diff --git a/.gitignore b/.gitignore index 5639a5425e..ac9936c872 100644 --- a/.gitignore +++ b/.gitignore @@ -9,16 +9,15 @@ # prebuild target binarys to provide /target/ -# scripts for getting and packing source packages -/tools/mkpkg/* -!/tools/mkpkg/mkpkg_* - # mkpkg temp mkpkg-temp # private working directory /.work/ +# dedicated filesystem +/lost+found/ + # symlinks... /sources /.work @@ -31,3 +30,4 @@ mkpkg-temp # crap .DS_Store +.directory diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06fefb4ba6..6ce7e12492 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ ### Questions about LibreELEC? To get your questions answered, please ask in the LibreELEC [Forum], on IRC: -\#libreelec on freenode.net, or [webchat]. +\#libreelec on freenode.net. Do not open an issue. @@ -104,8 +104,7 @@ Please follow this process; it's the best way to get your work included in the p - [Open a Pull Request](https://help.github.com/articles/using-pull-requests) with a clear title and description. -[Forum]: http://libreelec.tv/forum +[Forum]: https://forum.libreelec.tv/ [issue]: https://github.com/LibreELEC/LibreELEC.tv/issues -[webchat]: http://libreelec.tv/support/chat -[logfiles]: http://wiki.libreelec.tv/index.php?title=LibreELEC_FAQ#Support_Logs +[logfiles]: https://wiki.libreelec.tv/index.php?title=LibreELEC_FAQ#Support_Logs [similar issue]: https://github.com/LibreELEC/LibreELEC.tv/search?&ref=cmdform&type=Issues diff --git a/Makefile b/Makefile index 7fad4973f7..1cf38d2aba 100644 --- a/Makefile +++ b/Makefile @@ -24,4 +24,7 @@ distclean: rm -rf ./.ccache ./$(BUILD_DIRS) src-pkg: - tar cvjf sources.tar.bz2 sources .stamps + tar cvJf sources.tar.xz sources .stamps + +docker: + docker run --name rasplex-build -v"$$(pwd)"://app --entrypoint '/bin/sleep' -h rasplex-build -d rasplex-build infinity diff --git a/README.md b/README.md index 4a645cd0e3..7d9e00c19b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,23 @@ -# LibreELEC +# OpenPHT-Embedded + +OpenPHT-Embedded is a 'Just enough OS' Linux distribution for running [OpenPHT](https://github.com/RasPlex/OpenPHT) on popular mediacentre hardware. + +**Notes** -LibreELEC is a 'Just enough OS' Linux distribution for running the award-winning [Kodi](http://kodi.tv) software on popular mediacentre hardware. LibreELEC is a conservative fork of the popular [OpenELEC](http://openelec.tv) project with a stronger focus on pre-release testing and post-release change management. Further information on the project can be found on the [LibreELEC website](https://libreelec.tv). +* SSH login details are user: "root" password: "openpht" or "rasplex" depending on distribution. -**Issues & Support** +**Build** -Please report issues via the [LibreELEC forum: Bug Reports](http://forum.libreelec.tv/forum-35.html). Please ask support questions in the [LibreELEC forum: Help & Support](http://forum.libreelec.tv/forum-3.html) or ask a member of project staff in the #libreelec IRC channel on Freenode. +* `DISTRO=OpenPHT PROJECT=Generic ARCH=x86_64 make image` +* `DISTRO=RasPlex PROJECT=RPi2 ARCH=arm make image` +* `DISTRO=RasPlex PROJECT=RPi ARCH=arm make image` +* Use `OPENPHT_REPO`, `OPENPHT_SETTINGS_REPO` and `OPENPHT_BRANCH` to change what repository and branch of OpenPHT(-settings) to build + +# LibreELEC -**Donations** +**Source code** -Contributions towards current project funding goals can be sent via PayPal to donations@libreelec.tv +* https://github.com/LibreELEC/LibreELEC.tv **License** diff --git a/config/addon/xbmc.broken.xml b/config/addon/xbmc.broken.xml new file mode 100644 index 0000000000..3e41803130 --- /dev/null +++ b/config/addon/xbmc.broken.xml @@ -0,0 +1,35 @@ + + + + + +@REQUIRES@ + + + @PKG_ADDON_PROVIDES@ + + + @PKG_SHORTDESC@ + +@PKG_LONGDESC@ + + +@PKG_DISCLAIMER@ + + +@PKG_ADDON_BROKEN@ + + all + +@PKG_ADDON_NEWS@ + + + resources/icon.png + resources/fanart.png +@PKG_ADDON_SCREENSHOT@ + + + diff --git a/config/addon/xbmc.service.library.xml b/config/addon/xbmc.service.library.xml new file mode 100644 index 0000000000..f5a1aaefac --- /dev/null +++ b/config/addon/xbmc.service.library.xml @@ -0,0 +1,35 @@ + + + + + +@REQUIRES@ + + + @PKG_ADDON_PROVIDES@ + + + + + + @PKG_SHORTDESC@ + +@PKG_LONGDESC@ + + +@PKG_DISCLAIMER@ + + all + +@PKG_ADDON_NEWS@ + + + resources/icon.png + resources/fanart.png +@PKG_ADDON_SCREENSHOT@ + + + diff --git a/config/arch.aarch64 b/config/arch.aarch64 index ca435df80c..0d39f35a83 100644 --- a/config/arch.aarch64 +++ b/config/arch.aarch64 @@ -15,7 +15,7 @@ TARGET_VARIANT=armv8-a TARGET_ABI=eabi TARGET_EXTRA_FLAGS="-mcpu=${TARGET_CPU}${TARGET_CPU_FLAGS}" - SIMD_SUPPORT="yes" + TARGET_FEATURES+=" neon" ;; esac @@ -23,6 +23,6 @@ TARGET_KERNEL_ARCH=arm64 # setup ARCH specific *FLAGS - TARGET_CFLAGS="-march=${TARGET_VARIANT}${TARGET_CPU_FLAGS} -mabi=lp64 -Wno-psabi $TARGET_EXTRA_FLAGS" + TARGET_CFLAGS="-march=${TARGET_VARIANT}${TARGET_CPU_FLAGS} -mabi=lp64 -Wno-psabi -mtune=$TARGET_CPU $TARGET_EXTRA_FLAGS" TARGET_LDFLAGS="-march=${TARGET_VARIANT}${TARGET_CPU_FLAGS} -mtune=$TARGET_CPU" GCC_OPTS="--with-abi=lp64 --with-arch=$TARGET_VARIANT" diff --git a/config/arch.arm b/config/arch.arm index 9c56274b21..e9147e4c07 100644 --- a/config/arch.arm +++ b/config/arch.arm @@ -29,29 +29,36 @@ TARGET_ABI=eabi TARGET_EXTRA_FLAGS="-mcpu=$TARGET_CPU" TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU" - SIMD_SUPPORT="no" ;; - cortex-a7|cortex-a15|cortex-a15.cortex-a7|cortex-a17.cortex-a7) + cortex-a7|cortex-a15|cortex-a17|cortex-a15.cortex-a7|cortex-a17.cortex-a7) TARGET_SUBARCH=armv7ve TARGET_ABI=eabi TARGET_EXTRA_FLAGS="-mcpu=$TARGET_CPU" TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU" - SIMD_SUPPORT="yes" + TARGET_FEATURES+=" neon" ;; cortex-a5|cortex-a8|cortex-a9) TARGET_SUBARCH=armv7-a TARGET_ABI=eabi TARGET_EXTRA_FLAGS="-mcpu=$TARGET_CPU" TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU" - SIMD_SUPPORT="yes" + TARGET_FEATURES+=" neon" + ;; + cortex-a53|cortex-a72.cortex-a53) + TARGET_SUBARCH=armv8-a + TARGET_ABI=eabi + TARGET_EXTRA_FLAGS="-mcpu=${TARGET_CPU}" + TARGET_FPU_FLAGS="-mfloat-abi=$TARGET_FLOAT -mfpu=$TARGET_FPU" + TARGET_FEATURES+=" neon" ;; esac + TARGET_VARIANT="${TARGET_SUBARCH}${TARGET_CPU_FLAGS}" TARGET_GCC_ARCH=${TARGET_SUBARCH/-} - TARGET_KERNEL_ARCH=arm + TARGET_KERNEL_ARCH=${TARGET_KERNEL_ARCH:-arm} # setup ARCH specific *FLAGS - TARGET_CFLAGS="-march=$TARGET_SUBARCH -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated $TARGET_EXTRA_FLAGS" + TARGET_CFLAGS="-march=$TARGET_VARIANT -mtune=$TARGET_CPU -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated $TARGET_EXTRA_FLAGS" [ -n "$TARGET_FPU" ] && TARGET_CFLAGS="$TARGET_CFLAGS $TARGET_FPU_FLAGS" - TARGET_LDFLAGS="-march=$TARGET_SUBARCH -mtune=$TARGET_CPU" + TARGET_LDFLAGS="-march=$TARGET_VARIANT -mtune=$TARGET_CPU" GCC_OPTS="--with-abi=aapcs-linux --with-arch=$TARGET_SUBARCH --with-float=$TARGET_FLOAT --with-fpu=$TARGET_FPU" diff --git a/config/arch.x86_64 b/config/arch.x86_64 index 7787b04904..a7d1b39587 100644 --- a/config/arch.x86_64 +++ b/config/arch.x86_64 @@ -6,12 +6,12 @@ # determine architecture's family TARGET_SUBARCH=x86_64 - TARGET_GCC_ARCH=$(echo $TARGET_SUBARCH | sed -e "s,-,,") + TARGET_GCC_ARCH="${TARGET_SUBARCH/-/}" TARGET_KERNEL_ARCH=x86 # setup ARCH specific *FLAGS - TARGET_CFLAGS="-march=$TARGET_CPU -m64" + TARGET_CFLAGS="-march=$TARGET_CPU -m64 -mmmx -msse -msse2 -mfpmath=sse" TARGET_LDFLAGS="-march=$TARGET_CPU -m64" # build with SIMD support ( yes / no ) - SIMD_SUPPORT="yes" + TARGET_FEATURES+=" mmx sse sse2" diff --git a/config/docker/package.mk b/config/docker/package.mk index 91d7fcb5ed..fd963a65df 100644 --- a/config/docker/package.mk +++ b/config/docker/package.mk @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="@NAME@" PKG_VERSION="@VERSION@" # Update bin/docker.@NAME@ accordingly diff --git a/config/docker/source/bin/docker b/config/docker/source/bin/docker index c003a413f7..8a2c39672d 100644 --- a/config/docker/source/bin/docker +++ b/config/docker/source/bin/docker @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) name="$(basename $0)" . /etc/profile diff --git a/config/docker/source/default.py b/config/docker/source/default.py index 6c6b84a8a5..0b9d649ccd 100644 --- a/config/docker/source/default.py +++ b/config/docker/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/config/functions b/config/functions index c74cdd340b..5c2e701cc9 100644 --- a/config/functions +++ b/config/functions @@ -1,4 +1,228 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +### FUNCTION HELPERS ### +# die (message, code) abort with optional message and code +die() { + if [ -n "$1" ]; then + echo -e "$1" >&2 + fi + exit "${2:-1}" +} + +# return 0 if $2 in space-separated list $1, otherwise return 1 +listcontains() { + if [ -n "$1" -a -n "$2" ]; then + [[ ${1} =~ (^|[[:space:]])${2}($|[[:space:]]) ]] && return 0 || return 1 + else + return 1 + fi +} + +# remove item(s) from list. +# looping makes it greedy (eg. listremoveitem "abc def ghi" "(abc|def)" removes both "abc" and "def"). +listremoveitem() { + local data="${1}" odata tmp_array + if [ -n "$1" -a -n "$2" ]; then + while [ : ]; do + odata="${data}" + data="$(echo "${data}" | sed -E "s (^|[[:space:]])${2}($|[[:space:]]) \ g")" + [ "${odata}" = "${data}" ] && break + done + fi + # Use array word splitting to squash spaces + tmp_array=(${data}) + echo "${tmp_array[@]}" +} + +print_color() { + local clr_name="$1" clr_text="$2" clr_actual + local black red green yellow blue magenta cyan white endcolor + local boldblack boldred boldgreen boldyellow boldblue boldmagenta boldcyan boldwhite + + [ -z "${clr_name}" ] && return 0 + + if [ "$DISABLE_COLORS" = "yes" ]; then + [ $# -eq 2 ] && echo -en "${clr_text}" + return 0 + fi + + black="\e[0;30m" + boldblack="\e[1;30m" + red="\e[0;31m" + boldred="\e[1;31m" + green="\e[0;32m" + boldgreen="\e[1;32m" + yellow="\e[0;33m" + boldyellow="\e[1;33m" + blue="\e[0;34m" + boldblue="\e[1;34m" + magenta="\e[0;35m" + boldmagenta="\e[1;35m" + cyan="\e[0;36m" + boldcyan="\e[1;36m" + white="\e[0;37m" + boldwhite="\e[1;37m" + endcolor="\e[0m" + + # $clr_name can be a color variable (boldgreen etc.) or a + # "standard" color determined by an indirect name (CLR_ERROR etc.) + # + # If ${!clr_name} doesn't exist then assume it's a standard color. + # If ${!clr_name} does exist then check it's not a custom color mapping. + # Custom color mappings can be configured in options files. + # + clr_actual="${!clr_name}" + + if [ -n "${clr_actual}" ]; then + clr_actual="${!clr_actual}" + else + case "${clr_name}" in + CLR_ERROR) clr_actual="${boldred}";; + CLR_WARNING) clr_actual="${boldred}";; + CLR_WARNING_DIM) clr_actual="${red}";; + + CLR_APPLY_PATCH) clr_actual="${boldgreen}";; + CLR_AUTORECONF) clr_actual="${boldmagenta}";; + CLR_BUILD) clr_actual="${boldyellow}";; + CLR_TOOLCHAIN) clr_actual="${boldmagenta}";; + CLR_CLEAN) clr_actual="${boldred}";; + CLR_FIXCONFIG) clr_actual="${boldyellow}";; + CLR_GET) clr_actual="${boldcyan}";; + CLR_INFO) clr_actual="${boldgreen}";; + CLR_INSTALL) clr_actual="${boldgreen}";; + CLR_PATCH_DESC) clr_actual="${boldwhite}";; + CLR_TARGET) clr_actual="${boldwhite}";; + CLR_UNPACK) clr_actual="${boldcyan}";; + + CLR_ENDCOLOR) clr_actual="${endcolor}";; + + *) clr_actual="${endcolor}";; + esac + fi + + if [ $# -eq 2 ]; then + echo -en "${clr_actual}${clr_text}${endcolor}" + else + echo -en "${clr_actual}" + fi +} + +# print build progress messages +# param1: message color, p2: label, p3: text, p4: indent (optional) +build_msg() { + local spaces + + [ -n "${BUILD_INDENT}" ] && spaces="$(printf "%${BUILD_INDENT}c" " ")" || spaces="" + + if [ -n "${3}" ]; then + echo -e "${spaces}$(print_color "${1}" "${2}") ${3}" >&${SILENT_OUT} + else + echo -e "${spaces}$(print_color "${1}" "${2}")" >&${SILENT_OUT} + fi + + # pad left space to create "indent" effect + if [ "${4}" = "indent" ]; then + export BUILD_INDENT=$((${BUILD_INDENT:-0}+${BUILD_INDENT_SIZE})) + elif [ -n "${4}" ]; then + die "ERROR: ${0} unexpected parameter: ${4}" + fi +} + + +### BUILDSYSTEM HELPERS ### +# check if a flag is enabled +# $1: flag-name, $2: default (yes/no), $3: ingenious check (none,only-disable,only-enable) +# set variable PKG_[FLAG]_[HOST/TARGET]_ENABLED=(yes/no) +# return 0 if flag is enabled, otherwise 1 +flag_enabled() { + # make flag name upper case and replace hyphen with underscore, to use as variable name + local flag_name=${1^^} + [[ $flag_name =~ : ]] || flag_name+="_TARGET" + flag_name="PKG_${flag_name//[:-]/_}_ENABLED" + + # check flag + if [ -n "${PKG_BUILD_FLAGS}" ] && listcontains "${PKG_BUILD_FLAGS}" "[+]?$1"; then + if [ "${3:none}" = "only-disable" ]; then + die "ERROR: $1 cannot enable via PKG_BUILD_FLAGS (found in $PKG_NAME)" + fi + declare ${flag_name}="yes" + return 0 + elif [ "$2" = "yes" ] && ! listcontains "${PKG_BUILD_FLAGS}" "-$1"; then + declare ${flag_name}="yes" + return 0 + else + if [ "${3:none}" = "only-enable" ]; then + die "ERROR: $1 cannot disable via PKG_BUILD_FLAGS (found in $PKG_NAME)" + fi + declare ${flag_name}="no" + return 1 + fi +} + setup_toolchain() { + if [ "$LTO_SUPPORT" = "yes" ]; then + if flag_enabled "lto-parallel" "no"; then + TARGET_CFLAGS+=" $FLAGS_OPTIM_LTO_PARALLEL $FLAGS_OPTIM_LTO_NO_FAT" + TARGET_CXXFLAGS+=" $FLAGS_OPTIM_LTO_PARALLEL $FLAGS_OPTIM_LTO_NO_FAT" + TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_LTO_COMMON $FLAGS_OPTIM_LTO_PARALLEL" + elif flag_enabled "lto-fat" "no"; then + TARGET_CFLAGS+=" $FLAGS_OPTIM_LTO_NO_PARALLEL $FLAGS_OPTIM_LTO_FAT" + TARGET_CXXFLAGS+=" $FLAGS_OPTIM_LTO_NO_PARALLEL $FLAGS_OPTIM_LTO_FAT" + TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_LTO_COMMON $FLAGS_OPTIM_LTO_NO_PARALLEL" + elif flag_enabled "lto" "no"; then + TARGET_CFLAGS+=" $FLAGS_OPTIM_LTO_NO_PARALLEL $FLAGS_OPTIM_LTO_NO_FAT" + TARGET_CXXFLAGS+=" $FLAGS_OPTIM_LTO_NO_PARALLEL $FLAGS_OPTIM_LTO_NO_FAT" + TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_LTO_COMMON $FLAGS_OPTIM_LTO_NO_PARALLEL" + fi + fi + + if flag_enabled "lto-off" "no"; then + TARGET_CFLAGS+=" $FLAGS_OPTIM_LTO_OFF" + TARGET_CXXFLAGS+=" $FLAGS_OPTIM_LTO_OFF" + TARGET_LDFLAGS+=" $FLAGS_OPTIM_LTO_OFF" + fi + + # gold flag + if flag_enabled "gold" "$GOLD_SUPPORT" "only-disable"; then + TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_GOLD" + fi + + # position-independent code + if flag_enabled "pic" "no"; then + TARGET_CFLAGS+=" $CFLAGS_OPTIM_PIC" + TARGET_CXXFLAGS+=" $CXXFLAGS_OPTIM_PIC" + TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_PIC" + fi + if flag_enabled "pic:host" "no"; then + HOST_CFLAGS+=" $CFLAGS_OPTIM_PIC" + HOST_CXXFLAGS+=" $CXXFLAGS_OPTIM_PIC" + HOST_LDFLAGS+=" $LDFLAGS_OPTIM_PIC" + fi + + # hardening support + if flag_enabled "hardening" "$HARDENING_SUPPORT"; then + TARGET_CFLAGS+=" $CFLAGS_OPTIM_HARDENING" + TARGET_CXXFLAGS+=" $CXXFLAGS_OPTIM_HARDENING" + TARGET_CFLAGS+=" $CPPFLAGS_OPTIM_HARDENING" + TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_HARDENING" + fi + + # parallel + if ! flag_enabled "parallel" "yes"; then + NINJA_OPTS="$NINJA_OPTS -j1" + export MAKEFLAGS="-j1" + else + NINJA_OPTS="$NINJA_OPTS -j$CONCURRENCY_MAKE_LEVEL" + export MAKEFLAGS="-j$CONCURRENCY_MAKE_LEVEL" + fi + + # verbose flag + if flag_enabled "verbose" "no"; then + NINJA_OPTS="$NINJA_OPTS -v" + export MAKEFLAGS="$MAKEFLAGS V=1 VERBOSE=1" + fi + case "$1" in target|init) export DESTIMAGE="target" @@ -17,16 +241,16 @@ setup_toolchain() { export CFLAGS="$TARGET_CFLAGS" export CXXFLAGS="$TARGET_CXXFLAGS" export LDFLAGS="$TARGET_LDFLAGS" - export PKG_CONFIG="$ROOT/$TOOLCHAIN/bin/pkg-config" + export PKG_CONFIG="$TOOLCHAIN/bin/pkg-config" export PKG_CONFIG_PATH="" export PKG_CONFIG_LIBDIR="$SYSROOT_PREFIX/usr/lib/pkgconfig:$SYSROOT_PREFIX/usr/share/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="$SYSROOT_PREFIX" export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 - export CMAKE_CONF=$ROOT/$TOOLCHAIN/etc/cmake-$TARGET_NAME.conf + export CMAKE_CONF=$TOOLCHAIN/etc/cmake-$TARGET_NAME.conf export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF -DCMAKE_INSTALL_PREFIX=/usr" if [ ! -f $CMAKE_CONF ] ; then - mkdir -p $ROOT/$TOOLCHAIN/etc + mkdir -p $TOOLCHAIN/etc echo "SET(CMAKE_SYSTEM_NAME Linux)" >> $CMAKE_CONF echo "SET(CMAKE_SYSTEM_VERSION 1)" >> $CMAKE_CONF echo "SET(CMAKE_SYSTEM_PROCESSOR $TARGET_ARCH)" >> $CMAKE_CONF @@ -39,8 +263,8 @@ setup_toolchain() { echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> $CMAKE_CONF echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)" >> $CMAKE_CONF fi - export HOST_CC="$ROOT/$TOOLCHAIN/bin/host-gcc" - export HOST_CXX="$ROOT/$TOOLCHAIN/bin/host-g++" + export HOST_CC="$TOOLCHAIN/bin/host-gcc" + export HOST_CXX="$TOOLCHAIN/bin/host-g++" export HOSTCC="$HOST_CC" export HOSTCXX="$HOST_CXX" export CC_FOR_BUILD="$HOST_CC" @@ -54,8 +278,8 @@ setup_toolchain() { host|bootstrap) export DESTIMAGE="host" export AWK="gawk" - export CC="$ROOT/$TOOLCHAIN/bin/host-gcc" - export CXX="$ROOT/$TOOLCHAIN/bin/host-g++" + export CC="$TOOLCHAIN/bin/host-gcc" + export CXX="$TOOLCHAIN/bin/host-g++" export CPP="cpp" export LD="ld" export AS="as" @@ -69,23 +293,24 @@ setup_toolchain() { export CFLAGS="$HOST_CFLAGS" export CXXFLAGS="$HOST_CXXFLAGS" export LDFLAGS="$HOST_LDFLAGS" - export PKG_CONFIG="$ROOT/$TOOLCHAIN/bin/pkg-config" + export PKG_CONFIG="$TOOLCHAIN/bin/pkg-config" export PKG_CONFIG_PATH="" - export PKG_CONFIG_LIBDIR="$ROOT/$TOOLCHAIN/lib/pkgconfig:$ROOT/$TOOLCHAIN/share/pkgconfig" + export PKG_CONFIG_LIBDIR="$TOOLCHAIN/lib/pkgconfig:$TOOLCHAIN/share/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="" unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS unset PKG_CONFIG_ALLOW_SYSTEM_LIBS - export CMAKE_CONF=$ROOT/$TOOLCHAIN/etc/cmake-$HOST_NAME.conf - export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF -DCMAKE_INSTALL_PREFIX=$ROOT/$TOOLCHAIN" + export CMAKE_CONF=$TOOLCHAIN/etc/cmake-$HOST_NAME.conf + export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF -DCMAKE_INSTALL_PREFIX=$TOOLCHAIN" if [ ! -f $CMAKE_CONF ] ; then mkdir -p $TOOLCHAIN/etc echo "SET(CMAKE_SYSTEM_NAME Linux)" >> $CMAKE_CONF echo "SET(CMAKE_SYSTEM_VERSION 1)" >> $CMAKE_CONF + echo "SET(CMAKE_SYSTEM_PROCESSOR ${MACHINE_HARDWARE_NAME})" >> $CMAKE_CONF echo "SET(CMAKE_C_COMPILER $CC)" >> $CMAKE_CONF echo "SET(CMAKE_CXX_COMPILER $CXX)" >> $CMAKE_CONF echo "SET(CMAKE_CPP_COMPILER $CXX)" >> $CMAKE_CONF echo "SET(CMAKE_AR $AR CACHE FILEPATH "Archiver")" >> $CMAKE_CONF # hum? - echo "SET(CMAKE_FIND_ROOT_PATH $ROOT/$TOOLCHAIN)" >> $CMAKE_CONF + echo "SET(CMAKE_FIND_ROOT_PATH $TOOLCHAIN)" >> $CMAKE_CONF echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)" >> $CMAKE_CONF echo "SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)" >> $CMAKE_CONF echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)" >> $CMAKE_CONF @@ -99,428 +324,895 @@ setup_toolchain() { export CXX_FOR_BUILD="$CXX" export BUILD_CC="$CC" export BUILD_CXX="$CXX" + export _python_sysroot="$TOOLCHAIN" + export _python_prefix=/ + export _python_exec_prefix=/ ;; esac } -kernel_path() { - if [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then - . $ROOT/projects/$PROJECT/packages/linux/package.mk - else - . $ROOT/packages/linux/package.mk - fi +create_meson_conf() { + local endian root properties + case "$1" in + target|init) endian="little" + root="$SYSROOT_PREFIX/usr" + ;; + host|bootstrap) endian="big" + root="$TOOLCHAIN" + ;; + esac - echo $ROOT/$BUILD/${PKG_NAME}-${PKG_VERSION} + properties="PKG_MESON_PROPERTIES_${1^^}" + + cat > $2 </dev/null) - if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then - . $_PKG_DIR/package.mk +# strip +debug_strip() { + if [ -z "${BUILD_WITH_DEBUG}" ]; then + die "ERROR: debug_strip() must not be called without configuring BUILD_WITH_DEBUG" + fi + + if [ "${BUILD_WITH_DEBUG}" != "yes" ] && flag_enabled "strip" "yes"; then + find $* -type f -executable | xargs $STRIP 2>/dev/null || : + fi +} + +init_package_cache() { + local _ANCHOR="@?+?@" DIR + local temp_global temp_local + + # If the package caches are unset, then populate them + if [ -z "${_CACHE_PACKAGE_LOCAL}" -o -z "${_CACHE_PACKAGE_GLOBAL}" ]; then + temp_global="$(mktemp)" + temp_local="$(mktemp)" + + # cache project/device folder for a package + if [ -n $DEVICE ]; then + for DIR in $(find $ROOT/projects/$PROJECT/devices/$DEVICE/packages -type d 2>/dev/null); do + [ -r "$DIR/package.mk" ] && echo "${DIR}${_ANCHOR}" >> "${temp_local}" + done + fi + + # cache project folder for a package + for DIR in $(find $ROOT/projects/$PROJECT/packages -type d 2>/dev/null); do + [ -r "$DIR/package.mk" ] && echo "${DIR}${_ANCHOR}" >> "${temp_local}" + done + + # cache packages folder + for DIR in $(find $ROOT/$PACKAGES -type d 2>/dev/null); do + [ -r "$DIR/package.mk" ] && echo "${DIR}${_ANCHOR}" >> "${temp_global}" + done + + _CACHE_PACKAGE_LOCAL="${BUILD}/.cache_package_local" + _CACHE_PACKAGE_GLOBAL="${BUILD}/.cache_package_global" + export _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL + + # overwrite existing cache files only when they are invalid, or not yet created + mkdir -p "$(dirname "${_CACHE_PACKAGE_GLOBAL}")" + if [ -f "${_CACHE_PACKAGE_LOCAL}" ] && cmp -s "${temp_local}" "${_CACHE_PACKAGE_LOCAL}"; then + rm "${temp_local}" else - local _PKG_DIR=$(find $ROOT/packages -name $1 2>/dev/null) - if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then - . $_PKG_DIR/package.mk - fi + mv "${temp_local}" "${_CACHE_PACKAGE_LOCAL}" fi + if [ -f "${_CACHE_PACKAGE_GLOBAL}" ] && cmp -s "${temp_global}" "${_CACHE_PACKAGE_GLOBAL}"; then + rm "${temp_global}" + else + mv "${temp_global}" "${_CACHE_PACKAGE_GLOBAL}" + fi + fi - echo $ROOT/$BUILD/${PKG_NAME}-${PKG_VERSION} + if [ -z "${_DEBUG_DEPENDS_LIST+x}" ]; then + set_debug_depends fi } -get_pkg_version() { - if [ ! -z $1 ] ; then - cd $ROOT - . config/options $1 - echo "$PKG_VERSION" +load_build_config() { + if [ -d "${1}" -a -f ${1}/.build.conf ]; then + source ${1}/.build.conf + return 0 fi + return 1 } -tolower(){ - echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz +save_build_config() { + local var + mkdir -p ${BUILD} + rm -f ${BUILD}/.build.conf + for var in PROJECT DEVICE ARCH DEBUG BUILD_SUFFIX; do + echo "export ${var}=\"${!var}\"" >> ${BUILD}/.build.conf + done } -require_eglibc() { - if [ "$TARGET_LIBC" != eglibc ]; then - echo "$1 requires eglibc, aborting." - exit 1 +check_path() { + local dashes="===========================" path_err_msg + if [ "${PWD##/usr}" != "${PWD}" ]; then + path_err_msg="\n $dashes$dashes$dashes" + path_err_msg="${path_err_msg}\n ERROR: Detected building inside /usr" + path_err_msg="${path_err_msg}\n $dashes$dashes$dashes" + path_err_msg="${path_err_msg}\n This is not supported with our buildsystem." + path_err_msg="${path_err_msg}\n Please use another dir (for example your \$HOME) to build ${DISTRONAME}" + + die "${path_err_msg}" fi } -add_user() { - # Usage: add_user "username" "password" "userid" "groupid" "description" "home" "shell" - mkdir -p ${INSTALL}/etc - touch ${INSTALL}/etc/passwd - if [ -z "`grep "$1:" ${INSTALL}/etc/passwd`" ]; then - echo "$1:x:$3:$4:$5:$6:$7" >> ${INSTALL}/etc/passwd +check_distro() { + local dashes="===========================" distro_err_msg + if [ -z "${DISTRO}" -o ! -d "${DISTRO_DIR}/${DISTRO}" ]; then + distro_err_msg="\n $dashes$dashes$dashes" + distro_err_msg="${distro_err_msg}\n ERROR: Distro not found, use a valid distro or create a new config" + distro_err_msg="${distro_err_msg}\n $dashes$dashes$dashes" + distro_err_msg="${distro_err_msg}\n\n Valid distros:" + + for distros in ${DISTRO_DIR}/*; do + distro_err_msg="${distro_err_msg}\n - ${distros##*/}" + done + die "${distro_err_msg}" fi +} - touch ${INSTALL}/etc/shadow - PASSWORD="$2" - if [ "$PASSWORD" = "x" ]; then - PASSWORD="*" +check_project() { + local dashes="===========================" project_err_msg + if [ -z "${PROJECT}" -o ! -d "${PROJECT_DIR}/${PROJECT}" ]; then + project_err_msg="\n $dashes$dashes$dashes" + project_err_msg="${project_err_msg}\n ERROR: Project not found, use a valid project or create a new config" + project_err_msg="${project_err_msg}\n $dashes$dashes$dashes" + project_err_msg="${project_err_msg}\n\n Valid projects:" + + for projects in ${PROJECT_DIR}/*; do + project_err_msg="${project_err_msg}\n - ${projects##*/}" + done + die "${project_err_msg}" fi - if [ -z "`grep "$1:" ${INSTALL}/etc/shadow`" ]; then - echo "$1:$PASSWORD:::::::" >> ${INSTALL}/etc/shadow +} + +check_device() { + local dashes="===========================" device_err_msg + if [ \( -z "${DEVICE}" -a -d "${PROJECT_DIR}/${PROJECT}/devices" \) -o \ + \( -n "${DEVICE}" -a ! -d "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}" \) ]; then + device_err_msg="\n $dashes$dashes$dashes" + device_err_msg="${device_err_msg}\n ERROR: You need to specify a valid device for the $PROJECT project" + device_err_msg="${device_err_msg}\n $dashes$dashes$dashes" + device_err_msg="${device_err_msg}\n\n Valid devices for project: ${PROJECT}" + + for device in ${PROJECT_DIR}/${PROJECT}/devices/*; do + device_err_msg="${device_err_msg}\n - ${device##*/}" + done + die "${device_err_msg}" fi } -add_group() { - # Usage: add_group "groupname" "groupid" ("members") - mkdir -p ${INSTALL}/etc - touch ${INSTALL}/etc/group - if [ -z "`grep "$1:" ${INSTALL}/etc/group`" ]; then - echo "$1:x:$2:$3" >> ${INSTALL}/etc/group +check_arch() { + local dashes="===========================" arch_err_msg linux_config_dir + if [ -d ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ]; then + linux_config_dir="${PROJECT_DIR}/${PROJECT}/devices/$DEVICE/linux" + else + linux_config_dir="${PROJECT_DIR}/${PROJECT}/linux" + fi + + if [ ! -e $linux_config_dir/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf ] && + ! ls $linux_config_dir/*/linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf &>/dev/null; then + arch_err_msg="\n $dashes$dashes$dashes" + arch_err_msg="${arch_err_msg}\n ERROR: Architecture not found, use a valid Architecture" + arch_err_msg="${arch_err_msg}\n for your project or create a new config" + arch_err_msg="${arch_err_msg}\n $dashes$dashes$dashes" + arch_err_msg="${arch_err_msg}\n\n Valid Architectures for your project: ${PROJECT}" + + for arch in $linux_config_dir/*.conf $linux_config_dir/*/linux.$TARGET_ARCH.conf; do + [[ ${arch} =~ .*\*.* ]] && continue #ignore unexpanded wildcard + arch_err_msg="${arch_err_msg}\n - $(basename $arch | cut -f2 -d".")" + done + die "${arch_err_msg}" fi } +check_config() { + check_path + check_distro + check_project + check_device + check_arch +} + do_autoreconf() { export ACLOCAL_DIR=$SYSROOT_PREFIX/usr/share/aclocal - if [ -e "$ROOT/$TOOLCHAIN/bin/autoconf" ]; then - export AUTOCONF=$ROOT/$TOOLCHAIN/bin/autoconf + if [ -e "$TOOLCHAIN/bin/autoconf" ]; then + export AUTOCONF=$TOOLCHAIN/bin/autoconf fi - if [ -e "$ROOT/$TOOLCHAIN/bin/automake" ]; then - export AUTOMAKE=$ROOT/$TOOLCHAIN/bin/automake + if [ -e "$TOOLCHAIN/bin/automake" ]; then + export AUTOMAKE=$TOOLCHAIN/bin/automake fi - if [ -e "$ROOT/$TOOLCHAIN/bin/autopoint" ]; then - export AUTOPOINT=$ROOT/$TOOLCHAIN/bin/autopoint + if [ -e "$TOOLCHAIN/bin/autopoint" ]; then + export AUTOPOINT=$TOOLCHAIN/bin/autopoint fi - if [ -e "$ROOT/$TOOLCHAIN/bin/libtoolize" ]; then - export LIBTOOLIZE=$ROOT/$TOOLCHAIN/bin/libtoolize + if [ -e "$TOOLCHAIN/bin/libtoolize" ]; then + export LIBTOOLIZE=$TOOLCHAIN/bin/libtoolize fi - if [ -e "$ROOT/$TOOLCHAIN/bin/intltoolize" ]; then - export INTLTOOLIZE=$ROOT/$TOOLCHAIN/bin/intltoolize + if [ -e "$TOOLCHAIN/bin/intltoolize" ]; then + export INTLTOOLIZE=$TOOLCHAIN/bin/intltoolize fi - if [ -e "$ROOT/$TOOLCHAIN/bin/aclocal" ]; then - export ACLOCAL="$ROOT/$TOOLCHAIN/bin/aclocal -I $ACLOCAL_DIR" + if [ -e "$TOOLCHAIN/bin/aclocal" ]; then + export ACLOCAL="$TOOLCHAIN/bin/aclocal -I $ACLOCAL_DIR" fi - if [ -e "$ROOT/$TOOLCHAIN/bin/autoheader" ]; then - export AUTOHEADER=$ROOT/$TOOLCHAIN/bin/autoheader + if [ -e "$TOOLCHAIN/bin/autoheader" ]; then + export AUTOHEADER=$TOOLCHAIN/bin/autoheader fi - if [ -e "$ROOT/$TOOLCHAIN/bin/libtool" ]; then - export LIBTOOL=$ROOT/$TOOLCHAIN/bin/libtool + if [ -e "$TOOLCHAIN/bin/libtool" ]; then + export LIBTOOL=$TOOLCHAIN/bin/libtool fi - if [ -e "$ROOT/$TOOLCHAIN/bin/autoreconf" -a -e "$INTLTOOLIZE" ]; then + if [ -e "$TOOLCHAIN/bin/autoreconf" -a -e "$INTLTOOLIZE" ]; then mkdir -p $ACLOCAL_DIR - export AUTORECONF="$ROOT/$TOOLCHAIN/bin/autoreconf --verbose --force --install -I $ACLOCAL_DIR" + if [ -e "$LIBTOOLIZE" ]; then + export AUTORECONF="$TOOLCHAIN/bin/autoreconf --verbose --force --install -I $ACLOCAL_DIR" + else + export AUTORECONF="$TOOLCHAIN/bin/autoreconf --verbose --force -I $ACLOCAL_DIR" + fi $AUTORECONF $@ fi } -strip_lto() { - # strip out LTO optimization from *FLAGS - if [ -n "$GCC_OPTIM_LTO" ] ; then - CFLAGS=`echo $CFLAGS | sed -e "s|$GCC_OPTIM_LTO||g"` - CXXFLAGS=`echo $CXXFLAGS | sed -e "s|$GCC_OPTIM_LTO||g"` - TARGET_CFLAGS=`echo $TARGET_CFLAGS | sed -e "s|$GCC_OPTIM_LTO||g"` - TARGET_CXXFLAGS=`echo $TARGET_CXXFLAGS | sed -e "s|$GCC_OPTIM_LTO||g"` - fi - if [ -n "$LD_OPTIM_LTO" ] ; then - LDFLAGS=`echo $LDFLAGS | sed -e "s|$LD_OPTIM_LTO||g"` - TARGET_LDFLAGS=`echo $TARGET_LDFLAGS | sed -e "s|$LD_OPTIM_LTO||g"` + +### PACKAGE HELPERS ### +# get variable ($2) for package ($1). +# avoid infinite recursion if required package is already loaded. +get_pkg_variable() { + if [ -n "$1" -a -n "$2" ] ; then + if [ "$1" != "$PKG_NAME" ]; then + source_package "${1}" + fi + echo "${!2}" fi } -strip_gold() { - # strip out usage from GOLD linker - LDFLAGS=`echo $LDFLAGS | sed -e "s|-fuse-ld=gold||g"` - TARGET_LDFLAGS=`echo $TARGET_LDFLAGS | sed -e "s|-fuse-ld=gold||g"` +# get package's build dir +get_build_dir() { + local _PKG_NAME="$(get_pkg_variable "$1" PKG_NAME)" _PKG_VERSION="$(get_pkg_version "$1")" + if [ -n "$_PKG_NAME" -a -n "$_PKG_VERSION" ]; then + echo $BUILD/${_PKG_NAME}-${_PKG_VERSION} + fi } -fix_module_depends() { - # modify .modinfo section in kernel module to depends on other required modules - local MODULE="$1" - local DEPENDS="$2" - local OLD_DEPENDS="" - cp ${MODULE} ${MODULE}_orig - $OBJDUMP -s -j .modinfo ${MODULE}_orig | awk 'BEGIN{v=0;} /Contents/ {v=1; next;} {if (v==1) print $0;}' >new.modinfo1 - cat new.modinfo1 | cut -c7-41 | awk '{printf($0);}' | sed 's/ //g;s/../\\\x&/g;' >new.modinfo2 - /bin/echo -ne `cat new.modinfo2` | tr '\000' '\n' >new.modinfo3 - cat new.modinfo3 | awk '/^depends=/ {next;} {print $0;}' | tr '\n' '\000' >new.modinfo - OLD_DEPENDS=$(awk '{FS="="} /depends=/ {print $2}' new.modinfo3) - [ -n "$OLD_DEPENDS" ] && DEPENDS="$OLD_DEPENDS,$DEPENDS" - /bin/echo -ne "depends=$DEPENDS\0" >>new.modinfo - $OBJCOPY --remove-section=.modinfo --add-section=.modinfo=new.modinfo --set-section-flags .modinfo=contents,alloc,load,readonly,data ${MODULE}_orig ${MODULE} - rm new.modinfo* +get_pkg_version() { + get_pkg_variable "$1" PKG_VERSION } -# Usage: enable_service [target] -enable_service () { - local unit="$1" - local unit_dir="/usr/lib/systemd/system" - local target="$2" - local target_dir=$INSTALL +get_pkg_directory() { + local _PKG_ROOT_NAME=${1%:*} _ALL_DIRS _FOUND=0 _ANCHOR="@?+?@" _PKG_DIR _DIR + + # Check for any available local package in preference to a global package + for _DIR in $(grep -F "/${_PKG_ROOT_NAME}${_ANCHOR}" "${_CACHE_PACKAGE_LOCAL}"); do + _DIR="${_DIR%${_ANCHOR}}" + # found first, set $_PKG_DIR + _PKG_DIR="$_DIR" + # keep track of dirs with package.mk for detecting multiple folders + _ALL_DIRS+="${_DIR}\n" + _FOUND=$((_FOUND+1)) + done - [ -f "$target_dir/$unit_dir/$unit" ] || exit 1 - if [ -z "$target" ] ; then - for target in `grep '^WantedBy' $target_dir/$unit_dir/$unit | cut -f2 -d=` ; do - if [ -n "$target" ]; then - mkdir -p ${target_dir}/$unit_dir/${target}.wants - ln -sf ../${unit} ${target_dir}/$unit_dir/${target}.wants/ - fi + # If there's no local package available, use the global package + if [ $_FOUND -eq 0 ]; then + for _DIR in $(grep -F "/${_PKG_ROOT_NAME}${_ANCHOR}" "${_CACHE_PACKAGE_GLOBAL}"); do + _DIR="${_DIR%${_ANCHOR}}" + # found first, set $_PKG_DIR + _PKG_DIR="$_DIR" + # keep track of dirs with package.mk for detecting multiple folders + _ALL_DIRS+="${_DIR}\n" + _FOUND=$((_FOUND+1)) done fi - for target in `grep '^Alias' $target_dir/$unit_dir/$unit | cut -f2 -d=` ; do - if [ -n "$target" ]; then - ln -sf ${unit} ${target_dir}/$unit_dir/${target} - fi - done -} - -check_path() { -dashes="===========================" - if [ "${PWD##/usr}" != "${PWD}" ]; then - check_pathmessage="$check_pathmessage\n $dashes$dashes$dashes" - check_pathmessage="$check_pathmessage\n ERROR: You try to build inside /usr" - check_pathmessage="$check_pathmessage\n $dashes$dashes$dashes" - check_pathmessage="$check_pathmessage\n This is not supported with our buildsystem." - check_pathmessage="$check_pathmessage\n Please use another dir (for example your \$HOME) to build $DISTRONAME" - echo -e $check_pathmessage - exit 1 + # _FOUND multiple packages? fail + if [ $_FOUND -gt 1 ]; then + echo "Error - multiple package folders for package ${_PKG_ROOT_NAME}:" >&2 + echo -e "$_ALL_DIRS" >&2 + die fi + + echo "$_PKG_DIR" } -check_config() { -dashes="===========================" - if [ ! -d $PROJECT_DIR/$PROJECT ]; then - check_project="$check_project\n $dashes$dashes$dashes" - check_project="$check_project\n ERROR: Project not found, use a valid project or create a new config" - check_project="$check_project\n $dashes$dashes$dashes" - check_project="$check_project\n\n Valid projects:" - - for projects in $PROJECT_DIR/*; do - check_project="$check_project\n - $(basename $projects)" - done - echo -e $check_project - exit 1 - fi +calculate_stamp() { + local stamp + stamp="$PKG_DIR $PROJECT_DIR/$PROJECT/patches/$PKG_NAME" + [ -n "$DEVICE" ] && stamp+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME" + [ -n "$PKG_NEED_UNPACK" ] && stamp+=" $PKG_NEED_UNPACK" + find ${stamp} -exec sha256sum {} \; 2>/dev/null | sed "s/ ${ROOT//\//\\/}\// /" | sort | sha256sum | cut -d" " -f1 +} - if [ \( -z "$DEVICE" -a -d "$PROJECT_DIR/$PROJECT/devices" \) -o \( -n "$DEVICE" -a ! -d "$PROJECT_DIR/$PROJECT/devices/$DEVICE" \) ]; then - check_device="$check_device\n $dashes$dashes$dashes" - check_device="$check_device\n ERROR: You need to specify a valid device for the $PROJECT project" - check_device="$check_device\n $dashes$dashes$dashes" - check_device="$check_device\n\n Valid devices for project: $PROJECT" +target_has_feature() { + listcontains "$TARGET_FEATURES" "$1" +} - for device in $PROJECT_DIR/$PROJECT/devices/*; do - check_device="$check_device\n - $(basename $device)" - done - echo -e $check_device - exit 1 +# find path for matching file or directory, searching standard directory hierarchy, using optional default +# if a path is located it will be set in FOUND_PATH and exit code will be 0. +find_path() { + local test_func="$1" search="$2" default="$3" + local dir match wildcard=0 ftype + + # support wildcard matches + [[ $search =~ \* || $search =~ \? ]] && wildcard=1 + + [ "$test_func" = "-f" ] && ftype="file" || ftype="dir" + + for dir in $PROJECT_DIR/$PROJECT/devices/$DEVICE/packages/$PKG_NAME \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE \ + $PROJECT_DIR/$PROJECT/packages/$PKG_NAME \ + $PROJECT_DIR/$PROJECT \ + $DISTRO_DIR/$DISTRO/packages/$PKG_NAME \ + $DISTRO_DIR/$DISTRO \ + $PKG_DIR \ + ; do + # ignore directories with missing DEVICE or PKG_NAME components + [[ $dir =~ /packages/$ ]] && continue + [[ $dir =~ /devices/$ ]] && continue + [[ $dir =~ /devices//packages/$PKG_NAME$ ]] && continue + + if [ $wildcard -eq 1 ]; then + ls $dir/$search 1>/dev/null 2>&1 && match="$dir/$search" && break + else + [ $test_func "$dir/$search" ] && match="$dir/$search" && break + fi + done + + if [ -z "$match" -a -n "$default" ]; then + if [[ $default =~ \* || $default =~ \? ]]; then + ls $default 1>/dev/null 2>&1 && match="$default" + else + [ $test_func "$default" ] && match="$default" + fi fi - if [ -d $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux ]; then - linux_config_dir="$PROJECT_DIR/$PROJECT/devices/$DEVICE/linux" + if [ -n "$match" ]; then + FOUND_PATH="$match" + [ "${VERBOSE_FIND_PATH,,}" = "yes" ] && echo "find_path: Searching for $ftype: \"$search\", found: \"$FOUND_PATH\"" >&2 + return 0 else - linux_config_dir="$PROJECT_DIR/$PROJECT/linux" + unset FOUND_PATH + [ "${VERBOSE_FIND_PATH,,}" = "yes" ] && echo "find_path: Searching for $ftype: \"$search\" - not found" >&2 + return 1 fi +} - if [ ! -f $linux_config_dir/linux.$TARGET_ARCH.conf ] && - ! ls $linux_config_dir/*/linux.$TARGET_ARCH.conf &>/dev/null; then - check_arch="$check_arch\n $dashes$dashes$dashes" - check_arch="$check_arch\n ERROR: Architecture not found, use a valid Architecture" - check_arch="$check_arch\n for your project or create a new config" - check_arch="$check_arch\n $dashes$dashes$dashes" - check_arch="$check_arch\n\n Valid Architectures for your project: $PROJECT" +find_file_path() { + find_path -f "$1" "$2" +} - for arch in $linux_config_dir/*.conf $linux_config_dir/*/linux.$TARGET_ARCH.conf; do - check_arch="$check_arch\n - $(basename $arch | cut -f2 -d".")" - done - echo -e $check_arch - exit 1 - fi +find_dir_path() { + find_path -d "$1" "$2" } -show_config() { - # load graphic configuration - get_graphicdrivers +# p1: name of function to test for +# return 0 if function exists, 1 if not +pkg_call_exists() { + [ "$(type -t ${1})" = "function" ] && return 0 || return 1 +} - dashes="===========================" - config_message="$config_message\n $dashes$dashes$dashes" - config_message="$config_message\n Configuration for $DISTRONAME ($([ "$OFFICIAL" = "yes" ] && echo "official" || echo "community"))" - config_message="$config_message\n $dashes$dashes$dashes" +# p1: name of function to execute unconditionally +# testing the exit code value of this function is likely to break set -e fail-on-error behaviour +pkg_call() { + [ -n "${PKG_NAME}" ] || die "$(print_color CLR_ERROR "FAILURE: Cannot call ${1} package function when package is not known!")" - # Build options + ${1} +} - config_message="$config_message\n\n Buildoptions:" - config_message="$config_message\n $dashes$dashes" +unset_functions() { + local target - config_message="$config_message\n - CPU (ARCH):\t\t\t\t $TARGET_CPU ($TARGET_ARCH)" - config_message="$config_message\n - FLOAT:\t\t\t\t $TARGET_FLOAT" - config_message="$config_message\n - FPU:\t\t\t\t\t $TARGET_FPU" - config_message="$config_message\n - SIMD support:\t\t\t $SIMD_SUPPORT" - config_message="$config_message\n - LTO (Link Time Optimization) support: $LTO_SUPPORT" - config_message="$config_message\n - GOLD (Google Linker) Support:\t $GOLD_SUPPORT" - config_message="$config_message\n - LLVM support:\t\t\t $LLVM_SUPPORT" + unset -f configure_package - # config_message="$config_message\n - CFLAGS:\t $TARGET_CFLAGS" - # config_message="$config_message\n - LDFLAGS:\t $TARGET_LDFLAGS" + unset -f pre_unpack unpack post_unpack + unset -f pre_patch post_patch - # Graphic configuration + for target in target host init bootstrap; do + unset -f pre_build_${target} + unset -f pre_configure_${target} configure_${target} post_configure_${target} + unset -f pre_make_${target} make_${target} post_make_${target} + unset -f pre_makeinstall_${target} makeinstall_${target} post_makeinstall_${target} + done - config_message="$config_message\n\n Graphic configuration:" - config_message="$config_message\n $dashes$dashes" + unset -f pre_install post_install - if [ "$DISPLAYSERVER" = "x11" ] ; then - config_message="$config_message\n - Xorg Graphic Drivers:\t\t $GRAPHIC_DRIVERS" - config_message="$config_message\n - XORG Composite support:\t\t $COMPOSITE_SUPPORT" - config_message="$config_message\n - WindowManager:\t\t\t $WINDOWMANAGER" - fi - config_message="$config_message\n - OpenGL (GLX) support (provider):\t $OPENGL_SUPPORT ($OPENGL)" - config_message="$config_message\n - OpenGLES support (provider):\t\t $OPENGLES_SUPPORT ($OPENGLES)" - config_message="$config_message\n - uvesafb support:\t\t\t $UVESAFB_SUPPORT" + unset -f addon +} - # Hardware decoder support +# p1: name of package to be sourced +source_package() { + local opwd="${PWD}" - config_message="$config_message\n\n Hardware decoder configuration:" - config_message="$config_message\n $dashes$dashes" + # Don't use BUILD_WITH_DEBUG in "global" package.mk - instead, call the function + # build_with_debug() directly as the function depends on various package.mk + # variables that will be in the process of being configured. Once package.mk is + # fully sourced we can set this variable and use it in situations where we know the + # package has already been sourced. + unset BUILD_WITH_DEBUG - config_message="$config_message\n - Kodi Player driver:\t\t\t $KODIPLAYER_DRIVER" - config_message="$config_message\n - VAAPI Support:\t\t\t $VAAPI_SUPPORT" - config_message="$config_message\n - VDPAU Support:\t\t\t $VDPAU_SUPPORT" + reset_pkg_vars + unset_functions - # Input device configuration + if [ -n "${1}" ]; then + PKG_DIR="$(get_pkg_directory ${1})" - config_message="$config_message\n\n Input device configuration:" - config_message="$config_message\n $dashes$dashes" + [ -n "$PKG_DIR" -a -r $PKG_DIR/package.mk ] || die "FAILURE: unable to source package - ${1}/package.mk does not exist" - config_message="$config_message\n - Remote support:\t\t\t $REMOTE_SUPPORT" - config_message="$config_message\n - ATV Remote support:\t\t\t $ATVCLIENT_SUPPORT" - config_message="$config_message\n - CEC Adapter support:\t\t\t $CEC_SUPPORT" - config_message="$config_message\n - Kodi Joystick support:\t\t $JOYSTICK_SUPPORT" + cd "${ROOT}" + . ${PKG_DIR}/package.mk || die "FAILURE: an error occurred while sourcing ${PKG_DIR}/package.mk" + cd "${opwd}" - # Misc. hardware configuration + PKG_SHORTDESC="${PKG_SHORTDESC:-${PKG_NAME} (autogenerated)}" + PKG_LONGDESC="${PKG_LONGDESC:-${PKG_NAME} (autogenerated)}" - config_message="$config_message\n\n Misc. hardware configuration:" - config_message="$config_message\n $dashes$dashes" + if [ "$PKG_IS_ADDON" = "yes" -o "$PKG_IS_ADDON" = "embedded" ] ; then + [ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="${PKG_SECTION//\//.}.$PKG_NAME" + [ "$PKG_ADDON_IS_STANDALONE" != "yes" ] && PKG_NEED_UNPACK="${PKG_NEED_UNPACK} $(get_pkg_directory $MEDIACENTER)" + fi - config_message="$config_message\n - ALSA support:\t\t\t $ALSA_SUPPORT" - config_message="$config_message\n - Pulseaudio support:\t\t\t $PULSEAUDIO_SUPPORT" - config_message="$config_message\n - Bluetooth support:\t\t\t $BLUETOOTH_SUPPORT" + # Automatically set PKG_SOURCE_NAME unless it is already defined. + # PKG_SOURCE_NAME will be automatically set to a name based on + # the $PKG_NAME-$PKG_VERSION convention. + # + # Any $PKG_URL that references more than a single url will abort + # the build as these are no longer supported - use mkpkg instead. + if [ -n "$PKG_URL" -a -z "$PKG_SOURCE_NAME" ]; then + if [[ $PKG_URL =~ .*\ .* ]]; then + echo "Error - packages with multiple urls are no longer supported, use mkpkg." + echo "$PKG_URL" + die + fi + if [[ ${PKG_URL} =~ .git$ || ${PKG_URL} =~ ^git:// ]]; then + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION} + elif [[ ${PKG_URL} =~ ^file:// ]]; then + PKG_SOURCE_NAME=${PKG_URL#file://} + # if no specific PKG_TAR_COPY_OPTS then default to excluding .git and .svn as they can be huge + [ -z "${PKG_TAR_COPY_OPTS+x}" ] && PKG_TAR_COPY_OPTS="--exclude=.git --exclude=.svn" + else + PKG_SOURCE_NAME="${PKG_URL##*/}" + case $PKG_SOURCE_NAME in + ${PKG_NAME}-${PKG_VERSION}.*) + PKG_SOURCE_NAME=$PKG_SOURCE_NAME + ;; + *.tar | *.tbz | *.tgz | *.txz | *.7z | *.zip) + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.} + ;; + *.tar.bz2 | *.tar.gz | *.tar.xz) + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.tar.${PKG_SOURCE_NAME##*\.} + ;; + *.diff | *.patch | *.diff.bz2 | *.patch.bz2 | patch-*.bz2 | *.diff.gz | *.patch.gz | patch-*.gz) + PKG_SOURCE_NAME=$PKG_SOURCE_NAME + ;; + *) + PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.} + ;; + esac + fi + fi - for config_driver in $ADDITIONAL_DRIVERS; do - config_message="$config_message\n - Include driver:\t\t\t $config_driver" - done + PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" + fi - for config_firmware in $FIRMWARE; do - config_message="$config_message\n - Include firmware:\t\t\t $config_firmware" - done + build_with_debug && BUILD_WITH_DEBUG="yes" || BUILD_WITH_DEBUG="no" - for config_modules in $INITRAMFS_MODULES; do - config_message="$config_message\n - Initramfs modules:\t\t\t $config_modules" + # Late variable binding - allow the package to now evaluate any variables + # that we may have initialised after sourcing the package, typically + # PKG_BUILD etc. + if [ -n "${PKG_NAME}" ]; then + if pkg_call_exists configure_package; then + pkg_call configure_package + fi + fi +} + + +### KERNEL HELPERS ### +kernel_path() { + get_build_dir linux +} + +kernel_version() { + get_pkg_version linux +} + +kernel_config_path() { + local cfg pkg_linux_dir pkg_linux_version config_name + + pkg_linux_version="$(get_pkg_version linux)" + pkg_linux_dir="$(get_pkg_directory linux)" + + config_name="linux.${TARGET_PATCH_ARCH:-$TARGET_ARCH}.conf" + + for cfg in $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux/$pkg_linux_version/$config_name \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux/$LINUX/$config_name \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux/$config_name \ + $PROJECT_DIR/$PROJECT/linux/$pkg_linux_version/$config_name \ + $PROJECT_DIR/$PROJECT/linux/$LINUX/$config_name \ + $PROJECT_DIR/$PROJECT/linux/$config_name \ + $pkg_linux_dir/config/$pkg_linux_version/$config_name \ + $pkg_linux_dir/config/$LINUX/$config_name \ + $pkg_linux_dir/config/$config_name \ + ; do + [[ $cfg =~ /devices//linux/ ]] && continue + [ -f "$cfg" ] && echo "$cfg" && break done +} - # Network service configuration +kernel_make() { + LDFLAGS="" make CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + ARCH="$TARGET_KERNEL_ARCH" \ + HOSTCC="$TOOLCHAIN/bin/host-gcc" \ + HOSTCXX="$TOOLCHAIN/bin/host-g++" \ + HOSTCFLAGS="$HOST_CFLAGS" \ + HOSTLDFLAGS="$HOST_LDFLAGS" \ + HOSTCXXFLAGS="$HOST_CXXFLAGS" \ + DEPMOD="$TOOLCHAIN/bin/depmod" \ + "$@" +} - config_message="$config_message\n\n Network service configuration:" - config_message="$config_message\n $dashes$dashes" +# get kernel module dir +get_module_dir() { + if [ -n "${_CACHED_KERNEL_MODULE_DIR}" ]; then + echo "${_CACHED_KERNEL_MODULE_DIR}" + else + basename $(ls -d $(get_build_dir linux)/.install_pkg/usr/lib/kernel-overlays/base/lib/modules/*) + fi +} - config_message="$config_message\n - Avahi (Zeroconf) support:\t\t $AVAHI_DAEMON" - config_message="$config_message\n - NFS mounting support:\t\t $NFS_SUPPORT" - config_message="$config_message\n - SAMBA mounting support:\t\t $SAMBA_SUPPORT" - config_message="$config_message\n - SAMBA server support:\t\t $SAMBA_SERVER" - config_message="$config_message\n - SFTP server support:\t\t\t $SFTP_SERVER" - config_message="$config_message\n - OpenVPN support:\t\t\t $OPENVPN_SUPPORT" +# get base path to kernel modules and firmware +get_kernel_overlay_dir() { + echo "usr/lib/kernel-overlays/${1:-base}" +} - # OS configuration +# get full path to kernel module dir +# optional parameter specifies overlay level (default is base) +get_full_module_dir() { + echo "$(get_kernel_overlay_dir $1)/lib/modules/$(get_module_dir)" +} - config_message="$config_message\n\n OS configuration:" - config_message="$config_message\n $dashes$dashes" +# get full path to firmware dir +# optional parameter specifies overlay level (default is base) +get_full_firmware_dir() { + echo "$(get_kernel_overlay_dir $1)/lib/firmware" +} - config_message="$config_message\n - OEM Support:\t\t\t\t $OEM_SUPPORT" - config_message="$config_message\n - Default ROOT Password:\t\t $ROOT_PASSWORD" - config_message="$config_message\n - Bootloader:\t\t\t\t $BOOTLOADER" - if [ "$BOOTLOADER" = "u-boot" ]; then - config_message="$config_message\n - U-Boot configuration:\t\t $UBOOT_CONFIG" - config_message="$config_message\n - U-Boot config file:\t\t $UBOOT_CONFIGFILE" +fix_module_depends() { + # modify .modinfo section in kernel module to depends on other required modules + local MODULE="$1" + local DEPENDS="$2" + local OLD_DEPENDS="" + cp ${MODULE} ${MODULE}_orig + $OBJDUMP -s -j .modinfo ${MODULE}_orig | awk 'BEGIN{v=0;} /Contents/ {v=1; next;} {if (v==1) print $0;}' >new.modinfo1 + cat new.modinfo1 | cut -c7-41 | awk '{printf($0);}' | sed 's/ //g;s/../\\\x&/g;' >new.modinfo2 + /bin/echo -ne `cat new.modinfo2` | tr '\000' '\n' >new.modinfo3 + cat new.modinfo3 | awk '/^depends=/ {next;} {print $0;}' | tr '\n' '\000' >new.modinfo + OLD_DEPENDS=$(awk '{FS="="} /depends=/ {print $2}' new.modinfo3) + [ -n "$OLD_DEPENDS" ] && DEPENDS="$OLD_DEPENDS,$DEPENDS" + /bin/echo -ne "depends=$DEPENDS\0" >>new.modinfo + $OBJCOPY --remove-section=.modinfo --add-section=.modinfo=new.modinfo --set-section-flags .modinfo=contents,alloc,load,readonly,data ${MODULE}_orig ${MODULE} + rm new.modinfo* +} + + +### ADDON HELPERS ### +install_binary_addon() { + local addon_id="$1" addon_so + + mkdir -p $ADDON_BUILD/$addon_id/ + cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$addon_id/* $ADDON_BUILD/$addon_id/ + + addon_so=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$addon_id/addon.xml || :) + if [ -n "$addon_so" ]; then + cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$addon_id/$addon_so $ADDON_BUILD/$addon_id/ + chmod +x $ADDON_BUILD/$addon_id/$addon_so fi - config_message="$config_message\n - UDevil support:\t\t\t $UDEVIL" - config_message="$config_message\n - Installer support:\t\t\t $INSTALLER_SUPPORT" - # Misc. Filesystems + if [ -d $PKG_BUILD/.install_pkg/usr/lib/kernel-overlays/$addon_id ] ; then + mkdir -p $ADDON_BUILD/$addon_id/kernel-overlay + cp -PR $PKG_BUILD/.install_pkg/usr/lib/kernel-overlays/$addon_id/* $ADDON_BUILD/$addon_id/kernel-overlay + fi +} - config_message="$config_message\n\n Misc. Filesystems:" - config_message="$config_message\n $dashes$dashes" +install_addon_source() { + if [ -d $PKG_DIR/source ]; then + cp -R $PKG_DIR/source/* "$1" + fi +} - config_message="$config_message\n - Swap Support:\t\t\t $SWAP_SUPPORT" - if [ "$SWAP_SUPPORT" = "yes" ]; then - config_message="$config_message\n - Swapfile default size:\t\t $SWAPFILESIZE" +install_addon_images() { + local dest_dir="$1" + + if [ -f "$PKG_DIR/icon/icon.png" ]; then + mkdir -p "$dest_dir/resources" + cp "$PKG_DIR/icon/icon.png" "$dest_dir/resources" + fi + + if [ -f "$DISTRO_DIR/$DISTRO/addons/fanart.png" ]; then + mkdir -p "$dest_dir/resources" + cp "$DISTRO_DIR/$DISTRO/addons/fanart.png" "$dest_dir/resources" fi - config_message="$config_message\n - exFAT Support (via Fuse):\t\t $EXFAT" - config_message="$config_message\n - NTFS Support (via Fuse):\t\t $NTFS3G" - config_message="$config_message\n - Install HFS Tools:\t\t\t $HFSTOOLS" +} + +create_addon_xml() { + local addon_xml addon_version addon_name provider_name requires requires_addonname requires_addonversion screenshots + local tmp_changelog - # Kodi configuration + addon_xml="$1/addon.xml" - config_message="$config_message\n\n Kodi configuration:" - config_message="$config_message\n $dashes$dashes" + IFS=" " +for i in $PKG_ADDON_REQUIRES; do + requires_addonname=`echo $i | cut -f1 -d ":"` + requires_addonversion=`echo $i | cut -f2 -d ":"` + requires="$requires\n " +done + unset IFS - config_message="$config_message\n - Kodi version:\t\t\t $MEDIACENTER" - config_message="$config_message\n - Kodi nonfree support:\t\t $KODI_NONFREE_SUPPORT" - config_message="$config_message\n - Kodi Blu-Ray support:\t\t $KODI_BLURAY_SUPPORT" - if [ "$KODI_BLURAY_SUPPORT" = "yes" ] ; then - config_message="$config_message\n - Bluray BD+ support:\t\t $BLURAY_BDPLUS_SUPPORT" - config_message="$config_message\n - Bluray AACS support:\t\t $BLURAY_AACS_SUPPORT" + if [ ! -f "$addon_xml" ] ; then + cp $ROOT/config/addon/${PKG_ADDON_TYPE}.xml "$addon_xml" + addon_version=${PKG_ADDON_VERSION:-${ADDON_VERSION}.${PKG_REV}} + else + if ! command -v xmlstarlet >/dev/null ; then + die "*** ERROR: $ADDON has addon.xml shipped, you need 'xmlstarlet' ***" "255" + fi + addon_version="${PKG_ADDON_VERSION:-$(xmlstarlet sel -t -v "/addon/@version" "$addon_xml").$PKG_REV}" + xmlstarlet ed --inplace -u "/addon[@version]/@version" -v "$addon_version" "$addon_xml" fi - config_message="$config_message\n - Kodi DVDCSS support:\t\t\t $KODI_DVDCSS_SUPPORT" - config_message="$config_message\n - Kodi Airplay support:\t\t $KODI_AIRPLAY_SUPPORT" - config_message="$config_message\n - Kodi Airtunes support:\t\t $KODI_AIRTUNES_SUPPORT" - config_message="$config_message\n - Kodi NFS support:\t\t\t $KODI_NFS_SUPPORT" - config_message="$config_message\n - Kodi MySQL support:\t\t\t $KODI_MYSQL_SUPPORT" - config_message="$config_message\n - Kodi Optical Drive support:\t\t $KODI_OPTICAL_SUPPORT" - config_message="$config_message\n - Kodi SAMBA client support:\t\t $KODI_SAMBA_SUPPORT" - config_message="$config_message\n - Kodi SSH client support:\t\t $KODI_SSHLIB_SUPPORT" - config_message="$config_message\n - Kodi UPNP support:\t\t\t $KODI_UPNP_SUPPORT" - config_message="$config_message\n - Kodi Webserver support:\t\t $KODI_WEBSERVER_SUPPORT" + if [ -f $PKG_DIR/changelog.txt ]; then + tmp_changelog="$(mktemp)" + cat ${PKG_DIR}/changelog.txt | xmlstarlet esc >"${tmp_changelog}" + sed -e "/@PKG_ADDON_NEWS@/ \ + { + r ${tmp_changelog} + d + }" -i "$addon_xml" + rm -f "${tmp_changelog}" + else + sed -e "s|@PKG_ADDON_NEWS@||g" -i "$addon_xml" + fi - for config_skin in $SKINS; do - config_message="$config_message\n - Include Skin:\t\t\t $config_skin" + provider_name=${PKG_MAINTAINER:-"Team LibreELEC"} + addon_name=${PKG_ADDON_NAME:-"$PKG_NAME"} + + for f in $PKG_DIR/source/resources/screenshot-*.{jpg,png}; do + if [ -f "$f" ]; then + screenshots+="resources/$(basename $f)\n" + fi done - config_message="$config_message\n - Default Skin:\t\t\t $SKIN_DEFAULT" - config_message="$config_message\n - Include extra fonts:\t\t\t $KODI_EXTRA_FONTS" + sed -e "s|@PKG_ADDON_ID@|$PKG_ADDON_ID|g" \ + -e "s|@ADDON_NAME@|$addon_name|g" \ + -e "s|@ADDON_VERSION@|$addon_version|g" \ + -e "s|@REQUIRES@|$requires|g" \ + -e "s|@PKG_SHORTDESC@|$PKG_SHORTDESC|g" \ + -e "s|@OS_VERSION@|$OS_VERSION|g" \ + -e "s|@PKG_LONGDESC@|$PKG_LONGDESC|g" \ + -e "s|@PKG_DISCLAIMER@|$PKG_DISCLAIMER|g" \ + -e "s|@PROVIDER_NAME@|$provider_name|g" \ + -e "s|@PKG_ADDON_PROVIDES@|$PKG_ADDON_PROVIDES|g" \ + -e "s|@PKG_ADDON_SCREENSHOT@|$screenshots|g" \ + -e "s|@PKG_ADDON_BROKEN@|$PKG_ADDON_BROKEN|g" \ + -i "$addon_xml" +} + +install_addon_files() { + install_addon_source "$1" + install_addon_images "$1" + create_addon_xml "$1" +} + +install_driver_addon_files() { + if [ "$#" -eq 0 ] ; then + die "$(print_color CLR_ERROR "no module search path defined")" + fi - config_message="$config_message\n" - config_message="$config_message\n $dashes$dashes$dashes" - config_message="$config_message\n End Configuration for $DISTRONAME" - config_message="$config_message\n $dashes$dashes$dashes" - config_message="$config_message\n\n\n" + PKG_MODULE_DIR="$INSTALL/$(get_full_module_dir $PKG_ADDON_ID)/updates/$PKG_ADDON_ID" + PKG_ADDON_DIR="$INSTALL/usr/share/$MEDIACENTER/addons/$PKG_ADDON_ID" - echo -e "$config_message" + mkdir -p $PKG_MODULE_DIR + find $@ -name \*.ko -exec cp {} $PKG_MODULE_DIR \; + + find $PKG_MODULE_DIR -name \*.ko -exec ${TARGET_KERNEL_PREFIX}strip --strip-debug {} \; + + mkdir -p $PKG_ADDON_DIR + cp $PKG_DIR/changelog.txt $PKG_ADDON_DIR + install_addon_files "$PKG_ADDON_DIR" } -# strip -debug_strip() { - if [ ! "$DEBUG" = yes ]; then - find $* -type f -executable | xargs $STRIP 1>/dev/null || : + +### TARGET CONFIGURATION HELPERS ### +add_user() { + # Usage: add_user "username" "password" "userid" "groupid" "description" "home" "shell" + mkdir -p ${INSTALL}/etc + touch ${INSTALL}/etc/passwd + if ! grep -q "^$1:" ${INSTALL}/etc/passwd; then + echo "$1:x:$3:$4:$5:$6:$7" >> ${INSTALL}/etc/passwd + fi + + mkdir -p ${INSTALL}/usr/cache + touch ${INSTALL}/usr/cache/shadow + ln -sf /storage/.cache/shadow ${INSTALL}/etc/shadow + + PASSWORD="$2" + if [ "$PASSWORD" = "x" ]; then + PASSWORD="*" fi + if ! grep -q "^$1:" ${INSTALL}/usr/cache/shadow; then + echo "$1:$PASSWORD:::::::" >> ${INSTALL}/usr/cache/shadow + fi +} + +add_group() { + # Usage: add_group "groupname" "groupid" ("members") + mkdir -p ${INSTALL}/etc + touch ${INSTALL}/etc/group + if [ -z "`grep "$1:" ${INSTALL}/etc/group`" ]; then + echo "$1:x:$2:$3" >> ${INSTALL}/etc/group + fi +} + +# Usage: enable_service [target] +enable_service () { + local unit="$1" + local unit_dir="/usr/lib/systemd/system" + local target="$2" + local target_dir=$INSTALL + + [ -f "$target_dir/$unit_dir/$unit" ] || die + if [ -z "$target" ] ; then + for target in `grep '^WantedBy' $target_dir/$unit_dir/$unit | cut -f2 -d=` ; do + if [ -n "$target" ]; then + mkdir -p ${target_dir}/$unit_dir/${target}.wants + ln -sf ../${unit} ${target_dir}/$unit_dir/${target}.wants/ + fi + done + fi + for target in `grep '^Alias' $target_dir/$unit_dir/$unit | cut -f2 -d=` ; do + if [ -n "$target" ]; then + ln -sf ${unit} ${target_dir}/$unit_dir/${target} + fi + done } # Use distribution functions if any diff --git a/config/graphic b/config/graphic index 79ad74a53a..b9e9e34339 100644 --- a/config/graphic +++ b/config/graphic @@ -11,71 +11,112 @@ else fi get_graphicdrivers() { + + # set defaults + GALLIUM_DRIVERS="" + DRI_DRIVERS="" + XORG_DRIVERS="" + LLVM_SUPPORT="no" + COMPOSITE_SUPPORT="no" + VDPAU_SUPPORT="no" + VAAPI_SUPPORT="no" + V4L2_SUPPORT="no" + if [ "$GRAPHIC_DRIVERS" = "all" ]; then - GRAPHIC_DRIVERS="i915 i965 r200 r300 r600 nvidia vmware virtualbox" + GRAPHIC_DRIVERS="i915 i965 r200 r300 r600 radeonsi nvidia nvidia-legacy vmware virtio vc4" + fi + + if listcontains "$GRAPHIC_DRIVERS" "i915"; then + DRI_DRIVERS="$DRI_DRIVERS,i915" + XORG_DRIVERS="$XORG_DRIVERS intel" + COMPOSITE_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "i965"; then + DRI_DRIVERS="$DRI_DRIVERS,i965" + XORG_DRIVERS="$XORG_DRIVERS intel" + COMPOSITE_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "nvidia"; then + XORG_DRIVERS="$XORG_DRIVERS nvidia" + VDPAU_SUPPORT="yes" fi - for drv in $GRAPHIC_DRIVERS; do - if [ "$drv" = "i915" ]; then - DRI_DRIVERS="$DRI_DRIVERS,i915" - XORG_DRIVERS="$XORG_DRIVERS intel" - COMPOSITE_SUPPORT="yes" - VAAPI_SUPPORT="yes" - fi - - if [ "$drv" = "i965" ]; then - DRI_DRIVERS="$DRI_DRIVERS,i965" - XORG_DRIVERS="$XORG_DRIVERS intel" - COMPOSITE_SUPPORT="yes" - VAAPI_SUPPORT="yes" - fi - - if [ "$drv" = "nvidia" ]; then - XORG_DRIVERS="$XORG_DRIVERS nvidia" - VDPAU_SUPPORT="yes" - fi - - if [ "$drv" = "nvidia-legacy" ]; then - XORG_DRIVERS="$XORG_DRIVERS nvidia-legacy" - VDPAU_SUPPORT="yes" - fi - - if [ "$drv" = "r200" ]; then - DRI_DRIVERS="$DRI_DRIVERS,r200" - XORG_DRIVERS="$XORG_DRIVERS ati" - COMPOSITE_SUPPORT="yes" - fi - - if [ "$drv" = "r300" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r300" - XORG_DRIVERS="$XORG_DRIVERS ati" - LLVM_SUPPORT="yes" - COMPOSITE_SUPPORT="yes" - VDPAU_SUPPORT="yes" - fi - - if [ "$drv" = "r600" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r600" - XORG_DRIVERS="$XORG_DRIVERS ati" - LLVM_SUPPORT="yes" - COMPOSITE_SUPPORT="yes" - VDPAU_SUPPORT="yes" - fi - - if [ "$drv" = "radeonsi" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,radeonsi" - XORG_DRIVERS="$XORG_DRIVERS ati amdgpu" - LLVM_SUPPORT="yes" - COMPOSITE_SUPPORT="yes" - VDPAU_SUPPORT="yes" - fi - - if [ "$drv" = "vmware" ]; then - DRI_DRIVERS="$DRI_DRIVERS,swrast" - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,svga" - XORG_DRIVERS="$XORG_DRIVERS vmware" -# LLVM_SUPPORT="yes" - fi - - done + if listcontains "$GRAPHIC_DRIVERS" "nvidia-legacy"; then + XORG_DRIVERS="$XORG_DRIVERS nvidia-legacy" + VDPAU_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "r200"; then + DRI_DRIVERS="$DRI_DRIVERS,r200" + XORG_DRIVERS="$XORG_DRIVERS ati" + COMPOSITE_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "r300"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r300" + XORG_DRIVERS="$XORG_DRIVERS ati" + LLVM_SUPPORT="yes" + COMPOSITE_SUPPORT="yes" + VDPAU_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "r600"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r600" + XORG_DRIVERS="$XORG_DRIVERS ati" + LLVM_SUPPORT="yes" + COMPOSITE_SUPPORT="yes" + VDPAU_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "radeonsi"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,radeonsi" + XORG_DRIVERS="$XORG_DRIVERS ati amdgpu" + LLVM_SUPPORT="yes" + COMPOSITE_SUPPORT="yes" + VDPAU_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "vmware"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,svga" + XORG_DRIVERS="$XORG_DRIVERS vmware" + COMPOSITE_SUPPORT="yes" + fi + + if listcontains "$GRAPHIC_DRIVERS" "virtio"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,virgl" + fi + + if listcontains "$GRAPHIC_DRIVERS" "vc4"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,vc4" + V4L2_SUPPORT="yes" + VAAPI_SUPPORT="no" + VDPAU_SUPPORT="no" + fi + + if listcontains "$GRAPHIC_DRIVERS" "freedreno"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,freedreno" + V4L2_SUPPORT="yes" + VAAPI_SUPPORT="no" + VDPAU_SUPPORT="no" + fi + + if listcontains "$GRAPHIC_DRIVERS" "etnaviv"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,etnaviv,imx" + V4L2_SUPPORT="yes" + VAAPI_SUPPORT="no" + VDPAU_SUPPORT="no" + fi + + # remove leading comma if present + [[ $GALLIUM_DRIVERS =~ ^, ]] && GALLIUM_DRIVERS="${GALLIUM_DRIVERS:1}" + [[ $DRI_DRIVERS =~ ^, ]] && DRI_DRIVERS="${DRI_DRIVERS:1}" + + # remove duplicate entries + XORG_DRIVERS="$(echo $XORG_DRIVERS | xargs -n1 | sort -u | xargs)" } diff --git a/config/issue b/config/issue deleted file mode 100644 index 7b7a66e92a..0000000000 --- a/config/issue +++ /dev/null @@ -1 +0,0 @@ -Welcome to OpenELEC - the powerful Mediacenter4you diff --git a/config/noobs/partition_setup.sh b/config/noobs/partition_setup.sh index 52ebab5819..50577f5e6b 100755 --- a/config/noobs/partition_setup.sh +++ b/config/noobs/partition_setup.sh @@ -1,21 +1,7 @@ #!/bin/sh -x -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) MOUNTPOINT="/tmp/LibreELEC-System" diff --git a/config/noobs/partitions.json b/config/noobs/partitions.json index bc05e26adb..591b255ded 100644 --- a/config/noobs/partitions.json +++ b/config/noobs/partitions.json @@ -1,7 +1,7 @@ { "partitions": [ { - "label": "@DISTRONAME@_@PROJECT@_System", + "label": "System", "filesystem_type": "FAT", "partition_size_nominal": @SYSTEM_SIZE@, "want_maximised": false, @@ -9,7 +9,7 @@ "mkfs_options": "" }, { - "label": "@DISTRONAME@_@PROJECT@_Storage", + "label": "Storage", "filesystem_type": "ext4", "partition_size_nominal": 512, "want_maximised": true, diff --git a/config/optimize b/config/optimize index 2c395a57f1..08d38b3b97 100644 --- a/config/optimize +++ b/config/optimize @@ -1,16 +1,8 @@ GCC_OPTIM="-Os" +# Linker hash-style is set to gnu via gcc default LD_OPTIM="-Wl,--as-needed" -if [ "$LTO_SUPPORT" = yes ];then - GCC_OPTIM_LTO="-flto -ffat-lto-objects" - LD_OPTIM_LTO="-fuse-linker-plugin -flto" -fi - -if [ "$GOLD_SUPPORT" = yes ];then - LD_OPTIM_GOLD="-fuse-ld=gold" -fi - -if [ "$DEBUG" = yes ]; then +if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then TARGET_CFLAGS="$TARGET_CFLAGS -ggdb" TARGET_CXXFLAGS="$TARGET_CXXFLAGS -ggdb" TARGET_LDFLAGS="$TARGET_LDFLAGS -ggdb" @@ -20,54 +12,84 @@ else TARGET_LDFLAGS="$TARGET_LDFLAGS" fi -TARGET_CPPFLAGS= -TARGET_CFLAGS="$TARGET_CFLAGS -Wall -pipe $GCC_OPTIM $GCC_OPTIM_LTO $PROJECT_CFLAGS" +NINJA_OPTS="" + +TARGET_CPPFLAGS="" +TARGET_CFLAGS="$TARGET_CFLAGS -Wall -pipe $GCC_OPTIM $PROJECT_CFLAGS" TARGET_CXXFLAGS="$TARGET_CFLAGS" -TARGET_LDFLAGS="$TARGET_LDFLAGS $LD_OPTIM $LD_OPTIM_GOLD $LD_OPTIM_LTO" +TARGET_LDFLAGS="$TARGET_LDFLAGS $LD_OPTIM" TARGET_LIBDIR="$SYSROOT_PREFIX/lib $SYSROOT_PREFIX/usr/lib" TARGET_INCDIR="$SYSROOT_PREFIX/include $SYSROOT_PREFIX/usr/include" HOST_CPPFLAGS="" -HOST_CFLAGS="-O2 -Wall -pipe -I$ROOT/$TOOLCHAIN/include" +HOST_CFLAGS="-march=native -O2 -Wall -pipe -I$TOOLCHAIN/include" HOST_CXXFLAGS="$HOST_CFLAGS" -HOST_LDFLAGS="-Wl,-rpath,$ROOT/$TOOLCHAIN/lib -L$ROOT/$TOOLCHAIN/lib" -HOST_LIBDIR="$ROOT/$TOOLCHAIN/lib" +HOST_LDFLAGS="-Wl,-rpath,$TOOLCHAIN/lib -L$TOOLCHAIN/lib" +HOST_INCDIR="$TOOLCHAIN/include /usr/include" # work around Ubuntu default C*FLAGS # see https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wformat_-Wformat-security HOST_CFLAGS="$HOST_CFLAGS -Wno-format-security" HOST_CXXFLAGS="$HOST_CXXFLAGS -Wno-format-security" +# lto flags +FLAGS_OPTIM_LTO_NO_PARALLEL="-flto" +FLAGS_OPTIM_LTO_PARALLEL="-flto=${CONCURRENCY_MAKE_LEVEL}" +FLAGS_OPTIM_LTO_NO_FAT="-fno-fat-lto-objects" +FLAGS_OPTIM_LTO_FAT="-ffat-lto-objects" +FLAGS_OPTIM_LTO_OFF="-fno-lto" +LDFLAGS_OPTIM_LTO_COMMON="-fuse-linker-plugin" + +# gold flags +LDFLAGS_OPTIM_GOLD="-fuse-ld=gold" + +# position-independent code +CFLAGS_OPTIM_PIC="-fPIC -DPIC" +CXXFLAGS_OPTIM_PIC="-fPIC -DPIC" +LDFLAGS_OPTIM_PIC="-fPIC" + +# hardening support +# TODO: basiclly copied from debian 9, should adjust for LE +CFLAGS_OPTIM_HARDENING="-fstack-protector-strong -Wformat -Werror=format-security -fPIE" +CXXFLAGS_OPTIM_HARDENING="-fstack-protector-strong -Wformat -Werror=format-security -fPIE" +CPPFLAGS_OPTIM_HARDENING="-D_FORTIFY_SOURCE=2" +LDFLAGS_OPTIM_HARDENING="-Wl,-z,relro -Wl,-z,now" + # add distro specific library dirs +if [ -z "$HOST_LIBDIR" ]; then + HOST_LIBDIR="$TOOLCHAIN/lib" + # ubuntu/debian specific "multiarch support" - FAMILY_TRIPLET=$(echo $HOST_NAME | sed -e "s,$(uname -m),$(uname -i),") - if [ -d /lib/$FAMILY_TRIPLET ]; then - HOST_LIBDIR="$HOST_LIBDIR /lib/$FAMILY_TRIPLET" - fi - if [ -d /usr/lib/$FAMILY_TRIPLET ]; then - HOST_LIBDIR="$HOST_LIBDIR /usr/lib/$FAMILY_TRIPLET" - fi + export MACHINE_HARDWARE_NAME="$(uname -m)" + export MACHINE_HARDWARE_PLATFORM="$(uname -i)" + FAMILY_TRIPLET=${HOST_NAME/${MACHINE_HARDWARE_NAME}/${MACHINE_HARDWARE_PLATFORM}} + if [ -d /lib/$FAMILY_TRIPLET ]; then + HOST_LIBDIR="$HOST_LIBDIR /lib/$FAMILY_TRIPLET" + fi + if [ -d /usr/lib/$FAMILY_TRIPLET ]; then + HOST_LIBDIR="$HOST_LIBDIR /usr/lib/$FAMILY_TRIPLET" + fi # default multiarch support - case "`uname -m`" in - i*86) - if [ -d /lib32 ]; then - HOST_LIBDIR="$HOST_LIBDIR /lib32" - fi - if [ -d /usr/lib32 ]; then - HOST_LIBDIR="$HOST_LIBDIR /usr/lib32" - fi - ;; - x86_64) - if [ -d /lib64 ]; then - HOST_LIBDIR="$HOST_LIBDIR /lib64" - fi - if [ -d /usr/lib64 ]; then - HOST_LIBDIR="$HOST_LIBDIR /usr/lib64" - fi - ;; - esac + case "${MACHINE_HARDWARE_NAME}" in + i*86) + if [ -d /lib32 ]; then + HOST_LIBDIR="$HOST_LIBDIR /lib32" + fi + if [ -d /usr/lib32 ]; then + HOST_LIBDIR="$HOST_LIBDIR /usr/lib32" + fi + ;; + x86_64) + if [ -d /lib64 ]; then + HOST_LIBDIR="$HOST_LIBDIR /lib64" + fi + if [ -d /usr/lib64 ]; then + HOST_LIBDIR="$HOST_LIBDIR /usr/lib64" + fi + ;; + esac # default dirs - HOST_LIBDIR="$HOST_LIBDIR /lib /usr/lib" - HOST_INCDIR="$ROOT/$TOOLCHAIN/include /usr/include" + export HOST_LIBDIR="$HOST_LIBDIR /lib /usr/lib" +fi diff --git a/config/options b/config/options index cc20c5204d..1bba024b99 100644 --- a/config/options +++ b/config/options @@ -1,81 +1,74 @@ +# Do not build as root. Ever. +if [[ "${EUID}" -eq 0 ]]; then + echo "Building as the root user is NOT supported. Use a regular user account for the build." 1>&2 + exit 1 +fi + # set default language for buildsystem - export LC_ALL=C +export LC_ALL=C + +# set default independent variables +ROOT="${PWD}" +DISTRO_DIR="${ROOT}/distributions" +PROJECT_DIR="${ROOT}/projects" # determines DISTRO, if not forced by user -# default is LibreELEC -if [ -z "$DISTRO" ]; then - DISTRO="LibreELEC" -else - DISTRO="$DISTRO" -fi +DISTRO="${DISTRO:-LibreELEC}" # determines PROJECT, if not forced by user -# default is Generic -if [ -z "$PROJECT" ]; then - PROJECT="Generic" -else - PROJECT="$PROJECT" -fi +PROJECT="${PROJECT:-Generic}" -# determines TARGET_ARCH, if not forced by user (x86_64 / arm) -# default is x86_64 -if [ -z "$ARCH" ]; then - TARGET_ARCH="x86_64" -else - TARGET_ARCH="$ARCH" -fi +# determines TARGET_ARCH, if not forced by user +ARCH="${ARCH:-x86_64}" +TARGET_ARCH="${ARCH}" -ROOT=`pwd` -DISTRO_DIR="$ROOT/distributions" -PROJECT_DIR="$ROOT/projects" -LINUX_DEPENDS="$PROJECT_DIR/$PROJECT/linux/linux.$TARGET_ARCH.conf $PROJECT_DIR/$PROJECT/devices/$DEVICE/linux/linux.$TARGET_ARCH.conf $ROOT/packages/linux/package.mk" -[ "$TARGET_ARCH" = "x86_64" ] && LINUX_DEPENDS+=" $ROOT/packages/linux-firmware/intel-ucode/package.mk $ROOT/packages/linux-firmware/x86-firmware/package.mk" +# include helper functions +. config/functions -# include versioning - . config/version +# read DISTRO version information +. "${DISTRO_DIR}/${DISTRO}/version" || die "\nERROR: No distro version present\n" + +# read DISTRO options if available +if [ -f "${DISTRO_DIR}/${DISTRO}/options" ]; then + . "${DISTRO_DIR}/${DISTRO}/options" +fi -# read distro versioning if available - if [ -f "$DISTRO_DIR/$DISTRO/version" ]; then - . $DISTRO_DIR/$DISTRO/version - fi +# read PROJECT options if available +if [ -f "${PROJECT_DIR}/${PROJECT}/options" ]; then + . "${PROJECT_DIR}/${PROJECT}/options" +fi -# read distro options if available - if [ -f "$DISTRO_DIR/$DISTRO/options" ]; then - . $DISTRO_DIR/$DISTRO/options - fi +# read DEVICE options if available +if [ -f "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options" ]; then + . "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options" +fi -# read project options if available - if [ -f "$PROJECT_DIR/$PROJECT/options" ]; then - . $PROJECT_DIR/$PROJECT/options - fi +# projects can set KERNEL_NAME (kernel.img) +KERNEL_NAME="${KERNEL_NAME:-KERNEL}" -# read board options if available - if [ -f "$PROJECT_DIR/$PROJECT/devices/$DEVICE/options" ]; then - . $PROJECT_DIR/$PROJECT/devices/$DEVICE/options - fi +LINUX_DEPENDS="${PROJECT_DIR}/${PROJECT}/linux ${PROJECT_DIR}/${PROJECT}/patches/linux ${PROJECT_DIR}/${PROJECT}/packages/linux ${ROOT}/packages/linux" +[ -n "${DEVICE}" ] && LINUX_DEPENDS+=" ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/linux ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/linux" +[ "${TARGET_ARCH}" = "x86_64" ] && LINUX_DEPENDS+=" ${ROOT}/packages/linux-firmware/intel-ucode ${ROOT}/packages/linux-firmware/kernel-firmware" # Need to point to your actual cc -# If you have ccache installed, take care that LOCAL_CC don't point to it - LOCAL_CC=`which gcc` +# If you have ccache installed, take care that LOCAL_CC does not point to it +[ -z "${LOCAL_CC}" ] && export LOCAL_CC="$(command -v gcc)" -if [ -z "$LOCAL_CC" ] ; then - echo "***** Please install gcc *****" - exit 127 +if [ -z "${LOCAL_CC}" ]; then + die "***** Please install gcc *****" "127" fi # Need to point to your actual g++ -# If you have ccache installed, take care that LOCAL_CXX don't point to it - LOCAL_CXX=`which g++` +# If you have ccache installed, take care that LOCAL_CXX does not point to it +[ -z "${LOCAL_CXX}" ] && export LOCAL_CXX="$(command -v g++)" # verbose compilation mode (yes/no) - VERBOSE="yes" +VERBOSE="${VERBOSE:-yes}" # Concurrency make level (-j option) -# Try value 1 (default) to 4 on single CPU computer, or more on -# multi-processor computer (like hyperthreading SMP CPU) - if test -z "${CONCURRENCY_MAKE_LEVEL}"; then - CONCURRENCY_MAKE_LEVEL=`cat /proc/cpuinfo | grep -c '^processor[[:cntrl:]]*:'` - fi +# Try values between 1 and number of processor cores present. +# default: use all cores +[ -z "${CONCURRENCY_MAKE_LEVEL}" ] && export CONCURRENCY_MAKE_LEVEL=$(nproc) # cache size for ccache # Set the maximum size of the files stored in the cache. You can specify a @@ -83,22 +76,27 @@ fi # value. The default is gigabytes. The actual value stored is rounded down to # the nearest multiple of 16 kilobytes. Keep in mind this per project .ccache # directory. - CCACHE_CACHE_SIZE="10G" +CCACHE_CACHE_SIZE="10G" # read options from $HOME if available - if [ -f "$HOME/.libreelec/options" ]; then - . $HOME/.libreelec/options - fi - -# install devtools on development builds - if [ -z "$DEVTOOLS" -a "$LIBREELEC_VERSION" = "devel" ]; then - DEVTOOLS=yes - fi +if [ -f "${HOME}/.libreelec/options" ]; then + . "${HOME}/.libreelec/options" +fi # overwrite OEM_SUPPORT via commandline -if [ "$OEM" = yes -o "$OEM" = no ]; then - OEM_SUPPORT=$OEM +if [ "${OEM}" = "yes" -o "${OEM}" = "no" ]; then + OEM_SUPPORT="${OEM}" fi +check_config + . config/graphic . config/path $1 + +## package processing + +# If the package caches are unset, then populate them +init_package_cache + +# set package metadata +source_package "${1}" diff --git a/config/path b/config/path index 4e853342b3..1f1080b53c 100644 --- a/config/path +++ b/config/path @@ -1,14 +1,15 @@ -set -e +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) -. config/functions +set -e # setup initial directorys (relative to root) CONFIG=config SCRIPTS=scripts PACKAGES=packages - SOURCES=sources + SOURCES=${SOURCES_DIR:-$ROOT/sources} BUILD_BASE=build - TARGET=target + TARGET_IMG=${TARGET_DIR:-$ROOT/target} ADDONS=addons # include ARCH specific options @@ -16,26 +17,18 @@ set -e . config/arch.$TARGET_ARCH fi -HOST_NAME=`$LOCAL_CC -dumpmachine` +[ -z "${HOST_NAME}" ] && export HOST_NAME="$($LOCAL_CC -dumpmachine)" TARGET_NAME=$TARGET_GCC_ARCH-libreelec-linux-gnu${TARGET_ABI} -if [ -n "$DEVICE" ]; then - BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$DEVICE.$TARGET_ARCH-$LIBREELEC_VERSION - if [ "$LIBREELEC_VERSION" = "devel" ] ; then - BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$DEVICE.$TARGET_ARCH-$OS_VERSION-$LIBREELEC_VERSION - fi -else - BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$LIBREELEC_VERSION - if [ "$LIBREELEC_VERSION" = "devel" ] ; then - BUILD=$BUILD_BASE.$DISTRONAME-$PROJECT.$TARGET_ARCH-$OS_VERSION-$LIBREELEC_VERSION - fi +BUILD=$ROOT/$BUILD_BASE.$DISTRONAME-${DEVICE:-$PROJECT}.$TARGET_ARCH-$LIBREELEC_VERSION +if [ "$LIBREELEC_VERSION" = "devel" ] ; then + BUILD=$ROOT/$BUILD_BASE.$DISTRONAME-${DEVICE:-$PROJECT}.$TARGET_ARCH-$OS_VERSION-$LIBREELEC_VERSION fi if [ -n "$BUILD_SUFFIX" ]; then BUILD=$BUILD-$BUILD_SUFFIX fi -TARGET_IMG=$ROOT/$TARGET TARGET_ADDONS="$TARGET_IMG/$ADDONS/$ADDON_PATH" ADDON_BUILD="$BUILD/$ADDONS/$1" STAMPS_NOARCH=.stamps @@ -43,11 +36,21 @@ STAMPS=$BUILD/.stamps STAMPS_INSTALL=$BUILD/image/.stamps DOCS=DOCS TOOLCHAIN=$BUILD/toolchain -SYSROOT_PREFIX=$ROOT/$TOOLCHAIN/$TARGET_NAME/sysroot +SYSROOT_PREFIX=$TOOLCHAIN/$TARGET_NAME/sysroot LIB_PREFIX=$SYSROOT_PREFIX/usr -TARGET_PREFIX=$ROOT/$TOOLCHAIN/bin/$TARGET_NAME- +TARGET_PREFIX=$TOOLCHAIN/bin/$TARGET_NAME- + +# use linaro toolchain on 64/32 split builds +if [ -z "$KERNEL_LINARO_TOOLCHAIN" -a "$TARGET_KERNEL_ARCH" = "arm64" -a "$TARGET_ARCH" = "arm" ]; then + KERNEL_LINARO_TOOLCHAIN="aarch64-linux-gnu" +fi +if [ -n "$KERNEL_LINARO_TOOLCHAIN" ]; then + TARGET_KERNEL_PREFIX=$TOOLCHAIN/lib/gcc-linaro-$KERNEL_LINARO_TOOLCHAIN/bin/$KERNEL_LINARO_TOOLCHAIN- +else + TARGET_KERNEL_PREFIX=$TARGET_PREFIX +fi -FAKEROOT_SCRIPT=$ROOT/.fakeroot.$BUILD +FAKEROOT_SCRIPT=$BUILD/.fakeroot if [ -z "$INSTALL" ]; then INSTALL=$BUILD/image/system @@ -56,126 +59,8 @@ INSTALL_INIT=$BUILD/image/initramfs/root-image . config/sources -MAKE="$ROOT/$TOOLCHAIN/bin/make" -MAKEINSTALL="$ROOT/$TOOLCHAIN/bin/make -j1 DESTDIR=$SYSROOT_PREFIX install" -SED="sed -i" - -# set package metadata - PKG_NAME="$1" - PKG_VERSION="0.0invalid" - PKG_REV="0" - PKG_ARCH="any" - PKG_LICENSE="unknown" - PKG_SITE="" - PKG_URL="" - PKG_SOURCE_NAME="" - PKG_SOURCE_DIR="" - PKG_DEPENDS_TARGET="" - PKG_DEPENDS_HOST="" - PKG_DEPENDS_INIT="" - PKG_DEPENDS_BOOTSTRAP="" - PKG_SECTION="" - PKG_SHORTDESC="$1 (autogenerated)" - PKG_LONGDESC="" - PKG_IS_ADDON="no" - PKG_PATCH_DIRS="" - - if [ -n "$1" ]; then - _PKG_ROOT_NAME=${1%:*} - _ALL_DIRS="" - _FOUND=0 - _ANCHOR="@?+?@" - PKG_DIR="" - - # If the package caches are unset, then populate them - if [ -z "${_CACHE_PACKAGE_LOCAL+x}" -o -z "${_CACHE_PACKAGE_GLOBAL+x}" ]; then - _CACHE_PACKAGE_LOCAL="" - _CACHE_PACKAGE_GLOBAL="" - - # cache project folder for a package - for DIR in $(find $ROOT/projects/$PROJECT/packages -type d 2>/dev/null); do - [ -r "$DIR/package.mk" ] && _CACHE_PACKAGE_LOCAL+="${DIR}${_ANCHOR}\n" - done - - # cache packages folder - for DIR in $(find $ROOT/$PACKAGES -type d 2>/dev/null); do - [ -r "$DIR/package.mk" ] && _CACHE_PACKAGE_GLOBAL+="${DIR}${_ANCHOR}\n" - done - - export _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL - fi - - # Check for any available local package in preference to a global package - for DIR in $(echo -e "${_CACHE_PACKAGE_LOCAL}" | grep -F "/${_PKG_ROOT_NAME}${_ANCHOR}"); do - DIR="${DIR%${_ANCHOR}}" - # found first, set $PKG_DIR - PKG_DIR="$DIR" - # keep track of dirs with package.mk for detecting multiple folders - _ALL_DIRS+="${DIR}\n" - _FOUND=$((_FOUND+1)) - done - - # If there's no local package available, use the global package - if [ $_FOUND -eq 0 ]; then - for DIR in $(echo -e "${_CACHE_PACKAGE_GLOBAL}" | grep -F "/${_PKG_ROOT_NAME}${_ANCHOR}"); do - DIR="${DIR%${_ANCHOR}}" - # found first, set $PKG_DIR - PKG_DIR="$DIR" - # keep track of dirs with package.mk for detecting multiple folders - _ALL_DIRS+="${DIR}\n" - _FOUND=$((_FOUND+1)) - done - fi - - # _FOUND multiple packages? fail - if [ $_FOUND -gt 1 ]; then - echo "Error - multiple package folders:" - echo -e "$_ALL_DIRS" - exit 1 - fi - fi - - if [ -n "$PKG_DIR" -a -r $PKG_DIR/package.mk ]; then - . $PKG_DIR/package.mk - fi - - if [ "$PKG_IS_ADDON" = "yes" ] ; then - [ -z $PKG_SECTION ] && PKG_ADDON_ID="$PKG_NAME" || PKG_ADDON_ID="`echo $PKG_SECTION | sed 's,/,.,g'`.$PKG_NAME" - fi - - # Automatically set PKG_SOURCE_NAME unless it is already defined. - # PKG_SOURCE_NAME will be automatically set to a name based on - # the $PKG_NAME-$PKG_VERSION convention. - # - # Any $PKG_URL that references more than a single url will abort - # the build as these are no longer supported - use mkpkg instead. - if [ -n "$PKG_URL" -a -z "$PKG_SOURCE_NAME" ]; then - if [[ $PKG_URL =~ .*\ .* ]]; then - echo "Error - packages with multiple urls are no longer supported, use mkpkg:" - echo "$PKG_URL" - exit 1 - fi - PKG_SOURCE_NAME="$(basename "$PKG_URL")" - case $PKG_SOURCE_NAME in - ${PKG_NAME}-${PKG_VERSION}.*) - PKG_SOURCE_NAME=$PKG_SOURCE_NAME - ;; - *.tar | *.tbz | *.tgz | *.txz | *.7z | *.zip) - PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.} - ;; - *.tar.bz2 | *.tar.gz | *.tar.xz) - PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.tar.${PKG_SOURCE_NAME##*\.} - ;; - *.diff | *.patch | *.diff.bz2 | *.patch.bz2 | patch-*.bz2 | *.diff.gz | *.patch.gz | patch-*.gz) - PKG_SOURCE_NAME=$PKG_SOURCE_NAME - ;; - *) - PKG_SOURCE_NAME=${PKG_NAME}-${PKG_VERSION}.${PKG_SOURCE_NAME##*\.} - ;; - esac - fi - - PKG_BUILD="$BUILD/${PKG_NAME}-${PKG_VERSION}" +MAKE="$TOOLCHAIN/bin/make" +MAKEINSTALL="$TOOLCHAIN/bin/make -j1 DESTDIR=$SYSROOT_PREFIX install" XORG_PATH_DRI=/usr/lib/dri XORG_PATH_XKB=/usr/share/X11/xkb @@ -187,53 +72,31 @@ XORG_PATH_DRIVERS=/usr/lib/xorg/modules/drivers . config/optimize if [ -z "$CCACHE_DIR" ]; then - export CCACHE_DIR=$ROOT/$BUILD/.ccache + export CCACHE_DIR=$BUILD/.ccache fi -export MAKEFLAGS=-j$CONCURRENCY_MAKE_LEVEL -export PKG_CONFIG=$ROOT/$TOOLCHAIN/bin/pkg-config -if [ -z "$PATH" -o "$PATH" = "${PATH#$ROOT/$TOOLCHAIN/bin:}" ]; then - export PATH="$ROOT/$TOOLCHAIN/bin:$ROOT/$TOOLCHAIN/sbin:$PATH" -fi - -if [ -z "$LD_LIBRARY_PATH" -o "$LD_LIBRARY_PATH" = "${LD_LIBRARY_PATH#$ROOT/$TOOLCHAIN/lib:}" ]; then - export LD_LIBRARY_PATH="$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" +if [[ -z "$PATH" || ( "$PATH" != "$TOOLCHAIN/bin:$TOOLCHAIN/sbin" && "$PATH" = "${PATH#$TOOLCHAIN/bin:$TOOLCHAIN/sbin:}" ) ]]; then + export PATH="$TOOLCHAIN/bin:$TOOLCHAIN/sbin${PATH:+":$PATH"}" fi VERSION_SUFFIX=$TARGET_ARCH -check_path -check_config - -SILENT_OUT=3 -VERBOSE_OUT=4 -if [ "$VERBOSE" = yes ]; then - exec 3>&1 - exec 4>&2 -else - exec 3>&2 - exec 4>/dev/null +# redirect formatted output +if [ -z "${SILENT_OUT}" -a -z "${VERBOSE_OUT}" ]; then + export BUILD_INDENT_SIZE=4 + export SILENT_OUT=3 + export VERBOSE_OUT=4 + + if [ "$VERBOSE" = yes ]; then + exec 3>&1 + exec 4>&2 + else + exec 3>&2 + exec 4>/dev/null + fi fi -BUILD_INDENT_SIZE=4 - -# define colors - black="\e[0;30m" - boldblack="\e[1;30m" - red="\e[0;31m" - boldred="\e[1;31m" - green="\e[0;32m" - boldgreen="\e[1;32m" - yellow="\e[0;33m" - boldyellow="\e[1;33m" - blue="\e[0;34m" - boldblue="\e[1;34m" - magenta="\e[0;35m" - boldmagenta="\e[1;35m" - cyan="\e[0;36m" - boldcyan="\e[1;36m" - white="\e[0;37m" - boldwhite="\e[1;37m" - endcolor="\e[0m" + +unset LD_LIBRARY_PATH # multilib? nah unset CONFIG_SITE diff --git a/config/show_config b/config/show_config new file mode 100644 index 0000000000..dc18851a32 --- /dev/null +++ b/config/show_config @@ -0,0 +1,171 @@ +show_config() { + # load graphic configuration + get_graphicdrivers + + dashes="===========================" + config_message="$config_message\n $dashes$dashes$dashes" + config_message="$config_message\n Configuration for $DISTRONAME ($([ "$OFFICIAL" = "yes" ] && echo "official" || echo "community"))" + config_message="$config_message\n $dashes$dashes$dashes" + + # Build options + + config_message="$config_message\n\n Buildoptions:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - CPU (ARCH):\t\t\t\t $TARGET_CPU ($TARGET_ARCH)" + config_message="$config_message\n - FLOAT:\t\t\t\t $TARGET_FLOAT" + config_message="$config_message\n - FPU:\t\t\t\t\t $TARGET_FPU" + config_message="$config_message\n - CPU features:\t\t\t $TARGET_FEATURES" + config_message="$config_message\n - LTO (Link Time Optimization) support: $LTO_SUPPORT" + config_message="$config_message\n - GOLD (Google Linker) Support:\t $GOLD_SUPPORT" + config_message="$config_message\n - LLVM support:\t\t\t $LLVM_SUPPORT" + config_message="$config_message\n - DEBUG:\t\t\t\t ${DEBUG:-no}" + + # config_message="$config_message\n - CFLAGS:\t $TARGET_CFLAGS" + # config_message="$config_message\n - LDFLAGS:\t $TARGET_LDFLAGS" + + # Graphic configuration + + config_message="$config_message\n\n Graphic configuration:" + config_message="$config_message\n $dashes$dashes" + + if [ "$DISPLAYSERVER" = "x11" ] ; then + config_message="$config_message\n - Xorg Graphic Drivers:\t\t $GRAPHIC_DRIVERS" + config_message="$config_message\n - XORG Composite support:\t\t $COMPOSITE_SUPPORT" + config_message="$config_message\n - WindowManager:\t\t\t $WINDOWMANAGER" + fi + config_message="$config_message\n - OpenGL (GLX) support (provider):\t $OPENGL_SUPPORT ($OPENGL)" + config_message="$config_message\n - OpenGLES support (provider):\t\t $OPENGLES_SUPPORT ($OPENGLES)" + config_message="$config_message\n - uvesafb support:\t\t\t $UVESAFB_SUPPORT" + + # Hardware decoder support + + config_message="$config_message\n\n Hardware decoder configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Kodi Player driver:\t\t\t $KODIPLAYER_DRIVER" + config_message="$config_message\n - VAAPI Support:\t\t\t $VAAPI_SUPPORT" + config_message="$config_message\n - VDPAU Support:\t\t\t $VDPAU_SUPPORT" + + # Input device configuration + + config_message="$config_message\n\n Input device configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Remote support:\t\t\t $REMOTE_SUPPORT" + config_message="$config_message\n - ATV Remote support:\t\t\t $ATVCLIENT_SUPPORT" + config_message="$config_message\n - CEC Adapter support:\t\t\t $CEC_SUPPORT" + config_message="$config_message\n - CEC Framework support:\t\t $CEC_FRAMEWORK_SUPPORT" + config_message="$config_message\n - Kodi Joystick support:\t\t $JOYSTICK_SUPPORT" + + # Misc. hardware configuration + + config_message="$config_message\n\n Misc. hardware configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - ALSA support:\t\t\t $ALSA_SUPPORT" + config_message="$config_message\n - Pulseaudio support:\t\t\t $PULSEAUDIO_SUPPORT" + config_message="$config_message\n - Bluetooth support:\t\t\t $BLUETOOTH_SUPPORT" + + for config_driver in $ADDITIONAL_DRIVERS; do + config_message="$config_message\n - Include driver:\t\t\t $config_driver" + done + + if [ "$DRIVER_ADDONS_SUPPORT" = "yes" ]; then + for config_driver_addons in $DRIVER_ADDONS; do + config_message="$config_message\n - Include driver add-ons:\t\t $config_driver_addons" + done + fi + + for config_firmware in $FIRMWARE; do + config_message="$config_message\n - Include firmware:\t\t\t $config_firmware" + done + + for config_modules in $INITRAMFS_MODULES; do + config_message="$config_message\n - Initramfs modules:\t\t\t $config_modules" + done + + # Network service configuration + + config_message="$config_message\n\n Network service configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Avahi (Zeroconf) support:\t\t $AVAHI_DAEMON" + config_message="$config_message\n - NFS mounting support:\t\t $NFS_SUPPORT" + config_message="$config_message\n - SAMBA mounting support:\t\t $SAMBA_SUPPORT" + config_message="$config_message\n - SAMBA server support:\t\t $SAMBA_SERVER" + config_message="$config_message\n - SFTP server support:\t\t\t $SFTP_SERVER" + config_message="$config_message\n - OpenVPN support:\t\t\t $OPENVPN_SUPPORT" + + # OS configuration + + config_message="$config_message\n\n OS configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - OEM Support:\t\t\t\t $OEM_SUPPORT" + config_message="$config_message\n - Default ROOT Password:\t\t $ROOT_PASSWORD" + config_message="$config_message\n - Bootloader:\t\t\t\t $BOOTLOADER" + if [ "$BOOTLOADER" = "u-boot" ]; then + config_message="$config_message\n - U-Boot configuration:\t\t $UBOOT_CONFIG" + config_message="$config_message\n - U-Boot config file:\t\t $UBOOT_CONFIGFILE" + fi + config_message="$config_message\n - UDevil support:\t\t\t $UDEVIL" + config_message="$config_message\n - Installer support:\t\t\t $INSTALLER_SUPPORT" + for config_package in $ADDITIONAL_PACKAGES; do + config_message="$config_message\n - Include package:\t\t\t $config_package" + done + + # Misc. Filesystems + + config_message="$config_message\n\n Misc. Filesystems:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Swap Support:\t\t\t $SWAP_SUPPORT" + if [ "$SWAP_SUPPORT" = "yes" ]; then + config_message="$config_message\n - Swapfile default size:\t\t $SWAPFILESIZE" + fi + config_message="$config_message\n - exFAT Support (via Fuse):\t\t $EXFAT" + config_message="$config_message\n - NTFS Support (via Fuse):\t\t $NTFS3G" + config_message="$config_message\n - Install HFS Tools:\t\t\t $HFSTOOLS" + + # Kodi configuration + if [ ! "$MEDIACENTER" = "no" ]; then + config_message="$config_message\n\n Kodi configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Kodi version:\t\t\t $MEDIACENTER" + config_message="$config_message\n - Kodi Blu-Ray support:\t\t $KODI_BLURAY_SUPPORT" + if [ "$KODI_BLURAY_SUPPORT" = "yes" ] ; then + config_message="$config_message\n - Bluray BD+ support:\t\t $BLURAY_BDPLUS_SUPPORT" + config_message="$config_message\n - Bluray AACS support:\t\t $BLURAY_AACS_SUPPORT" + fi + config_message="$config_message\n - Kodi DVDCSS support:\t\t\t $KODI_DVDCSS_SUPPORT" + config_message="$config_message\n - Kodi Airplay support:\t\t $KODI_AIRPLAY_SUPPORT" + config_message="$config_message\n - Kodi Airtunes support:\t\t $KODI_AIRTUNES_SUPPORT" + config_message="$config_message\n - Kodi NFS support:\t\t\t $KODI_NFS_SUPPORT" + config_message="$config_message\n - Kodi MySQL support:\t\t\t $KODI_MYSQL_SUPPORT" + config_message="$config_message\n - Kodi Optical Drive support:\t\t $KODI_OPTICAL_SUPPORT" + config_message="$config_message\n - Kodi SAMBA client support:\t\t $KODI_SAMBA_SUPPORT" + config_message="$config_message\n - Kodi UPNP support:\t\t\t $KODI_UPNP_SUPPORT" + config_message="$config_message\n - Kodi Webserver support:\t\t $KODI_WEBSERVER_SUPPORT" + + for config_skin in $SKINS; do + config_message="$config_message\n - Include Skin:\t\t\t $config_skin" + done + + config_message="$config_message\n - Default Skin:\t\t\t $SKIN_DEFAULT" + config_message="$config_message\n - Include extra fonts:\t\t\t $KODI_EXTRA_FONTS" + fi + + if [ "$(type -t show_distro_config)" = "function" ]; then + show_distro_config + fi + + config_message="$config_message\n" + config_message="$config_message\n $dashes$dashes$dashes" + config_message="$config_message\n End Configuration for $DISTRONAME" + config_message="$config_message\n $dashes$dashes$dashes" + config_message="$config_message\n\n\n" + + echo -e "$config_message" +} diff --git a/config/sources b/config/sources index 9971c2a33e..fe19a603fe 100644 --- a/config/sources +++ b/config/sources @@ -1,2 +1,2 @@ # Sourceforge download site - SOURCEFORGE_SRC="http://prdownloads.sourceforge.net" \ No newline at end of file + SOURCEFORGE_SRC="https://prdownloads.sourceforge.net" diff --git a/config/version b/config/version deleted file mode 100644 index e07311ebb2..0000000000 --- a/config/version +++ /dev/null @@ -1,9 +0,0 @@ -# VERSION: set full version, use "devel" for development version - LIBREELEC_VERSION="devel" - -# OS_VERSION: OS Version - OS_VERSION="8.0" - -# ADDON_VERSION: Addon version - ADDON_VERSION="8.1" - diff --git a/distributions/LibreELEC/options b/distributions/LibreELEC/options index 8246e6f476..cb446938e4 100644 --- a/distributions/LibreELEC/options +++ b/distributions/LibreELEC/options @@ -4,6 +4,9 @@ # GOLD (Google Linker) support GOLD_SUPPORT="yes" +# HARDENING (security relevant linker and compiler flags) support + HARDENING_SUPPORT="no" + # Name of the Distro to build (full name, without special characters) DISTRONAME="LibreELEC" @@ -13,7 +16,7 @@ # Welcome Message for e.g. SSH Server (up to 5 Lines) GREETING0="##############################################" GREETING1="# LibreELEC #" - GREETING2="# http://libreelec.tv #" + GREETING2="# https://libreelec.tv #" GREETING3="##############################################" GREETING4="" @@ -34,6 +37,9 @@ # Default Skin (Estuary) SKIN_DEFAULT="Estuary" +# Select whether to use default (upstream xbmc/xbmc) repo, or specific vendor repo + KODI_VENDOR="default" + # install extra subtitle Fonts for KODI (yes / no) KODI_EXTRA_FONTS="yes" @@ -43,10 +49,6 @@ # build and install espeak support (yes / no) ESPEAK_SUPPORT="yes" -# build and install with non-free support -# (RAR compression support in KODI) (yes / no) - KODI_NONFREE_SUPPORT="yes" - # build and install with BluRay support (yes / no) KODI_BLURAY_SUPPORT="yes" @@ -63,7 +65,7 @@ KODI_DVDCSS_SUPPORT="yes" # additional drivers to install: -# for a list of additinoal drivers see packages/linux-drivers +# for a list of additional drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU" @@ -80,11 +82,8 @@ # build with UPnP support (yes / no) KODI_UPNP_SUPPORT="yes" -# build with MySQL support (yes / no) - KODI_MYSQL_SUPPORT="yes" - -# build xbmc with sshlib support (yes / no) - KODI_SSHLIB_SUPPORT="yes" +# build with MySQL support (mysql / mariadb / none) + KODI_MYSQL_SUPPORT="mariadb" # build xbmc with optical drive support (yes / no) KODI_OPTICAL_SUPPORT="yes" @@ -136,7 +135,7 @@ # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) # Space separated list is supported, # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" - GRAPHIC_DRIVERS="r300 r600 radeonsi i915 i965 nvidia nvidia-legacy" + GRAPHIC_DRIVERS="r300 r600 radeonsi i915 i965 nvidia nvidia-legacy vmware virtio" # build and install remote support (yes / no) REMOTE_SUPPORT="yes" @@ -150,6 +149,9 @@ # build and install CEC adapter support (yes / no) CEC_SUPPORT="yes" +# build and install CEC framework support (yes / no) + CEC_FRAMEWORK_SUPPORT="no" + # build and install iSCSI support - iscsistart (yes / no) ISCSI_SUPPORT="yes" @@ -158,13 +160,18 @@ INITRAMFS_PARTED_SUPPORT="no" # build with swap support (yes / no) - SWAP_SUPPORT="no" + SWAP_SUPPORT="yes" # swap support enabled per default (yes / no) SWAP_ENABLED_DEFAULT="no" # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="256" + SWAPFILESIZE="128" + +# additional packages to install: +# Space separated list is supported, +# e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES="" # build with installer (yes / no) INSTALLER_SUPPORT="yes" @@ -186,13 +193,35 @@ DISTRO_SRC="http://sources.libreelec.tv/$LIBREELEC_VERSION" # Addon Server Url - ADDON_SERVER_URL="http://addons.libreelec.tv" + ADDON_SERVER_URL="https://addons.libreelec.tv" # set the addon dirs - ADDON_PATH="$ADDON_VERSION/$PROJECT/$TARGET_ARCH" + ADDON_PATH="$ADDON_VERSION/${DEVICE:-$PROJECT}/$TARGET_ARCH" ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" # Default size of system partition, in MB, eg. 512 SYSTEM_SIZE=512 # Default system partition offset, in sectors, eg. 2048 - SYSTEM_PART_START=2048 + SYSTEM_PART_START=8192 + +# Configure debug groups (space delimited key=value pairs, with each value comma-delimited) and default group when DEBUG=yes +# Use ! or - prefix to prevent a dependent package from being built with debug. Add + suffix to build dependenencies with debug. + DEBUG_GROUPS="kodi+=kodi+,kodi-platform+,p8-platform+,!mesa" + DEBUG_GROUP_YES="kodi+" + +# Default supported get handlers (archive, git, file etc.) + GET_HANDLER_SUPPORT="archive" + +# Partition labels for USB/SD installation media + DISTRO_BOOTLABEL="LIBREELEC" + DISTRO_DISKLABEL="STORAGE" + +# Settings package name - blank if not required + DISTRO_PKG_SETTINGS="LibreELEC-settings" + +# IR remote protocols supported in default config + IR_REMOTE_PROTOCOLS="RC6 NEC" + +# IR remote keymaps supported in default config + IR_REMOTE_KEYMAPS="rc6_mce xbox_360 xbox_one" + diff --git a/distributions/LibreELEC/version b/distributions/LibreELEC/version new file mode 100644 index 0000000000..3a7718c9cd --- /dev/null +++ b/distributions/LibreELEC/version @@ -0,0 +1,8 @@ +# VERSION: set full version, use "devel" for development version + LIBREELEC_VERSION="devel" + +# OS_VERSION: OS Version + OS_VERSION="9.0" + +# ADDON_VERSION: Addon version + ADDON_VERSION="9.0" diff --git a/distributions/OpenPHT/config/functions b/distributions/OpenPHT/config/functions new file mode 100644 index 0000000000..58eefa1a02 --- /dev/null +++ b/distributions/OpenPHT/config/functions @@ -0,0 +1,33 @@ + +distro_image_name() { + if [ -f $BUILD/BUILD_OPENPHT ]; then + . $BUILD/BUILD_OPENPHT + fi + if [ -n "$OPENPHT_VERSION" ]; then + CUSTOM_VERSION=$OPENPHT_VERSION + if [ -z "$DEVICE" ]; then + CUSTOM_IMAGE_NAME="$DISTRONAME-$OPENPHT_VERSION-$PROJECT.$TARGET_ARCH" + else + CUSTOM_IMAGE_NAME="$DISTRONAME-$OPENPHT_VERSION-$DEVICE.$TARGET_ARCH" + fi + fi +} + +show_distro_config() { + distro_image_name + + config_message="$config_message\n\n OpenPHT configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - OpenPHT branch:\t\t\t $OPENPHT_BRANCH" + config_message="$config_message\n - OpenPHT repository:\t\t\t $OPENPHT_REPO" + config_message="$config_message\n - OpenPHT-Settings repository:\t\t $OPENPHT_SETTINGS_REPO" + config_message="$config_message\n - OpenPHT gitrev:\t\t\t $OPENPHT_GITREV" + config_message="$config_message\n - OpenPHT version:\t\t\t $OPENPHT_VERSION" + + config_message="$config_message\n\n Image configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Image version:\t\t\t $CUSTOM_VERSION" + config_message="$config_message\n - Image name:\t\t\t\t $CUSTOM_IMAGE_NAME" +} diff --git a/distributions/OpenPHT/options b/distributions/OpenPHT/options new file mode 100644 index 0000000000..1f99ab1c11 --- /dev/null +++ b/distributions/OpenPHT/options @@ -0,0 +1,208 @@ +# LTO (Link Time Optimization) support + LTO_SUPPORT="yes" + +# GOLD (Google Linker) support + GOLD_SUPPORT="yes" + +# Name of the Distro to build (full name, without special characters) + DISTRONAME="OpenPHT-Embedded" + +# short project description + DESCRIPTION="OpenPHT-Embedded is a fast and user-friendly OpenPHT distribution." + +# Welcome Message for e.g. SSH Server (up to 5 Lines) + GREETING0="##############################################" + GREETING1="# OpenPHT-Embedded #" + GREETING2="# http://openpht.tv #" + GREETING3="##############################################" + GREETING4="" + +# Root password to integrate in the target system + ROOT_PASSWORD="openpht" + +# Install glibc locales to the build (yes / no) + GLIBC_LOCALES="yes" + +# Mediacenter to use (kodi / plexht / no) + MEDIACENTER="plexht" + +if [ -z "$OPENPHT_BRANCH" ]; then + OPENPHT_BRANCH="openpht-1.9" +fi +if [ -z "$OPENPHT_REPO" ]; then + OPENPHT_REPO="https://github.com/RasPlex/OpenPHT.git" +fi +if [ -z "$OPENPHT_SETTINGS_REPO" ]; then + OPENPHT_SETTINGS_REPO="https://github.com/RasPlex/service.openelec.settings.git" +fi + +# Skins to install (Estuary) +# Space separated list is supported, +# e.g. SKINS="Estuary" + SKINS="" + +# Default Skin (Estuary) + SKIN_DEFAULT="plex" + +# install extra subtitle Fonts for KODI (yes / no) + KODI_EXTRA_FONTS="yes" + +# build and install PulseAudio support (yes / no) + PULSEAUDIO_SUPPORT="yes" + +# build and install espeak support (yes / no) + ESPEAK_SUPPORT="no" + +# build and install with non-free support +# (RAR compression support in KODI) (yes / no) + KODI_NONFREE_SUPPORT="no" + +# build and install with BluRay support (yes / no) + KODI_BLURAY_SUPPORT="no" + +# build and install with BD+ support +# (BD+ decryption support in KODI) (yes / no) + BLURAY_BDPLUS_SUPPORT="no" + +# build and install with AACS support +# (BD decryption support in KODI) (yes / no) + BLURAY_AACS_SUPPORT="no" + +# build and install with DVDCSS support +# (DVD decryption support in KODI) (yes / no) + KODI_DVDCSS_SUPPORT="no" + +# additional drivers to install: +# for a list of additinoal drivers see packages/linux-drivers +# Space separated list is supported, +# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU" + +# build and install bluetooth support (yes / no) + BLUETOOTH_SUPPORT="yes" + +# build and install with KODI webfrontend (yes / no) + KODI_WEBSERVER_SUPPORT="yes" + +# build and install Avahi (Zeroconf) daemon (yes / no) + AVAHI_DAEMON="yes" + +# build with UPnP support (yes / no) + KODI_UPNP_SUPPORT="yes" + +# build with MySQL support (yes / no) + KODI_MYSQL_SUPPORT="no" + +# build xbmc with sshlib support (yes / no) + KODI_SSHLIB_SUPPORT="no" + +# build xbmc with optical drive support (yes / no) + KODI_OPTICAL_SUPPORT="no" + +# build with AirPlay support (stream videos from iDevices to KODI) (yes / no) + KODI_AIRPLAY_SUPPORT="yes" + +# build with AirTunes support (stream music from iDevices to KODI) (yes / no) + KODI_AIRTUNES_SUPPORT="yes" + +# build with libnfs support (mounting nfs shares with KODI) (yes / no) + KODI_NFS_SUPPORT="no" + +# build with Samba Client support (mounting SAMBA shares with KODI) (yes / no) + KODI_SAMBA_SUPPORT="yes" + +# build with NFS support (mounting nfs shares via the OS) (yes / no) + NFS_SUPPORT="no" + +# build with Samba Client support (mounting samba shares via the OS) (yes / no) + SAMBA_SUPPORT="yes" + +# build and install Samba Server (yes / no) + SAMBA_SERVER="yes" + +# build and install SFTP Server (yes / no) + SFTP_SERVER="yes" + +# build and install OpenVPN support (yes / no) + OPENVPN_SUPPORT="yes" + +# build and install diskmounter support (udevil) +# this service provide auto mounting support for external drives in the +# mediacenter also automount internally drives at boottime via udev (yes / no) + UDEVIL="yes" + +# build and install exFAT fuse support (yes / no) + EXFAT="yes" + +# build and install NTFS-3G fuse support (yes / no) + NTFS3G="yes" + +# build and install hfs filesystem utilities (yes / no) + HFSTOOLS="yes" + +# Windowmanager to use (fluxbox / none) + WINDOWMANAGER="fluxbox" + +# Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) +# Space separated list is supported, +# e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="r300 r600 radeonsi i915 i965 nvidia nvidia-legacy vmware" + +# build and install remote support (yes / no) + REMOTE_SUPPORT="yes" + +# build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="yes" + +# build and install Joystick support (yes / no) + JOYSTICK_SUPPORT="yes" + +# build and install CEC adapter support (yes / no) + CEC_SUPPORT="yes" + +# build and install iSCSI support - iscsistart (yes / no) + ISCSI_SUPPORT="no" + +# Support for partitioning and formating disks in initramfs (yes / no) +# This adds support for parted and mkfs.ext3/4 to initramfs for OEM usage + INITRAMFS_PARTED_SUPPORT="no" + +# build with swap support (yes / no) + SWAP_SUPPORT="yes" + +# swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + +# swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="128" + +# build with installer (yes / no) + INSTALLER_SUPPORT="yes" + +# Testpackages for development (yes / no) + TESTING="no" + +# OEM packages for OEM's (yes / no) + OEM_SUPPORT="no" + +# build and install nano text editor (yes / no) + NANO_EDITOR="yes" + +# cron support (yes / no) + CRON_SUPPORT="yes" + +# Distribution Specific source location + DISTRO_MIRROR="http://sources.openpht.tv/mirror" + DISTRO_SRC="http://sources.openpht.tv/$LIBREELEC_VERSION" + +# Addon Server Url + ADDON_SERVER_URL="https://addons.openpht.tv" + +# set the addon dirs + ADDON_PATH="$ADDON_VERSION/$PROJECT/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" + +# Default size of system partition, in MB, eg. 512 + SYSTEM_SIZE=512 +# Default system partition offset, in sectors, eg. 2048 + SYSTEM_PART_START=8192 diff --git a/distributions/OpenPHT/splash/boot-logo.bmp.gz b/distributions/OpenPHT/splash/boot-logo.bmp.gz new file mode 100644 index 0000000000..cdd6584f0d Binary files /dev/null and b/distributions/OpenPHT/splash/boot-logo.bmp.gz differ diff --git a/distributions/OpenPHT/splash/splash-1080.png b/distributions/OpenPHT/splash/splash-1080.png new file mode 100644 index 0000000000..4fea75c9dd Binary files /dev/null and b/distributions/OpenPHT/splash/splash-1080.png differ diff --git a/distributions/OpenPHT/splash/splash-768.png b/distributions/OpenPHT/splash/splash-768.png new file mode 100644 index 0000000000..27c0ec7822 Binary files /dev/null and b/distributions/OpenPHT/splash/splash-768.png differ diff --git a/distributions/RasPlex/config/functions b/distributions/RasPlex/config/functions new file mode 100644 index 0000000000..58eefa1a02 --- /dev/null +++ b/distributions/RasPlex/config/functions @@ -0,0 +1,33 @@ + +distro_image_name() { + if [ -f $BUILD/BUILD_OPENPHT ]; then + . $BUILD/BUILD_OPENPHT + fi + if [ -n "$OPENPHT_VERSION" ]; then + CUSTOM_VERSION=$OPENPHT_VERSION + if [ -z "$DEVICE" ]; then + CUSTOM_IMAGE_NAME="$DISTRONAME-$OPENPHT_VERSION-$PROJECT.$TARGET_ARCH" + else + CUSTOM_IMAGE_NAME="$DISTRONAME-$OPENPHT_VERSION-$DEVICE.$TARGET_ARCH" + fi + fi +} + +show_distro_config() { + distro_image_name + + config_message="$config_message\n\n OpenPHT configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - OpenPHT branch:\t\t\t $OPENPHT_BRANCH" + config_message="$config_message\n - OpenPHT repository:\t\t\t $OPENPHT_REPO" + config_message="$config_message\n - OpenPHT-Settings repository:\t\t $OPENPHT_SETTINGS_REPO" + config_message="$config_message\n - OpenPHT gitrev:\t\t\t $OPENPHT_GITREV" + config_message="$config_message\n - OpenPHT version:\t\t\t $OPENPHT_VERSION" + + config_message="$config_message\n\n Image configuration:" + config_message="$config_message\n $dashes$dashes" + + config_message="$config_message\n - Image version:\t\t\t $CUSTOM_VERSION" + config_message="$config_message\n - Image name:\t\t\t\t $CUSTOM_IMAGE_NAME" +} diff --git a/distributions/RasPlex/options b/distributions/RasPlex/options new file mode 100644 index 0000000000..436b235869 --- /dev/null +++ b/distributions/RasPlex/options @@ -0,0 +1,232 @@ +# LTO (Link Time Optimization) support + LTO_SUPPORT="yes" + +# GOLD (Google Linker) support + GOLD_SUPPORT="yes" + +# Name of the Distro to build (full name, without special characters) + DISTRONAME="RasPlex" + +# short project description + DESCRIPTION="RasPlex is a fast and user-friendly OpenPHT distribution for Raspberry Pi." + +# Welcome Message for e.g. SSH Server (up to 5 Lines) + GREETING0="##############################################" + GREETING1="# RasPlex #" + GREETING2="# http://rasplex.com #" + GREETING3="##############################################" + GREETING4="" + +# Root password to integrate in the target system + ROOT_PASSWORD="rasplex" + +# Install glibc locales to the build (yes / no) + GLIBC_LOCALES="yes" + +# Mediacenter to use (kodi / plexht / no) + MEDIACENTER="plexht" + +if [ -z "$OPENPHT_BRANCH" ]; then + OPENPHT_BRANCH="openpht-1.9" +fi +if [ -z "$OPENPHT_REPO" ]; then + OPENPHT_REPO="https://github.com/RasPlex/OpenPHT.git" +fi +if [ -z "$OPENPHT_SETTINGS_REPO" ]; then + OPENPHT_SETTINGS_REPO="https://github.com/RasPlex/service.openelec.settings.git" +fi + +# Skins to install (Estuary) +# Space separated list is supported, +# e.g. SKINS="Estuary" + SKINS="" + +# Default Skin (Estuary) + SKIN_DEFAULT="plex" + +# install extra subtitle Fonts for KODI (yes / no) + KODI_EXTRA_FONTS="yes" + +# build and install PulseAudio support (yes / no) + PULSEAUDIO_SUPPORT="yes" + +# build and install espeak support (yes / no) + ESPEAK_SUPPORT="no" + +# build and install with non-free support +# (RAR compression support in KODI) (yes / no) + KODI_NONFREE_SUPPORT="no" + +# build and install with BluRay support (yes / no) + KODI_BLURAY_SUPPORT="no" + +# build and install with BD+ support +# (BD+ decryption support in KODI) (yes / no) + BLURAY_BDPLUS_SUPPORT="no" + +# build and install with AACS support +# (BD decryption support in KODI) (yes / no) + BLURAY_AACS_SUPPORT="no" + +# build and install with DVDCSS support +# (DVD decryption support in KODI) (yes / no) + KODI_DVDCSS_SUPPORT="no" + +# additional drivers to install: +# for a list of additinoal drivers see packages/linux-drivers +# Space separated list is supported, +# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU" + +# build and install bluetooth support (yes / no) + BLUETOOTH_SUPPORT="yes" + +# build and install with KODI webfrontend (yes / no) + KODI_WEBSERVER_SUPPORT="yes" + +# build and install Avahi (Zeroconf) daemon (yes / no) + AVAHI_DAEMON="yes" + +# build with UPnP support (yes / no) + KODI_UPNP_SUPPORT="yes" + +# build with MySQL support (yes / no) + KODI_MYSQL_SUPPORT="no" + +# build xbmc with sshlib support (yes / no) + KODI_SSHLIB_SUPPORT="no" + +# build xbmc with optical drive support (yes / no) + KODI_OPTICAL_SUPPORT="no" + +# build with AirPlay support (stream videos from iDevices to KODI) (yes / no) + KODI_AIRPLAY_SUPPORT="yes" + +# build with AirTunes support (stream music from iDevices to KODI) (yes / no) + KODI_AIRTUNES_SUPPORT="yes" + +# build with libnfs support (mounting nfs shares with KODI) (yes / no) + KODI_NFS_SUPPORT="no" + +# build with Samba Client support (mounting SAMBA shares with KODI) (yes / no) + KODI_SAMBA_SUPPORT="yes" + +# build with NFS support (mounting nfs shares via the OS) (yes / no) + NFS_SUPPORT="no" + +# build with Samba Client support (mounting samba shares via the OS) (yes / no) + SAMBA_SUPPORT="yes" + +# build and install Samba Server (yes / no) + SAMBA_SERVER="yes" + +# build and install SFTP Server (yes / no) + SFTP_SERVER="yes" + +# build and install OpenVPN support (yes / no) + OPENVPN_SUPPORT="yes" + +# build and install diskmounter support (udevil) +# this service provide auto mounting support for external drives in the +# mediacenter also automount internally drives at boottime via udev (yes / no) + UDEVIL="yes" + +# build and install exFAT fuse support (yes / no) + EXFAT="yes" + +# build and install NTFS-3G fuse support (yes / no) + NTFS3G="yes" + +# build and install hfs filesystem utilities (yes / no) + HFSTOOLS="yes" + +# Windowmanager to use (fluxbox / none) + WINDOWMANAGER="fluxbox" + +# Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) +# Space separated list is supported, +# e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="r300 r600 radeonsi i915 i965 nvidia nvidia-legacy vmware" + +# build and install remote support (yes / no) + REMOTE_SUPPORT="yes" + +# build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="yes" + +# build and install Joystick support (yes / no) + JOYSTICK_SUPPORT="yes" + +# build and install CEC adapter support (yes / no) + CEC_SUPPORT="yes" + +# build and install iSCSI support - iscsistart (yes / no) + ISCSI_SUPPORT="no" + +# Support for partitioning and formating disks in initramfs (yes / no) +# This adds support for parted and mkfs.ext3/4 to initramfs for OEM usage + INITRAMFS_PARTED_SUPPORT="no" + +# build with swap support (yes / no) + SWAP_SUPPORT="yes" + +# swap support enabled per default (yes / no) + SWAP_ENABLED_DEFAULT="no" + +# swapfile size if SWAP_SUPPORT=yes in MB + SWAPFILESIZE="128" + +# build with installer (yes / no) + INSTALLER_SUPPORT="yes" + +# Testpackages for development (yes / no) + TESTING="no" + +# OEM packages for OEM's (yes / no) + OEM_SUPPORT="no" + +# build and install nano text editor (yes / no) + NANO_EDITOR="yes" + +# cron support (yes / no) + CRON_SUPPORT="yes" + +# Distribution Specific source location + DISTRO_MIRROR="http://sources.openpht.tv/mirror" + DISTRO_SRC="http://sources.openpht.tv/$LIBREELEC_VERSION" + +# DISTRO_MIRROR="http://sources.libreelec.tv/mirror" +# DISTRO_SRC="http://sources.libreelec.tv/$LIBREELEC_VERSION" + +# Addon Server Url + ADDON_SERVER_URL="https://addons.openpht.tv" + +# set the addon dirs + ADDON_PATH="$ADDON_VERSION/$PROJECT/$TARGET_ARCH" + ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" + +## Configure debug groups (space delimited key=value pairs, with each value comma-delimited) and default group when DEBUG=yes +## Use ! or - prefix to prevent a dependent package from being built with debug. Add + suffix to build dependenencies with debug. +# DEBUG_GROUPS="kodi+=kodi+,kodi-platform+,p8-platform+,!mesa" +# DEBUG_GROUP_YES="kodi+" + +# Default size of system partition, in MB, eg. 512 + SYSTEM_SIZE=512 +# Default system partition offset, in sectors, eg. 2048 + SYSTEM_PART_START=8192 + + GET_HANDLER_SUPPORT="archive" + +# Partition labels for USB/SD installation media + DISTRO_BOOTLABEL="RASPLEX" + DISTRO_DISKLABEL="STORAGE" + +# Settings package name - blank if not required + DISTRO_PKG_SETTINGS="RasPlex-settings" + +# IR remote protocols supported in default config + IR_REMOTE_PROTOCOLS="RC6 NEC" + +# IR remote keymaps supported in default config + IR_REMOTE_KEYMAPS="rc6_mce xbox_360 xbox_one" + diff --git a/distributions/RasPlex/splash/splash-1080.png b/distributions/RasPlex/splash/splash-1080.png new file mode 100644 index 0000000000..c90541496f Binary files /dev/null and b/distributions/RasPlex/splash/splash-1080.png differ diff --git a/distributions/RasPlex/splash/splash.conf b/distributions/RasPlex/splash/splash.conf new file mode 100644 index 0000000000..55bb95d6c2 --- /dev/null +++ b/distributions/RasPlex/splash/splash.conf @@ -0,0 +1 @@ +fbset -xres 1280 -yres 720 -depth 32 diff --git a/distributions/RasPlex/version b/distributions/RasPlex/version new file mode 100644 index 0000000000..3a7718c9cd --- /dev/null +++ b/distributions/RasPlex/version @@ -0,0 +1,8 @@ +# VERSION: set full version, use "devel" for development version + LIBREELEC_VERSION="devel" + +# OS_VERSION: OS Version + OS_VERSION="9.0" + +# ADDON_VERSION: Addon version + ADDON_VERSION="9.0" diff --git a/licenses/BSL.txt b/licenses/BSL.txt new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/licenses/BSL.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/licenses/LibPNG2.txt b/licenses/LibPNG2.txt new file mode 100644 index 0000000000..62ab8e48dc --- /dev/null +++ b/licenses/LibPNG2.txt @@ -0,0 +1,134 @@ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= + +PNG Reference Library License version 2 +--------------------------------------- + + * Copyright (c) 1995-2018 The PNG Reference Library Authors. + * Copyright (c) 2018 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no even shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are +Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners, and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. diff --git a/merglist.txt b/merglist.txt new file mode 100644 index 0000000000..d93616b397 --- /dev/null +++ b/merglist.txt @@ -0,0 +1,30 @@ +* 244a5af9ee - (origin/openpht-1.9, origin/HEAD, openpht-1.9) Add patch notes file to show how i merged (1 year ago) +* ecce4e1988 - SKIPPED - gcc: update to 6.3.0 (1 year ago) +* 2448adacca - SKIPPED - new project: Intel_EGL (1 year ago) +* 0119b736ef - SKIPPED - WeTek_Core: use some aarch64 patches (1 year ago) +* fe5d2e6f72 - SKIPPED - WeTek_Play_2: add plexht support (1 year ago) +* f7fd80bd19 - SKIPPED - WeTek_Hub: add plexht support (1 year ago) +* 7a1b6d2fb0 - SKIPPED - Odroid_C2: add plexht support (1 year ago) +* d754fc43e0 - SKIPPED - WeTek_Play: add plexht support (1 year ago) +* ebb5bf573c - SKIPPED - WeTek_Core: add plexht support (1 year ago) +* 1e7bd5e1ab - applied with minor conflicts - rasplex +* ace5ace0d1 - applied with minor conflicts - openpht +* 9e4e4e748e - applied +* 8f7364ac45 - applied +* 8012d1f294 - SKIPPED - for now bluez: use userspace hid (1 year ago) +* 9f5498d9d4 - manually applied +* aaf9ab2db4 - applied +* 9cb1f1d591 - applied +* f6ec0b24a6 - Added plex in this, said there were conflicts but there weren't +* b576f7a4c6 - applied +* 59618df84f - Reverted ffmpeg to this exact revision +* 2fef5407da - applied +* d20b9a7919 - applied, conflicts resolved +* b5c2c6f463 - added upstream, not applied +* c3c76d2385 - applied +* cfa2c2aa79 - added upstream, not applied +* d59022d1c0 - applied +* 384f28aa1c - applied +* 0518042d2b - Doesn't apply cleanly +* 79b2bd1ee9 - noop +* 9efdeb5b7d - noop diff --git a/packages/addons/README.md b/packages/addons/README.md deleted file mode 100644 index ed06803427..0000000000 --- a/packages/addons/README.md +++ /dev/null @@ -1,45 +0,0 @@ -#add-on package.mk skeleton -This file shows a skeleton example of an add-on package.mk with content notes. Except for the license header, any lines prefixed with `#` are optional and may be omitted if not required. - -```shell -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="myprogram" # same as the folder name -PKG_VERSION="1.0.1" # version or 7 digit-hash -PKG_REV="100" # currently we start at 100 to solve OE update problems -PKG_ARCH="any" # for available architectures, see LE/config/arch.* files -# PKG_ADDON_PROJECTS="RPi RPi2" # for available projects, see projects subdirectory -PKG_LICENSE="GPL" # program licenses, see licenses subdirectory for a list -PKG_SITE="http://www.site.org" -PKG_URL="http://www.site.org/$PKG_VERSION.tar.xz" # for github see the other packages, prefer tar.xz over .gz -# PKG_SOURCE_DIR="somename-${PKG_VERSION}*" # if the folder inside the zip is different to the pkg name -PKG_DEPENDS_TARGET="toolchain curl" # dependencies that are needed that the addon builds -PKG_SECTION="service" # service, tools, virtual, driver, driver.remote ... -PKG_SHORTDESC="Addon name: sort description" # Addon: is a program that does this and that -PKG_LONGDESC="Addon name ($PKG_VERSION): detailed description" -PKG_AUTORECONF="no" # yes or no - -PKG_IS_ADDON="yes" -PKG_ADDON_NAME="Addon name" # proper name of the addon that is shown at the repo -PKG_ADDON_TYPE="xbmc.service" # see LE/config/addon/ for other possibilities -# PKG_ADDON_PROVIDES="executable" # http://kodi.wiki/view/addon.xml#.3Cprovides.3E_element -PKG_ADDON_REPOVERSION="8.0" # for what main version it should be compatible -# PKG_ADDON_REQUIRES="some.addon:0.0.0" # http://kodi.wiki/view/addon.xml#.3Crequires.3E -# PKG_MAINTAINER="John Doe (email)" # if you want to be know as maintainer for a addon -``` diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADS1x15/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADS1x15/package.mk index aa31fa4e16..82f830e6d6 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADS1x15/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADS1x15/package.mk @@ -1,38 +1,13 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_ADS1x15" -PKG_VERSION="733d179" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="a963cc0ee83e2ba6d671b02df5febf7250f626aa" +PKG_SHA256="2f81a9a6b7b7f46b79faa5b01df0c25fa5f16af80842d74e35b5fbf01ab0c619" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python ADS1x15 Library" -PKG_LONGDESC="Python code to use the ADS1015 and ADS1115 analog to digital converters with a Raspberry Pi or BeagleBone black." -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the ADS1015 and ADS1115 analog to digital converters with a Raspberry Pi." +PKG_TOOLCHAIN="manual" -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADXL345/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADXL345/package.mk index af6795e4c0..73d7407405 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADXL345/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_ADXL345/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_ADXL345" -PKG_VERSION="b153663" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="dca3d90b5477a304fa130f5cc90ea59e3968ce6f" +PKG_SHA256="22ec0fc6679cc3e9b5f0aff5cfeef34cbbf13e59aecfb829c2f0dc2d90b5fb8b" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python ADXL345 Library" -PKG_LONGDESC="Python code to use the ADXL345 triple-axis accelerometer over I2C with a Raspberry Pi or BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the ADXL345 triple-axis accelerometer over I2C with a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_BMP/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_BMP/package.mk index 6b6c44c6ea..1b56ce43b3 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_BMP/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_BMP/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_BMP" -PKG_VERSION="ad6521d" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e8521e969afae3321d9789353d7e92ea9a5e9a56" +PKG_SHA256="e5e140c34e312f6a00c62b1bd47ebe3f1857009b1c202c18c7b092ebb2e1eb9c" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python BMP Library" -PKG_LONGDESC="Python library for accessing the BMP series pressure and temperature sensors like the BMP085/BMP180 on a Raspberry Pi or Beaglebone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python library for accessing the BMP series pressure and temperature sensors like the BMP085/BMP180 on a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_CharLCD/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_CharLCD/package.mk index c69a0bac36..cf38375560 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_CharLCD/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_CharLCD/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_CharLCD" -PKG_VERSION="e5952eb" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="bc75cad284766240424f29dc8e7b84d0caceb72e" +PKG_SHA256="eae4b446162feb533a469a9dacf6e750250f925561c9f7983a11d340e1dd98d4" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python CharLCD Library" -PKG_LONGDESC="Python library for accessing Adafruit character LCDs from a Raspberry Pi or BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python library for accessing Adafruit character LCDs from a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_DHT/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_DHT/package.mk index e767827b45..fc392560f5 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_DHT/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_DHT/package.mk @@ -1,56 +1,32 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_DHT" -PKG_VERSION="310c59b" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="18846deec6a96572b3f2c4a9edfb5bac55b46f5b" +PKG_SHA256="9125f8f42b4874db257a45184b866e8b424aa67230d2ffbc734b53686da7817f" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python DHT Library" -PKG_LONGDESC="Python library to read the DHT series of humidity and temperature sensors on a Raspberry Pi or Beaglebone Black." -PKG_AUTORECONF="no" - -case $PROJECT in - RPi) - RPI_VERSION="--force-pi" - ;; - RPi2) - RPI_VERSION="--force-pi2" - ;; -esac +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python library to read the DHT series of humidity and temperature sensors on a Raspberry Pi." +PKG_TOOLCHAIN="manual" pre_make_target() { export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" export LDSHARED="$CC -shared" - - sed -e 's/from ez_setup import use_setuptools/\#from ez_setup import use_setuptools/' \ - -e 's/use_setuptools()/\#use_setuptools()/' \ - -i setup.py } make_target() { - python setup.py build $RPI_VERSION --cross-compile -} + case "$PROJECT:$DEVICE" in + "RPi:RPi") + PKG_RPI_VERSION="--force-pi" + ;; + "RPi:RPi2") + PKG_RPI_VERSION="--force-pi2" + ;; + *) + PKG_RPI_VERSION="" + esac -makeinstall_target() { - : # nop + python setup.py build $PKG_RPI_VERSION --cross-compile } diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_GPIO/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_GPIO/package.mk index 74affdbb6b..f298786e59 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_GPIO/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_GPIO/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_GPIO" -PKG_VERSION="fdf0fca" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="c543d1df9c0a71bafb9f0a1f9dceecd79a920e74" +PKG_SHA256="d3cb74fd033ebe5aea1786a584d64ef5eb8082ef2bf0a568b01691612cd04e88" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python GPIO Library" -PKG_LONGDESC="Library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO librarie" -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Library to provide a cross-platform GPIO interface on the Raspberry Pi ." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LED_Backpack/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LED_Backpack/package.mk index 248cbfcb2c..6837bd67cc 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LED_Backpack/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LED_Backpack/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_LED_Backpack" -PKG_VERSION="d3bd401" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e34b9548e86e63747563a94f02b65b2980fdefff" +PKG_SHA256="244d2625cdaebdc68e299fedde276efa5c9f7c143681c4ee056fb8350a4f7167" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Python library for controlling LED backpack displays." -PKG_LONGDESC="Python library for controlling LED backpack displays such as 8x8 matrices, bar graphs, and 7/14-segment displays on a Raspberry Pi or BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python library for controlling LED backpack displays." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LSM303/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LSM303/package.mk index 87c835c41f..fe516deeef 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LSM303/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_LSM303/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_LSM303" -PKG_VERSION="03b344d" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="37d288844515d7bb62a2329982eb033e92dceceb" +PKG_SHA256="609591f2add15e849d3bba320417c705a50a3ed077632baf20c12c8b740d5331" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python LSM303 Library" -PKG_LONGDESC="Python code to use the LSM303 accelerometer & magnetometer with Raspberry Pi & BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the LSM303 accelerometer & magnetometer with Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP3008/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP3008/package.mk index 0f4f4079c5..3690d8dcb6 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP3008/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP3008/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_MCP3008" -PKG_VERSION="705f090" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e721d26e650c99b0f6d3efd4ec30444e1adf5ccd" +PKG_SHA256="f5e4c847a87716c16f0209df95c281b5071549644a79a143a77b212f25c464dc" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python MCP3008 Library" -PKG_LONGDESC="Python code to use the MCP3008 analog to digital converter with a Raspberry Pi or BeagleBone black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the MCP3008 analog to digital converter with a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP4725/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP4725/package.mk index 2c5f349175..016272331e 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP4725/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_MCP4725/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_MCP4725" -PKG_VERSION="5b5fc87" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4d028bbcf58b011a8f14c5d95057b7e1dcc1064e" +PKG_SHA256="6ebbd1f76807b01dc2b723064e52b0c82fc45388265b8ec867e0a42a46a6e926" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python MCP4725 Library" -PKG_LONGDESC="Python code to use the MCP4725 digital to analog converter with a Raspberry Pi or BeagleBone black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the MCP4725 digital to analog converter with a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PCA9685/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PCA9685/package.mk index 72b95706ab..3e76f4d641 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PCA9685/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PCA9685/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_PCA9685" -PKG_VERSION="bfa4851" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="f86db2ca5de379748afd71e379ce2155f47d21e7" +PKG_SHA256="46e11dcfbfaab5756ddeb6ab31740cf8c7419ec1d32be2519f19882e7d86e426" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python PCA9685 Library" -PKG_LONGDESC="Python code to use the PCA9685 PWM servo/LED controller with a Raspberry Pi or BeagleBone black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the PCA9685 PWM servo/LED controller with a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PureIO/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PureIO/package.mk index 678f3ffd7a..2c2a6b4feb 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PureIO/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_PureIO/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_PureIO" -PKG_VERSION="a29d95a" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="6f4976d91c52d70b67b28bba75a429b5328a52c1" +PKG_SHA256="891a4d077fe6610de6aa4b0dc5b9933a6c7db3492072df60c0383662f28c2ae9" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Pure python access to Linux IO including I2C and SPI." -PKG_LONGDESC="Pure python access to Linux IO including I2C and SPI. Drop in replacement for smbus and spidev modules." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Pure python access to Linux IO including I2C and SPI." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SI1145/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SI1145/package.mk index b583517948..c88e16c816 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SI1145/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SI1145/package.mk @@ -1,40 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_SI1145" -PKG_VERSION="cbc6c62" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="18c400643b39dbf29ab7ff8e74ab0c5c36ef5cf1" +PKG_SHA256="0238b2c01cfbb2890ae78468d2fc19c815748fc94860a4eb92b649d074476264" PKG_LICENSE="MIT" PKG_SITE="https://github.com/THP-JOE/Python_SI1145" PKG_URL="https://github.com/THP-JOE/Python_SI1145/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="Python_SI1145-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Python library for the SI1145" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" PKG_LONGDESC="Python library for accessing the SI1145 temperature sensor on a Raspberry Pi" -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} - +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SSD1306/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SSD1306/package.mk new file mode 100644 index 0000000000..0ec63b1f56 --- /dev/null +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_SSD1306/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="Adafruit_Python_SSD1306" +PKG_VERSION="8819e2d203df49f2843059d981b7347d9881c82b" +PKG_SHA256="ed1163dee2fe6c0c2065a429e1d93cff7397a309071ff83714c84566739680a2" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/adafruit/${PKG_NAME}" +PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="SSD1306 oled driver library for 'monochrome' 128x64 and 128x32 OLEDs." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_TCS34725/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_TCS34725/package.mk index 7000bfc5aa..9ca8003fe5 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_TCS34725/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_TCS34725/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_TCS34725" -PKG_VERSION="4ff05a3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="6306f90b4601237a852acef89eeecc1261ce38b3" +PKG_SHA256="f2c3218551da55d7fdbe2499a6ffa3a0b8ed1709e4402c6b0e0f37b17d4aa81f" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python TCS34725 Library" -PKG_LONGDESC="Python code to use the TCS34725 color sensor with the Raspberry Pi & BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the TCS34725 color sensor with the Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_VCNL40xx/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_VCNL40xx/package.mk index c0ecd8ad22..499f51add3 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_VCNL40xx/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_VCNL40xx/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_VCNL40xx" -PKG_VERSION="e54bff9" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5c72575b7390fbedfae0b5fb2a881ca9efe9ca22" +PKG_SHA256="78346836965562720248138203a4af9dc6aa18815bda2a5b7842e3b9af9d1ea8" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python VCNL40xx Library" -PKG_LONGDESC="Python code to use the VCNL4000 & VCNL4010 proximity sensors with the Raspberry Pi & BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to use the VCNL4000 & VCNL4010 proximity sensors with the Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_WS2801/package.mk b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_WS2801/package.mk index 8030d26559..bc76e60c05 100644 --- a/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_WS2801/package.mk +++ b/packages/addons/addon-depends/adafruit-libraries-depends/Adafruit_Python_WS2801/package.mk @@ -1,38 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="Adafruit_Python_WS2801" -PKG_VERSION="699426a" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="d0c190715ffef1b00e5ffa2d7b7560e7f8ed4263" +PKG_SHA256="6219edb5c1d767ff950f5020bacdfb5ba608b4995eb14d6073fdec2f17f584cb" PKG_LICENSE="MIT" PKG_SITE="https://github.com/adafruit/${PKG_NAME}" PKG_URL="https://github.com/adafruit/${PKG_NAME}/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="Adafruit Python WS2801 Library" -PKG_LONGDESC="Python code to control WS2801 and similar SPI interface addressable RGB LED strips on a Raspberry Pi & BeagleBone Black." -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python code to control WS2801 and similar SPI interface addressable RGB LED strips on a Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/argtable2/package.mk b/packages/addons/addon-depends/argtable2/package.mk new file mode 100644 index 0000000000..637c9c211d --- /dev/null +++ b/packages/addons/addon-depends/argtable2/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="argtable2" +PKG_VERSION="2.13" +PKG_SHA256="8f77e8a7ced5301af6e22f47302fdbc3b1ff41f2b83c43c77ae5ca041771ddbf" +PKG_LICENSE="BSD" +PKG_SITE="http://argtable.sourceforge.net/" +PKG_URL="https://downloads.sourceforge.net/project/argtable/argtable/argtable-${PKG_VERSION}/argtable2-${PKG_VERSION:2:4}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Argtable is an open source ANSI C library that parses GNU-style command-line options." + +make_target() { + : +} diff --git a/packages/addons/addon-depends/atk/package.mk b/packages/addons/addon-depends/atk/package.mk deleted file mode 100644 index fafc0e0572..0000000000 --- a/packages/addons/addon-depends/atk/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="atk" -PKG_VERSION="2.20.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://library.gnome.org/devel/atk/" -PKG_URL="http://ftp.gnome.org/pub/gnome/sources/$PKG_NAME/2.20/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain glib" -PKG_SECTION="accessibility" -PKG_SHORTDESC="ATK - Accessibility Toolkit" -PKG_LONGDESC="ATK provides the set of accessibility interfaces that are implemented by other toolkits and applications. Using the ATK interfaces, accessibility tools have full access to view and control running applications." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ - --disable-rebuilds --disable-glibtest" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} diff --git a/packages/addons/addon-depends/atk/patches/atk-meh.patch b/packages/addons/addon-depends/atk/patches/atk-meh.patch deleted file mode 100644 index 1fa31a93d9..0000000000 --- a/packages/addons/addon-depends/atk/patches/atk-meh.patch +++ /dev/null @@ -1,347 +0,0 @@ -diff -Naur atk-2.20.0/atk/atkobject.c atk-2.20.0.patch/atk/atkobject.c ---- atk-2.20.0/atk/atkobject.c 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/atkobject.c 2016-03-26 01:10:01.058238623 +0100 -@@ -26,7 +26,6 @@ - #include - - #include "atk.h" --#include "atkmarshal.h" - #include "atkprivate.h" - - /** -@@ -610,27 +609,6 @@ - G_TYPE_POINTER); - - /** -- * AtkObject::state-change: -- * @atkobject: the object which received the signal. -- * @arg1: The name of the state which has changed -- * @arg2: A boolean which indicates whether the state has been set or unset. -- * -- * The "state-change" signal is emitted when an object's state -- * changes. The detail value identifies the state type which has -- * changed. -- */ -- atk_object_signals[STATE_CHANGE] = -- g_signal_new ("state_change", -- G_TYPE_FROM_CLASS (klass), -- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, -- G_STRUCT_OFFSET (AtkObjectClass, state_change), -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__STRING_BOOLEAN, -- G_TYPE_NONE, 2, -- G_TYPE_STRING, -- G_TYPE_BOOLEAN); -- -- /** - * AtkObject::visible-data-changed: - * @atkobject: the object which received the signal. - * -diff -Naur atk-2.20.0/atk/atktable.c atk-2.20.0.patch/atk/atktable.c ---- atk-2.20.0/atk/atktable.c 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/atktable.c 2016-03-26 01:11:35.242363570 +0100 -@@ -20,7 +20,6 @@ - #include "config.h" - - #include "atktable.h" --#include "atkmarshal.h" - - /** - * SECTION:atktable -@@ -102,78 +101,6 @@ - if (!initialized) - { - /** -- * AtkTable::row-inserted: -- * @atktable: the object which received the signal. -- * @arg1: The index of the first row inserted. -- * @arg2: The number of rows inserted. -- * -- * The "row-inserted" signal is emitted by an object which -- * implements the AtkTable interface when a row is inserted. -- */ -- atk_table_signals[ROW_INSERTED] = -- g_signal_new ("row_inserted", -- ATK_TYPE_TABLE, -- G_SIGNAL_RUN_LAST, -- G_STRUCT_OFFSET (AtkTableIface, row_inserted), -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT, -- G_TYPE_NONE, -- 2, G_TYPE_INT, G_TYPE_INT); -- /** -- * AtkTable::column-inserted: -- * @atktable: the object which received the signal. -- * @arg1: The index of the column inserted. -- * @arg2: The number of colums inserted. -- * -- * The "column-inserted" signal is emitted by an object which -- * implements the AtkTable interface when a column is inserted. -- */ -- atk_table_signals[COLUMN_INSERTED] = -- g_signal_new ("column_inserted", -- ATK_TYPE_TABLE, -- G_SIGNAL_RUN_LAST, -- G_STRUCT_OFFSET (AtkTableIface, column_inserted), -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT, -- G_TYPE_NONE, -- 2, G_TYPE_INT, G_TYPE_INT); -- /** -- * AtkTable::row-deleted: -- * @atktable: the object which received the signal. -- * @arg1: The index of the first row deleted. -- * @arg2: The number of rows deleted. -- * -- * The "row-deleted" signal is emitted by an object which -- * implements the AtkTable interface when a row is deleted. -- */ -- atk_table_signals[ROW_DELETED] = -- g_signal_new ("row_deleted", -- ATK_TYPE_TABLE, -- G_SIGNAL_RUN_LAST, -- G_STRUCT_OFFSET (AtkTableIface, row_deleted), -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT, -- G_TYPE_NONE, -- 2, G_TYPE_INT, G_TYPE_INT); -- /** -- * AtkTable::column-deleted: -- * @atktable: the object which received the signal. -- * @arg1: The index of the first column deleted. -- * @arg2: The number of columns deleted. -- * -- * The "column-deleted" signal is emitted by an object which -- * implements the AtkTable interface when a column is deleted. -- */ -- atk_table_signals[COLUMN_DELETED] = -- g_signal_new ("column_deleted", -- ATK_TYPE_TABLE, -- G_SIGNAL_RUN_LAST, -- G_STRUCT_OFFSET (AtkTableIface, column_deleted), -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT, -- G_TYPE_NONE, -- 2, G_TYPE_INT, G_TYPE_INT); -- /** - * AtkTable::row-reordered: - * @atktable: the object which received the signal. - * -diff -Naur atk-2.20.0/atk/atktext.c atk-2.20.0.patch/atk/atktext.c ---- atk-2.20.0/atk/atktext.c 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/atktext.c 2016-03-26 01:12:57.099480029 +0100 -@@ -20,7 +20,6 @@ - #include "config.h" - - #include "atk.h" --#include "atkmarshal.h" - - #include - -@@ -190,75 +189,6 @@ - class->get_bounded_ranges = atk_text_real_get_bounded_ranges; - - /** -- * AtkText::text-changed: -- * @atktext: the object which received the signal. -- * @arg1: The position (character offset) of the insertion or deletion. -- * @arg2: The length (in characters) of text inserted or deleted. -- * -- * The "text-changed" signal is emitted when the text of the -- * object which implements the AtkText interface changes, This -- * signal will have a detail which is either "insert" or -- * "delete" which identifies whether the text change was an -- * insertion or a deletion. -- * -- * Deprecated: 2.9.4: Use #AtkObject::text-insert or -- * #AtkObject::text-remove instead. -- */ -- atk_text_signals[TEXT_CHANGED] = -- g_signal_new ("text_changed", -- ATK_TYPE_TEXT, -- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, -- G_STRUCT_OFFSET (AtkTextIface, text_changed), -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT, -- G_TYPE_NONE, -- 2, G_TYPE_INT, G_TYPE_INT); -- -- /** -- * AtkText::text-insert: -- * @atktext: the object which received the signal. -- * @arg1: The position (character offset) of the insertion. -- * @arg2: The length (in characters) of text inserted. -- * @arg3: The new text inserted -- * -- * The "text-insert" signal is emitted when a new text is -- * inserted. If the signal was not triggered by the user -- * (e.g. typing or pasting text), the "system" detail should be -- * included. -- */ -- atk_text_signals[TEXT_INSERT] = -- g_signal_new ("text_insert", -- ATK_TYPE_TEXT, -- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, -- 0, -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT_STRING, -- G_TYPE_NONE, -- 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING); -- -- /** -- * AtkText::text-remove: -- * @atktext: the object which received the signal. -- * @arg1: The position (character offset) of the removal. -- * @arg2: The length (in characters) of text removed. -- * @arg3: The old text removed -- * -- * The "text-remove" signal is emitted when a new text is -- * removed. If the signal was not triggered by the user -- * (e.g. typing or pasting text), the "system" detail should be -- * included. -- */ -- atk_text_signals[TEXT_REMOVE] = -- g_signal_new ("text_remove", -- ATK_TYPE_TEXT, -- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, -- 0, -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__INT_INT_STRING, -- G_TYPE_NONE, -- 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING); -- -- /** - * AtkText::text-caret-moved: - * @atktext: the object which received the signal. - * @arg1: The new position of the text caret. -diff -Naur atk-2.20.0/atk/atkutil.c atk-2.20.0.patch/atk/atkutil.c ---- atk-2.20.0/atk/atkutil.c 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/atkutil.c 2016-03-26 01:13:04.481490538 +0100 -@@ -20,7 +20,6 @@ - #include "config.h" - - #include "atkutil.h" --#include "atkmarshal.c" - - /** - * SECTION:atkutil -diff -Naur atk-2.20.0/atk/atkvalue.c atk-2.20.0.patch/atk/atkvalue.c ---- atk-2.20.0/atk/atkvalue.c 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/atkvalue.c 2016-03-26 01:18:03.268897883 +0100 -@@ -23,7 +23,6 @@ - #include - - #include "atkvalue.h" --#include "atkmarshal.h" - #include "atk-enum-types.h" - #include "atkprivate.h" - -@@ -322,42 +321,6 @@ - atk_value_base_init (AtkValueIface *class) - { - static gboolean initialized = FALSE; -- if (!initialized) -- { -- /** -- * AtkValue::value-changed: -- * @atkvalue: the object on which the signal was emitted. -- * @value: the new value in a numerical form. -- * @text: human readable text alternative (also called -- * description) of this object. NULL if not available. -- * -- * The 'value-changed' signal is emitted when the current value -- * that represent the object changes. @value is the numerical -- * representation of this new value. @text is the human -- * readable text alternative of @value, and can be NULL if it is -- * not available. Note that if there is a textual description -- * associated with the new numeric value, that description -- * should be included regardless of whether or not it has also -- * changed. -- * -- * Example: a password meter whose value changes as the user -- * types their new password. Appropiate value text would be -- * "weak", "acceptable" and "strong". -- * -- * Since: 2.12 -- */ -- atk_value_signals[VALUE_CHANGED] = -- g_signal_new ("value_changed", -- ATK_TYPE_VALUE, -- G_SIGNAL_RUN_LAST, -- 0, -- (GSignalAccumulator) NULL, NULL, -- atk_marshal_VOID__DOUBLE_STRING, -- G_TYPE_NONE, -- 2, G_TYPE_DOUBLE, G_TYPE_STRING); -- -- initialized = TRUE; -- } - } - - /** -diff -Naur atk-2.20.0/atk/atkwindow.c atk-2.20.0.patch/atk/atkwindow.c ---- atk-2.20.0/atk/atkwindow.c 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/atkwindow.c 2016-03-26 01:13:13.448503294 +0100 -@@ -20,7 +20,6 @@ - #include "config.h" - - #include "atkwindow.h" --#include "atkmarshal.h" - - /** - * SECTION:atkwindow -diff -Naur atk-2.20.0/atk/Makefile.am atk-2.20.0.patch/atk/Makefile.am ---- atk-2.20.0/atk/Makefile.am 2016-02-15 12:29:12.000000000 +0100 -+++ atk-2.20.0.patch/atk/Makefile.am 2016-03-26 01:08:29.075118340 +0100 -@@ -115,50 +115,7 @@ - - # ---------- Handle built sources ---------- - --BUILT_SOURCES = atkmarshal.h atkmarshal.c atk-enum-types.h atk-enum-types.c -- --atkmarshal.h: stamp-atkmarshal.h -- @true --stamp-atkmarshal.h: @REBUILD@ atkmarshal.list -- $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=atk_marshal $(srcdir)/atkmarshal.list --header >> xgen-gmh \ -- && (cmp -s xgen-gmh atkmarshal.h || cp xgen-gmh atkmarshal.h) \ -- && rm -f xgen-gmh xgen-gmh~ \ -- && echo timestamp > $(@F) -- --atkmarshal.c: stamp-atkmarshal.c -- @true --stamp-atkmarshal.c: @REBUILD@ atkmarshal.list -- $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=atk_marshal $(srcdir)/atkmarshal.list --body >> xgen-gmc \ -- && (cmp -s xgen-gmc atkmarshal.c || cp xgen-gmc atkmarshal.c) \ -- && rm -f xgen-gmc xgen-gmc~ \ -- && echo timestamp > $(@F) -- --atk-enum-types.h: s-enum-types-h -- @true --s-enum-types-h: @REBUILD@ $(atk_headers) Makefile -- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ -- --fhead "#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)\n#error \"Only can be included directly.\"\n#endif\n\n#ifndef __ATK_ENUM_TYPES_H__\n#define __ATK_ENUM_TYPES_H__\n\n#include \n#include \n\nG_BEGIN_DECLS\n" \ -- --fprod "/* enumerations from \"@filename@\" */\n" \ -- --vhead "ATK_AVAILABLE_IN_ALL\nGType @enum_name@_get_type (void);\n#define ATK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \ -- --ftail "G_END_DECLS\n\n#endif /* __ATK_ENUM_TYPES_H__ */" \ -- $(atk_headers) ) > tmp-atk-enum-types.h \ -- && (cmp -s tmp-atk-enum-types.h atk-enum-types.h || cp tmp-atk-enum-types.h atk-enum-types.h ) \ -- && rm -f tmp-atk-enum-types.h \ -- && echo timestamp > $(@F) -- --atk-enum-types.c: s-enum-types-c -- @true --s-enum-types-c: @REBUILD@ $(atk_headers) Makefile -- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ -- --fhead "#include \"config.h\"\n\n#include " \ -- --fprod "\n/* enumerations from \"@filename@\" */" \ -- --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ -- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ -- --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \ -- $(atk_headers) ) > tmp-atk-enum-types.c \ -- && (cmp -s tmp-atk-enum-types.c atk-enum-types.c || cp tmp-atk-enum-types.c atk-enum-types.c ) \ -- && rm -f tmp-atk-enum-types.c \ -- && echo timestamp > $(@F) -+BUILT_SOURCES = atk-enum-types.h atk-enum-types.c - - - if HAVE_INTROSPECTION diff --git a/packages/addons/addon-depends/bash/package.mk b/packages/addons/addon-depends/bash/package.mk index 174fbabc30..233e0ee6c4 100644 --- a/packages/addons/addon-depends/bash/package.mk +++ b/packages/addons/addon-depends/bash/package.mk @@ -1,42 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bash" PKG_VERSION="4.3.46" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="fc7131bbc3139db143ec9fe03fd4e6bd3636bdf53e6956065b261f034b6af74b" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/bash/bash.html" PKG_URL="ftp://ftp.cwru.edu/pub/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_SECTION="devel" -PKG_SHORTDESC="The GNU Bourne Again shell" -PKG_LONGDESC="The GNU Bourne Again shell" +PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_LONGDESC="The GNU Bourne Again shell." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static \ - --disable-shared \ - --with-curses \ +PKG_CONFIGURE_OPTS_TARGET="--with-curses \ --enable-readline \ --without-bash-malloc \ --with-installed-readline" - -pre_configure_target() { - export LIBS="-lterminfo" -} diff --git a/packages/addons/addon-depends/ccid/package.mk b/packages/addons/addon-depends/ccid/package.mk new file mode 100644 index 0000000000..7568691f24 --- /dev/null +++ b/packages/addons/addon-depends/ccid/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ccid" +PKG_VERSION="1.4.28" +PKG_SHA256="875836ac5d9d952b40dc1a253a726e74361671864d81337285a3260268f8ade0" +PKG_LICENSE="LGPL" +PKG_SITE="http://pcsclite.alioth.debian.org/ccid.html" +PKG_URL="https://alioth.debian.org/frs/download.php/latestfile/112/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain pcsc-lite" +PKG_LONGDESC="A generic USB Chip/Smart Card Interface Devices driver." +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static --enable-twinserial" + +make_target() { + make + make -C src/ Info.plist +} diff --git a/packages/addons/addon-depends/chrome-depends/at-spi2-atk/package.mk b/packages/addons/addon-depends/chrome-depends/at-spi2-atk/package.mk new file mode 100644 index 0000000000..4dfa6e5d8a --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/at-spi2-atk/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Escalade +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="at-spi2-atk" +PKG_VERSION="2.26.2" +PKG_SHA256="61891f0abae1689f6617a963105a3f1dcdab5970c4a36ded9c79a7a544b16a6e" +PKG_LICENSE="OSS" +PKG_SITE="http://www.gnome.org/" +PKG_URL="https://ftp.gnome.org/pub/gnome/sources/at-spi2-atk/${PKG_VERSION:0:4}/at-spi2-atk-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain at-spi2-core atk libX11 libxml2" +PKG_LONGDESC="A GTK+ module that bridges ATK to D-Bus at-spi." diff --git a/packages/addons/addon-depends/chrome-depends/at-spi2-core/package.mk b/packages/addons/addon-depends/chrome-depends/at-spi2-core/package.mk new file mode 100644 index 0000000000..0b6b29a5e9 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/at-spi2-core/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Escalade +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="at-spi2-core" +PKG_VERSION="2.28.0" +PKG_SHA256="42a2487ab11ce43c288e73b2668ef8b1ab40a0e2b4f94e80fca04ad27b6f1c87" +PKG_LICENSE="OSS" +PKG_SITE="http://www.gnome.org/" +PKG_URL="https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/${PKG_VERSION:0:4}/at-spi2-core-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain atk dbus glib libXtst" +PKG_LONGDESC="Protocol definitions and daemon for D-Bus at-spi." + +PKG_MESON_OPTS_TARGET="-Denable_docs=false \ + -Denable-introspection=no" + +pre_configure_target() { + LDFLAGS="$LDFLAGS -lXext" +} diff --git a/packages/addons/addon-depends/chrome-depends/atk/package.mk b/packages/addons/addon-depends/chrome-depends/atk/package.mk new file mode 100644 index 0000000000..de27b94bd6 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/atk/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="atk" +PKG_VERSION="2.29.1" +PKG_SHA256="1aa7707c6297c1797fe4d79a22a57ede4d5586b0f7a3b30e886d7ca9d75f20da" +PKG_LICENSE="GPL" +PKG_SITE="http://library.gnome.org/devel/atk/" +PKG_URL="https://ftp.gnome.org/pub/gnome/sources/atk/${PKG_VERSION:0:4}/atk-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain glib glib:host" +PKG_LONGDESC="Provides the set of accessibility interfaces that are implemented by other applications." +PKG_BUILD_FLAGS="+pic" + +PKG_MESON_OPTS_TARGET="-Ddocs=false \ + -Dintrospection=false" diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXcomposite/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libXcomposite/package.mk new file mode 100644 index 0000000000..dc65abc96d --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libXcomposite/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libXcomposite)/package.mk + +PKG_NAME="chrome-libXcomposite" +PKG_LONGDESC="libXcomposite for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/mono-depends/mono_sqlite/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libXcomposite/sources/trigger_unpack similarity index 100% rename from packages/addons/addon-depends/mono-depends/mono_sqlite/sources/trigger_unpack rename to packages/addons/addon-depends/chrome-depends/chrome-libXcomposite/sources/trigger_unpack diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXdamage/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libXdamage/package.mk new file mode 100644 index 0000000000..6c7525891e --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libXdamage/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libXdamage)/package.mk + +PKG_NAME="chrome-libXdamage" +PKG_LONGDESC="libXdamage for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXdamage/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libXdamage/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXfixes/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libXfixes/package.mk new file mode 100644 index 0000000000..e373ff806a --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libXfixes/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libXfixes)/package.mk + +PKG_NAME="chrome-libXfixes" +PKG_LONGDESC="libXfixes for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXfixes/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libXfixes/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXi/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libXi/package.mk new file mode 100644 index 0000000000..91281c1018 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libXi/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libXi)/package.mk + +PKG_NAME="chrome-libXi" +PKG_LONGDESC="libXi for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXi/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libXi/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXrender/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libXrender/package.mk new file mode 100644 index 0000000000..2d91dba614 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libXrender/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libXrender)/package.mk + +PKG_NAME="chrome-libXrender" +PKG_LONGDESC="libXrender for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXrender/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libXrender/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXtst/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libXtst/package.mk new file mode 100644 index 0000000000..dfe0bfc12c --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libXtst/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libXtst)/package.mk + +PKG_NAME="chrome-libXtst" +PKG_LONGDESC="libXtst for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libXtst/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libXtst/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libxcb/package.mk b/packages/addons/addon-depends/chrome-depends/chrome-libxcb/package.mk new file mode 100644 index 0000000000..a9caed23d1 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/chrome-libxcb/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory libxcb)/package.mk + +PKG_NAME="chrome-libxcb" +PKG_LONGDESC="libxcb for chrome" +PKG_URL="" + +PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET \ + --disable-static \ + --enable-shared" + +unpack() { + mkdir -p $PKG_BUILD + tar --strip-components=1 -xf $SOURCES/${PKG_NAME:7}/${PKG_NAME:7}-$PKG_VERSION.tar.bz2 -C $PKG_BUILD +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/chrome-libxcb/sources/trigger_unpack b/packages/addons/addon-depends/chrome-depends/chrome-libxcb/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/chrome-depends/cups/package.mk b/packages/addons/addon-depends/chrome-depends/cups/package.mk new file mode 100644 index 0000000000..1ed87d1ef4 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/cups/package.mk @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Escalade +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="cups" +PKG_VERSION="2.2.8" +PKG_SHA256="8f87157960b9d80986f52989781d9de79235aa060e05008e4cf4c0a6ef6bca72" +PKG_LICENSE="GPL" +PKG_SITE="http://www.cups.org" +PKG_URL="https://github.com/apple/cups/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain openssl zlib" +PKG_LONGDESC="CUPS printing system." +PKG_BUILD_FLAGS="+pic" + +PKG_CONFIGURE_OPTS_TARGET="--libdir=/usr/lib \ + --disable-gssapi \ + --disable-avahi \ + --disable-systemd \ + --disable-launchd \ + --disable-unit-tests" + +pre_configure_target() { + cd .. + rm -rf .$TARGET_NAME +} + +makeinstall_target() { + make BUILDROOT="$INSTALL/../.INSTALL_PKG" +} diff --git a/packages/addons/addon-depends/chrome-depends/gdk-pixbuf/package.mk b/packages/addons/addon-depends/chrome-depends/gdk-pixbuf/package.mk new file mode 100644 index 0000000000..b89b7df98b --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/gdk-pixbuf/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="gdk-pixbuf" +PKG_VERSION="2.36.12" +PKG_SHA256="fff85cf48223ab60e3c3c8318e2087131b590fd6f1737e42cb3759a3b427a334" +PKG_LICENSE="OSS" +PKG_SITE="http://www.gtk.org/" +PKG_URL="https://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/${PKG_VERSION:0:4}/gdk-pixbuf-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain glib libjpeg-turbo libpng jasper shared-mime-info tiff" +PKG_LONGDESC="GdkPixbuf is a a GNOME library for image loading and manipulation." + +PKG_MESON_OPTS_TARGET="-Ddocs=false \ + -Dgir=false \ + -Dman=false \ + -Drelocatable=false" +pre_configure_target() { + export PKG_CONFIG_PATH="$(get_build_dir shared-mime-info)/.$TARGET_NAME" +} diff --git a/packages/addons/addon-depends/chrome-depends/gdk-pixbuf/patches/gdk-pixbuf-01-meson-crosscompile-fix.patch b/packages/addons/addon-depends/chrome-depends/gdk-pixbuf/patches/gdk-pixbuf-01-meson-crosscompile-fix.patch new file mode 100644 index 0000000000..e7a28e5612 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/gdk-pixbuf/patches/gdk-pixbuf-01-meson-crosscompile-fix.patch @@ -0,0 +1,85 @@ +diff -Naur a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build +--- a/gdk-pixbuf/meson.build 2018-06-15 20:13:23.593361199 +0200 ++++ b/gdk-pixbuf/meson.build 2018-06-15 20:13:42.601469091 +0200 +@@ -232,15 +232,15 @@ + + # The 'loaders.cache' used for testing, so we don't accidentally + # load the installed cache; we always build it by default +-loaders_cache = custom_target('loaders.cache', +- output: 'loaders.cache', +- capture: true, +- command: [ +- gdk_pixbuf_query_loaders, +- dynamic_loaders, +- ], +- build_by_default: true) +-loaders_dep = declare_dependency(sources: [ loaders_cache ]) ++#loaders_cache = custom_target('loaders.cache', ++# output: 'loaders.cache', ++# capture: true, ++# command: [ ++# gdk_pixbuf_query_loaders, ++# dynamic_loaders, ++# ], ++# build_by_default: true) ++#loaders_dep = declare_dependency(sources: [ loaders_cache ]) + + build_gir = get_option('gir') + if build_gir +diff -Naur a/meson.build b/meson.build +--- a/meson.build 2018-06-15 20:13:23.573361085 +0200 ++++ b/meson.build 2018-06-15 20:13:32.761413236 +0200 +@@ -398,7 +398,7 @@ + # i18n + subdir('po') + +-subdir('tests') ++#subdir('tests') + subdir('thumbnailer') + + # Documentation +diff -Naur a/thumbnailer/meson.build b/thumbnailer/meson.build +--- a/thumbnailer/meson.build 2018-06-15 20:13:23.605361267 +0200 ++++ b/thumbnailer/meson.build 2018-06-15 20:13:50.305512825 +0200 +@@ -12,22 +12,22 @@ + c_args: common_cflags, + dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ]) + +-custom_target('thumbnailer', +- input: 'gdk-pixbuf-thumbnailer.thumbnailer.in', +- output: 'gdk-pixbuf-thumbnailer.thumbnailer', +- command: [ +- gen_thumbnailer, +- '--printer=@0@'.format(gdk_pixbuf_print_mime_types.full_path()), +- '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()), +- '--loaders=@0@'.format(loaders_cache.full_path()), +- '--bindir=@0@'.format(gdk_pixbuf_bindir), +- '@INPUT@', +- '@OUTPUT@', +- ], +- depends: [ +- gdk_pixbuf_print_mime_types, +- gdk_pixbuf_pixdata, +- loaders_cache, +- ], +- install: true, +- install_dir: join_paths(gdk_pixbuf_datadir, 'thumbnailers')) ++#custom_target('thumbnailer', ++# input: 'gdk-pixbuf-thumbnailer.thumbnailer.in', ++# output: 'gdk-pixbuf-thumbnailer.thumbnailer', ++# command: [ ++# gen_thumbnailer, ++# '--printer=@0@'.format(gdk_pixbuf_print_mime_types.full_path()), ++# '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()), ++# '--loaders=@0@'.format(loaders_cache.full_path()), ++# '--bindir=@0@'.format(gdk_pixbuf_bindir), ++# '@INPUT@', ++# '@OUTPUT@', ++# ], ++# depends: [ ++# gdk_pixbuf_print_mime_types, ++# gdk_pixbuf_pixdata, ++# loaders_cache, ++# ], ++# install: true, ++# install_dir: join_paths(gdk_pixbuf_datadir, 'thumbnailers')) diff --git a/packages/addons/addon-depends/chrome-depends/gtk3/files/settings.ini b/packages/addons/addon-depends/chrome-depends/gtk3/files/settings.ini new file mode 100644 index 0000000000..c6bdb7fa46 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/gtk3/files/settings.ini @@ -0,0 +1,4 @@ +[Settings] +gtk-icon-theme-name = Adwaita +gtk-theme-name = Adwaita +gtk-font-name = Liberation Sans 12 diff --git a/packages/addons/addon-depends/chrome-depends/gtk3/package.mk b/packages/addons/addon-depends/chrome-depends/gtk3/package.mk new file mode 100644 index 0000000000..ad764698c1 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/gtk3/package.mk @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Escalade +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="gtk3" +PKG_VERSION="3.22.30" +PKG_SHA256="a1a4a5c12703d4e1ccda28333b87ff462741dc365131fbc94c218ae81d9a6567" +PKG_LICENSE="LGPL" +PKG_SITE="http://www.gtk.org/" +PKG_URL="https://ftp.gnome.org/pub/gnome/sources/gtk+/${PKG_VERSION:0:4}/gtk+-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain at-spi2-atk atk cairo gdk-pixbuf glib libX11 libXi libXrandr libepoxy pango" +PKG_LONGDESC="A library for creating graphical user interfaces for the X Window System." + +PKG_CONFIGURE_OPTS_TARGET="--disable-cups \ + --disable-debug \ + --enable-explicit-deps=no \ + --disable-glibtest \ + --disable-gtk-doc \ + --disable-gtk-doc-html \ + --disable-man \ + --enable-modules \ + --disable-papi \ + --disable-xinerama \ + --enable-xkb" + +pre_configure_target() { + LIBS="$LIBS -lXcursor" + export PKG_CONFIG_PATH="$(get_build_dir pango)/.$TARGET_NAME" + export CFLAGS="$CFLAGS -I$(get_build_dir pango) -L$(get_build_dir pango)/.$TARGET_NAME/pango" +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/gtk3/patches/gtk3-subdirs.patch b/packages/addons/addon-depends/chrome-depends/gtk3/patches/gtk3-subdirs.patch new file mode 100644 index 0000000000..c3be473373 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/gtk3/patches/gtk3-subdirs.patch @@ -0,0 +1,13 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -566,8 +566,8 @@ + || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \ + && DISPLAY=:$$XID && export DISPLAY + +-SRC_SUBDIRS = gdk gtk libgail-util modules demos tests testsuite examples +-SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build ++SRC_SUBDIRS = gdk gtk modules ++SUBDIRS = po po-properties $(SRC_SUBDIRS) m4macros build + ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + MAINTAINERCLEANFILES = \ + $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \ diff --git a/packages/addons/addon-depends/chrome-depends/harfbuzz/package.mk b/packages/addons/addon-depends/chrome-depends/harfbuzz/package.mk new file mode 100644 index 0000000000..63b496aaac --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/harfbuzz/package.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="harfbuzz" +PKG_VERSION="1.8.1" +PKG_SHA256="fbed6392ddb085e45e6090a9f389f72926d0e355f4b0a2ef51d35cf21686df45" +PKG_LICENSE="GPL" +PKG_SITE="http://www.freedesktop.org/wiki/Software/HarfBuzz" +PKG_URL="https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain cairo freetype glib icu" +PKG_LONGDESC="HarfBuzz is an OpenType text shaping engine." +PKG_TOOLCHAIN="configure" + +PKG_CONFIGURE_OPTS_TARGET="--with-icu \ + --disable-gtk-doc \ + --disable-gtk-doc-html \ + --disable-gtk-doc-pdf" + +pre_configure_target() { + export LDFLAGS="$LDFLAGS -ldl" +} diff --git a/packages/addons/addon-depends/chrome-depends/icu/package.mk b/packages/addons/addon-depends/chrome-depends/icu/package.mk new file mode 100644 index 0000000000..d4ccf8c3a1 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/icu/package.mk @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="icu" +PKG_VERSION="61.1" +PKG_SHA256="d007f89ae8a2543a53525c74359b65b36412fa84b3349f1400be6dcf409fafef" +PKG_LICENSE="Custom" +PKG_SITE="http://www.icu-project.org" +PKG_URL="http://download.icu-project.org/files/icu4c/${PKG_VERSION}/icu4c-${PKG_VERSION//./_}-src.tgz" +PKG_DEPENDS_TARGET="toolchain icu:host" +PKG_LONGDESC="International Components for Unicode library." + +PKG_ICU_OPTS="--disable-extras \ + --disable-icuio \ + --disable-layout \ + --disable-renaming \ + --disable-samples \ + --disable-tests \ + --disable-tools" + +PKG_CONFIGURE_OPTS_HOST="--enable-static \ + --disable-shared \ + $PKG_ICU_OPTS" + +configure_package() { + PKG_CONFIGURE_OPTS_TARGET="--with-cross-build=$PKG_BUILD/.$HOST_NAME \ + $PKG_ICU_OPTS" + + PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/source/configure" +} + +post_makeinstall_target() { + rm -rf $INSTALL +} diff --git a/packages/addons/addon-depends/chrome-depends/libXScrnSaver/package.mk b/packages/addons/addon-depends/chrome-depends/libXScrnSaver/package.mk new file mode 100644 index 0000000000..c17771b1ec --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/libXScrnSaver/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libXScrnSaver" +PKG_VERSION="1.2.2" +PKG_SHA256="8ff1efa7341c7f34bcf9b17c89648d6325ddaae22e3904e091794e0b4426ce1d" +PKG_LICENSE="GPL" +PKG_SITE="http://xorg.freedesktop.org/" +PKG_URL="https://xorg.freedesktop.org/releases/individual/lib/libXScrnSaver-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain scrnsaverproto" +PKG_LONGDESC="X11 Screen Saver extension client library." + +PKG_CONFIGURE_OPTS_TARGET="--disable-static \ + --enable-shared \ + --enable-malloc0returnsnull" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/libXcursor/package.mk b/packages/addons/addon-depends/chrome-depends/libXcursor/package.mk new file mode 100644 index 0000000000..2c3323ed1a --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/libXcursor/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libXcursor" +PKG_VERSION="1.1.15" +PKG_SHA256="294e670dd37cd23995e69aae626629d4a2dfe5708851bbc13d032401b7a3df6b" +PKG_LICENSE="OSS" +PKG_SITE="http://www.X.org" +PKG_URL="https://xorg.freedesktop.org/archive/individual/lib/libXcursor-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain libX11 libXfixes libXrender" +PKG_LONGDESC="X11 Cursor management library.s" +PKG_BUILD_FLAGS="+pic" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/libXft/package.mk b/packages/addons/addon-depends/chrome-depends/libXft/package.mk new file mode 100644 index 0000000000..8da4ef714b --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/libXft/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libXft" +PKG_VERSION="2.3.2" +PKG_SHA256="f5a3c824761df351ca91827ac221090943ef28b248573486050de89f4bfcdc4c" +PKG_LICENSE="OSS" +PKG_SITE="http://www.X.org" +PKG_URL="https://xorg.freedesktop.org/archive/individual/lib/libXft-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain fontconfig freetype libXrender util-macros xorgproto" +PKG_LONGDESC="X FreeType library." +PKG_BUILD_FLAGS="+pic" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/libxss/package.mk b/packages/addons/addon-depends/chrome-depends/libxss/package.mk new file mode 100644 index 0000000000..1fc13ef8fc --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/libxss/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libxss" +PKG_VERSION="1.2.2" +PKG_SHA256="8ff1efa7341c7f34bcf9b17c89648d6325ddaae22e3904e091794e0b4426ce1d" +PKG_LICENSE="OSS" +PKG_SITE="http://www.X.org" +PKG_URL="https://xorg.freedesktop.org/archive/individual/lib/libXScrnSaver-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain util-macros libXext scrnsaverproto" +PKG_LONGDESC="X11 Screen Saver extension library." +PKG_BUILD_FLAGS="+pic" + +PKG_CONFIGURE_OPTS_TARGET="--enable-malloc0returnsnull" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/pango/config/pango.modules b/packages/addons/addon-depends/chrome-depends/pango/config/pango.modules similarity index 100% rename from packages/addons/addon-depends/pango/config/pango.modules rename to packages/addons/addon-depends/chrome-depends/pango/config/pango.modules diff --git a/packages/addons/addon-depends/pango/config/pangorc b/packages/addons/addon-depends/chrome-depends/pango/config/pangorc similarity index 100% rename from packages/addons/addon-depends/pango/config/pangorc rename to packages/addons/addon-depends/chrome-depends/pango/config/pangorc diff --git a/packages/addons/addon-depends/chrome-depends/pango/package.mk b/packages/addons/addon-depends/chrome-depends/pango/package.mk new file mode 100644 index 0000000000..96cb1188c0 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/pango/package.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pango" +PKG_VERSION="1.42.1" +PKG_SHA256="915a6756b298578ff27c7a6393f8c2e62e6e382f9411f2504d7af1a13c7bce32" +PKG_LICENSE="GPL" +PKG_SITE="http://www.pango.org/" +PKG_URL="https://ftp.gnome.org/pub/gnome/sources/pango/${PKG_VERSION:0:4}/pango-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain cairo freetype fontconfig fribidi glib harfbuzz libX11 libXft" +PKG_LONGDESC="The Pango library for layout and rendering of internationalized text." +PKG_TOOLCHAIN="meson" + +PKG_MESON_OPTS_TARGET="-Denable_docs=false \ + -Dgir=false" + +pre_configure_target() { + export PKG_CONFIG_PATH="$(get_build_dir cairo)/.$TARGET_NAME/src":"$(get_build_dir libXft)/.$TARGET_NAME/src" +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/scrnsaverproto/package.mk b/packages/addons/addon-depends/chrome-depends/scrnsaverproto/package.mk new file mode 100644 index 0000000000..b34a2cfced --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/scrnsaverproto/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="scrnsaverproto" +PKG_VERSION="1.2.2" +PKG_SHA256="8bb70a8da164930cceaeb4c74180291660533ad3cc45377b30a795d1b85bcd65" +PKG_LICENSE="GPL" +PKG_SITE="http://xorg.freedesktop.org/" +PKG_URL="https://xorg.freedesktop.org/releases/individual/proto/scrnsaverproto-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="X11 Screen Saver extension wire protocol." + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/shared-mime-info/package.mk b/packages/addons/addon-depends/chrome-depends/shared-mime-info/package.mk new file mode 100644 index 0000000000..e759272316 --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/shared-mime-info/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="shared-mime-info" +PKG_VERSION="1.9" +PKG_SHA256="5c0133ec4e228e41bdf52f726d271a2d821499c2ab97afd3aa3d6cf43efcdc83" +PKG_LICENSE="GPL2" +PKG_SITE="https://freedesktop.org/wiki/Software/shared-mime-info/" +PKG_URL="http://freedesktop.org/~hadess/shared-mime-info-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain libxml2" +PKG_LONGDESC="The shared-mime-info package contains the core database of common types." +PKG_BUILD_FLAGS="-parallel" + +PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ + --disable-update-mimedb" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/chrome-depends/unclutter/package.mk b/packages/addons/addon-depends/chrome-depends/unclutter/package.mk new file mode 100644 index 0000000000..3b27053f8f --- /dev/null +++ b/packages/addons/addon-depends/chrome-depends/unclutter/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="unclutter" +PKG_VERSION="1.09" +PKG_SHA256="3a53575fe2a75a34bc9a2b0ad92ee0f8a7dbedc05d8783f191c500060a40a9bd" +PKG_LICENSE="Public Domain" +PKG_SITE="https://sourceforge.net/projects/unclutter/" +PKG_URL="https://sourceforge.net/projects/unclutter/unclutter/source_$PKG_VERSION/unclutter-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libX11" +PKG_LONGDESC="Unclutter runs in the background of an X11 session and hides the X11 Cursor." + +make_target() { + rm -f Makefile + LDFLAGS="$LDFLAGS -lX11" $MAKE unclutter +} + +makeinstall_target() { + mkdir -p .install_pkg/usr/bin + install -m 755 unclutter .install_pkg/usr/bin/ +} diff --git a/packages/addons/addon-depends/comskip/package.mk b/packages/addons/addon-depends/comskip/package.mk new file mode 100644 index 0000000000..92c23a26e3 --- /dev/null +++ b/packages/addons/addon-depends/comskip/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="comskip" +PKG_VERSION="6030aa0d3b589161ec96c6c986c48aa826fb9f72" +PKG_SHA256="df0b4b0354aef5acc17e4e94a20a396fa69c474af7579c94aad09dd490e0ee38" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kaashoek.com/comskip/" +PKG_URL="https://github.com/erikkaashoek/Comskip/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain argtable2 ffmpeg" +PKG_LONGDESC="Comskip detects commercial breaks from a video stream. It can be used for post-processing recordings." +PKG_TOOLCHAIN="autotools" + +pre_configure_target() { + LDFLAGS="$LDFLAGS -ldl" + + export argtable2_CFLAGS="-I$(get_build_dir argtable2)/src" + export argtable2_LIBS="-L$(get_build_dir argtable2)/src/.libs -largtable2" +} + +make_target() { + : +} diff --git a/packages/addons/addon-depends/containerd/package.mk b/packages/addons/addon-depends/containerd/package.mk index 32fb881ed1..b1dfab0863 100644 --- a/packages/addons/addon-depends/containerd/package.mk +++ b/packages/addons/addon-depends/containerd/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="containerd" -PKG_VERSION="0366d7e" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.2.2" +PKG_SHA256="91d480816986d74ff4fa7dd0412c787615fa705975b18fa4079c333b137c653f" PKG_LICENSE="APL" PKG_SITE="https://containerd.tools/" -PKG_URL="https://github.com/docker/containerd/archive/${PKG_VERSION}.tar.gz" -PKG_DEPENDS_HOST="toolchain go" -PKG_SECTION="system" -PKG_SHORTDESC="containerd is a daemon to control runC" -PKG_LONGDESC="containerd is a daemon to control runC, built for performance and density. containerd leverages runC's advanced features such as seccomp and user namespace support as well as checkpoint and restore for cloning and live migration of containers." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_URL="https://github.com/containerd/containerd/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain go:host" +PKG_LONGDESC="A daemon to control runC, built for performance and density." +PKG_TOOLCHAIN="manual" pre_make_target() { case $TARGET_ARCH in @@ -43,9 +24,9 @@ pre_make_target() { arm1176jzf-s) export GOARM=6 ;; - cortex-a7) - export GOARM=7 - ;; + *) + export GOARM=7 + ;; esac ;; aarch64) @@ -57,22 +38,25 @@ pre_make_target() { export CGO_ENABLED=1 export CGO_NO_EMULATION=1 export CGO_CFLAGS=$CFLAGS - export LDFLAGS="-w -extldflags -static -X github.com/docker/containerd.GitCommit=${PKG_VERSION} -extld $CC" - export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go - export GOPATH=$ROOT/$PKG_BUILD.gopath:$ROOT/$PKG_BUILD/vendor/ - export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export CONTAINERD_VERSION=v${PKG_VERSION} + export CONTAINERD_REVISION=${PKG_VERSION} + export CONTAINERD_PKG=github.com/containerd/containerd + export LDFLAGS="-w -extldflags -static -X ${CONTAINERD_PKG}/version.Version=${CONTAINERD_VERSION} -X ${CONTAINERD_PKG}/version.Revision=${CONTAINERD_REVISION} -X ${CONTAINERD_PKG}/version.Package=${CONTAINERD_PKG} -extld $CC" + export GOLANG=$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$PKG_BUILD/.gopath + export GOROOT=$TOOLCHAIN/lib/golang export PATH=$PATH:$GOROOT/bin - ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/vendor/src/github.com/docker/containerd + mkdir -p $PKG_BUILD/.gopath + if [ -d $PKG_BUILD/vendor ]; then + mv $PKG_BUILD/vendor $PKG_BUILD/.gopath/src + fi + + ln -fs $PKG_BUILD $PKG_BUILD/.gopath/src/github.com/containerd/containerd } make_target() { mkdir -p bin - $GOLANG build -v -o bin/containerd -a -tags "static_build" -ldflags "$LDFLAGS" ./containerd - $GOLANG build -v -o bin/containerd-shim -a -tags "static_build" -ldflags "$LDFLAGS" ./containerd-shim + $GOLANG build -v -o bin/containerd -a -tags "static_build no_btrfs" -ldflags "$LDFLAGS" ./cmd/containerd + $GOLANG build -v -o bin/containerd-shim -a -tags "static_build no_btrfs" -ldflags "$LDFLAGS" ./cmd/containerd-shim } - -makeinstall_target() { - : -} - diff --git a/packages/addons/addon-depends/cxxtools/package.mk b/packages/addons/addon-depends/cxxtools/package.mk index 53f0cff5e2..f7f31e898c 100644 --- a/packages/addons/addon-depends/cxxtools/package.mk +++ b/packages/addons/addon-depends/cxxtools/package.mk @@ -1,53 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="cxxtools" PKG_VERSION="2.2.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="8cebb6d6cda7c93cc4f7c0d552a68d50dd5530b699cf87916bb3b708fdc4e342" PKG_LICENSE="GPL-2" PKG_SITE="http://www.tntnet.org/cxxtools.html" PKG_URL="http://www.tntnet.org/download/${PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS_HOST="" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="python/web" -PKG_SHORTDESC="cxxtools: a collection of general-purpose C++ classes" -PKG_LONGDESC="Cxxtools is a collection of general-purpose C++ classes" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Cxxtools is a collection of general-purpose C++ classes." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_HOST="--disable-demos --with-atomictype=pthread --disable-unittest" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --disable-demos --with-atomictype=pthread --disable-unittest" -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC" - CXXFLAGS="$CXXFLAGS -fPIC" - LDFLAGS="$LDFLAGS -fPIC" -} - - post_makeinstall_host() { rm -rf $TOOLCHAIN/bin/cxxtools-config } post_makeinstall_target() { - $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/cxxtools-config + sed -e "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/cxxtools-config rm -rf $INSTALL/usr/bin } diff --git a/packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch b/packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch deleted file mode 100644 index 6e6be79401..0000000000 --- a/packages/addons/addon-depends/cxxtools/patches/cxxtools-2.2-no_shared_flag.patch +++ /dev/null @@ -1,10 +0,0 @@ -Index: cxxtools-2.2/src/Makefile.am -=================================================================== ---- cxxtools-2.2.orig/src/Makefile.am 2013-05-05 13:56:03.225204926 +0300 -+++ cxxtools-2.2/src/Makefile.am 2013-05-05 13:56:14.017219885 +0300 -@@ -215,4 +215,4 @@ - endif - - libcxxtools_la_LIBADD = $(LIBICONV) --libcxxtools_la_LDFLAGS = -version-info @sonumber@ @SHARED_LIB_FLAG@ -+libcxxtools_la_LDFLAGS = -version-info @sonumber@ diff --git a/packages/addons/addon-depends/dotnet-runtime-depends/curl3/package.mk b/packages/addons/addon-depends/dotnet-runtime-depends/curl3/package.mk new file mode 100644 index 0000000000..7beeb3d71f --- /dev/null +++ b/packages/addons/addon-depends/dotnet-runtime-depends/curl3/package.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. $(get_pkg_directory curl)/package.mk + +PKG_NAME="curl3" +PKG_URL="" +PKG_LONGDESC="curl for dotnet" + +unpack() { + mkdir -p $PKG_BUILD + cp -r $(get_build_dir curl)/* $PKG_BUILD + sed -i 's/CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@4/CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@3/g' $PKG_BUILD/lib/libcurl.vers.in +} + +makeinstall_target() { + make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET +} + +post_makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dotnet-runtime-depends/curl3/sources/trigger_unpack b/packages/addons/addon-depends/dotnet-runtime-depends/curl3/sources/trigger_unpack new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/addons/addon-depends/dotnet-runtime-depends/krb5/package.mk b/packages/addons/addon-depends/dotnet-runtime-depends/krb5/package.mk new file mode 100644 index 0000000000..08bfbc304e --- /dev/null +++ b/packages/addons/addon-depends/dotnet-runtime-depends/krb5/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="krb5" +PKG_VERSION="1.16.2-final" +PKG_SHA256="92f62e5a54404d22aa2a7eee9fba64d1be8d10d8dd3aa052e1799993208acce4" +PKG_LICENSE="MIT" +PKG_SITE="http://web.mit.edu/kerberos/" +PKG_URL="https://github.com/krb5/krb5/archive/krb5-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The Kerberos network authentication protocol." +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_regcomp=yes \ + ac_cv_printf_positional=yes \ + krb5_cv_attr_constructor_destructor=yes,yes" + +post_unpack() { + rm -rf $PKG_BUILD/doc + mv $PKG_BUILD/src/* $PKG_BUILD +} + +makeinstall_target() { + make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET +} diff --git a/packages/addons/addon-depends/dotnet-runtime-depends/lttng-ust/package.mk b/packages/addons/addon-depends/dotnet-runtime-depends/lttng-ust/package.mk new file mode 100644 index 0000000000..44708bca53 --- /dev/null +++ b/packages/addons/addon-depends/dotnet-runtime-depends/lttng-ust/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="lttng-ust" +PKG_VERSION="2.10.2" +PKG_SHA256="015452be6f94e4468315d0478cd5a4d01d9e52672bcea122b4ff7426198d5803" +PKG_LICENSE="LGPLv2.1" +PKG_SITE="https://lttng.org/" +PKG_URL="https://github.com/lttng/lttng-ust/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain userspace-rcu" +PKG_LONGDESC="LTTng is an open source tracing framework for Linux" +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_TARGET="--disable-man-pages" + +makeinstall_target() { + make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET +} diff --git a/packages/addons/addon-depends/dotnet-runtime-depends/userspace-rcu/package.mk b/packages/addons/addon-depends/dotnet-runtime-depends/userspace-rcu/package.mk new file mode 100644 index 0000000000..c6d92d1515 --- /dev/null +++ b/packages/addons/addon-depends/dotnet-runtime-depends/userspace-rcu/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="userspace-rcu" +PKG_VERSION="0.10.1" +PKG_SHA256="4ddbca9927b459b7a295dec612cf43df5886d398161d50c59d0097995e368a3b" +PKG_LICENSE="LGPLv2.1" +PKG_SITE="http://liburcu.org" +PKG_URL="https://github.com/urcu/userspace-rcu/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="userspace read-copy-update library" +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" + +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static" diff --git a/packages/addons/addon-depends/dvb-tools-depends/blindscan-s2/package.mk b/packages/addons/addon-depends/dvb-tools-depends/blindscan-s2/package.mk new file mode 100644 index 0000000000..da0fea372e --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/blindscan-s2/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="blindscan-s2" +PKG_VERSION="192eaf0b3eccfb9721b3d49b9010b5c1447776e0" +PKG_SHA256="c9e5bd07672765b30dac758844e2eb87ab68d5dc6bc731e9df6394159acddcbb" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/majortom/blindscan-s2" +PKG_URL="https://github.com/PLi-metas/blindscan-s2/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="blindscan-s2 is a program to blindscan digital satellite signals" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk b/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk index 3b7ee57c9f..84a3aa4b07 100644 --- a/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk +++ b/packages/addons/addon-depends/dvb-tools-depends/depends/bitstream/package.mk @@ -1,34 +1,13 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bitstream" -PKG_VERSION="1.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.4" +PKG_SHA256="b2484940d3b8733bec9dd1ec1731de428261dff31c9f95874264be9dc9ce786b" PKG_LICENSE="GPL" PKG_SITE="http://www.videolan.org" -PKG_URL="http://download.videolan.org/pub/videolan/${PKG_NAME}/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_URL="http://download.videolan.org/pub/videolan/bitstream/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="biTStream is a set of C headers allowing a simpler access to binary structures such as specified by MPEG, DVB, IETF, etc." -PKG_LONGDESC="biTStream is a set of C headers allowing a simpler access to binary structures such as specified by MPEG, DVB, IETF, etc." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="biTStream is a set of C headers allowing a simpler access to binary structures such as specified by MPEG, DVB, IETF." PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr" diff --git a/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk b/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk index d3850cd6a8..9ffa4623fc 100644 --- a/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk +++ b/packages/addons/addon-depends/dvb-tools-depends/depends/libev/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libev" -PKG_VERSION="4.22" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.24" +PKG_SHA256="973593d3479abdf657674a55afe5f78624b0e440614e2b8cb3a07f16d4d7f821" PKG_LICENSE="GPL" PKG_SITE="http://software.schmorp.de/pkg/libev.html" PKG_URL="http://dist.schmorp.de/libev/${PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libev: a full-featured and high-performance event loop" -PKG_LONGDESC="A full-featured and high-performance event loop that is loosely modelled after libevent, but without its limitations and bugs." +PKG_LONGDESC="A full-featured and high-performance event loop." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static" diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk index 65b8ea2b20..71d7f0cb30 100644 --- a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/package.mk @@ -1,32 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dvb-apps" PKG_VERSION="3d43b280298c" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="70c1d293ea3ddbcb970e01c8a51487ee97a4dcf33a73c0236c7d57757c7f6fb0" PKG_LICENSE="GPL" PKG_SITE="https://www.linuxtv.org/wiki/index.php/LinuxTV_dvb-apps" PKG_URL="http://linuxtv.org/hg/dvb-apps/archive/${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="Digitial Video Broadcasting (DVB) applications" -PKG_LONGDESC="Applications and utilities geared towards the initial setup, testing and operation of an DVB device supporting the DVB-S, DVB-C, DVB-T, and ATSC standards." -PKG_AUTORECONF="no" +PKG_LONGDESC="Applications for initial setup, testing and operation of an DVB device supporting the DVB-S, DVB-C, DVB-T, and ATSC." + +pre_make_target() { + export PERL_USE_UNSAFE_INC=1 +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-40-kernel-fix-4.14.patch b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-40-kernel-fix-4.14.patch new file mode 100644 index 0000000000..7fa44033a2 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvb-apps/patches/dvb-apps-40-kernel-fix-4.14.patch @@ -0,0 +1,52 @@ +From: CvH +Date: Wed, 22 Nov 2017 23:45:38 +0100 +Subject: [PATCH] fix for kernel >=4.14 + +--- + include/ca.h | 1 - + util/dst-utils/dst_test.c | 14 -------------- + 2 files changed, 15 deletions(-) + +diff --git a/include/ca.h b/include/ca.h +index c18537f..5ad21c9 100644 +--- a/include/ca.h ++++ b/include/ca.h +@@ -85,6 +85,5 @@ typedef struct ca_pid { + #define CA_GET_MSG _IOR('o', 132, ca_msg_t) + #define CA_SEND_MSG _IOW('o', 133, ca_msg_t) + #define CA_SET_DESCR _IOW('o', 134, ca_descr_t) +-#define CA_SET_PID _IOW('o', 135, ca_pid_t) + + #endif +diff --git a/util/dst-utils/dst_test.c b/util/dst-utils/dst_test.c +index 74385de..5cf3bd8 100644 +--- a/util/dst-utils/dst_test.c ++++ b/util/dst-utils/dst_test.c +@@ -111,16 +111,6 @@ static int dst_reset(int cafd) + return 0; + } + +-static int dst_set_pid(int cafd) +-{ +- if ((ioctl(cafd, CA_SET_PID)) < 0) { +- printf("%s: ioctl failed ..\n", __FUNCTION__); +- return -1; +- } +- +- return 0; +-} +- + static int dst_get_descr(int cafd) + { + if ((ioctl(cafd, CA_GET_DESCR_INFO)) < 0) { +@@ -229,10 +219,6 @@ int main(int argc, char *argv[]) + printf("%s: Reset\n", __FUNCTION__); + dst_reset(cafd); + break; +- case 'p': +- printf("%s: PID\n", __FUNCTION__); +- dst_set_pid(cafd); +- break; + case 'g': + printf("%s: Get Desc\n", __FUNCTION__); + dst_get_descr(cafd); diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvb-fe-tool/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvb-fe-tool/package.mk deleted file mode 100644 index 93132cde40..0000000000 --- a/packages/addons/addon-depends/dvb-tools-depends/dvb-fe-tool/package.mk +++ /dev/null @@ -1,62 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="dvb-fe-tool" -PKG_VERSION="fa2f7d9" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://linuxtv.org/" -PKG_URL="https://git.linuxtv.org/cgit.cgi/v4l-utils.git/snapshot/$PKG_VERSION.tar.xz" -PKG_SOURCE_DIR="$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="dvb-fe-tool: Linux V4L2 and DVB API utilities and v4l libraries (libv4l)." -PKG_LONGDESC="Linux V4L2 and DVB API utilities and v4l libraries (libv4l)." -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ - --disable-rpath \ - --disable-libdvbv5 \ - --disable-libv4l \ - --disable-v4l-utils \ - --disable-qv4l2 \ - --without-jpeg \ - --without-libiconv-prefix \ - --without-libintl-prefix" - -post_patch() { - mkdir -p $ROOT/$PKG_BUILD/build-aux/ - touch $ROOT/$PKG_BUILD/build-aux/config.rpath - touch $ROOT/$PKG_BUILD/libdvbv5-po/Makefile.in.in - touch $ROOT/$PKG_BUILD/v4l-utils-po/Makefile.in.in -} - -make_target() { - cd $ROOT/$PKG_BUILD/.$TARGET_NAME/lib/libdvbv5 - make CFLAGS="$TARGET_CFLAGS" - - cd $ROOT/$PKG_BUILD/.$TARGET_NAME/utils/dvb - make CFLAGS="$TARGET_CFLAGS" -} - -makeinstall_target() { - : # nop -} diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk index 3747cf1270..2f66627e85 100644 --- a/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk +++ b/packages/addons/addon-depends/dvb-tools-depends/dvblast/package.mk @@ -1,42 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dvblast" -PKG_VERSION="3.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="acf3844377351ea2949ce1c48dbfde589491013d" +PKG_SHA256="007d2c93876892bd09c2a520bdce0b04f6469187123bbf24cdcf0d5effec5389" PKG_LICENSE="GPL" -PKG_SITE="http://www.videolan.org" -PKG_URL="http://downloads.videolan.org/pub/videolan/dvblast/${PKG_VERSION}/dvblast-${PKG_VERSION}.tar.bz2" +PKG_SITE="https://www.videolan.org/projects/dvblast.html" +PKG_URL="http://repo.or.cz/dvblast.git/snapshot/${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain bitstream libev" -PKG_SECTION="tools" -PKG_SHORTDESC="DVBlast is a simple and powerful MPEG-2/TS demux and streaming application" PKG_LONGDESC="DVBlast is a simple and powerful MPEG-2/TS demux and streaming application" -PKG_AUTORECONF="no" - -MAKEFLAGS="V=1" pre_configure_target() { export LDFLAGS="$LDFLAGS -lm" } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvblast/patches/dvblast-ldflags.patch b/packages/addons/addon-depends/dvb-tools-depends/dvblast/patches/dvblast-ldflags.patch deleted file mode 100644 index 9ad9e2080b..0000000000 --- a/packages/addons/addon-depends/dvb-tools-depends/dvblast/patches/dvblast-ldflags.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -Naur dvblast-3.0/Makefile dvblast-3.0.patch/Makefile ---- dvblast-3.0/Makefile 2015-10-05 17:51:14.000000000 +0200 -+++ dvblast-3.0.patch/Makefile 2016-03-26 22:54:59.953303040 +0100 -@@ -55,11 +55,11 @@ - - dvblast: $(OBJ_DVBLAST) - @echo "LINK $@" -- $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLAST) $(LDLIBS_DVBLAST) $(LDLIBS) -+ $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLAST) $(LDFLAGS) $(LDLIBS_DVBLAST) $(LDLIBS) - - dvblastctl: $(OBJ_DVBLASTCTL) - @echo "LINK $@" -- $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLASTCTL) $(LDLIBS) -+ $(Q)$(CROSS)$(CC) -o $@ $(OBJ_DVBLASTCTL) $(LDFLAGS) $(LDLIBS) - - clean: - @echo "CLEAN $(CLEAN_OBJS)" diff --git a/packages/addons/addon-depends/dvb-tools-depends/dvbsnoop/package.mk b/packages/addons/addon-depends/dvb-tools-depends/dvbsnoop/package.mk new file mode 100644 index 0000000000..94ebc41800 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/dvbsnoop/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="dvbsnoop" +PKG_VERSION="badf61fcdab1177c1162747be06d035a2b671e9b" +PKG_SHA256="7f0f5d9ca15c5caae3ca249d95a5fc30cececd16f63e00a1404e0d2368ce56fa" +PKG_LICENSE="GPL" +PKG_SITE="http://dvbsnoop.sourceforge.net/" +PKG_URL="https://github.com/persianpros/dvbsnoop/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="dvbsnoop is a DVB/MPEG stream analyzer program" +PKG_TOOLCHAIN="autotools" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/mumudvb/package.mk b/packages/addons/addon-depends/dvb-tools-depends/mumudvb/package.mk new file mode 100644 index 0000000000..f430cdb9a7 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/mumudvb/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mumudvb" +PKG_VERSION="6153f87a17a94fbf6e71d710bef39c313302b494" +PKG_SHA256="4e8dd903d0cba1e798c3921da83b332a9bbb5ad2102f5c1a9699965af6989e28" +PKG_LICENSE="GPL" +PKG_SITE="http://mumudvb.net/" +PKG_URL="https://github.com/braice/MuMuDVB/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libdvbcsa" +PKG_LONGDESC="MuMuDVB (Multi Multicast DVB) is a program that streams from DVB on a network using multicasting or unicast" +PKG_TOOLCHAIN="autotools" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/szap-s2/package.mk b/packages/addons/addon-depends/dvb-tools-depends/szap-s2/package.mk new file mode 100644 index 0000000000..22c8e165ef --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/szap-s2/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="szap-s2" +PKG_VERSION="69ff3584caf9b46f7a551b39b9f9956f8461377c" +PKG_SHA256="eea8d99d2d5d6403d624acdd9df908a2dd7767dd5469b44e9a281ff863096b32" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/updatelee/tune-s2" +PKG_URL="https://bitbucket.org/CrazyCat/szap-s2/get/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="szap-s2 is a simple zapping tool for the Linux DVB S2 API" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/t2scan/package.mk b/packages/addons/addon-depends/dvb-tools-depends/t2scan/package.mk new file mode 100644 index 0000000000..8d337201eb --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/t2scan/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="t2scan" +PKG_VERSION="8b9ad91e8685ff80e7c5d924caec83f1ee49ebf3" +PKG_SHA256="cdfae6232ba1bbc954bd228f9db217d004c07407cf46245816d39f4599e91111" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/mighty-p/t2scan" +PKG_URL="https://github.com/mighty-p/t2scan/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A small channel scan tool which generates DVB-T/T2 channels.conf files." + +# aml 3.14 hack +pre_configure_target() { + if [ "$LINUX" = "amlogic-3.14" -o "$LINUX" = "amlogic-3.10" ]; then + sed -i 's/DVB_HEADER=0/DVB_HEADER=1/g' $PKG_BUILD/configure* + sed -i 's/HAS_DVB_API5=0/HAS_DVB_API5=1/g' $PKG_BUILD/configure* + fi +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/tune-s2/package.mk b/packages/addons/addon-depends/dvb-tools-depends/tune-s2/package.mk new file mode 100644 index 0000000000..4b260f2335 --- /dev/null +++ b/packages/addons/addon-depends/dvb-tools-depends/tune-s2/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="tune-s2" +PKG_VERSION="60cc4aaa70b646d38f2e40251860375283c44816" +PKG_SHA256="e39069a0f2f0930809647052fe1f8c9a13f05af537013b03a99f09ceb9bfb997" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/updatelee/tune-s2" +PKG_URL="https://bitbucket.org/CrazyCat/tune-s2/get/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="tune-s2 is a small linux app to be able to tune a dvb devices" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/dvb-tools-depends/w_scan/package.mk b/packages/addons/addon-depends/dvb-tools-depends/w_scan/package.mk index c1734f45e8..70f8988187 100644 --- a/packages/addons/addon-depends/dvb-tools-depends/w_scan/package.mk +++ b/packages/addons/addon-depends/dvb-tools-depends/w_scan/package.mk @@ -1,38 +1,24 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="w_scan" -PKG_VERSION="20141122" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="20170107" +PKG_SHA256="38e0f38a7bf06cff6d6ea01652ad4ee60da2cb0e937360468f936da785b46ffe" PKG_LICENSE="GPL" PKG_SITE="http://wirbel.htpc-forum.de/w_scan/index2.html" PKG_URL="http://wirbel.htpc-forum.de/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="DVBlast is a small channel scan tool to create an channel.conf for VDR" -PKG_LONGDESC="DVBlast is a small channel scan tool to create an channel.conf for VDR" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A channel scan tool which generates ATSC, DVB-C, DVB-S/S2 and DVB-T channels.conf files." +PKG_TOOLCHAIN="autotools" -# aml 3.14 is meh +# aml 3.14 hack pre_configure_target() { -if [ "$TARGET_ARCH" = "aarch64" ]; then - sed -i 's/DVB_HEADER=0/DVB_HEADER=1/g' $ROOT/$PKG_BUILD/configure* - sed -i 's/HAS_DVB_API5=0/HAS_DVB_API5=1/g' $ROOT/$PKG_BUILD/configure* -fi + if [ "$LINUX" = "amlogic-3.14" -o "$LINUX" = "amlogic-3.10" ]; then + sed -i 's/DVB_HEADER=0/DVB_HEADER=1/g' $PKG_BUILD/configure* + sed -i 's/HAS_DVB_API5=0/HAS_DVB_API5=1/g' $PKG_BUILD/configure* + fi +} + +makeinstall_target() { + : } diff --git a/packages/addons/addon-depends/emby-depends/ffmpegx/package.mk b/packages/addons/addon-depends/emby-depends/ffmpegx/package.mk deleted file mode 100644 index 111f960642..0000000000 --- a/packages/addons/addon-depends/emby-depends/ffmpegx/package.mk +++ /dev/null @@ -1,113 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="ffmpegx" -PKG_VERSION="libreelec" -PKG_REV="6" -PKG_ARCH="any" -PKG_LICENSE="LGPLv2.1+" -PKG_SITE="https://ffmpeg.org" -PKG_DEPENDS_TARGET="toolchain ffmpeg lame x264" -PKG_SECTION="multimedia" -PKG_SHORTDESC="FFmpeg+" -PKG_LONGDESC="FFmpeg built static with additional features" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - cd "$ROOT/$PKG_BUILD" - rm -rf ".$TARGET_NAME" - cp -PR $(get_build_dir ffmpeg)/* . - make clean - -# ffmpeg builds better with these options - strip_gold - strip_lto - - if [ "$KODIPLAYER_DRIVER" == "bcm2835-driver" ]; then - CFLAGS="-DRPI=1 -I$SYSROOT_PREFIX/usr/include/IL -I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux $CFLAGS" - FFMPEG_LIBS="-lbcm_host -ldl -lmmal -lmmal_core -lmmal_util -lvchiq_arm -lvcos -lvcsm" - FFMPEG_RPI_HADE="--enable-mmal --enable-omx-rpi" - fi - -# ffmpeg does not build with libx264 on aarch64 - if [ "$TARGET_ARCH" != "aarch64" ]; then - FFMPEG_X264="--enable-libx264" - fi - - if [ "$TARGET_ARCH" == "arm" ]; then - FFMPEG_ARM_AO="--enable-hardcoded-tables" - fi -} - -configure_target() { - ./configure \ - \ - `#Licensing options` \ - --enable-gpl \ - \ - `#Documentation options` \ - --disable-doc \ - \ - `#Hardware accelerated decoding encoding` \ - $FFMPEG_RPI_HADE \ - \ - `#External library support` \ - --enable-libmp3lame \ - $FFMPEG_X264 \ - --enable-openssl \ - \ - `#Toolchain options` \ - --arch="$TARGET_ARCH" \ - --cpu="$TARGET_CPU" \ - --cross-prefix="$TARGET_PREFIX" \ - --enable-cross-compile \ - --sysroot="$SYSROOT_PREFIX" \ - --sysinclude="$SYSROOT_PREFIX/usr/include" \ - --target-os="linux" \ - --nm="$NM" \ - --ar="$AR" \ - --as="$CC" \ - --cc="$CC" \ - --ld="$CC" \ - --pkg-config="$ROOT/$TOOLCHAIN/bin/pkg-config" \ - --host-cc="$HOST_CC" \ - --host-cflags="$HOST_CFLAGS" \ - --host-ldflags="$HOST_LDFLAGS" \ - --host-libs="-lm" \ - --extra-cflags="$CFLAGS" \ - --extra-ldflags="$LDFLAGS" \ - --extra-libs="$FFMPEG_LIBS" \ - --extra-version="x" \ - --enable-pic \ - \ - `#Advanced options` \ - $FFMPEG_ARM_AO \ - -} - -makeinstall_target() { - make install DESTDIR=$INSTALL -} - -post_makeinstall_target() { - for ff in $INSTALL/usr/local/bin/*; do mv $ff ${ff}x; done - rm -fr $INSTALL/usr/local/include - rm -fr $INSTALL/usr/local/share/ffmpeg/examples -} diff --git a/packages/addons/addon-depends/emby-depends/imagemagick/package.mk b/packages/addons/addon-depends/emby-depends/imagemagick/package.mk index 45d1d23441..ec672a3a6c 100644 --- a/packages/addons/addon-depends/emby-depends/imagemagick/package.mk +++ b/packages/addons/addon-depends/emby-depends/imagemagick/package.mk @@ -1,43 +1,22 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="imagemagick" -PKG_VERSION="6.9.6-7" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="7.0.8-11" +PKG_SHA256="95e4da5fa109bc8b59b5e7a54cdfcf1af3230067c95adf608ff21c08eca1de20" PKG_LICENSE="http://www.imagemagick.org/script/license.php" PKG_SITE="http://www.imagemagick.org/" -PKG_URL="http://www.imagemagick.org/download/releases/ImageMagick-$PKG_VERSION.tar.xz" -PKG_SOURCE_DIR="ImageMagick-$PKG_VERSION" -PKG_DEPENDS_TARGET="toolchain libX11" -PKG_SECTION="graphics" -PKG_SHORTDESC="ImageMagick" +PKG_URL="https://github.com/ImageMagick/ImageMagick/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" PKG_LONGDESC="Software suite to create, edit, compose, or convert bitmap images" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static \ +PKG_CONFIGURE_OPTS_TARGET="--disable-openmp \ + --disable-static \ --enable-shared \ - --with-quantum-depth=8 \ - --enable-hdri=no \ - --disable-openmp" + --with-pango=no \ + --with-utilities=no \ + --with-x=no" makeinstall_target() { - make install DESTDIR=$INSTALL + make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET } diff --git a/packages/addons/addon-depends/emby-depends/x264/package.mk b/packages/addons/addon-depends/emby-depends/x264/package.mk deleted file mode 100644 index c01bb06da3..0000000000 --- a/packages/addons/addon-depends/emby-depends/x264/package.mk +++ /dev/null @@ -1,52 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="x264" -PKG_VERSION="snapshot-20161203-2245-stable" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.videolan.org/developers/x264.html" -PKG_URL="ftp://ftp.videolan.org/pub/videolan/x264/snapshots/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="x264" -PKG_LONGDESC="x264" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - cd $ROOT/$PKG_BUILD - rm -rf .$TARGET_NAME -} - -configure_target() { - ./configure \ - --prefix="/usr" \ - --extra-cflags="$CFLAGS" \ - --extra-ldflags="$LDFLAGS" \ - --disable-cli \ - --enable-static \ - --enable-strip \ - --disable-asm \ - --enable-pic \ - --host="$TARGET_NAME" \ - --cross-prefix="$TARGET_PREFIX" \ - --sysroot="$SYSROOT_PREFIX" -} diff --git a/packages/addons/addon-depends/enca/package.mk b/packages/addons/addon-depends/enca/package.mk index 5bd6d7effb..9b10033db0 100644 --- a/packages/addons/addon-depends/enca/package.mk +++ b/packages/addons/addon-depends/enca/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="enca" PKG_VERSION="1.19" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="3a487eca40b41021e2e4b7a6440b97d822e6532db5464471f572ecf77295e8b8" PKG_LICENSE="GPL" PKG_SITE="http://freshmeat.net/projects/enca/" PKG_URL="http://dl.cihar.com/enca/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="enca: detects the encoding of text files, on the basis of knowledge of their language." -PKG_LONGDESC="Enca detects the encoding of text files, on the basis of knowledge of their language. It can also convert them to other encodings, allowing you to recode files without knowing their current encoding. It supports most of Central and East European languages, and a few Unicode variants, independently on language." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Enca detects the encoding of text files, on the basis of knowledge of their language." +PKG_BUILD_FLAGS="+pic" PKG_MAKEINSTALL_OPTS_TARGET="-C lib" PKG_CONFIGURE_OPTS_TARGET="ac_cv_file__dev_random=yes \ @@ -44,10 +24,6 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_file__dev_random=yes \ --disable-rpath \ --with-gnu-ld" -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" -} - pre_make_target() { make CC="$HOST_CC" \ CPPFLAGS="$HOST_CPPFLAGS" \ diff --git a/packages/addons/addon-depends/enet/package.mk b/packages/addons/addon-depends/enet/package.mk index 2540000071..b842bc5ef3 100644 --- a/packages/addons/addon-depends/enet/package.mk +++ b/packages/addons/addon-depends/enet/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="enet" -PKG_VERSION="1.3.13" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e33ca1d" +PKG_SHA256="0ba5547de2c4c7fc79d367179a9bc92a7ac27e9258dd50fb277cd8761afaf9b0" PKG_LICENSE="" -PKG_SITE="" -PKG_URL="http://enet.bespin.org/download/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/cgutman/enet/" +PKG_URL="https://github.com/cgutman/enet/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol)" -PKG_LONGDESC="ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol)" - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A network communication layer on top of UDP (User Datagram Protocol)." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/enum34/package.mk b/packages/addons/addon-depends/enum34/package.mk index 7337a61e6d..f5ef059c0f 100644 --- a/packages/addons/addon-depends/enum34/package.mk +++ b/packages/addons/addon-depends/enum34/package.mk @@ -1,42 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="enum34" PKG_VERSION="1.1.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="b09c7f7ee925e600bd4efaa5fef49919eacdbdfd5a52e0696c5d03010cffb9ec" PKG_LICENSE="BSD" PKG_SITE="https://bitbucket.org/stoneleaf/enum34" PKG_URL="https://bitbucket.org/stoneleaf/$PKG_NAME/get/$PKG_VERSION.tar.bz2" -PKG_SOURCE_DIR="stoneleaf-enum34-*" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_PRIORITY="optional" -PKG_SECTION="python" -PKG_SHORTDESC="Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4" -PKG_LONGDESC="Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4." +PKG_TOOLCHAIN="manual" make_target() { python setup.py build } - -makeinstall_target() { - : -} diff --git a/packages/addons/addon-depends/faad2/package.mk b/packages/addons/addon-depends/faad2/package.mk index 3659ed1c5b..349321c11e 100644 --- a/packages/addons/addon-depends/faad2/package.mk +++ b/packages/addons/addon-depends/faad2/package.mk @@ -1,45 +1,22 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="faad2" -PKG_VERSION="2.7" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.8.8" +PKG_SHA256="985c3fadb9789d2815e50f4ff714511c79c2710ac27a4aaaf5c0c2662141426d" PKG_LICENSE="GPL" -PKG_SITE="http://www.audiocoding.com/" -PKG_URL="$SOURCEFORGE_SRC/faac/faad2-src/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="http://www.audiocoding.com" +PKG_URL="https://downloads.sourceforge.net/sourceforge/faac/faad2-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="faad: An MPEG-4 AAC decoder" -PKG_LONGDESC="The FAAD project includes the AAC decoder FAAD2. It supports several MPEG-4 object types (LC, Main, LTP, HE AAC, PS) and file formats (ADTS AAC, raw AAC, MP4), multichannel and gapless decoding as well as MP4 metadata tags. The codecs are compatible with standard-compliant audio applications using one or more of these profiles." +PKG_LONGDESC="An MPEG-4 AAC decoder." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAINTAINER="Team LibreELEC (addons@libreelec.tv)" - -# package specific configure options PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ - --without-xmms \ --without-drm \ + --with-gnu-ld \ --without-mpeg4ip \ - --with-gnu-ld" + --without-xmms" post_makeinstall_target() { rm -rf $INSTALL/usr/bin diff --git a/packages/addons/addon-depends/faad2/patches/faad2-2.7-automake_1.13.patch b/packages/addons/addon-depends/faad2/patches/faad2-2.7-automake_1.13.patch deleted file mode 100644 index 56724f3f14..0000000000 --- a/packages/addons/addon-depends/faad2/patches/faad2-2.7-automake_1.13.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur faad2-2.7-old/configure.in faad2-2.7-new/configure.in ---- faad2-2.7-old/configure.in 2009-02-04 16:51:03.000000000 -0800 -+++ faad2-2.7-new/configure.in 2012-12-30 14:58:33.000000000 -0800 -@@ -25,7 +25,7 @@ - AC_PROG_MAKE_SET - AC_CHECK_PROGS(RPMBUILD, rpmbuild, rpm) - --AM_CONFIG_HEADER(config.h) -+AC_CONFIG_HEADERS(config.h) - - AC_ARG_WITH(xmms,[ --with-xmms compile XMMS-1 plugin], - WITHXMMS=$withval, WITHXMMS=no) diff --git a/packages/addons/addon-depends/faad2/patches/faad2-2.7-mp4ff_shared.patch b/packages/addons/addon-depends/faad2/patches/faad2-2.7-mp4ff_shared.patch deleted file mode 100644 index fb97e81e9c..0000000000 --- a/packages/addons/addon-depends/faad2/patches/faad2-2.7-mp4ff_shared.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -Naur faad2-2.7-old/common/mp4ff/Makefile.am faad2-2.7-new/common/mp4ff/Makefile.am ---- faad2-2.7-old/common/mp4ff/Makefile.am 2009-02-06 06:24:21.000000000 -0800 -+++ faad2-2.7-new/common/mp4ff/Makefile.am 2009-02-11 05:36:14.000000000 -0800 -@@ -1,7 +1,7 @@ --lib_LIBRARIES = libmp4ff.a --include_HEADERS = mp4ff.h mp4ffint.h -+lib_LTLIBRARIES = libmp4ff.la -+include_HEADERS = mp4ff.h mp4ffint.h mp4ff_int_types.h - --libmp4ff_a_CFLAGS = -DUSE_TAGGING=1 -+libmp4ff_la_CFLAGS = -DUSE_TAGGING=1 - --libmp4ff_a_SOURCES = mp4ff.c mp4atom.c mp4meta.c mp4sample.c mp4util.c \ -- mp4tagupdate.c mp4ff.h mp4ffint.h mp4ff_int_types.h -+libmp4ff_la_SOURCES = mp4ff.c mp4atom.c mp4meta.c mp4sample.c mp4util.c \ -+ mp4tagupdate.c mp4ff.h mp4ffint.h mp4ff_int_types.h -diff -Naur faad2-2.7-old/frontend/Makefile.am faad2-2.7-new/frontend/Makefile.am ---- faad2-2.7-old/frontend/Makefile.am 2009-02-06 08:03:37.000000000 -0800 -+++ faad2-2.7-new/frontend/Makefile.am 2009-02-11 05:35:52.000000000 -0800 -@@ -5,7 +5,7 @@ - -I$(top_srcdir)/common/mp4ff - - faad_LDADD = $(top_builddir)/libfaad/libfaad.la \ -- $(top_builddir)/common/mp4ff/libmp4ff.a -+ $(top_builddir)/common/mp4ff/libmp4ff.la - - faad_SOURCES = main.c \ - audio.c audio.h \ diff --git a/packages/addons/addon-depends/ffmpegx-depends/libvpx/package.mk b/packages/addons/addon-depends/ffmpegx-depends/libvpx/package.mk new file mode 100644 index 0000000000..00cfe65f38 --- /dev/null +++ b/packages/addons/addon-depends/ffmpegx-depends/libvpx/package.mk @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libvpx" +PKG_VERSION="1.7.0" +PKG_SHA256="1fec931eb5c94279ad219a5b6e0202358e94a93a90cfb1603578c326abfc1238" +PKG_LICENSE="BSD" +PKG_SITE="https://www.webmproject.org" +PKG_URL="https://github.com/webmproject/libvpx/archive/v${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="WebM VP8/VP9 Codec" + +configure_target() { + + case $ARCH in + aarch64) + PKG_TARGET_NAME_LIBVPX="arm64-linux-gcc" + ;; + arm) + PKG_TARGET_NAME_LIBVPX="armv7-linux-gcc" + ;; + x86_64) + PKG_DEPENDS_TARGET+=" nasm:host" + PKG_TARGET_NAME_LIBVPX="x86_64-linux-gcc" + ;; + esac + + $PKG_CONFIGURE_SCRIPT --prefix=/usr \ + --extra-cflags="$CFLAGS" \ + --as=nasm \ + --target=$PKG_TARGET_NAME_LIBVPX \ + --disable-docs \ + --disable-examples \ + --disable-shared \ + --disable-tools \ + --disable-unit-tests \ + --disable-vp8-decoder \ + --disable-vp9-decoder \ + --enable-ccache \ + --enable-pic \ + --enable-static \ + --enable-vp8 \ + --enable-vp9 +} diff --git a/packages/addons/addon-depends/ffmpegx-depends/x264/package.mk b/packages/addons/addon-depends/ffmpegx-depends/x264/package.mk new file mode 100644 index 0000000000..2f295e4b55 --- /dev/null +++ b/packages/addons/addon-depends/ffmpegx-depends/x264/package.mk @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="x264" +PKG_VERSION="545de2ffec6ae9a80738de1b2c8cf820249a2530" +PKG_SHA256="74725cf7036b2c96387c2c014ef00d181942d00230f21e16277f11d2d9683adc" +PKG_LICENSE="GPL" +PKG_SITE="http://www.videolan.org/developers/x264.html" +PKG_URL="http://repo.or.cz/x264.git/snapshot/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="x264 codec" + +if [ "$TARGET_ARCH" = "x86_64" ]; then + PKG_DEPENDS_TARGET+=" nasm:host" +fi + +pre_configure_target() { + cd $PKG_BUILD + rm -rf .$TARGET_NAME + + if [ "$TARGET_ARCH" = "x86_64" ]; then + export AS="$TOOLCHAIN/bin/nasm" + else + PKG_X264_ASM="--disable-asm" + fi +} + +configure_target() { + ./configure \ + --cross-prefix="$TARGET_PREFIX" \ + --extra-cflags="$CFLAGS" \ + --extra-ldflags="$LDFLAGS" \ + --host="$TARGET_NAME" \ + --prefix="/usr" \ + --sysroot="$SYSROOT_PREFIX" \ + $PKG_X264_ASM \ + --disable-cli \ + --enable-lto \ + --enable-pic \ + --enable-static \ + --enable-strip +} diff --git a/packages/addons/addon-depends/ffmpegx-depends/x265/package.mk b/packages/addons/addon-depends/ffmpegx-depends/x265/package.mk new file mode 100644 index 0000000000..53709c804c --- /dev/null +++ b/packages/addons/addon-depends/ffmpegx-depends/x265/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="x265" +PKG_VERSION="2.9" +PKG_SHA256="ebae687c84a39f54b995417c52a2fdde65a4e2e7ebac5730d251471304b91024" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://www.videolan.org/developers/x265.html" +PKG_URL="http://download.videolan.org/pub/videolan/x265/${PKG_NAME}_${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="x265 is a H.265/HEVC video encoder application library" +PKG_TOOLCHAIN="make" + +pre_configure_target() { + LDFLAGS="$LDFLAGS -ldl" + cmake -G "Unix Makefiles" ./source +} diff --git a/packages/addons/addon-depends/ffmpegx/package.mk b/packages/addons/addon-depends/ffmpegx/package.mk new file mode 100644 index 0000000000..af24251ec5 --- /dev/null +++ b/packages/addons/addon-depends/ffmpegx/package.mk @@ -0,0 +1,188 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ffmpegx" +PKG_VERSION="4.1" +PKG_SHA256="7afb163d6974693cdad742aa1224c33683c50845c67ee5ae35506efc631ac121" +PKG_LICENSE="LGPLv2.1+" +PKG_SITE="https://ffmpeg.org" +PKG_URL="https://github.com/FFmpeg/FFmpeg/archive/n${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain aom bzip2 gnutls libvorbis opus x264 zlib" +PKG_LONGDESC="FFmpegx is an complete FFmpeg build to support encoding and decoding." +PKG_BUILD_FLAGS="-gold" + +# Dependencies +get_graphicdrivers + +if [ "$KODIPLAYER_DRIVER" == "bcm2835-driver" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver" +fi + +if [ "$TARGET_ARCH" = "x86_64" ]; then + PKG_DEPENDS_TARGET+=" nasm:host x265" +fi + +if [[ ! $TARGET_ARCH = arm ]] || target_has_feature neon; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvpx" +fi + +# X11 grab for screen recording +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libxcb libX11" +fi + +pre_configure_target() { + cd $PKG_BUILD + rm -rf .$TARGET_NAME + + # pass gnutls to build + PKG_CONFIG_PATH="$(get_build_dir gnutls)/.INSTALL_PKG/usr/lib/pkgconfig" + CFLAGS="$CFLAGS -I$(get_build_dir gnutls)/.INSTALL_PKG/usr/include" + LDFLAGS="$LDFLAGS -L$(get_build_dir gnutls)/.INSTALL_PKG/usr/lib" + + if [ "$KODIPLAYER_DRIVER" == "bcm2835-driver" ]; then + CFLAGS="-DRPI=1 -I$SYSROOT_PREFIX/usr/include/IL -I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux $CFLAGS" + PKG_FFMPEG_LIBS="-lbcm_host -ldl -lmmal -lmmal_core -lmmal_util -lvchiq_arm -lvcos -lvcsm" + fi + +# HW encoders + + # RPi 0-3 + if [ "$KODIPLAYER_DRIVER" == "bcm2835-driver" ]; then + PKG_FFMPEG_HW_ENCODERS_RPi="\ + `#Video encoders` \ + --enable-omx-rpi \ + --enable-mmal \ + --enable-encoder=h264_omx \ + \ + `#Video hwaccel` \ + --enable-hwaccel=h264_mmal \ + --enable-hwaccel=mpeg2_mmal \ + --enable-hwaccel=mpeg4_mmal \ + --enable-hwaccel=vc1_mmal" + fi + + # Generic + if [[ "$TARGET_ARCH" = "x86_64" ]]; then + PKG_FFMPEG_HW_ENCODERS_GENERIC="\ + `#Video encoders` \ + --enable-encoder=h264_nvenc \ + --enable-encoder=h264_vaapi \ + --enable-encoder=hevc_nvenc \ + --enable-encoder=hevc_vaapi \ + --enable-encoder=mjpeg_vaapi \ + --enable-encoder=mpeg2_vaapi \ + --enable-encoder=vp8_vaapi \ + --enable-encoder=vp9_vaapi \ + \ + `#Video hwaccel` \ + --enable-hwaccel=h263_vaapi \ + --enable-hwaccel=h264_vaapi \ + --enable-hwaccel=hevc_vaapi \ + --enable-hwaccel=mjpeg_vaapi \ + --enable-hwaccel=mpeg2_vaapi \ + --enable-hwaccel=mpeg4_vaapi \ + --enable-hwaccel=vc1_vaapi \ + --enable-hwaccel=vp8_vaapi \ + --enable-hwaccel=vp9_vaapi \ + --enable-hwaccel=wmv3_vaapi" + fi + +# Encoders + PKG_FFMPEG_ENCODERS="\ + `#Video encoders` \ + --enable-libvpx \ + --enable-encoder=libvpx_vp8 \ + --enable-encoder=libvpx_vp9 \ + --enable-libx264 \ + --enable-encoder=x264 \ + --enable-libx265 \ + --enable-encoder=x265 \ + --enable-libaom \ + --enable-encoder=libaom_av1 \ + \ + `#Audio encoders` \ + --enable-encoder=aac \ + --enable-encoder=ac3 \ + --enable-encoder=eac3 \ + --enable-encoder=flac \ + --enable-libmp3lame \ + --enable-encoder=libmp3lame \ + --enable-libopus \ + --enable-encoder=libopus \ + --enable-libvorbis \ + --enable-encoder=libvorbis" + +# X11 grab for screen recording + if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_FFMPEG_LIBS="$PKG_FFMPEG_LIBS -lX11" + PKG_FFMPEG_X11_GRAB="\ + --enable-libxcb \ + --enable-libxcb-shm \ + --enable-libxcb-xfixes \ + --enable-libxcb-shape" + fi +} + +configure_target() { + ./configure \ + \ + `#Programs to build` \ + --enable-ffmpeg \ + --disable-ffplay \ + --enable-ffprobe \ + \ + `#Static and Shared` \ + --enable-static \ + --disable-shared \ + \ + `#Licensing options` \ + --enable-gpl \ + --disable-nonfree \ + \ + `#Documentation options` \ + --disable-doc \ + \ + `#Hardware accelerated decoding encoding` \ + $PKG_FFMPEG_HW_ENCODERS_RPi \ + $PKG_FFMPEG_HW_ENCODERS_GENERIC \ + \ + `#General options` \ + --enable-avresample \ + --disable-lzma \ + --disable-alsa \ + $PKG_FFMPEG_X11_GRAB \ + \ + `#Toolchain options` \ + --arch="$TARGET_ARCH" \ + --cpu="$TARGET_CPU" \ + --cross-prefix="$TARGET_PREFIX" \ + --enable-cross-compile \ + --sysroot="$SYSROOT_PREFIX" \ + --sysinclude="$SYSROOT_PREFIX/usr/include" \ + --target-os="linux" \ + --nm="$NM" \ + --ar="$AR" \ + --as="$CC" \ + --cc="$CC" \ + --ld="$CC" \ + --pkg-config="$TOOLCHAIN/bin/pkg-config" \ + --host-cc="$HOST_CC" \ + --host-cflags="$HOST_CFLAGS" \ + --host-ldflags="$HOST_LDFLAGS" \ + --host-extralibs="-lm" \ + --extra-cflags="$CFLAGS" \ + --extra-ldflags="$LDFLAGS" \ + --extra-libs="$PKG_FFMPEG_LIBS" \ + --enable-pic \ + --enable-gnutls \ + --disable-openssl \ + \ + `#Advanced options` \ + --disable-hardcoded-tables \ + +} + +makeinstall_target() { + make install DESTDIR="$INSTALL/../.INSTALL_PKG" +} diff --git a/packages/addons/addon-depends/game-tools/bchunk/package.mk b/packages/addons/addon-depends/game-tools/bchunk/package.mk new file mode 100644 index 0000000000..44c98d9075 --- /dev/null +++ b/packages/addons/addon-depends/game-tools/bchunk/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="bchunk" +PKG_VERSION="1.2.0" +PKG_SHA256="afdc9d5e38bdd16f0b8b9d9d382b0faee0b1e0494446d686a08b256446f78b5d" +PKG_LICENSE="GPL" +PKG_SITE="http://he.fi/bchunk/" +PKG_URL="http://he.fi/bchunk/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Tool to convert a CD image in a .bin/.cue format to a set of .iso and .cdr tracks." + +makeinstall_target() { + : +} + +make_target() { + make $PKG_MAKE_OPTS_TARGET CC=$CC LD=$CC +} diff --git a/packages/addons/addon-depends/game-tools/ecm-tools/package.mk b/packages/addons/addon-depends/game-tools/ecm-tools/package.mk new file mode 100644 index 0000000000..b8baf4b1ee --- /dev/null +++ b/packages/addons/addon-depends/game-tools/ecm-tools/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ecm-tools" +PKG_VERSION="55365b0" +PKG_SHA256="39c2d0e36b1cba33fa9fee1c0a2a63f851b561fceb59dc99550a1e8e580d3b5a" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/alucryd/ecm-tools" +PKG_URL="https://github.com/alucryd/ecm-tools/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Error Code Modeler.s" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/game-tools/iat/package.mk b/packages/addons/addon-depends/game-tools/iat/package.mk new file mode 100644 index 0000000000..30ab5b2a7d --- /dev/null +++ b/packages/addons/addon-depends/game-tools/iat/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="iat" +PKG_VERSION="0.1.7" +PKG_SHA256="fb72c42f4be18107ec1bff8448bd6fac2a3926a574d4950a4d5120f0012d62ca" +PKG_LICENSE="GPL" +PKG_SITE="https://sourceforge.net/projects/iat.berlios/" +PKG_URL="https://sourceforge.net/projects/iat.berlios/files/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Iso9660 Analyzer Tool to detect many structures of image file." + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/game-tools/linuxconsoletools/package.mk b/packages/addons/addon-depends/game-tools/linuxconsoletools/package.mk new file mode 100644 index 0000000000..39e192b8d7 --- /dev/null +++ b/packages/addons/addon-depends/game-tools/linuxconsoletools/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="linuxconsoletools" +PKG_VERSION="1.5.1" +PKG_SHA256="0bd07aacea251d63d3d8a458728c7f965f41ae45891d906cefedc3fde0753b1e" +PKG_LICENSE="GPL" +PKG_SITE="http://sourceforge.net/projects/linuxconsole/" +PKG_URL="http://prdownloads.sourceforge.net/linuxconsole/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Set of utilities for joysticks and serial devices." + +PKG_MAKE_OPTS_TARGET="SYSTEMD_SUPPORT=0" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/game-tools/linuxconsoletools/patches/linuxconsoletools-0001-disable-building-ffmvforce.patch b/packages/addons/addon-depends/game-tools/linuxconsoletools/patches/linuxconsoletools-0001-disable-building-ffmvforce.patch new file mode 100644 index 0000000000..bfc9ae0b89 --- /dev/null +++ b/packages/addons/addon-depends/game-tools/linuxconsoletools/patches/linuxconsoletools-0001-disable-building-ffmvforce.patch @@ -0,0 +1,12 @@ +diff -Naur a/utils/Makefile b/utils/Makefile +--- a/utils/Makefile 2016-04-19 13:20:50.000000000 -0700 ++++ b/utils/Makefile 2016-10-20 00:31:34.238941511 -0700 +@@ -27,7 +27,7 @@ + + CFLAGS ?= -g -O2 -Wall + +-PROGRAMS = inputattach jstest jscal fftest ffmvforce ffset \ ++PROGRAMS = inputattach jstest jscal fftest ffset \ + ffcfstress jscal-restore jscal-store evdev-joystick + + PREFIX ?= /usr/local diff --git a/packages/addons/addon-depends/gdk-pixbuf/config/gdk-pixbuf.loaders b/packages/addons/addon-depends/gdk-pixbuf/config/gdk-pixbuf.loaders deleted file mode 100644 index 87a9bb58a6..0000000000 --- a/packages/addons/addon-depends/gdk-pixbuf/config/gdk-pixbuf.loaders +++ /dev/null @@ -1,132 +0,0 @@ -# GdkPixbuf Image Loader Modules file -# Automatically generated file, do not edit -# Created by gdk-pixbuf-query-loaders from gdk-pixbuf-2.21.5 -# -# LoaderDir = /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders -# -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so" -"ani" 4 "gdk-pixbuf" "The ANI image format" "LGPL" -"application/x-navi-animation" "" -"ani" "" -"RIFF ACON" " xxxx " 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so" -"bmp" 5 "gdk-pixbuf" "The BMP image format" "LGPL" -"image/bmp" "image/x-bmp" "image/x-MS-bmp" "" -"bmp" "" -"BM" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.so" -"gif" 4 "gdk-pixbuf" "The GIF image format" "LGPL" -"image/gif" "" -"gif" "" -"GIF8" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.so" -"icns" 4 "gdk-pixbuf" "The ICNS image format" "GPL" -"image/x-icns" "" -"icns" "" -"icns" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ico.so" -"ico" 5 "gdk-pixbuf" "The ICO image format" "LGPL" -"image/x-icon" "image/x-ico" "image/x-win-bitmap" "" -"ico" "cur" "" -" \001 " "zz znz" 100 -" \002 " "zz znz" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jasper.so" -"jpeg2000" 4 "gdk-pixbuf" "The JPEG 2000 image format" "LGPL" -"image/jp2" "image/jpeg2000" "image/jpx" "" -"jp2" "jpc" "jpx" "j2k" "jpf" "" -" jP" "!!!! " 100 -"\377O\377Q" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so" -"jpeg" 5 "gdk-pixbuf" "The JPEG image format" "LGPL" -"image/jpeg" "" -"jpeg" "jpe" "jpg" "" -"\377\330" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pcx.so" -"pcx" 4 "gdk-pixbuf" "The PCX image format" "LGPL" -"image/x-pcx" "" -"pcx" "" -"\n \001" "" 100 -"\n\002\001" "" 100 -"\n\003\001" "" 100 -"\n\004\001" "" 100 -"\n\005\001" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so" -"png" 5 "gdk-pixbuf" "The PNG image format" "LGPL" -"image/png" "" -"png" "" -"\211PNG\r\n\032\n" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pnm.so" -"pnm" 4 "gdk-pixbuf" "The PNM/PBM/PGM/PPM image format family" "LGPL" -"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" "" -"pnm" "pbm" "pgm" "ppm" "" -"P1" "" 100 -"P2" "" 100 -"P3" "" 100 -"P4" "" 100 -"P5" "" 100 -"P6" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.so" -"qtif" 4 "gdk-pixbuf" "The QTIF image format" "LGPL" -"image/x-quicktime" "image/qtif" "" -"qtif" "qif" "" -"abcdidsc" "xxxx " 100 -"abcdidat" "xxxx " 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ras.so" -"ras" 4 "gdk-pixbuf" "The Sun raster image format" "LGPL" -"image/x-cmu-raster" "image/x-sun-raster" "" -"ras" "" -"Y\246j\225" "" 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.so" -"tga" 4 "gdk-pixbuf" "The Targa image format" "LGPL" -"image/x-tga" "" -"tga" "targa" "" -" \001\001" "x " 100 -" \001\t" "x " 100 -" \002" "xz " 99 -" \003" "xz " 100 -" \n" "xz " 100 -" \013" "xz " 100 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so" -"tiff" 1 "gdk-pixbuf" "The TIFF image format" "LGPL" -"image/tiff" "" -"tiff" "tif" "" -"MM *" " z " 100 -"II* " " z" 100 -"II* \020 CR\002 " " z zzz z" 0 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-wbmp.so" -"wbmp" 4 "gdk-pixbuf" "The WBMP image format" "LGPL" -"image/vnd.wap.wbmp" "" -"wbmp" "" -" " "zz" 1 -" `" "z " 1 -" @" "z " 1 -" " "z " 1 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xbm.so" -"xbm" 4 "gdk-pixbuf" "The XBM image format" "LGPL" -"image/x-xbitmap" "" -"xbm" "" -"#define " "" 100 -"/*" "" 50 - -"/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.so" -"xpm" 4 "gdk-pixbuf" "The XPM image format" "LGPL" -"image/x-xpixmap" "" -"xpm" "" -"/* XPM */" "" 100 - - diff --git a/packages/addons/addon-depends/gdk-pixbuf/package.mk b/packages/addons/addon-depends/gdk-pixbuf/package.mk deleted file mode 100644 index 38aa39915d..0000000000 --- a/packages/addons/addon-depends/gdk-pixbuf/package.mk +++ /dev/null @@ -1,43 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="gdk-pixbuf" -PKG_VERSION="2.34.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.gtk.org/" -PKG_URL="http://ftp.acc.umu.se/pub/gnome/sources/gdk-pixbuf/2.34/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain glib libjpeg-turbo libpng jasper tiff" -PKG_SECTION="x11/toolkits" -PKG_SHORTDESC="gdk-pixbuf: a GNOME library for image loading and manipulation." -PKG_LONGDESC="gdk-pixbuf (GdkPixbuf) is a GNOME library for image loading and manipulation. The GdkPixbuf documentation contains both the programmer's guide and the API reference." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="gio_can_sniff=yes \ - --disable-gtk-doc \ - --disable-gtk-doc-html \ - --disable-gtk-doc-pdf \ - --disable-man \ - --with-libpng \ - --with-libjpeg \ - --with-libtiff \ - --with-libjasper" diff --git a/packages/addons/addon-depends/gdk-pixbuf/patches/gdk-pixbuf-01_meh.patch b/packages/addons/addon-depends/gdk-pixbuf/patches/gdk-pixbuf-01_meh.patch deleted file mode 100644 index d43ca77418..0000000000 --- a/packages/addons/addon-depends/gdk-pixbuf/patches/gdk-pixbuf-01_meh.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am -index 8319b49..8f27c5c 100644 ---- a/gdk-pixbuf/Makefile.am -+++ b/gdk-pixbuf/Makefile.am -@@ -617,51 +617,21 @@ MAINTAINERCLEANFILES = \ - # - # gdk-pixbuf-enum-types.h - # --gdk-pixbuf-enum-types.h: s-enum-types-h -+gdk-pixbuf-enum-types.h: - @true - --s-enum-types-h: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.h.template -- $(AM_V_GEN)( cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.h.template \ -- $(gdk_pixbuf_headers) ) > tmp-gdk-pixbuf-enum-types.h \ -- && (cmp -s tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h || cp tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h ) \ -- && rm -f tmp-gdk-pixbuf-enum-types.h \ -- && echo timestamp > $(@F) -- - CLEANFILES += tmp-gdk-pixbuf-enum-types.h - MAINTAINERCLEANFILES += s-enum-types-h - - # --# gdk-pixbuf-enum-types.c --# --gdk-pixbuf-enum-types.c: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.c.template -- $(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.c.template \ -- $(gdk_pixbuf_headers)) > gdk-pixbuf-enum-types.c -- --# - # gdk-pixbuf-marshal.h - # --gdk-pixbuf-marshal.h: @REBUILD@ stamp-gdk-pixbuf-marshal.h -+gdk-pixbuf-marshal.h: - @true - --stamp-gdk-pixbuf-marshal.h: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list -- $(AM_V_GEN)echo "#if !defined(GDK_PIXBUF_DISABLE_DEPRECATED) || defined(GDK_PIXBUF_COMPILATION)" > xgen-gmh \ -- && $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --header >> xgen-gmh \ -- && echo "#endif /* !GDK_PIXBUF_DISABLE_DEPRECATED || GDK_PIXBUF_COMPILATION */" >> xgen-gmh \ -- && (cmp -s xgen-gmh gdk-pixbuf-marshal.h || cp xgen-gmh gdk-pixbuf-marshal.h) \ -- && rm -f xgen-gmh xgen-gmh~ \ -- && echo timestamp > $(@F) -- - CLEANFILES += xgen-gmh - MAINTAINERCLEANFILES += stamp-gdk-pixbuf-marshal.h - --# --# gdk-pixbuf-marshal.c --# --$(srcdir)/gdk-pixbuf-marshal.c: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list -- $(AM_V_GEN)(echo -e "#include \n" | $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --body ) >> xgen-gmc \ -- && cp xgen-gmc gdk-pixbuf-marshal.c \ -- && rm -f xgen-gmc xgen-gmc~ -- - CLEANFILES += xgen-gmc - - # if srcdir!=builddir, clean out maintainer-clean files from builddir diff --git a/packages/addons/addon-depends/go/package.mk b/packages/addons/addon-depends/go/package.mk index 4a82330440..50809fa78e 100644 --- a/packages/addons/addon-depends/go/package.mk +++ b/packages/addons/addon-depends/go/package.mk @@ -1,59 +1,46 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="go" -PKG_VERSION="1.6.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.11.2" +PKG_SHA256="7854866866c57394217ae5facc41944dff2a7386a064b2bcc4149f7c68e3c79a" PKG_LICENSE="BSD" PKG_SITE="https://golang.org" PKG_URL="https://github.com/golang/go/archive/${PKG_NAME}${PKG_VERSION}.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}-${PKG_NAME}${PKG_VERSION}" PKG_DEPENDS_HOST="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="Go is an open source programming language that makes it easy to build simple, reliable, and efficient software." -PKG_LONGDESC="Go is an open source programming language that makes it easy to build simple, reliable, and efficient software." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="An programming language that makes it easy to build simple, reliable, and efficient software." +PKG_TOOLCHAIN="manual" #################################################################### # On Fedora `dnf install golang` will install go to /usr/lib/golang # -# On Ubuntu you need to install golang manually, similar to: -# $ wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz -# $ tar xf go1.6.linux-amd64.tar.gz -C /opt/ -# $ ln -s /opt/go /usr/lib/golang +# On Ubuntu you need to install golang: +# $ sudo apt install golang-go #################################################################### configure_host() { export GOOS=linux - export GOROOT_FINAL=$ROOT/$TOOLCHAIN/lib/golang - export GOROOT_BOOTSTRAP=/usr/lib/golang + export GOROOT_FINAL=$TOOLCHAIN/lib/golang + if [ -x /usr/lib/go/bin/go ]; then + export GOROOT_BOOTSTRAP=/usr/lib/go + else + export GOROOT_BOOTSTRAP=/usr/lib/golang + fi export GOARCH=amd64 } make_host() { - cd $ROOT/$PKG_BUILD/src + cd $PKG_BUILD/src bash make.bash --no-banner } +pre_makeinstall_host() { + # need to cleanup old golang version when updating to a new version + rm -rf $TOOLCHAIN/lib/golang +} + makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/lib/golang - cp -av $ROOT/$PKG_BUILD/* $ROOT/$TOOLCHAIN/lib/golang/ + mkdir -p $TOOLCHAIN/lib/golang + cp -av $PKG_BUILD/* $TOOLCHAIN/lib/golang/ } diff --git a/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch b/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch index 39ca1a380f..c64b430f03 100644 --- a/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch +++ b/packages/addons/addon-depends/go/patches/go-0001-add-ca-cert-location.patch @@ -1,11 +1,11 @@ -diff -Naur a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go ---- a/src/crypto/x509/root_unix.go 2016-04-19 16:27:35.000000000 -0700 -+++ b/src/crypto/x509/root_unix.go 2016-04-22 01:21:02.884977461 -0700 -@@ -13,6 +13,7 @@ - var certDirectories = []string{ - "/etc/ssl/certs", // SLES10/SLES11, https://golang.org/issue/12139 - "/system/etc/security/cacerts", // Android +diff -Naur go-1.9.2.orig/src/crypto/x509/root_unix.go go-1.9.2/src/crypto/x509/root_unix.go +--- go-1.9.2.orig/src/crypto/x509/root_unix.go 2017-11-03 14:58:53.655965257 +0100 ++++ go-1.9.2/src/crypto/x509/root_unix.go 2017-11-03 14:59:16.923786983 +0100 +@@ -19,6 +19,7 @@ + "/usr/local/share/certs", // FreeBSD + "/etc/pki/tls/certs", // Fedora/RHEL + "/etc/openssl/certs", // NetBSD + "/etc/ssl", // LibreELEC } - func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { + const ( diff --git a/packages/addons/addon-depends/gtk+/package.mk b/packages/addons/addon-depends/gtk+/package.mk deleted file mode 100644 index 31d7589a08..0000000000 --- a/packages/addons/addon-depends/gtk+/package.mk +++ /dev/null @@ -1,56 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="gtk+" -PKG_VERSION="2.24.30" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.gtk.org/" -PKG_URL="http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain atk libX11 libXrandr libXi glib pango cairo gdk-pixbuf" -PKG_SECTION="x11/toolkits" -PKG_SHORTDESC="gtk+: The Gimp ToolKit (GTK)" -PKG_LONGDESC="This is GTK+. GTK+, which stands for the Gimp ToolKit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="ac_cv_path_GLIB_GENMARSHAL=$ROOT/$TOOLCHAIN/bin/glib-genmarshal \ - --disable-glibtest \ - --enable-modules \ - --enable-explicit-deps=no \ - --disable-debug \ - --enable-shm \ - --disable-cups \ - --disable-papi \ - --enable-xkb \ - --disable-xinerama \ - --disable-gtk-doc-html \ - --with-xinput" - -make_target() { - make SRC_SUBDIRS="gdk gtk modules" - $MAKEINSTALL SRC_SUBDIRS="gdk gtk modules" -} - -makeinstall_target() { - make install DESTDIR=$INSTALL SRC_SUBDIRS="gdk gtk modules" -} diff --git a/packages/addons/addon-depends/gtk+/patches/gtk+-01_no-gtk-doc.patch b/packages/addons/addon-depends/gtk+/patches/gtk+-01_no-gtk-doc.patch deleted file mode 100644 index b264b45dbc..0000000000 --- a/packages/addons/addon-depends/gtk+/patches/gtk+-01_no-gtk-doc.patch +++ /dev/null @@ -1,64 +0,0 @@ -From fca2ac06da064b133101f215efd5fbd738fb3ef9 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Thu, 27 Mar 2014 14:26:27 +0200 -Subject: [PATCH] no gtk-doc - ---- - Makefile.am | 3 +-- - configure.ac | 12 ------------ - 2 files changed, 1 insertions(+), 14 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 8e3a2f1..35e94d2 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -2,7 +2,7 @@ - include $(top_srcdir)/Makefile.decl - - SRC_SUBDIRS = gdk gtk modules demos tests perf --SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build -+SUBDIRS = po po-properties $(SRC_SUBDIRS) m4macros build - - # require automake 1.4 - AUTOMAKE_OPTIONS = 1.7 -@@ -136,7 +136,6 @@ MAINTAINERCLEANFILES = \ - $(srcdir)/mkinstalldirs \ - $(srcdir)/omf.make \ - $(srcdir)/xmldocs.make \ -- $(srcdir)/gtk-doc.make \ - $(srcdir)/ChangeLog \ - `find "$(srcdir)" -type f -name Makefile.in -print` - -diff --git a/configure.ac b/configure.ac -index 245a87f..f6ede8a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1594,8 +1594,6 @@ GOBJECT_INTROSPECTION_CHECK([0.9.3]) - # Checks for gtk-doc and docbook-tools - ################################################## - --GTK_DOC_CHECK([1.11]) -- - AC_CHECK_PROG(DB2HTML, db2html, true, false) - AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) - -@@ -1727,16 +1725,6 @@ demos/Makefile - demos/gtk-demo/Makefile - demos/gtk-demo/geninclude.pl - tests/Makefile --docs/Makefile --docs/reference/Makefile --docs/reference/gdk/Makefile --docs/reference/gdk/version.xml --docs/reference/gtk/Makefile --docs/reference/gtk/version.xml --docs/reference/libgail-util/Makefile --docs/faq/Makefile --docs/tools/Makefile --docs/tutorial/Makefile - build/Makefile - build/win32/Makefile - build/win32/vs9/Makefile --- -1.7.2.5 - diff --git a/packages/addons/addon-depends/gtk+/patches/gtk+-02_meh-glib.patch b/packages/addons/addon-depends/gtk+/patches/gtk+-02_meh-glib.patch deleted file mode 100644 index 7ea8a7f0c4..0000000000 --- a/packages/addons/addon-depends/gtk+/patches/gtk+-02_meh-glib.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 3cb23c7b05be36e130bd1930dad3382ce8c08c51 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sun, 26 Oct 2014 00:26:09 +0300 -Subject: [PATCH] meh glib - ---- - gdk/Makefile.am | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gdk/Makefile.am b/gdk/Makefile.am -index c880f6e..7661530 100644 ---- a/gdk/Makefile.am -+++ b/gdk/Makefile.am -@@ -307,7 +307,7 @@ lib_LTLIBRARIES = $(gdktargetlib) - - EXTRA_LTLIBRARIES = libgdk-x11-2.0.la libgdk-win32-2.0.la libgdk-quartz-2.0.la libgdk-directfb-2.0.la - --MAINTAINERCLEANFILES = $(gdk_built_sources) stamp-gdkenumtypes.h -+MAINTAINERCLEANFILES = $(gdk_built_sources) - EXTRA_DIST += $(gdk_built_sources) - EXTRA_HEADERS = - -@@ -333,7 +333,7 @@ BUILT_SOURCES = \ - $(gdk_built_sources) \ - gdkconfig.h - --gdkenumtypes.h: stamp-gdkenumtypes.h -+gdkenumtypes.h: - @true - stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.h.template - ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.h.template \ --- -1.7.2.5 - diff --git a/packages/addons/addon-depends/harfbuzz/package.mk b/packages/addons/addon-depends/harfbuzz/package.mk deleted file mode 100644 index 1e0d007819..0000000000 --- a/packages/addons/addon-depends/harfbuzz/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="harfbuzz" -PKG_VERSION="1.3.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.freedesktop.org/wiki/Software/HarfBuzz" -PKG_URL="http://www.freedesktop.org/software/harfbuzz/release/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain glib freetype cairo icu" -PKG_SECTION="x11/toolkits" -PKG_SHORTDESC="harfbuzz: an OpenType text shaping engine." -PKG_LONGDESC="HarfBuzz is an OpenType text shaping engine." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAINTAINER="none" - -PKG_CONFIGURE_OPTS_TARGET="--with-icu=yes" - -pre_configure_target() { - export LIBS="-ldl" -} diff --git a/packages/addons/addon-depends/icu/package.mk b/packages/addons/addon-depends/icu/package.mk deleted file mode 100644 index d56d7292f6..0000000000 --- a/packages/addons/addon-depends/icu/package.mk +++ /dev/null @@ -1,45 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="icu" -PKG_VERSION="57.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="Custom" -PKG_SITE="http://www.icu-project.org" -PKG_URL="http://download.icu-project.org/files/${PKG_NAME}4c/${PKG_VERSION}/${PKG_NAME}4c-${PKG_VERSION//./_}-src.tgz" -PKG_SOURCE_DIR="icu" -PKG_DEPENDS_TARGET="toolchain icu:host" -PKG_SECTION="textproc" -PKG_SHORTDESC="International Components for Unicode library" -PKG_LONGDESC="International Components for Unicode library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static \ - --disable-shared \ - --with-cross-build=$ROOT/$PKG_BUILD/.$HOST_NAME" - -PKG_CONFIGURE_SCRIPT="source/configure" - -post_makeinstall_target() { - rm -rf $INSTALL -} diff --git a/packages/addons/addon-depends/inadyn/libconfuse/package.mk b/packages/addons/addon-depends/inadyn/libconfuse/package.mk index cdc78ae883..226d6da2d9 100644 --- a/packages/addons/addon-depends/inadyn/libconfuse/package.mk +++ b/packages/addons/addon-depends/inadyn/libconfuse/package.mk @@ -1,28 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libconfuse" -PKG_VERSION="3.0" +PKG_VERSION="3.2.2" +PKG_SHA256="2cf7e032980aff8f488efba61510dc3fb95e9a4b9183f985dea457a5651b0e2c" PKG_LICENSE="https://github.com/martinh/libconfuse/blob/master/LICENSE" PKG_SITE="https://github.com/martinh/libconfuse" PKG_URL="https://github.com/martinh/libconfuse/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_LONGDESC="Small configuration file parser library for C" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/inadyn/libite/package.mk b/packages/addons/addon-depends/inadyn/libite/package.mk deleted file mode 100644 index d9da5bee18..0000000000 --- a/packages/addons/addon-depends/inadyn/libite/package.mk +++ /dev/null @@ -1,28 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016-2017 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="libite" -PKG_VERSION="1.8.3" -PKG_LICENSE="MIT" -PKG_SITE="https://github.com/troglobit/libite" -PKG_URL="https://github.com/troglobit/libite/archive/v$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_LONGDESC="That missing frog DNA you've been looking for" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/jasper/package.mk b/packages/addons/addon-depends/jasper/package.mk index 6114f6b3b0..7d35fb3e7e 100644 --- a/packages/addons/addon-depends/jasper/package.mk +++ b/packages/addons/addon-depends/jasper/package.mk @@ -1,42 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="jasper" PKG_VERSION="1.900.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="6e9a959bf4f8cb02f77f42d1b9880b8e85d021ac51f43d8787b5438fd2b7a1c5" PKG_LICENSE="OpenSource" PKG_SITE="http://www.ece.uvic.ca/~mdadams/jasper/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libjpeg-turbo" -PKG_SECTION="graphics" -PKG_SHORTDESC="jasper: JPEG-2000 Part-1 standard (i.e., ISO/IEC 15444-1) implementation" -PKG_LONGDESC="This distribution contains the public release of the an open-source implementation of the ISO/IEC 15444-1 also known as JPEG-2000 standard for image compression." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A implementation of the ISO/IEC 15444-1 also known as JPEG-2000 standard for image compression." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin } diff --git a/packages/addons/addon-depends/lcdd-depends/libugpio/package.mk b/packages/addons/addon-depends/lcdd-depends/libugpio/package.mk index a1292e6ce9..125e178604 100644 --- a/packages/addons/addon-depends/lcdd-depends/libugpio/package.mk +++ b/packages/addons/addon-depends/lcdd-depends/libugpio/package.mk @@ -1,29 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2017 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libugpio" PKG_VERSION="0.0.6" -PKG_ARCH="any" +PKG_SHA256="5093c34cdb891560b0807cb371521cf94fa5c090ee7a84779663b16c831b9e9e" PKG_LICENSE="LGPLv2.1" PKG_SITE="https://github.com/mhei/libugpio" PKG_URL="https://github.com/mhei/$PKG_NAME/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain linux" -PKG_LONGDESC="A free software library to ease the use of linux kernel's sysfs gpio interface from C programs and/or other libraries" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A software library to ease the use of linux kernel's sysfs gpio interface from C programs and/or other libraries." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/lcdd-depends/serdisplib/package.mk b/packages/addons/addon-depends/lcdd-depends/serdisplib/package.mk index 1233858125..fec99e9f33 100644 --- a/packages/addons/addon-depends/lcdd-depends/serdisplib/package.mk +++ b/packages/addons/addon-depends/lcdd-depends/serdisplib/package.mk @@ -1,34 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2017 Team LibreELEC -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="serdisplib" PKG_VERSION="1.97.9" -PKG_ARCH="any" +PKG_SHA256="fe82ebe72731e91509083569dfe41a09e21632cc1211cdc4f76274f83ed218fa" PKG_LICENSE="GPL" PKG_SITE="http://serdisplib.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libusb-compat" -PKG_SHORTDESC="serdisplib: a lcd control library" -PKG_LONGDESC="Library to drive serial/parallel/usb displays with built-in controllers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Library to drive serial/parallel/usb displays with built-in controllers." PKG_CONFIGURE_OPTS_TARGET="--prefix=$SYSROOT_PREFIX/usr \ --bindir=$SYSROOT_PREFIX/usr/bin \ @@ -38,7 +19,7 @@ PKG_CONFIGURE_OPTS_TARGET="--prefix=$SYSROOT_PREFIX/usr \ pre_configure_target() { # serdisplib fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rmdir .$TARGET_NAME # use libusb-config from sysroot diff --git a/packages/addons/addon-depends/libXScrnSaver/package.mk b/packages/addons/addon-depends/libXScrnSaver/package.mk deleted file mode 100644 index 3bf715ae45..0000000000 --- a/packages/addons/addon-depends/libXScrnSaver/package.mk +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="libXScrnSaver" -PKG_VERSION="1.2.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://xorg.freedesktop.org/" -PKG_URL="http://xorg.freedesktop.org/releases/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain scrnsaverproto" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="" -PKG_LONGDESC="" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --enable-malloc0returnsnull" diff --git a/packages/addons/addon-depends/libXcursor/package.mk b/packages/addons/addon-depends/libXcursor/package.mk deleted file mode 100644 index 7f49219a8f..0000000000 --- a/packages/addons/addon-depends/libXcursor/package.mk +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="libXcursor" -PKG_VERSION="1.1.14" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libX11 libXfixes libXrender" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libXcursor: X Cursor Library" -PKG_LONGDESC="X11 Cursor management library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/addons/addon-depends/libXft/package.mk b/packages/addons/addon-depends/libXft/package.mk deleted file mode 100644 index 1dd47d5fff..0000000000 --- a/packages/addons/addon-depends/libXft/package.mk +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="libXft" -PKG_VERSION="2.3.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xproto libXrender fontconfig freetype" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxft: X FreeType library" -PKG_LONGDESC="X FreeType library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/libconfig/package.mk b/packages/addons/addon-depends/libconfig/package.mk index 380f1636cf..c70b918c99 100644 --- a/packages/addons/addon-depends/libconfig/package.mk +++ b/packages/addons/addon-depends/libconfig/package.mk @@ -1,35 +1,15 @@ -################################################################################# -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +## SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libconfig" PKG_VERSION="1.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="cae5c02361d8a9b2bb26946c64f089d2e5e599972f386203fbc48975c0d885c8" PKG_LICENSE="LGPL" PKG_SITE="http://hyperrealm.com/libconfig/libconfig.html" PKG_URL="https://github.com/hyperrealm/libconfig/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="lib" -PKG_SHORTDESC="C/C++ Configuration File Library" -PKG_LONGDESC="C/C++ Configuration File Library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A C/C++ configuration file library." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ diff --git a/packages/addons/addon-depends/libdvbcsa/package.mk b/packages/addons/addon-depends/libdvbcsa/package.mk index ea6919f075..6759face87 100644 --- a/packages/addons/addon-depends/libdvbcsa/package.mk +++ b/packages/addons/addon-depends/libdvbcsa/package.mk @@ -1,59 +1,29 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libdvbcsa" -PKG_VERSION="4ce8be8" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="aae3d0c" +PKG_SHA256="2c0b69a5ca70c5032f9375a57bcec449ecdf93b5459f60f087f5fa06c605c7c1" PKG_LICENSE="LGPL" PKG_SITE="http://www.videolan.org/developers/libdvbcsa.html" PKG_SITE="https://github.com/glenvt18/libdvbcsa/" PKG_URL="https://github.com/glenvt18/libdvbcsa/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="lib" -PKG_SHORTDESC="libdvbcsa is a free implementation of the DVB Common Scrambling Algorithm - DVB/CSA - with encryption and decryption capabilities" -PKG_LONGDESC="libdvbcsa is a free implementation of the DVB Common Scrambling Algorithm - DVB/CSA - with encryption and decryption capabilities" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A implementation of DVB/CSA, with encryption and decryption capabilities." +PKG_TOOLCHAIN="autotools" +# libdvbcsa is a bit faster without LTO, and tests will fail with gcc-5.x +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static --with-sysroot=$SYSROOT_PREFIX" -if echo "$TARGET_FPU" | grep -q '^neon'; then +if target_has_feature neon; then PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-neon" -elif [ "$TARGET_ARCH" = aarch64 ]; then - # change this to --enable-neon when AArch64 NEON performance is improved - # check performance with test/benchbitslice - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-uint64" elif [ "$TARGET_ARCH" = x86_64 ]; then - if echo "$PROJECT_CFLAGS" | grep -q '\-mssse3'; then + if target_has_feature ssse3; then PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-ssse3" - elif echo "$PROJECT_CFLAGS" | grep -q '\-msse2'; then + elif target_has_feature sse2; then PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-sse2" else PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-uint64" fi fi - -pre_configure_target() { -# libdvbcsa is a bit faster without LTO, and tests will fail with gcc-5.x - strip_lto - - export CFLAGS="$CFLAGS -fPIC" -} - diff --git a/packages/addons/addon-depends/libexif/package.mk b/packages/addons/addon-depends/libexif/package.mk index 494ec5734d..2f8fb91fee 100644 --- a/packages/addons/addon-depends/libexif/package.mk +++ b/packages/addons/addon-depends/libexif/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) PKG_NAME="libexif" PKG_VERSION="0.6.21" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="16cdaeb62eb3e6dfab2435f7d7bccd2f37438d21c5218ec4e58efa9157d4d41a" PKG_LICENSE="LGPL" PKG_SITE="http://sourceforge.net/projects/libexif" PKG_URL="http://downloads.sf.net/sourceforge/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="lib" -PKG_SHORTDESC="A library to parse an EXIF file and read the data from those tags" -PKG_LONGDESC="A library to parse an EXIF file and read the data from those tags" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A library to parse an EXIF file and read the data from those tags." diff --git a/packages/addons/addon-depends/libiconv/package.mk b/packages/addons/addon-depends/libiconv/package.mk index 87b4202f59..ace0c282ca 100644 --- a/packages/addons/addon-depends/libiconv/package.mk +++ b/packages/addons/addon-depends/libiconv/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libiconv" -PKG_VERSION="1.14" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.15" +PKG_SHA256="ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178" PKG_LICENSE="GPL" PKG_SITE="https://savannah.gnu.org/projects/libiconv/" PKG_URL="http://ftp.gnu.org/pub/gnu/libiconv/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="Libiconv converts from one character encoding to another through Unicode conversion." -PKG_LONGDESC="Libiconv converts from one character encoding to another through Unicode conversion." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A tool that converts from one character encoding to another through Unicode conversion." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--host=$TARGET_NAME \ --build=$HOST_NAME \ diff --git a/packages/addons/addon-depends/libiconv/patches/libiconv-glibc-fix-2.16.patch b/packages/addons/addon-depends/libiconv/patches/libiconv-glibc-fix-2.16.patch deleted file mode 100644 index e89c25ef96..0000000000 --- a/packages/addons/addon-depends/libiconv/patches/libiconv-glibc-fix-2.16.patch +++ /dev/null @@ -1,16 +0,0 @@ -from -http://www.itkb.ro/kb/linux/patch-libiconv-pentru-glibc-216 - ---- a/srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300 -+++ b/srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200 -@@ -695,7 +695,9 @@ - /* It is very rare that the developer ever has full control of stdin, - so any use of gets warrants an unconditional warning. Assume it is - always declared, since it is required by C89. */ --_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16) -+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -+#endif - #endif - - diff --git a/packages/addons/addon-depends/libid3tag/package.mk b/packages/addons/addon-depends/libid3tag/package.mk index 7f9aa813fb..f52ef80b54 100644 --- a/packages/addons/addon-depends/libid3tag/package.mk +++ b/packages/addons/addon-depends/libid3tag/package.mk @@ -1,38 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libid3tag" PKG_VERSION="0.15.1b" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151" PKG_LICENSE="GPL" -PKG_SITE="http://www.mars.org/home/rob/proj/mpeg/" -PKG_URL="$SOURCEFORGE_SRC/mad/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://www.underbit.com/products/mad/" +PKG_URL="ftp://ftp.mars.org/pub/mpeg/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain zlib" -PKG_SECTION="audio" -PKG_SHORTDESC="library for id3 tagging" -PKG_LONGDESC="library for id3 tagging" -PKG_IS_ADDON="no" +PKG_LONGDESC="A library for id3 tagging." -PKG_AUTORECONF="no" +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared" -PKG_MAINTAINER="Lukas Sabota (LTsmooth42@gmail.com)" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +post_makeinstall_target(){ + cp $PKG_BUILD/id3tag.pc $SYSROOT_PREFIX/usr/lib/pkgconfig +} diff --git a/packages/addons/addon-depends/libid3tag/sources/id3tag.pc b/packages/addons/addon-depends/libid3tag/sources/id3tag.pc new file mode 100644 index 0000000000..cb5ba7518d --- /dev/null +++ b/packages/addons/addon-depends/libid3tag/sources/id3tag.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=/usr/bin +libdir=/usr/lib +includedir=/usr/include + +Name: ID3TAG +Description: libid3tag - ID3 tag manipulation library +Version: 0.15.1b +Libs: -L${libdir} -lid3tag -lz +Cflags: diff --git a/packages/addons/addon-depends/libimobiledevice/package.mk b/packages/addons/addon-depends/libimobiledevice/package.mk index 0499d165d5..08e409426e 100644 --- a/packages/addons/addon-depends/libimobiledevice/package.mk +++ b/packages/addons/addon-depends/libimobiledevice/package.mk @@ -1,32 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libimobiledevice" PKG_VERSION="1.2.0" -PKG_ARCH="any" +PKG_SHA256="786b0de0875053bf61b5531a86ae8119e320edab724fc62fe2150cc931f11037" PKG_LICENSE="GPL" PKG_SITE="http://www.libimobiledevice.org" PKG_URL="http://www.libimobiledevice.org/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libusbmuxd libressl" -PKG_SECTION="libs" -PKG_SHORTDESC="libimobiledevice is a cross-platform software library that talks the protocols to support iPhone®, iPod Touch®, iPad® and Apple TV® devices" -PKG_LONGDESC="libimobiledevice is a cross-platform software library that talks the protocols to support iPhone®, iPod Touch®, iPad® and Apple TV® devices" -PKG_AUTORECONF="yes" +PKG_DEPENDS_TARGET="toolchain libusbmuxd openssl" +PKG_LONGDESC="A cross-platform software library that talks the protocols to support Apple devices." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ @@ -34,5 +17,5 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-largefile" post_makeinstall_target() { - cp $ROOT/$PKG_BUILD/common/utils.h $SYSROOT_PREFIX/usr/include/libimobiledevice/ + cp $PKG_BUILD/common/utils.h $SYSROOT_PREFIX/usr/include/libimobiledevice/ } diff --git a/packages/addons/addon-depends/libmad/package.mk b/packages/addons/addon-depends/libmad/package.mk index 9017a869c7..1ef3ae3613 100644 --- a/packages/addons/addon-depends/libmad/package.mk +++ b/packages/addons/addon-depends/libmad/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) PKG_NAME="libmad" PKG_VERSION="0.15.1b" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690" PKG_LICENSE="GPL" PKG_SITE="http://www.mars.org/home/rob/proj/mpeg/" PKG_URL="$SOURCEFORGE_SRC/mad/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="libmad: MPEG Audio Decoder" -PKG_LONGDESC="MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II, and Layer III a.k.a. MP3) are fully implemented." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A high-quality MPEG audio decoder." +PKG_TOOLCHAIN="autotools" # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/addons/addon-depends/libmpdclient/package.mk b/packages/addons/addon-depends/libmpdclient/package.mk new file mode 100644 index 0000000000..1743c2d75d --- /dev/null +++ b/packages/addons/addon-depends/libmpdclient/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libmpdclient" +PKG_VERSION="2.14" +PKG_SHA256="0a84e2791bfe3077cf22ee1784c805d5bb550803dffe56a39aa3690a38061372" +PKG_LICENSE="BSD-3c" +PKG_SITE="https://www.musicpd.org" +PKG_URL="https://www.musicpd.org/download/libmpdclient/2/libmpdclient-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A C library which implements the Music Player Daemon protocol." diff --git a/packages/addons/addon-depends/libnetwork/package.mk b/packages/addons/addon-depends/libnetwork/package.mk new file mode 100644 index 0000000000..dc0c1ba8dc --- /dev/null +++ b/packages/addons/addon-depends/libnetwork/package.mk @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libnetwork" +PKG_VERSION="2cfbf9b1f98162a55829a21cc603c76072a75382" +PKG_SHA256="12986c29a112f989886ceec675f5b11ccd001dcdb1c17a49835970c56aa406d0" +PKG_LICENSE="APL" +PKG_SITE="https://github.com/docker/libnetwork" +PKG_URL="https://github.com/docker/libnetwork/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain go:host" +PKG_LONGDESC="A native Go implementation for connecting containers." +PKG_TOOLCHAIN="manual" + +pre_make_target() { + case $TARGET_ARCH in + x86_64) + export GOARCH=amd64 + ;; + arm) + export GOARCH=arm + + case $TARGET_CPU in + arm1176jzf-s) + export GOARM=6 + ;; + *) + export GOARM=7 + ;; + esac + ;; + aarch64) + export GOARCH=arm64 + ;; + esac + + export GOOS=linux + export CGO_ENABLED=0 + export CGO_NO_EMULATION=1 + export CGO_CFLAGS=$CFLAGS + export LDFLAGS="-extld $CC" + export GOLANG=$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$PKG_BUILD/.gopath + export GOROOT=$TOOLCHAIN/lib/golang + export PATH=$PATH:$GOROOT/bin + + mkdir -p $PKG_BUILD/.gopath + if [ -d $PKG_BUILD/vendor ]; then + mv $PKG_BUILD/vendor $PKG_BUILD/.gopath/src + fi + + ln -fs $PKG_BUILD $PKG_BUILD/.gopath/src/github.com/docker/libnetwork +} + +make_target() { + mkdir -p bin + $GOLANG build -v -o bin/docker-proxy -a -ldflags "$LDFLAGS" ./cmd/proxy +} diff --git a/packages/addons/addon-depends/librespot-depends/pyalsaaudio/package.mk b/packages/addons/addon-depends/librespot-depends/pyalsaaudio/package.mk new file mode 100644 index 0000000000..fb188b729f --- /dev/null +++ b/packages/addons/addon-depends/librespot-depends/pyalsaaudio/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pyalsaaudio" +PKG_VERSION="0.8.4" +PKG_SHA256="84e8f8da544d7f4bd96479ce4a237600077984d9be1d7f16c1d9a492ecf50085" +PKG_LICENSE="PSF" +PKG_SITE="http://larsimmisch.github.io/pyalsaaudio/" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host alsa-lib" +PKG_LONGDESC="ALSA bindings" +PKG_TOOLCHAIN="manual" + +make_target() { + export LDSHARED="$CC -shared" + export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" + python setup.py build --cross-compile +} + +makeinstall_target() { + python setup.py install --root=$INSTALL --prefix=/usr + find $INSTALL/usr/lib -name "*.py" -exec rm -rf "{}" ";" + rm -rf $INSTALL/usr/lib/python*/site-packages/*.egg-info \ + $INSTALL/usr/lib/python*/site-packages/*/tests +} diff --git a/packages/addons/addon-depends/librespot-depends/rust/package.mk b/packages/addons/addon-depends/librespot-depends/rust/package.mk new file mode 100644 index 0000000000..e88cf25015 --- /dev/null +++ b/packages/addons/addon-depends/librespot-depends/rust/package.mk @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rust" +PKG_VERSION="1.31.1" +PKG_LICENSE="MIT" +PKG_SITE="https://www.rust-lang.org" +PKG_DEPENDS_TARGET="toolchain rustup.rs" +PKG_LONGDESC="A systems programming language that prevents segfaults, and guarantees thread safety." +PKG_TOOLCHAIN="manual" + +make_target() { + export CARGO_HOME="$TOOLCHAIN/.cargo" + export RUSTUP_HOME="$CARGO_HOME" + export PATH="$CARGO_HOME/bin:$PATH" + rm -rf "$CARGO_HOME" + $(get_build_dir rustup.rs)/rustup-init.sh --no-modify-path -y + rustup default "$PKG_VERSION" + case "$TARGET_ARCH" in + aarch64) + RUST_TRIPLE="aarch64-unknown-linux-gnu" + ;; + arm) + RUST_TRIPLE="arm-unknown-linux-gnueabihf" + ;; + x86_64) + RUST_TRIPLE="x86_64-unknown-linux-gnu" + ;; + esac + if [ "$TARGET_ARCH" != "x86_64" ]; then + rustup target add "$RUST_TRIPLE" + fi + + cat <"$CARGO_HOME/config" +[target.$RUST_TRIPLE] +linker = "$CC" +EOF + + cat <<'EOF' >"$CARGO_HOME/env" +export CARGO_HOME="$TOOLCHAIN/.cargo" +export CARGO_TARGET_DIR="$PKG_BUILD/.$TARGET_NAME" +export PATH="$CARGO_HOME/bin:$PATH" +export RUSTUP_HOME="$CARGO_HOME" +mkdir -p "$CARGO_TARGET_DIR" +EOF + + echo "CARGO_BUILD=\"cargo build --release --target $RUST_TRIPLE\"" \ + >>"$CARGO_HOME/env" +} diff --git a/packages/addons/addon-depends/librespot-depends/rustup.rs/package.mk b/packages/addons/addon-depends/librespot-depends/rustup.rs/package.mk new file mode 100644 index 0000000000..45b99c8014 --- /dev/null +++ b/packages/addons/addon-depends/librespot-depends/rustup.rs/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rustup.rs" +PKG_VERSION="1.16.0" +PKG_SHA256="8c4ffeda2088dbdd5ea2eac8acef5ddd57dfcfe1f06a503e3da790f93161e1a6" +PKG_LICENSE="MIT" +PKG_SITE="https://www.rust-lang.org" +PKG_URL="https://github.com/rust-lang-nursery/rustup.rs/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The Rust toolchain installer." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/libusbmuxd/package.mk b/packages/addons/addon-depends/libusbmuxd/package.mk index 375ef92349..1ea7f656a7 100644 --- a/packages/addons/addon-depends/libusbmuxd/package.mk +++ b/packages/addons/addon-depends/libusbmuxd/package.mk @@ -1,32 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libusbmuxd" PKG_VERSION="1.0.10" -PKG_ARCH="any" +PKG_SHA256="1aa21391265d2284ac3ccb7cf278126d10d354878589905b35e8102104fec9f2" PKG_LICENSE="GPL" PKG_SITE="http://www.libimobiledevice.org" PKG_URL="http://www.libimobiledevice.org/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libplist" -PKG_SECTION="libs" -PKG_SHORTDESC="USB Multiplex Daemon" -PKG_LONGDESC="USB Multiplex Daemon" -PKG_AUTORECONF="no" +PKG_LONGDESC="A USB multiplex daemon." PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes \ diff --git a/packages/addons/addon-depends/libva-vdpau-driver/package.mk b/packages/addons/addon-depends/libva-vdpau-driver/package.mk deleted file mode 100644 index b3e42111a3..0000000000 --- a/packages/addons/addon-depends/libva-vdpau-driver/package.mk +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="libva-vdpau-driver" -PKG_VERSION="0.7.4" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://freedesktop.org/wiki/Software/vaapi" -PKG_URL="http://freedesktop.org/software/vaapi/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libva libvdpau mesa" -PKG_SECTION="graphics" -PKG_SHORTDESC="VDPAU backend for VA API" -PKG_LONGDESC="VDPAU backend for VA API" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -post_makeinstall_target() { - rm -rf $INSTALL/usr/lib/va/s3g_drv_video.so -} diff --git a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0001_drop-formats.patch b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0001_drop-formats.patch deleted file mode 100644 index 74caee3483..0000000000 --- a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0001_drop-formats.patch +++ /dev/null @@ -1,29 +0,0 @@ ->From fda3706eb74ba5ad874853969f3df3e372739c8d Mon Sep 17 00:00:00 2001 -From: "Xiang, Haihao" -Date: Fri, 21 Jun 2013 12:55:30 +0800 -Subject: [PATCH] VAEncH264VUIBufferType and VAEncH264SEIBufferType are - dropped from VA API - -The driver doesn't use them indeed - -Signed-off-by: Xiang, Haihao ---- - src/vdpau_dump.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/src/vdpau_dump.c b/src/vdpau_dump.c -index 899888b..610e7cd 100644 ---- a/src/vdpau_dump.c -+++ b/src/vdpau_dump.c -@@ -59,8 +59,6 @@ const char *string_of_VABufferType(VABufferType type) - _(VAEncSequenceParameterBufferType); - _(VAEncPictureParameterBufferType); - _(VAEncSliceParameterBufferType); -- _(VAEncH264VUIBufferType); -- _(VAEncH264SEIBufferType); - #endif - #if VA_CHECK_VERSION(0,31,1) - _(VAQMatrixBufferType); --- -1.7.9.5 - diff --git a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0002_glext-missing-definition.patch b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0002_glext-missing-definition.patch deleted file mode 100644 index b56d268343..0000000000 --- a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0002_glext-missing-definition.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/src/utils_glx.h~ 2012-10-05 16:02:58.000000000 +0100 -+++ b/src/utils_glx.h 2012-10-19 08:44:12.469642440 +0100 -@@ -48,6 +48,13 @@ - typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int); - #endif - -+#if GL_GLEXT_VERSION >= 85 -+/* XXX: PFNGLMULTITEXCOORD2FPROC got out of the GL_VERSION_1_3_DEPRECATED -+ block and is not defined if GL_VERSION_1_3 is defined in -+ Redefine the type here as an interim solution */ -+typedef void (*PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -+#endif -+ - #ifndef GL_FRAMEBUFFER_BINDING - #define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT - #endif diff --git a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0003_libvdpau-0.8.patch b/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0003_libvdpau-0.8.patch deleted file mode 100644 index ab3a479986..0000000000 --- a/packages/addons/addon-depends/libva-vdpau-driver/patches/libva-vdpau-driver-0003_libvdpau-0.8.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/vdpau_decode.c -+++ b/src/vdpau_decode.c -@@ -1289,7 +1289,7 @@ - driver_data, - obj_context->vdp_decoder, - obj_surface->vdp_surface, -- (VdpPictureInfo)&obj_context->vdp_picture_info, -+ (VdpPictureInfo *)&obj_context->vdp_picture_info, - obj_context->vdp_bitstream_buffers_count, - obj_context->vdp_bitstream_buffers - ); diff --git a/packages/addons/addon-depends/libvncserver/package.mk b/packages/addons/addon-depends/libvncserver/package.mk index 9a54fb80f1..d8cbe153c2 100644 --- a/packages/addons/addon-depends/libvncserver/package.mk +++ b/packages/addons/addon-depends/libvncserver/package.mk @@ -1,37 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libvncserver" -PKG_VERSION="0.9.10" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="0.9.11" +PKG_SHA256="193d630372722a532136fd25c5326b2ca1a636cbb8bf9bb115ef869c804d2894" PKG_LICENSE="GPL" PKG_SITE="https://libvnc.github.io/" PKG_URL="https://github.com/LibVNC/libvncserver/archive/LibVNCServer-$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="libvncserver-LibVNCServer-$PKG_VERSION" -PKG_DEPENDS_TARGET="toolchain libjpeg-turbo libpng" -PKG_SECTION="libs" -PKG_SHORTDESC="LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program." -PKG_LONGDESC="LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program." - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="yes" +PKG_DEPENDS_TARGET="toolchain libjpeg-turbo libpng openssl systemd" +PKG_LONGDESC="A C library that allow you to easily implement VNC server or client functionality." +PKG_TOOLCHAIN="autotools" PKG_MAINTAINER="Lukas Rusak (lrusak at irc.freenode.net)" diff --git a/packages/addons/addon-depends/libzip/package.mk b/packages/addons/addon-depends/libzip/package.mk index b4c9399277..026805e4a1 100644 --- a/packages/addons/addon-depends/libzip/package.mk +++ b/packages/addons/addon-depends/libzip/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libzip" PKG_VERSION="0.11.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="7cfbbc2c540e154b933b6e9ec781e2671086bd8114eb744ae1a1ade34d2bb6bb" PKG_LICENSE="GPL" PKG_SITE="http://www.nih.at/libzip/" PKG_URL="http://www.nih.at/libzip/${PKG_NAME}-${PKG_VERSION}.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SHORTDESC="libzip" -PKG_LONGDESC="libzip" - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A C library for reading, creating, and modifying zip archives." +PKG_TOOLCHAIN="configure" PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/addons/addon-depends/mono-depends/libgdiplus/package.mk b/packages/addons/addon-depends/mono-depends/libgdiplus/package.mk deleted file mode 100644 index 108c3c4923..0000000000 --- a/packages/addons/addon-depends/mono-depends/libgdiplus/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="libgdiplus" -PKG_VERSION="4.2" -PKG_REV="0" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/mono/libgdiplus" -PKG_URL="https://github.com/mono/libgdiplus/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain giflib libjpeg-turbo tiff libXext libexif glib cairo" -PKG_SECTION="tools" -PKG_SHORTDESC="libgiplus" -PKG_LONGDESC="An Open Source implementation of the GDI+ API" - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="yes" -PKG_CONFIGURE_OPTS_TARGET="--enable-shared \ - --with-libgif \ - --with-libjpeg \ - --with-libtiff" - -makeinstall_target() { - make install DESTDIR=$INSTALL -} diff --git a/packages/addons/addon-depends/mono-depends/mono_sqlite/package.mk b/packages/addons/addon-depends/mono-depends/mono_sqlite/package.mk deleted file mode 100644 index fc0e5156a3..0000000000 --- a/packages/addons/addon-depends/mono-depends/mono_sqlite/package.mk +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. "$ROOT/packages/databases/sqlite/package.mk" - -PKG_NAME="mono_sqlite" -PKG_URL="" -PKG_DEPENDS_TARGET="toolchain sqlite" -PKG_SHORTDESC="sqlite for mono" -PKG_LONGDESC="libsqlite built shared for mono" - -PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-static --enable-shared" - -unpack() { - mkdir -p $PKG_BUILD - cp -r $(get_build_dir sqlite)/* $PKG_BUILD/ -} - -makeinstall_target() { - make install DESTDIR=$INSTALL -} diff --git a/packages/addons/addon-depends/moonlight-common-c/package.mk b/packages/addons/addon-depends/moonlight-common-c/package.mk deleted file mode 100644 index f6682eaa6b..0000000000 --- a/packages/addons/addon-depends/moonlight-common-c/package.mk +++ /dev/null @@ -1,40 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="moonlight-common-c" -PKG_VERSION="1d058cb" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPLv3" -PKG_SITE="https://github.com/irtimmer/moonlight-common-c" -PKG_URL="https://github.com/irtimmer/moonlight-common-c/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="" -PKG_SHORTDESC="Shared C code for the implementation of Nvidia's GameStream protocol" -PKG_LONGDESC="Shared C code for the implementation of Nvidia's GameStream protocol" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : -} - -makeinstall_target() { - : -} diff --git a/packages/addons/addon-depends/moonlight-embedded/package.mk b/packages/addons/addon-depends/moonlight-embedded/package.mk deleted file mode 100644 index 81cecb6c15..0000000000 --- a/packages/addons/addon-depends/moonlight-embedded/package.mk +++ /dev/null @@ -1,58 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="moonlight-embedded" -PKG_VERSION="2.2.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPLv3" -PKG_SITE="https://github.com/irtimmer/moonlight-embedded" -PKG_URL="https://github.com/irtimmer/moonlight-embedded/archive/v$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain curl libcec pulseaudio ffmpeg systemd alsa-lib moonlight-common-c libevdev enet opus" -PKG_SECTION="" -PKG_SHORTDESC="Gamestream client for embedded systems" -PKG_LONGDESC="Moonlight Embedded is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield, but built for Linux" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -FREESCALE_V4L_INCLUDE="" -if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver" -elif [ "$KODIPLAYER_DRIVER" = "libfslvpuwrap" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libfslvpuwrap gpu-viv-bin-mx6q v4l-utils" - FREESCALE_V4L_INCLUDE="-DFREESCALE_INCLUDE_DIR=$(get_build_dir v4l-utils)/lib/include" -elif [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libamcodec" -elif [ "$DISPLAYSERVER" = "x11" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau SDL2 ffmpeg libxcb" -fi - -PKG_CMAKE_OPTS_TARGET="$FREESCALE_V4L_INCLUDE" - -pre_build_target() { - cp -a $(get_build_dir moonlight-common-c)/* $ROOT/$PKG_BUILD/third_party/moonlight-common-c -} - -pre_configure_target() { - [ "$PROJECT" = "imx6" ] && strip_gold || true -} - -makeinstall_target() { - : -} diff --git a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0001-link-against-libm.patch b/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0001-link-against-libm.patch deleted file mode 100644 index 5180081714..0000000000 --- a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0001-link-against-libm.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2016-04-03 05:34:15.000000000 -0700 -+++ b/CMakeLists.txt 2016-05-04 14:33:19.840052271 -0700 -@@ -139,7 +139,7 @@ - - set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${MOONLIGHT_DEFINITIONS}) - target_include_directories(moonlight PRIVATE ${GAMESTREAM_INCLUDE_DIR} ${MOONLIGHT_COMMON_INCLUDE_DIR} ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS} ${UDEV_INCLUDE_DIRS}) --target_link_libraries(moonlight ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS}) -+target_link_libraries(moonlight ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS} m) - - add_subdirectory(docs) - diff --git a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0002-require-pthread.patch b/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0002-require-pthread.patch deleted file mode 100644 index 0b76d86818..0000000000 --- a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0002-require-pthread.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2016-11-19 09:59:59.335970047 -0800 -+++ b/CMakeLists.txt 2016-11-19 10:08:43.639992687 -0800 -@@ -139,7 +139,7 @@ - - set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${MOONLIGHT_DEFINITIONS}) - target_include_directories(moonlight PRIVATE ${GAMESTREAM_INCLUDE_DIR} ${MOONLIGHT_COMMON_INCLUDE_DIR} ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS} ${UDEV_INCLUDE_DIRS}) --target_link_libraries(moonlight ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS} m) -+target_link_libraries(moonlight ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS} pthread m) - - add_subdirectory(docs) - diff --git a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0003-fix-libcec4-compilation.patch b/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0003-fix-libcec4-compilation.patch deleted file mode 100644 index 72acfbfe0d..0000000000 --- a/packages/addons/addon-depends/moonlight-embedded/patches/moonlight-embedded-0003-fix-libcec4-compilation.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 90bfcdcc4da4178b0fd6c6013947006cd1c07377 Mon Sep 17 00:00:00 2001 -From: Iwan Timmer -Date: Fri, 9 Dec 2016 20:05:31 +0100 -Subject: [PATCH] Update libCEC compatibility to version 4.0 - ---- - src/input/cec.c | 2 +- - third_party/libcec/ceccloader.h | 8 ++++---- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/input/cec.c b/src/input/cec.c -index 8c3892e..1a50d81 100644 ---- a/src/input/cec.c -+++ b/src/input/cec.c -@@ -77,7 +77,7 @@ void cec_init() { - libcecc_reset_configuration(&g_config); - g_config.clientVersion = LIBCEC_VERSION_CURRENT; - g_config.bActivateSource = 0; -- g_callbacks.CBCecKeyPress = &on_cec_keypress; -+ g_callbacks.keyPress = &on_cec_keypress; - g_config.callbacks = &g_callbacks; - snprintf(g_config.strDeviceName, sizeof(g_config.strDeviceName), "Moonlight"); - g_config.callbacks = &g_callbacks; -diff --git a/third_party/libcec/ceccloader.h b/third_party/libcec/ceccloader.h -index 1ae0c2a..2f8f760 100644 ---- a/third_party/libcec/ceccloader.h -+++ b/third_party/libcec/ceccloader.h -@@ -84,7 +84,7 @@ typedef struct { - int (CDECL *set_osd_string)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iLogicalAddress, CEC_NAMESPACE cec_display_control duration, const char* strMessage); - int (CDECL *switch_monitoring)(libcec_connection_t connection, int bEnable); - CEC_NAMESPACE cec_version (CDECL *get_device_cec_version)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iLogicalAddress); -- int (CDECL *get_device_menu_language)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iLogicalAddress, CEC_NAMESPACE cec_menu_language* language); -+ int (CDECL *get_device_menu_language)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iLogicalAddress, CEC_NAMESPACE cec_menu_language language); - uint64_t (CDECL *get_device_vendor_id)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iLogicalAddress); - uint16_t (CDECL *get_device_physical_address)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iLogicalAddress); - CEC_NAMESPACE cec_logical_address (CDECL *get_active_source)(libcec_connection_t connection); -@@ -100,7 +100,7 @@ typedef struct { - int (CDECL *mute_audio)(libcec_connection_t connection, int bSendRelease); - int (CDECL *send_keypress)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iDestination, CEC_NAMESPACE cec_user_control_code key, int bWait); - int (CDECL *send_key_release)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iDestination, int bWait); -- CEC_NAMESPACE cec_osd_name (CDECL *get_device_osd_name)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iAddress); -+ int (CDECL *get_device_osd_name)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iAddress, CEC_NAMESPACE cec_osd_name name); - int (CDECL *set_stream_path_logical)(libcec_connection_t connection, CEC_NAMESPACE cec_logical_address iAddress); - int (CDECL *set_stream_path_physical)(libcec_connection_t connection, uint16_t iPhysicalAddress); - CEC_NAMESPACE cec_logical_addresses (CDECL *get_logical_addresses)(libcec_connection_t connection); -@@ -161,7 +161,7 @@ static int libcecc_resolve_all(void* lib, libcec_interface_t* iface) - _libcecc_resolve(lib, iface->set_osd_string, "libcec_set_osd_string", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address, CEC_NAMESPACE cec_display_control, const char*)); - _libcecc_resolve(lib, iface->switch_monitoring, "libcec_switch_monitoring", int(CDECL *)(libcec_connection_t, int)); - _libcecc_resolve(lib, iface->get_device_cec_version, "libcec_get_device_cec_version", CEC_NAMESPACE cec_version(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address)); -- _libcecc_resolve(lib, iface->get_device_menu_language, "libcec_get_device_menu_language", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address, CEC_NAMESPACE cec_menu_language*)); -+ _libcecc_resolve(lib, iface->get_device_menu_language, "libcec_get_device_menu_language", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address, CEC_NAMESPACE cec_menu_language)); - _libcecc_resolve(lib, iface->get_device_vendor_id, "libcec_get_device_vendor_id", uint64_t(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address)); - _libcecc_resolve(lib, iface->get_device_physical_address, "libcec_get_device_physical_address", uint16_t(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address)); - _libcecc_resolve(lib, iface->get_active_source, "libcec_get_active_source", CEC_NAMESPACE cec_logical_address(CDECL *)(libcec_connection_t)); -@@ -177,7 +177,7 @@ static int libcecc_resolve_all(void* lib, libcec_interface_t* iface) - _libcecc_resolve(lib, iface->mute_audio, "libcec_mute_audio", int(CDECL *)(libcec_connection_t, int)); - _libcecc_resolve(lib, iface->send_keypress, "libcec_send_keypress", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address, CEC_NAMESPACE cec_user_control_code, int)); - _libcecc_resolve(lib, iface->send_key_release, "libcec_send_key_release", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address, int)); -- _libcecc_resolve(lib, iface->get_device_osd_name, "libcec_get_device_osd_name", CEC_NAMESPACE cec_osd_name(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address)); -+ _libcecc_resolve(lib, iface->get_device_osd_name, "libcec_get_device_osd_name", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address, CEC_NAMESPACE cec_osd_name)); - _libcecc_resolve(lib, iface->set_stream_path_logical, "libcec_set_stream_path_logical", int(CDECL *)(libcec_connection_t, CEC_NAMESPACE cec_logical_address)); - _libcecc_resolve(lib, iface->set_stream_path_physical, "libcec_set_stream_path_physical", int(CDECL *)(libcec_connection_t, uint16_t)); - _libcecc_resolve(lib, iface->get_logical_addresses, "libcec_get_logical_addresses", CEC_NAMESPACE cec_logical_addresses(CDECL *)(libcec_connection_t)); diff --git a/packages/addons/addon-depends/mpd-mpc/package.mk b/packages/addons/addon-depends/mpd-mpc/package.mk new file mode 100644 index 0000000000..6bc74358e9 --- /dev/null +++ b/packages/addons/addon-depends/mpd-mpc/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mpd-mpc" +PKG_VERSION="0.31" +PKG_SHA256="62373e83a8a165b2ed43967975efecd3feee530f4557d6b861dd08aa89d52b2d" +PKG_LICENSE="GPL" +PKG_SITE="https://www.musicpd.org" +PKG_URL="https://www.musicpd.org/download/mpc/0/mpc-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain libiconv" +PKG_LONGDESC="Command-line client for MPD." +PKG_TOOLCHAIN="meson" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk index 2aa6532892..b323d8a2d0 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libmediainfo" -PKG_VERSION="0.7.83" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="18.05" +PKG_SHA256="76759613ca71d5659818e6ed121be9f31c552931b04939b0db4c58bc57cd5221" PKG_LICENSE="GPL" PKG_SITE="http://mediaarea.net/en/MediaInfo/Download/Source" -PKG_URL="http://mediaarea.net/download/source/libmediainfo/$PKG_VERSION/libmediainfo_$PKG_VERSION.tar.bz2" -PKG_SOURCE_DIR="MediaInfoLib" +PKG_URL="http://mediaarea.net/download/source/libmediainfo/${PKG_VERSION}/libmediainfo_${PKG_VERSION}.tar.xz" PKG_DEPENDS_TARGET="toolchain libzen zlib" -PKG_SECTION="multimedia" -PKG_SHORTDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" PKG_LONGDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - +PKG_TOOLCHAIN="manual" make_target() { cd Project/GNU/Library @@ -41,9 +20,7 @@ make_target() { --enable-static \ --disable-shared \ --prefix=/usr \ - --enable-visibility \ - --disable-libcurl \ - --disable-libmms + --enable-visibility make } @@ -54,5 +31,5 @@ post_makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include/MediaInfo/$i/ cp -aP ../../../Source/MediaInfo/$i/*.h $SYSROOT_PREFIX/usr/include/MediaInfo/$i/ done - cp -P libmediainfo-config $ROOT/$TOOLCHAIN/bin + cp -P libmediainfo-config $TOOLCHAIN/bin } diff --git a/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk index 3add8dc618..37e35787df 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/depends/libzen/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libzen" -PKG_VERSION="0.4.33" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.4.37" +PKG_SHA256="38c0a68b715b55d6685d2759eecda040adf37bd066955d79a5d01f91977bd9a0" PKG_LICENSE="GPL" PKG_SITE="http://mediaarea.net/en/MediaInfo/" -PKG_URL="http://mediaarea.net/download/source/libzen/$PKG_VERSION/libzen_$PKG_VERSION.tar.bz2" -PKG_SOURCE_DIR="ZenLib" +PKG_URL="http://mediaarea.net/download/source/libzen/${PKG_VERSION}/libzen_${PKG_VERSION}.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" PKG_LONGDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" make_target() { cd Project/GNU/Library @@ -51,5 +31,5 @@ post_makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include/ZenLib/$i/ cp -aP ../../../Source/ZenLib/$i/*.h $SYSROOT_PREFIX/usr/include/ZenLib/$i/ done - cp -P libzen-config $ROOT/$TOOLCHAIN/bin + cp -P libzen-config $TOOLCHAIN/bin } diff --git a/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk index 8984475e90..a9e71c3aff 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/mediainfo/package.mk @@ -1,34 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mediainfo" -PKG_VERSION="0.7.83" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="18.05" +PKG_SHA256="d94093aaf910759f302fb6b5ac23540a217eb940cfbb21834de2381de975fa65" PKG_LICENSE="GPL" PKG_SITE="http://mediaarea.net/en/MediaInfo/Download/Source" -PKG_URL="http://mediaarea.net/download/source/mediainfo/$PKG_VERSION/mediainfo_$PKG_VERSION.tar.bz2" -PKG_SOURCE_DIR="MediaInfo" +PKG_URL="http://mediaarea.net/download/source/mediainfo/${PKG_VERSION}/mediainfo_${PKG_VERSION}.tar.xz" PKG_DEPENDS_TARGET="toolchain libmediainfo" -PKG_SECTION="tools" -PKG_SHORTDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" -PKG_LONGDESC="MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" -PKG_AUTORECONF="no" +PKG_LONGDESC="A convenient unified display of the most relevant technical and tag data for video and audio files." +PKG_TOOLCHAIN="manual" + +pre_configure_target() { + export LDFLAGS="$LDFLAGS -L$(get_build_dir libmediainfo)/Project/GNU/Library/.libs -L$(get_build_dir libzen)/Project/GNU/Library/.libs" + export LIBS="-lmediainfo -lzen" +} make_target() { cd Project/GNU/CLI @@ -40,7 +26,3 @@ make_target() { --prefix=/usr make } - -makeinstall_target() { - : # nop -} diff --git a/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk index 88fb0e5873..cc8dd8c0ba 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/mesa-demos/package.mk @@ -1,33 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mesa-demos" PKG_VERSION="8.3.0" -PKG_REV="0" +PKG_SHA256="c173154bbd0d5fb53d732471984def42fb1b14ac85fcb834138fb9518b3e0bef" PKG_ARCH="i386 x86_64" PKG_LICENSE="OSS" PKG_SITE="http://www.mesa3d.org/" PKG_URL="ftp://ftp.freedesktop.org/pub/mesa/demos/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libX11 mesa glu glew" -PKG_SECTION="tools" -PKG_SHORTDESC="mesa-demos: Mesa 3D demos" PKG_LONGDESC="Mesa 3D demos - installed are the well known glxinfo and glxgears." -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--without-glut" diff --git a/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk index 0e50f1d67c..5531bb474e 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/mpg123/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mpg123" -PKG_VERSION="1.23.6" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="1.25.10" +PKG_SHA256="6c1337aee2e4bf993299851c70b7db11faec785303cfca3a5c3eb5f329ba7023" PKG_LICENSE="LGPLv2" PKG_SITE="http://www.mpg123.org/" -PKG_URL="http://netcologne.dl.sourceforge.net/project/$PKG_NAME/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="http://downloads.sourceforge.net/sourceforge/mpg123/mpg123-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain alsa-lib SDL2" -PKG_SECTION="tools" -PKG_SHORTDESC="mpg123" -PKG_LONGDESC="A fast MP3 Player" +PKG_LONGDESC="A console based real time MPEG Audio Player for Layer 1, 2 and 3." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static" diff --git a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk index e9efa5c17d..0a76f4e798 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/package.mk @@ -1,34 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="opencaster" PKG_VERSION="3.2.2" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="c9d77f98b31d53f521e3179003a9cb66b0586704717e9d401f3bc0dafa243865" PKG_LICENSE="GPL" PKG_SITE="http://www.avalpa.com/the-key-values/15-free-software/33-opencaster" PKG_URL="http://ftp.de.debian.org/debian/pool/main/o/opencaster/opencaster_${PKG_VERSION}+dfsg.orig.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="MPEG2 transport stream data generator and packet manipulator" -PKG_LONGDESC="OpenCaster is a free and open source MPEG2 transport stream data generator and packet manipulator" -PKG_AUTORECONF="no" +PKG_LONGDESC="A free and open source MPEG2 transport stream data generator and packet manipulator." + +pre_configure_target() { + PKG_MAKE_OPTS_TARGET="CC=$CC" +} pre_makeinstall_target() { - mkdir -p $ROOT/$PKG_BUILD/.install_pkg + mkdir -p $PKG_BUILD/.install_pkg } diff --git a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-01_crosscompile.patch b/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-01_crosscompile.patch deleted file mode 100644 index 7e7854de5f..0000000000 --- a/packages/addons/addon-depends/multimedia-tools-depends/opencaster/patches/opencaster-01_crosscompile.patch +++ /dev/null @@ -1,504 +0,0 @@ -diff --git a/libs/sectioncrc/Makefile b/libs/sectioncrc/Makefile -index 87e4627..ad8a0e5 100755 ---- a/libs/sectioncrc/Makefile -+++ b/libs/sectioncrc/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS = -g -MD -Wall -I. -I../../include - - OBJ = sectioncrc.o -diff --git a/tools/dsmcc-receive/Makefile b/tools/dsmcc-receive/Makefile -index 891a50c..ee2d82e 100644 ---- a/tools/dsmcc-receive/Makefile -+++ b/tools/dsmcc-receive/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc -lz - -diff --git a/tools/eitsecactualtoanother/Makefile b/tools/eitsecactualtoanother/Makefile -index be3a790..723c857 100644 ---- a/tools/eitsecactualtoanother/Makefile -+++ b/tools/eitsecactualtoanother/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/eitsecfilter/Makefile b/tools/eitsecfilter/Makefile -index f4e5fc4..cc94b71 100644 ---- a/tools/eitsecfilter/Makefile -+++ b/tools/eitsecfilter/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/eitsecmapper/Makefile b/tools/eitsecmapper/Makefile -index 9c6ce8f..29dbc39 100644 ---- a/tools/eitsecmapper/Makefile -+++ b/tools/eitsecmapper/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/esaudio2pes/Makefile b/tools/esaudio2pes/Makefile -index 349b187..607f0a3 100644 ---- a/tools/esaudio2pes/Makefile -+++ b/tools/esaudio2pes/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/esaudioinfo/Makefile b/tools/esaudioinfo/Makefile -index 2c014b2..69a38a0 100644 ---- a/tools/esaudioinfo/Makefile -+++ b/tools/esaudioinfo/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/esvideompeg2info/Makefile b/tools/esvideompeg2info/Makefile -index aaa8065..ac91058 100644 ---- a/tools/esvideompeg2info/Makefile -+++ b/tools/esvideompeg2info/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/esvideompeg2pes/Makefile b/tools/esvideompeg2pes/Makefile -index a905e7b..7020503 100644 ---- a/tools/esvideompeg2pes/Makefile -+++ b/tools/esvideompeg2pes/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/i13942ts/Makefile b/tools/i13942ts/Makefile -index 72e4b2d..0c020f8 100644 ---- a/tools/i13942ts/Makefile -+++ b/tools/i13942ts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - - OBJS = i13942ts.o -diff --git a/tools/ip2sec/Makefile b/tools/ip2sec/Makefile -index 3a90c82..7580ca3 100644 ---- a/tools/ip2sec/Makefile -+++ b/tools/ip2sec/Makefile -@@ -1,4 +1,3 @@ --CC = gcc - CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lpcap - -diff --git a/tools/m2ts2cbrts/Makefile b/tools/m2ts2cbrts/Makefile -index a2ed89f..778efb8 100644 ---- a/tools/m2ts2cbrts/Makefile -+++ b/tools/m2ts2cbrts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/mpe2sec/Makefile b/tools/mpe2sec/Makefile -index 5c29efd..55cbe4d 100644 ---- a/tools/mpe2sec/Makefile -+++ b/tools/mpe2sec/Makefile -@@ -1,4 +1,3 @@ --CC = gcc - CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - - OBJS = mpe.o sectioncrc.o -diff --git a/tools/mpeg2videovbv/Makefile b/tools/mpeg2videovbv/Makefile -index 8635e67..4074c93 100644 ---- a/tools/mpeg2videovbv/Makefile -+++ b/tools/mpeg2videovbv/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/oddparity/Makefile b/tools/oddparity/Makefile -index 7970590..6839a36 100644 ---- a/tools/oddparity/Makefile -+++ b/tools/oddparity/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/pes2es/Makefile b/tools/pes2es/Makefile -index a598df9..c3e803f 100644 ---- a/tools/pes2es/Makefile -+++ b/tools/pes2es/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/pes2txt/Makefile b/tools/pes2txt/Makefile -index d65922e..50057a1 100644 ---- a/tools/pes2txt/Makefile -+++ b/tools/pes2txt/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/pesaudio2ts/Makefile b/tools/pesaudio2ts/Makefile -index 6fec027..ab75796 100644 ---- a/tools/pesaudio2ts/Makefile -+++ b/tools/pesaudio2ts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/pesdata2ts/Makefile b/tools/pesdata2ts/Makefile -index 3e180f7..d541485 100644 ---- a/tools/pesdata2ts/Makefile -+++ b/tools/pesdata2ts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/pesinfo/Makefile b/tools/pesinfo/Makefile -index 5c9cbb3..3ffc1d7 100644 ---- a/tools/pesinfo/Makefile -+++ b/tools/pesinfo/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/pesvideo2ts/Makefile b/tools/pesvideo2ts/Makefile -index a8de20e..a2ebab0 100644 ---- a/tools/pesvideo2ts/Makefile -+++ b/tools/pesvideo2ts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/sec2ts/Makefile b/tools/sec2ts/Makefile -index 0607bcf..df22126 100644 ---- a/tools/sec2ts/Makefile -+++ b/tools/sec2ts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/ts2m2ts/Makefile b/tools/ts2m2ts/Makefile -index b70c018..28104fd 100644 ---- a/tools/ts2m2ts/Makefile -+++ b/tools/ts2m2ts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/ts2pes/Makefile b/tools/ts2pes/Makefile -index 61301f4..349c29e 100644 ---- a/tools/ts2pes/Makefile -+++ b/tools/ts2pes/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/ts2sec/Makefile b/tools/ts2sec/Makefile -index ebbe4be..baad160 100644 ---- a/tools/ts2sec/Makefile -+++ b/tools/ts2sec/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tscbrmuxer/Makefile b/tools/tscbrmuxer/Makefile -index aa93c07..38cd632 100644 ---- a/tools/tscbrmuxer/Makefile -+++ b/tools/tscbrmuxer/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsccc/Makefile b/tools/tsccc/Makefile -index 44340fb..85ec0f8 100755 ---- a/tools/tsccc/Makefile -+++ b/tools/tsccc/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tscrypt/Makefile b/tools/tscrypt/Makefile -index 3ce49f5..9cec259 100644 ---- a/tools/tscrypt/Makefile -+++ b/tools/tscrypt/Makefile -@@ -1,4 +1,3 @@ --CC = gcc - CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -ldvbcsa - -diff --git a/tools/tsdiscont/Makefile b/tools/tsdiscont/Makefile -index bed498e..78329c1 100644 ---- a/tools/tsdiscont/Makefile -+++ b/tools/tsdiscont/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsdoubleoutput/Makefile b/tools/tsdoubleoutput/Makefile -index e35c8a2..e8927fe 100644 ---- a/tools/tsdoubleoutput/Makefile -+++ b/tools/tsdoubleoutput/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsfilter/Makefile b/tools/tsfilter/Makefile -index 5e8a3fc..9397197 100755 ---- a/tools/tsfilter/Makefile -+++ b/tools/tsfilter/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsfixcc/Makefile b/tools/tsfixcc/Makefile -index cdf93ae..ebd894f 100755 ---- a/tools/tsfixcc/Makefile -+++ b/tools/tsfixcc/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsinputswitch/Makefile b/tools/tsinputswitch/Makefile -index 5b2f205..3a08c7a 100644 ---- a/tools/tsinputswitch/Makefile -+++ b/tools/tsinputswitch/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsloop/Makefile b/tools/tsloop/Makefile -index 0781c2c..71dc3c6 100755 ---- a/tools/tsloop/Makefile -+++ b/tools/tsloop/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsmask/Makefile b/tools/tsmask/Makefile -index afe3fe8..914a1ef 100755 ---- a/tools/tsmask/Makefile -+++ b/tools/tsmask/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsmodder/Makefile b/tools/tsmodder/Makefile -index 72a4fde..2199b8a 100644 ---- a/tools/tsmodder/Makefile -+++ b/tools/tsmodder/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsnullfiller/Makefile b/tools/tsnullfiller/Makefile -index fd7bf5a..3b6898f 100644 ---- a/tools/tsnullfiller/Makefile -+++ b/tools/tsnullfiller/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsnullshaper/Makefile b/tools/tsnullshaper/Makefile -index 2071129..3b89b7e 100644 ---- a/tools/tsnullshaper/Makefile -+++ b/tools/tsnullshaper/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc -lrt - -diff --git a/tools/tsororts/Makefile b/tools/tsororts/Makefile -index 408c924..0687c55 100644 ---- a/tools/tsororts/Makefile -+++ b/tools/tsororts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsorts/Makefile b/tools/tsorts/Makefile -index 1b4d287..96db276 100644 ---- a/tools/tsorts/Makefile -+++ b/tools/tsorts/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsoutputswitch/Makefile b/tools/tsoutputswitch/Makefile -index c2d0b09..6abfddb 100644 ---- a/tools/tsoutputswitch/Makefile -+++ b/tools/tsoutputswitch/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tspcrmeasure/Makefile b/tools/tspcrmeasure/Makefile -index 819a25e..f39efd3 100644 ---- a/tools/tspcrmeasure/Makefile -+++ b/tools/tspcrmeasure/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tspcrrestamp/Makefile b/tools/tspcrrestamp/Makefile -index 3f05709..43f37b4 100644 ---- a/tools/tspcrrestamp/Makefile -+++ b/tools/tspcrrestamp/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tspcrstamp/Makefile b/tools/tspcrstamp/Makefile -index 5520ef3..6c050bc 100644 ---- a/tools/tspcrstamp/Makefile -+++ b/tools/tspcrstamp/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tspidmapper/Makefile b/tools/tspidmapper/Makefile -index c02853a..f237a77 100644 ---- a/tools/tspidmapper/Makefile -+++ b/tools/tspidmapper/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsstamp/Makefile b/tools/tsstamp/Makefile -index 80393fe..f288f09 100644 ---- a/tools/tsstamp/Makefile -+++ b/tools/tsstamp/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tstcpreceive/Makefile b/tools/tstcpreceive/Makefile -index 4f1cac7..ebbba5f 100644 ---- a/tools/tstcpreceive/Makefile -+++ b/tools/tstcpreceive/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tstcpsend/Makefile b/tools/tstcpsend/Makefile -index 8894859..fb8a573 100644 ---- a/tools/tstcpsend/Makefile -+++ b/tools/tstcpsend/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc -lrt - -diff --git a/tools/tstdt/Makefile b/tools/tstdt/Makefile -index 1873adb..c5eb23d 100644 ---- a/tools/tstdt/Makefile -+++ b/tools/tstdt/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tstimedwrite/Makefile b/tools/tstimedwrite/Makefile -index 3ad1432..7a34191 100644 ---- a/tools/tstimedwrite/Makefile -+++ b/tools/tstimedwrite/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc -lrt - -diff --git a/tools/tstimeout/Makefile b/tools/tstimeout/Makefile -index 0dbc314..c37b97e 100644 ---- a/tools/tstimeout/Makefile -+++ b/tools/tstimeout/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsudpreceive/Makefile b/tools/tsudpreceive/Makefile -index 2e08cee..3a6c3cb 100644 ---- a/tools/tsudpreceive/Makefile -+++ b/tools/tsudpreceive/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/tsudpsend/Makefile b/tools/tsudpsend/Makefile -index 0d55bd4..bd6f39e 100644 ---- a/tools/tsudpsend/Makefile -+++ b/tools/tsudpsend/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc -lrt - -diff --git a/tools/tsvbr2cbr/Makefile b/tools/tsvbr2cbr/Makefile -index 01cc992..65d670c 100644 ---- a/tools/tsvbr2cbr/Makefile -+++ b/tools/tsvbr2cbr/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/txt2pes/Makefile b/tools/txt2pes/Makefile -index f506da7..55f0d5e 100644 ---- a/tools/txt2pes/Makefile -+++ b/tools/txt2pes/Makefile -@@ -1,4 +1,3 @@ --C = gcc - CFLAGS += -g -MD -Wall -I. -I../../include $(CPPFLAGS) - LDFLAGS += -lc - -diff --git a/tools/zpipe/Makefile b/tools/zpipe/Makefile -index 5997129..707647d 100644 ---- a/tools/zpipe/Makefile -+++ b/tools/zpipe/Makefile -@@ -1,4 +1,3 @@ --CC = gcc - CFLAGS += -g -O2 -MD -Wall -I. -I../../include -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) - LDFLAGS += -lz - diff --git a/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk index ea615a604e..028c539c86 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/package.mk @@ -1,40 +1,18 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="squeezelite" -PKG_VERSION="33cca7e" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="ecb6e3696a42113994640e5345d0b5ca2e77d28b" +PKG_SHA256="b0fbded72fbf400613b5cb071bc0efdaddaeba6b4ba32b1de9b24098c505b40b" PKG_LICENSE="GPLv3" PKG_SITE="https://github.com/ralph-irving/squeezelite" PKG_URL="https://github.com/ralph-irving/squeezelite/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain faad2 ffmpeg flac libmad libvorbis mpg123 soxr" -PKG_SECTION="tools" -PKG_SHORTDESC="squeezelite" -PKG_LONGDESC="A client for the Logitech Media Server" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain faad2 ffmpeg flac libmad libvorbis mpg123 soxr libogg" +PKG_LONGDESC="A client for the Logitech Media Server." pre_make_target() { - OPTS="-DDSD -DFFMPEG -DRESAMPLE -DVISEXPORT" - CFLAGS="$CFLAGS $OPTS" - LDFLAGS="$LDFLAGS -lasound -lpthread -lm -lrt" + export OPTS="-DDSD -DFFMPEG -DRESAMPLE -DVISEXPORT -DLINKALL" + export LIBS="-lvorbis -logg" } makeinstall_target() { diff --git a/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/patches/squeezelite-01-makefile.patch b/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/patches/squeezelite-01-makefile.patch new file mode 100644 index 0000000000..6389fe3861 --- /dev/null +++ b/packages/addons/addon-depends/multimedia-tools-depends/squeezelite/patches/squeezelite-01-makefile.patch @@ -0,0 +1,11 @@ +--- a/Makefile 2018-05-07 14:06:07.000000000 +0200 ++++ b/Makefile 2018-10-25 19:08:15.000000000 +0200 +@@ -103,7 +103,7 @@ + all: $(EXECUTABLE) + + $(EXECUTABLE): $(OBJECTS) +- $(CC) $(OBJECTS) $(LDFLAGS) $(LDADD) -o $@ ++ $(CC) $(OBJECTS) $(LDFLAGS) $(LDADD) $(LIBS) -o $@ + + $(OBJECTS): $(DEPS) + diff --git a/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk index 624d5f54a6..842d8fca9e 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/package.mk @@ -1,35 +1,22 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) PKG_NAME="tsdecrypt" PKG_VERSION="10.0" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="a337a7d60cc8f78b9dffbd7d675390497763bcb8f878ec9f1bec3eb80f32b1f1" PKG_LICENSE="GPL" PKG_SITE="http://georgi.unixsol.org/programs/tsdecrypt" PKG_URL="http://georgi.unixsol.org/programs/tsdecrypt/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain libdvbcsa" -PKG_SECTION="tools" -PKG_SHORTDESC="tsdecrypt" -PKG_LONGDESC="tsdecrypt reads incoming mpeg transport stream over UDP/RTP and then decrypts it using libdvbcsa/ffdecsa and keys obtained from OSCAM or similar cam server" -PKG_AUTORECONF="no" +PKG_LONGDESC="A tool that reads incoming mpeg transport stream over UDP/RTP and then decrypts it using libdvbcsa/ffdecsa." + +make_target() { + make CC=$CC LINK="$LD -o" +} + +post_make_target() { + make strip STRIP=$STRIP +} makeinstall_target() { : # nop diff --git a/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/patches/tsdecrypt-makefile.patch b/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/patches/tsdecrypt-makefile.patch deleted file mode 100644 index 979cd7eff5..0000000000 --- a/packages/addons/addon-depends/multimedia-tools-depends/tsdecrypt/patches/tsdecrypt-makefile.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -Naur tsdecrypt-10.0/libfuncs/Makefile tsdecrypt-10.0.patch/libfuncs/Makefile ---- tsdecrypt-10.0/libfuncs/Makefile 2013-09-12 12:53:27.000000000 +0200 -+++ tsdecrypt-10.0.patch/libfuncs/Makefile 2014-07-20 12:23:54.900762191 +0200 -@@ -1,5 +1,4 @@ --CC = $(CROSS)$(TARGET)gcc --LINK = $(CROSS)$(TARGET)ld -o -+LINK = $(LD) -o - MKDEP = $(CC) -M -o $*.d $< - - LIBRARY_LINK_OPTS = -L. -r -diff -Naur tsdecrypt-10.0/libtsfuncs/Makefile tsdecrypt-10.0.patch/libtsfuncs/Makefile ---- tsdecrypt-10.0/libtsfuncs/Makefile 2013-09-12 12:53:30.000000000 +0200 -+++ tsdecrypt-10.0.patch/libtsfuncs/Makefile 2014-07-20 12:23:54.901762318 +0200 -@@ -1,5 +1,4 @@ --CC = $(CROSS)$(TARGET)gcc --LINK = $(CROSS)$(TARGET)ld -o -+LINK = $(LD) -o - MKDEP = $(CC) -M -o $*.d $< - - LIBRARY_LINK_OPTS = -L. -r -diff -Naur tsdecrypt-10.0/Makefile tsdecrypt-10.0.patch/Makefile ---- tsdecrypt-10.0/Makefile 2013-09-12 12:53:16.000000000 +0200 -+++ tsdecrypt-10.0.patch/Makefile 2014-07-20 12:24:11.303809770 +0200 -@@ -1,5 +1,3 @@ --CC = $(CROSS)$(TARGET)cc --STRIP = $(CROSS)$(TARGET)strip - MKDEP = $(CC) -MP -MM -o $*.d $< - RM = rm -f - MV = mv -f diff --git a/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk index 2536a0be5e..2270af7085 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/tstools/package.mk @@ -1,40 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tstools" -PKG_VERSION="1.11" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="db1f79f" +PKG_SHA256="f204229016c9deafcc75fe602c390339878312126134edbfcebf239e093dc4ff" PKG_LICENSE="GPL" -PKG_SITE="http://tstools.berlios.de/" -PKG_URL="$SOURCEFORGE_SRC/project/tstools.berlios/tstools-1_11.tgz" +PKG_SITE="https://github.com/kynesim/tstools" +PKG_URL="https://github.com/kynesim/tstools/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="command line tools for working with MPEG data" PKG_LONGDESC="This is a set of cross-platform command line tools for working with MPEG data." -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="-parallel" make_target() { - make -j1 CROSS_COMPILE=$TARGET_PREFIX + make CROSS_COMPILE=$TARGET_PREFIX } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk b/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk index 2df608d2ff..77bba33750 100644 --- a/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/bwm-ng/package.mk @@ -1,33 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bwm-ng" PKG_VERSION="0.6.1" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="613e8072b0efc2f5f790143192bca45c3c80b7ad09bff384de9bbaa57aa499b8" PKG_LICENSE="GPL" PKG_SITE="http://www.gropp.org/?id=projects&sub=bwm-ng" -PKG_URL="http://www.gropp.org/bwm-ng/bwm-ng-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses libstatgrab" -PKG_SECTION="network/analyzer" -PKG_SHORTDESC="bwm-ng: small and simple console-based live network and disk io bandwidth monitor" -PKG_LONGDESC="Bandwidth Monitor NG is a small and simple console-based live network and disk io bandwidth monitor for Linux, BSD, Solaris, Mac OS X and others." -PKG_AUTORECONF="no" +PKG_URL="https://github.com/vgropp/bwm-ng/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain ncurses libstatgrab" +PKG_LONGDESC="A small and simple console-based live network and disk io bandwidth monitor." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--with-libstatgrab \ --with-time \ @@ -37,10 +19,6 @@ PKG_CONFIGURE_OPTS_TARGET="--with-libstatgrab \ --with-procnetdev \ --with-partitions" -pre_configure_target() { - export LIBS="-ltermcap" -} - makeinstall_target() { : # nop } diff --git a/packages/addons/addon-depends/network-tools-depends/bwm-ng/patches/bwm-ng-001-static-inline.patch b/packages/addons/addon-depends/network-tools-depends/bwm-ng/patches/bwm-ng-001-static-inline.patch new file mode 100644 index 0000000000..da9ae7040c --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/bwm-ng/patches/bwm-ng-001-static-inline.patch @@ -0,0 +1,286 @@ +From d5daf15c2098040b8b01753d3cdce8c1c79fc528 Mon Sep 17 00:00:00 2001 +From: David Seifert +Date: Fri, 10 Feb 2017 21:30:49 +0100 +Subject: [PATCH] Use `static inline` instead of `inline` + +`inline` by itself is not portably guaranteed to emit +an external definition when needed in C99. The current +code base implicitly relies on GNU89 inline semantics, +which _always_ emit an external definition. More recent +versions of GCC and Clang switch to C99/C11 inline semantics +by default, which fails with undefined references. + +See also: +* http://www.greenend.org.uk/rjk/tech/inline.html +* https://clang.llvm.org/compatibility.html#inline +* http://blahg.josefsipek.net/?p=529 +--- + src/bwm-ng.c | 4 ++-- + src/help.c | 4 ++-- + src/options.c | 16 ++++++++-------- + src/output.c | 22 +++++++++++----------- + src/process.c | 28 ++++++++++++++-------------- + 5 files changed, 37 insertions(+), 37 deletions(-) + +diff --git a/src/bwm-ng.c b/src/bwm-ng.c +index ad94ccd..c2ab0db 100644 +--- a/src/bwm-ng.c ++++ b/src/bwm-ng.c +@@ -26,7 +26,7 @@ + + /* handle interrupt signal */ + void sigint(int sig) FUNCATTR_NORETURN; +-inline void init(void); ++static inline void init(void); + + /* clear stuff and exit */ + #ifdef __STDC__ +@@ -98,7 +98,7 @@ void sigint(int sig) { + deinit(0, NULL); + } + +-inline void init(void) { ++static inline void init(void) { + if_count=0; + delay=500; + #if EXTENDED_STATS +diff --git a/src/help.c b/src/help.c +index 7fd9ca4..4853297 100644 +--- a/src/help.c ++++ b/src/help.c +@@ -24,9 +24,9 @@ + #include "global_vars.h" + #include "help.h" + +-inline void print_help_line(const char *short_c,const char * long_c,const char *descr); ++static inline void print_help_line(const char *short_c,const char * long_c,const char *descr); + +-inline void print_help_line(const char *short_c,const char * long_c,const char *descr) { ++static inline void print_help_line(const char *short_c,const char * long_c,const char *descr) { + #ifdef LONG_OPTIONS + printf(" %-23s",long_c); + #else +diff --git a/src/options.c b/src/options.c +index 1b65eeb..30dccb4 100644 +--- a/src/options.c ++++ b/src/options.c +@@ -30,12 +30,12 @@ static char* getToken(char** str, const char* delims); + char *trim_whitespace(char *str); + int read_config(const char *config_file); + #endif +-inline int str2output_unit(char *optarg); ++static inline int str2output_unit(char *optarg); + #if EXTENDED_STATS +-inline int str2output_type(char *optarg); ++static inline int str2output_type(char *optarg); + #endif +-inline int str2out_method(char *optarg); +-inline int str2in_method(char *optarg); ++static inline int str2out_method(char *optarg); ++static inline int str2in_method(char *optarg); + + #ifdef CONFIG_FILE + /****************************************************************************** +@@ -65,7 +65,7 @@ static char* getToken(char** str, const char* delims) { + /******************************************************************************/ + #endif + +-inline int str2output_unit(char *optarg) { ++static inline int str2output_unit(char *optarg) { + if (optarg) { + if (!strcasecmp(optarg,"bytes")) return BYTES_OUT; + if (!strcasecmp(optarg,"bits")) return BITS_OUT; +@@ -76,7 +76,7 @@ inline int str2output_unit(char *optarg) { + } + + #if EXTENDED_STATS +-inline int str2output_type(char *optarg) { ++static inline int str2output_type(char *optarg) { + if (optarg) { + if (!strcasecmp(optarg,"rate")) return RATE_OUT; + if (!strcasecmp(optarg,"max")) return MAX_OUT; +@@ -87,7 +87,7 @@ inline int str2output_type(char *optarg) { + } + #endif + +-inline int str2out_method(char *optarg) { ++static inline int str2out_method(char *optarg) { + if (optarg) { + if (!strcasecmp(optarg,"plain")) return PLAIN_OUT; + #ifdef HAVE_CURSES +@@ -109,7 +109,7 @@ inline int str2out_method(char *optarg) { + } + + +-inline int str2in_method(char *optarg) { ++static inline int str2in_method(char *optarg) { + if (optarg) { + #ifdef PROC_NET_DEV + if (!strcasecmp(optarg,"proc")) return PROC_IN; +diff --git a/src/output.c b/src/output.c +index 653e444..1425b3c 100644 +--- a/src/output.c ++++ b/src/output.c +@@ -25,13 +25,13 @@ + #include "output.h" + + inline static const char *output_type2str(void); +-inline const char *input2str(void); +-inline const char *show_all_if2str(void); +-inline ullong direction2value(char mode,struct inout_long stats); ++static inline const char *input2str(void); ++static inline const char *show_all_if2str(void); ++static inline ullong direction2value(char mode,struct inout_long stats); + #if EXTENDED_STATS +-inline double direction_max2value(char mode,struct inouttotal_double stats,int items); ++static inline double direction_max2value(char mode,struct inouttotal_double stats,int items); + #endif +-inline char *dyn_byte_value2str(double value,char *str,int buf_size); ++static inline char *dyn_byte_value2str(double value,char *str,int buf_size); + char *values2str(char mode,t_iface_speed_stats stats,t_iface_stats full_stats,float multiplier,char *str,int buf_size); + + inline static const char *output_type2str(void) { +@@ -59,7 +59,7 @@ inline static const char *output_type2str(void) { + } + + +-inline const char *input2str(void) { ++static inline const char *input2str(void) { + switch (input_method) { + #ifdef SYSCTL + case SYSCTL_IN: +@@ -121,7 +121,7 @@ inline const char *input2str(void) { + return ""; + } + +-inline const char *show_all_if2str(void) { ++static inline const char *show_all_if2str(void) { + switch (show_all_if) { + case 1: + return " (all)"; +@@ -262,7 +262,7 @@ int print_header(int option) { + } + + +-inline ullong direction2value(char mode,struct inout_long stats) { ++static inline ullong direction2value(char mode,struct inout_long stats) { + switch (mode) { + case 0: + return stats.in; +@@ -275,7 +275,7 @@ inline ullong direction2value(char mode,struct inout_long stats) { + } + + #if EXTENDED_STATS +-inline double direction_max2value(char mode,struct inouttotal_double stats,int items) { ++static inline double direction_max2value(char mode,struct inouttotal_double stats,int items) { + switch (mode) { + case 0: + return (double)(stats.in/items); +@@ -288,7 +288,7 @@ inline double direction_max2value(char mode,struct inouttotal_double stats,int i + } + #endif + +-inline char *dyn_byte_value2str(double value,char *str,int buf_size) { ++static inline char *dyn_byte_value2str(double value,char *str,int buf_size) { + if (dynamic) { + if (value<1024) + snprintf(str,buf_size,"%15.2f ",value); +@@ -306,7 +306,7 @@ inline char *dyn_byte_value2str(double value,char *str,int buf_size) { + return str; + } + +-inline char *dyn_bit_value2str(double value,char *str,int buf_size) { ++static inline char *dyn_bit_value2str(double value,char *str,int buf_size) { + if (dynamic) { + if (value<1000) + snprintf(str,buf_size,"%15.2f ",value); +diff --git a/src/process.c b/src/process.c +index 59eccf0..d06c6dd 100644 +--- a/src/process.c ++++ b/src/process.c +@@ -26,19 +26,19 @@ + + short show_iface(char *instr, char *searchstr,char iface_is_up); + #if HAVE_GETTIMEOFDAY +-inline long tvdiff(struct timeval newer, struct timeval older); ++static inline long tvdiff(struct timeval newer, struct timeval older); + float get_time_delay(int iface_num); + #endif +-inline ullong calc_new_values(ullong new, ullong old); ++static inline ullong calc_new_values(ullong new, ullong old); + t_iface_speed_stats convert2calced_values(t_iface_speed_stats new, t_iface_speed_stats old); + t_iface_speed_stats convert2calced_disk_values(t_iface_speed_stats new, t_iface_speed_stats old); + #if EXTENDED_STATS +-inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data); +-inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data); +-inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier); ++static inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data); ++static inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data); ++static inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier); + void save_avg(struct t_avg *avg,struct iface_speed_stats calced_stats,float multiplier); +-inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values); +-inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier); ++static inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values); ++static inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier); + #endif + + /* returns the whether to show the iface or not +@@ -74,7 +74,7 @@ short show_iface(char *instr, char *searchstr,char iface_is_up) { + + #if HAVE_GETTIMEOFDAY + /* Returns: the time difference in milliseconds. */ +-inline long tvdiff(struct timeval newer, struct timeval older) { ++static inline long tvdiff(struct timeval newer, struct timeval older) { + return labs((newer.tv_sec-older.tv_sec)*1000+ + (newer.tv_usec-older.tv_usec)/1000); + } +@@ -95,7 +95,7 @@ float get_time_delay(int iface_num) { + #endif + + /* basically new-old, but handles "overflow" of source aswell */ +-inline ullong calc_new_values(ullong new, ullong old) { ++static inline ullong calc_new_values(ullong new, ullong old) { + /* FIXME: WRAP_AROUND _might_ be wrong for libstatgrab, where the type is always long long */ + return (new>=old) ? (ullong)(new-old) : (ullong)(( + #ifdef HAVE_LIBKSTAT +@@ -136,13 +136,13 @@ t_iface_speed_stats convert2calced_disk_values(t_iface_speed_stats new, t_iface_ + + #if EXTENDED_STATS + /* sub old values from cached for avg stats */ +-inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data) { ++static inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data) { + values->in-=data.in; + values->out-=data.out; + values->total-=data.total; + } + +-inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data) { ++static inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data) { + values->in+=data.in; + values->out+=data.out; + values->total+=data.total; +@@ -151,7 +151,7 @@ inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_do + + /* put new-old bytes in inout_long struct into a inouttotal_double struct + * and add values to cached .value struct */ +-inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier) { ++static inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier) { + data->in=calced_stats.in*multiplier; + data->out=calced_stats.out*multiplier; + data->total=(calced_stats.in+calced_stats.out)*multiplier; +@@ -201,13 +201,13 @@ void save_avg(struct t_avg *avg,struct iface_speed_stats calced_stats,float mult + } + + /* add current in and out bytes to totals struct */ +-inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values) { ++static inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values) { + stats->in+=new_stats_values.in; + stats->out+=new_stats_values.out; + } + + /* lookup old max values and save new if higher */ +-inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier) { ++static inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier) { + if (multiplier*calced_stats.in > stats->in) + stats->in=multiplier*calced_stats.in; + if (multiplier*calced_stats.out>stats->out) diff --git a/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk b/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk index cbfac0b523..0d5442c9bc 100644 --- a/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/depends/libpcap/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libpcap" PKG_VERSION="1.7.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="7ad3112187e88328b85e46dce7a9b949632af18ee74d97ffc3f2b41fe7f448b0" PKG_LICENSE="GPL" PKG_SITE="http://www.tcpdump.org/" PKG_URL="http://www.tcpdump.org/release/libpcap-${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="system interface for user-level packet capture" -PKG_LONGDESC="libpcap (Packet CAPture) provides a portable framework for low-level network monitoring. Applications include network statistics collection, security monitoring, network debugging, etc." -PKG_AUTORECONF="no" +PKG_LONGDESC="A portable framework for low-level network monitoring." PKG_CONFIGURE_OPTS_TARGET="LIBS=-lpthread \ ac_cv_header_libusb_1_0_libusb_h=no \ diff --git a/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk b/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk index 8dcedf0529..4fe25ac3ec 100644 --- a/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/depends/libstatgrab/package.mk @@ -1,37 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libstatgrab" PKG_VERSION="0.91" -PKG_REV="1" +PKG_SHA256="03e9328e4857c2c9dcc1b0347724ae4cd741a72ee11acc991784e8ef45b7f1ab" PKG_SITE="http://www.i-scream.org/libstatgrab/" PKG_URL="http://ftp.i-scream.org/pub/i-scream/libstatgrab/libstatgrab-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION=libs -PKG_SHORTDESC="provides cross platform access to statistics about the system on which it's run" -PKG_LONGDESC="libstatgrab is a library that provides cross platform access to statistics about the system on which it's run. It's written in C and presents a selection of useful interfaces which can be used to access key system statistics. The current list of statistics includes CPU usage, memory utilisation, disk usage, process counts, network traffic, disk I/O, and more." -PKG_AUTORECONF="yes" +PKG_LONGDESC="A library that provides cross platform access to statistics about the system on which it's run." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ --enable-static \ --disable-shared \ --disable-saidar \ --disable-examples \ - --disable-manpages \ --disable-setuid-binaries \ --disable-setgid-binaries" diff --git a/packages/addons/addon-depends/network-tools-depends/iftop/package.mk b/packages/addons/addon-depends/network-tools-depends/iftop/package.mk index 6c5c34e69a..6a9b927f80 100644 --- a/packages/addons/addon-depends/network-tools-depends/iftop/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/iftop/package.mk @@ -1,33 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="iftop" PKG_VERSION="1.0pre4" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="f733eeea371a7577f8fe353d86dd88d16f5b2a2e702bd96f5ffb2c197d9b4f97" PKG_LICENSE="GPL" PKG_SITE="http://htop.sourceforge.net/" PKG_URL="http://www.ex-parrot.com/pdw/iftop/download/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses libpcap libnl" -PKG_SECTION="network/analyzer" -PKG_SHORTDESC="iftop: display bandwidth usage on an interface" -PKG_LONGDESC="iftop does for network usage what top(1) does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts. Handy for answering the question 'why is our ADSL link so slow?'." -PKG_AUTORECONF="yes" +PKG_DEPENDS_TARGET="toolchain ncurses libpcap libnl" +PKG_LONGDESC="A tool to display bandwidth usage on an interface." +PKG_TOOLCHAIN="autotools" pre_build_target() { mkdir -p $PKG_BUILD/.$TARGET_NAME @@ -35,8 +17,7 @@ pre_build_target() { } pre_configure_target() { - export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/pcap" - export LIBS="-lpcap -lnl-3 -lnl-genl-3 -lncurses -ltermcap" + export LIBS="-lpcap -lnl-3 -lnl-genl-3 -lncurses" } makeinstall_target() { diff --git a/packages/addons/addon-depends/network-tools-depends/iperf/package.mk b/packages/addons/addon-depends/network-tools-depends/iperf/package.mk index 3f5735fbce..b23893990a 100644 --- a/packages/addons/addon-depends/network-tools-depends/iperf/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/iperf/package.mk @@ -1,36 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="iperf" -PKG_VERSION="3.1.2" -PKG_REV="2" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="https://iperf.fr/" -PKG_URL="https://iperf.fr/download/source/$PKG_NAME-$PKG_VERSION-source.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network/testing" -PKG_SHORTDESC="iperf: A modern alternative for measuring maximum TCP and UDP bandwidth performance" -PKG_LONGDESC="Iperf was developed by NLANR/DAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss." -PKG_AUTORECONF="yes" +PKG_VERSION="3.6" +PKG_SHA256="1ad23f70a8eb4b892a3cbb247cafa956e0f5c7d8b8601b1d9c8031c2a806f23f" +PKG_LICENSE="BSD" +PKG_SITE="http://software.es.net/iperf/" +PKG_URL="https://github.com/esnet/iperf/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain openssl" +PKG_LONGDESC="A tool to measuring maximum TCP and UDP bandwidth performance." +PKG_TOOLCHAIN="autotools" -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/irssi/package.mk b/packages/addons/addon-depends/network-tools-depends/irssi/package.mk index a7fdf302e8..8b821e4085 100644 --- a/packages/addons/addon-depends/network-tools-depends/irssi/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/irssi/package.mk @@ -1,50 +1,27 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="irssi" -PKG_VERSION="0.8.19" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.1.2" +PKG_SHA256="5ccc2b89a394e91bea0aa83a951c3b1d471c76da87b4169ec435530a31bf9732" PKG_LICENSE="GPL" PKG_SITE="http://www.irssi.org/" -PKG_URL="https://github.com/irssi-import/irssi/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain glib netbsd-curses libressl" -PKG_SECTION="tools" -PKG_SHORTDESC="IRC client" -PKG_LONGDESC="Irssi is a terminal based IRC client for UNIX systems" -PKG_AUTORECONF="no" +PKG_URL="https://github.com/irssi/irssi/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain glib ncurses openssl" +PKG_LONGDESC="Irssi is a terminal based IRC client for UNIX systems." PKG_CONFIGURE_OPTS_TARGET="--with-sysroot=$SYSROOT_PREFIX \ - --enable-ssl \ --disable-glibtest \ --without-socks \ --with-textui \ --without-bot \ --without-proxy \ - --with-gc \ - --without-perl \ - --without-sco" + --without-perl" pre_configure_target() { - export CFLAGS="$CFLAGS -I$ROOT/$PKG_BUILD" - export LIBS="-ltermcap" + export CFLAGS="$CFLAGS -I$PKG_BUILD" } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/iw/package.mk b/packages/addons/addon-depends/network-tools-depends/iw/package.mk index 500c11fe32..fb143da195 100644 --- a/packages/addons/addon-depends/network-tools-depends/iw/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/iw/package.mk @@ -1,37 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="iw" -PKG_VERSION="4.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.14" +PKG_SHA256="f01671c0074bfdec082a884057edba1b9efd35c89eda554638496f03b769ad89" PKG_LICENSE="PUBLIC_DOMAIN" PKG_SITE="http://wireless.kernel.org/en/users/Documentation/iw" PKG_URL="https://www.kernel.org/pub/software/network/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain libnl" -PKG_SECTION="tools" -PKG_SHORTDESC="iw is a new nl80211 based CLI configuration utility for wireless devices" -PKG_LONGDESC="iw is a new nl80211 based CLI configuration utility for wireless devices. It supports all new drivers that have been added to the kernel recently." +PKG_LONGDESC="A new nl80211 based CLI configuration utility for wireless devices." +# iw fails at runtime with lto enabled pre_configure_target() { - # iw fails at runtime with lto enabled - strip_lto - export LDFLAGS="$LDFLAGS -pthread" } diff --git a/packages/addons/addon-depends/network-tools-depends/lftp/package.mk b/packages/addons/addon-depends/network-tools-depends/lftp/package.mk index ef238dbcf4..333cc86c63 100644 --- a/packages/addons/addon-depends/network-tools-depends/lftp/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/lftp/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="lftp" -PKG_VERSION="4.7.4" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" +PKG_VERSION="4.8.4" +PKG_SHA256="4ebc271e9e5cea84a683375a0f7e91086e5dac90c5d51bb3f169f75386107a62" +PKG_LICENSE="GPLv3" PKG_SITE="http://lftp.yar.ru/" -PKG_URL="http://lftp.yar.ru/ftp/${PKG_NAME}-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain readline libressl zlib" -PKG_SECTION="tools" -PKG_SHORTDESC="ftp client" -PKG_LONGDESC="LFTP is a sophisticated ftp/http client, and a file transfer program supporting a number of network protocols" -PKG_AUTORECONF="no" +PKG_URL="http://lftp.yar.ru/ftp/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain readline openssl zlib" +PKG_LONGDESC="A sophisticated ftp/http client, and a file transfer program supporting a number of network protocols." PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ --without-gnutls \ @@ -36,5 +17,5 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ --with-zlib=$SYSROOT_PREFIX/usr" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/lftp/patches/lftp-0001-link-readline-with-termcap.patch b/packages/addons/addon-depends/network-tools-depends/lftp/patches/lftp-0001-link-readline-with-termcap.patch index 112316ea4f..8cf3ca77cb 100644 --- a/packages/addons/addon-depends/network-tools-depends/lftp/patches/lftp-0001-link-readline-with-termcap.patch +++ b/packages/addons/addon-depends/network-tools-depends/lftp/patches/lftp-0001-link-readline-with-termcap.patch @@ -6,7 +6,7 @@ diff -Naur a/configure b/configure fi readline_ld_flags="-L$readline_prefix/lib" - readline_lib_flags="-lreadline" -+ readline_lib_flags="-lreadline -ltermcap" ++ readline_lib_flags="-lreadline -lncurses" run_readline_test="yes" elif test "$readline_requested" = "yes"; then if test -n "$readline_include_dir" -a -n "$readline_lib_flags"; then diff --git a/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk b/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk index f2dda3542b..a6d3e7a1c5 100644 --- a/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/ncftp/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="ncftp" -PKG_VERSION="3.2.5" -PKG_REV="0" -PKG_ARCH="any" -PKG_LICENSE="GPL" +PKG_VERSION="3.2.6" +PKG_SHA256="5f200687c05d0807690d9fb770327b226f02dd86155b49e750853fce4e31098d" +PKG_LICENSE="GPLv3" PKG_SITE="http://www.ncftp.com/ncftp/" -PKG_URL="ftp://ftp.ncftp.com/ncftp/ncftp-${PKG_VERSION}-src.tar.bz2" +PKG_URL="ftp://ftp.ncftp.com/ncftp/ncftp-${PKG_VERSION}-src.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="NcFTP Client (also known as just NcFTP) is a set of FREE application programs implementing the File Transfer Protocol (FTP)." -PKG_LONGDESC="NcFTP Client (also known as just NcFTP) is a set of FREE application programs implementing the File Transfer Protocol (FTP)." -PKG_AUTORECONF="no" +PKG_LONGDESC="NcFTP is a set of application programs implementing the File Transfer Protocol." PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_librtmp_rtmp_h=yes \ --enable-readline \ @@ -45,5 +26,5 @@ pre_build_target() { } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk b/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk index 9ce0123b45..23f98f8230 100644 --- a/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/ngrep/package.mk @@ -1,36 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="ngrep" -PKG_VERSION="1.45" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="9b5946822a5c9c617d937245fdc9049c5740ae09" +PKG_SHA256="db3ea041ad490a90d38ce4623ad9f3e7c9798734bdcaf900d3cf319fce16aa81" PKG_LICENSE="GPL" -PKG_SITE="http://ngrep.sourceforge.net/" -PKG_URL="http://prdownloads.sourceforge.net/ngrep/ngrep-${PKG_VERSION}.tar.bz2" +PKG_SITE="https://github.com/jpr5/ngrep" +PKG_URL="https://github.com/jpr5/ngrep/archive/${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain libpcap" -PKG_SECTION="network/analyzer" -PKG_SHORTDESC="ngrep - network grep" -PKG_LONGDESC="ngrep - network grep" -PKG_DISCLAIMER="this is an unofficial addon. please don't ask for support in openelec forum / irc channel" -PKG_AUTORECONF="no" +PKG_LONGDESC="A tool like GNU grep applied to the network layer." +PKG_TOOLCHAIN="autotools" -PKG_CONFIGURE_OPTS_TARGET="--with-pcap-includes=$SYSROOT_PREFIX/usr/include --disable-dropprivs" +PKG_CONFIGURE_OPTS_TARGET="--with-pcap-includes=$SYSROOT_PREFIX/usr/include \ + --enable-ipv6 \ + --disable-dropprivs" pre_build_target() { mkdir -p $PKG_BUILD/.$TARGET_NAME @@ -38,5 +21,5 @@ pre_build_target() { } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/nmap/package.mk b/packages/addons/addon-depends/network-tools-depends/nmap/package.mk index ba17c995b9..6e436524da 100644 --- a/packages/addons/addon-depends/network-tools-depends/nmap/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/nmap/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="nmap" -PKG_VERSION="7.11" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="7.70" +PKG_SHA256="847b068955f792f4cc247593aca6dc3dc4aae12976169873247488de147a6e18" PKG_LICENSE="GPL" PKG_SITE="http://nmap.org/" -PKG_URL="http://nmap.org/dist/${PKG_NAME}-${PKG_VERSION}.tgz" +PKG_URL="http://nmap.org/dist/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="network tool" -PKG_LONGDESC="Free Security Scanned for Network" -PKG_AUTORECONF="no" +PKG_LONGDESC="Free Security Scanned for Network." PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --with-pcap=linux \ @@ -39,12 +20,12 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static \ pre_configure_target() { # nmap fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME export CPPFLAGS="$CPPFLAGS -Iliblua" } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/rar2fs/package.mk b/packages/addons/addon-depends/network-tools-depends/rar2fs/package.mk new file mode 100644 index 0000000000..ea3193b9f0 --- /dev/null +++ b/packages/addons/addon-depends/network-tools-depends/rar2fs/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rar2fs" +PKG_VERSION="1.27.1" +PKG_SHA256="f7e84b813fe82c6a886313e13a85d4f0d229b21f343a3ce6f73325a4ac90cb5a" +PKG_LICENSE="GPL3" +PKG_SITE="https://github.com/hasse69/rar2fs" +PKG_URL="https://github.com/hasse69/rar2fs/releases/download/v$PKG_VERSION/rar2fs-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain fuse unrar" +PKG_LONGDESC="FUSE file system for reading RAR archives" + +PKG_CONFIGURE_OPTS_TARGET="--with-unrar=$(get_build_dir unrar) \ + --with-unrar-lib=$(get_build_dir unrar) \ + --disable-static-unrar" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/network-tools-depends/rsync/package.mk b/packages/addons/addon-depends/network-tools-depends/rsync/package.mk index d489b05d33..c2b0a4d55f 100644 --- a/packages/addons/addon-depends/network-tools-depends/rsync/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/rsync/package.mk @@ -1,38 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="rsync" -PKG_VERSION="3.1.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" +PKG_VERSION="3.1.3" +PKG_SHA256="55cc554efec5fdaad70de921cd5a5eeb6c29a95524c715f3bbf849235b0800c0" +PKG_LICENSE="GPLv3" PKG_SITE="http://www.samba.org/ftp/rsync/rsync.html" PKG_URL="https://download.samba.org/pub/rsync/src/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network/backup" -PKG_SHORTDESC="rsync: A replacement for rcp that has many more features" -PKG_LONGDESC="Rsync uses an own 'rsync' algorithm which provides a very fast method for bringing remote files into sync. It does this by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand. At first glance this may seem impossible because the calculation of diffs between two files normally requires local access to both files." -PKG_AUTORECONF="no" +PKG_LONGDESC="A very fast method for bringing remote files into sync." PKG_CONFIGURE_OPTS_TARGET="--disable-acl-support \ - --disable-xattr-support \ - --with-included-popt" + --disable-xattr-support \ + --with-included-popt" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk b/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk index 49837d0d83..71ac60d108 100644 --- a/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/sshfs/package.mk @@ -1,34 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="sshfs" -PKG_VERSION="2.7" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.10" +PKG_SHA256="70845dde2d70606aa207db5edfe878e266f9c193f1956dd10ba1b7e9a3c8d101" PKG_LICENSE="GPL" PKG_SITE="https://github.com/libfuse/sshfs" PKG_URL="https://github.com/libfuse/sshfs/releases/download/sshfs-$PKG_VERSION/sshfs-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain fuse glib" -PKG_SECTION="tools" -PKG_SHORTDESC="sshfs: a filesystem client based on the SSH File Transfer Protocol" -PKG_LONGDESC="This is a filesystem client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there's nothing to do. On the client side mounting the filesystem is as easy as logging into the server with ssh." -PKG_AUTORECONF="no" +PKG_LONGDESC="A filesystem client based on the SSH File Transfer Protocol." makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk b/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk index f0c5d84a71..e39a0746b3 100644 --- a/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/tcpdump/package.mk @@ -1,46 +1,29 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tcpdump" -PKG_VERSION="4.7.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.9.2" +PKG_SHA256="798b3536a29832ce0cbb07fafb1ce5097c95e308a6f592d14052e1ef1505fe79" PKG_SITE="http://www.tcpdump.org/" PKG_URL="http://www.tcpdump.org/release/tcpdump-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain libpcap" -PKG_SECTION="network/analyzer" -PKG_SHORTDESC="powerful tool for network monitoring and data acquisition" -PKG_LONGDESC="This program allows you to dump the traffic on a network. tcpdump is able to examine IPv4, ICMPv4, IPv6, ICMPv6, UDP, TCP, SNMP, AFS BGP, RIP, PIM, DVMRP, IGMP, SMB, OSPF, NFS and many other packet types." -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain libpcap libtirpc" +PKG_LONGDESC="A program that allows you to dump the traffic on a network." -PKG_CONFIGURE_OPTS_TARGET="--with-pcap=linux --with-crypto=no --disable-ipv6" +PKG_CONFIGURE_OPTS_TARGET="--with-crypto=no" pre_configure_target() { # When cross-compiling, configure can't set linux version # forcing it sed -i -e 's/ac_cv_linux_vers=unknown/ac_cv_linux_vers=2/' ../configure + CFLAGS+=" -I$SYSROOT_PREFIX/usr/include/tirpc" + LDFLAGS+=" -ltirpc" } -pre_build_target() { +post_configure_target() { # discard native system includes sed -i "s%-I/usr/include%%g" Makefile } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk b/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk index 69bb43c370..3e5966fc23 100644 --- a/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/udpxy/package.mk @@ -1,41 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="udpxy" -PKG_VERSION="1.0.23-0" -PKG_REV="0" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.udpxy.com/download-en.html" -PKG_URL="$SOURCEFORGE_SRC/project/udpxy/udpxy/Chipmunk-1.0/${PKG_NAME}.${PKG_VERSION}-prod.tar.gz" +PKG_VERSION="1.0.23-12" +PKG_SHA256="16bdc8fb22f7659e0427e53567dc3e56900339da261199b3d00104d699f7e94c" +PKG_LICENSE="GPLv3" +PKG_SITE="http://www.udpxy.com" +PKG_URL="http://www.udpxy.com/download/1_23/${PKG_NAME}.${PKG_VERSION}-prod.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="udpxy is a UDP-to-HTTP multicast traffic relay daemon" -PKG_LONGDESC="udpxy is a UDP-to-HTTP multicast traffic relay daemon" -PKG_DISCLAIMER="this is an unofficial addon. please don't ask for support in openelec forum / irc channel" -PKG_AUTORECONF="no" - -pre_configure_target() { - # fails to build with gcc 4.9 + lto - strip_lto - CFLAGS="$CFLAGS -Wno-error=unused-const-variable" -} +PKG_LONGDESC="A UDP-to-HTTP multicast traffic relay daemon." makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk b/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk index 976931768f..85c6ef8a08 100644 --- a/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk +++ b/packages/addons/addon-depends/network-tools-depends/wireless_tools/package.mk @@ -1,45 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="wireless_tools" -PKG_VERSION="29" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="30.pre9" +PKG_SHA256="abd9c5c98abf1fdd11892ac2f8a56737544fe101e1be27c6241a564948f34c63" PKG_LICENSE="GPL" -PKG_SITE="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html" -PKG_URL="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/$PKG_NAME.$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}.${PKG_VERSION}" +PKG_SITE="https://github.com/HewlettPackard/wireless-tools" +PKG_URL="https://hewlettpackard.github.io/wireless-tools/$PKG_NAME.$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="debug/tools" -PKG_SHORTDESC="wireless-tools: tools allowing to manipulate the Wireless Extensions" -PKG_LONGDESC="The Wireless Tools (WT) is a set of tools allowing to manipulate the Wireless Extensions. They use a textual interface and are rather crude, but aim to support the full Wireless Extension. There are many other tools you can use with Wireless Extensions, however Wireless Tools is the reference implementation." -PKG_AUTORECONF="no" - -pre_configure_Target() { - # wireless_tools fails to build on some systems with LTO enabled - strip_lto -} +PKG_LONGDESC="The Wireless Tools (WT) is a set of tools allowing to manipulate the Wireless Extensions." make_target() { make PREFIX=/usr CC="$CC" AR="$AR" \ - CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" iwmulticall + CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" iwmulticall } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/ninja/package.mk b/packages/addons/addon-depends/ninja/package.mk deleted file mode 100644 index 1011894a75..0000000000 --- a/packages/addons/addon-depends/ninja/package.mk +++ /dev/null @@ -1,43 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="ninja" -PKG_VERSION="1.6.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="Apache" -PKG_SITE="http://martine.github.io/ninja/" -PKG_URL="https://github.com/ninja-build/ninja/archive/v$PKG_VERSION.tar.gz" -PKG_SECTION="devel" -PKG_SHORTDESC="Small build system with a focus on speed" -PKG_LONGDESC="Small build system with a focus on speed" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -configure_host() { - : -} - -make_host() { - python2 configure.py --bootstrap -} - -makeinstall_host() { - cp ninja $ROOT/$TOOLCHAIN/bin/ -} diff --git a/packages/addons/addon-depends/nspr/package.mk b/packages/addons/addon-depends/nspr/package.mk deleted file mode 100644 index b2ad360943..0000000000 --- a/packages/addons/addon-depends/nspr/package.mk +++ /dev/null @@ -1,47 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="nspr" -PKG_VERSION="4.13" -PKG_REV="2" -PKG_ARCH="any" -PKG_LICENSE="Mozilla Public License" -PKG_SITE="http://www.linuxfromscratch.org/blfs/view/svn/general/nspr.html" -PKG_DEPENDS_TARGET="toolchain nss:host" -PKG_SECTION="security" -PKG_SHORTDESC="Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions" -PKG_LONGDESC="Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -MAKEFLAGS=-j1 - -if [ "$TARGET_ARCH" = "x86_64" ] ; then - TARGET_USE_64="--enable-64bit" -fi - -PKG_CONFIGURE_OPTS_TARGET="--with-pthreads $TARGET_USE_64" -PKG_MAKE_OPTS_TARGET="NSINSTALL=$ROOT/$TOOLCHAIN/bin/nsinstall" -PKG_MAKEINSTALL_OPTS_TARGET="NSINSTALL=$ROOT/$TOOLCHAIN/bin/nsinstall" - -configure_target() { - cd $(get_build_dir nss)/nspr - ./configure --with-pthreads $TARGET_USE_64 $TARGET_CONFIGURE_OPTS -} diff --git a/packages/addons/addon-depends/nss/package.mk b/packages/addons/addon-depends/nss/package.mk deleted file mode 100644 index 50b300a07b..0000000000 --- a/packages/addons/addon-depends/nss/package.mk +++ /dev/null @@ -1,77 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="nss" -PKG_VERSION="3.27.1" -PKG_REV="2" -PKG_ARCH="any" -PKG_LICENSE="Mozilla Public License" -PKG_SITE="http://ftp.mozilla.org/" -PKG_URL="http://ftp.mozilla.org/pub/security/nss/releases/NSS_3_27_1_RTM/src/nss-3.27.1-with-nspr-4.13.tar.gz" -PKG_DEPENDS_TARGET="toolchain nss:host nspr zlib" -PKG_SECTION="security" -PKG_SHORTDESC="The Network Security Services (NSS) package is a set of libraries designed to support cross-platform development of security-enabled client and server applications" -PKG_LONGDESC="The Network Security Services (NSS) package is a set of libraries designed to support cross-platform development of security-enabled client and server applications" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -MAKEFLAGS=-j1 - -make_host() { - cd $ROOT/$PKG_BUILD/nss - - [ "$TARGET_ARCH" = "x86_64" ] && export USE_64=1 - - make -C coreconf/nsinstall -} - -makeinstall_host() { - cp $ROOT/$PKG_BUILD/nss/coreconf/nsinstall/*/nsinstall $ROOT/$TOOLCHAIN/bin -} - -post_makeinstall_host() { - rm -rf $ROOT/$PKG_BUILD/nss/coreconf/nsinstall/Linux* -} - -make_target() { - cd $ROOT/$PKG_BUILD/nss - - [ "$TARGET_ARCH" = "x86_64" ] && TARGET_USE_64="USE_64=1" - - make BUILD_OPT=1 $TARGET_USE_64 \ - NSPR_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include/nspr \ - USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz \ - OS_TEST=$TARGET_ARCH \ - NSS_TESTS="dummy" \ - NSINSTALL=$ROOT/$TOOLCHAIN/bin/nsinstall \ - CPU_ARCH_TAG=$TARGET_ARCH \ - CC=$CC LDFLAGS="$LDFLAGS -L$SYSROOT_PREFIX/usr/lib" \ - V=1 -} - -makeinstall_target() { - cd $ROOT/$PKG_BUILD - $STRIP dist/Linux*/lib/*.so - cp -L dist/Linux*/lib/*.so $SYSROOT_PREFIX/usr/lib - cp -L dist/Linux*/lib/libcrmf.a $SYSROOT_PREFIX/usr/lib - mkdir -p $SYSROOT_PREFIX/usr/include/nss - cp -RL dist/{public,private}/nss/* $SYSROOT_PREFIX/usr/include/nss - cp -L dist/Linux*/lib/pkgconfig/nss.pc $SYSROOT_PREFIX/usr/lib/pkgconfig -} diff --git a/packages/addons/addon-depends/opus/package.mk b/packages/addons/addon-depends/opus/package.mk index a7c7b7d997..2a04fa8c6b 100644 --- a/packages/addons/addon-depends/opus/package.mk +++ b/packages/addons/addon-depends/opus/package.mk @@ -1,42 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="opus" -PKG_VERSION="1.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.3" +PKG_SHA256="4f3d69aefdf2dbaf9825408e452a8a414ffc60494c70633560700398820dc550" PKG_LICENSE="BSD" PKG_SITE="http://www.opus-codec.org" -PKG_URL="http://downloads.us.xiph.org/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://archive.mozilla.org/pub/opus/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="Codec designed for interactive speech and audio transmission over the Internet" -PKG_LONGDESC="Codec designed for interactive speech and audio transmission over the Internet" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Codec designed for interactive speech and audio transmission over the Internet." if [ "$TARGET_ARCH" = "arm" ]; then - FIXED_POINT="--enable-fixed-point" + PKG_FIXED_POINT="--enable-fixed-point" else - FIXED_POINT="--disable-fixed-point" + PKG_FIXED_POINT="--disable-fixed-point" fi PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ - $FIXED_POINT" + $PKG_FIXED_POINT" diff --git a/packages/addons/addon-depends/pango/package.mk b/packages/addons/addon-depends/pango/package.mk deleted file mode 100644 index 9361a2c41e..0000000000 --- a/packages/addons/addon-depends/pango/package.mk +++ /dev/null @@ -1,39 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -PKG_NAME="pango" -PKG_VERSION="1.40.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.pango.org/" -PKG_URL="http://ftp.gnome.org/pub/gnome/sources/pango/1.40/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain glib cairo freetype fontconfig libX11 libXft harfbuzz" -PKG_SECTION="x11/toolkits" -PKG_SHORTDESC="pango: Library for layout and rendering of internationalized text" -PKG_LONGDESC="The goal of the Pango project is to provide an open-source framework for the layout and rendering of internationalized text. Pango is an offshoot of the GTK+ and GNOME projects, and the initial focus is operation in those environments, however there is nothing fundamentally GTK+ or GNOME specific about Pango. Pango uses Unicode for all of its encoding, and will eventually support output in all the worlds major languages." -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--disable-doc-cross-references \ - --disable-gtk-doc \ - --disable-man \ - --enable-debug=no \ - --with-xft" diff --git a/packages/addons/addon-depends/pango/patches/pango-01_no-gtk-doc.patch b/packages/addons/addon-depends/pango/patches/pango-01_no-gtk-doc.patch deleted file mode 100644 index 1a583b8406..0000000000 --- a/packages/addons/addon-depends/pango/patches/pango-01_no-gtk-doc.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -Naur pango-1.38.1/configure.ac pango-1.38.1.patch/configure.ac ---- pango-1.38.1/configure.ac 2015-10-12 21:13:25.000000000 +0200 -+++ pango-1.38.1.patch/configure.ac 2015-11-14 23:14:05.714344868 +0100 -@@ -483,15 +483,6 @@ - dnl *** Checks for gtk-doc *** - dnl ************************** - --if $have_cairo ; then : ; else -- if test x$enable_gtk_doc = xyes ; then -- AC_MSG_WARN([Cairo not present, disabling doc building]) -- enable_gtk_doc=no -- fi --fi -- --GTK_DOC_CHECK([1.15], [--flavour no-tmpl]) -- - AC_ARG_ENABLE(doc-cross-references, - AC_HELP_STRING([--disable-doc-cross-references], - [cross reference glib and cairo symbols @<:@default=yes@:>@]), -@@ -606,7 +597,6 @@ - pango/pangoxft.rc - pango-view/Makefile - examples/Makefile --docs/Makefile - docs/version.xml - tools/Makefile - tests/Makefile -diff -Naur pango-1.38.1/Makefile.am pango-1.38.1.patch/Makefile.am ---- pango-1.38.1/Makefile.am 2015-04-15 19:37:43.000000000 +0200 -+++ pango-1.38.1.patch/Makefile.am 2015-11-14 23:05:52.738361176 +0100 -@@ -1,6 +1,6 @@ - ## Process this file with automake to create Makefile.in. - --SUBDIRS= pango pango-view examples docs tools tests build -+SUBDIRS= pango pango-view examples tools tests build - - EXTRA_DIST = \ - autogen.sh \ -@@ -38,7 +38,6 @@ - $(srcdir)/INSTALL \ - $(srcdir)/omf.make \ - $(srcdir)/xmldocs.make \ -- $(srcdir)/gtk-doc.make \ - $(srcdir)/ChangeLog - - ### ChangeLog generation diff --git a/packages/addons/addon-depends/pango/patches/pango-02_meh.patch b/packages/addons/addon-depends/pango/patches/pango-02_meh.patch deleted file mode 100644 index dc7b25d4e5..0000000000 --- a/packages/addons/addon-depends/pango/patches/pango-02_meh.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff -Naur pango-1.38.1/Makefile.am pango-1.38.1.patch/Makefile.am ---- pango-1.38.1/Makefile.am 2015-11-14 23:05:52.000000000 +0100 -+++ pango-1.38.1.patch/Makefile.am 2015-11-14 23:19:07.548943525 +0100 -@@ -1,6 +1,6 @@ - ## Process this file with automake to create Makefile.in. - --SUBDIRS= pango pango-view examples tools tests build -+SUBDIRS= pango build - - EXTRA_DIST = \ - autogen.sh \ -diff -Naur pango-1.38.1/pango/Makefile.am pango-1.38.1.patch/pango/Makefile.am ---- pango-1.38.1/pango/Makefile.am 2015-09-01 00:47:11.000000000 +0200 -+++ pango-1.38.1.patch/pango/Makefile.am 2015-11-14 23:21:14.081145117 +0100 -@@ -31,7 +31,7 @@ - $(LIBTHAI_CFLAGS) \ - $(X_CFLAGS) - --BUILT_SOURCES = pango-enum-types.h pango-enum-types.c pango-features.h -+BUILT_SOURCES = pango-features.h - - pangoincludedir=$(includedir)/pango-1.0/pango - -@@ -127,22 +127,6 @@ - pango-features.h \ - pango-enum-types.h - --pango-enum-types.h: s-enum-types-h --s-enum-types-h: $(pango_headers) Makefile.am pango-enum-types.h.template -- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ -- --template pango-enum-types.h.template \ -- $(pango_headers) ) > pango-enum-types.h.tmp \ -- && mv pango-enum-types.h.tmp pango-enum-types.h \ -- && echo timestamp > $@ -- --pango-enum-types.c: s-enum-types-c --s-enum-types-c: $(pango_headers) Makefile.am pango-enum-types.c.template -- $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) \ -- --template pango-enum-types.c.template \ -- $(pango_headers) ) > pango-enum-types.c.tmp \ -- && mv pango-enum-types.c.tmp pango-enum-types.c \ -- && echo timestamp > $@ -- - pango-features.h: - $(AM_V_GEN) cd $(top_builddir) && ./config.status pango/pango-features.h - -diff -Naur pango-1.38.1/pango/pango-context.c pango-1.38.1.patch/pango/pango-context.c ---- pango-1.38.1/pango/pango-context.c 2015-09-13 17:05:39.000000000 +0200 -+++ pango-1.38.1.patch/pango/pango-context.c 2015-11-14 23:22:57.512225981 +0100 -@@ -38,6 +38,7 @@ - - #include "pango-engine-private.h" - #include "pango-script-private.h" -+#include "pango-enum-types.h" - - /** - * PangoContext: -diff -Naur pango-1.38.1/pango/pangofc-font.c pango-1.38.1.patch/pango/pangofc-font.c ---- pango-1.38.1/pango/pangofc-font.c 2015-04-15 19:37:43.000000000 +0200 -+++ pango-1.38.1.patch/pango/pangofc-font.c 2015-11-14 23:23:49.840316980 +0100 -@@ -45,6 +45,7 @@ - #include "pango-engine.h" - #include "pango-layout.h" - #include "pango-impl-utils.h" -+#include "pango-enum-types.h" - - #include - -diff -Naur pango-1.38.1/pango/pango-layout.c pango-1.38.1.patch/pango/pango-layout.c ---- pango-1.38.1/pango/pango-layout.c 2015-09-01 18:20:54.000000000 +0200 -+++ pango-1.38.1.patch/pango/pango-layout.c 2015-11-14 23:23:19.280262638 +0100 -@@ -77,6 +77,7 @@ - #include - - #include "pango-layout-private.h" -+#include "pango-enum-types.h" - - - typedef struct _Extents Extents; diff --git a/packages/addons/addon-depends/pcsc-lite/package.mk b/packages/addons/addon-depends/pcsc-lite/package.mk index 5f32bf2926..661b981c5f 100644 --- a/packages/addons/addon-depends/pcsc-lite/package.mk +++ b/packages/addons/addon-depends/pcsc-lite/package.mk @@ -1,38 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pcsc-lite" -PKG_VERSION="1.8.16" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="1.8.23" +PKG_SHA256="5a27262586eff39cfd5c19aadc8891dd71c0818d3d629539bd631b958be689c9" PKG_LICENSE="GPL" -PKG_SITE="http://pcsclite.alioth.debian.org/pcsclite.html" -PKG_URL="https://alioth.debian.org/frs/download.php/file/4164/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_SITE="https://pcsclite.apdu.fr" +PKG_URL="https://pcsclite.apdu.fr/files/pcsc-lite-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain libusb" -PKG_SECTION="service/system" -PKG_SHORTDESC="Middleware to access a smart card using SCard API (PC/SC)" -PKG_LONGDESC="Middleware to access a smart card using SCard API (PC/SC)" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Middleware to access a smart card using SCard API (PC/SC)." PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ --enable-static \ --disable-libudev \ --enable-libusb \ - --enable-usbdropdir=/storage/.kodi/addons/service.system.pcscd-addon/drivers" + --enable-usbdropdir=/storage/.kodi/addons/service.pcscd/drivers" diff --git a/packages/addons/addon-depends/pngquant/package.mk b/packages/addons/addon-depends/pngquant/package.mk new file mode 100644 index 0000000000..f89a55f372 --- /dev/null +++ b/packages/addons/addon-depends/pngquant/package.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pngquant" +PKG_VERSION="2.12.0" +PKG_SHA256="0e540c64bb58c05f2a05b4eaf1d3d165f0d3278500f15abfeac47f93f8fa8fa8" +PKG_LICENSE="GPLv3" +PKG_SITE="https://pngquant.org" +PKG_URL="http://pngquant.org/pngquant-${PKG_VERSION}-src.tar.gz" +PKG_DEPENDS_HOST="toolchain libpng:host zlib:host" +PKG_LONGDESC="A lossy PNG compressor." + +configure_host() { + : +} + +make_host() { + cd $PKG_BUILD + BIN=$PKG_BUILD/pngquant make + + $STRIP $PKG_BUILD/pngquant +} + +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp $PKG_BUILD/pngquant $TOOLCHAIN/bin +} diff --git a/packages/addons/addon-depends/protobuf/package.mk b/packages/addons/addon-depends/protobuf/package.mk index 92a97cea7f..290734ff7f 100644 --- a/packages/addons/addon-depends/protobuf/package.mk +++ b/packages/addons/addon-depends/protobuf/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# 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. -# -# This program 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. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="protobuf" PKG_VERSION="3.1.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="51ceea9957c875bdedeb1f64396b5b0f3864fe830eed6a2d9c066448373ea2d6" PKG_LICENSE="OSS" PKG_SITE="https://developers.google.com/protocol-buffers/" PKG_URL="https://github.com/google/$PKG_NAME/releases/download/v$PKG_VERSION/$PKG_NAME-cpp-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="toolchain zlib:host" PKG_DEPENDS_TARGET="toolchain zlib protobuf:host" -PKG_SECTION="devel" -PKG_SHORTDESC="protobuf: Protocol Buffers - Google's data interchange format" -PKG_LONGDESC="protobuf: Protocol Buffers - Google's data interchange format" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CMAKE_SCRIPT="$ROOT/$PKG_BUILD/cmake/CMakeLists.txt" +PKG_LONGDESC="Protocol Buffers for Google's data interchange format." PKG_CMAKE_OPTS_HOST="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \ -DBUILD_SHARED_LIBS=0 \ @@ -39,6 +19,10 @@ PKG_CMAKE_OPTS_HOST="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \ PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_HOST" +configure_package() { + PKG_CMAKE_SCRIPT="$PKG_BUILD/cmake/CMakeLists.txt" +} + post_makeinstall_target() { rm -rf $INSTALL/usr/bin diff --git a/packages/addons/addon-depends/python-libusb1/package.mk b/packages/addons/addon-depends/python-libusb1/package.mk index 7538c898c0..ac7ce5dba3 100644 --- a/packages/addons/addon-depends/python-libusb1/package.mk +++ b/packages/addons/addon-depends/python-libusb1/package.mk @@ -1,41 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="python-libusb1" -PKG_VERSION="1.5.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.6.4" +PKG_SHA256="e4876dff281f948cdb57a44535627299c2333e6933fa06bfbc60c26cecd12fb1" PKG_LICENSE="LGPL" PKG_SITE="https://github.com/vpelletier/python-libusb1" PKG_URL="https://github.com/vpelletier/$PKG_NAME/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_PRIORITY="optional" -PKG_SECTION="python" -PKG_SHORTDESC="Pure-python wrapper for libusb-1.0" -PKG_LONGDESC="Pure-python wrapper for libusb-1.0" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="A pure-python wrapper for libusb-1.0." +PKG_TOOLCHAIN="manual" make_target() { python setup.py build } - -makeinstall_target() { - : -} diff --git a/packages/addons/addon-depends/qtbase/package.mk b/packages/addons/addon-depends/qtbase/package.mk index f7db62fe2e..c8a6583281 100644 --- a/packages/addons/addon-depends/qtbase/package.mk +++ b/packages/addons/addon-depends/qtbase/package.mk @@ -1,36 +1,18 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) PKG_NAME="qtbase" PKG_VERSION="5.6.2" -PKG_ARCH="any" +PKG_SHA256="2f6eae93c5d982fe0a387a01aeb3435571433e23e9d9d9246741faf51f1ee787" PKG_LICENSE="GPL" PKG_SITE="http://qt-project.org" PKG_URL="http://download.qt.io/official_releases/qt/5.6/$PKG_VERSION/submodules/$PKG_NAME-opensource-src-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="pcre zlib" -PKG_SOURCE_DIR="$PKG_NAME-opensource-src-$PKG_VERSION" -PKG_SHORTDESC="A cross-platform application and UI framework" -PKG_LONGDESC="A cross-platform application and UI framework" -PKG_AUTORECONF="no" +PKG_LONGDESC="A cross-platform application and UI framework." PKG_CONFIGURE_OPTS_TARGET="-prefix /usr -sysroot $SYSROOT_PREFIX - -hostprefix $ROOT/$TOOLCHAIN + -hostprefix $TOOLCHAIN -device linux-libreelec-g++ -opensource -confirm-license -release diff --git a/packages/addons/addon-depends/qtbase/patches/qtbase-001-stdlib-error.patch b/packages/addons/addon-depends/qtbase/patches/qtbase-001-stdlib-error.patch new file mode 100644 index 0000000000..2b6f680f5b --- /dev/null +++ b/packages/addons/addon-depends/qtbase/patches/qtbase-001-stdlib-error.patch @@ -0,0 +1,111 @@ +From 9f3efa796acb97ea4887468f1e8136e2e0711118 Mon Sep 17 00:00:00 2001 +From: Peter Levine +Date: Fri, 13 May 2016 20:04:00 -0400 +Subject: [PATCH] Remove -isystem from qmake due to QTBUG-53375 + +Change-Id: If0595fc2f209a48585e7e9b9a61f11c0d4e0664f +--- + mkspecs/common/clang.conf | 1 - + mkspecs/common/gcc-base.conf | 1 - + mkspecs/linux-icc/qmake.conf | 1 - + qmake/generators/unix/unixmake2.cpp | 14 +++----------- + qmake/generators/win32/mingw_make.cpp | 8 +------- + 5 files changed, 4 insertions(+), 21 deletions(-) + +diff --git a/mkspecs/common/clang.conf b/mkspecs/common/clang.conf +index ee9c1b8..fbe370e 100644 +--- a/mkspecs/common/clang.conf ++++ b/mkspecs/common/clang.conf +@@ -16,7 +16,6 @@ QMAKE_LINK_SHLIB = $$QMAKE_CXX + CONFIG += clang_pch_style + QMAKE_PCH_OUTPUT_EXT = .pch + +-QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_PRECOMPILE = -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} + QMAKE_CFLAGS_USE_PRECOMPILE = -Xclang -include-pch -Xclang ${QMAKE_PCH_OUTPUT} + QMAKE_CFLAGS_LTCG = -flto +diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf +index 6e043f5..df8d314 100644 +--- a/mkspecs/common/gcc-base.conf ++++ b/mkspecs/common/gcc-base.conf +@@ -44,7 +44,6 @@ QMAKE_CFLAGS_DEBUG += -g + QMAKE_CFLAGS_SHLIB += -fPIC + QMAKE_CFLAGS_STATIC_LIB += -fPIC + QMAKE_CFLAGS_APP += -fPIC +-QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses + QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden + QMAKE_CFLAGS_EXCEPTIONS_OFF += -fno-exceptions +diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf +index 495fd15..935833b 100644 +--- a/mkspecs/linux-icc/qmake.conf ++++ b/mkspecs/linux-icc/qmake.conf +@@ -21,7 +21,6 @@ QMAKE_CFLAGS_DEBUG = -O0 -g + QMAKE_CFLAGS_SHLIB = -fPIC + QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB + QMAKE_CFLAGS_YACC = +-QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_THREAD = -D_REENTRANT + QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections + QMAKE_CFLAGS_LTCG = -ipo -fno-fat-lto-objects +diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp +index 9312f19..009a674 100644 +--- a/qmake/generators/unix/unixmake2.cpp ++++ b/qmake/generators/unix/unixmake2.cpp +@@ -176,16 +176,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) + t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; + t << "INCPATH ="; + { +- QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); + const ProStringList &incs = project->values("INCLUDEPATH"); + for(int i = 0; i < incs.size(); ++i) { + const ProString &inc = incs.at(i); +- if (inc.isEmpty()) +- continue; +- +- if (!isystem.isEmpty() && isSystemInclude(inc.toQString())) +- t << ' ' << isystem << ' '; +- else ++ if (!inc.isEmpty()) + t << " -I"; + t << escapeFilePath(inc); + } +@@ -1328,10 +1322,8 @@ void UnixMakefileGenerator::init2() + } + + if (include_deps && project->isActiveConfig("gcc_MD_depends")) { +- // use -MMD if we know about -isystem too +- ProString MD_flag(project->values("QMAKE_CFLAGS_ISYSTEM").isEmpty() ? "-MD" : "-MMD"); +- project->values("QMAKE_CFLAGS") += MD_flag; +- project->values("QMAKE_CXXFLAGS") += MD_flag; ++ project->values("QMAKE_CFLAGS") += "-MD"; ++ project->values("QMAKE_CXXFLAGS") += "-MD"; + } + } + +diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp +index 382b10c..c9eebd8 100644 +--- a/qmake/generators/win32/mingw_make.cpp ++++ b/qmake/generators/win32/mingw_make.cpp +@@ -249,17 +249,11 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) + { + t << "INCPATH = "; + +- QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); + const ProStringList &incs = project->values("INCLUDEPATH"); + for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { + QString inc = (*incit).toQString(); + inc.replace(QRegExp("\\\\$"), ""); +- +- if (!isystem.isEmpty() && isSystemInclude(inc)) +- t << isystem << ' '; +- else +- t << "-I"; +- t << escapeFilePath(inc) << ' '; ++ t << "-I" << escapeFilePath(inc) << ' '; + } + t << endl; + } +-- +2.7.4 + diff --git a/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk b/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk index 5ca687cb86..9c14058079 100644 --- a/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk +++ b/packages/addons/addon-depends/rpi-tools-depends/RPi.GPIO/package.mk @@ -1,44 +1,23 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RPi.GPIO" -PKG_VERSION="0.6.2" -PKG_REV="1" +PKG_VERSION="0.6.3" +PKG_SHA256="a5fc0eb5e401963b6c0a03650da6b42c4005f02d962b81241d96c98d0a578516" PKG_ARCH="arm" PKG_LICENSE="MIT" PKG_SITE="http://sourceforge.net/p/raspberry-gpio-python/" -PKG_URL="https://pypi.python.org/packages/source/R/RPi.GPIO/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python" -PKG_SHORTDESC="A module to control Raspberry Pi GPIO channels" -PKG_LONGDESC="A module to control Raspberry Pi GPIO channels" -PKG_AUTORECONF="no" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="A module to control Raspberry Pi GPIO channels." +PKG_TOOLCHAIN="manual" pre_configure_target() { export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" export LDSHARED="$CC -shared" - export CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/python2.7" + export CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/$PKG_PYTHON_VERSION" } make_target() { python setup.py build } - -makeinstall_target() { - : # nop -} diff --git a/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk b/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk index c1c308c339..ddf863eaf3 100644 --- a/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk +++ b/packages/addons/addon-depends/rpi-tools-depends/gpiozero/package.mk @@ -1,38 +1,13 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gpiozero" -PKG_VERSION="1.2.0" -PKG_REV="1" +PKG_VERSION="1.4.1" +PKG_SHA256="b4b074e56dea12c21b05e6feef792719a392a245f5e685bc56be3dc2546f8609" PKG_ARCH="arm" PKG_LICENSE="BSD" PKG_SITE="https://github.com/RPi-Distro/python-gpiozero" -PKG_URL="https://pypi.python.org/packages/source/g/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="python" -PKG_SHORTDESC="A simple interface to everyday GPIO components used with Raspberry Pi" -PKG_LONGDESC="A simple interface to everyday GPIO components used with Raspberry Pi" -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_LONGDESC="A simple interface to everyday GPIO components used with Raspberry Pi." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/rpi-tools-depends/lan951x-led-ctl/package.mk b/packages/addons/addon-depends/rpi-tools-depends/lan951x-led-ctl/package.mk new file mode 100644 index 0000000000..a768a2185b --- /dev/null +++ b/packages/addons/addon-depends/rpi-tools-depends/lan951x-led-ctl/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="lan951x-led-ctl" +PKG_VERSION="1.0" +PKG_SHA256="27d607d3c5c7b142681dcd9fd0afecb7fcb052abfaffc330b28906f782e602f3" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://mockmoon-cybernetics.ch/computer/raspberry-pi/lan951x-led-ctl/" +PKG_URL="https://mockmoon-cybernetics.ch/cgi/cgit/lan951x-led-ctl.git/snapshot/lan951x-led-ctl-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain libusb" +PKG_LONGDESC="Control LEDs connected to LAN9512/LAN9514 ethernet USB controllers." +PKG_TOOLCHAIN="manual" + +make_target() { + $CC -std=c11 -I./include -Wall -Wstrict-prototypes -Wconversion \ + -Wmissing-prototypes -Wshadow -Wextra -Wunused \ + $CFLAGS -lusb-1.0 $LDFLAGS -o lan951x-led-ctl src/lan951x-led-ctl.c + + $STRIP lan951x-led-ctl +} diff --git a/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk b/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk index bb76209c44..2ea4f9ae7d 100644 --- a/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk +++ b/packages/addons/addon-depends/rpi-tools-depends/picamera/package.mk @@ -1,38 +1,13 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="picamera" -PKG_VERSION="1.10" -PKG_REV="1" +PKG_VERSION="1.13" +PKG_SHA256="890815aa01e4d855a6a95dd3ad0953b872a6b954982106407df0c5a31a163e50" PKG_ARCH="arm" PKG_LICENSE="BSD" PKG_SITE="https://github.com/waveform80/picamera" -PKG_URL="https://pypi.python.org/packages/source/p/picamera/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host bcm2835-driver" -PKG_SECTION="python" -PKG_SHORTDESC="A python and shell interface for the Raspberry Pi camera module" -PKG_LONGDESC="A python and shell interface for the Raspberry Pi camera module" -PKG_AUTORECONF="no" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host bcm2835-driver" +PKG_LONGDESC="A python and shell interface for the Raspberry Pi camera module." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/rpi_ws281x/package.mk b/packages/addons/addon-depends/rpi_ws281x/package.mk index 7e0dcb23d6..d3a183075d 100644 --- a/packages/addons/addon-depends/rpi_ws281x/package.mk +++ b/packages/addons/addon-depends/rpi_ws281x/package.mk @@ -1,40 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="rpi_ws281x" -PKG_VERSION="3e6ea50" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="" +PKG_VERSION="6c5ade9" +PKG_SHA256="e8fb94429edc21cfd894548755a417eb5b2e121329f4b54270cfb3f727696e21" +PKG_LICENSE="BSD-3c" PKG_SITE="https://github.com/hyperion-project/rpi_ws281x" PKG_URL="https://github.com/hyperion-project/rpi_ws281x/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="" -PKG_SHORTDESC="Userspace Raspberry Pi PWM library for WS281X LEDs" -PKG_LONGDESC="Userspace Raspberry Pi PWM library for WS281X LEDs" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : -} - -makeinstall_target() { - : -} +PKG_LONGDESC="Userspace Raspberry Pi PWM library for WS281X LEDs." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/rsyslog-depends/libestr/package.mk b/packages/addons/addon-depends/rsyslog-depends/libestr/package.mk index 07c4f728c5..8743942fcf 100644 --- a/packages/addons/addon-depends/rsyslog-depends/libestr/package.mk +++ b/packages/addons/addon-depends/rsyslog-depends/libestr/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libestr" PKG_VERSION="0.1.10" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="e8756b071540314abef25c044f893d6b5d249e46709329a4b3e7361403c29a1e" PKG_LICENSE="GPL" -PKG_SITE="http://libestr.adiscon.com/" -PKG_URL="http://libestr.adiscon.com/files/download/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="http://libestr.adiscon.com" +PKG_URL="https://github.com/rsyslog/libestr/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="rsyslog" -PKG_SHORTDESC="libestr: some essentials for string handling (and a bit more)" -PKG_LONGDESC="libestr: some essentials for string handling (and a bit more)" +PKG_TOOLCHAIN="autotools" +PKG_LONGDESC="Some essentials for string handling." -PKG_AUTORECONF="no" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes" diff --git a/packages/addons/addon-depends/rsyslog-depends/libfastjson/package.mk b/packages/addons/addon-depends/rsyslog-depends/libfastjson/package.mk index 5c3819c965..2f202ca63e 100644 --- a/packages/addons/addon-depends/rsyslog-depends/libfastjson/package.mk +++ b/packages/addons/addon-depends/rsyslog-depends/libfastjson/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libfastjson" -PKG_VERSION="0.99.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.99.8" +PKG_SHA256="3544c757668b4a257825b3cbc26f800f59ef3c1ff2a260f40f96b48ab1d59e07" PKG_LICENSE="GPL" -PKG_SITE="http://www.rsyslog.com/tag/libfastjson/" +PKG_SITE="http://www.rsyslog.com/tag/libfastjson" PKG_URL="http://download.rsyslog.com/libfastjson/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="rsyslog" -PKG_SHORTDESC="libfastjson" -PKG_LONGDESC="libfastjson" +PKG_LONGDESC="A fast json library for C." -PKG_AUTORECONF="no" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes" diff --git a/packages/addons/addon-depends/rsyslog-depends/liblogging/package.mk b/packages/addons/addon-depends/rsyslog-depends/liblogging/package.mk index 75bf48e285..c315fcba01 100644 --- a/packages/addons/addon-depends/rsyslog-depends/liblogging/package.mk +++ b/packages/addons/addon-depends/rsyslog-depends/liblogging/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="liblogging" -PKG_VERSION="1.0.5" -PKG_REV="100" -PKG_ARCH="any" +PKG_VERSION="1.0.6" +PKG_SHA256="338c6174e5c8652eaa34f956be3451f7491a4416ab489aef63151f802b00bf93" PKG_LICENSE="GPL" -PKG_SITE="http://www.liblogging.org/" +PKG_SITE="http://www.liblogging.org" PKG_URL="http://download.rsyslog.com/liblogging/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain systemd" -PKG_SHORTDESC="liblogging" -PKG_LONGDESC="liblogging" +PKG_LONGDESC="An easy to use and lightweight signal-safe logging library." -PKG_AUTORECONF="no" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-man-pages \ - --enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-man-pages \ ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes" diff --git a/packages/addons/addon-depends/rsyslog-depends/liblognorm/package.mk b/packages/addons/addon-depends/rsyslog-depends/liblognorm/package.mk index 03aa8fc77a..737648d68d 100644 --- a/packages/addons/addon-depends/rsyslog-depends/liblognorm/package.mk +++ b/packages/addons/addon-depends/rsyslog-depends/liblognorm/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="liblognorm" -PKG_VERSION="2.0.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.0.5" +PKG_SHA256="dd779b6992de37995555e1d54caf0716a694765efc65480eed2c713105ab46fe" PKG_LICENSE="GPL" -PKG_SITE="http://www.liblognorm.com/" -PKG_URL="http://www.liblognorm.com/files/download/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="http://www.liblognorm.com" +PKG_URL="https://github.com/rsyslog/liblognorm/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="rsyslog" -PKG_SHORTDESC="liblognorm" -PKG_LONGDESC="liblognorm" +PKG_TOOLCHAIN="autotools" +PKG_LONGDESC="A fast samples-based log normalization library." -PKG_AUTORECONF="no" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes" diff --git a/packages/addons/addon-depends/rsyslog-depends/librelp/package.mk b/packages/addons/addon-depends/rsyslog-depends/librelp/package.mk index 20a9cc9f97..55ae72d95a 100644 --- a/packages/addons/addon-depends/rsyslog-depends/librelp/package.mk +++ b/packages/addons/addon-depends/rsyslog-depends/librelp/package.mk @@ -1,37 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="librelp" -PKG_VERSION="1.2.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.2.17" +PKG_SHA256="1bf88b9decdbcaf06454ea1362455aa5ceccbcce282f07a4dc95e6911da4cbf0" PKG_LICENSE="GPL" -PKG_SITE="http://www.librelp.com/" +PKG_SITE="http://www.librelp.com" PKG_URL="http://download.rsyslog.com/librelp/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="rsyslog" -PKG_SHORTDESC="librelp" -PKG_LONGDESC="librelp" +PKG_LONGDESC="Provides reliable event logging over the network." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" -PKG_AUTORECONF="no" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-tls \ - --enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-tls \ ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes" diff --git a/packages/addons/addon-depends/runc/package.mk b/packages/addons/addon-depends/runc/package.mk index a9d5791dc4..75cf5fd170 100644 --- a/packages/addons/addon-depends/runc/package.mk +++ b/packages/addons/addon-depends/runc/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="runc" -PKG_VERSION="02f8fa7" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="96ec2177ae841256168fcf76954f7177af9446eb" +PKG_SHA256="96040a78008abad13b412863813011f4cbe55407e513acad1d8509f4ab9b39cd" PKG_LICENSE="APL" PKG_SITE="https://github.com/opencontainers/runc" PKG_URL="https://github.com/opencontainers/runc/archive/${PKG_VERSION}.tar.gz" -PKG_DEPENDS_HOST="toolchain go" -PKG_SECTION="system" -PKG_SHORTDESC="runc is a CLI tool for spawning and running containers according to the OCI specification" -PKG_LONGDESC="runc is a CLI tool for spawning and running containers according to the OCI specification" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain go:host" +PKG_LONGDESC="A CLI tool for spawning and running containers according to the OCI specification." +PKG_TOOLCHAIN="manual" pre_make_target() { case $TARGET_ARCH in @@ -43,9 +24,9 @@ pre_make_target() { arm1176jzf-s) export GOARM=6 ;; - cortex-a7) - export GOARM=7 - ;; + *) + export GOARM=7 + ;; esac ;; aarch64) @@ -57,20 +38,21 @@ pre_make_target() { export CGO_ENABLED=1 export CGO_NO_EMULATION=1 export CGO_CFLAGS=$CFLAGS - export LDFLAGS="-w -extldflags -static -X main.gitCommit=${PKG_VERSION} -extld $CC" - export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go - export GOPATH=$ROOT/$PKG_BUILD.gopath:$ROOT/$PKG_BUILD/Godeps/_workspace/ - export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export LDFLAGS="-w -extldflags -static -X main.gitCommit=${PKG_VERSION} -X main.version=$(cat ./VERSION) -extld $CC" + export GOLANG=$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$PKG_BUILD/.gopath + export GOROOT=$TOOLCHAIN/lib/golang export PATH=$PATH:$GOROOT/bin - ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/Godeps/_workspace/src/github.com/opencontainers/runc + mkdir -p $PKG_BUILD/.gopath + if [ -d $PKG_BUILD/vendor ]; then + mv $PKG_BUILD/vendor $PKG_BUILD/.gopath/src + fi + + ln -fs $PKG_BUILD $PKG_BUILD/.gopath/src/github.com/opencontainers/runc } make_target() { mkdir -p bin $GOLANG build -v -o bin/runc -a -tags "cgo static_build" -ldflags "$LDFLAGS" ./ } - -makeinstall_target() { - : -} diff --git a/packages/addons/addon-depends/runc/patches/runc-001-reenable-systemd-on-static-build.patch b/packages/addons/addon-depends/runc/patches/runc-001-reenable-systemd-on-static-build.patch new file mode 100644 index 0000000000..8122b6f660 --- /dev/null +++ b/packages/addons/addon-depends/runc/patches/runc-001-reenable-systemd-on-static-build.patch @@ -0,0 +1,20 @@ +diff --git a/libcontainer/cgroups/systemd/apply_nosystemd.go b/libcontainer/cgroups/systemd/apply_nosystemd.go +index a65d8e44..b897564c 100644 +--- a/libcontainer/cgroups/systemd/apply_nosystemd.go ++++ b/libcontainer/cgroups/systemd/apply_nosystemd.go +@@ -1,4 +1,4 @@ +-// +build !linux static_build ++// +build !linux + + package systemd + +diff --git a/libcontainer/cgroups/systemd/apply_systemd.go b/libcontainer/cgroups/systemd/apply_systemd.go +index d9d8302d..de89ccbe 100644 +--- a/libcontainer/cgroups/systemd/apply_systemd.go ++++ b/libcontainer/cgroups/systemd/apply_systemd.go +@@ -1,4 +1,4 @@ +-// +build linux,!static_build ++// +build linux + + package systemd + diff --git a/packages/addons/addon-depends/scrnsaverproto/package.mk b/packages/addons/addon-depends/scrnsaverproto/package.mk deleted file mode 100644 index 6f0bbff676..0000000000 --- a/packages/addons/addon-depends/scrnsaverproto/package.mk +++ /dev/null @@ -1,32 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="scrnsaverproto" -PKG_VERSION="1.2.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://xorg.freedesktop.org/" -PKG_URL="http://xorg.freedesktop.org/releases/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="" -PKG_LONGDESC="" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/addons/addon-depends/snapcast-depends/aixlog/package.mk b/packages/addons/addon-depends/snapcast-depends/aixlog/package.mk new file mode 100644 index 0000000000..ba427a0b72 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/aixlog/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="aixlog" +PKG_VERSION="1.2.1" +PKG_SHA256="3ed6f47b3658607edfd94faf98034d31906b0f04f3fe4355e87a16f8dd582384" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/badaix/aixlog" +PKG_URL="https://github.com/badaix/aixlog/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Header-only C++ logging library." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/snapcast-depends/alsa-plugins/package.mk b/packages/addons/addon-depends/snapcast-depends/alsa-plugins/package.mk new file mode 100644 index 0000000000..5f84136b01 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/alsa-plugins/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="alsa-plugins" +PKG_VERSION="1.1.8" +PKG_SHA256="7f77df171685ccec918268477623a39db4d9f32d5dc5e76874ef2467a2405994" +PKG_LICENSE="GPL" +PKG_SITE="http://www.alsa-project.org/" +PKG_URL="ftp://ftp.alsa-project.org/pub/plugins/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain alsa-lib" +PKG_LONGDESC="Alsa plugins." + +if [ "$PULSEAUDIO_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET pulseaudio" + SUBDIR_PULSEAUDIO="pulse" +fi + +PKG_CONFIGURE_OPTS_TARGET="--with-plugindir=/usr/lib/alsa" +PKG_MAKE_OPTS_TARGET="SUBDIRS=$SUBDIR_PULSEAUDIO" +PKG_MAKEINSTALL_OPTS_TARGET="SUBDIRS=$SUBDIR_PULSEAUDIO" diff --git a/packages/addons/addon-depends/snapcast-depends/asio/package.mk b/packages/addons/addon-depends/snapcast-depends/asio/package.mk new file mode 100644 index 0000000000..fddf1d820c --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/asio/package.mk @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="asio" +PKG_VERSION="1-12-0" +PKG_SHA256="3b3f2e38ac18f9a20a405c0852c90e8b637b7733c520829ddc80937d2ee7a5ec" +PKG_LICENSE="BSL" +PKG_SITE="http://think-async.com/Asio" +PKG_URL="https://github.com/chriskohlhoff/asio/archive/asio-$PKG_VERSION.zip" +PKG_SOURCE_DIR="asio-asio-$PKG_VERSION" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Asio C++ Library." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/snapcast-depends/popl/package.mk b/packages/addons/addon-depends/snapcast-depends/popl/package.mk new file mode 100644 index 0000000000..d8ae0c8673 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/popl/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="popl" +PKG_VERSION="1.2.0" +PKG_SHA256="dee63eed9bac3da9ec0008902c7ec72caa319461b20fc116e57e45948671a0bf" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/badaix/popl" +PKG_URL="https://github.com/badaix/popl/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Header-only C++ program options parser library." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/snapcast-depends/shairport-sync/package.mk b/packages/addons/addon-depends/snapcast-depends/shairport-sync/package.mk new file mode 100644 index 0000000000..987c2dd275 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/shairport-sync/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="shairport-sync" +PKG_VERSION="3.2" +PKG_SHA256="18e9343d4bd8ff70674ff3ecdaf7312dd90e716cac2826a4266c95e08ca305bc" +PKG_LICENSE="OSS" +PKG_SITE="https://github.com/mikebrady/shairport-sync" +PKG_URL="https://github.com/mikebrady/shairport-sync/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain alsa-lib avahi libconfig libdaemon openssl popt pulseaudio soxr" +PKG_LONGDESC="AirPlay audio player." +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_TARGET="--with-alsa \ + --with-avahi \ + --with-convolution \ + --with-metadata \ + --with-pa \ + --with-pipe \ + --with-soxr \ + --with-ssl=openssl \ + --with-stdout" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/snapcast-depends/snapcast/package.mk b/packages/addons/addon-depends/snapcast-depends/snapcast/package.mk new file mode 100644 index 0000000000..6bfb6dd7d4 --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/snapcast/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="snapcast" +PKG_VERSION="0.15.0" +PKG_SHA256="7c584fad4941a299339fe060174e33c4d810b1cbe80d6efbee54da3dafb252cc" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/badaix/snapcast" +PKG_URL="https://github.com/badaix/snapcast/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain aixlog alsa-lib asio avahi flac libvorbis popl" +PKG_LONGDESC="Synchronous multi-room audio player." +PKG_TOOLCHAIN="make" + +pre_configure_target() { + cd .. + rm -rf .$TARGET_NAME + CXXFLAGS="$CXXFLAGS -pthread \ + -I$(get_build_dir aixlog)/include \ + -I$(get_build_dir asio)/asio/include \ + -I$(get_build_dir popl)/include" +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/snapcast-depends/snapcast/patches/snapcast-01_makefiles.patch b/packages/addons/addon-depends/snapcast-depends/snapcast/patches/snapcast-01_makefiles.patch new file mode 100644 index 0000000000..2ae5c85dbd --- /dev/null +++ b/packages/addons/addon-depends/snapcast-depends/snapcast/patches/snapcast-01_makefiles.patch @@ -0,0 +1,29 @@ +--- snapcast-0.14.0/client/Makefile 2018-04-27 19:43:25.000000000 +0200 ++++ snapcast-0.14.0.makefiles/client/Makefile 2018-05-21 13:14:12.388757526 +0200 +@@ -78,10 +78,8 @@ + + else + +-CXX = g++ +-STRIP = strip + CXXFLAGS += -pthread -DHAS_VORBIS -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON +-LDFLAGS += -lrt -lasound -lvorbis -lavahi-client -lavahi-common -static-libgcc -static-libstdc++ -latomic ++LDFLAGS += -lrt -lasound -lvorbis -lavahi-client -lavahi-common -logg + OBJ += ../common/daemon.o player/alsaPlayer.o browseZeroConf/browseAvahi.o + + endif +diff -Naur snapcast-0.14.0/server/Makefile snapcast-0.14.0.makefiles/server/Makefile +--- snapcast-0.14.0/server/Makefile 2018-04-27 19:43:25.000000000 +0200 ++++ snapcast-0.14.0.makefiles/server/Makefile 2018-05-21 13:14:56.881206277 +0200 +@@ -84,10 +84,8 @@ + + else + +-CXX = g++ +-STRIP = strip + CXXFLAGS += -DHAS_AVAHI -DHAS_DAEMON -pthread +-LDFLAGS += -lrt -lavahi-client -lavahi-common -static-libgcc -static-libstdc++ ++LDFLAGS += -lrt -lavahi-client -lavahi-common -logg + OBJ += ../common/daemon.o publishZeroConf/publishAvahi.o + + endif diff --git a/packages/addons/addon-depends/system-tools-depends/autossh/package.mk b/packages/addons/addon-depends/system-tools-depends/autossh/package.mk index de6e249d5a..522a417bd5 100644 --- a/packages/addons/addon-depends/system-tools-depends/autossh/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/autossh/package.mk @@ -1,41 +1,23 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="autossh" -PKG_VERSION="1.4e" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.4g" +PKG_SHA256="5fc3cee3361ca1615af862364c480593171d0c54ec156de79fc421e31ae21277" PKG_LICENSE="GPL" PKG_SITE="http://www.harding.motd.ca/" -PKG_URL="http://www.harding.motd.ca/autossh/${PKG_NAME}-${PKG_VERSION}.tgz" +PKG_URL="http://www.harding.motd.ca/autossh/autossh-${PKG_VERSION}.tgz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="ssh tool" -PKG_LONGDESC="SSH tool to keep alive tunnels" -PKG_AUTORECONF="yes" +PKG_LONGDESC="Automatically restart SSH sessions and tunnels." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes" - + pre_configure_target() { export CFLAGS="$CFLAGS -I." } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk b/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk index 273297d91c..e574cf0285 100644 --- a/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/depends/efivar/package.mk @@ -1,42 +1,22 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="efivar" -PKG_VERSION="70e63d4" # 0.15 # Todo: later versions with buildproblems -PKG_REV="0" +PKG_VERSION="3e687d8072f3ed53ae727ec2cb99ae56dbcdf02b" +PKG_SHA256="810d386c9f4dafc160c721ef73e491c933c311e3df768e27eec50c28ac0f4d97" PKG_ARCH="x86_64" PKG_LICENSE="LGPL" -PKG_SITE="https://github.com/vathpela/efivar" -PKG_URL="https://github.com/vathpela/efivar-devel/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="efivar-devel-$PKG_VERSION*" +PKG_SITE="https://github.com/rhboot/efivar" +PKG_URL="https://github.com/rhboot/efivar/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain efivar:host" -PKG_SECTION="tools" -PKG_SHORTDESC="evivar: maniulate EFI Variables" PKG_LONGDESC="Tools and library to manipulate EFI variables." -PKG_AUTORECONF="no" make_host() { - make -C src/ makeguids + make -C src/ include/efivar/efivar-guids.h } make_target() { - strip_lto - make -C src/ libefivar.a efivar-guids.h efivar.h + make -C src/ libefivar.a libefiboot.a efivar.h efivar } makeinstall_host() { @@ -45,10 +25,8 @@ makeinstall_host() { makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/lib - cp -P src/libefivar.a $SYSROOT_PREFIX/usr/lib/ + cp -P src/libefivar.a src/libefiboot.a $SYSROOT_PREFIX/usr/lib/ mkdir -p $SYSROOT_PREFIX/usr/include/efivar - cp -P src/efivar.h $SYSROOT_PREFIX/usr/include/efivar - cp -P src/efivar-guids.h $SYSROOT_PREFIX/usr/include/efivar + cp -P src/include/efivar/*.h $SYSROOT_PREFIX/usr/include/efivar } - diff --git a/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-01-static_lib.patch b/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-01-static_lib.patch new file mode 100644 index 0000000000..5abebf9593 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-01-static_lib.patch @@ -0,0 +1,11 @@ +--- a/src/Makefile 2018-10-01 21:30:06.000000000 +0200 ++++ b/src/Makefile 2018-10-17 14:16:46.000000000 +0200 +@@ -69,7 +69,7 @@ libefivar.so : | $(GENERATED_SOURCES) li + libefivar.so : LIBS=dl + libefivar.so : MAP=libefivar.map + +-efivar : efivar.c | libefivar.so ++efivar : efivar.c | libefivar.a + efivar : LIBS=efivar dl + + efivar-static : efivar.c $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) diff --git a/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-makeguids-allocate-fix.patch b/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-makeguids-allocate-fix.patch deleted file mode 100644 index e6716c923b..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/depends/efivar/patches/efivar-makeguids-allocate-fix.patch +++ /dev/null @@ -1,32 +0,0 @@ -fix for - -./makeguids guids.txt guids.bin names.bin guid-symbols.S efivar-guids.h -makeguids: malloc.c:2395: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. - ---- a/src/makeguids.c 2014-10-15 06:48:49.000000000 -0700 -+++ b/src/makeguids.c 2016-05-05 05:40:35.964612900 -0700 -@@ -99,10 +99,8 @@ - if (rc < 0) - err(1, "makeguids: could not read \"%s\"", argv[1]); - -- /* strictly speaking, this *has* to be too large. */ -- struct guidname *outbuf = calloc(inlen, sizeof (char)); -- if (!outbuf) -- err(1, "makeguids"); -+ /* reallocate later to required size */ -+ struct guidname *outbuf = NULL; - - char *guidstr = inbuf; - unsigned int line; -@@ -133,6 +131,11 @@ - err(1, "makeguids: \"%s\": 4 invalid data on line %d", - argv[1], line); - -+ outbuf = realloc(outbuf, line * sizeof (struct guidname)); -+ if (!outbuf) -+ err(1, "makeguids"); -+ -+ bzero(&outbuf[line-1], sizeof (struct guidname)); - memcpy(&outbuf[line-1].guid, &guid, sizeof(guid)); - strcpy(outbuf[line-1].symbol, "efi_guid_"); - strncat(outbuf[line-1].symbol, symbol, diff --git a/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk b/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk index d17ca0400c..ee21f87939 100644 --- a/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/depends/libmtp/package.mk @@ -1,33 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libmtp" -PKG_VERSION="1.1.11" -PKG_REV="3" -PKG_ARCH="any" +PKG_VERSION="1.1.13" +PKG_SHA256="494ee02fbfbc316aad75b93263dac00f02a4899f28cfda1decbbd6e26fda6d40" PKG_LICENSE="GPL" PKG_SITE="http://libmtp.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/project/$PKG_NAME/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libusb" -PKG_SECTION="libs" -PKG_SHORTDESC="MTP library" -PKG_LONGDESC="libmtp is an Initiator implementation of the Media Transfer Protocol (MTP) in the form of a library suitable primarily for POSIX compliant operating systems. We implement MTP Basic, the stuff proposed for standardization." -PKG_AUTORECONF="yes" +PKG_LONGDESC="An Initiator implementation of the Media Transfer Protocol (MTP)." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ --disable-shared \ diff --git a/packages/addons/addon-depends/system-tools-depends/depends/libssh2/package.mk b/packages/addons/addon-depends/system-tools-depends/depends/libssh2/package.mk new file mode 100644 index 0000000000..d3f97a08ce --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/libssh2/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libssh2" +PKG_VERSION="1.8.0" +PKG_SHA256="39f34e2f6835f4b992cafe8625073a88e5a28ba78f83e8099610a7b3af4676d4" +PKG_LICENSE="BSD" +PKG_SITE="https://www.libssh2.org" +PKG_URL="https://www.libssh2.org/download/libssh2-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain openssl" +PKG_LONGDESC="A library implementing the SSH2 protocol" +PKG_BUILD_FLAGS="+pic" + +PKG_CMAKE_OPTS_TARGET="-DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF" diff --git a/packages/addons/addon-depends/system-tools-depends/depends/oniguruma/package.mk b/packages/addons/addon-depends/system-tools-depends/depends/oniguruma/package.mk new file mode 100644 index 0000000000..1aecc71002 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/depends/oniguruma/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="oniguruma" +PKG_VERSION="6.9.1" +PKG_SHA256="c7c3feb7be45a5cc9f2dec239b4a317a422e6ffea299cf91ffab1b926633ea12" +PKG_LICENSE="BSD" +PKG_SITE="https://github.com/kkos/oniguruma" +PKG_URL="https://github.com/kkos/oniguruma/releases/download/v$PKG_VERSION/onig-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A regular expression library" diff --git a/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk b/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk index 47b47c3bb6..03aa793123 100644 --- a/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/diffutils/package.mk @@ -1,33 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="diffutils" -PKG_VERSION="3.5" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="3.6" +PKG_SHA256="d621e8bdd4b573918c8145f7ae61817d1be9deb4c8d2328a65cea8e11d783bd6" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/diffutils/" PKG_URL="http://ftpmirror.gnu.org/diffutils/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="GNU Diffutils" -PKG_LONGDESC="GNU Diffutils is a package of several programs related to finding differences between files." -PKG_AUTORECONF="no" +PKG_LONGDESC="A package of several programs related to finding differences between files." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ --without-libsigsegv-prefix \ diff --git a/packages/addons/addon-depends/system-tools-depends/diffutils/patches/diffutils-001-no-man.patch b/packages/addons/addon-depends/system-tools-depends/diffutils/patches/diffutils-001-no-man.patch new file mode 100644 index 0000000000..297d01496e --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/diffutils/patches/diffutils-001-no-man.patch @@ -0,0 +1,11 @@ +--- diffutils-3.5/Makefile.am.org 2017-05-24 18:54:09.404508347 +0200 ++++ diffutils-3.5/Makefile.am 2017-05-24 18:46:25.238456499 +0200 +@@ -19,7 +19,7 @@ + ALL_RECURSIVE_TARGETS = + + EXTRA_DIST = bootstrap exgettext ChangeLog-2008 cfg.mk dist-check.mk +-SUBDIRS = lib src tests doc man po gnulib-tests ++SUBDIRS = lib src tests doc po gnulib-tests + + ACLOCAL_AMFLAGS = -I m4 + AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) diff --git a/packages/addons/addon-depends/system-tools-depends/diffutils/patches/diffutils-002-explicitly-disable-replacing-getopt.patch b/packages/addons/addon-depends/system-tools-depends/diffutils/patches/diffutils-002-explicitly-disable-replacing-getopt.patch new file mode 100644 index 0000000000..6e12ba86e3 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/diffutils/patches/diffutils-002-explicitly-disable-replacing-getopt.patch @@ -0,0 +1,26 @@ +http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-extended/diffutils/diffutils-3.6 + +Subject: explicitly disable replacing getopt + +Explicitly disable replacing getopt to avoid compilation error like below. + + xstrtol-error.c:84:26: error: invalid use of undefined type 'struct rpl_option' + +diff --git a/m4/getopt.m4 b/m4/getopt.m4 +index 3ebc7b7..8934426 100644 +--- a/m4/getopt.m4 ++++ b/m4/getopt.m4 +@@ -22,8 +22,8 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX], + fi + ]) + if test $REPLACE_GETOPT = 1; then +- dnl Arrange for getopt.h to be created. +- gl_GETOPT_SUBSTITUTE_HEADER ++ dnl Explicitly disable replacing getopt ++ : + fi + ]) + +-- +2.11.0 + diff --git a/packages/addons/addon-depends/system-tools-depends/dstat/package.mk b/packages/addons/addon-depends/system-tools-depends/dstat/package.mk new file mode 100644 index 0000000000..25a0becd7a --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/dstat/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="dstat" +PKG_VERSION="77e9347" +PKG_SHA256="2b2f4ef3a0d1dc6d0a4bc2f54a57ba6f1e278333881a07df7e55aec502a48c7c" +PKG_LICENSE="GPL" +PKG_SITE="http://dag.wiee.rs/home-made/dstat" +PKG_URL="https://github.com/dagwieers/dstat/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2" +PKG_LONGDESC="Versatile resource statistics tool." +PKG_TOOLCHAIN="manual" + +post_unpack() { +rm $PKG_BUILD/Makefile +} diff --git a/packages/addons/addon-depends/system-tools-depends/dtach/package.mk b/packages/addons/addon-depends/system-tools-depends/dtach/package.mk index 67c7ffd805..2b762cb7d1 100644 --- a/packages/addons/addon-depends/system-tools-depends/dtach/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/dtach/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dtach" -PKG_VERSION="0.8" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="0.9" +PKG_SHA256="5f7e8c835ee49a9e6dcf89f4e8ccbe724b061c0fc8565b504dd8b3e67ab79f82" PKG_LICENSE="GPL" PKG_SITE="http://dtach.sourceforge.net" -PKG_URL="http://download.sourceforge.net/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/crigler/dtach/archive/v${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="dtach - A program that emulates the detach feature of screen" -PKG_LONGDESC="dtach - A program that emulates the detach feature of screen" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-nls" +PKG_LONGDESC="A program that emulates the detach feature of screen." makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk b/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk index cd19da653d..6f49c8f8d7 100644 --- a/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/efibootmgr/package.mk @@ -1,39 +1,23 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="efibootmgr" -PKG_VERSION="95f7a63" # 0.8.0 -PKG_REV="1" +PKG_VERSION="99b578501643377e0b1994b2a068b790d189d5ad" +PKG_SHA256="04bc45dc8a841985d78d8df87b3475eb6e1122f993fae975197bf3adbc6e3341" PKG_ARCH="x86_64" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/vathpela/efibootmgr" -PKG_URL="https://github.com/vathpela/efibootmgr-devel/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="efibootmgr-devel-$PKG_VERSION*" +PKG_SITE="https://github.com/rhboot/efibootmgr" +PKG_URL="https://github.com/rhboot/efibootmgr/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain efivar pciutils zlib" -PKG_SECTION="tools" -PKG_SHORTDESC="EFI Boot Manager" -PKG_LONGDESC="This is a Linux user-space application to modify the Intel Extensible Firmware Interface (EFI) Boot Manager configuration. This application can create and destroy boot entries, change the boot order, change the next running boot option, and more." -PKG_AUTORECONF="no" +PKG_LONGDESC="Tool to modify UEFI Firmware Boot Manager Variables." -pre_make_target() { - strip_lto - export EXTRA_CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include -I$SYSROOT_PREFIX/usr/include/efivar -fgnu89-inline" +make_target() { + export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include -I$SYSROOT_PREFIX/usr/include/efivar -fgnu89-inline" export LDFLAGS="$LDFLAGS -L$SYSROOT_PREFIX/usr/lib -ludev -ldl" + + make EFIDIR=BOOT EFI_LOADER=bootx64.efi PKG_CONFIG=true \ + LDLIBS="-lefiboot -lefivar" \ + efibootmgr } makeinstall_target() { diff --git a/packages/addons/addon-depends/system-tools-depends/efibootmgr/patches/efibootmgr-kernel-4.4.patch b/packages/addons/addon-depends/system-tools-depends/efibootmgr/patches/efibootmgr-kernel-4.4.patch deleted file mode 100644 index f6f75037d7..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/efibootmgr/patches/efibootmgr-kernel-4.4.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur efibootmgr-ceb177a/src/lib/scsi_ioctls.c efibootmgr-ceb177a.patch/src/lib/scsi_ioctls.c ---- efibootmgr-ceb177a/src/lib/scsi_ioctls.c 2014-10-21 22:17:27.000000000 +0200 -+++ efibootmgr-ceb177a.patch/src/lib/scsi_ioctls.c 2016-03-26 13:49:59.119669675 +0100 -@@ -24,7 +24,7 @@ - #include - #include - #include --#include -+#include - #include "scsi_ioctls.h" - - int diff --git a/packages/addons/addon-depends/system-tools-depends/encfs/package.mk b/packages/addons/addon-depends/system-tools-depends/encfs/package.mk new file mode 100644 index 0000000000..2914c69938 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/encfs/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="encfs" +PKG_VERSION="1.9.5" +PKG_SHA256="4709f05395ccbad6c0a5b40a4619d60aafe3473b1a79bafb3aa700b1f756fd63" +PKG_LICENSE="LGPL" +PKG_SITE="https://vgough.github.io/encfs/" +PKG_URL="https://github.com/vgough/encfs/releases/download/v$PKG_VERSION/encfs-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain fuse" +PKG_LONGDESC="A Encrypted Filesystem for FUSE." + +PKG_CMAKE_OPTS_TARGET="-DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=$SYSROOT_PREFIX/usr/include \ + -DBUILD_UNIT_TESTS=OFF" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/system-tools-depends/evtest/package.mk b/packages/addons/addon-depends/system-tools-depends/evtest/package.mk index ea82aebb57..ac303fc8ef 100644 --- a/packages/addons/addon-depends/system-tools-depends/evtest/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/evtest/package.mk @@ -1,33 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="evtest" PKG_VERSION="1.33" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="5037d1162f4c407053cd97e85763ba03150a0c35f929ee9bf9a360abd32ef1c1" PKG_LICENSE="GPL" PKG_SITE="http://cgit.freedesktop.org/evtest/" PKG_URL="http://cgit.freedesktop.org/evtest/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libxml2" -PKG_SECTION="debug/tools" -PKG_SHORTDESC="evtest: Simple tool for input event debugging." -PKG_LONGDESC="evtest is a simple tool for input event debugging." -PKG_AUTORECONF="yes" +PKG_LONGDESC="A simple tool for input event debugging." +PKG_TOOLCHAIN="autotools" makeinstall_target() { : # nop diff --git a/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk b/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk index 9993e1462a..f0aae4d163 100644 --- a/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/fdupes/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="fdupes" -PKG_VERSION="1.51" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="1.6.1" +PKG_SHA256="9d6b6fdb0b8419815b4df3bdfd0aebc135b8276c90bbbe78ebe6af0b88ba49ea" PKG_LICENSE="GPL" PKG_SITE="http://premium.caribe.net/~adrian2/fdupes.html" -PKG_URL="https://fdupes.googlecode.com/files/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/adrianlopezroche/fdupes/archive/v${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="FDUPES is a program for identifying or deleting duplicate files residing within specified directories" -PKG_LONGDESC="FDUPES is a program for identifying or deleting duplicate files residing within specified directories" -PKG_AUTORECONF="no" +PKG_LONGDESC="A program for identifying or deleting duplicate files residing within specified directories." makeinstall_target() { : # nop diff --git a/packages/addons/addon-depends/system-tools-depends/fdupes/patches/fdupes-01-crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/fdupes/patches/fdupes-01-crosscompile.patch deleted file mode 100644 index e9f780d796..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/fdupes/patches/fdupes-01-crosscompile.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/Makefile b/Makefile -index 1d5e41a..6dc6da4 100644 ---- a/Makefile -+++ b/Makefile -@@ -71,7 +71,6 @@ MKDIR = mkdir -p - # - # Make Configuration - # --CC = gcc - COMPILER_OPTIONS = -Wall -O -g - - CFLAGS= $(COMPILER_OPTIONS) -I. -DVERSION=\"$(VERSION)\" $(EXTERNAL_MD5) $(EXPERIMENTAL_RBTREE) $(OMIT_GETOPT_LONG) diff --git a/packages/addons/addon-depends/system-tools-depends/file/package.mk b/packages/addons/addon-depends/system-tools-depends/file/package.mk index 6e68c1deeb..67dcd70032 100644 --- a/packages/addons/addon-depends/system-tools-depends/file/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/file/package.mk @@ -1,38 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="file" -PKG_VERSION="5.29" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="d1ff3af7a2c6b38bdbdde7af26b59e3c50a48fff" +PKG_SHA256="acc16f878576ad0bb29bbb7c724e29d2827f14ddb39fe94d76c3a859d4a3d0d9" PKG_LICENSE="BSD" PKG_SITE="http://www.darwinsys.com/file/" -PKG_URL="ftp://ftp.astron.com/pub/file/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/file/file/archive/${PKG_VERSION}.tar.gz" PKG_DEPENDS_HOST="ccache:host" -PKG_DEPENDS_TARGET="toolchain zlib file:host" -PKG_SECTION="tools" -PKG_SHORTDESC="file: File type identification utility" -PKG_LONGDESC="These are the sources to Darwin's file(1) utility and master magic(4) file, now maintained by Christos Zoulas. The file(1) utility is used to determine the types of various files." -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain file:host zlib" +PKG_LONGDESC="The file utility is used to determine the types of various files." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_HOST="--enable-fsect-man5 --enable-static --disable-shared" PKG_CONFIGURE_OPTS_TARGET="--enable-fsect-man5 --enable-static --disable-shared" makeinstall_target() { - : # meh + : } diff --git a/packages/addons/addon-depends/system-tools-depends/file/patches/file-fix-segfault-in-magic_close.patch b/packages/addons/addon-depends/system-tools-depends/file/patches/file-fix-segfault-in-magic_close.patch deleted file mode 100644 index 25b0f1bb21..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/file/patches/file-fix-segfault-in-magic_close.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/apprentice.c b/src/apprentice.c -index 961e83d..b7d500c 100644 ---- a/src/apprentice.c -+++ b/src/apprentice.c -@@ -348,11 +348,9 @@ apprentice_1(struct magic_set *ms, const char *fn, int action) - protected void - file_ms_free(struct magic_set *ms) - { -- size_t i; - if (ms == NULL) - return; -- for (i = 0; i < MAGIC_SETS; i++) -- mlist_free(ms->mlist[i]); -+ mlist_free(ms->mlist[0]); - free(ms->o.pbuf); - free(ms->o.buf); - free(ms->c.li); diff --git a/packages/addons/addon-depends/system-tools-depends/file/patches/file-zip.patch b/packages/addons/addon-depends/system-tools-depends/file/patches/file-zip.patch deleted file mode 100644 index f16e3126e9..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/file/patches/file-zip.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e990dc53f658cb67ec7b33c32e0bc24e65801792 Mon Sep 17 00:00:00 2001 -From: Christos Zoulas -Date: Sat, 14 May 2011 15:04:15 +0000 -Subject: [PATCH] small archive - ---- - magic/Magdir/archive | 5 ++++- - 1 files changed, 4 insertions(+), 1 deletions(-) - -diff --git a/magic/Magdir/archive b/magic/Magdir/archive -index e84c8e3..5ad1ce3 100644 ---- a/magic/Magdir/archive -+++ b/magic/Magdir/archive -@@ -654,6 +654,9 @@ - >>>>78 string -template Template - !:mime application/vnd.oasis.opendocument.image-template - -+>26 byte x Zip archive data -+ -+ - # StarView Metafile - # From Pierre Ducroquet - 0 string VCLMTF StarView MetaFile --- -1.7.4.1 - diff --git a/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk b/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk index df804f135e..98de97ea41 100644 --- a/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/getscancodes/package.mk @@ -1,34 +1,18 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="getscancodes" PKG_VERSION="1.0" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="5f4e2ab22dc3890392ab8870fb79bbebdfd39b34dcd5bafcb51edee554855d34" PKG_LICENSE="GPL" PKG_SITE="http://keytouch.sourceforge.net" PKG_URL="$SOURCEFORGE_SRC/keytouch/getscancodes-${PKG_VERSION}.tar.gz" -PKG_SOURCE_DIR="$PKG_NAME" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="Shows the scancode of the pressed or released key" -PKG_LONGDESC="Shows the scancode of the pressed or released key" -PKG_AUTORECONF="no" +PKG_LONGDESC="Shows the scancode of the pressed or released key." + +pre_configure_target() { + PKG_MAKE_OPTS_TARGET="CC=$CC" +} makeinstall_target() { : # nop diff --git a/packages/addons/addon-depends/system-tools-depends/getscancodes/patches/getscancodes-crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/getscancodes/patches/getscancodes-crosscompile.patch deleted file mode 100644 index a830cbd1e3..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/getscancodes/patches/getscancodes-crosscompile.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 06c160f28cceb32be4c8fcead3f33691a2469464 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Thu, 21 Nov 2013 23:29:07 +0200 -Subject: [PATCH] crosscompile - ---- - Makefile | 1 - - 1 files changed, 0 insertions(+), 1 deletions(-) - -diff --git a/Makefile b/Makefile -index 86ab501..355fb3d 100644 ---- a/Makefile -+++ b/Makefile -@@ -2,7 +2,6 @@ TARGET = getscancodes - SOURCES = getscancodes.c - - CFLAGS=-O2 -Wall --CC=gcc - - OBJECTS=$(SOURCES:.c=.o) - --- -1.7.2.5 - diff --git a/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk b/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk index dac98e358d..2f2e8286fe 100644 --- a/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/hd-idle/package.mk @@ -1,31 +1,11 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="hd-idle" -PKG_VERSION="1.04" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="1.05" +PKG_SHA256="4efefe79d145b50e055582730d9d685e485da3df3dad90fef030036d52aa3a0c" PKG_LICENSE="GPL" PKG_SITE="http://hd-idle.sourceforge.net/" PKG_URL="http://downloads.sourceforge.net/project/hd-idle/${PKG_NAME}-${PKG_VERSION}.tgz" -PKG_SOURCE_DIR="$PKG_NAME" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="hd-idle is a [Linux] utility program for spinning-down external disks after a period of idle time." -PKG_LONGDESC="hd-idle is a utility program for spinning-down external disks after a period of idle time. Since most external IDE disk enclosures don't support setting the IDE idle timer, a program like hd-idle is required to spin down idle disks automatically." -PKG_AUTORECONF="no" +PKG_LONGDESC="A utility for spinning-down external disks after a period of idle time." diff --git a/packages/addons/addon-depends/system-tools-depends/hddtemp/db/hddtemp.db b/packages/addons/addon-depends/system-tools-depends/hddtemp/db/hddtemp.db new file mode 100644 index 0000000000..4a061cfcb6 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/hddtemp/db/hddtemp.db @@ -0,0 +1,523 @@ +# +# Insert a regular expression for support of the model or the serie of your hard drive. +# If you don't know what to put in the second field, put the number +# that appears most often for your brand :o) +# A value of zero meens that we know that the drive doesn't have +# a temperature sensor (you can set the unit to C or F). +# +############################################################################ +# The following list was found at (http://www.almico.com/forumharddisks.php) +# If your drive is in the list send me a mail. +# +# Manufacturer Model Size Notes +# FUJITSU FUJITSU MPF3102AH 10.0GB +# FUJITSU FUJITSU MPG3204AH E 20.0GB +# FUJITSU FUJITSU MPG3307AT 30.0GB +# FUJITSU FUJITSU MPG3409AH 40.0GB +# FUJITSU FUJITSU MPG3409AH EF 40.0GB +# HITACHI HITACHI_DK23CA-10 9.8GB +# HITACHI HITACHI_DK23CA-15 14.7GB +# SAMSUNG SAMSUNG SV3012H 29.4GB +# SEAGATE ST310210A 10.0GB +# SEAGATE ST310211A 9.8GB +# SEAGATE ST310215A 10.0GB +# SEAGATE ST315320A 14.9GB +# SEAGATE ST320410A 19.6GB +# SEAGATE ST320413A 19.6GB +# SEAGATE ST320420A 19.9GB +# SEAGATE ST330610A 29.3GB +# SEAGATE ST330620A 29.3GB +# SEAGATE ST330621A 29.3GB +# SEAGATE ST330630A 29.9GB +# SEAGATE ST340016A 39.1GB +# SEAGATE ST340810ACE 39.1GB +# SEAGATE ST380020ACE 78.2GB +# WESTERN DIGITAL WDC AC210200D 10.0GB +# WESTERN DIGITAL WDC AC29100D 8.9GB +# WESTERN DIGITAL WDC AC420400D 19.9GB +# WESTERN DIGITAL WDC WD102AA 10.0GB +# +################################################# + +######################################## +############# ExcelStor drives +######################################## +# "ExcelStor Technology CT215" ??? ? "ExcelStor CT215" +"ExcelStor Technology J3.0" 194 C "ExcelStor Technology 3xy (xy GB)" +"ExcelStor Technology J6.0" 194 C "ExcelStor Technology 6xy (xy GB)" +"ExcelStor Technology J680" 194 C "ExcelStor Technology J680 (80 GB)" +"ExcelStor Technology J860" 194 C "ExcelStor Technology J860 (60 GB)" +"ExcelStor Technology J880" 194 C "ExcelStor Technology J880 (80 GB)" + + + +######################################## +############# Fujitsu drives +######################################## +"FUJITSU MHM2100AT" 0 C "Fujitsu MHM2100AT" + +"FUJITSU MHN2150AT" 194 C "Fujitsu MHN2150AT" +"FUJITSU MHN2200AT" 194 C "Fujitsu MHN2200AT" +"FUJITSU MHN2300AT" 194 C "Fujitsu MHN2300AT" + +"FUJITSU MHR2020AT" 194 C "Fujitsu MHR2020AT" +"FUJITSU MHR2030AT" 194 C "Fujitsu MHR2030AT" + +"FUJITSU MHS2030AT" 194 C "Fujitsu MHS2030AT" +"FUJITSU MHS2040AT" 194 C "Fujitsu MHS2040AT" +"FUJITSU MHS2060AT" 194 C "Fujitsu MHS2060AT (Apple PowerBook G4)" + +"FUJITSU MHT2030AC" 194 C "Fujitsu Mobile 30GB, 2MB, 4200RPM (automotive)" + +"FUJITSU MHT2030AT" 194 C "Fujitsu MHT2030AT" +"FUJITSU MHT2040AH" 194 C "Fujitsu MHT2040AH" +"FUJITSU MHT2040AT" 194 C "Fujitsu MHT2040AT" +"FUJITSU MHT2060AH" 194 C "Fujitsu MHT2060AH" +"FUJITSU MHT2060AT" 194 C "Fujitsu MHT2060AT" +"FUJITSU MHT2080AH" 194 C "Fujitsu MHT2080AH" + +"FUJITSU MHU2100AT" 194 C "Fujitsu MHU2100AT 100GB, 8MB (4200RPM)" + +"FUJITSU MHV2100AH" 194 C "FUJITSU MHV2100AH" +"FUJITSU MHV2100AT" 194 C "FUJITSU MHV2100AT" +"FUJITSU MHV2080[AB]H" 194 C "FUJITSU MHV2080AH" + +"FUJITSU MPF3204AH" 194 C "Fujitsu MPF3204AH" + +"FUJITSU MPG3204AT.*" 194 C "Fujitsu MPG3204AT" +"FUJITSU MPG3307AT" 194 C "Fujitsu MPG3307AT" +"FUJITSU MPG3409AT.*" 194 C "Fujitsu MPG3409AT E" +"FUJITSU MPG3409AH.*" 194 C "Fujitsu MPG3409AH E" +"FUJITSU MPG3204AH" 194 C "Fujitsu MPG3204AH" +"FUJITSU MPG3102AT E" 194 C "FUJITSU MPG3102AT E" + + + +######################################## +############# Hitachi drives +######################################## +"HITACHI_DK13FA-40B" 194 C "Hitachi DK13FA-40B" +"HITACHI_DK228A-65" 0 C "Hitachi DK228A-65" +"HITACHI_DK23CA-(15|20|30|30B|75)" 194 C "Hitachi DK23CA series" +"HITACHI_DK23DA-[234]0" 194 C "Hitachi DK23DA series" +"HITACHI_DK23EA-[2346]0" 194 C "Hitachi DK23EA series" +"HITACHI_DK23EB-40" 194 C "Hitachi DK23EB series" +"HITACHI_DK23FA-[468]0" 194 C "Hitachi DK23FA series" +"HITACHI_DK23FB-[46]0" 194 C "Hitachi DK23FB series" + +"HDS722516VLAT[28]0" 194 C "Hitachi Deskstar 7K250 160GB 2/8MB cache" +"HDS722525VLAT80" 194 C "Hitachi Deskstar 7K250 200/250GB, 7200RPM, 8MB, Parallel-ATA" +"HDS722512VLAT80" 194 C "Hitachi Deskstar 7K250 80GB" +"HDS722540VLAT20" 194 C "Hitachi Deskstar 7K250, 40GB, 7200RPM, 2MB cache" +"HDS722580VLAT20" 194 C "Deskstar 7K250 60GB" +"HDS724040KLSA80" 194 C "Hitachi Deskstar 7K250 400GB, 7200RPM, 8MB, Serial-ATA" +"HDS728080PLAT20" 194 C "Hitachi Deskstar 7K80 80GB" + +"HDS722525VLSA80" 194 C "Hitachi Deskstar 7K250 250GB, 7200RPM, 8MB, SATA" +"HDS722516VLSA80" 194 C "Hitachi Deskstar 7K250 160GB 8Mo cache SATA" +"HDS722580VLSA80" 194 C "Hitachi Deskstar 7K250 80GB SATA" +"HDS728040PLAT20" 194 C "Hitachi Deskstar 7K80 40GB" + +"HDS724040KLAT80" 194 C "Hitachi Deskstar 7K400 400GB 8Mo cache PATA" + +"HDT7225(16|25)DLAT80" 194 C "Hitachi Deskstar T7K250 series, 7200RPM, 8MB, PATA" +"HDT722516DLA380 V43O" 194 C "Hitachi T7K250 SATA" +"HDT722525DLA380" 194 C "Hitachi Deskstar T7K250 250GB 8Mo cache SATAII" +"HDT725050VLA360" 194 C "Hitachi Deskstar T7K500 500GB, 7200RPM, 16MB, SATA II" + +"HTE721010G9AT00" 194 C "Hitachi Travelstar 100GB (7200RPM)" +"HTE726060M9AT00" 194 C "Hitachi Travelstar 60GB (7200RPM)" +"HTS424030M9AT00" 194 C "Hitachi Travelstar 30GB (4200RPM)" +"HTS424040M9AT00" 194 C "Hitachi Travelstar 4K40 40GB 2MB cache (4200RPM)" +"HTS541010G9SA00" 194 C "Hitachi Travelstar 100GB SATA" +"HTS541040G9AT00" 194 C "Hitachi Travelstar 40GB (5400RPM)" +"HTS541080G9AT00" 194 C "Hitachi Travelstar 80GB (5400RPM)" +"HTS548020M9AT00" 194 C "Hitachi Travelstar 20GB (5400RPM)" +"HTS548030M9AT00" 194 C "Hitachi Travelstar 30GB (5400RPM)" +"HTS548040M9AT00" 194 C "Hitachi Travelstar 40GB (5400RPM)" +"HTS548060M9AT00" 194 C "Hitachi Travelstar 60GB (5400RPM)" +"HTS548080M9AT00" 194 C "Hitachi Travelstar 80GB (5400RPM)" +"HTS721080G9AT00" 194 C "Hitachi Travelstar 7K100 80GB (7200RPM)" +"HTS726060M9AT00" 194 C "Hitachi Travelstar 60GB" + + +######################################## +############# IBM drives +######################################## + +# DJSA serie is using F0h command to report temperature and also have +# SMART capabilties but it was reported not to work. +# "DJSA-2(30|32|10|20|05)" 0 C "IBM Travelstar 20GN, 32GH, 30GT series" + +"IBM-DARA-212000" 0 C "IBM Travelstar 12GN" +"IBM-DTTA-35*" 0 C "IBM Deskstar 16GP serie" + +# according to specifications they do not seems to have sensor +# but I prefer waiting for a report +#"IBM-DTTA-37*" 0 C "IBM Deskstar 14GXP serie" + +"IBM-DJNA-35.*" 231 C "IBM Deskstar 25 GP serie" +"IBM-DJNA-37.*" 231 C "IBM Deskstar 22 GXP serie" +"IBM-DHEA-(34330|36480)" 0 C "IBM Deskstar 5 serie" +"IBM-DHEA-(34331|36481|38451)" 0 C "IBM Deskstar 8 serie" +"IBM-DPTA-37.*" 231 C "IBM Deskstar 34GXP serie" +"IBM-DPTA-35.*" 231 C "IBM Deskstar 37GP serie" +"IBM-DTLA-30[57]0[123467][05]" 194 C "IBM Deskstar 40GV & 75GXP series" +"IC25N0[1234]0ATCS04-0" 194 C "IBM Travelstar 40GN serie" +"IC25N0[24]0ATC[SX]05-0" 194 C "IBM Travelstar 40GNX serie" +"IC25N0(10|15|20|30)ATDA04-0" 194 C "IBM Travelstar 30GN serie" +"IC25N0[23468]0ATMR04*" 194 C "Hitachi Travelstar 80GN" +"IC25T048ATDA05-0" 194 C "IBM Travelstar 48GH serie" +"IC25T060ATC[SX]05-0" 194 C "IBM Travelstar 60GH serie" +"IC35L0[12346]0AVER07" 194 C "IBM Deskstar 60GXP serie" +"IC35L[01][02468]0AVV[AN]07*" 194 C "IBM Deskstar 120GXP serie" +"IC35L[01][23689]0AVV207*" 194 C "IBM Deskstar 180GXP serie" + +######################################## +############# Maxtor drives +######################################## +#"Maxtor 2B0[012][04568]H1" ??? C "Maxtor Fireball 541DX" +"Maxtor 2F0[234]0[LJ]0" 194 C "Maxtor Fireball 3" +# which one must I trust ? +#"Maxtor 4D040H2" 9 C "Maxtor DiamondMax D540X-4D" +#"Maxtor 4D040H2" 0 C "Maxtor 4D040H2" +#"Maxtor 4D080H4" 12 C "Maxtor DiamondMax D540X-4D" +#"Maxtor 4D060H3" 12 C "Maxtor DiamondMax D540X-4D" +#"Maxtor 4D080H4" 9 C "Maxtor DiamondMax D540X-4D" +"MAXTOR 4K0[468]0H[234]" 194 C "Maxtor DiamondMax D540X serie" +"MAXTOR 4K020H1" 194 C "Maxtor 4K020H1" +"Maxtor 4A300J0" 194 C "Maxtor MaxLine II 300GB 5400RPM" +"Maxtor 4[RA](25|16|12|08|06)0[LJ]0" 194 C "Maxtor DiamondMax 16" +"Maxtor 5(1024|1369|2049|2732|3073|4098)U(2|3|4|6|8)" 0 C "Maxtor DiamondMax Plus 40" +"Maxtor 5A250J0" 194 C "Maxtor MaXline II 250GB 5400RPM" +"Maxtor 5A300J0" 194 C "Maxtor 5A300J0" +"Maxtor 5T0[24]0H[24]" 0 C "Maxtor DiamondMax Plus 60" +"Maxtor 6E0[234]0L0" 194 C "Maxtor DiamondMax Plus 8" +"MAXTOR 6L0[2468]0[LJ][1234]" 194 C "Maxtor DiamondMax Plus D740X family" +"Maxtor 6V320F0" 194 C "Maxtor Diamond Max 10 SATA II 320 GB" +"Maxtor 6Y(06|08|12|16|20|25)0[LPM]0" 194 C "Maxtor DiamondMax Plus 9" +"Maxtor 7L300[RS]0" 194 C "Maxtor 7L300R0 MaxLine+III 300GB 7200rpm" +"Maxtor 7Y250[PM]0" 194 C "Maxtor MaXLine Plus II 250GB 7200RPM" +"Maxtor 94098U8" 11 C "Maxtor DiamondMax 40 94098U8" + +#"Maxtor 6(B|L)(08|12|16|20|25|30)0[RSPM]0" 194 C "Maxtor DiamondMax Plus 10" +"Maxtor 6B080M0" 194 C "Maxtor DiamondMax 10 80GB 8MB SATA" +"Maxtor 6B120M0" 194 C "Maxtor DiamondMax 10 120GB 8MB SATA" +"Maxtor 6B160M0" 194 C "Maxtor DiamondMax 10 160GB 8MB SATA" +"Maxtor 6B160P0" 194 C "Maxtor DiamondMax 10 160GB 8MB ATA/133" +"Maxtor 6B200M0" 194 C "Maxtor DiamondMax 10 200GB 8MB SATA" +"Maxtor 6B200P0" 194 C "Maxtor DiamondMax 10 200GB 8MB ATA/133" +"Maxtor 6B250R0" 194 C "Maxtor DiamondMax 10 250GB 16MB ATA/133" +"Maxtor 6B250S0" 194 C "Maxtor DiamondMax 10 250GB 16MB SATA" +"Maxtor 6B300R0" 194 C "Maxtor DiamondMax 10 300GB 16MB ATA/133" +"Maxtor 6B300S0" 194 C "Maxtor DiamondMax 10 300GB 16MB SATA" +"Maxtor 6L080L0" 194 C "Maxtor DiamondMax 10 80GB 2MB ATA/133 RoHS" +"Maxtor 6L080M0" 194 C "Maxtor DiamondMax 10 80GB 8MB SATA RoHS" +"Maxtor 6L080P0" 194 C "Maxtor DiamondMax 10 80GB 8MB ATA/133 RoHS" +"Maxtor 6L120M0" 194 C "Maxtor DiamondMax 10 120GB 8MB SATA RoHS" +"Maxtor 6L120P0" 194 C "Maxtor DiamondMax 10 120GB 8MB ATA/133 RoHS" +"Maxtor 6L160M0" 194 C "Maxtor DiamondMax 10 160GB 8MB SATA RoHS" +"Maxtor 6L160P0" 194 C "Maxtor DiamondMax 10 160GB 8MB ATA/133 RoHS" +"Maxtor 6L200M0" 194 C "Maxtor DiamondMax 10 200GB 8MB SATA RoHS" +"Maxtor 6L200P0" 194 C "Maxtor DiamondMax 10 200GB 8MB ATA/133 RoHS" +"Maxtor 6L250R0" 194 C "Maxtor DiamondMax 10 250GB 16MB ATA/133 RoHS" +"Maxtor 6L250S0" 194 C "Maxtor DiamondMax 10 250GB 16MB SATA RoHS" +"Maxtor 6L300R0" 194 C "Maxtor DiamondMax 10 300GB 16MB ATA/133 RoHS" +"Maxtor 6L300S0" 194 C "Maxtor DiamondMax 10 300GB 16MB SATA RoHS" +"Maxtor 6V080E0" 194 C "Maxtor DiamondMax 10 80GB 8MB SATAII RoHS" +"Maxtor 6V160E0" 194 C "Maxtor DiamondMax 10 160GB 8MB SATAII RoHS" +"Maxtor 6V200E0" 194 C "Maxtor DiamondMax 10 200GB 8MB SATAII RoHS" +"Maxtor 6V250F0" 194 C "Maxtor DiamondMax 10 250GB 16MB SATAII RoHS" +"Maxtor 6V300F0" 194 C "Maxtor DiamondMax 10 300GB 16MB SATAII RoHS" + + + +######################################## +############# Quantum drives +######################################## +"QUANTUM FIREBALLP AS40.0" 0 C "Quantum Fireball AS40" +"QUANTUM FIREBALL CX10.2A" 0 C "Quantum Fireball CX10.2A" +#"QUANTUM FIREBALLlct10 20" 4 C "Quantum Fireball CT10 20GB" +# I suspect the QUANTUM FIREBALL_TM2110A to have a sensor in field 9... +# "QUANTUM FIREBALL_TM2110A" 9 C "Quantum Fireball TM2110A" + + + +######################################## +############# Samsung drives +######################################## +# somenone reported a problem with the SP8004H which reports a temperature +# 10°C below the ambient temperature +"SAMSUNG HA(200|250)JC" 194 C "Samsung SpinPoint V120CE series" +"SAMSUNG HD160JJ" 194 C "Samsung 160GB, 7200RPM, 8MB cache, SATA" +"SAMSUNG HD160JJ/P" 194 C "Samsung SpinPoint P80 SD 160GB (7200RPM, 8MB cache)" +"SAMSUNG HD[30|32|40][01]L[DJ]" 194 C "Samsung SpinPoint T133 series (300-400MB)" +"SAMSUNG HD250KD" 194 C "Samsung SpinPoint T133 series (250 MB PATA)" +"SAMSUNG HD321KJ" 194 C "Samsung Spinpoint T166 (7200RPM, 16MB cache) - SATA" +"SAMSUNG HD501LJ" 194 C "Samsung HD501LJ" +"SAMSUNG MP0(302|402|603|804)H" 194 C "Samsung SpinPoint M40 2.5inch" +"SAMSUNG SW0434A" 0 C "Samsung SW0434A" +"SAMSUNG SP(2001|4002|6003|8004|40A2)H" 194 C "Samsung SpinPoint P40 serie" +"SAMSUNG SP(0612|0802|1203|1604|0812|1213|1614)N" 194 C "Samsung SpinPoint P80 serie" +"SAMSUNG SP(0612|0802|1203|1604|0812|1213|1614)C" 194 C "Samsung SpinPoint P80 series - SATA" +"SAMSUNG SP0411N" 194 C "Samsung SpinPoint PL40 serie" +"SAMSUNG SP0822N" 194 C "Samsung SP0822N" +"SAMSUNG SP(0812|1213|1614)C" 194 C "Samsung Spinpoint 160G SATA" +"SAMSUNG SP2[05]14N" 194 C "Samsung SpinPoint P120 series (7200RPM, 8MB cache)" +"SAMSUNG SP2[05]04C" 194 C "Samsung SpinPoint P120 series - SATA" +"SAMSUNG SV0432A" 0 C "Samsung SV0432A" +"SAMSUNG SV3002H" 0 C "Samsung SpinPoint V30 serie" +"SAMSUNG SV(2001|4002|4012|6003|8004)H" 194 C "Samsung SpinPoint V40 serie" +#"SAMSUNG SV(0221|0602|0813|1204)H" 9 C "Samsung SpinPoint V60 serie" +#"SAMSUNG SV1204H" 194 C "Samsung 120G" +"SAMSUNG SV(0401|0802|1203|1604)N" 194 C "Samsung SpinPoint V80 serie" +"SAMSUNG SV4012H" 194 C "Samsung 40GB, 5400RPM, 2MB cache" + +######################################## +############# Seagate drives +######################################## +"Seagate Technology 1275MB - ST31276A" 0 C "Seagate ST31276A" +"ST3412A" 0 C "Seagate ST3412A" +"ST38641A" 0 C "Seagate ST38641A" +"ST310014A" 194 C "Seagate ST310014A" +"ST310210A" 0 C "Seagate ST310210A" +"ST310211A" 194 C "Seagate ST310211A" +"ST310220A" 0 C "Seagate ST310220A" +# SEAGATE ST313021A 13.0GB +"ST313021A" 0 C "Seagate U8 ST313021A" +"ST310240A" 0 C "Seagate Medalist 10240 Ultra ATA-3" +"ST315320A" 194 C "Seagate ST315320A" +"ST320423A" 0 C "Seagate U10 20423, Ultra ATA/66" +"ST320011A" 194 C "Seagate ST320011A" +"ST320014A" 194 C "Seagate ST320014A (5400 rpm, 20Gb)" +"ST320410A" 194 C "Seagate ST320410A" +"ST320413A" 194 C "Seagate ST320413A" +"ST320414A" 194 C "Seagate ST320414A" +"ST320420A" 194 C "Seagate Barracuda II ST320420A" +"ST330013A" 194 C "Seagate ST330013A Barracuda ATA V 30GB, 7200 rpm" +"ST330620A" 194 C "Seagate ST330620A" +"ST330621A" 194 C "Seagate ST330621A" +"ST330630A" 194 C "Seagate Barracuda ST330630A" +"ST340014A" 194 C "Seagate Barracuda 7200.7 40Gb" +"ST340015A" 194 C "Seagate Barracuda 5400.1 40GB" +"ST340016A" 194 C "Seagate ST340016A" +"ST340810A" 194 C "Seagate U Series 40810 (40Gb, Ultra ATA/100, 5400 rpm)" +"ST340823A" 194 C "Seagate U Series 5 40823" +"ST340824A" 194 C "Seagate Barracuda III" +"ST360015A" 194 C "Seagate Barracuda V ST360015A" +"ST360020A" 194 C "Seagate U Series 60020" +"ST360021A" 194 C "Seagate Barracuda IV ST360021A" +"ST380011A" 194 C "Seagate Barracuda 7200.7 80GB" +"ST380012A" 194 C "Seagate ST380012A 80GB" +"ST380013A" 194 C "Seagate Barracuda 7200.7 80GB" +"ST380013AS" 194 C "Seagate Barracuda 7200.7 80GB (Serial ATA)" +"ST380020A" 194 C "Seagate U Series 80020 (80Gb, Ultra ATA/100, 5400 rpm)" +"ST380021A" 194 C "Seagate Barracuda IV ST380021A" +"ST380022A" 194 C "Seagate Barracuda U7 80022, Ultra ATA/100" +"ST380023A" 194 C "Seagate Barracuda V ST380023A" +"ST380817AS" 194 C "Seagate Barracuda 7200.7 80GB - SATA" +"ST39111A" 194 C "Seagate ST39111A (from Sun Ultra)" +"ST3120020A" 194 C "Seagate ST3120020A" +"ST3120022A" 194 C "Seagate Baraccuda 7200.7 120GB" +"ST3120023A" 194 C "Seagate Barracuda V ST3120023A" +"ST3120024A" 194 C "Seagate Barracuda V ST3120024A" +"ST3120025ACE" 194 C "Seagate Barracuda V ST3120025ACE" +"ST3120026A" 194 C "Seagate Barracuda V ST3120026A" +"ST3160021A" 194 C "Seagate Barracuda 7200.7 - ST3160021A" +"ST3160023(A|AS)" 194 C "Seagate Barracuda V ST3160023A and AS (160Gb, ATA100 or Serial ATA)" +"ST3160827AS" 194 C "Seagate Barracuda 7200.7 160GB (Serial ATA)" +"ST3200021A" 194 C "Seagate Barracuda 7200.7 Plus 200GB" +"ST3200822(A|AS)" 194 C "Seagate Barracuda 7200.7 Plus 200GB (PATA or SATA)" +"ST3200826A" 194 C "Seagate Barracuda 7200.8 200Gb" +"ST3250623A" 194 C "Seagate Barracuda 7200.16 250GB" +"ST3250823A" 194 C "Seagate Barracuda 7200.8 250GB" +"ST3250823A" 194 C "Seagate Barracuda 7200.7 Plus 250GB" +"ST3250823NS" 194 C "Seagate NL35 SATA (RAID-Edition) 7200 250GB" +"ST3300831A" 194 C "Seagate 300GB ST3300831A" +"ST3400832A" 194 C "Seagate Barracuda 7200.8 Plus 400GB" +"ST3400633(A|AS)" 194 C "Seagate Barracuda 7200.7 400 GB" +"ST3500630NS" 194 C "Seagate" +"ST3400632NS" 194 C "Seagate" +"ST3320620AS" 194 C "Seagate Barracuda 7200.7 320 GB" +"ST3500630AS" 194 C "Seagate Barracuda 7200.7 500 GB" +"ST3802110A" 194 C "Seagate Barracuda 7200.9 80 GB" +"ST910021A" 194 C "Seagate Momentus 7200.1 100GB" +"ST910082[35]A" 194 C "Seagate Momentus 5400.2 100GB" +"ST9120821A" 194 C "Seagate Momentus 5400.2 120GB" +"ST94019A" 194 C "Seagate ST94019A" +"ST94813A" 194 C "Seagate Momentus 5400.2 40GB" +"ST94[08]11A" 194 C "Seagate ST94011A" +"ST960821A" 194 C "Seagate ST960821A" +"ST960822A" 194 C "Seagate Momentus 5400.2 60GB" +"ST96812AS" 194 C "Seagate Momentus 5400.2 60GB SATA" +"ST9808211A" 194 C "Seagate Momentus 5400.2 80GB" + +######################################## +############# TOSHIBA Laptops +######################################## +"MK4313MAT" 220 C "Toshiba MK4313MAT" +"TOSHIBA MK1032GAX" 194 C "Toshiba MK1032GAX" +"TOSHIBA MK1517GAP" 0 C "Toshiba MK1517GAP" +"TOSHIBA MK2018GAS" 226 F "Toshiba MK2018GAS" +"TOSHIBA MK2023GAS" 194 C "Toshiba MK2023GAS" + +"TOSHIBA MK3017GAP" 0 C "Toshiba MK3017GAP" +"TOSHIBA MK3021GAS" 194 C "Toshiba MK3021GAS" +"TOSHIBA MK3025GAS" 194 C "Toshiba MK3025GAS" + +#"TOSHIBA MK4019GAX" 222 C "Toshiba MK4019GAX" +"TOSHIBA MK4021GAS" 194 C "Toshiba MK4021GAS" +"TOSHIBA MK4025GAS" 194 C "Toshiba MK4025GAS 40 Go" +"TOSHIBA MK4026GAS" 194 C "Toshiba MK4026GAS 40 Go" +"TOSHIBA MK4032GAX" 194 C "Toshiba MK4032GAX" + +"TOSHIBA MK6021GAS" 194 C "Toshiba MK6021GAS" +"TOSHIBA MK6022GAX" 194 C "Toshiba MK6022GAX" +"TOSHIBA MK6025GAS" 194 C "Toshiba MK6025GAS" +"TOSHIBA MK6026GAX" 194 C "Toshiba MK6026GAX" +"TOSHIBA MK8025GAS" 194 C "Toshiba MK8025GAS" +"TOSHIBA MK8026GAX" 194 C "Toshiba MK8026GAX" + +"MK4025GAS" 194 C "Toshiba MK4025GAS" + + +######################################## +############# Western Digital drives +######################################## +# WDC AC310100B and WDC AC2850F are reported not working +# no more informations were given +"WDC AC22000L" 0 C "Western Digital Caviar AC22000" +"WDC AC420400D" 231 C "Western Digital Caviar AC420400D" +"WDC AC418000D" 231 C "Western Digital AC418000D" +"WDC WD135BA" 231 C "Western Digital WD135BA" + +"WDC WD100EB-00BHF0" 0 C "Western Digital 100EB-00BHF0" +"WDC WD200BB-00AUA1" 0 C "Western Digital Caviar WD200BB" +#"WDC WD200BB-60DGA0" 0 C "Western Digital Caviar WD200BB" +"WDC WD300BB-00CAA0" 0 C "Western Digital WD300BB" +"WDC WD360GD-00FNA0" 194 C "Western Digital SATA Raptor 36.7GB" +"WDC WD400BB-00CAA0" 0 C "Western Digital 400BB-00CAA0" +"WDC WD400BB-00J[KH]A0" 194 C "Western Digital Caviar WD400BB" +"WDC WD400BB-23JHC0" 194 C "Western Digital 23JHC0" +#"WDC WD400BB-00GFA0" 0 C "" +"WDC WD400BB-55HEA0" 194 C "Western Digital Caviar WD400BB" +"WDC WD400BB-(18CA|00DE)A0" 0 C "Western Digital Caviar WD400BB" +"WDC WD400BB-75FJA1" 194 C "Western Digital Caviar WD400BB" +"WDC WD400EB-00CPF0" 0 C "Western Digital 400EB-00CPF0" +"WDC WD400JB-00(JJ|FM|FS)A0" 194 C "Western Digital Caviar 40GB Special Edition 8MB" +"WDC WD400JB-00ETA0" 194 C "Western Digital 400JB-00ETA0" +"WDC WD400JB-00JJC0" 194 C "Western Digital 400JB-00JJC0 40GB" +"WDC WD400LB-00DNA0" 194 C "Western Digital 400LB-00DNA0" +"WDC WD400UE-22HCT0" 194 C "Western Digital 40GB Notebook HDD" +"WDC WD400VE-75HDT1" 194 C "Western Digital Scorpio 40GB" +"WDC WD600BB-32BSA0" 0 C "Western Digital 600BB-32BSA0" +"WDC WD600JB-00ETA0" 194 C "Western Digital 600JB-00ETA0" +"WDC WD600LB-00DNA0" 194 C "Western Digital 60GB" +"WDC WD600VE-75HDT0" 194 C "Western Digital 600VE-75HDT0" +"WDC WD600VE-00HDT0" 194 C "Western Digital 600VE-00HDT0" +"WDC WD740GD-00FL21.0" 194 C "Western Digital SATA Raptor" +"WDC WD740GD-([05]0FL[AC]0|75FLA1)" 194 C "Western Digital SATA Raptor 74GB 8MB" +"WDC WD800BB-00CAA1" 0 C "Western Digital WD800BB-00CAA1" +"WDC WD800BB-(00|22)DKA0" 194 C "Western Digital WD800BB 80 Go" +"WDC WD800BB-32CCB0" 194 C "Western Digital 800BB-32CCB0" +"WDC WD800BB-55HEA0" 194 C "Western Digital 800BB-55HEA0" +"WDC WD800BB-00JHA0" 194 C "Western Digital 800BB-00JHA0" +"WDC WD800BB-00JKA0" 194 C "Western Digital 800BB-00JKA0" +"WDC WD800BB-55JKA0" 194 C "Western Digital 800BB-55JKA0" +"WDC WD800BB-75FRA0" 194 C "Western Digital Caviar WD800BB" +"WDC WD800JB-00CRA1" 0 C "Western Digital Caviar WD800JB" +"WDC WD800JB-00(ET|FM|FS)A0" 194 C "Western Digital Caviar 80GB Special Edition 8MB" +"WDC WD800JB-00JJ[AC]0" 194 C "Western Digital WD800JB" +"WDC WD800JD-(00|55)(HK|JR)A0" 194 C "Western Digital SATA 80GB, 8MB Cache" +"WDC WD800JD-00(HK|JN)A0" 194 C "Western Digital SATA 80GB, 8MB Cache" +"WDC WD800LB-(00|55)DNA0" 194 C "Western Digital Caviar WD800LB 80 Go ATA-100" +"WDC WD800VE-07HDT0" 194 C "Western Digital 800VE-07HDT0" +"WDC WD1200BB-00(FTA|GUA)0" 194 C "Western Digital Caviar EIDE 2MB Cache" +"WDC WD1200JB-00(EV|FU|GV)A0" 194 C "Western Digital Caviar 120GB Special Edition 8MB" +"WDC WD1200JB-22GVA0" 194 C "Western Digital Caviar 120GB" +"WDC WD1200JD-00(GBB|HBC)0" 194 C "Western Digital WD1200JD" +"WDC WD1200LB-55EDA0" 194 C "Western Digital WD1220LB" +"WDC WD1200SB-01KB[AC]0" 194 C "Western Digital Caviar RE (Raid Edition) 120 GB" +"WDC WD1600BB-00DWA0" 194 C "Western Digital Caviar WD1600BB" +"WDC WD1600JB-(00EV|00FU|00GV|22GV|75GV)A0" 194 C "Western Digital Caviar 160GB Special Edition 8MB" +"WDC WD2000BB-00FTA0" 194 C "Western Digital WD2000BB" +"WDC WD2000JB-(00EV|32EV|34EV|00FU|00GV|55GV|98GV|00KF)A0" 194 C "Western Digital Caviar 200GB Special Edition 8MB" +"WDC WD2000JB-00GVC0" 194 C "Western Digital WD2000JB" +"WDC WD2000JS-00MHB1" 194 C "Western Digital SATA 200GB" +"WDC WD2500JB-(00RE|00EV|00FU|32FU|00GV|55GV)A0" 194 C "Western Digital Caviar 250GB Special Edition 8MB" +"WDC WD2500JB-00GVC0" 194 C "Western Digital 250GB" +"WDC WD2500JD-(00G|32H)BB0" 194 C "Western Digital SATA Caviar 250GB Special Edition 8MB" +"WDC WD2500JD-40HBC0" 194 C "Western Digital WD2500JD-40HBC0" +"WDC WD2500PB-98FBA0" 194 C "Western Digital Caviar 250GB Special Edition 8MB" +"WDC WD2500PD-00FZB1" 194 C "Western Digital WD2500PD-00FZB1" +"WDC WD2500SD-01KCB0" 194 C "Western Digital Caviar RE 250GB 8MB" +"WDC WD3000JB-00KFA0" 194 C "Western Digital WD3000JB" +"WDC WD3200JB-00KFA0" 194 C "Western Digital Caviar 320GB 8MB" +"WDC WD4000KD-00NAB0" 194 C "Western Digital Caviar SE16 400GB 16MB" +"WDC WD4000YR-01PLB0" 194 C "Western Digital Caviar RE2 400GB 16MB" +"WD4000YS-01MPB0" 194 C "Western Digital RE2 7200 SATA II 400 GB" + +# not sure for next +# "WDC WD1200JB-00CRA1" 9 C "Western Digital 1200JB-00CRA1" +# "WDC WD273BA" 9 C "Western Digital WD273BA" + + + + +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## + +"ST3750640AS" 194 C "Seagate Barracuda 7200.10 SATA 750GB" +"ST3750840AS" 194 C "Seagate Barracuda 7200.10 SATA 750GB" +"ST3500630AS" 194 C "Seagate Barracuda 7200.10 SATA 500GB" +"ST3500830AS" 194 C "Seagate Barracuda 7200.10 SATA 500GB" +"ST3400620AS" 194 C "Seagate Barracuda 7200.10 SATA 400GB" +"ST3400620A" 194 C "Seagate Barracuda 7200.10 400GB" +"ST3400820AS" 194 C "Seagate Barracuda 7200.10 SATA 400GB" +"ST3320620AS" 194 C "Seagate Barracuda 7200.10 SATA 320GB" +"ST3320820AS" 194 C "Seagate Barracuda 7200.10 SATA 320GB" +"ST3300620AS" 194 C "Seagate Barracuda 7200.10 SATA 300GB" +"ST3300820AS" 194 C "Seagate Barracuda 7200.10 SATA 300GB" +"ST3250620AS" 194 C "Seagate Barracuda 7200.10 SATA 250GB" +"ST3250820AS" 194 C "Seagate Barracuda 7200.10 SATA 250GB" +"ST3250410AS" 194 C "Seagate Barracuda 7200.10 SATA 250GB" +"ST3250310AS" 194 C "Seagate Barracuda 7200.10 SATA 250GB" +"ST3200820AS" 194 C "Seagate Barracuda 7200.10 SATA 200GB" +"ST3160815AS" 194 C "Seagate Barracuda 7200.10 SATA 160GB" +"ST3160215AS" 194 C "Seagate Barracuda 7200.10 SATA 160GB" +"ST3120815AS" 194 C "Seagate Barracuda 7200.10 SATA 120GB" +"ST3120215AS" 194 C "Seagate Barracuda 7200.10 SATA 120GB" +"ST380815AS" 194 C "Seagate Barracuda 7200.10 SATA 80GB" +"ST380215AS" 194 C "Seagate Barracuda 7200.10 SATA 80GB" +"ST340815AS" 194 C "Seagate Barracuda 7200.10 SATA 40GB" +"ST340215AS" 194 C "Seagate Barracuda 7200.10 SATA 40GB" +"ST3300622AS" 194 C "Seagate Barracuda 7200.9 SATA2.5 300GB" +"ST3300831A" 194 C "Seagate Barracuda 7200.8 PATA 300GB" + +"Maxtor 7(L|V)250(F|R|S)0" 194 C "Maxtor MaXLine III 250GB 7200rpm" +"Maxtor 7(L|V)300(F|R|S)0" 194 C "Maxtor MaXLine III 300GB 7200rpm" +"MAXTOR STM3320620AS" 194 C "" + +"WDC WD1500ADFD-00NLR1" 194 C "Western Digital Raptor 150GB" +"WDC WD1600JS-00NCB1" 194 C "Western Digital Caviar 1600JS 160GB Sata" +"WDC WD1600SD-01KCC0" 194 C "Western Digital Caviar RE Serial ATA series" +"WDC WD2500JD-57HBC0" 194 C "Western Digital Caviar SE (Serial ATA) 250 GB" +"WDC WD2500JS" 194 C "Western Digital WD2500JS" +"WDC WD2500JS-41MVB1" 194 C "Western Digital SATAII Caviar 250GB Special Edition 8MB" +"WDC WD2500JD-00HBB0" 194 C "Western Digital SATA 250GB" +"WDC WD2500KS-00MJB0" 194 C "Western Digital SATA-II Caviar 250GB Special Edition 16MB" +"WDC WD3000JS-00PDB0" 194 C "Western Digital WD3000JS" +"WDC WD3200KS-00PFB0" 194 C "" +"WDC WD3200JD-22KLB0" 194 C "Western Digital Caviar SE 320GB 8MB" diff --git a/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk b/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk index 5c4c78d26d..1896f6461b 100644 --- a/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/hddtemp/package.mk @@ -1,37 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="hddtemp" -PKG_VERSION="0.3-beta15" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="e16aed6" +PKG_SHA256="5d5af74ba7449b6e56a8f872a0e10d654a512ed65d62beaef1575b0c1826d9f3" PKG_LICENSE="GPL" -PKG_SITE="http://www.guzu.net/linux/hddtemp.php" -PKG_URL="http://download.savannah.gnu.org/releases/hddtemp/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_SITE="https://savannah.nongnu.org/projects/hddtemp" +PKG_URL="https://github.com/guzu/hddtemp/archive/${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="debug/tools" -PKG_SHORTDESC="hddtemp: tool that reports hard drive temperature" -PKG_LONGDESC="hddtemp is a small utility (daemonizable) that gives you the temperature of your hard drive by reading S.M.A.R.T. informations (for drives that support this feature)." -PKG_AUTORECONF="no" +PKG_LONGDESC="A utility that gives you the temperature of your hard drive by reading S.M.A.R.T.." PKG_CONFIGURE_OPTS_TARGET="--with-db-path=/storage/.kodi/addons/virtual.system-tools/data/hddtemp.db" +post_unpack() { + cp $PKG_DIR/db/* $PKG_BUILD +} + makeinstall_target() { : # nop } - diff --git a/packages/addons/addon-depends/system-tools-depends/hddtemp/patches/hddtemp-0.3-beta15-52.patch b/packages/addons/addon-depends/system-tools-depends/hddtemp/patches/hddtemp-0.3-beta15-52.patch deleted file mode 100644 index 9397c86b67..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/hddtemp/patches/hddtemp-0.3-beta15-52.patch +++ /dev/null @@ -1,7539 +0,0 @@ ---- hddtemp-0.3-beta15.orig/README -+++ hddtemp-0.3-beta15/README -@@ -28,10 +28,7 @@ - INFORMATION - =========== - hddtemp accesses to the SATA disks via ATA pass-through commands (defined in --T10/04-262r7). At the time of writing (kernel 2.6.11-rc5 has just been --released), kernels doesn't have support for ATA pass-through. You have to --update the libata driver with a newer version that could be found on: --http://www.kernel.org/pub/linux/kernel/people/jgarzik/libata/ -+T10/04-262r7). Only kernel >= 2.6.16 have this support. - - In daemon mode, hddtemp doesn't allow too much query at a time. If the interval - between two query is inferior to 1 minute, hddtemp will give the previous value ---- hddtemp-0.3-beta15.orig/debian/rules -+++ hddtemp-0.3-beta15/debian/rules -@@ -0,0 +1,110 @@ -+#!/usr/bin/make -f -+# Sample debian/rules that uses debhelper. -+# GNU copyright 1997 to 1999 by Joey Hess. -+ -+# Uncomment this to turn on verbose mode. -+#export DH_VERBOSE=1 -+ -+# These are used for cross-compiling and for saving the configure script -+# from having to guess our platform (since we know it already) -+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -+ -+# Get flags from dpkg-buildflags -+CFLAGS = $(shell dpkg-buildflags --get CFLAGS) -+CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) -+LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -+ -+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) -+ INSTALL_PROGRAM += -s -+endif -+ -+config.status: configure -+ dh_testdir -+ -+ -test -r /usr/share/misc/config.sub && \ -+ cp -f /usr/share/misc/config.sub config.sub -+ -test -r /usr/share/misc/config.guess && \ -+ cp -f /usr/share/misc/config.guess config.guess -+ -+ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -+ ./configure --host=$(DEB_HOST_GNU_TYPE) \ -+ --build=$(DEB_BUILD_GNU_TYPE) \ -+ --prefix=/usr \ -+ --mandir=\$${prefix}/share/man \ -+ --infodir=\$${prefix}/share/info \ -+ --with-db-path=/etc/hddtemp.db -+ -+build: build-arch build-indep -+ -+build-arch: build-arch-stamp -+build-arch-stamp: config.status -+ dh_testdir -+ $(MAKE) -+ touch build-stamp -+ -+build-indep: -+ -+clean: debian-clean -+ dh_clean -+ -+debian-clean: -+ dh_testdir -+ dh_testroot -+ [ ! -f Makefile ] || $(MAKE) distclean -+ rm -f po/*.gmo po/stamp-po -+ -rm -f *-stamp -+ -rm -f config.sub config.guess -+ -+install: build -+ dh_testdir -+ dh_testroot -+ dh_clean -k -+ dh_installdirs -+ -+ # Add here commands to install the package into debian/hddtemp. -+ $(MAKE) install DESTDIR=$(CURDIR)/debian/hddtemp -+ -+ install -p -o root -g root -m 644 $(CURDIR)/debian/hddtemp.db \ -+ $(CURDIR)/debian/hddtemp/etc/hddtemp.db -+ -+ cp -a $(CURDIR)/contribs $(CURDIR)/debian/hddtemp/usr/share/doc/hddtemp -+ rm -f $(CURDIR)/debian/hddtemp/usr/share/doc/hddtemp/Makefile* -+ -+# Build architecture-independent files here. -+binary-indep: build install -+# We have nothing to do by default. -+ -+# Build architecture-dependent files here. -+binary-arch: build install -+ dh_testdir -+ dh_testroot -+ dh_installdebconf -+ dh_installdocs -+ dh_installexamples -+ dh_installmenu -+ dh_installlogcheck -+# dh_installlogrotate -+# dh_installemacsen -+# dh_installpam -+# dh_installmime -+ dh_installinit -+ dh_installcron -+ dh_installman -+ dh_installinfo -+ dh_installchangelogs ChangeLog -+ dh_link -+ dh_strip -+ dh_compress -+ dh_fixperms -+# dh_makeshlibs -+ dh_installdeb -+# dh_perl -+ dh_shlibdeps -+ dh_gencontrol -+ dh_md5sums -+ dh_builddeb -+ -+binary: binary-indep binary-arch -+.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install -+ ---- hddtemp-0.3-beta15.orig/debian/docs -+++ hddtemp-0.3-beta15/debian/docs -@@ -0,0 +1,2 @@ -+README -+TODO ---- hddtemp-0.3-beta15.orig/debian/postrm -+++ hddtemp-0.3-beta15/debian/postrm -@@ -0,0 +1,28 @@ -+#! /bin/sh -+# postrm script for hddtemp -+set -e -+ -+conffile="/etc/default/hddtemp" -+ -+case "$1" in -+ purge) -+ rm -f $conffile -+ ;; -+ remove) -+ rm -f /usr/bin/hddtemp -+ rm -f /usr/share/man/man1/hddtemp.1.gz -+ ;; -+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) -+ ;; -+ *) -+ echo "postrm called with unknown argument \`$1'" >&2 -+ exit 1 -+ ;; -+esac -+ -+# dh_installdeb will replace this with shell code automatically -+# generated by other debhelper scripts. -+ -+#DEBHELPER# -+ -+exit 0 ---- hddtemp-0.3-beta15.orig/debian/changelog -+++ hddtemp-0.3-beta15/debian/changelog -@@ -0,0 +1,1289 @@ -+hddtemp (0.3-beta15-52) unstable; urgency=low -+ -+ * Decrease hddtemp/daemon priority to medium from high (closes: -+ bug#680877). -+ * Bumped Standards-Version to 3.9.3. -+ -+ -- Aurelien Jarno Mon, 09 Jul 2012 08:12:30 +0200 -+ -+hddtemp (0.3-beta15-51) unstable; urgency=low -+ -+ * init script: also probe for double letter drives (closes: bug#646724). -+ -+ -- Aurelien Jarno Sun, 30 Oct 2011 20:21:06 +0100 -+ -+hddtemp (0.3-beta15-50) unstable; urgency=low -+ -+ * Convert hddtemp.db to UTF-8 (closes: bug#640899). -+ * Don't restart on reload in init.d (closes: bug#643610). -+ * Add a status option in init.d (closes: bug#643611). -+ -+ -- Aurelien Jarno Sun, 09 Oct 2011 20:16:06 +0200 -+ -+hddtemp (0.3-beta15-49) unstable; urgency=low -+ -+ * Added Slovak debconf templates. Thanks to Slavko (closes: bug#634519). -+ * Fix a few typo in translation and enable German translation. Thanks to -+ Ville Skyttä for tha patch. -+ * Add build-arch and build-indep targets. -+ -+ -- Aurelien Jarno Tue, 30 Aug 2011 16:32:45 +0200 -+ -+hddtemp (0.3-beta15-48) unstable; urgency=low -+ -+ * Fix backtrace support on i386. -+ * Add backtrace support on amd64. -+ -+ -- Aurelien Jarno Sun, 05 Jun 2011 00:18:46 +0200 -+ -+hddtemp (0.3-beta15-47) unstable; urgency=low -+ -+ * Fix reading model on SATA big-endian (closes: #602307). -+ * Updated Arabic debconf templates, thanks to Ossama Khaya (closes: -+ bug#596177). -+ * Updated Swedish debconf template, thanks to Joe Hansen (closes: -+ bug#603109). -+ * Update Dutch debconf translation, thanks to Jeroen Schot (closes: -+ bug#628757). -+ * Bumped Standards-Version to 3.9.2 (no changes). -+ -+ -- Aurelien Jarno Sat, 04 Jun 2011 21:36:32 +0200 -+ -+hddtemp (0.3-beta15-46) unstable; urgency=low -+ -+ * Don't probe /dev/sg? by default (closes: bug#531849). -+ * Add initial German translation, by Helge Kreutzmann (closes: #503710). -+ * Fix a typo in the help message (closes: #503711). -+ * Correctly zero-terminate long product ID strings (closes: #517981). -+ * Bumped Standards-Version to 3.8.4 (no changes). -+ -+ -- Aurelien Jarno Sun, 07 Feb 2010 20:24:49 +0100 -+ -+hddtemp (0.3-beta15-45) unstable; urgency=low -+ -+ * Updated Swedish debconf templates. Thanks to Martin Bagge (closes: -+ bug#491768). -+ * Improve init script, by Cristian Ionescu-Idbohrn (closes: bug#486235). -+ * Mention /etc/init.d/hddtemp and /etc/default/hddtemp in README.Debian -+ (closes: bug#482982). -+ * Bumped Standards-Version to 3.8.0 (no changes). -+ -+ -- Aurelien Jarno Sun, 27 Jul 2008 09:44:06 +0200 -+ -+hddtemp (0.3-beta15-44) unstable; urgency=low -+ -+ * Updated Japanese debconf templates. Thanks to Kenshi Muto (closes: -+ bug#483504). -+ -+ -- Aurelien Jarno Mon, 02 Jun 2008 10:30:58 +0200 -+ -+hddtemp (0.3-beta15-43) unstable; urgency=low -+ -+ * Don't wake up SATA drives if not asked (closes: #479840). -+ -+ -- Aurelien Jarno Sat, 10 May 2008 13:24:18 +0200 -+ -+hddtemp (0.3-beta15-42) unstable; urgency=low -+ -+ * Use minus instead of hyphenin manpage. -+ -+ -- Aurelien Jarno Sun, 02 Mar 2008 19:14:14 +0100 -+ -+hddtemp (0.3-beta15-41) unstable; urgency=low -+ -+ * Fixed LSB header in init script (closes: bug#466281). -+ -+ -- Aurelien Jarno Sun, 17 Feb 2008 18:22:21 +0100 -+ -+hddtemp (0.3-beta15-40) unstable; urgency=low -+ -+ * Added Basque debconf templates. Thanks to Piarres Beobide (closes: -+ bug#465731). -+ -+ -- Aurelien Jarno Fri, 15 Feb 2008 21:59:07 +0100 -+ -+hddtemp (0.3-beta15-39) unstable; urgency=low -+ -+ [ Aurelien Jarno ] -+ * Bumped Standards-Version to 3.7.3 (no changes). -+ -+ [ Christian Perrier ] -+ * Debconf templates and debian/control reviewed by the debian-l10n- -+ english team as part of the Smith review project. Closes: #462483 -+ * [Debconf translation updates] -+ * Norwegian BokmÃ¥l. Closes: #462799 -+ * German. Closes: #462843 -+ * Galician. Closes: #462988 -+ * Spanish. Closes: #463898 -+ * Finnish. Closes: #463943 -+ * Czech. Closes: #464224 -+ * Russian. Closes: #464566 -+ * Italian. Closes: #465069 -+ * Portuguese. Closes: #465135 -+ * Vietnamese. Closes: #465534 -+ * French. Closes: #465650 -+ -+ -- Aurelien Jarno Wed, 13 Feb 2008 23:43:53 +0100 -+ -+hddtemp (0.3-beta15-38) unstable; urgency=low -+ -+ * Fix typo in hddtemp manpage (closes: bug#444242). -+ -+ -- Aurelien Jarno Tue, 11 Dec 2007 15:17:16 +0100 -+ -+hddtemp (0.3-beta15-37) unstable; urgency=low -+ -+ * Updated Czech debconf templates. Thanks to Miroslav Kure (closes: -+ bug#413322). -+ * Added Galician debconf templates. Thanks to Jacobo Tarrio (closes: -+ bug#412198). -+ * Clean po/stamp-po to make sure the .gmo files are regenerated (closes: -+ bug#441708). -+ * Updated Portuguese translation, thanks to Rui Branco (closes: -+ bug#418281). -+ * Updated Vietnamese debconf translation. Thanks to Clytie Siddall (closes: -+ bug#427039). -+ * Fixed man page formatting error (closes: bug#439074). -+ * Fix a segfault when using --unit and --numeric (closes: bug#412368). -+ * Exit with error code != 0 in case of error (closes: bug#423509). -+ -+ -- Aurelien Jarno Wed, 12 Sep 2007 11:36:05 +0200 -+ -+hddtemp (0.3-beta15-36) unstable; urgency=low -+ -+ * Fix the init script, trying to kill not running daemon on shutdown -+ (closes: #411645). -+ -+ -- Aurelien Jarno Tue, 20 Feb 2007 22:04:01 +0100 -+ -+hddtemp (0.3-beta15-35) unstable; urgency=low -+ -+ * Updated Portuguese translation, thanks to Miguel Figueire (closes: -+ bug#409491). -+ -+ -- Aurelien Jarno Tue, 20 Feb 2007 08:22:22 +0100 -+ -+hddtemp (0.3-beta15-34) unstable; urgency=low -+ -+ * Relax SATA magic checkings (closes: #404310) -+ * Updated Swedish debconf template. Thanks to Daniel Nylander (closes: -+ bug#398788). -+ * /etc/default/hddtemp: changed SYSLOG into RUN_SYSLOG and fixed the -+ comments (closes: bug#401978). -+ -+ -- Aurelien Jarno Fri, 19 Jan 2007 00:38:27 +0100 -+ -+hddtemp (0.3-beta15-33) unstable; urgency=medium -+ -+ * Update the description (closes: #401428). -+ -+ -- Aurelien Jarno Mon, 4 Dec 2006 06:04:38 +0100 -+ -+hddtemp (0.3-beta15-32) unstable; urgency=low -+ -+ * Updated German debconf template. Thanks to Erik Schanze (closes: -+ bug#397209). -+ -+ -- Aurelien Jarno Mon, 27 Nov 2006 14:42:32 +0100 -+ -+hddtemp (0.3-beta15-31) unstable; urgency=low -+ -+ * Remove the suggest on gkrellm-hddtemp (closes: bug#398938). -+ * Updated Swedish debconf template. Thanks to Daniel Nylander (closes: -+ bug#398788). -+ * Added Swedish translation. Thanks to Daniel Nylander (closes: -+ bug#398787). -+ * Added and LSB header to the init script. -+ -+ -- Aurelien Jarno Mon, 27 Nov 2006 12:14:49 +0100 -+ -+hddtemp (0.3-beta15-30) unstable; urgency=medium -+ -+ * Remove a space in the printed temperature when a disk is not present -+ in hddtemp.db. -+ -+ -- Aurelien Jarno Thu, 19 Oct 2006 14:50:09 +0200 -+ -+hddtemp (0.3-beta15-29) unstable; urgency=medium -+ -+ * Also consider field 194 as a temperature in Celsius if the disk -+ is not present in hddtemp.db in daemon mode (closes: bug#391870). -+ -+ -- Aurelien Jarno Mon, 9 Oct 2006 16:42:47 +0200 -+ -+hddtemp (0.3-beta15-28) unstable; urgency=medium -+ -+ * Always consider field 194 as a temperature in Celsius if the disk -+ is not present in hddtemp.db (closes: bug#387102, #386943, #389290, -+ #387403, #389309, #387544) -+ * Updated Czech debconf template. Thanks to Miroslav Jezbera (closes: -+ bug#389244). -+ * Set urgency to medium as I really want to get this version in etch -+ (and not bother with roughly one bug report per week). -+ -+ -- Aurelien Jarno Wed, 4 Oct 2006 01:53:51 +0200 -+ -+hddtemp (0.3-beta15-27) unstable; urgency=low -+ -+ * Depends on lsb-base (>= 3.0-3) (closes: bug#386859). -+ * Added support for Western Digital WD2000JD (closes: bug#385604). -+ * Added support for Seagate NL35 SATA (closes: bug#385187). -+ * Added support for ST3160811AS (closes: bug#385335). -+ * Added support for WD400BB-00DKA0 (closes: bug#386857). -+ -+ -- Aurelien Jarno Mon, 11 Sep 2006 00:13:15 +0200 -+ -+hddtemp (0.3-beta15-26) unstable; urgency=low -+ -+ * Added support for SAMSUNG HD160JJ. -+ -+ -- Aurelien Jarno Sat, 26 Aug 2006 22:29:13 +0200 -+ -+hddtemp (0.3-beta15-25) unstable; urgency=low -+ -+ * Added support for WD1200JD-00FYB0 (closes: bug#383692). -+ -+ -- Aurelien Jarno Sun, 20 Aug 2006 15:00:15 +0200 -+ -+hddtemp (0.3-beta15-24) unstable; urgency=low -+ -+ * Updated Spanish debconf template. Thanks to Carlos Valdivia Yagüe (closes: -+ bug#383374:). -+ -+ -- Aurelien Jarno Thu, 17 Aug 2006 10:25:43 +0200 -+ -+hddtemp (0.3-beta15-23) unstable; urgency=low -+ -+ * Added support for WDC WD3200SD-01KNB0 (closes: bug#382449). -+ * Added support for ST3400633 (closes: bug#382546). -+ * Added various Seagate 7200.10 drives, patch by Petr Vandrovec (closes: -+ bug#382490). -+ -+ -- Aurelien Jarno Fri, 11 Aug 2006 21:46:40 +0200 -+ -+hddtemp (0.3-beta15-22) unstable; urgency=low -+ -+ * Added support for ST3320620AS (closes: bug#382300). -+ -+ -- Aurelien Jarno Thu, 10 Aug 2006 11:24:58 +0200 -+ -+hddtemp (0.3-beta15-21) unstable; urgency=low -+ -+ * Added support for Toshiba MK1032GSX (closes: bug#382130). -+ -+ -- Aurelien Jarno Wed, 9 Aug 2006 19:27:36 +0200 -+ -+hddtemp (0.3-beta15-20) unstable; urgency=low -+ -+ * Added support for Maxtor 6V300F0 (closes: bug#382071). -+ * Added support for Seagate ST98823AS (closes: bug#382009). -+ -+ -- Aurelien Jarno Tue, 8 Aug 2006 18:28:24 +0200 -+ -+hddtemp (0.3-beta15-19) unstable; urgency=low -+ -+ * Added support for ST3250624AS (closes: bug#381837). -+ * Added support for WDC WD3200KS-00PFB0 (closes: bug#381837). -+ -+ -- Aurelien Jarno Mon, 7 Aug 2006 23:38:39 +0200 -+ -+hddtemp (0.3-beta15-18) unstable; urgency=low -+ -+ * Added support for MHV2060AH. -+ -+ -- Aurelien Jarno Sat, 5 Aug 2006 21:19:56 +0200 -+ -+hddtemp (0.3-beta15-17) unstable; urgency=low -+ -+ * Added support for WDC WD1500ADFD-00NLR0 (closes: bug#381403). -+ -+ -- Aurelien Jarno Sat, 5 Aug 2006 17:00:30 +0200 -+ -+hddtemp (0.3-beta15-16) unstable; urgency=low -+ -+ * Updated Japanese debconf template. Thanks to Kenshi Muto (closes: -+ bug#379945). -+ * Added support for ST3808110AS and ST3160812AS (closes: bug#380478). -+ * Added support for ST3160812A (closes: bug#379701). -+ -+ -- Aurelien Jarno Sun, 30 Jul 2006 22:54:13 +0200 -+ -+hddtemp (0.3-beta15-15) unstable; urgency=low -+ -+ * Added support for WDC WD2500JD-75HBB0 (closes: bug#379024). -+ -+ -- Aurelien Jarno Thu, 20 Jul 2006 21:47:04 +0200 -+ -+hddtemp (0.3-beta15-14) unstable; urgency=low -+ -+ * Use lsb init-functions in init script. Thanks to Benjamin Leipold for the -+ patch (closes: bug#378118). -+ -+ -- Aurelien Jarno Fri, 14 Jul 2006 15:08:39 +0200 -+ -+hddtemp (0.3-beta15-13) unstable; urgency=low -+ -+ * Added support for Toshiba MK8032GSX (Closes: #375486). -+ * Update the minimum kernel version (2.6.16) necessary to support -+ SATA in README. -+ * Print all warning/messages to stderr. -+ * Applied patch by Andras Korn (Closes: #374796) to allow the hddtemp -+ daemon to stay in the foreground. -+ -+ -- Aurelien Jarno Thu, 29 Jun 2006 15:11:47 +0200 -+ -+hddtemp (0.3-beta15-12) unstable; urgency=low -+ -+ * Added Dutch debconf translation, thanks to Kurt De Bree (closes: -+ bug#370072). -+ -+ -- Aurelien Jarno Sat, 3 Jun 2006 19:45:21 +0200 -+ -+hddtemp (0.3-beta15-11) unstable; urgency=low -+ -+ * Updated Danish debconf template. Thanks to Claus Hindsgaul (closes: -+ bug#368045). -+ -+ -- Aurelien Jarno Fri, 19 May 2006 17:25:32 +0000 -+ -+hddtemp (0.3-beta15-10) unstable; urgency=low -+ -+ * Updated French debconf translation, thanks to Jean-Luc Coulon (closes: -+ bug#367540). -+ -+ -- Aurelien Jarno Tue, 16 May 2006 21:42:39 +0200 -+ -+hddtemp (0.3-beta15-9) unstable; urgency=low -+ -+ * debian/templates: Changed How often into in interval. (closes: bug#367382). -+ * debian/templates: fixed the templates to make lintian happy. -+ -+ -- Aurelien Jarno Mon, 15 May 2006 20:21:49 +0200 -+ -+hddtemp (0.3-beta15-8) unstable; urgency=low -+ -+ * Added support for SAMSUNG HD300LJ (closes: bug#367250). -+ -+ -- Aurelien Jarno Sun, 14 May 2006 20:08:31 +0200 -+ -+hddtemp (0.3-beta15-7) unstable; urgency=low -+ -+ * Added support for HDS722516VLSA80 (closes: bug#366742). -+ -+ -- Aurelien Jarno Thu, 11 May 2006 05:46:24 +0200 -+ -+hddtemp (0.3-beta15-6) unstable; urgency=low -+ -+ * Added support for FUJITSU MHV2100BH (closes: bug#366388). -+ -+ -- Aurelien Jarno Wed, 10 May 2006 06:29:54 +0200 -+ -+hddtemp (0.3-beta15-5) unstable; urgency=low -+ -+ * Added support for WDC WD740GD-00FLA1 (closes: bug#366021). -+ * Bumped Standards-Version to 3.7.2 (no changes). -+ -+ -- Aurelien Jarno Thu, 4 May 2006 18:38:15 +0200 -+ -+hddtemp (0.3-beta15-4) unstable; urgency=low -+ -+ * Fix a crash in daemon (syslog) mode when the hard disk is not known -+ (closes: bug#365605). -+ * Added support for WD1200JB-00REA0. -+ -+ -- Aurelien Jarno Wed, 3 May 2006 20:27:11 +0200 -+ -+hddtemp (0.3-beta15-3) unstable; urgency=low -+ -+ * Added support for WDC WD800JD-75JNC0 (closes: bug#365359). -+ * Added support for WDC WD2500KS and WDC WD2500YD. -+ -+ -- Aurelien Jarno Tue, 2 May 2006 21:49:37 +0200 -+ -+hddtemp (0.3-beta15-2) unstable; urgency=low -+ -+ * Updated database for Maxtors MaxLineIII series drives (closes: -+ bug#365011). -+ -+ -- Aurelien Jarno Thu, 27 Apr 2006 14:45:22 +0200 -+ -+hddtemp (0.3-beta15-1) unstable; urgency=low -+ -+ * New upstream version. -+ -+ -- Aurelien Jarno Thu, 27 Apr 2006 05:25:06 +0200 -+ -+hddtemp (0.3-beta14-12) unstable; urgency=low -+ -+ * Added Portuguese translation, thanks to Miguel Figueire (closes: -+ bug#361505). -+ -+ -- Aurelien Jarno Tue, 11 Apr 2006 00:38:51 +0200 -+ -+hddtemp (0.3-beta14-11) unstable; urgency=low -+ -+ * Added support for WDC WD2500PD-00FZB1, WDC WD2500SD-01KCB0, WDC -+ WD1200JD-00HBC0 and WDC WD4000YR-01PLB0 (closes: bug#357804). -+ -+ -- Aurelien Jarno Sat, 25 Mar 2006 20:29:42 +0100 -+ -+hddtemp (0.3-beta14-10) unstable; urgency=low -+ -+ * Use F for fahrenheit. -+ * Added support for Hitachi DK23EA-20B (closes: bug#355763). -+ -+ -- Aurelien Jarno Sat, 18 Mar 2006 11:39:20 +0100 -+ -+hddtemp (0.3-beta14-9) unstable; urgency=low -+ -+ * Update hddtemp.db (closes: bug#355469). -+ -+ -- Aurelien Jarno Mon, 6 Mar 2006 00:40:35 +0100 -+ -+hddtemp (0.3-beta14-8) unstable; urgency=low -+ -+ * Don't flood syslog if the system clock wraps (closes: bug#354260). -+ -+ -- Aurelien Jarno Fri, 24 Feb 2006 21:32:36 +0100 -+ -+hddtemp (0.3-beta14-7) unstable; urgency=low -+ -+ * Correctly initialize the structure dsk. -+ -+ -- Aurelien Jarno Sat, 4 Feb 2006 22:01:07 +0100 -+ -+hddtemp (0.3-beta14-6) unstable; urgency=low -+ -+ * Added support for TOSHIBA MK4026GAX. -+ -+ -- Aurelien Jarno Sun, 11 Dec 2005 21:13:06 +0100 -+ -+hddtemp (0.3-beta14-5) unstable; urgency=low -+ -+ * Added Swedish translation of hddtemp. Thanks to Daniel Nylander (close: -+ bug#337117). -+ -+ -- Aurelien Jarno Thu, 3 Nov 2005 01:56:26 +0100 -+ -+hddtemp (0.3-beta14-4) unstable; urgency=low -+ -+ * Fixed the package device patch. -+ -+ -- Aurelien Jarno Thu, 27 Oct 2005 03:18:43 +0200 -+ -+hddtemp (0.3-beta14-3) unstable; urgency=low -+ -+ * Don't try to read temperature from packet devices drives (closes: -+ bug#316750, bug#335571). -+ * Verify the response length when calling modesense (closes: -+ bug#278345). -+ -+ -- Aurelien Jarno Thu, 27 Oct 2005 01:02:21 +0200 -+ -+hddtemp (0.3-beta14-2) unstable; urgency=low -+ -+ * Added Swedish debconf translation. Thanks to Daniel Nylander (closes: -+ bug#333713). -+ -+ -- Aurelien Jarno Fri, 14 Oct 2005 11:22:05 +0200 -+ -+hddtemp (0.3-beta14-1) unstable; urgency=low -+ -+ * New upstream version. -+ -+ -- Aurelien Jarno Wed, 21 Sep 2005 14:48:43 +0200 -+ -+hddtemp (0.3-beta13-23) unstable; urgency=low -+ -+ * Added SAMSUNG SP2014N disk to the database. -+ -+ -- Aurelien Jarno Wed, 14 Sep 2005 11:27:22 +0200 -+ -+hddtemp (0.3-beta13-22) unstable; urgency=low -+ -+ * Updated hddtemp.db (closes: bug#326180, bug#326181). -+ -+ -- Aurelien Jarno Tue, 6 Sep 2005 03:51:29 +0200 -+ -+hddtemp (0.3-beta13-21) unstable; urgency=low -+ -+ * Added TOSHIBA MK4026GAX disk to the database (closes: bug#325702). -+ -+ -- Aurelien Jarno Wed, 31 Aug 2005 11:16:55 +0200 -+ -+hddtemp (0.3-beta13-20) unstable; urgency=low -+ -+ * Added Arabic debconf translation. Thanks to Mohammed Adnène Trojette -+ (closes: bug#320766). -+ -+ -- Aurelien Jarno Mon, 1 Aug 2005 15:40:56 +0200 -+ -+hddtemp (0.3-beta13-19) unstable; urgency=low -+ -+ * Fixed DISKS_NOPROBE when no other disks are detected. -+ * Added a logcheck rule to ignore sleeping drives (closes: bug#316613). -+ * Bumped Standards-Version to 3.6.2 (no changes). -+ -+ -- Aurelien Jarno Wed, 6 Jul 2005 19:15:16 +0200 -+ -+hddtemp (0.3-beta13-18) unstable; urgency=low -+ -+ * Added DISKS_NOPROBE option to the /etc/default/hddtemp (closes: -+ bug#316270). -+ -+ -- Aurelien Jarno Wed, 29 Jun 2005 22:13:53 +0200 -+ -+hddtemp (0.3-beta13-17) unstable; urgency=low -+ -+ * Updated database. -+ * Added support for Western Digital Caviar WD800BB (closes: bug#312247). -+ -+ -- Aurelien Jarno Thu, 9 Jun 2005 23:16:25 +0200 -+ -+hddtemp (0.3-beta13-16) unstable; urgency=low -+ -+ * Updated Vietnamese debconf translation. Thanks to Clytie Siddall (closes: -+ bug#311893). -+ * Fixed a typo in the debconf template. Thanks to Clytie Siddall (closes: -+ bug#311894). -+ -+ -- Aurelien Jarno Sat, 4 Jun 2005 17:03:31 +0200 -+ -+hddtemp (0.3-beta13-15) unstable; urgency=low -+ -+ * Updated German debconf translation. Thanks to Erik Schanze (closes: -+ bug#311716). -+ -+ -- Aurelien Jarno Fri, 3 Jun 2005 00:41:00 +0200 -+ -+hddtemp (0.3-beta13-14) unstable; urgency=low -+ -+ * Added SV4012H to the database. -+ -+ -- Aurelien Jarno Tue, 24 May 2005 00:54:01 +0200 -+ -+hddtemp (0.3-beta13-13) unstable; urgency=low -+ -+ * Added WD800BB-00JHA0 to the database (closes: bug#310301). -+ -+ -- Aurelien Jarno Mon, 23 May 2005 01:08:43 +0200 -+ -+hddtemp (0.3-beta13-12) unstable; urgency=low -+ -+ * Added HDS722512VLAT80 to the database (closes: bug#309011). -+ * Added Vietnamese debconf translation. Thanks to Clytie Siddall (closes: -+ bug#309451). -+ -+ -- Aurelien Jarno Mon, 16 May 2005 16:58:00 +0200 -+ -+hddtemp (0.3-beta13-11) unstable; urgency=low -+ -+ * Added WD2500JB-55GVA0 to the database (closes: bug#307673). -+ -+ -- Aurelien Jarno Wed, 4 May 2005 23:47:12 +0200 -+ -+hddtemp (0.3-beta13-10) unstable; urgency=high -+ -+ * Daemonization fixed (closes: bug#307113). -+ * Added HDS722525VLSA80 to the database (closes: bug#306691). -+ -+ -- Aurelien Jarno Mon, 2 May 2005 01:01:54 +0200 -+ -+hddtemp (0.3-beta13-9) unstable; urgency=low -+ -+ * Remove /etc/logcheck.ignore.workstation/hddtemp in postinst. -+ -+ -- Aurelien Jarno Fri, 22 Apr 2005 18:35:58 +0200 -+ -+hddtemp (0.3-beta13-8) unstable; urgency=low -+ -+ * Really applied Danish debconf template (closes: bug#302353). -+ * Updated Czech debconf template. Thanks to Miroslav Jezbera (closes: -+ bug#304716). -+ * Updated French debconf template. Thanks to Jean-Luc Coulon (closes: -+ bug#303061). -+ * Added WD2000JB-32EVA0 to hddtemp.deb (closes: bug#302760). -+ * Fixed logcheck ignore files (closes: bug#304110). -+ -+ -- Aurelien Jarno Fri, 15 Apr 2005 06:26:34 +0200 -+ -+hddtemp (0.3-beta13-7) unstable; urgency=low -+ -+ * Updated Danish debconf template. Thanks to Claus Hindsgaul (closes: -+ bug#302353). -+ -+ -- Aurelien Jarno Fri, 15 Apr 2005 06:15:19 +0200 -+ -+hddtemp (0.3-beta13-6) unstable; urgency=low -+ -+ * Updated Japanese debconf template. Thanks to Kenshi Muto (closes: -+ bug#302322). -+ -+ -- Aurelien Jarno Thu, 31 Mar 2005 12:26:56 +0200 -+ -+hddtemp (0.3-beta13-5) unstable; urgency=low -+ -+ * Fixed French debconf template. -+ -+ -- Aurelien Jarno Wed, 30 Mar 2005 22:59:34 +0200 -+ -+hddtemp (0.3-beta13-4) unstable; urgency=low -+ -+ * debian/templates: s/gkrellm-hdtemp/gkrellm/g (closes: bug#302178). -+ -+ -- Aurelien Jarno Wed, 30 Mar 2005 15:21:10 +0200 -+ -+hddtemp (0.3-beta13-3) unstable; urgency=medium -+ -+ * Don't listen on socket if only syslog is choosen in debconf. Thanks to -+ Mario Holbe for the patch (closes: bug#302065). -+ -+ -- Aurelien Jarno Wed, 30 Mar 2005 01:25:04 +0200 -+ -+hddtemp (0.3-beta13-2) unstable; urgency=medium -+ -+ * Try to detect cdrom drives using the ide-scsi driver (closes: -+ bug#302061). -+ -+ -- Aurelien Jarno Wed, 30 Mar 2005 00:38:49 +0200 -+ -+hddtemp (0.3-beta13-1) unstable; urgency=medium -+ -+ * New upstream version which contains the same code as in the previous -+ Debian package. -+ * Use SG_IO only when available (closes: bug#300679). -+ * Added syslog option in debconf (closes: bug#300332). -+ * Fixed the manpage (closes: bug#300332). -+ * Only disable SCSI exceptions if they are already enabled (closes: -+ bug#278345). -+ -+ -- Aurelien Jarno Tue, 29 Mar 2005 15:56:03 +0200 -+ -+hddtemp (0.3-beta12-16) unstable; urgency=low -+ -+ * Verify SATA magics in the ATA pass through subroutine. -+ -+ -- Aurelien Jarno Sun, 27 Feb 2005 16:51:48 +0100 -+ -+hddtemp (0.3-beta12-15) unstable; urgency=low -+ -+ * Change the way SATA disks are detected, so that there is no more -+ SCSI errors with SCSI disks. -+ * Print SCSI disks name in a smarter way. -+ * Updated database. -+ -+ -- Aurelien Jarno Fri, 25 Feb 2005 22:59:36 +0100 -+ -+hddtemp (0.3-beta12-14) unstable; urgency=low -+ -+ * Converted SCSI subroutines to SG_IO (closes: bug#235422, bug#275612, -+ bug#292205). -+ * Added support for SATA (closes: bug#227409). A kernel patch for -+ SATA is still need (see /usr/share/doc/hddtemp/README). -+ -+ -- Aurelien Jarno Fri, 25 Feb 2005 02:16:57 +0100 -+ -+hddtemp (0.3-beta12-13) unstable; urgency=low -+ -+ * Don't display an error message if /proc/sys/dev/cdrom/info doesn't -+ exist (systems without CDROM drives) (closes: bug#295814). -+ -+ -- Aurelien Jarno Fri, 18 Feb 2005 12:42:18 +0100 -+ -+hddtemp (0.3-beta12-12) unstable; urgency=low -+ -+ * Added Hitachi Deskstar 7K80 40G and 80GB disks. -+ -+ -- Aurelien Jarno Sun, 6 Feb 2005 17:49:15 +0100 -+ -+hddtemp (0.3-beta12-11) unstable; urgency=low -+ -+ * Uses /proc/sys/dev/cdrom/info instead of hardcoded paths to detect CDROM -+ drives (closes: bug#293542). -+ -+ -- Aurelien Jarno Fri, 4 Feb 2005 11:15:37 +0100 -+ -+hddtemp (0.3-beta12-10) unstable; urgency=low -+ -+ * Added a README.Debian to explain why the init script could not found -+ some disks. -+ -+ -- Aurelien Jarno Tue, 25 Jan 2005 16:46:53 +0100 -+ -+hddtemp (0.3-beta12-9) unstable; urgency=low -+ -+ * Updated Brasilian translation. Thanks to Tiago Bortoletto Vaz (closes: -+ bug#283832). -+ -+ -- Aurelien Jarno Wed, 1 Dec 2004 21:40:42 +0100 -+ -+hddtemp (0.3-beta12-8) unstable; urgency=low -+ -+ * Updated hddtemp.db. -+ * Added MHT2060AH drive (closes: bug#280805). -+ -+ -- Aurelien Jarno Wed, 1 Dec 2004 19:19:37 +0100 -+ -+hddtemp (0.3-beta12-7) unstable; urgency=low -+ -+ * Updated German debconf translation. Thanks to Erik Schanze (closes: -+ bug#282280). -+ -+ -- Aurelien Jarno Sun, 21 Nov 2004 16:22:41 +0100 -+ -+hddtemp (0.3-beta12-6) unstable; urgency=low -+ -+ * Don't abord the script if /dev/cdrom doesn't exists. -+ -+ -- Aurelien Jarno Mon, 25 Oct 2004 14:46:42 +0000 -+ -+hddtemp (0.3-beta12-5) unstable; urgency=low -+ -+ * Added a patch to allow temperatures to be logged to syslog (closes: -+ bug#271508). -+ * Added hddtemp-all.sh to contribs. Thanks to Javier Fernández-Sanguino -+ Peña (closes: bug#276444). -+ * /etc/init.d/hddtemp: skip CD and DVD drives. -+ -+ -- Aurelien Jarno Sun, 24 Oct 2004 17:30:34 +0200 -+ -+hddtemp (0.3-beta12-4) unstable; urgency=low -+ -+ * Print "done." in the init script when stopping hddtemp (closes: -+ bug#275952). -+ * Updated hddtemp.db with the latest available version. -+ -+ -- Aurelien Jarno Tue, 12 Oct 2004 10:10:01 +0100 -+ -+hddtemp (0.3-beta12-3) unstable; urgency=medium -+ -+ * Added support for WDC 200GB SE (closes: bug#275105). -+ -+ -- Aurelien Jarno Thu, 7 Oct 2004 21:01:15 +0200 -+ -+hddtemp (0.3-beta12-2) unstable; urgency=low -+ -+ * Added support for Maxtor MaXLine Plus II 250GB (closes: bug#274596). -+ * Added support for Travelstar 5K80 series (closes: bug#274671). -+ * Removed init message when the daemon is disabled. -+ -+ -- Aurelien Jarno Sun, 3 Oct 2004 19:40:23 +0200 -+ -+hddtemp (0.3-beta12-1) unstable; urgency=low -+ -+ * New upstream version. -+ -+ -- Aurelien Jarno Sat, 2 Oct 2004 01:47:19 +0200 -+ -+hddtemp (0.3-beta11-17) unstable; urgency=low -+ -+ * Detect sleeping drives in the init script (closes: bug#269462). -+ -+ -- Aurelien Jarno Wed, 1 Sep 2004 18:49:35 +0200 -+ -+hddtemp (0.3-beta11-16) unstable; urgency=low -+ -+ * Added support for Samsung SpinPoint PL40 serie. -+ * Added support for Western Digital 250GB Special Edition 8MB (closes: -+ bug#269342). -+ * Added support for Maxtor DiamondMax Plus 40 drives (closes: -+ bug#269346). -+ -+ -- Aurelien Jarno Wed, 1 Sep 2004 11:29:55 +0200 -+ -+hddtemp (0.3-beta11-15) unstable; urgency=low -+ -+ * Added Danish debconf translation. Thanks to Claus Hindsgaul (closes: -+ bug#267551). -+ * Added support for Western Digital 160GB Special Edition 8MB (closes: -+ bug#267492). -+ -+ -- Aurelien Jarno Tue, 31 Aug 2004 11:23:43 +0200 -+ -+hddtemp (0.3-beta11-14) unstable; urgency=medium -+ -+ * Let the kernel decide if we can access the device or not (closes: -+ bug#262742). -+ * Added an option to wake-up the driver if need (closes: #255308). -+ * Added IPv6 support. -+ -+ -- Aurelien Jarno Mon, 16 Aug 2004 15:36:00 +0200 -+ -+hddtemp (0.3-beta11-13) unstable; urgency=low -+ -+ * Added Czech debconf translation. Thanks to Miroslav Jezbera (closes: -+ bug#261284). -+ -+ -- Aurelien Jarno Sat, 31 Jul 2004 16:18:17 +0200 -+ -+hddtemp (0.3-beta11-12) unstable; urgency=low -+ -+ * Fixed manpage installation (closes: bug#258048, #258101). -+ -+ -- Aurelien Jarno Thu, 8 Jul 2004 02:08:00 +0200 -+ -+hddtemp (0.3-beta11-11) unstable; urgency=low -+ -+ * Print WARNING messages on stderr (closes: bug#254940). -+ -+ -- Aurelien Jarno Fri, 18 Jun 2004 00:17:08 +0200 -+ -+hddtemp (0.3-beta11-10) unstable; urgency=low -+ -+ * If a debconf answer is empty, ignore it (closes: bug#247026). -+ -+ -- Aurelien Jarno Tue, 4 May 2004 01:48:26 +0200 -+ -+hddtemp (0.3-beta11-9) unstable; urgency=low -+ -+ * The "Welcome to the 10 new EU members" release. -+ * Added --retry parameter when calling start-stop-daemon (closes: -+ bug#246028). -+ -+ -- Aurelien Jarno Sat, 1 May 2004 00:49:45 +0200 -+ -+hddtemp (0.3-beta11-8) unstable; urgency=low -+ -+ * Added support for Samsung P80 SATA drives (closes: bug#243464). -+ -+ -- Aurelien Jarno Tue, 13 Apr 2004 17:34:30 +0200 -+ -+hddtemp (0.3-beta11-7) unstable; urgency=low -+ -+ * Added support for Hitachi Deskstar 7K250 (closes: bug#241493). -+ -+ -- Aurelien Jarno Sun, 11 Apr 2004 16:37:51 +0200 -+ -+hddtemp (0.3-beta11-6) unstable; urgency=low -+ -+ * Added support for Western Digital WD1600JB-00FUA0 disk (closes: -+ bug#237983). -+ -+ -- Aurelien Jarno Tue, 16 Mar 2004 13:14:19 +0100 -+ -+hddtemp (0.3-beta11-5) unstable; urgency=low -+ -+ * Minor changes to debian/postinst script. -+ -+ -- Aurelien Jarno Sun, 8 Feb 2004 00:27:59 +0100 -+ -+hddtemp (0.3-beta11-4) unstable; urgency=low -+ -+ * Updated description (closes: bug#230507). -+ -+ -- Aurelien Jarno Sun, 1 Feb 2004 17:37:58 +0100 -+ -+hddtemp (0.3-beta11-3) unstable; urgency=low -+ -+ * Don't include asm headers on architectures that don't support -+ backtracing. -+ -+ -- Aurelien Jarno Sun, 25 Jan 2004 21:57:49 +0100 -+ -+hddtemp (0.3-beta11-2) unstable; urgency=low -+ -+ * Included upstream ChangeLog (closes: bug#226329). -+ -+ -- Aurelien Jarno Tue, 6 Jan 2004 03:16:37 +0100 -+ -+hddtemp (0.3-beta11-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Updated the database to version 03C. -+ -+ -- Aurelien Jarno Fri, 2 Jan 2004 10:05:21 +0100 -+ -+hddtemp (0.3-beta10-2) unstable; urgency=low -+ -+ * Disable backtracing on non-i386 architectures. -+ -+ -- Aurelien Jarno Mon, 15 Dec 2003 09:19:48 +0100 -+ -+hddtemp (0.3-beta10-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Updated debian/copyright. -+ -+ -- Aurelien Jarno Mon, 15 Dec 2003 08:24:37 +0100 -+ -+hddtemp (0.3-beta9-2) unstable; urgency=low -+ -+ * Moved ja.po in the right directory. -+ -+ -- Aurelien Jarno Fri, 12 Dec 2003 09:31:19 +0100 -+ -+hddtemp (0.3-beta9-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Updated the database to version 03B. -+ -+ -- Aurelien Jarno Fri, 12 Dec 2003 09:21:16 +0100 -+ -+hddtemp (0.3-beta8-7) unstable; urgency=low -+ -+ * Added po debconf translations. Thanks to Kenshi Muto. (closes: -+ bug#211954) -+ -+ -- Aurelien Jarno Sun, 21 Sep 2003 14:03:19 +0200 -+ -+hddtemp (0.3-beta8-6) unstable; urgency=low -+ -+ * Remove the link to /usr/sbin/hddtemp in /usr/bin when removing the -+ package (closes: bug#210609). -+ * Updated Policy standard compliance to 3.6.1 (no changes). -+ -+ -- Aurelien Jarno Fri, 12 Sep 2003 16:06:56 +0200 -+ -+hddtemp (0.3-beta8-5) unstable; urgency=low -+ -+ * Removed the single-quoting around the -s parameter in the init script -+ (closes: bug#208542). -+ -+ -- Aurelien Jarno Wed, 3 Sep 2003 19:02:24 +0200 -+ -+hddtemp (0.3-beta8-4) unstable; urgency=medium -+ -+ * Don't modify the config file in the config script (closes: bug#203583). -+ * Urgency set to medium as the bug breaks upgrade. -+ * The init script also stop manually started daemons. -+ * Added a small patch to make sure hddtemp could not be started in daemon -+ mode by a normal user even if it is SUID root. -+ -+ -- Aurelien Jarno Tue, 2 Sep 2003 14:52:03 +0200 -+ -+hddtemp (0.3-beta8-3) unstable; urgency=low -+ -+ * Don't strip the comments from the config file when installing the -+ package. -+ -+ -- Aurelien Jarno Mon, 1 Sep 2003 18:51:33 +0200 -+ -+hddtemp (0.3-beta8-2) unstable; urgency=low -+ -+ * Fixed a typo in the manpage. Thanks to Carlos Valdivia Yagüe. (Closes: -+ bug#205947). -+ -+ -- Aurelien Jarno Tue, 19 Aug 2003 09:19:04 +0200 -+ -+hddtemp (0.3-beta8-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Recoded the changelog in UTF-8. -+ -+ -- Aurelien Jarno Tue, 12 Aug 2003 01:14:19 +0200 -+ -+hddtemp (0.3-beta7-6) unstable; urgency=low -+ -+ * Fixed config and postinst scripts (closes: bug#203583). -+ -+ -- Aurelien Jarno Tue, 5 Aug 2003 09:16:11 +0200 -+ -+hddtemp (0.3-beta7-5) unstable; urgency=low -+ -+ * Fixed a typo in /etc/init.d/hddtemp (closes: bug#203441). -+ -+ -- Aurelien Jarno Wed, 30 Jul 2003 06:29:45 +0200 -+ -+hddtemp (0.3-beta7-4) unstable; urgency=low -+ -+ * Changed the DAEMON parameter in /etc/default/hddtemp to RUN_DAEMON -+ (closes: bug#203107). -+ * Updated the database to version 036. -+ * Updated Policy standard compliance to 3.6.0. -+ -+ -- Aurelien Jarno Mon, 28 Jul 2003 02:32:00 +0200 -+ -+hddtemp (0.3-beta7-3) unstable; urgency=low -+ -+ * Updated es debconf translations. Thanks to Carlos Valdivia Yagüe. -+ (closes: bug#198450). -+ * Updated the database to version 033. -+ -+ -- Aurelien Jarno Tue, 24 Jun 2003 01:12:00 +0200 -+ -+hddtemp (0.3-beta7-2) unstable; urgency=low -+ -+ * Updated fr debconf translations. Thanks to Michel Grentzin. -+ (closes: bug#198155) -+ * Added pt_BR debconf translations. Thanks to Andre Luis Lopes. -+ (closes: bug#198350) -+ -+ -- Aurelien Jarno Sun, 22 Jun 2003 02:55:59 +0200 -+ -+hddtemp (0.3-beta7-1) unstable; urgency=low -+ -+ * New upstream version with i18n support. -+ -+ -- Aurelien Jarno Mon, 16 Jun 2003 22:54:25 +0200 -+ -+hddtemp (0.3-beta6-9) unstable; urgency=low -+ -+ * Updated the database to version 032. -+ * Unmark some untranslatable strings in the master templates file. (closes: -+ bug#197642). -+ -+ -- Aurelien Jarno Mon, 16 Jun 2003 19:32:07 +0200 -+ -+hddtemp (0.3-beta6-8) unstable; urgency=low -+ -+ * Updated the database to version 030. -+ * Updated fr debconf translations. Thanks to Michel Grentzin. -+ (closes: bug#196765) -+ -+ -- Aurelien Jarno Mon, 9 Jun 2003 20:37:46 +0200 -+ -+hddtemp (0.3-beta6-7) unstable; urgency=low -+ -+ * Changed priority for debconf questions to more reasonable values. -+ * Updated the database to version 02F. -+ * Updated Policy standard compliance to 3.5.10. -+ -+ -- Aurelien Jarno Thu, 22 May 2003 23:43:24 +0200 -+ -+hddtemp (0.3-beta6-6) unstable; urgency=low -+ -+ * Don't mark /etc/default/hddtemp as a conffile, handle it entirely -+ in maintainer scripts (closes: bug#193466). -+ * Pass --ok-nodo argument to start-stop-daemon in init script when -+ stopping hddtemp (closes: bug#193622). -+ -+ -- Aurelien Jarno Sun, 18 May 2003 13:09:48 +0200 -+ -+hddtemp (0.3-beta6-5) unstable; urgency=low -+ -+ * Updated the database to version 02E. -+ * Don't save the fact that the daemon is running or not in debconf, but -+ rather in /etc/default/hddemp. -+ -+ -- Aurelien Jarno Sun, 11 May 2003 15:06:47 +0200 -+ -+hddtemp (0.3-beta6-4) unstable; urgency=low -+ -+ * Updated the upstream project homepage in debian/copyright (closes: -+ bug#190960). -+ -+ -- Aurelien Jarno Sun, 27 Apr 2003 17:46:53 +0200 -+ -+hddtemp (0.3-beta6-3) unstable; urgency=low -+ -+ * Updated the upstream project homepage in the description (closes: -+ bug#190929). -+ * Updated the database to version 02B. -+ -+ -- Aurelien Jarno Sun, 27 Apr 2003 11:40:14 +0200 -+ -+hddtemp (0.3-beta6-2) unstable; urgency=low -+ -+ * Added port and separator options to /etc/default/hddtemp. -+ * Added -l option to the manpage. -+ -+ -- Aurelien Jarno Thu, 3 Apr 2003 09:44:58 +0200 -+ -+hddtemp (0.3-beta6-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Updated database. -+ * Updated Policy standard compliance to 3.5.9. -+ -+ -- Aurelien Jarno Wed, 2 Apr 2003 22:54:01 +0200 -+ -+hddtemp (0.3-beta5-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Updated database. -+ * Added an option to listen on a specific interface (closes: bug#186062). -+ * Changed name displayed by /etc/init.d/hddtemp (closes: bug#187041). -+ -+ -- Aurelien Jarno Tue, 1 Apr 2003 02:24:53 +0200 -+ -+hddtemp (0.3-beta4-2) unstable; urgency=low -+ -+ * The "I have uploaded the wrong version" release. -+ * Fixed a bug in i18n.c. (closes: bug#185328). -+ -+ -- Aurelien Jarno Tue, 18 Mar 2003 20:32:03 +0100 -+ -+hddtemp (0.3-beta4-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Updated database. -+ * Improved /etc/init.d/hddtemp and added a config file in -+ /etc/default (Closes: bug#183843). Thanks to Greg Miller. -+ * Fixed a bug in i18n.c. -+ * Added homepage and author to the description. -+ * Debconf templates are now managed with po-debconf. -+ * Uses debian/compat instead of DH_COMPAT. -+ -+ -- Aurelien Jarno Mon, 17 Mar 2003 00:29:12 +0100 -+ -+hddtemp (0.3-beta3-3) unstable; urgency=low -+ -+ * Added patch to allow local port reuse in TIME_WAIT. -+ -+ -- Aurelien Jarno Sat, 25 Jan 2003 01:43:21 +0100 -+ -+hddtemp (0.3-beta3-2) unstable; urgency=low -+ -+ * Don't fail at postinst stage if daemon failed to start. (closes: -+ bug#177660) -+ -+ -- Aurelien Jarno Fri, 24 Jan 2003 21:21:41 +0100 -+ -+hddtemp (0.3-beta3-1) unstable; urgency=low -+ -+ * New upstream version including all the previous patches plus some fixes. -+ * Updated database. -+ -+ -- Aurelien Jarno Sun, 19 Jan 2003 21:27:30 +0100 -+ -+hddtemp (0.3-beta2-4) unstable; urgency=low -+ -+ * Added patch from Julien Blache to fix a lot of spelling mistakes. -+ Thanks ! -+ -+ -- Aurelien Jarno Sun, 19 Jan 2003 09:55:47 +0100 -+ -+hddtemp (0.3-beta2-3) unstable; urgency=low -+ -+ * Added an option to print only the temperature. Thanks to Julien Blache -+ for the patch. (closes: bug#176395) -+ * Fixed some warnings introduced by gcc-3.2. -+ -+ -- Aurelien Jarno Sun, 12 Jan 2003 12:30:49 +0100 -+ -+hddtemp (0.3-beta2-2) unstable; urgency=low -+ -+ * Merged hddtemp and hddtemp-daemon and added a debconf question -+ because the package was refused by the ftpmaster. -+ -+ -- Aurelien Jarno Wed, 8 Jan 2003 21:48:09 +0100 -+ -+hddtemp (0.3-beta2-1) unstable; urgency=low -+ -+ * New beta version. -+ * Added daemon mode init script to the new package hddtemp-daemon. -+ * Updated Policy standard compliance to 3.5.8. -+ -+ -- Aurelien Jarno Sat, 4 Jan 2003 10:04:16 +0100 -+ -+hddtemp (0.2-18) unstable; urgency=low -+ -+ * Updated database (version 021). -+ -+ -- Aurelien Jarno Sat, 28 Dec 2002 16:59:39 -0500 -+ -+hddtemp (0.2-17) unstable; urgency=low -+ -+ * Fixed copyright file. -+ * Removed debian/conffiles, this is handled by dh_installdeb automatically ; -+ otherwise we end up with each conffile being listed twice... -+ -+ -- Aurelien Jarno Tue, 17 Dec 2002 01:39:02 +0100 -+ -+hddtemp (0.2-16) unstable; urgency=low -+ -+ * Updated database (version 01f). -+ -+ -- Aurelien Jarno Tue, 17 Dec 2002 00:40:07 +0100 -+ -+hddtemp (0.2-15) unstable; urgency=low -+ -+ * Updated database (version 01D). -+ * Added disk model IC35L040AVVN07-0 (closes: bug#172117). Thanks to Henrique -+ de Moraes Holschuh. -+ -+ -- Aurelien Jarno Sat, 7 Dec 2002 16:47:41 +0100 -+ -+hddtemp (0.2-14) unstable; urgency=low -+ -+ * Corrected a bug affecting the display of the degree sign. -+ -+ -- Aurelien Jarno Thu, 26 Sep 2002 01:29:10 +0200 -+ -+hddtemp (0.2-13) unstable; urgency=low -+ -+ * Added support for other encodings than iso-8859-1. (closes:bug#158106) -+ * debian/hddtemp.1: corrected description of -f option. -+ -+ -- Aurelien Jarno Wed, 25 Sep 2002 14:26:20 +0200 -+ -+hddtemp (0.2-12) unstable; urgency=low -+ -+ * Updated database. -+ * Updated Policy standard compliance to 3.5.7 -+ -+ -- Aurelien Jarno Wed, 11 Sep 2002 14:21:49 +0200 -+ -+hddtemp (0.2-11) unstable; urgency=low -+ -+ * Updated database. -+ -+ -- Aurelien Jarno Wed, 14 Aug 2002 23:01:31 +0200 -+ -+hddtemp (0.2-10) unstable; urgency=low -+ -+ * Updated database. (closes: bug#149313) -+ -+ -- Aurelien Jarno Sat, 15 Jun 2002 00:00:48 +0200 -+ -+hddtemp (0.2-9) unstable; urgency=low -+ -+ * Corrected a bug affecting the display of the degree sign on some systems. -+ (closes: bug#147136, #147138) -+ -+ -- Aurelien Jarno Tue, 11 Jun 2002 19:34:03 +0200 -+ -+hddtemp (0.2-8) unstable; urgency=low -+ -+ * Corrected debconf template. (closes: bug#148146) -+ * Updated HDD database. -+ -+ -- Aurelien Jarno Sat, 25 May 2002 17:11:16 +0200 -+ -+hddtemp (0.2-7) unstable; urgency=low -+ -+ * Corrected the man page. -+ -+ -- Aurelien Jarno Sun, 19 May 2002 23:54:39 +0200 -+ -+hddtemp (0.2-6) unstable; urgency=low -+ -+ * Updated HDD database. -+ -+ -- Aurelien Jarno Sat, 18 May 2002 13:33:02 +0200 -+ -+hddtemp (0.2-5) unstable; urgency=low -+ -+ * Updated HDD database. -+ * Updated the man page. -+ -+ -- Aurelien Jarno Mon, 13 May 2002 06:40:08 +0200 -+ -+hddtemp (0.2-4) unstable; urgency=low -+ -+ * Moved /usr/share/hddtemp/hddtemp.db to /etc/hddtemp.db as conffile. -+ (closes: bug#146738) -+ -+ -- Aurelien Jarno Sun, 12 May 2002 19:50:23 +0200 -+ -+hddtemp (0.2-3) unstable; urgency=low -+ -+ * Added de debconf translations. -+ * Updated HDD database. -+ -+ -- Aurelien Jarno Sun, 12 May 2002 17:15:28 +0200 -+ -+hddtemp (0.2-2) unstable; urgency=low -+ -+ * Fixed typos and erroneous statement in description. (closes: bug#146551) -+ * Fixed manpage. (closes: bug#146554) -+ * A symlink to /usr/bin is made when installing hddtemp SUID root. -+ -+ -- Aurelien Jarno Sat, 11 May 2002 15:54:42 +0200 -+ -+hddtemp (0.2-1) unstable; urgency=low -+ -+ * Initial Release. (closes: bug#145611) -+ -+ -- Aurelien Jarno Thu, 9 May 2002 14:50:35 +0200 -+ ---- hddtemp-0.3-beta15.orig/debian/templates -+++ hddtemp-0.3-beta15/debian/templates -@@ -0,0 +1,63 @@ -+# These templates have been reviewed by the debian-l10n-english -+# team -+# -+# If modifications/additions/rewording are needed, please ask -+# debian-l10n-english@lists.debian.org for advice. -+# -+# Even minor modifications require translation updates and such -+# changes should be coordinated with translators and reviewers. -+ -+Template: hddtemp/SUID_bit -+Type: boolean -+Default: false -+_Description: Should /usr/sbin/hddtemp be installed SUID root? -+ You have the option of installing hddtemp with the SUID bit set, -+ allowing it to be run (reporting hard drive temperatures) by regular -+ users and not only the superuser. -+ . -+ This could potentially allow hddtemp to be used during an attack -+ against the computer's security. If in doubt, do not choose this option. -+ . -+ This setting can be modified later by running 'dpkg-reconfigure hddtemp'. -+ -+Template: hddtemp/syslog -+Type: string -+Default: 0 -+_Description: Interval between hard drive temperature checks: -+ The temperature of the hard drive(s) can be logged by hddtemp via -+ the generic system logging interface. -+ . -+ Please enter a value in seconds corresponding to the interval between -+ two checks. To disable this feature, enter 0. -+ -+Template: hddtemp/daemon -+Type: boolean -+Default: false -+_Description: Should the hddtemp daemon be started at boot? -+ The hddtemp program can be run as a daemon, listening on port 7634 -+ for incoming connections. It is used by some software such as gkrellm to get -+ the temperature of hard drives. -+ . -+ You have the option of starting the hddtemp daemon automatically on -+ system boot. If in doubt, it is suggested to not start it -+ automatically on boot. -+ . -+ This setting can be modified later by running 'dpkg-reconfigure hddtemp'. -+ -+Template: hddtemp/interface -+Type: string -+Default: 127.0.0.1 -+_Description: Interface to listen on: -+ The hddtemp program can listen for incoming connections on a specific -+ interface, or on all interfaces. -+ . -+ To listen on a specific interface, enter the IP address of that interface -+ (choosing 127.0.0.1 will accept local connections only). To listen on all interfaces, -+ enter 0.0.0.0. -+ -+Template: hddtemp/port -+Type: string -+Default: 7634 -+_Description: Port to listen on: -+ By default, hddtemp listens for incoming connections on port 7634. This -+ can be changed for another port number. ---- hddtemp-0.3-beta15.orig/debian/dirs -+++ hddtemp-0.3-beta15/debian/dirs -@@ -0,0 +1,3 @@ -+etc/init.d -+etc/default -+usr/share/doc/hddtemp ---- hddtemp-0.3-beta15.orig/debian/copyright -+++ hddtemp-0.3-beta15/debian/copyright -@@ -0,0 +1,26 @@ -+This package was debianized by Aurelien Jarno on -+Wed, 8 May 2002 01:40:30 +0200. -+ -+It was downloaded from http://www.guzu.net/linux/hddtemp.php -+ -+Upstream Author: Emmanuel Varagnat -+ -+Copyright: 2002, 2003 Emmanuel Varagnat -+ -+ 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. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License with -+ the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; -+ if not, write to the Free Software Foundation, Inc., 51 Franklin St, -+ Fifth Floor, Boston, MA 02110-1301 USA -+ -+ On Debian systems, the complete text of the GNU General Public -+ License, version 2, can be found in /usr/share/common-licenses/GPL-2. ---- hddtemp-0.3-beta15.orig/debian/logcheck.ignore.server -+++ hddtemp-0.3-beta15/debian/logcheck.ignore.server -@@ -0,0 +1,2 @@ -+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ hddtemp\[[0-9]+\]: /dev/([hs]d[a-z]|sg[0-9]): .*: [0-9]+ [CF]$ -+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ hddtemp\[[0-9]+\]: /dev/([hs]d[a-z]|sg[0-9]): .*: drive is sleeping$ ---- hddtemp-0.3-beta15.orig/debian/config -+++ hddtemp-0.3-beta15/debian/config -@@ -0,0 +1,51 @@ -+#!/bin/sh -+# hddtemp package configuration script -+ -+set -e -+ -+conffile="/etc/default/hddtemp" -+ -+get_config_file() -+{ -+ config_field=$1 -+ db_field=$2 -+ -+ if [ -f "$conffile" ] ; then -+ VALUE="$(grep "^[ ]*$config_field" $conffile | sed -e "s/^$config_field *= *\"\(.*\)\"/\1/g")" -+ if [ -n "$VALUE" ] ; then -+ db_set $db_field "$VALUE" -+ fi -+ fi -+} -+ -+# Source debconf library -- we have a Depends line -+# to make sure it is there... -+. /usr/share/debconf/confmodule -+db_version 2.0 -+ -+if [ "$1" = configure -o "$1" = reconfigure ] ; then -+ db_input medium hddtemp/SUID_bit || true -+ -+ get_config_file SYSLOG hddtemp/syslog -+ db_input medium hddtemp/syslog || true -+ -+ get_config_file DAEMON hddtemp/daemon -+ get_config_file RUN_DAEMON hddtemp/daemon -+ db_input medium hddtemp/daemon || true -+ -+ db_go -+ -+ db_get hddtemp/daemon -+ -+ if [ "$RET" = "true" ] ; then -+ get_config_file INTERFACE hddtemp/interface -+ db_input medium hddtemp/interface || true -+ -+ get_config_file PORT hddtemp/port -+ db_input medium hddtemp/port || true -+ -+ db_go -+ fi -+fi -+ -+exit 0 ---- hddtemp-0.3-beta15.orig/debian/postinst -+++ hddtemp-0.3-beta15/debian/postinst -@@ -0,0 +1,146 @@ -+#!/bin/sh -+# postinst script for hddtemp -+set -e -+ -+conffile="/etc/default/hddtemp" -+ -+update_config_file() -+{ -+ db_field=$1 -+ config_field=$2 -+ -+ RET=false -+ db_get $db_field -+ if [ -n "$RET" ] ; then -+ if grep -q "^$config_field" $conffile ; then -+ # keep any admin changes, while replacing the variable content -+ sed "s/^[ ]*$config_field=\".*\"/$config_field=\"$RET\"/" < $conffile > $conffile.new && -+ mv $conffile.new $conffile -+ else -+ echo "$config_field=\"$RET\"" >> $conffile -+ fi -+ fi -+} -+ -+# Source debconf library -- we have a Depends line -+# to make sure it is there... -+. /usr/share/debconf/confmodule -+db_version 2.0 -+ -+case "$1" in -+ configure) -+ if [ -f $conffile ] ; then -+ sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' \ -+ -e 's/^[ ]*SYSLOG/RUN_SYSLOG/g' \ -+ -e 's/^# Master system-wide hddtemp switch.*/# hddtemp network daemon switch. If set to true, hddtemp will listen/' \ -+ -e 's/^# set to true. STOP THE SERVICE.*/# for incoming connections./' \ -+ -e 's/^# Logging period.*temperatures.$/# Logging period (in seconds) for the temperatures. If set to a value\n# different than 0, hddtemp will run as a daemon periodically logging\n# the temperatures through syslog/' \ -+ $conffile -+ if ! grep -q RUN_SYSLOG $conffile ; then -+ cat << EOF >> $conffile -+ -+# Logging period (in seconds) for the temperatures. If set to a value -+# different than 0, hddtemp will run as a daemon periodically logging -+# the temperatures through syslog -+RUN_SYSLOG="0" -+EOF -+ fi -+ if ! grep -q OPTIONS $conffile ; then -+ cat << EOF >> $conffile -+ -+# Other options to pass to hddtemp -+OPTIONS="" -+EOF -+ fi -+ if ! grep -q DISKS_NOPROBE $conffile ; then -+ cat << EOF >> $conffile -+ -+# List of devices you want to use with hddtemp, but that would not be -+# probed for a working sensor. -+DISKS_NOPROBE="" -+EOF -+ fi -+ else -+ cat << EOF > $conffile -+# Defaults for hddtemp initscript (/etc/init.d/hddtemp) -+# This is a POSIX shell fragment -+ -+# [automatically edited by postinst, do not change line format ] -+ -+# hddtemp network daemon switch. If set to true, hddtemp will listen -+# for incoming connections. -+RUN_DAEMON="true" -+ -+# List of devices you want to use with hddtemp. If none specified, -+# hddtemp will probe standard devices. -+#DISKS="/dev/hda" -+ -+# List of devices you want to use with hddtemp, but that would not be -+# probed for a working sensor. -+DISKS_NOPROBE="" -+ -+# IP address of the interface on which you want hddtemp to be bound -+# on. If none specified, goes to 127.0.0.1. Use 0.0.0.0 to bind hddtemp -+# on all interfaces. -+INTERFACE="127.0.0.1" -+ -+# Port number on which you want hddtemp to listen on. If none specified, -+# the port 7634 is used. -+PORT="7634" -+ -+# Database file to use. If none specified, /etc/hddtemp.db is used. -+#DATABASE="/etc/hddtemp.db" -+ -+# Separator to use between fields. The default separator is '|'. -+#SEPARATOR="|" -+ -+# Logging period (in seconds) for the temperatures. If set to a value -+# different than 0, hddtemp will run as a daemon periodically logging -+# the temperatures through syslog -+RUN_SYSLOG="0" -+ -+# Other options to pass to hddtemp -+OPTIONS="" -+EOF -+ fi -+ -+ update_config_file hddtemp/daemon RUN_DAEMON -+ update_config_file hddtemp/syslog RUN_SYSLOG -+ update_config_file hddtemp/interface INTERFACE -+ update_config_file hddtemp/port PORT -+ -+ if ! dpkg-statoverride --list /usr/sbin/hddtemp 1>/dev/null 2>&1; then -+ # check if we are installing suid or not -+ RET=false -+ db_get hddtemp/SUID_bit -+ if [ "$RET" = "true" ]; then -+ chmod 4755 /usr/sbin/hddtemp -+ ln -sf /usr/sbin/hddtemp /usr/bin/hddtemp -+ ln -sf ../man8/hddtemp.8.gz /usr/share/man/man1/hddtemp.1.gz -+ else -+ chmod 0755 /usr/sbin/hddtemp -+ rm -f /usr/bin/hddtemp -+ rm -f /usr/share/man/man8/hddtemp.1.gz -+ fi -+ fi -+ -+ db_stop -+ -+ rm -f /etc/logcheck/ignore.d.workstation/hddtemp -+ ;; -+ abort-upgrade|abort-remove|abort-deconfigure) -+ ;; -+ -+ *) -+ echo "postinst called with unknown argument \`$1'" >&2 -+ exit 1 -+ ;; -+esac -+ -+ -+# dh_installdeb will replace this with shell code automatically -+# generated by other debhelper scripts. -+ -+#DEBHELPER# -+ -+exit 0 ---- hddtemp-0.3-beta15.orig/debian/control -+++ hddtemp-0.3-beta15/debian/control -@@ -0,0 +1,17 @@ -+Source: hddtemp -+Section: utils -+Priority: extra -+Maintainer: Aurelien Jarno -+Build-Depends: debhelper (>> 5), autotools-dev, gettext (>> 0.10.1) -+Standards-Version: 3.9.3 -+Homepage: http://www.guzu.net/linux/hddtemp.php -+ -+Package: hddtemp -+Architecture: any -+Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.0-3) -+Suggests: ksensors -+Conflicts: ksensors (<< 0.7-8), gkrellm-hddtemp (<< 0.1-9) -+Description: hard drive temperature monitoring utility -+ The hddtemp program monitors and reports the temperature of PATA, SATA -+ or SCSI hard drives by reading Self-Monitoring Analysis and Reporting -+ Technology (S.M.A.R.T.) information on drives that support this feature. ---- hddtemp-0.3-beta15.orig/debian/init -+++ hddtemp-0.3-beta15/debian/init -@@ -0,0 +1,100 @@ -+#!/bin/sh -+# -+# skeleton example file to build /etc/init.d/ scripts. -+# This file should be used to construct scripts for /etc/init.d. -+# -+# Written by Miquel van Smoorenburg . -+# Modified for Debian GNU/Linux -+# by Ian Murdock . -+# -+# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl -+# -+ -+### BEGIN INIT INFO -+# Provides: hddtemp -+# Required-Start: $remote_fs $syslog $network -+# Required-Stop: $remote_fs $syslog $network -+# Default-Start: 2 3 4 5 -+# Default-Stop: 0 1 6 -+# Short-Description: disk temperature monitoring daemon -+# Description: hddtemp is a disk temperature monitoring daemon -+### END INIT INFO -+ -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -+NAME=hddtemp -+DAEMON=/usr/sbin/$NAME -+DESC="disk temperature monitoring daemon" -+ -+DISKS="/dev/hd[a-z] /dev/hd[a-z][a-z]" -+DISKS="$DISKS /dev/sd[a-z] /dev/sd[a-z][a-z]" -+DISKS="$DISKS /dev/sr[a-z] /dev/sr[a-z][a-z]" -+INTERFACE="0.0.0.0" -+PORT="7634" -+SEPARATOR="|" -+RUN_SYSLOG="0" -+ -+# Reads config file (will override defaults above) -+[ -r /etc/default/hddtemp ] && . /etc/default/hddtemp -+ -+if [ -n "$RUN_SYSLOG" ] && [ "$RUN_SYSLOG" != "0" ] ; then -+ SYSLOG_ARG="-S $RUN_SYSLOG" -+fi -+ -+if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then -+ DAEMON_ARG="-d -l $INTERFACE -p $PORT -s $SEPARATOR" -+fi -+ -+[ -x "$DAEMON" ] || exit 0 -+ -+. /lib/lsb/init-functions -+ -+case "$1" in -+ start) -+ # master switch -+ if [ -n "$DAEMON_ARG" ] || [ -n "$SYSLOG_ARG" ] ; then -+ log_daemon_msg "Starting $DESC" "$NAME:" -+ CDROMS_LIST=$(sed -ne 's/^drive name:\t\+\(.*\)$/ \/dev\/\1/p' /proc/sys/dev/cdrom/info 2>/dev/null) || : -+ CDROMS_LIST="$CDROMS_LIST $(grep -sl '^ide-scsi ' /proc/ide/hd*/driver | awk -F / '{ print "/dev/"$4 }')" -+ for disk in $DISKS ; do -+ echo $CDROMS_LIST | grep -wq $disk && continue -+ echo $DISKS_NOPROBE | grep -wq $disk && continue -+ if $DAEMON -wn $OPTIONS $disk 2>/dev/null | grep -q '^[0-9]\+$' ; then -+ DISKS_LIST="$DISKS_LIST $disk"; -+ fi -+ done -+ if [ -n "$DISKS_LIST" ] || [ -n "$DISKS_NOPROBE" ] ; then -+ start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARG $SYSLOG_ARG $OPTIONS $DISKS_NOPROBE $DISKS_LIST -+ ret=$? -+ log_progress_msg "$DISKS_NOPROBE$DISKS_LIST" -+ log_end_msg $ret -+ else -+ log_progress_msg "no disks with monitoring capability were found." -+ log_end_msg 0 -+ fi -+ fi -+ ;; -+ stop) -+ # master switch -+ if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] || [ "$RUN_SYSLOG" != "0" ] ; then -+ log_daemon_msg "Stopping $DESC" "$NAME" -+ start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30 -+ log_end_msg $? -+ fi -+ ;; -+ force-reload|reload) -+ exit 3 -+ ;; -+ restart) -+ $0 stop && $0 start -+ ;; -+ status) -+ status_of_proc $DAEMON $NAME -+ exit $? -+ ;; -+ *) -+ echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2 -+ exit 1 -+ ;; -+esac -+ -+exit 0 ---- hddtemp-0.3-beta15.orig/debian/compat -+++ hddtemp-0.3-beta15/debian/compat -@@ -0,0 +1 @@ -+5 ---- hddtemp-0.3-beta15.orig/debian/README.Debian -+++ hddtemp-0.3-beta15/debian/README.Debian -@@ -0,0 +1,14 @@ -+README.Debian for hddtemp -+------------------------- -+ -+This package include an init script (/etc/init.d/hddtemp) to run hddtemp -+in daemon mode. To enable and configure it, either use -+'dpkg-reconfigure hddtemp' or edit /etc/default/hddtemp. -+ -+By default and when enable, the init script tries to find all disk that -+support SMART. If you get an error such as 'no disks with monitoring -+capability were found' or if an hard disk is not monitored, try to run -+'hddtemp /dev/xxx', with /dev/xxx being you hard disk device. You will -+see an explanation about why it fails. -+ -+ -- Aurelien Jarno Sun, 27 Jul 2008 09:34:39 +0200 ---- hddtemp-0.3-beta15.orig/debian/hddtemp.db -+++ hddtemp-0.3-beta15/debian/hddtemp.db -@@ -0,0 +1,169 @@ -+# -+# Insert a regular expression for support of the model or the serie of your hard drive. -+# If you don't know what to put in the second field, put the number -+# that appears most often for your brand :o) -+# A value of zero meens that we know that the drive doesn't have -+# a temperature sensor (you can set the unit to C or F). -+# -+############################################################################ -+# The following list was found at (http://www.almico.com/forumharddisks.php) -+# If your drive is in the list send me a mail. -+# -+# Manufacturer Model Size Notes -+# FUJITSU FUJITSU MPF3102AH 10.0GB -+# FUJITSU FUJITSU MPG3204AH E 20.0GB -+# FUJITSU FUJITSU MPG3307AT 30.0GB -+# FUJITSU FUJITSU MPG3409AH 40.0GB -+# FUJITSU FUJITSU MPG3409AH EF 40.0GB -+# HITACHI HITACHI_DK23CA-10 9.8GB -+# HITACHI HITACHI_DK23CA-15 14.7GB -+# SAMSUNG SAMSUNG SV3012H 29.4GB -+# SEAGATE ST310210A 10.0GB -+# SEAGATE ST310211A 9.8GB -+# SEAGATE ST310215A 10.0GB -+# SEAGATE ST315320A 14.9GB -+# SEAGATE ST320410A 19.6GB -+# SEAGATE ST320413A 19.6GB -+# SEAGATE ST320420A 19.9GB -+# SEAGATE ST330610A 29.3GB -+# SEAGATE ST330620A 29.3GB -+# SEAGATE ST330621A 29.3GB -+# SEAGATE ST330630A 29.9GB -+# SEAGATE ST340016A 39.1GB -+# SEAGATE ST340810ACE 39.1GB -+# SEAGATE ST380020ACE 78.2GB -+# WESTERN DIGITAL WDC AC210200D 10.0GB -+# WESTERN DIGITAL WDC AC29100D 8.9GB -+# WESTERN DIGITAL WDC AC420400D 19.9GB -+# WESTERN DIGITAL WDC WD102AA 10.0GB -+# -+################################################# -+ -+######################################## -+############# ExcelStor drives -+######################################## -+# "ExcelStor Technology CT215" ??? ? "ExcelStor CT215" -+ -+ -+######################################## -+############# Fujitsu drives -+######################################## -+"FUJITSU MHM2100AT" 0 C "Fujitsu MHM2100AT" -+ -+ -+######################################## -+############# Hitachi drives -+######################################## -+"HITACHI_DK228A-65" 0 C "Hitachi DK228A-65" -+ -+ -+######################################## -+############# IBM drives -+######################################## -+ -+# DJSA serie is using F0h command to report temperature and also have -+# SMART capabilties but it was reported not to work. -+# "DJSA-2(30|32|10|20|05)" 0 C "IBM Travelstar 20GN, 32GH, 30GT series" -+ -+"IBM-DARA-212000" 0 C "IBM Travelstar 12GN" -+"IBM-DTTA-35*" 0 C "IBM Deskstar 16GP serie" -+ -+# according to specifications they do not seems to have sensor -+# but I prefer waiting for a report -+#"IBM-DTTA-37*" 0 C "IBM Deskstar 14GXP serie" -+ -+"IBM-DJNA-35.*" 231 C "IBM Deskstar 25 GP serie" -+"IBM-DJNA-37.*" 231 C "IBM Deskstar 22 GXP serie" -+"IBM-DHEA-(34330|36480)" 0 C "IBM Deskstar 5 serie" -+"IBM-DHEA-(34331|36481|38451)" 0 C "IBM Deskstar 8 serie" -+"IBM-DPTA-37.*" 231 C "IBM Deskstar 34GXP serie" -+"IBM-DPTA-35.*" 231 C "IBM Deskstar 37GP serie" -+ -+ -+######################################## -+############# Maxtor drives -+######################################## -+#"Maxtor 2B0[012][04568]H1" ??? C "Maxtor Fireball 541DX" -+# which one must I trust ? -+#"Maxtor 4D040H2" 9 C "Maxtor DiamondMax D540X-4D" -+#"Maxtor 4D040H2" 0 C "Maxtor 4D040H2" -+#"Maxtor 4D080H4" 12 C "Maxtor DiamondMax D540X-4D" -+#"Maxtor 4D060H3" 12 C "Maxtor DiamondMax D540X-4D" -+#"Maxtor 4D080H4" 9 C "Maxtor DiamondMax D540X-4D" -+"Maxtor 5(1024|1369|2049|2732|3073|4098)U(2|3|4|6|8)" 0 C "Maxtor DiamondMax Plus 40" -+"Maxtor 5T0[24]0H[24]" 0 C "Maxtor DiamondMax Plus 60" -+"Maxtor 94098U8" 11 C "Maxtor DiamondMax 40 94098U8" -+ -+ -+######################################## -+############# Quantum drives -+######################################## -+"QUANTUM FIREBALLP AS40.0" 0 C "Quantum Fireball AS40" -+"QUANTUM FIREBALL CX10.2A" 0 C "Quantum Fireball CX10.2A" -+#"QUANTUM FIREBALLlct10 20" 4 C "Quantum Fireball CT10 20GB" -+# I suspect the QUANTUM FIREBALL_TM2110A to have a sensor in field 9... -+# "QUANTUM FIREBALL_TM2110A" 9 C "Quantum Fireball TM2110A" -+ -+ -+######################################## -+############# Samsung drives -+######################################## -+# somenone reported a problem with the SP8004H which reports a temperature -+# 10°C below the ambient temperature -+"SAMSUNG SW0434A" 0 C "Samsung SW0434A" -+"SAMSUNG SV0432A" 0 C "Samsung SV0432A" -+"SAMSUNG SV3002H" 0 C "Samsung SpinPoint V30 serie" -+#"SAMSUNG SV(0221|0602|0813|1204)H" 9 C "Samsung SpinPoint V60 serie" -+ -+ -+######################################## -+############# Seagate drives -+######################################## -+"Seagate Technology 1275MB - ST31276A" 0 C "Seagate ST31276A" -+"ST3412A" 0 C "Seagate ST3412A" -+"ST38641A" 0 C "Seagate ST38641A" -+"ST310210A" 0 C "Seagate ST310210A" -+"ST310220A" 0 C "Seagate ST310220A" -+# SEAGATE ST313021A 13.0GB -+"ST313021A" 0 C "Seagate U8 ST313021A" -+"ST310240A" 0 C "Seagate Medalist 10240 Ultra ATA-3" -+"ST320423A" 0 C "Seagate U10 20423, Ultra ATA/66" -+ -+ -+######################################## -+############# TOSHIBA Laptops -+######################################## -+"MK4313MAT" 220 C "Toshiba MK4313MAT" -+"TOSHIBA MK1517GAP" 0 C "Toshiba MK1517GAP" -+"TOSHIBA MK2018GAS" 226 F "Toshiba MK2018GAS" -+ -+"TOSHIBA MK3017GAP" 0 C "Toshiba MK3017GAP" -+ -+#"TOSHIBA MK4019GAX" 222 C "Toshiba MK4019GAX" -+ -+ -+######################################## -+############# Western Digital drives -+######################################## -+# WDC AC310100B and WDC AC2850F are reported not working -+# no more informations were given -+"WDC AC22000L" 0 C "Western Digital Caviar AC22000" -+"WDC AC420400D" 231 C "Western Digital Caviar AC420400D" -+"WDC AC418000D" 231 C "Western Digital AC418000D" -+"WDC WD135BA" 231 C "Western Digital WD135BA" -+ -+"WDC WD100EB-00BHF0" 0 C "Western Digital 100EB-00BHF0" -+"WDC WD200BB-00AUA1" 0 C "Western Digital Caviar WD200BB" -+#"WDC WD200BB-60DGA0" 0 C "Western Digital Caviar WD200BB" -+"WDC WD300BB-00CAA0" 0 C "Western Digital WD300BB" -+"WDC WD400BB-00CAA0" 0 C "Western Digital 400BB-00CAA0" -+#"WDC WD400BB-00GFA0" 0 C "" -+"WDC WD400BB-(18CA|00DE)A0" 0 C "Western Digital Caviar WD400BB" -+"WDC WD400EB-00CPF0" 0 C "Western Digital 400EB-00CPF0" -+"WDC WD600BB-32BSA0" 0 C "Western Digital 600BB-32BSA0" -+"WDC WD800BB-00CAA1" 0 C "Western Digital WD800BB-00CAA1" -+"WDC WD800JB-00CRA1" 0 C "Western Digital Caviar WD800JB" -+ -+# not sure for next -+# "WDC WD1200JB-00CRA1" 9 C "Western Digital 1200JB-00CRA1" -+# "WDC WD273BA" 9 C "Western Digital WD273BA" ---- hddtemp-0.3-beta15.orig/debian/po/cs.po -+++ hddtemp-0.3-beta15/debian/po/cs.po -@@ -0,0 +1,159 @@ -+# -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans -+# -+# Developers do not need to manually edit POT or PO files. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-05 21:54+0100\n" -+"Last-Translator: Miroslav Kure \n" -+"Language-Team: Czech \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Má se /usr/sbin/hddtemp nainstalovat jako SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Máte možnost nainstalovat hddtemp s nastaveným SUID bitem, což znamená, že " -+"jej kromÄ› správce budou moci spouÅ¡tÄ›t i běžní uživatelé (a zjišťovat teplotu " -+"pevného disku)." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Takto nastavený hddtemp může být potenciálnÄ› využit ke kompromitování " -+"poÄítaÄe. Pokud si nejste jisti, pak je lepší tuto možnost zamítnout." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "ZmÄ›níte-li pozdÄ›ji názor, staÄí spustit „dpkg-reconfigure hddtemp“." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Interval mezi kontrolami teploty pevného disku:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"hddtemp může zaznamenávat teplotu pevného disku (pevných disků) pÅ™es obecné " -+"logovací rozhraní systému." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Zadejte poÄet sekund odpovídající dobÄ› mezi po sobÄ› jdoucími měřeními. Pro " -+"zakázání této vlastnosti jednoduÅ¡e zadejte 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Má se daemon hddtemp spouÅ¡tÄ›t pÅ™i startu poÄítaÄe?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Program hddtemp může běžet jako daemon a Äekat na portu 7634 na příchozí " -+"spojení. Takto může být využíván programy typu gkrellm pro zjiÅ¡tÄ›ní aktuální " -+"teploty pevných disků." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Máte možnost spouÅ¡tÄ›t daemona hddtemp automaticky pÅ™i startu systému. Pokud " -+"si nejste jisti, pak jej radÄ›ji pÅ™i startu systému nespouÅ¡tÄ›jte." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Rozhraní, na kterém naslouchat:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Program hddtemp může oÄekávat příchozí spojení na konkrétním rozhraní nebo " -+"na vÅ¡ech rozhraních." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Aby poslouchal na konkrétním rozhraní, zadejte IP adresu daného rozhraní " -+"(127.0.0.1 znamená, že bude pÅ™ijímat pouze lokální spojení). Pokud chcete, " -+"aby poslouchal na vÅ¡ech rozhraních, zadejte 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port, na kterém naslouchat:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"hddtemp standardnÄ› oÄekává příchozí spojení na portu 7634. Pokud vám tento " -+"port nevyhovuje, můžete zadat jiný." ---- hddtemp-0.3-beta15.orig/debian/po/fr.po -+++ hddtemp-0.3-beta15/debian/po/fr.po -@@ -0,0 +1,159 @@ -+# Translation of hddtemp debconf templates to French -+# Copyright (C) 2008 Christian Perrier -+# This file is distributed under the same license as the hddtemp package. -+# -+# Michel Grentzinger , 2003. -+# Jean-Luc Coulon (f5ibh) -+# Christian Perrier , 2008. -+msgid "" -+msgstr "" -+"Project-Id-Version: \n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-10 12:20+0100\n" -+"Last-Translator: Christian Perrier \n" -+"Language-Team: French \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: KBabel 1.11.4\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Faut-il exécuter hddtemp avec les privilèges du superutilisateur ?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Il est possible d'installer hddtemp avec le bit « setuid » positionné, ce qui " -+"lui permet d'être exécuté (et donc d'indiquer la température des disques " -+"durs) par les utilisateurs non privilégiés et pas seulement le " -+"superutilisateur." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Cela peut théoriquement permettre d'utiliser hddtemp pour une attaque visant " -+"à compromettre la sécurité du système. Dans le doute, il est conseillé ne de " -+"pas activer cette option." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Ce choix peut être modifié ultérieurement avec la commande « dpkg-reconfigure " -+"hddtemp »." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Intervalle entre deux contrôles de température :" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"La température des disques durs peut être enregistrée par hddtemp et " -+"restituée par l'interface standard de journalisation du système." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Veuillez choisir l'intervalle en secondes entre deux mesures. Indiquez 0 " -+"pour désactiver cette fonctionnalité." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Faut-il lancer automatiquement le démon hddtemp au démarrage ?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Le programme hddtemp peut être lancé en tant que démon, à l'écoute sur le " -+"port 7634. Ce démon est utilisé par certains logiciels tel que gkrellm pour " -+"obtenir la température des disques durs." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Ce démon peut être lancé automatiquement au démarrage de l'ordinateur. Dans " -+"le doute, il est suggéré de ne pas activer cette option." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Interface où hddtemp sera à l'écoute :" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Le programme hddtemp peut être à l'écoute de connexions entrantes sur une " -+"interface spécifique ou sur toutes les interfaces." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Pour écouter sur une interface spécifique, indiquez l'adresse IP de cette " -+"interface (en choisissant 127.0.0.1, seules les connexions locales seront " -+"acceptées). Pour écouter sur toutes les interfaces, saisissez simplement " -+"0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port sur lequel hddtemp sera à l'écoute :" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Par défaut, hddtemp attend les connexions entrantes sur le port 7634. Ce " -+"port peut être modifié si nécessaire." ---- hddtemp-0.3-beta15.orig/debian/po/vi.po -+++ hddtemp-0.3-beta15/debian/po/vi.po -@@ -0,0 +1,154 @@ -+# Vietnamese Translation for hddtemp. -+# Copyright © 2008 Free Software Foundation, Inc. -+# Clytie Siddall , 2005-2008. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp_0.3-beta15-36\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-13 21:06+1030\n" -+"Last-Translator: Clytie Siddall \n" -+"Language-Team: Vietnamese \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=utf-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"Plural-Forms: nplurals=1; plural=0;\n" -+"X-Generator: LocFactoryEditor 1.7b3\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Có nên cài đặt SUID root « /usr/sbin/hddtemp » không?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Bạn có tùy chá»n cài đặt phần má»m hddtemp vá»›i bit SUID đã đặt, do đó cho phép " -+"nó được chạy bởi các ngưá»i dùng bình thưá»ng, không phải chỉ siêu ngưá»i dùng." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Tuy nhiên, đặt bit SUID cÅ©ng có thể cho phép ngưá»i hiểm độc dùng hddtemp khi " -+"tấn công bảo mật cá»§a máy tính này. Vì vậy nếu bạn chưa chắc chắn, đừng bật " -+"tùy chá»n này." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"CÅ©ng có thể sá»­a đổi thiết lập này vá» sau, bằng cách chạy lệnh cấu hình lại « " -+"dpkg-reconfigure hddtemp »." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Khoảng giữa hai lần kiểm tra nhiệt độ cá»§a đĩa cứng:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"Nhiệt độ cá»§a những đĩa cứng có thể được ghi lưu bởi hddtemp thông qua giao " -+"diện ghi lưu hệ thống chung." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Hãy nhập má»™t giá trị theo giây mà tương ứng vá»›i khoảng thá»i gian giữa hai " -+"lần kiểm tra. Äể tắt tính năng này, chỉ đơn giản nhập số 0 ở đây." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Có nên khởi chạy trình ná»n hddtemp khi khởi động hệ thống không?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Chương trình hddtemp cÅ©ng có thể chạy dưới dạng trình ná»n (daemon), lắng " -+"nghe trên cổng 7634 tìm kết nối gá»­i đến. Trình ná»n này được dùng bởi má»™t số " -+"phần má»m (v.d. gkrellm) để lấy nhiệt độ cá»§a các đĩa cứng." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Tùy chá»n bạn có thể tá»± động khởi chạy trình ná»n hddtemp khi khởi động hệ " -+"thống. Chưa chắc chắc thì khuyên bạn không bật tùy chá»n này." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Giao diện trên đó cần lắng nghe:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Chương trình hddtemp có thể lắng nghe kết nối gá»­i đến trên má»™t giao diện dứt " -+"khoát, hoặc trên má»i giao diện." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Äể lắng nghe trên má»™t giao diện cụ thể, hãy nhập địa chỉ IP cá»§a giao diện đó " -+"(giá trị « 127.0.0.0 » sẽ chỉ chấp nhận kết nối cục bá»™). Äể lắng nghe trên " -+"má»i giao diện, chỉ đơn giản hãy nhập địa chỉ « 0.0.0.0 »." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Cổng trên đó cần lắng nghe:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Mặc định là hddtemp lắng nghe kết nối gá»­i đến trên cổng 7634. CÅ©ng có thể " -+"thay đổi nó thành má»™t cổng khác." ---- hddtemp-0.3-beta15.orig/debian/po/pt_BR.po -+++ hddtemp-0.3-beta15/debian/po/pt_BR.po -@@ -0,0 +1,205 @@ -+# -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans -+# -+# Developers do not need to manually edit POT or PO files. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp_0.3-beta7-1\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2007-12-11 15:33+0100\n" -+"Last-Translator: Tiago Bortoletto Vaz \n" -+"Language-Team: Debian-BR Project \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=ISO-8859-1\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+#, fuzzy -+#| msgid "Do you want /usr/sbin/hddtemp to be installed SUID root?" -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Deseja que o /usr/sbin/hddtemp seja instalado SUID root ?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+#, fuzzy -+#| msgid "Do you want to start the hddtemp daemon on startup?" -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Deseja iniciar o daemon hddtemp na inicialização do sistema ?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+#, fuzzy -+#| msgid "" -+#| "hddtemp can be run as a daemon, listening on port 7634 for incoming " -+#| "connections. It is used some by software such as gkrellm to get the " -+#| "temperature of the hard drives." -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"O hddtemp pode ser executado com um daemon, ouvindo na porta 7634 por " -+"conexões entrantes. O mesmo é usado por alguns softwares como o gkrellm-" -+"hddtemp para obter a temperatura dos discos rígidos." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+#, fuzzy -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Você tem a opção de iniciar o daemon hddtemp automaticamente na " -+"inicialização de seu computador. Caso esteja em dúvida, é sugerido que você " -+"não inicie o hddtemp automaticamente na inicialização de seu computador. " -+"Caso você mude de idéia posteriormente você poderá executar o comando 'dpkg-" -+"reconfigure hddtemp' para mudar essa configuração." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+#, fuzzy -+#| msgid "" -+#| "hddtemp can listen for incoming connections on a specific interface, or " -+#| "on all interfaces." -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"O hddtemp pode ouvir por conexões entrantes em uma interface específica ou " -+"em todas as interfaces." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+#, fuzzy -+#| msgid "" -+#| "To listen on a specific interface, enter the IP address of that " -+#| "interface (127.0.0.1 which is the default value corresponds to the lo " -+#| "interface). To listen on all interfaces, simply enter 0.0.0.0." -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Para ouvir em uma interface específica, informe o endereço IP da interface " -+"em questão (o endereço padrão 127.0.0.1 corresponde a interface lo). Para " -+"ouvir e todas as interfaces, simplesmente informe o endereço 0.0.0.0 ." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+#, fuzzy -+#| msgid "" -+#| "By default, hddtemp listen for incoming connections on port 7634. However " -+#| "if you don't find this port appropriate, you can enter an other one." -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Por padrão, o hddtemp escuta por conexões entrantes na porta 7634. Porém " -+"caso você ache que essa não seja a porta apropriada, você pode informar uma " -+"outra porta." -+ -+#~ msgid "You have the option of installing hddtemp with the SUID bit set." -+#~ msgstr "Você tem a opção de instalar o hddtemp com o bit de SUID ligado." -+ -+#~ msgid "" -+#~ "If you make hddtemp SUID, unprivileged users of your systems will be able " -+#~ "to run it. This could, however, potentially allow hddtemp to be used " -+#~ "during a security attack on your computer. If in doubt, it is suggested " -+#~ "to install it without SUID. If you later change your mind, you can run: " -+#~ "'dpkg-reconfigure hddtemp'." -+#~ msgstr "" -+#~ "Caso você permita que o hdddtemp seja instalado com o bit de SUID ligado, " -+#~ "usuários não privilegiados de seu sistema serão capazes de executá-lo. " -+#~ "Isso pode, porém, potencialmente permitir que o hddtemp seja usado " -+#~ "durante um ataque contra a segurança de seu computador. Caso esteja em " -+#~ "dúvida, é sugerido que vcê instale o hddtemp sem o bit de SUID ligado. " -+#~ "Caso você mude de idéia posteriormente, você poderá executar o comando " -+#~ "'dpkg-reconfigure hddtemp' para mudar essa suaconfiguração." -+ -+#, fuzzy -+#~ msgid "At which interval do you want to log the temperatures?" -+#~ msgstr "Em qual interface você deseja que o hddtemp escute ?" -+ -+#~ msgid "On which interface do you want hddtemp to listen on?" -+#~ msgstr "Em qual interface você deseja que o hddtemp escute ?" -+ -+#~ msgid "On which port do you want hddtemp to listen on?" -+#~ msgstr "Em qual porta você deseja que o hddtemp escute ?" ---- hddtemp-0.3-beta15.orig/debian/po/ru.po -+++ hddtemp-0.3-beta15/debian/po/ru.po -@@ -0,0 +1,156 @@ -+# translation of ru.po to Russian -+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -+# This file is distributed under the same license as the PACKAGE package. -+# -+# Yuri Kozlov , 2008. -+msgid "" -+msgstr "" -+"Project-Id-Version: 0.3-beta15-39\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-01-27 19:15+0300\n" -+"Last-Translator: Yuri Kozlov \n" -+"Language-Team: Russian \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: KBabel 1.11.4\n" -+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" -+"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "УÑтановить /usr/sbin/hddtemp как SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Ð’Ñ‹ можете выбрать уÑтановку hddtemp Ñ Ð²ÐºÐ»ÑŽÑ‡Ñ‘Ð½Ð½Ñ‹Ð¼ SUID битом, чтобы её можно " -+"было запуÑкать проÑтым пользователÑм (Ð´Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ Ñ‚ÐµÐ¼Ð¿ÐµÑ€Ð°Ñ‚ÑƒÑ€ жёÑтких " -+"диÑков), а не только Ñуперпользователю." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Потенциально, Ñто может позволить иÑпользовать hddtemp Ð´Ð»Ñ Ð½Ð°Ñ€ÑƒÑˆÐµÐ½Ð¸Ñ " -+"компьютерной безопаÑноÑти. ЕÑли не уверены, ответьте отрицательно." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Эту наÑтройку можно позже изменить запуÑтив 'dpkg-reconfigure hddtemp'." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Интервал между проверками температуры жёÑткого диÑка:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"Температура жёÑткого диÑка(ов) может быть протоколироватьÑÑ hddtemp Ñ " -+"помощью Ñтандартного ÑиÑтемного интерфейÑа протоколированиÑ." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Введите значение интервала в Ñекундах между проверками. Ð”Ð»Ñ Ð²Ñ‹ÐºÐ»ÑŽÑ‡ÐµÐ½Ð¸Ñ " -+"проверок введите 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "ЗапуÑкать ÑÐµÑ€Ð²Ð¸Ñ hddtemp при Ñтарте компьютера?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Программа hddtemp может работать в виде ÑервиÑа, Ð¿Ñ€Ð¸Ð½Ð¸Ð¼Ð°Ñ Ð·Ð°Ð¿Ñ€Ð¾ÑÑ‹ на порту " -+"7634. Это иÑпользуетÑÑ Ð½ÐµÐºÐ¾Ñ‚Ð¾Ñ€Ñ‹Ð¼ ПО, например gkrellm, Ð´Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ " -+"температуры жёÑтких диÑков." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Ð¡ÐµÐ¹Ñ‡Ð°Ñ Ð²Ñ‹ можете включить автоматичеÑкий запуÑк ÑервиÑа hddtemp во Ð²Ñ€ÐµÐ¼Ñ " -+"загрузки ÑиÑтемы. ЕÑли не уверены, выберите не запуÑкать Ñту программу во " -+"Ð²Ñ€ÐµÐ¼Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Ð˜Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ð¿Ñ€Ð¸Ñ‘Ð¼Ð° запроÑов:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Программа hddtemp может принимать входÑщие запроÑÑ‹ на определённом " -+"интерфейÑе или Ñо вÑех интерфейÑов." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Ð”Ð»Ñ Ð¿Ñ€Ð¸Ñ‘Ð¼Ð° на конкретном интерфейÑа введите IP-Ð°Ð´Ñ€ÐµÑ Ñтого интерфейÑа (ввод " -+"127.0.0.1 обеÑпечит приём только локальных запроÑов). Ð”Ð»Ñ Ð¿Ñ€Ð¸Ñ‘Ð¼Ð° запроÑов Ñо " -+"вÑех интерфейÑов, введите 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Порт приёма запроÑов:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"По умолчанию, hddtemp принимает входÑщие запроÑÑ‹ Ñ Ð¿Ð¾Ñ€Ñ‚Ð° 7634. ЗдеÑÑŒ можно " -+"задать другой номер порта." ---- hddtemp-0.3-beta15.orig/debian/po/sv.po -+++ hddtemp-0.3-beta15/debian/po/sv.po -@@ -0,0 +1,127 @@ -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans -+# Developers do not need to manually edit POT or PO files. -+# , fuzzy -+# -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp 0.3-beta14-1\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-07-27 09:49+0200\n" -+"Last-Translator: Martin Bagge \n" -+"Language-Team: Swedish \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=iso-8859-1\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Vill du att /usr/sbin/hddtemp ska installeras som SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "You have the option of installing hddtemp with the SUID bit set, allowing it to be run (reporting hard drive temperatures) by regular users and not only the superuser." -+msgstr "Du kan installera hddtemp med SUID, då kan programmet köras av vanliga användare och inte bara superanvändare." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "This could potentially allow hddtemp to be used during an attack against the computer's security. If in doubt, do not choose this option." -+msgstr "Detta kan bidra till att intrång kan genomföras om det skulle finnas fel i hddtemp som någon nyttjar för att skaffa otillåten åtkomst. Om du är minsta osäker ska du inte aktivera detta alternativ." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+#: ../templates:4001 -+msgid "This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "Denna inställning kan ändras senare genom att köra 'dpkg-reconfige hddtemp'" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Intervall mellan temperaturmätningar:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "The temperature of the hard drive(s) can be logged by hddtemp via the generic system logging interface." -+msgstr "Temperaturen för hårddisken/hårddiskarna kan loggas i det vanliga loggningssystemet." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Please enter a value in seconds corresponding to the interval between two checks. To disable this feature, enter 0." -+msgstr "Ange ett värde i sekunder som anger intervallen mellan två mätningar. För att inaktivera den här funktionen, ange 0 som värde." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Vill du starta hddtemp-tjänsten när systemet startas upp?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "The hddtemp program can be run as a daemon, listening on port 7634 for incoming connections. It is used by some software such as gkrellm to get the temperature of hard drives." -+msgstr "hddtemp kan köras som en tjänst som lyssnar på port 7634 efter inkommande anslutningar. Den används av programvara såsom gkrellm för att läsa av temperaturen på hårddiskarna." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "You have the option of starting the hddtemp daemon automatically on system boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "Du har alternativet att starta hddtemp-tjänsten automatiskt när datorn startas upp. Om du är osäker föreslår jag att du inte startar den automatiskt vid uppstarten." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Gränssnitt att lyssna på:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "The hddtemp program can listen for incoming connections on a specific interface, or on all interfaces." -+msgstr "hddtemp kan lyssna efter inkommande anslutningar på specifika nätverksgränssnitt eller på gränssnitt." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"För att lyssna på ett specifik nätverkgränssnitt, ange IP-adressen på det " -+"gränssnittet (127.0.0.1, vilket är standardvärdet för gränssnittet lo). För " -+"att lyssna på alla, ange 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port att lyssna på:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Som standard lyssnar hddtemp efter inkommande anslutningar på port 7634. Om " -+"du anser att denna port inte är lämplig kan du ange en annan port här." -+ ---- hddtemp-0.3-beta15.orig/debian/po/da.po -+++ hddtemp-0.3-beta15/debian/po/da.po -@@ -0,0 +1,158 @@ -+# Danish translation hddtemp. -+# Copyright (C) 2010 hddtemp & nedenstÃ¥ende oversættere. -+# This file is distributed under the same license as the hddtemp package. -+# Claus Hindsgaul , 2004, 2005. -+# Claus Hindsgaul , 2006. -+# Joe Hansen (joedalton2@yahoo.dk), 2010. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2010-11-10 12:42+0000\n" -+"Last-Translator: Joe Hansen \n" -+"Language-Team: Danish \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"Plural-Forms: nplurals=2; plural=(n != 1);\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Skal /usr/sbin/hddtemp installeres SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Du har muligheden for at installere hddtemp med sættet SUID bit, og tillade " -+"den at blive kørt (rapportering af temperaturer for harddiske) af normale " -+"brugere og ikke kun superbrugeren." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Dette kan potentielt tillade hddtemp at blive brugt under et angreb mod " -+"computerens sikkerhed. Hvis du er i tvivl, sÃ¥ vælg ikke denne indstilling." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Denne indstilling kan ændres senere ved at køre »dpkg-reconfigure hddtemp«." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Tidsrum mellem to tjek af temperaturen pÃ¥ harddisken:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"Temperaturen pÃ¥ harddiskene kan logges af hddtemp via den generiske " -+"grænseflade til systemlogning." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Indtast venligst en værdi i sekunder, der angiver intervallet mellem to tjek. " -+"Du kan deaktivere denne funktion ved at skrive 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Skal hddtemp-dæmonen igangsættes ved opstart?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Programmet hddtemp kan køres som en dæmon, der lytter pÃ¥ port 7634 efter " -+"indkommende forbindelser. Programmet bruges af bestemte programmer sÃ¥som " -+"gkrellm til at hente harddiskenes temperaturer." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Du har mulighed for at igangsætte hddtemp-dæmonen automatisk under opstart. " -+"Hvis du er i tvivl, foreslÃ¥s det, at du ikke igangsætter den automatisk under " -+"opstarten." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Netkort, der skal lyttes pÃ¥:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Programmet hddtemp kan lytte efter indkommende forbindelser pÃ¥ et bestemt " -+"netkort eller pÃ¥ alle netkort." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"For at lytte til et bestemt netkort, skal du angive IP-adressen pÃ¥ dette " -+"(valg af 127.0.0.1 vil kun acceptere lokale forbindelser). For at " -+"lytte pÃ¥ alle netkort indtastes 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port, der skal lyttes pÃ¥:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Som udgangspunkt vil hddtemp lytte efter indkommende forbindelser pÃ¥ port " -+"7634. Dette kan ændres til et andet nummer." -+ -+ ---- hddtemp-0.3-beta15.orig/debian/po/pt.po -+++ hddtemp-0.3-beta15/debian/po/pt.po -@@ -0,0 +1,158 @@ -+# translation of pt.po to portugues -+# Portuguese translation for hddtemp -+# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. -+# This file is distributed under the same license as the hddtemp package. -+# -+# Miguel Figueiredo , 2006, 2007. -+# Bruno Queiros , 2007. -+# Bruno Queiros , 2008. -+msgid "" -+msgstr "" -+"Project-Id-Version: pt\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-10 19:48+0000\n" -+"Last-Translator: Bruno Queiros \n" -+"Language-Team: portugues \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: KBabel 1.11.4\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Deve o /usr/sbin/hddtemp ser instalado com SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Você tem a opção de instalar o hddtemp com o SUID, permitindo-o ser " -+"executado (relatar temperaturas do disco rigido) por utilizadores normais e " -+"não apenas pelo super utilizador." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Isto pode potencialmente permitir que o hddtemp seja utilizado num ataque " -+"contra a segurança do computador. Em caso de dúvida, não escolha esta opção." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Esta opção pode ser modificada mais tarde executando 'dpkg-reconfigure " -+"hddtemp'." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Intervalo entre verificações da temperatura do disco rigido:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"A temperatura do(s) disco(s) rígido(s) podem ser guardados pelo hddtemp " -+"através da interface genérica do sistema para guardar registos." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Por favor introduza um valor em segundos correspondendo ao intervalo entre " -+"duas verificações. Para desactivar esta opção, introduza 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Deseja iniciar o daemon hddtemp no arranque?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"O programa hddtemp pode ser executado como um daemon, à escuta na porta " -+"7634. É utilizada por alguns programas como o gkrellm para obter a " -+"temperatura dos discos rígidos." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Você tem a opção de executar o daemon hddtemp automaticamente no arranque do " -+"sistema. Se estiver em dúvida, é sugerido que não o inicie automaticamente " -+"no arranque." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Interface para utilizar na escuta:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"O programa hddtemp pode escutar por ligações de entrada numa interface " -+"específica, ou em todas as interfaces." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Para escutar numa interface específica, introduza o endereço IP dessa " -+"interface (escolhendo 127.0.0.1 irá aceitar apenas ligações locais). Para " -+"escutar em todas as interfaces, introduza 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Porta a utilizar na escuta:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"O hddtemp escuta por ligações de entrada na porta 7634 por pré-definição. " -+"Isto pode ser alterado para outra porta." ---- hddtemp-0.3-beta15.orig/debian/po/eu.po -+++ hddtemp-0.3-beta15/debian/po/eu.po -@@ -0,0 +1,111 @@ -+# SOME DESCRIPTIVE TITLE. -+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -+# This file is distributed under the same license as the PACKAGE package. -+# Piarres Beobide , 2008. -+ -+ -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp-debconf\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-14 12:11+0100\n" -+"Last-Translator: Piarres Beobide \n" -+"Language-Team: Euskara \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=utf-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "/usr/sbin/hddtemp SUID bit-a gaiturik duela instalatu behar da?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "You have the option of installing hddtemp with the SUID bit set, allowing it to be run (reporting hard drive temperatures) by regular users and not only the superuser." -+msgstr "Zuk hddtemp SUID bit-a ezarria duela instalatzeko aukera duzu supererabiltzaileak bakarrik beharrean erabiltzaile arrunti exekutatzeko (disko gogor tenperaturak erreportatzeko) baimena emanez." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "This could potentially allow hddtemp to be used during an attack against the computer's security. If in doubt, do not choose this option." -+msgstr "Honek ordenagailuari eraso batetan hddtemp erabiltzeko aukera ematen du. Zalantzarik baduzu ez hautatu aukera hau." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+#: ../templates:4001 -+msgid "This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "Ezarpen hau beranduago aldatu daiteke 'dpkg-reconfigure hddtemp' abiaraziz." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Disko gogor tenperatura arakatzeen arteko denbora tartea:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "The temperature of the hard drive(s) can be logged by hddtemp via the generic system logging interface." -+msgstr "Hddtemp-ek disko gorren tenperatura sistemako erregistro interfaze orokorraren bidez erregistratu dezake." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Please enter a value in seconds corresponding to the interval between two checks. To disable this feature, enter 0." -+msgstr "Mesedez idatzi bi arakatzeen arteko denbora tartea segunduetan. Ezaugarri hau ezgaitzeko 0 ezarri." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Hddtemp deabrua sistema abiaraztean abiarazi behar al da?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "The hddtemp program can be run as a daemon, listening on port 7634 for incoming connections. It is used by some software such as gkrellm to get the temperature of hard drives." -+msgstr "Hddtemp programa deabru bat bezala erabili daiteke, sarrera konexioak 7624 atakan entzungo ditu. Hau gkrellm bezalako zenbait softwarek disko gogorren tenperatura eskuratzeko erabiltzen dute." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "You have the option of starting the hddtemp daemon automatically on system boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "Zuk hddtemp deabrua sistema abiaraztean automatikoki abiarazteko aukera duzu. Zalantzarik baduzu abioan ez automatikoki abiaraztea gomendatzen da." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Entzungo den interfazea:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "The hddtemp program can listen for incoming connections on a specific interface, or on all interfaces." -+msgstr "Hddtemp programak sarrera konexioak interfaze zehatz batetan bakarrik edo guztietan entzuteko aukera du." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "To listen on a specific interface, enter the IP address of that interface (choosing 127.0.0.1 will accept local connections only). To listen on all interfaces, enter 0.0.0.0." -+msgstr "Interfaze zehatz batetan entzuteko, idatzi interfaze horren IP helbidea (127.0.0.1 ipiniaz konexioa lokalak bakarrik onartuko dira). Interfaze guztietan entzuteko , 0.0.0.0 idatzi." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Entzuteko ataka:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "By default, hddtemp listens for incoming connections on port 7634. This can be changed for another port number." -+msgstr "Lehenetspen modura hddtemp-ek sarrera konexioak 7634 atakan entzungo ditu. Auker ahonen bidez betste ataka bat ezartzeko auekra dago." -+ ---- hddtemp-0.3-beta15.orig/debian/po/it.po -+++ hddtemp-0.3-beta15/debian/po/it.po -@@ -0,0 +1,155 @@ -+# Italian translation of the hddtemp debconf template -+# This file is distributed under the same license as the hddtemp package -+# Copyright (C) 2008 Free Software Foundation, Inc. -+# Luca Monducci , 2008. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp 0.3\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-09 21:52+0100\n" -+"Last-Translator: Luca Monducci \n" -+"Language-Team: Italian \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Installare /usr/sbin/hddtemp con il SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"È possibile installare hddtemp con il bit SUID attivo, questo consente a un " -+"utente normale, e non solo al superuser, di eseguire il programma " -+"(riportando le temperature dei dischi)." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Questo potrebbe permettere l'uso di hddtemp durante un attacco alla " -+"sicurezza del sistema. In caso di dubbi, non attivare questa opzione." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"In seguito, per modificare questa impostazione si può usare \"dpkg-" -+"reconfigure hddtemp\"." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Intervallo fra due controlli della temperatura dei dischi:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"La temperatura dei dischi può essere registrata da hddtemp tramite " -+"l'interfaccia generica offerta dal log di sistema." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Inserire il valore in secondi corrispondente all'intervallo fra due " -+"controlli. Per non utilizzare questa funzionalità inserire 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Far partire il demone hddtemp all'avvio del sistema?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Il programma hddtemp può essere avviato come un demone in ascolto di " -+"connessioni in arrivo sulla porta 7634. Viene usato da programmi come " -+"gkrellm per recuperare la temperatura dei dischi fissi." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"È possibile far partire automaticamente il demone hddtemp all'avvio del " -+"sistema. In caso di dubbi, si suggerisce di non far partire il demone " -+"all'avvio." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Interfaccia su cui ascoltare:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Il programma hddtemp può mettersi in ascolto di connessioni in arrivo su una " -+"particolare interfaccia oppure su tutte." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Per ascoltare su una specifica interfaccia, inserire l'indirizzo IP di tale " -+"interfaccia (con 127.0.0.1 saranno accettate solo connesioni locali). Per " -+"ascoltare su tutte le interfacce inserire 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Porta su cui ascoltare:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Con la configurazione predefinita hddtemp si mette in ascolto di connessioni " -+"in arrivo sulla porta 7634. È possibile cambiare questo valore con un altro " -+"numero di porta." ---- hddtemp-0.3-beta15.orig/debian/po/de.po -+++ hddtemp-0.3-beta15/debian/po/de.po -@@ -0,0 +1,164 @@ -+# translation of hddtemp_0.3-beta15-39_de.po to German -+# -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans# -+# Developers do not need to manually edit POT or PO files. -+# -+# Erik Schanze , 2004-2008. -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp_0.3-beta15-39_de\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-01-27 21:18+0100\n" -+"Last-Translator: Erik Schanze \n" -+"Language-Team: German \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: KBabel 1.11.4\n" -+"Plural-Forms: nplurals=2; plural=(n != 1);\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Soll /usr/sbin/hddtemp mit Root-Rechten ausgestattet werden?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Sie haben die Möglichkeit, Hddtemp bei der Installation mit Root-Rechten " -+"auszustatten. Damit kann es von jedem normalen Benutzer (und nicht nur von " -+"Root) gestartet werden, um die Festplattentemperatur zu melden." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Dadurch könnte es aber möglich sein, die Sicherheit des Rechners " -+"anzugreifen. Wenn Sie sich nicht sicher sind, lehnen Sie hier ab." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Diese Einstellung kann später durch den Befehl 'dpkg-reconfigure hddtemp' " -+"geändert werden." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Zeitraum zwischen den Überprüfungen der Festplattentemperatur:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"Die Temperatur der Festplatte(n) kann von Hddtemp mittels der allgemeinen " -+"System-Protokollierschnittstelle fortlaufend gespeichert werden." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Bitte geben Sie die Zeitspanne zwischen zwei Überprüfungen in Sekunden ein. " -+"Um diese Funktion abzuschalten, geben Sie 0 ein." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Den Hddtemp-Dienst beim Hochfahren des Systems starten?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Hddtemp kann als Dienst betrieben werden und wartet am Port 7634 auf " -+"ankommende Verbindungen. Das wird von einigen Programmen wie Gkrellm " -+"genutzt, um die Temperatur der Festplatten abzufragen." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Sie haben die Möglichkeit, den Dienst Hddtemp beim Hochfahren des Systems " -+"automatisch zu starten. Wenn Sie sich nicht sicher sind, starten Sie den " -+"Dienst nicht automatisch beim Hochfahren." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Schnittstelle, an der auf Anfragen gewartet wird:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Hddtemp kann an einer speziellen oder an allen Schnittstelle auf ankommende " -+"Verbindungen warten." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Um an einer einzelnen Schnittstelle auf Anfragen zu warten, geben Sie deren " -+"IP-Adresse ein (Falls Sie 127.0.0.1 wählen, sind nur lokale Verbindungen " -+"erlaubt). Um alle Schnittstellen zu verwenden, geben Sie 0.0.0.0 ein." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port, an dem auf Anfragen gewartet wird:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Normalerweise wartet Hddtemp am Port 7634 auf ankommende Verbindungen. Sie " -+"können auch eine andere Port-Nummer eingeben." ---- hddtemp-0.3-beta15.orig/debian/po/gl.po -+++ hddtemp-0.3-beta15/debian/po/gl.po -@@ -0,0 +1,176 @@ -+# Galician translation of hddtemp's debconf templates -+# This file is distributed under the same license as the hddtemp package. -+# Jacobo Tarrio , 2007, 2008. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-01-28 19:08+0000\n" -+"Last-Translator: Jacobo Tarrio \n" -+"Language-Team: Galician \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "¿Quere instalar /usr/sbin/hddtemp con \"setuid\" root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Ten a posibilidade de instalar hddtemp co bit SUID establecido, o que o " -+"permite executar (para que informe da temperatura dos discos duros) por " -+"parte de usuarios normais, e non só o administrador." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Con isto é posible que se empregue hddtemp durante un ataque contra a " -+"seguridade do ordenador. Se non está seguro, non escolla esta opción." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Esta elección pódese cambiar a posteriori executando \"dpkg-reconfigure " -+"hddtemp\"." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Intervalo entre comprobacións da temperatura do disco duro:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"O programa hddtemp pode manter un rexistro da temperatura do(s) disco(s) duro" -+"(s) empregando a interface xenérica de rexistro do sistema." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Introduza un valor en segundos correspondente ao intervalo entre " -+"comprobacións. Para desactivar esta característica, introduza un 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "¿Quere iniciar o servizo de hddtemp co sistema?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Pódese executar o programa hddtemp coma un servizo que espera conexións " -+"entrantes no porto 7634. Emprégao algún software coma gkrellm para obter a " -+"temperatura dos discos duros." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Ten a posibilidade de arrincar o servizo hddtemp automaticamente ao iniciar " -+"o sistema. Se ten dúbidas, suxírese que non o arrinque automaticamente ao " -+"iniciar o sistema." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Interface na que escoitar:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"O programa hddtemp pode esperar conexións entrantes nunha interface " -+"determinada ou en tódalas interfaces." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Para escoitar nunha interface determinada, introduza o enderezo IP desa " -+"interface (se escolle 127.0.0.1 hanse aceptar só conexións locais). Para " -+"escoitar en tódalas interfaces, introduza 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Porto no que escoitar:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Por defecto, hddtemp espera conexións entrantes no porto 7634. Pódese " -+"cambiar por outro porto." -+ -+#~ msgid "You have the option of installing hddtemp with the SUID bit set." -+#~ msgstr "Ten a posibilidade de instalar hddtemp co bit SUID activado." -+ -+#~ msgid "" -+#~ "If you make hddtemp SUID, unprivileged users of your systems will be able " -+#~ "to run it. This could, however, potentially allow hddtemp to be used " -+#~ "during a security attack on your computer. If in doubt, it is suggested " -+#~ "to install it without SUID. If you later change your mind, you can run: " -+#~ "'dpkg-reconfigure hddtemp'." -+#~ msgstr "" -+#~ "Se lle pon o bit SUID a hddtemp, os usuarios sen privilexios dos seus " -+#~ "sistemas han poder executalo. Nembargantes, isto pode permitir que se " -+#~ "empregue hddtemp durante un ataque á seguridade do seu ordenador. Se ten " -+#~ "dúbidas, é mellor que o instale sen SUID. Se cambia de opinión máis " -+#~ "adiante, pode executar \"dpkg-reconfigure hddtemp\"." -+ -+#~ msgid "" -+#~ "hddtemp can periodically log the temperature of the hard drive(s) via the " -+#~ "SYSLOG interface." -+#~ msgstr "" -+#~ "hddtemp pode rexistrar periodicamente a temperatura das unidades de disco " -+#~ "mediante a interface SYSLOG." ---- hddtemp-0.3-beta15.orig/debian/po/ar.po -+++ hddtemp-0.3-beta15/debian/po/ar.po -@@ -0,0 +1,209 @@ -+# translation of ar.po to -+# -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans# -+# Developers do not need to manually edit POT or PO files. -+# -+# Ossama M. Khayat, 2005. -+# Ossama M. Khayat , 2010. -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp_0.3-beta13-19\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2010-09-09 04:48+0300\n" -+"Last-Translator: Ossama M. Khayat \n" -+"Language-Team: Arabic \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: Lokalize 1.0\n" -+"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " -+"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+#| msgid "Do you want /usr/sbin/hddtemp to be installed SUID root?" -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "هل يجب تثبيت /usr/sbin/hddtemp مع صلاحية SUID للمستخدم rootØŸ" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"لديك خيار تثبيت hddtemp مع صلاحية SUIDØŒ مما يسمح" -+"للمستخدمين العاديين تشغيله (تقرير درجات حرارة القرص الصلب) وليس Ùقط " -+"المستخدم الخارق." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"قد يتسبب هذا باستخدام hddtemp أثناء الهجوم على" -+"أمن الجهاز. إن كنت ÙÙŠ شك، لا تنتق هذا الخيار." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "يمكن تعديل هذا الإعداد لاحقاً بتنÙيذ الأمر 'dpkg-reconfigure hddtemp'." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Ø§Ù„ÙØ§ØµÙ„ الزمني للتحقق من حرارة القرص الصلب:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"يستطيع hddtemp تسجيل حرارة الأقراص الصلبة عبر " -+"واجهة سجلات النظام الاعتيادية." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+#| msgid "" -+#| "Please enter a value in seconds corresponding to the interval between two " -+#| "checks. To disable this feature, simply enter 0." -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"الرجاء إدخال قيمة بالثواني تحدد Ø§Ù„ÙØ§ØµÙ„ الزمني بين كل " -+"عملية. لتعطيل هذه الميزة، أدخل 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+#| msgid "Do you want to start the hddtemp daemon on startup?" -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "هل تريد تشغيل Ø¹ÙØ±ÙŠØª hddtemp عند الإقلاع؟" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+#| msgid "" -+#| "hddtemp can be run as a daemon, listening on port 7634 for incoming " -+#| "connections. It is used some by software such as gkrellm to get the " -+#| "temperature of the hard drives." -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"يمكن تشغيل برنامج hddtemp ÙƒØ¹ÙØ±ÙŠØªØŒ ÙŠÙØµØºÙŠ Ù„Ù„Ù…Ù†ÙØ° 7634 لأي" -+"اتصالات واردة. ÙŠÙØ³ØªØ®Ø¯Ù… البرنامج من قبل بعض البرامج الأخرى مثل gkrellm " -+"لمراقبة " -+"درجة حرارة الأقراص الصلبة." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+#| msgid "" -+#| "You have the option of starting the hddtemp daemon automatically on the " -+#| "computer startup. If in doubt, it is suggested to not start it " -+#| "automatically on startup. If you later change your mind, you can run: " -+#| "'dpkg-reconfigure hddtemp'." -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"لديك خيار تشغيل Ø¹ÙØ±ÙŠØª hddtemp آلياً عند إقلاع " -+"النظام. إن كنت ÙÙŠ شك، يقترح عدم تشغيله آلياً عند الإقلاع." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "الواجهة التي يصغي إليها:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+#| msgid "" -+#| "hddtemp can listen for incoming connections on a specific interface, or " -+#| "on all interfaces." -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"يستطيع برنامج hddtemp الإصغاء للاتصالات الواردة على واجهة " -+"محددة، أو جميع الواجهات." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+#| msgid "" -+#| "To listen on a specific interface, enter the IP address of that " -+#| "interface (127.0.0.1 which is the default value corresponds to the lo " -+#| "interface). To listen on all interfaces, simply enter 0.0.0.0." -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"للإصغاء إلى واجهة محددة، أدخل عنوان IP لتلك الواجهة " -+"(اختيار 127.0.0.1 سو٠يستقبل الاتصالات المحلية Ùقط). للإصغاء لجميع " -+"الواجهات، أدخل القيمة 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Ø§Ù„Ù…Ù†ÙØ° الذي يصغي إليه:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+#| msgid "" -+#| "By default, hddtemp listen for incoming connections on port 7634. However " -+#| "if you don't find this port appropriate, you can enter an other one." -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"بشكل Ø§ÙØªØ±Ø§Ø¶ÙŠØŒ يستمع hddtemp للاتصالات الواردة على Ø§Ù„Ù…Ù†ÙØ° 7634. ويمكن" -+"تغيير هذا الرقم إلى آخر." -+ -+#~ msgid "You have the option of installing hddtemp with the SUID bit set." -+#~ msgstr "لديك خيار تثبيت hddtemp بتعيين بت SUID." -+ -+#~ msgid "" -+#~ "If you make hddtemp SUID, unprivileged users of your systems will be able " -+#~ "to run it. This could, however, potentially allow hddtemp to be used " -+#~ "during a security attack on your computer. If in doubt, it is suggested " -+#~ "to install it without SUID. If you later change your mind, you can run: " -+#~ "'dpkg-reconfigure hddtemp'." -+#~ msgstr "" -+#~ "إن قمت بتعيين hddtemp SUIDØŒ ÙØ³ÙŠØ³ØªØ·ÙŠØ¹ المستخدمين الغير مخولين لنظامك " -+#~ "تشغيله. قد يتسبب هذا على أي حال بالسماح باستخدام hddtemp أثناء الهجوم " -+#~ "الأمني على حاسبك. إن كنت ÙÙŠ شك، أقترح تثبيته دون تعيين SUID. إن بدلت رأيك " -+#~ "لاحقاً، يمكنك تشغيل: 'dpkg-reconfigure hddtemp'." -+ -+#~ msgid "" -+#~ "hddtemp can periodically log the temperature of the hard drive(s) via the " -+#~ "SYSLOG interface." -+#~ msgstr "" -+#~ "يستطيع hddtemp تسجيل حرارة الأقراص الصلبة بشكل دوري عبر واجهة SYSLOG." ---- hddtemp-0.3-beta15.orig/debian/po/ja.po -+++ hddtemp-0.3-beta15/debian/po/ja.po -@@ -0,0 +1,138 @@ -+# -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans -+# -+# Developers do not need to manually edit POT or PO files. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-05-29 13:50+0900\n" -+"Last-Translator: Kenshi Muto \n" -+"Language-Team: Japanese \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "/usr/sbin/hddtemp ã‚’ SUID root ã§ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã—ã¾ã™ã‹?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "SUID ビットを設定ã—㦠hddtemp をインストールã™ã‚‹ã‹ã©ã†ã‹ã‚’é¸æŠžã—ã¾ã™ã€‚ã“れã¯ã€ã‚¹ãƒ¼ãƒ‘ーユーザã ã‘ã§ãªã一般ユーザã§ã‚‚ (ãƒãƒ¼ãƒ‰ãƒ‰ãƒ©ã‚¤ãƒ–ã®æ¸©åº¦ã®å ±å‘Šã‚’) 実行ã™ã‚‹ã“ã¨ã‚’許å¯ã™ã‚‹ã“ã¨ã«ãªã‚Šã¾ã™ã€‚" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "ã“ã‚Œã¯æ½œåœ¨çš„ã«ã¯ã‚³ãƒ³ãƒ”ュータã®ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£ã«å¯¾ã™ã‚‹æ”»æ’ƒã«ä½¿ã‚れるå¯èƒ½æ€§ã‚’ hddtemp ã«è¨±ã™ã“ã¨ã«ãªã‚Šã¾ã™ã€‚ç–‘ã‚ã—ã‘れã°ã€ã€Œã„ã„ãˆã€ã¨ç­”ãˆã¦ãã ã•ã„。" -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "ã“ã®è¨­å®šã¯ã‚ã¨ã§ 'dpkg-reconfigure hddtemp' を実行ã™ã‚‹ã“ã¨ã§å¤‰æ›´ã§ãã¾ã™ã€‚" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "ãƒãƒ¼ãƒ‰ãƒ‰ãƒ©ã‚¤ãƒ–ã®æ¸©åº¦ãƒã‚§ãƒƒã‚¯ã®é–“隔インターãƒãƒ«:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "hddtemp ã§ãƒãƒ¼ãƒ‰ãƒ‰ãƒ©ã‚¤ãƒ–ã®æ¸©åº¦ã‚’一般的ãªã‚·ã‚¹ãƒ†ãƒ ãƒ­ã‚®ãƒ³ã‚°ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイスを通ã—ã¦è¨˜éŒ²ã§ãã¾ã™ã€‚" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "2ã¤ã®ãƒã‚§ãƒƒã‚¯ã®é–“ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒãƒ«ã«ç›¸å½“ã™ã‚‹ç§’数を入力ã—ã¦ãã ã•ã„。ã“ã®æ©Ÿèƒ½ã‚’無効ã«ã™ã‚‹ã«ã¯ã€0 ã¨å…¥åŠ›ã—ã¦ãã ã•ã„。" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "起動時㫠hddtemp デーモンを開始ã—ã¾ã™ã‹?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "hddtemp プログラムã¯ã€å…¥åŠ›æŽ¥ç¶šã®ãŸã‚ã®ãƒãƒ¼ãƒˆ 7634 をリスンã™ã‚‹ãƒ‡ãƒ¼ãƒ¢ãƒ³ã¨ã—ã¦å®Ÿè¡Œã§ãã¾ã™ã€‚ãƒãƒ¼ãƒ‰ãƒ‰ãƒ©ã‚¤ãƒ–ã®æ¸©åº¦ã‚’å¾—ã‚‹ãŸã‚ã«ã€gkrellm ã®ã‚ˆã†ãªã„ãã¤ã‹ã®ã‚½ãƒ•トウェアã«ã‚ˆã£ã¦ä½¿ã‚れã¾ã™ã€‚" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "コンピュータã®èµ·å‹•時㫠hddtemp デーモンを自動的ã«é–‹å§‹ã™ã‚‹é¸æŠžè‚¢ã§ã™ã€‚ç–‘ã‚ã—ã„ã®ã§ã‚れã°ã€èµ·å‹•時ã«è‡ªå‹•çš„ã«ã¯é–‹å§‹ã—ãªã„ã“ã¨ã‚’ææ¡ˆã—ã¾ã™ã€‚" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "リスンã™ã‚‹ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイス:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "hddtemp プログラムã¯ã€ç‰¹å®šã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイスã¾ãŸã¯ã™ã¹ã¦ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイスã®å…¥åŠ›æŽ¥ç¶šã‚’ãƒªã‚¹ãƒ³ã§ãã¾ã™ã€‚" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "特定ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイスをリスンã™ã‚‹ã«ã¯ã€ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイス㮠IP アドレスを入力ã—ã¦ãã ã•ã„ (127.0.0.1 ã‚’é¸ã¶ã¨ã€ãƒ­ãƒ¼ã‚«ãƒ«ã®æŽ¥ç¶šã®ã¿ã‚’許å¯ã™ã‚‹ã‚ˆã†ã«ãªã‚Šã¾ã™)。ã™ã¹ã¦ã®ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイスをリスンã™ã‚‹ã«ã¯ã€0.0.0.0 ã¨å…¥åŠ›ã—ã¦ãã ã•ã„。" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "リスンã™ã‚‹ãƒãƒ¼ãƒˆ:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "デフォルトã§ã¯ã€hddtemp ã¯ãƒãƒ¼ãƒˆ 7634 ã§å…¥åŠ›æŽ¥ç¶šã‚’ãƒªã‚¹ãƒ³ã—ã¾ã™ã€‚ã“れã¯åˆ¥ã®ãƒãƒ¼ãƒˆç•ªå·ã«å¤‰æ›´ã§ãã¾ã™ã€‚" ---- hddtemp-0.3-beta15.orig/debian/po/fi.po -+++ hddtemp-0.3-beta15/debian/po/fi.po -@@ -0,0 +1,151 @@ -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-02-04 12:18+0200\n" -+"Last-Translator: Esko Arajärvi \n" -+"Language-Team: Finnish \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Poedit-Language: Finnish\n" -+"X-Poedit-Country: FINLAND\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Tulisiko /usr/sbin/hddtemp asentaa asetuksella SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Ohjelma hddtemp voidaan asentaa SUID-bitti asetettuna, jolloin pääkäyttäjien " -+"lisäksi myös tavalliset käyttäjät voivat ajaa ohjelman (saaden tietää " -+"kovalevyjen lämpötilat)." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Tämä saattaa mahdollistaa hddtempin käytön tietoturvahyökkäyksessä konetta " -+"vastaan. Jos olet epävarma, älä valitse tätä vaihtoehtoa." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Tätä asetusta voidaan myöhemmin muuttaa ajamalla komento â€dpkg-reconfigure " -+"hddtempâ€." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Aikaväli kovalevyjen lämpötilojen tarkistusten välillä:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"Kovalevyjen lämpötilat voidaan kirjoittaa yleiseen järjestelmälokiin " -+"hddtempin toimesta." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Anna tarkistusten välinen aika sekunneissa. Syötä 0 poistaaksesi tämän " -+"ominaisuuden käytöstä." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Tulisiko hddtemp-taustaohjelma käynnistää käynnistettäessä tietokone?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Ohjelma hddtemp voidaan ajaa taustaohjelmana, joka kuuntelee yhteydenottoja " -+"portissa 7634. Jotkin ohjelmat, kuten gkrellm, käyttävät tätä hakeakseen " -+"kovalevyjen lämpötilat." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"hddtemp-taustaohjelma voidaan käynnistää automaattisesti käynnistettäessä " -+"järjestelmä. Jos olet epävarma, ohjelmaa ei suositella käynnistettäväksi " -+"automaattisesti." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Kuunneltavat liitynnät:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Ohjelma hddtemp voi kuunnella yhteydenottoja tietystä liitynnästä tai " -+"kaikista liitynnöistä." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Voit määrittää tietyn liitynnän antamalla sen IP-osoitteen (asetus 127.0.0.1 " -+"hyväksyy vain paikalliset yhteydet). Kaikki liitynnät määritetään " -+"asetuksella 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Kuunneltava portti:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Oletuksena hddtemp kuuntelee yhteydenottoja portissa 7634. Tämä portin " -+"numero voidaan vaihtaa." ---- hddtemp-0.3-beta15.orig/debian/po/templates.pot -+++ hddtemp-0.3-beta15/debian/po/templates.pot -@@ -0,0 +1,131 @@ -+# SOME DESCRIPTIVE TITLE. -+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -+# This file is distributed under the same license as the PACKAGE package. -+# FIRST AUTHOR , YEAR. -+# -+#, fuzzy -+msgid "" -+msgstr "" -+"Project-Id-Version: PACKAGE VERSION\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -+"Last-Translator: FULL NAME \n" -+"Language-Team: LANGUAGE \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=CHARSET\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" ---- hddtemp-0.3-beta15.orig/debian/po/es.po -+++ hddtemp-0.3-beta15/debian/po/es.po -@@ -0,0 +1,172 @@ -+# hddtemp debconf translation to spanish -+# Copyright (C) 2003, 2006, 2008 Software in the Public Interest -+# This file is distributed under the same license as the hddtemp package. -+# -+# Changes: -+# - Initial translation -+# Carlos Valdivia Yagüe , 2003 -+# - Revisions: -+# Carlos Valdivia Yagüe , 2006, 2008 -+# -+# Translators, if you are not familiar with the PO format, gettext -+# documentation is worth reading, especially sections dedicated to -+# this format, e.g. by running: -+# info -n '(gettext)PO Files' -+# info -n '(gettext)Header Entry' -+# -+# Some information specific to po-debconf are available at -+# /usr/share/doc/po-debconf/README-trans -+# or http://www.debian.org/intl/l10n/po-debconf/README-trans -+# -+# Developers do not need to manually edit POT or PO files. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp 0.3-beta15-39:\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-01-31 16:50+0100\n" -+"Last-Translator: Carlos Valdivia Yagüe \n" -+"Language-Team: Debian L10n Spanish \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "¿Desea instalar «/usr/sbin/hddtemp» con el bit SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Puede instalar hddtemp con el bit SUID activado, permitiendo así su " -+"ejecución (informando de la temperatura de los discos duros) por parte de " -+"usuarios normales y no sólo del superusuario." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Esto podría permitir que se utilizara hddtemp para comprometer la seguridad " -+"del sistema durante un ataque. Si está en duda, se recomienda que no active " -+"el bit SUID." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Esta elección puede modificarse posteriormente ejecutando «dpkg-reconfigure " -+"hddtemp»." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Período entre dos comprobaciones de temperatura:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"La temperatura del disco o discos duros puede ser registrada por hddtemp " -+"mediante la interfaz de registro genérica del sistema." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Introduzca un valor en segundos para el período entre dos comprobaciones " -+"sucesivas. Para desactivar esta característica, introduzca 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "¿Desea iniciar el demonio de hddtemp en el arranque del sistema?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"hddtemp puede ejecutarse en modo demonio, escuchando conexiones entrantes en " -+"el puerto 7634. Algunos programas, como gkrellm, lo utilizan para obtener la " -+"temperatura de los discos duros." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Puede iniciar el demonio de hddtemp automáticamente cada vez que arranque el " -+"sistema. Si está en duda, se recomienda que no lo inicie automáticamente al " -+"arrancar." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Interfaz en la que escuchar:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"hddtemp puede escuchar conexiones entrantes en una interfaz concreta, o bien " -+"en todas." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Para escuchar en una interfaz determinada, introduzca la dirección IP de " -+"dicha interfaz (si elige 127.0.0.1 sólo se aceptarán conexiones locales). " -+"Para escuchar en todas las interfaces, introduzca 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Puerto en el que escuchar:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"De manera predeterminada hddtemp escucha en el puerto 7634, pero puede " -+"cambiarlo por otro." ---- hddtemp-0.3-beta15.orig/debian/po/sk.po -+++ hddtemp-0.3-beta15/debian/po/sk.po -@@ -0,0 +1,155 @@ -+# Slovak translations for hddtemp package -+# Slovenské preklady pre balík hddtemp. -+# Copyright (C) 2011 THE hddtemp'S COPYRIGHT HOLDER -+# This file is distributed under the same license as the hddtemp package. -+# Automatically generated, 2011. -+# Slavko , 2011. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp 0.3-beta15-48\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2011-08-30 16:30+0200\n" -+"Last-Translator: Slavko \n" -+"Language-Team: Slovak \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"Language: sk\n" -+"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Má byÅ¥ /usr/sbin/hddtemp nainÅ¡talovaný s SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Môžete si zvoliÅ¥ inÅ¡taláciu hddtemp s nastaveným bitom SUID, ktorý dovoľuje " -+"jeho spustenie (hlásenie stavu teploty pevných diskov) obyÄajným " -+"používateľom a nie len super-používateľovi." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Toto môže potenciálne umožniÅ¥, aby bol hddtemp použitý poÄas útoku na " -+"bezpeÄnosÅ¥ poÄítaÄa. Ak si nie ste istý, nevyberajte túto možnosÅ¥." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "Môžete to zmeniÅ¥ aj neskôr, spustením „dpkg-reconfigure hddtempâ€." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Interval medzi kontrolami teploty pevného disku:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"Teplota pevného disko(ov) môže hddtemp zaznamenávaÅ¥ pomocou spoloÄného " -+"rozhrania systémových záznamov." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Prosím, zadajte hodnotu v sekundách, ktorá zodpovedá intervalu medzi dvomi " -+"meraniami. Na zakázanie tejto funkcie zadajte 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Má byÅ¥ démon hddtemp spustený pri zavedení systému?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Program hddtemp môže byÅ¥ spustený ako démon, naÄúvajúci príchodzím spojeniam " -+"na porte 7634. Je to používané niektorými programami, napr. gkrellm, na " -+"získanie teploty pevných diskov." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Môžete si zvoliÅ¥ automatické spúšťanie démona hddtemp pri zavedení systému. " -+"Ak si nie ste istý, odporúÄame nespúšťaÅ¥ ho automaticky pri azvedení." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Rozhranie, na ktorom naÄúvaÅ¥:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Program hddtemp môže oÄakávaÅ¥ príchodzie spojenia na zadanom rozhraní alebo " -+"na vÅ¡etkých rozhraniach." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Aby naÄúval na zadanom rozhraní, zadajte IP adresu daného rozhrania (zadaním " -+"127.0.0.1 budú prijímané len lokálne spojenia). Na naÄúvanie na vÅ¡etkých " -+"rozhraniach, zadajte 0.0.0.0." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port, na ktorom naÄúvaÅ¥:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Predvolene hddtemp oÄakáva príchodzie spojenia na porte 7634. Môžete to " -+"zmeniÅ¥ na akékoľvek iné Äíslo portu." ---- hddtemp-0.3-beta15.orig/debian/po/POTFILES.in -+++ hddtemp-0.3-beta15/debian/po/POTFILES.in -@@ -0,0 +1 @@ -+[type: gettext/rfc822deb] templates ---- hddtemp-0.3-beta15.orig/debian/po/nl.po -+++ hddtemp-0.3-beta15/debian/po/nl.po -@@ -0,0 +1,159 @@ -+# Dutch translation of hddtemp debconf templates. -+# Copyright (C) 2006-2011 THE PACKAGE'S COPYRIGHT HOLDER -+# This file is distributed under the same license as the hddtemp package. -+# Kurt De Bree , 2006. -+# Jeroen Schot , 2011. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp 3.3-beta15-46\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2011-06-01 08:31+0200\n" -+"Last-Translator: Jeroen Schot \n" -+"Language-Team: Debian l10n Dutch \n" -+"Language: nl\n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Wilt u /usr/sbin/hddtemp als SUID root installeren?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"U heeft de keuze om hddtemp te installeren met de SUID-bit ingesteld. Dit " -+"zorgt ervoor dat het kan worden uitgevoerd (en hardeschijf-temperatuur " -+"meldt) door gewone gebruikers en niet enkel de beheerder." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Hierdoor zou hddtemp mogelijk gebruikt kunnen worden bij aan aanval om de " -+"beveiling van de computer te omzeilen. Als u twijfelt, kies dan niet voor " -+"deze optie." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Deze instelling kan later worden gewijzigd door 'dpkg-reconfigure hddtemp' " -+"uit te voeren." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Interval tussen controles van de hardeschijf-temperatuur:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"De temperatuur van de harde schijven kan worden bijgehouden via de algemene " -+"systeemloginterface." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Geef een waarde (in seconden) overeenkomend met de interval tussen twee " -+"controles. '0' schakelt deze functie uit." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "" -+"Wilt u dat hddtemp-achtergronddienst wordt gestart bij de systeemstart?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"Het hddtemp-programma kan worden uitgevoerd als achtergronddienst, " -+"luisterend naar inkomende verbindingen op poort 7634. Dit wordt gebruikt " -+"door sommige toepassingen zoals gkrellm om de temperatuur van de harde " -+"schijven op te halen." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"U heeft de optie om de hddtemp-achtergronddienst automatisch op te starten " -+"bij de systeemstart. Bij twijfel wordt aangeraden om de dienst niet " -+"automatisch op te starten." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "De interface waarop hddtemp moet luisteren:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"Het hddtemp-programma kan naar inkomende verbindingen luisteren op één " -+"specifieke interface, of op alle interfaces." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Om op één specifieke interface te luisteren, voer het IP-addres van deze " -+"interface in (als u 127.0.0.1 kiest zullen alleen lokale verbindingen worden " -+"geaccepeert). Om op alle interfaces te luisteren, voer 0.0.0.0. in." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "De poort waarop hddtemp moet luisteren:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Standaard luistert hddtemp naar inkomende verbindingen op poort 7634. Dit " -+"kan veranderd worden in een ander poortnummer." ---- hddtemp-0.3-beta15.orig/debian/po/nb.po -+++ hddtemp-0.3-beta15/debian/po/nb.po -@@ -0,0 +1,152 @@ -+# translation of hddtemp_nb.po to Norwegian BokmÃ¥l -+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -+# This file is distributed under the same license as the PACKAGE package. -+# -+# Bjørn Steensrud , 2008. -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp_nb\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2008-01-25 22:35+0100\n" -+"PO-Revision-Date: 2008-01-27 17:39+0100\n" -+"Last-Translator: Bjørn Steensrud \n" -+"Language-Team: Norwegian BokmÃ¥l \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: KBabel 1.11.4\n" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "Should /usr/sbin/hddtemp be installed SUID root?" -+msgstr "Skal /usr/sbin/hddtemp installeres med SUID root?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"You have the option of installing hddtemp with the SUID bit set, allowing it " -+"to be run (reporting hard drive temperatures) by regular users and not only " -+"the superuser." -+msgstr "" -+"Du kan installere hddtemp med SUID-biten satt, slik at vanlige brukere og " -+"ikke bare superbrukeren kan kjøre det for Ã¥ undersøke temperatur pÃ¥ " -+"harddisken(e)." -+ -+#. Type: boolean -+#. Description -+#: ../templates:2001 -+msgid "" -+"This could potentially allow hddtemp to be used during an attack against the " -+"computer's security. If in doubt, do not choose this option." -+msgstr "" -+"Dette kan kanskje tillate at hddtemp blir brukt i et angrep mot systemets " -+"sikkerhet. Er du i tvil, sÃ¥ ikke velg dette." -+ -+#. Type: boolean -+#. Description -+#. Type: boolean -+#. Description -+#: ../templates:2001 ../templates:4001 -+msgid "" -+"This setting can be modified later by running 'dpkg-reconfigure hddtemp'." -+msgstr "" -+"Denne innstillingen kan endres senere ved Ã¥ kjøre «dpkg-reconfigure hddtemp»." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "Interval between hard drive temperature checks:" -+msgstr "Intervall mellom sjekker pÃ¥ disktemperaturen:" -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"The temperature of the hard drive(s) can be logged by hddtemp via the " -+"generic system logging interface." -+msgstr "" -+"hddtemp kan logge disken(e)s temperatur via systemets eget log-grensesnitt." -+ -+#. Type: string -+#. Description -+#: ../templates:3001 -+msgid "" -+"Please enter a value in seconds corresponding to the interval between two " -+"checks. To disable this feature, enter 0." -+msgstr "" -+"Oppgi en verdi i sekunder som tilsvarer intervallet mellom to sjekker. Dette " -+"blir slÃ¥tt av hvis verdien er 0." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "Should the hddtemp daemon be started at boot?" -+msgstr "Skal hddtemp-daemonen startes ved oppstart?" -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"The hddtemp program can be run as a daemon, listening on port 7634 for " -+"incoming connections. It is used by some software such as gkrellm to get the " -+"temperature of hard drives." -+msgstr "" -+"hddtemp-programmet kan kjøres som en daemon som lytter pÃ¥ port 7634. Dette " -+"brukes av noen programmer slik som gkrellm for Ã¥ finne temperaturen pÃ¥ " -+"harddisker." -+ -+#. Type: boolean -+#. Description -+#: ../templates:4001 -+msgid "" -+"You have the option of starting the hddtemp daemon automatically on system " -+"boot. If in doubt, it is suggested to not start it automatically on boot." -+msgstr "" -+"Du kan velge Ã¥ starte hddtemp-daemonen automatisk nÃ¥r systemet starter opp. " -+"Er du i tvil, foreslÃ¥r vi at den ikke startes automatisk ved oppstart." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "Interface to listen on:" -+msgstr "Grensesnitt det skal lyttes pÃ¥:" -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"The hddtemp program can listen for incoming connections on a specific " -+"interface, or on all interfaces." -+msgstr "" -+"hddtemp-programmet kan lytte etter inkommende tilkoblinger pÃ¥ et bestemt " -+"grensesnitt, eller alle grensesnitt." -+ -+#. Type: string -+#. Description -+#: ../templates:5001 -+msgid "" -+"To listen on a specific interface, enter the IP address of that interface " -+"(choosing 127.0.0.1 will accept local connections only). To listen on all " -+"interfaces, enter 0.0.0.0." -+msgstr "" -+"Oppgi grensesnittets IP-adresse for Ã¥ lytte pÃ¥ det grensesnittet. (127.0.0.1 " -+"godtar bare lokale tilkoblinger). Oppgi 0.0.0.0 for Ã¥ lytte pÃ¥ alle " -+"grensesnitt." -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "Port to listen on:" -+msgstr "Port Ã¥ lytte pÃ¥:" -+ -+#. Type: string -+#. Description -+#: ../templates:6001 -+msgid "" -+"By default, hddtemp listens for incoming connections on port 7634. This can " -+"be changed for another port number." -+msgstr "" -+"Standardporten der hddtemp lytter etter innkommende tilkoblinger er port " -+"7634. Dette kan endres til et annet portnummer." ---- hddtemp-0.3-beta15.orig/doc/hddtemp.8 -+++ hddtemp-0.3-beta15/doc/hddtemp.8 -@@ -58,6 +58,10 @@ - .B \-f, \-\-file=\fIfile\fI - Specify the database file to use. - .TP -+.B \-F, \-\-foreground -+Don't fork into the background even in daemon mode. This is useful -+when running under a process supervisor. -+.TP - .B \-l, \-\-listen=\fIaddr\fR - Listen on a specific address. \fIaddr\fR is a string containing a - host name or a numeric host address string. The numeric host address -@@ -80,6 +84,9 @@ - .B \-q, \-\-quiet - Don't check if the drive is supported. - .TP -+.B \-u, \-\-unit=\fIC|F\fR -+Force output temperature either in Celsius or Fahrenheit. -+.TP - .B \-v, \-\-version - Display hddtemp version number. - .TP -@@ -96,7 +103,7 @@ - .SH "DRIVE DATABASE" - If you know your drive has a temperature sensor but it is being - reported unsupported, tell me which model and which manufacturer it --is, and/or just add a new entry in /usr/share/misc/hddtemp.db. Each -+is, and/or just add a new entry in /etc/hddtemp.db. Each - line of hddtemp.db is either a comment, a blank line or a line - containing: - .TP -@@ -112,7 +119,7 @@ - Feedback is welcome (see the REPORT section below). - - .SH "TCP/IP DAEMON MODE" --Exemple of type forcing: -+Example of type forcing: - .PP - # hddtemp SATA:/dev/sda PATA:/dev/hda - .PP -@@ -120,7 +127,7 @@ - .B hddtemp - in daemon mode, start it like this: - .PP --# hddtemp -d /dev/hd[abcd] -+# hddtemp \-d /dev/hd[abcd] - .PP - .PP - and use -@@ -165,8 +172,8 @@ - investigation they do not. But fields 194 (which is the standard - field for temperature) and 231 are good candidates. - .PP --Then, you can send me a report with outputs from `hddtemp --debug ...', --`smartctl' or `hdparm -i ...', and/or add an entry in hddtemp.db -+Then, you can send me a report with outputs from `hddtemp \-\-debug ...', -+`smartctl' or `hdparm \-i ...', and/or add an entry in hddtemp.db - yourself. - - .SH "BUGS" -@@ -183,5 +190,5 @@ - .PP - Emmanuel Varagnat (hddtemp@guzu.net). - .PP --This manual page was originaly written by Aurelien Jarno , -+This manual page was originally written by Aurelien Jarno , - for the Debian GNU/Linux system (but may be used by others). ---- hddtemp-0.3-beta15.orig/po/fr.po -+++ hddtemp-0.3-beta15/po/fr.po -@@ -7,9 +7,9 @@ - msgid "" - msgstr "" - "Project-Id-Version: fr\n" --"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" --"POT-Creation-Date: 2005-02-25 22:43+0100\n" --"PO-Revision-Date: 2003-06-03 00:58GMT+1\n" -+"Report-Msgid-Bugs-To: \n" -+"POT-Creation-Date: 2006-06-29 16:24+0200\n" -+"PO-Revision-Date: 2011-08-30 16:38+0200\n" - "Last-Translator: Aurelien Jarno \n" - "Language-Team: FRANCAIS \n" - "MIME-Version: 1.0\n" -@@ -17,23 +17,7 @@ - "Content-Transfer-Encoding: 8bit\n" - "X-Generator: KBabel 1.0.1\n" - --#: src/hddtemp.c:112 --#, c-format --msgid "" --"\n" --"Regexp%s| Value | Description\n" --"------%s---------------------\n" --msgstr "" --"\n" --"Regexp%s| Valeur | Description\n" --"------%s----------------------\n" -- --#: src/hddtemp.c:118 --#, c-format --msgid "%s%s| %5d | %s\n" --msgstr "%s%s| %5d | %s\n" -- --#: src/hddtemp.c:161 -+#: src/hddtemp.c:156 - #, c-format - msgid "" - "\n" -@@ -46,7 +30,7 @@ - "Modèle: %s\n" - "\n" - --#: src/hddtemp.c:188 -+#: src/hddtemp.c:189 - #, c-format - msgid "" - "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" -@@ -60,75 +44,60 @@ - "net).\n" - "ATTENTION : Voir les options --help, --debug et --drivebase.\n" - --#: src/hddtemp.c:192 -+#: src/hddtemp.c:197 - #, c-format - msgid "%s: %s: no sensor\n" - msgstr "%s: %s : pas de capteur\n" - --#: src/hddtemp.c:197 --#, c-format --msgid "" --"WARNING: Drive %s doesn't appear in the database of supported drives\n" --"WARNING: But using a common value, it reports something.\n" --"WARNING: Note that the temperature shown could be wrong.\n" --"WARNING: See --help, --debug and --drivebase options.\n" --"WARNING: And don't forget you can add your drive to hddtemp.db\n" --msgstr "" --"ATTENTION : Le lecteur %s n'apparait pas dans la base de données des " --"lecteurs supportés\n" --"ATTENTION : Mais en utilisant une valeur courante, il renvoie quelque " --"chose.\n" --"ATTENTION : Notez que la température renvoyée peut être erronée.\n" --"ATTENTION : Voir les options --help, --debug et --drivebase.\n" --"ATTENTION : Et n'oubliez pas d'ajouter votre lecteur au fichier hddtemp.db\n" -- --#: src/hddtemp.c:202 -+#: src/hddtemp.c:211 - #, c-format - msgid "%s: %s: %d%sC or %sF\n" - msgstr "%s: %s : %d%sC ou %sF\n" - --#: src/hddtemp.c:214 -+#: src/hddtemp.c:235 - #, c-format - msgid "%s: %s: drive is sleeping\n" - msgstr "%s: %s : le lecteur est en veille\n" - --#: src/hddtemp.c:217 -+#: src/hddtemp.c:242 - #, c-format --msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" -+msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" - msgstr "" - "%s: %s: lecteur connu, mais il ne possède pas de capteur de température.\n" - --#: src/hddtemp.c:220 -+#: src/hddtemp.c:246 - #, c-format - msgid "ERROR: %s: %s: unknown returned status\n" - msgstr "ERREUR : %s : %s : status inconnu\n" - --#: src/hddtemp.c:235 -+#: src/hddtemp.c:261 - #, c-format - msgid "" - "\n" - "If one of the field value seems to match the temperature, be sure to read\n" --"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" -+"the hddtemp man page before sending a report (section REPORT). Thanks.\n" - msgstr "" - --#: src/hddtemp.c:308 -+#: src/hddtemp.c:338 - #, c-format - msgid "ERROR: invalid separator.\n" - msgstr "ERREUR : séparateur invalide.\n" - --#: src/hddtemp.c:319 -+#: src/hddtemp.c:349 - #, c-format - msgid "ERROR: invalid port number.\n" - msgstr "ERREUR : numéro de port invalide.\n" - --#: src/hddtemp.c:329 --#, fuzzy, c-format -+#: src/hddtemp.c:371 -+#, c-format - msgid "" --" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" -+" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" - "\n" - " hddtemp displays the temperature of drives supplied in argument.\n" - " Drives must support S.M.A.R.T.\n" - "\n" -+" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" -+"\n" - " -b --drivebase : display database file content that allow hddtemp to\n" - " recognize supported drives.\n" - " -D --debug : display various S.M.A.R.T. fields and their values.\n" -@@ -138,6 +107,7 @@ - " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " - "default.)\n" - " -f --file=FILE : specify database file to use.\n" -+" -F --foreground : don't daemonize, stay in foreground.\n" - " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " - "mode).\n" - " -n --numeric : print only the temperature.\n" -@@ -145,6 +115,8 @@ - " -s --separator=C : separator to use between fields (in TCP/IP daemon " - "mode).\n" - " -S --syslog=s : log temperature to syslog every s seconds.\n" -+" -u --unit=[C|F] : force output temperature either in Celsius or " -+"Fahrenheit.\n" - " -q --quiet : do not check if the drive is supported.\n" - " -v --version : display hddtemp version number.\n" - " -w --wake-up : wake-up the drive if need.\n" -@@ -153,11 +125,14 @@ - "\n" - "Report bugs or new drives to .\n" - msgstr "" --" Utilisation: hddtemp [OPTIONS] DISQUE1 [DISQUE2]...\n" -+" Utilisation: hddtemp [OPTIONS] [TYPE:]DISQUE1 [[TYPE:]DISQUE2]...\n" - "\n" - " hddtemp affiche la température des lecteurs passés en argument.\n" - " Les lecteurs doivent avoir le support S.M.A.R.T.\n" - "\n" -+" TYPE peut être SATA, PATA ou SCSI. Si le type est omis, hddtemp essaiera\n" -+" de le deviner.\n" -+"\n" - " -b --drivebase : affiche le contenu du fichier de base de donnée " - "qui \n" - " permet à hddtemp de reconnaître les lecteurs " -@@ -172,6 +147,7 @@ - "défaut).\n" - " -f --file=FILE : specifie le fichier à utiliser comme base de " - "données.\n" -+" -F --foreground : ne pas démoniser, rester au premier plan.\n" - " -l --listen=addr : écoute sur une interface spécifique (en mode démon " - "TCP/IP).\n" - " -n --numeric : affiche seulement la température.\n" -@@ -180,6 +156,8 @@ - "démon TCP/IP).\n" - " -S --syslog=s : enregistre la température dans syslog tous les s " - "secondes.\n" -+" -u --unit=[C|F] : affiche la température en degrés Celsius ou " -+"Fahrenheit.\n" - " -q --quiet : ne vérifie pas si le lecteur est supporté.\n" - " -v --version : affiche la version de hddtemp.\n" - " -w --wake-up : réveiller le lecteur si nécessaire.\n" -@@ -188,62 +166,95 @@ - "\n" - "Report bugs or new drives to .\n" - --#: src/hddtemp.c:522 -+#: src/hddtemp.c:402 - #, c-format - msgid "hddtemp version %s\n" - msgstr "hddtemp version %s\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:418 - #, c-format - msgid "ERROR: invalid interval.\n" - msgstr "ERREUR : intervalle invalide.\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:438 -+#, c-format - msgid "Too few arguments: you must specify one drive, at least.\n" - msgstr "Trop peu d'arguments : vous devez spécifier au moins un lecteur.\n" - --#: src/hddtemp.c:557 -+#: src/hddtemp.c:448 -+#, c-format - msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" - msgstr "" - "ERREUR: impossible d'utiliser les options --debug et --daemon ou --syslog en " - "même temps.\n" - --#: src/hddtemp.c:583 -+#: src/hddtemp.c:505 - #, c-format - msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" - msgstr "" - "ERREUR: %s: impossible de déterminer le type de bus (ou ce type de bus est " - "inconnu)\n" - --#: src/ata.c:66 src/scsi.c:68 -+#: src/ata.c:66 src/scsi.c:64 - msgid "unknown" - msgstr "inconnu" - --#: src/ata.c:98 -+#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 - #, c-format --msgid "field(%d)\t = %d\n" --msgstr "champ(%d)\t = %d\n" -- --#: src/ata.c:167 - msgid "S.M.A.R.T. not available" - msgstr "S.M.A.R.T. non disponible" - --#: src/db.c:180 -+#: src/db.c:115 -+#, c-format -+msgid "" -+"\n" -+"Regexp%s| Value | Description\n" -+"------%s---------------------\n" -+msgstr "" -+"\n" -+"Regexp%s| Valeur | Description\n" -+"------%s----------------------\n" -+ -+#: src/db.c:121 -+#, c-format -+msgid "%s%s| %5d | %s\n" -+msgstr "%s%s| %5d | %s\n" -+ -+#: src/db.c:236 - #, c-format - msgid "hddtemp: can't open %1$s: %2$s\n" - msgstr "hddtemp: ne peut ouvrir %1$s: %2$s\n" - --#: src/db.c:194 -+#: src/db.c:250 - #, c-format - msgid "ERROR: syntax error at line %1$d in %2$s\n" - msgstr "ERREUR: erreur de syntaxe à la ligne %1$d: %2$s\n" - --#: src/db.c:201 -+#: src/db.c:257 - #, c-format - msgid " ERROR: line exceed %1$d characters in %2$s.\n" - msgstr " ERREUR: ligne exécdant %1$d caractères dans %2$s.\n" - --#: src/scsi.c:112 src/scsi.c:130 -+#: src/scsi.c:111 src/scsi.c:129 - #, c-format - msgid "log sense failed : %s" - msgstr "echec de 'log sense' : %s " -+ -+#~ msgid "" -+#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" -+#~ "WARNING: But using a common value, it reports something.\n" -+#~ "WARNING: Note that the temperature shown could be wrong.\n" -+#~ "WARNING: See --help, --debug and --drivebase options.\n" -+#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" -+#~ msgstr "" -+#~ "ATTENTION : Le lecteur %s n'apparait pas dans la base de données des " -+#~ "lecteurs supportés\n" -+#~ "ATTENTION : Mais en utilisant une valeur courante, il renvoie quelque " -+#~ "chose.\n" -+#~ "ATTENTION : Notez que la température renvoyée peut être erronée.\n" -+#~ "ATTENTION : Voir les options --help, --debug et --drivebase.\n" -+#~ "ATTENTION : Et n'oubliez pas d'ajouter votre lecteur au fichier hddtemp." -+#~ "db\n" -+ -+#~ msgid "field(%d)\t = %d\n" -+#~ msgstr "champ(%d)\t = %d\n" ---- hddtemp-0.3-beta15.orig/po/ru.po -+++ hddtemp-0.3-beta15/po/ru.po -@@ -6,8 +6,8 @@ - msgid "" - msgstr "" - "Project-Id-Version: hddtemp 0.3-beta3\n" --"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" --"POT-Creation-Date: 2005-02-25 22:43+0100\n" -+"Report-Msgid-Bugs-To: \n" -+"POT-Creation-Date: 2006-06-29 16:24+0200\n" - "PO-Revision-Date: 2003-03-08 16:42+0300\n" - "Last-Translator: Michael Shigorin \n" - "Language-Team: Russian \n" -@@ -15,23 +15,7 @@ - "Content-Type: text/plain; charset=koi8-r\n" - "Content-Transfer-Encoding: 8bit\n" - --#: src/hddtemp.c:112 --#, c-format --msgid "" --"\n" --"Regexp%s| Value | Description\n" --"------%s---------------------\n" --msgstr "" --"\n" --"òÅÇÜËÓ%s| úÎÁÞ. | ïÐÉÓÁÎÉÅ \n" --"------%s---------------------\n" -- --#: src/hddtemp.c:118 --#, c-format --msgid "%s%s| %5d | %s\n" --msgstr "" -- --#: src/hddtemp.c:161 -+#: src/hddtemp.c:156 - #, c-format - msgid "" - "\n" -@@ -40,7 +24,7 @@ - "\n" - msgstr "" - --#: src/hddtemp.c:188 -+#: src/hddtemp.c:189 - #, c-format - msgid "" - "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" -@@ -53,72 +37,59 @@ - "÷îéíáîéå: åÓÌÉ ×Ù ÔÏÞÎÏ ÚÎÁÅÔÅ, ÞÔÏ ÄÁÔÞÉË ÅÓÔØ, ÎÁÐÉÛÉÔÅ hddtemp@guzu.net\n" - "÷îéíáîéå: (ÓÍ. ÏÐÃÉÉ --help, --debug É --drivebase).\n" - --#: src/hddtemp.c:192 -+#: src/hddtemp.c:197 - #, c-format - msgid "%s: %s: no sensor\n" - msgstr "%s: %s: ÎÅÔ ÄÁÔÞÉËÁ\n" - --#: src/hddtemp.c:197 --#, c-format --msgid "" --"WARNING: Drive %s doesn't appear in the database of supported drives\n" --"WARNING: But using a common value, it reports something.\n" --"WARNING: Note that the temperature shown could be wrong.\n" --"WARNING: See --help, --debug and --drivebase options.\n" --"WARNING: And don't forget you can add your drive to hddtemp.db\n" --msgstr "" --"÷îéíáîéå: äÉÓË %s ÎÅ ×ËÌÀÞÅÎ × ÂÁÚÕ ÄÁÎÎÙÈ ÐÏÄÄÅÒÖÉ×ÁÅÍÙÈ ÐÒÉ×ÏÄÏ×.\n" --"÷îéíáîéå: îÏ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÒÁÓÐÒÏÓÔÒÁÎÅÎÎÙÈ ÐÁÒÁÍÅÔÒÏ× ÏÎ ÞÔÏ-ÔÏ ×ÙÄÁÅÔ.\n" --"÷îéíáîéå: úÁÍÅÔØÔÅ, ÞÔÏ ÐÏËÁÚÁÎÎÁÑ ÔÅÍÐÅÒÁÔÕÒÁ ÍÏÖÅÔ ÔÁËÏ×ÏÊ ÎÅ Ñ×ÌÑÔØÓÑ.\n" --"÷îéíáîéå: óÍ. ÏÐÃÉÉ --help, --debug É --drivebase.\n" --"÷îéíáîéå: é ÎÅ ÚÁÂÕÄØÔÅ, ÞÔÏ ÍÏÖÎÏ ÄÏÂÁ×ÉÔØ ÐÒÉ×ÏÄ × hddtemp.db\n" -- --#: src/hddtemp.c:202 -+#: src/hddtemp.c:211 - #, c-format - msgid "%s: %s: %d%sC or %sF\n" - msgstr "%s: %s: %d%sC ÉÌÉ %sF\n" - --#: src/hddtemp.c:214 -+#: src/hddtemp.c:235 - #, c-format - msgid "%s: %s: drive is sleeping\n" - msgstr "%s: %s: ÎÅÔ ÄÁÔÞÉËÁ\n" - --#: src/hddtemp.c:217 --#, c-format --msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" -+#: src/hddtemp.c:242 -+#, fuzzy, c-format -+msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" - msgstr "%s: %s: ÉÚ×ÅÓÔÎÙÊ ÄÉÓË, ÎÅ ÓÏÄÅÒÖÁÝÉÊ ÄÁÔÞÉËÁ ÔÅÍÐÅÒÁÔÕÒÙ.\n" - --#: src/hddtemp.c:220 -+#: src/hddtemp.c:246 - #, c-format - msgid "ERROR: %s: %s: unknown returned status\n" - msgstr "ïûéâëá: %s: %s: ÎÅÉÚ×ÅÓÔÎÙÊ ÓÔÁÔÕÓ ×ÏÚ×ÒÁÔÁ\n" - --#: src/hddtemp.c:235 -+#: src/hddtemp.c:261 - #, c-format - msgid "" - "\n" - "If one of the field value seems to match the temperature, be sure to read\n" --"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" -+"the hddtemp man page before sending a report (section REPORT). Thanks.\n" - msgstr "" - --#: src/hddtemp.c:308 -+#: src/hddtemp.c:338 - #, c-format - msgid "ERROR: invalid separator.\n" - msgstr "ïûéâëá: ÎÅ×ÅÒÎÙÊ ÒÁÚÄÅÌÉÔÅÌØ.\n" - --#: src/hddtemp.c:319 -+#: src/hddtemp.c:349 - #, c-format - msgid "ERROR: invalid port number.\n" - msgstr "ïýéâëá: ÎÅ×ÅÒÎÙÊ ÎÏÍÅÒ ÐÏÒÔÁ.\n" - --#: src/hddtemp.c:329 -+#: src/hddtemp.c:371 - #, fuzzy, c-format - msgid "" --" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" -+" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" - "\n" - " hddtemp displays the temperature of drives supplied in argument.\n" - " Drives must support S.M.A.R.T.\n" - "\n" -+" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" -+"\n" - " -b --drivebase : display database file content that allow hddtemp to\n" - " recognize supported drives.\n" - " -D --debug : display various S.M.A.R.T. fields and their values.\n" -@@ -128,6 +99,7 @@ - " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " - "default.)\n" - " -f --file=FILE : specify database file to use.\n" -+" -F --foreground : don't daemonize, stay in foreground.\n" - " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " - "mode).\n" - " -n --numeric : print only the temperature.\n" -@@ -135,6 +107,8 @@ - " -s --separator=C : separator to use between fields (in TCP/IP daemon " - "mode).\n" - " -S --syslog=s : log temperature to syslog every s seconds.\n" -+" -u --unit=[C|F] : force output temperature either in Celsius or " -+"Fahrenheit.\n" - " -q --quiet : do not check if the drive is supported.\n" - " -v --version : display hddtemp version number.\n" - " -w --wake-up : wake-up the drive if need.\n" -@@ -168,59 +142,90 @@ - "\n" - "óÏÏÂÝÅÎÉÑ Ï ÏÛÉÂËÁÈ É ÄÁÎÎÙÅ ÄÌÑ ÄÉÓËÏ× ÏÔÐÒÁ×ÌÑÊÔÅ ÎÁ .\n" - --#: src/hddtemp.c:522 -+#: src/hddtemp.c:402 - #, c-format - msgid "hddtemp version %s\n" - msgstr "÷ÅÒÓÉÑ hddtemp: %s\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:418 - #, fuzzy, c-format - msgid "ERROR: invalid interval.\n" - msgstr "ïûéâëá: ÎÅ×ÅÒÎÙÊ ÒÁÚÄÅÌÉÔÅÌØ.\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:438 -+#, c-format - msgid "Too few arguments: you must specify one drive, at least.\n" - msgstr "" - --#: src/hddtemp.c:557 --#, fuzzy -+#: src/hddtemp.c:448 -+#, fuzzy, c-format - msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" - msgstr "ïûéâëá: ÏÄÎÏ×ÒÅÍÅÎÎÏÅ ÉÓÐÏÌØÚÏ×ÁÎÉÅ --debug É --daemon ÎÅÄÏÐÕÓÔÉÍÏ.\n" - --#: src/hddtemp.c:583 -+#: src/hddtemp.c:505 - #, c-format - msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" - msgstr "ïûéâëá: %s: ÎÅ×ÏÚÍÏÖÎÏ ÏÐÒÅÄÅÌÉÔØ ÔÉÐ ÛÉÎÙ\n" - --#: src/ata.c:66 src/scsi.c:68 -+#: src/ata.c:66 src/scsi.c:64 - msgid "unknown" - msgstr "ÎÅÉÚ×." - --#: src/ata.c:98 -+#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 - #, c-format --msgid "field(%d)\t = %d\n" --msgstr "ÐÏÌÅ(%d)\t = %d\n" -- --#: src/ata.c:167 - msgid "S.M.A.R.T. not available" - msgstr "S.M.A.R.T. ÎÅÄÏÓÔÕÐÅÎ" - --#: src/db.c:180 -+#: src/db.c:115 -+#, c-format -+msgid "" -+"\n" -+"Regexp%s| Value | Description\n" -+"------%s---------------------\n" -+msgstr "" -+"\n" -+"òÅÇÜËÓ%s| úÎÁÞ. | ïÐÉÓÁÎÉÅ \n" -+"------%s---------------------\n" -+ -+#: src/db.c:121 -+#, c-format -+msgid "%s%s| %5d | %s\n" -+msgstr "" -+ -+#: src/db.c:236 - #, c-format - msgid "hddtemp: can't open %1$s: %2$s\n" - msgstr "hddtemp: ÎÅ ÍÏÇÕ ÏÔËÒÙÔØ %1$s: %2$s\n" - --#: src/db.c:194 -+#: src/db.c:250 - #, c-format - msgid "ERROR: syntax error at line %1$d in %2$s\n" - msgstr "óÉÎÔÁËÓÉÞÅÓËÁÑ ïûéâëá × ÓÔÒÏËÅ %1$d ÆÁÊÌÁ %2$s\n" - --#: src/db.c:201 -+#: src/db.c:257 - #, c-format - msgid " ERROR: line exceed %1$d characters in %2$s.\n" - msgstr "ïûéâëá: ÓÔÒÏËÁ ÄÌÉÎÎÅÅ %1$d ÓÉÍ×ÏÌÏ× × %2$s.\n" - --#: src/scsi.c:112 src/scsi.c:130 -+#: src/scsi.c:111 src/scsi.c:129 - #, c-format - msgid "log sense failed : %s" - msgstr "" -+ -+#~ msgid "" -+#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" -+#~ "WARNING: But using a common value, it reports something.\n" -+#~ "WARNING: Note that the temperature shown could be wrong.\n" -+#~ "WARNING: See --help, --debug and --drivebase options.\n" -+#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" -+#~ msgstr "" -+#~ "÷îéíáîéå: äÉÓË %s ÎÅ ×ËÌÀÞÅÎ × ÂÁÚÕ ÄÁÎÎÙÈ ÐÏÄÄÅÒÖÉ×ÁÅÍÙÈ ÐÒÉ×ÏÄÏ×.\n" -+#~ "÷îéíáîéå: îÏ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÒÁÓÐÒÏÓÔÒÁÎÅÎÎÙÈ ÐÁÒÁÍÅÔÒÏ× ÏÎ ÞÔÏ-ÔÏ " -+#~ "×ÙÄÁÅÔ.\n" -+#~ "÷îéíáîéå: úÁÍÅÔØÔÅ, ÞÔÏ ÐÏËÁÚÁÎÎÁÑ ÔÅÍÐÅÒÁÔÕÒÁ ÍÏÖÅÔ ÔÁËÏ×ÏÊ ÎÅ " -+#~ "Ñ×ÌÑÔØÓÑ.\n" -+#~ "÷îéíáîéå: óÍ. ÏÐÃÉÉ --help, --debug É --drivebase.\n" -+#~ "÷îéíáîéå: é ÎÅ ÚÁÂÕÄØÔÅ, ÞÔÏ ÍÏÖÎÏ ÄÏÂÁ×ÉÔØ ÐÒÉ×ÏÄ × hddtemp.db\n" -+ -+#~ msgid "field(%d)\t = %d\n" -+#~ msgstr "ÐÏÌÅ(%d)\t = %d\n" ---- hddtemp-0.3-beta15.orig/po/sv.po -+++ hddtemp-0.3-beta15/po/sv.po -@@ -6,8 +6,8 @@ - msgid "" - msgstr "" - "Project-Id-Version: hddtemp 0.3-beta14-4\n" --"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" --"POT-Creation-Date: 2005-02-25 22:43+0100\n" -+"Report-Msgid-Bugs-To: \n" -+"POT-Creation-Date: 2006-06-29 16:24+0200\n" - "PO-Revision-Date: 2005-11-02 19:03+0100\n" - "Last-Translator: Daniel Nylander \n" - "Language-Team: Swedish \n" -@@ -17,23 +17,7 @@ - "X-Poedit-Language: swe\n" - "X-Poedit-Country: swe\n" - --#: src/hddtemp.c:112 --#, c-format --msgid "" --"\n" --"Regexp%s| Value | Description\n" --"------%s---------------------\n" --msgstr "" --"\n" --"Regexp%s| Värde | Beskrivning\n" --"------%s---------------------\n" -- --#: src/hddtemp.c:118 --#, c-format --msgid "%s%s| %5d | %s\n" --msgstr "%s%s| %5d | %s\n" -- --#: src/hddtemp.c:161 -+#: src/hddtemp.c:156 - #, c-format - msgid "" - "\n" -@@ -46,7 +30,7 @@ - "Modell: %s\n" - "\n" - --#: src/hddtemp.c:188 -+#: src/hddtemp.c:189 - #, c-format - msgid "" - "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" -@@ -60,76 +44,63 @@ - "net).\n" - "VARNING: Se --help, --debug och --drivebase flaggorna.\n" - --#: src/hddtemp.c:192 -+#: src/hddtemp.c:197 - #, c-format - msgid "%s: %s: no sensor\n" - msgstr "%s: %s: ingen sensor\n" - --#: src/hddtemp.c:197 --#, c-format --msgid "" --"WARNING: Drive %s doesn't appear in the database of supported drives\n" --"WARNING: But using a common value, it reports something.\n" --"WARNING: Note that the temperature shown could be wrong.\n" --"WARNING: See --help, --debug and --drivebase options.\n" --"WARNING: And don't forget you can add your drive to hddtemp.db\n" --msgstr "" --"VARNING: Disken %s verkar inte finnas i databasen över diskar som stöds\n" --"VARNING: Men använder man ett vanligt värde rapporterar den något.\n" --"VARNING: Notera att temperaturen som visas kan vara felaktig.\n" --"VARNING: Se --help, --debug och --drivebase flaggorna.\n" --"VARNING: Och glöm inte att du kan lägga till din disk till hddtemp.db\n" -- --#: src/hddtemp.c:202 -+#: src/hddtemp.c:211 - #, c-format - msgid "%s: %s: %d%sC or %sF\n" - msgstr "%s: %s: %d%sC eller %sF\n" - --#: src/hddtemp.c:214 -+#: src/hddtemp.c:235 - #, c-format - msgid "%s: %s: drive is sleeping\n" - msgstr "%s: %s: disken sover\n" - --#: src/hddtemp.c:217 --#, c-format --msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" -+#: src/hddtemp.c:242 -+#, fuzzy, c-format -+msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" - msgstr "%s: %s: känd disk men den har ingen temperatursensor.\n" - --#: src/hddtemp.c:220 -+#: src/hddtemp.c:246 - #, c-format - msgid "ERROR: %s: %s: unknown returned status\n" - msgstr "FEL: %s: %s: okänd returnerad status\n" - --#: src/hddtemp.c:235 --#, c-format -+#: src/hddtemp.c:261 -+#, fuzzy, c-format - msgid "" - "\n" - "If one of the field value seems to match the temperature, be sure to read\n" --"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" -+"the hddtemp man page before sending a report (section REPORT). Thanks.\n" - msgstr "" - "\n" - "Om ett av fältvärdena verkar matcha temperaturen, var säker på att du\n" - "läst manualsidan för hddtemp före du skickar en rapport till mig (sektionen\n" - "REPORT). Tack.\n" - --#: src/hddtemp.c:308 -+#: src/hddtemp.c:338 - #, c-format - msgid "ERROR: invalid separator.\n" - msgstr "FEL: ogiltig separator.\n" - --#: src/hddtemp.c:319 -+#: src/hddtemp.c:349 - #, c-format - msgid "ERROR: invalid port number.\n" - msgstr "FEL: ogiltigt portnummer.\n" - --#: src/hddtemp.c:329 --#, c-format -+#: src/hddtemp.c:371 -+#, fuzzy, c-format - msgid "" --" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" -+" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" - "\n" - " hddtemp displays the temperature of drives supplied in argument.\n" - " Drives must support S.M.A.R.T.\n" - "\n" -+" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" -+"\n" - " -b --drivebase : display database file content that allow hddtemp to\n" - " recognize supported drives.\n" - " -D --debug : display various S.M.A.R.T. fields and their values.\n" -@@ -139,6 +110,7 @@ - " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " - "default.)\n" - " -f --file=FILE : specify database file to use.\n" -+" -F --foreground : don't daemonize, stay in foreground.\n" - " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " - "mode).\n" - " -n --numeric : print only the temperature.\n" -@@ -146,6 +118,8 @@ - " -s --separator=C : separator to use between fields (in TCP/IP daemon " - "mode).\n" - " -S --syslog=s : log temperature to syslog every s seconds.\n" -+" -u --unit=[C|F] : force output temperature either in Celsius or " -+"Fahrenheit.\n" - " -q --quiet : do not check if the drive is supported.\n" - " -v --version : display hddtemp version number.\n" - " -w --wake-up : wake-up the drive if need.\n" -@@ -184,61 +158,91 @@ - "\n" - "Rapportera buggar eller nya hårddiskar till .\n" - --#: src/hddtemp.c:522 -+#: src/hddtemp.c:402 - #, c-format - msgid "hddtemp version %s\n" - msgstr "hddtemp version %s\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:418 - #, c-format - msgid "ERROR: invalid interval.\n" - msgstr "FEL: ogiltigt intervall.\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:438 -+#, c-format - msgid "Too few arguments: you must specify one drive, at least.\n" - msgstr "För få argument: du måste specificera åtminstone en disk.\n" - --#: src/hddtemp.c:557 -+#: src/hddtemp.c:448 -+#, c-format - msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" - msgstr "" - "FEL: kan inte använda --debug och --daemon eller --syslog flaggorna " - "tillsammans.\n" - --#: src/hddtemp.c:583 -+#: src/hddtemp.c:505 - #, c-format - msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" - msgstr "" - "FEL: %s: kan inte fastställa busstyp (eller så är denna busstyp okänd)\n" - --#: src/ata.c:66 src/scsi.c:68 -+#: src/ata.c:66 src/scsi.c:64 - msgid "unknown" - msgstr "okänd" - --#: src/ata.c:98 -+#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 - #, c-format --msgid "field(%d)\t = %d\n" --msgstr "fält(%d)\t = %d\n" -- --#: src/ata.c:167 - msgid "S.M.A.R.T. not available" - msgstr "S.M.A.R.T. är inte tillgänglig" - --#: src/db.c:180 -+#: src/db.c:115 -+#, c-format -+msgid "" -+"\n" -+"Regexp%s| Value | Description\n" -+"------%s---------------------\n" -+msgstr "" -+"\n" -+"Regexp%s| Värde | Beskrivning\n" -+"------%s---------------------\n" -+ -+#: src/db.c:121 -+#, c-format -+msgid "%s%s| %5d | %s\n" -+msgstr "%s%s| %5d | %s\n" -+ -+#: src/db.c:236 - #, c-format - msgid "hddtemp: can't open %1$s: %2$s\n" - msgstr "hddtemp: kan inte öppna %1$s: %2$s\n" - --#: src/db.c:194 -+#: src/db.c:250 - #, c-format - msgid "ERROR: syntax error at line %1$d in %2$s\n" - msgstr "FEL: syntaxfel på rad %1$d i %2$s\n" - --#: src/db.c:201 -+#: src/db.c:257 - #, c-format - msgid " ERROR: line exceed %1$d characters in %2$s.\n" - msgstr " FEL: raden överstiger %1$d tecken i %2$s.\n" - --#: src/scsi.c:112 src/scsi.c:130 -+#: src/scsi.c:111 src/scsi.c:129 - #, c-format - msgid "log sense failed : %s" - msgstr "igenkänning av logg misslyckades : %s" -+ -+#~ msgid "" -+#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" -+#~ "WARNING: But using a common value, it reports something.\n" -+#~ "WARNING: Note that the temperature shown could be wrong.\n" -+#~ "WARNING: See --help, --debug and --drivebase options.\n" -+#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" -+#~ msgstr "" -+#~ "VARNING: Disken %s verkar inte finnas i databasen över diskar som stöds\n" -+#~ "VARNING: Men använder man ett vanligt värde rapporterar den något.\n" -+#~ "VARNING: Notera att temperaturen som visas kan vara felaktig.\n" -+#~ "VARNING: Se --help, --debug och --drivebase flaggorna.\n" -+#~ "VARNING: Och glöm inte att du kan lägga till din disk till hddtemp.db\n" -+ -+#~ msgid "field(%d)\t = %d\n" -+#~ msgstr "fält(%d)\t = %d\n" ---- hddtemp-0.3-beta15.orig/po/pt.po -+++ hddtemp-0.3-beta15/po/pt.po -@@ -7,7 +7,7 @@ - msgstr "" - "Project-Id-Version: hddtemp 0.3-beta14\n" - "Report-Msgid-Bugs-To: \n" --"POT-Creation-Date: 2005-02-25 22:43+0100\n" -+"POT-Creation-Date: 2006-06-29 16:24+0200\n" - "PO-Revision-Date: 2006-03-29 23:22+0000\n" - "Last-Translator: Miguel Figueiredo \n" - "Language-Team: Portuguese \n" -@@ -15,23 +15,7 @@ - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" - --#: src/hddtemp.c:112 --#, c-format --msgid "" --"\n" --"Regexp%s| Value | Description\n" --"------%s---------------------\n" --msgstr "" --"\n" --"Regexp%s| Valor | Descrição\n" --"------%s-------------------\n" -- --#: src/hddtemp.c:118 --#, c-format --msgid "%s%s| %5d | %s\n" --msgstr "%s%s| %5d | %s\n" -- --#: src/hddtemp.c:161 -+#: src/hddtemp.c:156 - #, c-format - msgid "" - "\n" -@@ -44,7 +28,7 @@ - "Modelo: %s\n" - "\n" - --#: src/hddtemp.c:188 -+#: src/hddtemp.c:189 - #, c-format - msgid "" - "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" -@@ -54,79 +38,68 @@ - msgstr "" - "AVISO: O disco %s não parece ter um sensor de temperatura.\n" - "AVISO: Isto não significa que não tem nenhum.\n" --"AVISO: Se tem a certeza que tem um, por favor contacte-me (hddtemp@guzu.net).\n" -+"AVISO: Se tem a certeza que tem um, por favor contacte-me (hddtemp@guzu." -+"net).\n" - "AVISO: Veja as opções --help, --debug e --drivebase.\n" - --#: src/hddtemp.c:192 -+#: src/hddtemp.c:197 - #, c-format - msgid "%s: %s: no sensor\n" - msgstr "%s: %s: sem sensor\n" - --#: src/hddtemp.c:197 --#, c-format --msgid "" --"WARNING: Drive %s doesn't appear in the database of supported drives\n" --"WARNING: But using a common value, it reports something.\n" --"WARNING: Note that the temperature shown could be wrong.\n" --"WARNING: See --help, --debug and --drivebase options.\n" --"WARNING: And don't forget you can add your drive to hddtemp.db\n" --msgstr "" --"AVISO: O disco %s não parece estar na base de dados de discos suportados\n" --"AVISO: Mas ao utilizar um valor usual, relata alguma coisa.\n" --"AVISO: Note que a temperatura mostrada pode estar errada.\n" --"AVISO: Veja as opções --help, --debug e --frivebase.\n" --"AVISO: E não se esqueça de adicionar o seu disco a hddtemp.db\n" -- --#: src/hddtemp.c:202 -+#: src/hddtemp.c:211 - #, c-format - msgid "%s: %s: %d%sC or %sF\n" - msgstr "%s: %s: %d%sC ou %sF\n" - --#: src/hddtemp.c:214 -+#: src/hddtemp.c:235 - #, c-format - msgid "%s: %s: drive is sleeping\n" - msgstr "%s: %s: o disco está adormecido\n" - --#: src/hddtemp.c:217 --#, c-format --msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" -+#: src/hddtemp.c:242 -+#, fuzzy, c-format -+msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" - msgstr "%s: %s: disco conhecido, mas não tem um sensor de temperatura.\n" - --#: src/hddtemp.c:220 -+#: src/hddtemp.c:246 - #, c-format - msgid "ERROR: %s: %s: unknown returned status\n" - msgstr "ERRO: %s: %s: estado devolvido desconhecido\n" - --#: src/hddtemp.c:235 --#, c-format -+#: src/hddtemp.c:261 -+#, fuzzy, c-format - msgid "" - "\n" - "If one of the field value seems to match the temperature, be sure to read\n" --"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" -+"the hddtemp man page before sending a report (section REPORT). Thanks.\n" - msgstr "" - "\n" --"Se um dos campos de valores parecer coincidir com a temperatura, assegure-se\n" -+"Se um dos campos de valores parecer coincidir com a temperatura, assegure-" -+"se\n" - "que lê a página do manual hddtemp antes de me enviar um relatório (secção\n" - "REPORT). Obrigado.\n" - --#: src/hddtemp.c:308 -+#: src/hddtemp.c:338 - #, c-format - msgid "ERROR: invalid separator.\n" - msgstr "ERRO: separador inválido.\n" - --#: src/hddtemp.c:319 -+#: src/hddtemp.c:349 - #, c-format - msgid "ERROR: invalid port number.\n" - msgstr "ERRO: número de port inválido\n" - --#: src/hddtemp.c:329 --#, c-format -+#: src/hddtemp.c:371 -+#, fuzzy, c-format - msgid "" --" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" -+" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" - "\n" - " hddtemp displays the temperature of drives supplied in argument.\n" - " Drives must support S.M.A.R.T.\n" - "\n" -+" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" -+"\n" - " -b --drivebase : display database file content that allow hddtemp to\n" - " recognize supported drives.\n" - " -D --debug : display various S.M.A.R.T. fields and their values.\n" -@@ -136,6 +109,7 @@ - " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " - "default.)\n" - " -f --file=FILE : specify database file to use.\n" -+" -F --foreground : don't daemonize, stay in foreground.\n" - " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " - "mode).\n" - " -n --numeric : print only the temperature.\n" -@@ -143,6 +117,8 @@ - " -s --separator=C : separator to use between fields (in TCP/IP daemon " - "mode).\n" - " -S --syslog=s : log temperature to syslog every s seconds.\n" -+" -u --unit=[C|F] : force output temperature either in Celsius or " -+"Fahrenheit.\n" - " -q --quiet : do not check if the drive is supported.\n" - " -v --version : display hddtemp version number.\n" - " -w --wake-up : wake-up the drive if need.\n" -@@ -156,19 +132,23 @@ - " hddtemp mostra a temperatura dos discos indicados no argumento.\n" - " Os discos têm de suportar S.M.A.R.T.\n" - "\n" --" -b --drivebase : mostrar o conteúdo do ficheiro de base de dados que\n" -+" -b\t --drivebase : mostrar o conteúdo do ficheiro de base de dados que\n" - " permite ao hddtemp reconhecer os discos suportados.\n" --" -D --debug : mostrar vários campos S.M.A.R.T. e os seus valores.\n" --" Útil para encontrar um valor que pareça coincidir com " --" a temperatura e/ou para me enviar um relatório.\n" -+" -D\t --debug : mostrar vários campos S.M.A.R.T. e os seus valores.\n" -+" Útil para encontrar um valor que pareça coincidir " -+"com a temperatura e/ou para me enviar um relatório.\n" - " (feito para cada disco indicado).\n" --" -d --daemon : correr o hddtemp no modo daemon TCP/IP\n (porto %d por omissão.)\n" -+" -d --daemon : correr o hddtemp no modo daemon TCP/IP\n" -+" (porto %d por omissão.)\n" - " -f --file=FILE : especificar o ficheiro de base de dados a utilizar.\n" --" -l --listen=addr : escutar um interface específico (no modo daemon TCP/IP).\n" -+" -l --listen=addr : escutar um interface específico (no modo daemon TCP/" -+"IP).\n" - " -n --numeric : escrever apenas a temperatura.\n" - " -p --port=# : port para escutar (no modo daemon TCP/IP).\n" --" -s --separator=C : separador a utilizar entre campos (no modo daemon TCP/IP).\n" --" -S --syslog=s : registar a temperatura para o syslog a cada s segundos.\n" -+" -s --separator=C : separador a utilizar entre campos (no modo daemon " -+"TCP/IP).\n" -+" -S --syslog=s : registar a temperatura para o syslog a cada s " -+"segundos.\n" - " -q --quiet : não verificar se o disco é suportado.\n" - " -v --version : mostrar o número da versão do hddtemp.\n" - " -w --wake-up : acordar o disco se necessário.\n" -@@ -177,58 +157,93 @@ - "\n" - "Relatar bugs ou novos discos para .\n" - --#: src/hddtemp.c:522 -+#: src/hddtemp.c:402 - #, c-format - msgid "hddtemp version %s\n" - msgstr "hddtemp versão %s\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:418 - #, c-format - msgid "ERROR: invalid interval.\n" - msgstr "ERRO: intervalo inválido.\n" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:438 -+#, c-format - msgid "Too few arguments: you must specify one drive, at least.\n" --msgstr "Número de argumentos insuficiente: tem de especificar pelo menos um disco.\n" -+msgstr "" -+"Número de argumentos insuficiente: tem de especificar pelo menos um disco.\n" - --#: src/hddtemp.c:557 -+#: src/hddtemp.c:448 -+#, c-format - msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" --msgstr "ERRO: não pode utilizar em conjunto as opções --debug e --daemon ou --syslog.\n" -+msgstr "" -+"ERRO: não pode utilizar em conjunto as opções --debug e --daemon ou --" -+"syslog.\n" - --#: src/hddtemp.c:583 -+#: src/hddtemp.c:505 - #, c-format - msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" --msgstr "ERRO: %s: não é possível determinar o tipo do bus (ou este tipo de bus é desconhecido)\n" -+msgstr "" -+"ERRO: %s: não é possível determinar o tipo do bus (ou este tipo de bus é " -+"desconhecido)\n" - --#: src/ata.c:66 src/scsi.c:68 -+#: src/ata.c:66 src/scsi.c:64 - msgid "unknown" - msgstr "desconhecido" - --#: src/ata.c:98 -+#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 - #, c-format --msgid "field(%d)\t = %d\n" --msgstr "campo(%d)\t = %d\n" -- --#: src/ata.c:167 - msgid "S.M.A.R.T. not available" - msgstr "S.M.A.R.T. não está disponível" - --#: src/db.c:180 -+#: src/db.c:115 -+#, c-format -+msgid "" -+"\n" -+"Regexp%s| Value | Description\n" -+"------%s---------------------\n" -+msgstr "" -+"\n" -+"Regexp%s| Valor | Descrição\n" -+"------%s-------------------\n" -+ -+#: src/db.c:121 -+#, c-format -+msgid "%s%s| %5d | %s\n" -+msgstr "%s%s| %5d | %s\n" -+ -+#: src/db.c:236 - #, c-format - msgid "hddtemp: can't open %1$s: %2$s\n" - msgstr "hddtemp: não pode abrir %1$s: %2$s\n" - --#: src/db.c:194 -+#: src/db.c:250 - #, c-format - msgid "ERROR: syntax error at line %1$d in %2$s\n" - msgstr "ERRO: erro de sintaxe na linha %1$d em %2$s\n" - --#: src/db.c:201 -+#: src/db.c:257 - #, c-format - msgid " ERROR: line exceed %1$d characters in %2$s.\n" - msgstr " ERRO: a linha execedeu %1$d caracteres em %2$s.\n" - --#: src/scsi.c:112 src/scsi.c:130 -+#: src/scsi.c:111 src/scsi.c:129 - #, c-format - msgid "log sense failed : %s" - msgstr "detecção de log falhou: %s" -+ -+#~ msgid "" -+#~ "WARNING: Drive %s doesn't appear in the database of supported drives\n" -+#~ "WARNING: But using a common value, it reports something.\n" -+#~ "WARNING: Note that the temperature shown could be wrong.\n" -+#~ "WARNING: See --help, --debug and --drivebase options.\n" -+#~ "WARNING: And don't forget you can add your drive to hddtemp.db\n" -+#~ msgstr "" -+#~ "AVISO: O disco %s não parece estar na base de dados de discos suportados\n" -+#~ "AVISO: Mas ao utilizar um valor usual, relata alguma coisa.\n" -+#~ "AVISO: Note que a temperatura mostrada pode estar errada.\n" -+#~ "AVISO: Veja as opções --help, --debug e --frivebase.\n" -+#~ "AVISO: E não se esqueça de adicionar o seu disco a hddtemp.db\n" -+ -+#~ msgid "field(%d)\t = %d\n" -+#~ msgstr "campo(%d)\t = %d\n" ---- hddtemp-0.3-beta15.orig/po/de.po -+++ hddtemp-0.3-beta15/po/de.po -@@ -0,0 +1,250 @@ -+# German translation of hddtemp. -+# Copyright (C) 2008 Free Software Foundation, Inc. -+# This file is distributed under the same license as the hddtemp package. -+# Vinzenz Vietzke , 2008. -+# , -+# -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: hddtemp 0.3-beta15-44\n" -+"Report-Msgid-Bugs-To: hddtemp@packages.debian.org\n" -+"POT-Creation-Date: 2006-06-29 16:24+0200\n" -+"PO-Revision-Date: 2011-08-30 16:40+0200\n" -+"Last-Translator: Vinzenz Vietzke \n" -+"Language-Team: \n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit" -+ -+#: src/hddtemp.c:156 -+#, c-format -+msgid "" -+"\n" -+"================= hddtemp %s ==================\n" -+"Model: %s\n" -+"\n" -+msgstr "" -+"\n" -+"================= hddtemp %s ==================\n" -+"Modell: %s\n" -+"\n" -+ -+#: src/hddtemp.c:189 -+#, c-format -+msgid "" -+"WARNING: Drive %s doesn't seem to have a temperature sensor.\n" -+"WARNING: This doesn't mean it hasn't got one.\n" -+"WARNING: If you are sure it has one, please contact me (hddtemp@guzu." -+"net).\n" -+"WARNING: See --help, --debug and --drivebase options.\n" -+msgstr "" -+"WARNUNG: Laufwerk %s scheint keinen Temperatur-Sensor zu haben.\n" -+"WARNUNG: Das bedeutet nicht, dass es keinen besitzt.\n" -+"WARNUNG: Falls Sie sicher sind, dass es einen besitzt, kontaktieren Sie " -+"mich bitte (hddtemp@guzu.net).\n" -+"WARNUNG: Siehe Optionen --help, --debug und --drivebase.\n" -+ -+#: src/hddtemp.c:197 -+#, c-format -+msgid "%s: %s: no sensor\n" -+msgstr "%s: %s: kein Sensor\n" -+ -+#: src/hddtemp.c:211 -+#, c-format -+msgid "%s: %s: %d%sC or %sF\n" -+msgstr "%s: %s: %d%s°C oder %s°F\n" -+ -+#: src/hddtemp.c:235 -+#, c-format -+msgid "%s: %s: drive is sleeping\n" -+msgstr "%s: %s: Laufwerk schläft\n" -+ -+#: src/hddtemp.c:242 -+#, c-format -+msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" -+msgstr "" -+"%s: %s: Laufwerk unterstützt, aber es hat keinen Temperatur-Sensor.\n" -+ -+#: src/hddtemp.c:246 -+#, c-format -+msgid "ERROR: %s: %s: unknown returned status\n" -+msgstr "FEHLER: %s: %s: zurückgegebener Status unbekannt\n" -+ -+#: src/hddtemp.c:261 -+#, c-format -+msgid "" -+"\n" -+"If one of the field value seems to match the temperature, be sure to read\n" -+"the hddtemp man page before sending a report (section REPORT). Thanks.\n" -+msgstr "" -+"\n" -+"Falls einer der Feldwerte der Temperatur zu entsprechen scheint, stellen " -+"Sie\n" -+"sicher, die hddtemp-Handbuchseite gelesen zu haben, bevor Sie einen " -+"Bericht\n" -+"senden (Abschnitt BERICHT). Danke.\n" -+ -+#: src/hddtemp.c:338 -+#, c-format -+msgid "ERROR: invalid separator.\n" -+msgstr "FEHLER: ungültiges Trennzeichen.\n" -+ -+#: src/hddtemp.c:349 -+#, c-format -+msgid "ERROR: invalid port number.\n" -+msgstr "FEHLER: ungültige Portnummer.\n" -+ -+#: src/hddtemp.c:371 -+#, c-format -+msgid "" -+" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" -+"\n" -+" hddtemp displays the temperature of drives supplied in argument.\n" -+" Drives must support S.M.A.R.T.\n" -+"\n" -+" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" -+"\n" -+" -b --drivebase : display database file content that allow hddtemp " -+"to\n" -+" recognize supported drives.\n" -+" -D --debug : display various S.M.A.R.T. fields and their " -+"values.\n" -+" Useful to find a value that seems to match the\n" -+" temperature and/or to send me a report.\n" -+" (done for every drive supplied).\n" -+" -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " -+"default.)\n" -+" -f --file=FILE : specify database file to use.\n" -+" -F --foreground : don't daemonize, stay in foreground.\n" -+" -l --listen=addr : listen on a specific interface (in TCP/IP daemon " -+"mode).\n" -+" -n --numeric : print only the temperature.\n" -+" -p --port=# : port to listen to (in TCP/IP daemon mode).\n" -+" -s --separator=C : separator to use between fields (in TCP/IP daemon " -+"mode).\n" -+" -S --syslog=s : log temperature to syslog every s seconds.\n" -+" -u --unit=[C|F] : force output temperature either in Celsius or " -+"Fahrenheit.\n" -+" -q --quiet : do not check if the drive is supported.\n" -+" -v --version : display hddtemp version number.\n" -+" -w --wake-up : wake-up the drive if need.\n" -+" -4 : listen on IPv4 sockets only.\n" -+" -6 : listen on IPv6 sockets only.\n" -+"\n" -+"Report bugs or new drives to .\n" -+msgstr "" -+" Verwendung: hddtemp [OPTIONEN] [TYP:]LAUFWERK1 [[TYP:]LAUFWERK2]...\n" -+"\n" -+" hddtemp zeigt die Temperatur der via Argument angegeben Laufwerke.\n" -+" Laufwerke müssen S.M.A.R.T. unterstützen.\n" -+"\n" -+" TYP kann SATA, PATA oder SCSI sein. Falls ausgelassen, wird hddtemp \n" -+" versuchen, diesen zu erraten.\n" -+"\n" -+" -b --drivebase : Datenbank-Datei-Inhalt anzeigen, der hddtemp " -+"erlaubt\n" -+" unterstützte Laufwerke zu erkennen.\n" -+" -D --debug : verschiedene S.M.A.R.T.-Felder und deren Werte " -+"anzeigen.\n" -+" Nützlich, um Werte zu finden, die der Temperatur " -+"entsprechen\n" -+" und/oder um mir einen Bericht zu senden.\n" -+" (bereits erledigt für jedes bereitgestellte " -+"Laufwerk).\n" -+" -d --daemon : hddtemp im TCP/IP-Daemon-Modus ausführen " -+"(Standardmäßig Port %d)\n" -+" -f --file=DATEI : zu verwendende Datenbank-Datei festlegen.\n" -+" -F --foreground : nicht daemonisieren, im Vordergrund bleiben.\n" -+" -l --listen=addr : auf einer bestimmten Schnittstelle auf Anfragen " -+"warten (im TCP/IP-Daemon-Modus).\n" -+" -n --numeric : nur die Temperatur ausgeben.\n" -+" -p --port=# : Port, auf dem auf Anfragen gewartet werden soll " -+"(im TCP/IP-Daemon-Modus).\n" -+" -s --separator=C : Trennzeichen zur Verwendung zwischen Feldern (im " -+"TCP/IP-Daemon-Modus).\n" -+" -S --syslog=s : Temperatur alle s Sekunden in das syslog " -+"eintragen.\n" -+" -u --unit=[C|F] : Ausgabe der Temperatur entweder in Celsius oder " -+"Fahrenheit erzwingen.\n" -+" -q --quiet : nicht prüfen, ob das Laufwerk unterstützt wird.\n" -+" -v --version : Versionsnummer von hddtemp anzeigen.\n" -+" -w --wake-up : Laufwerk bei Bedarf aufwecken.\n" -+" -4 : nur auf IPv4-Sockets auf Anfragen warten.\n" -+" -6 : nur auf IPv6-Sockets auf Anfragen warten.\n" -+"\n" -+"Fehler oder neue Laufwerke an melden.\n" -+ -+#: src/hddtemp.c:402 -+#, c-format -+msgid "hddtemp version %s\n" -+msgstr "hddtemp Version %s\n" -+ -+#: src/hddtemp.c:418 -+#, c-format -+msgid "ERROR: invalid interval.\n" -+msgstr "FEHLER: ungültiges Intervall.\n" -+ -+#: src/hddtemp.c:438 -+#, c-format -+msgid "Too few arguments: you must specify one drive, at least.\n" -+msgstr "Zu wenige Argumente: Sie müssen mindestens ein Laufwerk angeben.\n" -+ -+#: src/hddtemp.c:448 -+#, c-format -+msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" -+msgstr "" -+"FEHLER: kann Optionen --debug und --daemon oder --syslog nicht zusammen " -+"verwenden.\n" -+ -+#: src/hddtemp.c:505 -+#, c-format -+msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" -+msgstr "" -+"FEHLER: %s: kann Bus-Typ nicht ermitteln (oder dieser Bus-Typ ist " -+"unbekannt)\n" -+ -+#: src/ata.c:66 src/scsi.c:64 -+msgid "unknown" -+msgstr "unbekannt" -+ -+#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 -+#, c-format -+msgid "S.M.A.R.T. not available" -+msgstr "S.M.A.R.T. nicht verfügbar" -+ -+#: src/db.c:115 -+#, c-format -+msgid "" -+"\n" -+"Regexp%s| Value | Description\n" -+"------%s---------------------\n" -+msgstr "" -+"\n" -+"Regexp%s| Wert | Beschreibung\n" -+"------%s---------------------\n" -+ -+#: src/db.c:121 -+#, c-format -+msgid "%s%s| %5d | %s\n" -+msgstr "%s%s| %5d | %s\n" -+ -+#: src/db.c:236 -+#, c-format -+msgid "hddtemp: can't open %1$s: %2$s\n" -+msgstr "hddtemp: kann %1$s nicht öffnen: %2$s\n" -+ -+#: src/db.c:250 -+#, c-format -+msgid "ERROR: syntax error at line %1$d in %2$s\n" -+msgstr "FEHLER: Syntaxfehler in Zeile %1$d in %2$s\n" -+ -+#: src/db.c:257 -+#, c-format -+msgid " ERROR: line exceed %1$d characters in %2$s.\n" -+msgstr " FEHLER: Zeile überschreitet %1$d Zeichen in %2$s.\n" -+ -+#: src/scsi.c:111 src/scsi.c:129 -+#, c-format -+msgid "log sense failed : %s" -+msgstr "Protokoll-Erkennung fehlgeschlagen : %s" ---- hddtemp-0.3-beta15.orig/po/LINGUAS -+++ hddtemp-0.3-beta15/po/LINGUAS -@@ -1,2 +1,2 @@ - # Set of available languages. --fr pt ru sv -+de fr pt ru sv ---- hddtemp-0.3-beta15.orig/po/hddtemp.pot -+++ hddtemp-0.3-beta15/po/hddtemp.pot -@@ -1,35 +1,22 @@ -- --# Copyright (C) 2006 Free Software Foundation, Inc. --# This file is distributed under the same license as the 'hddtemp' package. --# Emmanuel VARAGNAT , 2006. -+# SOME DESCRIPTIVE TITLE. -+# Copyright (C) YEAR Free Software Foundation, Inc. -+# This file is distributed under the same license as the PACKAGE package. -+# FIRST AUTHOR , YEAR. - # - #, fuzzy - msgid "" - msgstr "" - "Project-Id-Version: PACKAGE VERSION\n" --"Report-Msgid-Bugs-To: hddtemp@guzu.net\n" --"POT-Creation-Date: 2005-02-25 22:43+0100\n" -+"Report-Msgid-Bugs-To: \n" -+"POT-Creation-Date: 2006-06-29 16:24+0200\n" - "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" --"Last-Translator: Emmanuel Varagnat \n" -+"Last-Translator: FULL NAME \n" - "Language-Team: LANGUAGE \n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=CHARSET\n" - "Content-Transfer-Encoding: 8bit\n" - --#: src/hddtemp.c:112 --#, c-format --msgid "" --"\n" --"Regexp%s| Value | Description\n" --"------%s---------------------\n" --msgstr "" -- --#: src/hddtemp.c:118 --#, c-format --msgid "%s%s| %5d | %s\n" --msgstr "" -- --#: src/hddtemp.c:161 -+#: src/hddtemp.c:156 - #, c-format - msgid "" - "\n" -@@ -38,7 +25,7 @@ - "\n" - msgstr "" - --#: src/hddtemp.c:188 -+#: src/hddtemp.c:189 - #, c-format - msgid "" - "WARNING: Drive %s doesn't seem to have a temperature sensor.\n" -@@ -47,67 +34,59 @@ - "WARNING: See --help, --debug and --drivebase options.\n" - msgstr "" - --#: src/hddtemp.c:192 --#, c-format --msgid "%s: %s: no sensor\n" --msgstr "" -- - #: src/hddtemp.c:197 - #, c-format --msgid "" --"WARNING: Drive %s doesn't appear in the database of supported drives\n" --"WARNING: But using a common value, it reports something.\n" --"WARNING: Note that the temperature shown could be wrong.\n" --"WARNING: See --help, --debug and --drivebase options.\n" --"WARNING: And don't forget you can add your drive to hddtemp.db\n" -+msgid "%s: %s: no sensor\n" - msgstr "" - --#: src/hddtemp.c:202 -+#: src/hddtemp.c:211 - #, c-format - msgid "%s: %s: %d%sC or %sF\n" - msgstr "" - --#: src/hddtemp.c:214 -+#: src/hddtemp.c:235 - #, c-format - msgid "%s: %s: drive is sleeping\n" - msgstr "" - --#: src/hddtemp.c:217 -+#: src/hddtemp.c:242 - #, c-format --msgid "%s: %s: known drive, but it doesn't have a temperature sensor.\n" -+msgid "%s: %s: drive supported, but it doesn't have a temperature sensor.\n" - msgstr "" - --#: src/hddtemp.c:220 -+#: src/hddtemp.c:246 - #, c-format - msgid "ERROR: %s: %s: unknown returned status\n" - msgstr "" - --#: src/hddtemp.c:235 -+#: src/hddtemp.c:261 - #, c-format - msgid "" - "\n" - "If one of the field value seems to match the temperature, be sure to read\n" --"the hddtemp man page before sending me a report (section REPORT). Thanks.\n" -+"the hddtemp man page before sending a report (section REPORT). Thanks.\n" - msgstr "" - --#: src/hddtemp.c:308 -+#: src/hddtemp.c:338 - #, c-format - msgid "ERROR: invalid separator.\n" - msgstr "" - --#: src/hddtemp.c:319 -+#: src/hddtemp.c:349 - #, c-format - msgid "ERROR: invalid port number.\n" - msgstr "" - --#: src/hddtemp.c:329 -+#: src/hddtemp.c:371 - #, c-format - msgid "" --" Usage: hddtemp [OPTIONS] DISK1 [DISK2]...\n" -+" Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...\n" - "\n" - " hddtemp displays the temperature of drives supplied in argument.\n" - " Drives must support S.M.A.R.T.\n" - "\n" -+" TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.\n" -+"\n" - " -b --drivebase : display database file content that allow hddtemp to\n" - " recognize supported drives.\n" - " -D --debug : display various S.M.A.R.T. fields and their values.\n" -@@ -117,6 +96,7 @@ - " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by " - "default.)\n" - " -f --file=FILE : specify database file to use.\n" -+" -F --foreground : don't daemonize, stay in foreground.\n" - " -l --listen=addr : listen on a specific interface (in TCP/IP daemon " - "mode).\n" - " -n --numeric : print only the temperature.\n" -@@ -124,6 +104,8 @@ - " -s --separator=C : separator to use between fields (in TCP/IP daemon " - "mode).\n" - " -S --syslog=s : log temperature to syslog every s seconds.\n" -+" -u --unit=[C|F] : force output temperature either in Celsius or " -+"Fahrenheit.\n" - " -q --quiet : do not check if the drive is supported.\n" - " -v --version : display hddtemp version number.\n" - " -w --wake-up : wake-up the drive if need.\n" -@@ -133,58 +115,69 @@ - "Report bugs or new drives to .\n" - msgstr "" - --#: src/hddtemp.c:522 -+#: src/hddtemp.c:402 - #, c-format - msgid "hddtemp version %s\n" - msgstr "" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:418 - #, c-format - msgid "ERROR: invalid interval.\n" - msgstr "" - --#: src/hddtemp.c:547 -+#: src/hddtemp.c:438 -+#, c-format - msgid "Too few arguments: you must specify one drive, at least.\n" - msgstr "" - --#: src/hddtemp.c:557 -+#: src/hddtemp.c:448 -+#, c-format - msgid "ERROR: can't use --debug and --daemon or --syslog options together.\n" - msgstr "" - --#: src/hddtemp.c:583 -+#: src/hddtemp.c:505 - #, c-format - msgid "ERROR: %s: can't determine bus type (or this bus type is unknown)\n" - msgstr "" - --#: src/ata.c:66 src/scsi.c:68 -+#: src/ata.c:66 src/scsi.c:64 - msgid "unknown" - msgstr "" - --#: src/ata.c:98 -+#: src/ata.c:85 src/ata.c:104 src/scsi.c:91 - #, c-format --msgid "field(%d)\t = %d\n" -+msgid "S.M.A.R.T. not available" - msgstr "" - --#: src/ata.c:167 --msgid "S.M.A.R.T. not available" -+#: src/db.c:115 -+#, c-format -+msgid "" -+"\n" -+"Regexp%s| Value | Description\n" -+"------%s---------------------\n" -+msgstr "" -+ -+#: src/db.c:121 -+#, c-format -+msgid "%s%s| %5d | %s\n" - msgstr "" - --#: src/db.c:180 -+#: src/db.c:236 - #, c-format - msgid "hddtemp: can't open %1$s: %2$s\n" - msgstr "" - --#: src/db.c:194 -+#: src/db.c:250 - #, c-format - msgid "ERROR: syntax error at line %1$d in %2$s\n" - msgstr "" - --#: src/db.c:201 -+#: src/db.c:257 - #, c-format - msgid " ERROR: line exceed %1$d characters in %2$s.\n" - msgstr "" - --#: src/scsi.c:112 src/scsi.c:130 -+#: src/scsi.c:111 src/scsi.c:129 - #, c-format - msgid "log sense failed : %s" - msgstr "" ---- hddtemp-0.3-beta15.orig/src/sata.c -+++ hddtemp-0.3-beta15/src/sata.c -@@ -118,11 +118,22 @@ - int i; - u16 * p; - -- if(dsk->db_entry && dsk->db_entry->attribute_id == 0) { -+ if(dsk->db_entry->attribute_id == 0) { - close(dsk->fd); - dsk->fd = -1; - return GETTEMP_NOSENSOR; - } -+ -+ switch(ata_get_powermode(dsk->fd)) { -+ case PWM_STANDBY: -+ case PWM_SLEEPING: -+ if (!wakeup) -+ return GETTEMP_DRIVE_SLEEP; -+ case PWM_UNKNOWN: -+ case PWM_ACTIVE: /* active or idle */ -+ default: -+ break; -+ } - - /* get SMART values */ - if(sata_enable_smart(dsk->fd) != 0) { -@@ -154,24 +165,15 @@ - } - - /* temperature */ -- if(dsk->db_entry && dsk->db_entry->attribute_id > 0) -- field = sata_search_temperature(values, dsk->db_entry->attribute_id); -- else -- field = sata_search_temperature(values, DEFAULT_ATTRIBUTE_ID); -+ field = sata_search_temperature(values, dsk->db_entry->attribute_id); - - if(field) - dsk->value = *(field+3); - - if(dsk->db_entry && dsk->value != -1) - return GETTEMP_KNOWN; -- else { -- if(dsk->value != -1) { -- return GETTEMP_GUESS; -- } -- else { -- return GETTEMP_UNKNOWN; -- } -- } -+ else -+ return GETTEMP_UNKNOWN; - - /* never reached */ - } ---- hddtemp-0.3-beta15.orig/src/satacmds.c -+++ hddtemp-0.3-beta15/src/satacmds.c -@@ -39,7 +39,7 @@ - #include - #include - #include --#include -+#include - - // Application specific includes - #include "satacmds.h" -@@ -80,8 +80,8 @@ - - ret = scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction); - -- /* Verify SATA magics */ -- if (sense[0] != 0x72 || sense[7] != 0x0e || sense[9] != 0x0e || sense[10] != 0x00) -+ /* Verify SATA magic */ -+ if (sense[0] != 0x72) - return 1; - else - return ret; -@@ -95,10 +95,10 @@ - p = s; - end = &s[bytecount & ~1]; /* bytecount must be even */ - -- /* convert from big-endian to host byte order */ -+ /* convert from big-endian to string order */ - for (p = end ; p != s;) { - unsigned short *pp = (unsigned short *) (p -= 2); -- *pp = ntohs(*pp); -+ *pp = bswap_16(*pp); - } - - /* strip leading blanks */ ---- hddtemp-0.3-beta15.orig/src/backtrace.c -+++ hddtemp-0.3-beta15/src/backtrace.c -@@ -16,9 +16,10 @@ - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#define _GNU_SOURCE - #include - --#if defined(__i386__) && defined(__GLIBC__) -+#if (defined(__i386__) || defined(__x86_64__)) && defined(__GLIBC__) - - #include - -@@ -31,8 +32,12 @@ - #include - #include - --#define __USE_GNU - #include -+#if defined(__i386__) -+# define REG_IP REG_EIP -+#elif defined(__x86_64__) -+# define REG_IP REG_RIP -+#endif - - #define MAX_BTSIZE 64 - -@@ -42,7 +47,6 @@ - static char **messages = NULL; - static size_t btsize = 0; - static size_t i; -- static unsigned int old_eip, old_ebp; - static char *strerr = "???"; - static FILE *fstrm; - -@@ -61,10 +65,10 @@ - SIC_CASE(SEGV_MAPERR); - SIC_CASE(SEGV_ACCERR); - } -- fprintf(fstrm, "=== SEGFAULT (%s) : invalid access to %p, in 0x%08x\n", -+ fprintf(fstrm, "=== SEGFAULT (%s) : invalid access to %p, in %p\n", - strerr, - ist->si_addr, -- puc->uc_mcontext.gregs[REG_EIP]); -+ (void*)puc->uc_mcontext.gregs[REG_IP]); - break; - case SIGILL: - switch(ist->si_code) { -@@ -77,10 +81,10 @@ - SIC_CASE(ILL_COPROC); - SIC_CASE(ILL_BADSTK); - } -- fprintf(fstrm, "=== ILLEGAL INSTR (%s) : invalid access to %p, in 0x%08x\n", -+ fprintf(fstrm, "=== ILLEGAL INSTR (%s) : invalid access to %p, in %p\n", - strerr, - ist->si_addr, -- puc->uc_mcontext.gregs[REG_EIP]); -+ (void*)puc->uc_mcontext.gregs[REG_IP]); - break; - case SIGBUS: - switch(ist->si_code) { -@@ -88,10 +92,10 @@ - SIC_CASE(BUS_ADRERR); - SIC_CASE(BUS_OBJERR); - } -- fprintf(fstrm, "=== BUS ERROR (%p) : invalid access to %p, in 0x%08x\n", -+ fprintf(fstrm, "=== BUS ERROR (%p) : invalid access to %p, in %p\n", - strerr, - ist->si_addr, -- puc->uc_mcontext.gregs[REG_EIP]); -+ (void*)puc->uc_mcontext.gregs[REG_IP]); - break; - } - fflush(fstrm); -@@ -101,7 +105,7 @@ - /* - old_eip = *(unsigned int*)((void*)&n-4); - old_ebp = *(unsigned int*)((void*)&n-8); -- *(unsigned int*)((void*)&n-4) = puc->uc_mcontext.gregs[REG_EIP]; -+ *(unsigned int*)((void*)&n-4) = puc->uc_mcontext.gregs[REG_IP]; - *(unsigned int*)((void*)&n-8) = puc->uc_mcontext.gregs[REG_EBP]; - - btsize = backtrace(btinfo, MAX_BTSIZE); -@@ -111,14 +115,14 @@ - */ - - btsize = backtrace(btinfo, MAX_BTSIZE); -- btinfo[1] = (void*) puc->uc_mcontext.gregs[REG_EIP]; -+ btinfo[1] = (void*) puc->uc_mcontext.gregs[REG_IP]; - - messages = backtrace_symbols(btinfo, btsize); - - for(i = 1; - i < btsize; - i++) -- fprintf(fstrm, "[%d] #%d: %s\n", getpid(), i, messages[i]); -+ fprintf(fstrm, "[%d] #%zu: %s\n", getpid(), i, messages[i]); - fflush(fstrm); - fclose(fstrm); - ---- hddtemp-0.3-beta15.orig/src/daemon.c -+++ hddtemp-0.3-beta15/src/daemon.c -@@ -163,19 +163,16 @@ - - switch(dsk->ret) { - case GETTEMP_NOT_APPLICABLE: -- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", -+ n = snprintf(msg, sizeof(msg), "%s%c%s%cNA%c*", - dsk->drive, separator, - dsk->model, separator, -- "NA", separator, -- '*'); -+ separator); - break; -- case GETTEMP_GUESS: - case GETTEMP_UNKNOWN: -- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", -+ n = snprintf(msg, sizeof(msg), "%s%c%s%cUNK%c*", - dsk->drive, separator, -- dsk->model, separator, -- "UNK", separator, -- '*'); -+ dsk->model, separator, -+ separator); - break; - case GETTEMP_KNOWN: - n = snprintf(msg, sizeof(msg), "%s%c%s%c%d%c%c", -@@ -185,26 +182,23 @@ - get_unit(dsk)); - break; - case GETTEMP_NOSENSOR: -- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", -+ n = snprintf(msg, sizeof(msg), "%s%c%s%cNOS%c*", - dsk->drive, separator, - dsk->model, separator, -- "NOS", separator, -- '*'); -+ separator); - break; - case GETTEMP_DRIVE_SLEEP: -- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", -+ n = snprintf(msg, sizeof(msg), "%s%c%s%cSLP%c*", - dsk->drive, separator, - dsk->model, separator, -- "SLP", separator, -- '*'); -+ separator); - break; - case GETTEMP_ERROR: - default: -- n = snprintf(msg, sizeof(msg), "%s%c%s%c%s%c%c", -+ n = snprintf(msg, sizeof(msg), "%s%c%s%cERR%c*", - dsk->drive, separator, - (dsk->model) ? dsk->model : "???", separator, -- "ERR", separator, -- '*'); -+ separator); - break; - } - write(cfd,&separator, 1); -@@ -222,14 +216,11 @@ - for(dsk = ldisks; dsk; dsk = dsk->next) { - switch(dsk->ret) { - case GETTEMP_KNOWN: -- case GETTEMP_GUESS: -- value_to_unit(dsk); -- - syslog(LOG_INFO, "%s: %s: %d %c", - dsk->drive, - dsk->model, -- dsk->value, -- dsk->db_entry->unit); -+ value_to_unit(dsk), -+ get_unit(dsk)); - break; - case GETTEMP_DRIVE_SLEEP: - syslog(LOG_WARNING, _("%s: %s: drive is sleeping"), -@@ -270,28 +261,30 @@ - fd_set deffds; - time_t next_time; - -- switch(fork()) { -- case -1: -- perror("fork"); -- exit(2); -- break; -- case 0: -- break; -- default: -- exit(0); -- } -- -- setsid(); -- -- switch(fork()) { -- case -1: -- perror("fork"); -- exit(2); -- break; -- case 0: -- break; -- default: -- exit(0); -+if (!foreground) { -+ switch(fork()) { -+ case -1: -+ perror("fork"); -+ exit(2); -+ break; -+ case 0: -+ break; -+ default: -+ exit(0); -+ } -+ -+ setsid(); -+ -+ switch(fork()) { -+ case -1: -+ perror("fork"); -+ exit(2); -+ break; -+ case 0: -+ break; -+ default: -+ exit(0); -+ } - } - chdir("/"); - umask(0); ---- hddtemp-0.3-beta15.orig/src/hddtemp.c -+++ hddtemp-0.3-beta15/src/hddtemp.c -@@ -75,7 +75,7 @@ - char separator = SEPARATOR; - - struct bustype * bus[BUS_TYPE_MAX]; --int tcp_daemon, debug, quiet, numeric, wakeup, af_hint; -+int tcp_daemon, debug, quiet, numeric, wakeup, foreground, af_hint; - - static enum { DEFAULT, CELSIUS, FAHRENHEIT } unit; - -@@ -194,23 +194,7 @@ - if (numeric && quiet) - printf("0\n"); - else -- printf(_("%s: %s: no sensor\n"), dsk->drive, dsk->model); -- -- break; -- case GETTEMP_GUESS: -- -- if(!quiet) -- fprintf(stderr, -- _("WARNING: Drive %s doesn't appear in the database of supported drives\n" -- "WARNING: But using a common value, it reports something.\n" -- "WARNING: Note that the temperature shown could be wrong.\n" -- "WARNING: See --help, --debug and --drivebase options.\n" -- "WARNING: And don't forget you can add your drive to hddtemp.db\n"), dsk->drive); -- -- if (! numeric) -- printf(_("%s: %s: %d%sC or %sF\n"), dsk->drive, dsk->model, dsk->value, degree, degree); -- else -- printf("%d\n", value_to_unit(dsk)); -+ fprintf(stderr, _("%s: %s: no sensor\n"), dsk->drive, dsk->model); - - break; - case GETTEMP_KNOWN: -@@ -232,14 +216,14 @@ - if (numeric && quiet) - printf("0\n"); - else -- printf(_("%s: %s: drive is sleeping\n"), dsk->drive, dsk->model); -+ fprintf(stderr, _("%s: %s: drive is sleeping\n"), dsk->drive, dsk->model); - - break; - case GETTEMP_NOSENSOR: - if (numeric && quiet) - printf("0\n"); - else -- printf(_("%s: %s: drive supported, but it doesn't have a temperature sensor.\n"), dsk->drive, dsk->model); -+ fprintf(stderr, _("%s: %s: drive supported, but it doesn't have a temperature sensor.\n"), dsk->drive, dsk->model); - - break; - default: -@@ -268,8 +252,9 @@ - - int main(int argc, char* argv[]) { - int i, c, lindex = 0, db_loaded = 0; -+ int ret = 0; - int show_db; -- struct disk * ldisks; -+ struct disk * ldisks; - - backtrace_sigsegv(); - backtrace_sigill(); -@@ -279,7 +264,7 @@ - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - -- show_db = debug = numeric = quiet = wakeup = af_hint = syslog_interval = 0; -+ show_db = debug = numeric = quiet = wakeup = af_hint = syslog_interval = foreground = 0; - unit = DEFAULT; - portnum = PORT_NUMBER; - listen_addr = NULL; -@@ -294,6 +279,7 @@ - {"drivebase", 0, NULL, 'b'}, - {"debug", 0, NULL, 'D'}, - {"file", 1, NULL, 'f'}, -+ {"foreground", 0, NULL, 'F'}, - {"listen", 1, NULL, 'l'}, - {"version", 0, NULL, 'v'}, - {"port", 1, NULL, 'p'}, -@@ -305,7 +291,7 @@ - {0, 0, 0, 0} - }; - -- c = getopt_long (argc, argv, "bDdf:l:hp:qs:u:vnw46S:", long_options, &lindex); -+ c = getopt_long (argc, argv, "bDdf:l:hp:qs:u:vnw46FS:", long_options, &lindex); - if (c == -1) - break; - -@@ -382,12 +368,13 @@ - " (done for every drive supplied).\n" - " -d --daemon : run hddtemp in TCP/IP daemon mode (port %d by default.)\n" - " -f --file=FILE : specify database file to use.\n" -+ " -F --foreground : don't daemonize, stay in foreground.\n" - " -l --listen=addr : listen on a specific interface (in TCP/IP daemon mode).\n" - " -n --numeric : print only the temperature.\n" - " -p --port=# : port to listen to (in TCP/IP daemon mode).\n" - " -s --separator=C : separator to use between fields (in TCP/IP daemon mode).\n" - " -S --syslog=s : log temperature to syslog every s seconds.\n" -- " -u --unit=[C|F] : force output temperature either in Celius or Fahrenheit.\n" -+ " -u --unit=[C|F] : force output temperature either in Celsius or Fahrenheit.\n" - " -q --quiet : do not check if the drive is supported.\n" - " -v --version : display hddtemp version number.\n" - " -w --wake-up : wake-up the drive if need.\n" -@@ -418,6 +405,9 @@ - } - } - break; -+ case 'F': -+ foreground = 1; -+ break; - default: - exit(1); - } -@@ -489,6 +479,7 @@ - if( (dsk->fd = open(dsk->drive, O_RDONLY | O_NONBLOCK)) < 0) { - snprintf(dsk->errormsg, MAX_ERRORMSG_SIZE, "open: %s\n", strerror(errno)); - dsk->type = ERROR; -+ ret = 1; - continue; - } - -@@ -501,6 +492,7 @@ - - ldisks = dsk->next; - free(dsk); -+ ret = 1; - continue; - } - -@@ -514,11 +506,17 @@ - db_loaded = 1; - } - -+ dsk->db_entry = (struct harddrive_entry *)malloc(sizeof(struct harddrive_entry)); - dbe = is_a_supported_drive(dsk->model); -- if(dbe) { -- dsk->db_entry = (struct harddrive_entry *)malloc(sizeof(struct harddrive_entry)); -+ if(dbe) - memcpy(dsk->db_entry, dbe, sizeof(struct harddrive_entry)); -- } -+ else { -+ dsk->db_entry->regexp = ""; -+ dsk->db_entry->description = ""; -+ dsk->db_entry->attribute_id = DEFAULT_ATTRIBUTE_ID; -+ dsk->db_entry->unit = 'C'; -+ dsk->db_entry->next = NULL; -+ } - } - } - -@@ -530,5 +528,5 @@ - do_direct_mode(ldisks); - } - -- return 0; -+ return ret; - } ---- hddtemp-0.3-beta15.orig/src/ata.c -+++ hddtemp-0.3-beta15/src/ata.c -@@ -75,7 +75,7 @@ - int i; - u16 * p; - -- if(dsk->db_entry && dsk->db_entry->attribute_id == 0) { -+ if(dsk->db_entry->attribute_id == 0) { - close(dsk->fd); - dsk->fd = -1; - return GETTEMP_NOSENSOR; -@@ -140,24 +140,15 @@ - */ - - /* temperature */ -- if(dsk->db_entry && dsk->db_entry->attribute_id > 0) -- field = ata_search_temperature(values, dsk->db_entry->attribute_id); -- else -- field = ata_search_temperature(values, DEFAULT_ATTRIBUTE_ID); -+ field = ata_search_temperature(values, dsk->db_entry->attribute_id); - - if(field) - dsk->value = *(field+3); - -- if(dsk->db_entry && dsk->value != -1) -+ if(dsk->value != -1) - return GETTEMP_KNOWN; -- else { -- if(dsk->value != -1) { -- return GETTEMP_GUESS; -- } -- else { -- return GETTEMP_UNKNOWN; -- } -- } -+ else -+ return GETTEMP_UNKNOWN; - - /* never reached */ - } ---- hddtemp-0.3-beta15.orig/src/hddtemp.h -+++ hddtemp-0.3-beta15/src/hddtemp.h -@@ -39,8 +39,6 @@ - GETTEMP_ERROR, /* Error */ - GETTEMP_NOT_APPLICABLE, /* */ - GETTEMP_UNKNOWN, /* Drive is not in database */ -- GETTEMP_GUESS, /* Not in database, but something was guessed, user must -- check that the temperature returned is correct */ - GETTEMP_KNOWN, /* Drive appear in database */ - GETTEMP_NOSENSOR, /* Drive appear in database but is known to have no sensor */ - GETTEMP_DRIVE_SLEEP /* Drive is sleeping */ -@@ -78,7 +76,7 @@ - - extern struct bustype * bus[BUS_TYPE_MAX]; - extern char errormsg[MAX_ERRORMSG_SIZE]; --extern int tcp_daemon, debug, quiet, wakeup, af_hint; -+extern int tcp_daemon, debug, quiet, wakeup, af_hint, foreground; - extern char separator; - extern long portnum, syslog_interval; - extern char * listen_addr; ---- hddtemp-0.3-beta15.orig/src/scsicmds.c -+++ hddtemp-0.3-beta15/src/scsicmds.c -@@ -147,6 +147,7 @@ - return 1; - else { - scsi_fixstring(buffer + 8, 24); -+ buffer[32] = 0; - return 0; - } - } diff --git a/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk b/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk index 5cd4e61fce..6a3896990e 100644 --- a/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/hid_mapper/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="hid_mapper" -PKG_VERSION="0" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="2.1.0" +PKG_SHA256="e740c1f3a99f260f015ea7d415f0419e27171356e2eddff1781fc5d936cc86cd" PKG_LICENSE="GPL" -PKG_SITE="" -PKG_URL="http://www.coldsource.net/hid_mapper.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}_beta" +PKG_SITE="https://github.com/s-leroux/hid_mapper" +PKG_URL="https://github.com/s-leroux/hid_mapper/archive/v${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="generic HID mapper" -PKG_LONGDESC="generic HID mapper" -PKG_AUTORECONF="no" +PKG_LONGDESC="A Generic HID mapper." makeinstall_target() { : # nope diff --git a/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch index 84130e692c..c2bb51c12d 100644 --- a/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch +++ b/packages/addons/addon-depends/system-tools-depends/hid_mapper/patches/hid_mapper-03_fix-parser.patch @@ -1,16 +1,14 @@ -diff --git a/MapReader.cpp b/MapReader.cpp -index e64b636..bd1ab68 100644 --- a/MapReader.cpp +++ b/MapReader.cpp -@@ -98,7 +98,10 @@ void MapReader::LoadMap(const char *filename,EventMapping *map) - +@@ -106,7 +106,10 @@ i = 0; - while(i. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="i2c-tools" PKG_VERSION="3.1.2" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="f939a6242c03950cc568d0efdfa3db7a9c29e0e8f5abd01f2908bdd344c054ff" PKG_LICENSE="GPL" PKG_SITE="http://www.lm-sensors.org/wiki/I2CTools" PKG_URL="http://fossies.org/linux/misc/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="debug/tools" -PKG_SHORTDESC="i2c-tools: bus probing tool, eeprom decoding/programming and SMBus python interface" -PKG_LONGDESC="The i2c-tools package contains a heterogeneous set of I2C tools for Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers, EEPROM decoding scripts, EEPROM programming tools, and a python module for SMBus access." -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="A heterogeneous set of I2C tools for Linux." pre_make_target() { export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" @@ -39,7 +20,7 @@ make_target() { CC="$CC" \ AR="$TARGET_AR" \ CFLAGS="$TARGET_CFLAGS" \ - CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/python2.7" + CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/$PKG_PYTHON_VERSION" } makeinstall_target() { diff --git a/packages/addons/addon-depends/system-tools-depends/inotify-tools/package.mk b/packages/addons/addon-depends/system-tools-depends/inotify-tools/package.mk index 37750dee88..711e3e6ec2 100644 --- a/packages/addons/addon-depends/system-tools-depends/inotify-tools/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/inotify-tools/package.mk @@ -1,42 +1,22 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="inotify-tools" -PKG_VERSION="1df9af4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.20.1" +PKG_SHA256="a433cc1dedba851078276db69b0e97f9fe41e4ba3336d2971adfca4b3a6242ac" PKG_LICENSE="GPLv2" PKG_SITE="http://wiki.github.com/rvoicilas/inotify-tools/" -PKG_URL="https://github.com/rvoicilas/$PKG_NAME/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/rvoicilas/inotify-tools/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="inotify-tools" -PKG_LONGDESC="a C library and a set of command-line programs for Linux providing a simple interface to inotify" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A C library and a set of command-line programs for Linux providing a simple interface to inotify." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --disable-doxygen" pre_configure_target() { CFLAGS="$CFLAGS -Wno-error=misleading-indentation" } makeinstall_target() { - : nothing to do + : } diff --git a/packages/addons/addon-depends/system-tools-depends/jq/package.mk b/packages/addons/addon-depends/system-tools-depends/jq/package.mk index 6e19e932d7..95e7329a8e 100644 --- a/packages/addons/addon-depends/system-tools-depends/jq/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/jq/package.mk @@ -1,37 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="jq" -PKG_VERSION="1.5" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="1.6" +PKG_SHA256="5de8c8e29aaa3fb9cc6b47bb27299f271354ebb72514e3accadc7d38b5bbaa72" PKG_LICENSE="MIT" PKG_SITE="http://stedolan.github.io/jq/" -PKG_URL="http://github.com/stedolan/jq/releases/download/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="jq is a command-line JSON processor" -PKG_LONGDESC="jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text." +PKG_URL="https://github.com/stedolan/jq/releases/download/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain oniguruma" +PKG_LONGDESC="A like sed for JSON data." -PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ --enable-static \ - --disable-maintainer-mode" + --disable-docs \ + --disable-maintainer-mode \ + --disable-valgrind" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk b/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk index 5c9a7316c3..ef4e746599 100644 --- a/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/lm_sensors/package.mk @@ -1,42 +1,25 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="lm_sensors" -PKG_VERSION="3.4.0" -PKG_REV="1" +PKG_VERSION="e8afbda10fba571c816abddcb5c8180afc435bba" +PKG_SHA256="255b9a9b30c7969b3df0460392a807239c18b15baac1ff33ff5fef3b1cc1169d" PKG_ARCH="arm x86_64" PKG_LICENSE="GPL" PKG_SITE="http://secure.netroedge.com/~lm78/" -PKG_URL="http://ftp.gwdg.de/pub/linux/misc/lm-sensors/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://github.com/groeck/lm-sensors/archive/${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="lm_sensors: Hardware monitoring via the SMBus" -PKG_LONGDESC="lm_sensors is a package to get data from the SMB (System Management Bus - an i2c bus) on modern mainboards. It consists of kernel modules and users space tools to get stuff like cpu / mb temperature, voltages, fan speed..." +PKG_LONGDESC="Provides user-space support for the hardware monitoring drivers." -# TODO: PKG_MAKE_OPTS_TARGET + ETCDIR=/storage/.kodi/addons/tools.lm_sensors/data if one wants sensor3.conf.. -PKG_MAKE_OPTS_TARGET="PREFIX=/usr CC=$CC AR=$AR" PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr" pre_make_target() { + PKG_MAKE_OPTS_TARGET="PREFIX=/usr CC=$CC AR=$AR" + export CFLAGS="$TARGET_CFLAGS" export CPPFLAGS="$TARGET_CPPFLAGS" } makeinstall_target() { - : # meh + : } diff --git a/packages/addons/addon-depends/system-tools-depends/lshw/package.mk b/packages/addons/addon-depends/system-tools-depends/lshw/package.mk index 0b448d68e2..28cf8ab9ce 100644 --- a/packages/addons/addon-depends/system-tools-depends/lshw/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/lshw/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="lshw" -PKG_VERSION="B.02.17" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="B.02.18" +PKG_SHA256="ae22ef11c934364be4fd2a0a1a7aadf4495a0251ec6979da280d342a89ca3c2f" PKG_LICENSE="GPL" PKG_SITE="http://ezix.org/project/wiki/HardwareLiSter" PKG_URL="http://ezix.org/software/files/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="lshw (Hardware Lister)" -PKG_LONGDESC="lshw (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine." -PKG_AUTORECONF="no" +PKG_LONGDESC="A small tool to provide detailed information on the hardware configuration of the machine." make_target() { make CXX=$CXX -C src/ diff --git a/packages/addons/addon-depends/system-tools-depends/mc/package.mk b/packages/addons/addon-depends/system-tools-depends/mc/package.mk index acbe1d821f..c5d1c884c6 100644 --- a/packages/addons/addon-depends/system-tools-depends/mc/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/mc/package.mk @@ -1,62 +1,48 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mc" -PKG_VERSION="4.8.17" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.8.21" +PKG_SHA256="8f37e546ac7c31c9c203a03b1c1d6cb2d2f623a300b86badfd367e5559fe148c" PKG_LICENSE="GPL" PKG_SITE="http://www.midnight-commander.org" -PKG_URL="http://ftp.midnight-commander.org/${PKG_NAME}-${PKG_VERSION}.tar.xz" -PKG_DEPENDS_TARGET="toolchain libtool:host gettext:host glib pcre netbsd-curses" -PKG_SECTION="tools" -PKG_SHORTDESC="mc: visual file manager" -PKG_LONGDESC="mc is a visual file manager, licensed under GNU General Public License and therefore qualifies as Free Software. It's a feature rich full-screen text mode application that allows you to copy, move and delete files and whole directory trees, search for files and run commands in the subshell. Internal viewer and editor are included" +PKG_URL="http://ftp.midnight-commander.org/mc-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain gettext:host glib libssh2 libtool:host ncurses pcre" +PKG_LONGDESC="Midnight Commander is a text based filemanager that emulates Norton Commander." -PKG_AUTORECONF="no" -PKG_IS_ADDON="no" - -PKG_CONFIGURE_OPTS_TARGET="--sysconfdir=/storage/.kodi/addons/virtual.system-tools/etc \ - --datadir=/storage/.kodi/addons/virtual.system-tools/data \ - --libdir=/storage/.kodi/addons/virtual.system-tools/mclib \ - --disable-mclib \ - --disable-aspell \ - --disable-vfs \ - --disable-doxygen-doc \ - --disable-doxygen-dot \ - --disable-doxygen-html \ - --with-sysroot=$SYSROOT_PREFIX \ - --with-screen=ncurses \ - --without-x \ - --with-gnu-ld \ - --without-libiconv-prefix \ - --without-libintl-prefix \ - --with-internal-edit \ - --without-diff-viewer \ - --with-subshell" +PKG_CONFIGURE_OPTS_TARGET=" \ + --datadir=/storage/.kodi/addons/virtual.system-tools/data \ + --libexecdir=/storage/.kodi/addons/virtual.system-tools/mclib \ + --with-homedir=/storage/.kodi/userdata/addon_data/virtual.system-tools \ + --sysconfdir=/storage/.kodi/addons/virtual.system-tools/etc \ + --with-screen=ncurses \ + --with-sysroot=$SYSROOT_PREFIX \ + --disable-aspell \ + --without-diff-viewer \ + --disable-doxygen-doc \ + --disable-doxygen-dot \ + --disable-doxygen-html \ + --with-gnu-ld \ + --without-libiconv-prefix \ + --without-libintl-prefix \ + --with-internal-edit \ + --disable-mclib \ + --with-subshell \ + --enable-vfs-extfs \ + --enable-vfs-ftp \ + --enable-vfs-sftp \ + --enable-vfs-tar \ + --without-x" pre_configure_target() { - export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/ncurses" - export LDFLAGS="$(echo $LDFLAGS | sed -e "s|-Wl,--as-needed||") -ltermcap" + LDFLAGS="$LDFLAGS -lcrypto -lssl" } post_makeinstall_target() { rm -rf $INSTALL/storage/.kodi/addons/virtual.system-tools/data/locale rm -rf $INSTALL/storage/.kodi/addons/virtual.system-tools/data/mc/help/mc.hlp.* + mv $INSTALL/usr/bin/mc $INSTALL/usr/bin/mc-bin + rm -f $INSTALL/usr/bin/{mcedit,mcview} + cp $PKG_DIR/wrapper/* $INSTALL/usr/bin } diff --git a/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-01-netbsd-curses.patch b/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-01-netbsd-curses.patch deleted file mode 100644 index 112ed0fe89..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-01-netbsd-curses.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 38d4c655d322837574e957b4a824f4a0d1bb3b86 Mon Sep 17 00:00:00 2001 -From: rofl0r -Date: Mon, 18 Jul 2016 22:19:56 +0100 -Subject: [PATCH] Ticket #3665: fix compatibility with netbsd curses. - -The code that manipulates the ncurses backend into changing -the key combination to generate SIGINT from CTRL-c to CTRL-g does -so by accessing undocumented internal ncurses data structures. -This breaks compilation with netbsd-curses[0], and could also break -when the ncurses author decides to change internal structures in a -future release. - -Fix it by using a portable approach that works everywhere using libc -primitives instead. - -[0] https://github.com/sabotage-linux/netbsd-curses - -Signed-off-by: Andrew Borodin ---- - lib/tty/tty-ncurses.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c -index efee8ec..76a21d2 100644 ---- a/lib/tty/tty-ncurses.c -+++ b/lib/tty/tty-ncurses.c -@@ -179,6 +179,7 @@ mc_tty_normalize_lines_char (const char *ch) - void - tty_init (gboolean mouse_enable, gboolean is_xterm) - { -+ struct termios mode; - initscr (); - - #ifdef HAVE_ESCDELAY -@@ -194,11 +195,12 @@ tty_init (gboolean mouse_enable, gboolean is_xterm) - ESCDELAY = 200; - #endif /* HAVE_ESCDELAY */ - -+ tcgetattr (STDIN_FILENO, &mode); - /* use Ctrl-g to generate SIGINT */ -- cur_term->Nttyb.c_cc[VINTR] = CTRL ('g'); /* ^g */ -+ mode.c_cc[VINTR] = CTRL ('g'); /* ^g */ - /* disable SIGQUIT to allow use Ctrl-\ key */ -- cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE; -- tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb); -+ mode.c_cc[VQUIT] = NULL_VALUE; -+ tcsetattr (STDIN_FILENO, TCSANOW, &mode); - - tty_start_interrupt_key (); - diff --git a/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-02-netbsd-curses.patch b/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-02-netbsd-curses.patch deleted file mode 100644 index eb09de4174..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/mc/patches/mc-02-netbsd-curses.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2da86f2595157c68c2d49e6c2b08a508750878ed Mon Sep 17 00:00:00 2001 -From: Andrew Borodin -Date: Tue, 9 Aug 2016 16:55:12 +0300 -Subject: [PATCH] Define NCURSES_CONST if curses library doesn't define it. - -Signed-off-by: Andrew Borodin ---- - lib/tty/tty-ncurses.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/lib/tty/tty-ncurses.h b/lib/tty/tty-ncurses.h -index 4f0e603..9962c7c 100644 ---- a/lib/tty/tty-ncurses.h -+++ b/lib/tty/tty-ncurses.h -@@ -20,6 +20,11 @@ - #include - #endif /* USE_NCURSESW */ - -+/* netbsd-libcurses doesn't define NCURSES_CONST */ -+#ifndef NCURSES_CONST -+#define NCURSES_CONST const -+#endif -+ - /*** typedefs(not structures) and defined constants **********************************************/ - - /*** enums ***************************************************************************************/ - diff --git a/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mc b/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mc new file mode 100644 index 0000000000..c006477ebd --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mc @@ -0,0 +1,4 @@ +#!/bin/sh +HISTFILE="/run/mc_histfile" +export HISTFILE +exec mc-bin "$@" diff --git a/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mcedit b/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mcedit new file mode 100644 index 0000000000..43b7815f4c --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mcedit @@ -0,0 +1,4 @@ +#!/bin/sh +HISTFILE="/run/mc_histfile" +export HISTFILE +exec mc-bin -e "$@" diff --git a/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mcview b/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mcview new file mode 100644 index 0000000000..7aec5c875a --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/mc/wrapper/mcview @@ -0,0 +1,4 @@ +#!/bin/sh +HISTFILE="/run/mc_histfile" +export HISTFILE +exec mc-bin -v "$@" diff --git a/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk b/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk index 4b18d005a9..31295323ba 100644 --- a/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/mrxvt/package.mk @@ -1,34 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mrxvt" PKG_VERSION="0.5.4" -PKG_REV="0" +PKG_SHA256="f403ad5a908fcd38a55ed0a7e1b85584cb77be8781199653a39b8af1a9ad10d7" PKG_ARCH="i386 x86_64" PKG_LICENSE="GPL" PKG_SITE="http://materm.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/materm/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libX11" -PKG_SECTION="tools" -PKG_SHORTDESC="mrxvt: Lightweight Xterm replacement" -PKG_LONGDESC="Mrxvt (previously named as materm) is a lightweight and powerful multi-tabbed X terminal emulator based on the popular rxvt and aterm. It implements many useful features seen in some modern X terminal emulators, like gnome-terminal and konsole, but keep to be lightweight and independent from the GNOME and KDE desktop environment." -PKG_AUTORECONF="yes" - +PKG_LONGDESC="A lightweight and powerful multi-tabbed X terminal emulator based on the popular rxvt and aterm." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_setpgrp_void=no \ --enable-minimal \ diff --git a/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk b/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk index 096fc9d4ef..dcfeb0cabd 100644 --- a/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/mtpfs/package.mk @@ -1,38 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mtpfs" -PKG_VERSION="1.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="fd3864dd6f0e8183fa2598d4cf890401d3a1e09a" +PKG_SHA256="f004136a82452d13362581277eb2496033aa13a6c3f35d0501327248f3120456" PKG_LICENSE="GPL" PKG_SITE="http://www.adebenham.com/mtpfs/" -PKG_URL="http://www.adebenham.com/files/mtp/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain fuse libmtp glib" -PKG_SECTION="tools" -PKG_SHORTDESC="MTPfs is a FUSE filesystem that supports reading and writing from any MTP device" -PKG_LONGDESC="MTPfs is a FUSE filesystem that supports reading and writing from any MTP device" -PKG_AUTORECONF="no" +PKG_URL="https://github.com/cjd/mtpfs/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain fuse glib libmtp" +PKG_LONGDESC="MTPfs is a FUSE filesystem that supports reading and writing from any MTP device." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-mad" -# TODO: mtpfs runs host utils while building, fix and set PKG_ARCH="any" - +# TODO: mtpfs runs host utils while building, fix and set pre_configure_target() { export LIBS="-lusb-1.0 -ludev" } diff --git a/packages/addons/addon-depends/system-tools-depends/nmon/package.mk b/packages/addons/addon-depends/system-tools-depends/nmon/package.mk index 7aa805b893..3fccf70529 100644 --- a/packages/addons/addon-depends/system-tools-depends/nmon/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/nmon/package.mk @@ -1,34 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="nmon" -PKG_VERSION="411b08f" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="411b08f1c98bca8b24670fc2d9ee6325b4fcb3d2" +PKG_SHA256="aa88257728e820db10b1f04792dfcc1b8a483de51bfda70db016da016a4879a2" PKG_LICENSE="GPL" PKG_SITE="https://github.com/axibase/nmon" PKG_URL="https://github.com/axibase/nmon/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses" -PKG_SECTION="tools" -PKG_SHORTDESC="Systems administrator, tuner, benchmark tool gives you a huge amount of important performance information in one go" -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_LONGDESC="Systems administrator, tuner, benchmark tool gives you a huge amount of important performance information in one go." +PKG_TOOLCHAIN="manual" make_target() { case $ARCH in @@ -40,10 +21,6 @@ make_target() { ;; esac CFLAGS="$CFLAGS -g -O3 -Wall -D JFS -D GETUSER -D LARGEMEM" - LDFLAGS="$LDFLAGS -lncurses -ltermcap -lm -g" + LDFLAGS="$LDFLAGS -lncurses -lm -g" $CC -o nmon lmon*.c $CFLAGS $LDFLAGS -D $arch -D KERNEL_2_6_18 } - -makeinstall_target() { - : -} diff --git a/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk b/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk index 271dd0fa4d..4db0399de1 100644 --- a/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/p7zip/package.mk @@ -1,39 +1,25 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="p7zip" -PKG_VERSION="15.14" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="16.02" +PKG_SHA256="5eb20ac0e2944f6cb9c2d51dd6c4518941c185347d4089ea89087ffdd6e2341f" PKG_LICENSE="GPL" PKG_SITE="http://p7zip.sourceforge.net/" PKG_URL="http://downloads.sourceforge.net/project/p7zip/p7zip/${PKG_VERSION}/p7zip_${PKG_VERSION}_src_all.tar.bz2" -PKG_SOURCE_DIR="${PKG_NAME}_${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="p7zip is a port of 7za.exe for POSIX systems like Unix" -PKG_LONGDESC="p7zip is a port of 7za.exe for POSIX systems like Unix" -PKG_AUTORECONF="no" +PKG_LONGDESC="p7zip is a port of 7za.exe for POSIX systems like Unix." +PKG_TOOLCHAIN="manual" + +make_host() { + make CXX=$CXX CC=$CC 7za +} make_target() { - make TARGET_CXX=$CXX TARGET_CC=$CC 7z 7za + make CXX=$CXX CC=$CC 7z 7za } -makeinstall_target() { - : # nop +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp bin/7za $TOOLCHAIN/bin } diff --git a/packages/addons/addon-depends/system-tools-depends/p7zip/patches/p7zip-crosscompile.patch b/packages/addons/addon-depends/system-tools-depends/p7zip/patches/p7zip-crosscompile.patch deleted file mode 100644 index 5e022073bd..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/p7zip/patches/p7zip-crosscompile.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur p7zip_15.14/makefile.machine p7zip_15.14.patch/makefile.machine ---- p7zip_15.14/makefile.machine 2016-03-13 18:30:21.000000000 +0100 -+++ p7zip_15.14.patch/makefile.machine 2016-03-27 03:17:45.348285607 +0200 -@@ -10,8 +10,8 @@ - -D_7ZIP_LARGE_PAGES \ - $(LOCAL_FLAGS) - --CXX=g++ --CC=gcc -+CXX=$(TARGET_CXX) -+CC=$(TARGET_CC) - CC_SHARED=-fPIC - LINK_SHARED=-fPIC -shared - diff --git a/packages/addons/addon-depends/system-tools-depends/patch/package.mk b/packages/addons/addon-depends/system-tools-depends/patch/package.mk index 7c350f9202..57ed258a71 100644 --- a/packages/addons/addon-depends/system-tools-depends/patch/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/patch/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="patch" -PKG_VERSION="2.7.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.7.6" +PKG_SHA256="ac610bda97abe0d9f6b7c963255a11dcb196c25e337c61f94e4778d632f1d8fd" PKG_LICENSE="GPL" PKG_SITE="http://savannah.gnu.org/projects/patch/" PKG_URL="http://ftpmirror.gnu.org/patch/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="GNU patch" -PKG_LONGDESC="Patch takes a patch file containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions" -PKG_AUTORECONF="no" +PKG_LONGDESC="Patch takes a patch file containing a difference listing produced by the diff." PKG_CONFIGURE_OPTS_TARGET="--disable-xattr" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/pv/package.mk b/packages/addons/addon-depends/system-tools-depends/pv/package.mk index eaecaeaad8..eab8bb0a3a 100644 --- a/packages/addons/addon-depends/system-tools-depends/pv/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/pv/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pv" -PKG_VERSION="1.6.0" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="1.6.6" +PKG_SHA256="608ef935f7a377e1439c181c4fc188d247da10d51a19ef79bcdee5043b0973f1" PKG_LICENSE="GNU" PKG_SITE="http://www.ivarch.com/programs/pv.shtml" -PKG_URL="http://www.ivarch.com/programs/sources/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="http://www.ivarch.com/programs/sources/pv-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="Pipe Viewer is a terminal-based tool for monitoring the progress of data through a pipeline" -PKG_LONGDESC="Pipe Viwer can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion." -PKG_AUTORECONF="no" +PKG_LONGDESC="Pipe Viwer can be inserted into any normal pipeline between two processes." PKG_CONFIGURE_OPTS_TARGET="--enable-static-nls" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/screen/package.mk b/packages/addons/addon-depends/system-tools-depends/screen/package.mk index f9367d4e91..dd2fb45f98 100644 --- a/packages/addons/addon-depends/system-tools-depends/screen/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/screen/package.mk @@ -1,48 +1,31 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screen" -PKG_VERSION="4.3.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.6.2" +PKG_SHA256="1b6922520e6a0ce5e28768d620b0f640a6631397f95ccb043b70b91bb503fa3a" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/screen/" PKG_URL="http://ftpmirror.gnu.org/screen/$PKG_NAME-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses" -PKG_SECTION="shell/console" -PKG_SHORTDESC="terminal multiplexor with VT100/ANSI terminal emulation" -PKG_LONGDESC="screen is a terminal multiplexor that runs several separate screens on a single physical character-based terminal. Each virtual terminal emulates a DEC VT100 plus several ANSI X3.64 and ISO 2022 functions. Screen sessions can be detached and resumed later on a different terminal." -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_LONGDESC="Screen is a window manager that multiplexes a physical terminal between several processes" PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_utempter_h=no \ + --enable-colors256 \ --disable-pam \ --disable-use-locale \ --disable-telnet \ --disable-socket-dir" pre_configure_target() { + CFLAGS="$CFLAGS -DTERMINFO" export LDFLAGS=`echo $LDFLAGS | sed -e "s|-Wl,--as-needed||"` # screen fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME } makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/smartmontools/package.mk b/packages/addons/addon-depends/system-tools-depends/smartmontools/package.mk new file mode 100644 index 0000000000..e1635179dc --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/smartmontools/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="smartmontools" +PKG_VERSION="7.0" +PKG_SHA256="e5e1ac2786bc87fdbd6f92d0ee751b799fbb3e1a09c0a6a379f9eb64b3e8f61c" +PKG_LICENSE="GPL" +PKG_SITE="https://www.smartmontools.org" +PKG_URL="https://downloads.sourceforge.net/sourceforge/smartmontools/smartmontools-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Control and monitor storage systems using S.M.A.R.T." + +PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ + --without-initscriptdir \ + --without-nvme-devicescan \ + --without-systemdenvfile \ + --without-systemdsystemunitdir \ + --without-systemdenvfile \ + --without-systemdsystemunitdir" + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/system-tools-depends/strace/package.mk b/packages/addons/addon-depends/system-tools-depends/strace/package.mk index 6e521bc530..c8d3375229 100644 --- a/packages/addons/addon-depends/system-tools-depends/strace/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/strace/package.mk @@ -1,34 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="strace" -PKG_VERSION="4.11" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.26" +PKG_SHA256="7c4d2ffeef4f7d1cdc71062ca78d1130eb52f947c2fca82f59f6a1183bfa1e1c" PKG_LICENSE="BSD" -PKG_SITE="http://sourceforge.net/projects/strace/" -PKG_URL="$SOURCEFORGE_SRC/strace/strace/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_SITE="https://strace.io/" +PKG_URL="https://strace.io/files/$PKG_VERSION/strace-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="strace: Trace system calls and signals" -PKG_LONGDESC="In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments and its return value are printed on standard error or to the file specified with the -o option." -PKG_AUTORECONF="yes" +PKG_LONGDESC="strace is a diagnostic, debugging and instructional userspace utility" +PKG_TOOLCHAIN="autotools" makeinstall_target() { - : # nothing to do here + : } diff --git a/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-4.8-autoreconf.patch b/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-4.8-autoreconf.patch deleted file mode 100644 index bf7efa09c6..0000000000 --- a/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-4.8-autoreconf.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -Naur strace-4.8/configure.ac strace-4.8.patch/configure.ac ---- strace-4.8/configure.ac 2013-05-04 21:51:57.000000000 +0200 -+++ strace-4.8.patch/configure.ac 2013-09-04 03:30:12.478057723 +0200 -@@ -1,8 +1,6 @@ - dnl Process this file with autoconf to create configure. Use autoreconf. - AC_PREREQ(2.57) --AC_INIT([strace], -- m4_esyscmd([./git-version-gen .tarball-version]), -- [strace-devel@lists.sourceforge.net]) -+AC_INIT([strace],[4.8]) - AC_CONFIG_SRCDIR([strace.c]) - AC_CONFIG_AUX_DIR([.]) - AC_CONFIG_HEADERS([config.h]) diff --git a/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-autoreconf.patch b/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-autoreconf.patch new file mode 100644 index 0000000000..3a065456f9 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/strace/patches/strace-autoreconf.patch @@ -0,0 +1,15 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -31,11 +31,7 @@ + # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + AC_PREREQ(2.57) +-AC_INIT([strace], +- m4_esyscmd([./git-version-gen .tarball-version]), +- [strace-devel@lists.strace.io], +- [strace], +- [https://strace.io]) ++AC_INIT([strace],[4.22]) + m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year])) + AC_COPYRIGHT([Copyright (C) 1999-]copyright_year[ The strace developers.]) + AC_CONFIG_SRCDIR([strace.c]) diff --git a/packages/addons/addon-depends/system-tools-depends/stress-ng/package.mk b/packages/addons/addon-depends/system-tools-depends/stress-ng/package.mk new file mode 100644 index 0000000000..4885e2a7b9 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/stress-ng/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="stress-ng" +PKG_VERSION="0.09.50" +PKG_SHA256="b07290495794092cdf2f8d51ac631f28b8cec9455a16552d8ca48bc1f376c634" +PKG_LICENSE="GPLv2" +PKG_SITE="http://kernel.ubuntu.com/~cking/stress-ng/" +PKG_URL="http://kernel.ubuntu.com/~cking/tarballs/stress-ng/stress-ng-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain attr keyutils libaio libcap zlib" +PKG_LONGDESC="stress-ng will stress test a computer system in various selectable ways" diff --git a/packages/addons/addon-depends/system-tools-depends/unrar/package.mk b/packages/addons/addon-depends/system-tools-depends/unrar/package.mk index 5f7bed1122..47b9eb6b7c 100644 --- a/packages/addons/addon-depends/system-tools-depends/unrar/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/unrar/package.mk @@ -1,34 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="unrar" -PKG_VERSION="5.3.11" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5.6.8" +PKG_SHA256="a4cc0ac14a354827751912d2af4a0a09e2c2129df5766576fa7e151791dd3dff" PKG_LICENSE="free" PKG_SITE="http://www.rarlab.com" PKG_URL="http://www.rarlab.com/rar/unrarsrc-$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="unrar: Extract, test and view RAR archives" -PKG_LONGDESC="Unrar is a package to handle files compressed in the RAR format. Due to strange licensing issues this package can only view, test and extract files in a given archive, but not pack files. But since we have far more advanced open-source compression utils it should be enough to extract the content when you get a RAR archive." -PKG_AUTORECONF="no" +PKG_LONGDESC="unrar extract, test and view RAR archives" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="+pic" make_target() { make CXX="$CXX" \ @@ -36,9 +18,17 @@ make_target() { RANLIB="$RANLIB" \ AR="$AR" \ STRIP="$STRIP" \ - -f makefile + -f makefile unrar + + make clean + + make CXX="$CXX" \ + CXXFLAGS="$TARGET_CXXFLAGS" \ + RANLIB="$RANLIB" \ + AR="$AR" \ + -f makefile lib } -makeinstall_target() { - : # nop +post_make_target() { + rm -f libunrar.so } diff --git a/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk b/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk index fa54c1f8cc..f8a5173daf 100644 --- a/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk +++ b/packages/addons/addon-depends/system-tools-depends/usb-modeswitch/package.mk @@ -1,34 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="usb-modeswitch" -PKG_VERSION="2.3.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.5.2" +PKG_SHA256="abffac09c87eacd78e101545967dc25af7e989745b4276756d45dbf4008a2ea6" PKG_LICENSE="GPL" PKG_SITE="http://www.draisberghof.de/usb_modeswitch/" PKG_URL="http://www.draisberghof.de/usb_modeswitch/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain libusb" -PKG_SECTION="tools" -PKG_SHORTDESC="USB_ModeSwitch - Handling Mode-Switching USB Devices on Linux" PKG_LONGDESC="USB_ModeSwitch - Handling Mode-Switching USB Devices on Linux" -PKG_AUTORECONF="no" makeinstall_target() { - : # nop + : } diff --git a/packages/addons/addon-depends/system-tools-depends/vim/package.mk b/packages/addons/addon-depends/system-tools-depends/vim/package.mk new file mode 100644 index 0000000000..9c6c7e76c6 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/vim/package.mk @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vim" +PKG_VERSION="8.0.0684" +PKG_SHA256="edee3a85471d8e299428971a399cf5fee29febd8eb081f12b241b6ddbf3264f0" +PKG_LICENSE="VIM" +PKG_SITE="http://www.vim.org/" +PKG_URL="https://github.com/vim/vim/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_LONGDESC="Vim is a highly configurable text editor built to enable efficient text editing." + +PKG_CONFIGURE_OPTS_TARGET="vim_cv_getcwd_broken=no \ + vim_cv_memmove_handles_overlap=yes \ + vim_cv_stat_ignores_slash=yes \ + vim_cv_terminfo=yes \ + vim_cv_tgent=zero \ + vim_cv_toupper_broken=no \ + vim_cv_tty_group=world \ + vim_cv_tty_mode=0620 \ + ac_cv_sizeof_int=4 \ + ac_cv_small_wchar_t=no \ + --enable-selinux=no \ + --enable-gui=no \ + --with-compiledby=LibreELEC \ + --with-features=huge \ + --with-tlib=ncurses \ + --without-x" + +pre_configure_target() { + cd .. + rm -rf .$TARGET_NAME +} + +make_target() { + : +} diff --git a/packages/addons/addon-depends/system-tools-depends/vim/patches/vim-01-disable-mouse-in-default-config.patch b/packages/addons/addon-depends/system-tools-depends/vim/patches/vim-01-disable-mouse-in-default-config.patch new file mode 100644 index 0000000000..937de0b901 --- /dev/null +++ b/packages/addons/addon-depends/system-tools-depends/vim/patches/vim-01-disable-mouse-in-default-config.patch @@ -0,0 +1,15 @@ +--- a/runtime/defaults.vim ++++ b/runtime/defaults.vim +@@ -66,9 +66,9 @@ + + " In many terminal emulators the mouse works just fine. By enabling it you + " can position the cursor, Visually select and scroll with the mouse. +-if has('mouse') +- set mouse=a +-endif ++"if has('mouse') ++" set mouse=a ++"endif + + " Switch syntax highlighting on when the terminal has colors or when using the + " GUI (which always has colors). diff --git a/packages/addons/addon-depends/tinc-depends/miniupnpc/package.mk b/packages/addons/addon-depends/tinc-depends/miniupnpc/package.mk new file mode 100644 index 0000000000..859ce3da45 --- /dev/null +++ b/packages/addons/addon-depends/tinc-depends/miniupnpc/package.mk @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="miniupnpc" +PKG_VERSION="2.1" +PKG_SHA256="e19fb5e01ea5a707e2a8cb96f537fbd9f3a913d53d804a3265e3aeab3d2064c6" +PKG_LICENSE="BSD" +PKG_SITE="http://miniupnp.free.fr" +PKG_URL="http://miniupnp.free.fr/files/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The MiniUPnP project offers software which supports the UPnP Internet Gateway Device (IGD) specifications" + +PKG_CMAKE_OPTS_TARGET="-DUPNPC_BUILD_SHARED=OFF -DUPNPC_BUILD_STATIC=ON" diff --git a/packages/addons/addon-depends/tini/package.mk b/packages/addons/addon-depends/tini/package.mk new file mode 100644 index 0000000000..62fa3cfe4e --- /dev/null +++ b/packages/addons/addon-depends/tini/package.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="tini" +PKG_VERSION="fec3683b971d9c3ef73f284f176672c44b448662" +PKG_SHA256="20ee672afa8be72f5a8334044d8c2ce31bc6f2347fa240cac9c84b6c7dbc684c" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/krallin/tini" +PKG_URL="https://github.com/krallin/tini/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Tini is a simplest init system." + +PKG_CMAKE_OPTS_TARGET="-DMINIMAL=ON" + +PKG_MAKE_OPTS_TARGET="tini-static" + +pre_configure_target(){ + sed -i "s|@tini_VERSION_GIT@| - git.${PKG_VERSION}|" $PKG_BUILD/src/tiniConfig.h.in +} + +makeinstall_target() { + : +} diff --git a/packages/addons/addon-depends/tntnet/package.mk b/packages/addons/addon-depends/tntnet/package.mk index 396252c284..143c844e08 100644 --- a/packages/addons/addon-depends/tntnet/package.mk +++ b/packages/addons/addon-depends/tntnet/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="tntnet" PKG_VERSION="2.2.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="c83170d08ef04c5868051e1c28c74b9562fe71e9e8263828e755ad5bd3547521" PKG_LICENSE="GPL-2" PKG_SITE="http://www.tntnet.org/" PKG_URL="http://www.tntnet.org/download/${PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS_HOST="cxxtools:host zlib:host" PKG_DEPENDS_TARGET="toolchain tntnet:host libtool cxxtools" -PKG_SECTION="python/web" -PKG_SHORTDESC="tntnet: C++ Dynamite for the Web" -PKG_LONGDESC="Tntnet is a modular, multithreaded, high performance webapplicationserver for C++" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A web application server for C++." PKG_CONFIGURE_OPTS_HOST="--disable-unittest \ --with-server=no \ @@ -50,7 +29,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-unittest \ --with-stressjob=no" post_makeinstall_target() { - $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/tntnet-config + sed -e "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/tntnet-config rm -rf $INSTALL/usr/bin rm -rf $INSTALL/usr/share diff --git a/packages/addons/addon-depends/tslib/package.mk b/packages/addons/addon-depends/tslib/package.mk index cc361dba7a..b3617421eb 100644 --- a/packages/addons/addon-depends/tslib/package.mk +++ b/packages/addons/addon-depends/tslib/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tslib" PKG_VERSION="1.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="fe35e5f710ea933b118f710e2ce4403ac076fe69926b570333867d4de082a51c" PKG_LICENSE="GPL" PKG_SITE="https://github.com/kergoth/tslib" PKG_URL="https://github.com/kergoth/tslib/releases/download/1.1/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain evtest" -PKG_SECTION="service/system" -PKG_SHORTDESC="Touchscreen access library with ts_uinput_touch daemon." PKG_LONGDESC="Touchscreen access library with ts_uinput_touch daemon." -PKG_AUTORECONF="yes" - -PKG_IS_ADDON="no" +PKG_TOOLCHAIN="autotools" TSLIB_MODULES_ENABLED="linear dejitter variance pthres ucb1x00 tatung input galax dmc touchkit st1232 waveshare" TSLIB_MODULES_DISABLED="arctic2 corgi collie h3600 linear_h2200 mk712 cy8mrln_palmpre" diff --git a/packages/addons/addon-depends/tslib/patches/tslib-10-ts_uinput_touch-daemon.patch b/packages/addons/addon-depends/tslib/patches/tslib-10-ts_uinput_touch-daemon.patch index 4bba59065a..21b586e5ae 100644 --- a/packages/addons/addon-depends/tslib/patches/tslib-10-ts_uinput_touch-daemon.patch +++ b/packages/addons/addon-depends/tslib/patches/tslib-10-ts_uinput_touch-daemon.patch @@ -1122,3375 +1122,6 @@ index 0000000..60efc46 + return 0; +} -From 9d3429357dfda9038118189a600a191a7d99400e Mon Sep 17 00:00:00 2001 -From: vpeter4 -Date: Tue, 30 Jun 2015 08:56:37 +0200 -Subject: [PATCH 02/11] ts_uinput_touch: kodi addon for calibration - ---- - kodi-addon/plugin.program.ts_calibrate/LICENSE.txt | 339 +++++++++++++++++++++ - kodi-addon/plugin.program.ts_calibrate/addon.py | 158 ++++++++++ - kodi-addon/plugin.program.ts_calibrate/addon.xml | 18 ++ - .../plugin.program.ts_calibrate/changelog.txt | 1 + - kodi-addon/plugin.program.ts_calibrate/icon.png | Bin 0 -> 17875 bytes - .../resources/language/English/strings.xml | 5 + - .../resources/media/background.jpg | Bin 0 -> 125107 bytes - .../resources/media/crosshair.png | Bin 0 -> 168 bytes - .../resources/settings.xml | 7 + - 9 files changed, 528 insertions(+) - create mode 100644 kodi-addon/plugin.program.ts_calibrate/LICENSE.txt - create mode 100644 kodi-addon/plugin.program.ts_calibrate/addon.py - create mode 100644 kodi-addon/plugin.program.ts_calibrate/addon.xml - create mode 100644 kodi-addon/plugin.program.ts_calibrate/changelog.txt - create mode 100644 kodi-addon/plugin.program.ts_calibrate/icon.png - create mode 100644 kodi-addon/plugin.program.ts_calibrate/resources/language/English/strings.xml - create mode 100644 kodi-addon/plugin.program.ts_calibrate/resources/media/background.jpg - create mode 100644 kodi-addon/plugin.program.ts_calibrate/resources/media/crosshair.png - create mode 100644 kodi-addon/plugin.program.ts_calibrate/resources/settings.xml - -diff --git a/kodi-addon/plugin.program.ts_calibrate/LICENSE.txt b/kodi-addon/plugin.program.ts_calibrate/LICENSE.txt -new file mode 100644 -index 0000000..d159169 ---- /dev/null -+++ b/kodi-addon/plugin.program.ts_calibrate/LICENSE.txt -@@ -0,0 +1,339 @@ -+ GNU GENERAL PUBLIC LICENSE -+ Version 2, June 1991 -+ -+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+ Preamble -+ -+ The licenses for most software are designed to take away your -+freedom to share and change it. By contrast, the GNU General Public -+License is intended to guarantee your freedom to share and change free -+software--to make sure the software is free for all its users. This -+General Public License applies to most of the Free Software -+Foundation's software and to any other program whose authors commit to -+using it. (Some other Free Software Foundation software is covered by -+the GNU Lesser General Public License instead.) You can apply it to -+your programs, too. -+ -+ When we speak of free software, we are referring to freedom, not -+price. Our General Public Licenses are designed to make sure that you -+have the freedom to distribute copies of free software (and charge for -+this service if you wish), that you receive source code or can get it -+if you want it, that you can change the software or use pieces of it -+in new free programs; and that you know you can do these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+anyone to deny you these rights or to ask you to surrender the rights. -+These restrictions translate to certain responsibilities for you if you -+distribute copies of the software, or if you modify it. -+ -+ For example, if you distribute copies of such a program, whether -+gratis or for a fee, you must give the recipients all the rights that -+you have. You must make sure that they, too, receive or can get the -+source code. And you must show them these terms so they know their -+rights. -+ -+ We protect your rights with two steps: (1) copyright the software, and -+(2) offer you this license which gives you legal permission to copy, -+distribute and/or modify the software. -+ -+ Also, for each author's protection and ours, we want to make certain -+that everyone understands that there is no warranty for this free -+software. If the software is modified by someone else and passed on, we -+want its recipients to know that what they have is not the original, so -+that any problems introduced by others will not reflect on the original -+authors' reputations. -+ -+ Finally, any free program is threatened constantly by software -+patents. We wish to avoid the danger that redistributors of a free -+program will individually obtain patent licenses, in effect making the -+program proprietary. To prevent this, we have made it clear that any -+patent must be licensed for everyone's free use or not licensed at all. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. -+ -+ GNU GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License applies to any program or other work which contains -+a notice placed by the copyright holder saying it may be distributed -+under the terms of this General Public License. The "Program", below, -+refers to any such program or work, and a "work based on the Program" -+means either the Program or any derivative work under copyright law: -+that is to say, a work containing the Program or a portion of it, -+either verbatim or with modifications and/or translated into another -+language. (Hereinafter, translation is included without limitation in -+the term "modification".) Each licensee is addressed as "you". -+ -+Activities other than copying, distribution and modification are not -+covered by this License; they are outside its scope. The act of -+running the Program is not restricted, and the output from the Program -+is covered only if its contents constitute a work based on the -+Program (independent of having been made by running the Program). -+Whether that is true depends on what the Program does. -+ -+ 1. You may copy and distribute verbatim copies of the Program's -+source code as you receive it, in any medium, provided that you -+conspicuously and appropriately publish on each copy an appropriate -+copyright notice and disclaimer of warranty; keep intact all the -+notices that refer to this License and to the absence of any warranty; -+and give any other recipients of the Program a copy of this License -+along with the Program. -+ -+You may charge a fee for the physical act of transferring a copy, and -+you may at your option offer warranty protection in exchange for a fee. -+ -+ 2. You may modify your copy or copies of the Program or any portion -+of it, thus forming a work based on the Program, and copy and -+distribute such modifications or work under the terms of Section 1 -+above, provided that you also meet all of these conditions: -+ -+ a) You must cause the modified files to carry prominent notices -+ stating that you changed the files and the date of any change. -+ -+ b) You must cause any work that you distribute or publish, that in -+ whole or in part contains or is derived from the Program or any -+ part thereof, to be licensed as a whole at no charge to all third -+ parties under the terms of this License. -+ -+ c) If the modified program normally reads commands interactively -+ when run, you must cause it, when started running for such -+ interactive use in the most ordinary way, to print or display an -+ announcement including an appropriate copyright notice and a -+ notice that there is no warranty (or else, saying that you provide -+ a warranty) and that users may redistribute the program under -+ these conditions, and telling the user how to view a copy of this -+ License. (Exception: if the Program itself is interactive but -+ does not normally print such an announcement, your work based on -+ the Program is not required to print an announcement.) -+ -+These requirements apply to the modified work as a whole. If -+identifiable sections of that work are not derived from the Program, -+and can be reasonably considered independent and separate works in -+themselves, then this License, and its terms, do not apply to those -+sections when you distribute them as separate works. But when you -+distribute the same sections as part of a whole which is a work based -+on the Program, the distribution of the whole must be on the terms of -+this License, whose permissions for other licensees extend to the -+entire whole, and thus to each and every part regardless of who wrote it. -+ -+Thus, it is not the intent of this section to claim rights or contest -+your rights to work written entirely by you; rather, the intent is to -+exercise the right to control the distribution of derivative or -+collective works based on the Program. -+ -+In addition, mere aggregation of another work not based on the Program -+with the Program (or with a work based on the Program) on a volume of -+a storage or distribution medium does not bring the other work under -+the scope of this License. -+ -+ 3. You may copy and distribute the Program (or a work based on it, -+under Section 2) in object code or executable form under the terms of -+Sections 1 and 2 above provided that you also do one of the following: -+ -+ a) Accompany it with the complete corresponding machine-readable -+ source code, which must be distributed under the terms of Sections -+ 1 and 2 above on a medium customarily used for software interchange; or, -+ -+ b) Accompany it with a written offer, valid for at least three -+ years, to give any third party, for a charge no more than your -+ cost of physically performing source distribution, a complete -+ machine-readable copy of the corresponding source code, to be -+ distributed under the terms of Sections 1 and 2 above on a medium -+ customarily used for software interchange; or, -+ -+ c) Accompany it with the information you received as to the offer -+ to distribute corresponding source code. (This alternative is -+ allowed only for noncommercial distribution and only if you -+ received the program in object code or executable form with such -+ an offer, in accord with Subsection b above.) -+ -+The source code for a work means the preferred form of the work for -+making modifications to it. For an executable work, complete source -+code means all the source code for all modules it contains, plus any -+associated interface definition files, plus the scripts used to -+control compilation and installation of the executable. However, as a -+special exception, the source code distributed need not include -+anything that is normally distributed (in either source or binary -+form) with the major components (compiler, kernel, and so on) of the -+operating system on which the executable runs, unless that component -+itself accompanies the executable. -+ -+If distribution of executable or object code is made by offering -+access to copy from a designated place, then offering equivalent -+access to copy the source code from the same place counts as -+distribution of the source code, even though third parties are not -+compelled to copy the source along with the object code. -+ -+ 4. You may not copy, modify, sublicense, or distribute the Program -+except as expressly provided under this License. Any attempt -+otherwise to copy, modify, sublicense or distribute the Program is -+void, and will automatically terminate your rights under this License. -+However, parties who have received copies, or rights, from you under -+this License will not have their licenses terminated so long as such -+parties remain in full compliance. -+ -+ 5. You are not required to accept this License, since you have not -+signed it. However, nothing else grants you permission to modify or -+distribute the Program or its derivative works. These actions are -+prohibited by law if you do not accept this License. Therefore, by -+modifying or distributing the Program (or any work based on the -+Program), you indicate your acceptance of this License to do so, and -+all its terms and conditions for copying, distributing or modifying -+the Program or works based on it. -+ -+ 6. Each time you redistribute the Program (or any work based on the -+Program), the recipient automatically receives a license from the -+original licensor to copy, distribute or modify the Program subject to -+these terms and conditions. You may not impose any further -+restrictions on the recipients' exercise of the rights granted herein. -+You are not responsible for enforcing compliance by third parties to -+this License. -+ -+ 7. If, as a consequence of a court judgment or allegation of patent -+infringement or for any other reason (not limited to patent issues), -+conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot -+distribute so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you -+may not distribute the Program at all. For example, if a patent -+license would not permit royalty-free redistribution of the Program by -+all those who receive copies directly or indirectly through you, then -+the only way you could satisfy both it and this License would be to -+refrain entirely from distribution of the Program. -+ -+If any portion of this section is held invalid or unenforceable under -+any particular circumstance, the balance of the section is intended to -+apply and the section as a whole is intended to apply in other -+circumstances. -+ -+It is not the purpose of this section to induce you to infringe any -+patents or other property right claims or to contest validity of any -+such claims; this section has the sole purpose of protecting the -+integrity of the free software distribution system, which is -+implemented by public license practices. Many people have made -+generous contributions to the wide range of software distributed -+through that system in reliance on consistent application of that -+system; it is up to the author/donor to decide if he or she is willing -+to distribute software through any other system and a licensee cannot -+impose that choice. -+ -+This section is intended to make thoroughly clear what is believed to -+be a consequence of the rest of this License. -+ -+ 8. If the distribution and/or use of the Program is restricted in -+certain countries either by patents or by copyrighted interfaces, the -+original copyright holder who places the Program under this License -+may add an explicit geographical distribution limitation excluding -+those countries, so that distribution is permitted only in or among -+countries not thus excluded. In such case, this License incorporates -+the limitation as if written in the body of this License. -+ -+ 9. The Free Software Foundation may publish revised and/or new versions -+of the General Public License from time to time. Such new versions will -+be similar in spirit to the present version, but may differ in detail to -+address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Program -+specifies a version number of this License which applies to it and "any -+later version", you have the option of following the terms and conditions -+either of that version or of any later version published by the Free -+Software Foundation. If the Program does not specify a version number of -+this License, you may choose any version ever published by the Free Software -+Foundation. -+ -+ 10. If you wish to incorporate parts of the Program into other free -+programs whose distribution conditions are different, write to the author -+to ask for permission. For software which is copyrighted by the Free -+Software Foundation, write to the Free Software Foundation; we sometimes -+make exceptions for this. Our decision will be guided by the two goals -+of preserving the free status of all derivatives of our free software and -+of promoting the sharing and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -+REPAIR OR CORRECTION. -+ -+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -+POSSIBILITY OF SUCH DAMAGES. -+ -+ END OF TERMS AND CONDITIONS -+ -+ How to Apply These Terms to Your New Programs -+ -+ If you develop a new program, and you want it to be of the greatest -+possible use to the public, the best way to achieve this is to make it -+free software which everyone can redistribute and change under these terms. -+ -+ To do so, attach the following notices to the program. It is safest -+to attach them to the start of each source file to most effectively -+convey the exclusion of warranty; and each file should have at least -+the "copyright" line and a pointer to where the full notice is found. -+ -+ -+ Copyright (C) -+ -+ 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. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+If the program is interactive, make it output a short notice like this -+when it starts in an interactive mode: -+ -+ Gnomovision version 69, Copyright (C) year name of author -+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -+ This is free software, and you are welcome to redistribute it -+ under certain conditions; type `show c' for details. -+ -+The hypothetical commands `show w' and `show c' should show the appropriate -+parts of the General Public License. Of course, the commands you use may -+be called something other than `show w' and `show c'; they could even be -+mouse-clicks or menu items--whatever suits your program. -+ -+You should also get your employer (if you work as a programmer) or your -+school, if any, to sign a "copyright disclaimer" for the program, if -+necessary. Here is a sample; alter the names: -+ -+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program -+ `Gnomovision' (which makes passes at compilers) written by James Hacker. -+ -+ , 1 April 1989 -+ Ty Coon, President of Vice -+ -+This General Public License does not permit incorporating your program into -+proprietary programs. If your program is a subroutine library, you may -+consider it more useful to permit linking proprietary applications with the -+library. If this is what you want to do, use the GNU Lesser General -+Public License instead of this License. -diff --git a/kodi-addon/plugin.program.ts_calibrate/addon.py b/kodi-addon/plugin.program.ts_calibrate/addon.py -new file mode 100644 -index 0000000..3285adb ---- /dev/null -+++ b/kodi-addon/plugin.program.ts_calibrate/addon.py -@@ -0,0 +1,158 @@ -+################################################################################ -+# This file is part of OpenELEC - http://www.openelec.tv -+# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -+# Copyright (C) 2015 Peter Vicman -+# -+# OpenELEC 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. -+# -+# OpenELEC 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. -+# -+# You should have received a copy of the GNU General Public License -+# along with OpenELEC. If not, see . -+################################################################################ -+ -+import os -+import socket -+import sys -+from threading import Thread -+import xbmc -+import xbmcgui -+import xbmcaddon -+ -+TEXT_ALIGN_LEFT = 0 -+TEXT_ALIGN_RIGHT = 1 -+TEXT_ALIGN_CENTER_X = 2 -+TEXT_ALIGN_CENTER_Y = 4 -+TEXT_ALIGN_RIGHT_CENTER_Y = 5 -+TEXT_ALIGN_LEFT_CENTER_X_CENTER_Y = 6 -+ACTION_PREVIOUS_MENU = 10 -+ACTION_BACKSPACE = 92 -+ -+SOCK_PATH = "/tmp/ts_calibrate.socket" -+TSLIB_EDGE_OFFEST = 50 -+CROSSHAIR_IMAGE_SIZE = 23 -+CROSSHAIR_IMAGE_OFFSET = 11 -+SKIN_WIDTH = 1280 # we are using 720p skin -+SKIN_HEIGHT = 720 -+ -+class coordinates: -+ var_x = 0 -+ var_y = 0 -+ -+def server_thread(conn, self): -+ while True: -+ data = conn.recv(128) -+ if not data: -+ break -+ -+ self.currentTarget = self.currentTarget + 1 -+ if self.currentTarget > 0: -+ self.removeControl(self.targetImage) -+ -+ if self.currentTarget == 5: -+ xbmcgui.Dialog().ok("Calibration", "Calibration done.") -+ break -+ -+ self.info.setLabel("Touch '" + data + "' crosshair") -+ self.targetImage = xbmcgui.ControlImage( -+ self.touch_points[self.currentTarget].var_x - CROSSHAIR_IMAGE_OFFSET, -+ self.touch_points[self.currentTarget].var_y - CROSSHAIR_IMAGE_OFFSET, -+ CROSSHAIR_IMAGE_SIZE, CROSSHAIR_IMAGE_SIZE, -+ self.crosshair_path, colorDiffuse='0x00000000') -+ self.addControl(self.targetImage) -+ -+ # out of loop, close connection -+ conn.close() -+ os.remove(SOCK_PATH) -+ self.retval = 0 -+ self.close() -+ -+class ts_calibrate(xbmcgui.WindowDialog): -+ def __init__(self): -+ self.retval = 0 -+ self.media_path=os.path.join(addon.getAddonInfo('path'), 'resources','media') + '/' -+ self.crosshair_path = self.media_path + 'crosshair.png' -+ self.currentTarget = -1 -+ -+ self.edge_offset_x = TSLIB_EDGE_OFFEST * SKIN_WIDTH / self.getWidth() -+ self.edge_offset_y = TSLIB_EDGE_OFFEST * SKIN_HEIGHT / self.getHeight() -+ -+ self.touch_points = [coordinates() for i in range(5)] -+ self.touch_points[0].var_x = self.edge_offset_x -+ self.touch_points[0].var_y = self.edge_offset_y -+ self.touch_points[1].var_x = SKIN_WIDTH - self.edge_offset_x -+ self.touch_points[1].var_y = self.edge_offset_y -+ self.touch_points[2].var_x = SKIN_WIDTH - self.edge_offset_x -+ self.touch_points[2].var_y = SKIN_HEIGHT - self.edge_offset_y -+ self.touch_points[3].var_x = self.edge_offset_x -+ self.touch_points[3].var_y = SKIN_HEIGHT - self.edge_offset_y -+ self.touch_points[4].var_x = SKIN_WIDTH / 2 -+ self.touch_points[4].var_y = SKIN_HEIGHT / 2 -+ -+ self.background = xbmcgui.ControlImage(0, 0, SKIN_WIDTH, SKIN_HEIGHT, -+ self.media_path + 'background.jpg', colorDiffuse = '0xffffffff') -+ self.addControl(self.background) -+ -+ tmp_str = "Tslib/Kodi calibration utility\n\nTouch crosshair to calibrate" -+ tmp_str += "\n\nresolution: " + str(self.getWidth()) + "x" + str(self.getHeight()) -+ tmp_str += "\nskin: " + str(SKIN_WIDTH) + "x" + str(SKIN_HEIGHT) -+ -+ self.about = xbmcgui.ControlLabel( -+ 10, 80, SKIN_WIDTH, 400, -+ "", textColor = '0xffffffff', font = 'font25', alignment = TEXT_ALIGN_CENTER_X) -+ self.addControl(self.about) -+ self.about.setLabel(tmp_str) -+ -+ self.info = xbmcgui.ControlLabel( -+ 20, SKIN_HEIGHT/2 - 40, -+ 1000, 400, -+ "", textColor = '0xffffffff', font = 'font30', alignment = TEXT_ALIGN_LEFT) -+ self.addControl(self.info) -+ self.info.setLabel("") -+ -+ if os.path.exists(SOCK_PATH): -+ os.remove(SOCK_PATH) -+ -+ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) -+ sock.bind(SOCK_PATH) -+ sock.listen(1) -+ -+ # enter calibration mode -+ os.system("killall -SIGUSR1 ts_uinput_touch") -+ -+ print 'Waiting for calibration connection' -+ conn, addr = sock.accept() -+ print 'Calibration connection accepted' -+ -+ self.t = Thread(target=server_thread, args=(conn, self,)) -+ self.t.start() -+ -+ def onAction(self, action): -+ if action == ACTION_PREVIOUS_MENU or action == ACTION_BACKSPACE: -+ self.retval = 0 -+ self.close() -+ -+addon = xbmcaddon.Addon(id = 'plugin.program.ts_calibrate') -+finished = False -+ -+while finished == False: -+ dialog = ts_calibrate() -+ dialog.doModal() -+ -+ if dialog.retval == 0: -+ finished = True -+ del dialog -+ -+del addon -+# exit calibration mode -+os.system("killall -SIGUSR2 ts_uinput_touch") -+ -+if os.path.exists(SOCK_PATH): -+ os.remove(SOCK_PATH) -+ -\ No newline at end of file -diff --git a/kodi-addon/plugin.program.ts_calibrate/addon.xml b/kodi-addon/plugin.program.ts_calibrate/addon.xml -new file mode 100644 -index 0000000..e4de5ca ---- /dev/null -+++ b/kodi-addon/plugin.program.ts_calibrate/addon.xml -@@ -0,0 +1,18 @@ -+ -+ -+ -+ -+ -+ -+ executable -+ -+ -+ all -+ -+ Tslib/Kodi touchscreen calibration tool -+ Tslib/Kodi touchscreen calibration tool -+ GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 -+ -+ http://openelec.tv/ -+ -+ -diff --git a/kodi-addon/plugin.program.ts_calibrate/changelog.txt b/kodi-addon/plugin.program.ts_calibrate/changelog.txt -new file mode 100644 -index 0000000..f061e08 ---- /dev/null -+++ b/kodi-addon/plugin.program.ts_calibrate/changelog.txt -@@ -0,0 +1 @@ -+1.0.0 first release -diff --git a/kodi-addon/plugin.program.ts_calibrate/icon.png b/kodi-addon/plugin.program.ts_calibrate/icon.png -new file mode 100644 -index 0000000000000000000000000000000000000000..8d47bf4b256e1039de19608cd8f7fe7340696d65 -GIT binary patch -literal 17875 -zcma%jWmFtZv@J5g;O_43?it+OEw~3K!GjELgC)2_U~miWPH=(-hu|*3;qtw^-v9gK -zoa(i@SM{l`mVM6N)zKPi^5`feC@?TE=!yz5TJP=1e+EQ+_f-bfx$h0Kn}VSy3=GoJ -ze+HWad;SOmLj|KK1Jd!yKIxotrIY`*|KMwTMuCmSlQFJioz_-dE%nog*SwI>o^HAa -z29-(O-(Wng@5I5S=_}&sSLvR0q|vzrjOp*N5$I@KJ?7DfKdCK^i^fhJ9h7t}l~rDW -za^Uu?PVsbKFfWgSUvYA!%4m169UbjzKl}Ll;(CMKxp*W2yO9as{vh!Q8@l}v=bHgCoXkHuaInExSnqyqmA{g&rAwf+n`Cb^{ -zk=jE?v9nSD=;Iq~%+Y-^F65I}hAf6@%ymImbPmuUu;S+I6oKa9#ERx}38?14?7=79 -zfz~9dB((1V#dVE|7VhI%k1Yw|UZ>;&O6A4j66n8fEFIQ}UJR53;^_`NwjR0S9wpj*MKn+hF -zlz#*sPIw(jVEYMcydv%X4Y~I>RHe2w(`g;gdGwOR9=V>3pi1%^cN1E{l<4>ZHD-wX -zWfRRHLI|3$MacTTuDbr*zsY8Dqe4Ep_rVPx1GBhjM^HeqmAH+=(s0;RmHc8MWKJgk -zJlNa+IVfJjPp4BsS^WLecZSn37rFOM#~<&~-H{rSEg7U$>O<&44Z`9gqS6M#gaK`S -zzCA;P3X(CyK6tN^#MG6+vL?NIDx%~9mRfBi@SXBY+gA=7G;QklG2^9Lt1)2eRblR&>#W% -z$tBSrRjxszl=NRbTYgN0(}xB9)L#A;coEVE)#Ia)R4)%%dK*RdHHjjL-(tQE+y6-H -zX1Z8Ie%*x)@{W5u0(4)(bvK2(9u?cGKsv?8Qy7wmy!Mo`o$)&S$t(rXnfz%i9I`FM1&{8f_D^tnP+ -zcVSQo7~0imet_MDLgPh1x_C=#=~3MV4m-wxoUu+w)BFH#Zv+ag^jQktHv{mfEwzll7!PBHD) -z(8LW&ptS1ZP~MH0no4!&C=x4E?lflyN_oUb8|8XBR1P1%@+XGA6y=PT>$VRwP^RXg4i!tyE_ -zd3QT%TYQWFZUVjL$9@Bj$ei&aiUdo;j#ppavLve&OfYi!;e^?Ko_1SSR;#2+k|OCHb-1)uRii2$_j|8x`v%n>T#^e&)yLPJ35 -zO_?;S6bJ*s1Y_#YUjvCmr|i_`VS&4`O>VC>c?IpNoF)`T{13ECpoIclxL%hKA803N${KvIsDCgx@SQhXWJOU@Of3#q@B~VFM-yg -zkX;ez=pXCIVaPTft2Mq -zv%{ACG^7Qt9$u`i5ELgwKd6@sHw70CO)3J4u2T3cuw+PaD>(pQNhB6cBttL4*0(a? -zL^TTNAMxct%ciO%Qoz2TFFEAN*fpvAl2!AU1lQV`o0Zr>qV&f%U9r3QE37T-F@L?5 -znlTb3_57k<6+R|tjJ`B;=;AarMz4cO7;p=TRr^yC_QGvBOF2-WIwz-3#=J}kldCY* -zXNX~^nC*~3$}iIj37vn0Vr1^ev?$uw#05yF?cVb7(o^FOXT(1s -zvXEtWVj^War$)o0h^jB`i;-d=A*B|=R^rAxatBYk-5Vke5Yw=kgv+GH#n4G9O|$r1 -zAP$lIVecaQ9w<@kAYfSnx_>VJ(*}A%o~@->CmzE?Fp`; -za4x=@A6sMyr_?_lz5);GzJNEj1dGAp9jrNh-yf&LU=-M_RHQ+y#21u^T#SvL%N-aS -z&SV*cuEnU-L||xbwAS|TzF_*GFn%vd-pz*$XIR`PQ7OFagXK4CgD>E4kyM&X!CxiF -zIu&1aX?y!b1o=Y;gWJkki8ZedMhR+vJUx0QTf=~oB*YikTf}KD;}sA%t-E& -zc1f*cA|#sZ{J{u<_W?(9nQ9}3GPTN7F*B$IG>xi3fq=o7WJ{*7H^EG!&?Zg7G=!X% -z&5s~M?1SinqFlB*y6ORj9Al~|bPKp4Uz|ER5(I;^abUT=mhtJU&xJ)Nx0VpD5J;F_ -zCIb)(zLj~-affF+@ihoh5zhe3XWMI3DY?NW=n@n6GmqV&Fj7q7{Dn&|D`IQAPl#TzC3ezt!$#LZR?qKx)~nqCmu_5^E-!}ksGN<#EVu=tK?hhzP=dTaS67`jaoJ -z+Wih?`G>vpHc)={gQ@;ZO;2I;r3VE3T&1JN%|3+q{|eWijJpuG;6CHqYmSN_3&_Zr -z)Nc6WkAl`Ja~!%NXOYTI8+zG$+g+OL&bQVP+?K4%Z_!IJ)r@1KgY0BXOZ}UE%!8Ki -z%QZ?eizQt(rkI{;Hge&^4nA$KC_fF|a{yysGn5ROjJkvFz6~B!NNo-Cg9r`B^b4_6 -zD8K`2k&&cPjYFz>47g>Iip!W??8ZalnN-c~PW*QPhxcrT_h#qi;;mEMyy7rTlE{0j -zX2FEZxMiJ%d#|n;i4s$)o1A}@4xAqtl%i=Hp~$^kxVTk}rBay65~raia}b^UU@k$5 -z9Hjg)NhTGCTK~f5H_G}jL3+MYT*NU>$P)@J_LV)fh>9dzzSIN8fvTXqkUM}X9Zw%H -z!y#oAdIPK4O92l~z3G7C;)cvFHTu-!Osq`HvQ=ZM97P=2tP&6T -ziE!O&``*7VdESuvJCW_Sn4@zlX8aX4Tl@ekX1v8o8jlNA?0{nG<~+0`$KttPEY)Upy;&!s0J>dd2fgZx!&3Y0$rj-n;u>5tc;U}3+=ocntU68e=&S|H -z7^T{qrT|wSI%x3;e+czRxq~DdU&)E7v#2&#ky#}fW9Jew3bo@o(&VtBIYrEZy1Z>L -z>`j#U^0@UsH6x41t$2PR{Mnpk+KAq^SY&dm5UKFx1N^~jfq_#T+A?Nc5;j!C^JoS@ah*h;rpFWQ#h4ZA?hbJ$>PFC*S)y4Eyj4s{EaNj -zNX0P;HE{xGfO)8tOKZR{fOF6kFO?%w4gW8B_r|Wdo@EfEKQlENp@UKPfcggc;n~n2 -z*qkrjSq*_RMg(cd>=w0p$O(HOJs&ZgC?2^4(O<8Ha=CdLQ=CDA4?rKsb;Z9%qpf7x`?hpeG|t -z8=i69hzF=cl(Gw}-tZ -z`%9MBS4l293#KuqHV7k1>k%6qh<~J12KUz!Rr{}XCx=iWLOzAKAWh`6G}archWV~B9)nD(+xuA- -zGDG@^m;*Kx!H6Qd^<*=q;WH@j$0YrxyZ} -zsNfo2?3o2zQXlC-VR)+2N#XjPt-YWYf?{(J@+IzBoZ`VOP-;nnqe9Af^(J9$-H*M;kS$3#ji0l$$Q -z)f;EZmv*~*a?rW?_x8amDI57D^?%$>QxL+)kxSs3PsrPicIymqWm$8_4wPufk34*E -z4zVbs_jw6a -zLsPWV;^750e8D;N;tB|>{H}oM -z_;aK=R=h8@L*SJe)vtQjh3K>cca{=S=7W(5=z -z*C6CUxom*q+fV$9C6To(Eg-C<|E?76P0aG6H -z@HJUrM>GY@$wwDQ<%ITO*1#@Iq@JA#uIl+eMPw5@>E9&cE;CW{1k>VaFnMf19V&!> -zM|G@Z`tqBgg4FbjW&O1>qgg`$LyNtIs?}C#ojVD^q0!$&ByU@A#(t08!4dImcii-j -zQ^E|;)IT^+sL{>7!2S!mq{o3O{4RM2S93#)FY?Zg#%7%Ykri$~7v|Hyb?b5xY6J`|>#jD+^)trh1$i -zLlK|9uT{HWGLkiv<*)q`iAb-BD_oKWyXZ4ywfu}DFqV8i2M#6?_Lx(iR&6z4LYiPR -zzecy=i^(6LUWlQqXA7@Xgm;9wxT=%>u9iF_D-4a1lOLt7eL-9MBQ5ZAn((sn6}$cs -zwq5}29K1`x{jn&;b*3h7OVFj|*MTed!WKPpdFxDSW)lqs@0JXo1VzusN$@9d3DB~r -zRy5J*BHbX0BwML$7Cm)H0~+g)7K&JA=@r&yO;GpLXjZd#g|rli>3$)#yZo2*O@U6V=;Yx9*DobOwiSY9t6q*4EZV6m6tysv&Y&5&u?ydc<6#Q1_%Z3K2 -z@k)G{Gd+HQ$KBdBrhsPZ$6cAk~rk!WLq)_6Oy$Gk}qQ@L_;3@(}v?nWK%c$DEv+PoQQ--SltE8 -zbGrGb?2f<{&Hbdqg|Aw-^!MB5)V||&N%YT$+NEaLYwIr2 -zSJhVjq~dW_kEvWkl#;R)ekOuj7g+qn)o7(p;oRBwW!paB3ncDmv&}nAhBqKt0hyH$ -z{!}=T$DdCW_v;2>#kkp*yTxeuYQIw~FMQ-^ZY-U@;SyDNl#X#DbLM!gYY*8OUhnsP -z`c%;VG{QJF9k^MxwNf(J9#%x_MG5|KuyNY|Pw$$WgLllV*M}}U_HW5II)z5F{Nw&o -z^YUEmZ`xwRj>5fMe7IM?SK&Yj=Ue08XclQ^#X6=jnNX7BCBTl9ZpSK$bWL_fHg1-i -z#Fff8pt&<%;8N`LtZ$EjB$j*vdvF5?5V> -zXG)4tn32UvsB5H!bJ$3z -zKcZjk3;T~tW#Td)MJ1+`&t&m?);&Pm~^g9Q -z>~coNEetJ*_2QW)W6vHJOco0C$4^~y6p>YG1(E*>5x~DN!0__(XqSGamHsqL4xNUS -z?y!#S7mObwRkRdQw@wgy>vIoTRe>02i%-Ihj&sPqE)1@nYg4GYB}(Q$f9!cVN6%VG -zr=r=`)qUG}3;DAi(FtpLmqan`FCaQ~7P%N}*MKzR95$9x`XzI{mL2J_Xb6+pljNxO -zRH_v{MI7=fVF{bdjk>Ug$vMb-W5_q({By{FcV{{8Isjcr*lhj -zvEL)#Gu+b+_e#?xNF`N^SV%gX{pi$^MK1Bb&_;0jP&@$-BN!hX{Kh!Z-Qvb=sY53Z$47$9mS#+6c?D#b{ -zkExL%R$JJFDi#XTV>Pr^G;~&j7&@mqyF_mH=aHLJx(<32Uix%|3kSt5BQ>;=Lu*gY -zW|OVC8@FZ(5p~lHm}Lc;lLAA>*^>vSFlzHormQvl2|FHUi?CvFTwQ3wV6O&A>Sv_= -zA{(^wVZ_agkUo<24BORy0W@X=U$?{nUn8cBb)p9AI7ewb>wSo9u3E;}7ANdpIJ3OUY-(q5^cbZ9w -z*l7}RET8%E1r_k13V^3H2mRnmP=HN~;Z;pgG^s9w9ZpPuE|>&-g|el|RIA0Ders_i|a?7&%`=8R13(d%LemPVrp3WOxt4eeh;ZE5p -zuiMg+J$+>Fqbp5Rp6HwD0Oluu?@pez!*;PC?NBzV;f|Qsax3Cc6WMQmd6OyD6tN@j -z^FC}OHCez}ntZi{L;v~W&+{b3^rIE&=ZQ)esaa14&|8HU|C%;R{eZ4A)z}5H>r?Bq -zmpq;$+~ojD*2WyK#p%{J)=hH@W)(`wEd8e{M4#&x507@GuyIU<3XoY&#&J^fZ922# -z+ebWUUF0A|pAlt{&o?vIvkt}6>*PThBbjfG9i>^Js4IsxE&qN*RScn*VHX?8$ek+( -zf|hCW&jzo?Pm4VbeQHpeW>y}AxfsA{Xvh`}X%&Kr=cWUmS1aPBmon~a29(o}J{hfx -z%A$wYpPV&O70Z3eKh98ja*Y1O%^FWb3j8qHpE`>_)}VFh;*({P5nhYz~$8CoS2t1=ITZR|VPB -zv6Ok7U5x)a)MTHvD5ZzG{qt*d`HS&+TmYp)wf}QcP^7&e+&PhFdAt6g=EV7cI&1#3 -zkhaZ+*?6S-lzfF5KDHk@foyFTYYRu&1=MptysgVve62HRF3Zck!6T@0Z?w5ArzT)N -z^ltqxw{hud?2yyrn**OK-EaV$dgL#|Pc?H(Hl)u#hA^oW@TIh{7EtD$Fz}#bSu~1t -z@@Yv1@%m$bb=LgwTvIkQhZDWW_cT40119#(emSCRVHZog305y8;D<(*jH>Qi1(*q5 -z9#z*deTOH=lF;wPCYYzSz0}ne!|zxgY{H6~rjJvXq+kVireQQZ|Es8u9E44ijNo>% -zyku&Ct=YZ0@LQ_1S^47+PE>m7Yd{ -z#W#|NEz&g#v*<~%hkPaQ<-UW^Dwj%iC8(F}8+2^HY`elGmTErJJ%`IIFsMPca)GyLBU;c@4 -z%sz4$^>#f`)vygIoVV5!7Amzedn*)CWchBfraX(YYpYXSwz{LMoBRi>v5iY-aDT7U -zNO0?i8U#B8&(y5Smigi{>Ze$OuO7cM^rpU73n(86&s8C|QrwbVK{us3CD-|&%MBzo -ze&##1TVI}k^N%2aVs%3DYvK&GL|e^N^2dDq6%9s;8)I*>+&~vm9dtLQvfn}l)svOD -zP>7yRG+R+gq-Vh=Yz|Z+3jLam4g#ZObQeTREXmU)7PrI{Tcd=Kxh%g2kgjQ*5Yi -zhbC8uW&1z%bH7V8fGd!zvYL@u1kW`Cs`l4}S}H+MM^fFN#(zmCk>RIZ@Fpj7h705S -zSiT30pJH2+oomt?>zXxwZzK&@t+b^`^Vm`N -zg>Celw^WBLb&++8d@!Z4ZrTJKq*Yyp3N=z3wc3k8<^;}PDBh|OpG8;92PttXg|`3k -zjWGS3z(%}H6)?C|1+eNFz2W0J^|5JGWX7+!-5pO=NpuUWzQmjdnW}^xrdN?qIrOiw -z@_l;q-a7kR!s&=x8cZn%@y%*cO>ZN8#_~1hGn;#hRd`BoYM0CMcycMAA0fBoz^&y8 -z|Hi(uxkA$ZCGsb9bWJM#ue*-B_U%$t*4V2~UQ-KgBcRpzw>HWG&;h||Jjz3Nt0hJ( -zP0szx%26JdQRpiB5ujWPSpfJzrk_S}%0nyvSI)&<-X7VbxlGHZqH+S3di0PQl)}bh -zW_k+IUygS52aY77{O{|uUQNLn>hZSddwYq*Y%!sEnm#3|-Z{u#L_e}t*riajpWLlJ -z0;t5b4mZ?N$1nNA2W=Z9m3kKy^q+!b$1W0Nm@@O^K;l~ -z%%~MsN1)S_dc15ge8CrNJ*AkJm4#syUV9P^ZF;2R1c$`EDY^(0ddvmiX=3+>P&g77 -z1M2l}$NOZlYuO!N>Mp2rnU8}Rq5SY87z!Owt6{tu-+$KM4K{oz -z8GFg%#{C>3x1%czI6AGA`ePhAu7UZvatIYD(>gZL#sb*>5%++Vi4kZuW^Cc_&p!!Cj-?9QWz&;pQEkX1mU*<9km?Y*3<9$?sNkyLL@F6^R@z$5k!+ -zx3_rIwyne2s)xI_Q82MZALP_W@^!%ZGJ8cwd -zRQ7R}$~Blyf5QG8Zq&uGJ?|-NCO+EZt}|uROZzjHVKF_(9p9 -z&hGirckVYh07Yyt8r^u$YJ9${Ha>uhDu5noPG4s3bPG;&GfIxOvb__vZ-Wd)-^TpM -zjZxI9OaIU$3`7+6{5psI^>yzXBgVgV6t&gO&n=e1# -z2+SpZ?=cvn1sJLkd|zSut&p(R;@i|5xx6YTP)`15EAYeTkLa=XGu!d`$>lcInucZs -z--Qfi`T6WUF^SQza(fApM&?!wk$Q&JHUDiL0L53Onn52UJ6&#a$e`s^@jjn~a2{ -zkoR(3WEAjRQf_Y)y#EYqA1@cJV6*)at<-HWn8_cl1}* -zxG&Fc9QRI7F`Um1mYR5H0U=!#BQwdxeFC+DPuGLgSJu2ERDg_tWF$i|ir)X1Dn&;2 -zeD;iClZBk#5Bm2EKY`8@bNe2)PO`BNE}6=H(oVBaubCPpn+)k{w(R|vPc4O4eey~) -z{}JSlMX7G=Px4}qD=rb7I5k~l2O@x7Gu#%KP^~m1mJ?rIvMzr`rhEHw5uO(K3c4U>t@cBJ4-w@9l-L7}q`gu*d -zjm|OqMs^>?b@{^D7y2?~*rD)d*Vp$ct|g`BMhhusE8=860+Uyma}I -z%s&RG@*J3d#8CX-f&oEF97GM%o1)2d_1?eZ7ZXz8SdF@SK*H0Fw!^D+v61D%pAXfa -z8DCUsfx>KgBR9{jM!DvaEs^3R$xGSAPcS<}22PMsAhW;y(S>2O%P^&e -zgz2_$Vm$xIySDLTiS-?h2yVd~zDP>kxZf;V!ZCSx15U8@ipd`TTiiNWD$YfHHm1rG -zbCw>!W9gxu5peg$^-!6vm(+?Kzeq({Z58umEny|wzM29?LZnC=dosF+t>1;;Buu{O -z;(Rd7xY9s7E{f~o^=gR>Y~q=iU#dblp14w686WsU$-V5*EYPKF$kQWU$?GLY9LQby -zof$K5bc${(5LjP^(9M)~hc1>3Mq2rsJ7vIpmJ-;qZgNKIgta)FiA-L16F3@(y>PkO -zphQ`aVi4!a1TnTaP@e2yYzU1*tLCNazGT4GT_0W7yZ85xzJDP&M}&H__3TlcM5IQ` -z?W__f$Dx@X8{Q^76;_h=XKFvnja171-m2o!oYL6RQPxTc_EB22n{CXA&uDayv5}D{ -z3&cO$A)wq9%R@!x@6Y|C -zrDRkz(b2uLS&($2ALRDT*L%jXExMFD?VhWf7j7rsmd_qU%`if9QP9VU6_j9=-xuh9 -zLp-xAG$`=N)e2q9t9CtQnWv1OTMU3mB%tv)1Yr^i$L>?ct`t(Li1Y0CO&084T&K7i -zC8#8)QqL=V3S*^Yo!%xNG!GVo$H0K7=N9<;PfS$OF^(1?Vh;zRoin59v|`@G^%kaD -z62Xb1$>sNWZi!~&?-2mEhYVCle%FTXQ$(Pf=U-@m`NMU@)l#XYSYobolStIG=~+Ea -z_G}x}{#VGSwR+b;CF||gRPXB3p^6D -zvJ$$?%_Xd#Bq=T5YVJ;S7L(HBEk>$ElxOD-(lIcW_5*WAaP6tqoK{*qgH_UUxhqBf -zb`ep)oJZF}Aqr(`%dld(sNnAuZF-8=y95M>dXQNNk@{XZ#k71YQYC98sx^=vG1kr! -zjEnC#lpGD&P5Hdo^-d;o_ga4&V9I#sQ$B|2HYC(CC>4fKh4RSxL{IZVe3dPmgo#N} -zKMD8x^!m`_kMP+iQ%n;YAn0l8A)8g<>-v3=Pg6k`Xh`n|HAGZZ$(|-r5f@ZW!|YzG -z7JJ`z{nB^{;El7XAsiM!w(9)(UUxi&^KWLTVl^3_fa3UVa2c2c -z5a#dcm84FPG<>48cLk(24k|MaiI8|IPI?rC*}AZp#lYLZj{CfZT2$1}YUh0dK%rhZ -zbg(0vs1QbYpL$-}(T=CPPfPBu1vNgToW7h$BZO3x)(TQYRzRzD8G-eW(n?|67_sKE -zibcM8<+Gqenz><{FHs%`RCS@)k%v`$Z~V%Gmcm%a+zT{NBF)MHyTfQpU5(TMe;i~~ -z`Y_A*UOeHwephbNKZ57x82`BUozkD->EI_4r!hm~X&cSv>|HUJS273vn?%pPTK@h# -z^21%rf5dhzygl-r%@h{tv!n`E+Ace2rz+=T;28lo&}5z0IZL7^$+S -z!vwwRaOq)r6WM)Z)v5QobhOeSgqQn0Fsyr6+2`?cM)E~z-YR>r@)lBqQLXQ)9`a1P -zdw{p|k;V>j;_1MbFarLj=7VsQ4Sn9W0S%;=K>t}J3rk_ -z-1mL@oJu@4Zi?$gGVFImlE@RqH3)OLWsg8Tn9y7$0TSWEiXeLdr^Y8CC-tE~#@*75 -zMM$$lN$AZoI&a=2%p~~cqH7?wH+r~Siv|xa98tSMr$nOwZ;;rHzO2cfrHnK@8B(#h -zy7wiReQTUXl2^fUbIbo=dH`R2z%imj2>c`8Zi?fp{IA4!g7fH+SWFy94`S8l_`oU6 -z6Lzx^Hb7Ml>S7c#s)%;x3gwfY&z~%a-WGFD)e6k?TDnX510^uY$0r;+?=3E3iVTp -zx10IszY)wl2{|zb;_Rx2?TxT5r_}C_6gd+xm1Ne^U4XMoN+q2}^DzUuE9@$lvF5%hVVLoS(2= -zI~jF2{Js*tIjYlG*4$00;a+|k8Rhmc$tRV+XF&EA6@`9%NtZ$ke>{{{yKeC`>wIKN -z2?wWF&gwg1nR3ur`GzvF6u?qTtGdCJpdf}quK`tB*n=NjzyWqY3<>m4%52Cn*w>Mx -z&PGaxC)mT^wJL9mZ>6mvtK9rW9^rjDDNP?z6@N6SD1B7D__egD9Ql<*@7Ym}a -zlyU3wKptEIq?uQ>njuBct-w+%EMO0&q6YMYwP3ZrYjQ|sYX~jj1MyvOthMRJwr}15 -z=$3`Wzn-mw;J+TF$erS4Ocix5KcHRKpV>q)8X4~cNT%H)66!~ -zR?QoEpwc7D4V_H67ah3c2e=BA^*svwA{^_5r@yL|B}Kl}j#yYp<%o)WSkl1>5$XM1 -zeVO6@aK}S+m(Q(g_M7Skru4#Z?^3Rz_`a`Fi9z9#5+4L}w=0I<^a{>SCgJeESIsVN -zqZd+~b;Z__=Pj7vTQ7y~z>g1UTVJTBPu4)ryFhXnrY}g(55hKK?FKtb5U@9?R_7wH -zej!BxFC4rn#Dl}&p*fX2q}%hZFY_PBR7fZjR!Jkn2iC^8VcPWfOVeg&aipx{QuTVj -zFW%Xz>%>|Da79ZNq$J;CFA$F(uzG3rJ)U1UP?|olPrmRQ2|c^MO0LeqH9wv+|Ho=7 -z=3PB7C+t6}eHVV2+d}#VFFtU#*8e$zF7Mg@g4= -zR|E-pJ+ZFq8uw}-;BWxpj{d(61p#&RvI+iKLEIph4$%XaN<@olw)_=?cD2Z}hzb!XQ?$Dj>2mp3_>2)LDyN3aa=7F|Q< -zQ&gYZW+nBVFiXDL%)r8Kzf58|{bg<>&2yYa{zVdyl<64oi=JM=UTQ=DZRZGv)Vd{! -zns6qaN}7tjhlz#3FQ>nXzMc<3E97_NT>wA6zq%!wX}EW)Ru5_Klh8*acr|XvP(2=t -zq`ZNCqF#G6_gpz=7Fz7d%j_sO%Wyi%u#ZJIQeEgLeD|j9R9RGE1{#*Gm>A7cslf+T -zCFf=(;zuObNd&Fo-v(5A6cQXHVImuTn#F$F6s$1lmKx5f%k*wJ4@Va}rl~Bd#3A@i -zT!0hJ-J4w -zT#C#>6O5Tv$PH?1nvld7L)1^AIx91_swJxQi5n2EUL0OfBW#HrnHo@WyU7@G(BgHLVlxMW+ -z@buwM1@jb@uuK9cks45}Kxhm2l{k4N)DbdL`)K@tZ^BZO@<60A0l&}*`$0%~Uh8Q9 -zl`0mE1>3t&o3HJ@Qa_+DF30X5ocELulVu4}!Z=IUeRV_rC%ht*EdNhW;q71tv$vfS -zWX-_5fMp43%Ysg|i7R+$woyngu2zo)lMPLVh)V23Yvi=_p<@#VFhadt$wFnE7OM5r -zo4};3*UAw%Mu+f7bXH!U;GtgNs$GeF!D0W#l#+lIv5lp4ez~wMy7s;X;JQq^gFkg$ -zJBB*ZDGrj3vw)CMXR)Y-t|u-IMKhq5HKZOm6a_W_dc2S%@N$&-@Ctr4+BzzxYi6_H -zf(!1vDq%G};0Z~NXuJoKt?kn1BS@?hKO`__ZJo~mm)lJ}KHT~fQZ5DtIW58ac0`E9 -zyj(nNHB!0^z|c`zH7ZLf%7^2_JHZ{Zh+X7{U@!1XAb$w`qR3Z?s|+?NV#B_QBg^-^ -z()3lCQ)ui0KkAEf8(0PBi$hqFIMcVO$=0=vq!01FvLb7j6ee$uWzQOUoM%K?08FAh -zuvN>7*$x!4yR8xwjIP<}z=Q3vzI3|M;rXAd6sQzdoyVy%jkZ*f;;`d_wWomnF@$Z* -z)+Na#k>1D*R>IF`zo^g>&xVT2Q3G!qp?*R+Rh?fM0p%LE@XG(BGr&f=W{S8YCyA;y#!hGm$sZ*@*`u1;aR-Fr9U2n93X7G(s)Ll;s*^(J|e4MJUpRfXw&i4<&)h!$5Zm!3JD(L0yN_oY;W9oWWT-{(AghuzZNIg(=D*_njwwWXqCp$*K#$2>rF3L -zgC<(EdUm!6ic=@H2ff9mFES2W0Ra7 -zM%`$Oc4c1PcNv@)evkgWHV3VfGX#&YOHFLv^^#meBt+PhEKS|&i=;BD*TwcZ2uOZC_%kLU -zgjm5HT(B-$z2_Z_wy@g^x@w;_EcP|Zv?OD`i!rtJAkYfdD~RqJi=$U7H4i%fv4>iK -zuP>^pWb-SC8s1RJ6e$(WWHA<~Qwq2~%aNeein-0_w;wPdTE)Jn*wN!fg>wq|>>+Ek -zhzSERl=GC2Ns{ybM$pP?+6b#9u)ysW?N%_xm&(=s$CPtQcM!{umA>ty!Js{Ev$q5~ -z&aPb|$A8jWtkMNU<#xexL0)yTC8y0oJ6uD4SQ@4`2@AZ$7vp%~pk(`;So2COysD9i -z-JI$Qx2q9^M)kwwxXj%wEU>kwi`jYoRR3aMl0q=Dre{45^5;WL?aX*)k9eQTYLnKr -z>`5QWL`9eH0jfRD{V@(EG0M4#q_e19ZyXCiMhZ3(NmPeA@=eaB-0_82w7ZKNvY6jRAdWsiv$lvbC$khE`0ZNOWbBgOKaZLU?XDN -zR!`8fEuy|HJ>qso#taPh?>M@lA#fVdGxd*ww(&<87=%y%{TG00RVV4Gx+I#nZE)`% -zu4*bolD)S3`$moA+U;ZD>&}mk36!pGW=d4Zi|W%KlQ;B|uY0JWVo!Ka+pKTTJA*Ag -z)0Wb?69-ojwmg5krc^Egz3bT{tvnkou7V44hgO>|x}4MBISQmx5GcK18V5k3yyhoO -zW?0Qa#6{8$MYRGJ$g8a5^DPyu1Z@_c?y`Pq6fji(6X^sN`;RtgA4pYAlX_xZfkH2V -z24!J^3sGjKOblwGZ_-Md2m)4kI~74o+{9OiAv-uAq6C!^4}pk!^Wgww!-CKgX>p=p -zDZ(Q6%#$&XQ6%4Cy8hDf`UTkTGy5!~6S;)`QB67x3{1 -zK5xI&pK4#O!Tx$d7NLz(mZ_(*j8qlL@PICn8Ok&(RrK^a#Jo!<1t`JDW#Kd^85_6- -z38lOOBS5}U008-Jj{d%;w~9?2p@$rx -z6=Rt*vrsXy%p^prtW=hrS+cU?sdHCIKNhxMHi{O -z5&DpVQlh738Kv}UvrHcXoo2cyYz#IEn_6fzvyqnmyN9qKkH0}b`~&G9J*+x(`iRtK -zno6mqrm{d~6;T5*8bN~x)vZUg-t9n5F)g`V+fjz?GAX?v+9RPxG&^;x#mbflsY*r( -z^i|~%*woTd(b|MIuIZk9a(p^kG4)m+L(H>hzX*=E1^bud{i_?RHP6ovFK<=P2MQ*vC9zfI_8kdH~zE(7w%C6w_zKkhvH -ziPy)RHvpr<8M!si${hk^RX%IWu>(-XUhlYZiZ~#O==^K+`uYI?QWWlgqT}ITMxP<0y6qJ?Wi=n>u)`VU1uzG0 -z@q01oz^c4AFUK?tc}nB2JMQ=s-AWPJPqzHc$VmlLXBphz?dxMjDbZeB@$Z1|aqE%r -zia2n~@k9CSjvYu6u&NQ+yI8{l8%=dzr8tOa?Sah|2f -z86ZbW*@(iM)?_LQ~w#BW)0FG@V -z4|X6K=-`3w9Yehi*F4LKat6o<8Gv9mDu%W%gW?-IHfz7;cap4002ovPDHLkV1gZg%v}Hg - -literal 0 -HcmV?d00001 - -diff --git a/kodi-addon/plugin.program.ts_calibrate/resources/language/English/strings.xml b/kodi-addon/plugin.program.ts_calibrate/resources/language/English/strings.xml -new file mode 100644 -index 0000000..a427554 ---- /dev/null -+++ b/kodi-addon/plugin.program.ts_calibrate/resources/language/English/strings.xml -@@ -0,0 +1,5 @@ -+ -+ -+ General -+ Recalibrate after reboot -+ -diff --git a/kodi-addon/plugin.program.ts_calibrate/resources/media/background.jpg b/kodi-addon/plugin.program.ts_calibrate/resources/media/background.jpg -new file mode 100644 -index 0000000000000000000000000000000000000000..3d5b572bd46fc88c8ed48a5c15cb5351b8500e1d -GIT binary patch -literal 125107 -zcmb4qcT`is^KU2#H6TbRp-G2?8bWUZ(gmf3CJ?IhCQ=0HMS2HmO7BSMAVrD<0wNu$ -z(t;uaB2okeU%tO`-uw6MxpQ{zxp!xF_arm(nVtJ@>E9L+R3pgM8354HfdR+?00Pky -zkpPGY+w~4u7d4xEC -zAg$#8&WyO^za>VH0RSZb!^@HqL=qY)faHJX2O`}4?;3~+3jcQvlm!0&UBiDy{qJ1< -zxBs^aPzR6@6aVKTG*ZF^BnJXXNr9APWFT^CN@{8?)h)(bbhjBG -z5C}Cb6Eh1p}B0%<%u+{tW==$Vp|%B1nk10mO7fBy>do -z-UHYO3n%)o_Mh4Rrx6i$oD>KmqaZxhxCJ04CL$prCM6{W0e~a`D#BwrE)oe -zU*PS?3=nr|GXr99hDXh4>-Z-bMAF`mSKXKq8RhUKQ~I7`*(^Z}E7AWb`EL#Xj}pQ| -zSvn#j05K6^yFsKN!Y&c+2s%he>A56ss~Q5i5q7@Kkr|~k43cU_gIheu_CF!&#vtUs -z6#z8}VIUm|9Y6(eh4l|yS*@OZ;hkt-#)`?)$K6S&yEvJ;Yy1u*O(4Q#M1{|nn -zV8$vgBI*(fNzQVn^p94=RA#X#49uhm&jyTSyoO!RQQ;3!yY#1$FFF}lOpBw^zd0-|bi>Ke -zIU#9m@@sT@Jbat3RLzNJLa6J9m{iR=IJf_d>GzDhF8X20Yf6W`L=AKU^xTF*BaQfX -zrM0C|%ZwEsKj;6kSPm8pXIs`_@O&1Hsd#cTEO?}t;B8>xYTY!S-L|rHbQ$PaS=puV -zAk|BGtrrTPu?W6vn`f))-+)7Qj?O>jkOkVjo9PU8TAQ(9KKTzc&=Z1q$?qrdTvzrH@=fay3on6g88e1no7wG -zb!2Om*#lPkR3$@mh7o9kXJfS0*EHD8e#_xaY%s8ZsNaRW)`{8J{|hk{qjBCG@*gX%R)M&+&@me@td -zZq_!K%ENCR+7%pYo{{rrm=GZanxq!NwwET)$qv^fP|VwY6^W?!?7FuZZ0;Jnrh-*ImJXfRl_+c`vUAgR$?1 -zGEcVBddtTTCzJDP4@Qrh%ojSV-d&fyzDam$dt(4`PaW+ab75Dzjq8# -zxk)@r{Nq&dsaq(F^?TdgKLCZ^KR|NIGn#77(7;R5ec7g~@()R!Supvh%B=HyR`cJ^ -zxbu{{xLRG0y5w4hg+*HmjGPd^STy6bap6liV$CJKaMf(Lzscnhm3xXYO97igmd8kx -zI`fK0FhxsE9aOwAngQu>z|Q1&h}|m9_D0vVv4iHyWw)|*4=C(@OBcE>{=Fmn_Ea#Z -zN`yo+JNtyRbC-5?k8%wvJ)y_Hj&`ZTAi*?qZZQp}5V!ZfJ@f_qlIaXy#mK%Y$14{G*s#6o -zgdBgxnKVpz6o^d=c--q%R(%krSq@Avr&jX{bY{Z2hBA8{oiS!5P -zZyuJ!zfaX1aW#S)>KdcV<5o?589H~Q%j`BgrxBEtj-F_=D0 -zRDx8{UrHNPEO}pnnPF_1(0hEZ05@1W>-vKa-R!32uML-EqLxhk{FJ=J?ck -z-6|$amQ4cjLTITo8P8|&`Yodh`Mg=jN-Qva@oyc*yx3%MW^98zILf9*!Yl+7l`9c3 -zW*ub{B;#FUw94~1eUDy6ZbRl9_1W>;HnO^;w+`uU2T;j!>Y2c6Z4;k_AiN*i6B -z7E4H)aa@%&&-5fAw&#@Z-J1*^F(n@Rx#}_c -zyXt-dHv8=&TTb&GDhJ$PBlG@P3K2yWBaA*j -zPE|N3?#DSi(NqKahQn@?yXI_%5zp%eomm3iSp#?yk}KvB`m>nBKi -zj#YJSR$*hkH3_RLT4uRL0-2o4@}vu{e!UEq&e4iNFgc`IAEnUm?#T<1@BX(VIU68x(leqAC*HlTo -z%KQEHVy#oe;=9_R<{G1wV1+?RWd>qf+O0mFAycz6>vH?En7e -z`jOtZ=n-dJa>j*Zn$Azbny2!HM{aLgFBH>WgwZd|8a(Ii_Ya@GQ2cD$8Z2JCX7)DR -z7Qesq-Dmv#>-Il@)>Ne)i6+mKuBDN0QHbL!lN^?Nzx)rDjT&M#ueG$5dN!tA32rC< -zUYP}P>TjB8$HT#TS|ELCh|P1=svH?Ml_it9->^jlPuf11!(_Jp*tr;N0VIDOWfEJ5 -ze@0?;#j1Y06e?tH-%}mse^O}@8^YkCg_GhEG-H#NeCnbD6L>&A;!g7AW$)FC3Q#YR -zsiTB7AzCcR4S&Lia+5;+12ne{bU2$Q(Na%PMBk?{!eZ+$z;=;}oAS<}EgAPxOZwOl -zFU0B+K+Xj#UM^^Qg76p1!3%mkZ@CI#ob&X0@@;!2NP2-IjZxc)DHT+we}mtNF@7?O -z{rx1TaBN)m9KyA9D^Q)UICkm7Jo+eNf#oG6B2MB+lGHRi8MZ$OdBiXmcSFMEIsI*T -zt-;}Hb2`>X-kfF1MexfY=I{oU(Ea!cscM{6J#0@sFZ}PGZ -z@|N5!g3->M8s{Cs>_EKS1n}yRC=X_Q6-+r99m+fyB#}(yHvEXP7Wgdk*Ph^jw{Osr -zOeCuXPmUtba#mL5*okLW1}+CBy>XZM{e8B=Q!uL!Gvi&(5+TF<4zH*_piQ(`i)u0) -zUDr5}S6c6vo`Tn9m$?t7aGs=dk7NrJ5nR6%5U%puO>8Mcw|Uo2+DDA^VwxXIkG; -z2RPE}1E#?*^-~7(MSzHx$f*Q>LccC9Gf449!+fkjL}L_s5%oaav*>@e;w62&}& -za%>2~PV7*)jL_r~LDaE|#pc_umhT~@yqHH?=Ge2G451S0HQTTBSB%isId>`)?Kc=0 -zYH7v!$I2LLo>Kk;plde029ES$;D^^;zX*t+yNATl(BgV>wQIgleR)j5%CR8?2wn|c -z?g^4{@u)>R<(@e9mnIuy_J~vPZv8$G=xW5b4wJf7DK8l>W|LsmX%Dbf$_mHy7^xKq -zc6h+?!E1V)D_z=VqsFM|0AbRnR{jW$0F9MrWVI{#xA?8_oUhSEGnt4 -ztm-D`o_}L7#02z~SvO)#<{bF&IAaIF^*FTy*iXy?D#gl&q1fwYa3+9C*y#dc&cc73 -zsBJl8qIiqDCaCETl)jeXQzO${Rttso&VeP1xlp2pn8I{((RD`YY6GFT*<5ed|8S}axN^oWaW9g{ef90?P!)^kEKcd6DjR#FO@C@ -zA21DW)dt(dQ)6UjSWUoL+|5or{o8!%BVZ~MtA}e8kd$~UW!?8Ryl`9l=Ak827JaH{ -zK;gK6;6gFjh<_(a8lIvt%Asm5ybXl@1K3*{y9U%X*K=Y{Q&yv0qzlYWY27%)>uJ4Q -zpq^DZ#s2`{-ztVb<=U$`mPEdaWNaMU4!3@%U;Omofx3Tp#*e9*_y<*O&s=IWU|o%A -z-W7jT`a^BPnXi?fe))Cwyt6fJ@;d!n80YL?4rV=L%Uaxzo5A^gfj7TkHgw3wj`h9+ -zA&#$sUP?tz%&&PqT!ggrR6f*($vSA#nAe@LYj#f&)65WxnZp_?=`IuM2qOr(xR#xAh1Z#`BZ;N|xRg#C=xt8nAGl!MEx5G(3 -z{eD!K`D13s(DO`b59V66z!9&vfc1T*r1m3vq&VDkwZAY}cqWhcTIF(X={q*Ib{i2JY>XiQplarxkdzaOOEknBie9d&8&y0G!R|V9}F~I -zVYn+{fu`A5njTl3@s$4P-!h?Q*1a&AX(7+G#SqVn-fQ5CUf7xNowU2SKQ6n3v(dB) -zK9j#KI$6+2y|}6U!Q^$9iPw@z@aDWTk9uX75mdrM#AQfnNre2TW=tp~MjWdyoUfUe -z{#GXz*5a2J=lC^qeWO%pJO?af#I#*DSA!7PPSv390?17LsdglBO>|bd#k==0|!Vn$^+CLer}LLzMv- -zWh5)E%Xw$2HWx&!<5*~woBN@tF2RWwCgK&N$7jhuC)<*wrmTt=%R=eABEA4Rpd*_} -zsnI@yShI}KD{x$Fs4}D} -zcPqUI19kbPV;74SkYBt<%!@h17lZT8$UGs~|3u;SNDium0U(MaHO~U -z6&>JZ)zQG-#y1dwCs&?#KC&j;q)Q00cU>Z){RgbTP3Y+)nr_ne>sngY-w^3 -zT-9)o;et14y=H5JIAuYft4Nc7jy`r!X`8?JjeGN=(IKoU=~+O{N|Hk9ml?%P+T -z;gOuXw)+HNvGQF$wqfngcYTMoi)W%~EXpd#Yk^O{t~tz%=U2U%*stB5KQK8nbAE+f -zguBaS)3a;7>EALOC9BRgQ+T_T=^#b5!d(B34ZIo`|FBIo-Z5Eh+KKXJM{qWXMT^9x -zM_<+E%OQ5e#O++hi>T~FdXp-f&8T|ZZ~m?L2$z%6)pww>;(G3yx|M;7%4F}GsB#Cs -z`$*?yqer{(o%3GvZsMMq4PHpIeFy_0Dl|@wrpWD5F#S%=Q&x38cQsi!gUh`NCZY_u -zwKbFZshecCYd@?fvtq~*f~zeG)~mH~7s62jo=y8kZ$`Ef?8@}L -z@u*k2NS=Fj>1p<2_LD{~MLD;^dbMhXPz^#4#T9KN?+51C1x;{n=93zf!Q5asPVW1V}&gQb$3k;&)wN6{D# -zYL`z3g0^>vqK+LGS{;Xy$vPHEpd+`u_eJuXMXz-%gNa%K;=CDn+`8oa>a^FQa~+#C -zb%-p5; -zd2Csl8(jwGr%V@|5!uP)&Sx+|ERZ|&8G0gW2-gQ|UaR$EmDnXvgCRi2aj6LDA-M7m -z>V763hni=hTu8m2%TC7eVGzCgJlg8z*oTEAL=bJ3NVJN$)0p6x#DhIXW{>j=svu`^ -zUGO5)5&<}>Rz`Ao&*z4vkRR(e7f#SEfBkA20rB7nO@ru7XN!-@;u|1u86`H~6jVo7 -zr!mx?F7DpRRb?=|cj_}jrSV)d@#AI`JMYIL`@4CKY39<{1_<_+5#L~hpY1@$U<2~FGNXsf -zdnxT1yeo;FHryGK3Wjt!g4>NIz(6sKQRmn!6FNs&0qp3+rotn5L~tdQ?t?u+8VtrE -zKrNCn{puw$wh)LfMk-mt!_`n{fyd+Jq-nJGlUKtB^c#_x6Nu%R%+ZWH9)VDy9#V%e -z3zOP#)h#u+a&+bB>$`jp>=XD4IQU#D{{aLY`v$QA974_b2M&;ryF8fM0Q}RbI7Nd3 -z)|{Bk3*JUB)0qbM)1Y^Tf4Uko1bd*;4HcS$E-+e<6)gjHMpdn=xg2PM)l+bEVjb|e -z&V)7n$jBCbIg=Em9zdpXq_4sEh^+lt&LL$gXUU3~AC2;han_b`S+a@Y>&dDktyWeu -zOkb@?QrAX}!jnBP)G_*nvV{}0HQ-vc^hjSbs{GM;O+gtxSNddptVAlbw3i7t2LyXewU -z>eu#bP?Tey=htYnrD}T%YP-IhlIcU`Rd&_hUF!0@KPk+=$vv8_l5_Vl5GZRK-%`y_ -zb*%6$4Ib!VW_w8simu5=P0Fd1Q+P6RLghz>-=unugdIsYo~0Xoz+wQ&-(uX -zdVbZN(UmvV@14mTR2yp&NkDo)aU?ZqL8>eR3t=KmBa%v|_@TPiAre38Obq88z484MS_=kA9RNfhxS00z1; -z-67N$-D#IGYfdLUa&os{-I<^mSt(=#-1{L)a0RW$5=>&w+0jenaL4``Q4FU91@FlIyuZF{9n^+B^> -zD{1v{mn&Y32~Si905e+`HcsP~8VxI%$*KA8kBVFZV*t)?$%w2Zf^N-p(DiF}swut9 -z-J6xnwUEA$%(3NOw=wW&F}mwLR@&1WM|Tu(&UG+J9{7ywP|N8|1{A`O`9K4l(EyHv -zhfui|HW_+FheVAqe;Va~E5i|IkV`GR(2(W(Cak<#Z?Nw~Bs2NAcotYPE_GkO@QiEk -zcqYjCtxb*TM-MnNb$PjUQcsv_4Fo|&cp?k1b4KoM -zsho6ZCZ3VC{)FfyYl+{m3sVG=a+s)I@s5O0X;_qA-oVNF2@j9m7GIj3%>4i!IX@#3 -z#{Fv&{DYIC)BSvrVMt#|14pwoP82+t>`cDeD$*C_)Jlb@Zcgr&$d7g(pk@ICIqQKM -zhjoYOV@;Ej9Y}&@$)*`LNjvAN1D7V9iKA=yM9EJ2BqTh~E*C&I5@>pycVr -zm|33Da%n1;SDq3#`IK&Hz*(M*(YGPOe=@`{*F$0HJT5^;#>}cQHXapr=wz2Ro>2Ce -zc5R-pIZTaht&2L#WEwj%>n7fYkSmt!H_x04mR~GhN@aM>{dh=HfG1Wd=5V;Ra+HHY -zS8VX>71RVuS0}u%>d%{_ -zD9o16VO?z&21=E^0%MGB1eUw@k^c>Pc -zkUo4+G14J&iw&bLk_K^j-^l!4!lW*m`DoPe9f@{vg<*3xy?Ve8_4Bs_v$tJqEM>fQ -z9YBRtY1z`z-86$CN~x*iXy3set?ns7Z@ei<_3oxtb%vKfKEX>P`7Zw5&@>{!{%c+;pXgc!_t7)o>j5FxUdaX1=hQ+k7iRzUG{xL4CU^wSUSc# -zvygGTI#2Pvp~fmn0I$)%hOb<<+JS)m=YKYe*JOw%=Yogx(!>u%{wj9T+U2=rp&c0tt^K%Y-JyDA6eZQ5UmdvBDjS&idk+k -zn3Jl7XIbtzS4~`dobCv>J|Wpr)`-lP&c!#FL6ed;eAypQw;M{oSZWYp^&-t$3g>U2 -zDnH2SqA&eUjT0_Z(`}<1`=Xo9TrW)nst0=S*)0dP37(nZsg3FT%ghwAgU;w0o>ASm -z1R9ri_G{oRgDj;!k(i1Mj$#^6&FB+J^9$mySy0AKpmlOYH=rflr@BuZMcu+;VXpUM -zvw<({tD?1Ie`?|DvXhT*gd5)`>~bIH3iiJ$s_LbvDy`^yZfL&08p^Y{of!thckXq( -zDzb0+wQp9 -zk~uGqKU9e~n%5fLloK6|pa6B)+ga+Wotnm|15RT_&#sf1IoY8{#`mhr`LYjb&uE|W -zSftu)PL3*=_A|4#mYz>K-Oi0Rv$%)YY5kyB>y35}&+{PhgJGmqufobc-vG;5ddV-q -z9kCvI`iiaTX+k%f9<*77!rAF5{{TyfbEzX5nh*n+(#Kpwjo3#d59quuB6Fo26*1Op6Hwy -z%N_H6;yrmK?P8jQ@LpOY`n+M!Djh4%>R?UgP}NKCwKO?PZ-Z~C&X7qDmUOXN+ikaC -z=@n-sXPGKhdKsYBX*1w;Nn)Rz9EsgBw|QY|ie5eydO0BnQf0=$pmO#l)u$o}2J4j0 -z2TcC}PCPVlALz)@u=H|7F_Gds5NPy%e%ILv=>vE31%?%N8m2TJ;t19{?`5pYeowv>^+6?4`&$=IH$B#KDxsQFu*~H7?neB`Tf1 -zd5^1OnR(#z2g5o|iR58(x|5-$OxFaLf!y2tt7Ee{emv_%a`=XbPKiuPe2n;r7a?fl -zR(-BJdf@-_{UH)1*Z_IQt-)a4+C!d#Fu`E0C^7Q5ncK|5PM}T%!M_D*T2a3fycH}& -z=~O(LI9ifW=`h&VN2!*tLZV?_?~$B0-w=a%UgLzRHNuQ6u4Sjk>v$MRyzySsKGd)a -z);LaBKrY_seXF=;k%ikN_ZNj#*A6EY!h-IGt(rtra=;&JRmX9#oma1>v=|uH%R_t2 -zf7$ES9^<~o$K{Og*u)gMBK_NR4ey^^id#Xy_^zR9ncQg-x{iXo9V&PAg~4nG9IKkT -zFWfbkH07|vH9MeG;vCz^3jSp+YIyiL7*zX}$3=PuFXZKz17^Ucm$YWgZV#o0xMBH9 -zS9SIFyf)M_Qf$+^Y^9QbF-K3jOv^m^J09!BR^fD|nkR~kp=mBg9J%-NqHg_xjs3JL -z5PBY$#>W)^tLtno$I!bt)&vzRKDi#%onwTDk;Qpb7|iH>+!>v^^8#l}@_ujddAt=7 -z*WxNI1x6PmKgQkLBLoTjKK4^7*+y3*tW3j45hVi^FnFgrI~vJVC`7kya%`iO*e2}C -z5H)C?f=K+6Tvq68e#Rjfe0$l%6AhC#5_fSKapWZ=1$U-t7+R77*7Mc6SXI}e=15E5 -zWt9#S8?asiHVooGJP9b4*<`nX_2s@s_B+e23-Z)3!#TE)-_rYc?K -zea^Z0Ir__)eDVFv!#PvVfY4JE?c3jG`u_lVp~MtoKc&o`g#7~?JhP@{o5*{6H9GO( -zd$&SR&*R?S+coo-E3J8~+-~q^tZh!W7yG@w<6iNXxv|iCnjaAviXZY(^#Wn{tDPLs -z0o$*>c;WwetiLlVF3cALacpa{ZpZ2EM`bl6m(3m%A2h2Te%z_KT*8H8^jgkWf}IcB -z4DZzZ*qI*eREX!6B}8}fAqaSEq)t};03}s`RqG5%XP7J~4dzDKfpo~2_k1`mU7saA -zR#taWQuAZb;L|v@LqE9ef?lHHl7p_7I@7f@+ebo#xeQ~{LargT<)H{Ec`t&593!Gi -zhLFas3P4uv?b-uM9b*k63oP0`nJ9n$814HPjloB~6;qglUgXWz-X`-v(Piz@8cBebT>uh!f|6(Z|2 -z6jbjm>Y)#=OOk&}2&;YpOIm!;kTZw4GP!qj>O*~o14 -zwK*5?!nd{QH;4ypCkC{Mc?B?OF2iY0$-H*qA!_I5NClB#;(_&^!s!+IMSy|{+-A(0 -zy29O?L&K%gDXBeTI!{eX!`;_yIzHie(;~Xv -zY*{XF4m}yPdO4c|!wiYsn6IaRWonN7ha_f9r!rsquJ!&+@|!`n@z72x-i# -zYcWCxF^iz|f!`;hW8M#aoMXKXK?wU3noVy_)7mGb_Ima#v`pY%iBZEIizA3$7Es?s^W7&Ktjpm6Kv -zyQ(K}eDj^JcYw3bn;^761aU3KGp;j~HHj!|SgnAZwY`G~zxp_uoX@%OLo&!2GZH@b -zDY-!NQBpJaO+>E>2xCLzMEw2J{HKsRyx#{qh}yuH{GZK#JjQ2@eBIZA1zD}Je+HZ1 -zc9-)sl6l%{eUlpSZt_*gPxA!0^(>Hej~hITS4uv6T09PZX=#3!vpc5glowm8JiS7ikkY -z;{PBMA)HUNlx^quKD1wRJwd=TeeAf=2xu3Z6p~)2rCNinS9;EiLk;R?G;gkc*6(ZO -z>${0K>5^Iez)a1M!XR$tk;B7080)~i5E7e@p8U~4y&K6&zfSFZpraScGJc@>V}5sv -zPa@)yaS~7UByj=h(gTIH2tTLPKuU|Z%_Mzk2wEjZVH8c__=6!ned=GC3DX&CL0>NA -zk9G5DS@7rcjon;vYD-9iBnUJOfBf3y|Xprtqav*-a%dN)0*#@+=umP$) -zoDzh!^0sF7b8` -zvk;E!O;6|W~S4__vF>z@2BG{5c!0f&$tl@&06++Z4cb= -zpn07~g>LaZ#~fl6zYME1ZUrElVtjl3*J&ZA>2X;HmqPu~Bi@__v0ArMwjfX%{MEw= -zeDYTJC&A}9*@djG##942EijiQZcaqOBP-TNZMzpI0N~rKL{i??TInNu@b`g5dFAU# -zdHdNJ@$3}ECK6{UX!VSC3HA~+6LnICS^l-uwoc{mdl%-MOv!{l07bb@ps -z{Q7F@{sDX{H3*~73lWhM(;Q+2AM;~o*|0mlkQ}5H!|P) -z%|>`?azwQGuNP?x+!}t$VGi))%Jr4_-$mxTX9*7l18*5lR6EbP`�(*r?3uhj$FK -z!(!F~MHjN%ZxYPkNP#+!^+)}V6tdiw;f&al#hZZ!bVKg;VgO&Ila5WWly%zbKF!8M -zmjFwXJ)0G1bio_ux6*Tm{nErbRf$p=?qj4mt}k{_6CN*9Wzo~)g;t5gdGX#)t^QCrbo%uuEoqJdF|8f -ziqSoTG`|98MdZ}my$&RWRCsx$yGt(8K)B*BpfR1+jj4pl?<;p9||ME7hqS0?eSR)EZw5A|>dYohTCaB)obo8>0% -z&K|s#{vF+WugJW*R-^nLOFw;NXEh9IV;q@U!nf3edEuKl%WKY$21nw?Z#Yfz>bk%A9Ikx$1| -zT^5oflXhQz>W;LC_4ZlHJT{n9OYGlK8m~hixbivOwY`SF8X>j3W8^;GNW?~EqgzDMRrd<>B-$(d(I)>kCA1uw_ -z_eSKOPA2C9Q@!oB4};~o?U_qN;&dB=EV-6U$0kUI5()knfj68T)HW6ddXU!k##(+! -zRAT`H@#ggoO}h?5P?fHqBUx#Gn-h07b6gahO66CxUWw-T7?Gh^Tv^%0b1&H+B()YG -zhHs*4QKQa^36D@m{_X-~ea%_TJ?Hx1uhR=R^Nw}jK+0~@C2SIGfv0eNex7?RufVYT -z^fqKJ`kk_ViMkX(fsn#!FC~g^g#`PchaNNvjRQ21@CA@|hR`&Jcg@HL)rBm(XyR0* -zEfr4?7D7;+?S)utWkHIEKZiUZ3~SGE;}pGlZkPNE>oXG>m8!#FAKE;PdO|pOs(p#?GoBx9^Fb-{*9sKiyQmhYCd`LIH2hqG>U -z%Xph&Y}?EqTF4%GSt8O%z-0vOUqfe=0@b<7PB -zZ>UV>1sWD#6T=cUh$Sl4Y2sh3%;@k#U0g=@6zw9a+d`h}o1cj+cPU%5^kkI;;F~6X -zMFcDq629yBP?ob8+j@WEz -z#nsqdjxNkBw92w3I|o+6Vcq)=Fj`=}Vl7(t@zI0i$Llwe@!^C1Qev)6%de>yI0DU7 -zPFBz6*8j+e9P6C6OIQ-(jOgeGR*tSOK9!o$-NVe5O{Xg4X8XMN9pM(FHoWt? -z!6&){!qpk@B}155y6MssO~fTpX)se7_0zF7614>w!pu1s+G7e;b^M88B!*9xb_}hq -zv9I+-qWgsrO9&S2^@XkkJdNrPcFtay-htlRzPMkHz>;7%3tA}Segy~Tg}l#)4)~h$ -zG4~SE|3gAm&sAisxbsVCF1}=PtZj1zACjy7=0mIV$(;^9#{5aau8#ca=5)8=e&%(G -zS4zKc9_N{UD3+ATl8U1al3hTP(xRb4wD>cUKM54ZVH`UL%lEyup4Kgjcr5_m-e>b1 -zjDtAb>5Uc6uOo`YNITQofe^vYQnOMr14{W#XMl0~#;CU42aX)8r{Jn3j!D{+&-b2r -zF6FURoJ#6^-nP)H79%>htRq66y1%qb_;Ff9T?-3kUKuKN+tM&E(4BGH#i0oMxfNb6%+ -z3RsX9MnMx$Ao(WZ)t6t*u#MhUwNEda36%gGMH`7fsc9u|7OBGWjG -zAKiF2RbVjxN?-_E{+B9=A`CnbBRbiP^IOT3!O)*@5a(oxTcah+j~Qxa)Ey{;gr!k} -z+Kr=ngP&q_3t$b7DG=wBVg!HLMRWP4Hq6#=yP-p9Zq%-Pj6V33I#}M9EBAR+4(zTK -zkZTK!-FlRW^h;DrHnn0A_8Mf5(>(|>)NRGgp!Vn^O`cazS_<9 -zOy(ry`yoOu@4i`kIHTK%b5Sj|B-EUL_jQ^io&qN5kS{>oeWBW0AK{c88M(r6(Md=* -zIS+fB-T+7yPB5?bmGSDT-hC-lCPstiD-Y!Os3xw*)t#{krVj88B;svIX5xS`6K`8c -zZ;}h4`UY*(iQmOlOgD5)k0XIGii`*YDN4#z4v_Arl9{wOl=seGI~@QSEi`{5%Ge(p -z-96IL%mHd92FM3p6}JA^^px@Cf!gQ;J=2z=$|JC=8n)9eO(pbeP6Nl;-^8&8bU~rC -zPbd+SRT>du1a*!aG0l*o!XP(sN{Bjv}C-+{TMykj4w?6d-Vgp*#&!Fo5&U{&*Q^o*!dN8{nRvgV<- -zgjIeAg)NDuSUOfkwH$I^yoY?087i^npTpY85S8cWZBTf-<6zHsAQch>NNVisj;yge|=S^|zD8Q!MoO75sbSCZc+{1KmXv-?8so%}ETkDG91p-hAxIrewQwL+gDob>jWqc=)sgrB%Wk{KMG@wON*vONocF82VyKGlzw@ -zc@qC*Vopj0Pjp7f)KjE+5(lepA3+b=I8fHA{rMf+Ij?OxmYhn~)P?d|QXZ~VMi(Z&x#C5=Oz -za$Y?rjYWK1hPBxoUW5KNn{)WCe)&y<&&{&4)RptXW*43U)A%JiH3G0d(*vX4Z;-El -z!q2iy-TC1u$@^IM7kZtOwCFSLTH`28b2P%TFN3w`ml0$#X&oQM*2m?sQTB< -z25aVRUen8h^Knhh*@0xP9gQ0*4tx=ykC(=f827uaRy4z!ZSD~HRzJ_wScSV@=ZIqw -zM^;bC^v2jf(W3u)|t1=?esBEHtgqL5)B7 -znq$a+Unh=u<0;{tKA&nWZZm&9FI}{s9cad~Xf*#H069U%zF3_K#^TE!qtyz{kVNyA -z#CvX0=E=9{aAvM0T!t#2KT};HmIxV=v6r|ahD&o0RBM_VD-Zryt8vy--o~B_MmcyW -zya=(d%Bh7qdu@2IEM#4iVB6f5R5WEKwhEQtn%e<}eUZy(>1eXCcmC%*9v%wmu*9re -zO($riRibfsf~oMG6o}JBd$H6m=>jUsMPtcWo$#8D4C6&qY;MeZk0Cpp{{Sow4>-X@kfczdwQI|IUEi(VM~&|o`&qC9S3r8ReTkSwZGWWjchbk;3c$U6L#IZDH!j- -z$|g@}_Tqq{OUY#lUZS`dW=VE#D}^fLw`ePC7eR^@2TiP;?KiI2}fmCsR0i`xh-=Hdy -zPR42jY@MM|-#8sY&D-v62Fn#*!$o=;G0*iW6+=L@V;UJo%>}tgq-58Tc2V0{{UD20ITVAf71sq -zOuGJu$he+=Rd>l>LH2alPmky4`lmpl>cL3j)705}a0Qe(vKO~;bZJrSyQB`xdKK;V2Wo2q=+dLx -zz6DEti`Ri=7A}t}4mHS)7IDCh38Tu3MC)?Zcaa=Ku~|}U&`R8`WsBO{_9bGHq~m~g -zS}4~5tmIuDRBOi~w3U`?4+8e#i=#@LTZ6T_OMQpo@;^ubLJBCJ -z_P8l8=4*|GQEk;*d>uFPPJU$AZ9bn13@EQR##svlXfuI<* -zx-iL6pE)qXeN9`2xAf#zy+NZuH)wxQRRNh}kgPCRYYcpA9xrj@e^PN{$8)a=nZe1E -z!!lKaqEa`tC~81rX7qacv|X -z?Rp(-d#@Y{+N$8!h9mc)cA7!% -z29(xtPT?~2X>^AbX0XaGFNzi^yd`(w=hfbi7|ST>(dZ{H%{HLFQ=%GrIzP(}`FUqv -z9WN$Rd3c|hFD5g@^5E0ZobwpARzDBaYTHpdp0v2a^d{!rt2#01__6o9{R!WdBIpwS -zZ9uM%Nny=}JJ=SG^N)&p!UVZrm_C2mql -zPl+5$I0tSH<)xai8)F6v->~??o)PvPDi$l$ -zWWVU@!Y54?Y-q)Q*_3=ClEKk2*)|=cMmY>u)HO(?#G4H4GLIoq%L+v%B?PGjM$pM; -zA?-%-Yaw67?B+nM5gi4Ixb&;++hz1-1hlf82OOM{n#DjFnmp -zN@EHzjSUsQCXe6TXzk#%gcPlBk%68`{jNE|$e%i^*7pj)>=M7K5xD@RsGE -z%EvxYSfP}CMT6&mLa|p=QbcP;ISPjRjFvyR$rOq0AD4y?mr0!}7&C?#@;7spK_}oH -zmuFLjSgTDv)f=>CNTu}}F~4Gp3bB^LqfdMWK-psvlx_JNwNPT1@)u=M{{W%Xet}V| -z8Ag*SAuR~UaH!yD#*opE+sht8T3+8HD2*75l?O%GDETQIYy}@tpt3ZCrh! -z8x@Gt!(rpdk=w}e*sMyPJ1~Mf43&=)3Kho;r5UC5GfL?A2Dk9P8R=)TbM1dzA7$~5 -zp1OrE^)J}?B>P&D-8)SmqU*_Z{{RWl>SLeEr0exMIDZYrhl=2qd3E9 -zDjjlUsA@4bQCh(D=qt&ZB>6A!{U<)IH?qwWc}H(R$1wUxl`HUN -z6g_Sg5?Wtr_WPNv6j64=*@wr_+6|-ITZ<^+m+g7T9Dd^1X_J}7tne>x3%KvOoH!@i -zd6S#5H-s-^FWXn(UftVo0%-Fj94m!l_FGZgld+=>{e8oe?eSIxYeOr+@6$`D#LySt;*N1wU_z} -zqson4t$^0$TKb69Uo<6$l{&QOzfP-4Pn#yz=TB{DBAiprrONoyEpz%EeLjlPk8@w0 -z`QT2IOTSaO?HrvlP1)VUhx)1+lKP7GVQ&J}HU%MG -z;>%5HCl|Zf_+zz577b5FdGmvWoMncE^*Z{!H7NJ3_Gc;QXNP81I&sUoY^~(OB~~ll -zk~|Hp)nRzxz!3ThHpmSaO6V0yja!50D8kTJ-3K6B(V&WZZ$m|sTV!bL%i)o9s(1?6 -zNW4&ZI`PPwHRKl1Yz^+Q>{nqt75@Mu@-NhRVhllPpggM=$li1AEq}`=PXh@sHF|Aw -z7lTK3pCF$>a?m3eCrfeMT&ChyDQU&?>T+Sn-F*66dVv@%HR>#%cH>FDP>idl5e_22>WE9by(aW4XF@-^@3 -z4qpaM0_;O;O<-=X$(yB(#j$p28r=zXuv_4p_al}^k(&|9tkS9$&TOiZFt@p%fHsJp -zMy}-fVqQk>t${7AW63HGk&b=>H0+#^EG~mJY0El-D1}%jPgwmnp)}FsQG2o -zH2P@2mm7cTVVj1)55qpuN<^np$z4wZDKYZ0srF@mW17CcAav51!I+al1zI!DmfV -zB`7#I`;p5Hd7h0f!}(Aa0d|3Cmdq;volR7g{{TZ;Rw{RX0q$yyaTqnY60^s3G;?$m -zs4>Dd8G&tprCI$$3|M#?0ZgzmRGpi*25p4^CQHy=2qi(IRt%$H&^3LGl_M;%s)7t- -z7%&)gg-V8oIQkUC4FzbVReFh8DHEdv>6h4KyaEHHb>f{BNoSC+Kym$sPOPjT#Zqg5 -z(xpI4AFyJ*f7q@tn-sSXWg0HViAf8vNYPfttG)*9R36gpHyoNV`i!9LHESaFw%R6vU8WdODbgTOchKef)XsYxY3j6{plO8xlVJM`B5pTWt9W3%&7@a&LcK-lD -zlFI~eJaKvSFCui&t@s)#tKPvCy|hs*za?Z%lKL>EpJA59qPkCIY0)|2=%lc`la>x_ -z>9I+mHIc=uJp8JXQKPv? -zN_adnk@gZJ$0(#ms}}ez31Ea-NIlVLjgF{1Zdx3i+ESCH7qOluG*?;yAmW!y}hq8*uPUkPn-p$yR{>M^)zb&x#k8%ng -z44}(=zeHyrLw1jHYBlR)A-gFIwCHIIvZ&u7N!1S++8HYzLhQYm8@7WLNGc;}y9lR{ -ztc6B{+jboW!ZwOQ*4u$3&{CnHDVLIwC!@ANu8SUz35$hv8pnZoT0^6vIJeqAQ$SEpCX6Gxdjdp^7h;YVL( -z**B-*i=)h(t`-NUgQ3E%gzT#Zl$klZF|jE}Ea{XlE5SKOa&{|@PH9HHi8X22(J0`P -zhUBbY8ibZVxV3mKToZB0D;1SCtetO?)sbbeno?An60lYBEp9D`l_#?muTqu03fF>m -z9#s2oRlaEI)nCe&1a#y1;=N1i?$RsAKJ5$cEz-xgLjM5N{{TcY_Zvxnfv4?YX!Nm~ -z#yNMpQ+)42IOL{&f;=N0CoF98EBv-RgyGPYNJhN{@;z^P6|KN{P$b*1&@0B?<}@s$ -zaMX_!dHf!va?|qY^IE3;&TgW5t8skGOUM%R8ofYqu3hZGOMVSrqK?a4nuA|+Z~+9V -z3O2xI5NiVMV+-U{0{8j_Y{8FXCw3WFQ=~oPc1yd^Db?~{9D_=%qkU*g$Dqnqj+}DY -zG%ezgwN077r2_p%*v7}WyajB)Ei?x52-kIH*j^K3=|LxNJ`IL9EVMh+2NkB<<&l%S -z$xU~1Pl8S5gOgJ$Amio*)I?fBx)r`THq9V6V0!_XvU~7o$@muP=-0TbZz62cGZnKrZYAILBXT^Ac&os!SOa&+ -zuOu?bNdOmjX0>btEj)}4K=)?yD7MMq%f|L+gQum@P>;=?JR+Q2cb6{M*34$>bp1Ne -zk9_|Cn}o)k+?!#X`<;_nPbZ`Ic;{w5k)C|fybFKv8t7YDqFXeFPSr9pN-xlK{*(s$ -z;?TG68h9h{3->a^$Sj7=+ydy$fpd{IXx7*^u!AD)fp3h4JKceJA3`1aiEuU(cTum1 -z>ClH}o&NxuU!orOwhrvJ1@3zoYZ<8J^Ya_rWZgOuJ^uip)sma=4BkwdY1+SWU!kuC -z-kU|79B;s>??o5pO+AT9J&%848Dl4yd_qrvTi^`VMEY`>ZA{5mxwB`Jw?L<6GW9Ug -zhOii>v#=86Z`3>a6_6VBpn%l51P*rkdGFWWBBp5F{ -zjj@tR87%(AArBm`Fcps=ju)WGV74TtihG8cm*_Hu<(89a>=b-{g7&v`QAZ3lO9r^M -z(@C(T!lQ57&@B_~9fBQxz)K8htKR{TqXkPNs^C=6@yS?9D`oqQ40fyTAF9n=7+GO53wlVO?@GQmws$mI)5oD*phO9w-Sqsu?U` -zXj?^Q`5ho7k5SUE?mUUw%L6Y!C4r)rN=QS+VyJk2f~D#_QAm|jOMS~iM5DzN)5go{ -zRv}#wm)x`;?sGxoC7~~&Xy?j0VTI(ZAJpg5bh26xlCjN{bU|8vXn3wHNPjD~Ruxad -zNQG|HZ1YUvPL&+z{);GQNvah5Xc)RZ5y?vx7ep{{QV4~*xC)2IkP2g -zkJ<$v7!HGAG2#qGgURtz$t<7Cuubasi`fF4w8*P*_jah!g@TW>yt@=-aD1k{h51|Jj`yQc+iyW0jbY-lE{!XN -z>Efu9(`$-72cvi3jI^m=sJcAK!r_NkUV=+c^5bK&aI7qnmYyC#r6x`}!xz5rU}^S!ntJ{SG5sqCrqPP$p(nn>c*tj9SGLtTHHpy#B{8v@q{gITehA= -zajWnyl$9p861?x|Q@0>%+?|J&D%?l6>`|%}uOewoX>^rp$K0;3^L+{Er}I}OwN*cI -zn0^}9+owg}PY+99s3r6hqm}8-9IwoZNc1tg#yRhcQkN`8>^zXa^kc-@5}ryrXiBwW -z)0VyPE5E0a>jLg6$o;@NLe@-X)2QFv^Ha+^^{4XmWbZEs;j8vJdGDyd9QR6Hk8wk -zd-N$MTLKM28Qe!MF3zle?m8#BU0w*3)^?KIj^{Te`_)`$hI=$E*g*GWDv+(x744nE -z#boU~Q&0I`;A|17!FdJYkMaV`o-7TcXCO|A+N5Up6LjAua@6|SE!aZnqJ~}QWGjN6~CdY)Yoj= -zrb}lE!^jh?8-QJ53$c-r9aT20p{M+f63ewBz*yAmuZo|LYA8u04@Z~n!!Yw|p;rt)tfS5F|b -zS|hL;?~Qm3(h}IaZ4d+MM!z!IlCzgDyL7Db=e)Bk0(Zf=JZW~mjufm3G>1xyVpih6 -zK<2#+mNFH&NeUbpFC!$V!O(0g)Wa=+kaQaboxuDLSB;F7wha!*ml-mScOJ3i)!Gd< -z!Fm~FF-lf4R2c!ge#TC(b13?SDnmlDRe2sNg;*LmvaqL){z^jx(D3&;bpNUG*ByW#$R!i -zZpz8vnBSr4)w#lRSQhr3e!QYV_=;zBIkbH|Bv$?O>%fh3N -zE3@cQwmMj`Ba63wr6Z0B6v{N1S11ZsenOi22V@_io-ZI-1>+V@54jqkAX648pJ%ErWk&ytbG*2+Y!KAYx> -z>FsX>qOH4oa92;Ak!X!uP375WJ6n*B8CW}3R}?aim_Khq+D`1}hoNmZhn2g -zD=i$d5SQ4#m!sIMj$Dr)an_&G!wlM@vDxhCtU}bjU*+--l(Oq5Okrv66{qDDlVtC4 -zOG?l_TRUElrUZIF_8!AdMUw$9aojJzm+Jf8tEQJr -ztl;0X@73|{;htX?*jM_95^ckWUzlo*wVSuvJTs~8DjHGw;QN>Hs(1sN;6 -zi6up)6iuO3#*>2}tT+8kuw$MjVH&bf#>I5%gA%?Jin5W2Ari4z84F6GX@|3Nv4%Gc -zV}I@qCESl=doy-n;|2RL{Q4QenY*0sI1$7Cj*i>{8ZS~xF-^(rj58#3I$3oZy^&RW -zzYEFD__N~i_*X=}AJaP4oPRT0#ea5t9}(+xe+_&&&TUJmn*6cy{{XT-H0rhWI?Z|O -zYRkV;ZrfsKmu%Gb?dZ6F#OLuc{4>|*T-9b#yzEg&e?X|x+~R#c((Sd7sAZN=uTi0= -zpC}q`;zLUCS{iL`httx&DC*MEzf);0KD_uhrfXok1|>x`)HiBY0B-Mo6$-+S6)d=My)(AAT!H)G@dWZ -zM5UwHu$JemJqo+4Ii;g4=D5A=8XdgpX)L9bp2sZVP2lwPG?ioDCpNC1^FIdA%JZiM -z{SHk<^*s$pe>43~Nyh?M>f^2{?n%JuoM~0$i(gU}J29?ygldaPRg-HBm5WN9ZiI2c -zT5MXzP?}OC(h^y+uM5bH6Vc^KtUgKk#>HjHIX%hMaW0-UBko&ST(8iAeX>mG)xsMO -z!$$jwXzINgsd(J%b-H&Kl>H6|vnkVc9jU@i_Pw8i+*$Vh+8JZNF?W{yiLmlj>wX0~ -zs&J3_oANK9&%mt!@U06}HDJ$SPZN6rvZ!jitdQ5%T5)iTxjo;3a>`>jPmiAtex`pi -zbf4so%#?k0HCoA%JiC?3_g7q+nr50Z+5W+ctQf-rkSHMJ!vTVV=od%=6~09YnyiXw -zQCQWF>Mr1>h4Kf6#$vHe0qpr=dCjrJ{#;%~GzRHjr{ZpwO%AiCUWB`i -zt1ry?Cf*Kw^WIflaqx8|Vo8BZa9%u;?>vl*_7Tf}0CM%*pLwKK{{Sk@g4Ho2FUSt% -zR6WhKX3&o|Cw3S+lH`@l@(*_CRO@Cdb$d`R1a3!=TfsZ9x8=~C)JEi_gLZ@q$`wD< -zm8XoYS%R>h0PwIVgV}=cYp@HmG11XOx^kP^I~>aw$=#%umrj>2Ea~a7?$3ABPdnpH -zIXPQ=iFwPwexN(8+G817B;|qD&x{j9vNRR9^#QNy3-=|n$ku^$4lKYOF{HTyd-yb7 -z=pOtDJx#DBi!%L4A3-Nf05ODkIy4{nO?YQD73pRC>&n4y3#`ePrPQ}p7{4?ke1!BR -zM@LN~DK9}REBRYv%Gx!9KR_z--?%Q(w%Qxq0PZr%2E@xLr^yED{R$^SYW`gLA<1_( -zY+R`-87u)JsyIAsaaz`j&-WYtY-p?vM@BH41ee$*stR7EU~RUuEVgT)-U9$B1uC~| -zAxJe$VAw5zSn@qR(W>*XbX}H=mFzP6ny4MDRll1ujVGK8l_LX86@1vqXK*O{46)#8 -z8IrR_Q)WXXJTApauH#aJ3H(nYx9CDjE~&X7r2^L -zJUseQte15gy9`U1XNt16$qk}xsyGUbv6Mzp -z!`jD~mt{$1Y&wOnL8BWQF{SD>gtQ{RLDI>hu*XBlovfAm(MT`&!5Ht!MIP1aQbhJ> -z({zeK2^B>mxAVza5voDumV@;p94wZC#!BLaUJi@tOLLw!miAUJEtbX2lyzym7mK5l -zPj3fKo9BOWvN>{&h^w-(g7ajc(>gTOud!@nmV(pV-zwI{p&!(wbkWs!Tyt|c?k{fVLxDL!o|Ty=+epb!^^4dIdV@yU -zOoQ4ApbYZp=sNvxhV@X_(U)xF`mYTA3!>|~f5d$k%+hK)@&0JHn7Bk8U!Y4tE! -zhb!C4IraK^^z(6?eWm2;*Nx9l2ODL$XEl`hBUx|3qU+GvXc@ejZ<3JNl+$~z2*)L1 -zb_ktS4408&_#P_^F*+6X1Mokcy+K%hLJ=zBiMYI?&0toW^c6_wc(Y|>r8@$R0ZB$V -z`xb{JqZ%uxgC|#lz6vM-65j{I)x)4w7YjVYIls5QO~IQ -zJv6oF*{2(ki`^%h=8lt`lw%(0aF-`%QK{4Z9q6aj^)gRU?G?Lz5z*FlJtyIgk?QM7 -zPg$?a1^mz3)71Rq<3ASaJ~7ojZFys8!EF`c1A1Gg;mfSc>4(?r`Z>NY@hxwQ^>f$O -zmiUZ#itvsO)1ku9t~fcX>-gq4V=>3nK|^{TFx;#l?fD%-*MWORzehs%suH#}EjQWvVeIgmdx+Ap+V>HlQ$y)>GSN*x%?}LdhO8%;%AbjDac_Yd -zy^7(>aq)b$!dIgxxV)h@Y@bKcb)8eLpHEU=t7F#b{{RkkvRBk~I(jR@{LJ)tc)5Az -z@WTH9$MbV%o*aLRDDyjCh9u<}Ta=W2IX%_zZi*N4daYenxQnmY%b@sHmfbX_{K>Pk -z{0A@2<3C&dww&rP`AdI;<~4e|O+j|AFLRo*&$0Pm4p&_SAGtTud@@$wM3=Om_c^os -zFOxg|Za>%iEss}>{{Th)pWX63zJTWk)=S~P3DjTuI+}j5lOsRFJszrmC#!ILMrz1k -zvO16STyp&{_tLYhx(^(tMIp3qMOt0*N>Py{f{eGr_|7sj;tjKc#@;e -z<>|S)fAev%(}yk`pN8zUdkCOHCm6Qglz2YXc{0kQ>}ki+B+57_I)Ja3H1_F6ma~<@s>D5z-S33p~s@;B%-%jP;xO}R;m<%h_=pl=5sf0eXu=bf?* -zm!UrIQ*goDZ5y~&@bW8QZGX6(!y>SMmO}UMi}Fq~N>9{brdxxdx4^k<9oTsVuOixM -z0m)~`Jfl8v1(Z(HXdB-kF}M)%p3Gm^JF!I({-U-Qenk{xe?V{$J(!|x7wjc&^N?SVTJi?`@CJ%Bg5Tu#5rz1@g^o#E`{nm?);?0R_RGMkQlYrxvKi#69jK~tm=`&AVc*!!w&XehU#L>EB$^6T5ZiXxQll9y{R1E}8n1TDl>})6VMa?MDA|-# -zyp5nQXcD3OOr!a@7frIIk8=%Fvx6w^83Cgk4N!JQkFMiLR!ajV-RVI{HHL?b$rN4? -zkqW~pjViDnFMA~%6pmTbj!D?8adb8P{Rze6Vd8aRQmVyy3f{a3w;f~2c~df64;4w% -z$vC{bDaP3?i72m7r|W=u^$l8ljsbL?u~^NCCx_&YRfo#0f|)+<+rB`jorrhn+F3iX -zlOVMX-;V(JrR`l$49_6O! -zm;IZ#hr}M$l&J+u?2Ki8!zns+#Q1^Qs-EFe{{W1Qu&Hh@c{^58rMS^;l23u)?)mpL -z$huN3c>9ka;NrBsXkhgeG@Y4Z6fo(GB3N0dBw5-}+pvavd3m#FcG7Q@2@ -zWJ-#T{2`+imSwiX(rBcK>=L|iG-GYp$#_F0b~J>vBOEc3e^Hb|mU29a+EpAs>N1TD -z7~T--1I$UXsNi@_&GVApzB6hS@UG6+1i^-y}$5Fea -z(DEf~MO~DHK%==tu|*_G)5U#?Mv}ekNEM1jA{MC)i)qQ^j7vo?p=?me)u$r*ZKvpR -z>Fwjt=+b^N*?e4iM_eC*@n2J$N&5SpI$33-lONrc^eIE*bdWoIo_V+<)>D4_F{$kX6-b|#Psp7 -zk4)`)WaXt-xjTx}HyeT%vvaBG(#Vfa_7k;PlbOU2+hPr8#NNJ2cO>_%GtVpW?b}r|Xn-wVpekBQNaFhjABc8w~CqoV`a) -z$J9@~@8y1P(Yn8e>S+FLHuWLtx;VRW>UduS{9Dz0F)ck;{6>PsOLgqetm%4>hx~U> -zzoyht)T?pXuXJ@|mO1)(T%3HpH~Euu>p$hg3`@ya>{nNy*3i3+$Nf>*lnt#XGMP=q -zV3XvmD3oZd9vD)lNLP9EDILYH)Wk`x#HO$Nmuu)v$8#Q3pLKR={{X4;>~s8Q@jpfI4JmZ} -zB3k`U&p3~(f6(y$Ir!tM>(ummMEYKx;@9&v@4@p4UBCFl9+ywhXUX^aj}z(r&DQmr -z{{RrzmbX!;^))4%e1Bt`w;B7Et>_(?VAJTa)-zMm9f0ieS;uq*AE`YnwBrrRMh)&X -zV&27}4Vkn{ks%85UrR{_8h=VUbhNF!eSu@1=C4hmdoR%M($dCIy)KvK^zeFm8ZWnI -zb7k#*JF;o$TU3)R9R$5EdOEbae0m)a>Fwojxyx(67oYq!t)I}}BYOKDiqP%5Uv0&D -z2u-ac%$A3vv~#@$z30^Ro{to^@IzBUWl~1i>Evp3_^#XH&P{D4+Scc@tEFwz&y$O& -z(RBB~&>kkdDL)UEd3{3N{{Wcw`k2~sSB`A*I=DNR{6#TOZzEbMUJflv%cIchGi`aw -zIJF{`w1cHEt|`aHXy=k=RO42Tc}IMZvEPMrwPHBo(OE6Yv_{89H72(v)(XoAl${c* -zVw)p2%1>rR=Ez#UFp_)ODLu+b(J3pxG(x&0PFoMtN~G76Bih7_oMmE5tF<+`r$(au -z&WXIUr%yvutDIq_7pXaI6_$M$LHKv4_5;=TGo&hkP?SpZ!*{^RoIKJx5)suAEo+dTac# -z!N}jK?{M_o9Y5in*?n*PN1c~9Coj9H^q<|)sqq=fcIl<16@;RWInGmU%1&P9d*g6X -z(Uy5<_^ENmW9kuR{{TQ%FpKovCa+a4-6%OV&j|Fiz6YbFo}*W}{{W*;`m)?zKQA|& -zXOFMQGUdY$b>i@7!cNplUZ-OZ%`h8^I`X`6?Cwg9d -zCa}HJ>Hh##SeXqOp -zBG+rprhOm8eg@$Ot2KM}JXu9bElFGbkDKZ`Ec$%AbDI6H==AuxvE-YMUgzWq -zzaf+y8&B?pd1sw>JXcg@`-;$B-l7vc1_0mKSF`jK@VkNggj{_@JOsD{cJd?EXT`WQSfrWluKkO;j>lq8|uiP5Wqh3Zz*&RpSFGNo(tZAh3pD(~Tf6y)E -zi?TS@fS$mxSQ{5+k+0Afk7F%?Yt%|;7EwEmlB+{PROmR}QPUe^U3>WgV>AcIwimkq -zrhv@04+5l@xTYK2Q14=|B8Îi9dQEz;MWq_bJxCPbGFUhGPfzo5ApSi0Ct%r^* -zVi)mJx0Z~a{F&BP>4Cohw?Y@Y2HctL=ncQQ6El83;@=_n$RCgz2a_jW<^Y1ut&40n -z!GKXTRtfSvc4X-`#LLj)){rl7-D7}0Nt^&9G?_r}QxX?Bm -z1!UE@VuPS%kkD&$MPiuJ11qL(21{clY2bYqWm)wyV0aww1wH*aCmC=3Lwk?j -zT^jeX8#Re0tHB)e83E7KPU=s{B_2>XCFjT6rd(2a3I!NR?JO!9`4z9XI5nbXOE=kW@T!PAaqa -zD-4#2Q^OWg3jT!SMHV(I5~q#%!AP(8iN(AAg<-QR5~f=*qwEN*ypI&p{{Ui=Br*Gp -zqlbeelPMJPJc(KnTp`l1rFJ}G%1BE=L&))1YbJ`r!0}!(Jc(Kg6_Mi~8-*+sj7mtI -zp&0HwV))=_$9z|T;}6UI#*sTh5y;Vo;Zd#fQZd|lidKYGuTj)#S)&g&QZdHJc@njw -z8eCVYXf5(AVyi!?Sj8>TSrWAHO-1=Hrmu2PkB&;l>nNr!Y?jklqpMAv+H1*uC;sK} -za^>aMr7J}@ -zmefvKWbP`=oQ@PDjt-}%R!zeUor`0WmBaqTYjkwDQ8x|A*tE-Nc8#Yw=*dq`P7+&6 -zE|^-NB))=Z{@+FLzsCJvNR&FLuBT7V()*uB(tKax9~P?AS{kqXv;3_5?Jq#3MRDZH -zc)nh5FG0h}_p$r8^8U}$l4dPEqxv;d(EOb-xdP{XbQyro3IR -zvpw#Q@%LS&QP$DX*Ic^oWu|!7m&wre7=9Zv{+IhbxQ2;nemVGdylbfGH8kIpl#)9% -zzB}+9p?~WwKS?I2earK3WrsE&i;n*8cDF!L-0zOR!F4~EuG9Yj`NvWCPd#>>fBZyk -zC-E%zjs8zHY32ACX<9uWnebgC`?}pa{{ZGM{&o0&L4WH;b^es(D^5)B;lkhG;f|k$ -zldq@vZoal-r!4Z-9;d>(r|}5)d_Uouv(x_o^J>Lu!|u;gJua(@Q|mN3c~;sQZ&m%> -zA$I4_pDb@}n!nHbPcJK?_y(i5sU-zhhFhrkkHLNoe>YWYYX1PHKbifJZEt{dopN#N -zI^T%vD%v`cf`3GT55V7tn(g_0YL?yKH9zPla$Ve6dFIP4eI)+>0NL}O6a0VF>!+vC -z=`NZN{O>Za=zPAuuCGz4DeCG=Qg1F&cF)o^fAG)Yddm85iR);~i1iw2uh8+nCI0}1 -ze-`NBEl!>qe-P4N=INzx{{ZEA8yw@*>H407kM8ka+xhtZxBI>^MBTp3>(%LXG&Lm+ -zNIf~N<0VZJaN>&3FIr{vL$`DX8eWCmC{EqbbUnzpXJd91?esE^1=0J92yk0ZPa9F8 -z442b|teZ&XlWFPabEij7J6O7Kx3&(=4J&_8S>er=ZqAQN*2k;U=;11}o1)S^o|i}T -zI5|DLxF~6K*WkQ5d~au7j*rynhJ|{ZIajU5^OsLaU|DEVyk}$6`3|tMEc7XD_b1%w -zk>ty#S;EQ9siT)?u{{hoxyz}eN#Xbmt*48rq>^|zI*mGSIX%5?8e3C|UD`5}|h!OtbRH_2)8h{}jpRw+%@_#r1&R&RbtN$zu3Mlm@% -zvQsGcqEg(2uAEbovTS<$2u7`nZ<5~+_-?<&I)$U58GXaD(*FPp)1>uU{{RzHmUcQr7^YZ>Z1nJ)XXyR@7O6eSMEpq4+(==JhuiJ+#*HFYw=oE}jdh>LYWP@jk!MWQ`qVHNhg0S -z^Ys4z0NKaM&2Qbq`LmjgJ2cYMg4!`9#^bcAvLeaqZO=RxeYh3c++X07w>w6LNqil%uPr^!1{(BkQ{MJf6SdQqhCe(SI{X^^dvf;kjIYOJAl+8p|?=`j1EA -zpAJb&sL)@Lzt0c!{{XS&>FUcyYEXG!sq_5YU7O(QCh`9O-!bWN<=yx2@qhQ*=e6|R -zN-|AKJU`gw-Lva{BhW|UdNS%XV_ig7=8b3{uRUgm9s -zq|Subs9qH;v(>}=tbas5)kyJZ0jJ;_At|6@s=%l}urCxLnXzjIyfE&7Ft6?arj>%X -z&4?wV2Y>>aFs)_eVQ0G%`Wfu30pW}K5;I;b7U_lTz_wzGa1G4)0#vJ!eoQ0BR#4gC -zotp3&Z1V$KS!<_#(a)3@s}EnX&VXKXWgE6SerzkBuqCY&ohHboYa*NC4qq|u_c398ZQX~nQh>|};8G#f1iM-RYP+$mc0^fs6%!zkAw -zr{HM-v0O7GI!dzW3L%g-1Eq(MDES#IQ1S-BY!s@E5U;q>7i^F#*l#9E?fnB_7PmEI -zWgc0Q@+OS|Al3ug6oViFjaXF%y=Z8qW9SPS8oX{4uiVNbNE;Q51~~OHPJ)o~Xq#%Q -zt%izO^XO%;W6mh7D5S<%S=>~tYNYbUD5t*xSrsbaZR|3XRI3S%7hF(&uRC+8&^LOxG3k!(m9nJ}eGbC|-nz*V+rt;S3A3@EC|QmBD1BW^K4 -zszWYl&)6wcP$5DphF&PiU5=Ipg{>7s$2UT#V{8twA0;6ur9~i`VkcXakLpq-O&l_d -zpF(lGj~rbTiBrbfW5;12ilnQ-NR>QCTkm2=2z0#eRwSe;qLBRwMz%#DzwE3^sSgEU -z()yB1b>yUc6^U4Q;k*@&SAuIh4!t%l5vsvbW5p_D;<+mpQYB3k_9-0Lk$9$2Dk~DE -zio&ttyS(3)EO1gZQYB9a*NbDNm*>bLpOjK4q=?!vTkwZVAJ`F9?p7-WBu3K3UD;U2 -z>}bZFZc#7Lq={Ns!pDm4ythGyb}JZh_Zmd*MTBXUjDDevYWXP`_#Q-VO&Hzy@>VNv -zCWdiVJQsoFLes@wYb7Ivjzxrh3c-7nkqcDQ`xlN89XO_*#iEMDD5YpUzD7#yWf9_A -z(p{nKvWhjxdqxiA`#|BzWgIgoSkb$Y?Q{npV$EfPvxFTFay3_A?ZIBaIR60IhE$wM -zxEI-rS76cRPG<^Uf;}^($8;lwHZGN!IVGopa)ljk7MUqR?466_la;`fp@wxz1e|D% -z#e8ydxCrA%Ord1lNm#tgXoY)@<46iP7f0B|Sn7pJ@;Vw8nLG^?ENFPEOk{;d&{R@k -zif66(bMW_3_=m0e8b6W|{Mx#*+7a^q0I+nACnh{t-1EATAA@`ks`%enx_*;M>P!66 -zc#Kz;_($l!2K*!N&w$g^jD987{{XIQ{5U^F&$~PNE}y6PPe~q+po7!UPxH_G+ONxJ -zPL7v^{f6}T?x(Nh>Mw3Lw;$_&U+w(VmaeZ;{{X2r(yz<1UqRv1_N3CH`g#xdX$3~rR;El-kZ3tI+`ZoUn#?am9zyAQ___q!YxvS;%T{l&SQ^)ZzzxDY!o}Yjyc{)27 -zsv~LH+*n6*qfR!3Q7xw&2T5gB(uU`6O$C2bpGH1T{*o5{qGdcd^2^KA=(M&yo|{V2 -z@_GFZouqr6E|KMO*QwL5)9G!4rW#a+(bB>?wDi_?JnXC7;`HQt6rLQNWmuDs+lFlf -z1%4o%D&2}8H9$dHnAB*Hk_PF~3IdV?217~d7~PHJ97uQ9CL1{>UB1u%{m60ff$?F_ -z{oMC;o#$Od{B~*wr3!%AF9=B3^ZrG&13-YIn5i*~^z57+CkLQcTwdUC-7`Sn)4Syb -zP_@h0B#hV=PUIp>CiM2her{*&pR8_mOG$}NY@V+SIuc{6G!IUM?_MN>R -zc8UjCds(h6Ju2DdL$3a;ib&9sfkQfv+oPm_jK9+26b|iYQZ@dD96ZgWpqCJ^XBOBq -zReGnJhv$tgf0qiH@BN>O3@h*lb{go~kY!7B;#0RS=Yf9cl> -zp_+-qXw0-0-q_x+w;K?Bb -zhdXJRDVG8Rj#f!X$*E-B;c`X3CGA;0?wrp7rKrV3)%(6?Mg%^FJN@8iN<5PHlB%8D -z&BBX+IO1Hm@PA~;_(MNyq_t%ui?p$c`8=YkZ~5}Bs`5%x1>7eB{xdFuO?<=BH4JLi -z(rWV1-sEqB<>Nga))x)~ZuOM$67tH6S)&llxMt_;jS0;aU#!yZ>tKD2kwh+mO`O+8 -zU+f7+ru>j9A`9;8si_Ng1YK9EfD6+6ji2xMX~jos~MSEJc&kw&ezb5Ljpu7I?tJ?H#7@i6G^+O^8JPDOak6*w6)mbGRwln7E+!n(#N1u@l4Zn^Q -zELh^6n?eU@#Lk&JtN2xaag(22GbYIhE$t?Ro9sPVeI^u!xj|jajIeyGYz?Y)=KX0; -z9;6%?%@?kon#?-!E9+I3aG2;OK_jhusz@8|$nUzDy^r -zSOz3yed~T91^N?iwHU`y`D1eLEK!M$K4)aKW61e$SfP6U*w*1mYecYCV4JO~V;$2E -zhy?#=W^0ZChuUpdtpG8oalfGeMZekr{^b>w>fwBiVVGEtVCTcxJ+S?aEwg(_LI==q -zA3PE{%lo_u9t;^@I=wQ5y=M(M^C|ikeNJxdJ-)rjA56BG#25)qkuR=d8@O@sOF_KZf -zHFS30r$^aH^e1@((?kB1D&&2B{UW}5W`1@R32ZCc#pLggz5eFtv_7vb9Xd61{j_133m=D0Y7L;FV -ztN5DSqAE~Cz0`Swd;>+Ae~PXki9S3(<$DTAqiPT}`JrTW-GjRO)N4>Cwq~!!J~sMI -zxtQUB-Yk-fBdMC-etqdGGIUY3?0vrem};grjZ3zc^)W_os@&}8NAMWl*2Po|_d;q2x+A>y(TatHxR`whFP8Y-Y -z#}GYZ)Q@;Bz(}dT6rEozxpqd?L!$UK6G6@=ko0je_J^;!q>b$@1KI<0|GH-PaM45R -zWWoQDI7W76ZG|!I{wBsNng=owCt1iJvYJ{G^7|G_v!D6(FNU0Kp@8sTiPwO -zi*oYlWzCFu`vnjq)4}Y7c9Bnk((;s}4qH}c%E0a(1jIh&fZYQ{FkM~V>vHRQMq{jPRnSHbxBOPS?cipNnWD@ -zYv-N@PuLQ6BCjC4;Ucre9};EXXHhDB_@sk<6jMKj!qy#D?Rpsh*PaSMhj7aeP+A>d -zgeDqU0-umG#ebCl)$tOu6(7$ZEhMxQbW_wRY#0&2BzaWlYgaGy&`z$1T|38Yw$AGS -zi~ZxdR${IdQAr^BbbQE|ab7)6Hpg9V9>CV>2_jKEIi5KG@V{c5r=}=eFdSLbp=A*h -z$S==&%C0+F??3Ob?X?fsiI;-FiVu*D^eU78ZiN5&9#VMPxpEpjg37o#?=`4dxT|X_ -z>dGKpckw-ugL+;&NAH0{f2?VZiL#U|TQsdmNl$KhR<;sz5>Iv!o5A2B&WiwZE11al -z3wp?Vd~WCrZJXLXtaYEsDYD<1n0TZtllcyogT9JCBhhB+(B5(^ef!rxRXfoc)cki4Oj+)gO)?ay5HbYE$vpw7p1DOi8MxyQEF0s7 -z1`edr3jta3?@nZe3%$N$ykGR>bs9$zuC^PqC&6F*&T9sx&!hHnAGc)ZhEf7dp*h7T -zv)J_3-1DTaK`Fq{IFs{5-L-5J?nl&dj*SN)8yU2AYIOYg1dVuVpO`Vgo!

-cd^| -z?eS_CJYO!-P}EvH;>?A0Y;90P7L4J%Lg1PL6-Mj9_i;1BThjP~h1^!_J%6Ton2txf -z>q0GFZe;z`ls@TV;5rmkx -zc*+IKxnRE4I0?sPKMq2s+(<;TXNml5Eg^^=46~znvAucr@5aP1rhRVSAk=&7g`sa# -z+$!$#&1#8`kRKzir07&$8lDQzpuyq}b?4uwBXRw(Q)?9?HiOP1UJR^_Yd(4zoBA -zA4gc_#97drrr4Tz3Bd4|Ap+JitsL+ho<_w@T0X-LfUg!hqxTt>f>RGNA0+*|F*Px~ -zkS%vC2QSKYEdcc!=Jjl!hpe@$%jwTdl*`JE{+PBm0nJO# -zj-e=G^?-H?TwPb2inayY5d$v~iVWuFC^s`;OiZ}8VfTrdI|c2UnKYF*%bBFZgtG-; -zJWYpH19oy-=kUF7p|1_BAYA1u3z(ApZ`s5Q7AFce)4!$*6qTxAVctfF`#4eVo)V-w8Wc9M3Wo)XbeYOYO}CVC4!Gg -z3NZE#gOEw9l{6WzV0H!`AtUa8H^vSApfn}%ef+YE(i;0o+b15&V1zL5rBvr;QZ%7a -zfGu57!+UW?Qd1b`-9zU%F6(->Sxi{w116|xowH$n>84rqqxjJ -z9#=+W#TP6(P5qbpdNKXW{vy&MWoDMDzJVgJdSm3k%FiPU8SVdK!mUNP^R?vc;RY~W -z|AxQumUfYSv&imr(AAf%(FyWB<%98DWCcYuvg<1QYvosCl$bDUO>^GXc^;989=e}h -zqH;dZ4=o%$|Mc7O=&mc>*3jDLBGWLVV|+0Y6>pLI1X;4e^XvPPb;xtn0?zyqb(MD6 -zgM~0$-CwTz{oew7$zE4hi2*w30H)XmYpxi_o||c+%C8@WlQFd`GH^?{70;6wrp%&s -zg7df%rhO>VZ8ZYJl}{EXpQytPAAWkkd|S{lk4s^iLltcRD;{F5Q@pFwL)QJws#B3h -z2Muo(cU$G-1byP~$cgi#^$>+&t-*I+YA2QL+_g3yV7h(x9d-W(zY9z*-2N&;{a7@9 -zO=D&YBs?c5f1l5PkEU^WO*1FQ$i|!LR^O_9`P^H}m&OV+Nq}q{#LcapOUauKftY6` -zK^y!6W7cVCLYq$>LM}7<@5du>Qyuq89}+afq2$aq41&%K5cMRmW#0Y=wH-0YA>#ul -zCCc{id%ev5vOauN5U8#O$+RP9Rv+Rd0zZh}evUDo|WHvY2w -zDDCJLHUZ&2^|3e6swwuBcb`@~*7!AMlA9>~EdES@w)01#V*XBkRGL5_<=xL#X>0;_ -zt@Orz9Sm5Z=&C@FLmeJ43y)%jADvtQo$etYbsl|iPo+CYV=~Bx?@{UN*@MLlDpi^& -z{T~O-ni3g_VaQ-Ir2|X_?`#{ZKOzi$UxNXyD*d*B*OrwE$dS~s7MZXRpaSaVWfj?%0$j4CPE4gnnEslU0t=x|y$o?)v53F*;v1&0VeWX|4NFulVy3tOT?8`m%0PrrM -z&{E1Vd&LH}Q2e3x4EtWFZ#IFxY75evpl -z3em*c+xNqf$1)wHV_ -zZ(>~i-wj9Ux*YqslJXpuO;=H0dxh)PjI?KJHiyzsH^&C48t(%O;Y?Nm6wg~R7Y}lB -zxn(}qs_{0K`Yrb}btXyEN`~e})b6V^C -zDm}!@T~{RXozlUEU>eA=2M7w7i*&Z+SSN*!qNnPInjuU~c6j)K0k`f)Be -z2^Q3kJNKRP_Gc2f{HuNSCJAd3?WXH}4A?{faK$w%{?M_g{0s|Bsb4pf3P)7dcLPuH -zN*h{y9K%UNr*b2p4@?_b)kz^dzt>U*{Z@Pj+_GPbcqCC*&2Y|qfmf)t)g+a2U(V9P -za`E(TJ^uQp66c}nS*Mg*7ai>5omche(IX`&!p1px4jZ_?ts8Jg^I0 -zCB?E~3WD~D@y}9WErg*3*P+<8d3pxIyze8b1vkAVYQZgw^lhcB3tbU3;Pe^E=L~mC -zWH9-a{liA*Rp)6`VvxH_L;#>aRSRal!_~iZH*$Vk|ysH%G`mLM@B@a8c -za|6^;)!wXrb`@?d)A`y&PP*ODILFX@IK0vWAjrNC?7ZpS9>o)~n9`!d4%U&a)N;_! -zGW3ClP~oyw$~C0jp4*jWU*;6tKWYcn@pK%dmh?@2)T)HlUg^#pUkkWz685ewBqDzt -za56RQs4C&M)v0?^3L_EBM{-WA$Bvg-k-uBveh^tZcXM63G`hw`_E)o_m7m{|j{mUx -zM7XK>!0;|ftn-~uPvWjWk-wkpW4M9gu6*}Uz~sln(cBn=r-Ww$p7!qzB}j|41@u0N -z&QiK7(?2fnkM>C6a%tm2?;OfMfPvZ5D=JKtcH%qIf!aXLG+R+C@yke(rG#k^eRoks -za$$zpzZ(#Lf6sBePDHZKTAgr3Ynp?Vd^4H;W{ey>1_moQ=mA{?yUKWAF10e17cS?h -z%JC%XK?J8{+uB2Em+wKCP1v2eHljdT9M_PCfW>TPv_hj=*s${QI4#ef)>rPS=m{V3 -zcO7bJw3d7KP8J=5U(#YhS5XtMh77|FOulMxDAa#4w7F9HZwN;cX<2qohK?0Y^T`Kh -zgcegN2P~9jG(FZ@VCuD%Jqkr(h7VfnE@(d5GC -zO;X9^iKS)of31~Yo=7y1YGCn==-<<1Ti`!x8~5Q$89+xu2(10~L-yOLQZapQ+H*$B -zY{P?eYsjsXv^Wk?i=1RP!0@~$=2^p}8PQ!#%6S!uWNy66{iKF74X}mdMD;PY4+5NZ -z-fJeReDq1#?JZ+1+;vG25H(j(|E$+YuUR)fNM_{ysd#NJ%Frco;U^k$oA&5g%lqg& -zkx9OL30@22-OYVW0zTsMPk4E!eNPzqp`rlG9SK~7&^piFwnrr7Hq1VUR7&0(;kBh& -z6&-2XzOT>B$TQs2O$HG?LL=|<`SCsRnX)eUtfRT#qanD1 -zhf!Nii1i@mxa09RYu3{rqdJv4uZ%=4$V@PUZXXMR*S@&@sZMz;@;ZFQ)PJ(k3>o5oDZBIB8X(E*yXUeg!O -zRUb!P{h}bTFPaDnNg;p$Vm~C$Q9S=Sc%PJuAL2#~$ugZy$d8+CYX09vUE8(>*r37U~i4$AV>1C){{3`G=1>o$^QIy-Z0Aw(MpF -z*}$Fom0J#g!U8QfzLY;ttETJTC8a#(c-zp*!RVdSS^bA5o -zAgeK1XS1~Al0k?j&4`9N%h;yZ?7thHllbx#I9&2b(vKsTDdd1YK8rk$h4oonMm>JR -zHr~&^)P*D4M1_*1gxLOd%fT30U5%zNm0%Z{IlRacJJbo$-IgBCrX&fg%+Ya#S%k@= -zP)DXg%^e~@2v^$Xnw?OtemR3=FJvUZBd&{ZE2m*JEp8F^fM_u*@4R+Ryv_lHIfN1~ -zDnoYW>@?&5-H=~yLorn|Nqcj2l899YhhL$P_Z}X0u=Cp`6d;E8U?vUUM=}V7kM>=T -zfG&szb5=z}2Lzmk_ulr;_YacL?(k88qhYD7J&0_@yvk@d&q}cQ^ar@v-3<&4QkG~Ts#H5=haDLoX4#*Od_9s(#Ce-(v4{N$ -z=9*eU%2H&*2D`SU*bFQx7co#)*Lpr+!fO98Sp#MD>Da8UnEiVmC~V*+Upmz&nD=`o -zi&@$~?rm)tBW?~!`LjtwK$lA*F7wz76ua#7|TJ2zy*rh?ciJsPIr~im& -zd=nM8ZN;cJ={>g6D%TP%Ts^0l(v|MBW-9>HtK|Q+*m28W?Rp1}U=1$nwH0@+G+}>M -z-}#xPYCBBsRn^>x+n6e(w~SJuZNo!cRmiw|ywWZj>oBf-P{sUn%KT^9b1mb1m%Y#w?t2~m4EkFnu-iW%hPlQkw7U@5XYX>& -z*&nk&Zl)lg9*4jG#l)aje#7}O-QI<;}xtEto -z#c=0wmZ-??^|byFi{U2Qh7;SJ^7k}td(4YdZe2`J!@(Lzd_?k$$Lyx#0<(IE&s`=p|>ZHX{?U@ttxv1@SFVDe{E&`b(MEo!#e5iy=}9)5bO> -zQSCquT*Bep`9HC3D}OPLTjuhwrdG1=If>j6NwbnL`MSI@xFf>63Y4y5!-;Q4>k)Rp -z-m!ICDD%63$az)F$(^UWA%?m|vA2W8gD5)O(UMIsvu|ZiOvJZ|TrO+TrMW<~{}2xX -zWj4lVv5NyQM_X!l%wmEK$J54RM*i5na9PU8_Ak~0{~<{s~|Ib5O?o6KzSV}H<-+G=O%k%j|+T1uU99$ -zes5oPPEKaiv7y4Ysv+`uyly~Mv+h~;=k>-~p$IiOQK0Jk+`K`|>Q0qt9Oa`~)B{G= -z_YW8XD0|FF5~X{5O5aC!x{r6Mks1rQuYW=qqPcz^2q^P@uT?E(8DGzX&|tM8v2gGzkduA=nRi-4tx;i28q;cr)eg9uwJ{Laum -z&@;p3uH09Lfl!Ai{09{v2?c^cUJCk|1AR;9EQCZ=jXj9ej#oEipl@u51OlPl0V$*2 -zaQWI=ok-;g4Rq^8s;}d;qWi|Be(aPPjy+)g&lUpN1Tg|LiG6rXS8ml%4VA4GD&D{J -zn2%k-U5R7gQa!_w_8}|xz)KS9nD+%A#(cseUUIIb+WDkv%KGU&#$4uAg4g~FZTDOF -zcjN8rz`K7?ly3Ko4KAB4BfHPzY~x<0riS5kCPrh7jUDCcJhvPj)%Ud8@6HuzryQ}# -zUn><)>`%r9)lgo-l_i!cuIvxF=oZ=%-APj1v6#*+_s%a~gF!~3ZmU-^Ez|Zu#m)v( -zN_^Txw7cG+!5CgadhyjYvj5k!CZuFIza%ylc+D -z-elUBE&?m@o_)bsS^Fbo;nr%Zn|=Z7n=2>z5*LQ?%JOUpfU5QH29*WXrEJL@?w&!xrIe8%g%6xACR&1jn^?sGRtZRa}n -zPG>IUtTFM|oiZxk{E8K;h@b=)!n^+9OJ!OdHfOU8Pvz;kku#$MGGcjQVMUWNhiNMJ -zJi#H6!nm4Hdm{z-5{%I;q51u0d|Tnh@K#GOt}SRJd+XfofWPzmxLl2cx*V9NELK`m -z*0mN$t$-DTgZIDq5bTge!$*te66~qhGHElXi-);;(oF8-sFc);Y_7_QsZzPf^1UtZ -zBk#gJ<0KEasoJ5L(fkpohxKAd=fNW3eevw7XUln7aL|>$X5QSk82%SgI$SgJn*~XB -zjFvL45?rpyGM`j<`JkX={`$v&%=2uCQLi-MRX?NzZ|^NtFarNmCmoGl;uyuBrvbG6 -z)$NTDaKYG?larl!s!l;|-e#SDHe_5nZ;Ho`%}|Db3D79*-~O4FX@Cu2vuUYIzZ@=( -zXf)CYjFOBLws>$9D82{Gx$BUi+eof%;2K2p4gi&;uZTa8Ubn>FQe -zbslj~%^7(r@M6MadX1NE*VFCR^1e%x_mEBgw7Ov55|0}eBd7FCZ)mqam;cEp665_~ -zIOb~Pp2g^K=WR#cK+nc2V-FRu%0_X|k*7D17x;HW1zB1$l9ADpkr|}3J2k06%iXCP -z?|LRXlY+vNx~lC#0+Zf*ud7+gsZC4ppS@XLHZ1M)rzkqrss-zQ`MVP^Ke`Lw4M7-b -zdce}0W=I+d@kOT<-*IZo4G8N%RM++)sN=M9o26Y@u2wt8RJ}mM($xOQI!!OB6>|5% -zWyeSDQV8q)<(dmv>{7zQJ|HNoG|e*Whv?3Xa>sTgp3kmOP^!3Jd*Xic>*Kkj>hqg2QyFs@dnj!zk -zYKAZ~?5*?f#+EpeJ@a}8mM&1X4{>o>{CC4gBSwxnXr@qkE0Ov! -z^pvG1zILX~J7m4Q&l@c-Pbuf#R(3`mG3u!8j&*jOsRdDbw#eAQNRP3fyT(*lI^XFN -zxFa1_jh7%)`UO07hUT&JP|6Pm7?)n1A5T|$MgoKSfw>k>gl2gwN -z<3*BZMl<_I><~JmA{<;Hdm>N2>T__i|G4o?VDDZrw|OqkmO_cGV!$g?tfd`_NBIyh -zAFo9iVV|Lf%A2{jYgbn&&&JQrV=g6~vjz9Jyv_4VLinLVrFl7dtmGihlCfXYq9b)Z -zk!O$c5CGj5z>tlc9tXY)WVrzHtildxIq%4{^_Fo9`^#w -zTK!Fl#7|c8^XJf&tv6k&5JG=|yn@TVMTubCt*x$K`g;$YJZLb8{ZV678l}`CO|RHZ -z3l6dqZu=Xq-<+wJqTZ?)-6LAAQpH`6S%$eo=}SZ3dB)qcF&Rg3=bhY3-qMuKPVyO) -z5g9ob%kue~kx{Yys=CV+se;)uzE-IwlM4a4GMaiE@1%Nuba?mBl9FAK4p+wNcE~}G -z;(B~4mm1#|Ko{Yh+ikP<1q9K$)GoYI@8;ZSHr(^J1VWdpHqEnoIy~llW9q5JkQ)d^ -z2*h7NpU@8Y}Qsn9I3Yxe5qT;aSPO<8Un -zbK`Z_{K8ZH&l_jj#WqzvkDZZ$afX3+`2j?jK{1j3eHg8;A(`H{F}*TB(wh98akG+$ -zKKP<(MIM+F(aU)vAZ0s7pT0TySIWbL0kT^q7!CzCL0yj7+*v7x+XF!= -zlU1+AUqo(!3}Z%tSyD3?fO{h~=Bv0D-9GxLdgFiKF-5KrMaYhQQL`F#9!-sy!H=gE -z1DwFkW-Oj0`T#@v-m8Qr$|biH6LKY5@H?P=+?d -zo2^1K0Xg^%KO@bTqIiMs|{I2-K}|)p1u?=FirmQRcQ}oq?!`{ -zZIJfYLE;c&(11d)a+Il=v1gb4APJ|flGo9_uZw0MQ+P0CT!vECPg^{X_yn@ncfM2^ -zQ@2VUZkl5ck4WO3tG)ZiRChe_1LY~P5%ErRrWBcQ@Lex2EK>Zw0G!MKl^EBM@^Xcw -zVEhuG+iy3do~s`&y#(?F-m(^Q_dGm(h{DIKBT3i|cJ;ui`^We`1-UP2!)K($Ov;)( -zl52^{6cH7@NqJ5h)~24YJ3QpWGliM;Num?zI(!cgvx4NjG*?lx1QU^;*o?i&be>6W -z_I2Zk*65x6QeIQrXXX6}az0+XqlP+uo}d%N9cfy7O;>rID27a2yLgbh!e-Y9Ufcib -zbWMBO57XOND(n>8=v_Tg*&4)F44IJ%X{8(U`|Fw(b)9{PsIz4o(kmhvTs;rz4q>!- -z5OW%0^zxdubRVqWc||IZLu2DF+rV{_#1Ye`k#^Z@&kNL|7qJs~q2?v7F?yY6!kwa% -z<~0Un&K(NBqY#t=F=+6@Dm-lq&WKVl$Tuk-(NORHl>yxwzwGE -z1tTgXK(egnGb*Oiv92C=5zC#LKy-2&n5x`YtOK|Hz=UO$C93nLO!D^#%I>W-e+Y-x -z#ec?)T*fPThOQ+}znEtPvlehphRD^L4x&c4PdibT1XdDS&hslJ?U;Wzb}L0DPs_D( -zwtdxgJd(>B&IBS^Q!Tq-eL!?JwPgFEt=!Nxo;3*cVq(&4=scrk-l5Q6a>n$4U1A2m -zmPM&o@&bSTq$nbA(}ZbHmQ7yEFZeo(yS3y+mUIf*yvP?G2No3HUXx%wH!gQMkv^1; -zKC(+8SI5+eJ0&{L`r!BQ-fCs-gFU6lAvPN6teIwu^-SFWswO5|>-lTpiK}=s*M@bX -zUnQ~!JyJ5+=+pIV)OAHGF1T1b9PsbeH0 -zWqHm*M59yu7om7k5X;}iHsaNNAnSu(3Vk%fSS95 -zER3)95j%xHw?Vfx7vb@w=+%5|gr_6epDR!xcHT3Kap}~q_?mfRi8DQabN;%)FX_9a -zQ#-kftlnQzzMya4Jbdg#&-H88PrunlPRpIFYt$mA%o{#xY0lv;AxW)mgIVb!DE~Yqgxd -zGrfeDxBy76;7Kh%!+5LBYCo#&%_eC3saw?oNQE=S-BTC+`vuX` -z)W6-DL}xb<>GAj|^lZTnXPvbee&UTA{e{CH3j?7Kafa2{!Zn}DDYCH<+pNh{oQ0I^ -zewbHGKAvk*O>eXQ6jTvb5M*Icl;7YchZ^-x(st64A7s&yi`mH{m1)W7Fy{fjF0@gT -zo9*r+=}F)gEwFE*6N|Qbg%VVy#5#-m(=@}>!0k76E=eh5Q$&d$tYgy9tkvZi4g=UI -zq|wR4hwYJ@w!QE08!pRLllWOCX>?(JNB2O<*Jb8KqZHIwef@>50i$7NWk0D>9RYuS -zcYC}LPTAW(BF6+k%9W>;jT4eWu)#UI^$w-fXGfanML+NDdShrINnExsC)`Ay&Jtth -z1Ru<=9P^Yudz53O)vsCH*NV6^1roZKzRLdmV_8PMEzia*!pNFj;_afY|trYgWHT4wM=sg@<-ArlkT%`Nx6eh;wc-07wH -zjO_dVS~lxK*;!<#LRD}+M1<=xAz;=3Zbk5c2$v^J*#6iXQGsy^8cP~nB%6x9g9^|` -z+WF9u+3$W{ufiE_-d4$sFLPAU>S66Odaaje6nL||{Frt@zxi{T-`z6fRf|P0vQAFH -zxg4Dypxb*57=WM-`{?Q(O9zgkNLBBm(9sE_E<*=@*0w-q<;{GKf@nquqbYJ}Hfeo3 -zS6NYm#6hA1GuG}ZzP{jya?q&Dg3xywFQ3}cec1`Fo+D0wB(yY#K?+UKhT -z2L(JeoB+zg*bK|PtqZg?Ew9mciS0WCwGo%hl})P(cJ7GQJX11g()pp}ACK5j)r@Y7 -zMckxS6f8uA(~fWyv|y<8L>Kel>XZX_FEJ>ArV11_Q4rUiB8btGHV51QV)~S{4lyi- -z2Lw=5EQG|wSjcCS;w#`=yHnb12-|WKI~CZ#Qx`8oL)&B8-P!+ -z!c)>4y~)Mdw-a@Etk7qQg{e7raL^V$ejjNLe#L%6smXF0T_l@cg+L#SF-TR}yny2g -zR=p2iy}s}?AH)R#mCUx;H646sc-bEtnIgdYE-UDPvTsAsu;i~YalQ*zv0_uR>MRL? -zB59M1kCS!AOv%Oh6@k^h4geN3i-J{ZhU*Z6!MhToRfG*&&!HN|j#LIb)qD01sGNyi -z*q_OOUl^R1!RtJa;j(`>6cQ&rT-rJxFE4|I_FJ-2wRV@+V4TU3F#F{ -zvPMjb<}P~Am&4XWD7W*1BzncTLa>uTNmp7FS~4+k_9&D$Ixf5MukZ27)uUwNS|qq& -zDk-S+(NXLKy+Ph|8R6gcTSPE&3V;4)MSI$7p8c|3H^c@i -z8?piZ5-8v7AZy;K8_tdq1*~TBvKgxc$=rxg=T4TPMe&E(`Cej6v -zX{3aa<#XEri!;E_?q{I&!HmU$p@v3>tc2D9(JO>Mcpu(pW@|NQJ#l5;NvYwsyxG|u -zG8FWtgQsM2OTz$o9y+2I3wRJ-_D8Za7wkfL(+i9Hc>lowM4LIQpB=LJB%`%Fand3s -zOvR*`M0;K;Ncwp?jCq}^>DO6sd&u*nkpC*CN4{+x+Eq%aXbHPbgpI9ru=r^$gGJJ| -zpUw4f2P_%R-aFme;=q9=<4{u7*;(d>kH=OK?cGR1yosu>+^xo1znSen90o9 -ziA2)Yx8W7PpO4uP&Yti%B*R-dgtY>Zl?<`d7@L@SA09V&R*SnzL)V<`BriYdYTn@1C -zsPEc4GJAnP+9bI)fawKUfV2DY2P2yxi?!`@Ip1{l@F4`dz@HF$AuAlMk$`@vn^giA -zhe=f9qK_t#_KAg@TElMaF_DYeQB_SEd`?!xE6&?USCi(|!(GEM7v@hagMo`qu>}-` -zvcOXo&3avg92)@_k5BpoKxSCHHqm2+#J39zHkJT4j5y_Od!E8sF0c2@%^wE1pn4WF -zjNK^jtSl#@C^{`P#a9+PPXyQjY;d~KMA#Lj6I)*NNM81u9bL%p~@99QKj?$XIwvvrUi -z8X|tM-YMPD*vqUXtx+xi*JGF`-H*AU4DxXkoyxVWKNs|C&DDF< -ziPMrVyyMBNQGd}5nY?BKM--Jneb8H?(|%ZzzBH(lVmh!PVWywaBEPfVVK2DyrphlF -z4;ekO6FH%6McmK_(UF)3;XJEJdV}`E6FMsZFnut@CuzvC_#2$lC8(e0A-3i^V&vxve-tgFyW -zXbR?8TS21pcTMe7^DNlf@^?kBL2+j3WpP`oryIORnw?{<#oyiHd;Z)n!cyK&5y`15 -zg&ceS(v{QD{{8?a)vcImF)!|OndnO-;~KsglMaaBRF8m>OBK$dxWR) -z?0fn}84ngBW3KaeKqYEV1U$;QPB1Dg=ZV#->5%Z<;+i`aU1a;R^Y<8{tgXuU$H%_CPRIlpVzEWFrSbjQ=C8`2(NuvWvBdJJ -z%{>vhoU(W2Hs7!A?(w>Qs?ti6c=)b9;-=E)7E6-Ed$$(eA5opP%l`e(#mW7U%TYTp -zl5wfc?RSu$UonT4Y;AJjb1>Zy)O$qEe9;5s$HNkvAHXn^Y7k>GXDBVTCYq4K+UDoL -z%=$bSl=7uxWb#jJ38sv5|2!*_&EBxh43it8@I0mLqmBs9dn3tMmLLv~4LcU#a~5BH -z?rTr_k%?4MjwJRKLcMtObgimU^S+5lQBla^fALJxVmTH&{veQyC%~HptBKnwXQjr* -z6%}O&>P1#sxIP(fN4_O`ZA^iOs*Taj@T-jfjZDU#4vu$*zKLb9ZPT#c;>layQ -zy*fO&((1d@{>I;-Jqp_`J1m6m3v`-M`{ZP9Jz_)~13E{ca8hCc=l;JUT=*TS1F|=f_`oRq_9X -z3^$3M0NHM?rh)B%TR+E?$@rymQp{Ijv-Ycg_s3XWUa2253OM_bzHRu4w*CmrTWCwz -zQ)~7n{5vEcj0W_$00OeM>MOsDuhRK%?5%CKji3)vOlQRkNa5_S+O*%K)fj0y09HZ$ -z0vrVjeY&>vdpg``6Q!rfMZ>lCxtl&ZTt-he{!?U0jt?66l~T^)4ARbRSBb6zX^lpg -zM@IKxZwf+r5g?jG**eI**x;W)1PEk({QqRWC&>y)j4JN=++E7qiR)$jxBJCFU*>d{ -z6AqN40o?Fs4A?nu)e%)}{a>FxKo&+nOqtdD*qs10->bylo%>U$uV5{j?faiy>zlX1 -zo*M9Gh;dFka#=QPU`3pQY-j -zTWw#Hh>5jrA|N(;%Zy(X9t#x-EXOvMlkiL6pSCa%4D$m_lmDq0lM-ioYTAMw>d@2nPW$?@@Bj!;;_bC-OEnB -zBZJNKG!tJL5IIFfmXYricjt{MCAGCTc0DZmLkkyi&kmcFlEO0YG{=7Tqjmiau;T%B?g&Z8+(;55aM0zd(io6-hvK7X^9zAW{` -zO4^YyDR{$!d&_O1f7Cr02k#UTxJs=_rKsTfz`IZSQsO|1`xkhwXu>WQ4sU(pl*a%$ -zyJLQK8*z8nyX^Y&+S -z*<*o@Z23gRVXODkCg9jLqWc$x7;z#L^#c?3a*Z+52!QXIDIPcmqql;xC$)q%P?;Ca -zAsWOAirP@3dXmE(Ke%FV4FprIXip!Cn+N};w^5AdQT^Q{0-CMF)^({%DpwJ0QR&lTA#>am?v<5 -zDu<~ijts#V_sIR~j*~~5yf)h@SppFBVJZntdcMZc?4e%y^C)h>p%~`?w$Prml4Cg0 -zUd{-i-;$5O8-VH0HouFn64DA9wBn0OQuQlk)%H#aU$dW2d$X@gx#~_H$g33fME0Nz -z<^*tLM+~f$aubro{4`L%b@HH-}uLf#{MSYhVtm0Qdoj`Q;S&P_@uthMT9oe*QV8%i7B2g -z%iu0y*#DRKp`%xq;dMcPUP@(Cd%1aV*rI~o*7AS!Tujx*$VbY_DW447=wuA<=qlLz -zD3{LGD+zpj*CJL@XOJ`Mzhs^)>7h`J1%{1XT6rLOd)!xx%wIcQQf3J;d4w5hd|;k! -zysxd~oH!&Thi%ZFn%p$ENj3w-p}T&75Nza59(C+NYFnQL{VHgsl`?Gb_)yTf_l%G8Jtq -ze6n6EUE(EwkQp^=yHBZ%@KKj!+D{koFlBd8fl4>pg=iQbx_L90k40-z*BCxhs7iDs -z+=VY|6J#EIm4N6lQrbAskp;?VhB3@6B0&&hQ6Ov3KojsmhPvg^Ot88&Oa9X3T`>c| -z&tsJLrK1vgDR-?<3T5W@IP}-Y-x^3R<*wbe9M9e4oR=rhoR0YZU>x;RR;M=`tx+!! -zEJVpM>D8|bs2`T$gmh(PBDKQ4a)(6@mS7PCk8Q5}2RJX~bH<_peOf65Up4qe%Hz0y -zW#t21*0~Y}2)Gl{Cyvr3*bq9?Bk`f~K=mm_f|iFzjG$cBS&A+xfMzpMRP*YH0(3Oz -z;aTE3LR8Xc!=k1d1Q&D?LC*7Hqm=q9s^8!?yoHL7qU~k;n|?I{LJ&yz0%R4nqMkMqy5`0XsPx;gpg0k{fgg)ab83O+Vsne^d -z8f?-mP?(>`f-d)aQRhC*w#;`Sn-tGnd->n5XavkTI$1zHqFN~Sv7QLA{35+%(czO% -z7N09W3+XZ5OBf8wN0TJXTm9_PEbHHth%HktsJf!k)|#L6jd_|s%*waR6J{eJuemIl -z6RZ(}N_N?@L7nIbX$TQ3O?m)~%2kv#@oQ%-u$~swSVNur -z9G6ubb7p3nUtnZ-xA1JHhsY{xGN2}__0y@iQ`l)cf3$m{s0gd^SS9E*-5zHvfBT>@ -z962sDyvorB) -zPGe|li=@qsg6`KMaKK9fGWt7;`^)zDZ503(9_O;oHg_igH62GV_}{}_@xgXb2Y5Y3 -zOIQ@Xe}~JFhJF0q4Iv-lFOiCVm0#vnC+XajYT*gp_ZXohYfc8gspyooqh2Hk_;@-W -z1^ebj){xw0NglCke;v~L*p_TQF44=vSyb`yx2h#F`x=%mFd_O{`+(2&L6>rH@^_mG -zJqw3~0-*@RvuRfV)r_#kNnO3LRbBkH{0I~()C*0+pzoB5*S0Pig2UBU8q#ZWkBzNd -zt_sP`W}Any7;o?If3K3Xh5_GJTvv=4COA~vzBhNZTx2NXHd%9j7aE(zaF&S?)_BtY -z(`65Bui-tO@Tb(Hd8bE9-Oj>!fhYCn$X*M7acf@qOh7?>ahS6ou)Ob-qt$=%t{94F -ze82k>Ce1IkbhPyQ$1R0^1wb>(({0r3WKVT2ycnF#(0eRuN;&J4lyIFjW!$)RdugRsH{C0N*wrDaskN#PCuvSv(#;W?ps~?=Tl}j{feAlVwqe47O8X_sq)aUmtZ$e -zfYGY952S*Cyf5Fj2u2{66O;D5KgqYS5qgbrO}|8+j9_R4a($9VXMk3-PR4Eglts1v -zR!PZXdS{sMyl6A%Wu+t3#NM37PZPeC;hU6lr-XD=E|2gecB_(At57ZoS`Opc<@}`6 -z2ac<~0Udw6(L~%4m!=Z-{Y9OF6v0YLr|xZMi`e&&}ye-fE)Vi?hjKb`i??3k+s+V&h%7Cg)B2m -zUzHGUp{$->D!^VfaWvcZ;vSBJtl#%F3(W*QygE>mIY!)EvZT;yJU0yN)6UxwD3^jm -zx$|jf=1^h+pzSJ`9GCjbrIds(1#!U -zw<+C4Fvc2Jw|eoKaC(ZZio8+grYu6QZvQ0`o&&~ccW-+vYkgnIiM(sPlZKcQ13Ci* -z)*xeRN@{q|hqZfH<3+v}q214CX}q0}Ck|q)HhS_`KmZ8Rm``fHS#n^IWxuG|=7(f? -z1ApitkFMt<0Mdi#l`}F#6fh6d)z|iL@Vp7^cwi*%ykzS#e -z6~d4dySO1H1%>%yiu-3|jh?$WYmOt}GZ=~zQwr>a)#7)d) -zD_rOYK$SG}IEu!-?nj*2>AqNXAZ5hE!w=Bx&fP&pg)FScE8<8T)^&^_K -z-98nN3Hj78E9Or%M?P0!=^cuL4n4R-$hMU-3^vMy`(Kpj}Kf#N;;j1D$)prL;J=jAe;?@Ih9co -z^$qUcw<@==lzqpBqm5WeNb|U;ZbEt-0Tu=9$1_}3!N~kXJy|xE?~f8j*As`|Q#Jv4 -z%H51tgu~K(LO&9@Oj-+Y73LvpyJta=fW3>H>^Wm#+*S-r{oiZ*bTe@4z2#P4?vuRePDQAfzs#XKx> -z39g(!cumgu(9@fdN2>p&*0Hu9Mb?YwOYm|+T9a<_mPb>BCIhDio7PvfX^j|8U6bH& -zhV)oKTy)t6$qJN9>2_Um?>6M)Xmr;Kl*^yZbzUb1ZxLKg9Pg8_V!uS?r7jh42r+zm -zwQsiZF}Rl}uc%-|n4+t;*f6hg-W(8KedH{nz{;73@_gDQ(4p9 -zc~HHaFHc}>H7Ii~(gFkY<&H0AWohwkjzgm>q_+6O$`M-#l -z0wcYw!G@MBseD!e1MVCkoh~+&dY2%j`AbyTId7YYpwQo!rs@4~)GaEt1Qzt&v(~k1 -zAkCBbT=)^da!!Qc{q9euHmNoD`F|ZS!BAIZGOh7MZwt=XlUx+d=RX*y+rhGem -zyKJ6OcyuUtK&`;tua4pulk7^2dgJ?oI;?;LJqM)4z*Qs4w%GOuCEN~BINJ%tE&#Jt+?Y?3t||00m_CuU-cGBbg6c1lrKk^BcI -zl;8{h;+_s^)Q#P<2~7GFW|mEgU9$x3A?~e}B4+>5k8f79$e*%Dns!8nw0J*pZgR2H -z8*-haGId)R&U@jnI`fyv>-_EyTLxl;)OGztDrfOpQc6;;RYF$7;k6s03Rfz2Ld -z&wHgbpj5n$m>VID%SoNv+8E^WDx6mxpAcO0g?c -z!#~~r?YQWMH0@Dzow(CT@y{IIIOAhU#|G3*x{3|rO9hLx=G=$?D{;h0r^GFyH7fj8 -z|1Z(YSy5sqI`=nvAC!NLKU=OX!9A><&Z; -zWE@zDz#{FHHu4*-laFJxr&Voi1NVA!@PcmJgT=iYrhx);cNr9>5vi7U0@-t}7?0vo -zzO6HC8s*pKDXxhkV -zPyxnqx)-`@t36Row#Z~}o+3ly3%416K46q6cDU@z5zK7GsN?+n1Hw&5{_}wgZ#7*B_XbRc7!5?% -zo#sT-9LRX`#@(?Ad>?x?QWTo9cQxKEDP%0IukG1svDGRn)ruui^{C!H>s-1boax5# -zOxKWD`~7QOO5?#FIfNwWqjI!{Q+!~U$@VVG0ut_*c(}@1itnV`E>07KUBC;kNa{9n -z9x?VlE6maGN<>qCM^qrlDpo_?lvRNt4bDfQjrBGCe8uB=y`x#H;V>4#rvuj+@Qqko -z^kB2Z?vaOTy+;CLfm?-NL1mjTrQvAPWq`d -zD>cZevavO*{-?}QyBB0d{C4)N2Gd4Z$*OXDXnP(ljFj>usvh3iEoau-Y)wbm5jaF6 -z-Q%T>n4G+sSAPA_n$DbyF@HTR=k!?Z4(O-U{$Wh|@aO_C`$)IhR!htH&eT=trgG;l -zoL^-l+4R0hxCL%;wW~^WcLY>nKvnzE5lkPyZql`|^|7WYF8=Z3)dL>A!1<38Oj><{ -z&tmYe>kcOBn~ZY>d0yAYf1XG(dl#roGH`E8lcM%V{9mFmD0{Uhp1%d=7CB`N)V|o= -zt72WRQq`^2;Z;ZcWCTTj*Mu=VdtDKxQA%Pc7!li$cbr?m;+GOc|8i2Vz|*BL;mUD^ -z;%mz}sIHlhL1(aX(5RV@&g%K?lkN$Omgi>rTi&cxlzXgL?POM#pEss3$rG&tG$9x^ -zxGXVK**Dp9#B7OR_rs9dk{y(%vAAS5xM6#k=g}F!ABi6E1xTEUZwT-42rOw=Pu`Ml -zDp%MF5Ri4Pw8EWDnyrS0JlqBh%2n)m7J;Awtg=r=aX0__`p1yBb(JC^qZpQ5#|rEi -zxt9ZCtL31vF|U`|py_AU$y!7HQt)Q?G5BtOx~u#n_2&jZviKp-g0Q%MBLUybirK#<1gCO2RLQD^ -z+4vf2-f%9)twN!pihE&WLz5;l=L*B77(_7kiQuPf?g7I -zLz;v13_>n&`F|97+<4CKk9A+gkZ@U!d;o@j!+vypbs9j2wZ(U42PQ(s1?D?@q{vTF -z$1#FMohec~Uv9>!$-;OcqK+Q^H{wUbC`>}E}L?R=x;V^OKU|4U< -zp_!8kAQ5G1Zaagc;r3L97EHYLrq&?*VWul(W*t&b=4^lC_*8@4H^@emUUUx?340L# -z)+PSr!82VT;ylIyrVcA+3b*x?U@P_Af@5@n%s}ruM5U~)A?pto~@kV -z%UD!iJB+P&)e)ce-q&QEfMYDCktU)DfFHF%$qAygTM@Iq#bqLzU%Z|?i77<1k7%eq#JU -zMP{zYFl~e+xSEeZ_&~2`qEO}Q*-7g$Ut!89+Cc?|wgt3R{_`)UA(PWnh-@D(%L64$eunOLY2zj6|w?%eo5befnQeBU$Dwm@c)3 -z?u*|)NIyHF!DgV=h)A%8o~PTK!m9?QW4bjq`D5vfRD*zl!L^hodbZk1gjfqUZ=j&OM}4Jt9D8G1wJxV-G3bWgV8xv31!6#Q+L~oBX>tTd!F&&NcveQMb&fO8ZSr&@Dn%~ -zhy4RB?oFb|W%cP9XFle|9}&^9P6-L0C{?CLF6VWUL#*TJ3Z~{EBruK@UWis7`0H7b -zHFNA)z<+1vsJ6M8FsM>Jxa<5xymkHFzO`!u}(N?Cf#)~ -z-|7Hv7&b4Zip%4y)yr9Lf9=}y?q8JsC~a>|uqKVaV&w;9rdeFJu}F&z3ow2C{oj!c -zsN!4syQo8uNb0A;=oGi*yHN3PSC}v8lJnS*lIH1M#It0>f(C+mA*-^ZZ7x&;+p}53@cJDm=;2t8Qo{N2)MGn`8I{$>jz+MUJLq(HDw%<>XUUA8vVD&jm5MPmbz*Y5T%Lix -z2kHERe3_IzcH>tEU6*j7oGjEg~acIkK0au -zt-w-&{~H?BpFAi@HK>zxA?}W6JQaJn?=-zPm4?RR(Bmlr5EV`0_tv)A0oi$z#ihtU -z*b^~a|MFAwPW81h2g&!;p~;=V(r|V+Bjcy@lkN&aSM%sH+*n$=k2+XNjMD2i!65U# -zLDLC_3HicT%S|8o6ywwdEY(fS(eTAN<4)k3%qrzzW`j72sL|yEH`UeB6M&BYqUZ4_ -z$hz?%d%~x-+3R@gUv4n|1EpRpeHss$4uvGM##Qv^ZyF84T=^ZF98Kl%`ITzeFctqW -zeHy+2MY!y%-3J`@AArhXCcQ%nu?HTpL}4nYj8y5bxYXF1mg1gpQ4l1~@hOnd{02rT -zultKuvNOJvPq^R=0>TeV$r@PX_WE6{{wVGp91s6pE{d0fFDx&f?GyNT1MKlkw2nH_P% -z;&p|Ks$lHcc`;?g=@>;y{z5n^hq;61FVUvSOTXA^-qY>E(pRdQQAIJ#1;Z_W((3ce -z&A$QZny^F1+!ZAK0R{QzJaiaK+x%L0_j!Z39?&5e%N2_93 -zIV$!^li3=^FEPons|X}kNcuC~#{(|;)bW-llkvj@;mGs~rNSW&skRhVd5CYTgpb=1piBy6e5<0T# -zy3JyjweU0*_!yk+)HrK*Iu(4RT}r{;{G!$V3@nwnkp+|cOVl%M2OiLe6eBJ|isuG3 -z^G{c=a(y$6onWI!XRG6LCwE6o-N^7=>GLgg`+OBRuIMVDFfeGk$Mo8;h{4^b<}VRn -z6;~E2j<@LeL|Q<)Rs-qb_mY%pYt*>M)GWZLbLy_=Z2MHWHrRXQmZX2vuWCXb0djaM -zou}vC(t76K8_Qs-#+SJBBdOG2Fd0%ff%M`moqB(=jv%LA`Ozkv%8fHDxEPd0EaR^0 -zw*ku^=9uAs?%o&NNn^jPXdaEW-=z!9I_58%k0Cv>fW5gZ1$Ul}j4lhlIb7w(cjcu= -z(N?&BFT(IgvM`;a)f0(M&C#8G=fOeh<*U_$27t)OILF-H`PH9j`x~Wt&brf--!6;$ -zTU(kV@ -z%}=)8?TdRq+jk^q)Lv?rcl#Ib*74Awgi%BL&SFg7Z526&cRhQ)Qw75D$JAe^UPo@V -zW&Y8Y80r)uMI279)&+^t!;(Z#Snn=yu|>C6O(wGSF8O`?Lce1lG{}@gy?F%H}AOb?Al2I8jR#%}E#!+X; -zu7US6O!?ADZEPAuL)W|IRtai6my~__jicOa7x~n#ZH}}XnPkcwQ8HbYg-Fy;-7eE@ -z_8v}3umxTbR!4iTW6-QlIae#fPpNn*S-U~TRi#-9zExC^tYpmoRcU>>s%V!J8m*Dd -z1h0KNSCvp}r|#G|#?oh$Jr8nq-_U6U`uRn~alRqb -z!w#~eevm+(6bW-zYZ3ziWAR=|GBtJKM3KKl^9>;^%EOwb -zw=u+~M=t~390_~k8EN~?&ymJl;H_ZaRu=v$paO#}55ULg`zlZ&yHdaVslUJSfP1YE -z*k~4n>)z|tm}@Mxv0FRID{1gcjxA)H*~A!Ke)tnx6@O=MbW8CB6J7sftaSR$)=$)K -z7XJ*>2^1YI5EvcLZT5J9U8b4|P;7_DE#ZiHI%UJ9?6tn{SxF8d*P~ZnDT#OQx^CCI -zq$|K%=R<#5ZU1BwxEOz)jEZ=`Y+53fCze$7by6S8`&ww;Mpk}euBpVb9TF<6HzIKV -zhu$O$Rhs01Rf9A4s@XIFZe{SwYKSd9fss>i3mydskA;NNcT9exYGvfwy^4EcDdc-k -z;G+-$rDrLuD@H^4Y{PwG%l-CIoOIK%Jo}4{wik$2^FH{&a#DomJ4bPuLDD7oVLRpX -zqPXh)Po&JTo<4 -z9m8b%FcB9d=D=_BTT>Bwj|4-YeFWc*e{^B6fkV4UR<)1^23&%c`=zR~Cqyp{Z#g5O -z5}+}A>Ry&wf}CQ{nn%u+^i4&~YlUibS5dzBGL@oRG?}AW33wGKoW*<|ve)roia)0) -zRZ}Fb!Zi5%=rZW?=Y^ibN|F@o)F1@rGjdn_#_OC;QynvkY^(O7SsWf@lDvN7y)?_6 -zT)~JXCj`L%J_o{u?C(AcG31E^%#*Li6R_A4CZB~vSG#_TeJl4uB0d9rY=gLkU2(_qXGbRI`lICATg?7n!>fPcGFet+!Z4O2X#mBt)L-I2>Rd&x!Ysp@c` -zA;z4n=V(AKB&b{C@D@epHnZtrL>q#W;pw&!MC5R+Vcl))BtcyK6na8f_b}J(x9E!; -z<(4eU4dJ<+$eWcC99zxdsX^KEgH+rIan3PI;)O|G0l`%fHgFTwn_bo0+5IFrBwvl^ -zevMCoHw%-Hi|)|=gBRNGC5<|Cd$*c16cv?MKpe-$pU`Na9rq~k+aO?x*(4txJ}@A_$X$}jRYav}q!Aniul1V)nXf83SPcMyQWHr!I>sxOC5WZ8rzjyg#D! -zCPz~_@wN|DOaY0PBp>s(-L#mQnZml-**Yo@I2B%=OG<37>JTioJbwKS^(bh`LfFdKF8oSk1(8n -zdO>!T8AmYw@*HUfSHm0IVp{sE0f1_&L$kC1A)n|_A!%8CyE1kq*kk3J82=?_Z-W2t -z(^Gum^I}-3duidGw|d6WDvE=)7VC)t@m3i~YN$B>D7ysLPn#`te)S_~S7`(m-+a8J -z!Go4gOqz4loXB5S$zEjj-LbFTvCW(2bi7+bk({!s8_ma+;KfYURe}QiFX*~=Xcli| -zpY7Mh0xL27m**d_-d{X#cCrcXJl{+w?fRxTT^BzVGvg}#`8dPbSV$#?hj2)X*8Ig& -zxxeWmWj_YhF4Z-^Ik0es3wKZ9ZCGD#`&3PsX2g4Xhm`MVms1&p3)jp0G%XqT{sIVS -zO6B?#^UUCBFrB#>VFy)+8?Iw{g4_tLbf;>y_&>qiA8bnmKZ`n6aL&g~Bf3nfC@18= -zY)&A;Pa0;z=T(@zk31tJ?0UFm6pj>*tgu+4PjYa$mLEBd39hi5NUy4CdF)Lh&e2vr=>oMTaHhxlGIU%JY>Y)Tb0jy^krc`lwltOsbXQ)vc3-`5hf -zo)u5U(Q_qy&x?3Ge=Q&UB0xakGV~ljPqyxTSRhqp -z3KMvsLtlyGpcQQEB(l}nP>&hqL*iSK>Csi5rmF0jE0f?`rFK;%rG%Z4pK+$*ew=^y -z)N~jsD3r5dd{d_l_Zr`cGY2OsRUeRIX_EFocTLt#pl>58zfTSXRW%nX*O9+Al4A;Am9|R{u05 -zB}Cd2rmp_UgGDU&N7&EeGmf`@UneoW=C1{uXkL>w+pcr=))>Qr7|~ -z_ifVb%T!RyGjTkb3B5`o+rKMMvBS3L72}ea+GPl=x5awaLk%@z*n;&J&=ilHiad=-Rr_4w%7aPa=$Jk|49XYnnoyH`pE_;McrdT98DdIJM3eD@tnL23LkuQ*fW*B2HzVhRDjjue -zf~XrFMpa21T;tgeg%3w6s4kNIPuFyv996L}@>CtJJQKY;Lie7d^Cthw?V8y+IR%vy -z->@@6_X)TUG1a8pY@r(~5Q=;IoPanKY4u<>?5noshcBELH{mR}&v_WQMf=_5GXv%krW5s_wz|Ewn+h#h^B`ilz_AbWH>1!byg)(5%FJVrI45U((3Y0g*zn -zH!3l7oPEvwEvMA#b)Ji{3gy2?c(xVCKc*8JzqF4`9=`tTnd4cbxD%vcl1A$@shFMoLcbbCeFw -zOZjO&|C9eM1su6#6505KJ=-PcFi-=}uSRr(qGWZA-CVYB+R)5~_Z<@-k$p#@xU)!zG -zEyG-i#{-J|zFUBKI?$uvk4OJKmsq0E;=xf~5(?gGfYjR&g>iAft4=aAz=s(z*F~?7gE1-q?sG7U6MeGAQbKgwI}Z85G4ekMn{AGnY)m1*A`L$0<(C?E_A%)B58#0-QG4KMPWJ -zS@hv$n@@ICe4Y(gy_)58xP;IkZKFhE`ZbIz-LAiEAa~g-!6CqQf*0y|kE!#%KB@LM -z_L)tBmWTHK*}Te9jE2mi-&}56piA-v&84Y1HI|idH-ImF!U@m~17Rf1J&$(Mg?1AI -z3gSpTzu&*?dOFEl+x$Fy3vp*6r~2f>)q@b79qP&Uhm3b?|LAdn#El{~=3oUotF^)j -zmmRrx>J+WI+vv(yw@^|%qpMGXtG9W!s3_m|*f!3?EbbGE_bR>Gf*B)8P5tO|k!RDd -z6qyFU`O?Wmgy3crnV=s@BgxRk6c5>o%DZnNg;p;QFq@@%d+*EGo|+{^_1>oKt*aHA -zy0jf|_s19!@>~Twh1E4{UFIz>EPB$+Vq_p6#js&YZI7tG6svB2KE`mn$LvIYY7v6tIXHz2l`c8B%8?_;)DT6b -z5i$tB*gMzNt{-SuZ~g6UTL#y+Lfje^ZQS2ubjydfKUT{T`^nh#!O^$Es{ -zMA0vDCc%7Iger&nCyp(s2IZ{0627HCZNyEs^M=gzA@4bLRhO}DG9%rnC4PIrvy2KF -zRAN*sDBpmua7&OBU`iJ^hBm8cjM6>ueocr8-oJ=V)K$8uI)E#0{KiW0bz{~~O$3-y -zCrZwt@K87Fw+TK8ho(AiH=317f#d|QB=?>5?u7TY?U%8$KJl@7yf`jn(XyRFwHrAP0s-vUg| -zLm1t7w3&AP`7^L_z7Y+bxw9@!$)h;&vh4l6ui1sX%8bvV3Cn%K&mX!UzghESc>eaZ -z>{m*%pmbW8Q`)|HSag4UQiaYhAzGtv)9xBD*Ehbwm66Zg7e-4n#M!Z9wm1%twcYey -zkad)JQQ4U726E1kg)Q4AGipt(qWG*UOg)cG5L1=0#aoE0_d#@kJ%D$vrci+QS -z&6!HQS3r-ZPlY-SWJU2*QgUpNsn#_}B65CfBPIK(3UmhRIZR`j`Fdzcmr%y?F7+9D -zn%*C!WM2^G&9na>H(dzXJyb!SPaZC@ -zXJy=Mx?SnuQtf{w!|f*&+T}DJ{T`}}(;jNrC**gyaDUsF-N@wr#{cczDV@T@3d?VED6*8yXj_OS#>f)tXWB`Ag_I6|^H{BkSw&o=iC@oTmCNUrPHx0rlUm3!Grs -zhGfjgsIh!9;$a|d2~a|%Ts#QqP6Y>7q~&=v5TS~%gM1VJF*gS4TjVj8pHihip2HBe -zf9A?%lMF@+Jg`OoZvGS`*bI+pf1F7bmFS+D7+#JEa6i5&H_x)xKH>l8PQDfADqM2X -zl5K0<+dDUYVj4&8kD;|&TFOA~{1^}n7WmJ~MoUQAPI!Of-`qkx -z-xK${BGdo0jdApO>(B;^7aCoY?$sL9s~AQB7aj&c0HJ6U!B{8E{y|zikYNNzH#-QL -zM`tr}aY27#9`Dg9e>v)Ex2@s&a?1g=auIS%_J_hurI^2LcLU -z4)GR%bRN4<7dBm8{2jEfp}8i1Fj;~kYkpX-TbOVfl^r$)2)0J#CD!B#7g)u&{@hdf -zC=yePmP3(r3*V4sMH>S?_R91dbF_B<@q2?!=~RDIIWy|+!+PDBZ8B6uznv3p&Yaog -zqPpvTT!)u1nN8a}?R>f~-tPmDDk?B>fDq5$Fs(@nmd16; -zXg{g#$_cx(!kY=>{ZnaGJ-zw^U0BI9%Cl%fKxGg&Z*kVBDNUUckP7`O!w)&UIg@2){49xNqo7BNNiIEC+#RzL73D8Ke -zE}l)?uevqcf*@)`x}0n-Bpo(h28xa~I&`Sgu2x2w`j_-&rAt;dxAwt^UfbL*Sa4aU -zoF{q}wEd(=@yY6_Q2IzYwv||uRDHn2AiUfiU9%RM>`KE;{o7btt$()9cR-`d6Hu;T -zaz6{0&R%H44IA=Q6(}rQ$3(p?Ly2vm#kq>h7wqHiE%5V{>g>RLs8Bk!LCdFt!o|+M -z73spE77}DRsB&acYC66O@>Xp8*uE!OWJt6V9jTygsWzGHNUs8TJsl9RZSf{W -zsJ7ZdIi^40FOgcQ#!`~Wdi5bc>YPDQWr;4#?9kv%4FYWTO@q>_G-|Q&y@$OgYgUKT -z{I+U%)4c@%t8@^eJQgY+D*PT0zX(vllVl-Mgvz;AERV!BGz*5HdfsI9qHI7NuH(K0 -zKW`A8Ba#br&5TRAq-v?@2erHqO-S^%YH#|3P|k@ -zCt8xc^gI)_G8si0i%Z&461YOBO)1DM3dXG=S5QiuuTVNSt~>SQ9S^g>7+=6HfLWPhrZlnE$W%4-sc9~7 -zpXuhJ46@9$CpM~EJZBTr&OE1606C1XL)D7hhuJgj2yYGKZZvStN|$;8ki!!3HJ|Jx -z>jQI>qigG%VjQ9UR;oo4F*HhfjDv)cl#{1Fwrf68M%s*V$*VdaCDUS(tK`f=_O1AH -zPRR%K8cB4HJu+?bssHUc-(!N>8s!n7+@tCf#|^S*ES|s=0x4M3y}~B9Z1^xMEFydyD9QXve9Jq3&lD-Al+SHzc`< -z{7&8epY7w@d)#AWyBGnF7piQ+<@dD>NmE#J%S@9a;S@Yw?TyvTvz;Z({laXY+nX%B -zcs{t^TbIy&(8#1V){%SldFx>Hz8DSl18(D{GMa(AFQy=x;v=qYrGB5twayLh$1e(1 -zYIK7nNM`gqLPxm)RT7qfC=P>OVKcuFL#($kE9FJS9WDCDEteDNEzC)`cxwMtSA7bp -zJZqnGE~QeE_d*N6WkW?vpna7ugIW@H(BfVqI_Hy}4q<=Yn5C?>C(<9=MET>^egLjVb+WG2;;ZYV9E#dMZ11zo&?uZa02C!C6CaXxk?!Y|5% -zk=p4$rMIDi++AQz$AoK&O^R#^gBV{%vro&X5|>oshQq4z{1nit3O7eac-ZJAUD-az -z4|ISY92CEEg4Y-i@893YyPFN34E<++Z-<`=;d1++{{ty4kKpI(g-V9(B)QBZCaKSpvFJ2cSeX;p&PY}&B~TH}m=iE<0u -zU3pD5`8rGWlx^Z@bX2XU9S^Ks6B5!~MKdD{Vck`}6urt`?4Q%~H1RaU&DZyL^Y@N? -zPw-UeI<|yoBgCA3k?&Q#f=rtl@sBb=R`u-EhvYQ-pZ_h~bRinDYS`GR71p$nNwX#d -zj0DN=-sxfJmkN^Knz|$w{K{_{nv4ZgCnTpFSRFm0BP2Kpr@uHO)7_@=A!mM(_rB9? -zp+&nJ#X{r -zhVnUBsBG{5082r%zIg1!i}0{ATk=vSqILBRub`_Vt(fqX$=!_>Dz&{(Q1LYr;45Kc -z_X>D^gF+rJf#Y&?mH11OtKpvs)$8t8^0X7FYD@NBS@eA;OVjj9x_u<2v(%Pk{{XSu -z#na`<=J<{-UZWmAyFAx}(|ixC>J_aQ82O8hm|E%kI4{{XlC$F}6;?oHp3 -zzLs}m({ah?Z#yolmip7epW)83Kg;s9fA~#*Q;(?V_4-Fz`ZLo10OYavKB+rT1IJbN -zI6uz^ye6$PUYie<(Q)eYm+whm8Dl1W2V3wRE~e+w){d|L0E+(rEWNxRKR8cEQc#>+ -zCl^gMlaD?;xbK&L7cM-rz^6lSPA`F$6BBCbNV>splcm<{HKV1Y7pbW%B#|8*DQoIO -zPfjjUlcbj?+M!wi7x{e=)5FDiFXZ9sdFKT2=PT*H7w~SM;E_&h -zJx^O%lgwf5>U&=d=rukouIH&Xv}2j-KiPVm9Vbsduc(HOo@X~!{{VCAbm6DdXve3~ -z#+*6-08{0j=MNOWFA?%xS3Xncysz~C0N;|alr*%XqoWn4qaC8ZcjPJVO+1A=J6esQcI9%y{<2e{0mFs -z@Se9%80mGfR?=UWSN+e7)Qq%eC{8Xji>99k=n>Ru+H}^;^FI-MDSS(({wql+^%4BC -zuk#$-yj|0~A8$*f>TeyKdHVT&U-bC&=vSz=+?2bMadw^4OfiI|c%#pK4{Z61)Na=X -zQozyEidNs)DaJc3j2oXIUC(6O8EML$FS(YZXb(}va=lIAyp?FquF!r=ysx+xqw`@? -zen8$#v}CPe{Y}|C889ic0*5W4fvx* -z`d*pW`Je1QGs=8<_VZ(ZSINgphWSTidVD+%x@+LO*Z7g=y)QyhW~dA9Td+kBP-$t9!rhjR%t%DEA%Ul)vaFZb!*+s# -zp1=+8HC5nNfFc;H7CExoQM6$6I(k-CIv03l^fZ$@`hJtTvA>|U>CJgO>E=F}(62_k -zp4_?`PX{FWeef*HY5YxiuRF5@?!C^vO+MQ>ry8_6xaG8*yGYAY?Tx7F&S}b!mDP?r -zY0QM@R&7bUXFT;cC%0BOjOA8FQv|1WNz2rguAFf+r(~SB1JvA`mKc_=F&6SCmLBVS -zi+8a#BnIsRV_BQP4qTu$YJy-6%GDEml+CewFe&0qHY0(4!!0Llo{utfJvQ!jUFPqsST;SXcLK?&@0$mH;%wcjcVHK}KJ}1yiLue|ED~;n -z@4zftX$;=r)ztY~RsLpZwG`(qk;y$rIkwp@O#3nX>G8*OF4L`q#(#5P{QJxxVMb{=VwdS^YnRdiuk_g%KrcY=fj62 -z)=~9S>2&pA^?G@!#oZ*%9Z$%q;$G*8)AhRDB-FIE9DJ@H(Dd|w5ozkB9;-_$c|}_H -zK8KI(9+#>7e{(PC{{T*Jfyu|~%>JP(R-fIHlBr>)cKoiNsEeM4s+I9}&V5drakp3O -zQ$8%D-19##CdVo2x#zd9?oFrYy^2l_FDa(HqIK(!Cl+28fwC8F2H*=~M=RO#EmzcT -zC|A$!Owg!SHP+}EcUkr(XbTC@tg6zNiuHU2>Bb86CX)5!(~m1Q+lVN(>3)SHp^KBG -zOH<++T1l-n-u&!v>vdY1?e|KTgmUtA96Vn>>-l>AYU74keonn^x*7?`NhwRu2cM~{ -zEm=89w#9q}?9U^csLz|mUcQc;aG3fjjANBpz@V7IR)CUM{{SpCxEH7^0zooBRlphO -zp^{bzrL$y~S9K^cz2XPF!c4>*6 -ztPVn_f80J>M?K4C)`d~FUQC_jC`J|b87sb6BD3UpV)8tjB^buH8DjWATMV776`m3p -z4;I~uf}IZvb?!3ziaqv^2r=D-P!~8FE{B9}-x~#N5Y>i4GD&Wa!M|rp+&M* -zJWT5&r-q5ANso2zQWA<-W5wDMF8zaaG$xdb-1I&V@YnGTcih}`VVTK(-shbgdu8x_ -ze@D}Ul37I-cvMEhM1`sKP3gR>=iA-vpDiGHCXm -z9+lZKl<~{Qh(dpJZ<@uk5 -z$>dxt&*A*u<~)-wKZ){vFX4WHbbUMP^%D8IpO-~G7cBJL?%j#2s~Jf`3bf$6BE1li -zo+$RQ#&P2@pC`@dmRz}9^7+1-@aB)o>GgW2yr0X3{;c%Wvh!Yy=IP`7KS$GOtaiak -z`@D{)N3n)IxXAg=PrseX(4~OJce^3omywjaL!^6GjQ0wgvOW0VDp&z~S5lz&5R9xU -zR+{7*FKWtGw-0}*6)aT-F6`PbYQ6S8gYLLX5Ss0O+>BRl`5U^!CWBk_`HzltOG;DM -zQT*|jW~%k_c;7MkKELA8i|aohmcYEz;$MqUdr`DdFu_(GczHB>k@cJ&3KKwO( -zvUxJCw?zBQrD>eb?I^ZlN?G(0T9|1&^%gSoVA#mAcnWq&OM41?nY68iJ4DvwC%Lv= -zDHmSDC+bccvEr`6RU-XzQZuzpStxQkTiatoST99S`C3ey)07)c7K-$uiK!})i``?H -zD&Tmp7h}(-amsduiUV(cl!m0DtAeo9Pk8-_MJBAIQ=r7ImV=DB*sLO-Cp=?iV--Wk -zJ#@oQn@p@=x9-6RLb6gS$B19m)d;~Y(P%g;t7kMLOUcov8_xr2&6bvg-f1LO5Od1} -zA@(|93}h}$uDu4FIHLM`V`;+u&W$}Gqn9kpr=(Z$9+mXHGWGt2^t5fI#EiNSfH}k4~b5&y(o)c=+w}UPQVz6zy-78J -z`VCzwi+QR%?x#+>zhN=T+UvN?W9Rj>dvEq<9O3#Nr%?^gDaBJd@$`ht%ZcfMY5E;K -zrcuD!TfHbkhf%=lEpXUrhe6z*Z=f2${y_P`npF4}tg8}*Jf)0s&YcC8LMwBlr&;|& -z3zhKndT3rhQ`hM9(npumJfqg=+P^|Po}OM=S(CC|I_>p5{-;8lw0in~$Z~Zsw9Z^E -zt8!h^-lSg4o1+w@x1utF?Jp`NB&%|EFO73gO*HUx&rf?hWVfPHj>Iy;I&sR! -zpFKah&p3Kf=*}DRb82aC&Af# -zCk@@WEL#V51lja%>I0C8?gzHw_Y8;by9dn0awl*czToaO#OidOK&4&TCgou6!|*R~ -z_NeEL&GS7;CaJ0x#qJ)}d-4wQZd4BJ1Gsxs?)5i$F5oF%;O-vPdw`vi?(hXHP`$&Y -zdzMYzf?eC0PLMV_Q@am<>ATC=l6}p)q)%I@wc8ve$S!jk-9}@-2G-W^Z7<~_<|X+R -z(ZQB?E4sADQ%X5*EsNX-Hi_)=9kC?t!Q9xcLeogi-O{gea&|Lzn3(?nj7oS4ZZ6ZO -zM4=-*lXxsJjNy!=E=NC*#X&W<=5BD)E8)sFKBu -zos^lEO2&0~v6Px*lNz|-tj#?vre!ViNjf$L?=F__HS>f@_`vBuAny$g?iH0lRqkZ) -z#oHP@jJ-bMC4u9SiYsu%U#JqlLG=cHCJX&6ZuYN>BA>j_T8ib9F7wSAEGJb4$J3?Lp -zpWP1#s=(2B$vC@AXuMZ};S^X3Xh`9iF{Lh^kHGX+zr?g6^A!8v(sw`a}% -z8~*_H?MLHITORtBPj91|;@{T1Ua!w4zL8Y$7`jB0`V9$S?QrQxyai5)+Clo5x=~4{ -z6za)cSW^gTRVup*fAmT+v@(|VZIelSS50gDD_SovO{u5)Kirq#{U4VOv#Wch^5gFJ -zFV(u}I=}w_gCd^itK9?wnO_(I~yg -zgu7)KcxdU4Ek4&?ZEH)?m*^~Imyvavdae0M{m`q>_bem4u$($`A9WNFuwd;b6&Rio2KZ{~lg;`~EP=6p8) -z0Q`E1{mveFzUlfsPLlS_Z|nQKYf9hj3vT#Be5ULxN&B8|p4Q@Krpm1?&{mt+8f~Xk -zhgd=RbQKQ>+R=6pW2Jz0(hO4PaKJQh*zxzFVmwk=+{x3$V0G$+jje}EI1EnHM0l$N -zRg{crWMr*08&`}PeLs4*{ZL~cs%3PoT?RyL*O=x}t~Mzc-=Wbx6*b)*$s`>&cHqHp -zjIywZsT7FPC28ZaT{!L}V`a3XNNDHEucsUxI&fLwj+9e6bfcV^$DLb7Cr+Fff_iDR -zb!h2iJ8|W9eLXum^mJP`hKcBCXwnkrq~{%@(e&NgkyXkY@dOv~nsHD0VYiH)kHfTo -z$4|yjH{!GTzY*7M+KcU1#S!k^boBgka_{LJx>{*3_A03+D)bg|X)wvRp`R`|C9O3~ -z^17++j_q4%qmFtlv!@IsaAnl@c#kVmJNY?fqLa=5>qiXqHJZyfbt&1?jV>N5&DMomJnd-idb+W@I5ps@j`X;)c{=gSICT{! -zdV27~I5lEJDE2tAaL;3&Zk3%{k=>lLTb!9a91xSC9Qd%$1e?P-?R8^3Eg6pqZgWOd -zJY`&(R=B!jEDnf4of>|nCE7Q^p&NbP>uNQg)d)w*yJHdB~0M$<^_MmRI&CJSwrI)zFx>C0i0bgqCc3YWx#?gyV*CXM?86t@py&3m)Es!d2xeF}D82JFRHXC1Ayp2FpqdU)Vf3~UdF -zMpSaw3|}RCH^Dl=D~*SgoG?Cfu-jjtsFIMik8dL0Lh-!>1!0n6w04f#fX}zrtx3~$}FSs!` -z)3trFzd}-jj_ISMH^%GKo#V#(@M)ECnVl2SQp|At5OHyI_c`*y+~8g$UKae{sRkHDjh09rIF&k!$OK*m6-*8fkQ&HUAK+=6j&B2*+{L~TxW#qL@Ryv -zFndZ8ieXBxCXXm(hA~DrUgIU;2~rN@lv2;I)CGaAta;>=cnlWciv2hpdJI8Iy~eBo -z20V=kMmsV0i(UneEe#y;W5NPWj4u>0BN{9#Z0syX9u}K{qp*(J8as^%PMug+ffi87 -zk12F@x1dv`#ax9ysM425jD}LSPA>yT0~1On8&pm?eg+y+y>G*_QTU8w{KuLBMqQ -z@D#*P$Wt+NqIMY2k#&v+UWO^C!ly}xa}!DR@=^GAStqy4?fSeOy)y0iS3tl0(r1hD -z{-fn|T6zioZAafP{wrhH>80QBuZOj_%CEBr9$VzfeI)(IlN&g(zgvH07TbkA#7sB2 -zcQ&70(`x?!5zzGdzF?yL)(Wh7JfFk8SAL$aNhhD@)A!{bs&A -z#X1RN!0I>dG+Vp4)!jk`3c2| -z*fWv9wCHHYzufD6J#Z(u0c1`i3>Tn~KABbZM$Y -zA(YGMt=L@oIyBPyomxI=9J+WrG;{YemoF~9o+^&r7}hXyX)pRa`gqg!WUVB|J9HyR -z?$CwDZ>i1G>7Duz^di}1F^>NLhoz^dsjBvh{g0hjt2xc($+wf}ejxtf^e3y71idwWEf5 -zy6by5HKVyY^*FM5nvugfH6nT%s|@6vFwR_~)#J&*sIbUM9eT0f^*N;-&P=1b3$&Zh -zu+Vqx28N0zx5<4htQ}fQ$<3o2(c7f3R~IIAeI!~glO-8a@)bNZRyeHMo!5RvZjhb- -z0AM-#nWSdyo89ad$+v-3#shz$IXl2yiArScTNqg~P3|+K+wx9Q!zXK_7)I{NN!^Uz -z8YeB^kt*22x0X(B`5C?l$*hRJFdMRM<-a36os(@MYe-hrKh&G&BQ{C85qv@Wh}dN5 -z2*kBW4gOZi$KElK{$YD5rIj&X)T2;a%?R~0)$&fsJ=4!6{XnCBfO_dHB2v_puRmf}lL`5rV^wmD -z6Sr)XwVT4i5-Wcpt08$Z%f#@ck_9&XLl`#MNNJVR)59yr#jv?)IKu-d7Eq=Y9QZr1 -z;gK%nyD)Cr{^ft5we>4F;B1|{*qyg!n&yRQUxy7U4mY@t6}=r86~_+Fe7K?Iak$ms -zl%s>PP~42*aA(D(@ve4~^kTh=G}VaJS;uCTl)M333stZ=WXv01pkoI)cBPQQ4sz{V -zv#Jq}jC*3U%PYmj-{$%YmWd5G=->ILJ9F-m}jSH=+1 -z7P9?@NDImxWqSmmmA~jV_62BUtzn_cFjkrwFBmjd16!e?St<;0jFsmBNsS0-EyqiI -z0t<99D?Jjj8mtTKGAgU`m2CB^1Vv;9qdAa6BtKHWicyy9{w?SRWx+V=RiXk(R?i6!;lhv10HW%?wk= -z9E4QejJ6<#LanTNKli(~^{1jFYt22Tu_dYc`^gfU9hft=vu95!$o-0xw=;G-4E#~w7r(ajc -zJ`a!d>-#;8`3zq+B6WbKmnX3CwCL%z=hN!LQ%+SlyGPXNYs0J1k5Q-mvc#AAS@JP< -zuy%Ym;uH9OuX0`5Z~5T)M_&goW!3duT>L*0ZhMcVjF?og{RGmUpHZdrv?brB_guyJ -zW=|)k@+|tSq&A(s$wpuC7SmL+gC@yO9OBz$p%rYL6;oy5AJnA9&uOBENw4l`E_p4} -zbh@2GY7uY4;CYYAA#S|VMKP!69 -z>~i&*u3Cy6&CFYge`yeNcsAQ8(5$xmt -z0BXJbzwiE#SK)mrCgavc`ZOc_DX#wjlUq)C_A3Qm3TetwPqnq|!P&?D(tJ*7>o4f@ -zwSEKFXeZsE$e-<+SkCKclah9KQKAv9$_iz}QbScThzfb*e$qcx%$I6&> -zSZ8&;U(MwFib6dFTUpr{*`Atew>j)|O!V_*qgRK3c6Ot_T3f2WQWDZ?@xeP5$33~0 -z(RBGO3R@C^T{dFm=+byQG+Jq9-QePbI`lBX@^ab*? -zJCnxeS9S6$*xOSZW60O(F7bwWT~A9_NcwGEG}FPs)O5=@8f5f1d9?X`Z3h#YO04%f -zo|3Nzm(*!?wo+HK#mO>`Wg($Fh~v1u!F20x%_-pN)17j8`g83s3FB}%^2OWTX^P}d -zGqk|vfN3d&r;vROOzwm9{2n3dng^Yvr7$EdkG^?9?8 -zQ4q=Lan}^%X`Hi;EbY`=oU>nJlPL6f>z=a8X-9B&?pIDEq*~t#X+-IYr9||gspPKc -zq>fCk#@g5x^2N$Ccz@Jn^lspHP?v#Rv$g@VcAd-q#B;aoBc2{aa^J|CJjBjqTjTXJ -zkd8uad}e{VU(l4AZ+(L)TPG)mC0iI-$VV!_CT-=mN>ZY0;{sBkw) -zHSRCeMImIjA*mZoyL=Ot%$`$mOnf-?7UUbNRCVe_TRCSF&(1pVsXjy*^J3Y`=zuFo -zK6w`R@FC$^6^`)5;fiQhh2U={dofK2mf(Dbw-iIdzxcpATnH(lTHOJw8k+#RG^Ap^ -zw9w;impTHI4Y(+6nPkZ}Bi$)Oq*ulpz~5YUg<+>Jm{ -z-^e7{qa;!hZR9YHOKIu)9h_WyPUO(jD51ddjol4ZX&$Z|azrjfQK2c>N)@7-2}@pr -zINQlxzt~o-Sca63Es8xLHGxeD&cd`k1Gmtbl4}piIYW9b(2Z}o9P!$cxhDZDxjr}#*i5dvFr%)7~y-2Q5i4G?gWNkpv7gl+wLku4GJqQ;B~OEYa=gk!qJLU -z9n6fCj|wruV?+s1(d1}DM|L*rkyZz<%SAEtO393s@&vMimjwuF3_!3l+-L$c1w$o6 -z!V32a`vYN>U9sUtJ2pCd3Y8$N20|HZ6|(?WBNm9!;0tioMU4s+80P!|ECm8FxETt* -z<1e7a81fW>5XE|oQ!Mf_*jVz0SX&JUD;}sRVS#6VxK-q6Q|=h7KLW=gPKJfB$kK_8^20$9ga^eg -z01J`HulR>UO4f#ywPe4|sfG4FcEf*AW!7?E!z65aJSV%iPg&RN_0sOvo0o{JCG3a+ -zIs$%&9m?f*m32&JGg2K(2S>wt*?d2&(&{4frzHK?CoSMRFF@m!#_k4K%%zv+`|Wue&@N;{A;J`ajzfY^*_}d#s2_f -z=N7}mKTZygE?l_$Pfl)L963F{&r3_@r7bzfRz6_tvV-u`^*&dlZ%y|`PA|%IdRiY7 -z>h#t%=U%xzK0bM8nDTi#e5KU8d)jeSbZKc$a_xj1tn#`oUc0Q7M_NiNc~-}%^VWnr -zBRNi7%1?8*j?AY1PdAerjn~cH4wpluN?lH(a{mBCGA6&pC#e?=6tr~z0QT;A%TdbP -z%Vvw?^eJ8!xx9>N)K|0TcwxiMNJ+pMLA1oT{E|`%cgS{4DcwP`YE*9HY&3f}e&qYN*@L-NgJY#TlSHQk)4{u{ -z@&zr;vq`5OzfWn>Jf5$n?X&1)tx>_$=q8>AmD$6~Wqh{2l{RuTdtGNwP2lo%q1$C8 -zd)!&fp8f -zgY_nOKv4B;J(uWi+ec}3fUjdWX81Q{8B%)-Sn^fJ0=VNM_R*Cm^cJ@%+AVq$u}M?d -z4SJ7C#S=$`@-1WBWzPU>7!yV%AXXT{@Ws)fY@dM|DR>sWMKq+Uz?Hd5-#d!Xr`ZK) -zr6EPpr-H18D-08oP9*miB0_ldo(>_>=lXBkDX@k@r+}q_ -z;YD&afhF(YBg#`pW)ll+n}b -zG&L5cn{b?6rk=-dPtBJN^|^hxx%hGB$KI^!x(<$gR;*zhCA;u@ueU=_AZvh?w}xh(s* -z`&;HmP9G~v^2KtwCv=IaQ`l&|?Cq~Rw@NQ@<17+a#{`Hx1bnZHNm-@UM*4?)5`6ZT8c#V!5^G=`F)O4$oalp~_Ayld-hEh3RNhUJqaZ<5G -zf{BugvEbfp1ga-RAjzj}cxLDcRkZPo!AN?Og0+&`ctW914om5)WZdi^@91IOpjejS=Wm)!2qlF-wZuB9ZE+wgOA -z+I_3$PPf9SE%TVp5X2>vjvpiK&ND_1~Nt-)#Ez#UPn??@^h(B>F#1&S5n83<34>( -zbtH#U!IQCdJY*_lRJX~LtNn~#)%)w5gTKKgE=}Cl4WR8)zaZ|SUEG1o)EXYuT+m}I -z5c!*$GP7uVT``{zVJ8&g?uApp++~;~)6DBMZv77rtJ16ReLqnfOz}G16qEEGSEtiw -zuMY}KED@DiO?dXV?sMHS-qt>2qBHdwY8>&HR;7QrgSBToGHzBcb~h&}U$8c5i%Lf} -zq^`(4UZddFM;fva;my>sWSsw4GRGvYx?NPfDT+kDw4gfL|?!;_& -znCoUr_ZWFoQyCi%5va3r0I -zrYXyjI4LhuO$fA4Zb5i_h2gOpZBaF08?~Hz33ReE5=cd0c^843q$dI%7F)4i<4NF4 -zbY&o3J%n$7i+-XWK$kQ_QqpDH{Rrx8OEqzF$r5q&EhSfE>%r$`Ji4c%sNiJ`4;WbS -zg(30d+g!Ag(+|t!ykkh+r$#(P?n~vW0)-X;{{RjK&~VSFk4}!4$UAK@ZyYqq$t^sR -zlo{CIN^rwD^5Rxx|3)8 -z4mDzSQ%a9+Hx=gFD&zDK#;i*z<=Slu`N>qb5voi>%1yk`9n&44IMBK@Dpp%gI42#; -z=|sN{K1-EfNnovg#nM=1Yx2?b99Z~q<$R{%>u@!OiYVdHoJ!n6RC`~zJ8#Ke%i{*^ -zu{&wDg)FNBjUwHdH_P3N*-a~*#hS49qOVS@R|Y3#G|3i_J82f|7qc9F3HBaTTB{W* -zMOAH#*-sB@5#|rBaOP=$Y+k>@uhL?(u(Eel$Q2&>#xo9Ii#w^<;S+` -z=xi?hquaeOHIG5uaKT3&m6bYGn+;$uoPb*lKvqWjKt6p_Cf2e4(pw -zZp9cI8pA;C;0(#oQy0mNvuInkYxNbkTL9Z_AL`P6iK+FG#biR*QwSc8Zbo)P}$NvD;{O$hn&w2T8`oCuv{{W*< -zr`gs)zgW>dPs1HtQ+jgK)?fQ%dP@wVZDlrrm)YGOU+CBAZ~W{hKP>tG07uR0^gTyN -z-_FsTE0(eMCZ7JM*Xi|IuwAyNAN0#8=GXXlMbG$#j)8YcEnO}(A(U}N9v3GMCk9=dlU3P{c;`E@yE0Z7=D~Cn -zs7S_(GE@#w-$9{8JPa&(@-n)}(6nRj6b1QKP2G2}N-I9Wpe=)DfH4X&g8;#cX)s4% -z`QTz1Wd^NZfGxKV(G37sAzxreb{``Y$SVTHg(bknHP}TOF3@%wGJCLs5SFBrV!Nc> -zB#(Ec_#U2`QtBI={{YgRBy@3b=gofV9GtlE&%E%{@D+r8Lg>0>4&RZdOaB0A$<+K4 -zM^#Da{{V$QALVCeT@NNRa_!BJRfW20Fa@xT5-RPfHO=za=rk-#5Z{DLo~p(@sk2ky!M)asFvvqBGT( -z&=y)_j85FD(fM#rqJp)XU&=u`h;P(+mc0|TZ<{RT1Lnw@VMyK7J7NB8t8>-(Z{iN8 -zq=M7buA@i&6Wx0=$mFh?wp)vnK0LRL(mb4a=QWhu?D`*x^j%u~x{pGC=+xWpdfh)s -zDM@z4PTHpzX!t&!IP!hJ;GTuWYIWL@Yfe9w3h>{P>AD_Vx{T%-PvZH`vx^=KE_m0| -z^!gF#dViM}`Q@1~Wt^|9)Rf!rtKx@UUZVd1GW#D(a>LYo-)3I#w?uqa2aH-)@Sl^H -z_=&ZdG)_@-SKQ_9CCYq*vfmcFrLU!@buRgGmc(^Bsp~4lW8oa}O=5!=f)_hlamb=? -zVc_oUpBWun;F!~=R)$W*k0V40sTV^iC^lT7HKfq%zM&YSZv>>qf0|a@WxD*Dm+y75W*fZy=6271FGB -zV@Cok4Hr#?I_XQhMn(EaTO*>s!;#t0!O7Ci_zZIAbt}{9BaEKMOQ5@Z^)VRa0t@y0^r`r$7rF(hzHl8)dE^M`rudA!#Uln~rdU|fOm+E=SSYjzvo4){c -z;m0tV#QnlbcoEBSd%mVtVs7V?DL*9C@MQ9BA4;iE(QC;V%Y2NawlQ?Fmi&zwZbmQu -zA>#P~E-S`Lf|(^Dl(5X6lvD7-+{pJEzXlG~d%aEHMAOHSTc+}1?N_@DUhk-iUZArN -zY5VXrXSo~n9T~K|WHObIjFTEH3HF|Oyq<4a3r~~3yTQ%WM&ia-i^Y8BR~)_%I&UoY -zddOj(Hm(~E-$TK72&Y4LS|Qz^aH-H;U8?tQk!35gef4~b<-SGOb?bux#=x-WbmLA$DZ_O|k7=OK{%gV=Kk}rcLK24Je)&IXp1i -zthy%N;Mt@JY)y{d89U91RmC|=bV^li6qEJbl(B3|z9nMahv|VN=vu4`66)An@Fn0) -zsUtURL7yT$g*+olg?Sl@?V&1>87;&qC5OP0Csu@eh}~H42u321uhVuVjY2)esz73m -zBk)vxD_hc -zYX-@Wpey}N#tgG&29E(N0|~16HkcAjM++*p1tWIsWzrJUbV^!#osJ?nZbvR72UL(w$-Mf=%olZ7M#*R$5 -z^sYG|;x7!Vg<#d;8Z(#hZPx=@6euFJPL$YwE-sW0PNZ&1I2S>}R*v?f$)vo=9C&&SqEX!+lDW0Ax{XBs)V -z@$*!|_(rkn2l}DftMnIp%^Wr_2;*3wRS!*zS7h{QO4j1mp?=)hp40d&k|$)4Z<$5N~Xpeynk -z5dlh;0=IYsb7Li03}I9r7^5aJMP&tY197-vX_W*EAwvTsJV1iIMuiBh4l3Mjg8)}P -z108_58_2~N@)QWGu|D+6z_;Ds -zsJ?we9rN@)x?df$#Ga(}9$)5fBS#{Q8_$CjP{>u!py^TxS!V;Uabvj2S&C$8vn_(X -zj7qMKytLCxFl#Y;GmEeIBs!Q&TcTaMi!#vj?fs6pszYhX#$C~L)7=Zn$A>;250-9! -zS^9tOgB-HL?+3~>(`n)C)7)q;sq|kI_*8x;r!9RL_VsaJnk#KZ{m+|NwX;4ys_Ap- -zGwr@*^?twi^?JNqvzHyuXRHnV39CpeV~$mHqIGX}6({T>_Mq@K$}!oDm4Yh)PJ&Y= -z7=Z>Mg%ykh3t;Ys0gK=}3Z6rn+-Os$N#rrTxfN^}?_mR8;fuAnp^K{wDT08qj1toz -ztT9s#!vos*2Tq^N*J}HJEPtu&rkUmZ25MatlHN1V{Q4e>!SwwslZPEVK7HOxv)u(t -z>L70($5WqAFXQ?b4Lx+T{F3$Xc*_l*_r@l_^7$vsl2&+{8a?Z}R-$+vULX0s@6GG< -z*?;5n@@+jiYPZ|5)u#w(s#%wiInwQp!jY0ae=lP9`CSIv@a%3 -zpOC=O)&i*tygUUk!kv1Vcok#)#^cC9(B$aRS9u{C!PB6yR|IoM1I*N?>q&f;+!bk(M+1i)P8_ -zu<`nj95!bPwt*FPA$^^0JXhF6$|q<97~^u0e!?WVDGyOn9GzuAQ;*-pF;MBBN~h92 -zx9Ip^O{#9{ZM8bzWImI5BNiXxyaFBK%3z< -z|8U~1A%CpI`Wcg2`}$W0ALZMNI*{9~{GekM57`)Sm+)Lu6LxF+)5=&T%Vxtb%$VWT -z*KG+h4Tw^Uil9+0%!ZgbQitd%PTG1N=S4!^xP@|`n{<+>awxz7Z7bS$sCNI6h6KRv -z#8hqqQvFK_?&?|lG3k5eKv(<(#)h`+TX*A@07>xD>;ZpZo1dfd5}UR40qCVf?r$*@ -zM#3QLGh!{N;GtZs>xkAdZmqV5C)R(zQ+{diEf3vP$A`SSj#PAa!B0QN_DNOJCGBR! -zpWEU%w;D7mcnx`>xpvLX?#*I|oe|EeJUsG&G5z?GCw)EDygx_k4*Pnrt -z6~-eI1#B77(OiS*rYW)$BujGqW8t9A;nRisWcc(IeWsHK`0jhA7K~6?H(P&P>1$R$ -zua#IwZoNR>g&1eCmffU}1K&M0fnFT%@_tt$@gCKv!A8!OyUT&%rs)|#{;v~_^!({O -zL!6cvfbiDRl;>MzO4Y56qECZ*!I1$7PhJSMg5g0w;Wo#wB*9_Inn~Idzf=kz#Z7y~ -z-=0(tvNL)%gzopG8GY(@NTroMkGq(~>?~ -zI{Mn7Uykrffdm_)7V3i5tVSCt#iL#cR)ms-?k}70|KWXtQ#%oA-}tYXOi0rwQ+@OD -zo++LJ#xezJlW*Iq8-ibqh!iOx496sKQY})MQeCngtMRL`XO=p&ZUSsZ@mD0VPaAs4 -ziKBz+s1I|*6e}-?sz(I#Ea>aLIHsni)=|(zMG`3(8hog}kE|Zkx1V;l3%{Ba^&5Zb -zV6El5hfc|4glwq4;In)Vc-9^Gt_KE{aa#xMPn+9KhnIP6I#VQg=D~ -z;rxxU*j7_eo6GnMal+NfyJqmxjWato&-7_^Z1y@saj`W6TP`;(M3I -z9iM*mOrOq!ug32=yi9xMlJhqWtq|ICH?gBKLD@{Lm@YLiKwQ<|sA)vlt~Bb$#H{;m -zg~#sZZmU+P;?;WFqBw)fZlGOK9#vw8=aMRS*oem9$pvwF_LYO8mgARYfVcnq&z`T| -zYx##rdlS-X3`Ye2dp?(xp9~jNRoqSTh -zmp~y(XOwx|7HkTOw;y`a=|IM5-!~r@)Frio6POTkA@pYG35hc9rTh4b{^iK)7{Ac+ -zFdTa5%+(u1uY?st5vyA_xCF;j(9F|v5b8YgUcKlzWn>?pc_*Kc8;Wi8%foB8kx&n -zexEuTnZPhR@9sZsFwcA5u?NYMnXD}E=2mwe{P!#$A0Va)qvv`sOQy%Zz?QfUy4>H& -zjEWs5CY@aR7)cHtcv_BIXYsz$y;$m&JY2&FpSAg{XMgj1Jmeq7q+<^q3|H^iGLv&q -zY7lr+a1)d=l`=55J8YZ-0YQ5sl0)``h3t+4?)SNoCh7YtHtVHjwaOa4a4dL#lGc#F -z*X`YX?fl=zkBNRsoHsWMe};^R5AKA$sZ2}a8# -zqifxNMfgJKBMBma)bj^lUk(nnC)F6nFth&VSI@+L221vr5g&xBOrl6}bG~EE{Sdu) -zWxv17V_ABMKPt++^s0Fhux0$`cTWSPt2V^1-+1+3oK6%Nxj!T&9*c^o$2wh9HiKZQ -zVUV!NOA)mi54F(;p|21cEG&Nj%~{!GGrN0qY@?;t -z5Xs%-YK99oWc&TCvvzHgOnB!|;-JUw=U&&_|6qJx^}YH90Hd;qO22%jUo0((OlbR9 -z6Ev}+T~Vi7Rg%@DlIB30GBOYwX~-EXTOub)7*Q-$tP?lEKv&1i?y4&cBf_r9RUQZ# -z-mh{uVB3)4(WD5hpEA|U=imomGs88(xk(?1W-oH|lo=d7ypv+*_N=qhid9AYCHgl5 -z^Vq5*HaBk62SoyN1cyY%IB$K0{TPD9z{txM`H!5&iynyTF(6^fM5bLW^U=1*$h7S* -zb!hh=JUqhRQCS()nqrBCOzcq4m9C_kEkF#l2J`cwAwvabsfBTZ?(2jb|6%Y3_$sjp -zaTKIa3bq*cQ!>_N1_nB{lon3zzo{h^TUO#qxXVpanzujOK~LZ#QKDI0Ssh@{;x-tR -z1{~LTtatd59cy(n0=7!(T?}l}FBx|~9D7?#mv3gZrl#v_t@SMFD9&G!DJLv4@XN(r -z{fvTWDW@iUryZ-#j;i^3sna7AU@_+r0og8X0AvFidaMXugl -zKb@vh4zh^j?7-EqT -zHxMZinm?u)x9BD8b;5`0Ut+2?`akMxXs@1Wql*TP)<&*eLH3=E=#oO0?pAHNqk(sN -zKRqJq#lHh6!CkoEv7^6%%ZA)O(V)z01=$mGa;fi=p!fPcm0@(`ul{luWD*NQtJ0GT -zte)<3f3Anw%B|Q}ntlP>GTDpbFn7N$SFdf1q%zu;-DuIL`{3~l-OM*o`9?G(^MYt7%rcG52zKF8Ek&AN=zYax6Ay=C%{ -zn08=f)9Y1Qe<}*6EQ9!;rgqg=71I^nI0^FrGjUpJ!y$TmyWgk6Zs -zMTl!gnxZ(E9uk8HmlVw@N(Ts2iL*9T$u;$8=Lip-ygA$+FsF){8+r8oi)<@bfImDr -z98v-ky_f0wsLQK&f$2{o_xTU&Qk0S4uz)J|yOctju|pnJeY;z};_VFwi7>h4Hs{g0 -z4+_>bhaFzndchRYA8_R(1@~;4cQ(6M;0f6Fb9_7tSndLQT!kb~?uELzVox@cu=q}2 -zu{Cf+4|$Eg-!8@TQ73>S$_qIdPu!SPKAoi=IU2;FDO=CBum5}<8G2*%wYf!o0akch -z`1d~{p1w_=)Ov&RNN1ImOwekV>{4H_dj-8IWUpW0`dC$Z2Z`F4T&SJ(r@@_i+om;gXD%{8JT_@UichaPOUYzK-rD -z?z8InNY#XoY`D3YTp!>|7REcDbAI4K3HQYNmasl+HEpm|#S%gFrE)Nsxk{&_$5Lx6 -zMU6h0r1VMIJKX08hK-K;Y>G1N8sD0txPzaYlET?2t03Z1P|Sm2gcU{=wzXfX8$z;`Lv`nWYq=7UKIPN>59J54OY$FyAea;NhL(a1>g3xQwpE<8C#u8}}7S;*R& -z(2da!)>{2n&1b0{&+NWuYOcYR^vu)h>2@z36qjnaY7X9MklE4g_oQacvYYG3C2O-h -zY3i|_5^N|{5DfQ==kgP=>X}qBZR|(|leMpa{mG0ijQSsbd9M8^X4O{gp4357pZejf -zyyQ5=E2oV$`%pebeKcB4+px`<7e_T -z0E*js?+k-H-<2JsmRi+Y&!UA4l?lH-B4ym2B{W{uB#0t*`}$dWYyeqYP~^|&18cpq -zg!)r6u+;?aM!%vmgc_n>ex=Gg1bb`1A!sE|g@$#WZROZd|LL@WwyC@3y*$oz=pSWO -zj+B)P=d9^U1(L7lDZe&#RSTO9eXMOt6%w|l7q(mI)AiFKrW)4SYQ}ZbH?!+vv6G9# -z)fTC`j05LL-wL4nO#JMRrAa!nhoJjNy2;f5g7Rp-u7WQ)j(*PYav{ehij=jW#Ceq- -z?*uMQqMBaL*BAl|P1l#ZD;ei>w#Oj0h3O+>R|2qGge#IO8QpSvntNpb^9hP#U3i1& -zHDNx3t8gzH`pZvt@RdJPB24@?nB){41#p2Bhg6w9c-TzeVb2p?i-uCh_%Y}}IjelZ -zjW4Rrf!Z?du(4Xri5KuVxT2w?bS<;u$HCeOZ*BnRiL=Fea|BRnYO{rD<$37qQAo|1 -zeVI{_L&1-6ne&}>f&B+%y;vl;S1={(l5uH7=p1frL4QKO#KInR2DvgCXUk_{4S+`1M${RV{;ChtYnk0?W;6`~0j^!`*c@D)& -zP>@UdQ9p56&M$NkHcdE8W_>E*@H?gNzT_CyfP3o%MHnl^Qp&lk&es1PIB100?+{$DC*P^s@;vJG -z%#*>BTx9`cA9Y@@_oG=K6X+7YFCm)v -z8Nnu@=cXr>gQ*zjkIjYc9Yu7M0+CzLP274f_5A~UE`4hM(x-t`prbC(1e7x?M_|`o -zcjC}bSVt7mU9#ULaMT4bLpyWn2J#dui+_Ba&-s;@mirGQW95!MRaKXKELWf_Z{&Bj -zkUD0-ok9PO8P*wk<(idE7IZFIKmb<)#uzdiipibt1AdC=JUnhgk5vuhPkI8?{^qUf -z$u9p@0h2s>y4Yhu;Sj!9I6(_FDxNvX3YLjkE~LpQ$Y8G}7Df0WbNxPzn~Y*8OXQ3A -zey)miepS)+wAq5WIErWC^}_oX`3cet4hh&;hE{SyJ(kh&4%|hIeSj=SDZJxFSpZhE -z#szjl{!bF<65|qS1917q414%E^H({{Huz7_9rf-em0QNyV?v7_=X$%HpS;gRBv5;| -zP$f6K4{XOi%a2R|m=DscZ+oEQ6WHa35z$(B&nAR_Z_S)Zk3Px*D74YJC%jW+L!8b4C0 -z(vAObuKXi|$n=fN$8SsBTOB|_I`Q~TZx74l8f -z6X-ng=?SK~DU=}v`S$Jrs{B#Q&x$>bzH(OlZ;8&1Z&s`6?snWtndwoF1EJNv3PdZT43y^_J`!s2^ML0?p!)fxC%ROh7M>}L>ER(*1H -z0%d+=po+xT3$PA)=-Jh^Ju(EyoaNThzMO}w{)H4xlUc*sODf?xXr5eL(|H-Y))9Fz -z6SNo=SD@OTJ*~mPlm1?yqJO$(81_}0V-OPqXG6O^DB-9v`fKj90mK~2;zo?K#&>bw -zryZ6{qgCk#&SSj_bd}6}n|pr;KIuu#VFY>leseh(4Q5%x>B&J@80V@sDA=(QiN&s$ -zSpq3n)6m2a9EZNSn4&n)PfKCVjyGUrQSK`x?M$q?EIU^7<3T^BRTWc|xVC^whLFaD|zo=46E0eSuRTfV$NRbLyPHYF{2Q`h-8~R-7ENh7tXl%XGEkf!Zks= -zBa?OcRP#Tmim$+4EJs=*`0S1-Drck7`+A$o-@}D1^YzrYQok&{Dc8|m5)tySKU!gB -zIx)5OBP6pRR>;^ps$r&qEJp5qiLX@Vk4 -zFgoVd>|2Ybx*8TBD-|W}9mo^za0*b)jy-mNq57F{5|J&=`?HaZ-}u{hY!WMLDeA*m -zuivzi9kTZFTj^lxJ_#Uu_h*#gJ(R)sQ-0He=HQ1leS|PR<1I@ur3B9Y5V0JeDXBO$ -zX_VCI53<7%#gkqp1GXGo3!`WLFU6jLQ>)32M_r}OZR1_m1}>~p10Bb6m>=*T^YBX3 -z4RO%v;lzj|;s5Hs`CQ8+7$T8~ERS8oC`NG@S{m;c -z3J1Kd>p(|V-O{;~GNt(U)3kUPc9BsKrX~3IG)2Yg%2b5S=0rt$tjKnz0Th@-ti7q3 -z!m_4K)tbw#WPXSj}b+_DIjJ -z=zKH5O%awg`YEA-N)^eMd4B!2ZBfM!Bd9)lMO@|MEeGE+#u$AKP1XYw`H8+GaZ`Llo~fTMeRV&N9QR&VFh@Gj$i#_dupuc@Xz*yC<}DQvm6C<{6ADD&az0@KJ)g^j^S -zBHO-j4RQi@EslPS9sQ>ZY;;oXB4k%Sud}?t6LlA_L#9-1Jme<^d8%3&3h;D7C -z&w5c89qUhxJ##4m$-&#vAT=eHW>ibV5XwilxdWNbc#5Z1sHY=w+uY$!YwsFb_~(F3 -z>}^s~!2D4(%MM~3PC -z7NAYX3-CQGd8-d*Ykx1NbcNk>8r~^Q_`KF4wS-$1^h}dSyAC?_F*)m1B{l14;f3^o -zdC}KpIld@mKFp7g5yPrK0s;6-`8?wyu2$gciz8=Nf9@%jLZ$-%MC7AJrMw%VE{N>?OJ%si$UvEXqbcyroTaax -zN)Z4z}Xg!@m=#5)}W4!bKeETs_5tR?K#Jjf&6P4wA646*}}xF&IVQ^a%O8fc)I -z&6%H%An0mhbw_o35^92WvY@Q#tuAX1VR|faml#n`V=@9j`O9(3!PzN6w?rf7E-i?s -zz6>=TTt}ISV_1!WtJKwWz0>KuQ~N$nE>VMRZP4ZQnc3E3$&kv0Kl_)kRJ8Y?a*J1q -zSbW`_1m0IBu#p@ddB3F}ub-AczkG*5RhF%0b^MZsA}AkLyCBPu(`P$1TZa(zVYOUu -zYxXvuswG?LQTKL9iI7_LWV>z~SzKJ<%X;$xomWZX85Y92mXT?$2AzVyr&t$qfh -z$Z{z(y=5tFN{K_(WJvruWcPLOjOFxHRy?m$zT}{6c1?9%8Ss3 -z0#UNF>4}ArRGUt0QS@c?!20^bie7zM-!bSW#DIc;bmCMKt{k*;R9X|0j{?*9{S3-NAozX$$W+LBDKkef; -zSWOi1TK&P$qt#D*>WU-vqw|!rr_QL~=&QBuV?m2cgXHap>IYo^iU8(lW_WF -zDCK#RFJ6^(=RpKVX*JfG7foTy(C6K7LO_Tu3?4#)b`Rk!z -zF!W5IVl)c~Zcfl%U=vU`6sz37d_C7Xp4MtUJMFP*zLR{4vcm+LX}(~dg>z+o_&s8| -zRuRQ9?m*Ylt!}t~)mfgs)b1+iIG^U>xp_V`s)vIvn_t1dBClM)(_?x8q2u{j=xbnfyRaa1ny*g9tZd`CG~}OdCUiMe)9F8x4brSL>~)06UIE+WAg}c~__A(RiA{Ls -z)M4&2nm#~;{ivCVbEE2KO^6B+3KmM9!zyM6+#l%4{@J5y|9MU)LDrkG?dw$3iO;t!~08yptO9wpOFL=1j -z$($v!gNhI7eOU@S^1ez?Unp;y9!s@+Fd&C|7YWsVs_Fn5b)}#NGEy#b=);TH2aNRE -zCy84`8Fcd0C6(>upz&w#bhhwUpWlCjh-J*_6cTNw#7w2lf3;azsNzm-peL=sz?No^ -z)3_vOolAHxFd{_Gw)X_ANPwjRCF~qn5rpuue6|^JmMo7@apHG1?~B!5@F(uC#{sad -zEyEeMy4^nomO{VW@K!zwZiE0b_uVPq&fG9Bn3AhNup3|ziVfRdC!INQaBvEXX1iSY -z%UMH1SDqF&0;ruOCi1s$It2uGlK>Ac%8zlg(}~r -z*biwQC_^%RrJi(6vW|kfu$0s&>H+V$b=o%cD-j#Z^w)7!gmKmgow!Qrf#2+@0jFXn -zV%X`i5uGE_o?O0~1Snbo4wBU52MtodzetcwXNgkllufIoWw8Wm -zv{$)MA0Kj+m9T+CUFUc0*GKAuz?PU1POfWzd1N5C`M%*;@{Hn-(trD*WJT*plXKIK -zFt5#0p}m0-qb>r;GQ^4R1C8R9I^Iw$dOg5wAMK!O|8YcJjFLPv(aSU7;?%{&u9|WC -z;7=9*457 -zzc^zPb*XwqCZcyPN}VYqNe$7lFq~~t^@6=HNq+HJtNgpQM~rE_Zd<}gbwWNdSH9Ds -zBfbs`WBM=@vN{T2&M(>}oL$a4&lO-*(Sp2l)1gR17Sc -zw_Fg3o{p_5y9-1a-xBYQe+d3=&ExYW?V3K*?e2$CUL~P-J0PC$62410E^cj@RSc++ -z-eY9^JzF%vRyp4fcP%v|U`m=hSlt;9M$dFd#QESC8m=TViH}v5=h3@)MIo=b`ZaVo -zi4Rv-Qr(`Y6U|-u6TcxdsAelIy=nT@Y8eoal&-mDhwYbK#Lq8*34?~g2Ik9gGFhk20 -z_Zp)DNBxx%(_#j`A!%Bd-&(`QwX^b^!rW(H{Cha7&4HWi@!Dunl;>(h+u9#L!wtNf -zCrDnGe;82FPMPD{2uZ&y8H}-0&ZhCy+Y)fwDBS8ZZ -z@cd{ACM3org82-6t@pWg@q%_1dJ9X3LGAaia&|8$+VGcbQE1NJF4r#(2pEamF{jZu -zM^Z}KYlp;{a%na2mTc&VesF;wB*w5RVYNq~3(v>ALk#%?>56LaX|X+j0L;gq`xV9& -z7qJGc3%&DFz0wyckN>oe3Hw;J8weM}L@tSU87r%km>>>|;jTtsM2x_mKRIODghVg) -zrbqPG8ROGa<7?S%7%td&zZ4hDbU5=_W!R@Nxb>Pa^-rLvFUAX~s%&U90J#!qC^JZz -zkHZT1P#_>*g|{NWK?@WA&wQDvS%f_r{N-oWI9XlcYiO=P2))lot6n_jjlHOajqAYR -zU}2t8rGk4Xrqu%8UCvr+t|G%$IC)|O+{_hVZ?^T2Ad -zgZZDPb0-*mv;67y5QR==ONbw3Aao+=shs<45n49tiWwXs%@X`0s^e+y-#D4-r%{%j -zi@f1dO)1S%=X>w^IKC(kFE0->r$>KvI>r}!U+LjdC*m&`=?JE(B-U1%uuVsZyt{1T -zTRs98mTC(50_%erv0Mj;p#Q3f``ney@0R;X%}af1k-InNZ!@_D!#)-g+`ugmh;y`4 -zq9l_hB+hKY?1NxI!@4!0Jz?2i_WVP`Ka8-LpfLWml33t^*qOrO^IC8D`GbB=2abM_ -zGsE`8c9}!GgVVTfZByXuG{K;>DlT0?Vb3+Q*dt>fafW4usf3oEop?W{MS|w|fGWT) -zXB8!;OEZbu>SJ;YDR=H&JT#H}!ffaH4+ED`QQqSVRfKkufV8vjqrB2wXkVDdmeJ&P -zK|1S({UL|x)Bly21^en=5)~WhWT76C`zfw3HKAuSIZp1!esUa-O#?g{cRCKJ7)vz3 -zFEaZy#OyDva~QP#V*Zh>81l9IlJA^AXX8{a-!-c&PqmgxUnEUkz5o^0haLqSEsuGZ -zM-zzXUqfbs-IcCbH@&3D{gY_D>H7zfqp&d=+?_>+}~FYeloPS}U$efYxB*YyWF7afJ!Qs#tf -zUf9p0SC_0+NK~-b95woi~{d!nGbns|+=X`Py_la9MYwa}95wCj%t3Ay@ -zKU^JC3~^63e!6$hxk?(C^f%*Ppt*YN4<}`fB;IrfgD}q*hu1i -z=)m-F>Z8L8&dD^sCbXF8t05dr+Edm*4N+<#27q#=OIp6r=%KC4(>d;skl5C`dqP1R -zQ5~fb*12a}jp{O@(P1*a@Ar&H1+nx5w||OG<{N1+Nc2a^0;aoClu -z6dezb0F$moTtGuVLgIw~x+7Ts%!+$J<`6G77th~WwLIUGr~`XDV?!7HOkwOUif1B) -zl(YFs(Q=ElQ47F#H3`$||2p1@7dV8;g-~-<6CawgM=@q{=8_>Vmagi@SH+D)&R_w; -zo69Cx8!R&`3d+Ipo!GSgb&?oA5!F;ro~%n|mmI~f^E+7*|943Ba|skJ9UEmwlg$wyq5TAj|!@ML)D -zLA3=O9+(kIASrfr)#~4b$8w^ekAMrZL;dug3mhHks8i=3_j01JL-C+ff6ICO+>&M$ -z5Z?I5cy-ei&RyBHD_dIi?OF;#(>B!cOkZH=aeH-?hSGytyjwKKFXM_~_=&R}JCB;q -zTf-7Aurk?bal6J9%CL?@*(8E*RDc1wo^`i -zURR7`k486+ok3wg{q#Hgozc8u7S>}yF{`L&!>${K`Jfj`kZ15qO^Sv>MYHmWQi%7y -zl}ln5yDvoT+q=U~%=of#?G{m(59Jb1P~}j0H4uCRG%xMcGuKw`W={nYNG^FDl(*8X -z;Vo^jYc%nZR{JvgIcia2yFLheH_9b35vkaY9M^xdta_+4Gc2$g-pg+KA(JtHtb^Nm -zY(eZZn!pDer>7+f+X08gBDJ}n#Z5uJZY3R$?jGcA}*bzW@90i^L@LKXJEaQ -zQ?TI9MHionWdk++VO$nK -z-%6M|a3+7V)HGV9@e^?l@leu8&fkR6w*}n&Z(je+h#eei=>3{9k2oB0-n^18TS9$5!GgWwBqK>kz -z70WubaO}6&fx6+5dD`NJ;NCmC22bTq@Nrm%s7x-`J_Y&+3_h0fcU>VEb1{WdPfB?E -z7j#u78|Toh+8z4qKi|NZ)Uh)5umi}7k6Fjs8Pu`of}p-hOE>U}8RT24#K|G>-a2-%~r`oocS|02w4*Fm3ph;Aj{;`!qUXlvJ4vc&hKw`# -zR$b5#crZ3z@RIB)MLd*S_FZ)|l>U2vU*h#1*Hba(0k&6c1hdTc8p^ZQm~q2;`+H){ -zHPWvgli~lvY2ndem)}y`n50v*m412X)tAVi_(8R9f!2#vssox2E$m2=A0j}d> -zyNfE#H-}EOOtY-}CDrX9vJ&W#qIlBJ%+}F5SjJp#HcdJO;^8UeLwK$L7a2RWH1zW_ -zDP91#Jc?(9TE(2_ZEzrR7%uJ9CoOu-H9i1vJ52V$LEmFqdb|1nSp6>Z}^=}3glDyKa4>_KIZSU -z=5VOEpnos8R_l}1@MLBG`QYPbly;1i8ffa+gh8)&CSgVH2EezxV6A1YH1OuD$g~+pHtWH4x8&>1#foFS2BMdmt2p(bkV5fS -zh&&Xn|0~j!A7m8Z4@7%}$D=tfCI<-1algtfaN&1EdoyG%_>zkQDiY$+ycG&6>|}`z -z&keFt;|Qxlf#jBrS#$hIu_^Eh^-gCmv%_`X*GGPu*bB2;KP}MNMt46rY&3DFxUigA -zRU0fRyx$&kahEbT1CA;pcT{*F*rXwxzE_@Feui>2jd^Zw{ea0dtM(;p!?J2YbkXzB=MrsL!g&@Hl5}r -z*-IVkKW(J8F8K0x{Gj_Ofxp*YBvzT#zqOt-1W_vuG)nPCu#gRSMLj>%#jnaIDu12> -zt@duM)2gp2jzwB`Cfdz*Oe?<0&;ZdIy|<&PS#*@68U2T$$&0FeZ94S!_qwFiU8lPG -zDRm5xKIUU~XDGRo9b?=AL$L^TX}Yd!n8gBet<#piwXQBM1gsXlW+85EWceJ^E=50u5#bBnc2$mSBr&geEA;B -z)BBePj}yuOrmgM#bk@W9a1zBr)DNWN5U)!YR-(KeMy9s*d`xRmehyAc>o0AEUAA|J -ztlAW8nicj@OT!O01$BsgaIdi9&*h-F?79TTh*l$q2HWrHtm7I<@7i$u&0UjgR9+^# -z%^wqi$~g}=SQ@*_2#P@h6a`8jPZW7yq^nauEt2mheK}T~6HnD#ars6aj%O06E-7W0 -zBg-xbjy9`U{cl2;iZWO?uMCw6%=@*oCOa_)m!bfJdt4QH?uA@l*xa1jt<0l0uCAj* -zKgf1#r6Nzh+dnLX&BDJeaJB$xiw>?wr#9?wG_ifDS{!Cp#*N<||L?e4;JB!umb)wI -zvtY#vFUE=MR@O?yDPOPaEtO#J%Kn=&6QvdmHGna(Y=Ql@zpZV3jda5U^jwHkPfMM; -z7)7({|FYN@u_T|b3iS!=#8`kCuPtleXQy-dVL2NW^)?LG`k?K^0_av_H%#x`uBolX -zD^0MvX<2T~Pa64#XWlMYuKj{Nyo|5cqG+BeRGuO9-fx8L3S=pJo@ML>X7l#vG1o&d -zy^7#%x5Ih7AckuC0X>l`L7z98W}&!E?2wJCiV_>qYuZZ|Zqs6p-qjbDEuQF?JmP=a -zI;+&qRfxSB&)Z;!Nnrvu^sbvnIvs#K9e#ZrUuWwAJSZg5nJ<0+E>y?zkoT_M;jFqu -zv_~!$kpxkS^>7#Stk&V)rFwXTmkoiha>uDbZgRR)6Q@HTh>rK*W2yGlx7d -zn%-=s%0|98B8#OZzqH&4sN!>CWsbiA!VmDH(Q3fGKq3-QLqbZGITt3zDZiqx%$eO!(ZFj7&g+<7pDLV<3b_B -zMqDC=u6L8-!&i^HYy+#Nx^_<`+SaYRoHsKAscC8|P(Zhaj^`KnUPK@UC1G5B-bZ9+ -z9)M>Qz!TcWOXB76Ftiza&_fDaXsw{g`J$?ihtv5pG(z;{th7{1#)ck9iBebP*V3}? -zigOFOj;AB7GUaR -zd6zEFxAqu9wsSsrs&v$aF{X#YY%&rq4vkgTnKbRgB|JXIK3f@IFZ73S?W?~~ -zW&Mrhn-HP2I`|T)mjVHzwPPO!l^~ePbf9O%KRk)jSbGo_n{u3o+zVKqJU!c_Uk!`y -z<8uK}mgt5k1?2gmXI_#vPd`bRd4=*dX#t=BF}r&85Dw*I*-Q{u;|kc%nF+~}D7+|) -zv_Nj7+&1%4ZXO*S9M$Ca8bJj_T?MJ)Nvk6#*tUnt*|+C{+O -zd7OF@%COLy6_4+#R{Xei@V2MeI>;XhyJ~rRYi=Os7~1m+)t%;4)z#Ityb9hn${YQh-JeMd`!%zwM88??1V@D&a#kW{M_k3JghMp! -z)p5@+F1z;{eRN#K;5ZRYA|1ec`$$(!!O2xuB)3`6Q; -zi~4Oqh-CNFo|EH6_mh3egaahlU}nk){+A{vIOvQ->n6G?aOt>lD?yz84D;bZ4Fq%^ -z6*m()9HEsu1ZBEpVMx5R6RcG70`C( -zu+P#mY_vX$ocY~vRc*A;0rR@j2^q)_wTZoaYZO1N0db>WHA`-*nqqOJk1t9y67+c; -z*jNEqHVckfEiMsgPn-USVPRU4^pdhY6B*xL)y15HOi}T#_ER?n({Yy5Pe^K2x}G~n -zpxAd2=~L0qYV|5%@ZRd#Faep|W}19NCC51Xt-#6FpGkEc*t_j(+w2zlHG=_9zpcc? -z;&ws5I#C{P#<9Y3S4_#)=I6b2)3F~ljd}d!j`5e}k3Ssuo12GmiJ_6df&Oj{|=fjeAj7X|~~!Wcbauj_P@ -zLGI32PvV;BsW<$-tuDOnps-DTml7%zzyEIUw338Hh{Bh2L{SN?(=_ -z!OM1AMHtGXn8wiZJD)l?J0iHeS-zk)k-J*`esWrsu)3h3rpYFj03yXMML+ZTgOs33 -z6`k9x%BQ~S)|hN>t(Gcs;BXZMl|y?`=R&*B3~-^VwA2othgy3yN#Ndl<-ge|(-|eaa!g -zY2xyuzoJF7$u~GVu#zcePTh4}P~wUd^j^7FU*?>v-)G9cPl$!ch#b4Y3N(4)-mhQ? -z-;OVCZAH5@gE(UgGVBprb15xg77?UFvcnvn<>c>6AuI7~YF={N^xm~5XM0pO_gn#V -zu7iNL+?eW4Q{-ZGacAGr{BSA<9Y`g~l)>rWZtV7jlJ(S(fO<>F{F)n<=m5!1Wd45> -z_C{R9Hhzt;aCS({2yq^`c7kX{7u3(qGI*~MGJ$@+ebG3%#VABfPrQevB6UY)== -z=_mAU|4pUI#ryGSN5^tRF*FLulpY&dOKWUdG_-$7Y7waHonUg9a*@BHJ-3S<^E3Hg -z@_!Vag+r75+r?>=RHQ~JATb)GO926?Aq=T0H5lF9J(b4Mjl>=#N2d&s7Ni+nlaidY -z!0+ArN8Hzaeb05y=TL-g6ApA*L(t0h2NksbPI3v`uYysmM}NsRr2&%HVg-A)L -zobWRH!2mzfn7+=5MKO`np@i9?DwvkjT!ETlhz|9os5j2iYLEzLq9$~=3w}}MX -zq+8xXIGbz*N}D>Qj@1Bt{m%y-fdDG1W|n?60V;BRO+l|@YKCv_6WGa2+nG)`zhCgA -z?+Tsan$lpSN>2S=dg-_2x}#jH{BzXsScMlhC9JL`d=W@zY7|jnii@t52gyNC2}{2z -zmJv2Nz4^V!1x%ouCM=$x0S^#noHKhr+23ia9N{`G`RQ3Jc3bBl`DXa+ -z+@bbMgUsHWtR)ZqJPGh_Pz8SOMcukZdXDQGec5nFB{gB7)%7kDSC%F(?`J(-zus7q -z?K}S+d1L{hvmOppZ}a?>V<|(+YuvRLmt{PEPsw9=~e`CIoBefZkR;)_30 -zOxNEsR}iB@vi~FaIj+AcyHO~5Z3?+n43|OT>qG9q|2d9yc5Ei2_u8xZd(LxqTb}8&NB6YIrM7Sd%ZY1E8Q$MO>D5CVNVYSfK3Ncv -zi^vt;@w>PR3KJ>hSOu2(oZ1zqw^1v_J8q%t&fndZ8S6#Q|J$pMz*Rw;~=3up|f71U^m%&9HiS& -zlNYd6{Kw+8_u6x)U?5-^_FsCFBOGoR_QPIC9Dh^*1=!Yq+oA-%LwF56Upf)Sc^^)5 -z{;N&#f7@(JHksQY6%eNGQ4G&R3pV+i~*9hoLMcC9Pklj)?W&evi;i_ZBY6|Wg0AN2*Mk%g%Iv3js -zPVXn4c71m(G1IJSp3HSS8o+mIYiM&gJ+or=PKZt38-FztY?#>i<@o+xM{|F(vxSPi -z!E=e!j;_!cOAmi5dP%qGcgZdGQ4L9Ag?4%7mG>2Z)x) -zG*wke6BE(8=!~buHC<+*Jio9^Fm!u@Hu`BM5YAH^I$ -zwVbx0y}MuaX#*AqMZocCF(mu7LK#w1@$B++JtN?7G6}@@w6)fMy>q?Ny@Ii7eZ+A# -zk)QFAE@v~V<*q0#u}s&Iu!Sz?dsAXaWOKhHc|5%k5ev~>1db_ED~qmK(nN@@c(bq# -zmFsLSi#DgwQI2q{Ikh*+i4iI@S>K+?u+VYRIr4JS@&1^rBp3s7_c9FIGIafHiVIj+ -znYR#2z^K^Vq#DX_p*oA)K7V$b;5ZO%P2;4gIuQ~H&A-n{!2@eQiVF1Q>jA7dxN1$ya6 -zQxlqE?i`9)S;<;H9;$cS8^L0i{vy248A@uFYJ+R}?Ql62Q$|@7qEXz`;X5fnG8aY& -zLLvBG>F+bBrP<){*^5Ne5*76+^yIuDOCt(5tvMnjp#oIn}OIzgUb(W -z|8p>SV;3V}%4%J#E(mz038R-&f8I-SS=V0$rytJw4{SjOYzdBqTDwIRNWh!{N+`6<|gW5ll@3Pvw*+1wgIR)+*+w_d~{b3wF0U=_h8dgE9ws0&uguV9%+D -zI>5#;T(o#11`e7gd;3I8T3#x5SGY4qff}Gd6oxM#hE3K)`df)NFS26hh>4-a9qlq6 -zRQ0zkZzpSq0tWX*ddwcMNLds!C|E>`j@GGZB=yh(G1lseZ!tDVSi9P*$pdG)0YjX) -zPe5n5C&JoM)w26>U|~k#Z`~kB)R1)1{u6w)J=n^`LjPBhAOLDGt@QG2n>&yE&Df}Xtgt#(uGMsZimFS -zKOW_(c&4>@|AR;Sj-uYsGz3v;6LT5x{K5{l0A$1eIRw&8gDcS)v0ir%4nI&KP101| -zLl$9a!`c=ywqC<7o@AE|>WgQOyC)_CZT*@%1)1QTvfZN{CHHvJJC#Xa;Lt~2)m1Q_vT&QY{pUNXt+%zu8%D~ -z?)r;T(B}qD_n}9P3%|&8KRfytzfyA1UR6&#gJ(~j{1iA{>$VFSwe+9H@2xluIDug -z+UUO%uA#^v_(gy< -zxBg0=v2Y>x_YLhmn?hbKs0Q!WqOgZfzrKHGCODk~`|T0PST~L=gFFfH4Pm?Xz?2S; -zufEC^IQ!vQ>z%P-^CcFmMUt1#_eCxMo+{TVt< -zL4}yK0K!G^fuovg-2iB!YbGI|Z~xK6gm@c5->TmrJ5!D{?CrI97GrPigj0VG{wmW- -zCN*)A&*j^O7|;{R8S7~D4gSD>!}5D%P4+??dJU5^ -zv3P%JE?D0?UKSs6V*SM5@L5hkE??qMs?hSSq*%EkHTo|4CJtDvh;v#Nwm{P*IQ7xN -z7yCg=wtHLZc4<+imyG-YTM22sjP*;Hyt3<1vfR=?HY|wpzTrX_HrRAt&6Qj^?ov?h -z?vuNH;%LF2Nr*bU -zYEz`soW_EJ%_?gkV-CZ&Gg6+qnNAFeq9A6Du}*MVn{(%qRB^5c%eoc;m=1$$?R@F( -z?VQ$K>l@>H6aF#pntO$ky%1qc%&aXajvOcGw$ie%V@`ZkR27s+lq2gR`0PDgX5FTV -zOdx`}YY_j$ViCytZfZC*!5^#0>djfKZtW)dw$di$qxU!+)&+JHuSeE+w)}fwkg9x# -zPs9vVV&?Q6^FIQvyEl0uxB2r8Pv2faYbEye56TLYG0whG8mC8QT&Uc -z%Kne?f;P3-p$r0-dj+~vtz#xj=1ubN$>@2XU{I?=^$s9?iPngvuTqA8GU=kFm>fbU -z^II2dh|)jCi+|b<-9_qROVrH3+4z-Ka9!HmW8LhmKH)2y>Zq*#r!&v=Clrd%%m=F* -zpnlrAeu-w=T}mtD$O8(0Yx+4?R6>4Gob5?pv)`^$$chYkJ4Wzf$(JXdUpz<6-R2|#j9q{2c3;xM~BB3I4<{YKtU6R|VITPL&4x5YQo;5$^S#MbI)_si~Z|Q{m -z+!+WKxG3h(qgq>>*_O4p&|F6**TKT1S|>HpUC|~6P$Y%UJmgI%FjdpgwTmRC66?*D -zzW^wpxEokRJ&Sz;>f@)Mm$VKifU8HG_HXm$-!1o0#PG;jVGBxTXIz{!U2cbyl;&~t -zyE2hndv@zDQ4iluRm}YqT(fb+1333hQa4=WIYhE$4-7?zP8IM3hk$=h|J>2RUD_k?w02*#Gowzc(oxhR48QEgj$ERvkBEoNbm;XuP-O?)0XBjO -z0s)T`uK9o;;@=JM@fmyTVQWgq9mkV&kMaXvd1>#aA@_yO#r~Y}?nEPm@?|$gEYGw? -zJuKGirK@@2mnY0P?f@#&4r%;VcD$P5T=s1Bg{DRPaq$9=7EG=Kf*TLJy~_0 -z9~x^MRStEHRoUWgVe17mDI>wT+juREJK&r=6poj$NiwSGyf%M$En9xp7dO}s!fIBw -z2`+029jA&48{3pN`47wKQ)vqKe}A)lXl!FI{KIQFx8`-%&|)A}DgEL(UqD!-uI#kq -zG*T!(2;8%?Hs5&hY}VXXA1wvzgA2NJj5fNwMcmJf`hmtd_BwAJ2fn -zrx9i!)wgA+dE-JNkaYHNA=US^L19@timq{2%}a$QZmm3)TYS_u*`?i9>h@WRxA7$AQML<)3bzZi9?HtY@z3X|n8 -z$~O(qm(@Dpthr0{%`=PlPkdQU-!GgV{=pxO<+&^D)5~gn9rp|7*c$jZMiZCw51!=6 -zcT980XH;Z<^4p!_l-kdfj2+byeL<2BRZ>L#e*XZQDrkM)^lV<3wPSu?zk~64llWbt+;fg; -zkWW4vE`N~<`LT`nXk5hNLuHaY*=|noI*js6)^%~BR*tSRwZMJCSocI|KEidll8A-W -z@PeGM(}N$LK;A%!p|!swEsw1Vj)&}cEFD_mo(;{nM!MDJ5;RV>Fch~ke0zj$Cekve -z8KR_)fKDaP{Vbgdj)YJIDE#(zIGqW>+AWA~Yu_S1IeY%THgx>1id?*pl9he=Gsi+( -zM0>y|C(r`j8DMuUec;WvPd7CIZee>#68zp{5)aSoTPQbdT6YmQmWXN&p(HRClk^LV -zDn?Xd9f&n_j@-zn<1+$qhI&`AuCi?}uOsCP%ATLCpZ<)jo+)FZmeI+?{??Qcl^l34 -zb}xz9>Xuw0Qy_FdZi?B6r?5~PVQ^tUzj5c)kV<481zu~IF4NlzDAAOqn| -zu2S%~N_RiA7$%$}(uQ;QN$hSC2}Wg9AnuXSYX~zBa}1>`jv=j&z(y>WY%c*!CQ=0< -z@`1@OM9S-q@=Euq=3~OXUQ_?0uA8WO_Nj#$-@fz$Ag{K&-^IANaHRLLqM8gMvhEzV -zG6odc{Vnd=w7xw#AB5MUO7|VLfUo}y0`pD}DHT+X#zKe=iN=~`p6UCpGa=kCtQzj# -ze5y!`;-!DFjdo#rJ6xr`->RP3A)fJm@6jiu1}OE$8qpv0(@Q|&>)!3$BoeC)xgCBW -z4o$Fb_W=L*7t&uLzC%GEG{H%C8_z@+vsE)OqY0* -zmuE3X2xC4!>VP_Un#8{+dXj%4Flw4IUXUksOE|pHf;*x4gR!ir^_Kp4F3F+Z!1s#D -zI9Ig%a(!zm-fv|2+ZB>igo}lX^g|n8t_1*N0|HEeN7&nxTYst7|xUIfa*B6ccU<)BlU0hTM -zH+UZz9NppJGDVEeU~LpCoGJMAOj)ZLAa5hnno;pgCVbiWq>q;e(WFJ*aUbI@>Daw}IV`|C*ZVI6YWUAtG`I_=eYq^u5QY3P9Dsm7V?IWwwr__b4B} -z`<}Sfez=a~z~momg_IKJD`6yCk>fxnz6%;(+{?s~(l{A>5^WKYv>=gw_>aAHjIZoT -ztq0O}8auylY|HWvl$mnrp`|EeeO!v;!0lePGj)eNT)C85bpfqUB5po*>~i@!27Ss4>5FRbaX|bwZrLoc=}L7u~>5U<{%Pi4P6L%A2X$UFA6| -z7k&1ejoqQ+pzh^>eZT7QRgtfo>3!}d`WB;oAO3N?mglYK#!xdgmJbp1W4cZ#Cm -zbFY`PgkAq52%@|rbr({TNzsWWj-(mejHSjX#)+|Z#UhLj6HxJw4`2T@J`5)JAj%X1 -zzxWqP7KsIGxW&Fe3mK5!#7ZA9?9<55PwrNCHA}#v6Xw{16TaS!U!Nx#w*vwgM93_2 -zc5SjXgK6d-*bKz~syq4G0!6aFY2rEOEi3|e#p&P#f^tOlXQ5nG3$x`Xn-_c)(@j}0 -z(KGH$#_t!zNtOcXYZJD$@v#5)27W*PJX(1eZ*EX)th(%RYcvJf^Ia-q-2OAMJ-7e< -zP!l)U!vxe?a?@Q}7%VjK`qz3Drz>>;jjx8UMRM0Iv2C;A=ZsYM -zRP@P`)~OSjO+!;2z10@@Qn#wq!=wVCBC2Ef73uw+8m*1@ESyF%ahfqpI^U3q5+PHN -zT_okEDyrosYUMNg?2i4T7f%6R?E`KZ`+;Sk6L{QFV|Djyd;utV0>e2AK1&y4worcN -z!{nCq#iHt5_J-=X0J8M2&1+}y?uEOk=0=xB{cU?_#a|)zpm3ssn;cX!YUUZZmWXF4{zf;|3|Q*BO1A*A=>Ds^gY43gEH36_Cp=mTnGouwR(mj -znLJw?3MB!-K?e%L5@B$Z-w-rOl}w)yVr6uRuhLZ0*vPgsrNg8Cieo!;M@55Jm^3JS -z1j0SH$c|$GSO8>;=ZU$e7owH~IisdMW8#w(s5frH=ZX^^hhEQREoaQk2W2!TM>#*N -zdFlCXVtCQE#XYAqCkM_V{Fy^T&x;vc6-q{@K$UMz`=Im#uY@1h(CJuOj3OO>fmSW? -z;FnZ^Qf~)mKGMj|!OuCk0X+|4yd%}7;3pS#Vx7d$Bt|`^kB#i@gf()SFoc^qME}VVJz#-$$O% -zL9l1pq?>}@fLcXRp2y4yc-vf1LSuc`Z9bCq{IM<#1nU|DcW2Za^_E-D&FU~z@m}-t -z%D3<$uYi9V1=BvS(Sd&Y1*Y1bnUyXtvjCZmkH7!xYaIddw{`DORs))cPw2>2FV!-; -z7d^3B979K!06ox{Cq1=f?9>gf)t@0<@!HY)cs^6xAX&Z7Zhh;FR{?uUI+2;KsnRv^ -zLSl=2|650)2c0=4Aiy2zBk7ONScKhMZ -zwHQdTx`~1G(Jgl3e}aVVs$G3R!}G@-d`-{ohpKZ<`UBjbUjzc`-Rc=H8E^t$NU^yK -z2}>5eM|y8)ty$l|xVsM2(8NCUWItpf3?DOa0)h0C9i7xn-KnhAV~hYFc^}82{i$>T -z*`h^bpFPC_q+UVFxDvJK&!lP|?JL@_&v}<{hT_3|RIN?w((@95eyY;j^$Snb -zSjmUn3({`^-3ISFt=u-Grp{#i6SMNsN6Vn?sr;E07LnAwhP@Abnw9m=SEQM>&E?DA7wdLg2WKz3pY_2mA7?hYxav`K!LT -zF8tn+?1WMjKCPti$$qNpfEUoBkT9A)P2JuqzJ2=pK5Z6>Knj1GSb3;em8l=&zbx=z -z20J{_w2|z9Y1j7A#Ow2LQF6K>&sV2?7NuW48mPKfK_vN^y9t4NiTAHYf -zkFZhQR|n?~C(Dtc>fXwIz-Z=77mA}2d9B}O3B^W*gQq^aY;Gv_<2;=9lmM+=t@imd -z9vA;3zz)vd$6III9}4(elitK^8l;1vltz*t5~w8K7VC;pTUUuaXQ-R_nz>8=pra>c -zf|@xT<~|R~7dGCRE&fvO>#FM$b3_rLW$E<>LQt$fXA> -zZfoQX)4LA0%JkiMJcjP^Ub}AF{rPF~{6D!iIbIIFoR3;3>7;8jis8lV-O6I|Nohu0 -z8sM}gFW2m@Yo%31kB$6Juw~(RtJi9n7pwb>6V~W^v?gb)gbaa&8XD~oYxS_)c8~cZ -z1`PoK64?M<=&0uKqJ9R1h~={_PD^j1cJsf}?S7r&O_K6qT~bmD6{cU7W7lOM>tToE -z%bmS{#&_cW-gJN5KTB-xD7whO{9e8h7AZ%>%!l|5_s`$*PS4_xDv})U6@xkKWi+?C -zKmNQ4*+M4g{&I5{R{AO2=&aackznnbwdBe?C){8e?V4aE9G#fhJZ<`xDj$DYlxC&p -z#0VlQ`4ts|GCvwn>uQ1Jn4T?2se58a>E7Gl%ZRcki<=fs#IW%Gi -z{+)nEm4IQo`IZqPU+LCpF}}EMl;})gw -zm9>uO0RZnwdqROkSmc=HSlx4jn2hfdH-n3L@6-f?X&O&6Qpaxw4xeYX0i8g4%ektz -zx_sM?vENtRA^JM*Kkpul{+D)Lw($s5%h~wZLbsxvj@{l0X|m6?4NvMFfezk3tB!d; -zF?<|ZOp`VA2LD*ojFGgQ`D(lQXV*}WxR)J2jxeU11MvgDxqM%Lk47Z@3^*|4(M3gO -zDpKU&9{&bTxE;J6fRNkarNjRbFn=#+rm;5eF%xqbuB7mbU0?kq0Z%ite!Y3ARuPI< -z>?8t7qZ4~px<0y=Kqt8TgIRi-CsS+D&CX;?8g=GGe$JGRxpf}^?R2}W0D5q7Nrkam -zD~02#-m=@g;Ve4L35oq}UQiU2MH?8*E()H=o$Yg7-wFEO2r{4F=fNr~I{$)r7X)>D -z395Z=Cv|+FCZegK=mZK*_42Bd^ZMZ)k~c5h&MS<6hKM5Q76x`1DXE!tDyPLVg^HnF~ -za_ugWtgNKowV!Ymmv(HY*rrcA5BQPD(*(iuq+^PWHjZQ9vf-H*)dbu7C%a=x6 -zF#fz|sCUu`w}uR{4i>SFeF`LwP$caXmwkjI-a-F2A0aKQD5#1Vn_}vH{Dw)#6M{Ca -zm5!05ywfFi9V&OPSzpM-jLKjir%!8w;!1M$C-$dIQ2S?-Y%4*6{_DFjd%<}V3zKg; -zpKA4Gx_H`2|G{th2ZDx^L&!m5P4N9MH5wl`n$}U)>`|&6^MXF$ozA$K&SG^Zc0Rb? -z-LTtA7^Jqws@4$&fRvJ;XS?wFPKzU?nm -zR{8tkVPGjB>X(6}-uOXgKuvH-rid%v8TXRtvhx!b?X`SSnj^J7*RMasc+AM#uXjt> -z=^}ib26g=`1y|Kh`YcfYqNi_^p88*<}Y72@0Qn(A)+K0a9mzAN(w`2Q4%tT&@9ek3c37_DTPsf+{|HVOo!Y#dxhv -zK-O)%0_3(w_7!wv%HV;WZSrEV7GEzFU}5W+4Re)tiu8xRFnw>=#`+Yay%fVT6;Nuk -z#q3NvspL=v6*8=6!KW*IK>#=twkQ}}w=5f5CC4k1RyE=qF -zF8UwA{8J)i93Eyd8X|!(e((NGXX|I+u<=Hv`b`&4S*5e1J;~!O`^2r0tuRowzcg?i -zctlAW&#JjR%8L;sj1asxU0PyL&=vp2OzI}RNrlRN2vOcBaC8!)xvHranG8^FqiJ8lfKZmcEUmhVbzh3pEPy -zrDaoZ#}aB&r1b(AtJrJpkUDFHf{PB;-?C -zP}k$c@bFas5}|NW;1_+e?jpPTBhoMbXg`I>E9vso7JUofj>DdcR7=j2ca>C~**Pv^ -zcdiOwHQC%GGT=2k!Asejf&wp{(Lu%Ao!kDaHU)Q>MZr7FYtTg4r&H;piPbY(l5b=0 -zhWr-A5sm<`cx1*CmZN?OpM){CkH3mUes<{+G2{}$(;J;jfW#5ZNHO}tloLifUKA8K -ztb{3UaFMi=MvRs~s{4^CSUeODru!5ulxt=C#})tWJ?QGQU^X2R?~h|6qwg{8Q(Y-4 -zj>_lE=&d?TDKq1EbUHXAlL{_w<)F(Kgbup6ftdN5>r>LzoBLkBxk>0u`wSjj_Sqlq -zzhYP5pvxPc>lLDEUUpZXoQY=ReD}P!1>@*vkkn_fDMYFm(=HK`P(Y%`i74%BWxO3P?46ZX?vfva$(H|LW2oAi>l -zzZ=cIzBE^jw2T)Hzdi;qG>YQk2X8Z|bJV0`+bw!c+47ZQ7O+f0Uffx%9YcvXPnxty -zM-YtQFf>Z^NPE_nT<~!$%H7KcCl$Al(yV)$U!xbn%qk7K?XP>Po6JY4S?J|mtaa$6&#dhJz)s0gmxwcExTd5X5_P>zV^mb+E -zs2q6FIn9>nU#F6<(K#b|H~TA~hrm!JA7V5({zprY=jcb{@Xgaf=7zreEcD{tL0@6RM|! -zjtAJ*lBX9ye4)&2oo0!~T@UhrCCnc%B`m%97&-Bn5o3w;1?ExCx`TEzU0?@SnXZ5Z -zasA#TK;c4OveZ+<&jjSq%@|Z+7e6_jK_=ITw0~_|$k#HMv6V4KlD_u5v_)w3{$bNO -zv{9w%C6_jjc}4JN-Yx*EvNIIy?D=%rQSgFc&VZtkI3@<@uxc#F`?qDWU9 -zjdpbiIm&r=J2_Sosh}hb06QK`?(Fyd-XB-w_4YMA0_m^2DI5_IE%QGG|B8QlDZxM` -zuI_S2X8K6*h#hqZc;@0<1W$-+Bk~y=-b<5tz=h)h@%=`=Vr4)3=t}Z3IhA83U0l#O0B-q& -zwlBQQ&%=I2!M&A?)QT@>*Ba5J3nnubQwK$#F@NnMB8~Qd(f=VdQ!P5aeDN?L!D^x` -zqF4>84Q7VGKnVk4Ef*9irm7M3P_ebU*wFq<3NuNOgu>K}*L77?bbJ0bstB -zT?yZP0jTC*>Ic@vF+Y+cH;)Em6#eYDQIhiEUa9iFM-n3=k8O+JXp3VVj(+H*Aa~`R -z)R&3|V&aQa?0}h^dhu+e3e1uMYC;rtDhr@yYfwrm#<}s)1adE;I)=jO;*A0|v+S#=4DByaZkZL_L)4#EH@f=WJ%L-4!8j)0 -zof)0)4+~^!cijlPvdB^sC}sSMq~)J@Vp(4^x_9f6*BNv( -z(C3DMc7}$BHV0Eu6QbT0n;kZIeqcM@$$>NPNlfEuZdqPXd_67E5{^eP(S>>nZzXk6 -zdu5Y-L|G18_v#78il%X8V!*HNekT5oj-y9os3_^juwwLz9~pfeL&wKB+{qc^6(lps -z+oslN-p}jf4hx@k6M`}}+m({t{9GQap|Z*&v9wlm1k~{?r>ZUMtQ3Q;6O2m$F$;p; -zoUrY`kxm~qFtG~Oro`a~q!E$RKJ?cpH=JF{VM03OK})n*Gf{pFc=_ -z{DDQ}g58B{ur+|0+F7O*i~>``4R=S$Fb`*=?n_=t3=G`;bYXQ_VrBz`MJ_#H`;Qut -z7SrZnix~<2N>{M$RsC73Iq){SHi?tZ3OhCpv*)Vrqkm~&xlH`5+gkO2)iPCgKH)&b -zkg}B058Y!00T8-~7N>yEspEaE+NB4zfgXl*hc|AjYpEqd)Jf)|&K)|27F;boZjM|;>ag)-bnw;WSf3;)LF%_}C1GNJw5Gn%<8 -z;-c6PYuWZ;WwAYKnU(kvreJR4n7${R0gRU?I!>?d#*WEzZ}9~PL?Rk$z2F}K8{%9o0QwkYk~D|p`~{sN*1`2a5mezL -zX(ros%_3CFn{15}a1JNLpQMFMCv9E>F+b#?e8!*w(3N$XWN0rBe6KDNQM6W6fiYI2 -zEIyKo|NqRIT7VS_pZ;WmDvBB2WUF)l*`)!(uBjRWZ(XWm{k2DC=rk3?Gz!Hu0$=2cD6li{u(?}5 -zEuIvXe{J_9XUpbl=E`PuOUwF1*lTEw0===mfSqq`-UX|msRPKp33lfwm#L>14qTIB -z#GRL4U#91+m~)Wyyu-uLkV1j<&rl53K- -znQdLh@%boT*e<=pZr5}|Etf5MJHxFkHaT8(1~C3fX;EFnd??U(d`*?r%sWPi;|6q6 -z@F+%LTHb$*G%vsXtWSvYYX~Gy^$Wyn90A0SCaSFr@+q<8uG93xN7QZfwoYp^7Q|MB -zQ5bLsdEwE6b|0Y^NR|8?P@RXPcJ{*8gNvZ|d2NH{{)o4!0m19Gzr0yDM$0>uB4Jw- -zOogvpey)-RqK%E$L*gdCp$nZ#Nd>=CwT(seg%u|~IVYX^PO5i8CN+hxEf1we%UW6M -zw6J~z5Cz~|XT2Ed7fmHUMB3bDLuaO%6W#Mjn7;R}SROEcVBcD%v{H9t=yGGUH+Fw! -zDlsTWHmD}*#qwp~H>6LliKm;7Pul!ruPdK|q<#Ld){y`r>|=bOVtctVyVgoVVPV@Z -zKzc%TpuG4mTa@}G#dxoVHtHtP*T>jQt3*f)nfHM02p(Aiv=9*UWvXE`{VKeu -zJc7E7W{!qRXaRwy%D9b_mrtjCI4`M*&sYfn;X#z~-&vXqNw@y1Tw_+;1-0E|z?&4i -zl6B(Ke`V0r94RW3cI)u5zh3e$RI`9o<$qXu4)x~FM+c=@B{^4u(_l0Y>^+W9cRsgR^(2Bq -zhcqI0zeHF4a1@45>A!^^BOjx3sRmBei^6bpxk2q;MHeRO?Ng -zQ_Uxa3P%y;hpJUyw`&E7apLn?Hy;eTwlep0{w9$&Z-b@@z$N{@v?F`s#&)yN5e$qk(VVivAB2Vr6mhsBW#T -zGh%pEuUP_%S3Yf!I>TwGW+E1ujIpo?Gu`2J&Jv-M$I|$>KQSBT=EXsd?Hm|D_Td9O -z&ys1vJQVW9bjIXd)-Bm`v+lZ!Bjc;(2<{ixNkBgADQ(W5*}u0dolG4MuPI<}C^=1K -zFPh<35@>1|FoEPhL8#b(QB-{_9`d>}aB`=01puKyqdt2yE#HP~rj(1rN -zRW;dSf3{YziSTwxhpwjq{d_&-OO2h7__M3f7)s+ -znQ0(;TF*&;=UlRy^RJ_i7<(lg-lulP!|J4CJ0*NjXb3uS{@IBmVd?WPeqzu24Y~QP -zQ!~=@MT~eA5v|%a(yhp^`FV&br<0(D#FT5G9+AOpz5qi(qB$WvJ&y@ -zSJEI1&{i%3@TsgY!%*5xu&O -z%}GoJQwDzmmbeKUN*$4%083#%y8lr!plAtQFd0l~!W*9g=s -zgmylLJpCP}E&3a?GnGNfyL-c-*uv)LSjB9z?_5J_nKSs1?CS0nYFzJMc4O^Oxf|iK -z?L9gyf?cL&dx21%$WLTYqccEy-RxmA3n2o{^h_hVWL3|U@jzO71ZXn`$yNj?zN8XT -z2xj&0^s_^d#^f=#>v0rNXnrJ87uE(H@bRj6X}u+n^MQ^OI)8n!#(l|F3Fi2&ah+!Fg=m@% -z&TZYf&crJ9-M%`s>?Szw<6he*udqO0Rf|KmDb9tGe=>Dl^91UNo9#dGUe_5sC-?jn -zD6IHn9^aZx*g=jGPJoBudtpo!vwDFoRx(ucT9H|Ekt@ztfZXI=*TV?G8CDoEMmP@b -z2(antNw9Vrtb6(l)^Wdi80!s+r6#^0%&ByrczEPoNkB3@G2(mwqqxf~e(- -zD^2zdoXnTE5=MZN3m*mi$<=&L1kY`^Dx8{W{ZZ2|7J_wq0<2LgsA-}WnH19w=HZE2 -zN -zgTJhUg(#7YhNuFWQe?4Vrk}Z1kuOcW1IU#_YJ}dED4Sg~k$zGteu0dT@By7y*XK%g> -zbNjp2CmqroP{7N7^v-&L4;);ESJy2JqTcyJ|0+MN>J(HY-fj0?K~^&T)X!h&_8$MI -z8b;ME9L}eyfB&Dre_Uh=3K$$a?0qbu!kL&I)bh7Pa2!L-6k4ZP-{UhHd?^Nyr}ZW3 -zfmwqRtxPQ^=3&lACjmVgJZ`}b;kmGo52K^BLUS&Qt(t~pI6&j|#;A`D<4~sNGPrx@4@;`HU(GSK> -zrG|M)?F>utxWPe7EQWh(d=QEP0OC7weFYO1_{sT(>I0jUYPs8o7)j@H=YP>J4bJ8? -z3RJJyC4C%KkLFa$sPco%1D2pA$<%FsM^(y@ZIcfK!rO{E-i2+rf)!AMARSkUviKoz -z&D+m4rr`B(^~vcX5y4Kasp)RPr}3trsiwqVZa#L{R0s7f0m-$&M?3FKi%XlI6w -z1{M`Je8$OQv&8{CG`7lb5-n6N*k8o)!jJnKvj#2f^Ei{eba^^5y1KL8%fv@hh{uu@ -znOjk2sg~opVoVDPa+Xd~(vuAA>;#P~F1xw`&3>c{4DT!;job*EbulteU{-@LQP1>B -zg1tBC(Zdhgm#f%O8v-XjFG;=*s&PWKrsU2g7VI19pSZe2gs|a!wD3j0rMHi2I<*ts -z5`>Smv{-|OnjgzCX6JUCF}ScA_5Y>_WTslcnA9~+R8QGlLrp7})zIz?HW>37b^l$? -zEg4mKBqR>zbs|W4|2~d?pquD`vByf1DL9egaMw -zev8_57*EeM?CB|yZ>ZHa&OY|=3h=UzYl;Y4Kk7FoNN4}IsJ4>)Do~1O|B`Hg%2dXx -z`Vyw^>1W-&JUX%38#k~#7QfE|vwolTaDBLCIBVXbT>F5*5~}V7Fm;N`ClVH|sO!>5 -zYqyn|fh;e<#cTJUXE*c6xxa20ee0R4Z|Ku3$0vA`K9jMdm=m&o@_!YbdpuMBAIHbq -zTsCxZ+1w%__sunTQMwpn<&sO&Smc`P+;UejBzGdd3(0LRx#Tu{TZBxcVL}Z{ZY`Hm -z`u@)E-}A@WIiJTlXXm`%&-e2c`Ag5O@Rk^m4w66cOW@U6-J1B)BpDQY%`qnRdk;*^ -zgBPHH3-i6wmok(>qxr*F=RbHA@pQJ{`=YofN*8FG0F<>x3Cep~xH<0#OEBYYH!?*F -zA)3%e-xSCzY6_^ElM)BYHmUn)eA9kiQZ8*}ms)HIlna>^7W?(~+>2v8j{J4yeM^#bZ -zsl)I+5ncaO@Wr*mfu@*v6Qa2A+q@K*w53&0LcXe!7a)v3)x%>=2YS37SNa$dzl#U? -zabb<^mMG3T%Hh52N1NR)$6t1xfq|lq-xmdF$T^&>Nt+npO~=(% -ziAwN?4V~!E_oFJ1#kXPu%3Ly;(c%~0U<5u$!3h4cLwtfGsAN44$c?!&CIGDXwy -zSRuj<(_js< -z5b=Wo<=37;F$d+ajt>@BunI}6^O`HPlxlH9KH@*=?PAT7GeyCn -zQn`Dc`z-fm3yV0gnUP#hwH2l;*T1y*2GO8nd+w=GYpj%!9r4A^alYGh&xkKNlHu!P -zONraikMR*g&1?trrXe_CBB#Enp~tC9oHVN$fg6D`ivfrLBhqVq3jp)Gi(Z*`UR49! -zH7@20&m|5a6mbhTMooY(Q>@p_2fA(Z2TEla7n?0TSm5%zDy1RSJKwQ8lqbC`l$QNDAvJKXct@{`u -zSzC~Ei=X;vC>BEsPJ6wTU7_kOSAFS;yR@aPG+7pJ8mz^r?anS6-{Wcuu_ajASF&37 -zJY5EdB})tQC`d}|EpgS}Wxly2b&44~)SSB`0F=5e5GZYKYp&fnBNpmck0#is6)8KA|$`5p5&o++yP -z6btXaRg6-v=NYOJbzR+*5X-rh&_ti<;!uCw`lVe@uD;Lql2x4_4j5xNW1H4b4b($Ku!O{CGpJl!MWLv%7r$#`4Pyva|- -zb35uLxZvlj?4B=8D_FzcV1G=cmGLQe`l&^|h6U9{@}##L2K}e; -z?|+~R2a!K(ax_I^Q>{YYlr*%7E9WetQ}R+X4)Wh*vaE6+K0gqUQrI&H-O=lx5PV8s -zAFO&QF)WuUuE8Ykti~8b^{pFetNHI5-euFf8+dotRjL})q|+vl-lZqVwx7F~C!@G_ -zrpin$-v3fUde{A3`VYhd{@gvj)C2h|MgDLD9j-zjk&n`{39KFdB@iU{zSh`r@^OLf -zrInFqO_$&PFcjAbWQUJb*M?f&&>^1XEHybld2W}lFV$ZMyJpeuK2>n5?2BT8eSbcj -z$0moP$F1u0#avoWxlYqpl2lT$1n;c)XTF=i_!4?YJW^?@-qdV^n)X!AO$bK5KxzuN -z?eJRDuAKM@cX~)l#3BvM>mY{k3UYN8-u)-@7_rKK8);Q33Ji@5eSO0YW79aHcfYhY -zzq)yaPa*W{3rzkKp8$t(+bpSzqKrusF-@Wrmy>&7QL=KllTJ;4#00#}}3Dt&A+ -z*^=EHM0o=g-&>u(&!%dJ0g*ZOVMCihX=Bd+L#jSltXvwC|XYGbRp -zkWKv1iOVx%wQy7TTCJjd_(h`#VcOS~wSmm==7>9A`$E#~u9xYli#Mz*yLJs-qwsWb -z(bxtTWSh=}ui4kxagN=^sD!!%1e?^V`35 -zC$T~Oo_WxHuCjGenSpJAfiu+^Vcre|j-aZA<*Q@!0<>SpUI}l5aE|3wupy(A#hYxU -z*?q2rm+4K3Dg*`$B&rp9JNXP*jw@hb56qy!7UE;gfpNZ<{)329m -zl2R`J^Jr@O-CuQo`Jkv{rRCKbnND{moYsiO7=17E&oArJiFZ=$B|5r?>e?Vh6LoV0 -z&37x#y0kg%;G@yvUvV;?-xy=7^lRT284dyu7Rp_m#X40KmA+F8^r6Xl -zA*W_NZkki-8l=72bIiYuN9858x}YpV(ef-Hg4x#twVX24a?yJd-|t~NoF5ZU!zS7AC -zD0a5dx?x-UIwhh0nMI~ppx4bmd%{i5e-jK7AHxwmoSe#mejBcww|zBUEh8M~-#QJ0 -zEKYMxIvHnlHiq!7%CvBK;YLT+2-GHAg*8utOVt2Ris -zC{ST3-a;i_H$a@i@6Bb2E=q|mYC$H1cyRUp)A9-K<^<3BCvxCLBBkdXksr?G`jdZE -zh958Nz}*S?iJ}YU)v}Z-PU##ZYX>L^RZ1@Kmb#yty7Q-0{a*k@ZTF5OXs*VZ|Nee- -zP3In=Ho7v|n%nd(019w4->wEYu6)hGT1%xmyZm3W=7l!9>L}xy>u%WP}Q62_&O8u6%R-s7`=Kz@z{&S!elbt&l0MD3v`=wdo<@Ci2v+n<=F#aF<|y88s|)X|5F;H)h=YJ -zo2>r!tIzz;lU5d;e&OEitHdbZ9IxSL+N~N%wYKJM8Upe=Y61qmLcZyhk0bAT4d1y+ -zS8jbyT-41g{rMf^x<@BnbK$@I3(yx8>Z;VhR*IBcJ)gTo4q!Z!b -zpSHzMukya1{%ejBJ? -z*@TQ-d}$;-GSMp-Yc250=$(6kd+FKW?gDWRzoCxyy*Ea!O#d>Q7)LP&eZOoFNs3h_XW?` -zS#tqTe>EVH<5n?ru^0R@?O&tYEkn(r$6_JcYIMw=2+W$BdYf`qv{($K>TW*w)V8Ebh9j0gtF=4XHNjbbPT#;9L{te8UQcHBx%_Y4Z -zw9nrOQG(d2m)Vf?{nXwBFxEa7e*ds{)`8reC3U5xU9dtWslCJa&8ZJBFG2Au=>Q|6>dUO3D(rK|eJ?~PP2`KoU`7@E#O|~B3NN%c>2CWGp)(EHIliKV -zLqB2vmb;cHjUfM4nPAq(gm8)=Fm*NjJDw(5Kbm3Y+JgEb__E?vax0{Ke=7y5E7z2hmcLCMz)zInuLRKQQW{esA6gz -zwQd@^E-(}CeQ<;X+2PwkucYlF%=V8|p+qrfk;;^`GShNwgWqdS{#(^w7{rEuS5;5j -zTPJi)lO&gS&W4@dRbcJoeSLd;+((jS`^QHXqVMjC3`#|kr3x=_21Po@1PvQyoiGxf -zXXJ%}8EZ`<6|Wg8ybg6jRMj7vm+}{4XtwZ)9qNn1Kw-2s6;@8tMAZRn%jFg>N*>Q&rwZVy3nmV#6VR_{Ox=%=A3Tgn*m|JTV+x0XIeK0kEQMJp6E(Rgxdcy?PkE{~=3 -zVL28IwzT=S4+OKcX$l{j^Eh79RG?_ag$PfbZv9;sI!OCGqe1!fq_|jO@yiD~bGPgI -zv8neq?*s$NoZ2LdiOng;=VG(094|(nt*$Oe>Rl*-GecL;mNNX*!$1uWdW9 -z$NWT6C^(-BB#8u7bTs3A!4*aKr5R11Lz;C4Wn%Img)h31E2I3aoAe==82zAh9U!vc -zhU!^j{jq987P_H6n#_B5BBR3C&oZBTMC!K|R5LrjeIFN;?Eavh11>D+IPuS%0%@7h -zb-?FgU+Eej>d7A7R6884yh5S@hPCeQCZN)YC4`Qc^1mxWlQk<$7kggJLQU -zhdP5bkJk)Uaed&ua8;(KPRvXT?7R5!{_jM#-K4uN4;ya;vcQ8wK%TfLrwf5Wi0}d7 -zfi6&gEo8Po$9v#G?74X-p(*GI#a+D+^VT11uW^L}Yx4erEVkd|Tsq6AG@&y0Z|bi? -zIfBGzhYgpNKC_t7AZrvVVtNDH^+?Hsqs9`|2x9*+O6pR@!rCV4CdLv_Wd9Oh-ma+R -zIjA!weWN1~S^l61A;hFIkH9_+5OD4*WO)YyUfmpwIs#fMxwI@1i$*W4O$3N9j$jn_%s9L-46f|R8C -z(~nn#j{z!D#s5I6A3FqOBE+e9m;!Vx_MbFOEfx(0=@1>AsT-x*s>%>4S^!pzf?9I$ -zAZRQP<*FE$NvaXed4x3r{lWG~vUKo&)b0W?#As1@Cs@bQ%Z`iRpnRQ<)9#jCdD-<@ -zY{$ULMm^+NrgdyYy~Z&hFr;41*@d_*@BDgXd|^Lm_jhfk_>T)lJa@6%`lA36%Khd! -zhGs>>G!}~(Sg4X5E(J1O8ZdxVV{lLem7#)+qX}=oR(AxFU!9!dyGqn#jrv+zvB56l -zP*SI{X-b&eM66NSf1r`ux!rBLPo9WB4xMa$*HBWn9gJE1et3MGugoCYJ`2A=unLzF -zxU^f$fA=qOslxruq}v^@tfE+8#K5E`gYSAGwZ!ju^TXszoGp*sM!IYT<0CPe%an`P -z+t-9lz(jMBxV8rOZi+bbTDuT)Y1VI1t>KhY4r@EE|u1VEw72x;-_K{l7>k% -zr|Z7Vv-_fF;la1q!*L9(h=%>VNzRA7fKD$IZ8Z$$m-DvA$f4}XOTt&ROjvICSS59rZS)rWa -z^+N1mn5F-jG6Cen=#(qjWbuaoKtN;V)X+q9d1^)=8_^4~`F;SWJeN1#^i;iZNkwc? -z-gHWZpz1~{gJV_8wU5x!`+IUGpSsvg4Axin3SF;VNGfr(*~)phx|DBl_Q&L#sSIa@ -zTKdMv$pxO%wOpIi-nCk8gT&!sm7_Xvay^TwX+dOt|4kOThs3NG5lSAV;uAd;$G -zK~DXapurX%^&QrIeTByGv6`3YGPzuRx&1(*OJ>gJ{A7RQ<|*9f7hry;@&Gma&)w3ZD>>Z~ -z_)5d?xiBD`d+MpGUSCC3FGTJ77Q~pm_aRj$i=cG<1DURiAzR7W` -zg1#@Xw6Bt{WAV-0zY=k?so`UJ<~^=JeU#6Ix8-_k$-N+tiAJI9fU%+W&J3BJWJ;Uj -zBWb;`gv3#>4~YU+#2vl9rcm`B*?o|%ey*U<`}0Sq+miWzSHl}rKTol?f31}M@$8O* -zTq>o%^-*X)tJ|ArZ=uxvY^dgjhyCD=?rm#?=S`c_R2!f{h#JAXXuuP^gD+LRnIIC+5Va$X5zwSTY0R`49!e@LGD@TPqP!PH5UK%-`Z%cW -zOi2rZ#?TyYsH0g0ZIomT5^-0uGukAEuox^drCSTEzNMfgKz4#R6C|kWooLbkSe~Fe -z^LzyML8AB-unwpq<9^l$XNp#!hv-;-yc~EZN68eV_7>_{d3nyUF -zwF0Y*Yulp+;_p`4&2(v^;Ct}WBwu0ABeN~g{&<*^TCndR3yO1*2tg`CXC6c6pxbAl -zut+Wv9(7_@r;&2xHeD4G;zu({Goo=k_t2>%@7FzfnPe%IkUYfeF!TV+W#y}yO~d5X -zYu!(#SwEg)5u6s*$m1>LRvMn|z>PnlP#PHh6c>W<`AP!tAsSpo -zF&a+7gH-`_esvnKa~0_3b$2)}7YnQq!JVvli6+iHfAYF|fn$%6@yFcg<95^c$0py# -z5Ybr?>!X{oOy{U+rt9R5w+cm#Q#50~ug7c>@dEtAd#ON%EkbpK?{YXU4R1?SuF%rCGct$9%?VHLA^DN!Q~G^a5TOP#skHD -zCaLJOK+)vffbTg7r1hBgch{&{;_avP)s9JsZG$>|S88X;Wr}(n9`XHN07F+KU=*k2 -zG(-a!RQEmKK}!^!^fXE7I*X?J+D$+9-8|1*bmpc|K)^+ZCrR^ZEr{LKY8kyp3V1}Q -z(ksr9Uucr}$#OVew@3rG-h;vGCVmPQoi`@oLGJJ(65gi`O(IOXMHj`gXi7^JYRS4)TE`O>z3CF7|q)J1jEIe-}5>OiCH|ouUw*|>v -zjh!Uop;gO6X#@%{ZS_JZBw|rHt^(M(zQYNpBh_6uJ4w(9Ah58@6+zWjA?}MMA&To) -zPgQpjP~zYwjEB;a3r`LL>ibL?os5{4W6{usj>9CSG`cG7C|$YV2^}xnMDnoYku3UM -zNJC@r{HWeVVB26hf?5?n7784fUXB~^!9=j1 -zoq(*H#zTsXfm^qzUVMUt^Y0uAgrbXp3nMY*Ct(v!G6+}#7AeI*hl59!1aMcn6w>_p -ziA=sl8j7D_iHBm9CQlK -L4~l}C{x|bKRFD`n - -literal 0 -HcmV?d00001 - -diff --git a/kodi-addon/plugin.program.ts_calibrate/resources/media/crosshair.png b/kodi-addon/plugin.program.ts_calibrate/resources/media/crosshair.png -new file mode 100644 -index 0000000000000000000000000000000000000000..779f142538af3eec5795f394a7edd93745f20908 -GIT binary patch -literal 168 -zcmeAS@N?(olHy`uVBq!ia0vp^;vmey1|%P7U0DF6@;zM~Ln`JZCrIc#_zwi0f#;c$ -zb9Vpz&$y{&y4GT*jco!~y4NvCD;#@z;+cWqbF)tjzP#$36QmY8n@6zu&zQ_5At}+( -zt>Fd)60<|TGV{AlRx0IHUlyXm#?v1(k#%PC8&$6?rA-VgU(Q*^z_8(qrOl(N`W-;4 -O89ZJ6T-G@yGywqWAv!Yv - -literal 0 -HcmV?d00001 - -diff --git a/kodi-addon/plugin.program.ts_calibrate/resources/settings.xml b/kodi-addon/plugin.program.ts_calibrate/resources/settings.xml -new file mode 100644 -index 0000000..eac73fe ---- /dev/null -+++ b/kodi-addon/plugin.program.ts_calibrate/resources/settings.xml -@@ -0,0 +1,7 @@ -+ -+ -+ -+ -+ -+ -+ - From b64b63ac2fc791cad6e79cf9236c47b928960c2e Mon Sep 17 00:00:00 2001 From: vpeter4 Date: Sat, 4 Jul 2015 13:46:56 +0200 diff --git a/packages/addons/addon-depends/tvh-dtv-scan-tables/package.mk b/packages/addons/addon-depends/tvh-dtv-scan-tables/package.mk new file mode 100644 index 0000000000..55ff74c5f2 --- /dev/null +++ b/packages/addons/addon-depends/tvh-dtv-scan-tables/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="tvh-dtv-scan-tables" +PKG_VERSION="68f86b42272fc364cdd53d7cfeaa2a78d676dbfa" +PKG_SHA256="2bb102094696bbaf440b9319a9e8a4c93e2ecbcf2d2c556fb719b1febf1a7d3b" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/tvheadend" +PKG_URL="https://github.com/tvheadend/dtv-scan-tables/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Digital TV scan tables, a fork from Tvh to support more recent tables." +PKG_TOOLCHAIN="manual" diff --git a/packages/addons/addon-depends/unclutter/package.mk b/packages/addons/addon-depends/unclutter/package.mk deleted file mode 100644 index 24c4246e9d..0000000000 --- a/packages/addons/addon-depends/unclutter/package.mk +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="unclutter" -PKG_VERSION="1.09" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="Public Domain" -PKG_SITE="https://sourceforge.net/projects/unclutter/" -PKG_URL="http://jaist.dl.sourceforge.net/project/unclutter/unclutter/source_$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libX11" -PKG_SECTION="x11" -PKG_SHORTDESC="Unclutter: Hide X11 Cursor" -PKG_LONGDESC="Unclutter runs in the background of an X11 session and after a specified period of inactivity hides the cursor from display. When the cursor is moved its display is restored. Users may specify specific windows to be ignored by unclutter." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - rm -f Makefile - LDFLAGS="$LDFLAGS -lX11" $MAKE unclutter -} - -makeinstall_target() { - mkdir -p .install_pkg/usr/bin - install -m 755 unclutter .install_pkg/usr/bin/ -} diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-ddci2/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-ddci2/package.mk new file mode 100644 index 0000000000..a4aa278041 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-ddci2/package.mk @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vdr-plugin-ddci2" +PKG_VERSION="05dd98824092859afd2aa7a4996c8f258affd975" +PKG_SHA256="b8ed2787e9140eb00a68397eaeb14862ba88a6e73480dc3220a098faffb14833" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/jasmin-j/vdr-plugin-ddci2" +PKG_URL="https://github.com/jasmin-j/vdr-plugin-ddci2/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain vdr" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="Support for stand alone CI by Digital Devices." +PKG_TOOLCHAIN="manual" + +make_target() { + VDR_DIR=$(get_build_dir vdr) + export PKG_CONFIG_PATH=$VDR_DIR:$PKG_CONFIG_PATH + export CPLUS_INCLUDE_PATH=$VDR_DIR/include + + make \ + LIBDIR="." \ + LOCDIR="./locale" \ + all +} + +post_make_target() { + VDR_DIR=$(get_build_dir vdr) + VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` + LIB_NAME=lib${PKG_NAME/-plugin/} + + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} + $STRIP libvdr-*.so* +} diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk index c928b45605..969279302b 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dummydevice/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-dummydevice" PKG_VERSION="2.0.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="5c0049824415bd463d3abc728a3136ee064b60a37b5d3a1986cf282b0d757085" PKG_LICENSE="GPL" PKG_SITE="http://www.vdr-wiki.de/wiki/index.php/Dummydevice-plugin" PKG_URL="http://phivdr.dyndns.org/vdr/vdr-dummydevice/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" -PKG_SOURCE_DIR="dummydevice-${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain vdr" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr dummydevice plugin" -PKG_LONGDESC="vdr dummydevice plugin" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="This plugin can be used to run vdr as recording server without any output devices." +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -49,9 +30,4 @@ post_make_target() { LIB_NAME=lib${PKG_NAME/-plugin/} cp --remove-destination ${LIB_NAME}.so ${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk index cb2245ddc5..3e6eb9df43 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/package.mk @@ -1,41 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-dvbapi" -PKG_VERSION="7a42b22" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="7d51cc457823156d446d06c6ae40f850958fa735" +PKG_SHA256="b16840574802581950343942559797aeccbc4a8fc216901ad0cea42f420bfd7c" PKG_LICENSE="GPL" PKG_SITE="https://github.com/manio/vdr-plugin-dvbapi" PKG_URL="https://github.com/manio/vdr-plugin-dvbapi/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr libdvbcsa" -PKG_SECTION="multimedia" -PKG_SHORTDESC="TV" -PKG_LONGDESC="TV" - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" - -pre_make_target() { - # dont build parallel - MAKEFLAGS=-j1 -} +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="VDR dvbapi plugin for use with OSCam" +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -54,10 +30,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch index a249ffc18f..20d3a117f0 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-dvbapi/patches/vdr-plugin-dvbapi-01_crosscompiling.patch @@ -1,5 +1,3 @@ -diff --git a/Makefile b/Makefile -index d18b016..278af2b 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ libdvbapi-dvbufs9xx.so: device-ufs9xx.o diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk index 3044dd6979..177fc6680a 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-eepg/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-eepg" -PKG_VERSION="9cd9a75" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="c46be443988489780f993a47d23a42936b49d6c0" +PKG_SHA256="08b343caa392bddefeb6e8cfe6f341b4e11e120046dce05961a335a06e9bee6c" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-eepg" -PKG_URL="http://projects.vdr-developer.org/git/vdr-plugin-eepg.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://github.com/vdr-projects/vdr-plugin-eepg/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-plugin-eepg" -PKG_LONGDESC="This plugin parses the Extended (2 to 10 day) EPG data which is send by providers on their portal channels. This EEPG data is transmitted in a non-standard format on a non-standard PID." - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="This plugin parses the Extended EPG data which is send by providers on their portal channels." +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -48,10 +29,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk index 95ff5c03c9..9cd2718dcf 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-epgfixer" -PKG_VERSION="1ad4aaf" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="354f28b0112ba27f08f6509243b410899f74b6ed" +PKG_SHA256="15bd73116f3bda9afc274bee97eff829b98f38b13043be32d7bb7f81af294715" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-epgfixer" -PKG_URL="http://projects.vdr-developer.org/git/vdr-plugin-epgfixer.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://github.com/vdr-projects/vdr-plugin-epgfixer/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr pcre" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-plugin-epgfixer" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" PKG_LONGDESC="Plugin for modifying EPG data using regular expressions." - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -48,10 +29,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-01-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-01-pkgconfig.patch new file mode 100644 index 0000000000..1cf7526792 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-01-pkgconfig.patch @@ -0,0 +1,13 @@ +--- a/Makefile ++++ b/Makefile +@@ -70,8 +70,8 @@ + OBJS = $(PLUGIN).o blacklist.o charset.o config.o epgclone.o epghandler.o regexp.o setup_menu.o tools.o + + ifeq ($(REGEXLIB), pcre) +-LIBS += $(shell pcre-config --libs-posix) +-INCLUDES += $(shell pcre-config --cflags) ++LIBS += $(shell pkg-config --libs libpcreposix libpcre) ++INCLUDES += $(shell pkg-config --cflags libpcre) + DEFINES += -DHAVE_PCREPOSIX + endif + diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch deleted file mode 100644 index 9ba62a07eb..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgfixer/patches/vdr-plugin-epgfixer-pkgconfig.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur vdr-plugin-epgfixer-1ad4aaf/Makefile vdr-plugin-epgfixer-1ad4aaf.patch/Makefile ---- vdr-plugin-epgfixer-1ad4aaf/Makefile 2015-01-01 11:15:50.000000000 +0100 -+++ vdr-plugin-epgfixer-1ad4aaf.patch/Makefile 2016-01-07 04:40:37.742655989 +0100 -@@ -70,8 +70,8 @@ - OBJS = $(PLUGIN).o blacklist.o charset.o config.o epgclone.o epghandler.o regexp.o setup_menu.o tools.o - - ifeq ($(REGEXLIB), pcre) --LIBS += $(shell pcre-config --libs-posix) --INCLUDES += $(shell pcre-config --cflags) -+LIBS += $(shell pkg-config --libs libpcreposix libpcre) -+INCLUDES += $(shell pkg-config --cflags libpcre) - DEFINES += -DHAVE_PCREPOSIX - endif - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk index 22f3b927fe..9feb102564 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-epgsearch" -PKG_VERSION="0b09f90" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="84b59b81137887a48533cc897551bccf2e9e10f6" +PKG_SHA256="d6c4a9136588a7cdf2eb43b6b9643a5bb81a44c542c6e6fcf7448b2383901914" PKG_LICENSE="GPL" PKG_SITE="http://winni.vdr-developer.org/epgsearch/" -PKG_URL="https://projects.vdr-developer.org/git/vdr-plugin-epgsearch.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://github.com/vdr-projects/vdr-plugin-epgsearch/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-epgsearch" -PKG_LONGDESC="vdr-epgsearch" - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="EPGSearch is a plugin for the Video-Disc-Recorder (VDR)." +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -48,10 +29,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-01-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-01-pkgconfig.patch index 4da0f3bcde..12a16937a8 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-01-pkgconfig.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-01-pkgconfig.patch @@ -1,6 +1,5 @@ -diff -Naur vdr-epgsearch-29c174a/Makefile vdr-epgsearch-29c174a.patch/Makefile ---- vdr-epgsearch-29c174a/Makefile 2014-01-18 16:53:11.000000000 +0100 -+++ vdr-epgsearch-29c174a.patch/Makefile 2016-01-07 04:47:33.004326981 +0100 +--- a/Makefile ++++ b/Makefile @@ -130,9 +130,8 @@ OBJS = afuzzy.o blacklist.o changrp.o confdloader.o conflictcheck.o conflictcheck_thread.o distance.o $(PLUGIN).o epgsearchcats.o epgsearchcfg.o epgsearchext.o epgsearchsetup.o epgsearchsvdrp.o epgsearchtools.o mail.o md5.o menu_announcelist.o menu_blacklistedit.o menu_blacklists.o menu_commands.o menu_conflictcheck.o menu_deftimercheckmethod.o menu_dirselect.o menu_event.o menu_favorites.o menu_main.o menu_myedittimer.o menu_quicksearch.o menu_recsdone.o menu_search.o menu_searchactions.o menu_searchedit.o menu_searchresults.o menu_searchtemplate.o menu_switchtimers.o menu_templateedit.o menu_timersdone.o menu_whatson.o noannounce.o pending_notifications.o rcfile.o recdone.o recstatus.o searchtimer_thread.o services.o switchtimer.o switchtimer_thread.o templatefile.o timer_thread.o timerdone.o timerstatus.o uservars.o varparser.o diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-02_don-t-build-unused-plugins.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-02_don-t-build-unused-plugins.patch index 00e6a9ca8a..a21f4cfb40 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-02_don-t-build-unused-plugins.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-epgsearch/patches/vdr-plugin-epgsearch-02_don-t-build-unused-plugins.patch @@ -1,14 +1,6 @@ -From 61c795e71df00f4d3c22d2be405ceb0eb0e0e49c Mon Sep 17 00:00:00 2001 From: Stefan Saraev -Date: Fri, 22 Nov 2013 21:45:56 +0200 Subject: [PATCH] don't build unused plugins ---- - Makefile | 6 +++--- - 1 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/Makefile b/Makefile -index 118e379..5f15ebe 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,9 @@ @@ -24,6 +16,4 @@ index 118e379..5f15ebe 100644 ### edit this to '0' if you don't want epgsearch to auto config itself AUTOCONFIG=1 --- -1.7.2.5 diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk index 049009a13a..f137b7bfd8 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-iptv" -PKG_VERSION="2226be2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5ae793f03048816193003c472d844091f4fd1767" +PKG_SHA256="b7a071ff46e6e06c18e3fbc413e3c8eb2bdb6cae3af953ce93e94ab445bf5cda" PKG_LICENSE="GPL" PKG_SITE="http://www.saunalahti.fi/~rahrenbe/vdr/iptv/" PKG_URL="https://github.com/rofafor/vdr-plugin-iptv/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr curl" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-iptv: an IPTV plugin for the Video Disk Recorder (VDR)" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" PKG_LONGDESC="vdr-iptv is an IPTV plugin for the Video Disk Recorder (VDR)" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -47,10 +29,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/patches/vdr-plugin-iptv-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/patches/vdr-plugin-iptv-pkgconfig.patch index 3ea17f922e..89e45a8cd7 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/patches/vdr-plugin-iptv-pkgconfig.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-iptv/patches/vdr-plugin-iptv-pkgconfig.patch @@ -1,6 +1,5 @@ -diff -Naur iptv-2.2.1/Makefile iptv-2.2.1.patch/Makefile ---- iptv-2.2.1/Makefile 2015-04-04 03:20:00.000000000 +0200 -+++ iptv-2.2.1.patch/Makefile 2016-01-07 07:37:31.037078104 +0100 +--- a/Makefile ++++ b/Makefile @@ -54,7 +54,7 @@ ### Libraries diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk index bb1e7cdad9..9eb1ac27a9 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/package.mk @@ -1,55 +1,32 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-live" -PKG_VERSION="0.3.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e582514ede475574842b44ca6792335ff141172d" +PKG_SHA256="74deb2ca43ffb5779b3f9ff6f34c8b53898a226fcf92605d7ede0401cb62601c" PKG_LICENSE="GPL" PKG_SITE="http://live.vdr-developer.org/en/index.php" -PKG_URL="http://live.vdr-developer.org/downloads/${PKG_NAME/-plugin/}-${PKG_VERSION}.tar.gz" -PKG_SOURCE_DIR="live-${PKG_VERSION}" +PKG_URL="https://github.com/vdr-projects/vdr-plugin-live/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr tntnet pcre:host pcre" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-live: the LIVE Interactive VDR Environment/" -PKG_LONGDESC="vdr-live allows a comfortable operation of VDR and some of its plugins trough a web interface" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="Allows a comfortable operation of VDR and some of its plugins trough a web interface." +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="+pic" pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" - export CXXFLAGS="$CXXFLAGS -fPIC" - export LDFLAGS="$LDFLAGS -fPIC -L$SYSROOT_PREFIX/usr/lib/iconv" -} - -pre_make_target() { - # dont build parallel - MAKEFLAGS=-j1 + export LDFLAGS="$LDFLAGS -L$SYSROOT_PREFIX/usr/lib/iconv" } make_target() { VDR_DIR=$(get_build_dir vdr) + export CPLUS_INCLUDE_PATH=$VDR_DIR/include + VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` + LIB_NAME=lib${PKG_NAME/-plugin/} + make VDRDIR=$VDR_DIR \ LIBDIR="." \ LOCALEDIR="./locale" -} -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-1.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-1.patch deleted file mode 100644 index 35d1c5a11a..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-1.patch +++ /dev/null @@ -1,290 +0,0 @@ -commit 042724e30d5690ab67a6c04aea48a16b9a3b085b -Author: Dieter Hametner -Date: Fri May 3 01:37:41 2013 +0200 - - Make LIVE compile and work with Tntnet and cxxtools version 2.2. - Thanks to Tommi Mäkitalo for his help on resolving the issues. - This problem was reported by Martin Gansser and by the user 'varas' in - the bugtracker as bug #1351. This commit fixes that bug. - -diff --git a/pages/recordings.ecpp b/pages/recordings.ecpp -index 51018bb..80f145b 100644 ---- a/pages/recordings.ecpp -+++ b/pages/recordings.ecpp -@@ -205,7 +205,11 @@ for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) { - <& rec_item_dir name=(recItem->Name()) level=(level) &> - <%cpp> - #if TNT_HAS_QUERYPARAMS -+#if TNT_QUERYPARAMS_NO_BOOL -+ tnt::QueryParams recItemParams(qparam); -+#else - tnt::QueryParams recItemParams(qparam, false); -+#endif - #else - cxxtools::QueryParams recItemParams(qparam, false); - #endif -diff --git a/tntconfig.cpp b/tntconfig.cpp -index 3a1fd14..3325776 100644 ---- a/tntconfig.cpp -+++ b/tntconfig.cpp -@@ -3,7 +3,13 @@ - #include - #include - #include -+#include "tntfeatures.h" -+#if TNT_LOG_SERINFO -+#include -+#include -+#else - #include -+#endif - #include - #include - #include -@@ -181,19 +187,67 @@ namespace vdrlive { - #endif - - #if TNT_CONFIG_INTERNAL -+ namespace { -+ std::string GetResourcePath() -+ { -+#if APIVERSNUM > 10729 -+ string resourceDir(Plugin::GetResourceDirectory()); -+ return resourceDir; -+#else -+ string configDir(Plugin::GetConfigDirectory()); -+ return configDir; -+#endif -+ } -+ -+ void MapUrl(tnt::Tntnet & app, const char *rule, const char * component, std::string const & instPath, const char * pathInfo, const char * mime_type) -+ { -+#if TNT_MAPURL_NAMED_ARGS -+ tnt::Mapping::args_type argMap; -+ argMap.insert(std::make_pair("mime-type", mime_type)); -+#endif -+ app.mapUrl(rule, component) -+ .setPathInfo(instPath + pathInfo) -+#if TNT_MAPURL_NAMED_ARGS -+ .setArgs(argMap); -+#else -+ .pushArg(mime_type); -+#endif -+ } -+ } -+ - void TntConfig::Configure(tnt::Tntnet& app) const - { - string const configDir(Plugin::GetConfigDirectory()); --#if APIVERSNUM > 10729 -- string const resourceDir(Plugin::GetResourceDirectory()); --#endif - -+#if TNT_LOG_SERINFO -+ cxxtools::SerializationInfo si; -+ std::istringstream logXmlConf( -+ "\n" -+ " " + LiveSetup().GetTntnetLogLevel() + "\n" -+ " \n" -+ " \n" -+ " cxxtools\n" -+ " " + LiveSetup().GetTntnetLogLevel() + "\n" -+ " \n" -+ " \n" -+ " tntnet\n" -+ " " + LiveSetup().GetTntnetLogLevel() + "\n" -+ " \n" -+ " \n" -+ "\n" -+ ); -+ cxxtools::xml::XmlDeserializer d(logXmlConf); -+ d.deserialize(si); -+ log_init(si); -+#else - std::istringstream logConf( - "rootLogger=" + LiveSetup().GetTntnetLogLevel() + "\n" - "logger.tntnet=" + LiveSetup().GetTntnetLogLevel() + "\n" - "logger.cxxtools=" + LiveSetup().GetTntnetLogLevel() + "\n" - ); -+ - log_init(logConf); -+#endif - - // +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ - // ------------------------------------------------------------------------ -@@ -229,13 +283,12 @@ namespace vdrlive { - - // the following selects the theme specific 'theme.css' file - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -- app.mapUrl("^/themes/([^/]*)/css.*/(.+\\.css)", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/themes/$1/css/$2") --#else -- .setPathInfo(configDir + "/themes/$1/css/$2") --#endif -- .pushArg("text/css"); -+ MapUrl(app, -+ "^/themes/([^/]*)/css.*/(.+\\.css)", -+ "content", -+ GetResourcePath(), -+ "/themes/$1/css/$2", -+ "text/css"); - - // the following rules provide a search scheme for images. The first - // rule where a image is found, terminates the search. -@@ -243,79 +296,82 @@ namespace vdrlive { - // 2. /img/. - // deprecated: 3. . (builtin images) - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -- app.mapUrl("^/themes/([^/]*)/img.*/(.+)\\.(.+)", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/themes/$1/img/$2.$3") --#else -- .setPathInfo(configDir + "/themes/$1/img/$2.$3") --#endif -- .pushArg("image/$3"); -- app.mapUrl("^/themes/([^/]*)/img.*/(.+)\\.(.+)", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/img/$2.$3") --#else -- .setPathInfo(configDir + "/img/$2.$3") --#endif -- .pushArg("image/$3"); -+ MapUrl(app, -+ "^/themes/([^/]*)/img.*/(.+)\\.(.+)", -+ "content", -+ GetResourcePath(), -+ "/themes/$1/img/$2.$3", -+ "image/$3"); -+ -+ MapUrl(app, -+ "^/themes/([^/]*)/img.*/(.+)\\.(.+)", -+ "content", -+ GetResourcePath(), -+ "/img/$2.$3", -+ "image/$3"); - // deprecated: file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl; - - // Epg images - string const epgImgPath(LiveSetup().GetEpgImageDir()); - if (!epgImgPath.empty()) { - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -- app.mapUrl("^/epgimages/([^/]*)\\.([^./]+)", "content") -- .setPathInfo(epgImgPath + "/$1.$2") -- .pushArg("image/$2"); -+ MapUrl(app, -+ "^/epgimages/([^/]*)\\.([^./]+)", -+ "content", -+ epgImgPath, -+ "/$1.$2", -+ "image/$2"); - } - - // select additional (not build in) javascript. - // WARNING: no path components with '.' in the name are allowed. Only - // the basename may contain dots and must end with '.js' - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -- app.mapUrl("^/js(/[^.]*)([^/]*\\.js)", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/js$1$2") --#else -- .setPathInfo(configDir + "/js$1$2") --#endif -- .pushArg("text/javascript"); -+ MapUrl(app, -+ "^/js(/[^.]*)([^/]*\\.js)", -+ "content", -+ GetResourcePath(), -+ "/js$1$2", -+ "text/javascript"); - - // map to 'css/basename(uri)' - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -- app.mapUrl("^/css.*/(.+)", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/css/$1") --#else -- .setPathInfo(configDir + "/css/$1") --#endif -- .pushArg("text/css"); -+ MapUrl(app, -+ "^/css.*/(.+)", -+ "content", -+ GetResourcePath(), -+ "/css/$1", -+ "text/css"); - - // map to 'img/basename(uri)' - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -- app.mapUrl("^/img.*/(.+)\\.([^.]+)", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/img/$1.$2") --#else -- .setPathInfo(configDir + "/img/$1.$2") --#endif -- .pushArg("image/$2"); -+ MapUrl(app, -+ "^/img.*/(.+)\\.([^.]+)", -+ "content", -+ GetResourcePath(), -+ "/img/$1.$2", -+ "image/$2"); - - // Map favicon.ico into img directory -- app.mapUrl("^/favicon.ico$", "content") --#if APIVERSNUM > 10729 -- .setPathInfo(resourceDir + "/img/favicon.ico") --#else -- .setPathInfo(configDir + "/img/favicon.ico") --#endif -- .pushArg("image/x-icon"); -+ MapUrl(app, -+ "^/favicon.ico$", -+ "content", -+ GetResourcePath(), -+ "/img/favicon.ico", -+ "image/x-icon"); - - // takes first path components without 'extension' when it does not - // contain '.' - // modified by 'tadi' -- verified with above, but not counterchecked yet! - app.mapUrl("^/([^./]+)(.*)?", "$1"); - -+#if TNT_GLOBAL_TNTCONFIG -+ tnt::TntConfig::it().sessionTimeout = 86400; -+ tnt::TntConfig::it().defaultContentType = string("text/html; charset=") + LiveI18n().CharacterEncoding(); -+#else - tnt::Sessionscope::setDefaultTimeout(86400); - tnt::HttpReply::setDefaultContentType(string("text/html; charset=") + LiveI18n().CharacterEncoding()); -+#endif - - Setup::IpList const& ips = LiveSetup().GetServerIps(); - int port = LiveSetup().GetServerPort(); -diff --git a/tntfeatures.h b/tntfeatures.h -index 6de1f88..76d3757 100644 ---- a/tntfeatures.h -+++ b/tntfeatures.h -@@ -17,6 +17,9 @@ - // Query params are now in tntnet and not in cxxtools - #define TNT_HAS_QUERYPARAMS (TNTVERSION >= 16060) - -+// Query params without boolean parameter -+#define TNT_QUERYPARAMS_NO_BOOL (TNTVERSION >= 22000) -+ - // One can request the host part of the request url - #define TNT_HAS_GETHOST (TNTVERSION >= 16060) - -@@ -26,4 +29,13 @@ - // version of TNTNET that binds ipv6 addresses with IPV6_V6ONLY flag set to true - #define TNT_IPV6_V6ONLY (CXXTOOLVER >= 21000) - -+// version of TNTNET with properties deserializer for logger configuration args. -+#define TNT_LOG_SERINFO (CXXTOOLVER >= 22000) -+ -+// version of TNTNET wich expects name, value mappings for Url-Mapper arguments. -+#define TNT_MAPURL_NAMED_ARGS (TNTVERSION >= 22000) -+ -+// version of TNTNET where configuration is global -+#define TNT_GLOBAL_TNTCONFIG (TNTVERSION >= 22000) -+ - #endif // VDR_LIVE_TNTFEATURES_H diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-2.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-2.patch deleted file mode 100644 index 3b49c6b0a3..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-04_tntnet-2.2-2.patch +++ /dev/null @@ -1,25 +0,0 @@ -commit 69f84f95fa875c6f562294b1a6a1ea6f584d3f6c -Author: Dieter Hametner -Date: Sat May 4 22:27:09 2013 +0200 - - With tntnet v2.2 use also the request.getArg() function. - In the previous commit support for tntnet 2.2 was added. The URL - mapping changed in that version and allows now named arguments. This - change makes uses of this feature now. - -diff --git a/pages/content.ecpp b/pages/content.ecpp -index 27d827c..cde092f 100644 ---- a/pages/content.ecpp -+++ b/pages/content.ecpp -@@ -17,7 +17,11 @@ bool logged_in(false); - - string mime("image/png"); - if (request.getArgsCount() > 0) { -+#if TNT_MAPURL_NAMED_ARGS -+ mime = request.getArg("mime-type"); -+#else - mime = request.getArg(0); -+#endif - // dsyslog("vdrlive::content found mime arg (%s)", mime.c_str()); - } - reply.setContentType(mime); diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-05_vdr-2.1.2-buildfix.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-05_vdr-2.1.2-buildfix.patch deleted file mode 100644 index dd576b9e10..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-05_vdr-2.1.2-buildfix.patch +++ /dev/null @@ -1,76 +0,0 @@ -commit 0f8a281027f852ed5968361bcb7420ed242d0476 -Author: Stefan Saraev -Date: Sat Oct 19 22:15:14 2013 +0300 - - vdr 2.1.2 buildfix - -diff --git a/pages/recordings.ecpp b/pages/recordings.ecpp -index 80f145b..6da5285 100644 ---- a/pages/recordings.ecpp -+++ b/pages/recordings.ecpp -@@ -79,7 +79,7 @@ for (deletions_type::const_iterator it = deletions.begin(); it != deletions.end( - deletions.clear(); - - int FreeMB, UsedMB; --int Percent = VideoDiskSpace(&FreeMB, &UsedMB); -+int Percent = cVideoDirectory::VideoDiskSpace(&FreeMB, &UsedMB); - int Minutes = int(double(FreeMB) / MB_PER_MINUTE); - int Hours = Minutes / 60; - Minutes %= 60; -diff --git a/recman.cpp b/recman.cpp -index 6a2fc00..9ed88f0 100644 ---- a/recman.cpp -+++ b/recman.cpp -@@ -112,7 +112,7 @@ namespace vdrlive { - if (found == string::npos) - return false; - -- string newname = string(VideoDirectory) + "/" + name + oldname.substr(found); -+ string newname = string(cVideoDirectory::Name()) + "/" + name + oldname.substr(found); - - if (!MoveDirectory(oldname.c_str(), newname.c_str(), copy)) { - esyslog("[LIVE]: renaming failed from '%s' to '%s'", oldname.c_str(), newname.c_str()); -diff --git a/tntconfig.cpp b/tntconfig.cpp -index 3325776..161fdc4 100644 ---- a/tntconfig.cpp -+++ b/tntconfig.cpp -@@ -279,7 +279,7 @@ namespace vdrlive { - // inserted by 'tadi' -- not verified, not counterchecked yet! - //app.mapUrl("^/vlc/(.+)", "static@tntnet") - // .setPathInfo("/$1") -- // .pushArg(string("DocumentRoot=") + VideoDirectory); -+ // .pushArg(string("DocumentRoot=") + cVideoDirectory::Name()); - - // the following selects the theme specific 'theme.css' file - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -diff --git a/tools.cpp b/tools.cpp -index c744d06..cb3529e 100644 ---- a/tools.cpp -+++ b/tools.cpp -@@ -365,7 +365,7 @@ namespace vdrlive { - stat(source.c_str(), &st1); - stat(target.c_str(),&st2); - if (!copy && (st1.st_dev == st2.st_dev)) { -- if (!RenameVideoFile(source.c_str(), target.c_str())) { -+ if (!cVideoDirectory::RenameVideoFile(source.c_str(), target.c_str())) { - esyslog("[LIVE]: rename failed from %s to %s", source.c_str(), target.c_str()); - return false; - } -@@ -461,7 +461,7 @@ namespace vdrlive { - size_t found = source.find_last_of(delim); - if (found != std::string::npos) { - source = source.substr(0, found); -- while (source != VideoDirectory) { -+ while (source != cVideoDirectory::Name()) { - found = source.find_last_of(delim); - if (found == std::string::npos) - break; -@@ -478,7 +478,7 @@ namespace vdrlive { - size_t found = target.find_last_of(delim); - if (found != std::string::npos) { - target = target.substr(0, found); -- while (target != VideoDirectory) { -+ while (target != cVideoDirectory::Name()) { - found = target.find_last_of(delim); - if (found == std::string::npos) - break; diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-06_dont-build-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-06_dont-build-i18n.patch deleted file mode 100644 index 28ef9af0e0..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-0.3.0-06_dont-build-i18n.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d95f6d719298b4586fc4b889612423be67b52e88 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Mon, 16 Jun 2014 12:06:29 +0300 -Subject: [PATCH] dont build i18n - ---- - Makefile | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/Makefile b/Makefile -index ab2f2b5..923d184 100644 ---- a/Makefile -+++ b/Makefile -@@ -94,7 +94,7 @@ WEBLIBS = pages/libpages.a css/libcss.a javascript/libjavascript.a - - ### Default rules: - --all: libvdr-$(PLUGIN).so $(I18NTARG) -+all: libvdr-$(PLUGIN).so - - .PHONY: all dist clean subdirs $(SUBDIRS) PAGES - --- -1.7.2.5 - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-01-makefile.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-01-makefile.patch new file mode 100644 index 0000000000..fab596fa69 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-01-makefile.patch @@ -0,0 +1,36 @@ +--- a/Makefile ++++ b/Makefile +@@ -11,7 +11,7 @@ PLUGIN := live + VERSION := $(shell grep '\#define LIVEVERSION ' setup.h | awk '{ print $$3 }' | sed -e 's/[";]//g') + + ### Check for libpcre c++ wrapper +-HAVE_LIBPCRECPP := $(shell pcre-config --libs-cpp) ++HAVE_LIBPCRECPP := $(shell pkg-config --libs libpcrecpp libpcre) + + ### The directory environment: + # Use package data if installed...otherwise assume we're under the VDR source directory: +@@ -37,18 +37,18 @@ APIVERSION := $(call PKGCFG,apiversion) + include global.mk + + ### Determine tntnet and cxxtools versions: +-TNTVERSION = $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') +-CXXTOOLVER = $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') ++TNTVERSION = $(shell pkg-config --modversion tntnet | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') ++CXXTOOLVER = $(shell pkg-config --modversion cxxtools | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') + +-CXXFLAGS += $(shell tntnet-config --cxxflags) +-LIBS += $(shell tntnet-config --libs) ++CXXFLAGS += $(shell pkg-config --cflags tntnet) ++LIBS += $(shell pkg-config --libs tntnet) + + ### Optional configuration features + PLUGINFEATURES := + ifneq ($(HAVE_LIBPCRECPP),) + PLUGINFEATURES += -DHAVE_LIBPCRECPP +- CXXFLAGS += $(shell pcre-config --cflags) +- LIBS += $(HAVE_LIBPCRECPP) ++ CXXFLAGS += $(shell pkg-config --cflags libpcreposix libpcre) ++ LIBS += -Wl,-Bstatic $(HAVE_LIBPCRECPP) -Wl,-Bdynamic + endif + + # -Wno-deprecated-declarations .. get rid of warning: ‘template class std::auto_ptr’ is deprecated diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-03-no-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-03-no-i18n.patch new file mode 100644 index 0000000000..3d932b8164 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-03-no-i18n.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -98,7 +98,7 @@ SUBDIRS := $(WEB_DIR_PAGES) $(WEB_DIR_CSS) $(WEB_DIR_JAVA) + + ### The main target: + .PHONY: all +-all: lib i18n ++all: lib + @true + + ### Implicit rules: diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-gcc6.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-gcc6.patch deleted file mode 100644 index e26503659a..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-gcc6.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/stdext.h.orig 2016-02-07 12:55:05.958100061 +0100 -+++ b/stdext.h 2016-02-07 12:56:49.583375455 +0100 -@@ -3,8 +3,38 @@ - - #if __GNUC__ >= 4 - --# include --# include -+#if __GNUC__ >= 6 -+ -+#include -+#include -+ -+namespace std { -+namespace tr1 { -+ -+ using std::bind; -+ using std::shared_ptr; -+ using std::weak_ptr; -+ -+ namespace placeholders { -+ using std::placeholders::_1; -+ using std::placeholders::_2; -+ using std::placeholders::_3; -+ using std::placeholders::_4; -+ using std::placeholders::_5; -+ using std::placeholders::_6; -+ using std::placeholders::_7; -+ using std::placeholders::_8; -+ using std::placeholders::_9; -+ } -+} // namespace tr1 -+} // namespace std -+ -+#else -+ -+ # include -+ # include -+ -+# endif - - #else - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-pkgconfig.patch deleted file mode 100644 index 8f159d514a..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-live/patches/vdr-plugin-live-pkgconfig.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff -Naur live-0.3.0/css/Makefile live-0.3.0.patch/css/Makefile ---- live-0.3.0/css/Makefile 2013-04-04 22:16:40.000000000 +0200 -+++ live-0.3.0.patch/css/Makefile 2016-01-07 06:49:35.954078949 +0100 -@@ -4,7 +4,7 @@ - - ### Additional options to silence TNTNET warnings - TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-function --TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -+TNTVERSION ?= $(shell pkg-config --modversion tntnet | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') - - ### The C++ compiler and options: - -diff -Naur live-0.3.0/httpd/Makefile live-0.3.0.patch/httpd/Makefile ---- live-0.3.0/httpd/Makefile 2013-04-04 22:16:40.000000000 +0200 -+++ live-0.3.0.patch/httpd/Makefile 2016-01-07 06:51:05.349223371 +0100 -@@ -3,7 +3,7 @@ - - CXXFLAGS ?= -O2 -Woverloaded-virtual -Wall -fPIC - --CXXFLAGS += `tntnet-config --cxxflags` -+CXXFLAGS += `pkg-config --cflags tntnet` - - ### Includes and Defines (add further entries here): - -diff -Naur live-0.3.0/javascript/Makefile live-0.3.0.patch/javascript/Makefile ---- live-0.3.0/javascript/Makefile 2013-04-04 22:16:40.000000000 +0200 -+++ live-0.3.0.patch/javascript/Makefile 2016-01-07 06:49:51.561104158 +0100 -@@ -4,7 +4,7 @@ - - ### Additional options to silence TNTNET warnings - TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-function --TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -+TNTVERSION ?= $(shell pkg-config --modversion tntnet | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') - - ### The C++ compiler and options: - -diff -Naur live-0.3.0/Makefile live-0.3.0.patch/Makefile ---- live-0.3.0/Makefile 2013-04-04 22:16:40.000000000 +0200 -+++ live-0.3.0.patch/Makefile 2016-01-07 06:48:29.683971910 +0100 -@@ -26,7 +26,7 @@ - LDFLAGS ?= -fPIC -g - - ### Check for libpcre c++ wrapper --HAVE_LIBPCRECPP = $(shell pcre-config --libs-cpp) -+HAVE_LIBPCRECPP = $(shell pkg-config --libs libpcrecpp libpcre) - - ### The directory environment: - -@@ -46,18 +46,18 @@ - - APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) - I18NTARG = $(shell if [ `echo $(APIVERSION) | tr [.] [0]` -ge "10507" ]; then echo "i18n"; fi) --TNTVERSION = $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') --CXXTOOLVER = $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -+TNTVERSION = $(shell pkg-config --modversion tntnet | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -+CXXTOOLVER = $(shell pkg-config --modversion cxxtools | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') - TNTVERS7 = $(shell ver=$(TNTVERSION); if [ $$ver -ge "1606" ]; then echo "yes"; fi) - --CXXFLAGS += $(shell tntnet-config --cxxflags) --LIBS += $(shell tntnet-config --libs) -+CXXFLAGS += $(shell pkg-config --cflags tntnet) -+LIBS += $(shell pkg-config --libs tntnet) - - ### Optional configuration features - PLUGINFEATURES = - ifneq ($(HAVE_LIBPCRECPP),) - PLUGINFEATURES += -DHAVE_LIBPCRECPP -- CXXFLAGS += $(shell pcre-config --cflags) -+ CXXFLAGS += $(shell pkg-config --cflags libpcreposix libpcre) - LIBS += $(HAVE_LIBPCRECPP) - endif - -diff -Naur live-0.3.0/pages/Makefile live-0.3.0.patch/pages/Makefile ---- live-0.3.0/pages/Makefile 2013-04-04 22:16:40.000000000 +0200 -+++ live-0.3.0.patch/pages/Makefile 2016-01-07 06:50:04.234124627 +0100 -@@ -4,8 +4,8 @@ - - ### Additional options to silence TNTNET warnings - TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-variable --TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') --CXXTOOLVER ?= $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -+TNTVERSION ?= $(shell pkg-config --modversion tntnet | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -+CXXTOOLVER ?= $(shell pkg-config --modversion cxxtools | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') - - ### The C++ compiler and options: - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk index 9a65cd7065..0cf91616b8 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/package.mk @@ -1,39 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-restfulapi" PKG_VERSION="0.2.6.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="116f2ec08eb8d228ef5da64fe4039f2c00ae4d76388f0f34ab329c866d928e1f" PKG_LICENSE="GPL" PKG_SITE="https://github.com/yavdr/vdr-plugin-restfulapi" PKG_URL="https://github.com/yavdr/${PKG_NAME}/releases/download/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr cxxtools vdr-plugin-wirbelscan" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-plugin-restfulapi: the restful API for the VDR/" -PKG_LONGDESC="vdr-plugin-restfulapi allows to access many internals of the VDR via a restful API" +PKG_NEED_UNPACK="$(get_pkg_directory vdr) $(get_pkg_directory vdr-plugin-wirbelscan)" +PKG_LONGDESC="Allows to access many internals of the VDR via a restful API." +PKG_TOOLCHAIN="manual" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_make_target() { - # dont build parallel - MAKEFLAGS=-j1 +pre_build_target() { + cp $(get_build_dir vdr-plugin-wirbelscan)/wirbelscan_services.h $PKG_BUILD/wirbelscan/ } make_target() { @@ -53,10 +34,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-01-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-01-pkgconfig.patch new file mode 100644 index 0000000000..cb1d60d43a --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-01-pkgconfig.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -51,7 +51,7 @@ SOFILE = libvdr-$(PLUGIN).so + + DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' + +-LIBS += $(shell cxxtools-config --libs) -lcxxtools-http ++LIBS += $(shell pkg-config --libs cxxtools-http cxxtools) + CONFDIR = $(call PKGCFG,configdir) + PLGCONFDIR = $(CONFDIR)/plugins/$(PLUGIN) + diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-02-webapp-path.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-02-webapp-path.patch new file mode 100644 index 0000000000..6f09426314 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-02-webapp-path.patch @@ -0,0 +1,22 @@ +--- a/tools.cpp ++++ b/tools.cpp +@@ -214,7 +214,7 @@ void Settings::initDefault() + SetIp((string)"0.0.0.0"); + SetEpgImageDirectory((string)"/var/cache/vdr/epgimages"); + SetChannelLogoDirectory((string)"/usr/share/vdr/channel-logos"); +- SetWebappDirectory((string)"/var/lib/vdr/plugins/restfulapi/webapp"); ++ SetWebappDirectory((string)"/storage/.kodi/addons/service.multimedia.vdr-addon/res/plugins/restfulapi"); + SetHeaders((string)"true"); + webapp_filetypes_filename = "webapp_file_types.conf"; + } +--- a/tools.h ++++ b/tools.h +@@ -40,7 +40,7 @@ + #define RESTFULAPI_EXTENSIONS + + #ifndef DOCUMENT_ROOT +-#define DOCUMENT_ROOT "/var/lib/vdr/plugins/restfulapi/" ++#define DOCUMENT_ROOT "/storage/.kodi/addons/service.multimedia.vdr-addon/res/plugins/restfulapi/" + #endif + + class Settings diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch deleted file mode 100644 index c0c9cf8512..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-restfulapi/patches/vdr-plugin-restfulapi-pkgconfig.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur vdr-plugin-restfulapi-0.2.1.4/Makefile vdr-plugin-restfulapi-0.2.1.4.patch/Makefile ---- vdr-plugin-restfulapi-0.2.1.4/Makefile 2015-03-18 23:12:01.000000000 +0100 -+++ vdr-plugin-restfulapi-0.2.1.4.patch/Makefile 2016-01-07 05:24:24.036888492 +0100 -@@ -49,7 +49,7 @@ - - DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' - --LIBS += $(shell cxxtools-config --libs) -lcxxtools-http -+LIBS += $(shell pkg-config --libs cxxtools-http cxxtools) - CONFDIR = $(call PKGCFG,configdir) - PLGCONFDIR = $(CONFDIR)/plugins/$(PLUGIN) - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-robotv/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-robotv/package.mk new file mode 100644 index 0000000000..ce2f4c3c0f --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-robotv/package.mk @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vdr-plugin-robotv" +PKG_VERSION="50d4bdcdbe3bdb6e85fe02de4c4086ca1f8db94d" +PKG_SHA256="062489e55111f0ba2420463cc506865ac59b1c1d080b318cb81d58ec3f4fbd3f" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/pipelka/roboTV" +PKG_URL="https://github.com/pipelka/vdr-plugin-robotv/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain vdr avahi" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="RoboTV is a Android TV based frontend for VDR." +PKG_TOOLCHAIN="cmake" + +pre_configure_target() { + VDR_DIR=$(get_build_dir vdr) + export PKG_CONFIG_PATH=$VDR_DIR:$PKG_CONFIG_PATH + export CPLUS_INCLUDE_PATH=$VDR_DIR/include + export VDRDIR=$VDR_DIR +} + +post_make_target() { + VDR_DIR=$(get_build_dir vdr) + VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` + LIB_NAME=lib${PKG_NAME/-plugin/} + + cp --remove-destination $PKG_BUILD/.$TARGET_NAME/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} +} diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk index d39b0de974..fb39580e7c 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-satip" -PKG_VERSION="6573c38" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="a4051bf88c1f3c86cfe5133fd703517296f7f590" +PKG_SHA256="ea9f930b829e4c333f8401e64b5e03a82efb88a4c6db3320463b295d297b0035" PKG_LICENSE="GPL" PKG_SITE="http://www.saunalahti.fi/~rahrenbe/vdr/satip/" PKG_URL="https://github.com/rofafor/vdr-plugin-satip/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr curl tinyxml" -PKG_SECTION="multimedia" -PKG_SHORTDESC="VDR-satip: SAT>IP plugin for VDR" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" PKG_LONGDESC="This is an SAT>IP plugin for the Video Disk Recorder (VDR)." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -48,10 +30,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/patches/vdr-plugin-satip-01-pkgconfig.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/patches/vdr-plugin-satip-01-pkgconfig.patch index c7d7f4a3ab..e0c19f3a8d 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/patches/vdr-plugin-satip-01-pkgconfig.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-satip/patches/vdr-plugin-satip-01-pkgconfig.patch @@ -1,6 +1,5 @@ -diff -Naur satip-2.2.2/Makefile satip-2.2.2.patch/Makefile ---- satip-2.2.2/Makefile 2015-04-26 03:20:00.000000000 +0200 -+++ satip-2.2.2.patch/Makefile 2016-01-07 07:33:20.588462880 +0100 +--- a/Makefile ++++ b/Makefile @@ -53,7 +53,7 @@ ### Libraries diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk index 595573ca2a..0d23c2c52f 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-streamdev" -PKG_VERSION="fc52e92" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e2a9b979d3fb92967c7a6a8221e674eb7e55c813" +PKG_SHA256="adcc08ac19cf98122576bedf63be3396d8b81ee4196c00df0e25c9fb8b7e11b8" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-streamdev" -PKG_URL="https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain vdr libressl" -PKG_SECTION="multimedia" -PKG_SHORTDESC="TV" -PKG_LONGDESC="TV" - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_URL="https://github.com/vdr-projects/vdr-plugin-streamdev/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain vdr openssl" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="This PlugIn is a VDR implementation of Video Transfer and a basic HTTP Streaming Protocol." +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -47,14 +28,6 @@ post_make_target() { VDR_DIR=$(get_build_dir vdr) VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/server/${LIB_NAME}-server.so $ROOT/$PKG_BUILD/server/${LIB_NAME}-server.so.${VDR_APIVERSION} - cp --remove-destination $ROOT/$PKG_BUILD/client/${LIB_NAME}-client.so $ROOT/$PKG_BUILD/client/${LIB_NAME}-client.so.${VDR_APIVERSION} - - $STRIP client/libvdr-*.so* - $STRIP server/libvdr-*.so* + cp --remove-destination $PKG_BUILD/server/${LIB_NAME}-server.so $PKG_BUILD/server/${LIB_NAME}-server.so.${VDR_APIVERSION} + cp --remove-destination $PKG_BUILD/client/${LIB_NAME}-client.so $PKG_BUILD/client/${LIB_NAME}-client.so.${VDR_APIVERSION} } - -makeinstall_target() { - : # installation not needed, done by create-addon script -} - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-01_4k_hevc_support.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-01_4k_hevc_support.patch index dcd664cec5..45b97824f6 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-01_4k_hevc_support.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-01_4k_hevc_support.patch @@ -1,8 +1,7 @@ http://www.vdr-portal.de/board17-developer/board97-vdr-core/p1272182-rfc-h-265-frame-parser/#post1272182 -diff -ur streamdev-160321-1/server/livestreamer.c streamdev-160321/server/livestreamer.c ---- streamdev-160321-1/server/livestreamer.c 2016-03-21 11:41:52.000000000 +0100 -+++ streamdev-160321/server/livestreamer.c 2016-05-03 13:54:07.000000000 +0200 +--- a/server/livestreamer.c ++++ b/server/livestreamer.c @@ -143,6 +143,8 @@ "ISO/IEC 14496-3 Audio with LATM transport syntax", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1a", diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-02_2.3.9_lock_fix.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-02_2.3.9_lock_fix.patch new file mode 100644 index 0000000000..fe42f9f226 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-streamdev/patches/vdr-plugin-streamdev-02_2.3.9_lock_fix.patch @@ -0,0 +1,15 @@ + +https://www.vdr-portal.de/forum/index.php?thread/131708-gel%C3%B6st-vdr-2-3-9-h%C3%A4ngt-bei-der-wiedergabe-von-aufnahmen-mit-rpihddevice/&postID=1303098#post1303098 + +diff --git a/client/device.c b/client/device.c +index a810f53..2e54e34 100644 +--- a/client/device.c ++++ b/client/device.c +@@ -190,7 +190,6 @@ bool cStreamdevDevice::SetChannelDevice(const cChannel *Channel, + + bool cStreamdevDevice::SetPid(cPidHandle *Handle, int Type, bool On) { + Dprintf("SetPid, Pid=%d, Type=%d, On=%d, used=%d\n", Handle->pid, Type, On, Handle->used); +- LOCK_THREAD; + + bool res = true; + if (Handle->pid && (On || !Handle->used)) { diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk index e883cfa05f..702de50bda 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-vnsiserver/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-vnsiserver" -PKG_VERSION="d6847c3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="49003f036609ee2a0b8d819979c063d8f8d348c8" +PKG_SHA256="fc64c343685bf87e4cc14018bcf642cba9aa637adfe1ab21725a19945c620737" PKG_LICENSE="GPL" PKG_SITE="https://github.com/FernetMenta/vdr-plugin-vnsiserver" PKG_URL="https://github.com/FernetMenta/vdr-plugin-vnsiserver/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr" -PKG_SECTION="multimedia" -PKG_SHORTDESC="TV" -PKG_LONGDESC="TV" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="VDR plugin to handle Kodi clients." +PKG_TOOLCHAIN="manual" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -47,10 +29,5 @@ post_make_target() { VDR_APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' $VDR_DIR/config.h` LIB_NAME=lib${PKG_NAME/-plugin/} - cp --remove-destination $ROOT/$PKG_BUILD/${LIB_NAME}.so $ROOT/$PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script + cp --remove-destination $PKG_BUILD/${LIB_NAME}.so $PKG_BUILD/${LIB_NAME}.so.${VDR_APIVERSION} } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk index e2649972c7..5070a75a24 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/package.mk @@ -1,42 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-wirbelscan" -PKG_VERSION="0.0.9" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2018.11.04" +PKG_SHA256="62c2848aefdb768c165310f70b3746665f57b96a95ebae96761febbb07e942e3" PKG_LICENSE="GPL" PKG_SITE="http://wirbel.htpc-forum.de/wirbelscan/index2.html" -PKG_URL="http://wirbel.htpc-forum.de/wirbelscan/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" -PKG_SOURCE_DIR="wirbelscan-${PKG_VERSION}" +PKG_URL="http://wirbel.htpc-forum.de/wirbelscan/vdr-wirbelscan-$PKG_VERSION.tgz" PKG_DEPENDS_TARGET="toolchain vdr" -PKG_SECTION="multimedia" -PKG_SHORTDESC="TV" -PKG_LONGDESC="TV" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" - export CXXFLAGS="$CXXFLAGS -fPIC" - export LDFLAGS="$LDFLAGS -fPIC" -} +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="Performs a channel scans for DVB-T, DVB-C and DVB-S" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="+pic" make_target() { VDR_DIR=$(get_build_dir vdr) @@ -44,8 +20,3 @@ make_target() { LIBDIR="." \ LOCALEDIR="./locale" } - -makeinstall_target() { - : # installation not needed, done by create-addon script -} - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01-fixes.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01-fixes.patch new file mode 100644 index 0000000000..1431804dc3 --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01-fixes.patch @@ -0,0 +1,56 @@ +Subject: [PATCH 1/2] interface channel count + +diff --git a/wirbelscan.c b/wirbelscan.c +index 602e659..aafbec3 100644 +--- a/wirbelscan.c ++++ b/wirbelscan.c +@@ -12,6 +12,7 @@ + #include "menusetup.h" + #include "countries.h" + #include "satellites.h" ++extern TChannels NewChannels; + + static const char *VERSION = "2018.11.04"; + static const char *DESCRIPTION = "DVB channel scan for VDR"; +@@ -201,8 +202,8 @@ bool cPluginWirbelscan::Service(const char* id, void* Data) { + strcpy(s->transponder, lTransponder.length()? lTransponder.c_str():"none"); + s->progress = s->status == StatusScanning?lProgress:0; + s->strength = s->status == StatusScanning?lStrength:0; +- s->numChannels = 0; // Channels.Count(); // not possible any longer. +- s->newChannels = channelcount; // ((Channels.Count() - channelcount) > 0) && channelcount?Channels.Count() - channelcount:0; ++ s->numChannels = cChannels::MaxNumber(); ++ s->newChannels = (NewChannels.Count() > cChannels::MaxNumber()) ? NewChannels.Count() - cChannels::MaxNumber():0; + s->nextTransponders = nextTransponders; + return true; + } +Subject: [PATCH 2/2] device detection + +diff --git a/common.c b/common.c +index 0ba4656..1ea8e51 100644 +--- a/common.c ++++ b/common.c +@@ -46,20 +46,10 @@ void cMySetup::InitSystems(void) { + for(int i = 0; i < cDevice::NumDevices(); i++) { + cDevice* device = cDevice::GetDevice(i); + if (device == NULL) continue; +- std::string t = *device->DeviceType(); +- if (t == "DVB-C" ) systems[SCAN_CABLE ] = 1; +- if (t == "DVB-T" ) systems[SCAN_TERRESTRIAL ] = 1; +- if (t == "DSS" ) systems[SCAN_SATELLITE ] = 1; +- if (t == "DVB-S" ) systems[SCAN_SATELLITE ] = 1; +- if (t == "DVB-S2") systems[SCAN_SATELLITE ] = 1; +- if (t == "ATSC" ) systems[SCAN_TERRCABLE_ATSC] = 1; +- if (t == "DVB-T2") systems[SCAN_TERRESTRIAL ] = 1; +- if (t == "TURBO" ) systems[SCAN_SATELLITE ] = 1; +- if (t == "SAT>IP") { +- if (device->ProvidesSource(cSource::FromString("S"))) systems[SCAN_SATELLITE ] = 1; +- if (device->ProvidesSource(cSource::FromString("T"))) systems[SCAN_TERRESTRIAL ] = 1; +- if (device->ProvidesSource(cSource::FromString("C"))) systems[SCAN_CABLE ] = 1; +- } ++ if (device->ProvidesSource(cSource::stSat)) systems[SCAN_SATELLITE] = 1; ++ if (device->ProvidesSource(cSource::stTerr)) systems[SCAN_TERRESTRIAL] = 1; ++ if (device->ProvidesSource(cSource::stCable)) systems[SCAN_CABLE] = 1; ++ if (device->ProvidesSource(cSource::stAtsc)) systems[SCAN_TERRCABLE_ATSC] = 1; + } + + if (DVB_Type >= SCAN_NO_DEVICE || ! systems[DVB_Type]) { diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01_fix-dvbs-scan.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01_fix-dvbs-scan.patch deleted file mode 100644 index 3e978b04cc..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-01_fix-dvbs-scan.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2b6a0e4b41a082655516c3a276a4d74e7a61cd90 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Mon, 2 Feb 2015 13:22:36 +0200 -Subject: [PATCH] fix dvbs scan - -using first channel freq from satellites.dat is not good. ---- - scanner.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scanner.c b/scanner.c -index 0c29ac2..25d6f8a 100644 ---- a/scanner.c -+++ b/scanner.c -@@ -738,7 +738,7 @@ void cScanner::Action(void) { - break; - case SCAN_SATELLITE: - aChannel->SetTransponderData(cSource::FromString(sat_list[this_channellist].source_id), -- sat_list[this_channellist].items[0].intermediate_frequency, -+ sat_list[this_channellist].items[channel].intermediate_frequency, - sat_list[this_channellist].items[channel].symbol_rate, - *ParamsToString('S', - GetVDRPolarizationFromDVB(sat_list[this_channellist].items[0].polarization), --- -1.7.10.4 - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-02_fix-wirbelscancontrol.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-02_fix-wirbelscancontrol.patch deleted file mode 100644 index e02eb7ad7d..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/patches/vdr-plugin-wirbelscan-02_fix-wirbelscancontrol.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 4708fdeab67cae81ee7211a306c6adf0bed24d3c Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Tue, 3 Feb 2015 18:19:17 +0200 -Subject: [PATCH] fix wirbelscancontrol - ---- - common.c | 2 +- - extended_frontend.h | 7 +++---- - menusetup.c | 2 +- - 3 files changed, 5 insertions(+), 6 deletions(-) - -diff --git a/common.c b/common.c -index 04a1e6e..40194d2 100644 ---- a/common.c -+++ b/common.c -@@ -54,7 +54,7 @@ void cMySetup::InitSystems(void) { - } - - if (DVB_Type >= SCAN_NO_DEVICE || ! systems[DVB_Type]) { -- for (DVB_Type = scantype_t(SCAN_UNDEFINED + 1); DVB_Type < SCAN_NO_DEVICE; DVB_Type = scantype_t(DVB_Type + 1)) { -+ for (DVB_Type = scantype_t(SCAN_TERRESTRIAL); DVB_Type < SCAN_NO_DEVICE; DVB_Type = scantype_t(DVB_Type + 1)) { - if (systems[DVB_Type]) - break; - } -diff --git a/extended_frontend.h b/extended_frontend.h -index 680594e..bcdb11f 100644 ---- a/extended_frontend.h -+++ b/extended_frontend.h -@@ -152,13 +152,12 @@ typedef enum { - * 20120107 wirbel - */ - typedef enum { -- SCAN_UNDEFINED, -- SCAN_SATELLITE, -- SCAN_CABLE, - SCAN_TERRESTRIAL, -- SCAN_TERRCABLE_ATSC, /* I dislike this mixture of terr and cable. fix later, as it leads to problems now. */ -+ SCAN_CABLE, -+ SCAN_SATELLITE, - SCAN_PVRINPUT, - SCAN_PVRINPUT_FM, -+ SCAN_TERRCABLE_ATSC, /* I dislike this mixture of terr and cable. fix later, as it leads to problems now. */ - SCAN_NO_DEVICE, - SCAN_TRANSPONDER=999 - } scantype_t; -diff --git a/menusetup.c b/menusetup.c -index daeccb1..46087be 100644 ---- a/menusetup.c -+++ b/menusetup.c -@@ -22,7 +22,7 @@ - using namespace COUNTRY; - - static const char * ScannerDesc = "wirbelscan scan thread"; --static const char * DVB_Types[] = {"NOTHING","DVB-S/S2","DVB-C","DVB-T/T2","ATSC","pvrinput","pvrinput FM", "no device found"}; -+static const char * DVB_Types[] = {"DVB-T/T2", "DVB-C", "DVB-S/S2", "pvrinput", "pvrinput FM", "ATSC", "no device found"}; - - cMenuScanning * MenuScanning = NULL; // pointer to actual menu - cScanner * Scanner = NULL; --- -1.7.10.4 - diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/sources/Makefile b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/sources/Makefile new file mode 100644 index 0000000000..9f20a9b30b --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscan/sources/Makefile @@ -0,0 +1,84 @@ +# taken from wirbelscan-2017.06.04 backup/Makefile.old +# -- v20120526, Winfried Koehler -- + +PLUGIN = wirbelscan + +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') + +CXX ?= g++ +CXXFLAGS ?= -g -O3 -Wall -Wextra -Werror=overloaded-virtual -Wformat=2 -Wswitch-default -fstack-protector-all -D_FORTIFY_SOURCE=2 + +VDRDIR ?= ../../.. +LIBDIR ?= ../../lib +TMPDIR ?= /tmp + +include $(VDRDIR)/Make.global + +-include $(VDRDIR)/Make.config + +APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) + +ARCHIVE = $(PLUGIN)-$(VERSION) +PACKAGE = vdr-$(ARCHIVE) + +INCLUDES += -I$(VDRDIR)/include + +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' + +UNCRUSTIFY_FILES = scanner.c scanner.h scanfilter.c scanfilter.h statemachine.h statemachine.c + +OBJS = $(PLUGIN).o common.o menusetup.o satellites.o scanner.o dvb_wrapper.o +OBJS += scanfilter.o statemachine.o countries.o + +all: libvdr-$(PLUGIN).so i18n + +%.o: %.c + $(CXX) -std=c++11 $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< + +MAKEDEP = $(CXX) -MM -MG +DEPFILE = .dependencies +$(DEPFILE): Makefile + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ + +-include $(DEPFILE) + +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot + +%.mo: %.po + @msgfmt -c -o $@ $< + +$(I18Npot): $(wildcard *.c) + @xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='' -o $@ $^ + +%.po: $(I18Npot) + @msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ + +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + @cp $< $@ + +.PHONY: i18n +i18n: $(I18Nmsgs) $(I18Npot) + +libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ + @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) + +perm: + @chmod 644 *.{c,h,html} COPYING HISTORY README TODO Makefile + @chmod 755 po/ + + +dist: $(I18Npo) clean perm + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @mkdir $(TMPDIR)/$(ARCHIVE) + @cp -a * $(TMPDIR)/$(ARCHIVE) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @echo Distribution package created as $(PACKAGE).tgz + diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk index 6666276031..b1cc143419 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/package.mk @@ -1,43 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-wirbelscancontrol" PKG_VERSION="0.0.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="178c5768dd47355a42409a2cb2629f0762da1297865e3a84963684649145cb13" PKG_LICENSE="GPL" PKG_SITE="http://wirbel.htpc-forum.de/wirbelscancontrol/index2.html" PKG_URL="http://wirbel.htpc-forum.de/wirbelscancontrol/${PKG_NAME/-plugin/}-$PKG_VERSION.tgz" -PKG_SOURCE_DIR="wirbelscancontrol-${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain vdr vdr-plugin-wirbelscan" -PKG_SECTION="multimedia" -PKG_SHORTDESC="TV" -PKG_LONGDESC="TV" - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" - export CXXFLAGS="$CXXFLAGS -fPIC" - export LDFLAGS="$LDFLAGS -fPIC" -} +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="Adds menu entry for wirbelscan at VDR." +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="+pic" pre_build_target() { WIRBELSCAN_DIR=$(get_build_dir vdr-plugin-wirbelscan) @@ -50,7 +25,3 @@ make_target() { LIBDIR="." \ LOCALEDIR="./locale" } - -makeinstall_target() { - : # installation not needed, done by create-addon script -} diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-01-dont-build-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-01-dont-build-i18n.patch index 09c1a7ac93..e457bbbe7f 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-01-dont-build-i18n.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-01-dont-build-i18n.patch @@ -1,14 +1,6 @@ -From 60bb89fa8f5d29e72e06c68c0b48a374ac95d522 Mon Sep 17 00:00:00 2001 From: Stefan Saraev -Date: Mon, 9 Jun 2014 22:04:41 +0300 Subject: [PATCH] dont build i18n ---- - Makefile | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/Makefile b/Makefile -index f3ae479..89e2970 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ UNCRUSTIFY_FILES = $(PLUGIN).c scanmenu.c scanmenu.h @@ -20,6 +12,4 @@ index f3ae479..89e2970 100644 ### Implicit rules: --- -1.7.2.5 diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-02-vdr_2.3.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-02-vdr_2.3.patch new file mode 100644 index 0000000000..1c2f0379ec --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-wirbelscancontrol/patches/vdr-plugin-wirbelscancontrol-02-vdr_2.3.patch @@ -0,0 +1,59 @@ +--- a/scanmenu.c ++++ b/scanmenu.c +@@ -255,6 +255,9 @@ + { + eOSState state = cOsdMenu::ProcessKey(Key); + int direction = 0; ++#if APIVERSNUM >= 20301 ++ LOCK_CHANNELS_READ; ++#endif + switch (Key) { + case kLeft: direction = -1; + break; +@@ -268,7 +271,11 @@ + case SETSCAN: + osdstatus = SCANNING; + start = time(NULL); ++#if APIVERSNUM < 20301 + channelcount0 = Channels.Count(); ++#else ++ channelcount0 = Channels->Count(); ++#endif + SetHelp(tr("Stop"), NULL, NULL, NULL); + TransferSetup(); + PutCommand(CmdStartScan); +@@ -655,7 +662,8 @@ + sbuf = cString::sprintf("%s (%d%% transponders from scan list + %u queued)", buf, status.progress, status.nextTransponders); + ProgressBar->SetText(*sbuf); + +- if (TV1 && TV2 && TV3 && TV4 && TV5) ++#if APIVERSNUM < 20301 ++ if (TV1 && TV2 && TV3 && TV4 && TV5) { + switch (Channels.Count() - channelcount0) { + default:; + case 5: TV5->SetText(Channels.GetByNumber(Channels.Count()-4)->Name()); +@@ -665,8 +673,23 @@ + case 1: TV1->SetText(Channels.GetByNumber(Channels.Count()-0)->Name()); + case 0:; + } +- ++ } + sbuf = cString::sprintf("%s%d", tr("New channels: "), Channels.Count() - channelcount0); ++#else ++ LOCK_CHANNELS_READ; ++ if (TV1 && TV2 && TV3 && TV4 && TV5) { ++ switch (Channels->Count() - channelcount0) { ++ default:; ++ case 5: TV5->SetText(Channels->GetByNumber(Channels->Count()-4)->Name()); ++ case 4: TV4->SetText(Channels->GetByNumber(Channels->Count()-3)->Name()); ++ case 3: TV3->SetText(Channels->GetByNumber(Channels->Count()-2)->Name()); ++ case 2: TV2->SetText(Channels->GetByNumber(Channels->Count()-1)->Name()); ++ case 1: TV1->SetText(Channels->GetByNumber(Channels->Count()-0)->Name()); ++ case 0:; ++ } ++ } ++ sbuf = cString::sprintf("%s%d", tr("New channels: "), Channels->Count() - channelcount0); ++#endif + if (CH) CH->SetText(*sbuf); + + Display(); diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk index 81bb680e67..12fe25648a 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/package.mk @@ -1,41 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-plugin-xmltv2vdr" -PKG_VERSION="b48e0bec" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="ec7bd920d94e55f2d21bfa076b7e900b7b2b7537" +PKG_SHA256="eacc91062095563d8adc93873b373ddb34b076a8c0a9e5a86f6220d1d5d892e9" PKG_LICENSE="GPL" PKG_SITE="http://projects.vdr-developer.org/projects/plg-xmltv2vdr" -PKG_URL="http://projects.vdr-developer.org/git/vdr-plugin-xmltv2vdr.git/snapshot/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_URL="https://github.com/vdr-projects/vdr-plugin-xmltv2vdr/archive/${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain vdr sqlite curl libzip libxml2 libxslt enca pcre" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr-xmltv2vdr" -PKG_LONGDESC="vdr-xmltv2vdr" - -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_NEED_UNPACK="$(get_pkg_directory vdr)" +PKG_LONGDESC="xmltv2vdr imports data in xmltv format" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="+pic" pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" - export CXXFLAGS="$CXXFLAGS -fPIC -Wno-narrowing" - export LDFLAGS="$LDFLAGS -fPIC" + export CXXFLAGS="$CXXFLAGS -Wno-narrowing" export LIBS="-L$SYSROOT_PREFIX/usr/lib/iconv -lpcre -lpcrecpp" } @@ -51,9 +31,4 @@ post_make_target() { make -j1 cd - $STRIP dist/epgdata2xmltv/epgdata2xmltv - $STRIP libvdr-*.so* -} - -makeinstall_target() { - : # installation not needed, done by create-addon script } diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch index 9949e94cb7..643d1f21a6 100644 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-01_dont-build-i18n.patch @@ -1,14 +1,6 @@ -From c2121393b05a756266fe728f83eaddbd3755ce13 Mon Sep 17 00:00:00 2001 From: Stefan Saraev -Date: Mon, 16 Jun 2014 12:14:33 +0300 Subject: [PATCH] dont build i18n ---- - Makefile | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/Makefile b/Makefile -index aa344a4..819b5b0 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ OBJS = $(PLUGIN).o soundex.o extpipe.o parse.o source.o import.o event.o setup.o @@ -20,6 +12,4 @@ index aa344a4..819b5b0 100644 ### Implicit rules: --- -1.7.2.5 diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-02_gcc721_fixes.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-02_gcc721_fixes.patch new file mode 100644 index 0000000000..91d784ec8e --- /dev/null +++ b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-02_gcc721_fixes.patch @@ -0,0 +1,74 @@ +taken from https://github.com/VDR4Arch/vdr4arch/blob/vdr-stable/plugins/vdr-xmltv2vdr/xmltv2vdr_gcc721_fixes.diff +fixes + +event.cpp: In member function 'void cXMLTVEvent::GetSQL(const char*, int, const char*, char**, char**)': +event.cpp:531:5: error: 'string' was not declared in this scope + string si=sql_insert; + ^~~~~~ + +diff --git a/dist/epgdata2xmltv/epgdata2xmltv.cpp b/dist/epgdata2xmltv/epgdata2xmltv.cpp +index de6fb26..ec465fb 100644 +--- a/dist/epgdata2xmltv/epgdata2xmltv.cpp ++++ b/dist/epgdata2xmltv/epgdata2xmltv.cpp +@@ -561,7 +561,7 @@ int cepgdata2xmltv::Process(int argc, char *argv[]) + enca_analyser_free(analyser); + } + +- string s = xmlmem; ++ std::string s = xmlmem; + int reps=pcrecpp::RE("&(?![a-zA-Z]{1,8};)").GlobalReplace("%amp;",&s); + if (reps) { + xmlmem = (char *)realloc(xmlmem, s.size()+1); +diff --git a/event.cpp b/event.cpp +index ae33002..1df43ec 100644 +--- a/event.cpp ++++ b/event.cpp +@@ -528,7 +528,7 @@ void cXMLTVEvent::GetSQL(const char *Source, int SrcIdx, const char *ChannelID, + return; + } + +- string si=sql_insert; ++ std::string si=sql_insert; + int ireps; + ireps=pcrecpp::RE("'").GlobalReplace("''",&si); + ireps+=pcrecpp::RE("\\^").GlobalReplace("'",&si); +@@ -540,7 +540,7 @@ void cXMLTVEvent::GetSQL(const char *Source, int SrcIdx, const char *ChannelID, + } + *Insert=sql_insert; + +- string su=sql_update; ++ std::string su=sql_update; + int ureps; + ureps=pcrecpp::RE("'").GlobalReplace("''",&su); + ureps+=pcrecpp::RE("\\^").GlobalReplace("'",&su); +diff --git a/import.cpp b/import.cpp +index 0d6f7bf..e417c59 100644 +--- a/import.cpp ++++ b/import.cpp +@@ -1401,7 +1401,7 @@ bool cImport::UpdateXMLTVEvent(cEPGSource *Source, sqlite3 *Db, cXMLTVEvent *xEv + return false; + } + +- string ed=shortdesc; ++ std::string ed=shortdesc; + + int reps; + reps=pcrecpp::RE("'").GlobalReplace("''",&ed); +@@ -1511,7 +1511,7 @@ bool cImport::UpdateXMLTVEvent(cEPGSource *Source, sqlite3 *Db, const cEvent *Ev + return false; + } + +- string ed=eitdescription; ++ std::string ed=eitdescription; + + int reps; + reps=pcrecpp::RE("'").GlobalReplace("''",&ed); +@@ -1649,7 +1649,7 @@ cXMLTVEvent *cImport::SearchXMLTVEvent(sqlite3 **Db,const char *ChannelID, const + return NULL; + } + +- string st=sqltitle; ++ std::string st=sqltitle; + + int reps; + reps=pcrecpp::RE("'").GlobalReplace("''",&st); diff --git a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-gcc6.patch b/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-gcc6.patch deleted file mode 100644 index 8b4e7cb19a..0000000000 --- a/packages/addons/addon-depends/vdr-plugins/vdr-plugin-xmltv2vdr/patches/vdr-plugin-xmltv2vdr-gcc6.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a/import.cpp b/import.cpp ---- a/import.cpp 2016-08-23 15:16:10.362347074 +0100 -+++ b/import.cpp 2016-08-23 15:16:22.814431356 +0100 -@@ -250,7 +250,7 @@ - char *cImport::Add2Description(char *description, const char *Name, int Value) - { - char *value=NULL; -- if (asprintf(&value,"%i",Value)==-1) return false; -+ if (asprintf(&value,"%i",Value)==-1) return NULL; - description = strcatrealloc(description,Name); - description = strcatrealloc(description,": "); - description = strcatrealloc(description,value); diff --git a/packages/addons/addon-depends/vdr/package.mk b/packages/addons/addon-depends/vdr/package.mk index b35810a86d..1d1029c8f2 100644 --- a/packages/addons/addon-depends/vdr/package.mk +++ b/packages/addons/addon-depends/vdr/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr" -PKG_VERSION="2.2.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.4.0" +PKG_SHA256="93af49fe87048073dc38ef5e6c71e9704344d730f21c261afac69e3c937f8cce" PKG_LICENSE="GPL" PKG_SITE="http://www.tvdr.de" -PKG_URL="ftp://ftp.tvdr.de/vdr/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain fontconfig freetype libcap libiconv libjpeg-turbo bzip2" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vdr: A powerful DVB TV application" -PKG_LONGDESC="This project describes how to build your own digital satellite receiver and video disk recorder. It is based mainly on the DVB-S digital satellite receiver card, which used to be available from Fujitsu Siemens and the driver software developed by the LinuxTV project." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_URL="ftp://ftp.tvdr.de/vdr/vdr-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain bzip2 fontconfig freetype libcap libiconv libjpeg-turbo" +PKG_LONGDESC="A DVB TV server application." +PKG_TOOLCHAIN="manual" post_unpack() { rm -rf $PKG_BUILD/PLUGINS/src/skincurses @@ -57,7 +38,3 @@ make_target() { make vdr vdr.pc make include-dir } - -makeinstall_target() { - : # installation not needed, done by create-addon script -} diff --git a/packages/addons/addon-depends/vdr/patches/vdr-01-decrease-channels.conf-autosave-delay.patch b/packages/addons/addon-depends/vdr/patches/vdr-01-decrease-channels.conf-autosave-delay.patch new file mode 100644 index 0000000000..7b73d800e2 --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-01-decrease-channels.conf-autosave-delay.patch @@ -0,0 +1,15 @@ +From: Stefan Saraev +Subject: [PATCH] decrease channels.conf autosave delay + +--- a/vdr.c ++++ b/vdr.c +@@ -74,7 +74,7 @@ + #define SHUTDOWNCANCELPROMPT 5 // seconds to wait in user prompt to allow canceling shutdown + #define RESTARTCANCELPROMPT 5 // seconds to wait in user prompt before restarting on SIGHUP + #define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start +-#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications ++#define CHANNELSAVEDELTA 120 // seconds before saving channels.conf after automatic modifications + #define DEVICEREADYTIMEOUT 30 // seconds to wait until all devices are ready + #define MENUTIMEOUT 120 // seconds of user inactivity after which an OSD display is closed + #define TIMERCHECKDELTA 10 // seconds between checks for timers that need to see their channel + diff --git a/packages/addons/addon-depends/vdr/patches/vdr-01_disable_ca_updates.patch b/packages/addons/addon-depends/vdr/patches/vdr-01_disable_ca_updates.patch deleted file mode 100644 index 4f41d8ff1d..0000000000 --- a/packages/addons/addon-depends/vdr/patches/vdr-01_disable_ca_updates.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Nru vdr-1.7.15-vanilla/pat.c vdr-1.7.15-disable_ca_updates/pat.c ---- vdr-1.7.15-vanilla/pat.c 2010-06-06 19:11:15.000000000 +0300 -+++ vdr-1.7.15-disable_ca_updates/pat.c 2010-06-06 20:42:47.000000000 +0300 -@@ -490,6 +490,7 @@ - } - if (Setup.UpdateChannels >= 2) { - Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid); -+ if (!cSource::IsType(Channel->Source(), 'I')) - Channel->SetCaIds(CaDescriptors->CaIds()); - Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds); - } diff --git a/packages/addons/addon-depends/vdr/patches/vdr-02-disable-logspam.patch b/packages/addons/addon-depends/vdr/patches/vdr-02-disable-logspam.patch new file mode 100644 index 0000000000..fc08ebea6e --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-02-disable-logspam.patch @@ -0,0 +1,29 @@ +remove logspam +ERROR: no OSD provider available - using dummy OSD! + +--- a/osd.c ++++ b/osd.c +@@ -2027,8 +2027,6 @@ cOsd *cOsdProvider::NewOsd(int Left, int Top, uint Level) + } + return Osd; + } +- else +- esyslog("ERROR: no OSD provider available - using dummy OSD!"); + return new cOsd(Left, Top, 999); // create a dummy cOsd, so that access won't result in a segfault + } + +--- a/vdr.c ++++ b/vdr.c +@@ -765,12 +765,6 @@ int main(int argc, char *argv[]) + Folders.Load(AddDirectory(ConfigDirectory, "folders.conf")); + CamResponsesLoad(AddDirectory(ConfigDirectory, "camresponses.conf"), true); + +- if (!*cFont::GetFontFileName(Setup.FontOsd)) { +- const char *msg = "no fonts available - OSD will not show any text!"; +- fprintf(stderr, "vdr: %s\n", msg); +- esyslog("ERROR: %s", msg); +- } +- + // Recordings: + + cRecordings::Update(); diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-01-svdrp-modt-recflag.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-01-svdrp-modt-recflag.patch new file mode 100644 index 0000000000..999fe2b264 --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-01-svdrp-modt-recflag.patch @@ -0,0 +1,46 @@ +ftp://ftp.tvdr.de/vdr/Developer/Patches/vdr-2.4/ + +# This patch fixes a bug in handling the tfRecording flag in the SVDRP commands MODT +# and UPDT. The tfRecording flag must only be handled by the VDR that actually hosts +# and processes the timer. +# +--- a/svdrp.c 2018/03/19 12:16:33 5.0 ++++ b/svdrp.c 2018/04/19 09:45:08 +@@ -2036,6 +2036,7 @@ + LOCK_TIMERS_WRITE; + Timers->SetExplicitModify(); + if (cTimer *Timer = Timers->GetById(Id)) { ++ bool IsRecording = Timer->HasFlags(tfRecording); + cTimer t = *Timer; + if (strcasecmp(tail, "ON") == 0) + t.SetFlags(tfActive); +@@ -2046,6 +2047,10 @@ + return; + } + *Timer = t; ++ if (IsRecording) ++ Timer->SetFlags(tfRecording); ++ else ++ Timer->ClrFlags(tfRecording); + Timers->SetModified(); + isyslog("SVDRP %s < %s modified timer %s (%s)", Setup.SVDRPHostName, *clientName, *Timer->ToDescr(), Timer->HasFlags(tfActive) ? "active" : "inactive"); + Reply(250, "%d %s", Timer->Id(), *Timer->ToText(true)); +@@ -2478,12 +2483,18 @@ + if (Timer->Parse(Option)) { + LOCK_TIMERS_WRITE; + if (cTimer *t = Timers->GetTimer(Timer)) { ++ bool IsRecording = t->HasFlags(tfRecording); + t->Parse(Option); + delete Timer; + Timer = t; ++ if (IsRecording) ++ Timer->SetFlags(tfRecording); ++ else ++ Timer->ClrFlags(tfRecording); + isyslog("SVDRP %s < %s updated timer %s", Setup.SVDRPHostName, *clientName, *Timer->ToDescr()); + } + else { ++ Timer->ClrFlags(tfRecording); + Timers->Add(Timer); + isyslog("SVDRP %s < %s added timer %s", Setup.SVDRPHostName, *clientName, *Timer->ToDescr()); + } diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-02-invalid-locking-sequence.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-02-invalid-locking-sequence.patch new file mode 100644 index 0000000000..00db568013 --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-02-invalid-locking-sequence.patch @@ -0,0 +1,48 @@ +# This patch fixes a possible invalid locking sequence in case a remote timer handling error message +# is displayed on the OSD and the skin tries to lock the Recordings or DeletedRecordings +# list in its Flush() function (for instance by calling cVideoDiskUsage::HasChanged()). +# To do this, the call to Skins.Message() in menu.c's HandleRemoteModifications() has +# been changed to Skins.QueueMessage(), and cSkins::ProcessQueuedMessages() is now called +# unconditionally in the main loop, and checks whether the current cSkinDisplay object +# (if any) implements SetMessage(). +# +--- 1/menu.c 2018/04/14 10:24:41 5.0 ++++ 1/menu.c 2018/04/28 12:09:45 +@@ -1075,7 +1075,7 @@ + { + cString ErrorMessage; + if (!HandleRemoteTimerModifications(NewTimer, OldTimer, &ErrorMessage)) { +- Skins.Message(mtError, ErrorMessage); ++ Skins.QueueMessage(mtError, ErrorMessage); + return false; + } + return true; +--- 1/skins.c 2013/08/18 12:07:22 5.0 ++++ 1/skins.c 2018/04/28 12:13:01 +@@ -352,6 +352,14 @@ + dsyslog("cSkins::ProcessQueuedMessages() called from background thread - ignored!"); + return; + } ++ // Check whether there is a cSkinDisplay object (if any) that implements SetMessage(): ++ if (cSkinDisplay *sd = cSkinDisplay::Current()) { ++ if (!(dynamic_cast(sd) || ++ dynamic_cast(sd) || ++ dynamic_cast(sd) || ++ dynamic_cast(sd))) ++ return; ++ } + cSkinQueuedMessage *msg = NULL; + // Get the first waiting message: + queueMessageMutex.Lock(); +--- 1/vdr.c 2018/04/10 13:24:43 5.0 ++++ 1/vdr.c 2018/04/28 11:27:48 +@@ -1176,8 +1176,7 @@ + if (!Menu && !cOsd::IsOpen()) + Menu = CamControl(); + // Queued messages: +- if (!Skins.IsOpen()) +- Skins.ProcessQueuedMessages(); ++ Skins.ProcessQueuedMessages(); + // User Input: + cOsdObject *Interact = Menu ? Menu : cControl::Control(); + eKeys key = Interface->GetKey(!Interact || !Interact->NeedsFastResponse()); diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-03-locking-channel-display.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-03-locking-channel-display.patch new file mode 100644 index 0000000000..b2c1c710bf --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-03-locking-channel-display.patch @@ -0,0 +1,89 @@ +# Fixed locking the Channels list in cDisplayChannel, where the lock was still held +# when Flush() was called. +# +--- 1/menu.c 2018/04/28 12:09:45 5.1 ++++ 1/menu.c 2018/05/06 09:30:11 +@@ -4626,14 +4626,17 @@ + cOsdProvider::OsdSizeChanged(osdState); // just to get the current state + positioner = NULL; + channel = NULL; +- LOCK_CHANNELS_READ; +- channel = Channels->GetByNumber(Number); +- lastPresent = lastFollowing = NULL; +- if (channel) { +- DisplayChannel(); +- DisplayInfo(); ++ { ++ LOCK_CHANNELS_READ; ++ channel = Channels->GetByNumber(Number); ++ lastPresent = lastFollowing = NULL; ++ if (channel) { ++ DisplayChannel(); ++ DisplayInfo(); ++ } ++ } ++ if (channel) + displayChannel->Flush(); +- } + lastTime.Set(); + } + +@@ -4868,31 +4871,33 @@ + } + }; + if (positioner || !timeout || lastTime.Elapsed() < (uint64_t)(Setup.ChannelInfoTime * 1000)) { +- LOCK_CHANNELS_READ; +- if (Key == kNone && !number && group < 0 && !NewChannel && channel && channel->Number() != cDevice::CurrentChannel()) { +- // makes sure a channel switch through the SVDRP CHAN command is displayed +- channel = Channels->GetByNumber(cDevice::CurrentChannel()); +- Refresh(); +- lastTime.Set(); +- } +- DisplayInfo(); +- if (NewChannel) { +- SetTrackDescriptions(NewChannel->Number()); // to make them immediately visible in the channel display +- Channels->SwitchTo(NewChannel->Number()); +- SetTrackDescriptions(NewChannel->Number()); // switching the channel has cleared them +- channel = NewChannel; +- } +- const cPositioner *Positioner = cDevice::ActualDevice()->Positioner(); +- bool PositionerMoving = Positioner && Positioner->IsMoving(); +- SetNeedsFastResponse(PositionerMoving); +- if (!PositionerMoving) { +- if (positioner) +- lastTime.Set(); // to keep the channel display up a few seconds after the target position has been reached +- Positioner = NULL; +- } +- if (Positioner || positioner) // making sure we call SetPositioner(NULL) if there is a switch from "with" to "without" positioner +- displayChannel->SetPositioner(Positioner); +- positioner = Positioner; ++ { ++ LOCK_CHANNELS_READ; ++ if (Key == kNone && !number && group < 0 && !NewChannel && channel && channel->Number() != cDevice::CurrentChannel()) { ++ // makes sure a channel switch through the SVDRP CHAN command is displayed ++ channel = Channels->GetByNumber(cDevice::CurrentChannel()); ++ Refresh(); ++ lastTime.Set(); ++ } ++ DisplayInfo(); ++ if (NewChannel) { ++ SetTrackDescriptions(NewChannel->Number()); // to make them immediately visible in the channel display ++ Channels->SwitchTo(NewChannel->Number()); ++ SetTrackDescriptions(NewChannel->Number()); // switching the channel has cleared them ++ channel = NewChannel; ++ } ++ const cPositioner *Positioner = cDevice::ActualDevice()->Positioner(); ++ bool PositionerMoving = Positioner && Positioner->IsMoving(); ++ SetNeedsFastResponse(PositionerMoving); ++ if (!PositionerMoving) { ++ if (positioner) ++ lastTime.Set(); // to keep the channel display up a few seconds after the target position has been reached ++ Positioner = NULL; ++ } ++ if (Positioner || positioner) // making sure we call SetPositioner(NULL) if there is a switch from "with" to "without" positioner ++ displayChannel->SetPositioner(Positioner); ++ positioner = Positioner; ++ } + displayChannel->Flush(); + return osContinue; + } diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-04-locking-channel-display-2.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-04-locking-channel-display-2.patch new file mode 100644 index 0000000000..3311e664a3 --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-04-locking-channel-display-2.patch @@ -0,0 +1,18 @@ +# Fixed locking the Channels list in cDisplayChannel, where the lock was still held +# when Flush() was called (cont'd). +# +--- 1/menu.c 2018/05/06 09:30:11 5.2 ++++ 1/menu.c 2018/05/27 09:51:56 5.3 +@@ -4654,8 +4654,10 @@ + displayChannel = Skins.Current()->DisplayChannel(withInfo); + positioner = NULL; + channel = NULL; +- LOCK_CHANNELS_READ; +- channel = Channels->GetByNumber(cDevice::CurrentChannel()); ++ { ++ LOCK_CHANNELS_READ; ++ channel = Channels->GetByNumber(cDevice::CurrentChannel()); ++ } + ProcessKey(FirstKey); + } + diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-05-shutdown.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-05-shutdown.patch new file mode 100644 index 0000000000..746ec34fb2 --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-05-shutdown.patch @@ -0,0 +1,33 @@ +# Fixed shutdown after user inactivity in case a plugin is keeping the OSD open. +# +--- a/vdr.c 2018/04/28 11:27:48 5.1 ++++ b/vdr.c 2018/07/16 08:52:40 5.2 +@@ -1514,9 +1514,7 @@ + ShutdownHandler.countdown.Cancel(); + } + +- if ((Now - LastInteract) > ACTIVITYTIMEOUT && !cRecordControls::Active() && !RecordingsHandler.Active() && (Now - cRemote::LastActivity()) > ACTIVITYTIMEOUT) { +- // Handle housekeeping tasks +- ++ if (!cRecordControls::Active() && !RecordingsHandler.Active() && (Now - cRemote::LastActivity()) > ACTIVITYTIMEOUT) { + // Shutdown: + // Check whether VDR will be ready for shutdown in SHUTDOWNWAIT seconds: + time_t Soon = Now + SHUTDOWNWAIT; +@@ -1535,7 +1533,8 @@ + // Do this again a bit later: + ShutdownHandler.SetRetry(SHUTDOWNRETRY); + } +- ++ // Handle housekeeping tasks ++ if ((Now - LastInteract) > ACTIVITYTIMEOUT) { + // Disk housekeeping: + RemoveDeletedRecordings(); + ListGarbageCollector.Purge(); +@@ -1543,6 +1542,7 @@ + // Plugins housekeeping: + PluginManager.Housekeeping(); + } ++ } + + ReportEpgBugFixStats(); + diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-06-channel-switch.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-06-channel-switch.patch new file mode 100644 index 0000000000..9a8662b10c --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-06-channel-switch.patch @@ -0,0 +1,31 @@ +# Fixed switching through encrypted channels with the Up/Down keys +# +--- a/device.c 2018/03/24 09:49:14 5.0 ++++ b/device.c 2018/07/16 09:29:57 +@@ -787,6 +787,7 @@ + if (LiveView) { + isyslog("switching to channel %d %s (%s)", Channel->Number(), *Channel->GetChannelID().ToString(), Channel->Name()); + cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer ++ // and, if decrypted, this removes the now superflous PIDs from the CAM, too + } + for (int i = 3; i--;) { + switch (SetChannel(Channel, LiveView)) { +@@ -809,6 +810,7 @@ + Direction = sgn(Direction); + if (Direction) { + cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer ++ // and, if decrypted, this removes the now superflous PIDs from the CAM, too + int n = CurrentChannel() + Direction; + int first = n; + LOCK_CHANNELS_READ; +--- a/menu.c 2018/05/27 09:51:56 5.3 ++++ b/menu.c 2018/07/16 09:29:57 +@@ -4704,6 +4704,8 @@ + const cChannel *cDisplayChannel::NextAvailableChannel(const cChannel *Channel, int Direction) + { + if (Direction) { ++ cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer ++ // and, if decrypted, this removes the now superflous PIDs from the CAM, too + LOCK_CHANNELS_READ; + while (Channel) { + Channel = Direction > 0 ? Channels->Next(Channel) : Channels->Prev(Channel); diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-07-disabling-mtd.patch b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-07-disabling-mtd.patch new file mode 100644 index 0000000000..4e97a6c598 --- /dev/null +++ b/packages/addons/addon-depends/vdr/patches/vdr-10-upstream-fix-07-disabling-mtd.patch @@ -0,0 +1,13 @@ +# Now deactivating MTD support if a non MCD capable CAM is inserted after removing +# a previously used CAM that is MCD capable. +# +--- a/ci.c 2018/03/19 16:37:03 5.0 ++++ b/ci.c 2018/09/23 10:17:20 +@@ -1213,6 +1213,7 @@ + } + else { + dsyslog("CAM %d: doesn't reply to QUERY - only a single channel can be decrypted", CamSlot()->SlotNumber()); ++ CamSlot()->MtdActivate(false); + state = 4; // normal operation + } + } diff --git a/packages/addons/addon-depends/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch b/packages/addons/addon-depends/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch deleted file mode 100644 index ecdf5f22bc..0000000000 --- a/packages/addons/addon-depends/vdr/patches/vdr-10_decrease-channels.conf-autosave-delay.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 973c66c3d4e7418e53932c719b4cb3345b38da9e Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sat, 12 Oct 2013 21:40:12 +0300 -Subject: [PATCH] decrease channels.conf autosave delay - ---- - vdr.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/vdr.c b/vdr.c -index c63eeca..1fb0c57 100644 ---- a/vdr.c -+++ b/vdr.c -@@ -74,7 +74,7 @@ - #define SHUTDOWNCANCELPROMPT 5 // seconds to wait in user prompt to allow canceling shutdown - #define RESTARTCANCELPROMPT 5 // seconds to wait in user prompt before restarting on SIGHUP - #define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start --#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications -+#define CHANNELSAVEDELTA 120 // seconds before saving channels.conf after automatic modifications - #define DEVICEREADYTIMEOUT 30 // seconds to wait until all devices are ready - #define MENUTIMEOUT 120 // seconds of user inactivity after which an OSD display is closed - #define TIMERCHECKDELTA 10 // seconds between checks for timers that need to see their channel --- -1.7.2.5 - diff --git a/packages/addons/addon-depends/vdr/patches/vdr-20_Implement-H.265-frame-parser.patch b/packages/addons/addon-depends/vdr/patches/vdr-20_Implement-H.265-frame-parser.patch deleted file mode 100644 index 444ea47111..0000000000 --- a/packages/addons/addon-depends/vdr/patches/vdr-20_Implement-H.265-frame-parser.patch +++ /dev/null @@ -1,148 +0,0 @@ -From ce4d2a08e6448b7bfab68b89a12a156ed3294a63 Mon Sep 17 00:00:00 2001 -From: Thomas Reufer -Date: Mon, 28 Mar 2016 19:47:14 +0200 -Subject: [PATCH] Implement H.265 frame parser - ---- - pat.c | 1 + - remux.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- - 2 files changed, 82 insertions(+), 3 deletions(-) - -diff --git a/pat.c b/pat.c -index beb5609..bb7e5ae 100644 ---- a/pat.c -+++ b/pat.c -@@ -439,6 +439,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length - case 1: // STREAMTYPE_11172_VIDEO - case 2: // STREAMTYPE_13818_VIDEO - case 0x1B: // H.264 -+ case 0x24: // H.265 - Vpid = esPid; - Ppid = pmt.getPCRPid(); - Vtype = stream.getStreamType(); -diff --git a/remux.c b/remux.c -index 6c07efc..fe87160 100644 ---- a/remux.c -+++ b/remux.c -@@ -708,6 +708,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length) - case 0x01: // STREAMTYPE_11172_VIDEO - case 0x02: // STREAMTYPE_13818_VIDEO - case 0x1B: // H.264 -+ case 0x24: // H.265 - vpid = stream.getPid(); - vtype = stream.getStreamType(); - ppid = Pmt.getPCRPid(); -@@ -1204,16 +1205,16 @@ private: - nutSequenceParameterSet = 7, - nutAccessUnitDelimiter = 9, - }; -- cTsPayload tsPayload; - uchar byte; // holds the current byte value in case of bitwise access - int bit; // the bit index into the current byte (-1 if we're not in bit reading mode) - int zeroBytes; // the number of consecutive zero bytes (to detect 0x000003) -- uint32_t scanner; - // Identifiers written in '_' notation as in "ITU-T H.264": - bool separate_colour_plane_flag; - int log2_max_frame_num; - bool frame_mbs_only_flag; -- // -+protected: -+ cTsPayload tsPayload; -+ uint32_t scanner; - bool gotAccessUnitDelimiter; - bool gotSequenceParameterSet; - uchar GetByte(bool Raw = false); -@@ -1430,6 +1431,81 @@ void cH264Parser::ParseSliceHeader(void) - } - } - -+// --- cH265Parser ----------------------------------------------------------- -+ -+class cH265Parser : public cH264Parser { -+private: -+ enum eNalUnitType { -+ nutSliceSegmentTrailingN = 0, -+ nutSliceSegmentTrailingR = 1, -+ nutSliceSegmentTSAN = 2, -+ nutSliceSegmentTSAR = 3, -+ nutSliceSegmentSTSAN = 4, -+ nutSliceSegmentSTSAR = 5, -+ nutSliceSegmentRADLN = 6, -+ nutSliceSegmentRADLR = 7, -+ nutSliceSegmentRASLN = 8, -+ nutSliceSegmentRASLR = 9, -+ nutSliceSegmentBLAWLP = 16, -+ nutSliceSegmentBLAWRADL = 17, -+ nutSliceSegmentBLANLP = 18, -+ nutSliceSegmentIDRWRADL = 19, -+ nutSliceSegmentIDRNLP = 20, -+ nutSliceSegmentCRANUT = 21, -+ nutVideoParameterSet = 32, -+ nutSequenceParameterSet = 33, -+ nutPictureParameterSet = 34, -+ nutAccessUnitDelimiter = 35, -+ nutEndOfSequence = 36, -+ nutEndOfBitstream = 37, -+ nutFillerData = 38, -+ nutPrefixSEI = 39, -+ nutSuffixSEI = 40, -+ nutNonVCLRes0 = 41, -+ nutNonVCLRes3 = 44, -+ nutUnspecified0 = 48, -+ nutUnspecified7 = 55, -+ }; -+public: -+ cH265Parser(void); -+ virtual int Parse(const uchar *Data, int Length, int Pid); -+ }; -+ -+cH265Parser::cH265Parser(void) : -+ cH264Parser() -+{ -+} -+ -+int cH265Parser::Parse(const uchar *Data, int Length, int Pid) -+{ -+ newFrame = independentFrame = false; -+ tsPayload.Setup(const_cast(Data), Length, Pid); -+ if (TsPayloadStart(Data)) { -+ tsPayload.SkipPesHeader(); -+ scanner = EMPTY_SCANNER; -+ } -+ for (;;) { -+ scanner = (scanner << 8) | GetByte(true); -+ if ((scanner & 0xFFFFFF00) == 0x00000100) { // NAL unit start -+ uchar NalUnitType = (scanner >> 1) & 0x3F; -+ GetByte(); // nuh_layer_id + nuh_temporal_id_plus1 -+ if (NalUnitType <= nutSliceSegmentRASLR || (NalUnitType >= nutSliceSegmentBLAWLP && NalUnitType <= nutSliceSegmentCRANUT)) { -+ if (NalUnitType == nutSliceSegmentIDRWRADL || NalUnitType == nutSliceSegmentIDRNLP || NalUnitType == nutSliceSegmentCRANUT) -+ independentFrame = true; -+ if (GetBit()) { // first_slice_segment_in_pic_flag -+ newFrame = true; -+ tsPayload.Statistics(); -+ } -+ break; -+ } -+ } -+ if (tsPayload.AtPayloadStart() // stop at any new payload start to have the buffer refilled if necessary -+ || tsPayload.Eof()) // or if we're out of data -+ break; -+ } -+ return tsPayload.Used(); -+} -+ - // --- cFrameDetector -------------------------------------------------------- - - cFrameDetector::cFrameDetector(int Pid, int Type) -@@ -1463,6 +1539,8 @@ void cFrameDetector::SetPid(int Pid, int Type) - parser = new cMpeg2Parser; - else if (type == 0x1B) - parser = new cH264Parser; -+ else if (type == 0x24) -+ parser = new cH265Parser; - else if (type == 0x04 || type == 0x06) // MPEG audio or AC3 audio - parser = new cAudioParser; - else if (type != 0) --- -2.0.5 - diff --git a/packages/addons/addon-depends/vdr/patches/vdr-30_fix-dvbname-segfault.patch b/packages/addons/addon-depends/vdr/patches/vdr-30_fix-dvbname-segfault.patch deleted file mode 100644 index acb0392d08..0000000000 --- a/packages/addons/addon-depends/vdr/patches/vdr-30_fix-dvbname-segfault.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- vdr-2.2.0/dvbdevice.c.org 2015-01-14 13:09:19.000000000 +0100 -+++ vdr-2.2.0/dvbdevice.c 2016-06-25 15:50:40.619609021 +0200 -@@ -1089,6 +1089,17 @@ - NULL - }; - -+#define NUMDELIVERYSYSTEMNAMES (sizeof(DeliverySystemNames)/sizeof(*DeliverySystemNames)-1) -+ -+const char *GetDeliverySystemName(int n) -+{ -+ if (n < 0 || n >= NUMDELIVERYSYSTEMNAMES) -+ return DeliverySystemNames[0]; -+ -+ return DeliverySystemNames[n]; -+} -+ -+ - cDvbDevice::cDvbDevice(int Adapter, int Frontend) - { - adapter = Adapter; -@@ -1185,9 +1196,9 @@ - { - if (dvbTuner) { - if (dvbTuner->FrontendType() != SYS_UNDEFINED) -- return DeliverySystemNames[dvbTuner->FrontendType()]; -+ return GetDeliverySystemName(dvbTuner->FrontendType()); - if (numDeliverySystems) -- return DeliverySystemNames[deliverySystems[0]]; // to have some reasonable default -+ return GetDeliverySystemName(deliverySystems[0]); // to have some reasonable default - } - return ""; - } -@@ -1318,7 +1329,7 @@ - if (numDeliverySystems > 0) { - cString ds(""); - for (int i = 0; i < numDeliverySystems; i++) -- ds = cString::sprintf("%s%s%s", *ds, i ? "," : "", DeliverySystemNames[deliverySystems[i]]); -+ ds = cString::sprintf("%s%s%s", *ds, i ? "," : "", GetDeliverySystemName(deliverySystems[i])); - cString ms(""); - if (frontendInfo.caps & FE_CAN_QPSK) { numModulations++; ms = cString::sprintf("%s%s%s", *ms, **ms ? "," : "", MapToUserString(QPSK, ModulationValues)); } - if (frontendInfo.caps & FE_CAN_QAM_16) { numModulations++; ms = cString::sprintf("%s%s%s", *ms, **ms ? "," : "", MapToUserString(QAM_16, ModulationValues)); } diff --git a/packages/addons/addon-depends/whois/package.mk b/packages/addons/addon-depends/whois/package.mk index 140d203e34..67d36ed978 100644 --- a/packages/addons/addon-depends/whois/package.mk +++ b/packages/addons/addon-depends/whois/package.mk @@ -1,37 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) PKG_NAME="whois" PKG_VERSION="5.2.13" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="d7af1e89e7b3c63835e78bcea6c8aeb14640a3f1027f18b7b619a47100a6f2dc" PKG_LICENSE="GPL" PKG_SITE="http://www.linux.it/~md/software/" PKG_URL="https://github.com/rfc1036/whois/archive/v${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="whois is a client-side application which queries the whois directory service for information pertaining to a particular domain name." -PKG_LONGDESC="whois is a client-side application which queries the whois directory service for information pertaining to a particular domain name." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A tool that queries the whois directory service for information pertaining to a particular domain name." make_target() { make mkpasswd diff --git a/packages/addons/addon-depends/xdotool/package.mk b/packages/addons/addon-depends/xdotool/package.mk deleted file mode 100644 index 894ab8e29b..0000000000 --- a/packages/addons/addon-depends/xdotool/package.mk +++ /dev/null @@ -1,46 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="xdotool" -PKG_VERSION="2.20110530.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.semicomplete.com/projects/xdotool/" -PKG_URL="http://semicomplete.googlecode.com/files/${PKG_NAME}-${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain libXinerama libXtst" -PKG_SECTION="x11/app" -PKG_SHORTDESC="This tool lets you simulate keyboard input and mouse activity, move and resize windows, etc." -PKG_LONGDESC="This tool lets you simulate keyboard input and mouse activity, move and resize windows, etc." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - LDFLAGS="$LDFLAGS -lXext" -} - -make_target() { - make xdotool.static - mv xdotool.static xdotool -} - -makeinstall_target() { - : # nothing to do here -} diff --git a/packages/addons/browser/chrome/changelog.txt b/packages/addons/browser/chrome/changelog.txt new file mode 100644 index 0000000000..89ae8dd02e --- /dev/null +++ b/packages/addons/browser/chrome/changelog.txt @@ -0,0 +1,5 @@ +101 +- fix download url + +100 +- initial release diff --git a/packages/addons/browser/chromium/config/Xdefaults b/packages/addons/browser/chrome/config/Xdefaults similarity index 100% rename from packages/addons/browser/chromium/config/Xdefaults rename to packages/addons/browser/chrome/config/Xdefaults diff --git a/packages/addons/browser/chrome/config/pango.modules b/packages/addons/browser/chrome/config/pango.modules new file mode 100644 index 0000000000..bd3e97457d --- /dev/null +++ b/packages/addons/browser/chrome/config/pango.modules @@ -0,0 +1,13 @@ +/storage/.kodi/addons/browser.chrome/pango-modules/pango-arabic-lang.so ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-basic-fc.so BasicScriptEngineFc PangoEngineShape PangoRenderFc common: +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so guruIndicScriptEngineLang PangoEngineLang PangoRenderNone gurmukhi:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so gujrIndicScriptEngineLang PangoEngineLang PangoRenderNone gujarati:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so oryaIndicScriptEngineLang PangoEngineLang PangoRenderNone oriya:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so tamlIndicScriptEngineLang PangoEngineLang PangoRenderNone tamil:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so teluIndicScriptEngineLang PangoEngineLang PangoRenderNone telugu:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so kndaIndicScriptEngineLang PangoEngineLang PangoRenderNone kannada:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so mlymIndicScriptEngineLang PangoEngineLang PangoRenderNone malayalam:* +/storage/.kodi/addons/browser.chrome/pango-modules/pango-indic-lang.so sinhIndicScriptEngineLang PangoEngineLang PangoRenderNone sinhala:* + diff --git a/packages/addons/browser/chrome/config/pangorc b/packages/addons/browser/chrome/config/pangorc new file mode 100644 index 0000000000..49fb9237bb --- /dev/null +++ b/packages/addons/browser/chrome/config/pangorc @@ -0,0 +1,10 @@ +# +# pangorc file for uninstalled operation. If pango-viewer is run with +# this file in the current directory it will set it as PANGO_RC_FILE +# + +[Pango] +ModuleFiles = /storage/.kodi/addons/browser.chrome/config/pango.modules + +[PangoX] +AliasFiles = /storage/.kodi/addons/browser.chrome/config/pangx.aliases diff --git a/packages/addons/browser/chrome/config/pixbuf.loaders.cache b/packages/addons/browser/chrome/config/pixbuf.loaders.cache new file mode 100644 index 0000000000..9effded69b --- /dev/null +++ b/packages/addons/browser/chrome/config/pixbuf.loaders.cache @@ -0,0 +1,104 @@ +# How to generate those file +# cd /LE/build.LibreELEC-Generic/gdk-pixbuf-2.36.12/.install_pkg/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders +# cp /LE/build.LibreELEC-Generic/gdk-pixbuf-2.36.12/.install_pkg/usr/bin/gdk-pixbuf-query-loaders . +# ./gdk-pixbuf-query-loaders *.so > pixbuf.loaders.cache + + +# GdkPixbuf Image Loader Modules file +# Automatically generated file, do not edit +# Created by gdk-pixbuf-query-loaders from gdk-pixbuf-2.36.12 +# +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-ani.so" +"ani" 4 "gdk-pixbuf" "Windows animated cursor" "LGPL" +"application/x-navi-animation" "" +"ani" "" +"RIFF ACON" " xxxx " 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-bmp.so" +"bmp" 5 "gdk-pixbuf" "BMP" "LGPL" +"image/bmp" "image/x-bmp" "image/x-MS-bmp" "" +"bmp" "" +"BM" "" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-gif.so" +"gif" 4 "gdk-pixbuf" "GIF" "LGPL" +"image/gif" "" +"gif" "" +"GIF8" "" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-icns.so" +"icns" 4 "gdk-pixbuf" "MacOS X icon" "GPL" +"image/x-icns" "" +"icns" "" +"icns" "" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-ico.so" +"ico" 5 "gdk-pixbuf" "Windows icon" "LGPL" +"image/x-icon" "image/x-ico" "image/x-win-bitmap" "image/vnd.microsoft.icon" "application/ico" "image/ico" "image/icon" "text/ico" "" +"ico" "cur" "" +" \001 " "zz znz" 100 +" \002 " "zz znz" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-jpeg.so" +"jpeg" 5 "gdk-pixbuf" "JPEG" "LGPL" +"image/jpeg" "" +"jpeg" "jpe" "jpg" "" +"\377\330" "" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-png.so" +"png" 5 "gdk-pixbuf" "PNG" "LGPL" +"image/png" "" +"png" "" +"\211PNG\r\n\032\n" "" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-pnm.so" +"pnm" 4 "gdk-pixbuf" "PNM/PBM/PGM/PPM" "LGPL" +"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" "" +"pnm" "pbm" "pgm" "ppm" "" +"P1" "" 100 +"P2" "" 100 +"P3" "" 100 +"P4" "" 100 +"P5" "" 100 +"P6" "" 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-qtif.so" +"qtif" 4 "gdk-pixbuf" "QuickTime" "LGPL" +"image/x-quicktime" "image/qtif" "" +"qtif" "qif" "" +"abcdidsc" "xxxx " 100 +"abcdidat" "xxxx " 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-tga.so" +"tga" 4 "gdk-pixbuf" "Targa" "LGPL" +"image/x-tga" "" +"tga" "targa" "" +" \001\001" "x " 100 +" \001\t" "x " 100 +" \002" "xz " 99 +" \003" "xz " 100 +" \n" "xz " 100 +" \v" "xz " 100 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-tiff.so" +"tiff" 5 "gdk-pixbuf" "TIFF" "LGPL" +"image/tiff" "" +"tiff" "tif" "" +"MM *" " z " 100 +"II* " " z" 100 +"II* \020 CR\002 " " z zzz z" 0 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-xbm.so" +"xbm" 4 "gdk-pixbuf" "XBM" "LGPL" +"image/x-xbitmap" "" +"xbm" "" +"#define " "" 100 +"/*" "" 50 + +"/storage/.kodi/addons/browser.chrome/gdk-pixbuf-modules/libpixbufloader-xpm.so" +"xpm" 4 "gdk-pixbuf" "XPM" "LGPL" +"image/x-xpixmap" "" +"xpm" "" +"/* XPM */" "" 100 + + diff --git a/packages/addons/browser/chrome/icon/icon.png b/packages/addons/browser/chrome/icon/icon.png new file mode 100644 index 0000000000..0baf8a3234 Binary files /dev/null and b/packages/addons/browser/chrome/icon/icon.png differ diff --git a/packages/addons/browser/chrome/package.mk b/packages/addons/browser/chrome/package.mk new file mode 100644 index 0000000000..73126a22da --- /dev/null +++ b/packages/addons/browser/chrome/package.mk @@ -0,0 +1,102 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="chrome" +PKG_VERSION="1.0" +PKG_REV="101" +PKG_ARCH="x86_64" +PKG_LICENSE="Custom" +PKG_SITE="http://www.google.com/chrome" +PKG_DEPENDS_TARGET="toolchain at-spi2-atk atk cairo chrome-libXcomposite \ + chrome-libXdamage chrome-libXfixes chrome-libXi chrome-libXrender \ + chrome-libXtst chrome-libxcb cups gdk-pixbuf gtk3 harfbuzz \ + libXcursor libxss nss pango scrnsaverproto unclutter" +PKG_SECTION="browser" +PKG_SHORTDESC="Google Chrome Browser" +PKG_LONGDESC="Google Chrome Browser" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Chrome" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="executable" + +make_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin \ + $ADDON_BUILD/$PKG_ADDON_ID/config \ + $ADDON_BUILD/$PKG_ADDON_ID/gdk-pixbuf-modules \ + $ADDON_BUILD/$PKG_ADDON_ID/lib + + # config + cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config + + # atk + cp -PL $(get_build_dir atk)/.$TARGET_NAME/atk/libatk-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # cairo + cp -PL $(get_build_dir cairo)/.install_pkg/usr/lib/libcairo-gobject.so.2 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir cairo)/.install_pkg/usr/lib/libcairo.so.2 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # gdk-pixbuf + cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/libgdk_pixbuf-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # gdk-pixbuf modules + cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/* $ADDON_BUILD/$PKG_ADDON_ID/gdk-pixbuf-modules + + # gtk3 gdk3 + cp -PL $(get_build_dir gtk3)/.$TARGET_NAME/gtk/.libs/libgtk-3.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir gtk3)/.$TARGET_NAME/gdk/.libs/libgdk-3.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # harfbuzz + cp -PL $(get_build_dir harfbuzz)/.$TARGET_NAME/src/.libs/libharfbuzz.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir harfbuzz)/.$TARGET_NAME/src/.libs/libharfbuzz-icu.so* $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libatk-bridge + cp -PL $(get_build_dir at-spi2-atk)/.$TARGET_NAME/atk-adaptor/libatk-bridge-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libatspi + cp -PL $(get_build_dir at-spi2-core)/.$TARGET_NAME/atspi/libatspi.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libcups + cp -PL $(get_build_dir cups)/cups/libcups.so.2 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libxcb + cp -PL $(get_build_dir chrome-libxcb)/.$TARGET_NAME/src/.libs/libxcb.so.1 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXcomposite + cp -PL $(get_build_dir chrome-libXcomposite)/.$TARGET_NAME/src/.libs/libXcomposite.so.1 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXcursor + cp -PL $(get_build_dir libXcursor)/.$TARGET_NAME/src/.libs/libXcursor.so.1 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXdamage + cp -PL $(get_build_dir chrome-libXdamage)/.$TARGET_NAME/src/.libs/libXdamage.so.1 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXfixes + cp -PL $(get_build_dir chrome-libXfixes)/.$TARGET_NAME/src/.libs/libXfixes.so.3 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXi + cp -PL $(get_build_dir chrome-libXi)/.$TARGET_NAME/src/.libs/libXi.so.6 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXrender + cp -PL $(get_build_dir chrome-libXrender)/.$TARGET_NAME/src/.libs/libXrender.so.1 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libxss + cp -PL $(get_build_dir libxss)/.$TARGET_NAME/src/.libs/libXss.so.1 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # libXtst + cp -PL $(get_build_dir chrome-libXtst)/.$TARGET_NAME/src/.libs/libXtst.so.6 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # pango + cp -PL $(get_build_dir pango)/.$TARGET_NAME/pango/libpangocairo-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir pango)/.$TARGET_NAME/pango/libpango-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir pango)/.$TARGET_NAME/pango/libpangoft2-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # unclutter + cp -P $(get_build_dir unclutter)/.install_pkg/usr/bin/unclutter $ADDON_BUILD/$PKG_ADDON_ID/bin + +} diff --git a/packages/addons/browser/chrome/source/bin/chrome-downloader b/packages/addons/browser/chrome/source/bin/chrome-downloader new file mode 100644 index 0000000000..8e83ff92ca --- /dev/null +++ b/packages/addons/browser/chrome/source/bin/chrome-downloader @@ -0,0 +1,65 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon browser.chrome + +ICON=$ADDON_DIR/resources/icon.png +CONTROL_FILE=/tmp/curl.done +DATA_FILE=/tmp/curl.data + +# check for enough free disk space +if [ $(df . | awk 'END {print $4}') -lt 400000 ]; then + kodi-send --action="Notification(Not enough disk space, at least 400MB are required,30000,${ICON})" >/dev/null + exit 0; +fi + +# remove install status and folders +if [ -f $ADDON_DIR/extract.ok ]; then + rm $ADDON_DIR/extract.ok +fi + +if [ -d $ADDON_DIR/chrome-bin ]; then + rm -rf $ADDON_DIR/chrome-bin +fi + +if [ -d $ADDON_DIR/tmp_download ]; then + rm -rf $ADDON_DIR/tmp_download +fi + +# create tmp download dir +mkdir -p $ADDON_DIR/tmp_download +cd $ADDON_DIR/tmp_download + +echo "Downloading Chrome" + +# download chrome +rm -f ${CONTROL_FILE} ${DATA_FILE} +( + curl -# -O -C - https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 2>${DATA_FILE} + touch ${CONTROL_FILE} +) | \ + while [ : ]; do + [ -f ${DATA_FILE} ] && prog="$(tr '\r' '\n' < ${DATA_FILE} | tail -n 1 | sed -r 's/^[# ]+/#/;s/^[^0-9]*//g')" || prog= + kodi-send --action="Notification(Downloading Chrome,"${prog:-0.0%}",3000,${ICON})" >/dev/null + [ -f ${CONTROL_FILE} ] && break + sleep 4 + done + +rm -f ${CONTROL_FILE} ${DATA_FILE} + +## extract chrome +# extrat chrome.deb +kodi-send --action="Notification(Extracting Chrome,starting,1000,${ICON})" >/dev/null +ar -x google-chrome-stable_current_amd64.deb + +# extract data.tar.xz to chrome-bin directory +mkdir $ADDON_DIR/chrome-bin +tar xf data.tar.xz --strip-components=4 -C $ADDON_DIR/chrome-bin ./opt/google/chrome + +# cleanup +rm -rf $ADDON_DIR/tmp_download +touch $ADDON_DIR/extract.ok +kodi-send --action="Notification(Extracting Chrome,finished,1000,${ICON})" >/dev/null diff --git a/packages/addons/browser/chrome/source/bin/chrome-start b/packages/addons/browser/chrome/source/bin/chrome-start new file mode 100644 index 0000000000..093e5a8332 --- /dev/null +++ b/packages/addons/browser/chrome/source/bin/chrome-start @@ -0,0 +1,99 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) +. /etc/profile +oe_setup_addon browser.chrome + +# check if chrome is already successful installed +if [ ! -f "$ADDON_DIR/extract.ok" ]; then + cd $ADDON_DIR + chrome-downloader +fi + +if [ -e $ADDON_HOME/env ] +then + . $ADDON_HOME/env +fi + +# fix file permissons (zip packaging) +chmod +x $ADDON_DIR/chrome-bin/chrome +chmod 4755 $ADDON_DIR/chrome-bin/chrome-sandbox + +# make sure we use "own" gtk/pango/nss/etc +export LD_LIBRARY_PATH=$ADDON_DIR/lib + +# configure pango/pixbuf +export PANGO_RC_FILE=$ADDON_DIR/config/pangorc +export GDK_PIXBUF_MODULE_FILE=$ADDON_DIR/config/pixbuf.loaders.cache + +# font rendering in gtk widgets is brokeen with nvidia blob. use our Xdefaults +export XENVIRONMENT=$ADDON_DIR/config/Xdefaults + +# start unclutter +if [ "$HIDE_CURSOR" == "true" ] +then + unclutter & + UNCLUTTER_PID=$! +fi + +# vaapi +LIBVA_DRIVERS_PATH="/usr/lib/dri:$ADDON_DIR/lib" +LIBVA_DRIVER_NAME='' +case $VAAPI_MODE in + 'intel') + LIBVA_DRIVER_NAME='i965' + chrome_OPTS="$chrome_OPTS --enable-accelerated-video" + ;; + 'amd') + LIBVA_DRIVER_NAME='vdpau' + chrome_OPTS="$chrome_OPTS --enable-accelerated-video" + ;; + 'nvidia') + LIBVA_DRIVER_NAME='vdpau' + chrome_OPTS="$chrome_OPTS --enable-accelerated-video --allow-no-sandbox-job --disable-gpu-sandbox" + ;; + *) + LIBGL_ALWAYS_SOFTWARE='1' + export LIBGL_ALWAYS_SOFTWARE +esac +export LIBVA_DRIVER_NAME LIBVA_DRIVERS_PATH + +# windowed +case $WINDOW_MODE in + 'maximized') chrome_OPTS="$chrome_OPTS --start-maximized";; + 'kiosk') chrome_OPTS="$chrome_OPTS --kiosk";; +esac + +# rasterization +case $RASTER_MODE in + 'off') chrome_OPTS="$chrome_OPTS --disable-accelerated-2d-canvas --disable-gpu-compositing";; + 'force') chrome_OPTS="$chrome_OPTS --enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist";; +esac + +# alsa +if [ ! -z $ALSA_DEVICE ]; then + chrome_OPTS="$chrome_OPTS --alsa-output-device=$ALSA_DEVICE" +fi + +# HACK!!! to get sound at Chrome stop pulseaudio +systemctl stop pulseaudio + +# start chrome +LD_PRELOAD=/usr/lib/libGL.so $ADDON_DIR/chrome-bin/chrome \ + $chrome_OPTS \ + --no-sandbox \ + --user-data-dir=$ADDON_HOME/profile \ + --test-type $@ \ + 2>&1 | tee $ADDON_LOG_FILE + +# kill unclutter +if [ "$HIDE_CURSOR" == "true" ] +then + kill $UNCLUTTER_PID +fi + +# HACK!!! to get sound at Kodi start pulseaudio +sleep 5 +systemctl start pulseaudio diff --git a/packages/addons/browser/chrome/source/default.py b/packages/addons/browser/chrome/source/default.py new file mode 100644 index 0000000000..bb4c62f3ad --- /dev/null +++ b/packages/addons/browser/chrome/source/default.py @@ -0,0 +1,101 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import os +import sys +import time +import xbmcaddon +import subprocess +from xml.dom.minidom import parse + +sys.path.append('/usr/share/kodi/addons/service.libreelec.settings') + +import oe + +__addon__ = xbmcaddon.Addon(); +__path__ = os.path.join(__addon__.getAddonInfo('path'), 'bin') + '/' + +pauseXBMC = __addon__.getSetting("PAUSE_XBMC") + +def pauseXbmc(): + if pauseXBMC == "true": + xbmc.executebuiltin("PlayerControl(Stop)") + xbmc.audioSuspend() + xbmc.enableNavSounds(False) + +def resumeXbmc(): + if pauseXBMC == "true": + xbmc.audioResume() + xbmc.enableNavSounds(True) + +def startchrome(args): + try: + new_env = os.environ.copy() + new_env['VAAPI_MODE'] = __addon__.getSetting('VAAPI_MODE') + new_env['WINDOW_MODE'] = __addon__.getSetting('WINDOW_MODE') + new_env['RASTER_MODE'] = __addon__.getSetting('RASTER_MODE') + + new_env['ALSA_DEVICE'] = '' + if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true': + alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR') + else: + alsa_device = getAudioDevice() + if not alsa_device == None and not alsa_device == '': + new_env['ALSA_DEVICE'] = alsa_device + + chrome_params = args + ' ' + \ + __addon__.getSetting('HOMEPAGE') + subprocess.call(__path__ + 'chrome-start ' + chrome_params, shell=True, env=new_env) + except Exception, e: + oe.dbg_log('chrome', unicode(e)) + +def isRuning(pname): + tmp = os.popen("ps -Af").read() + pcount = tmp.count(pname) + if pcount > 0: + return True + return False + +def getAudioDevice(): + try: + dom = parse("/storage/.kodi/userdata/guisettings.xml") + audiooutput=dom.getElementsByTagName('audiooutput') + for node in audiooutput: + dev = node.getElementsByTagName('audiodevice')[0].childNodes[0].nodeValue + if dev.startswith("ALSA:"): + dev = dev.split("ALSA:")[1] + if dev == "@": + return None + if dev.startswith("@:"): + dev = dev.split("@:")[1] + else: + # not ALSA + return None + except: + return None + if dev.startswith("CARD="): + dev = "plughw:" + dev + return dev + +if (not __addon__.getSetting("firstrun")): + __addon__.setSetting("firstrun", "1") + __addon__.openSettings() + +try: + args = ' '.join(sys.argv[1:]) +except: + args = "" + +if args == 'widevine': + install_widevine() +elif args == 'flash': + install_flash() +else: + if not isRuning('chrome'): + pauseXbmc() + startchrome(args) + while isRuning('chrome'): + time.sleep(1) + resumeXbmc() + diff --git a/packages/addons/browser/chrome/source/resources/language/English/strings.po b/packages/addons/browser/chrome/source/resources/language/English/strings.po new file mode 100644 index 0000000000..c112a7613c --- /dev/null +++ b/packages/addons/browser/chrome/source/resources/language/English/strings.po @@ -0,0 +1,46 @@ +# Kodi Media Center language file +# Addon Name: chrome +# Addon id: browser.chrome +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "General" +msgstr "" + +msgctxt "#30001" +msgid "Chrome Configuration" +msgstr "" + +msgctxt "#30002" +msgid "Stop Kodi Player and Suspend AudioEngine" +msgstr "" + +msgctxt "#30003" +msgid "HW Acceleration Mode" +msgstr "" + +msgctxt "#30004" +msgid "Rasterization Mode" +msgstr "" + +msgctxt "#30005" +msgid "Window Mode" +msgstr "" + +msgctxt "#30006" +msgid "Default Homepage" +msgstr "" + +msgctxt "#30007" +msgid "Use Custom Audio Device" +msgstr "" + +msgctxt "#30008" +msgid "Audio Device" +msgstr "" + +msgctxt "#30009" +msgid "Hide Cursor" +msgstr "" diff --git a/packages/addons/browser/chrome/source/resources/settings.xml b/packages/addons/browser/chrome/source/resources/settings.xml new file mode 100644 index 0000000000..d7fa58d4cf --- /dev/null +++ b/packages/addons/browser/chrome/source/resources/settings.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/packages/addons/browser/chrome/source/settings-default.xml b/packages/addons/browser/chrome/source/settings-default.xml new file mode 100644 index 0000000000..4eace1aefb --- /dev/null +++ b/packages/addons/browser/chrome/source/settings-default.xml @@ -0,0 +1,10 @@ + + + false + https://libreelec.tv + true + default + false + intel + maximized + diff --git a/packages/addons/browser/chromium/changelog.txt b/packages/addons/browser/chromium/changelog.txt deleted file mode 100644 index fb2e3b6306..0000000000 --- a/packages/addons/browser/chromium/changelog.txt +++ /dev/null @@ -1,20 +0,0 @@ -8.1.106 -- Update to 55.0.2883.75 - -8.1.105 -- Update to 55.0.2883.44 - -8.0.104 -- Update to 53.0.2785.92 - -8.0.103 -- add xdotool - -8.0.102 -- add unclutter - -7.0.101 -- update to version 50.0.2661.75 - -7.0.100 -- initial LibreELEC release diff --git a/packages/addons/browser/chromium/config/pango.modules b/packages/addons/browser/chromium/config/pango.modules deleted file mode 100644 index 3a7ae71db4..0000000000 --- a/packages/addons/browser/chromium/config/pango.modules +++ /dev/null @@ -1,13 +0,0 @@ -/storage/.kodi/addons/browser.chromium/pango-modules/pango-arabic-lang.so ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-basic-fc.so BasicScriptEngineFc PangoEngineShape PangoRenderFc common: -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so guruIndicScriptEngineLang PangoEngineLang PangoRenderNone gurmukhi:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so gujrIndicScriptEngineLang PangoEngineLang PangoRenderNone gujarati:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so oryaIndicScriptEngineLang PangoEngineLang PangoRenderNone oriya:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so tamlIndicScriptEngineLang PangoEngineLang PangoRenderNone tamil:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so teluIndicScriptEngineLang PangoEngineLang PangoRenderNone telugu:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so kndaIndicScriptEngineLang PangoEngineLang PangoRenderNone kannada:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so mlymIndicScriptEngineLang PangoEngineLang PangoRenderNone malayalam:* -/storage/.kodi/addons/browser.chromium/pango-modules/pango-indic-lang.so sinhIndicScriptEngineLang PangoEngineLang PangoRenderNone sinhala:* - diff --git a/packages/addons/browser/chromium/config/pangorc b/packages/addons/browser/chromium/config/pangorc deleted file mode 100644 index e7a942d712..0000000000 --- a/packages/addons/browser/chromium/config/pangorc +++ /dev/null @@ -1,10 +0,0 @@ -# -# pangorc file for uninstalled operation. If pango-viewer is run with -# this file in the current directory it will set it as PANGO_RC_FILE -# - -[Pango] -ModuleFiles = /storage/.kodi/addons/browser.chromium/config/pango.modules - -[PangoX] -AliasFiles = /storage/.kodi/addons/browser.chromium/config/pangx.aliases diff --git a/packages/addons/browser/chromium/config/pixbuf.loaders.cache b/packages/addons/browser/chromium/config/pixbuf.loaders.cache deleted file mode 100644 index 62ef3707da..0000000000 --- a/packages/addons/browser/chromium/config/pixbuf.loaders.cache +++ /dev/null @@ -1,125 +0,0 @@ -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-jpeg.so" -"jpeg" 5 "gdk-pixbuf" "The JPEG image format" "LGPL" -"image/jpeg" "" -"jpeg" "jpe" "jpg" "" -"\377\330" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-ani.so" -"ani" 4 "gdk-pixbuf" "The ANI image format" "LGPL" -"application/x-navi-animation" "" -"ani" "" -"RIFF ACON" " xxxx " 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-ico.so" -"ico" 5 "gdk-pixbuf" "The ICO image format" "LGPL" -"image/x-icon" "image/x-ico" "image/x-win-bitmap" "" -"ico" "cur" "" -" \001 " "zz znz" 100 -" \002 " "zz znz" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-ras.so" -"ras" 4 "gdk-pixbuf" "The Sun raster image format" "LGPL" -"image/x-cmu-raster" "image/x-sun-raster" "" -"ras" "" -"Y\246j\225" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-jasper.so" -"jpeg2000" 4 "gdk-pixbuf" "The JPEG 2000 image format" "LGPL" -"image/jp2" "image/jpeg2000" "image/jpx" "" -"jp2" "jpc" "jpx" "j2k" "jpf" "" -" jP" "!!!! " 100 -"\377O\377Q" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-wbmp.so" -"wbmp" 4 "gdk-pixbuf" "The WBMP image format" "LGPL" -"image/vnd.wap.wbmp" "" -"wbmp" "" -" " "zz" 1 -" `" "z " 1 -" @" "z " 1 -" " "z " 1 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-png.so" -"png" 5 "gdk-pixbuf" "The PNG image format" "LGPL" -"image/png" "" -"png" "" -"\211PNG\r\n\032\n" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-pcx.so" -"pcx" 4 "gdk-pixbuf" "The PCX image format" "LGPL" -"image/x-pcx" "" -"pcx" "" -"\n \001" "" 100 -"\n\002\001" "" 100 -"\n\003\001" "" 100 -"\n\004\001" "" 100 -"\n\005\001" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-qtif.so" -"qtif" 4 "gdk-pixbuf" "The QTIF image format" "LGPL" -"image/x-quicktime" "image/qtif" "" -"qtif" "qif" "" -"abcdidsc" "xxxx " 100 -"abcdidat" "xxxx " 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-tiff.so" -"tiff" 5 "gdk-pixbuf" "The TIFF image format" "LGPL" -"image/tiff" "" -"tiff" "tif" "" -"MM *" " z " 100 -"II* " " z" 100 -"II* \020 CR\002 " " z zzz z" 0 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-icns.so" -"icns" 4 "gdk-pixbuf" "The ICNS image format" "GPL" -"image/x-icns" "" -"icns" "" -"icns" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-tga.so" -"tga" 4 "gdk-pixbuf" "The Targa image format" "LGPL" -"image/x-tga" "" -"tga" "targa" "" -" \001\001" "x " 100 -" \001\t" "x " 100 -" \002" "xz " 99 -" \003" "xz " 100 -" \n" "xz " 100 -" \v" "xz " 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-bmp.so" -"bmp" 5 "gdk-pixbuf" "The BMP image format" "LGPL" -"image/bmp" "image/x-bmp" "image/x-MS-bmp" "" -"bmp" "" -"BM" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-xbm.so" -"xbm" 4 "gdk-pixbuf" "The XBM image format" "LGPL" -"image/x-xbitmap" "" -"xbm" "" -"#define " "" 100 -"/*" "" 50 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-xpm.so" -"xpm" 4 "gdk-pixbuf" "The XPM image format" "LGPL" -"image/x-xpixmap" "" -"xpm" "" -"/* XPM */" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-pnm.so" -"pnm" 4 "gdk-pixbuf" "The PNM/PBM/PGM/PPM image format family" "LGPL" -"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" "" -"pnm" "pbm" "pgm" "ppm" "" -"P1" "" 100 -"P2" "" 100 -"P3" "" 100 -"P4" "" 100 -"P5" "" 100 -"P6" "" 100 - -"/storage/.kodi/addons/browser.chromium/gdk-pixbuf-modules/libpixbufloader-gif.so" -"gif" 4 "gdk-pixbuf" "The GIF image format" "LGPL" -"image/gif" "" -"gif" "" -"GIF8" "" 100 - diff --git a/packages/addons/browser/chromium/icon/icon.png b/packages/addons/browser/chromium/icon/icon.png deleted file mode 100644 index 033fb10f71..0000000000 Binary files a/packages/addons/browser/chromium/icon/icon.png and /dev/null differ diff --git a/packages/addons/browser/chromium/package.mk b/packages/addons/browser/chromium/package.mk index f6843953dc..86b9884635 100644 --- a/packages/addons/browser/chromium/package.mk +++ b/packages/addons/browser/chromium/package.mk @@ -1,182 +1,25 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="chromium" -PKG_VERSION="55.0.2883.75" -PKG_REV="106" +PKG_VERSION="1.0" +PKG_REV="100" PKG_ARCH="x86_64" -PKG_LICENSE="Mixed" -PKG_SITE="http://www.chromium.org/Home" -PKG_URL="https://commondatastorage.googleapis.com/chromium-browser-official/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain pciutils dbus libXcomposite libXcursor libXtst alsa-lib bzip2 yasm nss libXScrnSaver libexif ninja:host libpng harfbuzz atk gtk+ libva-vdpau-driver unclutter xdotool" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="browser" -PKG_SHORTDESC="Chromium Browser: the open-source web browser from Google" -PKG_LONGDESC="Chromium Browser ($PKG_VERSION): the open-source web browser from Google" -PKG_AUTORECONF="no" +PKG_SHORTDESC="Add-on removed" +PKG_LONGDESC="Add-on removed" +PKG_TOOLCHAIN="manual" + +PKG_ADDON_BROKEN="Chromium is no longer maintained and has been superseded by Chrome." PKG_IS_ADDON="yes" PKG_ADDON_NAME="Chromium" -PKG_ADDON_TYPE="xbmc.python.script" -PKG_ADDON_PROVIDES="executable" - -pre_make_target() { - strip_lto - - sed -i -e 's/@WIDEVINE_VERSION@/Pinkie Pie/' third_party/widevine/cdm/stub/widevine_cdm_version.h -} - -make_target() { - export LDFLAGS="$LDFLAGS -ludev" - export LD=$CXX - - # Use Python 2 - find . -name '*.py' -exec sed -i -r "s|/usr/bin/python$|$ROOT/$TOOLCHAIN/bin/python|g" {} + - - # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) - # Note: These are for OpenELEC use ONLY. For your own distribution, please - # get your own set of keys. - - _google_api_key=AIzaSyAQ6L9vt9cnN4nM0weaa6Y38K4eyPvtKgI - _google_default_client_id=740889307901-4bkm4e0udppnp1lradko85qsbnmkfq3b.apps.googleusercontent.com - _google_default_client_secret=9TJlhL661hvShQub4cWhANXa - - local _flags=( - 'is_clang=false' - 'clang_use_chrome_plugins=false' - 'symbol_level=0' - 'is_debug=false' - 'fatal_linker_warnings=false' - 'treat_warnings_as_errors=false' - 'fieldtrial_testing_like_official_build=true' - 'remove_webcore_debug_symbols=true' - 'ffmpeg_branding="Chrome"' - 'proprietary_codecs=true' - 'link_pulseaudio=true' - 'linux_use_bundled_binutils=false' - 'use_allocator="none"' - 'use_cups=false' - 'use_gconf=false' - 'use_gnome_keyring=false' - 'use_gold=false' - 'use_gtk3=false' - 'use_kerberos=false' - 'use_pulseaudio=false' - 'use_sysroot=true' - "target_sysroot=\"${SYSROOT_PREFIX}\"" - 'enable_hangout_services_extension=true' - 'enable_widevine=true' - 'enable_nacl=false' - 'enable_nacl_nonsfi=false' - "google_api_key=\"${_google_api_key}\"" - "google_default_client_id=\"${_google_default_client_id}\"" - "google_default_client_secret=\"${_google_default_client_secret}\"" - ) - - # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py - local _system_libs=( - harfbuzz-ng - libjpeg - libpng - libxslt - yasm - ) - - # Remove bundled libraries for which we will use the system copies; this - # *should* do what the remove_bundled_libraries.py script does, with the - # added benefit of not having to list all the remaining libraries - local _lib - for _lib in ${_system_libs}; do - find -type f -path "*third_party/$_lib/*" \ - \! -path "*third_party/$_lib/chromium/*" \ - \! -path "*third_party/$_lib/google/*" \ - \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ - -delete - done - - ./build/linux/unbundle/replace_gn_files.py --system-libraries "${_system_libs}" - ./third_party/libaddressinput/chromium/tools/update-strings.py - - ./tools/gn/bootstrap/bootstrap.py --gn-gen-args "${_flags[*]}" - ./out/Release/gn gen out/Release --args="${_flags[*]}" --script-executable=$ROOT/$TOOLCHAIN/bin/python - - ninja -C out/Release chrome chrome_sandbox widevinecdmadapter -} - -makeinstall_target() { - : -} +PKG_ADDON_TYPE="xbmc.broken" addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $PKG_BUILD/out/Release/chrome $ADDON_BUILD/$PKG_ADDON_ID/bin/chromium.bin - cp -P $PKG_BUILD/out/Release/chrome_sandbox $ADDON_BUILD/$PKG_ADDON_ID/bin/chrome-sandbox - cp -P $PKG_BUILD/out/Release/{*.pak,*.dat,*.bin,libwidevinecdmadapter.so} $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -PR $PKG_BUILD/out/Release/locales $ADDON_BUILD/$PKG_ADDON_ID/bin/ - cp -PR $PKG_BUILD/out/Release/gen/content/content_resources.pak $ADDON_BUILD/$PKG_ADDON_ID/bin/ - - debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin - - # config - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config - cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config - - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib - - # pango - cp -PL $(get_build_dir pango)/.install_pkg/usr/lib/libpangocairo-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -PL $(get_build_dir pango)/.install_pkg/usr/lib/libpango-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -PL $(get_build_dir pango)/.install_pkg/usr/lib/libpangoft2-1.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib - - # cairo - cp -PL $(get_build_dir cairo)/.install_pkg/usr/lib/libcairo.so.2 $ADDON_BUILD/$PKG_ADDON_ID/lib - - # gtk - cp -PL $(get_build_dir gtk+)/.install_pkg/usr/lib/libgdk-x11-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -PL $(get_build_dir gtk+)/.install_pkg/usr/lib/libgtk-x11-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib - - # harfbuzz - cp -PL $(get_build_dir harfbuzz)/.install_pkg/usr/lib/libharfbuzz.so* $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -PL $(get_build_dir harfbuzz)/.install_pkg/usr/lib/libharfbuzz-icu.so* $ADDON_BUILD/$PKG_ADDON_ID/lib - - # gdk-pixbuf - cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/libgdk_pixbuf-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib - - # pixbuf loaders - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/gdk-pixbuf-modules - cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/* $ADDON_BUILD/$PKG_ADDON_ID/gdk-pixbuf-modules - - # nss - cp -PL $(get_build_dir nss)/dist/Linux*OPT.OBJ/lib/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib - - # nspr - cp -PL $(get_build_dir nspr)/.install_pkg/usr/lib/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib - - # libexif - cp -PL $(get_build_dir libexif)/.install_pkg/usr/lib/* $ADDON_BUILD/$PKG_ADDON_ID/lib - - # libva-vdpau-driver - cp -PL $(get_build_dir libva-vdpau-driver)/.install_pkg/usr/lib/va/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib - - # unclutter - cp -P $(get_build_dir unclutter)/.install_pkg/usr/bin/unclutter $ADDON_BUILD/$PKG_ADDON_ID/bin - - # xdotool - cp -P $(get_build_dir xdotool)/xdotool $ADDON_BUILD/$PKG_ADDON_ID/bin + : } diff --git a/packages/addons/browser/chromium/patches/chromium-0001_widevine.patch b/packages/addons/browser/chromium/patches/chromium-0001_widevine.patch deleted file mode 100644 index a67ae8b1c1..0000000000 --- a/packages/addons/browser/chromium/patches/chromium-0001_widevine.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff -upr chromium-48.0.2564.82.orig/third_party/widevine/cdm/stub/widevine_cdm_version.h chromium-48.0.2564.82/third_party/widevine/cdm/stub/widevine_cdm_version.h ---- chromium-48.0.2564.82.orig/third_party/widevine/cdm/stub/widevine_cdm_version.h 2016-01-14 01:05:17.000000000 +0200 -+++ chromium-48.0.2564.82/third_party/widevine/cdm/stub/widevine_cdm_version.h 2016-01-21 19:18:51.287978456 +0200 -@@ -12,4 +12,6 @@ - - #define WIDEVINE_CDM_AVAILABLE - -+#define WIDEVINE_CDM_VERSION_STRING "@WIDEVINE_VERSION@" -+ - #endif // WIDEVINE_CDM_VERSION_H_ diff --git a/packages/addons/browser/chromium/patches/chromium-0002-unset-madv_free.patch b/packages/addons/browser/chromium/patches/chromium-0002-unset-madv_free.patch deleted file mode 100644 index 2867c79677..0000000000 --- a/packages/addons/browser/chromium/patches/chromium-0002-unset-madv_free.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -up chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.madv_free chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp ---- chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.madv_free 2016-08-15 13:07:29.279655676 -0400 -+++ chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp 2016-08-15 13:08:38.447317416 -0400 -@@ -41,6 +41,11 @@ - #include - #include - -+#if OS(LINUX) && defined(MADV_FREE) -+// Added in Linux 4.5, but it breaks the sandbox. -+#undef MADV_FREE -+#endif -+ - #ifndef MADV_FREE - #define MADV_FREE MADV_DONTNEED - #endif diff --git a/packages/addons/browser/chromium/patches/chromium-0003_oe-root-filesystem-is-readonly.patch b/packages/addons/browser/chromium/patches/chromium-0003_oe-root-filesystem-is-readonly.patch deleted file mode 100644 index 4982ee8b0b..0000000000 --- a/packages/addons/browser/chromium/patches/chromium-0003_oe-root-filesystem-is-readonly.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/sandbox/linux/suid/client/setuid_sandbox_client.cc 2015-11-13 03:04:19.000000000 -0800 -+++ b/sandbox/linux/suid/client/setuid_sandbox_client.cc 2016-01-12 22:06:26.291831672 -0800 -@@ -123,7 +123,6 @@ - - // We now consider ourselves "fully sandboxed" as far as the - // setuid sandbox is concerned. -- CHECK(IsFileSystemAccessDenied()); - sandboxed_ = true; - return true; - } diff --git a/packages/addons/browser/chromium/patches/chromium-0004-vaapi-on-linux.patch b/packages/addons/browser/chromium/patches/chromium-0004-vaapi-on-linux.patch deleted file mode 100644 index 9fdb718bd2..0000000000 --- a/packages/addons/browser/chromium/patches/chromium-0004-vaapi-on-linux.patch +++ /dev/null @@ -1,639 +0,0 @@ -Description: Enables using VA-API hardware acceleration in Linux. The patch for bpf_gpu_policy_linux.cc initially came from https://codereview.chromium.org/15955009/diff/92001/content/common/sandbox_linux/bpf_gpu_policy_linux.cc. The code in bpf_gpu_policy_linux.cc was then updated by Steven Newbury to support Nvidia drivers. - -Index: dev/chrome/browser/about_flags.cc -=================================================================== ---- dev.orig/chrome/browser/about_flags.cc -+++ dev/chrome/browser/about_flags.cc -@@ -947,7 +947,7 @@ const FeatureEntry kFeatureEntries[] = { - "disable-accelerated-video-decode", - IDS_FLAGS_ACCELERATED_VIDEO_DECODE_NAME, - IDS_FLAGS_ACCELERATED_VIDEO_DECODE_DESCRIPTION, -- kOsMac | kOsWin | kOsCrOS, -+ kOsAll, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), - }, - #if defined(USE_ASH) -Index: dev/content/common/BUILD.gn -=================================================================== ---- dev.orig/content/common/BUILD.gn -+++ dev/content/common/BUILD.gn -@@ -11,6 +11,49 @@ if (is_mac) { - import("//build/config/mac/mac_sdk.gni") - } - -+if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { -+ action("libva_generate_stubs") { -+ extra_header = "../../media/gpu/va_stub_header.fragment" -+ -+ script = "../../tools/generate_stubs/generate_stubs.py" -+ sources = [ -+ "../../media/gpu/va.sigs", -+ ] -+ inputs = [ -+ extra_header, -+ ] -+ sources += [ "../../media/gpu/va_x11.sigs" ] -+ if (use_ozone) { -+ sources += [ -+ "../../media/gpu/va_drm.sigs", -+ "va_wayland.sigs", -+ ] -+ } -+ stubs_filename_root = "va_stubs" -+ -+ outputs = [ -+ "$target_gen_dir/$stubs_filename_root.cc", -+ "$target_gen_dir/$stubs_filename_root.h", -+ ] -+ args = [ -+ "-i", -+ rebase_path("$target_gen_dir", root_build_dir), -+ "-o", -+ rebase_path("$target_gen_dir", root_build_dir), -+ "-t", -+ "posix_stubs", -+ "-e", -+ rebase_path(extra_header, root_build_dir), -+ "-s", -+ stubs_filename_root, -+ "-p", -+ "content/common", -+ ] -+ -+ args += rebase_path(sources, root_build_dir) -+ } -+} -+ - source_set("common") { - # Targets external to content should always link to the public API. - # In addition, targets outside of the content component (shell and tests) -@@ -502,6 +545,15 @@ source_set("common") { - - if (use_seccomp_bpf) { - defines += [ "USE_SECCOMP_BPF" ] -+ if (current_cpu != "arm" && is_desktop_linux) { -+ sources += get_target_outputs(":libva_generate_stubs") -+ deps += [ ":libva_generate_stubs" ] -+ configs += [ "//third_party/libva:libva_config" ] -+ if (use_ozone) { -+ configs += [ "//build/config/linux:x11" ] -+ deps += [ "//third_party/wayland:wayland_client" ] -+ } -+ } - } else { - if (is_linux) { - sources -= [ -Index: dev/content/common/sandbox_linux/bpf_gpu_policy_linux.cc -=================================================================== ---- dev.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc -+++ dev/content/common/sandbox_linux/bpf_gpu_policy_linux.cc -@@ -24,6 +24,12 @@ - #include "base/memory/ptr_util.h" - #include "base/strings/stringprintf.h" - #include "build/build_config.h" -+ -+#if !defined(__arm__) -+// Auto-generated for dlopen libva libraries -+#include "content/common/va_stubs.h" -+#endif -+ - #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" - #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" - #include "content/common/set_process_title.h" -@@ -35,6 +41,27 @@ - #include "sandbox/linux/syscall_broker/broker_process.h" - #include "sandbox/linux/system_headers/linux_syscalls.h" - -+#if !defined(__arm__) -+#include "third_party/libva/va/va.h" -+#include "third_party/libva/va/va_backend.h" -+#if defined(USE_X11) -+#include "third_party/libva/va/va_x11.h" -+#include "ui/gfx/x/x11_types.h" -+#elif defined(USE_OZONE) -+#include "third_party/libva/va/va_drm.h" -+#include "third_party/libva/va/va_drmcommon.h" -+#endif -+#endif -+ -+#define DRIVER_EXTENSION "_drv_video.so" -+#if defined(__x86_64__) -+#define VA_DRIVERS_PATH "/usr/lib/x86_64-linux-gnu/dri" -+#elif defined(__i386__) -+#define VA_DRIVERS_PATH "/usr/lib/i386-linux-gnu/dri" -+#elif defined(__aarch64__) -+#define VA_DRIVERS_PATH "/usr/lib/aarch64-linux-gnu/dri" -+#endif -+ - using sandbox::arch_seccomp_data; - using sandbox::bpf_dsl::Allow; - using sandbox::bpf_dsl::ResultExpr; -@@ -43,6 +70,17 @@ using sandbox::syscall_broker::BrokerFil - using sandbox::syscall_broker::BrokerProcess; - using sandbox::SyscallSets; - -+#if !defined(__arm__) -+using content_common::kModuleVa; -+#if defined(USE_X11) -+using content_common::kModuleVa_x11; -+#elif defined(USE_OZONE) -+using content_common::kModuleVa_drm; -+#endif -+using content_common::InitializeStubs; -+using content_common::StubPathMap; -+#endif -+ - namespace content { - - namespace { -@@ -97,7 +135,7 @@ inline bool UseLibV4L2() { - - bool IsAcceleratedVaapiVideoEncodeEnabled() { - bool accelerated_encode_enabled = false; --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - accelerated_encode_enabled = -@@ -282,6 +320,32 @@ ResultExpr GpuProcessPolicy::EvaluateSys - } - } - -+#if !defined(__arm__) -+static VADisplay VaapiGetVADisplay() { -+ StubPathMap paths; -+ VADisplay va_display; -+ paths[kModuleVa].push_back("libva.so.1"); -+#if defined(USE_OZONE) -+ paths[kModuleVa_drm].push_back("libva-drm.so.1"); -+#elif defined (USE_X11) -+ paths[kModuleVa_x11].push_back("libva-x11.so.1"); -+#endif -+ if (!InitializeStubs(paths)) { -+ return NULL; -+ } -+#if defined(USE_OZONE) -+ va_display = vaGetDisplayDRM(drm_fd_.get()); -+#elif defined(USE_X11) -+ va_display = vaGetDisplay(gfx::GetXDisplay()); -+#endif -+ if (!vaDisplayIsValid(va_display)) { -+ LOG(WARNING) << "Unable to get display."; -+ return NULL; -+ } -+ return va_display; -+} -+#endif -+ - bool GpuProcessPolicy::PreSandboxHook() { - // Warm up resources needed by the policy we're about to enable and - // eventually start a broker process. -@@ -295,32 +359,75 @@ bool GpuProcessPolicy::PreSandboxHook() - GpuBrokerProcessPolicy::Create, - std::vector()); // No extra files in whitelist. - -+#if !defined(__arm__) - if (IsArchitectureX86_64() || IsArchitectureI386()) { - // Accelerated video dlopen()'s some shared objects - // inside the sandbox, so preload them now. - if (IsAcceleratedVaapiVideoEncodeEnabled() || - IsAcceleratedVideoDecodeEnabled()) { -- const char* I965DrvVideoPath = NULL; -- const char* I965HybridDrvVideoPath = NULL; -- -- if (IsArchitectureX86_64()) { -- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; -- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so"; -- } else if (IsArchitectureI386()) { -- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; -- } -- -- dlopen(I965DrvVideoPath, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); -- if (I965HybridDrvVideoPath) -- dlopen(I965HybridDrvVideoPath, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); -- dlopen("libva.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); -+ // Init a VA Context, get driver name (and path), close context and preload -+#if defined(USE_OZONE) || defined(USE_X11) -+ VADisplay va_display = VaapiGetVADisplay(); -+ if (va_display) { -+ char *va_search_path = getenv("LIBVA_DRIVERS_PATH"); -+ char *va_driver_name = getenv("LIBVA_DRIVER_NAME"); -+ char *saveptr, *driver_dir; -+ if (!va_driver_name) { -+ VADisplayContextP pDisplayContext = -+ static_cast(va_display); -+ pDisplayContext->vaGetDriverName(pDisplayContext, &va_driver_name); -+ } -+ -+ if (!va_driver_name) { -+ return true; -+ } -+ -+ if (!va_search_path) { -+ va_search_path = strdup(VA_DRIVERS_PATH); -+ } -+ -+ driver_dir = strtok_r(va_search_path, ":", &saveptr); -+ while (driver_dir) { -+ std::string driver_path = base::StringPrintf("%s/%s%s", driver_dir, -+ va_driver_name, DRIVER_EXTENSION); -+ -+ // attempt to dlopen() the va driver -+ LOG(INFO) << "Looking for " << driver_path << "..."; -+ if (access(driver_path.c_str(), R_OK) != -1) { -+ LOG(WARNING) << "Attempting to pre-load " << va_driver_name << " VA driver..."; -+ if (dlopen(driver_path.c_str(), RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { -+ LOG(WARNING) << "VA driver \"" << driver_path << "\" opened!"; -+ -+ if (strcmp(va_driver_name, "nvidia") == 0) { -+ LOG(WARNING) << "Pre-loading NVIDIA VDPAU driver libraries..."; -+ if (dlopen("libvdpau_nvidia.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { -+ LOG(WARNING) << "Loaded libvdpau_nvidia.so"; -+ } -+ -+ if (dlopen("libvdpau.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { -+ LOG(WARNING) << "Loaded libvdpau.so"; -+ } -+ } -+ LOG(WARNING) << "Loading libva libraries..."; -+ dlopen("libva.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); - #if defined(USE_OZONE) -- dlopen("libva-drm.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); -+ dlopen("libva-drm.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); - #elif defined(USE_X11) -- dlopen("libva-x11.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); -+ dlopen("libva-x11.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); -+#endif -+ break; -+ } -+ LOG(ERROR) << "VA driver failed to open!"; -+ } -+ -+ driver_dir = strtok_r(NULL, ":", &saveptr); -+ } -+ free(va_search_path); -+ } - #endif - } - } -+#endif - - return true; - } -Index: dev/content/common/va_wayland.sigs -=================================================================== ---- /dev/null -+++ dev/content/common/va_wayland.sigs -@@ -0,0 +1,8 @@ -+// Copyright 2014 The Chromium Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+//------------------------------------------------ -+// Functions from libva-wayland used in chromium code. -+//------------------------------------------------ -+VADisplay vaGetDisplayWl(struct wl_display *display); -Index: dev/content/gpu/BUILD.gn -=================================================================== ---- dev.orig/content/gpu/BUILD.gn -+++ dev/content/gpu/BUILD.gn -@@ -91,7 +91,7 @@ target(link_target_type, "gpu_sources") - ] - } - -- if (is_chromeos && current_cpu != "arm") { -+ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { - configs += [ "//third_party/libva:libva_config" ] - } - -Index: dev/content/gpu/gpu_main.cc -=================================================================== ---- dev.orig/content/gpu/gpu_main.cc -+++ dev/content/gpu/gpu_main.cc -@@ -79,7 +79,7 @@ - #include "content/common/sandbox_mac.h" - #endif - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - #include "media/gpu/vaapi_wrapper.h" - #endif - -@@ -138,7 +138,7 @@ class ContentSandboxHelper : public gpu: - (void)base::RandUint64(); - } - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - media::VaapiWrapper::PreSandboxInitialization(); - #endif - #if defined(OS_WIN) -Index: dev/content/public/common/content_switches.cc -=================================================================== ---- dev.orig/content/public/common/content_switches.cc -+++ dev/content/public/common/content_switches.cc -@@ -985,7 +985,9 @@ const char kDisableAudioSupportForDeskto - #if defined(OS_CHROMEOS) - // Disables panel fitting (used for mirror mode). - const char kDisablePanelFitting[] = "disable-panel-fitting"; -+#endif - -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - // Disables VA-API accelerated video encode. - const char kDisableVaapiAcceleratedVideoEncode[] = - "disable-vaapi-accelerated-video-encode"; -Index: dev/content/public/common/content_switches.h -=================================================================== ---- dev.orig/content/public/common/content_switches.h -+++ dev/content/public/common/content_switches.h -@@ -288,6 +288,8 @@ CONTENT_EXPORT extern const char kEnable - - #if defined(OS_CHROMEOS) - CONTENT_EXPORT extern const char kDisablePanelFitting[]; -+#endif -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[]; - #endif - -Index: dev/gpu/config/software_rendering_list_json.cc -=================================================================== ---- dev.orig/gpu/config/software_rendering_list_json.cc -+++ dev/gpu/config/software_rendering_list_json.cc -@@ -415,17 +415,6 @@ const char kSoftwareRenderingListJson[] - ] - }, - { -- "id": 48, -- "description": "Accelerated video decode is unavailable on Linux", -- "cr_bugs": [137247], -- "os": { -- "type": "linux" -- }, -- "features": [ -- "accelerated_video_decode" -- ] -- }, -- { - "id": 50, - "description": "Disable VMware software renderer on older Mesa", - "cr_bugs": [145531, 332596, 571899], -Index: dev/media/BUILD.gn -=================================================================== ---- dev.orig/media/BUILD.gn -+++ dev/media/BUILD.gn -@@ -370,7 +370,7 @@ component("media") { - allow_circular_includes_from = [ "//media/base/android" ] - } - -- if (current_cpu != "arm" && is_chromeos) { -+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) { - sources += [ - "filters/h264_bitstream_buffer.cc", - "filters/h264_bitstream_buffer.h", -@@ -653,7 +653,7 @@ test("media_unittests") { - } - } - -- if (current_cpu != "arm" && is_chromeos) { -+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) { - sources += [ "filters/h264_bitstream_buffer_unittest.cc" ] - } - -Index: dev/media/gpu/BUILD.gn -=================================================================== ---- dev.orig/media/gpu/BUILD.gn -+++ dev/media/gpu/BUILD.gn -@@ -12,7 +12,7 @@ if (is_mac) { - import("//build/config/mac/mac_sdk.gni") - } - --if (is_chromeos && current_cpu != "arm") { -+if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { - action("libva_generate_stubs") { - extra_header = "va_stub_header.fragment" - -@@ -238,7 +238,7 @@ component("gpu") { - } - } - -- if (is_chromeos) { -+ if (is_linux) { - sources += [ - "accelerated_video_decoder.h", - "h264_decoder.cc", -@@ -281,7 +281,7 @@ component("gpu") { - "GLESv2", - ] - } -- if (current_cpu == "arm") { -+ if (current_cpu == "arm" && is_chromeos) { - sources += [ - "tegra_v4l2_device.cc", - "tegra_v4l2_device.h", -Index: dev/media/gpu/gpu_video_decode_accelerator_factory.cc -=================================================================== ---- dev.orig/media/gpu/gpu_video_decode_accelerator_factory.cc -+++ dev/media/gpu/gpu_video_decode_accelerator_factory.cc -@@ -14,7 +14,7 @@ - #include "media/gpu/dxva_video_decode_accelerator_win.h" - #elif defined(OS_MACOSX) - #include "media/gpu/vt_video_decode_accelerator_mac.h" --#elif defined(OS_CHROMEOS) -+#elif defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(USE_V4L2_CODEC) - #include "media/gpu/v4l2_device.h" - #include "media/gpu/v4l2_slice_video_decode_accelerator.h" -@@ -79,7 +79,7 @@ GpuVideoDecodeAcceleratorFactory::GetDec - #if defined(OS_WIN) - capabilities.supported_profiles = - DXVAVideoDecodeAccelerator::GetSupportedProfiles(gpu_preferences); --#elif defined(OS_CHROMEOS) -+#elif defined(OS_CHROMEOS) || defined(OS_LINUX) - VideoDecodeAccelerator::SupportedProfiles vda_profiles; - #if defined(USE_V4L2_CODEC) - vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); -@@ -131,7 +131,7 @@ GpuVideoDecodeAcceleratorFactory::Create - &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, - &GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA, - #endif --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, - #endif - #if defined(OS_MACOSX) -@@ -199,11 +199,12 @@ GpuVideoDecodeAcceleratorFactory::Create - } - #endif - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - std::unique_ptr - GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA( - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const { -+ VLOG(1) << "Creating new VAAPI video decode accelerator."; - std::unique_ptr decoder; - decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_, - bind_image_cb_)); -Index: dev/media/gpu/gpu_video_decode_accelerator_factory.h -=================================================================== ---- dev.orig/media/gpu/gpu_video_decode_accelerator_factory.h -+++ dev/media/gpu/gpu_video_decode_accelerator_factory.h -@@ -98,7 +98,7 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcc - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const; - #endif --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - std::unique_ptr CreateVaapiVDA( - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const; -Index: dev/media/gpu/ipc/service/BUILD.gn -=================================================================== ---- dev.orig/media/gpu/ipc/service/BUILD.gn -+++ dev/media/gpu/ipc/service/BUILD.gn -@@ -45,7 +45,7 @@ target(link_target_type, "service") { - - configs += [ "//media/gpu:gpu_config" ] - -- if (is_chromeos && current_cpu != "arm") { -+ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { - configs += [ "//third_party/libva:libva_config" ] - } - -Index: dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc -=================================================================== ---- dev.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc -+++ dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc -@@ -58,7 +58,7 @@ static bool MakeDecoderContextCurrent( - return true; - } - --#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) -+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) - static bool BindImage(const base::WeakPtr& stub, - uint32_t client_texture_id, - uint32_t texture_target, -@@ -171,7 +171,7 @@ GpuVideoDecodeAccelerator::GpuVideoDecod - get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); - make_context_current_cb_ = - base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); --#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) -+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) - bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); - #endif - get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr()); -Index: dev/media/gpu/va_stub_header.fragment -=================================================================== ---- dev.orig/media/gpu/va_stub_header.fragment -+++ dev/media/gpu/va_stub_header.fragment -@@ -5,8 +5,9 @@ extern "C" { - - #include "third_party/libva/va/drm/va_drm.h" - #include "third_party/libva/va/va.h" --#if defined(USE_X11) - #include "third_party/libva/va/va_x11.h" -+#if defined(USE_OZONE) -+#include "third_party/libva/va/wayland/va_wayland.h" - #endif - - } -Index: dev/media/gpu/vaapi_video_decode_accelerator.cc -=================================================================== ---- dev.orig/media/gpu/vaapi_video_decode_accelerator.cc -+++ dev/media/gpu/vaapi_video_decode_accelerator.cc -@@ -359,17 +359,17 @@ bool VaapiVideoDecodeAccelerator::Initia - - base::AutoLock auto_lock(lock_); - DCHECK_EQ(state_, kUninitialized); -- DVLOG(2) << "Initializing VAVDA, profile: " << profile; -+ VLOG(1) << "Initializing VAVDA, profile: " << profile; - - #if defined(USE_X11) - if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { -- DVLOG(1) << "HW video decode acceleration not available without " -+ VLOG(1) << "HW video decode acceleration not available without " - "DesktopGL (GLX)."; - return false; - } - #elif defined(USE_OZONE) - if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { -- DVLOG(1) << "HW video decode acceleration not available without " -+ VLOG(1) << "HW video decode acceleration not available without " - << "EGLGLES2."; - return false; - } -@@ -379,7 +379,7 @@ bool VaapiVideoDecodeAccelerator::Initia - VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); - - if (!vaapi_wrapper_.get()) { -- DVLOG(1) << "Failed initializing VAAPI for profile " << profile; -+ VLOG(1) << "Failed initializing VAAPI for profile " << profile; - return false; - } - -@@ -394,7 +394,7 @@ bool VaapiVideoDecodeAccelerator::Initia - vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); - decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); - } else { -- DLOG(ERROR) << "Unsupported profile " << profile; -+ VLOG(1) << "Unsupported profile " << profile; - return false; - } - -Index: dev/media/gpu/vaapi_wrapper.cc -=================================================================== ---- dev.orig/media/gpu/vaapi_wrapper.cc -+++ dev/media/gpu/vaapi_wrapper.cc -@@ -194,7 +194,7 @@ scoped_refptr VaapiWrapper - VAProfile va_profile, - const base::Closure& report_error_to_uma_cb) { - if (!profile_infos_.Get().IsProfileSupported(mode, va_profile)) { -- DVLOG(1) << "Unsupported va_profile: " << va_profile; -+ VLOG(1) << "Unsupported va_profile: " << va_profile; - return nullptr; - } - -@@ -347,15 +347,17 @@ VaapiWrapper::GetSupportedProfileInfosFo - bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) { - static bool vaapi_functions_initialized = PostSandboxInitialization(); - if (!vaapi_functions_initialized) { -- bool running_on_chromeos = false; --#if defined(OS_CHROMEOS) -+ bool error_level_logging = false; -+#if defined(OS_LINUX) -+ error_level_logging = true; -+#elif defined(OS_CHROMEOS) - // When chrome runs on linux with chromeos=1, do not log error message - // without VAAPI libraries. -- running_on_chromeos = base::SysInfo::IsRunningOnChromeOS(); -+ error_level_logging = base::SysInfo::IsRunningOnChromeOS(); - #endif - static const char kErrorMsg[] = "Failed to initialize VAAPI libs"; -- if (running_on_chromeos) -- LOG(ERROR) << kErrorMsg; -+ if (error_level_logging) -+ VLOG(1) << kErrorMsg; - else - DVLOG(1) << kErrorMsg; - return false; -@@ -421,7 +423,7 @@ bool VaapiWrapper::IsEntrypointSupported - - if (std::find(supported_entrypoints.begin(), supported_entrypoints.end(), - entrypoint) == supported_entrypoints.end()) { -- DVLOG(1) << "Unsupported entrypoint"; -+ VLOG(1) << "Unsupported entrypoint"; - return false; - } - return true; -@@ -445,8 +447,8 @@ bool VaapiWrapper::AreAttribsSupported_L - if (attribs[i].type != required_attribs[i].type || - (attribs[i].value & required_attribs[i].value) != - required_attribs[i].value) { -- DVLOG(1) << "Unsupported value " << required_attribs[i].value -- << " for attribute type " << required_attribs[i].type; -+ VLOG(1) << "Unsupported value " << required_attribs[i].value -+ << " for attribute type " << required_attribs[i].type; - return false; - } - } diff --git a/packages/addons/browser/chromium/patches/chromium-0005-use-toolchain-prefix.patch b/packages/addons/browser/chromium/patches/chromium-0005-use-toolchain-prefix.patch deleted file mode 100644 index 3eada8d438..0000000000 --- a/packages/addons/browser/chromium/patches/chromium-0005-use-toolchain-prefix.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/build/toolchain/linux/BUILD.gn 2016-11-09 19:49:39.000000000 -0800 -+++ b/build/toolchain/linux/BUILD.gn 2016-11-10 20:33:18.200587987 -0800 -@@ -102,13 +102,14 @@ - } - - gcc_toolchain("x64") { -- cc = "gcc" -- cxx = "g++" -+ toolprefix = "x86_64-libreelec-linux-gnu-" -+ cc = "${toolprefix}gcc" -+ cxx = "${toolprefix}g++" - -- readelf = "readelf" -- nm = "nm" -- ar = "ar" -+ ar = "${toolprefix}ar" - ld = cxx -+ readelf = "${toolprefix}readelf" -+ nm = "${toolprefix}nm" - - toolchain_args = { - current_cpu = "x64" diff --git a/packages/addons/browser/chromium/patches/chromium-0007-dont-link-atomic-in-gn.patch b/packages/addons/browser/chromium/patches/chromium-0007-dont-link-atomic-in-gn.patch deleted file mode 100644 index f547fac5bb..0000000000 --- a/packages/addons/browser/chromium/patches/chromium-0007-dont-link-atomic-in-gn.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py ---- a/tools/gn/bootstrap/bootstrap.py 2016-10-20 15:02:19.000000000 -0700 -+++ b/tools/gn/bootstrap/bootstrap.py 2016-11-10 09:26:36.026611661 -0800 -@@ -563,7 +563,7 @@ - } - - if is_linux: -- libs.extend(['-lrt', '-latomic']) -+ libs.extend(['-lrt']) - ldflags.extend(['-pthread']) - - static_libraries['xdg_user_dirs'] = { diff --git a/packages/addons/browser/chromium/source/bin/chromium b/packages/addons/browser/chromium/source/bin/chromium deleted file mode 100644 index e0c7549cd1..0000000000 --- a/packages/addons/browser/chromium/source/bin/chromium +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. /etc/profile -oe_setup_addon browser.chromium - -# make sure we use "own" gtk/pango/nss/etc -export LD_LIBRARY_PATH=/storage/.kodi/addons/browser.chromium/lib - -# configure pango/pixbuf -export PANGO_RC_FILE=/storage/.kodi/addons/browser.chromium/config/pangorc -export GDK_PIXBUF_MODULE_FILE=/storage/.kodi/addons/browser.chromium/config/pixbuf.loaders.cache - -# font rendering in gtk widgets is brokeen with nvidia blob. use our Xdefaults -export XENVIRONMENT=/storage/.kodi/addons/browser.chromium/config/Xdefaults - -# start unclutter -if [ "$HIDE_CURSOR" == "true" ] -then - unclutter & - UNCLUTTER_PID=$! -fi - -# start chromium -LD_PRELOAD=/usr/lib/libGL.so /storage/.kodi/addons/browser.chromium/bin/chromium.bin \ - --user-data-dir=/storage/.kodi/userdata/addon_data/browser.chromium/profile \ - --test-type $@ - -# kill unclutter -if [ "$HIDE_CURSOR" == "true" ] -then - kill $UNCLUTTER_PID -fi diff --git a/packages/addons/browser/chromium/source/default.py b/packages/addons/browser/chromium/source/default.py deleted file mode 100644 index 973acfcc13..0000000000 --- a/packages/addons/browser/chromium/source/default.py +++ /dev/null @@ -1,199 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -import os -import sys -import time -import xbmcaddon -import subprocess -from xml.dom.minidom import parse - -sys.path.append('/usr/share/kodi/addons/service.libreelec.settings') - -import oe - -__addon__ = xbmcaddon.Addon(); -__path__ = os.path.join(__addon__.getAddonInfo('path'), 'bin') + '/' - -pauseXBMC = __addon__.getSetting("PAUSE_XBMC") - -# widevine and flash stuff -def install_flash(): - __url__ = 'https://fpdownload.adobe.com/pub/flashplayer/pdc/24.0.0.186/flash_player_ppapi_linux.x86_64.tar.gz' - __file__ = __url__.split('/')[-1] - __tmp__ = '/tmp/pepperflash/' - __lib__ = 'libpepflashplayer.so' - try: - if not os.path.isdir(__tmp__): - os.mkdir(__tmp__) - if not os.path.exists(__tmp__ + __file__): - oe.download_file(__url__, __tmp__ + __file__) - if not os.path.exists(__tmp__ + __file__): - oe.notify('Chromium', 'Could not download file') - else: - oe.notify('Chromium', 'Extracting libpepflashplayer.so') - if not os.path.isdir(__tmp__ + __file__): - oe.execute('tar zxf ' + __tmp__ + __file__ + ' -C ' + __tmp__ + '') - if not os.path.isdir(__path__ + 'PepperFlash'): - os.mkdir(__path__ + 'PepperFlash') - oe.copy_file(__tmp__ + __lib__, __path__ + 'PepperFlash/' + __lib__) - oe.notify('Chromium', 'Installation of libpepflashplayer.so succeeded') - except Exception, e: - oe.notify('Chromium', 'Installation of libpepflashplayer.so failed') - -def install_widevine(): - __url__ = 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb' - __file__ = __url__.split('/')[-1] - __tar__ = 'data.tar.xz' - __tmp__ = '/tmp/widevine/' - __lib__ = 'opt/google/chrome/libwidevinecdm.so' - try: - if not os.path.isdir(__tmp__): - os.mkdir(__tmp__) - if not os.path.exists(__tmp__ + __file__): - oe.download_file(__url__, __tmp__ + __file__) - if not os.path.exists(__tmp__ + __file__): - oe.notify('Chromium', 'Could not download file') - else: - oe.notify('Chromium', 'Extracting libwidevinecdm.so') - if not os.path.isdir(__tmp__ + __tar__): - oe.execute('cd ' + __tmp__ + ' && ar -x ' + __file__) - oe.execute('tar xf ' + __tmp__ + __tar__ + ' -C ' + __tmp__ + ' ./' + __lib__) - oe.copy_file(__tmp__ + __lib__, __path__ + __lib__.split('/')[-1]) - oe.notify('Chromium', 'Installation of libwidevinecdm.so succeeded') - except Exception, e: - oe.notify('Chromium', 'Installation of libwidevinecdm.so failed') - -def pauseXbmc(): - if pauseXBMC == "true": - xbmc.executebuiltin("PlayerControl(Stop)") - xbmc.audioSuspend() - xbmc.enableNavSounds(False) - -def resumeXbmc(): - if pauseXBMC == "true": - xbmc.audioResume() - xbmc.enableNavSounds(True) - -def startChromium(args): - oe.execute('chmod +x ' + __path__ + 'chromium') - oe.execute('chmod +x ' + __path__ + 'chromium.bin') - oe.execute('chmod 4755 ' + __path__ + 'chrome-sandbox') - - try: - window_mode = { - 'maximized': '--start-maximized', - 'kiosk': '--kiosk', - 'none': '', - } - - raster_mode = { - 'default': '', - 'off': '--disable-accelerated-2d-canvas --disable-gpu-compositing', - 'force': '--enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist', - } - - new_env = os.environ.copy() - vaapi_mode = __addon__.getSetting('VAAPI_MODE') - gpu_accel_mode = '' - if vaapi_mode == 'intel': - new_env['LIBVA_DRIVERS_PATH'] = '/usr/lib/va' - new_env['LIBVA_DRIVER_NAME'] = 'i965' - elif vaapi_mode == 'amd': - new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib') - new_env['LIBVA_DRIVER_NAME'] = 'vdpau' - elif vaapi_mode == 'nvidia': - new_env['LIBVA_DRIVERS_PATH'] = os.path.join(__addon__.getAddonInfo('path'), 'lib') - new_env['LIBVA_DRIVER_NAME'] = 'vdpau' - gpu_accel_mode = '--allow-no-sandbox-job --disable-gpu-sandbox' - else: - new_env['LIBGL_ALWAYS_SOFTWARE'] = '1' - - flash_plugin = '' - if os.path.exists(__path__ + 'PepperFlash/libpepflashplayer.so'): - flash_plugin = '--ppapi-flash-path=' + __path__ + 'PepperFlash/libpepflashplayer.so' - - if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true': - alsa_device = __addon__.getSetting('CUST_AUDIODEVICE_STR') - else: - alsa_device = getAudioDevice() - alsa_param = '' - if not alsa_device == None and not alsa_device == '': - alsa_param = '--alsa-output-device=' + alsa_device - - chrome_params = window_mode.get(__addon__.getSetting('WINDOW_MODE')) + ' ' + \ - raster_mode.get(__addon__.getSetting('RASTER_MODE')) + ' ' + \ - flash_plugin + ' ' + \ - gpu_accel_mode + ' ' + \ - alsa_param + ' ' + \ - args + ' ' + \ - __addon__.getSetting('HOMEPAGE') - subprocess.call(__path__ + 'chromium ' + chrome_params, shell=True, env=new_env) - except Exception, e: - oe.dbg_log('chromium', unicode(e)) - -def isRuning(pname): - tmp = os.popen("ps -Af").read() - pcount = tmp.count(pname) - if pcount > 0: - return True - return False - -def getAudioDevice(): - try: - dom = parse("/storage/.kodi/userdata/guisettings.xml") - audiooutput=dom.getElementsByTagName('audiooutput') - for node in audiooutput: - dev = node.getElementsByTagName('audiodevice')[0].childNodes[0].nodeValue - if dev.startswith("ALSA:"): - dev = dev.split("ALSA:")[1] - if dev == "@": - return None - if dev.startswith("@:"): - dev = dev.split("@:")[1] - else: - # not ALSA - return None - except: - return None - if dev.startswith("CARD="): - dev = "plughw:" + dev - return dev - -if (not __addon__.getSetting("firstrun")): - __addon__.setSetting("firstrun", "1") - __addon__.openSettings() - -try: - args = ' '.join(sys.argv[1:]) -except: - args = "" - -if args == 'widevine': - install_widevine() -elif args == 'flash': - install_flash() -else: - if not isRuning('chromium.bin'): - pauseXbmc() - startChromium(args) - while isRuning('chromium.bin'): - time.sleep(1) - resumeXbmc() diff --git a/packages/addons/browser/chromium/source/resources/language/English/strings.xml b/packages/addons/browser/chromium/source/resources/language/English/strings.xml deleted file mode 100644 index c3837d366d..0000000000 --- a/packages/addons/browser/chromium/source/resources/language/English/strings.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - General - Actions - Chromium Configuration - Stop Kodi Player and Suspend AudioEngine - HW Acceleration Mode - Rasterization Mode - Window Mode - Default Homepage - Use Custom Audio Device - Audio Device - Hide Cursor - Chromium Actions - Install libwidevinecdm.so (Netflix Support) - Install libpepflashplayer.so (Flash Player Support) - diff --git a/packages/addons/browser/chromium/source/resources/settings.xml b/packages/addons/browser/chromium/source/resources/settings.xml deleted file mode 100644 index 670c222fca..0000000000 --- a/packages/addons/browser/chromium/source/resources/settings.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/addons/driver/hdhomerun/package.mk b/packages/addons/driver/hdhomerun/package.mk index 8acc739c0a..924d5678bd 100644 --- a/packages/addons/driver/hdhomerun/package.mk +++ b/packages/addons/driver/hdhomerun/package.mk @@ -1,24 +1,9 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="hdhomerun" PKG_VERSION="7.0" -PKG_REV="100" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.silicondust.com/products/hdhomerun/dvbt/" @@ -27,19 +12,11 @@ PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="driver/dvb" PKG_SHORTDESC="HDHomeRun: a Linux driver to add support for HDHomeRun from silicondust.com" PKG_LONGDESC="Install this to add support for HDHomeRun devices." +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="HDHomeRun" PKG_ADDON_TYPE="xbmc.python.script" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to do here -} - -makeinstall_target() { - : # nothing to do here -} addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/ diff --git a/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh b/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh index 71f6e56b7e..2acb365ce1 100644 --- a/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh +++ b/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) . /etc/profile @@ -51,7 +36,15 @@ if [ ! -f "$HDHR_ADDON_SETTINGS" ]; then fi mkdir -p /var/config -cat "$HDHR_ADDON_SETTINGS" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/hdhomerun-addon.conf + +# check settings version +XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $HDHR_ADDON_SETTINGS)" +if [ "$XML_SETTINGS_VER" = "2" ]; then + xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$HDHR_ADDON_SETTINGS" > /var/config/hdhomerun-addon.conf +else + xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$HDHR_ADDON_SETTINGS" > /var/config/hdhomerun-addon.conf +fi + . /var/config/hdhomerun-addon.conf if [ -z "$(pidof userhdhomerun)" ]; then diff --git a/packages/addons/driver/hdhomerun/source/default.py b/packages/addons/driver/hdhomerun/source/default.py index cd40a7231e..4bcd7d2e7e 100644 --- a/packages/addons/driver/hdhomerun/source/default.py +++ b/packages/addons/driver/hdhomerun/source/default.py @@ -1,17 +1,2 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) diff --git a/packages/addons/driver/hdhomerun/source/resources/actions.py b/packages/addons/driver/hdhomerun/source/resources/actions.py index c0f230103c..ca6d98c455 100644 --- a/packages/addons/driver/hdhomerun/source/resources/actions.py +++ b/packages/addons/driver/hdhomerun/source/resources/actions.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) import os import sys diff --git a/packages/addons/driver/hdhomerun/source/resources/lib/functions.py b/packages/addons/driver/hdhomerun/source/resources/lib/functions.py index 2904cc4acd..341d1b7e49 100644 --- a/packages/addons/driver/hdhomerun/source/resources/lib/functions.py +++ b/packages/addons/driver/hdhomerun/source/resources/lib/functions.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) import os import sys diff --git a/packages/addons/driver/hdhomerun/source/sleep.d/99-hdhomerun.power b/packages/addons/driver/hdhomerun/source/sleep.d/99-hdhomerun.power index 7c7b7400d8..a84c4b10ad 100644 --- a/packages/addons/driver/hdhomerun/source/sleep.d/99-hdhomerun.power +++ b/packages/addons/driver/hdhomerun/source/sleep.d/99-hdhomerun.power @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/driver/imon-mce/package.mk b/packages/addons/driver/imon-mce/package.mk index f12a0cd3a1..c5c9280ee2 100644 --- a/packages/addons/driver/imon-mce/package.mk +++ b/packages/addons/driver/imon-mce/package.mk @@ -1,24 +1,9 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="imon-mce" PKG_VERSION="7.0" -PKG_REV="100" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="https://libreelec.tv" @@ -27,20 +12,12 @@ PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="driver/remote" PKG_SHORTDESC="iMON-MCE: a Linux driver to add support for MCE remotes to the iMON driver" PKG_LONGDESC="Install this to add support for iMon MCE remote controls." +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="iMON-MCE" PKG_ADDON_TYPE="xbmc.service" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to do here -} - -makeinstall_target() { - : # nothing to do here -} addon() { - : # nothing to do here + : } diff --git a/packages/addons/driver/imon-mce/source/bin/imon-mce.service b/packages/addons/driver/imon-mce/source/bin/imon-mce.service index 2bd14026c4..ed95e7589f 100755 --- a/packages/addons/driver/imon-mce/source/bin/imon-mce.service +++ b/packages/addons/driver/imon-mce/source/bin/imon-mce.service @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/driver/imon-mce/source/default.py b/packages/addons/driver/imon-mce/source/default.py index e1d46ceee1..7954985136 100644 --- a/packages/addons/driver/imon-mce/source/default.py +++ b/packages/addons/driver/imon-mce/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) import os import sys diff --git a/packages/addons/driver/sapphire/changelog.txt b/packages/addons/driver/sapphire/changelog.txt index 394f45512d..9f110dbab2 100644 --- a/packages/addons/driver/sapphire/changelog.txt +++ b/packages/addons/driver/sapphire/changelog.txt @@ -1,8 +1,14 @@ -8.0.102 +104 +- Update to 6.9 + +103 +- Rebuild driver against 4.14 kernel + +102 - Rebuild driver against 4.8 kernel -8.0.101 +101 - Rebuild driver against 4.7 kernel -8.0.100 +100 - Initial add-on diff --git a/packages/addons/driver/sapphire/package.mk b/packages/addons/driver/sapphire/package.mk index 6c7280425a..816f580a1e 100644 --- a/packages/addons/driver/sapphire/package.mk +++ b/packages/addons/driver/sapphire/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="sapphire" -PKG_VERSION="6.6" -PKG_REV="102" +PKG_VERSION="7.1" +PKG_SHA256="24c662c45c581f8fe395d1cdcd6e1dca3db9e0eb590433f39de6037b2d4c5764" +PKG_REV="105" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="https://libreelec.tv" @@ -27,11 +13,12 @@ PKG_DEPENDS_TARGET="toolchain linux bash" PKG_SECTION="driver.remote" PKG_SHORTDESC="A Linux driver to add support for sapphire remotes" PKG_LONGDESC="A Linux driver to add support for sapphire remotes" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Sapphire Remote Driver" PKG_ADDON_TYPE="xbmc.service" +PKG_IS_KERNEL_PKG="yes" if [ -f $SYSROOT_PREFIX/usr/include/linux/input-event-codes.h ]; then INPUT_H="$SYSROOT_PREFIX/usr/include/linux/input-event-codes.h" @@ -44,10 +31,10 @@ pre_make_target() { } make_target() { - make V=1 \ - KVER=$(kernel_version) \ - KDIR=$(kernel_path) \ - INPUT_H=$INPUT_H + kernel_make -C $(kernel_path) M=$(pwd) modules + + make INPUT_H=$INPUT_H \ + sapphire_keymap.sh } post_make_target() { @@ -61,10 +48,6 @@ post_make_target() { sapphire_startup.sh sapphire_keymap.sh } -makeinstall_target() { - : -} - addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp $PKG_BUILD/*.ko $ADDON_BUILD/$PKG_ADDON_ID/lib diff --git a/packages/addons/driver/sapphire/source/bin/sapphire-config b/packages/addons/driver/sapphire/source/bin/sapphire-config index 779e03cb53..77b62b6285 100755 --- a/packages/addons/driver/sapphire/source/bin/sapphire-config +++ b/packages/addons/driver/sapphire/source/bin/sapphire-config @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile oe_setup_addon driver.remote.sapphire diff --git a/packages/addons/driver/sapphire/source/default.py b/packages/addons/driver/sapphire/source/default.py index 0ba8038b6d..bf824fbeab 100644 --- a/packages/addons/driver/sapphire/source/default.py +++ b/packages/addons/driver/sapphire/source/default.py @@ -1,18 +1,3 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/addons/driver/steamcontroller/package.mk b/packages/addons/driver/steamcontroller/package.mk index 191992b079..5c8ecc56ab 100644 --- a/packages/addons/driver/steamcontroller/package.mk +++ b/packages/addons/driver/steamcontroller/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="steamcontroller" PKG_VERSION="60499dc" -PKG_REV="101" +PKG_SHA256="04a846c6f659fb5efca7747fe78e15c1348b5e0579437bb425f538318289bb80" +PKG_REV="102" PKG_ARCH="any" PKG_LICENSE="MIT" PKG_SITE="https://github.com/ynsta/steamcontroller" PKG_URL="https://github.com/ynsta/steamcontroller/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host python-libusb1 enum34 linux:host" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host python-libusb1 enum34 linux:host" PKG_SECTION="driver" PKG_SHORTDESC="A standalone userland driver for the steam controller to be used where steam client can't be installed." PKG_LONGDESC="A standalone userland driver for the steam controller to be used where steam client can't be installed." -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Steam Controller Driver" @@ -42,15 +28,11 @@ make_target() { python setup.py build } -makeinstall_target() { - : -} - addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin cp -a $PKG_BUILD/build/scripts-2.7/* $ADDON_BUILD/$PKG_ADDON_ID/bin/ - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib cp -a $PKG_BUILD/build/lib.linux-*-2.7/* $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -a $(get_build_dir python-libusb1)/build/lib/* $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -a $(get_build_dir enum34)/build/lib/* $ADDON_BUILD/$PKG_ADDON_ID/lib/ @@ -61,6 +43,6 @@ addon() { fi cp $(get_build_dir linux)/usr/include/linux/input.h $ADDON_BUILD/$PKG_ADDON_ID/include/linux/ - python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $ADDON_BUILD/$PKG_ADDON_ID/lib/ -f 1>/dev/null + $TOOLCHAIN/bin/python -Wi -t -B $TOOLCHAIN/lib/$PKG_PYTHON_VERSION/compileall.py $ADDON_BUILD/$PKG_ADDON_ID/lib/ -f 1>/dev/null find $ADDON_BUILD/$PKG_ADDON_ID/lib/ -name '*.py' -exec rm {} \; } diff --git a/packages/addons/driver/steamcontroller/source/default.py b/packages/addons/driver/steamcontroller/source/default.py index 6c6b84a8a5..0b9d649ccd 100644 --- a/packages/addons/driver/steamcontroller/source/default.py +++ b/packages/addons/driver/steamcontroller/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/driver/sundtek-mediatv/changelog.txt b/packages/addons/driver/sundtek-mediatv/changelog.txt index 3eb6749321..56402f5aee 100755 --- a/packages/addons/driver/sundtek-mediatv/changelog.txt +++ b/packages/addons/driver/sundtek-mediatv/changelog.txt @@ -1,3 +1,14 @@ +8.0.105 +- use new output from mediaclient + use xmlstartlet to parse settings.xml file + +8.0.104 +- once a serial number is in config file then ir_disabled parameter + needs to be localized below it (it is not global parameter anymore) + +8.0.103 +- rebuild + 8.0.102 - automatically update driver to latest version on first install show driver version in addon settings diff --git a/packages/addons/driver/sundtek-mediatv/config/sundtek.conf b/packages/addons/driver/sundtek-mediatv/config/sundtek.conf index 5f9d4acadb..e53ae59ede 100644 --- a/packages/addons/driver/sundtek-mediatv/config/sundtek.conf +++ b/packages/addons/driver/sundtek-mediatv/config/sundtek.conf @@ -27,6 +27,7 @@ bulk_notification=on #[U123456789012] #initial_dvb_mode=DVBT +#ir_disabled=1 #[NETWORK] #device=192.168.1.1:0 diff --git a/packages/addons/driver/sundtek-mediatv/package.mk b/packages/addons/driver/sundtek-mediatv/package.mk index fa16c557b3..c7e33f07fc 100644 --- a/packages/addons/driver/sundtek-mediatv/package.mk +++ b/packages/addons/driver/sundtek-mediatv/package.mk @@ -1,24 +1,9 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="sundtek-mediatv" PKG_VERSION="7.0" -PKG_REV="102" +PKG_REV="105" PKG_ARCH="any" PKG_LICENSE="nonfree" PKG_SITE="http://support.sundtek.com/" @@ -27,15 +12,15 @@ PKG_DEPENDS_TARGET="" PKG_SECTION="driver/dvb" PKG_SHORTDESC="Sundtek MediaTV: a Linux driver to add support for SUNDTEK USB DVB devices" PKG_LONGDESC="Install this to add support for Sundtek USB DVB devices." +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Sundtek MediaTV" PKG_ADDON_TYPE="xbmc.service" -PKG_AUTORECONF="no" make_target() { - mkdir -p $ROOT/$PKG_BUILD - cd $ROOT/$PKG_BUILD + mkdir -p $PKG_BUILD + cd $PKG_BUILD case $TARGET_ARCH in x86_64) @@ -48,13 +33,13 @@ make_target() { INSTALLER_URL="http://sundtek.de/media/netinst/arm64/installer.tar.gz" ;; esac - + wget -O installer.tar.gz $INSTALLER_URL - + tar -xzf installer.tar.gz - + chmod -R 755 opt/ etc/ - + rm -f opt/bin/getinput.sh rm -f opt/bin/lirc.sh rm -fr opt/lib/pm/ @@ -62,10 +47,6 @@ make_target() { wget -O version.used http://sundtek.de/media/latest.phtml } -makeinstall_target() { - : # nothing to do here -} - addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/ cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/ diff --git a/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.start b/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.start index db51011b40..8b349450a8 100644 --- a/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.start +++ b/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.start @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile @@ -67,7 +52,15 @@ fi [ ! -f $SUNDTEK_ADDON_HOME/rc_key_ok.map ] && mv $SUNDTEK_ADDON_HOME/rc_key_ok $SUNDTEK_ADDON_HOME/rc_key_ok.map mkdir -p /var/config -cat "$SUNDTEK_ADDON_SETTINGS" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/sundtek-addon.conf + +# check settings version +XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $SUNDTEK_ADDON_SETTINGS)" +if [ "$XML_SETTINGS_VER" = "2" ]; then + xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$SUNDTEK_ADDON_SETTINGS" > /var/config/sundtek-addon.conf +else + xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$SUNDTEK_ADDON_SETTINGS" > /var/config/sundtek-addon.conf +fi + . /var/config/sundtek-addon.conf # check if there is new driver on web @@ -136,7 +129,7 @@ if [ -z "$(pidof mediasrv)" ]; then if [ "$USE_NET_TUNERS" = "true" -a -n "$DEVICE1_IP" ]; then # delete all network tuner entries - awk '/^\[NETWORK\]/{flag=1; next} /^device=|^#|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-net + awk '/^\[NETWORK\]/{flag=1; next} /^[^\[]|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-net mv ${SUNDTEK_CONF_TMP}-net $SUNDTEK_CONF_TMP echo "" >>$SUNDTEK_CONF_TMP # remove empty lines at the end of file @@ -168,7 +161,7 @@ if [ -z "$(pidof mediasrv)" ]; then fi else # delete all network tuner entries - awk '/^\[NETWORK\]/{flag=1; next} /^device=|^#|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-net + awk '/^\[NETWORK\]/{flag=1; next} /^[^\[]|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-net mv ${SUNDTEK_CONF_TMP}-net $SUNDTEK_CONF_TMP echo "" >>$SUNDTEK_CONF_TMP # remove empty lines at the end of file @@ -186,7 +179,7 @@ if [ -z "$(pidof mediasrv)" ]; then KEYMAP=$(eval echo \$ATTACHED_TUNER_${SERIAL}_KEYMAP) if [ "$DVBMODE" = "DVB-T" ]; then - # only set DVB-T because default is DVB-C (and DVB-S is not set either) + # only set DVB-T because default is DVB-C (and DVB-S/S2 is not set either) DVBMODE="DVBT" else DVBMODE="" @@ -197,26 +190,26 @@ if [ -z "$(pidof mediasrv)" ]; then [ ! -f $KEYMAP ] && KEYMAP="" # remove setttings for this tuner - awk -v val="[$SERIAL]" '$0 == val {flag=1; next} /^ir_protocol=|^rcmap=|^initial_dvb_mode=|^#|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-types + awk -v val="[$SERIAL]" '$0 == val {flag=1; next} /^[^\[]|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-types mv ${SUNDTEK_CONF_TMP}-types $SUNDTEK_CONF_TMP echo "" >>$SUNDTEK_CONF_TMP # remove empty lines at the end of file sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $SUNDTEK_CONF_TMP - ADDNEW=true - if [ -n "$DVBMODE" ]; then - [ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP - echo "initial_dvb_mode=$DVBMODE" >>$SUNDTEK_CONF_TMP - fi - if [ -n "$IRPROT" ]; then - [ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP - echo "ir_protocol=$IRPROT" >>$SUNDTEK_CONF_TMP - fi - if [ -n "$KEYMAP" ]; then - [ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP - echo "rcmap=$KEYMAP" >>$SUNDTEK_CONF_TMP + echo "" >>$SUNDTEK_CONF_TMP + echo "[$SERIAL]" >>$SUNDTEK_CONF_TMP + + [ -n "$DVBMODE" ] && echo "initial_dvb_mode=$DVBMODE" >>$SUNDTEK_CONF_TMP + + if [ "$ENABLE_IR_RECEIVER" = "true" ]; then + echo "ir_disabled=0" >>$SUNDTEK_CONF_TMP + else + echo "ir_disabled=1" >>$SUNDTEK_CONF_TMP fi + [ -n "$IRPROT" ] && echo "ir_protocol=$IRPROT" >>$SUNDTEK_CONF_TMP + [ -n "$KEYMAP" ] && echo "rcmap=$KEYMAP" >>$SUNDTEK_CONF_TMP + echo "" >>$SUNDTEK_CONF_TMP done fi diff --git a/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.stop b/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.stop index 02aeedebde..5c191bd2e4 100644 --- a/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.stop +++ b/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-mediatv.stop @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-update-driver.sh b/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-update-driver.sh index 3e5339f292..0893deb465 100644 --- a/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-update-driver.sh +++ b/packages/addons/driver/sundtek-mediatv/source/bin/sundtek-update-driver.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/driver/sundtek-mediatv/source/bin/userspace-driver.sh b/packages/addons/driver/sundtek-mediatv/source/bin/userspace-driver.sh index 92d194ce23..dc9931cb56 100644 --- a/packages/addons/driver/sundtek-mediatv/source/bin/userspace-driver.sh +++ b/packages/addons/driver/sundtek-mediatv/source/bin/userspace-driver.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/driver/sundtek-mediatv/source/default.py b/packages/addons/driver/sundtek-mediatv/source/default.py index b858c59827..1fb883c734 100644 --- a/packages/addons/driver/sundtek-mediatv/source/default.py +++ b/packages/addons/driver/sundtek-mediatv/source/default.py @@ -1,17 +1,2 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) diff --git a/packages/addons/driver/sundtek-mediatv/source/resources/actions.py b/packages/addons/driver/sundtek-mediatv/source/resources/actions.py index 6e32393e0b..c2073c3c5a 100644 --- a/packages/addons/driver/sundtek-mediatv/source/resources/actions.py +++ b/packages/addons/driver/sundtek-mediatv/source/resources/actions.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) import os import sys diff --git a/packages/addons/driver/sundtek-mediatv/source/resources/lib/functions.py b/packages/addons/driver/sundtek-mediatv/source/resources/lib/functions.py index 04d8f73789..5a1e871de5 100644 --- a/packages/addons/driver/sundtek-mediatv/source/resources/lib/functions.py +++ b/packages/addons/driver/sundtek-mediatv/source/resources/lib/functions.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) import os import sys @@ -77,7 +62,7 @@ def get_devices_sundtek(mediaclient_e): str = line.strip() if str.startswith('device '): name = str[str.find("[")+1:str.find("]")] - tuners.append([name, 0, 's']) + tuners.append([name, 0, []]) if str.startswith('[SERIAL]:'): line = p.readline() @@ -85,20 +70,31 @@ def get_devices_sundtek(mediaclient_e): if str.startswith('ID:'): id = str.split(':'); id = id[1].strip() - tuners[len(tuners)-1] = [name, id, 's'] - - if str.startswith('[DVB-C]:'): - tuners[len(tuners)-1] = [name, id, 'c'] - elif str.startswith('[DVB-T]:'): - tuners[len(tuners)-1] = [name, id, 'c'] - elif str.startswith('[DVB-T2]:'): - tuners[len(tuners)-1] = [name, id, 'c'] + tuners[len(tuners)-1][1] = id + + if str.startswith('[DVB'): + types_arr = tuners[len(tuners)-1][2] + str = str.translate(None, '[]:') + types = str.split(",") + for i in range(len(types)): + if types[i] == 'DVB-C': + types_arr.append('c') + elif types[i] == 'DVB-T': + types_arr.append('t') + elif types[i] == 'DVB-T2': + types_arr.append('t2') + elif types[i] == 'DVB-S/S2': + types_arr.append('s') + + tuners[len(tuners)-1][2] = types_arr + except IOError: print 'Error getting sundtek tuners info' return tuners """ root ~ # mediaclient -e + **** List of Media Hardware Devices **** device 0: [Sundtek MediaTV Pro (USB 2.0)] DVB-C, DVB-T, ANALOG-TV, FM-RADIO, REMOTE-CONTROL, OSS-AUDIO, RDS [BUS]: @@ -123,6 +119,21 @@ def get_devices_sundtek(mediaclient_e): INPUT0: /dev/mediainput0 [OSS]: OSS0: /dev/dsp0 + +**** List of Media Hardware Devices **** +device 0: [MediaTV Digital Home III (EU)] DVB-C, DVB-T, DVB-T2, REMOTE-CONTROL + [INFO]: + STATUS: STANDBY + [BUS]: + ID: 2-5 + [SERIAL]: + ID: U170130193421 + [DVB-C,DVB-T,DVB-T2]: + FRONTEND: /dev/dvb/adapter0/frontend0 + DVR: /dev/dvb/adapter0/dvr0 + DMX: /dev/dvb/adapter0/demux0 + [REMOTECONTROL]: + INPUT0: /dev/mediainput0 """ ###################################################################################################### @@ -182,19 +193,42 @@ def add_sundtek(xmldoc, node_cat, tuners): for ix, tuner in enumerate(tuners): tuner_name = tuner[0] tuner_serial = tuner[1] - tuner_type = tuner[2] + tuner_types = tuner[2] node1 = xmldoc.createElement("setting") node1.setAttribute("id", 'ATTACHED_TUNER_' + tuner_serial + '_DVBMODE') node1.setAttribute("label", tuner_name + ", " + tuner_serial) node1.setAttribute("type", 'labelenum') - if (tuner_type == 's'): - node1.setAttribute("default", 'DVB-S') - node1.setAttribute("values", 'DVB-S') + if len(tuner_types) == 0: + values = 'unkn' + default = 'unkn' else: - node1.setAttribute("default", 'DVB-C') - node1.setAttribute("values", 'DVB-C|DVB-T') + values = '' + default = '' + + for ix, type in enumerate(tuner_types): + if type == 'c': + type_str = 'DVB-C' + elif type == 't': + type_str = 'DVB-T' + elif type == 't2': + type_str = 'DVB-T2' + elif type == 's': + type_str = 'DVB-S/S2' + else: + type_str = 'unkn' + + if not default: # first one + default = type_str; + + if ix == 0: + values = type_str + else: + values = values + '|' + type_str + + node1.setAttribute("default", default) + node1.setAttribute("values", values) node_cat.appendChild(node1) @@ -237,7 +271,7 @@ def add_new_tuners(xmldoc, tuners, which): def save_settings(settings_xml, xmldoc): try: outputfile = open(settings_xml, 'w') - xmlpp.pprint(xmldoc.toxml(), output = outputfile, indent=2) + xmlpp.pprint(xmldoc.toxml(), output = outputfile, indent=2, width=500) outputfile.close() except IOError: print 'Error saving file:', settings_xml diff --git a/packages/addons/driver/sundtek-mediatv/source/sleep.d/99-sundtek-mediatv.power b/packages/addons/driver/sundtek-mediatv/source/sleep.d/99-sundtek-mediatv.power index 1f91cc9065..d7f89ad5d0 100644 --- a/packages/addons/driver/sundtek-mediatv/source/sleep.d/99-sundtek-mediatv.power +++ b/packages/addons/driver/sundtek-mediatv/source/sleep.d/99-sundtek-mediatv.power @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/libraries/adafruit-libraries/changelog.txt b/packages/addons/libraries/adafruit-libraries/changelog.txt index b0857cdb36..0741be482f 100644 --- a/packages/addons/libraries/adafruit-libraries/changelog.txt +++ b/packages/addons/libraries/adafruit-libraries/changelog.txt @@ -1,6 +1,50 @@ -8.0.101 +107 + updated libraries: + - Pure python access to Linux IO including I2C and SPI. + - Adafruit Python BMP Library + - Adafruit Python SSD1306 Library + - Adafruit Python DHT Library + - Adafruit Python LSM303 Library + - Adafruit Python MCP4725 Library + - Adafruit Python VCNL40xx Library + +106 + updated libraries: + - Adafruit Python DHT Library + - Adafruit Python GPIO Library + - Python library for controlling LED backpack displays. + +105 + updated libraries: + - Adafruit Python CharLCD Library + * added support for backpack + - Adafruit Python GPIO Library + +104 +- include SSD1306 library + +103 + updated libraries: + - Adafruit Python ADS1x15 Library + - Adafruit Python ADXL345 Library + - Adafruit Python BMP Library + - Adafruit Python CharLCD Library + - Adafruit Python DHT Library + - Adafruit Python GPIO Library + - Python library for controlling LED backpack displays. + - Adafruit Python LSM303 Library + - Adafruit Python MCP3008 Library + - Adafruit Python MCP4725 Library + - Adafruit Python PCA9685 Library + - Pure python access to Linux IO including I2C and SPI. + - Python library for the SI1145 + - Adafruit Python TCS34725 Library + - Adafruit Python VCNL40xx Library + - Adafruit Python WS2801 Library + +101 - include SI1145 library - compile DHT driver -8.0.100 +100 - Initial Release diff --git a/packages/addons/libraries/adafruit-libraries/package.mk b/packages/addons/libraries/adafruit-libraries/package.mk index 9816b7d185..dc1eff4232 100644 --- a/packages/addons/libraries/adafruit-libraries/package.mk +++ b/packages/addons/libraries/adafruit-libraries/package.mk @@ -1,34 +1,18 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="adafruit-libraries" PKG_VERSION="" -PKG_REV="101" +PKG_REV="107" PKG_ARCH="any" -PKG_ADDON_PROJECTS="RPi RPi2" +PKG_ADDON_PROJECTS="RPi" PKG_LICENSE="MIT" PKG_SITE="" PKG_URL="" -PKG_DEPENDS_TARGET="Adafruit_Python_ADS1x15 Adafruit_Python_ADXL345 Adafruit_Python_BMP Adafruit_Python_CharLCD Adafruit_Python_DHT Adafruit_Python_GPIO Adafruit_Python_LED_Backpack Adafruit_Python_LSM303 Adafruit_Python_MCP3008 Adafruit_Python_MCP4725 Adafruit_Python_PCA9685 Adafruit_Python_PureIO Adafruit_Python_SI1145 Adafruit_Python_TCS34725 Adafruit_Python_VCNL40xx Adafruit_Python_WS2801" +PKG_DEPENDS_TARGET="Adafruit_Python_ADS1x15 Adafruit_Python_ADXL345 Adafruit_Python_BMP Adafruit_Python_CharLCD Adafruit_Python_DHT Adafruit_Python_GPIO Adafruit_Python_LED_Backpack Adafruit_Python_LSM303 Adafruit_Python_MCP3008 Adafruit_Python_MCP4725 Adafruit_Python_PCA9685 Adafruit_Python_PureIO Adafruit_Python_SI1145 Adafruit_Python_SSD1306 Adafruit_Python_TCS34725 Adafruit_Python_VCNL40xx Adafruit_Python_WS2801" PKG_SECTION="virtual" PKG_SHORTDESC="A bundle of libraries from Adafruit" -PKG_LONGDESC="This bundle currently includes Adafruit_ADS1x15, Adafruit_ADXL345, Adafruit_BMP, Adafruit_CharLCD, Adafruit_DHT, Adafruit_GPIO, Adafruit_LED_Backpack, Adafruit_LSM303, Adafruit_MCP3008, Adafruit_MCP4725, Adafruit_PCA9685, Adafruit_PureIO, Adafruit_SI1145 Adafruit_TCS34725, Adafruit_VCNL40xx and Adafruit_WS2801 python modules" -PKG_AUTORECONF="no" +PKG_LONGDESC="This is a bundle of various Adafruit Python libraries. Included are: ADS1x15, ADXL345, BMP, CharLCD, DHT, GPIO, LED_Backpack, LSM303, MCP3008, MCP4725, PCA9685, PureIO, SI1145, SSD1306, TCS34725, VCNL40xx, WS2801" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Adafruit Libraries" @@ -41,7 +25,7 @@ addon() { cp -PR $(get_build_dir Adafruit_Python_ADXL345)/Adafruit_ADXL345 $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_BMP)/Adafruit_BMP $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_CharLCD)/Adafruit_CharLCD $ADDON_BUILD/$PKG_ADDON_ID/lib/ - cp -PR $(get_build_dir Adafruit_Python_DHT)/build/lib.linux-*/Adafruit_DHT $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -PR $(get_build_dir Adafruit_Python_DHT)/build/lib/Adafruit_DHT $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_GPIO)/Adafruit_GPIO $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_LED_Backpack)/Adafruit_LED_Backpack $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_LSM303)/Adafruit_LSM303 $ADDON_BUILD/$PKG_ADDON_ID/lib/ @@ -50,6 +34,7 @@ addon() { cp -PR $(get_build_dir Adafruit_Python_PCA9685)/Adafruit_PCA9685 $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_PureIO)/Adafruit_PureIO $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_SI1145)/SI1145 $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -PR $(get_build_dir Adafruit_Python_SSD1306)/Adafruit_SSD1306 $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_TCS34725)/Adafruit_TCS34725 $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_VCNL40xx)/Adafruit_VCNL40xx $ADDON_BUILD/$PKG_ADDON_ID/lib/ cp -PR $(get_build_dir Adafruit_Python_WS2801)/Adafruit_WS2801 $ADDON_BUILD/$PKG_ADDON_ID/lib/ diff --git a/packages/addons/libraries/adafruit-libraries/source/default.py b/packages/addons/libraries/adafruit-libraries/source/default.py index ebb78520b4..54a03e2c51 100644 --- a/packages/addons/libraries/adafruit-libraries/source/default.py +++ b/packages/addons/libraries/adafruit-libraries/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui diff --git a/packages/addons/repository/repository.kodinerds/package.mk b/packages/addons/repository/repository.kodinerds/package.mk index 6282ab9ca3..7381a40edb 100644 --- a/packages/addons/repository/repository.kodinerds/package.mk +++ b/packages/addons/repository/repository.kodinerds/package.mk @@ -1,47 +1,27 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="repository.kodinerds" -PKG_VERSION="8.1" -PKG_REV="102" +PKG_VERSION="9.0" +PKG_REV="103" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodinerds.net" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain xmlstarlet:host" +PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="" PKG_SHORTDESC="Kodinerds add-on repository" PKG_LONGDESC="Kodinerds add-on repository" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Kodinerds Repository" PKG_ADDON_TYPE="xbmc.addon.repository" - make_target() { - $SED -e "s|@PKG_VERSION@|$PKG_VERSION|g" \ - -e "s|@PKG_REV@|$PKG_REV|g" \ - -i addon.xml -} - -makeinstall_target() { - : # nop + sed -e "s|@PKG_VERSION@|$PKG_VERSION|g" \ + -e "s|@PKG_REV@|$PKG_REV|g" \ + -i addon.xml } addon() { diff --git a/packages/addons/repository/repository.linuxserver.docker/changelog.txt b/packages/addons/repository/repository.linuxserver.docker/changelog.txt index c5d312a7b2..4e53519708 100644 --- a/packages/addons/repository/repository.linuxserver.docker/changelog.txt +++ b/packages/addons/repository/repository.linuxserver.docker/changelog.txt @@ -1,2 +1,5 @@ +101 +- Change repo location for zips + 100 - Initial LibreELEC version diff --git a/packages/addons/repository/repository.linuxserver.docker/package.mk b/packages/addons/repository/repository.linuxserver.docker/package.mk index 1f8fbeaf6f..255553f2af 100644 --- a/packages/addons/repository/repository.linuxserver.docker/package.mk +++ b/packages/addons/repository/repository.linuxserver.docker/package.mk @@ -1,48 +1,28 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="repository.linuxserver.docker" -PKG_VERSION="8.1" -PKG_REV="100" +PKG_VERSION="9.0" +PKG_REV="102" PKG_ARCH="any" -PKG_ADDON_PROJECTS="Generic RPi RPi2 imx6 WeTek_Hub WeTek_Play_2 Odroid_C2" +PKG_ADDON_PROJECTS="any !WeTek_Core !WeTek_Play" PKG_LICENSE="GPL" PKG_SITE="https://linuxserver.io" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain xmlstarlet:host" +PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="" PKG_SHORTDESC="LinuxServer.io docker add-on repository" PKG_LONGDESC="LinuxServer.io docker add-on repository" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="LinuxServer.io Repository" PKG_ADDON_TYPE="xbmc.addon.repository" - make_target() { - $SED -e "s|@PKG_VERSION@|$PKG_VERSION|g" \ - -e "s|@PKG_REV@|$PKG_REV|g" \ - -i addon.xml -} - -makeinstall_target() { - : # nop + sed -e "s|@PKG_VERSION@|$PKG_VERSION|g" \ + -e "s|@PKG_REV@|$PKG_REV|g" \ + -i addon.xml } addon() { diff --git a/packages/addons/repository/repository.linuxserver.docker/sources/addon.xml b/packages/addons/repository/repository.linuxserver.docker/sources/addon.xml index cb07d2bc3a..2e285dd1b3 100644 --- a/packages/addons/repository/repository.linuxserver.docker/sources/addon.xml +++ b/packages/addons/repository/repository.linuxserver.docker/sources/addon.xml @@ -10,7 +10,7 @@ name="LinuxServer.io's Docker Add-on Repository"> https://raw.githubusercontent.com/linuxserver/libreelec-addon-repo/master/addons.xml https://raw.githubusercontent.com/linuxserver/libreelec-addon-repo/master/addons.xml.md5 - https://raw.githubusercontent.com/linuxserver/libreelec-addons/master/download + https://raw.githubusercontent.com/linuxserver/libreelec-addon-repo/master/download

Install add-ons from LinuxServer.io's docker repository diff --git a/packages/addons/script/driverselect/package.mk b/packages/addons/script/driverselect/package.mk new file mode 100644 index 0000000000..11a98b33c6 --- /dev/null +++ b/packages/addons/script/driverselect/package.mk @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="driverselect" +PKG_VERSION="2b79180" +PKG_SHA256="ed1e9defa185b46d4400794681f21f2bf1ddf8ccdfdb20e49ddde3edccdd6b7f" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="https://libreelec.tv" +PKG_URL="https://github.com/b-jesch/script.program.driverselect/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="script.program" +PKG_SHORTDESC="script.program.driverselect" +PKG_LONGDESC="script.program.driverselect" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="embedded" +PKG_ADDON_NAME="Driver Select" +PKG_ADDON_TYPE="xbmc.python.script" + +unpack() { + mkdir -p $PKG_BUILD/addon + tar --strip-components=1 -xf $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz -C $PKG_BUILD/addon +} + +make_target() { + : +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/kodi/addons/${PKG_SECTION}.${PKG_NAME} + cp -rP $PKG_BUILD/addon/* $INSTALL/usr/share/kodi/addons/${PKG_SECTION}.${PKG_NAME} +} diff --git a/packages/addons/script/moonlight/changelog.txt b/packages/addons/script/moonlight/changelog.txt deleted file mode 100644 index 7b7cc1c50f..0000000000 --- a/packages/addons/script/moonlight/changelog.txt +++ /dev/null @@ -1,11 +0,0 @@ -8.1.104 -- update moonlight-common-c to support GFE 3.2 - -8.0.103 -- update Moonlight to 2.2.2 - -8.0.102 -- update Moonlight to 2.2.1 - -8.0.101 -- initial addon diff --git a/packages/addons/script/moonlight/icon/icon.png b/packages/addons/script/moonlight/icon/icon.png deleted file mode 100644 index 3a4bb5533c..0000000000 Binary files a/packages/addons/script/moonlight/icon/icon.png and /dev/null differ diff --git a/packages/addons/script/moonlight/package.mk b/packages/addons/script/moonlight/package.mk index 73db45a39f..b2e664d576 100644 --- a/packages/addons/script/moonlight/package.mk +++ b/packages/addons/script/moonlight/package.mk @@ -1,76 +1,25 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="moonlight" -PKG_VERSION="391de3f" -PKG_VERSION_NUMBER="2.2.2" -PKG_REV="104" +PKG_VERSION="1.0" +PKG_REV="110" PKG_ARCH="any" PKG_LICENSE="GPLv2" -PKG_SITE="https://github.com/dead/script.moonlight" -PKG_URL="https://github.com/dead/script.moonlight/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="script.moonlight-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain moonlight-embedded" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="script" -PKG_SHORTDESC="Moonlight: implementation of NVIDIA's GameStream protocol" -PKG_LONGDESC="Moonlight ($PKG_VERSION_NUMBER): allows you to stream your collection of games from your PC (with NVIDIA Gamestream) to your device and play them remotely" -PKG_AUTORECONF="no" +PKG_SHORTDESC="Moonlight: Add-on removed" +PKG_LONGDESC="Moonlight Add-on removed" +PKG_TOOLCHAIN="manual" + +PKG_ADDON_BROKEN="Moonlight is no longer maintained." PKG_IS_ADDON="yes" PKG_ADDON_NAME="Moonlight" -PKG_ADDON_TYPE="xbmc.service.pluginsource" -PKG_ADDON_PROVIDES="executable" - -make_target() { - : -} - -makeinstall_target() { - : -} +PKG_ADDON_TYPE="xbmc.broken" addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID - cp -PR $ROOT/$PKG_BUILD/script.moonlight/* $ADDON_BUILD/$PKG_ADDON_ID - - # let's use our addon.xml instead - rm $ADDON_BUILD/$PKG_ADDON_ID/addon.xml - - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/moonlight $ADDON_BUILD/$PKG_ADDON_ID/bin - - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libgamestream/libgamestream.so* $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libgamestream/libmoonlight-common.so* $ADDON_BUILD/$PKG_ADDON_ID/lib - - if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then - cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libmoonlight-pi.so $ADDON_BUILD/$PKG_ADDON_ID/lib - elif [ "$KODIPLAYER_DRIVER" = "libfslvpuwrap" ]; then - cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libmoonlight-imx.so $ADDON_BUILD/$PKG_ADDON_ID/lib - elif [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then - cp -P $(get_build_dir moonlight-embedded)/.$TARGET_NAME/libmoonlight-aml.so $ADDON_BUILD/$PKG_ADDON_ID/lib - fi - - cp -P $(get_build_dir libevdev)/.install_pkg/usr/lib/libevdev.so* $ADDON_BUILD/$PKG_ADDON_ID/lib - - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/etc - cp -P $(get_build_dir moonlight-embedded)/moonlight.conf $ADDON_BUILD/$PKG_ADDON_ID/etc - - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/share/moonlight - cp -PR $(get_build_dir moonlight-embedded)/mappings $ADDON_BUILD/$PKG_ADDON_ID/share/moonlight + : } diff --git a/packages/addons/script/script.config.vdr/changelog.txt b/packages/addons/script/script.config.vdr/changelog.txt index 5aa4383062..61de9dc8fe 100644 --- a/packages/addons/script/script.config.vdr/changelog.txt +++ b/packages/addons/script/script.config.vdr/changelog.txt @@ -1,3 +1,13 @@ +103 +- scan: "HD Channels" option does not exist any more +- fix for Leia skinning engine changes + +102 +- fix maintainer name + +101 +- fix scripts + 100 - fix addon icons diff --git a/packages/addons/script/script.config.vdr/package.mk b/packages/addons/script/script.config.vdr/package.mk index 9eb0bb469c..f43f44c82a 100644 --- a/packages/addons/script/script.config.vdr/package.mk +++ b/packages/addons/script/script.config.vdr/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="script.config.vdr" -PKG_VERSION="61c2dde" -PKG_REV="100" +PKG_VERSION="0345a2a3b98de48cbbaf77768ca6c9289f531e2b" +PKG_SHA256="793676258c399427047a7d6628984358c67b1180b98df44b48647d20e8f9395b" +PKG_REV="103" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="https://libreelec.tv" @@ -27,19 +13,15 @@ PKG_DEPENDS_TARGET="" PKG_SECTION="" PKG_SHORTDESC="script.config.vdr" PKG_LONGDESC="script.config.vdr" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="dummy" make_target() { - $SED -e "s|@ADDON_VERSION@|$ADDON_VERSION.$PKG_REV|g" \ - -e "s|@OS_VERSION@|$OS_VERSION|g" \ - -i addon.xml -} - -makeinstall_target() { - : # nothing to do here + sed -e "s|@ADDON_VERSION@|$ADDON_VERSION|g" \ + -e "s|@OS_VERSION@|$OS_VERSION|g" \ + -i addon.xml } addon() { diff --git a/packages/addons/script/script.config.vdr/sources/addon.xml b/packages/addons/script/script.config.vdr/sources/addon.xml index 41a1db8b3a..06f55c3324 100644 --- a/packages/addons/script/script.config.vdr/sources/addon.xml +++ b/packages/addons/script/script.config.vdr/sources/addon.xml @@ -2,30 +2,30 @@ + provider-name="Team LibreELEC"> - + executable - VDR-Sendersuchlauf und DiSEqC-Konfiguration - VDR channel scan and Diseqc Configuration + VDR-Sendersuchlauf und DiSEqC-Konfiguration + VDR channel scan and Diseqc Configuration VDR channel scan and DiSEqC Configuration - VDR kanalų paieška ir Diseqc konfigūravimas - VDR kanaal scan en Diseqc configuratie - Skanowanie kanałów i konfiguracja Diseqc + VDR kanalų paieška ir Diseqc konfigūravimas + VDR kanaal scan en Diseqc configuratie + Skanowanie kanałów i konfiguracja Diseqc Escanear canais VDR e Configuração Diseqc - VDR-Sendersuchlauf und DiSEqC-Konfiguration - VDR channel scan and Diseqc Configuration + VDR-Sendersuchlauf und DiSEqC-Konfiguration + VDR channel scan and Diseqc Configuration VDR channel scan and DiSEqC Configuration - VDR kanalų paieška ir Diseqc konfigūravimas - VDR kanaal scan en Diseqc configuratie - Skanowanie kanałów i konfiguracja Diseqc + VDR kanalų paieška ir Diseqc konfigūravimas + VDR kanaal scan en Diseqc configuratie + Skanowanie kanałów i konfiguracja Diseqc Escanear canais VDR e Configuração Diseqc - + all @PKG_ADDON_NEWS@ diff --git a/packages/addons/service/bluetooth-audio/changelog.txt b/packages/addons/service/bluetooth-audio/changelog.txt new file mode 100644 index 0000000000..572ffaee81 --- /dev/null +++ b/packages/addons/service/bluetooth-audio/changelog.txt @@ -0,0 +1,5 @@ +101 +- Fix log errors + +100 +- Initial release diff --git a/packages/addons/service/bluetooth-audio/icon/icon.png b/packages/addons/service/bluetooth-audio/icon/icon.png new file mode 100644 index 0000000000..5d57247f6e Binary files /dev/null and b/packages/addons/service/bluetooth-audio/icon/icon.png differ diff --git a/packages/addons/service/bluetooth-audio/package.mk b/packages/addons/service/bluetooth-audio/package.mk new file mode 100644 index 0000000000..2faf9fc565 --- /dev/null +++ b/packages/addons/service/bluetooth-audio/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="bluetooth-audio" +PKG_VERSION="0" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="service" +PKG_SHORTDESC="Provides the ability to change the kodi audio device if a bluetooth audio device is connected" +PKG_LONGDESC="Provides the ability to change the kodi audio device if a bluetooth audio device is connected" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Bluetooth Audio Device Changer" +PKG_ADDON_TYPE="xbmc.service" + +addon() { + : +} diff --git a/packages/addons/service/bluetooth-audio/source/default.py b/packages/addons/service/bluetooth-audio/source/default.py new file mode 100644 index 0000000000..a2bc275694 --- /dev/null +++ b/packages/addons/service/bluetooth-audio/source/default.py @@ -0,0 +1,179 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +import dbus +import dbus.mainloop.glib +import gobject +import json +import threading +import time +import xbmc +import xbmcaddon + +__addon__ = xbmcaddon.Addon() +__addonid__ = __addon__.getAddonInfo('id') + +gobject.threads_init() + +class KodiFunctions(object): + + def __init__(self): + + self.getjson = { + "jsonrpc": "2.0", + "method": "Settings.GetSettingValue", + "params": { + "setting": "audiooutput.audiodevice", + }, + "id": 1, + } + + self.setjson = { + "jsonrpc": "2.0", + "method": "Settings.SetSettingValue", + "params": { + "setting": "audiooutput.audiodevice", + "value": "", + }, + "id": 1, + } + + if __addon__.getSetting('audiodevice') == '': + self.audiodevice = json.loads(xbmc.executeJSONRPC(json.dumps(self.getjson)))['result']['value'] + __addon__.setSetting('audiodevice', self.audiodevice) + else: + self.audiodevice = __addon__.getSetting('audiodevice') + self.pulsedevice = 'PULSE:Default' + + self.select_default() + + def select_default(self): + + self.setjson['params']['value'] = self.audiodevice + xbmc.executeJSONRPC(json.dumps(self.setjson)) + + def select_pulse(self): + + self.setjson['params']['value'] = self.pulsedevice + xbmc.executeJSONRPC(json.dumps(self.setjson)) + +class BluetoothAudioClient(object): + + def __init__(self): + + xbmc.log('%s: starting add-on' % __addonid__, xbmc.LOGNOTICE) + + self.devices = {} + self.signal_added = None + self.signal_removed = None + + self.kodi = KodiFunctions() + + self._setup_loop() + self._setup_bus() + self._setup_signals() + + def quit(self): + + xbmc.log('%s: stopping add-on' % __addonid__, xbmc.LOGNOTICE) + + self.kodi.select_default() + + self.signal_added.remove() + self.signal_removed.remove() + + self._loop.quit() + + def _setup_loop(self): + + self._loop = gobject.MainLoop() + + self._thread = threading.Thread(target=self._loop.run) + self._thread.start() + + def _setup_bus(self): + + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + self._bus = dbus.SystemBus() + + def _setup_signals(self): + + self.signal_added = self._bus.add_signal_receiver(handler_function=self.switch_audio, + signal_name='InterfacesAdded', + dbus_interface='org.freedesktop.DBus.ObjectManager', + bus_name='org.bluez', + member_keyword='signal') + + self.signal_removed = self._bus.add_signal_receiver(handler_function=self.switch_audio, + signal_name='InterfacesRemoved', + dbus_interface='org.freedesktop.DBus.ObjectManager', + bus_name='org.bluez', + member_keyword='signal') + + def switch_audio(self, *args, **kwargs): + + device_path = args[0] + + try: + if kwargs['signal'] == 'InterfacesAdded': + + self.devices[device_path] = { + 'Connected': '', + 'Device': '', + 'Class': '', + } + + device = self._bus.get_object('org.bluez', device_path) + device_iface = dbus.Interface(device, dbus.PROPERTIES_IFACE) + self.devices[device_path]['Device'] = device_iface.Get('org.bluez.MediaTransport1', 'Device') + + audio_device_path = self._bus.get_object('org.bluez', self.devices[device_path]['Device']) + audio_device_iface = dbus.Interface(audio_device_path, dbus.PROPERTIES_IFACE) + self.devices[device_path]['Class'] = audio_device_iface.Get('org.bluez.Device1', 'Class') + self.devices[device_path]['Connected'] = audio_device_iface.Get('org.bluez.Device1', 'Connected') + + if self.devices[device_path]['Class'] & (1 << 21): + xbmc.log('%s: bluetooth audio device connected' % __addonid__, xbmc.LOGNOTICE) + xbmc.log('%s: switching to bluetooth audio device' % __addonid__, xbmc.LOGNOTICE) + self.kodi.select_pulse() + + elif kwargs['signal'] == 'InterfacesRemoved': + if self.devices[device_path]['Device'] is not None and self.devices[device_path]['Class'] & (1 << 21): + audio_device_path = self._bus.get_object('org.bluez', self.devices[device_path]['Device']) + audio_device_iface = dbus.Interface(audio_device_path, dbus.PROPERTIES_IFACE) + self.devices[device_path]['Connected'] = audio_device_iface.Get('org.bluez.Device1', 'Connected') + + while self.devices[device_path]['Connected']: + self.devices[device_path]['Connected'] = audio_device_iface.Get('org.bluez.Device1', 'Connected') + time.sleep(0.1) + + xbmc.log('%s: bluetooth audio device disconnected' % __addonid__, xbmc.LOGNOTICE) + xbmc.log('%s: checking for other connected devices' % __addonid__, xbmc.LOGNOTICE) + + for path in self.devices: + if self.devices[path]['Connected'] and self.devices[path]['Class'] & (1 << 21): + xbmc.log('%s: found connected bluetooth audio device' % __addonid__, xbmc.LOGNOTICE) + return + + xbmc.log('%s: switching to default audio device' % __addonid__, xbmc.LOGNOTICE) + self.kodi.select_default() + + except (TypeError, KeyError, dbus.exceptions.DBusException) as e: + xbmc.log('%s: ' % __addonid__ + unicode(e), xbmc.LOGERROR) + +class BluetoothMonitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + + xbmc.Monitor.__init__(self) + +if (__name__ == "__main__"): + monitor = BluetoothMonitor() + client = BluetoothAudioClient() + + monitor.waitForAbort() + + client.quit() + + del BluetoothAudioClient + del BluetoothMonitor diff --git a/packages/addons/service/bluetooth-audio/source/resources/language/English/strings.po b/packages/addons/service/bluetooth-audio/source/resources/language/English/strings.po new file mode 100644 index 0000000000..539f9a4795 --- /dev/null +++ b/packages/addons/service/bluetooth-audio/source/resources/language/English/strings.po @@ -0,0 +1,20 @@ +# Kodi Media Center language file +# Addon Name: bluetooth-audio +# Addon id: service.bluetooth-audio + +msgid "" +msgstr "" + +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#30000" +msgid "Settings" +msgstr "" + +msgctxt "#30001" +msgid "Audio Device" +msgstr "" diff --git a/packages/addons/service/bluetooth-audio/source/resources/settings.xml b/packages/addons/service/bluetooth-audio/source/resources/settings.xml new file mode 100644 index 0000000000..90a80bfae8 --- /dev/null +++ b/packages/addons/service/bluetooth-audio/source/resources/settings.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/addons/service/boblightd/package.mk b/packages/addons/service/boblightd/package.mk index 35ebde00a2..0efb5537fc 100644 --- a/packages/addons/service/boblightd/package.mk +++ b/packages/addons/service/boblightd/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="boblightd" PKG_VERSION="478" -PKG_REV="100" +PKG_SHA256="78b82c9b133ce20c3d24aba96abe4a8302ec8dc640460b3b7302aa1d368c543a" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://code.google.com/p/boblight" @@ -31,7 +17,7 @@ PKG_LONGDESC="Boblight($PKG_VERSION) is an opensource AmbiLight implementation." PKG_IS_ADDON="yes" PKG_ADDON_NAME="Boblight" PKG_ADDON_TYPE="xbmc.service" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" if [ "$DISPLAYSERVER" = "x11" ] ; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXext libXrender" diff --git a/packages/addons/service/boblightd/source/bin/boblightd.start b/packages/addons/service/boblightd/source/bin/boblightd.start index 6a7e586f05..0d99d7652f 100755 --- a/packages/addons/service/boblightd/source/bin/boblightd.start +++ b/packages/addons/service/boblightd/source/bin/boblightd.start @@ -1,24 +1,7 @@ #!/bin/bash -################################################################################ -# Copyright (C) 2009-2010 OpenELEC.tv -# http://www.openelec.tv -# -# Boblightd addon maintained by Adam Boeglin: adamrb@gmail.com -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2010 Adam Boeglin (adamrb@gmail.com) . /etc/profile diff --git a/packages/addons/service/boblightd/source/default.py b/packages/addons/service/boblightd/source/default.py index cd40a7231e..4bcd7d2e7e 100644 --- a/packages/addons/service/boblightd/source/default.py +++ b/packages/addons/service/boblightd/source/default.py @@ -1,17 +1,2 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) diff --git a/packages/addons/service/boblightd/source/sleep.d/boblightd.power b/packages/addons/service/boblightd/source/sleep.d/boblightd.power index a7e6071df4..5713bb983f 100644 --- a/packages/addons/service/boblightd/source/sleep.d/boblightd.power +++ b/packages/addons/service/boblightd/source/sleep.d/boblightd.power @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/service/dispmanx_vnc/changelog.txt b/packages/addons/service/dispmanx_vnc/changelog.txt index 4332756051..5d59d092aa 100644 --- a/packages/addons/service/dispmanx_vnc/changelog.txt +++ b/packages/addons/service/dispmanx_vnc/changelog.txt @@ -1,8 +1,20 @@ -8.0.102 +106 +- Fix versioning + +105 +- Update to 5bde54b + +104 +- Force build against systemd + +103 +- Update to 77b33a6 + +102 - Build with Linux 4.7 RPi libraries -8.0.101 +101 - Move settings to Kodi -8.0.100 +100 - Initial addon diff --git a/packages/addons/service/dispmanx_vnc/package.mk b/packages/addons/service/dispmanx_vnc/package.mk index bebe78c26e..0f6425c19a 100644 --- a/packages/addons/service/dispmanx_vnc/package.mk +++ b/packages/addons/service/dispmanx_vnc/package.mk @@ -1,34 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dispmanx_vnc" -PKG_VERSION="78e6673" -PKG_REV="102" +PKG_VERSION="5bde54b5a43a2e6f65994f3b9c665db90c45923f" +PKG_SHA256="1f096cd70d86620596db947757486064fe37dc2766ad33530318c35b279472aa" +PKG_VERSION_DATE="2018-08-18" +PKG_REV="106" PKG_ARCH="arm" -PKG_ADDON_PROJECTS="RPi RPi2" +PKG_ADDON_PROJECTS="RPi" PKG_LICENSE="OSS" PKG_SITE="https://github.com/patrikolausson/dispmanx_vnc" PKG_URL="https://github.com/patrikolausson/dispmanx_vnc/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libvncserver bcm2835-bootloader bcm2835-driver libconfig libressl" +PKG_DEPENDS_TARGET="toolchain libvncserver bcm2835-bootloader bcm2835-driver libconfig openssl" PKG_SECTION="service/system" PKG_SHORTDESC="Raspberry Pi VNC: a Virtual Network Computing server for Raspberry Pi" -PKG_LONGDESC="Raspberry Pi VNC ($PKG_VERSION) is a Virtual Network Computing (VNC) server for Raspberry Pi using dispmanx" -PKG_AUTORECONF="no" +PKG_LONGDESC="Raspberry Pi VNC ($PKG_VERSION_DATE) is a Virtual Network Computing (VNC) server for Raspberry Pi using dispmanx" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Raspberry Pi VNC" @@ -40,7 +26,7 @@ pre_make_target() { } makeinstall_target() { - : # nop + : } addon() { diff --git a/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch b/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch index 08dfb3d253..2a08a06f3f 100644 --- a/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch +++ b/packages/addons/service/dispmanx_vnc/patches/dispmanx_vnc-0001_fix-cross-compile.patch @@ -14,7 +14,7 @@ diff -Naur a/Makefile b/Makefile + +INCLUDES = -I$(SYSROOT_PREFIX)/usr/include/ -I$(SYSROOT_PREFIX)/usr/include/interface/vcos/pthreads -I$(SYSROOT_PREFIX)/usr/include/interface/vmcs_host/linux +LIB_PATHS = -L$(SYSROOT_PREFIX)/usr/lib/ -+LIBS = -lbrcmGLESv2 -lbrcmEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lconfig++ -lz -lssl -lcrypto -lresolv -lvncserver -ljpeg -lpng16 ++LIBS = -lbrcmGLESv2 -lbrcmEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lconfig++ -lz -lssl -lcrypto -lresolv -lvncserver -ljpeg -lpng16 -lsystemd SOURCES = main.cpp \ UFile.cpp \ diff --git a/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service b/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service index 4b0d232a34..fb226d6458 100755 --- a/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service +++ b/packages/addons/service/dispmanx_vnc/source/bin/dispmanx_vncserver-service @@ -1,21 +1,8 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + . /etc/profile oe_setup_addon service.system.dispmanx_vnc diff --git a/packages/addons/service/dispmanx_vnc/source/default.py b/packages/addons/service/dispmanx_vnc/source/default.py index 0a5065ba27..42617aaaca 100644 --- a/packages/addons/service/dispmanx_vnc/source/default.py +++ b/packages/addons/service/dispmanx_vnc/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/docker/changelog.txt b/packages/addons/service/docker/changelog.txt index af58d08bd9..ec61d50ca1 100644 --- a/packages/addons/service/docker/changelog.txt +++ b/packages/addons/service/docker/changelog.txt @@ -1,44 +1,77 @@ -8.1.111 +122 +- Update to docker 18.09.1 + +121 +- Update to docker 18.09.1-rc1 + +120 +- Update to docker 18.09.1-beta1 + +119 +- Update to docker 18.09.0 + +118 +- Update to docker 18.06.1-ce + +117 +- Update to docker 17.10 + +116 +- change to new project structure + +114 +- Enable journald buildtag + +113 +- Update to docker 1.13.1 +- Update to golang 1.7.5 + +112 +- Update to docker 1.13.0 +- Use journald log driver +- Add docker-init (tini) + +111 - Add temporary cleanup for old systemd service -8.1.110 +110 - Update to docker 1.12.5 - Adjust the systemd service file -8.1.109 +109 - Update to docker 1.12.3 - Include ctop utility -8.0.108 +108 - Update to docker 1.12.2 -8.0.107 +107 - Update to docker 1.12.1 -8.0.106 +106 - Include missing docker-proxy -8.0.105 +105 - Update to docker 1.12.0 - Update to golang 1.6.3 - Use overlay2 driver (new installs only) - Remove docker-containerd-ctr -8.0.104 +104 - Update to docker 1.11.2 -8.0.103 +103 - Allow using kodi notifications based on Docker events API -8.0.102 +102 - Update to docker 1.11.1 -8.0.101 +101 - Update to golang 1.6.2 - Update to docker 1.11.0 -8.0.100 +100 - Update for LibreELEC 8.0 -7.0.100 +100 - Initial release diff --git a/packages/addons/service/docker/package.mk b/packages/addons/service/docker/package.mk index 084d0cd2bf..d2fffbb6e9 100644 --- a/packages/addons/service/docker/package.mk +++ b/packages/addons/service/docker/package.mk @@ -1,34 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="docker" -PKG_VERSION="1.12.5" -PKG_REV="111" +PKG_VERSION="18.09.1" +PKG_SHA256="9eadb1eae1954b0322aadf6505f5397d1b1eccf6395ab511cadf8e6975cfc576" +PKG_REV="122" PKG_ARCH="any" -PKG_ADDON_PROJECTS="Generic RPi RPi2 imx6 WeTek_Hub WeTek_Play_2 Odroid_C2" +PKG_ADDON_PROJECTS="any !WeTek_Core !WeTek_Play" PKG_LICENSE="ASL" PKG_SITE="http://www.docker.com/" -PKG_URL="https://github.com/docker/docker/archive/v${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain sqlite go:host containerd runc" +PKG_URL="https://github.com/docker/docker-ce/archive/v${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain sqlite go:host containerd runc libnetwork tini systemd" PKG_SECTION="service/system" PKG_SHORTDESC="Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere." PKG_LONGDESC="Docker containers can encapsulate any payload, and will run consistently on and between virtually any server. The same container that a developer builds and tests on a laptop will run at scale, in production*, on VMs, bare-metal servers, OpenStack clusters, public instances, or combinations of the above." -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Docker" @@ -39,7 +26,8 @@ configure_target() { autogen \ exclude_graphdriver_devicemapper \ exclude_graphdriver_aufs \ - exclude_graphdriver_btrfs" + exclude_graphdriver_btrfs \ + journald" case $TARGET_ARCH in x86_64) @@ -52,9 +40,9 @@ configure_target() { arm1176jzf-s) export GOARM=6 ;; - cortex-a7|cortex-a9) - export GOARM=7 - ;; + *) + export GOARM=7 + ;; esac ;; aarch64) @@ -67,25 +55,71 @@ configure_target() { export CGO_NO_EMULATION=1 export CGO_CFLAGS=$CFLAGS export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld $CC" - export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go - export GOPATH=$ROOT/$PKG_BUILD/.gopath:$ROOT/$PKG_BUILD/vendor - export GOROOT=$ROOT/$TOOLCHAIN/lib/golang + export GOLANG=$TOOLCHAIN/lib/golang/bin/go + export GOPATH=$PKG_BUILD/.gopath_cli:$PKG_BUILD/.gopath + export GOROOT=$TOOLCHAIN/lib/golang export PATH=$PATH:$GOROOT/bin - ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/vendor/src/github.com/docker/docker + mkdir -p $PKG_BUILD/.gopath + mkdir -p $PKG_BUILD/.gopath_cli + + PKG_ENGINE_PATH=$PKG_BUILD/components/engine + PKG_CLI_PATH=$PKG_BUILD/components/cli + + if [ -d $PKG_ENGINE_PATH/vendor ]; then + mv $PKG_ENGINE_PATH/vendor $PKG_BUILD/.gopath/src + fi + + if [ -d $PKG_CLI_PATH/vendor ]; then + mv $PKG_CLI_PATH/vendor $PKG_BUILD/.gopath_cli/src + fi + + # Fix missing/incompatible .go files + cp -rf $PKG_BUILD/.gopath/src/github.com/moby/buildkit/frontend/* $PKG_BUILD/.gopath_cli/src/github.com/moby/buildkit/frontend + cp -rf $PKG_BUILD/.gopath/src/github.com/moby/buildkit/frontend/gateway/* $PKG_BUILD/.gopath_cli/src/github.com/moby/buildkit/frontend/gateway + cp -rf $PKG_BUILD/.gopath/src/github.com/moby/buildkit/solver/* $PKG_BUILD/.gopath_cli/src/github.com/moby/buildkit/solver + cp -rf $PKG_BUILD/.gopath/src/github.com/moby/buildkit/util/progress/* $PKG_BUILD/.gopath_cli/src/github.com/moby/buildkit/util/progress + cp -rf $PKG_BUILD/.gopath/src/github.com/docker/swarmkit/manager/* $PKG_BUILD/.gopath_cli/src/github.com/docker/swarmkit/manager + cp -rf $PKG_BUILD/.gopath/src/github.com/coreos/etcd/raft/* $PKG_BUILD/.gopath_cli/src/github.com/coreos/etcd/raft + cp -rf $PKG_BUILD/.gopath/src/golang.org/x/* $PKG_BUILD/.gopath_cli/src/golang.org/x + cp -rf $PKG_BUILD/.gopath/src/github.com/opencontainers/runtime-spec/specs-go/* $PKG_BUILD/.gopath_cli/src/github.com/opencontainers/runtime-spec/specs-go + + rm -rf $PKG_BUILD/.gopath_cli/src/github.com/containerd/containerd + mkdir -p $PKG_BUILD/.gopath_cli/src/github.com/containerd/containerd + cp -rf $PKG_BUILD/.gopath/src/github.com/containerd/containerd/* $PKG_BUILD/.gopath_cli/src/github.com/containerd/containerd + + rm -rf $PKG_BUILD/.gopath_cli/src/github.com/containerd/continuity + mkdir -p $PKG_BUILD/.gopath_cli/src/github.com/containerd/continuity + cp -rf $PKG_BUILD/.gopath/src/github.com/containerd/continuity/* $PKG_BUILD/.gopath_cli/src/github.com/containerd/continuity + + mkdir -p $PKG_BUILD/.gopath_cli/src/github.com/docker/docker/builder + cp -rf $PKG_ENGINE_PATH/builder/* $PKG_BUILD/.gopath_cli/src/github.com/docker/docker/builder + + if [ ! -L $PKG_BUILD/.gopath/src/github.com/docker/docker ];then + ln -fs $PKG_ENGINE_PATH $PKG_BUILD/.gopath/src/github.com/docker/docker + fi + + if [ ! -L $PKG_BUILD/.gopath_cli/src/github.com/docker/cli ];then + ln -fs $PKG_CLI_PATH $PKG_BUILD/.gopath_cli/src/github.com/docker/cli + fi # used for docker version - export GITCOMMIT=$PKG_VERSION - export VERSION=$PKG_VERSION + export GITCOMMIT=${PKG_VERSION} + export VERSION=${PKG_VERSION} export BUILDTIME="$(date --utc)" - bash ./hack/make/.go-autogen + + cd $PKG_ENGINE_PATH + bash hack/make/.go-autogen + cd $PKG_BUILD } make_target() { mkdir -p bin - $GOLANG build -v -o bin/docker -a -tags "$DOCKER_BUILDTAGS" -ldflags "$LDFLAGS" ./cmd/docker - $GOLANG build -v -o bin/dockerd -a -tags "$DOCKER_BUILDTAGS" -ldflags "$LDFLAGS" ./cmd/dockerd - $GOLANG build -v -o bin/docker-proxy -a -ldflags "$LDFLAGS" ./vendor/src/github.com/docker/libnetwork/cmd/proxy + PKG_CLI_FLAGS="-X 'github.com/docker/cli/cli.Version=${VERSION}'" + PKG_CLI_FLAGS="${PKG_CLI_FLAGS} -X 'github.com/docker/cli/cli.GitCommit=${GITCOMMIT}'" + PKG_CLI_FLAGS="${PKG_CLI_FLAGS} -X 'github.com/docker/cli/cli.BuildTime=${BUILDTIME}'" + $GOLANG build -v -o bin/docker -a -tags "$DOCKER_BUILDTAGS" -ldflags "$LDFLAGS ${PKG_CLI_FLAGS}" ./components/cli/cmd/docker + $GOLANG build -v -o bin/dockerd -a -tags "$DOCKER_BUILDTAGS" -ldflags "$LDFLAGS" ./components/engine/cmd/dockerd } makeinstall_target() { @@ -94,14 +128,19 @@ makeinstall_target() { addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $ROOT/$PKG_BUILD/bin/docker $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $ROOT/$PKG_BUILD/bin/dockerd $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $ROOT/$PKG_BUILD/bin/docker-proxy $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/bin/docker $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/bin/dockerd $ADDON_BUILD/$PKG_ADDON_ID/bin # containerd - cp -P $(get_build_dir containerd)/bin/containerd $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-containerd - cp -P $(get_build_dir containerd)/bin/containerd-shim $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-containerd-shim + cp -P $(get_build_dir containerd)/bin/containerd $ADDON_BUILD/$PKG_ADDON_ID/bin/containerd + cp -P $(get_build_dir containerd)/bin/containerd-shim $ADDON_BUILD/$PKG_ADDON_ID/bin/containerd-shim + + # libnetwork + cp -P $(get_build_dir libnetwork)/bin/docker-proxy $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-proxy # runc - cp -P $(get_build_dir runc)/bin/runc $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-runc + cp -P $(get_build_dir runc)/bin/runc $ADDON_BUILD/$PKG_ADDON_ID/bin/runc + + # tini + cp -P $(get_build_dir tini)/.$TARGET_NAME/tini-static $ADDON_BUILD/$PKG_ADDON_ID/bin/docker-init } diff --git a/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch b/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch index dba0a066ff..7ee7ea0444 100644 --- a/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch +++ b/packages/addons/service/docker/patches/docker-001-use-addon-storage-location.patch @@ -1,112 +1,95 @@ -# Created with -# find . -name "*.go" -print | xargs sed -i 's/\/etc\/docker/\/storage\/.kodi\/userdata\/addon_data\/service.system.docker\/config/g' +From 9979cbaa4d0108da552fd452294788a042766995 Mon Sep 17 00:00:00 2001 +From: 5schatten +Date: Wed, 7 Nov 2018 12:22:23 +0100 +Subject: [PATCH] use Kodi addon storage location -diff -Naur a/cmd/dockerd/daemon_solaris.go b/cmd/dockerd/daemon_solaris.go ---- a/cmd/dockerd/daemon_solaris.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/cmd/dockerd/daemon_solaris.go 2016-06-23 10:53:28.544141675 -0700 -@@ -39,7 +39,7 @@ - } +diff --git a/components/cli/vendor/github.com/docker/docker/registry/config_unix.go b/components/cli/vendor/github.com/docker/docker/registry/config_unix.go +index 20fb47bcae..a023df7895 100644 +--- a/components/cli/vendor/github.com/docker/docker/registry/config_unix.go ++++ b/components/cli/vendor/github.com/docker/docker/registry/config_unix.go +@@ -4,7 +4,7 @@ package registry // import "github.com/docker/docker/registry" - func getDaemonConfDir() string { -- return "/etc/docker" -+ return "/storage/.kodi/userdata/addon_data/service.system.docker/config" - } + var ( + // CertsDir is the directory where certificates are stored +- CertsDir = "/etc/docker/certs.d" ++ CertsDir = "/storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d" + ) - // setupConfigReloadTrap configures the USR2 signal to reload the configuration. -diff -Naur a/cmd/dockerd/daemon_unix.go b/cmd/dockerd/daemon_unix.go ---- a/cmd/dockerd/daemon_unix.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/cmd/dockerd/daemon_unix.go 2016-06-23 10:53:28.542141655 -0700 -@@ -18,7 +18,7 @@ - "github.com/docker/libnetwork/portallocator" + // cleanPath is used to ensure that a directory name is valid on the target +diff --git a/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go b/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go +index 832fdb95a4..606ddfaf96 100644 +--- a/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go ++++ b/components/cli/vendor/github.com/docker/docker/registry/endpoint_v1.go +@@ -49,7 +49,7 @@ func validateEndpoint(endpoint *V1Endpoint) error { + if endpoint.IsSecure { + // If registry is secure and HTTPS failed, show user the error and tell them about `--insecure-registry` + // in case that's what they need. DO NOT accept unknown CA certificates, and DO NOT fallback to HTTP. +- return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) ++ return fmt.Errorf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /storage/.kodi/userdata/addon_data/service.system.docker/config/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host) + } + + // If registry is insecure and HTTPS failed, fallback to HTTP. +diff --git a/components/engine/cmd/dockerd/daemon_unix.go b/components/engine/cmd/dockerd/daemon_unix.go +index 7b03e28594..74fc0cfe24 100644 +--- a/components/engine/cmd/dockerd/daemon_unix.go ++++ b/components/engine/cmd/dockerd/daemon_unix.go +@@ -19,7 +19,7 @@ import ( + "golang.org/x/sys/unix" ) -const defaultDaemonConfigFile = "/etc/docker/daemon.json" +const defaultDaemonConfigFile = "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json" - // currentUserIsOwner checks whether the current user is the owner of the given - // file. -@@ -44,7 +44,7 @@ + // setDefaultUmask sets the umask to 0022 to avoid problems + // caused by custom umask +@@ -34,7 +34,7 @@ func setDefaultUmask() error { } - func getDaemonConfDir() string { + func getDaemonConfDir(_ string) string { - return "/etc/docker" + return "/storage/.kodi/userdata/addon_data/service.system.docker/config" } - // setupConfigReloadTrap configures the USR2 signal to reload the configuration. -diff -Naur a/integration-cli/docker_cli_authz_unix_test.go b/integration-cli/docker_cli_authz_unix_test.go ---- a/integration-cli/docker_cli_authz_unix_test.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/integration-cli/docker_cli_authz_unix_test.go 2016-06-23 10:53:28.339139631 -0700 -@@ -142,10 +142,10 @@ - w.Write(b) - }) - -- err := os.MkdirAll("/etc/docker/plugins", 0755) -+ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) - c.Assert(err, checker.IsNil) - -- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", testAuthZPlugin) -+ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", testAuthZPlugin) - err = ioutil.WriteFile(fileName, []byte(s.server.URL), 0644) - c.Assert(err, checker.IsNil) - } -@@ -194,7 +194,7 @@ - - s.server.Close() - -- err := os.RemoveAll("/etc/docker/plugins") -+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") - c.Assert(err, checker.IsNil) - } - -diff -Naur a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go ---- a/integration-cli/docker_cli_daemon_test.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/integration-cli/docker_cli_daemon_test.go 2016-06-23 10:53:28.411140349 -0700 -@@ -553,13 +553,13 @@ + func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) { +diff --git a/components/engine/daemon/config/config_test.go b/components/engine/daemon/config/config_test.go +index 6998ed3312..c255b62146 100644 +--- a/components/engine/daemon/config/config_test.go ++++ b/components/engine/daemon/config/config_test.go +@@ -463,7 +463,7 @@ func TestReloadSetConfigFileNotExist(t *testing.T) { + func TestReloadDefaultConfigNotExist(t *testing.T) { + skip.If(t, os.Getuid() != 0, "skipping test that requires root") + reloaded := false +- configFile := "/etc/docker/daemon.json" ++ configFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/daemon.json" + flags := pflag.NewFlagSet("test", pflag.ContinueOnError) + flags.String("config-file", configFile, "") + err := Reload(configFile, flags, func(c *Config) { +diff --git a/components/engine/integration-cli/docker_cli_daemon_test.go b/components/engine/integration-cli/docker_cli_daemon_test.go +index 986cc27530..7a0c2805cd 100644 +--- a/components/engine/integration-cli/docker_cli_daemon_test.go ++++ b/components/engine/integration-cli/docker_cli_daemon_test.go +@@ -546,11 +546,11 @@ func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *check.C) { func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) { // TODO: skip or update for Windows daemon - os.Remove("/etc/docker/key.json") + os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") - if err := s.d.Start(); err != nil { - c.Fatalf("Could not start daemon: %v", err) - } - s.d.Stop() + s.d.Start(c) + s.d.Stop(c) - k, err := libtrust.LoadKeyFile("/etc/docker/key.json") + k, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") if err != nil { c.Fatalf("Error opening key file") } -@@ -572,7 +572,7 @@ - - func (s *DockerDaemonSuite) TestDaemonKeyMigration(c *check.C) { - // TODO: skip or update for Windows daemon -- os.Remove("/etc/docker/key.json") -+ os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") - k1, err := libtrust.GenerateECP256PrivateKey() - if err != nil { - c.Fatalf("Error generating private key: %s", err) -@@ -589,7 +589,7 @@ - } - s.d.Stop() - -- k2, err := libtrust.LoadKeyFile("/etc/docker/key.json") -+ k2, err := libtrust.LoadKeyFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") - if err != nil { - c.Fatalf("Error opening key file") - } -@@ -1337,7 +1337,7 @@ +@@ -1198,12 +1198,12 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) { Y string `json:"y"` } - os.Remove("/etc/docker/key.json") + os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") - if err := s.d.Start(); err != nil { - c.Fatalf("Failed to start daemon: %v", err) - } -@@ -1347,7 +1347,7 @@ - } + s.d.Start(c) + s.d.Stop(c) config := &Config{} - bytes, err := ioutil.ReadFile("/etc/docker/key.json") @@ -114,7 +97,7 @@ diff -Naur a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_ if err != nil { c.Fatalf("Error reading key.json file: %s", err) } -@@ -1367,11 +1367,11 @@ +@@ -1223,11 +1223,11 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *check.C) { } // write back @@ -126,40 +109,13 @@ diff -Naur a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_ - defer os.Remove("/etc/docker/key.json") + defer os.Remove("/storage/.kodi/userdata/addon_data/service.system.docker/config/key.json") - if err := s.d.Start(); err == nil { + if err := s.d.StartWithError(); err == nil { c.Fatalf("It should not be successful to start daemon with wrong key: %v", err) -diff -Naur a/integration-cli/docker_cli_external_graphdriver_unix_test.go b/integration-cli/docker_cli_external_graphdriver_unix_test.go ---- a/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/integration-cli/docker_cli_external_graphdriver_unix_test.go 2016-06-23 10:53:28.444140678 -0700 -@@ -321,10 +321,10 @@ - respond(w, &graphDriverResponse{Size: size}) - }) - -- err = os.MkdirAll("/etc/docker/plugins", 0755) -- c.Assert(err, check.IsNil, check.Commentf("error creating /etc/docker/plugins")) -+ err = os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) -+ c.Assert(err, check.IsNil, check.Commentf("error creating /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")) - -- specFile := "/etc/docker/plugins/" + name + "." + ext -+ specFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/" + name + "." + ext - err = ioutil.WriteFile(specFile, b, 0644) - c.Assert(err, check.IsNil, check.Commentf("error writing to %s", specFile)) - } -@@ -333,8 +333,8 @@ - s.server.Close() - s.jserver.Close() - -- err := os.RemoveAll("/etc/docker/plugins") -- c.Assert(err, check.IsNil, check.Commentf("error removing /etc/docker/plugins")) -+ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") -+ c.Assert(err, check.IsNil, check.Commentf("error removing /storage/.kodi/userdata/addon_data/service.system.docker/config/plugins")) - } - - func (s *DockerExternalGraphdriverSuite) TestExternalGraphDriver(c *check.C) { -diff -Naur a/integration-cli/docker_cli_external_volume_driver_unix_test.go b/integration-cli/docker_cli_external_volume_driver_unix_test.go ---- a/integration-cli/docker_cli_external_volume_driver_unix_test.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/integration-cli/docker_cli_external_volume_driver_unix_test.go 2016-06-23 10:53:28.435140588 -0700 -@@ -239,17 +239,17 @@ +diff --git a/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go b/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go +index da8bb7e011..605a162e79 100644 +--- a/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go ++++ b/components/engine/integration-cli/docker_cli_external_volume_driver_unix_test.go +@@ -267,10 +267,10 @@ func newVolumePlugin(c *check.C, name string) *volumePlugin { send(w, `{"Capabilities": { "Scope": "global" }}`) }) @@ -167,20 +123,21 @@ diff -Naur a/integration-cli/docker_cli_external_volume_driver_unix_test.go b/in + err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) c.Assert(err, checker.IsNil) -- err = ioutil.WriteFile("/etc/docker/plugins/test-external-volume-driver.spec", []byte(s.server.URL), 0644) -+ err = ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-volume-driver.spec", []byte(s.server.URL), 0644) +- err = ioutil.WriteFile("/etc/docker/plugins/"+name+".spec", []byte(s.Server.URL), 0644) ++ err = ioutil.WriteFile("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/"+name+".spec", []byte(s.Server.URL), 0644) c.Assert(err, checker.IsNil) + return s } - +@@ -278,7 +278,7 @@ func newVolumePlugin(c *check.C, name string) *volumePlugin { func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) { - s.server.Close() + s.volumePlugin.Close() - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") c.Assert(err, checker.IsNil) } -@@ -334,7 +334,7 @@ +@@ -371,7 +371,7 @@ func hostVolumePath(name string) string { // Make sure a request to use a down driver doesn't block other requests func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *check.C) { @@ -189,19 +146,42 @@ diff -Naur a/integration-cli/docker_cli_external_volume_driver_unix_test.go b/in err := ioutil.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0644) c.Assert(err, check.IsNil) defer os.RemoveAll(specPath) -@@ -373,7 +373,7 @@ - err := s.d.StartWithBusybox() +diff --git a/components/engine/integration-cli/docker_cli_network_unix_test.go b/components/engine/integration-cli/docker_cli_network_unix_test.go +index d3d6256a75..a0f0ae973d 100644 +--- a/components/engine/integration-cli/docker_cli_network_unix_test.go ++++ b/components/engine/integration-cli/docker_cli_network_unix_test.go +@@ -208,14 +208,14 @@ func setupRemoteNetworkDrivers(c *check.C, mux *http.ServeMux, url, netDrv, ipam + } + }) + +- err := os.MkdirAll("/etc/docker/plugins", 0755) ++ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) c.Assert(err, checker.IsNil) -- specPath := "/etc/docker/plugins/test-external-volume-driver-retry.spec" -+ specPath := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/test-external-volume-driver-retry.spec" - os.RemoveAll(specPath) - defer os.RemoveAll(specPath) +- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv) ++ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", netDrv) + err = ioutil.WriteFile(fileName, []byte(url), 0644) + c.Assert(err, checker.IsNil) -diff -Naur a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go ---- a/integration-cli/docker_cli_network_unix_test.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/integration-cli/docker_cli_network_unix_test.go 2016-06-23 10:53:28.441140648 -0700 -@@ -201,14 +201,14 @@ +- ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv) ++ ipamFileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", ipamDrv) + err = ioutil.WriteFile(ipamFileName, []byte(url), 0644) + c.Assert(err, checker.IsNil) + } +@@ -227,7 +227,7 @@ func (s *DockerNetworkSuite) TearDownSuite(c *check.C) { + + s.server.Close() + +- err := os.RemoveAll("/etc/docker/plugins") ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") + c.Assert(err, checker.IsNil) + } + +diff --git a/components/engine/integration-cli/docker_cli_swarm_test.go b/components/engine/integration-cli/docker_cli_swarm_test.go +index 9f99d0c849..2d9a4b088e 100644 +--- a/components/engine/integration-cli/docker_cli_swarm_test.go ++++ b/components/engine/integration-cli/docker_cli_swarm_test.go +@@ -783,14 +783,14 @@ func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv, } }) @@ -219,30 +199,78 @@ diff -Naur a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/d err = ioutil.WriteFile(ipamFileName, []byte(url), 0644) c.Assert(err, checker.IsNil) } -@@ -220,7 +220,7 @@ +@@ -802,7 +802,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) { + setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin) + defer func() { + s.server.Close() +- err := os.RemoveAll("/etc/docker/plugins") ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") + c.Assert(err, checker.IsNil) + }() + +diff --git a/components/engine/integration/plugin/authz/authz_plugin_test.go b/components/engine/integration/plugin/authz/authz_plugin_test.go +index d0f5d8a783..ba626c6310 100644 +--- a/components/engine/integration/plugin/authz/authz_plugin_test.go ++++ b/components/engine/integration/plugin/authz/authz_plugin_test.go +@@ -55,15 +55,15 @@ func setupTestV1(t *testing.T) func() { + ctrl = &authorizationController{} + teardown := setupTest(t) - s.server.Close() +- err := os.MkdirAll("/etc/docker/plugins", 0755) ++ err := os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) + assert.NilError(t, err) +- fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", testAuthZPlugin) ++ fileName := fmt.Sprintf("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/%s.spec", testAuthZPlugin) + err = ioutil.WriteFile(fileName, []byte(server.URL), 0644) + assert.NilError(t, err) + + return func() { +- err := os.RemoveAll("/etc/docker/plugins") ++ err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") + assert.NilError(t, err) + + teardown() +diff --git a/components/engine/integration/plugin/graphdriver/external_test.go b/components/engine/integration/plugin/graphdriver/external_test.go +index 99ce60ceef..53242b1ee0 100644 +--- a/components/engine/integration/plugin/graphdriver/external_test.go ++++ b/components/engine/integration/plugin/graphdriver/external_test.go +@@ -79,7 +79,7 @@ func TestExternalGraphDriver(t *testing.T) { + + sserver.Close() + jserver.Close() - err := os.RemoveAll("/etc/docker/plugins") + err := os.RemoveAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins") - c.Assert(err, checker.IsNil) + assert.NilError(t, err) } -diff -Naur a/pkg/plugins/discovery.go b/pkg/plugins/discovery.go ---- a/pkg/plugins/discovery.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/pkg/plugins/discovery.go 2016-06-23 10:53:28.636142593 -0700 -@@ -16,7 +16,7 @@ - // ErrNotFound plugin not found - ErrNotFound = errors.New("plugin not found") - socketsPath = "/run/docker/plugins" -- specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"} -+ specsPaths = []string{"/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", "/usr/lib/docker/plugins"} - ) +@@ -344,10 +344,10 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu + respond(w, &graphDriverResponse{Size: size}) + }) - // localRegistry defines a registry that is local (using unix socket). -diff -Naur a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go ---- a/pkg/plugins/plugins.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/pkg/plugins/plugins.go 2016-06-23 10:53:28.636142593 -0700 +- err = os.MkdirAll("/etc/docker/plugins", 0755) ++ err = os.MkdirAll("/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", 0755) + assert.NilError(t, err) + +- specFile := "/etc/docker/plugins/" + name + "." + ext ++ specFile := "/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins/" + name + "." + ext + err = ioutil.WriteFile(specFile, b, 0644) + assert.NilError(t, err) + } +diff --git a/components/engine/pkg/plugins/discovery_unix.go b/components/engine/pkg/plugins/discovery_unix.go +index 58058f2828..a7b449ca25 100644 +--- a/components/engine/pkg/plugins/discovery_unix.go ++++ b/components/engine/pkg/plugins/discovery_unix.go +@@ -2,4 +2,4 @@ + + package plugins // import "github.com/docker/docker/pkg/plugins" + +-var specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"} ++var specsPaths = []string{"/storage/.kodi/userdata/addon_data/service.system.docker/config/plugins", "/usr/lib/docker/plugins"} +diff --git a/components/engine/pkg/plugins/plugins.go b/components/engine/pkg/plugins/plugins.go +index 28c06ff693..c24cad2b63 100644 +--- a/components/engine/pkg/plugins/plugins.go ++++ b/components/engine/pkg/plugins/plugins.go @@ -4,7 +4,7 @@ // Docker discovers plugins by looking for them in the plugin directory whenever // a user or container tries to use one by name. UNIX domain socket files must @@ -252,10 +280,11 @@ diff -Naur a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go // by the Registry interface, which lets you list all plugins or get a plugin by // its name if it exists. // -diff -Naur a/registry/config_unix.go b/registry/config_unix.go ---- a/registry/config_unix.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/registry/config_unix.go 2016-06-23 10:53:28.594142174 -0700 -@@ -4,7 +4,7 @@ +diff --git a/components/engine/registry/config_unix.go b/components/engine/registry/config_unix.go +index 20fb47bcae..a023df7895 100644 +--- a/components/engine/registry/config_unix.go ++++ b/components/engine/registry/config_unix.go +@@ -4,7 +4,7 @@ package registry // import "github.com/docker/docker/registry" var ( // CertsDir is the directory where certificates are stored @@ -264,10 +293,11 @@ diff -Naur a/registry/config_unix.go b/registry/config_unix.go ) // cleanPath is used to ensure that a directory name is valid on the target -diff -Naur a/registry/endpoint_v1.go b/registry/endpoint_v1.go ---- a/registry/endpoint_v1.go 2016-06-17 13:28:45.000000000 -0700 -+++ b/registry/endpoint_v1.go 2016-06-23 10:53:28.593142164 -0700 -@@ -49,7 +49,7 @@ +diff --git a/components/engine/registry/endpoint_v1.go b/components/engine/registry/endpoint_v1.go +index 832fdb95a4..606ddfaf96 100644 +--- a/components/engine/registry/endpoint_v1.go ++++ b/components/engine/registry/endpoint_v1.go +@@ -49,7 +49,7 @@ func validateEndpoint(endpoint *V1Endpoint) error { if endpoint.IsSecure { // If registry is secure and HTTPS failed, show user the error and tell them about `--insecure-registry` // in case that's what they need. DO NOT accept unknown CA certificates, and DO NOT fallback to HTTP. diff --git a/packages/addons/service/docker/source/bin/docker-config b/packages/addons/service/docker/source/bin/docker-config index 703240f28a..d3775a7388 100755 --- a/packages/addons/service/docker/source/bin/docker-config +++ b/packages/addons/service/docker/source/bin/docker-config @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) ADDON_DIR="/storage/.kodi/addons/service.system.docker" ADDON_HOME_DIR="/storage/.kodi/userdata/addon_data/service.system.docker" diff --git a/packages/addons/service/docker/source/config/docker.conf b/packages/addons/service/docker/source/config/docker.conf index dd42259fbf..1153af8d14 100644 --- a/packages/addons/service/docker/source/config/docker.conf +++ b/packages/addons/service/docker/source/config/docker.conf @@ -1,2 +1,2 @@ -DOCKER_DAEMON_OPTS="--graph=/storage/.kodi/userdata/addon_data/service.system.docker/docker" +DOCKER_DAEMON_OPTS="--data-root=/storage/.kodi/userdata/addon_data/service.system.docker/docker" DOCKER_STORAGE_OPTS="--storage-driver=overlay2 --storage-opt overlay2.override_kernel_check=1" diff --git a/packages/addons/service/docker/source/default.py b/packages/addons/service/docker/source/default.py index f20849792d..912056d088 100644 --- a/packages/addons/service/docker/source/default.py +++ b/packages/addons/service/docker/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) import os import subprocess diff --git a/packages/addons/service/docker/source/system.d/service.system.docker.service b/packages/addons/service/docker/source/system.d/service.system.docker.service index 4d5e9c975e..ba37b01d98 100644 --- a/packages/addons/service/docker/source/system.d/service.system.docker.service +++ b/packages/addons/service/docker/source/system.d/service.system.docker.service @@ -9,6 +9,7 @@ Environment=PATH=/bin:/sbin:/usr/bin:/usr/sbin:/storage/.kodi/addons/service.sys ExecStartPre=/storage/.kodi/addons/service.system.docker/bin/docker-config EnvironmentFile=-/storage/.kodi/userdata/addon_data/service.system.docker/config/docker.conf ExecStart=/storage/.kodi/addons/service.system.docker/bin/dockerd --exec-opt native.cgroupdriver=systemd \ + --log-driver=journald \ --group=root \ $DOCKER_DAEMON_OPTS \ $DOCKER_STORAGE_OPTS diff --git a/packages/addons/service/emby/changelog.txt b/packages/addons/service/emby/changelog.txt index 0701806b3f..731e2f8c94 100644 --- a/packages/addons/service/emby/changelog.txt +++ b/packages/addons/service/emby/changelog.txt @@ -1,41 +1,92 @@ -110 -- Rebuild ffmpegx with libx264 +124 +- Update to 3.5.3.0 +- Update imagemagick to 7.0.8-11 + +123 +- Update to 3.5.2.0 +- Update imagemagick to 7.0.8-10 and build it without pango + +122 +- Bump addon + +121 +- Update to 3.5.1.0 for netcore + +120 +- Use ffmpeg instead of ffmpegx + +119 +- Update to 3.4.1.6 +- Add script (emby-update) to update Emby + +118 +- Update to 3.3.0.0 +- Moved ffmpegx to ffmpeg-tools add-on + +117 +- Update to 3.2.34.0 +- Use reworked ffmpegx -109 -- Rebuilt ffmpgex and imagemagick +116 +- Update to verson 3.2.27.0 +- Rename to Emby Server + +115 +- Update to version 3.2.26.0 + +114 +- Update to version 3.2.17.0 +- Rebuild libx264, ffmpegx and imagemagick +- Use ffmpgex by default + +113: +- Update to version 3.2.8 +- Rebuild x264 and ffmpegx + +112: +- Refer to libMagickWand-7 + +111: +- Updated to version 3.2.5 +- Rebuild libx264, ffmpegx and imagemagick + +110: +- Rebuild ffmpegx with libx264 -108 -- Updated to version 3.0.8500 +109: +- Rebuild ffmpgex and imagemagick +108: +- Update to version 3.0.8500 -107 -- Updated to version 3.0.8300 -- Rebuilt ffmpegx +107: +- Update to version 3.0.8300 +- Rebuild ffmpegx -106 -- Updated to version 3.0.8100 -- Rebuilt ffmpegx +106: +- Updat to version 3.0.8100 +- Rebuild ffmpegx -105 -- Updated to version 3.0.7100 +105: +- Update to version 3.0.7100 -104 -- Updated to version 3.0.6300 -- Rebuilt ffmpegx +104: +- Update to version 3.0.6300 +- Rebuild ffmpegx -103 -- Updated to version 3.0.6070 +103: +- Update to version 3.0.6070 - Build for all architectures - Refer to libsqlite3.so.0 instead of libsqlite3.so -102 -- Updated to version 3.0.6030 -- Added dedicated ffmpeg and ffprobe -- Removed unused shared libraries +102: +- Update to version 3.0.6030 +- Add dedicated ffmpeg and ffprobe +- Remove unused shared libraries -101 -- Updated to version 3.0.5985 +101: +- Update to version 3.0.5985 - Removed mono build dependency -100 +100: - Initial release diff --git a/packages/addons/service/emby/package.mk b/packages/addons/service/emby/package.mk index 0b90ee47f5..c2a677bd1f 100644 --- a/packages/addons/service/emby/package.mk +++ b/packages/addons/service/emby/package.mk @@ -1,66 +1,35 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="emby" -PKG_VERSION="3.0.8500" -PKG_REV="110" +PKG_VERSION="3.5.3.0" +PKG_SHA256="f25abb6d34f888c467db561ad333a222626febdc69b6353de86c04848753210c" +PKG_REV="124" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://emby.media" -PKG_URL="https://github.com/MediaBrowser/Emby/releases/download/$PKG_VERSION/Emby.Mono.zip" -PKG_DEPENDS_TARGET="toolchain ffmpegx imagemagick" +PKG_URL="https://github.com/MediaBrowser/Emby.Releases/releases/download/$PKG_VERSION/embyserver-netcore_$PKG_VERSION.zip" +PKG_SOURCE_DIR="system" +PKG_DEPENDS_TARGET="toolchain imagemagick" PKG_SECTION="service" -PKG_SHORTDESC="Emby: a personal media server" -PKG_LONGDESC="Emby ($PKG_VERSION) brings your home videos, music, and photos together, automatically converting and streaming your media on-the-fly to any device" +PKG_SHORTDESC="Emby Server: a personal media server" +PKG_LONGDESC="Emby Server ($PKG_VERSION) brings your home videos, music, and photos together, automatically converting and streaming your media on-the-fly to any device" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" -PKG_ADDON_NAME="Emby (beta)" +PKG_ADDON_NAME="Emby Server" PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_REQUIRES="tools.mono:0.0.0" +PKG_ADDON_REQUIRES="tools.ffmpeg-tools:0.0.0 tools.dotnet-runtime:0.0.0" PKG_MAINTAINER="Anton Voyl (awiouy)" -unpack() { - mkdir -p $PKG_BUILD -} - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} - addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/Emby.Mono - unzip -q $ROOT/$SOURCES/$PKG_NAME/$PKG_SOURCE_NAME \ - -d $ADDON_BUILD/$PKG_ADDON_ID/Emby.Mono - - sed -i 's/libsqlite3.so/libsqlite3.so.0/g' \ - $ADDON_BUILD/$PKG_ADDON_ID/Emby.Mono/System.Data.SQLite.dll.config - - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -L $(get_build_dir ffmpegx)/.install_pkg/usr/local/bin/ffmpegx \ - $(get_build_dir ffmpegx)/.install_pkg/usr/local/bin/ffprobex \ - $ADDON_BUILD/$PKG_ADDON_ID/bin/ + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/emby + cp -r $PKG_BUILD/* \ + -d $ADDON_BUILD/$PKG_ADDON_ID/emby mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib - cp -L $(get_build_dir imagemagick)/.install_pkg/usr/lib/libMagickCore-6.Q8.so.2 \ - $(get_build_dir imagemagick)/.install_pkg/usr/lib/libMagickWand-6.Q8.so \ + cp -L $(get_build_dir imagemagick)/.install_pkg/usr/lib/libMagickCore-7.Q16HDRI.so.? \ $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -L $(get_build_dir imagemagick)/.install_pkg/usr/lib/libMagickWand-7.Q16HDRI.so \ + $ADDON_BUILD/$PKG_ADDON_ID/lib/CORE_RL_Wand_.so } diff --git a/packages/addons/service/emby/source/bin/emby.start b/packages/addons/service/emby/source/bin/emby.start index 9caee9e7cc..7c674a5cb8 100644 --- a/packages/addons/service/emby/source/bin/emby.start +++ b/packages/addons/service/emby/source/bin/emby.start @@ -1,32 +1,12 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile oe_setup_addon service.emby -chmod +x $ADDON_DIR/bin/* -mkdir -p $ADDON_HOME - -if [ "$emby_ffmpeg" = "true" ] -then - emby_flags="-ffmpeg $ADDON_DIR/bin/ffmpegx -ffprobe $ADDON_DIR/bin/ffprobex" -fi - -mono $ADDON_DIR/Emby.Mono/MediaBrowser.Server.Mono.exe -programdata $ADDON_HOME \ - $emby_flags +LD_PRELOAD="$ADDON_DIR/lib/libMagickCore-7.Q16HDRI.so.6 \ + $ADDON_DIR/lib/CORE_RL_Wand_.so" \ +nice -n "$emby_nice" \ +le_dotnet $ADDON_DIR/emby/EmbyServer.dll -programdata $ADDON_HOME diff --git a/packages/addons/service/emby/source/default.py b/packages/addons/service/emby/source/default.py index 3999a0eb31..0b9d649ccd 100644 --- a/packages/addons/service/emby/source/default.py +++ b/packages/addons/service/emby/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc @@ -31,5 +16,5 @@ def onSettingsChanged(self): subprocess.call(['systemctl', 'restart', self.id]) -if __name__ == "__main__": +if __name__ == '__main__': Monitor().waitForAbort() diff --git a/packages/addons/service/emby/source/resources/language/English/strings.po b/packages/addons/service/emby/source/resources/language/English/strings.po index 5b56896f44..609e47bd59 100644 --- a/packages/addons/service/emby/source/resources/language/English/strings.po +++ b/packages/addons/service/emby/source/resources/language/English/strings.po @@ -1,4 +1,7 @@ # Kodi Media Center language file +# Addon Name: emby +# Addon id: service.emby +# Addon Provider: Team LibreELEC msgid "" msgstr "" @@ -7,5 +10,5 @@ msgid "Configuration" msgstr "" msgctxt "#30001" -msgid "Use dedicated ffmpeg/ffprobe (experimental)" +msgid "Priority (nice, 0=max, 19=min)" msgstr "" diff --git a/packages/addons/service/emby/source/resources/settings.xml b/packages/addons/service/emby/source/resources/settings.xml index d213cf69e2..2325485e41 100644 --- a/packages/addons/service/emby/source/resources/settings.xml +++ b/packages/addons/service/emby/source/resources/settings.xml @@ -1,6 +1,6 @@ - + diff --git a/packages/addons/service/emby/source/settings-default.xml b/packages/addons/service/emby/source/settings-default.xml new file mode 100644 index 0000000000..8d35529581 --- /dev/null +++ b/packages/addons/service/emby/source/settings-default.xml @@ -0,0 +1,3 @@ + + 10 + diff --git a/packages/addons/service/emby4/changelog.txt b/packages/addons/service/emby4/changelog.txt new file mode 100644 index 0000000000..fe01f1b4fe --- /dev/null +++ b/packages/addons/service/emby4/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial release diff --git a/packages/addons/service/emby4/icon/icon.png b/packages/addons/service/emby4/icon/icon.png new file mode 100644 index 0000000000..2674bc985b Binary files /dev/null and b/packages/addons/service/emby4/icon/icon.png differ diff --git a/packages/addons/service/emby4/package.mk b/packages/addons/service/emby4/package.mk new file mode 100644 index 0000000000..996560d407 --- /dev/null +++ b/packages/addons/service/emby4/package.mk @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="emby4" +PKG_VERSION="4.0.0.2" +PKG_SHA256="cac3de0f4b75d421719676377bae80274338a493e79c0498c8772e7e51cd8edf" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="prop." +PKG_SITE="http://emby.media" +PKG_URL="https://github.com/MediaBrowser/Emby.Releases/releases/download/$PKG_VERSION/embyserver-netcore_$PKG_VERSION.zip" +PKG_SOURCE_DIR="system" +PKG_DEPENDS_TARGET="toolchain imagemagick" +PKG_SECTION="service" +PKG_SHORTDESC="Emby Server: a personal media server" +PKG_LONGDESC="Emby Server ($PKG_VERSION) brings your home videos, music, and photos together, automatically converting and streaming your media on-the-fly to any device" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Emby Server 4" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REQUIRES="tools.ffmpeg-tools:0.0.0 tools.dotnet-runtime:0.0.0" +PKG_MAINTAINER="Anton Voyl (awiouy)" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/emby + cp -r $PKG_BUILD/* \ + -d $ADDON_BUILD/$PKG_ADDON_ID/emby + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -L $(get_build_dir imagemagick)/.install_pkg/usr/lib/libMagickCore-7.Q16HDRI.so.? \ + $ADDON_BUILD/$PKG_ADDON_ID/lib/ + cp -L $(get_build_dir imagemagick)/.install_pkg/usr/lib/libMagickWand-7.Q16HDRI.so \ + $ADDON_BUILD/$PKG_ADDON_ID/lib/CORE_RL_Wand_.so +} diff --git a/packages/addons/service/emby4/source/bin/emby4.start b/packages/addons/service/emby4/source/bin/emby4.start new file mode 100644 index 0000000000..fde212a96c --- /dev/null +++ b/packages/addons/service/emby4/source/bin/emby4.start @@ -0,0 +1,15 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.emby4 + +LD_PRELOAD="$ADDON_DIR/lib/libMagickCore-7.Q16HDRI.so.6 \ + $ADDON_DIR/lib/CORE_RL_Wand_.so" \ +nice -n "$emby_nice" \ +le_dotnet $ADDON_DIR/emby/EmbyServer.dll \ + -programdata $ADDON_HOME \ + -ffmpeg /storage/.kodi/addons/tools.ffmpeg-tools/bin/ffmpeg \ + -ffprobe /storage/.kodi/addons/tools.ffmpeg-tools/bin/ffprobe diff --git a/packages/addons/service/emby4/source/default.py b/packages/addons/service/emby4/source/default.py new file mode 100644 index 0000000000..d45cf2a6dc --- /dev/null +++ b/packages/addons/service/emby4/source/default.py @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +import json +import subprocess +import xbmc +import xbmcaddon +import xbmcgui + + +def jsonrpc(request): + return json.loads(xbmc.executeJSONRPC(json.dumps(request))) + + +def disable_conflicting(conficting, + message='{that} conflicts with {this} and has been disabled'): + is_enabled = {'jsonrpc': '2.0', 'method': 'Addons.GetAddonDetails', 'id': 1, + 'params': {'addonid': conficting, 'properties': ['enabled']}} + disable = {'jsonrpc': '2.0', 'method': 'Addons.SetAddonEnabled', 'id': 1, + 'params': {'addonid': conficting, 'enabled': False}} + try: + if jsonrpc(is_enabled)['result']['addon']['enabled']: + this = xbmcaddon.Addon().getAddonInfo('name') + that = xbmcaddon.Addon(conficting).getAddonInfo('name') + jsonrpc(disable) + dialog = xbmcgui.Dialog() + dialog.ok(this, message.format( + this=this, that=that)) + del dialog + except KeyError: + pass + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == '__main__': + disable_conflicting('service.emby') + Monitor().waitForAbort() diff --git a/packages/addons/service/emby4/source/resources/language/English/strings.po b/packages/addons/service/emby4/source/resources/language/English/strings.po new file mode 100644 index 0000000000..2e2eea991b --- /dev/null +++ b/packages/addons/service/emby4/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: emby4 +# Addon id: service.emby4 +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Priority (nice, 0=max, 19=min)" +msgstr "" diff --git a/packages/addons/service/emby4/source/resources/settings.xml b/packages/addons/service/emby4/source/resources/settings.xml new file mode 100644 index 0000000000..2325485e41 --- /dev/null +++ b/packages/addons/service/emby4/source/resources/settings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/addons/service/emby4/source/settings-default.xml b/packages/addons/service/emby4/source/settings-default.xml new file mode 100644 index 0000000000..8d35529581 --- /dev/null +++ b/packages/addons/service/emby4/source/settings-default.xml @@ -0,0 +1,3 @@ + + 10 + diff --git a/packages/addons/service/emby4/source/system.d/service.emby4.service b/packages/addons/service/emby4/source/system.d/service.emby4.service new file mode 100644 index 0000000000..2a395f625b --- /dev/null +++ b/packages/addons/service/emby4/source/system.d/service.emby4.service @@ -0,0 +1,13 @@ +[Unit] +Description=Emby 4 - streaming server +Documentation=http://emby.media +Wants=kodi.service +After=kodi.service +Conflicts=service.emby.service + +[Service] +ExecStart=/bin/sh /storage/.kodi/addons/service.emby4/bin/emby4.start +Restart=always + +[Install] +WantedBy=kodi.service diff --git a/packages/addons/service/fd628/changelog.txt b/packages/addons/service/fd628/changelog.txt new file mode 100644 index 0000000000..7e95b5bcd7 --- /dev/null +++ b/packages/addons/service/fd628/changelog.txt @@ -0,0 +1,13 @@ +110 +- Rewrite add-on from scratch +- Add support for APPS, SETUP, CVBS (X92) and POWER (A1 Max) indicators. +- Add a configuration dialog: + * Adjust display brightness. + * Storage access indication. + * Advanced hardware configuration of the display. +- Fix crash if aml_fd628 module is not loaded (led_on, led_off files don't exist) +- Fix disable add-on from Kodi UI. +- Turn off indicators when add-on is disabled. + +100 +- Initial add-on diff --git a/packages/addons/service/fd628/icon/icon.png b/packages/addons/service/fd628/icon/icon.png new file mode 100644 index 0000000000..265d6fa943 Binary files /dev/null and b/packages/addons/service/fd628/icon/icon.png differ diff --git a/packages/addons/service/fd628/package.mk b/packages/addons/service/fd628/package.mk new file mode 100644 index 0000000000..ff91f715be --- /dev/null +++ b/packages/addons/service/fd628/package.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="fd628" +PKG_VERSION="1.1" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://libreelec.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="service" +PKG_SHORTDESC="fd628: Kodi service to light up additional icons on devices with FD628 display" +PKG_LONGDESC="fd628: Kodi service to light up additional icons on devices with FD628 display" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="service.fd628" +PKG_ADDON_PROJECTS="S905 S912" +PKG_ADDON_TYPE="xbmc.service" + +make_target() { + sed -e "s|@PKG_VERSION@|$PKG_VERSION|g" \ + -i addon.xml +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID + cp -R $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID +} diff --git a/packages/addons/service/fd628/sources/addon.xml b/packages/addons/service/fd628/sources/addon.xml new file mode 100644 index 0000000000..781a99bf3d --- /dev/null +++ b/packages/addons/service/fd628/sources/addon.xml @@ -0,0 +1,22 @@ + + + + + + + + + Service for controlling FD628 VFD display icons + Service for controlling FD628 VFD display icons, e.g. Ethernet/WiFi connection status and Time + all + + resources/icon.png + + + + diff --git a/packages/addons/service/fd628/sources/resources/language/resource.language.en_gb/strings.po b/packages/addons/service/fd628/sources/resources/language/resource.language.en_gb/strings.po new file mode 100644 index 0000000000..2173018e15 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/language/resource.language.en_gb/strings.po @@ -0,0 +1,136 @@ +# Kodi Media Center language file +# Addon Name: FD628 Display +# Addon id: service.fd628 +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" +"Project-Id-Version: XBMC-Addons\n" +"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n" +"POT-Creation-Date: 2018-02-12 17:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en_GB\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +# Kodi Settings +msgctxt "#30000" +msgid "General" +msgstr "" + +msgctxt "#30001" +msgid "Turn on display" +msgstr "" + +msgctxt "#30002" +msgid "Display brightness" +msgstr "" + +msgctxt "#30003" +msgid "Advanced settings" +msgstr "" + +msgctxt "#30004" +msgid "Display type" +msgstr "" + +msgctxt "#30026" +msgid "Common anode display (transposed ram)" +msgstr "" + +msgctxt "#30013" +msgid "Enable storage access (RW) indicator" +msgstr "" + +msgctxt "#30014" +msgid "Select which icon is to be used as the access indicator" +msgstr "" + +msgctxt "#30028" +msgid "Clock colon (:) always on" +msgstr "" + +msgctxt "#30015" +msgid "play" +msgstr "" + +msgctxt "#30016" +msgid "pause" +msgstr "" + +msgctxt "#30017" +msgid "hdmi" +msgstr "" + +msgctxt "#30018" +msgid "cvbs" +msgstr "" + +msgctxt "#30019" +msgid "eth" +msgstr "" + +msgctxt "#30020" +msgid "wifi" +msgstr "" + +msgctxt "#30021" +msgid "setup" +msgstr "" + +msgctxt "#30022" +msgid "apps" +msgstr "" + +msgctxt "#30023" +msgid "usb" +msgstr "" + +msgctxt "#30024" +msgid "sd" +msgstr "" + +msgctxt "#30025" +msgid "alarm" +msgstr "" + +msgctxt "#30027" +msgid "power" +msgstr "" + +msgctxt "#30012" +msgid "Reorder character indexes" +msgstr "" + +msgctxt "#30005" +msgid "Index 0" +msgstr "" + +msgctxt "#30006" +msgid "Index 1" +msgstr "" + +msgctxt "#30007" +msgid "Index 2" +msgstr "" + +msgctxt "#30008" +msgid "Index 3" +msgstr "" + +msgctxt "#30009" +msgid "Index 4" +msgstr "" + +msgctxt "#30010" +msgid "Index 5" +msgstr "" + +msgctxt "#30011" +msgid "Index 6" +msgstr "" + +# Max index 30028 diff --git a/packages/addons/service/fd628/sources/resources/lib/fd628dev.py b/packages/addons/service/fd628/sources/resources/lib/fd628dev.py new file mode 100644 index 0000000000..9d631d8ac3 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/lib/fd628dev.py @@ -0,0 +1,78 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import os +import struct +from fd628utils import * + +_led_cmd = '/sys/class/leds/le-vfd/led_cmd' + +class fd628Dev: + def __init__(self): + import ioctl + import ctypes + size = ctypes.sizeof(ctypes.c_int(0)) + self._FD628_IOC_MAGIC = ord('M') + self._FD628_IOC_SMODE = ioctl.IOW(self._FD628_IOC_MAGIC, 1, size) + self._FD628_IOC_GMODE = ioctl.IOR(self._FD628_IOC_MAGIC, 2, size) + self._FD628_IOC_SBRIGHT = ioctl.IOW(self._FD628_IOC_MAGIC, 3, size) + self._FD628_IOC_GBRIGHT = ioctl.IOR(self._FD628_IOC_MAGIC, 4, size) + self._FD628_IOC_POWER = ioctl.IOW(self._FD628_IOC_MAGIC, 5, size) + self._FD628_IOC_GVER = ioctl.IOR(self._FD628_IOC_MAGIC, 6, size) + self._FD628_IOC_STATUS_LED = ioctl.IOW(self._FD628_IOC_MAGIC, 7, size) + self._FD628_IOC_GDISPLAY_TYPE = ioctl.IOR(self._FD628_IOC_MAGIC, 8, size) + self._FD628_IOC_SDISPLAY_TYPE = ioctl.IOW(self._FD628_IOC_MAGIC, 9, size) + self._FD628_IOC_SCHARS_ORDER = ioctl.IOW(self._FD628_IOC_MAGIC, 10, 7) + self._FD628_IOC_USE_DTB_CONFIG = ioctl.IOW(self._FD628_IOC_MAGIC, 11, size) + self._FD628_IOC_MAXNR = 12 + + def enableDisplay(self, value): + self.__writeFD628(self._FD628_IOC_POWER, int(value)) + + def getBrightness(self): + return self.__readFD628(self._FD628_IOC_GBRIGHT) + + def setBrightness(self, value): + self.__writeFD628(self._FD628_IOC_SBRIGHT, value) + + def getDisplayType(self): + return self.__readFD628(self._FD628_IOC_GDISPLAY_TYPE) + + def setDisplayType(self, value): + self.__writeFD628(self._FD628_IOC_SDISPLAY_TYPE, value) + + def setCharacterOrder(self, value): + pack = struct.pack('BBBBBBB', value[0], value[1], value[2], value[3], value[4], value[5], value[6]) + self.__writeFD628(self._FD628_IOC_SCHARS_ORDER, pack, True) + + def useDtbConfig(self): + self.__writeFD628(self._FD628_IOC_USE_DTB_CONFIG, 0) + + def __readFD628(self, cmd, isBuf = False): + import ioctl + ret = None + if (ioctl.DIR(cmd) == ioctl.READ and self.__writeFD628(cmd, 0)): + with open(_led_cmd, "rb") as vfd: + ret = vfd.read() + if (ret == ''): + ret = None + if (not isBuf and ret != None): + ret = int(ret, 0) + kodiLog('fd628Dev.__readFD628: value = {0}'.format(str(ret))) + return ret + + def __writeFD628(self, cmd, value, isBuf = False): + ret = False + if (os.path.isfile(_led_cmd)): + if isBuf: + value = ''.join([struct.pack('I', cmd), value]) + else: + value = struct.pack('Ii', cmd, value) + kodiLog('fd628Dev.__writeFD628: value = {0}'.format(repr(value))) + try: + with open(_led_cmd, "wb") as vfd: + vfd.write(value) + ret = True + except Exception as inst: + kodiLogError(inst) + return ret diff --git a/packages/addons/service/fd628/sources/resources/lib/fd628settings.py b/packages/addons/service/fd628/sources/resources/lib/fd628settings.py new file mode 100644 index 0000000000..06bfc92613 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/lib/fd628settings.py @@ -0,0 +1,95 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import xbmcaddon + +addon = xbmcaddon.Addon(id='service.fd628') + +def getSetting(id): + return addon.getSetting(id) + +def getSettingBool(id): + value = getSetting(id).lower() + if (value == 'true'): + value = True + else: + value = False + return value + +def getSettingInt(id): + return int(getSetting(id)) + +def getSettingNumber(id): + return float(getSetting(id)) + +class fd628Settings: + def __init__(self): + self.readValues() + + def isDisplayOn(self): + return self._displayOn + + def isAdvancedSettings(self): + return self._displayAdvanced + + def getBrightness(self): + return self._displayBrightness + + def getDisplayType(self): + return self._displayType + + def isCommonAnode(self): + return self._commonAnode + + def getDisplay(self): + value = self.getDisplayType() + if (self.isCommonAnode()): + value = value + (1 << 16) + return value + + def getCharacterIndex(self, i): + return self._characterIndexes[i] + + def getCharacterIndexes(self): + return self._characterIndexes + + def isStorageIndicator(self): + return self._storageIndicator + + def getStorageIndicatorIcon(self): + return self._storageIndicatorIcon + + def isColonOn(self): + return self._colonOn + + def readValues(self): + self._displayAdvanced = False + self._displayOn = getSettingBool('display.on') + if (self._displayOn): + self._displayBrightness = getSettingInt('display.brightness') + self._storageIndicator = getSettingBool('display.storage.indicator') + self._storageIndicatorIcon = getSetting('display.storage.indicator.icon') + self._colonOn = getSettingBool('display.colon.on') + self._displayAdvanced = getSettingBool('display.advanced') + if (self._displayAdvanced): + self._displayType = getSettingInt('display.type') + self._commonAnode = getSettingBool('display.common.anode') + self._characterIndexes = [] + for i in range(7): + self._characterIndexes.append(getSettingInt('display.char.index{0}'.format(i))) + else: + self.__initDefaultValues() + else: + self.__initDefaultValues() + + def __initDefaultValues(self): + if not (self._displayOn): + self._displayBrightness = 7 + self._storageIndicator = False + self._storageIndicatorIcon = '' + self._colonOn = False + self._displayAdvanced = False + if not (self._displayAdvanced): + self._displayType = 0 + self._commonAnode = False + self._characterIndexes = range(0, 7) diff --git a/packages/addons/service/fd628/sources/resources/lib/fd628states.py b/packages/addons/service/fd628/sources/resources/lib/fd628states.py new file mode 100644 index 0000000000..ef18170d63 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/lib/fd628states.py @@ -0,0 +1,187 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import xbmc +import os +from fd628utils import * + +class fd628State(object): + def __init__(self, ledName): + self._value = False + self._hasChanged = False + self._ledName = ledName + + def _getStr(self, className): + return '{0} ({1})'.format(className, self._ledName) + + def update(self): + raise NotImplementedError + + def getValue(self): + return self._value + + def hasChanged(self): + return self._hasChanged + + def getLedName(self): + return self._ledName + + def _update(self, value): + if (value != self._value): + self._hasChanged = True + self._value = value + else: + self._hasChanged = False + +class fd628IconIndicator(fd628State): + def __init__(self, on, ledName): + super(fd628IconIndicator, self).__init__(ledName) + self._on = on + + def __str__(self): + return self._getStr('fd628IconIndicator') + + def turnOn(self): + self._on = True + + def turnOff(self): + self._on = False + + def toggle(self): + self._on = not self._on + + def update(self): + self._update(self._on) + +class fd628CondVisibility(fd628State): + def __init__(self, ledName, cmd): + super(fd628CondVisibility, self).__init__(ledName) + self._cmd = cmd + + def __str__(self): + return self._getStr('fd628CondVisibility') + + def update(self): + value = xbmc.getCondVisibility(self._cmd) + self._update(value) + +class fd628FileContains(fd628State): + def __init__(self, ledName, path, strings): + super(fd628FileContains, self).__init__(ledName) + self._path = path + self._strings = strings + + def __str__(self): + return self._getStr('fd628FileContains') + + def update(self): + if (os.path.isfile(self._path)): + with open(self._path, 'rb') as state: + content = state.read() + value = self.__checkContent(content) + self._update(value) + else: + self._update(False) + + def __checkContent(self, content): + ret = False + for s in self._strings: + if (s in content): + ret = True + break + return ret + +class fd628WindowChecker(fd628State): + def __init__(self, ledName, windows): + super(fd628WindowChecker, self).__init__(ledName) + self._windows = windows + + def __str__(self): + return self._getStr('fd628WindowChecker') + + def update(self): + value = False + for id in self._windows: + if (xbmc.getCondVisibility('Window.IsVisible({0})'.format(id))): + value = True + break + self._update(value) + +class fd628ExtStorageChecker(fd628State): + def __init__(self, ledName, path): + super(fd628ExtStorageChecker, self).__init__(ledName) + self._path = path + + def __str__(self): + return self._getStr('fd628ExtStorageChecker') + + def update(self): + value = False + for folder, subs, files in os.walk('/dev/disk/by-uuid'): + for filename in files: + path = os.path.realpath(os.path.join(folder, filename)) + if (path.startswith(self._path)): + value = True + break + self._update(value) + +class fd628ExtStorageCount(fd628State): + def __init__(self, ledName, drives, type): + super(fd628ExtStorageCount, self).__init__(ledName) + if (drives == None): # Monitor all drives + self._drives = None + drives = self.__getAllDrives() + else: # Monitor listed drives + self._drives = drives + drives = self.__getSelectedDrives() + self._driveStats = {key: self.__readStatus(key) for key in drives} + kodiLogNotice('fd628ExtStorageCount.__init__: Drive stats ' + str(self._driveStats)) + self._read = False + self._write = False + if (type == 'r'): + self._read = True + elif (type == 'w'): + self._write = True + elif (type == 'rw'): + self._read = True + self._write = True + else: + raise Exception('\'type\' must be \'r\', \'w\' or \'rw\'.') + + def update(self): + value = False + if (self._drives == None): + drives = self.__getAllDrives() + else: + drives = self.__getSelectedDrives() + for drive in drives: + if (not drive in self._driveStats): + self._driveStats[drive] = None + kodiLogNotice('fd628ExtStorageCount.update: New drive found \'{0}\''.format(drive)) + for path, stats in self._driveStats.iteritems(): + newStats = self.__readStatus(path) + if (stats != None and newStats != None): + if (self._read): + value = value or stats[0] != newStats[0] + if (self._write): + value = value or stats[1] != newStats[1] + self._driveStats[path] = newStats + self._update(value) + + def __readStatus(self, path): + path = os.path.join('/sys/block', path, 'stat') + if (os.path.isfile(path)): + with open(path, 'rb') as status: + values = status.read().split() + return (values[2], values[6]) + else: + return None + + def __getAllDrives(self): + drives = [] + for folder, subs, files in os.walk('/sys/block'): + drives = [sub for sub in subs if (not sub.startswith('loop'))] + return drives + + def __getSelectedDrives(self): + return [drive for drive in self.__getAllDrives() if ([d for d in self._drives if drive.startswith(d)])] diff --git a/packages/addons/service/fd628/sources/resources/lib/fd628utils.py b/packages/addons/service/fd628/sources/resources/lib/fd628utils.py new file mode 100644 index 0000000000..d2a9f47d44 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/lib/fd628utils.py @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import xbmc +import xbmcaddon + +addonName = xbmcaddon.Addon(id='service.fd628').getAddonInfo('name') + +def kodiLog(message, level = xbmc.LOGDEBUG): + xbmc.log('{0} -> {1}'.format(addonName, str(message)), level) + +def kodiLogError(message): + kodiLog(message, xbmc.LOGERROR) + +def kodiLogWarning(message): + kodiLog(message, xbmc.LOGWARNING) + +def kodiLogNotice(message): + kodiLog(message, xbmc.LOGNOTICE) diff --git a/packages/addons/service/fd628/sources/resources/lib/ioctl.py b/packages/addons/service/fd628/sources/resources/lib/ioctl.py new file mode 100644 index 0000000000..e368e16d35 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/lib/ioctl.py @@ -0,0 +1,89 @@ +#!/usr/bin/python + +""" +Author: SpliFF +License: Public Domain + +Python ioctl constants and functions module + +Mostly follows specifications in asm-generic/ioctl.h from linux 2.5.36 + +Notable differences: +* no architecture dependant stuff +* size parameters are all passed as bytes, not types (ie pass 4, not int) + +!! WARNING EXPERIMENTAL SOFTWARE !! +Make sure the values returned by these functions are properly tested before using fcntl on anything remotely valuable! +""" + +NRBITS = 8 +TYPEBITS = 8 + +# may be arch dependent + +SIZEBITS = 14 +DIRBITS = 2 + +NRMASK = (1 << NRBITS) - 1 +TYPEMASK = (1 << TYPEBITS) - 1 +SIZEMASK = (1 << SIZEBITS) - 1 +DIRMASK = (1 << DIRBITS) - 1 + +NRSHIFT = 0 +TYPESHIFT = NRSHIFT + NRBITS +SIZESHIFT = TYPESHIFT + TYPEBITS +DIRSHIFT = SIZESHIFT + SIZEBITS + +# may be arch dependent + +NONE = 0x0 +WRITE = 0x1 +READ = 0x2 + +# for the drivers/sound files... + +IN = WRITE << DIRSHIFT +OUT = READ << DIRSHIFT +INOUT = (WRITE | READ) << DIRSHIFT +IOCSIZE_MASK = SIZEMASK << SIZESHIFT +IOCSIZE_SHIFT = SIZESHIFT + +# used to create numbers ... + +def IO( _type, nr): + return IOC(NONE, _type, nr, 0) + +def IOC(direction, _type, nr, size): + return (direction << DIRSHIFT) | (_type << TYPESHIFT) | (nr << NRSHIFT) | (size << SIZESHIFT) + +def IOR( _type, nr, size): + return IOC(READ, _type, nr, size) + +def IOW(_type, nr, size): + return IOC(WRITE, _type, nr, size) + +def IOWR(_type, nr, size): + return IOC(READ|WRITE, _type, nr, size) + +def IOR_BAD(_type, nr, size): + return IOC(READ, _type, nr, size) + +def IOW_BAD(_type, nr, size): + return IOC(WRITE, _type, nr, size) + +def IOWR_BAD(_type, nr, size): + return IOC(READ|WRITE, _type, nr, size) + +# used to decode ioctl numbers.. + +def DIR(nr): + return (nr >> DIRSHIFT) & DIRMASK + +def TYPE(nr): + return (nr >> TYPESHIFT) & TYPEMASK + +def NR(nr): + return (nr >> NRSHIFT) & NRMASK + +def SIZE(nr): + return (nr >> SIZESHIFT) & SIZEMASK diff --git a/packages/addons/service/fd628/sources/resources/lib/service.py b/packages/addons/service/fd628/sources/resources/lib/service.py new file mode 100644 index 0000000000..7fd270f3c3 --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/lib/service.py @@ -0,0 +1,143 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import xbmcaddon +import threading +import os +import fd628states +import fd628dev +import fd628settings +from fd628utils import * + +addon = xbmcaddon.Addon(id='service.fd628') + +class fd628Monitor(xbmc.Monitor): + def __init__(self): + super(fd628Monitor, self).__init__() + self._settingsChangedCallback = None + + def setSettingsChangedCallback(self, callbackObject): + self._settingsChangedCallback = callbackObject + + def onSettingsChanged(self): + kodiLog('Enter fd628Monitor.onSettingsChanged') + if (self._settingsChangedCallback != None): + self._settingsChangedCallback.onSettingsChanged() + +class fd628Addon(): + def __init__(self, monitor): + self._fd628 = fd628dev.fd628Dev() + self._states = [] + self._monitor = monitor + self._monitor.setSettingsChangedCallback(self) + self._settings = fd628settings.fd628Settings() + self._vfdon = '/sys/class/leds/le-vfd/led_on' + self._vfdoff = '/sys/class/leds/le-vfd/led_off' + self._rlock = threading.RLock() + + def run(self): + firstLoop = True + while not self._monitor.abortRequested(): + if self._monitor.waitForAbort(0.5): + break + if (not os.path.isfile(self._vfdon) or not os.path.isfile(self._vfdoff)): + firstLoop = True + continue + if (firstLoop): + self.onSettingsChanged() + firstLoop = False + self.__updateIndicators() + self.__cleanUp() + + def __updateIndicators(self): + ledon = [] + ledoff = [] + if (self._rlock.acquire()): + for state in self._states: + state.update() + if (state.hasChanged()): + if (state.getValue()): + ledon.append(state.getLedName()) + else: + ledoff.append(state.getLedName()) + self.__writeFile(self._vfdon, ledon) + self.__writeFile(self._vfdoff, ledoff) + self._rlock.release() + + def __cleanUp(self): + self.__turnOffIndicators() + self._monitor = None + + def __turnOffIndicators(self): + if (self._rlock.acquire()): + ledoff = [state.getLedName() for state in self._states] + self.__writeFile(self._vfdoff, ledoff) + self._rlock.release() + + def __writeFile(self, path, values): + if (os.path.isfile(path)): + with open(path, "wb") as vfd: + for j in values: + vfd.write(j) + vfd.flush() + + def onSettingsChanged(self): + kodiLog('Enter fd628Addon.onSettingsChanged') + self._settings.readValues() + if (self._rlock.acquire()): + self.__createStates() + self._fd628.enableDisplay(self._settings.isDisplayOn()) + if (self._settings.isDisplayOn()): + self._fd628.setBrightness(self._settings.getBrightness()) + if (self._settings.isAdvancedSettings()): + self._fd628.setDisplayType(self._settings.getDisplay()) + self._fd628.setCharacterOrder(self._settings.getCharacterIndexes()) + else: + self._fd628.useDtbConfig() + if (self._colonIcon != None and self._settings.isColonOn()): + self._colonIcon.turnOn() + self.__updateIndicators() + self._rlock.release() + kodiLog('isDisplayOn = {0}'.format(self._settings.isDisplayOn())) + kodiLog('getBrightness = {0}'.format(self._settings.getBrightness())) + kodiLog('isAdvancedSettings = {0}'.format(self._settings.isAdvancedSettings())) + kodiLog('getDisplayType = {0}'.format(self._settings.getDisplayType())) + kodiLog('isCommonAnode = {0}'.format(self._settings.isCommonAnode())) + kodiLog('getCharacterIndexex = {0}'.format(self._settings.getCharacterIndexes())) + + def __createStates(self): + settingsWindows = ['settings', 'systeminfo', 'systemsettings', 'servicesettings', 'pvrsettings', \ + 'playersettings', 'mediasettings', 'interfacesettings', 'profiles', 'skinsettings', 'videossettings', \ + 'musicsettings', 'appearancesettings', 'picturessettings', 'weathersettings', 'gamesettings', \ + 'service-LibreELEC-Settings-mainWindow.xml', 'service-LibreELEC-Settings-wizard.xml', \ + 'service-LibreELEC-Settings-getPasskey.xml'] + appsWindows = ['addonbrowser', 'addonsettings', 'addoninformation', 'addon', 'programs'] + states = [] + states.append(fd628states.fd628IconIndicator(True, 'power')) + states.append(fd628states.fd628CondVisibility('play', 'Player.Playing')) + states.append(fd628states.fd628CondVisibility('pause', 'Player.Paused')) + states.append(fd628states.fd628FileContains('hdmi', '/sys/class/amhdmitx/amhdmitx0/hpd_state', ['1'])) + states.append(fd628states.fd628FileContains('cvbs', '/sys/class/display/mode', ['cvbs'])) + states.append(fd628states.fd628FileContains('eth', '/sys/class/net/eth0/operstate', ['up', 'unknown'])) + states.append(fd628states.fd628FileContains('wifi', '/sys/class/net/wlan0/operstate', ['up'])) + states.append(fd628states.fd628WindowChecker('setup', settingsWindows)) + states.append(fd628states.fd628WindowChecker('apps', appsWindows)) + states.append(fd628states.fd628ExtStorageChecker('usb', '/dev/sd')) + states.append(fd628states.fd628ExtStorageChecker('sd', '/dev/mmcblk')) + self._colonIcon = fd628states.fd628IconIndicator(False, 'colon') + states.append(self._colonIcon) + if (self._settings.isStorageIndicator()): + for state in states: + if (state.getLedName() == self._settings.getStorageIndicatorIcon()): + states.remove(state) + break + states.append(fd628states.fd628ExtStorageCount(self._settings.getStorageIndicatorIcon(), None, 'rw')) + kodiLog('Active states: ' + str([str(state) for state in states])) + self.__turnOffIndicators() + self._states = states + +monitor = fd628Monitor() +fd628 = fd628Addon(monitor) +kodiLog('Service start.') +fd628.run() +kodiLog('Service stop.') diff --git a/packages/addons/service/fd628/sources/resources/settings.xml b/packages/addons/service/fd628/sources/resources/settings.xml new file mode 100644 index 0000000000..614f0e65af --- /dev/null +++ b/packages/addons/service/fd628/sources/resources/settings.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/hyperion/changelog.txt b/packages/addons/service/hyperion/changelog.txt index 8c3248afdc..1abbaf3e44 100644 --- a/packages/addons/service/hyperion/changelog.txt +++ b/packages/addons/service/hyperion/changelog.txt @@ -1,3 +1,18 @@ +109 +- Update to version 2018-12-20 + +108 +- Update to version 1d125d8 + * Kodi 18 fix merged + * Fix for segfaults + +107 +- Update to version dc6a602 +- Use correct OnAVStart event on Kodi 18 + +106 +- Update to version 1c21232 + 105 - Update protobuf to 3.1.0 - Fix build with gcc 6 diff --git a/packages/addons/service/hyperion/package.mk b/packages/addons/service/hyperion/package.mk index e599ae2e0e..d4d736e330 100644 --- a/packages/addons/service/hyperion/package.mk +++ b/packages/addons/service/hyperion/package.mk @@ -1,66 +1,47 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="hyperion" -PKG_VERSION="355a324" -PKG_REV="105" +PKG_VERSION="22f7be8df010fe8f0a51e3677fe0c8e709042622" +PKG_SHA256="51cb6c5694d4bad67255ac4ae61a3c0aa481395c4868fb044a3ee19ca35bf19d" +PKG_VERSION_DATE="2018-12-20" +PKG_REV="109" +PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/hyperion-project/hyperion" PKG_URL="https://github.com/hyperion-project/hyperion/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python libusb qtbase protobuf rpi_ws281x" +PKG_DEPENDS_TARGET="toolchain Python2 libusb qtbase protobuf rpi_ws281x" PKG_SECTION="service" PKG_SHORTDESC="Hyperion: an AmbiLight controller" -PKG_LONGDESC="Hyperion($PKG_VERSION) is an modern opensource AmbiLight implementation." +PKG_LONGDESC="Hyperion($PKG_VERSION_DATE) is an modern opensource AmbiLight implementation." PKG_IS_ADDON="yes" PKG_ADDON_NAME="Hyperion" PKG_ADDON_TYPE="xbmc.service" -AMLOGIC_SUPPORT="-DENABLE_AMLOGIC=0" -DISPMANX_SUPPORT="-DENABLE_DISPMANX=0" -FB_SUPPORT="-DENABLE_FB=1" -X11_SUPPORT="-DENABLE_X11=0" +PKG_AMLOGIC_SUPPORT="-DENABLE_AMLOGIC=0" +PKG_DISPMANX_SUPPORT="-DENABLE_DISPMANX=0" +PKG_FB_SUPPORT="-DENABLE_FB=1" +PKG_X11_SUPPORT="-DENABLE_X11=0" if [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libamcodec" - AMLOGIC_SUPPORT="-DENABLE_AMLOGIC=1" + PKG_AMLOGIC_SUPPORT="-DENABLE_AMLOGIC=1" elif [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver" - DISPMANX_SUPPORT="-DENABLE_DISPMANX=1" - FB_SUPPORT="-DENABLE_FB=0" + PKG_DISPMANX_SUPPORT="-DENABLE_DISPMANX=1" + PKG_FB_SUPPORT="-DENABLE_FB=0" elif [ "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xorg-server xrandr" - X11_SUPPORT="-DENABLE_X11=1" + PKG_X11_SUPPORT="-DENABLE_X11=1" fi -pre_build_target() { - cp -a $(get_build_dir rpi_ws281x)/* $ROOT/$PKG_BUILD/dependencies/external/rpi_ws281x -} - -pre_configure_target() { - echo "" > ../cmake/FindGitVersion.cmake -} - PKG_CMAKE_OPTS_TARGET="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \ -DHYPERION_VERSION_ID="$PKG_VERSION" \ - $AMLOGIC_SUPPORT \ - $DISPMANX_SUPPORT \ - $FB_SUPPORT \ + $PKG_AMLOGIC_SUPPORT \ + $PKG_DISPMANX_SUPPORT \ + $PKG_FB_SUPPORT \ -DENABLE_OSX=0 \ -DUSE_SYSTEM_PROTO_LIBS=1 \ -DENABLE_SPIDEV=1 \ @@ -68,11 +49,19 @@ PKG_CMAKE_OPTS_TARGET="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \ -DENABLE_V4L2=1 \ -DENABLE_WS2812BPWM=0 \ -DENABLE_WS281XPWM=1 \ - $X11_SUPPORT \ + $PKG_X11_SUPPORT \ -DENABLE_QT5=1 \ -DENABLE_TESTS=0 \ -Wno-dev" +pre_build_target() { + cp -a $(get_build_dir rpi_ws281x)/* $PKG_BUILD/dependencies/external/rpi_ws281x +} + +pre_configure_target() { + echo "" > ../cmake/FindGitVersion.cmake +} + makeinstall_target() { : # nothing to do here } @@ -83,6 +72,4 @@ addon() { cp -PR $PKG_BUILD/assets/webconfig $ADDON_BUILD/$PKG_ADDON_ID cp -PR $PKG_BUILD/effects $ADDON_BUILD/$PKG_ADDON_ID - - debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/service/hyperion/patches/hyperion-0003-fix-protobuf-cmake.patch b/packages/addons/service/hyperion/patches/hyperion-0003-fix-protobuf-cmake.patch index bc0b2d58b7..848a7e49b1 100644 --- a/packages/addons/service/hyperion/patches/hyperion-0003-fix-protobuf-cmake.patch +++ b/packages/addons/service/hyperion/patches/hyperion-0003-fix-protobuf-cmake.patch @@ -1,7 +1,8 @@ -diff -Naur a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt ---- a/dependencies/CMakeLists.txt 2016-09-06 13:58:55.000000000 -0700 -+++ b/dependencies/CMakeLists.txt 2016-11-09 23:25:20.458835732 -0800 -@@ -15,7 +15,7 @@ +diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt +index fe3d463..6ae8760 100644 +--- a/dependencies/CMakeLists.txt ++++ b/dependencies/CMakeLists.txt +@@ -16,7 +16,7 @@ set(USE_SYSTEM_PROTO_LIBS OFF CACHE BOOL "use protobuf library from system") if (USE_SYSTEM_PROTO_LIBS) find_package(Protobuf REQUIRED) @@ -10,84 +11,42 @@ diff -Naur a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt else () set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared protobuf library") add_subdirectory(external/protobuf) -@@ -38,79 +38,4 @@ - set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE} PARENT_SCOPE) +@@ -31,15 +31,15 @@ else () + endif() + + # define the include for the protobuf library at the parent scope +- set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src") +- set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS} PARENT_SCOPE) ++ set(Protobuf_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src") ++ set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE) + + # define the protoc executable at the parent scope +- get_property(PROTOBUF_PROTOC_EXECUTABLE TARGET protoc_compiler PROPERTY LOCATION) +- set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE} PARENT_SCOPE) ++ get_property(Protobuf_PROTOC_EXECUTABLE TARGET protoc_compiler PROPERTY LOCATION) ++ set(Protobuf_PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE} PARENT_SCOPE) endif() -message(STATUS "Using protobuf compiler: " ${PROTOBUF_PROTOC_EXECUTABLE}) -- --#============================================================================= --# Copyright 2009 Kitware, Inc. --# Copyright 2009-2011 Philip Lowman --# Copyright 2008 Esben Mose Hansen, Ange Optimization ApS --# --# Distributed under the OSI-approved BSD License (the "License"); --# see accompanying file Copyright.txt for details. --# --# This software is distributed WITHOUT ANY WARRANTY; without even the --# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --# See the License for more information. --#============================================================================= --# (To distribute this file outside of CMake, substitute the full --# License text for the above reference.) --function(PROTOBUF_GENERATE_CPP SRCS HDRS) -- if(NOT ARGN) -- message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") -- return() -- endif() -- -- if(PROTOBUF_GENERATE_CPP_APPEND_PATH) -- # Create an include path for each file specified -- foreach(FIL ${ARGN}) -- get_filename_component(ABS_FIL ${FIL} ABSOLUTE) -- get_filename_component(ABS_PATH ${ABS_FIL} PATH) -- list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) -- if(${_contains_already} EQUAL -1) -- list(APPEND _protobuf_include_path -I ${ABS_PATH}) -- endif() -- endforeach() -- else() -- set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) -- endif() -- -- if(DEFINED PROTOBUF_IMPORT_DIRS) -- foreach(DIR ${PROTOBUF_IMPORT_DIRS}) -- get_filename_component(ABS_PATH ${DIR} ABSOLUTE) -- list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) -- if(${_contains_already} EQUAL -1) -- list(APPEND _protobuf_include_path -I ${ABS_PATH}) -- endif() -- endforeach() -- endif() -- -- if(CMAKE_CROSSCOMPILING OR USE_SYSTEM_PROTO_LIBS) ++message(STATUS "Using protobuf compiler: " ${Protobuf_PROTOC_EXECUTABLE}) + + #============================================================================= + # Copyright 2009 Kitware, Inc. +@@ -86,7 +86,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) + endif() + + if(CMAKE_CROSSCOMPILING OR USE_SYSTEM_PROTO_LIBS) - set(PROTOC_DEPENDENCY ${PROTOBUF_PROTOC_EXECUTABLE}) -- else() -- set(PROTOC_DEPENDENCY protoc_compiler) -- endif() -- -- set(${SRCS}) -- set(${HDRS}) -- foreach(FIL ${ARGN}) -- get_filename_component(ABS_FIL ${FIL} ABSOLUTE) -- get_filename_component(FIL_WE ${FIL} NAME_WE) -- -- list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") -- list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") -- -- add_custom_command( -- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" -- "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" ++ set(PROTOC_DEPENDENCY ${Protobuf_PROTOC_EXECUTABLE}) + else() + set(PROTOC_DEPENDENCY protoc_compiler) + endif() +@@ -103,7 +103,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" + "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} -- ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} -- DEPENDS ${ABS_FIL} ${PROTOC_DEPENDENCY} -- COMMENT "Running C++ protocol buffer compiler on ${FIL}" -- VERBATIM -- ) -- endforeach() -- -- set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) -- set(${SRCS} ${${SRCS}} PARENT_SCOPE) -- set(${HDRS} ${${HDRS}} PARENT_SCOPE) --endfunction() -+message(STATUS "Using protobuf compiler: " ${Protobuf_PROTOC_EXECUTABLE}) ++ COMMAND ${Protobuf_PROTOC_EXECUTABLE} + ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} + DEPENDS ${ABS_FIL} ${PROTOC_DEPENDENCY} + COMMENT "Running C++ protocol buffer compiler on ${FIL}" diff --git a/packages/addons/service/hyperion/source/bin/hyperiond.start b/packages/addons/service/hyperion/source/bin/hyperiond.start index 9a55b91151..f9aac15adb 100644 --- a/packages/addons/service/hyperion/source/bin/hyperiond.start +++ b/packages/addons/service/hyperion/source/bin/hyperiond.start @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) . /etc/profile diff --git a/packages/addons/service/hyperion/source/default.py b/packages/addons/service/hyperion/source/default.py index 4294953255..6121a93630 100644 --- a/packages/addons/service/hyperion/source/default.py +++ b/packages/addons/service/hyperion/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) import xbmc diff --git a/packages/addons/service/inadyn/changelog.txt b/packages/addons/service/inadyn/changelog.txt index ce38abd821..1e98d0b0e1 100644 --- a/packages/addons/service/inadyn/changelog.txt +++ b/packages/addons/service/inadyn/changelog.txt @@ -1,8 +1,18 @@ +105 +- Update to 2.5 +- Fix settings + +104 +- Update to 2.4 + +103 +- Update to 2.2 + 102 -- Upgrade to 2.1 +- Update to 2.1 101 -- Upgrade to 2.0 +- Update to 2.0 100 - Initial addon diff --git a/packages/addons/service/inadyn/package.mk b/packages/addons/service/inadyn/package.mk index 1aa693af9e..adf4e86d9f 100644 --- a/packages/addons/service/inadyn/package.mk +++ b/packages/addons/service/inadyn/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016-2017 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="inadyn" -PKG_VERSION="2.1" -PKG_REV="102" +PKG_VERSION="2.5" +PKG_SHA256="28fddd94cb7dda08aef0e5e97bbfd2af83f5dc7ac899a477b5936e82a76d3709" +PKG_REV="105" PKG_ARCH="any" PKG_LICENSE="GPLv2" PKG_SITE="http://troglobit.com/inadyn.html" PKG_URL="https://github.com/troglobit/inadyn/archive/v$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libconfuse libite libressl" +PKG_DEPENDS_TARGET="toolchain libconfuse openssl" PKG_SECTION="service/system" PKG_SHORTDESC="Inadyn: a small and simple Dynamic Domain Name System client" PKG_LONGDESC="Inadyn ($PKG_VERSION) is a small and simple Dynamic Domain Name System (DDNS) client with HTTPS support. It is commonly available in many GNU/Linux distributions, used in off-the-shelf routers and Internet gateways to automate the task of keeping your DNS record up to date with any IP address changes from your ISP. It can also be used in installations with redundant (backup) connections to the Internet." -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Inadyn" diff --git a/packages/addons/service/inadyn/source/bin/inadyn-service b/packages/addons/service/inadyn/source/bin/inadyn-service index 75c677a236..e3514634bc 100644 --- a/packages/addons/service/inadyn/source/bin/inadyn-service +++ b/packages/addons/service/inadyn/source/bin/inadyn-service @@ -1,21 +1,10 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +f="/storage/.kodi/userdata/addon_data/service.system.inadyn/settings.xml" +[ -f "$f" ] && sed -i 's/inadyn_s/inadyn_c/g' "$f" . /etc/profile oe_setup_addon service.system.inadyn @@ -29,7 +18,7 @@ else else echo "\ provider $inadyn_S { - ssl = $inadyn_s + ssl = $inadyn_c username = $inadyn_u password = $inadyn_p hostname = $inadyn_a diff --git a/packages/addons/service/inadyn/source/default.py b/packages/addons/service/inadyn/source/default.py index 0a5065ba27..42617aaaca 100644 --- a/packages/addons/service/inadyn/source/default.py +++ b/packages/addons/service/inadyn/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/inadyn/source/resources/settings.xml b/packages/addons/service/inadyn/source/resources/settings.xml index 721a0e2f8d..88d73ca328 100644 --- a/packages/addons/service/inadyn/source/resources/settings.xml +++ b/packages/addons/service/inadyn/source/resources/settings.xml @@ -1,10 +1,42 @@ - + + - + diff --git a/packages/addons/service/lcdd/changelog.txt b/packages/addons/service/lcdd/changelog.txt index cfc16ec0b5..46c21fefef 100644 --- a/packages/addons/service/lcdd/changelog.txt +++ b/packages/addons/service/lcdd/changelog.txt @@ -1,10 +1,25 @@ -102: +107 +- Update to 0.5dev+2018-11-04 + +106 +- Build with -O3 to avoid undefined symbols + +105 +- Rebuild after glibc bump + +104 +- Update to 466edd3 + +103 +- Update to 0.5.8 + +102 - Update to c05a7de - Reintroduce dm140 driver - Build with libugpio -101: +101 - Update to upstream 1554506 -100: +100 - Initial addon diff --git a/packages/addons/service/lcdd/package.mk b/packages/addons/service/lcdd/package.mk index ba73094194..0e3403bed1 100644 --- a/packages/addons/service/lcdd/package.mk +++ b/packages/addons/service/lcdd/package.mk @@ -1,34 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016-2017 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="lcdd" -PKG_VERSION="c05a7de" -PKG_REV="102" +PKG_VERSION="e08546c13a4157ed98cd4a8e9086e7acd66f93c0" +PKG_SHA256="23d0fd14e16767d4907d724404b96216c0c7338c6206760e53cf6a7662dd3af2" +PKG_VERSION_DATE="0.5dev+2018-11-04" +PKG_REV="107" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://lcdproc.org/" PKG_URL="https://github.com/lcdproc/lcdproc/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="lcdproc-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain freetype libftdi1 libhid libugpio libusb netbsd-curses serdisplib" +PKG_DEPENDS_TARGET="toolchain freetype libftdi1 libhid libugpio libusb ncurses serdisplib" PKG_SECTION="service" PKG_SHORTDESC="LCDproc: Software to display system information from your Linux/*BSD box on a LCD" PKG_LONGDESC="LCDproc ($PKG_VERSION) is a piece of software that displays real-time system information from your Linux/*BSD box on a LCD. The server supports several serial devices: Matrix Orbital, Crystal Fontz, Bayrad, LB216, LCDM001 (kernelconcepts.de), Wirz-SLI, Cwlinux(.com) and PIC-an-LCD; and some devices connected to the LPT port: HD44780, STV5730, T6963, SED1520 and SED1330. Various clients are available that display things like CPU load, system load, memory usage, uptime, and a lot more." -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="-parallel" PKG_IS_ADDON="yes" PKG_ADDON_NAME="LCDproc" @@ -40,16 +27,14 @@ PKG_CONFIGURE_OPTS_TARGET="--with-ft-prefix=$SYSROOT_PREFIX/usr \ --disable-libX11 \ --enable-libhid \ --disable-libpng \ - --enable-drivers=all \ - --enable-seamless-hbars" + --enable-drivers=all" -pre_make_target() { - # dont build parallel - MAKEFLAGS=-j1 +pre_configure_target() { + CFLAGS="$CFLAGS -O3" } addon() { - drivers="none|$(cat $ROOT/$PKG_BUILD/.$TARGET_NAME/config.log | sed -n "s|^DRIVERS=' \(.*\)'|\1|p" | sed "s|.so||g" | tr ' ' '|')" + drivers="none|$(cat $PKG_BUILD/.$TARGET_NAME/config.log | sed -n "s|^DRIVERS=' \(.*\)'|\1|p" | sed "s|.so||g" | tr ' ' '|')" mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config diff --git a/packages/addons/service/lcdd/patches/lcdd-0.5.6-dm140_henlar_v0.2.patch b/packages/addons/service/lcdd/patches/lcdd-0.5.6-dm140_henlar_v0.2.patch index 04e799c6b7..d32bd0d3f3 100644 --- a/packages/addons/service/lcdd/patches/lcdd-0.5.6-dm140_henlar_v0.2.patch +++ b/packages/addons/service/lcdd/patches/lcdd-0.5.6-dm140_henlar_v0.2.patch @@ -59,13 +59,13 @@ index f82df85..0d98570 100644 futaba_CFLAGS = @LIBUSB_CFLAGS@ @LIBUSB_1_0_CFLAGS@ $(AM_CFLAGS) @@ -89,6 +89,7 @@ CFontzPacket_SOURCES = lcd.h lcd_lib.h CFontzPacket.c CFontzPacket.h CFontz-char - curses_SOURCES = lcd.h curses_drv.h curses_drv.c report.h - CwLnx_SOURCES = lcd.h lcd_lib.h CwLnx.c CwLnx.h report.h - debug_SOURCES = lcd.h report.h debug.c debug.h + curses_SOURCES = lcd.h curses_drv.h curses_drv.c + CwLnx_SOURCES = lcd.h lcd_lib.h CwLnx.c CwLnx.h + debug_SOURCES = lcd.h debug.c debug.h +dm140_SOURCES = lcd.h led.c libvfd.h led.h dm140.c dm140.h report.h - ea65_SOURCES = lcd.h ea65.h ea65.c report.h - EyeboxOne_SOURCES = lcd.h lcd_lib.h EyeboxOne.c EyeboxOne.h report.h - futaba_SOURCES = lcd.h futaba.c futaba.h report.h + ea65_SOURCES = lcd.h ea65.h ea65.c + EyeboxOne_SOURCES = lcd.h lcd_lib.h EyeboxOne.c EyeboxOne.h + futaba_SOURCES = lcd.h futaba.c futaba.h diff --git a/server/drivers/dm140.c b/server/drivers/dm140.c new file mode 100644 index 0000000..56f9219 @@ -92,7 +92,7 @@ index 0000000..56f9219 +#include "lcd.h" +#include "dm140.h" + -+#include "report.h" ++#include "shared/report.h" +#include "lcd_lib.h" +#include "libvfd.h" +#include "led.h" @@ -392,7 +392,7 @@ index 0000000..0bb565c +#include +#include "lcd.h" +#include "libvfd.h" -+#include "report.h" ++#include "shared/report.h" +#include "dm140.h" + + diff --git a/packages/addons/service/lcdd/patches/lcdd-0.5.6-libftdi1.patch b/packages/addons/service/lcdd/patches/lcdd-0.5.6-libftdi1.patch index b183619be3..f58a6fa700 100644 --- a/packages/addons/service/lcdd/patches/lcdd-0.5.6-libftdi1.patch +++ b/packages/addons/service/lcdd/patches/lcdd-0.5.6-libftdi1.patch @@ -1,16 +1,3 @@ -diff --git a/configure.ac b/configure.ac -index 7c053d2..dcb0c4d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -314,7 +314,7 @@ AC_MSG_RESULT($enable_libftdi) - - if test "$enable_libftdi" = "yes"; then - ifdef([PKG_CHECK_MODULES], -- [PKG_CHECK_MODULES(LIBFTDI, libftdi >= 0.8, -+ [PKG_CHECK_MODULES(LIBFTDI, libftdi1 >= 0.8, - [AC_DEFINE(HAVE_LIBFTDI, [1], [Define to 1 if you have libftdi])], - [ enable_libftdi=no ])], - [AC_MSG_WARN([pkg-config not (fully) installed; drivers requiring libftdi may not be built])]) diff --git a/server/drivers/hd44780-low.h b/server/drivers/hd44780-low.h index 47acf45..6faa830 100644 --- a/server/drivers/hd44780-low.h @@ -42,9 +29,9 @@ index 5d3e97a..6c26a19 100644 --- a/server/drivers/lis.c +++ b/server/drivers/lis.c @@ -42,7 +42,7 @@ + #include #include - #include -#include +#include @@ -55,9 +42,9 @@ index cbdde40..a84eb49 100644 --- a/server/drivers/ula200.c +++ b/server/drivers/ula200.c @@ -31,7 +31,7 @@ + #include #include - #include -#include +#include diff --git a/packages/addons/service/lcdd/source/bin/lcdd.start b/packages/addons/service/lcdd/source/bin/lcdd.start index 8e93d8fc81..40fae40698 100644 --- a/packages/addons/service/lcdd/source/bin/lcdd.start +++ b/packages/addons/service/lcdd/source/bin/lcdd.start @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile oe_setup_addon service.lcdd diff --git a/packages/addons/service/lcdd/source/default.py b/packages/addons/service/lcdd/source/default.py index 6c6b84a8a5..0b9d649ccd 100644 --- a/packages/addons/service/lcdd/source/default.py +++ b/packages/addons/service/lcdd/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/librespot/changelog.txt b/packages/addons/service/librespot/changelog.txt new file mode 100644 index 0000000000..1d56a1d4d0 --- /dev/null +++ b/packages/addons/service/librespot/changelog.txt @@ -0,0 +1,61 @@ +114 +- Fix discovery mode setting +- Start after Kodi + +113 +- Update to 96557b4 + +112 +- Update to a4e0f58 +- Rework Python +- Correct codec in Kodi mode +- Fix setting change +- Fix wizard +- Fix zapping issue +- Display album, artist, icon and title +- Wait for librespot.onevent to finish + +111 +- Update to 431be9e +- Fix delay with Kodi playback option +- Cache volume + +110 +- Update to 685fb4e +- Add kSupportsPlaylistV2 enum + +109 +- Refer librespot-org repository +- Update to bc7ceb3 +- Set stream type to audio in Kodi mode +- Initial volume as a setting + +108 +- Correct bug which prevented disabling the service from Kodi +- Place named pipe in /var/run/librespot + +107 +- Update to ddfc28f + +106 +- Rework code +- Display artist and title on track load + +105 +- Update to 910974e + +104 +- Switch from ffmpegx to pulseaudio to stream to Kodi +- Wait for sound.target + +103 +- Update system_information_string + +102 +- Update to aa86ebf + +101 +- Enable streaming to Kodi + +100 +- Initial addon diff --git a/packages/addons/service/librespot/icon/icon.png b/packages/addons/service/librespot/icon/icon.png new file mode 100644 index 0000000000..1b9e5e8400 Binary files /dev/null and b/packages/addons/service/librespot/icon/icon.png differ diff --git a/packages/addons/service/librespot/package.mk b/packages/addons/service/librespot/package.mk new file mode 100644 index 0000000000..0d0b31ca5b --- /dev/null +++ b/packages/addons/service/librespot/package.mk @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Shane Meagher (shanemeagher) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="librespot" +PKG_VERSION="96557b4ec1c45413cdf34673695f1269f99e3545" +PKG_SHA256="09fe8f8de50d25e460bdc75d02239961336ac4db837509386ac17057b00cc49a" +PKG_VERSION_DATE="2018-11-07" +PKG_REV="114" +PKG_ARCH="any" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/librespot-org/librespot/" +PKG_URL="https://github.com/librespot-org/librespot/archive/$PKG_VERSION.zip" +PKG_DEPENDS_TARGET="toolchain avahi pulseaudio pyalsaaudio rust" +PKG_SECTION="service" +PKG_SHORTDESC="Librespot: play Spotify through LibreELEC using a Spotify app as a remote" +PKG_LONGDESC="Librespot ($PKG_VERSION_DATE) plays Spotify through LibreELEC using the open source librespot library using a Spotify app as a remote." +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Librespot" +PKG_ADDON_TYPE="xbmc.service.library" +PKG_MAINTAINER="Anton Voyl (awiouy)" + +configure_target() { + . "$TOOLCHAIN/.cargo/env" + export PKG_CONFIG_ALLOW_CROSS=0 +} + +make_target() { + cd src + $CARGO_BUILD --no-default-features --features "alsa-backend pulseaudio-backend with-dns-sd" + cd "$PKG_BUILD/.$TARGET_NAME"/*/release + $STRIP librespot +} + +addon() { + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID" + cp "$(get_build_dir pyalsaaudio)/.install_pkg/usr/lib/$PKG_PYTHON_VERSION/site-packages/alsaaudio.so" \ + "$ADDON_BUILD/$PKG_ADDON_ID" + + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/bin" + cp "$PKG_BUILD/.$TARGET_NAME"/*/release/librespot \ + "$ADDON_BUILD/$PKG_ADDON_ID/bin" + + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/lib" + cp "$(get_build_dir avahi)/avahi-compat-libdns_sd/.libs/libdns_sd.so.1" \ + "$ADDON_BUILD/$PKG_ADDON_ID/lib" +} diff --git a/packages/addons/service/librespot/patches/librespot-02_kodi_hooks.patch b/packages/addons/service/librespot/patches/librespot-02_kodi_hooks.patch new file mode 100644 index 0000000000..dc6a78028b --- /dev/null +++ b/packages/addons/service/librespot/patches/librespot-02_kodi_hooks.patch @@ -0,0 +1,140 @@ +From 109452968762175b255d3a46d2447bf103022a68 Mon Sep 17 00:00:00 2001 +From: awiouy +Date: Wed, 7 Nov 2018 07:49:31 +0100 +Subject: [PATCH] libreelec: kodi hooks + +--- + playback/src/player.rs | 44 ++++++++++++++++++++++++++----------- + src/player_event_handler.rs | 8 +++++-- + 2 files changed, 37 insertions(+), 15 deletions(-) + +diff --git a/playback/src/player.rs b/playback/src/player.rs +index ab1a8ab..0aa0630 100644 +--- a/playback/src/player.rs ++++ b/playback/src/player.rs +@@ -49,15 +49,18 @@ enum PlayerCommand { + pub enum PlayerEvent { + Started { + track_id: SpotifyId, ++ new_state: String, + }, + + Changed { + old_track_id: SpotifyId, + new_track_id: SpotifyId, ++ new_state: String, + }, + + Stopped { + track_id: SpotifyId, ++ new_state: String, + }, + } + +@@ -413,11 +416,18 @@ impl PlayerInternal { + | PlayerState::EndOfTrack { + track_id: old_track_id, + .. +- } => self.send_event(PlayerEvent::Changed { +- old_track_id: old_track_id, +- new_track_id: track_id, +- }), +- _ => self.send_event(PlayerEvent::Started { track_id }), ++ } => { ++ let new_state = "play".to_string(); ++ self.send_event(PlayerEvent::Changed { ++ old_track_id: old_track_id, ++ new_track_id: track_id, ++ new_state: new_state, ++ }); ++ }, ++ _ => { ++ let new_state = "play".to_string(); ++ self.send_event(PlayerEvent::Started { track_id, new_state }); ++ }, + } + + self.start_sink(); +@@ -443,13 +453,18 @@ impl PlayerInternal { + | PlayerState::EndOfTrack { + track_id: old_track_id, + .. +- } => self.send_event(PlayerEvent::Changed { +- old_track_id: old_track_id, +- new_track_id: track_id, +- }), ++ } => { ++ let new_state = "pause".to_string(); ++ self.send_event(PlayerEvent::Changed { ++ old_track_id: old_track_id, ++ new_track_id: track_id, ++ new_state: new_state, ++ }) ++ }, + _ => (), + } +- self.send_event(PlayerEvent::Stopped { track_id }); ++ let new_state = "pause".to_string(); ++ self.send_event(PlayerEvent::Stopped { track_id, new_state }); + } + } + +@@ -474,7 +489,8 @@ impl PlayerInternal { + if let PlayerState::Paused { track_id, .. } = self.state { + self.state.paused_to_playing(); + +- self.send_event(PlayerEvent::Started { track_id }); ++ let new_state = "play".to_string(); ++ self.send_event(PlayerEvent::Started { track_id, new_state }); + self.start_sink(); + } else { + warn!("Player::play called from invalid state"); +@@ -486,7 +502,8 @@ impl PlayerInternal { + self.state.playing_to_paused(); + + self.stop_sink_if_running(); +- self.send_event(PlayerEvent::Stopped { track_id }); ++ let new_state = "pause".to_string(); ++ self.send_event(PlayerEvent::Stopped { track_id, new_state }); + } else { + warn!("Player::pause called from invalid state"); + } +@@ -497,7 +514,8 @@ impl PlayerInternal { + | PlayerState::Paused { track_id, .. } + | PlayerState::EndOfTrack { track_id } => { + self.stop_sink_if_running(); +- self.send_event(PlayerEvent::Stopped { track_id }); ++ let new_state = "stop".to_string(); ++ self.send_event(PlayerEvent::Stopped { track_id, new_state }); + self.state = PlayerState::Stopped; + } + PlayerState::Stopped => { +diff --git a/src/player_event_handler.rs b/src/player_event_handler.rs +index 1e682b9..3b478f1 100644 +--- a/src/player_event_handler.rs ++++ b/src/player_event_handler.rs +@@ -19,18 +19,22 @@ pub fn run_program_on_events(event: PlayerEvent, onevent: &str) -> io::Result { + env_vars.insert("PLAYER_EVENT", "change".to_string()); + env_vars.insert("OLD_TRACK_ID", old_track_id.to_base62()); + env_vars.insert("TRACK_ID", new_track_id.to_base62()); ++ env_vars.insert("STATE", new_state.to_string()); + } +- PlayerEvent::Started { track_id } => { ++ PlayerEvent::Started { track_id, new_state } => { + env_vars.insert("PLAYER_EVENT", "start".to_string()); + env_vars.insert("TRACK_ID", track_id.to_base62()); ++ env_vars.insert("STATE", new_state.to_string()); + } +- PlayerEvent::Stopped { track_id } => { ++ PlayerEvent::Stopped { track_id, new_state } => { + env_vars.insert("PLAYER_EVENT", "stop".to_string()); + env_vars.insert("TRACK_ID", track_id.to_base62()); ++ env_vars.insert("STATE", new_state.to_string()); + } + } + run_program(onevent, env_vars) diff --git a/packages/addons/service/librespot/patches/librespot-03_pulseaudio_sink.patch b/packages/addons/service/librespot/patches/librespot-03_pulseaudio_sink.patch new file mode 100644 index 0000000000..f441a109e7 --- /dev/null +++ b/packages/addons/service/librespot/patches/librespot-03_pulseaudio_sink.patch @@ -0,0 +1,30 @@ +From b87d18c6513cebc31118ffb447e2b7ae9255e6bd Mon Sep 17 00:00:00 2001 +From: awiouy +Date: Wed, 7 Nov 2018 07:51:46 +0100 +Subject: [PATCH] libreelec: pulseaudio sink + +--- + playback/src/audio_backend/pulseaudio.rs | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/playback/src/audio_backend/pulseaudio.rs b/playback/src/audio_backend/pulseaudio.rs +index 88f6280..4e7186b 100644 +--- a/playback/src/audio_backend/pulseaudio.rs ++++ b/playback/src/audio_backend/pulseaudio.rs +@@ -76,6 +76,7 @@ impl Open for PulseAudioSink { + + impl Sink for PulseAudioSink { + fn start(&mut self) -> io::Result<()> { ++ let sink = CString::new("librespot_sink").unwrap(); + if self.s == null_mut() { + self.s = call_pulseaudio( + |err| unsafe { +@@ -83,7 +84,7 @@ impl Sink for PulseAudioSink { + null(), // Use the default server. + self.name.as_ptr(), // Our application's name. + PA_STREAM_PLAYBACK, +- null(), // Use the default device. ++ sink.as_ptr(), // Our sink. + self.desc.as_ptr(), // desc of our stream. + &self.ss, // Our sample format. + null(), // Use default channel map diff --git a/packages/addons/service/librespot/source/addon.py b/packages/addons/service/librespot/source/addon.py new file mode 100644 index 0000000000..4c75451ca6 --- /dev/null +++ b/packages/addons/service/librespot/source/addon.py @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import alsaaudio +import xbmcaddon +import xbmcgui + + +dialog = xbmcgui.Dialog() +strings = xbmcaddon.Addon().getLocalizedString +while True: + pcms = alsaaudio.pcms()[1:] + if len(pcms) == 0: + dialog.ok(xbmcaddon.Addon().getAddonInfo('name'), strings(30210)) + break + pcmx = dialog.select(strings(30115), pcms) + if pcmx == -1: + break + pcm = pcms[pcmx] + xbmcaddon.Addon().setSetting('ls_o', pcm) + break +del dialog diff --git a/packages/addons/service/librespot/source/bin/librespot.env b/packages/addons/service/librespot/source/bin/librespot.env new file mode 100644 index 0000000000..3ca5ee662a --- /dev/null +++ b/packages/addons/service/librespot/source/bin/librespot.env @@ -0,0 +1,2 @@ +LS_PORT="6666" +LS_SINK="librespot_sink" diff --git a/packages/addons/service/librespot/source/bin/librespot.onevent b/packages/addons/service/librespot/source/bin/librespot.onevent new file mode 100755 index 0000000000..d528c6f537 --- /dev/null +++ b/packages/addons/service/librespot/source/bin/librespot.onevent @@ -0,0 +1,2 @@ +#!/bin/sh +echo -e "$STATE\n$TRACK_ID" > "$LS_FIFO" diff --git a/packages/addons/service/librespot/source/bin/librespot.start b/packages/addons/service/librespot/source/bin/librespot.start new file mode 100755 index 0000000000..b220d11576 --- /dev/null +++ b/packages/addons/service/librespot/source/bin/librespot.start @@ -0,0 +1,112 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +f="/storage/.kodi/userdata/addon_data/service.librespot/settings.xml" +[ -f "$f" ] && sed -i 's/ls_O/ls_m/g' "$f" + +activate_card() { + if [ -e "/proc/asound/$1" ]; then + return + fi + case "$LIBREELEC_ARCH" in + RPi*.arm) + if [ "$1" = "ALSA" ]; then + dtparam audio=on + sleep 1 + fi + ;; + *) + echo "Unable to activate card $1 on $LIBREELEC_ARCH" + exit + ;; + esac +} + +init_alsa() { + . /etc/os-release + + if [ ! "$(cat /proc/asound/pcm 2> /dev/null)" ]; then + case "$LIBREELEC_ARCH" in + RPi*.arm) + activate_card "ALSA" + ;; + *) + echo "Unable to activate an audio interface on $LIBREELEC_ARCH" + exit + ;; + esac + fi + + case "$ls_o" in + *:CARD=*) + card="${ls_o##*:CARD=}" + card="${card%%,*}" + activate_card "$card" + index="$(readlink /proc/asound/$card)" + index="${index##*card}" + ;; + hw:*,*) + echo "The hw:d,s specification is unreliable, use device:CARD=card instead" + index="${ls_o##hw:}" + index="${index%%,*}" + card="card$index" + activate_card "$card" + ;; + *) + if [ -n "$ls_o" ]; then + echo "Unknown playback device specification $ls_o" + fi + ;; + esac + + case "$LIBREELEC_ARCH" in + RPi*.arm) + [ "$(readlink /proc/asound/ALSA)" = "card$index" ] && [ "$pcm_3" ] && + amixer -c "$index" cset name="PCM Playback Route" "$pcm_3" + ;; + esac +} + + +. /etc/profile +oe_setup_addon service.librespot + +LIBRESPOT="librespot --cache \"$ADDON_HOME/cache\" \ + --disable-audio-cache \ + --name \"Librespot@$HOSTNAME\" \ + --onevent librespot.onevent" + +if [ -n "$ls_b" -a "$ls_b" != "-" ]; then + LIBRESPOT="$LIBRESPOT --bitrate $ls_b" +fi + +if [ "$ls_a" = "true" -a -n "$ls_p" -a -n "$ls_u" ]; then + LIBRESPOT="$LIBRESPOT --disable-discovery \ + --password \"$ls_p\" \ + --username \"$ls_u\"" +fi + +if [ "$ls_m" = "Kodi" ]; then + LIBRESPOT="$LIBRESPOT --backend pulseaudio --device-type TV" +else + init_alsa + if [ -n "$ls_o" ]; then + LIBRESPOT="$LIBRESPOT --device \"$ls_o\"" + fi + LIBRESPOT="$LIBRESPOT --device-type Speaker" +fi + +if [ -z "$(pactl list short modules | grep sink_name=$LS_SINK)" ]; then + pactl load-module module-null-sink sink_name="$LS_SINK" > /dev/null +fi +pactl suspend-sink "$LS_SINK" 1 +if [ -z "$(pactl list short modules | grep source=$LS_SINK.monitor)" ]; then + pactl load-module module-rtp-send source="$LS_SINK.monitor" \ + destination_ip=127.0.0.1 port="$LS_PORT" source_ip=127.0.0.1 > /dev/null +fi + +export LS_FIFO="/var/run/librespot" + +eval $LIBRESPOT diff --git a/packages/addons/service/librespot/source/default.py b/packages/addons/service/librespot/source/default.py new file mode 100644 index 0000000000..0c2f7e2d8c --- /dev/null +++ b/packages/addons/service/librespot/source/default.py @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import os +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'resources', 'lib')) + +from ls_monitor import Monitor as Monitor + + +if __name__ == '__main__': + Monitor().waitForAbort() diff --git a/packages/addons/service/librespot/source/resources/language/English/strings.po b/packages/addons/service/librespot/source/resources/language/English/strings.po new file mode 100644 index 0000000000..1a72bdf8ee --- /dev/null +++ b/packages/addons/service/librespot/source/resources/language/English/strings.po @@ -0,0 +1,84 @@ +# Kodi Media Center language file +# Addon Name: librespot +msgid "" +msgstr "" + +msgctxt "#30100" +msgid "Librespot" +msgstr "" + +msgctxt "#30102" +msgid "Bit rate" +msgstr "" + +msgctxt "#30103" +msgid "-" +msgstr "" + +msgctxt "#30104" +msgid "96" +msgstr "" + +msgctxt "#30105" +msgid "160" +msgstr "" + +msgctxt "#30106" +msgid "320" +msgstr "" + +msgctxt "#30107" +msgid "Output mode" +msgstr "" + +msgctxt "#30108" +msgid "ALSA" +msgstr "" + +msgctxt "#30109" +msgid "Kodi" +msgstr "" + +msgctxt "#30110" +msgid "Username" +msgstr "" + +msgctxt "#30111" +msgid "Password" +msgstr "" + +msgctxt "#30112" +msgid "User mode" +msgstr "" + +msgctxt "#30113" +msgid "ALSA" +msgstr "" + +msgctxt "#30114" +msgid "Configuration wizard" +msgstr "" + +msgctxt "#30115" +msgid "Playback device" +msgstr "" + +msgctxt "#30116" +msgid "Playback route" +msgstr "" + +msgctxt "#30117" +msgid "auto detect" +msgstr "" + +msgctxt "#30118" +msgid "headphone jack" +msgstr "" + +msgctxt "#30119" +msgid "HDMI" +msgstr "" + +msgctxt "#30210" +msgid "Could not find a playback device" +msgstr "" diff --git a/packages/addons/service/librespot/source/resources/lib/ls_librespot.py b/packages/addons/service/librespot/source/resources/lib/ls_librespot.py new file mode 100644 index 0000000000..3a803bd6c1 --- /dev/null +++ b/packages/addons/service/librespot/source/resources/lib/ls_librespot.py @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmcaddon + +from ls_log import log as log + + +_SERVICE = xbmcaddon.Addon().getAddonInfo('id') +_SINK = 'librespot_sink' + + +def _pactl(bit): + log('pactl {}'.format(bit)) + subprocess.call(['pactl', 'suspend-sink', _SINK, bit]) + + +def _systemctl(command): + log('systemctl {}'.format(command)) + subprocess.call(['systemctl', command, _SERVICE]) + _pactl('1') + + +class Librespot(): + + def __init__(self): + self.state = True + + def restart(self): + log('restarting librespot') + _systemctl('restart') + self.state = True + + def stop(self): + if self.state: + log('stopping librespot') + _systemctl('stop') + self.state = False + + def unsuspend(self): + _pactl('0') diff --git a/packages/addons/service/librespot/source/resources/lib/ls_log.py b/packages/addons/service/librespot/source/resources/lib/ls_log.py new file mode 100644 index 0000000000..abf51f1ab4 --- /dev/null +++ b/packages/addons/service/librespot/source/resources/lib/ls_log.py @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import xbmc +import xbmcaddon + + +_MESSAGE = xbmcaddon.Addon().getAddonInfo('name') + ': {}' + + +def log(message): + xbmc.log(_MESSAGE.format(message), xbmc.LOGNOTICE) diff --git a/packages/addons/service/librespot/source/resources/lib/ls_monitor.py b/packages/addons/service/librespot/source/resources/lib/ls_monitor.py new file mode 100644 index 0000000000..664843ebdd --- /dev/null +++ b/packages/addons/service/librespot/source/resources/lib/ls_monitor.py @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import xbmc + +from ls_log import log as log +from ls_player import Player as Player + + +class Monitor(xbmc.Monitor): + + def __init__(self): + log('monitor started') + self.player = Player() + + def onSettingsChanged(self): + self.player.onSettingsChanged() + + def waitForAbort(self): + super(Monitor, self).waitForAbort() + self.player.onAbortRequested() + log('monitor stopped') diff --git a/packages/addons/service/librespot/source/resources/lib/ls_player.py b/packages/addons/service/librespot/source/resources/lib/ls_player.py new file mode 100644 index 0000000000..834e9e3647 --- /dev/null +++ b/packages/addons/service/librespot/source/resources/lib/ls_player.py @@ -0,0 +1,134 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import os +import stat +import threading +import xbmc +import xbmcaddon +import xbmcgui + +from ls_librespot import Librespot as Librespot +from ls_log import log as log +from ls_spotify import Spotify as Spotify + +_CODEC = 'pcm_s16le' +_FIFO = '/var/run/librespot' +_STREAM = 'rtp://127.0.0.1:6666' + +_DEFAULT_ICON = xbmcaddon.Addon().getAddonInfo('icon') +_DEFAULT_TITLE = xbmcaddon.Addon().getAddonInfo('name') + + +class Player(threading.Thread, xbmc.Player): + + def __init__(self): + super(Player, self).__init__() + self.updateSettings() + self.dialog = xbmcgui.Dialog() + self.librespot = Librespot() + self.listitem = xbmcgui.ListItem() + self.listitem.addStreamInfo('audio', {'codec': _CODEC}) + self.listitem.setPath(_STREAM) + self.spotify = Spotify() + self.start() + if self.isPlaying(): + self.onPlayBackStarted() + + def onAbortRequested(self): + log('abort requested') + with open(_FIFO, 'w') as fifo: + fifo.close() + self.join() + + def onPlayBackEnded(self): + log('a playback ended') + self.librespot.restart() + + def onPlayBackStarted(self): + log('a playback started') + if self.getPlayingFile() != _STREAM: + self.librespot.stop() + + def onPlayBackStopped(self): + log('a playback stopped') + self.librespot.restart() + + def onSettingsChanged(self): + log('settings changed') + self.stop() + self.updateSettings() + + def pause(self): + if self.isPlaying() and self.getPlayingFile() == _STREAM: + log('pausing librespot playback') + super(Player, self).pause() + + def play(self, track_id): + track = self.spotify.getTrack(track_id) + if track['thumb'] == '': + track['thumb'] = _DEFAULT_ICON + if track['title'] == '': + track['title'] = _DEFAULT_TITLE + if self.kodi: + self.listitem.setArt({'thumb': track['thumb']}) + self.listitem.setInfo( + 'music', + { + 'album': track['album'], + 'artist': track['artist'], + 'title': track['title'] + } + ) + if self.isPlaying() and self.getPlayingFile() == _STREAM: + log('updating librespot playback') + self.updateInfoTag(self.listitem) + else: + self.librespot.unsuspend() + log('starting librespot playback') + super(Player, self).play(_STREAM, self.listitem) + else: + self.dialog.notification( + track['title'], + track['artist'], + icon=track['thumb'], + sound=False) + + def run(self): + log('named pipe started') + try: + os.unlink(_FIFO) + except OSError: + pass + os.mkfifo(_FIFO) + while (os.path.exists(_FIFO) and + stat.S_ISFIFO(os.stat(_FIFO).st_mode)): + with open(_FIFO, 'r') as fifo: + command = fifo.read().splitlines() + log('named pipe received {}'.format(str(command))) + if len(command) == 0: + break + elif command[0] == 'play': + self.play(command[1]) + elif command[0] == 'stop': + self.stop() + elif command[0] == 'pause': + self.pause() + try: + os.unlink(_FIFO) + except OSError: + pass + log('named pipe stopped') + + def stop(self): + if self.isPlaying(): + if self.getPlayingFile() == _STREAM: + log('stopping librespot playback') + super(Player, self).stop() + else: + self.librespot.stop() + else: + self.librespot.restart() + + def updateSettings(self): + self.kodi = (xbmcaddon.Addon().getSetting('ls_m') == 'Kodi') diff --git a/packages/addons/service/librespot/source/resources/lib/ls_spotify.py b/packages/addons/service/librespot/source/resources/lib/ls_spotify.py new file mode 100644 index 0000000000..7660f7dbc6 --- /dev/null +++ b/packages/addons/service/librespot/source/resources/lib/ls_spotify.py @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import base64 +import json +import time +import urllib +import urllib2 + +from ls_log import log as log + +_CLIENT_ID = '169df5532dee47a59913f8528e83ae71' +_CLIENT_SECRET = '1f3d8b507bbe4f68beb3a4472e8ad411' + + +def _get(default, tree, *indices): + try: + for index in indices: + tree = tree[index] + except LookupError: + tree = default + return tree + + +class Spotify(): + + def __init__(self): + self.headers = None + self.expiration = time.time() + self.request = [ + 'https://accounts.spotify.com/api/token', + urllib.urlencode({'grant_type': 'client_credentials'}), + {'Authorization': 'Basic {}'.format(base64.b64encode( + '{}:{}'.format(_CLIENT_ID, _CLIENT_SECRET)))} + ] + + def getTrack(self, track_id): + try: + if time.time() > self.expiration: + log('token expired') + token = json.loads(urllib2.urlopen( + urllib2.Request(*self.request)).read()) + log('token {} expires in {} seconds'.format( + token['access_token'], token['expires_in'])) + self.expiration = time.time() + float(token['expires_in']) - 60 + self.headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer {}'.format(token['access_token']) + } + track = json.loads(urllib2.urlopen(urllib2.Request( + 'https://api.spotify.com/v1/tracks/{}'.format(track_id), None, + self.headers)).read()) + except Exception as e: + log('failed to get track {} from Spotify: {}'.format(e)) + track = dict() + return { + 'album': _get('', track, 'album', 'name'), + 'artist': _get('', track, 'artists', 0, 'name'), + 'duration': _get(0, track, 'duration_ms') / 1000, + 'thumb': _get('', track, 'album', 'images', 0, 'url'), + 'title': _get('', track, 'name') + } diff --git a/packages/addons/service/librespot/source/resources/settings.xml b/packages/addons/service/librespot/source/resources/settings.xml new file mode 100644 index 0000000000..b2c0c6bc13 --- /dev/null +++ b/packages/addons/service/librespot/source/resources/settings.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/addons/service/librespot/source/settings-default.xml b/packages/addons/service/librespot/source/settings-default.xml new file mode 100644 index 0000000000..8caeebcf80 --- /dev/null +++ b/packages/addons/service/librespot/source/settings-default.xml @@ -0,0 +1,9 @@ + + false + 320 + ALSA + + + + 0 + diff --git a/packages/addons/service/librespot/source/system.d/service.librespot.service b/packages/addons/service/librespot/source/system.d/service.librespot.service new file mode 100644 index 0000000000..929da8af3c --- /dev/null +++ b/packages/addons/service/librespot/source/system.d/service.librespot.service @@ -0,0 +1,13 @@ +[Unit] +Description=librespot +Wants=kodi.service +After=kodi.service + +[Service] +EnvironmentFile=/storage/.kodi/addons/service.librespot/bin/librespot.env +ExecStart=/bin/sh /storage/.kodi/addons/service.librespot/bin/librespot.start +ExecStopPost=/usr/bin/pactl suspend-sink "$LS_SINK" 1 +Restart=on-failure + +[Install] +WantedBy=kodi.service diff --git a/packages/addons/service/locale/changelog.txt b/packages/addons/service/locale/changelog.txt new file mode 100644 index 0000000000..e447f8e84f --- /dev/null +++ b/packages/addons/service/locale/changelog.txt @@ -0,0 +1,8 @@ +102: +- Include localedef + +101: +- Fix dialog message + +100: +- Initial add-on diff --git a/packages/addons/service/locale/icon/icon.png b/packages/addons/service/locale/icon/icon.png new file mode 100644 index 0000000000..90f7acca94 Binary files /dev/null and b/packages/addons/service/locale/icon/icon.png differ diff --git a/packages/addons/service/locale/package.mk b/packages/addons/service/locale/package.mk new file mode 100644 index 0000000000..6f59583feb --- /dev/null +++ b/packages/addons/service/locale/package.mk @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="locale" +PKG_REV="102" +PKG_ARCH="any" +PKG_DEPENDS_TARGET="toolchain glibc" +PKG_SECTION="service" +PKG_SHORTDESC="Locale: allows users to set a custom locale to override the POSIX default" +PKG_LONGDESC="Locale ($PKG_REV) allows users to set a custom locale in the OS to override the POSIX default" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Locale" +PKG_ADDON_TYPE="xbmc.service" + +addon() { + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/bin" + cp -PR "$(get_build_dir glibc)/.$TARGET_NAME/locale/localedef" \ + "$ADDON_BUILD/$PKG_ADDON_ID/bin" + + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/i18n" + cp -PR "$(get_build_dir glibc)/localedata/charmaps" \ + "$(get_build_dir glibc)/localedata/locales" \ + "$ADDON_BUILD/$PKG_ADDON_ID/i18n" + + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/locpath" + + cp -PR $PKG_DIR/resources $ADDON_BUILD/$PKG_ADDON_ID + + locales="" + for p in "$ADDON_BUILD/$PKG_ADDON_ID/i18n/locales"/*; do + l="$(basename $p)" + if [ "$l" = "POSIX" ]; then + continue + fi + locales="$locales|$l" + done + locales="${locales:1}" + + sed -e "s/@LOCALES@/$locales/" \ + -i $ADDON_BUILD/$PKG_ADDON_ID/resources/settings.xml +} diff --git a/packages/addons/service/locale/resources/settings.xml b/packages/addons/service/locale/resources/settings.xml new file mode 100644 index 0000000000..5157d70e48 --- /dev/null +++ b/packages/addons/service/locale/resources/settings.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/addons/service/locale/source/default.py b/packages/addons/service/locale/source/default.py new file mode 100644 index 0000000000..a7c2a6b921 --- /dev/null +++ b/packages/addons/service/locale/source/default.py @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import os +import subprocess +import xbmc +import xbmcaddon +import xbmcgui + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.setLocale() + + def onSettingsChanged(self): + self.setLocale() + + def setLocale(self): + addon = xbmcaddon.Addon() + + charmap = addon.getSetting('charmap') + locale = addon.getSetting('locale') + lang = locale + '.' + charmap + + path = addon.getAddonInfo('path') + i18npath = os.path.join(path, 'i18n') + locpath = os.path.join(path, 'locpath') + localepath = os.path.join(locpath, lang) + profiled = os.path.join(path, 'profile.d') + profile = os.path.join(profiled, '10-locale.profile') + + strings = addon.getLocalizedString + + if os.path.isdir(locpath) == False: + os.makedirs(locpath) + + if os.path.isdir(localepath) == False: + os.environ['I18NPATH'] = i18npath + subprocess.call([os.path.join(path, 'bin/localedef'), '-f', charmap, + '-i', locale, localepath]) + + if os.path.isdir(profiled) == False: + os.makedirs(profiled) + + file = open(profile, 'w') + file.write('export LANG="' + lang + '"\n') + file.write('export LOCPATH="' + locpath + '"\n') + file.close() + + current = os.environ.get('LANG', '') + if lang != current: + if xbmcgui.Dialog().yesno('Locale', strings(30003).format(lang) + ) == True: + xbmc.restart() + + +if __name__ == '__main__': + Monitor().waitForAbort() diff --git a/packages/addons/service/locale/source/resources/language/English/strings.po b/packages/addons/service/locale/source/resources/language/English/strings.po new file mode 100644 index 0000000000..0538888a41 --- /dev/null +++ b/packages/addons/service/locale/source/resources/language/English/strings.po @@ -0,0 +1,19 @@ +# Kodi Media Center language file +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Charmap" +msgstr "" + +msgctxt "#30002" +msgid "Locale" +msgstr "" + +msgctxt "#30003" +msgid "Locale changed to {}. Please reboot to apply globally." +msgstr "" diff --git a/packages/addons/service/locale/source/settings-default.xml b/packages/addons/service/locale/source/settings-default.xml new file mode 100644 index 0000000000..5db70160c9 --- /dev/null +++ b/packages/addons/service/locale/source/settings-default.xml @@ -0,0 +1,4 @@ + + + + diff --git a/packages/addons/service/mariadb/changelog.txt b/packages/addons/service/mariadb/changelog.txt new file mode 100644 index 0000000000..4bd63214e1 --- /dev/null +++ b/packages/addons/service/mariadb/changelog.txt @@ -0,0 +1,11 @@ +102 +- do not change password on addon update + +101 +- update MariaDB to 10.3.12 + removed optimizer_search_depth from config file to speed it up + moved some paths for logs to addon home + added alias for service name (mariadb == service.mariadb) + +100 +- initial version diff --git a/packages/addons/service/mariadb/icon/icon.png b/packages/addons/service/mariadb/icon/icon.png new file mode 100644 index 0000000000..4337d6d064 Binary files /dev/null and b/packages/addons/service/mariadb/icon/icon.png differ diff --git a/packages/addons/service/mariadb/package.mk b/packages/addons/service/mariadb/package.mk new file mode 100644 index 0000000000..a1c4b18d12 --- /dev/null +++ b/packages/addons/service/mariadb/package.mk @@ -0,0 +1,97 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mariadb" +PKG_VERSION="10.3.12" +PKG_REV="102" +PKG_SHA256="f7449a34c25e0455928d7983dae83fd2069fe1f16c4c5f4aeed9ed9d3f081ff6" +PKG_LICENSE="GPL2" +PKG_SITE="https://mariadb.org" +PKG_URL="https://downloads.mariadb.org/interstitial/${PKG_NAME}-${PKG_VERSION}/source/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_HOST="toolchain ncurses:host" +PKG_DEPENDS_TARGET="toolchain binutils bzip2 libaio libxml2 lzo ncurses openssl systemd zlib mariadb:host" +PKG_SHORTDESC="MariaDB is a community-developed fork of the MySQL." +PKG_LONGDESC="MariaDB (${PKG_VERSION}) is a fast SQL database server and a drop-in replacement for MySQL." +PKG_TOOLCHAIN="cmake" +PKG_BUILD_FLAGS="-gold" + +PKG_IS_ADDON="yes" +PKG_SECTION="service" +PKG_ADDON_NAME="MariaDB SQL database server" +PKG_ADDON_TYPE="xbmc.service" + +configure_package() { + PKG_CMAKE_OPTS_HOST=" \ + -DCMAKE_INSTALL_MESSAGE=NEVER \ + -DSTACK_DIRECTION=-1 \ + -DHAVE_IB_GCC_ATOMIC_BUILTINS=1 \ + -DCMAKE_CROSSCOMPILING=OFF \ + import_executables" + + PKG_CMAKE_OPTS_TARGET=" \ + -DCMAKE_INSTALL_MESSAGE=NEVER \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_CONFIG=mysql_release \ + -DFEATURE_SET=classic \ + -DSTACK_DIRECTION=1 \ + -DDISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING=ON \ + -DCMAKE_CROSSCOMPILING=ON \ + -DIMPORT_EXECUTABLES=${PKG_BUILD}/.${HOST_NAME}/import_executables.cmake \ + -DWITHOUT_AWS_KEY_MANAGEMENT=ON \ + -DWITH_EXTRA_CHARSETS=complex \ + -DWITH_SSL=system \ + -DWITH_SSL=${SYSROOT_PREFIX}/usr \ + -DWITH_JEMALLOC=OFF \ + -DWITH_PCRE=bundled \ + -DWITH_ZLIB=bundled \ + -DWITH_EDITLINE=bundled \ + -DWITH_LIBEVENT=bundled \ + -DCONNECT_WITH_LIBXML2=bundled \ + -DSKIP_TESTS=ON \ + -DWITH_DEBUG=OFF \ + -DWITH_UNIT_TESTS=OFF \ + -DENABLE_DTRACE=OFF \ + -DSECURITY_HARDENED=OFF \ + -DWITH_EMBEDDED_SERVER=OFF \ + -DWITHOUT_SERVER=OFF \ + -DPLUGIN_AUTH_SOCKET=STATIC \ + -DDISABLE_SHARED=NO \ + -DENABLED_PROFILING=OFF \ + -DENABLE_STATIC_LIBS=OFF \ + -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \ + -DWITH_SAFEMALLOC=OFF \ + -DWITHOUT_AUTH_EXAMPLES=ON" +} + +make_host() { + ninja ${NINJA_OPTS} import_executables +} + +makeinstall_host() { + : +} + +makeinstall_target() { + # use only for addon + DESTDIR=${PKG_BUILD}/.install_addon ninja ${NINJA_OPTS} install + rm -rf "${PKG_BUILD}/.install_addon/usr/mysql-test" +} + +addon() { + local ADDON="${ADDON_BUILD}/${PKG_ADDON_ID}" + local MARIADB="${PKG_BUILD}/.install_addon/usr" + + mkdir -p ${ADDON}/bin + mkdir -p ${ADDON}/config + + cp ${MARIADB}/bin/mysql \ + ${MARIADB}/bin/mysqld \ + ${MARIADB}/bin/mysqladmin \ + ${MARIADB}/bin/mysql_secure_installation \ + ${MARIADB}/bin/my_print_defaults \ + ${MARIADB}/bin/resolveip \ + ${MARIADB}/scripts/mysql_install_db \ + ${ADDON}/bin + + cp -PR ${MARIADB}/share ${ADDON} +} diff --git a/packages/addons/service/mariadb/source/bin/mariadb.start b/packages/addons/service/mariadb/source/bin/mariadb.start new file mode 100755 index 0000000000..66d384188b --- /dev/null +++ b/packages/addons/service/mariadb/source/bin/mariadb.start @@ -0,0 +1,55 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.mariadb + +# create dir for socket and pid +mkdir -p /var/run/mysqld + +# exit if already running +PID=$(ps aux | awk '/\/bin\/mysqld/ {print $1; exit 0}') +if [ -n "$PID" ]; then + echo "MariaDB server is already running" + exit 0 +fi + +# copy config file +if [ ! -f $ADDON_HOME/my.cnf ]; then + cp $ADDON_DIR/config/my.cnf $ADDON_HOME +fi + +# install database +if [ ! -d "$ADDON_HOME/data/mysql" ]; then + echo "Installing database" + $ADDON_DIR/bin/mysql_install_db --basedir=$ADDON_DIR --datadir=$ADDON_HOME/data +fi + +# check for first run and generate passwords +if grep -q "@MYSQL_ROOT_PASS@" $ADDON_HOME/settings.xml; then + MYSQL_ROOT_PASS="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8)" + MYSQL_KODI_PASS="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8)" + + sed -e "s|@MYSQL_ROOT_PASS@|$MYSQL_ROOT_PASS|g" \ + -e "s|@MYSQL_KODI_PASS@|$MYSQL_KODI_PASS|g" \ + -i $ADDON_HOME/settings.xml +fi + +# init script to create user kodi and change passwords +init_file="" +if [[ ! -f $ADDON_HOME/set_mysql_passwords.sql ]] || [[ $ADDON_HOME/settings.xml -nt $ADDON_HOME/set_mysql_passwords.sql ]]; then + cat << SQL_DATA > $ADDON_HOME/set_mysql_passwords.sql +SET PASSWORD FOR 'root'@'localhost'=PASSWORD('$MYSQL_ROOT_PASS'); +CREATE USER IF NOT EXISTS 'kodi'; +SET PASSWORD FOR 'kodi'=PASSWORD('$MYSQL_KODI_PASS'); +GRANT ALL ON *.* TO 'kodi'; +flush privileges; +SQL_DATA + + init_file="--init-file=$ADDON_HOME/set_mysql_passwords.sql" +fi + +echo "Starting mysqld" +MYSQL_HOME="$ADDON_HOME" exec $ADDON_DIR/bin/mysqld $init_file & diff --git a/packages/addons/service/mariadb/source/bin/mariadb.stop b/packages/addons/service/mariadb/source/bin/mariadb.stop new file mode 100755 index 0000000000..049c577dec --- /dev/null +++ b/packages/addons/service/mariadb/source/bin/mariadb.stop @@ -0,0 +1,6 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +kill $(cat /var/run/mysqld/mysqld.pid) diff --git a/packages/addons/service/mariadb/source/config/my.cnf b/packages/addons/service/mariadb/source/config/my.cnf new file mode 100644 index 0000000000..44fbc9edda --- /dev/null +++ b/packages/addons/service/mariadb/source/config/my.cnf @@ -0,0 +1,207 @@ +# MariaDB database server configuration file. +# +# You can copy this file to one of: +# - "/etc/mysql/my.cnf" to set global options, +# - "~/.my.cnf" to set user-specific options. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# This will be passed to all mysql clients +# It has been reported that passwords should be enclosed with ticks/quotes +# escpecially if they contain "#" chars... +# Remember to edit /etc/mysql/debian.cnf when changing the socket location. +[client] +port = 3306 +socket = /var/run/mysqld/mysqld.sock + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +# This was formally known as [safe_mysqld]. Both versions are currently parsed. +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 + +[mysqld] +# +# * Basic Settings +# +user = root +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /storage/.kodi/addons/service.mariadb +datadir = /storage/.kodi/userdata/addon_data/service.mariadb/data +log-error = /storage/.kodi/userdata/addon_data/service.mariadb/mysqld.log +tmpdir = /tmp +#lc_messages_dir = /usr/share/mysql +lc_messages = en_US +skip-external-locking +# Kodi needs more for library (256K should probably be enough) +#thread_stack = 128K +thread_stack = 384K +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +#bind-address = 127.0.0.1 +# +# * Fine Tuning +# +max_connections = 100 +connect_timeout = 5 +wait_timeout = 600 +max_allowed_packet = 16M +thread_cache_size = 128 +sort_buffer_size = 4M +bulk_insert_buffer_size = 16M +tmp_table_size = 32M +max_heap_table_size = 32M +# +# * MyISAM +# +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched. On error, make copy and try a repair. +myisam_recover_options = BACKUP +key_buffer_size = 128M +#open-files-limit = 2000 +#table_open_cache = 400 +table_open_cache = 1000 +myisam_sort_buffer_size = 512M +concurrent_insert = 2 +read_buffer_size = 2M +read_rnd_buffer_size = 1M +# +# * Query Cache Configuration +# +# Cache only tiny result sets, so we can fit more in the query cache. +query_cache_limit = 128K +query_cache_size = 64M +# for more write intensive setups, set to DEMAND or OFF +#query_cache_type = DEMAND +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the log at runtime! +#general_log_file = /storage/.kodi/userdata/addon_data/service.mariadb/mysql.log +#general_log = 1 +# +# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. +# +# we do want to know about network errors and such +log_warnings = 2 +# +# Enable the slow query log to see queries with especially long duration +#slow_query_log[={0|1}] +slow_query_log_file = /storage/.kodi/userdata/addon_data/mariadb-slow.log +long_query_time = 10 +#log_slow_rate_limit = 1000 +log_slow_verbosity = query_plan + +#log-queries-not-using-indexes +#log_slow_admin_statements +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#report_host = master1 +#auto_increment_increment = 2 +#auto_increment_offset = 1 +# disable binary log +#log_bin = /storage/.kodi/userdata/addon_data/service.mariadb/mariadb-bin +#log_bin_index = /storage/.kodi/userdata/addon_data/service.mariadb/mariadb-bin.index +# not fab for performance, but safer +#sync_binlog = 1 +expire_logs_days = 10 +max_binlog_size = 100M +# slaves +#relay_log = /storage/.kodi/userdata/addon_data/service.mariadb/relay-bin +#relay_log_index = /storage/.kodi/userdata/addon_data/service.mariadb/relay-bin.index +#relay_log_info_file = /storage/.kodi/userdata/addon_data/service.mariadb/relay-bin.info +#log_slave_updates +#read_only +# +# If applications support it, this stricter sql_mode prevents some +# mistakes like inserting invalid dates etc. +#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +default_storage_engine = InnoDB +# you can't just change log file size, requires special procedure +#innodb_log_file_size = 50M + +# optimizations https://forum.kodi.tv/showthread.php?tid=329046&pid=2708799 #pid2708799 +# https://discourse.coreelec.org/t/kodi-and-mariadb-part-2/513 +# innodb_buffer_pool_size=2G # MariaDB recommends using 80% of your available memory but the default 1G might be enough. Always set to multiples of 1G. +# innodb_buffer_pool_instances=2 # When innodb_buffer_pool_size is > 1G, MariaDB will split the pool in instances. They should be even dividers of 1G. +# innodb_file_format=Barracuda # Gone in 10.3 / This is an optimized storage engine not available in MySQL +# innodb_log_block_size=4096 # Gone in 10.3 / Default is 512, when using an SSD or 4k drives, block size should be 4096 +# innodb_adaptive_hash_index=OFF # For Kodi no benefit is gained from additional indexes. This should only be used with large databases. +# character-set-server=utf8 # I really hope you all used this in MySQL already. This avoids potential pitfalls with text in exotic codepages. +# key-buffer-size=64k # When not using MyISAM as storage engine, this buffer can be reduced to a minimum +# skip-name-resolve # Avoids name resolving in the local network, thus reducing overhead. That also means that all connections are done by IP only. +# optimizer_search_depth=1 # Here we are, this is winner of the year. + +innodb_buffer_pool_size = 256M +innodb_log_buffer_size = 8M +innodb_file_per_table = 1 +innodb_open_files = 400 +innodb_io_capacity = 400 +innodb_flush_method = O_DIRECT +character-set-server=utf8 # This avoids potential pitfalls with text in exotic codepages. +#skip-name-resolve # Avoids name resolving in the local network, thus reducing overhead. That also means that all connections are done by IP only. +# well, not really according to use cases :( +#optimizer_search_depth=0 # Here we are, this is winner of the year. + +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem + +# +# * Galera-related settings +# +[galera] +# Mandatory settings +#wsrep_on=ON +#wsrep_provider= +#wsrep_cluster_address= +#binlog_format=row +#default_storage_engine=InnoDB +#innodb_autoinc_lock_mode=2 +# +# Allow server to accept connections on all interfaces. +# +#bind-address=0.0.0.0 +# +# Optional setting +#wsrep_slave_threads=1 +#innodb_flush_log_at_trx_commit=0 + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completion + +[isamchk] +key_buffer = 16M diff --git a/packages/addons/service/mariadb/source/default.py b/packages/addons/service/mariadb/source/default.py new file mode 100644 index 0000000000..72eb7df141 --- /dev/null +++ b/packages/addons/service/mariadb/source/default.py @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + +class Monitor(xbmc.Monitor): + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + +if __name__ == "__main__": + Monitor().waitForAbort() + diff --git a/packages/addons/service/mariadb/source/profile.d/99-mysql-histfile.profile b/packages/addons/service/mariadb/source/profile.d/99-mysql-histfile.profile new file mode 100644 index 0000000000..9f1a35133c --- /dev/null +++ b/packages/addons/service/mariadb/source/profile.d/99-mysql-histfile.profile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +export MYSQL_HISTFILE=/storage/.kodi/userdata/addon_data/service.mariadb/mysql_history diff --git a/packages/addons/service/mariadb/source/resources/language/English/strings.po b/packages/addons/service/mariadb/source/resources/language/English/strings.po new file mode 100644 index 0000000000..e8458d0767 --- /dev/null +++ b/packages/addons/service/mariadb/source/resources/language/English/strings.po @@ -0,0 +1,22 @@ +# Kodi Media Center language file +# Addon Name: mariadb +# Addon id: service.mariadb +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Accounts" +msgstr "" + +msgctxt "#30001" +msgid "Passwords" +msgstr "" + +msgctxt "#30002" +msgid "root" +msgstr "" + +msgctxt "#30003" +msgid "kodi" +msgstr "" diff --git a/packages/addons/service/mariadb/source/resources/settings.xml b/packages/addons/service/mariadb/source/resources/settings.xml new file mode 100644 index 0000000000..f77e80cdbd --- /dev/null +++ b/packages/addons/service/mariadb/source/resources/settings.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/addons/service/mariadb/source/settings-default.xml b/packages/addons/service/mariadb/source/settings-default.xml new file mode 100644 index 0000000000..bd3557c81f --- /dev/null +++ b/packages/addons/service/mariadb/source/settings-default.xml @@ -0,0 +1,4 @@ + + @MYSQL_ROOT_PASS@ + @MYSQL_KODI_PASS@ + diff --git a/packages/addons/service/mariadb/source/system.d/service.mariadb.service b/packages/addons/service/mariadb/source/system.d/service.mariadb.service new file mode 100644 index 0000000000..d32054a973 --- /dev/null +++ b/packages/addons/service/mariadb/source/system.d/service.mariadb.service @@ -0,0 +1,19 @@ +[Unit] +Description=MariaDB server +After=graphical.target network-online.service +Before=kodi.service + +[Service] +Type=forking +PIDFile=/var/run/mysqld/mysqld.pid +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.mariadb/bin/mariadb.start" +ExecStop=/bin/sh -c "exec sh /storage/.kodi/addons/service.mariadb/bin/mariadb.stop" +TimeoutStartSec=60 +TimeoutStopSec=60 +Restart=always +RestartSec=10 +StartLimitInterval=0 + +[Install] +Alias=mariadb.service +WantedBy=kodi.service diff --git a/packages/addons/service/minidlna/changelog.txt b/packages/addons/service/minidlna/changelog.txt new file mode 100644 index 0000000000..1eea9efece --- /dev/null +++ b/packages/addons/service/minidlna/changelog.txt @@ -0,0 +1,5 @@ +101 +- update to 1.2.1+2018-05-04 + +100 +- initial LibreELEC version diff --git a/packages/addons/service/minidlna/icon/icon.png b/packages/addons/service/minidlna/icon/icon.png new file mode 100755 index 0000000000..d3cfd67d43 Binary files /dev/null and b/packages/addons/service/minidlna/icon/icon.png differ diff --git a/packages/addons/service/minidlna/package.mk b/packages/addons/service/minidlna/package.mk new file mode 100644 index 0000000000..c0b9858ae8 --- /dev/null +++ b/packages/addons/service/minidlna/package.mk @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="minidlna" +PKG_VERSION="799e6cf505ec470b2bf0ae4118143380aa16b837" +PKG_SHA256="6d9d5a874381415b81dde80df30aa127ad732be341b37d73effb8a135454cbee" +PKG_VERSION_DATE="1.2.1+2018-05-04" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="BSD-3c/GPLv2" +PKG_SITE="https://sourceforge.net/projects/minidlna/" +PKG_URL="http://repo.or.cz/minidlna.git/snapshot/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain ffmpeg flac libexif libiconv libid3tag libjpeg-turbo libogg libvorbis sqlite" +PKG_SECTION="service" +PKG_SHORTDESC="MiniDLNA (ReadyMedia): a fully compliant DLNA/UPnP-AV server" +PKG_LONGDESC="MiniDLNA ($PKG_VERSION_DATE) (ReadyMedia) is a media server, with the aim of being fully compliant with DLNA/UPnP-AV clients." +PKG_TOOLCHAIN="autotools" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="MiniDLNA (ReadyMedia)" +PKG_ADDON_TYPE="xbmc.service" + +PKG_CONFIGURE_OPTS_TARGET="--disable-static \ + --disable-nls \ + --without-libiconv-prefix \ + --without-libintl-prefix \ + --with-os-name="$DISTRONAME" \ + --with-db-path="/storage/.kodi/userdata/addon_data/service.minidlna/db" \ + --with-os-url="https://libreelec.tv"" + +pre_configure_target() { + export LDFLAGS="$LDFLAGS -L$(get_build_dir ffmpeg)/.install_pkg/usr/lib" + export LIBS="$LIBS -lid3tag -lFLAC -logg -lz -lpthread -ldl -lm" +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.install_pkg/usr/sbin/minidlnad $ADDON_BUILD/$PKG_ADDON_ID/bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -p $(get_build_dir libexif)/.install_pkg/usr/lib/libexif.so.12 $ADDON_BUILD/$PKG_ADDON_ID/lib +} diff --git a/packages/addons/service/minidlna/patches/minidlna-01-fix-config.patch b/packages/addons/service/minidlna/patches/minidlna-01-fix-config.patch new file mode 100644 index 0000000000..7880b27f91 --- /dev/null +++ b/packages/addons/service/minidlna/patches/minidlna-01-fix-config.patch @@ -0,0 +1,23 @@ +disabling editing of the configfiles at buildtime +--- a/Makefile.am ++++ b/Makefile.am +@@ -73,19 +73,6 @@ testupnpdescgen_LDADD = \ + @LIBEXIF_LIBS@ \ + -lFLAC $(flacogglibs) $(vorbislibs) $(avahilibs) + +-SUFFIXES = .tmpl . +- +-.tmpl: +- sed -e s@:SBINDIR:@${sbindir}@ <$< >$@ +- +-GENERATED_FILES = \ +- linux/minidlna.init.d.script +- +-TEMPLATES = \ +- linux/minidlna.init.d.script.tmpl +- +-CLEANFILES = $(GENERATED_FILES) +- + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = m4/ChangeLog $(TEMPLATES) diff --git a/packages/addons/service/minidlna/source/bin/minidlna.start b/packages/addons/service/minidlna/source/bin/minidlna.start new file mode 100755 index 0000000000..82508e6074 --- /dev/null +++ b/packages/addons/service/minidlna/source/bin/minidlna.start @@ -0,0 +1,21 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile + +oe_setup_addon service.minidlna + +if [ ! -f "$ADDON_HOME/config/minidlna.conf" ]; then + mkdir -p $ADDON_HOME/config + cp $ADDON_DIR/config/minidlna.conf $ADDON_HOME/config +fi + +if [ ! -d "$ADDON_HOME/db" ]; then + mkdir -p $ADDON_HOME/db +fi + +chmod a+x $ADDON_DIR/bin/* + +exec $ADDON_DIR/bin/minidlnad -S -f $ADDON_HOME/config/minidlna.conf -p $minidlna_port &>$ADDON_HOME/service.log diff --git a/packages/addons/service/minidlna/source/config/minidlna.conf b/packages/addons/service/minidlna/source/config/minidlna.conf new file mode 100644 index 0000000000..8cb4a4d8e2 --- /dev/null +++ b/packages/addons/service/minidlna/source/config/minidlna.conf @@ -0,0 +1,79 @@ +# set this to the directory you want scanned +# + "A" for audio (eg. media_dir=A,/storage/music) +# + "V" for video (eg. media_dir=V,/storage/videos) +# + "P" for images (eg. media_dir=P,/storage/pictures) +# + "PV" for pictures and video (eg. media_dir=PV,/storage/digital_camera) +media_dir=V,/storage/videos +media_dir=V,/storage/tvshows +media_dir=P,/storage/pictures +media_dir=A,/storage/music + +# set this if you want to customize the name that shows up on your clients +friendly_name=DLNA Server + +# network interfaces to serve, comma delimited (8 interfaces max) +#network_interface=eth0 + +# set this to merge all media_dir base contents into the root container +# note: the default is no +#merge_media_dirs=no + +# set this to change the verbosity of the information that is logged +# each section can use a different level: off, fatal, error, warn, info, or debug +#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn + +# this should be a list of file names to check for when searching for album art +# note: names should be delimited with a forward slash ("/") +album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg + +# set this to no to disable inotify monitoring to automatically discover new files +# note: the default is yes +inotify=yes + +# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO +enable_tivo=no + +# set this to beacon to use legacy broadcast discovery method +# defauts to bonjour if avahi is available +tivo_discovery=bonjour + +# set this to strictly adhere to DLNA standards. +# * This will allow server-side downscaling of very large JPEG images, +# which may hurt JPEG serving performance on (at least) Sony DLNA products. +strict_dlna=no + +# default presentation url is http address on port 80 +#presentation_url=http://www.mylan/index.php + +# notify interval in seconds. default is 895 seconds. +notify_interval=1800 + +# serial and model number the daemon will report to clients +# in its XML description +serial=12345678 +model_number=1 + +# use different container as root of the tree +# possible values: +# + "." - use standard container (this is the default) +# + "B" - "Browse Directory" +# + "M" - "Music" +# + "V" - "Video" +# + "P" - "Pictures" +# + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists) +# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root +#root_container=. + +# always force SortCriteria to this value, regardless of the SortCriteria passed by the client +# note: you can prepend the sort criteria with "!" to alter the titles of the objects so that they +# will be alphanumerically sorted in the order you specify here, to work around clients that do their +# own alphanumeric sorting. +#force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title + +# maximum number of simultaneous connections +# note: many clients open several simultaneous connections while streaming +#max_connections=50 + +# enable subtitle support by default on unknown clients. +# note: the default is yes +#enable_subtitles=yes diff --git a/packages/addons/service/minidlna/source/default.py b/packages/addons/service/minidlna/source/default.py new file mode 100644 index 0000000000..95e7277c4a --- /dev/null +++ b/packages/addons/service/minidlna/source/default.py @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/minidlna/source/resources/language/English/strings.po b/packages/addons/service/minidlna/source/resources/language/English/strings.po new file mode 100644 index 0000000000..7f9ba3813d --- /dev/null +++ b/packages/addons/service/minidlna/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: minidlna +# Addon id: service.minidlna +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Port" +msgstr "" diff --git a/packages/addons/service/minidlna/source/resources/settings.xml b/packages/addons/service/minidlna/source/resources/settings.xml new file mode 100644 index 0000000000..5dc0437e50 --- /dev/null +++ b/packages/addons/service/minidlna/source/resources/settings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/addons/service/minidlna/source/settings-default.xml b/packages/addons/service/minidlna/source/settings-default.xml new file mode 100644 index 0000000000..02b57fb1f8 --- /dev/null +++ b/packages/addons/service/minidlna/source/settings-default.xml @@ -0,0 +1,3 @@ + + + diff --git a/packages/addons/service/minidlna/source/sleep.d/minidlna.power b/packages/addons/service/minidlna/source/sleep.d/minidlna.power new file mode 100644 index 0000000000..afd5a9fd56 --- /dev/null +++ b/packages/addons/service/minidlna/source/sleep.d/minidlna.power @@ -0,0 +1,25 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile + +oe_setup_addon service.minidlna + +SERVICE="service.minidlna" + +if [ "$RESTART_ON_RESUME" == "true" ] ; then + case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + systemctl start "$SERVICE" + fi + ;; + esac +fi diff --git a/packages/addons/service/minidlna/source/system.d/service.minidlna.service b/packages/addons/service/minidlna/source/system.d/service.minidlna.service new file mode 100644 index 0000000000..fad4788058 --- /dev/null +++ b/packages/addons/service/minidlna/source/system.d/service.minidlna.service @@ -0,0 +1,13 @@ +[Unit] +Description=minidlna +After=graphical.target + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.minidlna/bin/minidlna.start" +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/minisatip/changelog.txt b/packages/addons/service/minisatip/changelog.txt new file mode 100644 index 0000000000..ed5784c55b --- /dev/null +++ b/packages/addons/service/minisatip/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial Release diff --git a/packages/addons/service/minisatip/icon/icon.png b/packages/addons/service/minisatip/icon/icon.png new file mode 100644 index 0000000000..bd9dfaa6a4 Binary files /dev/null and b/packages/addons/service/minisatip/icon/icon.png differ diff --git a/packages/addons/service/minisatip/package.mk b/packages/addons/service/minisatip/package.mk new file mode 100644 index 0000000000..9446c3ee62 --- /dev/null +++ b/packages/addons/service/minisatip/package.mk @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="minisatip" +PKG_VERSION="110e6e99bc6c823b2a2c30ea02c58c91f59d077e" +PKG_SHA256="8ac997ae70d80bc50603609baf9a86253cf525f179c71fada5320301abaea902" +PKG_VERSION_NUMBER="0.7.16" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/catalinii/minisatip" +PKG_URL="https://github.com/catalinii/minisatip/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain dvb-apps libdvbcsa libxml2" +PKG_SECTION="service" +PKG_SHORTDESC="minisatip: a Sat>IP streaming server for Linux" +PKG_LONGDESC="minisatip($PKG_VERSION_NUMBER): is a Sat>IP streaming server for Linux supporting DVB-C, DVB-S/S2, DVB-T/T2, ATSC and ISDB-T" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Minisatip" +PKG_ADDON_TYPE="xbmc.service" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-netcv \ + --enable-dvbca \ + --enable-dvbaes \ + --enable-dvbcsa \ + --with-xml2=$(get_build_dir libxml2)" + +pre_configure_target() { + cd $PKG_BUILD + rm -rf .$TARGET_NAME + + # enables Common Interface (DVBEN50221) + CFLAGS="$CFLAGS -I$(get_build_dir dvb-apps)/lib" + LDFLAGS="$LDFLAGS -L$(get_build_dir dvb-apps)/lib/libdvbapi -L$(get_build_dir dvb-apps)/lib/libdvben50221 -L$(get_build_dir dvb-apps)/lib/libucsi" +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/minisatip $ADDON_BUILD/$PKG_ADDON_ID/bin + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/webif + cp -PR $PKG_BUILD/html/* $ADDON_BUILD/$PKG_ADDON_ID/webif +} diff --git a/packages/addons/service/minisatip/source/bin/minisatip.start b/packages/addons/service/minisatip/source/bin/minisatip.start new file mode 100644 index 0000000000..0c6987a3f9 --- /dev/null +++ b/packages/addons/service/minisatip/source/bin/minisatip.start @@ -0,0 +1,64 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile + +oe_setup_addon service.minisatip + +chmod a+x $ADDON_DIR/bin/* + +# wait for dvb card +if [ "$WAIT_FOR_FEINIT" = "true" ]; then + while [ true ] ; do + if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ]; then + break + fi + sleep 1 + done +fi + +# sleep for x seconds +if [ "$WORKAROUND_SLEEP" = "true" ]; then + sleep $WORKAROUND_SLEEP_TIME +fi + +## options +# simulate x adapters +if [ "$MINISATIP_TESTMODE" = "true" ]; then + MINISATIP_ARG_TEST="-a 2:2:2" +fi + +# debug log +if [ "$MINISATIP_DEBUG" = "true" ]; then + MINISATIP_ARG="-l -l -l" +fi + +# RTSP over TCP instead UDP +if [ "$MINISATIP_SATIP_TCP" = "true" ]; then + MINISATIP_ARG="$MINISATIP_ARG -O" +fi + +# clean the PSI from all CA information +if [ "$MINISATIP_CLEANPSI" = "true" ]; then + MINISATIP_ARG="$MINISATIP_ARG -t" +fi + +# port for listening for rtsp requests +if [ "$MINISATIP_RTSP_PORT" != "554" ]; then + MINISATIP_ARG="$MINISATIP_ARG -y $MINISATIP_RTSP_PORT" +fi + +# specify the hostname and port for the dvbapi server (oscam) +if [ "$MINISATIP_CLEANPSI" = "true" ]; then + MINISATIP_ARG="$MINISATIP_ARG -o ${MINISATIP_DVBAPI_IP}:${MINISATIP_DVBAPI_PORT}" +fi + +if [ "$MINISATIP_STARTUP" = "true" ]; then + echo "Minisatip was started with this settings: ${MINISATIP_STARTUP_ARGS}" > $ADDON_LOG_FILE + exec $ADDON_DIR/bin/minisatip -f ${MINISATIP_ARG_TEST} -x ${MINISATIP_WEBPORT} -R /storage/.kodi/addons/service.minisatip/webif ${MINISATIP_STARTUP_ARGS} >> $ADDON_LOG_FILE +else + echo "Minisatip was started with this settings: ${MINISATIP_ARG}" > $ADDON_LOG_FILE + $ADDON_DIR/bin/minisatip -f ${MINISATIP_ARG_TEST} -x ${MINISATIP_WEBPORT} -R /storage/.kodi/addons/service.minisatip/webif ${MINISATIP_ARG} >> $ADDON_LOG_FILE +fi diff --git a/packages/addons/service/minisatip/source/default.py b/packages/addons/service/minisatip/source/default.py new file mode 100644 index 0000000000..706475996f --- /dev/null +++ b/packages/addons/service/minisatip/source/default.py @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/minisatip/source/resources/language/English/strings.po b/packages/addons/service/minisatip/source/resources/language/English/strings.po new file mode 100644 index 0000000000..02a8346856 --- /dev/null +++ b/packages/addons/service/minisatip/source/resources/language/English/strings.po @@ -0,0 +1,82 @@ +# Kodi Media Center language file +# Addon Name: minisatip +# Addon id: service.minisatip +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Hardware" +msgstr "" + +msgctxt "#30001" +msgid "Wait for frontend initialization" +msgstr "" + +msgctxt "#30002" +msgid "Number of adapters to wait for" +msgstr "" + +msgctxt "#30003" +msgid "Unload DVB modules before suspend" +msgstr "" + +msgctxt "#30004" +msgid "Delay the start of Minisatip" +msgstr "" + +msgctxt "#30005" +msgid "time (s)" +msgstr "" + +msgctxt "#30006" +msgid "Minisatip" +msgstr "" + +msgctxt "#30007" +msgid "Use RTSP over TCP for data transport" +msgstr "" + +msgctxt "#30008" +msgid "Clean the PSI from all CA information" +msgstr "" + +msgctxt "#30009" +msgid "Specify the hostname for the dvbapi server (OScam)" +msgstr "" + +msgctxt "#30010" +msgid "Specify the port for the dvbapi server (OScam)" +msgstr "" + +msgctxt "#30011" +msgid "Port for listening for RTSP requests" +msgstr "" + +msgctxt "#30012" +msgid "Webui Port" +msgstr "" + +msgctxt "#30013" +msgid "Debugging" +msgstr "" + +msgctxt "#30014" +msgid "Debug Log" +msgstr "" + +msgctxt "#30015" +msgid "Simulate DVB adapters" +msgstr "" + +msgctxt "#30016" +msgid "Advanced Options" +msgstr "" + +msgctxt "#30017" +msgid "Manually enter startup command-line" +msgstr "" + +msgctxt "#30018" +msgid "Command-line" +msgstr "" diff --git a/packages/addons/service/minisatip/source/resources/settings.xml b/packages/addons/service/minisatip/source/resources/settings.xml new file mode 100644 index 0000000000..318fc9e0af --- /dev/null +++ b/packages/addons/service/minisatip/source/resources/settings.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/minisatip/source/settings-default.xml b/packages/addons/service/minisatip/source/settings-default.xml new file mode 100644 index 0000000000..30a46dcd2b --- /dev/null +++ b/packages/addons/service/minisatip/source/settings-default.xml @@ -0,0 +1,17 @@ + + false + false + 127.0.0.1 + 9000 + 554 + false + false + + false + 9999 + 1 + + false + false + 1 + diff --git a/packages/addons/service/minisatip/source/sleep.d/minisatip.power b/packages/addons/service/minisatip/source/sleep.d/minisatip.power new file mode 100644 index 0000000000..153eb73a7a --- /dev/null +++ b/packages/addons/service/minisatip/source/sleep.d/minisatip.power @@ -0,0 +1,25 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile + +oe_setup_addon service.minisatip + +SERVICE="service.minisatip" + +if [ "$RESTART_ON_RESUME" == "true" ] ; then + case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + systemctl start "$SERVICE" + fi + ;; + esac +fi diff --git a/packages/addons/service/minisatip/source/system.d/service.minisatip.service b/packages/addons/service/minisatip/source/system.d/service.minisatip.service new file mode 100644 index 0000000000..a962f4a2bc --- /dev/null +++ b/packages/addons/service/minisatip/source/system.d/service.minisatip.service @@ -0,0 +1,13 @@ +[Unit] +Description=minisatip +After=network-online.service + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.minisatip/bin/minisatip.start" +TimeoutStopSec=2 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/mpd/changelog.txt b/packages/addons/service/mpd/changelog.txt index f449da0b54..167476fe0b 100644 --- a/packages/addons/service/mpd/changelog.txt +++ b/packages/addons/service/mpd/changelog.txt @@ -1,5 +1,25 @@ -8.0.101 -- rebuild for libogg +107 +- Update to version 0.21.4 -8.0.100 -- initial LibreELEC version +106 +- Update to version 0.20.21 + +105 +- Update to version 0.20.19 +- Added mpd cli client mpc + +104 +- Update to version 0.20.13 +- Build with more features + +103 +- Update to version 0.20.9 + +102 +- Update to version 0.20.3 + +101 +- Rebuild for libogg + +100 +- Initial LibreELEC version diff --git a/packages/addons/service/mpd/package.mk b/packages/addons/service/mpd/package.mk index 6cbc11a2d5..9dac581ce7 100644 --- a/packages/addons/service/mpd/package.mk +++ b/packages/addons/service/mpd/package.mk @@ -1,97 +1,113 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mpd" -PKG_VERSION="0.19.15" -PKG_REV="101" +PKG_VERSION="0.21.4" +PKG_SHA256="247112eabf1b818a4052db7f0f5917ab00831ebc60a1ec3bf1154da4dc16a5c7" +PKG_REV="107" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://www.musicpd.org" -PKG_URL="http://www.musicpd.org/download/${PKG_NAME}/${PKG_VERSION%.*}/${PKG_NAME}-${PKG_VERSION}.tar.xz" -PKG_DEPENDS_TARGET="toolchain boost glib ffmpeg libmad libogg flac faad2 curl alsa-lib yajl libid3tag lame" +PKG_URL="http://www.musicpd.org/download/mpd/${PKG_VERSION%.*}/mpd-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain alsa-lib avahi boost curl faad2 ffmpeg flac glib lame libcdio libiconv libid3tag \ + libmad libmpdclient libsamplerate libvorbis libnfs libogg mpd-mpc opus pulseaudio samba yajl" PKG_SECTION="service.multimedia" PKG_SHORTDESC="Music Player Daemon (MPD): a free and open Music Player Server" PKG_LONGDESC="Music Player Daemon ($PKG_VERSION) is a flexible and powerful server-side application for playing music" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Music Player Daemon (MPD)" PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_PROVIDES="" + +PKG_MESON_OPTS_TARGET=" \ + -Dadplug=disabled \ + -Dalsa=enabled \ + -Dao=disabled \ + -Daudiofile=disabled \ + -Dbzip2=enabled \ + -Dcdio_paranoia=disabled \ + -Dchromaprint=disabled \ + -Dcue=true \ + -Dcurl=enabled \ + -Ddatabase=true \ + -Ddocumentation=false \ + -Ddsd=true \ + -Dexpat=enabled \ + -Dfaad=enabled \ + -Dffmpeg=enabled \ + -Dfifo=false \ + -Dflac=enabled \ + -Dfluidsynth=disabled \ + -Dgme=disabled \ + -Dhttpd=true \ + -Diconv=disabled \ + -Dicu=disabled \ + -Did3tag=enabled \ + -Dipv6=enabled \ + -Diso9660=enabled \ + -Djack=disabled \ + -Dlame=enabled \ + -Dlibmpdclient=enabled \ + -Dlibsamplerate=enabled \ + -Dlocal_socket=false \ + -Dmad=enabled \ + -Dmikmod=disabled \ + -Dmms=disabled \ + -Dmodplug=disabled \ + -Dmpcdec=disabled \ + -Dmpg123=disabled \ + -Dneighbor=false \ + -Dnfs=enabled \ + -Dopenal=disabled \ + -Dopus=enabled \ + -Doss=disabled \ + -Dpipe=true \ + -Dpulse=enabled \ + -Dqobuz=enabled \ + -Drecorder=false \ + -Dshine=disabled \ + -Dshout=disabled \ + -Dsidplay=disabled \ + -Dsmbclient=enabled \ + -Dsndfile=enabled \ + -Dsndio=disabled \ + -Dsolaris_output=disabled \ + -Dsoundcloud=enabled \ + -Dsoxr=enabled \ + -Dsqlite=enabled \ + -Dsyslog=disabled \ + -Dsystemd=disabled \ + -Dtest=false \ + -Dtidal=enabled \ + -Dtwolame=disabled \ + -Dupnp=disabled \ + -Dvorbis=enabled \ + -Dvorbisenc=enabled \ + -Dwave_encoder=true \ + -Dwavpack=disabled \ + -Dwebdav=enabled \ + -Dwildmidi=disabled \ + -Dyajl=enabled \ + -Dzeroconf=avahi \ + -Dzlib=enabled \ + -Dzzip=disabled" pre_configure_target() { - export LIBS="$LIBS -logg -lFLAC" + export LIBS="$LIBS -logg -lFLAC -ldl" } -PKG_CONFIGURE_OPTS_TARGET="--enable-alsa \ - --disable-roar \ - --disable-ao \ - --disable-audiofile \ - --disable-bzip2 \ - --disable-cdio-paranoia \ - --enable-curl \ - --disable-smbclient \ - --disable-soup \ - --disable-debug \ - --disable-documentation \ - --disable-ffado \ - --enable-ffmpeg \ - --disable-fluidsynth \ - --disable-gme \ - --enable-httpd-output \ - --enable-id3 \ - --disable-jack \ - --disable-lastfm \ - --disable-despotify \ - --disable-soundcloud \ - --enable-lame-encoder \ - --disable-libwrap \ - --disable-lsr \ - --enable-mad \ - --disable-mikmod\ - --disable-mms \ - --disable-modplug \ - --disable-mpg123 \ - --disable-mvp \ - --disable-openal \ - --disable-oss \ - --disable-pipe-output \ - --disable-pulse \ - --disable-recorder-output \ - --disable-sidplay \ - --disable-shout \ - --disable-sndfile \ - --disable-solaris-output \ - --disable-sqlite \ - --disable-systemd-daemon \ - --disable-test \ - --disable-twolame-encoder \ - --disable-zzip \ - --with-zeroconf=no \ - --disable-icu" - makeinstall_target() { - : # nop + : } addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $PKG_BUILD/.$TARGET_NAME/src/mpd $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.$TARGET_NAME/mpd $ADDON_BUILD/$PKG_ADDON_ID/bin + # copy mpd cli binary + cp -P $(get_build_dir mpd-mpc)/.$TARGET_NAME/mpc $ADDON_BUILD/$PKG_ADDON_ID/bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -p $(get_build_dir libmpdclient)/.install_pkg/usr/lib/libmpdclient.so $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -p $(get_build_dir libmpdclient)/.install_pkg/usr/lib/libmpdclient.so.2 $ADDON_BUILD/$PKG_ADDON_ID/lib } diff --git a/packages/addons/service/mpd/source/bin/mpd.start b/packages/addons/service/mpd/source/bin/mpd.start index d6a7bc36f1..e95b2c1e87 100755 --- a/packages/addons/service/mpd/source/bin/mpd.start +++ b/packages/addons/service/mpd/source/bin/mpd.start @@ -1,24 +1,8 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to the -# Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/mpd/source/default.py b/packages/addons/service/mpd/source/default.py index 6f814651a2..cd0d51d91f 100644 --- a/packages/addons/service/mpd/source/default.py +++ b/packages/addons/service/mpd/source/default.py @@ -1,19 +1,2 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/addons/service/mpd/source/resources/language/English/strings.po b/packages/addons/service/mpd/source/resources/language/English/strings.po new file mode 100644 index 0000000000..49c8a143f2 --- /dev/null +++ b/packages/addons/service/mpd/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: mpd +# Addon id: service.mpd +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "General" +msgstr "" + +msgctxt "#30001" +msgid "Restart on suspend / resume" +msgstr "" diff --git a/packages/addons/service/mpd/source/resources/language/English/strings.xml b/packages/addons/service/mpd/source/resources/language/English/strings.xml deleted file mode 100644 index d388c262c1..0000000000 --- a/packages/addons/service/mpd/source/resources/language/English/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - General - Restart on suspend / resume - diff --git a/packages/addons/service/mpd/source/resources/settings.xml b/packages/addons/service/mpd/source/resources/settings.xml index ae2693c874..8d6356f46e 100644 --- a/packages/addons/service/mpd/source/resources/settings.xml +++ b/packages/addons/service/mpd/source/resources/settings.xml @@ -1,8 +1,8 @@ - + - + diff --git a/packages/addons/service/mpd/source/settings-default.xml b/packages/addons/service/mpd/source/settings-default.xml index f5afe2c799..1bffc87a42 100644 --- a/packages/addons/service/mpd/source/settings-default.xml +++ b/packages/addons/service/mpd/source/settings-default.xml @@ -1,3 +1,3 @@ - - + + true diff --git a/packages/addons/service/mpd/source/sleep.d/mpd.power b/packages/addons/service/mpd/source/sleep.d/mpd.power index 1ba5ab37c6..b01cdeed86 100644 --- a/packages/addons/service/mpd/source/sleep.d/mpd.power +++ b/packages/addons/service/mpd/source/sleep.d/mpd.power @@ -1,24 +1,8 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/net-snmp/changelog.txt b/packages/addons/service/net-snmp/changelog.txt new file mode 100644 index 0000000000..de6237fc86 --- /dev/null +++ b/packages/addons/service/net-snmp/changelog.txt @@ -0,0 +1,25 @@ +106 +- update to 5.8 + +105 +- Improve configuration screen +- Make snmpv3 work again (missing include) +- Expose cputemp and/or gputemp with extends optionnaly + +104 +- Change daemon startup option + +103 +- update config.sub to support new hardware +- disable mini-agent in config options to get system MIB +- compile static binary to avoid cross compiling linking issue + +102 +-version bump + +101 +- make addon configurable + +100 +- Initial addon +- net-snmp 5.7.3 diff --git a/packages/addons/service/net-snmp/icon/icon.png b/packages/addons/service/net-snmp/icon/icon.png new file mode 100644 index 0000000000..1e3f6137a2 Binary files /dev/null and b/packages/addons/service/net-snmp/icon/icon.png differ diff --git a/packages/addons/service/net-snmp/package.mk b/packages/addons/service/net-snmp/package.mk new file mode 100644 index 0000000000..5f4fd2abdf --- /dev/null +++ b/packages/addons/service/net-snmp/package.mk @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="net-snmp" +PKG_VERSION="5.8" +PKG_SHA256="b2fc3500840ebe532734c4786b0da4ef0a5f67e51ef4c86b3345d697e4976adf" +PKG_REV="106" +PKG_ARCH="any" +PKG_LICENSE="BSD" +PKG_SITE="http://www.net-snmp.org" +PKG_URL="https://sourceforge.net/projects/net-snmp/files/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libnl openssl" +PKG_SECTION="service" +PKG_SHORTDESC="Simple Network Management Protocol utilities." +PKG_LONGDESC="Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment." +PKG_TOOLCHAIN="autotools" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Net-SNMP" +PKG_ADDON_TYPE="xbmc.service" + +configure_package() { + PKG_CONFIGURE_OPTS_TARGET="--with-defaults \ + --disable-applications \ + --disable-manuals \ + --disable-debugging \ + --disable-deprecated \ + --disable-snmptrapd-subagent \ + --disable-scripts \ + --enable-static=yes \ + --enable-shared=no \ + --with-nl \ + --with-logfile=/storage/.kodi/userdata/addon_data/${PKG_ADDON_ID} \ + --with-persistent-directory=/storage/.kodi/userdata/addon_data/${PKG_ADDON_ID} \ + --sysconfdir=/storage/.kodi/userdata/addon_data/${PKG_ADDON_ID} \ + --prefix=/storage/.kodi/addons/${PKG_ADDON_ID} \ + --exec-prefix=/storage/.kodi/addons/${PKG_ADDON_ID} \ + --datarootdir=/storage/.kodi/userdata/addon_data/${PKG_ADDON_ID}/share \ + --bindir=/storage/.kodi/addons/${PKG_ADDON_ID}/bin \ + --sbindir=/storage/.kodi/addons/${PKG_ADDON_ID}/bin \ + --libdir=/storage/.kodi/addons/${PKG_ADDON_ID}/lib \ + --disable-embedded-perl \ + --with-sysroot=$SYSROOT_PREFIX" +} + +make_target() { + make +} + +makeinstall_target() { + make install INSTALL_PREFIX=$PKG_BUILD/.$TARGET_NAME +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -r $PKG_BUILD/.$TARGET_NAME/storage/.kodi/addons/${PKG_ADDON_ID}/bin $PKG_BUILD/.$TARGET_NAME/storage/.kodi/userdata/addon_data/${PKG_ADDON_ID}/share $ADDON_BUILD/$PKG_ADDON_ID/ +} diff --git a/packages/addons/service/net-snmp/patches/net-snmp-0001-read_config.c.patch b/packages/addons/service/net-snmp/patches/net-snmp-0001-read_config.c.patch new file mode 100644 index 0000000000..6f52ff5a1f --- /dev/null +++ b/packages/addons/service/net-snmp/patches/net-snmp-0001-read_config.c.patch @@ -0,0 +1,11 @@ +--- a/snmplib/read_config.c 2014-12-08 14:23:22.000000000 -0600 ++++ b/snmplib/read_config.c 2017-03-30 12:21:16.351042803 -0500 +@@ -1618,7 +1618,7 @@ + * save a warning header to the top of the new file + */ + snprintf(fileold, sizeof(fileold), +- "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s", ++ "%s%s# Please save normal configuration tokens for %s in /storage/.kodi/userdata/addon_data/service.net-snmp/share/snmp/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s", + "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n", + "#\n# **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n", + type, type, type, diff --git a/packages/addons/service/net-snmp/patches/net-snmp-0002-net-snmp-create-v3-user.in.patch b/packages/addons/service/net-snmp/patches/net-snmp-0002-net-snmp-create-v3-user.in.patch new file mode 100644 index 0000000000..397341c400 --- /dev/null +++ b/packages/addons/service/net-snmp/patches/net-snmp-0002-net-snmp-create-v3-user.in.patch @@ -0,0 +1,15 @@ +--- a/net-snmp-create-v3-user.in 2014-12-08 14:23:22.000000000 -0600 ++++ b/net-snmp-create-v3-user.in 2017-03-30 13:20:56.336794994 -0500 +@@ -28,10 +28,8 @@ + NSC_SRCDIR="NET-SNMP-SOURCE-DIR" + fi + +-if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then +- echo "Apparently at least one snmpd demon is already running." +- echo "You must stop them in order to use this command." +- exit 1 ++if @PSCMD@ | egrep 'snmpd'> /dev/null 2>&1 ; then ++ systemctl stop service.net-snmp.service + fi + + Aalgorithm="MD5" diff --git a/packages/addons/service/net-snmp/patches/net-snmp-0003-config.sub.patch b/packages/addons/service/net-snmp/patches/net-snmp-0003-config.sub.patch new file mode 100644 index 0000000000..a39388d49a --- /dev/null +++ b/packages/addons/service/net-snmp/patches/net-snmp-0003-config.sub.patch @@ -0,0 +1,34 @@ +diff -ur net-snmp-5.7.3/config.sub net-snmp-5.7.3.new/config.sub +--- net-snmp-5.7.3/config.sub 2014-12-08 21:23:22.000000000 +0100 ++++ net-snmp-5.7.3.new/config.sub 2017-11-09 18:39:31.638689732 +0100 +@@ -247,10 +247,11 @@ case $basic_machine in + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ ++ | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ +- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ ++ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ +@@ -339,6 +340,7 @@ case $basic_machine in + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ ++ | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ +@@ -1171,6 +1173,9 @@ case $basic_machine in + basic_machine=hppa1.1-winbond + os=-proelf + ;; ++ x64) ++ basic_machine=x86_64-pc ++ ;; + xbox) + basic_machine=i686-pc + os=-mingw32 \ No newline at end of file diff --git a/packages/addons/service/net-snmp/source/bin/snmpd.start b/packages/addons/service/net-snmp/source/bin/snmpd.start new file mode 100644 index 0000000000..44a09d19a6 --- /dev/null +++ b/packages/addons/service/net-snmp/source/bin/snmpd.start @@ -0,0 +1,13 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.net-snmp + +ADDON_ID=service.net-snmp +ADDON_DIR="$HOME/.kodi/addons/$ADDON_ID" +ADDON_HOME="$HOME/.kodi/userdata/addon_data/$ADDON_ID" + +$ADDON_DIR/bin/snmpd -f -LS0-6d -C -c $ADDON_HOME/share/snmp/snmpd.conf -M $ADDON_DIR/share/snmp/mibs -p /var/run/snmpd.pid diff --git a/packages/addons/service/net-snmp/source/bin/snmpd.stop b/packages/addons/service/net-snmp/source/bin/snmpd.stop new file mode 100644 index 0000000000..50a8dc6c9b --- /dev/null +++ b/packages/addons/service/net-snmp/source/bin/snmpd.stop @@ -0,0 +1,14 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.net-snmp + +ADDON_ID=service.net-snmp +ADDON_DIR="$HOME/.kodi/addons/$ADDON_ID" +ADDON_HOME="$HOME/.kodi/userdata/addon_data/$ADDON_ID" + +PID=`cat /var/run/snmpd.pid` +kill -TERM $PID diff --git a/packages/addons/service/net-snmp/source/default.py b/packages/addons/service/net-snmp/source/default.py new file mode 100644 index 0000000000..1038dc3d68 --- /dev/null +++ b/packages/addons/service/net-snmp/source/default.py @@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +import xbmc +import xbmcvfs +import xbmcaddon +from os import system + + +class MyMonitor(xbmc.Monitor): + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + + def onSettingsChanged(self): + writeconfig() + + +# addon +__addon__ = xbmcaddon.Addon(id='service.net-snmp') +__addonpath__ = xbmc.translatePath(__addon__.getAddonInfo('path')) +__addonhome__ = xbmc.translatePath(__addon__.getAddonInfo('profile')) +if not xbmcvfs.exists(xbmc.translatePath(__addonhome__ + 'share/snmp/')): + xbmcvfs.mkdirs(xbmc.translatePath(__addonhome__ + 'share/snmp/')) +config = xbmc.translatePath(__addonhome__ + 'share/snmp/snmpd.conf') +persistent = xbmc.translatePath(__addonhome__ + 'snmpd.conf') + + +def writeconfig(): + system("systemctl stop service.net-snmp.service") + community = __addon__.getSetting("COMMUNITY") + location = __addon__.getSetting("LOCATION") + contact = __addon__.getSetting("CONTACT") + snmpversion = __addon__.getSetting("SNMPVERSION") + cputemp = __addon__.getSetting("CPUTEMP") + gputemp = __addon__.getSetting("GPUTEMP") + + if xbmcvfs.exists(persistent): + xbmcvfs.delete(persistent) + + file = xbmcvfs.File(config, 'w') + file.write('com2sec local default {}\n'.format(community)) + file.write('group localgroup {} local\n'.format(snmpversion)) + file.write('access localgroup "" any noauth exact all all none\n') + file.write('view all included .1 80\n') + file.write('syslocation {}\n'.format(location)) + file.write('syscontact {}\n'.format(contact)) + file.write('dontLogTCPWrappersConnects yes\n') + + if cputemp == "true": + file.write('extend cputemp "/usr/bin/cputemp"\n') + + if gputemp == "true": + file.write('extend gputemp "/usr/bin/gputemp"\n') + + if snmpversion == "v3": + file.write('includeFile ../../snmpd.conf\n') + snmppassword = __addon__.getSetting("SNMPPASSWORD") + snmpuser = __addon__.getSetting("SNMPUSER") + system("net-snmp-config --create-snmpv3-user -a MD5 -A {0} {1}".format(snmppassword,snmpuser)) + + file.close() + system("systemctl start service.net-snmp.service") + + +if not xbmcvfs.exists(config): + writeconfig() + +monitor = MyMonitor() +while not monitor.abortRequested(): + if monitor.waitForAbort(): + break + diff --git a/packages/addons/service/net-snmp/source/resources/language/English/strings.xml b/packages/addons/service/net-snmp/source/resources/language/English/strings.xml new file mode 100644 index 0000000000..e65e30caf2 --- /dev/null +++ b/packages/addons/service/net-snmp/source/resources/language/English/strings.xml @@ -0,0 +1,15 @@ + + + + General + Community + Location + Contact + SNMP Version + SNMP User + SNMP Password + v3 account + Extends + Expose cputemp + Expose gputemp + diff --git a/packages/addons/service/net-snmp/source/resources/settings.xml b/packages/addons/service/net-snmp/source/resources/settings.xml new file mode 100644 index 0000000000..ed20f72b8a --- /dev/null +++ b/packages/addons/service/net-snmp/source/resources/settings.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/net-snmp/source/system.d/service.net-snmp.service b/packages/addons/service/net-snmp/source/system.d/service.net-snmp.service new file mode 100644 index 0000000000..b2da3b4845 --- /dev/null +++ b/packages/addons/service/net-snmp/source/system.d/service.net-snmp.service @@ -0,0 +1,14 @@ +[Unit] +Description=Net-SNMP software bundle +After=network-online.target +Requires=network-online.target + +[Service] +Type=notification +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.net-snmp/bin/snmpd.start" +ExecStop=/bin/sh -c "exec sh /storage/.kodi/addons/service.net-snmp/bin/snmpd.stop" +ExecReload=/bin/kill -HUP $MAINPID +PIDFile=/var/run/snmpd.pid + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/oscam/changelog.txt b/packages/addons/service/oscam/changelog.txt index f78067db13..19a90e321c 100644 --- a/packages/addons/service/oscam/changelog.txt +++ b/packages/addons/service/oscam/changelog.txt @@ -1,8 +1,24 @@ +107 +- Update to version 11487 + +106 +- Update to version 11431 + +105 +- Update to version 11420 +- add SSL support + +104 +- Update to version 11391 + +103 +- Update to version 11350 + 102 - fix the delayed start workaround 101 -- Update OSCam to 11233 +- Update to version 11233 - fix the WeTek_Play problems 100 diff --git a/packages/addons/service/oscam/package.mk b/packages/addons/service/oscam/package.mk index f4c75e0b6d..5df8de451a 100644 --- a/packages/addons/service/oscam/package.mk +++ b/packages/addons/service/oscam/package.mk @@ -1,30 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="oscam" -PKG_VERSION="c677c6e" -PKG_VERSION_NUMBER="11233" -PKG_REV="102" +PKG_VERSION="695307bc8931a52ccf48927cdc197c0207ff6d66" +PKG_SHA256="b3171a7558f235842dcc8820710f311d6a344f642e0b90b0d53d5a82451b87d4" +PKG_VERSION_NUMBER="11487" +PKG_REV="107" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.streamboard.tv/oscam/wiki" PKG_URL="http://repo.or.cz/oscam.git/snapshot/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain pcsc-lite" +PKG_DEPENDS_TARGET="toolchain openssl pcsc-lite" PKG_SECTION="service.softcam" PKG_SHORTDESC="OSCam: an Open Source Conditional Access Modul" PKG_LONGDESC="OSCam($PKG_VERSION_NUMBER) is a software to be used to decrypt digital television channels, as an alternative for a conditional access module." @@ -32,24 +18,25 @@ PKG_LONGDESC="OSCam($PKG_VERSION_NUMBER) is a software to be used to decrypt dig PKG_IS_ADDON="yes" PKG_ADDON_NAME="OSCam" PKG_ADDON_TYPE="xbmc.service" -PKG_AUTORECONF="no" - -pre_unpack() { -export OSCAM_ADDON_VERSION="$PKG_VERSION_NUMBER" -} PKG_CMAKE_OPTS_TARGET="-DLIBUSBDIR=$SYSROOT_PREFIX/usr \ - -DWITH_SSL=0 \ - -DHAVE_LIBCRYPTO=0 \ - -DHAVE_DVBAPI=1 -DWITH_STAPI=0 \ + -DWITH_SSL=1 \ + -DHAVE_LIBCRYPTO=1 \ + -DHAVE_DVBAPI=1 \ + -DWITH_STAPI=0 \ -DWEBIF=1 \ -DWITH_DEBUG=0 \ -DOPTIONAL_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include \ -DSTATIC_LIBUSB=1 \ - -DCLOCKFIX=0" + -DCLOCKFIX=0 \ + -DCARDREADER_DB2COM=OFF" + +pre_configure_target() { + export OSCAM_ADDON_VERSION="$PKG_VERSION_NUMBER" +} makeinstall_target() { - : # nop + : } addon() { diff --git a/packages/addons/service/oscam/patches/oscam-01-revision.patch b/packages/addons/service/oscam/patches/oscam-01-revision.patch index 201666456e..43aeb9ca11 100644 --- a/packages/addons/service/oscam/patches/oscam-01-revision.patch +++ b/packages/addons/service/oscam/patches/oscam-01-revision.patch @@ -1,13 +1,11 @@ -diff --git a/config.sh b/config.sh -index 7653731..a6b2ea8 100755 --- a/config.sh +++ b/config.sh -@@ -687,7 +687,7 @@ do +@@ -698,7 +698,7 @@ do break ;; '-r'|'--oscam-revision') -- (svnversion -n . 2>/dev/null || printf 0) | sed 's/.*://; s/[^0-9]*$//; s/^$/0/' +- revision=`(svnversion -n . 2>/dev/null || printf 0) | sed 's/.*://; s/[^0-9]*$//; s/^$/0/'` + echo "$OSCAM_ADDON_VERSION" - break - ;; - '-O'|'--detect-osx-sdk-version') + if [ "$revision" = "0" ] + then + which git > /dev/null 2>&1 && revision=`git log -10 --pretty=%B | grep git-svn-id | head -n 1 | sed -n -e 's/^.*trunk@\([0-9]*\) .*$/\1/p'` diff --git a/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch b/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch index ff16f494da..7fade2ed5e 100644 --- a/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch +++ b/packages/addons/service/oscam/patches/oscam-02-link-with-ludev.patch @@ -1,18 +1,18 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3ebd781..2966e65 100644 +index 6d28847f..1b7ecc5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -474,7 +474,7 @@ add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs}) +@@ -498,7 +498,7 @@ add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs}) set (exe_name "oscam") add_executable (${exe_name} ${exe_srcs} ${exe_hdrs}) -target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt minilzo) +target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt minilzo udev) if(HAVE_LIBRT AND HAVE_LIBUSB) - if (LIBUSBDIR) - set (libusb_link "imp_libusb") + if (LIBUSBDIR) + set (libusb_link "imp_libusb") diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt -index 6790913..a603d3e 100644 +index 6790913e..a603d3ee 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -12,7 +12,7 @@ file (GLOB all_srcs ${exe_srcs}) @@ -24,5 +24,3 @@ index 6790913..a603d3e 100644 #----------------------- printout resume ----------------------------- message (STATUS "Utils: operating system: ${OSCamOperatingSystem}") --- -1.7.2.5 diff --git a/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch b/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch index 4eeee55111..e42fa170b9 100644 --- a/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch +++ b/packages/addons/service/oscam/patches/oscam-03-pcsc-pthread.patch @@ -1,12 +1,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index cd52430..b01b9fc 100644 +index 1b7ecc5e..ddef8576 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -530,6 +530,7 @@ if (HAVE_PCSC) +@@ -561,6 +561,7 @@ if (HAVE_PCSC) if (NOT OSCamOperatingSystem MATCHES "Mac OS X") if (NOT OSCamOperatingSystem MATCHES "Windows/Cygwin") - target_link_libraries (${exe_name} pcsclite) -+ target_link_libraries (${exe_name} pthread) + target_link_libraries (${exe_name} pcsclite) ++ target_link_libraries (${exe_name} pthread) endif (NOT OSCamOperatingSystem MATCHES "Windows/Cygwin") endif (NOT OSCamOperatingSystem MATCHES "Mac OS X") endif (HAVE_PCSC) diff --git a/packages/addons/service/oscam/source/bin/oscam.start b/packages/addons/service/oscam/source/bin/oscam.start index 23ae9d2bee..359ea503f5 100755 --- a/packages/addons/service/oscam/source/bin/oscam.start +++ b/packages/addons/service/oscam/source/bin/oscam.start @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/oscam/source/default.py b/packages/addons/service/oscam/source/default.py index c6dfcce9f2..cd0d51d91f 100644 --- a/packages/addons/service/oscam/source/default.py +++ b/packages/addons/service/oscam/source/default.py @@ -1,17 +1,2 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/addons/service/oscam/source/oscam-default.conf b/packages/addons/service/oscam/source/oscam-default.conf index ac5da7844c..4357311a28 100644 --- a/packages/addons/service/oscam/source/oscam-default.conf +++ b/packages/addons/service/oscam/source/oscam-default.conf @@ -1,11 +1,14 @@ -# oscam.conf generated automatically by Streamboard OSCAM 1.00-unstable_svn build #0 -# Read more: http://streamboard.gmc.to/svn/oscam/trunk/Distribution/doc/txt/oscam.conf.txt +# +# main configuration +# [global] +nice = -1 +WaitForCards = 1 + usrfile = /storage/.kodi/userdata/addon_data/service.softcam.oscam/log/oscamuser.log logfile = /storage/.kodi/userdata/addon_data/service.softcam.oscam/log/oscam.log cwlogdir = /storage/.kodi/userdata/addon_data/service.softcam.oscam/log/cw -nice = -1 saveinithistory = 1 [monitor] diff --git a/packages/addons/service/oscam/source/resources/language/English/strings.po b/packages/addons/service/oscam/source/resources/language/English/strings.po new file mode 100644 index 0000000000..61414741dd --- /dev/null +++ b/packages/addons/service/oscam/source/resources/language/English/strings.po @@ -0,0 +1,34 @@ +# Kodi Media Center language file +# Addon Name: oscam +# Addon id: service.oscam +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "General" +msgstr "" + +msgctxt "#30001" +msgid "Restart on suspend / resume" +msgstr "" + +msgctxt "#30002" +msgid "DVBAPI" +msgstr "" + +msgctxt "#30003" +msgid "Delay the start of OSCam" +msgstr "" + +msgctxt "#30004" +msgid "time (s)" +msgstr "" + +msgctxt "#30005" +msgid "Wait for frontend initialization" +msgstr "" + +msgctxt "#30006" +msgid "Number of adapters to wait for" +msgstr "" diff --git a/packages/addons/service/oscam/source/resources/language/English/strings.xml b/packages/addons/service/oscam/source/resources/language/English/strings.xml deleted file mode 100644 index adb080f372..0000000000 --- a/packages/addons/service/oscam/source/resources/language/English/strings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - General - Restart on suspend / resume - DVBAPI - Delay the start of OSCam - time (s) - Wait for frontend initialization - Number of adapters to wait for - diff --git a/packages/addons/service/oscam/source/resources/settings.xml b/packages/addons/service/oscam/source/resources/settings.xml index 669656f8c9..524fdff758 100644 --- a/packages/addons/service/oscam/source/resources/settings.xml +++ b/packages/addons/service/oscam/source/resources/settings.xml @@ -1,14 +1,14 @@ - + - - - + + + - + - - + + diff --git a/packages/addons/service/oscam/source/settings-default.xml b/packages/addons/service/oscam/source/settings-default.xml index 2c9c856108..c1244edcce 100644 --- a/packages/addons/service/oscam/source/settings-default.xml +++ b/packages/addons/service/oscam/source/settings-default.xml @@ -1,7 +1,7 @@ - - - - - - + + 1 + false + false + false + 1 diff --git a/packages/addons/service/oscam/source/sleep.d/oscam.power b/packages/addons/service/oscam/source/sleep.d/oscam.power index 550f884072..fceec0296a 100644 --- a/packages/addons/service/oscam/source/sleep.d/oscam.power +++ b/packages/addons/service/oscam/source/sleep.d/oscam.power @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/pcscd/changelog.txt b/packages/addons/service/pcscd/changelog.txt new file mode 100644 index 0000000000..428ea6227b --- /dev/null +++ b/packages/addons/service/pcscd/changelog.txt @@ -0,0 +1,2 @@ +100 +- initial addon diff --git a/packages/addons/service/pcscd/config/reader.conf b/packages/addons/service/pcscd/config/reader.conf new file mode 100644 index 0000000000..d9991a666c --- /dev/null +++ b/packages/addons/service/pcscd/config/reader.conf @@ -0,0 +1,10 @@ +# Gemalto reader with serial communication +# - n is the serial port to use n in [0..3] +# - reader is the reader name. It is needed for multi-slot readers. +# Possible reader values are: GemPCPinPad, GemCorePOSPro, GemCoreSIMPro, +# GemPCTwin (default value) +# example: /dev/ttyS0:GemPCPinPad +#FRIENDLYNAME "GemPCTwin serial" +#DEVICENAME /dev/ttySn[:reader] +#LIBPATH /storage/.kodi/addons/service.pcscd/drivers/serial/libccidtwin.so +#CHANNELID n diff --git a/packages/addons/service/pcscd/icon/icon.png b/packages/addons/service/pcscd/icon/icon.png new file mode 100644 index 0000000000..222be49f4b Binary files /dev/null and b/packages/addons/service/pcscd/icon/icon.png differ diff --git a/packages/addons/service/pcscd/package.mk b/packages/addons/service/pcscd/package.mk new file mode 100644 index 0000000000..82dd30e55e --- /dev/null +++ b/packages/addons/service/pcscd/package.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2011 Gregor Fuis (gujs@openelec.tv) +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pcscd" +PKG_VERSION="1.0" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://libreelec.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain pcsc-lite libusb ccid" +PKG_SECTION="service" +PKG_SHORTDESC="Middleware to access a smart card using SCard API (PC/SC)" +PKG_LONGDESC="Middleware to access a smart card using SCard API (PC/SC)" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="PC/SC Smart Card Daemon" +PKG_ADDON_TYPE="xbmc.service" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + cp -Pa $(get_build_dir pcsc-lite)/.install_pkg/usr/sbin/pcscd $ADDON_BUILD/$PKG_ADDON_ID/bin/pcscd.bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/drivers/serial + cp -Pa $(get_build_dir ccid)/.$TARGET_NAME/src/.libs/libccidtwin.so $ADDON_BUILD/$PKG_ADDON_ID/drivers/serial + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents/Linux/ + cp -Pa $(get_build_dir ccid)/.$TARGET_NAME/src/.libs/libccid.so $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents/Linux/ + cp -Pa $(get_build_dir ccid)/.$TARGET_NAME/src/Info.plist $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config + cp -Pa $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/ +} diff --git a/packages/addons/service/pcscd/source/bin/pcscd.start b/packages/addons/service/pcscd/source/bin/pcscd.start new file mode 100755 index 0000000000..c612adb150 --- /dev/null +++ b/packages/addons/service/pcscd/source/bin/pcscd.start @@ -0,0 +1,19 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile + +oe_setup_addon service.pcscd + +mkdir -p $ADDON_HOME/config + +chmod a+x $ADDON_DIR/bin/* + +if [ ! -f "$ADDON_HOME/config/reader.conf" ]; then + cp $ADDON_DIR/config/reader.conf $ADDON_HOME/config/reader.conf +fi + +exec pcscd.bin --foreground -c $ADDON_HOME/config/reader.conf diff --git a/packages/addons/service/pcscd/source/default.py b/packages/addons/service/pcscd/source/default.py new file mode 100644 index 0000000000..54d0daa205 --- /dev/null +++ b/packages/addons/service/pcscd/source/default.py @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/pcscd/source/system.d/service.pcscd.service b/packages/addons/service/pcscd/source/system.d/service.pcscd.service new file mode 100644 index 0000000000..1434d18b61 --- /dev/null +++ b/packages/addons/service/pcscd/source/system.d/service.pcscd.service @@ -0,0 +1,13 @@ +[Unit] +Description=PCSC lite +After=graphical.target + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.pcscd/bin/pcscd.start" +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/proftpd/changelog.txt b/packages/addons/service/proftpd/changelog.txt index 7b56342737..54413aed60 100644 --- a/packages/addons/service/proftpd/changelog.txt +++ b/packages/addons/service/proftpd/changelog.txt @@ -1,2 +1,8 @@ +102 +- update to proftpd 1.3.6 + +101 +- rebuild + 100 -- initial LibreELEC release \ No newline at end of file +- initial LibreELEC release diff --git a/packages/addons/service/proftpd/package.mk b/packages/addons/service/proftpd/package.mk index 9bec2884d0..c3684bea17 100644 --- a/packages/addons/service/proftpd/package.mk +++ b/packages/addons/service/proftpd/package.mk @@ -1,35 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="proftpd" -PKG_VERSION="1.3.5b" -PKG_REV="100" +PKG_VERSION="1.3.6" +PKG_SHA256="91ef74b143495d5ff97c4d4770c6804072a8c8eb1ad1ecc8cc541b40e152ecaf" +PKG_REV="102" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.proftpd.org/" PKG_URL="https://github.com/proftpd/proftpd/archive/v$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libcap libressl netbsd-curses pcre whois" +PKG_DEPENDS_TARGET="toolchain libcap openssl ncurses pcre whois" PKG_SECTION="service" PKG_SHORTDESC="ProFTPD: a FTP server for linux" PKG_LONGDESC="ProFTPD ($PKG_VERSION): is a secure and configurable FTP server with SSL/TLS support" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_NAME="ProFTPD Server" @@ -57,8 +41,8 @@ pre_build_target() { } pre_configure_target() { - export CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I$SYSROOT_PREFIX/usr/include/ncurses -I$ROOT/$PKG_BUILD/.$TARGET_NAME/include/" - export LDFLAGS="$LDFLAGS -L$ROOT/$PKG_BUILD/.$TARGET_NAME/lib" + export CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I$PKG_BUILD/.$TARGET_NAME/include/" + export LDFLAGS="$LDFLAGS -L$PKG_BUILD/.$TARGET_NAME/lib" } makeinstall_target() { diff --git a/packages/addons/service/proftpd/source/bin/proftpd.start b/packages/addons/service/proftpd/source/bin/proftpd.start index 58a324bc79..234ff8f493 100755 --- a/packages/addons/service/proftpd/source/bin/proftpd.start +++ b/packages/addons/service/proftpd/source/bin/proftpd.start @@ -1,26 +1,9 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2012 x23 -# Copyright (C) 2012-2015 ultraman -# -# 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, or (at your option) -# any later version. -# -# This Program 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2012 x23 +# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2012-2015 ultraman . /etc/profile diff --git a/packages/addons/service/proftpd/source/default.py b/packages/addons/service/proftpd/source/default.py index 3999a0eb31..252cf5c277 100644 --- a/packages/addons/service/proftpd/source/default.py +++ b/packages/addons/service/proftpd/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/rsyslog/changelog.txt b/packages/addons/service/rsyslog/changelog.txt index 4f7534df67..82b2d78c6e 100755 --- a/packages/addons/service/rsyslog/changelog.txt +++ b/packages/addons/service/rsyslog/changelog.txt @@ -1,10 +1,16 @@ -8.0.100 -- Initial addon +104 +- Update to 8.37.0 + +103 +- Rebuild + +102 +- Add first run wizard configuration menu -8.0.101 +101 - Add RELP Protocol - Add ability to compress messages using TCP/UDP protocols - Update configuration files using newer standards -8.0.102 -- Add first run wizard configuration menu +100 +- Initial addon diff --git a/packages/addons/service/rsyslog/package.mk b/packages/addons/service/rsyslog/package.mk index 089857f294..8ddc6a0b80 100644 --- a/packages/addons/service/rsyslog/package.mk +++ b/packages/addons/service/rsyslog/package.mk @@ -1,39 +1,25 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="rsyslog" -PKG_VERSION="8.21.0" -PKG_REV="102" +PKG_VERSION="8.37.0" +PKG_SHA256="295c289b4c8abd8f8f3fe35a83249b739cedabe82721702b910255f9faf147e7" +PKG_REV="104" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/rsyslog" PKG_URL="http://www.rsyslog.com/files/download/rsyslog/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain util-linux libestr libfastjson liblognorm librelp zlib libgcrypt liblogging" +PKG_DEPENDS_TARGET="toolchain curl libestr libfastjson libgcrypt liblogging liblognorm librelp util-linux zlib" PKG_SECTION="service" PKG_SHORTDESC="Rsyslog: a rocket-fast system for log processing." PKG_LONGDESC="Rsyslog ($PKG_VERSION) offers high-performance, great security features and a modular design." -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Rsyslog" PKG_ADDON_TYPE="xbmc.service" -PKG_CONFIGURE_OPTS_TARGET="--enable-imfile \ +PKG_CONFIGURE_OPTS_TARGET="--disable-default-tests \ + --enable-imfile \ --enable-imjournal \ --enable-relp \ --enable-omjournal \ diff --git a/packages/addons/service/rsyslog/source/bin/rsyslog.init b/packages/addons/service/rsyslog/source/bin/rsyslog.init index 072bddd0e6..9fc44aeb71 100644 --- a/packages/addons/service/rsyslog/source/bin/rsyslog.init +++ b/packages/addons/service/rsyslog/source/bin/rsyslog.init @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile oe_setup_addon service.rsyslog diff --git a/packages/addons/service/rsyslog/source/default.py b/packages/addons/service/rsyslog/source/default.py index b7838e8a78..b56ea657f6 100644 --- a/packages/addons/service/rsyslog/source/default.py +++ b/packages/addons/service/rsyslog/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/rsyslog/source/resources/settings.xml b/packages/addons/service/rsyslog/source/resources/settings.xml index e740cc15b4..7c1b5ad451 100644 --- a/packages/addons/service/rsyslog/source/resources/settings.xml +++ b/packages/addons/service/rsyslog/source/resources/settings.xml @@ -1,10 +1,10 @@ - - + + - + diff --git a/packages/addons/service/rsyslog/source/settings-default.xml b/packages/addons/service/rsyslog/source/settings-default.xml index 6160c557fb..c7037f0acd 100644 --- a/packages/addons/service/rsyslog/source/settings-default.xml +++ b/packages/addons/service/rsyslog/source/settings-default.xml @@ -1,11 +1,11 @@ - - - - - - - - - - + + + false + true + false + 514 + UDP + false + false + 0 diff --git a/packages/addons/service/slice/changelog.txt b/packages/addons/service/slice/changelog.txt new file mode 100644 index 0000000000..b8fc44b6fe --- /dev/null +++ b/packages/addons/service/slice/changelog.txt @@ -0,0 +1,9 @@ +102 +- Fix rew pattern not working +- Change logging to use LOGDEBUG + +101 +- Fix sleep.png so all LED's turn off + +100 +- Initial release diff --git a/packages/addons/service/slice/icon/icon.png b/packages/addons/service/slice/icon/icon.png new file mode 100644 index 0000000000..d669c45ed6 Binary files /dev/null and b/packages/addons/service/slice/icon/icon.png differ diff --git a/packages/addons/service/slice/package.mk b/packages/addons/service/slice/package.mk new file mode 100644 index 0000000000..f70f73173b --- /dev/null +++ b/packages/addons/service/slice/package.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="slice" +PKG_VERSION="0" +PKG_REV="102" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="service" +PKG_SHORTDESC="Provides the ability to change the led lights on the Slice box via Kodi actions" +PKG_LONGDESC="Provides the ability to change the led lights on the Slice box via Kodi actions" +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="embedded" +PKG_ADDON_NAME="Slice" +PKG_ADDON_PROJECTS="Slice Slice3" +PKG_ADDON_TYPE="xbmc.service" + +addon() { + : +} diff --git a/packages/addons/service/slice/source/default.py b/packages/addons/service/slice/source/default.py new file mode 100644 index 0000000000..b67ade74a9 --- /dev/null +++ b/packages/addons/service/slice/source/default.py @@ -0,0 +1,234 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +from PIL import Image + +import os +import threading +import time +import Queue +import xbmc +import xbmcaddon + +''' +ffwd.png +pause.png +play.png +quit.png +rew.png +shutdown.png +skipf.png +skipr.png +sleep.png +startup.png +stop.png +wake.png +''' + +__addon__ = xbmcaddon.Addon() +__path__ = __addon__.getAddonInfo('path') + +class PNGPatternPlayer(threading.Thread): + + def __init__(self): + threading.Thread.__init__(self) + self.path = __path__ + "/resources/media/ledpatterns" + self.patterns = Queue.Queue() + self.responses = Queue.Queue() + self.stopped = False + self.memo = {} + self.start() + + def setPath(self, path): + if self.path != path: + self.path = path + self.memo = {} + + def clearPattern(self): + with open('/dev/ws2812', 'wb') as f: + 'write null multiple times as the LEDs can get locked up with fast operations' + for n in range(5): + f.write(bytearray(25)) + + def playPattern(self, file, delay): + xbmc.log('playing pattern: %s' % file, xbmc.LOGDEBUG) + + 'get pixel data from a cache if available, otherwise load and calculate' + if file not in self.memo: + image = Image.open(file) + pixels = image.load() + width, height = image.size + data = [] + + for y in range(height): + x_pixels = [] + for x in range(width): + pixel = [] + r, g, b, a = pixels[x, y] + pixel.append(hex(r)[2:].zfill(2)) + pixel.append(hex(g)[2:].zfill(2)) + pixel.append(hex(b)[2:].zfill(2)) + pixel.append(hex(a)[2:].zfill(2)) + x_pixels.append(''.join(str(e) for e in pixel)) + data.append(' '.join(str(e) for e in x_pixels)) + + self.memo[file] = data + + for hexline in self.memo[file]: + if not self.stopped: + with open('/dev/ws2812', 'wb') as f: + f.write(bytearray.fromhex(hexline)) + time.sleep(delay) + else: + break + + def play(self, file, repeat=False, delay=0.030, wait=None): + self.stopped = True + + if wait is not None: + # wait up to specified time if this pattern is to be processed synchronously + self.patterns.put((file, repeat, delay, True)) + try: + result = self.responses.get(block=True, timeout=wait) + except Queue.Empty: + pass + else: + self.patterns.put((file, repeat, delay, False)) + + def stop(self, wait=None): + self.play(None, wait=wait) + + def run(self): + repeat = False + + while True: + try: + (file, repeat, delay, wait) = self.patterns.get(block=True, timeout=0 if repeat and not self.stopped else None) + + self.stopped = False + + if file is not None: + self.playPattern("%s/%s.png" % (self.path, file), delay) + else: + self.clearPattern() + + if wait: + self.responses.put(True) + + # Queue will be empty if we're repeating the last pattern and there is no new work + except Queue.Empty: + self.playPattern("%s/%s.png" % (self.path, file), delay) + +class SlicePlayer(xbmc.Player): + + def __init__(self, *args, **kwargs): + xbmc.Player.__init__(self) + + 'maps kodi player speed to delay in seconds' + self.speed_map = {-32: 0.015, + -16: 0.025, + -8: 0.030, + -4: 0.035, + -2: 0.040, + -1: 0.060, + 0: 0.000, + 1: 0.060, + 2: 0.040, + 4: 0.035, + 8: 0.030, + 16: 0.025, + 32: 0.015, + } + + self.speed = 1 + patterns.play('startup', False, 0.02) + xbmc.log('service.slice add-on started', xbmc.LOGNOTICE) + + def onPlayBackEnded(self): + 'Will be called when Kodi stops playing a file' + + patterns.play('stop') + + def onPlayBackPaused(self): + 'Will be called when user pauses a playing file' + + patterns.play('pause') + + def onPlayBackResumed(self): + 'Will be called when user resumes a paused file' + + patterns.play('play') + + def onPlayBackSeek(self, iTime, seekOffset): + 'Will be called when user seeks to a time' + + # todo: not working + + xbmc.log('time offset: %d' % iTime, xbmc.LOGDEBUG) + xbmc.log('seek offset: %d' % seekOffset, xbmc.LOGDEBUG) + + if seekOffset > 0: + patterns.play('skipf') + else: + patterns.play('skipr') + + def onPlayBackSeekChapter(self, chapter): + 'Will be called when user performs a chapter seek' + pass + + def onPlayBackSpeedChanged(self, speed): + 'Will be called when players speed changes. (eg. user FF/RW)' + + xbmc.log('seek speed: %d' % speed, xbmc.LOGDEBUG) + + self.speed = speed + + if self.speed != 1: + if self.speed < 0: + patterns.play('rew', True, self.speed_map[self.speed]) + elif self.speed > 0: + patterns.play('ffwd', True, self.speed_map[self.speed]) + else: + patterns.stop() + + def onPlayBackStarted(self): + 'Will be called when Kodi starts playing a file' + + patterns.play('play') + + def onPlayBackStopped(self): + 'Will be called when user stops Kodi playing a file' + + patterns.play('stop') + +class SliceMonitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + + def onScreensaverActivated(self): + 'Will be called when screensaver kicks in' + + patterns.play('sleep') + + def onScreensaverDeactivated(self): + 'Will be called when screensaver goes off' + + patterns.play('wake') + + def onSettingsChanged(self): + 'Will be called when addon settings are changed' + + # meh + +if (__name__ == "__main__"): + patterns = PNGPatternPlayer() + player = SlicePlayer() + monitor = SliceMonitor() + + monitor.waitForAbort() + patterns.play('shutdown', wait=5.0) + + del SliceMonitor + del SlicePlayer + del PNGPatternPlayer diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/ffwd.png b/packages/addons/service/slice/source/resources/media/ledpatterns/ffwd.png new file mode 100644 index 0000000000..5bee66fb5c Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/ffwd.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/pause.png b/packages/addons/service/slice/source/resources/media/ledpatterns/pause.png new file mode 100644 index 0000000000..60a480f104 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/pause.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/play.png b/packages/addons/service/slice/source/resources/media/ledpatterns/play.png new file mode 100644 index 0000000000..ae89019328 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/play.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/quit.png b/packages/addons/service/slice/source/resources/media/ledpatterns/quit.png new file mode 100644 index 0000000000..667ada77e6 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/quit.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/rew.png b/packages/addons/service/slice/source/resources/media/ledpatterns/rew.png new file mode 100644 index 0000000000..0420bee290 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/rew.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/shutdown.png b/packages/addons/service/slice/source/resources/media/ledpatterns/shutdown.png new file mode 100644 index 0000000000..d4fde7ee7b Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/shutdown.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/skipf.png b/packages/addons/service/slice/source/resources/media/ledpatterns/skipf.png new file mode 100644 index 0000000000..2018e325eb Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/skipf.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/skipr.png b/packages/addons/service/slice/source/resources/media/ledpatterns/skipr.png new file mode 100644 index 0000000000..9292082b82 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/skipr.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/sleep.png b/packages/addons/service/slice/source/resources/media/ledpatterns/sleep.png new file mode 100644 index 0000000000..d4a6af639d Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/sleep.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/startup.png b/packages/addons/service/slice/source/resources/media/ledpatterns/startup.png new file mode 100644 index 0000000000..282954b4a8 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/startup.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/stop.png b/packages/addons/service/slice/source/resources/media/ledpatterns/stop.png new file mode 100644 index 0000000000..e02589b813 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/stop.png differ diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/wake.png b/packages/addons/service/slice/source/resources/media/ledpatterns/wake.png new file mode 100644 index 0000000000..31944073b0 Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/wake.png differ diff --git a/packages/addons/service/snapclient/changelog.txt b/packages/addons/service/snapclient/changelog.txt new file mode 100644 index 0000000000..cefa2a9d7b --- /dev/null +++ b/packages/addons/service/snapclient/changelog.txt @@ -0,0 +1,11 @@ +102 +- Update to 0.15.0 +- Add alsa-plugins + +101 +- Always restart service +- Improve latency setting +- Keep daemon state + +100 +- Initial addon diff --git a/packages/addons/service/snapclient/icon/icon.png b/packages/addons/service/snapclient/icon/icon.png new file mode 100644 index 0000000000..b764a02395 Binary files /dev/null and b/packages/addons/service/snapclient/icon/icon.png differ diff --git a/packages/addons/service/snapclient/package.mk b/packages/addons/service/snapclient/package.mk new file mode 100644 index 0000000000..1ad68034b0 --- /dev/null +++ b/packages/addons/service/snapclient/package.mk @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="snapclient" +PKG_VERSION="0.15.0" +PKG_REV="102" +PKG_ARCH="any" +PKG_LICENSE="GPLv3" +PKG_DEPENDS_TARGET="toolchain alsa-plugins snapcast" +PKG_SECTION="service" +PKG_SHORTDESC="Snapclient: Synchronous multi-room audio client" +PKG_LONGDESC="Snapclient ($PKG_VERSION) is a Snapcast client. Snapcast is a multi-room client-server audio system, where all clients are time synchronized with the server to play perfectly synced audioplays." +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Snapclient" +PKG_ADDON_TYPE="xbmc.service.library" +PKG_MAINTAINER="Anton Voyl (awiouy)" + +addon() { + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/bin" + cp "$(get_build_dir snapcast)/client/snapclient" \ + "$ADDON_BUILD/$PKG_ADDON_ID/bin" + + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/lib" + cp "$(get_build_dir alsa-plugins)/.install_pkg/usr/lib/alsa"/*.so \ + "$ADDON_BUILD/$PKG_ADDON_ID/lib" +} diff --git a/packages/addons/service/snapclient/source/addon.py b/packages/addons/service/snapclient/source/addon.py new file mode 100644 index 0000000000..63d32436d4 --- /dev/null +++ b/packages/addons/service/snapclient/source/addon.py @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import os.path +import subprocess +import xbmcaddon +import xbmcgui + +SNAPCLIENT = os.path.join( + xbmcaddon.Addon().getAddonInfo('path'), 'bin', 'snapclient') + +card = '' +cards = [] +lines = subprocess.check_output([SNAPCLIENT, '--list']).splitlines() + +for line in lines: + if line != '': + card = card + ' ' + line + else: + cards.append(card) + card = '' + +dialog = xbmcgui.Dialog() +dialog.select(xbmcaddon.Addon().getLocalizedString(30015), cards) +del dialog diff --git a/packages/addons/service/snapclient/source/bin/snapclient.start b/packages/addons/service/snapclient/source/bin/snapclient.start new file mode 100644 index 0000000000..6b8189135a --- /dev/null +++ b/packages/addons/service/snapclient/source/bin/snapclient.start @@ -0,0 +1,39 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.snapclient + +. /etc/os-release +case "$LIBREELEC_ARCH" in + RPi*.arm) + if [ "$sc_a" == "true" ]; then + ALSA="/proc/asound/ALSA" + if [ ! -e "$ALSA" ]; then + echo "Starting Raspberry Pi onboard audio" + dtparam audio=on + sleep 1 + fi + if [ -e "$ALSA" ]; then + echo "Setting Raspberry Pi onboard audio playback route" + index="$(readlink $ALSA)" + index="${index##*card}" + amixer -c "$index" cset name="PCM Playback Route" "$sc_r" + fi + fi + ;; +esac + +[ -n "$sc_h" ] && sc_H="--hostID $sc_h" +[ -n "$sc_s" ] && sc_S="--soundcard $sc_s" + +HOME="$ADDON_HOME" \ +nice -n "$sc_n" \ +snapclient \ + $sc_H \ + --latency "$sc_l" \ + --port "$sc_p" \ + $sc_S \ + > /dev/null diff --git a/packages/addons/service/snapclient/source/default.py b/packages/addons/service/snapclient/source/default.py new file mode 100644 index 0000000000..fb245b68a2 --- /dev/null +++ b/packages/addons/service/snapclient/source/default.py @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + + +def systemctl(command): + subprocess.call( + ['systemctl', command, xbmcaddon.Addon().getAddonInfo('id')]) + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.player = Player() + + def onSettingsChanged(self): + self.player.start('restart') + + +class Player(xbmc.Player): + + def __init__(self): + super(Player, self).__init__(self) + self.start('start') + + def onPlayBackEnded(self): + if xbmcaddon.Addon().getSetting('sc_k') == 'true': + xbmc.sleep(500) + if not self.isPlaying(): + systemctl('start') + + def onPlayBackStarted(self): + if xbmcaddon.Addon().getSetting('sc_k') == 'true': + systemctl('stop') + + def onPlayBackStopped(self): + if xbmcaddon.Addon().getSetting('sc_k') == 'true': + systemctl('start') + + def start(self, command): + if xbmcaddon.Addon().getSetting('sc_k') == 'true': + if self.isPlaying(): + systemctl('stop') + else: + systemctl(command) + else: + systemctl(command) + + +if __name__ == '__main__': + Monitor().waitForAbort() diff --git a/packages/addons/service/snapclient/source/resources/language/English/strings.po b/packages/addons/service/snapclient/source/resources/language/English/strings.po new file mode 100644 index 0000000000..12eb6aa994 --- /dev/null +++ b/packages/addons/service/snapclient/source/resources/language/English/strings.po @@ -0,0 +1,70 @@ +# Kodi Media Center language file +# Addon Name: snapclient +# Addon id: service.snapclient +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Snapclient" +msgstr "" + +msgctxt "#30001" +msgid "List sound cards" +msgstr "" + +msgctxt "#30002" +msgid "Sound card" +msgstr "" + +msgctxt "#30003" +msgid "Host ID" +msgstr "" + +msgctxt "#30004" +msgid "Port" +msgstr "" + +msgctxt "#30005" +msgid "Priority" +msgstr "" + +msgctxt "#30006" +msgid "Latency" +msgstr "" + +msgctxt "#30007" +msgid "Kodi" +msgstr "" + +msgctxt "#30008" +msgid "Stop Snapclient when Kodi plays" +msgstr "" + +msgctxt "#30009" +msgid "Rasperry Pi" +msgstr "" + +msgctxt "#30010" +msgid "Manage onboard audio" +msgstr "" + +msgctxt "#30011" +msgid "Onboard audio playback route" +msgstr "" + +msgctxt "#30012" +msgid "Autodetect" +msgstr "" + +msgctxt "#30013" +msgid "Jack" +msgstr "" + +msgctxt "#30014" +msgid "HDMI" +msgstr "" + +msgctxt "#30015" +msgid "Available sound cards" +msgstr "" diff --git a/packages/addons/service/snapclient/source/resources/settings.xml b/packages/addons/service/snapclient/source/resources/settings.xml new file mode 100644 index 0000000000..cac0b3e312 --- /dev/null +++ b/packages/addons/service/snapclient/source/resources/settings.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/snapclient/source/settings-default.xml b/packages/addons/service/snapclient/source/settings-default.xml new file mode 100644 index 0000000000..77fb284747 --- /dev/null +++ b/packages/addons/service/snapclient/source/settings-default.xml @@ -0,0 +1,10 @@ + + false + + false + 0 + -3 + 1704 + 0 + + diff --git a/packages/addons/service/snapclient/source/system.d/service.snapclient.service b/packages/addons/service/snapclient/source/system.d/service.snapclient.service new file mode 100644 index 0000000000..2c40b7db41 --- /dev/null +++ b/packages/addons/service/snapclient/source/system.d/service.snapclient.service @@ -0,0 +1,11 @@ +[Unit] +Description=Snapclient +After=kodi.service network-online.target sound.target +Requires=kodi.service network-online.target sound.target + +[Service] +ExecStart=/bin/sh /storage/.kodi/addons/service.snapclient/bin/snapclient.start +Restart=always + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/snapserver/changelog.txt b/packages/addons/service/snapserver/changelog.txt new file mode 100644 index 0000000000..8981fddc4a --- /dev/null +++ b/packages/addons/service/snapserver/changelog.txt @@ -0,0 +1,10 @@ +102 +- Update to 0.15.0 + +101 +- Add streaming from Kodi +- Keep daemon state +- Rework settings + +100 +- Initial addon diff --git a/packages/addons/service/snapserver/icon/icon.png b/packages/addons/service/snapserver/icon/icon.png new file mode 100644 index 0000000000..6bf0f85a1a Binary files /dev/null and b/packages/addons/service/snapserver/icon/icon.png differ diff --git a/packages/addons/service/snapserver/package.mk b/packages/addons/service/snapserver/package.mk new file mode 100644 index 0000000000..ff4e1bc2af --- /dev/null +++ b/packages/addons/service/snapserver/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="snapserver" +PKG_VERSION="0.15.0" +PKG_REV="102" +PKG_ARCH="any" +PKG_LICENSE="GPLv3" +PKG_DEPENDS_TARGET="toolchain shairport-sync snapcast" +PKG_SECTION="service" +PKG_SHORTDESC="Snapserver: Synchronous multi-room audio server" +PKG_LONGDESC="Snapclient ($PKG_VERSION) is a Snapcast server. Snapcast is a multi-room client-server audio system, where all clients are time synchronized with the server to play perfectly synced audioplays." +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Snapserver" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REQUIRES="service.librespot:0.0.0" +PKG_MAINTAINER="Anton Voyl (awiouy)" + +addon() { + mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID/bin" + cp "$(get_build_dir shairport-sync)/.$TARGET_NAME/shairport-sync" \ + "$(get_build_dir snapcast)/server/snapserver" \ + "$ADDON_BUILD/$PKG_ADDON_ID/bin" +} diff --git a/packages/addons/service/snapserver/source/bin/snapserver.start b/packages/addons/service/snapserver/source/bin/snapserver.start new file mode 100644 index 0000000000..5f6e349d74 --- /dev/null +++ b/packages/addons/service/snapserver/source/bin/snapserver.start @@ -0,0 +1,48 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.snapserver + +config="pulseaudio.conf" +link="/storage/.config/pulse-daemon.conf.d/50-snapserver.conf" +mkdir -p "$(dirname $link)" +ln -sf "$ADDON_HOME/$config" "$link" +if [ ! -e "$ADDON_HOME/$config" ]; then + cp "$ADDON_DIR/config/$config" "$ADDON_HOME" +fi + +file="/tmp/snapkodi" +sink_name="Snapserver" +if [ -z "$(pactl list short | grep $sink_name)" ]; then + pactl load-module module-pipe-sink \ + file="$file" \ + rate=48000 \ + sink_name="$sink_name" \ + sink_properties=device.description="$sink_name" +fi + +case "$ss_st" in + Default) + stream="pipe:///tmp/snapfifo?name=Default" + ;; + Kodi) + stream="pipe://$file?name=Kodi" + ;; + Spotify) + stream="spotify:///librespot?name=Spotify" + ;; + *) + stream="airplay:///shairport-sync?name=AirPlay" + ;; +esac + +HOME="$ADDON_HOME" \ +nice -n "$ss_ni" \ +snapserver \ + --controlPort "$ss_cp" \ + --port "$ss_sp" \ + --stream "$stream" \ + > /dev/null diff --git a/packages/addons/service/snapserver/source/config/pulseaudio.conf b/packages/addons/service/snapserver/source/config/pulseaudio.conf new file mode 100644 index 0000000000..a797abef70 --- /dev/null +++ b/packages/addons/service/snapserver/source/config/pulseaudio.conf @@ -0,0 +1,6 @@ +### Pulseaudio reads this file when it starts-up +### Uncomment or add options if you know what you are doing + +#resample-method = soxr-vhq +#default-sample-format = s16le +#default-sample-rate = 48000 diff --git a/packages/addons/service/snapserver/source/default.py b/packages/addons/service/snapserver/source/default.py new file mode 100644 index 0000000000..bb9a1566e6 --- /dev/null +++ b/packages/addons/service/snapserver/source/default.py @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + + +def systemctl(command): + subprocess.call( + ['systemctl', command, xbmcaddon.Addon().getAddonInfo('id')]) + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + + def onSettingsChanged(self): + systemctl('restart') + + +if __name__ == '__main__': + Monitor().waitForAbort() diff --git a/packages/addons/service/snapserver/source/resources/language/English/strings.po b/packages/addons/service/snapserver/source/resources/language/English/strings.po new file mode 100644 index 0000000000..e05d5b99d3 --- /dev/null +++ b/packages/addons/service/snapserver/source/resources/language/English/strings.po @@ -0,0 +1,26 @@ +# Kodi Media Center language file +# Addon Name: snapserver +# Addon id: service.snapclient +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Server port" +msgstr "" + +msgctxt "#30002" +msgid "Control port" +msgstr "" + +msgctxt "#30003" +msgid "Priority" +msgstr "" + +msgctxt "#30004" +msgid "Stream" +msgstr "" diff --git a/packages/addons/service/snapserver/source/resources/settings.xml b/packages/addons/service/snapserver/source/resources/settings.xml new file mode 100644 index 0000000000..ddf0e292e6 --- /dev/null +++ b/packages/addons/service/snapserver/source/resources/settings.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/addons/service/snapserver/source/settings-default.xml b/packages/addons/service/snapserver/source/settings-default.xml new file mode 100644 index 0000000000..1b70d77906 --- /dev/null +++ b/packages/addons/service/snapserver/source/settings-default.xml @@ -0,0 +1,6 @@ + + 1705 + 0 + 1704 + AirPlay + diff --git a/packages/addons/service/snapserver/source/system.d/service.snapserver.service b/packages/addons/service/snapserver/source/system.d/service.snapserver.service new file mode 100644 index 0000000000..2f83b72754 --- /dev/null +++ b/packages/addons/service/snapserver/source/system.d/service.snapserver.service @@ -0,0 +1,11 @@ +[Unit] +Description=Snapserver +After=kodi.service network-online.target sound.target +Requires=kodi.service network-online.target sound.target + +[Service] +ExecStart=/bin/sh /storage/.kodi/addons/service.snapserver/bin/snapserver.start +Restart=always + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/spotify-connect-web/changelog.txt b/packages/addons/service/spotify-connect-web/changelog.txt deleted file mode 100644 index 0c63aada54..0000000000 --- a/packages/addons/service/spotify-connect-web/changelog.txt +++ /dev/null @@ -1,19 +0,0 @@ -8.0.103 -- Handle PCM specified as a:CARD=c,DEV=d - -8.0.102 -- Add passwordless/mutiuser login - -8.0.101 -- Use mixer card index -- Add instructions to the addon settings -- Add a configuration wizard to assist with ALSA configuration -- Enable setting initial volume -- Activate onboard audio interface if no audio interface is active -- Activate known audio interface if selected but inactive -- Only set the playback route for RPi2 onboard audio interface -- Remove default settings -- Fix the erroneous bit rate setting - -8.0.100 -- Initial addon diff --git a/packages/addons/service/spotify-connect-web/icon/icon.png b/packages/addons/service/spotify-connect-web/icon/icon.png deleted file mode 100644 index 17f274c329..0000000000 Binary files a/packages/addons/service/spotify-connect-web/icon/icon.png and /dev/null differ diff --git a/packages/addons/service/spotify-connect-web/package.mk b/packages/addons/service/spotify-connect-web/package.mk deleted file mode 100644 index ab53d640d4..0000000000 --- a/packages/addons/service/spotify-connect-web/package.mk +++ /dev/null @@ -1,55 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="spotify-connect-web" -PKG_VERSION="0.0.3-alpha" -PKG_REV="103" -PKG_ARCH="arm" -PKG_ADDON_PROJECTS="RPi2 WeTek_Core WeTek_Play" -PKG_LICENSE="prop." -PKG_SITE="https://github.com/Fornoth/spotify-connect-web" -PKG_URL="https://github.com/Fornoth/spotify-connect-web/releases/download/$PKG_VERSION/${PKG_NAME}_$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="spotify-connect-web" -PKG_DEPENDS_TARGET="toolchain avahi" -PKG_SECTION="service" -PKG_SHORTDESC="Spotify Connect Web: play Spotify through LibreELEC" -PKG_LONGDESC="Spotify Connect Web ($PKG_VERSION) plays Spotify through LibreELEC, using a Spotify app as a remote." -PKG_AUTORECONF="no" - -PKG_IS_ADDON="yes" -PKG_ADDON_NAME="Spotify Connect Web" -PKG_ADDON_TYPE="xbmc.service" -PKG_MAINTAINER="Anton Voyl (awiouy)" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - - cp -P $(get_build_dir avahi)/avahi-utils/.libs/avahi-publish \ - $ADDON_BUILD/$PKG_ADDON_ID/bin/ - - cp -PR $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID/ - rm $ADDON_BUILD/$PKG_ADDON_ID/libasound.so.2 -} diff --git a/packages/addons/service/spotify-connect-web/source/bin/spotify-connect-web.start b/packages/addons/service/spotify-connect-web/source/bin/spotify-connect-web.start deleted file mode 100755 index 7b2ee0874e..0000000000 --- a/packages/addons/service/spotify-connect-web/source/bin/spotify-connect-web.start +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. /etc/os-release -. /etc/profile -oe_setup_addon service.spotify-connect-web - -chmod +x "$ADDON_DIR/spotify-connect-web" -mkdir -p "$ADDON_HOME" - -activate_card() { - if [ -e "/proc/asound/$1" ] - then - return - fi - if [ "$LIBREELEC_ARCH" == "RPi2.arm" -a "$1" == "ALSA" ] - then - dtparam audio=on - sleep 1 - else - echo "Do not know how to activate card $1 on $LIBREELEC_ARCH" - exit - fi -} - -if [ ! "$(cat /proc/asound/pcm 2> /dev/null)" ] -then - if [ "$LIBREELEC_ARCH" == "RPi2.arm" ] - then - activate_card "ALSA" - else - echo "Do not how how to activate an audio interface on $LIBREELEC_ARCH" - ko="ko" - fi -fi - -if [ ! -f "$ADDON_HOME/spotify_appkey.key" ] -then - echo "Key not found" - ko="ko" -fi - -if [ ! "$scw_o" ] -then - echo "Playback device not set" - ko="ko" -fi - -if [ "$ko" ] -then - exit -fi - -case "$scw_o" in - - *:CARD=*) - card="${scw_o##*:CARD=}" - card="${card%%,*}" - activate_card "$card" - index="$(readlink /proc/asound/$card)" - index="${index##*card}" - ;; - - hw:*,*) - echo "The hw:d,s specification is unreliable, use device:CARD=card instead" - index="${scw_o##hw:}" - index="${index%%,*}" - card="card$index" - activate_card "$card" - ;; - - *) - echo "Unknown playback device specification $swc_o" - exit - ;; - -esac - -[ "$scw_m" ] && [ "$vol_0" ] && amixer -c "$index" set "$scw_m" "$vol_0%" - -if [ "$LIBREELEC_ARCH" == "RPi2.arm" -a \ - "$(readlink /proc/asound/ALSA)" == "card$index" ] -then - [ "$pcm_3" ] && amixer -c "$index" cset name="PCM Playback Route" "$pcm_3" -fi - -avahi-publish -s \ -TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf & - -[ "$scw_b" == "-" ] && scw_b="" -[ "$scw_b" ] && scw_b="-b $scw_b" -[ "$scw_m" ] && scw_m="-m $scw_m" -[ "$scw_p" ] && [ "$scw_u" ] && scw_p="-p $scw_p" && scw_u="-u $scw_u" - -cd "$ADDON_DIR" -./spotify-connect-web $scw_b \ - -c "$ADDON_HOME/credentials.json" \ - -k "$ADDON_HOME/spotify_appkey.key" \ - $scw_m \ - -n "$HOSTNAME" \ - -o "$scw_o" \ - $scw_p \ - $scw_u \ - --mixer_device_index "$index" diff --git a/packages/addons/service/spotify-connect-web/source/default.py b/packages/addons/service/spotify-connect-web/source/default.py deleted file mode 100644 index 3999a0eb31..0000000000 --- a/packages/addons/service/spotify-connect-web/source/default.py +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -import subprocess -import xbmc -import xbmcaddon - - -class Monitor(xbmc.Monitor): - - def __init__(self, *args, **kwargs): - xbmc.Monitor.__init__(self) - self.id = xbmcaddon.Addon().getAddonInfo('id') - - def onSettingsChanged(self): - subprocess.call(['systemctl', 'restart', self.id]) - - -if __name__ == "__main__": - Monitor().waitForAbort() diff --git a/packages/addons/service/spotify-connect-web/source/resources/language/English/strings.po b/packages/addons/service/spotify-connect-web/source/resources/language/English/strings.po deleted file mode 100644 index 386318d4e6..0000000000 --- a/packages/addons/service/spotify-connect-web/source/resources/language/English/strings.po +++ /dev/null @@ -1,116 +0,0 @@ -# Kodi Media Center language file -# Addon Name: spotify-connect-web -msgid "" -msgstr "" - -msgctxt "#30100" -msgid "Configuration" -msgstr "" - -msgctxt "#30101" -msgid "Spotify" -msgstr "" - -msgctxt "#30102" -msgid "Username (optional)" -msgstr "" - -msgctxt "#30103" -msgid "Password" -msgstr "" - -msgctxt "#30104" -msgid "Bit rate" -msgstr "" - -msgctxt "#30105" -msgid "-" -msgstr "" - -msgctxt "#30106" -msgid "90" -msgstr "" - -msgctxt "#30107" -msgid "160" -msgstr "" - -msgctxt "#30108" -msgid "320" -msgstr "" - -msgctxt "#30109" -msgid "ALSA" -msgstr "" - -msgctxt "#30110" -msgid "Configuration wizard" -msgstr "" - -msgctxt "#30111" -msgid "Playback device" -msgstr "" - -msgctxt "#30112" -msgid "Mixer" -msgstr "" - -msgctxt "#30113" -msgid "Initial volume" -msgstr "" - -msgctxt "#30114" -msgid "Playback route" -msgstr "" - -msgctxt "#30115" -msgid "auto detect" -msgstr "" - -msgctxt "#30116" -msgid "headphone jack" -msgstr "" - -msgctxt "#30117" -msgid "HDMI" -msgstr "" - -msgctxt "#30200" -msgid "Instructions" -msgstr "" - -msgctxt "#30201" -msgid "1. Copy your spofify_appkey.key the addon's home folder" -msgstr "" - -msgctxt "#30202" -msgid "2. Optionally enter your Spotify username and password" -msgstr "" - -msgctxt "#30203" -msgid "3. Configure ALSA with the wizard" -msgstr "" - -msgctxt "#30204" -msgid "4. Save the settings" -msgstr "" - -msgctxt "#30205" -msgid "5. Check the service with the web interface at port 4000" -msgstr "" - -msgctxt "#30206" -msgid "6. Play Spotify through the service, using a Spotify app as a remote" -msgstr "" - -msgctxt "#30207" -msgid "7. Enjoy!" -msgstr "" - -msgctxt "#30210" -msgid "No playback device" -msgstr "" - -msgctxt "#30211" -msgid "Could not find a playback device" -msgstr "" diff --git a/packages/addons/service/spotify-connect-web/source/resources/settings.xml b/packages/addons/service/spotify-connect-web/source/resources/settings.xml deleted file mode 100644 index 88496b4cb8..0000000000 --- a/packages/addons/service/spotify-connect-web/source/resources/settings.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/addons/service/spotify-connect-web/source/system.d/service.spotify-connect-web.service b/packages/addons/service/spotify-connect-web/source/system.d/service.spotify-connect-web.service deleted file mode 100644 index 91523d0a78..0000000000 --- a/packages/addons/service/spotify-connect-web/source/system.d/service.spotify-connect-web.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=spotify-connect-web -After=network-online.target -Requires=network-online.target - -[Service] -ExecStart=/bin/sh /storage/.kodi/addons/service.spotify-connect-web/bin/spotify-connect-web.start -Restart=on-failure - -[Install] -WantedBy=kodi.target diff --git a/packages/addons/service/spotify-connect-web/source/wizard.py b/packages/addons/service/spotify-connect-web/source/wizard.py deleted file mode 100644 index be4455dc60..0000000000 --- a/packages/addons/service/spotify-connect-web/source/wizard.py +++ /dev/null @@ -1,53 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -import alsaaudio as alsa -import xbmcaddon -import xbmcgui - -if __name__ == "__main__": - - addon = xbmcaddon.Addon("service.spotify-connect-web") - dialog = xbmcgui.Dialog() - strings = addon.getLocalizedString - - while True: - pcms = alsa.pcms()[1:] - if len(pcms) == 0: - dialog.ok(strings(30210), strings(30211)) - break - pcmx = dialog.select(strings(30111), pcms) - if pcmx == -1: - break - pcm = pcms[pcmx] - pair = pcm.split(":CARD=") - device = pair[0] - card = pair[1].split(",")[0] - cardx = alsa.cards().index(card) - mixers = [mixer for mixer in alsa.mixers(cardindex=cardx, device=device) - if 'Playback Volume' in alsa.Mixer(control=mixer, cardindex=cardx).volumecap()] - if len(mixers) == 0: - mixer = "" - else: - mixerx = dialog.select(strings(30112), mixers) - if mixerx == -1: - continue - mixer = mixers[mixerx] - addon.setSetting("scw_m", mixer) - addon.setSetting("scw_o", pcm) - break diff --git a/packages/addons/service/syncthing/changelog.txt b/packages/addons/service/syncthing/changelog.txt index 52374080d1..d89a472fc9 100644 --- a/packages/addons/service/syncthing/changelog.txt +++ b/packages/addons/service/syncthing/changelog.txt @@ -1,11 +1,20 @@ -8.0.103 -- Update to version 0.14.3 +107 +- Update to 1.0.0 -8.0.102 +106 +- Update to 0.14.49 + +105 +- Update to 0.14.29 + +103 +- Update to 0.14.3 + +102 - Enable automatic upgrades -8.0.101 -- Update to version 0.12.24 +101 +- Update to 0.12.24 -8.0.100 +100 - Initial addon diff --git a/packages/addons/service/syncthing/package.mk b/packages/addons/service/syncthing/package.mk index 04c39490d4..a1c41af22a 100644 --- a/packages/addons/service/syncthing/package.mk +++ b/packages/addons/service/syncthing/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="syncthing" -PKG_VERSION="0.14.3" -PKG_REV="103" +PKG_VERSION="1.0.0" +PKG_SHA256="737161bc87c1f414c142d95e04102de2bbdc8b0bfff908a114898305956a16c1" +PKG_REV="107" PKG_ARCH="any" PKG_LICENSE="MPLv2" PKG_SITE="https://syncthing.net/" @@ -27,7 +13,7 @@ PKG_DEPENDS_TARGET="toolchain go:host" PKG_SECTION="service/system" PKG_SHORTDESC="Syncthing: open source continuous file synchronization" PKG_LONGDESC="Syncthing ($PKG_VERSION) replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet." -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Syncthing" @@ -35,11 +21,19 @@ PKG_ADDON_TYPE="xbmc.service" PKG_MAINTAINER="Anton Voyl (awiouy)" configure_target() { - go run build.go assets + export GOLANG=$TOOLCHAIN/lib/golang/bin/go - mkdir -p $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/src/github.com/syncthing - ln -fs $ROOT/$PKG_BUILD $ROOT/$PKG_BUILD/src/github.com/syncthing/syncthing - ln -fs $ROOT/$PKG_BUILD/vendor $ROOT/$PKG_BUILD/vendor/src + cd $PKG_BUILD + $GOLANG generate -v ./lib/auto ./cmd/strelaypoolsrv/auto + + export GOOS=linux + export CGO_ENABLED=1 + export CGO_NO_EMULATION=1 + export CGO_CFLAGS=$CFLAGS + export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld $CC -X main.Version=v$PKG_VERSION" + export GOPATH=$PKG_BUILD:$PKG_BUILD/Godeps/_workspace + export GOROOT=$TOOLCHAIN/lib/golang + export PATH=$PATH:$GOROOT/bin case $TARGET_ARCH in x86_64) @@ -54,35 +48,23 @@ configure_target() { arm1176jzf-s) export GOARM=6 ;; - cortex-a7|cortex-a9) + *) export GOARM=7 ;; esac ;; esac - - export GOOS=linux - export CGO_ENABLED=1 - export CGO_NO_EMULATION=1 - export CGO_CFLAGS=$CFLAGS - export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld $CC -X main.Version=v$PKG_VERSION" - export GOLANG=$ROOT/$TOOLCHAIN/lib/golang/bin/go - export GOPATH=$ROOT/$PKG_BUILD/src/github.com/syncthing/syncthing:$ROOT/$PKG_BUILD/vendor:$ROOT/$PKG_BUILD/Godeps/_workspace - export GOROOT=$ROOT/$TOOLCHAIN/lib/golang - export PATH=$PATH:$GOROOT/bin } make_target() { - cd $ROOT/$PKG_BUILD/src/github.com/syncthing/syncthing - mkdir -p bin + mkdir -p $PKG_BUILD/src/github.com/syncthing + ln -sf $PKG_BUILD $PKG_BUILD/src/github.com/syncthing/syncthing + cd $PKG_BUILD/src/github.com/syncthing/syncthing + mkdir bin $GOLANG build -v -o bin/syncthing -a -ldflags "$LDFLAGS" ./cmd/syncthing } -makeinstall_target() { - : -} - addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $ROOT/$PKG_BUILD/bin/syncthing $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/bin/syncthing $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/service/syncthing/source/bin/syncthing-service b/packages/addons/service/syncthing/source/bin/syncthing-service index 45812d867e..934d1bfb03 100644 --- a/packages/addons/service/syncthing/source/bin/syncthing-service +++ b/packages/addons/service/syncthing/source/bin/syncthing-service @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile oe_setup_addon service.system.syncthing diff --git a/packages/addons/service/syncthing/source/default.py b/packages/addons/service/syncthing/source/default.py index 3999a0eb31..252cf5c277 100644 --- a/packages/addons/service/syncthing/source/default.py +++ b/packages/addons/service/syncthing/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/syncthing/source/settings-default.xml b/packages/addons/service/syncthing/source/settings-default.xml index c36bbd0391..801f97f524 100644 --- a/packages/addons/service/syncthing/source/settings-default.xml +++ b/packages/addons/service/syncthing/source/settings-default.xml @@ -1,3 +1,3 @@ - - + + 0.0.0.0:8384 diff --git a/packages/addons/service/tigervnc/changelog.txt b/packages/addons/service/tigervnc/changelog.txt index ffbebe8438..0c96fcb001 100644 --- a/packages/addons/service/tigervnc/changelog.txt +++ b/packages/addons/service/tigervnc/changelog.txt @@ -1,2 +1,11 @@ +103 +- Update to 1.9.0 + +102 +- Update to 1.8.0 + +101 +- update to 1.7.1 + 100 - Initial addon diff --git a/packages/addons/service/tigervnc/package.mk b/packages/addons/service/tigervnc/package.mk index 1e9fc78abf..9eeb9fff93 100644 --- a/packages/addons/service/tigervnc/package.mk +++ b/packages/addons/service/tigervnc/package.mk @@ -1,38 +1,24 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tigervnc" -PKG_VERSION="1.7.0" -PKG_REV="100" +PKG_VERSION="1.9.0" +PKG_SHA256="f15ced8500ec56356c3bf271f52e58ed83729118361c7103eab64a618441f740" +PKG_REV="104" PKG_ARCH="x86_64" PKG_LICENSE="GPLv2" PKG_SITE="http://www.tigervnc.org" PKG_URL="https://github.com/TigerVNC/tigervnc/archive/v$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain cmake:host libX11 libXext libXtst zlib libjpeg-turbo" +PKG_DEPENDS_TARGET="toolchain cmake:host libX11 libXdamage libXext libXtst zlib libjpeg-turbo" PKG_SECTION="service" +PKG_SHORTDESC="$PKG_ADDON_NAME server" +PKG_LONGDESC="$PKG_ADDON_NAME ($PKG_VERSION) is a high-performance, platform-neutral implementation of Virtual Network Computing, a client/server application that allows users to launch and interact with graphical applications on remote machines" PKG_IS_ADDON="yes" PKG_ADDON_NAME="TigerVNC" PKG_ADDON_TYPE="xbmc.service" -PKG_SHORTDESC="$PKG_ADDON_NAME server" -PKG_LONGDESC="$PKG_ADDON_NAME ($PKG_VERSION) is a high-performance, platform-neutral implementation of Virtual Network Computing, a client/server application that allows users to launch and interact with graphical applications on remote machines" -PKG_CMAKE_OPTS_TARGET="-DBUILD_VIEWER=off" +PKG_CMAKE_OPTS_TARGET="-DBUILD_VIEWER=off -Wno-dev" makeinstall_target() { : # nothing to do diff --git a/packages/addons/service/tigervnc/patches/tigervnc-system-notests.patch b/packages/addons/service/tigervnc/patches/tigervnc-system-notests.patch new file mode 100644 index 0000000000..c1237a4bf5 --- /dev/null +++ b/packages/addons/service/tigervnc/patches/tigervnc-system-notests.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt 2017-06-12 12:08:55.347685243 +0000 ++++ b/CMakeLists.txt 2017-06-12 12:09:01.337595834 +0000 +@@ -300,7 +300,6 @@ + add_subdirectory(media) + endif() + +-add_subdirectory(tests) + + + include(cmake/BuildPackages.cmake) diff --git a/packages/addons/service/tigervnc/source/bin/tigervnc.start b/packages/addons/service/tigervnc/source/bin/tigervnc.start index 624699d1e8..e2a0d4b863 100644 --- a/packages/addons/service/tigervnc/source/bin/tigervnc.start +++ b/packages/addons/service/tigervnc/source/bin/tigervnc.start @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile oe_setup_addon service.tigervnc diff --git a/packages/addons/service/tigervnc/source/default.py b/packages/addons/service/tigervnc/source/default.py index 3999a0eb31..252cf5c277 100644 --- a/packages/addons/service/tigervnc/source/default.py +++ b/packages/addons/service/tigervnc/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/tinc/changelog.txt b/packages/addons/service/tinc/changelog.txt old mode 100755 new mode 100644 index 954056c4fe..1a2dae7e7b --- a/packages/addons/service/tinc/changelog.txt +++ b/packages/addons/service/tinc/changelog.txt @@ -1,5 +1,20 @@ -8.0.101 -- Bump to tinc-1.1pre14 +105 +- Update to 1.1pre17 -8.0.100 +104 +- Update to 1.1pre16 +- Build with ncurses and readline +- Update miniupnpc to 2.1 + +103 +- Update to tinc-1.1pre15 +- Rework + +102 +- Enable clean building + +101 +- Update to tinc-1.1pre14 + +100 - Initial addon diff --git a/packages/addons/service/tinc/package.mk b/packages/addons/service/tinc/package.mk index 78257b6f14..af613dcdea 100644 --- a/packages/addons/service/tinc/package.mk +++ b/packages/addons/service/tinc/package.mk @@ -1,56 +1,37 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tinc" -PKG_VERSION="1.1pre14" -PKG_REV="101" +PKG_VERSION="1.1pre17" +PKG_SHA256="4c3107381f6998a62c6f0e32eb2101707f32d1cf0d9e29d9d380faa906ed64e0" +PKG_REV="105" PKG_ARCH="any" PKG_LICENSE="GPLv2" PKG_SITE="http://www.tinc-vpn.org/" -PKG_URL="${PKG_SITE}/packages/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libressl lzo zlib" +PKG_URL="https://github.com/gsliepen/tinc/archive/release-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain lzo miniupnpc ncurses openssl readline zlib" PKG_SECTION="service/system" PKG_SHORTDESC="tinc: a Virtual Private Network daemon" PKG_LONGDESC="tinc ($PKG_VERSION) is a Virtual Private Network (VPN) daemon that uses tunnelling and encryption to create a secure private network between hosts on the Internet. Because the VPN appears to the IP level network code as a normal network device, there is no need to adapt any existing software. This allows VPN sites to share information with each other over the Internet without exposing any information to others." -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" PKG_IS_ADDON="yes" PKG_ADDON_NAME="tinc" PKG_ADDON_TYPE="xbmc.service" PKG_MAINTAINER="Anton Voyl (awiouy)" -PKG_CONFIGURE_OPTS_TARGET="--disable-curses \ - --disable-readline \ - --sysconfdir=/storage/.cache" +PKG_CONFIGURE_OPTS_TARGET="--enable-miniupnpc \ + --sysconfdir=/run" +PKG_MAKE_OPTS_TARGET="SUBDIRS=src" +PKG_MAKEINSTALL_OPTS_TARGET="SUBDIRS=src" -pre_configure_target() { - # tinc fails to build in subdirs - cd $ROOT/$PKG_BUILD - rm -rf .$TARGET_NAME -} - -makeinstall_target() { +make_target() { : } addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp $PKG_BUILD/src/tinc \ - $PKG_BUILD/src/tincd \ + cp $PKG_BUILD/.install_pkg/usr/sbin/* \ $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/service/tinc/source/bin/subnet-up b/packages/addons/service/tinc/source/bin/subnet-up deleted file mode 100755 index 1a5cbdf504..0000000000 --- a/packages/addons/service/tinc/source/bin/subnet-up +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -. /etc/profile -oe_setup_addon service.system.tinc - -case "$SUBNET" in - ??:??:??:??:??:??) - : - ;; - *) - if [ "$NAME" == "$NODE" ] - then - ip addr replace "$SUBNET/$tinc_mask" dev "$INTERFACE" - elif [ "$tinc_mask" == "32" ] - then - ip route replace "$SUBNET" dev "$INTERFACE" - fi - ;; -esac diff --git a/packages/addons/service/tinc/source/bin/tinc-service b/packages/addons/service/tinc/source/bin/tinc-service deleted file mode 100644 index 0901a54331..0000000000 --- a/packages/addons/service/tinc/source/bin/tinc-service +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. /etc/profile -oe_setup_addon service.system.tinc - -config="$ADDON_HOME/.config" -dev="vmnetz" -host="$ADDON_HOME/Host" -hosts="$ADDON_HOME/Hosts" - -rm -rf "$host" -rm -f "$hosts" - -if [ -z "$tinc_name" ] -then - rm -rf "$config" - exit 0 -fi - -read_name="$(tinc -c $config get name)" - -if [ "$read_name" != "$tinc_name" ] -then - rm -rf "$config" - tinc -c "$config" init "$tinc_name" -fi - -mkdir -p "$host" -ln -s "$config/hosts/$tinc_name" "$host/$tinc_name" -ln -nsf "$config/hosts" "$hosts" - -for var in address port subnet -do - eval "tinc_var=\$tinc_$var" - if [ -z "$tinc_var" ] - then - tinc -c "$config" del "$var" - else - tinc -c "$config" set "$var" "$tinc_var" - fi -done - -cp "$ADDON_DIR/bin/subnet-up" \ - "$ADDON_DIR/bin/tinc-up" \ - "$config" - -case "$tinc_subnets" in - "default") - subnets="" - ;; - "strict subnets") - subnets="-o StrictSubnets=yes" - ;; - "tunnel server") - subnets="-o TunnelServer=yes" - ;; -esac - -tincd -c "$config" \ - -n "$dev" \ - -o AutoConnect=yes \ - -o LocalDiscovery=yes \ - -o mode="$tinc_mode" \ - $subnets diff --git a/packages/addons/service/tinc/source/bin/tinc.start b/packages/addons/service/tinc/source/bin/tinc.start new file mode 100644 index 0000000000..004da34d09 --- /dev/null +++ b/packages/addons/service/tinc/source/bin/tinc.start @@ -0,0 +1,69 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.system.tinc + +DIR_LEGACY="$ADDON_HOME/.config" +if [ -d "$DIR_LEGACY" ]; then + echo "Warning: using legacy configuration $DIR_LEGACY, ignoring Kodi settings" + tincd --config "$DIR_LEGACY" --no-detach + exit $? +fi + +[ -z "$tinc_loglevel" ] && tinc_loglevel="3" + +NET="vmnet_le" +NAME="${tinc_subnet//./_}" +CONF_KEYS="/storage/.cache/tinc.$NET" +CONF_TINC="/run/tinc/$NET" +DATA_LOCAL="$ADDON_HOME/Local" +DATA_REMOTES="$ADDON_HOME/Remotes" + +rm -fr "$CONF_TINC" "$DATA_LOCAL" &> /dev/null + +if [ ! -d "$CONF_KEYS" ]; then + rm -fr "$CONF_KEYS" &> /dev/null + mkdir -p "$CONF_KEYS" + tinc --batch --config "$CONF_KEYS" generate-ed25519-keys +fi + +if [ ! -d "$DATA_REMOTES" ]; then + rm -fr "$DATA_REMOTES" &> /dev/null + mkdir -p "$DATA_REMOTES" +fi + +if [ "$tinc_subnet" == "0.0.0.0" ]; then + echo "Warning: default subnet $tinc_subnet, aborting" + exit +fi + +if [ -e "$DATA_REMOTES/$NAME" ]; then + echo "Error: $NAME in $DATA_REMOTES, aborting" + exit +fi + +mkdir -p "$CONF_TINC" +cp -RT "$ADDON_DIR/config" "$CONF_TINC" +chmod +x "$CONF_TINC"/*-* +ln -sf "$DATA_REMOTES" "$CONF_TINC/hosts" +tee >> "$CONF_TINC/tinc.conf" << EOF +Ed25519PrivateKeyFile = $CONF_KEYS/ed25519_key.priv +LogLevel = $tinc_loglevel +Name = $NAME +EOF + +mkdir -p "$DATA_LOCAL" +if [ -n "$tinc_address" ]; then + echo "Address = $tinc_address" >> "$DATA_LOCAL/$NAME" +fi +cat "$CONF_KEYS/ed25519_key.pub" >> "$DATA_LOCAL/$NAME" + +tee -a "$CONF_TINC/tinc.conf" >> "$DATA_LOCAL/$NAME" << EOF +Port = $tinc_port +Subnet = $tinc_subnet +EOF + +tincd --net "$NET" --no-detach diff --git a/packages/addons/service/tinc/source/config/subnet-down b/packages/addons/service/tinc/source/config/subnet-down new file mode 100644 index 0000000000..9e74fb5cc8 --- /dev/null +++ b/packages/addons/service/tinc/source/config/subnet-down @@ -0,0 +1,4 @@ +#!/bin/sh +if [ "$NAME" != "$NODE" ]; then + ip route del "$SUBNET" dev "$INTERFACE" +fi diff --git a/packages/addons/service/tinc/source/config/subnet-up b/packages/addons/service/tinc/source/config/subnet-up new file mode 100644 index 0000000000..d22cd48c8f --- /dev/null +++ b/packages/addons/service/tinc/source/config/subnet-up @@ -0,0 +1,6 @@ +#!/bin/sh +if [ "$NAME" == "$NODE" ]; then + ip addr replace "$SUBNET" dev "$INTERFACE" +else + ip route replace "$SUBNET" dev "$INTERFACE" +fi diff --git a/packages/addons/service/tinc/source/bin/tinc-up b/packages/addons/service/tinc/source/config/tinc-up old mode 100755 new mode 100644 similarity index 100% rename from packages/addons/service/tinc/source/bin/tinc-up rename to packages/addons/service/tinc/source/config/tinc-up diff --git a/packages/addons/service/tinc/source/config/tinc.conf b/packages/addons/service/tinc/source/config/tinc.conf new file mode 100644 index 0000000000..8558d3fee4 --- /dev/null +++ b/packages/addons/service/tinc/source/config/tinc.conf @@ -0,0 +1,6 @@ +AutoConnect = yes +ExperimentalProtocol = yes +LocalDiscovery = yes +Mode = Router +TunnelServer = yes +UPnP = yes diff --git a/packages/addons/service/tinc/source/default.py b/packages/addons/service/tinc/source/default.py index c7cb3a4f32..289223c796 100644 --- a/packages/addons/service/tinc/source/default.py +++ b/packages/addons/service/tinc/source/default.py @@ -1,88 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ -import os.path -import random -import socket -import struct +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + import subprocess -import urllib2 import xbmc import xbmcaddon -ADDON = xbmcaddon.Addon() -ID = ADDON.getAddonInfo('id') -PATH = ADDON.getAddonInfo('path') -TINC = os.path.join(PATH, 'bin', 'tinc') - -def run_code(cmd, *argv): - return subprocess.call(cmd.format(*argv).split()) - -def run_lines(cmd, *argv): - try: - return subprocess.check_output(cmd.format(*argv).split()).splitlines() - except subprocess.CalledProcessError: - return [] - - class Monitor(xbmc.Monitor): - def __init__(self, *args, **kwargs): - xbmc.Monitor.__init__(self) + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') - def onSettingsChanged(self): - run_code('systemctl restart {}'.format(ID)) + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) if __name__ == '__main__': - for network in run_lines('{} network', TINC): - run_code('{} -n {} start', TINC, network) - - if ADDON.getSetting('tinc_wizard') == 'true': - try: - ip = urllib2.urlopen('http://ip.42.pl/raw').read() - address = socket.gethostbyaddr(ip)[0] - ADDON.setSetting('tinc_address', address) - except: - pass - - network, mask = '10.0.0.0/8'.split('/') - mask = 2 ** (32 - int(mask)) - 1 - network = struct.unpack('!L', socket.inet_aton(network))[0] & -mask - ip = network + random.randint(1, mask - 1) - name = format(ip, '08x') - subnet = socket.inet_ntoa(struct.pack('!L', ip)) - ADDON.setSetting('tinc_name', name) - ADDON.setSetting('tinc_subnet', subnet) - - port = int(ADDON.getSetting('tinc_port')) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.bind(('', port)) - s.close() - except socket.error: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.bind(('', 0)) - a, port = s.getsockname() - s.close() - ADDON.setSetting('tinc_port', str(port)) - - ADDON.setSetting('tinc_wizard', 'false') - run_code('systemctl restart {}'.format(ID)) - - Monitor().waitForAbort() + Monitor().waitForAbort() diff --git a/packages/addons/service/tinc/source/resources/language/English/strings.po b/packages/addons/service/tinc/source/resources/language/English/strings.po index 82efcf4fdf..e2766add8e 100644 --- a/packages/addons/service/tinc/source/resources/language/English/strings.po +++ b/packages/addons/service/tinc/source/resources/language/English/strings.po @@ -1,70 +1,30 @@ # Kodi Media Center language file # Addon Name: tinc # Addon id: service.system.tinc -# Addon Provider: awiouy at gmail dot com +# Addon Provider: Team LibreELEC msgid "" msgstr "" msgctxt "#30000" -msgid "Configuration" +msgid "Host" msgstr "" msgctxt "#30001" -msgid "Virtual Private Network" +msgid "Subnet (private IP address)" msgstr "" msgctxt "#30002" -msgid "Name" +msgid "Port" msgstr "" msgctxt "#30003" -msgid "Subnet" +msgid "Address (public DNS name)" msgstr "" msgctxt "#30004" -msgid "Mask" +msgid "Debug" msgstr "" msgctxt "#30005" -msgid "Mode" -msgstr "" - -msgctxt "#30006" -msgid "Subnet Discovery" -msgstr "" - -msgctxt "#30007" -msgid "Public Network" -msgstr "" - -msgctxt "#30008" -msgid "Address" -msgstr "" - -msgctxt "#30009" -msgid "Port" -msgstr "" - -msgctxt "#30010" -msgid "Instructions" -msgstr "" - -msgctxt "#30011" -msgid "1. Configure local node (see tinc-vpn.org/documentation-1.1)" -msgstr "" - -msgctxt "#30012" -msgid "2. Enable port forwarding on your router (see e.g. portforward.com)" -msgstr "" - -msgctxt "#30013" -msgid "3. Distribute local host file from userdata/addon_data/service.system.tinc/Host" -msgstr "" - -msgctxt "#30014" -msgid "4. Collect remote host files in userdata/addon_data/service.system.tinc/Hosts" -msgstr "" - -msgctxt "#30015" -msgid "5. Restart tinc to load remote host files" +msgid "LogLevel" msgstr "" diff --git a/packages/addons/service/tinc/source/resources/settings.xml b/packages/addons/service/tinc/source/resources/settings.xml index c9919ea0ac..03693ccb3a 100644 --- a/packages/addons/service/tinc/source/resources/settings.xml +++ b/packages/addons/service/tinc/source/resources/settings.xml @@ -1,24 +1,11 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + diff --git a/packages/addons/service/tinc/source/settings-default.xml b/packages/addons/service/tinc/source/settings-default.xml index 38d2d1c812..1e44397826 100644 --- a/packages/addons/service/tinc/source/settings-default.xml +++ b/packages/addons/service/tinc/source/settings-default.xml @@ -1,11 +1,6 @@ - - - - - - - - - + + + 3 + 6550 + 0.0.0.0 - diff --git a/packages/addons/service/tinc/source/system.d/service.system.tinc.service b/packages/addons/service/tinc/source/system.d/service.system.tinc.service index 59f6f7f125..b250c7edaa 100644 --- a/packages/addons/service/tinc/source/system.d/service.system.tinc.service +++ b/packages/addons/service/tinc/source/system.d/service.system.tinc.service @@ -5,8 +5,7 @@ After=network-online.target Requires=network-online.target [Service] -Type=forking -ExecStart=/bin/sh /storage/.kodi/addons/service.system.tinc/bin/tinc-service +ExecStart=/bin/sh /storage/.kodi/addons/service.system.tinc/bin/tinc.start Restart=on-failure [Install] diff --git a/packages/addons/service/touchscreen/package.mk b/packages/addons/service/touchscreen/package.mk index 4e0fcda253..63fc699163 100644 --- a/packages/addons/service/touchscreen/package.mk +++ b/packages/addons/service/touchscreen/package.mk @@ -1,26 +1,11 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="touchscreen" PKG_VERSION="1.0" -PKG_REV="100" +PKG_REV="101" PKG_ARCH="any" -PKG_ADDON_PROJECTS="Generic RPi RPi2 imx6" +PKG_ADDON_PROJECTS="Generic RPi Amlogic" PKG_LICENSE="GPL" PKG_SITE="" PKG_URL="" @@ -30,28 +15,20 @@ PKG_SHORTDESC="Touchscreen: support addon for Touchscreens" PKG_LONGDESC="Touchscreen: addon creates new virtual input device and \ converts data from touchscreen to Kodi. Short tap sends button press event \ and long tap sends only xy coordinates. Also includes calibration program." -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Touchscreen" PKG_ADDON_TYPE="xbmc.service" -make_target() { - : # only pack everything -} - -makeinstall_target() { - : # only pack everything -} - addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin cp $PKG_DIR/addon.xml $ADDON_BUILD/$PKG_ADDON_ID - # set version (no need to edit xml file on version bump) - $SED -e "s|@ADDON_VERSION@|$ADDON_VERSION.$PKG_REV|g" \ - -i $ADDON_BUILD/$PKG_ADDON_ID/addon.xml + # set only version (revision will be added by buildsystem) + sed -e "s|@ADDON_VERSION@|$ADDON_VERSION|g" \ + -i $ADDON_BUILD/$PKG_ADDON_ID/addon.xml cp $(get_build_dir tslib)/.install_pkg/usr/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin cp $(get_build_dir evtest)/.$TARGET_NAME/evtest $ADDON_BUILD/$PKG_ADDON_ID/bin diff --git a/packages/addons/service/touchscreen/source/bin/ts_calibrate.sh b/packages/addons/service/touchscreen/source/bin/ts_calibrate.sh index 76d4f5851e..cf8aa9a389 100644 --- a/packages/addons/service/touchscreen/source/bin/ts_calibrate.sh +++ b/packages/addons/service/touchscreen/source/bin/ts_calibrate.sh @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile @@ -35,7 +21,15 @@ if [ "$1" = "service" ]; then SETTINGS_XML="$ADDON_HOME/settings.xml" if [ -f "$SETTINGS_XML" ]; then mkdir -p /var/config - cat "$SETTINGS_XML" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/ts_calibration_addon.conf + + # check settings version + XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $SETTINGS_XML)" + if [ "$XML_SETTINGS_VER" = "2" ]; then + xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$SETTINGS_XML" > /var/config/ts_calibration_addon.conf + else + xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$SETTINGS_XML" > /var/config/ts_calibration_addon.conf + fi + . /var/config/ts_calibration_addon.conf if [ "$TS_RECALIBRATE" = "true" ]; then diff --git a/packages/addons/service/touchscreen/source/bin/ts_env.sh b/packages/addons/service/touchscreen/source/bin/ts_env.sh index c5375d3fa9..a34423bb8d 100644 --- a/packages/addons/service/touchscreen/source/bin/ts_env.sh +++ b/packages/addons/service/touchscreen/source/bin/ts_env.sh @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/touchscreen/source/bin/ts_uinput_touch.sh b/packages/addons/service/touchscreen/source/bin/ts_uinput_touch.sh index 9c6e127d28..508a620341 100644 --- a/packages/addons/service/touchscreen/source/bin/ts_uinput_touch.sh +++ b/packages/addons/service/touchscreen/source/bin/ts_uinput_touch.sh @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/touchscreen/source/calibrate.py b/packages/addons/service/touchscreen/source/calibrate.py index c9c302f2cc..23926fecf0 100644 --- a/packages/addons/service/touchscreen/source/calibrate.py +++ b/packages/addons/service/touchscreen/source/calibrate.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import os import socket diff --git a/packages/addons/service/touchscreen/source/config/ts_env.sh-sample b/packages/addons/service/touchscreen/source/config/ts_env.sh-sample index 6d881b5275..6403d83bcd 100644 --- a/packages/addons/service/touchscreen/source/config/ts_env.sh-sample +++ b/packages/addons/service/touchscreen/source/config/ts_env.sh-sample @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # find touchscreen device by name (substring) using evtest program diff --git a/packages/addons/service/touchscreen/source/config/ts_env.sh-waveshare b/packages/addons/service/touchscreen/source/config/ts_env.sh-waveshare index e739da5e96..dc7d051f49 100644 --- a/packages/addons/service/touchscreen/source/config/ts_env.sh-waveshare +++ b/packages/addons/service/touchscreen/source/config/ts_env.sh-waveshare @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # change vid/pid for waveshare touchscreen device PRODUCT_VID=0EEF diff --git a/packages/addons/service/touchscreen/source/lock-screen.py b/packages/addons/service/touchscreen/source/lock-screen.py index 83072a4561..194809b6c4 100644 --- a/packages/addons/service/touchscreen/source/lock-screen.py +++ b/packages/addons/service/touchscreen/source/lock-screen.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmc import xbmcgui diff --git a/packages/addons/service/touchscreen/source/service.py b/packages/addons/service/touchscreen/source/service.py index 1a91d91ede..cd0d51d91f 100644 --- a/packages/addons/service/touchscreen/source/service.py +++ b/packages/addons/service/touchscreen/source/service.py @@ -1,17 +1,2 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/addons/service/tvheadend/changelog.txt b/packages/addons/service/tvheadend/changelog.txt deleted file mode 100644 index 00d5d5449c..0000000000 --- a/packages/addons/service/tvheadend/changelog.txt +++ /dev/null @@ -1,17 +0,0 @@ -8.0.102 -- update tvheadend to 4.0.9-12 -- fixes picons download from Tvh server - -8.0.101 -- update tvheadend to 4.0.9-5 - -8.0.100 -- update for LibreELEC 8.0 - -7.0.101 -- update tvheadend to 4.0.9-4 -- startup logic fix -- added proper icon and description - -7.0.100 -- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/tvheadend/icon/icon.png b/packages/addons/service/tvheadend/icon/icon.png deleted file mode 100644 index 097b78a9ab..0000000000 Binary files a/packages/addons/service/tvheadend/icon/icon.png and /dev/null differ diff --git a/packages/addons/service/tvheadend/package.mk b/packages/addons/service/tvheadend/package.mk index c06b30f7e1..c05a599a34 100644 --- a/packages/addons/service/tvheadend/package.mk +++ b/packages/addons/service/tvheadend/package.mk @@ -1,79 +1,25 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tvheadend" -PKG_VERSION="e5400e2" -PKG_VERSION_NUMBER="4.0.9" -PKG_REV="102" +PKG_VERSION="1.0" +PKG_REV="100" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.tvheadend.org" -PKG_URL="https://github.com/tvheadend/tvheadend/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain curl libdvbcsa libiconv libressl Python:host" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="service.multimedia" -PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux" -PKG_LONGDESC="Tvheadend ($PKG_VERSION_NUMBER): is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV, SAT>IP and ATSC" -PKG_AUTORECONF="no" +PKG_SHORTDESC="Add-on removed" +PKG_LONGDESC="Add-on removed" +PKG_TOOLCHAIN="manual" -PKG_IS_ADDON="yes" -PKG_ADDON_NAME="Tvheadend 4.0" -PKG_ADDON_TYPE="xbmc.service" - -PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ - --arch=$TARGET_ARCH \ - --cpu=$TARGET_CPU \ - --cc=$CC \ - --enable-hdhomerun_client \ - --enable-hdhomerun_static \ - --disable-avahi \ - --disable-libav \ - --enable-inotify \ - --enable-epoll \ - --disable-uriparser \ - --enable-tvhcsa \ - --enable-bundle \ - --enable-dvbcsa \ - --disable-dbus_1 \ - --python=$ROOT/$TOOLCHAIN/bin/python" - -post_unpack() { - sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$PKG_ADDON_REPOVERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version -} - -pre_configure_target() { -# fails to build in subdirs - cd $ROOT/$PKG_BUILD - rm -rf .$TARGET_NAME +PKG_ADDON_BROKEN="Tvheadend 4.0 is no longer maintained and has been superseded by Tvheadend 4.2." - export CROSS_COMPILE=$TARGET_PREFIX - export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/iconv -L$SYSROOT_PREFIX/usr/lib/iconv" -} - -post_make_target() { - $CC -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o capmt_ca.so src/extra/capmt_ca.c -ldl -} - -makeinstall_target() { - : # nothing to do here -} +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Tvheadend Server 4.0" +PKG_ADDON_TYPE="xbmc.broken" addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $PKG_BUILD/build.linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $PKG_BUILD/capmt_ca.so $ADDON_BUILD/$PKG_ADDON_ID/bin + : } diff --git a/packages/addons/service/tvheadend/source/bin/tv_grab_file b/packages/addons/service/tvheadend/source/bin/tv_grab_file deleted file mode 100755 index 027ee869cd..0000000000 --- a/packages/addons/service/tvheadend/source/bin/tv_grab_file +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -if [ $# -lt 1 ] -then - . /etc/profile - - ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.multimedia.tvheadend" - ADDON_SETTINGS="$ADDON_HOME/settings.xml" - XMLTV_TYPE=`grep XMLTV_TYPE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - XMLTV_LOCATION_FILE=`grep XMLTV_LOCATION_FILE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - XMLTV_LOCATION_WEB=`grep XMLTV_LOCATION_WEB $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - XMLTV_LOCATION_SCRIPT=`grep XMLTV_LOCATION_SCRIPT $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - - if [ "$XMLTV_TYPE" = "FILE" ]; then - cat "$XMLTV_LOCATION_FILE" - exit 0 - elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then - if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then - exec "$XMLTV_LOCATION_SCRIPT" - fi - elif [ "$XMLTV_TYPE" = "WEB" ]; then - wget -qO - "$XMLTV_LOCATION_WEB" - exit 0 - fi -fi - -dflag= -vflag= -cflag= - -for a in "$@" -do -[ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 -[ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 -[ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 -done - -if [ -n "$dflag" ] -then -echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" -fi - -if [ -n "$vflag" ] -then -echo "1.0" -fi - -if [ -n "$cflag" ] -then -echo "baseline" -fi diff --git a/packages/addons/service/tvheadend/source/bin/tvheadend.start b/packages/addons/service/tvheadend/source/bin/tvheadend.start deleted file mode 100755 index d36fafa07c..0000000000 --- a/packages/addons/service/tvheadend/source/bin/tvheadend.start +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. /etc/profile - -oe_setup_addon service.multimedia.tvheadend - -ADDON_SETTINGS="$ADDON_HOME/settings.xml" -XMLTV_FILE="$ADDON_DIR/bin/tv_grab_file" -XMLTV_SETTINGS_DIR="$ADDON_HOME/xmltv" -XMLTV_SETTINGS_FILE="$XMLTV_SETTINGS_DIR/config" -DVR_SETTINGS_DIR="$ADDON_HOME/dvr" -DVR_SETTINGS_FILE="$DVR_SETTINGS_DIR/config" -DVR_DIR="$HOME/recordings" -TIMESHIFT_SETTINGS_DIR="$ADDON_HOME/timeshift" -TIMESHIFT_SETTINGS_FILE="$TIMESHIFT_SETTINGS_DIR/config" -TIMESHIFT_DIR="$ADDON_HOME/cache/timeshift" - -chmod a+x $ADDON_DIR/bin/* - -if [ "$WORKAROUND_SLEEP" == "true" ] ; then - sleep $WORKAROUND_SLEEP_TIME -fi - -if [ ! -f "$XMLTV_SETTINGS_FILE" ]; then - mkdir -p $XMLTV_SETTINGS_DIR - if [ -f $ADDON_DIR/xmltv-config ]; then - cp $ADDON_DIR/xmltv-config $XMLTV_SETTINGS_FILE - fi -fi - -if [ ! -f "$DVR_SETTINGS_FILE" ]; then - mkdir -p $DVR_DIR - mkdir -p $DVR_SETTINGS_DIR - if [ -f $ADDON_DIR/dvr-config ]; then - cp $ADDON_DIR/dvr-config $DVR_SETTINGS_FILE - fi -fi - -if [ ! -f "$TIMESHIFT_SETTINGS_FILE" ]; then - mkdir -p $TIMESHIFT_DIR - mkdir -p $TIMESHIFT_SETTINGS_DIR - if [ -f $ADDON_DIR/timeshift-config ]; then - cp $ADDON_DIR/timeshift-config $TIMESHIFT_SETTINGS_FILE - fi -fi - -if [ "$DEBUG" = "yes" ]; then - TVHEADEND_ARG="-B -C -s -u root -g video -c $ADDON_HOME" -else - TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME" -fi - -# start userspace DVB driver/addon -for driver_dvb in $(find /storage/.kodi/addons/driver.dvb.*/bin/userspace-driver.sh -type f 2>/dev/null); do - driver_dvb_name=$(echo $driver_dvb | awk 'BEGIN {FS="/"} {printf("%s", $5)}') - logger -t Tvheadend "### Loading userspace DVB driver: $driver_dvb_name ###" - # use ". " because of variable export - . $driver_dvb -done - -if [ "$WAIT_FOR_FEINIT" == "true" ] ; then - while [ true ] ; do - if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ] ; then - break - fi - sleep 1 - done -fi - -if [ "$PRELOAD_CAPMT_CA" == "true" ] ; then - logger -t Tvheadend "### Preloading capmt_ca.so library ###" - LD_PRELOAD="$ADDON_DIR/bin/capmt_ca.so $LD_PRELOAD" exec $ADDON_DIR/bin/tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE -else - exec $ADDON_DIR/bin/tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE -fi diff --git a/packages/addons/service/tvheadend/source/default.py b/packages/addons/service/tvheadend/source/default.py deleted file mode 100644 index 56d184d880..0000000000 --- a/packages/addons/service/tvheadend/source/default.py +++ /dev/null @@ -1,17 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ diff --git a/packages/addons/service/tvheadend/source/dvr-config b/packages/addons/service/tvheadend/source/dvr-config deleted file mode 100644 index 26b820aaa4..0000000000 --- a/packages/addons/service/tvheadend/source/dvr-config +++ /dev/null @@ -1,15 +0,0 @@ -{ - "storage": "/storage/recordings", - "retention-days": 31, - "pre-extra-time": 0, - "post-extra-time": 0, - "day-dir": 0, - "channel-dir": 0, - "channel-in-title": 0, - "date-in-title": 0, - "time-in-title": 0, - "whitespace-in-title": 0, - "title-dir": 0, - "episode-in-title": 0, - "tag-files": 1 -} diff --git a/packages/addons/service/tvheadend/source/resources/language/English/strings.xml b/packages/addons/service/tvheadend/source/resources/language/English/strings.xml deleted file mode 100644 index cb11c7d0a0..0000000000 --- a/packages/addons/service/tvheadend/source/resources/language/English/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - XMLTV - DVB - XMLTV configuration - XMLTV source type - XMLTV File location - XMLTV Web location - XMLTV Script location - DVB Configuration - Unload DVB mudules before suspend - Wait for frontend initialization - Number of adapters to wait for - Preload capmt_ca.so library - Delay the start of Tvheadend - time (s) - - diff --git a/packages/addons/service/tvheadend/source/resources/settings.xml b/packages/addons/service/tvheadend/source/resources/settings.xml deleted file mode 100644 index 910ac2418f..0000000000 --- a/packages/addons/service/tvheadend/source/resources/settings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/addons/service/tvheadend/source/settings-default.xml b/packages/addons/service/tvheadend/source/settings-default.xml deleted file mode 100644 index 0f47b8e232..0000000000 --- a/packages/addons/service/tvheadend/source/settings-default.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power b/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power deleted file mode 100755 index 50c83aea18..0000000000 --- a/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. /etc/profile - -oe_setup_addon service.multimedia.tvheadend - -SERVICE="service.multimedia.tvheadend" - -case "$1" in - pre) - if systemctl is-active "$SERVICE" &>/dev/null ; then - systemctl stop "$SERVICE" - for module in $REMOVE_MODULES ; do - rmmod $module - done - fi - ;; - post) - if systemctl is-enabled "$SERVICE" &>/dev/null ; then - for module in $REMOVE_MODULES ; do - modprobe $module - done - systemctl start "$SERVICE" - fi - ;; -esac diff --git a/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service b/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service deleted file mode 100644 index 615d46f01a..0000000000 --- a/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=TVHeadend Service -After=network-online.service -Requires=network-online.service - -[Service] -ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.multimedia.tvheadend/bin/tvheadend.start" -TimeoutStopSec=2 -Restart=always -RestartSec=2 -StartLimitInterval=0 - -[Install] -WantedBy=kodi.target diff --git a/packages/addons/service/tvheadend/source/timeshift-config b/packages/addons/service/tvheadend/source/timeshift-config deleted file mode 100644 index ab43e9660c..0000000000 --- a/packages/addons/service/tvheadend/source/timeshift-config +++ /dev/null @@ -1,9 +0,0 @@ -{ - "enabled": 0, - "ondemand": 0, - "path": "/storage/.kodi/userdata/addon_data/service.multimedia.tvheadend/cache/timeshift", - "unlimited_period": 0, - "max_period": 3600, - "unlimited_size": 0, - "max_size": 1024 -} diff --git a/packages/addons/service/tvheadend/source/xmltv-config b/packages/addons/service/tvheadend/source/xmltv-config deleted file mode 100644 index 7da27e36e0..0000000000 --- a/packages/addons/service/tvheadend/source/xmltv-config +++ /dev/null @@ -1,14 +0,0 @@ -{ - "grabbers": [ - { - "path": "/storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file", - "description": "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file", - "version": "0.1\n", - "mtime": 1318774706, - "capabilities": 1 - } - ], - "grab-interval": 12, - "grab-enabled": 1, - "current-grabber": "/storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file" -} diff --git a/packages/addons/service/tvheadend42/addon.xml b/packages/addons/service/tvheadend42/addon.xml new file mode 100644 index 0000000000..a166e9a6b0 --- /dev/null +++ b/packages/addons/service/tvheadend42/addon.xml @@ -0,0 +1,35 @@ + + + + + +@REQUIRES@ + + + @PKG_ADDON_PROVIDES@ + + + @PKG_ADDON_PROVIDES@ + + + @PKG_SHORTDESC@ + +@PKG_LONGDESC@ + + +@PKG_DISCLAIMER@ + + all + +@PKG_ADDON_NEWS@ + + + resources/icon.png + resources/fanart.png +@PKG_ADDON_SCREENSHOT@ + + + diff --git a/packages/addons/service/tvheadend42/changelog.txt b/packages/addons/service/tvheadend42/changelog.txt index 4009d676d7..ceffabb08c 100644 --- a/packages/addons/service/tvheadend42/changelog.txt +++ b/packages/addons/service/tvheadend42/changelog.txt @@ -1,3 +1,46 @@ +118 +- update to 4.2.7-44 +- fix tv_grab_file usage of & in urls + +117 +- update to 4.2.7-34 +- added hint to FRITZ!Box support (not needed anymore since FW 7.0) + +116 +- added comskip +- update to 4.2.6-62 +- fix Tvheadend works now without network too +- fix for AVM IPs were not set correctly + +115 +- update to 4.2.6-7 + +114 +- update to 4.2.5-31 +- addded manual Scan-Table update + +113 +- update to 4.2.4-23 +- full transcoding support + +112 +- update to 4.2.3-20 +- changed name + +111 +- update to Tvheadend 4.2.2-75 + +110 +- added tv_grab_file support for compressed files (gz bz2 xz) +- update to Tvheadend 4.2.1.7 +- fix FRITZ!Box support, AVM Repeater and 6490 are now working + +109 +- added custom start options to addon +- added FRITZ!Box Sat>IP server support to addon +- update to Tvheadend 4.1.2415 +- fix debug if activated but nothing selected + 108 - added CA (libdvben50221) support - update to Tvheadend 4.1.2401 @@ -28,4 +71,4 @@ - fix the XMLTV import script 100 -- initial LibreELEC version \ No newline at end of file +- initial LibreELEC version diff --git a/packages/addons/service/tvheadend42/package.mk b/packages/addons/service/tvheadend42/package.mk index b66763a683..ea2cc9af76 100644 --- a/packages/addons/service/tvheadend42/package.mk +++ b/packages/addons/service/tvheadend42/package.mk @@ -1,105 +1,134 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tvheadend42" -PKG_VERSION="1f894a6" -PKG_VERSION_NUMBER="4.1.2401" -PKG_REV="108" +PKG_VERSION="5c218500579d5bd1c1f7e7a4b5f7f0fb35baa626" +PKG_SHA256="a9fe5a4c36aa185e3f0a73a709f0dc05794ae9c12f5d888985b559ff68a2508d" +PKG_VERSION_NUMBER="4.2.7-44" +PKG_REV="118" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.tvheadend.org" PKG_URL="https://github.com/tvheadend/tvheadend/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="tvheadend-${PKG_VERSION}*" -PKG_DEPENDS_TARGET="toolchain curl dvb-tools libdvbcsa libiconv libressl Python:host yasm" +PKG_DEPENDS_TARGET="toolchain avahi comskip curl dvb-apps ffmpegx libdvbcsa libhdhomerun \ + libiconv openssl pngquant:host Python2:host tvh-dtv-scan-tables" PKG_SECTION="service" PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux" PKG_LONGDESC="Tvheadend ($PKG_VERSION_NUMBER): is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV, SAT>IP, ATSC and ISDB-T" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" -PKG_ADDON_NAME="Tvheadend 4.2" +PKG_ADDON_NAME="Tvheadend Server 4.2" PKG_ADDON_TYPE="xbmc.service" -# transcoding only for generic -if [ "$TARGET_ARCH" = x86_64 ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva-intel-driver" - TVH_TRANSCODING="--enable-ffmpeg_static --enable-libav --enable-libfdkaac --disable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-qsv" -else - TVH_TRANSCODING="--disable-ffmpeg_static --disable-libav" -fi +# basic transcoding options +PKG_TVH_TRANSCODING="\ + --disable-ffmpeg_static \ + --disable-libfdkaac_static \ + --disable-libopus_static \ + --disable-libtheora \ + --disable-libtheora_static \ + --disable-libvorbis_static \ + --disable-libvpx_static \ + --disable-libx264_static \ + --disable-libx265_static \ + --enable-libav \ + --enable-libfdkaac \ + --enable-libopus \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libx264 \ + --enable-libx265" -PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ - --arch=$TARGET_ARCH \ - --cpu=$TARGET_CPU \ - --cc=$CC \ - --disable-avahi \ - --enable-bundle \ - --disable-dbus_1 \ - --enable-dvbcsa \ - --enable-dvben50221 \ - --enable-hdhomerun_client \ - --enable-hdhomerun_static \ - --enable-epoll \ - --enable-inotify \ - --disable-nvenc \ - --disable-uriparser \ - $TVH_TRANSCODING \ - --enable-tvhcsa \ - --enable-trace \ - --nowerror \ - --disable-bintray_cache \ - --python=$ROOT/$TOOLCHAIN/bin/python" +# specific transcoding options +if [[ "$TARGET_ARCH" != "x86_64" ]]; then + PKG_TVH_TRANSCODING="$PKG_TVH_TRANSCODING \ + --disable-libvpx \ + --disable-libx265" +fi post_unpack() { sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$ADDON_VERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version + sed -e 's|'/usr/bin/pngquant'|'$TOOLCHAIN/bin/pngquant'|g' -i $PKG_BUILD/support/mkbundle } pre_configure_target() { + PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ + --arch=$TARGET_ARCH \ + --cpu=$TARGET_CPU \ + --cc=$CC \ + $PKG_TVH_TRANSCODING \ + --enable-avahi \ + --enable-bundle \ + --disable-dbus_1 \ + --enable-dvbcsa \ + --disable-dvben50221 \ + --disable-dvbscan \ + --enable-hdhomerun_client \ + --disable-hdhomerun_static \ + --enable-epoll \ + --enable-inotify \ + --enable-pngquant \ + --disable-libmfx_static \ + --disable-nvenc \ + --disable-uriparser \ + --enable-tvhcsa \ + --enable-trace \ + --nowerror \ + --disable-bintray_cache \ + --python=$TOOLCHAIN/bin/python" + # fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME -# transcoding - if [ "$TARGET_ARCH" = x86_64 ]; then - export AS=$ROOT/$TOOLCHAIN/bin/yasm - fi +# pass ffmpegx to build + PKG_CONFIG_PATH="$(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/lib/pkgconfig" + CFLAGS="$CFLAGS -I$(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/include" + LDFLAGS="$LDFLAGS -L$(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/lib" - export CROSS_COMPILE=$TARGET_PREFIX +# pass gnutls to build + LDFLAGS="$LDFLAGS -L$(get_build_dir gnutls)/.INSTALL_PKG/usr/lib" + +# pass libhdhomerun to build + CFLAGS="$CFLAGS -I$(get_build_dir libhdhomerun)" + + export CROSS_COMPILE="$TARGET_PREFIX" export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/iconv -L$SYSROOT_PREFIX/usr/lib/iconv" } -# transcoding link tvheadend with g++ -if [ "$TARGET_ARCH" = x86_64 ]; then - pre_make_target() { - export CXX=$CXX - } -fi - post_make_target() { $CC -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o capmt_ca.so src/extra/capmt_ca.c -ldl } makeinstall_target() { - : # nothing to do here + : } addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + + cp $PKG_DIR/addon.xml $ADDON_BUILD/$PKG_ADDON_ID + + # copy gnutls lib that is needed for ffmpeg + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir gnutls)/.INSTALL_PKG/usr/lib/libgnutls.so.30 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir nettle)/.install_pkg/usr/lib/libnettle.so.6 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir nettle)/.install_pkg/usr/lib/libhogweed.so.4 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir libidn2)/.install_pkg/usr/lib/libidn2.so.4 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir gmp)/.install_pkg/usr/lib/libgmp.so.10 $ADDON_BUILD/$PKG_ADDON_ID/lib + + # set only version (revision will be added by buildsystem) + sed -e "s|@ADDON_VERSION@|$ADDON_VERSION|g" \ + -i $ADDON_BUILD/$PKG_ADDON_ID/addon.xml + cp -P $PKG_BUILD/build.linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $PKG_BUILD/capmt_ca.so $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir comskip)/.install_pkg/usr/bin/comskip $ADDON_BUILD/$PKG_ADDON_ID/bin + + # dvb-scan files + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/dvb-scan + cp -r $(get_build_dir tvh-dtv-scan-tables)/atsc \ + $(get_build_dir tvh-dtv-scan-tables)/dvb-* \ + $(get_build_dir tvh-dtv-scan-tables)/isdb-t \ + $ADDON_BUILD/$PKG_ADDON_ID/dvb-scan } diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-01-dvb-scan-path.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-01-dvb-scan-path.patch new file mode 100644 index 0000000000..af3432ed85 --- /dev/null +++ b/packages/addons/service/tvheadend42/patches/tvheadend42-01-dvb-scan-path.patch @@ -0,0 +1,11 @@ +--- a/src/input/mpegts/scanfile.c ++++ b/src/input/mpegts/scanfile.c +@@ -903,7 +903,7 @@ scanfile_init ( const char *muxconf_path, int lock ) + #elif defined(PLATFORM_FREEBSD) + path = "/usr/local/share/dtv-scan-tables"; + #else +- path = "/usr/share/dvb"; ++ path = "/storage/.kodi/addons/service.tvheadend42/dvb-scan"; + #endif + + if (!initialized) { diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-01_makefile.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-01_makefile.patch deleted file mode 100644 index b1ad8ebf86..0000000000 --- a/packages/addons/service/tvheadend42/patches/tvheadend42-01_makefile.patch +++ /dev/null @@ -1,89 +0,0 @@ -From: Team LibreELEC - https://LibreELEC.tv -Subject: adjust Tvheadend ffmpeg build to work with LibreELEC (transcoding) 07.05.2016 - ---- - -diff --git a/Makefile b/Makefile ---- a/Makefile -+++ b/Makefile -@@ -97,50 +97,65 @@ FFMPEG_CONFIG := \ - PKG_CONFIG_LIBDIR=$(FFMPEG_LIBDIR)/pkgconfig $(PKG_CONFIG) \ - --define-variable=prefix=$(FFMPEG_PREFIX) --static - -+CFLAGS += -I${FFMPEG_PREFIX}/include -+LDFLAGS += ${FFMPEG_LIBDIR}/libavfilter.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libswresample.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libavresample.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libswscale.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libavformat.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libavcodec.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libavutil.a -+ - ifeq ($(CONFIG_LIBX264_STATIC),yes) - FFMPEG_DEPS += libx264 -+LDFLAGS += ${FFMPEG_LIBDIR}/libx264.a - endif - - ifeq ($(CONFIG_LIBX265_STATIC),yes) - FFMPEG_DEPS += libx265 -+LDFLAGS += ${FFMPEG_LIBDIR}/libx265.a - endif - - ifeq ($(CONFIG_LIBVPX_STATIC),yes) - FFMPEG_DEPS += libvpx -+LDFLAGS += ${FFMPEG_LIBDIR}/libvpx.a - endif - - ifeq ($(CONFIG_LIBOGG_STATIC),yes) - FFMPEG_DEPS += libogg -+LDFLAGS += ${FFMPEG_LIBDIR}/libogg.a - endif - - ifeq ($(CONFIG_LIBTHEORA_STATIC),yes) - FFMPEG_DEPS += libtheoraenc libtheoradec libtheora -+LDFLAGS += ${FFMPEG_LIBDIR}/libtheora.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libtheoradec.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libtheoraenc.a - endif - - ifeq ($(CONFIG_LIBVORBIS_STATIC),yes) - FFMPEG_DEPS += libvorbisfile libvorbisenc libvorbis -+LDFLAGS += ${FFMPEG_LIBDIR}/libvorbis.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libvorbisenc.a -+LDFLAGS += ${FFMPEG_LIBDIR}/libvorbisfile.a - endif - - ifeq ($(CONFIG_LIBFDKAAC_STATIC),yes) - FFMPEG_DEPS += libfdk-aac -+LDFLAGS += ${FFMPEG_LIBDIR}/libfdk-aac.a - endif - - ifeq ($(CONFIG_LIBMFX_STATIC),yes) - FFMPEG_DEPS += libmfx -+LDFLAGS += ${FFMPEG_LIBDIR}/libmfx.a - endif - --LDFLAGS += $(foreach lib,$(FFMPEG_LIBS),$(FFMPEG_LIBDIR)/$(lib).a) --LDFLAGS += $(foreach lib,$(FFMPEG_DEPS),$(FFMPEG_LIBDIR)/$(lib).a) -- - else # !FFMPEG_STATIC - - FFMPEG_CONFIG := $(PKG_CONFIG) - - endif # FFMPEG_STATIC - --CFLAGS += `$(FFMPEG_CONFIG) --cflags $(FFMPEG_LIBS)` --LDFLAGS += `$(FFMPEG_CONFIG) --libs $(FFMPEG_LIBS)` -- - endif - - # LIBAV ######################################################################## -@@ -613,7 +628,7 @@ reconfigure: - - # Binary - ${PROG}: .config.mk make_webui $(OBJS) -- $(pCC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS) -+ $(CXX) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS) - - # Object - ${BUILDDIR}/%.o: %.c diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-02-hdhomerun-includes.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-02-hdhomerun-includes.patch new file mode 100644 index 0000000000..4dded6eb22 --- /dev/null +++ b/packages/addons/service/tvheadend42/patches/tvheadend42-02-hdhomerun-includes.patch @@ -0,0 +1,24 @@ +fix libhdhomerun includes + +--- a/configure ++++ b/configure +@@ -362,7 +362,7 @@ if enabled hdhomerun_static; then + else + + if enabled_or_auto hdhomerun_client; then +- if check_cc_header 'libhdhomerun/hdhomerun' libhdhomerun; then ++ if check_cc_header 'hdhomerun' libhdhomerun; then + enable hdhomerun_client + LDFLAGS="$LDFLAGS -lhdhomerun" + fi +--- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h ++++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h +@@ -24,7 +24,7 @@ + #include "htsbuf.h" + #include "tvhdhomerun.h" + +-#include "libhdhomerun/hdhomerun.h" ++#include "hdhomerun.h" + + typedef struct tvhdhomerun_device_info tvhdhomerun_device_info_t; + typedef struct tvhdhomerun_device tvhdhomerun_device_t; diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-02_makefile_ffmpeg.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-02_makefile_ffmpeg.patch deleted file mode 100644 index c011dd2cbe..0000000000 --- a/packages/addons/service/tvheadend42/patches/tvheadend42-02_makefile_ffmpeg.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Team LibreELEC - https://LibreELEC.tv -Subject: adjust Tvheadend ffmpeg build to work with LibreELEC (transcoding) 07.05.2016 - ---- - -diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg ---- a/Makefile.ffmpeg -+++ b/Makefile.ffmpeg -@@ -24,6 +24,9 @@ FFMPEG_HOST := $(ARCH)-linux-gnu - FFMPEG_TARGET := x86-linux-gcc - endif - -+FFMPEG_HOST := $(ARCH)-libreelec-linux-gnu -+FFMPEG_TARGET := $(ARCH)-libreelec-linux-gnu -+ - unexport CFLAGS - unexport LDFLAGS - -@@ -145,7 +148,7 @@ $(LIB_ROOT)/$(YASM)/.tvh_download: - - $(LIB_ROOT)/$(YASM)/.tvh_build: \ - $(LIB_ROOT)/$(YASM)/.tvh_download -- cd $(LIB_ROOT)/$(YASM) && $(CONFIGURE) -+ cd $(LIB_ROOT)/$(YASM) && $(CONFIGURE) CC=$(HOST_CC) - DESTDIR=$(EBUILDIR) \ - $(MAKE) -C $(LIB_ROOT)/$(YASM) install - @touch $@ -@@ -238,6 +241,7 @@ $(LIB_ROOT)/$(LIBX265)/.tvh_build: \ - cd $(LIB_ROOT)/$(LIBX265)/build/linux && cmake -G "Unix Makefiles" \ - -DCMAKE_INSTALL_PREFIX="/ffmpeg" \ - -DENABLE_SHARED:BOOL=OFF \ -+ -DEXTRA_LINK_FLAGS="-ldl" \ - ../../source - DESTDIR=$(EBUILDIR) \ - $(MAKE) -C $(LIB_ROOT)/$(LIBX265)/build/linux install -@@ -271,7 +275,7 @@ endif - ifeq (yes,$(CONFIG_LIBVPX_STATIC)) - - ifneq (,$(FFMPEG_TARGET)) --LIBVPX_TARGET := --target=$(FFMPEG_TARGET) -+LIBVPX_TARGET := --target=generic-gnu - endif - - $(LIB_ROOT)/$(LIBVPX)/.tvh_download: -@@ -283,7 +287,7 @@ $(LIB_ROOT)/$(LIBVPX)/.tvh_build: \ - $(LIB_ROOT)/$(YASM)/.tvh_build \ - $(LIB_ROOT)/$(LIBVPX)/.tvh_download - cd $(LIB_ROOT)/$(LIBVPX) && \ -- ASFLAGS="-DENABLE_PIC=1 -DPIC=1" $(CONFIGURE) \ -+ ASFLAGS="-DENABLE_PIC=1 -DPIC=1" CROSS=$(FFMPEG_TARGET)- $(CONFIGURE) \ - --extra-cflags="$(CFLAGS_PI)" \ - --disable-examples \ - --disable-docs \ -@@ -359,7 +363,8 @@ $(LIB_ROOT)/$(LIBTHEORA)/.tvh_build: \ - $(LIB_ROOT)/$(LIBTHEORA)/.tvh_download - cd $(LIB_ROOT)/$(LIBTHEORA) && \ - CFLAGS="$(CFLAGS_PI)" $(CONFIGURE) \ -- --with-ogg=$(EPREFIX) \ -+ OGG_CFLAGS=-I$(EPREFIX)/include \ -+ OGG_LIBS=-L$(EPREFIX)/lib \ - --disable-examples \ - --disable-spec \ - $(LIBTHEORA_HOST) -@@ -406,7 +411,8 @@ $(LIB_ROOT)/$(LIBVORBIS)/.tvh_build: \ - $(LIB_ROOT)/$(LIBVORBIS)/.tvh_download - cd $(LIB_ROOT)/$(LIBVORBIS) && \ - CFLAGS="$(CFLAGS_PI)" $(CONFIGURE) \ -- --with-ogg=$(EPREFIX) -+ OGG_CFLAGS=-I$(EPREFIX)/include \ -+ OGG_LIBS=-L$(EPREFIX)/lib - DESTDIR=$(EBUILDIR) \ - $(MAKE) -C $(LIB_ROOT)/$(LIBVORBIS) install - @touch $@ -@@ -559,6 +565,8 @@ $(LIB_ROOT)/$(FFMPEG)/.tvh_build: \ - $(LIB_ROOT)/$(LIBMFX)/.tvh_build \ - $(LIB_ROOT)/$(FFMPEG)/.tvh_download - cd $(LIB_ROOT)/$(FFMPEG) && $(CONFIGURE) \ -+ --cc=$(FFMPEG_HOST)-gcc \ -+ --cxx=$(FFMPEG_HOST)-g++ \ - --disable-all \ - --enable-gpl \ - --extra-cflags="$(ECFLAGS)" \ diff --git a/packages/addons/service/tvheadend42/patches/tvheadend42-03_temp_ffmpeg_downgrade.patch b/packages/addons/service/tvheadend42/patches/tvheadend42-03_temp_ffmpeg_downgrade.patch deleted file mode 100644 index 841dda5ae9..0000000000 --- a/packages/addons/service/tvheadend42/patches/tvheadend42-03_temp_ffmpeg_downgrade.patch +++ /dev/null @@ -1,19 +0,0 @@ -Subject: [PATCH] tvheadend: HACK ffmpeg 3.1.5 instead of 3.2 - -diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg ---- a/Makefile.ffmpeg -+++ b/Makefile.ffmpeg -@@ -94,10 +94,10 @@ LIBMFX_URL = https://github.com/lu-zero/mfx_dispatch/archive/$(LIBMFX_TB) - LIBMFX_SHA1 = 84dbdf4a6b409067e863eb9564bb2efdec6d39ce - LIBMFX_DIFFS = libmfx.linux.path.diff - --FFMPEG = ffmpeg-3.2 --FFMPEG_TB = $(FFMPEG).tar.bz2 -+FFMPEG = ffmpeg-3.1.5 -+FFMPEG_TB = $(FFMPEG).tar.bz2 - FFMPEG_URL = http://ffmpeg.org/releases/$(FFMPEG_TB) --FFMPEG_SHA1 = aac4876d1bc4d2cd8d9833b20649c3eed984f6ef -+FFMPEG_SHA1 = 053dfea8c9e057fdf237885decd03147cb2412b1 - - - # ############################################################################## diff --git a/packages/addons/service/tvheadend42/source/bin/tv_grab_file b/packages/addons/service/tvheadend42/source/bin/tv_grab_file index 906d3a66ef..fe1c58187c 100755 --- a/packages/addons/service/tvheadend42/source/bin/tv_grab_file +++ b/packages/addons/service/tvheadend42/source/bin/tv_grab_file @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) if [ $# -lt 1 ] then @@ -24,13 +9,28 @@ then ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend42" ADDON_SETTINGS="$ADDON_HOME/settings.xml" - XMLTV_TYPE=`grep XMLTV_TYPE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - XMLTV_LOCATION_FILE=`grep XMLTV_LOCATION_FILE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - XMLTV_LOCATION_WEB=`grep XMLTV_LOCATION_WEB $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` - XMLTV_LOCATION_SCRIPT=`grep XMLTV_LOCATION_SCRIPT $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $ADDON_SETTINGS)" + if [ "$XML_SETTINGS_VER" = "2" ]; then + XMLTV_TYPE="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_TYPE"]' $ADDON_SETTINGS)" + XMLTV_LOCATION_FILE="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_LOCATION_FILE"]' $ADDON_SETTINGS)" + XMLTV_LOCATION_WEB="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_LOCATION_WEB"]' $ADDON_SETTINGS | xmlstarlet unesc)" + XMLTV_LOCATION_SCRIPT="$(xmlstarlet sel -t -v '/settings/setting[@id="XMLTV_LOCATION_SCRIPT"]' $ADDON_SETTINGS)" + else + XMLTV_TYPE="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_TYPE"]' -v @value $ADDON_SETTINGS)" + XMLTV_LOCATION_FILE="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_LOCATION_FILE"]' -v @value $ADDON_SETTINGS)" + XMLTV_LOCATION_WEB="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_LOCATION_WEB"]' -v @value $ADDON_SETTINGS | xmlstarlet unesc)" + XMLTV_LOCATION_SCRIPT="$(xmlstarlet sel -t -m '/settings/setting[@id="XMLTV_LOCATION_SCRIPT"]' -v @value $ADDON_SETTINGS)" + fi if [ "$XMLTV_TYPE" = "FILE" ]; then - cat "$XMLTV_LOCATION_FILE" + case "$XMLTV_LOCATION_FILE" in + *.gz | *.bz2 | *.xz) + zcat "$XMLTV_LOCATION_FILE" + ;; + *) + cat "$XMLTV_LOCATION_FILE" + ;; + esac exit 0 elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then diff --git a/packages/addons/service/tvheadend42/source/bin/tvheadend42.start b/packages/addons/service/tvheadend42/source/bin/tvheadend42.start index 6484302389..324114957d 100755 --- a/packages/addons/service/tvheadend42/source/bin/tvheadend42.start +++ b/packages/addons/service/tvheadend42/source/bin/tvheadend42.start @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile @@ -24,6 +9,9 @@ oe_setup_addon service.tvheadend42 ADDON_SETTINGS="$ADDON_HOME/settings.xml" +COMSKIP_DIR="$ADDON_HOME/comskip" +COMSKIP_SETTINGS_FILE="$COMSKIP_DIR/comskip.ini" + DVR_SETTINGS_DIR="$ADDON_HOME/dvr/config" DVR_SETTINGS_FILE="$DVR_SETTINGS_DIR/8d0f5b7ae354d956d7fe5db25f5d0d24" @@ -44,7 +32,25 @@ XMLTV_FILE="$ADDON_DIR/bin/tv_grab_file" chmod a+x $ADDON_DIR/bin/* +# workaround to support old 4.1.x version upgrade for Tvh after 4.1.2369 +if [ -f "$ADDON_HOME/dvr/config/dvr-config" ]; then + rm $ADDON_HOME/dvr/config/dvr-config +fi + +if [ -f "$ADDON_HOME/channel/config/config.tmp" ]; then + rm $ADDON_HOME/channel/config/config.tmp +fi + +if [ -f "$ADDON_HOME/channel/config/tag.tmp" ]; then + rm $ADDON_HOME/channel/config/tag.tmp +fi + # copy config files to userdata +if [ ! -f "$COMSKIP_SETTINGS_FILE" ]; then + mkdir -p $COMSKIP_DIR + cp $ADDON_DIR/defaults/comskip/comskip.ini $COMSKIP_SETTINGS_FILE +fi + if [ ! -f "$DVR_SETTINGS_FILE" ]; then mkdir -p $DVR_SETTINGS_DIR cp $ADDON_DIR/defaults/dvr/config/8d0f5b7ae354d956d7fe5db25f5d0d24 $DVR_SETTINGS_FILE @@ -71,11 +77,38 @@ if [ ! -f "$XMLTV_SETTINGS_FILE" ]; then cp $ADDON_DIR/defaults/xmltv/config $XMLTV_SETTINGS_FILE fi -# options +# delayed Tvh startup if [ "$WORKAROUND_SLEEP" == "true" ]; then sleep $WORKAROUND_SLEEP_TIME fi +# support FritzBox Sat>IP Server detection workaround for AVM-Repeater and AVM-6490 +if [ "$AVM_SATIP_SERVER" == "true" ]; then + if [ "$AVM_DEVICE" == "AVM_Repeater" ]; then + AVM_SATIP="--satip_xml http://${AVM_ROUTER_IP}:49000/satipdesc.xml" + fi + if [ "$AVM_DEVICE" == "AVM_6490" ]; then + AVM_SATIP="--satip_xml http://${AVM_ROUTER_FAKE_IP}:49000/satipdesc.xml" + AVM_NUM="4" + fi + + # add virtual ip as workaround for AVM limitation of one stream per ip + # AVM-Repeater (2 tuners) + ip address add ${AVM_IP1}/24 dev $AVM_ETH + ip address add ${AVM_IP2}/24 dev $AVM_ETH + + # AVM-6490 (4 tuners) + if [ "$AVM_NUM" = "4" ]; then + ip address add ${AVM_IP3}/24 dev $AVM_ETH + ip address add ${AVM_IP4}/24 dev $AVM_ETH + fi +fi + +# custom startup parameters +if [ "$CUSTOM_START" != "true" ]; then + CUSTOM_ARGS="" +fi + # debug value generation if [ "$DEBUG_LOG_TRACE_1" != "NONE" ]; then DEBUG_LOG_ARG="$DEBUG_LOG_TRACE_1" @@ -84,7 +117,7 @@ fi if [ "$DEBUG_LOG_TRACE_2" != "NONE" ]; then DEBUG_LOG_ARG="$DEBUG_LOG_ARG,$DEBUG_LOG_TRACE_2" fi - + if [ "$DEBUG_LOG_TRACE_3" != "NONE" ]; then DEBUG_LOG_ARG="$DEBUG_LOG_ARG,$DEBUG_LOG_TRACE_3" fi @@ -97,6 +130,11 @@ if [ "$DEBUG_LOG_TRACE_5" != "NONE" ]; then DEBUG_LOG_ARG="$DEBUG_LOG_ARG,$DEBUG_LOG_TRACE_5" fi +# if debuglog is activated and nothing selected to trace +if [ -z "$DEBUG_LOG_ARG" ];then + DEBUG_LOG_ARG="all" +fi + # rename debuglog if already exist to prevent overwriting after crash if [ -f "${DEBUG_LOG_PATH}" ]; then cp ${DEBUG_LOG_PATH} ${DEBUG_LOG_PATH}_$(date '+%Y-%m-%d_%H.%M.%S').txt @@ -104,9 +142,9 @@ fi # debug commandline if [ "$DEBUG_LOG" = "true" ]; then - TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME -l ${DEBUG_LOG_PATH} --trace $DEBUG_LOG_ARG" + TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME $AVM_SATIP $CUSTOM_ARGS -l ${DEBUG_LOG_PATH} --trace $DEBUG_LOG_ARG" else - TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME" + TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME $AVM_SATIP $CUSTOM_ARGS" fi # start userspace DVB driver/addon diff --git a/packages/addons/service/tvheadend42/source/default.py b/packages/addons/service/tvheadend42/source/default.py index 3999a0eb31..252cf5c277 100644 --- a/packages/addons/service/tvheadend42/source/default.py +++ b/packages/addons/service/tvheadend42/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import subprocess import xbmc diff --git a/packages/addons/service/tvheadend42/source/defaults/comskip/comskip.ini b/packages/addons/service/tvheadend42/source/defaults/comskip/comskip.ini new file mode 100644 index 0000000000..bf857d44d8 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/defaults/comskip/comskip.ini @@ -0,0 +1,83 @@ +; See comskip.txt in the distribution zip file for many settable parameters, read manual.html, tuning.html and debugwindow.html for how to tune and debug comskip +edl_mode=3 ; the mode specified in the generated edl file, 0=cut, 3=commercial break +mkv_time_offset=30.0 ; offset in seconds, to work around what appears to be an Kodi or ffmpeg bug +always_keep_first_seconds=2 ; Kodi has a bug that causes a segfault if we don't keep the start of the stream, I'll fix that when I get a chance + +detect_method=43 ; 1=black frame, 2=logo, 4=scene change, 8=fuzzy logic, 16=closed captions, 32=aspect ration, 64=silence, 128=cutscenes, 255=all +validate_silence=1 ; Default, set to 0 to force using this clues if selected above. +validate_uniform=1 ; Default, set to 0 to force using this clues (like pure white frames) if blackframe is selected above. +validate_scenechange=1 ; Default, set to 0 to force using this clues if selected above. +verbose=10 ; show a lot of extra info, level 5 is also OK, set to 0 to disable +max_brightness=60 ; frame not black if any pixels checked are greater than this (scale 0 to 255) +test_brightness=40 ; frame not pure black if any pixels checked are greater than this, will check average brightness (scale 0 to 255) +max_avg_brightness=25 ; maximum average brightness for a dim frame to be considered black (scale 0 to 255) 0 means autosetting +max_commercialbreak=600 ; maximum length in seconds to consider a segment a commercial break +min_commercialbreak=25 ; minimum length in seconds to consider a segment a commercial break +max_commercial_size=125 ; maximum time in seconds for a single commercial or multiple commercials if no breaks in between +min_commercial_size=4 ; mimimum time in seconds for a single commercial +min_show_segment_length=250 ; any segment longer than this will be scored towards show. +non_uniformity=500 ; Set to 0 to disable cutpoints based on uniform frames +max_volume=500 ; any frame with sound volume larger than this will not be regarded as black frame +min_silence=12 ; Any deep silence longer than this amount of frames is a possible cutpoint +ticker_tape=0 ; Amount of pixels from bottom to ignore in all processing +logo_at_bottom=0 ; Set to 1 to search only for logo at the lower half of the video, do not combine with subtitle setting +punish=0 ; Compare to average for sum of 1=brightness, 2=uniform 4=volume, 8=silence, 16=schange, set to 0 to disable +punish_threshold=1.3 ; Multiply when amount is above average * punish_threshold +punish_modifier=2 ; When above average * threshold multiply score by this value +intelligent_brightness=0 ; Set to 1 to use a USA specific algorithm to tune some of the settings, not adviced outside the USA +logo_percentile=0.92 ; if more then this amount of logo is found then logo detection will be disabled +logo_threshold=0.75 +punish_no_logo=1 ; Default, set to 0 to avoid show segments without logo to be scored towards commercial +aggressive_logo_rejection=0 +connect_blocks_with_logo=1 ; set to 1 if you want successive blocks with logo on the transition to be regarded as connected, set to 0 to disable +logo_filter=0 ; set the size of the filter to apply to bad logo detection, 4 seems to be a good value. +cut_on_ar_change=1 ; set to 1 if you want to cut also on aspect ratio changes when logo is present, set to 2 to force cuts on aspect ratio changes. set to 0 to disable +delete_show_after_last_commercial=0 ; set to 1 if you want to delete the last block if its a show and after a commercial +delete_show_before_or_after_current=0 ; set to 1 if you want to delete the previous and the next show in the recording, this can lead to the deletion of trailers of next show +delete_block_after_commercial=0 ; set to max size of block in seconds to be discarded, set to 0 to disable +remove_before=0 ; amount of seconds of show to be removed before ALL commercials +remove_after=0 ; amount of seconds of show to be removed after ALL commercials +shrink_logo=5 ; Reduce the duration of the logo with this amount of seconds +after_logo=0 ; set to number of seconds after logo disappears comskip should start to search for silence to insert an additional cutpoint +padding=0 +ms_audio_delay=5 +volume_slip=40 +skip_b_frames=0 ; Set to 1 to force Comskip to skip frames for higher processing speed. +hardware_decode=0 ; Set to 1 to enable hardware accelerated video decoding, only available in donator version +max_repair_size=200 ; Will repair maximum 200 missing MPEG frames in the timeline, set to 0 to disable repairing for players that don't use PTS. +disable_heuristics=4 ; bit pattern for disabling heuristics, adding 1 disables heristics 1, adding 2 disables heristics 2, adding 4 disables heristics 3, 255 disables all heuristics +delete_logo_file=0 ; set to 1 if you want comskip to tidy up after finishing +output_framearray=0 ; create a big excel file for detailed analysis, set to 0 to disable +output_data=0 ; create a dump of the user data channel, used for CC and XDS (such as V-Chip info). Can be use together with output_framearray to remote debug CC decoding +output_videoredo=0 ; The old videoredo format +output_videoredo3=0 ; The new videoredo v3 format. +output_womble=0 +output_mls=0 ; set to 1 if you want MPeg Video Wizard bookmark file output +output_cuttermaran=0 +output_mpeg2schnitt=0 +output_mpgtx=0 +output_dvrcut=0 +output_zoomplayer_chapter=0 +output_zoomplayer_cutlist=0 +output_edl=1 +output_dvrmstb=0 ; Set to 1 if you're running DVRMS-Toolbox +output_edlx=0 +output_vcf=0 +output_bsplayer=0 +output_btv=0 ; set to 1 if you want Beyond TV chapter cutlist output +output_projectx=0 ; set to 1 if you want ProjectX cutlist output (Xcl) +output_avisynth=0 +output_vdr=1 ; set to 1 if you want Kodi to skipping commercials +output_demux=0 ; set to 1 if you want comskip to demux the mpeg file while scanning +sage_framenumber_bug=0 +sage_minute_bug=0 +live_tv=0 ; set to 1 if you use parallelprocessing and need the output while recording +live_tv_retries=4 ; change to 16 when using live_tv in BTV, used for mpeg PS and TS +dvrms_live_tv_retries=300 ; only used for dvr_ms +standoff=0 ; change to 8000000 when using live_tv in BTV + +cuttermaran_options="cut=\"true\" unattended=\"true\" muxResult=\"false\" snapToCutPoints=\"true\" closeApp=\"true\"" +mpeg2schnitt_options="mpeg2schnitt.exe /S /E /R25 /Z %2 %1" +avisynth_options="LoadPlugin(\"MPEG2Dec3.dll\") \nMPEG2Source(\"%s\")\n" +dvrcut_options="dvrcut \"%s.dvr-ms\" \"%s_clean.dvr-ms\" " +windowtitle="Comskip - %s" \ No newline at end of file diff --git a/packages/addons/service/tvheadend42/source/download.py b/packages/addons/service/tvheadend42/source/download.py new file mode 100644 index 0000000000..44abfcedc5 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/download.py @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import urllib, os, zipfile +from urllib2 import URLError +import xbmc, xbmcgui, xbmcaddon +import shutil +import sys + +url = 'https://github.com/tvheadend/dtv-scan-tables/archive/tvheadend.zip' +temp = xbmc.translatePath('special://temp') +temp_folder = os.path.join(temp, 'dtv-scan-tables-tvheadend') +dest_folder = os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')), 'dvb-scan') +archive = os.path.join(temp, 'dtv_scantables.zip') + +ADDON_NAME = xbmcaddon.Addon().getAddonInfo('name') +LS = xbmcaddon.Addon().getLocalizedString +SCANTABLES = ['atsc', 'channels-conf', 'dvb-c', 'dvb-s', 'dvb-t', 'isdb-t'] + +class DownLoader(): + + def __init__(self): + self.dp = xbmcgui.DialogProgressBG() + + def download(self, url, dest): + try: + self.dp.create(ADDON_NAME, LS(30042)) + urllib.urlretrieve(url, dest, reporthook=self._pbhook) + self.dp.close() + zip = zipfile.ZipFile(archive) + if zip.testzip() is not None: raise zipfile.BadZipfile + + if os.path.exists(temp_folder): shutil.rmtree(temp_folder) + if os.path.exists(dest_folder): shutil.rmtree(dest_folder) + + self.dp.create(ADDON_NAME, LS(30043)) + for idx, folder in enumerate(SCANTABLES): + self._pbhook(idx, 1, len(SCANTABLES) - 1) + for z in zip.filelist: + if folder in z.filename: zip.extract(z.filename, temp) + + self.dp.close() + for folder in SCANTABLES: + shutil.copytree(os.path.join(temp_folder, folder), os.path.join(dest_folder, folder)) + + xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO) + except URLError, e: + xbmc.log('Could not download file: %s' % e.reason, xbmc.LOGERROR) + self.dp.close() + xbmcgui.Dialog().notification(ADDON_NAME, LS(30040), xbmcgui.NOTIFICATION_ERROR) + except zipfile.BadZipfile: + xbmc.log('Could not extract files from zip, bad zipfile', xbmc.LOGERROR) + xbmcgui.Dialog().notification(ADDON_NAME, LS(30041), xbmcgui.NOTIFICATION_ERROR) + + def _pbhook(self, numblocks, blocksize, filesize): + percent = int((numblocks * blocksize * 100) / filesize) + self.dp.update(percent) + + +if __name__ == '__main__': + try: + if sys.argv[1] == 'getscantables': + dl = DownLoader() + dl.download(url, archive) + except IndexError: + pass + diff --git a/packages/addons/service/tvheadend42/source/resources/language/English/strings.po b/packages/addons/service/tvheadend42/source/resources/language/English/strings.po new file mode 100644 index 0000000000..0fef20b349 --- /dev/null +++ b/packages/addons/service/tvheadend42/source/resources/language/English/strings.po @@ -0,0 +1,182 @@ +# Kodi Media Center language file +# Addon Name: tvheadend42 +# Addon id: service.tvheadend42 +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "XMLTV" +msgstr "" + +msgctxt "#30001" +msgid "DVB" +msgstr "" + +msgctxt "#30002" +msgid "DEBUG" +msgstr "" + +msgctxt "#30003" +msgid "FRITZ!Box Sat>IP" +msgstr "" + +msgctxt "#30004" +msgid "XMLTV Configuration" +msgstr "" + +msgctxt "#30005" +msgid "XMLTV source type" +msgstr "" + +msgctxt "#30006" +msgid "XMLTV File location" +msgstr "" + +msgctxt "#30007" +msgid "XMLTV Web location" +msgstr "" + +msgctxt "#30008" +msgid "XMLTV Script location" +msgstr "" + +msgctxt "#30009" +msgid "DVB Configuration" +msgstr "" + +msgctxt "#30010" +msgid "Unload DVB modules before suspend" +msgstr "" + +msgctxt "#30011" +msgid "Wait for frontend initialization" +msgstr "" + +msgctxt "#30012" +msgid "Number of adapters to wait for" +msgstr "" + +msgctxt "#30013" +msgid "Preload capmt_ca.so library" +msgstr "" + +msgctxt "#30014" +msgid "Delay the start of Tvheadend" +msgstr "" + +msgctxt "#30015" +msgid "Seconds delay" +msgstr "" + +msgctxt "#30016" +msgid "Custom start parameter" +msgstr "" + +msgctxt "#30017" +msgid "Parameter" +msgstr "" + +msgctxt "#30018" +msgid "FRITZ!Box Sat>IP server" +msgstr "" + +msgctxt "#30019" +msgid "AVM device" +msgstr "" + +msgctxt "#30020" +msgid "IP of the AVM Repeater" +msgstr "" + +msgctxt "#30021" +msgid "Router IP range (last digits are always .254)" +msgstr "" + +msgctxt "#30022" +msgid "Used network" +msgstr "" + +msgctxt "#30023" +msgid "Virtual IP #1" +msgstr "" + +msgctxt "#30024" +msgid "Virtual IP #2" +msgstr "" + +msgctxt "#30025" +msgid "Virtual IP #3" +msgstr "" + +msgctxt "#30026" +msgid "Virtual IP #4" +msgstr "" + +msgctxt "#30027" +msgid "TRACE Configuration" +msgstr "" + +msgctxt "#30028" +msgid "Path" +msgstr "" + +msgctxt "#30029" +msgid "Activate TRACE Debug" +msgstr "" + +msgctxt "#30030" +msgid "Debug Value #1" +msgstr "" + +msgctxt "#30031" +msgid "Debug Value #2" +msgstr "" + +msgctxt "#30032" +msgid "Debug Value #3" +msgstr "" + +msgctxt "#30033" +msgid "Debug Value #4" +msgstr "" + +msgctxt "#30034" +msgid "Debug Value #5" +msgstr "" + +msgctxt "#30035" +msgid "FRITZ!Box Configuration for FRITZ!OS 6.x (do not use for 7.x)" +msgstr "" + +msgctxt "#30036" +msgid "Scan Tables" +msgstr "" + +msgctxt "#30037" +msgid "Manage Scan-Tables" +msgstr "" + +msgctxt "#30038" +msgid "Download and install Scan-Tables" +msgstr "" + +msgctxt "#30039" +msgid "Download completed, tables installed" +msgstr "" + +msgctxt "#30040" +msgid "Could not download Scan-Tables" +msgstr "" + +msgctxt "#30041" +msgid "Could not extract zip files" +msgstr "" + +msgctxt "#30042" +msgid "Download Scan-Tables" +msgstr "" + +msgctxt "#30043" +msgid "Extract Scan-Tables" +msgstr "" diff --git a/packages/addons/service/tvheadend42/source/resources/language/English/strings.xml b/packages/addons/service/tvheadend42/source/resources/language/English/strings.xml deleted file mode 100644 index b036835769..0000000000 --- a/packages/addons/service/tvheadend42/source/resources/language/English/strings.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - XMLTV - DVB - DEBUG - XMLTV Configuration - XMLTV source type - XMLTV File location - XMLTV Web location - XMLTV Script location - DVB Configuration - Unload DVB mudules before suspend - Wait for frontend initialization - Number of adapters to wait for - Preload capmt_ca.so library - Delay the start of Tvheadend - Seconds delay - TRACE Configuration - Path - Activate TRACE Debug - Debug Value #1 - Debug Value #2 - Debug Value #3 - Debug Value #4 - Debug Value #5 - diff --git a/packages/addons/service/tvheadend42/source/resources/settings.xml b/packages/addons/service/tvheadend42/source/resources/settings.xml index 185a5a27f8..689d3b5556 100644 --- a/packages/addons/service/tvheadend42/source/resources/settings.xml +++ b/packages/addons/service/tvheadend42/source/resources/settings.xml @@ -1,34 +1,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/tvheadend42/source/settings-default.xml b/packages/addons/service/tvheadend42/source/settings-default.xml index 0f47b8e232..774e8bd51b 100644 --- a/packages/addons/service/tvheadend42/source/settings-default.xml +++ b/packages/addons/service/tvheadend42/source/settings-default.xml @@ -1,10 +1,31 @@ - - - - - - - - - + + + eth0 + 192.168.178.201 + 192.168.178.202 + 192.168.178.203 + 192.168.178.204 + 192.168.178.254 + 192.168.178.2 + false + + false + false + /storage/.kodi/userdata/addon_data/service.tvheadend42/debug.txt + NONE + NONE + NONE + NONE + NONE + + 1 + false + + false + false + 1 + + + http:// + NONE diff --git a/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power b/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power index ca66f083ff..a28b4f3aeb 100755 --- a/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power +++ b/packages/addons/service/tvheadend42/source/sleep.d/tvheadend.power @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile diff --git a/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service b/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service index e92c783ee8..06f0c67086 100644 --- a/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service +++ b/packages/addons/service/tvheadend42/source/system.d/service.tvheadend42.service @@ -1,7 +1,6 @@ [Unit] Description=TVHeadend42 Service After=network-online.service -Requires=network-online.service [Service] ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.tvheadend42/bin/tvheadend42.start" diff --git a/packages/addons/service/tvmosaic/changelog.txt b/packages/addons/service/tvmosaic/changelog.txt new file mode 100644 index 0000000000..ffbebe8438 --- /dev/null +++ b/packages/addons/service/tvmosaic/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial addon diff --git a/packages/addons/service/tvmosaic/icon/icon.png b/packages/addons/service/tvmosaic/icon/icon.png new file mode 100644 index 0000000000..620c7e1738 Binary files /dev/null and b/packages/addons/service/tvmosaic/icon/icon.png differ diff --git a/packages/addons/service/tvmosaic/package.mk b/packages/addons/service/tvmosaic/package.mk new file mode 100644 index 0000000000..823c27394d --- /dev/null +++ b/packages/addons/service/tvmosaic/package.mk @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="tvmosaic" +PKG_VERSION="1.0.0-16296" +PKG_SHA256="63d48e7b0912f2efb6e894252a13d8312679cdcb155ebe3fa758dc88b4f91816" +PKG_REV="100" +PKG_ARCH="any" +PKG_ARCH="arm" +PKG_LICENSE="Prop." +PKG_SITE="https://tv-mosaic.com" +PKG_URL="https://github.com/awiouy/tvmosaic/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="service" +PKG_SHORTDESC="TV Mosaic" +PKG_LONGDESC="TV Mosaic ($PKG_VERSION) live and recorded TV for Kodi and DLNA clients" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="-strip" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="TV Mosaic" +PKG_ADDON_TYPE="xbmc.service" +PKG_MAINTAINER="Anton Voyl (awiouy)" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/tvmosaic/tvmosaic_reg \ + $PKG_BUILD/tvmosaic/tvmosaic_server \ + $PKG_BUILD/tvmosaic/version.dat \ + $ADDON_BUILD/$PKG_ADDON_ID/bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/shared.inst/RecordedTV \ + $ADDON_BUILD/$PKG_ADDON_ID/config/shared.inst/channel_logo \ + $ADDON_BUILD/$PKG_ADDON_ID/config/shared.inst/xmltv + cp -r $PKG_BUILD/tvmosaic/data \ + $PKG_BUILD/tvmosaic/shared.inst \ + $ADDON_BUILD/$PKG_ADDON_ID/config + echo $PKG_REV > $ADDON_BUILD/$PKG_ADDON_ID/config/pkg_rev + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -L $PKG_BUILD/tvmosaic/lib/libcares.so.2 \ + $PKG_BUILD/tvmosaic/lib/libdvbapi.so \ + $PKG_BUILD/tvmosaic/lib/libdvben50221.so \ + $PKG_BUILD/tvmosaic/lib/libiconv.so.2 \ + $PKG_BUILD/tvmosaic/lib/libidn.so.11 \ + $PKG_BUILD/tvmosaic/lib/libssh2.so.1 \ + $PKG_BUILD/tvmosaic/lib/libucsi.so \ + $ADDON_BUILD/$PKG_ADDON_ID/lib +} diff --git a/packages/addons/service/tvmosaic/source/bin/tvmosaic.cli b/packages/addons/service/tvmosaic/source/bin/tvmosaic.cli new file mode 100755 index 0000000000..132c2231e4 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/bin/tvmosaic.cli @@ -0,0 +1,11 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.tvmosaic + +export TVMOSAIC_ROOT_CONFIG_DIR="$ADDON_HOME" + +tvmosaic_server -command_line_mode diff --git a/packages/addons/service/tvmosaic/source/bin/tvmosaic.start b/packages/addons/service/tvmosaic/source/bin/tvmosaic.start new file mode 100755 index 0000000000..8ffc8b2ec8 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/bin/tvmosaic.start @@ -0,0 +1,28 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon service.tvmosaic + +sleep "$tvm_delay" + +export TVMOSAIC_ROOT_CONFIG_DIR="$ADDON_HOME" + +pkg_rev() { + cat "$1/pkg_rev" 2> /dev/null +} + +if [ "$(pkg_rev $ADDON_DIR/config)" != "$(pkg_rev $ADDON_HOME)" ]; then + cp -r "$ADDON_DIR/config/"* "$ADDON_HOME" +fi + +if [ -f "$ADDON_HOME/tvmosaic_configuration.xml" ]; then + tvmosaic_reg -reginstall "$ADDON_HOME/data/common/product_info/tvmosaic.xml" update +else + tvmosaic_reg -preparenewinstall "$ADDON_DIR/bin" "$ADDON_HOME/data" "$ADDON_HOME/shared.inst" + tvmosaic_reg -reginstall "$ADDON_HOME/data/common/product_info/tvmosaic.xml" install +fi + +tvmosaic_server diff --git a/packages/addons/service/tvmosaic/source/default.py b/packages/addons/service/tvmosaic/source/default.py new file mode 100644 index 0000000000..bb9a1566e6 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/default.py @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + + +def systemctl(command): + subprocess.call( + ['systemctl', command, xbmcaddon.Addon().getAddonInfo('id')]) + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + + def onSettingsChanged(self): + systemctl('restart') + + +if __name__ == '__main__': + Monitor().waitForAbort() diff --git a/packages/addons/service/tvmosaic/source/resources/language/English/strings.po b/packages/addons/service/tvmosaic/source/resources/language/English/strings.po new file mode 100644 index 0000000000..537e7c5cc7 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: tvmosaic +# Addon id: service.tvmosaic +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Start delay" +msgstr "" diff --git a/packages/addons/service/tvmosaic/source/resources/settings.xml b/packages/addons/service/tvmosaic/source/resources/settings.xml new file mode 100644 index 0000000000..131f906384 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/resources/settings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/addons/service/tvmosaic/source/settings-default.xml b/packages/addons/service/tvmosaic/source/settings-default.xml new file mode 100644 index 0000000000..57c60a5c45 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/settings-default.xml @@ -0,0 +1,3 @@ + + 0 + diff --git a/packages/addons/service/tvmosaic/source/system.d/service.tvmosaic.service b/packages/addons/service/tvmosaic/source/system.d/service.tvmosaic.service new file mode 100644 index 0000000000..5c45fdea05 --- /dev/null +++ b/packages/addons/service/tvmosaic/source/system.d/service.tvmosaic.service @@ -0,0 +1,13 @@ +[Unit] +Description=TV Mosaic Server +Documentation=https://tv-mosaic.com +After=network-online.target +Requires=network-online.target + +[Service] +ExecStart=/bin/sh /storage/.kodi/addons/service.tvmosaic/bin/tvmosaic.start +Type=forking +Restart=always + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/usbmuxd/package.mk b/packages/addons/service/usbmuxd/package.mk index 092b575d0a..039a202c1c 100644 --- a/packages/addons/service/usbmuxd/package.mk +++ b/packages/addons/service/usbmuxd/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="usbmuxd" PKG_VERSION="1.1.0" -PKG_REV="100" +PKG_SHA256="3e8948b4fe4250ee5c4bd41ccd1b83c09b8a6f5518a7d131a66fd38bd461b42d" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.libimobiledevice.org" @@ -27,7 +13,6 @@ PKG_DEPENDS_TARGET="toolchain libusb libimobiledevice" PKG_SECTION="service" PKG_SHORTDESC="USB Multiplex Daemon" PKG_LONGDESC="USB Multiplex Daemon" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_NAME="iPhone Tether" diff --git a/packages/addons/service/usbmuxd/source/default.py b/packages/addons/service/usbmuxd/source/default.py index 1a91d91ede..cd0d51d91f 100644 --- a/packages/addons/service/usbmuxd/source/default.py +++ b/packages/addons/service/usbmuxd/source/default.py @@ -1,17 +1,2 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/addons/service/vdr-addon/changelog.txt b/packages/addons/service/vdr-addon/changelog.txt index d6a715f01b..1a199d0f84 100644 --- a/packages/addons/service/vdr-addon/changelog.txt +++ b/packages/addons/service/vdr-addon/changelog.txt @@ -1,3 +1,37 @@ +109 +- fix script.config.vdr scan: + . reststfulapi: use header from current wirbelscan + . wirbelscan: fix segv, interface channel counts and device detection +- update EEPG plugin to c46be44 +- update Sat>IP plugin to a4051bf +- update VNSI plugin to 1.8.0 +- update VDR 2.4.0 upstream patches +- update Wirbelscan plugin to 2018.11.04 + +108 +- update VDR to 2.4.0 +- update EPG-Fixer plugin to 354f28b +- update EPG-Search plugin to 84b59b8 +- update IPTV plugin to 5ae793f +- update Sat>IP plugin to 299296b +- update VNSI to 1.6.0 + +107 +- add robotv plugin +- add DDCI2 plugin +- update VDR to 2.3.8 +- update all addons + +106 +- update Sat>IP plugin to 28cc3ca +- update VNSI to 63d8151 + +105 +- fix for some scrambled channels +- update dvbapi to d7c7587 +- update Sat>IP plugin to ed99cfb +- update VNSI to 615a077 + 104 - encode special characters in directory names to be accesible via smb - update VNSI to d6847c3 diff --git a/packages/addons/service/vdr-addon/package.mk b/packages/addons/service/vdr-addon/package.mk index c27a78525f..e916fdf84c 100644 --- a/packages/addons/service/vdr-addon/package.mk +++ b/packages/addons/service/vdr-addon/package.mk @@ -1,48 +1,28 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vdr-addon" -PKG_VERSION="8.0" -PKG_REV="104" +PKG_VERSION="2.4" +PKG_REV="109" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv" +PKG_SITE="https://libreelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain vdr vdr-plugin-dummydevice vdr-plugin-dvbapi vdr-plugin-eepg vdr-plugin-epgfixer vdr-plugin-epgsearch vdr-plugin-iptv vdr-plugin-live vdr-plugin-restfulapi vdr-plugin-satip vdr-plugin-streamdev vdr-plugin-vnsiserver vdr-plugin-wirbelscan vdr-plugin-wirbelscancontrol vdr-plugin-xmltv2vdr" +PKG_DEPENDS_TARGET="toolchain vdr vdr-plugin-ddci2 vdr-plugin-dummydevice vdr-plugin-dvbapi vdr-plugin-eepg vdr-plugin-epgfixer \ + vdr-plugin-epgsearch vdr-plugin-iptv vdr-plugin-live vdr-plugin-restfulapi vdr-plugin-robotv vdr-plugin-satip \ + vdr-plugin-streamdev vdr-plugin-vnsiserver vdr-plugin-wirbelscan vdr-plugin-wirbelscancontrol vdr-plugin-xmltv2vdr" PKG_SECTION="service.multimedia" PKG_SHORTDESC="VDR: a TV streaming server for Linux" -PKG_LONGDESC="VDR (2.2.0) is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV and SAT>IP" -PKG_AUTORECONF="no" +PKG_LONGDESC="VDR (2.4.x) is a TV streaming server for Linux supporting DVB-S/S2, DVB-C, DVB-T/T2, IPTV and SAT>IP" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="VDR PVR Backend" PKG_ADDON_TYPE="xbmc.service" PKG_ADDON_REQUIRES="pvr.vdr.vnsi:0.0.0 script.config.vdr:0.0.0" -make_target() { - : # nothing to do here -} - -makeinstall_target() { - : # nothing to do here -} - addon() { VDR_DIR="$(get_build_dir vdr)" VDR_PLUGIN_LIVE_DIR="$(get_build_dir vdr-plugin-live)" @@ -87,6 +67,8 @@ addon() { cp -PR $(get_build_dir vdr-plugin-satip)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_EPGFIXER_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin cp -PR $VDR_PLUGIN_RESTFULAPI_DIR/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-robotv)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin + cp -PR $(get_build_dir vdr-plugin-ddci2)/libvdr*.so.* $ADDON_BUILD/$PKG_ADDON_ID/plugin mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/plugins/eepg diff --git a/packages/addons/service/vdr-addon/source/bin/vdr.start b/packages/addons/service/vdr-addon/source/bin/vdr.start old mode 100755 new mode 100644 index f357c190f8..8496485536 --- a/packages/addons/service/vdr-addon/source/bin/vdr.start +++ b/packages/addons/service/vdr-addon/source/bin/vdr.start @@ -1,22 +1,8 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) . /etc/profile @@ -48,7 +34,7 @@ ADDON_CACHE_DIR="$ADDON_HOME/cache" mkdir -p $ADDON_CACHE_DIR VDR_ARG="-g /tmp --no-kbd" -if [ "$DEBUG" = "yes" ]; then +if [ "$DEBUG" = "yes" -o "$ENABLE_VDR_DEBUG" == "true" ]; then VDR_ARG="$VDR_ARG --log=3" else VDR_ARG="$VDR_ARG --log=1" @@ -108,8 +94,13 @@ fi if [ "$ENABLE_EPGSEARCH" == "true" ] ; then VDR_ARG="$VDR_ARG -P epgsearch" fi -if [ "$ENABLE_DUMMYDEVICE" == "true" ] ; then +if [ "$ENABLE_DUMMYDEVICE" == "true" \ + -o ! \( -d /dev/dvb/adapter0 -o "$WAIT_FOR_FEINIT" == "true" \ + -o "$ENABLE_SATIP" == "true" \ + -o "$ENABLE_STREAMDEV_CLIENT" == "true" \) ] ; then VDR_ARG="$VDR_ARG -P dummydevice" +else + VNSI_ARG=" -d" fi if [ "$ENABLE_SATIP" == "true" ] ; then VDR_ARG="$VDR_ARG -P 'satip -d $SATIP_NUM_DEVICES'" @@ -130,6 +121,12 @@ if [ "$ENABLE_XMLTV2VDR" == "true" ] ; then cp $source /var/lib/epgsources done fi +if [ "$ENABLE_ROBOTV" == "true" ] ; then + VDR_ARG="$VDR_ARG -P robotv" +fi +if [ "$ENABLE_DDCI2" == "true" ] ; then + VDR_ARG="$VDR_ARG -P ddci2" +fi if [ ! -d "$ADDON_HOME/epgimages" ]; then mkdir -p "$ADDON_HOME/epgimages" @@ -144,7 +141,7 @@ RESTFULAPI_ARGS="$RESTFULAPI_ARGS --channellogos=\"$ADDON_HOME/channellogos\"" VDR_ARG="$VDR_ARG -P 'restfulapi $RESTFULAPI_ARGS'" # vnsi last -VDR_ARG="$VDR_ARG -P vnsiserver" +VDR_ARG="$VDR_ARG -P 'vnsiserver$VNSI_ARG'" cd $ADDON_DIR/config mkdir -p $ADDON_CONFIG_DIR @@ -178,4 +175,10 @@ if [ "$WAIT_FOR_FEINIT" == "true" ] ; then fi fix_config + +if [ "$ENABLE_VDR_DEBUG" == "true" ] ; then + /usr/bin/journalctl -b -0 -f -u service.multimedia.vdr-addon > $ADDON_LOG_FILE & + sleep 1 +fi + eval LANG=en_US.UTF-8 VDR_CHARSET_OVERRIDE="$VDR_CHARSET_OVERRIDE" exec vdr.bin $VDR_ARG diff --git a/packages/addons/service/vdr-addon/source/default.py b/packages/addons/service/vdr-addon/source/default.py index cd40a7231e..95e7277c4a 100644 --- a/packages/addons/service/vdr-addon/source/default.py +++ b/packages/addons/service/vdr-addon/source/default.py @@ -1,17 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/vdr-addon/source/resources/language/English/strings.po b/packages/addons/service/vdr-addon/source/resources/language/English/strings.po new file mode 100644 index 0000000000..5edca1b8fc --- /dev/null +++ b/packages/addons/service/vdr-addon/source/resources/language/English/strings.po @@ -0,0 +1,150 @@ +# Kodi Media Center language file +# Addon Name: vdr-addon +# Addon id: service.multimedia.vdr-addon +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "DVB" +msgstr "" + +msgctxt "#30001" +msgid "PLUGINS" +msgstr "" + +msgctxt "#30002" +msgid "VDR" +msgstr "" + +msgctxt "#30003" +msgid "DVB Configuration" +msgstr "" + +msgctxt "#30004" +msgid "Unload DVB modules before suspend" +msgstr "" + +msgctxt "#30005" +msgid "Wait for frontend initialization" +msgstr "" + +msgctxt "#30006" +msgid "Number of adapters to wait for" +msgstr "" + +msgctxt "#30007" +msgid "Enable charset override" +msgstr "" + +msgctxt "#30008" +msgid "- charset" +msgstr "" + +msgctxt "#30009" +msgid "Plugin Configuration" +msgstr "" + +msgctxt "#30010" +msgid "Enable plugin: iptv" +msgstr "" + +msgctxt "#30011" +msgid "Enable plugin: streamdev-client" +msgstr "" + +msgctxt "#30012" +msgid "Enable plugin: streamdev-server" +msgstr "" + +msgctxt "#30013" +msgid "Enable plugin: dvbapi (softcam)" +msgstr "" + +msgctxt "#30014" +msgid "Enable plugin: live" +msgstr "" + +msgctxt "#30015" +msgid "- listen on ip" +msgstr "" + +msgctxt "#30016" +msgid "- listen on port" +msgstr "" + +msgctxt "#30017" +msgid "Enable plugin: epgsearch" +msgstr "" + +msgctxt "#30018" +msgid "Enable plugin: xmltv2vdr" +msgstr "" + +msgctxt "#30019" +msgid "Enable plugin: extended EPG" +msgstr "" + +msgctxt "#30020" +msgid "Enable plugin: dummydevice" +msgstr "" + +msgctxt "#30021" +msgid "Enable plugin: satip" +msgstr "" + +msgctxt "#30022" +msgid "Enable plugin: epgfixer" +msgstr "" + +msgctxt "#30023" +msgid "VDR Configuration" +msgstr "" + +msgctxt "#30024" +msgid "VDR Video Dir" +msgstr "" + +msgctxt "#30025" +msgid "Enable external recdmd" +msgstr "" + +msgctxt "#30026" +msgid "External recdmd path" +msgstr "" + +msgctxt "#30027" +msgid "- number of devices" +msgstr "" + +msgctxt "#30028" +msgid "restfulapi plugin options" +msgstr "" + +msgctxt "#30029" +msgid "- listen on ip" +msgstr "" + +msgctxt "#30030" +msgid "- listen on port" +msgstr "" + +msgctxt "#30031" +msgid "Enable plugin: roboTV" +msgstr "" + +msgctxt "#30032" +msgid "Enable plugin: DDCI2" +msgstr "" + +msgctxt "#30033" +msgid "DEBUG" +msgstr "" + +msgctxt "#30034" +msgid "VDR Debugging" +msgstr "" + +msgctxt "#30035" +msgid "Enable Debug Log" +msgstr "" diff --git a/packages/addons/service/vdr-addon/source/resources/language/English/strings.xml b/packages/addons/service/vdr-addon/source/resources/language/English/strings.xml deleted file mode 100644 index 6f92edaaaf..0000000000 --- a/packages/addons/service/vdr-addon/source/resources/language/English/strings.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - DVB - Plugins - VDR - DVB Configuration - Unload DVB modules before suspend - Wait for frontend initialization - Number of adapters to wait for - Enable charset override - - charset - Plugin Configuration - Enable plugin: iptv - Enable plugin: streamdev-client - Enable plugin: streamdev-server - Enable softcam (dvbapi) - Enable plugin: live - - listen on ip - - listen on port - Enable plugin: epgsearch - Enable plugin: xmltv2vdr - Enable plugin: extended EPG - Enable plugin: dummydevice - Enable plugin: satip - Enable plugin: epgfixer - VDR Configuration - VDR Video Dir - Enable external recdmd - External recdmd path - - number of devices - restfulapi plugin options - - listen on ip - - listen on port - diff --git a/packages/addons/service/vdr-addon/source/resources/settings.xml b/packages/addons/service/vdr-addon/source/resources/settings.xml index 557a281dd4..3064f6e059 100644 --- a/packages/addons/service/vdr-addon/source/resources/settings.xml +++ b/packages/addons/service/vdr-addon/source/resources/settings.xml @@ -1,43 +1,49 @@ - - - - - - - - + + + + + + + + - - - - + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/vdr-addon/source/settings-default.xml b/packages/addons/service/vdr-addon/source/settings-default.xml index 52afb13f0d..12427ef3bd 100644 --- a/packages/addons/service/vdr-addon/source/settings-default.xml +++ b/packages/addons/service/vdr-addon/source/settings-default.xml @@ -1,27 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + false + false + false + false + false + false + false + false + false + false + false + true + false + false + false + false + + 1 + 0.0.0.0 + 8008 + 1 + + 127.0.0.1 + 8002 + 1 + /storage/videos + false diff --git a/packages/addons/service/vdr-addon/source/sleep.d/vdr.power b/packages/addons/service/vdr-addon/source/sleep.d/vdr.power index 58f3fe77b9..848cd1242f 100644 --- a/packages/addons/service/vdr-addon/source/sleep.d/vdr.power +++ b/packages/addons/service/vdr-addon/source/sleep.d/vdr.power @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/addons/service/vdr-addon/source/system.d/service.multimedia.vdr-addon.service b/packages/addons/service/vdr-addon/source/system.d/service.multimedia.vdr-addon.service index bfbb96b8c7..f9d1159ded 100644 --- a/packages/addons/service/vdr-addon/source/system.d/service.multimedia.vdr-addon.service +++ b/packages/addons/service/vdr-addon/source/system.d/service.multimedia.vdr-addon.service @@ -4,7 +4,7 @@ After=graphical.target [Service] ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.multimedia.vdr-addon/bin/vdr.start" -TimeoutStopSec=2 +TimeoutStopSec=5 Restart=always RestartSec=2 StartLimitInterval=0 diff --git a/packages/addons/service/webgrabplus/changelog.txt b/packages/addons/service/webgrabplus/changelog.txt deleted file mode 100644 index ccadc446ad..0000000000 --- a/packages/addons/service/webgrabplus/changelog.txt +++ /dev/null @@ -1,19 +0,0 @@ -104 -- Upgrade siteini.pack to 20161021 -- Add system.d timer -- Add license headers - -103 -- Upgrade mdb ini files - -102 -- Upgrade WebGrab+Plus to 56.29.pre -- Upgrade siteini.pack to 20160807 -- Call user defined pre/post processing - -101 -- Upgrade WebGrab+Plus to 56.28.pre -- Upgrade siteini.pack to 20160729 - -100 -- Initial addon diff --git a/packages/addons/service/webgrabplus/icon/icon.png b/packages/addons/service/webgrabplus/icon/icon.png deleted file mode 100644 index 1d627fb191..0000000000 Binary files a/packages/addons/service/webgrabplus/icon/icon.png and /dev/null differ diff --git a/packages/addons/service/webgrabplus/package.mk b/packages/addons/service/webgrabplus/package.mk index 901eeb5a3f..6f2759d8f4 100644 --- a/packages/addons/service/webgrabplus/package.mk +++ b/packages/addons/service/webgrabplus/package.mk @@ -1,49 +1,25 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="webgrabplus" -PKG_VERSION="56.29pre-20161021" -PKG_REV="104" +PKG_VERSION="1.0" +PKG_REV="100" PKG_ARCH="any" -PKG_LICENSE="prop." -PKG_SITE="http://www.webgrabplus.com/" -PKG_URL="https://github.com/awiouy/webgrabplus/archive/$PKG_VERSION.tar.gz" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="service" -PKG_SHORTDESC="WebGrab+Plus: a multi-site incremental xmltv epg grabber" -PKG_LONGDESC="WebGrab+Plus ($PKG_VERSION) collects tv-program guide data from selected tvguide sites for your favourite channels." -PKG_AUTORECONF="no" +PKG_SHORTDESC="Add-on removed" +PKG_LONGDESC="Add-on removed" +PKG_TOOLCHAIN="manual" + +PKG_ADDON_BROKEN="Webgrab++ is no longer maintained and has been removed." PKG_IS_ADDON="yes" PKG_ADDON_NAME="WebGrab+Plus" -PKG_ADDON_TYPE="xbmc.service" -PKG_ADDON_REQUIRES="tools.mono:0.0.0" -PKG_MAINTAINER="Anton Voyl (awiouy)" - -make_target() { - : # nop -} - -makeinstall_target() { - : # nop -} +PKG_ADDON_TYPE="xbmc.broken" addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID - cp -PR $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID + : } diff --git a/packages/addons/service/webgrabplus/source/bin/webgrabplus.run b/packages/addons/service/webgrabplus/source/bin/webgrabplus.run deleted file mode 100644 index ce6ea05b4d..0000000000 --- a/packages/addons/service/webgrabplus/source/bin/webgrabplus.run +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. /etc/profile -oe_setup_addon service.webgrabplus - -wgp_user () { - echo "User defined $1" - if [ -f "$2" ] - then - echo "Calling user defined $1 script $2" - sh "$2" - else - echo "Nothing to do" - fi -} - -mkdir -p "$ADDON_HOME" -cd "$ADDON_HOME" - -for p in chans2correct.xml mdb rex siteini.pack WebGrab++.config.xml -do - if [ ! -e "$p" ] - then - cp -r "$ADDON_DIR/config/$p" . - fi -done - -sid="$(basename $(find $ADDON_DIR/config/siteini.pack -name SiteIni.Pack_*.txt))" -sih="$(basename $(find siteini.pack -name SiteIni.Pack_*.txt))" -if [ "$sid" \> "$sih" ] -then - rm -rf siteini.pack - cp -r "$ADDON_DIR/config/siteini.pack" . -fi - -wgp_user "pre-processing" "$ADDON_HOME/before.sh" - -mono $ADDON_DIR/WebGrab+Plus/WebGrab+Plus.exe - -if [ -f guide_mdb.xml ] -then - cp guide_mdb.xml guide_wgp.xml - rm guide_mdb.xml -fi - -cp guide_wgp.xml guide_xtc.xml -mono $ADDON_DIR/WebGrab+Plus/xmltv_time_correct.exe guide_wgp.xml guide_xtc.xml < /dev/zero - -cp guide_xtc.xml guide.xml -rm guide_xtc.xml - -mono $ADDON_DIR/WebGrab+Plus/WG2MP.exe guide.xml mediaportal.xml - -wgp_user "post-processing" "$ADDON_HOME/after.sh" diff --git a/packages/addons/service/webgrabplus/source/bin/webgrabplus.start b/packages/addons/service/webgrabplus/source/bin/webgrabplus.start deleted file mode 100644 index 6ea408ab31..0000000000 --- a/packages/addons/service/webgrabplus/source/bin/webgrabplus.start +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. /etc/profile -oe_setup_addon service.webgrabplus - -[ "$wgp_on_act" ] && on_act="--on-active=$wgp_on_act" - -systemd-run $on_act --on-calendar="$wgp_on_cal" --unit=webgrabplus /bin/sh $ADDON_DIR/bin/webgrabplus.run diff --git a/packages/addons/service/webgrabplus/source/default.py b/packages/addons/service/webgrabplus/source/default.py deleted file mode 100644 index 2666e0f27c..0000000000 --- a/packages/addons/service/webgrabplus/source/default.py +++ /dev/null @@ -1,17 +0,0 @@ -import subprocess -import xbmc -import xbmcaddon - - -class Monitor(xbmc.Monitor): - - def __init__(self, *args, **kwargs): - xbmc.Monitor.__init__(self) - self.id = xbmcaddon.Addon().getAddonInfo('id') - - def onSettingsChanged(self): - subprocess.call(['systemctl', 'restart', self.id]) - - -if __name__ == "__main__": - Monitor().waitForAbort() diff --git a/packages/addons/service/webgrabplus/source/resources/language/English/strings.po b/packages/addons/service/webgrabplus/source/resources/language/English/strings.po deleted file mode 100644 index 0ee6e10c44..0000000000 --- a/packages/addons/service/webgrabplus/source/resources/language/English/strings.po +++ /dev/null @@ -1,14 +0,0 @@ -msgid "" -msgstr "" - -msgctxt "#30000" -msgid "systemd-run" -msgstr "" - -msgctxt "#30001" -msgid "--on-active" -msgstr "" - -msgctxt "#30002" -msgid "--on-calendar" -msgstr "" diff --git a/packages/addons/service/webgrabplus/source/resources/settings.xml b/packages/addons/service/webgrabplus/source/resources/settings.xml deleted file mode 100644 index 1ddacccab8..0000000000 --- a/packages/addons/service/webgrabplus/source/resources/settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/packages/addons/service/webgrabplus/source/settings-default.xml b/packages/addons/service/webgrabplus/source/settings-default.xml deleted file mode 100644 index 7c6826e537..0000000000 --- a/packages/addons/service/webgrabplus/source/settings-default.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/addons/service/webgrabplus/source/system.d/service.webgrabplus.service b/packages/addons/service/webgrabplus/source/system.d/service.webgrabplus.service deleted file mode 100644 index 6c51286242..0000000000 --- a/packages/addons/service/webgrabplus/source/system.d/service.webgrabplus.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=WebGrab+Plus -Documentation=http://www.webgrabplus.com/ -After=network.target -Requires=network.target - -[Service] -ExecStart=/bin/sh /storage/.kodi/addons/service.webgrabplus/bin/webgrabplus.start -ExecStop=/usr/bin/systemctl stop webgrabplus.timer -ExecStop=/usr/bin/systemctl stop webgrabplus.service -RemainAfterExit=yes -Type=oneshot - -[Install] -WantedBy=kodi.target diff --git a/packages/addons/skin/estouchy/package.mk b/packages/addons/skin/estouchy/package.mk index b9549e9744..8bbe9bc162 100644 --- a/packages/addons/skin/estouchy/package.mk +++ b/packages/addons/skin/estouchy/package.mk @@ -1,46 +1,22 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="estouchy" PKG_VERSION="1.0" -PKG_REV="100" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain kodi" -PKG_PRIORITY="optional" PKG_SECTION="skin" PKG_SHORTDESC="Kodi skin Estouchy" PKG_LONGDESC="Kodi skin Estouchy" +PKG_TOOLCHAIN="manual" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Estouchy" PKG_ADDON_TYPE="xbmc.gui.skin" -PKG_AUTORECONF="no" - -make_target() { - : # already build with kodi -} - -makeinstall_target() { - : # nothing to install -} addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID diff --git a/packages/addons/tools/btrfs-progs/package.mk b/packages/addons/tools/btrfs-progs/package.mk index f64a6fde88..efdbf9fbcf 100644 --- a/packages/addons/tools/btrfs-progs/package.mk +++ b/packages/addons/tools/btrfs-progs/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="btrfs-progs" PKG_VERSION="4.8.4" -PKG_REV="100" +PKG_SHA256="4741764daa4eee9179ae1d366f25b08e8ec99a2857bab03487e6a991f26a25ff" +PKG_REV="101" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://btrfs.wiki.kernel.org/index.php/Main_Page" @@ -27,7 +13,7 @@ PKG_DEPENDS_TARGET="toolchain util-linux zlib lzo" PKG_SECTION="tools" PKG_SHORTDESC="tools for the btrfs filesystem" PKG_LONGDESC="tools for the btrfs filesystem" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="configure" PKG_IS_ADDON="yes" PKG_ADDON_NAME="BTRFS Tools" diff --git a/packages/addons/tools/btrfs-progs/source/default.py b/packages/addons/tools/btrfs-progs/source/default.py index 880a196075..08bebb1487 100644 --- a/packages/addons/tools/btrfs-progs/source/default.py +++ b/packages/addons/tools/btrfs-progs/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui diff --git a/packages/addons/tools/dotnet-runtime/changelog.txt b/packages/addons/tools/dotnet-runtime/changelog.txt new file mode 100644 index 0000000000..1773413ff4 --- /dev/null +++ b/packages/addons/tools/dotnet-runtime/changelog.txt @@ -0,0 +1,14 @@ +104 +- Update to 2.2.0 + +103 +- Update to 2.1.6 + +102 +- Update to 2.1.4 + +101 +- Update to 2.1.3 + +100 +- Initial release diff --git a/packages/addons/tools/dotnet-runtime/icon/icon.png b/packages/addons/tools/dotnet-runtime/icon/icon.png new file mode 100644 index 0000000000..7b53b77cd0 Binary files /dev/null and b/packages/addons/tools/dotnet-runtime/icon/icon.png differ diff --git a/packages/addons/tools/dotnet-runtime/package.mk b/packages/addons/tools/dotnet-runtime/package.mk new file mode 100644 index 0000000000..f4746b49cb --- /dev/null +++ b/packages/addons/tools/dotnet-runtime/package.mk @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +case "$ARCH" in + "aarch64") + PKG_NC_ARCH="arm64" + PKG_SHA256="8baeaeb6ff7d65fbb8e7d085f7625cc4e3e2ffaecd97e80d2c5e4ca0ed598356" + PKG_URL="https://download.visualstudio.microsoft.com/download/pr/8931cb99-76f8-4d62-82be-881b79b03aac/9b31f0cbd0caac6d1639cece76d414a8/dotnet-runtime-2.2.0-linux-arm64.tar.gz" + ;; + "arm") + PKG_NC_ARCH="arm" + PKG_SHA256="248e3d43b7b46b30f9059c775b08770c377f3a90f27bbc3da188a3f7f24de75d" + PKG_URL="https://download.visualstudio.microsoft.com/download/pr/a3f3e38e-246a-4eab-8da3-63f9cd1b1c13/c2e795a9bb03bc75d3cfa767f3f77310/dotnet-runtime-2.2.0-linux-arm.tar.gz" + ;; + "x86_64") + PKG_NC_ARCH="x64" + PKG_SHA256="452ea9e2fc4f84fd5d0bf17501aa99a99d33badabee23950e537a1a4dc6a2b05" + PKG_URL="https://download.visualstudio.microsoft.com/download/pr/1057e14e-16cc-410b-80a4-5c2420c8359c/004dc3ce8255475d4723de9a011ac513/dotnet-runtime-2.2.0-linux-x64.tar.gz" + ;; +esac + +PKG_NAME="dotnet-runtime" +PKG_VERSION="2.2.0" +PKG_REV="104" +PKG_ARCH="any" +PKG_LICENSE="MIT" +PKG_SITE="https://dotnet.github.io/" +PKG_DEPENDS_TARGET="toolchain curl curl3 krb5 lttng-ust" +PKG_SECTION="tools" +PKG_SHORTDESC=".NET Core Runtime" +PKG_LONGDESC=".NET Core Runtime ($PKG_VERSION) runs applications built with .NET Core, a cross-platform .NET implementation." +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME=".Net Core Runtime" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_MAINTAINER="Anton Voyl (awiouy)" + +unpack() { + mkdir -p $PKG_BUILD + $SCRIPTS/extract $PKG_NAME $PKG_BUILD +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -r $PKG_BUILD/$PKG_NAME-$PKG_VERSION/* \ + $ADDON_BUILD/$PKG_ADDON_ID/bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/libs + cp -L $(get_build_dir curl3)/.install_pkg/usr/lib/libcurl.so.? \ + $(get_build_dir krb5)/.install_pkg/usr/lib/libcom_err.so.? \ + $(get_build_dir krb5)/.install_pkg/usr/lib/libgssapi_krb5.so.? \ + $(get_build_dir krb5)/.install_pkg/usr/lib/libk5crypto.so.? \ + $(get_build_dir krb5)/.install_pkg/usr/lib/libkrb5.so.? \ + $(get_build_dir krb5)/.install_pkg/usr/lib/libkrb5support.so.? \ + $(get_build_dir lttng-ust)/.install_pkg/usr/lib/liblttng-ust.so.? \ + $(get_build_dir lttng-ust)/.install_pkg/usr/lib/liblttng-ust-tracepoint.so.? \ + $ADDON_BUILD/$PKG_ADDON_ID/libs +} diff --git a/packages/addons/tools/dotnet-runtime/source/bin/le_dotnet b/packages/addons/tools/dotnet-runtime/source/bin/le_dotnet new file mode 100644 index 0000000000..2bf6a7287e --- /dev/null +++ b/packages/addons/tools/dotnet-runtime/source/bin/le_dotnet @@ -0,0 +1,10 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile +oe_setup_addon tools.dotnet-runtime + +DOTNET_SYSTEM_GLOBALIZATION_INVARIANT="1" \ +LD_LIBRARY_PATH="$ADDON_DIR/libs:$LD_LIBRARY_PATH" \ +dotnet "$@" diff --git a/packages/addons/tools/dvb-tools/changelog.txt b/packages/addons/tools/dvb-tools/changelog.txt index 2ca2a72d41..eabf220c33 100644 --- a/packages/addons/tools/dvb-tools/changelog.txt +++ b/packages/addons/tools/dvb-tools/changelog.txt @@ -1,3 +1,30 @@ +105 +- added t2scan +- updated bitstream to 1.4 +- updated blindscan-s2 to 192eaf0 +- updated dvblast to acf3844 +- updated dvbsnoop to badf61f +- updated mumudvb to 6153f87 + +104 +- remove dvb-fe-tool, it's already included in the image +- updated MuMuDVB to a09373d +- updated dvblast to 77cfaa8 + +103 +- added blindscan-s2 +- added dvbsnoop +- added szap-s2 +- added tune-s2 +- updated dvb-fe-tool to 1.12.5 +- updated MuMuDVB to 596f7db + +102 +- added MuMuDVB +- updated w_scan to 20170107 +- updated dvblast to 3.1 +- updated dvb-fe-tool to 1.12.3 + 101 - added w_scan diff --git a/packages/addons/tools/dvb-tools/package.mk b/packages/addons/tools/dvb-tools/package.mk index a36faf7cc2..de5199f060 100644 --- a/packages/addons/tools/dvb-tools/package.mk +++ b/packages/addons/tools/dvb-tools/package.mk @@ -1,46 +1,39 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dvb-tools" -PKG_VERSION="" -PKG_REV="101" +PKG_VERSION="1.0" +PKG_REV="105" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="virtual" PKG_SHORTDESC="DVB-Tools: is a bundle of dvb tools and programs" -PKG_LONGDESC="This bundle currently includes dvb-apps, dvb-fe-tool, dvblast and w_scan." -PKG_AUTORECONF="no" +PKG_LONGDESC="This bundle currently includes blindscan-s2, dvb-apps, dvblast, dvbsnoop, mumudvb, szap-s2, tune-s2, t2scan and w_scan." PKG_IS_ADDON="yes" PKG_ADDON_NAME="DVB Tools" PKG_ADDON_TYPE="xbmc.python.script" PKG_DEPENDS_TARGET="toolchain \ + blindscan-s2 \ dvb-apps \ - dvb-fe-tool \ dvblast \ + dvbsnoop \ + mumudvb \ + szap-s2 \ + tune-s2 \ + t2scan \ w_scan" addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + # blindscan-s2 + cp -P $(get_build_dir blindscan-s2)/blindscan-s2 $ADDON_BUILD/$PKG_ADDON_ID/bin + # dvb-apps cp -P $(get_build_dir dvb-apps)/util/dvbdate/dvbdate $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $(get_build_dir dvb-apps)/util/dvbnet/dvbnet $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -54,14 +47,24 @@ addon() { cp -P $(get_build_dir dvb-apps)/util/szap/tzap $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $(get_build_dir dvb-apps)/util/zap/zap $ADDON_BUILD/$PKG_ADDON_ID/bin - # dvb-de-tool - cp -P $(get_build_dir dvb-fe-tool)/.$TARGET_NAME/utils/dvb/dvb-fe-tool $ADDON_BUILD/$PKG_ADDON_ID/bin - # dvblast cp -P $(get_build_dir dvblast)/dvblast $ADDON_BUILD/$PKG_ADDON_ID/bin + # dvbsnoop + cp -P $(get_build_dir dvbsnoop)/.$TARGET_NAME/src/dvbsnoop $ADDON_BUILD/$PKG_ADDON_ID/bin + + # mumudvb + cp -P $(get_build_dir mumudvb)/.$TARGET_NAME/src/mumudvb $ADDON_BUILD/$PKG_ADDON_ID/bin + + # szap-s2 + cp -P $(get_build_dir szap-s2)/szap-s2 $ADDON_BUILD/$PKG_ADDON_ID/bin + + # tune-s2 + cp -P $(get_build_dir tune-s2)/tune-s2 $ADDON_BUILD/$PKG_ADDON_ID/bin + + # t2scan + cp -P $(get_build_dir t2scan)/.$TARGET_NAME/t2scan $ADDON_BUILD/$PKG_ADDON_ID/bin + # w_scan cp -P $(get_build_dir w_scan)/.$TARGET_NAME/w_scan $ADDON_BUILD/$PKG_ADDON_ID/bin - - debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/tools/dvb-tools/source/default.py b/packages/addons/tools/dvb-tools/source/default.py index 67e12970fe..08bebb1487 100644 --- a/packages/addons/tools/dvb-tools/source/default.py +++ b/packages/addons/tools/dvb-tools/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui diff --git a/packages/addons/tools/ffmpeg-tools/changelog.txt b/packages/addons/tools/ffmpeg-tools/changelog.txt new file mode 100644 index 0000000000..349ed13ce1 --- /dev/null +++ b/packages/addons/tools/ffmpeg-tools/changelog.txt @@ -0,0 +1,30 @@ +105 +- Removed FDK-AAC +- Build with GNUTLS +- Update AV1 to 2019-01-09 + +104 +- Update aom to d2a592e +- Update FFmpeg to 4.1 +- Update opus to 1.3 +- Update x264 to 20181116 +- Update x265 to 2.9 + +103 +- Update AV1 to 20181002 +- Update FFmpeg to 4.0.2 +- Update X264 to 20181001 + +102 +- Rename binary to ffmpeg (no ffmpegx anymore) +- Update AV1 to 96ee0eb +- Update FFmpeg to 4.0.1 +- Update X264 to 20180627 +- Update X265 to 2.8 + +101 +- Update to FFmpeg 4.0 +- Added AV1 codec + +100 +- Initial release diff --git a/packages/addons/tools/ffmpeg-tools/icon/icon.png b/packages/addons/tools/ffmpeg-tools/icon/icon.png new file mode 100755 index 0000000000..a3784abbc5 Binary files /dev/null and b/packages/addons/tools/ffmpeg-tools/icon/icon.png differ diff --git a/packages/addons/tools/ffmpeg-tools/package.mk b/packages/addons/tools/ffmpeg-tools/package.mk new file mode 100644 index 0000000000..4ae9c69c9b --- /dev/null +++ b/packages/addons/tools/ffmpeg-tools/package.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ffmpeg-tools" +PKG_VERSION="1.0" +PKG_REV="105" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://libreelec.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain ffmpegx" +PKG_SECTION="tools" +PKG_SHORTDESC="FFmpeg binary for transcoding and audio/video manipulating." +PKG_TOOLCHAIN="manual" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="FFmpeg Tools" +PKG_ADDON_TYPE="xbmc.python.script" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + cp -L $(get_build_dir ffmpegx)/.INSTALL_PKG/usr/local/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin + + # copy gnutls lib that is needed for ffmpeg + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir gmp)/.install_pkg/usr/lib/libgmp.so.10 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir gnutls)/.INSTALL_PKG/usr/lib/libgnutls.so.30 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir libidn2)/.install_pkg/usr/lib/libidn2.so.4 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir nettle)/.install_pkg/usr/lib/libhogweed.so.4 $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -PL $(get_build_dir nettle)/.install_pkg/usr/lib/libnettle.so.6 $ADDON_BUILD/$PKG_ADDON_ID/lib +} diff --git a/packages/addons/tools/ffmpeg-tools/source/default.py b/packages/addons/tools/ffmpeg-tools/source/default.py new file mode 100644 index 0000000000..871042ceb2 --- /dev/null +++ b/packages/addons/tools/ffmpeg-tools/source/default.py @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +import xbmcaddon +import xbmcgui + +dialog = xbmcgui.Dialog() +strings = xbmcaddon.Addon().getLocalizedString + +dialog.ok(strings(30000), strings(30001)) diff --git a/packages/addons/tools/ffmpeg-tools/source/resources/language/English/strings.po b/packages/addons/tools/ffmpeg-tools/source/resources/language/English/strings.po new file mode 100644 index 0000000000..19e773d620 --- /dev/null +++ b/packages/addons/tools/ffmpeg-tools/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: ffmpeg-tools +# Addon id: tools.ffmpeg-tools +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "FFmpeg Tools Help" +msgstr "" + +msgctxt "#30001" +msgid "Please have a look at our Wiki (https://libreelec.wiki) for instructions how the FFmpeg binary could be used." +msgstr "" diff --git a/packages/addons/tools/game-tools/changelog.txt b/packages/addons/tools/game-tools/changelog.txt new file mode 100644 index 0000000000..b7f9e891ea --- /dev/null +++ b/packages/addons/tools/game-tools/changelog.txt @@ -0,0 +1,2 @@ +9.0.100 +- Initial Release diff --git a/packages/addons/tools/game-tools/icon/icon.png b/packages/addons/tools/game-tools/icon/icon.png new file mode 100644 index 0000000000..f95a9e2b80 Binary files /dev/null and b/packages/addons/tools/game-tools/icon/icon.png differ diff --git a/packages/addons/tools/game-tools/package.mk b/packages/addons/tools/game-tools/package.mk new file mode 100644 index 0000000000..656bf7dc38 --- /dev/null +++ b/packages/addons/tools/game-tools/package.mk @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game-tools" +PKG_VERSION="" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="virtual" +PKG_SHORTDESC="A bundle of game tools and programs" +PKG_LONGDESC="This bundle currently includes bchunk, ecm-tools, iat, and linuxconsoletools" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Game Tools" +PKG_ADDON_TYPE="xbmc.python.script" + +PKG_DEPENDS_TARGET="toolchain \ + bchunk \ + ecm-tools \ + iat \ + linuxconsoletools" + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + # bchunk + cp -P $(get_build_dir bchunk)/bchunk $ADDON_BUILD/$PKG_ADDON_ID/bin + + # ecm-tools + cp -P $(get_build_dir ecm-tools)/bin2ecm $ADDON_BUILD/$PKG_ADDON_ID/bin + ln -s bin2ecm $ADDON_BUILD/$PKG_ADDON_ID/bin/ecm2bin + + # iat + cp -P $(get_build_dir iat)/.$TARGET_NAME/src/iat $ADDON_BUILD/$PKG_ADDON_ID/bin + + # linuxconsoletools + cp -P $(get_build_dir linuxconsoletools)/utils/fftest $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir linuxconsoletools)/utils/jscal $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir linuxconsoletools)/utils/jstest $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/tools/game-tools/source/default.py b/packages/addons/tools/game-tools/source/default.py new file mode 100644 index 0000000000..45df6c5419 --- /dev/null +++ b/packages/addons/tools/game-tools/source/default.py @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +import xbmcgui +import subprocess + +xbmcgui.Dialog().ok('', 'This is a console-only addon') + diff --git a/packages/addons/tools/mono/changelog.txt b/packages/addons/tools/mono/changelog.txt deleted file mode 100644 index 270f277c1a..0000000000 --- a/packages/addons/tools/mono/changelog.txt +++ /dev/null @@ -1,7 +0,0 @@ -8.0.101 -- Update to 4.2.1.102 -- Build static for all projects and architectures -- Remove uneeded binaries and libraries - -8.0.100 -- Initial release diff --git a/packages/addons/tools/mono/icon/icon.png b/packages/addons/tools/mono/icon/icon.png deleted file mode 100644 index 68e87967df..0000000000 Binary files a/packages/addons/tools/mono/icon/icon.png and /dev/null differ diff --git a/packages/addons/tools/mono/package.mk b/packages/addons/tools/mono/package.mk index 6f9c98ad18..8c1e6e0288 100644 --- a/packages/addons/tools/mono/package.mk +++ b/packages/addons/tools/mono/package.mk @@ -1,92 +1,25 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mono" -PKG_VERSION="4.2.1.102" -PKG_REV="101" +PKG_VERSION="1.0" +PKG_REV="100" PKG_ARCH="any" -PKG_LICENSE="MIT" -PKG_SITE="http://www.mono-project.com" -PKG_URL="http://download.mono-project.com/sources/mono/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_SOURCE_DIR="$PKG_NAME-${PKG_VERSION%.*}" -PKG_DEPENDS_TARGET="toolchain mono:host libgdiplus sqlite mono_sqlite zlib" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="tools" -PKG_SHORTDESC="Mono: a cross platform, open source .NET framework" -PKG_LONGDESC="Mono ($PKG_VERSION) is a software platform designed to allow developers to easily create cross platform applications part of the .NET Foundation" -PKG_AUTORECONF="yes" +PKG_SHORTDESC="Add-on removed" +PKG_LONGDESC="Add-on removed" +PKG_TOOLCHAIN="manual" + +PKG_ADDON_BROKEN="Mono is no longer maintained and has been removed." PKG_IS_ADDON="yes" PKG_ADDON_NAME="Mono" -PKG_ADDON_TYPE="xbmc.python.script" -PKG_MAINTAINER="Anton Voyl (awiouy)" - -prefix="/storage/.kodi/addons/$PKG_SECTION.$PKG_NAME" -options="--build=$HOST_NAME \ - --prefix=$prefix \ - --bindir=$prefix/bin \ - --sbindir=$prefix/sbin \ - --sysconfdir=$prefix/etc \ - --libexecdir=$prefix/lib \ - --localstatedir=/var \ - --disable-boehm \ - --disable-libraries \ - --without-mcs-docs" - -configure_host() { - cp -PR ../* . - ./configure $options --host=$HOST_NAME -} - -makeinstall_host() { - : # nop -} - -configure_target() { - cp -PR ../* . - strip_lto - ./configure $options --host=$TARGET_NAME \ - --disable-mcs-build -} - -makeinstall_target() { - make -C "$ROOT/$PKG_BUILD/.$HOST_NAME" install DESTDIR="$INSTALL" - make -C "$ROOT/$PKG_BUILD/.$TARGET_NAME" install DESTDIR="$INSTALL" - $STRIP "$INSTALL/storage/.kodi/addons/$PKG_SECTION.$PKG_NAME/bin/mono" -} +PKG_ADDON_TYPE="xbmc.broken" addon() { - mkdir -p "$ADDON_BUILD/$PKG_ADDON_ID" - - cp -PR "$PKG_BUILD/.install_pkg/storage/.kodi/addons/$PKG_SECTION.$PKG_NAME"/* \ - "$ADDON_BUILD/$PKG_ADDON_ID/" - - rm -fr "$ADDON_BUILD/$PKG_ADDON_ID/include" \ - "$ADDON_BUILD/$PKG_ADDON_ID/share/man" - - mv "$ADDON_BUILD/$PKG_ADDON_ID/bin/mono-sgen" \ - "$ADDON_BUILD/$PKG_ADDON_ID/bin/mono" - - cp -L "$(get_build_dir cairo)/.install_pkg/usr/lib/libcairo.so.2" \ - "$(get_build_dir libX11)/.install_pkg/usr/lib/libX11.so.6" \ - "$(get_build_dir libXext)/.install_pkg/usr/lib/libXext.so.6" \ - "$(get_build_dir libexif)/.install_pkg/usr/lib/libexif.so.12" \ - "$(get_build_dir libgdiplus)/.install_pkg/usr/lib/libgdiplus.so" \ - "$(get_build_dir mono_sqlite)/.install_pkg/usr/lib/libsqlite3.so.0" \ - "$(get_build_dir pixman)/.install_pkg/usr/lib/libpixman-1.so.0" \ - "$ADDON_BUILD/$PKG_ADDON_ID/lib" + : } diff --git a/packages/addons/tools/mono/patches/mono-01.debian-changes.patch b/packages/addons/tools/mono/patches/mono-01.debian-changes.patch deleted file mode 100644 index 609938d752..0000000000 --- a/packages/addons/tools/mono/patches/mono-01.debian-changes.patch +++ /dev/null @@ -1,12675 +0,0 @@ -Description: - TODO: Put a short summary on the line above and replace this paragraph - with a longer explanation of this change. Complete the meta-information - with other relevant fields (see below for details). To make it easier, the - information below has been extracted from the changelog. Adjust it or drop - it. - . - mono (4.2.1.102+dfsg2-8) unstable; urgency=medium - . - * [cf4937c] Fixes for ARM64 packages. Thanks to Matthias Klose - * [ec6abc9] Further packaging fixes for ARM64 (Closes: 825497) -Author: Jo Shields -Bug-Debian: https://bugs.debian.org/825497 - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: https://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: - ---- mono-4.2.1.102+dfsg2.orig/Makefile.am -+++ mono-4.2.1.102+dfsg2/Makefile.am -@@ -10,7 +10,7 @@ SUBDIRS = po $(libgc_dir) eglib mono $(i - ## 'tools' is not normally built - DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs - else --SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc $(docs_dir) -+SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc - # Keep in sync with SUBDIRS - ## 'tools' is not normally built - DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs ---- mono-4.2.1.102+dfsg2.orig/configure.ac -+++ mono-4.2.1.102+dfsg2/configure.ac -@@ -2732,6 +2732,7 @@ case "$host" in - mips*) - TARGET=MIPS; - arch_target=mips; -+ with_tls=pthread - sgen_supported=true - ACCESS_UNALIGNED="no" - ---- mono-4.2.1.102+dfsg2.orig/data/mono-cairo.pc.in -+++ mono-4.2.1.102+dfsg2/data/mono-cairo.pc.in -@@ -1,5 +1,5 @@ --prefix=${pcfiledir}/../.. --exec_prefix=${pcfiledir}/../.. -+prefix=@prefix@ -+exec_prefix=${prefix} - libdir=${prefix}/@reloc_libdir@ - includedir=${prefix}/include - ---- mono-4.2.1.102+dfsg2.orig/data/mono.pc.in -+++ mono-4.2.1.102+dfsg2/data/mono.pc.in -@@ -1,5 +1,5 @@ --prefix=${pcfiledir}/../.. --exec_prefix=${pcfiledir}/../.. -+prefix=@prefix@ -+exec_prefix=${prefix} - libdir=${prefix}/@reloc_libdir@ - includedir=${prefix}/include/mono-@API_VER@ - sysconfdir=@sysconfdir@ ---- mono-4.2.1.102+dfsg2.orig/data/net_1_1/machine.config -+++ mono-4.2.1.102+dfsg2/data/net_1_1/machine.config -@@ -75,7 +75,7 @@ - - - -- -+ - - - ---- mono-4.2.1.102+dfsg2.orig/data/net_2_0/machine.config -+++ mono-4.2.1.102+dfsg2/data/net_2_0/machine.config -@@ -119,7 +119,7 @@ - - - -- -+ - - - ---- mono-4.2.1.102+dfsg2.orig/data/net_4_0/machine.config -+++ mono-4.2.1.102+dfsg2/data/net_4_0/machine.config -@@ -136,7 +136,7 @@ - - - -- -+ - - - ---- mono-4.2.1.102+dfsg2.orig/data/net_4_5/machine.config -+++ mono-4.2.1.102+dfsg2/data/net_4_5/machine.config -@@ -139,7 +139,7 @@ - - - -- -+ - - - ---- mono-4.2.1.102+dfsg2.orig/libgc/include/private/gcconfig.h -+++ mono-4.2.1.102+dfsg2/libgc/include/private/gcconfig.h -@@ -2157,6 +2157,50 @@ - extern char * GC_FreeBSDGetDataStart(); - # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext) - # endif -+# ifdef FREEBSD -+# define OS_TYPE "FREEBSD" -+# ifndef GC_FREEBSD_THREADS -+# define MPROTECT_VDB -+# endif -+# ifdef __GLIBC__ -+# define SIG_SUSPEND (32+6) -+# define SIG_THR_RESTART (32+5) -+ extern int _end[]; -+# define DATAEND (_end) -+# else -+# define SIG_SUSPEND SIGUSR1 -+# define SIG_THR_RESTART SIGUSR2 -+# endif -+# define FREEBSD_STACKBOTTOM -+# ifdef __ELF__ -+# define DYNAMIC_LOADING -+# endif -+ extern char etext[]; -+ extern char * GC_FreeBSDGetDataStart(); -+# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext) -+# endif -+# ifdef FREEBSD -+# define OS_TYPE "FREEBSD" -+# ifndef GC_FREEBSD_THREADS -+# define MPROTECT_VDB -+# endif -+# ifdef __GLIBC__ -+# define SIG_SUSPEND (32+6) -+# define SIG_THR_RESTART (32+5) -+ extern int _end[]; -+# define DATAEND (_end) -+# else -+# define SIG_SUSPEND SIGUSR1 -+# define SIG_THR_RESTART SIGUSR2 -+# endif -+# define FREEBSD_STACKBOTTOM -+# ifdef __ELF__ -+# define DYNAMIC_LOADING -+# endif -+ extern char etext[]; -+ extern char * GC_FreeBSDGetDataStart(); -+# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext) -+# endif - # ifdef NETBSD - # define OS_TYPE "NETBSD" - # ifdef __ELF__ ---- mono-4.2.1.102+dfsg2.orig/mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs -+++ mono-4.2.1.102+dfsg2/mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs -@@ -128,12 +128,25 @@ namespace Mono.Security.X509 { - - string filename = Path.Combine (_storePath, GetUniqueName (certificate)); - if (!File.Exists (filename)) { -- using (FileStream fs = File.Create (filename)) { -- byte[] data = certificate.RawData; -- fs.Write (data, 0, data.Length); -- fs.Close (); -+ filename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate)); -+ if (!File.Exists (filename)) { -+ using (FileStream fs = File.Create (filename)) { -+ byte[] data = certificate.RawData; -+ fs.Write (data, 0, data.Length); -+ fs.Close (); -+ } -+ ClearCertificates (); // We have modified the store on disk. So forget the old state. -+ } -+ } else { -+ string newfilename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate)); -+ if (GetUniqueNameWithSerial (LoadCertificate (filename)) != GetUniqueNameWithSerial (certificate)) { -+ using (FileStream fs = File.Create (newfilename)) { -+ byte[] data = certificate.RawData; -+ fs.Write (data, 0, data.Length); -+ fs.Close (); -+ } -+ ClearCertificates (); // We have modified the store on disk. So forget the old state. - } -- ClearCertificates (); // We have modified the store on disk. So forget the old state. - } - #if !NET_2_1 - // Try to save privateKey if available.. -@@ -164,10 +177,16 @@ namespace Mono.Security.X509 { - - public void Remove (X509Certificate certificate) - { -- string filename = Path.Combine (_storePath, GetUniqueName (certificate)); -+ string filename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate)); - if (File.Exists (filename)) { - File.Delete (filename); - ClearCertificates (); // We have modified the store on disk. So forget the old state. -+ } else { -+ filename = Path.Combine (_storePath, GetUniqueName (certificate)); -+ if (File.Exists (filename)) { -+ File.Delete (filename); -+ ClearCertificates (); // We have modified the store on disk. So forget the old state. -+ } - } - } - -@@ -182,10 +201,15 @@ namespace Mono.Security.X509 { - - // private stuff - -- private string GetUniqueName (X509Certificate certificate) -+ private string GetUniqueNameWithSerial (X509Certificate certificate) -+ { -+ return GetUniqueName (certificate, certificate.SerialNumber); -+ } -+ -+ private string GetUniqueName (X509Certificate certificate, byte[] serial = null) - { - string method; -- byte[] name = GetUniqueName (certificate.Extensions); -+ byte[] name = GetUniqueName (certificate.Extensions, serial); - if (name == null) { - method = "tbp"; // thumbprint - name = certificate.Hash; -@@ -208,7 +232,7 @@ namespace Mono.Security.X509 { - return GetUniqueName (method, name, ".crl"); - } - -- private byte[] GetUniqueName (X509ExtensionCollection extensions) -+ private byte[] GetUniqueName (X509ExtensionCollection extensions, byte[] serial = null) - { - // We prefer Subject Key Identifier as the unique name - // as it will provide faster lookups -@@ -217,7 +241,14 @@ namespace Mono.Security.X509 { - return null; - - SubjectKeyIdentifierExtension ski = new SubjectKeyIdentifierExtension (ext); -- return ski.Identifier; -+ if (serial == null) { -+ return ski.Identifier; -+ } else { -+ byte[] uniqueWithSerial = new byte[ski.Identifier.Length + serial.Length]; -+ System.Buffer.BlockCopy (ski.Identifier, 0, uniqueWithSerial, 0, ski.Identifier.Length ); -+ System.Buffer.BlockCopy (serial, 0, uniqueWithSerial, ski.Identifier.Length, serial.Length ); -+ return uniqueWithSerial; -+ } - } - - private string GetUniqueName (string method, byte[] name, string fileExtension) ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/Mono.WebBrowser/Mono.NullBrowser/Base.cs -@@ -0,0 +1,174 @@ -+// 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. -+// -+// Copyright (c) 2007, 2008 Novell, Inc. -+// -+// Authors: -+// Andreia Gaita (avidigal@novell.com) -+// -+ -+using System; -+using System.Text; -+using System.Collections; -+using System.Runtime.InteropServices; -+using System.Diagnostics; -+using Mono.WebBrowser; -+ -+namespace Mono.NullBrowser -+{ -+ internal class Base -+ { -+ private static Hashtable boundControls; -+ private static bool initialized; -+ private static object initLock = new object (); -+ private static string monoMozDir; -+ -+ private static bool isInitialized () -+ { -+ if (!initialized) -+ return false; -+ return true; -+ } -+ -+ static Base () -+ { -+ boundControls = new Hashtable (); -+ } -+ -+ public Base () { } -+ -+ public static bool Init (WebBrowser control, Platform platform) -+ { -+ lock (initLock) { -+ if (!initialized) { -+ -+ initialized = true; -+ } -+ } -+ return initialized; -+ } -+ -+ public static bool Bind (WebBrowser control, IntPtr handle, int width, int height) -+ { -+ if (!isInitialized ()) -+ return false; -+ -+ -+ return true; -+ } -+ -+ public static bool Create (IWebBrowser control) { -+ if (!isInitialized ()) -+ return false; -+ -+ return true; -+ } -+ -+ public static void Shutdown (IWebBrowser control) -+ { -+ lock (initLock) { -+ if (!initialized) -+ return; -+ -+ -+ boundControls.Remove (control); -+ if (boundControls.Count == 0) { -+ initialized = false; -+ } -+ } -+ } -+ -+ // layout -+ public static void Focus (IWebBrowser control, FocusOption focus) -+ { -+ if (!isInitialized ()) -+ return; -+ -+ } -+ -+ -+ public static void Blur (IWebBrowser control) -+ { -+ if (!isInitialized ()) -+ return; -+ -+ } -+ -+ public static void Activate (IWebBrowser control) -+ { -+ if (!isInitialized ()) -+ return; -+ -+ } -+ -+ public static void Deactivate (IWebBrowser control) -+ { -+ if (!isInitialized ()) -+ return; -+ -+ } -+ -+ public static void Resize (IWebBrowser control, int width, int height) -+ { -+ if (!isInitialized ()) -+ return; -+ -+ } -+ -+ // navigation -+ public static void Home (IWebBrowser control) -+ { -+ if (!isInitialized ()) -+ return; -+ -+ } -+ -+ -+ public static IntPtr StringInit () -+ { -+ return IntPtr.Zero; -+ } -+ -+ public static void StringFinish (HandleRef str) -+ { -+ } -+ -+ public static string StringGet (HandleRef str) -+ { -+ return String.Empty; -+ } -+ -+ public static void StringSet (HandleRef str, string text) -+ { -+ } -+ -+ -+ public static object GetProxyForObject (IWebBrowser control, Guid iid, object obj) -+ { -+ return null; -+ } -+ -+ public static string EvalScript (IWebBrowser control, string script) -+ { -+ return null; -+ } -+ -+ -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/Mono.WebBrowser/Mono.NullBrowser/DOM/Navigation.cs -@@ -0,0 +1,127 @@ -+// 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. -+// -+// Copyright (c) 2007, 2008 Novell, Inc. -+// -+// Authors: -+// Andreia Gaita (avidigal@novell.com) -+// -+ -+using System; -+using System.Runtime.InteropServices; -+using System.Text; -+using Mono.WebBrowser; -+using Mono.WebBrowser.DOM; -+ -+namespace Mono.NullBrowser.DOM -+{ -+ internal class Navigation: INavigation -+ { -+ -+ -+ #region INavigation Members -+ -+ public bool CanGoBack { -+ get { -+ return false; -+ } -+ } -+ -+ public bool CanGoForward { -+ get { -+ return false; -+ } -+ } -+ -+ public bool Back () -+ { -+ return false; -+ } -+ -+ public bool Forward () -+ { -+ return false; -+ } -+ -+ public void Home () -+ { -+ } -+ -+ public void Reload () -+ { -+ } -+ -+ public void Reload (ReloadOption option) -+ { -+ } -+ -+ public void Stop () -+ { -+ } -+ -+ -+ /// -+ /// Navigate to the page in the history, by index. -+ /// -+ /// -+ /// A representing an absolute index in the -+ /// history (that is, > -1 and < history length -+ /// -+ public void Go (int index) -+ { -+ } -+ -+ /// -+ /// -+ /// -+ /// -+ /// A representing an index in the -+ /// history, that can be relative or absolute depending on the relative argument -+ /// -+ /// -+ /// A indicating whether the index is relative to -+ /// the current place in history or not (i.e., if relative = true, index can be -+ /// positive or negative, and index=-1 means load the previous page in the history. -+ /// if relative = false, index must be > -1, and index = 0 means load the first -+ /// page of the history. -+ /// -+ public void Go (int index, bool relative) { -+ } -+ -+ public void Go (string url) -+ { -+ } -+ -+ public void Go (string url, LoadFlags flags) -+ { -+ } -+ -+ public int HistoryCount { -+ get { -+ return 0; -+ } -+ } -+ -+ #endregion -+ -+ public override int GetHashCode () { -+ return 0; -+ } -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/Mono.WebBrowser/Mono.NullBrowser/WebBrowser.cs -@@ -0,0 +1,414 @@ -+// 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. -+// -+// Copyright (c) 2007, 2008 Novell, Inc. -+// Copyright (c) 2013 Jo Shields -+// -+// Authors: -+// Andreia Gaita (avidigal@novell.com) -+// Jo Shields (directhex@apebox.org) -+// -+ -+#undef debug -+ -+using System; -+using System.Collections; -+using System.Reflection; -+using System.Runtime.InteropServices; -+using System.Text; -+using System.Diagnostics; -+using Mono.WebBrowser; -+using Mono.WebBrowser.DOM; -+ -+namespace Mono.NullBrowser -+{ -+ internal class WebBrowser : IWebBrowser -+ { -+ bool loaded; -+ internal bool created = false; -+ bool creating = false; -+ -+ internal DOM.Navigation navigation; -+ -+ internal Platform platform; -+ internal Platform enginePlatform; -+ System.ComponentModel.EventHandlerList events; -+ System.ComponentModel.EventHandlerList domEvents; -+ -+ string statusText; -+ -+ bool streamingMode; -+ -+ internal Hashtable documents; -+ -+ int width; -+ int height; -+ bool isDirty; -+ -+ public WebBrowser (Platform platform) -+ { -+ this.platform = platform; -+ loaded = Base.Init (this, platform); -+ documents = new Hashtable (); -+ } -+ -+ public bool Load (IntPtr handle, int width, int height) -+ { -+ loaded = Base.Bind (this, handle, width, height); -+ return loaded; -+ } -+ -+ bool Created { -+ get { -+ if (!creating && !created) { -+ creating = true; -+ created = Base.Create (this); -+ if (created && isDirty) { -+ isDirty = false; -+ Base.Resize (this, width, height); -+ } -+ } -+ return created; -+ } -+ } -+ -+ public void Shutdown () -+ { -+ Base.Shutdown (this); -+ } -+ -+ internal void Reset () -+ { -+ this.DomEvents.Dispose (); -+ this.domEvents = null; -+ this.documents.Clear (); -+ } -+ -+ public bool Initialized { -+ get { return this.loaded; } -+ } -+ -+ public IWindow Window { -+ get { -+ return null; -+ } -+ } -+ -+ public IDocument Document { -+ get { -+ return null; -+ } -+ } -+ -+ public INavigation Navigation { -+ get { -+ if (!Created) return null; -+ -+ if (navigation == null) { -+ -+ navigation = new DOM.Navigation (); -+ } -+ return navigation as INavigation; -+ } -+ } -+ -+ public string StatusText { -+ get { return statusText; } -+ } -+ -+ public bool Offline { -+ get { -+ return false; -+ } -+ set { -+ } -+ } -+ -+ internal System.ComponentModel.EventHandlerList DomEvents { -+ get { -+ if (domEvents == null) -+ domEvents = new System.ComponentModel.EventHandlerList(); -+ -+ return domEvents; -+ } -+ } -+ -+ internal System.ComponentModel.EventHandlerList Events { -+ get { -+ if (events == null) -+ events = new System.ComponentModel.EventHandlerList(); -+ -+ return events; -+ } -+ } -+ -+ #region Layout -+ public void FocusIn (FocusOption focus) -+ { -+ if (!created) return; -+ Base.Focus (this, focus); -+ } -+ public void FocusOut () -+ { -+ if (!created) return; -+ Base.Blur (this); -+ } -+ -+ public void Activate () -+ { -+ if (!Created) return; -+ Base.Activate (this); -+ } -+ public void Deactivate () -+ { -+ if (!created) return; -+ Base.Deactivate (this); -+ } -+ -+ public void Resize (int width, int height) -+ { -+ this.width = width; -+ this.height = height; -+ isDirty = true; -+ if (!created) return; -+ Base.Resize (this, width, height); -+ } -+ -+ public void Render (byte[] data) -+ { -+ if (!Created) return; -+ if (data == null) -+ throw new ArgumentNullException ("data"); -+ string html = System.Text.ASCIIEncoding.UTF8.GetString (data); -+ Render (html); -+ } -+ -+ public void Render (string html) -+ { -+ if (!Created) return; -+ Render (html, "file:///", "text/html"); -+ } -+ -+ -+ public void Render (string html, string uri, string contentType) -+ { -+ if (!Created) return; -+ throw new Mono.WebBrowser.Exception (Mono.WebBrowser.Exception.ErrorCodes.Navigation); -+ -+ IntPtr native_html = Marshal.StringToHGlobalAnsi (html); -+ Marshal.FreeHGlobal (native_html); -+ -+ -+ } -+ -+ public void ExecuteScript (string script) { -+ if (!Created) return; -+ Base.EvalScript (this, script); -+ } -+ -+ internal void AttachEvent (INode node, string eve, EventHandler handler) { -+ string key = String.Intern (node.GetHashCode() + ":" + eve); -+#if debug -+ Console.Error.WriteLine ("Event Attached: " + key); -+#endif -+ DomEvents.AddHandler (key, handler); -+ } -+ -+ internal void DetachEvent (INode node, string eve, EventHandler handler) { -+ string key = String.Intern (node.GetHashCode() + ":" + eve); -+#if debug -+ Console.Error.WriteLine ("Event Detached: " + key); -+#endif -+ DomEvents.RemoveHandler (key, handler); -+ } -+ -+ #endregion -+ -+ #region Events -+ internal static object KeyDownEvent = new object (); -+ internal static object KeyPressEvent = new object (); -+ internal static object KeyUpEvent = new object (); -+ internal static object MouseClickEvent = new object (); -+ internal static object MouseDoubleClickEvent = new object (); -+ internal static object MouseDownEvent = new object (); -+ internal static object MouseEnterEvent = new object (); -+ internal static object MouseLeaveEvent = new object (); -+ internal static object MouseMoveEvent = new object (); -+ internal static object MouseUpEvent = new object (); -+ internal static object FocusEvent = new object (); -+ internal static object BlurEvent = new object (); -+ internal static object CreateNewWindowEvent = new object (); -+ internal static object AlertEvent = new object (); -+ -+ internal static object LoadStartedEvent = new object (); -+ internal static object LoadCommitedEvent = new object (); -+ internal static object ProgressChangedEvent = new object (); -+ internal static object LoadFinishedEvent = new object (); -+ -+ internal static object LoadEvent = new object (); -+ internal static object UnloadEvent = new object (); -+ internal static object StatusChangedEvent = new object (); -+ internal static object SecurityChangedEvent = new object (); -+ internal static object ProgressEvent = new object (); -+ internal static object ContextMenuEvent = new object (); -+ -+ internal static object NavigationRequestedEvent = new object (); -+ -+ public event NodeEventHandler KeyDown -+ { -+ add { Events.AddHandler (KeyDownEvent, value); } -+ remove { Events.RemoveHandler (KeyDownEvent, value); } -+ } -+ -+ public event NodeEventHandler KeyPress -+ { -+ add { Events.AddHandler (KeyPressEvent, value); } -+ remove { Events.RemoveHandler (KeyPressEvent, value); } -+ } -+ public event NodeEventHandler KeyUp -+ { -+ add { Events.AddHandler (KeyUpEvent, value); } -+ remove { Events.RemoveHandler (KeyUpEvent, value); } -+ } -+ public event NodeEventHandler MouseClick -+ { -+ add { Events.AddHandler (MouseClickEvent, value); } -+ remove { Events.RemoveHandler (MouseClickEvent, value); } -+ } -+ public event NodeEventHandler MouseDoubleClick -+ { -+ add { Events.AddHandler (MouseDoubleClickEvent, value); } -+ remove { Events.RemoveHandler (MouseDoubleClickEvent, value); } -+ } -+ public event NodeEventHandler MouseDown -+ { -+ add { Events.AddHandler (MouseDownEvent, value); } -+ remove { Events.RemoveHandler (MouseDownEvent, value); } -+ } -+ public event NodeEventHandler MouseEnter -+ { -+ add { Events.AddHandler (MouseEnterEvent, value); } -+ remove { Events.RemoveHandler (MouseEnterEvent, value); } -+ } -+ public event NodeEventHandler MouseLeave -+ { -+ add { Events.AddHandler (MouseLeaveEvent, value); } -+ remove { Events.RemoveHandler (MouseLeaveEvent, value); } -+ } -+ public event NodeEventHandler MouseMove -+ { -+ add { Events.AddHandler (MouseMoveEvent, value); } -+ remove { Events.RemoveHandler (MouseMoveEvent, value); } -+ } -+ public event NodeEventHandler MouseUp -+ { -+ add { Events.AddHandler (MouseUpEvent, value); } -+ remove { Events.RemoveHandler (MouseUpEvent, value); } -+ } -+ public event EventHandler Focus -+ { -+ add { Events.AddHandler (FocusEvent, value); } -+ remove { Events.RemoveHandler (FocusEvent, value); } -+ } -+ public event EventHandler Blur -+ { -+ add { Events.AddHandler (BlurEvent, value); } -+ remove { Events.RemoveHandler (BlurEvent, value); } -+ } -+ public event CreateNewWindowEventHandler CreateNewWindow -+ { -+ add { Events.AddHandler (CreateNewWindowEvent, value); } -+ remove { Events.RemoveHandler (CreateNewWindowEvent, value); } -+ } -+ public event AlertEventHandler Alert -+ { -+ add { Events.AddHandler (AlertEvent, value); } -+ remove { Events.RemoveHandler (AlertEvent, value); } -+ } -+ public event EventHandler Loaded -+ { -+ add { Events.AddHandler (LoadEvent, value); } -+ remove { Events.RemoveHandler (LoadEvent, value); } -+ } -+ public event EventHandler Unloaded -+ { -+ add { Events.AddHandler (UnloadEvent, value); } -+ remove { Events.RemoveHandler (UnloadEvent, value); } -+ } -+ -+ public event StatusChangedEventHandler StatusChanged -+ { -+ add { Events.AddHandler (StatusChangedEvent, value); } -+ remove { Events.RemoveHandler (StatusChangedEvent, value); } -+ } -+ -+ public event SecurityChangedEventHandler SecurityChanged -+ { -+ add { Events.AddHandler (SecurityChangedEvent, value); } -+ remove { Events.RemoveHandler (SecurityChangedEvent, value); } -+ } -+ -+ public event LoadStartedEventHandler LoadStarted -+ { -+ add { Events.AddHandler (LoadStartedEvent, value); } -+ remove { Events.RemoveHandler (LoadStartedEvent, value); } -+ } -+ -+ public event LoadCommitedEventHandler LoadCommited -+ { -+ add { Events.AddHandler (LoadCommitedEvent, value); } -+ remove { Events.RemoveHandler (LoadCommitedEvent, value); } -+ } -+ -+ public event ProgressChangedEventHandler ProgressChanged -+ { -+ add { Events.AddHandler (ProgressChangedEvent, value); } -+ remove { Events.RemoveHandler (ProgressChangedEvent, value); } -+ } -+ -+ public event LoadFinishedEventHandler LoadFinished -+ { -+ add { Events.AddHandler (LoadFinishedEvent, value); } -+ remove { Events.RemoveHandler (LoadFinishedEvent, value); } -+ } -+ -+ public event ContextMenuEventHandler ContextMenuShown -+ { -+ add { Events.AddHandler (ContextMenuEvent, value); } -+ remove { Events.RemoveHandler (ContextMenuEvent, value); } -+ } -+ -+ public event NavigationRequestedEventHandler NavigationRequested -+ { -+ add { } -+ remove { } -+ } -+ -+ internal static object GenericEvent = new object (); -+ internal event EventHandler Generic -+ { -+ add { Events.AddHandler (GenericEvent, value); } -+ remove { Events.RemoveHandler (GenericEvent, value); } -+ } -+ -+ #endregion -+ -+ -+ } -+} ---- mono-4.2.1.102+dfsg2.orig/mcs/class/Mono.WebBrowser/Mono.WebBrowser.dll.sources -+++ mono-4.2.1.102+dfsg2/mcs/class/Mono.WebBrowser/Mono.WebBrowser.dll.sources -@@ -133,6 +133,9 @@ Mono.Mozilla/interfaces/nsIWebNavigation - Mono.Mozilla/interfaces/extras/NodeType.cs - Mono.Mozilla/interfaces/extras/nsIWriteSegmentFun.cs - Mono.Mozilla/interfaces/extras/Options.cs -+Mono.NullBrowser/Base.cs -+Mono.NullBrowser/WebBrowser.cs -+Mono.NullBrowser/DOM/Navigation.cs - Mono.WebBrowser/DOM/IDocumentType.cs - Mono.WebBrowser/DOM/IDOMImplementation.cs - Mono.WebBrowser/DOM/IMediaList.cs ---- mono-4.2.1.102+dfsg2.orig/mcs/class/Mono.WebBrowser/Mono.WebBrowser/Manager.cs -+++ mono-4.2.1.102+dfsg2/mcs/class/Mono.WebBrowser/Mono.WebBrowser/Manager.cs -@@ -50,8 +50,15 @@ namespace Mono.WebBrowser - browserEngine = null; - } - } -- if (browserEngine == null || browserEngine == "mozilla") -- return new Mono.Mozilla.WebBrowser (platform); -+ if (browserEngine == "mozilla") { -+ try { -+ return new Mono.Mozilla.WebBrowser (platform); -+ } catch { -+ browserEngine = null; -+ } -+ } -+ if (browserEngine == null) -+ return new Mono.NullBrowser.WebBrowser (platform); - throw new Exception (Mono.WebBrowser.Exception.ErrorCodes.EngineNotSupported, browserEngine); - } - ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/ReferenceSources/DbConnectionStringDefaults.cs -@@ -0,0 +1,57 @@ -+using System.Data.SqlClient; -+ -+namespace System.Data.Common { -+ internal static class DbConnectionStringDefaults { -+ // all -+// internal const string NamedConnection = ""; -+ -+ // Odbc -+ internal const string Driver = ""; -+ internal const string Dsn = ""; -+ -+ // OleDb -+ internal const bool AdoNetPooler = false; -+ internal const string FileName = ""; -+ internal const int OleDbServices = ~(/*DBPROPVAL_OS_AGR_AFTERSESSION*/0x00000008 | /*DBPROPVAL_OS_CLIENTCURSOR*/0x00000004); // -13 -+ internal const string Provider = ""; -+ -+ // OracleClient -+ internal const bool Unicode = false; -+ internal const bool OmitOracleConnectionName = false; -+ -+ // SqlClient -+ internal const ApplicationIntent ApplicationIntent = System.Data.SqlClient.ApplicationIntent.ReadWrite; -+ internal const string ApplicationName = ".Net SqlClient Data Provider"; -+ internal const bool AsynchronousProcessing = false; -+ internal const string AttachDBFilename = ""; -+ internal const int ConnectTimeout = 15; -+ internal const bool ConnectionReset = true; -+ internal const bool ContextConnection = false; -+ internal const string CurrentLanguage = ""; -+ internal const string DataSource = ""; -+ internal const bool Encrypt = false; -+ internal const bool Enlist = true; -+ internal const string FailoverPartner = ""; -+ internal const string InitialCatalog = ""; -+ internal const bool IntegratedSecurity = false; -+ internal const int LoadBalanceTimeout = 0; // default of 0 means don't use -+ internal const bool MultipleActiveResultSets = false; -+ internal const bool MultiSubnetFailover = false; -+ internal const int MaxPoolSize = 100; -+ internal const int MinPoolSize = 0; -+ internal const string NetworkLibrary = ""; -+ internal const int PacketSize = 8000; -+ internal const string Password = ""; -+ internal const bool PersistSecurityInfo = false; -+ internal const bool Pooling = true; -+ internal const bool TrustServerCertificate = false; -+ internal const string TypeSystemVersion = "Latest"; -+ internal const string UserID = ""; -+ internal const bool UserInstance = false; -+ internal const bool Replication = false; -+ internal const string WorkstationID = ""; -+ internal const string TransactionBinding = "Implicit Unbind"; -+ internal const int ConnectRetryCount = 1; -+ internal const int ConnectRetryInterval = 10; -+ } -+} -\ No newline at end of file ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs -@@ -0,0 +1,131 @@ -+// -+// System.Data.Common.DataColumnMapping.cs -+// -+// Authors: -+// Rodrigo Moya (rodrigo@ximian.com) -+// Tim Coleman (tim@timcoleman.com) -+// -+// (C) Ximian, Inc -+// Copyright (C) Tim Coleman, 2002-2003 -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.ComponentModel; -+using System.Data; -+ -+namespace System.Data.Common { -+#if NET_2_0 -+ [TypeConverterAttribute ("System.Data.Common.DataColumnMapping+DataColumnMappingConverter, " + Consts.AssemblySystem_Data)] -+#else -+ [TypeConverterAttribute (typeof (DataColumnMappingConverter))] -+#endif -+ public sealed class DataColumnMapping : MarshalByRefObject, IColumnMapping, ICloneable -+ { -+ #region Fields -+ -+ string sourceColumn; -+ string dataSetColumn; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+ public DataColumnMapping () -+ { -+ sourceColumn = String.Empty; -+ dataSetColumn = String.Empty; -+ } -+ -+ public DataColumnMapping (string sourceColumn, string dataSetColumn) -+ { -+ this.sourceColumn = sourceColumn; -+ this.dataSetColumn = dataSetColumn; -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+#if ONLY_1_1 -+ [DataSysDescription ("DataColumn.ColumnName")] -+#endif -+ [DefaultValue ("")] -+ public string DataSetColumn { -+ get { return dataSetColumn; } -+ set { dataSetColumn = value; } -+ } -+ -+#if !NET_2_0 -+ [DataSysDescription ("Source column name - case sensitive.")] -+#endif -+ [DefaultValue ("")] -+ public string SourceColumn { -+ get { return sourceColumn; } -+ set { sourceColumn = value; } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public DataColumn GetDataColumnBySchemaAction (DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) -+ { -+ if (dataTable.Columns.Contains (dataSetColumn)) -+ return dataTable.Columns [dataSetColumn]; -+ if (schemaAction == MissingSchemaAction.Ignore) -+ return null; -+ if (schemaAction == MissingSchemaAction.Error) -+ throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", DataSetColumn, dataTable.TableName, SourceColumn)); -+ return new DataColumn (dataSetColumn, dataType); -+ } -+ -+#if NET_2_0 -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public static DataColumn GetDataColumnBySchemaAction (string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) -+ { -+ if (dataTable.Columns.Contains (dataSetColumn)) -+ return dataTable.Columns [dataSetColumn]; -+ if (schemaAction == MissingSchemaAction.Ignore) -+ return null; -+ if (schemaAction == MissingSchemaAction.Error) -+ throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", dataSetColumn, dataTable.TableName, sourceColumn)); -+ return new DataColumn (dataSetColumn, dataType); -+ } -+#endif -+ -+ object ICloneable.Clone () -+ { -+ return new DataColumnMapping (SourceColumn, DataSetColumn); -+ } -+ -+ public override string ToString () -+ { -+ return SourceColumn; -+ } -+ -+ #endregion // Methods -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs -@@ -0,0 +1,338 @@ -+// -+// System.Data.Common.DataColumnMappingCollection -+// -+// Authors: -+// Rodrigo Moya (rodrigo@ximian.com) -+// Tim Coleman (tim@timcoleman.com) -+// -+// (C) Ximian, Inc -+// Copyright (C) Tim Coleman, 2002-2003 -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System; -+using System.Collections; -+using System.ComponentModel; -+using System.Data; -+ -+namespace System.Data.Common -+{ -+ public sealed class DataColumnMappingCollection : MarshalByRefObject, IColumnMappingCollection , IList, ICollection, IEnumerable -+ { -+ #region Fields -+ -+ readonly ArrayList list; -+ readonly Hashtable sourceColumns; -+ readonly Hashtable dataSetColumns; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+ public DataColumnMappingCollection () -+ { -+ list = new ArrayList (); -+ sourceColumns = new Hashtable (); -+ dataSetColumns = new Hashtable (); -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ [Browsable (false)] -+#if !NET_2_0 -+ [DataSysDescription ("The number of items in the collection")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ public int Count { -+ get { return list.Count; } -+ } -+ -+ [Browsable (false)] -+#if !NET_2_0 -+ [DataSysDescription ("The specified DataColumnMapping object.")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ public DataColumnMapping this [int index] { -+ get { return (DataColumnMapping)(list[index]); } -+ set { -+ DataColumnMapping mapping = (DataColumnMapping)(list[index]); -+ sourceColumns[mapping] = value; -+ dataSetColumns[mapping] = value; -+ list[index] = value; -+ } -+ } -+ -+ [Browsable (false)] -+#if !NET_2_0 -+ [DataSysDescription ("The specified DataColumnMapping object.")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ public DataColumnMapping this [string sourceColumn] { -+ get { -+ if (!Contains(sourceColumn)) -+ throw new IndexOutOfRangeException("DataColumnMappingCollection doesn't contain DataColumnMapping with SourceColumn '" + sourceColumn + "'."); -+ return (DataColumnMapping) sourceColumns [sourceColumn]; -+ } -+ set { -+ this [list.IndexOf (sourceColumns [sourceColumn])] = value; -+ } -+ } -+ -+ object ICollection.SyncRoot { -+ get { return list.SyncRoot; } -+ } -+ -+ bool ICollection.IsSynchronized { -+ get { return list.IsSynchronized; } -+ } -+ -+ object IColumnMappingCollection.this [string index] { -+ get { return this [index]; } -+ set { -+ if (!(value is DataColumnMapping)) -+ throw new ArgumentException (); -+ this [index] = (DataColumnMapping) value; -+ } -+ } -+ -+ object IList.this [int index] { -+ get { return this [index]; } -+ set { -+ if (!(value is DataColumnMapping)) -+ throw new ArgumentException (); -+ this [index] = (DataColumnMapping) value; -+ } -+ } -+ -+ bool IList.IsReadOnly { -+ get { return false; } -+ } -+ -+ bool IList.IsFixedSize { -+ get { return false; } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ public int Add (object value) -+ { -+ if (!(value is DataColumnMapping)) -+ throw new InvalidCastException (); -+ -+ list.Add (value); -+ sourceColumns [((DataColumnMapping) value).SourceColumn] = value; -+ dataSetColumns [((DataColumnMapping )value).DataSetColumn] = value; -+ return list.IndexOf (value); -+ } -+ -+ public DataColumnMapping Add (string sourceColumn, string dataSetColumn) -+ { -+ DataColumnMapping mapping = new DataColumnMapping (sourceColumn, dataSetColumn); -+ Add (mapping); -+ return mapping; -+ } -+ -+#if NET_2_0 -+ public void AddRange (Array values) -+ { -+ for (int i = 0; i < values.Length; ++i) -+ Add (values.GetValue (i)); -+ } -+#endif -+ -+ public void AddRange (DataColumnMapping[] values) -+ { -+ foreach (DataColumnMapping mapping in values) -+ Add (mapping); -+ } -+ -+ public void Clear () -+ { -+ list.Clear (); -+ } -+ -+ public bool Contains (object value) -+ { -+ if (!(value is DataColumnMapping)) -+ throw new InvalidCastException("Object is not of type DataColumnMapping"); -+ return (list.Contains (value)); -+ } -+ -+ public bool Contains (string value) -+ { -+ return (sourceColumns.Contains (value)); -+ } -+ -+ public void CopyTo (Array array, int index) -+ { -+ list.CopyTo (array,index); -+ } -+ -+#if NET_2_0 -+ public void CopyTo (DataColumnMapping [] array, int index) -+ { -+ list.CopyTo (array, index); -+ } -+#endif -+ -+ public DataColumnMapping GetByDataSetColumn (string value) -+ { -+ // this should work case-insenstive. -+ if (!(dataSetColumns [value] == null)) -+ return (DataColumnMapping) (dataSetColumns [value]); -+ else { -+ string lowcasevalue = value.ToLower (); -+ object [] keyarray = new object [dataSetColumns.Count]; -+ dataSetColumns.Keys.CopyTo (keyarray, 0); -+ for (int i = 0; i < keyarray.Length; i++) { -+ string temp = (string) keyarray [i]; -+ if (lowcasevalue.Equals (temp.ToLower ())) -+ return (DataColumnMapping) (dataSetColumns [keyarray [i]]); -+ } -+ return null; -+ } -+ } -+ -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public static DataColumnMapping GetColumnMappingBySchemaAction (DataColumnMappingCollection columnMappings, string sourceColumn, MissingMappingAction mappingAction) -+ { -+ if (columnMappings.Contains (sourceColumn)) -+ return columnMappings[sourceColumn]; -+ if (mappingAction == MissingMappingAction.Ignore) -+ return null; -+ if (mappingAction == MissingMappingAction.Error) -+ throw new InvalidOperationException (String.Format ("Missing SourceColumn mapping for '{0}'", sourceColumn)); -+ return new DataColumnMapping (sourceColumn, sourceColumn); -+ } -+ -+#if NET_2_0 -+ [MonoTODO] -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public static DataColumn GetDataColumn (DataColumnMappingCollection columnMappings, string sourceColumn, Type dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction) -+ { -+ throw new NotImplementedException (); -+ } -+#endif -+ -+ public IEnumerator GetEnumerator () -+ { -+ return list.GetEnumerator (); -+ } -+ -+ IColumnMapping IColumnMappingCollection.Add (string sourceColumnName, string dataSetColumnName) -+ { -+ return Add (sourceColumnName, dataSetColumnName); -+ } -+ -+ IColumnMapping IColumnMappingCollection.GetByDataSetColumn (string dataSetColumnName) -+ { -+ return GetByDataSetColumn (dataSetColumnName); -+ } -+ -+ public int IndexOf (object value) -+ { -+ return list.IndexOf (value); -+ } -+ -+ public int IndexOf (string sourceColumn) -+ { -+ return list.IndexOf (sourceColumns [sourceColumn]); -+ } -+ -+ public int IndexOfDataSetColumn (string dataSetColumn) -+ { -+ // this should work case-insensitive -+ if (!(dataSetColumns [dataSetColumn] == null)) -+ return list.IndexOf (dataSetColumns [dataSetColumn]); -+ else { -+ string lowcasevalue = dataSetColumn.ToLower (); -+ object [] keyarray = new object[dataSetColumns.Count]; -+ dataSetColumns.Keys.CopyTo (keyarray,0); -+ for (int i = 0; i < keyarray.Length; i++) { -+ string temp = (string) keyarray [i]; -+ if (lowcasevalue.Equals (temp.ToLower ())) -+ return list.IndexOf (dataSetColumns [keyarray [i]]); -+ } -+ return -1; -+ } -+ } -+ -+ public void Insert (int index, object value) -+ { -+ list.Insert (index, value); -+ sourceColumns [((DataColumnMapping) value).SourceColumn] = value; -+ dataSetColumns [((DataColumnMapping) value).DataSetColumn] = value; -+ } -+ -+#if NET_2_0 -+ public void Insert (int index, DataColumnMapping value) -+ { -+ list.Insert (index, value); -+ sourceColumns [value.SourceColumn] = value; -+ dataSetColumns [value.DataSetColumn] = value; -+ } -+#endif -+ -+ public void Remove (object value) -+ { -+ int index = list.IndexOf (value); -+ sourceColumns.Remove (((DataColumnMapping) value).SourceColumn); -+ dataSetColumns.Remove (((DataColumnMapping) value).DataSetColumn); -+ if (index < 0 || index >=list.Count) -+ throw new ArgumentException("There is no such element in collection."); -+ list.Remove (value); -+ } -+ -+#if NET_2_0 -+ public void Remove (DataColumnMapping value) -+ { -+ int index = list.IndexOf (value); -+ sourceColumns.Remove (value.SourceColumn); -+ dataSetColumns.Remove (value.DataSetColumn); -+ if ( index < 0 || index >=list.Count) -+ throw new ArgumentException("There is no such element in collection."); -+ list.Remove (value); -+ } -+#endif -+ -+ public void RemoveAt (int index) -+ { -+ if (index < 0 || index >=list.Count) -+ throw new IndexOutOfRangeException("There is no element in collection."); -+ Remove (list [index]); -+ } -+ -+ public void RemoveAt (string sourceColumn) -+ { -+ RemoveAt (list.IndexOf (sourceColumns [sourceColumn])); -+ } -+ -+ #endregion // Methods -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DataColumnMappingConverter.cs -@@ -0,0 +1,59 @@ -+// -+// System.Data.Common.DataColumnMappingConverter.cs -+// -+// Author: -+// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -+// -+// (C) 2004 Andreas Nahr -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System; -+using System.Globalization; -+using System.ComponentModel; -+ -+namespace System.Data.Common -+{ -+ internal sealed class DataColumnMappingConverter : ExpandableObjectConverter -+ { -+ [MonoTODO] -+ public DataColumnMappingConverter () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) -+ { -+ throw new NotImplementedException (); -+ } -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs -@@ -0,0 +1,159 @@ -+// -+// System.Data.Common.DataTableMapping.cs -+// -+// Authors: -+// Rodrigo Moya (rodrigo@ximian.com) -+// Tim Coleman (tim@timcoleman.com) -+// -+// (C) Ximian, Inc -+// Copyright (C) Tim Coleman, 2002-2003 -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.ComponentModel; -+using System.Data; -+ -+namespace System.Data.Common { -+#if NET_2_0 -+ [TypeConverterAttribute ("System.Data.Common.DataTableMapping+DataTableMappingConverter, " + Consts.AssemblySystem_Data)] -+#else -+ [TypeConverterAttribute (typeof (DataTableMappingConverter))] -+#endif -+ public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable -+ { -+ #region Fields -+ -+ string sourceTable; -+ string dataSetTable; -+ DataColumnMappingCollection columnMappings; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+ public DataTableMapping () -+ { -+ dataSetTable = String.Empty; -+ sourceTable = String.Empty; -+ columnMappings = new DataColumnMappingCollection (); -+ } -+ -+ public DataTableMapping (string sourceTable, string dataSetTable) -+ : this () -+ { -+ this.sourceTable = sourceTable; -+ this.dataSetTable = dataSetTable; -+ } -+ -+ public DataTableMapping (string sourceTable, string dataSetTable, DataColumnMapping[] columnMappings) -+ : this (sourceTable, dataSetTable) -+ { -+ this.columnMappings.AddRange (columnMappings); -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+#if !NET_2_0 -+ [DataSysDescription ("Individual columns mappings when this table mapping is matched.")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] -+ public DataColumnMappingCollection ColumnMappings { -+ get { return columnMappings; } -+ } -+ -+#if !NET_2_0 -+ [DataSysDescription ("DataTable.TableName")] -+#endif -+ [DefaultValue ("")] -+ public string DataSetTable { -+ get { return dataSetTable; } -+ set { dataSetTable = value; } -+ } -+ -+ IColumnMappingCollection ITableMapping.ColumnMappings { -+ get { return ColumnMappings; } -+ } -+ -+#if !NET_2_0 -+ [DataSysDescription ("The DataTableMapping source table name. This name is case sensitive.")] -+#endif -+ [DefaultValue ("")] -+ public string SourceTable { -+ get { return sourceTable; } -+ set { sourceTable = value; } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction) -+ { -+ return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction); -+ } -+ -+#if NET_2_0 -+ [MonoTODO] -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public DataColumn GetDataColumn (string sourceColumn, -+ Type dataType, -+ DataTable dataTable, -+ MissingMappingAction mappingAction, -+ MissingSchemaAction schemaAction) -+ { -+ throw new NotImplementedException (); -+ } -+#endif -+ -+ [EditorBrowsable (EditorBrowsableState.Advanced)] -+ public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction) -+ { -+ if (dataSet.Tables.Contains (DataSetTable)) -+ return dataSet.Tables [DataSetTable]; -+ if (schemaAction == MissingSchemaAction.Ignore) -+ return null; -+ if (schemaAction == MissingSchemaAction.Error) -+ throw new InvalidOperationException (String.Format ("Missing the '{0} DataTable for the '{1}' SourceTable", DataSetTable, SourceTable)); -+ return new DataTable (DataSetTable); -+ } -+ -+ object ICloneable.Clone () -+ { -+ DataColumnMapping [] arr = new DataColumnMapping [columnMappings.Count]; -+ columnMappings.CopyTo (arr, 0); -+ return new DataTableMapping (SourceTable, DataSetTable, arr); -+ } -+ -+ public override string ToString () -+ { -+ return SourceTable; -+ } -+ -+ #endregion // Methods -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs -@@ -0,0 +1,326 @@ -+// -+// System.Data.Common.DataTableMappingCollection.cs -+// -+// Author: -+// Rodrigo Moya (rodrigo@ximian.com) -+// Tim Coleman (tim@timcoleman.com) -+// -+// (C) Ximian, Inc -+// Copyright (C) Tim Coleman, 2002-2003 -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System; -+using System.Collections; -+using System.ComponentModel; -+ -+namespace System.Data.Common -+{ -+ [ListBindable (false)] -+ [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DataTableMappingCollectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] -+ public sealed class DataTableMappingCollection : MarshalByRefObject, ITableMappingCollection, IList, ICollection, IEnumerable -+ { -+ #region Fields -+ -+ ArrayList mappings; -+ Hashtable sourceTables; -+ Hashtable dataSetTables; -+ -+ #endregion -+ -+ #region Constructors -+ -+ public DataTableMappingCollection() -+ { -+ mappings = new ArrayList (); -+ sourceTables = new Hashtable (); -+ dataSetTables = new Hashtable (); -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ [Browsable (false)] -+#if !NET_2_0 -+ [DataSysDescription ("The number of items in the collection")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ public int Count { -+ get { return mappings.Count; } -+ } -+ -+ [Browsable (false)] -+#if !NET_2_0 -+ [DataSysDescription ("The specified DataTableMapping object")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ public DataTableMapping this [int index] { -+ get { return (DataTableMapping)(mappings[index]); } -+ set { -+ DataTableMapping mapping = (DataTableMapping) mappings[index]; -+ sourceTables [mapping.SourceTable] = value; -+ dataSetTables [mapping.DataSetTable] = value; -+ mappings [index] = value; -+ } -+ } -+ -+ [Browsable (false)] -+#if !NET_2_0 -+ [DataSysDescription ("The specified DataTableMapping object")] -+#endif -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ public DataTableMapping this [string sourceTable] { -+ get { return (DataTableMapping) sourceTables[sourceTable]; } -+ set { this [mappings.IndexOf (sourceTables[sourceTable])] = value; } -+ } -+ -+ object IList.this [int index] { -+ get { return (object)(this[index]); } -+ set { -+ if (!(value is DataTableMapping)) -+ throw new ArgumentException (); -+ this[index] = (DataTableMapping)value; -+ } -+ } -+ -+ bool ICollection.IsSynchronized { -+ get { return mappings.IsSynchronized; } -+ } -+ -+ object ICollection.SyncRoot { -+ get { return mappings.SyncRoot; } -+ } -+ -+ bool IList.IsFixedSize { -+ get { return false; } -+ } -+ -+ bool IList.IsReadOnly { -+ get { return false; } -+ } -+ -+ object ITableMappingCollection.this [string index] { -+ get { return this [index]; } -+ set { -+ if (!(value is DataTableMapping)) -+ throw new ArgumentException (); -+ this [index] = (DataTableMapping) value; -+ } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ public int Add (object value) -+ { -+ if (!(value is System.Data.Common.DataTableMapping)) -+ throw new InvalidCastException ("The object passed in was not a DataTableMapping object."); -+ -+ sourceTables [((DataTableMapping) value).SourceTable] = value; -+ dataSetTables [((DataTableMapping) value).DataSetTable] = value; -+ return mappings.Add (value); -+ } -+ -+ public DataTableMapping Add (string sourceTable, string dataSetTable) -+ { -+ DataTableMapping mapping = new DataTableMapping (sourceTable, dataSetTable); -+ Add (mapping); -+ return mapping; -+ } -+ -+#if NET_2_0 -+ public void AddRange (Array values) -+ { -+ for (int i = 0; i < values.Length; ++i) -+ Add (values.GetValue (i)); -+ } -+#endif -+ -+ public void AddRange (DataTableMapping[] values) -+ { -+ foreach (DataTableMapping dataTableMapping in values) -+ this.Add (dataTableMapping); -+ } -+ -+ public void Clear () -+ { -+ sourceTables.Clear (); -+ dataSetTables.Clear (); -+ mappings.Clear (); -+ } -+ -+ public bool Contains (object value) -+ { -+ return mappings.Contains (value); -+ } -+ -+ public bool Contains (string value) -+ { -+ return sourceTables.Contains (value); -+ } -+ -+ public void CopyTo (Array array, int index) -+ { -+ mappings.CopyTo (array, index); -+ } -+ -+#if NET_2_0 -+ public void CopyTo (DataTableMapping[] array, int index) -+ { -+ mappings.CopyTo (array, index); -+ } -+#endif -+ -+ public DataTableMapping GetByDataSetTable (string dataSetTable) -+ { -+ // this should work case-insenstive. -+ if (!(dataSetTables[dataSetTable] == null)) -+ return (DataTableMapping) (dataSetTables [dataSetTable]); -+ else { -+ string lowcasevalue = dataSetTable.ToLower (); -+ object [] keyarray = new object [dataSetTables.Count]; -+ dataSetTables.Keys.CopyTo (keyarray, 0); -+ for (int i=0; i= mappings.Count) -+ throw new ArgumentException("There is no such element in collection."); -+ mappings.Remove ((DataTableMapping) value); -+ } -+ -+#if NET_2_0 -+ public void Remove (DataTableMapping value) -+ { -+ int index = mappings.IndexOf (value); -+ if (index < 0 || index >= mappings.Count) -+ throw new ArgumentException("There is no such element in collection."); -+ mappings.Remove ((DataTableMapping) value); -+ } -+#endif -+ -+ public void RemoveAt (int index) -+ { -+ if (index < 0 || index >= mappings.Count) -+ throw new IndexOutOfRangeException("There is no element in collection."); -+ -+ mappings.RemoveAt (index); -+ } -+ -+ public void RemoveAt (string sourceTable) -+ { -+ RemoveAt (mappings.IndexOf (sourceTables[sourceTable])); -+ } -+ -+ #endregion // Methods -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DataTableMappingConverter.cs -@@ -0,0 +1,59 @@ -+// -+// System.Data.Common.DataTableMappingConverter.cs -+// -+// Author: -+// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -+// -+// (C) 2004 Andreas Nahr -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System; -+using System.Globalization; -+using System.ComponentModel; -+ -+namespace System.Data.Common -+{ -+ internal sealed class DataTableMappingConverter : ExpandableObjectConverter -+ { -+ [MonoTODO] -+ public DataTableMappingConverter () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) -+ { -+ throw new NotImplementedException (); -+ } -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DbConnectionOptions.cs -@@ -0,0 +1,257 @@ -+// -+// System.Data.Common.DbConnectionOptions -+// adapted from older (pre beta1) DbConnectionString -+// -+// Authors: -+// Tim Coleman (tim@timcoleman.com) -+// Sebastien Pouliot -+// -+// Copyright (C) Tim Coleman, 2003 -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+#if NET_2_0 -+ -+using System.Collections; -+using System.Collections.Specialized; -+using System.Security; -+using System.Text; -+ -+namespace System.Data.Common { -+ -+ internal class DbConnectionOptions { -+ -+ #region Fields -+ -+ internal NameValueCollection options; -+ internal string normalizedConnectionString; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+ internal DbConnectionOptions () -+ { -+ } -+ -+ protected internal DbConnectionOptions (DbConnectionOptions connectionOptions) -+ { -+ options = connectionOptions.options; -+ } -+ -+ public DbConnectionOptions (string connectionString) -+ { -+ options = new NameValueCollection (); -+ ParseConnectionString (connectionString); -+ } -+ -+ [MonoTODO] -+ public DbConnectionOptions (string connectionString, Hashtable synonyms, bool useFirstKeyValuePair) -+ : this (connectionString) -+ { -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ [MonoTODO] -+ public bool IsEmpty { -+ get { throw new NotImplementedException (); } -+ } -+ -+ public string this [string keyword] { -+ get { return options [keyword]; } -+ } -+ -+ public ICollection Keys { -+ get { return options.Keys; } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ [MonoTODO] -+ protected void BuildConnectionString (StringBuilder builder, string[] withoutOptions, string insertValue) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ public bool ContainsKey (string keyword) -+ { -+ return (options.Get (keyword) != null); -+ } -+ -+ public bool ConvertValueToBoolean (string keyname, bool defaultvalue) -+ { -+ if (ContainsKey (keyname)) -+ return Boolean.Parse (this [keyname].Trim ()); -+ return defaultvalue; -+ } -+ -+ public int ConvertValueToInt32 (string keyname, int defaultvalue) -+ { -+ if (ContainsKey (keyname)) -+ return Int32.Parse (this [keyname].Trim ()); -+ return defaultvalue; -+ } -+ -+ [MonoTODO] -+ public bool ConvertValueToIntegratedSecurity () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ public string ConvertValueToString (string keyname, string defaultValue) -+ { -+ if (ContainsKey (keyname)) -+ return this [keyname]; -+ return defaultValue; -+ } -+ -+ [MonoTODO] -+ protected internal virtual PermissionSet CreatePermissionSet () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ protected internal virtual string Expand () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ public static string RemoveKeyValuePairs (string connectionString, string[] keynames) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ public string UsersConnectionString (bool hisPasswordPwd) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ internal void ParseConnectionString (string connectionString) -+ { -+ if (connectionString.Length == 0) -+ return; -+ -+ connectionString += ";"; -+ -+ bool inQuote = false; -+ bool inDQuote = false; -+ bool inName = true; -+ -+ string name = String.Empty; -+ string value = String.Empty; -+ StringBuilder sb = new StringBuilder (); -+ -+ for (int i = 0; i < connectionString.Length; i += 1) { -+ char c = connectionString [i]; -+ char peek; -+ if (i == connectionString.Length - 1) -+ peek = '\0'; -+ else -+ peek = connectionString [i + 1]; -+ -+ switch (c) { -+ case '\'': -+ if (inDQuote) -+ sb.Append (c); -+ else if (peek.Equals (c)) { -+ sb.Append (c); -+ i += 1; -+ } -+ else -+ inQuote = !inQuote; -+ break; -+ case '"': -+ if (inQuote) -+ sb.Append (c); -+ else if (peek.Equals (c)) { -+ sb.Append (c); -+ i += 1; -+ } -+ else -+ inDQuote = !inDQuote; -+ break; -+ case ';': -+ if (inDQuote || inQuote) -+ sb.Append (c); -+ else { -+ if (name != String.Empty && name != null) { -+ value = sb.ToString (); -+ // FIXME - KeywordLookup is an NOP -+ // options [KeywordLookup (name.Trim ())] = value; -+ options [name.Trim ()] = value; -+ } -+ inName = true; -+ name = String.Empty; -+ value = String.Empty; -+ sb = new StringBuilder (); -+ } -+ break; -+ case '=': -+ if (inDQuote || inQuote || !inName) -+ sb.Append (c); -+ else if (peek.Equals (c)) { -+ sb.Append (c); -+ i += 1; -+ } -+ else { -+ name = sb.ToString (); -+ sb = new StringBuilder (); -+ inName = false; -+ } -+ break; -+ case ' ': -+ if (inQuote || inDQuote) -+ sb.Append (c); -+ else if (sb.Length > 0 && !peek.Equals (';')) -+ sb.Append (c); -+ break; -+ default: -+ sb.Append (c); -+ break; -+ } -+ } -+ -+ StringBuilder normalized = new StringBuilder (); -+ ArrayList keys = new ArrayList (); -+ keys.AddRange (Keys); -+ keys.Sort (); -+ foreach (string key in keys) -+ { -+ string entry = String.Format ("{0}=\"{1}\";", key, this [key].Replace ("\"", "\"\"")); -+ normalized.Append (entry); -+ } -+ normalizedConnectionString = normalized.ToString (); -+ } -+ -+ #endregion // Methods -+ } -+} -+ -+#endif ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DbConnectionString.cs -@@ -0,0 +1,113 @@ -+// -+// System.Data.Common.DbConnectionString -+// -+// Authors: -+// Tim Coleman (tim@timcoleman.com) -+// Sebastien Pouliot -+// -+// Copyright (C) Tim Coleman, 2003 -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+#if NET_2_0 -+ -+using System.Collections; -+using System.Collections.Specialized; -+using System.Runtime.Serialization; -+using System.Text; -+ -+namespace System.Data.Common { -+ -+ [Obsolete ()] -+ internal class DbConnectionString : DbConnectionOptions, ISerializable { -+ -+ #region Fields -+ -+ KeyRestrictionBehavior behavior; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+ protected internal DbConnectionString (DbConnectionString constr) -+ { -+ options = constr.options; -+ } -+ -+ public DbConnectionString (string connectionString) -+ : base (connectionString) -+ { -+ options = new NameValueCollection (); -+ ParseConnectionString (connectionString); -+ } -+ -+ [MonoTODO] -+ protected DbConnectionString (SerializationInfo si, StreamingContext sc) -+ { -+ } -+ -+ [MonoTODO] -+ public DbConnectionString (string connectionString, string restrictions, KeyRestrictionBehavior behavior) -+ : this (connectionString) -+ { -+ this.behavior = behavior; -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ public KeyRestrictionBehavior Behavior { -+ get { return behavior; } -+ } -+ -+ [MonoTODO] -+ public string Restrictions { -+ get { throw new NotImplementedException (); } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ [MonoTODO] -+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ protected virtual string KeywordLookup (string keyname) -+ { -+ return keyname; -+ } -+ -+ [MonoTODO] -+ public virtual void PermissionDemand () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ #endregion // Methods -+ } -+} -+ -+#endif ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs -@@ -0,0 +1,802 @@ -+// -+// System.Data.Common.DbConnectionStringBuilder.cs -+// -+// Author: -+// Sureshkumar T (tsureshkumar@novell.com) -+// Gert Driesen (drieseng@users.sourceforge.net -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+#if NET_2_0 -+using System; -+using System.Collections; -+using System.Collections.Generic; -+using System.Collections.ObjectModel; -+using System.ComponentModel; -+using System.Data; -+using System.Data.Common; -+using System.Reflection; -+using System.Text; -+ -+namespace System.Data.Common -+{ -+ public class DbConnectionStringBuilder : IDictionary, ICollection, IEnumerable, ICustomTypeDescriptor -+ { -+ #region Fields -+ -+ readonly Dictionary _dictionary; -+ readonly bool useOdbcRules; -+ -+ #endregion Fields -+ -+ #region Constructors -+ -+ public DbConnectionStringBuilder () : this (false) -+ { -+ } -+ -+ public DbConnectionStringBuilder (bool useOdbcRules) -+ { -+ this.useOdbcRules = useOdbcRules; -+ _dictionary = new Dictionary (StringComparer.InvariantCultureIgnoreCase); -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] -+ [EditorBrowsable (EditorBrowsableState.Never)] -+ [Browsable (false)] -+ [DesignOnly (true)] -+ public bool BrowsableConnectionString { -+ get { throw new NotImplementedException (); } -+ set { throw new NotImplementedException (); } -+ } -+ -+ [RefreshProperties (RefreshProperties.All)] -+ public string ConnectionString { -+ get { -+ IDictionary dictionary = (IDictionary ) _dictionary; -+ StringBuilder sb = new StringBuilder (); -+ foreach (string key in Keys) { -+ object value = null; -+ if (!dictionary.TryGetValue (key, out value)) -+ continue; -+ string val = value.ToString (); -+ AppendKeyValuePair (sb, key, val, useOdbcRules); -+ } -+ return sb.ToString (); -+ } -+ set { -+ Clear (); -+ if (value == null) -+ return; -+ if (value.Trim ().Length == 0) -+ return; -+ ParseConnectionString (value); -+ } -+ } -+ -+ [Browsable (false)] -+ public virtual int Count -+ { -+ get { return _dictionary.Count; } -+ } -+ -+ [Browsable (false)] -+ public virtual bool IsFixedSize -+ { -+ get { return false; } -+ } -+ -+ [Browsable (false)] -+ public bool IsReadOnly -+ { -+ get { throw new NotImplementedException (); } -+ } -+ -+ [Browsable (false)] -+ public virtual object this [string keyword] { -+ get { -+ if (ContainsKey (keyword)) -+ return _dictionary [keyword]; -+ else -+ throw new ArgumentException (string.Format ( -+ "Keyword '{0}' does not exist", -+ keyword)); -+ } -+ set { -+ if (value == null) { -+ Remove (keyword); -+ return; -+ } -+ -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ -+ if (keyword.Length == 0) -+ throw CreateInvalidKeywordException (keyword); -+ -+ for (int i = 0; i < keyword.Length; i++) { -+ char c = keyword [i]; -+ if (i == 0 && (Char.IsWhiteSpace (c) || c == ';')) -+ throw CreateInvalidKeywordException (keyword); -+ if (i == (keyword.Length - 1) && Char.IsWhiteSpace (c)) -+ throw CreateInvalidKeywordException (keyword); -+ if (Char.IsControl (c)) -+ throw CreateInvalidKeywordException (keyword); -+ } -+ -+ if (ContainsKey (keyword)) -+ _dictionary [keyword] = value; -+ else -+ _dictionary.Add (keyword, value); -+ } -+ } -+ -+ [Browsable (false)] -+ public virtual ICollection Keys -+ { -+ get { -+ string [] keys = new string [_dictionary.Keys.Count]; -+ ((ICollection) _dictionary.Keys).CopyTo (keys, 0); -+ ReadOnlyCollection keyColl = new ReadOnlyCollection (keys); -+ return keyColl; -+ } -+ } -+ -+ bool ICollection.IsSynchronized -+ { -+ get { throw new NotImplementedException (); } -+ } -+ -+ object ICollection.SyncRoot -+ { -+ get { throw new NotImplementedException (); } -+ } -+ -+ object IDictionary.this [object keyword] -+ { -+ get { return this [(string) keyword]; } -+ set { this [(string) keyword] = value; } -+ } -+ -+ [Browsable (false)] -+ public virtual ICollection Values { -+ get { -+ object [] values = new object [_dictionary.Values.Count]; -+ ((ICollection) _dictionary.Values).CopyTo (values, 0); -+ ReadOnlyCollection valuesColl = new ReadOnlyCollection (values); -+ return valuesColl; -+ } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ public void Add (string keyword, object value) -+ { -+ this [keyword] = value; -+ } -+ -+ public static void AppendKeyValuePair (StringBuilder builder, string keyword, string value, -+ bool useOdbcRules) -+ { -+ if (builder == null) -+ throw new ArgumentNullException ("builder"); -+ if (keyword == null) -+ throw new ArgumentNullException ("keyName"); -+ if (keyword.Length == 0) -+ throw new ArgumentException ("Empty keyword is not valid."); -+ -+ if (builder.Length > 0) -+ builder.Append (';'); -+ if (!useOdbcRules) -+ builder.Append (keyword.Replace ("=", "==")); -+ else -+ builder.Append (keyword); -+ builder.Append ('='); -+ -+ if (value == null || value.Length == 0) -+ return; -+ -+ if (!useOdbcRules) { -+ bool dquoteFound = (value.IndexOf ('\"') > -1); -+ bool squoteFound = (value.IndexOf ('\'') > -1); -+ -+ if (dquoteFound && squoteFound) { -+ builder.Append ('\"'); -+ builder.Append (value.Replace ("\"", "\"\"")); -+ builder.Append ('\"'); -+ } else if (dquoteFound) { -+ builder.Append ('\''); -+ builder.Append (value); -+ builder.Append ('\''); -+ } else if (squoteFound || value.IndexOf ('=') > -1 || value.IndexOf (';') > -1) { -+ builder.Append ('\"'); -+ builder.Append (value); -+ builder.Append ('\"'); -+ } else if (ValueNeedsQuoting (value)) { -+ builder.Append ('\"'); -+ builder.Append (value); -+ builder.Append ('\"'); -+ } else -+ builder.Append (value); -+ } else { -+ int braces = 0; -+ bool semicolonFound = false; -+ int len = value.Length; -+ bool needBraces = false; -+ -+ int lastChar = -1; -+ -+ for (int i = 0; i < len; i++) { -+ int peek = 0; -+ if (i == (len - 1)) -+ peek = -1; -+ else -+ peek = value [i + 1]; -+ -+ char c = value [i]; -+ switch (c) { -+ case '{': -+ braces++; -+ break; -+ case '}': -+ if (peek.Equals (c)) { -+ i++; -+ continue; -+ } else { -+ braces--; -+ if (peek != -1) -+ needBraces = true; -+ } -+ break; -+ case ';': -+ semicolonFound = true; -+ break; -+ default: -+ break; -+ } -+ lastChar = c; -+ } -+ -+ if (value [0] == '{' && (lastChar != '}' || (braces == 0 && needBraces))) { -+ builder.Append ('{'); -+ builder.Append (value.Replace ("}", "}}")); -+ builder.Append ('}'); -+ return; -+ } -+ -+ bool isDriver = (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0); -+ if (isDriver) { -+ if (value [0] == '{' && lastChar == '}' && !needBraces) { -+ builder.Append (value); -+ return; -+ } -+ builder.Append ('{'); -+ builder.Append (value.Replace ("}", "}}")); -+ builder.Append ('}'); -+ return; -+ } -+ -+ if (value [0] == '{' && (braces != 0 || lastChar != '}') && needBraces) { -+ builder.Append ('{'); -+ builder.Append (value.Replace ("}", "}}")); -+ builder.Append ('}'); -+ return; -+ } -+ -+ if (value [0] != '{' && semicolonFound) { -+ builder.Append ('{'); -+ builder.Append (value.Replace ("}", "}}")); -+ builder.Append ('}'); -+ return; -+ } -+ -+ builder.Append (value); -+ } -+ } -+ -+ public static void AppendKeyValuePair (StringBuilder builder, string keyword, string value) -+ { -+ AppendKeyValuePair (builder, keyword, value, false); -+ } -+ -+ public virtual void Clear () -+ { -+ _dictionary.Clear (); -+ } -+ -+ public virtual bool ContainsKey (string keyword) -+ { -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ return _dictionary.ContainsKey (keyword); -+ } -+ -+ public virtual bool EquivalentTo (DbConnectionStringBuilder connectionStringBuilder) -+ { -+ bool ret = true; -+ try { -+ if (Count != connectionStringBuilder.Count) -+ ret = false; -+ else { -+ foreach (string key in Keys) { -+ if (!this [key].Equals (connectionStringBuilder [key])) { -+ ret = false; -+ break; -+ } -+ } -+ } -+ } catch (ArgumentException) { -+ ret = false; -+ } -+ return ret; -+ } -+ -+ [MonoTODO] -+ protected virtual void GetProperties (Hashtable propertyDescriptors) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ [MonoTODO] -+ protected internal void ClearPropertyDescriptors () -+ { -+ throw new NotImplementedException (); -+ } -+ -+ public virtual bool Remove (string keyword) -+ { -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ return _dictionary.Remove (keyword); -+ } -+ -+ public virtual bool ShouldSerialize (string keyword) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ void ICollection.CopyTo (Array array, int index) -+ { -+ if (array == null) -+ throw new ArgumentNullException ("array"); -+ KeyValuePair [] arr = array as KeyValuePair []; -+ if (arr == null) -+ throw new ArgumentException ("Target array type is not compatible with the type of items in the collection"); -+ ((ICollection>) _dictionary).CopyTo (arr, index); -+ } -+ -+ void IDictionary.Add (object keyword, object value) -+ { -+ this.Add ((string) keyword, value); -+ } -+ -+ bool IDictionary.Contains (object keyword) -+ { -+ return ContainsKey ((string) keyword); -+ } -+ -+ IDictionaryEnumerator IDictionary.GetEnumerator () -+ { -+ return (IDictionaryEnumerator) _dictionary.GetEnumerator (); -+ } -+ -+ void IDictionary.Remove (object keyword) -+ { -+ Remove ((string) keyword); -+ } -+ -+ IEnumerator IEnumerable.GetEnumerator () -+ { -+ return (IEnumerator) _dictionary.GetEnumerator (); -+ } -+ -+ private static object _staticAttributeCollection = null; -+ AttributeCollection ICustomTypeDescriptor.GetAttributes () -+ { -+ object value = _staticAttributeCollection; -+ if (value == null) { -+ CLSCompliantAttribute clsAttr = new CLSCompliantAttribute (true); -+ DefaultMemberAttribute defMemAttr = new DefaultMemberAttribute ("Item"); -+ Attribute [] attrs = {clsAttr, defMemAttr}; -+ value = new AttributeCollection (attrs); -+ } -+ System.Threading.Interlocked.CompareExchange (ref _staticAttributeCollection, value, null); -+ return _staticAttributeCollection as AttributeCollection; -+ } -+ -+ string ICustomTypeDescriptor.GetClassName () -+ { -+ return this.GetType ().ToString (); -+ } -+ -+ string ICustomTypeDescriptor.GetComponentName () -+ { -+ return null; -+ } -+ -+ TypeConverter ICustomTypeDescriptor.GetConverter () -+ { -+ return new CollectionConverter (); -+ } -+ -+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent () -+ { -+ return null; -+ } -+ -+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty () -+ { -+ return null; -+ } -+ -+ object ICustomTypeDescriptor.GetEditor (Type editorBaseType) -+ { -+ return null; -+ } -+ -+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents () -+ { -+ return EventDescriptorCollection.Empty; -+ } -+ -+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] attributes) -+ { -+ return EventDescriptorCollection.Empty; -+ } -+ -+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties () -+ { -+ return PropertyDescriptorCollection.Empty; -+ } -+ -+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] attributes) -+ { -+ return PropertyDescriptorCollection.Empty; -+ } -+ -+ object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd) -+ { -+ throw new NotImplementedException (); -+ } -+ -+ public override string ToString () -+ { -+ return ConnectionString; -+ } -+ -+ public virtual bool TryGetValue (string keyword, out object value) -+ { -+ // FIXME : not sure, difference between this [keyword] and this method -+ bool found = ContainsKey (keyword); -+ if (found) -+ value = this [keyword]; -+ else -+ value = null; -+ return found; -+ } -+ -+ static ArgumentException CreateInvalidKeywordException (string keyword) -+ { -+ return new ArgumentException ("A keyword cannot contain " -+ + "control characters, leading semicolons or " -+ + "leading or trailing whitespace.", keyword); -+ } -+ -+ static ArgumentException CreateConnectionStringInvalidException (int index) -+ { -+ return new ArgumentException ("Format of initialization " -+ + "string does not conform to specifications at " -+ + "index " + index + "."); -+ } -+ -+ static bool ValueNeedsQuoting (string value) -+ { -+ foreach (char c in value) { -+ if (char.IsWhiteSpace (c)) -+ return true; -+ } -+ return false; -+ } -+ void ParseConnectionString (string connectionString) -+ { -+ if (useOdbcRules) -+ ParseConnectionStringOdbc (connectionString); -+ else -+ ParseConnectionStringNonOdbc (connectionString); -+ } -+ -+ void ParseConnectionStringOdbc (string connectionString) -+ { -+ bool inQuote = false; -+ bool inDQuote = false; -+ bool inName = true; -+ bool inBraces = false; -+ -+ string name = String.Empty; -+ string val = String.Empty; -+ StringBuilder sb = new StringBuilder (); -+ int len = connectionString.Length; -+ -+ for (int i = 0; i < len; i++) { -+ char c = connectionString [i]; -+ int peek = (i == (len - 1)) ? -1 : connectionString [i + 1]; -+ -+ switch (c) { -+ case '{': -+ if (inName) { -+ sb.Append (c); -+ continue; -+ } -+ -+ if (sb.Length == 0) -+ inBraces = true; -+ sb.Append (c); -+ break; -+ case '}': -+ if (inName || !inBraces) { -+ sb.Append (c); -+ continue; -+ } -+ -+ if (peek == -1) { -+ sb.Append (c); -+ inBraces = false; -+ } else if (peek.Equals (c)) { -+ sb.Append (c); -+ sb.Append (c); -+ i++; -+ } else { -+ int next = NextNonWhitespaceChar (connectionString, i); -+ if (next != -1 && ((char) next) != ';') -+ throw CreateConnectionStringInvalidException (next); -+ sb.Append (c); -+ inBraces = false; -+ } -+ break; -+ case ';': -+ if (inName || inBraces) { -+ sb.Append (c); -+ continue; -+ } -+ -+ if (name.Length > 0 && sb.Length > 0) { -+ val = sb.ToString (); -+ name = name.ToLower ().TrimEnd (); -+ this [name] = val; -+ } else if (sb.Length > 0) -+ throw CreateConnectionStringInvalidException (c); -+ inName = true; -+ name = String.Empty; -+ sb.Length = 0; -+ break; -+ case '=': -+ if (inBraces || !inName) { -+ sb.Append (c); -+ continue; -+ } -+ -+ name = sb.ToString (); -+ if (name.Length == 0) -+ throw CreateConnectionStringInvalidException (c); -+ sb.Length = 0; -+ inName = false; -+ break; -+ default: -+ if (inDQuote || inQuote || inBraces) -+ sb.Append (c); -+ else if (char.IsWhiteSpace (c)) { -+ // ignore leading whitespace -+ if (sb.Length > 0) { -+ int nextChar = SkipTrailingWhitespace (connectionString, i); -+ if (nextChar == -1) -+ sb.Append (c); -+ else -+ i = nextChar; -+ } -+ } else -+ sb.Append (c); -+ break; -+ } -+ } -+ -+ if ((inName && sb.Length > 0) || inDQuote || inQuote || inBraces) -+ throw CreateConnectionStringInvalidException (len - 1); -+ -+ if (name.Length > 0 && sb.Length > 0) { -+ val = sb.ToString (); -+ name = name.ToLower ().TrimEnd (); -+ this [name] = val; -+ } -+ } -+ -+ void ParseConnectionStringNonOdbc (string connectionString) -+ { -+ bool inQuote = false; -+ bool inDQuote = false; -+ bool inName = true; -+ -+ string name = String.Empty; -+ string val = String.Empty; -+ StringBuilder sb = new StringBuilder (); -+ int len = connectionString.Length; -+ -+ for (int i = 0; i < len; i++) { -+ char c = connectionString [i]; -+ int peek = (i == (len - 1)) ? -1 : connectionString [i + 1]; -+ -+ switch (c) { -+ case '\'': -+ if (inName) { -+ sb.Append (c); -+ continue; -+ } -+ -+ if (inDQuote) -+ sb.Append (c); -+ else if (inQuote) { -+ if (peek == -1) -+ inQuote = false; -+ else if (peek.Equals (c)) { -+ sb.Append (c); -+ i++; -+ } else { -+ int next = NextNonWhitespaceChar (connectionString, i); -+ if (next != -1 && ((char) next) != ';') -+ throw CreateConnectionStringInvalidException (next); -+ inQuote = false; -+ } -+ -+ if (!inQuote) { -+ val = sb.ToString (); -+ name = name.ToLower ().TrimEnd (); -+ this [name] = val; -+ inName = true; -+ name = String.Empty; -+ sb.Length = 0; -+ } -+ } else if (sb.Length == 0) -+ inQuote = true; -+ else -+ sb.Append (c); -+ break; -+ case '"': -+ if (inName) { -+ sb.Append (c); -+ continue; -+ } -+ -+ if (inQuote) -+ sb.Append (c); -+ else if (inDQuote) { -+ if (peek == -1) -+ inDQuote = false; -+ else if (peek.Equals (c)) { -+ sb.Append (c); -+ i++; -+ } else { -+ int next = NextNonWhitespaceChar (connectionString, i); -+ if (next != -1 && ((char) next) != ';') -+ throw CreateConnectionStringInvalidException (next); -+ inDQuote = false; -+ } -+ } else if (sb.Length == 0) -+ inDQuote = true; -+ else -+ sb.Append (c); -+ break; -+ case ';': -+ if (inName) { -+ sb.Append (c); -+ continue; -+ } -+ -+ if (inDQuote || inQuote) -+ sb.Append (c); -+ else { -+ if (name.Length > 0 && sb.Length > 0) { -+ val = sb.ToString (); -+ name = name.ToLower ().TrimEnd (); -+ this [name] = val; -+ } else if (sb.Length > 0) -+ throw CreateConnectionStringInvalidException (c); -+ inName = true; -+ name = String.Empty; -+ sb.Length = 0; -+ } -+ break; -+ case '=': -+ if (inDQuote || inQuote || !inName) -+ sb.Append (c); -+ else if (peek != -1 && peek.Equals (c)) { -+ sb.Append (c); -+ i++; -+ } else { -+ name = sb.ToString (); -+ if (name.Length == 0) -+ throw CreateConnectionStringInvalidException (c); -+ sb.Length = 0; -+ inName = false; -+ } -+ break; -+ default: -+ if (inDQuote || inQuote) -+ sb.Append (c); -+ else if (char.IsWhiteSpace (c)) { -+ // ignore leading whitespace -+ if (sb.Length > 0) { -+ int nextChar = SkipTrailingWhitespace (connectionString, i); -+ if (nextChar == -1) -+ sb.Append (c); -+ else -+ i = nextChar; -+ } -+ } else -+ sb.Append (c); -+ break; -+ } -+ } -+ -+ if ((inName && sb.Length > 0) || inDQuote || inQuote) -+ throw CreateConnectionStringInvalidException (len -1); -+ -+ if (name.Length > 0 && sb.Length > 0) { -+ val = sb.ToString (); -+ name = name.ToLower ().TrimEnd (); -+ this [name] = val; -+ } -+ } -+ -+ static int SkipTrailingWhitespace (string value, int index) -+ { -+ int len = value.Length; -+ for (int i = (index + 1); i < len; i++) { -+ char c = value [i]; -+ if (c == ';') -+ return (i - 1); -+ if (!char.IsWhiteSpace (c)) -+ return -1; -+ } -+ return len - 1; -+ } -+ -+ static int NextNonWhitespaceChar (string value, int index) -+ { -+ int len = value.Length; -+ for (int i = (index + 1); i < len; i++) { -+ char c = value [i]; -+ if (!char.IsWhiteSpace (c)) -+ return (int) c; -+ } -+ return -1; -+ } -+ -+ #endregion // Public Methods -+ } -+} -+#endif // NET_2_0 using ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs -@@ -0,0 +1,317 @@ -+// -+// System.Data.Common.DbDataPermission.cs -+// -+// Authors: -+// Rodrigo Moya (rodrigo@ximian.com) -+// Tim Coleman (tim@timcoleman.com) -+// Sebastien Pouliot -+// -+// (C) Ximian, Inc -+// Copyright (C) Tim Coleman, 2002-2003 -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.Collections; -+using System.Security; -+using System.Security.Permissions; -+ -+namespace System.Data.Common { -+ -+ [Serializable] -+ public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission { -+ -+ #region Fields -+ -+ private const int version = 1; -+ -+ private bool allowBlankPassword; -+ private PermissionState state; -+ private Hashtable _connections; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+#if NET_2_0 -+ [Obsolete ("use DBDataPermission (PermissionState.None)", true)] -+#endif -+ protected DBDataPermission () -+ : this (PermissionState.None) -+ { -+ } -+ -+ protected DBDataPermission (DBDataPermission permission) -+ { -+ if (permission == null) -+ throw new ArgumentNullException ("permission"); -+ -+ state = permission.state; -+ if (state != PermissionState.Unrestricted) { -+ allowBlankPassword = permission.allowBlankPassword; -+ _connections = (Hashtable) permission._connections.Clone (); -+ } -+ } -+ -+ protected DBDataPermission (DBDataPermissionAttribute permissionAttribute) -+ { -+ if (permissionAttribute == null) -+ throw new ArgumentNullException ("permissionAttribute"); -+ -+ _connections = new Hashtable (); -+ if (permissionAttribute.Unrestricted) { -+ state = PermissionState.Unrestricted; -+ } -+ else { -+ state = PermissionState.None; -+ allowBlankPassword = permissionAttribute.AllowBlankPassword; -+ if (permissionAttribute.ConnectionString.Length > 0) { -+ Add (permissionAttribute.ConnectionString, permissionAttribute.KeyRestrictions, -+ permissionAttribute.KeyRestrictionBehavior); -+ } -+ } -+ } -+ -+ protected DBDataPermission (PermissionState state) -+ { -+ this.state = PermissionHelper.CheckPermissionState (state, true); -+ _connections = new Hashtable (); -+ } -+ -+#if NET_2_0 -+ [Obsolete ("use DBDataPermission (PermissionState.None)", true)] -+ protected -+#else -+ public -+#endif -+ DBDataPermission (PermissionState state, bool allowBlankPassword) -+ : this (state) -+ { -+ this.allowBlankPassword = allowBlankPassword; -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ public bool AllowBlankPassword { -+ get { return allowBlankPassword; } -+ set { allowBlankPassword = value; } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ public virtual void Add (string connectionString, string restrictions, KeyRestrictionBehavior behavior) -+ { -+ state = PermissionState.None; -+ _connections [connectionString] = new object [2] { restrictions, behavior }; -+ } -+ -+ protected void Clear () -+ { -+ _connections.Clear (); -+ } -+ -+ public override IPermission Copy () -+ { -+ DBDataPermission dbdp = CreateInstance (); -+ dbdp.allowBlankPassword = this.allowBlankPassword; -+ dbdp._connections = (Hashtable) this._connections.Clone (); -+ return dbdp; -+ } -+ -+ protected virtual DBDataPermission CreateInstance () -+ { -+ return (DBDataPermission) Activator.CreateInstance (this.GetType (), new object [1] { PermissionState.None }); -+ } -+ -+ public override void FromXml (SecurityElement securityElement) -+ { -+ PermissionHelper.CheckSecurityElement (securityElement, "securityElement", version, version); -+ // Note: we do not (yet) care about the return value -+ // as we only accept version 1 (min/max values) -+ -+ state = (PermissionHelper.IsUnrestricted (securityElement) ? -+ PermissionState.Unrestricted : PermissionState.None); -+ -+ allowBlankPassword = false; -+ string blank = securityElement.Attribute ("AllowBlankPassword"); -+ if (blank != null) { -+#if NET_2_0 -+ // avoid possible exceptions with Fx 2.0 -+ if (!Boolean.TryParse (blank, out allowBlankPassword)) -+ allowBlankPassword = false; -+#else -+ try { -+ allowBlankPassword = Boolean.Parse (blank); -+ } -+ catch { -+ allowBlankPassword = false; -+ } -+#endif -+ } -+ -+ if (securityElement.Children != null) { -+ foreach (SecurityElement child in securityElement.Children) { -+ string connect = child.Attribute ("ConnectionString"); -+ string restricts = child.Attribute ("KeyRestrictions"); -+ KeyRestrictionBehavior behavior = (KeyRestrictionBehavior) Enum.Parse ( -+ typeof (KeyRestrictionBehavior), child.Attribute ("KeyRestrictionBehavior")); -+ -+ if ((connect != null) && (connect.Length > 0)) -+ Add (connect, restricts, behavior); -+ } -+ } -+ } -+ -+ public override IPermission Intersect (IPermission target) -+ { -+ // FIXME: restrictions not completely implemented - nor documented -+ DBDataPermission dbdp = Cast (target); -+ if (dbdp == null) -+ return null; -+ if (IsUnrestricted ()) { -+ if (dbdp.IsUnrestricted ()) { -+ DBDataPermission u = CreateInstance (); -+ u.state = PermissionState.Unrestricted; -+ return u; -+ } -+ return dbdp.Copy (); -+ } -+ if (dbdp.IsUnrestricted ()) -+ return Copy (); -+ if (IsEmpty () || dbdp.IsEmpty ()) -+ return null; -+ -+ DBDataPermission p = CreateInstance (); -+ p.allowBlankPassword = (allowBlankPassword && dbdp.allowBlankPassword); -+ foreach (DictionaryEntry de in _connections) { -+ object o = dbdp._connections [de.Key]; -+ if (o != null) -+ p._connections.Add (de.Key, de.Value); -+ } -+ return (p._connections.Count > 0) ? p : null; -+ } -+ -+ public override bool IsSubsetOf (IPermission target) -+ { -+ // FIXME: restrictions not completely implemented - nor documented -+ DBDataPermission dbdp = Cast (target); -+ if (dbdp == null) -+ return IsEmpty (); -+ if (dbdp.IsUnrestricted ()) -+ return true; -+ if (IsUnrestricted ()) -+ return dbdp.IsUnrestricted (); -+ -+ if (allowBlankPassword && !dbdp.allowBlankPassword) -+ return false; -+ if (_connections.Count > dbdp._connections.Count) -+ return false; -+ -+ foreach (DictionaryEntry de in _connections) { -+ object o = dbdp._connections [de.Key]; -+ if (o == null) -+ return false; -+ // FIXME: this is a subset of what is required -+ // it seems that we must process both the connect string -+ // and the restrictions - but this has other effects :-/ -+ } -+ return true; -+ } -+ -+ public bool IsUnrestricted () -+ { -+ return (state == PermissionState.Unrestricted); -+ } -+ -+ public override SecurityElement ToXml () -+ { -+ SecurityElement se = PermissionHelper.Element (this.GetType (), version); -+ if (IsUnrestricted ()) { -+ se.AddAttribute ("Unrestricted", "true"); -+ } -+ else { -+ // attribute is present for both True and False -+ se.AddAttribute ("AllowBlankPassword", allowBlankPassword.ToString ()); -+ foreach (DictionaryEntry de in _connections) { -+ SecurityElement child = new SecurityElement ("add"); -+ child.AddAttribute ("ConnectionString", (string) de.Key); -+ object[] restrictionsInfo = (object[]) de.Value; -+ child.AddAttribute ("KeyRestrictions", (string) restrictionsInfo [0]); -+ KeyRestrictionBehavior krb = (KeyRestrictionBehavior) restrictionsInfo [1]; -+ child.AddAttribute ("KeyRestrictionBehavior", krb.ToString ()); -+ se.AddChild (child); -+ } -+ } -+ return se; -+ } -+ -+ public override IPermission Union (IPermission target) -+ { -+ // FIXME: restrictions not completely implemented - nor documented -+ DBDataPermission dbdp = Cast (target); -+ if (dbdp == null) -+ return Copy (); -+ if (IsEmpty () && dbdp.IsEmpty ()) -+ return Copy (); -+ -+ DBDataPermission p = CreateInstance (); -+ if (IsUnrestricted () || dbdp.IsUnrestricted ()) { -+ p.state = PermissionState.Unrestricted; -+ } -+ else { -+ p.allowBlankPassword = (allowBlankPassword || dbdp.allowBlankPassword); -+ p._connections = new Hashtable (_connections.Count + dbdp._connections.Count); -+ foreach (DictionaryEntry de in _connections) -+ p._connections.Add (de.Key, de.Value); -+ // don't duplicate -+ foreach (DictionaryEntry de in dbdp._connections) -+ p._connections [de.Key] = de.Value; -+ } -+ return p; -+ } -+ -+ // helpers -+ -+ private bool IsEmpty () -+ { -+ return ((state != PermissionState.Unrestricted) && (_connections.Count == 0)); -+ } -+ -+ private DBDataPermission Cast (IPermission target) -+ { -+ if (target == null) -+ return null; -+ -+ DBDataPermission dbdp = (target as DBDataPermission); -+ if (dbdp == null) { -+ PermissionHelper.ThrowInvalidPermission (target, this.GetType ()); -+ } -+ -+ return dbdp; -+ } -+ -+ #endregion // Methods -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs -@@ -0,0 +1,113 @@ -+// -+// System.Data.Common.DbDataPermissionAttribute.cs -+// -+// Authors: -+// Rodrigo Moya (rodrigo@ximian.com) -+// Tim Coleman (tim@timcoleman.com) -+// Sebastien Pouliot -+// -+// (C) Ximian, Inc -+// Copyright (C) Tim Coleman, 2002 -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.ComponentModel; -+using System.Security.Permissions; -+using System.Globalization; -+ -+namespace System.Data.Common { -+ -+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | -+ AttributeTargets.Struct | AttributeTargets.Constructor | -+ AttributeTargets.Method, AllowMultiple=true, Inherited=false)] -+ [Serializable] -+ public abstract class DBDataPermissionAttribute : CodeAccessSecurityAttribute { -+ #region Fields -+ -+ bool allowBlankPassword; -+ string keyRestrictions; -+ KeyRestrictionBehavior keyRestrictionBehavior; -+ string connectionString; -+ -+ #endregion // Fields -+ -+ #region Constructors -+ -+ protected DBDataPermissionAttribute (SecurityAction action) -+ : base (action) -+ { -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ public bool AllowBlankPassword { -+ get { return allowBlankPassword; } -+ set { allowBlankPassword = value; } -+ } -+ -+ public string KeyRestrictions { -+ get { -+ if (keyRestrictions == null) -+ return String.Empty; -+ return keyRestrictions; -+ } -+ set { keyRestrictions = value; } -+ } -+ -+ public string ConnectionString { -+ get { -+ if (connectionString == null) -+ return String.Empty; -+ return connectionString; -+ } -+ set { connectionString = value; } -+ } -+ -+ public KeyRestrictionBehavior KeyRestrictionBehavior { -+ get { return keyRestrictionBehavior; } -+ set { -+ ExceptionHelper.CheckEnumValue (typeof (KeyRestrictionBehavior), value); -+ keyRestrictionBehavior = value; -+ } -+ } -+ -+ #endregion // Properties -+ -+ #region // Methods -+ [EditorBrowsableAttribute (EditorBrowsableState.Never)] -+ public bool ShouldSerializeConnectionString () -+ { -+ // FIXME: configurable ? why is this in the attribute class ? -+ return false; -+ } -+ -+ [EditorBrowsableAttribute (EditorBrowsableState.Never)] -+ public bool ShouldSerializeKeyRestrictions () -+ { -+ // FIXME: configurable ? why is this in the attribute class ? -+ return false; -+ } -+ #endregion // Methods -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Odbc/OdbcConnectionStringBuilder.cs -@@ -0,0 +1,219 @@ -+// -+// System.Data.Odbc.OdbcConnectionStringBuilder -+// -+// Authors: -+// Nidhi Rawal (rawalnidhi_rawal@yahoo.com) -+// -+// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+#if NET_2_0 -+using System; -+using System.Collections; -+using System.ComponentModel; -+using System.Collections.Generic; -+using System.Data; -+using System.Data.Common; -+using System.Data.Odbc; -+using System.Reflection; -+using System.Text; -+ -+namespace System.Data.Odbc -+{ -+ [DefaultProperty ("Driver")] -+ [TypeConverter ("System.Data.Odbc.OdbcConnectionStringBuilder+OdbcConnectionStringBuilderConverter, " + Consts.AssemblySystem_Data)] -+ public sealed class OdbcConnectionStringBuilder : DbConnectionStringBuilder -+ { -+ #region Fields -+ string driver; -+ string dsn; -+ #endregion //Fields -+ -+ #region Constructors -+ -+ public OdbcConnectionStringBuilder () : base (true) -+ { -+ } -+ -+ public OdbcConnectionStringBuilder (string connectionString) : base (true) -+ { -+ if (connectionString == null) { -+ base.ConnectionString = string.Empty; -+ return; -+ } -+ -+ base.ConnectionString = connectionString; -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ public override Object this [string keyword] { -+ get { -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) -+ return Driver; -+ if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) -+ return Dsn; -+ return base [keyword]; -+ } -+ set { -+ if (value == null) { -+ Remove (keyword); -+ return; -+ } -+ -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ -+ string text_value = value.ToString (); -+ -+ if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) { -+ Driver = text_value; -+ return; -+ } else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) { -+ dsn = text_value; -+ } else if (value.ToString ().IndexOf (';') != -1) { -+ text_value = "{" + text_value + "}"; -+ } -+ base [keyword] = value; -+ } -+ } -+ -+ public override ICollection Keys { -+ get { -+ List keys = new List (); -+ keys.Add ("Dsn"); -+ keys.Add ("Driver"); -+ -+ ICollection base_keys = base.Keys; -+ foreach (string keyword in base_keys) { -+ if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) -+ continue; -+ if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) -+ continue; -+ keys.Add (keyword); -+ } -+ -+ string [] final = new string [keys.Count]; -+ keys.CopyTo (final); -+ return final; -+ } -+ } -+ -+ [DisplayName ("Driver")] -+ [RefreshProperties (RefreshProperties.All)] -+ public string Driver { -+ get { -+ if (driver == null) -+ return string.Empty; -+ return driver; -+ } -+ set { -+ if (value == null) -+ throw new ArgumentNullException ("Driver"); -+ driver = value; -+ -+ if (value.Length > 0) { -+ int startBrace = value.IndexOf ('{'); -+ int endBrace = value.IndexOf ('}'); -+ if (startBrace == -1 || endBrace == -1) -+ value = "{" + value + "}"; -+ else if (startBrace > 0 || endBrace < (value.Length - 1)) -+ value = "{" + value + "}"; -+ } -+ base ["Driver"] = value; -+ } -+ } -+ -+ [DisplayName ("Dsn")] -+ [RefreshProperties (RefreshProperties.All)] -+ public string Dsn { -+ get { -+ if (dsn == null) -+ return string.Empty; -+ return dsn; -+ } -+ set { -+ if (value == null) -+ throw new ArgumentNullException ("Dsn"); -+ dsn = value; -+ base ["Dsn"] = dsn; -+ } -+ } -+ -+ #endregion // Properties -+ -+ #region Methods -+ -+ public override bool ContainsKey (string keyword) -+ { -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) -+ return true; -+ if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) -+ return true; -+ return base.ContainsKey (keyword); -+ } -+ -+ public override bool Remove (string keyword) -+ { -+ if (keyword == null) -+ throw new ArgumentNullException ("keyword"); -+ if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) -+ driver = string.Empty; -+ else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) -+ dsn = string.Empty; -+ return base.Remove (keyword); -+ } -+ -+ public override void Clear () -+ { -+ driver = null; -+ dsn = null; -+ base.Clear (); -+ } -+ -+ public override bool TryGetValue (string keyword, out Object value) -+ { -+ if (keyword == null ) -+ throw new ArgumentNullException ("keyword"); -+ bool found = base.TryGetValue (keyword, out value); -+ if (found) -+ return found; -+ if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) { -+ value = string.Empty; -+ return true; -+ } else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) { -+ value = string.Empty; -+ return true; -+ } -+ return false; -+ } -+ -+ #endregion // Methods -+ } -+} -+#endif // NET_2_0 using ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs -@@ -0,0 +1,104 @@ -+// -+// System.Data.Odbc.OdbcError -+// -+// Author: -+// Brian Ritchie (brianlritchie@hotmail.com) -+// -+// Copyright (C) Brian Ritchie, 2002 -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.Collections; -+using System.ComponentModel; -+using System.Data; -+using System.Data.Common; -+using System.Text; -+ -+namespace System.Data.Odbc -+{ -+ [Serializable] -+ public sealed class OdbcError -+ { -+ readonly string _message; -+ string _source; -+ readonly string _state; -+ readonly int _nativeerror; -+ -+ #region Constructors -+ -+ internal OdbcError (OdbcConnection connection) -+ { -+ _nativeerror = 1; -+ _source = connection.SafeDriver; -+ _message = "Error in " + _source; -+ _state = string.Empty; -+ } -+ -+ internal OdbcError (string message, string state, int nativeerror) -+ { -+ _message = message; -+ _state = state; -+ _nativeerror = nativeerror; -+ } -+ -+ #endregion // Constructors -+ -+ #region Properties -+ -+ public string Message { -+ get { return _message; } -+ } -+ -+ public int NativeError { -+ get { return _nativeerror; } -+ } -+ -+ public string Source { -+ get { return _source; } -+ } -+ -+ public string SQLState { -+ get { return _state; } -+ } -+ -+ #endregion // Properties -+ -+ #region methods -+ -+ public override string ToString () -+ { -+ return Message; -+ } -+ -+ internal void SetSource (string source) -+ { -+ _source = source; -+ } -+ -+ #endregion -+ -+ } -+ -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Odbc/OdbcPermission.cs -@@ -0,0 +1,87 @@ -+// -+// System.Data.Odbc.OdbcPermission -+// -+// Authors: -+// Umadevi S (sumadevi@novell.com) -+// Sebastien Pouliot -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.Data.Common; -+using System.Security; -+using System.Security.Permissions; -+ -+namespace System.Data.Odbc -+{ -+ [Serializable] -+ public sealed class OdbcPermission : DBDataPermission -+ { -+ #region Constructors -+ -+ [Obsolete ("use OdbcPermission(PermissionState.None)", true)] -+ public OdbcPermission () -+ : base (PermissionState.None) -+ { -+ } -+ -+ public OdbcPermission (PermissionState state) -+ : base (state) -+ { -+ } -+ -+ [Obsolete ("use OdbcPermission(PermissionState.None)", true)] -+ public OdbcPermission (PermissionState state, bool allowBlankPassword) -+ : base (state) -+ { -+ AllowBlankPassword = allowBlankPassword; -+ } -+ -+ // required for Copy method -+ internal OdbcPermission (DBDataPermission permission) -+ : base (permission) -+ { -+ } -+ -+ // easier (and common) permission creation from attribute class -+ internal OdbcPermission (DBDataPermissionAttribute attribute) -+ : base (attribute) -+ { -+ } -+ -+ #endregion -+ -+ #region Methods -+ -+ public override IPermission Copy () -+ { -+ return new OdbcPermission (this); -+ } -+ -+ public override void Add (string connectionString, string restrictions, KeyRestrictionBehavior behavior) -+ { -+ base.Add (connectionString, restrictions, behavior); -+ } -+ -+ #endregion -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data.Odbc/OdbcPermissionAttribute.cs -@@ -0,0 +1,64 @@ -+// -+// System.Data.Odbc.OdbcPermissionAttribute -+// -+// Authors: -+// Umadevi S (sumadevi@novell.com) -+// Sebastien Pouliot -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+using System.Data.Common; -+using System.Security; -+using System.Security.Permissions; -+ -+namespace System.Data.Odbc { -+ -+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | -+ AttributeTargets.Struct | AttributeTargets.Constructor | -+ AttributeTargets.Method, AllowMultiple=true, -+ Inherited=false)] -+ [Serializable] -+ public sealed class OdbcPermissionAttribute : DBDataPermissionAttribute { -+ -+ #region Constructors -+ -+ public OdbcPermissionAttribute (SecurityAction action) -+ : base (action) -+ { -+ } -+ -+ #endregion -+ -+ #region Properties -+ #endregion -+ -+ #region Methods -+ -+ public override IPermission CreatePermission () -+ { -+ return new OdbcPermission (this); -+ } -+ -+ #endregion -+ } -+} ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/System.Data/KeyRestrictionBehavior.cs -@@ -0,0 +1,41 @@ -+// -+// System.Data.KeyRestrictionBehavior -+// -+// Author: -+// Tim Coleman -+// -+// Copyright (C) Tim Coleman, 2003 -+// -+ -+// -+// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -+// -+// 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. -+// -+ -+namespace System.Data { -+ [Serializable] -+ public enum KeyRestrictionBehavior -+ { -+ AllowOnly, -+ PreventUsage -+ } -+} -+ ---- mono-4.2.1.102+dfsg2.orig/mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs -@@ -500,7 +500,7 @@ namespace MonoTests.System.Data.Common { - { - NonAbstractDBDataPermission empty = new NonAbstractDBDataPermission (PermissionState.None); - NonAbstractDBDataPermission union = (NonAbstractDBDataPermission) empty.Union (empty); -- Assert.IsNull (union, "Empty U Empty"); -+ Assert.IsNotNull (union, "Empty U Empty"); - - NonAbstractDBDataPermission dbdp1 = new NonAbstractDBDataPermission (PermissionState.None); - dbdp1.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly); ---- mono-4.2.1.102+dfsg2.orig/mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs -+++ mono-4.2.1.102+dfsg2/mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs -@@ -1798,7 +1798,7 @@ namespace MonoTests.System.Data.Common - Assert.AreEqual (builder.GetType ().ToString (), className, "#1"); - - AttributeCollection collection = ictd.GetAttributes (); -- Assert.AreEqual (1, collection.Count, "#2"); -+ Assert.AreEqual (2, collection.Count, "#2"); - object [] attr = builder.GetType ().GetCustomAttributes (typeof (DefaultMemberAttribute), false); - if (attr.Length > 0) { - DefaultMemberAttribute defAtt = (DefaultMemberAttribute) attr [0]; ---- mono-4.2.1.102+dfsg2.orig/mcs/class/System.ServiceModel/Makefile -+++ mono-4.2.1.102+dfsg2/mcs/class/System.ServiceModel/Makefile -@@ -32,8 +32,10 @@ ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) - ifndef NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY - activation = $(the_libdir_base)System.ServiceModel.Activation.dll - servicemodel_deps = $(activation) -+endif - - ifneq (plainservice/,$(intermediate)) -+ifndef NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY - LIB_MCS_FLAGS += -define:HAS_ACTIVATION -r:System.ServiceModel.Activation.dll - endif - endif # NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY ---- mono-4.2.1.102+dfsg2.orig/mcs/class/reference-assemblies/Makefile -+++ mono-4.2.1.102+dfsg2/mcs/class/reference-assemblies/Makefile -@@ -10,10 +10,7 @@ install-local: - $(MKINSTALLDIRS) $(PROFILE_DIR)/2.0 - $(MKINSTALLDIRS) $(PROFILE_DIR)/3.5 - $(MKINSTALLDIRS) $(PROFILE_DIR)/4.0 -- $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v2.0/* $(PROFILE_DIR)/2.0 -- $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v3.5/* $(PROFILE_DIR)/3.5 -- $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.0/* $(PROFILE_DIR)/4.0 - --DISTFILES = $(wildcard ../../../external/binary-reference-assemblies/v4.0/*) $(wildcard ../../../external/binary-reference-assemblies/v3.5/*) $(wildcard ../../../external/binary-reference-assemblies/v2.0/*) Makefile -+DISTFILES = Makefile - - dist-local: dist-default ---- mono-4.2.1.102+dfsg2.orig/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets -+++ mono-4.2.1.102+dfsg2/mcs/tools/xbuild/data/12.0/Microsoft.Common.targets -@@ -33,7 +33,7 @@ - 2 - - .NETFramework -- v4.0 -+ v4.5 - - $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile) - $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion) ---- mono-4.2.1.102+dfsg2.orig/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets -+++ mono-4.2.1.102+dfsg2/mcs/tools/xbuild/data/14.0/Microsoft.Common.targets -@@ -33,7 +33,7 @@ - 2 - - .NETFramework -- v4.0 -+ v4.5 - - $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile) - $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion) ---- mono-4.2.1.102+dfsg2.orig/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets -+++ mono-4.2.1.102+dfsg2/mcs/tools/xbuild/data/4.0/Microsoft.Common.targets -@@ -33,7 +33,7 @@ - 2 - - .NETFramework -- v4.0 -+ v4.5 - - $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile) - $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion) ---- /dev/null -+++ mono-4.2.1.102+dfsg2/mono/arch/arm64/arm64-codegen.h -@@ -0,0 +1,851 @@ -+/* -+ * arm64-codegen.h: ARM64 code generation macros -+ * -+ * Author: -+ * Zoltan Varga (vargaz@gmail.com) -+ * -+ * Copyright 2013 Xamarin, Inc (http://www.xamarin.com) -+ */ -+ -+#ifndef __ARM64_CODEGEN_H__ -+#define __ARM64_CODEGEN_H__ -+ -+#include -+ -+enum { -+ ARMREG_R0 = 0, -+ ARMREG_R1 = 1, -+ ARMREG_R2 = 2, -+ ARMREG_R3 = 3, -+ ARMREG_R4 = 4, -+ ARMREG_R5 = 5, -+ ARMREG_R6 = 6, -+ ARMREG_R7 = 7, -+ ARMREG_R8 = 8, -+ ARMREG_R9 = 9, -+ ARMREG_R10 = 10, -+ ARMREG_R11 = 11, -+ ARMREG_R12 = 12, -+ ARMREG_R13 = 13, -+ ARMREG_R14 = 14, -+ ARMREG_R15 = 15, -+ ARMREG_R16 = 16, -+ ARMREG_R17 = 17, -+ ARMREG_R18 = 18, -+ ARMREG_R19 = 19, -+ ARMREG_R20 = 20, -+ ARMREG_R21 = 21, -+ ARMREG_R22 = 22, -+ ARMREG_R23 = 23, -+ ARMREG_R24 = 24, -+ ARMREG_R25 = 25, -+ ARMREG_R26 = 26, -+ ARMREG_R27 = 27, -+ ARMREG_R28 = 28, -+ ARMREG_R29 = 29, -+ ARMREG_R30 = 30, -+ ARMREG_SP = 31, -+ ARMREG_RZR = 31, -+ -+ ARMREG_IP0 = ARMREG_R16, -+ ARMREG_IP1 = ARMREG_R17, -+ ARMREG_FP = ARMREG_R29, -+ ARMREG_LR = ARMREG_R30 -+}; -+ -+enum { -+ ARMREG_D0 = 0, -+ ARMREG_D1 = 1, -+ ARMREG_D2 = 2, -+ ARMREG_D3 = 3, -+ ARMREG_D4 = 4, -+ ARMREG_D5 = 5, -+ ARMREG_D6 = 6, -+ ARMREG_D7 = 7, -+ ARMREG_D8 = 8, -+ ARMREG_D9 = 9, -+ ARMREG_D10 = 10, -+ ARMREG_D11 = 11, -+ ARMREG_D12 = 12, -+ ARMREG_D13 = 13, -+ ARMREG_D14 = 14, -+ ARMREG_D15 = 15, -+ ARMREG_D16 = 16, -+ ARMREG_D17 = 17, -+ ARMREG_D18 = 18, -+ ARMREG_D19 = 19, -+ ARMREG_D20 = 20, -+ ARMREG_D21 = 21, -+ ARMREG_D22 = 22, -+ ARMREG_D23 = 23, -+ ARMREG_D24 = 24, -+ ARMREG_D25 = 25, -+ ARMREG_D26 = 26, -+ ARMREG_D27 = 27, -+ ARMREG_D28 = 28, -+ ARMREG_D29 = 29, -+ ARMREG_D30 = 30, -+ ARMREG_D31 = 31 -+}; -+ -+typedef enum { -+ ARMCOND_EQ = 0x0, /* Equal; Z = 1 */ -+ ARMCOND_NE = 0x1, /* Not equal, or unordered; Z = 0 */ -+ ARMCOND_CS = 0x2, /* Carry set; C = 1 */ -+ ARMCOND_HS = ARMCOND_CS, /* Unsigned higher or same; */ -+ ARMCOND_CC = 0x3, /* Carry clear; C = 0 */ -+ ARMCOND_LO = ARMCOND_CC, /* Unsigned lower */ -+ ARMCOND_MI = 0x4, /* Negative; N = 1 */ -+ ARMCOND_PL = 0x5, /* Positive or zero; N = 0 */ -+ ARMCOND_VS = 0x6, /* Overflow; V = 1 */ -+ ARMCOND_VC = 0x7, /* No overflow; V = 0 */ -+ ARMCOND_HI = 0x8, /* Unsigned higher; C = 1 && Z = 0 */ -+ ARMCOND_LS = 0x9, /* Unsigned lower or same; C = 0 || Z = 1 */ -+ ARMCOND_GE = 0xA, /* Signed greater than or equal; N = V */ -+ ARMCOND_LT = 0xB, /* Signed less than; N != V */ -+ ARMCOND_GT = 0xC, /* Signed greater than; Z = 0 && N = V */ -+ ARMCOND_LE = 0xD, /* Signed less than or equal; Z = 1 || N != V */ -+ ARMCOND_AL = 0xE, /* Always */ -+ ARMCOND_NV = 0xF, /* Never */ -+} ARMCond; -+ -+typedef enum { -+ ARMSHIFT_LSL = 0x0, -+ ARMSHIFT_LSR = 0x1, -+ ARMSHIFT_ASR = 0x2 -+} ARMShift; -+ -+typedef enum { -+ ARMSIZE_B = 0x0, -+ ARMSIZE_H = 0x1, -+ ARMSIZE_W = 0x2, -+ ARMSIZE_X = 0x3 -+} ARMSize; -+ -+#define arm_emit(p, ins) do { *(guint32*)(p) = (ins); (p) += 4; } while (0) -+ -+/* Overwrite bits [offset,offset+nbits] with value */ -+static G_GNUC_UNUSED inline void -+arm_set_ins_bits (void *p, int offset, int nbits, guint32 value) -+{ -+ *(guint32*)p = (*(guint32*)p & ~(((1 << nbits) - 1) << offset)) | (value << offset); -+} -+ -+/* -+ * Naming conventions for codegen macros: -+ * - 64 bit opcodes have an 'X' suffix -+ * - 32 bit opcodes have a 'W' suffix -+ * - the order of operands is the same as in assembly -+ */ -+ -+/* -+ * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0487a/index.html -+ */ -+ -+/* Uncoditional branch (register) */ -+ -+// 0b1101011 == 0x6b -+#define arm_format_breg(p, opc, op2, op3, op4, rn) arm_emit ((p), (0x6b << 25) | ((opc) << 21) | ((op2) << 16) | ((op3) << 10) | ((rn) << 5) | ((op4) << 0)) -+ -+// 0b0000 == 0x0, 0b11111 == 0x1f -+#define arm_brx(p, reg) arm_format_breg ((p), 0x0, 0x1f, 0x0, 0x0, (reg)) -+ -+// 0b0001 == 0x1 -+#define arm_blrx(p, reg) arm_format_breg ((p), 0x1, 0x1f, 0x0, 0x0, (reg)) -+ -+//0b0010 == 0x2 -+#define arm_retx(p, reg) arm_format_breg ((p), 0x2, 0x1f, 0x0, 0x0, (reg)) -+ -+/* Unconditional branch (immeditate) */ -+ -+static G_GNUC_UNUSED inline gboolean -+arm_is_bl_disp (void *code, void *target) -+{ -+ gint64 disp = ((char*)(target) - (char*)(code)) / 4; -+ -+ return (disp > -(1 << 25)) && (disp < (1 << 25)); -+} -+ -+static G_GNUC_UNUSED inline unsigned int -+arm_get_disp (void *p, void *target) -+{ -+ unsigned int disp = ((char*)target - (char*)p) / 4; -+ -+ if (target) -+ g_assert (arm_is_bl_disp (p, target)); -+ -+ return (disp & 0x3ffffff); -+} -+ -+// 0b00101 == 0x5 -+#define arm_b(p, target) arm_emit (p, (0x0 << 31) | (0x5 << 26) | ((arm_get_disp ((p), (target)) << 0))) -+ -+#define arm_bl(p, target) arm_emit (p, (0x1 << 31) | (0x5 << 26) | ((arm_get_disp ((p), (target)) << 0))) -+ -+/* Conditional branch */ -+ -+static G_GNUC_UNUSED inline gboolean -+arm_is_disp19 (void *code, void *target) -+{ -+ gint64 disp = ((char*)(target) - (char*)(code)) / 4; -+ -+ return (disp > -(1 << 18)) && (disp < (1 << 18)); -+} -+ -+static G_GNUC_UNUSED inline unsigned int -+arm_get_disp19 (void *p, void *target) -+{ -+ unsigned int disp = ((char*)target - (char*)p) / 4; -+ -+ if (target) -+ g_assert (arm_is_disp19 (p, target)); -+ -+ return (disp & 0x7ffff); -+} -+ -+// 0b0101010 == 0x2a -+#define arm_format_condbr(p, o1, o0, cond, disp) arm_emit ((p), (0x2a << 25) | ((o1) << 24) | ((disp) << 5) | ((o0) << 4) | ((cond) << 0)) -+#define arm_get_bcc_cond(p) ((*(guint32*)p) & 0xf) -+ -+#define arm_bcc(p, cond, target) arm_format_condbr ((p), 0x0, 0x0, (cond), arm_get_disp19 ((p), (target))) -+ -+// 0b011010 == 0x1a -+#define arm_format_cmpbr(p, sf, op, rt, target) arm_emit ((p), ((sf) << 31) | (0x1a << 25) | ((op) << 24) | (arm_get_disp19 ((p), (target)) << 5) | ((rt) << 0)) -+ -+#define arm_set_cbz_target(p, target) arm_set_ins_bits (p, 5, 19, arm_get_disp19 ((p), (target))) -+ -+#define arm_cbzx(p, rt, target) arm_format_cmpbr ((p), 0x1, 0x0, (rt), (target)) -+#define arm_cbzw(p, rt, target) arm_format_cmpbr ((p), 0x0, 0x0, (rt), (target)) -+ -+#define arm_cbnzx(p, rt, target) arm_format_cmpbr ((p), 0x1, 0x1, (rt), (target)) -+#define arm_cbnzw(p, rt, target) arm_format_cmpbr ((p), 0x0, 0x1, (rt), (target)) -+ -+static G_GNUC_UNUSED inline unsigned int -+arm_get_disp15 (void *p, void *target) -+{ -+ unsigned int disp = ((char*)target - (char*)p) / 4; -+ return (disp & 0x7fff); -+} -+ -+// 0b011011 == 0x1b -+#define arm_format_tbimm(p, op, rt, bit, target) arm_emit ((p), ((((bit) >> 5) & 1) << 31) | (0x1b << 25) | ((op) << 24) | (((bit) & 0x1f) << 19) | (arm_get_disp15 ((p), (target)) << 5) | ((rt) << 0)) -+ -+#define arm_tbz(p, rt, bit, target) arm_format_tbimm ((p), 0x0, (rt), (bit), (target)) -+#define arm_tbnz(p, rt, bit, target) arm_format_tbimm ((p), 0x1, (rt), (bit), (target)) -+ -+/* Memory access */ -+ -+#define arm_is_pimm12_scaled(pimm,size) ((pimm) >= 0 && (pimm) / (size) <= 0xfff && ((pimm) % (size)) == 0) -+ -+static G_GNUC_UNUSED unsigned int -+arm_encode_pimm12 (int pimm, int size) -+{ -+ g_assert (arm_is_pimm12_scaled (pimm, size)); -+ return ((unsigned int)(pimm / size)) & 0xfff; -+} -+ -+#define arm_is_strb_imm(pimm) arm_is_pimm12_scaled((pimm), 1) -+#define arm_is_strh_imm(pimm) arm_is_pimm12_scaled((pimm), 2) -+#define arm_is_strw_imm(pimm) arm_is_pimm12_scaled((pimm), 4) -+#define arm_is_strx_imm(pimm) arm_is_pimm12_scaled((pimm), 8) -+ -+/* Load/Store register + scaled immediate */ -+/* No pre-index/post-index yet */ -+#define arm_format_mem_imm(p, size, opc, rt, rn, pimm, scale) arm_emit ((p), ((size) << 30) | (0x39 << 24) | ((opc) << 22) | (arm_encode_pimm12 ((pimm), (scale)) << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+/* C5.6.83 LDR (immediate) */ -+#define arm_ldrx(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_X, 0x1, (rt), (rn), (pimm), 8) -+#define arm_ldrw(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_W, 0x1, (rt), (rn), (pimm), 4) -+/* C5.6.86 LDRB (immediate) */ -+#define arm_ldrb(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_B, 0x1, (rt), (rn), (pimm), 1) -+/* C5.6.88 LDRH (immediate) */ -+#define arm_ldrh(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_H, 0x1, (rt), (rn), (pimm), 2) -+/* C5.6.90 LDRSB (immediate) */ -+#define arm_ldrsbx(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_B, 0x2, (rt), (rn), (pimm), 1) -+#define arm_ldrsbw(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_B, 0x3, (rt), (rn), (pimm), 1) -+/* C5.6.92 LDRSH (immediate) */ -+#define arm_ldrshx(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_H, 0x2, (rt), (rn), (pimm), 2) -+#define arm_ldrshw(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_H, 0x3, (rt), (rn), (pimm), 2) -+/* C5.6.94 LDRSW (immediate) */ -+#define arm_ldrswx(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_W, 0x2, (rt), (rn), (pimm), 4) -+ -+/* C5.6.178 STR (immediate) */ -+#define arm_strx(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_X, 0x0, (rt), (rn), (pimm), 8) -+#define arm_strw(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_W, 0x0, (rt), (rn), (pimm), 4) -+/* C5.6.182 STR (immediate) */ -+#define arm_strh(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_H, 0x0, (rt), (rn), (pimm), 2) -+#define arm_strb(p, rt, rn, pimm) arm_format_mem_imm (p, ARMSIZE_B, 0x0, (rt), (rn), (pimm), 1) -+ -+/* C3.3.9 Load/store register (immediate post-indexed) */ -+static G_GNUC_UNUSED unsigned int -+arm_encode_simm9 (int simm) -+{ -+ g_assert (simm >= -256 && simm <= 255); -+ return ((unsigned int)simm) & 0x1ff; -+} -+ -+#define arm_format_mem_imm_post(p, size, V, opc, rt, rn, simm) arm_emit ((p), ((size) << 30) | (0x7 << 27) | ((V) << 26) | (0x0 << 24) | ((opc) << 22) | (arm_encode_simm9 ((simm)) << 12) | (0x1 << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+#define arm_ldrx_post(p, rt, rn, simm) arm_format_mem_imm_post (p, ARMSIZE_X, 0x0, 0x1, (rt), (rn), (simm)) -+#define arm_ldrw_post(p, rt, rn, simm) arm_format_mem_imm_post (p, ARMSIZE_W, 0x0, 0x1, (rt), (rn), (simm)) -+ -+#define arm_strx_post(p, rt, rn, simm) arm_format_mem_imm_post (p, ARMSIZE_X, 0x0, 0x0, (rt), (rn), (simm)) -+#define arm_strw_post(p, rt, rn, simm) arm_format_mem_imm_post (p, ARMSIZE_W, 0x0, 0x0, (rt), (rn), (simm)) -+ -+/* C3.3.9 Load/store register (immediate pre-indexed) */ -+#define arm_format_mem_imm_pre(p, size, V, opc, rt, rn, simm) arm_emit ((p), ((size) << 30) | (0x7 << 27) | ((V) << 26) | (0x0 << 24) | ((opc) << 22) | (arm_encode_simm9 ((simm)) << 12) | (0x3 << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+#define arm_ldrx_pre(p, rt, rn, simm) arm_format_mem_imm_pre (p, ARMSIZE_X, 0x0, 0x1, (rt), (rn), (simm)) -+#define arm_ldrw_pre(p, rt, rn, simm) arm_format_mem_imm_pre (p, ARMSIZE_W, 0x0, 0x1, (rt), (rn), (simm)) -+ -+#define arm_strx_pre(p, rt, rn, simm) arm_format_mem_imm_pre (p, ARMSIZE_X, 0x0, 0x0, (rt), (rn), (simm)) -+#define arm_strw_pre(p, rt, rn, simm) arm_format_mem_imm_pre (p, ARMSIZE_W, 0x0, 0x0, (rt), (rn), (simm)) -+ -+/* Load/Store register + register */ -+/* No extend/scale yet */ -+#define arm_format_mem_reg(p, size, opc, rt, rn, rm) arm_emit ((p), ((size) << 30) | (0x38 << 24) | ((opc) << 22) | (0x1 << 21) | ((rm) << 16) | (0x3 << 13) | (0 << 12) | (0x2 << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+/* C5.6.85 LDR (register) */ -+#define arm_ldrx_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_X, 0x1, (rt), (rn), (rm)) -+#define arm_ldrw_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_W, 0x1, (rt), (rn), (rm)) -+/* C5.6.87 LDRB (register) */ -+#define arm_ldrb_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_B, 0x1, (rt), (rn), (rm)) -+/* C5.6.88 LDRH (register) */ -+#define arm_ldrh_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_H, 0x1, (rt), (rn), (rm)) -+/* C5.6.91 LDRSB (register) */ -+#define arm_ldrsbx_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_B, 0x2, (rt), (rn), (rm)) -+#define arm_ldrsbw_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_B, 0x3, (rt), (rn), (rm)) -+/* C5.6.93 LDRSH (register) */ -+#define arm_ldrshx_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_H, 0x2, (rt), (rn), (rm)) -+#define arm_ldrshw_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_H, 0x3, (rt), (rn), (rm)) -+/* C5.6.96 LDRSW (register) */ -+#define arm_ldrswx_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_W, 0x2, (rt), (rn), (rm)) -+ -+/* C5.6.179 STR (register) */ -+#define arm_strx_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_X, 0x0, (rt), (rn), (rm)) -+#define arm_strw_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_W, 0x0, (rt), (rn), (rm)) -+/* C5.6.181 STRB (register) */ -+#define arm_strb_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_B, 0x0, (rt), (rn), (rm)) -+/* C5.6.183 STRH (register) */ -+#define arm_strh_reg(p, rt, rn, rm) arm_format_mem_reg ((p), ARMSIZE_H, 0x0, (rt), (rn), (rm)) -+ -+/* PC relative */ -+ -+/* C5.6.84 LDR (literal) */ -+ -+#define arm_get_ldr_lit_reg(p) (*(guint32*)(p) & 0x1f) -+ -+#define arm_ldrx_lit(p, rt, target) arm_emit ((p), (0x01 << 30) | (0x18 << 24) | (arm_get_disp19 ((p), (target)) << 5) | ((rt) << 0)) -+#define arm_ldrw_lit(p, rt, target) arm_emit ((p), (0x00 << 30) | (0x18 << 24) | (arm_get_disp19 ((p), (target)) << 5) | ((rt) << 0)) -+#define arm_ldrswx_lit(p, rt, target) arm_emit ((p), (0x2 << 30) | (0x18 << 24) | (arm_get_disp19 ((p), (target)) << 5) | ((rt) << 0)) -+ -+/* Unscaled offset */ -+/* FIXME: Not yet */ -+ -+/* Load/Store Pair */ -+ -+static G_GNUC_UNUSED unsigned int -+arm_encode_imm7 (int imm, int size) -+{ -+ g_assert (imm / size >= -64 && imm / size <= 63 && (imm % size) == 0); -+ return ((unsigned int)(imm / size)) & 0x7f; -+} -+ -+#define arm_is_imm7_scaled(imm, size) ((imm) / (size) >= -64 && (imm) / (size) <= 63 && ((imm) % (size)) == 0) -+ -+#define arm_is_ldpx_imm(imm) arm_is_imm7_scaled ((imm), 8) -+ -+/* C3.3.14 */ -+#define arm_format_mem_p(p, size, opc, L, rt1, rt2, rn, imm) arm_emit ((p), (opc << 30) | (0x52 << 23) | ((L) << 22) | (arm_encode_imm7 (imm, size) << 15) | ((rt2) << 10) | ((rn) << 5) | ((rt1) << 0)) -+ -+#define arm_ldpx(p, rt1, rt2, rn, imm) arm_format_mem_p ((p), 8, 0x2, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_ldpw(p, rt1, rt2, rn, imm) arm_format_mem_p ((p), 4, 0x0, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_ldpsw(p, rt1, rt2, rn, imm) arm_format_mem_p ((p), 4, 0x1, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_stpx(p, rt1, rt2, rn, imm) arm_format_mem_p ((p), 8, 0x2, 0, (rt1), (rt2), (rn), (imm)) -+#define arm_stpw(p, rt1, rt2, rn, imm) arm_format_mem_p ((p), 4, 0x0, 0, (rt1), (rt2), (rn), (imm)) -+ -+/* Load/Store Pair (Pre-indexed) */ -+/* C3.3.16 */ -+#define arm_format_mem_p_pre(p, size, opc, L, rt1, rt2, rn, imm) arm_emit ((p), (opc << 30) | (0x53 << 23) | ((L) << 22) | (arm_encode_imm7 (imm, size) << 15) | ((rt2) << 10) | ((rn) << 5) | ((rt1) << 0)) -+ -+#define arm_ldpx_pre(p, rt1, rt2, rn, imm) arm_format_mem_p_pre ((p), 8, 0x2, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_ldpw_pre(p, rt1, rt2, rn, imm) arm_format_mem_p_pre ((p), 4, 0x0, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_ldpsw_pre(p, rt1, rt2, rn, imm) arm_format_mem_p_pre ((p), 4, 0x1, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_stpx_pre(p, rt1, rt2, rn, imm) arm_format_mem_p_pre ((p), 8, 0x2, 0, (rt1), (rt2), (rn), (imm)) -+#define arm_stpw_pre(p, rt1, rt2, rn, imm) arm_format_mem_p_pre ((p), 4, 0x0, 0, (rt1), (rt2), (rn), (imm)) -+ -+/* Not an official alias */ -+#define arm_pushpx (p, rt1, rt2) arm_LDPX_pre (p, rt1, rt2, ARMREG_RSP, -8) -+ -+/* Load/Store Pair (Post-indexed) */ -+/* C3.3.15 */ -+#define arm_format_mem_p_post(p, size, opc, L, rt1, rt2, rn, imm) arm_emit ((p), (opc << 30) | (0x51 << 23) | ((L) << 22) | (arm_encode_imm7 (imm, size) << 15) | ((rt2) << 10) | ((rn) << 5) | ((rt1) << 0)) -+ -+#define arm_ldpx_post(p, rt1, rt2, rn, imm) arm_format_mem_p_post ((p), 8, 0x2, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_ldpw_post(p, rt1, rt2, rn, imm) arm_format_mem_p_post ((p), 4, 0x0, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_ldpsw_post(p, rt1, rt2, rn, imm) arm_format_mem_p_post ((p), 4, 0x1, 1, (rt1), (rt2), (rn), (imm)) -+#define arm_stpx_post(p, rt1, rt2, rn, imm) arm_format_mem_p_post ((p), 8, 0x2, 0, (rt1), (rt2), (rn), (imm)) -+#define arm_stpw_post(p, rt1, rt2, rn, imm) arm_format_mem_p_post ((p), 4, 0x0, 0, (rt1), (rt2), (rn), (imm)) -+ -+/* Not an official alias */ -+#define arm_poppx (p, rt1, rt2) arm_ldpx_post (p, rt1, rt2, ARMREG_RSP, 8) -+ -+/* Load/Store Exclusive */ -+#define arm_format_ldxr(p, size, rt, rn) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x0 << 23) | (0x1 << 22) | (0x0 << 21) | (0x1f << 16) | (0x0 << 15) | (0x1f << 10) | ((rn) << 5) | ((rt) << 0)) -+#define arm_format_ldxp(p, size, rt1, rt2, rn) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x0 << 23) | (0x1 << 22) | (0x1 << 21) | (0x1f << 16) | (0x0 << 15) | ((rt2) << 10)| ((rn) << 5) | ((rt1) << 0)) -+#define arm_format_stxr(p, size, rs, rt, rn) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x0 << 23) | (0x0 << 22) | (0x0 << 21) | ((rs) << 16) | (0x0 << 15) | (0x1f << 10) | ((rn) << 5) | ((rt) << 0)) -+#define arm_format_stxp(p, size, rs, rt1, rt2, rn) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x0 << 23) | (0x0 << 22) | (0x1 << 21) | ((rs) << 16) | (0x0 << 15) | ((rt2) << 10)| ((rn) << 5) | ((rt1) << 0)) -+ -+#define arm_ldxrx(p, rt, rn) arm_format_ldxr ((p), ARMSIZE_X, (rt), (rn)) -+#define arm_ldxrw(p, rt, rn) arm_format_ldxr ((p), ARMSIZE_W, (rt), (rn)) -+#define arm_ldxrh(p, rt, rn) arm_format_ldxr ((p), ARMSIZE_H, (rt), (rn)) -+#define arm_ldxrb(p, rt, rn) arm_format_ldxr ((p), ARMSIZE_B, (rt), (rn)) -+#define arm_ldxpx(p, rt1, rt2, rn) arm_format_ldxp ((p), ARMSIZE_X, (rt1), (rt2), (rn)) -+#define arm_ldxpw(p, rt1, rt2, rn) arm_format_ldxp ((p), ARMSIZE_W, (rt1), (rt2), (rn)) -+#define arm_stxrx(p, rs, rt, rn) arm_format_stxr ((p), ARMSIZE_X, (rs), (rt), (rn)) -+#define arm_stxrw(p, rs, rt, rn) arm_format_stxr ((p), ARMSIZE_W, (rs), (rt), (rn)) -+#define arm_stxrh(p, rs, rt, rn) arm_format_stxr ((p), ARMSIZE_H, (rs), (rt), (rn)) -+#define arm_stxrb(p, rs, rt, rn) arm_format_stxr ((p), ARMSIZE_B, (rs), (rt), (rn)) -+#define arm_stxpx(p, rs, rt1, rt2, rn) arm_format_stxp ((p), ARMSIZE_X, (rs), (rt1), (rt2), (rn)) -+#define arm_stxpw(p, rs, rt1, rt2, rn) arm_format_stxp ((p), ARMSIZE_W, (rs), (rt1), (rt2), (rn)) -+ -+/* C5.6.73 LDAR: Load-Acquire Register */ -+ -+#define arm_format_ldar(p, size, rt, rn) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x1 << 23) | (0x1 << 22) | (0x0 << 21) | (0x1f << 16) | (0x1 << 15) | (0x1f << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+#define arm_ldarx(p, rt, rn) arm_format_ldar ((p), ARMSIZE_X, (rt), (rn)) -+#define arm_ldarw(p, rt, rn) arm_format_ldar ((p), ARMSIZE_W, (rt), (rn)) -+#define arm_ldarh(p, rt, rn) arm_format_ldar ((p), ARMSIZE_H, (rt), (rn)) -+#define arm_ldarb(p, rt, rn) arm_format_ldar ((p), ARMSIZE_B, (rt), (rn)) -+ -+/* C5.6.169 STLR: Store-Release Register */ -+ -+#define arm_format_stlr(p, size, rt, rn) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x1 << 23) | (0x0 << 22) | (0x0 << 21) | (0x1f << 16) | (0x1 << 15) | (0x1f << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+#define arm_stlrx(p, rn, rt) arm_format_stlr ((p), ARMSIZE_X, (rt), (rn)) -+#define arm_stlrw(p, rn, rt) arm_format_stlr ((p), ARMSIZE_W, (rt), (rn)) -+#define arm_stlrh(p, rn, rt) arm_format_stlr ((p), ARMSIZE_H, (rt), (rn)) -+#define arm_stlrb(p, rn, rt) arm_format_stlr ((p), ARMSIZE_B, (rt), (rn)) -+ -+/* C5.6.77 LDAXR */ -+#define arm_format_ldaxr(p, size, rn, rt) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x0 << 23) | (0x1 << 22) | (0x0 << 21) | (0x1f << 16) | (0x1 << 15) | (0x1f << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+#define arm_ldaxrx(p, rt, rn) arm_format_ldaxr ((p), 0x3, (rn), (rt)) -+#define arm_ldaxrw(p, rt, rn) arm_format_ldaxr ((p), 0x2, (rn), (rt)) -+ -+/* C5.6.173 STLXR */ -+#define arm_format_stlxr(p, size, rs, rn, rt) arm_emit ((p), ((size) << 30) | (0x8 << 24) | (0x0 << 23) | (0x0 << 22) | (0x0 << 21) | ((rs) << 16) | (0x1 << 15) | (0x1f << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+#define arm_stlxrx(p, rs, rt, rn) arm_format_stlxr ((p), 0x3, (rs), (rn), (rt)) -+#define arm_stlxrw(p, rs, rt, rn) arm_format_stlxr ((p), 0x2, (rs), (rn), (rt)) -+ -+/* Load/Store SIMD&FP */ -+ -+/* C6.3.285 STR (immediate, SIMD&FP) */ -+#define arm_format_strfp_imm(p, size, opc, rt, rn, pimm, scale) arm_emit ((p), ((size) << 30) | (0xf << 26) | (0x1 << 24) | ((opc) << 22) | (arm_encode_pimm12 ((pimm), (scale)) << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+/* Store double */ -+#define arm_strfpx(p, dt, xn, simm) arm_format_strfp_imm ((p), ARMSIZE_X, 0x0, (dt), (xn), (simm), 8) -+/* Store single */ -+#define arm_strfpw(p, st, xn, simm) arm_format_strfp_imm ((p), ARMSIZE_W, 0x0, (st), (xn), (simm), 4) -+ -+/* C6.3.166 LDR (immediate, SIMD&FP) */ -+#define arm_format_ldrfp_imm(p, size, opc, rt, rn, pimm, scale) arm_emit ((p), ((size) << 30) | (0xf << 26) | (0x1 << 24) | ((opc) << 22) | (arm_encode_pimm12 ((pimm), (scale)) << 10) | ((rn) << 5) | ((rt) << 0)) -+ -+/* Load double */ -+#define arm_ldrfpx(p, dt, xn, simm) arm_format_ldrfp_imm ((p), ARMSIZE_X, 0x1, dt, xn, simm, 8) -+/* Load single */ -+#define arm_ldrfpw(p, dt, xn, simm) arm_format_ldrfp_imm ((p), ARMSIZE_W, 0x1, dt, xn, simm, 4) -+ -+/* Arithmetic (immediate) */ -+static G_GNUC_UNUSED inline guint32 -+arm_encode_arith_imm (int imm, guint32 *shift) -+{ -+ // FIXME: -+ g_assert ((imm >= 0) && (imm < 0xfff)); -+ *shift = 0; -+ return (guint32)imm; -+} -+ -+// FIXME: -+#define arm_is_arith_imm(imm) (((imm) >= 0) && ((imm) < 0xfff)) -+ -+#define arm_format_alu_imm(p, sf, op, S, rd, rn, imm) do { \ -+ guint32 _imm12, _shift; \ -+ _imm12 = arm_encode_arith_imm ((imm), &_shift); arm_emit ((p), ((sf) << 31) | ((op) << 30) | ((S) << 29) | (0x11 << 24) | ((_shift) << 22) | ((_imm12) << 10) | ((rn) << 5) | ((rd) << 0)); \ -+} while (0) -+ -+/* rd/rn can be SP for addx/subx */ -+#define arm_addx_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x1, 0x0, 0x0, (rd), (rn), (imm)) -+#define arm_addw_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x0, 0x0, 0x0, (rd), (rn), (imm)) -+#define arm_addsx_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x1, 0x0, 0x1, (rd), (rn), (imm)) -+#define arm_addsw_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x0, 0x0, 0x1, (rd), (rn), (imm)) -+#define arm_subx_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x1, 0x1, 0x0, (rd), (rn), (imm)) -+#define arm_subw_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x0, 0x1, 0x0, (rd), (rn), (imm)) -+#define arm_subsx_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x1, 0x1, 0x1, (rd), (rn), (imm)) -+#define arm_subsw_imm(p, rd, rn, imm) arm_format_alu_imm ((p), 0x0, 0x1, 0x1, (rd), (rn), (imm)) -+ -+#define arm_cmpx_imm(p, rn, imm) arm_subsx_imm ((p), ARMREG_RZR, (rn), (imm)) -+#define arm_cmpw_imm(p, rn, imm) arm_subsw_imm ((p), ARMREG_RZR, (rn), (imm)) -+#define arm_cmnx_imm(p, rn, imm) arm_addsx_imm ((p), ARMREG_RZR, (rn), (imm)) -+#define arm_cmnw_imm(p, rn, imm) arm_addsw_imm ((p), ARMREG_RZR, (rn), (imm)) -+ -+/* Logical (immediate) */ -+ -+// FIXME: imm -+#if 0 -+#define arm_format_and(p, sf, opc, rd, rn, imm) arm_emit ((p), ((sf) << 31) | ((opc) << 29) | (0x24 << 23) | ((0) << 22) | ((imm) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_andx_imm(p, rd, rn, imm) arm_format_and ((p), 0x1, 0x0, (rd), (rn), (imm)) -+#define arm_andw_imm(p, rd, rn, imm) arm_format_and ((p), 0x0, 0x0, (rd), (rn), (imm)) -+#define arm_andsx_imm(p, rd, rn, imm) arm_format_and ((p), 0x1, 0x3, (rd), (rn), (imm)) -+#define arm_andsw_imm(p, rd, rn, imm) arm_format_and ((p), 0x0, 0x3, (rd), (rn), (imm)) -+#define arm_eorx_imm(p, rd, rn, imm) arm_format_and ((p), 0x1, 0x2, (rd), (rn), (imm)) -+#define arm_eorw_imm(p, rd, rn, imm) arm_format_and ((p), 0x0, 0x2, (rd), (rn), (imm)) -+#define arm_orrx_imm(p, rd, rn, imm) arm_format_and ((p), 0x1, 0x1, (rd), (rn), (imm)) -+#define arm_orrw_imm(p, rd, rn, imm) arm_format_and ((p), 0x0, 0x1, (rd), (rn), (imm)) -+ -+#define arm_tstx_imm(p, rn, imm) arm_andsx_imm ((p), ARMREG_RZR, (rn), (imm)) -+#define arm_tstw_imm(p, rn, imm) arm_andsw_imm ((p), ARMREG_RZR, (rn), (imm)) -+#endif -+ -+/* Move (wide immediate) */ -+#define arm_format_mov(p, sf, opc, hw, rd, imm16) arm_emit ((p), ((sf) << 31) | ((opc) << 29) | (0x25 << 23) | ((hw) << 21) | (((guint32)(imm16) & 0xffff) << 5) | ((rd) << 0)) -+ -+#define arm_get_movzx_rd(p) ((*(guint32*)p) & 0x1f) -+ -+#define arm_movzx(p, rd, imm, shift) do { g_assert ((shift) % 16 == 0); arm_format_mov ((p), 0x1, 0x2, (shift) / 16, (rd), (imm)); } while (0) -+#define arm_movzw(p, rd, imm, shift) do { g_assert ((shift) % 16 == 0); arm_format_mov ((p), 0x0, 0x2, (shift) / 16, (rd), (imm)); } while (0) -+#define arm_movnx(p, rd, imm, shift) do { g_assert ((shift) % 16 == 0); arm_format_mov ((p), 0x1, 0x0, (shift) / 16, (rd), (imm)); } while (0) -+#define arm_movnw(p, rd, imm, shift) do { g_assert ((shift) % 16 == 0); arm_format_mov ((p), 0x0, 0x0, (shift) / 16, (rd), (imm)); } while (0) -+#define arm_movkx(p, rd, imm, shift) do { g_assert ((shift) % 16 == 0); arm_format_mov ((p), 0x1, 0x3, (shift) / 16, (rd), (imm)); } while (0) -+#define arm_movkw(p, rd, imm, shift) do { g_assert ((shift) % 16 == 0); arm_format_mov ((p), 0x0, 0x3, (shift) / 16, (rd), (imm)); } while (0) -+ -+/* PC-relative address calculation */ -+#define arm_format_adrp(p, op, rd, target) do { guint64 imm1 = (guint64)(target); guint64 imm2 = (guint64)(p); int _imm = imm1 - imm2; arm_emit ((p), ((op) << 31) | (((_imm) & 0x3) << 29) | (0x10 << 24) | (((_imm >> 2) & 0x7ffff) << 5) | ((rd) << 0)); } while (0) -+ -+#define arm_adrpx(p, rd, target) arm_format_adrp ((p), 0x1, (rd), (target)) -+#define arm_adrx(p, rd, target) arm_format_adrp ((p), 0x0, (rd), (target)) -+ -+/* Bitfield move */ -+#define arm_format_bfm(p, sf, opc, N, immr, imms, rn, rd) arm_emit ((p), ((sf) << 31) | ((opc) << 29) | (0x26 << 23) | ((N) << 22) | ((N) << 22) | ((immr) << 16) | ((imms) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_bfmx(p, rd, rn, immr, imms) arm_format_bfm ((p), 0x1, 0x1, 0x1, (immr), (imms), (rn), (rd)) -+#define arm_bfmw(p, rd, rn, immr, imms) arm_format_bfm ((p), 0x0, 0x1, 0x0, (immr), (imms), (rn), (rd)) -+#define arm_sbfmx(p, rd, rn, immr, imms) arm_format_bfm ((p), 0x1, 0x0, 0x1, (immr), (imms), (rn), (rd)) -+#define arm_sbfmw(p, rd, rn, immr, imms) arm_format_bfm ((p), 0x0, 0x0, 0x0, (immr), (imms), (rn), (rd)) -+#define arm_ubfmx(p, rd, rn, immr, imms) arm_format_bfm ((p), 0x1, 0x2, 0x1, (immr), (imms), (rn), (rd)) -+#define arm_ubfmw(p, rd, rn, immr, imms) arm_format_bfm ((p), 0x0, 0x2, 0x0, (immr), (imms), (rn), (rd)) -+ -+/* Sign extend and Zero-extend */ -+#define arm_sxtbx(p, rd, rn) arm_sbfmx ((p), (rd), (rn), 0, 7) -+#define arm_sxtbw(p, rd, rn) arm_sbfmw ((p), (rd), (rn), 0, 7) -+#define arm_sxthx(p, rd, rn) arm_sbfmx ((p), (rd), (rn), 0, 15) -+#define arm_sxthw(p, rd, rn) arm_sbfmw ((p), (rd), (rn), 0, 15) -+#define arm_sxtwx(p, rd, rn) arm_sbfmx ((p), (rd), (rn), 0, 31) -+#define arm_uxtbx(p, rd, rn) arm_ubfmx ((p), (rd), (rn), 0, 7) -+#define arm_uxtbw(p, rd, rn) arm_ubfmw ((p), (rd), (rn), 0, 7) -+#define arm_uxthx(p, rd, rn) arm_ubfmx ((p), (rd), (rn), 0, 15) -+#define arm_uxthw(p, rd, rn) arm_ubfmw ((p), (rd), (rn), 0, 15) -+ -+/* Extract register */ -+#define arm_format_extr(p, sf, N, rd, rn, rm, imms) arm_emit ((p), ((sf) << 31) | (0x27 << 23) | ((N) << 22) | (0x0 << 21) | ((rm) << 16) | ((imms) << 10) | ((rn) << 5) | ((rd) << 0)) -+#define arm_extrx(p, rd, rn, rm, lsb) arm_format_extr ((p), 0x1, 0x1, (rd), (rn), (rm), (lsb)) -+#define arm_extrw(p, rd, rn, rm, lsb) arm_format_extr ((p), 0x0, 0x0, (rd), (rn), (rm), (lsb)) -+ -+/* Shift (immediate) */ -+#define arm_asrx(p, rd, rn, shift) arm_sbfmx ((p), (rd), (rn), (shift), 63) -+#define arm_asrw(p, rd, rn, shift) arm_sbfmw ((p), (rd), (rn), (shift), 31) -+#define arm_lslx(p, rd, rn, shift) arm_ubfmx ((p), (rd), (rn), 64 - ((shift) % 64), 63 - ((shift) % 64)) -+#define arm_lslw(p, rd, rn, shift) arm_ubfmw ((p), (rd), (rn), 32 - ((shift) % 32), 31 - ((shift) % 32)) -+#define arm_lsrx(p, rd, rn, shift) arm_ubfmx ((p), (rd), (rn), shift, 63) -+#define arm_lsrw(p, rd, rn, shift) arm_ubfmw ((p), (rd), (rn), shift, 31) -+#define arm_rorx(p, rd, rs, shift) arm_extrx ((p), (rd), (rs), (rs), (shift)) -+#define arm_rorw(p, rd, rs, shift) arm_extrw ((p), (rd), (rs), (rs), (shift)) -+ -+/* Arithmetic (shifted register) */ -+#define arm_format_alu_shift(p, sf, op, S, rd, rn, rm, shift, imm6) arm_emit ((p), ((sf) << 31) | ((op) << 30) | ((S) << 29) | (0xb << 24) | ((shift) << 22) | (0x0 << 21) | ((rm) << 16) | ((imm6) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_addx_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x1, 0x0, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_addw_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x0, 0x0, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_addsx_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x1, 0x0, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_addsw_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x0, 0x0, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_subx_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x1, 0x1, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_subw_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x0, 0x1, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_subsx_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x1, 0x1, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_subsw_shift(p, rd, rn, rm, shift_type, amount) arm_format_alu_shift ((p), 0x0, 0x1, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_cmnx_shift(p, rn, rm, shift_type, amount) arm_addsx_shift ((p), ARMREG_RZR, (rn), (rm), (shift_type), (amount)) -+#define arm_cmnw_shift(p, rn, rm, shift_type, amount) arm_addsw_shift ((p), ARMREG_RZR, (rn), (rm), (shift_type), (amount)) -+#define arm_cmpx_shift(p, rn, rm, shift_type, amount) arm_subsx_shift ((p), ARMREG_RZR, (rn), (rm), (shift_type), (amount)) -+#define arm_cmpw_shift(p, rn, rm, shift_type, amount) arm_subsw_shift ((p), ARMREG_RZR, (rn), (rm), (shift_type), (amount)) -+#define arm_negx_shift(p, rd, rm, shift_type, amount) arm_subx_shift ((p), (rd), ARMREG_RZR, (rm), (shift_type), (amount)) -+#define arm_negw_shift(p, rd, rm, shift_type, amount) arm_subw_shift ((p), (rd), ARMREG_RZR, (rm), (shift_type), (amount)) -+#define arm_negsx_shift(p, rd, rm, shift_type, amount) arm_subsx_shift ((p), (rd), ARMREG_RZR, (rm), (shift_type), (amount)) -+#define arm_negsw_shift(p, rd, rm, shift_type, amount) arm_subsw_shift ((p), (rd), ARMREG_RZR, (rm), (shift_type), (amount)) -+ -+#define arm_addx(p, rd, rn, rm) arm_addx_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_addw(p, rd, rn, rm) arm_addw_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_subx(p, rd, rn, rm) arm_subx_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_subw(p, rd, rn, rm) arm_subw_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_addsx(p, rd, rn, rm) arm_addsx_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_addsw(p, rd, rn, rm) arm_addsw_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_subsx(p, rd, rn, rm) arm_subsx_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_subsw(p, rd, rn, rm) arm_subsw_shift ((p), (rd), (rn), (rm), 0, 0) -+#define arm_cmpx(p, rd, rn) arm_cmpx_shift ((p), (rd), (rn), 0, 0) -+#define arm_cmpw(p, rd, rn) arm_cmpw_shift ((p), (rd), (rn), 0, 0) -+#define arm_negx(p, rd, rn) arm_negx_shift ((p), (rd), (rn), 0, 0) -+#define arm_negw(p, rd, rn) arm_negw_shift ((p), (rd), (rn), 0, 0) -+ -+/* Arithmetic with carry */ -+#define arm_format_adc(p, sf, op, S, rd, rn, rm) arm_emit ((p), ((sf) << 31) | ((op) << 30) | ((S) << 29) | (0xd0 << 21) | ((rm) << 16) | (0x0 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_adcx(p, rd, rn, rm) arm_format_adc ((p), 0x1, 0x0, 0x0, (rd), (rn), (rm)) -+#define arm_adcw(p, rd, rn, rm) arm_format_adc ((p), 0x0, 0x0, 0x0, (rd), (rn), (rm)) -+#define arm_adcsx(p, rd, rn, rm) arm_format_adc ((p), 0x1, 0x0, 0x1, (rd), (rn), (rm)) -+#define arm_adcsw(p, rd, rn, rm) arm_format_adc ((p), 0x0, 0x0, 0x1, (rd), (rn), (rm)) -+#define arm_sbcx(p, rd, rn, rm) arm_format_adc ((p), 0x1, 0x1, 0x0, (rd), (rn), (rm)) -+#define arm_sbcw(p, rd, rn, rm) arm_format_adc ((p), 0x0, 0x1, 0x0, (rd), (rn), (rm)) -+#define arm_sbcsx(p, rd, rn, rm) arm_format_adc ((p), 0x1, 0x1, 0x1, (rd), (rn), (rm)) -+#define arm_sbcsw(p, rd, rn, rm) arm_format_adc ((p), 0x0, 0x1, 0x1, (rd), (rn), (rm)) -+#define arm_ngcx(p, rd, rm) arm_sbcx ((p), (rd), ARMREG_RZR, (rm)) -+#define arm_ngcw(p, rd, rm) arm_sbcw ((p), (rd), ARMREG_RZR, (rm)) -+#define arm_ngcsx(p, rd, rm) arm_sbcsx ((p), (rd), ARMREG_RZR, (rm)) -+#define arm_ngcsw(p, rd, rm) arm_sbcsw ((p), (rd), ARMREG_RZR, (rm)) -+ -+/* Logical (shifted register) */ -+#define arm_format_logical_shift(p, sf, op, N, rd, rn, rm, shift, imm6) arm_emit ((p), ((sf) << 31) | ((op) << 29) | (0xa << 24) | ((shift) << 22) | ((N) << 21) | ((rm) << 16) | ((imm6) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_andx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x0, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_andw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x0, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_andsx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x3, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_andsw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x3, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_bicx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x0, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_bicw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x0, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_bicsx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x3, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_bicsw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x3, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_eonx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x2, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_eonw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x2, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_eorx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x2, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_eorw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x2, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_orrx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x1, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_orrw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x1, 0x0, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_ornx_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x1, 0x1, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_ornw_shift(p, rd, rn, rm, shift_type, amount) arm_format_logical_shift ((p), 0x0, 0x1, 0x1, (rd), (rn), (rm), (shift_type), (amount)) -+#define arm_mvnx_shift(p, rd, rm, shift_type, amount) arm_ornx_shift ((p), (rd), ARMREG_RZR, (rm), (shift_type), (amount)) -+#define arm_mvnw_shift(p, rd, rm, shift_type, amount) arm_ornw_shift ((p), (rd), ARMREG_RZR, (rm), (shift_type), (amount)) -+#define arm_tstx_shift(p, rn, rm, shift_type, amount) arm_andsx_shift ((p), ARMREG_RZR, (rn), (rm), (shift_type), (amount)) -+#define arm_tstw_shift(p, rn, rm, shift_type, amount) arm_andsw_shift ((p), ARMREG_RZR, (rn), (rm), (shift_type), (amount)) -+/* Aliases */ -+#define arm_andx(p, rd, rn, rm) arm_andx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_andw(p, rd, rn, rm) arm_andw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_andsx(p, rd, rn, rm) arm_andsx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_andsw(p, rd, rn, rm) arm_andsw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_bixx(p, rd, rn, rm) arm_bixx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_bixw(p, rd, rn, rm) arm_bixw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_bixsx(p, rd, rn, rm) arm_bixsx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_bixsw(p, rd, rn, rm) arm_bixsw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_eonx(p, rd, rn, rm) arm_eonx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_eonw(p, rd, rn, rm) arm_eonw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_eorx(p, rd, rn, rm) arm_eorx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_eorw(p, rd, rn, rm) arm_eorw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_orrx(p, rd, rn, rm) arm_orrx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_orrw(p, rd, rn, rm) arm_orrw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_ornx(p, rd, rn, rm) arm_ornx_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_ornw(p, rd, rn, rm) arm_ornw_shift(p, rd, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_mvnx(p, rd, rm) arm_mvnx_shift(p, rd, rm, ARMSHIFT_LSL, 0) -+#define arm_mvnw(p, rd, rm) arm_mvnw_shift(p, rd, rm, ARMSHIFT_LSL, 0) -+#define arm_tstx(p, rn, rm) arm_tstx_shift(p, rn, rm, ARMSHIFT_LSL, 0) -+#define arm_tstw(p, rn, rm) arm_tstw_shift(p, rn, rm, ARMSHIFT_LSL, 0) -+ -+/* Move (register) */ -+#define arm_movx(p, rn, rm) arm_orrx_shift ((p), (rn), ARMREG_RZR, (rm), ARMSHIFT_LSL, 0) -+#define arm_movw(p, rn, rm) arm_orrw_shift ((p), (rn), ARMREG_RZR, (rm), ARMSHIFT_LSL, 0) -+ -+/* Not an official alias */ -+#define arm_movspx(p, rn, rm) arm_addx_imm ((p), (rn), (rm), 0) -+ -+/* Shift (register) */ -+#define arm_format_shift_reg(p, sf, op2, rd, rn, rm) arm_emit ((p), ((sf) << 31) | (0xd6 << 21) | ((rm) << 16) | (0x2 << 12) | ((op2) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_asrvx(p, rd, rn, rm) arm_format_shift_reg ((p), 0x1, 0x2, (rd), (rn), (rm)) -+#define arm_asrvw(p, rd, rn, rm) arm_format_shift_reg ((p), 0x0, 0x2, (rd), (rn), (rm)) -+#define arm_lslvx(p, rd, rn, rm) arm_format_shift_reg ((p), 0x1, 0x0, (rd), (rn), (rm)) -+#define arm_lslvw(p, rd, rn, rm) arm_format_shift_reg ((p), 0x0, 0x0, (rd), (rn), (rm)) -+#define arm_lsrvx(p, rd, rn, rm) arm_format_shift_reg ((p), 0x1, 0x1, (rd), (rn), (rm)) -+#define arm_lsrvw(p, rd, rn, rm) arm_format_shift_reg ((p), 0x0, 0x1, (rd), (rn), (rm)) -+#define arm_rorvx(p, rd, rn, rm) arm_format_shift_reg ((p), 0x1, 0x3, (rd), (rn), (rm)) -+#define arm_rorvw(p, rd, rn, rm) arm_format_shift_reg ((p), 0x0, 0x3, (rd), (rn), (rm)) -+ -+/* Multiply */ -+#define arm_format_mul(p, sf, o0, rd, rn, rm, ra) arm_emit ((p), ((sf) << 31) | (0x0 << 29) | (0x1b << 24) | (0x0 << 21) | ((rm) << 16) | ((o0) << 15) | ((ra) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_maddx(p, rd, rn, rm, ra) arm_format_mul((p), 0x1, 0x0, (rd), (rn), (rm), (ra)) -+#define arm_maddw(p, rd, rn, rm, ra) arm_format_mul((p), 0x0, 0x0, (rd), (rn), (rm), (ra)) -+#define arm_msubx(p, rd, rn, rm, ra) arm_format_mul((p), 0x1, 0x1, (rd), (rn), (rm), (ra)) -+#define arm_msubw(p, rd, rn, rm, ra) arm_format_mul((p), 0x0, 0x1, (rd), (rn), (rm), (ra)) -+#define arm_mnegx(p, rd, rn, rm) arm_msubx ((p), (rd), (rn), (rm), ARMREG_RZR) -+#define arm_mnegw(p, rd, rn, rm) arm_msubw ((p), (rd), (rn), (rm), ARMREG_RZR) -+#define arm_mulx(p, rd, rn, rm) arm_maddx ((p), (rd), (rn), (rm), ARMREG_RZR) -+#define arm_mulw(p, rd, rn, rm) arm_maddw ((p), (rd), (rn), (rm), ARMREG_RZR) -+ -+/* FIXME: Missing multiple opcodes */ -+ -+/* Division */ -+#define arm_format_div(p, sf, o1, rd, rn, rm) arm_emit ((p), ((sf) << 31) | (0xd6 << 21) | ((rm) << 16) | (0x1 << 11) | ((o1) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_sdivx(p, rd, rn, rm) arm_format_div ((p), 0x1, 0x1, (rd), (rn), (rm)) -+#define arm_sdivw(p, rd, rn, rm) arm_format_div ((p), 0x0, 0x1, (rd), (rn), (rm)) -+#define arm_udivx(p, rd, rn, rm) arm_format_div ((p), 0x1, 0x0, (rd), (rn), (rm)) -+#define arm_udivw(p, rd, rn, rm) arm_format_div ((p), 0x0, 0x0, (rd), (rn), (rm)) -+ -+/* Conditional select */ -+#define arm_format_csel(p, sf, op, op2, cond, rd, rn, rm) arm_emit ((p), ((sf) << 31) | ((op) << 30) | (0xd4 << 21) | ((rm) << 16) | ((cond) << 12) | ((op2) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_cselx(p, cond, rd, rn, rm) arm_format_csel ((p), 0x1, 0x0, 0x0, (cond), (rd), (rn), (rm)) -+#define arm_cselw(p, cond, rd, rn, rm) arm_format_csel ((p), 0x0, 0x0, 0x0, (cond), (rd), (rn), (rm)) -+#define arm_csincx(p, cond, rd, rn, rm) arm_format_csel ((p), 0x1, 0x0, 0x1, (cond), (rd), (rn), (rm)) -+#define arm_csincw(p, cond, rd, rn, rm) arm_format_csel ((p), 0x0, 0x0, 0x1, (cond), (rd), (rn), (rm)) -+#define arm_csinvx(p, cond, rd, rn, rm) arm_format_csel ((p), 0x1, 0x1, 0x0, (cond), (rd), (rn), (rm)) -+#define arm_csinvw(p, cond, rd, rn, rm) arm_format_csel ((p), 0x0, 0x1, 0x0, (cond), (rd), (rn), (rm)) -+#define arm_csnegx(p, cond, rd, rn, rm) arm_format_csel ((p), 0x1, 0x1, 0x1, (cond), (rd), (rn), (rm)) -+#define arm_csnegw(p, cond, rd, rn, rm) arm_format_csel ((p), 0x0, 0x1, 0x1, (cond), (rd), (rn), (rm)) -+ -+#define arm_cset(p, cond, rd) arm_csincx ((p), ((cond) ^ 0x1), (rd), ARMREG_RZR, ARMREG_RZR) -+ -+/* C5.6.68 (HINT) */ -+#define arm_hint(p, imm) arm_emit ((p), (0xd5032 << 12) | ((imm) << 5) | (0x1f << 0)) -+#define arm_nop(p) arm_hint ((p), 0x0) -+ -+/* C5.6.29 BRK */ -+#define arm_brk(p, imm) arm_emit ((p), (0xd4 << 24) | (0x1 << 21) | ((imm) << 5)) -+ -+/* C6.3.114 FMOV (General) */ -+#define arm_format_fmov_gr(p, sf, type, rmode, opcode, rn, rd) arm_emit ((p), ((sf) << 31) | (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rmode) << 19) | ((opcode) << 16) | ((rn) << 5) | ((rd) << 0)) -+ -+/* Move gr->vfp */ -+#define arm_fmov_rx_to_double(p, dd, xn) arm_format_fmov_gr ((p), 0x1, 0x1, 0x0, 0x7, (xn), (dd)) -+ -+/* Move vfp->gr */ -+#define arm_fmov_double_to_rx(p, xd, dn) arm_format_fmov_gr ((p), 0x1, 0x1, 0x0, 0x6, (dn), (xd)) -+ -+/* C6.3.113 FMOV (register) */ -+#define arm_format_fmov(p, type, rn, rd) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | (0x10 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fmovd(p, dd, dn) arm_format_fmov ((p), 0x1, (dn), (dd)) -+#define arm_fmovs(p, dd, dn) arm_format_fmov ((p), 0x0, (dn), (dd)) -+ -+/* C6.3.54 FCMP */ -+#define arm_format_fcmp(p, type, opc, rn, rm) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rm) << 16) | (0x8 << 10) | ((rn) << 5) | ((opc) << 3)) -+ -+#define arm_fcmpd(p, dn, dm) arm_format_fcmp (p, 0x1, 0x0, (dn), (dm)) -+#define arm_fcmps(p, dn, dm) arm_format_fcmp (p, 0x0, 0x0, (dn), (dm)) -+ -+/* Float precision */ -+#define arm_format_fcvt(p, type, opc, rn, rd) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | (0x1 << 17) | ((opc) << 15) | (0x10 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+/* C6.3.57 FCVT */ -+/* single->double */ -+#define arm_fcvt_sd(p, dd, sn) arm_format_fcvt ((p), 0x0, 0x1, (sn), (dd)) -+/* double->single */ -+#define arm_fcvt_ds(p, sd, dn) arm_format_fcvt ((p), 0x1, 0x0, (dn), (sd)) -+ -+/* Float conversion to integer conversion */ -+#define arm_format_fcvtz(p, sf, type, rmode, opcode, rn, rd) arm_emit ((p), ((sf) << 31) | (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rmode) << 19) | ((opcode) << 16) | ((rn) << 5) | ((rd) << 0)) -+ -+/* C6.3.80 FCVTZS (scalar, integer) */ -+#define arm_fcvtzs_dw(p, rd, rn) arm_format_fcvtz ((p), 0x0, 0x1, 0x3, 0x0, (rn), (rd)) -+#define arm_fcvtzs_dx(p, rd, rn) arm_format_fcvtz ((p), 0x1, 0x1, 0x3, 0x0, (rn), (rd)) -+#define arm_fcvtzs_sw(p, rd, rn) arm_format_fcvtz ((p), 0x0, 0x0, 0x3, 0x0, (rn), (rd)) -+#define arm_fcvtzs_sx(p, rd, rn) arm_format_fcvtz ((p), 0x1, 0x0, 0x3, 0x0, (rn), (rd)) -+ -+/* C6.3.84 FCVTZU (scalar, integer) */ -+#define arm_fcvtzu_dw(p, rd, rn) arm_format_fcvtz ((p), 0x0, 0x1, 0x3, 0x1, (rn), (rd)) -+#define arm_fcvtzu_dx(p, rd, rn) arm_format_fcvtz ((p), 0x1, 0x1, 0x3, 0x1, (rn), (rd)) -+#define arm_fcvtzu_sw(p, rd, rn) arm_format_fcvtz ((p), 0x0, 0x0, 0x3, 0x1, (rn), (rd)) -+#define arm_fcvtzu_sx(p, rd, rn) arm_format_fcvtz ((p), 0x1, 0x0, 0x3, 0x1, (rn), (rd)) -+ -+/* C6.3.208 SCVTF (vector, integer) */ -+#define arm_format_scvtf_vector(p, sz, rn, rd) arm_emit ((p), (0x1 << 30) | (0x0 << 29) | (0x1e << 24) | ((sz) << 22) | (0x10 << 17) | (0x1d << 12) | (0x2 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_scvtf_d(p, dd, dn) arm_format_scvtf_vector ((p), 0x1, (dn), (dd)) -+#define arm_scvtf_s(p, sd, sn) arm_format_scvtf_vector ((p), 0x0, (sn), (sd)) -+ -+/* C6.3.210 SCVTF (scalar, integer) */ -+#define arm_format_scvtf_scalar(p, sf, type, rn, rd) arm_emit ((p), ((sf) << 31) | (0x1e << 24) | ((type) << 22) | (0x1 << 21) | (0x2 << 16) | (0x0 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_scvtf_rx_to_d(p, dd, rn) arm_format_scvtf_scalar ((p), 0x1, 0x1, rn, dd) -+#define arm_scvtf_rw_to_d(p, dd, rn) arm_format_scvtf_scalar ((p), 0x0, 0x1, rn, dd) -+#define arm_scvtf_rx_to_s(p, dd, rn) arm_format_scvtf_scalar ((p), 0x1, 0x0, rn, dd) -+#define arm_scvtf_rw_to_s(p, dd, rn) arm_format_scvtf_scalar ((p), 0x0, 0x0, rn, dd) -+ -+/* C6.3.306 UCVTF (vector, integer) */ -+#define arm_format_ucvtf_vector(p, sz, rn, rd) arm_emit ((p), (0x1 << 30) | (0x1 << 29) | (0x1e << 24) | ((sz) << 22) | (0x10 << 17) | (0x1d << 12) | (0x2 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_ucvtf_d(p, dd, dn) arm_format_ucvtf_vector ((p), 0x1, (dn), (dd)) -+#define arm_ucvtf_s(p, sd, sn) arm_format_ucvtf_vector ((p), 0x0, (sn), (sd)) -+ -+/* C6.3.308 UCVTF (scalar, integer) */ -+#define arm_format_ucvtf_scalar(p, sf, type, rn, rd) arm_emit ((p), ((sf) << 31) | (0x1e << 24) | ((type) << 22) | (0x1 << 21) | (0x3 << 16) | (0x0 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_ucvtf_rx_to_d(p, dd, rn) arm_format_ucvtf_scalar ((p), 0x1, 0x1, rn, dd) -+#define arm_ucvtf_rw_to_d(p, dd, rn) arm_format_ucvtf_scalar ((p), 0x0, 0x1, rn, dd) -+ -+/* C6.3.41 FADD (scalar) */ -+#define arm_format_fadd_scalar(p, type, rd, rn, rm) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rm) << 16) | (0x1 << 13) | (0x2 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fadd_d(p, rd, rn, rm) arm_format_fadd_scalar ((p), 0x1, (rd), (rn), (rm)) -+#define arm_fadd_s(p, rd, rn, rm) arm_format_fadd_scalar ((p), 0x0, (rd), (rn), (rm)) -+ -+/* C6.3.149 FSUB (scalar) */ -+#define arm_format_fsub_scalar(p, type, rd, rn, rm) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rm) << 16) | (0x1 << 13) | (0x1 << 12) | (0x2 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fsub_d(p, rd, rn, rm) arm_format_fsub_scalar ((p), 0x1, (rd), (rn), (rm)) -+#define arm_fsub_s(p, rd, rn, rm) arm_format_fsub_scalar ((p), 0x0, (rd), (rn), (rm)) -+ -+/* C6.3.119 FMUL (scalar) */ -+#define arm_format_fmul_scalar(p, type, rd, rn, rm) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rm) << 16) | (0x2 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fmul_d(p, rd, rn, rm) arm_format_fmul_scalar ((p), 0x1, (rd), (rn), (rm)) -+#define arm_fmul_s(p, rd, rn, rm) arm_format_fmul_scalar ((p), 0x0, (rd), (rn), (rm)) -+ -+/* C6.3.86 FDIV (scalar) */ -+#define arm_format_fdiv_scalar(p, type, rd, rn, rm) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((rm) << 16) | (0x1 << 12) | (0x2 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fdiv_d(p, rd, rn, rm) arm_format_fdiv_scalar ((p), 0x1, (rd), (rn), (rm)) -+#define arm_fdiv_s(p, rd, rn, rm) arm_format_fdiv_scalar ((p), 0x0, (rd), (rn), (rm)) -+ -+/* C6.3.116 FMSUB */ -+#define arm_format_fmsub(p, type, rd, rn, rm, ra) arm_emit ((p), (0x1f << 24) | ((type) << 22) | (0x0 << 21) | ((rm) << 16) | (0x1 << 15) | ((ra) << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fmsub_d(p, rd, rn, rm, ra) arm_format_fmsub ((p), 0x1, (rd), (rn), (rm), (ra)) -+ -+/* C6.3.123 FNEG */ -+#define arm_format_fneg(p, type, rd, rn) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | (0x2 << 15) | (0x10 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fneg_d(p, rd, rn) arm_format_fneg ((p), 0x1, (rd), (rn)) -+#define arm_fneg_s(p, rd, rn) arm_format_fneg ((p), 0x0, (rd), (rn)) -+ -+/* C6.3.37 FABS (scalar) */ -+#define arm_format_fabs(p, type, opc, rd, rn) arm_emit ((p), (0x1e << 24) | ((type) << 22) | (0x1 << 21) | ((opc) << 15) | (0x10 << 10) | ((rn) << 5) | ((rd) << 0)) -+ -+#define arm_fabs_d(p, rd, rn) arm_format_fabs ((p), 0x1, 0x1, (rd), (rn)) -+ -+/* C5.6.60 DMB */ -+#define arm_format_dmb(p, opc, CRm) arm_emit ((p), (0x354 << 22) | (0x3 << 16) | (0x3 << 12) | ((CRm) << 8) | (0x1 << 7) | ((opc) << 5) | (0x1f << 0)) -+ -+#define ARM_DMB_LD 0x1 -+#define ARM_DMB_ST 0x2 -+#define ARM_DMB_ALL 0x3 -+#define ARM_DMB_SY 0xc -+ -+#define arm_dmb(p, imm) arm_format_dmb ((p), 0x1, (imm)) -+ -+/* C5.6.129 MRS */ -+ -+#define ARM_MRS_REG_TPIDR_EL0 0x5e82 -+ -+#define arm_format_mrs(p, sysreg, rt) arm_emit ((p), (0x354 << 22) | (0x1 << 21) | (0x1 << 20) | ((sysreg) << 5) | ((rt) << 0)) -+ -+#define arm_mrs(p, rt, sysreg) arm_format_mrs ((p), (sysreg), (rt)) -+ -+#endif /* __arm_CODEGEN_H__ */ ---- mono-4.2.1.102+dfsg2.orig/mono/metadata/assembly.c -+++ mono-4.2.1.102+dfsg2/mono/metadata/assembly.c -@@ -105,7 +105,6 @@ static const AssemblyVersionMap framewor - {"Mono.Security.Win32", 0}, - {"Mono.Xml.Ext", 0}, - {"Novell.Directory.Ldap", 0}, -- {"Npgsql", 0}, - {"PEAPI", 0}, - {"System", 0}, - {"System.ComponentModel.Composition", 2}, ---- mono-4.2.1.102+dfsg2.orig/mono/mini/Makefile.am -+++ mono-4.2.1.102+dfsg2/mono/mini/Makefile.am -@@ -181,7 +181,7 @@ buildver-boehm.h: libmini-static.la $(mo - else - buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la - endif -- @echo "const char *build_date = \"`date`\";" > buildver-boehm.h -+ @echo "const char *build_date;" > buildver-boehm.h - mono_boehm-main.$(OBJEXT): buildver-boehm.h - endif - -@@ -190,7 +190,7 @@ buildver-sgen.h: libmini-static.la $(mon - else - buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la - endif -- @echo "const char *build_date = \"`date`\";" > buildver-sgen.h -+ @echo "const char *build_date;" > buildver-sgen.h - mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h - main-sgen.$(OBJEXT): buildver-sgen.h - -@@ -749,7 +749,7 @@ EXTRA_DIST = TestDriver.cs \ - Makefile.am.in - - version.h: Makefile -- echo "#define FULL_VERSION \"Stable 4.2.1.102/6dd2d0d\"" > version.h -+ echo "#define FULL_VERSION \"Debian $$(dpkg-parsechangelog -l$(top_srcdir)/debian/changelog | grep ^Vers | cut -d\ -f2)\"" > version.h - - # Utility target for patching libtool to speed up linking - patch-libtool: ---- mono-4.2.1.102+dfsg2.orig/mono/mini/aot-compiler.c -+++ mono-4.2.1.102+dfsg2/mono/mini/aot-compiler.c -@@ -836,7 +836,329 @@ arch_init (MonoAotCompile *acfg) - - #ifdef TARGET_ARM64 - --#include "../../../mono-extensions/mono/mini/aot-compiler-arm64.c" -+ -+/* Load the contents of GOT_SLOT into dreg, clobbering ip0 */ -+static void -+arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) -+{ -+ int offset; -+ -+ g_assert (acfg->fp); -+ emit_unset_mode (acfg); -+ /* r16==ip0 */ -+ offset = (int)(got_slot * sizeof (gpointer)); -+#ifdef TARGET_MACH -+ /* clang's integrated assembler */ -+ fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); -+ fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); -+ fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); -+#else -+ /* Linux GAS */ -+ fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); -+ fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); -+ fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); -+#endif -+} -+ -+static void -+arm64_emit_objc_selector_ref (MonoAotCompile *acfg, guint8 *code, int index, int *code_size) -+{ -+ int reg; -+ -+ g_assert (acfg->fp); -+ emit_unset_mode (acfg); -+ -+ /* ldr rt, target */ -+ reg = arm_get_ldr_lit_reg (code); -+ -+ fprintf (acfg->fp, "adrp x%d, L_OBJC_SELECTOR_REFERENCES_%d@PAGE\n", reg, index); -+ fprintf (acfg->fp, "add x%d, x%d, L_OBJC_SELECTOR_REFERENCES_%d@PAGEOFF\n", reg, reg, index); -+ fprintf (acfg->fp, "ldr x%d, [x%d]\n", reg, reg); -+ -+ *code_size = 12; -+} -+ -+static void -+arm64_emit_direct_call (MonoAotCompile *acfg, const char *target, gboolean external, gboolean thumb, MonoJumpInfo *ji, int *call_size) -+{ -+ g_assert (acfg->fp); -+ emit_unset_mode (acfg); -+ if (ji && ji->relocation == MONO_R_ARM64_B) { -+ fprintf (acfg->fp, "b %s\n", target); -+ } else { -+ if (ji) -+ g_assert (ji->relocation == MONO_R_ARM64_BL); -+ fprintf (acfg->fp, "bl %s\n", target); -+ } -+ *call_size = 4; -+} -+ -+static void -+arm64_emit_got_access (MonoAotCompile *acfg, guint8 *code, int got_slot, int *code_size) -+{ -+ int reg; -+ -+ /* ldr rt, target */ -+ reg = arm_get_ldr_lit_reg (code); -+ arm64_emit_load_got_slot (acfg, reg, got_slot); -+ *code_size = 12; -+} -+ -+static void -+arm64_emit_plt_entry (MonoAotCompile *acfg, const char *got_symbol, int offset, int info_offset) -+{ -+ arm64_emit_load_got_slot (acfg, ARMREG_R16, offset / sizeof (gpointer)); -+ fprintf (acfg->fp, "br x16\n"); -+ /* Used by mono_aot_get_plt_info_offset () */ -+ fprintf (acfg->fp, "%s %d\n", acfg->inst_directive, info_offset); -+} -+ -+static void -+arm64_emit_tramp_page_common_code (MonoAotCompile *acfg, int pagesize, int arg_reg, int *size) -+{ -+ guint8 buf [256]; -+ guint8 *code; -+ int imm; -+ -+ /* The common code */ -+ code = buf; -+ imm = pagesize; -+ /* The trampoline address is in IP0 */ -+ arm_movzx (code, ARMREG_IP1, imm & 0xffff, 0); -+ arm_movkx (code, ARMREG_IP1, (imm >> 16) & 0xffff, 16); -+ /* Compute the data slot address */ -+ arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1); -+ /* Trampoline argument */ -+ arm_ldrx (code, arg_reg, ARMREG_IP0, 0); -+ /* Address */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 8); -+ arm_brx (code, ARMREG_IP0); -+ -+ /* Emit it */ -+ emit_code_bytes (acfg, buf, code - buf); -+ -+ *size = code - buf; -+} -+ -+static void -+arm64_emit_tramp_page_specific_code (MonoAotCompile *acfg, int pagesize, int common_tramp_size, int specific_tramp_size) -+{ -+ guint8 buf [256]; -+ guint8 *code; -+ int i, count; -+ -+ count = (pagesize - common_tramp_size) / specific_tramp_size; -+ for (i = 0; i < count; ++i) { -+ code = buf; -+ arm_adrx (code, ARMREG_IP0, code); -+ /* Branch to the generic code */ -+ arm_b (code, code - 4 - (i * specific_tramp_size) - common_tramp_size); -+ /* This has to be 2 pointers long */ -+ arm_nop (code); -+ arm_nop (code); -+ g_assert (code - buf == specific_tramp_size); -+ emit_code_bytes (acfg, buf, code - buf); -+ } -+} -+ -+static void -+arm64_emit_specific_trampoline_pages (MonoAotCompile *acfg) -+{ -+ guint8 buf [128]; -+ guint8 *code; -+ guint8 *labels [16]; -+ int common_tramp_size; -+ int specific_tramp_size = 2 * 8; -+ int imm, pagesize; -+ char symbol [128]; -+ -+ if (!acfg->aot_opts.use_trampolines_page) -+ return; -+ -+#ifdef TARGET_MACH -+ /* Have to match the target pagesize */ -+ pagesize = 16384; -+#else -+ pagesize = mono_pagesize (); -+#endif -+ acfg->tramp_page_size = pagesize; -+ -+ /* The specific trampolines */ -+ sprintf (symbol, "%sspecific_trampolines_page", acfg->user_symbol_prefix); -+ emit_alignment (acfg, pagesize); -+ emit_global (acfg, symbol, TRUE); -+ emit_label (acfg, symbol); -+ -+ /* The common code */ -+ arm64_emit_tramp_page_common_code (acfg, pagesize, ARMREG_IP1, &common_tramp_size); -+ acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_SPECIFIC] = common_tramp_size; -+ -+ arm64_emit_tramp_page_specific_code (acfg, pagesize, common_tramp_size, specific_tramp_size); -+ -+ /* The rgctx trampolines */ -+ /* These are the same as the specific trampolines, but they load the argument into MONO_ARCH_RGCTX_REG */ -+ sprintf (symbol, "%srgctx_trampolines_page", acfg->user_symbol_prefix); -+ emit_alignment (acfg, pagesize); -+ emit_global (acfg, symbol, TRUE); -+ emit_label (acfg, symbol); -+ -+ /* The common code */ -+ arm64_emit_tramp_page_common_code (acfg, pagesize, MONO_ARCH_RGCTX_REG, &common_tramp_size); -+ acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_STATIC_RGCTX] = common_tramp_size; -+ -+ arm64_emit_tramp_page_specific_code (acfg, pagesize, common_tramp_size, specific_tramp_size); -+ -+ /* The gsharedvt arg trampolines */ -+ /* These are the same as the specific trampolines */ -+ sprintf (symbol, "%sgsharedvt_arg_trampolines_page", acfg->user_symbol_prefix); -+ emit_alignment (acfg, pagesize); -+ emit_global (acfg, symbol, TRUE); -+ emit_label (acfg, symbol); -+ -+ arm64_emit_tramp_page_common_code (acfg, pagesize, ARMREG_IP1, &common_tramp_size); -+ acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_GSHAREDVT_ARG] = common_tramp_size; -+ -+ arm64_emit_tramp_page_specific_code (acfg, pagesize, common_tramp_size, specific_tramp_size); -+ -+ /* The IMT trampolines */ -+ sprintf (symbol, "%simt_trampolines_page", acfg->user_symbol_prefix); -+ emit_alignment (acfg, pagesize); -+ emit_global (acfg, symbol, TRUE); -+ emit_label (acfg, symbol); -+ -+ code = buf; -+ imm = pagesize; -+ /* The trampoline address is in IP0 */ -+ arm_movzx (code, ARMREG_IP1, imm & 0xffff, 0); -+ arm_movkx (code, ARMREG_IP1, (imm >> 16) & 0xffff, 16); -+ /* Compute the data slot address */ -+ arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1); -+ /* Trampoline argument */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_IP0, 0); -+ -+ /* Same as arch_emit_imt_thunk () */ -+ labels [0] = code; -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 0); -+ arm_cmpx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG); -+ labels [1] = code; -+ arm_bcc (code, ARMCOND_EQ, 0); -+ -+ /* End-of-loop check */ -+ labels [2] = code; -+ arm_cbzx (code, ARMREG_IP0, 0); -+ -+ /* Loop footer */ -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 2 * 8); -+ arm_b (code, labels [0]); -+ -+ /* Match */ -+ mono_arm_patch (labels [1], code, MONO_R_ARM64_BCC); -+ /* Load vtable slot addr */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8); -+ /* Load vtable slot */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0); -+ arm_brx (code, ARMREG_IP0); -+ -+ /* No match */ -+ mono_arm_patch (labels [2], code, MONO_R_ARM64_CBZ); -+ /* Load fail addr */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8); -+ arm_brx (code, ARMREG_IP0); -+ -+ emit_code_bytes (acfg, buf, code - buf); -+ -+ common_tramp_size = code - buf; -+ acfg->tramp_page_code_offsets [MONO_AOT_TRAMP_IMT_THUNK] = common_tramp_size; -+ -+ arm64_emit_tramp_page_specific_code (acfg, pagesize, common_tramp_size, specific_tramp_size); -+} -+ -+static void -+arm64_emit_specific_trampoline (MonoAotCompile *acfg, int offset, int *tramp_size) -+{ -+ /* Load argument from second GOT slot */ -+ arm64_emit_load_got_slot (acfg, ARMREG_R17, offset + 1); -+ /* Load generic trampoline address from first GOT slot */ -+ arm64_emit_load_got_slot (acfg, ARMREG_R16, offset); -+ fprintf (acfg->fp, "br x16\n"); -+ *tramp_size = 7 * 4; -+} -+ -+static void -+arm64_emit_unbox_trampoline (MonoAotCompile *acfg, MonoCompile *cfg, MonoMethod *method, const char *call_target) -+{ -+ emit_unset_mode (acfg); -+ fprintf (acfg->fp, "add x0, x0, %d\n", (int)(sizeof (MonoObject))); -+ fprintf (acfg->fp, "b %s\n", call_target); -+} -+ -+static void -+arm64_emit_static_rgctx_trampoline (MonoAotCompile *acfg, int offset, int *tramp_size) -+{ -+ /* Similar to the specific trampolines, but use the rgctx reg instead of ip1 */ -+ -+ /* Load argument from first GOT slot */ -+ arm64_emit_load_got_slot (acfg, MONO_ARCH_RGCTX_REG, offset); -+ /* Load generic trampoline address from second GOT slot */ -+ arm64_emit_load_got_slot (acfg, ARMREG_R16, offset + 1); -+ fprintf (acfg->fp, "br x16\n"); -+ *tramp_size = 7 * 4; -+} -+ -+static void -+arm64_emit_imt_thunk (MonoAotCompile *acfg, int offset, int *tramp_size) -+{ -+ guint8 buf [128]; -+ guint8 *code, *labels [16]; -+ -+ /* Load parameter from GOT slot into ip1 */ -+ arm64_emit_load_got_slot (acfg, ARMREG_R17, offset); -+ -+ code = buf; -+ labels [0] = code; -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 0); -+ arm_cmpx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG); -+ labels [1] = code; -+ arm_bcc (code, ARMCOND_EQ, 0); -+ -+ /* End-of-loop check */ -+ labels [2] = code; -+ arm_cbzx (code, ARMREG_IP0, 0); -+ -+ /* Loop footer */ -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 2 * 8); -+ arm_b (code, labels [0]); -+ -+ /* Match */ -+ mono_arm_patch (labels [1], code, MONO_R_ARM64_BCC); -+ /* Load vtable slot addr */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8); -+ /* Load vtable slot */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0); -+ arm_brx (code, ARMREG_IP0); -+ -+ /* No match */ -+ mono_arm_patch (labels [2], code, MONO_R_ARM64_CBZ); -+ /* Load fail addr */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8); -+ arm_brx (code, ARMREG_IP0); -+ -+ emit_code_bytes (acfg, buf, code - buf); -+ -+ *tramp_size = code - buf + (3 * 4); -+} -+ -+static void -+arm64_emit_gsharedvt_arg_trampoline (MonoAotCompile *acfg, int offset, int *tramp_size) -+{ -+ /* Similar to the specific trampolines, but the address is in the second slot */ -+ /* Load argument from first GOT slot */ -+ arm64_emit_load_got_slot (acfg, ARMREG_R17, offset); -+ /* Load generic trampoline address from second GOT slot */ -+ arm64_emit_load_got_slot (acfg, ARMREG_R16, offset + 1); -+ fprintf (acfg->fp, "br x16\n"); -+ *tramp_size = 7 * 4; -+} - - #endif - ---- mono-4.2.1.102+dfsg2.orig/mono/mini/cpu-ppc.md -+++ mono-4.2.1.102+dfsg2/mono/mini/cpu-ppc.md -@@ -128,6 +128,8 @@ storer8_memindex: dest:b src1:i src2:i l - loadu4_mem: dest:i len:8 - move: dest:i src1:i len:4 - fmove: dest:f src1:f len:4 -+move_f_to_i4: dest:i src1:f len:8 -+move_i4_to_f: dest:f src1:i len:8 - add_imm: dest:i src1:i len:4 - sub_imm: dest:i src1:i len:4 - mul_imm: dest:i src1:i len:4 -@@ -314,5 +316,5 @@ vcall2_membase: src1:b len:16 clob:c - - jump_table: dest:i len:8 - --atomic_add_i4: src1:b src2:i dest:i len:20 -+atomic_add_i4: src1:b src2:i dest:i len:28 - atomic_cas_i4: src1:b src2:i src3:i dest:i len:38 ---- mono-4.2.1.102+dfsg2.orig/mono/mini/exceptions-arm64.c -+++ mono-4.2.1.102+dfsg2/mono/mini/exceptions-arm64.c -@@ -1 +1,585 @@ --#include "../../../mono-extensions/mono/mini/exceptions-arm64.c" -+/* -+ * exceptions-arm64.c: exception support for ARM64 -+ * -+ * Copyright 2013 Xamarin Inc -+ * -+ * Based on exceptions-arm.c: -+ * -+ * Authors: -+ * Dietmar Maurer (dietmar@ximian.com) -+ * Paolo Molaro (lupus@ximian.com) -+ * -+ * (C) 2001 Ximian, Inc. -+ */ -+ -+#include "mini.h" -+ -+#include -+#include -+ -+#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) -+ -+#ifndef DISABLE_JIT -+ -+gpointer -+mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *start, *code; -+ MonoJumpInfo *ji = NULL; -+ GSList *unwind_ops = NULL; -+ int i, ctx_reg, size; -+ -+ size = 256; -+ code = start = mono_global_codeman_reserve (size); -+ -+ arm_movx (code, ARMREG_IP0, ARMREG_R0); -+ ctx_reg = ARMREG_IP0; -+ /* Restore fregs */ -+ for (i = 0; i < 32; ++i) -+ arm_ldrfpx (code, i, ctx_reg, MONO_STRUCT_OFFSET (MonoContext, fregs) + (i * 8)); -+ /* Restore gregs */ -+ // FIXME: Restore less registers -+ // FIXME: fp should be restored later -+ code = mono_arm_emit_load_regarray (code, 0xffffffff & ~(1 << ctx_reg) & ~(1 << ARMREG_SP), ctx_reg, MONO_STRUCT_OFFSET (MonoContext, regs)); -+ /* ip0/ip1 doesn't need to be restored */ -+ /* ip1 = pc */ -+ arm_ldrx (code, ARMREG_IP1, ctx_reg, MONO_STRUCT_OFFSET (MonoContext, pc)); -+ /* ip0 = sp */ -+ arm_ldrx (code, ARMREG_IP0, ctx_reg, MONO_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_SP * 8)); -+ /* Restore sp, ctx is no longer valid */ -+ arm_movspx (code, ARMREG_SP, ARMREG_IP0); -+ /* Branch to pc */ -+ arm_brx (code, ARMREG_IP1); -+ /* Not reached */ -+ arm_brk (code, 0); -+ -+ g_assert ((code - start) < size); -+ mono_arch_flush_icache (start, code - start); -+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL); -+ -+ if (info) -+ *info = mono_tramp_info_create ("restore_context", start, code - start, ji, unwind_ops); -+ -+ return start; -+} -+ -+gpointer -+mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *code; -+ guint8* start; -+ int size, offset, gregs_offset, fregs_offset, ctx_offset, num_fregs, frame_size; -+ MonoJumpInfo *ji = NULL; -+ GSList *unwind_ops = NULL; -+ -+ size = 512; -+ start = code = mono_global_codeman_reserve (size); -+ -+ /* Compute stack frame size and offsets */ -+ offset = 0; -+ /* frame block */ -+ offset += 2 * 8; -+ /* gregs */ -+ gregs_offset = offset; -+ offset += 32 * 8; -+ /* fregs */ -+ num_fregs = 8; -+ fregs_offset = offset; -+ offset += num_fregs * 8; -+ ctx_offset = offset; -+ ctx_offset += 8; -+ frame_size = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); -+ -+ /* -+ * We are being called from C code, ctx is in r0, the address to call is in r1. -+ * We need to save state, restore ctx, make the call, then restore the previous state, -+ * returning the value returned by the call. -+ */ -+ -+ /* Setup a frame */ -+ arm_stpx_pre (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, -frame_size); -+ arm_movspx (code, ARMREG_FP, ARMREG_SP); -+ -+ /* Save ctx */ -+ arm_strx (code, ARMREG_R0, ARMREG_FP, ctx_offset); -+ /* Save gregs */ -+ code = mono_arm_emit_store_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS | (1 << ARMREG_FP), ARMREG_FP, gregs_offset); -+ /* No need to save/restore fregs, since we don't currently use them */ -+ -+ /* Load regs from ctx */ -+ code = mono_arm_emit_load_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, regs)); -+ /* Load fp */ -+ arm_ldrx (code, ARMREG_FP, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_FP * 8)); -+ -+ /* Make the call */ -+ arm_blrx (code, ARMREG_R1); -+ /* For filters, the result is in R0 */ -+ -+ /* Restore fp */ -+ arm_ldrx (code, ARMREG_FP, ARMREG_SP, gregs_offset + (ARMREG_FP * 8)); -+ /* Load ctx */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_FP, ctx_offset); -+ /* Save registers back to ctx */ -+ /* This isn't strictly neccessary since we don't allocate variables used in eh clauses to registers */ -+ code = mono_arm_emit_store_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoContext, regs)); -+ -+ /* Restore regs */ -+ code = mono_arm_emit_load_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS, ARMREG_FP, gregs_offset); -+ /* Destroy frame */ -+ code = mono_arm_emit_destroy_frame (code, frame_size, (1 << ARMREG_IP0)); -+ arm_retx (code, ARMREG_LR); -+ -+ g_assert ((code - start) < size); -+ mono_arch_flush_icache (start, code - start); -+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL); -+ -+ if (info) -+ *info = mono_tramp_info_create ("call_filter", start, code - start, ji, unwind_ops); -+ -+ return start; -+} -+ -+static gpointer -+get_throw_trampoline (int size, gboolean corlib, gboolean rethrow, gboolean llvm, gboolean resume_unwind, const char *tramp_name, MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *start, *code; -+ MonoJumpInfo *ji = NULL; -+ GSList *unwind_ops = NULL; -+ int i, offset, gregs_offset, fregs_offset, frame_size, num_fregs; -+ -+ code = start = mono_global_codeman_reserve (size); -+ -+ /* We are being called by JITted code, the exception object/type token is in R0 */ -+ -+ /* Compute stack frame size and offsets */ -+ offset = 0; -+ /* frame block */ -+ offset += 2 * 8; -+ /* gregs */ -+ gregs_offset = offset; -+ offset += 32 * 8; -+ /* fregs */ -+ num_fregs = 8; -+ fregs_offset = offset; -+ offset += num_fregs * 8; -+ frame_size = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); -+ -+ /* Setup a frame */ -+ arm_stpx_pre (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, -frame_size); -+ arm_movspx (code, ARMREG_FP, ARMREG_SP); -+ -+ /* Save gregs */ -+ code = mono_arm_emit_store_regarray (code, 0xffffffff, ARMREG_FP, gregs_offset); -+ if (corlib && !llvm) -+ /* The real LR is in R1 */ -+ arm_strx (code, ARMREG_R1, ARMREG_FP, gregs_offset + (ARMREG_LR * 8)); -+ /* Save fp/sp */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_FP, 0); -+ arm_strx (code, ARMREG_IP0, ARMREG_FP, gregs_offset + (ARMREG_FP * 8)); -+ arm_addx_imm (code, ARMREG_IP0, ARMREG_FP, frame_size); -+ arm_strx (code, ARMREG_IP0, ARMREG_FP, gregs_offset + (ARMREG_SP * 8)); -+ /* Save fregs */ -+ for (i = 0; i < num_fregs; ++i) -+ arm_strfpx (code, ARMREG_D8 + i, ARMREG_FP, fregs_offset + (i * 8)); -+ -+ /* Call the C trampoline function */ -+ /* Arg1 = exception object/type token */ -+ arm_movx (code, ARMREG_R0, ARMREG_R0); -+ /* Arg2 = caller ip */ -+ if (corlib) { -+ if (llvm) -+ arm_ldrx (code, ARMREG_R1, ARMREG_FP, gregs_offset + (ARMREG_LR * 8)); -+ else -+ arm_movx (code, ARMREG_R1, ARMREG_R1); -+ } else { -+ arm_ldrx (code, ARMREG_R1, ARMREG_FP, 8); -+ } -+ /* Arg 3 = gregs */ -+ arm_addx_imm (code, ARMREG_R2, ARMREG_FP, gregs_offset); -+ /* Arg 4 = fregs */ -+ arm_addx_imm (code, ARMREG_R3, ARMREG_FP, fregs_offset); -+ /* Arg 5 = corlib */ -+ arm_movzx (code, ARMREG_R4, corlib ? 1 : 0, 0); -+ /* Arg 6 = rethrow */ -+ arm_movzx (code, ARMREG_R5, rethrow ? 1 : 0, 0); -+ /* Call the function */ -+ if (aot) { -+ const char *icall_name; -+ -+ if (resume_unwind) -+ icall_name = "mono_arm_resume_unwind"; -+ else -+ icall_name = "mono_arm_throw_exception"; -+ -+ code = mono_arm_emit_aotconst (&ji, code, start, ARMREG_LR, MONO_PATCH_INFO_JIT_ICALL_ADDR, icall_name); -+ } else { -+ gpointer icall_func; -+ -+ if (resume_unwind) -+ icall_func = mono_arm_resume_unwind; -+ else -+ icall_func = mono_arm_throw_exception; -+ -+ code = mono_arm_emit_imm64 (code, ARMREG_LR, (guint64)icall_func); -+ } -+ arm_blrx (code, ARMREG_LR); -+ /* This shouldn't return */ -+ arm_brk (code, 0x0); -+ -+ g_assert ((code - start) < size); -+ mono_arch_flush_icache (start, code - start); -+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL); -+ -+ if (info) -+ *info = mono_tramp_info_create (tramp_name, start, code - start, ji, unwind_ops); -+ -+ return start; -+} -+ -+gpointer -+mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot) -+{ -+ return get_throw_trampoline (256, FALSE, FALSE, FALSE, FALSE, "throw_exception", info, aot); -+} -+ -+gpointer -+mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot) -+{ -+ return get_throw_trampoline (256, FALSE, TRUE, FALSE, FALSE, "rethrow_exception", info, aot); -+} -+ -+gpointer -+mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot) -+{ -+ return get_throw_trampoline (256, TRUE, FALSE, FALSE, FALSE, "throw_corlib_exception", info, aot); -+} -+ -+GSList* -+mono_arm_get_exception_trampolines (gboolean aot) -+{ -+ MonoTrampInfo *info; -+ GSList *tramps = NULL; -+ -+ /* LLVM uses the normal trampolines, but with a different name */ -+ get_throw_trampoline (256, TRUE, FALSE, FALSE, FALSE, "llvm_throw_corlib_exception_trampoline", &info, aot); -+ tramps = g_slist_prepend (tramps, info); -+ -+ get_throw_trampoline (256, TRUE, FALSE, TRUE, FALSE, "llvm_throw_corlib_exception_abs_trampoline", &info, aot); -+ tramps = g_slist_prepend (tramps, info); -+ -+ get_throw_trampoline (256, FALSE, FALSE, FALSE, TRUE, "llvm_resume_unwind_trampoline", &info, aot); -+ tramps = g_slist_prepend (tramps, info); -+ -+ return tramps; -+} -+ -+#else /* DISABLE_JIT */ -+ -+gpointer -+mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+GSList* -+mono_arm_get_exception_trampolines (gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+#endif /* !DISABLE_JIT */ -+ -+void -+mono_arch_exceptions_init (void) -+{ -+ guint8 *tramp; -+ GSList *tramps, *l; -+ -+ if (mono_aot_only) { -+ tramp = mono_aot_get_trampoline ("llvm_throw_corlib_exception_trampoline"); -+ mono_register_jit_icall (tramp, "llvm_throw_corlib_exception_trampoline", NULL, TRUE); -+ tramp = mono_aot_get_trampoline ("llvm_throw_corlib_exception_abs_trampoline"); -+ mono_register_jit_icall (tramp, "llvm_throw_corlib_exception_abs_trampoline", NULL, TRUE); -+ tramp = mono_aot_get_trampoline ("llvm_resume_unwind_trampoline"); -+ mono_register_jit_icall (tramp, "llvm_resume_unwind_trampoline", NULL, TRUE); -+ } else { -+ tramps = mono_arm_get_exception_trampolines (FALSE); -+ for (l = tramps; l; l = l->next) { -+ MonoTrampInfo *info = l->data; -+ -+ mono_register_jit_icall (info->code, g_strdup (info->name), NULL, TRUE); -+ mono_tramp_info_register (info); -+ } -+ g_slist_free (tramps); -+ } -+} -+ -+/* -+ * mono_arm_throw_exception: -+ * -+ * This function is called by the exception trampolines. -+ * FP_REGS points to the 8 callee saved fp regs. -+ */ -+void -+mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow) -+{ -+ MonoContext ctx; -+ MonoObject *exc = NULL; -+ guint32 ex_token_index, ex_token; -+ -+ if (!corlib) -+ exc = arg; -+ else { -+ ex_token_index = (guint64)arg; -+ ex_token = MONO_TOKEN_TYPE_DEF | ex_token_index; -+ exc = (MonoObject*)mono_exception_from_token (mono_defaults.corlib, ex_token); -+ } -+ -+ /* Adjust pc so it points into the call instruction */ -+ pc -= 4; -+ -+ /* Initialize a ctx based on the arguments */ -+ memset (&ctx, 0, sizeof (MonoContext)); -+ memcpy (&(ctx.regs [0]), int_regs, sizeof (mgreg_t) * 32); -+ memcpy (&(ctx.fregs [ARMREG_D8]), fp_regs, sizeof (double) * 8); -+ ctx.pc = pc; -+ -+ if (mono_object_isinst (exc, mono_defaults.exception_class)) { -+ MonoException *mono_ex = (MonoException*)exc; -+ if (!rethrow) -+ mono_ex->stack_trace = NULL; -+ } -+ -+ mono_handle_exception (&ctx, exc); -+ -+ mono_restore_context (&ctx); -+} -+ -+void -+mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow) -+{ -+ MonoContext ctx; -+ -+ /* Adjust pc so it points into the call instruction */ -+ pc -= 4; -+ -+ /* Initialize a ctx based on the arguments */ -+ memset (&ctx, 0, sizeof (MonoContext)); -+ memcpy (&(ctx.regs [0]), int_regs, sizeof (mgreg_t) * 32); -+ memcpy (&(ctx.fregs [ARMREG_D8]), fp_regs, sizeof (double) * 8); -+ ctx.pc = pc; -+ -+ mono_resume_unwind (&ctx); -+} -+ -+/* -+ * mono_arch_find_jit_info: -+ * -+ * See exceptions-amd64.c for docs; -+ */ -+gboolean -+mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, -+ MonoJitInfo *ji, MonoContext *ctx, -+ MonoContext *new_ctx, MonoLMF **lmf, -+ mgreg_t **save_locations, -+ StackFrameInfo *frame) -+{ -+ gpointer ip = MONO_CONTEXT_GET_IP (ctx); -+ -+ memset (frame, 0, sizeof (StackFrameInfo)); -+ frame->ji = ji; -+ -+ *new_ctx = *ctx; -+ -+ if (ji != NULL) { -+ mgreg_t regs [MONO_MAX_IREGS + 8 + 1]; -+ guint8 *cfa; -+ guint32 unwind_info_len; -+ guint8 *unwind_info; -+ -+ frame->type = FRAME_TYPE_MANAGED; -+ -+ unwind_info = mono_jinfo_get_unwind_info (ji, &unwind_info_len); -+ -+ memcpy (regs, &new_ctx->regs, sizeof (mgreg_t) * 32); -+ /* v8..v15 are callee saved */ -+ memcpy (regs + MONO_MAX_IREGS, &(new_ctx->fregs [8]), sizeof (mgreg_t) * 8); -+ -+ mono_unwind_frame (unwind_info, unwind_info_len, ji->code_start, -+ (guint8*)ji->code_start + ji->code_size, -+ ip, NULL, regs, MONO_MAX_IREGS + 8, -+ save_locations, MONO_MAX_IREGS, &cfa); -+ -+ memcpy (&new_ctx->regs, regs, sizeof (mgreg_t) * 32); -+ memcpy (&(new_ctx->fregs [8]), regs + MONO_MAX_IREGS, sizeof (mgreg_t) * 8); -+ -+ new_ctx->pc = regs [ARMREG_LR]; -+ new_ctx->regs [ARMREG_SP] = (mgreg_t)cfa; -+ -+ if (*lmf && (*lmf)->gregs [MONO_ARCH_LMF_REG_SP] && (MONO_CONTEXT_GET_SP (ctx) >= (gpointer)(*lmf)->gregs [MONO_ARCH_LMF_REG_SP])) { -+ /* remove any unused lmf */ -+ *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~3); -+ } -+ -+ /* we substract 1, so that the IP points into the call instruction */ -+ new_ctx->pc--; -+ -+ return TRUE; -+ } else if (*lmf) { -+ if (((gsize)(*lmf)->previous_lmf) & 2) { -+ /* -+ * This LMF entry is created by the soft debug code to mark transitions to -+ * managed code done during invokes. -+ */ -+ MonoLMFExt *ext = (MonoLMFExt*)(*lmf); -+ -+ g_assert (ext->debugger_invoke); -+ -+ memcpy (new_ctx, &ext->ctx, sizeof (MonoContext)); -+ -+ *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~3); -+ -+ frame->type = FRAME_TYPE_DEBUGGER_INVOKE; -+ -+ return TRUE; -+ } -+ -+ frame->type = FRAME_TYPE_MANAGED_TO_NATIVE; -+ -+ ji = mini_jit_info_table_find (domain, (gpointer)(*lmf)->pc, NULL); -+ if (!ji) -+ return FALSE; -+ -+ g_assert (MONO_ARCH_LMF_REGS == ((0x3ff << 19) | (1 << ARMREG_FP) | (1 << ARMREG_SP))); -+ memcpy (&new_ctx->regs [ARMREG_R19], &(*lmf)->gregs [0], sizeof (mgreg_t) * 10); -+ new_ctx->regs [ARMREG_FP] = (*lmf)->gregs [MONO_ARCH_LMF_REG_FP]; -+ new_ctx->regs [ARMREG_SP] = (*lmf)->gregs [MONO_ARCH_LMF_REG_SP]; -+ new_ctx->pc = (*lmf)->pc; -+ -+ /* we substract 1, so that the IP points into the call instruction */ -+ new_ctx->pc--; -+ -+ *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~3); -+ -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+void -+mono_arch_sigctx_to_monoctx (void *sigctx, MonoContext *mctx) -+{ -+ mono_sigctx_to_monoctx (sigctx, mctx); -+} -+ -+void -+mono_arch_monoctx_to_sigctx (MonoContext *mctx, void *sigctx) -+{ -+ mono_monoctx_to_sigctx (mctx, sigctx); -+} -+ -+/* -+ * handle_exception: -+ * -+ * Called by resuming from a signal handler. -+ */ -+static void -+handle_signal_exception (gpointer obj) -+{ -+ MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id); -+ MonoContext ctx; -+ -+ memcpy (&ctx, &jit_tls->ex_ctx, sizeof (MonoContext)); -+ -+ mono_handle_exception (&ctx, obj); -+ -+ mono_restore_context (&ctx); -+} -+ -+/* -+ * This is the function called from the signal handler -+ */ -+gboolean -+mono_arch_handle_exception (void *ctx, gpointer obj) -+{ -+#if defined(MONO_CROSS_COMPILE) -+ g_assert_not_reached (); -+#else -+ MonoJitTlsData *jit_tls; -+ void *sigctx = ctx; -+ -+ /* -+ * Resume into the normal stack and handle the exception there. -+ */ -+ jit_tls = mono_native_tls_get_value (mono_jit_tls_id); -+ -+ /* Pass the ctx parameter in TLS */ -+ mono_arch_sigctx_to_monoctx (sigctx, &jit_tls->ex_ctx); -+ /* The others in registers */ -+ UCONTEXT_REG_R0 (sigctx) = (gsize)obj; -+ -+ UCONTEXT_REG_PC (sigctx) = (gsize)handle_signal_exception; -+ UCONTEXT_REG_SP (sigctx) = UCONTEXT_REG_SP (sigctx) - MONO_ARCH_REDZONE_SIZE; -+#endif -+ -+ return TRUE; -+} -+ -+gpointer -+mono_arch_ip_from_context (void *sigctx) -+{ -+#ifdef MONO_CROSS_COMPILE -+ g_assert_not_reached (); -+ return NULL; -+#else -+ return (gpointer)UCONTEXT_REG_PC (sigctx); -+#endif -+} -+ -+void -+mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) -+{ -+ NOT_IMPLEMENTED; -+} -+ -+/* -+ * mono_arch_setup_resume_sighandler_ctx: -+ * -+ * Setup CTX so execution continues at FUNC. -+ */ -+void -+mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func) -+{ -+ MONO_CONTEXT_SET_IP (ctx,func); -+} ---- mono-4.2.1.102+dfsg2.orig/mono/mini/mini-arm64.c -+++ mono-4.2.1.102+dfsg2/mono/mini/mini-arm64.c -@@ -1 +1,5222 @@ --#include "../../../mono-extensions/mono/mini/mini-arm64.c" -+/* -+ * mini-arm64.c: ARM64 backend for the Mono code generator -+ * -+ * Copyright 2013 Xamarin, Inc (http://www.xamarin.com) -+ * -+ * Based on mini-arm.c: -+ * -+ * Authors: -+ * Paolo Molaro (lupus@ximian.com) -+ * Dietmar Maurer (dietmar@ximian.com) -+ * -+ * (C) 2003 Ximian, Inc. -+ * Copyright 2003-2011 Novell, Inc (http://www.novell.com) -+ * Copyright 2011 Xamarin, Inc (http://www.xamarin.com) -+ */ -+ -+#include "mini.h" -+#include "cpu-arm64.h" -+#include "ir-emit.h" -+ -+#include -+#include -+#include -+#include -+ -+/* -+ * Documentation: -+ * -+ * - ARM(R) Architecture Reference Manual, ARMv8, for ARMv8-A architecture profile (DDI0487A_a_armv8_arm.pdf) -+ * - Procedure Call Standard for the ARM 64-bit Architecture (AArch64) (IHI0055B_aapcs64.pdf) -+ * - ELF for the ARM 64-bit Architecture (IHI0056B_aaelf64.pdf) -+ * -+ * Register usage: -+ * - ip0/ip1/lr are used as temporary registers -+ * - r27 is used as the rgctx/imt register -+ * - r28 is used to access arguments passed on the stack -+ * - d15/d16 are used as fp temporary registers -+ */ -+ -+#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) -+ -+#define FP_TEMP_REG ARMREG_D16 -+#define FP_TEMP_REG2 ARMREG_D15 -+ -+#define THUNK_SIZE (4 * 4) -+ -+/* The single step trampoline */ -+static gpointer ss_trampoline; -+ -+/* The breakpoint trampoline */ -+static gpointer bp_trampoline; -+ -+static gboolean ios_abi; -+ -+static __attribute__((warn_unused_result)) guint8* emit_load_regset (guint8 *code, guint64 regs, int basereg, int offset); -+ -+const char* -+mono_arch_regname (int reg) -+{ -+ static const char * rnames[] = { -+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", -+ "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", -+ "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "fp", -+ "lr", "sp" -+ }; -+ if (reg >= 0 && reg < 32) -+ return rnames [reg]; -+ return "unknown"; -+} -+ -+const char* -+mono_arch_fregname (int reg) -+{ -+ static const char * rnames[] = { -+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", -+ "d10", "d11", "d12", "d13", "d14", "d15", "d16", "d17", "d18", "d19", -+ "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", -+ "d30", "d31" -+ }; -+ if (reg >= 0 && reg < 32) -+ return rnames [reg]; -+ return "unknown fp"; -+} -+ -+int -+mono_arch_get_argument_info (MonoGenericSharingContext *gsctx, MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info) -+{ -+ NOT_IMPLEMENTED; -+ return 0; -+} -+ -+#define MAX_ARCH_DELEGATE_PARAMS 7 -+ -+static gpointer -+get_delegate_invoke_impl (gboolean has_target, gboolean param_count, guint32 *code_size) -+{ -+ guint8 *code, *start; -+ -+ if (has_target) { -+ start = code = mono_global_codeman_reserve (12); -+ -+ /* Replace the this argument with the target */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_R0, MONO_STRUCT_OFFSET (MonoDelegate, method_ptr)); -+ arm_ldrx (code, ARMREG_R0, ARMREG_R0, MONO_STRUCT_OFFSET (MonoDelegate, target)); -+ arm_brx (code, ARMREG_IP0); -+ -+ g_assert ((code - start) <= 12); -+ -+ mono_arch_flush_icache (start, 12); -+ } else { -+ int size, i; -+ -+ size = 8 + param_count * 4; -+ start = code = mono_global_codeman_reserve (size); -+ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_R0, MONO_STRUCT_OFFSET (MonoDelegate, method_ptr)); -+ /* slide down the arguments */ -+ for (i = 0; i < param_count; ++i) -+ arm_movx (code, i, i + 1); -+ arm_brx (code, ARMREG_IP0); -+ -+ g_assert ((code - start) <= size); -+ -+ mono_arch_flush_icache (start, size); -+ } -+ -+ if (code_size) -+ *code_size = code - start; -+ -+ return start; -+} -+ -+/* -+ * mono_arch_get_delegate_invoke_impls: -+ * -+ * Return a list of MonoAotTrampInfo structures for the delegate invoke impl -+ * trampolines. -+ */ -+GSList* -+mono_arch_get_delegate_invoke_impls (void) -+{ -+ GSList *res = NULL; -+ guint8 *code; -+ guint32 code_len; -+ int i; -+ char *tramp_name; -+ -+ code = get_delegate_invoke_impl (TRUE, 0, &code_len); -+ res = g_slist_prepend (res, mono_tramp_info_create ("delegate_invoke_impl_has_target", code, code_len, NULL, NULL)); -+ -+ for (i = 0; i <= MAX_ARCH_DELEGATE_PARAMS; ++i) { -+ code = get_delegate_invoke_impl (FALSE, i, &code_len); -+ tramp_name = g_strdup_printf ("delegate_invoke_impl_target_%d", i); -+ res = g_slist_prepend (res, mono_tramp_info_create (tramp_name, code, code_len, NULL, NULL)); -+ g_free (tramp_name); -+ } -+ -+ return res; -+} -+ -+gpointer -+mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target) -+{ -+ guint8 *code, *start; -+ -+ /* -+ * vtypes are returned in registers, or using the dedicated r8 register, so -+ * they can be supported by delegate invokes. -+ */ -+ -+ if (has_target) { -+ static guint8* cached = NULL; -+ -+ if (cached) -+ return cached; -+ -+ if (mono_aot_only) -+ start = mono_aot_get_trampoline ("delegate_invoke_impl_has_target"); -+ else -+ start = get_delegate_invoke_impl (TRUE, 0, NULL); -+ mono_memory_barrier (); -+ cached = start; -+ return cached; -+ } else { -+ static guint8* cache [MAX_ARCH_DELEGATE_PARAMS + 1] = {NULL}; -+ int i; -+ -+ if (sig->param_count > MAX_ARCH_DELEGATE_PARAMS) -+ return NULL; -+ for (i = 0; i < sig->param_count; ++i) -+ if (!mono_is_regsize_var (sig->params [i])) -+ return NULL; -+ -+ code = cache [sig->param_count]; -+ if (code) -+ return code; -+ -+ if (mono_aot_only) { -+ char *name = g_strdup_printf ("delegate_invoke_impl_target_%d", sig->param_count); -+ start = mono_aot_get_trampoline (name); -+ g_free (name); -+ } else { -+ start = get_delegate_invoke_impl (FALSE, sig->param_count, NULL); -+ } -+ mono_memory_barrier (); -+ cache [sig->param_count] = start; -+ return start; -+ } -+ -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method, int offset, gboolean load_imt_reg) -+{ -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) -+{ -+ return (gpointer)regs [ARMREG_R0]; -+} -+ -+void -+mono_arch_cpu_init (void) -+{ -+} -+ -+void -+mono_arch_init (void) -+{ -+ mono_aot_register_jit_icall ("mono_arm_throw_exception", mono_arm_throw_exception); -+ mono_aot_register_jit_icall ("mono_arm_resume_unwind", mono_arm_resume_unwind); -+ -+ if (!mono_aot_only) -+ bp_trampoline = mini_get_breakpoint_trampoline (); -+ -+#if defined(TARGET_IOS) -+ ios_abi = TRUE; -+#endif -+} -+ -+void -+mono_arch_cleanup (void) -+{ -+} -+ -+guint32 -+mono_arch_cpu_optimizations (guint32 *exclude_mask) -+{ -+ *exclude_mask = 0; -+ return 0; -+} -+ -+guint32 -+mono_arch_cpu_enumerate_simd_versions (void) -+{ -+ return 0; -+} -+ -+void -+mono_arch_register_lowlevel_calls (void) -+{ -+} -+ -+void -+mono_arch_finish_init (void) -+{ -+} -+ -+/* The maximum length is 2 instructions */ -+static guint8* -+emit_imm (guint8 *code, int dreg, int imm) -+{ -+ // FIXME: Optimize this -+ if (imm < 0) { -+ gint64 limm = imm; -+ arm_movnx (code, dreg, (~limm) & 0xffff, 0); -+ arm_movkx (code, dreg, (limm >> 16) & 0xffff, 16); -+ } else { -+ arm_movzx (code, dreg, imm & 0xffff, 0); -+ if (imm >> 16) -+ arm_movkx (code, dreg, (imm >> 16) & 0xffff, 16); -+ } -+ -+ return code; -+} -+ -+/* The maximum length is 4 instructions */ -+static guint8* -+emit_imm64 (guint8 *code, int dreg, guint64 imm) -+{ -+ // FIXME: Optimize this -+ arm_movzx (code, dreg, imm & 0xffff, 0); -+ if ((imm >> 16) & 0xffff) -+ arm_movkx (code, dreg, (imm >> 16) & 0xffff, 16); -+ if ((imm >> 32) & 0xffff) -+ arm_movkx (code, dreg, (imm >> 32) & 0xffff, 32); -+ if ((imm >> 48) & 0xffff) -+ arm_movkx (code, dreg, (imm >> 48) & 0xffff, 48); -+ -+ return code; -+} -+ -+guint8* -+mono_arm_emit_imm64 (guint8 *code, int dreg, gint64 imm) -+{ -+ return emit_imm64 (code, dreg, imm); -+} -+ -+/* -+ * emit_imm_template: -+ * -+ * Emit a patchable code sequence for constructing a 64 bit immediate. -+ */ -+static guint8* -+emit_imm64_template (guint8 *code, int dreg) -+{ -+ arm_movzx (code, dreg, 0, 0); -+ arm_movkx (code, dreg, 0, 16); -+ arm_movkx (code, dreg, 0, 32); -+ arm_movkx (code, dreg, 0, 48); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_addw_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ if (!arm_is_arith_imm (imm)) { -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_addw (code, dreg, sreg, ARMREG_LR); -+ } else { -+ arm_addw_imm (code, dreg, sreg, imm); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_addx_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ if (!arm_is_arith_imm (imm)) { -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_addx (code, dreg, sreg, ARMREG_LR); -+ } else { -+ arm_addx_imm (code, dreg, sreg, imm); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_subw_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ if (!arm_is_arith_imm (imm)) { -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_subw (code, dreg, sreg, ARMREG_LR); -+ } else { -+ arm_subw_imm (code, dreg, sreg, imm); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_subx_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ if (!arm_is_arith_imm (imm)) { -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_subx (code, dreg, sreg, ARMREG_LR); -+ } else { -+ arm_subx_imm (code, dreg, sreg, imm); -+ } -+ return code; -+} -+ -+/* Emit sp+=imm. Clobbers ip0/ip1 */ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_addx_sp_imm (guint8 *code, int imm) -+{ -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_movspx (code, ARMREG_IP1, ARMREG_SP); -+ arm_addx (code, ARMREG_IP1, ARMREG_IP1, ARMREG_IP0); -+ arm_movspx (code, ARMREG_SP, ARMREG_IP1); -+ return code; -+} -+ -+/* Emit sp-=imm. Clobbers ip0/ip1 */ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_subx_sp_imm (guint8 *code, int imm) -+{ -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_movspx (code, ARMREG_IP1, ARMREG_SP); -+ arm_subx (code, ARMREG_IP1, ARMREG_IP1, ARMREG_IP0); -+ arm_movspx (code, ARMREG_SP, ARMREG_IP1); -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_andw_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_andw (code, dreg, sreg, ARMREG_LR); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_andx_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_andx (code, dreg, sreg, ARMREG_LR); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_orrw_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_orrw (code, dreg, sreg, ARMREG_LR); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_orrx_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_orrx (code, dreg, sreg, ARMREG_LR); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_eorw_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_eorw (code, dreg, sreg, ARMREG_LR); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_eorx_imm (guint8 *code, int dreg, int sreg, int imm) -+{ -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_eorx (code, dreg, sreg, ARMREG_LR); -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_cmpw_imm (guint8 *code, int sreg, int imm) -+{ -+ if (imm == 0) { -+ arm_cmpw (code, sreg, ARMREG_RZR); -+ } else { -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_cmpw (code, sreg, ARMREG_LR); -+ } -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_cmpx_imm (guint8 *code, int sreg, int imm) -+{ -+ if (imm == 0) { -+ arm_cmpx (code, sreg, ARMREG_RZR); -+ } else { -+ // FIXME: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_cmpx (code, sreg, ARMREG_LR); -+ } -+ -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_strb (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_strb_imm (imm)) { -+ arm_strb (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_strb_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_strh (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_strh_imm (imm)) { -+ arm_strh (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_strh_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_strw (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_strw_imm (imm)) { -+ arm_strw (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_strw_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_strfpw (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_strw_imm (imm)) { -+ arm_strfpw (code, rt, rn, imm); -+ } else { -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_addx (code, ARMREG_IP0, rn, ARMREG_IP0); -+ arm_strfpw (code, rt, ARMREG_IP0, 0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_strfpx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_strx_imm (imm)) { -+ arm_strfpx (code, rt, rn, imm); -+ } else { -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_addx (code, ARMREG_IP0, rn, ARMREG_IP0); -+ arm_strfpx (code, rt, ARMREG_IP0, 0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_strx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_strx_imm (imm)) { -+ arm_strx (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_strx_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrb (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 1)) { -+ arm_ldrb (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrb_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrsbx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 1)) { -+ arm_ldrsbx (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrsbx_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrh (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 2)) { -+ arm_ldrh (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrh_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrshx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 2)) { -+ arm_ldrshx (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrshx_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrswx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 4)) { -+ arm_ldrswx (code, rt, rn, imm); -+ } else { -+ g_assert (rt != ARMREG_IP0); -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrswx_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrw (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 4)) { -+ arm_ldrw (code, rt, rn, imm); -+ } else { -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrw_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 8)) { -+ arm_ldrx (code, rt, rn, imm); -+ } else { -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_ldrx_reg (code, rt, rn, ARMREG_IP0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrfpw (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 4)) { -+ arm_ldrfpw (code, rt, rn, imm); -+ } else { -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_addx (code, ARMREG_IP0, rn, ARMREG_IP0); -+ arm_ldrfpw (code, rt, ARMREG_IP0, 0); -+ } -+ return code; -+} -+ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_ldrfpx (guint8 *code, int rt, int rn, int imm) -+{ -+ if (arm_is_pimm12_scaled (imm, 8)) { -+ arm_ldrfpx (code, rt, rn, imm); -+ } else { -+ g_assert (rn != ARMREG_IP0); -+ code = emit_imm (code, ARMREG_IP0, imm); -+ arm_addx (code, ARMREG_IP0, rn, ARMREG_IP0); -+ arm_ldrfpx (code, rt, ARMREG_IP0, 0); -+ } -+ return code; -+} -+ -+guint8* -+mono_arm_emit_ldrx (guint8 *code, int rt, int rn, int imm) -+{ -+ return emit_ldrx (code, rt, rn, imm); -+} -+ -+static guint8* -+emit_call (MonoCompile *cfg, guint8* code, guint32 patch_type, gconstpointer data) -+{ -+ /* -+ mono_add_patch_info_rel (cfg, code - cfg->native_code, patch_type, data, MONO_R_ARM64_IMM); -+ code = emit_imm64_template (code, ARMREG_LR); -+ arm_blrx (code, ARMREG_LR); -+ */ -+ mono_add_patch_info_rel (cfg, code - cfg->native_code, patch_type, data, MONO_R_ARM64_BL); -+ arm_bl (code, code); -+ cfg->thunk_area += THUNK_SIZE; -+ return code; -+} -+ -+static guint8* -+emit_aotconst_full (MonoCompile *cfg, MonoJumpInfo **ji, guint8 *code, guint8 *start, int dreg, guint32 patch_type, gconstpointer data) -+{ -+ if (cfg) -+ mono_add_patch_info (cfg, code - cfg->native_code, patch_type, data); -+ else -+ *ji = mono_patch_info_list_prepend (*ji, code - start, patch_type, data); -+ /* See arch_emit_got_access () in aot-compiler.c */ -+ arm_ldrx_lit (code, dreg, 0); -+ arm_nop (code); -+ arm_nop (code); -+ return code; -+} -+ -+static guint8* -+emit_aotconst (MonoCompile *cfg, guint8 *code, int dreg, guint32 patch_type, gconstpointer data) -+{ -+ return emit_aotconst_full (cfg, NULL, code, NULL, dreg, patch_type, data); -+} -+ -+/* -+ * mono_arm_emit_aotconst: -+ * -+ * Emit code to load an AOT constant into DREG. Usable from trampolines. -+ */ -+guint8* -+mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *code_start, int dreg, guint32 patch_type, gconstpointer data) -+{ -+ return emit_aotconst_full (NULL, (MonoJumpInfo**)ji, code, code_start, dreg, patch_type, data); -+} -+ -+static guint8* -+emit_tls_get (guint8 *code, int dreg, int tls_offset) -+{ -+ arm_mrs (code, dreg, ARM_MRS_REG_TPIDR_EL0); -+ if (tls_offset < 256) { -+ arm_ldrx (code, dreg, dreg, tls_offset); -+ } else { -+ code = emit_addx_imm (code, dreg, dreg, tls_offset); -+ arm_ldrx (code, dreg, dreg, 0); -+ } -+ return code; -+} -+ -+static guint8* -+emit_tls_get_reg (guint8 *code, int dreg, int offset_reg) -+{ -+ g_assert (offset_reg != ARMREG_IP0); -+ arm_mrs (code, ARMREG_IP0, ARM_MRS_REG_TPIDR_EL0); -+ arm_ldrx_reg (code, dreg, ARMREG_IP0, offset_reg); -+ return code; -+} -+ -+static guint8* -+emit_tls_set (guint8 *code, int sreg, int tls_offset) -+{ -+ int tmpreg = ARMREG_IP0; -+ -+ g_assert (sreg != tmpreg); -+ arm_mrs (code, tmpreg, ARM_MRS_REG_TPIDR_EL0); -+ if (tls_offset < 256) { -+ arm_strx (code, sreg, tmpreg, tls_offset); -+ } else { -+ code = emit_addx_imm (code, tmpreg, tmpreg, tls_offset); -+ arm_strx (code, sreg, tmpreg, 0); -+ } -+ return code; -+} -+ -+ -+static guint8* -+emit_tls_set_reg (guint8 *code, int sreg, int offset_reg) -+{ -+ int tmpreg = ARMREG_IP0; -+ -+ g_assert (sreg != tmpreg); -+ arm_mrs (code, tmpreg, ARM_MRS_REG_TPIDR_EL0); -+ arm_strx_reg (code, sreg, tmpreg, offset_reg); -+ return code; -+} -+ -+/* -+ * Emits -+ * - mov sp, fp -+ * - ldrp [fp, lr], [sp], !stack_offfset -+ * Clobbers TEMP_REGS. -+ */ -+__attribute__((warn_unused_result)) guint8* -+mono_arm_emit_destroy_frame (guint8 *code, int stack_offset, guint64 temp_regs) -+{ -+ arm_movspx (code, ARMREG_SP, ARMREG_FP); -+ -+ if (arm_is_ldpx_imm (stack_offset)) { -+ arm_ldpx_post (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, stack_offset); -+ } else { -+ arm_ldpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, 0); -+ /* sp += stack_offset */ -+ g_assert (temp_regs & (1 << ARMREG_IP0)); -+ if (temp_regs & (1 << ARMREG_IP1)) { -+ code = emit_addx_sp_imm (code, stack_offset); -+ } else { -+ int imm = stack_offset; -+ -+ /* Can't use addx_sp_imm () since we can't clobber ip0/ip1 */ -+ arm_addx_imm (code, ARMREG_IP0, ARMREG_SP, 0); -+ while (imm > 256) { -+ arm_addx_imm (code, ARMREG_IP0, ARMREG_IP0, 256); -+ imm -= 256; -+ } -+ arm_addx_imm (code, ARMREG_SP, ARMREG_IP0, imm); -+ } -+ } -+ return code; -+} -+ -+#define is_call_imm(diff) ((gint)(diff) >= -33554432 && (gint)(diff) <= 33554431) -+ -+static guint8* -+emit_thunk (guint8 *code, gconstpointer target) -+{ -+ guint8 *p = code; -+ -+ arm_ldrx_lit (code, ARMREG_IP0, code + 8); -+ arm_brx (code, ARMREG_IP0); -+ *(guint64*)code = (guint64)target; -+ -+ mono_arch_flush_icache (p, code - p); -+ return code; -+} -+ -+static gpointer -+create_thunk (MonoCompile *cfg, MonoDomain *domain, guchar *code, const guchar *target) -+{ -+ MonoJitInfo *ji; -+ MonoThunkJitInfo *info; -+ guint8 *thunks, *p; -+ int thunks_size; -+ guint8 *orig_target; -+ guint8 *target_thunk; -+ -+ if (!domain) -+ domain = mono_domain_get (); -+ -+ if (cfg) { -+ /* -+ * This can be called multiple times during JITting, -+ * save the current position in cfg->arch to avoid -+ * doing a O(n^2) search. -+ */ -+ if (!cfg->arch.thunks) { -+ cfg->arch.thunks = cfg->thunks; -+ cfg->arch.thunks_size = cfg->thunk_area; -+ } -+ thunks = cfg->arch.thunks; -+ thunks_size = cfg->arch.thunks_size; -+ if (!thunks_size) { -+ g_print ("thunk failed %p->%p, thunk space=%d method %s", code, target, thunks_size, mono_method_full_name (cfg->method, TRUE)); -+ g_assert_not_reached (); -+ } -+ -+ g_assert (*(guint32*)thunks == 0); -+ emit_thunk (thunks, target); -+ -+ cfg->arch.thunks += THUNK_SIZE; -+ cfg->arch.thunks_size -= THUNK_SIZE; -+ -+ return thunks; -+ } else { -+ ji = mini_jit_info_table_find (domain, (char*)code, NULL); -+ g_assert (ji); -+ info = mono_jit_info_get_thunk_info (ji); -+ g_assert (info); -+ -+ thunks = (guint8*)ji->code_start + info->thunks_offset; -+ thunks_size = info->thunks_size; -+ -+ orig_target = mono_arch_get_call_target (code + 4); -+ -+ mono_domain_lock (domain); -+ -+ target_thunk = NULL; -+ if (orig_target >= thunks && orig_target < thunks + thunks_size) { -+ /* The call already points to a thunk, because of trampolines etc. */ -+ target_thunk = orig_target; -+ } else { -+ for (p = thunks; p < thunks + thunks_size; p += THUNK_SIZE) { -+ if (((guint32*)p) [0] == 0) { -+ /* Free entry */ -+ target_thunk = p; -+ break; -+ } else if (((guint64*)p) [1] == (guint64)target) { -+ /* Thunk already points to target */ -+ target_thunk = p; -+ break; -+ } -+ } -+ } -+ -+ //printf ("THUNK: %p %p %p\n", code, target, target_thunk); -+ -+ if (!target_thunk) { -+ mono_domain_unlock (domain); -+ g_print ("thunk failed %p->%p, thunk space=%d method %s", code, target, thunks_size, cfg ? mono_method_full_name (cfg->method, TRUE) : mono_method_full_name (jinfo_get_method (ji), TRUE)); -+ g_assert_not_reached (); -+ } -+ -+ emit_thunk (target_thunk, target); -+ -+ mono_domain_unlock (domain); -+ -+ return target_thunk; -+ } -+} -+ -+static void -+arm_patch_full (MonoCompile *cfg, MonoDomain *domain, guint8 *code, guint8 *target, int relocation) -+{ -+ switch (relocation) { -+ case MONO_R_ARM64_B: -+ arm_b (code, target); -+ break; -+ case MONO_R_ARM64_BCC: { -+ int cond; -+ -+ cond = arm_get_bcc_cond (code); -+ arm_bcc (code, cond, target); -+ break; -+ } -+ case MONO_R_ARM64_CBZ: -+ arm_set_cbz_target (code, target); -+ break; -+ case MONO_R_ARM64_IMM: { -+ guint64 imm = (guint64)target; -+ int dreg; -+ -+ /* emit_imm64_template () */ -+ dreg = arm_get_movzx_rd (code); -+ arm_movzx (code, dreg, imm & 0xffff, 0); -+ arm_movkx (code, dreg, (imm >> 16) & 0xffff, 16); -+ arm_movkx (code, dreg, (imm >> 32) & 0xffff, 32); -+ arm_movkx (code, dreg, (imm >> 48) & 0xffff, 48); -+ break; -+ } -+ case MONO_R_ARM64_BL: -+ if (arm_is_bl_disp (code, target)) { -+ arm_bl (code, target); -+ } else { -+ gpointer thunk; -+ -+ thunk = create_thunk (cfg, domain, code, target); -+ g_assert (arm_is_bl_disp (code, thunk)); -+ arm_bl (code, thunk); -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ } -+} -+ -+static void -+arm_patch_rel (guint8 *code, guint8 *target, int relocation) -+{ -+ arm_patch_full (NULL, NULL, code, target, relocation); -+} -+ -+void -+mono_arm_patch (guint8 *code, guint8 *target, int relocation) -+{ -+ arm_patch_rel (code, target, relocation); -+} -+ -+void -+mono_arch_patch_code_new (MonoCompile *cfg, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gpointer target) -+{ -+ guint8 *ip; -+ -+ ip = ji->ip.i + code; -+ -+ switch (ji->type) { -+ case MONO_PATCH_INFO_METHOD_JUMP: -+ /* ji->relocation is not set by the caller */ -+ arm_patch_rel (ip, (guint8*)target, MONO_R_ARM64_B); -+ break; -+ default: -+ arm_patch_full (cfg, domain, ip, (guint8*)target, ji->relocation); -+ break; -+ } -+} -+ -+void -+mono_arch_free_jit_tls_data (MonoJitTlsData *tls) -+{ -+} -+ -+void -+mono_arch_flush_register_windows (void) -+{ -+} -+ -+MonoMethod* -+mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) -+{ -+ return (gpointer)regs [MONO_ARCH_RGCTX_REG]; -+} -+ -+MonoVTable* -+mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) -+{ -+ return (gpointer)regs [MONO_ARCH_RGCTX_REG]; -+} -+ -+mgreg_t -+mono_arch_context_get_int_reg (MonoContext *ctx, int reg) -+{ -+ return ctx->regs [reg]; -+} -+ -+void -+mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) -+{ -+ ctx->regs [reg] = val; -+} -+ -+/* -+ * mono_arch_set_target: -+ * -+ * Set the target architecture the JIT backend should generate code for, in the form -+ * of a GNU target triplet. Only used in AOT mode. -+ */ -+void -+mono_arch_set_target (char *mtriple) -+{ -+ if (strstr (mtriple, "darwin") || strstr (mtriple, "ios")) { -+ ios_abi = TRUE; -+ } -+} -+ -+static void -+add_general (CallInfo *cinfo, ArgInfo *ainfo, int size, gboolean sign) -+{ -+ if (cinfo->gr >= PARAM_REGS) { -+ ainfo->storage = ArgOnStack; -+ if (ios_abi) { -+ /* Assume size == align */ -+ cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, size); -+ ainfo->offset = cinfo->stack_usage; -+ ainfo->slot_size = size; -+ ainfo->sign = sign; -+ cinfo->stack_usage += size; -+ } else { -+ ainfo->offset = cinfo->stack_usage; -+ ainfo->slot_size = 8; -+ ainfo->sign = FALSE; -+ /* Put arguments into 8 byte aligned stack slots */ -+ cinfo->stack_usage += 8; -+ } -+ } else { -+ ainfo->storage = ArgInIReg; -+ ainfo->reg = cinfo->gr; -+ cinfo->gr ++; -+ } -+} -+ -+static void -+add_fp (CallInfo *cinfo, ArgInfo *ainfo, gboolean single) -+{ -+ int size = single ? 4 : 8; -+ -+ if (cinfo->fr >= FP_PARAM_REGS) { -+ ainfo->storage = single ? ArgOnStackR4 : ArgOnStackR8; -+ if (ios_abi) { -+ cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, size); -+ ainfo->offset = cinfo->stack_usage; -+ ainfo->slot_size = size; -+ cinfo->stack_usage += size; -+ } else { -+ ainfo->offset = cinfo->stack_usage; -+ ainfo->slot_size = 8; -+ /* Put arguments into 8 byte aligned stack slots */ -+ cinfo->stack_usage += 8; -+ } -+ } else { -+ if (single) -+ ainfo->storage = ArgInFRegR4; -+ else -+ ainfo->storage = ArgInFReg; -+ ainfo->reg = cinfo->fr; -+ cinfo->fr ++; -+ } -+} -+ -+static gboolean -+is_hfa (MonoType *t, int *out_nfields, int *out_esize, int *field_offsets) -+{ -+ MonoClass *klass; -+ gpointer iter; -+ MonoClassField *field; -+ MonoType *ftype, *prev_ftype = NULL; -+ int i, nfields = 0; -+ -+ klass = mono_class_from_mono_type (t); -+ iter = NULL; -+ while ((field = mono_class_get_fields (klass, &iter))) { -+ if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) -+ continue; -+ ftype = mono_field_get_type (field); -+ ftype = mini_type_get_underlying_type (NULL, ftype); -+ -+ if (MONO_TYPE_ISSTRUCT (ftype)) { -+ int nested_nfields, nested_esize; -+ int nested_field_offsets [16]; -+ -+ if (!is_hfa (ftype, &nested_nfields, &nested_esize, nested_field_offsets)) -+ return FALSE; -+ if (nested_esize == 4) -+ ftype = &mono_defaults.single_class->byval_arg; -+ else -+ ftype = &mono_defaults.double_class->byval_arg; -+ if (prev_ftype && prev_ftype->type != ftype->type) -+ return FALSE; -+ prev_ftype = ftype; -+ for (i = 0; i < nested_nfields; ++i) { -+ if (nfields + i < 4) -+ field_offsets [nfields + i] = field->offset - sizeof (MonoObject) + nested_field_offsets [i]; -+ } -+ nfields += nested_nfields; -+ } else { -+ if (!(!ftype->byref && (ftype->type == MONO_TYPE_R4 || ftype->type == MONO_TYPE_R8))) -+ return FALSE; -+ if (prev_ftype && prev_ftype->type != ftype->type) -+ return FALSE; -+ prev_ftype = ftype; -+ if (nfields < 4) -+ field_offsets [nfields] = field->offset - sizeof (MonoObject); -+ nfields ++; -+ } -+ } -+ if (nfields == 0 || nfields > 4) -+ return FALSE; -+ *out_nfields = nfields; -+ *out_esize = prev_ftype->type == MONO_TYPE_R4 ? 4 : 8; -+ return TRUE; -+} -+ -+static void -+add_valuetype (CallInfo *cinfo, MonoGenericSharingContext *gsctx, ArgInfo *ainfo, MonoType *t) -+{ -+ int i, size, align_size, nregs, nfields, esize; -+ int field_offsets [16]; -+ guint32 align; -+ -+ size = mini_type_stack_size_full (gsctx, t, &align, FALSE); -+ align_size = ALIGN_TO (size, 8); -+ -+ nregs = size / 8; -+ if (is_hfa (t, &nfields, &esize, field_offsets)) { -+ /* -+ * The struct might include nested float structs aligned at 8, -+ * so need to keep track of the offsets of the individual fields. -+ */ -+ if (cinfo->fr + nfields <= FP_PARAM_REGS) { -+ ainfo->storage = ArgHFA; -+ ainfo->reg = cinfo->fr; -+ ainfo->nregs = nfields; -+ ainfo->size = size; -+ ainfo->esize = esize; -+ for (i = 0; i < nfields; ++i) -+ ainfo->foffsets [i] = field_offsets [i]; -+ cinfo->fr += ainfo->nregs; -+ } else { -+ cinfo->fr = FP_PARAM_REGS; -+ size = ALIGN_TO (size, 8); -+ ainfo->storage = ArgVtypeOnStack; -+ ainfo->offset = cinfo->stack_usage; -+ ainfo->size = size; -+ ainfo->hfa = TRUE; -+ ainfo->nregs = nfields; -+ ainfo->esize = esize; -+ cinfo->stack_usage += size; -+ } -+ return; -+ } -+ -+ if (align_size > 16) { -+ ainfo->storage = ArgVtypeByRef; -+ ainfo->size = size; -+ return; -+ } -+ -+ if (cinfo->gr + nregs > PARAM_REGS) { -+ size = ALIGN_TO (size, 8); -+ ainfo->storage = ArgVtypeOnStack; -+ ainfo->offset = cinfo->stack_usage; -+ ainfo->size = size; -+ cinfo->stack_usage += size; -+ cinfo->gr = PARAM_REGS; -+ } else { -+ ainfo->storage = ArgVtypeInIRegs; -+ ainfo->reg = cinfo->gr; -+ ainfo->nregs = nregs; -+ ainfo->size = size; -+ cinfo->gr += nregs; -+ } -+} -+ -+static void -+add_param (CallInfo *cinfo, MonoGenericSharingContext *gsctx, ArgInfo *ainfo, MonoType *t) -+{ -+ MonoType *ptype; -+ -+ ptype = mini_type_get_underlying_type (gsctx, t); -+ switch (ptype->type) { -+ case MONO_TYPE_I1: -+ add_general (cinfo, ainfo, 1, TRUE); -+ break; -+ case MONO_TYPE_BOOLEAN: -+ case MONO_TYPE_U1: -+ add_general (cinfo, ainfo, 1, FALSE); -+ break; -+ case MONO_TYPE_I2: -+ add_general (cinfo, ainfo, 2, TRUE); -+ break; -+ case MONO_TYPE_U2: -+ case MONO_TYPE_CHAR: -+ add_general (cinfo, ainfo, 2, FALSE); -+ break; -+ case MONO_TYPE_I4: -+ add_general (cinfo, ainfo, 4, TRUE); -+ break; -+ case MONO_TYPE_U4: -+ add_general (cinfo, ainfo, 4, FALSE); -+ break; -+ case MONO_TYPE_I: -+ case MONO_TYPE_U: -+ case MONO_TYPE_PTR: -+ case MONO_TYPE_FNPTR: -+ case MONO_TYPE_CLASS: -+ case MONO_TYPE_OBJECT: -+ case MONO_TYPE_SZARRAY: -+ case MONO_TYPE_ARRAY: -+ case MONO_TYPE_STRING: -+ case MONO_TYPE_U8: -+ case MONO_TYPE_I8: -+ add_general (cinfo, ainfo, 8, FALSE); -+ break; -+ case MONO_TYPE_R8: -+ add_fp (cinfo, ainfo, FALSE); -+ break; -+ case MONO_TYPE_R4: -+ add_fp (cinfo, ainfo, TRUE); -+ break; -+ case MONO_TYPE_VALUETYPE: -+ case MONO_TYPE_TYPEDBYREF: -+ add_valuetype (cinfo, gsctx, ainfo, ptype); -+ break; -+ case MONO_TYPE_VOID: -+ ainfo->storage = ArgNone; -+ break; -+ case MONO_TYPE_GENERICINST: -+ if (!mono_type_generic_inst_is_valuetype (ptype)) { -+ add_general (cinfo, ainfo, 8, FALSE); -+ } else if (mini_is_gsharedvt_variable_type_gsctx (gsctx, ptype)) { -+ /* -+ * Treat gsharedvt arguments as large vtypes -+ */ -+ ainfo->storage = ArgVtypeByRef; -+ ainfo->gsharedvt = TRUE; -+ } else { -+ add_valuetype (cinfo, gsctx, ainfo, ptype); -+ } -+ break; -+ case MONO_TYPE_VAR: -+ case MONO_TYPE_MVAR: -+ g_assert (mini_is_gsharedvt_type_gsctx (gsctx, ptype)); -+ ainfo->storage = ArgVtypeByRef; -+ ainfo->gsharedvt = TRUE; -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+} -+ -+/* -+ * get_call_info: -+ * -+ * Obtain information about a call according to the calling convention. -+ */ -+static CallInfo* -+get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSignature *sig) -+{ -+ CallInfo *cinfo; -+ ArgInfo *ainfo; -+ int n, pstart, pindex; -+ -+ n = sig->hasthis + sig->param_count; -+ -+ if (mp) -+ cinfo = mono_mempool_alloc0 (mp, sizeof (CallInfo) + (sizeof (ArgInfo) * n)); -+ else -+ cinfo = g_malloc0 (sizeof (CallInfo) + (sizeof (ArgInfo) * n)); -+ -+ cinfo->nargs = n; -+ -+ /* Return value */ -+ add_param (cinfo, gsctx, &cinfo->ret, sig->ret); -+ if (cinfo->ret.storage == ArgVtypeByRef) -+ cinfo->ret.reg = ARMREG_R8; -+ /* Reset state */ -+ cinfo->gr = 0; -+ cinfo->fr = 0; -+ cinfo->stack_usage = 0; -+ -+ /* Parameters */ -+ if (sig->hasthis) -+ add_general (cinfo, cinfo->args + 0, 8, FALSE); -+ pstart = 0; -+ for (pindex = pstart; pindex < sig->param_count; ++pindex) { -+ ainfo = cinfo->args + sig->hasthis + pindex; -+ -+ if ((sig->call_convention == MONO_CALL_VARARG) && (pindex == sig->sentinelpos)) { -+ /* Prevent implicit arguments and sig_cookie from -+ being passed in registers */ -+ cinfo->gr = PARAM_REGS; -+ cinfo->fr = FP_PARAM_REGS; -+ /* Emit the signature cookie just before the implicit arguments */ -+ add_param (cinfo, gsctx, &cinfo->sig_cookie, &mono_defaults.int_class->byval_arg); -+ } -+ -+ add_param (cinfo, gsctx, ainfo, sig->params [pindex]); -+ if (ainfo->storage == ArgVtypeByRef) { -+ /* Pass the argument address in the next register */ -+ if (cinfo->gr >= PARAM_REGS) { -+ ainfo->storage = ArgVtypeByRefOnStack; -+ ainfo->offset = cinfo->stack_usage; -+ cinfo->stack_usage += 8; -+ } else { -+ ainfo->reg = cinfo->gr; -+ cinfo->gr ++; -+ } -+ } -+ } -+ -+ /* Handle the case where there are no implicit arguments */ -+ if ((sig->call_convention == MONO_CALL_VARARG) && (pindex == sig->sentinelpos)) { -+ /* Prevent implicit arguments and sig_cookie from -+ being passed in registers */ -+ cinfo->gr = PARAM_REGS; -+ cinfo->fr = FP_PARAM_REGS; -+ /* Emit the signature cookie just before the implicit arguments */ -+ add_param (cinfo, gsctx, &cinfo->sig_cookie, &mono_defaults.int_class->byval_arg); -+ } -+ -+ cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, MONO_ARCH_FRAME_ALIGNMENT); -+ -+ return cinfo; -+} -+ -+typedef struct { -+ MonoMethodSignature *sig; -+ CallInfo *cinfo; -+ MonoType *rtype; -+ MonoType **param_types; -+ int n_fpargs, n_fpret; -+} ArchDynCallInfo; -+ -+static gboolean -+dyn_call_supported (CallInfo *cinfo, MonoMethodSignature *sig) -+{ -+ int i; -+ -+ if (sig->hasthis + sig->param_count > PARAM_REGS + DYN_CALL_STACK_ARGS) -+ return FALSE; -+ -+ // FIXME: Add more cases -+ switch (cinfo->ret.storage) { -+ case ArgNone: -+ case ArgInIReg: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ case ArgVtypeByRef: -+ break; -+ case ArgVtypeInIRegs: -+ if (cinfo->ret.nregs > 2) -+ return FALSE; -+ break; -+ case ArgHFA: -+ break; -+ default: -+ return FALSE; -+ } -+ -+ for (i = 0; i < cinfo->nargs; ++i) { -+ ArgInfo *ainfo = &cinfo->args [i]; -+ -+ switch (ainfo->storage) { -+ case ArgInIReg: -+ case ArgVtypeInIRegs: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ case ArgHFA: -+ case ArgVtypeByRef: -+ break; -+ case ArgOnStack: -+ if (ainfo->offset >= DYN_CALL_STACK_ARGS * sizeof (mgreg_t)) -+ return FALSE; -+ break; -+ default: -+ return FALSE; -+ } -+ } -+ -+ return TRUE; -+} -+ -+MonoDynCallInfo* -+mono_arch_dyn_call_prepare (MonoMethodSignature *sig) -+{ -+ ArchDynCallInfo *info; -+ CallInfo *cinfo; -+ int i; -+ -+ cinfo = get_call_info (NULL, NULL, sig); -+ -+ if (!dyn_call_supported (cinfo, sig)) { -+ g_free (cinfo); -+ return NULL; -+ } -+ -+ info = g_new0 (ArchDynCallInfo, 1); -+ // FIXME: Preprocess the info to speed up start_dyn_call () -+ info->sig = sig; -+ info->cinfo = cinfo; -+ info->rtype = mini_replace_type (sig->ret); -+ info->param_types = g_new0 (MonoType*, sig->param_count); -+ for (i = 0; i < sig->param_count; ++i) -+ info->param_types [i] = mini_replace_type (sig->params [i]); -+ -+ switch (cinfo->ret.storage) { -+ case ArgInFReg: -+ case ArgInFRegR4: -+ info->n_fpret = 1; -+ break; -+ case ArgHFA: -+ info->n_fpret = cinfo->ret.nregs; -+ break; -+ default: -+ break; -+ } -+ -+ return (MonoDynCallInfo*)info; -+} -+ -+void -+mono_arch_dyn_call_free (MonoDynCallInfo *info) -+{ -+ ArchDynCallInfo *ainfo = (ArchDynCallInfo*)info; -+ -+ g_free (ainfo->cinfo); -+ g_free (ainfo->param_types); -+ g_free (ainfo); -+} -+ -+static double -+bitcast_r4_to_r8 (float f) -+{ -+ float *p = &f; -+ -+ return *(double*)p; -+} -+ -+static float -+bitcast_r8_to_r4 (double f) -+{ -+ double *p = &f; -+ -+ return *(float*)p; -+} -+ -+void -+mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, guint8 *buf, int buf_len) -+{ -+ ArchDynCallInfo *dinfo = (ArchDynCallInfo*)info; -+ DynCallArgs *p = (DynCallArgs*)buf; -+ int aindex, arg_index, greg, i, pindex; -+ MonoMethodSignature *sig = dinfo->sig; -+ CallInfo *cinfo = dinfo->cinfo; -+ int buffer_offset = 0; -+ -+ g_assert (buf_len >= sizeof (DynCallArgs)); -+ -+ p->res = 0; -+ p->ret = ret; -+ p->n_fpargs = dinfo->n_fpargs; -+ p->n_fpret = dinfo->n_fpret; -+ -+ arg_index = 0; -+ greg = 0; -+ pindex = 0; -+ -+ if (sig->hasthis) -+ p->regs [greg ++] = (mgreg_t)*(args [arg_index ++]); -+ -+ if (cinfo->ret.storage == ArgVtypeByRef) -+ p->regs [ARMREG_R8] = (mgreg_t)ret; -+ -+ for (aindex = pindex; aindex < sig->param_count; aindex++) { -+ MonoType *t = dinfo->param_types [aindex]; -+ gpointer *arg = args [arg_index ++]; -+ ArgInfo *ainfo = &cinfo->args [aindex + sig->hasthis]; -+ int slot = -1; -+ -+ if (ainfo->storage == ArgOnStack) { -+ slot = PARAM_REGS + 1 + (ainfo->offset / sizeof (mgreg_t)); -+ } else { -+ slot = ainfo->reg; -+ } -+ -+ if (t->byref) { -+ p->regs [slot] = (mgreg_t)*arg; -+ continue; -+ } -+ -+ if (ios_abi && ainfo->storage == ArgOnStack) { -+ guint8 *stack_arg = (guint8*)&(p->regs [PARAM_REGS + 1]) + ainfo->offset; -+ gboolean handled = TRUE; -+ -+ /* Special case arguments smaller than 1 machine word */ -+ switch (t->type) { -+ case MONO_TYPE_BOOLEAN: -+ case MONO_TYPE_U1: -+ *(guint8*)stack_arg = *(guint8*)arg; -+ break; -+ case MONO_TYPE_I1: -+ *(gint8*)stack_arg = *(gint8*)arg; -+ break; -+ case MONO_TYPE_U2: -+ case MONO_TYPE_CHAR: -+ *(guint16*)stack_arg = *(guint16*)arg; -+ break; -+ case MONO_TYPE_I2: -+ *(gint16*)stack_arg = *(gint16*)arg; -+ break; -+ case MONO_TYPE_I4: -+ *(gint32*)stack_arg = *(gint32*)arg; -+ break; -+ case MONO_TYPE_U4: -+ *(guint32*)stack_arg = *(guint32*)arg; -+ break; -+ default: -+ handled = FALSE; -+ break; -+ } -+ if (handled) -+ continue; -+ } -+ -+ switch (t->type) { -+ case MONO_TYPE_STRING: -+ case MONO_TYPE_CLASS: -+ case MONO_TYPE_ARRAY: -+ case MONO_TYPE_SZARRAY: -+ case MONO_TYPE_OBJECT: -+ case MONO_TYPE_PTR: -+ case MONO_TYPE_I: -+ case MONO_TYPE_U: -+ case MONO_TYPE_I8: -+ case MONO_TYPE_U8: -+ p->regs [slot] = (mgreg_t)*arg; -+ break; -+ case MONO_TYPE_BOOLEAN: -+ case MONO_TYPE_U1: -+ p->regs [slot] = *(guint8*)arg; -+ break; -+ case MONO_TYPE_I1: -+ p->regs [slot] = *(gint8*)arg; -+ break; -+ case MONO_TYPE_I2: -+ p->regs [slot] = *(gint16*)arg; -+ break; -+ case MONO_TYPE_U2: -+ case MONO_TYPE_CHAR: -+ p->regs [slot] = *(guint16*)arg; -+ break; -+ case MONO_TYPE_I4: -+ p->regs [slot] = *(gint32*)arg; -+ break; -+ case MONO_TYPE_U4: -+ p->regs [slot] = *(guint32*)arg; -+ break; -+ case MONO_TYPE_R4: -+ p->fpregs [ainfo->reg] = bitcast_r4_to_r8 (*(float*)arg); -+ p->n_fpargs ++; -+ break; -+ case MONO_TYPE_R8: -+ p->fpregs [ainfo->reg] = *(double*)arg; -+ p->n_fpargs ++; -+ break; -+ case MONO_TYPE_GENERICINST: -+ if (MONO_TYPE_IS_REFERENCE (t)) { -+ p->regs [slot] = (mgreg_t)*arg; -+ break; -+ } else { -+ if (t->type == MONO_TYPE_GENERICINST && mono_class_is_nullable (mono_class_from_mono_type (t))) { -+ MonoClass *klass = mono_class_from_mono_type (t); -+ guint8 *nullable_buf; -+ int size; -+ -+ /* -+ * Use p->buffer as a temporary buffer since the data needs to be available after this call -+ * if the nullable param is passed by ref. -+ */ -+ size = mono_class_value_size (klass, NULL); -+ nullable_buf = p->buffer + buffer_offset; -+ buffer_offset += size; -+ g_assert (buffer_offset <= 256); -+ -+ /* The argument pointed to by arg is either a boxed vtype or null */ -+ mono_nullable_init (nullable_buf, (MonoObject*)arg, klass); -+ -+ arg = (gpointer*)nullable_buf; -+ /* Fall though */ -+ } else { -+ /* Fall though */ -+ } -+ } -+ case MONO_TYPE_VALUETYPE: -+ switch (ainfo->storage) { -+ case ArgVtypeInIRegs: -+ for (i = 0; i < ainfo->nregs; ++i) -+ p->regs [slot ++] = ((mgreg_t*)arg) [i]; -+ break; -+ case ArgHFA: -+ if (ainfo->esize == 4) { -+ for (i = 0; i < ainfo->nregs; ++i) -+ p->fpregs [ainfo->reg + i] = bitcast_r4_to_r8 (((float*)arg) [ainfo->foffsets [i] / 4]); -+ } else { -+ for (i = 0; i < ainfo->nregs; ++i) -+ p->fpregs [ainfo->reg + i] = ((double*)arg) [ainfo->foffsets [i] / 8]; -+ } -+ p->n_fpargs += ainfo->nregs; -+ break; -+ case ArgVtypeByRef: -+ p->regs [slot] = (mgreg_t)arg; -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ } -+ } -+} -+ -+void -+mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf) -+{ -+ ArchDynCallInfo *ainfo = (ArchDynCallInfo*)info; -+ CallInfo *cinfo = ainfo->cinfo; -+ DynCallArgs *args = (DynCallArgs*)buf; -+ MonoType *ptype = ainfo->rtype; -+ guint8 *ret = args->ret; -+ mgreg_t res = args->res; -+ mgreg_t res2 = args->res2; -+ int i; -+ -+ if (cinfo->ret.storage == ArgVtypeByRef) -+ return; -+ -+ switch (ptype->type) { -+ case MONO_TYPE_VOID: -+ *(gpointer*)ret = NULL; -+ break; -+ case MONO_TYPE_STRING: -+ case MONO_TYPE_CLASS: -+ case MONO_TYPE_ARRAY: -+ case MONO_TYPE_SZARRAY: -+ case MONO_TYPE_OBJECT: -+ case MONO_TYPE_I: -+ case MONO_TYPE_U: -+ case MONO_TYPE_PTR: -+ *(gpointer*)ret = (gpointer)res; -+ break; -+ case MONO_TYPE_I1: -+ *(gint8*)ret = res; -+ break; -+ case MONO_TYPE_U1: -+ case MONO_TYPE_BOOLEAN: -+ *(guint8*)ret = res; -+ break; -+ case MONO_TYPE_I2: -+ *(gint16*)ret = res; -+ break; -+ case MONO_TYPE_U2: -+ case MONO_TYPE_CHAR: -+ *(guint16*)ret = res; -+ break; -+ case MONO_TYPE_I4: -+ *(gint32*)ret = res; -+ break; -+ case MONO_TYPE_U4: -+ *(guint32*)ret = res; -+ break; -+ case MONO_TYPE_I8: -+ case MONO_TYPE_U8: -+ *(guint64*)ret = res; -+ break; -+ case MONO_TYPE_R4: -+ *(float*)ret = bitcast_r8_to_r4 (args->fpregs [0]); -+ break; -+ case MONO_TYPE_R8: -+ *(double*)ret = args->fpregs [0]; -+ break; -+ case MONO_TYPE_GENERICINST: -+ if (MONO_TYPE_IS_REFERENCE (ptype)) { -+ *(gpointer*)ret = (gpointer)res; -+ break; -+ } else { -+ /* Fall though */ -+ } -+ case MONO_TYPE_VALUETYPE: -+ switch (ainfo->cinfo->ret.storage) { -+ case ArgVtypeInIRegs: -+ *(mgreg_t*)ret = res; -+ if (ainfo->cinfo->ret.nregs > 1) -+ ((mgreg_t*)ret) [1] = res2; -+ break; -+ case ArgHFA: -+ /* Use the same area for returning fp values */ -+ if (cinfo->ret.esize == 4) { -+ for (i = 0; i < cinfo->ret.nregs; ++i) -+ ((float*)ret) [cinfo->ret.foffsets [i] / 4] = bitcast_r8_to_r4 (args->fpregs [i]); -+ } else { -+ for (i = 0; i < cinfo->ret.nregs; ++i) -+ ((double*)ret) [cinfo->ret.foffsets [i] / 8] = args->fpregs [i]; -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ } -+} -+ -+#if __APPLE__ -+void sys_icache_invalidate (void *start, size_t len); -+#endif -+ -+void -+mono_arch_flush_icache (guint8 *code, gint size) -+{ -+#ifndef MONO_CROSS_COMPILE -+#if __APPLE__ -+ sys_icache_invalidate (code, size); -+#else -+ __clear_cache (code, code + size); -+#endif -+#endif -+} -+ -+#ifndef DISABLE_JIT -+ -+gboolean -+mono_arch_opcode_needs_emulation (MonoCompile *cfg, int opcode) -+{ -+ NOT_IMPLEMENTED; -+ return FALSE; -+} -+ -+GList * -+mono_arch_get_allocatable_int_vars (MonoCompile *cfg) -+{ -+ GList *vars = NULL; -+ int i; -+ -+ for (i = 0; i < cfg->num_varinfo; i++) { -+ MonoInst *ins = cfg->varinfo [i]; -+ MonoMethodVar *vmv = MONO_VARINFO (cfg, i); -+ -+ /* unused vars */ -+ if (vmv->range.first_use.abs_pos >= vmv->range.last_use.abs_pos) -+ continue; -+ -+ if ((ins->flags & (MONO_INST_IS_DEAD|MONO_INST_VOLATILE|MONO_INST_INDIRECT)) || -+ (ins->opcode != OP_LOCAL && ins->opcode != OP_ARG)) -+ continue; -+ -+ if (mono_is_regsize_var (ins->inst_vtype)) { -+ g_assert (MONO_VARINFO (cfg, i)->reg == -1); -+ g_assert (i == vmv->idx); -+ vars = g_list_prepend (vars, vmv); -+ } -+ } -+ -+ vars = mono_varlist_sort (cfg, vars, 0); -+ -+ return vars; -+} -+ -+GList * -+mono_arch_get_global_int_regs (MonoCompile *cfg) -+{ -+ GList *regs = NULL; -+ int i; -+ -+ /* r28 is reserved for cfg->arch.args_reg */ -+ /* r27 is reserved for the imt argument */ -+ for (i = ARMREG_R19; i <= ARMREG_R26; ++i) -+ regs = g_list_prepend (regs, GUINT_TO_POINTER (i)); -+ -+ return regs; -+} -+ -+guint32 -+mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv) -+{ -+ MonoInst *ins = cfg->varinfo [vmv->idx]; -+ -+ if (ins->opcode == OP_ARG) -+ return 1; -+ else -+ return 2; -+} -+ -+void -+mono_arch_create_vars (MonoCompile *cfg) -+{ -+ MonoMethodSignature *sig; -+ CallInfo *cinfo; -+ -+ sig = mono_method_signature (cfg->method); -+ if (!cfg->arch.cinfo) -+ cfg->arch.cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, sig); -+ cinfo = cfg->arch.cinfo; -+ -+ if (cinfo->ret.storage == ArgVtypeByRef) { -+ cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL); -+ cfg->vret_addr->flags |= MONO_INST_VOLATILE; -+ } -+ -+ if (cfg->gen_sdb_seq_points) { -+ MonoInst *ins; -+ -+ if (cfg->compile_aot) { -+ ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL); -+ ins->flags |= MONO_INST_VOLATILE; -+ cfg->arch.seq_point_info_var = ins; -+ } -+ -+ ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL); -+ ins->flags |= MONO_INST_VOLATILE; -+ cfg->arch.ss_tramp_var = ins; -+ -+ ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL); -+ ins->flags |= MONO_INST_VOLATILE; -+ cfg->arch.bp_tramp_var = ins; -+ } -+ -+ if (cfg->method->save_lmf) { -+ cfg->create_lmf_var = TRUE; -+ cfg->lmf_ir = TRUE; -+#ifndef TARGET_MACH -+ cfg->lmf_ir_mono_lmf = TRUE; -+#endif -+ } -+} -+ -+void -+mono_arch_allocate_vars (MonoCompile *cfg) -+{ -+ MonoMethodSignature *sig; -+ MonoInst *ins; -+ CallInfo *cinfo; -+ ArgInfo *ainfo; -+ int i, offset, size, align; -+ guint32 locals_stack_size, locals_stack_align; -+ gint32 *offsets; -+ -+ /* -+ * Allocate arguments and locals to either register (OP_REGVAR) or to a stack slot (OP_REGOFFSET). -+ * Compute cfg->stack_offset and update cfg->used_int_regs. -+ */ -+ -+ sig = mono_method_signature (cfg->method); -+ -+ if (!cfg->arch.cinfo) -+ cfg->arch.cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, sig); -+ cinfo = cfg->arch.cinfo; -+ -+ /* -+ * The ARM64 ABI always uses a frame pointer. -+ * The instruction set prefers positive offsets, so fp points to the bottom of the -+ * frame, and stack slots are at positive offsets. -+ * If some arguments are received on the stack, their offsets relative to fp can -+ * not be computed right now because the stack frame might grow due to spilling -+ * done by the local register allocator. To solve this, we reserve a register -+ * which points to them. -+ * The stack frame looks like this: -+ * args_reg -> -+ * -+ * fp -> -+ * sp -> -+ */ -+ cfg->frame_reg = ARMREG_FP; -+ cfg->flags |= MONO_CFG_HAS_SPILLUP; -+ offset = 0; -+ -+ /* Saved fp+lr */ -+ offset += 16; -+ -+ if (cinfo->stack_usage) { -+ g_assert (!(cfg->used_int_regs & (1 << ARMREG_R28))); -+ cfg->arch.args_reg = ARMREG_R28; -+ cfg->used_int_regs |= 1 << ARMREG_R28; -+ } -+ -+ if (cfg->method->save_lmf) { -+ /* The LMF var is allocated normally */ -+ } else { -+ /* Callee saved regs */ -+ cfg->arch.saved_gregs_offset = offset; -+ for (i = 0; i < 32; ++i) -+ if ((MONO_ARCH_CALLEE_SAVED_REGS & (1 << i)) && (cfg->used_int_regs & (1 << i))) -+ offset += 8; -+ } -+ -+ /* Return value */ -+ switch (cinfo->ret.storage) { -+ case ArgNone: -+ break; -+ case ArgInIReg: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ cfg->ret->opcode = OP_REGVAR; -+ cfg->ret->dreg = cinfo->ret.reg; -+ break; -+ case ArgVtypeInIRegs: -+ case ArgHFA: -+ /* Allocate a local to hold the result, the epilog will copy it to the correct place */ -+ cfg->ret->opcode = OP_REGOFFSET; -+ cfg->ret->inst_basereg = cfg->frame_reg; -+ cfg->ret->inst_offset = offset; -+ if (cinfo->ret.storage == ArgHFA) -+ // FIXME: -+ offset += 64; -+ else -+ offset += 16; -+ break; -+ case ArgVtypeByRef: -+ /* This variable will be initalized in the prolog from R8 */ -+ cfg->vret_addr->opcode = OP_REGOFFSET; -+ cfg->vret_addr->inst_basereg = cfg->frame_reg; -+ cfg->vret_addr->inst_offset = offset; -+ offset += 8; -+ if (G_UNLIKELY (cfg->verbose_level > 1)) { -+ printf ("vret_addr ="); -+ mono_print_ins (cfg->vret_addr); -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ -+ /* Arguments */ -+ for (i = 0; i < sig->param_count + sig->hasthis; ++i) { -+ ainfo = cinfo->args + i; -+ -+ ins = cfg->args [i]; -+ if (ins->opcode == OP_REGVAR) -+ continue; -+ -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ -+ switch (ainfo->storage) { -+ case ArgInIReg: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ // FIXME: Use nregs/size -+ /* These will be copied to the stack in the prolog */ -+ ins->inst_offset = offset; -+ offset += 8; -+ break; -+ case ArgOnStack: -+ case ArgOnStackR4: -+ case ArgOnStackR8: -+ case ArgVtypeOnStack: -+ /* These are in the parent frame */ -+ g_assert (cfg->arch.args_reg); -+ ins->inst_basereg = cfg->arch.args_reg; -+ ins->inst_offset = ainfo->offset; -+ break; -+ case ArgVtypeInIRegs: -+ case ArgHFA: -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ /* These arguments are saved to the stack in the prolog */ -+ ins->inst_offset = offset; -+ if (cfg->verbose_level >= 2) -+ printf ("arg %d allocated to %s+0x%0x.\n", i, mono_arch_regname (ins->inst_basereg), (int)ins->inst_offset); -+ if (ainfo->storage == ArgHFA) -+ // FIXME: -+ offset += 64; -+ else -+ offset += 16; -+ break; -+ case ArgVtypeByRefOnStack: { -+ MonoInst *vtaddr; -+ -+ if (ainfo->gsharedvt) { -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->arch.args_reg; -+ ins->inst_offset = ainfo->offset; -+ break; -+ } -+ -+ /* The vtype address is in the parent frame */ -+ g_assert (cfg->arch.args_reg); -+ MONO_INST_NEW (cfg, vtaddr, 0); -+ vtaddr->opcode = OP_REGOFFSET; -+ vtaddr->inst_basereg = cfg->arch.args_reg; -+ vtaddr->inst_offset = ainfo->offset; -+ -+ /* Need an indirection */ -+ ins->opcode = OP_VTARG_ADDR; -+ ins->inst_left = vtaddr; -+ break; -+ } -+ case ArgVtypeByRef: { -+ MonoInst *vtaddr; -+ -+ if (ainfo->gsharedvt) { -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ ins->inst_offset = offset; -+ offset += 8; -+ break; -+ } -+ -+ /* The vtype address is in a register, will be copied to the stack in the prolog */ -+ MONO_INST_NEW (cfg, vtaddr, 0); -+ vtaddr->opcode = OP_REGOFFSET; -+ vtaddr->inst_basereg = cfg->frame_reg; -+ vtaddr->inst_offset = offset; -+ offset += 8; -+ -+ /* Need an indirection */ -+ ins->opcode = OP_VTARG_ADDR; -+ ins->inst_left = vtaddr; -+ break; -+ } -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ } -+ -+ /* Allocate these first so they have a small offset, OP_SEQ_POINT depends on this */ -+ // FIXME: Allocate these to registers -+ ins = cfg->arch.seq_point_info_var; -+ if (ins) { -+ size = 8; -+ align = 8; -+ offset += align - 1; -+ offset &= ~(align - 1); -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ ins->inst_offset = offset; -+ offset += size; -+ } -+ ins = cfg->arch.ss_tramp_var; -+ if (ins) { -+ size = 8; -+ align = 8; -+ offset += align - 1; -+ offset &= ~(align - 1); -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ ins->inst_offset = offset; -+ offset += size; -+ } -+ ins = cfg->arch.bp_tramp_var; -+ if (ins) { -+ size = 8; -+ align = 8; -+ offset += align - 1; -+ offset &= ~(align - 1); -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ ins->inst_offset = offset; -+ offset += size; -+ } -+ -+ /* Locals */ -+ offsets = mono_allocate_stack_slots (cfg, FALSE, &locals_stack_size, &locals_stack_align); -+ if (locals_stack_align) -+ offset = ALIGN_TO (offset, locals_stack_align); -+ -+ for (i = cfg->locals_start; i < cfg->num_varinfo; i++) { -+ if (offsets [i] != -1) { -+ ins = cfg->varinfo [i]; -+ ins->opcode = OP_REGOFFSET; -+ ins->inst_basereg = cfg->frame_reg; -+ ins->inst_offset = offset + offsets [i]; -+ //printf ("allocated local %d to ", i); mono_print_tree_nl (ins); -+ } -+ } -+ offset += locals_stack_size; -+ -+ offset = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); -+ -+ cfg->stack_offset = offset; -+} -+ -+#ifdef ENABLE_LLVM -+LLVMCallInfo* -+mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) -+{ -+ int i, n; -+ CallInfo *cinfo; -+ ArgInfo *ainfo; -+ LLVMCallInfo *linfo; -+ -+ n = sig->param_count + sig->hasthis; -+ -+ cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, sig); -+ -+ linfo = mono_mempool_alloc0 (cfg->mempool, sizeof (LLVMCallInfo) + (sizeof (LLVMArgInfo) * n)); -+ -+ switch (cinfo->ret.storage) { -+ case ArgInIReg: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ case ArgNone: -+ break; -+ case ArgVtypeByRef: -+ linfo->ret.storage = LLVMArgVtypeByRef; -+ break; -+ // -+ // FIXME: This doesn't work yet since the llvm backend represents these types as an i8 -+ // array which is returned in int regs -+ // -+ case ArgHFA: -+ linfo->ret.storage = LLVMArgFpStruct; -+ linfo->ret.nslots = cinfo->ret.nregs; -+ linfo->ret.esize = cinfo->ret.esize; -+ break; -+ case ArgVtypeInIRegs: -+ /* LLVM models this by returning an int */ -+ linfo->ret.storage = LLVMArgVtypeAsScalar; -+ linfo->ret.nslots = cinfo->ret.nregs; -+ linfo->ret.esize = cinfo->ret.esize; -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ -+ for (i = 0; i < n; ++i) { -+ LLVMArgInfo *lainfo = &linfo->args [i]; -+ -+ ainfo = cinfo->args + i; -+ -+ lainfo->storage = LLVMArgNone; -+ -+ switch (ainfo->storage) { -+ case ArgInIReg: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ case ArgOnStack: -+ case ArgOnStackR4: -+ case ArgOnStackR8: -+ lainfo->storage = LLVMArgInIReg; -+ break; -+ case ArgVtypeByRef: -+ case ArgVtypeByRefOnStack: -+ lainfo->storage = LLVMArgVtypeByRef; -+ break; -+ case ArgHFA: { -+ int j; -+ -+ lainfo->storage = LLVMArgAsFpArgs; -+ lainfo->nslots = ainfo->nregs; -+ lainfo->esize = ainfo->esize; -+ for (j = 0; j < ainfo->nregs; ++j) -+ lainfo->pair_storage [j] = LLVMArgInFPReg; -+ break; -+ } -+ case ArgVtypeInIRegs: -+ lainfo->storage = LLVMArgAsIArgs; -+ lainfo->nslots = ainfo->nregs; -+ break; -+ case ArgVtypeOnStack: -+ if (ainfo->hfa) { -+ int j; -+ /* Same as above */ -+ lainfo->storage = LLVMArgAsFpArgs; -+ lainfo->nslots = ainfo->nregs; -+ lainfo->esize = ainfo->esize; -+ for (j = 0; j < ainfo->nregs; ++j) -+ lainfo->pair_storage [j] = LLVMArgInFPReg; -+ } else { -+ lainfo->storage = LLVMArgAsIArgs; -+ lainfo->nslots = ainfo->size / 8; -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ } -+ -+ return linfo; -+} -+#endif -+ -+static void -+add_outarg_reg (MonoCompile *cfg, MonoCallInst *call, ArgStorage storage, int reg, MonoInst *arg) -+{ -+ MonoInst *ins; -+ -+ switch (storage) { -+ case ArgInIReg: -+ MONO_INST_NEW (cfg, ins, OP_MOVE); -+ ins->dreg = mono_alloc_ireg_copy (cfg, arg->dreg); -+ ins->sreg1 = arg->dreg; -+ MONO_ADD_INS (cfg->cbb, ins); -+ mono_call_inst_add_outarg_reg (cfg, call, ins->dreg, reg, FALSE); -+ break; -+ case ArgInFReg: -+ MONO_INST_NEW (cfg, ins, OP_FMOVE); -+ ins->dreg = mono_alloc_freg (cfg); -+ ins->sreg1 = arg->dreg; -+ MONO_ADD_INS (cfg->cbb, ins); -+ mono_call_inst_add_outarg_reg (cfg, call, ins->dreg, reg, TRUE); -+ break; -+ case ArgInFRegR4: -+ if (COMPILE_LLVM (cfg)) -+ MONO_INST_NEW (cfg, ins, OP_FMOVE); -+ else if (cfg->r4fp) -+ MONO_INST_NEW (cfg, ins, OP_RMOVE); -+ else -+ MONO_INST_NEW (cfg, ins, OP_ARM_SETFREG_R4); -+ ins->dreg = mono_alloc_freg (cfg); -+ ins->sreg1 = arg->dreg; -+ MONO_ADD_INS (cfg->cbb, ins); -+ mono_call_inst_add_outarg_reg (cfg, call, ins->dreg, reg, TRUE); -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+} -+ -+static void -+emit_sig_cookie (MonoCompile *cfg, MonoCallInst *call, CallInfo *cinfo) -+{ -+ MonoMethodSignature *tmp_sig; -+ int sig_reg; -+ -+ if (call->tail_call) -+ NOT_IMPLEMENTED; -+ -+ g_assert (cinfo->sig_cookie.storage == ArgOnStack); -+ -+ /* -+ * mono_ArgIterator_Setup assumes the signature cookie is -+ * passed first and all the arguments which were before it are -+ * passed on the stack after the signature. So compensate by -+ * passing a different signature. -+ */ -+ tmp_sig = mono_metadata_signature_dup (call->signature); -+ tmp_sig->param_count -= call->signature->sentinelpos; -+ tmp_sig->sentinelpos = 0; -+ memcpy (tmp_sig->params, call->signature->params + call->signature->sentinelpos, tmp_sig->param_count * sizeof (MonoType*)); -+ -+ sig_reg = mono_alloc_ireg (cfg); -+ MONO_EMIT_NEW_SIGNATURECONST (cfg, sig_reg, tmp_sig); -+ -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, ARMREG_SP, cinfo->sig_cookie.offset, sig_reg); -+} -+ -+void -+mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call) -+{ -+ MonoMethodSignature *sig; -+ MonoInst *arg, *vtarg; -+ CallInfo *cinfo; -+ ArgInfo *ainfo; -+ int i; -+ -+ sig = call->signature; -+ -+ cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, sig); -+ -+ switch (cinfo->ret.storage) { -+ case ArgVtypeInIRegs: -+ case ArgHFA: -+ /* -+ * The vtype is returned in registers, save the return area address in a local, and save the vtype into -+ * the location pointed to by it after call in emit_move_return_value (). -+ */ -+ if (!cfg->arch.vret_addr_loc) { -+ cfg->arch.vret_addr_loc = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL); -+ /* Prevent it from being register allocated or optimized away */ -+ ((MonoInst*)cfg->arch.vret_addr_loc)->flags |= MONO_INST_VOLATILE; -+ } -+ -+ MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, ((MonoInst*)cfg->arch.vret_addr_loc)->dreg, call->vret_var->dreg); -+ break; -+ case ArgVtypeByRef: -+ /* Pass the vtype return address in R8 */ -+ MONO_INST_NEW (cfg, vtarg, OP_MOVE); -+ vtarg->sreg1 = call->vret_var->dreg; -+ vtarg->dreg = mono_alloc_preg (cfg); -+ MONO_ADD_INS (cfg->cbb, vtarg); -+ -+ mono_call_inst_add_outarg_reg (cfg, call, vtarg->dreg, cinfo->ret.reg, FALSE); -+ break; -+ default: -+ break; -+ } -+ -+ for (i = 0; i < cinfo->nargs; ++i) { -+ ainfo = cinfo->args + i; -+ arg = call->args [i]; -+ -+ if ((sig->call_convention == MONO_CALL_VARARG) && (i == sig->sentinelpos)) { -+ /* Emit the signature cookie just before the implicit arguments */ -+ emit_sig_cookie (cfg, call, cinfo); -+ } -+ -+ switch (ainfo->storage) { -+ case ArgInIReg: -+ case ArgInFReg: -+ case ArgInFRegR4: -+ add_outarg_reg (cfg, call, ainfo->storage, ainfo->reg, arg); -+ break; -+ case ArgOnStack: -+ switch (ainfo->slot_size) { -+ case 8: -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, ARMREG_SP, ainfo->offset, arg->dreg); -+ break; -+ case 4: -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI4_MEMBASE_REG, ARMREG_SP, ainfo->offset, arg->dreg); -+ break; -+ case 2: -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI2_MEMBASE_REG, ARMREG_SP, ainfo->offset, arg->dreg); -+ break; -+ case 1: -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI1_MEMBASE_REG, ARMREG_SP, ainfo->offset, arg->dreg); -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ break; -+ case ArgOnStackR8: -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER8_MEMBASE_REG, ARMREG_SP, ainfo->offset, arg->dreg); -+ break; -+ case ArgOnStackR4: -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER4_MEMBASE_REG, ARMREG_SP, ainfo->offset, arg->dreg); -+ break; -+ case ArgVtypeInIRegs: -+ case ArgVtypeByRef: -+ case ArgVtypeByRefOnStack: -+ case ArgVtypeOnStack: -+ case ArgHFA: { -+ MonoInst *ins; -+ guint32 align; -+ guint32 size; -+ -+ size = mono_class_value_size (arg->klass, &align); -+ -+ MONO_INST_NEW (cfg, ins, OP_OUTARG_VT); -+ ins->sreg1 = arg->dreg; -+ ins->klass = arg->klass; -+ ins->backend.size = size; -+ ins->inst_p0 = call; -+ ins->inst_p1 = mono_mempool_alloc (cfg->mempool, sizeof (ArgInfo)); -+ memcpy (ins->inst_p1, ainfo, sizeof (ArgInfo)); -+ MONO_ADD_INS (cfg->cbb, ins); -+ break; -+ } -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ } -+ -+ /* Handle the case where there are no implicit arguments */ -+ if (!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG) && (cinfo->nargs == sig->sentinelpos)) -+ emit_sig_cookie (cfg, call, cinfo); -+ -+ call->call_info = cinfo; -+ call->stack_usage = cinfo->stack_usage; -+} -+ -+void -+mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src) -+{ -+ MonoCallInst *call = (MonoCallInst*)ins->inst_p0; -+ ArgInfo *ainfo = ins->inst_p1; -+ MonoInst *load; -+ int i; -+ -+ if (ins->backend.size == 0 && !ainfo->gsharedvt) -+ return; -+ -+ switch (ainfo->storage) { -+ case ArgVtypeInIRegs: -+ for (i = 0; i < ainfo->nregs; ++i) { -+ // FIXME: Smaller sizes -+ MONO_INST_NEW (cfg, load, OP_LOADI8_MEMBASE); -+ load->dreg = mono_alloc_ireg (cfg); -+ load->inst_basereg = src->dreg; -+ load->inst_offset = i * sizeof(mgreg_t); -+ MONO_ADD_INS (cfg->cbb, load); -+ add_outarg_reg (cfg, call, ArgInIReg, ainfo->reg + i, load); -+ } -+ break; -+ case ArgHFA: -+ for (i = 0; i < ainfo->nregs; ++i) { -+ if (ainfo->esize == 4) -+ MONO_INST_NEW (cfg, load, OP_LOADR4_MEMBASE); -+ else -+ MONO_INST_NEW (cfg, load, OP_LOADR8_MEMBASE); -+ load->dreg = mono_alloc_freg (cfg); -+ load->inst_basereg = src->dreg; -+ load->inst_offset = ainfo->foffsets [i]; -+ MONO_ADD_INS (cfg->cbb, load); -+ add_outarg_reg (cfg, call, ainfo->esize == 4 ? ArgInFRegR4 : ArgInFReg, ainfo->reg + i, load); -+ } -+ break; -+ case ArgVtypeByRef: -+ case ArgVtypeByRefOnStack: { -+ MonoInst *vtaddr, *load, *arg; -+ -+ /* Pass the vtype address in a reg/on the stack */ -+ if (ainfo->gsharedvt) { -+ load = src; -+ } else { -+ /* Make a copy of the argument */ -+ vtaddr = mono_compile_create_var (cfg, &ins->klass->byval_arg, OP_LOCAL); -+ -+ MONO_INST_NEW (cfg, load, OP_LDADDR); -+ load->inst_p0 = vtaddr; -+ vtaddr->flags |= MONO_INST_INDIRECT; -+ load->type = STACK_MP; -+ load->klass = vtaddr->klass; -+ load->dreg = mono_alloc_ireg (cfg); -+ MONO_ADD_INS (cfg->cbb, load); -+ mini_emit_memcpy (cfg, load->dreg, 0, src->dreg, 0, ainfo->size, 8); -+ } -+ -+ if (ainfo->storage == ArgVtypeByRef) { -+ MONO_INST_NEW (cfg, arg, OP_MOVE); -+ arg->dreg = mono_alloc_preg (cfg); -+ arg->sreg1 = load->dreg; -+ MONO_ADD_INS (cfg->cbb, arg); -+ add_outarg_reg (cfg, call, ArgInIReg, ainfo->reg, arg); -+ } else { -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, ARMREG_SP, ainfo->offset, load->dreg); -+ } -+ break; -+ } -+ case ArgVtypeOnStack: -+ for (i = 0; i < ainfo->size / 8; ++i) { -+ MONO_INST_NEW (cfg, load, OP_LOADI8_MEMBASE); -+ load->dreg = mono_alloc_ireg (cfg); -+ load->inst_basereg = src->dreg; -+ load->inst_offset = i * 8; -+ MONO_ADD_INS (cfg->cbb, load); -+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI8_MEMBASE_REG, ARMREG_SP, ainfo->offset + (i * 8), load->dreg); -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+} -+ -+void -+mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val) -+{ -+ MonoMethodSignature *sig; -+ CallInfo *cinfo; -+ -+ sig = mono_method_signature (cfg->method); -+ if (!cfg->arch.cinfo) -+ cfg->arch.cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, sig); -+ cinfo = cfg->arch.cinfo; -+ -+ switch (cinfo->ret.storage) { -+ case ArgNone: -+ break; -+ case ArgInIReg: -+ MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, cfg->ret->dreg, val->dreg); -+ break; -+ case ArgInFReg: -+ MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, cfg->ret->dreg, val->dreg); -+ break; -+ case ArgInFRegR4: -+ if (COMPILE_LLVM (cfg)) -+ MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, cfg->ret->dreg, val->dreg); -+ else if (cfg->r4fp) -+ MONO_EMIT_NEW_UNALU (cfg, OP_RMOVE, cfg->ret->dreg, val->dreg); -+ else -+ MONO_EMIT_NEW_UNALU (cfg, OP_ARM_SETFREG_R4, cfg->ret->dreg, val->dreg); -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+} -+ -+gboolean -+mono_arch_tail_call_supported (MonoCompile *cfg, MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) -+{ -+ CallInfo *c1, *c2; -+ gboolean res; -+ -+ if (cfg->compile_aot && !cfg->full_aot) -+ /* OP_TAILCALL doesn't work with AOT */ -+ return FALSE; -+ -+ c1 = get_call_info (NULL, NULL, caller_sig); -+ c2 = get_call_info (NULL, NULL, callee_sig); -+ res = TRUE; -+ // FIXME: Relax these restrictions -+ if (c1->stack_usage != 0) -+ res = FALSE; -+ if (c1->stack_usage != c2->stack_usage) -+ res = FALSE; -+ if ((c1->ret.storage != ArgNone && c1->ret.storage != ArgInIReg) || c1->ret.storage != c2->ret.storage) -+ res = FALSE; -+ -+ g_free (c1); -+ g_free (c2); -+ -+ return res; -+} -+ -+gboolean -+mono_arch_is_inst_imm (gint64 imm) -+{ -+ return (imm >= -((gint64)1<<31) && imm <= (((gint64)1<<31)-1)); -+} -+ -+void* -+mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments) -+{ -+ NOT_IMPLEMENTED; -+ return NULL; -+} -+ -+void* -+mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments, gboolean preserve_argument_registers) -+{ -+ NOT_IMPLEMENTED; -+ return NULL; -+} -+ -+void -+mono_arch_peephole_pass_1 (MonoCompile *cfg, MonoBasicBlock *bb) -+{ -+ //NOT_IMPLEMENTED; -+} -+ -+void -+mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb) -+{ -+ //NOT_IMPLEMENTED; -+} -+ -+#define ADD_NEW_INS(cfg,dest,op) do { \ -+ MONO_INST_NEW ((cfg), (dest), (op)); \ -+ mono_bblock_insert_before_ins (bb, ins, (dest)); \ -+ } while (0) -+ -+void -+mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) -+{ -+ MonoInst *ins, *temp, *last_ins = NULL; -+ -+ MONO_BB_FOR_EACH_INS (bb, ins) { -+ switch (ins->opcode) { -+ case OP_SBB: -+ case OP_ISBB: -+ case OP_SUBCC: -+ case OP_ISUBCC: -+ if (ins->next && (ins->next->opcode == OP_COND_EXC_C || ins->next->opcode == OP_COND_EXC_IC)) -+ /* ARM sets the C flag to 1 if there was _no_ overflow */ -+ ins->next->opcode = OP_COND_EXC_NC; -+ break; -+ case OP_IDIV_IMM: -+ case OP_IREM_IMM: -+ case OP_IDIV_UN_IMM: -+ case OP_IREM_UN_IMM: -+ case OP_LREM_IMM: -+ mono_decompose_op_imm (cfg, bb, ins); -+ break; -+ case OP_LOCALLOC_IMM: -+ if (ins->inst_imm > 32) { -+ ADD_NEW_INS (cfg, temp, OP_ICONST); -+ temp->inst_c0 = ins->inst_imm; -+ temp->dreg = mono_alloc_ireg (cfg); -+ ins->sreg1 = temp->dreg; -+ ins->opcode = mono_op_imm_to_op (ins->opcode); -+ } -+ break; -+ case OP_ICOMPARE_IMM: -+ if (ins->inst_imm == 0 && ins->next && ins->next->opcode == OP_IBEQ) { -+ ins->next->opcode = OP_ARM64_CBZW; -+ ins->next->sreg1 = ins->sreg1; -+ NULLIFY_INS (ins); -+ } else if (ins->inst_imm == 0 && ins->next && ins->next->opcode == OP_IBNE_UN) { -+ ins->next->opcode = OP_ARM64_CBNZW; -+ ins->next->sreg1 = ins->sreg1; -+ NULLIFY_INS (ins); -+ } -+ break; -+ case OP_LCOMPARE_IMM: -+ case OP_COMPARE_IMM: -+ if (ins->inst_imm == 0 && ins->next && ins->next->opcode == OP_LBEQ) { -+ ins->next->opcode = OP_ARM64_CBZX; -+ ins->next->sreg1 = ins->sreg1; -+ NULLIFY_INS (ins); -+ } else if (ins->inst_imm == 0 && ins->next && ins->next->opcode == OP_LBNE_UN) { -+ ins->next->opcode = OP_ARM64_CBNZX; -+ ins->next->sreg1 = ins->sreg1; -+ NULLIFY_INS (ins); -+ } -+ break; -+ case OP_FCOMPARE: { -+ gboolean swap = FALSE; -+ int reg; -+ -+ if (!ins->next) { -+ /* Optimized away */ -+ NULLIFY_INS (ins); -+ break; -+ } -+ -+ /* -+ * FP compares with unordered operands set the flags -+ * to NZCV=0011, which matches some non-unordered compares -+ * as well, like LE, so have to swap the operands. -+ */ -+ switch (ins->next->opcode) { -+ case OP_FBLT: -+ ins->next->opcode = OP_FBGT; -+ swap = TRUE; -+ break; -+ case OP_FBLE: -+ ins->next->opcode = OP_FBGE; -+ swap = TRUE; -+ break; -+ default: -+ break; -+ } -+ if (swap) { -+ reg = ins->sreg1; -+ ins->sreg1 = ins->sreg2; -+ ins->sreg2 = reg; -+ } -+ break; -+ } -+ default: -+ break; -+ } -+ -+ last_ins = ins; -+ } -+ bb->last_ins = last_ins; -+ bb->max_vreg = cfg->next_vreg; -+} -+ -+void -+mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *long_ins) -+{ -+} -+ -+static int -+opcode_to_armcond (int opcode) -+{ -+ switch (opcode) { -+ case OP_IBEQ: -+ case OP_LBEQ: -+ case OP_FBEQ: -+ case OP_CEQ: -+ case OP_ICEQ: -+ case OP_LCEQ: -+ case OP_FCEQ: -+ case OP_RCEQ: -+ case OP_COND_EXC_IEQ: -+ case OP_COND_EXC_EQ: -+ return ARMCOND_EQ; -+ case OP_IBGE: -+ case OP_LBGE: -+ case OP_FBGE: -+ case OP_ICGE: -+ case OP_FCGE: -+ case OP_RCGE: -+ return ARMCOND_GE; -+ case OP_IBGT: -+ case OP_LBGT: -+ case OP_FBGT: -+ case OP_CGT: -+ case OP_ICGT: -+ case OP_LCGT: -+ case OP_FCGT: -+ case OP_RCGT: -+ case OP_COND_EXC_IGT: -+ case OP_COND_EXC_GT: -+ return ARMCOND_GT; -+ case OP_IBLE: -+ case OP_LBLE: -+ case OP_FBLE: -+ case OP_ICLE: -+ case OP_FCLE: -+ case OP_RCLE: -+ return ARMCOND_LE; -+ case OP_IBLT: -+ case OP_LBLT: -+ case OP_FBLT: -+ case OP_CLT: -+ case OP_ICLT: -+ case OP_LCLT: -+ case OP_COND_EXC_ILT: -+ case OP_COND_EXC_LT: -+ return ARMCOND_LT; -+ case OP_IBNE_UN: -+ case OP_LBNE_UN: -+ case OP_FBNE_UN: -+ case OP_ICNEQ: -+ case OP_FCNEQ: -+ case OP_RCNEQ: -+ case OP_COND_EXC_INE_UN: -+ case OP_COND_EXC_NE_UN: -+ return ARMCOND_NE; -+ case OP_IBGE_UN: -+ case OP_LBGE_UN: -+ case OP_FBGE_UN: -+ case OP_ICGE_UN: -+ case OP_COND_EXC_IGE_UN: -+ case OP_COND_EXC_GE_UN: -+ return ARMCOND_HS; -+ case OP_IBGT_UN: -+ case OP_LBGT_UN: -+ case OP_FBGT_UN: -+ case OP_CGT_UN: -+ case OP_ICGT_UN: -+ case OP_LCGT_UN: -+ case OP_FCGT_UN: -+ case OP_RCGT_UN: -+ case OP_COND_EXC_IGT_UN: -+ case OP_COND_EXC_GT_UN: -+ return ARMCOND_HI; -+ case OP_IBLE_UN: -+ case OP_LBLE_UN: -+ case OP_FBLE_UN: -+ case OP_ICLE_UN: -+ case OP_COND_EXC_ILE_UN: -+ case OP_COND_EXC_LE_UN: -+ return ARMCOND_LS; -+ case OP_IBLT_UN: -+ case OP_LBLT_UN: -+ case OP_FBLT_UN: -+ case OP_CLT_UN: -+ case OP_ICLT_UN: -+ case OP_LCLT_UN: -+ case OP_COND_EXC_ILT_UN: -+ case OP_COND_EXC_LT_UN: -+ return ARMCOND_LO; -+ /* -+ * FCMP sets the NZCV condition bits as follows: -+ * eq = 0110 -+ * < = 1000 -+ * > = 0010 -+ * unordered = 0011 -+ * ARMCOND_LT is N!=V, so it matches unordered too, so -+ * fclt and fclt_un need to be special cased. -+ */ -+ case OP_FCLT: -+ case OP_RCLT: -+ /* N==1 */ -+ return ARMCOND_MI; -+ case OP_FCLT_UN: -+ case OP_RCLT_UN: -+ return ARMCOND_LT; -+ case OP_COND_EXC_C: -+ case OP_COND_EXC_IC: -+ return ARMCOND_CS; -+ case OP_COND_EXC_OV: -+ case OP_COND_EXC_IOV: -+ return ARMCOND_VS; -+ case OP_COND_EXC_NC: -+ case OP_COND_EXC_INC: -+ return ARMCOND_CC; -+ case OP_COND_EXC_NO: -+ case OP_COND_EXC_INO: -+ return ARMCOND_VC; -+ default: -+ printf ("%s\n", mono_inst_name (opcode)); -+ g_assert_not_reached (); -+ return -1; -+ } -+} -+ -+/* This clobbers LR */ -+static inline __attribute__((warn_unused_result)) guint8* -+emit_cond_exc (MonoCompile *cfg, guint8 *code, int opcode, const char *exc_name) -+{ -+ int cond; -+ -+ cond = opcode_to_armcond (opcode); -+ /* Capture PC */ -+ arm_adrx (code, ARMREG_IP1, code); -+ mono_add_patch_info_rel (cfg, code - cfg->native_code, MONO_PATCH_INFO_EXC, exc_name, MONO_R_ARM64_BCC); -+ arm_bcc (code, cond, 0); -+ return code; -+} -+ -+static guint8* -+emit_move_return_value (MonoCompile *cfg, guint8 * code, MonoInst *ins) -+{ -+ CallInfo *cinfo; -+ MonoCallInst *call; -+ -+ call = (MonoCallInst*)ins; -+ cinfo = call->call_info; -+ g_assert (cinfo); -+ switch (cinfo->ret.storage) { -+ case ArgNone: -+ break; -+ case ArgInIReg: -+ /* LLVM compiled code might only set the bottom bits */ -+ if (call->signature && mini_get_underlying_type (cfg, call->signature->ret)->type == MONO_TYPE_I4) -+ arm_sxtwx (code, call->inst.dreg, cinfo->ret.reg); -+ else if (call->inst.dreg != cinfo->ret.reg) -+ arm_movx (code, call->inst.dreg, cinfo->ret.reg); -+ break; -+ case ArgInFReg: -+ if (call->inst.dreg != cinfo->ret.reg) -+ arm_fmovd (code, call->inst.dreg, cinfo->ret.reg); -+ break; -+ case ArgInFRegR4: -+ if (cfg->r4fp) -+ arm_fmovs (code, call->inst.dreg, cinfo->ret.reg); -+ else -+ arm_fcvt_sd (code, call->inst.dreg, cinfo->ret.reg); -+ break; -+ case ArgVtypeInIRegs: { -+ MonoInst *loc = cfg->arch.vret_addr_loc; -+ int i; -+ -+ /* Load the destination address */ -+ g_assert (loc && loc->opcode == OP_REGOFFSET); -+ code = emit_ldrx (code, ARMREG_LR, loc->inst_basereg, loc->inst_offset); -+ for (i = 0; i < cinfo->ret.nregs; ++i) -+ arm_strx (code, cinfo->ret.reg + i, ARMREG_LR, i * 8); -+ break; -+ } -+ case ArgHFA: { -+ MonoInst *loc = cfg->arch.vret_addr_loc; -+ int i; -+ -+ /* Load the destination address */ -+ g_assert (loc && loc->opcode == OP_REGOFFSET); -+ code = emit_ldrx (code, ARMREG_LR, loc->inst_basereg, loc->inst_offset); -+ for (i = 0; i < cinfo->ret.nregs; ++i) { -+ if (cinfo->ret.esize == 4) -+ arm_strfpw (code, cinfo->ret.reg + i, ARMREG_LR, cinfo->ret.foffsets [i]); -+ else -+ arm_strfpx (code, cinfo->ret.reg + i, ARMREG_LR, cinfo->ret.foffsets [i]); -+ } -+ break; -+ } -+ case ArgVtypeByRef: -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ return code; -+} -+ -+/* -+ * emit_branch_island: -+ * -+ * Emit a branch island for the conditional branches from cfg->native_code + start_offset to code. -+ */ -+static guint8* -+emit_branch_island (MonoCompile *cfg, guint8 *code, int start_offset) -+{ -+ MonoJumpInfo *ji; -+ int offset, island_size; -+ -+ /* Iterate over the patch infos added so far by this bb */ -+ island_size = 0; -+ for (ji = cfg->patch_info; ji; ji = ji->next) { -+ if (ji->ip.i < start_offset) -+ /* The patch infos are in reverse order, so this means the end */ -+ break; -+ if (ji->relocation == MONO_R_ARM64_BCC || ji->relocation == MONO_R_ARM64_CBZ) -+ island_size += 4; -+ } -+ -+ if (island_size) { -+ offset = code - cfg->native_code; -+ if (offset > (cfg->code_size - island_size - 16)) { -+ cfg->code_size *= 2; -+ cfg->native_code = g_realloc (cfg->native_code, cfg->code_size); -+ code = cfg->native_code + offset; -+ } -+ -+ /* Branch over the island */ -+ arm_b (code, code + 4 + island_size); -+ -+ for (ji = cfg->patch_info; ji; ji = ji->next) { -+ if (ji->ip.i < start_offset) -+ break; -+ if (ji->relocation == MONO_R_ARM64_BCC || ji->relocation == MONO_R_ARM64_CBZ) { -+ /* Rewrite the cond branch so it branches to an uncoditional branch in the branch island */ -+ arm_patch_rel (cfg->native_code + ji->ip.i, code, ji->relocation); -+ /* Rewrite the patch so it points to the unconditional branch */ -+ ji->ip.i = code - cfg->native_code; -+ ji->relocation = MONO_R_ARM64_B; -+ arm_b (code, code); -+ } -+ } -+ } -+ return code; -+} -+ -+void -+mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) -+{ -+ MonoInst *ins; -+ MonoCallInst *call; -+ guint offset; -+ guint8 *code = cfg->native_code + cfg->code_len; -+ int start_offset, max_len, dreg, sreg1, sreg2; -+ mgreg_t imm; -+ -+ if (cfg->verbose_level > 2) -+ g_print ("Basic block %d starting at offset 0x%x\n", bb->block_num, bb->native_offset); -+ -+ start_offset = code - cfg->native_code; -+ -+ MONO_BB_FOR_EACH_INS (bb, ins) { -+ offset = code - cfg->native_code; -+ -+ max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN]; -+ -+ if (offset > (cfg->code_size - max_len - 16)) { -+ cfg->code_size *= 2; -+ cfg->native_code = g_realloc (cfg->native_code, cfg->code_size); -+ code = cfg->native_code + offset; -+ } -+ -+ if (G_UNLIKELY (cfg->arch.cond_branch_islands && offset - start_offset > 4 * 0x1ffff)) { -+ /* Emit a branch island for large basic blocks */ -+ code = emit_branch_island (cfg, code, start_offset); -+ offset = code - cfg->native_code; -+ start_offset = offset; -+ } -+ -+ mono_debug_record_line_number (cfg, ins, offset); -+ -+ dreg = ins->dreg; -+ sreg1 = ins->sreg1; -+ sreg2 = ins->sreg2; -+ imm = ins->inst_imm; -+ -+ switch (ins->opcode) { -+ case OP_ICONST: -+ code = emit_imm (code, dreg, ins->inst_c0); -+ break; -+ case OP_I8CONST: -+ code = emit_imm64 (code, dreg, ins->inst_c0); -+ break; -+ case OP_MOVE: -+ if (dreg != sreg1) -+ arm_movx (code, dreg, sreg1); -+ break; -+ case OP_NOP: -+ case OP_RELAXED_NOP: -+ break; -+ case OP_JUMP_TABLE: -+ mono_add_patch_info_rel (cfg, offset, (MonoJumpInfoType)ins->inst_i1, ins->inst_p0, MONO_R_ARM64_IMM); -+ code = emit_imm64_template (code, dreg); -+ break; -+ case OP_BREAK: -+ /* -+ * gdb does not like encountering the hw breakpoint ins in the debugged code. -+ * So instead of emitting a trap, we emit a call a C function and place a -+ * breakpoint there. -+ */ -+ code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD, (gpointer)"mono_break"); -+ break; -+ case OP_LOCALLOC: { -+ guint8 *buf [16]; -+ -+ arm_addx_imm (code, ARMREG_IP0, sreg1, (MONO_ARCH_FRAME_ALIGNMENT - 1)); -+ // FIXME: andx_imm doesn't work yet -+ code = emit_imm (code, ARMREG_IP1, -MONO_ARCH_FRAME_ALIGNMENT); -+ arm_andx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1); -+ //arm_andx_imm (code, ARMREG_IP0, sreg1, - MONO_ARCH_FRAME_ALIGNMENT); -+ arm_movspx (code, ARMREG_IP1, ARMREG_SP); -+ arm_subx (code, ARMREG_IP1, ARMREG_IP1, ARMREG_IP0); -+ arm_movspx (code, ARMREG_SP, ARMREG_IP1); -+ -+ /* Init */ -+ /* ip1 = pointer, ip0 = end */ -+ arm_addx (code, ARMREG_IP0, ARMREG_IP1, ARMREG_IP0); -+ buf [0] = code; -+ arm_cmpx (code, ARMREG_IP1, ARMREG_IP0); -+ buf [1] = code; -+ arm_bcc (code, ARMCOND_EQ, 0); -+ arm_stpx (code, ARMREG_RZR, ARMREG_RZR, ARMREG_IP1, 0); -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 16); -+ arm_b (code, buf [0]); -+ arm_patch_rel (buf [1], code, MONO_R_ARM64_BCC); -+ -+ arm_movspx (code, dreg, ARMREG_SP); -+ if (cfg->param_area) -+ code = emit_subx_sp_imm (code, cfg->param_area); -+ break; -+ } -+ case OP_LOCALLOC_IMM: { -+ int imm, offset; -+ -+ imm = ALIGN_TO (ins->inst_imm, MONO_ARCH_FRAME_ALIGNMENT); -+ g_assert (arm_is_arith_imm (imm)); -+ arm_subx_imm (code, ARMREG_SP, ARMREG_SP, imm); -+ -+ /* Init */ -+ g_assert (MONO_ARCH_FRAME_ALIGNMENT == 16); -+ offset = 0; -+ while (offset < imm) { -+ arm_stpx (code, ARMREG_RZR, ARMREG_RZR, ARMREG_SP, offset); -+ offset += 16; -+ } -+ arm_movspx (code, dreg, ARMREG_SP); -+ if (cfg->param_area) -+ code = emit_subx_sp_imm (code, cfg->param_area); -+ break; -+ } -+ case OP_AOTCONST: -+ code = emit_aotconst (cfg, code, dreg, (MonoJumpInfoType)ins->inst_i1, ins->inst_p0); -+ break; -+ case OP_OBJC_GET_SELECTOR: -+ mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_OBJC_SELECTOR_REF, ins->inst_p0); -+ /* See arch_emit_objc_selector_ref () in aot-compiler.c */ -+ arm_ldrx_lit (code, ins->dreg, 0); -+ arm_nop (code); -+ arm_nop (code); -+ break; -+ case OP_SEQ_POINT: { -+ MonoInst *info_var = cfg->arch.seq_point_info_var; -+ -+ /* -+ * For AOT, we use one got slot per method, which will point to a -+ * SeqPointInfo structure, containing all the information required -+ * by the code below. -+ */ -+ if (cfg->compile_aot) { -+ g_assert (info_var); -+ g_assert (info_var->opcode == OP_REGOFFSET); -+ } -+ -+ if (ins->flags & MONO_INST_SINGLE_STEP_LOC) { -+ MonoInst *var = cfg->arch.ss_tramp_var; -+ -+ g_assert (var); -+ g_assert (var->opcode == OP_REGOFFSET); -+ /* Load ss_tramp_var */ -+ /* This is equal to &ss_trampoline */ -+ arm_ldrx (code, ARMREG_IP1, var->inst_basereg, var->inst_offset); -+ /* Load the trampoline address */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_IP1, 0); -+ /* Call it if it is non-null */ -+ arm_cbzx (code, ARMREG_IP1, code + 8); -+ arm_blrx (code, ARMREG_IP1); -+ } -+ -+ mono_add_seq_point (cfg, bb, ins, code - cfg->native_code); -+ -+ if (cfg->compile_aot) { -+ guint32 offset = code - cfg->native_code; -+ guint32 val; -+ -+ arm_ldrx (code, ARMREG_IP1, info_var->inst_basereg, info_var->inst_offset); -+ /* Add the offset */ -+ val = ((offset / 4) * sizeof (guint8*)) + MONO_STRUCT_OFFSET (SeqPointInfo, bp_addrs); -+ /* Load the info->bp_addrs [offset], which is either 0 or the address of the bp trampoline */ -+ code = emit_ldrx (code, ARMREG_IP1, ARMREG_IP1, val); -+ /* Skip the load if its 0 */ -+ arm_cbzx (code, ARMREG_IP1, code + 8); -+ /* Call the breakpoint trampoline */ -+ arm_blrx (code, ARMREG_IP1); -+ } else { -+ MonoInst *var = cfg->arch.bp_tramp_var; -+ -+ g_assert (var); -+ g_assert (var->opcode == OP_REGOFFSET); -+ /* Load the address of the bp trampoline into IP0 */ -+ arm_ldrx (code, ARMREG_IP0, var->inst_basereg, var->inst_offset); -+ /* -+ * A placeholder for a possible breakpoint inserted by -+ * mono_arch_set_breakpoint (). -+ */ -+ arm_nop (code); -+ } -+ break; -+ } -+ -+ /* BRANCH */ -+ case OP_BR: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_target_bb, MONO_R_ARM64_B); -+ arm_b (code, code); -+ break; -+ case OP_BR_REG: -+ arm_brx (code, sreg1); -+ break; -+ case OP_IBEQ: -+ case OP_IBGE: -+ case OP_IBGT: -+ case OP_IBLE: -+ case OP_IBLT: -+ case OP_IBNE_UN: -+ case OP_IBGE_UN: -+ case OP_IBGT_UN: -+ case OP_IBLE_UN: -+ case OP_IBLT_UN: -+ case OP_LBEQ: -+ case OP_LBGE: -+ case OP_LBGT: -+ case OP_LBLE: -+ case OP_LBLT: -+ case OP_LBNE_UN: -+ case OP_LBGE_UN: -+ case OP_LBGT_UN: -+ case OP_LBLE_UN: -+ case OP_LBLT_UN: -+ case OP_FBEQ: -+ case OP_FBNE_UN: -+ case OP_FBLT: -+ case OP_FBGT: -+ case OP_FBGT_UN: -+ case OP_FBLE: -+ case OP_FBGE: -+ case OP_FBGE_UN: { -+ int cond; -+ -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_BCC); -+ cond = opcode_to_armcond (ins->opcode); -+ arm_bcc (code, cond, 0); -+ break; -+ } -+ case OP_FBLT_UN: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_BCC); -+ /* For fp compares, ARMCOND_LT is lt or unordered */ -+ arm_bcc (code, ARMCOND_LT, 0); -+ break; -+ case OP_FBLE_UN: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_BCC); -+ arm_bcc (code, ARMCOND_EQ, 0); -+ offset = code - cfg->native_code; -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_BCC); -+ /* For fp compares, ARMCOND_LT is lt or unordered */ -+ arm_bcc (code, ARMCOND_LT, 0); -+ break; -+ case OP_ARM64_CBZW: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_CBZ); -+ arm_cbzw (code, sreg1, 0); -+ break; -+ case OP_ARM64_CBZX: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_CBZ); -+ arm_cbzx (code, sreg1, 0); -+ break; -+ case OP_ARM64_CBNZW: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_CBZ); -+ arm_cbnzw (code, sreg1, 0); -+ break; -+ case OP_ARM64_CBNZX: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_true_bb, MONO_R_ARM64_CBZ); -+ arm_cbnzx (code, sreg1, 0); -+ break; -+ /* ALU */ -+ case OP_IADD: -+ arm_addw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LADD: -+ arm_addx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ISUB: -+ arm_subw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LSUB: -+ arm_subx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_IAND: -+ arm_andw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LAND: -+ arm_andx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_IOR: -+ arm_orrw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LOR: -+ arm_orrx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_IXOR: -+ arm_eorw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LXOR: -+ arm_eorx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_INEG: -+ arm_negw (code, dreg, sreg1); -+ break; -+ case OP_LNEG: -+ arm_negx (code, dreg, sreg1); -+ break; -+ case OP_INOT: -+ arm_mvnw (code, dreg, sreg1); -+ break; -+ case OP_LNOT: -+ arm_mvnx (code, dreg, sreg1); -+ break; -+ case OP_IADDCC: -+ arm_addsw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ADDCC: -+ case OP_LADDCC: -+ arm_addsx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ISUBCC: -+ arm_subsw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LSUBCC: -+ case OP_SUBCC: -+ arm_subsx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ICOMPARE: -+ arm_cmpw (code, sreg1, sreg2); -+ break; -+ case OP_COMPARE: -+ case OP_LCOMPARE: -+ arm_cmpx (code, sreg1, sreg2); -+ break; -+ case OP_IADD_IMM: -+ code = emit_addw_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_LADD_IMM: -+ case OP_ADD_IMM: -+ code = emit_addx_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_ISUB_IMM: -+ code = emit_subw_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_LSUB_IMM: -+ code = emit_subx_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_IAND_IMM: -+ code = emit_andw_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_LAND_IMM: -+ case OP_AND_IMM: -+ code = emit_andx_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_IOR_IMM: -+ code = emit_orrw_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_LOR_IMM: -+ code = emit_orrx_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_IXOR_IMM: -+ code = emit_eorw_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_LXOR_IMM: -+ code = emit_eorx_imm (code, dreg, sreg1, imm); -+ break; -+ case OP_ICOMPARE_IMM: -+ code = emit_cmpw_imm (code, sreg1, imm); -+ break; -+ case OP_LCOMPARE_IMM: -+ case OP_COMPARE_IMM: -+ if (imm == 0) { -+ arm_cmpx (code, sreg1, ARMREG_RZR); -+ } else { -+ // FIXME: 32 vs 64 bit issues for 0xffffffff -+ code = emit_imm64 (code, ARMREG_LR, imm); -+ arm_cmpx (code, sreg1, ARMREG_LR); -+ } -+ break; -+ case OP_ISHL: -+ arm_lslvw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LSHL: -+ arm_lslvx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ISHR: -+ arm_asrvw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LSHR: -+ arm_asrvx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ISHR_UN: -+ arm_lsrvw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LSHR_UN: -+ arm_lsrvx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_ISHL_IMM: -+ if (imm == 0) -+ arm_movx (code, dreg, sreg1); -+ else -+ arm_lslw (code, dreg, sreg1, imm); -+ break; -+ case OP_LSHL_IMM: -+ if (imm == 0) -+ arm_movx (code, dreg, sreg1); -+ else -+ arm_lslx (code, dreg, sreg1, imm); -+ break; -+ case OP_ISHR_IMM: -+ if (imm == 0) -+ arm_movx (code, dreg, sreg1); -+ else -+ arm_asrw (code, dreg, sreg1, imm); -+ break; -+ case OP_LSHR_IMM: -+ case OP_SHR_IMM: -+ if (imm == 0) -+ arm_movx (code, dreg, sreg1); -+ else -+ arm_asrx (code, dreg, sreg1, imm); -+ break; -+ case OP_ISHR_UN_IMM: -+ if (imm == 0) -+ arm_movx (code, dreg, sreg1); -+ else -+ arm_lsrw (code, dreg, sreg1, imm); -+ break; -+ case OP_SHR_UN_IMM: -+ case OP_LSHR_UN_IMM: -+ if (imm == 0) -+ arm_movx (code, dreg, sreg1); -+ else -+ arm_lsrx (code, dreg, sreg1, imm); -+ break; -+ -+ /* 64BIT ALU */ -+ case OP_SEXT_I4: -+ arm_sxtwx (code, dreg, sreg1); -+ break; -+ case OP_ZEXT_I4: -+ /* Clean out the upper word */ -+ arm_movw (code, dreg, sreg1); -+ break; -+ case OP_SHL_IMM: -+ arm_lslx (code, dreg, sreg1, imm); -+ break; -+ -+ /* MULTIPLY/DIVISION */ -+ case OP_IDIV: -+ case OP_IREM: -+ // FIXME: Optimize this -+ /* Check for zero */ -+ arm_cmpx_imm (code, sreg2, 0); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "DivideByZeroException"); -+ /* Check for INT_MIN/-1 */ -+ code = emit_imm (code, ARMREG_IP0, 0x80000000); -+ arm_cmpx (code, sreg1, ARMREG_IP0); -+ arm_cset (code, ARMCOND_EQ, ARMREG_IP1); -+ code = emit_imm (code, ARMREG_IP0, 0xffffffff); -+ arm_cmpx (code, sreg2, ARMREG_IP0); -+ arm_cset (code, ARMCOND_EQ, ARMREG_IP0); -+ arm_andx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1); -+ arm_cmpx_imm (code, ARMREG_IP0, 1); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "OverflowException"); -+ if (ins->opcode == OP_IREM) { -+ arm_sdivw (code, ARMREG_LR, sreg1, sreg2); -+ arm_msubw (code, dreg, ARMREG_LR, sreg2, sreg1); -+ } else { -+ arm_sdivw (code, dreg, sreg1, sreg2); -+ } -+ break; -+ case OP_IDIV_UN: -+ arm_cmpx_imm (code, sreg2, 0); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "DivideByZeroException"); -+ arm_udivw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_IREM_UN: -+ arm_cmpx_imm (code, sreg2, 0); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "DivideByZeroException"); -+ arm_udivw (code, ARMREG_LR, sreg1, sreg2); -+ arm_msubw (code, dreg, ARMREG_LR, sreg2, sreg1); -+ break; -+ case OP_LDIV: -+ case OP_LREM: -+ // FIXME: Optimize this -+ /* Check for zero */ -+ arm_cmpx_imm (code, sreg2, 0); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "DivideByZeroException"); -+ /* Check for INT64_MIN/-1 */ -+ code = emit_imm64 (code, ARMREG_IP0, 0x8000000000000000); -+ arm_cmpx (code, sreg1, ARMREG_IP0); -+ arm_cset (code, ARMCOND_EQ, ARMREG_IP1); -+ code = emit_imm64 (code, ARMREG_IP0, 0xffffffffffffffff); -+ arm_cmpx (code, sreg2, ARMREG_IP0); -+ arm_cset (code, ARMCOND_EQ, ARMREG_IP0); -+ arm_andx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1); -+ arm_cmpx_imm (code, ARMREG_IP0, 1); -+ /* 64 bit uses ArithmeticException */ -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "ArithmeticException"); -+ if (ins->opcode == OP_LREM) { -+ arm_sdivx (code, ARMREG_LR, sreg1, sreg2); -+ arm_msubx (code, dreg, ARMREG_LR, sreg2, sreg1); -+ } else { -+ arm_sdivx (code, dreg, sreg1, sreg2); -+ } -+ break; -+ case OP_LDIV_UN: -+ arm_cmpx_imm (code, sreg2, 0); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "DivideByZeroException"); -+ arm_udivx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LREM_UN: -+ arm_cmpx_imm (code, sreg2, 0); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_IEQ, "DivideByZeroException"); -+ arm_udivx (code, ARMREG_LR, sreg1, sreg2); -+ arm_msubx (code, dreg, ARMREG_LR, sreg2, sreg1); -+ break; -+ case OP_IMUL: -+ arm_mulw (code, dreg, sreg1, sreg2); -+ break; -+ case OP_LMUL: -+ arm_mulx (code, dreg, sreg1, sreg2); -+ break; -+ case OP_IMUL_IMM: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_mulw (code, dreg, sreg1, ARMREG_LR); -+ break; -+ case OP_MUL_IMM: -+ case OP_LMUL_IMM: -+ code = emit_imm (code, ARMREG_LR, imm); -+ arm_mulx (code, dreg, sreg1, ARMREG_LR); -+ break; -+ -+ /* CONVERSIONS */ -+ case OP_ICONV_TO_I1: -+ case OP_LCONV_TO_I1: -+ arm_sxtbx (code, dreg, sreg1); -+ break; -+ case OP_ICONV_TO_I2: -+ case OP_LCONV_TO_I2: -+ arm_sxthx (code, dreg, sreg1); -+ break; -+ case OP_ICONV_TO_U1: -+ case OP_LCONV_TO_U1: -+ arm_uxtbw (code, dreg, sreg1); -+ break; -+ case OP_ICONV_TO_U2: -+ case OP_LCONV_TO_U2: -+ arm_uxthw (code, dreg, sreg1); -+ break; -+ -+ /* CSET */ -+ case OP_CEQ: -+ case OP_ICEQ: -+ case OP_LCEQ: -+ case OP_CLT: -+ case OP_ICLT: -+ case OP_LCLT: -+ case OP_CGT: -+ case OP_ICGT: -+ case OP_LCGT: -+ case OP_CLT_UN: -+ case OP_ICLT_UN: -+ case OP_LCLT_UN: -+ case OP_CGT_UN: -+ case OP_ICGT_UN: -+ case OP_LCGT_UN: -+ case OP_ICNEQ: -+ case OP_ICGE: -+ case OP_ICLE: -+ case OP_ICGE_UN: -+ case OP_ICLE_UN: { -+ int cond; -+ -+ cond = opcode_to_armcond (ins->opcode); -+ arm_cset (code, cond, dreg); -+ break; -+ } -+ case OP_FCEQ: -+ case OP_FCLT: -+ case OP_FCLT_UN: -+ case OP_FCGT: -+ case OP_FCGT_UN: -+ case OP_FCNEQ: -+ case OP_FCLE: -+ case OP_FCGE: { -+ int cond; -+ -+ cond = opcode_to_armcond (ins->opcode); -+ arm_fcmpd (code, sreg1, sreg2); -+ arm_cset (code, cond, dreg); -+ break; -+ } -+ -+ /* MEMORY */ -+ case OP_LOADI1_MEMBASE: -+ code = emit_ldrsbx (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOADU1_MEMBASE: -+ code = emit_ldrb (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOADI2_MEMBASE: -+ code = emit_ldrshx (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOADU2_MEMBASE: -+ code = emit_ldrh (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOADI4_MEMBASE: -+ code = emit_ldrswx (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOADU4_MEMBASE: -+ code = emit_ldrw (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOAD_MEMBASE: -+ case OP_LOADI8_MEMBASE: -+ code = emit_ldrx (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_STOREI1_MEMBASE_IMM: -+ case OP_STOREI2_MEMBASE_IMM: -+ case OP_STOREI4_MEMBASE_IMM: -+ case OP_STORE_MEMBASE_IMM: -+ case OP_STOREI8_MEMBASE_IMM: { -+ int immreg; -+ -+ if (imm != 0) { -+ code = emit_imm (code, ARMREG_LR, imm); -+ immreg = ARMREG_LR; -+ } else { -+ immreg = ARMREG_RZR; -+ } -+ -+ switch (ins->opcode) { -+ case OP_STOREI1_MEMBASE_IMM: -+ code = emit_strb (code, immreg, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STOREI2_MEMBASE_IMM: -+ code = emit_strh (code, immreg, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STOREI4_MEMBASE_IMM: -+ code = emit_strw (code, immreg, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STORE_MEMBASE_IMM: -+ case OP_STOREI8_MEMBASE_IMM: -+ code = emit_strx (code, immreg, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ break; -+ } -+ case OP_STOREI1_MEMBASE_REG: -+ code = emit_strb (code, sreg1, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STOREI2_MEMBASE_REG: -+ code = emit_strh (code, sreg1, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STOREI4_MEMBASE_REG: -+ code = emit_strw (code, sreg1, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STORE_MEMBASE_REG: -+ case OP_STOREI8_MEMBASE_REG: -+ code = emit_strx (code, sreg1, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ -+ case OP_TLS_GET: -+ code = emit_tls_get (code, dreg, ins->inst_offset); -+ break; -+ case OP_TLS_GET_REG: -+ code = emit_tls_get_reg (code, dreg, sreg1); -+ break; -+ case OP_TLS_SET: -+ code = emit_tls_set (code, sreg1, ins->inst_offset); -+ break; -+ case OP_TLS_SET_REG: -+ code = emit_tls_set_reg (code, sreg1, sreg2); -+ break; -+ -+ /* Atomic */ -+ case OP_MEMORY_BARRIER: -+ arm_dmb (code, 0); -+ break; -+ case OP_ATOMIC_ADD_I4: { -+ guint8 *buf [16]; -+ -+ buf [0] = code; -+ arm_ldaxrw (code, ARMREG_IP0, sreg1); -+ arm_addx (code, ARMREG_IP0, ARMREG_IP0, sreg2); -+ arm_stlxrw (code, ARMREG_IP1, ARMREG_IP0, sreg1); -+ arm_cbnzw (code, ARMREG_IP1, buf [0]); -+ -+ arm_movx (code, dreg, ARMREG_IP0); -+ break; -+ } -+ case OP_ATOMIC_ADD_I8: { -+ guint8 *buf [16]; -+ -+ buf [0] = code; -+ arm_ldaxrx (code, ARMREG_IP0, sreg1); -+ arm_addx (code, ARMREG_IP0, ARMREG_IP0, sreg2); -+ arm_stlxrx (code, ARMREG_IP1, ARMREG_IP0, sreg1); -+ arm_cbnzx (code, ARMREG_IP1, buf [0]); -+ -+ arm_movx (code, dreg, ARMREG_IP0); -+ break; -+ } -+ case OP_ATOMIC_EXCHANGE_I4: { -+ guint8 *buf [16]; -+ -+ buf [0] = code; -+ arm_ldaxrw (code, ARMREG_IP0, sreg1); -+ arm_stlxrw (code, ARMREG_IP1, sreg2, sreg1); -+ arm_cbnzw (code, ARMREG_IP1, buf [0]); -+ -+ arm_movx (code, dreg, ARMREG_IP0); -+ break; -+ } -+ case OP_ATOMIC_EXCHANGE_I8: { -+ guint8 *buf [16]; -+ -+ buf [0] = code; -+ arm_ldaxrx (code, ARMREG_IP0, sreg1); -+ arm_stlxrx (code, ARMREG_IP1, sreg2, sreg1); -+ arm_cbnzw (code, ARMREG_IP1, buf [0]); -+ -+ arm_movx (code, dreg, ARMREG_IP0); -+ break; -+ } -+ case OP_ATOMIC_CAS_I4: { -+ guint8 *buf [16]; -+ -+ /* sreg2 is the value, sreg3 is the comparand */ -+ buf [0] = code; -+ arm_ldaxrw (code, ARMREG_IP0, sreg1); -+ arm_cmpw (code, ARMREG_IP0, ins->sreg3); -+ buf [1] = code; -+ arm_bcc (code, ARMCOND_NE, 0); -+ arm_stlxrw (code, ARMREG_IP1, sreg2, sreg1); -+ arm_cbnzw (code, ARMREG_IP1, buf [0]); -+ arm_patch_rel (buf [1], code, MONO_R_ARM64_BCC); -+ -+ arm_movx (code, dreg, ARMREG_IP0); -+ break; -+ } -+ case OP_ATOMIC_CAS_I8: { -+ guint8 *buf [16]; -+ -+ buf [0] = code; -+ arm_ldaxrx (code, ARMREG_IP0, sreg1); -+ arm_cmpx (code, ARMREG_IP0, ins->sreg3); -+ buf [1] = code; -+ arm_bcc (code, ARMCOND_NE, 0); -+ arm_stlxrx (code, ARMREG_IP1, sreg2, sreg1); -+ arm_cbnzw (code, ARMREG_IP1, buf [0]); -+ arm_patch_rel (buf [1], code, MONO_R_ARM64_BCC); -+ -+ arm_movx (code, dreg, ARMREG_IP0); -+ break; -+ } -+ case OP_ATOMIC_LOAD_I1: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarb (code, ins->dreg, ARMREG_LR); -+ arm_sxtbx (code, ins->dreg, ins->dreg); -+ break; -+ } -+ case OP_ATOMIC_LOAD_U1: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarb (code, ins->dreg, ARMREG_LR); -+ arm_uxtbx (code, ins->dreg, ins->dreg); -+ break; -+ } -+ case OP_ATOMIC_LOAD_I2: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarh (code, ins->dreg, ARMREG_LR); -+ arm_sxthx (code, ins->dreg, ins->dreg); -+ break; -+ } -+ case OP_ATOMIC_LOAD_U2: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarh (code, ins->dreg, ARMREG_LR); -+ arm_uxthx (code, ins->dreg, ins->dreg); -+ break; -+ } -+ case OP_ATOMIC_LOAD_I4: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarw (code, ins->dreg, ARMREG_LR); -+ arm_sxtwx (code, ins->dreg, ins->dreg); -+ break; -+ } -+ case OP_ATOMIC_LOAD_U4: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarw (code, ins->dreg, ARMREG_LR); -+ arm_movw (code, ins->dreg, ins->dreg); /* Clear upper half of the register. */ -+ break; -+ } -+ case OP_ATOMIC_LOAD_I8: -+ case OP_ATOMIC_LOAD_U8: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarx (code, ins->dreg, ARMREG_LR); -+ break; -+ } -+ case OP_ATOMIC_LOAD_R4: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ if (cfg->r4fp) { -+ arm_ldarw (code, ARMREG_LR, ARMREG_LR); -+ arm_fmov_rx_to_double (code, ins->dreg, ARMREG_LR); -+ } else { -+ arm_ldarw (code, ARMREG_LR, ARMREG_LR); -+ arm_fmov_rx_to_double (code, FP_TEMP_REG, ARMREG_LR); -+ arm_fcvt_sd (code, ins->dreg, FP_TEMP_REG); -+ } -+ break; -+ } -+ case OP_ATOMIC_LOAD_R8: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_basereg, ins->inst_offset); -+ arm_ldarx (code, ARMREG_LR, ARMREG_LR); -+ arm_fmov_rx_to_double (code, ins->dreg, ARMREG_LR); -+ break; -+ } -+ case OP_ATOMIC_STORE_I1: -+ case OP_ATOMIC_STORE_U1: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset); -+ arm_stlrb (code, ARMREG_LR, ins->sreg1); -+ break; -+ } -+ case OP_ATOMIC_STORE_I2: -+ case OP_ATOMIC_STORE_U2: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset); -+ arm_stlrh (code, ARMREG_LR, ins->sreg1); -+ break; -+ } -+ case OP_ATOMIC_STORE_I4: -+ case OP_ATOMIC_STORE_U4: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset); -+ arm_stlrw (code, ARMREG_LR, ins->sreg1); -+ break; -+ } -+ case OP_ATOMIC_STORE_I8: -+ case OP_ATOMIC_STORE_U8: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset); -+ arm_stlrx (code, ARMREG_LR, ins->sreg1); -+ break; -+ } -+ case OP_ATOMIC_STORE_R4: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset); -+ if (cfg->r4fp) { -+ arm_fmov_double_to_rx (code, ARMREG_IP0, ins->sreg1); -+ arm_stlrw (code, ARMREG_LR, ARMREG_IP0); -+ } else { -+ arm_fcvt_ds (code, FP_TEMP_REG, ins->sreg1); -+ arm_fmov_double_to_rx (code, ARMREG_IP0, FP_TEMP_REG); -+ arm_stlrw (code, ARMREG_LR, ARMREG_IP0); -+ } -+ break; -+ } -+ case OP_ATOMIC_STORE_R8: { -+ code = emit_addx_imm (code, ARMREG_LR, ins->inst_destbasereg, ins->inst_offset); -+ arm_fmov_double_to_rx (code, ARMREG_IP0, ins->sreg1); -+ arm_stlrx (code, ARMREG_LR, ARMREG_IP0); -+ break; -+ } -+ -+ /* FP */ -+ case OP_R8CONST: { -+ guint64 imm = *(guint64*)ins->inst_p0; -+ -+ if (imm == 0) { -+ arm_fmov_rx_to_double (code, dreg, ARMREG_RZR); -+ } else { -+ code = emit_imm64 (code, ARMREG_LR, imm); -+ arm_fmov_rx_to_double (code, ins->dreg, ARMREG_LR); -+ } -+ break; -+ } -+ case OP_R4CONST: { -+ guint64 imm = *(guint32*)ins->inst_p0; -+ -+ code = emit_imm64 (code, ARMREG_LR, imm); -+ if (cfg->r4fp) { -+ arm_fmov_rx_to_double (code, dreg, ARMREG_LR); -+ } else { -+ arm_fmov_rx_to_double (code, FP_TEMP_REG, ARMREG_LR); -+ arm_fcvt_sd (code, dreg, FP_TEMP_REG); -+ } -+ break; -+ } -+ case OP_LOADR8_MEMBASE: -+ code = emit_ldrfpx (code, dreg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case OP_LOADR4_MEMBASE: -+ if (cfg->r4fp) { -+ code = emit_ldrfpw (code, dreg, ins->inst_basereg, ins->inst_offset); -+ } else { -+ code = emit_ldrfpw (code, FP_TEMP_REG, ins->inst_basereg, ins->inst_offset); -+ arm_fcvt_sd (code, dreg, FP_TEMP_REG); -+ } -+ break; -+ case OP_STORER8_MEMBASE_REG: -+ code = emit_strfpx (code, sreg1, ins->inst_destbasereg, ins->inst_offset); -+ break; -+ case OP_STORER4_MEMBASE_REG: -+ if (cfg->r4fp) { -+ code = emit_strfpw (code, sreg1, ins->inst_destbasereg, ins->inst_offset); -+ } else { -+ arm_fcvt_ds (code, FP_TEMP_REG, sreg1); -+ code = emit_strfpw (code, FP_TEMP_REG, ins->inst_destbasereg, ins->inst_offset); -+ } -+ break; -+ case OP_FMOVE: -+ if (dreg != sreg1) -+ arm_fmovd (code, dreg, sreg1); -+ break; -+ case OP_RMOVE: -+ if (dreg != sreg1) -+ arm_fmovs (code, dreg, sreg1); -+ break; -+ case OP_MOVE_F_TO_I4: -+ if (cfg->r4fp) { -+ arm_fmov_double_to_rx (code, ins->dreg, ins->sreg1); -+ } else { -+ arm_fcvt_ds (code, ins->dreg, ins->sreg1); -+ arm_fmov_double_to_rx (code, ins->dreg, ins->dreg); -+ } -+ break; -+ case OP_MOVE_I4_TO_F: -+ if (cfg->r4fp) { -+ arm_fmov_rx_to_double (code, ins->dreg, ins->sreg1); -+ } else { -+ arm_fmov_rx_to_double (code, ins->dreg, ins->sreg1); -+ arm_fcvt_sd (code, ins->dreg, ins->dreg); -+ } -+ break; -+ case OP_MOVE_F_TO_I8: -+ arm_fmov_double_to_rx (code, ins->dreg, ins->sreg1); -+ break; -+ case OP_MOVE_I8_TO_F: -+ arm_fmov_rx_to_double (code, ins->dreg, ins->sreg1); -+ break; -+ case OP_FCOMPARE: -+ arm_fcmpd (code, sreg1, sreg2); -+ break; -+ case OP_RCOMPARE: -+ arm_fcmps (code, sreg1, sreg2); -+ break; -+ case OP_FCONV_TO_I1: -+ arm_fcvtzs_dx (code, dreg, sreg1); -+ arm_sxtbx (code, dreg, dreg); -+ break; -+ case OP_FCONV_TO_U1: -+ arm_fcvtzu_dx (code, dreg, sreg1); -+ arm_uxtbw (code, dreg, dreg); -+ break; -+ case OP_FCONV_TO_I2: -+ arm_fcvtzs_dx (code, dreg, sreg1); -+ arm_sxthx (code, dreg, dreg); -+ break; -+ case OP_FCONV_TO_U2: -+ arm_fcvtzu_dx (code, dreg, sreg1); -+ arm_uxthw (code, dreg, dreg); -+ break; -+ case OP_FCONV_TO_I4: -+ arm_fcvtzs_dx (code, dreg, sreg1); -+ arm_sxtwx (code, dreg, dreg); -+ break; -+ case OP_FCONV_TO_U4: -+ arm_fcvtzu_dx (code, dreg, sreg1); -+ break; -+ case OP_FCONV_TO_I8: -+ arm_fcvtzs_dx (code, dreg, sreg1); -+ break; -+ case OP_FCONV_TO_U8: -+ arm_fcvtzu_dx (code, dreg, sreg1); -+ break; -+ case OP_FCONV_TO_R4: -+ if (cfg->r4fp) { -+ arm_fcvt_ds (code, dreg, sreg1); -+ } else { -+ arm_fcvt_ds (code, FP_TEMP_REG, sreg1); -+ arm_fcvt_sd (code, dreg, FP_TEMP_REG); -+ } -+ break; -+ case OP_ICONV_TO_R4: -+ if (cfg->r4fp) { -+ arm_scvtf_rw_to_s (code, dreg, sreg1); -+ } else { -+ arm_scvtf_rw_to_s (code, FP_TEMP_REG, sreg1); -+ arm_fcvt_sd (code, dreg, FP_TEMP_REG); -+ } -+ break; -+ case OP_LCONV_TO_R4: -+ if (cfg->r4fp) { -+ arm_scvtf_rx_to_s (code, dreg, sreg1); -+ } else { -+ arm_scvtf_rx_to_s (code, FP_TEMP_REG, sreg1); -+ arm_fcvt_sd (code, dreg, FP_TEMP_REG); -+ } -+ break; -+ case OP_ICONV_TO_R8: -+ arm_scvtf_rw_to_d (code, dreg, sreg1); -+ break; -+ case OP_LCONV_TO_R8: -+ arm_scvtf_rx_to_d (code, dreg, sreg1); -+ break; -+ case OP_ICONV_TO_R_UN: -+ arm_ucvtf_rw_to_d (code, dreg, sreg1); -+ break; -+ case OP_LCONV_TO_R_UN: -+ arm_ucvtf_rx_to_d (code, dreg, sreg1); -+ break; -+ case OP_FADD: -+ arm_fadd_d (code, dreg, sreg1, sreg2); -+ break; -+ case OP_FSUB: -+ arm_fsub_d (code, dreg, sreg1, sreg2); -+ break; -+ case OP_FMUL: -+ arm_fmul_d (code, dreg, sreg1, sreg2); -+ break; -+ case OP_FDIV: -+ arm_fdiv_d (code, dreg, sreg1, sreg2); -+ break; -+ case OP_FREM: -+ /* Emulated */ -+ g_assert_not_reached (); -+ break; -+ case OP_FNEG: -+ arm_fneg_d (code, dreg, sreg1); -+ break; -+ case OP_ARM_SETFREG_R4: -+ arm_fcvt_ds (code, dreg, sreg1); -+ break; -+ case OP_CKFINITE: -+ /* Check for infinity */ -+ code = emit_imm64 (code, ARMREG_LR, 0x7fefffffffffffffLL); -+ arm_fmov_rx_to_double (code, FP_TEMP_REG, ARMREG_LR); -+ arm_fabs_d (code, FP_TEMP_REG2, sreg1); -+ arm_fcmpd (code, FP_TEMP_REG2, FP_TEMP_REG); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_GT, "ArithmeticException"); -+ /* Check for nans */ -+ arm_fcmpd (code, FP_TEMP_REG2, FP_TEMP_REG2); -+ code = emit_cond_exc (cfg, code, OP_COND_EXC_OV, "ArithmeticException"); -+ arm_fmovd (code, dreg, sreg1); -+ break; -+ -+ /* R4 */ -+ case OP_RADD: -+ arm_fadd_s (code, dreg, sreg1, sreg2); -+ break; -+ case OP_RSUB: -+ arm_fsub_s (code, dreg, sreg1, sreg2); -+ break; -+ case OP_RMUL: -+ arm_fmul_s (code, dreg, sreg1, sreg2); -+ break; -+ case OP_RDIV: -+ arm_fdiv_s (code, dreg, sreg1, sreg2); -+ break; -+ case OP_RNEG: -+ arm_fneg_s (code, dreg, sreg1); -+ break; -+ case OP_RCONV_TO_I1: -+ arm_fcvtzs_sx (code, dreg, sreg1); -+ arm_sxtbx (code, dreg, dreg); -+ break; -+ case OP_RCONV_TO_U1: -+ arm_fcvtzu_sx (code, dreg, sreg1); -+ arm_uxtbw (code, dreg, dreg); -+ break; -+ case OP_RCONV_TO_I2: -+ arm_fcvtzs_sx (code, dreg, sreg1); -+ arm_sxthx (code, dreg, dreg); -+ break; -+ case OP_RCONV_TO_U2: -+ arm_fcvtzu_sx (code, dreg, sreg1); -+ arm_uxthw (code, dreg, dreg); -+ break; -+ case OP_RCONV_TO_I4: -+ arm_fcvtzs_sx (code, dreg, sreg1); -+ arm_sxtwx (code, dreg, dreg); -+ break; -+ case OP_RCONV_TO_U4: -+ arm_fcvtzu_sx (code, dreg, sreg1); -+ break; -+ case OP_RCONV_TO_I8: -+ arm_fcvtzs_sx (code, dreg, sreg1); -+ break; -+ case OP_RCONV_TO_U8: -+ arm_fcvtzu_sx (code, dreg, sreg1); -+ break; -+ case OP_RCONV_TO_R8: -+ arm_fcvt_sd (code, dreg, sreg1); -+ break; -+ case OP_RCONV_TO_R4: -+ if (dreg != sreg1) -+ arm_fmovs (code, dreg, sreg1); -+ break; -+ case OP_RCEQ: -+ case OP_RCLT: -+ case OP_RCLT_UN: -+ case OP_RCGT: -+ case OP_RCGT_UN: -+ case OP_RCNEQ: -+ case OP_RCLE: -+ case OP_RCGE: { -+ int cond; -+ -+ cond = opcode_to_armcond (ins->opcode); -+ arm_fcmps (code, sreg1, sreg2); -+ arm_cset (code, cond, dreg); -+ break; -+ } -+ -+ /* CALLS */ -+ case OP_VOIDCALL: -+ case OP_CALL: -+ case OP_LCALL: -+ case OP_FCALL: -+ case OP_RCALL: -+ case OP_VCALL2: -+ call = (MonoCallInst*)ins; -+ if (ins->flags & MONO_INST_HAS_METHOD) -+ code = emit_call (cfg, code, MONO_PATCH_INFO_METHOD, call->method); -+ else -+ code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, call->fptr); -+ code = emit_move_return_value (cfg, code, ins); -+ break; -+ case OP_VOIDCALL_REG: -+ case OP_CALL_REG: -+ case OP_LCALL_REG: -+ case OP_FCALL_REG: -+ case OP_RCALL_REG: -+ case OP_VCALL2_REG: -+ arm_blrx (code, sreg1); -+ code = emit_move_return_value (cfg, code, ins); -+ break; -+ case OP_VOIDCALL_MEMBASE: -+ case OP_CALL_MEMBASE: -+ case OP_LCALL_MEMBASE: -+ case OP_FCALL_MEMBASE: -+ case OP_RCALL_MEMBASE: -+ case OP_VCALL2_MEMBASE: -+ code = emit_ldrx (code, ARMREG_IP0, ins->inst_basereg, ins->inst_offset); -+ arm_blrx (code, ARMREG_IP0); -+ code = emit_move_return_value (cfg, code, ins); -+ break; -+ case OP_TAILCALL: { -+ MonoCallInst *call = (MonoCallInst*)ins; -+ -+ g_assert (!cfg->method->save_lmf); -+ -+ // FIXME: Copy stack arguments -+ -+ /* Restore registers */ -+ code = emit_load_regset (code, MONO_ARCH_CALLEE_SAVED_REGS & cfg->used_int_regs, ARMREG_FP, cfg->arch.saved_gregs_offset); -+ -+ /* Destroy frame */ -+ code = mono_arm_emit_destroy_frame (code, cfg->stack_offset, ((1 << ARMREG_IP0) | (1 << ARMREG_IP1))); -+ -+ if (cfg->compile_aot) { -+ /* This is not a PLT patch */ -+ code = emit_aotconst (cfg, code, ARMREG_IP0, MONO_PATCH_INFO_METHOD_JUMP, call->method); -+ arm_brx (code, ARMREG_IP0); -+ } else { -+ mono_add_patch_info_rel (cfg, code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, call->method, MONO_R_ARM64_B); -+ arm_b (code, code); -+ } -+ ins->flags |= MONO_INST_GC_CALLSITE; -+ ins->backend.pc_offset = code - cfg->native_code; -+ break; -+ } -+ case OP_ARGLIST: -+ g_assert (cfg->arch.cinfo); -+ code = emit_addx_imm (code, ARMREG_IP0, cfg->arch.args_reg, ((CallInfo*)cfg->arch.cinfo)->sig_cookie.offset); -+ arm_strx (code, ARMREG_IP0, sreg1, 0); -+ break; -+ case OP_DYN_CALL: { -+ MonoInst *var = cfg->dyn_call_var; -+ guint8 *labels [16]; -+ int i; -+ -+ /* -+ * sreg1 points to a DynCallArgs structure initialized by mono_arch_start_dyn_call (). -+ * sreg2 is the function to call. -+ */ -+ -+ g_assert (var->opcode == OP_REGOFFSET); -+ -+ arm_movx (code, ARMREG_LR, sreg1); -+ arm_movx (code, ARMREG_IP1, sreg2); -+ -+ /* Save args buffer */ -+ code = emit_strx (code, ARMREG_LR, var->inst_basereg, var->inst_offset); -+ -+ /* Set fp argument regs */ -+ code = emit_ldrw (code, ARMREG_R0, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, n_fpargs)); -+ arm_cmpw (code, ARMREG_R0, ARMREG_RZR); -+ labels [0] = code; -+ arm_bcc (code, ARMCOND_EQ, 0); -+ for (i = 0; i < 8; ++i) -+ code = emit_ldrfpx (code, ARMREG_D0 + i, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, fpregs) + (i * 8)); -+ arm_patch_rel (labels [0], code, MONO_R_ARM64_BCC); -+ -+ /* Set stack args */ -+ for (i = 0; i < DYN_CALL_STACK_ARGS; ++i) { -+ code = emit_ldrx (code, ARMREG_R0, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, regs) + ((PARAM_REGS + 1 + i) * sizeof (mgreg_t))); -+ code = emit_strx (code, ARMREG_R0, ARMREG_SP, i * sizeof (mgreg_t)); -+ } -+ -+ /* Set argument registers + r8 */ -+ code = mono_arm_emit_load_regarray (code, 0x1ff, ARMREG_LR, 0); -+ -+ /* Make the call */ -+ arm_blrx (code, ARMREG_IP1); -+ -+ /* Save result */ -+ code = emit_ldrx (code, ARMREG_LR, var->inst_basereg, var->inst_offset); -+ arm_strx (code, ARMREG_R0, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, res)); -+ arm_strx (code, ARMREG_R1, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, res2)); -+ /* Save fp result */ -+ code = emit_ldrw (code, ARMREG_R0, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, n_fpret)); -+ arm_cmpw (code, ARMREG_R0, ARMREG_RZR); -+ labels [1] = code; -+ arm_bcc (code, ARMCOND_EQ, 0); -+ for (i = 0; i < 8; ++i) -+ code = emit_strfpx (code, ARMREG_D0 + i, ARMREG_LR, MONO_STRUCT_OFFSET (DynCallArgs, fpregs) + (i * 8)); -+ arm_patch_rel (labels [1], code, MONO_R_ARM64_BCC); -+ break; -+ } -+ -+ case OP_GENERIC_CLASS_INIT: { -+ static int byte_offset = -1; -+ static guint8 bitmask; -+ guint8 *jump; -+ -+ if (byte_offset < 0) -+ mono_marshal_find_bitfield_offset (MonoVTable, initialized, &byte_offset, &bitmask); -+ -+ /* Load vtable->initialized */ -+ arm_ldrsbx (code, ARMREG_IP0, sreg1, byte_offset); -+ // FIXME: No andx_imm yet */ -+ code = mono_arm_emit_imm64 (code, ARMREG_IP1, bitmask); -+ arm_andx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1); -+ jump = code; -+ arm_cbnzx (code, ARMREG_IP0, 0); -+ -+ /* Slowpath */ -+ g_assert (sreg1 == ARMREG_R0); -+ -+ /* Call mono_generic_class_init_trampoline () */ -+ /* The vtable is still in R0, the generic trampoline code will pass it as the argument to the C function */ -+ code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD, -+ (gpointer)"specific_trampoline_generic_class_init"); -+ -+ mono_arm_patch (jump, code, MONO_R_ARM64_CBZ); -+ break; -+ } -+ -+ case OP_CHECK_THIS: -+ arm_ldrx (code, ARMREG_LR, sreg1, 0); -+ break; -+ case OP_NOT_NULL: -+ case OP_NOT_REACHED: -+ case OP_DUMMY_USE: -+ break; -+ case OP_IL_SEQ_POINT: -+ mono_add_seq_point (cfg, bb, ins, code - cfg->native_code); -+ break; -+ -+ /* EH */ -+ case OP_COND_EXC_C: -+ case OP_COND_EXC_IC: -+ case OP_COND_EXC_OV: -+ case OP_COND_EXC_IOV: -+ case OP_COND_EXC_NC: -+ case OP_COND_EXC_INC: -+ case OP_COND_EXC_NO: -+ case OP_COND_EXC_INO: -+ case OP_COND_EXC_EQ: -+ case OP_COND_EXC_IEQ: -+ case OP_COND_EXC_NE_UN: -+ case OP_COND_EXC_INE_UN: -+ case OP_COND_EXC_ILT: -+ case OP_COND_EXC_LT: -+ case OP_COND_EXC_ILT_UN: -+ case OP_COND_EXC_LT_UN: -+ case OP_COND_EXC_IGT: -+ case OP_COND_EXC_GT: -+ case OP_COND_EXC_IGT_UN: -+ case OP_COND_EXC_GT_UN: -+ case OP_COND_EXC_IGE: -+ case OP_COND_EXC_GE: -+ case OP_COND_EXC_IGE_UN: -+ case OP_COND_EXC_GE_UN: -+ case OP_COND_EXC_ILE: -+ case OP_COND_EXC_LE: -+ case OP_COND_EXC_ILE_UN: -+ case OP_COND_EXC_LE_UN: -+ code = emit_cond_exc (cfg, code, ins->opcode, ins->inst_p1); -+ break; -+ case OP_THROW: -+ if (sreg1 != ARMREG_R0) -+ arm_movx (code, ARMREG_R0, sreg1); -+ code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD, -+ (gpointer)"mono_arch_throw_exception"); -+ break; -+ case OP_RETHROW: -+ if (sreg1 != ARMREG_R0) -+ arm_movx (code, ARMREG_R0, sreg1); -+ code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD, -+ (gpointer)"mono_arch_rethrow_exception"); -+ break; -+ case OP_CALL_HANDLER: -+ mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_target_bb, MONO_R_ARM64_BL); -+ arm_bl (code, 0); -+ cfg->thunk_area += THUNK_SIZE; -+ break; -+ case OP_START_HANDLER: { -+ MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region); -+ -+ /* Save caller address */ -+ code = emit_strx (code, ARMREG_LR, spvar->inst_basereg, spvar->inst_offset); -+ -+ /* -+ * Reserve a param area, see test_0_finally_param_area (). -+ * This is needed because the param area is not set up when -+ * we are called from EH code. -+ */ -+ if (cfg->param_area) -+ code = emit_subx_sp_imm (code, cfg->param_area); -+ break; -+ } -+ case OP_ENDFINALLY: -+ case OP_ENDFILTER: { -+ MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region); -+ -+ if (cfg->param_area) -+ code = emit_addx_sp_imm (code, cfg->param_area); -+ -+ if (ins->opcode == OP_ENDFILTER && sreg1 != ARMREG_R0) -+ arm_movx (code, ARMREG_R0, sreg1); -+ -+ /* Return to either after the branch in OP_CALL_HANDLER, or to the EH code */ -+ code = emit_ldrx (code, ARMREG_LR, spvar->inst_basereg, spvar->inst_offset); -+ arm_brx (code, ARMREG_LR); -+ break; -+ } -+ case OP_GET_EX_OBJ: -+ if (ins->dreg != ARMREG_R0) -+ arm_movx (code, ins->dreg, ARMREG_R0); -+ break; -+ -+ default: -+ g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__); -+ g_assert_not_reached (); -+ } -+ -+ if ((cfg->opt & MONO_OPT_BRANCH) && ((code - cfg->native_code - offset) > max_len)) { -+ g_warning ("wrong maximal instruction length of instruction %s (expected %d, got %d)", -+ mono_inst_name (ins->opcode), max_len, code - cfg->native_code - offset); -+ g_assert_not_reached (); -+ } -+ } -+ -+ /* -+ * If the compiled code size is larger than the bcc displacement (19 bits signed), -+ * insert branch islands between/inside basic blocks. -+ */ -+ if (cfg->arch.cond_branch_islands) -+ code = emit_branch_island (cfg, code, start_offset); -+ -+ cfg->code_len = code - cfg->native_code; -+} -+ -+static guint8* -+emit_move_args (MonoCompile *cfg, guint8 *code) -+{ -+ MonoInst *ins; -+ CallInfo *cinfo; -+ ArgInfo *ainfo; -+ int i, part; -+ -+ cinfo = cfg->arch.cinfo; -+ g_assert (cinfo); -+ for (i = 0; i < cinfo->nargs; ++i) { -+ ainfo = cinfo->args + i; -+ ins = cfg->args [i]; -+ -+ if (ins->opcode == OP_REGVAR) { -+ switch (ainfo->storage) { -+ case ArgInIReg: -+ arm_movx (code, ins->dreg, ainfo->reg); -+ break; -+ case ArgOnStack: -+ switch (ainfo->slot_size) { -+ case 1: -+ if (ainfo->sign) -+ code = emit_ldrsbx (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ else -+ code = emit_ldrb (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ break; -+ case 2: -+ if (ainfo->sign) -+ code = emit_ldrshx (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ else -+ code = emit_ldrh (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ break; -+ case 4: -+ if (ainfo->sign) -+ code = emit_ldrswx (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ else -+ code = emit_ldrw (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ break; -+ default: -+ code = emit_ldrx (code, ins->dreg, cfg->arch.args_reg, ainfo->offset); -+ break; -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ } else { -+ if (ainfo->storage != ArgVtypeByRef && ainfo->storage != ArgVtypeByRefOnStack) -+ g_assert (ins->opcode == OP_REGOFFSET); -+ -+ switch (ainfo->storage) { -+ case ArgInIReg: -+ /* Stack slots for arguments have size 8 */ -+ code = emit_strx (code, ainfo->reg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case ArgInFReg: -+ code = emit_strfpx (code, ainfo->reg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case ArgInFRegR4: -+ code = emit_strfpw (code, ainfo->reg, ins->inst_basereg, ins->inst_offset); -+ break; -+ case ArgOnStack: -+ case ArgOnStackR4: -+ case ArgOnStackR8: -+ case ArgVtypeByRefOnStack: -+ case ArgVtypeOnStack: -+ break; -+ case ArgVtypeByRef: { -+ MonoInst *addr_arg = ins->inst_left; -+ -+ if (ainfo->gsharedvt) { -+ g_assert (ins->opcode == OP_GSHAREDVT_ARG_REGOFFSET); -+ arm_strx (code, ainfo->reg, ins->inst_basereg, ins->inst_offset); -+ } else { -+ g_assert (ins->opcode == OP_VTARG_ADDR); -+ g_assert (addr_arg->opcode == OP_REGOFFSET); -+ arm_strx (code, ainfo->reg, addr_arg->inst_basereg, addr_arg->inst_offset); -+ } -+ break; -+ } -+ case ArgVtypeInIRegs: -+ for (part = 0; part < ainfo->nregs; part ++) { -+ code = emit_strx (code, ainfo->reg + part, ins->inst_basereg, ins->inst_offset + (part * 8)); -+ } -+ break; -+ case ArgHFA: -+ for (part = 0; part < ainfo->nregs; part ++) { -+ if (ainfo->esize == 4) -+ code = emit_strfpw (code, ainfo->reg + part, ins->inst_basereg, ins->inst_offset + ainfo->foffsets [part]); -+ else -+ code = emit_strfpx (code, ainfo->reg + part, ins->inst_basereg, ins->inst_offset + ainfo->foffsets [part]); -+ } -+ break; -+ default: -+ g_assert_not_reached (); -+ break; -+ } -+ } -+ } -+ -+ return code; -+} -+ -+/* -+ * emit_store_regarray: -+ * -+ * Emit code to store the registers in REGS into the appropriate elements of -+ * the register array at BASEREG+OFFSET. -+ */ -+static __attribute__((warn_unused_result)) guint8* -+emit_store_regarray (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ int i; -+ -+ for (i = 0; i < 32; ++i) { -+ if (regs & (1 << i)) { -+ if (i + 1 < 32 && (regs & (1 << (i + 1))) && (i + 1 != ARMREG_SP)) { -+ arm_stpx (code, i, i + 1, basereg, offset + (i * 8)); -+ i++; -+ } else if (i == ARMREG_SP) { -+ arm_movspx (code, ARMREG_IP1, ARMREG_SP); -+ arm_strx (code, ARMREG_IP1, basereg, offset + (i * 8)); -+ } else { -+ arm_strx (code, i, basereg, offset + (i * 8)); -+ } -+ } -+ } -+ return code; -+} -+ -+/* -+ * emit_load_regarray: -+ * -+ * Emit code to load the registers in REGS from the appropriate elements of -+ * the register array at BASEREG+OFFSET. -+ */ -+static __attribute__((warn_unused_result)) guint8* -+emit_load_regarray (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ int i; -+ -+ for (i = 0; i < 32; ++i) { -+ if (regs & (1 << i)) { -+ if ((regs & (1 << (i + 1))) && (i + 1 != ARMREG_SP)) { -+ if (offset + (i * 8) < 500) -+ arm_ldpx (code, i, i + 1, basereg, offset + (i * 8)); -+ else { -+ code = emit_ldrx (code, i, basereg, offset + (i * 8)); -+ code = emit_ldrx (code, i + 1, basereg, offset + ((i + 1) * 8)); -+ } -+ i++; -+ } else if (i == ARMREG_SP) { -+ g_assert_not_reached (); -+ } else { -+ code = emit_ldrx (code, i, basereg, offset + (i * 8)); -+ } -+ } -+ } -+ return code; -+} -+ -+/* -+ * emit_store_regset: -+ * -+ * Emit code to store the registers in REGS into consecutive memory locations starting -+ * at BASEREG+OFFSET. -+ */ -+static __attribute__((warn_unused_result)) guint8* -+emit_store_regset (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ int i, pos; -+ -+ pos = 0; -+ for (i = 0; i < 32; ++i) { -+ if (regs & (1 << i)) { -+ if ((regs & (1 << (i + 1))) && (i + 1 != ARMREG_SP)) { -+ arm_stpx (code, i, i + 1, basereg, offset + (pos * 8)); -+ i++; -+ pos++; -+ } else if (i == ARMREG_SP) { -+ arm_movspx (code, ARMREG_IP1, ARMREG_SP); -+ arm_strx (code, ARMREG_IP1, basereg, offset + (pos * 8)); -+ } else { -+ arm_strx (code, i, basereg, offset + (pos * 8)); -+ } -+ pos++; -+ } -+ } -+ return code; -+} -+ -+/* -+ * emit_load_regset: -+ * -+ * Emit code to load the registers in REGS from consecutive memory locations starting -+ * at BASEREG+OFFSET. -+ */ -+static __attribute__((warn_unused_result)) guint8* -+emit_load_regset (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ int i, pos; -+ -+ pos = 0; -+ for (i = 0; i < 32; ++i) { -+ if (regs & (1 << i)) { -+ if ((regs & (1 << (i + 1))) && (i + 1 != ARMREG_SP)) { -+ arm_ldpx (code, i, i + 1, basereg, offset + (pos * 8)); -+ i++; -+ pos++; -+ } else if (i == ARMREG_SP) { -+ g_assert_not_reached (); -+ } else { -+ arm_ldrx (code, i, basereg, offset + (pos * 8)); -+ } -+ pos++; -+ } -+ } -+ return code; -+} -+ -+__attribute__((warn_unused_result)) guint8* -+mono_arm_emit_load_regarray (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ return emit_load_regarray (code, regs, basereg, offset); -+} -+ -+__attribute__((warn_unused_result)) guint8* -+mono_arm_emit_store_regarray (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ return emit_store_regarray (code, regs, basereg, offset); -+} -+ -+__attribute__((warn_unused_result)) guint8* -+mono_arm_emit_store_regset (guint8 *code, guint64 regs, int basereg, int offset) -+{ -+ return emit_store_regset (code, regs, basereg, offset); -+} -+ -+/* Same as emit_store_regset, but emit unwind info too */ -+/* CFA_OFFSET is the offset between the CFA and basereg */ -+static __attribute__((warn_unused_result)) guint8* -+emit_store_regset_cfa (MonoCompile *cfg, guint8 *code, guint64 regs, int basereg, int offset, int cfa_offset, guint64 no_cfa_regset) -+{ -+ int i, j, pos, nregs; -+ guint32 cfa_regset = regs & ~no_cfa_regset; -+ -+ pos = 0; -+ for (i = 0; i < 32; ++i) { -+ nregs = 1; -+ if (regs & (1 << i)) { -+ if ((regs & (1 << (i + 1))) && (i + 1 != ARMREG_SP)) { -+ if (offset < 256) { -+ arm_stpx (code, i, i + 1, basereg, offset + (pos * 8)); -+ } else { -+ code = emit_strx (code, i, basereg, offset + (pos * 8)); -+ code = emit_strx (code, i + 1, basereg, offset + (pos * 8) + 8); -+ } -+ nregs = 2; -+ } else if (i == ARMREG_SP) { -+ arm_movspx (code, ARMREG_IP1, ARMREG_SP); -+ code = emit_strx (code, ARMREG_IP1, basereg, offset + (pos * 8)); -+ } else { -+ code = emit_strx (code, i, basereg, offset + (pos * 8)); -+ } -+ -+ for (j = 0; j < nregs; ++j) { -+ if (cfa_regset & (1 << (i + j))) -+ mono_emit_unwind_op_offset (cfg, code, i + j, (- cfa_offset) + offset + ((pos + j) * 8)); -+ } -+ -+ i += nregs - 1; -+ pos += nregs; -+ } -+ } -+ return code; -+} -+ -+/* -+ * emit_setup_lmf: -+ * -+ * Emit code to initialize an LMF structure at LMF_OFFSET. -+ * Clobbers ip0/ip1. -+ */ -+static guint8* -+emit_setup_lmf (MonoCompile *cfg, guint8 *code, gint32 lmf_offset, int cfa_offset) -+{ -+ /* -+ * The LMF should contain all the state required to be able to reconstruct the machine state -+ * at the current point of execution. Since the LMF is only read during EH, only callee -+ * saved etc. registers need to be saved. -+ * FIXME: Save callee saved fp regs, JITted code doesn't use them, but native code does, and they -+ * need to be restored during EH. -+ */ -+ -+ /* pc */ -+ arm_adrx (code, ARMREG_LR, code); -+ code = emit_strx (code, ARMREG_LR, ARMREG_FP, lmf_offset + MONO_STRUCT_OFFSET (MonoLMF, pc)); -+ /* gregs + fp + sp */ -+ /* Don't emit unwind info for sp/fp, they are already handled in the prolog */ -+ code = emit_store_regset_cfa (cfg, code, MONO_ARCH_LMF_REGS, ARMREG_FP, lmf_offset + MONO_STRUCT_OFFSET (MonoLMF, gregs), cfa_offset, (1 << ARMREG_FP) | (1 << ARMREG_SP)); -+ -+ return code; -+} -+ -+guint8 * -+mono_arch_emit_prolog (MonoCompile *cfg) -+{ -+ MonoMethod *method = cfg->method; -+ MonoMethodSignature *sig; -+ MonoBasicBlock *bb; -+ guint8 *code; -+ int cfa_offset, max_offset; -+ -+ sig = mono_method_signature (method); -+ cfg->code_size = 256 + sig->param_count * 64; -+ code = cfg->native_code = g_malloc (cfg->code_size); -+ -+ /* This can be unaligned */ -+ cfg->stack_offset = ALIGN_TO (cfg->stack_offset, MONO_ARCH_FRAME_ALIGNMENT); -+ -+ /* -+ * - Setup frame -+ */ -+ cfa_offset = 0; -+ mono_emit_unwind_op_def_cfa (cfg, code, ARMREG_SP, 0); -+ -+ /* Setup frame */ -+ if (arm_is_ldpx_imm (-cfg->stack_offset)) { -+ arm_stpx_pre (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, -cfg->stack_offset); -+ } else { -+ /* sp -= cfg->stack_offset */ -+ /* This clobbers ip0/ip1 */ -+ code = emit_subx_sp_imm (code, cfg->stack_offset); -+ arm_stpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, 0); -+ } -+ cfa_offset += cfg->stack_offset; -+ mono_emit_unwind_op_def_cfa_offset (cfg, code, cfa_offset); -+ mono_emit_unwind_op_offset (cfg, code, ARMREG_FP, (- cfa_offset) + 0); -+ mono_emit_unwind_op_offset (cfg, code, ARMREG_LR, (- cfa_offset) + 8); -+ arm_movspx (code, ARMREG_FP, ARMREG_SP); -+ mono_emit_unwind_op_def_cfa_reg (cfg, code, ARMREG_FP); -+ if (cfg->param_area) { -+ /* The param area is below the frame pointer */ -+ code = emit_subx_sp_imm (code, cfg->param_area); -+ } -+ -+ if (cfg->method->save_lmf) { -+ code = emit_setup_lmf (cfg, code, cfg->lmf_var->inst_offset, cfa_offset); -+ } else { -+ /* Save gregs */ -+ code = emit_store_regset_cfa (cfg, code, MONO_ARCH_CALLEE_SAVED_REGS & cfg->used_int_regs, ARMREG_FP, cfg->arch.saved_gregs_offset, cfa_offset, 0); -+ } -+ -+ /* Setup args reg */ -+ if (cfg->arch.args_reg) { -+ /* The register was already saved above */ -+ code = emit_addx_imm (code, cfg->arch.args_reg, ARMREG_FP, cfg->stack_offset); -+ } -+ -+ /* Save return area addr received in R8 */ -+ if (cfg->vret_addr) { -+ MonoInst *ins = cfg->vret_addr; -+ -+ g_assert (ins->opcode == OP_REGOFFSET); -+ code = emit_strx (code, ARMREG_R8, ins->inst_basereg, ins->inst_offset); -+ } -+ -+ /* Save mrgctx received in MONO_ARCH_RGCTX_REG */ -+ if (cfg->rgctx_var) { -+ MonoInst *ins = cfg->rgctx_var; -+ -+ g_assert (ins->opcode == OP_REGOFFSET); -+ -+ code = emit_strx (code, MONO_ARCH_RGCTX_REG, ins->inst_basereg, ins->inst_offset); -+ } -+ -+ /* -+ * Move arguments to their registers/stack locations. -+ */ -+ code = emit_move_args (cfg, code); -+ -+ /* Initialize seq_point_info_var */ -+ if (cfg->arch.seq_point_info_var) { -+ MonoInst *ins = cfg->arch.seq_point_info_var; -+ -+ /* Initialize the variable from a GOT slot */ -+ code = emit_aotconst (cfg, code, ARMREG_IP0, MONO_PATCH_INFO_SEQ_POINT_INFO, cfg->method); -+ g_assert (ins->opcode == OP_REGOFFSET); -+ code = emit_strx (code, ARMREG_IP0, ins->inst_basereg, ins->inst_offset); -+ -+ /* Initialize ss_tramp_var */ -+ ins = cfg->arch.ss_tramp_var; -+ g_assert (ins->opcode == OP_REGOFFSET); -+ -+ code = emit_ldrx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (SeqPointInfo, ss_tramp_addr)); -+ code = emit_strx (code, ARMREG_IP1, ins->inst_basereg, ins->inst_offset); -+ } else { -+ MonoInst *ins; -+ -+ if (cfg->arch.ss_tramp_var) { -+ /* Initialize ss_tramp_var */ -+ ins = cfg->arch.ss_tramp_var; -+ g_assert (ins->opcode == OP_REGOFFSET); -+ -+ code = emit_imm64 (code, ARMREG_IP0, (guint64)&ss_trampoline); -+ code = emit_strx (code, ARMREG_IP0, ins->inst_basereg, ins->inst_offset); -+ } -+ -+ if (cfg->arch.bp_tramp_var) { -+ /* Initialize bp_tramp_var */ -+ ins = cfg->arch.bp_tramp_var; -+ g_assert (ins->opcode == OP_REGOFFSET); -+ -+ code = emit_imm64 (code, ARMREG_IP0, (guint64)bp_trampoline); -+ code = emit_strx (code, ARMREG_IP0, ins->inst_basereg, ins->inst_offset); -+ } -+ } -+ -+ max_offset = 0; -+ if (cfg->opt & MONO_OPT_BRANCH) { -+ for (bb = cfg->bb_entry; bb; bb = bb->next_bb) { -+ MonoInst *ins; -+ bb->max_offset = max_offset; -+ -+ MONO_BB_FOR_EACH_INS (bb, ins) { -+ max_offset += ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN]; -+ } -+ } -+ } -+ if (max_offset > 0x3ffff * 4) -+ cfg->arch.cond_branch_islands = TRUE; -+ -+ return code; -+} -+ -+static guint8* -+realloc_code (MonoCompile *cfg, int size) -+{ -+ while (cfg->code_len + size > (cfg->code_size - 16)) { -+ cfg->code_size *= 2; -+ cfg->native_code = g_realloc (cfg->native_code, cfg->code_size); -+ cfg->stat_code_reallocs++; -+ } -+ return cfg->native_code + cfg->code_len; -+} -+ -+void -+mono_arch_emit_epilog (MonoCompile *cfg) -+{ -+ CallInfo *cinfo; -+ int max_epilog_size; -+ guint8 *code; -+ int i; -+ -+ max_epilog_size = 16 + 20*4; -+ code = realloc_code (cfg, max_epilog_size); -+ -+ if (cfg->method->save_lmf) { -+ code = mono_arm_emit_load_regarray (code, MONO_ARCH_CALLEE_SAVED_REGS & cfg->used_int_regs, ARMREG_FP, cfg->lmf_var->inst_offset + MONO_STRUCT_OFFSET (MonoLMF, gregs) - (MONO_ARCH_FIRST_LMF_REG * 8)); -+ } else { -+ /* Restore gregs */ -+ code = emit_load_regset (code, MONO_ARCH_CALLEE_SAVED_REGS & cfg->used_int_regs, ARMREG_FP, cfg->arch.saved_gregs_offset); -+ } -+ -+ /* Load returned vtypes into registers if needed */ -+ cinfo = cfg->arch.cinfo; -+ switch (cinfo->ret.storage) { -+ case ArgVtypeInIRegs: { -+ MonoInst *ins = cfg->ret; -+ -+ for (i = 0; i < cinfo->ret.nregs; ++i) -+ code = emit_ldrx (code, cinfo->ret.reg + i, ins->inst_basereg, ins->inst_offset + (i * 8)); -+ break; -+ } -+ case ArgHFA: { -+ MonoInst *ins = cfg->ret; -+ -+ for (i = 0; i < cinfo->ret.nregs; ++i) { -+ if (cinfo->ret.esize == 4) -+ code = emit_ldrfpw (code, cinfo->ret.reg + i, ins->inst_basereg, ins->inst_offset + cinfo->ret.foffsets [i]); -+ else -+ code = emit_ldrfpx (code, cinfo->ret.reg + i, ins->inst_basereg, ins->inst_offset + cinfo->ret.foffsets [i]); -+ } -+ break; -+ } -+ default: -+ break; -+ } -+ -+ /* Destroy frame */ -+ code = mono_arm_emit_destroy_frame (code, cfg->stack_offset, ((1 << ARMREG_IP0) | (1 << ARMREG_IP1))); -+ -+ arm_retx (code, ARMREG_LR); -+ -+ g_assert (code - (cfg->native_code + cfg->code_len) < max_epilog_size); -+ -+ cfg->code_len = code - cfg->native_code; -+} -+ -+void -+mono_arch_emit_exceptions (MonoCompile *cfg) -+{ -+ MonoJumpInfo *ji; -+ MonoClass *exc_class; -+ guint8 *code, *ip; -+ guint8* exc_throw_pos [MONO_EXC_INTRINS_NUM]; -+ guint8 exc_throw_found [MONO_EXC_INTRINS_NUM]; -+ int i, id, size = 0; -+ -+ for (i = 0; i < MONO_EXC_INTRINS_NUM; i++) { -+ exc_throw_pos [i] = NULL; -+ exc_throw_found [i] = 0; -+ } -+ -+ for (ji = cfg->patch_info; ji; ji = ji->next) { -+ if (ji->type == MONO_PATCH_INFO_EXC) { -+ i = mini_exception_id_by_name (ji->data.target); -+ if (!exc_throw_found [i]) { -+ size += 32; -+ exc_throw_found [i] = TRUE; -+ } -+ } -+ } -+ -+ code = realloc_code (cfg, size); -+ -+ /* Emit code to raise corlib exceptions */ -+ for (ji = cfg->patch_info; ji; ji = ji->next) { -+ if (ji->type != MONO_PATCH_INFO_EXC) -+ continue; -+ -+ ip = cfg->native_code + ji->ip.i; -+ -+ id = mini_exception_id_by_name (ji->data.target); -+ -+ if (exc_throw_pos [id]) { -+ /* ip points to the bcc () in OP_COND_EXC_... */ -+ arm_patch_rel (ip, exc_throw_pos [id], ji->relocation); -+ ji->type = MONO_PATCH_INFO_NONE; -+ continue; -+ } -+ -+ exc_throw_pos [id] = code; -+ arm_patch_rel (ip, code, ji->relocation); -+ -+ /* We are being branched to from the code generated by emit_cond_exc (), the pc is in ip1 */ -+ -+ /* r0 = type token */ -+ exc_class = mono_class_from_name (mono_defaults.corlib, "System", ji->data.name); -+ g_assert (exc_class); -+ code = emit_imm (code, ARMREG_R0, exc_class->type_token - MONO_TOKEN_TYPE_DEF); -+ /* r1 = throw ip */ -+ arm_movx (code, ARMREG_R1, ARMREG_IP1); -+ /* Branch to the corlib exception throwing trampoline */ -+ ji->ip.i = code - cfg->native_code; -+ ji->type = MONO_PATCH_INFO_INTERNAL_METHOD; -+ ji->data.name = "mono_arch_throw_corlib_exception"; -+ ji->relocation = MONO_R_ARM64_BL; -+ arm_bl (code, 0); -+ cfg->thunk_area += THUNK_SIZE; -+ } -+ -+ cfg->code_len = code - cfg->native_code; -+ -+ g_assert (cfg->code_len < cfg->code_size); -+} -+ -+MonoInst* -+mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) -+{ -+ return NULL; -+} -+ -+gboolean -+mono_arch_print_tree (MonoInst *tree, int arity) -+{ -+ return FALSE; -+} -+ -+guint32 -+mono_arch_get_patch_offset (guint8 *code) -+{ -+ return 0; -+} -+ -+gpointer -+mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, -+ gpointer fail_tramp) -+{ -+ int i, buf_len, imt_reg; -+ guint8 *buf, *code; -+ -+#if DEBUG_IMT -+ printf ("building IMT thunk for class %s %s entries %d code size %d code at %p end %p vtable %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable); -+ for (i = 0; i < count; ++i) { -+ MonoIMTCheckItem *item = imt_entries [i]; -+ printf ("method %d (%p) %s vtable slot %p is_equals %d chunk size %d\n", i, item->key, item->key->name, &vtable->vtable [item->value.vtable_slot], item->is_equals, item->chunk_size); -+ } -+#endif -+ -+ buf_len = 0; -+ for (i = 0; i < count; ++i) { -+ MonoIMTCheckItem *item = imt_entries [i]; -+ if (item->is_equals) { -+ gboolean fail_case = !item->check_target_idx && fail_tramp; -+ -+ if (item->check_target_idx || fail_case) { -+ if (!item->compare_done || fail_case) { -+ buf_len += 4 * 4 + 4; -+ } -+ buf_len += 4; -+ if (item->has_target_code) { -+ buf_len += 5 * 4; -+ } else { -+ buf_len += 6 * 4; -+ } -+ if (fail_case) { -+ buf_len += 5 * 4; -+ } -+ } else { -+ buf_len += 6 * 4; -+ } -+ } else { -+ buf_len += 6 * 4; -+ } -+ } -+ -+ if (fail_tramp) -+ buf = mono_method_alloc_generic_virtual_thunk (domain, buf_len); -+ else -+ buf = mono_domain_code_reserve (domain, buf_len); -+ code = buf; -+ -+ /* -+ * We are called by JITted code, which passes in the IMT argument in -+ * MONO_ARCH_RGCTX_REG (r27). We need to preserve all caller saved regs -+ * except ip0/ip1. -+ */ -+ imt_reg = MONO_ARCH_RGCTX_REG; -+ for (i = 0; i < count; ++i) { -+ MonoIMTCheckItem *item = imt_entries [i]; -+ -+ item->code_target = code; -+ -+ if (item->is_equals) { -+ /* -+ * Check the imt argument against item->key, if equals, jump to either -+ * item->value.target_code or to vtable [item->value.vtable_slot]. -+ * If fail_tramp is set, jump to it if not-equals. -+ */ -+ gboolean fail_case = !item->check_target_idx && fail_tramp; -+ -+ if (item->check_target_idx || fail_case) { -+ /* Compare imt_reg with item->key */ -+ if (!item->compare_done || fail_case) { -+ // FIXME: Optimize this -+ code = emit_imm64 (code, ARMREG_IP0, (guint64)item->key); -+ arm_cmpx (code, imt_reg, ARMREG_IP0); -+ } -+ item->jmp_code = code; -+ arm_bcc (code, ARMCOND_NE, 0); -+ /* Jump to target if equals */ -+ if (item->has_target_code) { -+ code = emit_imm64 (code, ARMREG_IP0, (guint64)item->value.target_code); -+ arm_brx (code, ARMREG_IP0); -+ } else { -+ guint64 imm = (guint64)&(vtable->vtable [item->value.vtable_slot]); -+ -+ code = emit_imm64 (code, ARMREG_IP0, imm); -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0); -+ arm_brx (code, ARMREG_IP0); -+ } -+ -+ if (fail_case) { -+ arm_patch_rel (item->jmp_code, code, MONO_R_ARM64_BCC); -+ item->jmp_code = NULL; -+ code = emit_imm64 (code, ARMREG_IP0, (guint64)fail_tramp); -+ arm_brx (code, ARMREG_IP0); -+ } -+ } else { -+ guint64 imm = (guint64)&(vtable->vtable [item->value.vtable_slot]); -+ -+ code = emit_imm64 (code, ARMREG_IP0, imm); -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0); -+ arm_brx (code, ARMREG_IP0); -+ } -+ } else { -+ code = emit_imm64 (code, ARMREG_IP0, (guint64)item->key); -+ arm_cmpx (code, imt_reg, ARMREG_IP0); -+ item->jmp_code = code; -+ arm_bcc (code, ARMCOND_HS, 0); -+ } -+ } -+ /* Patch the branches */ -+ for (i = 0; i < count; ++i) { -+ MonoIMTCheckItem *item = imt_entries [i]; -+ if (item->jmp_code && item->check_target_idx) -+ arm_patch_rel (item->jmp_code, imt_entries [item->check_target_idx]->code_target, MONO_R_ARM64_BCC); -+ } -+ -+ g_assert ((code - buf) < buf_len); -+ -+ mono_arch_flush_icache (buf, code - buf); -+ -+ return buf; -+} -+ -+GSList * -+mono_arch_get_trampolines (gboolean aot) -+{ -+ return mono_arm_get_exception_trampolines (aot); -+} -+ -+#else /* DISABLE_JIT */ -+ -+gpointer -+mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, -+ gpointer fail_tramp) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+#endif /* !DISABLE_JIT */ -+ -+#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED -+ -+void -+mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip) -+{ -+ guint8 *code = ip; -+ guint32 native_offset = ip - (guint8*)ji->code_start; -+ -+ if (ji->from_aot) { -+ SeqPointInfo *info = mono_arch_get_seq_point_info (mono_domain_get (), ji->code_start); -+ -+ g_assert (native_offset % 4 == 0); -+ g_assert (info->bp_addrs [native_offset / 4] == 0); -+ info->bp_addrs [native_offset / 4] = mini_get_breakpoint_trampoline (); -+ } else { -+ /* ip points to an ldrx */ -+ code += 4; -+ arm_blrx (code, ARMREG_IP0); -+ mono_arch_flush_icache (ip, code - ip); -+ } -+} -+ -+void -+mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip) -+{ -+ guint8 *code = ip; -+ -+ if (ji->from_aot) { -+ guint32 native_offset = ip - (guint8*)ji->code_start; -+ SeqPointInfo *info = mono_arch_get_seq_point_info (mono_domain_get (), ji->code_start); -+ -+ g_assert (native_offset % 4 == 0); -+ info->bp_addrs [native_offset / 4] = NULL; -+ } else { -+ /* ip points to an ldrx */ -+ code += 4; -+ arm_nop (code); -+ mono_arch_flush_icache (ip, code - ip); -+ } -+} -+ -+void -+mono_arch_start_single_stepping (void) -+{ -+ ss_trampoline = mini_get_single_step_trampoline (); -+} -+ -+void -+mono_arch_stop_single_stepping (void) -+{ -+ ss_trampoline = NULL; -+} -+ -+gboolean -+mono_arch_is_single_step_event (void *info, void *sigctx) -+{ -+ /* We use soft breakpoints on arm64 */ -+ return FALSE; -+} -+ -+gboolean -+mono_arch_is_breakpoint_event (void *info, void *sigctx) -+{ -+ /* We use soft breakpoints on arm64 */ -+ return FALSE; -+} -+ -+void -+mono_arch_skip_breakpoint (MonoContext *ctx, MonoJitInfo *ji) -+{ -+ g_assert_not_reached (); -+} -+ -+void -+mono_arch_skip_single_step (MonoContext *ctx) -+{ -+ g_assert_not_reached (); -+} -+ -+gpointer -+mono_arch_get_seq_point_info (MonoDomain *domain, guint8 *code) -+{ -+ SeqPointInfo *info; -+ MonoJitInfo *ji; -+ -+ // FIXME: Add a free function -+ -+ mono_domain_lock (domain); -+ info = g_hash_table_lookup (domain_jit_info (domain)->arch_seq_points, -+ code); -+ mono_domain_unlock (domain); -+ -+ if (!info) { -+ ji = mono_jit_info_table_find (domain, (char*)code); -+ g_assert (ji); -+ -+ info = g_malloc0 (sizeof (SeqPointInfo) + (ji->code_size / 4) * sizeof(guint8*)); -+ -+ info->ss_tramp_addr = &ss_trampoline; -+ -+ mono_domain_lock (domain); -+ g_hash_table_insert (domain_jit_info (domain)->arch_seq_points, -+ code, info); -+ mono_domain_unlock (domain); -+ } -+ -+ return info; -+} -+ -+void -+mono_arch_init_lmf_ext (MonoLMFExt *ext, gpointer prev_lmf) -+{ -+ ext->lmf.previous_lmf = prev_lmf; -+ /* Mark that this is a MonoLMFExt */ -+ ext->lmf.previous_lmf = (gpointer)(((gssize)ext->lmf.previous_lmf) | 2); -+ ext->lmf.gregs [MONO_ARCH_LMF_REG_SP] = (gssize)ext; -+} -+ -+#endif /* MONO_ARCH_SOFT_DEBUG_SUPPORTED */ -+ -+gboolean -+mono_arch_opcode_supported (int opcode) -+{ -+ switch (opcode) { -+ case OP_ATOMIC_ADD_I4: -+ case OP_ATOMIC_ADD_I8: -+ case OP_ATOMIC_EXCHANGE_I4: -+ case OP_ATOMIC_EXCHANGE_I8: -+ case OP_ATOMIC_CAS_I4: -+ case OP_ATOMIC_CAS_I8: -+ case OP_ATOMIC_LOAD_I1: -+ case OP_ATOMIC_LOAD_I2: -+ case OP_ATOMIC_LOAD_I4: -+ case OP_ATOMIC_LOAD_I8: -+ case OP_ATOMIC_LOAD_U1: -+ case OP_ATOMIC_LOAD_U2: -+ case OP_ATOMIC_LOAD_U4: -+ case OP_ATOMIC_LOAD_U8: -+ case OP_ATOMIC_LOAD_R4: -+ case OP_ATOMIC_LOAD_R8: -+ case OP_ATOMIC_STORE_I1: -+ case OP_ATOMIC_STORE_I2: -+ case OP_ATOMIC_STORE_I4: -+ case OP_ATOMIC_STORE_I8: -+ case OP_ATOMIC_STORE_U1: -+ case OP_ATOMIC_STORE_U2: -+ case OP_ATOMIC_STORE_U4: -+ case OP_ATOMIC_STORE_U8: -+ case OP_ATOMIC_STORE_R4: -+ case OP_ATOMIC_STORE_R8: -+ return TRUE; -+ default: -+ return FALSE; -+ } -+} -+ -+CallInfo* -+mono_arch_get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSignature *sig) -+{ -+ return get_call_info (gsctx, mp, sig); -+} -+ -+gpointer -+mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value) -+{ -+ gpointer *lr_loc; -+ char *old_value; -+ char *bp; -+ -+ /*Load the spvar*/ -+ bp = MONO_CONTEXT_GET_BP (ctx); -+ lr_loc = (gpointer*)(bp + clause->exvar_offset); -+ -+ old_value = *lr_loc; -+ if ((char*)old_value < (char*)ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size)) -+ return old_value; -+ -+ *lr_loc = new_value; -+ -+ return old_value; -+} ---- mono-4.2.1.102+dfsg2.orig/mono/mini/mini-arm64.h -+++ mono-4.2.1.102+dfsg2/mono/mini/mini-arm64.h -@@ -1 +1,253 @@ --#include "../../../mono-extensions/mono/mini/mini-arm64.h" -+/* -+ * mini-arm64.h -+ * -+ * Copyright 2013 Xamarin Inc -+ * -+ * Based on mini-arm.h: -+ * -+ * Copyright 2011 Xamarin Inc -+ */ -+ -+#ifndef __MONO_MINI_ARM64_H__ -+#define __MONO_MINI_ARM64_H__ -+ -+#include -+ -+#define MONO_ARCH_CPU_SPEC mono_arm64_cpu_desc -+ -+#define MONO_MAX_IREGS 32 -+#define MONO_MAX_FREGS 32 -+ -+#define MONO_CONTEXT_SET_LLVM_EXC_REG(ctx, exc) do { (ctx)->regs [0] = (gsize)exc; } while (0) -+ -+#define MONO_INIT_CONTEXT_FROM_FUNC(ctx,func) do { \ -+ MONO_CONTEXT_SET_BP ((ctx), __builtin_frame_address (0)); \ -+ MONO_CONTEXT_SET_SP ((ctx), __builtin_frame_address (0)); \ -+ MONO_CONTEXT_SET_IP ((ctx), (func)); \ -+ } while (0) -+ -+#define MONO_ARCH_INIT_TOP_LMF_ENTRY(lmf) -+ -+/* Parameters used by the register allocator */ -+/* r0..r7, r9..r14 (r15 is the imt/rgctx reg) */ -+#define MONO_ARCH_CALLEE_REGS 0xfeff -+/* r19..r28 */ -+#define MONO_ARCH_CALLEE_SAVED_REGS (0x3ff << 19) -+ -+/* v15/v16 is reserved for a scratch reg */ -+#define MONO_ARCH_CALLEE_FREGS 0xfffc00ff -+/* v8..v15 */ -+#define MONO_ARCH_CALLEE_SAVED_FREGS 0xff00 -+ -+#define MONO_ARCH_USE_FPSTACK FALSE -+#define MONO_ARCH_FPSTACK_SIZE 0 -+ -+#define MONO_ARCH_INST_SREG2_MASK(ins) (0) -+ -+#define MONO_ARCH_INST_FIXED_REG(desc) ((desc) == 'a' ? ARMREG_R0 : -1) -+ -+#define MONO_ARCH_INST_IS_REGPAIR(desc) (0) -+ -+#define MONO_ARCH_INST_IS_FLOAT(desc) ((desc) == 'f') -+ -+#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (-1) -+ -+#define MONO_ARCH_USE_FPSTACK FALSE -+ -+#define MONO_ARCH_FRAME_ALIGNMENT 16 -+ -+#define MONO_ARCH_CODE_ALIGNMENT 32 -+ -+/* callee saved regs + fp + sp */ -+#define MONO_ARCH_LMF_REGS ((0x3ff << 19) | (1 << ARMREG_FP) | (1 << ARMREG_SP)) -+#define MONO_ARCH_NUM_LMF_REGS (10 + 2) -+#define MONO_ARCH_FIRST_LMF_REG ARMREG_R19 -+#define MONO_ARCH_LMF_REG_FP 10 -+#define MONO_ARCH_LMF_REG_SP 11 -+ -+struct MonoLMF { -+ /* -+ * If the second lowest bit is set to 1, then this is a MonoLMFExt structure, and -+ * the other fields are not valid. -+ */ -+ gpointer previous_lmf; -+ gpointer lmf_addr; -+ mgreg_t pc; -+ mgreg_t gregs [MONO_ARCH_NUM_LMF_REGS]; -+}; -+ -+/* Structure used by the sequence points in AOTed code */ -+typedef struct { -+ gpointer ss_trigger_page; -+ gpointer bp_trigger_page; -+ gpointer ss_tramp_addr; -+ guint8* bp_addrs [MONO_ZERO_LEN_ARRAY]; -+} SeqPointInfo; -+ -+#define PARAM_REGS 8 -+#define FP_PARAM_REGS 8 -+ -+#define DYN_CALL_STACK_ARGS 6 -+ -+typedef struct { -+ /* The +1 is for r8 */ -+ mgreg_t regs [PARAM_REGS + 1 + DYN_CALL_STACK_ARGS]; -+ mgreg_t res, res2; -+ guint8 *ret; -+ double fpregs [FP_PARAM_REGS]; -+ int n_fpargs, n_fpret; -+ guint8 buffer [256]; -+} DynCallArgs; -+ -+typedef struct { -+ gpointer cinfo; -+ int saved_gregs_offset; -+ /* Points to arguments received on the stack */ -+ int args_reg; -+ gboolean cond_branch_islands; -+ gpointer vret_addr_loc; -+ gpointer seq_point_info_var; -+ gpointer ss_tramp_var; -+ gpointer bp_tramp_var; -+ guint8 *thunks; -+ int thunks_size; -+} MonoCompileArch; -+ -+#define MONO_ARCH_EMULATE_FREM 1 -+#define MONO_ARCH_NO_EMULATE_LONG_MUL_OPTS 1 -+#define MONO_ARCH_EMULATE_LONG_MUL_OVF_OPTS 1 -+#define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS 1 -+#define MONO_ARCH_NEED_DIV_CHECK 1 -+#define MONO_ARCH_EMULATE_MUL_OVF 1 -+#define MONO_ARCH_HAVE_IMT 1 -+#define MONO_ARCH_HAVE_OP_TAIL_CALL 1 -+#define MONO_ARCH_THIS_AS_FIRST_ARG 1 -+#define MONO_ARCH_RGCTX_REG ARMREG_R15 -+#define MONO_ARCH_IMT_REG MONO_ARCH_RGCTX_REG -+#define MONO_ARCH_VTABLE_REG ARMREG_R0 -+#define MONO_ARCH_EXC_REG ARMREG_R0 -+#define MONO_ARCH_HAVE_XP_UNWIND 1 -+#define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE 1 -+#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1 -+#define MONO_ARCH_USE_SIGACTION 1 -+#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1 -+#define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1 -+#define MONO_ARCH_GSHARED_SUPPORTED 1 -+#define MONO_ARCH_AOT_SUPPORTED 1 -+#define MONO_ARCH_LLVM_SUPPORTED 1 -+#define MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES 1 -+#define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1 -+#define MONO_ARCH_HAVE_GET_TRAMPOLINES 1 -+#define MONO_ARCH_DYN_CALL_SUPPORTED 1 -+#define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * 8) -+#define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1 -+#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1 -+#define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1 -+#ifndef MONO_CROSS_COMPILE -+#define MONO_ARCH_ENABLE_MONO_LMF_VAR 1 -+#endif -+#define MONO_ARCH_HAVE_OP_GET_EX_OBJ 1 -+#define MONO_ARCH_HAVE_OBJC_GET_SELECTOR 1 -+#define MONO_ARCH_HAVE_SDB_TRAMPOLINES 1 -+#define MONO_ARCH_HAVE_PATCH_CODE_NEW 1 -+#define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1 -+#define MONO_ARCH_HAVE_OPCODE_NEEDS_EMULATION 1 -+#define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1 -+#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1 -+ -+#ifdef TARGET_IOS -+ -+#define MONO_ARCH_REDZONE_SIZE 128 -+ -+#else -+ -+#define MONO_ARCH_REDZONE_SIZE 0 -+#if !defined(__PIC__) -+#define MONO_ARCH_HAVE_TLS_GET 1 -+#endif -+#define MONO_ARCH_HAVE_TLS_GET_REG 1 -+ -+#endif -+ -+/* Relocations */ -+#define MONO_R_ARM64_B 1 -+#define MONO_R_ARM64_BCC 2 -+#define MONO_R_ARM64_IMM 3 -+#define MONO_R_ARM64_BL 4 -+#define MONO_R_ARM64_BL_SHORT 5 -+#define MONO_R_ARM64_CBZ 6 -+ -+typedef enum { -+ ArgInIReg, -+ ArgInFReg, -+ ArgInFRegR4, -+ ArgOnStack, -+ ArgOnStackR8, -+ ArgOnStackR4, -+ /* -+ * Vtype passed in consecutive int registers. -+ * ainfo->reg is the firs register, -+ * ainfo->nregs is the number of registers, -+ * ainfo->size is the size of the structure. -+ */ -+ ArgVtypeInIRegs, -+ ArgVtypeByRef, -+ ArgVtypeByRefOnStack, -+ ArgVtypeOnStack, -+ ArgHFA, -+ ArgNone -+} ArgStorage; -+ -+typedef struct { -+ ArgStorage storage; -+ int reg; -+ /* ArgOnStack */ -+ int offset; -+ /* ArgVtypeInIRegs/ArgHFA */ -+ int nregs, size; -+ /* ArgHFA */ -+ int esize; -+ /* ArgHFA */ -+ /* The offsets of the float values inside the arg */ -+ guint16 foffsets [4]; -+ /* ArgOnStack */ -+ int slot_size; -+ gboolean sign; -+ gboolean gsharedvt; -+ gboolean hfa; -+} ArgInfo; -+ -+typedef struct { -+ int nargs; -+ int gr, fr, stack_usage; -+ ArgInfo ret; -+ ArgInfo sig_cookie; -+ ArgInfo args [1]; -+} CallInfo; -+ -+guint8* mono_arm_emit_imm64 (guint8 *code, int dreg, gint64 imm); -+ -+guint8* mono_arm_emit_ldrx (guint8 *code, int rt, int rn, int imm); -+ -+guint8* mono_arm_emit_destroy_frame (guint8 *code, int stack_offset, guint64 temp_regs); -+ -+guint8* mono_arm_emit_store_regset (guint8 *code, guint64 regs, int basereg, int offset); -+ -+guint8* mono_arm_emit_store_regarray (guint8 *code, guint64 regs, int basereg, int offset); -+ -+guint8* mono_arm_emit_load_regarray (guint8 *code, guint64 regs, int basereg, int offset); -+ -+/* MonoJumpInfo **ji */ -+guint8* mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *code_start, int dreg, guint32 patch_type, gconstpointer data); -+ -+void mono_arm_patch (guint8 *code, guint8 *target, int relocation); -+ -+void mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow); -+ -+GSList* mono_arm_get_exception_trampolines (gboolean aot); -+ -+void mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow); -+ -+CallInfo* mono_arch_get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSignature *sig); -+ -+#endif /* __MONO_MINI_ARM64_H__ */ ---- mono-4.2.1.102+dfsg2.orig/mono/mini/mini-ppc.c -+++ mono-4.2.1.102+dfsg2/mono/mini/mini-ppc.c -@@ -1091,8 +1091,10 @@ get_call_info (MonoGenericSharingContext - cinfo->args [n].reg = fr; - fr ++; - FP_ALSO_IN_REG (gr ++); -+#if !defined(__mono_ppc64__) - if (size == 8) - FP_ALSO_IN_REG (gr ++); -+#endif - ALWAYS_ON_STACK (stack_size += size); - } else { - cinfo->args [n].offset = PPC_STACK_PARAM_OFFSET + stack_size; -@@ -1695,15 +1697,27 @@ mono_arch_emit_outarg_vt (MonoCompile *c - } else - #endif - for (i = 0; i < ainfo->vtregs; ++i) { -+ dreg = mono_alloc_ireg (cfg); -+#if G_BYTE_ORDER == G_BIG_ENDIAN - int antipadding = 0; - if (ainfo->bytes) { - g_assert (i == 0); - antipadding = sizeof (gpointer) - ainfo->bytes; - } -- dreg = mono_alloc_ireg (cfg); - MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, soffset); - if (antipadding) - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_UN_IMM, dreg, dreg, antipadding * 8); -+#else -+ if (ainfo->bytes && mono_class_native_size (ins->klass, NULL) == 1) { -+ MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU1_MEMBASE, dreg, src->dreg, soffset); -+ } else if (ainfo->bytes && mono_class_native_size (ins->klass, NULL) == 2) { -+ MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU2_MEMBASE, dreg, src->dreg, soffset); -+ } else if (ainfo->bytes && mono_class_native_size (ins->klass, NULL) == 4) { // WDS -- Maybe <= 4? -+ MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADU4_MEMBASE, dreg, src->dreg, soffset); -+ } else { -+ MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, soffset); -+ } -+#endif - mono_call_inst_add_outarg_reg (cfg, call, dreg, ainfo->reg + i, FALSE); - soffset += sizeof (gpointer); - } -@@ -2242,8 +2256,11 @@ mono_arch_decompose_opts (MonoCompile *c - else - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_IMM, ins->dreg, result_shifted_reg, 32); - ins->opcode = OP_NOP; -+ break; - } - #endif -+ default: -+ break; - } - } - -@@ -3735,6 +3752,14 @@ mono_arch_output_basic_block (MonoCompil - if (ins->dreg != ins->sreg1) - ppc_fmr (code, ins->dreg, ins->sreg1); - break; -+ case OP_MOVE_F_TO_I4: -+ ppc_stfs (code, ins->sreg1, -4, ppc_r1); -+ ppc_ldptr (code, ins->dreg, -4, ppc_r1); -+ break; -+ case OP_MOVE_I4_TO_F: -+ ppc_stw (code, ins->sreg1, -4, ppc_r1); -+ ppc_lfs (code, ins->dreg, -4, ppc_r1); -+ break; - case OP_FCONV_TO_R4: - ppc_frsp (code, ins->dreg, ins->sreg1); - break; -@@ -4417,6 +4442,22 @@ mono_arch_output_basic_block (MonoCompil - else - ppc_mr (code, ins->dreg, ins->sreg1); - break; -+#else -+ case OP_ICONV_TO_R4: -+ case OP_ICONV_TO_R8: { -+ if (cpu_hw_caps & PPC_ISA_64) { -+ ppc_srawi(code, ppc_r0, ins->sreg1, 31); -+ ppc_stw (code, ppc_r0, -8, ppc_r1); -+ ppc_stw (code, ins->sreg1, -4, ppc_r1); -+ ppc_lfd (code, ins->dreg, -8, ppc_r1); -+ ppc_fcfid (code, ins->dreg, ins->dreg); -+ if (ins->opcode == OP_ICONV_TO_R4) -+ ppc_frsp (code, ins->dreg, ins->dreg); -+ } -+ break; -+ } -+#endif -+ - case OP_ATOMIC_ADD_I4: - CASE_PPC64 (OP_ATOMIC_ADD_I8) { - int location = ins->inst_basereg; -@@ -4450,21 +4491,6 @@ mono_arch_output_basic_block (MonoCompil - ppc_mr (code, ins->dreg, ppc_r0); - break; - } --#else -- case OP_ICONV_TO_R4: -- case OP_ICONV_TO_R8: { -- if (cpu_hw_caps & PPC_ISA_64) { -- ppc_srawi(code, ppc_r0, ins->sreg1, 31); -- ppc_stw (code, ppc_r0, -8, ppc_r1); -- ppc_stw (code, ins->sreg1, -4, ppc_r1); -- ppc_lfd (code, ins->dreg, -8, ppc_r1); -- ppc_fcfid (code, ins->dreg, ins->dreg); -- if (ins->opcode == OP_ICONV_TO_R4) -- ppc_frsp (code, ins->dreg, ins->dreg); -- } -- break; -- } --#endif - case OP_ATOMIC_CAS_I4: - CASE_PPC64 (OP_ATOMIC_CAS_I8) { - int location = ins->sreg1; -@@ -5040,9 +5066,21 @@ mono_arch_emit_prolog (MonoCompile *cfg) - #ifdef __mono_ppc64__ - if (ainfo->bytes) { - g_assert (cur_reg == 0); -+#if G_BYTE_ORDER == G_BIG_ENDIAN - ppc_sldi (code, ppc_r0, ainfo->reg, - (sizeof (gpointer) - ainfo->bytes) * 8); - ppc_stptr (code, ppc_r0, doffset, inst->inst_basereg); -+#else -+ if (mono_class_native_size (inst->klass, NULL) == 1) { -+ ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); -+ } else if (mono_class_native_size (inst->klass, NULL) == 2) { -+ ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); -+ } else if (mono_class_native_size (inst->klass, NULL) == 4) { // WDS -- maybe <=4? -+ ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); -+ } else { -+ ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); // WDS -- Better way? -+ } -+#endif - } else - #endif - { ---- mono-4.2.1.102+dfsg2.orig/mono/mini/mini-trampolines.c -+++ mono-4.2.1.102+dfsg2/mono/mini/mini-trampolines.c -@@ -1066,7 +1066,7 @@ mono_delegate_trampoline (mgreg_t *regs, - } - } - } -- } else { -+ } else if (delegate->method_ptr) { - ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (delegate->method_ptr)); - if (ji) - method = jinfo_get_method (ji); ---- mono-4.2.1.102+dfsg2.orig/mono/mini/tramp-arm64.c -+++ mono-4.2.1.102+dfsg2/mono/mini/tramp-arm64.c -@@ -1 +1,705 @@ --#include "../../../mono-extensions/mono/mini/tramp-arm64.c" -+/* -+ * tramp-arm64.c: JIT trampoline code for ARM64 -+ * -+ * Copyright 2013 Xamarin Inc -+ * -+ * Based on tramp-arm.c: -+ * -+ * Authors: -+ * Paolo Molaro (lupus@ximian.com) -+ * -+ * (C) 2001-2003 Ximian, Inc. -+ * Copyright 2003-2011 Novell Inc -+ * Copyright 2011 Xamarin Inc -+ */ -+ -+#include "mini.h" -+#include "debugger-agent.h" -+ -+#include -+#include -+ -+#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) -+ -+void -+mono_arch_patch_callsite (guint8 *method_start, guint8 *code_ptr, guint8 *addr) -+{ -+ mono_arm_patch (code_ptr - 4, addr, MONO_R_ARM64_BL); -+ mono_arch_flush_icache (code_ptr - 4, 4); -+} -+ -+void -+mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) -+{ -+ guint32 ins; -+ guint64 slot_addr; -+ int disp; -+ -+ /* -+ * Decode the address loaded by the PLT entry emitted by arch_emit_plt_entry () in -+ * aot-compiler.c -+ */ -+ -+ /* adrp */ -+ ins = ((guint32*)code) [0]; -+ g_assert (((ins >> 24) & 0x1f) == 0x10); -+ disp = (((ins >> 5) & 0x7ffff) << 2) | ((ins >> 29) & 0x3); -+ /* FIXME: disp is signed */ -+ g_assert ((disp >> 20) == 0); -+ -+ slot_addr = ((guint64)code + (disp << 12)) & ~0xfff; -+ -+ /* add x16, x16, :lo12:got */ -+ ins = ((guint32*)code) [1]; -+ g_assert (((ins >> 22) & 0x3) == 0); -+ slot_addr += (ins >> 10) & 0xfff; -+ -+ /* ldr x16, [x16, ] */ -+ ins = ((guint32*)code) [2]; -+ g_assert (((ins >> 24) & 0x3f) == 0x39); -+ slot_addr += ((ins >> 10) & 0xfff) * 8; -+ -+ g_assert (*(guint64*)slot_addr); -+ *(gpointer*)slot_addr = addr; -+} -+ -+void -+mono_arch_nullify_class_init_trampoline (guint8 *code, mgreg_t *regs) -+{ -+ mono_arch_patch_callsite (NULL, code, mini_get_nullified_class_init_trampoline ()); -+} -+ -+guint8* -+mono_arch_get_call_target (guint8 *code) -+{ -+ guint32 imm; -+ int disp; -+ -+ code -= 4; -+ -+ imm = *(guint32*)code; -+ /* Should be a bl */ -+ g_assert (((imm >> 31) & 0x1) == 0x1); -+ g_assert (((imm >> 26) & 0x7) == 0x5); -+ -+ disp = (imm & 0x3ffffff); -+ if ((disp >> 25) != 0) -+ /* Negative, sing extend to 32 bits */ -+ disp = disp | 0xfc000000; -+ -+ return code + (disp * 4); -+} -+ -+guint32 -+mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) -+{ -+ /* The offset is stored as the 5th word of the plt entry */ -+ return ((guint32*)plt_entry) [4]; -+} -+ -+#ifndef DISABLE_JIT -+ -+guchar* -+mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *code, *buf, *tramp; -+ int i, buf_len, imm; -+ int frame_size, offset, gregs_offset, num_fregs, fregs_offset, arg_offset, lmf_offset; -+ guint64 gregs_regset; -+ GSList *unwind_ops = NULL; -+ MonoJumpInfo *ji = NULL; -+ char *tramp_name; -+ -+ buf_len = 768; -+ buf = code = mono_global_codeman_reserve (buf_len); -+ -+ /* -+ * We are getting called by a specific trampoline, ip1 contains the trampoline argument. -+ */ -+ -+ /* Compute stack frame size and offsets */ -+ offset = 0; -+ /* frame block */ -+ offset += 2 * 8; -+ /* gregs */ -+ gregs_offset = offset; -+ offset += 32 * 8; -+ /* fregs */ -+ // FIXME: Save 128 bits -+ /* Only have to save the argument regs */ -+ num_fregs = 8; -+ fregs_offset = offset; -+ offset += num_fregs * 8; -+ /* arg */ -+ arg_offset = offset; -+ offset += 8; -+ /* LMF */ -+ lmf_offset = offset; -+ offset += sizeof (MonoLMF); -+ //offset += 22 * 8; -+ frame_size = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); -+ -+ /* Setup stack frame */ -+ imm = frame_size; -+ while (imm > 256) { -+ arm_subx_imm (code, ARMREG_SP, ARMREG_SP, 256); -+ imm -= 256; -+ } -+ arm_subx_imm (code, ARMREG_SP, ARMREG_SP, imm); -+ arm_stpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, 0); -+ arm_movspx (code, ARMREG_FP, ARMREG_SP); -+ -+ /* Save gregs */ -+ // FIXME: Optimize this -+ gregs_regset = ~((1 << ARMREG_FP) | (1 << ARMREG_SP)); -+ code = mono_arm_emit_store_regarray (code, gregs_regset, ARMREG_FP, gregs_offset); -+ /* Save fregs */ -+ for (i = 0; i < num_fregs; ++i) -+ arm_strfpx (code, i, ARMREG_FP, fregs_offset + (i * 8)); -+ /* Save trampoline arg */ -+ arm_strx (code, ARMREG_IP1, ARMREG_FP, arg_offset); -+ -+ /* Setup LMF */ -+ arm_addx_imm (code, ARMREG_IP0, ARMREG_FP, lmf_offset); -+ code = mono_arm_emit_store_regset (code, MONO_ARCH_LMF_REGS, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, gregs)); -+ /* Save caller fp */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_FP, 0); -+ arm_strx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, gregs) + (MONO_ARCH_LMF_REG_FP * 8)); -+ /* Save caller sp */ -+ arm_movx (code, ARMREG_IP1, ARMREG_FP); -+ imm = frame_size; -+ while (imm > 256) { -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 256); -+ imm -= 256; -+ } -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, imm); -+ arm_strx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, gregs) + (MONO_ARCH_LMF_REG_SP * 8)); -+ /* Save caller pc */ -+ if (tramp_type == MONO_TRAMPOLINE_JUMP) -+ arm_movx (code, ARMREG_LR, ARMREG_RZR); -+ else -+ arm_ldrx (code, ARMREG_LR, ARMREG_FP, 8); -+ arm_strx (code, ARMREG_LR, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, pc)); -+ -+ /* Save LMF */ -+ /* Similar to emit_save_lmf () */ -+ if (aot) { -+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_get_lmf_addr"); -+ } else { -+ tramp = (guint8*)mono_get_lmf_addr; -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp); -+ } -+ arm_blrx (code, ARMREG_IP0); -+ /* r0 contains the address of the tls slot holding the current lmf */ -+ /* ip0 = lmf */ -+ arm_addx_imm (code, ARMREG_IP0, ARMREG_FP, lmf_offset); -+ /* lmf->lmf_addr = lmf_addr */ -+ arm_strx (code, ARMREG_R0, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, lmf_addr)); -+ /* lmf->previous_lmf = *lmf_addr */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_R0, 0); -+ arm_strx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, previous_lmf)); -+ /* *lmf_addr = lmf */ -+ arm_strx (code, ARMREG_IP0, ARMREG_R0, 0); -+ -+ /* Call the C trampoline function */ -+ /* Arg 1 = gregs */ -+ arm_addx_imm (code, ARMREG_R0, ARMREG_FP, gregs_offset); -+ /* Arg 2 = caller */ -+ if (tramp_type == MONO_TRAMPOLINE_JUMP) -+ arm_movx (code, ARMREG_R1, ARMREG_RZR); -+ else -+ arm_ldrx (code, ARMREG_R1, ARMREG_FP, gregs_offset + (ARMREG_LR * 8)); -+ /* Arg 3 = arg */ -+ if (MONO_TRAMPOLINE_TYPE_HAS_ARG (tramp_type)) -+ /* Passed in r0 */ -+ arm_ldrx (code, ARMREG_R2, ARMREG_FP, gregs_offset + (ARMREG_R0 * 8)); -+ else -+ arm_ldrx (code, ARMREG_R2, ARMREG_FP, arg_offset); -+ /* Arg 4 = trampoline addr */ -+ arm_movx (code, ARMREG_R3, ARMREG_RZR); -+ -+ if (aot) { -+ char *icall_name = g_strdup_printf ("trampoline_func_%d", tramp_type); -+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, icall_name); -+ } else { -+ tramp = (guint8*)mono_get_trampoline_func (tramp_type); -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp); -+ } -+ arm_blrx (code, ARMREG_IP0); -+ -+ /* Restore LMF */ -+ /* Similar to emit_restore_lmf () */ -+ /* Clobbers ip0/ip1 */ -+ /* ip0 = lmf */ -+ arm_addx_imm (code, ARMREG_IP0, ARMREG_FP, lmf_offset); -+ /* ip1 = lmf->previous_lmf */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, previous_lmf)); -+ /* ip0 = lmf->lmf_addr */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, lmf_addr)); -+ /* *lmf_addr = previous_lmf */ -+ arm_strx (code, ARMREG_IP1, ARMREG_IP0, 0); -+ -+ /* Save the result to ip1 */ -+ arm_movx (code, ARMREG_IP1, ARMREG_R0); -+ -+ /* Restore gregs */ -+ /* Only have to load the argument regs (r0..r8) and the rgctx reg */ -+ code = mono_arm_emit_load_regarray (code, 0x1ff | (1 << ARMREG_LR) | (1 << MONO_ARCH_RGCTX_REG), ARMREG_FP, gregs_offset); -+ /* Restore fregs */ -+ for (i = 0; i < num_fregs; ++i) -+ arm_ldrfpx (code, i, ARMREG_FP, fregs_offset + (i * 8)); -+ -+ /* These trampolines return a value */ -+ if (tramp_type == MONO_TRAMPOLINE_RGCTX_LAZY_FETCH) -+ arm_movx (code, ARMREG_R0, ARMREG_IP1); -+ -+ /* Cleanup frame */ -+ code = mono_arm_emit_destroy_frame (code, frame_size, ((1 << ARMREG_IP0))); -+ -+ if ((tramp_type == MONO_TRAMPOLINE_CLASS_INIT) || (tramp_type == MONO_TRAMPOLINE_GENERIC_CLASS_INIT) || (tramp_type == MONO_TRAMPOLINE_RGCTX_LAZY_FETCH)) -+ arm_retx (code, ARMREG_LR); -+ else -+ arm_brx (code, ARMREG_IP1); -+ -+ g_assert ((code - buf) < buf_len); -+ mono_arch_flush_icache (buf, code - buf); -+ -+ if (info) { -+ tramp_name = mono_get_generic_trampoline_name (tramp_type); -+ *info = mono_tramp_info_create (tramp_name, buf, code - buf, ji, unwind_ops); -+ g_free (tramp_name); -+ } -+ -+ return buf; -+} -+ -+gpointer -+mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info) -+{ -+ guint8 *buf, *code; -+ -+ code = buf = mono_global_codeman_reserve (16); -+ -+ arm_retx (code, ARMREG_LR); -+ -+ mono_arch_flush_icache (buf, code - buf); -+ -+ if (info) -+ *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL); -+ -+ return buf; -+} -+ -+gpointer -+mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) -+{ -+ guint8 *code, *buf, *tramp; -+ int buf_len = 64; -+ -+ /* -+ * Return a trampoline which calls generic trampoline TRAMP_TYPE passing in ARG1. -+ * Pass the argument in ip1, clobbering ip0. -+ */ -+ tramp = mono_get_trampoline_code (tramp_type); -+ -+ buf = code = mono_global_codeman_reserve (buf_len); -+ -+ code = mono_arm_emit_imm64 (code, ARMREG_IP1, (guint64)arg1); -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp); -+ -+ arm_brx (code, ARMREG_IP0); -+ -+ g_assert ((code - buf) < buf_len); -+ mono_arch_flush_icache (buf, code - buf); -+ if (code_len) -+ *code_len = code - buf; -+ -+ return buf; -+} -+ -+gpointer -+mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) -+{ -+ guint8 *code, *start; -+ guint32 size = 32; -+ MonoDomain *domain = mono_domain_get (); -+ -+ start = code = mono_domain_code_reserve (domain, size); -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)addr); -+ arm_addx_imm (code, ARMREG_R0, ARMREG_R0, sizeof (MonoObject)); -+ arm_brx (code, ARMREG_IP0); -+ -+ g_assert ((code - start) <= size); -+ mono_arch_flush_icache (start, code - start); -+ return start; -+} -+ -+gpointer -+mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr) -+{ -+ guint8 *code, *start; -+ guint32 buf_len = 32; -+ MonoDomain *domain = mono_domain_get (); -+ -+ start = code = mono_domain_code_reserve (domain, buf_len); -+ code = mono_arm_emit_imm64 (code, MONO_ARCH_RGCTX_REG, (guint64)mrgctx); -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)addr); -+ arm_brx (code, ARMREG_IP0); -+ -+ g_assert ((code - start) <= buf_len); -+ -+ mono_arch_flush_icache (start, code - start); -+ -+ return start; -+} -+ -+gpointer -+mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *code, *buf; -+ int buf_size; -+ int i, depth, index, njumps; -+ gboolean is_mrgctx; -+ guint8 **rgctx_null_jumps; -+ MonoJumpInfo *ji = NULL; -+ GSList *unwind_ops = NULL; -+ guint8 *tramp; -+ guint32 code_len; -+ -+ is_mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot); -+ index = MONO_RGCTX_SLOT_INDEX (slot); -+ if (is_mrgctx) -+ index += MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT / sizeof (gpointer); -+ for (depth = 0; ; ++depth) { -+ int size = mono_class_rgctx_get_array_size (depth, is_mrgctx); -+ -+ if (index < size - 1) -+ break; -+ index -= size - 1; -+ } -+ -+ buf_size = 64 + 16 * depth; -+ code = buf = mono_global_codeman_reserve (buf_size); -+ -+ rgctx_null_jumps = g_malloc0 (sizeof (guint8*) * (depth + 2)); -+ njumps = 0; -+ -+ /* The vtable/mrgtx is in R0 */ -+ g_assert (MONO_ARCH_VTABLE_REG == ARMREG_R0); -+ -+ if (is_mrgctx) { -+ /* get mrgctx ptr */ -+ arm_movx (code, ARMREG_IP1, ARMREG_R0); -+ } else { -+ /* load rgctx ptr from vtable */ -+ code = mono_arm_emit_ldrx (code, ARMREG_IP1, ARMREG_R0, MONO_STRUCT_OFFSET (MonoVTable, runtime_generic_context)); -+ /* is the rgctx ptr null? */ -+ /* if yes, jump to actual trampoline */ -+ rgctx_null_jumps [njumps ++] = code; -+ arm_cbzx (code, ARMREG_IP1, 0); -+ } -+ -+ for (i = 0; i < depth; ++i) { -+ /* load ptr to next array */ -+ if (is_mrgctx && i == 0) { -+ code = mono_arm_emit_ldrx (code, ARMREG_IP1, ARMREG_IP1, MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT); -+ } else { -+ code = mono_arm_emit_ldrx (code, ARMREG_IP1, ARMREG_IP1, 0); -+ } -+ /* is the ptr null? */ -+ /* if yes, jump to actual trampoline */ -+ rgctx_null_jumps [njumps ++] = code; -+ arm_cbzx (code, ARMREG_IP1, 0); -+ } -+ -+ /* fetch slot */ -+ code = mono_arm_emit_ldrx (code, ARMREG_IP1, ARMREG_IP1, sizeof (gpointer) * (index + 1)); -+ /* is the slot null? */ -+ /* if yes, jump to actual trampoline */ -+ rgctx_null_jumps [njumps ++] = code; -+ arm_cbzx (code, ARMREG_IP1, 0); -+ /* otherwise return, result is in IP1 */ -+ arm_movx (code, ARMREG_R0, ARMREG_IP1); -+ arm_brx (code, ARMREG_LR); -+ -+ g_assert (njumps <= depth + 2); -+ for (i = 0; i < njumps; ++i) -+ mono_arm_patch (rgctx_null_jumps [i], code, MONO_R_ARM64_CBZ); -+ -+ g_free (rgctx_null_jumps); -+ -+ /* Slowpath */ -+ -+ /* Call mono_rgctx_lazy_fetch_trampoline (), passing in the slot as argument */ -+ /* The vtable/mrgctx is still in R0 */ -+ if (aot) { -+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, g_strdup_printf ("specific_trampoline_lazy_fetch_%u", slot)); -+ } else { -+ tramp = mono_arch_create_specific_trampoline (GUINT_TO_POINTER (slot), MONO_TRAMPOLINE_RGCTX_LAZY_FETCH, mono_get_root_domain (), &code_len); -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp); -+ } -+ arm_brx (code, ARMREG_IP0); -+ -+ mono_arch_flush_icache (buf, code - buf); -+ -+ g_assert (code - buf <= buf_size); -+ -+ if (info) { -+ char *name = mono_get_rgctx_fetch_trampoline_name (slot); -+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops); -+ g_free (name); -+ } -+ -+ return buf; -+} -+ -+gpointer -+mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *code, *buf; -+ int tramp_size; -+ MonoJumpInfo *ji = NULL; -+ GSList *unwind_ops = NULL; -+ -+ g_assert (aot); -+ -+ tramp_size = 32; -+ -+ code = buf = mono_global_codeman_reserve (tramp_size); -+ -+ mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, 0); -+ -+ // FIXME: Currently, we always go to the slow path. -+ /* Load trampoline addr */ -+ arm_ldrx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG, 8); -+ /* The vtable/mrgctx is in R0 */ -+ g_assert (MONO_ARCH_VTABLE_REG == ARMREG_R0); -+ arm_brx (code, ARMREG_IP0); -+ -+ mono_arch_flush_icache (buf, code - buf); -+ -+ g_assert (code - buf <= tramp_size); -+ -+ if (info) -+ *info = mono_tramp_info_create ("rgctx_fetch_trampoline_general", buf, code - buf, ji, unwind_ops); -+ -+ return buf; -+} -+ -+static gpointer -+handler_block_trampoline_helper (gpointer *ptr) -+{ -+ MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id); -+ return jit_tls->handler_block_return_address; -+} -+ -+gpointer -+mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot) -+{ -+ guint8 *tramp; -+ guint8 *code, *buf; -+ int tramp_size = 64; -+ MonoJumpInfo *ji = NULL; -+ GSList *unwind_ops = NULL; -+ -+ g_assert (!aot); -+ -+ code = buf = mono_global_codeman_reserve (tramp_size); -+ -+ unwind_ops = NULL; -+ -+ tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL); -+ -+ /* -+ This trampoline restore the call chain of the handler block then jumps into the code that deals with it. -+ */ -+ -+ /* -+ * We are in a method frame after the call emitted by OP_CALL_HANDLER. -+ */ -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)handler_block_trampoline_helper); -+ /* Set it as the return address so the trampoline will return to it */ -+ arm_movx (code, ARMREG_LR, ARMREG_IP0); -+ -+ /* Call the trampoline */ -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp); -+ arm_brx (code, ARMREG_IP0); -+ -+ mono_arch_flush_icache (buf, code - buf); -+ mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL); -+ g_assert (code - buf <= tramp_size); -+ -+ *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops); -+ -+ return buf; -+} -+ -+/* -+ * mono_arch_create_sdb_trampoline: -+ * -+ * Return a trampoline which captures the current context, passes it to -+ * debugger_agent_single_step_from_context ()/debugger_agent_breakpoint_from_context (), -+ * then restores the (potentially changed) context. -+ */ -+guint8* -+mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot) -+{ -+ int tramp_size = 512; -+ int offset, imm, frame_size, ctx_offset; -+ guint64 gregs_regset; -+ guint8 *code, *buf; -+ GSList *unwind_ops = NULL; -+ MonoJumpInfo *ji = NULL; -+ -+ code = buf = mono_global_codeman_reserve (tramp_size); -+ -+ /* Compute stack frame size and offsets */ -+ offset = 0; -+ /* frame block */ -+ offset += 2 * 8; -+ /* MonoContext */ -+ ctx_offset = offset; -+ offset += sizeof (MonoContext); -+ offset = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); -+ frame_size = offset; -+ -+ // FIXME: Unwind info -+ -+ /* Setup stack frame */ -+ imm = frame_size; -+ while (imm > 256) { -+ arm_subx_imm (code, ARMREG_SP, ARMREG_SP, 256); -+ imm -= 256; -+ } -+ arm_subx_imm (code, ARMREG_SP, ARMREG_SP, imm); -+ arm_stpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, 0); -+ arm_movspx (code, ARMREG_FP, ARMREG_SP); -+ -+ /* Initialize a MonoContext structure on the stack */ -+ /* No need to save fregs */ -+ gregs_regset = ~((1 << ARMREG_FP) | (1 << ARMREG_SP)); -+ code = mono_arm_emit_store_regarray (code, gregs_regset, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, regs)); -+ /* Save caller fp */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_FP, 0); -+ arm_strx (code, ARMREG_IP1, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_FP * 8)); -+ /* Save caller sp */ -+ arm_movx (code, ARMREG_IP1, ARMREG_FP); -+ imm = frame_size; -+ while (imm > 256) { -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 256); -+ imm -= 256; -+ } -+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, imm); -+ arm_strx (code, ARMREG_IP1, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_SP * 8)); -+ /* Save caller ip */ -+ arm_ldrx (code, ARMREG_IP1, ARMREG_FP, 8); -+ arm_strx (code, ARMREG_IP1, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, pc)); -+ -+ /* Call the single step/breakpoint function in sdb */ -+ /* Arg1 = ctx */ -+ arm_addx_imm (code, ARMREG_R0, ARMREG_FP, ctx_offset); -+ if (aot) { -+ if (single_step) -+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_single_step_from_context"); -+ else -+ code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_breakpoint_from_context"); -+ } else { -+ gpointer addr = single_step ? debugger_agent_single_step_from_context : debugger_agent_breakpoint_from_context; -+ -+ code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)addr); -+ } -+ arm_blrx (code, ARMREG_IP0); -+ -+ /* Restore ctx */ -+ /* Save fp/pc into the frame block */ -+ arm_ldrx (code, ARMREG_IP0, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_FP * 8)); -+ arm_strx (code, ARMREG_IP0, ARMREG_FP, 0); -+ arm_ldrx (code, ARMREG_IP0, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, pc)); -+ arm_strx (code, ARMREG_IP0, ARMREG_FP, 8); -+ gregs_regset = ~((1 << ARMREG_FP) | (1 << ARMREG_SP)); -+ code = mono_arm_emit_load_regarray (code, gregs_regset, ARMREG_FP, ctx_offset + G_STRUCT_OFFSET (MonoContext, regs)); -+ -+ code = mono_arm_emit_destroy_frame (code, frame_size, ((1 << ARMREG_IP0) | (1 << ARMREG_IP1))); -+ -+ arm_retx (code, ARMREG_LR); -+ -+ mono_arch_flush_icache (code, code - buf); -+ g_assert (code - buf <= tramp_size); -+ -+ const char *tramp_name = single_step ? "sdb_single_step_trampoline" : "sdb_breakpoint_trampoline"; -+ *info = mono_tramp_info_create (tramp_name, buf, code - buf, ji, unwind_ops); -+ -+ return buf; -+} -+ -+#else /* DISABLE_JIT */ -+ -+guchar* -+mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+guint8* -+mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gboolean aot) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+#endif /* !DISABLE_JIT */ -+ -+#if defined(MONO_ARCH_GSHAREDVT_SUPPORTED) -+ -+gpointer -+mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) -+{ -+ if (info) -+ *info = NULL; -+ return NULL; -+} -+ -+gpointer -+mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr) -+{ -+ g_assert_not_reached (); -+ return NULL; -+} -+ -+#endif /* !MONOTOUCH */ ---- mono-4.2.1.102+dfsg2.orig/mono/sgen/sgen-archdep.h -+++ mono-4.2.1.102+dfsg2/mono/sgen/sgen-archdep.h -@@ -89,7 +89,7 @@ - - /* MS_BLOCK_SIZE must be a multiple of the system pagesize, which for some - archs is 64k. */ --#if defined(TARGET_POWERPC64) && _CALL_ELF == 2 -+#if defined(TARGET_POWERPC64) - #define ARCH_MIN_MS_BLOCK_SIZE (64*1024) - #define ARCH_MIN_MS_BLOCK_SIZE_SHIFT 16 - #endif ---- mono-4.2.1.102+dfsg2.orig/mono/tests/Makefile.am -+++ mono-4.2.1.102+dfsg2/mono/tests/Makefile.am -@@ -356,7 +356,6 @@ BASE_TEST_CS_SRC= \ - modules.cs \ - bug-81673.cs \ - bug-81691.cs \ -- bug-80307.cs \ - bug-415577.cs \ - filter-stack.cs \ - vararg2.cs \ -@@ -387,8 +386,6 @@ BASE_TEST_CS_SRC= \ - bug-575941.cs \ - bug-599469.cs \ - bug-389886-3.cs \ -- monitor.cs \ -- monitor-resurrection.cs \ - dynamic-method-resurrection.cs \ - bug-666008.cs \ - bug-685908.cs \ -@@ -404,7 +401,6 @@ BASE_TEST_CS_SRC= \ - appdomain-unload-doesnot-raise-pending-events.cs \ - bug-6148.cs \ - assembly_append_ordering.cs \ -- bug-10127.cs \ - bug-18026.cs \ - allow-synchronous-major.cs \ - unload-appdomain-on-shutdown.cs \ ---- mono-4.2.1.102+dfsg2.orig/mono/utils/mono-context.h -+++ mono-4.2.1.102+dfsg2/mono/utils/mono-context.h -@@ -183,11 +183,11 @@ extern void mono_context_get_current (vo - #define MONO_CONTEXT_GET_CURRENT(ctx) \ - __asm__ __volatile__( \ - "movq $0x0, %%nacl:0x00(%%r15, %0, 1)\n" \ -- "movq %%rbx, %%nacl:0x08(%%r15, %0, 1)\n" \ -- "movq %%rcx, %%nacl:0x10(%%r15, %0, 1)\n" \ -- "movq %%rdx, %%nacl:0x18(%%r15, %0, 1)\n" \ -- "movq %%rbp, %%nacl:0x20(%%r15, %0, 1)\n" \ -- "movq %%rsp, %%nacl:0x28(%%r15, %0, 1)\n" \ -+ "movq %%rcx, %%nacl:0x08(%%r15, %0, 1)\n" \ -+ "movq %%rdx, %%nacl:0x10(%%r15, %0, 1)\n" \ -+ "movq %%rbx, %%nacl:0x18(%%r15, %0, 1)\n" \ -+ "movq %%rsp, %%nacl:0x20(%%r15, %0, 1)\n" \ -+ "movq %%rbp, %%nacl:0x28(%%r15, %0, 1)\n" \ - "movq %%rsi, %%nacl:0x30(%%r15, %0, 1)\n" \ - "movq %%rdi, %%nacl:0x38(%%r15, %0, 1)\n" \ - "movq %%r8, %%nacl:0x40(%%r15, %0, 1)\n" \ -@@ -204,14 +204,15 @@ extern void mono_context_get_current (vo - : "a" ((int64_t)&(ctx)) \ - : "rdx", "memory") - #else -+ - #define MONO_CONTEXT_GET_CURRENT(ctx) \ - __asm__ __volatile__( \ - "movq $0x0, 0x00(%0)\n" \ -- "movq %%rbx, 0x08(%0)\n" \ -- "movq %%rcx, 0x10(%0)\n" \ -- "movq %%rdx, 0x18(%0)\n" \ -- "movq %%rbp, 0x20(%0)\n" \ -- "movq %%rsp, 0x28(%0)\n" \ -+ "movq %%rcx, 0x08(%0)\n" \ -+ "movq %%rdx, 0x10(%0)\n" \ -+ "movq %%rbx, 0x18(%0)\n" \ -+ "movq %%rsp, 0x20(%0)\n" \ -+ "movq %%rbp, 0x28(%0)\n" \ - "movq %%rsi, 0x30(%0)\n" \ - "movq %%rdi, 0x38(%0)\n" \ - "movq %%r8, 0x40(%0)\n" \ ---- mono-4.2.1.102+dfsg2.orig/mono/utils/mono-threads-linux.c -+++ mono-4.2.1.102+dfsg2/mono/utils/mono-threads-linux.c -@@ -1,6 +1,6 @@ - #include - --#if defined(__linux__) && !defined(PLATFORM_ANDROID) -+#if (defined(__linux__) && !defined(PLATFORM_ANDROID)) || defined(__FreeBSD_kernel__) - - #include - #include ---- mono-4.2.1.102+dfsg2.orig/support/syslog.c -+++ mono-4.2.1.102+dfsg2/support/syslog.c -@@ -38,7 +38,16 @@ Mono_Posix_Syscall_closelog (void) - int - Mono_Posix_Syscall_syslog (int priority, const char* message) - { -+#ifdef __GNUC__ -+ #pragma GCC diagnostic push -+ #pragma GCC diagnostic ignored "-Wformat-security" -+#endif -+ - syslog (priority, message); -+ -+#ifdef __GNUC__ -+ #pragma GCC diagnostic pop -+#endif - return 0; - } - - diff --git a/packages/addons/tools/mono/source/default.py b/packages/addons/tools/mono/source/default.py deleted file mode 100644 index 67e12970fe..0000000000 --- a/packages/addons/tools/mono/source/default.py +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -import xbmcgui - -dialog = xbmcgui.Dialog() -dialog.ok('', 'This is a console-only addon') diff --git a/packages/addons/tools/multimedia-tools/changelog.txt b/packages/addons/tools/multimedia-tools/changelog.txt index 69ab4ac23c..73cfec2b8f 100644 --- a/packages/addons/tools/multimedia-tools/changelog.txt +++ b/packages/addons/tools/multimedia-tools/changelog.txt @@ -1,13 +1,36 @@ -8.0.103 +109 +- Update squeezelite to b2ed99e and support all possible media formats + +108 +- Update alsamixer to 1.1.6 +- Update mediainfo to 18.05 +- Update mpg123 to 1.25.10 +- Update squeezelite to b2ed99e +- Update tstools to db1f79f + +107 +- squeezelite: support all possible media formats + +106 +- Update squeezelite to 33cca7e +- Update Mediainfo to 17.10 + +105 +- rebuild + +104 +- squeezelite: update to a3d95ec and link audio libraries + +103 - Add alsamixer - Update mpg123 to 1.23.6 - Update squeezelite to 33cca7e -8.0.102 +102 - Remove IR support from squeezelite -8.0.101 +101 - Add mpg123 and squeezelite -8.0.100 +100 - Initial Release diff --git a/packages/addons/tools/multimedia-tools/package.mk b/packages/addons/tools/multimedia-tools/package.mk index a802b6637b..f4d4190cc6 100644 --- a/packages/addons/tools/multimedia-tools/package.mk +++ b/packages/addons/tools/multimedia-tools/package.mk @@ -1,27 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="multimedia-tools" -PKG_VERSION="" -PKG_REV="103" +PKG_VERSION="1.0" +PKG_REV="109" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="virtual" @@ -31,9 +16,7 @@ PKG_LONGDESC="This bundle currently includes alsamixer, mediainfo, mesa-demos, m PKG_IS_ADDON="yes" PKG_ADDON_NAME="Multimedia Tools" PKG_ADDON_TYPE="xbmc.python.script" -PKG_ADDON_PROVIDES="" -PKG_AUTORECONF="no" PKG_DEPENDS_TARGET="toolchain \ alsa-utils \ @@ -72,6 +55,4 @@ addon() { # tstools cp -P $(get_build_dir tstools)/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin/ - - debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/tools/multimedia-tools/source/default.py b/packages/addons/tools/multimedia-tools/source/default.py index 67e12970fe..08bebb1487 100644 --- a/packages/addons/tools/multimedia-tools/source/default.py +++ b/packages/addons/tools/multimedia-tools/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui diff --git a/packages/addons/tools/network-tools/changelog.txt b/packages/addons/tools/network-tools/changelog.txt index f6abfd1747..b50fd4f032 100644 --- a/packages/addons/tools/network-tools/changelog.txt +++ b/packages/addons/tools/network-tools/changelog.txt @@ -1,2 +1,25 @@ -8.0.100 +103 +- added rar2fs +- updated iperf to 3.6 +- updated irssi to 1.1.2 +- updated lftp to 4.8.4 + +102 +- updated iperf to 3.5 +- updated irssi to 1.1.1 +- updated iw to 4.14 +- updated lftp to 4.8.3 +- updated ncftp to 3.2.6 +- updated ngrep to latest +- updated nmap to 7.70 +- updated rsync to 3.1.3 +- updated sshfs to 2.10 +- updated tcpdump to 4.9.2 +- updated udpxy to 1.0.23-12 +- updated wireless_tools to 30.pre9 + +101 +- rebuild + +100 - Initial Release diff --git a/packages/addons/tools/network-tools/package.mk b/packages/addons/tools/network-tools/package.mk index 5cb0148251..a0aa5482e7 100644 --- a/packages/addons/tools/network-tools/package.mk +++ b/packages/addons/tools/network-tools/package.mk @@ -1,39 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="network-tools" -PKG_VERSION="" -PKG_REV="100" +PKG_VERSION="1.0" +PKG_REV="103" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="virtual" PKG_SHORTDESC="A bundle of network tools and programs" -PKG_LONGDESC="This bundle currently includes bwm-ng, iftop, iperf, irssi, iw, lftp, ncftp, ngrep, nmap, rsync, sshfs, tcpdump, udpxy and wireless_tools." +PKG_LONGDESC="This bundle currently includes bwm-ng, iftop, iperf, irssi, iw, lftp, ncftp, ngrep, nmap, rar2fs, rsync, sshfs, tcpdump, udpxy and wireless_tools." PKG_IS_ADDON="yes" PKG_ADDON_NAME="Network Tools" PKG_ADDON_TYPE="xbmc.python.script" -PKG_ADDON_PROVIDES="" - -PKG_AUTORECONF="no" PKG_DEPENDS_TARGET="toolchain \ bwm-ng \ @@ -45,6 +27,7 @@ PKG_DEPENDS_TARGET="toolchain \ ncftp \ ngrep \ nmap \ + rar2fs \ rsync \ sshfs \ tcpdump \ @@ -52,7 +35,7 @@ PKG_DEPENDS_TARGET="toolchain \ wireless_tools" addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin # bwm-ng cp -P $(get_build_dir bwm-ng)/.$TARGET_NAME/src/bwm-ng $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -85,6 +68,10 @@ addon() { # nmap cp -P $(get_build_dir nmap)/nmap $ADDON_BUILD/$PKG_ADDON_ID/bin + # rar2fs + cp -P $(get_build_dir rar2fs)/.$TARGET_NAME/mkr2i $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir rar2fs)/.$TARGET_NAME/rar2fs $ADDON_BUILD/$PKG_ADDON_ID/bin + # rsync cp -P $(get_build_dir rsync)/.$TARGET_NAME/rsync $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -95,7 +82,7 @@ addon() { cp -P $(get_build_dir tcpdump)/.$TARGET_NAME/tcpdump $ADDON_BUILD/$PKG_ADDON_ID/bin # udpxy - cp -P $(get_build_dir udpxy)/udpxy $ADDON_BUILD/$PKG_ADDON_ID/bin/ + cp -P $(get_build_dir udpxy)/udpxy $ADDON_BUILD/$PKG_ADDON_ID/bin # wireless_tools cp -P $(get_build_dir wireless_tools)/iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -104,6 +91,4 @@ addon() { ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwlist ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwspy ln -s iwmulticall $ADDON_BUILD/$PKG_ADDON_ID/bin/iwpriv - - debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/tools/network-tools/source/default.py b/packages/addons/tools/network-tools/source/default.py index 67e12970fe..08bebb1487 100644 --- a/packages/addons/tools/network-tools/source/default.py +++ b/packages/addons/tools/network-tools/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui diff --git a/packages/addons/tools/rpi-tools/changelog.txt b/packages/addons/tools/rpi-tools/changelog.txt index a5f6cd5efa..5a95ca3074 100644 --- a/packages/addons/tools/rpi-tools/changelog.txt +++ b/packages/addons/tools/rpi-tools/changelog.txt @@ -1,8 +1,19 @@ -8.0.102 -- move Adafruit modules to adafruit-libraries +105 +- Update gpiozero to 1.4.1 +- Update picamera to 1.13 +- Update RPi.GPIO to 0.6.3 -8.0.101 -- add Adafruit python modules (LED_Backpack, GPIO, PureIO) +104 +- Add lan951x-led-ctl to control LEDs connected to LAN9512/LAN9514 -8.0.100 +103 +- Rebuild + +102 +- Move Adafruit modules to adafruit-libraries + +101 +- Add Adafruit python modules (LED_Backpack, GPIO, PureIO) + +100 - Initial Release diff --git a/packages/addons/tools/rpi-tools/package.mk b/packages/addons/tools/rpi-tools/package.mk index 9f93873319..fee23dcf93 100644 --- a/packages/addons/tools/rpi-tools/package.mk +++ b/packages/addons/tools/rpi-tools/package.mk @@ -1,41 +1,24 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="rpi-tools" -PKG_VERSION="" -PKG_REV="102" +PKG_VERSION="1.0" +PKG_REV="105" PKG_ARCH="arm" PKG_LICENSE="GPL" -PKG_SITE="" +PKG_SITE="https://libreelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain RPi.GPIO picamera gpiozero" +PKG_DEPENDS_TARGET="toolchain RPi.GPIO picamera gpiozero lan951x-led-ctl" PKG_SECTION="virtual" PKG_SHORTDESC="A bundle of tools and programs for use on the Raspberry Pi" -PKG_LONGDESC="This bundle currently includes RPi.GPIO, picamera, gpiozero python modules" +PKG_LONGDESC="This bundle currently includes RPi.GPIO, picamera, gpiozero lan951x-led-ctl" PKG_DISCAIMER="Raspberry Pi is a trademark of the Raspberry Pi Foundation http://www.raspberrypi.org" PKG_IS_ADDON="yes" PKG_ADDON_NAME="Raspberry Pi Tools" PKG_ADDON_TYPE="xbmc.python.module" -PKG_ADDON_PROVIDES="" -PKG_ADDON_PROJECTS="RPi RPi2" +PKG_ADDON_PROJECTS="RPi" -PKG_AUTORECONF="no" addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/RPi/ @@ -49,4 +32,7 @@ addon() { cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspiyuv $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspivid $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $BCM2835_DIR/hardfp/opt/vc/bin/raspividyuv $ADDON_BUILD/$PKG_ADDON_ID/bin + + # lan951x-led-ctl + cp -P $(get_build_dir lan951x-led-ctl)/lan951x-led-ctl $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/tools/rpi-tools/source/default.py b/packages/addons/tools/rpi-tools/source/default.py index 880a196075..08bebb1487 100644 --- a/packages/addons/tools/rpi-tools/source/default.py +++ b/packages/addons/tools/rpi-tools/source/default.py @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui diff --git a/packages/addons/tools/system-tools/changelog.txt b/packages/addons/tools/system-tools/changelog.txt index e3c24fc38a..96c00c7cac 100644 --- a/packages/addons/tools/system-tools/changelog.txt +++ b/packages/addons/tools/system-tools/changelog.txt @@ -1,11 +1,66 @@ +111 +- updated autossh to 1.4g +- updated file to d1ff3af +- updated htop to 3.0.0 Beta5 +- updated jq to 1.6 +- updated lm_sensors to e8afbda +- updated patch to 2.7.6 +- updated pv to 1.6.6 +- updated smartmontools to 7.0 +- updated strace to 4.26 +- updated stress-ng to 0.09.50 +- updated unrar to 5.6.8 + +110 +- updated and improved mc (4.8.21) +- using more compatible "xterm" TERM definition +- updated efibootmgr to 17 +- fixed screen + +109 +- added stress-ng + +108 +- added encfs and smartmontools +- updated autossh to 1.4f +- updated file to 5.33 +- updated htop to 3.0.0 Beta4 +- updated inotify-tools to 3.20.1 +- updated lm_sensors to 1c48b19 +- updated mc to 4.8.20 +- updated screen to 4.6.2 +- updated strace to 4.22 +- updated unrar to 5.6.3 + +107 +- added dstat, htop and vim +- updated difftools to 3.6 +- updated dtach to 0.9 +- updated fdupes to 1.6.1 +- updated file to 5.31 +- updated hd-idle to 1.05 +- updated hddtemp to 0.3-beta16 +- updated hid_mapper to 2.1.0 +- updated libmtp to 1.1.13 +- updated lm_sensors to 0d5ccf6 +- updated lshw to 2.18 +- updated mc to 4.8.19 +- updated mtpfs to fd3864d +- updated p7zip to 16.02 +- updated strace to 4.17 +- updated unrar to 5.5.5 + +106 +- updated screen, fix colors issue + 104 -- Bump file package +- updated file package 103 -- Add nmon +- added nmon 102 -- Add inotify-tools, mc +- added inotify-tools, mc 101 - mrxvt can be started from KODI diff --git a/packages/addons/tools/system-tools/package.mk b/packages/addons/tools/system-tools/package.mk index 63941c2e97..84d14418fd 100644 --- a/packages/addons/tools/system-tools/package.mk +++ b/packages/addons/tools/system-tools/package.mk @@ -1,45 +1,29 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="system-tools" -PKG_VERSION="" -PKG_REV="104" +PKG_VERSION="1.0" +PKG_REV="111" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="virtual" PKG_SHORTDESC="A bundle of system tools and programs" -PKG_LONGDESC="This bundle currently includes autossh, diffutils, dtach, efibootmgr, evtest, fdupes, file, getscancodes, hddtemp, hd-idle, hid_mapper, i2c-tools, inotify-tools, jq, lm_sensors, lshw, mc, mrxvt, mtpfs, nmon, p7zip, patch, pv, screen, strace, unrar and usb-modeswitch." +PKG_LONGDESC="This bundle currently includes autossh, diffutils, dstat, dtach, efibootmgr, encfs, evtest, fdupes, file, getscancodes, hddtemp, hd-idle, hid_mapper, htop, i2c-tools, inotify-tools, jq, lm_sensors, lshw, mc, mrxvt, mtpfs, nmon, p7zip, patch, pv, screen, smartmontools, strace, stress-ng, unrar, usb-modeswitch and vim." PKG_IS_ADDON="yes" PKG_ADDON_NAME="System Tools" PKG_ADDON_TYPE="xbmc.python.script" -PKG_ADDON_PROVIDES="" - -PKG_AUTORECONF="no" PKG_DEPENDS_TARGET="toolchain \ autossh \ diffutils \ + dstat \ dtach \ efibootmgr \ + encfs \ evtest \ fdupes \ file \ @@ -47,6 +31,7 @@ PKG_DEPENDS_TARGET="toolchain \ hddtemp \ hd-idle \ hid_mapper \ + htop \ i2c-tools \ inotify-tools \ jq \ @@ -60,9 +45,12 @@ PKG_DEPENDS_TARGET="toolchain \ patch \ pv \ screen \ + smartmontools \ strace \ + stress-ng \ unrar \ - usb-modeswitch" + usb-modeswitch \ + vim" addon() { mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/ @@ -77,11 +65,18 @@ addon() { cp -P $(get_build_dir diffutils)/.$TARGET_NAME/src/diff3 $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $(get_build_dir diffutils)/.$TARGET_NAME/src/sdiff $ADDON_BUILD/$PKG_ADDON_ID/bin + # dstat + cp -P $(get_build_dir dstat)/dstat $ADDON_BUILD/$PKG_ADDON_ID/bin + # dtach cp -P $(get_build_dir dtach)/.$TARGET_NAME/dtach $ADDON_BUILD/$PKG_ADDON_ID/bin # efibootmgr - cp -P $(get_build_dir efibootmgr)/src/efibootmgr/efibootmgr $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + cp -P $(get_build_dir efibootmgr)/src/efibootmgr $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : + + # encfs + cp -P $(get_build_dir encfs)/.$TARGET_NAME/encfs $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir encfs)/.$TARGET_NAME/encfsctl $ADDON_BUILD/$PKG_ADDON_ID/bin # evtest cp -P $(get_build_dir evtest)/.$TARGET_NAME/evtest $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -98,7 +93,7 @@ addon() { # hddtemp cp -P $(get_build_dir hddtemp)/.$TARGET_NAME/src/hddtemp $ADDON_BUILD/$PKG_ADDON_ID/bin - cp -P $(get_build_dir hddtemp)/debian/hddtemp.db $ADDON_BUILD/$PKG_ADDON_ID/data + cp -P $(get_build_dir hddtemp)/hddtemp.db $ADDON_BUILD/$PKG_ADDON_ID/data # hd-idle cp -P $(get_build_dir hd-idle)/hd-idle $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -106,6 +101,9 @@ addon() { # hid_mapper cp -P $(get_build_dir hid_mapper)/hid_mapper $ADDON_BUILD/$PKG_ADDON_ID/bin + # htop + cp -P $(get_build_dir htop)/.install_pkg/usr/bin/htop $ADDON_BUILD/$PKG_ADDON_ID/bin + # i2c-tools cp -P $(get_build_dir i2c-tools)/tools/i2cdetect $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $(get_build_dir i2c-tools)/tools/i2cdump $ADDON_BUILD/$PKG_ADDON_ID/bin @@ -119,6 +117,7 @@ addon() { # jq cp -P $(get_build_dir jq)/.$TARGET_NAME/jq $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $(get_build_dir oniguruma)/.install_pkg/usr/lib/libonig.so $ADDON_BUILD/$PKG_ADDON_ID/lib # lm_sensors cp -P $(get_build_dir lm_sensors)/prog/sensors/sensors $ADDON_BUILD/$PKG_ADDON_ID/bin 2>/dev/null || : @@ -154,14 +153,21 @@ addon() { # screen cp -P $(get_build_dir screen)/screen $ADDON_BUILD/$PKG_ADDON_ID/bin + # smartmontools + cp -P $(get_build_dir smartmontools)/.$TARGET_NAME/smartctl $ADDON_BUILD/$PKG_ADDON_ID/bin + # strace cp -P $(get_build_dir strace)/.$TARGET_NAME/strace $ADDON_BUILD/$PKG_ADDON_ID/bin + # stress-ng + cp -P $(get_build_dir stress-ng)/.install_pkg/usr/bin/stress-ng $ADDON_BUILD/$PKG_ADDON_ID/bin + # unrar cp -P $(get_build_dir unrar)/unrar $ADDON_BUILD/$PKG_ADDON_ID/bin # usb-modeswitch cp -P $(get_build_dir usb-modeswitch)/usb_modeswitch $ADDON_BUILD/$PKG_ADDON_ID/bin - debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin + # vim + cp -P $(get_build_dir vim)/.install_pkg/usr/bin/vim $ADDON_BUILD/$PKG_ADDON_ID/bin } diff --git a/packages/addons/tools/system-tools/source/default.py b/packages/addons/tools/system-tools/source/default.py index 347208b8b7..fefa4dd76f 100644 --- a/packages/addons/tools/system-tools/source/default.py +++ b/packages/addons/tools/system-tools/source/default.py @@ -1,25 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) import xbmcgui import subprocess yes = xbmcgui.Dialog().yesno('', 'This is a console-only addon','','Open a terminal window?','No','Yes') if yes: - subprocess.Popen(["systemd-run","sh","-c",". /etc/profile;exec mrxvt"], shell=False, close_fds=True) + subprocess.Popen(["systemd-run","sh","-c",". /etc/profile;cd;exec mrxvt -ls"], shell=False, close_fds=True) diff --git a/packages/audio/alsa-lib/package.mk b/packages/audio/alsa-lib/package.mk index 5cf3c6ac8c..e32803a049 100644 --- a/packages/audio/alsa-lib/package.mk +++ b/packages/audio/alsa-lib/package.mk @@ -1,54 +1,28 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="alsa-lib" -PKG_VERSION="1.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.1.8" +PKG_SHA256="3cdc3a93a6427a26d8efab4ada2152e64dd89140d981f6ffa003e85be707aedf" PKG_LICENSE="GPL" PKG_SITE="http://www.alsa-project.org/" -PKG_URL="ftp://ftp.alsa-project.org/pub/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="ftp://ftp.alsa-project.org/pub/lib/alsa-lib-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="alsa-lib: Advanced Linux Sound Architecture library" -PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API. It provides much finer (->better) access to the sound hardware, has a unbeatable mixer API and supports stuff like multi channel hardware, digital outs and ins, uninterleaved sound data access, and an oss emulation layer (for the old applications). It is the prefered API for professional sound apps under Linux." +PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -if [ "$DEBUG" = yes ]; then - ALSA_DEBUG=--with-debug +if build_with_debug; then + PKG_ALSA_DEBUG=--with-debug else - ALSA_DEBUG=--without-debug + PKG_ALSA_DEBUG=--without-debug fi -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--with-plugindir=/usr/lib/alsa \ - --disable-python \ - $ALSA_DEBUG \ - --disable-dependency-tracking" - -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" - - # alsa-lib fails building with LTO support - strip_lto -} +PKG_CONFIGURE_OPTS_TARGET="$PKG_ALSA_DEBUG \ + --disable-dependency-tracking \ + --with-plugindir=/usr/lib/alsa \ + --disable-python" post_configure_target() { sed -i 's/.*PKGLIBDIR.*/#define PKGLIBDIR ""/' include/config.h diff --git a/packages/audio/alsa-lib/patches/alsa-lib-USB_Soundblaster_HD.patch b/packages/audio/alsa-lib/patches/alsa-lib-USB_Soundblaster_HD.patch deleted file mode 100644 index 3cadfedb6e..0000000000 --- a/packages/audio/alsa-lib/patches/alsa-lib-USB_Soundblaster_HD.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 982c628f484266c8db4f70dc1e856bc7844c1873 Mon Sep 17 00:00:00 2001 -From: Patrick Rasmussen -Date: Fri, 13 Mar 2015 14:52:56 +0100 -Subject: [PATCH] Add USB Sound Blaster HD - ---- - src/conf/cards/USB-Audio.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 4cbf85e..2591d00 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -62,6 +62,7 @@ USB-Audio.pcm.iec958_device { - # Second iec958 device number, if any. - USB-Audio.pcm.iec958_2_device { - "PHIREE U2" 1 # 0 = PCM S/PDIF, 1 = non-PCM S/PDIF -+ "USB Sound Blaster HD" 1 - } - - --- -2.1.4 diff --git a/packages/audio/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch b/packages/audio/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch index ed24c9a685..9435bef363 100644 --- a/packages/audio/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch +++ b/packages/audio/alsa-lib/patches/alsa-lib-asound.conf_configdir.patch @@ -1,9 +1,10 @@ -diff -Naur alsa-lib-1.0.25/src/conf/alsa.conf alsa-lib-1.0.25.patch/src/conf/alsa.conf ---- alsa-lib-1.0.25/src/conf/alsa.conf 2012-01-25 08:56:56.000000000 +0100 -+++ alsa-lib-1.0.25.patch/src/conf/alsa.conf 2012-03-26 01:05:47.913335895 +0200 -@@ -16,7 +16,8 @@ - ] - } +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index bb00ff40..cba5b6f2 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -10,7 +10,8 @@ + files [ + "/etc/alsa/conf.d" "/etc/asound.conf" - "~/.asoundrc" + "/run/asound.conf" diff --git a/packages/audio/alsa-utils/package.mk b/packages/audio/alsa-utils/package.mk index 2e6b100789..0416893daa 100644 --- a/packages/audio/alsa-utils/package.mk +++ b/packages/audio/alsa-utils/package.mk @@ -1,45 +1,24 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="alsa-utils" -PKG_VERSION="1.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.1.8" +PKG_SHA256="fd9bf528922b3829a91913b89a1858c58a0b24271a7b5f529923aa9ea12fa4cf" PKG_LICENSE="GPL" PKG_SITE="http://www.alsa-project.org/" -PKG_URL="ftp://ftp.alsa-project.org/pub/utils/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain alsa-lib netbsd-curses" -PKG_SECTION="audio" -PKG_SHORTDESC="alsa-utils: Advanced Linux Sound Architecture utilities" +PKG_URL="ftp://ftp.alsa-project.org/pub/utils/alsa-utils-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain alsa-lib ncurses" PKG_LONGDESC="This package includes the utilities for ALSA, like alsamixer, aplay, arecord, alsactl, iecset and speaker-test." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \ - --disable-xmlto \ - --disable-alsaconf \ +PKG_CONFIGURE_OPTS_TARGET="--disable-alsaconf \ --disable-alsaloop \ --enable-alsatest \ --disable-bat \ - --disable-nls" - + --disable-dependency-tracking \ + --disable-nls \ + --disable-rst2man \ + --disable-xmlto" post_makeinstall_target() { rm -rf $INSTALL/lib $INSTALL/var @@ -51,7 +30,7 @@ post_makeinstall_target() { # so we avoid resetting our soundconfig rm -rf $INSTALL/usr/lib/udev/rules.d/90-alsa-restore.rules - for i in aconnect alsamixer alsaucm amidi aplaymidi arecord arecordmidi aseqdump aseqnet iecset; do + for i in aconnect alsamixer amidi aplaymidi arecord arecordmidi aseqdump aseqnet iecset; do rm -rf $INSTALL/usr/bin/$i done diff --git a/packages/audio/alsa-utils/scripts/soundconfig b/packages/audio/alsa-utils/scripts/soundconfig index 0156bf8376..e9896580bb 100755 --- a/packages/audio/alsa-utils/scripts/soundconfig +++ b/packages/audio/alsa-utils/scripts/soundconfig @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # setup alsa (especially the mixer config) diff --git a/packages/audio/alsa-utils/udev.d/90-alsa-restore.rules b/packages/audio/alsa-utils/udev.d/90-alsa-restore.rules index fb381d00ba..3fa0a600bf 100644 --- a/packages/audio/alsa-utils/udev.d/90-alsa-restore.rules +++ b/packages/audio/alsa-utils/udev.d/90-alsa-restore.rules @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # When a sound device is detected, restore the volume settings KERNEL=="controlC[0-9]*", NAME="snd/%k", ACTION=="add", RUN+="soundconfig %k" diff --git a/packages/audio/asplib/package.mk b/packages/audio/asplib/package.mk deleted file mode 100644 index 9218b03077..0000000000 --- a/packages/audio/asplib/package.mk +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="asplib" -PKG_VERSION="da66f51" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/AchimTuran/asplib" -PKG_URL="https://github.com/AchimTuran/asplib/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="asplib: Achim's Signal Processing LIBrary" -PKG_LONGDESC="asplib is a small and lightweight C++ library for digital signal processing." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -CXXFLAGS="$CXXFLAGS -DTARGET_LINUX" diff --git a/packages/audio/asplib/patches/asplib-cmake.patch b/packages/audio/asplib/patches/asplib-cmake.patch deleted file mode 100644 index d4f5556b97..0000000000 --- a/packages/audio/asplib/patches/asplib-cmake.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff -Naur a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2016-03-09 15:16:52.000000000 -0800 -+++ b/CMakeLists.txt 2016-03-30 22:45:01.502582518 -0700 -@@ -1,46 +1,15 @@ - project(asplib) - - cmake_minimum_required(VERSION 2.6) --enable_language(CXX) - --set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}) -- --include(cmake/UseMultiArch.cmake) - include(cmake/asplib_helpers.cmake) - - set(asplib_NAME asplib) - set(asplib_DESCRIPTION "asplib (Achim's Signal Processing LIBrary), is a small and lightweight C++ library for digital signal processing.") --set(asplib_VERSION_MAJOR 0) --set(asplib_VERSION_MINOR 2) --set(asplib_VERSION_PATCH 0) -- --if(NOT WIN32) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") --endif() -- --if(CMAKE_SYSTEM_NAME MATCHES "Linux") -- set(CMAKE_CXX_FLAGS "-DTARGET_LINUX") --endif() -- --if(CMAKE_SYSTEM_NAME MATCHES "Windows") -- set(CMAKE_CXX_FLAGS "-DTARGET_WINDOWS") -- # Enable the orginization of projects with folders -- set_property(GLOBAL PROPERTY USE_FOLDERS ON) --endif() -- --if (NOT WIN32) -- add_definitions(-fPIC -g -O2) --endif() -- --set(asplib_INCLUDE_DIRS ${PROJECT_SOURCE_DIR} -- ${PROJECT_SOURCE_DIR}/Biquads -- ${CMAKE_INSTALL_PREFIX}/include/asplib) -- --include_directories(${asplib_INCLUDE_DIRS}) - - set(SOURCES Biquads/Biquad_Native/asplib_Biquad_Native.cpp - Biquads/apslib_BiquadFactory.cpp) -- -+ - set(HEADERS interfaces/asplib_IBaseBiquad.h - Biquads/apslib_BiquadFactory.h - Biquads/Biquad_Native/asplib_Biquad_Native.h -@@ -54,35 +23,13 @@ - asplib_utils/os/linux/linux_definitions.h - asplib_utils/os/raspberry_pi/raspberry_pi_definitions.h - asplib_utils/os/windows/windows_definitions.h) -- --asplib_source_group("${SOURCES}") --asplib_source_group("${HEADERS}") - --add_library(asplib ${SOURCES} ${HEADERS}) --target_link_libraries(asplib ${asplib_LIBRARIES}) --set_target_properties(asplib PROPERTIES VERSION ${asplib_VERSION_MAJOR}.${asplib_VERSION_MINOR}.${asplib_VERSION_PATCH} -- SOVERSION ${asplib_VERSION_MAJOR}.0) -+asplib_install_with_folder("${HEADERS}" ${CMAKE_INSTALL_PREFIX}/include/asplib) - -+add_library(asplib STATIC ${SOURCES} ${HEADERS}) - --install(TARGETS asplib DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+include_directories(${PROJECT_SOURCE_DIR} -+ ${PROJECT_SOURCE_DIR}/Biquads) - -+install(TARGETS asplib DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - asplib_install_with_folder("${HEADERS}" ${CMAKE_INSTALL_PREFIX}/include/asplib) -- --IF(NOT WIN32) -- # Pkgconfig -- include(cmake/PkgConfigHandler.cmake) -- configure_pc_file(asplib asplib.pc.in -- asplib.pc -- ${CMAKE_INSTALL_PREFIX} -- ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} -- ${CMAKE_INSTALL_PREFIX}/include) -- -- install(FILES ${CMAKE_BINARY_DIR}/asplib.pc -- DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/pkgconfig) --ENDIF(NOT WIN32) -- --# config mode --configure_file(asplib-config.cmake.in -- asplib-config.cmake @ONLY) --install(FILES ${CMAKE_BINARY_DIR}/asplib-config.cmake -- DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/asplib) diff --git a/packages/audio/dcadec/package.mk b/packages/audio/dcadec/package.mk new file mode 100644 index 0000000000..efbcfaea01 --- /dev/null +++ b/packages/audio/dcadec/package.mk @@ -0,0 +1,46 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="dcadec" +PKG_VERSION="0e07438" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/foo86/dcadec" +PKG_URL="https://github.com/foo86/dcadec/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="audio" +PKG_SHORTDESC="DTS Coherent Acoustics decoder with support for HD extensions" +PKG_LONGDESC="DTS Coherent Acoustics decoder with support for HD extensions" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +# todo: we need to build as shared library, otherwise sond dont work +# in kodi with enabled dcadec support and we have 100% CPU usage +# (to test disable passtrough and use a DTS-HD sample) +PKG_MAKE_OPTS_TARGET="PREFIX=/usr BINDIR=/usr/bin LIBDIR=/usr/lib INCLUDEDIR=/usr/include PKG_CONFIG_PATH=/usr/lib/pkgconfig CONFIG_SHARED=1" +PKG_MAKEINSTALL_OPTS_TARGET="$PKG_MAKE_OPTS_TARGET" + +pre_configure_target() { + export CFLAGS="$CFLAGS -fPIC -DPIC" + export LDFLAGS="$LDFLAGS -fPIC -DPIC" +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/audio/espeak/package.mk b/packages/audio/espeak/package.mk index 88c6c1a56d..8fbccc15c2 100644 --- a/packages/audio/espeak/package.mk +++ b/packages/audio/espeak/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="espeak" PKG_VERSION="1.48.04-source" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="bf9a17673adffcc28ff7ea18764f06136547e97bbd9edf2ec612f09b207f0659" PKG_LICENSE="GPL" PKG_SITE="http://espeak.sourceforge.net/" PKG_URL="http://sourceforge.net/projects/espeak/files/espeak/espeak-1.48/$PKG_NAME-$PKG_VERSION.zip" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="Text to Speech engine for English, with support for other languages" PKG_LONGDESC="Text to Speech engine for English, with support for other languages" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" pre_make_target() { cp src/portaudio19.h src/portaudio.h diff --git a/packages/audio/flac/package.mk b/packages/audio/flac/package.mk index a2700c2668..856a988642 100644 --- a/packages/audio/flac/package.mk +++ b/packages/audio/flac/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="flac" -PKG_VERSION="1.3.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.3.2" +PKG_SHA256="91cfc3ed61dc40f47f050a109b08610667d73477af6ef36dcad31c31a4a8d53f" PKG_LICENSE="GPLv2" PKG_SITE="https://xiph.org/flac/" PKG_URL="http://downloads.xiph.org/releases/flac/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain libogg" -PKG_SECTION="audio" -PKG_SHORTDESC="flac: An Free Lossless Audio Codec" -PKG_LONGDESC="Grossly oversimplified, FLAC is similar to MP3, but lossless, meaning that audio is compressed in FLAC without throwing away any information. This is similar to how Zip works, except with FLAC you will get much better compression because it is designed specifically for audio." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="An Free Lossless Audio Codec." +PKG_TOOLCHAIN="autotools" +# flac-1.3.1 dont build with LTO support +PKG_BUILD_FLAGS="+pic" # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--enable-static \ @@ -44,19 +26,12 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --with-ogg=$SYSROOT_PREFIX/usr \ --with-gnu-ld" -if [ $TARGET_ARCH = "x86_64" ]; then +if target_has_feature sse; then PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-sse" else PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-sse" fi -pre_configure_target() { - # flac-1.3.1 dont build with LTO support - strip_lto - - export CFLAGS="$CFLAGS -fPIC -DPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin } diff --git a/packages/audio/flac/patches/flac-1.3.1-debug.patch b/packages/audio/flac/patches/flac-1.3.1-debug.patch deleted file mode 100644 index d42fd31c74..0000000000 --- a/packages/audio/flac/patches/flac-1.3.1-debug.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -Naur flac-1.3.1/configure.ac flac-1.3.1.patch/configure.ac ---- flac-1.3.1/configure.ac 2014-11-27 03:45:33.000000000 +0100 -+++ flac-1.3.1.patch/configure.ac 2015-01-24 20:19:19.119178172 +0100 -@@ -348,11 +348,10 @@ - - if test "x$debug" = xtrue; then - CPPFLAGS="-DDEBUG $CPPFLAGS" -- CFLAGS=$(echo "$CFLAGS" | sed 's/-g//') - CFLAGS="-g $CFLAGS" - else - CPPFLAGS="-DNDEBUG $CPPFLAGS" -- CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//') -+ CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//') - CFLAGS="-O3 -funroll-loops $CFLAGS" - fi - diff --git a/packages/audio/fluidsynth/package.mk b/packages/audio/fluidsynth/package.mk index f3a6ad40af..2971eeb67d 100644 --- a/packages/audio/fluidsynth/package.mk +++ b/packages/audio/fluidsynth/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="fluidsynth" PKG_VERSION="1.1.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="d28b47dfbf7f8e426902ae7fa2981d821fbf84f41da9e1b85be933d2d748f601" PKG_LICENSE="GPL" PKG_SITE="http://fluidsynth.org/" PKG_URL="$SOURCEFORGE_SRC/project/fluidsynth/fluidsynth-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="FluidSynth: A SoundFont Synthesizer." -PKG_LONGDESC="FluidSynth renders midi music files as raw audio data, for playing or conversion. " - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="FluidSynth renders midi music files as raw audio data, for playing or conversion." +PKG_BUILD_FLAGS="+pic" PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=0 \ -Denable-readline=0 \ diff --git a/packages/audio/lame/package.mk b/packages/audio/lame/package.mk index 68cda3a160..04554d3e07 100644 --- a/packages/audio/lame/package.mk +++ b/packages/audio/lame/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="lame" PKG_VERSION="3.99.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff" PKG_LICENSE="LGPL" PKG_SITE="http://lame.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/lame/lame/3.99/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="lame: LAME Ain't an Mp3 Encoder" -PKG_LONGDESC="LAME originally stood for LAME Ain't an Mp3 Encoder. The goal of the LAME project is to use the open source model to improve the psycho acoustics, noise shaping and speed of MP3. Another goal of the LAME project is to use these improvements for the basis of a patent free audio compression codec for the GNU project." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A high quality MPEG Audio Layer III (MP3) encoder." +PKG_BUILD_FLAGS="-parallel +pic" # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--enable-static \ @@ -50,8 +30,3 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --with-gnu-ld \ --with-fileio=lame \ GTK_CONFIG=no" - -post_make_target() { - # dont build parallel - MAKEFLAGS=-j1 -} diff --git a/packages/audio/libcdio/package.mk b/packages/audio/libcdio/package.mk index b238c30965..f637279333 100644 --- a/packages/audio/libcdio/package.mk +++ b/packages/audio/libcdio/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libcdio" PKG_VERSION="0.94" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="96e2c903f866ae96f9f5b9048fa32db0921464a2286f5b586c0f02699710025a" PKG_LICENSE="GPLv3" PKG_SITE="https://www.gnu.org/software/libcdio/" PKG_URL="http://ftpmirror.gnu.org/libcdio/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="libcdio: A CD-ROM reading and control library" -PKG_LONGDESC="This library is to encapsulate CD-ROM reading and control. Applications wishing to be oblivious of the OS- and device-dependant properties of a CD-ROM can use this library. Some support for disk image types like BIN/CUE and NRG is available, so applications that use this library also have the ability to read disc images as though they were CD's." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A CD-ROM reading and control library." +PKG_BUILD_FLAGS="+pic" # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--enable-cxx \ @@ -50,10 +30,6 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-cxx \ --without-libiconv-prefix \ --with-gnu-ld" -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin } diff --git a/packages/audio/libmodplug/package.mk b/packages/audio/libmodplug/package.mk index ed8b293063..bbfd5ebecd 100644 --- a/packages/audio/libmodplug/package.mk +++ b/packages/audio/libmodplug/package.mk @@ -1,34 +1,12 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libmodplug" PKG_VERSION="0.8.8.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="77462d12ee99476c8645cb5511363e3906b88b33a6b54362b4dbc0f39aa2daad" PKG_LICENSE="GPL" PKG_SITE="http://modplug-xmms.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/modplug-xmms/libmodplug/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="libmodplug: renders mod music files as raw audio data, for playing or conversion." -PKG_LONGDESC="libmodplug renders mod music files as raw audio data, for playing or conversion. libmodplug is based on the fast and high quality mod playing code written and released to the public domain by Olivier Lapicque. mod, .s3m, .it, .xm, and a number of lesser-known formats are supported. Optional features include high-quality resampling, bass expansion, surround and reverb." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +PKG_LONGDESC="libmodplug renders mod music files as raw audio data, for playing or conversion." +PKG_BUILD_FLAGS="+pic" diff --git a/packages/audio/libogg/package.mk b/packages/audio/libogg/package.mk index b95ce1af0c..b3beb4d20f 100644 --- a/packages/audio/libogg/package.mk +++ b/packages/audio/libogg/package.mk @@ -1,34 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libogg" -PKG_VERSION="1.3.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.3.3" +PKG_SHA256="4f3fc6178a533d392064f14776b23c397ed4b9f48f5de297aba73b643f955c08" PKG_LICENSE="BSD" PKG_SITE="https://www.xiph.org/ogg/" -PKG_URL="http://downloads.xiph.org/releases/ogg/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="http://downloads.xiph.org/releases/ogg/libogg-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="libogg: Open source bitstream container format" PKG_LONGDESC="Libogg contains necessary functionality to create, decode, and work with Ogg bitstreams." +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared" diff --git a/packages/audio/libopenmpt/package.mk b/packages/audio/libopenmpt/package.mk index c27524a31c..cad60b79db 100644 --- a/packages/audio/libopenmpt/package.mk +++ b/packages/audio/libopenmpt/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libopenmpt" -PKG_VERSION="0.2.7386-beta20.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.3.1" +PKG_SHA256="6fc5614926edd523d5585e40fdaf0b2ea08689d4dc91de49511d02503744cbb5" PKG_LICENSE="BSD" PKG_SITE="http://lib.openmpt.org/libopenmpt/" -PKG_URL="http://lib.openmpt.org/files/libopenmpt/src/${PKG_NAME}-${PKG_VERSION}-autotools.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}-${PKG_VERSION//-beta*/}-autotools" +PKG_URL="http://lib.openmpt.org/files/libopenmpt/src/${PKG_NAME}-${PKG_VERSION}+release.autotools.tar.gz" PKG_DEPENDS_TARGET="toolchain libogg libvorbis" -PKG_SECTION="audio" -PKG_SHORTDESC="libopenmpt: renders mod music files as raw audio data, for playing or conversion." PKG_LONGDESC="libopenmpt renders mod music files as raw audio data, for playing or conversion." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ diff --git a/packages/audio/libsamplerate/package.mk b/packages/audio/libsamplerate/package.mk index 3d93a08d06..4f42bd3ec3 100644 --- a/packages/audio/libsamplerate/package.mk +++ b/packages/audio/libsamplerate/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libsamplerate" PKG_VERSION="0.1.8" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="93b54bdf46d5e6d2354b7034395fe329c222a966790de34520702bb9642f1c06" PKG_LICENSE="GPL" PKG_SITE="http://www.mega-nerd.com/SRC/" PKG_URL="http://www.mega-nerd.com/SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="libsamplerate: A Sample Rate Converter library for audio" -PKG_LONGDESC="Libsamplerate is a Sample Rate Converter for audio. One example of where such a thing would be useful is converting audio from the CD sample rate of 44.1kHz to the 48kHz sample rate used by DAT players." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" # ToDo +PKG_LONGDESC="A Sample Rate Converter for audio." # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ diff --git a/packages/audio/libsndfile/package.mk b/packages/audio/libsndfile/package.mk index 0b9cc4abc7..f213523382 100644 --- a/packages/audio/libsndfile/package.mk +++ b/packages/audio/libsndfile/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libsndfile" -PKG_VERSION="1.0.27" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.0.28" +PKG_SHA256="1ff33929f042fa333aed1e8923aa628c3ee9e1eb85512686c55092d1e5a9dfa9" PKG_LICENSE="LGPL" PKG_SITE="http://www.mega-nerd.com/libsndfile/" PKG_URL="http://www.mega-nerd.com/$PKG_NAME/files/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain alsa-lib" -PKG_SECTION="audio" -PKG_SHORTDESC="libsndfile: A library for accessing various audio file formats" -PKG_LONGDESC="libsndfile is a C library for reading and writing sound files such as AIFF, AU, WAV, and others through one standard interface. It can currently read/write 8, 16, 24 and 32-bit PCM files as well as 32 and 64-bit floating point WAV files and a number of compressed formats. It compiles and runs on *nix, MacOS, and Win32." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A library for accessing various audio file formats." +PKG_TOOLCHAIN="configure" # package specific configure options PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ @@ -40,7 +20,8 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ --disable-experimental \ --disable-test-coverage \ --enable-largefile \ - --with-gnu-ld" + --with-gnu-ld \ + --with-pic" post_makeinstall_target() { rm -rf $INSTALL/usr/bin diff --git a/packages/audio/libvorbis/package.mk b/packages/audio/libvorbis/package.mk index f77bc10153..f5c932d114 100644 --- a/packages/audio/libvorbis/package.mk +++ b/packages/audio/libvorbis/package.mk @@ -1,39 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libvorbis" -PKG_VERSION="1.3.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.3.6" +PKG_SHA256="af00bb5a784e7c9e69f56823de4637c350643deedaf333d0fa86ecdba6fcb415" PKG_LICENSE="BSD" PKG_SITE="http://www.vorbis.com/" -PKG_URL="http://downloads.xiph.org/releases/vorbis/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://downloads.xiph.org/releases/vorbis/libvorbis-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain libogg" -PKG_SECTION="audio" -PKG_SHORTDESC="libvorbis: Lossless audio compression tools using the ogg-vorbis algorithms" -PKG_LONGDESC="Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for mid to high quality (8kHz-48.0kHz, 16+ bit, polyphonic) audio and music at fixed and variable bitrates from 16 to 128 kbps/channel. This places Vorbis in the same competitive class as audio representations such as MPEG-4 (AAC), and similar to, but higher performance than MPEG-1/2 audio layer 3, MPEG-4 audio (TwinVQ), WMA and PAC." +PKG_LONGDESC="Lossless audio compression tools using the ogg-vorbis algorithms." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ --with-ogg=$SYSROOT_PREFIX/usr \ - --disable-oggtest \ --disable-docs \ - --disable-examples" + --disable-examples \ + --disable-oggtest" diff --git a/packages/audio/libvorbis/patches/libvorbis-1.3.3-configure.patch b/packages/audio/libvorbis/patches/libvorbis-1.3.3-configure.patch deleted file mode 100644 index 1265714d8b..0000000000 --- a/packages/audio/libvorbis/patches/libvorbis-1.3.3-configure.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -Naur libvorbis-1.3.3-old/configure.ac libvorbis-1.3.3-new/configure.ac ---- libvorbis-1.3.3-old/configure.ac 2012-02-03 14:00:34.000000000 -0800 -+++ libvorbis-1.3.3-new/configure.ac 2012-02-09 12:56:02.000000000 -0800 -@@ -8,6 +8,7 @@ - AC_INIT([libvorbis],[1.3.3],[vorbis-dev@xiph.org]) - - AC_CONFIG_SRCDIR([lib/mdct.c]) -+AC_CONFIG_MACRO_DIR([m4]) - - AC_CANONICAL_TARGET([]) - -@@ -16,7 +17,6 @@ - AC_CONFIG_HEADERS([config.h]) - - dnl Add parameters for aclocal --AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") - - dnl Library versioning - dnl - library source changed -> increment REVISION -diff -Naur libvorbis-1.3.3-old/Makefile.am libvorbis-1.3.3-new/Makefile.am ---- libvorbis-1.3.3-old/Makefile.am 2010-12-21 00:46:03.000000000 -0800 -+++ libvorbis-1.3.3-new/Makefile.am 2012-02-09 12:56:02.000000000 -0800 -@@ -3,6 +3,8 @@ - #AUTOMAKE_OPTIONS = 1.7 foreign dist-zip dist-bzip2 - AUTOMAKE_OPTIONS = foreign 1.11 dist-zip dist-xz - -+ACLOCAL_AMFLAGS = -I m4 -+ - SUBDIRS = m4 include vq lib test doc - - if BUILD_EXAMPLES diff --git a/packages/audio/openal-soft/package.mk b/packages/audio/openal-soft/package.mk new file mode 100644 index 0000000000..b3d103e0fe --- /dev/null +++ b/packages/audio/openal-soft/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="openal-soft" +PKG_VERSION="1.18.2" +PKG_SHA256="9f8ac1e27fba15a59758a13f0c7f6540a0605b6c3a691def9d420570506d7e82" +PKG_LICENSE="GPL" +PKG_SITE="http://www.openal.org/" +PKG_URL="http://kcat.strangesoft.net/openal-releases/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain alsa-lib" +PKG_LONGDESC="OpenAL the Open Audio Library" + +PKG_CMAKE_OPTS_TARGET="-DALSOFT_BACKEND_OSS=off \ + -DALSOFT_BACKEND_WAVE=off \ + -DALSOFT_BACKEND_PULSEAUDIO=off \ + -DALSOFT_EXAMPLES=off \ + -DALSOFT_TESTS=off \ + -DALSOFT_UTILS=off" diff --git a/packages/audio/pulseaudio/package.mk b/packages/audio/pulseaudio/package.mk index a4cae45c93..d28ae529dc 100644 --- a/packages/audio/pulseaudio/package.mk +++ b/packages/audio/pulseaudio/package.mk @@ -1,64 +1,42 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pulseaudio" -PKG_VERSION="9.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="12.2" +PKG_SHA256="809668ffc296043779c984f53461c2b3987a45b7a25eb2f0a1d11d9f23ba4055" PKG_LICENSE="GPL" PKG_SITE="http://pulseaudio.org/" PKG_URL="http://www.freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain libtool json-c alsa-lib libsndfile soxr dbus systemd libressl libcap" -PKG_SECTION="audio" -PKG_SHORTDESC="pulseaudio: Yet another sound server for Unix" -PKG_LONGDESC="PulseAudio is a sound server for Linux and other Unix-like operating systems. It is intended to be an improved drop-in replacement for the Enlightened Sound Daemon (esound or esd). In addition to the features esound provides, PulseAudio has an extensible plugin architecture, support for more than one sink per source, better low-latency behavior, the ability to be embedded into other software, a completely asynchronous C API, a simple command line interface for reconfiguring the daemon while running, flexible and implicit sample type conversion and resampling, and a "Zero-Copy" architecture." - -PKG_IS_ADDON="no" - -# broken -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain alsa-lib dbus libcap libsndfile libtool openssl soxr systemd glib:host" +PKG_LONGDESC="PulseAudio is a sound system for POSIX OSes, meaning that it is a proxy for your sound applications." if [ "$BLUETOOTH_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET sbc" - PULSEAUDIO_BLUETOOTH="--enable-bluez5" + PKG_PULSEAUDIO_BLUETOOTH="--enable-bluez5" else - PULSEAUDIO_BLUETOOTH="--disable-bluez5" + PKG_PULSEAUDIO_BLUETOOTH="--disable-bluez5" fi if [ "$AVAHI_DAEMON" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi" - PULSEAUDIO_AVAHI="--enable-avahi" + PKG_PULSEAUDIO_AVAHI="--enable-avahi" else - PULSEAUDIO_AVAHI="--disable-avahi" + PKG_PULSEAUDIO_AVAHI="--disable-avahi" fi -if [ "$TARGET_FPU" = "neon" -o "$TARGET_FPU" = "neon-fp16" -o "$TARGET_FPU" = "neon-vfpv4" ]; then - PULSEAUDIO_NEON="--enable-neon-opt" +# PulseAudio fails to build on aarch64 when NEON is enabled, so don't enable NEON for aarch64 until upstream supports it +if [ "$TARGET_ARCH" = "arm" ] && target_has_feature neon; then + PKG_PULSEAUDIO_NEON="--enable-neon-opt" else - PULSEAUDIO_NEON="--disable-neon-opt" + PKG_PULSEAUDIO_NEON="--disable-neon-opt" fi -# package specific configure options PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --disable-nls \ --enable-largefile \ --disable-rpath \ - $PULSEAUDIO_NEON \ + $PKG_PULSEAUDIO_NEON \ --disable-x11 \ --disable-tests \ --disable-samplerate \ @@ -72,22 +50,21 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --enable-glib2 \ --disable-gtk3 \ --disable-gconf \ - $PULSEAUDIO_AVAHI \ + $PKG_PULSEAUDIO_AVAHI \ --disable-jack \ --disable-asyncns \ --disable-tcpwrap \ --disable-lirc \ --enable-dbus \ --disable-bluez4 \ - $PULSEAUDIO_BLUETOOTH \ + $PKG_PULSEAUDIO_BLUETOOTH \ --disable-bluez5-ofono-headset \ --disable-bluez5-native-headset \ --enable-udev \ - --with-udev-rules-dir=/usr/lib/udev/rules.d + --with-udev-rules-dir=/usr/lib/udev/rules.d \ --disable-hal-compat \ --enable-ipv6 \ --enable-openssl \ - --disable-xen \ --disable-orc \ --disable-manpages \ --disable-per-user-esound-socket \ @@ -102,6 +79,11 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --with-soxr \ --with-module-dir=/usr/lib/pulse" +pre_configure_target() { + sed -e 's|; remixing-use-all-sink-channels = yes|; remixing-use-all-sink-channels = no|' \ + -i $PKG_BUILD/src/daemon/daemon.conf.in +} + post_makeinstall_target() { rm -rf $INSTALL/usr/bin/esdcompat rm -rf $INSTALL/usr/include diff --git a/packages/audio/pulseaudio/patches/pulseaudio-0900.03-dont_relink_against_host.patch b/packages/audio/pulseaudio/patches/pulseaudio-0900.03-dont_relink_against_host.patch deleted file mode 100644 index e2697750d8..0000000000 --- a/packages/audio/pulseaudio/patches/pulseaudio-0900.03-dont_relink_against_host.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh -index 63ae69d..cfde522 100644 ---- a/build-aux/ltmain.sh -+++ b/build-aux/ltmain.sh -@@ -6918,7 +6918,7 @@ func_mode_link () - fi - else - # We cannot seem to hardcode it, guess we'll fake it. -- add_dir="-L$libdir" -+ #add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in diff --git a/packages/audio/pulseaudio/profile.d/99-pulseaudio.conf b/packages/audio/pulseaudio/profile.d/99-pulseaudio.conf index 70427c6cf2..7e7b95357b 100644 --- a/packages/audio/pulseaudio/profile.d/99-pulseaudio.conf +++ b/packages/audio/pulseaudio/profile.d/99-pulseaudio.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/pulseaudio" diff --git a/packages/audio/pulseaudio/system.d/pulseaudio.service b/packages/audio/pulseaudio/system.d/pulseaudio.service index 96ce5351fc..f052e019d3 100644 --- a/packages/audio/pulseaudio/system.d/pulseaudio.service +++ b/packages/audio/pulseaudio/system.d/pulseaudio.service @@ -1,14 +1,12 @@ [Unit] -Description=PulseAudio Sound System +Description=PulseAudio Sound Service After=syslog.target local-fs.target [Service] +Type=dbus +BusName=org.pulseaudio.Server +ExecStart=/usr/bin/pulseaudio --system --disallow-exit --exit-idle-time=-1 --disable-shm Restart=on-failure -ExecStart=/usr/bin/pulseaudio --system -TimeoutStopSec=1s -RestartSec=2 -StartLimitInterval=60 -StartLimitBurst=10 [Install] WantedBy=multi-user.target diff --git a/packages/audio/rpi-cirrus-config/config/rpi-cirrus-config.sh.sample b/packages/audio/rpi-cirrus-config/config/rpi-cirrus-config.sh.sample new file mode 100644 index 0000000000..76fdb71bdb --- /dev/null +++ b/packages/audio/rpi-cirrus-config/config/rpi-cirrus-config.sh.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Sample user config script to setup Cirrus Logic Audio Card + +# load helper functions and definitions +. /usr/lib/alsa/rpi-cirrus-functions.sh + +# enable output to S/PDIF, line out and headset out +playback_to_spdif +playback_to_lineout +playback_to_headset + +# disable noise gate - this can cut off the first few ms of playback +mixer 'Noise Gate Switch' off + +# Uncomment this line to enable output to speakers +# playback_to_speakers + +# example: mix line in and headset in into line out using a high-pass filter +# - line in gain is set to +8dB +# - headset in gain is set to +20dB +# - line in and headset in are mixed together in the filter, each using +# a gain of -3dB (volume 29). line in uses input 1, headset in input 2 +# - first input of line out is connected to audio signal from RPi/Kodi, +# using a -3dB gain +# - second input of line out is connected to output of the filter +# +# mixer "${line_out} Digital Switch" off # mute output +# setup_line_in 8 +# setup_headset_in 20 +# setup_filter "High-Pass" "240,3" +# set_mixer $filter_signals $line_in_signals 29 1 +# set_mixer $filter_signals $headset_in_signals 29 2 +# set_mixer $line_out_signals $rpi_out_signals 29 1 +# set_mixer $line_out_signals $filter_signals 29 2 +# mixer "${line_out} Digital Switch" on # unmute output diff --git a/packages/audio/rpi-cirrus-config/modprobe.d/rpi-cirrus.conf b/packages/audio/rpi-cirrus-config/modprobe.d/rpi-cirrus.conf new file mode 100644 index 0000000000..2b3237d29f --- /dev/null +++ b/packages/audio/rpi-cirrus-config/modprobe.d/rpi-cirrus.conf @@ -0,0 +1 @@ +softdep arizona-spi pre: arizona-ldo1 diff --git a/packages/audio/rpi-cirrus-config/package.mk b/packages/audio/rpi-cirrus-config/package.mk new file mode 100644 index 0000000000..e7025481f8 --- /dev/null +++ b/packages/audio/rpi-cirrus-config/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rpi-cirrus-config" +PKG_VERSION="0.0.1" +PKG_SHA256="a2a580d9738aaf4e901d8215cedd1df5d95b1e057165cfd9b72335e0dc6c40e4" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/HiassofT/rpi-cirrus-config" +PKG_URL="https://github.com/HiassofT/rpi-cirrus-config/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="alsa-utils" +PKG_LONGDESC="Config scripts for the Wolfson/Cirrus Logic audio card" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/usr/lib/udev + install -m 0755 $PKG_DIR/scripts/rpi-cirrus-config $INSTALL/usr/lib/udev/rpi-cirrus-config + + mkdir -p $INSTALL/usr/share/alsa/cards + cp alsa/RPiCirrus.conf $INSTALL/usr/share/alsa/cards + + mkdir -p $INSTALL/usr/lib/alsa + cp mixer-scripts/rpi-cirrus-functions.sh $INSTALL/usr/lib/alsa + + mkdir -p $INSTALL/usr/config + cp -PR $PKG_DIR/config/* $INSTALL/usr/config +} diff --git a/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config b/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config new file mode 100755 index 0000000000..d8bda0b07c --- /dev/null +++ b/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config @@ -0,0 +1,24 @@ +#!/bin/sh + +# setup default mixer settings for Cirrus Logic Audio Card + +. /etc/profile + +if [ -f $HOME/.config/sound.conf ] ; then + alsactl restore -f $HOME/.config/sound.conf +else + if [ -r $HOME/.config/rpi-cirrus-config.sh ] ; then + progress "Setting up Cirrus Logic Audio Card with user config" + sh $HOME/.config/rpi-cirrus-config.sh + else + progress "Setting up Cirrus Logic Audio Card" + + # load helper functions and definitions + . /usr/lib/alsa/rpi-cirrus-functions.sh + + playback_to_spdif + playback_to_lineout + playback_to_headset + mixer 'Noise Gate Switch' off + fi +fi diff --git a/packages/audio/rpi-cirrus-config/udev.d/90-alsa-restore.rules b/packages/audio/rpi-cirrus-config/udev.d/90-alsa-restore.rules new file mode 100644 index 0000000000..b208528958 --- /dev/null +++ b/packages/audio/rpi-cirrus-config/udev.d/90-alsa-restore.rules @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +# When a sound device is detected, restore the volume settings +SUBSYSTEM=="sound", KERNEL=="controlC*", NAME="snd/%k", ACTION=="add", GOTO="alsa_restore_go" +GOTO="alsa_restore_end" + +LABEL="alsa_restore_go" + +# Separate config-script for RPi-Cirrus card +DRIVERS=="snd-rpi-cirrus", RUN+="rpi-cirrus-config", GOTO="alsa_restore_end" + +# Default config-script for all other cards +RUN+="soundconfig %k" + +LABEL="alsa_restore_end" + diff --git a/packages/audio/sbc/package.mk b/packages/audio/sbc/package.mk index 08c7b7531b..7f286512e5 100644 --- a/packages/audio/sbc/package.mk +++ b/packages/audio/sbc/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="sbc" PKG_VERSION="1.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="4a358581fb57b98e0c1c34606a35343f31f908f57c26659e51495f75e283785d" PKG_LICENSE="GPL" PKG_SITE="http://www.bluez.org/" PKG_URL="http://www.kernel.org/pub/linux/bluetooth/sbc-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="sbc: standalone SBC library" PKG_LONGDESC="standalone SBC library" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ - --disable-tools --disable-tester" +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-tools \ + --disable-tester" diff --git a/packages/audio/sidplay-libs/package.mk b/packages/audio/sidplay-libs/package.mk index a0dff5aad4..f958ed1c8c 100644 --- a/packages/audio/sidplay-libs/package.mk +++ b/packages/audio/sidplay-libs/package.mk @@ -1,41 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="sidplay-libs" PKG_VERSION="2.1.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="e9a24ada48215a46d2c232a70c5601bc9505e997f120e8f2ba3713e09e28d1f9" PKG_LICENSE="GPL" PKG_SITE="http://sidplay2.sourceforge.net/" PKG_URL="http://mirrors.xbmc.org/build-deps/sources/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="sidplay-libs" PKG_LONGDESC="sidplay-libs" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" pre_configure_target() { # fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME export CXXFLAGS="$CXXFLAGS -Wno-narrowing" diff --git a/packages/audio/soxr/package.mk b/packages/audio/soxr/package.mk index 2142da957d..677ec5c675 100644 --- a/packages/audio/soxr/package.mk +++ b/packages/audio/soxr/package.mk @@ -1,38 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="soxr" -PKG_VERSION="0.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.1.3" +PKG_SHA256="b111c15fdc8c029989330ff559184198c161100a59312f5dc19ddeb9b5a15889" PKG_LICENSE="LGPL" -PKG_SITE="http://sourceforge.net/p/soxr/wiki/Home/" -PKG_URL="$SOURCEFORGE_SRC/soxr/$PKG_NAME-$PKG_VERSION-Source.tar.xz" -PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION-Source" +PKG_SITE="https://sourceforge.net/projects/soxr/" +PKG_URL="$SOURCEFORGE_SRC/soxr/soxr-$PKG_VERSION-Source.tar.xz" PKG_DEPENDS_TARGET="toolchain cmake:host" -PKG_SECTION="audio" -PKG_SHORTDESC="soxr: a library which performs one-dimensional sample-rate conversion." -PKG_LONGDESC="The SoX Resampler library performs one-dimensional sample-rate conversion. it may be used, for example, to resample PCM-encoded audio." +PKG_LONGDESC="The SoX Resampler library performs one-dimensional sample-rate conversion. It may be used to resample PCM-encoded audio." +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_CMAKE_OPTS_TARGET="-DBUILD_EXAMPLES=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTS=OFF \ + -DWITH_AVFFT=OFF" -PKG_CMAKE_OPTS_TARGET="-DHAVE_WORDS_BIGENDIAN_EXITCODE=1 \ - -DBUILD_TESTS=0 \ - -DBUILD_EXAMPLES=1 \ - -DBUILD_SHARED_LIBS=OFF" +if [ "$TARGET_ARCH" = "arm" ]; then + if target_has_feature neon; then + PKG_CMAKE_OPTS_TARGET+=" -DWITH_CR32=OFF" + else + PKG_CMAKE_OPTS_TARGET+=" -DWITH_CR32S=OFF" + fi +fi diff --git a/packages/audio/speex/package.mk b/packages/audio/speex/package.mk index 2c28120022..c821495368 100644 --- a/packages/audio/speex/package.mk +++ b/packages/audio/speex/package.mk @@ -1,33 +1,12 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="speex" -PKG_VERSION="1.2rc2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.2.0" +PKG_SHA256="eaae8af0ac742dc7d542c9439ac72f1f385ce838392dc849cae4536af9210094" PKG_LICENSE="BSD" -PKG_SITE="http://downloads.us.xiph.org/releases/speex" -#PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_URL="$PKG_SITE/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://speex.org" +PKG_URL="http://downloads.us.xiph.org/releases/speex/speex-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="audio" -PKG_SHORTDESC="Speex / OPUS audio codec" -PKG_LONGDESC="Speex / OPUS audio codec" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="An Open Source Software patent-free audio compression format designed for speech." diff --git a/packages/audio/taglib/package.mk b/packages/audio/taglib/package.mk index 0114fafe31..3f695bcada 100644 --- a/packages/audio/taglib/package.mk +++ b/packages/audio/taglib/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="taglib" -PKG_VERSION="1.11" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.11.1" +PKG_SHA256="b6d1a5a610aae6ff39d93de5efd0fdc787aa9e9dc1e7026fa4c961b26563526b" PKG_LICENSE="LGPL" PKG_SITE="http://taglib.github.com/" PKG_URL="http://taglib.github.io/releases/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain cmake:host zlib" -PKG_SECTION="audio" -PKG_SHORTDESC="taglib: a library for reading and editing the meta-data of several popular audio formats." PKG_LONGDESC="TagLib is a library for reading and editing the meta-data of several popular audio formats." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=OFF \ -DWITH_MP4=ON \ -DWITH_ASF=ON" @@ -38,9 +17,9 @@ PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=OFF \ post_makeinstall_target() { rm -rf $INSTALL/usr/bin # pkgconf hack - $SED "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/taglib-config - $SED "s:\([':\" ]\)-I/usr:\\1-I$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib.pc - $SED "s:\([':\" ]\)-L/usr:\\1-L$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib.pc - $SED "s:\([':\" ]\)-I/usr:\\1-I$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib_c.pc - $SED "s:\([':\" ]\)-L/usr:\\1-L$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib_c.pc + sed -e "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/taglib-config + sed -e "s:\([':\" ]\)-I/usr:\\1-I$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib.pc + sed -e "s:\([':\" ]\)-L/usr:\\1-L$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib.pc + sed -e "s:\([':\" ]\)-I/usr:\\1-I$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib_c.pc + sed -e "s:\([':\" ]\)-L/usr:\\1-L$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/lib/pkgconfig/taglib_c.pc } diff --git a/packages/audio/taglib/patches/taglib-01-efficient_lookup_for_an_ID3v2_tag_in_MPEG_files_with_garbage.patch b/packages/audio/taglib/patches/taglib-01-efficient_lookup_for_an_ID3v2_tag_in_MPEG_files_with_garbage.patch new file mode 100644 index 0000000000..b31cf6a089 --- /dev/null +++ b/packages/audio/taglib/patches/taglib-01-efficient_lookup_for_an_ID3v2_tag_in_MPEG_files_with_garbage.patch @@ -0,0 +1,72 @@ +From d2e0e5522308ce4c905c205c7bf5972ea71cd6e5 Mon Sep 17 00:00:00 2001 +From: Tsuda Kageyu +Date: Fri, 20 Jan 2017 21:14:38 +0900 +Subject: [PATCH] Efficient lookup for an ID3v2 tag in MPEG files with garbage. + +This looks for an ID3v2 tag until reaching the first valid MPEG frame in O(n) time. +--- + taglib/mpeg/mpegfile.cpp | 45 +++++++++++++++++++++++++++++---------------- + 1 file changed, 29 insertions(+), 16 deletions(-) + +diff --git a/taglib/mpeg/mpegfile.cpp b/taglib/mpeg/mpegfile.cpp +index af7253f..c634eeb 100644 +--- a/taglib/mpeg/mpegfile.cpp ++++ b/taglib/mpeg/mpegfile.cpp +@@ -488,28 +488,41 @@ long MPEG::File::findID3v2() + const ByteVector headerID = ID3v2::Header::fileIdentifier(); + + seek(0); ++ if(readBlock(headerID.size()) == headerID) ++ return 0; + +- const ByteVector data = readBlock(headerID.size()); +- if(data.size() < headerID.size()) ++ Header firstHeader(this, 0, true); ++ if(firstHeader.isValid()) + return -1; + +- if(data == headerID) +- return 0; ++ // Look for an ID3v2 tag until reaching the first valid MPEG frame. + +- if(firstSyncByte(data[0]) && secondSynchByte(data[1])) +- return -1; ++ char frameSyncBytes[2] = {}; ++ char tagHeaderBytes[4] = {}; ++ long position = 0; + +- // Look for the entire file, if neither an MEPG frame or ID3v2 tag was found +- // at the beginning of the file. +- // We don't care about the inefficiency of the code, since this is a seldom case. ++ while(true) { ++ seek(position); ++ const ByteVector buffer = readBlock(bufferSize()); ++ if(buffer.isEmpty()) ++ return -1; + +- const long tagOffset = find(headerID); +- if(tagOffset < 0) +- return -1; ++ for(unsigned int i = 0; i < buffer.size(); ++i) { ++ frameSyncBytes[0] = frameSyncBytes[1]; ++ frameSyncBytes[1] = buffer[i]; ++ if(firstSyncByte(frameSyncBytes[0]) && secondSynchByte(frameSyncBytes[1])) { ++ Header header(this, position + i - 1, true); ++ if(header.isValid()) ++ return -1; ++ } + +- const long frameOffset = firstFrameOffset(); +- if(frameOffset < tagOffset) +- return -1; ++ tagHeaderBytes[0] = tagHeaderBytes[1]; ++ tagHeaderBytes[1] = tagHeaderBytes[2]; ++ tagHeaderBytes[2] = buffer[i]; ++ if(headerID == tagHeaderBytes) ++ return position + i - 2; ++ } + +- return tagOffset; ++ position += bufferSize(); ++ } + } diff --git a/packages/compress/bzip2/package.mk b/packages/compress/bzip2/package.mk index e826bf31c5..610406b72e 100644 --- a/packages/compress/bzip2/package.mk +++ b/packages/compress/bzip2/package.mk @@ -1,63 +1,44 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bzip2" PKG_VERSION="1.0.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd" PKG_LICENSE="GPL" PKG_SITE="http://www.bzip.org" -PKG_URL="http://www.bzip.org/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="toolchain" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="compress" -PKG_SHORTDESC="bzip2 data compressor" -PKG_LONGDESC="bzip2 is a freely available, patent free (see below), high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A high-quality bzip2 data compressor." +PKG_BUILD_FLAGS="+pic +pic:host" pre_build_host() { - mkdir -p $ROOT/$PKG_BUILD/.$HOST_NAME - cp -r $ROOT/$PKG_BUILD/* $ROOT/$PKG_BUILD/.$HOST_NAME + mkdir -p $PKG_BUILD/.$HOST_NAME + cp -r $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME } make_host() { - cd $ROOT/$PKG_BUILD/.$HOST_NAME - make -f Makefile-libbz2_so CC=$HOST_CC CFLAGS="$CFLAGS -fPIC -DPIC" + cd $PKG_BUILD/.$HOST_NAME + make -f Makefile-libbz2_so CC=$HOST_CC CFLAGS="$CFLAGS" } makeinstall_host() { - make install PREFIX=$ROOT/$TOOLCHAIN + make install PREFIX=$TOOLCHAIN } pre_build_target() { - mkdir -p $ROOT/$PKG_BUILD/.$TARGET_NAME - cp -r $ROOT/$PKG_BUILD/* $ROOT/$PKG_BUILD/.$TARGET_NAME + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -r $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME } pre_make_target() { - cd $ROOT/$PKG_BUILD/.$TARGET_NAME + cd $PKG_BUILD/.$TARGET_NAME sed -e "s,ln -s (lib.*),ln -snf \$$1; ln -snf libbz2.so.$PKG_VERSION libbz2.so,g" -i Makefile-libbz2_so } make_target() { - make -f Makefile-libbz2_so CC=$CC CFLAGS="$CFLAGS -fPIC -DPIC" + make -f Makefile-libbz2_so CC=$CC CFLAGS="$CFLAGS" } post_make_target() { diff --git a/packages/compress/cpio/package.mk b/packages/compress/cpio/package.mk index 2e2c1313b1..bbe40b5169 100644 --- a/packages/compress/cpio/package.mk +++ b/packages/compress/cpio/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="cpio" PKG_VERSION="2.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="08a35e92deb3c85d269a0059a27d4140a9667a6369459299d08c17f713a92e73" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/cpio/" PKG_URL="http://ftpmirror.gnu.org/cpio/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="" -PKG_SECTION="compress" -PKG_SHORTDESC="cpio: A GNU archiving program" -PKG_LONGDESC="This is GNU cpio, a program to manage archives of files. As of version 2.0, it supports the features of the System V release 4 cpio, including support for tar archives." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_HOST="toolchain" +PKG_LONGDESC="A program to manage archives of files." diff --git a/packages/compress/libarchive/package.mk b/packages/compress/libarchive/package.mk new file mode 100644 index 0000000000..ea25b94429 --- /dev/null +++ b/packages/compress/libarchive/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libarchive" +PKG_VERSION="3.3.2" +PKG_SHA256="ed2dbd6954792b2c054ccf8ec4b330a54b85904a80cef477a1c74643ddafa0ce" +PKG_LICENSE="GPL" +PKG_SITE="https://www.libarchive.org" +PKG_URL="https://www.libarchive.org/downloads/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain" +PKG_DEPENDS_TARGET="toolchain" +PKG_SHORTDESC="A multi-format archive and compression library." + +PKG_CMAKE_OPTS_TARGET="-DENABLE_SHARED=0 -DENABLE_STATIC=1 -DCMAKE_POSITION_INDEPENDENT_CODE=1 -DENABLE_EXPAT=0 -DENABLE_ICONV=0 -DENABLE_LIBXML2=0 -DENABLE_LZO=1 -DENABLE_TEST=0 -DENABLE_COVERAGE=0" + +post_makeinstall_target() { + rm -rf $INSTALL +} diff --git a/packages/compress/libarchive/patches/libarchive-01-die-Werror.patch b/packages/compress/libarchive/patches/libarchive-01-die-Werror.patch new file mode 100644 index 0000000000..9a831f2a2e --- /dev/null +++ b/packages/compress/libarchive/patches/libarchive-01-die-Werror.patch @@ -0,0 +1,37 @@ +From f3c2f0ca7916288c72da07a2c3352b85b8f96e55 Mon Sep 17 00:00:00 2001 +From: Arne Morten Kvarving +Date: Sat, 11 Nov 2017 23:42:40 +0100 +Subject: [PATCH] die Werror + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 73bf07b..08e8f49 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -96,7 +96,7 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" +- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") ++ #SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") +@@ -112,7 +112,7 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") +- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") ++ #SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") +@@ -133,7 +133,7 @@ + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qflag=w:w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") + ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") +-IF (MSVC) ++IF (0) + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" diff --git a/packages/compress/libarchive/patches/libarchive-02-static-please.patch b/packages/compress/libarchive/patches/libarchive-02-static-please.patch new file mode 100644 index 0000000000..fb2bbc275a --- /dev/null +++ b/packages/compress/libarchive/patches/libarchive-02-static-please.patch @@ -0,0 +1,14 @@ +--- libarchive/libarchive/CMakeLists.txt ++++ libarchive/libarchive/CMakeLists.txt +@@ -224,9 +224,9 @@ + ENDIF() + + # Libarchive is a shared library +-ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) ++ADD_LIBRARY(archive STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) +-SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) ++SET_TARGET_PROPERTIES(archive PROPERTIES COMPILE_DEFINITIONS LIBARCHIVE_STATIC) + + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) diff --git a/packages/compress/lz4/package.mk b/packages/compress/lz4/package.mk new file mode 100644 index 0000000000..80c44b412b --- /dev/null +++ b/packages/compress/lz4/package.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="lz4" +PKG_VERSION="1.8.2" +PKG_SHA256="0963fbe9ee90acd1d15e9f09e826eaaf8ea0312e854803caf2db0a6dd40f4464" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/lz4/lz4" +PKG_URL="https://github.com/lz4/lz4/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="lz4 data compressor/decompressor" + +configure_package() { + PKG_CMAKE_SCRIPT="$PKG_BUILD/contrib/cmake_unofficial/CMakeLists.txt" + + PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=0" +} + +post_makeinstall_target() { + rm -rf $INSTALL +} diff --git a/packages/compress/lzo/package.mk b/packages/compress/lzo/package.mk index 85220f2d11..a861a63e95 100644 --- a/packages/compress/lzo/package.mk +++ b/packages/compress/lzo/package.mk @@ -1,36 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="lzo" -PKG_VERSION="2.09" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.10" +PKG_SHA256="c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b4221a072" PKG_LICENSE="GPL" PKG_SITE="http://www.oberhumer.com/opensource/lzo" PKG_URL="http://www.oberhumer.com/opensource/lzo/download/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="" +PKG_DEPENDS_HOST="toolchain" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="compress" -PKG_SHORTDESC="LZO data compressor" -PKG_LONGDESC="LZO is a data compression library which is suitable for data de-/compression in real-time. This means it favours speed over compression ratio." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A data compression library which is suitable for data de-/compression." +PKG_BUILD_FLAGS="+pic" PKG_CMAKE_OPTS_HOST="-DENABLE_SHARED=OFF -DENABLE_STATIC=ON" PKG_CMAKE_OPTS_TARGET="-DENABLE_SHARED=OFF -DENABLE_STATIC=ON" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/libexec +} diff --git a/packages/compress/minizip/package.mk b/packages/compress/minizip/package.mk new file mode 100644 index 0000000000..7a38c9a9da --- /dev/null +++ b/packages/compress/minizip/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="minizip" +PKG_VERSION="1.1" +PKG_SHA256="5666b5ee3e85dfd2dd119970613c12e6267d31813f07d3ffa5d359fe272cb6d1" +PKG_LICENSE="zlib" +PKG_SITE="https://github.com/nmoinvaz/minizip" +PKG_URL="https://github.com/nmoinvaz/minizip/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="zlib" +PKG_LONGDESC="Minizip zlib contribution fork with latest bug fixes" + +PKG_CMAKE_OPTS_TARGET="-DUSE_AES=OFF \ + -DBUILD_TEST=ON" + +makeinstall_target() { + cp -v miniunz_exec $SYSROOT_PREFIX/usr/bin/miniunz + cp -v minizip_exec $SYSROOT_PREFIX/usr/bin/minizip +} diff --git a/packages/compress/unzip/package.mk b/packages/compress/unzip/package.mk index 0f11869910..0ddca31edb 100644 --- a/packages/compress/unzip/package.mk +++ b/packages/compress/unzip/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="unzip" PKG_VERSION="60" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37" PKG_LICENSE="OSS" PKG_SITE="http://www.info-zip.org/pub/infozip/" PKG_URL="http://ftp.uk.i-scream.org/sites/www.ibiblio.org/gentoo/distfiles/$PKG_NAME$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="compress" -PKG_SHORTDESC="unzip: PKUNZIP compatible compression utility" -PKG_LONGDESC="UnZip is an extraction utility for archives compressed in .zip format (also called "zipfiles"). Although highly compatible both with PKWARE's PKZIP and PKUNZIP utilities for MS-DOS and with Info-ZIP's own Zip program, the primary objectives have been portability and non-MSDOS functionality." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_LONGDESC="UnZip is an extraction utility for archives compressed in .zip format." +PKG_TOOLCHAIN="manual" make_target() { make CC=$CC RANLIB=$RANLIB AR=$AR STRIP=$STRIP \ @@ -42,4 +21,3 @@ makeinstall_target() { cp unzip $INSTALL/usr/bin $STRIP $INSTALL/usr/bin/unzip } - diff --git a/packages/compress/xz/package.mk b/packages/compress/xz/package.mk index 007ff7eeb7..0974846d8d 100644 --- a/packages/compress/xz/package.mk +++ b/packages/compress/xz/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xz" -PKG_VERSION="5.2.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5.2.4" +PKG_SHA256="3313fd2a95f43d88e44264e6b015e7d03053e681860b0d5d3f9baca79c57b7bf" PKG_LICENSE="GPL" PKG_SITE="http://tukaani.org/xz/" PKG_URL="http://tukaani.org/xz/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="toolchain/archivers" -PKG_SHORTDESC="xz: a free general-purpose data compression software with high compression ratio." -PKG_LONGDESC="XZ Utils is free general-purpose data compression software with high compression ratio. XZ Utils were written for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A free general-purpose data compression software with high compression ratio." +PKG_BUILD_FLAGS="+pic" # never build shared or k0p happens when building # on fedora due to host selinux/liblzma @@ -40,3 +21,8 @@ PKG_CONFIGURE_OPTS_HOST="--disable-shared --enable-static \ --disable-scripts \ --disable-nls" +PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" + +post_makeinstall_target() { + rm -rf $INSTALL +} diff --git a/packages/compress/xz/patches/xz-01-init-uninitialized-variables.patch b/packages/compress/xz/patches/xz-01-init-uninitialized-variables.patch new file mode 100644 index 0000000000..0d88880702 --- /dev/null +++ b/packages/compress/xz/patches/xz-01-init-uninitialized-variables.patch @@ -0,0 +1,27 @@ +From 5cd389f1fe1fe095cdf555194df875ee3ab445cf Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Sun, 26 Nov 2017 22:21:15 +0000 +Subject: [PATCH] uninitialized variables build error + +--- + src/liblzma/lzma/lzma_encoder.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c +index ba9ce69..08e8c87 100644 +--- a/src/liblzma/lzma/lzma_encoder.c ++++ b/src/liblzma/lzma/lzma_encoder.c +@@ -359,8 +359,8 @@ lzma_lzma_encode(lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf, + // - UINT32_MAX: not a match but a literal + // Value ranges for len: + // - [MATCH_LEN_MIN, MATCH_LEN_MAX] +- uint32_t len; +- uint32_t back; ++ uint32_t len = 0; ++ uint32_t back = 0; + + if (coder->fast_mode) + lzma_lzma_optimum_fast(coder, mf, &back, &len); +-- +2.14.1 + diff --git a/packages/compress/zip/package.mk b/packages/compress/zip/package.mk index 85192bc121..ce3b160422 100644 --- a/packages/compress/zip/package.mk +++ b/packages/compress/zip/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="zip" PKG_VERSION="30" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369" PKG_LICENSE="Info-ZIP" PKG_SITE="http://www.info-zip.org/pub/infozip/" PKG_URL="$SOURCEFORGE_SRC/infozip/Zip%203.x%20%28latest%29/3.0/${PKG_NAME}${PKG_VERSION}.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}${PKG_VERSION}" PKG_DEPENDS_TARGET="toolchain bzip2" -PKG_SECTION="compress" -PKG_SHORTDESC="zip: PKUNZIP compatible compression utility" -PKG_LONGDESC="zip is a compression and file packaging utility for Unix, VMS, MSDOS, OS/2, Windows 9x/NT/XP, Minix, Atari, Macintosh, MVS, z/OS, Amiga, Acorn RISC, and other OS. It is analogous to a combination of the Unix commands tar(1) and compress(1) (or tar(1) and gzip(1)) and is compatible with PKZIP (Phil Katz's ZIP for MSDOS systems) and other major zip utilities." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A compression and file packaging utility." +PKG_TOOLCHAIN="manual" make_target() { make CC=$CC CPP=$CPP RANLIB=$RANLIB AR=$AR STRIP=$STRIP LOCAL_ZIP="$CFLAGS" \ diff --git a/packages/compress/zlib/package.mk b/packages/compress/zlib/package.mk index a031c88dfb..7a86e767b7 100644 --- a/packages/compress/zlib/package.mk +++ b/packages/compress/zlib/package.mk @@ -1,56 +1,13 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="zlib" -PKG_VERSION="1.2.8" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.2.11" +PKG_SHA256="4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066" PKG_LICENSE="OSS" PKG_SITE="http://www.zlib.net" PKG_URL="http://zlib.net/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="cmake:host" PKG_DEPENDS_TARGET="toolchain" -PKG_DEPENDS_HOST="" -PKG_SECTION="compress" -PKG_SHORTDESC="zlib: A general purpose (ZIP) data compression library" -PKG_LONGDESC="zlib is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format)." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -post_configure_target() { - ## configure minizip - ( - cd $ROOT/$PKG_BUILD/contrib/minizip - rm Makefile - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:../../" - do_autoreconf - cp $ROOT/$PKG_BUILD/.$TARGET_NAME/zconf.h ./ - ./configure --host=$TARGET_NAME --build=$HOST_NAME $TARGET_CONFIGURE_OPTS --disable-shared --enable-static - ) -} - -post_make_target() { - # make minizip - make -C $ROOT/$PKG_BUILD/contrib/minizip -} - -post_makeinstall_target() { - # Install minizip - make -C $ROOT/$PKG_BUILD/contrib/minizip DESTDIR=$SYSROOT_PREFIX install -} - +PKG_LONGDESC="A general purpose (ZIP) data compression library." +PKG_TOOLCHAIN="cmake-make" diff --git a/packages/compress/zstd/package.mk b/packages/compress/zstd/package.mk new file mode 100644 index 0000000000..3ec5713722 --- /dev/null +++ b/packages/compress/zstd/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="zstd" +PKG_VERSION="1.3.8" +PKG_SHA256="293fa004dfacfbe90b42660c474920ff27093e3fb6c99f7b76e6083b21d6d48e" +PKG_LICENSE="BSD/GPLv2" +PKG_SITE="http://www.zstd.net" +PKG_URL="https://github.com/facebook/zstd/releases/download/v${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_SOURCE_DIR=$PKG_NAME-$PKG_VERSION +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A fast real-time compression algorithm." + +configure_package() { + PKG_CMAKE_SCRIPT="$PKG_BUILD/build/cmake/CMakeLists.txt" + PKG_CMAKE_OPTS_HOST="-DTHREADS_PTHREAD_ARG=0" +} diff --git a/packages/databases/mariadb-connector-c/package.mk b/packages/databases/mariadb-connector-c/package.mk new file mode 100644 index 0000000000..16deb8a21c --- /dev/null +++ b/packages/databases/mariadb-connector-c/package.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mariadb-connector-c" +PKG_VERSION="3.0.6" +PKG_SHA256="46181f8c95c096ac1aa6cb0ca80f4ed0e746873cfd6af84f3bac925d7e2cd091" +PKG_LICENSE="LGPL" +PKG_SITE="https://mariadb.org/" +PKG_URL="https://github.com/MariaDB/mariadb-connector-c/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain zlib openssl" +PKG_LONGDESC="mariadb-connector: library to conntect to mariadb/mysql database server" +PKG_BUILD_FLAGS="-gold" + +PKG_CMAKE_OPTS_TARGET="-DWITH_EXTERNAL_ZLIB=ON + -DAUTH_CLEARTEXT=STATIC + -DAUTH_DIALOG=STATIC + -DAUTH_OLDPASSWORD=STATIC + -DREMOTEIO=OFF + " + +post_makeinstall_target() { + # drop all unneeded + rm -rf $INSTALL/usr +} diff --git a/packages/databases/mysql/package.mk b/packages/databases/mysql/package.mk index 0ea0d00ae2..e3c05a9f9c 100644 --- a/packages/databases/mysql/package.mk +++ b/packages/databases/mysql/package.mk @@ -1,46 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mysql" -PKG_VERSION="5.7.17" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5.7.20" +PKG_SHA256="5397549bb7c238f396c123db2df4cad2191b11adf8986de7fe63bff8e2786487" PKG_LICENSE="LGPL" PKG_SITE="http://www.mysql.com" PKG_URL="http://ftp.gwdg.de/pub/misc/$PKG_NAME/Downloads/MySQL-5.7/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="zlib:host" -PKG_DEPENDS_TARGET="toolchain zlib netbsd-curses libressl boost mysql:host" -PKG_SECTION="database" -PKG_SHORTDESC="mysql: A database server" -PKG_LONGDESC="MySQL is a SQL (Structured Query Language) database server. SQL is the most popular database language in the world. MySQL is a client server implementation that consists of a server daemon mysqld and many different client programs/libraries." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -post_unpack() { - sed -i 's|OPENSSL_MAJOR_VERSION STREQUAL "1"|OPENSSL_MAJOR_VERSION STREQUAL "2"|' $ROOT/$PKG_BUILD/cmake/ssl.cmake - sed -i 's|GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME libmysql OUTPUT_NAME)|SET(LIBMYSQL_OS_OUTPUT_NAME "mysqlclient")|' $ROOT/$PKG_BUILD/scripts/CMakeLists.txt - sed -i "s|COMMAND comp_err|COMMAND $ROOT/$TOOLCHAIN/bin/comp_err|" $ROOT/$PKG_BUILD/extra/CMakeLists.txt - sed -i "s|COMMAND comp_sql|COMMAND $ROOT/$TOOLCHAIN/bin/comp_sql|" $ROOT/$PKG_BUILD/scripts/CMakeLists.txt - sed -i "s|COMMAND gen_lex_hash|COMMAND $ROOT/$TOOLCHAIN/bin/gen_lex_hash|" $ROOT/$PKG_BUILD/sql/CMakeLists.txt - - sed -i '/^IF(NOT BOOST_MINOR_VERSION.*$/,/^ENDIF()$/d' $ROOT/$PKG_BUILD/cmake/boost.cmake -} +PKG_DEPENDS_HOST="toolchain zlib:host" +PKG_DEPENDS_TARGET="toolchain zlib ncurses openssl boost mysql:host" +PKG_LONGDESC="A SQL database server." PKG_CMAKE_OPTS_HOST="-DCMAKE_BUILD_TYPE=Release \ -DSTACK_DIRECTION=-1 \ @@ -59,23 +28,6 @@ PKG_CMAKE_OPTS_HOST="-DCMAKE_BUILD_TYPE=Release \ -DWITH_UNIT_TESTS=OFF \ -DWITH_ZLIB=bundled" -make_host() { - make comp_err - make gen_lex_hash - make comp_sql -} - -post_make_host() { - # needed so the binary isn't built for target - cp scripts/comp_sql ../scripts/comp_sql -} - -makeinstall_host() { - cp -P extra/comp_err $ROOT/$TOOLCHAIN/bin - cp -P sql/gen_lex_hash $ROOT/$TOOLCHAIN/bin - cp -P scripts/comp_sql $ROOT/$TOOLCHAIN/bin -} - PKG_CMAKE_OPTS_TARGET="-DINSTALL_INCLUDEDIR=include/mysql \ -DCMAKE_BUILD_TYPE=Release \ -DFEATURE_SET=classic \ @@ -97,11 +49,37 @@ PKG_CMAKE_OPTS_TARGET="-DINSTALL_INCLUDEDIR=include/mysql \ -DSTACK_DIRECTION=1 \ -DHAVE_LLVM_LIBCPP=1" +post_unpack() { + sed -i 's|GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME libmysql OUTPUT_NAME)|SET(LIBMYSQL_OS_OUTPUT_NAME "mysqlclient")|' $PKG_BUILD/scripts/CMakeLists.txt + sed -i "s|COMMAND comp_err|COMMAND $TOOLCHAIN/bin/comp_err|" $PKG_BUILD/extra/CMakeLists.txt + sed -i "s|COMMAND comp_sql|COMMAND $TOOLCHAIN/bin/comp_sql|" $PKG_BUILD/scripts/CMakeLists.txt + sed -i "s|COMMAND gen_lex_hash|COMMAND $TOOLCHAIN/bin/gen_lex_hash|" $PKG_BUILD/sql/CMakeLists.txt + + sed -i '/^IF(NOT BOOST_MINOR_VERSION.*$/,/^ENDIF()$/d' $PKG_BUILD/cmake/boost.cmake +} + +make_host() { + ninja comp_err + ninja gen_lex_hash + ninja comp_sql +} + +post_make_host() { + # needed so the binary isn't built for target + cp scripts/comp_sql ../scripts/comp_sql +} + +makeinstall_host() { + cp -P extra/comp_err $TOOLCHAIN/bin + cp -P sql/gen_lex_hash $TOOLCHAIN/bin + cp -P scripts/comp_sql $TOOLCHAIN/bin +} + post_makeinstall_target() { sed -i "s|pkgincludedir=.*|pkgincludedir=\'$SYSROOT_PREFIX/usr/include/mysql\'|" scripts/mysql_config sed -i "s|pkglibdir=.*|pkglibdir=\'$SYSROOT_PREFIX/usr/lib/mysql\'|" scripts/mysql_config cp scripts/mysql_config $SYSROOT_PREFIX/usr/bin - ln -sf $SYSROOT_PREFIX/usr/bin/mysql_config $ROOT/$TOOLCHAIN/bin/mysql_config + ln -sf $SYSROOT_PREFIX/usr/bin/mysql_config $TOOLCHAIN/bin/mysql_config rm -rf $INSTALL } diff --git a/packages/databases/mysql/patches/mysql-0001-link-against-termcap.patch b/packages/databases/mysql/patches/mysql-0001-link-against-termcap.patch deleted file mode 100644 index 033763f9d6..0000000000 --- a/packages/databases/mysql/patches/mysql-0001-link-against-termcap.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a/client/CMakeLists.txt b/client/CMakeLists.txt ---- a/client/CMakeLists.txt 2016-03-28 11:06:12.000000000 -0700 -+++ b/client/CMakeLists.txt 2016-05-19 02:34:38.828457442 -0700 -@@ -44,7 +44,7 @@ - MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc ../sql-common/sql_string.cc) - TARGET_LINK_LIBRARIES(mysql mysqlclient) - IF(UNIX) -- TARGET_LINK_LIBRARIES(mysql ${EDITLINE_LIBRARY}) -+ TARGET_LINK_LIBRARIES(mysql ${EDITLINE_LIBRARY} termcap) - ENDIF(UNIX) - - IF(NOT WITHOUT_SERVER) diff --git a/packages/databases/mysql/patches/mysql-0004-compile-comp_sql-even-when-crosscompiling.patch b/packages/databases/mysql/patches/mysql-0004-compile-comp_sql-even-when-crosscompiling.patch index e1514dbf94..e42f7b8f02 100644 --- a/packages/databases/mysql/patches/mysql-0004-compile-comp_sql-even-when-crosscompiling.patch +++ b/packages/databases/mysql/patches/mysql-0004-compile-comp_sql-even-when-crosscompiling.patch @@ -1,7 +1,8 @@ -diff -Naur a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt ---- a/scripts/CMakeLists.txt 2016-09-21 23:16:59.461308398 -0700 -+++ b/scripts/CMakeLists.txt 2016-09-21 23:23:50.606510539 -0700 -@@ -14,11 +14,8 @@ +diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt +index 1d0480b..425abb8 100644 +--- a/scripts/CMakeLists.txt ++++ b/scripts/CMakeLists.txt +@@ -14,10 +14,8 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Build comp_sql - used for embedding SQL in C or C++ programs @@ -9,9 +10,8 @@ diff -Naur a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt - ADD_EXECUTABLE(comp_sql comp_sql.c) - TARGET_LINK_LIBRARIES(comp_sql) -ENDIF() -- +ADD_EXECUTABLE(comp_sql comp_sql.c) +TARGET_LINK_LIBRARIES(comp_sql) - # Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts) - IF(NOT WIN32 OR CMAKE_CROSSCOMPILING) + # Add compiler information, for easier debugging of output from mysql_config. + SET(COMPILER_ID_AND_VERSION diff --git a/packages/databases/mysql/patches/mysql-0005-pchar-fix-in-client-authtentification.patch b/packages/databases/mysql/patches/mysql-0005-pchar-fix-in-client-authtentification.patch new file mode 100644 index 0000000000..bbde74e716 --- /dev/null +++ b/packages/databases/mysql/patches/mysql-0005-pchar-fix-in-client-authtentification.patch @@ -0,0 +1,11 @@ +--- a/sql-common/client_authentication.cc 2017-05-06 16:38:34.349486565 +0200 ++++ b/sql-common/client_authentication.cc 2017-05-06 16:41:32.286431336 +0200 +@@ -84,7 +84,7 @@ + + if (mysql->options.extension != NULL && + mysql->options.extension->server_public_key_path != NULL && +- mysql->options.extension->server_public_key_path != '\0') ++ *(mysql->options.extension->server_public_key_path) != '\0') + { + pub_key_file= fopen(mysql->options.extension->server_public_key_path, + "r"); diff --git a/packages/databases/sqlite/package.mk b/packages/databases/sqlite/package.mk index a4c9c1640f..66af7122b5 100644 --- a/packages/databases/sqlite/package.mk +++ b/packages/databases/sqlite/package.mk @@ -1,36 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="sqlite" -PKG_VERSION="autoconf-3150200" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="autoconf-3260000" +PKG_SHA256="5daa6a3fb7d1e8c767cd59c4ded8da6e4b00c61d3b466d0685e35c4dd6d7bf5d" PKG_LICENSE="PublicDomain" PKG_SITE="https://www.sqlite.org/" -PKG_URL="https://www.sqlite.org/2016/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://www.sqlite.org/2018/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="database" -PKG_SHORTDESC="sqlite: An Embeddable SQL Database Engine" -PKG_LONGDESC="SQLite is a C library that implements an embeddable SQL database engine. Programs that link with the SQLite library can have SQL database access without running a separate RDBMS process. The distribution comes with a standalone command-line access program (sqlite) that can be used to administer an SQLite database and which serves as an example of how to use the SQLite library. SQLite is not a client library used to connect to a big database server. SQLite is the server. The SQLite library reads and writes directly to and from the database files on disk." +PKG_LONGDESC="An Embeddable SQL Database Engine." +# libsqlite3.a(sqlite3.o): requires dynamic R_X86_64_PC32 reloc against 'sqlite3_stricmp' which may overflow at runtime +PKG_BUILD_FLAGS="+pic +pic:host -parallel" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_CONFIGURE_OPTS_TARGET="--disable-static \ + --enable-shared \ + --disable-readline \ + --enable-threadsafe \ + --enable-dynamic-extensions \ + --with-gnu-ld" +pre_configure_target() { # sqlite fails to compile with fast-math link time optimization. CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-O3|g"` CFLAGS=`echo $CFLAGS | sed -e "s|-ffast-math||g"` @@ -61,15 +51,4 @@ PKG_AUTORECONF="no" # sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) call, or at run-time using the # mmap_size pragma. CFLAGS="$CFLAGS -DSQLITE_TEMP_STORE=3 -DSQLITE_DEFAULT_MMAP_SIZE=268435456" - -pre_make_target() { - # dont build parallel - MAKEFLAGS=-j1 } - -PKG_CONFIGURE_OPTS_TARGET="--enable-static \ - --disable-shared \ - --disable-readline \ - --enable-threadsafe \ - --enable-dynamic-extensions \ - --with-gnu-ld" diff --git a/packages/debug/edid-decode/package.mk b/packages/debug/edid-decode/package.mk new file mode 100644 index 0000000000..144564a967 --- /dev/null +++ b/packages/debug/edid-decode/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="edid-decode" +PKG_VERSION="f56f329" +PKG_SHA256="d9347ddf6933c6f90c79230b1898da5686083f0e5ebb7ef67acb011108cfaeae" +PKG_LICENSE="None" +PKG_SITE="https://cgit.freedesktop.org/xorg/app/edid-decode/" +PKG_URL="https://cgit.freedesktop.org/xorg/app/edid-decode/snapshot/$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Decode EDID data in human-readable format" + +make_target() { + echo "$CC $CFLAGS -Wall $LDFLAGS -lm -o edid-decode edid-decode.c" + $CC $CFLAGS -Wall $LDFLAGS -lm -o edid-decode edid-decode.c +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp edid-decode $INSTALL/usr/bin +} diff --git a/packages/debug/gdb/package.mk b/packages/debug/gdb/package.mk index b87401f508..10c51b7229 100644 --- a/packages/debug/gdb/package.mk +++ b/packages/debug/gdb/package.mk @@ -1,43 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gdb" -PKG_VERSION="7.11.1" -PKG_REV="2" -PKG_ARCH="any" +PKG_VERSION="8.1" +PKG_SHA256="af61a0263858e69c5dce51eab26662ff3d2ad9aa68da9583e8143b5426be4b34" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/gdb/" PKG_URL="http://ftpmirror.gnu.org/gdb/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain zlib netbsd-curses expat" -PKG_SECTION="debug" -PKG_SHORTDESC="gdb: The GNU Debugger" -PKG_LONGDESC="The purpose of a debugger such as GDB is to allow you to see what is going on ``inside'' another program while it executes--or what another program was doing at the moment it crashed." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -CC_FOR_BUILD="$HOST_CC" -CFLAGS_FOR_BUILD="$HOST_CFLAGS" - -pre_configure_target() { - # gdb could fail on runtime if build with LTO support - strip_lto -} +PKG_DEPENDS_TARGET="toolchain zlib ncurses expat" +PKG_LONGDESC="GNU Project debugger, allows you to see what is going on inside another program while it executes." +# gdb could fail on runtime if build with LTO support PKG_CONFIGURE_OPTS_TARGET="bash_cv_have_mbstate_t=set \ --disable-shared \ @@ -55,6 +28,15 @@ PKG_CONFIGURE_OPTS_TARGET="bash_cv_have_mbstate_t=set \ --enable-libssp \ --disable-werror" +pre_configure_target() { + CC_FOR_BUILD="$HOST_CC" + CFLAGS_FOR_BUILD="$HOST_CFLAGS" +} + +makeinstall_target() { + make DESTDIR=$INSTALL install +} + post_makeinstall_target() { rm -rf $INSTALL/usr/share/gdb/python } diff --git a/packages/debug/gdb/patches/gdb-001-notex.patch b/packages/debug/gdb/patches/gdb-001-notex.patch new file mode 100644 index 0000000000..0a9804e540 --- /dev/null +++ b/packages/debug/gdb/patches/gdb-001-notex.patch @@ -0,0 +1,12 @@ +--- gdb-7.11.1/missing.orig 2017-01-30 19:01:55.652407184 +0900 ++++ gdb-7.11.1/missing 2017-01-30 19:02:53.703405905 +0900 +@@ -83,6 +83,9 @@ + # If it succeeded, we are done. + test $st -eq 0 && exit 0 + ++# No need for tex monster ++test $1 = makeinfo && exit 0 ++ + # Also exit now if we it failed (or wasn't found), and '--version' was + # passed; such an option is passed most likely to detect whether the + # program is present and works. diff --git a/packages/debug/libunwind/package.mk b/packages/debug/libunwind/package.mk new file mode 100644 index 0000000000..47698d37eb --- /dev/null +++ b/packages/debug/libunwind/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libunwind" +PKG_VERSION="1.2.1" +PKG_SHA256="3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb" +PKG_LICENSE="GPL" +PKG_SITE="http://www.nongnu.org/libunwind/" +PKG_URL="http://download.savannah.nongnu.org/releases/libunwind/libunwind-${PKG_VERSION}.tar.gz" +PKG_LONGDESC="library to determine the call-chain of a program" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared" + +makeinstall_target() { + make DESTDIR=$SYSROOT_PREFIX install +} diff --git a/packages/debug/libva-utils/package.mk b/packages/debug/libva-utils/package.mk new file mode 100644 index 0000000000..86bb90ba10 --- /dev/null +++ b/packages/debug/libva-utils/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libva-utils" +PKG_VERSION="2.3.0" +PKG_SHA256="f338497b867bbc9bf008e4892eaebda08955785dc7eb2005855bba5f1a20b037" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/01org/libva-utils" +PKG_URL="https://github.com/intel/libva-utils/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="Libva-utils is a collection of tests for VA-API (VIdeo Acceleration API)" +PKG_TOOLCHAIN="autotools" + +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="toolchain libva libdrm libX11" + DISPLAYSERVER_LIBVA="--enable-x11" +else + PKG_DEPENDS_TARGET="toolchain libva libdrm" + DISPLAYSERVER_LIBVA="--disable-x11" +fi + +PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ + --enable-drm \ + $DISPLAYSERVER_LIBVA \ + --disable-wayland \ + --disable-tests" diff --git a/packages/debug/memtester/package.mk b/packages/debug/memtester/package.mk new file mode 100644 index 0000000000..4d922a7bdf --- /dev/null +++ b/packages/debug/memtester/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="memtester" +PKG_VERSION="4.3.0" +PKG_SHA256="f9dfe2fd737c38fad6535bbab327da9a21f7ce4ea6f18c7b3339adef6bf5fd88" +PKG_LICENSE="GPL" +PKG_SITE="http://pyropus.ca/software/memtester/" +PKG_URL="http://pyropus.ca/software/memtester/old-versions/memtester-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A userspace utility for testing the memory subsystem for faults." +PKG_TOOLCHAIN="manual" + +make_target() { + make memtester +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp memtester $INSTALL/usr/bin +} diff --git a/packages/debug/memtester/patches/memtester-001-cross-compile.patch b/packages/debug/memtester/patches/memtester-001-cross-compile.patch new file mode 100644 index 0000000000..3ff6decfc7 --- /dev/null +++ b/packages/debug/memtester/patches/memtester-001-cross-compile.patch @@ -0,0 +1,34 @@ +Author: Helmut Grohne +Description: make the build system honor $CC to facilitate cross builds + +Index: memtester-4.3.0/conf-cc +=================================================================== +--- memtester-4.3.0.orig/conf-cc 2012-06-09 23:45:22.000000000 +0200 ++++ memtester-4.3.0/conf-cc 2015-09-12 20:36:27.000000000 +0200 +@@ -1,3 +1,3 @@ +-cc -O2 -DPOSIX -D_POSIX_C_SOURCE=200809L -D_FILE_OFFSET_BITS=64 -DTEST_NARROW_WRITES -c ++$CC -O2 -DPOSIX -D_POSIX_C_SOURCE=200809L -D_FILE_OFFSET_BITS=64 -DTEST_NARROW_WRITES -c + + This will be used to compile .c files. +Index: memtester-4.3.0/conf-ld +=================================================================== +--- memtester-4.3.0.orig/conf-ld 2012-06-09 23:45:22.000000000 +0200 ++++ memtester-4.3.0/conf-ld 2015-09-12 20:36:33.000000000 +0200 +@@ -1,3 +1,3 @@ +-cc -s ++$CC -s + + This will be used to link .o files into an executable. +Index: memtester-4.3.0/Makefile +=================================================================== +--- memtester-4.3.0.orig/Makefile 2015-09-12 20:01:06.000000000 +0200 ++++ memtester-4.3.0/Makefile 2015-09-12 20:50:40.000000000 +0200 +@@ -10,8 +10,6 @@ + # You don't need to edit these; change the contents of the conf-cc and conf-ld + # files if you need to change the compile/link commands. See the README for + # more information. +-CC = $(shell head -n 1 conf-cc) +-LD = $(shell head -n 1 conf-ld) + + SOURCES = memtester.c tests.c + OBJECTS = $(SOURCES:.c=.o) diff --git a/packages/debug/valgrind/package.mk b/packages/debug/valgrind/package.mk index e8163f3a8a..e22ad4e3ed 100644 --- a/packages/debug/valgrind/package.mk +++ b/packages/debug/valgrind/package.mk @@ -1,42 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="valgrind" -PKG_VERSION="3.12.0" -PKG_REV="0" -PKG_ARCH="any" +PKG_VERSION="3.14.0" +PKG_SHA256="037c11bfefd477cc6e9ebe8f193bb237fe397f7ce791b4a4ce3fa1c6a520baa5" PKG_LICENSE="GPL" PKG_SITE="http://valgrind.org/" -PKG_URL="http://valgrind.org/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="ftp://sourceware.org/pub/valgrind/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="debug" -PKG_SHORTDESC="A tool to help find memory-management problems in programs" PKG_LONGDESC="A tool to help find memory-management problems in programs" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - if [ "$TARGET_ARCH" = "arm" ]; then PKG_CONFIGURE_OPTS_TARGET="--enable-only32bit" elif [ "$TARGET_ARCH" = "aarch64" -o "$TARGET_ARCH" = "x86_64" ]; then PKG_CONFIGURE_OPTS_TARGET="--enable-only64bit" fi - -pre_configure_target() { - strip_lto -} diff --git a/packages/debug/valgrind/patches/valgrind-0001-enable-armv8.patch b/packages/debug/valgrind/patches/valgrind-0001-enable-armv8.patch new file mode 100644 index 0000000000..5e690a195d --- /dev/null +++ b/packages/debug/valgrind/patches/valgrind-0001-enable-armv8.patch @@ -0,0 +1,12 @@ +diff -Naur a/configure b/configure +--- a/configure 2017-06-15 06:41:35.000000000 -0700 ++++ b/configure 2018-06-26 14:51:02.264580174 -0700 +@@ -5627,7 +5627,7 @@ + ARCH_MAX="s390x" + ;; + +- armv7*) ++ armv7*|armv8*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5 + $as_echo "ok (${host_cpu})" >&6; } + ARCH_MAX="arm" diff --git a/packages/debug/vdpauinfo/package.mk b/packages/debug/vdpauinfo/package.mk index 9c2c597c75..b8725e2164 100644 --- a/packages/debug/vdpauinfo/package.mk +++ b/packages/debug/vdpauinfo/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="vdpauinfo" PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="4054960b7ae618c351ff1ce3e7831b5cbda964ae1fbf9969b7146404d3044bc4" PKG_LICENSE="GPL" PKG_SITE="http://freedesktop.org/wiki/Software/VDPAU" PKG_URL="http://people.freedesktop.org/~aplattner/vdpau/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libvdpau" -PKG_SECTION="debug" -PKG_SHORTDESC="vdpauinfo: a tool to show vdpau infos " -PKG_LONGDESC="VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A tool to show vdpau infos." diff --git a/packages/devel/arm-mem/package.mk b/packages/devel/arm-mem/package.mk index 4994b3fdf4..f49044a7c1 100644 --- a/packages/devel/arm-mem/package.mk +++ b/packages/devel/arm-mem/package.mk @@ -1,42 +1,28 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="arm-mem" -PKG_VERSION="3aee5f4" -PKG_REV="1" +PKG_VERSION="a3277ce" +PKG_SHA256="f571bbc43e3670c8f52447eb885f0c561ed039bcfb692678681899d7df13b165" PKG_ARCH="arm" PKG_LICENSE="GPL" PKG_SITE="https://github.com/bavison/arm-mem" PKG_URL="https://github.com/bavison/arm-mem/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" PKG_DEPENDS_INIT="toolchain arm-mem" -PKG_SECTION="devel" -PKG_SHORTDESC="arm-mem: ARM-accelerated versions of selected functions from string.h" PKG_LONGDESC="arm-mem is a ARM-accelerated versions of selected functions from string.h" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +if [ "$DEVICE" = "RPi2" -o "$DEVICE" = "Slice3" ] ; then + PKG_LIB_ARM_MEM="libarmmem-v7l.so" +else + PKG_LIB_ARM_MEM="libarmmem-v6l.so" +fi -PKG_MAKE_OPTS_TARGET="libarmmem.so" +PKG_MAKE_OPTS_TARGET="$PKG_LIB_ARM_MEM" pre_make_target() { export CROSS_COMPILE=$TARGET_PREFIX - export CFLAGS="$CFLAGS -fPIC" } make_init() { @@ -45,17 +31,16 @@ make_init() { makeinstall_target() { mkdir -p $INSTALL/usr/lib - cp -P libarmmem.so $INSTALL/usr/lib + cp -P $PKG_LIB_ARM_MEM $INSTALL/usr/lib mkdir -p $INSTALL/etc - echo "/usr/lib/libarmmem.so" >> $INSTALL/etc/ld.so.preload + echo "/usr/lib/$PKG_LIB_ARM_MEM" >> $INSTALL/etc/ld.so.preload } makeinstall_init() { mkdir -p $INSTALL/usr/lib - cp -P libarmmem.so $INSTALL/usr/lib + cp -P $PKG_LIB_ARM_MEM $INSTALL/usr/lib mkdir -p $INSTALL/etc - echo "/usr/lib/libarmmem.so" >> $INSTALL/etc/ld.so.preload + echo "/usr/lib/$PKG_LIB_ARM_MEM" >> $INSTALL/etc/ld.so.preload } - diff --git a/packages/devel/attr/package.mk b/packages/devel/attr/package.mk index b1950c1ef4..2e52ddef27 100644 --- a/packages/devel/attr/package.mk +++ b/packages/devel/attr/package.mk @@ -1,43 +1,23 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -#      Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="attr" PKG_VERSION="2.4.47" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="25772f653ac5b2e3ceeb89df50e4688891e21f723c460636548971652af0a859" PKG_LICENSE="GPL" PKG_SITE="" PKG_URL="http://download.savannah.gnu.org/releases-noredirect/attr/$PKG_NAME-$PKG_VERSION.src.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="accessibility" -PKG_SHORTDESC="attr: Extended Attributes Of Filesystem Objects" -PKG_LONGDESC="Extended attributes are name:value pairs associated permanently with files and directories, similar to the environment strings associated with a process. An attribute may be defined or undefined. If it is defined, its value may be empty or non-empty. Extended attributes are extensions to the normal attributes which are associated with all inodes in the system (i.e. the stat(2) data). They are often used to provide additional functionality to a filesystem - for example, additional security features such as Access Control Lists (ACLs) may be implemented using extended attributes." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Extended Attributes Of Filesystem Objects." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="OPTIMIZER= \ CONFIG_SHELL=/bin/bash \ INSTALL_USER=root INSTALL_GROUP=root \ --disable-shared --enable-static" -if [ "$DEBUG" = yes ]; then +if build_with_debug; then PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET DEBUG=-DDEBUG" else PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET DEBUG=-DNDEBUG" @@ -45,7 +25,7 @@ fi pre_configure_target() { # attr fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME } diff --git a/packages/devel/autoconf-archive/package.mk b/packages/devel/autoconf-archive/package.mk index 1d1d04e60e..f6590d4e1b 100644 --- a/packages/devel/autoconf-archive/package.mk +++ b/packages/devel/autoconf-archive/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="autoconf-archive" -PKG_VERSION="2015.09.25" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2017.09.28" +PKG_SHA256="5c9fb5845b38b28982a3ef12836f76b35f46799ef4a2e46b48e2bd3c6182fa01" PKG_LICENSE="GPL" PKG_SITE="https://www.gnu.org/software/autoconf-archive/" PKG_URL="http://ftpmirror.gnu.org/autoconf-archive/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="autoconf-archive: macros for autoconf" PKG_LONGDESC="autoconf-archive is an package of m4 macros" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME --prefix=$ROOT/$TOOLCHAIN" +PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME --prefix=$TOOLCHAIN" makeinstall_host() { # make install diff --git a/packages/devel/autoconf/package.mk b/packages/devel/autoconf/package.mk index 52868fc411..5ab7b4b51d 100644 --- a/packages/devel/autoconf/package.mk +++ b/packages/devel/autoconf/package.mk @@ -1,38 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="autoconf" PKG_VERSION="2.69" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684" PKG_LICENSE="GPL" PKG_SITE="http://sources.redhat.com/autoconf/" PKG_URL="http://ftpmirror.gnu.org/autoconf/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host m4:host gettext:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="autoconf: A GNU tool for automatically configuring source code" -PKG_LONGDESC="Autoconf is an extensible package of m4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention. Autoconf creates a configuration script for a package from a template file that lists the operating system features that the package can use, in the form of m4 macro calls." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A GNU tool for automatically configuring source code." PKG_CONFIGURE_OPTS_HOST="EMACS=no \ - ac_cv_path_M4=$ROOT/$TOOLCHAIN/bin/m4 \ + ac_cv_path_M4=$TOOLCHAIN/bin/m4 \ ac_cv_prog_gnu_m4_gnu=no \ --target=$TARGET_NAME" diff --git a/packages/devel/autoconf/patches/autoconf-0100-backport-runstatedir.patch b/packages/devel/autoconf/patches/autoconf-0100-backport-runstatedir.patch new file mode 100644 index 0000000000..37a03843aa --- /dev/null +++ b/packages/devel/autoconf/patches/autoconf-0100-backport-runstatedir.patch @@ -0,0 +1,59 @@ +From 8e269b13bc042bc2504d5860e0d453b4aac32909 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 24 Jun 2018 13:45:26 +0200 +Subject: [PATCH] backport AC_INIT: add --runstatedir option to configure + +Backport of a197431414088a417b407b9b20583b2e8f7363bd. +Changes to NEWS and doc/autoconf.tex have been dropped. +--- + lib/autoconf/general.m4 | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 +index adfae1db..1437c0ca 100644 +--- a/lib/autoconf/general.m4 ++++ b/lib/autoconf/general.m4 +@@ -586,6 +586,7 @@ AC_SUBST([datadir], ['${datarootdir}'])dnl + AC_SUBST([sysconfdir], ['${prefix}/etc'])dnl + AC_SUBST([sharedstatedir], ['${prefix}/com'])dnl + AC_SUBST([localstatedir], ['${prefix}/var'])dnl ++AC_SUBST([runstatedir], ['${localstatedir}/run'])dnl + AC_SUBST([includedir], ['${prefix}/include'])dnl + AC_SUBST([oldincludedir], ['/usr/include'])dnl + AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], +@@ -812,6 +813,15 @@ do + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + ++ -runstatedir | --runstatedir | --runstatedi | --runstated \ ++ | --runstate | --runstat | --runsta | --runst | --runs \ ++ | --run | --ru | --r) ++ ac_prev=runstatedir ;; ++ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ ++ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ ++ | --run=* | --ru=* | --r=*) ++ runstatedir=$ac_optarg ;; ++ + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ +@@ -921,7 +931,7 @@ fi + for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ +- libdir localedir mandir ++ libdir localedir mandir runstatedir + do + eval ac_val=\$$ac_var + # Remove trailing slashes. +@@ -1058,6 +1068,7 @@ Fine tuning of the installation directories: + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] ++ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] +-- +2.11.0 + diff --git a/packages/devel/automake/package.mk b/packages/devel/automake/package.mk index f3406d9d1a..0f371369e6 100644 --- a/packages/devel/automake/package.mk +++ b/packages/devel/automake/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="automake" -PKG_VERSION="1.15" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.15.1" +PKG_SHA256="af6ba39142220687c500f79b4aa2f181d9b24e4f8d8ec497cea4ba26c64bedaf" PKG_LICENSE="GPL" PKG_SITE="http://sources.redhat.com/automake/" PKG_URL="http://ftpmirror.gnu.org/automake/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host autoconf:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="automake: A GNU tool for automatically creating Makefiles" -PKG_LONGDESC="This is Automake, a Makefile generator. It was inspired by the 4.4BSD make and include files, but aims to be portable and to conform to the GNU standards for Makefile variables and targets. Automake is a Perl script. The input files are called Makefile.am. The output files are called Makefile.in; they are intended for use with Autoconf. Automake requires certain things to be done in your configure.in." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A GNU tool for automatically creating Makefiles." PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME --disable-silent-rules" diff --git a/packages/devel/binutils/package.mk b/packages/devel/binutils/package.mk index ae29f9c403..19c4a738e1 100644 --- a/packages/devel/binutils/package.mk +++ b/packages/devel/binutils/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="binutils" -PKG_VERSION="2.27" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.31.1" +PKG_SHA256="e88f8d36bd0a75d3765a4ad088d819e35f8d7ac6288049780e2fefcad18dde88" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/binutils/" PKG_URL="http://ftpmirror.gnu.org/binutils/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host bison:host flex:host linux:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="binutils: A GNU collection of binary utilities" -PKG_LONGDESC="The GNU binutils are utilities of use when dealing with object files. the packages includes ld - the GNU linker, as - the GNU assembler, addr2line - converts addresses into filenames and line numbers, ar - a utility for creating, modifying and extracting from archives, c++filt - filter to demangle encoded C++ symbols, gprof - displays profiling information, nlmconv - converts object code into an NLM, nm - lists symbols from object files, objcopy - Copys and translates object files, objdump - displays information from object files, ranlib - generates an index to the contents of an archive, readelf - displays information from any ELF format object file, size - lists the section sizes of an object or archive file, strings - lists printable strings from files, strip - discards symbols as well as windres - a compiler for Windows resource files." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain binutils:host" +PKG_LONGDESC="A GNU collection of binary utilities." PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME \ --with-sysroot=$SYSROOT_PREFIX \ @@ -47,6 +28,23 @@ PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME \ --enable-lto \ --disable-nls" +PKG_CONFIGURE_OPTS_TARGET="--target=$TARGET_NAME \ + --with-sysroot=$SYSROOT_PREFIX \ + --with-lib-path=$SYSROOT_PREFIX/lib:$SYSROOT_PREFIX/usr/lib \ + --without-ppl \ + --without-cloog \ + --enable-static \ + --disable-shared \ + --disable-werror \ + --disable-multilib \ + --disable-libada \ + --disable-libssp \ + --disable-plugins \ + --disable-gold \ + --disable-ld \ + --disable-lto \ + --disable-nls" + pre_configure_host() { unset CPPFLAGS unset CFLAGS @@ -63,3 +61,15 @@ makeinstall_host() { cp -v ../include/libiberty.h $SYSROOT_PREFIX/usr/include make install } + +make_target() { + make configure-host + make -C libiberty + make -C bfd +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib + cp libiberty/libiberty.a $SYSROOT_PREFIX/usr/lib + make DESTDIR="$SYSROOT_PREFIX" -C bfd install +} diff --git a/packages/devel/bison/package.mk b/packages/devel/bison/package.mk index 729221cf7b..5c15fbc23d 100644 --- a/packages/devel/bison/package.mk +++ b/packages/devel/bison/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="bison" -PKG_VERSION="3.0.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.0.5" +PKG_SHA256="075cef2e814642e30e10e8155e93022e4a91ca38a65aa1d5467d4e969f97f338" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/bison/" PKG_URL="http://ftpmirror.gnu.org/bison/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="devel" -PKG_SHORTDESC="bison: The GNU general-purpose parser generator" -PKG_LONGDESC="Bison is a general-purpose parser generator that converts a grammar description for an LALR(1) context-free grammar into a C program to parse that grammar. Once you are proficient with Bison, you may use it to develop a wide range of language parsers, from those used in simple desk calculators to complex programming languages. Bison is upward compatible with Yacc: all properly-written Yacc grammars ought to work with Bison with no change. Anyone familiar with Yacc should be able to use Bison with little trouble. You need to be fluent in C programming in order to use Bison or to understand this manual." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A general-purpose parser generator." PKG_CONFIGURE_OPTS_HOST="--disable-rpath --with-gnu-ld" diff --git a/packages/devel/boost/package.mk b/packages/devel/boost/package.mk index 360a46831f..be04c26908 100644 --- a/packages/devel/boost/package.mk +++ b/packages/devel/boost/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="boost" -PKG_VERSION="1_61_0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1_65_1" +PKG_SHA256="9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81" PKG_LICENSE="OSS" PKG_SITE="http://www.boost.org/" -PKG_URL="$SOURCEFORGE_SRC/boost/boost/1.61.0/${PKG_NAME}_${PKG_VERSION}.tar.bz2" -PKG_SOURCE_DIR="${PKG_NAME}_${PKG_VERSION}" -PKG_DEPENDS_HOST="" -PKG_DEPENDS_TARGET="toolchain boost:host Python:host zlib bzip2" -PKG_SECTION="devel" -PKG_SHORTDESC="boost: Peer-reviewed STL style libraries for C++" -PKG_LONGDESC="Boost provides free peer-reviewed portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. One goal is to establish existing practice and provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's upcoming C++ Standard Library Technical Report." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_URL="$SOURCEFORGE_SRC/boost/boost/1.65.1/${PKG_NAME}_${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain boost:host Python2 zlib bzip2" +PKG_LONGDESC="boost: Peer-reviewed STL style libraries for C++" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="+pic" make_host() { cd tools/build/src/engine @@ -39,39 +18,41 @@ make_host() { } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp bin.*/bjam $ROOT/$TOOLCHAIN/bin + mkdir -p $TOOLCHAIN/bin + cp bin.*/bjam $TOOLCHAIN/bin } pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" - export CXXFLAGS="$CXXFLAGS -fPIC" - export LDFLAGS="$LDFLAGS -fPIC" + export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/$PKG_PYTHON_VERSION" + export CXXFLAGS="$CXXFLAGS -I$SYSROOT_PREFIX/usr/include/$PKG_PYTHON_VERSION" } configure_target() { sh bootstrap.sh --prefix=/usr \ - --with-bjam=$ROOT/$TOOLCHAIN/bin/bjam \ - --with-python=$ROOT/$TOOLCHAIN/bin/python \ + --with-bjam=$TOOLCHAIN/bin/bjam \ + --with-python=$TOOLCHAIN/bin/python \ + --with-python-root=$SYSROOT_PREFIX/usr echo "using gcc : `$CC -v 2>&1 | tail -n 1 |awk '{print $3}'` : $CC : \"$CFLAGS\" \"$LDFLAGS\" ;" \ > tools/build/src/user-config.jam -} - -make_target() { - : # nothing todo, we use makeinstall_target() + echo "using python : ${PKG_PYTHON_VERSION/#python} : $TOOLCHAIN : $SYSROOT_PREFIX/usr/include : $SYSROOT_PREFIX/usr/lib ;" \ + >> tools/build/src/user-config.jam } makeinstall_target() { - $ROOT/$TOOLCHAIN/bin/bjam -d2 --toolset=gcc link=static \ - --prefix=$SYSROOT_PREFIX/usr \ - --ignore-site-config \ - --layout=system \ - --with-thread \ - --with-iostreams \ - --with-system \ - --with-serialization \ - --with-filesystem \ - --with-regex -sICU_PATH="$SYSROOT_PREFIX/usr" \ - install + $TOOLCHAIN/bin/bjam -d2 --ignore-site-config \ + --layout=system \ + --prefix=$SYSROOT_PREFIX/usr \ + --toolset=gcc link=static \ + --with-chrono \ + --with-date_time \ + --with-filesystem \ + --with-iostreams \ + --with-python \ + --with-random \ + --with-regex -sICU_PATH="$SYSROOT_PREFIX/usr" \ + --with-serialization \ + --with-system \ + --with-thread \ + install } diff --git a/packages/devel/breakpad/package.mk b/packages/devel/breakpad/package.mk new file mode 100644 index 0000000000..d947f1cd2e --- /dev/null +++ b/packages/devel/breakpad/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# 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. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################ + +PKG_NAME="breakpad" +PKG_VERSION="0291f06" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="https://chromium.googlesource.com/breakpad/breakpad/" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="toolchain" +PKG_DEPENDS_TARGET="toolchain breakpad:host" +PKG_SECTION="devel" +PKG_SHORTDESC="Breakpad is a set of client and server components which implement a crash-reporting system." +PKG_LONGDESC="Breakpad is a set of client and server components which implement a crash-reporting system." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_HOST="--enable-selftest" +PKG_CONFIGURE_OPTS_TARGET="--disable-processor --disable-tools" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/devel/ccache/package.mk b/packages/devel/ccache/package.mk index 0822fc033f..f0cc2a309b 100644 --- a/packages/devel/ccache/package.mk +++ b/packages/devel/ccache/package.mk @@ -1,58 +1,40 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="ccache" -PKG_VERSION="3.3.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.3.6" +PKG_SHA256="eac8d2a5055014bebae1434d9b7c66c25d64323800808c27a4534cee167e6bea" PKG_LICENSE="GPL" -PKG_SITE="http://ccache.samba.org/" -PKG_URL="http://samba.org/ftp/ccache/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_SITE="https://ccache.samba.org/" +PKG_URL="https://samba.org/ftp/ccache/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="make:host" -PKG_SECTION="devel" -PKG_SHORTDESC="ccache: A fast compiler cache" -PKG_LONGDESC="Ccache is a compiler cache. It speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -export CC=$LOCAL_CC -export CXX=$LOCAL_CXX +PKG_LONGDESC="A compiler cache to speed up re-compilation of C/C++ code by caching." PKG_CONFIGURE_OPTS_HOST="--with-bundled-zlib" +pre_configure_host() { + export CC=$LOCAL_CC + export CXX=$LOCAL_CXX +} + post_makeinstall_host() { # setup ccache if [ -z "$CCACHE_DISABLE" ]; then - $ROOT/$TOOLCHAIN/bin/ccache --max-size=$CCACHE_CACHE_SIZE + $TOOLCHAIN/bin/ccache --max-size=$CCACHE_CACHE_SIZE fi - cat > $ROOT/$TOOLCHAIN/bin/host-gcc < $TOOLCHAIN/bin/host-gcc < $ROOT/$TOOLCHAIN/bin/host-g++ < $TOOLCHAIN/bin/host-g++ <. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="cmake" -PKG_VERSION="3.6.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.13.2" +PKG_SHA256="c925e7d2c5ba511a69f43543ed7b4182a7d446c274c7480d0e42cd933076ae25" PKG_LICENSE="BSD" PKG_SITE="http://www.cmake.org/" -PKG_URL="http://www.cmake.org/files/v3.6/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="ccache:host libressl:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="cmake: A cross-platform, open-source make system" -PKG_LONGDESC="CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. CMake is quite sophisticated: it is possible to support complex environments requiring system configuration, preprocessor generation, code generation, and template instantiation." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_URL="http://www.cmake.org/files/v${PKG_VERSION%.*}/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="ccache:host openssl:host" +PKG_LONGDESC="A cross-platform, open-source make system." +PKG_TOOLCHAIN="configure" configure_host() { - ../configure --prefix=$ROOT/$TOOLCHAIN \ + ../configure --prefix=$TOOLCHAIN \ --no-qt-gui --no-system-libs \ -- \ -DCMAKE_C_FLAGS="-O2 -Wall -pipe -Wno-format-security" \ diff --git a/packages/devel/configtools/package.mk b/packages/devel/configtools/package.mk index 0ae46b7778..66326337dd 100644 --- a/packages/devel/configtools/package.mk +++ b/packages/devel/configtools/package.mk @@ -1,34 +1,17 @@ -################################################################################ -# 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. -# -# This program 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. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="configtools" PKG_VERSION="706fbe5" -PKG_ARCH="any" +PKG_SHA256="185511fd06ccbb892e14d6c593f68f0f1fd7c713b21a8d8bd3c7fd949e9c5979" PKG_LICENSE="GPL" PKG_SITE="http://git.savannah.gnu.org/cgit/config.git" PKG_URL="http://git.savannah.gnu.org/cgit/config.git/snapshot/$PKG_VERSION.tar.xz" -PKG_SOURCE_DIR="$PKG_VERSION*" PKG_DEPENDS_HOST="" -PKG_SHORTDESC="configtools" PKG_LONGDESC="configtools" - -make_host() { - : -} +PKG_TOOLCHAIN="manual" makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/configtools - cp config.* $ROOT/$TOOLCHAIN/configtools + mkdir -p $TOOLCHAIN/configtools + cp config.* $TOOLCHAIN/configtools } diff --git a/packages/devel/crossguid/package.mk b/packages/devel/crossguid/package.mk index 676b396d9e..4ffb88d1be 100644 --- a/packages/devel/crossguid/package.mk +++ b/packages/devel/crossguid/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="crossguid" PKG_VERSION="8f399e8" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="022c9f02cc36e865cd8fd0111a597ff2bd91988deeb348dbe2aba64aed1abd99" PKG_LICENSE="GPL" PKG_SITE="https://github.com/graeme-hill/crossguid" PKG_URL="https://github.com/graeme-hill/crossguid/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="minimal, cross platform, C++ GUID library" +PKG_DEPENDS_TARGET="toolchain util-linux" PKG_LONGDESC="minimal, cross platform, C++ GUID library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" make_target() { $CXX -c guid.cpp -o guid.o $CXXFLAGS -std=c++11 -DGUID_LIBUUID diff --git a/packages/devel/dbus-glib/package.mk b/packages/devel/dbus-glib/package.mk index 53f8f8d4ee..115e1abcdd 100644 --- a/packages/devel/dbus-glib/package.mk +++ b/packages/devel/dbus-glib/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="dbus-glib" PKG_VERSION="0.108" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="9f340c7e2352e9cdf113893ca77ca9075d9f8d5e81476bf2bf361099383c602c" PKG_LICENSE="GPL" PKG_SITE="https://freedesktop.org/wiki/Software/dbus" PKG_URL="https://dbus.freedesktop.org/releases/dbus-glib/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain dbus glib expat" -PKG_SECTION="devel" -PKG_SHORTDESC="dbus-glib: A message bus system" -PKG_LONGDESC="D-BUS is a message bus, used for sending messages between applications. Conceptually, it fits somewhere in between raw sockets and CORBA in terms of complexity." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A message bus, used for sending messages between applications." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic +lto" PKG_CONFIGURE_OPTS_TARGET="ac_cv_have_abstract_sockets=yes \ ac_cv_func_posix_getpwnam_r=yes \ @@ -40,10 +21,6 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_have_abstract_sockets=yes \ --disable-bash-completion \ --enable-asserts=no" -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin/dbus-binding-tool } diff --git a/packages/devel/elfutils/package.mk b/packages/devel/elfutils/package.mk index fc222ed02a..6a2cedbc36 100644 --- a/packages/devel/elfutils/package.mk +++ b/packages/devel/elfutils/package.mk @@ -1,60 +1,54 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="elfutils" -PKG_VERSION="0.167" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.173" +PKG_SHA256="b76d8c133f68dad46250f5c223482c8299d454a69430d9aa5c19123345a000ff" PKG_LICENSE="GPL" -PKG_SITE="https://fedorahosted.org/elfutils/" -PKG_URL="https://fedorahosted.org/releases/e/l/elfutils/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_SITE="https://sourceware.org/elfutils/" +PKG_URL="https://sourceware.org/elfutils/ftp/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_HOST="make:host zlib:host" PKG_DEPENDS_TARGET="toolchain zlib" -PKG_SECTION="devel" -PKG_SHORTDESC="elfutils: collection of utilities to handle ELF objects" -PKG_LONGDESC="Elfutils is a collection of utilities, including eu-ld (a linker), eu-nm (for listing symbols from object files), eu-size (for listing the section sizes of an object or archive file), eu-strip (for discarding symbols), eu-readelf (to see the raw ELF file structures), and eu-elflint (to check for well-formed ELF files)." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A collection of utilities to handle ELF objects." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="utrace_cv_cc_biarch=false \ - --disable-werror \ - --disable-progs \ --disable-nls \ --with-zlib \ --without-bzlib \ --without-lzma" -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" +PKG_CONFIGURE_OPTS_HOST="utrace_cv_cc_biarch=false \ + --disable-nls \ + --with-zlib \ + --without-bzlib \ + --without-lzma" + +makeinstall_host() { + make DESTDIR="$INSTALL" -C libelf install } make_target() { make V=1 -C libelf libelf.a make V=1 -C libebl libebl.a make V=1 -C libdwfl libdwfl.a + make V=1 -C libdwelf libdwelf.a make V=1 -C libdw libdw.a } makeinstall_target() { make DESTDIR="$SYSROOT_PREFIX" -C libelf install-includeHEADERS install-pkgincludeHEADERS + make DESTDIR="$SYSROOT_PREFIX" -C libdwfl install-pkgincludeHEADERS make DESTDIR="$SYSROOT_PREFIX" -C libdw install-includeHEADERS install-pkgincludeHEADERS mkdir -p $SYSROOT_PREFIX/usr/lib cp libelf/libelf.a $SYSROOT_PREFIX/usr/lib + cp libebl/libebl.a $SYSROOT_PREFIX/usr/lib + cp libdwfl/libdwfl.a $SYSROOT_PREFIX/usr/lib cp libdw/libdw.a $SYSROOT_PREFIX/usr/lib + + mkdir -p $SYSROOT_PREFIX/usr/include/elfutils + cp version.h $SYSROOT_PREFIX/usr/include/elfutils } diff --git a/packages/devel/fakeroot/package.mk b/packages/devel/fakeroot/package.mk index d21b7f6257..cca5a05325 100644 --- a/packages/devel/fakeroot/package.mk +++ b/packages/devel/fakeroot/package.mk @@ -1,38 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) # fakeroot-1.20.2 depends on libcap:host, which depends on attr:host # there are reported buildproblems with attr:host, which should be replicated -# use fakeroot-1.18.4 instead until attr:host builds +# use fakeroot-1.18.4 instead until attr:host builds PKG_NAME="fakeroot" PKG_VERSION="1.20.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="7c0a164d19db3efa9e802e0fc7cdfeff70ec6d26cdbdc4338c9c2823c5ea230c" PKG_LICENSE="GPL3" PKG_SITE="http://fakeroot.alioth.debian.org/" PKG_URL="http://ftp.debian.org/debian/pool/main/f/fakeroot/${PKG_NAME}_${PKG_VERSION}.orig.tar.bz2" PKG_DEPENDS_HOST="ccache:host libcap:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="fakeroot: provides a fake root environment by means of LD_PRELOAD and SYSV IPC (or TCP) trickery." PKG_LONGDESC="fakeroot provides a fake root environment by means of LD_PRELOAD and SYSV IPC (or TCP) trickery." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_HOST="--with-gnu-ld" diff --git a/packages/devel/flatbuffers/package.mk b/packages/devel/flatbuffers/package.mk new file mode 100644 index 0000000000..7e6f7ea7f8 --- /dev/null +++ b/packages/devel/flatbuffers/package.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="flatbuffers" +PKG_VERSION="1.9.0" +PKG_SHA256="5ca5491e4260cacae30f1a5786d109230db3f3a6e5a0eb45d0d0608293d247e3" +PKG_LICENSE="Apache-2.0" +PKG_SITE="https://github.com/google/flatbuffers" +PKG_URL="https://github.com/google/flatbuffers/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="An efficient cross platform serialization library for games and other memory constrained apps." + +PKG_CMAKE_OPTS_HOST="-DFLATBUFFERS_CODE_COVERAGE=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_INSTALL=ON \ + -DFLATBUFFERS_BUILD_FLATLIB=OFF \ + -DFLATBUFFERS_BUILD_FLATC=ON \ + -DFLATBUFFERS_BUILD_FLATHASH=OFF \ + -DFLATBUFFERS_BUILD_GRPCTEST=OFF \ + -DFLATBUFFERS_BUILD_SHAREDLIB=OFF" + +PKG_CMAKE_OPTS_TARGET="-DFLATBUFFERS_CODE_COVERAGE=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_INSTALL=ON \ + -DFLATBUFFERS_BUILD_FLATLIB=OFF \ + -DFLATBUFFERS_BUILD_FLATC=OFF \ + -DFLATBUFFERS_BUILD_FLATHASH=OFF \ + -DFLATBUFFERS_BUILD_GRPCTEST=OFF \ + -DFLATBUFFERS_BUILD_SHAREDLIB=OFF" + +pre_configure_host() { + export CXXFLAGS="$CXXFLAGS -std=c++11" +} + +post_makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp -PR $PKG_BUILD/.$HOST_NAME/flatc $TOOLCHAIN/bin +} diff --git a/packages/devel/flex/package.mk b/packages/devel/flex/package.mk index f784d346ab..091e4c2cfa 100644 --- a/packages/devel/flex/package.mk +++ b/packages/devel/flex/package.mk @@ -1,43 +1,23 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="flex" PKG_VERSION="2.5.39" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="add2b55f3bc38cb512b48fad7d72f43b11ef244487ff25fc00aabec1e32b617f" PKG_LICENSE="GPL" PKG_SITE="http://flex.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/flex/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="flex: Fast lexical analyzer generator" -PKG_LONGDESC="flex is a tool for generating programs that perform pattern-matching on text." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A tool for generating programs that perform pattern-matching on text." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared --disable-rpath --with-gnu-ld" post_makeinstall_host() { - cat > $ROOT/$TOOLCHAIN/bin/lex << "EOF" + cat > $TOOLCHAIN/bin/lex << "EOF" #!/bin/sh exec flex "$@" EOF - chmod -v 755 $ROOT/$TOOLCHAIN/bin/lex + chmod -v 755 $TOOLCHAIN/bin/lex } diff --git a/packages/devel/flex/patches/flex-002-nodocs.patch b/packages/devel/flex/patches/flex-002-nodocs.patch new file mode 100644 index 0000000000..ebe9089ab3 --- /dev/null +++ b/packages/devel/flex/patches/flex-002-nodocs.patch @@ -0,0 +1,10 @@ +--- flex-2.5.39/Makefile.am.orig 2017-01-26 21:20:07.947836925 +0900 ++++ flex-2.5.39/Makefile.am 2017-01-26 21:20:20.332836652 +0900 +@@ -117,7 +117,6 @@ + SUBDIRS = \ + lib \ + . \ +- doc \ + examples \ + po \ + tests diff --git a/packages/devel/fribidi/package.mk b/packages/devel/fribidi/package.mk index 117f1f48ba..83dc8ab006 100644 --- a/packages/devel/fribidi/package.mk +++ b/packages/devel/fribidi/package.mk @@ -1,49 +1,27 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="fribidi" -PKG_VERSION="0.19.7" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.0.1" +PKG_SHA256="c1b182d70590b6cdb5545bab8149de33b966800f27f2d9365c68917ed5a174e4" PKG_LICENSE="LGPL" PKG_SITE="http://fribidi.freedesktop.org/" -PKG_URL="http://fribidi.freedesktop.org/download/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://github.com/fribidi/fribidi/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="fribidi: The Bidirectional Algorithm library" -PKG_LONGDESC="The library implements all of the algorithm as described in the Unicode Standard Annex #9, The Bidirectional Algorithm, http://www.unicode.org/unicode/reports/tr9/. FriBidi is exhautively tested against Bidi Reference Code, and due to our best knowledge, does not contain any conformance bugs." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A bidirectional algorithm library." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ --enable-static \ --disable-debug \ --disable-deprecated \ --disable-silent-rules \ - --enable-malloc \ --enable-charsets \ --with-gnu-ld \ --without-glib" pre_configure_target() { export CFLAGS="$CFLAGS -DFRIBIDI_CHUNK_SIZE=4080" - export CFLAGS="$CFLAGS -fPIC -DPIC" } post_makeinstall_target() { diff --git a/packages/devel/fribidi/scripts/fribidi-config b/packages/devel/fribidi/scripts/fribidi-config index 8a5318272a..120b3925d0 100644 --- a/packages/devel/fribidi/scripts/fribidi-config +++ b/packages/devel/fribidi/scripts/fribidi-config @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) while test $# -gt 0; do case $1 in diff --git a/packages/devel/gettext/package.mk b/packages/devel/gettext/package.mk index 86a8555d58..48d131cb7d 100644 --- a/packages/devel/gettext/package.mk +++ b/packages/devel/gettext/package.mk @@ -1,44 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gettext" PKG_VERSION="0.19.8.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/s/gettext/" PKG_URL="http://ftp.gnu.org/pub/gnu/gettext/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="gettext: A program internationalization library and tools" -PKG_LONGDESC="This is the GNU gettext package. It is interesting for authors or maintainers of other packages or programs which they want to see internationalized. As one step the handling of messages in different languages should be implemented. For this task GNU gettext provides the needed tools and library functions." +PKG_LONGDESC="A program internationalization library and tools." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +configure_package() { + PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/gettext-tools/configure" -PKG_CONFIGURE_SCRIPT="gettext-tools/configure" - -PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared \ - --disable-rpath \ - --with-gnu-ld \ - --disable-java \ - --disable-curses \ - --with-included-libxml \ - --disable-native-java \ - --disable-csharp \ - --without-emacs" + PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared \ + --disable-rpath \ + --with-gnu-ld \ + --disable-java \ + --disable-curses \ + --with-included-libxml \ + --disable-native-java \ + --disable-csharp \ + --without-emacs" +} diff --git a/packages/devel/glib/package.mk b/packages/devel/glib/package.mk index 35dc6ecc45..a6ee22122a 100644 --- a/packages/devel/glib/package.mk +++ b/packages/devel/glib/package.mk @@ -1,44 +1,24 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2016- Team LibreELEC -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="glib" -PKG_VERSION="2.46.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.53.5" +PKG_SHA256="991421f41a4ed4cc1637e5f9db0d03fd236d2cbd19f3c5b097a343bec5126602" PKG_LICENSE="LGPL" PKG_SITE="http://www.gtk.org/" -PKG_URL="http://ftp.gnome.org/pub/gnome/sources/glib/2.46/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain zlib libffi Python:host" -PKG_DEPENDS_HOST="libffi:host" -PKG_SECTION="devel" -PKG_SHORTDESC="glib: C support library" -PKG_LONGDESC="GLib is a library which includes support routines for C such as lists, trees, hashes, memory allocation, and many other things." +PKG_URL="http://ftp.gnome.org/pub/gnome/sources/glib/${PKG_VERSION%.*}/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain zlib libffi Python2:host util-linux" +PKG_DEPENDS_HOST="libffi:host pcre:host" +PKG_LONGDESC="A library which includes support routines for C such as lists, trees, hashes, memory allocation." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared" -PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_mmap_fixed_mapped=yes \ - ac_cv_func_posix_getpwuid_r=yes \ - ac_cv_func_posix_getgrgid_r=yes \ - ac_cv_func_printf_unix98=yes \ - ac_cv_func_snprintf_c99=yes \ +PKG_CONFIGURE_OPTS_HOST="PCRE_LIBS=-l:libpcre.a \ + --enable-static \ + --disable-shared \ + --disable-libmount \ + --with-python=python" +PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_snprintf_c99=yes \ ac_cv_func_vsnprintf_c99=yes \ glib_cv_stack_grows=no \ glib_cv_uscore=no \ @@ -48,21 +28,15 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_mmap_fixed_mapped=yes \ --enable-xattr \ --disable-libelf \ --disable-gtk-doc \ + --disable-gtk-doc-html \ --disable-man \ --disable-dtrace \ --disable-systemtap \ --enable-Bsymbolic \ --with-gnu-ld \ --with-threads=posix \ - --with-pcre=internal" - -post_makeinstall_target() { - mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig - cp g*-2.0.pc $SYSROOT_PREFIX/usr/lib/pkgconfig - - mkdir -p $SYSROOT_PREFIX/usr/share/aclocal - cp ../m4macros/glib-gettext.m4 $SYSROOT_PREFIX/usr/share/aclocal -} + --with-pcre=internal \ + --with-python=python" post_makeinstall_target() { rm -rf $INSTALL/usr/bin diff --git a/packages/devel/glibc/config/nsswitch-init.conf b/packages/devel/glibc/config/nsswitch-init.conf new file mode 100644 index 0000000000..eba159e8fc --- /dev/null +++ b/packages/devel/glibc/config/nsswitch-init.conf @@ -0,0 +1,3 @@ +# This is just enough to get DNS resolution working in the initramfs + +hosts: dns diff --git a/packages/devel/glibc/config/nsswitch.conf b/packages/devel/glibc/config/nsswitch-target.conf similarity index 100% rename from packages/devel/glibc/config/nsswitch.conf rename to packages/devel/glibc/config/nsswitch-target.conf diff --git a/packages/devel/glibc/package.mk b/packages/devel/glibc/package.mk index fe673523da..a487ed0aa9 100644 --- a/packages/devel/glibc/package.mk +++ b/packages/devel/glibc/package.mk @@ -1,39 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="glibc" -PKG_VERSION="2.24" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.28" +PKG_SHA256="b1900051afad76f7a4f73e71413df4826dce085ef8ddb785a945b66d7d513082" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/libc/" PKG_URL="http://ftp.gnu.org/pub/gnu/glibc/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="ccache:host autotools:host autoconf:host linux:host gcc:bootstrap" PKG_DEPENDS_INIT="glibc" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="glibc: The GNU C library" -PKG_LONGDESC="The Glibc package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The Glibc package contains the main C library." +PKG_BUILD_FLAGS="-gold" PKG_CONFIGURE_OPTS_TARGET="BASH_SHELL=/bin/sh \ - ac_cv_path_PERL= \ + ac_cv_path_PERL=no \ ac_cv_prog_MAKEINFO= \ --libexecdir=/usr/lib/glibc \ --cache-file=config.cache \ @@ -49,24 +30,21 @@ PKG_CONFIGURE_OPTS_TARGET="BASH_SHELL=/bin/sh \ --enable-kernel=3.0.0 \ --without-cvs \ --without-gd \ - --enable-obsolete-rpc \ --disable-build-nscd \ --disable-nscd \ --enable-lock-elision \ --disable-timezone-tools" -if [ "$DEBUG" = yes ]; then +# busybox:init needs it +# testcase: boot with /storage as nfs-share (set cmdline.txt -> "ip=dhcp boot=UUID=2407-5145 disk=NFS=[nfs-share] quiet") +PKG_CONFIGURE_OPTS_TARGET+=" --enable-obsolete-rpc" + +if build_with_debug; then PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-debug" else PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-debug" fi -NSS_CONF_DIR="$PKG_BUILD/nss" - -GLIBC_EXCLUDE_BIN="catchsegv gencat getconf iconv iconvconfig ldconfig" -GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN makedb mtrace pcprofiledump" -GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN pldd rpcgen sln sotruss sprof xtrace" - pre_build_target() { cd $PKG_BUILD aclocal --force --verbose @@ -75,12 +53,6 @@ pre_build_target() { } pre_configure_target() { -# Fails to compile with GCC's link time optimization. - strip_lto - -# glibc dont support GOLD linker. - strip_gold - # Filter out some problematic *FLAGS export CFLAGS=`echo $CFLAGS | sed -e "s|-ffast-math||g"` export CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-O2|g"` @@ -104,7 +76,7 @@ pre_configure_target() { export BUILD_CC=$HOST_CC export OBJDUMP_FOR_HOST=objdump -cat >config.cache <config.cache <> configparms -echo "slibdir=/usr/lib" >> configparms -echo "sbindir=/usr/bin" >> configparms -echo "rootsbindir=/usr/bin" >> configparms + cat >configparms <. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="gmp" -PKG_VERSION="6.1.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="6.1.2" +PKG_SHA256="87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912" PKG_LICENSE="LGPLv3+" PKG_SITE="http://gmplib.org/" PKG_URL="https://gmplib.org/download/gmp/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="devel" -PKG_SHORTDESC="gmp: The GNU MP (multiple precision arithmetic) library" -PKG_LONGDESC="GNU MP is a library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. It has a rich set of functions, and the functions have a regular interface. GNU MP is designed to be as fast as possible, both for small operands and for huge operands. The speed is achieved by using fullwords as the basic arithmetic type, by using fast algorithms, by carefully optimized assembly code for the most common inner loops for a lots of CPUs, and by a general emphasis on speed (instead of simplicity or elegance). The speed of GNU MP is believed to be faster than any other similar library. The advantage for GNU MP increases with the operand sizes for certain operations, since GNU MP in many cases has asymptotically faster algorithms." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_LONGDESC="A library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers." +PKG_BUILD_FLAGS="+pic:host" PKG_CONFIGURE_OPTS_HOST="--enable-cxx --enable-static --disable-shared" pre_configure_host() { - export CFLAGS="$CFLAGS -fPIC -DPIC" export CPPFLAGS="$CPPFLAGS -fexceptions" } diff --git a/packages/devel/heimdal/package.mk b/packages/devel/heimdal/package.mk new file mode 100644 index 0000000000..f7ce5e4cf2 --- /dev/null +++ b/packages/devel/heimdal/package.mk @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="heimdal" +PKG_VERSION="7.5.0" +PKG_SHA256="ad67fef994dc2268fb0b1a8164b39330d184f425057867485a178e9785a7f35a" +PKG_LICENSE="BSD-3c" +PKG_SITE="http://www.h5l.org/" +PKG_URL="https://github.com/heimdal/heimdal/archive/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain e2fsprogs:host Python2:host ncurses:host" +PKG_LONGDESC="Kerberos 5, PKIX, CMS, GSS-API, SPNEGO, NTLM, Digest-MD5 and, SASL implementation." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="-parallel" + +PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared \ + --without-openldap \ + --without-capng \ + --without-sqlite3 \ + --without-libintl \ + --without-openssl \ + --without-berkeley-db \ + --without-readline \ + --without-libedit \ + --without-hesiod \ + --without-x \ + --disable-otp \ + --disable-heimdal-documentation" + +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp -PR lib/asn1/asn1_compile $TOOLCHAIN/bin +} diff --git a/packages/devel/intltool/package.mk b/packages/devel/intltool/package.mk index b0c34a8bb9..d4f68b3fcb 100644 --- a/packages/devel/intltool/package.mk +++ b/packages/devel/intltool/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="intltool" PKG_VERSION="0.51.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd" PKG_LICENSE="GPL" PKG_SITE="http://www.gnome.org" PKG_URL="http://launchpad.net/intltool/trunk/$PKG_VERSION/+download/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="devel" -PKG_SHORTDESC="intltool: Gnome international tools" -PKG_LONGDESC="The Gnome international tools help to handle translation strings from various source files (.xml.in, .glade, .desktop.in, .server.in, .oaf.in)." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Tools to translate strings from various source files (.xml.in, .glade, .desktop.in, .server.in, .oaf.in)." post_makeinstall_host() { mkdir -p $SYSROOT_PREFIX/usr/share/aclocal diff --git a/packages/devel/intltool/patches/intltool-0001-fix-regex-expressions.patch b/packages/devel/intltool/patches/intltool-0001-fix-regex-expressions.patch new file mode 100644 index 0000000000..dcf9105427 --- /dev/null +++ b/packages/devel/intltool/patches/intltool-0001-fix-regex-expressions.patch @@ -0,0 +1,45 @@ +=== modified file 'intltool-update.in' +--- a/intltool-update.in 2014-05-14 02:15:53 +0000 ++++ b/intltool-update.in 2016-01-19 15:59:38 +0000 +@@ -1062,7 +1062,7 @@ + } + } + +- if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/) ++ if ($str =~ /^(.*)\$\{?([A-Z_]+)}?(.*)$/) + { + my $rest = $3; + my $untouched = $1; +@@ -1190,10 +1190,10 @@ + $name =~ s/\(+$//g; + $version =~ s/\(+$//g; + +- $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); +- $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); +- $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); +- $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); ++ $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\$\{?AC_PACKAGE_NAME}?/); ++ $varhash{"PACKAGE"} = $name if (not $name =~ /\$\{?PACKAGE}?/); ++ $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\$\{?AC_PACKAGE_VERSION}?/); ++ $varhash{"VERSION"} = $version if (not $name =~ /\$\{?VERSION}?/); + } + + if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)[,]?([^,\)]+)?/m) +@@ -1219,11 +1219,11 @@ + $version =~ s/\(+$//g; + $bugurl =~ s/\(+$//g if (defined $bugurl); + +- $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); +- $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); +- $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); +- $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); +- $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\${?\w+}?/); ++ $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\$\{?AC_PACKAGE_NAME}?/); ++ $varhash{"PACKAGE"} = $name if (not $name =~ /\$\{?PACKAGE}?/); ++ $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\$\{?AC_PACKAGE_VERSION}?/); ++ $varhash{"VERSION"} = $version if (not $name =~ /\$\{?VERSION}?/); ++ $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\$\{?\w+}?/); + } + + # \s makes this not work, why? + diff --git a/packages/devel/json-c/package.mk b/packages/devel/json-c/package.mk deleted file mode 100644 index bc0058c623..0000000000 --- a/packages/devel/json-c/package.mk +++ /dev/null @@ -1,39 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -#      Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="json-c" -PKG_VERSION="537f8bc" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/json-c/json-c/wiki" -PKG_URL="https://github.com/json-c/json-c/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="accessibility" -PKG_SHORTDESC="json-c" -PKG_LONGDESC="JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects" - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_realloc_0_nonnull=yes \ - ac_cv_func_malloc_0_nonnull=yes \ - --enable-static --disable-shared \ - --disable-oldname-compat" diff --git a/packages/devel/libaio/package.mk b/packages/devel/libaio/package.mk new file mode 100644 index 0000000000..4d973e585a --- /dev/null +++ b/packages/devel/libaio/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) + +PKG_NAME="libaio" +PKG_VERSION="0.3.110" +PKG_SHA256="e019028e631725729376250e32b473012f7cb68e1f7275bfc1bbcdd0f8745f7e" +PKG_LICENSE="GPL" +PKG_SITE="http://lse.sourceforge.net/io/aio.html" +PKG_URL="http://http.debian.net/debian/pool/main/liba/libaio/${PKG_NAME}_${PKG_VERSION}.orig.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Kernel Asynchronous I/O (AIO) Support for Linux." + +make_target() { + make -C src +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib + cp -PR src/libaio.a $SYSROOT_PREFIX/usr/lib + + mkdir -p $SYSROOT_PREFIX/usr/include + cp -PR src/libaio.h $SYSROOT_PREFIX/usr/include +} diff --git a/packages/devel/libcap/package.mk b/packages/devel/libcap/package.mk index fb863b35a6..73a075aaf3 100644 --- a/packages/devel/libcap/package.mk +++ b/packages/devel/libcap/package.mk @@ -1,80 +1,60 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -#      Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libcap" PKG_VERSION="2.25" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="693c8ac51e983ee678205571ef272439d83afe62dd8e424ea14ad9790bc35162" PKG_LICENSE="GPL" PKG_SITE="" PKG_URL="http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="libcap: A library for getting and setting POSIX.1e capabilities" -PKG_LONGDESC="As of Linux 2.2.0, the power of the superuser has been partitioned into a set of discrete capabilities (in other places, these capabilities are know as privileges). The contents of the libcap package are a library and a number of simple programs that are intended to show how an application/daemon can be protected (with wrappers) or rewritten to take advantage of this fine grained approach to constraining the danger to your system from programs running as 'root'." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A library for getting and setting POSIX.1e capabilities." post_unpack() { - mkdir -p $ROOT/$PKG_BUILD/.$HOST_NAME - cp -r $ROOT/$PKG_BUILD/* $ROOT/$PKG_BUILD/.$HOST_NAME - mkdir -p $ROOT/$PKG_BUILD/.$TARGET_NAME - cp -r $ROOT/$PKG_BUILD/* $ROOT/$PKG_BUILD/.$TARGET_NAME + mkdir -p $PKG_BUILD/.$HOST_NAME + cp -r $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -r $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME } - make_host() { - cd $ROOT/$PKG_BUILD/.$HOST_NAME + cd $PKG_BUILD/.$HOST_NAME make CC=$CC \ AR=$AR \ RANLIB=$RANLIB \ CFLAGS="$HOST_CFLAGS" \ - BUILD_CFLAGS="$HOST_CFLAGS -I$ROOT/$PKG_BUILD/libcap/include" \ + BUILD_CFLAGS="$HOST_CFLAGS -I$PKG_BUILD/libcap/include" \ PAM_CAP=no \ lib=/lib \ + BUILD_GPERF=no \ -C libcap libcap.pc libcap.a } make_target() { - cd $ROOT/$PKG_BUILD/.$TARGET_NAME + cd $PKG_BUILD/.$TARGET_NAME make CC=$CC \ AR=$AR \ RANLIB=$RANLIB \ CFLAGS="$TARGET_CFLAGS" \ BUILD_CC=$HOST_CC \ - BUILD_CFLAGS="$HOST_CFLAGS -I$ROOT/$PKG_BUILD/libcap/include" \ + BUILD_CFLAGS="$HOST_CFLAGS -I$PKG_BUILD/libcap/include" \ PAM_CAP=no \ lib=/lib \ + BUILD_GPERF=no \ -C libcap libcap.pc libcap.a } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/lib - cp libcap/libcap.a $ROOT/$TOOLCHAIN/lib + mkdir -p $TOOLCHAIN/lib + cp libcap/libcap.a $TOOLCHAIN/lib - mkdir -p $ROOT/$TOOLCHAIN/lib/pkgconfig - cp libcap/libcap.pc $ROOT/$TOOLCHAIN/lib/pkgconfig + mkdir -p $TOOLCHAIN/lib/pkgconfig + cp libcap/libcap.pc $TOOLCHAIN/lib/pkgconfig - mkdir -p $ROOT/$TOOLCHAIN/include/sys - cp libcap/include/sys/capability.h $ROOT/$TOOLCHAIN/include/sys + mkdir -p $TOOLCHAIN/include/sys + cp libcap/include/sys/capability.h $TOOLCHAIN/include/sys } makeinstall_target() { diff --git a/packages/devel/libcec/package.mk b/packages/devel/libcec/package.mk index 71871a3f05..ef45e2a1be 100644 --- a/packages/devel/libcec/package.mk +++ b/packages/devel/libcec/package.mk @@ -1,52 +1,29 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libcec" -PKG_VERSION="2fc92b5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="libcec-4.0.4" +PKG_SHA256="4382a964bf8c511c22c03cdab5ba2d81c241536e6479072a61516966804f400a" PKG_LICENSE="GPL" PKG_SITE="http://libcec.pulse-eight.com/" PKG_URL="https://github.com/Pulse-Eight/libcec/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain systemd lockdev p8-platform" -PKG_SECTION="system" -PKG_SHORTDESC="libCEC is an open-source dual licensed library designed for communicating with the Pulse-Eight USB - CEC Adaptor" +PKG_DEPENDS_TARGET="toolchain systemd p8-platform swig:host" PKG_LONGDESC="libCEC is an open-source dual licensed library designed for communicating with the Pulse-Eight USB - CEC Adaptor." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=1 \ -DCMAKE_INSTALL_LIBDIR:STRING=lib \ - -DCMAKE_INSTALL_LIBDIR_NOARCH:STRING=lib" - -if [ "$KODIPLAYER_DRIVER" = "bcm2835-firmware" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-firmware" -fi + -DCMAKE_INSTALL_LIBDIR_NOARCH:STRING=lib \ + -DSKIP_PYTHON_WRAPPER=1 \ + -DHAVE_IMX_API=0 \ + -DHAVE_GIT_BIN=0" -if [ "$KODIPLAYER_DRIVER" = "libfslvpuwrap" ]; then - PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_IMX_API=1" -else - PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_IMX_API=0" +if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bcm2835-driver" fi if [ "$KODIPLAYER_DRIVER" = "libamcodec" ]; then - if [ "$TARGET_ARCH" = "aarch64" ]; then + if [ "$TARGET_KERNEL_ARCH" = "arm64" ]; then PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_AOCEC_API=1" else PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_AMLOGIC_API=1" @@ -55,8 +32,13 @@ else PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_AOCEC_API=0 -DHAVE_AMLOGIC_API=0" fi +if [ "$CEC_FRAMEWORK_SUPPORT" = "yes" ]; then + PKG_PATCH_DIRS="cec-framework" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET -DHAVE_LINUX_API=1" +fi + pre_configure_target() { - if [ "$KODIPLAYER_DRIVER" = "bcm2835-firmware" ]; then + if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then export CXXFLAGS="$CXXFLAGS \ -I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads/ \ -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux" @@ -67,7 +49,8 @@ pre_configure_target() { } post_makeinstall_target() { - if [ -d $INSTALL/usr/lib/python2.7/dist-packages ]; then - mv $INSTALL/usr/lib/python2.7/dist-packages $INSTALL/usr/lib/python2.7/site-packages + PYTHON_DIR=$INSTALL/usr/lib/$PKG_PYTHON_VERSION + if [ -d $PYTHON_DIR/dist-packages ]; then + mv $PYTHON_DIR/dist-packages $PYTHON_DIR/site-packages fi } diff --git a/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch b/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch new file mode 100644 index 0000000000..49af7eadf3 --- /dev/null +++ b/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch @@ -0,0 +1,887 @@ +From 467cc79fd289403e7d4f6e4e817b906c0c0027dd Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 6 Sep 2017 17:37:05 +0200 +Subject: [PATCH] Add Linux CEC Adapter + +--- + docs/README.linux.md | 6 + + include/cectypes.h | 11 + + src/libcec/CECTypeUtils.h | 2 + + src/libcec/CMakeLists.txt | 2 + + src/libcec/adapter/AdapterFactory.cpp | 26 +- + .../Linux/LinuxCECAdapterCommunication.cpp | 438 ++++++++++++++++++ + .../Linux/LinuxCECAdapterCommunication.h | 95 ++++ + .../Linux/LinuxCECAdapterDetection.cpp | 50 ++ + .../adapter/Linux/LinuxCECAdapterDetection.h | 51 ++ + src/libcec/cmake/CheckPlatformSupport.cmake | 12 + + src/libcec/cmake/DisplayPlatformSupport.cmake | 6 + + src/libcec/env.h.in | 3 + + 12 files changed, 700 insertions(+), 2 deletions(-) + create mode 100644 src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp + create mode 100644 src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h + create mode 100644 src/libcec/adapter/Linux/LinuxCECAdapterDetection.cpp + create mode 100644 src/libcec/adapter/Linux/LinuxCECAdapterDetection.h + +diff --git a/docs/README.linux.md b/docs/README.linux.md +index c59fb80..e8053cc 100644 +--- a/docs/README.linux.md ++++ b/docs/README.linux.md +@@ -51,5 +51,11 @@ Pass the argument `-DHAVE_TDA995X_API=1` to the cmake command in the compilation + cmake -DHAVE_TDA995X_API=1 .. + ``` + ++### Linux CEC Framework (v4.10+) ++Pass the argument `-DHAVE_LINUX_API=1` to the cmake command in the compilation instructions: ++``` ++cmake -DHAVE_LINUX_API=1 .. ++``` ++ + ### Debian / Ubuntu .deb packaging + See [docs/README.debian.md](README.debian.md). +\ No newline at end of file +diff --git a/include/cectypes.h b/include/cectypes.h +index 9c91842..2c32e4d 100644 +--- a/include/cectypes.h ++++ b/include/cectypes.h +@@ -281,6 +281,16 @@ namespace CEC { + */ + #define CEC_MAX_DATA_PACKET_SIZE (16 * 4) + ++/*! ++ * the path to use for the Linux CEC device ++ */ ++#define CEC_LINUX_PATH "/dev/cec0" ++ ++/*! ++ * the name of the virtual COM port to use for the Linux' CEC wire ++ */ ++#define CEC_LINUX_VIRTUAL_COM "Linux" ++ + /*! + * the path to use for the AOCEC HDMI CEC device + */ +@@ -861,6 +871,7 @@ typedef enum cec_adapter_type + ADAPTERTYPE_RPI = 0x100, + ADAPTERTYPE_TDA995x = 0x200, + ADAPTERTYPE_EXYNOS = 0x300, ++ ADAPTERTYPE_LINUX = 0x400, + ADAPTERTYPE_AOCEC = 0x500 + } cec_adapter_type; + +diff --git a/src/libcec/CECTypeUtils.h b/src/libcec/CECTypeUtils.h +index 25c1c6e..15f9543 100644 +--- a/src/libcec/CECTypeUtils.h ++++ b/src/libcec/CECTypeUtils.h +@@ -766,6 +766,8 @@ namespace CEC + return "Raspberry Pi"; + case ADAPTERTYPE_TDA995x: + return "TDA995x"; ++ case ADAPTERTYPE_LINUX: ++ return "Linux"; + default: + return "unknown"; + } +diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt +index 6baee69..74fe5f3 100644 +--- a/src/libcec/CMakeLists.txt ++++ b/src/libcec/CMakeLists.txt +@@ -89,6 +89,8 @@ set(CEC_HEADERS devices/CECRecordingDevice.h + adapter/Exynos/ExynosCEC.h + adapter/Exynos/ExynosCECAdapterDetection.h + adapter/Exynos/ExynosCECAdapterCommunication.h ++ adapter/Linux/LinuxCECAdapterDetection.h ++ adapter/Linux/LinuxCECAdapterCommunication.h + adapter/AOCEC/AOCEC.h + adapter/AOCEC/AOCECAdapterDetection.h + adapter/AOCEC/AOCECAdapterCommunication.h +diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp +index 91195ea..323c272 100644 +--- a/src/libcec/adapter/AdapterFactory.cpp ++++ b/src/libcec/adapter/AdapterFactory.cpp +@@ -58,6 +58,11 @@ + #include "Exynos/ExynosCECAdapterCommunication.h" + #endif + ++#if defined(HAVE_LINUX_API) ++#include "Linux/LinuxCECAdapterDetection.h" ++#include "Linux/LinuxCECAdapterCommunication.h" ++#endif ++ + #if defined(HAVE_AOCEC_API) + #include "AOCEC/AOCECAdapterDetection.h" + #include "AOCEC/AOCECAdapterCommunication.h" +@@ -131,6 +136,18 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8 + } + #endif + ++#if defined(HAVE_LINUX_API) ++ if (iAdaptersFound < iBufSize && CLinuxCECAdapterDetection::FindAdapter()) ++ { ++ snprintf(deviceList[iAdaptersFound].strComPath, sizeof(deviceList[iAdaptersFound].strComPath), CEC_LINUX_PATH); ++ snprintf(deviceList[iAdaptersFound].strComName, sizeof(deviceList[iAdaptersFound].strComName), CEC_LINUX_VIRTUAL_COM); ++ deviceList[iAdaptersFound].iVendorId = 0; ++ deviceList[iAdaptersFound].iProductId = 0; ++ deviceList[iAdaptersFound].adapterType = ADAPTERTYPE_LINUX; ++ iAdaptersFound++; ++ } ++#endif ++ + #if defined(HAVE_AOCEC_API) + if (iAdaptersFound < iBufSize && CAOCECAdapterDetection::FindAdapter()) + { +@@ -144,7 +161,7 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8 + #endif + + +-#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AOCEC_API) ++#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_LINUX_API) && !defined(HAVE_AOCEC_API) + #error "libCEC doesn't have support for any type of adapter. please check your build system or configuration" + #endif + +@@ -163,6 +180,11 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_ + return new CExynosCECAdapterCommunication(m_lib->m_cec); + #endif + ++#if defined(HAVE_LINUX_API) ++ if (!strcmp(strPort, CEC_LINUX_VIRTUAL_COM)) ++ return new CLinuxCECAdapterCommunication(m_lib->m_cec); ++#endif ++ + #if defined(HAVE_AOCEC_API) + if (!strcmp(strPort, CEC_AOCEC_VIRTUAL_COM)) + return new CAOCECAdapterCommunication(m_lib->m_cec); +@@ -177,7 +199,7 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_ + return new CUSBCECAdapterCommunication(m_lib->m_cec, strPort, iBaudRate); + #endif + +-#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_AOCEC_API) ++#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_LINUX_API) && !defined(HAVE_AOCEC_API) + return NULL; + #endif + } +diff --git a/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp +new file mode 100644 +index 0000000..6a28835 +--- /dev/null ++++ b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp +@@ -0,0 +1,438 @@ ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Linux CEC Adapter is Copyright (C) 2017-2019 Jonas Karlman ++ * based heavily on: ++ * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs ++ * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; 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 program 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. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++#include ++#include ++ ++#if defined(HAVE_LINUX_API) ++#include "LinuxCECAdapterCommunication.h" ++#include "CECTypeUtils.h" ++#include "LibCEC.h" ++#include "p8-platform/util/buffer.h" ++#include ++ ++using namespace CEC; ++using namespace P8PLATFORM; ++ ++#define LIB_CEC m_callback->GetLib() ++ ++// Required capabilities ++#define CEC_LINUX_CAPABILITIES (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | CEC_CAP_PASSTHROUGH) ++ ++CLinuxCECAdapterCommunication::CLinuxCECAdapterCommunication(IAdapterCommunicationCallback *callback) ++ : IAdapterCommunication(callback) ++{ ++ m_fd = INVALID_SOCKET_VALUE; ++} ++ ++CLinuxCECAdapterCommunication::~CLinuxCECAdapterCommunication(void) ++{ ++ Close(); ++} ++ ++bool CLinuxCECAdapterCommunication::Open(uint32_t UNUSED(iTimeoutMs), bool UNUSED(bSkipChecks), bool bStartListening) ++{ ++ if (IsOpen()) ++ Close(); ++ ++ if ((m_fd = open(CEC_LINUX_PATH, O_RDWR)) >= 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Open - m_fd=%d bStartListening=%d", m_fd, bStartListening); ++ ++ // Ensure the CEC device supports required capabilities ++ struct cec_caps caps = {}; ++ if (ioctl(m_fd, CEC_ADAP_G_CAPS, &caps) || (caps.capabilities & CEC_LINUX_CAPABILITIES) != CEC_LINUX_CAPABILITIES) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_G_CAPS failed - capabilities=%02x errno=%d", caps.capabilities, errno); ++ Close(); ++ return false; ++ } ++ ++ if (!bStartListening) ++ { ++ Close(); ++ return true; ++ } ++ ++ // This is an exclusive follower, in addition put the CEC device into passthrough mode ++ uint32_t mode = CEC_MODE_INITIATOR | CEC_MODE_EXCL_FOLLOWER_PASSTHRU; ++ if (ioctl(m_fd, CEC_S_MODE, &mode)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Open - ioctl CEC_S_MODE failed - errno=%d", errno); ++ Close(); ++ return false; ++ } ++ ++ uint16_t addr; ++ if (ioctl(m_fd, CEC_ADAP_G_PHYS_ADDR, &addr)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_G_PHYS_ADDR failed - errno=%d", errno); ++ Close(); ++ return false; ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_G_PHYS_ADDR - addr=%04x", addr); ++ ++ if (addr == CEC_PHYS_ADDR_INVALID) ++ LIB_CEC->AddLog(CEC_LOG_WARNING, "CLinuxCECAdapterCommunication::Open - physical address is invalid"); ++ ++ // Clear existing logical addresses and set the CEC device to the unconfigured state ++ struct cec_log_addrs log_addrs = {}; ++ if (ioctl(m_fd, CEC_ADAP_S_LOG_ADDRS, &log_addrs)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS failed - errno=%d", errno); ++ Close(); ++ return false; ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=%04x num_log_addrs=%u", log_addrs.log_addr_mask, log_addrs.num_log_addrs); ++ ++ // Set logical address to unregistered, without any logical address configured no messages is transmitted or received ++ log_addrs = {}; ++ log_addrs.cec_version = CEC_OP_CEC_VERSION_1_4; ++ log_addrs.vendor_id = CEC_VENDOR_PULSE_EIGHT; ++ log_addrs.num_log_addrs = 1; ++ log_addrs.flags = CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK; ++ log_addrs.log_addr[0] = CEC_LOG_ADDR_UNREGISTERED; ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_SWITCH; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; ++ if (ioctl(m_fd, CEC_ADAP_S_LOG_ADDRS, &log_addrs)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS failed - errno=%d", errno); ++ Close(); ++ return false; ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=%04x num_log_addrs=%u", log_addrs.log_addr_mask, log_addrs.num_log_addrs); ++ ++ if (CreateThread()) ++ return true; ++ ++ Close(); ++ } ++ ++ return false; ++} ++ ++void CLinuxCECAdapterCommunication::Close(void) ++{ ++ StopThread(0); ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Close - m_fd=%d", m_fd); ++ ++ close(m_fd); ++ m_fd = INVALID_SOCKET_VALUE; ++} ++ ++bool CLinuxCECAdapterCommunication::IsOpen(void) ++{ ++ return m_fd != INVALID_SOCKET_VALUE; ++} ++ ++cec_adapter_message_state CLinuxCECAdapterCommunication::Write(const cec_command &data, bool &bRetry, uint8_t UNUSED(iLineTimeout), bool UNUSED(bIsReply)) ++{ ++ if (IsOpen()) ++ { ++ struct cec_msg msg; ++ cec_msg_init(&msg, data.initiator, data.destination); ++ ++ if (data.opcode_set) ++ { ++ msg.msg[msg.len++] = data.opcode; ++ ++ if (data.parameters.size) ++ { ++ memcpy(&msg.msg[msg.len], data.parameters.data, data.parameters.size); ++ msg.len += data.parameters.size; ++ } ++ } ++ ++ if (ioctl(m_fd, CEC_TRANSMIT, &msg)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT failed - tx_status=%02x errno=%d", msg.tx_status, errno); ++ return ADAPTER_MESSAGE_STATE_ERROR; ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=%02x len=%d addr=%02x opcode=%02x", msg.tx_status, msg.len, msg.msg[0], cec_msg_opcode(&msg)); ++ ++ // The CEC driver will make re-transmission attempts ++ bRetry = false; ++ ++ if (msg.tx_status & CEC_TX_STATUS_OK) ++ return ADAPTER_MESSAGE_STATE_SENT_ACKED; ++ ++ if (msg.tx_status & CEC_TX_STATUS_NACK) ++ return ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED; ++ ++ return ADAPTER_MESSAGE_STATE_ERROR; ++ } ++ ++ return ADAPTER_MESSAGE_STATE_UNKNOWN; ++} ++ ++bool CLinuxCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) ++{ ++ if (IsOpen()) ++ { ++ struct cec_log_addrs log_addrs = {}; ++ if (ioctl(m_fd, CEC_ADAP_G_LOG_ADDRS, &log_addrs)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_G_LOG_ADDRS failed - errno=%d", errno); ++ return false; ++ } ++ ++ // TODO: Claiming a logical address will only work when CEC device has a valid physical address ++ ++ // Clear existing logical addresses and set the CEC device to the unconfigured state ++ if (log_addrs.num_log_addrs) ++ { ++ log_addrs = {}; ++ if (ioctl(m_fd, CEC_ADAP_S_LOG_ADDRS, &log_addrs)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS failed - errno=%d", errno); ++ return false; ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=%04x num_log_addrs=%u", log_addrs.log_addr_mask, log_addrs.num_log_addrs); ++ } ++ ++ if (!addresses.IsEmpty()) ++ { ++ // NOTE: This can only be configured when num_log_addrs > 0 ++ // and gets reset when num_log_addrs = 0 ++ log_addrs.cec_version = CEC_OP_CEC_VERSION_1_4; ++ log_addrs.vendor_id = CEC_VENDOR_PULSE_EIGHT; ++ ++ // TODO: Support more then the primary logical address ++ log_addrs.num_log_addrs = 1; ++ log_addrs.log_addr[0] = addresses.primary; ++ ++ switch (addresses.primary) ++ { ++ case CECDEVICE_AUDIOSYSTEM: ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_AUDIOSYSTEM; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM; ++ break; ++ case CECDEVICE_PLAYBACKDEVICE1: ++ case CECDEVICE_PLAYBACKDEVICE2: ++ case CECDEVICE_PLAYBACKDEVICE3: ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_PLAYBACK; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_PLAYBACK; ++ break; ++ case CECDEVICE_RECORDINGDEVICE1: ++ case CECDEVICE_RECORDINGDEVICE2: ++ case CECDEVICE_RECORDINGDEVICE3: ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_RECORD; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_RECORD; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_RECORD; ++ break; ++ case CECDEVICE_TUNER1: ++ case CECDEVICE_TUNER2: ++ case CECDEVICE_TUNER3: ++ case CECDEVICE_TUNER4: ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_TUNER; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_TUNER; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_TUNER; ++ break; ++ case CECDEVICE_TV: ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_TV; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_TV; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_TV; ++ break; ++ default: ++ log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_SWITCH; ++ log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; ++ log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; ++ break; ++ } ++ } ++ else ++ log_addrs.num_log_addrs = 0; ++ ++ if (ioctl(m_fd, CEC_ADAP_S_LOG_ADDRS, &log_addrs)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS failed - errno=%d", errno); ++ return false; ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::SetLogicalAddresses - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=%04x num_log_addrs=%u", log_addrs.log_addr_mask, log_addrs.num_log_addrs); ++ ++ if (log_addrs.num_log_addrs && !log_addrs.log_addr_mask) ++ return false; ++ ++ return true; ++ } ++ ++ return false; ++} ++ ++cec_logical_addresses CLinuxCECAdapterCommunication::GetLogicalAddresses(void) const ++{ ++ cec_logical_addresses addresses; ++ addresses.Clear(); ++ ++ if (m_fd != INVALID_SOCKET_VALUE) ++ { ++ struct cec_log_addrs log_addrs = {}; ++ if (ioctl(m_fd, CEC_ADAP_G_LOG_ADDRS, &log_addrs)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::GetLogicalAddresses - ioctl CEC_ADAP_G_LOG_ADDRS failed - errno=%d", errno); ++ return addresses; ++ } ++ ++ for (int i = 0; i < log_addrs.num_log_addrs; i++) ++ addresses.Set(cec_logical_address(log_addrs.log_addr[i])); ++ } ++ ++ return addresses; ++} ++ ++uint16_t CLinuxCECAdapterCommunication::GetPhysicalAddress(void) ++{ ++ if (IsOpen()) ++ { ++ uint16_t addr; ++ if (!ioctl(m_fd, CEC_ADAP_G_PHYS_ADDR, &addr)) ++ return addr; ++ ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::GetPhysicalAddress - ioctl CEC_ADAP_G_PHYS_ADDR failed - errno=%d", errno); ++ } ++ ++ return CEC_INVALID_PHYSICAL_ADDRESS; ++} ++ ++cec_vendor_id CLinuxCECAdapterCommunication::GetVendorId(void) ++{ ++ if (IsOpen()) ++ { ++ struct cec_log_addrs log_addrs = {}; ++ if (!ioctl(m_fd, CEC_ADAP_G_LOG_ADDRS, &log_addrs)) ++ return cec_vendor_id(log_addrs.vendor_id); ++ ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::GetVendorId - ioctl CEC_ADAP_G_LOG_ADDRS failed - errno=%d", errno); ++ } ++ ++ return CEC_VENDOR_UNKNOWN; ++} ++ ++void *CLinuxCECAdapterCommunication::Process(void) ++{ ++ CTimeout phys_addr_timeout; ++ bool phys_addr_changed = false; ++ uint16_t phys_addr = CEC_INVALID_PHYSICAL_ADDRESS; ++ fd_set rd_fds; ++ fd_set ex_fds; ++ ++ while (!IsStopped()) ++ { ++ struct timeval timeval = {}; ++ timeval.tv_sec = 1; ++ ++ FD_ZERO(&rd_fds); ++ FD_ZERO(&ex_fds); ++ FD_SET(m_fd, &rd_fds); ++ FD_SET(m_fd, &ex_fds); ++ ++ if (select(m_fd + 1, &rd_fds, NULL, &ex_fds, &timeval) < 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Process - select failed - errno=%d", errno); ++ break; ++ } ++ ++ if (FD_ISSET(m_fd, &ex_fds)) ++ { ++ struct cec_event ev = {}; ++ if (ioctl(m_fd, CEC_DQEVENT, &ev)) ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Process - ioctl CEC_DQEVENT failed - errno=%d", errno); ++ else if (ev.event == CEC_EVENT_STATE_CHANGE) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Process - CEC_DQEVENT - CEC_EVENT_STATE_CHANGE - log_addr_mask=%04x phys_addr=%04x", ev.state_change.log_addr_mask, ev.state_change.phys_addr); ++ ++ // TODO: handle ev.state_change.log_addr_mask change ++ ++ phys_addr = ev.state_change.phys_addr; ++ phys_addr_changed = true; ++ ++ if (ev.state_change.phys_addr == CEC_PHYS_ADDR_INVALID) ++ { ++ // Debounce change to invalid physical address with 2 seconds because ++ // EDID refresh and other events may cause short periods of invalid physical address ++ phys_addr_timeout.Init(2000); ++ } ++ else ++ { ++ // Debounce change to valid physical address with 500 ms when no logical address have been claimed ++ phys_addr_timeout.Init(ev.state_change.log_addr_mask ? 0 : 500); ++ } ++ } ++ } ++ ++ if (phys_addr_changed && !phys_addr_timeout.TimeLeft() && !IsStopped()) ++ { ++ phys_addr_changed = false; ++ m_callback->HandlePhysicalAddressChanged(phys_addr); ++ } ++ ++ if (FD_ISSET(m_fd, &rd_fds)) ++ { ++ struct cec_msg msg = {}; ++ if (ioctl(m_fd, CEC_RECEIVE, &msg)) ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "CLinuxCECAdapterCommunication::Process - ioctl CEC_RECEIVE failed - rx_status=%02x errno=%d", msg.rx_status, errno); ++ else if (msg.len > 0) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Process - ioctl CEC_RECEIVE - rx_status=%02x len=%d addr=%02x opcode=%02x", msg.rx_status, msg.len, msg.msg[0], cec_msg_opcode(&msg)); ++ ++ cec_command cmd; ++ cmd.PushArray(msg.len, msg.msg); ++ ++ if (!IsStopped()) ++ m_callback->OnCommandReceived(cmd); ++ } ++ } ++ ++ if (!IsStopped()) ++ Sleep(5); ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "CLinuxCECAdapterCommunication::Process - stopped - m_fd=%d", m_fd); ++ return 0; ++} ++ ++#endif +diff --git a/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h +new file mode 100644 +index 0000000..f4fac87 +--- /dev/null ++++ b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h +@@ -0,0 +1,95 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Linux CEC Adapter is Copyright (C) 2017-2018 Jonas Karlman ++ * based heavily on: ++ * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs ++ * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; 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 program 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. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++ ++#if defined(HAVE_LINUX_API) ++#include "p8-platform/threads/threads.h" ++#include "../AdapterCommunication.h" ++ ++namespace CEC ++{ ++ class CLinuxCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread ++ { ++ public: ++ /*! ++ * @brief Create a new Linux CEC communication handler. ++ * @param callback The callback to use for incoming CEC commands. ++ */ ++ CLinuxCECAdapterCommunication(IAdapterCommunicationCallback *callback); ++ virtual ~CLinuxCECAdapterCommunication(void); ++ ++ /** @name IAdapterCommunication implementation */ ++ ///{ ++ bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true) override; ++ void Close(void) override; ++ bool IsOpen(void) override; ++ cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool bIsReply) override; ++ ++ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) override { return true; } ++ bool StartBootloader(void) override { return false; } ++ bool SetLogicalAddresses(const cec_logical_addresses &addresses) override; ++ cec_logical_addresses GetLogicalAddresses(void) const override; ++ bool PingAdapter(void) override { return true; } ++ uint16_t GetFirmwareVersion(void) override { return 0; } ++ uint32_t GetFirmwareBuildDate(void) override { return 0; } ++ bool IsRunningLatestFirmware(void) override { return true; } ++ bool SetControlledMode(bool UNUSED(controlled)) override { return true; } ++ bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) override { return false; } ++ bool SetAutoMode(bool UNUSED(automode)) override { return false; } ++ bool GetConfiguration(libcec_configuration & UNUSED(configuration)) override { return false; } ++ std::string GetPortName(void) override { return std::string("LINUX"); } ++ uint16_t GetPhysicalAddress(void) override; ++ cec_vendor_id GetVendorId(void) override; ++ bool SupportsSourceLogicalAddress(const cec_logical_address address) override { return address > CECDEVICE_TV && address <= CECDEVICE_BROADCAST; } ++ cec_adapter_type GetAdapterType(void) override { return ADAPTERTYPE_LINUX; } ++ uint16_t GetAdapterVendorId(void) const override { return 1; } ++ uint16_t GetAdapterProductId(void) const override { return 1; } ++ void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) override {} ++ ///} ++ ++ /** @name P8PLATFORM::CThread implementation */ ++ ///{ ++ void *Process(void) override; ++ ///} ++ ++ private: ++ int m_fd; ++ }; ++}; ++ ++#endif +diff --git a/src/libcec/adapter/Linux/LinuxCECAdapterDetection.cpp b/src/libcec/adapter/Linux/LinuxCECAdapterDetection.cpp +new file mode 100644 +index 0000000..7b72238 +--- /dev/null ++++ b/src/libcec/adapter/Linux/LinuxCECAdapterDetection.cpp +@@ -0,0 +1,50 @@ ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Linux CEC Adapter is Copyright (C) 2017 Jonas Karlman ++ * based heavily on: ++ * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs ++ * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; 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 program 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. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++#include ++ ++#if defined(HAVE_LINUX_API) ++#include "LinuxCECAdapterDetection.h" ++ ++using namespace CEC; ++ ++bool CLinuxCECAdapterDetection::FindAdapter(void) ++{ ++ return access(CEC_LINUX_PATH, 0) == 0; ++} ++ ++#endif +diff --git a/src/libcec/adapter/Linux/LinuxCECAdapterDetection.h b/src/libcec/adapter/Linux/LinuxCECAdapterDetection.h +new file mode 100644 +index 0000000..f5ea2c4 +--- /dev/null ++++ b/src/libcec/adapter/Linux/LinuxCECAdapterDetection.h +@@ -0,0 +1,51 @@ ++#pragma once ++/* ++ * This file is part of the libCEC(R) library. ++ * ++ * libCEC Linux CEC Adapter is Copyright (C) 2017 Jonas Karlman ++ * based heavily on: ++ * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs ++ * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea ++ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. ++ * libCEC(R) is an original work, containing original code. ++ * ++ * libCEC(R) is a trademark of Pulse-Eight Limited. ++ * ++ * This program is dual-licensed; 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 program 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. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * ++ * Alternatively, you can license this library under a commercial license, ++ * please contact Pulse-Eight Licensing for more information. ++ * ++ * For more information contact: ++ * Pulse-Eight Licensing ++ * http://www.pulse-eight.com/ ++ * http://www.pulse-eight.net/ ++ */ ++ ++#include "env.h" ++ ++#if defined(HAVE_LINUX_API) ++ ++namespace CEC ++{ ++ class CLinuxCECAdapterDetection ++ { ++ public: ++ static bool FindAdapter(void); ++ }; ++}; ++ ++#endif +diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake +index 2d7102f..dacca0f 100644 +--- a/src/libcec/cmake/CheckPlatformSupport.cmake ++++ b/src/libcec/cmake/CheckPlatformSupport.cmake +@@ -9,6 +9,7 @@ + # HAVE_RPI_API ON if Raspberry Pi is supported + # HAVE_TDA995X_API ON if TDA995X is supported + # HAVE_EXYNOS_API ON if Exynos is supported ++# HAVE_LINUX_API ON if Linux is supported + # HAVE_AOCEC_API ON if AOCEC is supported + # HAVE_P8_USB ON if Pulse-Eight devices are supported + # HAVE_P8_USB_DETECT ON if Pulse-Eight devices can be auto-detected +@@ -30,6 +31,7 @@ SET(HAVE_LIBUDEV OFF CACHE BOOL "udev not supported") + SET(HAVE_RPI_API OFF CACHE BOOL "raspberry pi not supported") + SET(HAVE_TDA995X_API OFF CACHE BOOL "tda995x not supported") + SET(HAVE_EXYNOS_API OFF CACHE BOOL "exynos not supported") ++SET(HAVE_LINUX_API OFF CACHE BOOL "linux not supported") + SET(HAVE_AOCEC_API OFF CACHE BOOL "aocec not supported") + # Pulse-Eight devices are always supported + set(HAVE_P8_USB ON CACHE BOOL "p8 usb-cec supported" FORCE) +@@ -139,6 +141,16 @@ else() + list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_EXYNOS}) + endif() + ++ # Linux ++ if (${HAVE_LINUX_API}) ++ set(LIB_INFO "${LIB_INFO}, Linux") ++ SET(HAVE_LINUX_API ON CACHE BOOL "linux supported" FORCE) ++ set(CEC_SOURCES_ADAPTER_LINUX adapter/Linux/LinuxCECAdapterDetection.cpp ++ adapter/Linux/LinuxCECAdapterCommunication.cpp) ++ source_group("Source Files\\adapter\\Linux" FILES ${CEC_SOURCES_ADAPTER_LINUX}) ++ list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_LINUX}) ++ endif() ++ + # AOCEC + if (${HAVE_AOCEC_API}) + set(LIB_INFO "${LIB_INFO}, AOCEC") +diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake +index 83a778a..f47b1f7 100644 +--- a/src/libcec/cmake/DisplayPlatformSupport.cmake ++++ b/src/libcec/cmake/DisplayPlatformSupport.cmake +@@ -44,6 +44,12 @@ else() + message(STATUS "DRM support: no") + endif() + ++if (HAVE_LINUX_API) ++ message(STATUS "Linux support: yes") ++else() ++ message(STATUS "Linux support: no") ++endif() ++ + if (HAVE_AOCEC_API) + message(STATUS "AOCEC support: yes") + else() +diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in +index 456a2e7..71895a8 100644 +--- a/src/libcec/env.h.in ++++ b/src/libcec/env.h.in +@@ -76,6 +76,9 @@ + /* Define to 1 for Exynos support */ + #cmakedefine HAVE_EXYNOS_API @HAVE_EXYNOS_API@ + ++/* Define to 1 for Linux support */ ++#cmakedefine HAVE_LINUX_API @HAVE_LINUX_API@ ++ + /* Define to 1 for AOCEC support */ + #cmakedefine HAVE_AOCEC_API @HAVE_AOCEC_API@ + diff --git a/packages/devel/libdaemon/package.mk b/packages/devel/libdaemon/package.mk index 38a839b5e3..56ad351277 100644 --- a/packages/devel/libdaemon/package.mk +++ b/packages/devel/libdaemon/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libdaemon" PKG_VERSION="0.14" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="fd23eb5f6f986dcc7e708307355ba3289abe03cc381fc47a80bca4a50aa6b834" PKG_LICENSE="GPL" PKG_SITE="http://0pointer.de/lennart/projects/libdaemon/" PKG_URL="http://0pointer.de/lennart/projects/libdaemon/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="libdaemon: A lightweight C library which eases the writing of UNIX daemons" -PKG_LONGDESC="A wrapper around fork() which does the correct daemonization procedure of a process. A wrapper around syslog() for simpler and compatible log output to Syslog or STDERR. An API for writing PID files. An API for serializing UNIX signals into a pipe for usage with select() or poll()." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A lightweight C library which eases the writing of UNIX daemons." PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_setpgrp_void=no \ --enable-static \ diff --git a/packages/devel/libffi/package.mk b/packages/devel/libffi/package.mk index 28e2b76661..b4e83eb32b 100644 --- a/packages/devel/libffi/package.mk +++ b/packages/devel/libffi/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libffi" PKG_VERSION="3.2.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37" PKG_LICENSE="GPL" PKG_SITE="http://sourceware.org/$PKG_NAME/" PKG_URL="ftp://sourceware.org/pub/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="Foreign Function Interface Library" -PKG_LONGDESC="The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run-time." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="Foreign Function Interface Library." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-debug \ --enable-static --disable-shared \ diff --git a/packages/devel/libfmt/package.mk b/packages/devel/libfmt/package.mk new file mode 100644 index 0000000000..a2c976f54a --- /dev/null +++ b/packages/devel/libfmt/package.mk @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libfmt" +PKG_VERSION="5.1.0" +PKG_SHA256="73d4cab4fa8a3482643d8703de4d9522d7a56981c938eca42d929106ff474b44" +PKG_LICENSE="BSD" +PKG_SITE="https://github.com/fmtlib/fmt" +PKG_URL="https://github.com/fmtlib/fmt/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="fmt is an open-source formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams." + +PKG_CMAKE_OPTS_TARGET="-DFMT_DOC=OFF -DFMT_INSTALL=ON -DFMT_TEST=OFF -DFMT_USE_CPP11=ON" diff --git a/packages/devel/libfstrcmp/package.mk b/packages/devel/libfstrcmp/package.mk new file mode 100644 index 0000000000..e29c0acf1d --- /dev/null +++ b/packages/devel/libfstrcmp/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libfstrcmp" +PKG_VERSION="0.7.D001" +PKG_SHA256="e4018e850f80700acee8da296e56e15b1eef711ab15157e542e7d7e1237c3476" +PKG_LICENSE="GPL" +PKG_SITE="http://fstrcmp.sourceforge.net/" +PKG_URL="https://downloads.sourceforge.net/project/fstrcmp/fstrcmp/0.7/fstrcmp-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The fstrcmp project provides a library that is used to make fuzzy comparisons of strings and byte arrays, including multi-byte character strings." + +pre_configure_target() { + cd "$PKG_BUILD" +} + +make_target() { + make all-bin +} + +makeinstall_target() { + make DESTDIR="$SYSROOT_PREFIX" install-include install-libdir +} diff --git a/packages/devel/libftdi1/package.mk b/packages/devel/libftdi1/package.mk index b36608b266..6ec495365e 100644 --- a/packages/devel/libftdi1/package.mk +++ b/packages/devel/libftdi1/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libftdi1" PKG_VERSION="1.3" -PKG_REV=1"" -PKG_ARCH="any" +PKG_SHA256="9a8c95c94bfbcf36584a0a58a6e2003d9b133213d9202b76aec76302ffaa81f4" PKG_LICENSE="LGPL" PKG_SITE="http://www.intra2net.com/en/developer/libftdi/" PKG_URL="http://www.intra2net.com/en/developer/libftdi/download/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain libusb" -PKG_SECTION="devel" -PKG_SHORTDESC="libFTDI is an open source library to talk to FTDI chips" PKG_LONGDESC="libFTDI is an open source library to talk to FTDI chips" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CMAKE_OPTS_TARGET="-DSTATICLIBS=ON \ -DDOCUMENTATION=FALSE \ @@ -37,10 +17,6 @@ PKG_CMAKE_OPTS_TARGET="-DSTATICLIBS=ON \ -DFTDIPP=FALSE \ -DPYTHON_BINDINGS=FALSE" -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} - makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include/libftdi1 cp ../src/ftdi.h $SYSROOT_PREFIX/usr/include/libftdi1 diff --git a/packages/devel/libirman/package.mk b/packages/devel/libirman/package.mk index 9fa8b73ae3..6316e76d8b 100644 --- a/packages/devel/libirman/package.mk +++ b/packages/devel/libirman/package.mk @@ -1,42 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libirman" PKG_VERSION="0.5.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="43e58d7cd22b3a4c4dc8dcf8542a269ebcb4d8f6ceea0577b9fc882898f09a47" PKG_LICENSE="GPL" PKG_SITE="http://sourceforge.net/projects/lirc" PKG_URL="http://downloads.sourceforge.net/project/libirman/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain systemd lirc" -PKG_SECTION="system" -PKG_SHORTDESC="libirman library for lircd" PKG_LONGDESC="libirman library for lircd" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--disable-swtest" -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin } diff --git a/packages/devel/libplist/package.mk b/packages/devel/libplist/package.mk index 5216ed109e..4ac7571c04 100644 --- a/packages/devel/libplist/package.mk +++ b/packages/devel/libplist/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libplist" -PKG_VERSION="1.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.0.0" +PKG_SHA256="3a7e9694c2d9a85174ba1fa92417cfabaea7f6d19631e544948dc7e17e82f602" PKG_LICENSE="GPL" -PKG_SITE="http://matt.colyer.name/projects/iphone-linux/" +PKG_SITE="http://www.libimobiledevice.org/" PKG_URL="http://www.libimobiledevice.org/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libxml2 glib" -PKG_SECTION="devel" -PKG_SHORTDESC="libplist: a library for manipulating Apple Binary and XML Property Lists" +PKG_DEPENDS_TARGET="toolchain glib" PKG_LONGDESC="libplist is a library for manipulating Apple Binary and XML Property Lists" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--without-cython" diff --git a/packages/devel/libpthread-stubs/package.mk b/packages/devel/libpthread-stubs/package.mk index 3e5fe9b815..9969b69cb0 100644 --- a/packages/devel/libpthread-stubs/package.mk +++ b/packages/devel/libpthread-stubs/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libpthread-stubs" -PKG_VERSION="0.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.4" +PKG_SHA256="50d5686b79019ccea08bcbd7b02fe5a40634abcfd4146b6e75c6420cc170e9d9" PKG_LICENSE="OSS" PKG_SITE="http://xcb.freedesktop.org/" PKG_URL="http://xcb.freedesktop.org/dist/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="libpthread-stubs: A library providing weak aliases for pthread functions" -PKG_LONGDESC="This library provides weak aliases for pthread functions not provided in libc or otherwise available by default. Libraries like libxcb rely on pthread stubs to use pthreads optionally, becoming thread-safe when linked to libpthread, while avoiding any performance hit when running single-threaded." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A library providing weak aliases for pthread functions." diff --git a/packages/devel/libtool/package.mk b/packages/devel/libtool/package.mk index 1351c8b6cf..a0b667ed2d 100644 --- a/packages/devel/libtool/package.mk +++ b/packages/devel/libtool/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libtool" PKG_VERSION="2.4.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/libtool/" PKG_URL="http://ftpmirror.gnu.org/libtool/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="ccache:host autoconf:host" +PKG_DEPENDS_HOST="ccache:host autoconf:host automake:host" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="libtool: Generic library support script" -PKG_LONGDESC="This is GNU Libtool, a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_LONGDESC="A generic library support script." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared" - diff --git a/packages/devel/lockdev/package.mk b/packages/devel/lockdev/package.mk deleted file mode 100644 index d68d3dc468..0000000000 --- a/packages/devel/lockdev/package.mk +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="lockdev" -PKG_VERSION="16b8996" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://alioth.debian.org/scm/?group_id=100443" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="lockdev: Manage character and block device lockfiles." -PKG_LONGDESC="lockdev manages character and block device lockfiles." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} - -post_makeinstall_target() { - rm -rf $INSTALL/usr -} diff --git a/packages/devel/m4/package.mk b/packages/devel/m4/package.mk index 58678dd69f..aa17f8148b 100644 --- a/packages/devel/m4/package.mk +++ b/packages/devel/m4/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="m4" -PKG_VERSION="1.4.17" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.4.18" +PKG_SHA256="6640d76b043bc658139c8903e293d5978309bf0f408107146505eca701e67cf6" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/m4/" PKG_URL="http://ftpmirror.gnu.org/m4/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="devel" -PKG_SHORTDESC="m4: The m4 macro processor" -PKG_LONGDESC="GNU 'M4' is an implementation of the traditional Unix macro processor. It is mostly SVR4 compatible, although it has some extensions (for example, handling more than 9 positional parameters to macros). 'M4' also has built-in functions for including files, running shell commands, doing arithmetic, etc. Autoconf needs GNU 'M4' for generating 'configure' scripts, but not for running them." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The m4 macro processor." PKG_CONFIGURE_OPTS_HOST="gl_cv_func_gettimeofday_clobber=no --target=$TARGET_NAME" diff --git a/packages/devel/m4/patches/fix-compilation-with-glibc-2.28.patch b/packages/devel/m4/patches/fix-compilation-with-glibc-2.28.patch new file mode 100644 index 0000000000..325be90741 --- /dev/null +++ b/packages/devel/m4/patches/fix-compilation-with-glibc-2.28.patch @@ -0,0 +1,125 @@ +Those are changes from upstream gnulib commit which fixes compilation with glibc 2.28. + +diff --git a/lib/fflush.c b/lib/fflush.c +index 983ade0..a6edfa1 100644 +--- a/lib/fflush.c ++++ b/lib/fflush.c +@@ -33,7 +33,7 @@ + #undef fflush + + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ + static void +@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp) + + #endif + +-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) ++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) + + # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ +@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream) + if (stream == NULL || ! freading (stream)) + return fflush (stream); + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + clear_ungetc_buffer_preserving_position (stream); + +diff --git a/lib/fpending.c b/lib/fpending.c +index c84e3a5..789f50e 100644 +--- a/lib/fpending.c ++++ b/lib/fpending.c +@@ -32,7 +32,7 @@ __fpending (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return fp->_IO_write_ptr - fp->_IO_write_base; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ +diff --git a/lib/fpurge.c b/lib/fpurge.c +index b1d417c..3aedcc3 100644 +--- a/lib/fpurge.c ++++ b/lib/fpurge.c +@@ -62,7 +62,7 @@ fpurge (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_IO_read_end = fp->_IO_read_ptr; + fp->_IO_write_ptr = fp->_IO_write_base; + /* Avoid memory leak when there is an active ungetc buffer. */ +diff --git a/lib/freadahead.c b/lib/freadahead.c +index c2ecb5b..23ec76e 100644 +--- a/lib/freadahead.c ++++ b/lib/freadahead.c +@@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *); + size_t + freadahead (FILE *fp) + { +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_write_ptr > fp->_IO_write_base) + return 0; + return (fp->_IO_read_end - fp->_IO_read_ptr) +diff --git a/lib/freading.c b/lib/freading.c +index 73c28ac..c24d0c8 100644 +--- a/lib/freading.c ++++ b/lib/freading.c +@@ -31,7 +31,7 @@ freading (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return ((fp->_flags & _IO_NO_WRITES) != 0 + || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 + && fp->_IO_read_base != NULL)); +diff --git a/lib/fseeko.c b/lib/fseeko.c +index 0101ab5..193f4e8 100644 +--- a/lib/fseeko.c ++++ b/lib/fseeko.c +@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence) + #endif + + /* These tests are based on fpurge.c. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_read_end == fp->_IO_read_ptr + && fp->_IO_write_ptr == fp->_IO_write_base + && fp->_IO_save_base == NULL) +@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence) + return -1; + } + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags &= ~_IO_EOF_SEEN; + fp->_offset = pos; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ +--- a/lib/stdio-impl.h ++++ b/lib/stdio-impl.h +@@ -18,6 +18,12 @@ + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + ++/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this ++ problem by defining it ourselves. FIXME: Do not rely on glibc ++ internals. */ ++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN ++# define _IO_IN_BACKUP 0x100 ++#endif + + /* BSD stdio derived implementations. */ + +-- +1.9.1 + diff --git a/packages/devel/make/package.mk b/packages/devel/make/package.mk index caf494a41f..366fec7145 100644 --- a/packages/devel/make/package.mk +++ b/packages/devel/make/package.mk @@ -1,38 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="make" PKG_VERSION="4.2.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="d6e262bf3601b42d2b1e4ef8310029e1dcf20083c5446b4b7aa67081fdffc589" PKG_LICENSE="GPLv3" PKG_SITE="https://www.gnu.org/software/make/" PKG_URL="http://ftpmirror.gnu.org/make/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="make: GNU make utility to maintain groups of programs" -PKG_LONGDESC="The 'make' utility automatically determines which pieces of a large program need to be recompiled, and issues commands to recompile them. This is GNU 'make', which was implemented by Richard Stallman and Roland McGrath. GNU 'make' conforms to section 6.2 of EEE Standard 1003.2-1992' (POSIX.2)." +PKG_LONGDESC="Utility to maintain groups of programs." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -export CC=$LOCAL_CC +pre_configure_host() { + export CC=$LOCAL_CC +} post_makeinstall_host() { - ln -sf make $ROOT/$TOOLCHAIN/bin/gmake + ln -sf make $TOOLCHAIN/bin/gmake } diff --git a/packages/devel/make/patches/make-glibc_alloc_fix.patch b/packages/devel/make/patches/make-glibc_alloc_fix.patch new file mode 100644 index 0000000000..a0cc0ed973 --- /dev/null +++ b/packages/devel/make/patches/make-glibc_alloc_fix.patch @@ -0,0 +1,13 @@ +diff --git a/glob/glob.c b/glob/glob.c +index f3911bc..8adbde3 100644 +--- a/glob/glob.c ++++ b/glob/glob.c +@@ -208,7 +208,7 @@ my_realloc (p, n) + #endif /* __GNU_LIBRARY__ || __DJGPP__ */ + + +-#if !defined __alloca && !defined __GNU_LIBRARY__ ++#if !defined __alloca && defined __GNU_LIBRARY__ + + # ifdef __GNUC__ + # undef alloca diff --git a/packages/devel/mpc/package.mk b/packages/devel/mpc/package.mk index 2d5e0abe66..f89534c7ec 100644 --- a/packages/devel/mpc/package.mk +++ b/packages/devel/mpc/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="mpc" PKG_VERSION="1.0.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3" PKG_LICENSE="LGPL" PKG_SITE="http://www.multiprecision.org" PKG_URL="http://ftpmirror.gnu.org/mpc/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host gmp:host mpfr:host" -PKG_SECTION="devel" -PKG_SHORTDESC="mpc: A C library for the arithmetic of high precision complex numbers" -PKG_LONGDESC="pc is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result. It is built upon and follows the same principles as Mpfr." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result." PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME \ --enable-static --disable-shared \ - --with-gmp=$ROOT/$TOOLCHAIN \ - --with-mpfr=$ROOT/$TOOLCHAIN" + --with-gmp=$TOOLCHAIN \ + --with-mpfr=$TOOLCHAIN" diff --git a/packages/devel/mpfr/package.mk b/packages/devel/mpfr/package.mk index 420f864adc..31a2e60537 100644 --- a/packages/devel/mpfr/package.mk +++ b/packages/devel/mpfr/package.mk @@ -1,38 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="mpfr" PKG_VERSION="3.1.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="015fde82b3979fbe5f83501986d328331ba8ddf008c1ff3da3c238f49ca062bc" PKG_LICENSE="LGPL" PKG_SITE="http://www.mpfr.org/" PKG_URL="http://ftpmirror.gnu.org/mpfr/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="ccache:host gmp:host" -PKG_SECTION="devel" -PKG_SHORTDESC="mpfr: A C library for multiple-precision floating-point computations with exact roundi" -PKG_LONGDESC="The MPFR library is a C library for multiple-precision floating-point computations with exact rounding (also called correct rounding). It is based on the GMP multiple-precision library. The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has well-defined semantics. It copies the good ideas from the ANSI/IEEE-754 standard for double-precision floating-point arithmetic (53-bit mantissa)." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A C library for multiple-precision floating-point computations with exact rounding." PKG_CONFIGURE_OPTS_HOST="--target=$TARGET_NAME \ --enable-static --disable-shared \ - --prefix=$ROOT/$TOOLCHAIN \ - --with-gmp-lib=$ROOT/$TOOLCHAIN/lib \ - --with-gmp-include=$ROOT/$TOOLCHAIN/include" + --prefix=$TOOLCHAIN \ + --with-gmp-lib=$TOOLCHAIN/lib \ + --with-gmp-include=$TOOLCHAIN/include" diff --git a/packages/devel/ncurses/package.mk b/packages/devel/ncurses/package.mk new file mode 100644 index 0000000000..c04d685099 --- /dev/null +++ b/packages/devel/ncurses/package.mk @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ncurses" +PKG_VERSION="6.1-20181215" +PKG_SHA256="08b07c3e792961f300829512c283d5fefc0b1c421a57b76922c3d13303ed677d" +PKG_LICENSE="MIT" +PKG_SITE="http://www.gnu.org/software/ncurses/" +PKG_URL="http://invisible-mirror.net/archives/ncurses/current/ncurses-$PKG_VERSION.tgz" +PKG_DEPENDS_TARGET="toolchain zlib ncurses:host" +PKG_LONGDESC="A library is a free software emulation of curses in System V Release 4.0, and more." +# causes some segmentation fault's (dialog) when compiled with gcc's link time optimization. +PKG_BUILD_FLAGS="+pic" + +PKG_CONFIGURE_OPTS_TARGET="--without-ada \ + --without-cxx \ + --without-cxx-binding \ + --disable-db-install \ + --without-manpages \ + --without-progs \ + --without-tests \ + --without-shared \ + --with-normal \ + --without-debug \ + --without-profile \ + --without-termlib \ + --without-ticlib \ + --without-gpm \ + --without-dbmalloc \ + --without-dmalloc \ + --disable-rpath \ + --disable-database \ + --with-fallbacks=linux,screen,xterm,xterm-color \ + --with-termpath=/storage/.config/termcap \ + --disable-big-core \ + --enable-termcap \ + --enable-getcap \ + --disable-getcap-cache \ + --enable-symlinks \ + --disable-bsdpad \ + --without-rcs-ids \ + --enable-ext-funcs \ + --disable-const \ + --enable-no-padding \ + --disable-sigwinch \ + --enable-pc-files \ + --with-pkg-config-libdir=/usr/lib/pkgconfig \ + --disable-tcap-names \ + --without-develop \ + --disable-hard-tabs \ + --disable-xmc-glitch \ + --disable-hashmap \ + --disable-safe-sprintf \ + --disable-scroll-hints \ + --disable-widec \ + --disable-echo \ + --disable-warnings \ + --disable-home-terminfo \ + --disable-assertions" + +post_makeinstall_target() { + cp misc/ncurses-config $TOOLCHAIN/bin + chmod +x $TOOLCHAIN/bin/ncurses-config + sed -e "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $TOOLCHAIN/bin/ncurses-config + rm -rf $INSTALL/usr/bin +} diff --git a/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch b/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch new file mode 100644 index 0000000000..030213be1e --- /dev/null +++ b/packages/devel/ncurses/patches/ncurses-001-terminfo-xterm.patch @@ -0,0 +1,16 @@ + +Remove recent xterm terminfo features to be compatible with other emulations + +--- a/misc/terminfo.src 2018-12-21 18:53:11.000000000 +0100 ++++ a/misc/terminfo.src 2018-12-22 22:56:47.000000000 +0100 +@@ -4335,8 +4335,8 @@ xterm-xfree86|xterm terminal emulator (X + xterm-new|modern xterm terminal emulator, + npc, + indn=\E[%p1%dS, kb2=\EOE, kcbt=\E[Z, kent=\EOM, +- rin=\E[%p1%dT, use=ansi+rep, use=ecma+strikeout, +- use=xterm+sm+1006, use=xterm+pcfkeys, use=xterm+tmux, ++ rin=\E[%p1%dT, use=ecma+strikeout, ++ use=xterm+sm+1005, use=xterm+pcfkeys, use=xterm+tmux, + use=xterm-basic, + + # This fragment is for people who cannot agree on what the backspace key diff --git a/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch b/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch new file mode 100644 index 0000000000..218e3a7b32 --- /dev/null +++ b/packages/devel/ncurses/patches/ncurses-002-alloc-fallbacks.patch @@ -0,0 +1,24 @@ +Fix freeing not allocated fallback entries by allocating a copy. + +--- a/ncurses/tinfo/lib_setup.c 2018-11-24 23:13:16.000000000 +0100 ++++ b/ncurses/tinfo/lib_setup.c 2018-12-29 10:31:01.000000000 +0100 +@@ -756,6 +756,8 @@ TINFO_SETUP_TERM(TERMINAL **tp, + if (status != TGETENT_YES) { + const TERMTYPE2 *fallback = _nc_fallback2(tname); + ++ if (fallback) ++ fallback = _nc_copy_entry(fallback); + if (fallback) { + T(("found fallback entry")); + TerminalType(termp) = *fallback; +--- a/ncurses/tinfo/tinfo_driver.c 2018-11-24 23:17:03.000000000 +0100 ++++ b/ncurses/tinfo/tinfo_driver.c 2018-12-29 10:27:19.000000000 +0100 +@@ -172,6 +172,8 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * T + if (status != TGETENT_YES) { + const TERMTYPE2 *fallback = _nc_fallback2(tname); + ++ if (fallback) ++ fallback = _nc_copy_entry(fallback); + if (fallback) { + T(("found fallback entry")); + TerminalType(termp) = *fallback; diff --git a/packages/devel/netbsd-curses/package.mk b/packages/devel/netbsd-curses/package.mk deleted file mode 100644 index 407fd69158..0000000000 --- a/packages/devel/netbsd-curses/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="netbsd-curses" -PKG_VERSION="47b256a" -PKG_ARCH="any" -PKG_SITE="https://github.com/sabotage-linux/netbsd-curses" -PKG_URL="https://github.com/sabotage-linux/netbsd-curses/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="netbsd-libcurses portable edition" -PKG_LONGDESC="netbsd-libcurses portable edition" - -make_target() { - make HOSTCC="$HOST_CC" PREFIX=/usr all-static -} - -makeinstall_target() { - make HOSTCC="$HOST_CC" PREFIX=$SYSROOT_PREFIX/usr install-static -} diff --git a/packages/devel/pcre/package.mk b/packages/devel/pcre/package.mk index b45114b7ff..0518214abf 100644 --- a/packages/devel/pcre/package.mk +++ b/packages/devel/pcre/package.mk @@ -1,39 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pcre" -PKG_VERSION="8.39" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="8.42" +PKG_SHA256="2cd04b7c887808be030254e8d77de11d3fe9d4505c39d4b15d2664ffe8bf9301" PKG_LICENSE="OSS" PKG_SITE="http://www.pcre.org/" -PKG_URL="http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://ftp.pcre.org/pub/pcre/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="pcre: Perl Compatible Regulat Expressions" -PKG_LONGDESC="The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API. The PCRE library is free, even for building commercial software." +PKG_LONGDESC="A set of functions that implement regular expression pattern matching." +PKG_TOOLCHAIN="configure" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_HOST="--prefix=$ROOT/$TOOLCHAIN \ +PKG_CONFIGURE_OPTS_HOST="--prefix=$TOOLCHAIN \ + --enable-static \ --enable-utf8 \ --enable-unicode-properties \ --with-gnu-ld" @@ -45,12 +27,6 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ --enable-unicode-properties \ --with-gnu-ld" -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC" - CXXFLAGS="$CXXFLAGS -fPIC" - LDFLAGS="$LDFLAGS -fPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin sed -e "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/$PKG_NAME-config diff --git a/packages/devel/pkg-config/package.mk b/packages/devel/pkg-config/package.mk index 218ad07108..aa73ddb5c1 100644 --- a/packages/devel/pkg-config/package.mk +++ b/packages/devel/pkg-config/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="pkg-config" -PKG_VERSION="0.29.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.29.2" +PKG_SHA256="6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591" PKG_LICENSE="GPL" PKG_SITE="http://www.freedesktop.org/software/pkgconfig/" PKG_URL="http://pkg-config.freedesktop.org/releases/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host gettext:host" -PKG_SECTION="toolchain/devel" -PKG_SHORTDESC="pkg-config: A library configuration management system" -PKG_LONGDESC="pkg-config is a system for managing library compile/link flags that works with automake and autoconf. It replaces the ubiquitous *-config scripts you may have seen with a single tool." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A system for managing library compile/link flags that works with automake and autoconf." PKG_CONFIGURE_OPTS_HOST="--disable-silent-rules \ --with-internal-glib --disable-dtrace \ diff --git a/packages/devel/pkg-config/patches/pkg-config-0001-use-sysroot-path.patch b/packages/devel/pkg-config/patches/pkg-config-0001-use-sysroot-path.patch index 0b53525fd8..851801dfd6 100644 --- a/packages/devel/pkg-config/patches/pkg-config-0001-use-sysroot-path.patch +++ b/packages/devel/pkg-config/patches/pkg-config-0001-use-sysroot-path.patch @@ -1,23 +1,36 @@ -diff -Naur a/pkg.c b/pkg.c ---- a/pkg.c 2016-02-26 17:56:52.000000000 +0100 -+++ b/pkg.c 2017-01-02 19:48:34.000000000 +0100 -@@ -468,11 +468,14 @@ +From 35fe817168fe0bdb78777d2707ba0189a4ce19bc Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Fri, 5 May 2017 08:23:25 +0100 +Subject: [PATCH] pkg-config: use sysroot path (see #1135) + +--- + pkg.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/pkg.c b/pkg.c +index f29ecc7..a7a1f2a 100644 +--- a/pkg.c ++++ b/pkg.c +@@ -433,7 +433,7 @@ flag_list_to_string (GList *list) Flag *flag = tmp->data; char *tmpstr = flag->arg; - if (pcsysrootdir != NULL && flag->type & (CFLAGS_I | LIBS_L)) { + if (pcsysrootdir != NULL && flag->type & (CFLAGS_I | LIBS_L) && strncmp(tmpstr+2, pcsysrootdir, strlen(pcsysrootdir)) != 0) { - g_string_append_c (str, '-'); - g_string_append_c (str, tmpstr[1]); - g_string_append (str, pcsysrootdir); - g_string_append (str, tmpstr+2); + /* Handle non-I Cflags like -isystem */ + if (flag->type & CFLAGS_I && strncmp (tmpstr, "-I", 2) != 0) { + char *space = strchr (tmpstr, ' '); +@@ -449,6 +449,9 @@ flag_list_to_string (GList *list) + g_string_append (str, pcsysrootdir); + g_string_append (str, tmpstr+2); + } + } else if (pcsysrootdir != NULL && strncmp(tmpstr, "/usr", 4) == 0 && strncmp(tmpstr, pcsysrootdir, strlen(pcsysrootdir)) != 0) { + g_string_append (str, pcsysrootdir); + g_string_append (str, tmpstr); } else { g_string_append (str, tmpstr); } -@@ -1087,6 +1090,8 @@ +@@ -1060,6 +1063,8 @@ packages_get_var (GList *pkgs, { if (str->len > 0) g_string_append_c (str, ' '); @@ -26,3 +39,6 @@ diff -Naur a/pkg.c b/pkg.c g_string_append (str, var); g_free (var); } +-- +2.7.4 + diff --git a/packages/devel/popt/package.mk b/packages/devel/popt/package.mk index 9b46219fe7..188272f1c3 100644 --- a/packages/devel/popt/package.mk +++ b/packages/devel/popt/package.mk @@ -1,43 +1,21 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="popt" PKG_VERSION="1.16" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8" PKG_LICENSE="GPL" PKG_SITE="http://rpm5.org/files/popt/" PKG_URL="http://rpm5.org/files/popt/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="popt: library for parsing command line options." -PKG_LONGDESC="The popt library exists essentially for parsing command-line options. It is found superior in many ways when compared to parsing the argv array by hand or using the getopt functions getopt() and getopt_long()." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - +PKG_LONGDESC="The popt library exists essentially for parsing command-line options." pre_configure_target() { - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME } pre_configure_host() { - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$HOST_NAME } diff --git a/packages/devel/rapidjson/package.mk b/packages/devel/rapidjson/package.mk new file mode 100644 index 0000000000..c2ea2e9423 --- /dev/null +++ b/packages/devel/rapidjson/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rapidjson" +PKG_VERSION="1.1.0" +PKG_SHA256="bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/miloyip/rapidjson" +PKG_URL="https://github.com/miloyip/rapidjson/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A fast JSON parser/generator for C++ with both SAX/DOM style API" + +PKG_CMAKE_OPTS_TARGET="-DRAPIDJSON_BUILD_DOC=OFF \ + -DRAPIDJSON_BUILD_EXAMPLES=OFF \ + -DRAPIDJSON_BUILD_TESTS=OFF \ + -DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF \ + -DRAPIDJSON_BUILD_ASAN=OFF \ + -DRAPIDJSON_BUILD_UBSAN=OFF \ + -DRAPIDJSON_HAS_STDSTRING=ON" diff --git a/packages/devel/rapidjson/patches/rapidjson-0001-remove_custom_cxx_flags.patch b/packages/devel/rapidjson/patches/rapidjson-0001-remove_custom_cxx_flags.patch new file mode 100644 index 0000000000..51434ff52e --- /dev/null +++ b/packages/devel/rapidjson/patches/rapidjson-0001-remove_custom_cxx_flags.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ceda71b..efb259e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,7 +50,6 @@ if(CCACHE_FOUND) + endif(CCACHE_FOUND) + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror") + if (RAPIDJSON_BUILD_CXX11) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +@@ -73,7 +72,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + endif() + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers") + if (RAPIDJSON_BUILD_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() +@@ -88,7 +86,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + endif() + endif() + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +- add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") + endif() + + diff --git a/packages/devel/readline/package.mk b/packages/devel/readline/package.mk index b77d94c0a4..7e3ceba513 100644 --- a/packages/devel/readline/package.mk +++ b/packages/devel/readline/package.mk @@ -1,41 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="readline" -PKG_VERSION="6.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="7.0" +PKG_SHA256="750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334" PKG_LICENSE="MIT" PKG_SITE="http://www.gnu.org/software/readline/" PKG_URL="http://ftpmirror.gnu.org/readline/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses" -PKG_SECTION="devel" -PKG_SHORTDESC="readline: The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in." +PKG_DEPENDS_TARGET="toolchain ncurses" PKG_LONGDESC="The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="bash_cv_wcwidth_broken=no \ --disable-shared \ --enable-static \ - --with-curses \ - --without-purify" + --with-curses" post_makeinstall_target() { rm -rf $INSTALL/usr/share/readline diff --git a/packages/devel/readline/patches/readline-6.2-shlib_libs.patch.bk b/packages/devel/readline/patches/readline-6.2-shlib_libs.patch.bk deleted file mode 100644 index 6bc7cc2330..0000000000 --- a/packages/devel/readline/patches/readline-6.2-shlib_libs.patch.bk +++ /dev/null @@ -1,36 +0,0 @@ -diff -Naur readline-6.2-old/configure readline-6.2-new/configure ---- a/configure 2010-11-14 14:48:06.000000000 -0800 -+++ b/configure 2012-05-02 19:38:49.000000000 -0700 -@@ -10450,10 +10450,10 @@ - $as_echo_n "checking configuration for building shared libraries... " >&6; } - eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}` - --# case "$SHLIB_LIBS" in --# *curses*|*termcap*|*termlib*) ;; --# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;; --# esac -+ case "$SHLIB_LIBS" in -+ *curses*|*termcap*|*termlib*) ;; -+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;; -+ esac - - - -diff -Naur readline-6.2-old/configure.in readline-6.2-new/configure.in ---- a/configure.in 2010-11-14 14:41:48.000000000 -0800 -+++ b/configure.in 2012-05-02 19:38:41.000000000 -0700 -@@ -214,10 +214,10 @@ - AC_MSG_CHECKING(configuration for building shared libraries) - eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}` - --# case "$SHLIB_LIBS" in --# *curses*|*termcap*|*termlib*) ;; --# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;; --# esac -+ case "$SHLIB_LIBS" in -+ *curses*|*termcap*|*termlib*) ;; -+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;; -+ esac - - AC_SUBST(SHOBJ_CC) - AC_SUBST(SHOBJ_CFLAGS) diff --git a/packages/devel/slang/package.mk b/packages/devel/slang/package.mk index b3908bbb2d..e247b6624e 100644 --- a/packages/devel/slang/package.mk +++ b/packages/devel/slang/package.mk @@ -1,47 +1,26 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="slang" PKG_VERSION="2.1.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="14877efebbf0e57a3543f7ab3c72b491d3e398ea852616990f88463d64a3b4e3" PKG_LICENSE="GPL" PKG_SITE="http://s-lang.org/" PKG_URL="ftp://space.mit.edu/pub/davis/slang/v2.1/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="slang: multi-platform programmer's library designed to allow a developer to create robust multi-platform software." -PKG_LONGDESC="S-Lang is a multi-platform programmer's library designed to allow a developer to create robust multi-platform software. It provides facilities required by interactive applications such as display/screen management, keyboard input, keymaps, and so on. The most exciting feature of the library is the slang interpreter that may be easily embedded into a program to make it extensible. While the emphasis has always been on the embedded nature of the interpreter, it may also be used in a stand-alone fashion through the use of slsh, which is part of the S-Lang distribution." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -MAKEFLAGS=-j1 +PKG_LONGDESC="A library designed to allow a developer to create robust multi-platform software." +PKG_BUILD_FLAGS="-parallel" +PKG_CONFIGURE_OPTS_TARGET="--without-onig" pre_configure_target() { # slang fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME } pre_configure_host() { # slang fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$HOST_NAME } diff --git a/packages/devel/swig/package.mk b/packages/devel/swig/package.mk index 1179362939..14850898ed 100644 --- a/packages/devel/swig/package.mk +++ b/packages/devel/swig/package.mk @@ -1,37 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="swig" -PKG_VERSION="3.0.10" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.0.12" +PKG_SHA256="7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d" PKG_LICENSE="GPL" PKG_SITE="http://www.swig.org" PKG_URL="$SOURCEFORGE_SRC/swig/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="devel" -PKG_SHORTDESC="SWIG: a software development tool that connects programs written in C and C++ with a variety of high-level programming languages." PKG_LONGDESC="SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_HOST="--with-pcre-prefix=$ROOT/$TOOLCHAIN \ +PKG_CONFIGURE_OPTS_HOST="--program-suffix=3.0 \ + --with-pcre-prefix=$TOOLCHAIN \ --with-boost=no \ --without-pcre \ --without-x \ @@ -57,3 +37,7 @@ PKG_CONFIGURE_OPTS_HOST="--with-pcre-prefix=$ROOT/$TOOLCHAIN \ --without-r \ --without-go \ --without-d" + +post_makeinstall_host() { + ln -sf swig3.0 $TOOLCHAIN/bin/swig +} diff --git a/packages/devel/yajl/package.mk b/packages/devel/yajl/package.mk index e69f113b0b..a534cc2187 100644 --- a/packages/devel/yajl/package.mk +++ b/packages/devel/yajl/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="yajl" PKG_VERSION="2.1.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="020f55a2dfc979ad63dc99b629b3fea7e7e4b9f20d8b10b856cfcb8850f03c61" PKG_LICENSE="ISC" PKG_SITE="http://lloyd.github.com/yajl/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="devel" -PKG_SHORTDESC="yajl: Yet Another JSON Library (YAJL) is a small event-driven (SAX-style) JSON parser" -PKG_LONGDESC="Yet Another JSON Library (YAJL) is a small event-driven (SAX-style) JSON parser written in ANSI C, and a small validating JSON generator. YAJL is released under the permissive ISC license." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A small event-driven (SAX-style) JSON parser." post_makeinstall_target() { mv $SYSROOT_PREFIX/usr/lib/libyajl_s.a $SYSROOT_PREFIX/usr/lib/libyajl.a diff --git a/packages/emulation/cyclone68000/package.mk b/packages/emulation/cyclone68000/package.mk new file mode 100644 index 0000000000..0549397581 --- /dev/null +++ b/packages/emulation/cyclone68000/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="cyclone68000" +PKG_VERSION="66dda84" +PKG_SHA256="c59900531e35e7303e1172d9bd5d161491b4554983930ad855614252156ea0e0" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/notaz/cyclone68000" +PKG_URL="https://github.com/notaz/cyclone68000/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Motorola 68000 emulator written in ARM assembly" +PKG_TOOLCHAIN="manual" diff --git a/packages/emulation/libretro-2048/package.mk b/packages/emulation/libretro-2048/package.mk new file mode 100644 index 0000000000..6c7ce9c264 --- /dev/null +++ b/packages/emulation/libretro-2048/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-2048" +PKG_VERSION="bc05dc6e504e78fd4eaf7bf91f5b3f84a93c2962" +PKG_SHA256="39d283fdf59ffc22e66a06918b8e2afa27cd2912317fb0754431516b0e34277e" +PKG_LICENSE="Public domain" +PKG_SITE="https://github.com/libretro/libretro-2048" +PKG_URL="https://github.com/libretro/libretro-2048/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.2048: 2048 for Kodi" + +PKG_LIBNAME="2048_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="2048_LIB" + +make_target() { + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-4do/package.mk b/packages/emulation/libretro-4do/package.mk new file mode 100644 index 0000000000..fcc01a7c6b --- /dev/null +++ b/packages/emulation/libretro-4do/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-4do" +PKG_VERSION="e2ba1ebcbf6f210fcb8807ea43f57fe03c5a10ba" +PKG_SHA256="e7d691d26cabf03c141111b308a528567633568a653fd473d78616cba2444619" +PKG_LICENSE="LGPL" +PKG_SITE="https://github.com/libretro/4do-libretro" +PKG_URL="https://github.com/libretro/4do-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Port of 4DO/libfreedo to libretro." + +PKG_LIBNAME="4do_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="4DO_LIB" + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-4do/patches/libretro-4do-0001-fix-makefile.patch b/packages/emulation/libretro-4do/patches/libretro-4do-0001-fix-makefile.patch new file mode 100644 index 0000000000..85ddba078c --- /dev/null +++ b/packages/emulation/libretro-4do/patches/libretro-4do-0001-fix-makefile.patch @@ -0,0 +1,12 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2017-07-01 22:16:40.000000000 -0700 ++++ b/Makefile 2017-07-14 09:55:45.714816515 -0700 +@@ -37,8 +37,6 @@ + endif + + ifneq (,$(findstring unix,$(platform))) +- AR = ${CC_PREFIX}ar +- CC = ${CC_PREFIX}gcc + + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC diff --git a/packages/emulation/libretro-beetle-bsnes/package.mk b/packages/emulation/libretro-beetle-bsnes/package.mk new file mode 100644 index 0000000000..9ca0cb1f37 --- /dev/null +++ b/packages/emulation/libretro-beetle-bsnes/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-bsnes" +PKG_VERSION="7e73405fb0b24dde7a0aca1bd5ef50928d7abe45" +PKG_SHA256="06b261c90985a6612013a478893d8a0e0c908aa8502e6e5ae4b7b3d3d1b82a6b" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-bsnes-libretro" +PKG_URL="https://github.com/libretro/beetle-bsnes-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-bsnes: Beetle bSNES for Kodi" + +PKG_LIBNAME="mednafen_snes_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-BSNES_LIB" + +make_target() { + LDFLAGS="$LDFLAGS -ldl" + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-gba/package.mk b/packages/emulation/libretro-beetle-gba/package.mk new file mode 100644 index 0000000000..ed1582439f --- /dev/null +++ b/packages/emulation/libretro-beetle-gba/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-gba" +PKG_VERSION="b953b7402f34cec94852b59e49a3486235b11607" +PKG_SHA256="1f17e9caf430001acf52426df7d73968ba1c48bdaa41256055e73c18f7ef11e2" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-gba-libretro" +PKG_URL="https://github.com/libretro/beetle-gba-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-gba: Beetle GBA for Kodi" + +PKG_LIBNAME="mednafen_gba_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-GBA_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-lynx/package.mk b/packages/emulation/libretro-beetle-lynx/package.mk new file mode 100644 index 0000000000..7094a531ce --- /dev/null +++ b/packages/emulation/libretro-beetle-lynx/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-lynx" +PKG_VERSION="ad4347a58e8334bb351abaf82cb7bcb08d7e3c8c" +PKG_SHA256="427d809c0ecc390677ffe85f20ebc86dea402e76138ff45cd2a7bd7e98eb9981" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-lynx-libretro" +PKG_URL="https://github.com/libretro/beetle-lynx-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Standalone port of Mednafen Lynx to libretro, itself a fork of Handy" + +PKG_LIBNAME="mednafen_lynx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-LYNX_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-ngp/package.mk b/packages/emulation/libretro-beetle-ngp/package.mk new file mode 100644 index 0000000000..1f574ece27 --- /dev/null +++ b/packages/emulation/libretro-beetle-ngp/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-ngp" +PKG_VERSION="78eb883d0e9efbb8a66be20f3938f1616453cea6" +PKG_SHA256="91217306d2018663c24c290a2167b46e1ae1e74efcd79b267610b569ad88bcea" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-ngp-libretro" +PKG_URL="https://github.com/libretro/beetle-ngp-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Standalone port of Mednafen NGP to the libretro API, itself a fork of Neopop" + +PKG_LIBNAME="mednafen_ngp_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-NGP_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-pce-fast/package.mk b/packages/emulation/libretro-beetle-pce-fast/package.mk new file mode 100644 index 0000000000..ff92180d33 --- /dev/null +++ b/packages/emulation/libretro-beetle-pce-fast/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-pce-fast" +PKG_VERSION="433fb7a36fa26996a37f2107fb5189f243024f7d" +PKG_SHA256="33d13fdbf315e4de9c04f6a70417a4afc25a82ca95f66f45e45818f1d3d37d6a" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-pce-fast-libretro" +PKG_URL="https://github.com/libretro/beetle-pce-fast-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-pce-fast: Beetle PCE Fast for Kodi" + +PKG_LIBNAME="mednafen_pce_fast_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-PCE-FAST_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-pcfx/package.mk b/packages/emulation/libretro-beetle-pcfx/package.mk new file mode 100644 index 0000000000..3cc7e9c428 --- /dev/null +++ b/packages/emulation/libretro-beetle-pcfx/package.mk @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-pcfx" +PKG_VERSION="84b7ca6af37525af126069f812d53784bc1702fe" +PKG_SHA256="30b85929a9b9d23c730c26ea823ba9a3a9963f4db18698025874e247ed9473fa" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-pcfx-libretro" +PKG_URL="https://github.com/libretro/beetle-pcfx-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Standalone port of Mednafen PCFX to libretro" + +PKG_LIBNAME="mednafen_pcfx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-PCFX_LIB" + +make_target() { + case $TARGET_CPU in + arm1176jzf-s) + make platform=armv6-hardfloat + ;; + cortex-a7) + make platform=armv7-neon-hardfloat + ;; + cortex-a9|*cortex-a53|cortex-a17) + if [ "$TARGET_ARCH" = "aarch64" ]; then + make platform=aarch64 + else + make platform=armv7-cortexa9-neon-hardfloat + fi + ;; + x86-64) + make + ;; + esac +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-pcfx/patches/libretro-beetle-pcfx-0001-fix-makefile.patch b/packages/emulation/libretro-beetle-pcfx/patches/libretro-beetle-pcfx-0001-fix-makefile.patch new file mode 100644 index 0000000000..89e25370cf --- /dev/null +++ b/packages/emulation/libretro-beetle-pcfx/patches/libretro-beetle-pcfx-0001-fix-makefile.patch @@ -0,0 +1,11 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2017-08-18 14:58:12.000000000 -0700 ++++ b/Makefile 2017-09-05 12:41:51.209673108 -0700 +@@ -198,7 +198,6 @@ + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC + SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T +- CC = gcc + LDFLAGS += $(PTHREAD_FLAGS) + FLAGS += $(PTHREAD_FLAGS) -DHAVE_MKDIR + IS_X86 = 0 diff --git a/packages/emulation/libretro-beetle-psx/package.mk b/packages/emulation/libretro-beetle-psx/package.mk new file mode 100644 index 0000000000..0d383a7aae --- /dev/null +++ b/packages/emulation/libretro-beetle-psx/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-psx" +PKG_VERSION="53591985319edc34d83a0858ad9a935b934dcf5c" +PKG_SHA256="5c9ae8e49622b95df6485dffe75f90e9282542a3b6d7b5331a8e48287b355302" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-psx-libretro" +PKG_URL="https://github.com/libretro/beetle-psx-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Fork of Mednafen PSX" + +PKG_LIBNAME="mednafen_psx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-PSX_LIB" + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-saturn/package.mk b/packages/emulation/libretro-beetle-saturn/package.mk new file mode 100644 index 0000000000..67120db310 --- /dev/null +++ b/packages/emulation/libretro-beetle-saturn/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-saturn" +PKG_VERSION="ad74e9675ad60211ae5d7bb6bbdfbae234110a55" +PKG_SHA256="4820b641bd85fb51edfacd01f3518f03dbaa91f71a9900a9760e73ce67bf9064" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/beetle-saturn-libretro" +PKG_URL="https://github.com/libretro/beetle-saturn-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-saturn: beetle-saturn for Kodi" + +PKG_LIBNAME="mednafen_saturn_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-SATURN_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-supergrafx/package.mk b/packages/emulation/libretro-beetle-supergrafx/package.mk new file mode 100644 index 0000000000..b289cb8731 --- /dev/null +++ b/packages/emulation/libretro-beetle-supergrafx/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-supergrafx" +PKG_VERSION="c92d975f4e572b84a219e96573a92e17af21dbe7" +PKG_SHA256="5aa844efb11dd53e70e03caaa1bc1535bdae4c6929d73715b1a07fabfd76865d" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-supergrafx-libretro" +PKG_URL="https://github.com/libretro/beetle-supergrafx-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Standalone port of Mednafen PCE Fast to libretro. This one only emulates a SuperGrafx TG-16" + +PKG_LIBNAME="mednafen_supergrafx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-SUPERGRAFX_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-vb/package.mk b/packages/emulation/libretro-beetle-vb/package.mk new file mode 100644 index 0000000000..b8bcaf20e9 --- /dev/null +++ b/packages/emulation/libretro-beetle-vb/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-vb" +PKG_VERSION="00accc8a7c3482e5e464c5bb5f0679478024a0dc" +PKG_SHA256="f42baa7896d906f385e4aaa60d9f39066eb84bcad67b8f94366c8ff0f8bcef7f" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-vb-libretro" +PKG_URL="https://github.com/libretro/beetle-vb-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Standalone port of Mednafen VB to libretro" + +PKG_LIBNAME="mednafen_vb_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-VB_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-beetle-wswan/package.mk b/packages/emulation/libretro-beetle-wswan/package.mk new file mode 100644 index 0000000000..65b3e9e3a1 --- /dev/null +++ b/packages/emulation/libretro-beetle-wswan/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-beetle-wswan" +PKG_VERSION="ecada6655c6e6b53b27ee83a23523ecb89769625" +PKG_SHA256="1b4cb151b0cab58de72b608a2f6d894515848af90e95514c56e218568e2f3556" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/beetle-wswan-libretro" +PKG_URL="https://github.com/libretro/beetle-wswan-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Standalone port of Mednafen WonderSwan to libretro, itself a fork of Cygne" + +PKG_LIBNAME="mednafen_wswan_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BEETLE-WSWAN_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-bluemsx/package.mk b/packages/emulation/libretro-bluemsx/package.mk new file mode 100644 index 0000000000..95785b2b86 --- /dev/null +++ b/packages/emulation/libretro-bluemsx/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-bluemsx" +PKG_VERSION="d0fd4a7bf3f76329ab078e4e1e2db13ea20c106b" +PKG_SHA256="828f5222f62edc84ecb73b560467971ddf3e27e1cb80f026818fae9a1d563783" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/blueMSX-libretro" +PKG_URL="https://github.com/libretro/blueMSX-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.bluemsx: BlueMSX for Kodi" + +PKG_LIBNAME="bluemsx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BLUEMSX_LIB" + +make_target() { + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-bnes/package.mk b/packages/emulation/libretro-bnes/package.mk new file mode 100644 index 0000000000..460ced3986 --- /dev/null +++ b/packages/emulation/libretro-bnes/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-bnes" +PKG_VERSION="598c123771c885f8c48967f82b3a496b9e105b79" +PKG_SHA256="6e8d04517908593c7c3260d5358da4de0caffeb9dd5457b0097555a144f4c757" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/bnes-libretro" +PKG_URL="https://github.com/libretro/bnes-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.bnes: bNES for Kodi" + +PKG_LIBNAME="bnes_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="BNES_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-bsnes-mercury-accuracy/package.mk b/packages/emulation/libretro-bsnes-mercury-accuracy/package.mk new file mode 100644 index 0000000000..69ac9cadef --- /dev/null +++ b/packages/emulation/libretro-bsnes-mercury-accuracy/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-bsnes-mercury-accuracy" +PKG_VERSION="4e221df676ffc7b46d083cf2ae100131eabe5076" +PKG_SHA256="ad493381c5736e521996b850918e0df7c09124c71d98fac6a1e04c57830dade4" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/bsnes-mercury" +PKG_URL="https://github.com/libretro/bsnes-mercury/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-bsnes-accuracy: Beetle bSNES for Kodi" + +PKG_LIBNAME="bsnes_mercury_accuracy_libretro.so" +PKG_LIBPATH="out/$PKG_LIBNAME" +PKG_LIBVAR="BSNES-MERCURY-ACCURACY_LIB" + +make_target() { + make profile=accuracy +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-bsnes-mercury-accuracy/patches/libretro-bsnes-mercury-accuracy-0001_fix-cross-compile.patch b/packages/emulation/libretro-bsnes-mercury-accuracy/patches/libretro-bsnes-mercury-accuracy-0001_fix-cross-compile.patch new file mode 100644 index 0000000000..a7b59a12a4 --- /dev/null +++ b/packages/emulation/libretro-bsnes-mercury-accuracy/patches/libretro-bsnes-mercury-accuracy-0001_fix-cross-compile.patch @@ -0,0 +1,57 @@ +From ed19aa8fbd4012ea2ccb74a2160855be01aba5e4 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Sun, 5 Feb 2017 18:15:12 -0800 +Subject: [PATCH 1/2] fix cross compile + +--- + Makefile | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 0ac8061..b76c4c6 100644 +--- a/Makefile ++++ b/Makefile +@@ -51,13 +51,7 @@ else ifeq ($(pgo),optimize) + flags += -fprofile-use + endif + +-ifeq ($(compiler),) +- ifneq ($(CXX),) +- compiler := $(CXX) +- else +- compiler := g++ +- endif +-endif ++compiler = $(CXX) + + # platform + ui := target-$(target) +-- +2.9.3 + + +From da71b9ec79482c31c37496019792da316626f1f2 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Sun, 5 Feb 2017 20:40:42 -0800 +Subject: [PATCH 2/2] no -O3 + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index b76c4c6..9622b5a 100644 +--- a/Makefile ++++ b/Makefile +@@ -32,7 +32,7 @@ sfc_lagfix := 1 + ifeq ($(DEBUG), 1) + flags := -I. -O0 -g + else +- flags := -I. -O3 -fomit-frame-pointer ++ flags := -I. -fomit-frame-pointer + endif + + cflags := $(CPPFLAGS) $(CFLAGS) -std=gnu99 -xc +-- +2.9.3 + diff --git a/packages/emulation/libretro-bsnes-mercury-balanced/package.mk b/packages/emulation/libretro-bsnes-mercury-balanced/package.mk new file mode 100644 index 0000000000..6c44f60a6f --- /dev/null +++ b/packages/emulation/libretro-bsnes-mercury-balanced/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-bsnes-mercury-balanced" +PKG_VERSION="4e221df676ffc7b46d083cf2ae100131eabe5076" +PKG_SHA256="ad493381c5736e521996b850918e0df7c09124c71d98fac6a1e04c57830dade4" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/bsnes-mercury" +PKG_URL="https://github.com/libretro/bsnes-mercury/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-bsnes-balanced: Beetle bSNES for Kodi" + +PKG_LIBNAME="bsnes_mercury_balanced_libretro.so" +PKG_LIBPATH="out/$PKG_LIBNAME" +PKG_LIBVAR="BSNES-MERCURY-BALANCED_LIB" + +make_target() { + make profile=balanced +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-bsnes-mercury-balanced/patches/libretro-bsnes-mercury-balanced-0001_fix-cross-compile.patch b/packages/emulation/libretro-bsnes-mercury-balanced/patches/libretro-bsnes-mercury-balanced-0001_fix-cross-compile.patch new file mode 100644 index 0000000000..a7b59a12a4 --- /dev/null +++ b/packages/emulation/libretro-bsnes-mercury-balanced/patches/libretro-bsnes-mercury-balanced-0001_fix-cross-compile.patch @@ -0,0 +1,57 @@ +From ed19aa8fbd4012ea2ccb74a2160855be01aba5e4 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Sun, 5 Feb 2017 18:15:12 -0800 +Subject: [PATCH 1/2] fix cross compile + +--- + Makefile | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 0ac8061..b76c4c6 100644 +--- a/Makefile ++++ b/Makefile +@@ -51,13 +51,7 @@ else ifeq ($(pgo),optimize) + flags += -fprofile-use + endif + +-ifeq ($(compiler),) +- ifneq ($(CXX),) +- compiler := $(CXX) +- else +- compiler := g++ +- endif +-endif ++compiler = $(CXX) + + # platform + ui := target-$(target) +-- +2.9.3 + + +From da71b9ec79482c31c37496019792da316626f1f2 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Sun, 5 Feb 2017 20:40:42 -0800 +Subject: [PATCH 2/2] no -O3 + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index b76c4c6..9622b5a 100644 +--- a/Makefile ++++ b/Makefile +@@ -32,7 +32,7 @@ sfc_lagfix := 1 + ifeq ($(DEBUG), 1) + flags := -I. -O0 -g + else +- flags := -I. -O3 -fomit-frame-pointer ++ flags := -I. -fomit-frame-pointer + endif + + cflags := $(CPPFLAGS) $(CFLAGS) -std=gnu99 -xc +-- +2.9.3 + diff --git a/packages/emulation/libretro-bsnes-mercury-performance/package.mk b/packages/emulation/libretro-bsnes-mercury-performance/package.mk new file mode 100644 index 0000000000..2bd556d391 --- /dev/null +++ b/packages/emulation/libretro-bsnes-mercury-performance/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-bsnes-mercury-performance" +PKG_VERSION="4e221df676ffc7b46d083cf2ae100131eabe5076" +PKG_SHA256="ad493381c5736e521996b850918e0df7c09124c71d98fac6a1e04c57830dade4" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/bsnes-mercury" +PKG_URL="https://github.com/libretro/bsnes-mercury/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.beetle-bsnes-performance: Beetle bSNES for Kodi" + +PKG_LIBNAME="bsnes_mercury_performance_libretro.so" +PKG_LIBPATH="out/$PKG_LIBNAME" +PKG_LIBVAR="BSNES-MERCURY-PERFORMANCE_LIB" + +make_target() { + make profile=performance +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-bsnes-mercury-performance/patches/libretro-bsnes-mercury-performance-0001_fix-cross-compile.patch b/packages/emulation/libretro-bsnes-mercury-performance/patches/libretro-bsnes-mercury-performance-0001_fix-cross-compile.patch new file mode 100644 index 0000000000..a7b59a12a4 --- /dev/null +++ b/packages/emulation/libretro-bsnes-mercury-performance/patches/libretro-bsnes-mercury-performance-0001_fix-cross-compile.patch @@ -0,0 +1,57 @@ +From ed19aa8fbd4012ea2ccb74a2160855be01aba5e4 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Sun, 5 Feb 2017 18:15:12 -0800 +Subject: [PATCH 1/2] fix cross compile + +--- + Makefile | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 0ac8061..b76c4c6 100644 +--- a/Makefile ++++ b/Makefile +@@ -51,13 +51,7 @@ else ifeq ($(pgo),optimize) + flags += -fprofile-use + endif + +-ifeq ($(compiler),) +- ifneq ($(CXX),) +- compiler := $(CXX) +- else +- compiler := g++ +- endif +-endif ++compiler = $(CXX) + + # platform + ui := target-$(target) +-- +2.9.3 + + +From da71b9ec79482c31c37496019792da316626f1f2 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Sun, 5 Feb 2017 20:40:42 -0800 +Subject: [PATCH 2/2] no -O3 + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index b76c4c6..9622b5a 100644 +--- a/Makefile ++++ b/Makefile +@@ -32,7 +32,7 @@ sfc_lagfix := 1 + ifeq ($(DEBUG), 1) + flags := -I. -O0 -g + else +- flags := -I. -O3 -fomit-frame-pointer ++ flags := -I. -fomit-frame-pointer + endif + + cflags := $(CPPFLAGS) $(CFLAGS) -std=gnu99 -xc +-- +2.9.3 + diff --git a/packages/emulation/libretro-cap32/package.mk b/packages/emulation/libretro-cap32/package.mk new file mode 100644 index 0000000000..0d2ee60eb8 --- /dev/null +++ b/packages/emulation/libretro-cap32/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-cap32" +PKG_VERSION="b8dfc3cca531dcb5fb88b818ae21f50aa3ad481f" +PKG_SHA256="1c3b3527b36d44e1db1327f3b4804145fa409c3be2985261ef2411208ffa6d0c" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/libretro-cap32" +PKG_URL="https://github.com/libretro/libretro-cap32/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.cap32: cap32 for Kodi" + +PKG_LIBNAME="cap32_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="CAP32_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-desmume/package.mk b/packages/emulation/libretro-desmume/package.mk new file mode 100644 index 0000000000..a25315e2ea --- /dev/null +++ b/packages/emulation/libretro-desmume/package.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-desmume" +PKG_VERSION="5f6f1ee44310cb7b84111fa86288fcb912da33a7" +PKG_SHA256="b231f187c2eee594bc48622cdf8486e3e135806f297bf34045897028cf4a4977" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/desmume" +PKG_URL="https://github.com/libretro/desmume/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="libretro wrapper for desmume NDS emulator." +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="desmume_libretro.so" +PKG_LIBPATH="desmume/$PKG_LIBNAME" +PKG_LIBVAR="DESMUME_LIB" + +make_target() { + case $TARGET_CPU in + arm1176jzf-s) + make -C desmume -f Makefile.libretro platform=armv6-hardfloat-$TARGET_CPU + ;; + cortex-a7|cortex-a9) + make -C desmume -f Makefile.libretro platform=armv7-neon-hardfloat-$TARGET_CPU + ;; + x86-64) + make -C desmume -f Makefile.libretro + ;; + esac +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-dinothawr/package.mk b/packages/emulation/libretro-dinothawr/package.mk new file mode 100644 index 0000000000..e3b4fcdcd1 --- /dev/null +++ b/packages/emulation/libretro-dinothawr/package.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-dinothawr" +PKG_VERSION="387d6128ffedadefaf60eae5cf9037123f185abf" +PKG_SHA256="fd8088386cab23d9b2636d6dbb9a20818432b721d258942e1e6c7a9c689ce94e" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/Dinothawr" +PKG_URL="https://github.com/libretro/Dinothawr/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.dinothawr: dinothawr for Kodi" + +PKG_LIBNAME="dinothawr_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="DINOTHAWR_LIB" + +pre_make_target() { + if target_has_feature neon; then + export HAVE_NEON=1 + fi +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-dinothawr/patches/libretro-dinothawr-0001-fix-makefile.patch b/packages/emulation/libretro-dinothawr/patches/libretro-dinothawr-0001-fix-makefile.patch new file mode 100644 index 0000000000..ac37a5ca33 --- /dev/null +++ b/packages/emulation/libretro-dinothawr/patches/libretro-dinothawr-0001-fix-makefile.patch @@ -0,0 +1,11 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2017-06-12 09:00:49.000000000 -0700 ++++ b/Makefile 2017-07-14 13:23:42.430741116 -0700 +@@ -1,6 +1,6 @@ + DEBUG = 0 + USE_CXX03 = 0 +-HAVE_NEON=0 ++HAVE_NEON ?= 0 + + ifeq ($(platform),) + platform = unix diff --git a/packages/emulation/libretro-dinothawr/patches/libretro-dinothawr-001-gcc7-fixes.patch b/packages/emulation/libretro-dinothawr/patches/libretro-dinothawr-001-gcc7-fixes.patch new file mode 100644 index 0000000000..5e45813e32 --- /dev/null +++ b/packages/emulation/libretro-dinothawr/patches/libretro-dinothawr-001-gcc7-fixes.patch @@ -0,0 +1,10 @@ +--- libretro-dinothawr-02821dd/utils.hpp 2017-06-02 15:32:28.527780477 +0200 ++++ libretro-dinothawr-02821dd/utils.hpp 2017-06-02 15:24:23.781305524 +0200 +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #include + diff --git a/packages/emulation/libretro-dolphin/package.mk b/packages/emulation/libretro-dolphin/package.mk new file mode 100644 index 0000000000..b11edb083e --- /dev/null +++ b/packages/emulation/libretro-dolphin/package.mk @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-dolphin" +PKG_VERSION="9ef58b5" +PKG_SHA256="b9a040233219bdb2bfb2b67f4bc6ea63faf0b9b85bf22893408710a62df4c2da" +PKG_ARCH="none" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/dolphin" +PKG_URL="https://github.com/libretro/dolphin/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform enet" +PKG_LONGDESC="Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC" + +PKG_LIBNAME="dolphin_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="DOLPHIN_LIB" + +pre_configure_target() { + # fails to build in subdirs + cd $PKG_BUILD + rm -rf .$TARGET_NAME +} + +make_target() { + make -C libretro/ +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-dosbox/package.mk b/packages/emulation/libretro-dosbox/package.mk new file mode 100644 index 0000000000..3da7905027 --- /dev/null +++ b/packages/emulation/libretro-dosbox/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-dosbox" +PKG_VERSION="8f2d7318b6e66e397448a5905b30bc4f92de7133" +PKG_SHA256="ee1bd0d04f9aa0e11eb827b8badbceec5bd9f0727765688436bd1d67fdb65816" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/dosbox-libretro" +PKG_URL="https://github.com/libretro/dosbox-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.dosbox: DOSBox for Kodi" +PKG_BUILD_FLAGS="+pic" + +PKG_LIBNAME="dosbox_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="DOSBOX_LIB" + +make_target() { + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-fbalpha/package.mk b/packages/emulation/libretro-fbalpha/package.mk new file mode 100644 index 0000000000..860753bd83 --- /dev/null +++ b/packages/emulation/libretro-fbalpha/package.mk @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-fbalpha" +PKG_VERSION="0581bf39ec9ac7a6f63d37324bc0083e9f024880" +PKG_SHA256="9b9cc7aad7ff4eedcc2faa18e36ea969911bdba8a868be7d983dc4c8e92b9fd8" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/fbalpha" +PKG_URL="https://github.com/libretro/fbalpha/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.fba: fba for Kodi" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="fbalpha_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="FBALPHA_LIB" + +pre_make_target() { + PKG_MAKE_OPTS_TARGET="-f makefile.libretro CC=$CC CXX=$CXX GIT_VERSION=${PKG_VERSION:0:7}" + + if [ "$PROJECT" = "RPi" ]; then + case $DEVICE in + RPi) + PKG_MAKE_OPTS_TARGET+=" platform=armv" + ;; + RPi2) + PKG_MAKE_OPTS_TARGET+=" platform=rpi2" + ;; + esac + else + # NEON Support ? + if target_has_feature neon; then + PKG_MAKE_OPTS_TARGET+=" HAVE_NEON=1" + fi + fi +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-fceumm/package.mk b/packages/emulation/libretro-fceumm/package.mk new file mode 100644 index 0000000000..c5d03ae2b6 --- /dev/null +++ b/packages/emulation/libretro-fceumm/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-fceumm" +PKG_VERSION="d3f4d8f30c78d36f10c57d301d893f806786313c" +PKG_SHA256="e1e665b906443bc559a424f9675af252c827ef028c85ceaf0dd23ccf79177486" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/libretro-fceumm" +PKG_URL="https://github.com/libretro/libretro-fceumm/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.fceumm: FCEUmm emulator for Kodi" + +PKG_LIBNAME="fceumm_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="FCEUMM_LIB" + +make_target() { + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-fmsx/package.mk b/packages/emulation/libretro-fmsx/package.mk new file mode 100644 index 0000000000..bb68f7f46c --- /dev/null +++ b/packages/emulation/libretro-fmsx/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-fmsx" +PKG_VERSION="6b241974ffb4d2a3fc681b65a8ff6b717501cb67" +PKG_SHA256="16d5fbdc0e5fcb0c7954fa531f8014ca251404c67975654e7b77c582d3b7d0fa" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/fmsx-libretro" +PKG_URL="https://github.com/libretro/fmsx-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.fmsx: fmsx for Kodi" + +PKG_LIBNAME="fmsx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="FMSX_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-fsuae/package.mk b/packages/emulation/libretro-fsuae/package.mk new file mode 100644 index 0000000000..5781201196 --- /dev/null +++ b/packages/emulation/libretro-fsuae/package.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-fsuae" +PKG_VERSION="6b98f852e00a83ecdcf497c1032882ad7b6efc99" +PKG_SHA256="0beaf41955733f30cf092e7aa7e4f5e07a64c0608783fb7e6c820711c44e4ed9" +PKG_ARCH="x86_64" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/libretro-fsuae" +PKG_URL="https://github.com/libretro/libretro-fsuae/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libmpeg2 openal-soft" +PKG_LONGDESC="FS-UAE amiga emulator." +PKG_BUILD_FLAGS="-lto" +PKG_TOOLCHAIN="autotools" + +PKG_LIBNAME="fsuae_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="FSUAE_LIB" + +if [ "$TARGET_ARCH" = "arm" ] && target_has_feature neon; then + PKG_CONFIGURE_OPTS_TARGET="--disable-jit --enable-neon" +fi + +pre_configure_target() { + cd $PKG_BUILD + rm -rf .$TARGET_NAME + export ac_cv_func_realloc_0_nonnull=yes +} + +make_target() { + make -j1 CC="$CC" gen + make CC="$CC" +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-fuse/package.mk b/packages/emulation/libretro-fuse/package.mk new file mode 100644 index 0000000000..747f1dedc0 --- /dev/null +++ b/packages/emulation/libretro-fuse/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-fuse" +PKG_VERSION="43d01dec6ad26e6014fabf79dbcf6a04ac2c7eea" +PKG_SHA256="f6a170d126d46dee2442127bea7fab54fcd641a663941c92e087f00d38430251" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/fuse-libretro" +PKG_URL="https://github.com/libretro/fuse-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.fuse: fuse for Kodi" + +PKG_LIBNAME="fuse_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="FUSE_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-gambatte/package.mk b/packages/emulation/libretro-gambatte/package.mk new file mode 100644 index 0000000000..dd2d2cdb32 --- /dev/null +++ b/packages/emulation/libretro-gambatte/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-gambatte" +PKG_VERSION="ffce1f0e93111bec77b3778273297536fcfb612a" +PKG_SHA256="2acc20c33c0ae86483803a58abd20555e87528b3c0697055894dfdf90a614ca8" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/gambatte-libretro" +PKG_URL="https://github.com/libretro/gambatte-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.gambatte: Gambatte for Kodi" + +PKG_LIBNAME="gambatte_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="GAMBATTE_LIB" + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-genplus/package.mk b/packages/emulation/libretro-genplus/package.mk new file mode 100644 index 0000000000..50485b0587 --- /dev/null +++ b/packages/emulation/libretro-genplus/package.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-genplus" +PKG_VERSION="f5eed5133101999e1f6f04d2240ae77bb891adb9" +PKG_SHA256="8e4ff32f722144b68e629729cac42fb14e4299e9c5d0217539e816748db7c8a4" +PKG_LICENSE="Modified BSD / LGPLv2.1" +PKG_SITE="https://github.com/libretro/Genesis-Plus-GX" +PKG_URL="https://github.com/libretro/Genesis-Plus-GX/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.genplus: Genesis Plus GX for Kodi" +PKG_TOOLCHAIN="manual" + +PKG_LIBNAME="genesis_plus_gx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="GENPLUS_LIB" + +make_target() { + if [ "$ARCH" = "arm" ]; then + CFLAGS="$CFLAGS -DALIGN_LONG" + fi + + make -f Makefile.libretro GIT_VERSION=$PKG_VERSION +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-gw/package.mk b/packages/emulation/libretro-gw/package.mk new file mode 100644 index 0000000000..2e62a2acf6 --- /dev/null +++ b/packages/emulation/libretro-gw/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-gw" +PKG_VERSION="dc0feaf9a779a9dc4862351584a585d4fc871c3f" +PKG_SHA256="df8a8bf8253d2dd791eec702ef2c3b1b719a9ead92d08f96fa53b6f5bdcd091f" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/gw-libretro" +PKG_URL="https://github.com/libretro/gw-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.gw: gw for Kodi" + +PKG_LIBNAME="gw_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="GW_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-handy/package.mk b/packages/emulation/libretro-handy/package.mk new file mode 100644 index 0000000000..2079da3631 --- /dev/null +++ b/packages/emulation/libretro-handy/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-handy" +PKG_VERSION="08cc63376cd8886aea6e6cd38297ba7c9ea0344c" +PKG_SHA256="e2e70fcf4d983549fa2a33791cd570958087f4dbf3664374dcc38a82d29139ce" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/libretro-handy" +PKG_URL="https://github.com/libretro/libretro-handy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.handy: handy for Kodi" + +PKG_LIBNAME="handy_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="HANDY_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-hatari/package.mk b/packages/emulation/libretro-hatari/package.mk new file mode 100644 index 0000000000..040fa37ee4 --- /dev/null +++ b/packages/emulation/libretro-hatari/package.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-hatari" +PKG_VERSION="42388bbdf042824d1d7d3b6db64a6b719c707682" +PKG_SHA256="38ebb5bf1e3e60de71cce695a4f4bbb443bb08852262c10e6e1d11754f4a3fe2" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/hatari" +PKG_URL="https://github.com/libretro/hatari/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.hatari: hatari for Kodi" +PKG_TOOLCHAIN="manual" + +PKG_LIBNAME="hatari_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="HATARI_LIB" + +make_target() { + cd $PKG_BUILD + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame/package.mk b/packages/emulation/libretro-mame/package.mk new file mode 100644 index 0000000000..93bb19566f --- /dev/null +++ b/packages/emulation/libretro-mame/package.mk @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame" +PKG_VERSION="1347e1cf946e8402164acaaea1e12e08de6ca14d" +PKG_SHA256="c7d43ff48134a77e3ee2229949cf01cebdc190d876896ade0546db24069b392c" +PKG_ARCH="x86_64 arm" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame" +PKG_URL="https://github.com/libretro/mame/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.mame: MAME for Kodi" +PKG_BUILD_FLAGS="-gold -lto" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="mame_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME_LIB" + +make_target() { + PTR64="0" + NOASM="0" + + if [ "$ARCH" == "arm" ]; then + NOASM="1" + elif [ "$ARCH" == "x86_64" ]; then + PTR64="1" + fi + + make REGENIE=1 VERBOSE=1 NOWERROR=1 PYTHON_EXECUTABLE=python2 CONFIG=libretro \ + LIBRETRO_OS="unix" ARCH="" PROJECT="" LIBRETRO_CPU="$ARCH" DISTRO="debian-stable" \ + CC="$CC" CXX="$CXX" LD="$LD" CROSS_BUILD="" PTR64="$PTR64" TARGET="mame" \ + SUBTARGET="arcade" PLATFORM="$ARCH" RETRO=1 OSD="retro" +} + +post_make_target() { + mv $PKG_BUILD/mamearcade_libretro.so $PKG_BUILD/mame_libretro.so +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame/patches/libretro-mame-0001-fix-makefile.patch b/packages/emulation/libretro-mame/patches/libretro-mame-0001-fix-makefile.patch new file mode 100644 index 0000000000..9bd7cd5bff --- /dev/null +++ b/packages/emulation/libretro-mame/patches/libretro-mame-0001-fix-makefile.patch @@ -0,0 +1,14 @@ +diff -Naur a/3rdparty/genie/build/gmake.linux/genie.make b/3rdparty/genie/build/gmake.linux/genie.make +--- a/3rdparty/genie/build/gmake.linux/genie.make 2017-06-28 12:47:18.000000000 -0700 ++++ b/3rdparty/genie/build/gmake.linux/genie.make 2017-07-14 12:21:57.302218319 -0700 +@@ -28,10 +28,6 @@ + RM = $(SILENT) del /F "$(subst /,\\,$(1))" 2> nul || exit 0 + endif + +-CC = gcc +-CXX = g++ +-AR = ar +- + ifndef RESCOMP + ifdef WINDRES + RESCOMP = $(WINDRES) diff --git a/packages/emulation/libretro-mame2000/package.mk b/packages/emulation/libretro-mame2000/package.mk new file mode 100644 index 0000000000..dd7f4065e5 --- /dev/null +++ b/packages/emulation/libretro-mame2000/package.mk @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame2000" +PKG_VERSION="90d9909ab60dace88d5ab281fa1e9e43e5f25364" +PKG_SHA256="e7fed9e0457edae536d9056d52458af18f53ddd3e77393d5cfff487cf07d33f9" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame2000-libretro" +PKG_URL="https://github.com/libretro/mame2000-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="2000 version of MAME (0.37b5) for libretro" + +PKG_LIBNAME="mame2000_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME2000_LIB" + +make_target() { + if [ "$TARGET_ARCH" = "arm" ]; then + make ARM=1 + else + make + fi +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame2003/package.mk b/packages/emulation/libretro-mame2003/package.mk new file mode 100644 index 0000000000..2c3f0b0732 --- /dev/null +++ b/packages/emulation/libretro-mame2003/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame2003" +PKG_VERSION="b0142d797cf5caebd2d012acb6fa811de3b0eeb3" +PKG_SHA256="4832c38ca0dd1410fb617fb0cd2c9549bb37e4f15f4609cd7d151195bb7c8a6d" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame2003-libretro" +PKG_URL="https://github.com/libretro/mame2003-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Late 2003 version of MAME (0.78) for libretro" + +PKG_LIBNAME="mame2003_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME2003_LIB" + +configure_target() { + export LD="$CC" +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame2003_plus/package.mk b/packages/emulation/libretro-mame2003_plus/package.mk new file mode 100644 index 0000000000..58c1c3fa6f --- /dev/null +++ b/packages/emulation/libretro-mame2003_plus/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame2003_plus" +PKG_VERSION="7c1709431c65fb9c71eb678a18e8c389cdb21b9c" +PKG_SHA256="495330f81e84f82b222ec9a4943f8b0b82650d121c8df52cfb49f64d0c4bc3b7" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame2003-plus-libretro" +PKG_URL="https://github.com/libretro/mame2003-plus-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Updated 2018 version of MAME (0.78) with added game support plus many fixes and improvements" + +PKG_LIBNAME="mame2003_plus_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME2003_PLUS_LIB" + +configure_target() { + export LD="$CC" +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame2010/package.mk b/packages/emulation/libretro-mame2010/package.mk new file mode 100644 index 0000000000..16dcb36b0b --- /dev/null +++ b/packages/emulation/libretro-mame2010/package.mk @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame2010" +PKG_VERSION="70732f9137f6bb2bde4014746ea8bc613173dd1e" +PKG_SHA256="36ab11541233c9a4240baf6f0a529d8d335dce23f25b66b950e18373fd8e65fb" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame2010-libretro" +PKG_URL="https://github.com/libretro/mame2010-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Late 2010 version of MAME (0.139) for libretro" + +PKG_LIBNAME="mame2010_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME2010_LIB" + +pre_make_target() { + export CFLAGS="$CFLAGS -fpermissive" + export CXXFLAGS="$CXXFLAGS -fpermissive" + export LD="$CXX" +} + +make_target() { + case $TARGET_CPU in + arm1176jzf-s) + make platform=armv6-hardfloat-$TARGET_CPU + ;; + cortex-a7|cortex-a9) + make platform=armv7-neon-hardfloat-$TARGET_CPU + ;; + *cortex-a53|cortex-a17) + if [ "$TARGET_ARCH" = "aarch64" ]; then + make platform=aarch64 + else + make platform=armv7-neon-hardfloat-cortex-a9 + fi + ;; + x86-64) + make + ;; + esac +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame2010/patches/libretro-mame2010-0001_fix-cross-build.patch b/packages/emulation/libretro-mame2010/patches/libretro-mame2010-0001_fix-cross-build.patch new file mode 100644 index 0000000000..fbdb86b3aa --- /dev/null +++ b/packages/emulation/libretro-mame2010/patches/libretro-mame2010-0001_fix-cross-build.patch @@ -0,0 +1,87 @@ +diff --git a/Makefile b/Makefile +index deb8820..aa13d3b 100644 +--- a/Makefile ++++ b/Makefile +@@ -61,7 +61,7 @@ COBJFLAGS = + CPPONLYFLAGS = + # LDFLAGS are used generally; LDFLAGSEMULATOR are additional + # flags only used when linking the core emulator +-LDFLAGS = ++LDFLAGS ?= + LDFLAGSEMULATOR = + + GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)" +@@ -104,24 +104,22 @@ ifeq ($(VRENDER),opengl) + CCOMFLAGS += -DHAVE_OPENGL + endif + +-UNAME=$(shell uname -m) +- +-ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64) ++ifeq ($(firstword $(filter x86_64,$(ARCH))),x86_64) + PTR64 = 1 + endif +-ifeq ($(firstword $(filter amd64,$(UNAME))),amd64) ++ifeq ($(firstword $(filter amd64,$(ARCH))),amd64) + PTR64 = 1 + endif +-ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64) ++ifeq ($(firstword $(filter ppc64,$(ARCH))),ppc64) + PTR64 = 1 + endif + ifneq (,$(findstring mingw64-w64,$(PATH))) + PTR64=1 + endif +-ifneq (,$(findstring Power,$(UNAME))) ++ifneq (,$(findstring Power,$(ARCH))) + BIGENDIAN=1 + endif +-ifneq (,$(findstring ppc,$(UNAME))) ++ifneq (,$(findstring ppc,$(ARCH))) + BIGENDIAN=1 + endif + +@@ -143,14 +141,10 @@ ifeq ($(VRENDER),opengl) + LIBS += -lGL + endif + LDFLAGS += $(SHARED) +- NATIVELD = g++ +- NATIVELDFLAGS = -Wl,--warn-common -lstdc++ +- NATIVECC = g++ +- NATIVECFLAGS = -std=gnu99 +- CC_AS = gcc +- CC = g++ +- AR = @ar +- LD = g++ ++ CC_AS ?= $(CC) ++ CC ?= g++ ++ AR ?= @ar ++ LD ?= g++ + CCOMFLAGS += $(PLATCFLAGS) -ffast-math + LIBS += -lstdc++ -lpthread + +@@ -345,10 +339,13 @@ else ifneq (,$(findstring rpi,$(platform))) + + # ARM + else ifneq (,$(findstring armv,$(platform))) ++ ARM_ENABLED = 1 ++ EXTRA_RULES = 1 + TARGETLIB := $(TARGET_NAME)_libretro.so +- SHARED := -shared -Wl,--no-undefined ++ SHARED := -shared -Wl,--version-script=src/osd/retro/link.T ++ LDFLAGS += $(SHARED) + fpic = -fPIC +- CC = g++ ++ CC ?= g++ + LDFLAGS += $(SHARED) + ARM_ENABLED = 1 + X86_SH2DRC = 0 +@@ -568,7 +565,7 @@ DEFS += -DFLAC__NO_DLL + + # CFLAGS is defined based on C or C++ targets + # (remember, expansion only happens when used, so doing it here is ok) +-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) ++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) + + # we compile C-only to C89 standard with GNU extensions + # we compile C++ code to C++98 standard with GNU extensions diff --git a/packages/emulation/libretro-mame2014/package.mk b/packages/emulation/libretro-mame2014/package.mk new file mode 100644 index 0000000000..aa4685476e --- /dev/null +++ b/packages/emulation/libretro-mame2014/package.mk @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame2014" +PKG_VERSION="62a932c9435ef89fdb9a1b0c41deadd7f04f53f3" +PKG_SHA256="9b38e1c0d75bc4295d9c08288579f2bf58e55e97132308b65d92ca494e55fa67" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame2014-libretro" +PKG_URL="https://github.com/libretro/mame2014-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Late 2014/Early 2015 version of MAME (0.159-ish) for libretro" + +PKG_LIBNAME="mame2014_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME2014_LIB" + +pre_make_target() { + export REALCC=$CC + export CC=$CXX + export LD=$CXX +} + +make_target() { + case $TARGET_CPU in + arm1176jzf-s) + make platform=armv6-hardfloat-$TARGET_CPU + ;; + cortex-a7|cortex-a9) + make platform=armv7-neon-hardfloat-$TARGET_CPU + ;; + *cortex-a53|cortex-a17) + if [ "$TARGET_ARCH" = "aarch64" ]; then + make platform=aarch64 + else + make platform=armv7-neon-hardfloat-cortex-a9 + fi + ;; + x86-64) + make + ;; + esac +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame2014/patches/libretro-mame2014-0001_fix-cross-compile.patch b/packages/emulation/libretro-mame2014/patches/libretro-mame2014-0001_fix-cross-compile.patch new file mode 100644 index 0000000000..ca0bea7a77 --- /dev/null +++ b/packages/emulation/libretro-mame2014/patches/libretro-mame2014-0001_fix-cross-compile.patch @@ -0,0 +1,44 @@ +diff --git a/Makefile b/Makefile +index 54a6f648c8..4a933d1d01 100644 +--- a/Makefile ++++ b/Makefile +@@ -132,8 +132,8 @@ ifneq (,$(findstring unix,$(platform))) + LIBS += -lGL + endif + LDFLAGS += $(fpic) $(SHARED) +- REALCC ?= gcc +- NATIVECC ?= g++ ++ REALCC ?= $(CC) ++ NATIVECC ?= $(CXX) + NATIVECFLAGS ?= -std=gnu99 + BASELIBS += -lpthread + CXX ?= g++ +@@ -142,13 +142,13 @@ ifneq (,$(findstring unix,$(platform))) + AR ?= @ar + LD := $(CXX) + LIBS += -lstdc++ -lpthread -ldl +- ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64) ++ ifeq ($(firstword $(filter x86_64,$(ARCH))),x86_64) + PTR64 = 1 + endif +- ifeq ($(firstword $(filter amd64,$(UNAME))),amd64) ++ ifeq ($(firstword $(filter amd64,$(ARCH))),amd64) + PTR64 = 1 + endif +- ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64) ++ ifeq ($(firstword $(filter ppc64,$(ARCH))),ppc64) + PTR64 = 1 + endif + ifneq (,$(findstring ppc,$(UNAME))) +@@ -487,7 +487,7 @@ endif + # utilities + MD = -mkdir$(EXE_EXT) + RM = @rm -f +-OBJDUMP = @objdump ++OBJDUMP ?= @objdump + PYTHON ?= @python2 + + #------------------------------------------------- +-- +2.17.1 + diff --git a/packages/emulation/libretro-mame2016/package.mk b/packages/emulation/libretro-mame2016/package.mk new file mode 100644 index 0000000000..5d1b79170b --- /dev/null +++ b/packages/emulation/libretro-mame2016/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mame2016" +PKG_VERSION="e06d731644217f46bf5a7613222632d41a327f93" +PKG_SHA256="60a8aaab5158868419f24cc0671f8bcba0a578aae46cae7b9482e2c332784553" +PKG_ARCH="x86_64" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mame2016-libretro" +PKG_URL="https://github.com/libretro/mame2016-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Late 2016 version of MAME (0.174) for libretro. Compatible with MAME 0.174 romsets" +PKG_TOOLCHAIN="make" +PKG_BUILD_FLAGS="-gold" + +PKG_LIBNAME="mame2016_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MAME2016_LIB" + +make_target() { + PTR64="1" + NOASM="0" + + make REGENIE=1 VERBOSE=1 NOWERROR=1 PYTHON_EXECUTABLE=python2 CONFIG=libretro \ + LIBRETRO_OS="unix" ARCH="" PROJECT="" LIBRETRO_CPU="$ARCH" DISTRO="debian-stable" \ + CC="$CC" CXX="$CXX" LD="$LD" CROSS_BUILD="" PTR64="$PTR64" TARGET="mame" \ + SUBTARGET="arcade" PLATFORM="$ARCH" RETRO=1 OSD="retro" +} + +post_make_target() { + mv $PKG_BUILD/mamearcade2016_libretro.so $PKG_BUILD/mame2016_libretro.so +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mame2016/patches/libretro-mame2016-01-crosscompile.patch b/packages/emulation/libretro-mame2016/patches/libretro-mame2016-01-crosscompile.patch new file mode 100644 index 0000000000..6c59619723 --- /dev/null +++ b/packages/emulation/libretro-mame2016/patches/libretro-mame2016-01-crosscompile.patch @@ -0,0 +1,15 @@ +--- a/makefile ++++ b/makefile +@@ -336,9 +336,9 @@ + else + PYTHON := $(PYTHON_EXECUTABLE) + endif +-CC := $(SILENT)gcc +-LD := $(SILENT)g++ +-CXX:= $(SILENT)g++ ++CC ?= $(SILENT)gcc ++LD ?= $(SILENT)g++ ++CXX?= $(SILENT)g++ + + #------------------------------------------------- + # specify OSD layer: windows, sdl, etc. diff --git a/packages/emulation/libretro-melonds/package.mk b/packages/emulation/libretro-melonds/package.mk new file mode 100644 index 0000000000..9e8f87fae0 --- /dev/null +++ b/packages/emulation/libretro-melonds/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-melonds" +PKG_VERSION="f3a42da78908edf4500055f4cb895e144094643d" +PKG_SHA256="cd96f1920c630091bccd39332929a2510ef79a1cebb6cc84dc5240f0199e0b71" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/melonds" +PKG_URL="https://github.com/libretro/melonds/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="libretro wrapper for melonDS DS emulator." +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="melonds_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MELONDS_LIB" + +configure_target() { + cd $PKG_BUILD +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mesen/package.mk b/packages/emulation/libretro-mesen/package.mk new file mode 100644 index 0000000000..64f4ff330d --- /dev/null +++ b/packages/emulation/libretro-mesen/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mesen" +PKG_VERSION="278ca034b2bbe8c3e931458a63d12a7559770f17" +PKG_SHA256="1d5743a4ff7d4fbedd9b1a0063e51fad5f961274cf3f007bc1d4537450753d45" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/SourMesen/Mesen/" +PKG_URL="https://github.com/SourMesen/Mesen/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.mesen: mesen for Kodi" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="mesen_libretro.so" +PKG_LIBPATH="Libretro/$PKG_LIBNAME" +PKG_LIBVAR="MESEN_LIB" + +make_target() { + make -C Libretro/ +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-meteor/package.mk b/packages/emulation/libretro-meteor/package.mk new file mode 100644 index 0000000000..9fb7f9e6d6 --- /dev/null +++ b/packages/emulation/libretro-meteor/package.mk @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-meteor" +PKG_VERSION="f8ab66ce5f68991bf9f926bf1dd5b662abd9d74b" +PKG_SHA256="3d2c4934ccb688782353f017313ca5bfea75441cc4c6751cda2751688d255c13" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/meteor-libretro" +PKG_URL="https://github.com/libretro/meteor-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.meteor: Meteor GBA for Kodi" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="meteor_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="METEOR_LIB" + +pre_configure_target() { + # fails to build in subdirs + cd $PKG_BUILD + rm -rf .$TARGET_NAME +} + +make_target() { + make -C libretro/ +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mgba/package.mk b/packages/emulation/libretro-mgba/package.mk new file mode 100644 index 0000000000..284f4d04d0 --- /dev/null +++ b/packages/emulation/libretro-mgba/package.mk @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mgba" +PKG_VERSION="a6767badd13821fbcae99cb10582c9519ae5fae7" +PKG_SHA256="834a6d879a43db21ba0481ed791668fb5ca2c7d790445542135853d8ef84af77" +PKG_LICENSE="MPL 2.0" +PKG_SITE="https://github.com/libretro/mgba" +PKG_URL="https://github.com/libretro/mgba/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform zlib" +PKG_LONGDESC="game.libretro.mgba: mGBA for Kodi" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="mgba_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MGBA_LIB" + +pre_configure_target() { + # fails to build in subdirs + cd $PKG_BUILD + rm -rf .$TARGET_NAME +} + +make_target() { + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mrboom/package.mk b/packages/emulation/libretro-mrboom/package.mk new file mode 100644 index 0000000000..8d99c519b4 --- /dev/null +++ b/packages/emulation/libretro-mrboom/package.mk @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mrboom" +PKG_VERSION="87a4af45ff35e693b4106ba1a340ab2111f61303" +PKG_SHA256="5cce743b2cd4f7252c2d3491b326612b2a9174dcf31f8a1e5ec8dfbcff9551e1" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/mrboom-libretro" +PKG_URL="https://github.com/libretro/mrboom-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.mrboom: mrboom for Kodi" + +PKG_LIBNAME="mrboom_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MRBOOM_LIB" + +pre_make_target() { + # Disable NEON otherwise build fails + if target_has_feature neon; then + CFLAGS+=" -DDONT_WANT_ARM_OPTIMIZATIONS" + fi +} + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mupen64plus/package.mk b/packages/emulation/libretro-mupen64plus/package.mk new file mode 100644 index 0000000000..1e3c3ed8a1 --- /dev/null +++ b/packages/emulation/libretro-mupen64plus/package.mk @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-mupen64plus" +PKG_VERSION="b21e3292e6ff7afb954d4871362ab6e6473d680f" +PKG_SHA256="2bc4424ac80ee03d248d261908a857dc1e0ae919704830e1629cd111a9acc91e" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/mupen64plus-libretro" +PKG_URL="https://github.com/libretro/mupen64plus-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.mupen64plus: Mupen64Plus for Kodi" + +PKG_LIBNAME="mupen64plus_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="MUPEN64PLUS_LIB" + +make_target() { + + if target_has_feature neon; then + export HAVE_NEON=1 + fi + + if [ -z "$DEVICE" ]; then + PKG_DEVICE_NAME=$PROJECT + else + PKG_DEVICE_NAME=$DEVICE + fi + + case $PKG_DEVICE_NAME in + RPi|RPi2) + make platform=${PKG_DEVICE_NAME,,} + ;; + Generic) + make WITH_DYNAREC=x86_64 + ;; + *) + if [[ "$TARGET_CPU" = "cortex-a9" ]] || [[ "$TARGET_CPU" = *"cortex-a53" ]] || [[ "$TARGET_CPU" = "cortex-a17" ]]; then + if [ "$TARGET_ARCH" = "aarch64" ]; then + make platform=aarch64 + else + make platform=linux-gles FORCE_GLES=1 WITH_DYNAREC=arm + fi + fi + ;; + esac +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-mupen64plus/patches/libretro-mupen64plus-0003-revert-47e12a3.patch b/packages/emulation/libretro-mupen64plus/patches/libretro-mupen64plus-0003-revert-47e12a3.patch new file mode 100644 index 0000000000..f0550571ad --- /dev/null +++ b/packages/emulation/libretro-mupen64plus/patches/libretro-mupen64plus-0003-revert-47e12a3.patch @@ -0,0 +1,104 @@ +diff -Naur a/libretro-common/libco/amd64.c b/libretro-common/libco/amd64.c +--- a/libretro-common/libco/amd64.c 2016-05-08 08:20:29.000000000 -0700 ++++ b/libretro-common/libco/amd64.c 2016-05-10 14:58:50.221637488 -0700 +@@ -5,7 +5,7 @@ + */ + + #define LIBCO_C +-#include ++#include "libco.h" + #include + #include + +@@ -21,6 +21,8 @@ + static thread_local cothread_t co_active_handle = 0; + #ifndef CO_USE_INLINE_ASM + static void (*co_swap)(cothread_t, cothread_t) = 0; ++#else ++void co_swap(cothread_t, cothread_t); + #endif + + #ifdef _WIN32 +@@ -81,7 +83,7 @@ + sizeof(co_swap_function), PAGE_EXECUTE_READWRITE, &old_privileges); + } + #else +-/* ABI: SystemV */ ++//ABI: SystemV + #ifndef CO_USE_INLINE_ASM + static unsigned char co_swap_function[] = { + 0x48, 0x89, 0x26, /* mov [rsi],rsp */ +@@ -113,7 +115,29 @@ + mprotect((void*)base, size, PROT_READ | PROT_WRITE | PROT_EXEC); + } + #else +-void co_init(void) {} ++__asm__( ++".intel_syntax noprefix\n" ++".globl co_swap \n" ++"co_swap: \n" ++".globl _co_swap \n" /* OSX ABI is different from Linux. */ ++"_co_swap: \n" ++"mov [rsi],rsp \n" ++"mov [rsi+0x08],rbp \n" ++"mov [rsi+0x10],rbx \n" ++"mov [rsi+0x18],r12 \n" ++"mov [rsi+0x20],r13 \n" ++"mov [rsi+0x28],r14 \n" ++"mov [rsi+0x30],r15 \n" ++"mov rsp,[rdi] \n" ++"mov rbp,[rdi+0x08] \n" ++"mov rbx,[rdi+0x10] \n" ++"mov r12,[rdi+0x18] \n" ++"mov r13,[rdi+0x20] \n" ++"mov r14,[rdi+0x28] \n" ++"mov r15,[rdi+0x30] \n" ++"ret \n" ++".att_syntax \n" ++); + #endif + #endif + +@@ -162,42 +186,11 @@ + free(handle); + } + +-#ifndef CO_USE_INLINE_ASM + void co_switch(cothread_t handle) + { + register cothread_t co_previous_handle = co_active_handle; + co_swap(co_active_handle = handle, co_previous_handle); + } +-#else +-#ifdef __APPLE__ +-#define ASM_PREFIX "_" +-#else +-#define ASM_PREFIX "" +-#endif +-__asm__( +-".intel_syntax noprefix \n" +-".globl " ASM_PREFIX "co_switch \n" +-ASM_PREFIX "co_switch: \n" +-"mov rsi, [rip+" ASM_PREFIX "co_active_handle]\n" +-"mov [rsi],rsp \n" +-"mov [rsi+0x08],rbp \n" +-"mov [rsi+0x10],rbx \n" +-"mov [rsi+0x18],r12 \n" +-"mov [rsi+0x20],r13 \n" +-"mov [rsi+0x28],r14 \n" +-"mov [rsi+0x30],r15 \n" +-"mov [rip+" ASM_PREFIX "co_active_handle], rdi\n" +-"mov rsp,[rdi] \n" +-"mov rbp,[rdi+0x08] \n" +-"mov rbx,[rdi+0x10] \n" +-"mov r12,[rdi+0x18] \n" +-"mov r13,[rdi+0x20] \n" +-"mov r14,[rdi+0x28] \n" +-"mov r15,[rdi+0x30] \n" +-"ret \n" +-".att_syntax \n" +-); +-#endif + + #ifdef __cplusplus + } diff --git a/packages/emulation/libretro-mupen64plus/patches/libretro-mupen64plus-0004-aarch64-support.patch b/packages/emulation/libretro-mupen64plus/patches/libretro-mupen64plus-0004-aarch64-support.patch new file mode 100644 index 0000000000..3ad7299d8f --- /dev/null +++ b/packages/emulation/libretro-mupen64plus/patches/libretro-mupen64plus-0004-aarch64-support.patch @@ -0,0 +1,21 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2016-05-08 08:20:29.000000000 -0700 ++++ b/Makefile 2016-05-10 15:08:05.548597094 -0700 +@@ -304,6 +304,17 @@ + CPUFLAGS += -mfloat-abi=hard + endif + ++# aarch64 ++else ifneq (,$(findstring aarch64,$(platform))) ++ TARGET := $(TARGET_NAME)_libretro.so ++ LDFLAGS += -shared -Wl,--version-script=$(LIBRETRO_DIR)/link.T -Wl,--no-undefined ++ fpic := -fPIC ++# CPUFLAGS += -DNO_ASM -DARM -D__arm__ -DARM_ASM -DNOSSE ++ WITH_DYNAREC=arm64 ++# PLATCFLAGS += -DARM ++ GLES = 1 ++ GL_LIB := -lGLESv2 ++ + # emscripten + else ifeq ($(platform), emscripten) + TARGET := $(TARGET_NAME)_libretro_emscripten.bc diff --git a/packages/emulation/libretro-nestopia/package.mk b/packages/emulation/libretro-nestopia/package.mk new file mode 100644 index 0000000000..c79250d069 --- /dev/null +++ b/packages/emulation/libretro-nestopia/package.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-nestopia" +PKG_VERSION="fbeed047d5ad783e8e73daff8ff4dfa82f913307" +PKG_SHA256="018a0530edefe94f0a1afa58497dcfa8660eab4c0e01b42f4c97c5a14e08bfdd" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/nestopia" +PKG_URL="https://github.com/libretro/nestopia/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.nestopia: Nestopia for Kodi" +PKG_TOOLCHAIN="manual" + +PKG_LIBNAME="nestopia_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="NESTOPIA_LIB" + +post_unpack() { + rm $PKG_BUILD/configure.ac +} + +make_target() { + make -C libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-nx/package.mk b/packages/emulation/libretro-nx/package.mk new file mode 100644 index 0000000000..036a11f7c8 --- /dev/null +++ b/packages/emulation/libretro-nx/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-nx" +PKG_VERSION="f83ccdc9a3c14bdcc5e9c291230a603e4686cfec" +PKG_SHA256="cc53d2b561f0631445b06884905db12e07b4065a775f2f1bbab70fa0eaf5f9df" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/nxengine-libretro" +PKG_URL="https://github.com/libretro/nxengine-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.nx: nx for Kodi" + +PKG_LIBNAME="nxengine_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="NX_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-o2em/package.mk b/packages/emulation/libretro-o2em/package.mk new file mode 100644 index 0000000000..783139b72a --- /dev/null +++ b/packages/emulation/libretro-o2em/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-o2em" +PKG_VERSION="32182d2b2d2a8c2455db3b06b65aa7e01505c020" +PKG_SHA256="ce9c945fe21ec00e155b90993104e255d142c07fd2d52181a0f0b486e0df7efa" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/libretro-o2em" +PKG_URL="https://github.com/libretro/libretro-o2em/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.o2em: o2em for Kodi" + +PKG_LIBNAME="o2em_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="O2EM_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-pcsx-rearmed/package.mk b/packages/emulation/libretro-pcsx-rearmed/package.mk new file mode 100644 index 0000000000..3d94e7fe87 --- /dev/null +++ b/packages/emulation/libretro-pcsx-rearmed/package.mk @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-pcsx-rearmed" +PKG_VERSION="8569f7c3abe705930306d7537cc0f7e53e63bc19" +PKG_SHA256="c6245b92d5ab43e35cd36972175758711ab14f9d06971d9895d1b79fb9db4e53" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/pcsx_rearmed" +PKG_URL="https://github.com/libretro/pcsx_rearmed/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.pcsx-rearmed: PCSX Rearmed for Kodi" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="-gold" + +PKG_LIBNAME="pcsx_rearmed_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="PCSX-REARMED_LIB" + +make_target() { + cd $PKG_BUILD + + if target_has_feature neon; then + export HAVE_NEON=1 + else + export HAVE_NEON=0 + fi + + case $TARGET_ARCH in + aarch64) + make -f Makefile.libretro platform=aarch64 GIT_VERSION=$PKG_VERSION + ;; + arm) + make -f Makefile.libretro USE_DYNAREC=1 GIT_VERSION=$PKG_VERSION + ;; + x86_64) + make -f Makefile.libretro GIT_VERSION=$PKG_VERSION + ;; + esac +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-pcsx-rearmed/patches/libretro-pcsx-rearmed-0001-aarch64-support.patch b/packages/emulation/libretro-pcsx-rearmed/patches/libretro-pcsx-rearmed-0001-aarch64-support.patch new file mode 100644 index 0000000000..b8734f73c6 --- /dev/null +++ b/packages/emulation/libretro-pcsx-rearmed/patches/libretro-pcsx-rearmed-0001-aarch64-support.patch @@ -0,0 +1,18 @@ +diff -Naur a/Makefile.libretro b/Makefile.libretro +--- a/Makefile.libretro 2016-05-05 20:28:57.000000000 -0700 ++++ b/Makefile.libretro 2016-05-10 10:10:33.447118136 -0700 +@@ -246,6 +246,14 @@ + ARCH = arm + USE_DYNAREC = 1 + ++# aarch64 ++else ifneq (,$(findstring aarch64,$(platform))) ++ TARGET := $(TARGET_NAME)_libretro.so ++ SHARED := -shared -Wl,--no-undefined ++ fpic := -fPIC ++ DRC_CACHE_BASE = 0 ++ ARCH = aarch64 ++ + # Windows + else + TARGET := $(TARGET_NAME)_libretro.dll diff --git a/packages/emulation/libretro-picodrive/package.mk b/packages/emulation/libretro-picodrive/package.mk new file mode 100644 index 0000000000..0c938d189f --- /dev/null +++ b/packages/emulation/libretro-picodrive/package.mk @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-picodrive" +PKG_VERSION="03f663dd1a65f11cadbd51bd4389dc82581f2f23" +PKG_SHA256="a6f5bfe5c497de56dcc4b648bbf43471caa96d8ed601ed883e9e7cd4bbd46311" +PKG_LICENSE="MAME" +PKG_SITE="https://github.com/libretro/picodrive" +PKG_URL="https://github.com/libretro/picodrive/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform $PKG_NAME:host" +PKG_DEPENDS_HOST="cyclone68000" +PKG_LONGDESC="Fast MegaDrive/MegaCD/32X emulator" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="-gold" + +PKG_LIBNAME="picodrive_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="PICODRIVE_LIB" + +pre_build_host() { + cp -a $(get_build_dir cyclone68000)/* $PKG_BUILD/cpu/cyclone/ +} + +pre_configure_host() { + # fails to build in subdirs + cd $PKG_BUILD + rm -rf .$HOST_NAME +} + +make_host() { + if [ "$ARCH" == "arm" ]; then + make -C cpu/cyclone CONFIG_FILE=../cyclone_config.h + fi +} + +pre_configure_target() { + # fails to build in subdirs + cd $PKG_BUILD + rm -rf .$TARGET_NAME +} + +post_configure_target() { + sed -e "s|^GIT_VERSION :=.*$|GIT_VERSION := \" ${PKG_VERSION:0:7}\"|" -i Makefile.libretro +} + +make_target() { + R= make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-pokemini/package.mk b/packages/emulation/libretro-pokemini/package.mk new file mode 100644 index 0000000000..a7f893836c --- /dev/null +++ b/packages/emulation/libretro-pokemini/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-pokemini" +PKG_VERSION="e1b02956f9f3289ddc80a431270d50fe23513032" +PKG_SHA256="09f7ad361308da7d1776e20415e296d782b07466df9ea5b080014aceeeab965c" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/pokemini" +PKG_URL="https://github.com/libretro/pokemini/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="libretro wrapper for PokeMini emulator." +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="pokemini_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="POKEMINI_LIB" + +configure_target() { + cd $PKG_BUILD +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-ppsspp/package.mk b/packages/emulation/libretro-ppsspp/package.mk new file mode 100644 index 0000000000..58c42f67ab --- /dev/null +++ b/packages/emulation/libretro-ppsspp/package.mk @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-ppsspp" +PKG_VERSION="caa506bf2a253a99850a4248a1cb5a399f32467a" +PKG_SHA256="d59b4d044b761a73e744ab71e207e5b3bdbac819ed2201b79ed4455606ac0719" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/hrydgard/ppsspp" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain SDL2" +PKG_LONGDESC="A PSP emulator written in C++." +PKG_TOOLCHAIN="cmake-make" + +PKG_LIBNAME="ppsspp_libretro.so" +PKG_LIBPATH="lib/$PKG_LIBNAME" +PKG_LIBVAR="PPSSPP_LIB" + +if [ "$PROJECT" = "Amlogic" ] || [ "$PROJECT" = "RPi" ]; then + case $DEVICE in + KVIM|RPi2|S905|Odroid_C2) + PKG_ARCH_ARM="-DARMV7=ON \ + -DUSING_FBDEV=ON \ + -DUSING_EGL=ON \ + -DUSING_GLES2=ON \ + -DUSING_X11_VULKAN=OFF" + ;; + esac +fi + +PKG_CMAKE_OPTS_TARGET="-DLIBRETRO=ON \ + -DUSE_SYSTEM_FFMPEG=ON \ + $PKG_ARCH_ARM" + +pre_configure_target() { + LDFLAGS="$LDFLAGS -lpthread" +} + +pre_make_target() { + find . -name flags.make -exec sed -i "s:isystem :I:g" \{} \; +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-prboom/package.mk b/packages/emulation/libretro-prboom/package.mk new file mode 100644 index 0000000000..27740dd614 --- /dev/null +++ b/packages/emulation/libretro-prboom/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-prboom" +PKG_VERSION="7b29bb9f5a8cd50c6a22124d423c546b5417a518" +PKG_SHA256="bfecffeab27385ae3a0f4877ea6ce3f33bb5ec90667b95731c71477df88cbf8f" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/libretro-prboom" +PKG_URL="https://github.com/libretro/libretro-prboom/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.prboom: prboom for Kodi" + +PKG_LIBNAME="prboom_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="PRBOOM_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-prosystem/package.mk b/packages/emulation/libretro-prosystem/package.mk new file mode 100644 index 0000000000..373df4a064 --- /dev/null +++ b/packages/emulation/libretro-prosystem/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-prosystem" +PKG_VERSION="d3c4796983d0758c7bb19249b3088f1973332d36" +PKG_SHA256="f53e73da1c79dae16aefa19c9b0aafb45579e2f17f0eb2910d18264227f0d5c5" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/prosystem-libretro" +PKG_URL="https://github.com/libretro/prosystem-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Port of ProSystem to libretro" + +PKG_LIBNAME="prosystem_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="PROSYSTEM_LIB" + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-quicknes/package.mk b/packages/emulation/libretro-quicknes/package.mk new file mode 100644 index 0000000000..13ef5478c5 --- /dev/null +++ b/packages/emulation/libretro-quicknes/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-quicknes" +PKG_VERSION="0e95700c8818ef4b1eec0735383c61a8c9a2addc" +PKG_SHA256="8617e594d4d21efb1b22543e078d71019998d8a5d9cabbb00a5b4b9506d9f44f" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/QuickNES_Core" +PKG_URL="https://github.com/libretro/QuickNES_Core/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.quicknes: QuickNES for Kodi" + +PKG_LIBNAME="quicknes_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="QUICKNES_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-reicast/package.mk b/packages/emulation/libretro-reicast/package.mk new file mode 100644 index 0000000000..fbf161499a --- /dev/null +++ b/packages/emulation/libretro-reicast/package.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-reicast" +PKG_VERSION="9d6f80ee347f99a7a8162032de59834e03b64016" +PKG_SHA256="94b20bb11d17b987a15a06f67cd87ae8957c6c1a71b07c1cbc2bceb045226d4c" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/reicast-emulator" +PKG_URL="https://github.com/libretro/reicast-emulator/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Reicast is a multiplatform Sega Dreamcast emulator" + +PKG_LIBNAME="reicast_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="REICAST_LIB" + +make_target() { + if [ "$DEVICE" = "RPi2" ]; then + make platform=${DEVICE,,} + else + case $TARGET_CPU in + arm1176jzf-s) + make platform=arm FORCE_GLES=1 + ;; + cortex-a7|cortex-a9) + make platform=armv7-neon-hardfloat-$TARGET_CPU FORCE_GLES=1 + ;; + x86-64) + make + ;; + esac + fi +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-sameboy/package.mk b/packages/emulation/libretro-sameboy/package.mk new file mode 100644 index 0000000000..9d005c18dc --- /dev/null +++ b/packages/emulation/libretro-sameboy/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-sameboy" +PKG_VERSION="3cc57ba417d58e863bc315d641da5285c876441b" +PKG_SHA256="7c2b69912a6180ae4039bffabdb3a33fbb4b82d8d386143144fab57a05109229" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/libretro/sameboy" +PKG_URL="https://github.com/libretro/sameboy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="libretro wrapper for SameBoy emulator." + +PKG_LIBNAME="sameboy_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="SAMEBOY_LIB" + +make_target() { + make -C libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-scummvm/package.mk b/packages/emulation/libretro-scummvm/package.mk new file mode 100644 index 0000000000..1ceb8b676a --- /dev/null +++ b/packages/emulation/libretro-scummvm/package.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-scummvm" +PKG_VERSION="373756e3663bc5aee0c96fe582fd749a8a95c4c9" +PKG_SHA256="acba36640e23cf80edd2d61d43cf8295130bff0e9922963a83b6b6a71d6d1408" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/scummvm" +PKG_URL="https://github.com/libretro/scummvm/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.scummvm: scummvm for Kodi" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="scummvm_libretro.so" +PKG_LIBPATH="backends/platform/libretro/build/$PKG_LIBNAME" +PKG_LIBVAR="SCUMMVM_LIB" + +PKG_MAKE_OPTS_TARGET="-C backends/platform/libretro/build/" + +pre_make_target() { + cd $PKG_BUILD + CXXFLAGS+=" -DHAVE_POSIX_MEMALIGN=1" + export AR+=" cru" + export LD="$CC" +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-scummvm/patches/libretro-scummvm-0001-fix-cross-compile.patch b/packages/emulation/libretro-scummvm/patches/libretro-scummvm-0001-fix-cross-compile.patch new file mode 100644 index 0000000000..8005fe5200 --- /dev/null +++ b/packages/emulation/libretro-scummvm/patches/libretro-scummvm-0001-fix-cross-compile.patch @@ -0,0 +1,16 @@ +diff -Naur a/backends/platform/libretro/build/Makefile b/backends/platform/libretro/build/Makefile +--- a/backends/platform/libretro/build/Makefile 2016-05-09 19:28:52.000000000 -0700 ++++ b/backends/platform/libretro/build/Makefile 2016-05-11 11:55:30.434658218 -0700 +@@ -24,9 +24,9 @@ + + TARGET_NAME := scummvm + +-LD = $(CXX) +-AR = ar cru +-RANLIB = ranlib ++LD ?= $(CXX) ++AR ?= ar cru ++RANLIB ?= ranlib + + ifeq ($(platform), unix) + TARGET := $(TARGET_NAME)_libretro.so diff --git a/packages/emulation/libretro-snes9x/package.mk b/packages/emulation/libretro-snes9x/package.mk new file mode 100644 index 0000000000..214a223c09 --- /dev/null +++ b/packages/emulation/libretro-snes9x/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-snes9x" +PKG_VERSION="a425ee94707648db676d91414680ff5482c82bcf" +PKG_SHA256="0a2fe1641ec2bd34d78a6dbd94cc1803cdde949596fde3868c900ede67246181" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/snes9x" +PKG_URL="https://github.com/libretro/snes9x/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.snes9x: snes9x for Kodi" +PKG_TOOLCHAIN="manual" + +PKG_LIBNAME="snes9x_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="SNES9X_LIB" + +make_target() { + make -C libretro/ +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-snes9x2002/package.mk b/packages/emulation/libretro-snes9x2002/package.mk new file mode 100644 index 0000000000..54215094ea --- /dev/null +++ b/packages/emulation/libretro-snes9x2002/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-snes9x2002" +PKG_VERSION="8b456289c6c31e1f36df2843f7a6044757b96dbe" +PKG_SHA256="e1f980eec9feb38efa8a68134ae46bdcb9886b5480ba60a97339e8a50c9f91b3" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/libretro/snes9x2002" +PKG_URL="https://github.com/libretro/snes9x2002/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Port of SNES9x 1.39 for libretro. Heavily optimized for ARM." + +PKG_LIBNAME="snes9x2002_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="SNES9X2002_LIB" + +pre_make_target() { + export CFLAGS="$CFLAGS -std=gnu11" +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-snes9x2010/package.mk b/packages/emulation/libretro-snes9x2010/package.mk new file mode 100644 index 0000000000..0e9d026195 --- /dev/null +++ b/packages/emulation/libretro-snes9x2010/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-snes9x2010" +PKG_VERSION="d0606eb568d1ec13dd2ca8949ae990b86cfb1034" +PKG_SHA256="7e1ab9521ec4a5173a7a3241b7f2fad5703258f1b0ea3dee47d70d50fbdbe541" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/snes9x2010" +PKG_URL="https://github.com/libretro/snes9x2010/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="snes9x2010 for Kodi" + +PKG_LIBNAME="snes9x2010_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="SNES9X2010_LIB" + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-stella/package.mk b/packages/emulation/libretro-stella/package.mk new file mode 100644 index 0000000000..951809d3df --- /dev/null +++ b/packages/emulation/libretro-stella/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-stella" +PKG_VERSION="b0b63615fc2c7a30470fc1ac31ffdc18fdf4518b" +PKG_SHA256="b16263ff91018f9c9b06d4ed1d7c1ec083a7552d1ac0ffcfb0f22e2a2b206c0f" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/stella-libretro" +PKG_URL="https://github.com/libretro/stella-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.stella: Stella for Kodi" + +PKG_LIBNAME="stella_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="STELLA_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-tgbdual/package.mk b/packages/emulation/libretro-tgbdual/package.mk new file mode 100644 index 0000000000..6f56024a2a --- /dev/null +++ b/packages/emulation/libretro-tgbdual/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-tgbdual" +PKG_VERSION="c13b9418664dede869362d965cdc8eeb6382e779" +PKG_SHA256="8ba057ec134bbde12c32765ca27cb6cd51a48657f097a785aa62149690f429e8" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/tgbdual-libretro" +PKG_URL="https://github.com/libretro/tgbdual-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.tgbdual: tgbdual for Kodi" + +PKG_LIBNAME="tgbdual_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="TGBDUAL_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-tyrquake/package.mk b/packages/emulation/libretro-tyrquake/package.mk new file mode 100644 index 0000000000..75b49df0f7 --- /dev/null +++ b/packages/emulation/libretro-tyrquake/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-tyrquake" +PKG_VERSION="9ab2b7adcc46322755a757a34da20cd494c01e3a" +PKG_SHA256="7128ee5d9f946ec85281e8131aa0e267009f4ce6f4a778208cb8963d2713a4a4" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/tyrquake" +PKG_URL="https://github.com/libretro/tyrquake/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.tyrquake: tyrquake for Kodi" + +PKG_LIBNAME="tyrquake_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="TYRQUAKE_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-uae/package.mk b/packages/emulation/libretro-uae/package.mk new file mode 100644 index 0000000000..c3b7fcbe0a --- /dev/null +++ b/packages/emulation/libretro-uae/package.mk @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-uae" +PKG_VERSION="a739e451e37f3227bc37380049508250af6adcd3" +PKG_SHA256="0f5a661ac5d7dc4f174f1c944d01bb68f001d71fd47ea1b7862cd497a2a24c3c" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/libretro/libretro-uae" +PKG_URL="https://github.com/libretro/libretro-uae/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="libretro wrapper for UAE emulator." +PKG_BUILD_FLAGS="-lto" + +PKG_LIBNAME="puae_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="UAE_LIB" + +pre_configure_target() { + if [ "$TARGET_ARCH" = "arm" ]; then + CFLAGS="$CFLAGS -DARM -marm" + fi +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-uae4arm/package.mk b/packages/emulation/libretro-uae4arm/package.mk new file mode 100644 index 0000000000..1e8e4b5583 --- /dev/null +++ b/packages/emulation/libretro-uae4arm/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-uae4arm" +PKG_VERSION="0e9dd6e2e8c1d08df0532a429afc8fa9f5e9ca3a" +PKG_SHA256="ccc989c75c11cbc1be96b917cadc3551b5fb8710f2a203f2ce86c46196229a4a" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/libretro/uae4arm-libretro" +PKG_URL="https://github.com/libretro/uae4arm-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="UAE4ARM amiga emulator." + +PKG_LIBNAME="uae4arm_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="UAE4ARM_LIB" + +pre_configure_target() { + if target_has_feature neon; then + CFLAGS="$CFLAGS -D__NEON_OPT" + fi +} + +make_target() { + if target_has_feature neon; then + PKG_HAVE_NEON=1 + else + PKG_HAVE_NEON=0 + fi + + make HAVE_NEON=$PKG_HAVE_NEON USE_PICASSO96=1 +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-vba-next/package.mk b/packages/emulation/libretro-vba-next/package.mk new file mode 100644 index 0000000000..157ca51f78 --- /dev/null +++ b/packages/emulation/libretro-vba-next/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-vba-next" +PKG_VERSION="e40f1d56268416b7d75578b3df2cc6f139a3f097" +PKG_SHA256="c7c97f6fcbb2a1566cf01efcfb1aa7f8e75dbc73c309179a03a4c71f69596907" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/vba-next" +PKG_URL="https://github.com/libretro/vba-next/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.vba-next: VBA-Next for Kodi" + +PKG_LIBNAME="vba_next_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="VBA-NEXT_LIB" + +make_target() { + make -f Makefile.libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-vbam/package.mk b/packages/emulation/libretro-vbam/package.mk new file mode 100644 index 0000000000..b1ef491d2c --- /dev/null +++ b/packages/emulation/libretro-vbam/package.mk @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-vbam" +PKG_VERSION="2a796d48a027adc64cc80792cd5e684f19b847e9" +PKG_SHA256="8527f5f46e8e86a88bbecb809d28b2fd3d9e6c28e13d20088e86b25fd880148d" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/vbam-libretro" +PKG_URL="https://github.com/libretro/vbam-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.vbam: VBA-M for Kodi" +PKG_TOOLCHAIN="make" + +PKG_LIBNAME="vbam_libretro.so" +PKG_LIBPATH="src/libretro/$PKG_LIBNAME" +PKG_LIBVAR="VBAM_LIB" + +pre_configure_target() { + # fails to build in subdirs + cd $PKG_BUILD + rm -rf .$TARGET_NAME +} + +make_target() { + make -C src/libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-vecx/package.mk b/packages/emulation/libretro-vecx/package.mk new file mode 100644 index 0000000000..20f0ac5c5d --- /dev/null +++ b/packages/emulation/libretro-vecx/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-vecx" +PKG_VERSION="42366f88249a7fb52b823f53cdc4730f6778afc5" +PKG_SHA256="879d2844cacfa8579349aa908fde2bd4c0c10b2016c8c1f6dc507d185d18f7f3" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/libretro-vecx" +PKG_URL="https://github.com/libretro/libretro-vecx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.vecx: vecx for Kodi" + +PKG_LIBNAME="vecx_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="VECX_LIB" + +make_target() { + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-vice/package.mk b/packages/emulation/libretro-vice/package.mk new file mode 100644 index 0000000000..db457d1ccc --- /dev/null +++ b/packages/emulation/libretro-vice/package.mk @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-vice" +PKG_VERSION="ce4524df3c4e93e25dd97a6586c24c5e40d30c60" +PKG_SHA256="04e2081f08cb68e0d107e8f7a0e689dd103187c2062374754d2da138393706dc" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/vice-libretro" +PKG_URL="https://github.com/libretro/vice-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="VICE C64 libretro" + +PKG_LIBNAME="vice_x64_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="VICE_LIB" + +pre_build_target() { + export GIT_VERSION=$PKG_VERSION +} + +make_target() { + make -f Makefile.libretro CC=$CC +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-virtualjaguar/package.mk b/packages/emulation/libretro-virtualjaguar/package.mk new file mode 100644 index 0000000000..caff9d6ee0 --- /dev/null +++ b/packages/emulation/libretro-virtualjaguar/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-virtualjaguar" +PKG_VERSION="c4812ceead33452741968b2b96dd43ff1bdee10e" +PKG_SHA256="7d97d1e1fca46459ad6663fcfb8552018aecc73b5b5260655d929f660abd9f22" +PKG_LICENSE="GPLv3" +PKG_SITE="https://github.com/libretro/virtualjaguar-libretro" +PKG_URL="https://github.com/libretro/virtualjaguar-libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="Port of Virtual Jaguar to Libretro" + +PKG_LIBNAME="virtualjaguar_libretro.so" +PKG_LIBPATH="$PKG_LIBNAME" +PKG_LIBVAR="VIRTUALJAGUAR_LIB" + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-vram-test/package.mk b/packages/emulation/libretro-vram-test/package.mk new file mode 100644 index 0000000000..e4e28d5391 --- /dev/null +++ b/packages/emulation/libretro-vram-test/package.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-vram-test" +PKG_VERSION="6b90ce9" +PKG_SHA256="2bd1b3af783a028355eb4b4c416f09802313a9a69759e716377b55012f7bb4ae" +PKG_LICENSE="MIT" +PKG_SITE="https://github.com/libretro/libretro-samples" +PKG_URL="https://github.com/libretro/libretro-samples/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="VRAM Test from libretro" +PKG_TOOLCHAIN="manual" + +PKG_LIBNAME="testsw_vram_libretro.so" +PKG_LIBVAR="VRAM-TEST_LIB" + +configure_package() { + PKG_LIBPATH="$PKG_BUILD/video/software/rendering_direct_to_vram/$PKG_LIBNAME" +} + +make_target() { + cd $PKG_BUILD/video/software/rendering_direct_to_vram + make +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/emulation/libretro-yabause/package.mk b/packages/emulation/libretro-yabause/package.mk new file mode 100644 index 0000000000..92d7a68068 --- /dev/null +++ b/packages/emulation/libretro-yabause/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libretro-yabause" +PKG_VERSION="aa15301b1d1b49d035d0672a1ccaa5631211b29b" +PKG_SHA256="268e356c6c3f30a88f8cd3394a48d863d3166cbc060fe7e7eb02be4a93a38f7c" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/yabause" +PKG_URL="https://github.com/libretro/yabause/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_LONGDESC="game.libretro.yabause: Yabause for Kodi" +PKG_TOOLCHAIN="manual" + +PKG_LIBNAME="yabause_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="YABAUSE_LIB" + +make_target() { + make -C libretro +} + +makeinstall_target() { + mkdir -p $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME + cp $PKG_LIBPATH $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $SYSROOT_PREFIX/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/lib/cmake/$PKG_NAME/$PKG_NAME-config.cmake +} diff --git a/packages/graphics/bcm2835-driver/package.mk b/packages/graphics/bcm2835-driver/package.mk index 7c4c4a4eda..55d6d2e4cd 100644 --- a/packages/graphics/bcm2835-driver/package.mk +++ b/packages/graphics/bcm2835-driver/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bcm2835-driver" -PKG_VERSION="6df93de" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="d095b96ac33de9eb4b95539cb3261f35a3c74509" +PKG_SHA256="f3d40adebe3dd0cb9a85e4c8b6dec864aedfaa9661e134f447655b2a33097c8c" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain dtc" -PKG_SECTION="graphics" -PKG_SHORTDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" PKG_LONGDESC="OpenMAX-bcm2835: OpenGL-ES and OpenMAX driver for BCM2835" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" if [ "$TARGET_FLOAT" = "softfp" -o "$TARGET_FLOAT" = "soft" ]; then FLOAT="softfp" @@ -46,16 +27,16 @@ make_target() { ln -sf $SYSROOT_PREFIX/usr/lib/libbrcmEGL.so $SYSROOT_PREFIX/usr/lib/libEGL.so ln -sf $SYSROOT_PREFIX/usr/lib/libbrcmGLESv2.so $SYSROOT_PREFIX/usr/lib/libGLESv2.so cp -PRv $FLOAT/opt/vc/lib/*.a $SYSROOT_PREFIX/usr/lib + cp -PRv $FLOAT/opt/vc/lib/pkgconfig $SYSROOT_PREFIX/usr/lib } makeinstall_target() { - mkdir -p $INSTALL/usr/sbin - cp -PRv $FLOAT/opt/vc/sbin/vcfiled $INSTALL/usr/sbin - mkdir -p $INSTALL/usr/lib cp -PRv $FLOAT/opt/vc/lib/*.so $INSTALL/usr/lib ln -sf /usr/lib/libbrcmEGL.so $INSTALL/usr/lib/libEGL.so + ln -sf /usr/lib/libbrcmEGL.so $INSTALL/usr/lib/libEGL.so.1 ln -sf /usr/lib/libbrcmGLESv2.so $INSTALL/usr/lib/libGLESv2.so + ln -sf /usr/lib/libbrcmGLESv2.so $INSTALL/usr/lib/libGLESv2.so.2 # some usefull debug tools mkdir -p $INSTALL/usr/bin diff --git a/packages/graphics/cairo/package.mk b/packages/graphics/cairo/package.mk index 1101a01b42..92b2742bd1 100644 --- a/packages/graphics/cairo/package.mk +++ b/packages/graphics/cairo/package.mk @@ -1,38 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="cairo" -PKG_VERSION="1.14.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.14.10" +PKG_SHA256="7e87878658f2c9951a14fc64114d4958c0e65ac47530b8ac3078b2ce41b66a09" PKG_LICENSE="LGPL" PKG_SITE="http://cairographics.org/" PKG_URL="http://cairographics.org/releases/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain zlib freetype fontconfig libpng pixman" -PKG_SECTION="graphics" -PKG_SHORTDESC="cairo: Multi-platform 2D graphics library" -PKG_LONGDESC="Cairo is a vector graphics library with cross-device output support. Currently supported output targets include the X Window System and in-memory image buffers. PostScript and PDF file output is planned. Cairo is designed to produce identical output on all output media while taking advantage of display hardware acceleration when available." -PKG_IS_ADDON="no" +PKG_DEPENDS_TARGET="toolchain zlib freetype fontconfig glib libpng pixman" +PKG_LONGDESC="Cairo is a vector graphics library with cross-device output support." +PKG_TOOLCHAIN="configure" # ToDo -PKG_AUTORECONF="no" # ToDo +if [ "$OPENGL" != "no" ]; then + PKG_DEPENDS_TARGET+=" $OPENGL" +fi + +if [ "$OPENGLES" != "no" ]; then + PKG_DEPENDS_TARGET+=" $OPENGLES" +fi if [ "$DISPLAYSERVER" = "x11" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libXrender libX11 mesa glu" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libXrender libX11 mesa" PKG_CAIRO_CONFIG="--x-includes="$SYSROOT_PREFIX/usr/include" \ --x-libraries="$SYSROOT_PREFIX/usr/lib" \ --enable-xlib \ @@ -43,7 +31,6 @@ if [ "$DISPLAYSERVER" = "x11" ]; then --disable-egl \ --with-x" - elif [ "$DISPLAYSERVER" = "weston" ]; then PKG_CAIRO_CONFIG="--disable-xlib \ --disable-xlib-xrender \ @@ -52,6 +39,14 @@ elif [ "$DISPLAYSERVER" = "weston" ]; then --enable-glesv2 \ --enable-egl \ --without-x" +else + PKG_CAIRO_CONFIG="--disable-xlib \ + --disable-xlib-xrender \ + --disable-gl \ + --disable-glx \ + --disable-glesv2 \ + --disable-egl \ + --without-x" fi PKG_CONFIGURE_OPTS_TARGET="$PKG_CAIRO_CONFIG \ @@ -77,9 +72,7 @@ PKG_CONFIGURE_OPTS_TARGET="$PKG_CAIRO_CONFIG \ --disable-beos \ --disable-cogl \ --disable-drm \ - --disable-drm-xr \ --disable-gallium \ - --disable-xcb-drm \ --enable-png \ --disable-directfb \ --disable-vg \ @@ -94,7 +87,7 @@ PKG_CONFIGURE_OPTS_TARGET="$PKG_CAIRO_CONFIG \ --disable-tee \ --disable-xml \ --enable-pthread \ - --disable-gobject \ + --enable-gobject=yes \ --disable-full-testing \ --disable-trace \ --enable-interpreter \ diff --git a/packages/graphics/ftgl/package.mk b/packages/graphics/ftgl/package.mk index fd912c649c..9e89044afb 100644 --- a/packages/graphics/ftgl/package.mk +++ b/packages/graphics/ftgl/package.mk @@ -1,34 +1,13 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="ftgl" PKG_VERSION="2.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="0f61d978c28cd5d78daded591f5b03f71248c0a51c7965733e8729c874265f50" PKG_LICENSE="GPL" PKG_SITE="http://sourceforge.net/projects/ftgl/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain freetype" -PKG_SECTION="multimedia" -PKG_SHORTDESC="ftgl:" -PKG_LONGDESC="ftgl:" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="a free cross-platform Open Source C++ library that uses Freetype2 to simplify rendering fonts in OpenGL applications" PKG_CMAKE_OPTS_TARGET="-DOUTPUT_DIR=$SYSROOT_PREFIX/usr" diff --git a/packages/graphics/giflib/package.mk b/packages/graphics/giflib/package.mk index f0d8c69622..7da0497bb4 100644 --- a/packages/graphics/giflib/package.mk +++ b/packages/graphics/giflib/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="giflib" PKG_VERSION="5.1.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="df27ec3ff24671f80b29e6ab1c4971059c14ac3db95406884fc26574631ba8d5" PKG_LICENSE="OSS" PKG_SITE="http://giflib.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/giflib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="zlib:host" PKG_DEPENDS_TARGET="toolchain zlib" -PKG_SECTION="graphics" -PKG_SHORTDESC="giflib: giflib service library" PKG_LONGDESC="giflib: giflib service library" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_HOST="--disable-shared --enable-static" PKG_CONFIGURE_OPTS_TARGET="--with-sysroot=$SYSROOT_PREFIX" diff --git a/packages/graphics/giflib/patches/giflib-01-fix-reallocarray-exception.patch b/packages/graphics/giflib/patches/giflib-01-fix-reallocarray-exception.patch new file mode 100644 index 0000000000..f2158c66cf --- /dev/null +++ b/packages/graphics/giflib/patches/giflib-01-fix-reallocarray-exception.patch @@ -0,0 +1,34 @@ +--- a/lib/dgif_lib.c ++++ b/lib/dgif_lib.c +@@ -23,6 +23,8 @@ + #include "gif_lib.h" + #include "gif_lib_private.h" + ++extern void *reallocarray(void *optr, size_t nmemb, size_t size); ++ + /* compose unsigned little endian value */ + #define UNSIGNED_LITTLE_ENDIAN(lo, hi) ((lo) | ((hi) << 8)) + +--- a/lib/gif_lib.h ++++ b/lib/gif_lib.h +@@ -244,9 +244,6 @@ + GifPixelType ColorTransIn2[]); + extern int GifBitSize(int n); + +-extern void * +-reallocarray(void *optr, size_t nmemb, size_t size); +- + /****************************************************************************** + Support for the in-core structures allocation (slurp mode). + ******************************************************************************/ +--- a/lib/gifalloc.c ++++ b/lib/gifalloc.c +@@ -10,6 +10,8 @@ + + #include "gif_lib.h" + ++extern void *reallocarray(void *optr, size_t nmemb, size_t size); ++ + #define MAX(x, y) (((x) > (y)) ? (x) : (y)) + + /****************************************************************************** diff --git a/packages/graphics/glew/package.mk b/packages/graphics/glew/package.mk index cfc49ccc72..7d3c3593fc 100644 --- a/packages/graphics/glew/package.mk +++ b/packages/graphics/glew/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="glew" PKG_VERSION="1.13.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="aa25dc48ed84b0b64b8d41cdd42c8f40f149c37fa2ffa39cd97f42c78d128bc7" PKG_LICENSE="BSD" PKG_SITE="http://glew.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/glew/glew/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tgz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="glew: The OpenGL Extension Wrangler Library" -PKG_LONGDESC="The OpenGL Extension Wrangler Library (GLEW) is a cross-platform C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. OpenGL core and extension functionality is exposed in a single header file." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A cross-platform C/C++ extension loading library." make_target() { make CC="$CC" LD="$CC" AR="$AR" \ diff --git a/packages/graphics/glfw/package.mk b/packages/graphics/glfw/package.mk index ab46de583f..10bcc3440c 100644 --- a/packages/graphics/glfw/package.mk +++ b/packages/graphics/glfw/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="glfw" PKG_VERSION="2.7.9" -PKG_REV="1" +PKG_SHA256="b7276dcadc85a07077834d1043f11ffd6a3a379647bb94361b4abc3ffca75e7d" PKG_ARCH="x86_64" PKG_LICENSE="BSD" PKG_SITE="http://glfw.org" PKG_URL="$SOURCEFORGE_SRC/glfw/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain mesa glu" -PKG_SECTION="graphics" -PKG_SHORTDESC="glfw:" -PKG_LONGDESC="glfw:" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="provides a simple API for creating windows, contexts and surfaces, receiving input and events" if [ "$OPENGL" = "no" ] ; then exit 0 diff --git a/packages/graphics/glm/package.mk b/packages/graphics/glm/package.mk new file mode 100644 index 0000000000..b0ec23feb2 --- /dev/null +++ b/packages/graphics/glm/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="glm" +PKG_VERSION="0.9.9.2" +PKG_SHA256="209b5943d393925e1a6ecb6734e7507b8f6add25e72a605b25d0d0d382e64fd4" +PKG_LICENSE="MIT" +PKG_SITE="https://glm.g-truc.net/" +PKG_URL="https://github.com/g-truc/glm/releases/download/$PKG_VERSION/glm-$PKG_VERSION.zip" +PKG_SOURCE_DIR="glm" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="OpenGL Mathematics (GLM)" + +if [ "$OPENGL" = "no" ] ; then + exit 0 +fi diff --git a/packages/graphics/glu/package.mk b/packages/graphics/glu/package.mk index 60014a31e0..05580f4bb8 100644 --- a/packages/graphics/glu/package.mk +++ b/packages/graphics/glu/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="glu" PKG_VERSION="9.0.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="3d19cca9b26ec4048dd22e3d294acd43e080a3205a29ff47765bd514571ea8f9" PKG_LICENSE="OSS" PKG_SITE="http://cgit.freedesktop.org/mesa/glu/" PKG_URL="http://cgit.freedesktop.org/mesa/glu/snapshot/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="glu: The OpenGL utility library" +PKG_DEPENDS_TARGET="toolchain mesa" PKG_LONGDESC="libglu is the The OpenGL utility library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --disable-debug \ diff --git a/packages/graphics/gpu-viv-bin-mx6q/package.mk b/packages/graphics/gpu-viv-bin-mx6q/package.mk index 8400b0f9f1..a47d433380 100644 --- a/packages/graphics/gpu-viv-bin-mx6q/package.mk +++ b/packages/graphics/gpu-viv-bin-mx6q/package.mk @@ -1,34 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="gpu-viv-bin-mx6q" PKG_VERSION="3.10.17-1.0.2-hfp" -PKG_REV="1" +PKG_SHA256="fcf5cc1c2507d77b6ecaef6defd63fbd604be5a765f86922530cb423a595a592" PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.freescale.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain gpu-viv-g2d" -PKG_SECTION="graphics" -PKG_SHORTDESC="gpu-viv-bin-mx6q: OpenGL-ES and VIVANTE driver for imx6q" PKG_LONGDESC="gpu-viv-bin-mx6q: OpenGL-ES and VIVANTE driver for imx6q" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" make_target() { : # nothing to make diff --git a/packages/graphics/gpu-viv-bin-mx6q/system.d/unbind-console.service b/packages/graphics/gpu-viv-bin-mx6q/system.d/unbind-console.service deleted file mode 100644 index af5e5d44c4..0000000000 --- a/packages/graphics/gpu-viv-bin-mx6q/system.d/unbind-console.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=unbind Framebuffer console - -ConditionPathExists=/sys/class/vtconsole/vtcon1/bind - -[Service] -Type=oneshot -ExecStart=/bin/sh -c 'echo 0 > /sys/class/vtconsole/vtcon1/bind' - -[Install] -WantedBy=graphical.target diff --git a/packages/graphics/gpu-viv-g2d/package.mk b/packages/graphics/gpu-viv-g2d/package.mk deleted file mode 100644 index 8ce2b1c9a9..0000000000 --- a/packages/graphics/gpu-viv-g2d/package.mk +++ /dev/null @@ -1,44 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="gpu-viv-g2d" -PKG_VERSION="3.10.17-1.0.2" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="nonfree" -PKG_SITE="http://www.freescale.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="gpu-viv-g2d: Another vivante Binary for performant resizing" -PKG_LONGDESC="gpu-viv-g2d: Another vivante Binary for performant resizing" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to make all binary -} - -makeinstall_target() { - mkdir -p $SYSROOT_PREFIX/usr - cp -PRv usr/* $SYSROOT_PREFIX/usr - - mkdir -p $INSTALL/usr/lib - cp -PRv usr/lib/* $INSTALL/usr/lib -} diff --git a/packages/graphics/imx-gpu-viv/package.mk b/packages/graphics/imx-gpu-viv/package.mk index d149e873c9..4284b6a6bb 100644 --- a/packages/graphics/imx-gpu-viv/package.mk +++ b/packages/graphics/imx-gpu-viv/package.mk @@ -1,38 +1,23 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="imx-gpu-viv" -PKG_VERSION="5.0.11.p4.5-hfp" -PKG_REV="1" +if [ "$LINUX" = "imx6-3.14-sr" ]; then + PKG_VERSION="5.0.11.p4.5-hfp" + PKG_SHA256="2dfcacd17f8009b1a235a2df2b398f22afccb6f671953e442c04cd74234312f0" +elif [ "$LINUX" = "imx6-4.4-xbian" ]; then + PKG_VERSION="5.0.11.p7.4-hfp" + PKG_SHA256="252b2a8badbc74ca91916490782225affba3908813374baaa7d6267f1de9dae6" +else + exit 0 +fi PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.freescale.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="imx-gpu-viv: OpenGL-ES and VIVANTE driver for imx6q" PKG_LONGDESC="imx-gpu-viv: OpenGL-ES and VIVANTE driver for imx6q" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to make -} +PKG_TOOLCHAIN="manual" makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include @@ -50,14 +35,19 @@ makeinstall_target() { gpu-core/usr/lib/libGLSLC.so* \ gpu-core/usr/lib/libGAL-fb.so \ gpu-core/usr/lib/libGAL.so* \ - gpu-core/usr/lib/libGAL_egl.fb.so \ - gpu-core/usr/lib/libGAL_egl.so* \ gpu-core/usr/lib/libVIVANTE-fb.so \ gpu-core/usr/lib/libVIVANTE.so* \ gpu-core/usr/lib/libOpenCL.so \ gpu-core/usr/lib/libVSC.so \ g2d/usr/lib/libg2d*.so*" + # missing in 5.0.11.p7.4-hfp + if [ "$PKG_VERSION" = "5.0.11.p4.5-hfp" ]; then + LIBS_COPY="$LIBS_COPY \ + gpu-core/usr/lib/libGAL_egl.fb.so \ + gpu-core/usr/lib/libGAL_egl.so*" + fi + mkdir -p $SYSROOT_PREFIX/usr/lib cp -PRv $LIBS_COPY $SYSROOT_PREFIX/usr/lib diff --git a/packages/graphics/imx-gpu-viv/system.d/unbind-console.service b/packages/graphics/imx-gpu-viv/system.d/unbind-console.service deleted file mode 100644 index af5e5d44c4..0000000000 --- a/packages/graphics/imx-gpu-viv/system.d/unbind-console.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=unbind Framebuffer console - -ConditionPathExists=/sys/class/vtconsole/vtcon1/bind - -[Service] -Type=oneshot -ExecStart=/bin/sh -c 'echo 0 > /sys/class/vtconsole/vtcon1/bind' - -[Install] -WantedBy=graphical.target diff --git a/packages/graphics/kmscube/package.mk b/packages/graphics/kmscube/package.mk new file mode 100644 index 0000000000..4dbb5c05d9 --- /dev/null +++ b/packages/graphics/kmscube/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="kmscube" +PKG_VERSION="98f31bf" +PKG_SHA256="78b52b9e606f0d3444e10ea2ed7c0c03a87f1ad2ef99e35036551395faade041" +PKG_LICENSE="GPL" +PKG_SITE="https://cgit.freedesktop.org/mesa/kmscube" +PKG_URL="https://cgit.freedesktop.org/mesa/kmscube/snapshot/$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Example KMS/GBM/EGL application" +PKG_TOOLCHAIN="autotools" + +if [ "$OPENGLES_SUPPORT" = "yes" ]; then + PKG_DEPENDS_TARGET+=" $OPENGLES" +elif [ "$OPENGL_SUPPORT" = "yes" ]; then + echo "kmscube only supports OpenGLESv2" + exit 0 +fi diff --git a/packages/graphics/libdrm/package.mk b/packages/graphics/libdrm/package.mk index db29a1aa58..0978b6ec3a 100644 --- a/packages/graphics/libdrm/package.mk +++ b/packages/graphics/libdrm/package.mk @@ -1,62 +1,56 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libdrm" -PKG_VERSION="2.4.74" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.4.96" +PKG_SHA256="0d561acf7bb4cc59dc82415100e6c1a44860e8c380e00f9592923e3cd08db393" PKG_LICENSE="GPL" PKG_SITE="http://dri.freedesktop.org" PKG_URL="http://dri.freedesktop.org/libdrm/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libpthread-stubs libpciaccess" -PKG_SECTION="graphics" -PKG_SHORTDESC="libdrm: Userspace interface to kernel DRM services" +PKG_DEPENDS_TARGET="toolchain libpciaccess" PKG_LONGDESC="The userspace interface library to kernel DRM services." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="meson" get_graphicdrivers -DRM_CONFIG="--disable-libkms --disable-intel --disable-radeon --disable-amdgpu" -DRM_CONFIG="$DRM_CONFIG --disable-nouveau --disable-vmwgfx" - -for drv in $GRAPHIC_DRIVERS; do - [ "$drv" = "i915" -o "$drv" = "i965" ] && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-libkms/enable-libkms/'` && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-intel/enable-intel/'` - - [ "$drv" = "r200" -o "$drv" = "r300" -o "$drv" = "r600" -o "$drv" = "radeonsi" ] && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-libkms/enable-libkms/'` && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-radeon/enable-radeon/'` && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-amdgpu/enable-amdgpu/'` - - [ "$drv" = "vmware" ] && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-libkms/enable-libkms/'` && \ - DRM_CONFIG=`echo $DRM_CONFIG | sed -e 's/disable-vmwgfx/enable-vmwgfx/'` -done - -PKG_CONFIGURE_OPTS_TARGET="--disable-udev \ - --enable-largefile \ - --with-kernel-source=$(kernel_path) \ - $DRM_CONFIG \ - --disable-install-test-programs \ - --disable-cairo-tests \ - --disable-manpages \ - --disable-valgrind" +PKG_DRM_CONFIG="-Dnouveau=false \ + -Domap=false \ + -Dexynos=false \ + -Dtegra=false" + +listcontains "$GRAPHIC_DRIVERS" "(i915|i965)" && + PKG_DRM_CONFIG+=" -Dintel=true" || PKG_DRM_CONFIG+=" -Dintel=false" + +listcontains "$GRAPHIC_DRIVERS" "(r200|r300|r600|radeonsi)" && + PKG_DRM_CONFIG+=" -Dradeon=true" || PKG_DRM_CONFIG+=" -Dradeon=false" + +listcontains "$GRAPHIC_DRIVERS" "radeonsi" && + PKG_DRM_CONFIG+=" -Damdgpu=true" || PKG_DRM_CONFIG+=" -Damdgpu=false" + +listcontains "$GRAPHIC_DRIVERS" "vmware" && + PKG_DRM_CONFIG+=" -Dvmwgfx=true" || PKG_DRM_CONFIG+=" -Dvmwgfx=false" + +listcontains "$GRAPHIC_DRIVERS" "vc4" && + PKG_DRM_CONFIG+=" -Dvc4=true" || PKG_DRM_CONFIG+=" -Dvc4=false" + +listcontains "$GRAPHIC_DRIVERS" "freedreno" && + PKG_DRM_CONFIG+=" -Dfreedreno=true" || PKG_DRM_CONFIG+=" -Dfreedreno=false" + +listcontains "$GRAPHIC_DRIVERS" "etnaviv" && + PKG_DRM_CONFIG+=" -Detnaviv=true" || PKG_DRM_CONFIG+=" -Detnaviv=false" + +PKG_MESON_OPTS_TARGET="-Dlibkms=false \ + $PKG_DRM_CONFIG \ + -Dcairo-tests=false \ + -Dman-pages=false \ + -Dvalgrind=false \ + -Dfreedreno-kgsl=false \ + -Dinstall-test-programs=false \ + -Dudev=false" + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -a $PKG_BUILD/.$TARGET_NAME/tests/modetest/modetest $INSTALL/usr/bin/ +} diff --git a/packages/graphics/libepoxy/package.mk b/packages/graphics/libepoxy/package.mk index 95e0594fbe..a8f0036a1c 100644 --- a/packages/graphics/libepoxy/package.mk +++ b/packages/graphics/libepoxy/package.mk @@ -1,38 +1,30 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) # libepoxy (actually) needs to be built shared, to avoid -# (EE) Failed to load /usr/lib/xorg/modules/libglamoregl.so: +# (EE) Failed to load /usr/lib/xorg/modules/libglamoregl.so: # /usr/lib/xorg/modules/libglamoregl.so: undefined symbol: epoxy_eglCreateImageKHR # in Xorg.log PKG_NAME="libepoxy" -PKG_VERSION="1.3.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.5.2" +PKG_SHA256="a9562386519eb3fd7f03209f279f697a8cba520d3c155d6e253c3e138beca7d8" PKG_LICENSE="GPL" PKG_SITE="https://github.com/anholt/libepoxy" -PKG_URL="https://github.com/anholt/libepoxy/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain $OPENGL" -PKG_SECTION="graphics" -PKG_SHORTDESC="libepoxy: a library for handling OpenGL function pointer management for you." +PKG_URL="https://github.com/anholt/libepoxy/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" PKG_LONGDESC="Epoxy is a library for handling OpenGL function pointer management for you." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +if [ "$OPENGL" != "no" ]; then + PKG_DEPENDS_TARGET+=" $OPENGL" +fi +if [ "$OPENGLES" != "no" ]; then + PKG_DEPENDS_TARGET+=" $OPENGLES" +fi + +if [ "$DISPLAYSERVER" != "x11" ]; then + PKG_CONFIGURE_OPTS_TARGET="--disable-glx" +fi diff --git a/packages/graphics/libjpeg-turbo/package.mk b/packages/graphics/libjpeg-turbo/package.mk index ebe0135fd0..0d7c6eaa5d 100644 --- a/packages/graphics/libjpeg-turbo/package.mk +++ b/packages/graphics/libjpeg-turbo/package.mk @@ -1,54 +1,36 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libjpeg-turbo" -PKG_VERSION="1.5.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.0.1" +PKG_SHA256="a30db8bcc8a0fab56998ea134233a8cdcb7ac81170e7d87f8bc900f02dda39d4" PKG_LICENSE="GPL" -PKG_SITE="http://libjpeg-turbo.virtualgl.org/" -PKG_URL="$SOURCEFORGE_SRC/libjpeg-turbo/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://libjpeg-turbo.org/" +PKG_URL="https://github.com/libjpeg-turbo/libjpeg-turbo/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="toolchain" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="libjpeg-turbo: a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression." -PKG_LONGDESC="libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression. libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal." - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_HOST="--enable-static \ - --disable-shared \ - --with-jpeg8 \ - --without-simd" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-jpeg8" - -pre_configure_host() { - export CFLAGS="$CFLAGS -fPIC -DPIC" -} - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" -} +PKG_LONGDESC="A high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD." +PKG_BUILD_FLAGS="+pic +pic:host" + +PKG_CMAKE_OPTS_HOST="-DENABLE_STATIC=ON \ + -DENABLE_SHARED=OFF \ + -DWITH_JPEG8=ON \ + -DWITH_SIMD=OFF" + +PKG_CMAKE_OPTS_TARGET="-DENABLE_STATIC=ON \ + -DENABLE_SHARED=OFF \ + -DWITH_JPEG8=ON" + +if target_has_feature "(neon|sse)"; then + PKG_CMAKE_OPTS_TARGET+=" -DWITH_SIMD=ON" +else + PKG_CMAKE_OPTS_TARGET+=" -DWITH_SIMD=OFF" +fi -if [ "$SIMD_SUPPORT" = "no" ]; then - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --without-simd" +if [ $TARGET_ARCH = "x86_64" ]; then + PKG_DEPENDS_HOST+=" nasm:host" + PKG_DEPENDS_TARGET+=" nasm:host" fi post_makeinstall_target() { diff --git a/packages/graphics/libmali/package.mk b/packages/graphics/libmali/package.mk new file mode 100644 index 0000000000..d7c1054260 --- /dev/null +++ b/packages/graphics/libmali/package.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libmali" +PKG_VERSION="3e06d6226c22d8d69cd5cb4935d040178b0737f6" +PKG_SHA256="dfdcf2b9f55c3ba9a4e723834708edefb5d7bc7596c4cbde8448e1b0410796d7" +PKG_ARCH="arm aarch64" +PKG_LICENSE="nonfree" +PKG_SITE="https://github.com/LibreELEC/libmali" +PKG_URL="https://github.com/LibreELEC/libmali/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="OpenGL ES user-space binary for the ARM Mali GPU family" + +PKG_DEPENDS_TARGET="libdrm" + +if [ "$MALI_FAMILY" = "t720" ]; then + PKG_DEPENDS_TARGET+=" wayland" +fi + +PKG_CMAKE_OPTS_TARGET="-DMALI_VARIANT=$MALI_FAMILY" + +if [ -n "$MALI_REVISION" ]; then + PKG_CMAKE_OPTS_TARGET+=" -DMALI_REVISION=$MALI_REVISION" +fi + +if [ "$TARGET_ARCH" = "aarch64" ]; then + PKG_CMAKE_OPTS_TARGET+=" -DMALI_ARCH=aarch64-linux-gnu" +fi diff --git a/packages/graphics/libpng/package.mk b/packages/graphics/libpng/package.mk index 2430a45fb2..ca5c420016 100644 --- a/packages/graphics/libpng/package.mk +++ b/packages/graphics/libpng/package.mk @@ -1,37 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libpng" -PKG_VERSION="1.6.25" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" +PKG_VERSION="1.6.36" +PKG_SHA256="eceb924c1fa6b79172fdfd008d335f0e59172a86a66481e09d4089df872aa319" +PKG_LICENSE="LibPNG2" PKG_SITE="http://www.libpng.org/" PKG_URL="$SOURCEFORGE_SRC/libpng/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="zlib:host" PKG_DEPENDS_TARGET="toolchain zlib" -PKG_SECTION="graphics" -PKG_SHORTDESC="libpng: Portable Network Graphics (PNG) Reference Library" -PKG_LONGDESC="PNG (Portable Network Graphics) is an extensible file format for the lossless, portable, well-compressed storage of raster images. PNG provides a patent-free replacement for GIF and can also replace many common uses of TIFF. Indexed-color, grayscale, and truecolor images are supported, plus an optional alpha channel. Sample depths range from 1 to 16 bits." - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="An extensible file format for the lossless, portable, well-compressed storage of raster images." +PKG_TOOLCHAIN="configure" +PKG_BUILD_FLAGS="+pic +pic:host" PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_z_zlibVersion=yes \ --enable-static \ @@ -40,12 +20,10 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_z_zlibVersion=yes \ PKG_CONFIGURE_OPTS_HOST="--enable-static --disable-shared" pre_configure_host() { - export CFLAGS="$CFLAGS -fPIC -DPIC" - export CPPFLAGS="$CPPFLAGS -I$ROOT/$TOOLCHAIN/include" + export CPPFLAGS="$CPPFLAGS -I$TOOLCHAIN/include" } pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" export CPPFLAGS="$CPPFLAGS -I$SYSROOT_PREFIX/usr/include" } diff --git a/packages/graphics/libprojectM/package.mk b/packages/graphics/libprojectM/package.mk index 446506e7ce..333e42da36 100644 --- a/packages/graphics/libprojectM/package.mk +++ b/packages/graphics/libprojectM/package.mk @@ -1,34 +1,22 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libprojectM" -PKG_VERSION="2.0.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="8b52061e17ace56737de191b81adf3c3df34504e" +PKG_SHA256="1bc4a2b9a0310b5215ff29b4bd12c807c776174ea28c11acf37b76587e88c7b8" PKG_LICENSE="GPL" -PKG_SITE="http://projectm.sourceforge.net/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain ftgl freetype $OPENGL" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libprojectM:" -PKG_LONGDESC="libprojectM:" +PKG_SITE="https://github.com/projectM-visualizer/projectm" +PKG_URL="https://github.com/projectM-visualizer/projectm/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain freetype glm $OPENGL" +PKG_LONGDESC="A MilkDrop compatible opensource music visualizer." +PKG_TOOLCHAIN="configure" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ + --enable-static" -PKG_CMAKE_OPTS_TARGET="-DBUILD_PROJECTM_STATIC=1" \ No newline at end of file +# workaround due broken release files, remove at next bump +pre_configure_target() { + ./autogen.sh +} diff --git a/packages/graphics/libprojectM/patches/libprojectM-01-pm-fix-freetype.patch b/packages/graphics/libprojectM/patches/libprojectM-01-pm-fix-freetype.patch deleted file mode 100644 index fb0f75b791..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-01-pm-fix-freetype.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- projectm/cmake/FindFreetype2.orig.cmake 2013-07-17 11:47:46.844351322 +0200 -+++ projectm/cmake/FindFreetype2.cmake 2013-07-17 11:48:14.912350387 +0200 -@@ -64,7 +64,7 @@ - /sw/include/freetype2 - ${VISUS_INCLUDE} - ${VISUS_INCLUDE}/freetype2 -- NO_DEFAULT_PATH -+ # NO_DEFAULT_PATH - ) - - FIND_PATH(FREETYPE2_FT2BUILD ft2build.h -@@ -74,7 +74,7 @@ - /usr/X11R6/include - /sw/include - ${VISUS_INCLUDE} -- NO_DEFAULT_PATH -+ # NO_DEFAULT_PATH - ) - - FIND_PATH(FREETYPE2_FT_CONFIG bin/freetype-config -@@ -84,7 +84,7 @@ - /usr/X11R6 - /sw/bin - ${VISUS_BINARY_DIR} -- NO_DEFAULT_PATH -+ # NO_DEFAULT_PATH - ) - - IF (NOT WIN32) -@@ -95,7 +95,7 @@ - /usr/X11R6/lib - /sw/lib - ${VISUS_LIBRARIES} -- NO_DEFAULT_PATH -+ # NO_DEFAULT_PATH - ) - - ELSE (NOT WIN32) diff --git a/packages/graphics/libprojectM/patches/libprojectM-02-fix-projectm-cmakelists.patch b/packages/graphics/libprojectM/patches/libprojectM-02-fix-projectm-cmakelists.patch deleted file mode 100644 index bb0973fd29..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-02-fix-projectm-cmakelists.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- projectM-2.0.0-Source.orig/CMakeLists.txt 2009-12-01 07:38:42.000000000 +0100 -+++ projectM-2.0.0-Source/CMakeLists.txt 2014-09-02 18:13:37.650948971 +0200 -@@ -18,6 +18,7 @@ - - cmake_policy(SET CMP0005 OLD) - -+ADD_DEFINITIONS(-fPIC) - - set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) -@@ -100,15 +101,6 @@ - ADD_DEFINITIONS(-DUSE_FBO) - endif(USE_FBO) - --if(USE_FTGL) --ADD_DEFINITIONS(-DUSE_FTGL) -- --find_package( Freetype2 REQUIRED) --include_directories( ${FREETYPE2_INCLUDE_DIR} ) -- --endif(USE_FTGL) -- -- - if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) - endif(COMMAND cmake_policy) -@@ -138,58 +130,54 @@ - - add_subdirectory(Renderer) - --#ADD_DEFINITIONS(-DCMAKE_INSTALL_PREFIX="\\\"${CMAKE_INSTALL_PREFIX}\\\"") -- - FIND_PACKAGE(OpenGL) - - INCLUDE(FindPkgConfig.cmake) - --pkg_search_module (FTGL ftgl) -- --#set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH};/opt/local/include;/Developer/SDKs/MACOSX10.5.sdk/usr/X11/include) --#set(CMAKE_LIBRARY_PATH /opt/local/lib;/Developer/SDKs/MACOSX10.5.sdk;/Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/) -- - IF(USE_FTGL) -- if (FTGL_FOUND) -+ pkg_check_modules (FREETYPE freetype2) -+ if(FREETYPE_FOUND) -+ include(FindPackageHandleStandardArgs) -+ find_package_handle_standard_args(FREETYPE DEFAULT_MSG FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES FREETYPE_LIBRARY_DIRS) -+ set(FREETYPE2_INCLUDE_DIR ${FREETYPE_INCLUDE_DIRS}) -+ include_directories(${FREETYPE_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS}/include/freetype2) -+ endif() -+ message(STATUS "FREETYPE2_INCLUDE_DIR: ${FREETYPE2_INCLUDE_DIR}") -+ -+ pkg_check_modules (FTGL ftgl) -+ if(FTGL_FOUND) -+ include(FindPackageHandleStandardArgs) -+ find_package_handle_standard_args(FTGL DEFAULT_MSG FTGL_INCLUDE_DIRS FTGL_LIBRARIES FTGL_LIBRARY_DIRS) -+ ADD_DEFINITIONS(-DUSE_FTGL) -+ - MESSAGE(STATUS "[projectM] FTGL font support was detected and enabled.") - else (FTGL_FOUND) -- MESSAGE(STATUS -- "[projectM] Warning! FTGL has been enabled but not detected. Your compilation will probably break. Turn off FTGL support by setting USE_FTGL to false, or visit http://ftgl.wiki.sourceforge.net/ for help on installing FTGL.") -+ MESSAGE(FATAL_ERROR "[projectM] Warning! FTGL has been enabled but not detected. Your compilation will probably break. Turn off FTGL support by setting USE_FTGL to false, or visit http://ftgl.wiki.sourceforge.net/ for help on installing FTGL.") - endif (FTGL_FOUND) - -- ADD_DEFINITIONS(-DUSE_FTGL) -- - set (FTGL_INCUDE_DIRS ${FTGL_INCLUDE_DIRS} ${CMAKE_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR}) -- set (FTGL_LINK_DIRS ${FTGL_LIBRARY_DIRS} ) -+ set (FTGL_LINK_DIRS ${FTGL_LIBRARIES} ) -+ set (FTGL_LINK_LIBS -L${FTGL_LIBRARY_DIRS} ${FTGL_LIBRARIES} -L${FREETYPE_LIBRARY_DIRS} ${FREETYPE_LIBRARIES}) - set (FTGL_LINK_TARGETS ftgl freetype) - --ELSE (USE_FTGL) -- IF (FTGL_FOUND) -- MESSAGE(STATUS "[projectM] Warning: FTGL font support was detected but NOT enabled. You can enable it by setting USE_FTGL=true") -- ELSE (FTGL_FOUND) -- MESSAGE(STATUS "[projectM] Warning: FTGL font support was not detected. Visit http://ftgl.wiki.sourceforge.net/ for help on installing FTGL.") -- ENDIF(FTGL_FOUND) -- -- # todo: change this because its obscure and probably not being used -- set (FTGL_INCLUDE_DIRS "/opt/local/include") -- set (FTGL_LINK_DIRS ) -- set (FTGL_LINK_TARGETS ) - ENDIF(USE_FTGL) - -- - IF(USE_OPENMP) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ") - ENDIF(USE_OPENMP) - - INCLUDE_DIRECTORIES(${projectM_SOURCE_DIR} ${FTGL_INCLUDE_DIRS} ${Renderer_SOURCE_DIR} ${PRESET_FACTORY_SOURCES}) --LINK_DIRECTORIES(${FTGL_LINK_DIRS} ${Renderer_BINARY_DIR} ${PRESET_FACTORY_BINARY_DIR}) -+LINK_DIRECTORIES(${Renderer_BINARY_DIR} ${PRESET_FACTORY_BINARY_DIR}) - - if(BUILD_PROJECTM_STATIC) -- TARGET_LINK_LIBRARIES(projectM ${GLEW_LINK_TARGETS} m ${FTGL_LINK_TARGETS} ${OPENGL_LIBRARIES} ${IMAGE_LINK_TARGETS} ${CG_LINK_TARGETS} ${PRESET_FACTORY_LINK_TARGETS}) -+message(STATUS "OPENGL_LIBRARIES: ${OPENGL_LIBRARIES}") -+ set(OPENGL_LIBRARIES "-lGLEW -lGLU -lGL -lm -ldl -ldrm -lXdamage -lX11-xcb -lxcb-glx -lxcb-dri2 -lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence -lXxf86vm -lXfixes -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp") -+message(STATUS "OPENGL_LIBRARIES: ${OPENGL_LIBRARIES}") -+ TARGET_LINK_LIBRARIES(projectM Renderer ${PRESET_FACTORY_LINK_TARGETS} ${GLEW_LINK_TARGETS} m ${FTGL_LINK_LIBS} ${OPENGL_LIBRARIES} ${IMAGE_LINK_TARGETS} ${CG_LINK_TARGETS}) - else(BUILD_PROJECTM_STATIC) - --TARGET_LINK_LIBRARIES(projectM ${GLEW_LINK_TARGETS} m ${FTGL_LINK_TARGETS} ${OPENGL_LIBRARIES} ${IMAGE_LINK_TARGETS} ${CG_LINK_TARGETS} ${PRESET_FACTORY_LINK_TARGETS}) -+ TARGET_LINK_LIBRARIES(projectM Renderer ${PRESET_FACTORY_LINK_TARGETS} ${GLEW_LINK_TARGETS} m dl ${FTGL_LINK_LIBS} ${OPENGL_LIBRARIES} ${IMAGE_LINK_TARGETS} ${CG_LINK_TARGETS}) - - endif(BUILD_PROJECTM_STATIC) diff --git a/packages/graphics/libprojectM/patches/libprojectM-03-pm-remove-cache.patch b/packages/graphics/libprojectM/patches/libprojectM-03-pm-remove-cache.patch deleted file mode 100644 index 54b6cb414d..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-03-pm-remove-cache.patch +++ /dev/null @@ -1,758 +0,0 @@ ---- projectm/CMakeCache.txt 2009-12-01 07:38:42.000000000 +0100 -+++ /dev/null 2013-10-24 12:04:38.043396310 +0200 -@@ -1,755 +0,0 @@ --# This is the CMakeCache file. --# For build in directory: /home/struktured/release/2.0.0/src/libprojectM --# It was generated by CMake: /usr/bin/cmake --# You can edit this file to change values found and used by cmake. --# If you do not want to change any of the values, simply exit the editor. --# If you do want to change a value, simply edit, save, and exit the editor. --# The syntax for the file is as follows: --# KEY:TYPE=VALUE --# KEY is the name of a variable in the cache. --# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. --# VALUE is the current value for the KEY. -- --######################## --# EXTERNAL cache entries --######################## -- --//Build the projectM target library in the platform's native static --// (NOT shared) format. --BUILD_PROJECTM_STATIC:BOOL=OFF -- --//Path to a program. --CMAKE_AR:FILEPATH=/usr/bin/ar -- --//For backwards compatibility, what version of CMake commands and --// syntax should this version of CMake try to support. --CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4 -- --//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or --// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. --CMAKE_BUILD_TYPE:STRING=Release -- --//Enable/Disable color output during build. --CMAKE_COLOR_MAKEFILE:BOOL=ON -- --//CXX compiler. --CMAKE_CXX_COMPILER:FILEPATH=/usr/lib64/ccache/c++ -- --//Flags used by the compiler during all build types. --CMAKE_CXX_FLAGS:STRING= -- --//Flags used by the compiler during debug builds. --CMAKE_CXX_FLAGS_DEBUG:STRING=-g -- --//Flags used by the compiler during release minsize builds. --CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG -- --//Flags used by the compiler during release builds (/MD /Ob1 /Oi --// /Ot /Oy /Gs will produce slightly less optimized but smaller --// files). --CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -- --//Flags used by the compiler during Release with Debug Info builds. --CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -- --//C compiler. --CMAKE_C_COMPILER:FILEPATH=/usr/lib64/ccache/gcc -- --//Flags used by the compiler during all build types. --CMAKE_C_FLAGS:STRING= -- --//Flags used by the compiler during debug builds. --CMAKE_C_FLAGS_DEBUG:STRING=-g -- --//Flags used by the compiler during release minsize builds. --CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG -- --//Flags used by the compiler during release builds (/MD /Ob1 /Oi --// /Ot /Oy /Gs will produce slightly less optimized but smaller --// files). --CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -- --//Flags used by the compiler during Release with Debug Info builds. --CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -- --//Flags used by the linker. --CMAKE_EXE_LINKER_FLAGS:STRING= -- --//Flags used by the linker during debug builds. --CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= -- --//Flags used by the linker during release minsize builds. --CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= -- --//Flags used by the linker during release builds. --CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= -- --//Flags used by the linker during Release with Debug Info builds. --CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= -- --//Install path prefix, prepended onto install directories. --CMAKE_INSTALL_PREFIX:PATH=/usr/local -- --//Path to a program. --CMAKE_LINKER:FILEPATH=/usr/bin/ld -- --//Path to a program. --CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake -- --//Flags used by the linker during the creation of modules. --CMAKE_MODULE_LINKER_FLAGS:STRING= -- --//Flags used by the linker during debug builds. --CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= -- --//Flags used by the linker during release minsize builds. --CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= -- --//Flags used by the linker during release builds. --CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= -- --//Flags used by the linker during Release with Debug Info builds. --CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= -- --//Path to a program. --CMAKE_NM:FILEPATH=/usr/bin/nm -- --//Path to a program. --CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy -- --//Path to a program. --CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump -- --//Path to a program. --CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib -- --//Flags used by the linker during the creation of dll's. --CMAKE_SHARED_LINKER_FLAGS:STRING= -- --//Flags used by the linker during debug builds. --CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= -- --//Flags used by the linker during release minsize builds. --CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= -- --//Flags used by the linker during release builds. --CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= -- --//Flags used by the linker during Release with Debug Info builds. --CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= -- --//If set, runtime paths are not added when using shared libraries. --CMAKE_SKIP_RPATH:BOOL=NO -- --//Path to a program. --CMAKE_STRIP:FILEPATH=/usr/bin/strip -- --//If true, cmake will use relative paths in makefiles and projects. --CMAKE_USE_RELATIVE_PATHS:BOOL=OFF -- --//If this value is on, makefiles will be generated without the --// .SILENT directive, and all commands will be echoed to the console --// during the make. This is useful for debugging only. With Visual --// Studio IDE projects all commands are done without /nologo. --CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE -- --//Enable to build Debian packages --CPACK_BINARY_DEB:BOOL=OFF -- --//Enable to build NSIS packages --CPACK_BINARY_NSIS:BOOL=OFF -- --//Enable to build RPM packages --CPACK_BINARY_RPM:BOOL=OFF -- --//Enable to build STGZ packages --CPACK_BINARY_STGZ:BOOL=ON -- --//Enable to build TBZ2 packages --CPACK_BINARY_TBZ2:BOOL=OFF -- --//Enable to build TGZ packages --CPACK_BINARY_TGZ:BOOL=ON -- --//Enable to build TZ packages --CPACK_BINARY_TZ:BOOL=OFF -- --//Enable to build TBZ2 source packages --CPACK_SOURCE_TBZ2:BOOL=OFF -- --//Enable to build TGZ source packages --CPACK_SOURCE_TGZ:BOOL=ON -- --//Enable to build TZ source packages --CPACK_SOURCE_TZ:BOOL=OFF -- --//Enable to build ZIP source packages --CPACK_SOURCE_ZIP:BOOL=OFF -- --//Turn off support for Milkdrop (.milk / .prjm) presets --DISABLE_MILKDROP_PRESETS:BOOL=OFF -- --//Turn off support for native (C++ style) presets --DISABLE_NATIVE_PRESETS:BOOL=OFF -- --//Single output directory for building all executables. --EXECUTABLE_OUTPUT_PATH:PATH= -- --//Path to a file. --FREETYPE2_FT2BUILD:PATH=/usr/include -- --//Path to a file. --FREETYPE2_FT_CONFIG:PATH=/usr -- --//Path to a file. --FREETYPE2_INCLUDE_DIR:PATH=/usr/include/freetype2 -- --//Path to a library. --FREETYPE2_LIBRARIES:FILEPATH=/usr/lib64/libfreetype.so -- --//Single output directory for building all libraries. --LIBRARY_OUTPUT_PATH:PATH= -- --//Value Computed by CMake --MilkdropPresetFactory_BINARY_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM/MilkdropPresetFactory -- --//Dependencies for the target --MilkdropPresetFactory_LIB_DEPENDS:STATIC=general;Renderer; -- --//Value Computed by CMake --MilkdropPresetFactory_SOURCE_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM/MilkdropPresetFactory -- --//Value Computed by CMake --NativePresetFactory_BINARY_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM/NativePresetFactory -- --//Dependencies for the target --NativePresetFactory_LIB_DEPENDS:STATIC=general;Renderer;general;m; -- --//Value Computed by CMake --NativePresetFactory_SOURCE_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM/NativePresetFactory -- --//Path to a file. --OPENGL_INCLUDE_DIR:PATH=/usr/include -- --//Path to a library. --OPENGL_gl_LIBRARY:FILEPATH=/usr/lib64/libGL.so -- --//Path to a library. --OPENGL_glu_LIBRARY:FILEPATH=/usr/lib64/libGLU.so -- --//Path to a file. --OPENGL_xmesa_INCLUDE_DIR:PATH=OPENGL_xmesa_INCLUDE_DIR-NOTFOUND -- --//pkg-config executable --PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config -- --//Value Computed by CMake --Renderer_BINARY_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM/Renderer -- --//Dependencies for the target --Renderer_LIB_DEPENDS:STATIC=general;m; -- --//Value Computed by CMake --Renderer_SOURCE_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM/Renderer -- --//Experimental feature to synchronize preset switches internally --SYNC_PRESET_SWITCHES:BOOL=OFF -- --//Use Cg for Pixel Shader support --USE_CG:BOOL=ON -- --//Use devIL for image loading rather than the builtin SOIL library --USE_DEVIL:BOOL=OFF -- --//Use Framebuffer Objects for increased rendering quality. Disable --// this for OpenGL ES 1.x or if you are experiencing problems on --// older or poorly supported hardware. --USE_FBO:BOOL=ON -- --//Use FTGL for on-screen fonts (found on your system) --USE_FTGL:BOOL=ON -- --//Use OpenGL ES 1.x --USE_GLES1:BOOL=OFF -- --//Use projectM's native implemention of GLEW. --USE_NATIVE_GLEW:BOOL=OFF -- --//Use OpenMP and OMPTL for multi-core paralellization --USE_OPENMP:BOOL=ON -- --//Path to a file. --X11_ICE_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_ICE_LIB:FILEPATH=/usr/lib64/libICE.so -- --//Path to a library. --X11_SM_LIB:FILEPATH=/usr/lib64/libSM.so -- --//Path to a file. --X11_X11_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_X11_LIB:FILEPATH=/usr/lib64/libX11.so -- --//Path to a file. --X11_XShm_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_XTest_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_XTest_LIB:FILEPATH=/usr/lib64/libXtst.so -- --//Path to a file. --X11_Xaccessrules_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xaccessstr_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xau_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xau_LIB:FILEPATH=/usr/lib64/libXau.so -- --//Path to a file. --X11_Xcomposite_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xcomposite_LIB:FILEPATH=/usr/lib64/libXcomposite.so -- --//Path to a file. --X11_Xcursor_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xcursor_LIB:FILEPATH=/usr/lib64/libXcursor.so -- --//Path to a file. --X11_Xdamage_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xdamage_LIB:FILEPATH=/usr/lib64/libXdamage.so -- --//Path to a file. --X11_Xdmcp_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xdmcp_LIB:FILEPATH=/usr/lib64/libXdmcp.so -- --//Path to a library. --X11_Xext_LIB:FILEPATH=/usr/lib64/libXext.so -- --//Path to a file. --X11_Xfixes_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xfixes_LIB:FILEPATH=/usr/lib64/libXfixes.so -- --//Path to a file. --X11_Xft_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xft_LIB:FILEPATH=/usr/lib64/libXft.so -- --//Path to a file. --X11_Xinerama_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xinerama_LIB:FILEPATH=/usr/lib64/libXinerama.so -- --//Path to a file. --X11_Xinput_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xinput_LIB:FILEPATH=/usr/lib64/libXi.so -- --//Path to a file. --X11_Xkb_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xkblib_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xlib_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xpm_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xpm_LIB:FILEPATH=/usr/lib64/libXpm.so -- --//Path to a file. --X11_Xrandr_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xrandr_LIB:FILEPATH=/usr/lib64/libXrandr.so -- --//Path to a file. --X11_Xrender_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xrender_LIB:FILEPATH=/usr/lib64/libXrender.so -- --//Path to a file. --X11_Xscreensaver_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xscreensaver_LIB:FILEPATH=/usr/lib64/libXss.so -- --//Path to a file. --X11_Xshape_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xt_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xt_LIB:FILEPATH=/usr/lib64/libXt.so -- --//Path to a file. --X11_Xutil_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_Xv_INCLUDE_PATH:PATH=/usr/include -- --//Path to a library. --X11_Xv_LIB:FILEPATH=/usr/lib64/libXv.so -- --//Path to a library. --X11_Xxf86misc_LIB:FILEPATH=/usr/lib64/libXxf86misc.so -- --//Path to a file. --X11_dpms_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_xf86misc_INCLUDE_PATH:PATH=/usr/include -- --//Path to a file. --X11_xf86vmode_INCLUDE_PATH:PATH=/usr/include -- --//Value Computed by CMake --projectM_BINARY_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM -- --//Dependencies for the target --projectM_LIB_DEPENDS:STATIC=general;GLEW;general;m;general;ftgl;general;freetype;general;/usr/lib64/libGLU.so;general;/usr/lib64/libGL.so;general;/usr/lib64/libSM.so;general;/usr/lib64/libICE.so;general;/usr/lib64/libX11.so;general;/usr/lib64/libXext.so;general;Cg;general;CgGL;general;NativePresetFactory;general;MilkdropPresetFactory; -- --//Value Computed by CMake --projectM_SOURCE_DIR:STATIC=/home/struktured/release/2.0.0/src/libprojectM -- -- --######################## --# INTERNAL cache entries --######################## -- --//Advanced flag for variable: CMAKE_AR --CMAKE_AR-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_BUILD_TOOL --CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1 --//What is the target build tool cmake is generating for. --CMAKE_BUILD_TOOL:INTERNAL=/usr/bin/gmake --//Modified flag for variable: CMAKE_BUILD_TYPE --CMAKE_BUILD_TYPE-MODIFIED:INTERNAL=1 --//This is the directory where this CMakeCahe.txt was created --CMAKE_CACHEFILE_DIR:INTERNAL=/home/struktured/release/2.0.0/src/libprojectM --//Major version of cmake used to create the current loaded cache --CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2 --//Minor version of cmake used to create the current loaded cache --CMAKE_CACHE_MINOR_VERSION:INTERNAL=6 --//Major version of cmake used to create the current loaded cache --CMAKE_CACHE_RELEASE_VERSION:INTERNAL=patch 4 --//Advanced flag for variable: CMAKE_COLOR_MAKEFILE --CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 --//Path to CMake executable. --CMAKE_COMMAND:INTERNAL=/usr/bin/cmake --//Path to cpack program executable. --CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack --//Path to ctest program executable. --CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest --//Advanced flag for variable: CMAKE_CXX_COMPILER --CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 --CMAKE_CXX_COMPILER_WORKS:INTERNAL=1 --//Advanced flag for variable: CMAKE_CXX_FLAGS --CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_CXX_FLAGS_DEBUG --CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_CXX_FLAGS_MINSIZEREL --CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_CXX_FLAGS_RELEASE --CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO --CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_C_COMPILER --CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 --CMAKE_C_COMPILER_WORKS:INTERNAL=1 --//Advanced flag for variable: CMAKE_C_FLAGS --CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_C_FLAGS_DEBUG --CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_C_FLAGS_MINSIZEREL --CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_C_FLAGS_RELEASE --CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_C_FLAGS_RELWITHDEBINFO --CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 --//Result of TRY_COMPILE --CMAKE_DETERMINE_CXX_ABI_COMPILED:INTERNAL=TRUE --//Result of TRY_COMPILE --CMAKE_DETERMINE_C_ABI_COMPILED:INTERNAL=TRUE --//Path to cache edit program executable. --CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake --//Executable file format --CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF --//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS --CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG --CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL --CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE --CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO --CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 --//Name of generator. --CMAKE_GENERATOR:INTERNAL=Unix Makefiles --//Have function connect --CMAKE_HAVE_CONNECT:INTERNAL=1 --//Have function gethostbyname --CMAKE_HAVE_GETHOSTBYNAME:INTERNAL=1 --//Have function remove --CMAKE_HAVE_REMOVE:INTERNAL=1 --//Have function shmat --CMAKE_HAVE_SHMAT:INTERNAL=1 --//Start directory with the top level CMakeLists.txt file for this --// project --CMAKE_HOME_DIRECTORY:INTERNAL=/home/struktured/release/2.0.0/src/libprojectM --//Install .so files without execute permission. --CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 --//Have library ICE --CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER:INTERNAL=1 --//Advanced flag for variable: CMAKE_LINKER --CMAKE_LINKER-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_MAKE_PROGRAM --CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS --CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG --CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL --CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE --CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO --CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_NM --CMAKE_NM-ADVANCED:INTERNAL=1 --//number of local generators --CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=4 --//Advanced flag for variable: CMAKE_OBJCOPY --CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_OBJDUMP --CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_RANLIB --CMAKE_RANLIB-ADVANCED:INTERNAL=1 --//Path to CMake installation. --CMAKE_ROOT:INTERNAL=/usr/share/cmake --//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS --CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG --CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL --CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE --CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO --CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_SKIP_RPATH --CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_STRIP --CMAKE_STRIP-ADVANCED:INTERNAL=1 --//uname command --CMAKE_UNAME:INTERNAL=/bin/uname --//Advanced flag for variable: CMAKE_USE_RELATIVE_PATHS --CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CMAKE_VERBOSE_MAKEFILE --CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_DEB --CPACK_BINARY_DEB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_NSIS --CPACK_BINARY_NSIS-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_RPM --CPACK_BINARY_RPM-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_STGZ --CPACK_BINARY_STGZ-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_TBZ2 --CPACK_BINARY_TBZ2-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_TGZ --CPACK_BINARY_TGZ-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_BINARY_TZ --CPACK_BINARY_TZ-ADVANCED:INTERNAL=1 --//Modified flag for variable: CPACK_BINARY_TZ --CPACK_BINARY_TZ-MODIFIED:INTERNAL=1 --//Advanced flag for variable: CPACK_SOURCE_TBZ2 --CPACK_SOURCE_TBZ2-ADVANCED:INTERNAL=1 --//Modified flag for variable: CPACK_SOURCE_TBZ2 --CPACK_SOURCE_TBZ2-MODIFIED:INTERNAL=1 --//Advanced flag for variable: CPACK_SOURCE_TGZ --CPACK_SOURCE_TGZ-ADVANCED:INTERNAL=1 --//Advanced flag for variable: CPACK_SOURCE_TZ --CPACK_SOURCE_TZ-ADVANCED:INTERNAL=1 --//Modified flag for variable: CPACK_SOURCE_TZ --CPACK_SOURCE_TZ-MODIFIED:INTERNAL=1 --//Advanced flag for variable: CPACK_SOURCE_ZIP --CPACK_SOURCE_ZIP-ADVANCED:INTERNAL=1 --//Details about finding X11 --FIND_PACKAGE_MESSAGE_DETAILS_X11:INTERNAL=[/usr/lib64/libX11.so][/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include;/usr/include] --FTGL_CFLAGS:INTERNAL=-I/usr/include/freetype2 --FTGL_CFLAGS_I:INTERNAL= --FTGL_CFLAGS_OTHER:INTERNAL= --FTGL_FOUND:INTERNAL=1 --FTGL_INCLUDEDIR:INTERNAL=/usr/include --FTGL_INCLUDE_DIRS:INTERNAL=/usr/include/freetype2 --FTGL_LDFLAGS:INTERNAL=-lGLU;-lGL;-lftgl;-lfreetype --FTGL_LDFLAGS_OTHER:INTERNAL= --FTGL_LIBDIR:INTERNAL=/usr/lib64 --FTGL_LIBRARIES:INTERNAL=GLU;GL;ftgl;freetype --FTGL_LIBRARY_DIRS:INTERNAL= --FTGL_LIBS:INTERNAL= --FTGL_LIBS_L:INTERNAL= --FTGL_LIBS_OTHER:INTERNAL= --FTGL_LIBS_PATHS:INTERNAL= --FTGL_PREFIX:INTERNAL=/usr --FTGL_STATIC_CFLAGS:INTERNAL=-I/usr/include/freetype2 --FTGL_STATIC_CFLAGS_I:INTERNAL= --FTGL_STATIC_CFLAGS_OTHER:INTERNAL= --FTGL_STATIC_INCLUDE_DIRS:INTERNAL=/usr/include/freetype2 --FTGL_STATIC_LDFLAGS:INTERNAL=-lGLU;-lGL;-lftgl;-lfreetype --FTGL_STATIC_LDFLAGS_OTHER:INTERNAL= --FTGL_STATIC_LIBDIR:INTERNAL= --FTGL_STATIC_LIBRARIES:INTERNAL=GLU;GL;ftgl;freetype --FTGL_STATIC_LIBRARY_DIRS:INTERNAL= --FTGL_STATIC_LIBS:INTERNAL= --FTGL_STATIC_LIBS_L:INTERNAL= --FTGL_STATIC_LIBS_OTHER:INTERNAL= --FTGL_STATIC_LIBS_PATHS:INTERNAL= --FTGL_VERSION:INTERNAL=2.1.2 --FTGL_ftgl_INCLUDEDIR:INTERNAL= --FTGL_ftgl_LIBDIR:INTERNAL= --FTGL_ftgl_PREFIX:INTERNAL= --FTGL_ftgl_VERSION:INTERNAL= --//Advanced flag for variable: OPENGL_INCLUDE_DIR --OPENGL_INCLUDE_DIR-ADVANCED:INTERNAL=1 --//Advanced flag for variable: OPENGL_gl_LIBRARY --OPENGL_gl_LIBRARY-ADVANCED:INTERNAL=1 --//Advanced flag for variable: OPENGL_glu_LIBRARY --OPENGL_glu_LIBRARY-ADVANCED:INTERNAL=1 --//Advanced flag for variable: OPENGL_xmesa_INCLUDE_DIR --OPENGL_xmesa_INCLUDE_DIR-ADVANCED:INTERNAL=1 --//Advanced flag for variable: PKG_CONFIG_EXECUTABLE --PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1 --//Modified flag for variable: USE_CG --USE_CG-MODIFIED:INTERNAL=1 --//Advanced flag for variable: X11_ICE_INCLUDE_PATH --X11_ICE_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_ICE_LIB --X11_ICE_LIB-ADVANCED:INTERNAL=1 --//Have library /usr/lib64/libX11.so;/usr/lib64/libXext.so --X11_LIB_X11_SOLO:INTERNAL=1 --//Advanced flag for variable: X11_SM_LIB --X11_SM_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_X11_INCLUDE_PATH --X11_X11_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_X11_LIB --X11_X11_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_XShm_INCLUDE_PATH --X11_XShm_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_XTest_INCLUDE_PATH --X11_XTest_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_XTest_LIB --X11_XTest_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xaccessrules_INCLUDE_PATH --X11_Xaccessrules_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xaccessstr_INCLUDE_PATH --X11_Xaccessstr_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xau_INCLUDE_PATH --X11_Xau_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xau_LIB --X11_Xau_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xcomposite_INCLUDE_PATH --X11_Xcomposite_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xcomposite_LIB --X11_Xcomposite_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xcursor_INCLUDE_PATH --X11_Xcursor_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xcursor_LIB --X11_Xcursor_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xdamage_INCLUDE_PATH --X11_Xdamage_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xdamage_LIB --X11_Xdamage_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xdmcp_INCLUDE_PATH --X11_Xdmcp_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xdmcp_LIB --X11_Xdmcp_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xext_LIB --X11_Xext_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xfixes_INCLUDE_PATH --X11_Xfixes_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xfixes_LIB --X11_Xfixes_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xft_INCLUDE_PATH --X11_Xft_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xft_LIB --X11_Xft_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xinerama_INCLUDE_PATH --X11_Xinerama_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xinerama_LIB --X11_Xinerama_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xinput_INCLUDE_PATH --X11_Xinput_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xinput_LIB --X11_Xinput_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xkb_INCLUDE_PATH --X11_Xkb_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xkblib_INCLUDE_PATH --X11_Xkblib_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xlib_INCLUDE_PATH --X11_Xlib_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xpm_INCLUDE_PATH --X11_Xpm_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xpm_LIB --X11_Xpm_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xrandr_INCLUDE_PATH --X11_Xrandr_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xrandr_LIB --X11_Xrandr_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xrender_INCLUDE_PATH --X11_Xrender_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xrender_LIB --X11_Xrender_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xscreensaver_INCLUDE_PATH --X11_Xscreensaver_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xscreensaver_LIB --X11_Xscreensaver_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xshape_INCLUDE_PATH --X11_Xshape_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xt_INCLUDE_PATH --X11_Xt_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xt_LIB --X11_Xt_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xutil_INCLUDE_PATH --X11_Xutil_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xv_INCLUDE_PATH --X11_Xv_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xv_LIB --X11_Xv_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_Xxf86misc_LIB --X11_Xxf86misc_LIB-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_dpms_INCLUDE_PATH --X11_dpms_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_xf86misc_INCLUDE_PATH --X11_xf86misc_INCLUDE_PATH-ADVANCED:INTERNAL=1 --//Advanced flag for variable: X11_xf86vmode_INCLUDE_PATH --X11_xf86vmode_INCLUDE_PATH-ADVANCED:INTERNAL=1 --__pkg_config_checked_FTGL:INTERNAL=1 -- diff --git a/packages/graphics/libprojectM/patches/libprojectM-04-fix-pkgconfig.patch b/packages/graphics/libprojectM/patches/libprojectM-04-fix-pkgconfig.patch deleted file mode 100644 index 5d8f6bfc01..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-04-fix-pkgconfig.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- projectm/libprojectM.pc.in.orig 2015-03-16 14:02:55.733369674 +0100 -+++ projectm/libprojectM.pc.in 2015-03-16 14:03:42.685370237 +0100 -@@ -1,6 +1,6 @@ - prefix=@CMAKE_INSTALL_PREFIX@ - exec_prefix=@CMAKE_INSTALL_PREFIX@ --libdir=@LIB_INSTALL_DIR@ -+libdir=@CMAKE_INSTALL_PREFIX@/lib - includedir=@CMAKE_INSTALL_PREFIX@/include - pkgdatadir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@ - sysconfdir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@ -@@ -9,5 +9,5 @@ - Version: 2.0.0 - Description: projectM - OpenGL Milkdrop - Requires: --Libs: -L${libdir} -lprojectM -+Libs: -L${libdir} -lprojectM -lMilkdropPresetFactory -lprojectM -lNativePresetFactory -lRenderer -lm - Cflags: -I${includedir} diff --git a/packages/graphics/libprojectM/patches/libprojectM-04-fix-pkgconfig.patch.old b/packages/graphics/libprojectM/patches/libprojectM-04-fix-pkgconfig.patch.old deleted file mode 100644 index 77cefd1310..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-04-fix-pkgconfig.patch.old +++ /dev/null @@ -1,17 +0,0 @@ ---- projectm/libprojectM.pc.in.orig 2015-03-16 14:02:55.733369674 +0100 -+++ projectm/libprojectM.pc.in 2015-03-16 14:03:42.685370237 +0100 -@@ -1,6 +1,6 @@ - prefix=@CMAKE_INSTALL_PREFIX@ - exec_prefix=@CMAKE_INSTALL_PREFIX@ --libdir=@LIB_INSTALL_DIR@ -+libdir=@CMAKE_INSTALL_PREFIX@/lib - includedir=@CMAKE_INSTALL_PREFIX@/include - pkgdatadir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@ - sysconfdir=@CMAKE_INSTALL_PREFIX@/@RESOURCE_PREFIX@ -@@ -9,5 +9,5 @@ - Version: 2.0.0 - Description: projectM - OpenGL Milkdrop - Requires: --Libs: -L${libdir} -lprojectM -+Libs: -L${libdir} -lprojectM -lMilkdropPresetFactory -lNativePresetFactory -lRenderer -lm - Cflags: -I${includedir} diff --git a/packages/graphics/libprojectM/patches/libprojectM-05-install-renderlib.patch b/packages/graphics/libprojectM/patches/libprojectM-05-install-renderlib.patch deleted file mode 100644 index 58a0188f3f..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-05-install-renderlib.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- projectm/Renderer/CMakeLists.txt.orig 2015-03-16 13:30:27.909346320 +0100 -+++ projectm/Renderer/CMakeLists.txt 2015-03-16 13:30:57.221346672 +0100 -@@ -14,3 +14,6 @@ - ADD_LIBRARY(Renderer STATIC ${Renderer_SOURCES}) - SET_TARGET_PROPERTIES(Renderer PROPERTIES VERSION 2.00 SOVERSION 2) - TARGET_LINK_LIBRARIES(Renderer m) -+IF(BUILD_PROJECTM_STATIC) -+ INSTALL(TARGETS Renderer DESTINATION lib${LIB_SUFFIX}) -+endif() diff --git a/packages/graphics/libprojectM/patches/libprojectM-06-install-nativefactory.patch b/packages/graphics/libprojectM/patches/libprojectM-06-install-nativefactory.patch deleted file mode 100644 index 3afde598ef..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-06-install-nativefactory.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- projectm/NativePresetFactory/CMakeLists.txt.orig 2015-03-16 13:31:17.965346920 +0100 -+++ projectm/NativePresetFactory/CMakeLists.txt 2015-03-16 13:31:38.921347172 +0100 -@@ -13,3 +13,6 @@ - ADD_LIBRARY(NativePresetFactory STATIC ${NativePresetFactory_SOURCES}) - SET_TARGET_PROPERTIES(NativePresetFactory PROPERTIES VERSION 2.00 SOVERSION 2) - TARGET_LINK_LIBRARIES(NativePresetFactory Renderer m) -+IF(BUILD_PROJECTM_STATIC) -+ INSTALL(TARGETS NativePresetFactory DESTINATION lib${LIB_SUFFIX}) -+endif() diff --git a/packages/graphics/libprojectM/patches/libprojectM-07-install-milkdropfactory.patch b/packages/graphics/libprojectM/patches/libprojectM-07-install-milkdropfactory.patch deleted file mode 100644 index a0b1b6c310..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-07-install-milkdropfactory.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- projectm/MilkdropPresetFactory/CMakeLists.txt.orig 2015-03-16 13:27:41.557344326 +0100 -+++ projectm/MilkdropPresetFactory/CMakeLists.txt 2015-03-16 13:31:00.769346714 +0100 -@@ -15,3 +15,6 @@ - ADD_LIBRARY(MilkdropPresetFactory STATIC ${MilkdropPresetFactory_SOURCES}) - SET_TARGET_PROPERTIES(MilkdropPresetFactory PROPERTIES VERSION 2.00 SOVERSION 2) - TARGET_LINK_LIBRARIES(MilkdropPresetFactory Renderer) -+IF(BUILD_PROJECTM_STATIC) -+ INSTALL(TARGETS MilkdropPresetFactory DESTINATION lib${LIB_SUFFIX}) -+endif() diff --git a/packages/graphics/libprojectM/patches/libprojectM-c++14.patch b/packages/graphics/libprojectM/patches/libprojectM-c++14.patch deleted file mode 100644 index e23f31d805..0000000000 --- a/packages/graphics/libprojectM/patches/libprojectM-c++14.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff -x '*orig' -rup a/Common.hpp b/Common.hpp ---- a/Common.hpp 2012-05-20 04:43:26.000000000 +0100 -+++ b/Common.hpp 2016-03-17 05:00:14.176905540 +0000 -@@ -63,7 +63,8 @@ extern FILE *fmemopen(void *buf, size_t - - #ifdef LINUX - #include --#define projectM_isnan isnan -+#include -+#define projectM_isnan std::isnan - - #endif - -diff -x '*orig' -rup a/MilkdropPresetFactory/Parser.cpp b/MilkdropPresetFactory/Parser.cpp ---- a/MilkdropPresetFactory/Parser.cpp 2012-05-20 04:43:26.000000000 +0100 -+++ b/MilkdropPresetFactory/Parser.cpp 2016-03-17 05:00:14.177905556 +0000 -@@ -1406,7 +1406,7 @@ PerFrameEqn * Parser::parse_implicit_per - PerFrameEqn * per_frame_eqn; - GenExpr * gen_expr; - -- if (fs == NULL) -+ if (!fs) - return NULL; - if (param_string == NULL) - return NULL; -@@ -1561,7 +1561,7 @@ InitCond * Parser::parse_per_frame_init_ - - if (preset == NULL) - return NULL; -- if (fs == NULL) -+ if (!fs) - return NULL; - - if ((token = parseToken(fs, name)) != tEq) -@@ -1875,7 +1875,7 @@ int Parser::parse_shapecode(char * token - /* Null argument checks */ - if (preset == NULL) - return PROJECTM_FAILURE; -- if (fs == NULL) -+ if (!fs) - return PROJECTM_FAILURE; - if (token == NULL) - return PROJECTM_FAILURE; -@@ -2166,7 +2166,7 @@ int Parser::parse_wave(char * token, std - - if (token == NULL) - return PROJECTM_FAILURE; -- if (fs == NULL) -+ if (!fs) - return PROJECTM_FAILURE; - if (preset == NULL) - return PROJECTM_FAILURE; -@@ -2348,7 +2348,7 @@ int Parser::parse_shape(char * token, st - if (token == NULL) - - return PROJECTM_FAILURE; -- if (fs == NULL) -+ if (!fs) - return PROJECTM_FAILURE; - if (preset == NULL) - return PROJECTM_FAILURE; diff --git a/packages/graphics/libraw/package.mk b/packages/graphics/libraw/package.mk new file mode 100644 index 0000000000..ceefca4bd9 --- /dev/null +++ b/packages/graphics/libraw/package.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libraw" +PKG_VERSION="0.18.7" +PKG_SHA256="87e347c261a8e87935d9a23afd750d27676b99f540e8552314d40db0ea315771" +PKG_LICENSE="LGPL" +PKG_SITE="http://www.libraw.org/" +PKG_URL="http://www.libraw.org/data/LibRaw-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libjpeg-turbo" +PKG_LONGDESC="A library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)" +PKG_BUILD_FLAGS="+pic" + +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-openmp \ + --enable-jpeg \ + --disable-jasper \ + --disable-lcms \ + --disable-examples \ + --disable-demosaic-pack-gpl2 \ + --disable-demosaic-pack-gpl3" diff --git a/packages/graphics/libraw/patches/libraw-01-fix-glibc-2.27.patch b/packages/graphics/libraw/patches/libraw-01-fix-glibc-2.27.patch new file mode 100644 index 0000000000..8e289fcd58 --- /dev/null +++ b/packages/graphics/libraw/patches/libraw-01-fix-glibc-2.27.patch @@ -0,0 +1,340 @@ +From 158398653a14e8b5884d744ec711ba31a8ceafdc Mon Sep 17 00:00:00 2001 +From: Alex Tutubalin +Date: Fri, 2 Feb 2018 08:31:47 +0300 +Subject: [PATCH] powf64=>libraw_powf64 + +--- + internal/dcraw_common.cpp | 98 +++++++++++++++++++++++------------------------ + 2 files changed, 98 insertions(+), 98 deletions(-) + +diff --git a/internal/dcraw_common.cpp b/internal/dcraw_common.cpp +index a9b45db0..66eb08e4 100644 +--- a/internal/dcraw_common.cpp ++++ b/internal/dcraw_common.cpp +@@ -5849,7 +5849,7 @@ static float powf_lim(float a, float b, float limup) + { + return (b>limup || b < -limup)?0.f:powf(a,b); + } +-static float powf64(float a, float b) ++static float libraw_powf64(float a, float b) + { + return powf_lim(a,b,64.f); + } +@@ -5873,7 +5873,7 @@ static float my_roundf(float x) { + static float _CanonConvertAperture(ushort in) + { + if ((in == (ushort)0xffe0) || (in == (ushort)0x7fff)) return 0.0f; +- return powf64(2.0, in/64.0); ++ return libraw_powf64(2.0, in/64.0); + } + + static float _CanonConvertEV (short in) +@@ -6336,21 +6336,21 @@ void CLASS processNikonLensData (uchar *LensData, unsigned len) + if (fabsf(imgdata.lens.makernotes.MinFocal) < 1.1f) + { + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 2]) +- imgdata.lens.makernotes.MinFocal = 5.0f * powf64(2.0f, (float)LensData[i + 2] / 24.0f); ++ imgdata.lens.makernotes.MinFocal = 5.0f * libraw_powf64(2.0f, (float)LensData[i + 2] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 3]) +- imgdata.lens.makernotes.MaxFocal = 5.0f * powf64(2.0f, (float)LensData[i + 3] / 24.0f); ++ imgdata.lens.makernotes.MaxFocal = 5.0f * libraw_powf64(2.0f, (float)LensData[i + 3] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 4]) +- imgdata.lens.makernotes.MaxAp4MinFocal = powf64(2.0f, (float)LensData[i + 4] / 24.0f); ++ imgdata.lens.makernotes.MaxAp4MinFocal = libraw_powf64(2.0f, (float)LensData[i + 4] / 24.0f); + if ((imgdata.lens.nikon.NikonLensType ^ (uchar)0x01) || LensData[i + 5]) +- imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(2.0f, (float)LensData[i + 5] / 24.0f); ++ imgdata.lens.makernotes.MaxAp4MaxFocal = libraw_powf64(2.0f, (float)LensData[i + 5] / 24.0f); + } + imgdata.lens.nikon.NikonMCUVersion = LensData[i + 6]; + if (i != 2) + { + if ((LensData[i - 1]) && + (fabsf(imgdata.lens.makernotes.CurFocal) < 1.1f)) +- imgdata.lens.makernotes.CurFocal = 5.0f * powf64(2.0f, (float)LensData[i - 1] / 24.0f); +- if (LensData[i + 7]) imgdata.lens.nikon.NikonEffectiveMaxAp = powf64(2.0f, (float)LensData[i + 7] / 24.0f); ++ imgdata.lens.makernotes.CurFocal = 5.0f * libraw_powf64(2.0f, (float)LensData[i - 1] / 24.0f); ++ if (LensData[i + 7]) imgdata.lens.nikon.NikonEffectiveMaxAp = libraw_powf64(2.0f, (float)LensData[i + 7] / 24.0f); + } + imgdata.lens.makernotes.LensID = + (unsigned long long) LensData[i] << 56 | +@@ -6827,13 +6827,13 @@ void CLASS PentaxLensInfo (unsigned id, unsigned len) // tag 0x0207 + if (table_buf[iLensData+9] && + (fabs(imgdata.lens.makernotes.CurFocal) < 0.1f)) + imgdata.lens.makernotes.CurFocal = +- 10*(table_buf[iLensData+9]>>2) * powf64(4, (table_buf[iLensData+9] & 0x03)-2); ++ 10*(table_buf[iLensData+9]>>2) * libraw_powf64(4, (table_buf[iLensData+9] & 0x03)-2); + if (table_buf[iLensData+10] & 0xf0) + imgdata.lens.makernotes.MaxAp4CurFocal = +- powf64(2.0f, (float)((table_buf[iLensData+10] & 0xf0) >>4)/4.0f); ++ libraw_powf64(2.0f, (float)((table_buf[iLensData+10] & 0xf0) >>4)/4.0f); + if (table_buf[iLensData+10] & 0x0f) + imgdata.lens.makernotes.MinAp4CurFocal = +- powf64(2.0f, (float)((table_buf[iLensData+10] & 0x0f) + 10)/4.0f); ++ libraw_powf64(2.0f, (float)((table_buf[iLensData+10] & 0x0f) + 10)/4.0f); + + if (iLensData != 12) + { +@@ -6854,14 +6854,14 @@ void CLASS PentaxLensInfo (unsigned id, unsigned len) // tag 0x0207 + if ((table_buf[iLensData+14] > 1) && + (fabs(imgdata.lens.makernotes.MaxAp4CurFocal) < 0.7f)) + imgdata.lens.makernotes.MaxAp4CurFocal = +- powf64(2.0f, (float)((table_buf[iLensData+14] & 0x7f) -1)/32.0f); ++ libraw_powf64(2.0f, (float)((table_buf[iLensData+14] & 0x7f) -1)/32.0f); + } + else if ((id != 0x12e76) && // K-5 + (table_buf[iLensData+15] > 1) && + (fabs(imgdata.lens.makernotes.MaxAp4CurFocal) < 0.7f)) + { + imgdata.lens.makernotes.MaxAp4CurFocal = +- powf64(2.0f, (float)((table_buf[iLensData+15] & 0x7f) -1)/32.0f); ++ libraw_powf64(2.0f, (float)((table_buf[iLensData+15] & 0x7f) -1)/32.0f); + } + } + free(table_buf); +@@ -7349,11 +7349,11 @@ void CLASS process_Sony_0x9050 (uchar * buf, unsigned id) + { + if (buf[0]) + imgdata.lens.makernotes.MaxAp4CurFocal = +- my_roundf(powf64(2.0f, ((float)SonySubstitution[buf[0]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; ++ my_roundf(libraw_powf64(2.0f, ((float)SonySubstitution[buf[0]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; + + if (buf[1]) + imgdata.lens.makernotes.MinAp4CurFocal = +- my_roundf(powf64(2.0f, ((float)SonySubstitution[buf[1]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; ++ my_roundf(libraw_powf64(2.0f, ((float)SonySubstitution[buf[1]] / 8.0 - 1.06f) / 2.0f)*10.0f) / 10.0f; + } + + if (imgdata.lens.makernotes.CameraMount != LIBRAW_MOUNT_FixedLens) +@@ -7363,7 +7363,7 @@ void CLASS process_Sony_0x9050 (uchar * buf, unsigned id) + lid = SonySubstitution[buf[0x3d]] << 8 | + SonySubstitution[buf[0x3c]]; + imgdata.lens.makernotes.CurAp = +- powf64(2.0f, ((float)lid/256.0f - 16.0f) / 2.0f); ++ libraw_powf64(2.0f, ((float)lid/256.0f - 16.0f) / 2.0f); + } + if (buf[0x105] && + (imgdata.lens.makernotes.LensMount != LIBRAW_MOUNT_Canon_EF) && +@@ -7749,7 +7749,7 @@ void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) + { + unsigned char cc; + fread(&cc, 1, 1, ifp); +- iso_speed = (int)(100.0 * powf64(2.0, (double)(cc) / 12.0 - 5.0)); ++ iso_speed = (int)(100.0 * libraw_powf64(2.0, (double)(cc) / 12.0 - 5.0)); + break; + } + } +@@ -7794,7 +7794,7 @@ void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) + } + break; + case 0x1002: +- imgdata.lens.makernotes.CurAp = powf64(2.0f, getreal(type)/2); ++ imgdata.lens.makernotes.CurAp = libraw_powf64(2.0f, getreal(type)/2); + break; + case 0x20100102: + stmread(imgdata.shootinginfo.InternalBodySerial, len, ifp); +@@ -7821,10 +7821,10 @@ void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) + stmread(imgdata.lens.makernotes.Lens,len, ifp); + break; + case 0x20100205: +- imgdata.lens.makernotes.MaxAp4MinFocal = powf64(sqrt(2.0f), get2() / 256.0f); ++ imgdata.lens.makernotes.MaxAp4MinFocal = libraw_powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100206: +- imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(sqrt(2.0f), get2() / 256.0f); ++ imgdata.lens.makernotes.MaxAp4MaxFocal = libraw_powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100207: + imgdata.lens.makernotes.MinFocal = (float)get2(); +@@ -7835,7 +7835,7 @@ void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) + imgdata.lens.makernotes.MaxFocal = imgdata.lens.makernotes.MinFocal; + break; + case 0x2010020a: +- imgdata.lens.makernotes.MaxAp4CurFocal = powf64(sqrt(2.0f), get2() / 256.0f); ++ imgdata.lens.makernotes.MaxAp4CurFocal = libraw_powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100301: + imgdata.lens.makernotes.TeleconverterID = fgetc(ifp) << 8; +@@ -8144,7 +8144,7 @@ void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer) + lid = (((ushort)table_buf[2])<<8) | + ((ushort)table_buf[3]); + imgdata.lens.makernotes.CurAp = +- powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); ++ libraw_powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); + } + break; + case 1536: +@@ -8675,7 +8675,7 @@ void CLASS parse_makernote (int base, int uptag) + } + break; + case 0x1002: +- imgdata.lens.makernotes.CurAp = powf64(2.0f, getreal(type)/2); ++ imgdata.lens.makernotes.CurAp = libraw_powf64(2.0f, getreal(type)/2); + break; + case 0x20401112: + imgdata.makernotes.olympus.OlympusCropID = get2(); +@@ -8709,10 +8709,10 @@ void CLASS parse_makernote (int base, int uptag) + stmread(imgdata.lens.makernotes.Lens, len, ifp); + break; + case 0x20100205: +- imgdata.lens.makernotes.MaxAp4MinFocal = powf64(sqrt(2.0f), get2() / 256.0f); ++ imgdata.lens.makernotes.MaxAp4MinFocal = libraw_powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100206: +- imgdata.lens.makernotes.MaxAp4MaxFocal = powf64(sqrt(2.0f), get2() / 256.0f); ++ imgdata.lens.makernotes.MaxAp4MaxFocal = libraw_powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100207: + imgdata.lens.makernotes.MinFocal = (float)get2(); +@@ -8723,7 +8723,7 @@ void CLASS parse_makernote (int base, int uptag) + imgdata.lens.makernotes.MaxFocal = imgdata.lens.makernotes.MinFocal; + break; + case 0x2010020a: +- imgdata.lens.makernotes.MaxAp4CurFocal = powf64(sqrt(2.0f), get2() / 256.0f); ++ imgdata.lens.makernotes.MaxAp4CurFocal = libraw_powf64(sqrt(2.0f), get2() / 256.0f); + break; + case 0x20100301: + imgdata.lens.makernotes.TeleconverterID = fgetc(ifp) << 8; +@@ -9150,7 +9150,7 @@ void CLASS parse_makernote (int base, int uptag) + lid = (((ushort)table_buf[2])<<8) | + ((ushort)table_buf[3]); + imgdata.lens.makernotes.CurAp = +- powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); ++ libraw_powf64(2.0f, ((float)lid/8.0f-1.0f)/2.0f); + } + break; + case 1536: +@@ -9248,19 +9248,19 @@ void CLASS parse_makernote (int base, int uptag) + { + unsigned char cc; + fread(&cc,1,1,ifp); +- iso_speed = int(100.0 * powf64(2.0f,float(cc)/12.0-5.0)); ++ iso_speed = int(100.0 * libraw_powf64(2.0f,float(cc)/12.0-5.0)); + } + if (tag == 4 && len > 26 && len < 35) { + if ((i=(get4(),get2())) != 0x7fff && (!iso_speed || iso_speed == 65535)) +- iso_speed = 50 * powf64(2.0, i/32.0 - 4); ++ iso_speed = 50 * libraw_powf64(2.0, i/32.0 - 4); + #ifdef LIBRAW_LIBRARY_BUILD + get4(); + #else + if ((i=(get2(),get2())) != 0x7fff && !aperture) +- aperture = powf64(2.0, i/64.0); ++ aperture = libraw_powf64(2.0, i/64.0); + #endif + if ((i=get2()) != 0xffff && !shutter) +- shutter = powf64(2.0, (short) i/-32.0); ++ shutter = libraw_powf64(2.0, (short) i/-32.0); + wbi = (get2(),get2()); + shot_order = (get2(),get2()); + } +@@ -9854,7 +9854,7 @@ void CLASS parse_exif (int base) + imgdata.lens.Lens[0] = 0; + break; + case 0x9205: +- imgdata.lens.EXIF_MaxAp = powf64(2.0f, (getreal(type) / 2.0f)); ++ imgdata.lens.EXIF_MaxAp = libraw_powf64(2.0f, (getreal(type) / 2.0f)); + break; + #endif + case 33434: tiff_ifd[tiff_nifds-1].t_shutter = +@@ -9869,11 +9869,11 @@ void CLASS parse_exif (int base) + case 36868: get_timestamp(0); break; + case 37377: if ((expo = -getreal(type)) < 128 && shutter == 0.) + tiff_ifd[tiff_nifds-1].t_shutter = +- shutter = powf64(2.0, expo); ++ shutter = libraw_powf64(2.0, expo); + break; + case 37378: // 0x9202 ApertureValue + if ((fabs(ape = getreal(type))<256.0) && (!aperture)) +- aperture = powf64(2.0, ape/2); ++ aperture = libraw_powf64(2.0, ape/2); + break; + case 37385: flash_used = getreal(type); break; + case 37386: focal_len = getreal(type); break; +@@ -10769,7 +10769,7 @@ int CLASS parse_tiff_ifd (int base) + imgdata.lens.Lens[0] = 0; + break; + case 0x9205: +- imgdata.lens.EXIF_MaxAp = powf64(2.0f, (getreal(type) / 2.0f)); ++ imgdata.lens.EXIF_MaxAp = libraw_powf64(2.0f, (getreal(type) / 2.0f)); + break; + // IB end + #endif +@@ -11804,22 +11804,22 @@ void CLASS parse_ciff (int offset, int length, int depth) + thumb_length = len; + } + if (type == 0x1818) { +- shutter = powf64(2.0f, -int_to_float((get4(),get4()))); +- aperture = powf64(2.0f, int_to_float(get4())/2); ++ shutter = libraw_powf64(2.0f, -int_to_float((get4(),get4()))); ++ aperture = libraw_powf64(2.0f, int_to_float(get4())/2); + #ifdef LIBRAW_LIBRARY_BUILD + imgdata.lens.makernotes.CurAp = aperture; + #endif + } + if (type == 0x102a) { + // iso_speed = pow (2.0, (get4(),get2())/32.0 - 4) * 50; +- iso_speed = powf64(2.0f, ((get2(),get2()) + get2())/32.0f - 5.0f) * 100.0f; ++ iso_speed = libraw_powf64(2.0f, ((get2(),get2()) + get2())/32.0f - 5.0f) * 100.0f; + #ifdef LIBRAW_LIBRARY_BUILD + aperture = _CanonConvertAperture((get2(),get2())); + imgdata.lens.makernotes.CurAp = aperture; + #else +- aperture = powf64(2.0, (get2(),(short)get2())/64.0); ++ aperture = libraw_powf64(2.0, (get2(),(short)get2())/64.0); + #endif +- shutter = powf64(2.0,-((short)get2())/32.0); ++ shutter = libraw_powf64(2.0,-((short)get2())/32.0); + wbi = (get2(),get2()); + if (wbi > 17) wbi = 0; + fseek (ifp, 32, SEEK_CUR); +@@ -12024,8 +12024,8 @@ void CLASS parse_phase_one (int base) + setPhaseOneFeatures(unique_id); + break; + case 0x0401: +- if (type == 4) imgdata.lens.makernotes.CurAp = powf64(2.0f, (int_to_float(data)/2.0f)); +- else imgdata.lens.makernotes.CurAp = powf64(2.0f, (getreal(type)/2.0f)); ++ if (type == 4) imgdata.lens.makernotes.CurAp = libraw_powf64(2.0f, (int_to_float(data)/2.0f)); ++ else imgdata.lens.makernotes.CurAp = libraw_powf64(2.0f, (getreal(type)/2.0f)); + break; + case 0x0403: + if (type == 4) imgdata.lens.makernotes.CurFocal = int_to_float(data); +@@ -12039,16 +12039,16 @@ void CLASS parse_phase_one (int base) + break; + case 0x0414: + if (type == 4) { +- imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, (int_to_float(data)/2.0f)); ++ imgdata.lens.makernotes.MaxAp4CurFocal = libraw_powf64(2.0f, (int_to_float(data)/2.0f)); + } else { +- imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, (getreal(type) / 2.0f)); ++ imgdata.lens.makernotes.MaxAp4CurFocal = libraw_powf64(2.0f, (getreal(type) / 2.0f)); + } + break; + case 0x0415: + if (type == 4) { +- imgdata.lens.makernotes.MinAp4CurFocal = powf64(2.0f, (int_to_float(data)/2.0f)); ++ imgdata.lens.makernotes.MinAp4CurFocal = libraw_powf64(2.0f, (int_to_float(data)/2.0f)); + } else { +- imgdata.lens.makernotes.MinAp4CurFocal = powf64(2.0f, (getreal(type) / 2.0f)); ++ imgdata.lens.makernotes.MinAp4CurFocal = libraw_powf64(2.0f, (getreal(type) / 2.0f)); + } + break; + case 0x0416: +@@ -14237,15 +14237,15 @@ void CLASS identify() + case 18: iso_speed = 320; break; + case 19: iso_speed = 400; break; + } +- shutter = powf64(2.0f, (((float)get4())/8.0f)) / 16000.0f; ++ shutter = libraw_powf64(2.0f, (((float)get4())/8.0f)) / 16000.0f; + FORC4 cam_mul[c ^ (c >> 1)] = get4(); + fseek (ifp, 88, SEEK_SET); +- aperture = powf64(2.0f, ((float)get4())/16.0f); ++ aperture = libraw_powf64(2.0f, ((float)get4())/16.0f); + fseek (ifp, 112, SEEK_SET); + focal_len = get4(); + #ifdef LIBRAW_LIBRARY_BUILD + fseek (ifp, 104, SEEK_SET); +- imgdata.lens.makernotes.MaxAp4CurFocal = powf64(2.0f, ((float)get4())/16.0f); ++ imgdata.lens.makernotes.MaxAp4CurFocal = libraw_powf64(2.0f, ((float)get4())/16.0f); + fseek (ifp, 124, SEEK_SET); + stmread(imgdata.lens.makernotes.Lens, 32, ifp); + imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Contax_N; diff --git a/packages/graphics/mesa/package.mk b/packages/graphics/mesa/package.mk index 9254954b6c..f67e597225 100644 --- a/packages/graphics/mesa/package.mk +++ b/packages/graphics/mesa/package.mk @@ -1,119 +1,105 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mesa" -PKG_VERSION="13.0.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="18.3.2" +PKG_SHA256="e9760ff8f0a6700c395705181ee997cd4fcb6f492143f2d52965ca63bca7139f" PKG_LICENSE="OSS" PKG_SITE="http://www.mesa3d.org/" -PKG_URL="ftp://freedesktop.org/pub/mesa/${PKG_VERSION%-*}/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain Python:host expat glproto dri2proto presentproto libdrm libXext libXdamage libXfixes libXxf86vm libxcb libX11 systemd dri3proto libxshmfence libressl" -PKG_SECTION="graphics" -PKG_SHORTDESC="mesa: 3-D graphics library with OpenGL API" -PKG_LONGDESC="Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax or state machine, it is being used with authorization from Silicon Graphics, Inc. However, the author makes no claim that Mesa is in any way a compatible replacement for OpenGL or associated with Silicon Graphics, Inc. Those who want a licensed implementation of OpenGL should contact a licensed vendor. While Mesa is not a licensed OpenGL implementation, it is currently being tested with the OpenGL conformance tests. For the current conformance status see the CONFORM file included in the Mesa distribution." +PKG_URL="https://github.com/mesa3d/mesa/archive/mesa-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain expat libdrm Mako:host" +PKG_LONGDESC="Mesa is a 3-D graphics library with an API." +PKG_TOOLCHAIN="meson" +PKG_BUILD_FLAGS="+lto" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +get_graphicdrivers -# configure GPU drivers and dependencies: - get_graphicdrivers +PKG_MESON_OPTS_TARGET="-Ddri-drivers=$DRI_DRIVERS \ + -Dgallium-drivers=$GALLIUM_DRIVERS \ + -Dgallium-extra-hud=false \ + -Dgallium-xvmc=false \ + -Dgallium-omx=disabled \ + -Dgallium-nine=false \ + -Dgallium-opencl=disabled \ + -Dvulkan-drivers= \ + -Dshader-cache=true \ + -Dshared-glapi=true \ + -Dopengl=true \ + -Dgbm=true \ + -Degl=true \ + -Dglvnd=false \ + -Dasm=true \ + -Dvalgrind=false \ + -Dlibunwind=false \ + -Dlmsensors=false \ + -Dbuild-tests=false \ + -Dselinux=false \ + -Dosmesa=none" + +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xorgproto libXext libXdamage libXfixes libXxf86vm libxcb libX11 libxshmfence libXrandr" + export X11_INCLUDES= + PKG_MESON_OPTS_TARGET+=" -Dplatforms=x11,drm -Ddri3=true -Dglx=dri" +elif [ "$DISPLAYSERVER" = "weston" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET wayland wayland-protocols" + PKG_MESON_OPTS_TARGET+=" -Dplatforms=wayland,drm -Ddri3=false -Dglx=disabled" +else + PKG_MESON_OPTS_TARGET+=" -Dplatforms=drm -Ddri3=false -Dglx=disabled" +fi if [ "$LLVM_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET elfutils llvm" export LLVM_CONFIG="$SYSROOT_PREFIX/usr/bin/llvm-config-host" - MESA_GALLIUM_LLVM="--enable-gallium-llvm --enable-llvm-shared-libs" + PKG_MESON_OPTS_TARGET+=" -Dllvm=true" else - MESA_GALLIUM_LLVM="--disable-gallium-llvm" + PKG_MESON_OPTS_TARGET+=" -Dllvm=false" fi if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" - MESA_VDPAU="--enable-vdpau" + PKG_MESON_OPTS_TARGET+=" -Dgallium-vdpau=true" +else + PKG_MESON_OPTS_TARGET+=" -Dgallium-vdpau=false" +fi + +if [ "$VAAPI_SUPPORT" = "yes" ] && listcontains "$GRAPHIC_DRIVERS" "(r600|radeonsi)"; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva" + PKG_MESON_OPTS_TARGET+=" -Dgallium-va=true" else - MESA_VDPAU="--disable-vdpau" + PKG_MESON_OPTS_TARGET+=" -Dgallium-va=false" fi -XA_CONFIG="--disable-xa" -for drv in $GRAPHIC_DRIVERS; do - [ "$drv" = "vmware" ] && XA_CONFIG="--enable-xa" -done +if listcontains "$GRAPHIC_DRIVERS" "vmware"; then + PKG_MESON_OPTS_TARGET+=" -Dgallium-xa=true" +else + PKG_MESON_OPTS_TARGET+=" -Dgallium-xa=false" +fi if [ "$OPENGLES_SUPPORT" = "yes" ]; then - MESA_GLES="--enable-gles2" + PKG_MESON_OPTS_TARGET+=" -Dgles1=false -Dgles2=true" else - MESA_GLES="--disable-gles2" + PKG_MESON_OPTS_TARGET+=" -Dgles1=false -Dgles2=false" fi - -PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ - CXX_FOR_BUILD=$HOST_CXX \ - CFLAGS_FOR_BUILD= \ - CXXFLAGS_FOR_BUILD= \ - LDFLAGS_FOR_BUILD= \ - X11_INCLUDES= \ - DRI_DRIVER_INSTALL_DIR=$XORG_PATH_DRI \ - DRI_DRIVER_SEARCH_DIR=$XORG_PATH_DRI \ - --disable-debug \ - --disable-mangling \ - --enable-texture-float \ - --enable-asm \ - --disable-selinux \ - --enable-opengl \ - --disable-gles1 \ - $MESA_GLES \ - --enable-dri \ - --enable-dri3 \ - --enable-glx \ - --disable-osmesa \ - --disable-gallium-osmesa \ - --enable-egl --with-egl-platforms=x11,drm \ - $XA_CONFIG \ - --enable-gbm \ - --disable-nine \ - --disable-xvmc \ - $MESA_VDPAU \ - --disable-omx \ - --disable-va \ - --disable-opencl \ - --enable-opencl-icd \ - --disable-gallium-tests \ - --enable-shared-glapi \ - --enable-shader-cache \ - --enable-driglx-direct \ - --enable-glx-tls \ - $MESA_GALLIUM_LLVM \ - --disable-silent-rules \ - --with-gl-lib-name=GL \ - --with-osmesa-lib-name=OSMesa \ - --with-gallium-drivers=$GALLIUM_DRIVERS \ - --with-dri-drivers=$DRI_DRIVERS \ - --with-vulkan-drivers=no \ - --with-sysroot=$SYSROOT_PREFIX" +# Temporary workaround: +# Listed libraries are static, while mesa expects shared ones. This breaks the +# dependency tracking. The following has some ideas on how to address that. +# https://github.com/LibreELEC/LibreELEC.tv/pull/2163 pre_configure_target() { - export LIBS="-lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence -lz" + if [ "$DISPLAYSERVER" = "x11" ]; then + export LIBS="-lxcb-dri3 -lxcb-dri2 -lxcb-xfixes -lxcb-present -lxcb-sync -lxshmfence -lz" + fi } post_makeinstall_target() { - # rename and relink for cooperate with nvidia drivers + # Similar hack is needed on EGL, GLES* front. Might as well drop it and test the GLVND? + if [ "$DISPLAYSERVER" = "x11" ]; then + # rename and relink for cooperate with nvidia drivers rm -rf $INSTALL/usr/lib/libGL.so rm -rf $INSTALL/usr/lib/libGL.so.1 ln -sf libGL.so.1 $INSTALL/usr/lib/libGL.so ln -sf /var/lib/libGL.so $INSTALL/usr/lib/libGL.so.1 mv $INSTALL/usr/lib/libGL.so.1.2.0 $INSTALL/usr/lib/libGL_mesa.so.1 + fi } diff --git a/packages/graphics/opengl-mali/package.mk b/packages/graphics/opengl-mali/package.mk index bf3bffb880..ce009109d6 100644 --- a/packages/graphics/opengl-mali/package.mk +++ b/packages/graphics/opengl-mali/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="opengl-mali" PKG_VERSION="20130520" -PKG_REV="1" +PKG_SHA256="4832c8b56fa2b844ff5ead96185a83e08731767062ed711b86fd70543211a9db" PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.arm.com/products/multimedia/mali-graphics-hardware/mali-400-mp.php" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="opengl-mali: OpenGL-ES and Mali driver for Mali 400 GPUs" PKG_LONGDESC="opengl-mali: OpenGL-ES and Mali driver for Mali 400 GPUs" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - make_target() { : # nothing todo } @@ -51,4 +31,3 @@ makeinstall_target() { ln -sf libGLESv1_CM.so.1.1 $INSTALL/usr/lib/libGLESv1_CM.so ln -sf libGLESv2.so.2.0 $INSTALL/usr/lib/libGLESv2.so } - diff --git a/packages/graphics/opengl-meson/package.mk b/packages/graphics/opengl-meson/package.mk index 5fb536a449..e7af48e2cf 100644 --- a/packages/graphics/opengl-meson/package.mk +++ b/packages/graphics/opengl-meson/package.mk @@ -1,49 +1,32 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="opengl-meson" -PKG_REV="1" PKG_ARCH="arm aarch64" PKG_LICENSE="nonfree" PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/filesystem/" case $MESON_FAMILY in 8) - PKG_VERSION="8-r5p1-01rel0-armhf" + PKG_VERSION="8-r5p1-02rel0-armhf" + PKG_SHA256="717739c9f65f6782e3185aad09d01f228873315f70f9a58c0526b9e63a6e386f" ;; 6) - PKG_VERSION="6-r5p1-01rel0-armhf" + PKG_VERSION="6-r5p1-02rel0-armhf" + PKG_SHA256="de38a1fa23191bd5de5c85c66627d4537775ee4634b71baa8d0e241b8b9d4ba2" ;; gxbb) - PKG_VERSION="gxbb-r5p1-01rel0" - ;; + if [ "$TARGET_ARCH" = "arm" ]; then + PKG_VERSION="8-r5p1-02rel0-armhf" + PKG_SHA256="717739c9f65f6782e3185aad09d01f228873315f70f9a58c0526b9e63a6e386f" + else + PKG_VERSION="gxbb-r5p1-01rel0" + fi +;; esac PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="graphics" -PKG_SHORTDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs" -PKG_LONGDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs. The libraries could be found in a Linux buildroot released by Amlogic at http://openlinux.amlogic.com:8000/download/ARM/filesystem/. See the opengl package." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} +PKG_LONGDESC="OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs." +PKG_TOOLCHAIN="manual" makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/include diff --git a/packages/graphics/soil/package.mk b/packages/graphics/soil/package.mk index 072201f145..1c6f5d87f0 100644 --- a/packages/graphics/soil/package.mk +++ b/packages/graphics/soil/package.mk @@ -1,39 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="soil" PKG_VERSION="1.16" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="5f2d8a8c78e81d29df07f0f97c34fa2f75187bcadfdc7222cbd026859acaff2f" PKG_LICENSE="CCPL" PKG_SITE="http://www.lonesock.net/soil.html" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain mesa" -PKG_SECTION="graphics" -PKG_SHORTDESC="A tiny C lib primarily for loading textures into OpenGL" PKG_LONGDESC="A tiny C lib primarily for loading textures into OpenGL" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" pre_make_target() { sed "s/1.07-20071110/$PKG_VERSION/" -i Makefile - export CFLAGS="$CFLAGS -fPIC" } pre_makeinstall_target() { diff --git a/packages/graphics/tiff/package.mk b/packages/graphics/tiff/package.mk index 1f81cf4014..31ba78ecb4 100644 --- a/packages/graphics/tiff/package.mk +++ b/packages/graphics/tiff/package.mk @@ -19,7 +19,6 @@ PKG_NAME="tiff" #PKG_VERSION="4.0.3" PKG_VERSION="3.9.7" -PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.remotesensing.org/libtiff/" diff --git a/packages/graphics/vsxu/package.mk b/packages/graphics/vsxu/package.mk index b9ac28b7db..54e015dc09 100644 --- a/packages/graphics/vsxu/package.mk +++ b/packages/graphics/vsxu/package.mk @@ -1,44 +1,27 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="vsxu" PKG_VERSION="0.5.1" -PKG_REV="1" +PKG_SHA256="6707b230ba6cb28c5b19ec6163722b801dd30afed8f966b57e188761b4d54b8e" PKG_ARCH="i386 x86_64" PKG_LICENSE="GPL" PKG_SITE="http://www.vsxu.com" # repackaged from https://github.com/vovoid/vsxu/archive/$PKG_VERSION.tar.gz PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain $OPENGL libX11 glew glfw zlib libpng libjpeg-turbo freetype" -PKG_SECTION="multimedia" -PKG_SHORTDESC="vsxu:" -PKG_LONGDESC="vsxu:" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -export LDFLAGS="$LDFLAGS -lX11" +PKG_LONGDESC="an OpenGL-based programming environment to visualize music and create graphic effects" PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=0 \ -DVSXU_STATIC=1 \ -DCMAKE_POSITION_INDEPENDENT_CODE=1 \ -DCMAKE_CXX_FLAGS=-I$SYSROOT_PREFIX/usr/include/freetype2" +pre_configure_target(){ + export LDFLAGS="$LDFLAGS -lX11" +} + post_makeinstall_target() { mkdir -p $SYSROOT_PREFIX/usr/lib/vsxu cp -PR $INSTALL/usr/lib/* $SYSROOT_PREFIX/usr/lib diff --git a/packages/lang/Python/package.mk b/packages/lang/Python/package.mk deleted file mode 100644 index ebc90abeae..0000000000 --- a/packages/lang/Python/package.mk +++ /dev/null @@ -1,135 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="Python" -PKG_VERSION="2.7.13" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.python.org/" -PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_HOST="zlib:host bzip2:host sqlite:host" -PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 libressl libffi Python:host" -PKG_SECTION="lang" -PKG_SHORTDESC="python: The Python programming language" -PKG_LONGDESC="Python is an interpreted object-oriented programming language, and is often compared with Tcl, Perl, Java or Scheme." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PY_DISABLED_MODULES="_tkinter nis gdbm bsddb ossaudiodev" - -PKG_CONFIGURE_OPTS_HOST="--cache-file=config.cache \ - --without-cxx-main \ - --with-threads \ - --enable-unicode=ucs4" - -PKG_CONFIGURE_OPTS_TARGET="ac_cv_file_dev_ptc=no \ - ac_cv_file_dev_ptmx=yes \ - ac_cv_func_lchflags_works=no \ - ac_cv_func_chflags_works=no \ - ac_cv_func_printf_zd=yes \ - ac_cv_buggy_getaddrinfo=no \ - ac_cv_header_bluetooth_bluetooth_h=no \ - ac_cv_header_bluetooth_h=no \ - ac_cv_file__dev_ptmx=no \ - ac_cv_file__dev_ptc=no \ - ac_cv_have_long_long_format=yes \ - --with-threads \ - --enable-unicode=ucs4 \ - --enable-ipv6 \ - --disable-profiling \ - --without-pydebug \ - --without-doc-strings \ - --without-tsc \ - --with-pymalloc \ - --without-fpectl \ - --with-wctype-functions \ - --without-cxx-main \ - --with-system-ffi \ - --with-system-expat" -post_patch() { - # This is needed to make sure the Python build process doesn't try to - # regenerate those files with the pgen program. Otherwise, it builds - # pgen for the target, and tries to run it on the host. - touch $PKG_BUILD/Include/graminit.h - touch $PKG_BUILD/Python/graminit.c -} - -make_host() { - make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \ - PYTHON_MODULES_LIB="$HOST_LIBDIR" \ - PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PY_DISABLED_MODULES" - - # python distutils per default adds -L$LIBDIR when linking binary extensions - sed -e "s|^ 'LIBDIR':.*| 'LIBDIR': '/usr/lib',|g" -i $(cat pybuilddir.txt)/_sysconfigdata.py -} - -makeinstall_host() { - make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \ - PYTHON_MODULES_LIB="$HOST_LIBDIR" \ - PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PY_DISABLED_MODULES" \ - install -} - -pre_configure_target() { - export PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python -} - -make_target() { - make -j1 CC="$CC" LDFLAGS="$TARGET_LDFLAGS -L." \ - PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \ - PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \ - PYTHON_MODULES_LIB="$TARGET_LIBDIR" -} - -makeinstall_target() { - make -j1 CC="$CC" DESTDIR=$SYSROOT_PREFIX \ - PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \ - PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \ - PYTHON_MODULES_LIB="$TARGET_LIBDIR" \ - install - - make -j1 CC="$CC" DESTDIR=$INSTALL \ - PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \ - PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \ - PYTHON_MODULES_LIB="$TARGET_LIBDIR" \ - install -} - -post_makeinstall_target() { - EXCLUDE_DIRS="bsddb idlelib lib-tk lib2to3 msilib pydoc_data test unittest" - for dir in $EXCLUDE_DIRS; do - rm -rf $INSTALL/usr/lib/python*/$dir - done - - rm -rf $INSTALL/usr/lib/python*/config - rm -rf $INSTALL/usr/bin/2to3 - rm -rf $INSTALL/usr/bin/idle - rm -rf $INSTALL/usr/bin/pydoc - rm -rf $INSTALL/usr/bin/smtpd.py - rm -rf $INSTALL/usr/bin/python*-config - - cd $INSTALL/usr/lib/python2.7 - python -Wi -t -B $ROOT/$PKG_BUILD/Lib/compileall.py -d /usr/lib/python2.7 -f . - find $INSTALL/usr/lib/python2.7 -name "*.py" -exec rm -f {} \; &>/dev/null - - # strip - chmod u+w $INSTALL/usr/lib/libpython*.so.* - debug_strip $INSTALL/usr -} diff --git a/packages/lang/Python/patches/Python-2.7.11-010-fix-python-config.patch b/packages/lang/Python/patches/Python-2.7.11-010-fix-python-config.patch deleted file mode 100644 index 7843c78b9a..0000000000 --- a/packages/lang/Python/patches/Python-2.7.11-010-fix-python-config.patch +++ /dev/null @@ -1,208 +0,0 @@ -Add a backport of http://bugs.python.org/issue16235 so we can use -python-config for cross builds. -This basically replaces the python version of python-config with a pure-shell -version that's already preprocessed when installed and doesn't depend -on the sysconfig import that usually leads to bad data/results. - -Signed-off-by: Gustavo Zacarias - -Index: b/configure.ac -=================================================================== ---- a/configure.ac -+++ b/configure.ac -@@ -885,6 +885,7 @@ - - # Other platforms follow - if test $enable_shared = "yes"; then -+ PY_ENABLE_SHARED=1 - AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.]) - case $ac_sys_system in - BeOS*) -@@ -945,6 +946,7 @@ - - esac - else # shared is disabled -+ PY_ENABLE_SHARED=0 - case $ac_sys_system in - CYGWIN*) - BLDLIBRARY='$(LIBRARY)' -@@ -1921,6 +1923,9 @@ - AC_SUBST(BLDSHARED) - AC_SUBST(CCSHARED) - AC_SUBST(LINKFORSHARED) -+AC_SUBST(PY_ENABLE_SHARED) -+LIBPL="${prefix}/lib/python${VERSION}/config" -+AC_SUBST(LIBPL) - # SO is the extension of shared libraries `(including the dot!) - # -- usually .so, .sl on HP-UX, .dll on Cygwin - AC_MSG_CHECKING(SO) -@@ -4588,7 +4593,7 @@ - AC_SUBST(ENSUREPIP) - - # generate output files --AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) -+AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh) - AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) - AC_OUTPUT - -Index: b/Makefile.pre.in -=================================================================== ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -166,7 +166,7 @@ - SUBDIRSTOO= Include Lib Misc Demo - - # Files and directories to be distributed --CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in -+CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Misc/python-config.sh - DISTFILES= README ChangeLog $(CONFIGFILES) - DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy - DIST= $(DISTFILES) $(DISTDIRS) -@@ -410,7 +410,7 @@ - - # Default target - all: @DEF_MAKE_ALL_RULE@ --build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks -+build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks python-config - - # Compile a binary with gcc profile guided optimization. - profile-opt: -@@ -1101,10 +1101,12 @@ - fi; \ - cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen - --python-config: $(srcdir)/Misc/python-config.in -+python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh - # Substitution happens here, as the completely-expanded BINDIR - # is not available in configure -- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config -+ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py -+ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} -+ sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' Misc/python-config.sh >python-config - - # Install the include files - INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) -@@ -1163,7 +1165,7 @@ - $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup - $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh - $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config -- rm python-config -+ $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py - @if [ -s Modules/python.exp -a \ - "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ - echo; echo "Installing support files for building shared extension modules on AIX:"; \ -@@ -1345,6 +1347,7 @@ - config.cache config.log pyconfig.h Modules/config.c - -rm -rf build platform - -rm -rf $(PYTHONFRAMEWORKDIR) -+ -rm -f python-config.py python-config - - # Make things extra clean, before making a distribution: - # remove all generated files, even Makefile[.pre] -Index: b/Misc/python-config.sh.in -=================================================================== ---- /dev/null -+++ b/Misc/python-config.sh.in -@@ -0,0 +1,102 @@ -+#!/bin/sh -+ -+exit_with_usage () -+{ -+ echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--configdir" -+ exit $1 -+} -+ -+if [ "$1" = "" ] ; then -+ exit_with_usage 1 -+fi -+ -+# Returns the actual prefix where this script was installed to. -+installed_prefix () -+{ -+ RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) -+ if which readlink >/dev/null 2>&1 ; then -+ RESULT=$(readlink -f "$RESULT") -+ fi -+ echo $RESULT -+} -+ -+prefix_build="@prefix@" -+prefix_real=$(installed_prefix "$0") -+ -+# Use sed to fix paths from their built to locations to their installed to locations. -+prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") -+exec_prefix_build="@exec_prefix@" -+exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#") -+includedir=$(echo "@includedir@") -+libdir=$(echo "@libdir@") -+CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#") -+VERSION="@VERSION@" -+LIBM="@LIBM@" -+LIBC="@LIBC@" -+SYSLIBS="$LIBM $LIBC" -+LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}" -+BASECFLAGS="@BASECFLAGS@" -+LDLIBRARY="@LDLIBRARY@" -+LINKFORSHARED="@LINKFORSHARED@" -+OPT="@OPT@" -+PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" -+LDVERSION="@LDVERSION@" -+LIBDEST=${prefix}/lib/python${VERSION} -+LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#") -+SO="@SO@" -+PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" -+INCDIR="-I$includedir/python${VERSION}" -+PLATINCDIR="-I$includedir/python${VERSION}" -+ -+# Scan for --help or unknown argument. -+for ARG in $* -+do -+ case $ARG in -+ --help) -+ exit_with_usage 0 -+ ;; -+ --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir) -+ ;; -+ *) -+ exit_with_usage 1 -+ ;; -+esac -+done -+ -+for ARG in "$@" -+do -+ case "$ARG" in -+ --prefix) -+ echo "$prefix" -+ ;; -+ --exec-prefix) -+ echo "$exec_prefix" -+ ;; -+ --includes) -+ echo "$INCDIR $PLATINCDIR" -+ ;; -+ --cflags) -+ echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT" -+ ;; -+ --libs) -+ echo "$LIBS" -+ ;; -+ --ldflags) -+ LINKFORSHAREDUSED= -+ if [ -z "$PYTHONFRAMEWORK" ] ; then -+ LINKFORSHAREDUSED=$LINKFORSHARED -+ fi -+ LIBPLUSED= -+ if [ "$PY_ENABLE_SHARED" = "0" ] ; then -+ LIBPLUSED="-L$LIBPL" -+ fi -+ echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED" -+ ;; -+ --extension-suffix) -+ echo "$SO" -+ ;; -+ --configdir) -+ echo "$LIBPL" -+ ;; -+esac -+done diff --git a/packages/lang/Python/patches/Python-2.7.11-017-link-curses-module-against-termcap.patch b/packages/lang/Python/patches/Python-2.7.11-017-link-curses-module-against-termcap.patch deleted file mode 100644 index 4d67f9c96c..0000000000 --- a/packages/lang/Python/patches/Python-2.7.11-017-link-curses-module-against-termcap.patch +++ /dev/null @@ -1,241 +0,0 @@ -diff -Naur a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c ---- a/Modules/_cursesmodule.c 2015-12-05 11:47:13.000000000 -0800 -+++ b/Modules/_cursesmodule.c 2016-04-29 01:22:41.271608696 -0700 -@@ -312,7 +312,6 @@ - Window_NoArgNoReturnVoidFunction(wclear) - - Window_OneArgNoReturnVoidFunction(idcok, int, "i;True(1) or False(0)") --Window_OneArgNoReturnVoidFunction(immedok, int, "i;True(1) or False(0)") - Window_OneArgNoReturnVoidFunction(wtimeout, int, "i;delay") - - Window_NoArg2TupleReturnFunction(getyx, int, "ii") -@@ -336,7 +335,6 @@ - Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)") - Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)") - Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines") --Window_OneArgNoReturnFunction(syncok, int, "i;True(1) or False(0)") - - Window_TwoArgNoReturnFunction(mvwin, int, "ii;y,x") - Window_TwoArgNoReturnFunction(mvderwin, int, "ii;y,x") -@@ -1580,7 +1578,6 @@ - {"hline", (PyCFunction)PyCursesWindow_Hline, METH_VARARGS}, - {"idcok", (PyCFunction)PyCursesWindow_idcok, METH_VARARGS}, - {"idlok", (PyCFunction)PyCursesWindow_idlok, METH_VARARGS}, -- {"immedok", (PyCFunction)PyCursesWindow_immedok, METH_VARARGS}, - {"inch", (PyCFunction)PyCursesWindow_InCh, METH_VARARGS}, - {"insch", (PyCFunction)PyCursesWindow_InsCh, METH_VARARGS}, - {"insdelln", (PyCFunction)PyCursesWindow_winsdelln, METH_VARARGS}, -@@ -1618,7 +1615,6 @@ - {"subpad", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS}, - {"subwin", (PyCFunction)PyCursesWindow_SubWin, METH_VARARGS}, - {"syncdown", (PyCFunction)PyCursesWindow_wsyncdown, METH_NOARGS}, -- {"syncok", (PyCFunction)PyCursesWindow_syncok, METH_VARARGS}, - {"syncup", (PyCFunction)PyCursesWindow_wsyncup, METH_NOARGS}, - {"timeout", (PyCFunction)PyCursesWindow_wtimeout, METH_VARARGS}, - {"touchline", (PyCFunction)PyCursesWindow_TouchLine, METH_VARARGS}, -@@ -1693,16 +1689,6 @@ - NoArgNoReturnVoidFunction(noqiflush) - - static PyObject * --PyCurses_filter(PyObject *self) --{ -- /* not checking for PyCursesInitialised here since filter() must -- be called before initscr() */ -- filter(); -- Py_INCREF(Py_None); -- return Py_None; --} -- --static PyObject * - PyCurses_Color_Content(PyObject *self, PyObject *args) - { - short color,r,g,b; -@@ -1772,19 +1758,6 @@ - return PyString_FromStringAndSize(&ch, 1); - } - --static PyObject * --PyCurses_getsyx(PyObject *self) --{ -- int x = 0; -- int y = 0; -- -- PyCursesInitialised; -- -- getsyx(y, x); -- -- return Py_BuildValue("(ii)", y, x); --} -- - #ifdef NCURSES_MOUSE_VERSION - static PyObject * - PyCurses_GetMouse(PyObject *self) -@@ -1855,25 +1828,6 @@ - return PyCursesCheckERR(halfdelay(tenths), "halfdelay"); - } - --#ifndef STRICT_SYSV_CURSES --/* No has_key! */ --static PyObject * PyCurses_has_key(PyObject *self, PyObject *args) --{ -- int ch; -- -- PyCursesInitialised; -- -- if (!PyArg_ParseTuple(args,"i",&ch)) return NULL; -- -- if (has_key(ch) == FALSE) { -- Py_INCREF(Py_False); -- return Py_False; -- } -- Py_INCREF(Py_True); -- return Py_True; --} --#endif /* STRICT_SYSV_CURSES */ -- - static PyObject * - PyCurses_Init_Color(PyObject *self, PyObject *args) - { -@@ -2426,26 +2380,6 @@ - #endif /* HAVE_CURSES_RESIZE_TERM */ - - static PyObject * --PyCurses_setsyx(PyObject *self, PyObject *args) --{ -- int y,x; -- -- PyCursesInitialised; -- -- if (PyTuple_Size(args)!=2) { -- PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments"); -- return NULL; -- } -- -- if (!PyArg_ParseTuple(args, "ii;y, x", &y, &x)) return NULL; -- -- setsyx(y,x); -- -- Py_INCREF(Py_None); -- return Py_None; --} -- --static PyObject * - PyCurses_Start_Color(PyObject *self) - { - int code; -@@ -2539,18 +2473,6 @@ - } - - static PyObject * --PyCurses_TypeAhead(PyObject *self, PyObject *args) --{ -- int fd; -- -- PyCursesInitialised; -- -- if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL; -- -- return PyCursesCheckERR(typeahead( fd ), "typeahead"); --} -- --static PyObject * - PyCurses_UnCtrl(PyObject *self, PyObject *args) - { - PyObject *temp; -@@ -2594,25 +2516,6 @@ - return PyCursesCheckERR(ungetch(ch), "ungetch"); - } - --static PyObject * --PyCurses_Use_Env(PyObject *self, PyObject *args) --{ -- int flag; -- -- switch(PyTuple_Size(args)) { -- case 1: -- if (!PyArg_ParseTuple(args,"i;True(1), False(0)",&flag)) -- return NULL; -- break; -- default: -- PyErr_SetString(PyExc_TypeError, "use_env requires 1 argument"); -- return NULL; -- } -- use_env(flag); -- Py_INCREF(Py_None); -- return Py_None; --} -- - #ifndef STRICT_SYSV_CURSES - static PyObject * - PyCurses_Use_Default_Colors(PyObject *self) -@@ -2650,21 +2553,16 @@ - {"echo", (PyCFunction)PyCurses_echo, METH_VARARGS}, - {"endwin", (PyCFunction)PyCurses_endwin, METH_NOARGS}, - {"erasechar", (PyCFunction)PyCurses_EraseChar, METH_NOARGS}, -- {"filter", (PyCFunction)PyCurses_filter, METH_NOARGS}, - {"flash", (PyCFunction)PyCurses_flash, METH_NOARGS}, - {"flushinp", (PyCFunction)PyCurses_flushinp, METH_NOARGS}, - #ifdef NCURSES_MOUSE_VERSION - {"getmouse", (PyCFunction)PyCurses_GetMouse, METH_NOARGS}, - {"ungetmouse", (PyCFunction)PyCurses_UngetMouse, METH_VARARGS}, - #endif -- {"getsyx", (PyCFunction)PyCurses_getsyx, METH_NOARGS}, - {"getwin", (PyCFunction)PyCurses_GetWin, METH_O}, - {"has_colors", (PyCFunction)PyCurses_has_colors, METH_NOARGS}, - {"has_ic", (PyCFunction)PyCurses_has_ic, METH_NOARGS}, - {"has_il", (PyCFunction)PyCurses_has_il, METH_NOARGS}, --#ifndef STRICT_SYSV_CURSES -- {"has_key", (PyCFunction)PyCurses_has_key, METH_VARARGS}, --#endif - {"halfdelay", (PyCFunction)PyCurses_HalfDelay, METH_VARARGS}, - {"init_color", (PyCFunction)PyCurses_Init_Color, METH_VARARGS}, - {"init_pair", (PyCFunction)PyCurses_Init_Pair, METH_VARARGS}, -@@ -2708,7 +2606,6 @@ - {"resize_term", (PyCFunction)PyCurses_Resize_Term, METH_VARARGS}, - #endif - {"savetty", (PyCFunction)PyCurses_savetty, METH_NOARGS}, -- {"setsyx", (PyCFunction)PyCurses_setsyx, METH_VARARGS}, - {"setupterm", (PyCFunction)PyCurses_setupterm, - METH_VARARGS|METH_KEYWORDS}, - {"start_color", (PyCFunction)PyCurses_Start_Color, METH_NOARGS}, -@@ -2718,10 +2615,8 @@ - {"tigetnum", (PyCFunction)PyCurses_tigetnum, METH_VARARGS}, - {"tigetstr", (PyCFunction)PyCurses_tigetstr, METH_VARARGS}, - {"tparm", (PyCFunction)PyCurses_tparm, METH_VARARGS}, -- {"typeahead", (PyCFunction)PyCurses_TypeAhead, METH_VARARGS}, - {"unctrl", (PyCFunction)PyCurses_UnCtrl, METH_VARARGS}, - {"ungetch", (PyCFunction)PyCurses_UngetCh, METH_VARARGS}, -- {"use_env", (PyCFunction)PyCurses_Use_Env, METH_VARARGS}, - #ifndef STRICT_SYSV_CURSES - {"use_default_colors", (PyCFunction)PyCurses_Use_Default_Colors, METH_NOARGS}, - #endif -diff -Naur a/setup.py b/setup.py ---- a/setup.py 2016-04-28 13:18:03.397008583 -0700 -+++ b/setup.py 2016-04-28 13:28:04.595779984 -0700 -@@ -766,7 +766,7 @@ - else: - readline_extra_link_args = () - -- readline_libs = ['readline'] -+ readline_libs = ['readline', 'termcap'] - if readline_termcap_library: - pass # Issue 7384: Already linked against curses or tinfo. - elif curses_library: -@@ -1359,7 +1359,7 @@ - # Bug 1464056: If _curses.so links with ncursesw, - # _curses_panel.so must link with panelw. - panel_library = 'panelw' -- curses_libs = [curses_library] -+ curses_libs = [curses_library, 'termcap'] - curses_incs = find_file('curses.h', inc_dirs, - [os.path.join(d, 'ncursesw') for d in inc_dirs]) - exts.append( Extension('_curses', ['_cursesmodule.c'], -@@ -1373,7 +1373,7 @@ - elif (self.compiler.find_library_file(lib_dirs, 'termcap')): - curses_libs = ['curses', 'termcap'] - else: -- curses_libs = ['curses'] -+ curses_libs = ['curses', 'termcap'] - - exts.append( Extension('_curses', ['_cursesmodule.c'], - libraries = curses_libs) ) diff --git a/packages/lang/Python2/package.mk b/packages/lang/Python2/package.mk new file mode 100644 index 0000000000..a5e17dae8e --- /dev/null +++ b/packages/lang/Python2/package.mk @@ -0,0 +1,123 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="Python2" +# When changing PKG_VERSION remember to sync PKG_PYTHON_VERSION! +PKG_VERSION="2.7.15" +PKG_SHA256="22d9b1ac5b26135ad2b8c2901a9413537e08749a753356ee913c84dbd2df5574" +PKG_LICENSE="OSS" +PKG_SITE="http://www.python.org/" +PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/${PKG_NAME::-1}-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="zlib:host bzip2:host sqlite:host" +PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 openssl libffi Python2:host" +PKG_LONGDESC="Python2 is an interpreted object-oriented programming language." + +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="-parallel +lto-parallel" + +PKG_PY_DISABLED_MODULES="_tkinter nis gdbm bsddb ossaudiodev" + +PKG_CONFIGURE_OPTS_HOST="--cache-file=config.cache \ + --without-cxx-main \ + --with-threads \ + --enable-unicode=ucs4" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_file_dev_ptc=no \ + ac_cv_file_dev_ptmx=yes \ + ac_cv_func_lchflags_works=no \ + ac_cv_func_chflags_works=no \ + ac_cv_func_printf_zd=yes \ + ac_cv_buggy_getaddrinfo=no \ + ac_cv_header_bluetooth_bluetooth_h=no \ + ac_cv_header_bluetooth_h=no \ + ac_cv_file__dev_ptmx=no \ + ac_cv_file__dev_ptc=no \ + ac_cv_have_long_long_format=yes \ + --with-threads \ + --enable-unicode=ucs4 \ + --enable-ipv6 \ + --disable-profiling \ + --without-pydebug \ + --without-doc-strings \ + --without-tsc \ + --with-pymalloc \ + --without-fpectl \ + --without-cxx-main \ + --with-system-ffi \ + --with-system-expat" +post_patch() { + # This is needed to make sure the Python build process doesn't try to + # regenerate those files with the pgen program. Otherwise, it builds + # pgen for the target, and tries to run it on the host. + touch $PKG_BUILD/Include/graminit.h + touch $PKG_BUILD/Python/graminit.c +} + +make_host() { + make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \ + PYTHON_MODULES_LIB="$HOST_LIBDIR" \ + PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PKG_PY_DISABLED_MODULES" + + # python distutils per default adds -L$LIBDIR when linking binary extensions + sed -e "s|^ 'LIBDIR':.*| 'LIBDIR': '/usr/lib',|g" -i $(cat pybuilddir.txt)/_sysconfigdata.py +} + +makeinstall_host() { + make PYTHON_MODULES_INCLUDE="$HOST_INCDIR" \ + PYTHON_MODULES_LIB="$HOST_LIBDIR" \ + PYTHON_DISABLE_MODULES="readline _curses _curses_panel $PKG_PY_DISABLED_MODULES" \ + install +} + +post_makeinstall_host() { + rm -fr $PKG_BUILD/.$HOST_NAME/build/temp.* +} + +pre_configure_target() { + export PYTHON_FOR_BUILD=$TOOLCHAIN/bin/python +} + +make_target() { + make CC="$CC" LDFLAGS="$TARGET_LDFLAGS -L." \ + PYTHON_DISABLE_MODULES="$PKG_PY_DISABLED_MODULES" \ + PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \ + PYTHON_MODULES_LIB="$TARGET_LIBDIR" +} + +makeinstall_target() { + make CC="$CC" DESTDIR=$SYSROOT_PREFIX \ + PYTHON_DISABLE_MODULES="$PKG_PY_DISABLED_MODULES" \ + PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \ + PYTHON_MODULES_LIB="$TARGET_LIBDIR" \ + install + + make CC="$CC" DESTDIR=$INSTALL \ + PYTHON_DISABLE_MODULES="$PKG_PY_DISABLED_MODULES" \ + PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \ + PYTHON_MODULES_LIB="$TARGET_LIBDIR" \ + install +} + +post_makeinstall_target() { + rm -fr $PKG_BUILD/.$TARGET_NAME/build/temp.* + + for dir in bsddb idlelib lib-tk lib2to3 msilib pydoc_data test unittest; do + rm -rf $INSTALL/usr/lib/python*/$dir + done + + rm -rf $INSTALL/usr/lib/python*/config + rm -rf $INSTALL/usr/bin/2to3 + rm -rf $INSTALL/usr/bin/idle + rm -rf $INSTALL/usr/bin/pydoc + rm -rf $INSTALL/usr/bin/smtpd.py + rm -rf $INSTALL/usr/bin/python*-config + + cd $INSTALL/usr/lib/$PKG_PYTHON_VERSION + $TOOLCHAIN/bin/python -Wi -t -B $PKG_BUILD/Lib/compileall.py -d /usr/lib/$PKG_PYTHON_VERSION -f . + find $INSTALL/usr/lib/$PKG_PYTHON_VERSION -name "*.py" -exec rm -f {} \; &>/dev/null + + # strip + chmod u+w $INSTALL/usr/lib/libpython*.so.* + debug_strip $INSTALL/usr +} diff --git a/packages/lang/Python/patches/Python-2.7.11-001_xcompile.patch b/packages/lang/Python2/patches/Python2-2.7.11-001_xcompile.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-001_xcompile.patch rename to packages/lang/Python2/patches/Python2-2.7.11-001_xcompile.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-002_xcompile_path.patch b/packages/lang/Python2/patches/Python2-2.7.11-002_xcompile_path.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-002_xcompile_path.patch rename to packages/lang/Python2/patches/Python2-2.7.11-002_xcompile_path.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-003_xcompile_disable_modules.patch b/packages/lang/Python2/patches/Python2-2.7.11-003_xcompile_disable_modules.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-003_xcompile_disable_modules.patch rename to packages/lang/Python2/patches/Python2-2.7.11-003_xcompile_disable_modules.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-004_xcompile_fix_libffi_configure.patch b/packages/lang/Python2/patches/Python2-2.7.11-004_xcompile_fix_libffi_configure.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-004_xcompile_fix_libffi_configure.patch rename to packages/lang/Python2/patches/Python2-2.7.11-004_xcompile_fix_libffi_configure.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-005_dont_generate_pyo_and_pyc_files.patch b/packages/lang/Python2/patches/Python2-2.7.11-005_dont_generate_pyo_and_pyc_files.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-005_dont_generate_pyo_and_pyc_files.patch rename to packages/lang/Python2/patches/Python2-2.7.11-005_dont_generate_pyo_and_pyc_files.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-006_fix_ncurse_cppflags.patch b/packages/lang/Python2/patches/Python2-2.7.11-006_fix_ncurse_cppflags.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-006_fix_ncurse_cppflags.patch rename to packages/lang/Python2/patches/Python2-2.7.11-006_fix_ncurse_cppflags.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-008-distutils-use-python-sysroot.patch b/packages/lang/Python2/patches/Python2-2.7.11-008-distutils-use-python-sysroot.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-008-distutils-use-python-sysroot.patch rename to packages/lang/Python2/patches/Python2-2.7.11-008-distutils-use-python-sysroot.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-008-reread-environment.patch b/packages/lang/Python2/patches/Python2-2.7.11-008-reread-environment.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-008-reread-environment.patch rename to packages/lang/Python2/patches/Python2-2.7.11-008-reread-environment.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-009-distutils-rpath.patch b/packages/lang/Python2/patches/Python2-2.7.11-009-distutils-rpath.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-009-distutils-rpath.patch rename to packages/lang/Python2/patches/Python2-2.7.11-009-distutils-rpath.patch diff --git a/packages/lang/Python2/patches/Python2-2.7.11-010-fix-python-config.patch b/packages/lang/Python2/patches/Python2-2.7.11-010-fix-python-config.patch new file mode 100644 index 0000000000..c1cc478dad --- /dev/null +++ b/packages/lang/Python2/patches/Python2-2.7.11-010-fix-python-config.patch @@ -0,0 +1,208 @@ +Add a backport of http://bugs.python.org/issue16235 so we can use +python-config for cross builds. +This basically replaces the python version of python-config with a pure-shell +version that's already preprocessed when installed and doesn't depend +on the sysconfig import that usually leads to bad data/results. + +Signed-off-by: Gustavo Zacarias + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -885,6 +885,7 @@ + + # Other platforms follow + if test $enable_shared = "yes"; then ++ PY_ENABLE_SHARED=1 + AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.]) + case $ac_sys_system in + BeOS*) +@@ -945,6 +946,7 @@ + + esac + else # shared is disabled ++ PY_ENABLE_SHARED=0 + case $ac_sys_system in + CYGWIN*) + BLDLIBRARY='$(LIBRARY)' +@@ -1921,6 +1923,9 @@ + AC_SUBST(BLDSHARED) + AC_SUBST(CCSHARED) + AC_SUBST(LINKFORSHARED) ++AC_SUBST(PY_ENABLE_SHARED) ++LIBPL="${prefix}/lib/python${VERSION}/config" ++AC_SUBST(LIBPL) + # SO is the extension of shared libraries `(including the dot!) + # -- usually .so, .sl on HP-UX, .dll on Cygwin + AC_MSG_CHECKING(SO) +@@ -4588,7 +4593,7 @@ + AC_SUBST(ENSUREPIP) + + # generate output files +-AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) ++AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh) + AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) + AC_OUTPUT + +Index: b/Makefile.pre.in +=================================================================== +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -166,7 +166,7 @@ + SUBDIRSTOO= Include Lib Misc Demo + + # Files and directories to be distributed +-CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in ++CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Misc/python-config.sh + DISTFILES= README ChangeLog $(CONFIGFILES) + DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy + DIST= $(DISTFILES) $(DISTDIRS) +@@ -410,7 +410,7 @@ + + # Default target + all: @DEF_MAKE_ALL_RULE@ +-build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks ++build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks python-config + + # Compile a binary with gcc profile guided optimization. + profile-opt: +@@ -1101,10 +1101,12 @@ + fi; \ + cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen + +-python-config: $(srcdir)/Misc/python-config.in ++python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh + # Substitution happens here, as the completely-expanded BINDIR + # is not available in configure +- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config ++ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py ++ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} ++ sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' Misc/python-config.sh >python-config + + # Install the include files + INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) +@@ -1163,7 +1165,7 @@ + $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup + $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh + $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config +- rm python-config ++ $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py + @if [ -s Modules/python.exp -a \ + "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ + echo; echo "Installing support files for building shared extension modules on AIX:"; \ +@@ -1345,6 +1347,7 @@ + config.cache config.log pyconfig.h Modules/config.c + -rm -rf build platform + -rm -rf $(PYTHONFRAMEWORKDIR) ++ -rm -f python-config.py python-config + + # Make things extra clean, before making a distribution: + # remove all generated files, even Makefile[.pre] +Index: b/Misc/python-config.sh.in +=================================================================== +--- /dev/null ++++ b/Misc/python-config.sh.in +@@ -0,0 +1,102 @@ ++#!/bin/sh ++ ++exit_with_usage () ++{ ++ echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--configdir" ++ exit $1 ++} ++ ++if [ "$1" = "" ] ; then ++ exit_with_usage 1 ++fi ++ ++# Returns the actual prefix where this script was installed to. ++installed_prefix () ++{ ++ RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) ++ if which readlink >/dev/null 2>&1 ; then ++ RESULT=$(readlink -f "$RESULT") ++ fi ++ echo $RESULT ++} ++ ++prefix_build="@prefix@" ++prefix_real=$(installed_prefix "$0") ++ ++# Use sed to fix paths from their built to locations to their installed to locations. ++prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") ++exec_prefix_build="@exec_prefix@" ++exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#") ++includedir=$(echo "@includedir@") ++libdir=$(echo "@libdir@") ++CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#") ++VERSION="@VERSION@" ++LIBM="@LIBM@" ++LIBC="@LIBC@" ++SYSLIBS="$LIBM $LIBC" ++LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}" ++BASECFLAGS="@BASECFLAGS@" ++LDLIBRARY="@LDLIBRARY@" ++LINKFORSHARED="@LINKFORSHARED@" ++OPT="@OPT@" ++PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" ++LDVERSION="@LDVERSION@" ++LIBDEST=${prefix}/lib/python${VERSION} ++LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#") ++SO="@SO@" ++PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" ++INCDIR="-I$includedir/python${VERSION}" ++PLATINCDIR="-I$includedir/python${VERSION}" ++ ++# Scan for --help or unknown argument. ++for ARG in $* ++do ++ case $ARG in ++ --help) ++ exit_with_usage 0 ++ ;; ++ --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir) ++ ;; ++ *) ++ exit_with_usage 1 ++ ;; ++esac ++done ++ ++for ARG in "$@" ++do ++ case "$ARG" in ++ --prefix) ++ echo "$prefix" ++ ;; ++ --exec-prefix) ++ echo "$exec_prefix" ++ ;; ++ --includes) ++ echo "$INCDIR $PLATINCDIR" ++ ;; ++ --cflags) ++ echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT" ++ ;; ++ --libs) ++ echo "$LIBS" ++ ;; ++ --ldflags) ++ LINKFORSHAREDUSED= ++ if [ -z "$PYTHONFRAMEWORK" ] ; then ++ LINKFORSHAREDUSED=$LINKFORSHARED ++ fi ++ LIBPLUSED= ++ if [ "$PY_ENABLE_SHARED" = "0" ] ; then ++ LIBPLUSED="-L$LIBPL" ++ fi ++ echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED" ++ ;; ++ --extension-suffix) ++ echo "$SO" ++ ;; ++ --configdir) ++ echo "$LIBPL" ++ ;; ++esac ++done diff --git a/packages/lang/Python/patches/Python-2.7.11-014-abort-on-failed-modules.patch b/packages/lang/Python2/patches/Python2-2.7.11-014-abort-on-failed-modules.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-014-abort-on-failed-modules.patch rename to packages/lang/Python2/patches/Python2-2.7.11-014-abort-on-failed-modules.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-015_no_static_lib.patch b/packages/lang/Python2/patches/Python2-2.7.11-015_no_static_lib.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-015_no_static_lib.patch rename to packages/lang/Python2/patches/Python2-2.7.11-015_no_static_lib.patch diff --git a/packages/lang/Python/patches/Python-2.7.11-016-default-is-optimized.patch b/packages/lang/Python2/patches/Python2-2.7.11-016-default-is-optimized.patch similarity index 100% rename from packages/lang/Python/patches/Python-2.7.11-016-default-is-optimized.patch rename to packages/lang/Python2/patches/Python2-2.7.11-016-default-is-optimized.patch diff --git a/packages/lang/Python2/patches/aarch64/Python2-001-fix_platform_machine_func_for_32bit_userspace.patch b/packages/lang/Python2/patches/aarch64/Python2-001-fix_platform_machine_func_for_32bit_userspace.patch new file mode 100644 index 0000000000..b8a117f244 --- /dev/null +++ b/packages/lang/Python2/patches/aarch64/Python2-001-fix_platform_machine_func_for_32bit_userspace.patch @@ -0,0 +1,13 @@ +diff -Naur Python-2.7.13.orig/Lib/platform.py Python-2.7.13/Lib/platform.py +--- Python-2.7.13.orig/Lib/platform.py 2017-01-08 11:57:36.615886244 +0100 ++++ Python-2.7.13/Lib/platform.py 2017-01-08 12:12:44.567848271 +0100 +@@ -1250,6 +1250,9 @@ + system = 'Windows' + release = 'Vista' + ++ if machine == 'aarch64' and architecture()[0] == '32bit': ++ machine = 'armv7l' ++ + _uname_cache = system,node,release,version,machine,processor + return _uname_cache + diff --git a/packages/lang/Python3/package.mk b/packages/lang/Python3/package.mk new file mode 100644 index 0000000000..751c2d44e9 --- /dev/null +++ b/packages/lang/Python3/package.mk @@ -0,0 +1,123 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="Python3" +# When changing PKG_VERSION remember to sync PKG_PYTHON_VERSION! +PKG_VERSION="3.7.1" +PKG_SHA256="fa7e2b8e8c9402f192ad56dc4f814089d1c4466c97d780f5e5acc02c04243d6d" +PKG_LICENSE="OSS" +PKG_SITE="http://www.python.org/" +PKG_URL="http://www.python.org/ftp/python/$PKG_VERSION/${PKG_NAME::-1}-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="zlib:host bzip2:host libffi:host util-linux:host" +PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 openssl Python3:host readline ncurses" +PKG_LONGDESC="Python3 is an interpreted object-oriented programming language." + +PKG_PYTHON_VERSION=python3.7 + +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_HOST="ac_cv_prog_HAS_HG=/bin/false + ac_cv_prog_SVNVERSION=/bin/false + --disable-pyc-build + --disable-ossaudiodev + --disable-sqlite3 + --disable-codecs-cjk + --disable-nis + --enable-unicodedata + --enable-openssl + --disable-readline + --disable-bzip2 + --enable-zlib + --disable-xz + --disable-tk + --disable-curses + --disable-pydoc + --disable-test-modules + --enable-lib2to3 + --disable-idle3 + --without-cxx-main + --with-expat=builtin + --with-libmpdec=none + --with-doc-strings + --without-pymalloc + --without-ensurepip +" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_prog_HAS_HG=/bin/false + ac_cv_prog_SVNVERSION=/bin/false + ac_cv_file__dev_ptmx=no + ac_cv_file__dev_ptc=no + ac_cv_have_long_long_format=yes + ac_cv_working_tzset=yes + ac_cv_func_lchflags_works=no + ac_cv_func_chflags_works=no + ac_cv_func_printf_zd=yes + ac_cv_buggy_getaddrinfo=no + ac_cv_header_bluetooth_bluetooth_h=no + ac_cv_header_bluetooth_h=no + --disable-pyc-build + --disable-ossaudiodev + --enable-sqlite3 + --disable-codecs-cjk + --disable-nis + --enable-unicodedata + --enable-openssl + --enable-readline + --enable-bzip2 + --enable-zlib + --disable-xz + --disable-tk + --enable-curses + --disable-pydoc + --disable-test-modules + --disable-lib2to3 + --disable-idle3 + --without-cxx-main + --with-expat=system + --with-libmpdec=none + --with-doc-strings + --without-pymalloc + --without-ensurepip + --with-threads + --enable-ipv6 +" + +post_unpack() { + # This is needed to make sure the Python build process doesn't try to + # regenerate those files with the pgen program. Otherwise, it builds + # pgen for the target, and tries to run it on the host. + touch $PKG_BUILD/Include/graminit.h + touch $PKG_BUILD/Python/graminit.c +} + +post_makeinstall_host() { + rm -f $TOOLCHAIN/bin/python*-config + rm -f $TOOLCHAIN/bin/smtpd.py* + rm -f $TOOLCHAIN/bin/pyvenv + rm -f $TOOLCHAIN/bin/pydoc* + + rm -fr $PKG_BUILD/.$HOST_NAME/build/temp.* + + cp $PKG_BUILD/Tools/scripts/reindent.py $TOOLCHAIN/lib/$PKG_PYTHON_VERSION +} + +post_makeinstall_target() { + rm -fr $PKG_BUILD/.$TARGET_NAME/build/temp.* + + PKG_INSTALL_PATH_LIB=$INSTALL/usr/lib/$PKG_PYTHON_VERSION + + for dir in config compiler sysconfigdata lib-dynload/sysconfigdata lib2to3 test; do + rm -rf $PKG_INSTALL_PATH_LIB/$dir + done + + rm -rf $INSTALL/usr/bin/pyvenv + rm -rf $INSTALL/usr/bin/python*-config + rm -rf $INSTALL/usr/bin/smtpd.py $INSTALL/usr/bin/smtpd.py.* + + $TOOLCHAIN/bin/python3 -Wi -t -B $TOOLCHAIN/lib/$PKG_PYTHON_VERSION/compileall.py -d ${PKG_INSTALL_PATH_LIB#${INSTALL}} -b -f $PKG_INSTALL_PATH_LIB + find $PKG_INSTALL_PATH_LIB -name "*.py" -exec rm -f {} \; &>/dev/null + + # strip + chmod u+w $INSTALL/usr/lib/libpython*.so.* + debug_strip $INSTALL/usr +} diff --git a/packages/lang/Python3/patches/Python3-0000-default-is-optimized.patch b/packages/lang/Python3/patches/Python3-0000-default-is-optimized.patch new file mode 100644 index 0000000000..d39eea7b09 --- /dev/null +++ b/packages/lang/Python3/patches/Python3-0000-default-is-optimized.patch @@ -0,0 +1,25 @@ +From 722c059f586ffd26bb3c447c56cb4d2601d9f94c Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Sat, 8 Sep 2018 06:24:14 +0100 +Subject: [PATCH] Default is optimized + +--- + Python/pylifecycle.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c +index fdb759f..432119e 100644 +--- a/Python/pylifecycle.c ++++ b/Python/pylifecycle.c +@@ -115,7 +115,7 @@ int Py_VerboseFlag = 0; /* Needed by import.c */ + int Py_QuietFlag = 0; /* Needed by sysmodule.c */ + int Py_InteractiveFlag = 0; /* Needed by Py_FdIsInteractive() below */ + int Py_InspectFlag = 0; /* Needed to determine whether to exit at SystemExit */ +-int Py_OptimizeFlag = 0; /* Needed by compile.c */ ++int Py_OptimizeFlag = 2; /* Needed by compile.c */ + int Py_NoSiteFlag = 0; /* Suppress 'import site' */ + int Py_BytesWarningFlag = 0; /* Warn on str(bytes) and str(buffer) */ + int Py_FrozenFlag = 0; /* Needed by getpath.c */ +-- +2.7.4 + diff --git a/packages/lang/Python3/patches/Python3-0100-buildroot-patches.patch b/packages/lang/Python3/patches/Python3-0100-buildroot-patches.patch new file mode 100644 index 0000000000..9d678cbe08 --- /dev/null +++ b/packages/lang/Python3/patches/Python3-0100-buildroot-patches.patch @@ -0,0 +1,1823 @@ +From 1df58e4e6932c4c887fdd2f6a92509ae91e3d86f Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 16:21:31 -0800 +Subject: [PATCH 01/32] Make the build of pyc files conditional + +This commit adds a new configure option --disable-pyc-build to disable +the compilation of pyc. + +Signed-off-by: Thomas Petazzoni +[ Andrey Smrinov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 2 ++ + configure.ac | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 4c23c0e..ca52776 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1385,6 +1385,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi ++ifeq (@PYC_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ +@@ -1412,6 +1413,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c + $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ++endif + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +diff --git a/configure.ac b/configure.ac +index b5beb08..027901d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1107,6 +1107,12 @@ fi + + AC_MSG_CHECKING(LDLIBRARY) + ++AC_SUBST(PYC_BUILD) ++ ++AC_ARG_ENABLE(pyc-build, ++ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]), ++ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ]) ++ + # MacOSX framework builds need more magic. LDLIBRARY is the dynamic + # library that we build, but we do not want to link against it (we + # will find it with a -framework option). For this reason there is an +-- +2.7.4 + + +From 4bf9295c7c03ecdcfeb40cf9cabeefb414fa3b2f Mon Sep 17 00:00:00 2001 +From: Vanya Sergeev +Date: Wed, 23 Dec 2015 11:30:33 +0100 +Subject: [PATCH 02/32] Disable buggy_getaddrinfo configure test when + cross-compiling with IPv6 support + +Signed-off-by: Vanya Sergeev +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 027901d..3aa3e33 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3985,7 +3985,7 @@ fi + + AC_MSG_RESULT($ac_cv_buggy_getaddrinfo) + +-if test $have_getaddrinfo = no || test "$ac_cv_buggy_getaddrinfo" = yes ++if test $have_getaddrinfo = no || test "$cross_compiling" != "yes" -a "$ac_cv_buggy_getaddrinfo" = yes + then + if test $ipv6 = yes + then +-- +2.7.4 + + +From 3c1728bb10f2d8e5dbe42d35bd7b1ec354e31d89 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 16:33:22 -0800 +Subject: [PATCH 03/32] Add infrastructure to disable the build of certain + extensions + +Some of the extensions part of the Python core have dependencies on +external libraries (sqlite, tk, etc.) or are relatively big and not +necessarly always useful (CJK codecs for example). By extensions, we +mean part of Python modules that are written in C and therefore +compiled to binary code. + +Therefore, we introduce a small infrastructure that allows to disable +some of those extensions. This can be done inside the configure.ac by +adding values to the DISABLED_EXTENSIONS variable (which is a +word-separated list of extensions). + +The implementation works as follow : + + * configure.ac defines a DISABLED_EXTENSIONS variable, which is + substituted (so that when Makefile.pre is generated from + Makefile.pre.in, the value of the variable is substituted). For + now, this DISABLED_EXTENSIONS variable is empty, later patches will + use it. + + * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the + variables passed in the environment when calling the setup.py + script that actually builds and installs those extensions. + + * setup.py is modified so that the existing "disabled_module_list" is + filled with those pre-disabled extensions listed in + DISABLED_EXTENSIONS. + +Patch ported to python2.7 by Maxime Ripard , and +then extended by Thomas Petazzoni +. + +Signed-off-by: Thomas Petazzoni +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 6 +++++- + configure.ac | 2 ++ + setup.py | 6 +++++- + 3 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index ca52776..5d64ab7 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -196,6 +196,8 @@ FILEMODE= 644 + # configure script arguments + CONFIG_ARGS= @CONFIG_ARGS@ + ++# disabled extensions ++DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@ + + # Subdirectories with code + SRCDIRS= @SRCDIRS@ +@@ -609,6 +611,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + esac; \ + echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ ++ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ +@@ -1508,7 +1511,8 @@ libainstall: @DEF_MAKE_RULE@ python-config + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: sharedmods +- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ ++ $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ ++ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ +diff --git a/configure.ac b/configure.ac +index 3aa3e33..d68d410 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2902,6 +2902,8 @@ LIBS="$withval $LIBS" + + PKG_PROG_PKG_CONFIG + ++AC_SUBST(DISABLED_EXTENSIONS) ++ + # Check for use of the system expat library + AC_MSG_CHECKING(for --with-system-expat) + AC_ARG_WITH(system_expat, +diff --git a/setup.py b/setup.py +index a97a755..e62b499 100644 +--- a/setup.py ++++ b/setup.py +@@ -43,7 +43,11 @@ host_platform = get_platform() + COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) + + # This global variable is used to hold the list of modules to be disabled. +-disabled_module_list = [] ++try: ++ disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ") ++except KeyError: ++ disabled_module_list = list() ++ + + def add_dir_to_list(dirlist, dir): + """Add the directory 'dir' to the list 'dirlist' (after any relative +-- +2.7.4 + + +From 4ba45fbf70789f51f5bb83a513a7633c065ee6f3 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:33:14 +0100 +Subject: [PATCH 04/32] Adjust library/header paths for cross-compilation + +When cross-compiling third-party extensions, the get_python_inc() or +get_python_lib() can be called, to return the path to headers or +libraries. However, they use the sys.prefix of the host Python, which +returns incorrect paths when cross-compiling (paths pointing to host +headers and libraries). + +In order to fix this, we introduce the _python_sysroot, _python_prefix +and _python_exec_prefix variables, that allow to override these +values, and get correct header/library paths when cross-compiling +third-party Python modules. + +Signed-off-by: Thomas Petazzoni +--- + Lib/distutils/command/build_ext.py | 5 ++++- + Lib/distutils/sysconfig.py | 15 +++++++++++---- + 2 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py +index 8fad9cd..bfe5122 100644 +--- a/Lib/distutils/command/build_ext.py ++++ b/Lib/distutils/command/build_ext.py +@@ -233,7 +233,10 @@ class build_ext(Command): + if (sysconfig.get_config_var('Py_ENABLE_SHARED')): + if not sysconfig.python_build: + # building third party extensions +- self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) ++ libdir = sysconfig.get_config_var('LIBDIR') ++ if "_python_sysroot" in os.environ: ++ libdir = os.environ.get("_python_sysroot") + libdir ++ self.library_dirs.append(libdir) + else: + # building python standard extensions + self.library_dirs.append('.') +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index e07a6c8..a9d78a5 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -17,10 +17,17 @@ import sys + from .errors import DistutilsPlatformError + + # These are needed in a couple of spots, so just compute them once. +-PREFIX = os.path.normpath(sys.prefix) +-EXEC_PREFIX = os.path.normpath(sys.exec_prefix) +-BASE_PREFIX = os.path.normpath(sys.base_prefix) +-BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) ++if "_python_sysroot" in os.environ: ++ _sysroot=os.environ.get('_python_sysroot') ++ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix')) ++ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix')) ++ BASE_PREFIX = PREFIX ++ BASE_EXEC_PREFIX = EXEC_PREFIX ++else: ++ PREFIX = os.path.normpath(sys.prefix) ++ EXEC_PREFIX = os.path.normpath(sys.exec_prefix) ++ BASE_PREFIX = os.path.normpath(sys.base_prefix) ++ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) + + # Path to the base directory of the project. On Windows the binary may + # live in project/PCbuild/win32 or project/PCbuild/amd64. +-- +2.7.4 + + +From 5737dfd186e53233c63c36aa2f359fa15081d3bc Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:36:00 +0100 +Subject: [PATCH 05/32] Don't look in /usr/lib/termcap for libraries + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/setup.py b/setup.py +index e62b499..c065092 100644 +--- a/setup.py ++++ b/setup.py +@@ -850,12 +850,9 @@ class PyBuildExt(build_ext): + pass # Issue 7384: Already linked against curses or tinfo. + elif curses_library: + readline_libs.append(curses_library) +- elif self.compiler.find_library_file(lib_dirs + +- ['/usr/lib/termcap'], +- 'termcap'): ++ elif self.compiler.find_library_file(lib_dirs, 'termcap'): + readline_libs.append('termcap') + exts.append( Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs) ) + else: +-- +2.7.4 + + +From 1dd3495fcbec3ad495fc0a05cd2f0cb6a68c4bba Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:36:27 +0100 +Subject: [PATCH 06/32] Don't add multiarch paths + +The add_multiarch_paths() function leads, in certain build +environments, to the addition of host header paths to the CFLAGS, +which is not appropriate for cross-compilation. This patch fixes that +by simply removing the call to add_multiarch_paths() when we're +cross-compiling. + +Investigation done by David . + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index c065092..c44a683 100644 +--- a/setup.py ++++ b/setup.py +@@ -547,10 +547,10 @@ class PyBuildExt(build_ext): + if not cross_compiling: + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') ++ self.add_multiarch_paths() + # only change this for cross builds for 3.3, issues on Mageia + if cross_compiling: + self.add_gcc_paths() +- self.add_multiarch_paths() + + # Add paths specified in the environment variables LDFLAGS and + # CPPFLAGS for header and library files. +-- +2.7.4 + + +From af7fdaf9d5ac109f052a5ac687e5ebf3254a0ae6 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:43:24 +0100 +Subject: [PATCH 07/32] Abort on failed module build + +When building a Python module fails, the setup.py script currently +doesn't exit with an error, and simply continues. This is not a really +nice behavior, so this patch changes setup.py to abort with an error, +so that the build issue is clearly noticeable. + +Signed-off-by: Thomas Petazzoni +--- + setup.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/setup.py b/setup.py +index c44a683..a6eb2be 100644 +--- a/setup.py ++++ b/setup.py +@@ -358,6 +358,7 @@ class PyBuildExt(build_ext): + print("Failed to build these modules:") + print_three_column(failed) + print() ++ sys.exit(1) + + if self.failed_on_import: + failed = self.failed_on_import[:] +-- +2.7.4 + + +From bb03d2ab3820d0ba0f6788c58c7d02b7ec5a6f2e Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Wed, 23 Dec 2015 11:44:02 +0100 +Subject: [PATCH 08/32] Serial ioctl() workaround + +The ioctls.h of some architectures (notably xtensa) references structs from +linux/serial.h. Make sure to include this header as well. + +Also, undef TIOCTTYGSTRUCT that require reference to internal kernel tty_struct, +but isn't actually referenced in modern kernels. + +Signed-off-by: Baruch Siach +--- + Modules/termios.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Modules/termios.c b/Modules/termios.c +index b4aa77f..760a4a8 100644 +--- a/Modules/termios.c ++++ b/Modules/termios.c +@@ -15,7 +15,9 @@ + #endif + + #include ++#include + #include ++#undef TIOCTTYGSTRUCT + + /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR, + * MDTR, MRI, and MRTS (appearantly used internally by some things +-- +2.7.4 + + +From fc9e8c17bd551d71a8e8250fd8d03717328f7ef0 Mon Sep 17 00:00:00 2001 +From: Christophe Vu-Brugier +Date: Wed, 23 Dec 2015 11:44:30 +0100 +Subject: [PATCH 09/32] Do not adjust the shebang of Python scripts for + cross-compilation + +The copy_scripts() method in distutils copies the scripts listed in +the setup file and adjusts the first line to refer to the current +Python interpreter. When cross-compiling, this means that the adjusted +shebang refers to the host Python interpreter. + +This patch modifies copy_scripts() to preserve the shebang when +cross-compilation is detected. + +Signed-off-by: Christophe Vu-Brugier +--- + Lib/distutils/command/build_scripts.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py +index ccc70e6..d6d5419 100644 +--- a/Lib/distutils/command/build_scripts.py ++++ b/Lib/distutils/command/build_scripts.py +@@ -91,7 +91,7 @@ class build_scripts(Command): + adjust = True + post_interp = match.group(1) or b'' + +- if adjust: ++ if adjust and not '_python_sysroot' in os.environ: + log.info("copying and adjusting %s -> %s", script, + self.build_dir) + updated_files.append(outfile) +-- +2.7.4 + + +From f02eded6c8aa395e287c17d1514bbef76be22c07 Mon Sep 17 00:00:00 2001 +From: Peter Korsgaard +Date: Thu, 20 Nov 2014 13:24:59 +0100 +Subject: [PATCH 10/32] Misc/python-config.sh.in: ensure sed invocations only + match beginning of strings + +The build/real prefix handling using sed breaks if build != real and the +standard include / lib directories are used ($prefix/include and $prefix/lib). + +E.G. + +prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include". + +If this gets installed with make DESTDIR="/foo" install, then we end up with +prefix_real = prefix = "/foo/usr" as expected, but +includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of +the double sed invocation (prefix is already expanded). Work around it by +ensuring we only match the beginning of the string. + +Submitted upstream: http://bugs.python.org/issue22907 + +Signed-off-by: Peter Korsgaard +--- + Misc/python-config.sh.in | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in +index d1d3275..9e259c0 100644 +--- a/Misc/python-config.sh.in ++++ b/Misc/python-config.sh.in +@@ -24,18 +24,19 @@ installed_prefix () + echo $RESULT + } + ++prefix_build="@prefix@" + prefix_real=$(installed_prefix "$0") + + # Use sed to fix paths from their built-to locations to their installed-to + # locations. Keep prefix & exec_prefix using their original values in case + # they are referenced in other configure variables, to prevent double + # substitution, issue #22140. +-prefix="@prefix@" +-exec_prefix="@exec_prefix@" ++prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#") ++exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#") + exec_prefix_real=${prefix_real} +-includedir=$(echo "@includedir@" | sed "s#$prefix#$prefix_real#") +-libdir=$(echo "@libdir@" | sed "s#$prefix#$prefix_real#") +-CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix#$prefix_real#") ++includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#") ++libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#") ++CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#") + VERSION="@VERSION@" + LIBM="@LIBM@" + LIBC="@LIBC@" +@@ -49,7 +50,7 @@ OPT="@OPT@" + PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" + LDVERSION="@LDVERSION@" + LIBDEST=${prefix_real}/lib/python${VERSION} +-LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#") ++LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#") + SO="@EXT_SUFFIX@" + PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" + INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" +-- +2.7.4 + + +From d60ebafd835463f75ea05ef1dc2be46d10f9f9fb Mon Sep 17 00:00:00 2001 +From: Samuel Cabrero +Date: Wed, 23 Dec 2015 11:45:48 +0100 +Subject: [PATCH 11/32] Override system locale and set to default when adding + gcc paths + +Forces the use of the default locale in the function +add_gcc_paths, which is called when cross compiling to add the +include and library paths. This is necessary because otherwise +the gcc output is localized and the output parsing fails, which +results in no paths added and detect_modules not able to find +any system library (eg. libz, libssl, etc.) + +[Thomas: patch taken from https://bugs.python.org/issue23767.] + +Signed-off-by: Samuel Cabrero +Signed-off-by: Thomas Petazzoni +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index a6eb2be..184999e 100644 +--- a/setup.py ++++ b/setup.py +@@ -514,7 +514,7 @@ class PyBuildExt(build_ext): + tmpfile = os.path.join(self.build_temp, 'gccpaths') + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) +- ret = os.system('%s -E -v - %s 1>/dev/null' % (gcc, tmpfile)) ++ ret = os.system('LC_ALL=C %s -E -v - %s 1>/dev/null' % (gcc, tmpfile)) + is_gcc = False + in_incdirs = False + inc_dirs = [] +-- +2.7.4 + + +From bc0f12d5f610852f9dd59f7c77e275c9c5d6b50a Mon Sep 17 00:00:00 2001 +From: Christophe Vu-Brugier +Date: Wed, 22 Feb 2017 16:48:49 -0800 +Subject: [PATCH 12/32] Add importlib fix for PEP 3147 issue + +Python 3 has a new standard for installing .pyc file, called PEP +3147. Unfortunately, this standard requires both the .py and .pyc +files to be installed for a Python module to be found. This is quite +annoying on space-constrained embedded systems, since the .py file is +technically not required for execution. + +This patch changes cache_from_source() and source_from_cache() in +importlib to get rid of the "__pycache__" directory. +This effectively disables PEP 3147 for: + +* The python standard library +* Packages built with distutils or setuptools +* Packages built with automake that use the `py-compile` helper + +Signed-off-by: Christophe Vu-Brugier +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Lib/importlib/_bootstrap_external.py | 38 +++++------------------------------- + 1 file changed, 5 insertions(+), 33 deletions(-) + +diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py +index 53b24ff..8b28bad 100644 +--- a/Lib/importlib/_bootstrap_external.py ++++ b/Lib/importlib/_bootstrap_external.py +@@ -283,8 +283,6 @@ def cache_from_source(path, debug_override=None, *, optimization=None): + a True value is the same as setting 'optimization' to the empty string + while a False value is equivalent to setting 'optimization' to '1'. + +- If sys.implementation.cache_tag is None then NotImplementedError is raised. +- + """ + if debug_override is not None: + _warnings.warn('the debug_override parameter is deprecated; use ' +@@ -296,10 +294,7 @@ def cache_from_source(path, debug_override=None, *, optimization=None): + path = _os.fspath(path) + head, tail = _path_split(path) + base, sep, rest = tail.rpartition('.') +- tag = sys.implementation.cache_tag +- if tag is None: +- raise NotImplementedError('sys.implementation.cache_tag is None') +- almost_filename = ''.join([(base if base else rest), sep, tag]) ++ almost_filename = ''.join([(base if base else rest)]) + if optimization is None: + if sys.flags.optimize == 0: + optimization = '' +@@ -310,40 +305,17 @@ def cache_from_source(path, debug_override=None, *, optimization=None): + if not optimization.isalnum(): + raise ValueError('{!r} is not alphanumeric'.format(optimization)) + almost_filename = '{}.{}{}'.format(almost_filename, _OPT, optimization) +- return _path_join(head, _PYCACHE, almost_filename + BYTECODE_SUFFIXES[0]) ++ return _path_join(head, almost_filename + BYTECODE_SUFFIXES[0]) + + + def source_from_cache(path): + """Given the path to a .pyc. file, return the path to its .py file. + + The .pyc file does not need to exist; this simply returns the path to +- the .py file calculated to correspond to the .pyc file. If path does +- not conform to PEP 3147/488 format, ValueError will be raised. If +- sys.implementation.cache_tag is None then NotImplementedError is raised. +- ++ the .py file calculated to correspond to the .pyc file. + """ +- if sys.implementation.cache_tag is None: +- raise NotImplementedError('sys.implementation.cache_tag is None') +- path = _os.fspath(path) +- head, pycache_filename = _path_split(path) +- head, pycache = _path_split(head) +- if pycache != _PYCACHE: +- raise ValueError('{} not bottom-level directory in ' +- '{!r}'.format(_PYCACHE, path)) +- dot_count = pycache_filename.count('.') +- if dot_count not in {2, 3}: +- raise ValueError('expected only 2 or 3 dots in ' +- '{!r}'.format(pycache_filename)) +- elif dot_count == 3: +- optimization = pycache_filename.rsplit('.', 2)[-2] +- if not optimization.startswith(_OPT): +- raise ValueError("optimization portion of filename does not start " +- "with {!r}".format(_OPT)) +- opt_level = optimization[len(_OPT):] +- if not opt_level.isalnum(): +- raise ValueError("optimization level {!r} is not an alphanumeric " +- "value".format(optimization)) +- base_filename = pycache_filename.partition('.')[0] ++ head, filename = _path_split(path) ++ base_filename = filename.partition('.')[0] + return _path_join(head, base_filename + SOURCE_SUFFIXES[0]) + + +-- +2.7.4 + + +From 84d23f2038c36b100d168586609abba7d1de03e3 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:01:18 -0800 +Subject: [PATCH 13/32] Add an option to disable installation of test modules + +The Python standard distribution comes with many test modules, that +are not necessarly useful on embedded targets. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 54 ++++++++++++++++++++++++++++++++++++------------------ + configure.ac | 5 +++++ + 2 files changed, 41 insertions(+), 18 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 5d64ab7..194dbfc 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1251,8 +1251,28 @@ maninstall: altmaninstall + + # Install the library + XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax +-LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ +- tkinter/test/test_ttk site-packages test \ ++ ++LIBSUBDIRS= tkinter site-packages \ ++ asyncio \ ++ collections concurrent concurrent/futures encodings \ ++ email email/mime \ ++ ensurepip ensurepip/_bundled \ ++ html json http dbm xmlrpc \ ++ sqlite3 \ ++ logging csv wsgiref urllib \ ++ lib2to3 lib2to3/fixes lib2to3/pgen2 \ ++ ctypes ctypes/macholib \ ++ idlelib idlelib/Icons \ ++ distutils distutils/command $(XMLLIBSUBDIRS) \ ++ importlib \ ++ turtledemo \ ++ multiprocessing multiprocessing/dummy \ ++ unittest \ ++ venv venv/scripts venv/scripts/common venv/scripts/posix \ ++ curses pydoc_data ++ ++TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ ++ tkinter/test/test_ttk test \ + test/audiodata \ + test/capath test/data \ + test/cjkencodings test/decimaltestdata test/xmltestdata \ +@@ -1306,26 +1326,24 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ + test/test_importlib/source \ + test/test_importlib/zipdata01 \ + test/test_importlib/zipdata02 \ +- asyncio \ + test/test_asyncio \ +- collections concurrent concurrent/futures encodings \ +- email email/mime test/test_email test/test_email/data \ +- ensurepip ensurepip/_bundled \ +- html json test/test_json http dbm xmlrpc \ +- sqlite3 sqlite3/test \ +- logging csv wsgiref urllib \ +- lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \ ++ test/test_email test/test_email/data \ ++ test/test_json \ ++ sqlite3/test \ ++ lib2to3/tests \ + lib2to3/tests/data lib2to3/tests/data/fixers \ + lib2to3/tests/data/fixers/myfixes \ +- ctypes ctypes/test ctypes/macholib \ +- idlelib idlelib/Icons idlelib/idle_test \ +- distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \ ++ ctypes/test \ ++ idlelib/idle_test \ ++ distutils/tests \ ++ test/test_importlib test/test_importlib/builtin \ + test/test_tools test/test_warnings test/test_warnings/data \ +- turtledemo \ +- multiprocessing multiprocessing/dummy \ +- unittest unittest/test unittest/test/testmock \ +- venv venv/scripts venv/scripts/common venv/scripts/posix \ +- curses pydoc_data ++ unittest/test unittest/test/testmock ++ ++ifeq (@TEST_MODULES@,yes) ++LIBSUBDIRS += $(TESTSUBDIRS) ++endif ++ + libinstall: build_all $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +diff --git a/configure.ac b/configure.ac +index d68d410..ea7aaeb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3162,6 +3162,11 @@ if test "$posix_threads" = "yes"; then + AC_CHECK_FUNCS(pthread_getcpuclockid) + fi + ++AC_SUBST(TEST_MODULES) ++ ++AC_ARG_ENABLE(test-modules, ++ AS_HELP_STRING([--disable-test-modules], [disable test modules]), ++ [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ]) + + # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) +-- +2.7.4 + + +From 66627f9f652400a125cf78a2356bf5b984ef707c Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:07:56 -0800 +Subject: [PATCH 14/32] Add an option to disable pydoc + +It removes 0.5 MB of data from the target plus the pydoc script +itself. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 8 +++++++- + configure.ac | 6 ++++++ + setup.py | 9 +++++++-- + 3 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 194dbfc..efba1b5 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1221,7 +1221,9 @@ bininstall: altbininstall + -rm -f $(DESTDIR)$(BINDIR)/idle3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 ++ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/2to3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) + -rm -f $(DESTDIR)$(BINDIR)/pyvenv +@@ -1269,7 +1271,7 @@ LIBSUBDIRS= tkinter site-packages \ + multiprocessing multiprocessing/dummy \ + unittest \ + venv venv/scripts venv/scripts/common venv/scripts/posix \ +- curses pydoc_data ++ curses + + TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + tkinter/test/test_ttk test \ +@@ -1344,6 +1346,10 @@ ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += $(TESTSUBDIRS) + endif + ++ifeq (@PYDOC@,yes) ++LIBSUBDIRS += pydoc_data ++endif ++ + libinstall: build_all $(srcdir)/Modules/xxmodule.c + @for i in $(SCRIPTDIR) $(LIBDEST); \ + do \ +diff --git a/configure.ac b/configure.ac +index ea7aaeb..608ef45 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3162,6 +3162,12 @@ if test "$posix_threads" = "yes"; then + AC_CHECK_FUNCS(pthread_getcpuclockid) + fi + ++AC_SUBST(PYDOC) ++ ++AC_ARG_ENABLE(pydoc, ++ AS_HELP_STRING([--disable-pydoc], [disable pydoc]), ++ [ PYDOC="${enableval}" ], [ PYDOC=yes ]) ++ + AC_SUBST(TEST_MODULES) + + AC_ARG_ENABLE(test-modules, +diff --git a/setup.py b/setup.py +index 184999e..0492942 100644 +--- a/setup.py ++++ b/setup.py +@@ -2332,6 +2332,12 @@ def main(): + # turn off warnings when deprecated modules are imported + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) ++ ++ scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', ++ 'Lib/smtpd.py'] ++ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): ++ scripts += [ 'Tools/scripts/pydoc3' ] ++ + setup(# PyPI Metadata (PEP 301) + name = "Python", + version = sys.version.split()[0], +@@ -2356,8 +2362,7 @@ def main(): + # If you change the scripts installed here, you also need to + # check the PyBuildScripts command above, and change the links + # created by the bininstall target in Makefile.pre.in +- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", +- "Tools/scripts/2to3", "Tools/scripts/pyvenv"] ++ scripts = scripts + ) + + # --install-platlib +-- +2.7.4 + + +From 9879ed6a7efae3152feabc880f4d01e1fa2ff389 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:15:31 -0800 +Subject: [PATCH 15/32] Add an option to disable lib2to3 + +lib2to3 is a library to convert Python 2.x code to Python 3.x. As +such, it is probably not very useful on embedded system targets. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 16 ++++++++++++---- + configure.ac | 6 ++++++ + setup.py | 5 +++-- + 3 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index efba1b5..017844f 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1225,7 +1225,9 @@ ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) + endif + -rm -f $(DESTDIR)$(BINDIR)/2to3 ++ifeq (@LIB2TO3@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/pyvenv + (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv) + if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ +@@ -1262,7 +1264,6 @@ LIBSUBDIRS= tkinter site-packages \ + html json http dbm xmlrpc \ + sqlite3 \ + logging csv wsgiref urllib \ +- lib2to3 lib2to3/fixes lib2to3/pgen2 \ + ctypes ctypes/macholib \ + idlelib idlelib/Icons \ + distutils distutils/command $(XMLLIBSUBDIRS) \ +@@ -1332,9 +1333,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_email test/test_email/data \ + test/test_json \ + sqlite3/test \ +- lib2to3/tests \ +- lib2to3/tests/data lib2to3/tests/data/fixers \ +- lib2to3/tests/data/fixers/myfixes \ + ctypes/test \ + idlelib/idle_test \ + distutils/tests \ +@@ -1342,6 +1340,14 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_tools test/test_warnings test/test_warnings/data \ + unittest/test unittest/test/testmock + ++ifeq (@LIB2TO3@,yes) ++LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 ++TESTSUBDIRS += lib2to3/tests \ ++ lib2to3/tests/data \ ++ lib2to3/tests/data/fixers \ ++ lib2to3/tests/data/fixers/myfixes ++endif ++ + ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += $(TESTSUBDIRS) + endif +@@ -1441,10 +1447,12 @@ ifeq (@PYC_BUILD@,yes) + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + endif ++ifeq (@LIB2TO3@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt ++endif + + python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh + @ # Substitution happens here, as the completely-expanded BINDIR +diff --git a/configure.ac b/configure.ac +index 608ef45..3f73186 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3174,6 +3174,12 @@ AC_ARG_ENABLE(test-modules, + AS_HELP_STRING([--disable-test-modules], [disable test modules]), + [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ]) + ++AC_SUBST(LIB2TO3) ++ ++AC_ARG_ENABLE(lib2to3, ++ AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]), ++ [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) ++ + # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +diff --git a/setup.py b/setup.py +index 0492942..2c2fbd5 100644 +--- a/setup.py ++++ b/setup.py +@@ -2333,10 +2333,11 @@ def main(): + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) + +- scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', +- 'Lib/smtpd.py'] ++ scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/pydoc3' ] ++ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): ++ scripts += [ 'Tools/scripts/2to3' ] + + setup(# PyPI Metadata (PEP 301) + name = "Python", +-- +2.7.4 + + +From 8a8ea383325abb2237f526d7a3744172a19c881f Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:20:45 -0800 +Subject: [PATCH 16/32] Add option to disable the sqlite3 module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 7 +++++-- + configure.ac | 9 +++++++++ + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 017844f..c5f1389 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1262,7 +1262,6 @@ LIBSUBDIRS= tkinter site-packages \ + email email/mime \ + ensurepip ensurepip/_bundled \ + html json http dbm xmlrpc \ +- sqlite3 \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib \ + idlelib idlelib/Icons \ +@@ -1332,7 +1331,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_asyncio \ + test/test_email test/test_email/data \ + test/test_json \ +- sqlite3/test \ + ctypes/test \ + idlelib/idle_test \ + distutils/tests \ +@@ -1348,6 +1346,11 @@ TESTSUBDIRS += lib2to3/tests \ + lib2to3/tests/data/fixers/myfixes + endif + ++ifeq (@SQLITE3@,yes) ++LIBSUBDIRS += sqlite3 ++TESTSUBDIRS += sqlite3/test ++endif ++ + ifeq (@TEST_MODULES@,yes) + LIBSUBDIRS += $(TESTSUBDIRS) + endif +diff --git a/configure.ac b/configure.ac +index 3f73186..8252ee9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3162,6 +3162,15 @@ if test "$posix_threads" = "yes"; then + AC_CHECK_FUNCS(pthread_getcpuclockid) + fi + ++AC_SUBST(SQLITE3) ++AC_ARG_ENABLE(sqlite3, ++ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]), ++ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ]) ++ ++if test "$SQLITE3" = "no" ; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.7.4 + + +From 44fb56b626118fc994277a433930d2bd5f77e446 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:23:42 -0800 +Subject: [PATCH 17/32] Add an option to disable the tk module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 11 ++++++++--- + configure.ac | 9 +++++++++ + 2 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index c5f1389..62b0617 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1256,7 +1256,7 @@ maninstall: altmaninstall + # Install the library + XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax + +-LIBSUBDIRS= tkinter site-packages \ ++LIBSUBDIRS= site-packages \ + asyncio \ + collections concurrent concurrent/futures encodings \ + email email/mime \ +@@ -1273,8 +1273,7 @@ LIBSUBDIRS= tkinter site-packages \ + venv venv/scripts venv/scripts/common venv/scripts/posix \ + curses + +-TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ +- tkinter/test/test_ttk test \ ++TESTSUBDIRS= test \ + test/audiodata \ + test/capath test/data \ + test/cjkencodings test/decimaltestdata test/xmltestdata \ +@@ -1338,6 +1337,12 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \ + test/test_tools test/test_warnings test/test_warnings/data \ + unittest/test unittest/test/testmock + ++ifeq (@TK@,yes) ++LIBSUBDIRS += tkinter ++TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \ ++ tkinter/test/test_ttk ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index 8252ee9..a668e0e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3171,6 +3171,15 @@ if test "$SQLITE3" = "no" ; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" + fi + ++AC_SUBST(TK) ++AC_ARG_ENABLE(tk, ++ AS_HELP_STRING([--disable-tk], [disable tk]), ++ [ TK="${enableval}" ], [ TK=yes ]) ++ ++if test "$TK" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.7.4 + + +From fadc3279588dbf99fb5f044edd329dc4ea2b30a6 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:31:51 -0800 +Subject: [PATCH 18/32] Add an option to disable the curses module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 7 +++++-- + configure.ac | 9 +++++++++ + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 62b0617..5cef555 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1270,8 +1270,7 @@ LIBSUBDIRS= site-packages \ + turtledemo \ + multiprocessing multiprocessing/dummy \ + unittest \ +- venv venv/scripts venv/scripts/common venv/scripts/posix \ +- curses ++ venv venv/scripts venv/scripts/common venv/scripts/posix + + TESTSUBDIRS= test \ + test/audiodata \ +@@ -1343,6 +1342,10 @@ TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \ + tkinter/test/test_ttk + endif + ++ifeq (@CURSES@,yes) ++LIBSUBDIRS += curses ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index a668e0e..c4b15ce 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3180,6 +3180,15 @@ if test "$TK" = "no"; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter" + fi + ++AC_SUBST(CURSES) ++AC_ARG_ENABLE(curses, ++ AS_HELP_STRING([--disable-curses], [disable curses]), ++ [ CURSES="${enableval}" ], [ CURSES=yes ]) ++ ++if test "$CURSES" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.7.4 + + +From d14bc30bf2758459a42f1315601e5a829935601e Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:40:45 -0800 +Subject: [PATCH 19/32] Add an option to disable expat + +This patch replaces the existing --with-system-expat option with a +--with-expat={system,builtin,none} option, which allows to tell Python +whether we want to use the system expat (already installed), the expat +builtin the Python sources, or no expat at all (which disables the +installation of XML modules). + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 6 +++++- + configure.ac | 18 +++++++++++++----- + setup.py | 2 +- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 5cef555..d703c36 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1265,7 +1265,7 @@ LIBSUBDIRS= site-packages \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib \ + idlelib idlelib/Icons \ +- distutils distutils/command $(XMLLIBSUBDIRS) \ ++ distutils distutils/command \ + importlib \ + turtledemo \ + multiprocessing multiprocessing/dummy \ +@@ -1346,6 +1346,10 @@ ifeq (@CURSES@,yes) + LIBSUBDIRS += curses + endif + ++ifeq (@EXPAT@,yes) ++LIBSUBDIRS += $(XMLLIBSUBDIRS) ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index c4b15ce..46fef2c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2905,13 +2905,21 @@ PKG_PROG_PKG_CONFIG + AC_SUBST(DISABLED_EXTENSIONS) + + # Check for use of the system expat library +-AC_MSG_CHECKING(for --with-system-expat) +-AC_ARG_WITH(system_expat, +- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]), ++AC_MSG_CHECKING(for --with-expat) ++AC_ARG_WITH(expat, ++ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]), + [], +- [with_system_expat="no"]) ++ [with_expat="builtin"]) + +-AC_MSG_RESULT($with_system_expat) ++AC_MSG_RESULT($with_expat) ++ ++if test "$with_expat" != "none"; then ++ EXPAT=yes ++else ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat" ++ EXPAT=no ++fi ++AC_SUBST(EXPAT) + + # Check for use of the system libffi library + AC_MSG_CHECKING(for --with-system-ffi) +diff --git a/setup.py b/setup.py +index 2c2fbd5..27c4e1a 100644 +--- a/setup.py ++++ b/setup.py +@@ -1485,7 +1485,7 @@ class PyBuildExt(build_ext): + # + # More information on Expat can be found at www.libexpat.org. + # +- if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): ++ if '--with-expat=system' in sysconfig.get_config_var("CONFIG_ARGS"): + expat_inc = [] + define_macros = [] + extra_compile_args = [] +-- +2.7.4 + + +From aa2d0e7d0cd008f4a9b886806119d05bf81cebe1 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:49:55 +0100 +Subject: [PATCH 20/32] Add an option to disable CJK codecs + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 46fef2c..db47ca1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3179,6 +3179,12 @@ if test "$SQLITE3" = "no" ; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" + fi + ++AC_ARG_ENABLE(codecs-cjk, ++ AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.7.4 + + +From 453934f6ffbcbe113f0a1ca01f6747810472392e Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:50:11 +0100 +Subject: [PATCH 21/32] Add an option to disable NIS + +NIS is not necessarily available in uClibc, so we need an option to +not compile support for it. + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index db47ca1..7a79890 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3185,6 +3185,12 @@ AC_ARG_ENABLE(codecs-cjk, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022" + fi]) + ++AC_ARG_ENABLE(nis, ++ AS_HELP_STRING([--disable-nis], [disable NIS]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.7.4 + + +From 423e0dbcb0e14e8b14b42a77056b646a1eb21ebd Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:50:27 +0100 +Subject: [PATCH 22/32] Add an option to disable unicodedata + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 7a79890..9ea602f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3191,6 +3191,12 @@ AC_ARG_ENABLE(nis, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis" + fi]) + ++AC_ARG_ENABLE(unicodedata, ++ AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.7.4 + + +From d7f5a846ebc198214364fb810880778f5ff16d46 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Wed, 22 Feb 2017 17:45:14 -0800 +Subject: [PATCH 23/32] Add an option to disable IDLE + +IDLE is an IDE embedded into python, written using Tk, so it doesn't make +much sense to have it into our build. + +Signed-off-by: Maxime Ripard +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +--- + Makefile.pre.in | 7 ++++++- + configure.ac | 6 ++++++ + setup.py | 4 +++- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index d703c36..b8e9388 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1219,7 +1219,9 @@ bininstall: altbininstall + -rm -f $(DESTDIR)$(LIBPC)/python3.pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc) + -rm -f $(DESTDIR)$(BINDIR)/idle3 ++ifeq (@IDLE@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 + ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) +@@ -1264,7 +1266,6 @@ LIBSUBDIRS= site-packages \ + html json http dbm xmlrpc \ + logging csv wsgiref urllib \ + ctypes ctypes/macholib \ +- idlelib idlelib/Icons \ + distutils distutils/command \ + importlib \ + turtledemo \ +@@ -1350,6 +1351,10 @@ ifeq (@EXPAT@,yes) + LIBSUBDIRS += $(XMLLIBSUBDIRS) + endif + ++ifeq (@IDLE@,yes) ++LIBSUBDIRS += idlelib idlelib/Icons ++endif ++ + ifeq (@LIB2TO3@,yes) + LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 + TESTSUBDIRS += lib2to3/tests \ +diff --git a/configure.ac b/configure.ac +index 9ea602f..047d080 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3233,6 +3233,12 @@ AC_ARG_ENABLE(lib2to3, + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]), + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) + ++AC_SUBST(IDLE) ++ ++AC_ARG_ENABLE(idle3, ++ AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]), ++ [ IDLE="${enableval}" ], [ IDLE=yes ]) ++ + # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +diff --git a/setup.py b/setup.py +index 27c4e1a..c0995ed 100644 +--- a/setup.py ++++ b/setup.py +@@ -2333,11 +2333,13 @@ def main(): + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) + +- scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] ++ scripts = [ 'Lib/smtpd.py'] + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/pydoc3' ] + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/2to3' ] ++ if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"): ++ scripts += [ 'Tools/scripts/idle3' ] + + setup(# PyPI Metadata (PEP 301) + name = "Python", +-- +2.7.4 + + +From 7dfb61f2454472b8acf1e8fad3867ba91c20273f Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:51:31 +0100 +Subject: [PATCH 24/32] Add an option to disable decimal + +This patch replaces the existing --with-system-libmpdec option with a +--with-libmpdec={system,builtin,none} option, which allows to tell +Python whether we want to use the system libmpdec (already installed), +the libmpdec builtin the Python sources, or no libmpdec at all. + +Signed-off-by: Thomas Petazzoni +[aduskett@gmail.com: Update for python 3.7.0] +Signed-off-by: Adam Duskett +--- + configure.ac | 17 ++++++++++++----- + setup.py | 2 +- + 2 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 047d080..8fd595e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2956,13 +2956,20 @@ fi + AC_SUBST(LIBFFI_INCLUDEDIR) + + # Check for use of the system libmpdec library +-AC_MSG_CHECKING(for --with-system-libmpdec) +-AC_ARG_WITH(system_libmpdec, +- AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]), ++AC_MSG_CHECKING(for --with-libmpdec) ++AC_ARG_WITH(libmpdec, ++ AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]), + [], +- [with_system_libmpdec="no"]) ++ [with_libmpdec="builtin"]) + +-AC_MSG_RESULT($with_system_libmpdec) ++AC_MSG_RESULT($with_libmpdec) ++if test "$with_libmpdec" != "none"; then ++ MPDEC=yes ++else ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal" ++ MPDEC=no ++fi ++AC_SUBST(MPDEC) + + # Check for support for loadable sqlite extensions + AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions) +diff --git a/setup.py b/setup.py +index c0995ed..1a7085c 100644 +--- a/setup.py ++++ b/setup.py +@@ -2010,7 +2010,7 @@ class PyBuildExt(build_ext): + def _decimal_ext(self): + extra_compile_args = [] + undef_macros = [] +- if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): ++ if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"): + include_dirs = [] + libraries = [':libmpdec.so.2'] + sources = ['_decimal/_decimal.c'] +-- +2.7.4 + + +From 27bbc7b6892807d152f1ce808eadfa87fc0e9349 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 23 Dec 2015 11:51:58 +0100 +Subject: [PATCH 25/32] Add an option to disable the ossaudiodev module + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 8fd595e..2287a3e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2971,6 +2971,12 @@ else + fi + AC_SUBST(MPDEC) + ++AC_ARG_ENABLE(ossaudiodev, ++ AS_HELP_STRING([--disable-ossaudiodev], [disable OSSAUDIODEV]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ossaudiodev" ++ fi]) ++ + # Check for support for loadable sqlite extensions + AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions) + AC_ARG_ENABLE(loadable-sqlite-extensions, +-- +2.7.4 + + +From e335230b4e7f82a4e8aa628fd41cc0bac4cbb58b Mon Sep 17 00:00:00 2001 +From: Nicolas Cavallari +Date: Wed, 22 Feb 2017 17:55:59 -0800 +Subject: [PATCH 26/32] Add an option to disable openssl support. + +Signed-off-by: Nicolas Cavallari +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 2287a3e..5433aaa 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3210,6 +3210,12 @@ AC_ARG_ENABLE(unicodedata, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata" + fi]) + ++AC_ARG_ENABLE(openssl, ++ AS_HELP_STRING([--disable-openssl], [disable openssl support]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.7.4 + + +From 3f17b4b32b490f451d20e88f59ad0d12b1a77aa7 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 7 Mar 2017 23:29:05 +0100 +Subject: [PATCH 27/32] Add an option to disable the readline module + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 5433aaa..1bfade6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3216,6 +3216,12 @@ AC_ARG_ENABLE(openssl, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib" + fi]) + ++AC_ARG_ENABLE(readline, ++ AS_HELP_STRING([--disable-readline], [disable readline]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.7.4 + + +From fbe47fb2f70635ffeb7b44d9af23cc6352ade250 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 7 Mar 2017 23:31:11 +0100 +Subject: [PATCH 28/32] Add options to disable zlib, bzip2 and xz modules + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 1bfade6..b022460 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3222,6 +3222,24 @@ AC_ARG_ENABLE(readline, + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline" + fi]) + ++AC_ARG_ENABLE(bzip2, ++ AS_HELP_STRING([--disable-bzip2], [disable bzip2]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _bz2" ++ fi]) ++ ++AC_ARG_ENABLE(zlib, ++ AS_HELP_STRING([--disable-zlib], [disable zlib]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib" ++ fi]) ++ ++AC_ARG_ENABLE(xz, ++ AS_HELP_STRING([--disable-xz], [disable xz]), ++ [ if test "$enableval" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _lzma" ++ fi]) ++ + AC_SUBST(TK) + AC_ARG_ENABLE(tk, + AS_HELP_STRING([--disable-tk], [disable tk]), +-- +2.7.4 + + +From 3ce895014bc7a43e4af09268037ca3ae11ab5434 Mon Sep 17 00:00:00 2001 +From: Matt Weber +Date: Fri, 6 Oct 2017 09:54:15 -0500 +Subject: [PATCH 29/32] python-config.sh: don't reassign ${prefix} + +When prefix is set to a path like /usr during crossbuild +the sed operations end up executing twice, once for the prefix +reassignment and another for includedir if it is set as a string +including the ${prefix} variable. This results in an issue +when the build directory is under /usr. + +This patch updates the remaining location which uses the prefix +variable to also sed and update to use the real path. + +Upstream bug report: +https://bugs.python.org/issue31713 + +Buildroot bug: +https://bugs.busybox.net/show_bug.cgi?id=10361 + +Fixes failures like the following: +dbus-python-1.2.4 | NOK | http://autobuild.buildroot.net/results/758858efa97b6273c1b470513f5492258a6d8853 + +Signed-off-by: Matthew Weber +--- + Misc/python-config.sh.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in +index 9e259c0..8b249d9 100644 +--- a/Misc/python-config.sh.in ++++ b/Misc/python-config.sh.in +@@ -31,7 +31,7 @@ prefix_real=$(installed_prefix "$0") + # locations. Keep prefix & exec_prefix using their original values in case + # they are referenced in other configure variables, to prevent double + # substitution, issue #22140. +-prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#") ++prefix=$prefix_build + exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#") + exec_prefix_real=${prefix_real} + includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#") +@@ -49,7 +49,7 @@ LINKFORSHARED="@LINKFORSHARED@" + OPT="@OPT@" + PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" + LDVERSION="@LDVERSION@" +-LIBDEST=${prefix_real}/lib/python${VERSION} ++LIBDEST=$( echo "${prefix}/lib/python${VERSION}" | sed "s#^$prefix_build#$prefix_real#") + LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#") + SO="@EXT_SUFFIX@" + PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" +-- +2.7.4 + + +From cacbe32e00706bd30ac85c61c3ef7968e7842daa Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Fri, 20 Jul 2018 10:17:39 -0400 +Subject: [PATCH 30/32] Fix cross compiling the uuid module + +Python 3.7 has a new _uuid module, however, the include directory +search path for uuid.h is hardcoded to /usr/include/uuid, which should +not be used when cross-compiling. + +To fix this, use the same solution as the one used by the NIS +detection: append "uuid" to each of the include directories in +"inc_dirs", instead of hardcoding /usr/include/uuid. + +Signed-off-by: Adam Duskett +[Thomas: drop STAGING_DIR based solution, use a solution similar to +the one used for the NIS detection.] +Signed-off-by: Thomas Petazzoni +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 1a7085c..f33d0b5 100644 +--- a/setup.py ++++ b/setup.py +@@ -1627,7 +1627,8 @@ class PyBuildExt(build_ext): + missing.append('_tkinter') + + # Build the _uuid module if possible +- uuid_incs = find_file("uuid.h", inc_dirs, ["/usr/include/uuid"]) ++ uuid_incs = find_file("uuid.h", inc_dirs, ++ [os.path.join(inc_dir, 'uuid') for inc_dir in inc_dirs]) + if uuid_incs is not None: + if self.compiler.find_library_file(lib_dirs, 'uuid'): + uuid_libs = ['uuid'] +-- +2.7.4 + + +From 2fa6601532a26fa443af815515fb4606e3ed365c Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 18 Aug 2018 10:54:56 +0200 +Subject: [PATCH 31/32] Add an option to disable uuid module + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index b022460..505b7c9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3258,6 +3258,15 @@ if test "$CURSES" = "no"; then + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel" + fi + ++AC_SUBST(UUID) ++AC_ARG_ENABLE(uuid, ++ AS_HELP_STRING([--disable-uuid], [disable uuid]), ++ [ UUID="${enableval}" ], [ UUID=yes ]) ++ ++if test "$UUID" = "no"; then ++ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _uuid" ++fi ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.7.4 + + +From 09ce21cc094ef0545eda45299474365d910cb91f Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Thu, 16 Aug 2018 14:52:37 -0700 +Subject: [PATCH 32/32] fix building on older distributions + +Python > 3.6.3 calls os.replace in the update_file.py script, during the +regen-importlib phase of the build process. + +According to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same +way as os.rename, however, it is now cross-platform compatible for Windows. + +Because BuildRoot is guaranteed only to be built in POSIX environment, it is +safe to change os.replace back to os.rename. + +This change fixes building on older systems such as CentOS7, that only come +with python 2. + +Signed-off-by: Adam Duskett +--- + Tools/scripts/update_file.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py +index 224585c..ef458c0 100644 +--- a/Tools/scripts/update_file.py ++++ b/Tools/scripts/update_file.py +@@ -16,7 +16,7 @@ def main(old_path, new_path): + with open(new_path, 'rb') as f: + new_contents = f.read() + if old_contents != new_contents: +- os.replace(new_path, old_path) ++ os.rename(new_path, old_path) + else: + os.unlink(new_path) + +-- +2.7.4 + diff --git a/packages/lang/gcc-linaro-aarch64-elf/package.mk b/packages/lang/gcc-linaro-aarch64-elf/package.mk index 74be5a846a..c98f874d4f 100644 --- a/packages/lang/gcc-linaro-aarch64-elf/package.mk +++ b/packages/lang/gcc-linaro-aarch64-elf/package.mk @@ -1,42 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gcc-linaro-aarch64-elf" -PKG_VERSION="4.9-2016.02" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.9.4-2017.01" +PKG_SHA256="00c79aaf7ff9b1c22f7b0443a730056b3936561a4206af187ef61a4e3cab1716" PKG_LICENSE="GPL" PKG_SITE="" -PKG_URL="https://releases.linaro.org/components/toolchain/binaries/${PKG_VERSION}/aarch64-elf/gcc-linaro-${PKG_VERSION}-x86_64_aarch64-elf.tar.xz" -PKG_SOURCE_DIR="gcc-linaro-${PKG_VERSION}-x86_64_aarch64-elf" -PKG_DEPENDS_HOST="toolchain" -PKG_SECTION="lang" -PKG_SHORTDESC="" -PKG_LONGDESC="" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_host() { - : -} +PKG_URL="https://releases.linaro.org/components/toolchain/binaries/4.9-2017.01/aarch64-elf/gcc-linaro-${PKG_VERSION}-x86_64_aarch64-elf.tar.xz" +PKG_DEPENDS_HOST="ccache:host" +PKG_LONGDESC="Linaro Aarch64 GNU Linux Binary Toolchain" +PKG_TOOLCHAIN="manual" makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/ - cp -a * $ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-elf + mkdir -p $TOOLCHAIN/lib/gcc-linaro-aarch64-elf/ + cp -a * $TOOLCHAIN/lib/gcc-linaro-aarch64-elf } diff --git a/packages/lang/gcc-linaro-aarch64-linux-gnu/package.mk b/packages/lang/gcc-linaro-aarch64-linux-gnu/package.mk new file mode 100644 index 0000000000..6f62acd01d --- /dev/null +++ b/packages/lang/gcc-linaro-aarch64-linux-gnu/package.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="gcc-linaro-aarch64-linux-gnu" +PKG_VERSION="7.3.1-2018.05" +PKG_SHA256="73eed74e593e2267504efbcf3678918bb22409ab7afa3dc7c135d2c6790c2345" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-${PKG_VERSION}-x86_64_aarch64-linux-gnu.tar.xz" +PKG_DEPENDS_HOST="ccache:host" +PKG_LONGDESC="Linaro Aarch64 GNU Linux Binary Toolchain" +PKG_TOOLCHAIN="manual" + +makeinstall_host() { + mkdir -p $TOOLCHAIN/lib/gcc-linaro-aarch64-linux-gnu/ + cp -a * $TOOLCHAIN/lib/gcc-linaro-aarch64-linux-gnu + + # wrap gcc and g++ with ccache like in gcc package.mk + PKG_GCC_PREFIX="$TOOLCHAIN/lib/gcc-linaro-aarch64-linux-gnu/bin/aarch64-linux-gnu-" + + cp "${PKG_GCC_PREFIX}gcc" "${PKG_GCC_PREFIX}gcc.real" +cat > "${PKG_GCC_PREFIX}gcc" << EOF +#!/bin/sh +$TOOLCHAIN/bin/ccache ${PKG_GCC_PREFIX}gcc.real "\$@" +EOF + + chmod +x "${PKG_GCC_PREFIX}gcc" + + cp "${PKG_GCC_PREFIX}g++" "${PKG_GCC_PREFIX}g++.real" +cat > "${PKG_GCC_PREFIX}g++" << EOF +#!/bin/sh +$TOOLCHAIN/bin/ccache ${PKG_GCC_PREFIX}g++.real "\$@" +EOF + + chmod +x "${PKG_GCC_PREFIX}g++" +} diff --git a/packages/lang/gcc-linaro-arm-eabi/package.mk b/packages/lang/gcc-linaro-arm-eabi/package.mk index 73c18914e3..9167b71b19 100644 --- a/packages/lang/gcc-linaro-arm-eabi/package.mk +++ b/packages/lang/gcc-linaro-arm-eabi/package.mk @@ -1,42 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gcc-linaro-arm-eabi" -PKG_VERSION="4.9-2016.02" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.9.4-2017.01" +PKG_SHA256="5fa170a74db172dca098c70ae58f4c08d2fca0232ce135530b2ef4996326b4bd" PKG_LICENSE="GPL" PKG_SITE="" -PKG_URL="https://releases.linaro.org/components/toolchain/binaries/${PKG_VERSION}/arm-eabi/gcc-linaro-${PKG_VERSION}-x86_64_arm-eabi.tar.xz" -PKG_SOURCE_DIR="gcc-linaro-${PKG_VERSION}-x86_64_arm-eabi" -PKG_DEPENDS_HOST="toolchain" -PKG_SECTION="lang" -PKG_SHORTDESC="" -PKG_LONGDESC="" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_host() { - : -} +PKG_URL="https://releases.linaro.org/components/toolchain/binaries/4.9-2017.01/arm-eabi/gcc-linaro-${PKG_VERSION}-x86_64_arm-eabi.tar.xz" +PKG_DEPENDS_HOST="ccache:host" +PKG_LONGDESC="Linaro ARM GNU Linux Binary Toolchain" +PKG_TOOLCHAIN="manual" makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/lib/gcc-linaro-arm-eabi/ - cp -a * $ROOT/$TOOLCHAIN/lib/gcc-linaro-arm-eabi + mkdir -p $TOOLCHAIN/lib/gcc-linaro-arm-eabi/ + cp -a * $TOOLCHAIN/lib/gcc-linaro-arm-eabi } diff --git a/packages/lang/gcc-linaro-arm-linux-gnueabihf/package.mk b/packages/lang/gcc-linaro-arm-linux-gnueabihf/package.mk new file mode 100644 index 0000000000..833e271258 --- /dev/null +++ b/packages/lang/gcc-linaro-arm-linux-gnueabihf/package.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="gcc-linaro-arm-linux-gnueabihf" +PKG_VERSION="7.3.1-2018.05" +PKG_SHA256="7248bf105d0d468887a9b8a7120bb281ac8ad0223d9cb3d00dc7c2d498485d91" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/gcc-linaro-${PKG_VERSION}-x86_64_arm-linux-gnueabihf.tar.xz" +PKG_DEPENDS_HOST="ccache:host" +PKG_LONGDESC="Linaro ARM GNU Linux Binary Toolchain" +PKG_TOOLCHAIN="manual" + +makeinstall_host() { + mkdir -p $TOOLCHAIN/lib/gcc-linaro-arm-linux-gnueabihf/ + cp -a * $TOOLCHAIN/lib/gcc-linaro-arm-linux-gnueabihf + + # wrap gcc and g++ with ccache like in gcc package.mk + PKG_GCC_PREFIX="$TOOLCHAIN/lib/gcc-linaro-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-" + + cp "${PKG_GCC_PREFIX}gcc" "${PKG_GCC_PREFIX}gcc.real" +cat > "${PKG_GCC_PREFIX}gcc" << EOF +#!/bin/sh +$TOOLCHAIN/bin/ccache ${PKG_GCC_PREFIX}gcc.real "\$@" +EOF + + chmod +x "${PKG_GCC_PREFIX}gcc" + + cp "${PKG_GCC_PREFIX}g++" "${PKG_GCC_PREFIX}g++.real" +cat > "${PKG_GCC_PREFIX}g++" << EOF +#!/bin/sh +$TOOLCHAIN/bin/ccache ${PKG_GCC_PREFIX}g++.real "\$@" +EOF + + chmod +x "${PKG_GCC_PREFIX}g++" +} diff --git a/packages/lang/gcc/package.mk b/packages/lang/gcc/package.mk index 59cac8bcf1..f899aeb2b1 100644 --- a/packages/lang/gcc/package.mk +++ b/packages/lang/gcc/package.mk @@ -1,49 +1,30 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gcc" -PKG_VERSION="6.2.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="8.2.0" +PKG_SHA256="196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080" PKG_LICENSE="GPL" PKG_SITE="http://gcc.gnu.org/" -PKG_URL="http://ftpmirror.gnu.org/gcc/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="http://ftpmirror.gnu.org/gcc/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_BOOTSTRAP="ccache:host autoconf:host binutils:host gmp:host mpfr:host mpc:host" PKG_DEPENDS_TARGET="gcc:host" PKG_DEPENDS_HOST="ccache:host autoconf:host binutils:host gmp:host mpfr:host mpc:host glibc" -PKG_SECTION="lang" -PKG_SHORTDESC="gcc: The GNU Compiler Collection Version 4 (aka GNU C Compiler)" -PKG_LONGDESC="This package contains the GNU Compiler Collection. It includes compilers for the languages C, C++, Objective C, Fortran 95, Java and others ... This GCC contains the Stack-Smashing Protector Patch which can be enabled with the -fstack-protector command-line option. More information about it ca be found at http://www.research.ibm.com/trl/projects/security/ssp/." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="This package contains the GNU Compiler Collection." GCC_COMMON_CONFIGURE_OPTS="--target=$TARGET_NAME \ --with-sysroot=$SYSROOT_PREFIX \ - --with-gmp=$ROOT/$TOOLCHAIN \ - --with-mpfr=$ROOT/$TOOLCHAIN \ - --with-mpc=$ROOT/$TOOLCHAIN \ + --with-gmp=$TOOLCHAIN \ + --with-mpfr=$TOOLCHAIN \ + --with-mpc=$TOOLCHAIN \ --with-gnu-as \ --with-gnu-ld \ --enable-plugin \ --enable-lto \ --enable-gold \ --enable-ld=default \ + --with-linker-hash-style=gnu \ --disable-multilib \ --disable-nls \ --enable-checking=release \ @@ -96,7 +77,7 @@ post_make_host() { rm -rf $TARGET_NAME/libgcc/libgcc_s.so ln -sf libgcc_s.so.1 $TARGET_NAME/libgcc/libgcc_s.so - if [ ! "$DEBUG" = yes ]; then + if [ ! "${BUILD_WITH_DEBUG}" = "yes" ]; then ${TARGET_PREFIX}strip $TARGET_NAME/libgcc/libgcc_s.so* ${TARGET_PREFIX}strip $TARGET_NAME/libstdc++-v3/src/.libs/libstdc++.so* fi @@ -105,7 +86,7 @@ post_make_host() { post_makeinstall_host() { cp -PR $TARGET_NAME/libstdc++-v3/src/.libs/libstdc++.so* $SYSROOT_PREFIX/usr/lib - GCC_VERSION=`$ROOT/$TOOLCHAIN/bin/${TARGET_NAME}-gcc -dumpversion` + GCC_VERSION=`$TOOLCHAIN/bin/${TARGET_NAME}-gcc -dumpversion` DATE="0501`echo $GCC_VERSION | sed 's/\([0-9]\)/0\1/g' | sed 's/\.//g'`" CROSS_CC=${TARGET_PREFIX}gcc-${GCC_VERSION} CROSS_CXX=${TARGET_PREFIX}g++-${GCC_VERSION} @@ -114,7 +95,7 @@ post_makeinstall_host() { cat > ${TARGET_PREFIX}gcc < ${TARGET_PREFIX}g++ <. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="llvm" -PKG_VERSION="3.9.0" -PKG_REV="1" +PKG_VERSION="7.0.0" +PKG_SHA256="8bc1f844e6cbde1b652c19c1edebc1864456fd9c78b8c1bea038e51b363fe222" PKG_ARCH="x86_64" PKG_LICENSE="GPL" PKG_SITE="http://llvm.org/" PKG_URL="http://llvm.org/releases/$PKG_VERSION/${PKG_NAME}-${PKG_VERSION}.src.tar.xz" -PKG_SOURCE_DIR="${PKG_NAME}-${PKG_VERSION}.src" +PKG_DEPENDS_HOST="toolchain" PKG_DEPENDS_TARGET="toolchain llvm:host zlib" -PKG_SECTION="lang" -PKG_SHORTDESC="llvm: Low Level Virtual Machine" -PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure designed for compile-time, link-time, run-time, and idle-time optimization of programs from arbitrary programming languages. It currently supports compilation of C, Objective-C, and C++ programs, using front-ends derived from GCC 4.0, GCC 4.2, and a custom new front-end, "clang". It supports x86, x86-64, ia64, PowerPC, and SPARC, with support for Alpha and ARM under development." +PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CMAKE_OPTS_HOST="-DLLVM_INCLUDE_TOOLS=ON \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_BUILD_UTILS=OFF \ - -DLLVM_BUILD_EXAMPLES=OFF \ - -DLLVM_INCLUDE_EXAMPLES=OFF \ - -DLLVM_BUILD_TESTS=OFF \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DLLVM_INCLUDE_GO_TESTS=OFF \ - -DLLVM_BUILD_DOCS=OFF \ - -DLLVM_INCLUDE_DOCS=OFF \ - -DLLVM_ENABLE_DOXYGEN=OFF \ - -DLLVM_ENABLE_SPHINX=OFF \ - -DLLVM_TARGETS_TO_BUILD="AMDGPU" \ - -DLLVM_ENABLE_TERMINFO=OFF \ - -DLLVM_ENABLE_ASSERTIONS=OFF \ - -DLLVM_ENABLE_WERROR=OFF \ - -DLLVM_ENABLE_ZLIB=OFF \ - -DLLVM_OPTIMIZED_TABLEGEN=ON" - -make_host() { - make llvm-config llvm-tblgen -} - -makeinstall_host() { - cp -a bin/llvm-config $SYSROOT_PREFIX/usr/bin/llvm-config-host - cp -a bin/llvm-tblgen $ROOT/$TOOLCHAIN/bin -} - -PKG_CMAKE_OPTS_TARGET="-DCMAKE_BUILD_TYPE=MinSizeRel \ - -DCMAKE_C_FLAGS="$CFLAGS" \ - -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ - -DLLVM_INCLUDE_TOOLS=ON \ +PKG_CMAKE_OPTS_COMMON="-DLLVM_INCLUDE_TOOLS=ON \ -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_BUILD_UTILS=ON \ + -DLLVM_BUILD_UTILS=OFF \ -DLLVM_BUILD_EXAMPLES=OFF \ -DLLVM_INCLUDE_EXAMPLES=OFF \ -DLLVM_BUILD_TESTS=OFF \ @@ -79,15 +29,37 @@ PKG_CMAKE_OPTS_TARGET="-DCMAKE_BUILD_TYPE=MinSizeRel \ -DLLVM_ENABLE_TERMINFO=OFF \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_ENABLE_WERROR=OFF \ - -DLLVM_TARGET_ARCH="$TARGET_ARCH" \ -DLLVM_ENABLE_ZLIB=ON \ -DLLVM_BUILD_LLVM_DYLIB=ON \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DLLVM_OPTIMIZED_TABLEGEN=ON \ - -DLLVM_TABLEGEN=$ROOT/$TOOLCHAIN/bin/llvm-tblgen" + -DLLVM_APPEND_VC_REV=OFF \ + -DLLVM_ENABLE_RTTI=ON" + +PKG_CMAKE_OPTS_HOST="$PKG_CMAKE_OPTS_COMMON \ + -DCMAKE_INSTALL_RPATH=$TOOLCHAIN/lib" + +pre_configure_target() { + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_COMMON \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DLLVM_TARGET_ARCH="$TARGET_ARCH" \ + -DLLVM_TABLEGEN=$TOOLCHAIN/bin/llvm-tblgen" +} + +make_host() { + ninja $NINJA_OPTS llvm-config llvm-tblgen +} + +makeinstall_host() { + cp -a bin/llvm-config $SYSROOT_PREFIX/usr/bin/llvm-config-host + cp -a bin/llvm-tblgen $TOOLCHAIN/bin +} post_makeinstall_target() { rm -rf $INSTALL/usr/bin rm -rf $INSTALL/usr/lib/LLVMHello.so rm -rf $INSTALL/usr/lib/libLTO.so + rm -rf $INSTALL/usr/share } diff --git a/packages/lang/llvm/patches/llvm-0001-disable-go-and-ocaml-bindings.patch b/packages/lang/llvm/patches/llvm-0001-disable-go-and-ocaml-bindings.patch deleted file mode 100644 index a3532505bc..0000000000 --- a/packages/lang/llvm/patches/llvm-0001-disable-go-and-ocaml-bindings.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff -Naur a/cmake/config-ix.cmake b/cmake/config-ix.cmake ---- a/cmake/config-ix.cmake 2016-06-21 12:34:40.000000000 -0700 -+++ b/cmake/config-ix.cmake 2016-09-03 13:00:34.362142473 -0700 -@@ -525,23 +525,7 @@ - endif() - - set(LLVM_BINDINGS "") --if(WIN32) -- message(STATUS "Go bindings disabled.") --else() -- find_program(GO_EXECUTABLE NAMES go DOC "go executable") -- if(GO_EXECUTABLE STREQUAL "GO_EXECUTABLE-NOTFOUND") -- message(STATUS "Go bindings disabled.") -- else() -- execute_process(COMMAND ${GO_EXECUTABLE} run ${PROJECT_SOURCE_DIR}/bindings/go/conftest.go -- RESULT_VARIABLE GO_CONFTEST) -- if(GO_CONFTEST STREQUAL "0") -- set(LLVM_BINDINGS "${LLVM_BINDINGS} go") -- message(STATUS "Go bindings enabled.") -- else() -- message(STATUS "Go bindings disabled, need at least Go 1.2.") -- endif() -- endif() --endif() -+message(STATUS "Go bindings disabled.") - - find_program(GOLD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.gold ld.gold ${LLVM_DEFAULT_TARGET_TRIPLE}-ld ld DOC "The gold linker") - set(LLVM_BINUTILS_INCDIR "" CACHE PATH -@@ -551,28 +535,6 @@ - find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker") - endif() - --include(FindOCaml) --include(AddOCaml) --if(WIN32) -- message(STATUS "OCaml bindings disabled.") --else() -- find_package(OCaml) -- if( NOT OCAML_FOUND ) -- message(STATUS "OCaml bindings disabled.") -- else() -- if( OCAML_VERSION VERSION_LESS "4.00.0" ) -- message(STATUS "OCaml bindings disabled, need OCaml >=4.00.0.") -- else() -- find_ocamlfind_package(ctypes VERSION 0.4 OPTIONAL) -- if( HAVE_OCAML_CTYPES ) -- message(STATUS "OCaml bindings enabled.") -- find_ocamlfind_package(oUnit VERSION 2 OPTIONAL) -- set(LLVM_BINDINGS "${LLVM_BINDINGS} ocaml") -- else() -- message(STATUS "OCaml bindings disabled, need ctypes >=0.4.") -- endif() -- endif() -- endif() --endif() -+message(STATUS "OCaml bindings disabled.") - - string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}") diff --git a/packages/lang/nasm/package.mk b/packages/lang/nasm/package.mk new file mode 100644 index 0000000000..a081a3647f --- /dev/null +++ b/packages/lang/nasm/package.mk @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="nasm" +PKG_VERSION="2.14" +PKG_SHA256="97c615dbf02ef80e4e2b6c385f7e28368d51efc214daa98e600ca4572500eec0" +PKG_ARCH="x86_64" +PKG_LICENSE="BSD" +PKG_SITE="https://www.nasm.us/" +PKG_URL="http://www.nasm.us/pub/nasm/releasebuilds/${PKG_VERSION}/nasm-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_HOST="ccache:host" +PKG_LONGDESC="The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler designed for portability and modularity." diff --git a/packages/lang/yasm/package.mk b/packages/lang/yasm/package.mk index d09fd5e679..2ccc9bd67c 100644 --- a/packages/lang/yasm/package.mk +++ b/packages/lang/yasm/package.mk @@ -18,7 +18,6 @@ PKG_NAME="yasm" PKG_VERSION="1.3.0" -PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="BSD" PKG_SITE="http://www.tortall.net/projects/yasm/" diff --git a/packages/linux-driver-addons/dvb/crazycat/changelog.txt b/packages/linux-driver-addons/dvb/crazycat/changelog.txt new file mode 100755 index 0000000000..32d81ca428 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial add-on diff --git a/packages/linux-driver-addons/dvb/crazycat/icon/icon.png b/packages/linux-driver-addons/dvb/crazycat/icon/icon.png new file mode 100644 index 0000000000..22a6c6a0d9 Binary files /dev/null and b/packages/linux-driver-addons/dvb/crazycat/icon/icon.png differ diff --git a/packages/linux-driver-addons/dvb/crazycat/package.mk b/packages/linux-driver-addons/dvb/crazycat/package.mk new file mode 100644 index 0000000000..cac8da6ebf --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat/package.mk @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="crazycat" +PKG_VERSION="f77791e13e0a29edeb775383f89e37bb1ed80416" +PKG_SHA256="524a5cdbbb653b0db46d20b56249953e473302bd20e8097bf06e3918e5c0a35f" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/CrazyCat/media_build" +PKG_URL="https://bitbucket.org/CrazyCat/media_build/get/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux media_tree_cc" +PKG_NEED_UNPACK="$LINUX_DEPENDS media_tree_cc" +PKG_SECTION="driver.dvb" +PKG_LONGDESC="DVB driver for TBS cards with CrazyCats additions" + +PKG_IS_ADDON="embedded" +PKG_IS_KERNEL_PKG="yes" +PKG_ADDON_IS_STANDALONE="yes" +PKG_ADDON_NAME="DVB drivers for TBS" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_VERSION="${ADDON_VERSION}.${PKG_REV}" + +pre_make_target() { + export KERNEL_VER=$(get_module_dir) + export LDFLAGS="" +} + +make_target() { + cp -RP $(get_build_dir media_tree_cc)/* $PKG_BUILD/linux + + # make config all + kernel_make VER=$KERNEL_VER SRCDIR=$(kernel_path) allyesconfig + + # hack to workaround media_build bug + if [ "$PROJECT" = Rockchip ]; then + sed -e 's/CONFIG_DVB_CXD2820R=m/# CONFIG_DVB_CXD2820R is not set/g' -i v4l/.config + sed -e 's/CONFIG_DVB_LGDT3306A=m/# CONFIG_DVB_LGDT3306A is not set/g' -i v4l/.config + fi + + # add menuconfig to edit .config + kernel_make VER=$KERNEL_VER SRCDIR=$(kernel_path) +} + +makeinstall_target() { + install_driver_addon_files "$PKG_BUILD/v4l/" +} diff --git a/packages/linux-driver-addons/dvb/crazycat/patches/driver.dvb.crazycat-01-remove-rmmod.pl.patch b/packages/linux-driver-addons/dvb/crazycat/patches/driver.dvb.crazycat-01-remove-rmmod.pl.patch new file mode 100644 index 0000000000..b7a80a6434 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat/patches/driver.dvb.crazycat-01-remove-rmmod.pl.patch @@ -0,0 +1,13 @@ +[Patch] without this patch you need to install libproc-processtable-perl at host system + +--- a/v4l/Makefile ++++ b/v4l/Makefile +@@ -51,7 +51,7 @@ + @echo Kernel build directory is $(OUTDIR) + $(MAKE) -C ../linux apply_patches + $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules +- ./scripts/rmmod.pl check ++# ./scripts/rmmod.pl check + # $(MAKE) checkpatch + + mismatch:: prepare firmware diff --git a/packages/linux-driver-addons/dvb/crazycat/patches/driver.dvb.crazycat-02-disable-modules.patch b/packages/linux-driver-addons/dvb/crazycat/patches/driver.dvb.crazycat-02-disable-modules.patch new file mode 100644 index 0000000000..e2659408e8 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat/patches/driver.dvb.crazycat-02-disable-modules.patch @@ -0,0 +1,13 @@ +--- a/v4l/scripts/make_kconfig.pl ++++ b/v4l/scripts/make_kconfig.pl +@@ -626,6 +626,10 @@ ($$) + close OUT; + + # These options should default to off ++disable_config('MEDIA_ANALOG_TV_SUPPORT'); ++disable_config('MEDIA_CAMERA_SUPPORT'); ++disable_config('MEDIA_CEC_SUPPORT'); ++disable_config('SOC_CAMERA'); + disable_config('DVB_AV7110_FIRMWARE'); + disable_config('DVB_CINERGYT2_TUNING'); + disable_config('VIDEO_HELPER_CHIPS_AUTO'); diff --git a/packages/linux-driver-addons/dvb/crazycat/source/default.py b/packages/linux-driver-addons/dvb/crazycat/source/default.py new file mode 100644 index 0000000000..9002b050de --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat/source/default.py @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/changelog.txt b/packages/linux-driver-addons/dvb/crazycat_aml/changelog.txt new file mode 100755 index 0000000000..32d81ca428 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat_aml/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial add-on diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/icon/icon.png b/packages/linux-driver-addons/dvb/crazycat_aml/icon/icon.png new file mode 100644 index 0000000000..22a6c6a0d9 Binary files /dev/null and b/packages/linux-driver-addons/dvb/crazycat_aml/icon/icon.png differ diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/package.mk b/packages/linux-driver-addons/dvb/crazycat_aml/package.mk new file mode 100644 index 0000000000..0cea4556f9 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat_aml/package.mk @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="crazycat_aml" +PKG_VERSION="835dc72da3ee63df7f4057bd0507887454c005d1" +PKG_SHA256="3d68d368a9eda15688c6686caa854a045a753740ec93553d80a4bcfc14c2950a" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/CrazyCat/media_build" +PKG_URL="https://bitbucket.org/CrazyCat/media_build/get/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux media_tree_cc_aml" +PKG_NEED_UNPACK="$LINUX_DEPENDS media_tree_cc_aml" +PKG_SECTION="driver.dvb" +PKG_LONGDESC="DVB drivers from the latest kernel" + +PKG_IS_ADDON="embedded" +PKG_IS_KERNEL_PKG="yes" +PKG_ADDON_IS_STANDALONE="yes" +PKG_ADDON_NAME="DVB drivers from the latest kernel" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_VERSION="${ADDON_VERSION}.${PKG_REV}" + +pre_make_target() { + export KERNEL_VER=$(get_module_dir) + export LDFLAGS="" +} + +make_target() { + cp -RP $(get_build_dir media_tree_cc_aml)/* $PKG_BUILD/linux + + # compile modules + echo "obj-y += video_dev/" >> "$PKG_BUILD/linux/drivers/media/platform/meson/Makefile" + echo "obj-y += wetek/" >> "$PKG_BUILD/linux/drivers/media/platform/meson/Makefile" + + # make config all + kernel_make VER=$KERNEL_VER SRCDIR=$(kernel_path) allyesconfig + + # deactivate several build options + sed '/CONFIG_VIDEO_S5C73M3=m/d' -i $PKG_BUILD/v4l/.config + + # enable AML drivers + echo "CONFIG_IR_MESON=m" >> $PKG_BUILD/v4l/.config + echo "CONFIG_V4L_AMLOGIC_VIDEO=m" >> $PKG_BUILD/v4l/.config + echo "CONFIG_VIDEOBUF_RESOURCE=m" >> $PKG_BUILD/v4l/.config + + kernel_make VER=$KERNEL_VER SRCDIR=$(kernel_path) +} + +makeinstall_target() { + install_driver_addon_files "$PKG_BUILD/v4l/" +} diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-01-remove-rmmod.pl.patch b/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-01-remove-rmmod.pl.patch new file mode 100644 index 0000000000..b7a80a6434 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-01-remove-rmmod.pl.patch @@ -0,0 +1,13 @@ +[Patch] without this patch you need to install libproc-processtable-perl at host system + +--- a/v4l/Makefile ++++ b/v4l/Makefile +@@ -51,7 +51,7 @@ + @echo Kernel build directory is $(OUTDIR) + $(MAKE) -C ../linux apply_patches + $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules +- ./scripts/rmmod.pl check ++# ./scripts/rmmod.pl check + # $(MAKE) checkpatch + + mismatch:: prepare firmware diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-02-disable-modules.patch b/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-02-disable-modules.patch new file mode 100644 index 0000000000..e2659408e8 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-02-disable-modules.patch @@ -0,0 +1,13 @@ +--- a/v4l/scripts/make_kconfig.pl ++++ b/v4l/scripts/make_kconfig.pl +@@ -626,6 +626,10 @@ ($$) + close OUT; + + # These options should default to off ++disable_config('MEDIA_ANALOG_TV_SUPPORT'); ++disable_config('MEDIA_CAMERA_SUPPORT'); ++disable_config('MEDIA_CEC_SUPPORT'); ++disable_config('SOC_CAMERA'); + disable_config('DVB_AV7110_FIRMWARE'); + disable_config('DVB_CINERGYT2_TUNING'); + disable_config('VIDEO_HELPER_CHIPS_AUTO'); diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-03-config_mycompat_h.patch b/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-03-config_mycompat_h.patch new file mode 100644 index 0000000000..174c69a955 --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat_aml/patches/driver.dvb.crazycat_aml-03-config_mycompat_h.patch @@ -0,0 +1,7 @@ +--- /dev/null ++++ b/v4l/config-mycompat.h +@@ -0,0 +1,3 @@ ++#undef NEED_PFN_TO_PHYS ++#undef NEED_WRITEL_RELAXED ++#undef NEED_PM_RUNTIME_GET +-- diff --git a/packages/linux-driver-addons/dvb/crazycat_aml/source/default.py b/packages/linux-driver-addons/dvb/crazycat_aml/source/default.py new file mode 100644 index 0000000000..9002b050de --- /dev/null +++ b/packages/linux-driver-addons/dvb/crazycat_aml/source/default.py @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/linux-driver-addons/dvb/depends/media_tree/package.mk b/packages/linux-driver-addons/dvb/depends/media_tree/package.mk new file mode 100644 index 0000000000..3a53725d0f --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="media_tree" +PKG_VERSION="2018-12-07-e159b6074c82" +PKG_SHA256="8df4e76878239881cf69bddab2f1c69be698c25682d114b706d75123972c95b7" +PKG_LICENSE="GPL" +PKG_SITE="https://git.linuxtv.org/media_tree.git" +PKG_URL="http://linuxtv.org/downloads/drivers/linux-media-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Source of Linux Kernel media_tree subsystem to build with media_build." +PKG_TOOLCHAIN="manual" + +unpack() { + mkdir -p $PKG_BUILD/ + tar -xf $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2 -C $PKG_BUILD/ + + # hack/workaround for borked upstream kernel/media_build + # without removing atomisp there a lot additional includes that + # slowdown build process after modpost from 3min to 6min + # even if atomisp is disabled via kernel.conf + rm -rf $PKG_BUILD/drivers/staging/media/atomisp + sed -i 's|^.*drivers/staging/media/atomisp.*$||' \ + $PKG_BUILD/drivers/staging/media/Kconfig +} diff --git a/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-01-hauppauge.patch b/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-01-hauppauge.patch new file mode 100644 index 0000000000..21294e3191 --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-01-hauppauge.patch @@ -0,0 +1,1479 @@ +Combined patches from https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder +to support all kind of Hauppauge DVB cards. + +diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c +index 0e1f5da..409db8e 100644 +--- a/drivers/media/dvb-frontends/lgdt3306a.c ++++ b/drivers/media/dvb-frontends/lgdt3306a.c +@@ -855,6 +855,7 @@ static int lgdt3306a_fe_sleep(struct dvb_frontend *fe) + static int lgdt3306a_init(struct dvb_frontend *fe) + { + struct lgdt3306a_state *state = fe->demodulator_priv; ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; + u8 val; + int ret; + +@@ -1006,6 +1007,9 @@ static int lgdt3306a_init(struct dvb_frontend *fe) + ret = lgdt3306a_sleep(state); + lg_chkerr(ret); + ++ c->cnr.len = 1; ++ c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ + fail: + return ret; + } +@@ -1606,6 +1610,7 @@ static int lgdt3306a_read_status(struct dvb_frontend *fe, + enum fe_status *status) + { + struct lgdt3306a_state *state = fe->demodulator_priv; ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; + u16 strength = 0; + int ret = 0; + +@@ -1646,6 +1651,15 @@ static int lgdt3306a_read_status(struct dvb_frontend *fe, + default: + ret = -EINVAL; + } ++ ++ if (*status & FE_HAS_SYNC) { ++ c->cnr.len = 1; ++ c->cnr.stat[0].scale = FE_SCALE_DECIBEL; ++ c->cnr.stat[0].svalue = lgdt3306a_calculate_snr_x100(state) * 10; ++ } else { ++ c->cnr.len = 1; ++ c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ } + } + return ret; + } +diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c +index 324493e..4d43424 100644 +--- a/drivers/media/dvb-frontends/si2168.c ++++ b/drivers/media/dvb-frontends/si2168.c +@@ -18,6 +18,10 @@ + + #include "si2168_priv.h" + ++static int dvbt_auto_plp = 1; ++module_param(dvbt_auto_plp, int, 0644); ++MODULE_PARM_DESC(dvbt_auto_plp, "if set, the PLP is set to auto detect DVB-T and DVB-T2 signals"); ++ + static const struct dvb_frontend_ops si2168_ops; + + /* execute firmware command */ +@@ -106,13 +110,12 @@ static int si2168_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) + return ret; + } + +-static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) ++static int si2168_get_status(struct dvb_frontend *fe, enum fe_status *status) + { + struct i2c_client *client = fe->demodulator_priv; + struct si2168_dev *dev = i2c_get_clientdata(client); + struct dtv_frontend_properties *c = &fe->dtv_property_cache; +- int ret, i; +- unsigned int utmp, utmp1, utmp2; ++ int ret, sys; + struct si2168_cmd cmd; + + *status = 0; +@@ -122,7 +125,23 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + goto err; + } + +- switch (c->delivery_system) { ++ sys = c->delivery_system; ++ ++ /* check if we found DVB-T2 during DVB-T tuning */ ++ if (dvbt_auto_plp && sys == SYS_DVBT) { ++ memcpy(cmd.args, "\x87\x01", 2); ++ cmd.wlen = 2; ++ cmd.rlen = 8; ++ ++ ret = si2168_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ if ((cmd.args[3] & 0x0f) == 7) ++ sys = SYS_DVBT2; ++ } ++ ++ switch (sys) { + case SYS_DVBT: + memcpy(cmd.args, "\xa0\x01", 2); + cmd.wlen = 2; +@@ -144,9 +163,29 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + } + + ret = si2168_cmd_execute(client, &cmd); ++ if (dvbt_auto_plp && (ret == -EREMOTEIO)) { ++ /* In auto-PLP mode it is possible to read 0x8701 while ++ * the frontend is in switchover transition. This causes ++ * a status read failure, due to incorrect system. Check ++ * the other sys if we hit this race condition. ++ */ ++ if (sys == SYS_DVBT) { ++ memcpy(cmd.args, "\x50\x01", 2); /* DVB-T2 */ ++ cmd.wlen = 2; ++ cmd.rlen = 14; ++ ret = si2168_cmd_execute(client, &cmd); ++ } else if (sys == SYS_DVBT2) { ++ memcpy(cmd.args, "\xa0\x01", 2); /* DVB-T */ ++ cmd.wlen = 2; ++ cmd.rlen = 13; ++ ret = si2168_cmd_execute(client, &cmd); ++ } ++ } + if (ret) + goto err; + ++ //c->delivery_system = sys; /* update delivery system in case auto-PLP */ ++ + switch ((cmd.args[2] >> 1) & 0x03) { + case 0x01: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; +@@ -157,8 +196,6 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + break; + } + +- dev->fe_status = *status; +- + if (*status & FE_HAS_LOCK) { + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; +@@ -171,8 +208,120 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + dev_dbg(&client->dev, "status=%02x args=%*ph\n", + *status, cmd.rlen, cmd.args); + ++ dev->fe_status = *status; ++ ++ return 0; ++err: ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ ++static int si2168_read_snr(struct dvb_frontend *fe, u16 *snr) ++{ ++ struct i2c_client *client = fe->demodulator_priv; ++ struct si2168_dev *dev = i2c_get_clientdata(client); ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; ++ enum fe_status status = 0; ++ u64 stat_snr; ++ int ret; ++ ++ *snr = 0; ++ ++ if (!dev->active) { ++ ret = -EAGAIN; ++ goto err; ++ } ++ ++ ret = si2168_get_status(fe, &status); ++ if (ret) ++ goto err; ++ ++ if (status & FE_HAS_LOCK) { ++ stat_snr = c->cnr.stat[0].svalue; ++ do_div(stat_snr, 100); ++ *snr = (u16)stat_snr; ++ } ++ ++ dev_dbg(&client->dev, "snr=%02x\n", *snr); ++ ++ return 0; ++err: ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ ++static int si2168_read_signal_strength(struct dvb_frontend *fe, u16 *rssi) ++{ ++ int ret = -ENOSYS; ++ struct i2c_client *client = fe->demodulator_priv; ++ struct si2168_dev *dev = i2c_get_clientdata(client); ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; ++ enum fe_status status = 0; ++ u64 stat_strength; ++ ++ *rssi = 0; ++ ++ if (!dev->active) { ++ ret = -EAGAIN; ++ goto err; ++ } ++ ++ ret = si2168_get_status(fe, &status); ++ if (ret) ++ goto err; ++ ++ if (status & FE_HAS_LOCK) { ++ if (fe->ops.tuner_ops.get_rf_strength) ++ ret = fe->ops.tuner_ops.get_rf_strength(fe, rssi); ++ else if (c->strength.len > 0) { ++ if (c->strength.stat[0].svalue < -80000) ++ *rssi = 0; ++ else { ++ stat_strength = c->strength.stat[0].svalue; ++ do_div(stat_strength, 1000); ++ *rssi = (u16)(stat_strength + 100); ++ *rssi = (*rssi > 100) ? 0xffff : ++ (u16)(((u32)*rssi) * 0xffff / 100); ++ } ++ } ++ } else { ++ c->strength.len = 1; ++ c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ } ++ ++ dev_dbg(&client->dev, "rssi=%02x\n", *rssi); ++ ++ return 0; ++err: ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ ++/* ------------------------------------------------------------------------ */ ++ ++static int si2168_read_ber(struct dvb_frontend *fe, u32 *ber) ++{ ++ struct i2c_client *client = fe->demodulator_priv; ++ struct si2168_dev *dev = i2c_get_clientdata(client); ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; ++ enum fe_status status = 0; ++ int ret, i; ++ unsigned int utmp, utmp1, utmp2; ++ struct si2168_cmd cmd; ++ ++ *ber = 0; ++ ++ if (!dev->active) { ++ ret = -EAGAIN; ++ goto err; ++ } ++ ++ ret = si2168_get_status(fe, &status); ++ if (ret) ++ goto err; ++ + /* BER */ +- if (*status & FE_HAS_VITERBI) { ++ if (status & FE_HAS_VITERBI) { + memcpy(cmd.args, "\x82\x00", 2); + cmd.wlen = 2; + cmd.rlen = 3; +@@ -191,6 +340,9 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + utmp1 = cmd.args[2] * utmp1; + utmp2 = 100000000; /* 10^8 */ + ++ if (cmd.args[1] != 0) ++ *ber = (cmd.args[2] * utmp1) / utmp2; ++ + dev_dbg(&client->dev, + "post_bit_error=%u post_bit_count=%u ber=%u*10^-%u\n", + utmp1, utmp2, cmd.args[2], cmd.args[1]); +@@ -204,8 +356,35 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + ++ return 0; ++err: ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ ++static int si2168_read_ucblocks(struct dvb_frontend *fe, u32 *ucb) ++{ ++ struct i2c_client *client = fe->demodulator_priv; ++ struct si2168_dev *dev = i2c_get_clientdata(client); ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; ++ enum fe_status status = 0; ++ int ret; ++ unsigned int utmp1; ++ struct si2168_cmd cmd; ++ ++ *ucb = 0; ++ ++ if (!dev->active) { ++ ret = -EAGAIN; ++ goto err; ++ } ++ ++ ret = si2168_get_status(fe, &status); ++ if (ret) ++ goto err; ++ + /* UCB */ +- if (*status & FE_HAS_SYNC) { ++ if (status & FE_HAS_SYNC) { + memcpy(cmd.args, "\x84\x01", 2); + cmd.wlen = 2; + cmd.rlen = 3; +@@ -220,11 +399,61 @@ static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) + if (utmp1 == 0xffff) + utmp1 = 0; + ++ *ucb = utmp1; ++ + c->block_error.stat[0].scale = FE_SCALE_COUNTER; + c->block_error.stat[0].uvalue += utmp1; + } else { + c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } ++ return 0; ++err: ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ ++ ++static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) ++{ ++ struct i2c_client *client = fe->demodulator_priv; ++ struct si2168_dev *dev = i2c_get_clientdata(client); ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; ++ int ret; ++ u16 rssi; ++ u32 ber, ucb; ++ ++ *status = 0; ++ ++ if (!dev->active) { ++ ret = -EAGAIN; ++ goto err; ++ } ++ ++ ret = si2168_get_status(fe, status); ++ if (ret) ++ goto err; ++ ++ if ((*status & FE_HAS_LOCK) == 0) { ++ /* No lock, reset all statistics */ ++ c->strength.len = 1; ++ c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ return 0; ++ } ++ ++ ret = si2168_read_signal_strength(fe, &rssi); ++ if (ret) ++ goto err; ++ ++ ret = si2168_read_ber(fe, &ber); ++ if (ret) ++ goto err; ++ ++ ret = si2168_read_ucblocks(fe, &ucb); ++ if (ret) ++ goto err; + + return 0; + err: +@@ -254,7 +483,10 @@ static int si2168_set_frontend(struct dvb_frontend *fe) + + switch (c->delivery_system) { + case SYS_DVBT: +- delivery_system = 0x20; ++ if (dvbt_auto_plp) ++ delivery_system = 0xf0; /* T/T2 auto-detect is user friendly */ ++ else ++ delivery_system = 0x20; + break; + case SYS_DVBC_ANNEX_A: + delivery_system = 0x30; +@@ -324,6 +556,16 @@ static int si2168_set_frontend(struct dvb_frontend *fe) + ret = si2168_cmd_execute(client, &cmd); + if (ret) + goto err; ++ } else if (dvbt_auto_plp && (c->delivery_system == SYS_DVBT)) { ++ /* select Auto PLP */ ++ cmd.args[0] = 0x52; ++ cmd.args[1] = 0; ++ cmd.args[2] = 0; /* Auto PLP */ ++ cmd.wlen = 3; ++ cmd.rlen = 1; ++ ret = si2168_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; + } + + memcpy(cmd.args, "\x51\x03", 2); +@@ -363,6 +605,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe) + + memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); + cmd.args[4] = delivery_system | bandwidth; ++ if (delivery_system == 0xf0) ++ cmd.args[5] |= 2; /* Auto detect DVB-T/T2 */ + if (dev->spectral_inversion) + cmd.args[5] |= 1; + cmd.wlen = 6; +@@ -384,6 +628,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe) + } + + memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6); ++ /* BUGBUG? FW defaults to 1, but windows driver uses 30; above is 0? */ ++ cmd.args[5] = 30; + cmd.wlen = 6; + cmd.rlen = 4; + ret = si2168_cmd_execute(client, &cmd); +@@ -714,6 +960,11 @@ static const struct dvb_frontend_ops si2168_ops = { + .set_frontend = si2168_set_frontend, + + .read_status = si2168_read_status, ++ ++ .read_ber = si2168_read_ber, ++ .read_signal_strength = si2168_read_signal_strength, ++ .read_snr = si2168_read_snr, ++ .read_ucblocks = si2168_read_ucblocks, + }; + + static int si2168_probe(struct i2c_client *client, +diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c +index b168bf3..1f06119 100644 +--- a/drivers/media/i2c/cx25840/cx25840-core.c ++++ b/drivers/media/i2c/cx25840/cx25840-core.c +@@ -684,14 +684,14 @@ static void cx23885_initialize(struct i2c_client *client) + */ + cx25840_write4(client, 0x404, 0x0010253e); + +- /* CC on - Undocumented Register */ ++ /* CC on - VBI_LINE_CTRL3, FLD_VBI_MD_LINE12 */ + cx25840_write(client, state->vbi_regs_offset + 0x42f, 0x66); + + /* HVR-1250 / HVR1850 DIF related */ + /* Power everything up */ + cx25840_write4(client, 0x130, 0x0); + +- /* Undocumented */ ++ /* SRC_COMB_CFG */ + if (is_cx23888(state)) + cx25840_write4(client, 0x454, 0x6628021F); + else +@@ -1127,16 +1127,25 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp + cx25840_write4(client, 0x410, 0xffff0dbf); + cx25840_write4(client, 0x414, 0x00137d03); + +- cx25840_write4(client, state->vbi_regs_offset + 0x42c, 0x42600000); +- cx25840_write4(client, state->vbi_regs_offset + 0x430, 0x0000039b); +- cx25840_write4(client, state->vbi_regs_offset + 0x438, 0x00000000); +- +- cx25840_write4(client, state->vbi_regs_offset + 0x440, 0xF8E3E824); +- cx25840_write4(client, state->vbi_regs_offset + 0x444, 0x401040dc); +- cx25840_write4(client, state->vbi_regs_offset + 0x448, 0xcd3f02a0); +- cx25840_write4(client, state->vbi_regs_offset + 0x44c, 0x161f1000); +- cx25840_write4(client, state->vbi_regs_offset + 0x450, 0x00000802); +- ++ /* These are not VBI controls */ ++ if (is_cx23888(state)) { ++ /* 888 MISC_TIM_CTRL */ ++ cx25840_write4(client, 0x42c, 0x42600000); ++ /* 888 FIELD_COUNT */ ++ cx25840_write4(client, 0x430, 0x0000039b); ++ /* 888 VSCALE_CTRL */ ++ cx25840_write4(client, 0x438, 0x00000000); ++ /* 888 DFE_CTRL1 */ ++ cx25840_write4(client, 0x440, 0xF8E3E824); ++ /* 888 DFE_CTRL2 */ ++ cx25840_write4(client, 0x444, 0x401040dc); ++ /* 888 DFE_CTRL3 */ ++ cx25840_write4(client, 0x448, 0xcd3f02a0); ++ /* 888 PLL_CTRL */ ++ cx25840_write4(client, 0x44c, 0x161f1000); ++ /* 888 HTL_CTRL */ ++ cx25840_write4(client, 0x450, 0x00000802); ++ } + cx25840_write4(client, 0x91c, 0x01000000); + cx25840_write4(client, 0x8e0, 0x03063870); + cx25840_write4(client, 0x8d4, 0x7FFF0024); +@@ -1743,6 +1752,7 @@ static int cx25840_s_stream(struct v4l2_subdev *sd, int enable) + if (is_cx2388x(state) || is_cx231xx(state)) + return 0; + ++ /* PIN_CTRL1 */ + if (enable) { + v = cx25840_read(client, 0x115) | 0x0c; + cx25840_write(client, 0x115, v); +diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c +index ed3210d..9598b99 100644 +--- a/drivers/media/pci/cx23885/cx23885-cards.c ++++ b/drivers/media/pci/cx23885/cx23885-cards.c +@@ -325,8 +325,7 @@ struct cx23885_board cx23885_boards[] = { + .name = "Hauppauge WinTV-HVR1255", + .porta = CX23885_ANALOG_VIDEO, + .portc = CX23885_MPEG_DVB, +- .tuner_type = TUNER_ABSENT, +- .tuner_addr = 0x42, /* 0x84 >> 1 */ ++ .tuner_type = TUNER_NXP_TDA18271, + .force_bff = 1, + .input = {{ + .type = CX23885_VMUX_TELEVISION, +@@ -354,8 +353,7 @@ struct cx23885_board cx23885_boards[] = { + .name = "Hauppauge WinTV-HVR1255", + .porta = CX23885_ANALOG_VIDEO, + .portc = CX23885_MPEG_DVB, +- .tuner_type = TUNER_ABSENT, +- .tuner_addr = 0x42, /* 0x84 >> 1 */ ++ .tuner_type = TUNER_NXP_TDA18271, + .force_bff = 1, + .input = {{ + .type = CX23885_VMUX_TELEVISION, +@@ -767,24 +765,48 @@ struct cx23885_board cx23885_boards[] = { + } }, + }, + [CX23885_BOARD_HAUPPAUGE_QUADHD_DVB] = { +- .name = "Hauppauge WinTV-QuadHD-DVB", ++ .name = "Hauppauge WinTV-QuadHD-DVB", ++ .porta = CX23885_ANALOG_VIDEO, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, ++ .tuner_type = TUNER_ABSENT, ++ .force_bff = 1, ++ .input = {{ ++ .type = CX23885_VMUX_TELEVISION, ++ .vmux = CX25840_VIN7_CH3 | ++ CX25840_VIN5_CH2 | ++ CX25840_VIN2_CH1 | ++ CX25840_DIF_ON, ++ .amux = CX25840_AUDIO8, ++ } }, + }, + [CX23885_BOARD_HAUPPAUGE_QUADHD_DVB_885] = { +- .name = "Hauppauge WinTV-QuadHD-DVB(885)", ++ .name = "Hauppauge WinTV-QuadHD-DVB(885)", + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, ++ .tuner_type = TUNER_ABSENT, + }, + [CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC] = { +- .name = "Hauppauge WinTV-QuadHD-ATSC", ++ .name = "Hauppauge WinTV-QuadHD-ATSC", ++ .porta = CX23885_ANALOG_VIDEO, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, ++ .tuner_type = TUNER_ABSENT, ++ .force_bff = 1, ++ .input = {{ ++ .type = CX23885_VMUX_TELEVISION, ++ .vmux = CX25840_VIN7_CH3 | ++ CX25840_VIN5_CH2 | ++ CX25840_VIN2_CH1 | ++ CX25840_DIF_ON, ++ .amux = CX25840_AUDIO8, ++ } }, + }, + [CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC_885] = { +- .name = "Hauppauge WinTV-QuadHD-ATSC(885)", ++ .name = "Hauppauge WinTV-QuadHD-ATSC(885)", + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, ++ .tuner_type = TUNER_ABSENT, + }, + [CX23885_BOARD_HAUPPAUGE_HVR1265_K4] = { + .name = "Hauppauge WinTV-HVR-1265(161111)", +@@ -793,6 +815,13 @@ struct cx23885_board cx23885_boards[] = { + .tuner_type = TUNER_ABSENT, + .force_bff = 1, + .input = {{ ++ .type = CX23885_VMUX_TELEVISION, ++ .vmux = CX25840_VIN7_CH3 | ++ CX25840_VIN5_CH2 | ++ CX25840_VIN2_CH1 | ++ CX25840_DIF_ON, ++ .amux = CX25840_AUDIO8, ++ }, { + .type = CX23885_VMUX_COMPOSITE1, + .vmux = CX25840_VIN7_CH3 | + CX25840_VIN4_CH2 | +diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c +index 0d0929c..0366c4d 100644 +--- a/drivers/media/pci/cx23885/cx23885-dvb.c ++++ b/drivers/media/pci/cx23885/cx23885-dvb.c +@@ -2382,6 +2382,16 @@ static int dvb_register(struct cx23885_tsport *port) + goto frontend_detach; + } + port->i2c_client_tuner = client_tuner; ++ ++ /* we only attach tuner for analog on the 888 version */ ++ if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_DVB) { ++ pr_info("%s(): QUADHD_DVB analog setup\n", ++ __func__); ++ dev->ts1.analog_fe.tuner_priv = client_tuner; ++ memcpy(&dev->ts1.analog_fe.ops.tuner_ops, ++ &fe0->dvb.frontend->ops.tuner_ops, ++ sizeof(struct dvb_tuner_ops)); ++ } + break; + + /* port c - terrestrial/cable */ +@@ -2471,6 +2481,16 @@ static int dvb_register(struct cx23885_tsport *port) + goto frontend_detach; + } + port->i2c_client_tuner = client_tuner; ++ ++ /* we only attach tuner for analog on the 888 version */ ++ if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC) { ++ pr_info("%s(): QUADHD_ATSC analog setup\n", ++ __func__); ++ dev->ts1.analog_fe.tuner_priv = client_tuner; ++ memcpy(&dev->ts1.analog_fe.ops.tuner_ops, ++ &fe0->dvb.frontend->ops.tuner_ops, ++ sizeof(struct dvb_tuner_ops)); ++ } + break; + + /* port c - terrestrial/cable */ +@@ -2542,6 +2562,11 @@ static int dvb_register(struct cx23885_tsport *port) + goto frontend_detach; + } + port->i2c_client_tuner = client_tuner; ++ ++ dev->ts1.analog_fe.tuner_priv = client_tuner; ++ memcpy(&dev->ts1.analog_fe.ops.tuner_ops, ++ &fe0->dvb.frontend->ops.tuner_ops, ++ sizeof(struct dvb_tuner_ops)); + break; + } + break; +diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c +index 168178c..6d6e7fb 100644 +--- a/drivers/media/pci/cx23885/cx23885-video.c ++++ b/drivers/media/pci/cx23885/cx23885-video.c +@@ -264,6 +264,8 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111) || + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1265_K4) || ++ (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC) || ++ (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_DVB) || + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) || + (dev->board == CX23885_BOARD_MYGICA_X8507) || + (dev->board == CX23885_BOARD_AVERMEDIA_HC81R) || +@@ -644,8 +646,17 @@ static int vidioc_querycap(struct file *file, void *priv, + sizeof(cap->card)); + sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); + cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_AUDIO; +- if (dev->tuner_type != TUNER_ABSENT) ++ switch (dev->board) { /* i2c device tuners */ ++ case CX23885_BOARD_HAUPPAUGE_HVR1265_K4: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: + cap->device_caps |= V4L2_CAP_TUNER; ++ break; ++ default: ++ if (dev->tuner_type != TUNER_ABSENT) ++ cap->device_caps |= V4L2_CAP_TUNER; ++ break; ++ } + if (vdev->vfl_type == VFL_TYPE_VBI) + cap->device_caps |= V4L2_CAP_VBI_CAPTURE; + else +@@ -899,8 +910,16 @@ static int vidioc_g_tuner(struct file *file, void *priv, + { + struct cx23885_dev *dev = video_drvdata(file); + +- if (dev->tuner_type == TUNER_ABSENT) +- return -EINVAL; ++ switch (dev->board) { /* i2c device tuners */ ++ case CX23885_BOARD_HAUPPAUGE_HVR1265_K4: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: ++ break; ++ default: ++ if (dev->tuner_type == TUNER_ABSENT) ++ return -EINVAL; ++ break; ++ } + if (0 != t->index) + return -EINVAL; + +@@ -915,8 +934,16 @@ static int vidioc_s_tuner(struct file *file, void *priv, + { + struct cx23885_dev *dev = video_drvdata(file); + +- if (dev->tuner_type == TUNER_ABSENT) +- return -EINVAL; ++ switch (dev->board) { /* i2c device tuners */ ++ case CX23885_BOARD_HAUPPAUGE_HVR1265_K4: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: ++ break; ++ default: ++ if (dev->tuner_type == TUNER_ABSENT) ++ return -EINVAL; ++ break; ++ } + if (0 != t->index) + return -EINVAL; + /* Update the A/V core */ +@@ -930,9 +957,16 @@ static int vidioc_g_frequency(struct file *file, void *priv, + { + struct cx23885_dev *dev = video_drvdata(file); + +- if (dev->tuner_type == TUNER_ABSENT) +- return -EINVAL; +- ++ switch (dev->board) { /* i2c device tuners */ ++ case CX23885_BOARD_HAUPPAUGE_HVR1265_K4: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: ++ break; ++ default: ++ if (dev->tuner_type == TUNER_ABSENT) ++ return -EINVAL; ++ break; ++ } + f->type = V4L2_TUNER_ANALOG_TV; + f->frequency = dev->freq; + +@@ -946,8 +980,16 @@ static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency + struct v4l2_ctrl *mute; + int old_mute_val = 1; + +- if (dev->tuner_type == TUNER_ABSENT) +- return -EINVAL; ++ switch (dev->board) { /* i2c device tuners */ ++ case CX23885_BOARD_HAUPPAUGE_HVR1265_K4: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: ++ break; ++ default: ++ if (dev->tuner_type == TUNER_ABSENT) ++ return -EINVAL; ++ break; ++ } + if (unlikely(f->tuner != 0)) + return -EINVAL; + +@@ -1012,7 +1054,9 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev, + if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) || + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111) || +- (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1265_K4)) ++ (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1265_K4) || ++ (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_DVB) || ++ (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC)) + fe = &dev->ts1.analog_fe; + + if (fe && fe->ops.tuner_ops.set_analog_params) { +@@ -1043,6 +1087,8 @@ int cx23885_set_frequency(struct file *file, void *priv, + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: + case CX23885_BOARD_HAUPPAUGE_HVR1265_K4: + case CX23885_BOARD_HAUPPAUGE_HVR1850: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: ++ case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: + ret = cx23885_set_freq_via_ops(dev, f); + break; + default: +diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c +index d389f1f..b93f333 100644 +--- a/drivers/media/tuners/si2157.c ++++ b/drivers/media/tuners/si2157.c +@@ -1,5 +1,5 @@ + /* +- * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver ++ * Silicon Labs Si2141/2146/2147/2148/2157/2158 silicon tuner driver + * + * Copyright (C) 2014 Antti Palosaari + * +@@ -56,14 +56,20 @@ static int si2157_cmd_execute(struct i2c_client *client, struct si2157_cmd *cmd) + break; + } + +- dev_dbg(&client->dev, "cmd execution took %d ms\n", ++ dev_dbg(&client->dev, "cmd execution took %d ms, status=%x\n", + jiffies_to_msecs(jiffies) - +- (jiffies_to_msecs(timeout) - TIMEOUT)); ++ (jiffies_to_msecs(timeout) - TIMEOUT), ++ cmd->args[0]); + + if (!((cmd->args[0] >> 7) & 0x01)) { + ret = -ETIMEDOUT; + goto err_mutex_unlock; + } ++ /* check error status bit */ ++ if (cmd->args[0] & 0x40) { ++ ret = -EAGAIN; ++ goto err_mutex_unlock; ++ } + } + + mutex_unlock(&dev->i2c_mutex); +@@ -84,24 +90,23 @@ static int si2157_init(struct dvb_frontend *fe) + struct si2157_cmd cmd; + const struct firmware *fw; + const char *fw_name; +- unsigned int uitmp, chip_id; ++ unsigned int chip_id, xtal_trim; + + dev_dbg(&client->dev, "\n"); + +- /* Returned IF frequency is garbage when firmware is not running */ +- memcpy(cmd.args, "\x15\x00\x06\x07", 4); ++ /* Try to get Xtal trim property, to verify tuner still running */ ++ memcpy(cmd.args, "\x15\x00\x04\x02", 4); + cmd.wlen = 4; + cmd.rlen = 4; + ret = si2157_cmd_execute(client, &cmd); +- if (ret) +- goto err; + +- uitmp = cmd.args[2] << 0 | cmd.args[3] << 8; +- dev_dbg(&client->dev, "if_frequency kHz=%u\n", uitmp); ++ xtal_trim = cmd.args[2] | (cmd.args[3] << 8); + +- if (uitmp == dev->if_frequency / 1000) ++ if ((ret == 0) && (xtal_trim < 16)) + goto warm; + ++ dev->if_frequency = 0; /* we no longer know current tuner state */ ++ + /* power up */ + if (dev->chiptype == SI2157_CHIPTYPE_SI2146) { + memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9); +@@ -230,6 +235,45 @@ skip_fw_download: + + dev_info(&client->dev, "firmware version: %c.%c.%d\n", + cmd.args[6], cmd.args[7], cmd.args[8]); ++ ++ if (dev->chiptype == SI2157_CHIPTYPE_SI2141) { ++ /* set clock */ ++ memcpy(cmd.args, "\xc0\x00\x0d", 3); ++ cmd.wlen = 3; ++ cmd.rlen = 1; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ /* setup PIN */ ++ memcpy(cmd.args, "\x12\x80\x80\x85\x00\x81\x00", 7); ++ cmd.wlen = 7; ++ cmd.rlen = 7; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ } ++ ++ /* enable tuner status flags */ ++ memcpy(cmd.args, "\x14\x00\x01\x05\x01\x00", 6); ++ cmd.wlen = 6; ++ cmd.rlen = 1; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ memcpy(cmd.args, "\x14\x00\x01\x06\x01\x00", 6); ++ cmd.wlen = 6; ++ cmd.rlen = 1; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ memcpy(cmd.args, "\x14\x00\x01\x07\x01\x00", 6); ++ cmd.wlen = 6; ++ cmd.rlen = 1; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; + warm: + /* init statistics in order signal app which are supported */ + c->strength.len = 1; +@@ -274,6 +318,84 @@ err: + return ret; + } + ++static int si2157_tune_wait(struct i2c_client *client, u8 is_digital) ++{ ++#define TUN_TIMEOUT 40 ++#define DIG_TIMEOUT 30 ++#define ANALOG_TIMEOUT 150 ++ struct si2157_dev *dev = i2c_get_clientdata(client); ++ int ret; ++ unsigned long timeout; ++ unsigned long start_time; ++ u8 wait_status; ++ u8 tune_lock_mask; ++ ++ if (is_digital) ++ tune_lock_mask = 0x04; ++ else ++ tune_lock_mask = 0x02; ++ ++ mutex_lock(&dev->i2c_mutex); ++ ++ /* wait tuner command complete */ ++ start_time = jiffies; ++ timeout = start_time + msecs_to_jiffies(TUN_TIMEOUT); ++ while (!time_after(jiffies, timeout)) { ++ ret = i2c_master_recv(client, &wait_status, ++ sizeof(wait_status)); ++ if (ret < 0) { ++ goto err_mutex_unlock; ++ } else if (ret != sizeof(wait_status)) { ++ ret = -EREMOTEIO; ++ goto err_mutex_unlock; ++ } ++ ++ /* tuner done? */ ++ if ((wait_status & 0x81) == 0x81) ++ break; ++ usleep_range(5000, 10000); ++ } ++ /* if we tuned ok, wait a bit for tuner lock */ ++ if ((wait_status & 0x81) == 0x81) { ++ if (is_digital) ++ timeout = jiffies + msecs_to_jiffies(DIG_TIMEOUT); ++ else ++ timeout = jiffies + msecs_to_jiffies(ANALOG_TIMEOUT); ++ while (!time_after(jiffies, timeout)) { ++ ret = i2c_master_recv(client, &wait_status, ++ sizeof(wait_status)); ++ if (ret < 0) { ++ goto err_mutex_unlock; ++ } else if (ret != sizeof(wait_status)) { ++ ret = -EREMOTEIO; ++ goto err_mutex_unlock; ++ } ++ ++ /* tuner locked? */ ++ if (wait_status & tune_lock_mask) ++ break; ++ usleep_range(5000, 10000); ++ } ++ } ++ ++ dev_dbg(&client->dev, "tuning took %d ms, status=0x%x\n", ++ jiffies_to_msecs(jiffies) - jiffies_to_msecs(start_time), ++ wait_status); ++ ++ if ((wait_status & 0xc0) != 0x80) { ++ ret = -ETIMEDOUT; ++ goto err_mutex_unlock; ++ } ++ ++ mutex_unlock(&dev->i2c_mutex); ++ return 0; ++ ++err_mutex_unlock: ++ mutex_unlock(&dev->i2c_mutex); ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ + static int si2157_set_params(struct dvb_frontend *fe) + { + struct i2c_client *client = fe->tuner_priv; +@@ -344,7 +466,7 @@ static int si2157_set_params(struct dvb_frontend *fe) + if (ret) + goto err; + +- /* set if frequency if needed */ ++ /* set digital if frequency if needed */ + if (if_frequency != dev->if_frequency) { + memcpy(cmd.args, "\x14\x00\x06\x07", 4); + cmd.args[4] = (if_frequency / 1000) & 0xff; +@@ -358,7 +480,7 @@ static int si2157_set_params(struct dvb_frontend *fe) + dev->if_frequency = if_frequency; + } + +- /* set frequency */ ++ /* set digital frequency */ + memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); + cmd.args[4] = (c->frequency >> 0) & 0xff; + cmd.args[5] = (c->frequency >> 8) & 0xff; +@@ -370,24 +492,298 @@ static int si2157_set_params(struct dvb_frontend *fe) + if (ret) + goto err; + ++ dev->bandwidth = bandwidth; ++ dev->frequency = c->frequency; ++ ++ si2157_tune_wait(client, 1); /* wait to complete, ignore any errors */ ++ ++ return 0; ++err: ++ dev->bandwidth = 0; ++ dev->frequency = 0; ++ dev->if_frequency = 0; ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ ++static int si2157_set_analog_params(struct dvb_frontend *fe, ++ struct analog_parameters *params) ++{ ++ struct i2c_client *client = fe->tuner_priv; ++ struct si2157_dev *dev = i2c_get_clientdata(client); ++ char *std; /* for debugging */ ++ int ret; ++ struct si2157_cmd cmd; ++ u32 bandwidth = 0; ++ u32 if_frequency = 0; ++ u32 freq = 0; ++ u64 tmp_lval = 0; ++ u8 system = 0; ++ u8 color = 0; /* 0=NTSC/PAL, 0x10=SECAM */ ++ u8 invert_analog = 1; /* analog tuner spectrum; 0=normal, 1=inverted */ ++ ++ if (dev->chiptype != SI2157_CHIPTYPE_SI2157) { ++ dev_info(&client->dev, "%s: Analog tuning not supported for chiptype=%u\n", ++ __func__, dev->chiptype); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ if (!dev->active) ++ si2157_init(fe); ++ ++ if (!dev->active) { ++ ret = -EAGAIN; ++ goto err; ++ } ++ if (params->mode == V4L2_TUNER_RADIO) { ++ /* ++ * std = "fm"; ++ * bandwidth = 1700000; //best can do for FM, AGC will be a mess though ++ * if_frequency = 1250000; //HVR-225x(saa7164), HVR-12xx(cx23885) ++ * if_frequency = 6600000; //HVR-9xx(cx231xx) ++ * if_frequency = 5500000; //HVR-19xx(pvrusb2) ++ */ ++ dev_dbg(&client->dev, "si2157 does not currently support FM radio\n"); ++ ret = -EINVAL; ++ goto err; ++ } ++ tmp_lval = params->frequency * 625LL; ++ do_div(tmp_lval, 10); /* convert to HZ */ ++ freq = (u32)tmp_lval; ++ ++ if (freq < 1000000) /* is freq in KHz */ ++ freq = freq * 1000; ++ dev->frequency = freq; ++ ++ /* if_frequency values based on tda187271C2 */ ++ if (params->std & (V4L2_STD_B|V4L2_STD_GH)) { ++ if (freq >= 470000000) { ++ std = "palGH"; ++ bandwidth = 8000000; ++ if_frequency = 6000000; ++ system = 1; ++ if (params->std & (V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)) { ++ std = "secamGH"; ++ color = 0x10; ++ } ++ } else { ++ std = "palB"; ++ bandwidth = 7000000; ++ if_frequency = 6000000; ++ system = 0; ++ if (params->std & V4L2_STD_SECAM_B) { ++ std = "secamB"; ++ color = 0x10; ++ } ++ } ++ } else if (params->std & V4L2_STD_MN) { ++ std = "MN"; ++ bandwidth = 6000000; ++ if_frequency = 5400000; ++ system = 2; ++ } else if (params->std & V4L2_STD_PAL_I) { ++ std = "palI"; ++ bandwidth = 8000000; ++ if_frequency = 7250000; /* TODO: does not work yet */ ++ system = 4; ++ } else if (params->std & V4L2_STD_DK) { ++ std = "palDK"; ++ bandwidth = 8000000; ++ if_frequency = 6900000; /* TODO: does not work yet */ ++ system = 5; ++ if (params->std & V4L2_STD_SECAM_DK) { ++ std = "secamDK"; ++ color = 0x10; ++ } ++ } else if (params->std & V4L2_STD_SECAM_L) { ++ std = "secamL"; ++ bandwidth = 8000000; ++ if_frequency = 6750000; /* TODO: untested */ ++ system = 6; ++ color = 0x10; ++ } else if (params->std & V4L2_STD_SECAM_LC) { ++ std = "secamL'"; ++ bandwidth = 7000000; ++ if_frequency = 1250000; /* TODO: untested */ ++ system = 7; ++ color = 0x10; ++ } else { ++ std = "unknown"; ++ } ++ /* calc channel center freq */ ++ freq = freq - 1250000 + (bandwidth/2); ++ ++ dev_dbg(&client->dev, ++ "mode=%d system=%u std='%s' params->frequency=%u center freq=%u if=%u bandwidth=%u\n", ++ params->mode, system, std, params->frequency, ++ freq, if_frequency, bandwidth); ++ ++ /* set analog IF port */ ++ memcpy(cmd.args, "\x14\x00\x03\x06\x08\x02", 6); ++ /* in using dev->if_port, we assume analog and digital IF's */ ++ /* are always on different ports */ ++ /* assumes if_port definition is 0 or 1 for digital out */ ++ cmd.args[4] = (dev->if_port == 1)?8:10; ++ cmd.args[5] = (dev->if_port == 1)?2:1; /* Analog AGC assumed external */ ++ cmd.wlen = 6; ++ cmd.rlen = 4; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ /* set analog IF output config */ ++ memcpy(cmd.args, "\x14\x00\x0d\x06\x94\x64", 6); ++ cmd.wlen = 6; ++ cmd.rlen = 4; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ /* make this distinct from a digital IF */ ++ dev->if_frequency = if_frequency | 1; ++ ++ /* calc and set tuner analog if center frequency */ ++ if_frequency = if_frequency + 1250000 - (bandwidth/2); ++ dev_dbg(&client->dev, "IF Ctr freq=%d\n", if_frequency); ++ ++ memcpy(cmd.args, "\x14\x00\x0C\x06", 4); ++ cmd.args[4] = (if_frequency / 1000) & 0xff; ++ cmd.args[5] = ((if_frequency / 1000) >> 8) & 0xff; ++ cmd.wlen = 6; ++ cmd.rlen = 4; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ /* set analog AGC config */ ++ memcpy(cmd.args, "\x14\x00\x07\x06\x32\xc8", 6); ++ cmd.wlen = 6; ++ cmd.rlen = 4; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ /* set analog video mode */ ++ memcpy(cmd.args, "\x14\x00\x04\x06\x00\x00", 6); ++ cmd.args[4] = system | color; ++#if 1 /* can use dev->inversion if assumed it applies to both digital/analog */ ++ if (invert_analog) ++ cmd.args[5] |= 0x02; ++#else ++ if (dev->inversion) ++ cmd.args[5] |= 0x02; ++#endif ++ cmd.wlen = 6; ++ cmd.rlen = 1; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ /* set analog frequency */ ++ memcpy(cmd.args, "\x41\x01\x00\x00\x00\x00\x00\x00", 8); ++ cmd.args[4] = (freq >> 0) & 0xff; ++ cmd.args[5] = (freq >> 8) & 0xff; ++ cmd.args[6] = (freq >> 16) & 0xff; ++ cmd.args[7] = (freq >> 24) & 0xff; ++ cmd.wlen = 8; ++ cmd.rlen = 1; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++#if 1 /* testing */ ++ /* get tuner status, RSSI values */ ++ memcpy(cmd.args, "\x42\x01", 2); ++ cmd.wlen = 2; ++ cmd.rlen = 12; ++ ret = si2157_cmd_execute(client, &cmd); ++ ++ dev_info(&client->dev, "%s: tuner status: ret=%d rssi=%d mode=%x freq=%d\n", ++ __func__, ret, cmd.args[3], cmd.args[8], ++ (cmd.args[7]<<24 | cmd.args[6]<<16 | ++ cmd.args[5]<<8 | cmd.args[4])); ++#endif ++ dev->bandwidth = bandwidth; ++ ++ si2157_tune_wait(client, 0); /* wait to complete, ignore any errors */ ++ + return 0; + err: ++ dev->bandwidth = 0; ++ dev->frequency = 0; ++ dev->if_frequency = 0; + dev_dbg(&client->dev, "failed=%d\n", ret); + return ret; + } + ++static int si2157_get_frequency(struct dvb_frontend *fe, u32 *frequency) ++{ ++ struct i2c_client *client = fe->tuner_priv; ++ struct si2157_dev *dev = i2c_get_clientdata(client); ++ ++ *frequency = dev->frequency; ++ dev_info(&client->dev, "%s: freq=%u\n", __func__, dev->frequency); ++ return 0; ++} ++ ++static int si2157_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) ++{ ++ struct i2c_client *client = fe->tuner_priv; ++ struct si2157_dev *dev = i2c_get_clientdata(client); ++ ++ *bandwidth = dev->bandwidth; ++ dev_info(&client->dev, "%s: bandwidth=%u\n", __func__, dev->bandwidth); ++ return 0; ++} ++ + static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) + { + struct i2c_client *client = fe->tuner_priv; + struct si2157_dev *dev = i2c_get_clientdata(client); + +- *frequency = dev->if_frequency; ++ *frequency = dev->if_frequency & ~1; /* strip analog IF indicator bit */ ++ dev_info(&client->dev, "%s: if_frequency=%u\n", __func__, *frequency); + return 0; + } + ++static int si2157_get_rf_strength(struct dvb_frontend *fe, u16 *rssi) ++{ ++ struct i2c_client *client = fe->tuner_priv; ++ struct dtv_frontend_properties *c = &fe->dtv_property_cache; ++ struct si2157_cmd cmd; ++ int ret; ++ int strength; ++ ++ dev_dbg(&client->dev, "\n"); ++ ++ memcpy(cmd.args, "\x42\x00", 2); ++ cmd.wlen = 2; ++ cmd.rlen = 12; ++ ret = si2157_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ ++ c->strength.stat[0].scale = FE_SCALE_DECIBEL; ++ c->strength.stat[0].svalue = (s8) cmd.args[3] * 1000; ++ ++ strength = (s8)cmd.args[3]; ++ strength = (strength > -80) ? (u16)(strength + 100) : 0; ++ strength = strength > 80 ? 100 : strength; ++ ++ *rssi = (u16)(strength * 0xffff / 100); ++ dev_dbg(&client->dev, "%s: strength=%d rssi=%u\n", ++ __func__, (s8)cmd.args[3], *rssi); ++ ++ return 0; ++err: ++ dev_dbg(&client->dev, "failed=%d\n", ret); ++ return ret; ++} ++ + static const struct dvb_tuner_ops si2157_ops = { + .info = { +- .name = "Silicon Labs Si2141/Si2146/2147/2148/2157/2158", ++ .name = "Silicon Labs Si2141/2146/2147/2148/2157/2158", + .frequency_min_hz = 42 * MHz, + .frequency_max_hz = 870 * MHz, + }, +@@ -395,7 +791,12 @@ static const struct dvb_tuner_ops si2157_ops = { + .init = si2157_init, + .sleep = si2157_sleep, + .set_params = si2157_set_params, +- .get_if_frequency = si2157_get_if_frequency, ++ .set_analog_params = si2157_set_analog_params, ++ .get_frequency = si2157_get_frequency, ++ .get_bandwidth = si2157_get_bandwidth, ++ .get_if_frequency = si2157_get_if_frequency, ++ ++ .get_rf_strength = si2157_get_rf_strength, + }; + + static void si2157_stat_work(struct work_struct *work) +@@ -455,7 +856,7 @@ static int si2157_probe(struct i2c_client *client, + cmd.wlen = 0; + cmd.rlen = 1; + ret = si2157_cmd_execute(client, &cmd); +- if (ret) ++ if (ret && (ret != -EAGAIN)) + goto err_kfree; + + memcpy(&fe->ops.tuner_ops, &si2157_ops, sizeof(struct dvb_tuner_ops)); +diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h +index 50f8630..1e5ce5b 100644 +--- a/drivers/media/tuners/si2157_priv.h ++++ b/drivers/media/tuners/si2157_priv.h +@@ -37,6 +37,8 @@ struct si2157_dev { + u8 chiptype; + u8 if_port; + u32 if_frequency; ++ u32 bandwidth; ++ u32 frequency; + struct delayed_work stat_work; + + #if defined(CONFIG_MEDIA_CONTROLLER) +diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c +index fdd3c22..25aa7bb 100644 +--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c ++++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c +@@ -599,14 +599,27 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) + return status; + } + } +- if (dev->tuner_type == TUNER_NXP_TDA18271) ++ switch (dev->model) { /* i2c device tuners */ ++ case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: ++ case CX231XX_BOARD_HAUPPAUGE_935C: ++ case CX231XX_BOARD_HAUPPAUGE_955Q: ++ case CX231XX_BOARD_HAUPPAUGE_975: ++ case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: + status = cx231xx_set_decoder_video_input(dev, + CX231XX_VMUX_TELEVISION, + INPUT(input)->vmux); +- else +- status = cx231xx_set_decoder_video_input(dev, ++ break; ++ default: ++ if (dev->tuner_type == TUNER_NXP_TDA18271) ++ status = cx231xx_set_decoder_video_input(dev, ++ CX231XX_VMUX_TELEVISION, ++ INPUT(input)->vmux); ++ else ++ status = cx231xx_set_decoder_video_input(dev, + CX231XX_VMUX_COMPOSITE1, + INPUT(input)->vmux); ++ break; ++ }; + + break; + default: +@@ -1205,12 +1218,22 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev, + cx231xx_set_field(FLD_SIF_EN, 0)); + break; + default: ++ switch (dev->model) { /* i2c device tuners */ ++ case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: ++ case CX231XX_BOARD_HAUPPAUGE_935C: ++ case CX231XX_BOARD_HAUPPAUGE_955Q: ++ case CX231XX_BOARD_HAUPPAUGE_975: ++ case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: ++ /* TODO: Normal mode: SIF passthrough at 14.32 MHz ??? */ ++ break; ++ default: + /* This is just a casual suggestion to people adding + new boards in case they use a tuner type we don't + currently know about */ +- dev_info(dev->dev, +- "Unknown tuner type configuring SIF"); +- break; ++ dev_info(dev->dev, ++ "Unknown tuner type configuring SIF"); ++ break; ++ } + } + break; + +diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c +index 0d451c4..d5e51a5 100644 +--- a/drivers/media/usb/cx231xx/cx231xx-video.c ++++ b/drivers/media/usb/cx231xx/cx231xx-video.c +@@ -1293,7 +1293,7 @@ int cx231xx_s_frequency(struct file *file, void *priv, + struct cx231xx_fh *fh = priv; + struct cx231xx *dev = fh->dev; + struct v4l2_frequency new_freq = *f; +- int rc; ++ int rc, need_if_freq = 0; + u32 if_frequency = 5400000; + + dev_dbg(dev->dev, +@@ -1310,14 +1310,30 @@ int cx231xx_s_frequency(struct file *file, void *priv, + /* set pre channel change settings in DIF first */ + rc = cx231xx_tuner_pre_channel_change(dev); + +- call_all(dev, tuner, s_frequency, f); +- call_all(dev, tuner, g_frequency, &new_freq); +- dev->ctl_freq = new_freq.frequency; ++ switch (dev->model) { /* i2c device tuners */ ++ case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: ++ case CX231XX_BOARD_HAUPPAUGE_935C: ++ case CX231XX_BOARD_HAUPPAUGE_955Q: ++ case CX231XX_BOARD_HAUPPAUGE_975: ++ case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: ++ if (dev->cx231xx_set_analog_freq) ++ dev->cx231xx_set_analog_freq(dev, f->frequency); ++ dev->ctl_freq = f->frequency; ++ need_if_freq = 1; ++ break; ++ default: ++ call_all(dev, tuner, s_frequency, f); ++ call_all(dev, tuner, g_frequency, &new_freq); ++ dev->ctl_freq = new_freq.frequency; ++ break; ++ } ++ ++ pr_err("%s() %u : %u\n", __func__, f->frequency, dev->ctl_freq); + + /* set post channel change settings in DIF first */ + rc = cx231xx_tuner_post_channel_change(dev); + +- if (dev->tuner_type == TUNER_NXP_TDA18271) { ++ if (need_if_freq || dev->tuner_type == TUNER_NXP_TDA18271) { + if (dev->norm & (V4L2_STD_MN | V4L2_STD_NTSC_443)) + if_frequency = 5400000; /*5.4MHz */ + else if (dev->norm & V4L2_STD_B) +@@ -1584,8 +1600,19 @@ int cx231xx_querycap(struct file *file, void *priv, + else + cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE; + } +- if (dev->tuner_type != TUNER_ABSENT) ++ switch (dev->model) { /* i2c device tuners */ ++ case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: ++ case CX231XX_BOARD_HAUPPAUGE_935C: ++ case CX231XX_BOARD_HAUPPAUGE_955Q: ++ case CX231XX_BOARD_HAUPPAUGE_975: ++ case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: + cap->device_caps |= V4L2_CAP_TUNER; ++ break; ++ default: ++ if (dev->tuner_type != TUNER_ABSENT) ++ cap->device_caps |= V4L2_CAP_TUNER; ++ break; ++ } + cap->capabilities = cap->device_caps | V4L2_CAP_READWRITE | + V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; +@@ -2191,10 +2218,20 @@ static void cx231xx_vdev_init(struct cx231xx *dev, + + video_set_drvdata(vfd, dev); + if (dev->tuner_type == TUNER_ABSENT) { +- v4l2_disable_ioctl(vfd, VIDIOC_G_FREQUENCY); +- v4l2_disable_ioctl(vfd, VIDIOC_S_FREQUENCY); +- v4l2_disable_ioctl(vfd, VIDIOC_G_TUNER); +- v4l2_disable_ioctl(vfd, VIDIOC_S_TUNER); ++ switch (dev->model) { ++ case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: ++ case CX231XX_BOARD_HAUPPAUGE_935C: ++ case CX231XX_BOARD_HAUPPAUGE_955Q: ++ case CX231XX_BOARD_HAUPPAUGE_975: ++ case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: ++ break; ++ default: ++ v4l2_disable_ioctl(vfd, VIDIOC_G_FREQUENCY); ++ v4l2_disable_ioctl(vfd, VIDIOC_S_FREQUENCY); ++ v4l2_disable_ioctl(vfd, VIDIOC_G_TUNER); ++ v4l2_disable_ioctl(vfd, VIDIOC_S_TUNER); ++ break; ++ } + } + } + +-- +2.17.1 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-02-add-t230c2.patch b/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-02-add-t230c2.patch new file mode 100644 index 0000000000..c67b37845a --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-02-add-t230c2.patch @@ -0,0 +1,217 @@ +From: Thomas Hollstegge +[v3] media: dvbsky: Add support for MyGica T230C v2 +https://lore.kernel.org/patchwork/cover/904817/ + +diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c +index 4d43424..3402b96 100644 +--- a/drivers/media/dvb-frontends/si2168.c ++++ b/drivers/media/dvb-frontends/si2168.c +@@ -96,13 +96,15 @@ static int si2168_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) + dev_dbg(&client->dev, "%s acquire: %d\n", __func__, acquire); + + /* set TS_MODE property */ +- memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); ++ memcpy(cmd.args, "\x14\x00\x01\x10\x00\x00", 6); + if (acquire) + cmd.args[4] |= dev->ts_mode; + else + cmd.args[4] |= SI2168_TS_TRISTATE; + if (dev->ts_clock_gapped) + cmd.args[4] |= 0x40; ++ cmd.args[4] |= (dev->ts_clock_mode & 0x03) << 4; ++ + cmd.wlen = 6; + cmd.rlen = 4; + ret = si2168_cmd_execute(client, &cmd); +@@ -644,6 +646,18 @@ static int si2168_set_frontend(struct dvb_frontend *fe) + if (ret) + goto err; + ++ /* set TS frequency */ ++ if (dev->ts_clock_freq) { ++ memcpy(cmd.args, "\x14\x00\x0d\x10", 4); ++ cmd.args[4] = ((dev->ts_clock_freq / 10000) >> 0) & 0xff; ++ cmd.args[5] = ((dev->ts_clock_freq / 10000) >> 8) & 0xff; ++ cmd.wlen = 6; ++ cmd.rlen = 4; ++ ret = si2168_cmd_execute(client, &cmd); ++ if (ret) ++ goto err; ++ } ++ + memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); + cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; + cmd.wlen = 6; +@@ -1057,6 +1071,10 @@ static int si2168_probe(struct i2c_client *client, + dev->ts_mode = config->ts_mode; + dev->ts_clock_inv = config->ts_clock_inv; + dev->ts_clock_gapped = config->ts_clock_gapped; ++ dev->ts_clock_mode = config->ts_clock_mode; ++ if (dev->ts_clock_mode == 0) ++ dev->ts_clock_mode = SI2168_TS_CLOCK_MODE_AUTO_ADAPT; ++ dev->ts_clock_freq = config->ts_clock_freq; + dev->spectral_inversion = config->spectral_inversion; + + dev_info(&client->dev, "Silicon Labs Si2168-%c%d%d successfully identified\n", +diff --git a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h +index d519edd..3f52ee8 100644 +--- a/drivers/media/dvb-frontends/si2168.h ++++ b/drivers/media/dvb-frontends/si2168.h +@@ -47,6 +47,14 @@ struct si2168_config { + /* TS clock gapped */ + bool ts_clock_gapped; + ++ /* TS clock mode */ ++#define SI2168_TS_CLOCK_MODE_AUTO_ADAPT 0x01 ++#define SI2168_TS_CLOCK_MODE_MANUAL 0x02 ++ u8 ts_clock_mode; ++ ++ /* TS clock frequency (for manual mode) */ ++ u32 ts_clock_freq; ++ + /* Inverted spectrum */ + bool spectral_inversion; + }; +diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h +index 2d362e1..8173d6c 100644 +--- a/drivers/media/dvb-frontends/si2168_priv.h ++++ b/drivers/media/dvb-frontends/si2168_priv.h +@@ -48,6 +48,8 @@ struct si2168_dev { + u8 ts_mode; + bool ts_clock_inv; + bool ts_clock_gapped; ++ u8 ts_clock_mode; ++ u32 ts_clock_freq; + bool spectral_inversion; + }; + +diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c +index e28bd88..4a4c6ae 100644 +--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c ++++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c +@@ -583,6 +583,66 @@ static int dvbsky_mygica_t230c_attach(struct dvb_usb_adapter *adap) + return 0; + } + ++static int dvbsky_mygica_t230c_v2_attach(struct dvb_usb_adapter *adap) ++{ ++ struct dvbsky_state *state = adap_to_priv(adap); ++ struct dvb_usb_device *d = adap_to_d(adap); ++ struct i2c_adapter *i2c_adapter; ++ struct i2c_client *client_demod, *client_tuner; ++ struct i2c_board_info info; ++ struct si2168_config si2168_config; ++ struct si2157_config si2157_config; ++ ++ /* attach demod */ ++ memset(&si2168_config, 0, sizeof(si2168_config)); ++ si2168_config.i2c_adapter = &i2c_adapter; ++ si2168_config.fe = &adap->fe[0]; ++ si2168_config.ts_mode = SI2168_TS_PARALLEL; ++ si2168_config.ts_clock_inv = 1; ++ si2168_config.ts_clock_mode = SI2168_TS_CLOCK_MODE_MANUAL; ++ si2168_config.ts_clock_freq = 10000000; ++ memset(&info, 0, sizeof(struct i2c_board_info)); ++ strlcpy(info.type, "si2168", sizeof(info.type)); ++ info.addr = 0x64; ++ info.platform_data = &si2168_config; ++ ++ request_module("si2168"); ++ client_demod = i2c_new_device(&d->i2c_adap, &info); ++ if (!client_demod || !client_demod->dev.driver) ++ goto fail_demod_device; ++ if (!try_module_get(client_demod->dev.driver->owner)) ++ goto fail_demod_module; ++ ++ /* attach tuner */ ++ memset(&si2157_config, 0, sizeof(si2157_config)); ++ si2157_config.fe = adap->fe[0]; ++ si2157_config.if_port = 0; ++ memset(&info, 0, sizeof(struct i2c_board_info)); ++ strlcpy(info.type, "si2141", sizeof(info.type)); ++ info.addr = 0x60; ++ info.platform_data = &si2157_config; ++ ++ request_module("si2157"); ++ client_tuner = i2c_new_device(i2c_adapter, &info); ++ if (!client_tuner || !client_tuner->dev.driver) ++ goto fail_tuner_device; ++ if (!try_module_get(client_tuner->dev.driver->owner)) ++ goto fail_tuner_module; ++ ++ state->i2c_client_demod = client_demod; ++ state->i2c_client_tuner = client_tuner; ++ return 0; ++ ++fail_tuner_module: ++ i2c_unregister_device(client_tuner); ++fail_tuner_device: ++ module_put(client_demod->dev.driver->owner); ++fail_demod_module: ++ i2c_unregister_device(client_demod); ++fail_demod_device: ++ return -ENODEV; ++} ++ + + static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) + { +@@ -762,6 +822,33 @@ static struct dvb_usb_device_properties mygica_t230c_props = { + } + }; + ++static struct dvb_usb_device_properties mygica_t230c_v2_props = { ++ .driver_name = KBUILD_MODNAME, ++ .owner = THIS_MODULE, ++ .adapter_nr = adapter_nr, ++ .size_of_priv = sizeof(struct dvbsky_state), ++ ++ .generic_bulk_ctrl_endpoint = 0x01, ++ .generic_bulk_ctrl_endpoint_response = 0x81, ++ .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, ++ ++ .i2c_algo = &dvbsky_i2c_algo, ++ .frontend_attach = dvbsky_mygica_t230c_v2_attach, ++ .init = dvbsky_init, ++ .get_rc_config = dvbsky_get_rc_config, ++ .streaming_ctrl = dvbsky_streaming_ctrl, ++ .identify_state = dvbsky_identify_state, ++ .exit = dvbsky_exit, ++ ++ .num_adapters = 1, ++ .adapter = { ++ { ++ .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), ++ } ++ } ++}; ++ ++ + static const struct usb_device_id dvbsky_id_table[] = { + { DVB_USB_DEVICE(0x0572, 0x6831, + &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, +@@ -797,6 +884,9 @@ static const struct usb_device_id dvbsky_id_table[] = { + { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C, + &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C", + RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, ++ { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C_V2, ++ &mygica_t230c_v2_props, "MyGica Mini DVB-T2 USB Stick T230C v2", ++ RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, + { } + }; + MODULE_DEVICE_TABLE(usb, dvbsky_id_table); +diff --git a/include/media/dvb-usb-ids.h b/include/media/dvb-usb-ids.h +index f9e73b4..d606248 100644 +--- a/include/media/dvb-usb-ids.h ++++ b/include/media/dvb-usb-ids.h +@@ -387,6 +387,7 @@ + #define USB_PID_MYGICA_D689 0xd811 + #define USB_PID_MYGICA_T230 0xc688 + #define USB_PID_MYGICA_T230C 0xc689 ++#define USB_PID_MYGICA_T230C_V2 0xc68a + #define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011 + #define USB_PID_ELGATO_EYETV_DTT 0x0021 + #define USB_PID_ELGATO_EYETV_DTT_2 0x003f +-- +2.17.1 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-03-linux-902-extend-rc6-toggle-support-for-zotac.patch b/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-03-linux-902-extend-rc6-toggle-support-for-zotac.patch new file mode 100644 index 0000000000..65fe5fd6c7 --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree/patches/media_tree-03-linux-902-extend-rc6-toggle-support-for-zotac.patch @@ -0,0 +1,41 @@ +From ae1ccaa3587c0bd3d6d01841fa2e668cdf738f1e Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 3 Feb 2019 14:24:00 +0100 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Zotac + remotes + +The Zotac RC2604323/01G and RC2604329/02BG remotes use the 32-bit +rc6 protocol and toggle bit 15 (0x8000) on repeated button presses, +like MCE remotes. + +Add the customer code 0x80340000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index d96aed1343e4..5cc302fa4daa 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */ + #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ +@@ -246,6 +247,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + switch (scancode & RC6_6A_LCC_MASK) { + case RC6_6A_MCE_CC: + case RC6_6A_KATHREIN_CC: ++ case RC6_6A_ZOTAC_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +-- +2.20.1 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc/package.mk b/packages/linux-driver-addons/dvb/depends/media_tree_cc/package.mk new file mode 100644 index 0000000000..5b74de22ac --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="media_tree_cc" +PKG_VERSION="2018-11-06" +PKG_SHA256="a12223aadb230ae6b174ad1ffe54db1bed44370d092db010ea12dddc16fbec36" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/CrazyCat/media_build/downloads/" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Source of Linux Kernel media_tree subsystem to build with media_build." +PKG_TOOLCHAIN="manual" + +unpack() { + mkdir -p $PKG_BUILD/ + tar -xf $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2 -C $PKG_BUILD/ + + # hack/workaround for borked upstream kernel/media_build + # without removing atomisp there a lot additional includes that + # slowdown build process after modpost from 3min to 6min + # even if atomisp is disabled via kernel.conf + rm -rf $PKG_BUILD/drivers/staging/media/atomisp + sed -i 's|^.*drivers/staging/media/atomisp.*$||' \ + $PKG_BUILD/drivers/staging/media/Kconfig +} diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-02-linux-901-extend-rc6-toggle-support.patch b/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-02-linux-901-extend-rc6-toggle-support.patch new file mode 100644 index 0000000000..de21628bda --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-02-linux-901-extend-rc6-toggle-support.patch @@ -0,0 +1,52 @@ +From 3f1f8303b6e0be751d7a7c55031c8ab840ed5c1a Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 24 Aug 2018 23:31:51 +0200 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Kathrein + RCU-676 remote + +The Kathrein RCU-676 remote uses the 32-bit rc6 protocol and toggles +bit 15 (0x8000) on repeated button presses, like MCE remotes. + +Add it's customer code 0x80460000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index 68487ce9f79b..d96aed1343e4 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ + #endif +@@ -242,13 +243,17 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + toggle = 0; + break; + case 32: +- if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { ++ switch (scancode & RC6_6A_LCC_MASK) { ++ case RC6_6A_MCE_CC: ++ case RC6_6A_KATHREIN_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +- } else { ++ break; ++ default: + protocol = RC_PROTO_RC6_6A_32; + toggle = 0; ++ break; + } + break; + default: +-- +2.11.0 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-03-linux-902-extend-rc6-toggle-support-for-zotac.patch b/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-03-linux-902-extend-rc6-toggle-support-for-zotac.patch new file mode 100644 index 0000000000..65fe5fd6c7 --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-03-linux-902-extend-rc6-toggle-support-for-zotac.patch @@ -0,0 +1,41 @@ +From ae1ccaa3587c0bd3d6d01841fa2e668cdf738f1e Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 3 Feb 2019 14:24:00 +0100 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Zotac + remotes + +The Zotac RC2604323/01G and RC2604329/02BG remotes use the 32-bit +rc6 protocol and toggle bit 15 (0x8000) on repeated button presses, +like MCE remotes. + +Add the customer code 0x80340000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index d96aed1343e4..5cc302fa4daa 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */ + #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ +@@ -246,6 +247,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + switch (scancode & RC6_6A_LCC_MASK) { + case RC6_6A_MCE_CC: + case RC6_6A_KATHREIN_CC: ++ case RC6_6A_ZOTAC_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +-- +2.20.1 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-04-fix-tbs5520se.patch b/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-04-fix-tbs5520se.patch new file mode 100644 index 0000000000..5919df3e7b --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc/patches/media_tree_cc-04-fix-tbs5520se.patch @@ -0,0 +1,22 @@ +https://bitbucket.org/CrazyCat/linux_media/commits/ebd9c45524383e09d993563f4bd3cc765796b38a/raw +https://forum.libreelec.tv/thread/14405-dual-tbs-5520se-libreelec-9-0-0-intel-generic/?postID=110926#post110926 +fixes TBS5520se scanning of frequencies + +From: CrazyCat +Date: Mon, 12 Nov 2018 19:49:55 +0200 +Subject: [PATCH] si2183: Fixed minimal frequency for DVB-C. + +diff --git a/drivers/media/dvb-frontends/si2183.c b/drivers/media/dvb-frontends/si2183.c +index f1cc0da..333abd0 100644 +--- a/drivers/media/dvb-frontends/si2183.c ++++ b/drivers/media/dvb-frontends/si2183.c +@@ -1335,7 +1335,7 @@ static int si2183_set_property(struct dvb_frontend *fe, + break; + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_B: +- fe->ops.info.frequency_min_hz = 470 * MHz; ++ fe->ops.info.frequency_min_hz = 47 * MHz; + fe->ops.info.frequency_max_hz = 862 * MHz; + fe->ops.info.frequency_stepsize_hz = 62500; + break; + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/package.mk b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/package.mk new file mode 100644 index 0000000000..4b17779c9a --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="media_tree_cc_aml" +PKG_VERSION="2018-09-23" +PKG_SHA256="3b0cf3699317c04d9184b7e25056065fd374b20b851ee86a63ea2c70e219ee9e" +PKG_LICENSE="GPL" +PKG_SITE="https://bitbucket.org/CrazyCat/media_build/downloads/" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Source of Linux Kernel media_tree subsystem to build with media_build." +PKG_TOOLCHAIN="manual" + +unpack() { + mkdir -p $PKG_BUILD/ + tar -xf $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz -C $PKG_BUILD/ + + # hack/workaround for borked upstream kernel/media_build + # without removing atomisp there a lot additional includes that + # slowdown build process after modpost from 3min to 6min + # even if atomisp is disabled via kernel.conf + rm -rf $PKG_BUILD/drivers/staging/media/atomisp + sed -i 's|^.*drivers/staging/media/atomisp.*$||' \ + $PKG_BUILD/drivers/staging/media/Kconfig +} diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-02-linux-901-extend-rc6-toggle-support.patch b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-02-linux-901-extend-rc6-toggle-support.patch new file mode 100644 index 0000000000..de21628bda --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-02-linux-901-extend-rc6-toggle-support.patch @@ -0,0 +1,52 @@ +From 3f1f8303b6e0be751d7a7c55031c8ab840ed5c1a Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 24 Aug 2018 23:31:51 +0200 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Kathrein + RCU-676 remote + +The Kathrein RCU-676 remote uses the 32-bit rc6 protocol and toggles +bit 15 (0x8000) on repeated button presses, like MCE remotes. + +Add it's customer code 0x80460000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index 68487ce9f79b..d96aed1343e4 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ + #endif +@@ -242,13 +243,17 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + toggle = 0; + break; + case 32: +- if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { ++ switch (scancode & RC6_6A_LCC_MASK) { ++ case RC6_6A_MCE_CC: ++ case RC6_6A_KATHREIN_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +- } else { ++ break; ++ default: + protocol = RC_PROTO_RC6_6A_32; + toggle = 0; ++ break; + } + break; + default: +-- +2.11.0 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-03-linux-902-extend-rc6-toggle-support-for-zotac.patch b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-03-linux-902-extend-rc6-toggle-support-for-zotac.patch new file mode 100644 index 0000000000..65fe5fd6c7 --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-03-linux-902-extend-rc6-toggle-support-for-zotac.patch @@ -0,0 +1,41 @@ +From ae1ccaa3587c0bd3d6d01841fa2e668cdf738f1e Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 3 Feb 2019 14:24:00 +0100 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Zotac + remotes + +The Zotac RC2604323/01G and RC2604329/02BG remotes use the 32-bit +rc6 protocol and toggle bit 15 (0x8000) on repeated button presses, +like MCE remotes. + +Add the customer code 0x80340000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index d96aed1343e4..5cc302fa4daa 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */ + #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ +@@ -246,6 +247,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + switch (scancode & RC6_6A_LCC_MASK) { + case RC6_6A_MCE_CC: + case RC6_6A_KATHREIN_CC: ++ case RC6_6A_ZOTAC_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +-- +2.20.1 + diff --git a/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-04-fix-tbs5520se.patch b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-04-fix-tbs5520se.patch new file mode 100644 index 0000000000..5919df3e7b --- /dev/null +++ b/packages/linux-driver-addons/dvb/depends/media_tree_cc_aml/patches/media_tree_cc_aml-04-fix-tbs5520se.patch @@ -0,0 +1,22 @@ +https://bitbucket.org/CrazyCat/linux_media/commits/ebd9c45524383e09d993563f4bd3cc765796b38a/raw +https://forum.libreelec.tv/thread/14405-dual-tbs-5520se-libreelec-9-0-0-intel-generic/?postID=110926#post110926 +fixes TBS5520se scanning of frequencies + +From: CrazyCat +Date: Mon, 12 Nov 2018 19:49:55 +0200 +Subject: [PATCH] si2183: Fixed minimal frequency for DVB-C. + +diff --git a/drivers/media/dvb-frontends/si2183.c b/drivers/media/dvb-frontends/si2183.c +index f1cc0da..333abd0 100644 +--- a/drivers/media/dvb-frontends/si2183.c ++++ b/drivers/media/dvb-frontends/si2183.c +@@ -1335,7 +1335,7 @@ static int si2183_set_property(struct dvb_frontend *fe, + break; + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_B: +- fe->ops.info.frequency_min_hz = 470 * MHz; ++ fe->ops.info.frequency_min_hz = 47 * MHz; + fe->ops.info.frequency_max_hz = 862 * MHz; + fe->ops.info.frequency_stepsize_hz = 62500; + break; + diff --git a/packages/linux-driver-addons/dvb/digital_devices/changelog.txt b/packages/linux-driver-addons/dvb/digital_devices/changelog.txt new file mode 100755 index 0000000000..32d81ca428 --- /dev/null +++ b/packages/linux-driver-addons/dvb/digital_devices/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial add-on diff --git a/packages/linux-driver-addons/dvb/digital_devices/icon/icon.png b/packages/linux-driver-addons/dvb/digital_devices/icon/icon.png new file mode 100644 index 0000000000..10c6edc267 Binary files /dev/null and b/packages/linux-driver-addons/dvb/digital_devices/icon/icon.png differ diff --git a/packages/linux-driver-addons/dvb/digital_devices/package.mk b/packages/linux-driver-addons/dvb/digital_devices/package.mk new file mode 100644 index 0000000000..99dbed95ed --- /dev/null +++ b/packages/linux-driver-addons/dvb/digital_devices/package.mk @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="digital_devices" +PKG_VERSION="21aefddd4bbff5ac2915cfde05bd5d373ce413c3" +PKG_SHA256="0ef1e9c2edd9c574c67b30f2e5d79d21e95169ed08968704cf25cd77d885da58" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/DigitalDevices/dddvb/" +PKG_URL="https://github.com/DigitalDevices/dddvb/archive/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_BUILD_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_SECTION="driver.dvb" +PKG_LONGDESC="DVB driver for Digital Devices cards" + +PKG_IS_ADDON="embedded" +PKG_ADDON_IS_STANDALONE="yes" +PKG_ADDON_NAME="DVB drivers for DigitalDevices" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_VERSION="${ADDON_VERSION}.${PKG_REV}" + +make_target() { + KDIR=$(kernel_path) make +} + +makeinstall_target() { + install_driver_addon_files "$PKG_BUILD/ddbridge $PKG_BUILD/dvb-core $PKG_BUILD/frontends" +} diff --git a/packages/linux-driver-addons/dvb/digital_devices/source/default.py b/packages/linux-driver-addons/dvb/digital_devices/source/default.py new file mode 100644 index 0000000000..9002b050de --- /dev/null +++ b/packages/linux-driver-addons/dvb/digital_devices/source/default.py @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/linux-driver-addons/dvb/dvb-latest/changelog.txt b/packages/linux-driver-addons/dvb/dvb-latest/changelog.txt new file mode 100755 index 0000000000..32d81ca428 --- /dev/null +++ b/packages/linux-driver-addons/dvb/dvb-latest/changelog.txt @@ -0,0 +1,2 @@ +100 +- Initial add-on diff --git a/packages/linux-driver-addons/dvb/dvb-latest/icon/icon.png b/packages/linux-driver-addons/dvb/dvb-latest/icon/icon.png new file mode 100644 index 0000000000..85e5ed9f32 Binary files /dev/null and b/packages/linux-driver-addons/dvb/dvb-latest/icon/icon.png differ diff --git a/packages/linux-driver-addons/dvb/dvb-latest/package.mk b/packages/linux-driver-addons/dvb/dvb-latest/package.mk new file mode 100644 index 0000000000..fae4889590 --- /dev/null +++ b/packages/linux-driver-addons/dvb/dvb-latest/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="dvb-latest" +PKG_VERSION="bd2896dbe1969af199b9f0569d1c60b0ab2859ff" +PKG_SHA256="00923e79db7b34fec4015cafc1390db388165b86e78564f340759f6da245824e" +PKG_LICENSE="GPL" +PKG_SITE="http://git.linuxtv.org/media_build.git" +PKG_URL="https://git.linuxtv.org/media_build.git/snapshot/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux media_tree" +PKG_NEED_UNPACK="$LINUX_DEPENDS media_tree" +PKG_SECTION="driver.dvb" +PKG_LONGDESC="DVB drivers from the latest kernel (media_build)" + +PKG_IS_ADDON="embedded" +PKG_IS_KERNEL_PKG="yes" +PKG_ADDON_IS_STANDALONE="yes" +PKG_ADDON_NAME="DVB drivers from the latest kernel" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_VERSION="${ADDON_VERSION}.${PKG_REV}" + +pre_make_target() { + export KERNEL_VER=$(get_module_dir) + export LDFLAGS="" +} + +make_target() { + cp -RP $(get_build_dir media_tree)/* $PKG_BUILD/linux + + # make config all + kernel_make VER=$KERNEL_VER SRCDIR=$(kernel_path) allyesconfig + + kernel_make VER=$KERNEL_VER SRCDIR=$(kernel_path) +} + +makeinstall_target() { + install_driver_addon_files "$PKG_BUILD/v4l/" +} diff --git a/packages/linux-driver-addons/dvb/dvb-latest/patches/driver.dvb.dvb-latest-01-remove-rmmod.pl.patch b/packages/linux-driver-addons/dvb/dvb-latest/patches/driver.dvb.dvb-latest-01-remove-rmmod.pl.patch new file mode 100644 index 0000000000..13435136c9 --- /dev/null +++ b/packages/linux-driver-addons/dvb/dvb-latest/patches/driver.dvb.dvb-latest-01-remove-rmmod.pl.patch @@ -0,0 +1,11 @@ +diff --git a/v4l/Makefile b/v4l/Makefile +--- a/v4l/Makefile ++++ b/v4l/Makefile +@@ -51,7 +51,6 @@ default:: prepare firmware + @echo Kernel build directory is $(OUTDIR) + $(MAKE) -C ../linux apply_patches + $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules +- ./scripts/rmmod.pl check + # $(MAKE) checkpatch + + mismatch:: prepare firmware diff --git a/packages/linux-driver-addons/dvb/dvb-latest/patches/driver.dvb.dvb-latest-02-disable-modules.patch b/packages/linux-driver-addons/dvb/dvb-latest/patches/driver.dvb.dvb-latest-02-disable-modules.patch new file mode 100644 index 0000000000..e2659408e8 --- /dev/null +++ b/packages/linux-driver-addons/dvb/dvb-latest/patches/driver.dvb.dvb-latest-02-disable-modules.patch @@ -0,0 +1,13 @@ +--- a/v4l/scripts/make_kconfig.pl ++++ b/v4l/scripts/make_kconfig.pl +@@ -626,6 +626,10 @@ ($$) + close OUT; + + # These options should default to off ++disable_config('MEDIA_ANALOG_TV_SUPPORT'); ++disable_config('MEDIA_CAMERA_SUPPORT'); ++disable_config('MEDIA_CEC_SUPPORT'); ++disable_config('SOC_CAMERA'); + disable_config('DVB_AV7110_FIRMWARE'); + disable_config('DVB_CINERGYT2_TUNING'); + disable_config('VIDEO_HELPER_CHIPS_AUTO'); diff --git a/packages/linux-driver-addons/dvb/dvb-latest/source/default.py b/packages/linux-driver-addons/dvb/dvb-latest/source/default.py new file mode 100644 index 0000000000..9002b050de --- /dev/null +++ b/packages/linux-driver-addons/dvb/dvb-latest/source/default.py @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) diff --git a/packages/linux-drivers/RTL8188EU/package.mk b/packages/linux-drivers/RTL8188EU/package.mk index f0660af653..8c741d8e77 100644 --- a/packages/linux-drivers/RTL8188EU/package.mk +++ b/packages/linux-drivers/RTL8188EU/package.mk @@ -1,38 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RTL8188EU" -PKG_VERSION="ced2b64" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4b0ecca485b9f11f58670b69aa9f90ecad7da02f" +PKG_SHA256="cc872aa0991c044d35abfcc81543bad950c6aae487e37d5a09d1cbf8c4cb3058" PKG_LICENSE="GPL" # realtek: PKG_SITE="http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PFid=48&Level=5&Conn=4&ProdID=274&DownTypeID=3&GetDown=false&Downloads=true" PKG_SITE="https://github.com/lwfinger/rtl8188eu" PKG_URL="https://github.com/lwfinger/rtl8188eu/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="rtl8188eu-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="Realtek RTL81xxEU Linux 3.x driver" PKG_LONGDESC="Realtek RTL81xxEU Linux 3.x driver" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_IS_KERNEL_PKG="yes" pre_make_target() { unset LDFLAGS @@ -42,11 +22,11 @@ make_target() { make V=1 \ ARCH=$TARGET_KERNEL_ARCH \ KSRC=$(kernel_path) \ - CROSS_COMPILE=$TARGET_PREFIX \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ CONFIG_POWER_SAVING=n } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME } diff --git a/packages/linux-drivers/RTL8192CU/package.mk b/packages/linux-drivers/RTL8192CU/package.mk index 68c052cc24..894b83608d 100644 --- a/packages/linux-drivers/RTL8192CU/package.mk +++ b/packages/linux-drivers/RTL8192CU/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RTL8192CU" -PKG_VERSION="v4.0.2_9000.20130911" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="26360110f3a80d91dd0707da096317152b0f379e" +PKG_SHA256="eff13b2d8605d1c981f77b15b44142d40bf70a8bf9cf6cd79b8a8204e3987426" PKG_LICENSE="GPL" -PKG_SITE="http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PFid=48&Level=5&Conn=4&ProdID=274&DownTypeID=3&GetDown=false&Downloads=true" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_SITE="https://github.com/pvaret/rtl8192cu-fixes" +PKG_URL="$PKG_SITE/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="Realtek RTL81xxCU Linux 3.x driver" PKG_LONGDESC="Realtek RTL81xxCU Linux 3.x driver" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_IS_KERNEL_PKG="yes" pre_make_target() { unset LDFLAGS @@ -40,11 +21,11 @@ make_target() { make V=1 \ ARCH=$TARGET_KERNEL_ARCH \ KSRC=$(kernel_path) \ - CROSS_COMPILE=$TARGET_PREFIX \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ CONFIG_POWER_SAVING=n } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME } diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0001-add_device_ID_330d.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0001-add_device_ID_330d.patch new file mode 100644 index 0000000000..f318ddd448 --- /dev/null +++ b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0001-add_device_ID_330d.patch @@ -0,0 +1,12 @@ +diff -Naur RTL8192CU-v4.0.2_9000.20130911/hal/rtl8192c/usb/usb_halinit.c RTL8192CU-v4.0.2_9000.20130911.patch/hal/rtl8192c/usb/usb_halinit.c +--- RTL8192CU-v4.0.2_9000.20130911/hal/rtl8192c/usb/usb_halinit.c 2013-09-11 05:56:55.000000000 +0200 ++++ RTL8192CU-v4.0.2_9000.20130911.patch/hal/rtl8192c/usb/usb_halinit.c 2014-04-01 20:17:59.270739417 +0200 +@@ -3509,6 +3509,8 @@ + pHalData->CustomerID = RT_CID_DLINK; + else if((pHalData->EEPROMVID == 0x2001) && (pHalData->EEPROMPID == 0x330a)) + pHalData->CustomerID = RT_CID_DLINK; ++ else if((pHalData->EEPROMVID == 0x2001) && (pHalData->EEPROMPID == 0x330d)) ++ pHalData->CustomerID = RT_CID_DLINK; + break; + case EEPROM_CID_WHQL: + /* diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-fix_310_proc2.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0002-fix_310_proc2.patch similarity index 100% rename from packages/linux-drivers/RTL8192CU/patches/RTL8192CU-fix_310_proc2.patch rename to packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0002-fix_310_proc2.patch diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-gcc-4.9.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0101-gcc-4.9.patch similarity index 100% rename from packages/linux-drivers/RTL8192CU/patches/RTL8192CU-gcc-4.9.patch rename to packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0101-gcc-4.9.patch diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-gcc-5.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0102-gcc-5.patch similarity index 100% rename from packages/linux-drivers/RTL8192CU/patches/RTL8192CU-gcc-5.patch rename to packages/linux-drivers/RTL8192CU/patches/RTL8192CU-0102-gcc-5.patch diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-add_device_ID_330d.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-add_device_ID_330d.patch deleted file mode 100644 index 681c03db7c..0000000000 --- a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-add_device_ID_330d.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -Naur RTL8192CU-v4.0.2_9000.20130911/hal/rtl8192c/usb/usb_halinit.c RTL8192CU-v4.0.2_9000.20130911.patch/hal/rtl8192c/usb/usb_halinit.c ---- RTL8192CU-v4.0.2_9000.20130911/hal/rtl8192c/usb/usb_halinit.c 2013-09-11 05:56:55.000000000 +0200 -+++ RTL8192CU-v4.0.2_9000.20130911.patch/hal/rtl8192c/usb/usb_halinit.c 2014-04-01 20:17:59.270739417 +0200 -@@ -3509,6 +3509,8 @@ - pHalData->CustomerID = RT_CID_DLINK; - else if((pHalData->EEPROMVID == 0x2001) && (pHalData->EEPROMPID == 0x330a)) - pHalData->CustomerID = RT_CID_DLINK; -+ else if((pHalData->EEPROMVID == 0x2001) && (pHalData->EEPROMPID == 0x330d)) -+ pHalData->CustomerID = RT_CID_DLINK; - break; - case EEPROM_CID_WHQL: - /* -diff -Naur RTL8192CU-v4.0.2_9000.20130911/os_dep/linux/usb_intf.c RTL8192CU-v4.0.2_9000.20130911.patch/os_dep/linux/usb_intf.c ---- RTL8192CU-v4.0.2_9000.20130911/os_dep/linux/usb_intf.c 2013-09-11 05:56:55.000000000 +0200 -+++ RTL8192CU-v4.0.2_9000.20130911.patch/os_dep/linux/usb_intf.c 2014-04-01 20:19:23.936708369 +0200 -@@ -138,6 +138,7 @@ - {USB_DEVICE(0x2001, 0x3307)},/* D-Link - Cameo */ \ - {USB_DEVICE(0x2001, 0x330A)},/* D-Link - Alpha */ \ - {USB_DEVICE(0x2001, 0x3309)},/* D-Link - Alpha */ \ -+ {USB_DEVICE(0x2001, 0x330D)},/* D-Link - Alpha(?)*/ \ - {USB_DEVICE(0x0586, 0x341F)},/* Zyxel - Abocom */ \ - {USB_DEVICE(0x7392, 0x7822)},/* Edimax - Edimax */ \ - {USB_DEVICE(0x2019, 0xAB2B)},/* Planex - Abocom */ \ diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-add_more_products.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-add_more_products.patch deleted file mode 100644 index 32552109a7..0000000000 --- a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-add_more_products.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -Naur RTL8192CU-v4.0.2_9000.20130911/os_dep/linux/usb_intf.c RTL8192CU-v4.0.2_9000.20130911.patch/os_dep/linux/usb_intf.c ---- RTL8192CU-v4.0.2_9000.20130911/os_dep/linux/usb_intf.c 2013-09-11 05:56:55.000000000 +0200 -+++ RTL8192CU-v4.0.2_9000.20130911.patch/os_dep/linux/usb_intf.c 2014-06-08 15:44:13.239381855 +0200 -@@ -96,6 +96,7 @@ - {USB_DEVICE(0x2019, 0xED17)},/* PCI - Edimax */ \ - {USB_DEVICE(0x0DF6, 0x0052)},/* Sitecom - Edimax */ \ - {USB_DEVICE(0x7392, 0x7811)},/* Edimax - Edimax */ \ -+ {USB_DEVICE(0x07B8, 0x8188)},/* Abocom - Abocom */ \ - {USB_DEVICE(0x07B8, 0x8189)},/* Abocom - Abocom */ \ - {USB_DEVICE(0x0EB0, 0x9071)},/* NO Brand - Etop */ \ - {USB_DEVICE(0x06F8, 0xE033)},/* Hercules - Edimax */ \ -@@ -144,8 +145,10 @@ - {USB_DEVICE(0x07B8, 0x8178)},/* Abocom - Abocom */ \ - {USB_DEVICE(0x07AA, 0x0056)},/* ATKK - Gemtek */ \ - {USB_DEVICE(0x4855, 0x0091)},/* - Feixun */ \ -+ {USB_DEVICE(0x050D, 0x11F2)},/* Belkin - Edimax */ \ - {USB_DEVICE(0x050D, 0x2102)},/* Belkin - Sercomm */ \ - {USB_DEVICE(0x050D, 0x2103)},/* Belkin - Edimax */ \ -+ {USB_DEVICE(0x050D, 0x21F2)},/* Belkin - Edimax */ \ - {USB_DEVICE(0x20F4, 0x624D)},/* TRENDnet */ \ - {USB_DEVICE(0x0DF6, 0x0061)},/* Sitecom - Edimax */ \ - {USB_DEVICE(0x0B05, 0x17AB)},/* ASUS - Edimax */ \ diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.0.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.0.patch deleted file mode 100644 index 7b01db4685..0000000000 --- a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.0.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -Naur RTL8192CU-v4.0.2_9000.20130911/os_dep/linux/rtw_android.c RTL8192CU-v4.0.2_9000.20130911.patch/os_dep/linux/rtw_android.c ---- RTL8192CU-v4.0.2_9000.20130911/os_dep/linux/rtw_android.c 2013-09-11 05:56:55.000000000 +0200 -+++ RTL8192CU-v4.0.2_9000.20130911.patch/os_dep/linux/rtw_android.c 2015-04-04 20:20:23.779119031 +0200 -@@ -230,7 +230,11 @@ - { - int cmd_num; - for(cmd_num=0 ; cmd_num= KERNEL_VERSION(4, 0, 0)) -+ if(!strncasecmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) -+#else - if(0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) -+#endif - break; - - return cmd_num; diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.6.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.6.patch deleted file mode 100644 index b6947605f8..0000000000 --- a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.6.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -Naur a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c ---- a/os_dep/linux/os_intfs.c 2016-04-19 11:17:44.465411644 -0700 -+++ b/os_dep/linux/os_intfs.c 2016-04-19 11:23:24.742014169 -0700 -@@ -958,7 +958,13 @@ - return dscp >> 5; - } - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) -+static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb, -+ void *accel_priv, -+ select_queue_fallback_t fallback) -+#else - static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb) -+#endif - { - _adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.7.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.7.patch deleted file mode 100644 index 73f9d108b1..0000000000 --- a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.7.patch +++ /dev/null @@ -1,259 +0,0 @@ -diff -Naur a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c ---- a/os_dep/linux/ioctl_cfg80211.c 2016-06-23 13:32:35.544763290 +0100 -+++ b/os_dep/linux/ioctl_cfg80211.c 2016-06-23 13:33:02.888918609 +0100 -@@ -57,7 +57,7 @@ - } - - #define CHAN2G(_channel, _freq, _flags) { \ -- .band = IEEE80211_BAND_2GHZ, \ -+ .band = NL80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ -@@ -66,7 +66,7 @@ - } - - #define CHAN5G(_channel, _flags) { \ -- .band = IEEE80211_BAND_5GHZ, \ -+ .band = NL80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ -@@ -166,18 +166,18 @@ - } - - struct ieee80211_supported_band *rtw_spt_band_alloc( -- enum ieee80211_band band -+ enum nl80211_band band - ) - { - struct ieee80211_supported_band *spt_band = NULL; - int n_channels, n_bitrates; - -- if(band == IEEE80211_BAND_2GHZ) -+ if(band == NL80211_BAND_2GHZ) - { - n_channels = RTW_2G_CHANNELS_NUM; - n_bitrates = RTW_G_RATES_NUM; - } -- else if(band == IEEE80211_BAND_5GHZ) -+ else if(band == NL80211_BAND_5GHZ) - { - n_channels = RTW_5G_CHANNELS_NUM; - n_bitrates = RTW_A_RATES_NUM; -@@ -201,12 +201,12 @@ - spt_band->n_channels = n_channels; - spt_band->n_bitrates = n_bitrates; - -- if(band == IEEE80211_BAND_2GHZ) -+ if(band == NL80211_BAND_2GHZ) - { - rtw_2g_channels_init(spt_band->channels); - rtw_2g_rates_init(spt_band->bitrates); - } -- else if(band == IEEE80211_BAND_5GHZ) -+ else if(band == NL80211_BAND_5GHZ) - { - rtw_5g_channels_init(spt_band->channels); - rtw_5g_rates_init(spt_band->bitrates); -@@ -226,13 +226,13 @@ - if(!spt_band) - return; - -- if(spt_band->band == IEEE80211_BAND_2GHZ) -+ if(spt_band->band == NL80211_BAND_2GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM - + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; - } -- else if(spt_band->band == IEEE80211_BAND_5GHZ) -+ else if(spt_band->band == NL80211_BAND_5GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM -@@ -301,12 +301,12 @@ - /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ - -- if (band == IEEE80211_BAND_5GHZ) { -+ if (band == NL80211_BAND_5GHZ) { - if (chan >= 182 && chan <= 196) - return 4000 + chan * 5; - else - return 5000 + chan * 5; -- } else { /* IEEE80211_BAND_2GHZ */ -+ } else { /* NL80211_BAND_2GHZ */ - if (chan == 14) - return 2484; - else if (chan < 14) -@@ -391,9 +391,9 @@ - DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__); - - if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, -@@ -424,9 +424,9 @@ - - channel = pnetwork->network.Configuration.DSConfig; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - -@@ -569,9 +569,9 @@ - return _FALSE; - - if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq); - bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel, -@@ -626,9 +626,9 @@ - u16 channel = cur_network->network.Configuration.DSConfig; - - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - #endif -@@ -3097,9 +3097,9 @@ - #else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #ifdef COMPAT_KERNEL_RELEASE - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -@@ -3142,9 +3142,9 @@ - #else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - pmgmt_frame = mgmt_buf; - pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame; -@@ -3950,9 +3950,9 @@ - - indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -@@ -3990,9 +3990,9 @@ - - indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -@@ -4020,9 +4020,9 @@ - DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); - - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC); -@@ -5199,7 +5199,7 @@ - #endif - }; - --static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type) -+static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) - { - - #define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ -@@ -5223,7 +5223,7 @@ - ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - /* -- *hw->wiphy->bands[IEEE80211_BAND_2GHZ] -+ *hw->wiphy->bands[NL80211_BAND_2GHZ] - *base on ant_num - *rx_mask: RX mask - *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 -@@ -5268,16 +5268,16 @@ - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ - { -- bands = wiphy->bands[IEEE80211_BAND_2GHZ]; -+ bands = wiphy->bands[NL80211_BAND_2GHZ]; - if(bands) -- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); -+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_2GHZ, rf_type); - } - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ - { -- bands = wiphy->bands[IEEE80211_BAND_5GHZ]; -+ bands = wiphy->bands[NL80211_BAND_5GHZ]; - if(bands) -- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); -+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_5GHZ, rf_type); - } - } - -@@ -5348,9 +5348,9 @@ - wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites); - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ -- wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); -+ wiphy->bands[NL80211_BAND_2GHZ] = rtw_spt_band_alloc(NL80211_BAND_2GHZ); - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ -- wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); -+ wiphy->bands[NL80211_BAND_5GHZ] = rtw_spt_band_alloc(NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; -@@ -5456,8 +5456,8 @@ - - pwdev_priv = wdev_to_priv(wdev); - -- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]); -- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]); -+ rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_2GHZ]); -+ rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_5GHZ]); - - wiphy_free(wdev->wiphy); - diff --git a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.8.patch b/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.8.patch deleted file mode 100644 index 6ed92e7bfd..0000000000 --- a/packages/linux-drivers/RTL8192CU/patches/RTL8192CU-kernel-4.8.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -Naur a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c ---- a/os_dep/linux/ioctl_cfg80211.c 2016-09-11 01:43:17.669610692 +0100 -+++ b/os_dep/linux/ioctl_cfg80211.c 2016-09-11 01:45:09.268139751 +0100 -@@ -1789,7 +1789,14 @@ - } - else - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) -+ struct cfg80211_scan_info info = { -+ .aborted = aborted -+ }; -+ cfg80211_scan_done(pwdev_priv->scan_request, &info); -+#else - cfg80211_scan_done(pwdev_priv->scan_request, aborted); -+#endif - } - - pwdev_priv->scan_request = NULL; diff --git a/packages/linux-drivers/RTL8192DU/package.mk b/packages/linux-drivers/RTL8192DU/package.mk index 13553ba96d..5aa4eb44d4 100644 --- a/packages/linux-drivers/RTL8192DU/package.mk +++ b/packages/linux-drivers/RTL8192DU/package.mk @@ -1,37 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RTL8192DU" -PKG_VERSION="9e7eb15" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="31a276df70c7cdbb534cf29de31cfc2d59c71eb8" +PKG_SHA256="9dd97f3fbfc31714d8b2cba4966051371f9c0515cff78da13d6e2c98506ac888" PKG_LICENSE="GPL" PKG_SITE="https://github.com/lwfinger/rtl8192du" PKG_URL="https://github.com/lwfinger/rtl8192du/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="rtl8192du-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="Realtek RTL8192DU Linux 3.x driver" PKG_LONGDESC="Realtek RTL8192DU Linux 3.x driver" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_IS_KERNEL_PKG="yes" pre_make_target() { unset LDFLAGS @@ -41,11 +21,11 @@ make_target() { make V=1 \ ARCH=$TARGET_KERNEL_ARCH \ KSRC=$(kernel_path) \ - CROSS_COMPILE=$TARGET_PREFIX \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ CONFIG_POWER_SAVING=n } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME } diff --git a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-remove_overlapping_pids.patch b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0001-remove_overlapping_pids.patch similarity index 100% rename from packages/linux-drivers/RTL8192DU/patches/RTL8192DU-remove_overlapping_pids.patch rename to packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0001-remove_overlapping_pids.patch diff --git a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0002-PR61.patch b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0002-PR61.patch new file mode 100644 index 0000000000..aeee5937ab --- /dev/null +++ b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0002-PR61.patch @@ -0,0 +1,64 @@ +From d295ee29d71a7969047fbe5042cec471408632c4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cl=C3=A9ment=20Peron?= + <1859302+clementperon@users.noreply.github.com> +Date: Wed, 6 Jun 2018 17:40:54 +0200 +Subject: [PATCH] Change __vfs_read_alt to __vfs_read + +For kernel from 4.1 to 4.10 there is no call_read_iter used in new_sync_read. +Why create a new __vfs_read_alt whereas the __vfs_read is exported and seems to do exactly the same. + +Remove __vfs_read_alt code and it's dependencies and use the __vfs_read function instead +--- + os_dep/osdep_service.c | 32 +------------------------------- + 1 file changed, 1 insertion(+), 31 deletions(-) + +diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c +index 286096a..9dd3d2b 100644 +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -40,36 +40,6 @@ atomic_t _malloc_cnt = ATOMIC_INIT(0); + atomic_t _malloc_size = ATOMIC_INIT(0); + #endif /* DBG_MEMORY_LEAK */ + +- +-static ssize_t new_sync_read(struct file *filp, void __user *buf, __kernel_size_t len, loff_t *ppos) +-{ +- struct iovec iov; +- struct kiocb kiocb; +- struct iov_iter iter; +- ssize_t ret; +- +- iov.iov_base = buf; +- iov.iov_len = len; +- init_sync_kiocb(&kiocb, filp); +- kiocb.ki_pos = *ppos; +- iov_iter_init(&iter, READ, &iov, 1, len); +- +- ret = call_read_iter(filp, &kiocb, &iter); +- BUG_ON(ret == -EIOCBQUEUED); +- *ppos = kiocb.ki_pos; +- return ret; +-} +- +-static ssize_t __vfs_read_alt(struct file *file, char __user *buf, size_t count, +- loff_t *pos) +-{ +- if (file->f_op->read) +- return file->f_op->read(file, buf, count, pos); +- else if (file->f_op->read_iter) +- return new_sync_read(file, (void *)buf, (__kernel_size_t)count, pos); +- else +- return -EINVAL; +-} + /* + * Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE + * @return: one of RTW_STATUS_CODE +@@ -1086,7 +1056,7 @@ static int readFile(struct file *fp,char *buf,int len) + + while(sum= KERNEL_VERSION(4, 1, 0)) +- rlen = __vfs_read_alt(fp, buf+sum, len-sum, &fp->f_pos); ++ rlen = __vfs_read(fp, buf+sum, len-sum, &fp->f_pos); + #else + rlen = fp->f_op->read(fp, buf+sum, len-sum, &fp->f_pos); + #endif diff --git a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0003-fix-vfs-read.patch b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0003-fix-vfs-read.patch new file mode 100644 index 0000000000..ecc26a678d --- /dev/null +++ b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-0003-fix-vfs-read.patch @@ -0,0 +1,27 @@ +From 9e477ff7fb1626f188e0d3314799371a5cce8681 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Wed, 13 Jun 2018 18:54:09 +0100 +Subject: [PATCH] fix vfs_read with 4.14.y+ + +--- + os_dep/osdep_service.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c +index 9dd3d2b..bd1df96 100644 +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -1055,7 +1055,9 @@ static int readFile(struct file *fp,char *buf,int len) + return -EPERM; + + while(sum= KERNEL_VERSION(4, 1, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) ++ rlen = kernel_read(fp, buf+sum, len-sum, &fp->f_pos); ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + rlen = __vfs_read(fp, buf+sum, len-sum, &fp->f_pos); + #else + rlen = fp->f_op->read(fp, buf+sum, len-sum, &fp->f_pos); +-- +2.14.1 + diff --git a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-kernel-4.7.patch b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-kernel-4.7.patch deleted file mode 100644 index f1936d65b4..0000000000 --- a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-kernel-4.7.patch +++ /dev/null @@ -1,236 +0,0 @@ -diff -Naur a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c ---- a/os_dep/ioctl_cfg80211.c 2016-06-23 13:12:55.005653163 +0100 -+++ b/os_dep/ioctl_cfg80211.c 2016-06-23 13:13:25.961839084 +0100 -@@ -47,7 +47,7 @@ - } - - #define CHAN2G(_channel, _freq, _flags) { \ -- .band = IEEE80211_BAND_2GHZ, \ -+ .band = NL80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ -@@ -56,7 +56,7 @@ - } - - #define CHAN5G(_channel, _flags) { \ -- .band = IEEE80211_BAND_5GHZ, \ -+ .band = NL80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ -@@ -155,19 +155,19 @@ - } - - static struct ieee80211_supported_band *rtw_spt_band_alloc( -- enum ieee80211_band band -+ enum nl80211_band band - ) - { - struct ieee80211_supported_band *spt_band = NULL; - int n_channels, n_bitrates; - int len; - -- if (band == IEEE80211_BAND_2GHZ) -+ if (band == NL80211_BAND_2GHZ) - { - n_channels = RTW_2G_CHANNELS_NUM; - n_bitrates = RTW_G_RATES_NUM; - } -- else if (band == IEEE80211_BAND_5GHZ) -+ else if (band == NL80211_BAND_5GHZ) - { - n_channels = RTW_5G_CHANNELS_NUM; - n_bitrates = RTW_A_RATES_NUM; -@@ -190,12 +190,12 @@ - spt_band->n_channels = n_channels; - spt_band->n_bitrates = n_bitrates; - -- if (band == IEEE80211_BAND_2GHZ) -+ if (band == NL80211_BAND_2GHZ) - { - rtw_2g_channels_init(spt_band->channels); - rtw_2g_rates_init(spt_band->bitrates); - } -- else if (band == IEEE80211_BAND_5GHZ) -+ else if (band == NL80211_BAND_5GHZ) - { - rtw_5g_channels_init(spt_band->channels); - rtw_5g_rates_init(spt_band->bitrates); -@@ -215,13 +215,13 @@ - if (!spt_band) - return; - -- if (spt_band->band == IEEE80211_BAND_2GHZ) -+ if (spt_band->band == NL80211_BAND_2GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM - + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; - } -- else if (spt_band->band == IEEE80211_BAND_5GHZ) -+ else if (spt_band->band == NL80211_BAND_5GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM -@@ -290,12 +290,12 @@ - /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ - -- if (band == IEEE80211_BAND_5GHZ) { -+ if (band == NL80211_BAND_5GHZ) { - if (chan >= 182 && chan <= 196) - return 4000 + chan * 5; - else - return 5000 + chan * 5; -- } else { /* IEEE80211_BAND_2GHZ */ -+ } else { /* NL80211_BAND_2GHZ */ - if (chan == 14) - return 2484; - else if (chan < 14) -@@ -335,9 +335,9 @@ - - channel = pnetwork->network.Configuration.DSConfig; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - -@@ -435,9 +435,9 @@ - u16 channel = cur_network->network.Configuration.DSConfig; - - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - #endif -@@ -2434,9 +2434,9 @@ - #else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, flags); - #endif /* defined(RTW_USE_CFG80211_STA_EVENT) */ -@@ -2463,9 +2463,9 @@ - #else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - pmgmt_frame = mgmt_buf; - pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame; -@@ -3148,9 +3148,9 @@ - - indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, flags); - } -@@ -3172,9 +3172,9 @@ - - indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - rtw_cfg80211_rx_mgmt(padapter, freq, 0, frame, frame_len, flags); - } -@@ -3199,9 +3199,9 @@ - DBG_8192D("RTW_Rx:category(%u), action(%u)\n", category, action); - - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, flags); - } -@@ -3633,7 +3633,7 @@ - .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, - }; - --static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type) -+static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) - { - - #define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ -@@ -3657,7 +3657,7 @@ - ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - /* -- *hw->wiphy->bands[IEEE80211_BAND_2GHZ] -+ *hw->wiphy->bands[NL80211_BAND_2GHZ] - *base on ant_num - *rx_mask: RX mask - *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 -@@ -3701,16 +3701,16 @@ - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ - { -- bands = wiphy->bands[IEEE80211_BAND_2GHZ]; -+ bands = wiphy->bands[NL80211_BAND_2GHZ]; - if (bands) -- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); -+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_2GHZ, rf_type); - } - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ - { -- bands = wiphy->bands[IEEE80211_BAND_5GHZ]; -+ bands = wiphy->bands[NL80211_BAND_5GHZ]; - if (bands) -- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); -+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_5GHZ, rf_type); - } - } - -@@ -3750,9 +3750,9 @@ - wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites); - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ -- wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); -+ wiphy->bands[NL80211_BAND_2GHZ] = rtw_spt_band_alloc(NL80211_BAND_2GHZ); - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ -- wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); -+ wiphy->bands[NL80211_BAND_5GHZ] = rtw_spt_band_alloc(NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; -@@ -3855,8 +3855,8 @@ - - pwdev_priv = wdev_to_priv(wdev); - -- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]); -- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]); -+ rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_2GHZ]); -+ rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_5GHZ]); - - wiphy_free(wdev->wiphy); - diff --git a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-kernel-4.8.patch b/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-kernel-4.8.patch deleted file mode 100644 index c6f517ba64..0000000000 --- a/packages/linux-drivers/RTL8192DU/patches/RTL8192DU-kernel-4.8.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -Naur a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c ---- a/os_dep/ioctl_cfg80211.c 2016-09-11 01:51:12.796375013 +0100 -+++ b/os_dep/ioctl_cfg80211.c 2016-09-11 01:52:39.942348529 +0100 -@@ -1425,7 +1425,14 @@ - } - else - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) -+ struct cfg80211_scan_info info = { -+ .aborted = aborted -+ }; -+ cfg80211_scan_done(pwdev_priv->scan_request, &info); -+#else - cfg80211_scan_done(pwdev_priv->scan_request, aborted); -+#endif - } - - pwdev_priv->scan_request = NULL; diff --git a/packages/linux-drivers/RTL8192DU/patches/aarch64/RTL8192DU-0101-PR63.patch b/packages/linux-drivers/RTL8192DU/patches/aarch64/RTL8192DU-0101-PR63.patch new file mode 100644 index 0000000000..0cabd59f81 --- /dev/null +++ b/packages/linux-drivers/RTL8192DU/patches/aarch64/RTL8192DU-0101-PR63.patch @@ -0,0 +1,25 @@ +From fb85a57a5cd6241cc8c066c5efc5b43781b0e42d Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Wed, 13 Jun 2018 06:43:10 +0100 +Subject: [PATCH] aarch64/4.4.y: implicit declaration of function + 'csum_ipv6_magic' + +--- + core/rtw_br_ext.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c +index da9c5e5..19af0fe 100644 +--- a/core/rtw_br_ext.c ++++ b/core/rtw_br_ext.c +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + #endif + #endif + +-- +2.14.1 + diff --git a/packages/linux-drivers/RTL8192DU/patches/aarch64/RTL8192DU-0102-fix-multiple-definitions.patch b/packages/linux-drivers/RTL8192DU/patches/aarch64/RTL8192DU-0102-fix-multiple-definitions.patch new file mode 100644 index 0000000000..04ca403f6e --- /dev/null +++ b/packages/linux-drivers/RTL8192DU/patches/aarch64/RTL8192DU-0102-fix-multiple-definitions.patch @@ -0,0 +1,26 @@ +diff --git a/include/ieee80211.h b/include/ieee80211.h +index 3c28a0b..2268fbd 100644 +--- a/include/ieee80211.h ++++ b/include/ieee80211.h +@@ -969,18 +969,18 @@ enum ieee80211_state { + #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" + #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] + +-extern __inline int is_multicast_mac_addr(const u8 *addr) ++static __inline int is_multicast_mac_addr(const u8 *addr) + { + return ((addr[0] != 0xff) && (0x01 & addr[0])); + } + +-extern __inline int is_broadcast_mac_addr(const u8 *addr) ++static __inline int is_broadcast_mac_addr(const u8 *addr) + { + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); + } + +-extern __inline int is_zero_mac_addr(const u8 *addr) ++static __inline int is_zero_mac_addr(const u8 *addr) + { + return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ + (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); diff --git a/packages/linux-drivers/RTL8192EU/package.mk b/packages/linux-drivers/RTL8192EU/package.mk index 0b74265a63..2ebca16725 100644 --- a/packages/linux-drivers/RTL8192EU/package.mk +++ b/packages/linux-drivers/RTL8192EU/package.mk @@ -1,37 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RTL8192EU" -PKG_VERSION="0c80da7" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="dcd752459cc93ee89e52331b26c93eb8209dc00b" +PKG_SHA256="a8da10546ab7d1faabdc71fcd7793ab979a1b2a8d46854945b5956280aa7c698" PKG_LICENSE="GPL" PKG_SITE="https://github.com/Mange/rtl8192eu-linux-driver" PKG_URL="https://github.com/Mange/rtl8192eu-linux-driver/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="rtl8192eu-linux-driver-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="Realtek RTL8192EU Linux 3.x driver" PKG_LONGDESC="Realtek RTL8192EU Linux 3.x driver" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_IS_KERNEL_PKG="yes" pre_make_target() { unset LDFLAGS @@ -41,12 +21,12 @@ make_target() { make V=1 \ ARCH=$TARGET_KERNEL_ARCH \ KSRC=$(kernel_path) \ - CROSS_COMPILE=$TARGET_PREFIX \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ CONFIG_POWER_SAVING=n \ USER_EXTRA_CFLAGS="-Wno-error=date-time" } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME } diff --git a/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-gcc-5.patch b/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-0101-gcc-5.patch similarity index 100% rename from packages/linux-drivers/RTL8192EU/patches/RTL8192EU-gcc-5.patch rename to packages/linux-drivers/RTL8192EU/patches/RTL8192EU-0101-gcc-5.patch diff --git a/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-kernel-4.7.patch b/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-kernel-4.7.patch deleted file mode 100644 index eb2e92418b..0000000000 --- a/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-kernel-4.7.patch +++ /dev/null @@ -1,346 +0,0 @@ -diff -Naur a/os_dep/linux/wifi_regd.c b/os_dep/linux/wifi_regd.c ---- a/os_dep/linux/wifi_regd.c 2016-06-23 13:37:11.270350569 +0100 -+++ b/os_dep/linux/wifi_regd.c 2016-06-23 13:37:39.606515916 +0100 -@@ -143,7 +143,7 @@ - static void _rtw_reg_apply_beaconing_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) - { -- enum ieee80211_band band; -+ enum nl80211_band band; - struct ieee80211_supported_band *sband; - const struct ieee80211_reg_rule *reg_rule; - struct ieee80211_channel *ch; -@@ -205,9 +205,9 @@ - u32 bandwidth = 0; - int r; - -- if (!wiphy->bands[IEEE80211_BAND_2GHZ]) -+ if (!wiphy->bands[NL80211_BAND_2GHZ]) - return; -- sband = wiphy->bands[IEEE80211_BAND_2GHZ]; -+ sband = wiphy->bands[NL80211_BAND_2GHZ]; - - /* - * If no country IE has been received always enable active scan -@@ -258,10 +258,10 @@ - struct ieee80211_channel *ch; - unsigned int i; - -- if (!wiphy->bands[IEEE80211_BAND_5GHZ]) -+ if (!wiphy->bands[NL80211_BAND_5GHZ]) - return; - -- sband = wiphy->bands[IEEE80211_BAND_5GHZ]; -+ sband = wiphy->bands[NL80211_BAND_5GHZ]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; -@@ -298,12 +298,12 @@ - /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ - -- if (band == IEEE80211_BAND_5GHZ) { -+ if (band == NL80211_BAND_5GHZ) { - if (chan >= 182 && chan <= 196) - return 4000 + chan * 5; - else - return 5000 + chan * 5; -- } else { /* IEEE80211_BAND_2GHZ */ -+ } else { /* NL80211_BAND_2GHZ */ - if (chan == 14) - return 2484; - else if (chan < 14) -@@ -348,11 +348,11 @@ - if (channel <= 14) - freq = - rtw_ieee80211_channel_to_frequency(channel, -- IEEE80211_BAND_2GHZ); -+ NL80211_BAND_2GHZ); - else - freq = - rtw_ieee80211_channel_to_frequency(channel, -- IEEE80211_BAND_5GHZ); -+ NL80211_BAND_5GHZ); - - ch = ieee80211_get_channel(wiphy, freq); - if (ch) { -@@ -393,11 +393,11 @@ - if (channel <= 14) - freq = - rtw_ieee80211_channel_to_frequency(channel, -- IEEE80211_BAND_2GHZ); -+ NL80211_BAND_2GHZ); - else - freq = - rtw_ieee80211_channel_to_frequency(channel, -- IEEE80211_BAND_5GHZ); -+ NL80211_BAND_5GHZ); - - ch = ieee80211_get_channel(wiphy, freq); - if (ch) { -@@ -544,4 +544,4 @@ - - return _rtw_reg_notifier_apply(wiphy, request, reg); - } --#endif //CONFIG_IOCTL_CFG80211 -\ No newline at end of file -+#endif //CONFIG_IOCTL_CFG80211 -diff -Naur a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c ---- a/os_dep/linux/ioctl_cfg80211.c 2016-06-23 13:37:16.990383918 +0100 -+++ b/os_dep/linux/ioctl_cfg80211.c 2016-06-23 13:37:48.786569554 +0100 -@@ -74,7 +74,7 @@ - } - - #define CHAN2G(_channel, _freq, _flags) { \ -- .band = IEEE80211_BAND_2GHZ, \ -+ .band = NL80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ -@@ -83,7 +83,7 @@ - } - - #define CHAN5G(_channel, _flags) { \ -- .band = IEEE80211_BAND_5GHZ, \ -+ .band = NL80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ -@@ -200,18 +200,18 @@ - } - - struct ieee80211_supported_band *rtw_spt_band_alloc( -- enum ieee80211_band band -+ enum nl80211_band band - ) - { - struct ieee80211_supported_band *spt_band = NULL; - int n_channels, n_bitrates; - -- if(band == IEEE80211_BAND_2GHZ) -+ if(band == NL80211_BAND_2GHZ) - { - n_channels = RTW_2G_CHANNELS_NUM; - n_bitrates = RTW_G_RATES_NUM; - } -- else if(band == IEEE80211_BAND_5GHZ) -+ else if(band == NL80211_BAND_5GHZ) - { - n_channels = RTW_5G_CHANNELS_NUM; - n_bitrates = RTW_A_RATES_NUM; -@@ -235,12 +235,12 @@ - spt_band->n_channels = n_channels; - spt_band->n_bitrates = n_bitrates; - -- if(band == IEEE80211_BAND_2GHZ) -+ if(band == NL80211_BAND_2GHZ) - { - rtw_2g_channels_init(spt_band->channels); - rtw_2g_rates_init(spt_band->bitrates); - } -- else if(band == IEEE80211_BAND_5GHZ) -+ else if(band == NL80211_BAND_5GHZ) - { - rtw_5g_channels_init(spt_band->channels); - rtw_5g_rates_init(spt_band->bitrates); -@@ -260,13 +260,13 @@ - if(!spt_band) - return; - -- if(spt_band->band == IEEE80211_BAND_2GHZ) -+ if(spt_band->band == NL80211_BAND_2GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM - + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; - } -- else if(spt_band->band == IEEE80211_BAND_5GHZ) -+ else if(spt_band->band == NL80211_BAND_5GHZ) - { - size = sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM -@@ -335,12 +335,12 @@ - /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ - -- if (band == IEEE80211_BAND_5GHZ) { -+ if (band == NL80211_BAND_5GHZ) { - if (chan >= 182 && chan <= 196) - return 4000 + chan * 5; - else - return 5000 + chan * 5; -- } else { /* IEEE80211_BAND_2GHZ */ -+ } else { /* NL80211_BAND_2GHZ */ - if (chan == 14) - return 2484; - else if (chan < 14) -@@ -441,9 +441,9 @@ - DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__); - - if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/, -@@ -475,9 +475,9 @@ - - channel = pnetwork->network.Configuration.DSConfig; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - -@@ -617,9 +617,9 @@ - return _FALSE; - - if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq); - bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel, -@@ -771,9 +771,9 @@ - u16 channel = cur_network->network.Configuration.DSConfig; - - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - notify_channel = ieee80211_get_channel(wiphy, freq); - #endif -@@ -3400,9 +3400,9 @@ - #else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #ifdef COMPAT_KERNEL_RELEASE - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -@@ -3445,9 +3445,9 @@ - #else /* defined(RTW_USE_CFG80211_STA_EVENT) */ - channel = pmlmeext->cur_channel; - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - pmgmt_frame = mgmt_buf; - pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame; -@@ -4257,9 +4257,9 @@ - - indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -@@ -4297,9 +4297,9 @@ - - indicate: - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC); -@@ -4327,9 +4327,9 @@ - DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action); - - if (channel <= RTW_CH_MAX_2G_CHANNEL) -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); - else -- freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); -+ freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) - rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC); -@@ -5718,7 +5718,7 @@ - - } - --static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type) -+static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type) - { - - #define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ -@@ -5742,7 +5742,7 @@ - ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - /* -- *hw->wiphy->bands[IEEE80211_BAND_2GHZ] -+ *hw->wiphy->bands[NL80211_BAND_2GHZ] - *base on ant_num - *rx_mask: RX mask - *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 -@@ -5787,16 +5787,16 @@ - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ - { -- bands = wiphy->bands[IEEE80211_BAND_2GHZ]; -+ bands = wiphy->bands[NL80211_BAND_2GHZ]; - if(bands) -- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); -+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_2GHZ, rf_type); - } - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ - { -- bands = wiphy->bands[IEEE80211_BAND_5GHZ]; -+ bands = wiphy->bands[NL80211_BAND_5GHZ]; - if(bands) -- rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); -+ rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_5GHZ, rf_type); - } - - /* init regulary domain */ -@@ -5874,9 +5874,9 @@ - wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites); - - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ -- wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); -+ wiphy->bands[NL80211_BAND_2GHZ] = rtw_spt_band_alloc(NL80211_BAND_2GHZ); - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ -- wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); -+ wiphy->bands[NL80211_BAND_5GHZ] = rtw_spt_band_alloc(NL80211_BAND_5GHZ); - - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; -@@ -6071,8 +6071,8 @@ - if (!wdev) - return; - -- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]); -- rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]); -+ rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_2GHZ]); -+ rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_5GHZ]); - - wiphy_free(wdev->wiphy); - diff --git a/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-kernel-4.8.patch b/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-kernel-4.8.patch deleted file mode 100644 index 5de2869002..0000000000 --- a/packages/linux-drivers/RTL8192EU/patches/RTL8192EU-kernel-4.8.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -Naur a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c ---- a/os_dep/linux/ioctl_cfg80211.c 2016-09-11 01:54:30.184844740 +0100 -+++ b/os_dep/linux/ioctl_cfg80211.c 2016-09-11 01:55:58.426842518 +0100 -@@ -1891,7 +1891,14 @@ - } - else - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) -+ struct cfg80211_scan_info info = { -+ .aborted = aborted -+ }; -+ cfg80211_scan_done(pwdev_priv->scan_request, &info); -+#else - cfg80211_scan_done(pwdev_priv->scan_request, aborted); -+#endif - } - - pwdev_priv->scan_request = NULL; diff --git a/packages/linux-drivers/RTL8812AU/package.mk b/packages/linux-drivers/RTL8812AU/package.mk index fd40ed905f..6a94585af2 100644 --- a/packages/linux-drivers/RTL8812AU/package.mk +++ b/packages/linux-drivers/RTL8812AU/package.mk @@ -1,36 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="RTL8812AU" -PKG_VERSION="4.3.20" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="61d0cd95afc01eae64da0c446515803910de1a00" +PKG_SHA256="8d36737540b1a47e56174ced61194f3b596999609ce8c18ac466dbd42b48bc0b" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/Grawp/rtl8812au_rtl8821au" -PKG_URL="https://github.com/Grawp/rtl8812au_rtl8821au/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="rtl8812au_rtl8821au-$PKG_VERSION" +PKG_SITE="https://github.com/paspro/rtl8812au" +PKG_URL="https://github.com/paspro/rtl8812au/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="Realtek RTL8812AU Linux 3.x driver" PKG_LONGDESC="Realtek RTL8812AU Linux 3.x driver" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_IS_KERNEL_PKG="yes" pre_make_target() { unset LDFLAGS @@ -40,11 +21,11 @@ make_target() { make V=1 \ ARCH=$TARGET_KERNEL_ARCH \ KSRC=$(kernel_path) \ - CROSS_COMPILE=$TARGET_PREFIX \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ CONFIG_POWER_SAVING=n } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME } diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch deleted file mode 100644 index 0fe54ac2ed..0000000000 --- a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-01-add_new_cards.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c -index 85312bc..7318b1e 100644 ---- a/os_dep/linux/usb_intf.c -+++ b/os_dep/linux/usb_intf.c -@@ -167,6 +167,11 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ - {USB_DEVICE(0x13b1, 0x003f),.driver_info = RTL8812}, /* Linksys - WUSB6300 */ - {USB_DEVICE(0x2357, 0x0101),.driver_info = RTL8812}, /* TP-Link - T4U */ - {USB_DEVICE(0x2357, 0x0103),.driver_info = RTL8812}, /* TP-Link - T4UH */ -+ /*=== Patched ID ===*/ -+ {USB_DEVICE(0x050D, 0x1109),.driver_info = RTL8812}, /* Belkin F9L1109 - SerComm */ -+ {USB_DEVICE(0x20F4, 0x805B),.driver_info = RTL8812}, /* TRENDnet - Cameo */ -+ {USB_DEVICE(0x148F, 0x9097),.driver_info = RTL8812}, /* Amped Wireless ACA1 */ -+ - #endif - - #ifdef CONFIG_RTL8821A -@@ -184,9 +189,18 @@ static struct usb_device_id rtw_usb_id_tbl[] ={ - {USB_DEVICE(0x2001, 0x3314),.driver_info = RTL8821}, /* D-Link - Cameo */ - {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link - Cameo */ - {USB_DEVICE(0x0E66, 0x0023),.driver_info = RTL8821}, /* HAWKING - Edimax */ -- {USB_DEVICE(0x056E, 0x400E) , .driver_info = RTL8821}, /* ELECOM - ELECOM */ -- {USB_DEVICE(0x056E, 0x400F) , .driver_info = RTL8821}, /* ELECOM - ELECOM */ -+ {USB_DEVICE(0x056E, 0x400E),.driver_info = RTL8821}, /* ELECOM - ELECOM */ -+ {USB_DEVICE(0x056E, 0x400F),.driver_info = RTL8821}, /* ELECOM - ELECOM */ - {USB_DEVICE(0x0846, 0x9052),.driver_info = RTL8821}, /* Netgear - A6100 */ -+ /*=== Patched ID ===*/ -+ {USB_DEVICE(0x0BDA, 0xA811),.driver_info = RTL8821}, /* OUTLINK - Edimax */ -+ {USB_DEVICE(0x7392, 0xA812),.driver_info = RTL8821}, /* Edimax - Edimax */ -+ {USB_DEVICE(0x0411, 0x0242),.driver_info = RTL8821}, /* BUFFALO - Edimax */ -+ {USB_DEVICE(0x2001, 0x3318),.driver_info = RTL8821}, /* D-Link DWA-172 */ -+ {USB_DEVICE(0x056e, 0x4007),.driver_info = RTL8821}, /* Elecom - WDC-433DU2HBK */ -+ {USB_DEVICE(0x7392, 0xA813),.driver_info = RTL8821}, /* Edimax - EW-7811UAC */ -+ {USB_DEVICE(0x2019, 0xAB32),.driver_info = RTL8821}, /* Planex - GW-450S */ -+ {USB_DEVICE(0x0411, 0x025D),.driver_info = RTL8821}, /* BUFFALO WI-U3-866D */ - #endif - - #ifdef CONFIG_RTL8192E diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-05-fix-AP-timeout.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-05-fix-AP-timeout.patch deleted file mode 100644 index 7345ac136a..0000000000 --- a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-05-fix-AP-timeout.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 4037784fc342dc81c71f7b950f4f5d94c0c21e5c Mon Sep 17 00:00:00 2001 -From: Sam Nazarko -Date: Tue, 8 Sep 2015 18:36:02 +0100 -Subject: [PATCH] Fix potential issue for timeout when connecting to an AP. - -Signed-off-by: Sam Nazarko ---- - include/rtw_mlme_ext.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h -index cd52a90..4908e59 100644 ---- a/include/rtw_mlme_ext.h -+++ b/include/rtw_mlme_ext.h -@@ -27,7 +27,7 @@ - // So, this driver tried to extend the dwell time for each scanning channel. - // This will increase the chance to receive the probe response from SoftAP. - --#define SURVEY_TO (100) -+#define SURVEY_TO (150) - #define REAUTH_TO (300) //(50) - #define REASSOC_TO (300) //(50) - //#define DISCONNECT_TO (3000) diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-06-disable-power-saving.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-06-disable-power-saving.patch deleted file mode 100644 index 390637d4f2..0000000000 --- a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-06-disable-power-saving.patch +++ /dev/null @@ -1,23 +0,0 @@ -From b68705a507c47dc2ff2cc6121830af315fbcdc83 Mon Sep 17 00:00:00 2001 -From: Sam Nazarko -Date: Sat, 11 Jul 2015 02:31:07 +0100 -Subject: [PATCH] Disable power saving by default - -Signed-off-by: Sam Nazarko ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index e97fbbf..7981e59 100644 ---- a/Makefile -+++ b/Makefile -@@ -36,7 +36,7 @@ CONFIG_SDIO_HCI = n - CONFIG_GSPI_HCI = n - - CONFIG_MP_INCLUDED = y --CONFIG_POWER_SAVING = y -+CONFIG_POWER_SAVING = n - CONFIG_USB_AUTOSUSPEND = n - CONFIG_HW_PWRP_DETECTION = n - CONFIG_WIFI_TEST = n diff --git a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-08-disable-debug-output.patch b/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-08-disable-debug-output.patch deleted file mode 100644 index 9c238ba248..0000000000 --- a/packages/linux-drivers/RTL8812AU/patches/RTL8812AU-08-disable-debug-output.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/include/autoconf.h b/include/autoconf.h -index 7cc4184..8135c1d 100755 ---- a/include/autoconf.h -+++ b/include/autoconf.h -@@ -343,14 +343,14 @@ - /* - * Debug Related Config - */ --#define DBG 1 -+#define DBG 0 - - //#define CONFIG_DEBUG /* DBG_871X, etc... */ - //#define CONFIG_DEBUG_RTL871X /* RT_TRACE, RT_PRINT_DATA, _func_enter_, _func_exit_ */ - --#define CONFIG_PROC_DEBUG -+//#define CONFIG_PROC_DEBUG - --#define DBG_CONFIG_ERROR_DETECT -+//#define DBG_CONFIG_ERROR_DETECT - //#define DBG_CONFIG_ERROR_DETECT_INT - //#define DBG_CONFIG_ERROR_RESET - diff --git a/packages/linux-drivers/RTL8812AU/patches/aarch64/RTL8812AU-02-fix-multiple-definitions.patch b/packages/linux-drivers/RTL8812AU/patches/aarch64/RTL8812AU-02-fix-multiple-definitions.patch index e586fe3d8a..263a970576 100644 --- a/packages/linux-drivers/RTL8812AU/patches/aarch64/RTL8812AU-02-fix-multiple-definitions.patch +++ b/packages/linux-drivers/RTL8812AU/patches/aarch64/RTL8812AU-02-fix-multiple-definitions.patch @@ -1,14 +1,24 @@ -diff -Naur a/include/ieee80211.h b/include/ieee80211.h ---- a/include/ieee80211.h 2016-10-20 12:20:19.000000000 -0700 -+++ b/include/ieee80211.h 2016-11-15 17:00:32.239848199 -0800 -@@ -1388,18 +1388,18 @@ - (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ - (((Addr[5]) & 0xff) == 0xff)) +From 92d01b516a77be6f21f6a3611c39f23e03fe4594 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Mon, 10 Jul 2017 20:11:37 +0100 +Subject: [PATCH] fix multiple definitions + +--- + include/ieee80211.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/ieee80211.h b/include/ieee80211.h +index 7a50a07..84aad12 100644 +--- a/include/ieee80211.h ++++ b/include/ieee80211.h +@@ -1481,18 +1481,18 @@ enum ieee80211_state { + (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ + (((Addr[5]) & 0xff) == 0xff)) #else -extern __inline int is_multicast_mac_addr(const u8 *addr) +static __inline int is_multicast_mac_addr(const u8 *addr) { - return ((addr[0] != 0xff) && (0x01 & addr[0])); + return (addr[0] != 0xff) && (0x01 & addr[0]); } -extern __inline int is_broadcast_mac_addr(const u8 *addr) @@ -23,3 +33,6 @@ diff -Naur a/include/ieee80211.h b/include/ieee80211.h { return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/RTL8188EU-aml/package.mk b/packages/linux-drivers/amlogic/RTL8188EU-aml/package.mk new file mode 100644 index 0000000000..0a7262f523 --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8188EU-aml/package.mk @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="RTL8188EU-aml" +PKG_VERSION="2d358c5" +PKG_SHA256="adf31d56d3a94bca814f1bd0de24af61fae85d25a259124b5d16c1d23cc72c91" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8188eu" +PKG_URL="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8188eu/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Realtek RTL8188EU Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's/-DCONFIG_CONCURRENT_MODE//g; s/^CONFIG_POWER_SAVING.*$/CONFIG_POWER_SAVING = n/g; s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/g' $PKG_BUILD/*/Makefile + sed -i 's/^#define CONFIG_DEBUG.*//g' $PKG_BUILD/*/include/autoconf.h + sed -i 's/#define DEFAULT_RANDOM_MACADDR.*1/#define DEFAULT_RANDOM_MACADDR 0/g' $PKG_BUILD/*/core/rtw_ieee80211.c +} + +make_target() { + LDFLAGS="" make -C $(kernel_path) M=$PKG_BUILD/rtl8xxx_EU \ + ARCH=$TARGET_KERNEL_ARCH \ + KSRC=$(kernel_path) \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + USER_EXTRA_CFLAGS="-fgnu89-inline" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/RTL8188EU-aml/patches/RTL8188EU-aml-0001-Add-support-for-a-few-USB-dongles.patch b/packages/linux-drivers/amlogic/RTL8188EU-aml/patches/RTL8188EU-aml-0001-Add-support-for-a-few-USB-dongles.patch new file mode 100644 index 0000000000..5a36dca7b8 --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8188EU-aml/patches/RTL8188EU-aml-0001-Add-support-for-a-few-USB-dongles.patch @@ -0,0 +1,29 @@ +From b67364bd4236f890238fb44df1bbba228b42ffe1 Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Mon, 2 Oct 2017 11:13:42 +0200 +Subject: [PATCH] Add support for a few USB dongles + +--- + rtl8xxx_EU/os_dep/linux/usb_intf.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/rtl8xxx_EU/os_dep/linux/usb_intf.c b/rtl8xxx_EU/os_dep/linux/usb_intf.c +index 2fbffd6..4892838 100755 +--- a/rtl8xxx_EU/os_dep/linux/usb_intf.c ++++ b/rtl8xxx_EU/os_dep/linux/usb_intf.c +@@ -138,6 +138,12 @@ static struct usb_device_id rtw_usb_id_tbl[] = { + /*=== Customer ID ===*/ + /****** 8188EUS ********/ + {USB_DEVICE(0x07B8, 0x8179), .driver_info = RTL8188E}, /* Abocom - Abocom */ ++ {USB_DEVICE(0x0DF6, 0x0076), .driver_info = RTL8188E}, /* Sitecom N150 v2 */ ++ {USB_DEVICE(0x2001, 0x330F), .driver_info = RTL8188E}, /* DLink DWA-125 REV D1 */ ++ {USB_DEVICE(0x2001, 0x3310), .driver_info = RTL8188E}, /* Dlink DWA-123 REV D1 */ ++ {USB_DEVICE(0x2001, 0x3311), .driver_info = RTL8188E}, /* DLink GO-USB-N150 REV B1 */ ++ {USB_DEVICE(0x056E, 0x4008), .driver_info = RTL8188E}, /* Elecom WDC-150SU2M */ ++ {USB_DEVICE(0x2357, 0x010c), .driver_info = RTL8188E}, /* TP-Link TL-WN722N v2 */ + #endif + + #ifdef CONFIG_RTL8812A +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/RTL8189ES-aml/package.mk b/packages/linux-drivers/amlogic/RTL8189ES-aml/package.mk new file mode 100644 index 0000000000..b20d9fc2ea --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8189ES-aml/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="RTL8189ES-aml" +PKG_VERSION="f971e4b" +PKG_SHA256="a87d891e3a42d70429b39f01216775dee95b0dc9093f9576ca7417e74f21ee2b" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8189es" +PKG_URL="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8189es/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Realtek RTL8189ES Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's/-DCONFIG_CONCURRENT_MODE//g; s/^CONFIG_POWER_SAVING.*$/CONFIG_POWER_SAVING = n/g; s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/g' $PKG_BUILD/*/Makefile + sed -i 's/^#define CONFIG_DEBUG.*//g' $PKG_BUILD/*/include/autoconf.h + sed -i 's/#define DEFAULT_RANDOM_MACADDR.*1/#define DEFAULT_RANDOM_MACADDR 0/g' $PKG_BUILD/*/core/rtw_ieee80211.c +} + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD/rtl8189ES \ + ARCH=$TARGET_KERNEL_ARCH \ + KSRC=$(kernel_path) \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + USER_EXTRA_CFLAGS="-fgnu89-inline" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/RTL8189FS-aml/package.mk b/packages/linux-drivers/amlogic/RTL8189FS-aml/package.mk new file mode 100644 index 0000000000..7ae58e2cfb --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8189FS-aml/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="RTL8189FS-aml" +PKG_VERSION="538ba58" +PKG_SHA256="3dc7602481096b8890d48915e16bf0eb1554ca1b7a3dfec6450486468aadb826" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8189ftv" +PKG_URL="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8189ftv/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Realtek RTL8189FS Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's/-DCONFIG_CONCURRENT_MODE//g; s/^CONFIG_POWER_SAVING.*$/CONFIG_POWER_SAVING = n/g; s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/g' $PKG_BUILD/*/Makefile + sed -i 's/^#define CONFIG_DEBUG.*//g' $PKG_BUILD/*/include/autoconf.h + sed -i 's/#define DEFAULT_RANDOM_MACADDR.*1/#define DEFAULT_RANDOM_MACADDR 0/g' $PKG_BUILD/*/core/rtw_ieee80211.c +} + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD/rtl8189FS \ + ARCH=$TARGET_KERNEL_ARCH \ + KSRC=$(kernel_path) \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + USER_EXTRA_CFLAGS="-fgnu89-inline" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/RTL8723BS-aml/package.mk b/packages/linux-drivers/amlogic/RTL8723BS-aml/package.mk new file mode 100644 index 0000000000..eb075203b4 --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8723BS-aml/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="RTL8723BS-aml" +PKG_VERSION="ee9d86a" +PKG_SHA256="4d1c5fe0d05edbf5eab96dfe5ff99b7d56c098f4d4d317351fa25e75606de094" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8723bs" +PKG_URL="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8723bs/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Realtek RTL8723BS Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's/-DCONFIG_CONCURRENT_MODE//g; s/^CONFIG_POWER_SAVING.*$/CONFIG_POWER_SAVING = n/g; s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/g' $PKG_BUILD/*/Makefile + sed -i 's/^#define CONFIG_DEBUG.*//g' $PKG_BUILD/*/include/autoconf.h + sed -i 's/#define DEFAULT_RANDOM_MACADDR.*1/#define DEFAULT_RANDOM_MACADDR 0/g' $PKG_BUILD/*/core/rtw_ieee80211.c +} + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD/rtl8723BS \ + ARCH=$TARGET_KERNEL_ARCH \ + KSRC=$(kernel_path) \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + USER_EXTRA_CFLAGS="-fgnu89-inline" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/RTL8723DS-aml/package.mk b/packages/linux-drivers/amlogic/RTL8723DS-aml/package.mk new file mode 100644 index 0000000000..1022147c2c --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8723DS-aml/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="RTL8723DS-aml" +PKG_VERSION="fb4adf7" +PKG_SHA256="00da0a7773286df38e8785be2891025e4fa6c4ff5ace9450e54cae85f143847e" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8723ds" +PKG_URL="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8723ds/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Realtek RTL8723DS Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's/-DCONFIG_CONCURRENT_MODE//g; s/^CONFIG_POWER_SAVING.*$/CONFIG_POWER_SAVING = n/g; s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/g' $PKG_BUILD/*/Makefile + sed -i 's/^#define CONFIG_DEBUG.*//g' $PKG_BUILD/*/include/autoconf.h + sed -i 's/#define DEFAULT_RANDOM_MACADDR.*1/#define DEFAULT_RANDOM_MACADDR 0/g' $PKG_BUILD/*/core/rtw_ieee80211.c +} + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD/rtl8723DS \ + ARCH=$TARGET_KERNEL_ARCH \ + KSRC=$(kernel_path) \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + USER_EXTRA_CFLAGS="-fgnu89-inline" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/RTL8822BU-aml/package.mk b/packages/linux-drivers/amlogic/RTL8822BU-aml/package.mk new file mode 100644 index 0000000000..9e8ec98ad6 --- /dev/null +++ b/packages/linux-drivers/amlogic/RTL8822BU-aml/package.mk @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="RTL8822BU-aml" +PKG_VERSION="9df3607" +PKG_SHA256="d7005150d0737f81475437e55430b2cef780664db6948f5a17fecc32c915d317" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8822bu" +PKG_URL="https://github.com/khadas/android_hardware_wifi_realtek_drivers_8822bu/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Realtek RTL8822BU Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's/-DCONFIG_CONCURRENT_MODE//g; s/^CONFIG_POWER_SAVING.*$/CONFIG_POWER_SAVING = n/g; s/^CONFIG_RTW_DEBUG.*/CONFIG_RTW_DEBUG = n/g' $PKG_BUILD/*/Makefile + sed -i 's/^#define CONFIG_DEBUG.*//g' $PKG_BUILD/*/include/autoconf.h + sed -i 's/#define DEFAULT_RANDOM_MACADDR.*1/#define DEFAULT_RANDOM_MACADDR 0/g' $PKG_BUILD/*/core/rtw_ieee80211.c +} + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD/rtl8822BU \ + ARCH=$TARGET_KERNEL_ARCH \ + KSRC=$(kernel_path) \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + USER_EXTRA_CFLAGS="-fgnu89-inline" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/ap6xxx-aml/modprobe.d/dhd.conf b/packages/linux-drivers/amlogic/ap6xxx-aml/modprobe.d/dhd.conf new file mode 100644 index 0000000000..3eac44b78f --- /dev/null +++ b/packages/linux-drivers/amlogic/ap6xxx-aml/modprobe.d/dhd.conf @@ -0,0 +1 @@ +options dhd firmware_path=/usr/lib/firmware/brcm/ nvram_path=/usr/lib/firmware/brcm/ diff --git a/packages/linux-drivers/amlogic/ap6xxx-aml/package.mk b/packages/linux-drivers/amlogic/ap6xxx-aml/package.mk new file mode 100644 index 0000000000..8e0cfdfeed --- /dev/null +++ b/packages/linux-drivers/amlogic/ap6xxx-aml/package.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ap6xxx-aml" +PKG_VERSION="99b3459" +PKG_SHA256="5f2bfc29616d869ad5fb41e0782887d73cafe0bae8a13e7e945bb32b2a2c0877" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_broadcom_drivers_ap6xxx" +PKG_URL="https://github.com/khadas/android_hardware_wifi_broadcom_drivers_ap6xxx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="ap6xxx: Linux drivers for AP6xxx WLAN chips used in some devices based on Amlogic SoCs" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD/bcmdhd.1.363.59.144.x.cn \ + ARCH=$TARGET_KERNEL_ARCH \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + CONFIG_BCMDHD_DISABLE_WOWLAN=y +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0001-bcmdhd-Add-new-SDIO-vendor-device-ID-for-AP6212.patch b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0001-bcmdhd-Add-new-SDIO-vendor-device-ID-for-AP6212.patch new file mode 100644 index 0000000000..3efe1cdbd5 --- /dev/null +++ b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0001-bcmdhd-Add-new-SDIO-vendor-device-ID-for-AP6212.patch @@ -0,0 +1,34 @@ +From fb537b584b78c0407c663ed4076e4ff79b36a14c Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Thu, 14 Sep 2017 21:20:18 +0200 +Subject: [PATCH 1/4] bcmdhd: Add new SDIO vendor/device ID for AP6212 + +--- + bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c b/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c +index af321a6..f7d9a09 100644 +--- a/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c ++++ b/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c +@@ -74,6 +74,9 @@ + #if !defined(SDIO_DEVICE_ID_BROADCOM_43239) + #define SDIO_DEVICE_ID_BROADCOM_43239 43239 + #endif /* !defined(SDIO_DEVICE_ID_BROADCOM_43239) */ ++#if !defined(SDIO_DEVICE_ID_BROADCOM_4343) ++#define SDIO_DEVICE_ID_BROADCOM_4343 0xa9a6 ++#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4343) */ + + extern void wl_cfg80211_set_parent_dev(void *dev); + extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); +@@ -217,6 +220,7 @@ static void bcmsdh_sdmmc_remove(struct sdio_func *func) + /* devices we support, null terminated */ + static const struct sdio_device_id bcmsdh_sdmmc_ids[] = { + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT) }, ++ { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4343) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329) }, +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0002-bcmdhd-add-BCM4335-firmware-loading-support.patch b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0002-bcmdhd-add-BCM4335-firmware-loading-support.patch new file mode 100644 index 0000000000..1e4ddb9790 --- /dev/null +++ b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0002-bcmdhd-add-BCM4335-firmware-loading-support.patch @@ -0,0 +1,53 @@ +From cd000f263d8433f2a1a29d7e722cd57e47b30fc5 Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Thu, 14 Sep 2017 21:20:55 +0200 +Subject: [PATCH 2/4] bcmdhd: add BCM4335 firmware loading support + +--- + bcmdhd.1.363.59.144.x.cn/dhd_config.c | 10 ++++++++++ + bcmdhd.1.363.59.144.x.cn/dhd_config.h | 1 + + 2 files changed, 11 insertions(+) + +diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_config.c b/bcmdhd.1.363.59.144.x.cn/dhd_config.c +index ff07d18..b668400 100644 +--- a/bcmdhd.1.363.59.144.x.cn/dhd_config.c ++++ b/bcmdhd.1.363.59.144.x.cn/dhd_config.c +@@ -141,6 +141,14 @@ const static char *bcm43241b4_ag_fw_name[] = { + "fw_bcm43241b4_ag_mfg.bin" + }; + ++const static char *bcm4335b0_ag_fw_name[] = { ++ "fw_bcm4335b0_ag.bin", ++ "fw_bcm4335b0_ag_apsta.bin", ++ "fw_bcm4335b0_ag_p2p.bin", ++ "fw_bcm4335b0_ag_es.bin", ++ "fw_bcm4335b0_ag_mfg.bin" ++}; ++ + const static char *bcm4339a0_ag_fw_name[] = { + "fw_bcm4339a0_ag.bin", + "fw_bcm4339a0_ag_apsta.bin", +@@ -529,6 +537,8 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) + case BCM4335_CHIP_ID: + if (chiprev == BCM4335A0_CHIP_REV) + strcpy(&fw_path[i+1], bcm4339a0_ag_fw_name[fw_type]); ++ else if (chiprev == BCM4335B0_CHIP_REV) ++ strcpy(&fw_path[i+1], bcm4335b0_ag_fw_name[fw_type]); + break; + case BCM4345_CHIP_ID: + case BCM43454_CHIP_ID: +diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_config.h b/bcmdhd.1.363.59.144.x.cn/dhd_config.h +index cc76e8b..450df56 100644 +--- a/bcmdhd.1.363.59.144.x.cn/dhd_config.h ++++ b/bcmdhd.1.363.59.144.x.cn/dhd_config.h +@@ -28,6 +28,7 @@ extern uint dhd_slpauto; + #define BCM43341B0_CHIP_REV 2 + #define BCM43241B4_CHIP_REV 5 + #define BCM4335A0_CHIP_REV 2 ++#define BCM4335B0_CHIP_REV 1 + #define BCM4339A0_CHIP_REV 1 + #define BCM43455C0_CHIP_REV 6 + #define BCM4354A1_CHIP_REV 1 +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0003-bcmdhd-match-only-Broadcom-SDIO-devices.patch b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0003-bcmdhd-match-only-Broadcom-SDIO-devices.patch new file mode 100644 index 0000000000..5f7354d34e --- /dev/null +++ b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0003-bcmdhd-match-only-Broadcom-SDIO-devices.patch @@ -0,0 +1,25 @@ +From 24affe6bf59dfd6fd9b62b3118e4b2b9e555181a Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Thu, 14 Sep 2017 21:21:18 +0200 +Subject: [PATCH 3/4] bcmdhd: match only Broadcom SDIO devices + +--- + bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c b/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c +index f7d9a09..47ca535 100644 +--- a/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c ++++ b/bcmdhd.1.363.59.144.x.cn/bcmsdh_sdmmc_linux.c +@@ -229,7 +229,7 @@ static const struct sdio_device_id bcmsdh_sdmmc_ids[] = { + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4334) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4324) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43239) }, +- { SDIO_DEVICE_CLASS(SDIO_CLASS_NONE) }, ++ { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_ANY_ID) }, + { /* end: all zeroes */ }, + }; + +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0004-bcmdhd-if-driver-is-not-yet-initialized-wait-and-ret.patch b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0004-bcmdhd-if-driver-is-not-yet-initialized-wait-and-ret.patch new file mode 100644 index 0000000000..a904347194 --- /dev/null +++ b/packages/linux-drivers/amlogic/ap6xxx-aml/patches/ap6xxx-aml-0004-bcmdhd-if-driver-is-not-yet-initialized-wait-and-ret.patch @@ -0,0 +1,37 @@ +From b9edf37b14f64a8bed5586898e3503322a5b8bfc Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Thu, 5 Oct 2017 22:04:11 +0200 +Subject: [PATCH 4/4] bcmdhd: if driver is not yet initialized, wait and retry + +--- + bcmdhd.1.363.59.144.x.cn/dhd_linux.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_linux.c b/bcmdhd.1.363.59.144.x.cn/dhd_linux.c +index c64f851..1754fb7 100644 +--- a/bcmdhd.1.363.59.144.x.cn/dhd_linux.c ++++ b/bcmdhd.1.363.59.144.x.cn/dhd_linux.c +@@ -6127,9 +6127,17 @@ dhd_open(struct net_device *net) + int ifidx; + int32 ret = 0; + +- if (!dhd_download_fw_on_driverload && !dhd_driver_init_done) { +- DHD_ERROR(("%s: WLAN driver is not initialized\n", __FUNCTION__)); +- return -1; ++ for (int retry = 0; ++retry; ) { ++ if (!dhd_download_fw_on_driverload && !dhd_driver_init_done) { ++ DHD_ERROR(("%s: WLAN driver is not initialized\n", __FUNCTION__)); ++ if (retry > 1) { ++ return -1; ++ } else { ++ OSL_SLEEP(1000); ++ } ++ } else { ++ break; ++ } + } + + printf("%s: Enter %p\n", __FUNCTION__, net); +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/avl6862-aml/package.mk b/packages/linux-drivers/amlogic/avl6862-aml/package.mk new file mode 100644 index 0000000000..c8721c411c --- /dev/null +++ b/packages/linux-drivers/amlogic/avl6862-aml/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="avl6862-aml" +PKG_VERSION="1.0" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://libreelec.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="virtual" +PKG_LONGDESC="avl6862-aml: Internal DVB tuner driver for Amlogic devices developed by afl1" + +post_install() { + enable_service amlogic-dvb.service +} diff --git a/packages/linux-drivers/amlogic/avl6862-aml/system.d/amlogic-dvb.service b/packages/linux-drivers/amlogic/avl6862-aml/system.d/amlogic-dvb.service new file mode 100644 index 0000000000..3feef16975 --- /dev/null +++ b/packages/linux-drivers/amlogic/avl6862-aml/system.d/amlogic-dvb.service @@ -0,0 +1,11 @@ +[Unit] +Description=Amlogic DVB module loader +ConditionPathExists=/proc/device-tree/dvbfe/dtv_demod0 +After=kernel-overlays.service + +[Service] +Type=simple +ExecStart=/bin/sh -c '[ `cat /proc/device-tree/dvbfe/dtv_demod0` = "Avl6211" ] && /sbin/modprobe aml_fe' + +[Install] +WantedBy=basic.target diff --git a/packages/linux-drivers/amlogic/fd628-aml/package.mk b/packages/linux-drivers/amlogic/fd628-aml/package.mk new file mode 100644 index 0000000000..b882ecd575 --- /dev/null +++ b/packages/linux-drivers/amlogic/fd628-aml/package.mk @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="fd628-aml" +PKG_VERSION="8047f2e" +PKG_SHA256="168b9ae9df56834462a68654fb204468a4c8df31ce2b88d654fdff378e5eacda" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/arthur-liberman/linux_fd628" +PKG_URL="https://github.com/arthur-liberman/linux_fd628/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="fd628-aml: Driver for Amlogic FD628 display" + +PKG_TOOLCHAIN="manual" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + kernel_make -C "$(kernel_path)" M="$PKG_BUILD/driver" + + make FD628Service +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; + + mkdir -p $INSTALL/usr/sbin + cp -P FD628Service $INSTALL/usr/sbin +} + +post_install() { + enable_service fd628.service +} diff --git a/packages/linux-drivers/amlogic/fd628-aml/sources/Makefile b/packages/linux-drivers/amlogic/fd628-aml/sources/Makefile new file mode 100644 index 0000000000..3bbee48b6e --- /dev/null +++ b/packages/linux-drivers/amlogic/fd628-aml/sources/Makefile @@ -0,0 +1,6 @@ +default: + obj-m += driver/aml_fd628.o + $(MAKE) modules + +FD628Service: FD628Service.c + $(CC) $(CFLAGS) -Wall -w -o $@ $^ -lm -lpthread diff --git a/packages/linux-drivers/amlogic/fd628-aml/system.d/fd628.service b/packages/linux-drivers/amlogic/fd628-aml/system.d/fd628.service new file mode 100644 index 0000000000..08a04f8ee6 --- /dev/null +++ b/packages/linux-drivers/amlogic/fd628-aml/system.d/fd628.service @@ -0,0 +1,15 @@ +[Unit] +Description=Amlogic FD628 Service +ConditionPathExists=/proc/device-tree/le-vfd/ +ConditionPathExists=/storage/.config/vfd.conf + +[Service] +Type=oneshot +EnvironmentFile=/storage/.config/vfd.conf +ExecStart=/bin/sh -c '[ `cat /proc/device-tree/le-vfd/compatible` = "le,vfd" ] && /sbin/modprobe aml_fd628 vfd_gpio_clk=${vfd_gpio_clk} vfd_gpio_dat=${vfd_gpio_dat} vfd_gpio_stb=${vfd_gpio_stb} vfd_chars=${vfd_chars} vfd_dot_bits=${vfd_dot_bits} vfd_display_type=${vfd_display_type}' +ExecStart=/bin/sh -c '[ `cat /proc/device-tree/le-vfd/compatible` = "le,vfd" ] && /usr/sbin/FD628Service' +RemainAfterExit=yes + +[Install] +WantedBy=basic.target + diff --git a/packages/linux-drivers/amlogic/mt7601u-aml/package.mk b/packages/linux-drivers/amlogic/mt7601u-aml/package.mk new file mode 100644 index 0000000000..35f9688934 --- /dev/null +++ b/packages/linux-drivers/amlogic/mt7601u-aml/package.mk @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mt7601u-aml" +PKG_VERSION="4e61a61" +PKG_SHA256="814a63d8654f87a76cc06425ad2120daa32646f5220341a26296e4a6643b013a" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_mtk_drivers_mt7601" +PKG_URL="https://github.com/khadas/android_hardware_wifi_mtk_drivers_mt7601/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="mt7601u Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make -C $(kernel_path) M=$PKG_BUILD \ + ARCH=$TARGET_KERNEL_ARCH \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; + + mkdir -p $INSTALL/$(get_full_firmware_dir) + cp $PKG_BUILD/RT2870STA_7601.dat $INSTALL/$(get_full_firmware_dir) +} diff --git a/packages/linux-drivers/amlogic/mt7601u-aml/patches/mt7601u-aml-001-firmware-path.patch b/packages/linux-drivers/amlogic/mt7601u-aml/patches/mt7601u-aml-001-firmware-path.patch new file mode 100644 index 0000000000..5df89a3819 --- /dev/null +++ b/packages/linux-drivers/amlogic/mt7601u-aml/patches/mt7601u-aml-001-firmware-path.patch @@ -0,0 +1,13 @@ +diff --git a/include/os/rt_linux.h b/include/os/rt_linux.h +index 0303698..36dd603 100755 +--- a/include/os/rt_linux.h ++++ b/include/os/rt_linux.h +@@ -159,7 +159,7 @@ typedef struct usb_ctrlrequest devctrlrequest; + #ifdef ALLWINNER + #define STA_PROFILE_PATH "/system/vendor/modules/RT2870STA_7601.dat" + #else +-#define STA_PROFILE_PATH "/system/etc/wifi/RT2870STA_7601.dat" ++#define STA_PROFILE_PATH "/lib/firmware/RT2870STA_7601.dat" + #endif + #define STA_DRIVER_VERSION "JEDI.L0.MP1.mt7601u.v1.2" + #define DRIVER_ROLE "STA" diff --git a/packages/linux-drivers/amlogic/mt7603u-aml/package.mk b/packages/linux-drivers/amlogic/mt7603u-aml/package.mk new file mode 100644 index 0000000000..b0751dbfa7 --- /dev/null +++ b/packages/linux-drivers/amlogic/mt7603u-aml/package.mk @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mt7603u-aml" +PKG_VERSION="0c53dfb" +PKG_SHA256="9e3eab02f3c3dd7de373c5d631c2069771e6ad783ecda36a484030ab4ec0ccec" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/khadas/android_hardware_wifi_mtk_drivers_mt7603" +PKG_URL="https://github.com/khadas/android_hardware_wifi_mtk_drivers_mt7603/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="mt7603u Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + make LINUX_SRC=$(kernel_path) \ + ARCH=$TARGET_KERNEL_ARCH \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + RT28xx_DIR=$PKG_BUILD \ + -f $PKG_BUILD/Makefile +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; + + mkdir -p $INSTALL/$(get_full_firmware_dir) + cp $PKG_BUILD/conf/MT7603USTA.dat $INSTALL/$(get_full_firmware_dir) +} diff --git a/packages/linux-drivers/amlogic/mt7603u-aml/patches/mt7603u-aml-001-firmware-path.patch b/packages/linux-drivers/amlogic/mt7603u-aml/patches/mt7603u-aml-001-firmware-path.patch new file mode 100644 index 0000000000..3cf74f011c --- /dev/null +++ b/packages/linux-drivers/amlogic/mt7603u-aml/patches/mt7603u-aml-001-firmware-path.patch @@ -0,0 +1,38 @@ +diff --git a/include/os/rt_linux.h b/include/os/rt_linux.h +index 9ddc4ea..258907a 100755 +--- a/include/os/rt_linux.h ++++ b/include/os/rt_linux.h +@@ -201,7 +201,7 @@ typedef struct usb_ctrlrequest devctrlrequest; + + #ifdef CONFIG_STA_SUPPORT + #ifdef RTMP_MAC_PCI +-#define STA_PROFILE_PATH "/system/etc/wifi/RT2870STA_7603.dat" ++#define STA_PROFILE_PATH "/lib/firmware/RT2870STA_7603.dat" + #define STA_DRIVER_VERSION "3.0.0.0" + #ifdef MULTIPLE_CARD_SUPPORT + #define CARD_INFO_PATH "/etc/Wireless/RT2860STA/RT2860STACard.dat" +@@ -210,12 +210,12 @@ typedef struct usb_ctrlrequest devctrlrequest; + + #ifdef RTMP_MAC_USB + #ifdef HE_BD_CFG80211_SUPPORT +-#define STA_PROFILE_PATH "/system/etc/wifi/RT2870STA_7603.dat" ++#define STA_PROFILE_PATH "/lib/firmware/RT2870STA_7603.dat" + #else + #ifdef USE_CHIP_DEPENDENT_PROFILE_NAME +-#define STA_PROFILE_PATH "/system/etc/wifi/RT2870STA_7603.dat" ++#define STA_PROFILE_PATH "/lib/firmware/RT2870STA_7603.dat" + #else +-#define STA_PROFILE_PATH "/system/etc/wifi/RT2870STA_7603.dat" ++#define STA_PROFILE_PATH "/lib/firmware/RT2870STA_7603.dat" + #endif /* USE_CHIP_DEPENDENT_PROFILE_NAME */ + #endif /* HE_BD_CFG80211_SUPPORT */ + #define STA_DRIVER_VERSION "JEDI.L0.MP1.mt7603u.v1.8" +@@ -227,7 +227,7 @@ typedef struct usb_ctrlrequest devctrlrequest; + + + #ifdef RTMP_MAC_SDIO +-#define STA_PROFILE_PATH "/system/etc/wifi/RT2870STA_7603.dat" ++#define STA_PROFILE_PATH "/lib/firmware/RT2870STA_7603.dat" + #define STA_DRIVER_VERSION "3.0.0.0" + #ifdef MULTIPLE_CARD_SUPPORT + #define CARD_INFO_PATH "/etc/Wireless/RT2870STA/RT2870STACard.dat" diff --git a/packages/linux-drivers/amlogic/mt7603u-aml/patches/mt7603u-aml-002-fix-building.patch b/packages/linux-drivers/amlogic/mt7603u-aml/patches/mt7603u-aml-002-fix-building.patch new file mode 100644 index 0000000000..7939d752f1 --- /dev/null +++ b/packages/linux-drivers/amlogic/mt7603u-aml/patches/mt7603u-aml-002-fix-building.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 65d0a5c..7fc16f4 100755 +--- a/Makefile ++++ b/Makefile +@@ -234,7 +234,7 @@ endif + ifeq ($(PREALLOC), YES) + #build prealloc.ko + cp -f $(RT28xx_DIR)/os/linux/Makefile.6.prealloc $(RT28xx_DIR)/os/linux/Makefile +- $(MAKE) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules ++ $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules + endif + cp -f $(RT28xx_DIR)/os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile + ifeq ($(PLATFORM),DM6446) diff --git a/packages/linux-drivers/amlogic/qca9377-aml/package.mk b/packages/linux-drivers/amlogic/qca9377-aml/package.mk new file mode 100644 index 0000000000..c1a2529e2d --- /dev/null +++ b/packages/linux-drivers/amlogic/qca9377-aml/package.mk @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="qca9377-aml" +PKG_VERSION="0cc65f9" +PKG_SHA256="336f6e95fc16874a81daf5289c656688a90c5df566ffeaea708f7ac2f5198b9e" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://boundarydevices.com/new-silex-wifi-802-11ac-bt4-1-module/" +PKG_URL="https://github.com/boundarydevices/qcacld-2.0/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="qca9377 Linux Driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +post_unpack() { + sed -i 's,-Wall,,g; s,-Werror,,g' $PKG_BUILD/Kbuild + sed -i 's,CDEFINES :=,CDEFINES := -Wno-misleading-indentation -Wno-unused-variable -Wno-unused-function,g' $PKG_BUILD/Kbuild +} + +pre_make_target() { + unset LDFLAGS + unset CFLAGS +} + +make_target() { + make KERNEL_SRC="$(kernel_path)" \ + ARCH=$TARGET_KERNEL_ARCH \ + CROSS_COMPILE=$TARGET_KERNEL_PREFIX \ + CONFIG_CLD_HL_SDIO_CORE=y +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; +} diff --git a/packages/linux-drivers/amlogic/qca9377-aml/patches/qca9377-aml-001-Modify-SDIO-and-firmware-handling-to-support-chips-u.patch b/packages/linux-drivers/amlogic/qca9377-aml/patches/qca9377-aml-001-Modify-SDIO-and-firmware-handling-to-support-chips-u.patch new file mode 100644 index 0000000000..3523e59c84 --- /dev/null +++ b/packages/linux-drivers/amlogic/qca9377-aml/patches/qca9377-aml-001-Modify-SDIO-and-firmware-handling-to-support-chips-u.patch @@ -0,0 +1,538 @@ +From 7d4ee23fb20cc5e17d8d79db20a0d6704ac3df6c Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Tue, 10 Jan 2017 22:43:12 +0100 +Subject: [PATCH] Modify SDIO and firmware handling to support chips used in + Amlogic devices + +--- + CORE/HDD/src/wlan_hdd_cfg.c | 10 +- + CORE/HDD/src/wlan_hdd_main.c | 180 ++++++++++++++++++++- + CORE/SERVICES/BMI/ol_fw.c | 8 +- + CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c | 6 - + .../sdio/linux/native_sdio/include/hif_internal.h | 2 +- + CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 62 +++---- + 6 files changed, 209 insertions(+), 59 deletions(-) + +diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c +index af7f399..5eedfcb 100644 +--- a/CORE/HDD/src/wlan_hdd_cfg.c ++++ b/CORE/HDD/src/wlan_hdd_cfg.c +@@ -60,6 +60,8 @@ + #include + #include + ++extern int qca_request_firmware(const struct firmware **firmware_p, const char *name,struct device *device); ++ + static char *mac_param; + module_param_named(mac, mac_param, charp, S_IRUGO); + MODULE_PARM_DESC(mac, "mac address override"); +@@ -4411,11 +4413,11 @@ VOS_STATUS hdd_parse_config_ini(hdd_context_t* pHddCtx) + + memset(cfgIniTable, 0, sizeof(cfgIniTable)); + +- status = request_firmware(&fw, WLAN_INI_FILE, pHddCtx->parent_dev); ++ status = qca_request_firmware(&fw, WLAN_INI_FILE, pHddCtx->parent_dev); + + if(status) + { +- hddLog(VOS_TRACE_LEVEL_FATAL, "%s: request_firmware failed %d",__func__, status); ++ hddLog(VOS_TRACE_LEVEL_FATAL, "%s: qca_request_firmware failed %d",__func__, status); + vos_status = VOS_STATUS_E_FAILURE; + goto config_exit; + } +@@ -5104,11 +5106,11 @@ VOS_STATUS hdd_update_mac_config(hdd_context_t *pHddCtx) + } + + memset(macTable, 0, sizeof(macTable)); +- status = request_firmware(&fw, WLAN_MAC_FILE, pHddCtx->parent_dev); ++ status = qca_request_firmware(&fw, WLAN_MAC_FILE, pHddCtx->parent_dev); + + if (status) + { +- hddLog(VOS_TRACE_LEVEL_WARN, "%s: request_firmware failed %d", ++ hddLog(VOS_TRACE_LEVEL_WARN, "%s: qca_request_firmware failed %d", + __func__, status); + vos_status = VOS_STATUS_E_FAILURE; + return vos_status; +diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c +index 1919627..3bcc6b0 100644 +--- a/CORE/HDD/src/wlan_hdd_main.c ++++ b/CORE/HDD/src/wlan_hdd_main.c +@@ -239,6 +239,163 @@ static VOS_STATUS hdd_parse_ese_beacon_req(tANI_U8 *pValue, + /* + * Android DRIVER command structures + */ ++//tkun add ++ typedef char A_CHAR; ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) ++ #define GET_INODE_FROM_FILEP(filp) \ ++ (filp)->f_path.dentry->d_inode ++ #else ++ #define GET_INODE_FROM_FILEP(filp) \ ++ (filp)->f_dentry->d_inode ++ #endif ++// #define A_MALLOC(size) kmalloc((size), GFP_KERNEL) ++ #define A_MALLOC_NOWAIT(size) kmalloc((size), GFP_ATOMIC) ++// #define A_FREE(addr) kfree(addr);addr=NULL; ++//#define A_MEMCPY(dst, src, len) memcpy((dst), (src), (len)) ++// #define A_MEMZERO(addr, len) memset((addr), 0, (len)) ++ #define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len)) ++ #define A_ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) ++ ++ char qcafwpath[256] = "/lib/firmware"; ++ ++ int android_readwrite_file(const A_CHAR *filename, A_CHAR *rbuf, const A_CHAR *wbuf, size_t length) ++ { ++ int ret = 0; ++ struct file *filp = (struct file *)-ENOENT; ++ mm_segment_t oldfs; ++ oldfs = get_fs(); ++ set_fs(KERNEL_DS); ++ ++ // printk("%s: filename %s \n",__func__,filename); ++ do { ++ int mode = (wbuf) ? O_RDWR : O_RDONLY; ++ filp = filp_open(filename, mode, S_IRUSR); ++ if (IS_ERR(filp) || !filp->f_op) { ++ printk("%s: file %s filp_open error\n", __FUNCTION__, filename); ++ ret = -ENOENT; ++ break; ++ } ++ ++ if (length==0) { ++ /* Read the length of the file only */ ++ struct inode *inode; ++ ++ inode = GET_INODE_FROM_FILEP(filp); ++ if (!inode) { ++ // printk("%s: Get inode from %s failed\n", __FUNCTION__, filen ame); ++ ret = -ENOENT; ++ break; ++ } ++ ret = i_size_read(inode->i_mapping->host); ++ break; ++ } ++ ++ if (wbuf) { ++ if ( (ret=filp->f_op->write(filp, wbuf, length, &filp->f_pos)) < 0) { ++// printk("%s: Write %u bytes to file %s error %d\n", __FUNCTION__, ++ // length, filename, ret); ++ break; ++ } ++ } else { ++ if ( (ret=filp->f_op->read(filp, rbuf, length, &filp->f_pos)) < 0) { ++// printk ("%s: Read %u bytes from file %s error %d\n", __FUNCTION__, ++ // length, filename, ret); ++ break; ++ } ++ } ++ } while (0); ++ ++ if (!IS_ERR(filp)) { ++ filp_close(filp, NULL); ++ } ++ set_fs(oldfs); ++ ++ return ret; ++ } ++ ++ ++ int android_request_firmware(const struct firmware **firmware_p, const char *name,struct device *device) ++ { ++ int ret = 0; ++ struct firmware *firmware; ++ char filename[256]; ++ const char *raw_filename = name; ++ *firmware_p = firmware = A_MALLOC(sizeof(*firmware)); ++ if (!firmware) ++ return -ENOMEM; ++ A_MEMZERO(firmware, sizeof(*firmware)); ++ do { ++ size_t length, bufsize, bmisize; ++ ++ if (snprintf(filename, sizeof(filename), "%s/%s", qcafwpath, ++ raw_filename) >= sizeof(filename)) { ++ printk("snprintf: %s/%s\n", qcafwpath, raw_filename); ++ ret = -1; ++ break; ++ } ++ if ( (ret=android_readwrite_file(filename, NULL, NULL, 0)) < 0) { ++ break; ++ } else { ++ length = ret; ++ } ++ ++ if (strcmp(raw_filename, "softmac") == 0) { ++ bufsize = length = 17; ++ } else { ++ bufsize = ALIGN(length, PAGE_SIZE); ++ bmisize = A_ROUND_UP(length, 4); ++ bufsize = max(bmisize, bufsize); ++ } ++ firmware->data = vmalloc(bufsize); ++ firmware->size = length; ++ ++ // printk("AR6K: %s(): raw_filename=%s, bufsize=%d\n", __FUNCTION__, ra w_filename, bufsize); ++ ++ if (!firmware->data) { ++ printk("%s: Cannot allocate buffer for firmware\n", __FUNCTION__); ++ ret = -ENOMEM; ++ break; ++ } ++ ++ if ( (ret=android_readwrite_file(filename, (char*)firmware->data, NULL, length)) != length) { ++// printk("%s: file read error, ret %d request %d\n", __FUNCTION__,ret,length); ++// ret = -1; ++ break; ++ } ++ ++ } while (0); ++ ++ if (ret<0) { ++ if (firmware) { ++ if (firmware->data) ++ vfree(firmware->data); ++ A_FREE(firmware); ++ } ++ *firmware_p = NULL; ++ } else { ++ ret = 0; ++ } ++ return ret; ++ } ++ ++ void android_release_firmware(const struct firmware *firmware) ++ { ++ if (firmware) { ++ if (firmware->data) ++ vfree(firmware->data); ++ kfree(firmware); ++ } ++ } ++extern int qca_request_firmware(const struct firmware **firmware_p,const char *name,struct device *device) ++ { ++ // int uevent = 1; ++ ++ //return _request_firmware(firmware_p, name, device, uevent, false); ++ ++ return android_request_firmware(firmware_p, name,device); ++ ++ ++ } + struct android_wifi_reassoc_params { + unsigned char bssid[18]; + int channel; +@@ -7778,7 +7935,7 @@ VOS_STATUS hdd_get_cfg_file_size(v_VOID_t *pCtx, char *pFileName, v_SIZE_t *pBuf + + ENTER(); + +- status = request_firmware(&pHddCtx->fw, pFileName, pHddCtx->parent_dev); ++ status = qca_request_firmware(&pHddCtx->fw, pFileName, pHddCtx->parent_dev); + + if(status || !pHddCtx->fw || !pHddCtx->fw->data) { + hddLog(VOS_TRACE_LEVEL_FATAL,"%s: CFG download failed",__func__); +@@ -7819,7 +7976,7 @@ VOS_STATUS hdd_read_cfg_file(v_VOID_t *pCtx, char *pFileName, + + ENTER(); + +- status = request_firmware(&pHddCtx->fw, pFileName, pHddCtx->parent_dev); ++ status = qca_request_firmware(&pHddCtx->fw, pFileName, pHddCtx->parent_dev); + + if(status || !pHddCtx->fw || !pHddCtx->fw->data) { + hddLog(VOS_TRACE_LEVEL_FATAL,"%s: CFG download failed",__func__); +@@ -12860,15 +13017,34 @@ static int hdd_driver_init( void) + \return - 0 for success, non zero for failure + + --------------------------------------------------------------------------*/ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) ++extern int wifi_setup_dt(void); ++extern void wifi_teardown_dt(void); ++#endif ++extern void extern_wifi_set_enable(int is_on); ++extern void sdio_reinit(void); ++ + #ifdef MODULE + static int __init hdd_module_init ( void) + { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) ++ wifi_setup_dt(); ++#endif ++ extern_wifi_set_enable(0); ++ mdelay(200); ++ extern_wifi_set_enable(1); ++ mdelay(200); ++sdio_reinit(); ++ + return hdd_driver_init(); + } + #else /* #ifdef MODULE */ + static int __init hdd_module_init ( void) + { + /* Driver initialization is delayed to fwpath_changed_handler */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) ++wifi_teardown_dt(); ++#endif + return 0; + } + #endif /* #ifdef MODULE */ +diff --git a/CORE/SERVICES/BMI/ol_fw.c b/CORE/SERVICES/BMI/ol_fw.c +index 66d741e..6e0e8d8 100644 +--- a/CORE/SERVICES/BMI/ol_fw.c ++++ b/CORE/SERVICES/BMI/ol_fw.c +@@ -118,7 +118,7 @@ static int ol_get_fw_files_for_target(struct ol_fw_files *pfw_files, + return 0; + } + #endif +- ++extern int qca_request_firmware(const struct firmware **firmware_p, const char *name,struct device *device); + #ifdef HIF_USB + static A_STATUS ol_usb_extra_initialization(struct ol_softc *scn); + #endif +@@ -164,7 +164,7 @@ static int ol_transfer_single_bin_file(struct ol_softc *scn, + __func__)); + } + +- if (request_firmware(&fw_entry, filename, scn->sc_osdev->device) != 0) ++ if (qca_request_firmware(&fw_entry, filename, scn->sc_osdev->device) != 0) + { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("%s: Failed to get %s\n", +@@ -492,7 +492,7 @@ static int ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file, + break; + } + +- if (request_firmware(&fw_entry, filename, scn->sc_osdev->device) != 0) ++ if (qca_request_firmware(&fw_entry, filename, scn->sc_osdev->device) != 0) + { + printk("%s: Failed to get %s\n", __func__, filename); + +@@ -506,7 +506,7 @@ static int ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file, + filename = scn->fw_files.board_data; + printk("%s: Trying to load default %s\n", + __func__, filename); +- if (request_firmware(&fw_entry, filename, ++ if (qca_request_firmware(&fw_entry, filename, + scn->sc_osdev->device) != 0) { + printk("%s: Failed to get %s\n", + __func__, filename); +diff --git a/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c b/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c +index c99020e..6bafed8 100644 +--- a/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c ++++ b/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c +@@ -234,12 +234,6 @@ ath_hif_sdio_remove(void *context, void *hif_handle) + { + ENTER(); + +- if (!sc) { +- VOS_TRACE(VOS_MODULE_ID_HIF, VOS_TRACE_LEVEL_ERROR, +- "Global SDIO context is NULL"); +- return A_ERROR; +- } +- + athdiag_procfs_remove(); + + #ifndef TARGET_DUMP_FOR_NON_QC_PLATFORM +diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/include/hif_internal.h b/CORE/SERVICES/HIF/sdio/linux/native_sdio/include/hif_internal.h +index 382e38c..234bc09 100644 +--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/include/hif_internal.h ++++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/include/hif_internal.h +@@ -112,7 +112,7 @@ struct hif_device { + A_BOOL swap_mailbox; + }; + +-#define HIF_DMA_BUFFER_SIZE (4 * 1024) ++#define HIF_DMA_BUFFER_SIZE (56 * 1024) + #define CMD53_FIXED_ADDRESS 1 + #define CMD53_INCR_ADDRESS 2 + +diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +index d45ebd9..9fb1057 100644 +--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c ++++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +@@ -64,7 +64,8 @@ + ((request->request & HIF_WRITE)&& \ + (request->address >= 0x1000 && request->address < 0x1FFFF)) + #endif +-unsigned int mmcbusmode = 0; ++//unsigned int mmcbusmode = 0; ++unsigned int mmcbusmode = 5; + module_param(mmcbusmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + MODULE_PARM_DESC(mmcbusmode, "Set MMC driver Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104"); + EXPORT_SYMBOL(mmcbusmode); +@@ -74,7 +75,9 @@ module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + MODULE_PARM_DESC(mmcbuswidth, "Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit"); + EXPORT_SYMBOL(mmcbuswidth); + +-unsigned int mmcclock = 0; ++//unsigned int mmcclock = 0; ++//unsigned int mmcclock = 166666666; ++unsigned int mmcclock = 200000000; + module_param(mmcclock, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + MODULE_PARM_DESC(mmcclock, "Set MMC driver Clock value"); + EXPORT_SYMBOL(mmcclock); +@@ -95,7 +98,7 @@ unsigned int asyncintdelay = 2; + module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + MODULE_PARM_DESC(asyncintdelay, "Delay clock count for aysnc interrupt, 2 is default, vaild values are 1 and 2"); + #else +-unsigned int asyncintdelay = 0; ++unsigned int asyncintdelay = 2; + module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + MODULE_PARM_DESC(asyncintdelay, "Delay clock count for aysnc interrupt, 0 is default, vaild values are 1 and 2"); + #endif +@@ -412,12 +415,6 @@ __HIFReadWrite(HIF_DEVICE *device, + tbuffer = device->dma_buffer; + /* copy the write data to the dma buffer */ + AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE); +- if (length > HIF_DMA_BUFFER_SIZE) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, +- ("AR6000: Invalid write length: %d\n", length)); +- status = A_EINVAL; +- break; +- } + memcpy(tbuffer, buffer, length); + bounced = TRUE; + } else { +@@ -440,12 +437,6 @@ __HIFReadWrite(HIF_DEVICE *device, + if (BUFFER_NEEDS_BOUNCE(buffer)) { + AR_DEBUG_ASSERT(device->dma_buffer != NULL); + AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE); +- if (length > HIF_DMA_BUFFER_SIZE) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, +- ("AR6000: Invalid read length: %d\n", length)); +- status = A_EINVAL; +- break; +- } + tbuffer = device->dma_buffer; + bounced = TRUE; + } else { +@@ -695,7 +686,7 @@ static int async_task(void *param) + complete_and_exit(&device->async_completion, 0); + return 0; + } +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) ++#if 1 + static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg, A_UINT32 flags, A_UINT32 *resp) + { + struct mmc_command cmd; +@@ -719,6 +710,7 @@ static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg, + return err; + } + #endif ++//extern int sdio_reset_comm(struct mmc_card *card); + A_STATUS ReinitSDIO(HIF_DEVICE *device) + { + A_INT32 err = 0; +@@ -733,10 +725,12 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) + host = card->host; + + AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +ReinitSDIO \n")); ++ ++// err = sdio_reset_comm(card); ++#if 1 + sdio_claim_host(func); + + do { +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) + /* 2.6.32 kernel does part of the SDIO initalization upon resume */ + A_BOOL lt_2_6_32 = (LINUX_VERSION_CODEocr) { +- /* Issue CMD5, arg = 0 */ +- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, 0, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); +- if (err) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); +- break; +- } +- host->ocr = resp; +- } + + /* Issue CMD5, arg = ocr. Wait till card is ready */ + for (i=0;i<100;i++) { +- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, host->ocr, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); ++ err = IssueSDCommand(device, SD_IO_SEND_OP_COND, 0, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); + if (err) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); + break; +@@ -828,7 +813,7 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) + break; + } + } +-#endif ++ + /* Enable high speed */ + if (card->host->caps & MMC_CAP_SD_HIGHSPEED) { + AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("ReinitSDIO: Set high speed mode\n")); +@@ -891,7 +876,7 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) + + sdio_release_host(func); + AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ReinitSDIO \n")); +- ++#endif + return (err) ? A_ERROR : A_OK; + } + +@@ -1320,6 +1305,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id + /* + TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Power Manage work. + */ ++#if 1 + { + A_UINT32 clock, clock_set = 12500000; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) +@@ -1578,7 +1564,7 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe + + sdio_release_host(func); + } +- ++#endif + spin_lock_init(&device->lock); + + spin_lock_init(&device->asynclock); +@@ -2070,12 +2056,10 @@ static int hifDeviceSuspend(struct device *dev) + return -1; + } + } else { +- if (wma_suspend_target(temp_module, 0)) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("PDEV Suspend Failed\n")); +- return -1; +- } ++ if (wma_suspend_target(temp_module, 0)) { ++ printk(KERN_ERR "wma_suspend_target failed.\n"); ++ } + } +- + if (pm_flag & MMC_PM_WAKE_SDIO_IRQ){ + AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("hifDeviceSuspend: wow enter\n")); + config = HIF_DEVICE_POWER_DOWN; +@@ -2295,9 +2279,7 @@ static HIF_DEVICE * + addHifDevice(struct sdio_func *func) + { + HIF_DEVICE *hifdevice = NULL; +-#if(LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && !defined(WITH_BACKPORTS) + int ret = 0; +-#endif + ENTER(); + AR_DEBUG_ASSERT(func != NULL); + hifdevice = (HIF_DEVICE *)A_MALLOC(sizeof(HIF_DEVICE)); +@@ -2310,13 +2292,9 @@ addHifDevice(struct sdio_func *func) + hifdevice->func = func; + hifdevice->powerConfig = HIF_DEVICE_POWER_UP; + hifdevice->DeviceState = HIF_DEVICE_STATE_ON; +-#if(LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && !defined(WITH_BACKPORTS) + ret = sdio_set_drvdata(func, hifdevice); ++ + EXIT("status %d", ret); +-#else +- sdio_set_drvdata(func, hifdevice); +- EXIT(); +-#endif + return hifdevice; + } + +-- +2.7.4 + diff --git a/packages/linux-drivers/amlogic/qca9377-aml/udev.d/99-qca9377-wireless.rules b/packages/linux-drivers/amlogic/qca9377-aml/udev.d/99-qca9377-wireless.rules new file mode 100644 index 0000000000..3515891f51 --- /dev/null +++ b/packages/linux-drivers/amlogic/qca9377-aml/udev.d/99-qca9377-wireless.rules @@ -0,0 +1 @@ +ACTION=="add|change", SUBSYSTEM=="net", ENV{INTERFACE}=="wlan*", ATTRS{vendor}=="0x0271", RUN+="/usr/bin/systemctl restart connman.service" diff --git a/packages/linux-drivers/amlogic/ssv6xxx-aml/package.mk b/packages/linux-drivers/amlogic/ssv6xxx-aml/package.mk new file mode 100644 index 0000000000..cca103e54b --- /dev/null +++ b/packages/linux-drivers/amlogic/ssv6xxx-aml/package.mk @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="ssv6xxx-aml" +PKG_VERSION="1041e7d" +PKG_SHA256="1d96db8eec06c8a2c43f2c8024cc573e2bbce08fb0504fd9b6671224335e7d5f" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="http://libreelec.tv" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="ssv6xxx Linux driver" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +pre_configure_target() { + sed -i 's,hw_cap_p2p = on,hw_cap_p2p = off,g' firmware/ssv6051-wifi.cfg +} + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + if [ "$TARGET_KERNEL_ARCH" = "arm64" ]; then + PLATFORM="aml-s905" + else + PLATFORM="aml-s805" + fi + + cd $PKG_BUILD + ./ver_info.pl include/ssv_version.h + cp Makefile.android Makefile + sed -i 's,PLATFORMS =,PLATFORMS = '"$PLATFORM"',g' Makefile + make module SSV_ARCH="$TARGET_KERNEL_ARCH" \ + SSV_CROSS="$TARGET_KERNEL_PREFIX" \ + SSV_KERNEL_PATH="$(kernel_path)" +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + find $PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/$(get_full_module_dir)/$PKG_NAME \; + + mkdir -p $INSTALL/$(get_full_firmware_dir)/ssv6051 + cp $PKG_BUILD/firmware/* $INSTALL/$(get_full_firmware_dir)/ssv6051 +} diff --git a/packages/linux-drivers/amlogic/ssv6xxx-aml/patches/ssv6xxx-aml-001-fix-build-and-firmware-path.patch b/packages/linux-drivers/amlogic/ssv6xxx-aml/patches/ssv6xxx-aml-001-fix-build-and-firmware-path.patch new file mode 100644 index 0000000000..c0f46fa1ce --- /dev/null +++ b/packages/linux-drivers/amlogic/ssv6xxx-aml/patches/ssv6xxx-aml-001-fix-build-and-firmware-path.patch @@ -0,0 +1,86 @@ +diff --git a/Makefile.android b/Makefile.android +index 82211e1..0deeee5 100755 +--- a/Makefile.android ++++ b/Makefile.android +@@ -2,10 +2,8 @@ PLATFORMS = + + KBUILD_TOP := $(PWD) + +-SSV_PATH=$(ANDROID_BUILD_TOP)/hardware/wifi/icomm/ssv6xxx/ssv6051/ +- +-include $(SSV_PATH)/ssv6051.cfg +-include $(SSV_PATH)/platform-config.mak ++include ${KBUILD_TOP}/ssv6051.cfg ++include ${KBUILD_TOP}/platform-config.mak + + PWD := $(shell pwd) + +@@ -69,7 +67,7 @@ obj-$(CONFIG_SSV6200_CORE) += $(KMODULE_NAME).o + all:module strip + + module: +- make -C $(SSV_KERNEL_PATH) ARCH=$(SSV_ARCH) CROSS_COMPILE=$(SSV_CROSS) \ ++ $(MAKE) -C $(SSV_KERNEL_PATH) ARCH=$(SSV_ARCH) CROSS_COMPILE=$(SSV_CROSS) \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" M=$(PWD) modules + + install: +@@ -92,6 +90,6 @@ ifneq ($(SSV_STRIP),) + endif + + clean: +- make -C $(SSV_KERNEL_PATH) ARCH=$(SSV_ARCH) CROSS_COMPILE=$(SSV_CROSS) \ ++ $(MAKE) -C $(SSV_KERNEL_PATH) ARCH=$(SSV_ARCH) CROSS_COMPILE=$(SSV_CROSS) \ + M=$(PWD) clean + rm $(DEF_PARSER_H) +diff --git a/firmware/ssv6051-wifi.cfg b/firmware/ssv6051-wifi.cfg +index 6c3a823..9c623a0 100755 +--- a/firmware/ssv6051-wifi.cfg ++++ b/firmware/ssv6051-wifi.cfg +@@ -11,7 +11,7 @@ + # Priority.3 default firmware + ################################################## + +-firmware_path = /system/etc/wifi/ssv6051/ ++firmware_path = /usr/lib/firmware/ssv6051/ + + ############################################################ + # MAC address + +diff --git a/platform-config.mak b/platform-config.mak +index bf35b70..f02e2b5 100755 +--- a/platform-config.mak ++++ b/platform-config.mak +@@ -5,7 +5,7 @@ CONFIG_SSV6200_CORE=m + ########################################################################### + # Compiler options # + ########################################################################### +-ccflags-y += -Werror ++# ccflags-y += -Werror + + # Enable -g to help debug. Deassembly from .o to .S would help to track to + # the problomatic line from call stack dump. +diff --git a/ssv6051.cfg b/ssv6051.cfg +index 7cf12c2..a6960fa 100755 +--- a/ssv6051.cfg ++++ b/ssv6051.cfg +@@ -16,6 +16,6 @@ ccflags-y += -DCONFIG_SSV_RSSI + #SSV_CROSS = $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android- + #SSV_KERNEL_PATH = $(ANDROID_BUILD_TOP)/out/target/product/p201/obj/KERNEL_OBJ/ + +-SSV_ARCH = arm64 ++#SSV_ARCH = arm64 + #KMODDESTDIR = $(MODDESTDIR) + +diff --git a/ssvdevice/ssvdevice.c b/ssvdevice/ssvdevice.c +index ff4305e..375827f 100755 +--- a/ssvdevice/ssvdevice.c ++++ b/ssvdevice/ssvdevice.c +@@ -35,7 +35,7 @@ + MODULE_AUTHOR("iComm Semiconductor Co., Ltd"); + MODULE_DESCRIPTION("Shared library for SSV wireless LAN cards."); + MODULE_LICENSE("Dual BSD/GPL"); +-static char *stacfgpath = NULL; ++static char *stacfgpath = "/usr/lib/firmware/ssv6051/ssv6051-wifi.cfg"; + EXPORT_SYMBOL(stacfgpath); + module_param(stacfgpath, charp, 0000); + MODULE_PARM_DESC(stacfgpath, "Get path of sta cfg"); diff --git a/packages/linux-drivers/bcm_sta/package.mk b/packages/linux-drivers/bcm_sta/package.mk index 7ae9a67302..0eca39128a 100644 --- a/packages/linux-drivers/bcm_sta/package.mk +++ b/packages/linux-drivers/bcm_sta/package.mk @@ -1,46 +1,29 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) # Downloadlocation: # http://www.broadcom.com/support/802.11/linux_sta.php PKG_NAME="bcm_sta" PKG_VERSION="6.30.223.271" -PKG_REV="1" +PKG_SHA256="959bcd1e965d294304a4e290cb8e47b7c74b9763094eff4d0b8e6cfb68a6895b" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="bcm_sta: Broadcom's BCM4311-, BCM4312-, BCM4313-, BCM4321-, BCM4322-, BCM43224-, and BCM43225-based WLAN driver" -PKG_LONGDESC="These packages contain Broadcom's IEEE 802.11a/b/g/n hybrid Linux® device driver for use with Broadcom's BCM4311-, BCM4312-, BCM4313-, BCM4321-, BCM4322-, BCM43224-, and BCM43225-based hardware. There are different tars for 32-bit and 64-bit x86 CPU architectures. Make sure that you download the appropriate tar because the hybrid binary file must be of the appropriate architecture type. The hybrid binary file is agnostic to the specific version of the Linux kernel because it is designed to perform all interactions with the operating system through operating-system-specific files and an operating system abstraction layer file. All Linux operating-system-specific code is provided in source form, making it possible to retarget to different kernel versions and fix operating system related issues." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Broadcom's BCM4311-, BCM4312-, BCM4313-, BCM4321-, BCM4322-, BCM43224-, and BCM43225-based WLAN driver." +PKG_TOOLCHAIN="manual" +PKG_IS_KERNEL_PKG="yes" make_target() { cd x86-64 - KBUILD_NOPEDANTIC=1 make V=1 CC=$CC -C $(kernel_path) M=`pwd` BINARCH=$TARGET_KERNEL_ARCH + KBUILD_NOPEDANTIC=1 kernel_make V=1 CC=$CC -C $(kernel_path) M=`pwd` BINARCH=$TARGET_KERNEL_ARCH } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/bcm_sta - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME + mkdir -p $INSTALL/$(get_full_module_dir)/bcm_sta + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME } diff --git a/packages/linux-drivers/bcm_sta/patches/bcm_sta-0008-kernel-4.11.patch b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0008-kernel-4.11.patch new file mode 100644 index 0000000000..56fb51a95a --- /dev/null +++ b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0008-kernel-4.11.patch @@ -0,0 +1,68 @@ +From 7e8dddb7a545bc5ba74336ef2aafed1c0b4ceee1 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Mon, 13 Mar 2017 20:48:44 +0000 +Subject: [PATCH 1/2] bcm_sta: Fix build for API changes in kernel 4.11 + +--- + x86-64/src/wl/sys/wl_cfg80211_hybrid.c | 4 ++++ + x86-64/src/wl/sys/wl_linux.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c +index 7b606e0..76ef208 100644 +--- a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c +@@ -26,6 +26,10 @@ + #include + #include + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#include ++#endif ++ + #include + #include + #include +diff --git a/x86-64/src/wl/sys/wl_linux.c b/x86-64/src/wl/sys/wl_linux.c +index 0d05100..dca7c71 100644 +--- a/x86-64/src/wl/sys/wl_linux.c ++++ b/x86-64/src/wl/sys/wl_linux.c +@@ -26,6 +26,10 @@ + #include + #include + #include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#include ++#endif ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) + #include + #endif +-- +2.7.4 + + +From 1d066a57a682af0ac42b8d1c65bf7bd1984a54ca Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Mon, 13 Mar 2017 20:49:01 +0000 +Subject: [PATCH 2/2] bcm_sta: Remove usage of net_device last_rx member + +--- + x86-64/src/wl/sys/wl_linux.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/x86-64/src/wl/sys/wl_linux.c b/x86-64/src/wl/sys/wl_linux.c +index dca7c71..f3be019 100644 +--- a/x86-64/src/wl/sys/wl_linux.c ++++ b/x86-64/src/wl/sys/wl_linux.c +@@ -2919,7 +2919,6 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p) + if (skb == NULL) return; + + skb->dev = wl->monitor_dev; +- skb->dev->last_rx = jiffies; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) + skb_reset_mac_header(skb); + #else +-- +2.7.4 + diff --git a/packages/linux-drivers/bcm_sta/patches/bcm_sta-0009-kernel-4.12.patch b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0009-kernel-4.12.patch new file mode 100644 index 0000000000..65e691c5db --- /dev/null +++ b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0009-kernel-4.12.patch @@ -0,0 +1,75 @@ +From 268500240a551436c5003f5843ff4d090bf3e202 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 18 May 2017 12:52:55 +0100 +Subject: [PATCH] Fix build with kernel 4.12-rc1 + +--- + x86-64/src/wl/sys/wl_cfg80211_hybrid.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c +index 7b606e0..cedf95c 100644 +--- a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c +@@ -49,8 +49,13 @@ u32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO; + u32 wl_dbg_level = WL_DBG_ERR; + #endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ++ enum nl80211_iftype type, struct vif_params *params); ++#else + static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, + enum nl80211_iftype type, u32 *flags, struct vif_params *params); ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + static s32 + wl_cfg80211_scan(struct wiphy *wiphy, +@@ -461,10 +466,16 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) + return err; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++static s32 ++wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ++ enum nl80211_iftype type, struct vif_params *params) ++#else + static s32 + wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params) ++#endif + { + struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy); + struct wireless_dev *wdev; +@@ -2364,6 +2375,19 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN); + memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); + wl_update_bss_info(wl); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ { ++ struct cfg80211_roam_info roam_info = { ++ .channel = &wl->conf->channel, ++ .bssid = (u8 *)&wl->bssid, ++ .req_ie = conn_info->req_ie, ++ .req_ie_len = conn_info->req_ie_len, ++ .resp_ie = conn_info->resp_ie, ++ .resp_ie_len = conn_info->resp_ie_len, ++ }; ++ cfg80211_roamed(ndev, &roam_info, GFP_KERNEL); ++ } ++#else + cfg80211_roamed(ndev, + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) + &wl->conf->channel, +@@ -2371,6 +2395,7 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + (u8 *)&wl->bssid, + conn_info->req_ie, conn_info->req_ie_len, + conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); ++#endif + WL_DBG(("Report roaming result\n")); + + set_bit(WL_STATUS_CONNECTED, &wl->status); +-- +2.7.4 + diff --git a/packages/linux-drivers/bcm_sta/patches/bcm_sta-0010-kernel-4.15.patch b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0010-kernel-4.15.patch new file mode 100644 index 0000000000..d44ceb0f82 --- /dev/null +++ b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0010-kernel-4.15.patch @@ -0,0 +1,61 @@ +From a893fac9b9e883f39a545e8ce87926cecc26ba12 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Sun, 10 Jun 2018 19:13:17 +0100 +Subject: [PATCH] add 4.15.y support + +Credit: https://github.com/UnitedRPMs/broadcom-wl-dkms/blob/5147b5f1867273e2762f777fd724b6523c3ab8dd/008-linux415.patch +--- + x86-64/src/wl/sys/wl_linux.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/x86-64/src/wl/sys/wl_linux.c b/x86-64/src/wl/sys/wl_linux.c +index f7149da..89a3831 100644 +--- a/x86-64/src/wl/sys/wl_linux.c ++++ b/x86-64/src/wl/sys/wl_linux.c +@@ -97,7 +97,11 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev); + + #include + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++static void wl_timer(struct timer_list *tl); ++#else + static void wl_timer(ulong data); ++#endif + static void _wl_timer(wl_timer_t *t); + static struct net_device *wl_alloc_linux_if(wl_if_t *wlif); + +@@ -2296,10 +2300,17 @@ wl_timer_task(wl_task_t *task) + atomic_dec(&t->wl->callbacks); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++static void ++wl_timer(struct timer_list *tl) ++{ ++ wl_timer_t *t = (wl_timer_t *)tl; ++#else + static void + wl_timer(ulong data) + { + wl_timer_t *t = (wl_timer_t *)data; ++#endif + + if (!WL_ALL_PASSIVE_ENAB(t->wl)) + _wl_timer(t); +@@ -2351,9 +2362,13 @@ wl_init_timer(wl_info_t *wl, void (*fn)(void *arg), void *arg, const char *tname + + bzero(t, sizeof(wl_timer_t)); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&t->timer, wl_timer, 0); ++#else + init_timer(&t->timer); + t->timer.data = (ulong) t; + t->timer.function = wl_timer; ++#endif + t->wl = wl; + t->fn = fn; + t->arg = arg; +-- +2.14.1 + diff --git a/packages/linux-drivers/bcm_sta/patches/bcm_sta-0011-fix-kernel-warnings.patch b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0011-fix-kernel-warnings.patch new file mode 100644 index 0000000000..2daca4200e --- /dev/null +++ b/packages/linux-drivers/bcm_sta/patches/bcm_sta-0011-fix-kernel-warnings.patch @@ -0,0 +1,177 @@ +From 6bc816ae3ef424bc52b2736aeb1eb08ab09f38a9 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Sun, 10 Jun 2018 19:32:39 +0100 +Subject: [PATCH] fix kernel warnings + +Credit: https://github.com/UnitedRPMs/broadcom-wl-dkms/blob/master/wl-kmod-008_fix_kernel_warnings.patch +--- + x86-64/src/wl/sys/wl_cfg80211_hybrid.c | 88 +++++++++++++++++++++++----------- + 1 file changed, 60 insertions(+), 28 deletions(-) + +diff --git a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c +index 2e8625d..4da9b38 100644 +--- a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c ++++ b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c +@@ -1983,7 +1983,7 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info + + if (dtoh32(bi->length) > WL_BSS_INFO_MAX) { + WL_DBG(("Beacon is larger than buffer. Discarding\n")); +- return err; ++ return -E2BIG; + } + notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(u8) + + WL_BSS_INFO_MAX, GFP_KERNEL); +@@ -2007,9 +2007,15 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info + beacon_proberesp->capab_info = cpu_to_le16(bi->capability); + wl_rst_ie(wl); + +- wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length); +- wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX - +- offsetof(struct wl_cfg80211_bss_info, frame_buf)); ++ err = wl_mrg_ie(wl, ((u8 *) bi) + bi->ie_offset, bi->ie_length); ++ if (err) ++ goto inform_single_bss_out; ++ ++ err = wl_cp_ie(wl, beacon_proberesp->variable, WL_BSS_INFO_MAX - ++ offsetof(struct wl_cfg80211_bss_info, frame_buf)); ++ if (err) ++ goto inform_single_bss_out; ++ + notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) + + wl_get_ielen(wl); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) +@@ -2021,14 +2027,14 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info + #endif + if (freq == 0) { + WL_ERR(("Invalid channel, fail to chcnage channel to freq\n")); +- kfree(notif_bss_info); +- return -EINVAL; ++ err = -EINVAL; ++ goto inform_single_bss_out; + } + channel = ieee80211_get_channel(wiphy, freq); + if (unlikely(!channel)) { + WL_ERR(("ieee80211_get_channel error\n")); +- kfree(notif_bss_info); +- return -EINVAL; ++ err = -EINVAL; ++ goto inform_single_bss_out; + } + + WL_DBG(("SSID : \"%s\", rssi %d, channel %d, capability : 0x04%x, bssid %pM\n", +@@ -2036,28 +2042,35 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info + mgmt->u.beacon.capab_info, &bi->BSSID)); + + signal = notif_bss_info->rssi * 100; +- cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt, +- le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL); +- if (unlikely(!cbss)) { +- WL_ERR(("cfg80211_inform_bss_frame error\n")); +- kfree(notif_bss_info); +- return -EINVAL; ++ if (!wl->scan_request) { ++ cbss = cfg80211_inform_bss_frame(wiphy, channel, mgmt, ++ le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL); ++ if (unlikely(!cbss)) { ++ WL_ERR(("cfg80211_inform_bss_frame error\n")); ++ err = -ENOMEM; ++ goto inform_single_bss_out; ++ } + } +- +- notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); +- notify_ielen = le32_to_cpu(bi->ie_length); ++ else { ++ notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); ++ notify_ielen = le32_to_cpu(bi->ie_length); + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) +- cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet), +- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, +- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); ++ cbss = cfg80211_inform_bss(wiphy, channel, (const u8 *)(bi->BSSID.octet), ++ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, ++ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); + #else +- cbss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, (const u8 *)(bi->BSSID.octet), +- 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, +- (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); ++ cbss = cfg80211_inform_bss(wiphy, channel, ++ wl->active_scan ? CFG80211_BSS_FTYPE_PRESP : CFG80211_BSS_FTYPE_BEACON, ++ (const u8 *)(bi->BSSID.octet), ++ 0, beacon_proberesp->capab_info, beacon_proberesp->beacon_int, ++ (const u8 *)notify_ie, notify_ielen, signal, GFP_KERNEL); + #endif +- +- if (unlikely(!cbss)) +- return -ENOMEM; ++ if (unlikely(!cbss)) { ++ WL_ERR(("cfg80211_inform_bss error\n")); ++ err = -ENOMEM; ++ goto inform_single_bss_out; ++ } ++ } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(wiphy, cbss); +@@ -2065,6 +2078,7 @@ static s32 wl_inform_single_bss(struct wl_cfg80211_priv *wl, struct wl_bss_info + cfg80211_put_bss(cbss); + #endif + ++inform_single_bss_out: + kfree(notif_bss_info); + + return err; +@@ -2331,6 +2345,9 @@ static s32 wl_update_bss_info(struct wl_cfg80211_priv *wl) + if (err) + goto update_bss_info_out; + ++ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid, ++ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); ++ + ie = ((u8 *)bi) + bi->ie_offset; + ie_len = bi->ie_length; + } else { +@@ -2343,12 +2360,20 @@ static s32 wl_update_bss_info(struct wl_cfg80211_priv *wl) + ie_len = bss->len_information_elements; + #endif + wl->conf->channel = *bss->channel; ++ } ++ ++ if (bss) { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + cfg80211_put_bss(wiphy, bss); + #else + cfg80211_put_bss(bss); + #endif + } ++ else { ++ WL_DBG(("Could not update BSS\n")); ++ err = -EINVAL; ++ goto update_bss_info_out; ++ } + + tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM); + if (tim) { +@@ -2375,10 +2400,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev, + struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl); + s32 err = 0; + +- wl_get_assoc_ies(wl); ++ err = wl_get_assoc_ies(wl); ++ if (err) ++ return err; ++ + memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN); + memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); +- wl_update_bss_info(wl); ++ ++ err = wl_update_bss_info(wl); ++ if (err) ++ return err; ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + { + struct cfg80211_roam_info roam_info = { +-- +2.14.1 + diff --git a/packages/linux-drivers/brcmap6xxx-aml/config/config.txt b/packages/linux-drivers/brcmap6xxx-aml/config/config.txt index e9c4460696..2722085821 100644 --- a/packages/linux-drivers/brcmap6xxx-aml/config/config.txt +++ b/packages/linux-drivers/brcmap6xxx-aml/config/config.txt @@ -3,6 +3,7 @@ ccode=CN regrev=38 mimo_bw_cap=1 PM=0 -nv_by_chip=2 \ +nv_by_chip=3 \ +17221 6 nvram_ap6255.txt \ 17200 4 nvram_ap6330.txt \ 17209 1 nvram_ap6335.txt diff --git a/packages/linux-drivers/brcmap6xxx-aml/package.mk b/packages/linux-drivers/brcmap6xxx-aml/package.mk index f3e2d6a94f..8562904679 100644 --- a/packages/linux-drivers/brcmap6xxx-aml/package.mk +++ b/packages/linux-drivers/brcmap6xxx-aml/package.mk @@ -1,49 +1,31 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="brcmap6xxx-aml" -PKG_REV="1" PKG_ARCH="arm aarch64" PKG_LICENSE="GPL" PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/wifi/" -PKG_VERSION="1.201.59.5-b82e63f" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_VERSION="de3f5c5" +PKG_SHA256="5d109f630aa8c92b6c4ab8622d405dcbc2a7c4f07f1e5a8834358be230d2c35b" +PKG_URL="https://github.com/openwetek/brcmap6xxx-aml/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain linux wlan-firmware-aml" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="brcmap6xxx-aml: Linux drivers for AP6xxx WLAN chips used in some devices based on Amlogic SoCs" PKG_LONGDESC="brcmap6xxx-aml: Linux drivers for AP6xxx WLAN chips used in some devices based on Amlogic SoCs" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" +PKG_IS_KERNEL_PKG="yes" make_target() { cd bcmdhd_1_201_59_x LDFLAGS="" make V=1 \ - -C $(kernel_path) M=$ROOT/$PKG_BUILD/bcmdhd_1_201_59_x \ + -C $(kernel_path) M=$PKG_BUILD/bcmdhd_1_201_59_x \ ARCH=$TARGET_KERNEL_ARCH \ - CROSS_COMPILE=$TARGET_PREFIX + CROSS_COMPILE=$TARGET_KERNEL_PREFIX } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/bcmdhd - cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/bcmdhd + mkdir -p $INSTALL/$(get_full_module_dir)/bcmdhd + cp *.ko $INSTALL/$(get_full_module_dir)/bcmdhd - mkdir -p $INSTALL/usr/lib/firmware/brcm - cp $PKG_DIR/config/config.txt $INSTALL/usr/lib/firmware/brcm + mkdir -p $INSTALL/$(get_full_firmware_dir)/brcm + cp $PKG_DIR/config/config.txt $INSTALL/$(get_full_firmware_dir)/brcm } diff --git a/packages/linux-drivers/dvbhdhomerun/package.mk b/packages/linux-drivers/dvbhdhomerun/package.mk index 2ea7e6ca05..948c48e140 100644 --- a/packages/linux-drivers/dvbhdhomerun/package.mk +++ b/packages/linux-drivers/dvbhdhomerun/package.mk @@ -1,64 +1,45 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dvbhdhomerun" PKG_VERSION="20130704" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="1af817b85b163f3c6c3a9a07410f54875e74513c197709638b4922165e894f54" PKG_LICENSE="GPL" PKG_SITE="http://sourceforge.net/projects/dvbhdhomerun/" PKG_URL="${DISTRO_SRC}/${PKG_NAME}-${PKG_VERSION}.tar.xz" #PKG_URL="$SOURCEFORGE_SRC/project/dvbhdhomerun/${PKG_NAME}_${PKG_VERSION}.tar.gz" -#PKG_SOURCE_DIR="${PKG_NAME}_${PKG_VERSION}" -PKG_DEPENDS_TARGET="toolchain linux libhdhomerun" +#PKG_DEPENDS_TARGET="toolchain linux libhdhomerun" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver/dvb" -PKG_SHORTDESC="A linux DVB driver for the HDHomeRun TV tuner (http://www.silicondust.com)." PKG_LONGDESC="A linux DVB driver for the HDHomeRun TV tuner (http://www.silicondust.com)." +PKG_IS_KERNEL_PKG="yes" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CMAKE_SCRIPT="userhdhomerun/CMakeLists.txt" - -pre_make_target() { - ( cd ../kernel - LDFLAGS="" make dvb_hdhomerun KERNEL_DIR=$(kernel_path) - fix_module_depends dvb_hdhomerun_core.ko "dvb_core" - ) +configure_package() { + PKG_CMAKE_SCRIPT="${PKG_BUILD}/userhdhomerun/CMakeLists.txt" } pre_configure_target() { + # use it here to be sure libhdhomerun is already built + PKG_CMAKE_OPTS_TARGET="-DLIBHDHOMERUN_PATH=$(ls -d $BUILD/libhdhomerun-*/)" -# use it here to be sure libhdhomerun is already built - PKG_CMAKE_OPTS_TARGET="-DLIBHDHOMERUN_PATH=$(ls -d $ROOT/$BUILD/libhdhomerun-*/)" - -# absolute path - LIBHDHOMERUN_PATH=$(ls -d $ROOT/$BUILD/libhdhomerun-*/) + # absolute path + LIBHDHOMERUN_PATH=$(ls -d $BUILD/libhdhomerun-*/) sed -i "s|SET(LIBHDHOMERUN_PATH .*)|SET(LIBHDHOMERUN_PATH $LIBHDHOMERUN_PATH)|g" ../userhdhomerun/CMakeLists.txt sed -i "s|/etc/dvbhdhomerun|/tmp/dvbhdhomerun|g" ../userhdhomerun/hdhomerun_tuner.cpp sed -i "s|/etc/dvbhdhomerun|/tmp/dvbhdhomerun|g" ../userhdhomerun/hdhomerun_controller.cpp } +pre_make_target() { + ( cd ../kernel + LDFLAGS="" make dvb_hdhomerun KERNEL_DIR=$(kernel_path) + fix_module_depends dvb_hdhomerun_core.ko "dvb_core" + ) +} + makeinstall_target() { - cd $ROOT/$PKG_BUILD - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/hdhomerun - cp kernel/*.ko $INSTALL/usr/lib/modules/$(get_module_dir)/hdhomerun/ + cd $PKG_BUILD + mkdir -p $INSTALL/$(get_full_module_dir)/hdhomerun + cp kernel/*.ko $INSTALL/$(get_full_module_dir)/hdhomerun/ mkdir -p $INSTALL/usr/bin cp -PR .$TARGET_NAME/userhdhomerun $INSTALL/usr/bin diff --git a/packages/linux-drivers/gpu-aml/modules-load.d/mali.conf b/packages/linux-drivers/gpu-aml/modules-load.d/mali.conf deleted file mode 100644 index 29c66fc8c8..0000000000 --- a/packages/linux-drivers/gpu-aml/modules-load.d/mali.conf +++ /dev/null @@ -1 +0,0 @@ -mali diff --git a/packages/linux-drivers/gpu-aml/package.mk b/packages/linux-drivers/gpu-aml/package.mk index 44d88e7d27..3be9b6685c 100644 --- a/packages/linux-drivers/gpu-aml/package.mk +++ b/packages/linux-drivers/gpu-aml/package.mk @@ -1,46 +1,55 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="gpu-aml" -PKG_REV="1" PKG_ARCH="arm aarch64" PKG_LICENSE="GPL" PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/gpu/" -# r5p1 -PKG_VERSION="9b0fbbc" -PKG_URL="https://github.com/openwetek/gpu-aml/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="gpu-aml-$PKG_VERSION*" +PKG_VERSION="fe7a4d8" +PKG_SHA256="518f855a2b191e50d09c2d0b3e671b5ed4b5e4db06aa3a718e29ef30cc0d9a57" +PKG_URL="https://github.com/khadas/android_hardware_arm_gpu/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="gpu-aml: Linux drivers for Mali GPUs found in Amlogic Meson SoCs" PKG_LONGDESC="gpu-aml: Linux drivers for Mali GPUs found in Amlogic Meson SoCs" +PKG_TOOLCHAIN="manual" +PKG_IS_KERNEL_PKG="yes" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +configure_package() { + PKG_UTGARD_VERSION="r5p1" + PKG_UTGARD_BUILD_DIR="$PKG_BUILD/utgard/$PKG_UTGARD_VERSION" + PKG_MIDGARD_VERSION="r16p0" + PKG_MIDGARD_BUILD_DIR="$PKG_BUILD/midgard/$PKG_MIDGARD_VERSION/kernel/drivers/gpu/arm/midgard" +} + +pre_configure_target() { + sed -e "s|shell date|shell date -R|g" -i $PKG_BUILD/utgard/*/Kbuild + sed -e "s|USING_GPU_UTILIZATION=1|USING_GPU_UTILIZATION=0|g" -i $PKG_BUILD/utgard/platform/Kbuild.amlogic +} + +pre_make_target() { + ln -s $PKG_BUILD/utgard/platform $PKG_UTGARD_BUILD_DIR/platform +} make_target() { - LDFLAGS="" make -C $(kernel_path) M=$ROOT/$PKG_BUILD/mali \ - CONFIG_MALI400=m CONFIG_MALI450=m + if [ "$MESON_FAMILY" = "gxm" ] ; then + kernel_make -C $(kernel_path) M=$PKG_MIDGARD_BUILD_DIR \ + EXTRA_CFLAGS="-DCONFIG_MALI_PLATFORM_DEVICETREE -DCONFIG_MALI_BACKEND=gpu" \ + CONFIG_MALI_MIDGARD=m CONFIG_MALI_PLATFORM_DEVICETREE=y CONFIG_MALI_BACKEND=gpu modules + else + kernel_make -C $(kernel_path) M=$PKG_UTGARD_BUILD_DIR \ + EXTRA_CFLAGS="-DCONFIG_MALI450=y" \ + CONFIG_MALI400=m CONFIG_MALI450=y + fi } makeinstall_target() { - LDFLAGS="" make -C $(kernel_path) M=$ROOT/$PKG_BUILD/mali \ - INSTALL_MOD_PATH=$INSTALL/usr INSTALL_MOD_STRIP=1 DEPMOD=: \ - modules_install + if [ "$MESON_FAMILY" = "gxm" ] ; then + kernel_make -C $(kernel_path) M=$PKG_MIDGARD_BUILD_DIR \ + INSTALL_MOD_PATH=$INSTALL/$(get_kernel_overlay_dir) INSTALL_MOD_STRIP=1 DEPMOD=: \ + modules_install + else + kernel_make -C $(kernel_path) M=$PKG_UTGARD_BUILD_DIR \ + INSTALL_MOD_PATH=$INSTALL/$(get_kernel_overlay_dir) INSTALL_MOD_STRIP=1 DEPMOD=: \ + modules_install + fi } diff --git a/packages/linux-drivers/intel_nuc_led/package.mk b/packages/linux-drivers/intel_nuc_led/package.mk new file mode 100644 index 0000000000..939d7b158b --- /dev/null +++ b/packages/linux-drivers/intel_nuc_led/package.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="intel_nuc_led" +PKG_VERSION="637c07a" +PKG_SHA256="b6c3c6f8a1a306f853f521bd0b6ab3cc876cd10ae8f6d152a72056e93e2866d4" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/milesp20/intel_nuc_led/" +PKG_URL="https://github.com/milesp20/intel_nuc_led/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="Intel NUC7i[x]BN and NUC6CAY LED Control for Linux" +PKG_IS_KERNEL_PKG="yes" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + kernel_make KDIR=$(kernel_path) +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME +} diff --git a/packages/linux-drivers/media_build/package.mk b/packages/linux-drivers/media_build/package.mk deleted file mode 100644 index 4a7eccb88d..0000000000 --- a/packages/linux-drivers/media_build/package.mk +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="media_build" -PKG_VERSION="2016-12-28" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/crazycat69/linux_media" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain linux" -PKG_BUILD_DEPENDS_TARGET="toolchain linux" -PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="DVB drivers that replace the version shipped with the kernel" -PKG_LONGDESC="DVB drivers that replace the version shipped with the kernel" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_make_target() { - export KERNEL_VER=$(get_module_dir) - export LDFLAGS="" -} - -make_target() { - cd media_build - make dir DIR=../media - make VER=$KERNEL_VER SRCDIR=$(kernel_path) allyesconfig - make VER=$KERNEL_VER SRCDIR=$(kernel_path) -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$KERNEL_VER/updates - find $ROOT/$PKG_BUILD/media_build/v4l/ -name \*.ko -exec cp {} $INSTALL/usr/lib/modules/$KERNEL_VER/updates \; -} diff --git a/packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch b/packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch deleted file mode 100644 index fbe5f6f064..0000000000 --- a/packages/linux-drivers/media_build/patches/media_build-01-remove-rmmod.pl.patch +++ /dev/null @@ -1,13 +0,0 @@ -[Patch] without this patch you need to install libproc-processtable-perl at host system - ---- a/media_build/v4l/Makefile -+++ b/media_build/v4l/Makefile -@@ -51,7 +51,7 @@ - @echo Kernel build directory is $(OUTDIR) - $(MAKE) -C ../linux apply_patches - $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules -- ./scripts/rmmod.pl check -+# ./scripts/rmmod.pl check - # $(MAKE) checkpatch - - mismatch:: prepare firmware diff --git a/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch b/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch deleted file mode 100644 index 5321820b79..0000000000 --- a/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/media_build/backports/backports.txt -+++ b/media_build/backports/backports.txt -@@ -25,6 +25,9 @@ - add pr_fmt.patch - add debug.patch - add drx39xxj.patch -+add linux-202-lnbp22_patch_for_more_power_if_rotor.patch -+add linux-203-stb0899_enable_low_symbol_rate.patch -+add linux-222-stb0899_signal_quality.patch - - [4.8.255] - add v4.8_user_pages_flag.patch diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch deleted file mode 100755 index f4d48b9739..0000000000 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch +++ /dev/null @@ -1,165 +0,0 @@ -This patch is from the original driver author and allows minimal power on time, -so that capacitors of secondary equipment like dish motors can be properly loaded and equipment properly initialized -see https://www.spinics.net/lists/linux-media/msg38226.html -and https://github.com/LibreELEC/LibreELEC.tv/pull/1118 - -tested with TT S2-3650CI and a HH90 rotor - - ---- a/drivers/media/dvb-frontends/lnbp22.c -+++ b/drivers/media/dvb-frontends/lnbp22.c -@@ -48,47 +48,95 @@ struct lnbp22 { - struct i2c_adapter *i2c; - }; - -+static int lnbp22_read_config(struct dvb_frontend *fe, u8 *config) { -+ struct lnbp22 *lnbp22 = (struct lnbp22 *) fe->sec_priv; -+ struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, -+ .buf = (char*)config, -+ .len = sizeof(lnbp22->config) }; -+ -+ if (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) { -+ dprintk(2, "%s: %02X %02X %02X %02X\n", __FUNCTION__, -+ config[0], config[1], config[2], config[3]); -+ return 0; -+ } -+ return -EIO; -+} -+ -+static int lnbp22_write_config(struct dvb_frontend *fe, u8 *config) { -+ struct lnbp22 *lnbp22 = (struct lnbp22 *) fe->sec_priv; -+ struct i2c_msg msg = { .addr = 0x08, .flags = 0, -+ .buf = (char*)config, -+ .len = sizeof(lnbp22->config) }; -+ -+ if (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) { -+ dprintk(2, "%s: %02X %02X %02X %02X\n", __FUNCTION__, -+ config[0], config[1], config[2], config[3]); -+ return 0; -+ } -+ return -EIO; -+} -+ - static int lnbp22_set_voltage(struct dvb_frontend *fe, - enum fe_sec_voltage voltage) - { - struct lnbp22 *lnbp22 = (struct lnbp22 *)fe->sec_priv; -- struct i2c_msg msg = { -- .addr = 0x08, -- .flags = 0, -- .buf = (char *)&lnbp22->config, -- .len = sizeof(lnbp22->config), -- }; -+ int status; - - dprintk(1, "%s: %d (18V=%d 13V=%d)\n", __func__, voltage, - SEC_VOLTAGE_18, SEC_VOLTAGE_13); - -- lnbp22->config[3] = 0x60; /* Power down */ - switch (voltage) { -- case SEC_VOLTAGE_OFF: -- break; -- case SEC_VOLTAGE_13: -- lnbp22->config[3] |= LNBP22_EN; -- break; -- case SEC_VOLTAGE_18: -- lnbp22->config[3] |= (LNBP22_EN | LNBP22_VSEL); -- break; -- default: -- return -EINVAL; -+ case SEC_VOLTAGE_OFF: -+ lnbp22->config[3] &= ~LNBP22_EN; -+ return lnbp22_write_config(fe, lnbp22->config); -+ case SEC_VOLTAGE_13: -+ lnbp22->config[3] |= LNBP22_EN; -+ lnbp22->config[3] &= ~LNBP22_VSEL; -+ break; -+ case SEC_VOLTAGE_18: -+ lnbp22->config[3] |= LNBP22_EN|LNBP22_VSEL; -+ break; -+ default: -+ return -EINVAL; } -+ -+ status = lnbp22_write_config(fe, lnbp22->config); -+ if( status == 0 ) { -+ u8 config[4]; -+ int retries = 20; -+ -+ /* byte 0: status -+ bit 3: open loop -+ bit 2: in progress/not ready -+ bit 1: over current limit -+ bit 0: over voltage limit */ -+ -+ /* wait up to 2 seconds for voltage to stablize. -+ It is important to wait that long, especially if there is a -+ rotor to power on, as DC/DC converter capacitors can take a -+ while to charge up and could cause a temporary overload */ -+ do -+ { -+ msleep(50); -+ status = lnbp22_read_config(fe, config); -+ if( status < 0 ) -+ return status; -+ } -+ while( (config[0] & (1<<2)) && retries-- ); -+ -+ dprintk(1, "%s status=0x%02X\n", __FUNCTION__, config[0]); -+ -+ if( retries < 0 ) -+ return -EAGAIN; /* temporary overload ? */ -+ -+ if( config[0] & (1<<3) ) -+ return -ENOLINK; /* open loop */ - } -- -- dprintk(1, "%s: 0x%02x)\n", __func__, lnbp22->config[3]); -- return (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) ? 0 : -EIO; -+ return status; - } - - static int lnbp22_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) - { - struct lnbp22 *lnbp22 = (struct lnbp22 *) fe->sec_priv; -- struct i2c_msg msg = { -- .addr = 0x08, -- .flags = 0, -- .buf = (char *)&lnbp22->config, -- .len = sizeof(lnbp22->config), -- }; - - dprintk(1, "%s: %d\n", __func__, (int)arg); - if (arg) -@@ -96,7 +144,7 @@ static int lnbp22_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) - else - lnbp22->config[3] &= ~LNBP22_LLC; - -- return (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) ? 0 : -EIO; -+ return lnbp22_write_config(fe, lnbp22->config); - } - - static void lnbp22_release(struct dvb_frontend *fe) -@@ -118,20 +166,14 @@ struct dvb_frontend *lnbp22_attach(struct dvb_frontend *fe, - return NULL; - - /* default configuration */ -- lnbp22->config[0] = 0x00; /* ? */ -+ lnbp22->config[0] = 0x00; /* status */ - lnbp22->config[1] = 0x28; /* ? */ -- lnbp22->config[2] = 0x48; /* ? */ -+ lnbp22->config[2] = 0x49; /* ? */ - lnbp22->config[3] = 0x60; /* Power down */ - lnbp22->i2c = i2c; - fe->sec_priv = lnbp22; - -- /* detect if it is present or not */ -- if (lnbp22_set_voltage(fe, SEC_VOLTAGE_OFF)) { -- dprintk(0, "%s LNBP22 not found\n", __func__); -- kfree(lnbp22); -- fe->sec_priv = NULL; -- return NULL; -- } -+ lnbp22_set_voltage(fe, SEC_VOLTAGE_OFF); - - /* install release callback */ - fe->ops.release_sec = lnbp22_release; diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch deleted file mode 100644 index 3624c9fa00..0000000000 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/media/dvb-frontends/stb0899_drv.c -+++ b/drivers/media/dvb-frontends/stb0899_drv.c -@@ -1618,7 +1618,7 @@ static const struct dvb_frontend_ops stb0899_ops = { - .frequency_max = 2150000, - .frequency_stepsize = 0, - .frequency_tolerance = 0, -- .symbol_rate_min = 5000000, -+ .symbol_rate_min = 1000000, - .symbol_rate_max = 45000000, - - .caps = FE_CAN_INVERSION_AUTO | diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch deleted file mode 100644 index 2e2ab8e6f7..0000000000 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/drivers/media/dvb-frontends/stb0899_drv.c -+++ b/drivers/media/dvb-frontends/stb0899_drv.c -@@ -976,6 +976,16 @@ static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength) - - *strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val); - *strength += 750; -+ -+ const int MIN_STRENGTH_DVBS = 0; -+ const int MAX_STRENGTH_DVBS = 680; -+ if (*strength < MIN_STRENGTH_DVBS) -+ *strength = 0; -+ else if(*strength > MAX_STRENGTH_DVBS) -+ *strength = 0xFFFF; -+ else -+ *strength = (*strength - MIN_STRENGTH_DVBS) * 0xFFFF / (MAX_STRENGTH_DVBS - MIN_STRENGTH_DVBS); -+ - dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm", - val & 0xff, *strength); - } -@@ -988,6 +998,7 @@ static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength) - - *strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val); - *strength += 950; -+ *strength = *strength << 4; - dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm", - val & 0x3fff, *strength); - } -@@ -1021,6 +1032,16 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr) - val = MAKEWORD16(buf[0], buf[1]); - - *snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val); -+ -+ const int MIN_SNR_DVBS = 0; -+ const int MAX_SNR_DVBS = 200; -+ if (*snr < MIN_SNR_DVBS) -+ *snr = 0; -+ else if(*snr > MAX_SNR_DVBS) -+ *snr = 0xFFFF; -+ else -+ *snr = (*snr - MIN_SNR_DVBS) * 0xFFFF / (MAX_SNR_DVBS - MIN_SNR_DVBS); -+ - dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n", - buf[0], buf[1], val, *snr); - } -@@ -1045,6 +1066,16 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr) - val = (quantn - estn) / 10; - } - *snr = val; -+ -+ const int MIN_SNR_DVBS2 = 10; -+ const int MAX_SNR_DVBS2 = 70; -+ if (*snr < MIN_SNR_DVBS2) -+ *snr = 0; -+ else if(*snr > MAX_SNR_DVBS2) -+ *snr = 0xFFFF; -+ else -+ *snr = (*snr - MIN_SNR_DVBS2) * 0xFFFF / (MAX_SNR_DVBS2 - MIN_SNR_DVBS2); -+ - dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm", - quant, quantn, est, estn, val); - } diff --git a/packages/linux-drivers/slice-drivers/package.mk b/packages/linux-drivers/slice-drivers/package.mk new file mode 100644 index 0000000000..3a4bb00ec1 --- /dev/null +++ b/packages/linux-drivers/slice-drivers/package.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="slice-drivers" +PKG_VERSION="8a2bdcd5dc182de899f19b0935d8beeb7f5fdbcb" +PKG_SHA256="ffb3b9ef5a0e6101d661407447257abf136f1ae206a17bd18d9b204e0b29f050" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/LibreELEC/slice-drivers" +PKG_URL="https://github.com/LibreELEC/slice-drivers/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain linux" +PKG_NEED_UNPACK="$LINUX_DEPENDS" +PKG_LONGDESC="linux kernel modules for the Slice box" +PKG_IS_KERNEL_PKG="yes" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + kernel_make KDIR=$(kernel_path) +} + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME + cp *.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME +} diff --git a/packages/linux-drivers/tbs-linux-drivers/README.unsupported b/packages/linux-drivers/tbs-linux-drivers/README.unsupported deleted file mode 100644 index 09db912ab1..0000000000 --- a/packages/linux-drivers/tbs-linux-drivers/README.unsupported +++ /dev/null @@ -1,12 +0,0 @@ -This driver contains a binary blob, is utterly broken, -breaks too much hardware that works without it, -and is there only to make self-builders happy. - -You are free to use it but there will be no support at all. -Please dont ask us to include it in release builds by default. - -To be absolutely clear there will be - -=== NO SUPPORT === - -on this driver. diff --git a/packages/linux-drivers/tbs-linux-drivers/package.mk b/packages/linux-drivers/tbs-linux-drivers/package.mk deleted file mode 100644 index a0318560c1..0000000000 --- a/packages/linux-drivers/tbs-linux-drivers/package.mk +++ /dev/null @@ -1,52 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="tbs-linux-drivers" -PKG_VERSION="160126" -PKG_REV="1" -PKG_ARCH="x86_64" -PKG_LICENSE="GPL" -PKG_SITE="http://www.tbsdtv.com/english/Download.html" -PKG_URL="http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v${PKG_VERSION}.zip" -PKG_SOURCE_DIR="$PKG_NAME" -PKG_DEPENDS_TARGET="toolchain linux" -PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="Linux TBS tuner drivers" -PKG_LONGDESC="Linux TBS tuner drivers" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -post_unpack() { - tar xjf $ROOT/$PKG_BUILD/linux-tbs-drivers.tar.bz2 -C $ROOT/$PKG_BUILD - chmod -R u+rwX $ROOT/$PKG_BUILD/linux-tbs-drivers/* -} - -make_target() { - cd $ROOT/$PKG_BUILD/linux-tbs-drivers - ./v4l/tbs-x86_64.sh - LDFLAGS="" make DIR=$(kernel_path) prepare - LDFLAGS="" make DIR=$(kernel_path) -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/updates/tbs - find $ROOT/$PKG_BUILD/linux-tbs-drivers/ -name \*.ko -exec cp {} $INSTALL/usr/lib/modules/$(get_module_dir)/updates/tbs \; - mkdir -p $INSTALL/lib/firmware/ - cp $ROOT/$PKG_BUILD/*.fw $INSTALL/lib/firmware/ -} diff --git a/packages/linux-drivers/wetekdvb/modules-load.d/wetekdvb.conf b/packages/linux-drivers/wetekdvb/modules-load.d/wetekdvb.conf deleted file mode 100644 index 84cd91bb2a..0000000000 --- a/packages/linux-drivers/wetekdvb/modules-load.d/wetekdvb.conf +++ /dev/null @@ -1 +0,0 @@ -wetekdvb diff --git a/packages/linux-drivers/wetekdvb/package.mk b/packages/linux-drivers/wetekdvb/package.mk index fd4b1323a7..be666a151f 100644 --- a/packages/linux-drivers/wetekdvb/package.mk +++ b/packages/linux-drivers/wetekdvb/package.mk @@ -1,49 +1,32 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="wetekdvb" -PKG_VERSION="20161127" -PKG_REV="1" +PKG_VERSION="20180222" +PKG_SHA256="9deb42ede05082279da971edf1ec0133c0f5da6edcae9d69c04f022fc91c7d6c" PKG_ARCH="arm aarch64" PKG_LICENSE="nonfree" PKG_SITE="http://www.wetek.com/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain linux" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="driver" -PKG_SHORTDESC="wetekdvb: Wetek DVB driver" -PKG_LONGDESC="These package contains Wetek's DVB driver " +PKG_LONGDESC="Wetek's DVB driver " +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +makeinstall_target() { + device=${DEVICE:-$PROJECT} + [ $device = "S905" ] && device=WeTek_Play_2 + for overlay_dir in driver/$device/*/; do + overlay_dir=`basename $overlay_dir` + mkdir -p $INSTALL/$(get_full_module_dir $overlay_dir)/$PKG_NAME + cp driver/$device/$overlay_dir/wetekdvb.ko $INSTALL/$(get_full_module_dir $overlay_dir)/$PKG_NAME + done -make_target() { - : # nothing todo + mkdir -p $INSTALL/$(get_full_firmware_dir) + cp firmware/* $INSTALL/$(get_full_firmware_dir) } -makeinstall_target() { - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - if [ $PROJECT = "WeTek_Play_2" ]; then - cp driver/wetekdvb_play2.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME/wetekdvb.ko - else - cp driver/wetekdvb.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME - fi - - mkdir -p $INSTALL/usr/lib/firmware - cp firmware/* $INSTALL/usr/lib/firmware +post_install() { + enable_service wetekdvb.service } diff --git a/packages/linux-drivers/wetekdvb/system.d/wetekdvb.service b/packages/linux-drivers/wetekdvb/system.d/wetekdvb.service new file mode 100644 index 0000000000..b860b1c094 --- /dev/null +++ b/packages/linux-drivers/wetekdvb/system.d/wetekdvb.service @@ -0,0 +1,11 @@ +[Unit] +Description=WeTek DVB module loader +ConditionPathExists=/proc/device-tree/dvb/dev_name +After=kernel-overlays.service + +[Service] +Type=simple +ExecStart=/bin/sh -c '[ `cat /proc/device-tree/dvb/dev_name` = "wetek-dvb" ] && /sbin/modprobe wetekdvb' + +[Install] +WantedBy=basic.target diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/package.mk b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/package.mk new file mode 100644 index 0000000000..6c7a5b9b01 --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/package.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="brcmfmac_sdio-firmware-all-aml" +PKG_VERSION="02b8502" +PKG_SHA256="899f1da77994d337cfe57ec3f38cc13247769d8df6c56b2541f5b8fea6438f16" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kszaq/brcmfmac_sdio-firmware-aml" +PKG_URL="https://github.com/kszaq/brcmfmac_sdio-firmware-aml/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Firmware for brcm bluetooth chips used in some Amlogic based devices." + +post_makeinstall_target() { + cd $INSTALL/$(get_full_firmware_dir)/brcm + for f in *.hcd; do + ln -sr $f $(grep --text -o 'BCM\S*' $f).hcd 2>/dev/null || true + ln -sr $f $(grep --text -o 'BCM\S*' $f | cut -c4-).hcd 2>/dev/null || true + ln -sr $f $(echo $f | sed -r 's/[^.]*/\U&/') 2>/dev/null || true + ln -sr bcm4335_V0343.0353.hcd BCM4335A0.hcd 2>/dev/null || true + done +} diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/patches/brcmfmac_sdio-firmware-aml-all-0001-install-firmware-in-usr.patch b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/patches/brcmfmac_sdio-firmware-aml-all-0001-install-firmware-in-usr.patch new file mode 100644 index 0000000000..254be5a23c --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/patches/brcmfmac_sdio-firmware-aml-all-0001-install-firmware-in-usr.patch @@ -0,0 +1,14 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2014-10-07 14:00:34.000000000 -0700 ++++ b/Makefile 2016-12-06 11:24:34.855522455 -0800 +@@ -15,8 +15,8 @@ + install: + mkdir -p $(DESTDIR)/usr/bin + cp -P $(PROG) $(DESTDIR)/usr/bin +- mkdir -p $(DESTDIR)/lib/firmware +- cp -PR firmware/brcm $(DESTDIR)/lib/firmware/ ++ mkdir -p $(DESTDIR)/usr/lib/kernel-overlays/base/lib/firmware ++ cp -PR firmware/brcm $(DESTDIR)/usr/lib/kernel-overlays/base/lib/firmware/ + + clean: + rm -f $(PROG) diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/system.d/brcmfmac_sdio-firmware-aml.service b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/system.d/brcmfmac_sdio-firmware-aml.service new file mode 100644 index 0000000000..d9353648f3 --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/system.d/brcmfmac_sdio-firmware-aml.service @@ -0,0 +1,8 @@ +[Unit] +Description=Broadcom sdio firmware update + +[Service] +Type=simple +RemainAfterExit=yes +EnvironmentFile=/usr/share/bttty.conf +ExecStart=/usr/bin/hciattach -n -s 115200 ${BTTTY} bcm43xx 2000000 diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/system.d/brcmfmac_sdio-firmware@.service b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/system.d/brcmfmac_sdio-firmware@.service new file mode 100644 index 0000000000..0d5fa2cc95 --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/system.d/brcmfmac_sdio-firmware@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Broadcom sdio firmware update for %I + +[Service] +Type=simple +RemainAfterExit=yes +EnvironmentFile=/usr/share/bttty.conf +ExecStart=/usr/bin/brcm_patchram_plus --patchram /usr/lib/kernel-overlays/base/lib/firmware/brcm/%I.hcd --baudrate 2000000 --use_baudrate_for_download ${BTTTY} --enable_hci --no2bytes --tosleep=50000 diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/udev.d/80-brcmfmac_sdio.rules b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/udev.d/80-brcmfmac_sdio.rules new file mode 100644 index 0000000000..f119bd2779 --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-all-aml/udev.d/80-brcmfmac_sdio.rules @@ -0,0 +1,12 @@ +################################################################################ +# udev rules file for loading brcmfmac_sdio-firmware +################################################################################ + +### Broadcom bcm43362/bcm20710a1 bluetooth device +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", ACTION=="add", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="brcmfmac_sdio-firmware@bcm20710a1.service", GOTO="end" + +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ACTION=="add", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="brcmfmac_sdio-firmware-aml.service" + +LABEL="end" diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/package.mk b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/package.mk new file mode 100644 index 0000000000..c19f1a611c --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) + +PKG_NAME="brcmfmac_sdio-firmware-aml" +PKG_VERSION="0.1" +PKG_SHA256="37e19eb005882793d26d0def8704417b21beb1c24d2b4489715e4ed7e7818776" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/LibreELEC/LibreELEC.tv" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Firmware for brcm bluetooth chips used in some Amlogic based devices." + +makeinstall_target() { + DESTDIR=$INSTALL FWDIR=$INSTALL/$(get_kernel_overlay_dir) make install +} diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/patches/brcmfmac_sdio-firmware-aml-0001-install-firmware-to-FWDIR.patch b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/patches/brcmfmac_sdio-firmware-aml-0001-install-firmware-to-FWDIR.patch new file mode 100644 index 0000000000..156bcf4e8e --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/patches/brcmfmac_sdio-firmware-aml-0001-install-firmware-to-FWDIR.patch @@ -0,0 +1,14 @@ +diff -Naur brcmfmac_sdio-firmware-aml-0.1.orig/Makefile brcmfmac_sdio-firmware-aml-0.1/Makefile +--- brcmfmac_sdio-firmware-aml-0.1.orig/Makefile 2014-10-07 23:00:34.000000000 +0200 ++++ brcmfmac_sdio-firmware-aml-0.1/Makefile 2017-11-09 11:52:47.102781882 +0100 +@@ -15,8 +15,8 @@ + install: + mkdir -p $(DESTDIR)/usr/bin + cp -P $(PROG) $(DESTDIR)/usr/bin +- mkdir -p $(DESTDIR)/lib/firmware +- cp -PR firmware/brcm $(DESTDIR)/lib/firmware/ ++ mkdir -p $(FWDIR)/lib/firmware ++ cp -PR firmware/brcm $(FWDIR)/lib/firmware/ + + clean: + rm -f $(PROG) diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service similarity index 100% rename from packages/linux-firmware/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service rename to packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/system.d/brcmfmac_sdio-firmware@.service diff --git a/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules new file mode 100644 index 0000000000..bd06442be6 --- /dev/null +++ b/packages/linux-firmware/amlogic/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules @@ -0,0 +1,30 @@ +################################################################################ +# udev rules file for loading brcmfmac_sdio-firmware +################################################################################ + +ACTION!="add", GOTO="end" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", GOTO="begin" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4330", GOTO="begin" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4335", GOTO="begin" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa9bf", GOTO="begin" +GOTO="end" +LABEL="begin" +### Broadcom bcm43362/bcm20710a1 bluetooth device +ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", \ + ENV{brcm_device}="bcm20710a1" + +### Broadcom bcm4330/bcm40183b2 bluetooth device +ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4330", \ + ENV{brcm_device}="bcm40183b2" + +### Broadcom bcm4335/bcm4335c0 bluetooth device +ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4335", \ + ENV{brcm_device}="bcm4335c0" + +### Broadcom bcm4345c0 bluetooth device +ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa9bf", \ + ENV{brcm_device}="bcm4345c0" + +ENV{brcm_device}=="bcm*", ACTION=="add", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="brcmfmac_sdio-firmware@$env{brcm_device}.service" +LABEL="end" diff --git a/packages/linux-firmware/amlogic/qca9377-firmware-aml/package.mk b/packages/linux-firmware/amlogic/qca9377-firmware-aml/package.mk new file mode 100644 index 0000000000..2db207ba7a --- /dev/null +++ b/packages/linux-firmware/amlogic/qca9377-firmware-aml/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="qca9377-firmware-aml" +PKG_VERSION="1.0.0-3" +PKG_SHA256="9a9f214943e77e89ce8fc8c0dc5b41bc253478a9d92383a76590993df861f36d" +PKG_ARCH="arm aarch64" +PKG_LICENSE="BSD-3c" +PKG_SITE="http://linode.boundarydevices.com/repos/apt/ubuntu-relx/pool/main/q/qca-firmware/" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="qca9377 Linux firmware" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_firmware_dir) + cp -a * $INSTALL/$(get_full_firmware_dir) +} diff --git a/packages/linux-firmware/amlogic/qca9377-firmware-aml/system.d/qca9377-firmware-aml.service b/packages/linux-firmware/amlogic/qca9377-firmware-aml/system.d/qca9377-firmware-aml.service new file mode 100644 index 0000000000..be1f8a9e57 --- /dev/null +++ b/packages/linux-firmware/amlogic/qca9377-firmware-aml/system.d/qca9377-firmware-aml.service @@ -0,0 +1,8 @@ +[Unit] +Description=QCA Bluetooth firmware service +ConditionPathExists=/dev/ttyS1 + +[Service] +Type=simple +RemainAfterExit=yes +ExecStart=/usr/bin/hciattach -n -s 115200 /dev/ttyS1 qca 2000000 diff --git a/packages/linux-firmware/amlogic/qca9377-firmware-aml/udev.d/80-qca9377-firmware-aml.rules b/packages/linux-firmware/amlogic/qca9377-firmware-aml/udev.d/80-qca9377-firmware-aml.rules new file mode 100644 index 0000000000..d3dd577bf2 --- /dev/null +++ b/packages/linux-firmware/amlogic/qca9377-firmware-aml/udev.d/80-qca9377-firmware-aml.rules @@ -0,0 +1,6 @@ +################################################################################ +# udev rules file for loading qca9377-firmware-aml +################################################################################ + +ACTION=="add", SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x0271", ATTRS{device}=="0x0701", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="qca9377-firmware-aml.service" diff --git a/packages/linux-firmware/amlogic/wlan-firmware-aml/package.mk b/packages/linux-firmware/amlogic/wlan-firmware-aml/package.mk new file mode 100644 index 0000000000..8a1d6e7659 --- /dev/null +++ b/packages/linux-firmware/amlogic/wlan-firmware-aml/package.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="wlan-firmware-aml" +PKG_VERSION="5f5fae7" +PKG_SHA256="a926edbd87b028afcf8048c776859fa2bf0dca006df6a0f6867ce3915bd21494" +PKG_LICENSE="Free-to-use" +PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/wifi/" +PKG_URL="https://github.com/openwetek/wlan-firmware-aml/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="wlan-firmware-aml: Firmware for various WLAN chips used in the devices based on Amlogic SoCs" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/$(get_full_firmware_dir)/brcm + + # AP6210 + cp -PR bcm_ampak/config/AP6210/Wi-Fi/fw_bcm40181a2*.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -P bcm_ampak/config/AP6210/Wi-Fi/nvram_ap6210.txt $INSTALL/$(get_full_firmware_dir)/brcm + cp -P bcm_ampak/config/AP6210/BT/bcm20710a1.hcd $INSTALL/$(get_full_firmware_dir)/brcm + + # AP6255 + cp -PR bcm_ampak/config/6255/fw_bcm43455c0_*.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -P bcm_ampak/config/6255/nvram.txt $INSTALL/$(get_full_firmware_dir)/brcm/nvram_ap6255.txt + cp -P bcm_ampak/config/6255/BT/BCM4345C0.hcd $INSTALL/$(get_full_firmware_dir)/brcm/bcm4345c0.hcd + + # AP6330 + cp -PR bcm_ampak/config/AP6330/Wi-Fi/fw_bcm40183b2*.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -P bcm_ampak/config/AP6330/Wi-Fi/nvram_ap6330.txt $INSTALL/$(get_full_firmware_dir)/brcm + cp -P bcm_ampak/config/AP6330/BT/bcm40183b2.hcd $INSTALL/$(get_full_firmware_dir)/brcm + + # AP6335 + cp -PR bcm_ampak/config/6335/fw_bcm4339a0_*.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -P bcm_ampak/config/6335/nvram.txt $INSTALL/$(get_full_firmware_dir)/brcm/nvram_ap6335.txt + cp -P bcm_ampak/config/6335/BT/bcm4335c0.hcd $INSTALL/$(get_full_firmware_dir)/brcm +} diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/package.mk b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/package.mk deleted file mode 100644 index 6d04457158..0000000000 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/package.mk +++ /dev/null @@ -1,33 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="brcmfmac_sdio-firmware-aml" -PKG_VERSION="0.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/LibreELEC/LibreELEC.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="brcmfmac_sdio-firmware: firmware for brcm bluetooth chips used in some Amlogic based devices" -PKG_LONGDESC="Firmware for Broadcom Bluetooth devices used in some Amlogic based devices, and brcm-patchram-plus that downloads a patchram files in the HCD format to the Bluetooth based silicon and combo chips and other utility functions." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/patches/brcmfmac_sdio-firmware-aml-0001-install-firmware-in-usr.patch b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/patches/brcmfmac_sdio-firmware-aml-0001-install-firmware-in-usr.patch deleted file mode 100644 index 839f4adfeb..0000000000 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/patches/brcmfmac_sdio-firmware-aml-0001-install-firmware-in-usr.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur a/Makefile b/Makefile ---- a/Makefile 2014-10-07 14:00:34.000000000 -0700 -+++ b/Makefile 2016-12-06 11:24:34.855522455 -0800 -@@ -15,8 +15,8 @@ - install: - mkdir -p $(DESTDIR)/usr/bin - cp -P $(PROG) $(DESTDIR)/usr/bin -- mkdir -p $(DESTDIR)/lib/firmware -- cp -PR firmware/brcm $(DESTDIR)/lib/firmware/ -+ mkdir -p $(DESTDIR)/usr/lib/firmware -+ cp -PR firmware/brcm $(DESTDIR)/usr/lib/firmware/ - - clean: - rm -f $(PROG) diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules b/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules deleted file mode 100644 index 00c66eb4a2..0000000000 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-aml/udev.d/80-brcmfmac_sdio.rules +++ /dev/null @@ -1,25 +0,0 @@ -################################################################################ -# udev rules file for loading brcmfmac_sdio-firmware -################################################################################ - -ACTION!="add", GOTO="end" -SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", GOTO="begin" -SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4330", GOTO="begin" -SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4335", GOTO="begin" -GOTO="end" -LABEL="begin" -### Broadcom bcm43362/bcm20710a1 bluetooth device -ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa962", \ - ENV{brcm_device}="bcm20710a1" - -### Broadcom bcm4330/bcm40183b2 bluetooth device -ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4330", \ - ENV{brcm_device}="bcm40183b2" - -### Broadcom bcm4335/bcm4335c0 bluetooth device -ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4335", \ - ENV{brcm_device}="bcm4335c0" - -ENV{brcm_device}=="bcm*", ACTION=="add", \ - TAG+="systemd", ENV{SYSTEMD_WANTS}+="brcmfmac_sdio-firmware@$env{brcm_device}.service" -LABEL="end" diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-imx/package.mk b/packages/linux-firmware/brcmfmac_sdio-firmware-imx/package.mk index ae46c17814..6731f6cf36 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-imx/package.mk +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-imx/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="brcmfmac_sdio-firmware-imx" PKG_VERSION="0.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="4c8ed8ae39ecd05d7e3aeebc98cf230912cdcc887fa78d5112f981b6f9358b6e" PKG_LICENSE="GPL" PKG_SITE="https://github.com/LibreELEC/LibreELEC.tv" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="brcmfmac_sdio-firmware: firmware for brcm bluetooth chips used in some Freescale iMX based devices" -PKG_LONGDESC="Firmware for Broadcom Bluetooth chips used in some Freescale iMX based devices, and brcm-patchram-plus that downloads a patchram files in the HCD format to the Bluetooth based silicon and combo chips and other utility functions." +PKG_LONGDESC="Firmware for brcm bluetooth chips used in some Freescale iMX based devices." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -av brcm_patchram_plus $INSTALL/usr/bin/ + mkdir -p $INSTALL/$(get_kernel_overlay_dir)/lib/firmware/ + cp -av firmware/brcm $INSTALL/$(get_kernel_overlay_dir)/lib/firmware/ +} diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-imx/patches/brcmfmac_sdio-firmware-imx-0001-install-firmware-in-usr.patch b/packages/linux-firmware/brcmfmac_sdio-firmware-imx/patches/brcmfmac_sdio-firmware-imx-0001-install-firmware-in-usr.patch deleted file mode 100644 index 839f4adfeb..0000000000 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-imx/patches/brcmfmac_sdio-firmware-imx-0001-install-firmware-in-usr.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur a/Makefile b/Makefile ---- a/Makefile 2014-10-07 14:00:34.000000000 -0700 -+++ b/Makefile 2016-12-06 11:24:34.855522455 -0800 -@@ -15,8 +15,8 @@ - install: - mkdir -p $(DESTDIR)/usr/bin - cp -P $(PROG) $(DESTDIR)/usr/bin -- mkdir -p $(DESTDIR)/lib/firmware -- cp -PR firmware/brcm $(DESTDIR)/lib/firmware/ -+ mkdir -p $(DESTDIR)/usr/lib/firmware -+ cp -PR firmware/brcm $(DESTDIR)/usr/lib/firmware/ - - clean: - rm -f $(PROG) diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/package.mk b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/package.mk index 3a42e617ec..96b8a832c9 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/package.mk +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/package.mk @@ -1,42 +1,25 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="brcmfmac_sdio-firmware-rpi" -PKG_VERSION="0.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="cda3df85ecbf1bf3ed756bc7c3cbd6ef4cce7c1d" +PKG_SHA256="866006c141c4dfb0e75cad3ea6136653659bc95f966cb66f1a7cf1db6167ed4a" PKG_LICENSE="GPL" PKG_SITE="https://github.com/LibreELEC/LibreELEC.tv" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/LibreELEC/$PKG_NAME/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="brcmfmac_sdio-firmware: firmware for brcm bluetooth chips used on RaspberryPi devices" -PKG_LONGDESC="Firmware for Broadcom Bluetooth chips used on RaspberryPi devices, and brcm-patchram-plus that downloads a patchram files in the HCD format to the Bluetooth based silicon and combo chips and other utility functions." +PKG_LONGDESC="Firmware for brcm bluetooth chips used on RaspberryPi devices." +PKG_TOOLCHAIN="manual" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo +makeinstall_target() { + DESTDIR=$INSTALL/$(get_kernel_overlay_dir) ./install } -makeinstall_target() { - DESTDIR=$INSTALL/usr ./install +post_makeinstall_target() { + # Install rpi btuart script to bring up Bluetooth + mkdir -p $INSTALL/usr/bin + cp -P $PKG_DIR/scripts/rpi-btuart $INSTALL/usr/bin } post_install() { diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/scripts/rpi-btuart b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/scripts/rpi-btuart new file mode 100755 index 0000000000..fb89ef84e6 --- /dev/null +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/scripts/rpi-btuart @@ -0,0 +1,18 @@ +#!/bin/sh + +HCIATTACH=/usr/bin/hciattach +SERIAL=$(awk '/^Serial/{ print $3 }' /proc/cpuinfo) +B1=${SERIAL:10:2} +B2=${SERIAL:12:2} +B3=${SERIAL:14:2} +BDADDR=$(printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))) + +if [ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ] ; then + if [ "$(wc -c /proc/device-tree/soc/gpio@7e200000/uart0_pins/brcm\,pins | cut -f 1 -d ' ')" = "16" ] ; then + $HCIATTACH /dev/serial1 bcm43xx 3000000 flow - $BDADDR + else + $HCIATTACH /dev/serial1 bcm43xx 921600 noflow - $BDADDR + fi +else + $HCIATTACH /dev/serial1 bcm43xx 460800 noflow - $BDADDR +fi diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/system.d/brcmfmac_sdio-firmware.service b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/system.d/brcmfmac_sdio-firmware.service index 0c66ca357d..ade61a2c0c 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/system.d/brcmfmac_sdio-firmware.service +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/system.d/brcmfmac_sdio-firmware.service @@ -1,13 +1,12 @@ [Unit] Description=Broadcom sdio firmware update for BCM43430A1 -ConditionPathExists=/dev/ttyAMA0 -ConditionPathExists=/proc/device-tree/soc/gpio@7e200000/bt_pins +ConditionPathExists=/dev/serial1 After=network.target [Service] Type=simple RemainAfterExit=yes -ExecStart=/usr/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow - +ExecStart=/usr/bin/rpi-btuart [Install] WantedBy=network.target diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/udev.d/90-rpi-add-serial.rules b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/udev.d/90-rpi-add-serial.rules new file mode 100755 index 0000000000..334bd37d4b --- /dev/null +++ b/packages/linux-firmware/brcmfmac_sdio-firmware-rpi/udev.d/90-rpi-add-serial.rules @@ -0,0 +1,21 @@ +KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if [ $(cat $ALIASES/uart0) = $(cat $ALIASES/serial0) ]; then \ + echo 0;\ + elif [ $(cat $ALIASES/uart0) = $(cat $ALIASES/serial1) ]; then \ + echo 1; \ + else \ + exit 1; \ + fi\ + '", SYMLINK+="serial%c" + +KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if [ $(cat $ALIASES/uart1) = $(cat $ALIASES/serial0) ]; then \ + echo 0; \ + elif [ $(cat $ALIASES/uart1) = $(cat $ALIASES/serial1) ]; then \ + echo 1; \ + else \ + exit 1; \ + fi \ + '", SYMLINK+="serial%c" diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware/udev.d/81-bt-power.rules b/packages/linux-firmware/brcmfmac_sdio-firmware/udev.d/81-bt-power.rules deleted file mode 100644 index 39a1bb60c6..0000000000 --- a/packages/linux-firmware/brcmfmac_sdio-firmware/udev.d/81-bt-power.rules +++ /dev/null @@ -1,5 +0,0 @@ -################################################################################ -# udev rule to set bluetooth power up -################################################################################ - -ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up" diff --git a/packages/linux-firmware/dvb-firmware/package.mk b/packages/linux-firmware/dvb-firmware/package.mk index 9295b9f80b..a0bbbe20f6 100644 --- a/packages/linux-firmware/dvb-firmware/package.mk +++ b/packages/linux-firmware/dvb-firmware/package.mk @@ -1,40 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dvb-firmware" -PKG_VERSION="1.2.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.3.1" +PKG_SHA256="c800e41f5047c586d3e3184166436f45edb460f71164724250e1e54faf1e0988" PKG_LICENSE="Free-to-use" PKG_SITE="https://github.com/LibreELEC/dvb-firmware" PKG_URL="https://github.com/LibreELEC/dvb-firmware/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="dvb-firmware: firmwares for various DVB drivers" PKG_LONGDESC="dvb-firmware: firmwares for various DVB drivers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} +PKG_TOOLCHAIN="manual" makeinstall_target() { - DESTDIR=$INSTALL/usr ./install + PKG_FW_DIR="$INSTALL/$(get_kernel_overlay_dir)/lib/firmware" + mkdir -p "$PKG_FW_DIR" + cp -a "$PKG_BUILD/firmware/"* "$PKG_FW_DIR" } diff --git a/packages/linux-firmware/firmware-imx/package.mk b/packages/linux-firmware/firmware-imx/package.mk index d684316df7..4d895b40e2 100644 --- a/packages/linux-firmware/firmware-imx/package.mk +++ b/packages/linux-firmware/firmware-imx/package.mk @@ -1,42 +1,25 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="firmware-imx" PKG_VERSION="5.4" -PKG_REV="1" +PKG_SHA256="c5bd4bff48cce9715a5d6d2c190ff3cd2262c7196f7facb9b0eda231c92cc223" PKG_ARCH="arm" PKG_LICENSE="other" PKG_SITE="http://www.freescale.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://www.nxp.com/lgfiles/NMG/MAD/YOCTO/${PKG_NAME}-${PKG_VERSION}.bin" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="linux-firmware" -PKG_SHORTDESC="firmware-imx: Freescale IMX firmware" PKG_LONGDESC="firmware-imx: Freescale IMX firmware such as for the VPU" +PKG_TOOLCHAIN="manual" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo here +unpack() { + mkdir -p $BUILD + cd $BUILD + sh $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.bin --auto-accept } makeinstall_target() { - mkdir -p $INSTALL/usr/lib/firmware/vpu - cp -P firmware/vpu/vpu_fw_imx6d.bin $INSTALL/usr/lib/firmware/vpu - cp -P firmware/vpu/vpu_fw_imx6q.bin $INSTALL/usr/lib/firmware/vpu + mkdir -p $INSTALL/$(get_full_firmware_dir)/vpu + cp -P firmware/vpu/vpu_fw_imx6d.bin $INSTALL/$(get_full_firmware_dir)/vpu + cp -P firmware/vpu/vpu_fw_imx6q.bin $INSTALL/$(get_full_firmware_dir)/vpu } diff --git a/packages/linux-firmware/intel-ucode/package.mk b/packages/linux-firmware/intel-ucode/package.mk index 10f3cfb9d5..94768ce394 100644 --- a/packages/linux-firmware/intel-ucode/package.mk +++ b/packages/linux-firmware/intel-ucode/package.mk @@ -1,53 +1,19 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="intel-ucode" -PKG_VERSION="20161104" -PKG_REV="1" +PKG_VERSION="20180807a" +PKG_SHA256="46ab18699ec42eb6cc01ee1846ec4d7ca979766dee2156f92d69e2f6df548137" PKG_ARCH="x86_64" PKG_LICENSE="other" PKG_SITE="https://downloadcenter.intel.com/search?keyword=linux+microcode" -PKG_URL="https://downloadmirror.intel.com/26400/eng/microcode-${PKG_VERSION}.tgz" +PKG_URL="https://downloadmirror.intel.com/28087/eng/microcode-${PKG_VERSION}.tgz" +PKG_DEPENDS_HOST="toolchain" PKG_DEPENDS_TARGET="toolchain intel-ucode:host" -PKG_SECTION="linux-firmware" -PKG_SHORTDESC="intel-ucode: Intel CPU microcodes" PKG_LONGDESC="intel-ucode: Intel CPU microcodes" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="manual" unpack() { - mkdir -p $ROOT/$PKG_BUILD - tar xf $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tgz -C $ROOT/$PKG_BUILD -} - -make_host() { - $CC $CFLAGS -o intel-microcode2ucode intel-microcode2ucode.c -} - -makeinstall_host() { - cp intel-microcode2ucode $ROOT/$TOOLCHAIN/bin/ -} - -make_target() { - intel-microcode2ucode ./microcode.dat -} - -makeinstall_target() { - : + mkdir -p $PKG_BUILD + tar xf $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tgz -C $PKG_BUILD } diff --git a/packages/linux-firmware/iwlwifi-firmware/package.mk b/packages/linux-firmware/iwlwifi-firmware/package.mk index f5e8b97a1d..b4ff06120a 100644 --- a/packages/linux-firmware/iwlwifi-firmware/package.mk +++ b/packages/linux-firmware/iwlwifi-firmware/package.mk @@ -1,40 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="iwlwifi-firmware" -PKG_VERSION="cb23d96" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="bc32183c521559114eb72c0677b850269772addb" +PKG_SHA256="deaaac826b7d68d46936b327994312a298f81c446ac5b72dbeee2cbd4cf1b719" PKG_LICENSE="Free-to-use" PKG_SITE="https://github.com/LibreELEC/iwlwifi-firmware" PKG_URL="https://github.com/LibreELEC/iwlwifi-firmware/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="iwlwifi-firmware: firmwares for various Intel WLAN drivers" PKG_LONGDESC="iwlwifi-firmware: firmwares for various Intel WLAN drivers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} +PKG_TOOLCHAIN="manual" makeinstall_target() { - DESTDIR=$INSTALL/usr ./install + DESTDIR=$INSTALL/$(get_kernel_overlay_dir) ./install } diff --git a/packages/linux-firmware/kernel-firmware/firmwares/any.dat b/packages/linux-firmware/kernel-firmware/firmwares/any.dat new file mode 100644 index 0000000000..e6a29070d2 --- /dev/null +++ b/packages/linux-firmware/kernel-firmware/firmwares/any.dat @@ -0,0 +1,17 @@ +#aarch64 +htc_7010.fw +htc_9271.fw + +ath3k-1.fw +ar5523.bin +carl9170-1.fw +mt7601u.bin +rt2870.bin +rt73.bin +vntwusb.fw + +ath6k/AR6004/hw1.?/bdata.bin +ath9k_htc/* +brcm/* +rtl_bt/* +rtlwifi/* diff --git a/packages/linux-firmware/kernel-firmware/firmwares/x86_64.dat b/packages/linux-firmware/kernel-firmware/firmwares/x86_64.dat new file mode 100644 index 0000000000..65a8932f88 --- /dev/null +++ b/packages/linux-firmware/kernel-firmware/firmwares/x86_64.dat @@ -0,0 +1,13 @@ +ath10k/* +ctefx.bin +lbtf_usb.bin +rt2561.bin +rt2561s.bin +rt2661.bin +rt2860.bin +rt3290.bin +ar3k/*.dfu +intel/dsp_fw_{bxtn,cnl,glk,kbl,release}.bin +intel/fw_sst_*.bin* +intel/ibt-*.{ddc,sfi,bseq} +intel/IntcSST2.bin diff --git a/packages/linux-firmware/kernel-firmware/package.mk b/packages/linux-firmware/kernel-firmware/package.mk new file mode 100644 index 0000000000..4865c7a2a1 --- /dev/null +++ b/packages/linux-firmware/kernel-firmware/package.mk @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="kernel-firmware" +PKG_VERSION="28f5f7dc1f077ea37d663f70de4490844db0449d" +PKG_SHA256="422efa46f633acede2290ee4b53e07d1e2786e9b26d5cd0a7a5b8991c3763334" +PKG_LICENSE="other" +PKG_SITE="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/" +PKG_URL="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/$PKG_VERSION.tar.gz" +PKG_NEED_UNPACK="${PROJECT_DIR}/${PROJECT}/packages/${PKG_NAME} ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/${PKG_NAME}" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="kernel-firmware: kernel related firmware" +PKG_TOOLCHAIN="manual" + +# Install additional miscellaneous drivers +makeinstall_target() { + FW_TARGET_DIR=$INSTALL/$(get_full_firmware_dir) + + if find_file_path firmwares/kernel-firmware.dat; then + FW_LISTS="${FOUND_PATH}" + else + FW_LISTS="${PKG_DIR}/firmwares/any.dat ${PKG_DIR}/firmwares/${TARGET_ARCH}.dat" + fi + + for fwlist in ${FW_LISTS}; do + [ -f "${fwlist}" ] || continue + + while read -r fwline; do + [ -z "${fwline}" ] && continue + [[ ${fwline} =~ ^#.* ]] && continue + [[ ${fwline} =~ ^[[:space:]] ]] && continue + + while read -r fwfile; do + [ -d "${PKG_BUILD}/${fwfile}" ] && continue + + if [ -f "${PKG_BUILD}/${fwfile}" ]; then + mkdir -p "$(dirname "${FW_TARGET_DIR}/${fwfile}")" + cp -Lv "${PKG_BUILD}/${fwfile}" "${FW_TARGET_DIR}/${fwfile}" + else + echo "ERROR: Firmware file ${fwfile} does not exist - aborting" + exit 1 + fi + done <<< "$(cd ${PKG_BUILD} && eval "find "${fwline}"")" + done < "${fwlist}" + done + + # The following files are RPi specific and installed by brcmfmac_sdio-firmware-rpi instead. + # They are also not required at all if the kernel is not suitably configured. + if listcontains "${FIRMWARE}" "brcmfmac_sdio-firmware-rpi" || \ + ! grep -q "^CONFIG_BRCMFMAC_SDIO=y" $(kernel_config_path); then + rm -fr $FW_TARGET_DIR/brcm/brcmfmac43430*-sdio.* + rm -fr $FW_TARGET_DIR/brcm/brcmfmac43455*-sdio.* + fi + + # brcm pcie firmware is only needed by x86_64 + [ "$TARGET_ARCH" != "x86_64" ] && rm -fr $FW_TARGET_DIR/brcm/*-pcie.* + + # Cleanup - which may be project or device specific + find_file_path scripts/cleanup.sh && ${FOUND_PATH} ${FW_TARGET_DIR} || true +} diff --git a/packages/linux-firmware/kernel-firmware/patches/kernel-firmware-02-add-brcmfmac-43xxx-configs.patch b/packages/linux-firmware/kernel-firmware/patches/kernel-firmware-02-add-brcmfmac-43xxx-configs.patch new file mode 100644 index 0000000000..493745205d --- /dev/null +++ b/packages/linux-firmware/kernel-firmware/patches/kernel-firmware-02-add-brcmfmac-43xxx-configs.patch @@ -0,0 +1,188 @@ +From 1e6e0b28cd5b3e621e012169563d45748734b721 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 29 Nov 2018 23:47:02 +0000 +Subject: [PATCH] add missing brcmfmac434[30,55]-sdio.txt config files + +--- + brcm/brcmfmac43430-sdio.txt | 64 ++++++++++++++++++++++++++++++ + brcm/brcmfmac43455-sdio.txt | 97 +++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 161 insertions(+) + create mode 100644 brcm/brcmfmac43430-sdio.txt + create mode 100644 brcm/brcmfmac43455-sdio.txt + +diff --git a/brcm/brcmfmac43430-sdio.txt b/brcm/brcmfmac43430-sdio.txt +new file mode 100644 +index 0000000..e644e6a +--- /dev/null ++++ b/brcm/brcmfmac43430-sdio.txt +@@ -0,0 +1,64 @@ ++# NVRAM file for BCM943430WLSELG ++# 2.4 GHz, 20 MHz BW mode ++ ++# The following parameter values are just placeholders, need to be updated. ++manfid=0x2d0 ++prodid=0x0726 ++vendid=0x14e4 ++devid=0x43e2 ++boardtype=0x0726 ++boardrev=0x1202 ++boardnum=22 ++macaddr=00:90:4c:c5:12:38 ++sromrev=11 ++boardflags=0x00404201 ++boardflags3=0x08000000 ++xtalfreq=37400 ++#xtalfreq=19200 ++nocrc=1 ++ag0=255 ++aa2g=1 ++ccode=ALL ++ ++pa0itssit=0x20 ++extpagain2g=0 ++ ++#PA parameters for 2.4GHz, measured at CHIP OUTPUT ++pa2ga0=-168,7161,-820 ++AvVmid_c0=0x0,0xc8 ++cckpwroffset0=5 ++ ++# PPR params ++maxp2ga0=84 ++txpwrbckof=6 ++cckbw202gpo=0 ++legofdmbw202gpo=0x66111111 ++mcsbw202gpo=0x77711111 ++propbw202gpo=0xdd ++ ++# OFDM IIR : ++ofdmdigfilttype=18 ++ofdmdigfilttypebe=18 ++# PAPD mode: ++papdmode=1 ++papdvalidtest=1 ++pacalidx2g=32 ++papdepsoffset=-36 ++papdendidx=61 ++ ++il0macaddr=00:90:4c:c5:12:38 ++wl0id=0x431b ++ ++deadman_to=0xffffffff ++# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG ++muxenab=0x1 ++# CLDO PWM voltage settings - 0x4 - 1.1 volt ++#cldo_pwm=0x4 ++ ++#VCO freq 326.4MHz ++spurconfig=0x3 ++ ++# Experimental Bluetooth coexistence parameters from Cypress ++btc_mode=1 ++btc_params8=0x4e20 ++btc_params1=0x7530 +diff --git a/brcm/brcmfmac43455-sdio.txt b/brcm/brcmfmac43455-sdio.txt +new file mode 100644 +index 0000000..04b6570 +--- /dev/null ++++ b/brcm/brcmfmac43455-sdio.txt +@@ -0,0 +1,97 @@ ++# Cloned from bcm94345wlpagb_p2xx.txt ++NVRAMRev=$Rev: 498373 $ ++sromrev=11 ++vendid=0x14e4 ++devid=0x43ab ++manfid=0x2d0 ++prodid=0x06e4 ++#macaddr=00:90:4c:c5:12:38 ++macaddr=b8:27:eb:74:f2:6c ++nocrc=1 ++boardtype=0x6e4 ++boardrev=0x1304 ++ ++#XTAL 37.4MHz ++xtalfreq=37400 ++ ++btc_mode=1 ++#------------------------------------------------------ ++#boardflags: 5GHz eTR switch by default ++# 2.4GHz eTR switch by default ++# bit1 for btcoex ++boardflags=0x00480201 ++boardflags2=0x40800000 ++boardflags3=0x48200100 ++phycal_tempdelta=15 ++rxchain=1 ++txchain=1 ++aa2g=1 ++aa5g=1 ++tssipos5g=1 ++tssipos2g=1 ++femctrl=0 ++AvVmid_c0=1,165,2,100,2,100,2,100,2,100 ++pa2ga0=-129,6525,-718 ++pa2ga1=-149,4408,-601 ++pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818 ++pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575 ++itrsw=1 ++pdoffsetcckma0=2 ++pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 ++pdoffset2g40ma0=16 ++pdoffset40ma0=0x8888 ++pdoffset80ma0=0x8888 ++extpagain5g=2 ++extpagain2g=2 ++tworangetssi2g=1 ++tworangetssi5g=1 ++# LTECX flags ++# WCI2 ++ltecxmux=0 ++ltecxpadnum=0x0504 ++ltecxfnsel=0x22 ++ltecxgcigpio=0x32 ++ ++maxp2ga0=80 ++ofdmlrbw202gpo=0x0022 ++dot11agofdmhrbw202gpo=0x4442 ++mcsbw202gpo=0x98444422 ++mcsbw402gpo=0x98444422 ++maxp5ga0=82,82,82,82 ++mcsbw205glpo=0xb9555000 ++mcsbw205gmpo=0xb9555000 ++mcsbw205ghpo=0xb9555000 ++mcsbw405glpo=0xb9555000 ++mcsbw405gmpo=0xb9555000 ++mcsbw405ghpo=0xb9555000 ++mcsbw805glpo=0xb9555000 ++mcsbw805gmpo=0xb9555000 ++mcsbw805ghpo=0xb9555000 ++ ++swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff ++swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe ++swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 ++swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 ++ ++vcodivmode=1 ++deadman_to=481500000 ++ ++ed_thresh2g=-54 ++ed_thresh5g=-54 ++eu_edthresh2g=-54 ++eu_edthresh5g=-54 ++ldo1=4 ++rawtempsense=0x1ff ++cckPwrIdxCorr=3 ++cckTssiDelay=150 ++ofdmTssiDelay=150 ++txpwr2gAdcScale=1 ++txpwr5gAdcScale=1 ++dot11b_opts=0x3aa85 ++cbfilttype=1 ++fdsslevel_ch11=6 ++ ++# Experimental Bluetooth coexistence parameters from Cypress ++btc_mode=1 ++btc_params8=0x4e20 ++btc_params1=0x7530 +-- +2.14.1 + diff --git a/packages/linux-firmware/misc-firmware/package.mk b/packages/linux-firmware/misc-firmware/package.mk index ef19d5ce15..d355287438 100644 --- a/packages/linux-firmware/misc-firmware/package.mk +++ b/packages/linux-firmware/misc-firmware/package.mk @@ -1,40 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="misc-firmware" -PKG_VERSION="0.0.17" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="9dd2a25" +PKG_SHA256="8788d153cbee0bfd9998aed4cf2e015b373529d4b9c2c35325a08ef390855ec6" PKG_LICENSE="Free-to-use" -PKG_SITE="https://github.com/OpenELEC/misc-firmware" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="misc-firmware: firmwares for various drivers" +PKG_SITE="https://github.com/LibreELEC/misc-firmware" +PKG_URL="https://github.com/LibreELEC/misc-firmware/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kernel-firmware" PKG_LONGDESC="misc-firmware: firmwares for various drivers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} +PKG_TOOLCHAIN="manual" makeinstall_target() { - DESTDIR=$INSTALL/usr ./install + DESTDIR=$INSTALL/$(get_kernel_overlay_dir) ./install } diff --git a/packages/linux-firmware/rockchip-firmware/modprobe.d/bcmdhd.conf b/packages/linux-firmware/rockchip-firmware/modprobe.d/bcmdhd.conf new file mode 100644 index 0000000000..724420a894 --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/modprobe.d/bcmdhd.conf @@ -0,0 +1 @@ +options bcmdhd firmware_path=/lib/firmware/brcm/ nvram_path=/lib/firmware/brcm/ diff --git a/packages/linux-firmware/rockchip-firmware/package.mk b/packages/linux-firmware/rockchip-firmware/package.mk new file mode 100644 index 0000000000..b7bf9680fa --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/package.mk @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rockchip-firmware" +PKG_VERSION="firmware" +PKG_ARCH="arm aarch64" +PKG_LICENSE="nonfree" +PKG_SITE="https://github.com/rockchip-linux" +PKG_URL="" +PKG_DEPENDS_TARGET="rkbin rfkill" +PKG_LONGDESC="rockchip firmware" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec + + mkdir -p $INSTALL/usr/bin + cp -v $(get_build_dir rkbin)/firmware/bin/rtk_hciattach $INSTALL/usr/bin + + mkdir -p $INSTALL/$(get_full_firmware_dir)/rtlbt + cp -v $(get_build_dir rkbin)/firmware/bluetooth/rtl8723b_* $INSTALL/$(get_full_firmware_dir)/rtlbt + + mkdir -p $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/bluetooth/BCM4345C0.hcd $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/bluetooth/BCM4345C5.hcd $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/bluetooth/bcm4354a1.hcd $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/bluetooth/BCM4354A2.hcd $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/bluetooth/BCM4356A2.hcd $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/bluetooth/BCM4359C0.hcd $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/fw_bcm43455c0_ag.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/fw_bcm43456c5_ag.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/fw_bcm4354a1_ag.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/fw_bcm4356a2_ag.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/fw_bcm4359c0_ag.bin $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/nvram_ap6255.txt $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/nvram_ap6256.txt $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/nvram_ap6354.txt $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/nvram_ap6356.txt $INSTALL/$(get_full_firmware_dir)/brcm + cp -v $(get_build_dir rkbin)/firmware/wifi/nvram_ap6398s.txt $INSTALL/$(get_full_firmware_dir)/brcm + + mkdir -p $INSTALL/$(get_full_firmware_dir)/rockchip + cp -v $(get_build_dir rkbin)/firmware/rockchip/dptx.bin $INSTALL/$(get_full_firmware_dir)/rockchip +} diff --git a/packages/linux-firmware/rockchip-firmware/scripts/hciattach-realtek-config b/packages/linux-firmware/rockchip-firmware/scripts/hciattach-realtek-config new file mode 100755 index 0000000000..33985cc96d --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/scripts/hciattach-realtek-config @@ -0,0 +1,17 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +if [ "$(cat /sys/firmware/devicetree/base/model)" = "Rockchip RK3328 TRN9" ]; then + cp -f /usr/lib/kernel-overlays/base/lib/firmware/rtlbt/rtl8723b_config_noflow /var/lib/firmware/rtlbt/rtl8723b_config + + # temporarily disable bluetooth unless bootargs contains bluetooth + BOOTARGS=$(cat /sys/firmware/devicetree/base/chosen/bootargs) && [ "$BOOTARGS" = "${BOOTARGS/bluetooth/}" ] && exit 1 +fi + +if [ -d /var/lib/firmware/updates/rtlbt ]; then + cp -f /var/lib/firmware/updates/rtlbt/* /var/lib/firmware/rtlbt +fi + +exit 0 diff --git a/packages/linux-firmware/rockchip-firmware/system.d/btattach@.service b/packages/linux-firmware/rockchip-firmware/system.d/btattach@.service new file mode 100644 index 0000000000..7bb104e983 --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/system.d/btattach@.service @@ -0,0 +1,11 @@ +[Unit] +Description=Attach /dev/ttyS0 to BlueZ stack using %I protocol +Wants=bluetooth.service +Before=bluetooth.service +After=dev-ttyS0.device + +[Service] +Type=simple +ExecStartPre=/usr/sbin/rfkill unblock bluetooth +ExecStart=/usr/bin/btattach -B /dev/ttyS0 -P %I +ExecStopPost=/usr/sbin/rfkill block bluetooth diff --git a/packages/linux-firmware/rockchip-firmware/system.d/hciattach-realtek.service b/packages/linux-firmware/rockchip-firmware/system.d/hciattach-realtek.service new file mode 100644 index 0000000000..733a4ab238 --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/system.d/hciattach-realtek.service @@ -0,0 +1,12 @@ +[Unit] +Description=Attach /dev/ttyS0 to BlueZ stack +Wants=bluetooth.service +Before=bluetooth.service +After=dev-ttyS0.device + +[Service] +Type=simple +ExecStartPre=/usr/lib/libreelec/hciattach-realtek-config +ExecStartPre=/usr/sbin/rfkill unblock bluetooth +ExecStart=/usr/bin/rtk_hciattach -n -s 115200 ttyS0 rtk_h5 +ExecStopPost=/usr/sbin/rfkill block bluetooth diff --git a/packages/linux-firmware/rockchip-firmware/system.d/hciattach@.service b/packages/linux-firmware/rockchip-firmware/system.d/hciattach@.service new file mode 100644 index 0000000000..ee8db515a3 --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/system.d/hciattach@.service @@ -0,0 +1,11 @@ +[Unit] +Description=Attach /dev/ttyS0 to BlueZ stack using %I type +Wants=bluetooth.service +Before=bluetooth.service +After=dev-ttyS0.device + +[Service] +Type=simple +ExecStartPre=/usr/sbin/rfkill unblock bluetooth +ExecStart=/usr/bin/hciattach -n -s 115200 ttyS0 %I +ExecStopPost=/usr/sbin/rfkill block bluetooth diff --git a/packages/linux-firmware/rockchip-firmware/udev.d/80-rockchip-firmware.rules b/packages/linux-firmware/rockchip-firmware/udev.d/80-rockchip-firmware.rules new file mode 100644 index 0000000000..63b0b082f7 --- /dev/null +++ b/packages/linux-firmware/rockchip-firmware/udev.d/80-rockchip-firmware.rules @@ -0,0 +1,32 @@ +################################################################################ +# udev rules file for loading rockchip-firmware +################################################################################ + +ACTION!="add", GOTO="end" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0xb723", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x8753", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0626", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0624", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0623", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0524", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0523", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0241", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0x0240", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach-realtek.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0xa9bf", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach@bcm43xx.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4354", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach@bcm43xx.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4356", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach@bcm43xx.service" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x02d0", ATTRS{device}=="0x4359", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="hciattach@bcm43xx.service" +LABEL="end" diff --git a/packages/linux-firmware/rtl8723bs_bt/package.mk b/packages/linux-firmware/rtl8723bs_bt/package.mk new file mode 100644 index 0000000000..ca35897880 --- /dev/null +++ b/packages/linux-firmware/rtl8723bs_bt/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rtl8723bs_bt" +PKG_VERSION="09eb91f" +PKG_SHA256="4bb8483c4a14a9e0dfc4a6ddca18486caab5f361be2441b91e9e2a399ca9f33e" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/lwfinger/rtl8723bs_bt" +PKG_URL="https://github.com/lwfinger/rtl8723bs_bt/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="rtl8723bs_bt Linux firmware" diff --git a/packages/linux-firmware/rtl8723bs_bt/patches/rtl8723bs_bt-001-Makefile.patch b/packages/linux-firmware/rtl8723bs_bt/patches/rtl8723bs_bt-001-Makefile.patch new file mode 100644 index 0000000000..e4296c08e2 --- /dev/null +++ b/packages/linux-firmware/rtl8723bs_bt/patches/rtl8723bs_bt-001-Makefile.patch @@ -0,0 +1,26 @@ +diff --git a/Makefile b/Makefile +index 52506b9..fd196f3 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,12 +1,15 @@ + rtk_hciattach:hciattach.c hciattach_rtk.o +- cc -o rtk_hciattach hciattach.c hciattach_rtk.o ++ $(CC) $(CFLAGS) $(LDFLAGS) -o rtk_hciattach hciattach.c hciattach_rtk.o + + hciattach_rtk.o:hciattach_rtk.c +- cc -c hciattach_rtk.c ++ $(CC) $(CFLAGS) $(LDFLAGS) -c hciattach_rtk.c + +-clean: +- rm -f *.o rtk_hciattach ++all: ++ rtk_hciattach + + install: +- mkdir -p /lib/firmware/rtl_bt +- cp -p rtlbt_* /lib/firmware/rtl_bt/. ++ mkdir -p $(DESTDIR)/usr/bin ++ cp -P rtk_hciattach $(DESTDIR)/usr/bin ++ ++clean: ++ rm -f *.o rtk_hciattach diff --git a/packages/linux-firmware/rtl8723bs_bt/patches/rtl8723bs_bt-002-firmware_path.patch b/packages/linux-firmware/rtl8723bs_bt/patches/rtl8723bs_bt-002-firmware_path.patch new file mode 100644 index 0000000000..cc57fbe371 --- /dev/null +++ b/packages/linux-firmware/rtl8723bs_bt/patches/rtl8723bs_bt-002-firmware_path.patch @@ -0,0 +1,20 @@ +--- a/hciattach_rtk.c 2016-07-18 00:47:52.000000000 +0100 ++++ b/hciattach_rtk.c 2017-12-15 04:27:39.481299996 +0000 +@@ -1419,7 +1419,7 @@ + int ret = 0; + struct stat st; + +- ret = sprintf(firmware_file_name, FIRMWARE_DIRECTORY"rtlbt_fw"); ++ ret = sprintf(firmware_file_name, FIRMWARE_DIRECTORY"rtl8723b_fw"); + + return firmware_file_name; + } +@@ -1504,7 +1504,7 @@ + int ret = 0; + int i = 0; + +- ret = sprintf(bt_config_file_name, BT_CONFIG_DIRECTORY"rtlbt_config"); ++ ret = sprintf(bt_config_file_name, BT_CONFIG_DIRECTORY"rtl8723b_config"); + if (stat(bt_config_file_name, &st) < 0) { + RS_ERR("can't access bt config file:%s, errno:%d\n", bt_config_file_name, errno); + return -1; diff --git a/packages/linux-firmware/rtl8723bs_bt/system.d/rtl8723bs_bt-firmware.service b/packages/linux-firmware/rtl8723bs_bt/system.d/rtl8723bs_bt-firmware.service new file mode 100644 index 0000000000..44f74a35c4 --- /dev/null +++ b/packages/linux-firmware/rtl8723bs_bt/system.d/rtl8723bs_bt-firmware.service @@ -0,0 +1,8 @@ +[Unit] +Description=Realtek sdio firmware update + +[Service] +Type=simple +RemainAfterExit=yes +EnvironmentFile=/usr/share/bttty.conf +ExecStart=/usr/bin/rtk_hciattach -n -s 115200 ${BTTTY} rtk_h5 2000000 diff --git a/packages/linux-firmware/rtl8723bs_bt/udev.d/80-rtl8723_bt.rules b/packages/linux-firmware/rtl8723bs_bt/udev.d/80-rtl8723_bt.rules new file mode 100644 index 0000000000..742f49cd37 --- /dev/null +++ b/packages/linux-firmware/rtl8723bs_bt/udev.d/80-rtl8723_bt.rules @@ -0,0 +1,9 @@ +################################################################################ +# udev rules file for loading rtl8723bs_bt-firmware +################################################################################ + +ACTION!="add", GOTO="end" +SUBSYSTEMS=="sdio", ATTRS{vendor}=="0x024c", ATTRS{device}=="0xb723", TAG+="systemd", ENV{SYSTEMD_WANTS}+="rtl8723bs_bt-firmware.service" +GOTO="end" + +LABEL="end" diff --git a/packages/linux-firmware/slice-firmware/package.mk b/packages/linux-firmware/slice-firmware/package.mk new file mode 100644 index 0000000000..ae5f97c686 --- /dev/null +++ b/packages/linux-firmware/slice-firmware/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="slice-firmware" +PKG_VERSION="0f463cc" +PKG_SHA256="27e8bac75d5639ca75d683bb2c9b10398c5d7f54f2cf3337ede6abf98e42f751" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/FiveNinjas/slice-firmware" +PKG_URL="https://github.com/libreelec/slice-firmware/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain dtc:host" +PKG_LONGDESC="BCM270x firmware related stuff for Slice" +PKG_TOOLCHAIN="manual" + +make_target() { + if [ "$DEVICE" = "Slice3" ]; then + $(kernel_path)/scripts/dtc/dtc -O dtb -I dts -o dt-blob.bin slice3-dt-blob.dts + elif [ "$DEVICE" = "Slice" ]; then + $(kernel_path)/scripts/dtc/dtc -O dtb -I dts -o dt-blob.bin slice-dt-blob.dts + fi +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/bootloader/ + cp -a $PKG_BUILD/dt-blob.bin $INSTALL/usr/share/bootloader/ +} diff --git a/packages/linux-firmware/wlan-firmware-aml/package.mk b/packages/linux-firmware/wlan-firmware-aml/package.mk deleted file mode 100644 index 25f0b81e21..0000000000 --- a/packages/linux-firmware/wlan-firmware-aml/package.mk +++ /dev/null @@ -1,48 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="wlan-firmware-aml" -PKG_VERSION="b74369c" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="Free-to-use" -PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/wifi/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="wlan-firmware-aml: Firmware for various WLAN chips used in the devices based on Amlogic SoCs" -PKG_LONGDESC="wlan-firmware-aml: Firmware for various WLAN chips used in the devices based on Amlogic SoCs" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/lib/firmware/brcm - - cp -PR bcm_ampak/config/AP6330/Wi-Fi/fw_bcm40183b2*.bin $INSTALL/usr/lib/firmware/brcm - cp -P bcm_ampak/config/AP6330/Wi-Fi/nvram_ap6330.txt $INSTALL/usr/lib/firmware/brcm - cp -P bcm_ampak/config/AP6330/BT/bcm40183b2.hcd $INSTALL/usr/lib/firmware/brcm - - cp -PR bcm_ampak/config/6335/fw_bcm4339a0_*.bin $INSTALL/usr/lib/firmware/brcm - cp -P bcm_ampak/config/6335/nvram.txt $INSTALL/usr/lib/firmware/brcm/nvram_ap6335.txt - cp -P bcm_ampak/config/6335/BT/bcm4335c0.hcd $INSTALL/usr/lib/firmware/brcm -} diff --git a/packages/linux-firmware/wlan-firmware/package.mk b/packages/linux-firmware/wlan-firmware/package.mk index 6cdbcd6c0e..5700cb106a 100644 --- a/packages/linux-firmware/wlan-firmware/package.mk +++ b/packages/linux-firmware/wlan-firmware/package.mk @@ -1,40 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="wlan-firmware" -PKG_VERSION="0.0.32" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2142727" +PKG_SHA256="d03e3108ef18ec10774b601d06d8445aebbd3c39f8ea3ab2b20a26c62af3500f" PKG_LICENSE="Free-to-use" PKG_SITE="https://github.com/LibreELEC/wlan-firmware" PKG_URL="https://github.com/LibreELEC/wlan-firmware/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="firmware" -PKG_SHORTDESC="wlan-firmware: firmwares for various WLAN drivers" PKG_LONGDESC="wlan-firmware: firmwares for various WLAN drivers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing todo -} +PKG_TOOLCHAIN="manual" makeinstall_target() { - DESTDIR=$INSTALL/usr ./install + DESTDIR=$INSTALL/$(get_kernel_overlay_dir) ./install } diff --git a/packages/linux-firmware/x86-firmware/package.mk b/packages/linux-firmware/x86-firmware/package.mk deleted file mode 100644 index 485d926416..0000000000 --- a/packages/linux-firmware/x86-firmware/package.mk +++ /dev/null @@ -1,45 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="x86-firmware" -PKG_VERSION="c4c07a8" -PKG_REV="1" -PKG_ARCH="x86_64" -PKG_LICENSE="other" -PKG_SITE="http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/" -PKG_URL="http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/$PKG_VERSION.tar.xz" -PKG_SOURCE_DIR="$PKG_VERSION" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="linux-firmware" -PKG_SHORTDESC="x86-firmware: x86 related firmware" -PKG_LONGDESC="x86-firmware: x86 related firmware" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -configure_target() { - : -} - -make_target() { - : -} - -makeinstall_target() { - : -} diff --git a/packages/linux/modprobe.d/ath9k.conf b/packages/linux/modprobe.d/ath9k.conf deleted file mode 100644 index e10b4ce285..0000000000 --- a/packages/linux/modprobe.d/ath9k.conf +++ /dev/null @@ -1,5 +0,0 @@ -# /etc/modprobe.d/ath9k.conf: setup modload options for module ath9k. -# see: -# http://openelec.tv/forum/28-issue-reports/4644-addons-download-not-working#4778 - -options ath9k nohwcrypt=1 diff --git a/packages/linux/package.mk b/packages/linux/package.mk index 55ffaa09c8..7afc308383 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -1,76 +1,71 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="linux" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kernel.org" PKG_DEPENDS_HOST="ccache:host" -PKG_DEPENDS_TARGET="toolchain cpio:host kmod:host pciutils xz:host wireless-regdb keyutils" +PKG_DEPENDS_TARGET="toolchain cpio:host kmod:host pciutils xz:host wireless-regdb keyutils $KERNEL_EXTRA_DEPENDS_TARGET" PKG_DEPENDS_INIT="toolchain" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="linux" -PKG_SHORTDESC="linux26: The Linux kernel 2.6 precompiled kernel binary image and modules" PKG_LONGDESC="This package contains a precompiled kernel image and the modules." +PKG_IS_KERNEL_PKG="yes" + +PKG_PATCH_DIRS="$LINUX" + case "$LINUX" in amlogic-3.10) - PKG_VERSION="1261cae" + PKG_VERSION="95ba9d626c0fce672caa296f5911ab9190881642" + PKG_SHA256="df34b086993fd3552efae92d84d28990a61a1ca79a8703a4b64241ab80e3b6db" PKG_URL="https://github.com/LibreELEC/linux-amlogic/archive/$PKG_VERSION.tar.gz" - PKG_SOURCE_DIR="$PKG_NAME-amlogic-$PKG_VERSION*" - PKG_PATCH_DIRS="amlogic-3.10" + PKG_SOURCE_NAME="linux-$LINUX-$PKG_VERSION.tar.gz" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET aml-dtbtools:host u-boot-tools-aml:host" + PKG_BUILD_PERF="no" ;; amlogic-3.14) - PKG_VERSION="33aa3be" + PKG_VERSION="6d8fbb4ee61a7779ac57b5961e076f0c63ff8b65" + PKG_SHA256="ef05c88779c893f92e92e5315d0e5396f34c32289726c301fae7ffe8c4214227" PKG_URL="https://github.com/LibreELEC/linux-amlogic/archive/$PKG_VERSION.tar.gz" - PKG_SOURCE_DIR="$PKG_NAME-amlogic-$PKG_VERSION*" - PKG_PATCH_DIRS="amlogic-3.14" + PKG_SOURCE_NAME="linux-$LINUX-$PKG_VERSION.tar.gz" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET aml-dtbtools:host" + PKG_BUILD_PERF="no" ;; - imx6) - PKG_VERSION="3.14-mx6-sr" - PKG_COMMIT="27e61f6" - PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION-$PKG_COMMIT" - PKG_SOURCE_NAME="$PKG_SOURCE_DIR.tar.xz" - PKG_URL="$DISTRO_SRC/$PKG_SOURCE_NAME" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx6-status-led imx6-soc-fan" + rockchip-4.4) + PKG_VERSION="aa8bacf821e5c8ae6dd8cae8d64011c741659945" + PKG_SHA256="a2760fe89a15aa7be142fd25fb08ebd357c5d855c41f1612cf47c6e89de39bb3" + PKG_URL="https://github.com/rockchip-linux/kernel/archive/$PKG_VERSION.tar.gz" + PKG_SOURCE_NAME="linux-$LINUX-$PKG_VERSION.tar.gz" ;; - imx6-4.4-xbian) - PKG_VERSION="4.4-xbian" - PKG_COMMIT="20160821-f14907b" - PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION-$PKG_COMMIT" - PKG_SOURCE_NAME="$PKG_SOURCE_DIR.tar.xz" - PKG_URL="$DISTRO_SRC/$PKG_SOURCE_NAME" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx6-status-led imx6-soc-fan irqbalanced" + raspberrypi) + PKG_VERSION="0a7f6900636f7c5a027124fe3388c928f1769c52" # 4.19.23 + PKG_SHA256="937cbaa16d33260148c405f984a9c44bac0e62c5028249a00b2a3ca01605ba91" + PKG_URL="https://github.com/raspberrypi/linux/archive/$PKG_VERSION.tar.gz" + PKG_SOURCE_NAME="linux-$LINUX-$PKG_VERSION.tar.gz" ;; *) - PKG_VERSION="4.9.3" - PKG_URL="http://www.kernel.org/pub/linux/kernel/v4.x/$PKG_NAME-$PKG_VERSION.tar.xz" + PKG_VERSION="4.19.23" + PKG_SHA256="2d9b25678aac7f3f109c52e6266fb6ee89cc424b597518a2875874bacb8f130a" + PKG_URL="https://www.kernel.org/pub/linux/kernel/v4.x/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_PATCH_DIRS="default" ;; esac -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_KERNEL_CFG_FILE=$(kernel_config_path) -PKG_MAKE_OPTS_HOST="ARCH=$TARGET_KERNEL_ARCH headers_check" +if [ -n "$KERNEL_LINARO_TOOLCHAIN" ]; then + PKG_DEPENDS_HOST="$PKG_DEPENDS_HOST gcc-linaro-$KERNEL_LINARO_TOOLCHAIN:host" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gcc-linaro-$KERNEL_LINARO_TOOLCHAIN:host" + HEADERS_ARCH=$TARGET_ARCH +fi + +if [ "$PKG_BUILD_PERF" != "no" ] && grep -q ^CONFIG_PERF_EVENTS= $PKG_KERNEL_CFG_FILE ; then + PKG_BUILD_PERF="yes" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET binutils elfutils libunwind zlib openssl" +fi if [ "$TARGET_ARCH" = "x86_64" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET intel-ucode x86-firmware" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET intel-ucode:host kernel-firmware elfutils:host" fi if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then @@ -78,33 +73,14 @@ if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then fi post_patch() { - if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/$PKG_NAME/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf ]; then - KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/devices/$DEVICE/$PKG_NAME/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf - elif [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf ]; then - KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/devices/$DEVICE/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf - elif [ -f $PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf ]; then - KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf - elif [ -f $PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf ]; then - KERNEL_CFG_FILE=$PROJECT_DIR/$PROJECT/$PKG_NAME/$PKG_NAME.$TARGET_ARCH.conf - elif [ -f $PKG_DIR/config/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf ]; then - KERNEL_CFG_FILE=$PKG_DIR/config/$PKG_VERSION/$PKG_NAME.$TARGET_ARCH.conf - else - KERNEL_CFG_FILE=$PKG_DIR/config/$PKG_NAME.$TARGET_ARCH.conf - fi - - sed -i -e "s|^HOSTCC[[:space:]]*=.*$|HOSTCC = $ROOT/$TOOLCHAIN/bin/host-gcc|" \ - -e "s|^HOSTCXX[[:space:]]*=.*$|HOSTCXX = $ROOT/$TOOLCHAIN/bin/host-g++|" \ - -e "s|^ARCH[[:space:]]*?=.*$|ARCH = $TARGET_KERNEL_ARCH|" \ - -e "s|^CROSS_COMPILE[[:space:]]*?=.*$|CROSS_COMPILE = $TARGET_PREFIX|" \ - $PKG_BUILD/Makefile - - cp $KERNEL_CFG_FILE $PKG_BUILD/.config + cp $PKG_KERNEL_CFG_FILE $PKG_BUILD/.config if [ ! "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then - sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$ROOT/$BUILD/image/initramfs.cpio\"|" $PKG_BUILD/.config + sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$BUILD/image/initramfs.cpio\"|" $PKG_BUILD/.config + sed -i -e '/^CONFIG_INITRAMFS_SOURCE=*./ a CONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0' $PKG_BUILD/.config fi - # set default hostname based on $DISTRONAME - sed -i -e "s|@DISTRONAME@|$DISTRONAME|g" $PKG_BUILD/.config + # set default hostname based on $DISTRO + sed -i -e "s|@DISTRONAME@|$DISTRO|g" $PKG_BUILD/.config # disable swap support if not enabled if [ ! "$SWAP_SUPPORT" = yes ]; then @@ -130,18 +106,38 @@ post_patch() { sed -i -e "s|^CONFIG_ISCSI_IBFT=.*$|# CONFIG_ISCSI_IBFT is not set|" $PKG_BUILD/.config fi - # enable different libcec version for imx6 project with kernel 4.4 - # using customized kernel driver - if [ "$PROJECT" = "imx6" ]; then - if [ "$LIBCEC_TYPE" = "xbian" -a "$LINUX" = "imx6-4.4-xbian" ]; then - sed -i -e "s|# CONFIG_MXC_HDMI_CEC is not set|CONFIG_MXC_HDMI_CEC=y|" $PKG_BUILD/.config - sed -i -e "s|CONFIG_MXC_HDMI_CEC_SR=y||" $PKG_BUILD/.config - fi + # install extra dts files + for f in $PROJECT_DIR/$PROJECT/config/*-overlay.dts; do + [ -f "$f" ] && cp -v $f $PKG_BUILD/arch/$TARGET_KERNEL_ARCH/boot/dts/overlays || true + done + if [ -n "$DEVICE" ]; then + for f in $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/*-overlay.dts; do + [ -f "$f" ] && cp -v $f $PKG_BUILD/arch/$TARGET_KERNEL_ARCH/boot/dts/overlays || true + done fi } +make_host() { + make \ + ARCH=${HEADERS_ARCH:-$TARGET_KERNEL_ARCH} \ + HOSTCC="$TOOLCHAIN/bin/host-gcc" \ + HOSTCXX="$TOOLCHAIN/bin/host-g++" \ + HOSTCFLAGS="$HOST_CFLAGS" \ + HOSTCXXFLAGS="$HOST_CXXFLAGS" \ + HOSTLDFLAGS="$HOST_LDFLAGS" \ + headers_check +} + makeinstall_host() { - make ARCH=$TARGET_KERNEL_ARCH INSTALL_HDR_PATH=dest headers_install + make \ + ARCH=${HEADERS_ARCH:-$TARGET_KERNEL_ARCH} \ + HOSTCC="$TOOLCHAIN/bin/host-gcc" \ + HOSTCXX="$TOOLCHAIN/bin/host-g++" \ + HOSTCFLAGS="$HOST_CFLAGS" \ + HOSTCXXFLAGS="$HOST_CXXFLAGS" \ + HOSTLDFLAGS="$HOST_LDFLAGS" \ + INSTALL_HDR_PATH=dest \ + headers_install mkdir -p $SYSROOT_PREFIX/usr/include cp -R dest/include/* $SYSROOT_PREFIX/usr/include } @@ -149,66 +145,123 @@ makeinstall_host() { pre_make_target() { if [ "$TARGET_ARCH" = "x86_64" ]; then # copy some extra firmware to linux tree - mkdir -p $ROOT/$PKG_BUILD/external-firmware - cp -a $(get_build_dir x86-firmware)/{amdgpu,amd-ucode,i915,radeon,rtl_nic} $ROOT/$PKG_BUILD/external-firmware + mkdir -p $PKG_BUILD/external-firmware + cp -a $(get_build_dir kernel-firmware)/{amdgpu,amd-ucode,i915,radeon,e100,rtl_nic} $PKG_BUILD/external-firmware - mkdir -p $ROOT/$PKG_BUILD/external-firmware/intel-ucode - cp -a $(get_build_dir intel-ucode)/microcode.bin $ROOT/$PKG_BUILD/external-firmware/intel-ucode + cp -a $(get_build_dir intel-ucode)/intel-ucode $PKG_BUILD/external-firmware - FW_LIST="$(find $ROOT/$PKG_BUILD/external-firmware \( -type f -o -type l \) \( -iname '*.bin' -o -iname '*.fw' \) | sed 's|.*external-firmware/||' | sort | xargs)" - sed -i "s|CONFIG_EXTRA_FIRMWARE=.*|CONFIG_EXTRA_FIRMWARE=\"${FW_LIST}\"|" $ROOT/$PKG_BUILD/.config + FW_LIST="$(find $PKG_BUILD/external-firmware \( -type f -o -type l \) \( -iname '*.bin' -o -iname '*.fw' -o -path '*/intel-ucode/*' \) | sed 's|.*external-firmware/||' | sort | xargs)" + sed -i "s|CONFIG_EXTRA_FIRMWARE=.*|CONFIG_EXTRA_FIRMWARE=\"${FW_LIST}\"|" $PKG_BUILD/.config fi - make oldconfig - - # regdb - cp $(get_build_dir wireless-regdb)/db.txt $ROOT/$PKG_BUILD/net/wireless/db.txt + kernel_make oldconfig - if [ "$BOOTLOADER" = "u-boot" ]; then - ( cd $ROOT - $SCRIPTS/build u-boot - ) + # regdb (backward compatability with pre-4.15 kernels) + if grep -q ^CONFIG_CFG80211_INTERNAL_REGDB= $PKG_BUILD/.config ; then + cp $(get_build_dir wireless-regdb)/db.txt $PKG_BUILD/net/wireless/db.txt fi } make_target() { - LDFLAGS="" make modules - LDFLAGS="" make INSTALL_MOD_PATH=$INSTALL/usr DEPMOD="$ROOT/$TOOLCHAIN/bin/depmod" modules_install - rm -f $INSTALL/usr/lib/modules/*/build - rm -f $INSTALL/usr/lib/modules/*/source + kernel_make modules + kernel_make INSTALL_MOD_PATH=$INSTALL/$(get_kernel_overlay_dir) modules_install + rm -f $INSTALL/$(get_kernel_overlay_dir)/lib/modules/*/build + rm -f $INSTALL/$(get_kernel_overlay_dir)/lib/modules/*/source + + if [ "$PKG_BUILD_PERF" = "yes" ] ; then + ( cd tools/perf + + # arch specific perf build args + case "$TARGET_ARCH" in + x86_64) + PERF_BUILD_ARGS="ARCH=x86" + ;; + aarch64) + PERF_BUILD_ARGS="ARCH=arm64" + ;; + *) + PERF_BUILD_ARGS="ARCH=$TARGET_ARCH" + ;; + esac + + WERROR=0 \ + NO_LIBPERL=1 \ + NO_LIBPYTHON=1 \ + NO_SLANG=1 \ + NO_GTK2=1 \ + NO_LIBNUMA=1 \ + NO_LIBAUDIT=1 \ + NO_LZMA=1 \ + NO_SDT=1 \ + LDFLAGS="$LDFLAGS -ldw -ldwfl -lebl -lelf -ldl -lz" \ + EXTRA_PERFLIBS="-lebl" \ + CROSS_COMPILE="$TARGET_PREFIX" \ + JOBS="$CONCURRENCY_MAKE_LEVEL" \ + make $PERF_BUILD_ARGS + mkdir -p $INSTALL/usr/bin + cp perf $INSTALL/usr/bin + ) + fi ( cd $ROOT - rm -rf $ROOT/$BUILD/initramfs + rm -rf $BUILD/initramfs $SCRIPTS/install initramfs ) if [ "$BOOTLOADER" = "u-boot" -a -n "$KERNEL_UBOOT_EXTRA_TARGET" ]; then for extra_target in "$KERNEL_UBOOT_EXTRA_TARGET"; do - LDFLAGS="" make $extra_target + kernel_make $extra_target done fi - LDFLAGS="" make $KERNEL_TARGET $KERNEL_MAKE_EXTRACMD + # the modules target is required to get a proper Module.symvers + # file with symbols from built-in and external modules. + # Without that it'll contain only the symbols from the kernel + kernel_make $KERNEL_TARGET $KERNEL_MAKE_EXTRACMD modules if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then - LDFLAGS="" mkbootimg --kernel arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET --ramdisk $ROOT/$BUILD/image/initramfs.cpio \ - $ANDROID_BOOTIMG_OPTIONS --output arch/$TARGET_KERNEL_ARCH/boot/boot.img + DTB_BLOBS=($(ls arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*.dtb 2>/dev/null || true)) + DTB_BLOBS_COUNT="${#DTB_BLOBS[@]}" + DTB_BLOB_OUTPUT="arch/$TARGET_KERNEL_ARCH/boot/dtb.img" + ANDROID_BOOTIMG_SECOND="--second $DTB_BLOB_OUTPUT" + + if [ "$DTB_BLOBS_COUNT" -gt 1 ]; then + $TOOLCHAIN/bin/dtbTool -o arch/$TARGET_KERNEL_ARCH/boot/dtb.img -p scripts/dtc/ arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/ + elif [ "$DTB_BLOBS_COUNT" -eq 1 ]; then + cp -PR $DTB_BLOBS $DTB_BLOB_OUTPUT + else + ANDROID_BOOTIMG_SECOND="" + fi + + LDFLAGS="" mkbootimg --kernel arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET --ramdisk $BUILD/image/initramfs.cpio \ + $ANDROID_BOOTIMG_SECOND $ANDROID_BOOTIMG_OPTIONS --output arch/$TARGET_KERNEL_ARCH/boot/boot.img + mv -f arch/$TARGET_KERNEL_ARCH/boot/boot.img arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET + fi } makeinstall_target() { if [ "$BOOTLOADER" = "u-boot" ]; then mkdir -p $INSTALL/usr/share/bootloader - for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb; do - cp $dtb $INSTALL/usr/share/bootloader 2>/dev/null || : - done - if [ -d arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic -a -f "arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/$KERNEL_UBOOT_EXTRA_TARGET" ]; then - cp "arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/$KERNEL_UBOOT_EXTRA_TARGET" $INSTALL/usr/share/bootloader/dtb.img 2>/dev/null || : + if [ -d arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic -a -f arch/$TARGET_KERNEL_ARCH/boot/dtb.img ]; then + cp arch/$TARGET_KERNEL_ARCH/boot/dtb.img $INSTALL/usr/share/bootloader/dtb.img 2>/dev/null || : + else + for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb arch/$TARGET_KERNEL_ARCH/boot/dts/*/*.dtb; do + if [ -f $dtb ]; then + cp -v $dtb $INSTALL/usr/share/bootloader + fi + done fi elif [ "$BOOTLOADER" = "bcm2835-bootloader" ]; then mkdir -p $INSTALL/usr/share/bootloader/overlays + + # install platform dtbs, but remove upstream kernel dtbs (i.e. without downstream + # drivers and decent USB support) as these are not required by LibreELEC cp -p arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb $INSTALL/usr/share/bootloader + rm -f $INSTALL/usr/share/bootloader/bcm283*.dtb + + # install overlay dtbs for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/overlays/*.dtbo; do cp $dtb $INSTALL/usr/share/bootloader/overlays 2>/dev/null || : done @@ -226,7 +279,7 @@ makeinstall_init() { mkdir -p $INSTALL/usr/lib/modules for i in $INITRAMFS_MODULES; do - module=`find .install_pkg/usr/lib/modules/$(get_module_dir)/kernel -name $i.ko` + module=`find .install_pkg/$(get_full_module_dir)/kernel -name $i.ko` if [ -n "$module" ]; then echo $i >> $INSTALL/etc/modules cp $module $INSTALL/usr/lib/modules/`basename $module` @@ -236,15 +289,16 @@ makeinstall_init() { if [ "$UVESAFB_SUPPORT" = yes ]; then mkdir -p $INSTALL/usr/lib/modules - uvesafb=`find .install_pkg/usr/lib/modules/$(get_module_dir)/kernel -name uvesafb.ko` + uvesafb=`find .install_pkg/$(get_full_module_dir)/kernel -name uvesafb.ko` cp $uvesafb $INSTALL/usr/lib/modules/`basename $uvesafb` fi } post_install() { - mkdir -p $INSTALL/usr/lib/firmware/ - ln -sf /storage/.config/firmware/ $INSTALL/usr/lib/firmware/updates + mkdir -p $INSTALL/$(get_full_firmware_dir)/ - # bluez looks in /etc/firmware/ - ln -sf /usr/lib/firmware/ $INSTALL/etc/firmware + # regdb and signature is now loaded as firmware by 4.15+ + if grep -q ^CONFIG_CFG80211_REQUIRE_SIGNED_REGDB= $PKG_BUILD/.config; then + cp $(get_build_dir wireless-regdb)/regulatory.db{,.p7s} $INSTALL/$(get_full_firmware_dir) + fi } diff --git a/packages/linux/patches/amlogic-3.10/linux-002-compiler-gcc.h.patch b/packages/linux/patches/amlogic-3.10/linux-002-compiler-gcc.h.patch deleted file mode 100644 index 51b93a3034..0000000000 --- a/packages/linux/patches/amlogic-3.10/linux-002-compiler-gcc.h.patch +++ /dev/null @@ -1,166 +0,0 @@ -From cb984d101b30eb7478d32df56a0023e4603cba7f Mon Sep 17 00:00:00 2001 -From: Joe Perches -Date: Thu, 25 Jun 2015 15:01:02 -0700 -Subject: compiler-gcc: integrate the various compiler-gcc[345].h files - -As gcc major version numbers are going to advance rather rapidly in the -future, there's no real value in separate files for each compiler -version. - -Deduplicate some of the macros #defined in each file too. - -Neaten comments using normal kernel commenting style. - -Signed-off-by: Joe Perches -Cc: Andi Kleen -Cc: Michal Marek -Cc: Segher Boessenkool -Cc: Sasha Levin -Cc: Anton Blanchard -Cc: Alan Modra -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds ---- - include/linux/compiler-gcc.h | 120 ++++++++++++++++++++++++++++++++++++++++-- - include/linux/compiler-gcc3.h | 23 -------- - include/linux/compiler-gcc4.h | 91 -------------------------------- - include/linux/compiler-gcc5.h | 67 ----------------------- - 4 files changed, 116 insertions(+), 185 deletions(-) - delete mode 100644 include/linux/compiler-gcc3.h - delete mode 100644 include/linux/compiler-gcc4.h - delete mode 100644 include/linux/compiler-gcc5.h - -diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h -index 5c2c14e..dfaa7b3 100644 ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -122,10 +122,122 @@ - #define __maybe_unused __attribute__((unused)) - #define __always_unused __attribute__((unused)) - --#define __gcc_header(x) #x --#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) --#define gcc_header(x) _gcc_header(x) --#include gcc_header(__GNUC__) -+/* gcc version specific checks */ -+ -+#if GCC_VERSION < 30200 -+# error Sorry, your compiler is too old - please upgrade it. -+#endif -+ -+#if GCC_VERSION < 30300 -+# define __used __attribute__((__unused__)) -+#else -+# define __used __attribute__((__used__)) -+#endif -+ -+#ifdef CONFIG_GCOV_KERNEL -+# if GCC_VERSION < 30400 -+# error "GCOV profiling support for gcc versions below 3.4 not included" -+# endif /* __GNUC_MINOR__ */ -+#endif /* CONFIG_GCOV_KERNEL */ -+ -+#if GCC_VERSION >= 30400 -+#define __must_check __attribute__((warn_unused_result)) -+#endif -+ -+#if GCC_VERSION >= 40000 -+ -+/* GCC 4.1.[01] miscompiles __weak */ -+#ifdef __KERNEL__ -+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 -+# error Your version of gcc miscompiles the __weak directive -+# endif -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __compiler_offsetof(a, b) \ -+ __builtin_offsetof(a, b) -+ -+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -+#endif -+ -+#if GCC_VERSION >= 40300 -+/* Mark functions as cold. gcc will assume any path leading to a call -+ * to them will be unlikely. This means a lot of manual unlikely()s -+ * are unnecessary now for any paths leading to the usual suspects -+ * like BUG(), printk(), panic() etc. [but let's keep them for now for -+ * older compilers] -+ * -+ * Early snapshots of gcc 4.3 don't support this and we can't detect this -+ * in the preprocessor, but we can live with this because they're unreleased. -+ * Maketime probing would be overkill here. -+ * -+ * gcc also has a __attribute__((__hot__)) to move hot functions into -+ * a special section, but I don't see any sense in this right now in -+ * the kernel context -+ */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+#endif /* GCC_VERSION >= 40300 */ -+ -+#if GCC_VERSION >= 40500 -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+#endif /* GCC_VERSION >= 40500 */ -+ -+#if GCC_VERSION >= 40600 -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) -+#endif -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#if GCC_VERSION >= 40400 -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#endif -+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -+ -+#if GCC_VERSION >= 50000 -+#define KASAN_ABI_VERSION 4 -+#elif GCC_VERSION >= 40902 -+#define KASAN_ABI_VERSION 3 -+#endif -+ -+#endif /* gcc version >= 40000 specific checks */ - - #if !defined(__noclone) - #define __noclone /* not needed */ --- -cgit v0.12 - diff --git a/packages/linux/patches/amlogic-3.14/linux-001-staging_rtl8712_rtl8712_avoid_lots_of_build_warnings.patch b/packages/linux/patches/amlogic-3.14/linux-001-staging_rtl8712_rtl8712_avoid_lots_of_build_warnings.patch deleted file mode 100644 index 0ad0dc7884..0000000000 --- a/packages/linux/patches/amlogic-3.14/linux-001-staging_rtl8712_rtl8712_avoid_lots_of_build_warnings.patch +++ /dev/null @@ -1,113 +0,0 @@ -From fa89009a1869844f9a9360eb07c45d457446ac0e Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Thu, 5 Jun 2014 22:48:15 +0200 -Subject: [PATCH] staging: rtl8712, rtl8712: avoid lots of build warnings - -commit 0c9f3a65c5eb7fe1fc611a22eb8a8b71ea865998 upstream. - -The rtl8712 driver has an 'extern inline' function that contains an -'if', which causes lots of warnings with CONFIG_PROFILE_ALL_BRANCHES -overriding the definition of 'if': - -drivers/staging/rtl8712/ieee80211.h:759:229: warning: '______f' is static but declared in inline function 'ieee80211_get_hdrlen' which is not static [enabled by default] - -This changes the driver to use 'static inline' instead, which happens -to be the correct annotation anyway. - -Signed-off-by: Arnd Bergmann -Cc: Larry Finger -Cc: Florian Schilhabel -Signed-off-by: Greg Kroah-Hartman ---- - drivers/staging/rtl8187se/ieee80211/ieee80211.h | 4 ++-- - drivers/staging/rtl8192u/ieee80211/ieee80211.h | 10 +++++----- - drivers/staging/rtl8712/ieee80211.h | 4 ++-- - 3 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h -index 09ffd9b..6ebdd3f 100644 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h -@@ -1460,12 +1460,12 @@ extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, - - extern const long ieee80211_wlan_frequencies[]; - --extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) -+static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) - { - ieee->scans++; - } - --extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) -+static inline int ieee80211_get_scans(struct ieee80211_device *ieee) - { - return ieee->scans; - } -diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h -index bc64f05..b1a0380 100644 ---- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h -+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h -@@ -2250,7 +2250,7 @@ static inline void *ieee80211_priv(struct net_device *dev) - return ((struct ieee80211_device *)netdev_priv(dev))->priv; - } - --extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - { - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') -@@ -2266,7 +2266,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - return 1; - } - --extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) -+static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) - { - /* - * It is possible for both access points and our device to support -@@ -2292,7 +2292,7 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod - return 0; - } - --extern inline int ieee80211_get_hdrlen(u16 fc) -+static inline int ieee80211_get_hdrlen(u16 fc) - { - int hdrlen = IEEE80211_3ADDR_LEN; - -@@ -2578,12 +2578,12 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); - - extern const long ieee80211_wlan_frequencies[]; - --extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) -+static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) - { - ieee->scans++; - } - --extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) -+static inline int ieee80211_get_scans(struct ieee80211_device *ieee) - { - return ieee->scans; - } -diff --git a/drivers/staging/rtl8712/ieee80211.h b/drivers/staging/rtl8712/ieee80211.h -index da4000e..8269be8 100644 ---- a/drivers/staging/rtl8712/ieee80211.h -+++ b/drivers/staging/rtl8712/ieee80211.h -@@ -734,7 +734,7 @@ enum ieee80211_state { - #define IEEE_G (1<<2) - #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) - --extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - { - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') -@@ -748,7 +748,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - return 1; - } - --extern inline int ieee80211_get_hdrlen(u16 fc) -+static inline int ieee80211_get_hdrlen(u16 fc) - { - int hdrlen = 24; - diff --git a/packages/linux/patches/amlogic-3.14/linux-002-backport_overlayfs.patch b/packages/linux/patches/amlogic-3.14/linux-002-backport_overlayfs.patch deleted file mode 100644 index 64fa02d97b..0000000000 --- a/packages/linux/patches/amlogic-3.14/linux-002-backport_overlayfs.patch +++ /dev/null @@ -1,11997 +0,0 @@ -From c82d759a596eb688e804ec1d1727f78d042b26fb Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 1 Apr 2014 17:08:42 +0200 -Subject: [PATCH 01/73] vfs: rename: move d_move() up - -Move the d_move() in vfs_rename_dir() up, similarly to how it's done in -vfs_rename_other(). The next patch will consolidate these two functions -and this is the only structural difference between them. - -I'm not sure if doing the d_move() after the dput is even valid. But there -may be a logical explanation for that. But moving the d_move() before the -dput() (and the mutex_unlock()) should definitely not hurt. - -Signed-off-by: Miklos Szeredi -Reviewed-by: J. Bruce Fields -(cherry picked from commit de22a4c3720a96f1c2ebf12b0857b6db6a991f2c) -Signed-off-by: Alex Shi ---- - fs/namei.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/fs/namei.c b/fs/namei.c -index 0dd72c8..f8a6d19 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4049,13 +4049,12 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, - target->i_flags |= S_DEAD; - dont_mount(new_dentry); - } -+ if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) -+ d_move(old_dentry, new_dentry); - out: - if (target) - mutex_unlock(&target->i_mutex); - dput(new_dentry); -- if (!error) -- if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) -- d_move(old_dentry,new_dentry); - return error; - } - --- -2.7.4 - - -From 75a4b5ddf548bcfb932cc0ba8cb8eb7806ae9dbc Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 1 Apr 2014 17:08:42 +0200 -Subject: [PATCH 02/73] vfs: rename: use common code for dir and non-dir - -There's actually very little difference between vfs_rename_dir() and -vfs_rename_other() so move both inline into vfs_rename() which still stays -reasonably readable. - -Signed-off-by: Miklos Szeredi -Reviewed-by: J. Bruce Fields -(cherry picked from commit bc27027a73e8b80376b51a1583ad1c7445605e8a) -Signed-off-by: Alex Shi ---- - fs/namei.c | 187 +++++++++++++++++++++++++------------------------------------ - 1 file changed, 75 insertions(+), 112 deletions(-) - -diff --git a/fs/namei.c b/fs/namei.c -index f8a6d19..4fa9e66 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -3977,7 +3977,27 @@ SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname - return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); - } - --/* -+/** -+ * vfs_rename - rename a filesystem object -+ * @old_dir: parent of source -+ * @old_dentry: source -+ * @new_dir: parent of destination -+ * @new_dentry: destination -+ * @delegated_inode: returns an inode needing a delegation break -+ * -+ * The caller must hold multiple mutexes--see lock_rename()). -+ * -+ * If vfs_rename discovers a delegation in need of breaking at either -+ * the source or destination, it will return -EWOULDBLOCK and return a -+ * reference to the inode in delegated_inode. The caller should then -+ * break the delegation and retry. Because breaking a delegation may -+ * take a long time, the caller should drop all locks before doing -+ * so. -+ * -+ * Alternatively, a caller may pass NULL for delegated_inode. This may -+ * be appropriate for callers that expect the underlying filesystem not -+ * to be NFS exported. -+ * - * The worst of all namespace operations - renaming directory. "Perverted" - * doesn't even start to describe it. Somebody in UCB had a heck of a trip... - * Problems: -@@ -4005,19 +4025,39 @@ SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname - * ->i_mutex on parents, which works but leads to some truly excessive - * locking]. - */ --static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, -- struct inode *new_dir, struct dentry *new_dentry) -+int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, -+ struct inode *new_dir, struct dentry *new_dentry, -+ struct inode **delegated_inode) - { -- int error = 0; -+ int error; -+ bool is_dir = d_is_dir(old_dentry); -+ const unsigned char *old_name; -+ struct inode *source = old_dentry->d_inode; - struct inode *target = new_dentry->d_inode; -- unsigned max_links = new_dir->i_sb->s_max_links; -+ -+ if (source == target) -+ return 0; -+ -+ error = may_delete(old_dir, old_dentry, is_dir); -+ if (error) -+ return error; -+ -+ if (!target) -+ error = may_create(new_dir, new_dentry); -+ else -+ error = may_delete(new_dir, new_dentry, is_dir); -+ if (error) -+ return error; -+ -+ if (!old_dir->i_op->rename) -+ return -EPERM; - - /* - * If we are going to change the parent - check write permissions, - * we'll need to flip '..'. - */ -- if (new_dir != old_dir) { -- error = inode_permission(old_dentry->d_inode, MAY_WRITE); -+ if (is_dir && new_dir != old_dir) { -+ error = inode_permission(source, MAY_WRITE); - if (error) - return error; - } -@@ -4026,134 +4066,57 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, - if (error) - return error; - -+ old_name = fsnotify_oldname_init(old_dentry->d_name.name); - dget(new_dentry); -- if (target) -+ if (!is_dir) -+ lock_two_nondirectories(source, target); -+ else if (target) - mutex_lock(&target->i_mutex); - - error = -EBUSY; - if (d_mountpoint(old_dentry) || d_mountpoint(new_dentry)) - goto out; - -- error = -EMLINK; -- if (max_links && !target && new_dir != old_dir && -- new_dir->i_nlink >= max_links) -- goto out; -- -- if (target) -- shrink_dcache_parent(new_dentry); -- error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry); -- if (error) -- goto out; -- -- if (target) { -- target->i_flags |= S_DEAD; -- dont_mount(new_dentry); -- } -- if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) -- d_move(old_dentry, new_dentry); --out: -- if (target) -- mutex_unlock(&target->i_mutex); -- dput(new_dentry); -- return error; --} -- --static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry, -- struct inode *new_dir, struct dentry *new_dentry, -- struct inode **delegated_inode) --{ -- struct inode *target = new_dentry->d_inode; -- struct inode *source = old_dentry->d_inode; -- int error; -- -- error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry); -- if (error) -- return error; -- -- dget(new_dentry); -- lock_two_nondirectories(source, target); -+ if (is_dir) { -+ unsigned max_links = new_dir->i_sb->s_max_links; - -- error = -EBUSY; -- if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry)) -- goto out; -+ error = -EMLINK; -+ if (max_links && !target && new_dir != old_dir && -+ new_dir->i_nlink >= max_links) -+ goto out; - -- error = try_break_deleg(source, delegated_inode); -- if (error) -- goto out; -- if (target) { -- error = try_break_deleg(target, delegated_inode); -+ if (target) -+ shrink_dcache_parent(new_dentry); -+ } else { -+ error = try_break_deleg(source, delegated_inode); - if (error) - goto out; -+ if (target) { -+ error = try_break_deleg(target, delegated_inode); -+ if (error) -+ goto out; -+ } - } - error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry); - if (error) - goto out; - -- if (target) -+ if (target) { -+ if (is_dir) -+ target->i_flags |= S_DEAD; - dont_mount(new_dentry); -+ } - if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) - d_move(old_dentry, new_dentry); - out: -- unlock_two_nondirectories(source, target); -+ if (!is_dir) -+ unlock_two_nondirectories(source, target); -+ else if (target) -+ mutex_unlock(&target->i_mutex); - dput(new_dentry); -- return error; --} -- --/** -- * vfs_rename - rename a filesystem object -- * @old_dir: parent of source -- * @old_dentry: source -- * @new_dir: parent of destination -- * @new_dentry: destination -- * @delegated_inode: returns an inode needing a delegation break -- * -- * The caller must hold multiple mutexes--see lock_rename()). -- * -- * If vfs_rename discovers a delegation in need of breaking at either -- * the source or destination, it will return -EWOULDBLOCK and return a -- * reference to the inode in delegated_inode. The caller should then -- * break the delegation and retry. Because breaking a delegation may -- * take a long time, the caller should drop all locks before doing -- * so. -- * -- * Alternatively, a caller may pass NULL for delegated_inode. This may -- * be appropriate for callers that expect the underlying filesystem not -- * to be NFS exported. -- */ --int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, -- struct inode *new_dir, struct dentry *new_dentry, -- struct inode **delegated_inode) --{ -- int error; -- int is_dir = d_is_dir(old_dentry); -- const unsigned char *old_name; -- -- if (old_dentry->d_inode == new_dentry->d_inode) -- return 0; -- -- error = may_delete(old_dir, old_dentry, is_dir); -- if (error) -- return error; -- -- if (!new_dentry->d_inode) -- error = may_create(new_dir, new_dentry); -- else -- error = may_delete(new_dir, new_dentry, is_dir); -- if (error) -- return error; -- -- if (!old_dir->i_op->rename) -- return -EPERM; -- -- old_name = fsnotify_oldname_init(old_dentry->d_name.name); -- -- if (is_dir) -- error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry); -- else -- error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry,delegated_inode); - if (!error) - fsnotify_move(old_dir, new_dir, old_name, is_dir, -- new_dentry->d_inode, old_dentry); -+ target, old_dentry); - fsnotify_oldname_free(old_name); - - return error; --- -2.7.4 - - -From 148622f8708456dda3262bbbe08742a962a0d667 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 1 Apr 2014 17:08:42 +0200 -Subject: [PATCH 03/73] vfs: add renameat2 syscall - -Add new renameat2 syscall, which is the same as renameat with an added -flags argument. - -Pass flags to vfs_rename() and to i_op->rename() as well. - -Signed-off-by: Miklos Szeredi -Reviewed-by: J. Bruce Fields -(cherry picked from commit 520c8b16505236fc82daa352e6c5e73cd9870cff) -Signed-off-by: Alex Shi ---- - Documentation/filesystems/Locking | 6 +++- - Documentation/filesystems/vfs.txt | 16 ++++++++++ - arch/x86/syscalls/syscall_64.tbl | 1 + - .../lustre/lustre/include/linux/lustre_compat25.h | 4 +-- - drivers/staging/lustre/lustre/lvfs/lvfs_linux.c | 2 +- - fs/cachefiles/namei.c | 2 +- - fs/ecryptfs/inode.c | 2 +- - fs/namei.c | 34 +++++++++++++++++----- - fs/nfsd/vfs.c | 2 +- - include/linux/fs.h | 4 ++- - 10 files changed, 58 insertions(+), 15 deletions(-) - -diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking -index 5b0c083..f424e0e 100644 ---- a/Documentation/filesystems/Locking -+++ b/Documentation/filesystems/Locking -@@ -47,6 +47,8 @@ prototypes: - int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename) (struct inode *, struct dentry *, - struct inode *, struct dentry *); -+ int (*rename2) (struct inode *, struct dentry *, -+ struct inode *, struct dentry *, unsigned int); - int (*readlink) (struct dentry *, char __user *,int); - void * (*follow_link) (struct dentry *, struct nameidata *); - void (*put_link) (struct dentry *, struct nameidata *, void *); -@@ -78,6 +80,7 @@ mkdir: yes - unlink: yes (both) - rmdir: yes (both) (see below) - rename: yes (all) (see below) -+rename2: yes (all) (see below) - readlink: no - follow_link: no - put_link: no -@@ -96,7 +99,8 @@ tmpfile: no - - Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on - victim. -- cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. -+ cross-directory ->rename() and rename2() has (per-superblock) -+->s_vfs_rename_sem. - - See Documentation/filesystems/directory-locking for more detailed discussion - of the locking scheme for directory operations. -diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt -index c53784c..94eb862 100644 ---- a/Documentation/filesystems/vfs.txt -+++ b/Documentation/filesystems/vfs.txt -@@ -347,6 +347,8 @@ struct inode_operations { - int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename) (struct inode *, struct dentry *, - struct inode *, struct dentry *); -+ int (*rename2) (struct inode *, struct dentry *, -+ struct inode *, struct dentry *, unsigned int); - int (*readlink) (struct dentry *, char __user *,int); - void * (*follow_link) (struct dentry *, struct nameidata *); - void (*put_link) (struct dentry *, struct nameidata *, void *); -@@ -414,6 +416,20 @@ otherwise noted. - rename: called by the rename(2) system call to rename the object to - have the parent and name given by the second inode and dentry. - -+ rename2: this has an additional flags argument compared to rename. -+ If no flags are supported by the filesystem then this method -+ need not be implemented. If some flags are supported then the -+ filesystem must return -EINVAL for any unsupported or unknown -+ flags. Currently the following flags are implemented: -+ (1) RENAME_NOREPLACE: this flag indicates that if the target -+ of the rename exists the rename should fail with -EEXIST -+ instead of replacing the target. The VFS already checks for -+ existence, so for local filesystems the RENAME_NOREPLACE -+ implementation is equivalent to plain rename. -+ (2) RENAME_EXCHANGE: exchange source and target. Both must -+ exist; this is checked by the VFS. Unlike plain rename, -+ source and target may be of different type. -+ - readlink: called by the readlink(2) system call. Only required if - you want to support reading symbolic links - -diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h -index eefdb8d..81cc7a0 100644 ---- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h -+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h -@@ -105,8 +105,8 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, - #define ll_vfs_unlink(inode,entry,mnt) vfs_unlink(inode,entry) - #define ll_vfs_mknod(dir,entry,mnt,mode,dev) vfs_mknod(dir,entry,mode,dev) - #define ll_security_inode_unlink(dir,entry,mnt) security_inode_unlink(dir,entry) --#define ll_vfs_rename(old,old_dir,mnt,new,new_dir,mnt1,delegated_inode) \ -- vfs_rename(old,old_dir,new,new_dir,delegated_inode) -+#define ll_vfs_rename(old, old_dir, mnt, new, new_dir, mnt1) \ -+ vfs_rename(old, old_dir, new, new_dir, NULL, 0) - - #define cfs_bio_io_error(a,b) bio_io_error((a)) - #define cfs_bio_endio(a,b,c) bio_endio((a),(c)) -diff --git a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c -index 428ffd8..d50822b 100644 ---- a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c -+++ b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c -@@ -223,7 +223,7 @@ int lustre_rename(struct dentry *dir, struct vfsmount *mnt, - GOTO(put_old, err = PTR_ERR(dchild_new)); - - err = ll_vfs_rename(dir->d_inode, dchild_old, mnt, -- dir->d_inode, dchild_new, mnt, NULL); -+ dir->d_inode, dchild_new, mnt); - - dput(dchild_new); - put_old: -diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c -index ca65f39..31088a9 100644 ---- a/fs/cachefiles/namei.c -+++ b/fs/cachefiles/namei.c -@@ -396,7 +396,7 @@ try_again: - cachefiles_io_error(cache, "Rename security error %d", ret); - } else { - ret = vfs_rename(dir->d_inode, rep, -- cache->graveyard->d_inode, grave, NULL); -+ cache->graveyard->d_inode, grave, NULL, 0); - if (ret != 0 && ret != -ENOMEM) - cachefiles_io_error(cache, - "Rename failed with error %d", ret); -diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c -index a85ceb7..57ee4c5 100644 ---- a/fs/ecryptfs/inode.c -+++ b/fs/ecryptfs/inode.c -@@ -641,7 +641,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, - } - rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry, - lower_new_dir_dentry->d_inode, lower_new_dentry, -- NULL); -+ NULL, 0); - if (rc) - goto out_lock; - if (target_inode) -diff --git a/fs/namei.c b/fs/namei.c -index 4fa9e66..5134f8c 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -3984,6 +3984,7 @@ SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname - * @new_dir: parent of destination - * @new_dentry: destination - * @delegated_inode: returns an inode needing a delegation break -+ * @flags: rename flags - * - * The caller must hold multiple mutexes--see lock_rename()). - * -@@ -4027,7 +4028,7 @@ SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname - */ - int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - struct inode *new_dir, struct dentry *new_dentry, -- struct inode **delegated_inode) -+ struct inode **delegated_inode, unsigned int flags) - { - int error; - bool is_dir = d_is_dir(old_dentry); -@@ -4052,6 +4053,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - if (!old_dir->i_op->rename) - return -EPERM; - -+ if (flags && !old_dir->i_op->rename2) -+ return -EINVAL; -+ - /* - * If we are going to change the parent - check write permissions, - * we'll need to flip '..'. -@@ -4097,7 +4101,13 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - goto out; - } - } -- error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry); -+ if (!flags) { -+ error = old_dir->i_op->rename(old_dir, old_dentry, -+ new_dir, new_dentry); -+ } else { -+ error = old_dir->i_op->rename2(old_dir, old_dentry, -+ new_dir, new_dentry, flags); -+ } - if (error) - goto out; - -@@ -4122,8 +4132,8 @@ out: - return error; - } - --SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, -- int, newdfd, const char __user *, newname) -+SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, -+ int, newdfd, const char __user *, newname, unsigned int, flags) - { - struct dentry *old_dir, *new_dir; - struct dentry *old_dentry, *new_dentry; -@@ -4135,6 +4145,10 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, - unsigned int lookup_flags = 0; - bool should_retry = false; - int error; -+ -+ if (flags) -+ return -EINVAL; -+ - retry: - from = user_path_parent(olddfd, oldname, &oldnd, lookup_flags); - if (IS_ERR(from)) { -@@ -4206,8 +4220,8 @@ retry_deleg: - if (error) - goto exit5; - error = vfs_rename(old_dir->d_inode, old_dentry, -- new_dir->d_inode, new_dentry, -- &delegated_inode); -+ new_dir->d_inode, new_dentry, -+ &delegated_inode, flags); - exit5: - dput(new_dentry); - exit4: -@@ -4237,9 +4251,15 @@ exit: - return error; - } - -+SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, -+ int, newdfd, const char __user *, newname) -+{ -+ return sys_renameat2(olddfd, oldname, newdfd, newname, 0); -+} -+ - SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname) - { -- return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname); -+ return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0); - } - - int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link) -diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c -index eea5ad1..464f813 100644 ---- a/fs/nfsd/vfs.c -+++ b/fs/nfsd/vfs.c -@@ -1703,7 +1703,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, - if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry) - goto out_dput_new; - -- host_err = vfs_rename(fdir, odentry, tdir, ndentry, NULL); -+ host_err = vfs_rename(fdir, odentry, tdir, ndentry, NULL, 0); - if (!host_err) { - host_err = commit_metadata(tfhp); - if (!host_err) -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 23b2a35..3b3670e 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -1460,7 +1460,7 @@ extern int vfs_symlink(struct inode *, struct dentry *, const char *); - extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **); - extern int vfs_rmdir(struct inode *, struct dentry *); - extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); --extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **); -+extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); - - /* - * VFS dentry helper functions. -@@ -1571,6 +1571,8 @@ struct inode_operations { - int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename) (struct inode *, struct dentry *, - struct inode *, struct dentry *); -+ int (*rename2) (struct inode *, struct dentry *, -+ struct inode *, struct dentry *, unsigned int); - int (*setattr) (struct dentry *, struct iattr *); - int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); - int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); --- -2.7.4 - - -From f1bdf915fa37836cc39f76e86c65521504deb7e1 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 1 Apr 2014 17:08:43 +0200 -Subject: [PATCH 04/73] vfs: add RENAME_NOREPLACE flag - -If this flag is specified and the target of the rename exists then the -rename syscall fails with EEXIST. - -The VFS does the existence checking, so it is trivial to enable for most -local filesystems. This patch only enables it in ext4. - -For network filesystems the VFS check is not enough as there may be a race -between a remote create and the rename, so these filesystems need to handle -this flag in their ->rename() implementations to ensure atomicity. - -Andy writes about why this is useful: - -"The trivial answer: to eliminate the race condition from 'mv -i'. - -Another answer: there's a common pattern to atomically create a file -with contents: open a temporary file, write to it, optionally fsync -it, close it, then link(2) it to the final name, then unlink the -temporary file. - -The reason to use link(2) is because it won't silently clobber the destination. - -This is annoying: - - It requires an extra system call that shouldn't be necessary. - - It doesn't work on (IMO sensible) filesystems that don't support -hard links (e.g. vfat). - - It's not atomic -- there's an intermediate state where both files exist. - - It's ugly. - -The new rename flag will make this totally sensible. - -To be fair, on new enough kernels, you can also use O_TMPFILE and -linkat to achieve the same thing even more cleanly." - -Suggested-by: Andy Lutomirski -Signed-off-by: Miklos Szeredi -Reviewed-by: J. Bruce Fields -(cherry picked from commit 0a7c3937a1f23f8cb5fc77ae01661e9968a51d0c) -Signed-off-by: Alex Shi ---- - fs/ext4/namei.c | 11 +++++++++++ - fs/namei.c | 21 +++++++++++++-------- - include/uapi/linux/fs.h | 2 ++ - 3 files changed, 26 insertions(+), 8 deletions(-) - -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 2dcbfb6..f0598d6 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -3191,6 +3191,16 @@ end_rename: - return retval; - } - -+static int ext4_rename2(struct inode *old_dir, struct dentry *old_dentry, -+ struct inode *new_dir, struct dentry *new_dentry, -+ unsigned int flags) -+{ -+ if (flags & ~RENAME_NOREPLACE) -+ return -EINVAL; -+ -+ return ext4_rename(old_dir, old_dentry, new_dir, new_dentry); -+} -+ - /* - * directories can handle most operations... - */ -@@ -3205,6 +3215,7 @@ const struct inode_operations ext4_dir_inode_operations = { - .mknod = ext4_mknod, - .tmpfile = ext4_tmpfile, - .rename = ext4_rename, -+ .rename2 = ext4_rename2, - .setattr = ext4_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, -diff --git a/fs/namei.c b/fs/namei.c -index 5134f8c..3f2cc3c 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4146,7 +4146,7 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, - bool should_retry = false; - int error; - -- if (flags) -+ if (flags & ~RENAME_NOREPLACE) - return -EINVAL; - - retry: -@@ -4172,6 +4172,8 @@ retry: - goto exit2; - - new_dir = newnd.path.dentry; -+ if (flags & RENAME_NOREPLACE) -+ error = -EEXIST; - if (newnd.last_type != LAST_NORM) - goto exit2; - -@@ -4194,22 +4196,25 @@ retry_deleg: - error = -ENOENT; - if (d_is_negative(old_dentry)) - goto exit4; -+ new_dentry = lookup_hash(&newnd); -+ error = PTR_ERR(new_dentry); -+ if (IS_ERR(new_dentry)) -+ goto exit4; -+ error = -EEXIST; -+ if ((flags & RENAME_NOREPLACE) && d_is_positive(new_dentry)) -+ goto exit5; - /* unless the source is a directory trailing slashes give -ENOTDIR */ - if (!d_is_dir(old_dentry)) { - error = -ENOTDIR; - if (oldnd.last.name[oldnd.last.len]) -- goto exit4; -+ goto exit5; - if (newnd.last.name[newnd.last.len]) -- goto exit4; -+ goto exit5; - } - /* source should not be ancestor of target */ - error = -EINVAL; - if (old_dentry == trap) -- goto exit4; -- new_dentry = lookup_hash(&newnd); -- error = PTR_ERR(new_dentry); -- if (IS_ERR(new_dentry)) -- goto exit4; -+ goto exit5; - /* target should not be an ancestor of source */ - error = -ENOTEMPTY; - if (new_dentry == trap) -diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h -index 6c28b61..9250f4d 100644 ---- a/include/uapi/linux/fs.h -+++ b/include/uapi/linux/fs.h -@@ -35,6 +35,8 @@ - #define SEEK_HOLE 4 /* seek to the next hole */ - #define SEEK_MAX SEEK_HOLE - -+#define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ -+ - struct fstrim_range { - __u64 start; - __u64 len; --- -2.7.4 - - -From 5371fcd46e9276f4216e329ba2714d595a384a1f Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 1 Apr 2014 17:08:43 +0200 -Subject: [PATCH 05/73] security: add flags to rename hooks - -Add flags to security_path_rename() and security_inode_rename() hooks. - -Signed-off-by: Miklos Szeredi -Reviewed-by: J. Bruce Fields -(cherry picked from commit 0b3974eb04c4874e85fa1d4fc70450d12f28611d) -Signed-off-by: Alex Shi ---- - fs/cachefiles/namei.c | 2 +- - fs/namei.c | 5 +++-- - include/linux/security.h | 12 ++++++++---- - security/security.c | 6 ++++-- - 4 files changed, 16 insertions(+), 9 deletions(-) - -diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c -index 31088a9..6494d9f 100644 ---- a/fs/cachefiles/namei.c -+++ b/fs/cachefiles/namei.c -@@ -391,7 +391,7 @@ try_again: - path.dentry = dir; - path_to_graveyard.mnt = cache->mnt; - path_to_graveyard.dentry = cache->graveyard; -- ret = security_path_rename(&path, rep, &path_to_graveyard, grave); -+ ret = security_path_rename(&path, rep, &path_to_graveyard, grave, 0); - if (ret < 0) { - cachefiles_io_error(cache, "Rename security error %d", ret); - } else { -diff --git a/fs/namei.c b/fs/namei.c -index 3f2cc3c..137a7b8 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4066,7 +4066,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - return error; - } - -- error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry); -+ error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry, -+ flags); - if (error) - return error; - -@@ -4221,7 +4222,7 @@ retry_deleg: - goto exit5; - - error = security_path_rename(&oldnd.path, old_dentry, -- &newnd.path, new_dentry); -+ &newnd.path, new_dentry, flags); - if (error) - goto exit5; - error = vfs_rename(old_dir->d_inode, old_dentry, -diff --git a/include/linux/security.h b/include/linux/security.h -index 2fc42d1..6478ce3 100644 ---- a/include/linux/security.h -+++ b/include/linux/security.h -@@ -1793,7 +1793,8 @@ int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) - int security_inode_rmdir(struct inode *dir, struct dentry *dentry); - int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev); - int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, -- struct inode *new_dir, struct dentry *new_dentry); -+ struct inode *new_dir, struct dentry *new_dentry, -+ unsigned int flags); - int security_inode_readlink(struct dentry *dentry); - int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); - int security_inode_permission(struct inode *inode, int mask); -@@ -2161,7 +2162,8 @@ static inline int security_inode_mknod(struct inode *dir, - static inline int security_inode_rename(struct inode *old_dir, - struct dentry *old_dentry, - struct inode *new_dir, -- struct dentry *new_dentry) -+ struct dentry *new_dentry, -+ unsigned int flags) - { - return 0; - } -@@ -2955,7 +2957,8 @@ int security_path_symlink(struct path *dir, struct dentry *dentry, - int security_path_link(struct dentry *old_dentry, struct path *new_dir, - struct dentry *new_dentry); - int security_path_rename(struct path *old_dir, struct dentry *old_dentry, -- struct path *new_dir, struct dentry *new_dentry); -+ struct path *new_dir, struct dentry *new_dentry, -+ unsigned int flags); - int security_path_chmod(struct path *path, umode_t mode); - int security_path_chown(struct path *path, kuid_t uid, kgid_t gid); - int security_path_chroot(struct path *path); -@@ -3003,7 +3006,8 @@ static inline int security_path_link(struct dentry *old_dentry, - static inline int security_path_rename(struct path *old_dir, - struct dentry *old_dentry, - struct path *new_dir, -- struct dentry *new_dentry) -+ struct dentry *new_dentry, -+ unsigned int flags) - { - return 0; - } -diff --git a/security/security.c b/security/security.c -index 919cad9..284fbc9 100644 ---- a/security/security.c -+++ b/security/security.c -@@ -433,7 +433,8 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, - } - - int security_path_rename(struct path *old_dir, struct dentry *old_dentry, -- struct path *new_dir, struct dentry *new_dentry) -+ struct path *new_dir, struct dentry *new_dentry, -+ unsigned int flags) - { - if (unlikely(IS_PRIVATE(old_dentry->d_inode) || - (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) -@@ -524,7 +525,8 @@ int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, - } - - int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, -- struct inode *new_dir, struct dentry *new_dentry) -+ struct inode *new_dir, struct dentry *new_dentry, -+ unsigned int flags) - { - if (unlikely(IS_PRIVATE(old_dentry->d_inode) || - (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) --- -2.7.4 - - -From c3ae3e8840e6b555949cda895d885ad91c5e3f24 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 1 Apr 2014 17:08:43 +0200 -Subject: [PATCH 06/73] vfs: add cross-rename - -If flags contain RENAME_EXCHANGE then exchange source and destination files. -There's no restriction on the type of the files; e.g. a directory can be -exchanged with a symlink. - -Signed-off-by: Miklos Szeredi -Reviewed-by: Jan Kara -Reviewed-by: J. Bruce Fields -(cherry picked from commit da1ce0670c14d8380e423a3239e562a1dc15fa9e) -Signed-off-by: Alex Shi ---- - fs/dcache.c | 50 ++++++++++++++++++----- - fs/namei.c | 104 +++++++++++++++++++++++++++++++++--------------- - include/linux/dcache.h | 1 + - include/uapi/linux/fs.h | 1 + - security/security.c | 16 ++++++++ - 5 files changed, 131 insertions(+), 41 deletions(-) - -diff --git a/fs/dcache.c b/fs/dcache.c -index 4366127..e3c5563 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -2481,12 +2481,14 @@ static void switch_names(struct dentry *dentry, struct dentry *target) - dentry->d_name.name = dentry->d_iname; - } else { - /* -- * Both are internal. Just copy target to dentry -+ * Both are internal. - */ -- memcpy(dentry->d_iname, target->d_name.name, -- target->d_name.len + 1); -- dentry->d_name.len = target->d_name.len; -- return; -+ unsigned int i; -+ BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); -+ for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { -+ swap(((long *) &dentry->d_iname)[i], -+ ((long *) &target->d_iname)[i]); -+ } - } - } - swap(dentry->d_name.len, target->d_name.len); -@@ -2543,13 +2545,15 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry, - * __d_move - move a dentry - * @dentry: entry to move - * @target: new dentry -+ * @exchange: exchange the two dentries - * - * Update the dcache to reflect the move of a file name. Negative - * dcache entries should not be moved in this way. Caller must hold - * rename_lock, the i_mutex of the source and target directories, - * and the sb->s_vfs_rename_mutex if they differ. See lock_rename(). - */ --static void __d_move(struct dentry * dentry, struct dentry * target) -+static void __d_move(struct dentry *dentry, struct dentry *target, -+ bool exchange) - { - if (!dentry->d_inode) - printk(KERN_WARNING "VFS: moving negative dcache entry\n"); -@@ -2571,8 +2575,15 @@ static void __d_move(struct dentry * dentry, struct dentry * target) - __d_drop(dentry); - __d_rehash(dentry, d_hash(target->d_parent, target->d_name.hash)); - -- /* Unhash the target: dput() will then get rid of it */ -+ /* -+ * Unhash the target (d_delete() is not usable here). If exchanging -+ * the two dentries, then rehash onto the other's hash queue. -+ */ - __d_drop(target); -+ if (exchange) { -+ __d_rehash(target, -+ d_hash(dentry->d_parent, dentry->d_name.hash)); -+ } - - list_del(&dentry->d_u.d_child); - list_del(&target->d_u.d_child); -@@ -2599,6 +2610,8 @@ static void __d_move(struct dentry * dentry, struct dentry * target) - write_seqcount_end(&dentry->d_seq); - - dentry_unlock_parents_for_move(dentry, target); -+ if (exchange) -+ fsnotify_d_move(target); - spin_unlock(&target->d_lock); - fsnotify_d_move(dentry); - spin_unlock(&dentry->d_lock); -@@ -2616,11 +2629,30 @@ static void __d_move(struct dentry * dentry, struct dentry * target) - void d_move(struct dentry *dentry, struct dentry *target) - { - write_seqlock(&rename_lock); -- __d_move(dentry, target); -+ __d_move(dentry, target, false); - write_sequnlock(&rename_lock); - } - EXPORT_SYMBOL(d_move); - -+/* -+ * d_exchange - exchange two dentries -+ * @dentry1: first dentry -+ * @dentry2: second dentry -+ */ -+void d_exchange(struct dentry *dentry1, struct dentry *dentry2) -+{ -+ write_seqlock(&rename_lock); -+ -+ WARN_ON(!dentry1->d_inode); -+ WARN_ON(!dentry2->d_inode); -+ WARN_ON(IS_ROOT(dentry1)); -+ WARN_ON(IS_ROOT(dentry2)); -+ -+ __d_move(dentry1, dentry2, true); -+ -+ write_sequnlock(&rename_lock); -+} -+ - /** - * d_ancestor - search for an ancestor - * @p1: ancestor dentry -@@ -2668,7 +2700,7 @@ static struct dentry *__d_unalias(struct inode *inode, - m2 = &alias->d_parent->d_inode->i_mutex; - out_unalias: - if (likely(!d_mountpoint(alias))) { -- __d_move(alias, dentry); -+ __d_move(alias, dentry, false); - ret = alias; - } - out_err: -diff --git a/fs/namei.c b/fs/namei.c -index 137a7b8..5e41971 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4035,6 +4035,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - const unsigned char *old_name; - struct inode *source = old_dentry->d_inode; - struct inode *target = new_dentry->d_inode; -+ bool new_is_dir = false; -+ unsigned max_links = new_dir->i_sb->s_max_links; - - if (source == target) - return 0; -@@ -4043,10 +4045,16 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - if (error) - return error; - -- if (!target) -+ if (!target) { - error = may_create(new_dir, new_dentry); -- else -- error = may_delete(new_dir, new_dentry, is_dir); -+ } else { -+ new_is_dir = d_is_dir(new_dentry); -+ -+ if (!(flags & RENAME_EXCHANGE)) -+ error = may_delete(new_dir, new_dentry, is_dir); -+ else -+ error = may_delete(new_dir, new_dentry, new_is_dir); -+ } - if (error) - return error; - -@@ -4060,10 +4068,17 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - * If we are going to change the parent - check write permissions, - * we'll need to flip '..'. - */ -- if (is_dir && new_dir != old_dir) { -- error = inode_permission(source, MAY_WRITE); -- if (error) -- return error; -+ if (new_dir != old_dir) { -+ if (is_dir) { -+ error = inode_permission(source, MAY_WRITE); -+ if (error) -+ return error; -+ } -+ if ((flags & RENAME_EXCHANGE) && new_is_dir) { -+ error = inode_permission(target, MAY_WRITE); -+ if (error) -+ return error; -+ } - } - - error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry, -@@ -4073,7 +4088,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - - old_name = fsnotify_oldname_init(old_dentry->d_name.name); - dget(new_dentry); -- if (!is_dir) -+ if (!is_dir || (flags & RENAME_EXCHANGE)) - lock_two_nondirectories(source, target); - else if (target) - mutex_lock(&target->i_mutex); -@@ -4082,25 +4097,25 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - if (d_mountpoint(old_dentry) || d_mountpoint(new_dentry)) - goto out; - -- if (is_dir) { -- unsigned max_links = new_dir->i_sb->s_max_links; -- -+ if (max_links && new_dir != old_dir) { - error = -EMLINK; -- if (max_links && !target && new_dir != old_dir && -- new_dir->i_nlink >= max_links) -+ if (is_dir && !new_is_dir && new_dir->i_nlink >= max_links) - goto out; -- -- if (target) -- shrink_dcache_parent(new_dentry); -- } else { -+ if ((flags & RENAME_EXCHANGE) && !is_dir && new_is_dir && -+ old_dir->i_nlink >= max_links) -+ goto out; -+ } -+ if (is_dir && !(flags & RENAME_EXCHANGE) && target) -+ shrink_dcache_parent(new_dentry); -+ if (!is_dir) { - error = try_break_deleg(source, delegated_inode); - if (error) - goto out; -- if (target) { -- error = try_break_deleg(target, delegated_inode); -- if (error) -- goto out; -- } -+ } -+ if (target && !new_is_dir) { -+ error = try_break_deleg(target, delegated_inode); -+ if (error) -+ goto out; - } - if (!flags) { - error = old_dir->i_op->rename(old_dir, old_dentry, -@@ -4112,22 +4127,31 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - if (error) - goto out; - -- if (target) { -+ if (!(flags & RENAME_EXCHANGE) && target) { - if (is_dir) - target->i_flags |= S_DEAD; - dont_mount(new_dentry); - } -- if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) -- d_move(old_dentry, new_dentry); -+ if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) { -+ if (!(flags & RENAME_EXCHANGE)) -+ d_move(old_dentry, new_dentry); -+ else -+ d_exchange(old_dentry, new_dentry); -+ } - out: -- if (!is_dir) -+ if (!is_dir || (flags & RENAME_EXCHANGE)) - unlock_two_nondirectories(source, target); - else if (target) - mutex_unlock(&target->i_mutex); - dput(new_dentry); -- if (!error) -+ if (!error) { - fsnotify_move(old_dir, new_dir, old_name, is_dir, -- target, old_dentry); -+ !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry); -+ if (flags & RENAME_EXCHANGE) { -+ fsnotify_move(new_dir, old_dir, old_dentry->d_name.name, -+ new_is_dir, NULL, new_dentry); -+ } -+ } - fsnotify_oldname_free(old_name); - - return error; -@@ -4147,7 +4171,10 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, - bool should_retry = false; - int error; - -- if (flags & ~RENAME_NOREPLACE) -+ if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) -+ return -EINVAL; -+ -+ if ((flags & RENAME_NOREPLACE) && (flags & RENAME_EXCHANGE)) - return -EINVAL; - - retry: -@@ -4184,7 +4211,8 @@ retry: - - oldnd.flags &= ~LOOKUP_PARENT; - newnd.flags &= ~LOOKUP_PARENT; -- newnd.flags |= LOOKUP_RENAME_TARGET; -+ if (!(flags & RENAME_EXCHANGE)) -+ newnd.flags |= LOOKUP_RENAME_TARGET; - - retry_deleg: - trap = lock_rename(new_dir, old_dir); -@@ -4204,12 +4232,23 @@ retry_deleg: - error = -EEXIST; - if ((flags & RENAME_NOREPLACE) && d_is_positive(new_dentry)) - goto exit5; -+ if (flags & RENAME_EXCHANGE) { -+ error = -ENOENT; -+ if (d_is_negative(new_dentry)) -+ goto exit5; -+ -+ if (!d_is_dir(new_dentry)) { -+ error = -ENOTDIR; -+ if (newnd.last.name[newnd.last.len]) -+ goto exit5; -+ } -+ } - /* unless the source is a directory trailing slashes give -ENOTDIR */ - if (!d_is_dir(old_dentry)) { - error = -ENOTDIR; - if (oldnd.last.name[oldnd.last.len]) - goto exit5; -- if (newnd.last.name[newnd.last.len]) -+ if (!(flags & RENAME_EXCHANGE) && newnd.last.name[newnd.last.len]) - goto exit5; - } - /* source should not be ancestor of target */ -@@ -4217,7 +4256,8 @@ retry_deleg: - if (old_dentry == trap) - goto exit5; - /* target should not be an ancestor of source */ -- error = -ENOTEMPTY; -+ if (!(flags & RENAME_EXCHANGE)) -+ error = -ENOTEMPTY; - if (new_dentry == trap) - goto exit5; - -diff --git a/include/linux/dcache.h b/include/linux/dcache.h -index 3b50cac..3b9bfdb 100644 ---- a/include/linux/dcache.h -+++ b/include/linux/dcache.h -@@ -308,6 +308,7 @@ extern void dentry_update_name_case(struct dentry *, struct qstr *); - - /* used for rename() and baskets */ - extern void d_move(struct dentry *, struct dentry *); -+extern void d_exchange(struct dentry *, struct dentry *); - extern struct dentry *d_ancestor(struct dentry *, struct dentry *); - - /* appendix may either be NULL or be used for transname suffixes */ -diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h -index 9250f4d..ca1a11b 100644 ---- a/include/uapi/linux/fs.h -+++ b/include/uapi/linux/fs.h -@@ -36,6 +36,7 @@ - #define SEEK_MAX SEEK_HOLE - - #define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ -+#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ - - struct fstrim_range { - __u64 start; -diff --git a/security/security.c b/security/security.c -index 284fbc9..8b774f3 100644 ---- a/security/security.c -+++ b/security/security.c -@@ -439,6 +439,14 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry, - if (unlikely(IS_PRIVATE(old_dentry->d_inode) || - (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) - return 0; -+ -+ if (flags & RENAME_EXCHANGE) { -+ int err = security_ops->path_rename(new_dir, new_dentry, -+ old_dir, old_dentry); -+ if (err) -+ return err; -+ } -+ - return security_ops->path_rename(old_dir, old_dentry, new_dir, - new_dentry); - } -@@ -531,6 +539,14 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, - if (unlikely(IS_PRIVATE(old_dentry->d_inode) || - (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) - return 0; -+ -+ if (flags & RENAME_EXCHANGE) { -+ int err = security_ops->inode_rename(new_dir, new_dentry, -+ old_dir, old_dentry); -+ if (err) -+ return err; -+ } -+ - return security_ops->inode_rename(old_dir, old_dentry, - new_dir, new_dentry); - } --- -2.7.4 - - -From a756aea51bb937b6a150c4d1cfff66824285491d Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Wed, 23 Jul 2014 15:15:30 +0200 -Subject: [PATCH 07/73] fs: call rename2 if exists - -Christoph Hellwig suggests: - -1) make vfs_rename call ->rename2 if it exists instead of ->rename -2) switch all filesystems that you're adding NOREPLACE support for to - use ->rename2 -3) see how many ->rename instances we'll have left after a few - iterations of 2. - -Signed-off-by: Miklos Szeredi -Signed-off-by: Christoph Hellwig -Signed-off-by: Al Viro -(cherry picked from commit 7177a9c4b509eb357cc450256bc3cf39f1a1e639) -Signed-off-by: Alex Shi - - Conflicts: - fs/fuse/dir.c ---- - fs/ext4/namei.c | 1 - - fs/fuse/dir.c | 32 +++++++++++++++++++++++++++++++- - fs/namei.c | 5 +++-- - 3 files changed, 34 insertions(+), 4 deletions(-) - -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index f0598d6..98de4b3 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -3214,7 +3214,6 @@ const struct inode_operations ext4_dir_inode_operations = { - .rmdir = ext4_rmdir, - .mknod = ext4_mknod, - .tmpfile = ext4_tmpfile, -- .rename = ext4_rename, - .rename2 = ext4_rename2, - .setattr = ext4_setattr, - .setxattr = generic_setxattr, -diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c -index 342f0239..d53a7d9 100644 ---- a/fs/fuse/dir.c -+++ b/fs/fuse/dir.c -@@ -796,6 +796,36 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent, - return err; - } - -+static int fuse_rename2(struct inode *olddir, struct dentry *oldent, -+ struct inode *newdir, struct dentry *newent, -+ unsigned int flags) -+{ -+ struct fuse_conn *fc = get_fuse_conn(olddir); -+ int err; -+ -+ if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) -+ return -EINVAL; -+ -+ if (flags) { -+ if (fc->no_rename2 || fc->minor < 23) -+ return -EINVAL; -+ -+ err = fuse_rename_common(olddir, oldent, newdir, newent, flags, -+ FUSE_RENAME2, -+ sizeof(struct fuse_rename2_in)); -+ if (err == -ENOSYS) { -+ fc->no_rename2 = 1; -+ err = -EINVAL; -+ } -+ } else { -+ err = fuse_rename_common(olddir, oldent, newdir, newent, 0, -+ FUSE_RENAME, -+ sizeof(struct fuse_rename_in)); -+ } -+ -+ return err; -+} -+ - static int fuse_link(struct dentry *entry, struct inode *newdir, - struct dentry *newent) - { -@@ -1882,7 +1912,7 @@ static const struct inode_operations fuse_dir_inode_operations = { - .symlink = fuse_symlink, - .unlink = fuse_unlink, - .rmdir = fuse_rmdir, -- .rename = fuse_rename, -+ .rename2 = fuse_rename2, - .link = fuse_link, - .setattr = fuse_setattr, - .create = fuse_create, -diff --git a/fs/namei.c b/fs/namei.c -index 5e41971..fa7dd2d 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4058,7 +4058,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - if (error) - return error; - -- if (!old_dir->i_op->rename) -+ if (!old_dir->i_op->rename && !old_dir->i_op->rename2) - return -EPERM; - - if (flags && !old_dir->i_op->rename2) -@@ -4117,10 +4117,11 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, - if (error) - goto out; - } -- if (!flags) { -+ if (!old_dir->i_op->rename2) { - error = old_dir->i_op->rename(old_dir, old_dentry, - new_dir, new_dentry); - } else { -+ WARN_ON(old_dir->i_op->rename != NULL); - error = old_dir->i_op->rename2(old_dir, old_dentry, - new_dir, new_dentry, flags); - } --- -2.7.4 - - -From c5948f26c2de38f3b475d10cfb6695245f52b6ff Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Sat, 1 Feb 2014 04:43:32 -0500 -Subject: [PATCH 08/73] get rid of pointless checks for NULL ->i_op - -Signed-off-by: Al Viro -(cherry picked from commit 627bf81ac625f05060db033a0f3791521ad7bd79) -Signed-off-by: Alex Shi ---- - fs/cachefiles/bind.c | 1 - - fs/cachefiles/namei.c | 3 +-- - security/integrity/evm/evm_crypto.c | 2 +- - security/integrity/evm/evm_main.c | 2 +- - security/tomoyo/realpath.c | 4 ++-- - 5 files changed, 5 insertions(+), 7 deletions(-) - -diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c -index 622f469..5b99baf 100644 ---- a/fs/cachefiles/bind.c -+++ b/fs/cachefiles/bind.c -@@ -124,7 +124,6 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) - /* check parameters */ - ret = -EOPNOTSUPP; - if (!root->d_inode || -- !root->d_inode->i_op || - !root->d_inode->i_op->lookup || - !root->d_inode->i_op->mkdir || - !root->d_inode->i_op->setxattr || -diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c -index 6494d9f..c0a6817 100644 ---- a/fs/cachefiles/namei.c -+++ b/fs/cachefiles/namei.c -@@ -779,8 +779,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, - } - - ret = -EPERM; -- if (!subdir->d_inode->i_op || -- !subdir->d_inode->i_op->setxattr || -+ if (!subdir->d_inode->i_op->setxattr || - !subdir->d_inode->i_op->getxattr || - !subdir->d_inode->i_op->lookup || - !subdir->d_inode->i_op->mkdir || -diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c -index 3bab89e..e90ab0e 100644 ---- a/security/integrity/evm/evm_crypto.c -+++ b/security/integrity/evm/evm_crypto.c -@@ -137,7 +137,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry, - int error; - int size; - -- if (!inode->i_op || !inode->i_op->getxattr) -+ if (!inode->i_op->getxattr) - return -EOPNOTSUPP; - desc = init_desc(type); - if (IS_ERR(desc)) -diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c -index 7e71e06..690cd63 100644 ---- a/security/integrity/evm/evm_main.c -+++ b/security/integrity/evm/evm_main.c -@@ -62,7 +62,7 @@ static int evm_find_protected_xattrs(struct dentry *dentry) - int error; - int count = 0; - -- if (!inode->i_op || !inode->i_op->getxattr) -+ if (!inode->i_op->getxattr) - return -EOPNOTSUPP; - - for (xattr = evm_config_xattrnames; *xattr != NULL; xattr++) { -diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c -index 80a09c3..a3386d1 100644 ---- a/security/tomoyo/realpath.c -+++ b/security/tomoyo/realpath.c -@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer, - * Use filesystem name if filesystem does not support rename() - * operation. - */ -- if (inode->i_op && !inode->i_op->rename) -+ if (!inode->i_op->rename) - goto prepend_filesystem_name; - } - /* Prepend device name. */ -@@ -282,7 +282,7 @@ char *tomoyo_realpath_from_path(struct path *path) - * Get local name for filesystems without rename() operation - * or dentry without vfsmount. - */ -- if (!path->mnt || (inode->i_op && !inode->i_op->rename)) -+ if (!path->mnt || !inode->i_op->rename) - pos = tomoyo_get_local_path(path->dentry, buf, - buf_len - 1); - /* Get absolute name for the rest. */ --- -2.7.4 - - -From bb9934859afca84e19c3213060f2f2eeaff5d6a1 Mon Sep 17 00:00:00 2001 -From: Tetsuo Handa -Date: Wed, 20 Aug 2014 14:14:04 +0900 -Subject: [PATCH 09/73] tomoyo: Fix pathname calculation breakage. - -Commit 7177a9c4b509 ("fs: call rename2 if exists") changed -"struct inode_operations"->rename == NULL if -"struct inode_operations"->rename2 != NULL . - -TOMOYO needs to check for both ->rename and ->rename2 , or -a system on (e.g.) ext4 filesystem won't boot. - -Signed-off-by: Tetsuo Handa -Signed-off-by: Serge E. Hallyn -(cherry picked from commit 8fe7a268b18ebc89203c766b020b9e32f1cfeebf) -Signed-off-by: Alex Shi ---- - security/tomoyo/realpath.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c -index a3386d1..bed745c 100644 ---- a/security/tomoyo/realpath.c -+++ b/security/tomoyo/realpath.c -@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer, - * Use filesystem name if filesystem does not support rename() - * operation. - */ -- if (!inode->i_op->rename) -+ if (!inode->i_op->rename && !inode->i_op->rename2) - goto prepend_filesystem_name; - } - /* Prepend device name. */ -@@ -282,7 +282,8 @@ char *tomoyo_realpath_from_path(struct path *path) - * Get local name for filesystems without rename() operation - * or dentry without vfsmount. - */ -- if (!path->mnt || !inode->i_op->rename) -+ if (!path->mnt || -+ (!inode->i_op->rename && !inode->i_op->rename2)) - pos = tomoyo_get_local_path(path->dentry, buf, - buf_len - 1); - /* Get absolute name for the rest. */ --- -2.7.4 - - -From 0750d56323044df86224bb9aa3d0830bada1cb81 Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Fri, 14 Mar 2014 13:42:45 -0400 -Subject: [PATCH 10/73] new helper: readlink_copy() - -Signed-off-by: Al Viro -(cherry picked from commit 5d826c847b34de6415b4f1becd88a57ff619af50) -Signed-off-by: Alex Shi - - Conflicts: - fs/namei.c ---- - fs/namei.c | 12 ++++-------- - fs/proc/namespaces.c | 14 ++++---------- - fs/proc/self.c | 2 +- - fs/xfs/xfs_ioctl.c | 28 +--------------------------- - include/linux/fs.h | 2 +- - 5 files changed, 11 insertions(+), 47 deletions(-) - -diff --git a/fs/namei.c b/fs/namei.c -index fa7dd2d..ef28dcd 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4309,11 +4309,9 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna - return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0); - } - --int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link) -+int readlink_copy(char __user *buffer, int buflen, const char *link) - { -- int len; -- -- len = PTR_ERR(link); -+ int len = PTR_ERR(link); - if (IS_ERR(link)) - goto out; - -@@ -4342,7 +4340,7 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) - if (IS_ERR(cookie)) - return PTR_ERR(cookie); - -- res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); -+ res = readlink_copy(buffer, buflen, nd_get_link(&nd)); - if (dentry->d_inode->i_op->put_link) - dentry->d_inode->i_op->put_link(dentry, &nd, cookie); - return res; -@@ -4366,8 +4364,7 @@ static char *page_getlink(struct dentry * dentry, struct page **ppage) - int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) - { - struct page *page = NULL; -- char *s = page_getlink(dentry, &page); -- int res = vfs_readlink(dentry,buffer,buflen,s); -+ int res = readlink_copy(buffer, buflen, page_getlink(dentry, &page)); - if (page) { - kunmap(page); - page_cache_release(page); -@@ -4463,7 +4460,6 @@ EXPORT_SYMBOL(vfs_link); - EXPORT_SYMBOL(vfs_mkdir); - EXPORT_SYMBOL(vfs_mknod); - EXPORT_SYMBOL(generic_permission); --EXPORT_SYMBOL(vfs_readlink); - EXPORT_SYMBOL(vfs_rename); - EXPORT_SYMBOL(vfs_rmdir); - EXPORT_SYMBOL(vfs_symlink); -diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c -index 9ae46b8..8902609 100644 ---- a/fs/proc/namespaces.c -+++ b/fs/proc/namespaces.c -@@ -146,7 +146,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl - struct task_struct *task; - void *ns; - char name[50]; -- int len = -EACCES; -+ int res = -EACCES; - - task = get_proc_task(inode); - if (!task) -@@ -155,24 +155,18 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl - if (!ptrace_may_access(task, PTRACE_MODE_READ)) - goto out_put_task; - -- len = -ENOENT; -+ res = -ENOENT; - ns = ns_ops->get(task); - if (!ns) - goto out_put_task; - - snprintf(name, sizeof(name), "%s:[%u]", ns_ops->name, ns_ops->inum(ns)); -- len = strlen(name); -- -- if (len > buflen) -- len = buflen; -- if (copy_to_user(buffer, name, len)) -- len = -EFAULT; -- -+ res = readlink_copy(buffer, buflen, name); - ns_ops->put(ns); - out_put_task: - put_task_struct(task); - out: -- return len; -+ return res; - } - - static const struct inode_operations proc_ns_link_inode_operations = { -diff --git a/fs/proc/self.c b/fs/proc/self.c -index ffeb202..4348bb8 100644 ---- a/fs/proc/self.c -+++ b/fs/proc/self.c -@@ -16,7 +16,7 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer, - if (!tgid) - return -ENOENT; - sprintf(tmp, "%d", tgid); -- return vfs_readlink(dentry,buffer,buflen,tmp); -+ return readlink_copy(buffer, buflen, tmp); - } - - static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) -diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c -index 78e62cc..6152cbe 100644 ---- a/fs/xfs/xfs_ioctl.c -+++ b/fs/xfs/xfs_ioctl.c -@@ -271,32 +271,6 @@ xfs_open_by_handle( - return error; - } - --/* -- * This is a copy from fs/namei.c:vfs_readlink(), except for removing it's -- * unused first argument. -- */ --STATIC int --do_readlink( -- char __user *buffer, -- int buflen, -- const char *link) --{ -- int len; -- -- len = PTR_ERR(link); -- if (IS_ERR(link)) -- goto out; -- -- len = strlen(link); -- if (len > (unsigned) buflen) -- len = buflen; -- if (copy_to_user(buffer, link, len)) -- len = -EFAULT; -- out: -- return len; --} -- -- - int - xfs_readlink_by_handle( - struct file *parfilp, -@@ -334,7 +308,7 @@ xfs_readlink_by_handle( - error = -xfs_readlink(XFS_I(dentry->d_inode), link); - if (error) - goto out_kfree; -- error = do_readlink(hreq->ohandle, olen, link); -+ error = readlink_copy(hreq->ohandle, olen, link); - if (error) - goto out_kfree; - -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 3b3670e..29170bf 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -2566,7 +2566,7 @@ extern const struct file_operations generic_ro_fops; - - #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) - --extern int vfs_readlink(struct dentry *, char __user *, int, const char *); -+extern int readlink_copy(char __user *, int, const char *); - extern int page_readlink(struct dentry *, char __user *, int); - extern void *page_follow_link_light(struct dentry *, struct nameidata *); - extern void page_put_link(struct dentry *, struct nameidata *, void *); --- -2.7.4 - - -From 6c1a7bfb6a5ac8cf057fd191acd8f28b23c60dd4 Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Fri, 14 Mar 2014 12:54:25 -0400 -Subject: [PATCH 11/73] lustre: generic_readlink() is just fine there, TYVM... - -Signed-off-by: Al Viro -(cherry picked from commit 4efcc9ffcd4fc53f1f7de539842cdffa1f8e5ecc) -Signed-off-by: Alex Shi ---- - drivers/staging/lustre/lustre/llite/symlink.c | 23 +---------------------- - 1 file changed, 1 insertion(+), 22 deletions(-) - -diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c -index ab06891..80d48b5 100644 ---- a/drivers/staging/lustre/lustre/llite/symlink.c -+++ b/drivers/staging/lustre/lustre/llite/symlink.c -@@ -115,27 +115,6 @@ failed: - return rc; - } - --static int ll_readlink(struct dentry *dentry, char *buffer, int buflen) --{ -- struct inode *inode = dentry->d_inode; -- struct ptlrpc_request *request; -- char *symname; -- int rc; -- -- CDEBUG(D_VFSTRACE, "VFS Op\n"); -- -- ll_inode_size_lock(inode); -- rc = ll_readlink_internal(inode, &request, &symname); -- if (rc) -- GOTO(out, rc); -- -- rc = vfs_readlink(dentry, buffer, buflen, symname); -- out: -- ptlrpc_req_finished(request); -- ll_inode_size_unlock(inode); -- return rc; --} -- - static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) - { - struct inode *inode = dentry->d_inode; -@@ -175,7 +154,7 @@ static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cooki - } - - struct inode_operations ll_fast_symlink_inode_operations = { -- .readlink = ll_readlink, -+ .readlink = generic_readlink, - .setattr = ll_setattr, - .follow_link = ll_follow_link, - .put_link = ll_put_link, --- -2.7.4 - - -From 71732036259eac84c4b4add5b7503a0f01905bc4 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:35 +0200 -Subject: [PATCH 12/73] vfs: add i_op->dentry_open() - -Add a new inode operation i_op->dentry_open(). This is for stacked filesystems -that want to return a struct file from a different filesystem. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 4aa7c6346be395bdf776f82bbb2e3e2bc60bdd2b) -Signed-off-by: Alex Shi ---- - Documentation/filesystems/Locking | 2 ++ - Documentation/filesystems/vfs.txt | 7 +++++++ - fs/namei.c | 9 ++++++--- - fs/open.c | 23 +++++++++++++++++++++-- - include/linux/fs.h | 4 ++++ - 5 files changed, 40 insertions(+), 5 deletions(-) - -diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking -index f424e0e..821c8f4 100644 ---- a/Documentation/filesystems/Locking -+++ b/Documentation/filesystems/Locking -@@ -67,6 +67,7 @@ prototypes: - struct file *, unsigned open_flag, - umode_t create_mode, int *opened); - int (*tmpfile) (struct inode *, struct dentry *, umode_t); -+ int (*dentry_open)(struct dentry *, struct file *, const struct cred *); - - locking rules: - all may block -@@ -96,6 +97,7 @@ fiemap: no - update_time: no - atomic_open: yes - tmpfile: no -+dentry_open: no - - Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on - victim. -diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt -index 94eb862..5d06f2a 100644 ---- a/Documentation/filesystems/vfs.txt -+++ b/Documentation/filesystems/vfs.txt -@@ -364,6 +364,7 @@ struct inode_operations { - int (*atomic_open)(struct inode *, struct dentry *, struct file *, - unsigned open_flag, umode_t create_mode, int *opened); - int (*tmpfile) (struct inode *, struct dentry *, umode_t); -+ int (*dentry_open)(struct dentry *, struct file *, const struct cred *); - }; - - Again, all methods are called without any locks being held, unless -@@ -697,6 +698,12 @@ struct address_space_operations { - but instead uses bmap to find out where the blocks in the file - are and uses those addresses directly. - -+ dentry_open: *WARNING: probably going away soon, do not use!* This is an -+ alternative to f_op->open(), the difference is that this method may open -+ a file not necessarily originating from the same filesystem as the one -+ i_op->open() was called on. It may be useful for stacking filesystems -+ which want to allow native I/O directly on underlying files. -+ - - invalidatepage: If a page has PagePrivate set, then invalidatepage - will be called when part or all of the page is to be removed -diff --git a/fs/namei.c b/fs/namei.c -index ef28dcd..b987228 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -3037,9 +3037,12 @@ finish_open_created: - error = may_open(&nd->path, acc_mode, open_flag); - if (error) - goto out; -- file->f_path.mnt = nd->path.mnt; -- error = finish_open(file, nd->path.dentry, NULL, opened); -- if (error) { -+ -+ BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ -+ error = vfs_open(&nd->path, file, current_cred()); -+ if (!error) { -+ *opened |= FILE_OPENED; -+ } else { - if (error == -EOPENSTALE) - goto stale_open; - goto out; -diff --git a/fs/open.c b/fs/open.c -index 2ed7325..c92c6ef 100644 ---- a/fs/open.c -+++ b/fs/open.c -@@ -822,8 +822,7 @@ struct file *dentry_open(const struct path *path, int flags, - f = get_empty_filp(); - if (!IS_ERR(f)) { - f->f_flags = flags; -- f->f_path = *path; -- error = do_dentry_open(f, NULL, cred); -+ error = vfs_open(path, f, cred); - if (!error) { - /* from now on we need fput() to dispose of f */ - error = open_check_o_direct(f); -@@ -840,6 +839,26 @@ struct file *dentry_open(const struct path *path, int flags, - } - EXPORT_SYMBOL(dentry_open); - -+/** -+ * vfs_open - open the file at the given path -+ * @path: path to open -+ * @filp: newly allocated file with f_flag initialized -+ * @cred: credentials to use -+ */ -+int vfs_open(const struct path *path, struct file *filp, -+ const struct cred *cred) -+{ -+ struct inode *inode = path->dentry->d_inode; -+ -+ if (inode->i_op->dentry_open) -+ return inode->i_op->dentry_open(path->dentry, filp, cred); -+ else { -+ filp->f_path = *path; -+ return do_dentry_open(filp, NULL, cred); -+ } -+} -+EXPORT_SYMBOL(vfs_open); -+ - static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op) - { - int lookup_flags = 0; -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 29170bf..ce38acf 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -1587,6 +1587,9 @@ struct inode_operations { - umode_t create_mode, int *opened); - int (*tmpfile) (struct inode *, struct dentry *, umode_t); - int (*set_acl)(struct inode *, struct posix_acl *, int); -+ -+ /* WARNING: probably going away soon, do not use! */ -+ int (*dentry_open)(struct dentry *, struct file *, const struct cred *); - } ____cacheline_aligned; - - ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, -@@ -2081,6 +2084,7 @@ extern struct file *file_open_name(struct filename *, int, umode_t); - extern struct file *filp_open(const char *, int, umode_t); - extern struct file *file_open_root(struct dentry *, struct vfsmount *, - const char *, int); -+extern int vfs_open(const struct path *, struct file *, const struct cred *); - extern struct file * dentry_open(const struct path *, int, const struct cred *); - extern int filp_close(struct file *, fl_owner_t id); - --- -2.7.4 - - -From 5c45fc6a9c14be17ae4d203d35fe82c6b4575de4 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:35 +0200 -Subject: [PATCH 13/73] vfs: export do_splice_direct() to modules - -Export do_splice_direct() to modules. Needed by overlay filesystem. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 1c118596a7682912106c80007102ce0184c77780) -Signed-off-by: Alex Shi ---- - fs/internal.h | 6 ------ - fs/splice.c | 1 + - include/linux/fs.h | 3 +++ - 3 files changed, 4 insertions(+), 6 deletions(-) - -diff --git a/fs/internal.h b/fs/internal.h -index 4657424..873cdf5 100644 ---- a/fs/internal.h -+++ b/fs/internal.h -@@ -135,12 +135,6 @@ extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); - extern int rw_verify_area(int, struct file *, const loff_t *, size_t); - - /* -- * splice.c -- */ --extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, -- loff_t *opos, size_t len, unsigned int flags); -- --/* - * pipe.c - */ - extern const struct file_operations pipefifo_fops; -diff --git a/fs/splice.c b/fs/splice.c -index 12028fa..ffb92b9 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1327,6 +1327,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, - - return ret; - } -+EXPORT_SYMBOL(do_splice_direct); - - static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, - struct pipe_inode_info *opipe, -diff --git a/include/linux/fs.h b/include/linux/fs.h -index ce38acf..5bcbbf3 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -2506,6 +2506,9 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *, - struct file *, loff_t *, size_t, unsigned int); - extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, - struct file *out, loff_t *, size_t len, unsigned int flags); -+extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, -+ loff_t *opos, size_t len, unsigned int flags); -+ - - extern void - file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); --- -2.7.4 - - -From 96bd0c53e4204392144978e5a40f4699570be22b Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:35 +0200 -Subject: [PATCH 14/73] vfs: export __inode_permission() to modules - -We need to be able to check inode permissions (but not filesystem implied -permissions) for stackable filesystems. Expose this interface for overlayfs. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit bd5d08569cc379f8366663a61558a9ce17c2e460) -Signed-off-by: Alex Shi ---- - fs/internal.h | 1 - - fs/namei.c | 1 + - include/linux/fs.h | 1 + - 3 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/fs/internal.h b/fs/internal.h -index 873cdf5..dd41b12 100644 ---- a/fs/internal.h -+++ b/fs/internal.h -@@ -42,7 +42,6 @@ extern void __init chrdev_init(void); - /* - * namei.c - */ --extern int __inode_permission(struct inode *, int); - extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *); - extern int vfs_path_lookup(struct dentry *, struct vfsmount *, - const char *, unsigned int, struct path *); -diff --git a/fs/namei.c b/fs/namei.c -index b987228..56b30af 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -415,6 +415,7 @@ int __inode_permission(struct inode *inode, int mask) - - return security_inode_permission(inode, mask); - } -+EXPORT_SYMBOL(__inode_permission); - - /** - * sb_permission - Check superblock-level permissions -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 5bcbbf3..82c78d6 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -2298,6 +2298,7 @@ extern sector_t bmap(struct inode *, sector_t); - #endif - extern int notify_change(struct dentry *, struct iattr *, struct inode **); - extern int inode_permission(struct inode *, int); -+extern int __inode_permission(struct inode *, int); - extern int generic_permission(struct inode *, int); - - static inline bool execute_ok(struct inode *inode) --- -2.7.4 - - -From 574c7ef9787b3b3d0513830e40323c34c2f53a39 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:36 +0200 -Subject: [PATCH 15/73] vfs: introduce clone_private_mount() - -Overlayfs needs a private clone of the mount, so create a function for -this and export to modules. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit c771d683a62e5d36bc46036f5c07f4f5bb7dda61) -Signed-off-by: Alex Shi ---- - fs/namespace.c | 27 +++++++++++++++++++++++++++ - include/linux/mount.h | 3 +++ - 2 files changed, 30 insertions(+) - -diff --git a/fs/namespace.c b/fs/namespace.c -index 039f380..c6533ce 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1586,6 +1586,33 @@ void drop_collected_mounts(struct vfsmount *mnt) - namespace_unlock(); - } - -+/** -+ * clone_private_mount - create a private clone of a path -+ * -+ * This creates a new vfsmount, which will be the clone of @path. The new will -+ * not be attached anywhere in the namespace and will be private (i.e. changes -+ * to the originating mount won't be propagated into this). -+ * -+ * Release with mntput(). -+ */ -+struct vfsmount *clone_private_mount(struct path *path) -+{ -+ struct mount *old_mnt = real_mount(path->mnt); -+ struct mount *new_mnt; -+ -+ if (IS_MNT_UNBINDABLE(old_mnt)) -+ return ERR_PTR(-EINVAL); -+ -+ down_read(&namespace_sem); -+ new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); -+ up_read(&namespace_sem); -+ if (IS_ERR(new_mnt)) -+ return ERR_CAST(new_mnt); -+ -+ return &new_mnt->mnt; -+} -+EXPORT_SYMBOL_GPL(clone_private_mount); -+ - int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, - struct vfsmount *root) - { -diff --git a/include/linux/mount.h b/include/linux/mount.h -index b0c1e65..fff78cb 100644 ---- a/include/linux/mount.h -+++ b/include/linux/mount.h -@@ -81,6 +81,9 @@ extern void mnt_pin(struct vfsmount *mnt); - extern void mnt_unpin(struct vfsmount *mnt); - extern int __mnt_is_readonly(struct vfsmount *mnt); - -+struct path; -+extern struct vfsmount *clone_private_mount(struct path *path); -+ - struct file_system_type; - extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, - int flags, const char *name, --- -2.7.4 - - -From ae311653282de97e927ff8c961a79be3ab259cb1 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:36 +0200 -Subject: [PATCH 16/73] vfs: export check_sticky() - -It's already duplicated in btrfs and about to be used in overlayfs too. - -Move the sticky bit check to an inline helper and call the out-of-line -helper only in the unlikly case of the sticky bit being set. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit cbdf35bcb833bfd00f0925d7a9a33a21f41ea582) -Signed-off-by: Alex Shi ---- - fs/btrfs/ioctl.c | 20 +------------------- - fs/namei.c | 9 ++------- - include/linux/fs.h | 9 +++++++++ - 3 files changed, 12 insertions(+), 26 deletions(-) - -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c -index 0b72006..96b95e6 100644 ---- a/fs/btrfs/ioctl.c -+++ b/fs/btrfs/ioctl.c -@@ -682,23 +682,6 @@ out: - return ret; - } - --/* copy of check_sticky in fs/namei.c() --* It's inline, so penalty for filesystems that don't use sticky bit is --* minimal. --*/ --static inline int btrfs_check_sticky(struct inode *dir, struct inode *inode) --{ -- kuid_t fsuid = current_fsuid(); -- -- if (!(dir->i_mode & S_ISVTX)) -- return 0; -- if (uid_eq(inode->i_uid, fsuid)) -- return 0; -- if (uid_eq(dir->i_uid, fsuid)) -- return 0; -- return !capable(CAP_FOWNER); --} -- - /* copy of may_delete in fs/namei.c() - * Check whether we can remove a link victim from directory dir, check - * whether the type of victim is right. -@@ -734,8 +717,7 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir) - return error; - if (IS_APPEND(dir)) - return -EPERM; -- if (btrfs_check_sticky(dir, victim->d_inode)|| -- IS_APPEND(victim->d_inode)|| -+ if (check_sticky(dir, victim->d_inode) || IS_APPEND(victim->d_inode) || - IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode)) - return -EPERM; - if (isdir) { -diff --git a/fs/namei.c b/fs/namei.c -index 56b30af..1fd5d75 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -2360,22 +2360,17 @@ kern_path_mountpoint(int dfd, const char *name, struct path *path, - } - EXPORT_SYMBOL(kern_path_mountpoint); - --/* -- * It's inline, so penalty for filesystems that don't use sticky bit is -- * minimal. -- */ --static inline int check_sticky(struct inode *dir, struct inode *inode) -+int __check_sticky(struct inode *dir, struct inode *inode) - { - kuid_t fsuid = current_fsuid(); - -- if (!(dir->i_mode & S_ISVTX)) -- return 0; - if (uid_eq(inode->i_uid, fsuid)) - return 0; - if (uid_eq(dir->i_uid, fsuid)) - return 0; - return !capable_wrt_inode_uidgid(inode, CAP_FOWNER); - } -+EXPORT_SYMBOL(__check_sticky); - - /* - * Check whether we can remove a link victim from directory dir, check -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 82c78d6..ddb9ab5 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -2300,6 +2300,7 @@ extern int notify_change(struct dentry *, struct iattr *, struct inode **); - extern int inode_permission(struct inode *, int); - extern int __inode_permission(struct inode *, int); - extern int generic_permission(struct inode *, int); -+extern int __check_sticky(struct inode *dir, struct inode *inode); - - static inline bool execute_ok(struct inode *inode) - { -@@ -2787,6 +2788,14 @@ static inline int is_sxid(umode_t mode) - return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); - } - -+static inline int check_sticky(struct inode *dir, struct inode *inode) -+{ -+ if (!(dir->i_mode & S_ISVTX)) -+ return 0; -+ -+ return __check_sticky(dir, inode); -+} -+ - static inline void inode_has_no_xattr(struct inode *inode) - { - if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) --- -2.7.4 - - -From 9354e064adb1c963fdec1d38dc43d48dee394e1e Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:36 +0200 -Subject: [PATCH 17/73] vfs: add whiteout support - -Whiteout isn't actually a new file type, but is represented as a char -device (Linus's idea) with 0/0 device number. - -This has several advantages compared to introducing a new whiteout file -type: - - - no userspace API changes (e.g. trivial to make backups of upper layer - filesystem, without losing whiteouts) - - - no fs image format changes (you can boot an old kernel/fsck without - whiteout support and things won't break) - - - implementation is trivial - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 787fb6bc9682ec7c05fb5d9561b57100fbc1cc41) -Signed-off-by: Alex Shi ---- - fs/namei.c | 14 ++++++++++++++ - include/linux/fs.h | 11 +++++++++++ - 2 files changed, 25 insertions(+) - -diff --git a/fs/namei.c b/fs/namei.c -index 1fd5d75..9a4443b 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4308,6 +4308,20 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna - return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0); - } - -+int vfs_whiteout(struct inode *dir, struct dentry *dentry) -+{ -+ int error = may_create(dir, dentry); -+ if (error) -+ return error; -+ -+ if (!dir->i_op->mknod) -+ return -EPERM; -+ -+ return dir->i_op->mknod(dir, dentry, -+ S_IFCHR | WHITEOUT_MODE, WHITEOUT_DEV); -+} -+EXPORT_SYMBOL(vfs_whiteout); -+ - int readlink_copy(char __user *buffer, int buflen, const char *link) - { - int len = PTR_ERR(link); -diff --git a/include/linux/fs.h b/include/linux/fs.h -index ddb9ab5..18492c8 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -218,6 +218,13 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, - #define ATTR_TIMES_SET (1 << 16) - - /* -+ * Whiteout is represented by a char device. The following constants define the -+ * mode and device number to use. -+ */ -+#define WHITEOUT_MODE 0 -+#define WHITEOUT_DEV 0 -+ -+/* - * This is the Inode Attributes structure, used for notify_change(). It - * uses the above definitions as flags, to know which values have changed. - * Also, in this manner, a Filesystem can look at only the values it cares -@@ -1461,6 +1468,7 @@ extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct ino - extern int vfs_rmdir(struct inode *, struct dentry *); - extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); - extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); -+extern int vfs_whiteout(struct inode *, struct dentry *); - - /* - * VFS dentry helper functions. -@@ -1687,6 +1695,9 @@ struct super_operations { - #define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) - #define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) - -+#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \ -+ (inode)->i_rdev == WHITEOUT_DEV) -+ - /* - * Inode state bits. Protected by inode->i_lock - * --- -2.7.4 - - -From 0e98d78deaf317c6524acf9c57eecdefbfdbe444 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:37 +0200 -Subject: [PATCH 18/73] vfs: add RENAME_WHITEOUT - -This adds a new RENAME_WHITEOUT flag. This flag makes rename() create a -whiteout of source. The whiteout creation is atomic relative to the -rename. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 0d7a855526dd672e114aff2ac22b60fc6f155b08) -Signed-off-by: Alex Shi ---- - fs/namei.c | 8 ++++++-- - include/uapi/linux/fs.h | 1 + - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/fs/namei.c b/fs/namei.c -index 9a4443b..a047265e 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4171,12 +4171,16 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, - bool should_retry = false; - int error; - -- if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) -+ if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) - return -EINVAL; - -- if ((flags & RENAME_NOREPLACE) && (flags & RENAME_EXCHANGE)) -+ if ((flags & (RENAME_NOREPLACE | RENAME_WHITEOUT)) && -+ (flags & RENAME_EXCHANGE)) - return -EINVAL; - -+ if ((flags & RENAME_WHITEOUT) && !capable(CAP_MKNOD)) -+ return -EPERM; -+ - retry: - from = user_path_parent(olddfd, oldname, &oldnd, lookup_flags); - if (IS_ERR(from)) { -diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h -index ca1a11b..3735fa0 100644 ---- a/include/uapi/linux/fs.h -+++ b/include/uapi/linux/fs.h -@@ -37,6 +37,7 @@ - - #define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ - #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ -+#define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ - - struct fstrim_range { - __u64 start; --- -2.7.4 - - -From c5341097e1a69ba7f5cbc938b927489ad3bef1ee Mon Sep 17 00:00:00 2001 -From: "Paul E. McKenney" -Date: Mon, 27 Oct 2014 21:11:27 -0700 -Subject: [PATCH 19/73] rcu: Provide counterpart to rcu_dereference() for - non-RCU situations - -Although rcu_dereference() and friends can be used in situations where -object lifetimes are being managed by something other than RCU, the -resulting sparse and lockdep-RCU noise can be annoying. This commit -therefore supplies a lockless_dereference(), which provides the -protection for dereferences without the RCU-related debugging noise. - -Reported-by: Al Viro -Signed-off-by: Paul E. McKenney -Signed-off-by: Al Viro -(cherry picked from commit 54ef6df3f3f1353d99c80c437259d317b2cd1cbd) -Signed-off-by: Alex Shi ---- - include/linux/rcupdate.h | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h -index 72bf3a0..a9a98ff 100644 ---- a/include/linux/rcupdate.h -+++ b/include/linux/rcupdate.h -@@ -555,6 +555,21 @@ static inline void rcu_preempt_sleep_check(void) - #define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) - - /** -+ * lockless_dereference() - safely load a pointer for later dereference -+ * @p: The pointer to load -+ * -+ * Similar to rcu_dereference(), but for situations where the pointed-to -+ * object's lifetime is managed by something other than RCU. That -+ * "something other" might be reference counting or simple immortality. -+ */ -+#define lockless_dereference(p) \ -+({ \ -+ typeof(p) _________p1 = ACCESS_ONCE(p); \ -+ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ -+ (_________p1); \ -+}) -+ -+/** - * rcu_assign_pointer() - assign to RCU-protected pointer - * @p: pointer to assign to - * @v: value to assign (publish) --- -2.7.4 - - -From 5587227cc0f683fe4732c0a6813f96154254e96b Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:38 +0200 -Subject: [PATCH 20/73] overlay filesystem - -Overlayfs allows one, usually read-write, directory tree to be -overlaid onto another, read-only directory tree. All modifications -go to the upper, writable layer. - -This type of mechanism is most often used for live CDs but there's a -wide variety of other uses. - -The implementation differs from other "union filesystem" -implementations in that after a file is opened all operations go -directly to the underlying, lower or upper, filesystems. This -simplifies the implementation and allows native performance in these -cases. - -The dentry tree is duplicated from the underlying filesystems, this -enables fast cached lookups without adding special support into the -VFS. This uses slightly more memory than union mounts, but dentries -are relatively small. - -Currently inodes are duplicated as well, but it is a possible -optimization to share inodes for non-directories. - -Opening non directories results in the open forwarded to the -underlying filesystem. This makes the behavior very similar to union -mounts (with the same limitations vs. fchmod/fchown on O_RDONLY file -descriptors). - -Usage: - - mount -t overlayfs overlayfs -olowerdir=/lower,upperdir=/upper/upper,workdir=/upper/work /overlay - -The following cotributions have been folded into this patch: - -Neil Brown : - - minimal remount support - - use correct seek function for directories - - initialise is_real before use - - rename ovl_fill_cache to ovl_dir_read - -Felix Fietkau : - - fix a deadlock in ovl_dir_read_merged - - fix a deadlock in ovl_remove_whiteouts - -Erez Zadok - - fix cleanup after WARN_ON - -Sedat Dilek - - fix up permission to confirm to new API - -Robin Dong - - fix possible leak in ovl_new_inode - - create new inode in ovl_link - -Andy Whitcroft - - switch to __inode_permission() - - copy up i_uid/i_gid from the underlying inode - -AV: - - ovl_copy_up_locked() - dput(ERR_PTR(...)) on two failure exits - - ovl_clear_empty() - one failure exit forgetting to do unlock_rename(), - lack of check for udir being the parent of upper, dropping and regaining - the lock on udir (which would require _another_ check for parent being - right). - - bogus d_drop() in copyup and rename [fix from your mail] - - copyup/remove and copyup/rename races [fix from your mail] - - ovl_dir_fsync() leaving ERR_PTR() in ->realfile - - ovl_entry_free() is pointless - it's just a kfree_rcu() - - fold ovl_do_lookup() into ovl_lookup() - - manually assigning ->d_op is wrong. Just use ->s_d_op. - [patches picked from Miklos]: - * copyup/remove and copyup/rename races - * bogus d_drop() in copyup and rename - -Also thanks to the following people for testing and reporting bugs: - - Jordi Pujol - Andy Whitcroft - Michal Suchanek - Felix Fietkau - Erez Zadok - Randy Dunlap - -Signed-off-by: Miklos Szeredi -(cherry picked from commit e9be9d5e76e34872f0c37d72e25bc27fe9e2c54c) -Signed-off-by: Alex Shi ---- - fs/Kconfig | 1 + - fs/Makefile | 1 + - fs/overlayfs/Kconfig | 10 + - fs/overlayfs/Makefile | 7 + - fs/overlayfs/copy_up.c | 414 +++++++++++++++++++++ - fs/overlayfs/dir.c | 921 +++++++++++++++++++++++++++++++++++++++++++++++ - fs/overlayfs/inode.c | 425 ++++++++++++++++++++++ - fs/overlayfs/overlayfs.h | 191 ++++++++++ - fs/overlayfs/readdir.c | 587 ++++++++++++++++++++++++++++++ - fs/overlayfs/super.c | 727 +++++++++++++++++++++++++++++++++++++ - 10 files changed, 3284 insertions(+) - create mode 100644 fs/overlayfs/Kconfig - create mode 100644 fs/overlayfs/Makefile - create mode 100644 fs/overlayfs/copy_up.c - create mode 100644 fs/overlayfs/dir.c - create mode 100644 fs/overlayfs/inode.c - create mode 100644 fs/overlayfs/overlayfs.h - create mode 100644 fs/overlayfs/readdir.c - create mode 100644 fs/overlayfs/super.c - -diff --git a/fs/Kconfig b/fs/Kconfig -index 7385e54..6b40fd8 100644 ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -67,6 +67,7 @@ source "fs/quota/Kconfig" - - source "fs/autofs4/Kconfig" - source "fs/fuse/Kconfig" -+source "fs/overlayfs/Kconfig" - - menu "Caches" - -diff --git a/fs/Makefile b/fs/Makefile -index 47ac07b..5eb9caf 100644 ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -104,6 +104,7 @@ obj-$(CONFIG_QNX6FS_FS) += qnx6/ - obj-$(CONFIG_AUTOFS4_FS) += autofs4/ - obj-$(CONFIG_ADFS_FS) += adfs/ - obj-$(CONFIG_FUSE_FS) += fuse/ -+obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ - obj-$(CONFIG_UDF_FS) += udf/ - obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ - obj-$(CONFIG_OMFS_FS) += omfs/ -diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig -new file mode 100644 -index 0000000..e601259 ---- /dev/null -+++ b/fs/overlayfs/Kconfig -@@ -0,0 +1,10 @@ -+config OVERLAYFS_FS -+ tristate "Overlay filesystem support" -+ help -+ An overlay filesystem combines two filesystems - an 'upper' filesystem -+ and a 'lower' filesystem. When a name exists in both filesystems, the -+ object in the 'upper' filesystem is visible while the object in the -+ 'lower' filesystem is either hidden or, in the case of directories, -+ merged with the 'upper' object. -+ -+ For more information see Documentation/filesystems/overlayfs.txt -diff --git a/fs/overlayfs/Makefile b/fs/overlayfs/Makefile -new file mode 100644 -index 0000000..8f91889 ---- /dev/null -+++ b/fs/overlayfs/Makefile -@@ -0,0 +1,7 @@ -+# -+# Makefile for the overlay filesystem. -+# -+ -+obj-$(CONFIG_OVERLAYFS_FS) += overlayfs.o -+ -+overlayfs-objs := super.o inode.o dir.o readdir.o copy_up.o -diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c -new file mode 100644 -index 0000000..ea10a87 ---- /dev/null -+++ b/fs/overlayfs/copy_up.c -@@ -0,0 +1,414 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+#define OVL_COPY_UP_CHUNK_SIZE (1 << 20) -+ -+int ovl_copy_xattr(struct dentry *old, struct dentry *new) -+{ -+ ssize_t list_size, size; -+ char *buf, *name, *value; -+ int error; -+ -+ if (!old->d_inode->i_op->getxattr || -+ !new->d_inode->i_op->getxattr) -+ return 0; -+ -+ list_size = vfs_listxattr(old, NULL, 0); -+ if (list_size <= 0) { -+ if (list_size == -EOPNOTSUPP) -+ return 0; -+ return list_size; -+ } -+ -+ buf = kzalloc(list_size, GFP_KERNEL); -+ if (!buf) -+ return -ENOMEM; -+ -+ error = -ENOMEM; -+ value = kmalloc(XATTR_SIZE_MAX, GFP_KERNEL); -+ if (!value) -+ goto out; -+ -+ list_size = vfs_listxattr(old, buf, list_size); -+ if (list_size <= 0) { -+ error = list_size; -+ goto out_free_value; -+ } -+ -+ for (name = buf; name < (buf + list_size); name += strlen(name) + 1) { -+ size = vfs_getxattr(old, name, value, XATTR_SIZE_MAX); -+ if (size <= 0) { -+ error = size; -+ goto out_free_value; -+ } -+ error = vfs_setxattr(new, name, value, size, 0); -+ if (error) -+ goto out_free_value; -+ } -+ -+out_free_value: -+ kfree(value); -+out: -+ kfree(buf); -+ return error; -+} -+ -+static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) -+{ -+ struct file *old_file; -+ struct file *new_file; -+ loff_t old_pos = 0; -+ loff_t new_pos = 0; -+ int error = 0; -+ -+ if (len == 0) -+ return 0; -+ -+ old_file = ovl_path_open(old, O_RDONLY); -+ if (IS_ERR(old_file)) -+ return PTR_ERR(old_file); -+ -+ new_file = ovl_path_open(new, O_WRONLY); -+ if (IS_ERR(new_file)) { -+ error = PTR_ERR(new_file); -+ goto out_fput; -+ } -+ -+ /* FIXME: copy up sparse files efficiently */ -+ while (len) { -+ size_t this_len = OVL_COPY_UP_CHUNK_SIZE; -+ long bytes; -+ -+ if (len < this_len) -+ this_len = len; -+ -+ if (signal_pending_state(TASK_KILLABLE, current)) { -+ error = -EINTR; -+ break; -+ } -+ -+ bytes = do_splice_direct(old_file, &old_pos, -+ new_file, &new_pos, -+ this_len, SPLICE_F_MOVE); -+ if (bytes <= 0) { -+ error = bytes; -+ break; -+ } -+ WARN_ON(old_pos != new_pos); -+ -+ len -= bytes; -+ } -+ -+ fput(new_file); -+out_fput: -+ fput(old_file); -+ return error; -+} -+ -+static char *ovl_read_symlink(struct dentry *realdentry) -+{ -+ int res; -+ char *buf; -+ struct inode *inode = realdentry->d_inode; -+ mm_segment_t old_fs; -+ -+ res = -EINVAL; -+ if (!inode->i_op->readlink) -+ goto err; -+ -+ res = -ENOMEM; -+ buf = (char *) __get_free_page(GFP_KERNEL); -+ if (!buf) -+ goto err; -+ -+ old_fs = get_fs(); -+ set_fs(get_ds()); -+ /* The cast to a user pointer is valid due to the set_fs() */ -+ res = inode->i_op->readlink(realdentry, -+ (char __user *)buf, PAGE_SIZE - 1); -+ set_fs(old_fs); -+ if (res < 0) { -+ free_page((unsigned long) buf); -+ goto err; -+ } -+ buf[res] = '\0'; -+ -+ return buf; -+ -+err: -+ return ERR_PTR(res); -+} -+ -+static int ovl_set_timestamps(struct dentry *upperdentry, struct kstat *stat) -+{ -+ struct iattr attr = { -+ .ia_valid = -+ ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, -+ .ia_atime = stat->atime, -+ .ia_mtime = stat->mtime, -+ }; -+ -+ return notify_change(upperdentry, &attr, NULL); -+} -+ -+int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat) -+{ -+ int err = 0; -+ -+ if (!S_ISLNK(stat->mode)) { -+ struct iattr attr = { -+ .ia_valid = ATTR_MODE, -+ .ia_mode = stat->mode, -+ }; -+ err = notify_change(upperdentry, &attr, NULL); -+ } -+ if (!err) { -+ struct iattr attr = { -+ .ia_valid = ATTR_UID | ATTR_GID, -+ .ia_uid = stat->uid, -+ .ia_gid = stat->gid, -+ }; -+ err = notify_change(upperdentry, &attr, NULL); -+ } -+ if (!err) -+ ovl_set_timestamps(upperdentry, stat); -+ -+ return err; -+ -+} -+ -+static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, -+ struct dentry *dentry, struct path *lowerpath, -+ struct kstat *stat, struct iattr *attr, -+ const char *link) -+{ -+ struct inode *wdir = workdir->d_inode; -+ struct inode *udir = upperdir->d_inode; -+ struct dentry *newdentry = NULL; -+ struct dentry *upper = NULL; -+ umode_t mode = stat->mode; -+ int err; -+ -+ newdentry = ovl_lookup_temp(workdir, dentry); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out; -+ -+ upper = lookup_one_len(dentry->d_name.name, upperdir, -+ dentry->d_name.len); -+ err = PTR_ERR(upper); -+ if (IS_ERR(upper)) -+ goto out1; -+ -+ /* Can't properly set mode on creation because of the umask */ -+ stat->mode &= S_IFMT; -+ err = ovl_create_real(wdir, newdentry, stat, link, NULL, true); -+ stat->mode = mode; -+ if (err) -+ goto out2; -+ -+ if (S_ISREG(stat->mode)) { -+ struct path upperpath; -+ ovl_path_upper(dentry, &upperpath); -+ BUG_ON(upperpath.dentry != NULL); -+ upperpath.dentry = newdentry; -+ -+ err = ovl_copy_up_data(lowerpath, &upperpath, stat->size); -+ if (err) -+ goto out_cleanup; -+ } -+ -+ err = ovl_copy_xattr(lowerpath->dentry, newdentry); -+ if (err) -+ goto out_cleanup; -+ -+ mutex_lock(&newdentry->d_inode->i_mutex); -+ err = ovl_set_attr(newdentry, stat); -+ if (!err && attr) -+ err = notify_change(newdentry, attr, NULL); -+ mutex_unlock(&newdentry->d_inode->i_mutex); -+ if (err) -+ goto out_cleanup; -+ -+ err = ovl_do_rename(wdir, newdentry, udir, upper, 0); -+ if (err) -+ goto out_cleanup; -+ -+ ovl_dentry_update(dentry, newdentry); -+ newdentry = NULL; -+ -+ /* -+ * Non-directores become opaque when copied up. -+ */ -+ if (!S_ISDIR(stat->mode)) -+ ovl_dentry_set_opaque(dentry, true); -+out2: -+ dput(upper); -+out1: -+ dput(newdentry); -+out: -+ return err; -+ -+out_cleanup: -+ ovl_cleanup(wdir, newdentry); -+ goto out; -+} -+ -+/* -+ * Copy up a single dentry -+ * -+ * Directory renames only allowed on "pure upper" (already created on -+ * upper filesystem, never copied up). Directories which are on lower or -+ * are merged may not be renamed. For these -EXDEV is returned and -+ * userspace has to deal with it. This means, when copying up a -+ * directory we can rely on it and ancestors being stable. -+ * -+ * Non-directory renames start with copy up of source if necessary. The -+ * actual rename will only proceed once the copy up was successful. Copy -+ * up uses upper parent i_mutex for exclusion. Since rename can change -+ * d_parent it is possible that the copy up will lock the old parent. At -+ * that point the file will have already been copied up anyway. -+ */ -+int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, -+ struct path *lowerpath, struct kstat *stat, -+ struct iattr *attr) -+{ -+ struct dentry *workdir = ovl_workdir(dentry); -+ int err; -+ struct kstat pstat; -+ struct path parentpath; -+ struct dentry *upperdir; -+ struct dentry *upperdentry; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ char *link = NULL; -+ -+ ovl_path_upper(parent, &parentpath); -+ upperdir = parentpath.dentry; -+ -+ err = vfs_getattr(&parentpath, &pstat); -+ if (err) -+ return err; -+ -+ if (S_ISLNK(stat->mode)) { -+ link = ovl_read_symlink(lowerpath->dentry); -+ if (IS_ERR(link)) -+ return PTR_ERR(link); -+ } -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_free_link; -+ -+ override_cred->fsuid = stat->uid; -+ override_cred->fsgid = stat->gid; -+ /* -+ * CAP_SYS_ADMIN for copying up extended attributes -+ * CAP_DAC_OVERRIDE for create -+ * CAP_FOWNER for chmod, timestamp update -+ * CAP_FSETID for chmod -+ * CAP_CHOWN for chown -+ * CAP_MKNOD for mknod -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ cap_raise(override_cred->cap_effective, CAP_FSETID); -+ cap_raise(override_cred->cap_effective, CAP_CHOWN); -+ cap_raise(override_cred->cap_effective, CAP_MKNOD); -+ old_cred = override_creds(override_cred); -+ -+ err = -EIO; -+ if (lock_rename(workdir, upperdir) != NULL) { -+ pr_err("overlayfs: failed to lock workdir+upperdir\n"); -+ goto out_unlock; -+ } -+ upperdentry = ovl_dentry_upper(dentry); -+ if (upperdentry) { -+ unlock_rename(workdir, upperdir); -+ err = 0; -+ /* Raced with another copy-up? Do the setattr here */ -+ if (attr) { -+ mutex_lock(&upperdentry->d_inode->i_mutex); -+ err = notify_change(upperdentry, attr, NULL); -+ mutex_unlock(&upperdentry->d_inode->i_mutex); -+ } -+ goto out_put_cred; -+ } -+ -+ err = ovl_copy_up_locked(workdir, upperdir, dentry, lowerpath, -+ stat, attr, link); -+ if (!err) { -+ /* Restore timestamps on parent (best effort) */ -+ ovl_set_timestamps(upperdir, &pstat); -+ } -+out_unlock: -+ unlock_rename(workdir, upperdir); -+out_put_cred: -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+out_free_link: -+ if (link) -+ free_page((unsigned long) link); -+ -+ return err; -+} -+ -+int ovl_copy_up(struct dentry *dentry) -+{ -+ int err; -+ -+ err = 0; -+ while (!err) { -+ struct dentry *next; -+ struct dentry *parent; -+ struct path lowerpath; -+ struct kstat stat; -+ enum ovl_path_type type = ovl_path_type(dentry); -+ -+ if (type != OVL_PATH_LOWER) -+ break; -+ -+ next = dget(dentry); -+ /* find the topmost dentry not yet copied up */ -+ for (;;) { -+ parent = dget_parent(next); -+ -+ type = ovl_path_type(parent); -+ if (type != OVL_PATH_LOWER) -+ break; -+ -+ dput(next); -+ next = parent; -+ } -+ -+ ovl_path_lower(next, &lowerpath); -+ err = vfs_getattr(&lowerpath, &stat); -+ if (!err) -+ err = ovl_copy_up_one(parent, next, &lowerpath, &stat, NULL); -+ -+ dput(parent); -+ dput(next); -+ } -+ -+ return err; -+} -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -new file mode 100644 -index 0000000..15cd91a ---- /dev/null -+++ b/fs/overlayfs/dir.c -@@ -0,0 +1,921 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+void ovl_cleanup(struct inode *wdir, struct dentry *wdentry) -+{ -+ int err; -+ -+ dget(wdentry); -+ if (S_ISDIR(wdentry->d_inode->i_mode)) -+ err = ovl_do_rmdir(wdir, wdentry); -+ else -+ err = ovl_do_unlink(wdir, wdentry); -+ dput(wdentry); -+ -+ if (err) { -+ pr_err("overlayfs: cleanup of '%pd2' failed (%i)\n", -+ wdentry, err); -+ } -+} -+ -+struct dentry *ovl_lookup_temp(struct dentry *workdir, struct dentry *dentry) -+{ -+ struct dentry *temp; -+ char name[20]; -+ -+ snprintf(name, sizeof(name), "#%lx", (unsigned long) dentry); -+ -+ temp = lookup_one_len(name, workdir, strlen(name)); -+ if (!IS_ERR(temp) && temp->d_inode) { -+ pr_err("overlayfs: workdir/%s already exists\n", name); -+ dput(temp); -+ temp = ERR_PTR(-EIO); -+ } -+ -+ return temp; -+} -+ -+/* caller holds i_mutex on workdir */ -+static struct dentry *ovl_whiteout(struct dentry *workdir, -+ struct dentry *dentry) -+{ -+ int err; -+ struct dentry *whiteout; -+ struct inode *wdir = workdir->d_inode; -+ -+ whiteout = ovl_lookup_temp(workdir, dentry); -+ if (IS_ERR(whiteout)) -+ return whiteout; -+ -+ err = ovl_do_whiteout(wdir, whiteout); -+ if (err) { -+ dput(whiteout); -+ whiteout = ERR_PTR(err); -+ } -+ -+ return whiteout; -+} -+ -+int ovl_create_real(struct inode *dir, struct dentry *newdentry, -+ struct kstat *stat, const char *link, -+ struct dentry *hardlink, bool debug) -+{ -+ int err; -+ -+ if (newdentry->d_inode) -+ return -ESTALE; -+ -+ if (hardlink) { -+ err = ovl_do_link(hardlink, dir, newdentry, debug); -+ } else { -+ switch (stat->mode & S_IFMT) { -+ case S_IFREG: -+ err = ovl_do_create(dir, newdentry, stat->mode, debug); -+ break; -+ -+ case S_IFDIR: -+ err = ovl_do_mkdir(dir, newdentry, stat->mode, debug); -+ break; -+ -+ case S_IFCHR: -+ case S_IFBLK: -+ case S_IFIFO: -+ case S_IFSOCK: -+ err = ovl_do_mknod(dir, newdentry, -+ stat->mode, stat->rdev, debug); -+ break; -+ -+ case S_IFLNK: -+ err = ovl_do_symlink(dir, newdentry, link, debug); -+ break; -+ -+ default: -+ err = -EPERM; -+ } -+ } -+ if (!err && WARN_ON(!newdentry->d_inode)) { -+ /* -+ * Not quite sure if non-instantiated dentry is legal or not. -+ * VFS doesn't seem to care so check and warn here. -+ */ -+ err = -ENOENT; -+ } -+ return err; -+} -+ -+static int ovl_set_opaque(struct dentry *upperdentry) -+{ -+ return ovl_do_setxattr(upperdentry, ovl_opaque_xattr, "y", 1, 0); -+} -+ -+static void ovl_remove_opaque(struct dentry *upperdentry) -+{ -+ int err; -+ -+ err = ovl_do_removexattr(upperdentry, ovl_opaque_xattr); -+ if (err) { -+ pr_warn("overlayfs: failed to remove opaque from '%s' (%i)\n", -+ upperdentry->d_name.name, err); -+ } -+} -+ -+static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry, -+ struct kstat *stat) -+{ -+ int err; -+ enum ovl_path_type type; -+ struct path realpath; -+ -+ type = ovl_path_real(dentry, &realpath); -+ err = vfs_getattr(&realpath, stat); -+ if (err) -+ return err; -+ -+ stat->dev = dentry->d_sb->s_dev; -+ stat->ino = dentry->d_inode->i_ino; -+ -+ /* -+ * It's probably not worth it to count subdirs to get the -+ * correct link count. nlink=1 seems to pacify 'find' and -+ * other utilities. -+ */ -+ if (type == OVL_PATH_MERGE) -+ stat->nlink = 1; -+ -+ return 0; -+} -+ -+static int ovl_create_upper(struct dentry *dentry, struct inode *inode, -+ struct kstat *stat, const char *link, -+ struct dentry *hardlink) -+{ -+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); -+ struct inode *udir = upperdir->d_inode; -+ struct dentry *newdentry; -+ int err; -+ -+ mutex_lock_nested(&udir->i_mutex, I_MUTEX_PARENT); -+ newdentry = lookup_one_len(dentry->d_name.name, upperdir, -+ dentry->d_name.len); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_unlock; -+ err = ovl_create_real(udir, newdentry, stat, link, hardlink, false); -+ if (err) -+ goto out_dput; -+ -+ ovl_dentry_version_inc(dentry->d_parent); -+ ovl_dentry_update(dentry, newdentry); -+ ovl_copyattr(newdentry->d_inode, inode); -+ d_instantiate(dentry, inode); -+ newdentry = NULL; -+out_dput: -+ dput(newdentry); -+out_unlock: -+ mutex_unlock(&udir->i_mutex); -+ return err; -+} -+ -+static int ovl_lock_rename_workdir(struct dentry *workdir, -+ struct dentry *upperdir) -+{ -+ /* Workdir should not be the same as upperdir */ -+ if (workdir == upperdir) -+ goto err; -+ -+ /* Workdir should not be subdir of upperdir and vice versa */ -+ if (lock_rename(workdir, upperdir) != NULL) -+ goto err_unlock; -+ -+ return 0; -+ -+err_unlock: -+ unlock_rename(workdir, upperdir); -+err: -+ pr_err("overlayfs: failed to lock workdir+upperdir\n"); -+ return -EIO; -+} -+ -+static struct dentry *ovl_clear_empty(struct dentry *dentry, -+ struct list_head *list) -+{ -+ struct dentry *workdir = ovl_workdir(dentry); -+ struct inode *wdir = workdir->d_inode; -+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); -+ struct inode *udir = upperdir->d_inode; -+ struct path upperpath; -+ struct dentry *upper; -+ struct dentry *opaquedir; -+ struct kstat stat; -+ int err; -+ -+ err = ovl_lock_rename_workdir(workdir, upperdir); -+ if (err) -+ goto out; -+ -+ ovl_path_upper(dentry, &upperpath); -+ err = vfs_getattr(&upperpath, &stat); -+ if (err) -+ goto out_unlock; -+ -+ err = -ESTALE; -+ if (!S_ISDIR(stat.mode)) -+ goto out_unlock; -+ upper = upperpath.dentry; -+ if (upper->d_parent->d_inode != udir) -+ goto out_unlock; -+ -+ opaquedir = ovl_lookup_temp(workdir, dentry); -+ err = PTR_ERR(opaquedir); -+ if (IS_ERR(opaquedir)) -+ goto out_unlock; -+ -+ err = ovl_create_real(wdir, opaquedir, &stat, NULL, NULL, true); -+ if (err) -+ goto out_dput; -+ -+ err = ovl_copy_xattr(upper, opaquedir); -+ if (err) -+ goto out_cleanup; -+ -+ err = ovl_set_opaque(opaquedir); -+ if (err) -+ goto out_cleanup; -+ -+ mutex_lock(&opaquedir->d_inode->i_mutex); -+ err = ovl_set_attr(opaquedir, &stat); -+ mutex_unlock(&opaquedir->d_inode->i_mutex); -+ if (err) -+ goto out_cleanup; -+ -+ err = ovl_do_rename(wdir, opaquedir, udir, upper, RENAME_EXCHANGE); -+ if (err) -+ goto out_cleanup; -+ -+ ovl_cleanup_whiteouts(upper, list); -+ ovl_cleanup(wdir, upper); -+ unlock_rename(workdir, upperdir); -+ -+ /* dentry's upper doesn't match now, get rid of it */ -+ d_drop(dentry); -+ -+ return opaquedir; -+ -+out_cleanup: -+ ovl_cleanup(wdir, opaquedir); -+out_dput: -+ dput(opaquedir); -+out_unlock: -+ unlock_rename(workdir, upperdir); -+out: -+ return ERR_PTR(err); -+} -+ -+static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, -+ enum ovl_path_type type) -+{ -+ int err; -+ struct dentry *ret = NULL; -+ LIST_HEAD(list); -+ -+ err = ovl_check_empty_dir(dentry, &list); -+ if (err) -+ ret = ERR_PTR(err); -+ else if (type == OVL_PATH_MERGE) -+ ret = ovl_clear_empty(dentry, &list); -+ -+ ovl_cache_free(&list); -+ -+ return ret; -+} -+ -+static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, -+ struct kstat *stat, const char *link, -+ struct dentry *hardlink) -+{ -+ struct dentry *workdir = ovl_workdir(dentry); -+ struct inode *wdir = workdir->d_inode; -+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); -+ struct inode *udir = upperdir->d_inode; -+ struct dentry *upper; -+ struct dentry *newdentry; -+ int err; -+ -+ err = ovl_lock_rename_workdir(workdir, upperdir); -+ if (err) -+ goto out; -+ -+ newdentry = ovl_lookup_temp(workdir, dentry); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_unlock; -+ -+ upper = lookup_one_len(dentry->d_name.name, upperdir, -+ dentry->d_name.len); -+ err = PTR_ERR(upper); -+ if (IS_ERR(upper)) -+ goto out_dput; -+ -+ err = ovl_create_real(wdir, newdentry, stat, link, hardlink, true); -+ if (err) -+ goto out_dput2; -+ -+ if (S_ISDIR(stat->mode)) { -+ err = ovl_set_opaque(newdentry); -+ if (err) -+ goto out_cleanup; -+ -+ err = ovl_do_rename(wdir, newdentry, udir, upper, -+ RENAME_EXCHANGE); -+ if (err) -+ goto out_cleanup; -+ -+ ovl_cleanup(wdir, upper); -+ } else { -+ err = ovl_do_rename(wdir, newdentry, udir, upper, 0); -+ if (err) -+ goto out_cleanup; -+ } -+ ovl_dentry_version_inc(dentry->d_parent); -+ ovl_dentry_update(dentry, newdentry); -+ ovl_copyattr(newdentry->d_inode, inode); -+ d_instantiate(dentry, inode); -+ newdentry = NULL; -+out_dput2: -+ dput(upper); -+out_dput: -+ dput(newdentry); -+out_unlock: -+ unlock_rename(workdir, upperdir); -+out: -+ return err; -+ -+out_cleanup: -+ ovl_cleanup(wdir, newdentry); -+ goto out_dput2; -+} -+ -+static int ovl_create_or_link(struct dentry *dentry, int mode, dev_t rdev, -+ const char *link, struct dentry *hardlink) -+{ -+ int err; -+ struct inode *inode; -+ struct kstat stat = { -+ .mode = mode, -+ .rdev = rdev, -+ }; -+ -+ err = -ENOMEM; -+ inode = ovl_new_inode(dentry->d_sb, mode, dentry->d_fsdata); -+ if (!inode) -+ goto out; -+ -+ err = ovl_copy_up(dentry->d_parent); -+ if (err) -+ goto out_iput; -+ -+ if (!ovl_dentry_is_opaque(dentry)) { -+ err = ovl_create_upper(dentry, inode, &stat, link, hardlink); -+ } else { -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_iput; -+ -+ /* -+ * CAP_SYS_ADMIN for setting opaque xattr -+ * CAP_DAC_OVERRIDE for create in workdir, rename -+ * CAP_FOWNER for removing whiteout from sticky dir -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ old_cred = override_creds(override_cred); -+ -+ err = ovl_create_over_whiteout(dentry, inode, &stat, link, -+ hardlink); -+ -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ } -+ -+ if (!err) -+ inode = NULL; -+out_iput: -+ iput(inode); -+out: -+ return err; -+} -+ -+static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev, -+ const char *link) -+{ -+ int err; -+ -+ err = ovl_want_write(dentry); -+ if (!err) { -+ err = ovl_create_or_link(dentry, mode, rdev, link, NULL); -+ ovl_drop_write(dentry); -+ } -+ -+ return err; -+} -+ -+static int ovl_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ bool excl) -+{ -+ return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); -+} -+ -+static int ovl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) -+{ -+ return ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL); -+} -+ -+static int ovl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t rdev) -+{ -+ /* Don't allow creation of "whiteout" on overlay */ -+ if (S_ISCHR(mode) && rdev == WHITEOUT_DEV) -+ return -EPERM; -+ -+ return ovl_create_object(dentry, mode, rdev, NULL); -+} -+ -+static int ovl_symlink(struct inode *dir, struct dentry *dentry, -+ const char *link) -+{ -+ return ovl_create_object(dentry, S_IFLNK, 0, link); -+} -+ -+static int ovl_link(struct dentry *old, struct inode *newdir, -+ struct dentry *new) -+{ -+ int err; -+ struct dentry *upper; -+ -+ err = ovl_want_write(old); -+ if (err) -+ goto out; -+ -+ err = ovl_copy_up(old); -+ if (err) -+ goto out_drop_write; -+ -+ upper = ovl_dentry_upper(old); -+ err = ovl_create_or_link(new, upper->d_inode->i_mode, 0, NULL, upper); -+ -+out_drop_write: -+ ovl_drop_write(old); -+out: -+ return err; -+} -+ -+static int ovl_remove_and_whiteout(struct dentry *dentry, -+ enum ovl_path_type type, bool is_dir) -+{ -+ struct dentry *workdir = ovl_workdir(dentry); -+ struct inode *wdir = workdir->d_inode; -+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); -+ struct inode *udir = upperdir->d_inode; -+ struct dentry *whiteout; -+ struct dentry *upper; -+ struct dentry *opaquedir = NULL; -+ int err; -+ -+ if (is_dir) { -+ opaquedir = ovl_check_empty_and_clear(dentry, type); -+ err = PTR_ERR(opaquedir); -+ if (IS_ERR(opaquedir)) -+ goto out; -+ } -+ -+ err = ovl_lock_rename_workdir(workdir, upperdir); -+ if (err) -+ goto out_dput; -+ -+ whiteout = ovl_whiteout(workdir, dentry); -+ err = PTR_ERR(whiteout); -+ if (IS_ERR(whiteout)) -+ goto out_unlock; -+ -+ if (type == OVL_PATH_LOWER) { -+ upper = lookup_one_len(dentry->d_name.name, upperdir, -+ dentry->d_name.len); -+ err = PTR_ERR(upper); -+ if (IS_ERR(upper)) -+ goto kill_whiteout; -+ -+ err = ovl_do_rename(wdir, whiteout, udir, upper, 0); -+ dput(upper); -+ if (err) -+ goto kill_whiteout; -+ } else { -+ int flags = 0; -+ -+ upper = ovl_dentry_upper(dentry); -+ if (opaquedir) -+ upper = opaquedir; -+ err = -ESTALE; -+ if (upper->d_parent != upperdir) -+ goto kill_whiteout; -+ -+ if (is_dir) -+ flags |= RENAME_EXCHANGE; -+ -+ err = ovl_do_rename(wdir, whiteout, udir, upper, flags); -+ if (err) -+ goto kill_whiteout; -+ -+ if (is_dir) -+ ovl_cleanup(wdir, upper); -+ } -+ ovl_dentry_version_inc(dentry->d_parent); -+out_d_drop: -+ d_drop(dentry); -+ dput(whiteout); -+out_unlock: -+ unlock_rename(workdir, upperdir); -+out_dput: -+ dput(opaquedir); -+out: -+ return err; -+ -+kill_whiteout: -+ ovl_cleanup(wdir, whiteout); -+ goto out_d_drop; -+} -+ -+static int ovl_remove_upper(struct dentry *dentry, bool is_dir) -+{ -+ struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent); -+ struct inode *dir = upperdir->d_inode; -+ struct dentry *upper = ovl_dentry_upper(dentry); -+ int err; -+ -+ mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); -+ err = -ESTALE; -+ if (upper->d_parent == upperdir) { -+ /* Don't let d_delete() think it can reset d_inode */ -+ dget(upper); -+ if (is_dir) -+ err = vfs_rmdir(dir, upper); -+ else -+ err = vfs_unlink(dir, upper, NULL); -+ dput(upper); -+ ovl_dentry_version_inc(dentry->d_parent); -+ } -+ -+ /* -+ * Keeping this dentry hashed would mean having to release -+ * upperpath/lowerpath, which could only be done if we are the -+ * sole user of this dentry. Too tricky... Just unhash for -+ * now. -+ */ -+ d_drop(dentry); -+ mutex_unlock(&dir->i_mutex); -+ -+ return err; -+} -+ -+static inline int ovl_check_sticky(struct dentry *dentry) -+{ -+ struct inode *dir = ovl_dentry_real(dentry->d_parent)->d_inode; -+ struct inode *inode = ovl_dentry_real(dentry)->d_inode; -+ -+ if (check_sticky(dir, inode)) -+ return -EPERM; -+ -+ return 0; -+} -+ -+static int ovl_do_remove(struct dentry *dentry, bool is_dir) -+{ -+ enum ovl_path_type type; -+ int err; -+ -+ err = ovl_check_sticky(dentry); -+ if (err) -+ goto out; -+ -+ err = ovl_want_write(dentry); -+ if (err) -+ goto out; -+ -+ err = ovl_copy_up(dentry->d_parent); -+ if (err) -+ goto out_drop_write; -+ -+ type = ovl_path_type(dentry); -+ if (type == OVL_PATH_PURE_UPPER) { -+ err = ovl_remove_upper(dentry, is_dir); -+ } else { -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_drop_write; -+ -+ /* -+ * CAP_SYS_ADMIN for setting xattr on whiteout, opaque dir -+ * CAP_DAC_OVERRIDE for create in workdir, rename -+ * CAP_FOWNER for removing whiteout from sticky dir -+ * CAP_FSETID for chmod of opaque dir -+ * CAP_CHOWN for chown of opaque dir -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ cap_raise(override_cred->cap_effective, CAP_FSETID); -+ cap_raise(override_cred->cap_effective, CAP_CHOWN); -+ old_cred = override_creds(override_cred); -+ -+ err = ovl_remove_and_whiteout(dentry, type, is_dir); -+ -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ } -+out_drop_write: -+ ovl_drop_write(dentry); -+out: -+ return err; -+} -+ -+static int ovl_unlink(struct inode *dir, struct dentry *dentry) -+{ -+ return ovl_do_remove(dentry, false); -+} -+ -+static int ovl_rmdir(struct inode *dir, struct dentry *dentry) -+{ -+ return ovl_do_remove(dentry, true); -+} -+ -+static int ovl_rename2(struct inode *olddir, struct dentry *old, -+ struct inode *newdir, struct dentry *new, -+ unsigned int flags) -+{ -+ int err; -+ enum ovl_path_type old_type; -+ enum ovl_path_type new_type; -+ struct dentry *old_upperdir; -+ struct dentry *new_upperdir; -+ struct dentry *olddentry; -+ struct dentry *newdentry; -+ struct dentry *trap; -+ bool old_opaque; -+ bool new_opaque; -+ bool new_create = false; -+ bool cleanup_whiteout = false; -+ bool overwrite = !(flags & RENAME_EXCHANGE); -+ bool is_dir = S_ISDIR(old->d_inode->i_mode); -+ bool new_is_dir = false; -+ struct dentry *opaquedir = NULL; -+ const struct cred *old_cred = NULL; -+ struct cred *override_cred = NULL; -+ -+ err = -EINVAL; -+ if (flags & ~(RENAME_EXCHANGE | RENAME_NOREPLACE)) -+ goto out; -+ -+ flags &= ~RENAME_NOREPLACE; -+ -+ err = ovl_check_sticky(old); -+ if (err) -+ goto out; -+ -+ /* Don't copy up directory trees */ -+ old_type = ovl_path_type(old); -+ err = -EXDEV; -+ if ((old_type == OVL_PATH_LOWER || old_type == OVL_PATH_MERGE) && is_dir) -+ goto out; -+ -+ if (new->d_inode) { -+ err = ovl_check_sticky(new); -+ if (err) -+ goto out; -+ -+ if (S_ISDIR(new->d_inode->i_mode)) -+ new_is_dir = true; -+ -+ new_type = ovl_path_type(new); -+ err = -EXDEV; -+ if (!overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) -+ goto out; -+ -+ err = 0; -+ if (new_type == OVL_PATH_LOWER && old_type == OVL_PATH_LOWER) { -+ if (ovl_dentry_lower(old)->d_inode == -+ ovl_dentry_lower(new)->d_inode) -+ goto out; -+ } -+ if (new_type != OVL_PATH_LOWER && old_type != OVL_PATH_LOWER) { -+ if (ovl_dentry_upper(old)->d_inode == -+ ovl_dentry_upper(new)->d_inode) -+ goto out; -+ } -+ } else { -+ if (ovl_dentry_is_opaque(new)) -+ new_type = OVL_PATH_UPPER; -+ else -+ new_type = OVL_PATH_PURE_UPPER; -+ } -+ -+ err = ovl_want_write(old); -+ if (err) -+ goto out; -+ -+ err = ovl_copy_up(old); -+ if (err) -+ goto out_drop_write; -+ -+ err = ovl_copy_up(new->d_parent); -+ if (err) -+ goto out_drop_write; -+ if (!overwrite) { -+ err = ovl_copy_up(new); -+ if (err) -+ goto out_drop_write; -+ } -+ -+ old_opaque = old_type != OVL_PATH_PURE_UPPER; -+ new_opaque = new_type != OVL_PATH_PURE_UPPER; -+ -+ if (old_opaque || new_opaque) { -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_drop_write; -+ -+ /* -+ * CAP_SYS_ADMIN for setting xattr on whiteout, opaque dir -+ * CAP_DAC_OVERRIDE for create in workdir -+ * CAP_FOWNER for removing whiteout from sticky dir -+ * CAP_FSETID for chmod of opaque dir -+ * CAP_CHOWN for chown of opaque dir -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ cap_raise(override_cred->cap_effective, CAP_FSETID); -+ cap_raise(override_cred->cap_effective, CAP_CHOWN); -+ old_cred = override_creds(override_cred); -+ } -+ -+ if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { -+ opaquedir = ovl_check_empty_and_clear(new, new_type); -+ err = PTR_ERR(opaquedir); -+ if (IS_ERR(opaquedir)) { -+ opaquedir = NULL; -+ goto out_revert_creds; -+ } -+ } -+ -+ if (overwrite) { -+ if (old_opaque) { -+ if (new->d_inode || !new_opaque) { -+ /* Whiteout source */ -+ flags |= RENAME_WHITEOUT; -+ } else { -+ /* Switch whiteouts */ -+ flags |= RENAME_EXCHANGE; -+ } -+ } else if (is_dir && !new->d_inode && new_opaque) { -+ flags |= RENAME_EXCHANGE; -+ cleanup_whiteout = true; -+ } -+ } -+ -+ old_upperdir = ovl_dentry_upper(old->d_parent); -+ new_upperdir = ovl_dentry_upper(new->d_parent); -+ -+ trap = lock_rename(new_upperdir, old_upperdir); -+ -+ olddentry = ovl_dentry_upper(old); -+ newdentry = ovl_dentry_upper(new); -+ if (newdentry) { -+ if (opaquedir) { -+ newdentry = opaquedir; -+ opaquedir = NULL; -+ } else { -+ dget(newdentry); -+ } -+ } else { -+ new_create = true; -+ newdentry = lookup_one_len(new->d_name.name, new_upperdir, -+ new->d_name.len); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_unlock; -+ } -+ -+ err = -ESTALE; -+ if (olddentry->d_parent != old_upperdir) -+ goto out_dput; -+ if (newdentry->d_parent != new_upperdir) -+ goto out_dput; -+ if (olddentry == trap) -+ goto out_dput; -+ if (newdentry == trap) -+ goto out_dput; -+ -+ if (is_dir && !old_opaque && new_opaque) { -+ err = ovl_set_opaque(olddentry); -+ if (err) -+ goto out_dput; -+ } -+ if (!overwrite && new_is_dir && old_opaque && !new_opaque) { -+ err = ovl_set_opaque(newdentry); -+ if (err) -+ goto out_dput; -+ } -+ -+ if (old_opaque || new_opaque) { -+ err = ovl_do_rename(old_upperdir->d_inode, olddentry, -+ new_upperdir->d_inode, newdentry, -+ flags); -+ } else { -+ /* No debug for the plain case */ -+ BUG_ON(flags & ~RENAME_EXCHANGE); -+ err = vfs_rename(old_upperdir->d_inode, olddentry, -+ new_upperdir->d_inode, newdentry, -+ NULL, flags); -+ } -+ -+ if (err) { -+ if (is_dir && !old_opaque && new_opaque) -+ ovl_remove_opaque(olddentry); -+ if (!overwrite && new_is_dir && old_opaque && !new_opaque) -+ ovl_remove_opaque(newdentry); -+ goto out_dput; -+ } -+ -+ if (is_dir && old_opaque && !new_opaque) -+ ovl_remove_opaque(olddentry); -+ if (!overwrite && new_is_dir && !old_opaque && new_opaque) -+ ovl_remove_opaque(newdentry); -+ -+ if (old_opaque != new_opaque) { -+ ovl_dentry_set_opaque(old, new_opaque); -+ if (!overwrite) -+ ovl_dentry_set_opaque(new, old_opaque); -+ } -+ -+ if (cleanup_whiteout) -+ ovl_cleanup(old_upperdir->d_inode, newdentry); -+ -+ ovl_dentry_version_inc(old->d_parent); -+ ovl_dentry_version_inc(new->d_parent); -+ -+out_dput: -+ dput(newdentry); -+out_unlock: -+ unlock_rename(new_upperdir, old_upperdir); -+out_revert_creds: -+ if (old_opaque || new_opaque) { -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ } -+out_drop_write: -+ ovl_drop_write(old); -+out: -+ dput(opaquedir); -+ return err; -+} -+ -+const struct inode_operations ovl_dir_inode_operations = { -+ .lookup = ovl_lookup, -+ .mkdir = ovl_mkdir, -+ .symlink = ovl_symlink, -+ .unlink = ovl_unlink, -+ .rmdir = ovl_rmdir, -+ .rename2 = ovl_rename2, -+ .link = ovl_link, -+ .setattr = ovl_setattr, -+ .create = ovl_create, -+ .mknod = ovl_mknod, -+ .permission = ovl_permission, -+ .getattr = ovl_dir_getattr, -+ .setxattr = ovl_setxattr, -+ .getxattr = ovl_getxattr, -+ .listxattr = ovl_listxattr, -+ .removexattr = ovl_removexattr, -+}; -diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c -new file mode 100644 -index 0000000..af2d18c ---- /dev/null -+++ b/fs/overlayfs/inode.c -@@ -0,0 +1,425 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+static int ovl_copy_up_last(struct dentry *dentry, struct iattr *attr, -+ bool no_data) -+{ -+ int err; -+ struct dentry *parent; -+ struct kstat stat; -+ struct path lowerpath; -+ -+ parent = dget_parent(dentry); -+ err = ovl_copy_up(parent); -+ if (err) -+ goto out_dput_parent; -+ -+ ovl_path_lower(dentry, &lowerpath); -+ err = vfs_getattr(&lowerpath, &stat); -+ if (err) -+ goto out_dput_parent; -+ -+ if (no_data) -+ stat.size = 0; -+ -+ err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat, attr); -+ -+out_dput_parent: -+ dput(parent); -+ return err; -+} -+ -+int ovl_setattr(struct dentry *dentry, struct iattr *attr) -+{ -+ int err; -+ struct dentry *upperdentry; -+ -+ err = ovl_want_write(dentry); -+ if (err) -+ goto out; -+ -+ upperdentry = ovl_dentry_upper(dentry); -+ if (upperdentry) { -+ mutex_lock(&upperdentry->d_inode->i_mutex); -+ err = notify_change(upperdentry, attr, NULL); -+ mutex_unlock(&upperdentry->d_inode->i_mutex); -+ } else { -+ err = ovl_copy_up_last(dentry, attr, false); -+ } -+ ovl_drop_write(dentry); -+out: -+ return err; -+} -+ -+static int ovl_getattr(struct vfsmount *mnt, struct dentry *dentry, -+ struct kstat *stat) -+{ -+ struct path realpath; -+ -+ ovl_path_real(dentry, &realpath); -+ return vfs_getattr(&realpath, stat); -+} -+ -+int ovl_permission(struct inode *inode, int mask) -+{ -+ struct ovl_entry *oe; -+ struct dentry *alias = NULL; -+ struct inode *realinode; -+ struct dentry *realdentry; -+ bool is_upper; -+ int err; -+ -+ if (S_ISDIR(inode->i_mode)) { -+ oe = inode->i_private; -+ } else if (mask & MAY_NOT_BLOCK) { -+ return -ECHILD; -+ } else { -+ /* -+ * For non-directories find an alias and get the info -+ * from there. -+ */ -+ alias = d_find_any_alias(inode); -+ if (WARN_ON(!alias)) -+ return -ENOENT; -+ -+ oe = alias->d_fsdata; -+ } -+ -+ realdentry = ovl_entry_real(oe, &is_upper); -+ -+ /* Careful in RCU walk mode */ -+ realinode = ACCESS_ONCE(realdentry->d_inode); -+ if (!realinode) { -+ WARN_ON(!(mask & MAY_NOT_BLOCK)); -+ err = -ENOENT; -+ goto out_dput; -+ } -+ -+ if (mask & MAY_WRITE) { -+ umode_t mode = realinode->i_mode; -+ -+ /* -+ * Writes will always be redirected to upper layer, so -+ * ignore lower layer being read-only. -+ * -+ * If the overlay itself is read-only then proceed -+ * with the permission check, don't return EROFS. -+ * This will only happen if this is the lower layer of -+ * another overlayfs. -+ * -+ * If upper fs becomes read-only after the overlay was -+ * constructed return EROFS to prevent modification of -+ * upper layer. -+ */ -+ err = -EROFS; -+ if (is_upper && !IS_RDONLY(inode) && IS_RDONLY(realinode) && -+ (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) -+ goto out_dput; -+ } -+ -+ err = __inode_permission(realinode, mask); -+out_dput: -+ dput(alias); -+ return err; -+} -+ -+ -+struct ovl_link_data { -+ struct dentry *realdentry; -+ void *cookie; -+}; -+ -+static void *ovl_follow_link(struct dentry *dentry, struct nameidata *nd) -+{ -+ void *ret; -+ struct dentry *realdentry; -+ struct inode *realinode; -+ -+ realdentry = ovl_dentry_real(dentry); -+ realinode = realdentry->d_inode; -+ -+ if (WARN_ON(!realinode->i_op->follow_link)) -+ return ERR_PTR(-EPERM); -+ -+ ret = realinode->i_op->follow_link(realdentry, nd); -+ if (IS_ERR(ret)) -+ return ret; -+ -+ if (realinode->i_op->put_link) { -+ struct ovl_link_data *data; -+ -+ data = kmalloc(sizeof(struct ovl_link_data), GFP_KERNEL); -+ if (!data) { -+ realinode->i_op->put_link(realdentry, nd, ret); -+ return ERR_PTR(-ENOMEM); -+ } -+ data->realdentry = realdentry; -+ data->cookie = ret; -+ -+ return data; -+ } else { -+ return NULL; -+ } -+} -+ -+static void ovl_put_link(struct dentry *dentry, struct nameidata *nd, void *c) -+{ -+ struct inode *realinode; -+ struct ovl_link_data *data = c; -+ -+ if (!data) -+ return; -+ -+ realinode = data->realdentry->d_inode; -+ realinode->i_op->put_link(data->realdentry, nd, data->cookie); -+ kfree(data); -+} -+ -+static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) -+{ -+ struct path realpath; -+ struct inode *realinode; -+ -+ ovl_path_real(dentry, &realpath); -+ realinode = realpath.dentry->d_inode; -+ -+ if (!realinode->i_op->readlink) -+ return -EINVAL; -+ -+ touch_atime(&realpath); -+ -+ return realinode->i_op->readlink(realpath.dentry, buf, bufsiz); -+} -+ -+ -+static bool ovl_is_private_xattr(const char *name) -+{ -+ return strncmp(name, "trusted.overlay.", 14) == 0; -+} -+ -+int ovl_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags) -+{ -+ int err; -+ struct dentry *upperdentry; -+ -+ err = ovl_want_write(dentry); -+ if (err) -+ goto out; -+ -+ err = -EPERM; -+ if (ovl_is_private_xattr(name)) -+ goto out_drop_write; -+ -+ err = ovl_copy_up(dentry); -+ if (err) -+ goto out_drop_write; -+ -+ upperdentry = ovl_dentry_upper(dentry); -+ err = vfs_setxattr(upperdentry, name, value, size, flags); -+ -+out_drop_write: -+ ovl_drop_write(dentry); -+out: -+ return err; -+} -+ -+ssize_t ovl_getxattr(struct dentry *dentry, const char *name, -+ void *value, size_t size) -+{ -+ if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && -+ ovl_is_private_xattr(name)) -+ return -ENODATA; -+ -+ return vfs_getxattr(ovl_dentry_real(dentry), name, value, size); -+} -+ -+ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) -+{ -+ ssize_t res; -+ int off; -+ -+ res = vfs_listxattr(ovl_dentry_real(dentry), list, size); -+ if (res <= 0 || size == 0) -+ return res; -+ -+ if (ovl_path_type(dentry->d_parent) != OVL_PATH_MERGE) -+ return res; -+ -+ /* filter out private xattrs */ -+ for (off = 0; off < res;) { -+ char *s = list + off; -+ size_t slen = strlen(s) + 1; -+ -+ BUG_ON(off + slen > res); -+ -+ if (ovl_is_private_xattr(s)) { -+ res -= slen; -+ memmove(s, s + slen, res - off); -+ } else { -+ off += slen; -+ } -+ } -+ -+ return res; -+} -+ -+int ovl_removexattr(struct dentry *dentry, const char *name) -+{ -+ int err; -+ struct path realpath; -+ enum ovl_path_type type; -+ -+ err = ovl_want_write(dentry); -+ if (err) -+ goto out; -+ -+ if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && -+ ovl_is_private_xattr(name)) -+ goto out_drop_write; -+ -+ type = ovl_path_real(dentry, &realpath); -+ if (type == OVL_PATH_LOWER) { -+ err = vfs_getxattr(realpath.dentry, name, NULL, 0); -+ if (err < 0) -+ goto out_drop_write; -+ -+ err = ovl_copy_up(dentry); -+ if (err) -+ goto out_drop_write; -+ -+ ovl_path_upper(dentry, &realpath); -+ } -+ -+ err = vfs_removexattr(realpath.dentry, name); -+out_drop_write: -+ ovl_drop_write(dentry); -+out: -+ return err; -+} -+ -+static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type, -+ struct dentry *realdentry) -+{ -+ if (type != OVL_PATH_LOWER) -+ return false; -+ -+ if (special_file(realdentry->d_inode->i_mode)) -+ return false; -+ -+ if (!(OPEN_FMODE(flags) & FMODE_WRITE) && !(flags & O_TRUNC)) -+ return false; -+ -+ return true; -+} -+ -+static int ovl_dentry_open(struct dentry *dentry, struct file *file, -+ const struct cred *cred) -+{ -+ int err; -+ struct path realpath; -+ enum ovl_path_type type; -+ bool want_write = false; -+ -+ type = ovl_path_real(dentry, &realpath); -+ if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) { -+ want_write = true; -+ err = ovl_want_write(dentry); -+ if (err) -+ goto out; -+ -+ if (file->f_flags & O_TRUNC) -+ err = ovl_copy_up_last(dentry, NULL, true); -+ else -+ err = ovl_copy_up(dentry); -+ if (err) -+ goto out_drop_write; -+ -+ ovl_path_upper(dentry, &realpath); -+ } -+ -+ err = vfs_open(&realpath, file, cred); -+out_drop_write: -+ if (want_write) -+ ovl_drop_write(dentry); -+out: -+ return err; -+} -+ -+static const struct inode_operations ovl_file_inode_operations = { -+ .setattr = ovl_setattr, -+ .permission = ovl_permission, -+ .getattr = ovl_getattr, -+ .setxattr = ovl_setxattr, -+ .getxattr = ovl_getxattr, -+ .listxattr = ovl_listxattr, -+ .removexattr = ovl_removexattr, -+ .dentry_open = ovl_dentry_open, -+}; -+ -+static const struct inode_operations ovl_symlink_inode_operations = { -+ .setattr = ovl_setattr, -+ .follow_link = ovl_follow_link, -+ .put_link = ovl_put_link, -+ .readlink = ovl_readlink, -+ .getattr = ovl_getattr, -+ .setxattr = ovl_setxattr, -+ .getxattr = ovl_getxattr, -+ .listxattr = ovl_listxattr, -+ .removexattr = ovl_removexattr, -+}; -+ -+struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, -+ struct ovl_entry *oe) -+{ -+ struct inode *inode; -+ -+ inode = new_inode(sb); -+ if (!inode) -+ return NULL; -+ -+ mode &= S_IFMT; -+ -+ inode->i_ino = get_next_ino(); -+ inode->i_mode = mode; -+ inode->i_flags |= S_NOATIME | S_NOCMTIME; -+ -+ switch (mode) { -+ case S_IFDIR: -+ inode->i_private = oe; -+ inode->i_op = &ovl_dir_inode_operations; -+ inode->i_fop = &ovl_dir_operations; -+ break; -+ -+ case S_IFLNK: -+ inode->i_op = &ovl_symlink_inode_operations; -+ break; -+ -+ case S_IFREG: -+ case S_IFSOCK: -+ case S_IFBLK: -+ case S_IFCHR: -+ case S_IFIFO: -+ inode->i_op = &ovl_file_inode_operations; -+ break; -+ -+ default: -+ WARN(1, "illegal file type: %i\n", mode); -+ iput(inode); -+ inode = NULL; -+ } -+ -+ return inode; -+ -+} -diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h -new file mode 100644 -index 0000000..814bed3 ---- /dev/null -+++ b/fs/overlayfs/overlayfs.h -@@ -0,0 +1,191 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+ -+struct ovl_entry; -+ -+enum ovl_path_type { -+ OVL_PATH_PURE_UPPER, -+ OVL_PATH_UPPER, -+ OVL_PATH_MERGE, -+ OVL_PATH_LOWER, -+}; -+ -+extern const char *ovl_opaque_xattr; -+ -+static inline int ovl_do_rmdir(struct inode *dir, struct dentry *dentry) -+{ -+ int err = vfs_rmdir(dir, dentry); -+ pr_debug("rmdir(%pd2) = %i\n", dentry, err); -+ return err; -+} -+ -+static inline int ovl_do_unlink(struct inode *dir, struct dentry *dentry) -+{ -+ int err = vfs_unlink(dir, dentry, NULL); -+ pr_debug("unlink(%pd2) = %i\n", dentry, err); -+ return err; -+} -+ -+static inline int ovl_do_link(struct dentry *old_dentry, struct inode *dir, -+ struct dentry *new_dentry, bool debug) -+{ -+ int err = vfs_link(old_dentry, dir, new_dentry, NULL); -+ if (debug) { -+ pr_debug("link(%pd2, %pd2) = %i\n", -+ old_dentry, new_dentry, err); -+ } -+ return err; -+} -+ -+static inline int ovl_do_create(struct inode *dir, struct dentry *dentry, -+ umode_t mode, bool debug) -+{ -+ int err = vfs_create(dir, dentry, mode, true); -+ if (debug) -+ pr_debug("create(%pd2, 0%o) = %i\n", dentry, mode, err); -+ return err; -+} -+ -+static inline int ovl_do_mkdir(struct inode *dir, struct dentry *dentry, -+ umode_t mode, bool debug) -+{ -+ int err = vfs_mkdir(dir, dentry, mode); -+ if (debug) -+ pr_debug("mkdir(%pd2, 0%o) = %i\n", dentry, mode, err); -+ return err; -+} -+ -+static inline int ovl_do_mknod(struct inode *dir, struct dentry *dentry, -+ umode_t mode, dev_t dev, bool debug) -+{ -+ int err = vfs_mknod(dir, dentry, mode, dev); -+ if (debug) { -+ pr_debug("mknod(%pd2, 0%o, 0%o) = %i\n", -+ dentry, mode, dev, err); -+ } -+ return err; -+} -+ -+static inline int ovl_do_symlink(struct inode *dir, struct dentry *dentry, -+ const char *oldname, bool debug) -+{ -+ int err = vfs_symlink(dir, dentry, oldname); -+ if (debug) -+ pr_debug("symlink(\"%s\", %pd2) = %i\n", oldname, dentry, err); -+ return err; -+} -+ -+static inline int ovl_do_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags) -+{ -+ int err = vfs_setxattr(dentry, name, value, size, flags); -+ pr_debug("setxattr(%pd2, \"%s\", \"%*s\", 0x%x) = %i\n", -+ dentry, name, (int) size, (char *) value, flags, err); -+ return err; -+} -+ -+static inline int ovl_do_removexattr(struct dentry *dentry, const char *name) -+{ -+ int err = vfs_removexattr(dentry, name); -+ pr_debug("removexattr(%pd2, \"%s\") = %i\n", dentry, name, err); -+ return err; -+} -+ -+static inline int ovl_do_rename(struct inode *olddir, struct dentry *olddentry, -+ struct inode *newdir, struct dentry *newdentry, -+ unsigned int flags) -+{ -+ int err; -+ -+ pr_debug("rename2(%pd2, %pd2, 0x%x)\n", -+ olddentry, newdentry, flags); -+ -+ err = vfs_rename(olddir, olddentry, newdir, newdentry, NULL, flags); -+ -+ if (err) { -+ pr_debug("...rename2(%pd2, %pd2, ...) = %i\n", -+ olddentry, newdentry, err); -+ } -+ return err; -+} -+ -+static inline int ovl_do_whiteout(struct inode *dir, struct dentry *dentry) -+{ -+ int err = vfs_whiteout(dir, dentry); -+ pr_debug("whiteout(%pd2) = %i\n", dentry, err); -+ return err; -+} -+ -+enum ovl_path_type ovl_path_type(struct dentry *dentry); -+u64 ovl_dentry_version_get(struct dentry *dentry); -+void ovl_dentry_version_inc(struct dentry *dentry); -+void ovl_path_upper(struct dentry *dentry, struct path *path); -+void ovl_path_lower(struct dentry *dentry, struct path *path); -+enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path); -+struct dentry *ovl_dentry_upper(struct dentry *dentry); -+struct dentry *ovl_dentry_lower(struct dentry *dentry); -+struct dentry *ovl_dentry_real(struct dentry *dentry); -+struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper); -+struct ovl_dir_cache *ovl_dir_cache(struct dentry *dentry); -+void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache); -+struct dentry *ovl_workdir(struct dentry *dentry); -+int ovl_want_write(struct dentry *dentry); -+void ovl_drop_write(struct dentry *dentry); -+bool ovl_dentry_is_opaque(struct dentry *dentry); -+void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque); -+bool ovl_is_whiteout(struct dentry *dentry); -+void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry); -+struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, -+ unsigned int flags); -+struct file *ovl_path_open(struct path *path, int flags); -+ -+struct dentry *ovl_upper_create(struct dentry *upperdir, struct dentry *dentry, -+ struct kstat *stat, const char *link); -+ -+/* readdir.c */ -+extern const struct file_operations ovl_dir_operations; -+int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list); -+void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list); -+void ovl_cache_free(struct list_head *list); -+ -+/* inode.c */ -+int ovl_setattr(struct dentry *dentry, struct iattr *attr); -+int ovl_permission(struct inode *inode, int mask); -+int ovl_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags); -+ssize_t ovl_getxattr(struct dentry *dentry, const char *name, -+ void *value, size_t size); -+ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); -+int ovl_removexattr(struct dentry *dentry, const char *name); -+ -+struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, -+ struct ovl_entry *oe); -+static inline void ovl_copyattr(struct inode *from, struct inode *to) -+{ -+ to->i_uid = from->i_uid; -+ to->i_gid = from->i_gid; -+} -+ -+/* dir.c */ -+extern const struct inode_operations ovl_dir_inode_operations; -+struct dentry *ovl_lookup_temp(struct dentry *workdir, struct dentry *dentry); -+int ovl_create_real(struct inode *dir, struct dentry *newdentry, -+ struct kstat *stat, const char *link, -+ struct dentry *hardlink, bool debug); -+void ovl_cleanup(struct inode *dir, struct dentry *dentry); -+ -+/* copy_up.c */ -+int ovl_copy_up(struct dentry *dentry); -+int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, -+ struct path *lowerpath, struct kstat *stat, -+ struct iattr *attr); -+int ovl_copy_xattr(struct dentry *old, struct dentry *new); -+int ovl_set_attr(struct dentry *upper, struct kstat *stat); -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -new file mode 100644 -index 0000000..c6787f8 ---- /dev/null -+++ b/fs/overlayfs/readdir.c -@@ -0,0 +1,587 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+struct ovl_cache_entry { -+ const char *name; -+ unsigned int len; -+ unsigned int type; -+ u64 ino; -+ bool is_whiteout; -+ struct list_head l_node; -+ struct rb_node node; -+}; -+ -+struct ovl_dir_cache { -+ long refcount; -+ u64 version; -+ struct list_head entries; -+}; -+ -+struct ovl_readdir_data { -+ struct dir_context ctx; -+ bool is_merge; -+ struct rb_root *root; -+ struct list_head *list; -+ struct list_head *middle; -+ int count; -+ int err; -+}; -+ -+struct ovl_dir_file { -+ bool is_real; -+ bool is_upper; -+ struct ovl_dir_cache *cache; -+ struct ovl_cache_entry cursor; -+ struct file *realfile; -+ struct file *upperfile; -+}; -+ -+static struct ovl_cache_entry *ovl_cache_entry_from_node(struct rb_node *n) -+{ -+ return container_of(n, struct ovl_cache_entry, node); -+} -+ -+static struct ovl_cache_entry *ovl_cache_entry_find(struct rb_root *root, -+ const char *name, int len) -+{ -+ struct rb_node *node = root->rb_node; -+ int cmp; -+ -+ while (node) { -+ struct ovl_cache_entry *p = ovl_cache_entry_from_node(node); -+ -+ cmp = strncmp(name, p->name, len); -+ if (cmp > 0) -+ node = p->node.rb_right; -+ else if (cmp < 0 || len < p->len) -+ node = p->node.rb_left; -+ else -+ return p; -+ } -+ -+ return NULL; -+} -+ -+static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, -+ u64 ino, unsigned int d_type) -+{ -+ struct ovl_cache_entry *p; -+ -+ p = kmalloc(sizeof(*p) + len + 1, GFP_KERNEL); -+ if (p) { -+ char *name_copy = (char *) (p + 1); -+ memcpy(name_copy, name, len); -+ name_copy[len] = '\0'; -+ p->name = name_copy; -+ p->len = len; -+ p->type = d_type; -+ p->ino = ino; -+ p->is_whiteout = false; -+ } -+ -+ return p; -+} -+ -+static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, -+ const char *name, int len, u64 ino, -+ unsigned int d_type) -+{ -+ struct rb_node **newp = &rdd->root->rb_node; -+ struct rb_node *parent = NULL; -+ struct ovl_cache_entry *p; -+ -+ while (*newp) { -+ int cmp; -+ struct ovl_cache_entry *tmp; -+ -+ parent = *newp; -+ tmp = ovl_cache_entry_from_node(*newp); -+ cmp = strncmp(name, tmp->name, len); -+ if (cmp > 0) -+ newp = &tmp->node.rb_right; -+ else if (cmp < 0 || len < tmp->len) -+ newp = &tmp->node.rb_left; -+ else -+ return 0; -+ } -+ -+ p = ovl_cache_entry_new(name, len, ino, d_type); -+ if (p == NULL) -+ return -ENOMEM; -+ -+ list_add_tail(&p->l_node, rdd->list); -+ rb_link_node(&p->node, parent, newp); -+ rb_insert_color(&p->node, rdd->root); -+ -+ return 0; -+} -+ -+static int ovl_fill_lower(struct ovl_readdir_data *rdd, -+ const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) -+{ -+ struct ovl_cache_entry *p; -+ -+ p = ovl_cache_entry_find(rdd->root, name, namelen); -+ if (p) { -+ list_move_tail(&p->l_node, rdd->middle); -+ } else { -+ p = ovl_cache_entry_new(name, namelen, ino, d_type); -+ if (p == NULL) -+ rdd->err = -ENOMEM; -+ else -+ list_add_tail(&p->l_node, rdd->middle); -+ } -+ -+ return rdd->err; -+} -+ -+void ovl_cache_free(struct list_head *list) -+{ -+ struct ovl_cache_entry *p; -+ struct ovl_cache_entry *n; -+ -+ list_for_each_entry_safe(p, n, list, l_node) -+ kfree(p); -+ -+ INIT_LIST_HEAD(list); -+} -+ -+static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry) -+{ -+ struct ovl_dir_cache *cache = od->cache; -+ -+ list_del(&od->cursor.l_node); -+ WARN_ON(cache->refcount <= 0); -+ cache->refcount--; -+ if (!cache->refcount) { -+ if (ovl_dir_cache(dentry) == cache) -+ ovl_set_dir_cache(dentry, NULL); -+ -+ ovl_cache_free(&cache->entries); -+ kfree(cache); -+ } -+} -+ -+static int ovl_fill_merge(void *buf, const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) -+{ -+ struct ovl_readdir_data *rdd = buf; -+ -+ rdd->count++; -+ if (!rdd->is_merge) -+ return ovl_cache_entry_add_rb(rdd, name, namelen, ino, d_type); -+ else -+ return ovl_fill_lower(rdd, name, namelen, offset, ino, d_type); -+} -+ -+static inline int ovl_dir_read(struct path *realpath, -+ struct ovl_readdir_data *rdd) -+{ -+ struct file *realfile; -+ int err; -+ -+ realfile = ovl_path_open(realpath, O_RDONLY | O_DIRECTORY); -+ if (IS_ERR(realfile)) -+ return PTR_ERR(realfile); -+ -+ rdd->ctx.pos = 0; -+ do { -+ rdd->count = 0; -+ rdd->err = 0; -+ err = iterate_dir(realfile, &rdd->ctx); -+ if (err >= 0) -+ err = rdd->err; -+ } while (!err && rdd->count); -+ fput(realfile); -+ -+ return err; -+} -+ -+static void ovl_dir_reset(struct file *file) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ struct ovl_dir_cache *cache = od->cache; -+ struct dentry *dentry = file->f_path.dentry; -+ enum ovl_path_type type = ovl_path_type(dentry); -+ -+ if (cache && ovl_dentry_version_get(dentry) != cache->version) { -+ ovl_cache_put(od, dentry); -+ od->cache = NULL; -+ } -+ WARN_ON(!od->is_real && type != OVL_PATH_MERGE); -+ if (od->is_real && type == OVL_PATH_MERGE) -+ od->is_real = false; -+} -+ -+static int ovl_dir_mark_whiteouts(struct dentry *dir, -+ struct ovl_readdir_data *rdd) -+{ -+ struct ovl_cache_entry *p; -+ struct dentry *dentry; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) { -+ ovl_cache_free(rdd->list); -+ return -ENOMEM; -+ } -+ -+ /* -+ * CAP_DAC_OVERRIDE for lookup -+ */ -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ old_cred = override_creds(override_cred); -+ -+ mutex_lock(&dir->d_inode->i_mutex); -+ list_for_each_entry(p, rdd->list, l_node) { -+ if (!p->name) -+ continue; -+ -+ if (p->type != DT_CHR) -+ continue; -+ -+ dentry = lookup_one_len(p->name, dir, p->len); -+ if (IS_ERR(dentry)) -+ continue; -+ -+ p->is_whiteout = ovl_is_whiteout(dentry); -+ dput(dentry); -+ } -+ mutex_unlock(&dir->d_inode->i_mutex); -+ -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+ return 0; -+} -+ -+static inline int ovl_dir_read_merged(struct path *upperpath, -+ struct path *lowerpath, -+ struct list_head *list) -+{ -+ int err; -+ struct rb_root root = RB_ROOT; -+ struct list_head middle; -+ struct ovl_readdir_data rdd = { -+ .ctx.actor = ovl_fill_merge, -+ .list = list, -+ .root = &root, -+ .is_merge = false, -+ }; -+ -+ if (upperpath->dentry) { -+ err = ovl_dir_read(upperpath, &rdd); -+ if (err) -+ goto out; -+ -+ if (lowerpath->dentry) { -+ err = ovl_dir_mark_whiteouts(upperpath->dentry, &rdd); -+ if (err) -+ goto out; -+ } -+ } -+ if (lowerpath->dentry) { -+ /* -+ * Insert lowerpath entries before upperpath ones, this allows -+ * offsets to be reasonably constant -+ */ -+ list_add(&middle, rdd.list); -+ rdd.middle = &middle; -+ rdd.is_merge = true; -+ err = ovl_dir_read(lowerpath, &rdd); -+ list_del(&middle); -+ } -+out: -+ return err; -+ -+} -+ -+static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) -+{ -+ struct ovl_cache_entry *p; -+ loff_t off = 0; -+ -+ list_for_each_entry(p, &od->cache->entries, l_node) { -+ if (!p->name) -+ continue; -+ if (off >= pos) -+ break; -+ off++; -+ } -+ list_move_tail(&od->cursor.l_node, &p->l_node); -+} -+ -+static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) -+{ -+ int res; -+ struct path lowerpath; -+ struct path upperpath; -+ struct ovl_dir_cache *cache; -+ -+ cache = ovl_dir_cache(dentry); -+ if (cache && ovl_dentry_version_get(dentry) == cache->version) { -+ cache->refcount++; -+ return cache; -+ } -+ ovl_set_dir_cache(dentry, NULL); -+ -+ cache = kzalloc(sizeof(struct ovl_dir_cache), GFP_KERNEL); -+ if (!cache) -+ return ERR_PTR(-ENOMEM); -+ -+ cache->refcount = 1; -+ INIT_LIST_HEAD(&cache->entries); -+ -+ ovl_path_lower(dentry, &lowerpath); -+ ovl_path_upper(dentry, &upperpath); -+ -+ res = ovl_dir_read_merged(&upperpath, &lowerpath, &cache->entries); -+ if (res) { -+ ovl_cache_free(&cache->entries); -+ kfree(cache); -+ return ERR_PTR(res); -+ } -+ -+ cache->version = ovl_dentry_version_get(dentry); -+ ovl_set_dir_cache(dentry, cache); -+ -+ return cache; -+} -+ -+static int ovl_iterate(struct file *file, struct dir_context *ctx) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ struct dentry *dentry = file->f_path.dentry; -+ -+ if (!ctx->pos) -+ ovl_dir_reset(file); -+ -+ if (od->is_real) -+ return iterate_dir(od->realfile, ctx); -+ -+ if (!od->cache) { -+ struct ovl_dir_cache *cache; -+ -+ cache = ovl_cache_get(dentry); -+ if (IS_ERR(cache)) -+ return PTR_ERR(cache); -+ -+ od->cache = cache; -+ ovl_seek_cursor(od, ctx->pos); -+ } -+ -+ while (od->cursor.l_node.next != &od->cache->entries) { -+ struct ovl_cache_entry *p; -+ -+ p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); -+ /* Skip cursors */ -+ if (p->name) { -+ if (!p->is_whiteout) { -+ if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) -+ break; -+ } -+ ctx->pos++; -+ } -+ list_move(&od->cursor.l_node, &p->l_node); -+ } -+ return 0; -+} -+ -+static loff_t ovl_dir_llseek(struct file *file, loff_t offset, int origin) -+{ -+ loff_t res; -+ struct ovl_dir_file *od = file->private_data; -+ -+ mutex_lock(&file_inode(file)->i_mutex); -+ if (!file->f_pos) -+ ovl_dir_reset(file); -+ -+ if (od->is_real) { -+ res = vfs_llseek(od->realfile, offset, origin); -+ file->f_pos = od->realfile->f_pos; -+ } else { -+ res = -EINVAL; -+ -+ switch (origin) { -+ case SEEK_CUR: -+ offset += file->f_pos; -+ break; -+ case SEEK_SET: -+ break; -+ default: -+ goto out_unlock; -+ } -+ if (offset < 0) -+ goto out_unlock; -+ -+ if (offset != file->f_pos) { -+ file->f_pos = offset; -+ if (od->cache) -+ ovl_seek_cursor(od, offset); -+ } -+ res = offset; -+ } -+out_unlock: -+ mutex_unlock(&file_inode(file)->i_mutex); -+ -+ return res; -+} -+ -+static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, -+ int datasync) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ struct dentry *dentry = file->f_path.dentry; -+ struct file *realfile = od->realfile; -+ -+ /* -+ * Need to check if we started out being a lower dir, but got copied up -+ */ -+ if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { -+ struct inode *inode = file_inode(file); -+ -+ mutex_lock(&inode->i_mutex); -+ realfile = od->upperfile; -+ if (!realfile) { -+ struct path upperpath; -+ -+ ovl_path_upper(dentry, &upperpath); -+ realfile = ovl_path_open(&upperpath, O_RDONLY); -+ if (IS_ERR(realfile)) { -+ mutex_unlock(&inode->i_mutex); -+ return PTR_ERR(realfile); -+ } -+ od->upperfile = realfile; -+ } -+ mutex_unlock(&inode->i_mutex); -+ } -+ -+ return vfs_fsync_range(realfile, start, end, datasync); -+} -+ -+static int ovl_dir_release(struct inode *inode, struct file *file) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ -+ if (od->cache) { -+ mutex_lock(&inode->i_mutex); -+ ovl_cache_put(od, file->f_path.dentry); -+ mutex_unlock(&inode->i_mutex); -+ } -+ fput(od->realfile); -+ if (od->upperfile) -+ fput(od->upperfile); -+ kfree(od); -+ -+ return 0; -+} -+ -+static int ovl_dir_open(struct inode *inode, struct file *file) -+{ -+ struct path realpath; -+ struct file *realfile; -+ struct ovl_dir_file *od; -+ enum ovl_path_type type; -+ -+ od = kzalloc(sizeof(struct ovl_dir_file), GFP_KERNEL); -+ if (!od) -+ return -ENOMEM; -+ -+ type = ovl_path_real(file->f_path.dentry, &realpath); -+ realfile = ovl_path_open(&realpath, file->f_flags); -+ if (IS_ERR(realfile)) { -+ kfree(od); -+ return PTR_ERR(realfile); -+ } -+ INIT_LIST_HEAD(&od->cursor.l_node); -+ od->realfile = realfile; -+ od->is_real = (type != OVL_PATH_MERGE); -+ od->is_upper = (type != OVL_PATH_LOWER); -+ file->private_data = od; -+ -+ return 0; -+} -+ -+const struct file_operations ovl_dir_operations = { -+ .read = generic_read_dir, -+ .open = ovl_dir_open, -+ .iterate = ovl_iterate, -+ .llseek = ovl_dir_llseek, -+ .fsync = ovl_dir_fsync, -+ .release = ovl_dir_release, -+}; -+ -+int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) -+{ -+ int err; -+ struct path lowerpath; -+ struct path upperpath; -+ struct ovl_cache_entry *p; -+ -+ ovl_path_upper(dentry, &upperpath); -+ ovl_path_lower(dentry, &lowerpath); -+ -+ err = ovl_dir_read_merged(&upperpath, &lowerpath, list); -+ if (err) -+ return err; -+ -+ err = 0; -+ -+ list_for_each_entry(p, list, l_node) { -+ if (p->is_whiteout) -+ continue; -+ -+ if (p->name[0] == '.') { -+ if (p->len == 1) -+ continue; -+ if (p->len == 2 && p->name[1] == '.') -+ continue; -+ } -+ err = -ENOTEMPTY; -+ break; -+ } -+ -+ return err; -+} -+ -+void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) -+{ -+ struct ovl_cache_entry *p; -+ -+ mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_PARENT); -+ list_for_each_entry(p, list, l_node) { -+ struct dentry *dentry; -+ -+ if (!p->is_whiteout) -+ continue; -+ -+ dentry = lookup_one_len(p->name, upper, p->len); -+ if (IS_ERR(dentry)) { -+ pr_err("overlayfs: lookup '%s/%.*s' failed (%i)\n", -+ upper->d_name.name, p->len, p->name, -+ (int) PTR_ERR(dentry)); -+ continue; -+ } -+ ovl_cleanup(upper->d_inode, dentry); -+ dput(dentry); -+ } -+ mutex_unlock(&upper->d_inode->i_mutex); -+} -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -new file mode 100644 -index 0000000..227710a ---- /dev/null -+++ b/fs/overlayfs/super.c -@@ -0,0 +1,727 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+MODULE_AUTHOR("Miklos Szeredi "); -+MODULE_DESCRIPTION("Overlay filesystem"); -+MODULE_LICENSE("GPL"); -+ -+/* private information held for overlayfs's superblock */ -+struct ovl_fs { -+ struct vfsmount *upper_mnt; -+ struct vfsmount *lower_mnt; -+ struct dentry *workdir; -+}; -+ -+struct ovl_dir_cache; -+ -+/* private information held for every overlayfs dentry */ -+struct ovl_entry { -+ struct dentry *__upperdentry; -+ struct dentry *lowerdentry; -+ struct ovl_dir_cache *cache; -+ union { -+ struct { -+ u64 version; -+ bool opaque; -+ }; -+ struct rcu_head rcu; -+ }; -+}; -+ -+const char *ovl_opaque_xattr = "trusted.overlay.opaque"; -+ -+ -+enum ovl_path_type ovl_path_type(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ if (oe->__upperdentry) { -+ if (oe->lowerdentry) { -+ if (S_ISDIR(dentry->d_inode->i_mode)) -+ return OVL_PATH_MERGE; -+ else -+ return OVL_PATH_UPPER; -+ } else { -+ if (oe->opaque) -+ return OVL_PATH_UPPER; -+ else -+ return OVL_PATH_PURE_UPPER; -+ } -+ } else { -+ return OVL_PATH_LOWER; -+ } -+} -+ -+static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) -+{ -+ struct dentry *upperdentry = ACCESS_ONCE(oe->__upperdentry); -+ /* -+ * Make sure to order reads to upperdentry wrt ovl_dentry_update() -+ */ -+ smp_read_barrier_depends(); -+ return upperdentry; -+} -+ -+void ovl_path_upper(struct dentry *dentry, struct path *path) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ path->mnt = ofs->upper_mnt; -+ path->dentry = ovl_upperdentry_dereference(oe); -+} -+ -+enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path) -+{ -+ -+ enum ovl_path_type type = ovl_path_type(dentry); -+ -+ if (type == OVL_PATH_LOWER) -+ ovl_path_lower(dentry, path); -+ else -+ ovl_path_upper(dentry, path); -+ -+ return type; -+} -+ -+struct dentry *ovl_dentry_upper(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ return ovl_upperdentry_dereference(oe); -+} -+ -+struct dentry *ovl_dentry_lower(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ return oe->lowerdentry; -+} -+ -+struct dentry *ovl_dentry_real(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ struct dentry *realdentry; -+ -+ realdentry = ovl_upperdentry_dereference(oe); -+ if (!realdentry) -+ realdentry = oe->lowerdentry; -+ -+ return realdentry; -+} -+ -+struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper) -+{ -+ struct dentry *realdentry; -+ -+ realdentry = ovl_upperdentry_dereference(oe); -+ if (realdentry) { -+ *is_upper = true; -+ } else { -+ realdentry = oe->lowerdentry; -+ *is_upper = false; -+ } -+ return realdentry; -+} -+ -+struct ovl_dir_cache *ovl_dir_cache(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ return oe->cache; -+} -+ -+void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ oe->cache = cache; -+} -+ -+void ovl_path_lower(struct dentry *dentry, struct path *path) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ path->mnt = ofs->lower_mnt; -+ path->dentry = oe->lowerdentry; -+} -+ -+int ovl_want_write(struct dentry *dentry) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ return mnt_want_write(ofs->upper_mnt); -+} -+ -+void ovl_drop_write(struct dentry *dentry) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ mnt_drop_write(ofs->upper_mnt); -+} -+ -+struct dentry *ovl_workdir(struct dentry *dentry) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ return ofs->workdir; -+} -+ -+bool ovl_dentry_is_opaque(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ return oe->opaque; -+} -+ -+void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ oe->opaque = opaque; -+} -+ -+void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ WARN_ON(!mutex_is_locked(&upperdentry->d_parent->d_inode->i_mutex)); -+ WARN_ON(oe->__upperdentry); -+ BUG_ON(!upperdentry->d_inode); -+ /* -+ * Make sure upperdentry is consistent before making it visible to -+ * ovl_upperdentry_dereference(). -+ */ -+ smp_wmb(); -+ oe->__upperdentry = upperdentry; -+} -+ -+void ovl_dentry_version_inc(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); -+ oe->version++; -+} -+ -+u64 ovl_dentry_version_get(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); -+ return oe->version; -+} -+ -+bool ovl_is_whiteout(struct dentry *dentry) -+{ -+ struct inode *inode = dentry->d_inode; -+ -+ return inode && IS_WHITEOUT(inode); -+} -+ -+static bool ovl_is_opaquedir(struct dentry *dentry) -+{ -+ int res; -+ char val; -+ struct inode *inode = dentry->d_inode; -+ -+ if (!S_ISDIR(inode->i_mode) || !inode->i_op->getxattr) -+ return false; -+ -+ res = inode->i_op->getxattr(dentry, ovl_opaque_xattr, &val, 1); -+ if (res == 1 && val == 'y') -+ return true; -+ -+ return false; -+} -+ -+static void ovl_dentry_release(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ if (oe) { -+ dput(oe->__upperdentry); -+ dput(oe->lowerdentry); -+ kfree_rcu(oe, rcu); -+ } -+} -+ -+static const struct dentry_operations ovl_dentry_operations = { -+ .d_release = ovl_dentry_release, -+}; -+ -+static struct ovl_entry *ovl_alloc_entry(void) -+{ -+ return kzalloc(sizeof(struct ovl_entry), GFP_KERNEL); -+} -+ -+static inline struct dentry *ovl_lookup_real(struct dentry *dir, -+ struct qstr *name) -+{ -+ struct dentry *dentry; -+ -+ mutex_lock(&dir->d_inode->i_mutex); -+ dentry = lookup_one_len(name->name, dir, name->len); -+ mutex_unlock(&dir->d_inode->i_mutex); -+ -+ if (IS_ERR(dentry)) { -+ if (PTR_ERR(dentry) == -ENOENT) -+ dentry = NULL; -+ } else if (!dentry->d_inode) { -+ dput(dentry); -+ dentry = NULL; -+ } -+ return dentry; -+} -+ -+struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, -+ unsigned int flags) -+{ -+ struct ovl_entry *oe; -+ struct dentry *upperdir; -+ struct dentry *lowerdir; -+ struct dentry *upperdentry = NULL; -+ struct dentry *lowerdentry = NULL; -+ struct inode *inode = NULL; -+ int err; -+ -+ err = -ENOMEM; -+ oe = ovl_alloc_entry(); -+ if (!oe) -+ goto out; -+ -+ upperdir = ovl_dentry_upper(dentry->d_parent); -+ lowerdir = ovl_dentry_lower(dentry->d_parent); -+ -+ if (upperdir) { -+ upperdentry = ovl_lookup_real(upperdir, &dentry->d_name); -+ err = PTR_ERR(upperdentry); -+ if (IS_ERR(upperdentry)) -+ goto out_put_dir; -+ -+ if (lowerdir && upperdentry) { -+ if (ovl_is_whiteout(upperdentry)) { -+ dput(upperdentry); -+ upperdentry = NULL; -+ oe->opaque = true; -+ } else if (ovl_is_opaquedir(upperdentry)) { -+ oe->opaque = true; -+ } -+ } -+ } -+ if (lowerdir && !oe->opaque) { -+ lowerdentry = ovl_lookup_real(lowerdir, &dentry->d_name); -+ err = PTR_ERR(lowerdentry); -+ if (IS_ERR(lowerdentry)) -+ goto out_dput_upper; -+ } -+ -+ if (lowerdentry && upperdentry && -+ (!S_ISDIR(upperdentry->d_inode->i_mode) || -+ !S_ISDIR(lowerdentry->d_inode->i_mode))) { -+ dput(lowerdentry); -+ lowerdentry = NULL; -+ oe->opaque = true; -+ } -+ -+ if (lowerdentry || upperdentry) { -+ struct dentry *realdentry; -+ -+ realdentry = upperdentry ? upperdentry : lowerdentry; -+ err = -ENOMEM; -+ inode = ovl_new_inode(dentry->d_sb, realdentry->d_inode->i_mode, -+ oe); -+ if (!inode) -+ goto out_dput; -+ ovl_copyattr(realdentry->d_inode, inode); -+ } -+ -+ oe->__upperdentry = upperdentry; -+ oe->lowerdentry = lowerdentry; -+ -+ dentry->d_fsdata = oe; -+ d_add(dentry, inode); -+ -+ return NULL; -+ -+out_dput: -+ dput(lowerdentry); -+out_dput_upper: -+ dput(upperdentry); -+out_put_dir: -+ kfree(oe); -+out: -+ return ERR_PTR(err); -+} -+ -+struct file *ovl_path_open(struct path *path, int flags) -+{ -+ return dentry_open(path, flags, current_cred()); -+} -+ -+static void ovl_put_super(struct super_block *sb) -+{ -+ struct ovl_fs *ufs = sb->s_fs_info; -+ -+ dput(ufs->workdir); -+ mntput(ufs->upper_mnt); -+ mntput(ufs->lower_mnt); -+ -+ kfree(ufs); -+} -+ -+static const struct super_operations ovl_super_operations = { -+ .put_super = ovl_put_super, -+}; -+ -+struct ovl_config { -+ char *lowerdir; -+ char *upperdir; -+ char *workdir; -+}; -+ -+enum { -+ OPT_LOWERDIR, -+ OPT_UPPERDIR, -+ OPT_WORKDIR, -+ OPT_ERR, -+}; -+ -+static const match_table_t ovl_tokens = { -+ {OPT_LOWERDIR, "lowerdir=%s"}, -+ {OPT_UPPERDIR, "upperdir=%s"}, -+ {OPT_WORKDIR, "workdir=%s"}, -+ {OPT_ERR, NULL} -+}; -+ -+static int ovl_parse_opt(char *opt, struct ovl_config *config) -+{ -+ char *p; -+ -+ config->upperdir = NULL; -+ config->lowerdir = NULL; -+ config->workdir = NULL; -+ -+ while ((p = strsep(&opt, ",")) != NULL) { -+ int token; -+ substring_t args[MAX_OPT_ARGS]; -+ -+ if (!*p) -+ continue; -+ -+ token = match_token(p, ovl_tokens, args); -+ switch (token) { -+ case OPT_UPPERDIR: -+ kfree(config->upperdir); -+ config->upperdir = match_strdup(&args[0]); -+ if (!config->upperdir) -+ return -ENOMEM; -+ break; -+ -+ case OPT_LOWERDIR: -+ kfree(config->lowerdir); -+ config->lowerdir = match_strdup(&args[0]); -+ if (!config->lowerdir) -+ return -ENOMEM; -+ break; -+ -+ case OPT_WORKDIR: -+ kfree(config->workdir); -+ config->workdir = match_strdup(&args[0]); -+ if (!config->workdir) -+ return -ENOMEM; -+ break; -+ -+ default: -+ return -EINVAL; -+ } -+ } -+ return 0; -+} -+ -+#define OVL_WORKDIR_NAME "work" -+ -+static struct dentry *ovl_workdir_create(struct vfsmount *mnt, -+ struct dentry *dentry) -+{ -+ struct inode *dir = dentry->d_inode; -+ struct dentry *work; -+ int err; -+ bool retried = false; -+ -+ err = mnt_want_write(mnt); -+ if (err) -+ return ERR_PTR(err); -+ -+ mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); -+retry: -+ work = lookup_one_len(OVL_WORKDIR_NAME, dentry, -+ strlen(OVL_WORKDIR_NAME)); -+ -+ if (!IS_ERR(work)) { -+ struct kstat stat = { -+ .mode = S_IFDIR | 0, -+ }; -+ -+ if (work->d_inode) { -+ err = -EEXIST; -+ if (retried) -+ goto out_dput; -+ -+ retried = true; -+ ovl_cleanup(dir, work); -+ dput(work); -+ goto retry; -+ } -+ -+ err = ovl_create_real(dir, work, &stat, NULL, NULL, true); -+ if (err) -+ goto out_dput; -+ } -+out_unlock: -+ mutex_unlock(&dir->i_mutex); -+ mnt_drop_write(mnt); -+ -+ return work; -+ -+out_dput: -+ dput(work); -+ work = ERR_PTR(err); -+ goto out_unlock; -+} -+ -+static int ovl_mount_dir(const char *name, struct path *path) -+{ -+ int err; -+ -+ err = kern_path(name, LOOKUP_FOLLOW, path); -+ if (err) { -+ pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); -+ err = -EINVAL; -+ } -+ return err; -+} -+ -+static bool ovl_is_allowed_fs_type(struct dentry *root) -+{ -+ const struct dentry_operations *dop = root->d_op; -+ -+ /* -+ * We don't support: -+ * - automount filesystems -+ * - filesystems with revalidate (FIXME for lower layer) -+ * - filesystems with case insensitive names -+ */ -+ if (dop && -+ (dop->d_manage || dop->d_automount || -+ dop->d_revalidate || dop->d_weak_revalidate || -+ dop->d_compare || dop->d_hash)) { -+ return false; -+ } -+ return true; -+} -+ -+/* Workdir should not be subdir of upperdir and vice versa */ -+static bool ovl_workdir_ok(struct dentry *workdir, struct dentry *upperdir) -+{ -+ bool ok = false; -+ -+ if (workdir != upperdir) { -+ ok = (lock_rename(workdir, upperdir) == NULL); -+ unlock_rename(workdir, upperdir); -+ } -+ return ok; -+} -+ -+static int ovl_fill_super(struct super_block *sb, void *data, int silent) -+{ -+ struct path lowerpath; -+ struct path upperpath; -+ struct path workpath; -+ struct inode *root_inode; -+ struct dentry *root_dentry; -+ struct ovl_entry *oe; -+ struct ovl_fs *ufs; -+ struct ovl_config config; -+ int err; -+ -+ err = ovl_parse_opt((char *) data, &config); -+ if (err) -+ goto out; -+ -+ /* FIXME: workdir is not needed for a R/O mount */ -+ err = -EINVAL; -+ if (!config.upperdir || !config.lowerdir || !config.workdir) { -+ pr_err("overlayfs: missing upperdir or lowerdir or workdir\n"); -+ goto out_free_config; -+ } -+ -+ err = -ENOMEM; -+ ufs = kmalloc(sizeof(struct ovl_fs), GFP_KERNEL); -+ if (!ufs) -+ goto out_free_config; -+ -+ oe = ovl_alloc_entry(); -+ if (oe == NULL) -+ goto out_free_ufs; -+ -+ err = ovl_mount_dir(config.upperdir, &upperpath); -+ if (err) -+ goto out_free_oe; -+ -+ err = ovl_mount_dir(config.lowerdir, &lowerpath); -+ if (err) -+ goto out_put_upperpath; -+ -+ err = ovl_mount_dir(config.workdir, &workpath); -+ if (err) -+ goto out_put_lowerpath; -+ -+ err = -EINVAL; -+ if (!S_ISDIR(upperpath.dentry->d_inode->i_mode) || -+ !S_ISDIR(lowerpath.dentry->d_inode->i_mode) || -+ !S_ISDIR(workpath.dentry->d_inode->i_mode)) { -+ pr_err("overlayfs: upperdir or lowerdir or workdir not a directory\n"); -+ goto out_put_workpath; -+ } -+ -+ if (upperpath.mnt != workpath.mnt) { -+ pr_err("overlayfs: workdir and upperdir must reside under the same mount\n"); -+ goto out_put_workpath; -+ } -+ if (!ovl_workdir_ok(workpath.dentry, upperpath.dentry)) { -+ pr_err("overlayfs: workdir and upperdir must be separate subtrees\n"); -+ goto out_put_workpath; -+ } -+ -+ if (!ovl_is_allowed_fs_type(upperpath.dentry)) { -+ pr_err("overlayfs: filesystem of upperdir is not supported\n"); -+ goto out_put_workpath; -+ } -+ -+ if (!ovl_is_allowed_fs_type(lowerpath.dentry)) { -+ pr_err("overlayfs: filesystem of lowerdir is not supported\n"); -+ goto out_put_workpath; -+ } -+ -+ ufs->upper_mnt = clone_private_mount(&upperpath); -+ err = PTR_ERR(ufs->upper_mnt); -+ if (IS_ERR(ufs->upper_mnt)) { -+ pr_err("overlayfs: failed to clone upperpath\n"); -+ goto out_put_workpath; -+ } -+ -+ ufs->lower_mnt = clone_private_mount(&lowerpath); -+ err = PTR_ERR(ufs->lower_mnt); -+ if (IS_ERR(ufs->lower_mnt)) { -+ pr_err("overlayfs: failed to clone lowerpath\n"); -+ goto out_put_upper_mnt; -+ } -+ -+ ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); -+ err = PTR_ERR(ufs->workdir); -+ if (IS_ERR(ufs->workdir)) { -+ pr_err("overlayfs: failed to create directory %s/%s\n", -+ config.workdir, OVL_WORKDIR_NAME); -+ goto out_put_lower_mnt; -+ } -+ -+ /* -+ * Make lower_mnt R/O. That way fchmod/fchown on lower file -+ * will fail instead of modifying lower fs. -+ */ -+ ufs->lower_mnt->mnt_flags |= MNT_READONLY; -+ -+ /* If the upper fs is r/o, we mark overlayfs r/o too */ -+ if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY) -+ sb->s_flags |= MS_RDONLY; -+ -+ sb->s_d_op = &ovl_dentry_operations; -+ -+ err = -ENOMEM; -+ root_inode = ovl_new_inode(sb, S_IFDIR, oe); -+ if (!root_inode) -+ goto out_put_workdir; -+ -+ root_dentry = d_make_root(root_inode); -+ if (!root_dentry) -+ goto out_put_workdir; -+ -+ mntput(upperpath.mnt); -+ mntput(lowerpath.mnt); -+ path_put(&workpath); -+ -+ oe->__upperdentry = upperpath.dentry; -+ oe->lowerdentry = lowerpath.dentry; -+ -+ root_dentry->d_fsdata = oe; -+ -+ sb->s_op = &ovl_super_operations; -+ sb->s_root = root_dentry; -+ sb->s_fs_info = ufs; -+ -+ return 0; -+ -+out_put_workdir: -+ dput(ufs->workdir); -+out_put_lower_mnt: -+ mntput(ufs->lower_mnt); -+out_put_upper_mnt: -+ mntput(ufs->upper_mnt); -+out_put_workpath: -+ path_put(&workpath); -+out_put_lowerpath: -+ path_put(&lowerpath); -+out_put_upperpath: -+ path_put(&upperpath); -+out_free_oe: -+ kfree(oe); -+out_free_ufs: -+ kfree(ufs); -+out_free_config: -+ kfree(config.lowerdir); -+ kfree(config.upperdir); -+ kfree(config.workdir); -+out: -+ return err; -+} -+ -+static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags, -+ const char *dev_name, void *raw_data) -+{ -+ return mount_nodev(fs_type, flags, raw_data, ovl_fill_super); -+} -+ -+static struct file_system_type ovl_fs_type = { -+ .owner = THIS_MODULE, -+ .name = "overlayfs", -+ .mount = ovl_mount, -+ .kill_sb = kill_anon_super, -+}; -+MODULE_ALIAS_FS("overlayfs"); -+ -+static int __init ovl_init(void) -+{ -+ return register_filesystem(&ovl_fs_type); -+} -+ -+static void __exit ovl_exit(void) -+{ -+ unregister_filesystem(&ovl_fs_type); -+} -+ -+module_init(ovl_init); -+module_exit(ovl_exit); --- -2.7.4 - - -From a38696f51b951dddbba71e7a3cabb47d9347fa06 Mon Sep 17 00:00:00 2001 -From: Andy Whitcroft -Date: Fri, 24 Oct 2014 00:14:38 +0200 -Subject: [PATCH 21/73] overlayfs: add statfs support - -Add support for statfs to the overlayfs filesystem. As the upper layer -is the target of all write operations assume that the space in that -filesystem is the space in the overlayfs. There will be some inaccuracy as -overwriting a file will copy it up and consume space we were not expecting, -but it is better than nothing. - -Use the upper layer dentry and mount from the overlayfs root inode, -passing the statfs call to that filesystem. - -Signed-off-by: Andy Whitcroft -Signed-off-by: Miklos Szeredi -(cherry picked from commit cc2596392af3b1404421aaef828a255303c46f93) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 227710a..aaf562b 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -16,17 +16,21 @@ - #include - #include - #include -+#include - #include "overlayfs.h" - - MODULE_AUTHOR("Miklos Szeredi "); - MODULE_DESCRIPTION("Overlay filesystem"); - MODULE_LICENSE("GPL"); - -+#define OVERLAYFS_SUPER_MAGIC 0x794c764f -+ - /* private information held for overlayfs's superblock */ - struct ovl_fs { - struct vfsmount *upper_mnt; - struct vfsmount *lower_mnt; - struct dentry *workdir; -+ long lower_namelen; - }; - - struct ovl_dir_cache; -@@ -383,8 +387,35 @@ static void ovl_put_super(struct super_block *sb) - kfree(ufs); - } - -+/** -+ * ovl_statfs -+ * @sb: The overlayfs super block -+ * @buf: The struct kstatfs to fill in with stats -+ * -+ * Get the filesystem statistics. As writes always target the upper layer -+ * filesystem pass the statfs to the same filesystem. -+ */ -+static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ struct dentry *root_dentry = dentry->d_sb->s_root; -+ struct path path; -+ int err; -+ -+ ovl_path_upper(root_dentry, &path); -+ -+ err = vfs_statfs(&path, buf); -+ if (!err) { -+ buf->f_namelen = max(buf->f_namelen, ofs->lower_namelen); -+ buf->f_type = OVERLAYFS_SUPER_MAGIC; -+ } -+ -+ return err; -+} -+ - static const struct super_operations ovl_super_operations = { - .put_super = ovl_put_super, -+ .statfs = ovl_statfs, - }; - - struct ovl_config { -@@ -556,6 +587,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - struct ovl_entry *oe; - struct ovl_fs *ufs; - struct ovl_config config; -+ struct kstatfs statfs; - int err; - - err = ovl_parse_opt((char *) data, &config); -@@ -617,6 +649,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - goto out_put_workpath; - } - -+ err = vfs_statfs(&lowerpath, &statfs); -+ if (err) { -+ pr_err("overlayfs: statfs failed on lowerpath\n"); -+ goto out_put_workpath; -+ } -+ ufs->lower_namelen = statfs.f_namelen; -+ - ufs->upper_mnt = clone_private_mount(&upperpath); - err = PTR_ERR(ufs->upper_mnt); - if (IS_ERR(ufs->upper_mnt)) { -@@ -669,6 +708,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - - root_dentry->d_fsdata = oe; - -+ sb->s_magic = OVERLAYFS_SUPER_MAGIC; - sb->s_op = &ovl_super_operations; - sb->s_root = root_dentry; - sb->s_fs_info = ufs; --- -2.7.4 - - -From 2428e59706e6221ccebeee9c79870988485e2b06 Mon Sep 17 00:00:00 2001 -From: Erez Zadok -Date: Fri, 24 Oct 2014 00:14:38 +0200 -Subject: [PATCH 22/73] overlayfs: implement show_options - -This is useful because of the stacking nature of overlayfs. Users like to -find out (via /proc/mounts) which lower/upper directory were used at mount -time. - -AV: even failing ovl_parse_opt() could've done some kstrdup() -AV: failure of ovl_alloc_entry() should end up with ENOMEM, not EINVAL - -Signed-off-by: Erez Zadok -Signed-off-by: Miklos Szeredi -(cherry picked from commit f45827e84186af152492c6d0dcf4105b4a605f9b) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 76 +++++++++++++++++++++++++++++++++------------------- - 1 file changed, 48 insertions(+), 28 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index aaf562b..7dcc24e 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include "overlayfs.h" - - MODULE_AUTHOR("Miklos Szeredi "); -@@ -25,12 +26,20 @@ MODULE_LICENSE("GPL"); - - #define OVERLAYFS_SUPER_MAGIC 0x794c764f - -+struct ovl_config { -+ char *lowerdir; -+ char *upperdir; -+ char *workdir; -+}; -+ - /* private information held for overlayfs's superblock */ - struct ovl_fs { - struct vfsmount *upper_mnt; - struct vfsmount *lower_mnt; - struct dentry *workdir; - long lower_namelen; -+ /* pathnames of lower and upper dirs, for show_options */ -+ struct ovl_config config; - }; - - struct ovl_dir_cache; -@@ -384,6 +393,9 @@ static void ovl_put_super(struct super_block *sb) - mntput(ufs->upper_mnt); - mntput(ufs->lower_mnt); - -+ kfree(ufs->config.lowerdir); -+ kfree(ufs->config.upperdir); -+ kfree(ufs->config.workdir); - kfree(ufs); - } - -@@ -413,15 +425,27 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) - return err; - } - -+/** -+ * ovl_show_options -+ * -+ * Prints the mount options for a given superblock. -+ * Returns zero; does not fail. -+ */ -+static int ovl_show_options(struct seq_file *m, struct dentry *dentry) -+{ -+ struct super_block *sb = dentry->d_sb; -+ struct ovl_fs *ufs = sb->s_fs_info; -+ -+ seq_printf(m, ",lowerdir=%s", ufs->config.lowerdir); -+ seq_printf(m, ",upperdir=%s", ufs->config.upperdir); -+ seq_printf(m, ",workdir=%s", ufs->config.workdir); -+ return 0; -+} -+ - static const struct super_operations ovl_super_operations = { - .put_super = ovl_put_super, - .statfs = ovl_statfs, --}; -- --struct ovl_config { -- char *lowerdir; -- char *upperdir; -- char *workdir; -+ .show_options = ovl_show_options, - }; - - enum { -@@ -442,10 +466,6 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - { - char *p; - -- config->upperdir = NULL; -- config->lowerdir = NULL; -- config->workdir = NULL; -- - while ((p = strsep(&opt, ",")) != NULL) { - int token; - substring_t args[MAX_OPT_ARGS]; -@@ -586,39 +606,40 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - struct dentry *root_dentry; - struct ovl_entry *oe; - struct ovl_fs *ufs; -- struct ovl_config config; - struct kstatfs statfs; - int err; - -- err = ovl_parse_opt((char *) data, &config); -- if (err) -+ err = -ENOMEM; -+ ufs = kzalloc(sizeof(struct ovl_fs), GFP_KERNEL); -+ if (!ufs) - goto out; - -+ err = ovl_parse_opt((char *) data, &ufs->config); -+ if (err) -+ goto out_free_config; -+ - /* FIXME: workdir is not needed for a R/O mount */ - err = -EINVAL; -- if (!config.upperdir || !config.lowerdir || !config.workdir) { -+ if (!ufs->config.upperdir || !ufs->config.lowerdir || -+ !ufs->config.workdir) { - pr_err("overlayfs: missing upperdir or lowerdir or workdir\n"); - goto out_free_config; - } - - err = -ENOMEM; -- ufs = kmalloc(sizeof(struct ovl_fs), GFP_KERNEL); -- if (!ufs) -- goto out_free_config; -- - oe = ovl_alloc_entry(); - if (oe == NULL) -- goto out_free_ufs; -+ goto out_free_config; - -- err = ovl_mount_dir(config.upperdir, &upperpath); -+ err = ovl_mount_dir(ufs->config.upperdir, &upperpath); - if (err) - goto out_free_oe; - -- err = ovl_mount_dir(config.lowerdir, &lowerpath); -+ err = ovl_mount_dir(ufs->config.lowerdir, &lowerpath); - if (err) - goto out_put_upperpath; - -- err = ovl_mount_dir(config.workdir, &workpath); -+ err = ovl_mount_dir(ufs->config.workdir, &workpath); - if (err) - goto out_put_lowerpath; - -@@ -674,7 +695,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - err = PTR_ERR(ufs->workdir); - if (IS_ERR(ufs->workdir)) { - pr_err("overlayfs: failed to create directory %s/%s\n", -- config.workdir, OVL_WORKDIR_NAME); -+ ufs->config.workdir, OVL_WORKDIR_NAME); - goto out_put_lower_mnt; - } - -@@ -729,12 +750,11 @@ out_put_upperpath: - path_put(&upperpath); - out_free_oe: - kfree(oe); --out_free_ufs: -- kfree(ufs); - out_free_config: -- kfree(config.lowerdir); -- kfree(config.upperdir); -- kfree(config.workdir); -+ kfree(ufs->config.lowerdir); -+ kfree(ufs->config.upperdir); -+ kfree(ufs->config.workdir); -+ kfree(ufs); - out: - return err; - } --- -2.7.4 - - -From 8f963c31b87794a5c16a6ea155f8001cdd1d93c7 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 24 Oct 2014 00:14:39 +0200 -Subject: [PATCH 23/73] fs: limit filesystem stacking depth - -Add a simple read-only counter to super_block that indicates how deep this -is in the stack of filesystems. Previously ecryptfs was the only stackable -filesystem and it explicitly disallowed multiple layers of itself. - -Overlayfs, however, can be stacked recursively and also may be stacked -on top of ecryptfs or vice versa. - -To limit the kernel stack usage we must limit the depth of the -filesystem stack. Initially the limit is set to 2. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 69c433ed2ecd2d3264efd7afec4439524b319121) -Signed-off-by: Alex Shi ---- - fs/ecryptfs/main.c | 7 +++++++ - fs/overlayfs/super.c | 9 +++++++++ - include/linux/fs.h | 11 +++++++++++ - 3 files changed, 27 insertions(+) - -diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c -index 34eb843..d9eb84b 100644 ---- a/fs/ecryptfs/main.c -+++ b/fs/ecryptfs/main.c -@@ -576,6 +576,13 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags - s->s_maxbytes = path.dentry->d_sb->s_maxbytes; - s->s_blocksize = path.dentry->d_sb->s_blocksize; - s->s_magic = ECRYPTFS_SUPER_MAGIC; -+ s->s_stack_depth = path.dentry->d_sb->s_stack_depth + 1; -+ -+ rc = -EINVAL; -+ if (s->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { -+ pr_err("eCryptfs: maximum fs stacking depth exceeded\n"); -+ goto out_free; -+ } - - inode = ecryptfs_get_inode(path.dentry->d_inode, s); - rc = PTR_ERR(inode); -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 7dcc24e..08b704c 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -677,6 +677,15 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - } - ufs->lower_namelen = statfs.f_namelen; - -+ sb->s_stack_depth = max(upperpath.mnt->mnt_sb->s_stack_depth, -+ lowerpath.mnt->mnt_sb->s_stack_depth) + 1; -+ -+ err = -EINVAL; -+ if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { -+ pr_err("overlayfs: maximum fs stacking depth exceeded\n"); -+ goto out_put_workpath; -+ } -+ - ufs->upper_mnt = clone_private_mount(&upperpath); - err = PTR_ERR(ufs->upper_mnt); - if (IS_ERR(ufs->upper_mnt)) { -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 18492c8..429af8d 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -256,6 +256,12 @@ struct iattr { - */ - #include - -+/* -+ * Maximum number of layers of fs stack. Needs to be limited to -+ * prevent kernel stack overflow -+ */ -+#define FILESYSTEM_MAX_STACK_DEPTH 2 -+ - /** - * enum positive_aop_returns - aop return codes with specific semantics - * -@@ -1336,6 +1342,11 @@ struct super_block { - struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; - struct list_lru s_inode_lru ____cacheline_aligned_in_smp; - struct rcu_head rcu; -+ -+ /* -+ * Indicates how deep in a filesystem stack this SB is -+ */ -+ int s_stack_depth; - }; - - extern struct timespec current_fs_time(struct super_block *sb); --- -2.7.4 - - -From a5613f10c5230eb50a863caf596774c50ec8f3e9 Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Thu, 23 Oct 2014 22:56:05 -0400 -Subject: [PATCH 24/73] overlayfs: don't hold ->i_mutex over opening the real - directory - -just use it to serialize the assignment - -Signed-off-by: Al Viro -(cherry picked from commit 3d268c9b136f51385f9d041f3f2424501b257388) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index c6787f8..b7d9fb0 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -458,20 +458,27 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, - if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { - struct inode *inode = file_inode(file); - -- mutex_lock(&inode->i_mutex); - realfile = od->upperfile; - if (!realfile) { - struct path upperpath; - - ovl_path_upper(dentry, &upperpath); - realfile = ovl_path_open(&upperpath, O_RDONLY); -- if (IS_ERR(realfile)) { -- mutex_unlock(&inode->i_mutex); -- return PTR_ERR(realfile); -+ mutex_lock(&inode->i_mutex); -+ if (!od->upperfile) { -+ if (IS_ERR(realfile)) { -+ mutex_unlock(&inode->i_mutex); -+ return PTR_ERR(realfile); -+ } -+ od->upperfile = realfile; -+ } else { -+ /* somebody has beaten us to it */ -+ if (!IS_ERR(realfile)) -+ fput(realfile); -+ realfile = od->upperfile; - } -- od->upperfile = realfile; -+ mutex_unlock(&inode->i_mutex); - } -- mutex_unlock(&inode->i_mutex); - } - - return vfs_fsync_range(realfile, start, end, datasync); --- -2.7.4 - - -From c0913e8f810834e7f4645050bfcb5e1c9f06fd53 Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Thu, 23 Oct 2014 22:58:56 -0400 -Subject: [PATCH 25/73] overlayfs: make ovl_cache_entry->name an array instead - of pointer - -Signed-off-by: Al Viro -(cherry picked from commit 68bf8611076a8e4bee8bc8d03ff28bd1e9a9c631) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index b7d9fb0..9c9872b 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -18,13 +18,13 @@ - #include "overlayfs.h" - - struct ovl_cache_entry { -- const char *name; - unsigned int len; - unsigned int type; - u64 ino; - bool is_whiteout; - struct list_head l_node; - struct rb_node node; -+ char name[]; - }; - - struct ovl_dir_cache { -@@ -82,13 +82,12 @@ static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, - u64 ino, unsigned int d_type) - { - struct ovl_cache_entry *p; -+ size_t size = offsetof(struct ovl_cache_entry, name[len + 1]); - -- p = kmalloc(sizeof(*p) + len + 1, GFP_KERNEL); -+ p = kmalloc(size, GFP_KERNEL); - if (p) { -- char *name_copy = (char *) (p + 1); -- memcpy(name_copy, name, len); -- name_copy[len] = '\0'; -- p->name = name_copy; -+ memcpy(p->name, name, len); -+ p->name[len] = '\0'; - p->len = len; - p->type = d_type; - p->ino = ino; --- -2.7.4 - - -From 90887f5c1bb98d0d51933e4d2238b5cc888b56cf Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Thu, 23 Oct 2014 23:00:53 -0400 -Subject: [PATCH 26/73] overlayfs: embed root into overlay_readdir_data - -no sense having it a pointer - all instances have it pointing to -local variable in the same stack frame - -Signed-off-by: Al Viro -(cherry picked from commit 49be4fb9cc3431fc4ebc71c764db848483b2a16c) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 9c9872b..a9ee2c1 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -36,7 +36,7 @@ struct ovl_dir_cache { - struct ovl_readdir_data { - struct dir_context ctx; - bool is_merge; -- struct rb_root *root; -+ struct rb_root root; - struct list_head *list; - struct list_head *middle; - int count; -@@ -101,7 +101,7 @@ static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, - const char *name, int len, u64 ino, - unsigned int d_type) - { -- struct rb_node **newp = &rdd->root->rb_node; -+ struct rb_node **newp = &rdd->root.rb_node; - struct rb_node *parent = NULL; - struct ovl_cache_entry *p; - -@@ -126,7 +126,7 @@ static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, - - list_add_tail(&p->l_node, rdd->list); - rb_link_node(&p->node, parent, newp); -- rb_insert_color(&p->node, rdd->root); -+ rb_insert_color(&p->node, &rdd->root); - - return 0; - } -@@ -137,7 +137,7 @@ static int ovl_fill_lower(struct ovl_readdir_data *rdd, - { - struct ovl_cache_entry *p; - -- p = ovl_cache_entry_find(rdd->root, name, namelen); -+ p = ovl_cache_entry_find(&rdd->root, name, namelen); - if (p) { - list_move_tail(&p->l_node, rdd->middle); - } else { -@@ -277,12 +277,11 @@ static inline int ovl_dir_read_merged(struct path *upperpath, - struct list_head *list) - { - int err; -- struct rb_root root = RB_ROOT; - struct list_head middle; - struct ovl_readdir_data rdd = { - .ctx.actor = ovl_fill_merge, - .list = list, -- .root = &root, -+ .root = RB_ROOT, - .is_merge = false, - }; - --- -2.7.4 - - -From 258e15586ba135f8534ab416c647d2f195e12df1 Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Thu, 23 Oct 2014 23:03:03 -0400 -Subject: [PATCH 27/73] overlayfs: embed middle into overlay_readdir_data - -same story... - -Signed-off-by: Al Viro -(cherry picked from commit db6ec212b53abc29a5bb6ac8c810010fc28d5191) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 12 +++++------- - 1 file changed, 5 insertions(+), 7 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index a9ee2c1..910553f 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -38,7 +38,7 @@ struct ovl_readdir_data { - bool is_merge; - struct rb_root root; - struct list_head *list; -- struct list_head *middle; -+ struct list_head middle; - int count; - int err; - }; -@@ -139,13 +139,13 @@ static int ovl_fill_lower(struct ovl_readdir_data *rdd, - - p = ovl_cache_entry_find(&rdd->root, name, namelen); - if (p) { -- list_move_tail(&p->l_node, rdd->middle); -+ list_move_tail(&p->l_node, &rdd->middle); - } else { - p = ovl_cache_entry_new(name, namelen, ino, d_type); - if (p == NULL) - rdd->err = -ENOMEM; - else -- list_add_tail(&p->l_node, rdd->middle); -+ list_add_tail(&p->l_node, &rdd->middle); - } - - return rdd->err; -@@ -277,7 +277,6 @@ static inline int ovl_dir_read_merged(struct path *upperpath, - struct list_head *list) - { - int err; -- struct list_head middle; - struct ovl_readdir_data rdd = { - .ctx.actor = ovl_fill_merge, - .list = list, -@@ -301,11 +300,10 @@ static inline int ovl_dir_read_merged(struct path *upperpath, - * Insert lowerpath entries before upperpath ones, this allows - * offsets to be reasonably constant - */ -- list_add(&middle, rdd.list); -- rdd.middle = &middle; -+ list_add(&rdd.middle, rdd.list); - rdd.is_merge = true; - err = ovl_dir_read(lowerpath, &rdd); -- list_del(&middle); -+ list_del(&rdd.middle); - } - out: - return err; --- -2.7.4 - - -From 313adf61d46e2fc1092a03540f33b1f1345b8c44 Mon Sep 17 00:00:00 2001 -From: Al Viro -Date: Tue, 28 Oct 2014 18:27:28 -0400 -Subject: [PATCH 28/73] overlayfs: barriers for opening upper-layer directory - -make sure that - a) all stores done by opening struct file don't leak past storing -the reference in od->upperfile - b) the lockless side has read dependency barrier - -Signed-off-by: Al Viro -(cherry picked from commit d45f00ae43e63eff1b3d79df20610ae1ef645ebd) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 910553f..8c8ce9d 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -454,12 +454,13 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, - if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { - struct inode *inode = file_inode(file); - -- realfile = od->upperfile; -+ realfile =lockless_dereference(od->upperfile); - if (!realfile) { - struct path upperpath; - - ovl_path_upper(dentry, &upperpath); - realfile = ovl_path_open(&upperpath, O_RDONLY); -+ smp_mb__before_spinlock(); - mutex_lock(&inode->i_mutex); - if (!od->upperfile) { - if (IS_ERR(realfile)) { --- -2.7.4 - - -From 2b3b22f12809d5406745005ea0c20c4945dfe789 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Mon, 27 Oct 2014 13:48:48 +0100 -Subject: [PATCH 29/73] ovl: fix check for cursor - -ovl_cache_entry.name is now an array not a pointer, so it makes no sense -test for it being NULL. - -Detected by coverity. - -From: Miklos Szeredi -Fixes: 68bf8611076a ("overlayfs: make ovl_cache_entry->name an array instead of -+pointer") -Signed-off-by: Miklos Szeredi -Signed-off-by: Al Viro - -(cherry picked from commit c2096537d40f026672c4c6adfcd7247ce5799604) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 8c8ce9d..3fbf0d3 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -21,9 +21,10 @@ struct ovl_cache_entry { - unsigned int len; - unsigned int type; - u64 ino; -- bool is_whiteout; - struct list_head l_node; - struct rb_node node; -+ bool is_whiteout; -+ bool is_cursor; - char name[]; - }; - -@@ -251,7 +252,7 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir, - - mutex_lock(&dir->d_inode->i_mutex); - list_for_each_entry(p, rdd->list, l_node) { -- if (!p->name) -+ if (p->is_cursor) - continue; - - if (p->type != DT_CHR) -@@ -307,7 +308,6 @@ static inline int ovl_dir_read_merged(struct path *upperpath, - } - out: - return err; -- - } - - static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) -@@ -316,7 +316,7 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) - loff_t off = 0; - - list_for_each_entry(p, &od->cache->entries, l_node) { -- if (!p->name) -+ if (p->is_cursor) - continue; - if (off >= pos) - break; -@@ -389,7 +389,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx) - - p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); - /* Skip cursors */ -- if (p->name) { -+ if (!p->is_cursor) { - if (!p->is_whiteout) { - if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) - break; -@@ -519,6 +519,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file) - od->realfile = realfile; - od->is_real = (type != OVL_PATH_MERGE); - od->is_upper = (type != OVL_PATH_LOWER); -+ od->cursor.is_cursor = true; - file->private_data = od; - - return 0; --- -2.7.4 - - -From 9ba0656673b59bcae46ce2a7849005a07d494fac Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Mon, 27 Oct 2014 15:42:01 +0100 -Subject: [PATCH 30/73] overlayfs: fix lockdep misannotation - -In an overlay directory that shadows an empty lower directory, say -/mnt/a/empty102, do: - - touch /mnt/a/empty102/x - unlink /mnt/a/empty102/x - rmdir /mnt/a/empty102 - -It's actually harmless, but needs another level of nesting between -I_MUTEX_CHILD and I_MUTEX_NORMAL. - -Signed-off-by: Miklos Szeredi -Tested-by: David Howells -Signed-off-by: Al Viro -(cherry picked from commit d1b72cc6d8cb766c802fdc70a5edc2f0ba8a2b57) -Signed-off-by: Alex Shi ---- - fs/namei.c | 2 +- - fs/overlayfs/readdir.c | 2 +- - include/linux/fs.h | 9 ++++++--- - 3 files changed, 8 insertions(+), 5 deletions(-) - -diff --git a/fs/namei.c b/fs/namei.c -index a047265e..0fbf150 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -2473,7 +2473,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) - } - - mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); -- mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_CHILD); -+ mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT2); - return NULL; - } - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 3fbf0d3..401f084 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -571,7 +571,7 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) - { - struct ovl_cache_entry *p; - -- mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_PARENT); -+ mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_CHILD); - list_for_each_entry(p, list, l_node) { - struct dentry *dentry; - -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 429af8d..1ec29cc 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -641,11 +641,13 @@ static inline int inode_unhashed(struct inode *inode) - * 2: child/target - * 3: xattr - * 4: second non-directory -- * The last is for certain operations (such as rename) which lock two -+ * 5: second parent (when locking independent directories in rename) -+ * -+ * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two - * non-directories at once. - * - * The locking order between these classes is -- * parent -> child -> normal -> xattr -> second non-directory -+ * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory - */ - enum inode_i_mutex_lock_class - { -@@ -653,7 +655,8 @@ enum inode_i_mutex_lock_class - I_MUTEX_PARENT, - I_MUTEX_CHILD, - I_MUTEX_XATTR, -- I_MUTEX_NONDIR2 -+ I_MUTEX_NONDIR2, -+ I_MUTEX_PARENT2, - }; - - void lock_two_nondirectories(struct inode *, struct inode*); --- -2.7.4 - - -From a996f76df429a061985a5e7b1904c6574315a818 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Fri, 31 Oct 2014 20:02:42 +0100 -Subject: [PATCH 31/73] ovl: initialize ->is_cursor - -Signed-off-by: Miklos Szeredi -Signed-off-by: Al Viro -(cherry picked from commit 9f2f7d4c8dfcf4617af5de6ea381b91deac3db48) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 401f084..4e9d7c1 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -93,6 +93,7 @@ static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, - p->type = d_type; - p->ino = ino; - p->is_whiteout = false; -+ p->is_cursor = false; - } - - return p; --- -2.7.4 - - -From 30d1df13eef6be298b5f783a2b36b82cf1c0f033 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 30 Oct 2014 17:37:34 +0100 -Subject: [PATCH 32/73] vfs: make first argument of dir_context.actor typed - -Signed-off-by: Miklos Szeredi -Signed-off-by: Al Viro -(cherry picked from commit ac7576f4b1da8c9c6bc1ae026c2b9e86ae617ba5) -Signed-off-by: Alex Shi ---- - arch/alpha/kernel/osf_sys.c | 7 ++++--- - arch/parisc/hpux/fs.c | 7 ++++--- - drivers/staging/lustre/lustre/llite/llite_nfs.c | 8 +++++--- - fs/afs/dir.c | 9 +++++---- - fs/compat.c | 21 +++++++++++++-------- - fs/ecryptfs/file.c | 6 +++--- - fs/exportfs/expfs.c | 5 +++-- - fs/fat/dir.c | 5 +++-- - fs/gfs2/export.c | 8 +++++--- - fs/hppfs/hppfs.c | 5 +++-- - fs/nfsd/nfs4recover.c | 5 +++-- - fs/nfsd/vfs.c | 12 +++++++----- - fs/nfsd/vfs.h | 4 ++-- - fs/ocfs2/dir.c | 8 +++++--- - fs/ocfs2/journal.c | 8 +++++--- - fs/overlayfs/readdir.c | 8 +++++--- - fs/readdir.c | 21 ++++++++++++--------- - fs/reiserfs/xattr.c | 15 +++++++++------ - include/linux/fs.h | 5 ++++- - 19 files changed, 100 insertions(+), 67 deletions(-) - -diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c -index 1402fcc..98f57d3 100644 ---- a/arch/alpha/kernel/osf_sys.c -+++ b/arch/alpha/kernel/osf_sys.c -@@ -104,11 +104,12 @@ struct osf_dirent_callback { - }; - - static int --osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, -- u64 ino, unsigned int d_type) -+osf_filldir(struct dir_context *ctx, const char *name, int namlen, -+ loff_t offset, u64 ino, unsigned int d_type) - { - struct osf_dirent __user *dirent; -- struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; -+ struct osf_dirent_callback *buf = -+ container_of(ctx, struct osf_dirent_callback, ctx); - unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32)); - unsigned int d_ino; - -diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c -index 2bedafe..97a7bf8 100644 ---- a/arch/parisc/hpux/fs.c -+++ b/arch/parisc/hpux/fs.c -@@ -56,11 +56,12 @@ struct getdents_callback { - - #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) - --static int filldir(void * __buf, const char * name, int namlen, loff_t offset, -- u64 ino, unsigned d_type) -+static int filldir(struct dir_context *ctx, const char *name, int namlen, -+ loff_t offset, u64 ino, unsigned d_type) - { - struct hpux_dirent __user * dirent; -- struct getdents_callback * buf = (struct getdents_callback *) __buf; -+ struct getdents_callback *buf = -+ container_of(ctx, struct getdents_callback, ctx); - ino_t d_ino; - int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long)); - -diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c -index 1767c74..ed35a88 100644 ---- a/drivers/staging/lustre/lustre/llite/llite_nfs.c -+++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c -@@ -205,13 +205,15 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen, - return LUSTRE_NFS_FID; - } - --static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen, -- loff_t hash, u64 ino, unsigned type) -+static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, -+ int namelen, loff_t hash, u64 ino, -+ unsigned type) - { - /* It is hack to access lde_fid for comparison with lgd_fid. - * So the input 'name' must be part of the 'lu_dirent'. */ - struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name); -- struct ll_getname_data *lgd = cookie; -+ struct ll_getname_data *lgd = -+ container_of(ctx, struct ll_getname_data, ctx); - struct lu_fid fid; - - fid_le_to_cpu(&fid, &lde->lde_fid); -diff --git a/fs/afs/dir.c b/fs/afs/dir.c -index 5293003..5479af6 100644 ---- a/fs/afs/dir.c -+++ b/fs/afs/dir.c -@@ -26,7 +26,7 @@ static int afs_readdir(struct file *file, struct dir_context *ctx); - static int afs_d_revalidate(struct dentry *dentry, unsigned int flags); - static int afs_d_delete(const struct dentry *dentry); - static void afs_d_release(struct dentry *dentry); --static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, -+static int afs_lookup_filldir(struct dir_context *ctx, const char *name, int nlen, - loff_t fpos, u64 ino, unsigned dtype); - static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, - bool excl); -@@ -391,10 +391,11 @@ static int afs_readdir(struct file *file, struct dir_context *ctx) - * - if afs_dir_iterate_block() spots this function, it'll pass the FID - * uniquifier through dtype - */ --static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, -- loff_t fpos, u64 ino, unsigned dtype) -+static int afs_lookup_filldir(struct dir_context *ctx, const char *name, -+ int nlen, loff_t fpos, u64 ino, unsigned dtype) - { -- struct afs_lookup_cookie *cookie = _cookie; -+ struct afs_lookup_cookie *cookie = -+ container_of(ctx, struct afs_lookup_cookie, ctx); - - _enter("{%s,%u},%s,%u,,%llu,%u", - cookie->name.name, cookie->name.len, name, nlen, -diff --git a/fs/compat.c b/fs/compat.c -index 6af20de..14da9b3 100644 ---- a/fs/compat.c -+++ b/fs/compat.c -@@ -837,10 +837,12 @@ struct compat_readdir_callback { - int result; - }; - --static int compat_fillonedir(void *__buf, const char *name, int namlen, -- loff_t offset, u64 ino, unsigned int d_type) -+static int compat_fillonedir(struct dir_context *ctx, const char *name, -+ int namlen, loff_t offset, u64 ino, -+ unsigned int d_type) - { -- struct compat_readdir_callback *buf = __buf; -+ struct compat_readdir_callback *buf = -+ container_of(ctx, struct compat_readdir_callback, ctx); - struct compat_old_linux_dirent __user *dirent; - compat_ulong_t d_ino; - -@@ -905,11 +907,12 @@ struct compat_getdents_callback { - int error; - }; - --static int compat_filldir(void *__buf, const char *name, int namlen, -+static int compat_filldir(struct dir_context *ctx, const char *name, int namlen, - loff_t offset, u64 ino, unsigned int d_type) - { - struct compat_linux_dirent __user * dirent; -- struct compat_getdents_callback *buf = __buf; -+ struct compat_getdents_callback *buf = -+ container_of(ctx, struct compat_getdents_callback, ctx); - compat_ulong_t d_ino; - int reclen = ALIGN(offsetof(struct compat_linux_dirent, d_name) + - namlen + 2, sizeof(compat_long_t)); -@@ -991,11 +994,13 @@ struct compat_getdents_callback64 { - int error; - }; - --static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t offset, -- u64 ino, unsigned int d_type) -+static int compat_filldir64(struct dir_context *ctx, const char *name, -+ int namlen, loff_t offset, u64 ino, -+ unsigned int d_type) - { - struct linux_dirent64 __user *dirent; -- struct compat_getdents_callback64 *buf = __buf; -+ struct compat_getdents_callback64 *buf = -+ container_of(ctx, struct compat_getdents_callback64, ctx); - int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, - sizeof(u64)); - u64 off; -diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c -index 03df502..121a948 100644 ---- a/fs/ecryptfs/file.c -+++ b/fs/ecryptfs/file.c -@@ -76,11 +76,11 @@ struct ecryptfs_getdents_callback { - - /* Inspired by generic filldir in fs/readdir.c */ - static int --ecryptfs_filldir(void *dirent, const char *lower_name, int lower_namelen, -- loff_t offset, u64 ino, unsigned int d_type) -+ecryptfs_filldir(struct dir_context *ctx, const char *lower_name, -+ int lower_namelen, loff_t offset, u64 ino, unsigned int d_type) - { - struct ecryptfs_getdents_callback *buf = -- (struct ecryptfs_getdents_callback *)dirent; -+ container_of(ctx, struct ecryptfs_getdents_callback, ctx); - size_t name_size; - char *name; - int rc; -diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c -index 48a359d..59d339c 100644 ---- a/fs/exportfs/expfs.c -+++ b/fs/exportfs/expfs.c -@@ -241,10 +241,11 @@ struct getdents_callback { - * A rather strange filldir function to capture - * the name matching the specified inode number. - */ --static int filldir_one(void * __buf, const char * name, int len, -+static int filldir_one(struct dir_context *ctx, const char *name, int len, - loff_t pos, u64 ino, unsigned int d_type) - { -- struct getdents_callback *buf = __buf; -+ struct getdents_callback *buf = -+ container_of(ctx, struct getdents_callback, ctx); - int result = 0; - - buf->sequence++; -diff --git a/fs/fat/dir.c b/fs/fat/dir.c -index 3963ede..c5d6bb9 100644 ---- a/fs/fat/dir.c -+++ b/fs/fat/dir.c -@@ -702,10 +702,11 @@ static int fat_readdir(struct file *file, struct dir_context *ctx) - } - - #define FAT_IOCTL_FILLDIR_FUNC(func, dirent_type) \ --static int func(void *__buf, const char *name, int name_len, \ -+static int func(struct dir_context *ctx, const char *name, int name_len, \ - loff_t offset, u64 ino, unsigned int d_type) \ - { \ -- struct fat_ioctl_filldir_callback *buf = __buf; \ -+ struct fat_ioctl_filldir_callback *buf = \ -+ container_of(ctx, struct fat_ioctl_filldir_callback, ctx); \ - struct dirent_type __user *d1 = buf->dirent; \ - struct dirent_type __user *d2 = d1 + 1; \ - \ -diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c -index 8b9b377..c41d255 100644 ---- a/fs/gfs2/export.c -+++ b/fs/gfs2/export.c -@@ -69,10 +69,12 @@ struct get_name_filldir { - char *name; - }; - --static int get_name_filldir(void *opaque, const char *name, int length, -- loff_t offset, u64 inum, unsigned int type) -+static int get_name_filldir(struct dir_context *ctx, const char *name, -+ int length, loff_t offset, u64 inum, -+ unsigned int type) - { -- struct get_name_filldir *gnfd = opaque; -+ struct get_name_filldir *gnfd = -+ container_of(ctx, struct get_name_filldir, ctx); - - if (inum != gnfd->inum.no_addr) - return 0; -diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c -index 4338ff3..5f27551 100644 ---- a/fs/hppfs/hppfs.c -+++ b/fs/hppfs/hppfs.c -@@ -548,10 +548,11 @@ struct hppfs_dirent { - struct dentry *dentry; - }; - --static int hppfs_filldir(void *d, const char *name, int size, -+static int hppfs_filldir(struct dir_context *ctx, const char *name, int size, - loff_t offset, u64 inode, unsigned int type) - { -- struct hppfs_dirent *dirent = d; -+ struct hppfs_dirent *dirent = -+ container_of(ctx, struct hppfs_dirent, ctx); - - if (file_removed(dirent->dentry, name)) - return 0; -diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c -index 9c271f4..674a5d5 100644 ---- a/fs/nfsd/nfs4recover.c -+++ b/fs/nfsd/nfs4recover.c -@@ -244,10 +244,11 @@ struct nfs4_dir_ctx { - }; - - static int --nfsd4_build_namelist(void *arg, const char *name, int namlen, -+nfsd4_build_namelist(struct dir_context *__ctx, const char *name, int namlen, - loff_t offset, u64 ino, unsigned int d_type) - { -- struct nfs4_dir_ctx *ctx = arg; -+ struct nfs4_dir_ctx *ctx = -+ container_of(__ctx, struct nfs4_dir_ctx, ctx); - struct name_list *entry; - - if (namlen != HEXDIR_LEN - 1) -diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c -index 464f813..3953a20 100644 ---- a/fs/nfsd/vfs.c -+++ b/fs/nfsd/vfs.c -@@ -1808,10 +1808,12 @@ struct readdir_data { - int full; - }; - --static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, -- loff_t offset, u64 ino, unsigned int d_type) -+static int nfsd_buffered_filldir(struct dir_context *ctx, const char *name, -+ int namlen, loff_t offset, u64 ino, -+ unsigned int d_type) - { -- struct readdir_data *buf = __buf; -+ struct readdir_data *buf = -+ container_of(ctx, struct readdir_data, ctx); - struct buffered_dirent *de = (void *)(buf->dirent + buf->used); - unsigned int reclen; - -@@ -1831,7 +1833,7 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, - return 0; - } - --static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, -+static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func, - struct readdir_cd *cdp, loff_t *offsetp) - { - struct buffered_dirent *de; -@@ -1915,7 +1917,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, - */ - __be32 - nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, -- struct readdir_cd *cdp, filldir_t func) -+ struct readdir_cd *cdp, nfsd_filldir_t func) - { - __be32 err; - struct file *file; -diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h -index fbe90bd..ea760b1 100644 ---- a/fs/nfsd/vfs.h -+++ b/fs/nfsd/vfs.h -@@ -36,7 +36,7 @@ - /* - * Callback function for readdir - */ --typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); -+typedef int (*nfsd_filldir_t)(void *, const char *, int, loff_t, u64, unsigned); - - /* nfsd/vfs.c */ - int nfsd_racache_init(int); -@@ -89,7 +89,7 @@ __be32 nfsd_rename(struct svc_rqst *, - __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, - char *name, int len); - __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, -- loff_t *, struct readdir_cd *, filldir_t); -+ loff_t *, struct readdir_cd *, nfsd_filldir_t); - __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, - struct kstatfs *, int access); - -diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c -index 91a7e85..478e14d 100644 ---- a/fs/ocfs2/dir.c -+++ b/fs/ocfs2/dir.c -@@ -2073,10 +2073,12 @@ struct ocfs2_empty_dir_priv { - unsigned seen_other; - unsigned dx_dir; - }; --static int ocfs2_empty_dir_filldir(void *priv, const char *name, int name_len, -- loff_t pos, u64 ino, unsigned type) -+static int ocfs2_empty_dir_filldir(struct dir_context *ctx, const char *name, -+ int name_len, loff_t pos, u64 ino, -+ unsigned type) - { -- struct ocfs2_empty_dir_priv *p = priv; -+ struct ocfs2_empty_dir_priv *p = -+ container_of(ctx, struct ocfs2_empty_dir_priv, ctx); - - /* - * Check the positions of "." and ".." records to be sure -diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c -index 44fc3e5..a1b7dca 100644 ---- a/fs/ocfs2/journal.c -+++ b/fs/ocfs2/journal.c -@@ -1981,10 +1981,12 @@ struct ocfs2_orphan_filldir_priv { - struct ocfs2_super *osb; - }; - --static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len, -- loff_t pos, u64 ino, unsigned type) -+static int ocfs2_orphan_filldir(struct dir_context *ctx, const char *name, -+ int name_len, loff_t pos, u64 ino, -+ unsigned type) - { -- struct ocfs2_orphan_filldir_priv *p = priv; -+ struct ocfs2_orphan_filldir_priv *p = -+ container_of(ctx, struct ocfs2_orphan_filldir_priv, ctx); - struct inode *iter; - - if (name_len == 1 && !strncmp(".", name, 1)) -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 4e9d7c1..301f64a 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -180,10 +180,12 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry) - } - } - --static int ovl_fill_merge(void *buf, const char *name, int namelen, -- loff_t offset, u64 ino, unsigned int d_type) -+static int ovl_fill_merge(struct dir_context *ctx, const char *name, -+ int namelen, loff_t offset, u64 ino, -+ unsigned int d_type) - { -- struct ovl_readdir_data *rdd = buf; -+ struct ovl_readdir_data *rdd = -+ container_of(ctx, struct ovl_readdir_data, ctx); - - rdd->count++; - if (!rdd->is_merge) -diff --git a/fs/readdir.c b/fs/readdir.c -index 5b53d99..e21af53 100644 ---- a/fs/readdir.c -+++ b/fs/readdir.c -@@ -72,10 +72,11 @@ struct readdir_callback { - int result; - }; - --static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset, -- u64 ino, unsigned int d_type) -+static int fillonedir(struct dir_context *ctx, const char *name, int namlen, -+ loff_t offset, u64 ino, unsigned int d_type) - { -- struct readdir_callback *buf = (struct readdir_callback *) __buf; -+ struct readdir_callback *buf = -+ container_of(ctx, struct readdir_callback, ctx); - struct old_linux_dirent __user * dirent; - unsigned long d_ino; - -@@ -146,11 +147,12 @@ struct getdents_callback { - int error; - }; - --static int filldir(void * __buf, const char * name, int namlen, loff_t offset, -- u64 ino, unsigned int d_type) -+static int filldir(struct dir_context *ctx, const char *name, int namlen, -+ loff_t offset, u64 ino, unsigned int d_type) - { - struct linux_dirent __user * dirent; -- struct getdents_callback * buf = (struct getdents_callback *) __buf; -+ struct getdents_callback *buf = -+ container_of(ctx, struct getdents_callback, ctx); - unsigned long d_ino; - int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, - sizeof(long)); -@@ -230,11 +232,12 @@ struct getdents_callback64 { - int error; - }; - --static int filldir64(void * __buf, const char * name, int namlen, loff_t offset, -- u64 ino, unsigned int d_type) -+static int filldir64(struct dir_context *ctx, const char *name, int namlen, -+ loff_t offset, u64 ino, unsigned int d_type) - { - struct linux_dirent64 __user *dirent; -- struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf; -+ struct getdents_callback64 *buf = -+ container_of(ctx, struct getdents_callback64, ctx); - int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, - sizeof(u64)); - -diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c -index 5cdfbd6..d8b7acf 100644 ---- a/fs/reiserfs/xattr.c -+++ b/fs/reiserfs/xattr.c -@@ -177,10 +177,11 @@ struct reiserfs_dentry_buf { - }; - - static int --fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset, -- u64 ino, unsigned int d_type) -+fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) - { -- struct reiserfs_dentry_buf *dbuf = buf; -+ struct reiserfs_dentry_buf *dbuf = -+ container_of(ctx, struct reiserfs_dentry_buf, ctx); - struct dentry *dentry; - WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex)); - -@@ -794,10 +795,12 @@ struct listxattr_buf { - struct dentry *dentry; - }; - --static int listxattr_filler(void *buf, const char *name, int namelen, -- loff_t offset, u64 ino, unsigned int d_type) -+static int listxattr_filler(struct dir_context *ctx, const char *name, -+ int namelen, loff_t offset, u64 ino, -+ unsigned int d_type) - { -- struct listxattr_buf *b = (struct listxattr_buf *)buf; -+ struct listxattr_buf *b = -+ container_of(ctx, struct listxattr_buf, ctx); - size_t size; - if (name[0] != '.' || - (namelen != 1 && (name[1] != '.' || namelen != 2))) { -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 1ec29cc..e1cee8b 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -1530,7 +1530,10 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); - * This allows the kernel to read directories into kernel space or - * to have different dirent layouts depending on the binary type. - */ --typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); -+struct dir_context; -+typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64, -+ unsigned); -+ - struct dir_context { - const filldir_t actor; - loff_t pos; --- -2.7.4 - - -From 68a4dee66f6231bb2a5058c58e9e9ebea8149b5c Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Tue, 4 Nov 2014 16:11:03 +0100 -Subject: [PATCH 33/73] ovl: don't poison cursor - -ovl_cache_put() can be called from ovl_dir_reset() if the cache needs to be -rebuilt. We did list_del() on the cursor, which results in an Oops on the -poisoned pointer in ovl_seek_cursor(). - -Reported-by: Jordi Pujol Palomer -Signed-off-by: Miklos Szeredi -Tested-by: Jordi Pujol Palomer -Signed-off-by: Al Viro -(cherry picked from commit 3f822c6264954660babce757fb45792fd3af273e) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 301f64a..fdb63de 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -168,7 +168,7 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry) - { - struct ovl_dir_cache *cache = od->cache; - -- list_del(&od->cursor.l_node); -+ list_del_init(&od->cursor.l_node); - WARN_ON(cache->refcount <= 0); - cache->refcount--; - if (!cache->refcount) { --- -2.7.4 - - -From 5c5ce110a498fc025c7ca85165ba2f5fa1ddef43 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:39:59 +0100 -Subject: [PATCH 34/73] ovl: rename filesystem type to "overlay" - -Some distributions carry an "old" format of overlayfs while mainline has a -"new" format. - -The distros will possibly want to keep the old overlayfs alongside the new -for compatibility reasons. - -To make it possible to differentiate the two versions change the name of -the new one from "overlayfs" to "overlay". - -Signed-off-by: Miklos Szeredi -Reported-by: Serge Hallyn -Cc: Andy Whitcroft -(cherry picked from commit ef94b1864d1ed5be54376404bb23d22ed0481feb) -Signed-off-by: Alex Shi ---- - Documentation/filesystems/overlayfs.txt | 198 ++++++++++++++++++++++++++++++++ - MAINTAINERS | 7 ++ - fs/Makefile | 2 +- - fs/overlayfs/Kconfig | 2 +- - fs/overlayfs/Makefile | 4 +- - fs/overlayfs/super.c | 6 +- - 6 files changed, 212 insertions(+), 7 deletions(-) - create mode 100644 Documentation/filesystems/overlayfs.txt - -diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt -new file mode 100644 -index 0000000..a27c950 ---- /dev/null -+++ b/Documentation/filesystems/overlayfs.txt -@@ -0,0 +1,198 @@ -+Written by: Neil Brown -+ -+Overlay Filesystem -+================== -+ -+This document describes a prototype for a new approach to providing -+overlay-filesystem functionality in Linux (sometimes referred to as -+union-filesystems). An overlay-filesystem tries to present a -+filesystem which is the result over overlaying one filesystem on top -+of the other. -+ -+The result will inevitably fail to look exactly like a normal -+filesystem for various technical reasons. The expectation is that -+many use cases will be able to ignore these differences. -+ -+This approach is 'hybrid' because the objects that appear in the -+filesystem do not all appear to belong to that filesystem. In many -+cases an object accessed in the union will be indistinguishable -+from accessing the corresponding object from the original filesystem. -+This is most obvious from the 'st_dev' field returned by stat(2). -+ -+While directories will report an st_dev from the overlay-filesystem, -+all non-directory objects will report an st_dev from the lower or -+upper filesystem that is providing the object. Similarly st_ino will -+only be unique when combined with st_dev, and both of these can change -+over the lifetime of a non-directory object. Many applications and -+tools ignore these values and will not be affected. -+ -+Upper and Lower -+--------------- -+ -+An overlay filesystem combines two filesystems - an 'upper' filesystem -+and a 'lower' filesystem. When a name exists in both filesystems, the -+object in the 'upper' filesystem is visible while the object in the -+'lower' filesystem is either hidden or, in the case of directories, -+merged with the 'upper' object. -+ -+It would be more correct to refer to an upper and lower 'directory -+tree' rather than 'filesystem' as it is quite possible for both -+directory trees to be in the same filesystem and there is no -+requirement that the root of a filesystem be given for either upper or -+lower. -+ -+The lower filesystem can be any filesystem supported by Linux and does -+not need to be writable. The lower filesystem can even be another -+overlayfs. The upper filesystem will normally be writable and if it -+is it must support the creation of trusted.* extended attributes, and -+must provide valid d_type in readdir responses, so NFS is not suitable. -+ -+A read-only overlay of two read-only filesystems may use any -+filesystem type. -+ -+Directories -+----------- -+ -+Overlaying mainly involves directories. If a given name appears in both -+upper and lower filesystems and refers to a non-directory in either, -+then the lower object is hidden - the name refers only to the upper -+object. -+ -+Where both upper and lower objects are directories, a merged directory -+is formed. -+ -+At mount time, the two directories given as mount options "lowerdir" and -+"upperdir" are combined into a merged directory: -+ -+ mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,\ -+workdir=/work /merged -+ -+The "workdir" needs to be an empty directory on the same filesystem -+as upperdir. -+ -+Then whenever a lookup is requested in such a merged directory, the -+lookup is performed in each actual directory and the combined result -+is cached in the dentry belonging to the overlay filesystem. If both -+actual lookups find directories, both are stored and a merged -+directory is created, otherwise only one is stored: the upper if it -+exists, else the lower. -+ -+Only the lists of names from directories are merged. Other content -+such as metadata and extended attributes are reported for the upper -+directory only. These attributes of the lower directory are hidden. -+ -+whiteouts and opaque directories -+-------------------------------- -+ -+In order to support rm and rmdir without changing the lower -+filesystem, an overlay filesystem needs to record in the upper filesystem -+that files have been removed. This is done using whiteouts and opaque -+directories (non-directories are always opaque). -+ -+A whiteout is created as a character device with 0/0 device number. -+When a whiteout is found in the upper level of a merged directory, any -+matching name in the lower level is ignored, and the whiteout itself -+is also hidden. -+ -+A directory is made opaque by setting the xattr "trusted.overlay.opaque" -+to "y". Where the upper filesystem contains an opaque directory, any -+directory in the lower filesystem with the same name is ignored. -+ -+readdir -+------- -+ -+When a 'readdir' request is made on a merged directory, the upper and -+lower directories are each read and the name lists merged in the -+obvious way (upper is read first, then lower - entries that already -+exist are not re-added). This merged name list is cached in the -+'struct file' and so remains as long as the file is kept open. If the -+directory is opened and read by two processes at the same time, they -+will each have separate caches. A seekdir to the start of the -+directory (offset 0) followed by a readdir will cause the cache to be -+discarded and rebuilt. -+ -+This means that changes to the merged directory do not appear while a -+directory is being read. This is unlikely to be noticed by many -+programs. -+ -+seek offsets are assigned sequentially when the directories are read. -+Thus if -+ - read part of a directory -+ - remember an offset, and close the directory -+ - re-open the directory some time later -+ - seek to the remembered offset -+ -+there may be little correlation between the old and new locations in -+the list of filenames, particularly if anything has changed in the -+directory. -+ -+Readdir on directories that are not merged is simply handled by the -+underlying directory (upper or lower). -+ -+ -+Non-directories -+--------------- -+ -+Objects that are not directories (files, symlinks, device-special -+files etc.) are presented either from the upper or lower filesystem as -+appropriate. When a file in the lower filesystem is accessed in a way -+the requires write-access, such as opening for write access, changing -+some metadata etc., the file is first copied from the lower filesystem -+to the upper filesystem (copy_up). Note that creating a hard-link -+also requires copy_up, though of course creation of a symlink does -+not. -+ -+The copy_up may turn out to be unnecessary, for example if the file is -+opened for read-write but the data is not modified. -+ -+The copy_up process first makes sure that the containing directory -+exists in the upper filesystem - creating it and any parents as -+necessary. It then creates the object with the same metadata (owner, -+mode, mtime, symlink-target etc.) and then if the object is a file, the -+data is copied from the lower to the upper filesystem. Finally any -+extended attributes are copied up. -+ -+Once the copy_up is complete, the overlay filesystem simply -+provides direct access to the newly created file in the upper -+filesystem - future operations on the file are barely noticed by the -+overlay filesystem (though an operation on the name of the file such as -+rename or unlink will of course be noticed and handled). -+ -+ -+Non-standard behavior -+--------------------- -+ -+The copy_up operation essentially creates a new, identical file and -+moves it over to the old name. The new file may be on a different -+filesystem, so both st_dev and st_ino of the file may change. -+ -+Any open files referring to this inode will access the old data and -+metadata. Similarly any file locks obtained before copy_up will not -+apply to the copied up file. -+ -+On a file opened with O_RDONLY fchmod(2), fchown(2), futimesat(2) and -+fsetxattr(2) will fail with EROFS. -+ -+If a file with multiple hard links is copied up, then this will -+"break" the link. Changes will not be propagated to other names -+referring to the same inode. -+ -+Symlinks in /proc/PID/ and /proc/PID/fd which point to a non-directory -+object in overlayfs will not contain valid absolute paths, only -+relative paths leading up to the filesystem's root. This will be -+fixed in the future. -+ -+Some operations are not atomic, for example a crash during copy_up or -+rename will leave the filesystem in an inconsistent state. This will -+be addressed in the future. -+ -+Changes to underlying filesystems -+--------------------------------- -+ -+Offline changes, when the overlay is not mounted, are allowed to either -+the upper or the lower trees. -+ -+Changes to the underlying filesystems while part of a mounted overlay -+filesystem are not allowed. If the underlying filesystem is changed, -+the behavior of the overlay is undefined, though it will not result in -+a crash or deadlock. -diff --git a/MAINTAINERS b/MAINTAINERS -index 900d98e..976dae0 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -6452,6 +6452,13 @@ F: drivers/scsi/osd/ - F: include/scsi/osd_* - F: fs/exofs/ - -+OVERLAY FILESYSTEM -+M: Miklos Szeredi -+L: linux-fsdevel@vger.kernel.org -+S: Supported -+F: fs/overlayfs/* -+F: Documentation/filesystems/overlayfs.txt -+ - P54 WIRELESS DRIVER - M: Christian Lamparter - L: linux-wireless@vger.kernel.org -diff --git a/fs/Makefile b/fs/Makefile -index 5eb9caf..b595440 100644 ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -104,7 +104,7 @@ obj-$(CONFIG_QNX6FS_FS) += qnx6/ - obj-$(CONFIG_AUTOFS4_FS) += autofs4/ - obj-$(CONFIG_ADFS_FS) += adfs/ - obj-$(CONFIG_FUSE_FS) += fuse/ --obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ -+obj-$(CONFIG_OVERLAY_FS) += overlayfs/ - obj-$(CONFIG_UDF_FS) += udf/ - obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ - obj-$(CONFIG_OMFS_FS) += omfs/ -diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig -index e601259..3435581 100644 ---- a/fs/overlayfs/Kconfig -+++ b/fs/overlayfs/Kconfig -@@ -1,4 +1,4 @@ --config OVERLAYFS_FS -+config OVERLAY_FS - tristate "Overlay filesystem support" - help - An overlay filesystem combines two filesystems - an 'upper' filesystem -diff --git a/fs/overlayfs/Makefile b/fs/overlayfs/Makefile -index 8f91889..900daed 100644 ---- a/fs/overlayfs/Makefile -+++ b/fs/overlayfs/Makefile -@@ -2,6 +2,6 @@ - # Makefile for the overlay filesystem. - # - --obj-$(CONFIG_OVERLAYFS_FS) += overlayfs.o -+obj-$(CONFIG_OVERLAY_FS) += overlay.o - --overlayfs-objs := super.o inode.o dir.o readdir.o copy_up.o -+overlay-objs := super.o inode.o dir.o readdir.o copy_up.o -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 08b704c..b92bd18 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -24,7 +24,7 @@ MODULE_AUTHOR("Miklos Szeredi "); - MODULE_DESCRIPTION("Overlay filesystem"); - MODULE_LICENSE("GPL"); - --#define OVERLAYFS_SUPER_MAGIC 0x794c764f -+#define OVERLAYFS_SUPER_MAGIC 0x794c7630 - - struct ovl_config { - char *lowerdir; -@@ -776,11 +776,11 @@ static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags, - - static struct file_system_type ovl_fs_type = { - .owner = THIS_MODULE, -- .name = "overlayfs", -+ .name = "overlay", - .mount = ovl_mount, - .kill_sb = kill_anon_super, - }; --MODULE_ALIAS_FS("overlayfs"); -+MODULE_ALIAS_FS("overlay"); - - static int __init ovl_init(void) - { --- -2.7.4 - - -From 67b24788bb53d0b36bad84205ab940718003bffc Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:39:59 +0100 -Subject: [PATCH 35/73] ovl: fix remove/copy-up race - -ovl_remove_and_whiteout() needs to check if upper dentry exists or not -after having locked upper parent directory. - -Previously we used a "type" value computed before locking the upper parent -directory, which is susceptible to racing with copy-up. - -There's a similar check in ovl_check_empty_and_clear(). This one is not -actually racy, since copy-up doesn't change the "emptyness" property of a -directory. Add a comment to this effect, and check the existence of upper -dentry locally to make the code cleaner. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit a105d685a8483985a01776411de191a726b48132) -Signed-off-by: Alex Shi ---- - fs/overlayfs/dir.c | 31 +++++++++++++++++++------------ - 1 file changed, 19 insertions(+), 12 deletions(-) - -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -index 15cd91a..8ffc4b9 100644 ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -284,8 +284,7 @@ out: - return ERR_PTR(err); - } - --static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, -- enum ovl_path_type type) -+static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry) - { - int err; - struct dentry *ret = NULL; -@@ -294,8 +293,17 @@ static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, - err = ovl_check_empty_dir(dentry, &list); - if (err) - ret = ERR_PTR(err); -- else if (type == OVL_PATH_MERGE) -- ret = ovl_clear_empty(dentry, &list); -+ else { -+ /* -+ * If no upperdentry then skip clearing whiteouts. -+ * -+ * Can race with copy-up, since we don't hold the upperdir -+ * mutex. Doesn't matter, since copy-up can't create a -+ * non-empty directory from an empty one. -+ */ -+ if (ovl_dentry_upper(dentry)) -+ ret = ovl_clear_empty(dentry, &list); -+ } - - ovl_cache_free(&list); - -@@ -487,8 +495,7 @@ out: - return err; - } - --static int ovl_remove_and_whiteout(struct dentry *dentry, -- enum ovl_path_type type, bool is_dir) -+static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) - { - struct dentry *workdir = ovl_workdir(dentry); - struct inode *wdir = workdir->d_inode; -@@ -500,7 +507,7 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, - int err; - - if (is_dir) { -- opaquedir = ovl_check_empty_and_clear(dentry, type); -+ opaquedir = ovl_check_empty_and_clear(dentry); - err = PTR_ERR(opaquedir); - if (IS_ERR(opaquedir)) - goto out; -@@ -515,9 +522,10 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, - if (IS_ERR(whiteout)) - goto out_unlock; - -- if (type == OVL_PATH_LOWER) { -+ upper = ovl_dentry_upper(dentry); -+ if (!upper) { - upper = lookup_one_len(dentry->d_name.name, upperdir, -- dentry->d_name.len); -+ dentry->d_name.len); - err = PTR_ERR(upper); - if (IS_ERR(upper)) - goto kill_whiteout; -@@ -529,7 +537,6 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, - } else { - int flags = 0; - -- upper = ovl_dentry_upper(dentry); - if (opaquedir) - upper = opaquedir; - err = -ESTALE; -@@ -648,7 +655,7 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir) - cap_raise(override_cred->cap_effective, CAP_CHOWN); - old_cred = override_creds(override_cred); - -- err = ovl_remove_and_whiteout(dentry, type, is_dir); -+ err = ovl_remove_and_whiteout(dentry, is_dir); - - revert_creds(old_cred); - put_cred(override_cred); -@@ -781,7 +788,7 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, - } - - if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { -- opaquedir = ovl_check_empty_and_clear(new, new_type); -+ opaquedir = ovl_check_empty_and_clear(new); - err = PTR_ERR(opaquedir); - if (IS_ERR(opaquedir)) { - opaquedir = NULL; --- -2.7.4 - - -From ee3679843c9d6dec75e1d260cb6f041aa36ccbed Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:40:00 +0100 -Subject: [PATCH 36/73] ovl: fix race in private xattr checks - -Xattr operations can race with copy up. This does not matter as long as -we consistently fiter out "trunsted.overlay.opaque" attribute on upper -directories. - -Previously we checked parent against OVL_PATH_MERGE. This is too general, -and prone to race with copy-up. I.e. we found the parent to be on the -lower layer but ovl_dentry_real() would return the copied-up dentry, -possibly with the "opaque" attribute. - -So instead use ovl_path_real() and decide to filter the attributes based on -the actual type of the dentry we'll use. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 521484639ec19a6f1ed56de6993feb255f5f676c) -Signed-off-by: Alex Shi ---- - fs/overlayfs/inode.c | 27 ++++++++++++++++++--------- - 1 file changed, 18 insertions(+), 9 deletions(-) - -diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c -index af2d18c..07d74b2 100644 ---- a/fs/overlayfs/inode.c -+++ b/fs/overlayfs/inode.c -@@ -235,26 +235,36 @@ out: - return err; - } - -+static bool ovl_need_xattr_filter(struct dentry *dentry, -+ enum ovl_path_type type) -+{ -+ return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode); -+} -+ - ssize_t ovl_getxattr(struct dentry *dentry, const char *name, - void *value, size_t size) - { -- if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && -- ovl_is_private_xattr(name)) -+ struct path realpath; -+ enum ovl_path_type type = ovl_path_real(dentry, &realpath); -+ -+ if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) - return -ENODATA; - -- return vfs_getxattr(ovl_dentry_real(dentry), name, value, size); -+ return vfs_getxattr(realpath.dentry, name, value, size); - } - - ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) - { -+ struct path realpath; -+ enum ovl_path_type type = ovl_path_real(dentry, &realpath); - ssize_t res; - int off; - -- res = vfs_listxattr(ovl_dentry_real(dentry), list, size); -+ res = vfs_listxattr(realpath.dentry, list, size); - if (res <= 0 || size == 0) - return res; - -- if (ovl_path_type(dentry->d_parent) != OVL_PATH_MERGE) -+ if (!ovl_need_xattr_filter(dentry, type)) - return res; - - /* filter out private xattrs */ -@@ -279,17 +289,16 @@ int ovl_removexattr(struct dentry *dentry, const char *name) - { - int err; - struct path realpath; -- enum ovl_path_type type; -+ enum ovl_path_type type = ovl_path_real(dentry, &realpath); - - err = ovl_want_write(dentry); - if (err) - goto out; - -- if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && -- ovl_is_private_xattr(name)) -+ err = -ENODATA; -+ if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) - goto out_drop_write; - -- type = ovl_path_real(dentry, &realpath); - if (type == OVL_PATH_LOWER) { - err = vfs_getxattr(realpath.dentry, name, NULL, 0); - if (err < 0) --- -2.7.4 - - -From 0ca1a2c9b8357ebf224d1714a6a1e3635e8e5862 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:40:00 +0100 -Subject: [PATCH 37/73] ovl: allow filenames with comma - -Allow option separator (comma) to be escaped with backslash. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 91c77947133f7aef851b625701e182d3f99d14a9) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 45 insertions(+), 3 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index b92bd18..eee7a62 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -462,11 +462,34 @@ static const match_table_t ovl_tokens = { - {OPT_ERR, NULL} - }; - -+static char *ovl_next_opt(char **s) -+{ -+ char *sbegin = *s; -+ char *p; -+ -+ if (sbegin == NULL) -+ return NULL; -+ -+ for (p = sbegin; *p; p++) { -+ if (*p == '\\') { -+ p++; -+ if (!*p) -+ break; -+ } else if (*p == ',') { -+ *p = '\0'; -+ *s = p + 1; -+ return sbegin; -+ } -+ } -+ *s = NULL; -+ return sbegin; -+} -+ - static int ovl_parse_opt(char *opt, struct ovl_config *config) - { - char *p; - -- while ((p = strsep(&opt, ",")) != NULL) { -+ while ((p = ovl_next_opt(&opt)) != NULL) { - int token; - substring_t args[MAX_OPT_ARGS]; - -@@ -554,15 +577,34 @@ out_dput: - goto out_unlock; - } - -+static void ovl_unescape(char *s) -+{ -+ char *d = s; -+ -+ for (;; s++, d++) { -+ if (*s == '\\') -+ s++; -+ *d = *s; -+ if (!*s) -+ break; -+ } -+} -+ - static int ovl_mount_dir(const char *name, struct path *path) - { - int err; -+ char *tmp = kstrdup(name, GFP_KERNEL); -+ -+ if (!tmp) -+ return -ENOMEM; - -- err = kern_path(name, LOOKUP_FOLLOW, path); -+ ovl_unescape(tmp); -+ err = kern_path(tmp, LOOKUP_FOLLOW, path); - if (err) { -- pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); -+ pr_err("overlayfs: failed to resolve '%s': %i\n", tmp, err); - err = -EINVAL; - } -+ kfree(tmp); - return err; - } - --- -2.7.4 - - -From a4180dfef4dc3c948d524dfe0c168cb59317df56 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:40:01 +0100 -Subject: [PATCH 38/73] ovl: use lockless_dereference() for upperdentry - -Don't open code lockless_dereference() in ovl_upperdentry_dereference(). - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 71d509280f7e92eb60ae6b7c78c20afafff060c7) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index eee7a62..f16d318 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -84,12 +84,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry) - - static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) - { -- struct dentry *upperdentry = ACCESS_ONCE(oe->__upperdentry); -- /* -- * Make sure to order reads to upperdentry wrt ovl_dentry_update() -- */ -- smp_read_barrier_depends(); -- return upperdentry; -+ return lockless_dereference(oe->__upperdentry); - } - - void ovl_path_upper(struct dentry *dentry, struct path *path) --- -2.7.4 - - -From d3a45e42dd711ce4e2095f14d77865b78c749190 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:40:01 +0100 -Subject: [PATCH 39/73] ovl: pass dentry into ovl_dir_read_merged() - -Pass dentry into ovl_dir_read_merged() insted of upperpath and lowerpath. -This cleans up callers and paves the way for multi-layer directory reads. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit c9f00fdb9ab3999cb2fb582ad82a5db9e70c82f5) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 35 ++++++++++++++--------------------- - 1 file changed, 14 insertions(+), 21 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index fdb63de..6d5d9fd 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -276,11 +276,11 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir, - return 0; - } - --static inline int ovl_dir_read_merged(struct path *upperpath, -- struct path *lowerpath, -- struct list_head *list) -+static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) - { - int err; -+ struct path lowerpath; -+ struct path upperpath; - struct ovl_readdir_data rdd = { - .ctx.actor = ovl_fill_merge, - .list = list, -@@ -288,25 +288,28 @@ static inline int ovl_dir_read_merged(struct path *upperpath, - .is_merge = false, - }; - -- if (upperpath->dentry) { -- err = ovl_dir_read(upperpath, &rdd); -+ ovl_path_lower(dentry, &lowerpath); -+ ovl_path_upper(dentry, &upperpath); -+ -+ if (upperpath.dentry) { -+ err = ovl_dir_read(&upperpath, &rdd); - if (err) - goto out; - -- if (lowerpath->dentry) { -- err = ovl_dir_mark_whiteouts(upperpath->dentry, &rdd); -+ if (lowerpath.dentry) { -+ err = ovl_dir_mark_whiteouts(upperpath.dentry, &rdd); - if (err) - goto out; - } - } -- if (lowerpath->dentry) { -+ if (lowerpath.dentry) { - /* - * Insert lowerpath entries before upperpath ones, this allows - * offsets to be reasonably constant - */ - list_add(&rdd.middle, rdd.list); - rdd.is_merge = true; -- err = ovl_dir_read(lowerpath, &rdd); -+ err = ovl_dir_read(&lowerpath, &rdd); - list_del(&rdd.middle); - } - out: -@@ -331,8 +334,6 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) - static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) - { - int res; -- struct path lowerpath; -- struct path upperpath; - struct ovl_dir_cache *cache; - - cache = ovl_dir_cache(dentry); -@@ -349,10 +350,7 @@ static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) - cache->refcount = 1; - INIT_LIST_HEAD(&cache->entries); - -- ovl_path_lower(dentry, &lowerpath); -- ovl_path_upper(dentry, &upperpath); -- -- res = ovl_dir_read_merged(&upperpath, &lowerpath, &cache->entries); -+ res = ovl_dir_read_merged(dentry, &cache->entries); - if (res) { - ovl_cache_free(&cache->entries); - kfree(cache); -@@ -540,14 +538,9 @@ const struct file_operations ovl_dir_operations = { - int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) - { - int err; -- struct path lowerpath; -- struct path upperpath; - struct ovl_cache_entry *p; - -- ovl_path_upper(dentry, &upperpath); -- ovl_path_lower(dentry, &lowerpath); -- -- err = ovl_dir_read_merged(&upperpath, &lowerpath, list); -+ err = ovl_dir_read_merged(dentry, list); - if (err) - return err; - --- -2.7.4 - - -From effb810d716f07d643385ba8206ab981a4b20dd9 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 20 Nov 2014 16:40:02 +0100 -Subject: [PATCH 40/73] ovl: ovl_dir_fsync() cleanup - -Check against !OVL_PATH_LOWER instead of OVL_PATH_MERGE. For a copied up -directory the two are currently equivalent. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 7676895f4736421ebafc48de5078e25ea69e88ee) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 6d5d9fd..c020599 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -452,10 +452,10 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, - /* - * Need to check if we started out being a lower dir, but got copied up - */ -- if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { -+ if (!od->is_upper && ovl_path_type(dentry) != OVL_PATH_LOWER) { - struct inode *inode = file_inode(file); - -- realfile =lockless_dereference(od->upperfile); -+ realfile = lockless_dereference(od->upperfile); - if (!realfile) { - struct path upperpath; - --- -2.7.4 - - -From 8f7458c9c66418c8b9af323ba29c8f023ffe559e Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:42 +0100 -Subject: [PATCH 41/73] ovl: check whiteout while reading directory - -Don't make a separate pass for checking whiteouts, since we can do it while -reading the upper directory. - -This will make it easier to handle multiple layers. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 49c21e1cacd74a8c83407c70ad860c994e606e25) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 77 ++++++++++++++++++-------------------------------- - 1 file changed, 28 insertions(+), 49 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index c020599..b361719 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -40,6 +40,7 @@ struct ovl_readdir_data { - struct rb_root root; - struct list_head *list; - struct list_head middle; -+ struct dentry *dir; - int count; - int err; - }; -@@ -126,6 +127,32 @@ static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, - if (p == NULL) - return -ENOMEM; - -+ if (d_type == DT_CHR) { -+ struct dentry *dentry; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) { -+ kfree(p); -+ return -ENOMEM; -+ } -+ -+ /* -+ * CAP_DAC_OVERRIDE for lookup -+ */ -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ old_cred = override_creds(override_cred); -+ -+ dentry = lookup_one_len(name, rdd->dir, len); -+ if (!IS_ERR(dentry)) { -+ p->is_whiteout = ovl_is_whiteout(dentry); -+ dput(dentry); -+ } -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ } -+ - list_add_tail(&p->l_node, rdd->list); - rb_link_node(&p->node, parent, newp); - rb_insert_color(&p->node, &rdd->root); -@@ -233,49 +260,6 @@ static void ovl_dir_reset(struct file *file) - od->is_real = false; - } - --static int ovl_dir_mark_whiteouts(struct dentry *dir, -- struct ovl_readdir_data *rdd) --{ -- struct ovl_cache_entry *p; -- struct dentry *dentry; -- const struct cred *old_cred; -- struct cred *override_cred; -- -- override_cred = prepare_creds(); -- if (!override_cred) { -- ovl_cache_free(rdd->list); -- return -ENOMEM; -- } -- -- /* -- * CAP_DAC_OVERRIDE for lookup -- */ -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- old_cred = override_creds(override_cred); -- -- mutex_lock(&dir->d_inode->i_mutex); -- list_for_each_entry(p, rdd->list, l_node) { -- if (p->is_cursor) -- continue; -- -- if (p->type != DT_CHR) -- continue; -- -- dentry = lookup_one_len(p->name, dir, p->len); -- if (IS_ERR(dentry)) -- continue; -- -- p->is_whiteout = ovl_is_whiteout(dentry); -- dput(dentry); -- } -- mutex_unlock(&dir->d_inode->i_mutex); -- -- revert_creds(old_cred); -- put_cred(override_cred); -- -- return 0; --} -- - static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) - { - int err; -@@ -292,15 +276,10 @@ static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) - ovl_path_upper(dentry, &upperpath); - - if (upperpath.dentry) { -+ rdd.dir = upperpath.dentry; - err = ovl_dir_read(&upperpath, &rdd); - if (err) - goto out; -- -- if (lowerpath.dentry) { -- err = ovl_dir_mark_whiteouts(upperpath.dentry, &rdd); -- if (err) -- goto out; -- } - } - if (lowerpath.dentry) { - /* --- -2.7.4 - - -From 8688583b8896b61fb799a3e7a6272b8beb87ec9e Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:42 +0100 -Subject: [PATCH 42/73] ovl: make path-type a bitmap - -OVL_PATH_PURE_UPPER -> __OVL_PATH_UPPER | __OVL_PATH_PURE -OVL_PATH_UPPER -> __OVL_PATH_UPPER -OVL_PATH_MERGE -> __OVL_PATH_UPPER | __OVL_PATH_MERGE -OVL_PATH_LOWER -> 0 - -Multiple R/O layers will allow __OVL_PATH_MERGE without __OVL_PATH_UPPER. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 1afaba1ecb5299cdd0f69b5bad98b0185fe71e79) -Signed-off-by: Alex Shi ---- - fs/overlayfs/copy_up.c | 4 ++-- - fs/overlayfs/dir.c | 22 +++++++++++----------- - fs/overlayfs/inode.c | 9 ++++++--- - fs/overlayfs/overlayfs.h | 13 +++++++++---- - fs/overlayfs/readdir.c | 10 +++++----- - fs/overlayfs/super.c | 19 ++++++++----------- - 6 files changed, 41 insertions(+), 36 deletions(-) - -diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c -index ea10a87..a5bfd60 100644 ---- a/fs/overlayfs/copy_up.c -+++ b/fs/overlayfs/copy_up.c -@@ -385,7 +385,7 @@ int ovl_copy_up(struct dentry *dentry) - struct kstat stat; - enum ovl_path_type type = ovl_path_type(dentry); - -- if (type != OVL_PATH_LOWER) -+ if (OVL_TYPE_UPPER(type)) - break; - - next = dget(dentry); -@@ -394,7 +394,7 @@ int ovl_copy_up(struct dentry *dentry) - parent = dget_parent(next); - - type = ovl_path_type(parent); -- if (type != OVL_PATH_LOWER) -+ if (OVL_TYPE_UPPER(type)) - break; - - dput(next); -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -index 8ffc4b9..ab50bd1 100644 ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -152,7 +152,7 @@ static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry, - * correct link count. nlink=1 seems to pacify 'find' and - * other utilities. - */ -- if (type == OVL_PATH_MERGE) -+ if (OVL_TYPE_MERGE(type)) - stat->nlink = 1; - - return 0; -@@ -630,7 +630,7 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir) - goto out_drop_write; - - type = ovl_path_type(dentry); -- if (type == OVL_PATH_PURE_UPPER) { -+ if (OVL_TYPE_PURE_UPPER(type)) { - err = ovl_remove_upper(dentry, is_dir); - } else { - const struct cred *old_cred; -@@ -712,7 +712,7 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, - /* Don't copy up directory trees */ - old_type = ovl_path_type(old); - err = -EXDEV; -- if ((old_type == OVL_PATH_LOWER || old_type == OVL_PATH_MERGE) && is_dir) -+ if (OVL_TYPE_MERGE_OR_LOWER(old_type) && is_dir) - goto out; - - if (new->d_inode) { -@@ -725,25 +725,25 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, - - new_type = ovl_path_type(new); - err = -EXDEV; -- if (!overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) -+ if (!overwrite && OVL_TYPE_MERGE_OR_LOWER(new_type) && new_is_dir) - goto out; - - err = 0; -- if (new_type == OVL_PATH_LOWER && old_type == OVL_PATH_LOWER) { -+ if (!OVL_TYPE_UPPER(new_type) && !OVL_TYPE_UPPER(old_type)) { - if (ovl_dentry_lower(old)->d_inode == - ovl_dentry_lower(new)->d_inode) - goto out; - } -- if (new_type != OVL_PATH_LOWER && old_type != OVL_PATH_LOWER) { -+ if (OVL_TYPE_UPPER(new_type) && OVL_TYPE_UPPER(old_type)) { - if (ovl_dentry_upper(old)->d_inode == - ovl_dentry_upper(new)->d_inode) - goto out; - } - } else { - if (ovl_dentry_is_opaque(new)) -- new_type = OVL_PATH_UPPER; -+ new_type = __OVL_PATH_UPPER; - else -- new_type = OVL_PATH_PURE_UPPER; -+ new_type = __OVL_PATH_UPPER | __OVL_PATH_PURE; - } - - err = ovl_want_write(old); -@@ -763,8 +763,8 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, - goto out_drop_write; - } - -- old_opaque = old_type != OVL_PATH_PURE_UPPER; -- new_opaque = new_type != OVL_PATH_PURE_UPPER; -+ old_opaque = !OVL_TYPE_PURE_UPPER(old_type); -+ new_opaque = !OVL_TYPE_PURE_UPPER(new_type); - - if (old_opaque || new_opaque) { - err = -ENOMEM; -@@ -787,7 +787,7 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, - old_cred = override_creds(override_cred); - } - -- if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { -+ if (overwrite && OVL_TYPE_MERGE_OR_LOWER(new_type) && new_is_dir) { - opaquedir = ovl_check_empty_and_clear(new); - err = PTR_ERR(opaquedir); - if (IS_ERR(opaquedir)) { -diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c -index 07d74b2..48492f1 100644 ---- a/fs/overlayfs/inode.c -+++ b/fs/overlayfs/inode.c -@@ -238,7 +238,10 @@ out: - static bool ovl_need_xattr_filter(struct dentry *dentry, - enum ovl_path_type type) - { -- return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode); -+ if ((type & (__OVL_PATH_PURE | __OVL_PATH_UPPER)) == __OVL_PATH_UPPER) -+ return S_ISDIR(dentry->d_inode->i_mode); -+ else -+ return false; - } - - ssize_t ovl_getxattr(struct dentry *dentry, const char *name, -@@ -299,7 +302,7 @@ int ovl_removexattr(struct dentry *dentry, const char *name) - if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) - goto out_drop_write; - -- if (type == OVL_PATH_LOWER) { -+ if (!OVL_TYPE_UPPER(type)) { - err = vfs_getxattr(realpath.dentry, name, NULL, 0); - if (err < 0) - goto out_drop_write; -@@ -321,7 +324,7 @@ out: - static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type, - struct dentry *realdentry) - { -- if (type != OVL_PATH_LOWER) -+ if (OVL_TYPE_UPPER(type)) - return false; - - if (special_file(realdentry->d_inode->i_mode)) -diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h -index 814bed3..d39eaa8 100644 ---- a/fs/overlayfs/overlayfs.h -+++ b/fs/overlayfs/overlayfs.h -@@ -12,12 +12,17 @@ - struct ovl_entry; - - enum ovl_path_type { -- OVL_PATH_PURE_UPPER, -- OVL_PATH_UPPER, -- OVL_PATH_MERGE, -- OVL_PATH_LOWER, -+ __OVL_PATH_PURE = (1 << 0), -+ __OVL_PATH_UPPER = (1 << 1), -+ __OVL_PATH_MERGE = (1 << 2), - }; - -+#define OVL_TYPE_UPPER(type) ((type) & __OVL_PATH_UPPER) -+#define OVL_TYPE_MERGE(type) ((type) & __OVL_PATH_MERGE) -+#define OVL_TYPE_PURE_UPPER(type) ((type) & __OVL_PATH_PURE) -+#define OVL_TYPE_MERGE_OR_LOWER(type) \ -+ (OVL_TYPE_MERGE(type) || !OVL_TYPE_UPPER(type)) -+ - extern const char *ovl_opaque_xattr; - - static inline int ovl_do_rmdir(struct inode *dir, struct dentry *dentry) -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index b361719..fb18287 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -255,8 +255,8 @@ static void ovl_dir_reset(struct file *file) - ovl_cache_put(od, dentry); - od->cache = NULL; - } -- WARN_ON(!od->is_real && type != OVL_PATH_MERGE); -- if (od->is_real && type == OVL_PATH_MERGE) -+ WARN_ON(!od->is_real && !OVL_TYPE_MERGE(type)); -+ if (od->is_real && OVL_TYPE_MERGE(type)) - od->is_real = false; - } - -@@ -431,7 +431,7 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, - /* - * Need to check if we started out being a lower dir, but got copied up - */ -- if (!od->is_upper && ovl_path_type(dentry) != OVL_PATH_LOWER) { -+ if (!od->is_upper && OVL_TYPE_UPPER(ovl_path_type(dentry))) { - struct inode *inode = file_inode(file); - - realfile = lockless_dereference(od->upperfile); -@@ -497,8 +497,8 @@ static int ovl_dir_open(struct inode *inode, struct file *file) - } - INIT_LIST_HEAD(&od->cursor.l_node); - od->realfile = realfile; -- od->is_real = (type != OVL_PATH_MERGE); -- od->is_upper = (type != OVL_PATH_LOWER); -+ od->is_real = !OVL_TYPE_MERGE(type); -+ od->is_upper = OVL_TYPE_UPPER(type); - od->cursor.is_cursor = true; - file->private_data = od; - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index f16d318..821719c 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -64,22 +64,19 @@ const char *ovl_opaque_xattr = "trusted.overlay.opaque"; - enum ovl_path_type ovl_path_type(struct dentry *dentry) - { - struct ovl_entry *oe = dentry->d_fsdata; -+ enum ovl_path_type type = 0; - - if (oe->__upperdentry) { -+ type = __OVL_PATH_UPPER; -+ - if (oe->lowerdentry) { - if (S_ISDIR(dentry->d_inode->i_mode)) -- return OVL_PATH_MERGE; -- else -- return OVL_PATH_UPPER; -- } else { -- if (oe->opaque) -- return OVL_PATH_UPPER; -- else -- return OVL_PATH_PURE_UPPER; -+ type |= __OVL_PATH_MERGE; -+ } else if (!oe->opaque) { -+ type |= __OVL_PATH_PURE; - } -- } else { -- return OVL_PATH_LOWER; - } -+ return type; - } - - static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) -@@ -101,7 +98,7 @@ enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path) - - enum ovl_path_type type = ovl_path_type(dentry); - -- if (type == OVL_PATH_LOWER) -+ if (!OVL_TYPE_UPPER(type)) - ovl_path_lower(dentry, path); - else - ovl_path_upper(dentry, path); --- -2.7.4 - - -From 046f00ecd2379495e451658be72234ded7bee154 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:43 +0100 -Subject: [PATCH 43/73] ovl: dont replace opaque dir - -When removing an empty opaque directory, then it makes no sense to replace -it with an exact replica of itself before removal. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 263b4a0fee43f1239c4d6f3c3a62fb5a20d84f2e) -Signed-off-by: Alex Shi ---- - fs/overlayfs/dir.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -index ab50bd1..dcae3ac 100644 ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -506,7 +506,7 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) - struct dentry *opaquedir = NULL; - int err; - -- if (is_dir) { -+ if (is_dir && OVL_TYPE_MERGE_OR_LOWER(ovl_path_type(dentry))) { - opaquedir = ovl_check_empty_and_clear(dentry); - err = PTR_ERR(opaquedir); - if (IS_ERR(opaquedir)) --- -2.7.4 - - -From d669aefff21050073a65d12d8711c7c8bbad65b9 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:43 +0100 -Subject: [PATCH 44/73] ovl: add mutli-layer infrastructure - -Add multiple lower layers to 'struct ovl_fs' and 'struct ovl_entry'. - -ovl_entry will have an array of paths, instead of just the dentry. This -allows a compact array containing just the layers which exist at current -point in the tree (which is expected to be a small number for the majority -of dentries). - -The number of layers is not limited by this infrastructure. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit dd662667e6d3e55b42798a6e6e7f37dddc639460) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 98 ++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 64 insertions(+), 34 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 821719c..460d866 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -35,7 +35,8 @@ struct ovl_config { - /* private information held for overlayfs's superblock */ - struct ovl_fs { - struct vfsmount *upper_mnt; -- struct vfsmount *lower_mnt; -+ unsigned numlower; -+ struct vfsmount **lower_mnt; - struct dentry *workdir; - long lower_namelen; - /* pathnames of lower and upper dirs, for show_options */ -@@ -47,7 +48,6 @@ struct ovl_dir_cache; - /* private information held for every overlayfs dentry */ - struct ovl_entry { - struct dentry *__upperdentry; -- struct dentry *lowerdentry; - struct ovl_dir_cache *cache; - union { - struct { -@@ -56,10 +56,16 @@ struct ovl_entry { - }; - struct rcu_head rcu; - }; -+ unsigned numlower; -+ struct path lowerstack[]; - }; - - const char *ovl_opaque_xattr = "trusted.overlay.opaque"; - -+static struct dentry *__ovl_dentry_lower(struct ovl_entry *oe) -+{ -+ return oe->numlower ? oe->lowerstack[0].dentry : NULL; -+} - - enum ovl_path_type ovl_path_type(struct dentry *dentry) - { -@@ -69,7 +75,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry) - if (oe->__upperdentry) { - type = __OVL_PATH_UPPER; - -- if (oe->lowerdentry) { -+ if (oe->numlower) { - if (S_ISDIR(dentry->d_inode->i_mode)) - type |= __OVL_PATH_MERGE; - } else if (!oe->opaque) { -@@ -117,7 +123,7 @@ struct dentry *ovl_dentry_lower(struct dentry *dentry) - { - struct ovl_entry *oe = dentry->d_fsdata; - -- return oe->lowerdentry; -+ return __ovl_dentry_lower(oe); - } - - struct dentry *ovl_dentry_real(struct dentry *dentry) -@@ -127,7 +133,7 @@ struct dentry *ovl_dentry_real(struct dentry *dentry) - - realdentry = ovl_upperdentry_dereference(oe); - if (!realdentry) -- realdentry = oe->lowerdentry; -+ realdentry = __ovl_dentry_lower(oe); - - return realdentry; - } -@@ -140,7 +146,7 @@ struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper) - if (realdentry) { - *is_upper = true; - } else { -- realdentry = oe->lowerdentry; -+ realdentry = __ovl_dentry_lower(oe); - *is_upper = false; - } - return realdentry; -@@ -162,11 +168,9 @@ void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache) - - void ovl_path_lower(struct dentry *dentry, struct path *path) - { -- struct ovl_fs *ofs = dentry->d_sb->s_fs_info; - struct ovl_entry *oe = dentry->d_fsdata; - -- path->mnt = ofs->lower_mnt; -- path->dentry = oe->lowerdentry; -+ *path = oe->numlower ? oe->lowerstack[0] : (struct path) { NULL, NULL }; - } - - int ovl_want_write(struct dentry *dentry) -@@ -258,8 +262,11 @@ static void ovl_dentry_release(struct dentry *dentry) - struct ovl_entry *oe = dentry->d_fsdata; - - if (oe) { -+ unsigned int i; -+ - dput(oe->__upperdentry); -- dput(oe->lowerdentry); -+ for (i = 0; i < oe->numlower; i++) -+ dput(oe->lowerstack[i].dentry); - kfree_rcu(oe, rcu); - } - } -@@ -268,9 +275,15 @@ static const struct dentry_operations ovl_dentry_operations = { - .d_release = ovl_dentry_release, - }; - --static struct ovl_entry *ovl_alloc_entry(void) -+static struct ovl_entry *ovl_alloc_entry(unsigned int numlower) - { -- return kzalloc(sizeof(struct ovl_entry), GFP_KERNEL); -+ size_t size = offsetof(struct ovl_entry, lowerstack[numlower]); -+ struct ovl_entry *oe = kzalloc(size, GFP_KERNEL); -+ -+ if (oe) -+ oe->numlower = numlower; -+ -+ return oe; - } - - static inline struct dentry *ovl_lookup_real(struct dentry *dir, -@@ -297,19 +310,19 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - { - struct ovl_entry *oe; - struct dentry *upperdir; -- struct dentry *lowerdir; -+ struct path lowerdir; - struct dentry *upperdentry = NULL; - struct dentry *lowerdentry = NULL; - struct inode *inode = NULL; - int err; - - err = -ENOMEM; -- oe = ovl_alloc_entry(); -+ oe = ovl_alloc_entry(1); - if (!oe) - goto out; - - upperdir = ovl_dentry_upper(dentry->d_parent); -- lowerdir = ovl_dentry_lower(dentry->d_parent); -+ ovl_path_lower(dentry->d_parent, &lowerdir); - - if (upperdir) { - upperdentry = ovl_lookup_real(upperdir, &dentry->d_name); -@@ -317,7 +330,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - if (IS_ERR(upperdentry)) - goto out_put_dir; - -- if (lowerdir && upperdentry) { -+ if (lowerdir.dentry && upperdentry) { - if (ovl_is_whiteout(upperdentry)) { - dput(upperdentry); - upperdentry = NULL; -@@ -327,8 +340,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - } - } - } -- if (lowerdir && !oe->opaque) { -- lowerdentry = ovl_lookup_real(lowerdir, &dentry->d_name); -+ if (lowerdir.dentry && !oe->opaque) { -+ lowerdentry = ovl_lookup_real(lowerdir.dentry, &dentry->d_name); - err = PTR_ERR(lowerdentry); - if (IS_ERR(lowerdentry)) - goto out_dput_upper; -@@ -355,8 +368,12 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - } - - oe->__upperdentry = upperdentry; -- oe->lowerdentry = lowerdentry; -- -+ if (lowerdentry) { -+ oe->lowerstack[0].dentry = lowerdentry; -+ oe->lowerstack[0].mnt = lowerdir.mnt; -+ } else { -+ oe->numlower = 0; -+ } - dentry->d_fsdata = oe; - d_add(dentry, inode); - -@@ -380,10 +397,12 @@ struct file *ovl_path_open(struct path *path, int flags) - static void ovl_put_super(struct super_block *sb) - { - struct ovl_fs *ufs = sb->s_fs_info; -+ unsigned i; - - dput(ufs->workdir); - mntput(ufs->upper_mnt); -- mntput(ufs->lower_mnt); -+ for (i = 0; i < ufs->numlower; i++) -+ mntput(ufs->lower_mnt[i]); - - kfree(ufs->config.lowerdir); - kfree(ufs->config.upperdir); -@@ -641,6 +660,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - struct ovl_entry *oe; - struct ovl_fs *ufs; - struct kstatfs statfs; -+ struct vfsmount *mnt; -+ unsigned int i; - int err; - - err = -ENOMEM; -@@ -661,7 +682,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - } - - err = -ENOMEM; -- oe = ovl_alloc_entry(); -+ oe = ovl_alloc_entry(1); - if (oe == NULL) - goto out_free_config; - -@@ -727,12 +748,24 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - goto out_put_workpath; - } - -- ufs->lower_mnt = clone_private_mount(&lowerpath); -- err = PTR_ERR(ufs->lower_mnt); -- if (IS_ERR(ufs->lower_mnt)) { -- pr_err("overlayfs: failed to clone lowerpath\n"); -+ ufs->lower_mnt = kcalloc(1, sizeof(struct vfsmount *), GFP_KERNEL); -+ if (ufs->lower_mnt == NULL) - goto out_put_upper_mnt; -+ -+ mnt = clone_private_mount(&lowerpath); -+ err = PTR_ERR(mnt); -+ if (IS_ERR(mnt)) { -+ pr_err("overlayfs: failed to clone lowerpath\n"); -+ goto out_put_lower_mnt; - } -+ /* -+ * Make lower_mnt R/O. That way fchmod/fchown on lower file -+ * will fail instead of modifying lower fs. -+ */ -+ mnt->mnt_flags |= MNT_READONLY; -+ -+ ufs->lower_mnt[0] = mnt; -+ ufs->numlower = 1; - - ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); - err = PTR_ERR(ufs->workdir); -@@ -742,12 +775,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - goto out_put_lower_mnt; - } - -- /* -- * Make lower_mnt R/O. That way fchmod/fchown on lower file -- * will fail instead of modifying lower fs. -- */ -- ufs->lower_mnt->mnt_flags |= MNT_READONLY; -- - /* If the upper fs is r/o, we mark overlayfs r/o too */ - if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY) - sb->s_flags |= MS_RDONLY; -@@ -768,7 +795,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - path_put(&workpath); - - oe->__upperdentry = upperpath.dentry; -- oe->lowerdentry = lowerpath.dentry; -+ oe->lowerstack[0].dentry = lowerpath.dentry; -+ oe->lowerstack[0].mnt = ufs->lower_mnt[0]; - - root_dentry->d_fsdata = oe; - -@@ -782,7 +810,9 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - out_put_workdir: - dput(ufs->workdir); - out_put_lower_mnt: -- mntput(ufs->lower_mnt); -+ for (i = 0; i < ufs->numlower; i++) -+ mntput(ufs->lower_mnt[i]); -+ kfree(ufs->lower_mnt); - out_put_upper_mnt: - mntput(ufs->upper_mnt); - out_put_workpath: --- -2.7.4 - - -From 8216b4cc31e60690afef76cbe1a310064f8727d7 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:43 +0100 -Subject: [PATCH 45/73] ovl: helper to iterate layers - -Add helper to iterate through all the layers, starting from the upper layer -(if exists) and continuing down through the lower layers. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 5ef88da56a77bfb3b9631f5e5775f3bff86b6219) -Signed-off-by: Alex Shi ---- - fs/overlayfs/overlayfs.h | 1 + - fs/overlayfs/super.c | 21 +++++++++++++++++++++ - 2 files changed, 22 insertions(+) - -diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h -index d39eaa8..d176b67 100644 ---- a/fs/overlayfs/overlayfs.h -+++ b/fs/overlayfs/overlayfs.h -@@ -135,6 +135,7 @@ void ovl_dentry_version_inc(struct dentry *dentry); - void ovl_path_upper(struct dentry *dentry, struct path *path); - void ovl_path_lower(struct dentry *dentry, struct path *path); - enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path); -+int ovl_path_next(int idx, struct dentry *dentry, struct path *path); - struct dentry *ovl_dentry_upper(struct dentry *dentry); - struct dentry *ovl_dentry_lower(struct dentry *dentry); - struct dentry *ovl_dentry_real(struct dentry *dentry); -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 460d866..07e4c57 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -305,6 +305,27 @@ static inline struct dentry *ovl_lookup_real(struct dentry *dir, - return dentry; - } - -+/* -+ * Returns next layer in stack starting from top. -+ * Returns -1 if this is the last layer. -+ */ -+int ovl_path_next(int idx, struct dentry *dentry, struct path *path) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ BUG_ON(idx < 0); -+ if (idx == 0) { -+ ovl_path_upper(dentry, path); -+ if (path->dentry) -+ return oe->numlower ? 1 : -1; -+ idx++; -+ } -+ BUG_ON(idx > oe->numlower); -+ *path = oe->lowerstack[idx - 1]; -+ -+ return (idx < oe->numlower) ? idx + 1 : -1; -+} -+ - struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) - { --- -2.7.4 - - -From 3dbcd51370dba076be4dc8c45d2bf19db48201b8 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:44 +0100 -Subject: [PATCH 46/73] ovl: multi-layer readdir - -If multiple lower layers exist, merge them as well in readdir according to -the same rules as merging upper with lower. I.e. take whiteouts and opaque -directories into account on all but the lowers layer. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 9d7459d834c28f55c82f1737f638a6c90e0c0e0f) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 43 +++++++++++++++++++++---------------------- - fs/overlayfs/super.c | 3 +++ - 2 files changed, 24 insertions(+), 22 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index fb18287..5ef05149 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -263,35 +263,34 @@ static void ovl_dir_reset(struct file *file) - static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) - { - int err; -- struct path lowerpath; -- struct path upperpath; -+ struct path realpath; - struct ovl_readdir_data rdd = { - .ctx.actor = ovl_fill_merge, - .list = list, - .root = RB_ROOT, - .is_merge = false, - }; -- -- ovl_path_lower(dentry, &lowerpath); -- ovl_path_upper(dentry, &upperpath); -- -- if (upperpath.dentry) { -- rdd.dir = upperpath.dentry; -- err = ovl_dir_read(&upperpath, &rdd); -- if (err) -- goto out; -- } -- if (lowerpath.dentry) { -- /* -- * Insert lowerpath entries before upperpath ones, this allows -- * offsets to be reasonably constant -- */ -- list_add(&rdd.middle, rdd.list); -- rdd.is_merge = true; -- err = ovl_dir_read(&lowerpath, &rdd); -- list_del(&rdd.middle); -+ int idx, next; -+ -+ for (idx = 0; idx != -1; idx = next) { -+ next = ovl_path_next(idx, dentry, &realpath); -+ -+ if (next != -1) { -+ rdd.dir = realpath.dentry; -+ err = ovl_dir_read(&realpath, &rdd); -+ if (err) -+ break; -+ } else { -+ /* -+ * Insert lowest layer entries before upper ones, this -+ * allows offsets to be reasonably constant -+ */ -+ list_add(&rdd.middle, rdd.list); -+ rdd.is_merge = true; -+ err = ovl_dir_read(&realpath, &rdd); -+ list_del(&rdd.middle); -+ } - } --out: - return err; - } - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 07e4c57..c245043 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -81,6 +81,9 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry) - } else if (!oe->opaque) { - type |= __OVL_PATH_PURE; - } -+ } else { -+ if (oe->numlower > 1) -+ type |= __OVL_PATH_MERGE; - } - return type; - } --- -2.7.4 - - -From 1dabc18b8b2115693ec868cb84fda26052a8ee83 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:44 +0100 -Subject: [PATCH 47/73] ovl: multi-layer lookup - -Look up dentry in all relevant layers. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 3d3c6b89399a1b5e8a59ffbb8cb2a7797a9ef154) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 143 +++++++++++++++++++++++++++++++++------------------ - 1 file changed, 94 insertions(+), 49 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index c245043..f72b82f 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -333,82 +333,127 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags) - { - struct ovl_entry *oe; -- struct dentry *upperdir; -- struct path lowerdir; -- struct dentry *upperdentry = NULL; -- struct dentry *lowerdentry = NULL; -+ struct ovl_entry *poe = dentry->d_parent->d_fsdata; -+ struct path *stack = NULL; -+ struct dentry *upperdir, *upperdentry = NULL; -+ unsigned int ctr = 0; - struct inode *inode = NULL; -+ bool upperopaque = false; -+ struct dentry *this, *prev = NULL; -+ unsigned int i; - int err; - -- err = -ENOMEM; -- oe = ovl_alloc_entry(1); -- if (!oe) -- goto out; -- -- upperdir = ovl_dentry_upper(dentry->d_parent); -- ovl_path_lower(dentry->d_parent, &lowerdir); -- -+ upperdir = ovl_upperdentry_dereference(poe); - if (upperdir) { -- upperdentry = ovl_lookup_real(upperdir, &dentry->d_name); -- err = PTR_ERR(upperdentry); -- if (IS_ERR(upperdentry)) -- goto out_put_dir; -- -- if (lowerdir.dentry && upperdentry) { -- if (ovl_is_whiteout(upperdentry)) { -- dput(upperdentry); -- upperdentry = NULL; -- oe->opaque = true; -- } else if (ovl_is_opaquedir(upperdentry)) { -- oe->opaque = true; -+ this = ovl_lookup_real(upperdir, &dentry->d_name); -+ err = PTR_ERR(this); -+ if (IS_ERR(this)) -+ goto out; -+ -+ /* -+ * If this is not the lowermost layer, check whiteout and opaque -+ * directory. -+ */ -+ if (poe->numlower && this) { -+ if (ovl_is_whiteout(this)) { -+ dput(this); -+ this = NULL; -+ upperopaque = true; -+ } else if (ovl_is_opaquedir(this)) { -+ upperopaque = true; - } - } -+ upperdentry = prev = this; - } -- if (lowerdir.dentry && !oe->opaque) { -- lowerdentry = ovl_lookup_real(lowerdir.dentry, &dentry->d_name); -- err = PTR_ERR(lowerdentry); -- if (IS_ERR(lowerdentry)) -- goto out_dput_upper; -+ -+ if (!upperopaque && poe->numlower) { -+ err = -ENOMEM; -+ stack = kcalloc(poe->numlower, sizeof(struct path), GFP_KERNEL); -+ if (!stack) -+ goto out_put_upper; - } - -- if (lowerdentry && upperdentry && -- (!S_ISDIR(upperdentry->d_inode->i_mode) || -- !S_ISDIR(lowerdentry->d_inode->i_mode))) { -- dput(lowerdentry); -- lowerdentry = NULL; -- oe->opaque = true; -+ for (i = 0; !upperopaque && i < poe->numlower; i++) { -+ bool opaque = false; -+ struct path lowerpath = poe->lowerstack[i]; -+ -+ opaque = false; -+ this = ovl_lookup_real(lowerpath.dentry, &dentry->d_name); -+ err = PTR_ERR(this); -+ if (IS_ERR(this)) -+ goto out_put; -+ if (!this) -+ continue; -+ -+ /* -+ * If this is not the lowermost layer, check whiteout and opaque -+ * directory. -+ */ -+ if (i < poe->numlower - 1) { -+ if (ovl_is_whiteout(this)) { -+ dput(this); -+ break; -+ } else if (ovl_is_opaquedir(this)) { -+ opaque = true; -+ } -+ } -+ /* -+ * If this is a non-directory then stop here. -+ * -+ * FIXME: check for opaqueness maybe better done in remove code. -+ */ -+ if (!S_ISDIR(this->d_inode->i_mode)) { -+ opaque = true; -+ } else if (prev && (!S_ISDIR(prev->d_inode->i_mode) || -+ !S_ISDIR(this->d_inode->i_mode))) { -+ if (prev == upperdentry) -+ upperopaque = true; -+ dput(this); -+ break; -+ } -+ stack[ctr].dentry = this; -+ stack[ctr].mnt = lowerpath.mnt; -+ ctr++; -+ prev = this; -+ if (opaque) -+ break; - } - -- if (lowerdentry || upperdentry) { -+ oe = ovl_alloc_entry(ctr); -+ err = -ENOMEM; -+ if (!oe) -+ goto out_put; -+ -+ if (upperdentry || ctr) { - struct dentry *realdentry; - -- realdentry = upperdentry ? upperdentry : lowerdentry; -+ realdentry = upperdentry ? upperdentry : stack[0].dentry; -+ - err = -ENOMEM; - inode = ovl_new_inode(dentry->d_sb, realdentry->d_inode->i_mode, - oe); - if (!inode) -- goto out_dput; -+ goto out_free_oe; - ovl_copyattr(realdentry->d_inode, inode); - } - -+ oe->opaque = upperopaque; - oe->__upperdentry = upperdentry; -- if (lowerdentry) { -- oe->lowerstack[0].dentry = lowerdentry; -- oe->lowerstack[0].mnt = lowerdir.mnt; -- } else { -- oe->numlower = 0; -- } -+ memcpy(oe->lowerstack, stack, sizeof(struct path) * ctr); -+ kfree(stack); - dentry->d_fsdata = oe; - d_add(dentry, inode); - - return NULL; - --out_dput: -- dput(lowerdentry); --out_dput_upper: -- dput(upperdentry); --out_put_dir: -+out_free_oe: - kfree(oe); -+out_put: -+ for (i = 0; i < ctr; i++) -+ dput(stack[i].dentry); -+ kfree(stack); -+out_put_upper: -+ dput(upperdentry); - out: - return ERR_PTR(err); - } --- -2.7.4 - - -From 34d7a5b7b3a920178f662fa768bb724eb41be925 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:45 +0100 -Subject: [PATCH 48/73] ovl: check whiteout on lowest layer as well - -Not checking whiteouts on lowest layer was an optimization (there's nothing -to white out there), but it could result in inconsitent behavior when a -layer previously used as upper/middle is later used as lowest. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 3e01cee3b980f96463cb6f378ab05303a99903d9) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 79 +++++++++++++++++++++++++------------------------- - fs/overlayfs/super.c | 27 +++++++---------- - 2 files changed, 50 insertions(+), 56 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 5ef05149..2b8315b 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -80,23 +80,50 @@ static struct ovl_cache_entry *ovl_cache_entry_find(struct rb_root *root, - return NULL; - } - --static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, -+static struct ovl_cache_entry *ovl_cache_entry_new(struct dentry *dir, -+ const char *name, int len, - u64 ino, unsigned int d_type) - { - struct ovl_cache_entry *p; - size_t size = offsetof(struct ovl_cache_entry, name[len + 1]); - - p = kmalloc(size, GFP_KERNEL); -- if (p) { -- memcpy(p->name, name, len); -- p->name[len] = '\0'; -- p->len = len; -- p->type = d_type; -- p->ino = ino; -- p->is_whiteout = false; -- p->is_cursor = false; -- } -+ if (!p) -+ return NULL; -+ -+ memcpy(p->name, name, len); -+ p->name[len] = '\0'; -+ p->len = len; -+ p->type = d_type; -+ p->ino = ino; -+ p->is_whiteout = false; -+ p->is_cursor = false; -+ -+ if (d_type == DT_CHR) { -+ struct dentry *dentry; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) { -+ kfree(p); -+ return NULL; -+ } - -+ /* -+ * CAP_DAC_OVERRIDE for lookup -+ */ -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ old_cred = override_creds(override_cred); -+ -+ dentry = lookup_one_len(name, dir, len); -+ if (!IS_ERR(dentry)) { -+ p->is_whiteout = ovl_is_whiteout(dentry); -+ dput(dentry); -+ } -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ } - return p; - } - -@@ -123,36 +150,10 @@ static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, - return 0; - } - -- p = ovl_cache_entry_new(name, len, ino, d_type); -+ p = ovl_cache_entry_new(rdd->dir, name, len, ino, d_type); - if (p == NULL) - return -ENOMEM; - -- if (d_type == DT_CHR) { -- struct dentry *dentry; -- const struct cred *old_cred; -- struct cred *override_cred; -- -- override_cred = prepare_creds(); -- if (!override_cred) { -- kfree(p); -- return -ENOMEM; -- } -- -- /* -- * CAP_DAC_OVERRIDE for lookup -- */ -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- old_cred = override_creds(override_cred); -- -- dentry = lookup_one_len(name, rdd->dir, len); -- if (!IS_ERR(dentry)) { -- p->is_whiteout = ovl_is_whiteout(dentry); -- dput(dentry); -- } -- revert_creds(old_cred); -- put_cred(override_cred); -- } -- - list_add_tail(&p->l_node, rdd->list); - rb_link_node(&p->node, parent, newp); - rb_insert_color(&p->node, &rdd->root); -@@ -170,7 +171,7 @@ static int ovl_fill_lower(struct ovl_readdir_data *rdd, - if (p) { - list_move_tail(&p->l_node, &rdd->middle); - } else { -- p = ovl_cache_entry_new(name, namelen, ino, d_type); -+ p = ovl_cache_entry_new(rdd->dir, name, namelen, ino, d_type); - if (p == NULL) - rdd->err = -ENOMEM; - else -@@ -231,6 +232,7 @@ static inline int ovl_dir_read(struct path *realpath, - if (IS_ERR(realfile)) - return PTR_ERR(realfile); - -+ rdd->dir = realpath->dentry; - rdd->ctx.pos = 0; - do { - rdd->count = 0; -@@ -276,7 +278,6 @@ static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) - next = ovl_path_next(idx, dentry, &realpath); - - if (next != -1) { -- rdd.dir = realpath.dentry; - err = ovl_dir_read(&realpath, &rdd); - if (err) - break; -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index f72b82f..5dbc678 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -350,16 +350,12 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - if (IS_ERR(this)) - goto out; - -- /* -- * If this is not the lowermost layer, check whiteout and opaque -- * directory. -- */ -- if (poe->numlower && this) { -+ if (this) { - if (ovl_is_whiteout(this)) { - dput(this); - this = NULL; - upperopaque = true; -- } else if (ovl_is_opaquedir(this)) { -+ } else if (poe->numlower && ovl_is_opaquedir(this)) { - upperopaque = true; - } - } -@@ -384,19 +380,16 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - goto out_put; - if (!this) - continue; -- -+ if (ovl_is_whiteout(this)) { -+ dput(this); -+ break; -+ } - /* -- * If this is not the lowermost layer, check whiteout and opaque -- * directory. -+ * Only makes sense to check opaque dir if this is not the -+ * lowermost layer. - */ -- if (i < poe->numlower - 1) { -- if (ovl_is_whiteout(this)) { -- dput(this); -- break; -- } else if (ovl_is_opaquedir(this)) { -- opaque = true; -- } -- } -+ if (i < poe->numlower - 1 && ovl_is_opaquedir(this)) -+ opaque = true; - /* - * If this is a non-directory then stop here. - * --- -2.7.4 - - -From 5dfc4d41f976aa0916abe3298c71e585e78e5491 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:45 +0100 -Subject: [PATCH 49/73] ovl: lookup ENAMETOOLONG on lower means ENOENT - -"Suppose you have in one of the lower layers a filesystem with -->lookup()-enforced upper limit on name length. Pretty much every local fs -has one, but... they are not all equal. 255 characters is the common upper -limit, but e.g. jffs2 stops at 254, minixfs upper limit is somewhere from -14 to 60, depending upon version, etc. You are doing a lookup for -something that is present in upper layer, but happens to be too long for -one of the lower layers. Too bad - ENAMETOOLONG for you..." - -Reported-by: Al Viro -Signed-off-by: Miklos Szeredi -(cherry picked from commit 09e10322b71716adf567d453889ef0871cf226b9) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 5dbc678..110c968 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -376,8 +376,14 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - opaque = false; - this = ovl_lookup_real(lowerpath.dentry, &dentry->d_name); - err = PTR_ERR(this); -- if (IS_ERR(this)) -+ if (IS_ERR(this)) { -+ /* -+ * If it's positive, then treat ENAMETOOLONG as ENOENT. -+ */ -+ if (err == -ENAMETOOLONG && (upperdentry || ctr)) -+ continue; - goto out_put; -+ } - if (!this) - continue; - if (ovl_is_whiteout(this)) { --- -2.7.4 - - -From f3f4d3482d4f4e8edd9ef8a862676004a07c2e43 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:46 +0100 -Subject: [PATCH 50/73] ovl: allow statfs if no upper layer - -Handle "no upper layer" case in statfs. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 4ebc581828d5d0fe189ca06cef8b7a63cb4583d5) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 110c968..cc7a0f3 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -484,7 +484,7 @@ static void ovl_put_super(struct super_block *sb) - * @buf: The struct kstatfs to fill in with stats - * - * Get the filesystem statistics. As writes always target the upper layer -- * filesystem pass the statfs to the same filesystem. -+ * filesystem pass the statfs to the upper filesystem (if it exists) - */ - static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) - { -@@ -493,7 +493,7 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) - struct path path; - int err; - -- ovl_path_upper(root_dentry, &path); -+ ovl_path_real(root_dentry, &path); - - err = vfs_statfs(&path, buf); - if (!err) { --- -2.7.4 - - -From ed3dcf4bb43b6d737b85ba134d25d1483fa12c8e Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:48 +0100 -Subject: [PATCH 51/73] ovl: mount: change order of initialization - -Move allocation of root entry above to where it's needed. - -Move initializations related to upperdir and workdir near each other. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 3b7a9a249a93e68b7bb318de40e64d3b68ba1a6d) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 70 ++++++++++++++++++++++++---------------------------- - 1 file changed, 32 insertions(+), 38 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index cc7a0f3..a177028 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -723,7 +723,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - struct path lowerpath; - struct path upperpath; - struct path workpath; -- struct inode *root_inode; - struct dentry *root_dentry; - struct ovl_entry *oe; - struct ovl_fs *ufs; -@@ -749,54 +748,49 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - goto out_free_config; - } - -- err = -ENOMEM; -- oe = ovl_alloc_entry(1); -- if (oe == NULL) -- goto out_free_config; -- - err = ovl_mount_dir(ufs->config.upperdir, &upperpath); - if (err) -- goto out_free_oe; -+ goto out_free_config; - -- err = ovl_mount_dir(ufs->config.lowerdir, &lowerpath); -+ err = ovl_mount_dir(ufs->config.workdir, &workpath); - if (err) - goto out_put_upperpath; - -- err = ovl_mount_dir(ufs->config.workdir, &workpath); -+ err = ovl_mount_dir(ufs->config.lowerdir, &lowerpath); - if (err) -- goto out_put_lowerpath; -+ goto out_put_workpath; - - err = -EINVAL; - if (!S_ISDIR(upperpath.dentry->d_inode->i_mode) || - !S_ISDIR(lowerpath.dentry->d_inode->i_mode) || - !S_ISDIR(workpath.dentry->d_inode->i_mode)) { - pr_err("overlayfs: upperdir or lowerdir or workdir not a directory\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - - if (upperpath.mnt != workpath.mnt) { - pr_err("overlayfs: workdir and upperdir must reside under the same mount\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - if (!ovl_workdir_ok(workpath.dentry, upperpath.dentry)) { - pr_err("overlayfs: workdir and upperdir must be separate subtrees\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - - if (!ovl_is_allowed_fs_type(upperpath.dentry)) { - pr_err("overlayfs: filesystem of upperdir is not supported\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - - if (!ovl_is_allowed_fs_type(lowerpath.dentry)) { - pr_err("overlayfs: filesystem of lowerdir is not supported\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - - err = vfs_statfs(&lowerpath, &statfs); - if (err) { - pr_err("overlayfs: statfs failed on lowerpath\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - ufs->lower_namelen = statfs.f_namelen; - -@@ -806,19 +800,27 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - err = -EINVAL; - if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { - pr_err("overlayfs: maximum fs stacking depth exceeded\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; - } - - ufs->upper_mnt = clone_private_mount(&upperpath); - err = PTR_ERR(ufs->upper_mnt); - if (IS_ERR(ufs->upper_mnt)) { - pr_err("overlayfs: failed to clone upperpath\n"); -- goto out_put_workpath; -+ goto out_put_lowerpath; -+ } -+ -+ ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); -+ err = PTR_ERR(ufs->workdir); -+ if (IS_ERR(ufs->workdir)) { -+ pr_err("overlayfs: failed to create directory %s/%s\n", -+ ufs->config.workdir, OVL_WORKDIR_NAME); -+ goto out_put_upper_mnt; - } - - ufs->lower_mnt = kcalloc(1, sizeof(struct vfsmount *), GFP_KERNEL); - if (ufs->lower_mnt == NULL) -- goto out_put_upper_mnt; -+ goto out_put_workdir; - - mnt = clone_private_mount(&lowerpath); - err = PTR_ERR(mnt); -@@ -835,14 +837,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - ufs->lower_mnt[0] = mnt; - ufs->numlower = 1; - -- ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); -- err = PTR_ERR(ufs->workdir); -- if (IS_ERR(ufs->workdir)) { -- pr_err("overlayfs: failed to create directory %s/%s\n", -- ufs->config.workdir, OVL_WORKDIR_NAME); -- goto out_put_lower_mnt; -- } -- - /* If the upper fs is r/o, we mark overlayfs r/o too */ - if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY) - sb->s_flags |= MS_RDONLY; -@@ -850,13 +844,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - sb->s_d_op = &ovl_dentry_operations; - - err = -ENOMEM; -- root_inode = ovl_new_inode(sb, S_IFDIR, oe); -- if (!root_inode) -- goto out_put_workdir; -+ oe = ovl_alloc_entry(1); -+ if (!oe) -+ goto out_put_lower_mnt; - -- root_dentry = d_make_root(root_inode); -+ root_dentry = d_make_root(ovl_new_inode(sb, S_IFDIR, oe)); - if (!root_dentry) -- goto out_put_workdir; -+ goto out_free_oe; - - mntput(upperpath.mnt); - mntput(lowerpath.mnt); -@@ -875,22 +869,22 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - - return 0; - --out_put_workdir: -- dput(ufs->workdir); -+out_free_oe: -+ kfree(oe); - out_put_lower_mnt: - for (i = 0; i < ufs->numlower; i++) - mntput(ufs->lower_mnt[i]); - kfree(ufs->lower_mnt); -+out_put_workdir: -+ dput(ufs->workdir); - out_put_upper_mnt: - mntput(ufs->upper_mnt); --out_put_workpath: -- path_put(&workpath); - out_put_lowerpath: - path_put(&lowerpath); -+out_put_workpath: -+ path_put(&workpath); - out_put_upperpath: - path_put(&upperpath); --out_free_oe: -- kfree(oe); - out_free_config: - kfree(ufs->config.lowerdir); - kfree(ufs->config.upperdir); --- -2.7.4 - - -From 4db5f1d8cd9d89c8810c8ed10a4e50d1f0debbd1 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:49 +0100 -Subject: [PATCH 52/73] ovl: improve mount helpers - -Move common checks into ovl_mount_dir() helper. - -Create helper for looking up lower directories. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit ab508822cab4c84f07373cd6ad107a1fd1362831) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 125 ++++++++++++++++++++++++++++++--------------------- - 1 file changed, 73 insertions(+), 52 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index a177028..592370f 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -669,24 +669,6 @@ static void ovl_unescape(char *s) - } - } - --static int ovl_mount_dir(const char *name, struct path *path) --{ -- int err; -- char *tmp = kstrdup(name, GFP_KERNEL); -- -- if (!tmp) -- return -ENOMEM; -- -- ovl_unescape(tmp); -- err = kern_path(tmp, LOOKUP_FOLLOW, path); -- if (err) { -- pr_err("overlayfs: failed to resolve '%s': %i\n", tmp, err); -- err = -EINVAL; -- } -- kfree(tmp); -- return err; --} -- - static bool ovl_is_allowed_fs_type(struct dentry *root) - { - const struct dentry_operations *dop = root->d_op; -@@ -706,6 +688,71 @@ static bool ovl_is_allowed_fs_type(struct dentry *root) - return true; - } - -+static int ovl_mount_dir_noesc(const char *name, struct path *path) -+{ -+ int err; -+ -+ err = kern_path(name, LOOKUP_FOLLOW, path); -+ if (err) { -+ pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); -+ goto out; -+ } -+ err = -EINVAL; -+ if (!ovl_is_allowed_fs_type(path->dentry)) { -+ pr_err("overlayfs: filesystem on '%s' not supported\n", name); -+ goto out_put; -+ } -+ if (!S_ISDIR(path->dentry->d_inode->i_mode)) { -+ pr_err("overlayfs: '%s' not a directory\n", name); -+ goto out_put; -+ } -+ return 0; -+ -+out_put: -+ path_put(path); -+out: -+ return err; -+} -+ -+static int ovl_mount_dir(const char *name, struct path *path) -+{ -+ int err = -ENOMEM; -+ char *tmp = kstrdup(name, GFP_KERNEL); -+ -+ if (tmp) { -+ ovl_unescape(tmp); -+ err = ovl_mount_dir_noesc(tmp, path); -+ kfree(tmp); -+ } -+ return err; -+} -+ -+static int ovl_lower_dir(const char *name, struct path *path, long *namelen, -+ int *stack_depth) -+{ -+ int err; -+ struct kstatfs statfs; -+ -+ err = ovl_mount_dir(name, path); -+ if (err) -+ goto out; -+ -+ err = vfs_statfs(path, &statfs); -+ if (err) { -+ pr_err("overlayfs: statfs failed on '%s'\n", name); -+ goto out_put; -+ } -+ *namelen = max(*namelen, statfs.f_namelen); -+ *stack_depth = max(*stack_depth, path->mnt->mnt_sb->s_stack_depth); -+ -+ return 0; -+ -+out_put: -+ path_put(path); -+out: -+ return err; -+} -+ - /* Workdir should not be subdir of upperdir and vice versa */ - static bool ovl_workdir_ok(struct dentry *workdir, struct dentry *upperdir) - { -@@ -726,7 +773,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - struct dentry *root_dentry; - struct ovl_entry *oe; - struct ovl_fs *ufs; -- struct kstatfs statfs; - struct vfsmount *mnt; - unsigned int i; - int err; -@@ -756,48 +802,23 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - if (err) - goto out_put_upperpath; - -- err = ovl_mount_dir(ufs->config.lowerdir, &lowerpath); -- if (err) -- goto out_put_workpath; -- -- err = -EINVAL; -- if (!S_ISDIR(upperpath.dentry->d_inode->i_mode) || -- !S_ISDIR(lowerpath.dentry->d_inode->i_mode) || -- !S_ISDIR(workpath.dentry->d_inode->i_mode)) { -- pr_err("overlayfs: upperdir or lowerdir or workdir not a directory\n"); -- goto out_put_lowerpath; -- } -- - if (upperpath.mnt != workpath.mnt) { - pr_err("overlayfs: workdir and upperdir must reside under the same mount\n"); -- goto out_put_lowerpath; -+ goto out_put_workpath; - } - if (!ovl_workdir_ok(workpath.dentry, upperpath.dentry)) { - pr_err("overlayfs: workdir and upperdir must be separate subtrees\n"); -- goto out_put_lowerpath; -- } -- -- if (!ovl_is_allowed_fs_type(upperpath.dentry)) { -- pr_err("overlayfs: filesystem of upperdir is not supported\n"); -- goto out_put_lowerpath; -- } -- -- if (!ovl_is_allowed_fs_type(lowerpath.dentry)) { -- pr_err("overlayfs: filesystem of lowerdir is not supported\n"); -- goto out_put_lowerpath; -- } -- -- err = vfs_statfs(&lowerpath, &statfs); -- if (err) { -- pr_err("overlayfs: statfs failed on lowerpath\n"); -- goto out_put_lowerpath; -+ goto out_put_workpath; - } -- ufs->lower_namelen = statfs.f_namelen; -+ sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth; - -- sb->s_stack_depth = max(upperpath.mnt->mnt_sb->s_stack_depth, -- lowerpath.mnt->mnt_sb->s_stack_depth) + 1; -+ err = ovl_lower_dir(ufs->config.lowerdir, &lowerpath, -+ &ufs->lower_namelen, &sb->s_stack_depth); -+ if (err) -+ goto out_put_workpath; - - err = -EINVAL; -+ sb->s_stack_depth++; - if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { - pr_err("overlayfs: maximum fs stacking depth exceeded\n"); - goto out_put_lowerpath; --- -2.7.4 - - -From b153140225155c1de019eefe5aadde93365f7a66 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:51 +0100 -Subject: [PATCH 53/73] ovl: make upperdir optional - -Make "upperdir=" mount option optional. If "upperdir=" is not given, then -the "workdir=" option is also optional (and ignored if given). - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 53a08cb9b8bccfe58f1228c7c27baf34a83da78b) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 83 +++++++++++++++++++++++++++++----------------------- - 1 file changed, 47 insertions(+), 36 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 592370f..35bb0ad 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -516,8 +516,10 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry) - struct ovl_fs *ufs = sb->s_fs_info; - - seq_printf(m, ",lowerdir=%s", ufs->config.lowerdir); -- seq_printf(m, ",upperdir=%s", ufs->config.upperdir); -- seq_printf(m, ",workdir=%s", ufs->config.workdir); -+ if (ufs->config.upperdir) { -+ seq_printf(m, ",upperdir=%s", ufs->config.upperdir); -+ seq_printf(m, ",workdir=%s", ufs->config.workdir); -+ } - return 0; - } - -@@ -768,8 +770,8 @@ static bool ovl_workdir_ok(struct dentry *workdir, struct dentry *upperdir) - static int ovl_fill_super(struct super_block *sb, void *data, int silent) - { - struct path lowerpath; -- struct path upperpath; -- struct path workpath; -+ struct path upperpath = { NULL, NULL }; -+ struct path workpath = { NULL, NULL }; - struct dentry *root_dentry; - struct ovl_entry *oe; - struct ovl_fs *ufs; -@@ -786,31 +788,38 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - if (err) - goto out_free_config; - -- /* FIXME: workdir is not needed for a R/O mount */ - err = -EINVAL; -- if (!ufs->config.upperdir || !ufs->config.lowerdir || -- !ufs->config.workdir) { -- pr_err("overlayfs: missing upperdir or lowerdir or workdir\n"); -+ if (!ufs->config.lowerdir) { -+ pr_err("overlayfs: missing 'lowerdir'\n"); - goto out_free_config; - } - -- err = ovl_mount_dir(ufs->config.upperdir, &upperpath); -- if (err) -- goto out_free_config; -+ sb->s_stack_depth = 0; -+ if (ufs->config.upperdir) { -+ /* FIXME: workdir is not needed for a R/O mount */ -+ if (!ufs->config.workdir) { -+ pr_err("overlayfs: missing 'workdir'\n"); -+ goto out_free_config; -+ } - -- err = ovl_mount_dir(ufs->config.workdir, &workpath); -- if (err) -- goto out_put_upperpath; -+ err = ovl_mount_dir(ufs->config.upperdir, &upperpath); -+ if (err) -+ goto out_free_config; - -- if (upperpath.mnt != workpath.mnt) { -- pr_err("overlayfs: workdir and upperdir must reside under the same mount\n"); -- goto out_put_workpath; -- } -- if (!ovl_workdir_ok(workpath.dentry, upperpath.dentry)) { -- pr_err("overlayfs: workdir and upperdir must be separate subtrees\n"); -- goto out_put_workpath; -+ err = ovl_mount_dir(ufs->config.workdir, &workpath); -+ if (err) -+ goto out_put_upperpath; -+ -+ if (upperpath.mnt != workpath.mnt) { -+ pr_err("overlayfs: workdir and upperdir must reside under the same mount\n"); -+ goto out_put_workpath; -+ } -+ if (!ovl_workdir_ok(workpath.dentry, upperpath.dentry)) { -+ pr_err("overlayfs: workdir and upperdir must be separate subtrees\n"); -+ goto out_put_workpath; -+ } -+ sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth; - } -- sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth; - - err = ovl_lower_dir(ufs->config.lowerdir, &lowerpath, - &ufs->lower_namelen, &sb->s_stack_depth); -@@ -824,19 +833,21 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - goto out_put_lowerpath; - } - -- ufs->upper_mnt = clone_private_mount(&upperpath); -- err = PTR_ERR(ufs->upper_mnt); -- if (IS_ERR(ufs->upper_mnt)) { -- pr_err("overlayfs: failed to clone upperpath\n"); -- goto out_put_lowerpath; -- } -+ if (ufs->config.upperdir) { -+ ufs->upper_mnt = clone_private_mount(&upperpath); -+ err = PTR_ERR(ufs->upper_mnt); -+ if (IS_ERR(ufs->upper_mnt)) { -+ pr_err("overlayfs: failed to clone upperpath\n"); -+ goto out_put_lowerpath; -+ } - -- ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); -- err = PTR_ERR(ufs->workdir); -- if (IS_ERR(ufs->workdir)) { -- pr_err("overlayfs: failed to create directory %s/%s\n", -- ufs->config.workdir, OVL_WORKDIR_NAME); -- goto out_put_upper_mnt; -+ ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); -+ err = PTR_ERR(ufs->workdir); -+ if (IS_ERR(ufs->workdir)) { -+ pr_err("overlayfs: failed to create directory %s/%s\n", -+ ufs->config.workdir, OVL_WORKDIR_NAME); -+ goto out_put_upper_mnt; -+ } - } - - ufs->lower_mnt = kcalloc(1, sizeof(struct vfsmount *), GFP_KERNEL); -@@ -858,8 +869,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - ufs->lower_mnt[0] = mnt; - ufs->numlower = 1; - -- /* If the upper fs is r/o, we mark overlayfs r/o too */ -- if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY) -+ /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */ -+ if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY)) - sb->s_flags |= MS_RDONLY; - - sb->s_d_op = &ovl_dentry_operations; --- -2.7.4 - - -From cb19636311dcb8206f668af9cbb68e9bafaeea14 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:52 +0100 -Subject: [PATCH 54/73] ovl: support multiple lower layers - -Allow "lowerdir=" option to contain multiple lower directories separated by -a colon (e.g. "lowerdir=/bin:/usr/bin"). Colon characters in filenames can -be escaped with a backslash. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit a78d9f0d5d5ca9054703376c7c23c901807ddd87) -Signed-off-by: Alex Shi ---- - Documentation/filesystems/overlayfs.txt | 12 ++++ - fs/overlayfs/super.c | 110 ++++++++++++++++++++++++-------- - 2 files changed, 95 insertions(+), 27 deletions(-) - -diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt -index a27c950..b370928 100644 ---- a/Documentation/filesystems/overlayfs.txt -+++ b/Documentation/filesystems/overlayfs.txt -@@ -159,6 +159,18 @@ overlay filesystem (though an operation on the name of the file such as - rename or unlink will of course be noticed and handled). - - -+Multiple lower layers -+--------------------- -+ -+Multiple lower layers can now be given using the the colon (":") as a -+separator character between the directory names. For example: -+ -+ mount -t overlay overlay -olowerdir=/lower1:/lower2:/lower3 /merged -+ -+As the example shows, "upperdir=" and "workdir=" may be omitted. In that case -+the overlay will be read-only. -+ -+ - Non-standard behavior - --------------------- - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 35bb0ad..5c495a1 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -60,6 +60,8 @@ struct ovl_entry { - struct path lowerstack[]; - }; - -+#define OVL_MAX_STACK 500 -+ - const char *ovl_opaque_xattr = "trusted.overlay.opaque"; - - static struct dentry *__ovl_dentry_lower(struct ovl_entry *oe) -@@ -692,8 +694,12 @@ static bool ovl_is_allowed_fs_type(struct dentry *root) - - static int ovl_mount_dir_noesc(const char *name, struct path *path) - { -- int err; -+ int err = -EINVAL; - -+ if (!*name) { -+ pr_err("overlayfs: empty lowerdir\n"); -+ goto out; -+ } - err = kern_path(name, LOOKUP_FOLLOW, path); - if (err) { - pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); -@@ -735,7 +741,7 @@ static int ovl_lower_dir(const char *name, struct path *path, long *namelen, - int err; - struct kstatfs statfs; - -- err = ovl_mount_dir(name, path); -+ err = ovl_mount_dir_noesc(name, path); - if (err) - goto out; - -@@ -767,15 +773,38 @@ static bool ovl_workdir_ok(struct dentry *workdir, struct dentry *upperdir) - return ok; - } - -+static unsigned int ovl_split_lowerdirs(char *str) -+{ -+ unsigned int ctr = 1; -+ char *s, *d; -+ -+ for (s = d = str;; s++, d++) { -+ if (*s == '\\') { -+ s++; -+ } else if (*s == ':') { -+ *d = '\0'; -+ ctr++; -+ continue; -+ } -+ *d = *s; -+ if (!*s) -+ break; -+ } -+ return ctr; -+} -+ - static int ovl_fill_super(struct super_block *sb, void *data, int silent) - { -- struct path lowerpath; - struct path upperpath = { NULL, NULL }; - struct path workpath = { NULL, NULL }; - struct dentry *root_dentry; - struct ovl_entry *oe; - struct ovl_fs *ufs; -- struct vfsmount *mnt; -+ struct path *stack = NULL; -+ char *lowertmp; -+ char *lower; -+ unsigned int numlower; -+ unsigned int stacklen = 0; - unsigned int i; - int err; - -@@ -820,13 +849,31 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - } - sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth; - } -- -- err = ovl_lower_dir(ufs->config.lowerdir, &lowerpath, -- &ufs->lower_namelen, &sb->s_stack_depth); -- if (err) -+ err = -ENOMEM; -+ lowertmp = kstrdup(ufs->config.lowerdir, GFP_KERNEL); -+ if (!lowertmp) - goto out_put_workpath; - - err = -EINVAL; -+ stacklen = ovl_split_lowerdirs(lowertmp); -+ if (stacklen > OVL_MAX_STACK) -+ goto out_free_lowertmp; -+ -+ stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL); -+ if (!stack) -+ goto out_free_lowertmp; -+ -+ lower = lowertmp; -+ for (numlower = 0; numlower < stacklen; numlower++) { -+ err = ovl_lower_dir(lower, &stack[numlower], -+ &ufs->lower_namelen, &sb->s_stack_depth); -+ if (err) -+ goto out_put_lowerpath; -+ -+ lower = strchr(lower, '\0') + 1; -+ } -+ -+ err = -EINVAL; - sb->s_stack_depth++; - if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { - pr_err("overlayfs: maximum fs stacking depth exceeded\n"); -@@ -850,24 +897,25 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - } - } - -- ufs->lower_mnt = kcalloc(1, sizeof(struct vfsmount *), GFP_KERNEL); -+ ufs->lower_mnt = kcalloc(numlower, sizeof(struct vfsmount *), GFP_KERNEL); - if (ufs->lower_mnt == NULL) - goto out_put_workdir; -+ for (i = 0; i < numlower; i++) { -+ struct vfsmount *mnt = clone_private_mount(&stack[i]); - -- mnt = clone_private_mount(&lowerpath); -- err = PTR_ERR(mnt); -- if (IS_ERR(mnt)) { -- pr_err("overlayfs: failed to clone lowerpath\n"); -- goto out_put_lower_mnt; -- } -- /* -- * Make lower_mnt R/O. That way fchmod/fchown on lower file -- * will fail instead of modifying lower fs. -- */ -- mnt->mnt_flags |= MNT_READONLY; -+ if (IS_ERR(mnt)) { -+ pr_err("overlayfs: failed to clone lowerpath\n"); -+ goto out_put_lower_mnt; -+ } -+ /* -+ * Make lower_mnt R/O. That way fchmod/fchown on lower file -+ * will fail instead of modifying lower fs. -+ */ -+ mnt->mnt_flags |= MNT_READONLY; - -- ufs->lower_mnt[0] = mnt; -- ufs->numlower = 1; -+ ufs->lower_mnt[ufs->numlower] = mnt; -+ ufs->numlower++; -+ } - - /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */ - if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY)) -@@ -876,7 +924,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - sb->s_d_op = &ovl_dentry_operations; - - err = -ENOMEM; -- oe = ovl_alloc_entry(1); -+ oe = ovl_alloc_entry(numlower); - if (!oe) - goto out_put_lower_mnt; - -@@ -885,12 +933,16 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - goto out_free_oe; - - mntput(upperpath.mnt); -- mntput(lowerpath.mnt); -+ for (i = 0; i < numlower; i++) -+ mntput(stack[i].mnt); - path_put(&workpath); -+ kfree(lowertmp); - - oe->__upperdentry = upperpath.dentry; -- oe->lowerstack[0].dentry = lowerpath.dentry; -- oe->lowerstack[0].mnt = ufs->lower_mnt[0]; -+ for (i = 0; i < numlower; i++) { -+ oe->lowerstack[i].dentry = stack[i].dentry; -+ oe->lowerstack[i].mnt = ufs->lower_mnt[i]; -+ } - - root_dentry->d_fsdata = oe; - -@@ -912,7 +964,11 @@ out_put_workdir: - out_put_upper_mnt: - mntput(ufs->upper_mnt); - out_put_lowerpath: -- path_put(&lowerpath); -+ for (i = 0; i < numlower; i++) -+ path_put(&stack[i]); -+ kfree(stack); -+out_free_lowertmp: -+ kfree(lowertmp); - out_put_workpath: - path_put(&workpath); - out_put_upperpath: --- -2.7.4 - - -From 96149453dee0b67c9ecb1032c0ed0e4aa31fb914 Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Wed, 26 Nov 2014 16:16:59 +0800 -Subject: [PATCH 55/73] ovl: Cleanup redundant blank lines - -This patch removes redundant blanks lines in overlayfs. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit 1ba38725a351f91769918b132c17fb7fcaf6c2f5) -Signed-off-by: Alex Shi ---- - fs/overlayfs/copy_up.c | 1 - - fs/overlayfs/inode.c | 1 - - fs/overlayfs/super.c | 1 - - 3 files changed, 3 deletions(-) - -diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c -index a5bfd60..24f6404 100644 ---- a/fs/overlayfs/copy_up.c -+++ b/fs/overlayfs/copy_up.c -@@ -191,7 +191,6 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat) - ovl_set_timestamps(upperdentry, stat); - - return err; -- - } - - static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, -diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c -index 48492f1..5ac1236 100644 ---- a/fs/overlayfs/inode.c -+++ b/fs/overlayfs/inode.c -@@ -433,5 +433,4 @@ struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, - } - - return inode; -- - } -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 5c495a1..e9ce4a9 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -106,7 +106,6 @@ void ovl_path_upper(struct dentry *dentry, struct path *path) - - enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path) - { -- - enum ovl_path_type type = ovl_path_type(dentry); - - if (!OVL_TYPE_UPPER(type)) --- -2.7.4 - - -From 4fb1e9e207167f999c57954716a51942d0d61674 Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Mon, 24 Nov 2014 18:25:21 +0800 -Subject: [PATCH 56/73] ovl: Use macros to present ovl_xattr - -This patch adds two macros: - -OVL_XATTR_PRE_NAME and OVL_XATTR_PRE_LEN - -to present ovl_xattr name prefix and its length. Also, a -new macro OVL_XATTR_OPAQUE is introduced to replace old -*ovl_opaque_xattr*. - -Fix the length of "trusted.overlay." to *16*. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit cead89bb08c0f64e23886f1c18df9bb98e97c55c) -Signed-off-by: Alex Shi ---- - fs/overlayfs/dir.c | 4 ++-- - fs/overlayfs/inode.c | 2 +- - fs/overlayfs/overlayfs.h | 4 +++- - fs/overlayfs/super.c | 4 +--- - 4 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -index dcae3ac..0dc4c33 100644 ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -118,14 +118,14 @@ int ovl_create_real(struct inode *dir, struct dentry *newdentry, - - static int ovl_set_opaque(struct dentry *upperdentry) - { -- return ovl_do_setxattr(upperdentry, ovl_opaque_xattr, "y", 1, 0); -+ return ovl_do_setxattr(upperdentry, OVL_XATTR_OPAQUE, "y", 1, 0); - } - - static void ovl_remove_opaque(struct dentry *upperdentry) - { - int err; - -- err = ovl_do_removexattr(upperdentry, ovl_opaque_xattr); -+ err = ovl_do_removexattr(upperdentry, OVL_XATTR_OPAQUE); - if (err) { - pr_warn("overlayfs: failed to remove opaque from '%s' (%i)\n", - upperdentry->d_name.name, err); -diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c -index 5ac1236..04f1248 100644 ---- a/fs/overlayfs/inode.c -+++ b/fs/overlayfs/inode.c -@@ -205,7 +205,7 @@ static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) - - static bool ovl_is_private_xattr(const char *name) - { -- return strncmp(name, "trusted.overlay.", 14) == 0; -+ return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0; - } - - int ovl_setxattr(struct dentry *dentry, const char *name, -diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h -index d176b67..17ac5af 100644 ---- a/fs/overlayfs/overlayfs.h -+++ b/fs/overlayfs/overlayfs.h -@@ -23,7 +23,9 @@ enum ovl_path_type { - #define OVL_TYPE_MERGE_OR_LOWER(type) \ - (OVL_TYPE_MERGE(type) || !OVL_TYPE_UPPER(type)) - --extern const char *ovl_opaque_xattr; -+#define OVL_XATTR_PRE_NAME "trusted.overlay." -+#define OVL_XATTR_PRE_LEN 16 -+#define OVL_XATTR_OPAQUE OVL_XATTR_PRE_NAME"opaque" - - static inline int ovl_do_rmdir(struct inode *dir, struct dentry *dentry) - { -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index e9ce4a9..84f3144 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -62,8 +62,6 @@ struct ovl_entry { - - #define OVL_MAX_STACK 500 - --const char *ovl_opaque_xattr = "trusted.overlay.opaque"; -- - static struct dentry *__ovl_dentry_lower(struct ovl_entry *oe) - { - return oe->numlower ? oe->lowerstack[0].dentry : NULL; -@@ -254,7 +252,7 @@ static bool ovl_is_opaquedir(struct dentry *dentry) - if (!S_ISDIR(inode->i_mode) || !inode->i_op->getxattr) - return false; - -- res = inode->i_op->getxattr(dentry, ovl_opaque_xattr, &val, 1); -+ res = inode->i_op->getxattr(dentry, OVL_XATTR_OPAQUE, &val, 1); - if (res == 1 && val == 'y') - return true; - --- -2.7.4 - - -From 248653d3bb85e5b87899b47e56dc0cf86ee24f89 Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Tue, 6 Jan 2015 12:52:13 +0800 -Subject: [PATCH 57/73] ovl: Fix kernel panic while mounting overlayfs - -The function ovl_fill_super() in recently multi-layer support -version will incorrectly return 0 at error handling path and -then cause kernel panic. - -This failure can be reproduced by mounting a overlayfs with -upperdir and workdir in different mounts. - -And also, If the memory allocation of *lower_mnt* fail, this -function may return an zero either. - -This patch fix this problem by setting *err* to proper error -number before jumping to error handling path. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit 2f83fd8c2849a388082f30d755a75c1e67c4643b) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 84f3144..6ca8ea8 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -836,6 +836,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - if (err) - goto out_put_upperpath; - -+ err = -EINVAL; - if (upperpath.mnt != workpath.mnt) { - pr_err("overlayfs: workdir and upperdir must reside under the same mount\n"); - goto out_put_workpath; -@@ -894,12 +895,14 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - } - } - -+ err = -ENOMEM; - ufs->lower_mnt = kcalloc(numlower, sizeof(struct vfsmount *), GFP_KERNEL); - if (ufs->lower_mnt == NULL) - goto out_put_workdir; - for (i = 0; i < numlower; i++) { - struct vfsmount *mnt = clone_private_mount(&stack[i]); - -+ err = PTR_ERR(mnt); - if (IS_ERR(mnt)) { - pr_err("overlayfs: failed to clone lowerpath\n"); - goto out_put_lower_mnt; --- -2.7.4 - - -From ef2578e619a9107cb007644f38701d6774a46c5f Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Tue, 6 Jan 2015 16:10:01 +0800 -Subject: [PATCH 58/73] ovl: Fix opaque regression in ovl_lookup - -Current multi-layer support overlayfs has a regression in -.lookup(). If there is a directory in upperdir and a regular -file has same name in lowerdir in a merged directory, lower -file is hidden and upper directory is set to opaque in former -case. But it is changed in present code. - -In lowerdir lookup path, if a found inode is not directory, -the type checking of previous inode is missing. This inode -will be copied to the lowerstack of ovl_entry directly. - -That will lead to several wrong conditions, for example, -the reading of the directory in upperdir may return an error -like: - - ls: reading directory .: Not a directory - -This patch makes the lowerdir lookup path check the opaque -for non-directory file too. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit a425c037f3dd8a56469158ab5f37beb46402d958) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 23 +++++++++++++---------- - 1 file changed, 13 insertions(+), 10 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 6ca8ea8..9e94f4a 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -372,7 +372,6 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - bool opaque = false; - struct path lowerpath = poe->lowerstack[i]; - -- opaque = false; - this = ovl_lookup_real(lowerpath.dentry, &dentry->d_name); - err = PTR_ERR(this); - if (IS_ERR(this)) { -@@ -395,20 +394,24 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - */ - if (i < poe->numlower - 1 && ovl_is_opaquedir(this)) - opaque = true; -- /* -- * If this is a non-directory then stop here. -- * -- * FIXME: check for opaqueness maybe better done in remove code. -- */ -- if (!S_ISDIR(this->d_inode->i_mode)) { -- opaque = true; -- } else if (prev && (!S_ISDIR(prev->d_inode->i_mode) || -- !S_ISDIR(this->d_inode->i_mode))) { -+ -+ if (prev && (!S_ISDIR(prev->d_inode->i_mode) || -+ !S_ISDIR(this->d_inode->i_mode))) { -+ /* -+ * FIXME: check for upper-opaqueness maybe better done -+ * in remove code. -+ */ - if (prev == upperdentry) - upperopaque = true; - dput(this); - break; - } -+ /* -+ * If this is a non-directory then stop here. -+ */ -+ if (!S_ISDIR(this->d_inode->i_mode)) -+ opaque = true; -+ - stack[ctr].dentry = this; - stack[ctr].mnt = lowerpath.mnt; - ctr++; --- -2.7.4 - - -From 1676d3ec23db0db95de768672df3355c92589a0e Mon Sep 17 00:00:00 2001 -From: Seunghun Lee -Date: Sat, 3 Jan 2015 02:26:49 +0900 -Subject: [PATCH 59/73] ovl: Prevent rw remount when it should be ro mount - -Overlayfs should be mounted read-only when upper-fs is read-only or nonexistent. -But now it can be remounted read-write and this can cause kernel panic. -So we should prevent read-write remount when the above situation happens. - -Signed-off-by: Seunghun Lee -Signed-off-by: Miklos Szeredi -(cherry picked from commit 3cdf6fe91041b3afd6761f76254f7b6cbe8020fc) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 9e94f4a..b90952f 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -525,10 +525,22 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry) - return 0; - } - -+static int ovl_remount(struct super_block *sb, int *flags, char *data) -+{ -+ struct ovl_fs *ufs = sb->s_fs_info; -+ -+ if (!(*flags & MS_RDONLY) && -+ (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))) -+ return -EROFS; -+ -+ return 0; -+} -+ - static const struct super_operations ovl_super_operations = { - .put_super = ovl_put_super, - .statfs = ovl_statfs, - .show_options = ovl_show_options, -+ .remount_fs = ovl_remount, - }; - - enum { --- -2.7.4 - - -From add5fbd4b119cd897c130cc2282c4040dc004b88 Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Thu, 11 Dec 2014 10:30:18 +0800 -Subject: [PATCH 60/73] ovl: discard independent cursor in readdir() - -Since the ovl_dir_cache is stable during a directory reading, the cursor -of struct ovl_dir_file don't need to be an independent entry in the list -of a merged directory. - -This patch changes *cursor* to a pointer which points to the entry in the -ovl_dir_cache. After this, we don't need to check *is_cursor* either. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit 4330397e4e8a662f36d101659e2a59ce32e76ff4) -Signed-off-by: Alex Shi ---- - fs/overlayfs/readdir.c | 38 ++++++++++++++------------------------ - 1 file changed, 14 insertions(+), 24 deletions(-) - -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -index 2b8315b..907870e 100644 ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -24,7 +24,6 @@ struct ovl_cache_entry { - struct list_head l_node; - struct rb_node node; - bool is_whiteout; -- bool is_cursor; - char name[]; - }; - -@@ -49,7 +48,7 @@ struct ovl_dir_file { - bool is_real; - bool is_upper; - struct ovl_dir_cache *cache; -- struct ovl_cache_entry cursor; -+ struct list_head *cursor; - struct file *realfile; - struct file *upperfile; - }; -@@ -97,7 +96,6 @@ static struct ovl_cache_entry *ovl_cache_entry_new(struct dentry *dir, - p->type = d_type; - p->ino = ino; - p->is_whiteout = false; -- p->is_cursor = false; - - if (d_type == DT_CHR) { - struct dentry *dentry; -@@ -196,7 +194,6 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry) - { - struct ovl_dir_cache *cache = od->cache; - -- list_del_init(&od->cursor.l_node); - WARN_ON(cache->refcount <= 0); - cache->refcount--; - if (!cache->refcount) { -@@ -256,6 +253,7 @@ static void ovl_dir_reset(struct file *file) - if (cache && ovl_dentry_version_get(dentry) != cache->version) { - ovl_cache_put(od, dentry); - od->cache = NULL; -+ od->cursor = NULL; - } - WARN_ON(!od->is_real && !OVL_TYPE_MERGE(type)); - if (od->is_real && OVL_TYPE_MERGE(type)) -@@ -297,17 +295,16 @@ static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) - - static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) - { -- struct ovl_cache_entry *p; -+ struct list_head *p; - loff_t off = 0; - -- list_for_each_entry(p, &od->cache->entries, l_node) { -- if (p->is_cursor) -- continue; -+ list_for_each(p, &od->cache->entries) { - if (off >= pos) - break; - off++; - } -- list_move_tail(&od->cursor.l_node, &p->l_node); -+ /* Cursor is safe since the cache is stable */ -+ od->cursor = p; - } - - static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) -@@ -346,6 +343,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx) - { - struct ovl_dir_file *od = file->private_data; - struct dentry *dentry = file->f_path.dentry; -+ struct ovl_cache_entry *p; - - if (!ctx->pos) - ovl_dir_reset(file); -@@ -364,19 +362,13 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx) - ovl_seek_cursor(od, ctx->pos); - } - -- while (od->cursor.l_node.next != &od->cache->entries) { -- struct ovl_cache_entry *p; -- -- p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); -- /* Skip cursors */ -- if (!p->is_cursor) { -- if (!p->is_whiteout) { -- if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) -- break; -- } -- ctx->pos++; -- } -- list_move(&od->cursor.l_node, &p->l_node); -+ while (od->cursor != &od->cache->entries) { -+ p = list_entry(od->cursor, struct ovl_cache_entry, l_node); -+ if (!p->is_whiteout) -+ if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) -+ break; -+ od->cursor = p->l_node.next; -+ ctx->pos++; - } - return 0; - } -@@ -495,11 +487,9 @@ static int ovl_dir_open(struct inode *inode, struct file *file) - kfree(od); - return PTR_ERR(realfile); - } -- INIT_LIST_HEAD(&od->cursor.l_node); - od->realfile = realfile; - od->is_real = !OVL_TYPE_MERGE(type); - od->is_upper = OVL_TYPE_UPPER(type); -- od->cursor.is_cursor = true; - file->private_data = od; - - return 0; --- -2.7.4 - - -From 088805e56746eafd55a13e2dc7fb37d046cfdfdb Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Thu, 15 Jan 2015 13:17:36 +0800 -Subject: [PATCH 61/73] ovl: print error message for invalid mount options - -Overlayfs should print an error message if an incorrect mount option -is caught like other filesystems. - -After this patch, improper option input could be clearly known. - -Reported-by: Fabian Sturm -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit bead55ef775f6e25a8d286c0d47030580f577bec) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index b90952f..ab3c8cb 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -615,6 +615,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - break; - - default: -+ pr_err("overlayfs: unrecognized mount option \"%s\" or missing value\n", p); - return -EINVAL; - } - } --- -2.7.4 - - -From 0d8e803097108c61b26175178e62465a7d36c889 Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Thu, 15 Jan 2015 13:19:21 +0800 -Subject: [PATCH 62/73] ovl: check lowerdir amount for non-upper mount - -Recently multi-lower layer mount support allow upperdir and workdir -to be omitted, then cause overlayfs can be mount with only one -lowerdir directory. This action make no sense and have potential risk. - -This patch check the total number of lower directories to prevent -mounting overlayfs with only one directory. - -Also, an error message is added to indicate lower directories exceed -OVL_MAX_STACK limit. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit 6be4506e34cf6075a1307b646e0a6c46c1c9010d) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index ab3c8cb..edbb3eb 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -870,8 +870,14 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - - err = -EINVAL; - stacklen = ovl_split_lowerdirs(lowertmp); -- if (stacklen > OVL_MAX_STACK) -+ if (stacklen > OVL_MAX_STACK) { -+ pr_err("overlayfs: too many lower directries, limit is %d\n", -+ OVL_MAX_STACK); - goto out_free_lowertmp; -+ } else if (!ufs->config.upperdir && stacklen == 1) { -+ pr_err("overlayfs: at least 2 lowerdir are needed while upperdir nonexistent\n"); -+ goto out_free_lowertmp; -+ } - - stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL); - if (!stack) --- -2.7.4 - - -From d7170c004481f9fbe303a391774e0fcb238f0e78 Mon Sep 17 00:00:00 2001 -From: hujianyang -Date: Thu, 15 Jan 2015 13:20:57 +0800 -Subject: [PATCH 63/73] ovl: upper fs should not be R/O - -After importing multi-lower layer support, users could mount a r/o -partition as the left most lowerdir instead of using it as upperdir. -And a r/o upperdir may cause an error like - - overlayfs: failed to create directory ./workdir/work - -during mount. - -This patch check the *s_flags* of upper fs and return an error if -it is a r/o partition. The checking of *upper_mnt->mnt_sb->s_flags* -can be removed now. - -This patch also remove - - /* FIXME: workdir is not needed for a R/O mount */ - -from ovl_fill_super() because: - -1) for upper fs r/o case -Setting a r/o partition as upper is prevented, no need to care about -workdir in this case. - -2) for "mount overlay -o ro" with a r/w upper fs case -Users could remount overlayfs to r/w in this case, so workdir should -not be omitted. - -Signed-off-by: hujianyang -Signed-off-by: Miklos Szeredi -(cherry picked from commit 71cbad7e694ee81233b3be3a38b81c3d5872cc6f) -Signed-off-by: Alex Shi ---- - fs/overlayfs/super.c | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index edbb3eb..5f0d199 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -529,8 +529,7 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data) - { - struct ovl_fs *ufs = sb->s_fs_info; - -- if (!(*flags & MS_RDONLY) && -- (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))) -+ if (!(*flags & MS_RDONLY) && !ufs->upper_mnt) - return -EROFS; - - return 0; -@@ -619,6 +618,15 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - return -EINVAL; - } - } -+ -+ /* Workdir is useless in non-upper mount */ -+ if (!config->upperdir && config->workdir) { -+ pr_info("overlayfs: option \"workdir=%s\" is useless in a non-upper mount, ignore\n", -+ config->workdir); -+ kfree(config->workdir); -+ config->workdir = NULL; -+ } -+ - return 0; - } - -@@ -838,7 +846,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - - sb->s_stack_depth = 0; - if (ufs->config.upperdir) { -- /* FIXME: workdir is not needed for a R/O mount */ - if (!ufs->config.workdir) { - pr_err("overlayfs: missing 'workdir'\n"); - goto out_free_config; -@@ -848,6 +855,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - if (err) - goto out_free_config; - -+ /* Upper fs should not be r/o */ -+ if (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY) { -+ pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); -+ err = -EINVAL; -+ goto out_put_upperpath; -+ } -+ - err = ovl_mount_dir(ufs->config.workdir, &workpath); - if (err) - goto out_put_upperpath; -@@ -939,8 +953,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) - ufs->numlower++; - } - -- /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */ -- if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY)) -+ /* If the upper fs is nonexistent, we mark overlayfs r/o too */ -+ if (!ufs->upper_mnt) - sb->s_flags |= MS_RDONLY; - - sb->s_d_op = &ovl_dentry_operations; --- -2.7.4 - - -From 59b077027a431f849a07bd330f0de14c31376743 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Sat, 13 Dec 2014 00:59:53 +0100 -Subject: [PATCH 64/73] ovl: add testsuite to docs - -Reported-by: Sedat Dilek -Signed-off-by: Miklos Szeredi -(cherry picked from commit 2b7a8f36f092a7855f6438cd42d6990394f450fa) -Signed-off-by: Alex Shi ---- - Documentation/filesystems/overlayfs.txt | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt -index b370928..006ea48 100644 ---- a/Documentation/filesystems/overlayfs.txt -+++ b/Documentation/filesystems/overlayfs.txt -@@ -208,3 +208,15 @@ Changes to the underlying filesystems while part of a mounted overlay - filesystem are not allowed. If the underlying filesystem is changed, - the behavior of the overlay is undefined, though it will not result in - a crash or deadlock. -+ -+Testsuite -+--------- -+ -+There's testsuite developed by David Howells at: -+ -+ git://git.infradead.org/users/dhowells/unionmount-testsuite.git -+ -+Run as root: -+ -+ # cd unionmount-testsuite -+ # ./run --ov --- -2.7.4 - - -From 6fb17a412207343151aac1fde91935a542339deb Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 8 Jan 2015 15:09:15 +0100 -Subject: [PATCH 65/73] ovl: document lower layer ordering - -Reported-by: Fabian Sturm -Signed-off-by: Miklos Szeredi -(cherry picked from commit 6d900f5a33393067e370736d39798f814f5e25cc) -Signed-off-by: Alex Shi ---- - Documentation/filesystems/overlayfs.txt | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt -index 006ea48..6db0e5d 100644 ---- a/Documentation/filesystems/overlayfs.txt -+++ b/Documentation/filesystems/overlayfs.txt -@@ -167,8 +167,12 @@ separator character between the directory names. For example: - - mount -t overlay overlay -olowerdir=/lower1:/lower2:/lower3 /merged - --As the example shows, "upperdir=" and "workdir=" may be omitted. In that case --the overlay will be read-only. -+As the example shows, "upperdir=" and "workdir=" may be omitted. In -+that case the overlay will be read-only. -+ -+The specified lower directories will be stacked beginning from the -+rightmost one and going left. In the above example lower1 will be the -+top, lower2 the middle and lower3 the bottom layer. - - - Non-standard behavior --- -2.7.4 - - -From 77dfdd746390b9230ac5420f13dd363bcdac6e98 Mon Sep 17 00:00:00 2001 -From: Pavel Emelyanov -Date: Thu, 10 Oct 2013 17:10:30 +0400 -Subject: [PATCH 66/73] fuse: Connection bit for enabling writeback - -Off (0) by default. Will be used in the next patches and will be turned -on at the very end. - -Signed-off-by: Maxim Patlasov -Signed-off-by: Pavel Emelyanov -Signed-off-by: Miklos Szeredi -(cherry picked from commit d5cd66c58edf10a7ee786659994595fd43995aab) -Signed-off-by: Alex Shi ---- - fs/fuse/fuse_i.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h -index 2da5db2..374a8be 100644 ---- a/fs/fuse/fuse_i.h -+++ b/fs/fuse/fuse_i.h -@@ -480,6 +480,9 @@ struct fuse_conn { - /** Set if bdi is valid */ - unsigned bdi_initialized:1; - -+ /** write-back cache policy (default is write-through) */ -+ unsigned writeback_cache:1; -+ - /* - * The following bitfields are only for optimization purposes - * and hence races in setting them will not cause malfunction --- -2.7.4 - - -From 4a40d2a3f50fd5721e3c8896e077d3f62f5b73be Mon Sep 17 00:00:00 2001 -From: Pavel Emelyanov -Date: Thu, 10 Oct 2013 17:10:04 +0400 -Subject: [PATCH 67/73] fuse: Linking file to inode helper - -When writeback is ON every writeable file should be in per-inode write list, -not only mmap-ed ones. Thus introduce a helper for this linkage. - -Signed-off-by: Maxim Patlasov -Signed-off-by: Pavel Emelyanov -Signed-off-by: Miklos Szeredi -(cherry picked from commit 650b22b941fa03590c4a3671e79ec2c96ea59e9a) -Signed-off-by: Alex Shi ---- - fs/fuse/file.c | 33 +++++++++++++++++++-------------- - 1 file changed, 19 insertions(+), 14 deletions(-) - -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index d8a6027..f018386 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -188,6 +188,22 @@ int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, - } - EXPORT_SYMBOL_GPL(fuse_do_open); - -+static void fuse_link_write_file(struct file *file) -+{ -+ struct inode *inode = file_inode(file); -+ struct fuse_conn *fc = get_fuse_conn(inode); -+ struct fuse_inode *fi = get_fuse_inode(inode); -+ struct fuse_file *ff = file->private_data; -+ /* -+ * file may be written through mmap, so chain it onto the -+ * inodes's write_file list -+ */ -+ spin_lock(&fc->lock); -+ if (list_empty(&ff->write_entry)) -+ list_add(&ff->write_entry, &fi->write_files); -+ spin_unlock(&fc->lock); -+} -+ - void fuse_finish_open(struct inode *inode, struct file *file) - { - struct fuse_file *ff = file->private_data; -@@ -1942,20 +1958,9 @@ static const struct vm_operations_struct fuse_file_vm_ops = { - - static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma) - { -- if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) { -- struct inode *inode = file_inode(file); -- struct fuse_conn *fc = get_fuse_conn(inode); -- struct fuse_inode *fi = get_fuse_inode(inode); -- struct fuse_file *ff = file->private_data; -- /* -- * file may be written through mmap, so chain it onto the -- * inodes's write_file list -- */ -- spin_lock(&fc->lock); -- if (list_empty(&ff->write_entry)) -- list_add(&ff->write_entry, &fi->write_files); -- spin_unlock(&fc->lock); -- } -+ if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) -+ fuse_link_write_file(file); -+ - file_accessed(file); - vma->vm_ops = &fuse_file_vm_ops; - return 0; --- -2.7.4 - - -From fb2667e92663bb09a3d7e79de4103b7ce296b589 Mon Sep 17 00:00:00 2001 -From: Pavel Emelyanov -Date: Thu, 10 Oct 2013 17:10:16 +0400 -Subject: [PATCH 68/73] fuse: Prepare to handle short reads - -A helper which gets called when read reports less bytes than was requested. -See patch "trust kernel i_size only" for details. - -Signed-off-by: Maxim Patlasov -Signed-off-by: Pavel Emelyanov -Signed-off-by: Miklos Szeredi -(cherry picked from commit a92adc824ed5feaa2d4f7029f21170f574987aee) -Signed-off-by: Alex Shi ---- - fs/fuse/file.c | 21 +++++++++++++-------- - 1 file changed, 13 insertions(+), 8 deletions(-) - -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index f018386..4646157 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -671,6 +671,15 @@ static void fuse_read_update_size(struct inode *inode, loff_t size, - spin_unlock(&fc->lock); - } - -+static void fuse_short_read(struct fuse_req *req, struct inode *inode, -+ u64 attr_ver) -+{ -+ size_t num_read = req->out.args[0].size; -+ -+ loff_t pos = page_offset(req->pages[0]) + num_read; -+ fuse_read_update_size(inode, pos, attr_ver); -+} -+ - static int fuse_readpage(struct file *file, struct page *page) - { - struct fuse_io_priv io = { .async = 0, .file = file }; -@@ -708,18 +717,18 @@ static int fuse_readpage(struct file *file, struct page *page) - req->page_descs[0].length = count; - num_read = fuse_send_read(req, &io, pos, count, NULL); - err = req->out.h.error; -- fuse_put_request(fc, req); - - if (!err) { - /* - * Short read means EOF. If file size is larger, truncate it - */ - if (num_read < count) -- fuse_read_update_size(inode, pos + num_read, attr_ver); -+ fuse_short_read(req, inode, attr_ver); - - SetPageUptodate(page); - } - -+ fuse_put_request(fc, req); - fuse_invalidate_atime(inode); - out: - unlock_page(page); -@@ -742,13 +751,9 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req) - /* - * Short read means EOF. If file size is larger, truncate it - */ -- if (!req->out.h.error && num_read < count) { -- loff_t pos; -+ if (!req->out.h.error && num_read < count) -+ fuse_short_read(req, inode, req->misc.read.attr_ver); - -- pos = page_offset(req->pages[0]) + num_read; -- fuse_read_update_size(inode, pos, -- req->misc.read.attr_ver); -- } - fuse_invalidate_atime(inode); - } - --- -2.7.4 - - -From 628bfe8bf63df0e83632598115cb91c7c52a115a Mon Sep 17 00:00:00 2001 -From: Pavel Emelyanov -Date: Thu, 10 Oct 2013 17:10:46 +0400 -Subject: [PATCH 69/73] fuse: Trust kernel i_size only - -Make fuse think that when writeback is on the inode's i_size is always -up-to-date and not update it with the value received from the userspace. -This is done because the page cache code may update i_size without letting -the FS know. - -This assumption implies fixing the previously introduced short-read helper -- -when a short read occurs the 'hole' is filled with zeroes. - -fuse_file_fallocate() is also fixed because now we should keep i_size up to -date, so it must be updated if FUSE_FALLOCATE request succeeded. - -Signed-off-by: Maxim V. Patlasov -Signed-off-by: Miklos Szeredi -(cherry picked from commit 8373200b124d03de7fa2e99be56de8642e604e9e) -Signed-off-by: Alex Shi ---- - fs/fuse/dir.c | 13 +++++++++++-- - fs/fuse/file.c | 21 +++++++++++++++++++-- - fs/fuse/inode.c | 11 +++++++++-- - 3 files changed, 39 insertions(+), 6 deletions(-) - -diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c -index d53a7d9..6fc8339 100644 ---- a/fs/fuse/dir.c -+++ b/fs/fuse/dir.c -@@ -870,6 +870,11 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr, - struct kstat *stat) - { - unsigned int blkbits; -+ struct fuse_conn *fc = get_fuse_conn(inode); -+ -+ /* see the comment in fuse_change_attributes() */ -+ if (fc->writeback_cache && S_ISREG(inode->i_mode)) -+ attr->size = i_size_read(inode); - - stat->dev = inode->i_sb->s_dev; - stat->ino = attr->ino; -@@ -1611,6 +1616,7 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - struct fuse_setattr_in inarg; - struct fuse_attr_out outarg; - bool is_truncate = false; -+ bool is_wb = fc->writeback_cache; - loff_t oldsize; - int err; - -@@ -1682,7 +1688,9 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - fuse_change_attributes_common(inode, &outarg.attr, - attr_timeout(&outarg)); - oldsize = inode->i_size; -- i_size_write(inode, outarg.attr.size); -+ /* see the comment in fuse_change_attributes() */ -+ if (!is_wb || is_truncate || !S_ISREG(inode->i_mode)) -+ i_size_write(inode, outarg.attr.size); - - if (is_truncate) { - /* NOTE: this may release/reacquire fc->lock */ -@@ -1694,7 +1702,8 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - * Only call invalidate_inode_pages2() after removing - * FUSE_NOWRITE, otherwise fuse_launder_page() would deadlock. - */ -- if (S_ISREG(inode->i_mode) && oldsize != outarg.attr.size) { -+ if ((is_truncate || !is_wb) && -+ S_ISREG(inode->i_mode) && oldsize != outarg.attr.size) { - truncate_pagecache(inode, outarg.attr.size); - invalidate_inode_pages2(inode->i_mapping); - } -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 4646157..5b863c0 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -675,9 +675,26 @@ static void fuse_short_read(struct fuse_req *req, struct inode *inode, - u64 attr_ver) - { - size_t num_read = req->out.args[0].size; -+ struct fuse_conn *fc = get_fuse_conn(inode); -+ -+ if (fc->writeback_cache) { -+ /* -+ * A hole in a file. Some data after the hole are in page cache, -+ * but have not reached the client fs yet. So, the hole is not -+ * present there. -+ */ -+ int i; -+ int start_idx = num_read >> PAGE_CACHE_SHIFT; -+ size_t off = num_read & (PAGE_CACHE_SIZE - 1); - -- loff_t pos = page_offset(req->pages[0]) + num_read; -- fuse_read_update_size(inode, pos, attr_ver); -+ for (i = start_idx; i < req->num_pages; i++) { -+ zero_user_segment(req->pages[i], off, PAGE_CACHE_SIZE); -+ off = 0; -+ } -+ } else { -+ loff_t pos = page_offset(req->pages[0]) + num_read; -+ fuse_read_update_size(inode, pos, attr_ver); -+ } - } - - static int fuse_readpage(struct file *file, struct page *page) -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 73f6bcb..22a78a6 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -197,6 +197,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, - { - struct fuse_conn *fc = get_fuse_conn(inode); - struct fuse_inode *fi = get_fuse_inode(inode); -+ bool is_wb = fc->writeback_cache; - loff_t oldsize; - struct timespec old_mtime; - -@@ -211,10 +212,16 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, - fuse_change_attributes_common(inode, attr, attr_valid); - - oldsize = inode->i_size; -- i_size_write(inode, attr->size); -+ /* -+ * In case of writeback_cache enabled, the cached writes beyond EOF -+ * extend local i_size without keeping userspace server in sync. So, -+ * attr->size coming from server can be stale. We cannot trust it. -+ */ -+ if (!is_wb || !S_ISREG(inode->i_mode)) -+ i_size_write(inode, attr->size); - spin_unlock(&fc->lock); - -- if (S_ISREG(inode->i_mode)) { -+ if (!is_wb && S_ISREG(inode->i_mode)) { - bool inval = false; - - if (oldsize != attr->size) { --- -2.7.4 - - -From 9d48c62fbcbc8ce7c9cad37119d12fe0be61300c Mon Sep 17 00:00:00 2001 -From: Maxim Patlasov -Date: Thu, 26 Dec 2013 19:51:11 +0400 -Subject: [PATCH 70/73] fuse: Trust kernel i_mtime only - -Let the kernel maintain i_mtime locally: - - clear S_NOCMTIME - - implement i_op->update_time() - - flush mtime on fsync and last close - - update i_mtime explicitly on truncate and fallocate - -Fuse inode flag FUSE_I_MTIME_DIRTY serves as indication that local i_mtime -should be flushed to the server eventually. - -Signed-off-by: Maxim Patlasov -Signed-off-by: Miklos Szeredi -(cherry picked from commit b0aa760652179072119582375f8dc896ed5b5dfd) -Signed-off-by: Alex Shi ---- - fs/fuse/dir.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++--------- - fs/fuse/file.c | 30 +++++++++++++--- - fs/fuse/fuse_i.h | 6 +++- - fs/fuse/inode.c | 13 +++++-- - 4 files changed, 132 insertions(+), 25 deletions(-) - -diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c -index 6fc8339..b4adb3d9 100644 ---- a/fs/fuse/dir.c -+++ b/fs/fuse/dir.c -@@ -873,8 +873,11 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr, - struct fuse_conn *fc = get_fuse_conn(inode); - - /* see the comment in fuse_change_attributes() */ -- if (fc->writeback_cache && S_ISREG(inode->i_mode)) -+ if (fc->writeback_cache && S_ISREG(inode->i_mode)) { - attr->size = i_size_read(inode); -+ attr->mtime = inode->i_mtime.tv_sec; -+ attr->mtimensec = inode->i_mtime.tv_nsec; -+ } - - stat->dev = inode->i_sb->s_dev; - stat->ino = attr->ino; -@@ -1513,12 +1516,16 @@ static long fuse_dir_compat_ioctl(struct file *file, unsigned int cmd, - FUSE_IOCTL_COMPAT | FUSE_IOCTL_DIR); - } - --static bool update_mtime(unsigned ivalid) -+static bool update_mtime(unsigned ivalid, bool trust_local_mtime) - { - /* Always update if mtime is explicitly set */ - if (ivalid & ATTR_MTIME_SET) - return true; - -+ /* Or if kernel i_mtime is the official one */ -+ if (trust_local_mtime) -+ return true; -+ - /* If it's an open(O_TRUNC) or an ftruncate(), don't update */ - if ((ivalid & ATTR_SIZE) && (ivalid & (ATTR_OPEN | ATTR_FILE))) - return false; -@@ -1527,7 +1534,8 @@ static bool update_mtime(unsigned ivalid) - return true; - } - --static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg) -+static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg, -+ bool trust_local_mtime) - { - unsigned ivalid = iattr->ia_valid; - -@@ -1546,11 +1554,11 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg) - if (!(ivalid & ATTR_ATIME_SET)) - arg->valid |= FATTR_ATIME_NOW; - } -- if ((ivalid & ATTR_MTIME) && update_mtime(ivalid)) { -+ if ((ivalid & ATTR_MTIME) && update_mtime(ivalid, trust_local_mtime)) { - arg->valid |= FATTR_MTIME; - arg->mtime = iattr->ia_mtime.tv_sec; - arg->mtimensec = iattr->ia_mtime.tv_nsec; -- if (!(ivalid & ATTR_MTIME_SET)) -+ if (!(ivalid & ATTR_MTIME_SET) && !trust_local_mtime) - arg->valid |= FATTR_MTIME_NOW; - } - } -@@ -1599,6 +1607,63 @@ void fuse_release_nowrite(struct inode *inode) - spin_unlock(&fc->lock); - } - -+static void fuse_setattr_fill(struct fuse_conn *fc, struct fuse_req *req, -+ struct inode *inode, -+ struct fuse_setattr_in *inarg_p, -+ struct fuse_attr_out *outarg_p) -+{ -+ req->in.h.opcode = FUSE_SETATTR; -+ req->in.h.nodeid = get_node_id(inode); -+ req->in.numargs = 1; -+ req->in.args[0].size = sizeof(*inarg_p); -+ req->in.args[0].value = inarg_p; -+ req->out.numargs = 1; -+ if (fc->minor < 9) -+ req->out.args[0].size = FUSE_COMPAT_ATTR_OUT_SIZE; -+ else -+ req->out.args[0].size = sizeof(*outarg_p); -+ req->out.args[0].value = outarg_p; -+} -+ -+/* -+ * Flush inode->i_mtime to the server -+ */ -+int fuse_flush_mtime(struct file *file, bool nofail) -+{ -+ struct inode *inode = file->f_mapping->host; -+ struct fuse_inode *fi = get_fuse_inode(inode); -+ struct fuse_conn *fc = get_fuse_conn(inode); -+ struct fuse_req *req = NULL; -+ struct fuse_setattr_in inarg; -+ struct fuse_attr_out outarg; -+ int err; -+ -+ if (nofail) { -+ req = fuse_get_req_nofail_nopages(fc, file); -+ } else { -+ req = fuse_get_req_nopages(fc); -+ if (IS_ERR(req)) -+ return PTR_ERR(req); -+ } -+ -+ memset(&inarg, 0, sizeof(inarg)); -+ memset(&outarg, 0, sizeof(outarg)); -+ -+ inarg.valid |= FATTR_MTIME; -+ inarg.mtime = inode->i_mtime.tv_sec; -+ inarg.mtimensec = inode->i_mtime.tv_nsec; -+ -+ fuse_setattr_fill(fc, req, inode, &inarg, &outarg); -+ fuse_request_send(fc, req); -+ err = req->out.h.error; -+ fuse_put_request(fc, req); -+ -+ if (!err) -+ clear_bit(FUSE_I_MTIME_DIRTY, &fi->state); -+ -+ return err; -+} -+ - /* - * Set attributes, and at the same time refresh them. - * -@@ -1619,6 +1684,7 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - bool is_wb = fc->writeback_cache; - loff_t oldsize; - int err; -+ bool trust_local_mtime = is_wb && S_ISREG(inode->i_mode); - - if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS)) - attr->ia_valid |= ATTR_FORCE; -@@ -1647,7 +1713,7 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - - memset(&inarg, 0, sizeof(inarg)); - memset(&outarg, 0, sizeof(outarg)); -- iattr_to_fattr(attr, &inarg); -+ iattr_to_fattr(attr, &inarg, trust_local_mtime); - if (file) { - struct fuse_file *ff = file->private_data; - inarg.valid |= FATTR_FH; -@@ -1658,17 +1724,7 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - inarg.valid |= FATTR_LOCKOWNER; - inarg.lock_owner = fuse_lock_owner_id(fc, current->files); - } -- req->in.h.opcode = FUSE_SETATTR; -- req->in.h.nodeid = get_node_id(inode); -- req->in.numargs = 1; -- req->in.args[0].size = sizeof(inarg); -- req->in.args[0].value = &inarg; -- req->out.numargs = 1; -- if (fc->minor < 9) -- req->out.args[0].size = FUSE_COMPAT_ATTR_OUT_SIZE; -- else -- req->out.args[0].size = sizeof(outarg); -- req->out.args[0].value = &outarg; -+ fuse_setattr_fill(fc, req, inode, &inarg, &outarg); - fuse_request_send(fc, req); - err = req->out.h.error; - fuse_put_request(fc, req); -@@ -1685,6 +1741,12 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, - } - - spin_lock(&fc->lock); -+ /* the kernel maintains i_mtime locally */ -+ if (trust_local_mtime && (attr->ia_valid & ATTR_MTIME)) { -+ inode->i_mtime = attr->ia_mtime; -+ clear_bit(FUSE_I_MTIME_DIRTY, &fi->state); -+ } -+ - fuse_change_attributes_common(inode, &outarg.attr, - attr_timeout(&outarg)); - oldsize = inode->i_size; -@@ -1915,6 +1977,17 @@ static int fuse_removexattr(struct dentry *entry, const char *name) - return err; - } - -+static int fuse_update_time(struct inode *inode, struct timespec *now, -+ int flags) -+{ -+ if (flags & S_MTIME) { -+ inode->i_mtime = *now; -+ set_bit(FUSE_I_MTIME_DIRTY, &get_fuse_inode(inode)->state); -+ BUG_ON(!S_ISREG(inode->i_mode)); -+ } -+ return 0; -+} -+ - static const struct inode_operations fuse_dir_inode_operations = { - .lookup = fuse_lookup, - .mkdir = fuse_mkdir, -@@ -1954,6 +2027,7 @@ static const struct inode_operations fuse_common_inode_operations = { - .getxattr = fuse_getxattr, - .listxattr = fuse_listxattr, - .removexattr = fuse_removexattr, -+ .update_time = fuse_update_time, - }; - - static const struct inode_operations fuse_symlink_inode_operations = { -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 5b863c0..5916dc5 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -308,6 +308,9 @@ static int fuse_open(struct inode *inode, struct file *file) - - static int fuse_release(struct inode *inode, struct file *file) - { -+ if (test_bit(FUSE_I_MTIME_DIRTY, &get_fuse_inode(inode)->state)) -+ fuse_flush_mtime(file, true); -+ - fuse_release_common(file, FUSE_RELEASE); - - /* return value is ignored by VFS */ -@@ -475,6 +478,12 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, - - fuse_sync_writes(inode); - -+ if (test_bit(FUSE_I_MTIME_DIRTY, &get_fuse_inode(inode)->state)) { -+ int err = fuse_flush_mtime(file, false); -+ if (err) -+ goto out; -+ } -+ - req = fuse_get_req_nopages(fc); - if (IS_ERR(req)) { - err = PTR_ERR(req); -@@ -960,16 +969,21 @@ static size_t fuse_send_write(struct fuse_req *req, struct fuse_io_priv *io, - return req->misc.write.out.size; - } - --void fuse_write_update_size(struct inode *inode, loff_t pos) -+bool fuse_write_update_size(struct inode *inode, loff_t pos) - { - struct fuse_conn *fc = get_fuse_conn(inode); - struct fuse_inode *fi = get_fuse_inode(inode); -+ bool ret = false; - - spin_lock(&fc->lock); - fi->attr_version = ++fc->attr_version; -- if (pos > inode->i_size) -+ if (pos > inode->i_size) { - i_size_write(inode, pos); -+ ret = true; -+ } - spin_unlock(&fc->lock); -+ -+ return ret; - } - - static size_t fuse_send_write_pages(struct fuse_req *req, struct file *file, -@@ -2873,8 +2887,16 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, - goto out; - - /* we could have extended the file */ -- if (!(mode & FALLOC_FL_KEEP_SIZE)) -- fuse_write_update_size(inode, offset + length); -+ if (!(mode & FALLOC_FL_KEEP_SIZE)) { -+ bool changed = fuse_write_update_size(inode, offset + length); -+ -+ if (changed && fc->writeback_cache) { -+ struct fuse_inode *fi = get_fuse_inode(inode); -+ -+ inode->i_mtime = current_fs_time(inode->i_sb); -+ set_bit(FUSE_I_MTIME_DIRTY, &fi->state); -+ } -+ } - - if (mode & FALLOC_FL_PUNCH_HOLE) - truncate_pagecache_range(inode, offset, offset + length - 1); -diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h -index 374a8be..1e6ad6d 100644 ---- a/fs/fuse/fuse_i.h -+++ b/fs/fuse/fuse_i.h -@@ -119,6 +119,8 @@ enum { - FUSE_I_INIT_RDPLUS, - /** An operation changing file size is in progress */ - FUSE_I_SIZE_UNSTABLE, -+ /** i_mtime has been updated locally; a flush to userspace needed */ -+ FUSE_I_MTIME_DIRTY, - }; - - struct fuse_conn; -@@ -876,7 +878,9 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd, - unsigned fuse_file_poll(struct file *file, poll_table *wait); - int fuse_dev_release(struct inode *inode, struct file *file); - --void fuse_write_update_size(struct inode *inode, loff_t pos); -+bool fuse_write_update_size(struct inode *inode, loff_t pos); -+ -+int fuse_flush_mtime(struct file *file, bool nofail); - - int fuse_do_setattr(struct inode *inode, struct iattr *attr, - struct file *file); -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 22a78a6..338da52 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -170,8 +170,11 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, - inode->i_blocks = attr->blocks; - inode->i_atime.tv_sec = attr->atime; - inode->i_atime.tv_nsec = attr->atimensec; -- inode->i_mtime.tv_sec = attr->mtime; -- inode->i_mtime.tv_nsec = attr->mtimensec; -+ /* mtime from server may be stale due to local buffered write */ -+ if (!fc->writeback_cache || !S_ISREG(inode->i_mode)) { -+ inode->i_mtime.tv_sec = attr->mtime; -+ inode->i_mtime.tv_nsec = attr->mtimensec; -+ } - inode->i_ctime.tv_sec = attr->ctime; - inode->i_ctime.tv_nsec = attr->ctimensec; - -@@ -250,6 +253,8 @@ static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr) - { - inode->i_mode = attr->mode & S_IFMT; - inode->i_size = attr->size; -+ inode->i_mtime.tv_sec = attr->mtime; -+ inode->i_mtime.tv_nsec = attr->mtimensec; - if (S_ISREG(inode->i_mode)) { - fuse_init_common(inode); - fuse_init_file_inode(inode); -@@ -296,7 +301,9 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, - return NULL; - - if ((inode->i_state & I_NEW)) { -- inode->i_flags |= S_NOATIME|S_NOCMTIME; -+ inode->i_flags |= S_NOATIME; -+ if (!fc->writeback_cache || !S_ISREG(inode->i_mode)) -+ inode->i_flags |= S_NOCMTIME; - inode->i_generation = generation; - inode->i_data.backing_dev_info = &fc->bdi; - fuse_init_inode(inode, attr); --- -2.7.4 - - -From 6b1c8b7974158eabc822d1a01f528f95793219ae Mon Sep 17 00:00:00 2001 -From: Maxim Patlasov -Date: Mon, 28 Apr 2014 14:19:24 +0200 -Subject: [PATCH 71/73] fuse: trust kernel i_ctime only - -Let the kernel maintain i_ctime locally: update i_ctime explicitly on -truncate, fallocate, open(O_TRUNC), setxattr, removexattr, link, rename, -unlink. - -The inode flag I_DIRTY_SYNC serves as indication that local i_ctime should -be flushed to the server eventually. The patch sets the flag and updates -i_ctime in course of operations listed above. - -Signed-off-by: Maxim Patlasov -Signed-off-by: Miklos Szeredi -(cherry picked from commit 31f3267b4ba16b12fb9dd3b1953ea0f221cc2ab4) -Signed-off-by: Alex Shi ---- - fs/fuse/dir.c | 22 ++++++++++++++++++++-- - fs/fuse/inode.c | 6 ++++-- - 2 files changed, 24 insertions(+), 4 deletions(-) - -diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c -index b4adb3d9..6d5e45c 100644 ---- a/fs/fuse/dir.c -+++ b/fs/fuse/dir.c -@@ -680,6 +680,14 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry, - return create_new_entry(fc, req, dir, entry, S_IFLNK); - } - -+static inline void fuse_update_ctime(struct inode *inode) -+{ -+ if (!IS_NOCMTIME(inode)) { -+ inode->i_ctime = current_fs_time(inode->i_sb); -+ mark_inode_dirty_sync(inode); -+ } -+} -+ - static int fuse_unlink(struct inode *dir, struct dentry *entry) - { - int err; -@@ -714,6 +722,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) - fuse_invalidate_attr(inode); - fuse_invalidate_attr(dir); - fuse_invalidate_entry_cache(entry); -+ fuse_update_ctime(inode); - } else if (err == -EINTR) - fuse_invalidate_entry(entry); - return err; -@@ -772,6 +781,7 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent, - if (!err) { - /* ctime changes */ - fuse_invalidate_attr(oldent->d_inode); -+ fuse_update_ctime(oldent->d_inode); - - fuse_invalidate_attr(olddir); - if (olddir != newdir) -@@ -781,6 +791,7 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent, - if (newent->d_inode) { - fuse_invalidate_attr(newent->d_inode); - fuse_invalidate_entry_cache(newent); -+ fuse_update_ctime(newent->d_inode); - } - } else if (err == -EINTR) { - /* If request was interrupted, DEITY only knows if the -@@ -860,6 +871,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, - inc_nlink(inode); - spin_unlock(&fc->lock); - fuse_invalidate_attr(inode); -+ fuse_update_ctime(inode); - } else if (err == -EINTR) { - fuse_invalidate_attr(inode); - } -@@ -877,6 +889,8 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr, - attr->size = i_size_read(inode); - attr->mtime = inode->i_mtime.tv_sec; - attr->mtimensec = inode->i_mtime.tv_nsec; -+ attr->ctime = inode->i_ctime.tv_sec; -+ attr->ctimensec = inode->i_ctime.tv_nsec; - } - - stat->dev = inode->i_sb->s_dev; -@@ -1841,8 +1855,10 @@ static int fuse_setxattr(struct dentry *entry, const char *name, - fc->no_setxattr = 1; - err = -EOPNOTSUPP; - } -- if (!err) -+ if (!err) { - fuse_invalidate_attr(inode); -+ fuse_update_ctime(inode); -+ } - return err; - } - -@@ -1972,8 +1988,10 @@ static int fuse_removexattr(struct dentry *entry, const char *name) - fc->no_removexattr = 1; - err = -EOPNOTSUPP; - } -- if (!err) -+ if (!err) { - fuse_invalidate_attr(inode); -+ fuse_update_ctime(inode); -+ } - return err; - } - -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 338da52..8fe0b48 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -174,9 +174,9 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, - if (!fc->writeback_cache || !S_ISREG(inode->i_mode)) { - inode->i_mtime.tv_sec = attr->mtime; - inode->i_mtime.tv_nsec = attr->mtimensec; -+ inode->i_ctime.tv_sec = attr->ctime; -+ inode->i_ctime.tv_nsec = attr->ctimensec; - } -- inode->i_ctime.tv_sec = attr->ctime; -- inode->i_ctime.tv_nsec = attr->ctimensec; - - if (attr->blksize != 0) - inode->i_blkbits = ilog2(attr->blksize); -@@ -255,6 +255,8 @@ static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr) - inode->i_size = attr->size; - inode->i_mtime.tv_sec = attr->mtime; - inode->i_mtime.tv_nsec = attr->mtimensec; -+ inode->i_ctime.tv_sec = attr->ctime; -+ inode->i_ctime.tv_nsec = attr->ctimensec; - if (S_ISREG(inode->i_mode)) { - fuse_init_common(inode); - fuse_init_file_inode(inode); --- -2.7.4 - - -From e03ae8b69bb899c5cdd0c594fa58a85cd180df1b Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Mon, 28 Apr 2014 16:43:44 +0200 -Subject: [PATCH 72/73] fuse: add renameat2 support - -Support RENAME_EXCHANGE and RENAME_NOREPLACE flags on the userspace ABI. - -Signed-off-by: Miklos Szeredi -(cherry picked from commit 1560c974dcd40a8d3f193283acd7cc6aee13dc13) -Signed-off-by: Alex Shi - - Conflicts: - fs/fuse/dir.c - include/uapi/linux/fuse.h ---- - fs/fuse/dir.c | 24 ++++++++++++++++-------- - fs/fuse/fuse_i.h | 3 +++ - include/uapi/linux/fuse.h | 10 ++++++++++ - 3 files changed, 29 insertions(+), 8 deletions(-) - -diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c -index 6d5e45c..33dec83 100644 ---- a/fs/fuse/dir.c -+++ b/fs/fuse/dir.c -@@ -753,23 +753,26 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) - return err; - } - --static int fuse_rename(struct inode *olddir, struct dentry *oldent, -- struct inode *newdir, struct dentry *newent) -+static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, -+ struct inode *newdir, struct dentry *newent, -+ unsigned int flags, int opcode, size_t argsize) - { - int err; -- struct fuse_rename_in inarg; -+ struct fuse_rename2_in inarg; - struct fuse_conn *fc = get_fuse_conn(olddir); -- struct fuse_req *req = fuse_get_req_nopages(fc); -+ struct fuse_req *req; - -+ req = fuse_get_req_nopages(fc); - if (IS_ERR(req)) - return PTR_ERR(req); - -- memset(&inarg, 0, sizeof(inarg)); -+ memset(&inarg, 0, argsize); - inarg.newdir = get_node_id(newdir); -- req->in.h.opcode = FUSE_RENAME; -+ inarg.flags = flags; -+ req->in.h.opcode = opcode; - req->in.h.nodeid = get_node_id(olddir); - req->in.numargs = 3; -- req->in.args[0].size = sizeof(inarg); -+ req->in.args[0].size = argsize; - req->in.args[0].value = &inarg; - req->in.args[1].size = oldent->d_name.len + 1; - req->in.args[1].value = oldent->d_name.name; -@@ -783,12 +786,17 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent, - fuse_invalidate_attr(oldent->d_inode); - fuse_update_ctime(oldent->d_inode); - -+ if (flags & RENAME_EXCHANGE) { -+ fuse_invalidate_attr(newent->d_inode); -+ fuse_update_ctime(newent->d_inode); -+ } -+ - fuse_invalidate_attr(olddir); - if (olddir != newdir) - fuse_invalidate_attr(newdir); - - /* newent will end up negative */ -- if (newent->d_inode) { -+ if (!(flags & RENAME_EXCHANGE) && newent->d_inode) { - fuse_invalidate_attr(newent->d_inode); - fuse_invalidate_entry_cache(newent); - fuse_update_ctime(newent->d_inode); -diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h -index 1e6ad6d..7cc58c9 100644 ---- a/fs/fuse/fuse_i.h -+++ b/fs/fuse/fuse_i.h -@@ -544,6 +544,9 @@ struct fuse_conn { - /** Is fallocate not implemented by fs? */ - unsigned no_fallocate:1; - -+ /** Is rename with flags implemented by fs? */ -+ unsigned no_rename2:1; -+ - /** Use enhanced/automatic page cache invalidation. */ - unsigned auto_inval_data:1; - -diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h -index 60bb2f9..b77cf38 100644 ---- a/include/uapi/linux/fuse.h -+++ b/include/uapi/linux/fuse.h -@@ -93,6 +93,9 @@ - * - * 7.22 - * - add FUSE_ASYNC_DIO -+ * -+ * 7.23 -+ * - add FUSE_RENAME2 request - */ - - #ifndef _LINUX_FUSE_H -@@ -343,6 +346,7 @@ enum fuse_opcode { - FUSE_BATCH_FORGET = 42, - FUSE_FALLOCATE = 43, - FUSE_READDIRPLUS = 44, -+ FUSE_RENAME2 = 45, - - /* CUSE specific operations */ - CUSE_INIT = 4096, -@@ -421,6 +425,12 @@ struct fuse_rename_in { - uint64_t newdir; - }; - -+struct fuse_rename2_in { -+ uint64_t newdir; -+ uint32_t flags; -+ uint32_t padding; -+}; -+ - struct fuse_link_in { - uint64_t oldnodeid; - }; --- -2.7.4 - - -From ab0f88ef018ee96ff56dc39a032c9882a07037d0 Mon Sep 17 00:00:00 2001 -From: Alex Shi -Date: Thu, 20 Aug 2015 14:56:22 +0800 -Subject: [PATCH 73/73] fs/xfs: add missed symbol readlink_copy - -When compile davinci_all_defconfig in Kevin's kernelci.org, -The missed symbol experting cause following error: - - ERROR: "readlink_copy" [fs/xfs/xfs.ko] undefined! - -This patch fixed the problem. - -Signed-off-by: Alex Shi ---- - fs/namei.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fs/namei.c b/fs/namei.c -index 0fbf150..e3b23a0 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -4340,6 +4340,7 @@ int readlink_copy(char __user *buffer, int buflen, const char *link) - out: - return len; - } -+EXPORT_SYMBOL(readlink_copy); - - /* - * A helper for ->readlink(). This should be used *ONLY* for symlinks that --- -2.7.4 - diff --git a/packages/linux/patches/amlogic-3.14/linux-007-sound_soc_aml_m8-Report-only-working-frequecies-and-bit-depths.patch b/packages/linux/patches/amlogic-3.14/linux-007-sound_soc_aml_m8-Report-only-working-frequecies-and-bit-depths.patch deleted file mode 100644 index 72c12ac072..0000000000 --- a/packages/linux/patches/amlogic-3.14/linux-007-sound_soc_aml_m8-Report-only-working-frequecies-and-bit-depths.patch +++ /dev/null @@ -1,58 +0,0 @@ -From edab2a489829689fdaadb90f1897c948ea3c9020 Mon Sep 17 00:00:00 2001 -From: kszaq -Date: Wed, 3 Jun 2015 10:20:04 +0200 -Subject: [PATCH] sound/soc/aml/m8: Report only working frequecies and bit - depths - ---- - sound/soc/aml/m8/aml_spdif_codec.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/aml/m8/aml_spdif_codec.c b/sound/soc/aml/m8/aml_spdif_codec.c -index ac76ef6..cf0e929 100644 ---- a/sound/soc/aml/m8/aml_spdif_codec.c -+++ b/sound/soc/aml/m8/aml_spdif_codec.c -@@ -26,9 +26,8 @@ - - #define DRV_NAME "spdif-dit" - --#define STUB_RATES SNDRV_PCM_RATE_8000_192000 --#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ -- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -+#define STUB_RATES SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000 -+#define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE - - struct pinctrl *pin_spdif_ctl; - struct device *spdif_dev; --- -1.8.3.1 - -From 1e6294498438359c4ac39b2ab563487d750fbaaf Mon Sep 17 00:00:00 2001 -From: kszaq -Date: Tue, 30 Aug 2016 23:31:29 +0200 -Subject: [PATCH] sound/soc/aml/m8: report only working frequencies and bit - depths for I2S - ---- - sound/soc/aml/m8/aml_i2s_dai.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/aml/m8/aml_i2s_dai.c b/sound/soc/aml/m8/aml_i2s_dai.c -index 3626676..d2ebad1 100644 ---- a/sound/soc/aml/m8/aml_i2s_dai.c -+++ b/sound/soc/aml/m8/aml_i2s_dai.c -@@ -290,9 +290,8 @@ static int aml_dai_i2s_resume(struct snd_soc_dai *dai) - return 0; - } - --#define AML_DAI_I2S_RATES (SNDRV_PCM_RATE_8000_192000) --#define AML_DAI_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ -- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -+#define AML_DAI_I2S_RATES SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000 -+#define AML_DAI_I2S_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE - - static struct snd_soc_dai_ops aml_dai_i2s_ops = { - .startup = aml_dai_i2s_startup, --- -1.8.3.1 - diff --git a/packages/linux/patches/default/linux-004-fix-build-with-gcc-5.patch b/packages/linux/patches/default/linux-004-fix-build-with-gcc-5.patch deleted file mode 100644 index b2e8d91d38..0000000000 --- a/packages/linux/patches/default/linux-004-fix-build-with-gcc-5.patch +++ /dev/null @@ -1,16 +0,0 @@ -# see https://github.com/wongsyrone/openwrt-1/commit/93c0a5173414cfa7684547de3c3a1f3dc4240383 -# and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932 - -diff -Naur linux-4.3-rc5.orig/arch/arm/Makefile linux-4.3-rc5/arch/arm/Makefile ---- linux-4.3-rc5.orig/arch/arm/Makefile 2015-10-11 11:09:45.000000000 -0700 -+++ linux-4.3-rc5/arch/arm/Makefile 2015-10-20 12:24:44.507102957 -0700 -@@ -130,7 +130,8 @@ - endif - - # Need -Uarm for gcc < 3.x --KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm -+# Maybe we need -fno-ipa-sra for gcc > 4.9.x -+KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm -fno-ipa-sra - KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float - - CHECKFLAGS += -D__arm__ diff --git a/packages/linux/patches/default/linux-051-ouya_controller_support.patch b/packages/linux/patches/default/linux-051-ouya_controller_support.patch index 9b0f253372..8ee3cb27be 100644 --- a/packages/linux/patches/default/linux-051-ouya_controller_support.patch +++ b/packages/linux/patches/default/linux-051-ouya_controller_support.patch @@ -1,211 +1,129 @@ -diff -Naur linux-3.19.orig/drivers/hid/hid-core.c linux-3.19/drivers/hid/hid-core.c ---- linux-3.19.orig/drivers/hid/hid-core.c 2015-02-20 14:01:17.080322846 -0800 -+++ linux-3.19/drivers/hid/hid-core.c 2015-02-20 14:03:30.375519421 -0800 -@@ -1884,6 +1884,7 @@ - { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) }, -diff -Naur linux-3.19.orig/drivers/hid/hid-ids.h linux-3.19/drivers/hid/hid-ids.h ---- linux-3.19.orig/drivers/hid/hid-ids.h 2015-02-20 14:01:17.080322846 -0800 -+++ linux-3.19/drivers/hid/hid-ids.h 2015-02-20 14:03:30.382519482 -0800 -@@ -721,6 +721,9 @@ - #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 +commit 5a596921a4636e62843a59b7eab7b87b70a6d296 +Author: Lukas Rusak +Date: Sun May 6 22:03:11 2018 -0700 + + HID: add ouya HID driver + + This driver is a simple implementation to get the controller working and mapped properly. + This driver does not include functionality for the touchpad (yet). The original driver + was taken from from the ouya linux tree and has been simplified. It seems there may have + been other versions of the controller present that had a broken report descriptor. I have + removed that for now. + +diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig +index 60252fd796f6..6be2c454e72e 100644 +--- a/drivers/hid/Kconfig ++++ b/drivers/hid/Kconfig +@@ -659,6 +659,12 @@ config HID_ORTEK + - Ortek WKB-2000 + - Skycable wireless presenter + ++config HID_OUYA ++ tristate "OUYA Game Controller" ++ depends on USB_HID ++ ---help--- ++ Support for OUYA Game Controller. ++ + config HID_PANTHERLORD + tristate "Pantherlord/GreenAsia game controller" + depends on HID +diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile +index 17a8bd97da9d..4425890934e4 100644 +--- a/drivers/hid/Makefile ++++ b/drivers/hid/Makefile +@@ -71,6 +71,7 @@ obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o + obj-$(CONFIG_HID_NTI) += hid-nti.o + obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o + obj-$(CONFIG_HID_ORTEK) += hid-ortek.o ++obj-$(CONFIG_HID_OUYA) += hid-ouya.o + obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o + obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o + obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 0b5cc910f62e..0528efb825fa 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -859,6 +859,9 @@ #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 + #define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003 -+#define USB_VENDOR_ID_OUYA 0x2836 -+#define USB_DEVICE_ID_OUYA_CONTROLLER 0x0001 ++#define USB_VENDOR_ID_OUYA 0x2836 ++#define USB_DEVICE_ID_OUYA_CONTROLLER 0x0001 + #define USB_VENDOR_ID_PLANTRONICS 0x047f #define USB_VENDOR_ID_PANASONIC 0x04da -diff -Naur linux-3.19.orig/drivers/hid/hid-ouya.c linux-3.19/drivers/hid/hid-ouya.c ---- linux-3.19.orig/drivers/hid/hid-ouya.c 1969-12-31 16:00:00.000000000 -0800 -+++ linux-3.19/drivers/hid/hid-ouya.c 2015-02-20 14:03:30.371519386 -0800 -@@ -0,0 +1,260 @@ +diff --git a/drivers/hid/hid-ouya.c b/drivers/hid/hid-ouya.c +new file mode 100644 +index 000000000000..4344a47b40af +--- /dev/null ++++ b/drivers/hid/hid-ouya.c +@@ -0,0 +1,131 @@ +/* + * HID driver for OUYA Game Controller(s) + * + * Copyright (c) 2013 OUYA ++ * Copyright (c) 2013 Gregorios Leach ++ * Copyright (c) 2018 Lukas Rusak + */ + +#include -+#include +#include ++#include +#include + +#include "hid-ids.h" + -+#define OUYA_TOUCHPAD_FIXUP (1 << 0) -+ -+struct ouya_sc { -+ unsigned long quirks; ++static const unsigned int ouya_absmap[] = { ++ [0x30] = ABS_X, /* left stick X */ ++ [0x31] = ABS_Y, /* left stick Y */ ++ [0x32] = ABS_Z, /* L2 */ ++ [0x33] = ABS_RX, /* right stick X */ ++ [0x34] = ABS_RY, /* right stick Y */ ++ [0x35] = ABS_RZ, /* R2 */ +}; + -+/* Fixed report descriptor */ -+static __u8 ouya_rdesc_fixed[] = { -+ -+ 0x05, 0x01, /* Usage Page (Desktop), */ -+ 0x09, 0x05, /* Usage (Game Pad), */ -+ -+ 0xA1, 0x01, /* Collection (Application), */ -+ 0x85, 0x07, /* Report ID (7), */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x30, /* Usage (X), */ -+ 0x09, 0x31, /* Usage (Y), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x02, /* Report Count (2), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x33, /* Usage (Rx), */ -+ 0x09, 0x34, /* Usage (Ry), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x02, /* Report Count (2), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x32, /* Usage (Z), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x35, /* Usage (Rz), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0x05, 0x09, /* Usage Page (Button), */ -+ 0x19, 0x01, /* Usage Minimum (01h), */ -+ 0x29, 0x10, /* Usage Maximum (10h), */ -+ 0x95, 0x10, /* Report Count (16), */ -+ 0x75, 0x01, /* Report Size (1), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ -+ /* ORIGINAL REPORT DESCRIPTOR FOR TOUCHPAD INPUT */ -+ /* 06 00 ff a1 02 09 02 15 00 26 ff 00 35 00 46 ff 00 95 03 75 08 81 02 c0 */ -+ -+ 0x06, 0x00, 0xFF, /* Usage Page (Custom), */ -+ 0x09, 0x02, /* Usage (Mouse), */ -+ 0x09, 0x01, /* Usage (Pointer), */ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x05, 0x09, /* Usage Page (Button), */ -+ 0x19, 0x01, /* Usage Minimum (01h), */ -+ 0x29, 0x03, /* Usage Maximum (03h), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x25, 0x01, /* Logical Maximum (1), */ -+ 0x95, 0x03, /* Report Count (3), */ -+ 0x75, 0x01, /* Report Size (1), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x75, 0x05, /* Report Size (5), */ -+ 0x81, 0x01, /* Input (Constant), */ -+ 0x05, 0x01, /* Usage Page (Desktop), */ -+ 0x09, 0x30, /* Usage (X), */ -+ 0x09, 0x31, /* Usage (Y), */ -+ 0x15, 0x81, /* Logical Minimum (-127), */ -+ 0x25, 0x7f, /* Logical Maximum (127), */ -+ 0x95, 0x02, /* Report Count (2), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x06, /* Input (Relative), */ -+ 0xC0, /* End Collection, */ -+ -+ 0x06, 0x00, 0xFF, /* Usage Page (Custom), */ -+ 0xA1, 0x02, /* Collection (Logical), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x95, 0x07, /* Report Count (7), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x09, 0x01, /* Usage (Pointer), */ -+ 0x91, 0x02, /* Output (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xC0, /* End Collection */ -+ -+ -+ 0x06, 0x00, 0xFF, /* Usage Page (Custom), */ -+ 0x05, 0x0C, /* Usage Page (Consumer), */ -+ 0x09, 0x01, /* Usage (Consumer Control), */ -+ -+ 0xA1, 0x01, /* Collection (Application), */ -+ 0x85, 0x03, /* Report ID (3), */ -+ 0x05, 0x01, /* Usage Page (Desktop), */ -+ 0x09, 0x06, /* Usage (Keyboard), */ -+ 0xA1, 0x02, /* Collection (Logical), */ -+ 0x05, 0x06, /* Usage Page (Generic), */ -+ 0x09, 0x20, /* Usage (Battery Strgth), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0x06, 0xBC, 0xFF, /* Usage Page (Custom), */ -+ -+ 0x0A, 0xAD, 0xBD, /* UNKNOWN */ -+ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x95, 0x06, /* Report Count (6), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xC0, /* End Collection */ -+ -+ 0x00 ++static const unsigned int ouya_keymap[] = { ++ [0x1] = BTN_SOUTH, /* O */ ++ [0x2] = BTN_WEST, /* U */ ++ [0x3] = BTN_NORTH, /* Y */ ++ [0x4] = BTN_EAST, /* A */ ++ [0x5] = BTN_TL, /* L1 */ ++ [0x6] = BTN_TR, /* R1 */ ++ [0x7] = BTN_THUMBL, /* L3 */ ++ [0x8] = BTN_THUMBR, /* R3 */ ++ [0x9] = BTN_DPAD_UP, /* Up */ ++ [0xa] = BTN_DPAD_DOWN, /* Down */ ++ [0xb] = BTN_DPAD_LEFT, /* Left */ ++ [0xc] = BTN_DPAD_RIGHT, /* Right */ ++ [0xd] = BTN_TL2, /* L2 */ ++ [0xe] = BTN_TR2, /* R2 */ ++ [0xf] = BTN_MODE, /* Power */ +}; + -+static __u8 *ouya_report_fixup(struct hid_device *hdev, __u8 *rdesc, -+ unsigned int *rsize) -+{ -+ struct ouya_sc *sc = hid_get_drvdata(hdev); -+ -+ if (sc->quirks & OUYA_TOUCHPAD_FIXUP) { -+ rdesc = ouya_rdesc_fixed; -+ *rsize = sizeof(ouya_rdesc_fixed); -+ } -+ return rdesc; -+} -+ +static int ouya_input_mapping(struct hid_device *hdev, struct hid_input *hi, + struct hid_field *field, struct hid_usage *usage, + unsigned long **bit, int *max) +{ -+ struct ouya_sc *sc = hid_get_drvdata(hdev); ++ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) { ++ unsigned int key = usage->hid & HID_USAGE; + -+ if (!(sc->quirks & OUYA_TOUCHPAD_FIXUP)) { -+ return 0; -+ } ++ if (key >= ARRAY_SIZE(ouya_keymap)) ++ return -1; + -+ if ((usage->hid & 0x90000) == 0x90000 && -+ (field->physical & 0xff000000) == 0xff000000 && -+ usage->collection_index == 5 && -+ field->report_count == 3) { ++ key = ouya_keymap[key]; ++ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key); + -+ hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_MOUSE + (usage->hid - 0x90001)); ++ return 1; ++ ++ } else if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK) { ++ unsigned int abs = usage->hid & HID_USAGE; ++ ++ if (abs >= ARRAY_SIZE(ouya_absmap)) ++ return -1; ++ ++ abs = ouya_absmap[abs]; ++ hid_map_usage_clear(hi, usage, bit, max, EV_ABS, abs); + + return 1; + } @@ -216,22 +134,6 @@ diff -Naur linux-3.19.orig/drivers/hid/hid-ouya.c linux-3.19/drivers/hid/hid-ouy +static int ouya_probe(struct hid_device *hdev, const struct hid_device_id *id) +{ + int ret; -+ struct ouya_sc *sc; -+ -+ sc = kzalloc(sizeof(*sc), GFP_KERNEL); -+ if (sc == NULL) { -+ hid_err(hdev, "can't alloc ouya descriptor\n"); -+ return -ENOMEM; -+ } -+ -+ if(((hdev->version & 0xff00) == 0x0100 && (hdev->version & 0xff) >= 0x04) || -+ ((hdev->version & 0xff00) == 0xe100 && (hdev->version & 0xff) >= 0x3a)) { -+ hid_info(hdev, "ouya controller - new version\n"); -+ sc->quirks = OUYA_TOUCHPAD_FIXUP; -+ } else { -+ sc->quirks = 0; -+ } -+ hid_set_drvdata(hdev, sc); + + ret = hid_parse(hdev); + if (ret) { @@ -239,8 +141,7 @@ diff -Naur linux-3.19.orig/drivers/hid/hid-ouya.c linux-3.19/drivers/hid/hid-ouy + goto err_free; + } + -+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | -+ HID_CONNECT_HIDDEV_FORCE); ++ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | HID_CONNECT_HIDDEV_FORCE); + if (ret) { + hid_err(hdev, "hw start failed\n"); + goto err_free; @@ -249,7 +150,6 @@ diff -Naur linux-3.19.orig/drivers/hid/hid-ouya.c linux-3.19/drivers/hid/hid-ouy + return 0; + +err_free: -+ kfree(sc); + return ret; +} + @@ -268,10 +168,9 @@ diff -Naur linux-3.19.orig/drivers/hid/hid-ouya.c linux-3.19/drivers/hid/hid-ouy +static struct hid_driver ouya_driver = { + .name = "ouya", + .id_table = ouya_devices, ++ .input_mapping = ouya_input_mapping, + .probe = ouya_probe, + .remove = ouya_remove, -+ .input_mapping = ouya_input_mapping, -+ .report_fixup = ouya_report_fixup +}; + +static int __init ouya_init(void) @@ -286,30 +185,22 @@ diff -Naur linux-3.19.orig/drivers/hid/hid-ouya.c linux-3.19/drivers/hid/hid-ouy + +module_init(ouya_init); +module_exit(ouya_exit); -diff -Naur linux-3.19.orig/drivers/hid/Kconfig linux-3.19/drivers/hid/Kconfig ---- linux-3.19.orig/drivers/hid/Kconfig 2015-02-20 14:01:17.081322855 -0800 -+++ linux-3.19/drivers/hid/Kconfig 2015-02-20 14:03:30.381519473 -0800 -@@ -528,6 +528,12 @@ - - Ortek WKB-2000 - - Skycable wireless presenter - -+config HID_OUYA -+ tristate "OUYA Game Controller" -+ depends on USB_HID -+ ---help--- -+ Support for OUYA Game Controller. + - config HID_PANTHERLORD - tristate "Pantherlord/GreenAsia game controller" - depends on HID -diff -Naur linux-3.19.orig/drivers/hid/Makefile linux-3.19/drivers/hid/Makefile ---- linux-3.19.orig/drivers/hid/Makefile 2015-02-20 14:01:17.081322855 -0800 -+++ linux-3.19/drivers/hid/Makefile 2015-02-20 14:03:30.382519482 -0800 -@@ -70,6 +70,7 @@ - obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o - obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o - obj-$(CONFIG_HID_ORTEK) += hid-ortek.o -+obj-$(CONFIG_HID_OUYA) += hid-ouya.o - obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o - obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o - obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Lukas Rusak "); ++MODULE_AUTHOR("Gregorios Leach "); ++MODULE_DESCRIPTION("Ouya Controller Driver"); +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 587e2681a53f..b5adc13e0df1 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -538,6 +538,9 @@ static const struct hid_device_id hid_have_special_driver[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, + #endif ++#if IS_ENABLED(CONFIG_HID_OUYA) ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) }, ++#endif + #if IS_ENABLED(CONFIG_HID_PANTHERLORD) + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, diff --git a/packages/linux/patches/default/linux-052-XBOX_remote_support.patch b/packages/linux/patches/default/linux-052-XBOX_remote_support.patch deleted file mode 100644 index 399739dde0..0000000000 --- a/packages/linux/patches/default/linux-052-XBOX_remote_support.patch +++ /dev/null @@ -1,1029 +0,0 @@ -diff -Naur linux-3.9.4/drivers/staging/media/lirc/Kconfig linux-3.9.4.patch/drivers/staging/media/lirc/Kconfig ---- linux-3.9.4/drivers/staging/media/lirc/Kconfig 2013-05-24 20:45:59.000000000 +0200 -+++ linux-3.9.4.patch/drivers/staging/media/lirc/Kconfig 2013-05-30 18:18:57.238957100 +0200 -@@ -63,10 +63,17 @@ - help - Driver for the SIR IrDA port - -+config LIRC_XBOX -+ tristate "XBOX USB IR Remote" -+ depends on LIRC && USB -+ help -+ Driver for the Microsoft XBOX USB IR Remote -+ - config LIRC_ZILOG - tristate "Zilog/Hauppauge IR Transmitter" - depends on LIRC && I2C - help - Driver for the Zilog/Hauppauge IR Transmitter, found on - PVR-150/500, HVR-1200/1250/1700/1800, HD-PVR and other cards -+ - endif -diff -Naur linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c linux-3.9.4.patch/drivers/staging/media/lirc/lirc_xbox.c ---- linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.9.4.patch/drivers/staging/media/lirc/lirc_xbox.c 2013-05-30 18:40:22.523775446 +0200 -@@ -0,0 +1,995 @@ -+/* -+ * lirc_xbox - USB remote support for LIRC -+ * (supports Microsoft XBOX DVD Dongle) -+ * -+ * Copyright (C) 2003-2004 Paul Miller -+ * -+ * This driver was derived from: -+ * Vladimir Dergachev 's 2002 -+ * "USB ATI Remote support" (input device) -+ * Adrian Dewhurst 's 2002 -+ * "USB StreamZap remote driver" (LIRC) -+ * Artur Lipowski 's 2002 -+ * "lirc_dev" and "lirc_gpio" LIRC modules -+ * Michael Wojciechowski -+ * initial xbox support -+ * Vassilis Virvilis 2006 -+ * reworked the patch for lirc submission -+ * Paul Miller's 2004 -+ * lirc_atiusb - removed all ati remote support -+ * $Id: lirc_xbox.c,v 1.88 2011/06/03 11:11:11 jmartin Exp $ -+ */ -+ -+/* -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+ -+//#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) -+//#include -+//#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+//#include "drivers/kcompat.h" -+//#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) -+#include -+#include -+//#else -+//#include "drivers/lirc.h" -+//#include "drivers/lirc_dev/lirc_dev.h" -+//#endif -+ -+#define DRIVER_VERSION "$Revision: 0.01 $" -+#define DRIVER_AUTHOR "Jason Martin " -+#define DRIVER_DESC "XBOX DVD Dongle USB remote driver for LIRC" -+#define DRIVER_NAME "lirc_xbox" -+ -+#define CODE_LENGTH 6 -+#define CODE_MIN_LENGTH 6 -+#define DECODE_LENGTH 1 -+ -+#ifndef URB_ASYNC_UNLINK -+#define URB_ASYNC_UNLINK 0 -+#endif -+ -+/* module parameters */ -+#ifdef CONFIG_USB_DEBUG -+static int debug = 1; -+#else -+static int debug; -+#endif -+ -+#define dprintk(fmt, args...) \ -+ do { \ -+ if (debug) \ -+ printk(KERN_DEBUG fmt, ## args); \ -+ } while (0) -+ -+/* -+ * USB_BUFF_LEN must be the maximum value of the code_length array. -+ * It is used for static arrays. -+ */ -+#define USB_BUFF_LEN 6 -+ -+static int mask = 0xFFFF; /* channel acceptance bit mask */ -+static int unique; /* enable channel-specific codes */ -+static int repeat = 10; /* repeat time in 1/100 sec */ -+static unsigned long repeat_jiffies; /* repeat timeout */ -+ -+/* get hi and low bytes of a 16-bits int */ -+#define HI(a) ((unsigned char)((a) >> 8)) -+#define LO(a) ((unsigned char)((a) & 0xff)) -+ -+/* general constants */ -+#define SEND_FLAG_IN_PROGRESS 1 -+#define SEND_FLAG_COMPLETE 2 -+#define FREE_ALL 0xFF -+ -+/* endpoints */ -+#define EP_KEYS 0 -+#define EP_MOUSE 1 -+#define EP_MOUSE_ADDR 0x81 -+#define EP_KEYS_ADDR 0x82 -+ -+/* USB vendor ids for XBOX DVD Dongles */ -+#define VENDOR_MS1 0x040b -+#define VENDOR_MS2 0x045e -+#define VENDOR_MS3 0xFFFF -+ -+static struct usb_device_id usb_remote_table[] = { -+ /* Gamester Xbox DVD Movie Playback Kit IR */ -+ { USB_DEVICE(VENDOR_MS1, 0x6521) }, -+ -+ /* Microsoft Xbox DVD Movie Playback Kit IR */ -+ { USB_DEVICE(VENDOR_MS2, 0x0284) }, -+ -+ /* -+ * Some Chinese manufacturer -- conflicts with the joystick from the -+ * same manufacturer -+ */ -+ { USB_DEVICE(VENDOR_MS3, 0xFFFF) }, -+ -+ /* Terminating entry */ -+ { } -+}; -+ -+/* init strings */ -+#define USB_OUTLEN 7 -+ -+static char init1[] = {0x01, 0x00, 0x20, 0x14}; -+static char init2[] = {0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20}; -+ -+struct in_endpt { -+ /* inner link in list of endpoints for the remote specified by ir */ -+ struct list_head iep_list_link; -+ struct xbox_dev *ir; -+ struct urb *urb; -+ struct usb_endpoint_descriptor *ep; -+ -+ /* buffers and dma */ -+ unsigned char *buf; -+ unsigned int len; -+ dma_addr_t dma; -+ -+ /* handle repeats */ -+ unsigned char old[USB_BUFF_LEN]; -+ unsigned long old_jiffies; -+}; -+ -+struct out_endpt { -+ struct xbox_dev *ir; -+ struct urb *urb; -+ struct usb_endpoint_descriptor *ep; -+ -+ /* buffers and dma */ -+ unsigned char *buf; -+ dma_addr_t dma; -+ -+ /* handle sending (init strings) */ -+ int send_flags; -+ wait_queue_head_t wait; -+}; -+ -+ -+/* data structure for each usb remote */ -+struct xbox_dev { -+ /* inner link in list of all remotes managed by this module */ -+ struct list_head remote_list_link; -+ /* Number of usb interfaces associated with this device */ -+ int dev_refcount; -+ -+ /* usb */ -+ struct usb_device *usbdev; -+ /* Head link to list of all inbound endpoints in this remote */ -+ struct list_head iep_listhead; -+ struct out_endpt *out_init; -+ int devnum; -+ -+ /* lirc */ -+ struct lirc_driver *d; -+ int connected; -+ -+ /* locking */ -+ struct mutex lock; -+}; -+ -+/* list of all registered devices via the remote_list_link in xbox_dev */ -+static struct list_head remote_list; -+ -+/* -+ * Convenience macros to retrieve a pointer to the surrounding struct from -+ * the given list_head reference within, pointed at by link. -+ */ -+#define get_iep_from_link(link) \ -+ list_entry((link), struct in_endpt, iep_list_link); -+#define get_irctl_from_link(link) \ -+ list_entry((link), struct xbox_dev, remote_list_link); -+ -+/* send packet - used to initialize remote */ -+static void send_packet(struct out_endpt *oep, u16 cmd, unsigned char *data) -+{ -+ struct xbox_dev *ir = oep->ir; -+ DECLARE_WAITQUEUE(wait, current); -+ int timeout = HZ; /* 1 second */ -+ unsigned char buf[USB_OUTLEN]; -+ -+ dprintk(DRIVER_NAME "[%d]: send called (%#x)\n", ir->devnum, cmd); -+ -+ mutex_lock(&ir->lock); -+ oep->urb->transfer_buffer_length = LO(cmd) + 1; -+ oep->urb->dev = oep->ir->usbdev; -+ oep->send_flags = SEND_FLAG_IN_PROGRESS; -+ -+ memcpy(buf+1, data, LO(cmd)); -+ buf[0] = HI(cmd); -+ memcpy(oep->buf, buf, LO(cmd)+1); -+ -+ set_current_state(TASK_INTERRUPTIBLE); -+ add_wait_queue(&oep->wait, &wait); -+ -+ if (usb_submit_urb(oep->urb, GFP_ATOMIC)) { -+ set_current_state(TASK_RUNNING); -+ remove_wait_queue(&oep->wait, &wait); -+ mutex_unlock(&ir->lock); -+ return; -+ } -+ mutex_unlock(&ir->lock); -+ -+ while (timeout && (oep->urb->status == -EINPROGRESS) -+ && !(oep->send_flags & SEND_FLAG_COMPLETE)) { -+ timeout = schedule_timeout(timeout); -+ rmb(); -+ } -+ -+ dprintk(DRIVER_NAME "[%d]: send complete (%#x)\n", ir->devnum, cmd); -+ -+ set_current_state(TASK_RUNNING); -+ remove_wait_queue(&oep->wait, &wait); -+ oep->urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(oep->urb); -+} -+ -+static int unregister_from_lirc(struct xbox_dev *ir) -+{ -+ struct lirc_driver *d = ir->d; -+ int devnum; -+ -+ devnum = ir->devnum; -+ dprintk(DRIVER_NAME "[%d]: unregister from lirc called\n", devnum); -+ -+ lirc_unregister_driver(d->minor); -+ -+ printk(DRIVER_NAME "[%d]: usb remote disconnected\n", devnum); -+ return 0; -+} -+ -+static int set_use_inc(void *data) -+{ -+ struct xbox_dev *ir = data; -+ struct list_head *pos, *n; -+ struct in_endpt *iep; -+ int rtn; -+ -+ if (!ir) { -+ printk(DRIVER_NAME "[?]: set_use_inc called with no context\n"); -+ return -EIO; -+ } -+ dprintk(DRIVER_NAME "[%d]: set use inc\n", ir->devnum); -+ -+ mutex_lock(&ir->lock); -+ if (!ir->connected) { -+ if (!ir->usbdev) { -+ mutex_unlock(&ir->lock); -+ dprintk(DRIVER_NAME "[%d]: !ir->usbdev\n", ir->devnum); -+ return -ENOENT; -+ } -+ -+ /* Iterate through the inbound endpoints */ -+ list_for_each_safe(pos, n, &ir->iep_listhead) { -+ /* extract the current in_endpt */ -+ iep = get_iep_from_link(pos); -+ iep->urb->dev = ir->usbdev; -+ dprintk(DRIVER_NAME "[%d]: linking iep 0x%02x (%p)\n", -+ ir->devnum, iep->ep->bEndpointAddress, iep); -+ rtn = usb_submit_urb(iep->urb, GFP_ATOMIC); -+ if (rtn) { -+ printk(DRIVER_NAME "[%d]: open result = %d " -+ "error submitting urb\n", -+ ir->devnum, rtn); -+ mutex_unlock(&ir->lock); -+ return -EIO; -+ } -+ } -+ ir->connected = 1; -+ } -+ mutex_unlock(&ir->lock); -+ -+ return 0; -+} -+ -+static void set_use_dec(void *data) -+{ -+ struct xbox_dev *ir = data; -+ struct list_head *pos, *n; -+ struct in_endpt *iep; -+ -+ if (!ir) { -+ printk(DRIVER_NAME "[?]: set_use_dec called with no context\n"); -+ return; -+ } -+ dprintk(DRIVER_NAME "[%d]: set use dec\n", ir->devnum); -+ -+ mutex_lock(&ir->lock); -+ if (ir->connected) { -+ /* Free inbound usb urbs */ -+ list_for_each_safe(pos, n, &ir->iep_listhead) { -+ iep = get_iep_from_link(pos); -+ dprintk(DRIVER_NAME "[%d]: unlinking iep 0x%02x (%p)\n", -+ ir->devnum, iep->ep->bEndpointAddress, iep); -+ usb_kill_urb(iep->urb); -+ } -+ ir->connected = 0; -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+static void print_data(struct in_endpt *iep, char *buf, int len) -+{ -+ const int clen = CODE_LENGTH; -+ char codes[clen * 3 + 1]; -+ int i; -+ -+ if (len <= 0) -+ return; -+ -+ for (i = 0; i < len && i < clen; i++) -+ snprintf(codes+i*3, 4, "%02x ", buf[i] & 0xFF); -+ printk(DRIVER_NAME "[%d]: data received %s (ep=0x%x length=%d)\n", -+ iep->ir->devnum, codes, iep->ep->bEndpointAddress, len); -+} -+ -+static int code_check_xbox(struct in_endpt *iep, int len) -+{ -+ // struct xbox_dev *ir = iep->ir; -+ const int clen = CODE_LENGTH; -+ -+ if (len != clen) { -+ dprintk(DRIVER_NAME ": We got %d instead of %d bytes from xbox " -+ "ir.. ?\n", len, clen); -+ return -1; -+ } -+ -+ /* check for repeats */ -+ if (memcmp(iep->old, iep->buf, len) == 0) { -+ if (iep->old_jiffies + repeat_jiffies > jiffies) -+ return -1; -+ } else { -+ /* -+ * the third byte of xbox ir packet seems to contain key info -+ * the last two bytes are.. some kind of clock? -+ */ -+ iep->buf[0] = iep->buf[2]; -+ memset(iep->buf + 1, 0, len - 1); -+ memcpy(iep->old, iep->buf, len); -+ } -+ iep->old_jiffies = jiffies; -+ -+ return 0; -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) -+static void usb_remote_recv(struct urb *urb, struct pt_regs *regs) -+#else -+static void usb_remote_recv(struct urb *urb) -+#endif -+{ -+ struct in_endpt *iep; -+ int len, result = -1; -+ -+ if (!urb) -+ return; -+ iep = urb->context; -+ if (!iep) { -+ urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(urb); -+ return; -+ } -+ if (!iep->ir->usbdev) -+ return; -+ -+ len = urb->actual_length; -+ if (debug) -+ print_data(iep, urb->transfer_buffer, len); -+ -+ switch (urb->status) { -+ -+ case 0: -+ result = code_check_xbox(iep, len); -+ -+ if (result < 0) -+ break; -+ -+ lirc_buffer_write(iep->ir->d->rbuf, iep->buf); -+ wake_up(&iep->ir->d->rbuf->wait_poll); -+ break; -+ -+ case -ECONNRESET: -+ case -ENOENT: -+ case -ESHUTDOWN: -+ urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(urb); -+ return; -+ -+ case -EPIPE: -+ default: -+ break; -+ } -+ -+ usb_submit_urb(urb, GFP_ATOMIC); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) -+static void usb_remote_send(struct urb *urb, struct pt_regs *regs) -+#else -+static void usb_remote_send(struct urb *urb) -+#endif -+{ -+ struct out_endpt *oep; -+ -+ if (!urb) -+ return; -+ oep = urb->context; -+ if (!oep) { -+ urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(urb); -+ return; -+ } -+ if (!oep->ir->usbdev) -+ return; -+ -+ dprintk(DRIVER_NAME "[%d]: usb out called\n", oep->ir->devnum); -+ -+ if (urb->status) -+ return; -+ -+ oep->send_flags |= SEND_FLAG_COMPLETE; -+ wmb(); -+ if (waitqueue_active(&oep->wait)) -+ wake_up(&oep->wait); -+} -+ -+ -+/* -+ * Initialization and removal -+ */ -+ -+/* -+ * Free iep according to mem_failure which specifies a checkpoint into the -+ * initialization sequence for rollback recovery. -+ */ -+static void free_in_endpt(struct in_endpt *iep, int mem_failure) -+{ -+ struct xbox_dev *ir; -+ dprintk(DRIVER_NAME ": free_in_endpt(%p, %d)\n", iep, mem_failure); -+ if (!iep) -+ return; -+ -+ ir = iep->ir; -+ if (!ir) { -+ dprintk(DRIVER_NAME ": free_in_endpt: WARNING! null ir\n"); -+ return; -+ } -+ mutex_lock(&ir->lock); -+ switch (mem_failure) { -+ case FREE_ALL: -+ case 5: -+ list_del(&iep->iep_list_link); -+ dprintk(DRIVER_NAME "[%d]: free_in_endpt removing ep=0x%0x " -+ "from list\n", ir->devnum, iep->ep->bEndpointAddress); -+ case 4: -+ if (iep->urb) { -+ iep->urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(iep->urb); -+ usb_free_urb(iep->urb); -+ iep->urb = 0; -+ } else -+ dprintk(DRIVER_NAME "[%d]: free_in_endpt null urb!\n", -+ ir->devnum); -+ case 3: -+ usb_free_coherent(iep->ir->usbdev, iep->len, iep->buf, iep->dma); -+ iep->buf = 0; -+ case 2: -+ kfree(iep); -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+/* -+ * Construct a new inbound endpoint for this remote, and add it to the list of -+ * in_epts in ir. -+ */ -+static struct in_endpt *new_in_endpt(struct xbox_dev *ir, -+ struct usb_endpoint_descriptor *ep) -+{ -+ struct usb_device *dev = ir->usbdev; -+ struct in_endpt *iep; -+ int pipe, maxp, len, addr; -+ int mem_failure; -+ -+ addr = ep->bEndpointAddress; -+ pipe = usb_rcvintpipe(dev, addr); -+ maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); -+ -+/* len = (maxp > USB_BUFLEN) ? USB_BUFLEN : maxp; -+ * len -= (len % CODE_LENGTH); */ -+ len = CODE_LENGTH; -+ -+ dprintk(DRIVER_NAME "[%d]: acceptable inbound endpoint (0x%x) found " -+ "(maxp=%d len=%d)\n", ir->devnum, addr, maxp, len); -+ -+ mem_failure = 0; -+ iep = kzalloc(sizeof(*iep), GFP_KERNEL); -+ if (!iep) { -+ mem_failure = 1; -+ goto new_in_endpt_failure_check; -+ } -+ iep->ir = ir; -+ iep->ep = ep; -+ iep->len = len; -+ -+ iep->buf = usb_alloc_coherent(dev, len, GFP_ATOMIC, &iep->dma); -+ if (!iep->buf) { -+ mem_failure = 2; -+ goto new_in_endpt_failure_check; -+ } -+ -+ iep->urb = usb_alloc_urb(0, GFP_KERNEL); -+ if (!iep->urb) -+ mem_failure = 3; -+ -+new_in_endpt_failure_check: -+ -+ if (mem_failure) { -+ free_in_endpt(iep, mem_failure); -+ printk(DRIVER_NAME "[%d]: ep=0x%x out of memory (code=%d)\n", -+ ir->devnum, addr, mem_failure); -+ return NULL; -+ } -+ list_add_tail(&iep->iep_list_link, &ir->iep_listhead); -+ dprintk(DRIVER_NAME "[%d]: adding ep=0x%0x to list\n", -+ ir->devnum, iep->ep->bEndpointAddress); -+ return iep; -+} -+ -+static void free_out_endpt(struct out_endpt *oep, int mem_failure) -+{ -+ struct xbox_dev *ir; -+ dprintk(DRIVER_NAME ": free_out_endpt(%p, %d)\n", oep, mem_failure); -+ if (!oep) -+ return; -+ -+ wake_up_all(&oep->wait); -+ -+ ir = oep->ir; -+ if (!ir) { -+ dprintk(DRIVER_NAME ": free_out_endpt: WARNING! null ir\n"); -+ return; -+ } -+ mutex_lock(&ir->lock); -+ switch (mem_failure) { -+ case FREE_ALL: -+ case 4: -+ if (oep->urb) { -+ oep->urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(oep->urb); -+ usb_free_urb(oep->urb); -+ oep->urb = 0; -+ } else { -+ dprintk(DRIVER_NAME "[%d]: free_out_endpt: null urb!\n", -+ ir->devnum); -+ } -+ case 3: -+ usb_free_coherent(oep->ir->usbdev, USB_OUTLEN, -+ oep->buf, oep->dma); -+ oep->buf = 0; -+ case 2: -+ kfree(oep); -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+static struct out_endpt *new_out_endpt(struct xbox_dev *ir, -+ struct usb_endpoint_descriptor *ep) -+{ -+ struct usb_device *dev = ir->usbdev; -+ struct out_endpt *oep; -+ int mem_failure; -+ -+ dprintk(DRIVER_NAME "[%d]: acceptable outbound endpoint (0x%x) found\n", -+ ir->devnum, ep->bEndpointAddress); -+ -+ mem_failure = 0; -+ oep = kzalloc(sizeof(*oep), GFP_KERNEL); -+ if (!oep) -+ mem_failure = 1; -+ else { -+ oep->ir = ir; -+ oep->ep = ep; -+ init_waitqueue_head(&oep->wait); -+ -+ oep->buf = usb_alloc_coherent(dev, USB_OUTLEN, -+ GFP_ATOMIC, &oep->dma); -+ if (!oep->buf) -+ mem_failure = 2; -+ else { -+ oep->urb = usb_alloc_urb(0, GFP_KERNEL); -+ if (!oep->urb) -+ mem_failure = 3; -+ } -+ } -+ if (mem_failure) { -+ free_out_endpt(oep, mem_failure); -+ printk(DRIVER_NAME "[%d]: ep=0x%x out of memory (code=%d)\n", -+ ir->devnum, ep->bEndpointAddress, mem_failure); -+ return NULL; -+ } -+ return oep; -+} -+ -+static void free_irctl(struct xbox_dev *ir, int mem_failure) -+{ -+ struct list_head *pos, *n; -+ struct in_endpt *in; -+ dprintk(DRIVER_NAME ": free_irctl(%p, %d)\n", ir, mem_failure); -+ -+ if (!ir) -+ return; -+ -+ list_for_each_safe(pos, n, &ir->iep_listhead) { -+ in = get_iep_from_link(pos); -+ free_in_endpt(in, FREE_ALL); -+ } -+ if (ir->out_init) { -+ free_out_endpt(ir->out_init, FREE_ALL); -+ ir->out_init = NULL; -+ } -+ -+ mutex_lock(&ir->lock); -+ switch (mem_failure) { -+ case FREE_ALL: -+ case 6: -+ if (!--ir->dev_refcount) { -+ list_del(&ir->remote_list_link); -+ dprintk(DRIVER_NAME "[%d]: free_irctl: removing " -+ "remote from list\n", ir->devnum); -+ } else { -+ dprintk(DRIVER_NAME "[%d]: free_irctl: refcount at %d," -+ "aborting free_irctl\n", -+ ir->devnum, ir->dev_refcount); -+ mutex_unlock(&ir->lock); -+ return; -+ } -+ case 5: -+ case 4: -+ case 3: -+ if (ir->d) { -+ switch (mem_failure) { -+ case 5: -+ lirc_buffer_free(ir->d->rbuf); -+ case 4: -+ kfree(ir->d->rbuf); -+ case 3: -+ kfree(ir->d); -+ } -+ } else -+ printk(DRIVER_NAME "[%d]: ir->d is a null pointer!\n", -+ ir->devnum); -+ case 2: -+ mutex_unlock(&ir->lock); -+ kfree(ir); -+ return; -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+static struct xbox_dev *new_irctl(struct usb_interface *intf) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ struct xbox_dev *ir; -+ struct lirc_driver *driver; -+ int devnum, dclen; -+ int mem_failure; -+ -+ devnum = dev->devnum; -+ -+ dprintk(DRIVER_NAME "[%d]: remote type = XBOX DVD Dongle\n", devnum); -+ -+ mem_failure = 0; -+ ir = kzalloc(sizeof(*ir), GFP_KERNEL); -+ if (!ir) { -+ mem_failure = 1; -+ goto new_irctl_failure_check; -+ } -+ -+ dclen = DECODE_LENGTH; -+ -+ /* -+ * add this infrared remote struct to remote_list, keeping track -+ * of the number of drivers registered. -+ */ -+ dprintk(DRIVER_NAME "[%d]: adding remote to list\n", devnum); -+ list_add_tail(&ir->remote_list_link, &remote_list); -+ ir->dev_refcount = 1; -+ -+ driver = kzalloc(sizeof(*driver), GFP_KERNEL); -+ if (!driver) { -+ mem_failure = 2; -+ goto new_irctl_failure_check; -+ } -+ -+ ir->d = driver; -+ driver->rbuf = kmalloc(sizeof(*(driver->rbuf)), GFP_KERNEL); -+ if (!driver->rbuf) { -+ mem_failure = 3; -+ goto new_irctl_failure_check; -+ } -+ -+ if (lirc_buffer_init(driver->rbuf, dclen, 2)) { -+ mem_failure = 4; -+ goto new_irctl_failure_check; -+ } -+ -+ strcpy(driver->name, DRIVER_NAME " "); -+ driver->minor = -1; -+ driver->code_length = dclen * 8; -+ driver->features = LIRC_CAN_REC_LIRCCODE; -+ driver->data = ir; -+ driver->set_use_inc = &set_use_inc; -+ driver->set_use_dec = &set_use_dec; -+ driver->dev = &intf->dev; -+ driver->owner = THIS_MODULE; -+ ir->usbdev = dev; -+ ir->devnum = devnum; -+ -+ mutex_init(&ir->lock); -+ INIT_LIST_HEAD(&ir->iep_listhead); -+ -+new_irctl_failure_check: -+ -+ if (mem_failure) { -+ free_irctl(ir, mem_failure); -+ printk(DRIVER_NAME "[%d]: out of memory (code=%d)\n", -+ devnum, mem_failure); -+ return NULL; -+ } -+ return ir; -+} -+ -+/* -+ * Scan the global list of remotes to see if the device listed is one of them. -+ * If it is, the corresponding xbox_dev is returned, with its dev_refcount -+ * incremented. Otherwise, returns null. -+ */ -+static struct xbox_dev *get_prior_reg_ir(struct usb_device *dev) -+{ -+ struct list_head *pos; -+ struct xbox_dev *ir = NULL; -+ -+ dprintk(DRIVER_NAME "[%d]: scanning remote_list...\n", dev->devnum); -+ list_for_each(pos, &remote_list) { -+ ir = get_irctl_from_link(pos); -+ if (ir->usbdev != dev) { -+ dprintk(DRIVER_NAME "[%d]: device %d isn't it...", -+ dev->devnum, ir->devnum); -+ ir = NULL; -+ } else { -+ dprintk(DRIVER_NAME "[%d]: prior instance found.\n", -+ dev->devnum); -+ ir->dev_refcount++; -+ break; -+ } -+ } -+ return ir; -+} -+ -+/* -+ * If the USB interface has an out endpoint for control. -+ */ -+static void send_outbound_init(struct xbox_dev *ir) -+{ -+ if (ir->out_init) { -+ struct out_endpt *oep = ir->out_init; -+ dprintk(DRIVER_NAME "[%d]: usb_remote_probe: initializing " -+ "outbound ep\n", ir->devnum); -+ usb_fill_int_urb(oep->urb, ir->usbdev, -+ usb_sndintpipe(ir->usbdev, oep->ep->bEndpointAddress), -+ oep->buf, USB_OUTLEN, usb_remote_send, -+ oep, oep->ep->bInterval); -+ oep->urb->transfer_dma = oep->dma; -+ oep->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; -+ -+ send_packet(oep, 0x8004, init1); -+ send_packet(oep, 0x8007, init2); -+ } -+} -+ -+/* Log driver and usb info */ -+static void log_usb_dev_info(struct usb_device *dev) -+{ -+ char buf[63], name[128] = ""; -+ -+ if (dev->descriptor.iManufacturer -+ && usb_string(dev, dev->descriptor.iManufacturer, -+ buf, sizeof(buf)) > 0) -+ strlcpy(name, buf, sizeof(name)); -+ if (dev->descriptor.iProduct -+ && usb_string(dev, dev->descriptor.iProduct, buf, sizeof(buf)) > 0) -+ snprintf(name + strlen(name), sizeof(name) - strlen(name), -+ " %s", buf); -+ printk(DRIVER_NAME "[%d]: %s on usb%d:%d\n", dev->devnum, name, -+ dev->bus->busnum, dev->devnum); -+} -+ -+ -+static int usb_remote_probe(struct usb_interface *intf, -+ const struct usb_device_id *id) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ struct usb_host_interface *idesc; -+ struct usb_endpoint_descriptor *ep; -+ struct in_endpt *iep; -+ struct xbox_dev *ir; -+ int i; -+ -+ dprintk(DRIVER_NAME "[%d]: usb_remote_probe: dev:%p, intf:%p, id:%p)\n", -+ dev->devnum, dev, intf, id); -+ -+ idesc = intf->cur_altsetting; -+ -+ /* Check if a usb remote has already been registered for this device */ -+ ir = get_prior_reg_ir(dev); -+ -+ if (!ir) { -+ ir = new_irctl(intf); -+ if (!ir) -+ return -ENOMEM; -+ } -+ -+ /* -+ * step through the endpoints to find first in and first out endpoint -+ * of type interrupt transfer -+ */ -+ for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { -+ ep = &idesc->endpoint[i].desc; -+ dprintk(DRIVER_NAME "[%d]: processing endpoint %d\n", -+ dev->devnum, i); -+ if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == -+ USB_DIR_IN) && -+ ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == -+ USB_ENDPOINT_XFER_INT)) { -+ -+ iep = new_in_endpt(ir, ep); -+ if (iep) -+ { -+ usb_fill_int_urb(iep->urb, dev, -+ usb_rcvintpipe(dev, -+ iep->ep->bEndpointAddress), -+ iep->buf, iep->len, usb_remote_recv, -+ iep, iep->ep->bInterval); -+ iep->urb->transfer_dma = iep->dma; -+ iep->urb->transfer_flags |= -+ URB_NO_TRANSFER_DMA_MAP; -+ } -+ } -+ -+ if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == -+ USB_DIR_OUT) && -+ ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == -+ USB_ENDPOINT_XFER_INT) && -+ (ir->out_init == NULL)) -+ ir->out_init = new_out_endpt(ir, ep); -+ } -+ if (list_empty(&ir->iep_listhead)) { -+ printk(DRIVER_NAME "[%d]: inbound endpoint not found\n", -+ ir->devnum); -+ free_irctl(ir, FREE_ALL); -+ return -ENODEV; -+ } -+ if (ir->dev_refcount == 1) { -+ ir->d->minor = lirc_register_driver(ir->d); -+ if (ir->d->minor < 0) { -+ free_irctl(ir, FREE_ALL); -+ return -ENODEV; -+ } -+ -+ /* Note new driver registration in kernel logs */ -+ log_usb_dev_info(dev); -+ -+ /* outbound data (initialization) */ -+ send_outbound_init(ir); -+ } -+ -+ usb_set_intfdata(intf, ir); -+ return 0; -+} -+ -+static void usb_remote_disconnect(struct usb_interface *intf) -+{ -+ /* struct usb_device *dev = interface_to_usbdev(intf); */ -+ struct xbox_dev *ir = usb_get_intfdata(intf); -+ usb_set_intfdata(intf, NULL); -+ -+ dprintk(DRIVER_NAME ": disconnecting remote %d:\n", -+ (ir ? ir->devnum : -1)); -+ if (!ir || !ir->d) -+ return; -+ -+ if (ir->usbdev) { -+ /* Only unregister once */ -+ ir->usbdev = NULL; -+ unregister_from_lirc(ir); -+ } -+ -+ /* This also removes the current remote from remote_list */ -+ free_irctl(ir, FREE_ALL); -+} -+ -+static struct usb_driver usb_remote_driver = { -+ .name = DRIVER_NAME, -+ .probe = usb_remote_probe, -+ .disconnect = usb_remote_disconnect, -+ .id_table = usb_remote_table -+}; -+ -+static int __init usb_remote_init(void) -+{ -+ int i; -+ -+ INIT_LIST_HEAD(&remote_list); -+ -+ printk(KERN_INFO "\n" DRIVER_NAME ": " DRIVER_DESC " " -+ DRIVER_VERSION "\n"); -+ printk(DRIVER_NAME ": " DRIVER_AUTHOR "\n"); -+ dprintk(DRIVER_NAME ": debug mode enabled: " -+ "$Id: lirc_xbox.c,v 1.88 2011/06/05 11:11:11 jmartin Exp $\n"); -+ -+ repeat_jiffies = repeat*HZ/100; -+ -+ i = usb_register(&usb_remote_driver); -+ if (i) { -+ printk(DRIVER_NAME ": usb register failed, result = %d\n", i); -+ return -ENODEV; -+ } -+ -+ return 0; -+} -+ -+static void __exit usb_remote_exit(void) -+{ -+ usb_deregister(&usb_remote_driver); -+} -+ -+module_init(usb_remote_init); -+module_exit(usb_remote_exit); -+ -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_AUTHOR(DRIVER_AUTHOR); -+MODULE_LICENSE("GPL"); -+MODULE_DEVICE_TABLE(usb, usb_remote_table); -+ -+module_param(debug, uint, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(debug, "Debug enabled or not (default: 0)"); -+ -+module_param(mask, uint, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(mask, "Set channel acceptance bit mask (default: 0xFFFF)"); -+ -+module_param(unique, uint, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(unique, "Enable channel-specific codes (default: 0)"); -+ -+module_param(repeat, uint, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(repeat, "Repeat timeout (1/100 sec) (default: 10)"); -diff -Naur linux-3.9.4/drivers/staging/media/lirc/Makefile linux-3.9.4.patch/drivers/staging/media/lirc/Makefile ---- linux-3.9.4/drivers/staging/media/lirc/Makefile 2013-05-24 20:45:59.000000000 +0200 -+++ linux-3.9.4.patch/drivers/staging/media/lirc/Makefile 2013-05-30 18:17:39.163634834 +0200 -@@ -10,4 +10,5 @@ - obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o - obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o - obj-$(CONFIG_LIRC_SIR) += lirc_sir.o -+obj-$(CONFIG_LIRC_XBOX) += lirc_xbox.o - obj-$(CONFIG_LIRC_ZILOG) += lirc_zilog.o diff --git a/packages/linux/patches/default/linux-052-xbox_dvd_remote_support.patch b/packages/linux/patches/default/linux-052-xbox_dvd_remote_support.patch new file mode 100644 index 0000000000..8db97ddb2f --- /dev/null +++ b/packages/linux/patches/default/linux-052-xbox_dvd_remote_support.patch @@ -0,0 +1,466 @@ +From 4d331d301222dc0585ab8864a842b3e460b1f744 Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Thu, 4 Oct 2018 02:57:10 +0200 +Subject: [PATCH] media: rc: add driver for Xbox DVD Movie Playback Kit + +The Xbox DVD Movie Playback Kit is a USB dongle with an IR remote for the +Original Xbox. + +Historically it has been supported by the out-of-tree lirc_xbox driver, +but this one has fallen out of favour and was just dropped from popular +Kodi (formerly XBMC) distributions. + +This driver is heaviely based on the ati_remote driver where all the +boilerplate was taken from - I was mostly just removing code. + +Signed-off-by: Benjamin Valentin +Signed-off-by: Sean Young +--- + drivers/media/rc/Kconfig | 12 + + drivers/media/rc/Makefile | 1 + + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-xbox-dvd.c | 63 +++++ + drivers/media/rc/xbox_remote.c | 306 +++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 6 files changed, 384 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-xbox-dvd.c + create mode 100644 drivers/media/rc/xbox_remote.c + +diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig +index 1021c08a9ba4..8a216068a35a 100644 +--- a/drivers/media/rc/Kconfig ++++ b/drivers/media/rc/Kconfig +@@ -493,6 +493,18 @@ config IR_TANGO + The HW decoder supports NEC, RC-5, RC-6 IR protocols. + When compiled as a module, look for tango-ir. + ++config RC_XBOX_DVD ++ tristate "Xbox DVD Movie Playback Kit" ++ depends on RC_CORE ++ depends on USB_ARCH_HAS_HCD ++ select USB ++ help ++ Say Y here if you want to use the Xbox DVD Movie Playback Kit. ++ These are IR remotes with USB receivers for the Original Xbox (2001). ++ ++ To compile this driver as a module, choose M here: the module will be ++ called xbox_remote. ++ + config IR_ZX + tristate "ZTE ZX IR remote control" + depends on RC_CORE +diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile +index e0340d043fe8..92c163816849 100644 +--- a/drivers/media/rc/Makefile ++++ b/drivers/media/rc/Makefile +@@ -48,3 +48,4 @@ obj-$(CONFIG_IR_SIR) += sir_ir.o + obj-$(CONFIG_IR_MTK) += mtk-cir.o + obj-$(CONFIG_IR_ZX) += zx-irdec.o + obj-$(CONFIG_IR_TANGO) += tango-ir.o ++obj-$(CONFIG_RC_XBOX_DVD) += xbox_remote.o +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index d6b913a3032d..5b1399af6b3a 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -116,4 +116,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-winfast.o \ + rc-winfast-usbii-deluxe.o \ + rc-su3000.o \ ++ rc-xbox-dvd.o \ + rc-zx-irdec.o +diff --git a/drivers/media/rc/keymaps/rc-xbox-dvd.c b/drivers/media/rc/keymaps/rc-xbox-dvd.c +new file mode 100644 +index 000000000000..af387244636b +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-xbox-dvd.c +@@ -0,0 +1,63 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++// Keytable for Xbox DVD remote ++// Copyright (c) 2018 by Benjamin Valentin ++ ++#include ++#include ++ ++/* based on lircd.conf.xbox */ ++static struct rc_map_table xbox_dvd[] = { ++ {0xa0b, KEY_OK}, ++ {0xaa6, KEY_UP}, ++ {0xaa7, KEY_DOWN}, ++ {0xaa8, KEY_RIGHT}, ++ {0xaa9, KEY_LEFT}, ++ {0xac3, KEY_INFO}, ++ ++ {0xac6, KEY_9}, ++ {0xac7, KEY_8}, ++ {0xac8, KEY_7}, ++ {0xac9, KEY_6}, ++ {0xaca, KEY_5}, ++ {0xacb, KEY_4}, ++ {0xacc, KEY_3}, ++ {0xacd, KEY_2}, ++ {0xace, KEY_1}, ++ {0xacf, KEY_0}, ++ ++ {0xad5, KEY_ANGLE}, ++ {0xad8, KEY_BACK}, ++ {0xadd, KEY_PREVIOUSSONG}, ++ {0xadf, KEY_NEXTSONG}, ++ {0xae0, KEY_STOP}, ++ {0xae2, KEY_REWIND}, ++ {0xae3, KEY_FASTFORWARD}, ++ {0xae5, KEY_TITLE}, ++ {0xae6, KEY_PAUSE}, ++ {0xaea, KEY_PLAY}, ++ {0xaf7, KEY_MENU}, ++}; ++ ++static struct rc_map_list xbox_dvd_map = { ++ .map = { ++ .scan = xbox_dvd, ++ .size = ARRAY_SIZE(xbox_dvd), ++ .rc_proto = RC_PROTO_UNKNOWN, ++ .name = RC_MAP_XBOX_DVD, ++ } ++}; ++ ++static int __init init_rc_map(void) ++{ ++ return rc_map_register(&xbox_dvd_map); ++} ++ ++static void __exit exit_rc_map(void) ++{ ++ rc_map_unregister(&xbox_dvd_map); ++} ++ ++module_init(init_rc_map) ++module_exit(exit_rc_map) ++ ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/rc/xbox_remote.c b/drivers/media/rc/xbox_remote.c +new file mode 100644 +index 000000000000..07ed9be24a60 +--- /dev/null ++++ b/drivers/media/rc/xbox_remote.c +@@ -0,0 +1,306 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++// Driver for Xbox DVD Movie Playback Kit ++// Copyright (c) 2018 by Benjamin Valentin ++ ++/* ++ * Xbox DVD Movie Playback Kit USB IR dongle support ++ * ++ * The driver was derived from the ati_remote driver 2.2.1 ++ * and used information from lirc_xbox.c ++ * ++ * Copyright (c) 2011, 2012 Anssi Hannula ++ * Copyright (c) 2004 Torrey Hoffman ++ * Copyright (c) 2002 Vladimir Dergachev ++ * Copyright (c) 2003-2004 Paul Miller ++ */ ++ ++#include ++#include ++#include ++#include ++ ++/* ++ * Module and Version Information ++ */ ++#define DRIVER_VERSION "1.0.0" ++#define DRIVER_AUTHOR "Benjamin Valentin " ++#define DRIVER_DESC "Xbox DVD USB Remote Control" ++ ++#define NAME_BUFSIZE 80 /* size of product name, path buffers */ ++#define DATA_BUFSIZE 8 /* size of URB data buffers */ ++ ++/* ++ * USB vendor ids for XBOX DVD Dongles ++ */ ++#define VENDOR_GAMESTER 0x040b ++#define VENDOR_MICROSOFT 0x045e ++ ++static const struct usb_device_id xbox_remote_table[] = { ++ /* Gamester Xbox DVD Movie Playback Kit IR */ ++ { ++ USB_DEVICE(VENDOR_GAMESTER, 0x6521), ++ }, ++ /* Microsoft Xbox DVD Movie Playback Kit IR */ ++ { ++ USB_DEVICE(VENDOR_MICROSOFT, 0x0284), ++ }, ++ {} /* Terminating entry */ ++}; ++ ++MODULE_DEVICE_TABLE(usb, xbox_remote_table); ++ ++struct xbox_remote { ++ struct rc_dev *rdev; ++ struct usb_device *udev; ++ struct usb_interface *interface; ++ ++ struct urb *irq_urb; ++ unsigned char inbuf[DATA_BUFSIZE] __aligned(sizeof(u16)); ++ ++ char rc_name[NAME_BUFSIZE]; ++ char rc_phys[NAME_BUFSIZE]; ++}; ++ ++static int xbox_remote_rc_open(struct rc_dev *rdev) ++{ ++ struct xbox_remote *xbox_remote = rdev->priv; ++ ++ /* On first open, submit the read urb which was set up previously. */ ++ xbox_remote->irq_urb->dev = xbox_remote->udev; ++ if (usb_submit_urb(xbox_remote->irq_urb, GFP_KERNEL)) { ++ dev_err(&xbox_remote->interface->dev, ++ "%s: usb_submit_urb failed!\n", __func__); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++static void xbox_remote_rc_close(struct rc_dev *rdev) ++{ ++ struct xbox_remote *xbox_remote = rdev->priv; ++ ++ usb_kill_urb(xbox_remote->irq_urb); ++} ++ ++/* ++ * xbox_remote_report_input ++ */ ++static void xbox_remote_input_report(struct urb *urb) ++{ ++ struct xbox_remote *xbox_remote = urb->context; ++ unsigned char *data = xbox_remote->inbuf; ++ ++ /* ++ * data[0] = 0x00 ++ * data[1] = length - always 0x06 ++ * data[2] = the key code ++ * data[3] = high part of key code ++ * data[4] = last_press_ms (low) ++ * data[5] = last_press_ms (high) ++ */ ++ ++ /* Deal with strange looking inputs */ ++ if (urb->actual_length != 6 || urb->actual_length != data[1]) { ++ dev_warn(&urb->dev->dev, "Weird data, len=%d: %*ph\n", ++ urb->actual_length, urb->actual_length, data); ++ return; ++ } ++ ++ rc_keydown(xbox_remote->rdev, RC_PROTO_UNKNOWN, ++ le16_to_cpup((__le16*)(data + 2)), 0); ++} ++ ++/* ++ * xbox_remote_irq_in ++ */ ++static void xbox_remote_irq_in(struct urb *urb) ++{ ++ struct xbox_remote *xbox_remote = urb->context; ++ int retval; ++ ++ switch (urb->status) { ++ case 0: /* success */ ++ xbox_remote_input_report(urb); ++ break; ++ case -ECONNRESET: /* unlink */ ++ case -ENOENT: ++ case -ESHUTDOWN: ++ dev_dbg(&xbox_remote->interface->dev, ++ "%s: urb error status, unlink?\n", ++ __func__); ++ return; ++ default: /* error */ ++ dev_dbg(&xbox_remote->interface->dev, ++ "%s: Nonzero urb status %d\n", ++ __func__, urb->status); ++ } ++ ++ retval = usb_submit_urb(urb, GFP_ATOMIC); ++ if (retval) ++ dev_err(&xbox_remote->interface->dev, ++ "%s: usb_submit_urb()=%d\n", ++ __func__, retval); ++} ++ ++static void xbox_remote_rc_init(struct xbox_remote *xbox_remote) ++{ ++ struct rc_dev *rdev = xbox_remote->rdev; ++ ++ rdev->priv = xbox_remote; ++ rdev->allowed_protocols = RC_PROTO_BIT_UNKNOWN; ++ rdev->driver_name = "xbox_remote"; ++ ++ rdev->open = xbox_remote_rc_open; ++ rdev->close = xbox_remote_rc_close; ++ ++ rdev->device_name = xbox_remote->rc_name; ++ rdev->input_phys = xbox_remote->rc_phys; ++ ++ usb_to_input_id(xbox_remote->udev, &rdev->input_id); ++ rdev->dev.parent = &xbox_remote->interface->dev; ++} ++ ++static int xbox_remote_initialize(struct xbox_remote *xbox_remote, ++ struct usb_endpoint_descriptor *endpoint_in) ++{ ++ struct usb_device *udev = xbox_remote->udev; ++ int pipe, maxp; ++ ++ /* Set up irq_urb */ ++ pipe = usb_rcvintpipe(udev, endpoint_in->bEndpointAddress); ++ maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); ++ maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp; ++ ++ usb_fill_int_urb(xbox_remote->irq_urb, udev, pipe, xbox_remote->inbuf, ++ maxp, xbox_remote_irq_in, xbox_remote, ++ endpoint_in->bInterval); ++ ++ return 0; ++} ++ ++/* ++ * xbox_remote_probe ++ */ ++static int xbox_remote_probe(struct usb_interface *interface, ++ const struct usb_device_id *id) ++{ ++ struct usb_device *udev = interface_to_usbdev(interface); ++ struct usb_host_interface *iface_host = interface->cur_altsetting; ++ struct usb_endpoint_descriptor *endpoint_in; ++ struct xbox_remote *xbox_remote; ++ struct rc_dev *rc_dev; ++ int err = -ENOMEM; ++ ++ // why is there also a device with no endpoints? ++ if (iface_host->desc.bNumEndpoints == 0) ++ return -ENODEV; ++ ++ if (iface_host->desc.bNumEndpoints != 1) { ++ pr_err("%s: Unexpected desc.bNumEndpoints: %d\n", ++ __func__, iface_host->desc.bNumEndpoints); ++ return -ENODEV; ++ } ++ ++ endpoint_in = &iface_host->endpoint[0].desc; ++ ++ if (!usb_endpoint_is_int_in(endpoint_in)) { ++ pr_err("%s: Unexpected endpoint_in\n", __func__); ++ return -ENODEV; ++ } ++ if (le16_to_cpu(endpoint_in->wMaxPacketSize) == 0) { ++ pr_err("%s: endpoint_in message size==0?\n", __func__); ++ return -ENODEV; ++ } ++ ++ xbox_remote = kzalloc(sizeof(*xbox_remote), GFP_KERNEL); ++ rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); ++ if (!xbox_remote || !rc_dev) ++ goto exit_free_dev_rdev; ++ ++ /* Allocate URB buffer */ ++ xbox_remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); ++ if (!xbox_remote->irq_urb) ++ goto exit_free_buffers; ++ ++ xbox_remote->udev = udev; ++ xbox_remote->rdev = rc_dev; ++ xbox_remote->interface = interface; ++ ++ usb_make_path(udev, xbox_remote->rc_phys, sizeof(xbox_remote->rc_phys)); ++ ++ strlcat(xbox_remote->rc_phys, "/input0", sizeof(xbox_remote->rc_phys)); ++ ++ snprintf(xbox_remote->rc_name, sizeof(xbox_remote->rc_name), "%s%s%s", ++ udev->manufacturer ?: "", ++ udev->manufacturer && udev->product ? " " : "", ++ udev->product ?: ""); ++ ++ if (!strlen(xbox_remote->rc_name)) ++ snprintf(xbox_remote->rc_name, sizeof(xbox_remote->rc_name), ++ DRIVER_DESC "(%04x,%04x)", ++ le16_to_cpu(xbox_remote->udev->descriptor.idVendor), ++ le16_to_cpu(xbox_remote->udev->descriptor.idProduct)); ++ ++ rc_dev->map_name = RC_MAP_XBOX_DVD; /* default map */ ++ ++ xbox_remote_rc_init(xbox_remote); ++ ++ /* Device Hardware Initialization */ ++ err = xbox_remote_initialize(xbox_remote, endpoint_in); ++ if (err) ++ goto exit_kill_urbs; ++ ++ /* Set up and register rc device */ ++ err = rc_register_device(xbox_remote->rdev); ++ if (err) ++ goto exit_kill_urbs; ++ ++ usb_set_intfdata(interface, xbox_remote); ++ ++ return 0; ++ ++exit_kill_urbs: ++ usb_kill_urb(xbox_remote->irq_urb); ++exit_free_buffers: ++ usb_free_urb(xbox_remote->irq_urb); ++exit_free_dev_rdev: ++ rc_free_device(rc_dev); ++ kfree(xbox_remote); ++ ++ return err; ++} ++ ++/* ++ * xbox_remote_disconnect ++ */ ++static void xbox_remote_disconnect(struct usb_interface *interface) ++{ ++ struct xbox_remote *xbox_remote; ++ ++ xbox_remote = usb_get_intfdata(interface); ++ usb_set_intfdata(interface, NULL); ++ if (!xbox_remote) { ++ dev_warn(&interface->dev, "%s - null device?\n", __func__); ++ return; ++ } ++ ++ usb_kill_urb(xbox_remote->irq_urb); ++ rc_unregister_device(xbox_remote->rdev); ++ usb_free_urb(xbox_remote->irq_urb); ++ kfree(xbox_remote); ++} ++ ++/* usb specific object to register with the usb subsystem */ ++static struct usb_driver xbox_remote_driver = { ++ .name = "xbox_remote", ++ .probe = xbox_remote_probe, ++ .disconnect = xbox_remote_disconnect, ++ .id_table = xbox_remote_table, ++}; ++ ++module_usb_driver(xbox_remote_driver); ++ ++MODULE_AUTHOR(DRIVER_AUTHOR); ++MODULE_DESCRIPTION(DRIVER_DESC); ++MODULE_LICENSE("GPL"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index bfa3017cecba..d621acadfbf3 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name); + #define RC_MAP_WINFAST "rc-winfast" + #define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" + #define RC_MAP_SU3000 "rc-su3000" ++#define RC_MAP_XBOX_DVD "rc-xbox-dvd" + #define RC_MAP_ZX_IRDEC "rc-zx-irdec" + + /* +-- +2.17.1 + diff --git a/packages/linux/patches/default/linux-053-spinelplus-remote-0.2.patch b/packages/linux/patches/default/linux-053-spinelplus-remote-0.2.patch deleted file mode 100644 index ca86427992..0000000000 --- a/packages/linux/patches/default/linux-053-spinelplus-remote-0.2.patch +++ /dev/null @@ -1,164 +0,0 @@ -diff -Naur linux-3.19/drivers/hid/hid-core.c linux-3.19.patch/drivers/hid/hid-core.c ---- linux-3.19/drivers/hid/hid-core.c 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19.patch/drivers/hid/hid-core.c 2015-02-11 00:06:14.966131308 +0100 -@@ -1886,6 +1886,10 @@ - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_4) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, - #if IS_ENABLED(CONFIG_HID_ROCCAT) -diff -Naur linux-3.19/drivers/hid/hid-ids.h linux-3.19.patch/drivers/hid/hid-ids.h ---- linux-3.19/drivers/hid/hid-ids.h 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19.patch/drivers/hid/hid-ids.h 2015-02-11 00:04:45.885977057 +0100 -@@ -743,6 +743,10 @@ - - #define USB_VENDOR_ID_PHILIPS 0x0471 - #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617 -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1 0x206c -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2 0x20cc -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3 0x0613 -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_4 0x2168 - - #define USB_VENDOR_ID_PI_ENGINEERING 0x05f3 - #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff -diff -Naur linux-3.19/drivers/hid/hid-spinelplus.c linux-3.19.patch/drivers/hid/hid-spinelplus.c ---- linux-3.19/drivers/hid/hid-spinelplus.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.19.patch/drivers/hid/hid-spinelplus.c 2015-02-11 00:04:45.886977059 +0100 -@@ -0,0 +1,104 @@ -+/* -+ * HID driver for "PHILIPS MCE USB IR Receiver- Spinel plus" remotes -+ * -+ * Copyright (c) 2010 Panagiotis Skintzos -+ * -+ * Renamed to Spinel, cleanup and modified to also support -+ * Spinel Plus 0471:20CC by Stephan Raue 2012. -+ */ -+ -+/* -+ * 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 "hid-ids.h" -+ -+#define spinelplus_map_key(c) set_bit(EV_REP, hi->input->evbit); \ -+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) -+ -+static int spinelplus_input_mapping(struct hid_device *hdev, -+ struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, -+ unsigned long **bit, int *max) -+{ -+ switch (usage->hid) { -+ case 0xffbc000d: spinelplus_map_key(KEY_MEDIA); break; -+ case 0xffbc0024: spinelplus_map_key(KEY_MEDIA); break; -+ case 0xffbc0027: spinelplus_map_key(KEY_ZOOM); break; -+ case 0xffbc0033: spinelplus_map_key(KEY_HOME); break; -+ case 0xffbc0035: spinelplus_map_key(KEY_CAMERA); break; -+ case 0xffbc0036: spinelplus_map_key(KEY_EPG); break; -+ case 0xffbc0037: spinelplus_map_key(KEY_DVD); break; -+ case 0xffbc0038: spinelplus_map_key(KEY_HOME); break; -+ case 0xffbc0039: spinelplus_map_key(KEY_MP3); break; -+ case 0xffbc003a: spinelplus_map_key(KEY_VIDEO); break; -+ case 0xffbc005a: spinelplus_map_key(KEY_TEXT); break; -+ case 0xffbc005b: spinelplus_map_key(KEY_RED); break; -+ case 0xffbc005c: spinelplus_map_key(KEY_GREEN); break; -+ case 0xffbc005d: spinelplus_map_key(KEY_YELLOW); break; -+ case 0xffbc005e: spinelplus_map_key(KEY_BLUE); break; -+ default: -+ return 0; -+ } -+ return 1; -+} -+ -+static int spinelplus_probe(struct hid_device *hdev, -+ const struct hid_device_id *id) -+{ -+ int ret; -+ /* Connect only to hid input (not hiddev & hidraw)*/ -+ unsigned int cmask = HID_CONNECT_HIDINPUT; -+ -+ ret = hid_parse(hdev); -+ if (ret) { -+ dev_err(&hdev->dev, "parse failed\n"); -+ goto err_free; -+ } -+ -+ ret = hid_hw_start(hdev, cmask); -+ if (ret) { -+ dev_err(&hdev->dev, "hw start failed\n"); -+ goto err_free; -+ } -+ -+ return 0; -+err_free: -+ return ret; -+} -+ -+static const struct hid_device_id spinelplus_devices[] = { -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_4) }, -+ { } -+}; -+MODULE_DEVICE_TABLE(hid, spinelplus_devices); -+ -+static struct hid_driver spinelplus_driver = { -+ .name = "SpinelPlus", -+ .id_table = spinelplus_devices, -+ .input_mapping = spinelplus_input_mapping, -+ .probe = spinelplus_probe, -+}; -+ -+static int __init spinelplus_init(void) -+{ -+ return hid_register_driver(&spinelplus_driver); -+} -+ -+static void __exit spinelplus_exit(void) -+{ -+ hid_unregister_driver(&spinelplus_driver); -+} -+ -+module_init(spinelplus_init); -+module_exit(spinelplus_exit); -+MODULE_LICENSE("GPL"); -diff -Naur linux-3.19/drivers/hid/Kconfig linux-3.19.patch/drivers/hid/Kconfig ---- linux-3.19/drivers/hid/Kconfig 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19.patch/drivers/hid/Kconfig 2015-02-11 00:04:45.886977059 +0100 -@@ -702,6 +702,12 @@ - ---help--- - Support for Steelseries SRW-S1 steering wheel - -+config HID_SPINELPLUS -+ tristate "Spinel Plus remote control" -+ depends on USB_HID -+ ---help--- -+ Say Y here if you have a Spinel Plus (0471:206c/20cc/0613/2168) remote -+ - config HID_SUNPLUS - tristate "Sunplus wireless desktop" - depends on HID -diff -Naur linux-3.19/drivers/hid/Makefile linux-3.19.patch/drivers/hid/Makefile ---- linux-3.19/drivers/hid/Makefile 2015-02-09 03:54:22.000000000 +0100 -+++ linux-3.19.patch/drivers/hid/Makefile 2015-02-11 00:04:45.886977059 +0100 -@@ -107,6 +107,7 @@ - obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o - obj-$(CONFIG_HID_SONY) += hid-sony.o - obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o -+obj-$(CONFIG_HID_SPINELPLUS) += hid-spinelplus.o - obj-$(CONFIG_HID_STEELSERIES) += hid-steelseries.o - obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o - obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o diff --git a/packages/linux/patches/default/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch b/packages/linux/patches/default/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch deleted file mode 100644 index 08566d1f13..0000000000 --- a/packages/linux/patches/default/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur linux-3.0/drivers/media/rc/nuvoton-cir.c linux-3.0.patch/drivers/media/rc/nuvoton-cir.c ---- linux-3.0/drivers/media/rc/nuvoton-cir.c 2011-07-22 04:17:23.000000000 +0200 -+++ linux-3.0.patch/drivers/media/rc/nuvoton-cir.c 2011-07-22 21:30:48.374591146 +0200 -@@ -1110,7 +1110,7 @@ - rdev->dev.parent = &pdev->dev; - rdev->driver_name = NVT_DRIVER_NAME; - rdev->map_name = RC_MAP_RC6_MCE; -- rdev->timeout = MS_TO_NS(100); -+ rdev->timeout = US_TO_NS(1000); - /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ - rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD); - #if 0 diff --git a/packages/linux/patches/default/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch b/packages/linux/patches/default/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch deleted file mode 100644 index 6b09bc0073..0000000000 --- a/packages/linux/patches/default/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- linux/drivers/media/rc/ir-rc6-decoder.c 2012-11-25 22:08:13.148418669 -0800 -+++ linux.patch/drivers/media/rc/ir-rc6-decoder.c 2012-11-25 22:07:48.864417975 -0800 -@@ -39,7 +39,6 @@ - #define RC6_STARTBIT_MASK 0x08 /* for the header bits */ - #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ - #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ --#define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ - #ifndef CHAR_BIT - #define CHAR_BIT 8 /* Normally in */ - #endif -@@ -257,14 +256,9 @@ again: - toggle = 0; - break; - case 32: -- if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { -- protocol = RC_TYPE_RC6_MCE; -- toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); -- scancode &= ~RC6_6A_MCE_TOGGLE_MASK; -- } else { -- protocol = RC_TYPE_RC6_6A_32; -- toggle = 0; -- } -+ protocol = RC_TYPE_RC6_MCE; -+ toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); -+ scancode &= ~RC6_6A_MCE_TOGGLE_MASK; - break; - default: - IR_dprintk(1, "RC6(6A) unsupported length\n"); diff --git a/packages/linux/patches/default/linux-900-fix-libelf-detection.patch b/packages/linux/patches/default/linux-900-fix-libelf-detection.patch new file mode 100644 index 0000000000..9d581f8ca0 --- /dev/null +++ b/packages/linux/patches/default/linux-900-fix-libelf-detection.patch @@ -0,0 +1,16 @@ +diff --git a/Makefile b/Makefile +index c9132594860b..9551c8bc5e91 100644 +--- a/Makefile ++++ b/Makefile +@@ -933,7 +933,7 @@ export mod_sign_cmd + + ifdef CONFIG_STACK_VALIDATION + has_libelf := $(call try-run,\ +- echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0) ++ echo "int main() {}" | $(HOSTCC) $(HOSTCFLAGS) -xc -o /dev/null $(HOSTLDFLAGS) -lelf -,1,0) + ifeq ($(has_libelf),1) + objtool_target := tools/objtool FORCE + else +-- +2.11.0 + diff --git a/packages/linux/patches/default/linux-901-extend-rc6-toggle-support.patch b/packages/linux/patches/default/linux-901-extend-rc6-toggle-support.patch new file mode 100644 index 0000000000..de21628bda --- /dev/null +++ b/packages/linux/patches/default/linux-901-extend-rc6-toggle-support.patch @@ -0,0 +1,52 @@ +From 3f1f8303b6e0be751d7a7c55031c8ab840ed5c1a Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 24 Aug 2018 23:31:51 +0200 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Kathrein + RCU-676 remote + +The Kathrein RCU-676 remote uses the 32-bit rc6 protocol and toggles +bit 15 (0x8000) on repeated button presses, like MCE remotes. + +Add it's customer code 0x80460000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index 68487ce9f79b..d96aed1343e4 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ + #endif +@@ -242,13 +243,17 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + toggle = 0; + break; + case 32: +- if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { ++ switch (scancode & RC6_6A_LCC_MASK) { ++ case RC6_6A_MCE_CC: ++ case RC6_6A_KATHREIN_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +- } else { ++ break; ++ default: + protocol = RC_PROTO_RC6_6A_32; + toggle = 0; ++ break; + } + break; + default: +-- +2.11.0 + diff --git a/packages/linux/patches/default/linux-902-extend-rc6-toggle-support-for-zotac.patch b/packages/linux/patches/default/linux-902-extend-rc6-toggle-support-for-zotac.patch new file mode 100644 index 0000000000..65fe5fd6c7 --- /dev/null +++ b/packages/linux/patches/default/linux-902-extend-rc6-toggle-support-for-zotac.patch @@ -0,0 +1,41 @@ +From ae1ccaa3587c0bd3d6d01841fa2e668cdf738f1e Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 3 Feb 2019 14:24:00 +0100 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Zotac + remotes + +The Zotac RC2604323/01G and RC2604329/02BG remotes use the 32-bit +rc6 protocol and toggle bit 15 (0x8000) on repeated button presses, +like MCE remotes. + +Add the customer code 0x80340000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index d96aed1343e4..5cc302fa4daa 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */ + #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ +@@ -246,6 +247,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + switch (scancode & RC6_6A_LCC_MASK) { + case RC6_6A_MCE_CC: + case RC6_6A_KATHREIN_CC: ++ case RC6_6A_ZOTAC_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +-- +2.20.1 + diff --git a/packages/linux/patches/default/linux-999-i915-chris-wilson-limit-depth-of-display-pipeline.patch b/packages/linux/patches/default/linux-999-i915-chris-wilson-limit-depth-of-display-pipeline.patch deleted file mode 100644 index e484b89c2f..0000000000 --- a/packages/linux/patches/default/linux-999-i915-chris-wilson-limit-depth-of-display-pipeline.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 428ce1a022a0bc30cf2d09cde4c1352a88d70d0a Mon Sep 17 00:00:00 2001 -From: Chris Wilson -Date: Fri, 26 Aug 2016 19:26:01 +0100 -Subject: [PATCH] drm/i915: Limit the depth of the display pipeline to the - framebuffer - -There is little point in using higher bitdepth inside the pipeline if -the endpoints are of lower accuracy. Using the higher bitdepth requires -extra bandwidth, often to the point of failure - such as signal loss and -blank displays. - -Since commit 7a0baa623446 ("Revert "drm/i915: Disable 12bpc hdmi for -now"") we have had users reporting blank screens and rightfully -complaining about the regressions. Whilst these are using due to some -other underlying bug, they have lingered and still remain unresolved. So -let's try a different tact and avoid using higher bitdepths than -required. - -Signed-off-by: Chris Wilson ---- - drivers/gpu/drm/i915/intel_display.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c -index af551a2c89ba..05ad77dae2e8 100644 ---- a/drivers/gpu/drm/i915/intel_display.c -+++ b/drivers/gpu/drm/i915/intel_display.c -@@ -12695,9 +12695,11 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, - struct intel_crtc_state *pipe_config) - { - struct drm_device *dev = crtc->base.dev; -- struct drm_atomic_state *state; -+ struct drm_atomic_state *state = pipe_config->base.state; -+ - struct drm_connector *connector; - struct drm_connector_state *connector_state; -+ struct drm_plane_state *plane_state; - int bpp, i; - - if ((IS_G4X(dev) || IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev))) -@@ -12707,11 +12709,14 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, - else - bpp = 8*3; - -+ plane_state = drm_atomic_get_plane_state(state, crtc->base.primary); -+ if (plane_state->fb->depth < bpp) -+ bpp = 8*3; - -+ DRM_DEBUG_KMS("initial pipeline bpp = %d (fb depth %d)\n", -+ bpp, plane_state->fb->depth); - pipe_config->pipe_bpp = bpp; - -- state = pipe_config->base.state; -- - /* Clamp display bpp to EDID value */ - for_each_connector_in_state(state, connector, connector_state, i) { - if (connector_state->crtc != &crtc->base) --- -2.9.3 - diff --git a/packages/linux/patches/default/linux-999-i915-fixes-and-diagnostics-for-braswell.patch b/packages/linux/patches/default/linux-999-i915-fixes-and-diagnostics-for-braswell.patch deleted file mode 100644 index f07daafe09..0000000000 --- a/packages/linux/patches/default/linux-999-i915-fixes-and-diagnostics-for-braswell.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0db9810b18ffc46709ad00831c426712d5489aea Mon Sep 17 00:00:00 2001 -From: Chris Wilson -Date: Sat, 13 Aug 2016 21:32:17 +0100 -Subject: [PATCH 1/2] drm/i915: Show RPS autotuning thresholds along waitboost - ---- - drivers/gpu/drm/i915/i915_debugfs.c | 62 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 62 insertions(+) - -diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c -index 1035468..2cff44a 100644 ---- a/drivers/gpu/drm/i915/i915_debugfs.c -+++ b/drivers/gpu/drm/i915/i915_debugfs.c -@@ -2434,6 +2434,68 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) - spin_unlock(&dev_priv->rps.client_lock); - mutex_unlock(&dev->filelist_mutex); - -+ if (INTEL_INFO(dev)->gen >= 6) { -+ u32 rpmodectl, rpinclimit, rpdeclimit; -+ u32 rpstat, cagf; -+ u32 rpupei, rpcurup, rpprevup; -+ u32 rpdownei, rpcurdown, rpprevdown; -+ -+ intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); -+ -+ rpmodectl = I915_READ(GEN6_RP_CONTROL); -+ rpinclimit = I915_READ(GEN6_RP_UP_THRESHOLD); -+ rpdeclimit = I915_READ(GEN6_RP_DOWN_THRESHOLD); -+ -+ rpstat = I915_READ(GEN6_RPSTAT1); -+ rpupei = I915_READ(GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK; -+ rpcurup = I915_READ(GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK; -+ rpprevup = I915_READ(GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK; -+ rpdownei = I915_READ(GEN6_RP_CUR_DOWN_EI) & GEN6_CURIAVG_MASK; -+ rpcurdown = I915_READ(GEN6_RP_CUR_DOWN) & GEN6_CURBSYTAVG_MASK; -+ rpprevdown = I915_READ(GEN6_RP_PREV_DOWN) & GEN6_CURBSYTAVG_MASK; -+ intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); -+ -+ if (IS_GEN9(dev)) -+ cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT; -+ else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) -+ cagf = (rpstat & HSW_CAGF_MASK) >> HSW_CAGF_SHIFT; -+ else -+ cagf = (rpstat & GEN6_CAGF_MASK) >> GEN6_CAGF_SHIFT; -+ cagf = intel_gpu_freq(dev_priv, cagf); -+ -+ -+ seq_printf(m, "RP CUR UP EI: %d (%dus)\n", -+ rpupei, GT_PM_INTERVAL_TO_US(dev_priv, rpupei)); -+ seq_printf(m, "RP CUR UP: %d (%dus)\n", -+ rpcurup, GT_PM_INTERVAL_TO_US(dev_priv, rpcurup)); -+ seq_printf(m, "RP PREV UP: %d (%dus)\n", -+ rpprevup, GT_PM_INTERVAL_TO_US(dev_priv, rpprevup)); -+ seq_printf(m, "Up threshold: %d%%\n", -+ dev_priv->rps.up_threshold); -+ -+ seq_printf(m, "RP CUR DOWN EI: %d (%dus)\n", -+ rpdownei, GT_PM_INTERVAL_TO_US(dev_priv, rpdownei)); -+ seq_printf(m, "RP CUR DOWN: %d (%dus)\n", -+ rpcurdown, GT_PM_INTERVAL_TO_US(dev_priv, rpcurdown)); -+ seq_printf(m, "RP PREV DOWN: %d (%dus)\n", -+ rpprevdown, GT_PM_INTERVAL_TO_US(dev_priv, rpprevdown)); -+ seq_printf(m, "Down threshold: %d%%\n", -+ dev_priv->rps.down_threshold); -+ -+ seq_printf(m, "Current freq: %d MHz\n", -+ intel_gpu_freq(dev_priv, dev_priv->rps.cur_freq)); -+ seq_printf(m, "Actual freq: %d MHz\n", cagf); -+ seq_printf(m, "Idle freq: %d MHz\n", -+ intel_gpu_freq(dev_priv, dev_priv->rps.idle_freq)); -+ seq_printf(m, "Min freq: %d MHz\n", -+ intel_gpu_freq(dev_priv, dev_priv->rps.min_freq)); -+ seq_printf(m, "Max freq: %d MHz\n", -+ intel_gpu_freq(dev_priv, dev_priv->rps.max_freq)); -+ seq_printf(m, -+ "efficient (RPe) frequency: %d MHz\n", -+ intel_gpu_freq(dev_priv, dev_priv->rps.efficient_freq)); -+ } -+ - return 0; - } - --- -2.7.4 - - -From d77c081cd5ea0d278b314ee2043556d2bd9aacaf Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sat, 13 Aug 2016 22:56:37 +0200 -Subject: [PATCH 2/2] drm/i915: intel-pm enable thresholds - ---- - drivers/gpu/drm/i915/intel_pm.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c -index 2863b92..f3aaef2 100644 ---- a/drivers/gpu/drm/i915/intel_pm.c -+++ b/drivers/gpu/drm/i915/intel_pm.c -@@ -4511,8 +4511,7 @@ static void valleyview_set_rps(struct drm_device *dev, u8 val) - - if (val != dev_priv->rps.cur_freq) { - vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val); -- if (!IS_CHERRYVIEW(dev_priv)) -- gen6_set_rps_thresholds(dev_priv, val); -+ gen6_set_rps_thresholds(dev_priv, val); - } - - dev_priv->rps.cur_freq = val; --- -2.7.4 - - diff --git a/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch b/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch deleted file mode 100644 index 37649c62ef..0000000000 --- a/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h -index f68c789..a6b6dfe 100644 ---- a/drivers/gpu/drm/i915/i915_drv.h -+++ b/drivers/gpu/drm/i915/i915_drv.h -@@ -3948,6 +3948,7 @@ __raw_write(64, q) - #define INTEL_BROADCAST_RGB_AUTO 0 - #define INTEL_BROADCAST_RGB_FULL 1 - #define INTEL_BROADCAST_RGB_LIMITED 2 -+#define INTEL_BROADCAST_RGB_VIDEO 3 - - static inline i915_reg_t i915_vgacntrl_reg(struct drm_device *dev) - { -diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h -index ff399b9..f2ac0ff 100644 ---- a/drivers/gpu/drm/i915/intel_drv.h -+++ b/drivers/gpu/drm/i915/intel_drv.h -@@ -522,6 +522,13 @@ struct intel_crtc_state { - */ - bool limited_color_range; - -+ /* -+ * -+ * Use reduced/limited/broadcast rgb range without compressing. -+ * -+ */ -+ bool video_color_range; -+ - /* Bitmask of encoder types (enum intel_output_type) - * driven by the pipe. - */ -@@ -805,6 +812,7 @@ struct intel_hdmi { - } dp_dual_mode; - bool limited_color_range; - bool color_range_auto; -+ bool color_range_video; - bool has_hdmi_sink; - bool has_audio; - enum hdmi_force_audio force_audio; -diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c -index 4df9f38..8b64508 100644 ---- a/drivers/gpu/drm/i915/intel_hdmi.c -+++ b/drivers/gpu/drm/i915/intel_hdmi.c -@@ -462,7 +462,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, - } - - if (intel_hdmi->rgb_quant_range_selectable) { -- if (intel_crtc->config->limited_color_range) -+ if (intel_crtc->config->limited_color_range || -+ intel_crtc->config->video_color_range) - frame.avi.quantization_range = - HDMI_QUANTIZATION_RANGE_LIMITED; - else -@@ -1308,6 +1309,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, - pipe_config->limited_color_range = - intel_hdmi->limited_color_range; - } -+ if (intel_hdmi->color_range_video) -+ pipe_config->video_color_range = true; - - if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) { - pipe_config->pixel_multiplier = 2; -@@ -1588,25 +1591,35 @@ intel_hdmi_set_property(struct drm_connector *connector, - if (property == dev_priv->broadcast_rgb_property) { - bool old_auto = intel_hdmi->color_range_auto; - bool old_range = intel_hdmi->limited_color_range; -+ bool old_range_video = intel_hdmi->color_range_video; - - switch (val) { - case INTEL_BROADCAST_RGB_AUTO: - intel_hdmi->color_range_auto = true; -+ intel_hdmi->color_range_video = false; - break; - case INTEL_BROADCAST_RGB_FULL: - intel_hdmi->color_range_auto = false; - intel_hdmi->limited_color_range = false; -+ intel_hdmi->color_range_video = false; - break; - case INTEL_BROADCAST_RGB_LIMITED: - intel_hdmi->color_range_auto = false; - intel_hdmi->limited_color_range = true; -+ intel_hdmi->color_range_video = false; -+ break; -+ case INTEL_BROADCAST_RGB_VIDEO: -+ intel_hdmi->color_range_auto = false; -+ intel_hdmi->limited_color_range = false; -+ intel_hdmi->color_range_video = true; - break; - default: - return -EINVAL; - } - - if (old_auto == intel_hdmi->color_range_auto && -- old_range == intel_hdmi->limited_color_range) -+ old_range == intel_hdmi->limited_color_range && -+ old_range_video == intel_hdmi->color_range_video) - return 0; - - goto done; -diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c -index f2584d0..5a6f853 100644 ---- a/drivers/gpu/drm/i915/intel_modes.c -+++ b/drivers/gpu/drm/i915/intel_modes.c -@@ -103,6 +103,7 @@ static const struct drm_prop_enum_list broadcast_rgb_names[] = { - { INTEL_BROADCAST_RGB_AUTO, "Automatic" }, - { INTEL_BROADCAST_RGB_FULL, "Full" }, - { INTEL_BROADCAST_RGB_LIMITED, "Limited 16:235" }, -+ { INTEL_BROADCAST_RGB_VIDEO, "Video 16:235 pass-through" }, - }; - - void diff --git a/packages/linux/patches/default/linux-999-i915-use-legacy-turbo.patch b/packages/linux/patches/default/linux-999-i915-use-legacy-turbo.patch deleted file mode 100644 index a8df9d68d2..0000000000 --- a/packages/linux/patches/default/linux-999-i915-use-legacy-turbo.patch +++ /dev/null @@ -1,27 +0,0 @@ -From aefcd1a6b1ec22e4e0d26eb932b618c5d12f7e9c Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sun, 21 Feb 2016 12:39:16 +0100 -Subject: [PATCH] i915_irq: enable legacy turbo (4.6) - ---- - drivers/gpu/drm/i915/i915_irq.c | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c -index 1c21220..6507643 100644 ---- a/drivers/gpu/drm/i915/i915_irq.c -+++ b/drivers/gpu/drm/i915/i915_irq.c -@@ -4557,12 +4557,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv) - INIT_WORK(&dev_priv->rps.work, gen6_pm_rps_work); - INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work); - -- /* Let's track the enabled rps events */ -- if (IS_VALLEYVIEW(dev_priv)) -- /* WaGsvRC0ResidencyMethod:vlv */ -- dev_priv->pm_rps_events = GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_UP_EI_EXPIRED; -- else -- dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS; -+ dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS; - - INIT_DELAYED_WORK(&dev_priv->gpu_error.hangcheck_work, - i915_hangcheck_elapsed); diff --git a/packages/linux/patches/default/linux-999-no-lzma-in-x86-perf-build.patch b/packages/linux/patches/default/linux-999-no-lzma-in-x86-perf-build.patch new file mode 100644 index 0000000000..676d0d98ca --- /dev/null +++ b/packages/linux/patches/default/linux-999-no-lzma-in-x86-perf-build.patch @@ -0,0 +1,13 @@ +diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config +index 0294bfb6c5f8..153036bbed7e 100644 +--- a/tools/perf/Makefile.config ++++ b/tools/perf/Makefile.config +@@ -35,7 +35,7 @@ ifeq ($(SRCARCH),x86) + ifeq (${IS_64_BIT}, 1) + CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated + ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S +- LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma ++ LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind + $(call detected,CONFIG_X86_64) + else + LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind diff --git a/packages/linux/patches/default/linux-999.03-dvbskys960-fix.patch b/packages/linux/patches/default/linux-999.03-dvbskys960-fix.patch new file mode 100644 index 0000000000..bc610f8642 --- /dev/null +++ b/packages/linux/patches/default/linux-999.03-dvbskys960-fix.patch @@ -0,0 +1,39 @@ +From: jahutchi +Date: Fri, 11 Jan 2019 13:35:00 +0000 +Subject: [PATCH] media: m88ds3103: serialize reset messages in m88ds3103_set_frontend + +Ref: +https://bugzilla.kernel.org/show_bug.cgi?id=199323 +https://forum.libreelec.tv/thread/12452-problems-with-dvbsky-technotrend-usb-dvb-s2-tuners-since-le8/ + +DVBSky S960/S960C are partly broken since linux kernel commit (4.10rc1) +https://github.com/torvalds/linux/commit/9d659ae14b545c4296e812c70493bfdc999b5c1c + +diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c +index dffd2d4bf1..e495a26e6e 100644 +--- a/drivers/media/dvb-frontends/m88ds3103.c ++++ b/drivers/media/dvb-frontends/m88ds3103.c +@@ -309,6 +309,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) + u16 u16tmp; + u32 tuner_frequency_khz, target_mclk; + s32 s32tmp; ++ static const struct reg_sequence reset_buf[] = {{0x07, 0x80}, {0x07, 0x00}}; + + dev_dbg(&client->dev, + "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", +@@ -321,11 +322,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) + } + + /* reset */ +- ret = regmap_write(dev->regmap, 0x07, 0x80); +- if (ret) +- goto err; +- +- ret = regmap_write(dev->regmap, 0x07, 0x00); ++ ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2); + if (ret) + goto err; + +-- +2.7.4 + diff --git a/packages/linux/patches/default/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch b/packages/linux/patches/default/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch deleted file mode 100644 index b3eb8b34b0..0000000000 --- a/packages/linux/patches/default/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 57f0b99ca9a2db948fa70988c447553683368be1 Mon Sep 17 00:00:00 2001 -From: Nell Hardcastle -Date: Thu, 29 May 2014 22:06:50 -0700 -Subject: [PATCH] eMMC: Don't initialize partitions on RPMB flagged areas. - -Prevents a lot of pointless hanging at boot on some devices. ---- - drivers/mmc/card/block.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 4409d79..56df902 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -2254,7 +2254,7 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md) - return 0; - - for (idx = 0; idx < card->nr_parts; idx++) { -- if (card->part[idx].size) { -+ if (card->part[idx].size && !(card->part[idx].area_type & MMC_BLK_DATA_AREA_RPMB)) { - ret = mmc_blk_alloc_part(card, md, - card->part[idx].part_cfg, - card->part[idx].size >> 9, --- -1.7.10.4 - diff --git a/packages/linux/patches/default/linux-999.20-i915-pm-Be-less-agressive-with-clockfreq-changes-on-Bay-Trail.patch b/packages/linux/patches/default/linux-999.20-i915-pm-Be-less-agressive-with-clockfreq-changes-on-Bay-Trail.patch new file mode 100644 index 0000000000..0a68a040d8 --- /dev/null +++ b/packages/linux/patches/default/linux-999.20-i915-pm-Be-less-agressive-with-clockfreq-changes-on-Bay-Trail.patch @@ -0,0 +1,89 @@ +From 28ad70a06fb84fe63cd036970db2561b2fd1562b Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 5 Nov 2017 16:51:23 +0100 +Subject: [PATCH v3 1/2] i915: pm: Be less agressive with clockfreq changes on + Bay Trail + +Bay Trail devices are known to hang when changing the frequency often, +this is discussed in great length in: +https://bugzilla.kernel.org/show_bug.cgi?id=109051 + +Commit 6067a27d1f01 ("drm/i915: Avoid tweaking evaluation thresholds +on Baytrail v3") is an attempt to workaround this. Several users in +bko109051 report that an earlier version of this patch, v1: +https://bugzilla.kernel.org/attachment.cgi?id=251471 + +Works better for them and they still see hangs with the merged v3. + +Comparing the 2 versions shows that they are indeed not equivalent, +v1 not only skips writing the GEN6_RP* registers from valleyview_set_rps, +as v3 does. It also contained these modifications to i915_irq.c: + + if (pm_iir & GEN6_PM_RP_DOWN_EI_EXPIRED) { + if (!vlv_c0_above(dev_priv, + &dev_priv->rps.down_ei, &now, +- dev_priv->rps.down_threshold)) ++ VLV_RP_DOWN_EI_THRESHOLD)) + events |= GEN6_PM_RP_DOWN_THRESHOLD; + dev_priv->rps.down_ei = now; + } + + if (pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) { + if (vlv_c0_above(dev_priv, + &dev_priv->rps.up_ei, &now, +- dev_priv->rps.up_threshold)) ++ VLV_RP_UP_EI_THRESHOLD)) + events |= GEN6_PM_RP_UP_THRESHOLD; + dev_priv->rps.up_ei = now; + } + +Which use less aggressive up/down thresholds, which results in less +GEN6_PM_RP_*_THRESHOLD events and thus in less calls to intel_set_rps() -> +valleyview_set_rps() -> vlv_punit_write(PUNIT_REG_GPU_FREQ_REQ). +With the last call being the likely cause of the hang. + +This commit hardcodes the threshold_up and _down values for Bay Trail to +less aggressive values, reducing the amount of clock frequency changes, +thus avoiding the hangs some people are still seeing with the merged fix. + +Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=109051 +Signed-off-by: Hans de Goede +--- + drivers/gpu/drm/i915/i915_reg.h | 3 +++ + drivers/gpu/drm/i915/intel_pm.c | 5 ++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h +index 68a58cce6ab1..2561af075ebb 100644 +--- a/drivers/gpu/drm/i915/i915_reg.h ++++ b/drivers/gpu/drm/i915/i915_reg.h +@@ -1355,6 +1355,9 @@ enum i915_power_well_id { + #define VLV_BIAS_CPU_125_SOC_875 (6 << 2) + #define CHV_BIAS_CPU_50_SOC_50 (3 << 2) + ++#define VLV_RP_UP_EI_THRESHOLD 90 ++#define VLV_RP_DOWN_EI_THRESHOLD 70 ++ + /* vlv2 north clock has */ + #define CCK_FUSE_REG 0x8 + #define CCK_FUSE_HPLL_FREQ_MASK 0x3 +diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c +index 01966b89be14..177b6caa0a38 100644 +--- a/drivers/gpu/drm/i915/intel_pm.c ++++ b/drivers/gpu/drm/i915/intel_pm.c +@@ -6096,8 +6096,11 @@ static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val) + /* When byt can survive without system hang with dynamic + * sw freq adjustments, this restriction can be lifted. + */ +- if (IS_VALLEYVIEW(dev_priv)) ++ if (IS_VALLEYVIEW(dev_priv)) { ++ threshold_up = VLV_RP_UP_EI_THRESHOLD; ++ threshold_down = VLV_RP_DOWN_EI_THRESHOLD; + goto skip_hw_write; ++ } + + I915_WRITE(GEN6_RP_UP_EI, + GT_INTERVAL_FROM_US(dev_priv, ei_up)); +-- +2.14.3 + diff --git a/packages/linux/patches/default/linux-999.21-intel_idle-Disable-C6N-and-C6S-on-Bay-Trail.patch b/packages/linux/patches/default/linux-999.21-intel_idle-Disable-C6N-and-C6S-on-Bay-Trail.patch new file mode 100644 index 0000000000..8b820cdc82 --- /dev/null +++ b/packages/linux/patches/default/linux-999.21-intel_idle-Disable-C6N-and-C6S-on-Bay-Trail.patch @@ -0,0 +1,53 @@ +From 945d0eb39d8920854c72ecb743c07d54b738cf7f Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 9 Nov 2017 14:21:24 +0100 +Subject: [PATCH v3 2/2] intel_idle: Disable C6N and C6S on Bay Trail + +It seems that Bay Trail SoCs sometimes have issues waking from C6, +a lot of users even report Bay Trail devices only being stable +when passing intel_idle.max_cstate=1 to the kernel. + +This commits disables the C6 states while leaving the C7 states +available so that the cores can still reach deep sleep states. + +There are several indicators that this is part of the solution for +all the users who need to pass intel_idle.max_cstate=1: + +1) The "VLP52 EOI Transactions May Not be Sent if Software + Enters Core C6 During an Interrupt Service Routine" errata. + +2) Several users who need intel_idle.max_cstate=1 indicate in bko109051 + (which has over 800 comments!) that using a shell script which + disables C6N and C6S through sysfs allows them to remove + intel_idle.max_cstate=1 and still have a stable system which does + use the C7 states for power-saving. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=109051 +Signed-off-by: Hans de Goede +--- + drivers/idle/intel_idle.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c +index 5dc7ea4b6bc4..fe05984c9e81 100644 +--- a/drivers/idle/intel_idle.c ++++ b/drivers/idle/intel_idle.c +@@ -221,6 +221,7 @@ static struct cpuidle_state byt_cstates[] = { + .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency = 300, + .target_residency = 275, ++ .disabled = true, + .enter = &intel_idle, + .enter_s2idle = intel_idle_s2idle, }, + { +@@ -229,6 +230,7 @@ static struct cpuidle_state byt_cstates[] = { + .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, + .exit_latency = 500, + .target_residency = 560, ++ .disabled = true, + .enter = &intel_idle, + .enter_s2idle = intel_idle_s2idle, }, + { +-- +2.14.3 + diff --git a/packages/linux/patches/raspberrypi/linux-051-ouya_controller_support.patch b/packages/linux/patches/raspberrypi/linux-051-ouya_controller_support.patch new file mode 100644 index 0000000000..8ee3cb27be --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-051-ouya_controller_support.patch @@ -0,0 +1,206 @@ +commit 5a596921a4636e62843a59b7eab7b87b70a6d296 +Author: Lukas Rusak +Date: Sun May 6 22:03:11 2018 -0700 + + HID: add ouya HID driver + + This driver is a simple implementation to get the controller working and mapped properly. + This driver does not include functionality for the touchpad (yet). The original driver + was taken from from the ouya linux tree and has been simplified. It seems there may have + been other versions of the controller present that had a broken report descriptor. I have + removed that for now. + +diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig +index 60252fd796f6..6be2c454e72e 100644 +--- a/drivers/hid/Kconfig ++++ b/drivers/hid/Kconfig +@@ -659,6 +659,12 @@ config HID_ORTEK + - Ortek WKB-2000 + - Skycable wireless presenter + ++config HID_OUYA ++ tristate "OUYA Game Controller" ++ depends on USB_HID ++ ---help--- ++ Support for OUYA Game Controller. ++ + config HID_PANTHERLORD + tristate "Pantherlord/GreenAsia game controller" + depends on HID +diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile +index 17a8bd97da9d..4425890934e4 100644 +--- a/drivers/hid/Makefile ++++ b/drivers/hid/Makefile +@@ -71,6 +71,7 @@ obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o + obj-$(CONFIG_HID_NTI) += hid-nti.o + obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o + obj-$(CONFIG_HID_ORTEK) += hid-ortek.o ++obj-$(CONFIG_HID_OUYA) += hid-ouya.o + obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o + obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o + obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 0b5cc910f62e..0528efb825fa 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -859,6 +859,9 @@ + #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 + #define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003 + ++#define USB_VENDOR_ID_OUYA 0x2836 ++#define USB_DEVICE_ID_OUYA_CONTROLLER 0x0001 ++ + #define USB_VENDOR_ID_PLANTRONICS 0x047f + + #define USB_VENDOR_ID_PANASONIC 0x04da +diff --git a/drivers/hid/hid-ouya.c b/drivers/hid/hid-ouya.c +new file mode 100644 +index 000000000000..4344a47b40af +--- /dev/null ++++ b/drivers/hid/hid-ouya.c +@@ -0,0 +1,131 @@ ++/* ++ * HID driver for OUYA Game Controller(s) ++ * ++ * Copyright (c) 2013 OUYA ++ * Copyright (c) 2013 Gregorios Leach ++ * Copyright (c) 2018 Lukas Rusak ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include "hid-ids.h" ++ ++static const unsigned int ouya_absmap[] = { ++ [0x30] = ABS_X, /* left stick X */ ++ [0x31] = ABS_Y, /* left stick Y */ ++ [0x32] = ABS_Z, /* L2 */ ++ [0x33] = ABS_RX, /* right stick X */ ++ [0x34] = ABS_RY, /* right stick Y */ ++ [0x35] = ABS_RZ, /* R2 */ ++}; ++ ++static const unsigned int ouya_keymap[] = { ++ [0x1] = BTN_SOUTH, /* O */ ++ [0x2] = BTN_WEST, /* U */ ++ [0x3] = BTN_NORTH, /* Y */ ++ [0x4] = BTN_EAST, /* A */ ++ [0x5] = BTN_TL, /* L1 */ ++ [0x6] = BTN_TR, /* R1 */ ++ [0x7] = BTN_THUMBL, /* L3 */ ++ [0x8] = BTN_THUMBR, /* R3 */ ++ [0x9] = BTN_DPAD_UP, /* Up */ ++ [0xa] = BTN_DPAD_DOWN, /* Down */ ++ [0xb] = BTN_DPAD_LEFT, /* Left */ ++ [0xc] = BTN_DPAD_RIGHT, /* Right */ ++ [0xd] = BTN_TL2, /* L2 */ ++ [0xe] = BTN_TR2, /* R2 */ ++ [0xf] = BTN_MODE, /* Power */ ++}; ++ ++static int ouya_input_mapping(struct hid_device *hdev, struct hid_input *hi, ++ struct hid_field *field, struct hid_usage *usage, ++ unsigned long **bit, int *max) ++{ ++ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) { ++ unsigned int key = usage->hid & HID_USAGE; ++ ++ if (key >= ARRAY_SIZE(ouya_keymap)) ++ return -1; ++ ++ key = ouya_keymap[key]; ++ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key); ++ ++ return 1; ++ ++ } else if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK) { ++ unsigned int abs = usage->hid & HID_USAGE; ++ ++ if (abs >= ARRAY_SIZE(ouya_absmap)) ++ return -1; ++ ++ abs = ouya_absmap[abs]; ++ hid_map_usage_clear(hi, usage, bit, max, EV_ABS, abs); ++ ++ return 1; ++ } ++ ++ return 0; ++} ++ ++static int ouya_probe(struct hid_device *hdev, const struct hid_device_id *id) ++{ ++ int ret; ++ ++ ret = hid_parse(hdev); ++ if (ret) { ++ hid_err(hdev, "parse failed\n"); ++ goto err_free; ++ } ++ ++ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | HID_CONNECT_HIDDEV_FORCE); ++ if (ret) { ++ hid_err(hdev, "hw start failed\n"); ++ goto err_free; ++ } ++ ++ return 0; ++ ++err_free: ++ return ret; ++} ++ ++static void ouya_remove(struct hid_device *hdev) ++{ ++ hid_hw_stop(hdev); ++ kfree(hid_get_drvdata(hdev)); ++} ++ ++static const struct hid_device_id ouya_devices[] = { ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) }, ++ { } ++}; ++MODULE_DEVICE_TABLE(hid, ouya_devices); ++ ++static struct hid_driver ouya_driver = { ++ .name = "ouya", ++ .id_table = ouya_devices, ++ .input_mapping = ouya_input_mapping, ++ .probe = ouya_probe, ++ .remove = ouya_remove, ++}; ++ ++static int __init ouya_init(void) ++{ ++ return hid_register_driver(&ouya_driver); ++} ++ ++static void __exit ouya_exit(void) ++{ ++ hid_unregister_driver(&ouya_driver); ++} ++ ++module_init(ouya_init); ++module_exit(ouya_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Lukas Rusak "); ++MODULE_AUTHOR("Gregorios Leach "); ++MODULE_DESCRIPTION("Ouya Controller Driver"); +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 587e2681a53f..b5adc13e0df1 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -538,6 +538,9 @@ static const struct hid_device_id hid_have_special_driver[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, + #endif ++#if IS_ENABLED(CONFIG_HID_OUYA) ++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) }, ++#endif + #if IS_ENABLED(CONFIG_HID_PANTHERLORD) + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, diff --git a/packages/linux/patches/raspberrypi/linux-052-xbox_dvd_remote_support.patch b/packages/linux/patches/raspberrypi/linux-052-xbox_dvd_remote_support.patch new file mode 100644 index 0000000000..8db97ddb2f --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-052-xbox_dvd_remote_support.patch @@ -0,0 +1,466 @@ +From 4d331d301222dc0585ab8864a842b3e460b1f744 Mon Sep 17 00:00:00 2001 +From: Benjamin Valentin +Date: Thu, 4 Oct 2018 02:57:10 +0200 +Subject: [PATCH] media: rc: add driver for Xbox DVD Movie Playback Kit + +The Xbox DVD Movie Playback Kit is a USB dongle with an IR remote for the +Original Xbox. + +Historically it has been supported by the out-of-tree lirc_xbox driver, +but this one has fallen out of favour and was just dropped from popular +Kodi (formerly XBMC) distributions. + +This driver is heaviely based on the ati_remote driver where all the +boilerplate was taken from - I was mostly just removing code. + +Signed-off-by: Benjamin Valentin +Signed-off-by: Sean Young +--- + drivers/media/rc/Kconfig | 12 + + drivers/media/rc/Makefile | 1 + + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-xbox-dvd.c | 63 +++++ + drivers/media/rc/xbox_remote.c | 306 +++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 6 files changed, 384 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-xbox-dvd.c + create mode 100644 drivers/media/rc/xbox_remote.c + +diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig +index 1021c08a9ba4..8a216068a35a 100644 +--- a/drivers/media/rc/Kconfig ++++ b/drivers/media/rc/Kconfig +@@ -493,6 +493,18 @@ config IR_TANGO + The HW decoder supports NEC, RC-5, RC-6 IR protocols. + When compiled as a module, look for tango-ir. + ++config RC_XBOX_DVD ++ tristate "Xbox DVD Movie Playback Kit" ++ depends on RC_CORE ++ depends on USB_ARCH_HAS_HCD ++ select USB ++ help ++ Say Y here if you want to use the Xbox DVD Movie Playback Kit. ++ These are IR remotes with USB receivers for the Original Xbox (2001). ++ ++ To compile this driver as a module, choose M here: the module will be ++ called xbox_remote. ++ + config IR_ZX + tristate "ZTE ZX IR remote control" + depends on RC_CORE +diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile +index e0340d043fe8..92c163816849 100644 +--- a/drivers/media/rc/Makefile ++++ b/drivers/media/rc/Makefile +@@ -48,3 +48,4 @@ obj-$(CONFIG_IR_SIR) += sir_ir.o + obj-$(CONFIG_IR_MTK) += mtk-cir.o + obj-$(CONFIG_IR_ZX) += zx-irdec.o + obj-$(CONFIG_IR_TANGO) += tango-ir.o ++obj-$(CONFIG_RC_XBOX_DVD) += xbox_remote.o +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index d6b913a3032d..5b1399af6b3a 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -116,4 +116,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-winfast.o \ + rc-winfast-usbii-deluxe.o \ + rc-su3000.o \ ++ rc-xbox-dvd.o \ + rc-zx-irdec.o +diff --git a/drivers/media/rc/keymaps/rc-xbox-dvd.c b/drivers/media/rc/keymaps/rc-xbox-dvd.c +new file mode 100644 +index 000000000000..af387244636b +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-xbox-dvd.c +@@ -0,0 +1,63 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++// Keytable for Xbox DVD remote ++// Copyright (c) 2018 by Benjamin Valentin ++ ++#include ++#include ++ ++/* based on lircd.conf.xbox */ ++static struct rc_map_table xbox_dvd[] = { ++ {0xa0b, KEY_OK}, ++ {0xaa6, KEY_UP}, ++ {0xaa7, KEY_DOWN}, ++ {0xaa8, KEY_RIGHT}, ++ {0xaa9, KEY_LEFT}, ++ {0xac3, KEY_INFO}, ++ ++ {0xac6, KEY_9}, ++ {0xac7, KEY_8}, ++ {0xac8, KEY_7}, ++ {0xac9, KEY_6}, ++ {0xaca, KEY_5}, ++ {0xacb, KEY_4}, ++ {0xacc, KEY_3}, ++ {0xacd, KEY_2}, ++ {0xace, KEY_1}, ++ {0xacf, KEY_0}, ++ ++ {0xad5, KEY_ANGLE}, ++ {0xad8, KEY_BACK}, ++ {0xadd, KEY_PREVIOUSSONG}, ++ {0xadf, KEY_NEXTSONG}, ++ {0xae0, KEY_STOP}, ++ {0xae2, KEY_REWIND}, ++ {0xae3, KEY_FASTFORWARD}, ++ {0xae5, KEY_TITLE}, ++ {0xae6, KEY_PAUSE}, ++ {0xaea, KEY_PLAY}, ++ {0xaf7, KEY_MENU}, ++}; ++ ++static struct rc_map_list xbox_dvd_map = { ++ .map = { ++ .scan = xbox_dvd, ++ .size = ARRAY_SIZE(xbox_dvd), ++ .rc_proto = RC_PROTO_UNKNOWN, ++ .name = RC_MAP_XBOX_DVD, ++ } ++}; ++ ++static int __init init_rc_map(void) ++{ ++ return rc_map_register(&xbox_dvd_map); ++} ++ ++static void __exit exit_rc_map(void) ++{ ++ rc_map_unregister(&xbox_dvd_map); ++} ++ ++module_init(init_rc_map) ++module_exit(exit_rc_map) ++ ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/rc/xbox_remote.c b/drivers/media/rc/xbox_remote.c +new file mode 100644 +index 000000000000..07ed9be24a60 +--- /dev/null ++++ b/drivers/media/rc/xbox_remote.c +@@ -0,0 +1,306 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++// Driver for Xbox DVD Movie Playback Kit ++// Copyright (c) 2018 by Benjamin Valentin ++ ++/* ++ * Xbox DVD Movie Playback Kit USB IR dongle support ++ * ++ * The driver was derived from the ati_remote driver 2.2.1 ++ * and used information from lirc_xbox.c ++ * ++ * Copyright (c) 2011, 2012 Anssi Hannula ++ * Copyright (c) 2004 Torrey Hoffman ++ * Copyright (c) 2002 Vladimir Dergachev ++ * Copyright (c) 2003-2004 Paul Miller ++ */ ++ ++#include ++#include ++#include ++#include ++ ++/* ++ * Module and Version Information ++ */ ++#define DRIVER_VERSION "1.0.0" ++#define DRIVER_AUTHOR "Benjamin Valentin " ++#define DRIVER_DESC "Xbox DVD USB Remote Control" ++ ++#define NAME_BUFSIZE 80 /* size of product name, path buffers */ ++#define DATA_BUFSIZE 8 /* size of URB data buffers */ ++ ++/* ++ * USB vendor ids for XBOX DVD Dongles ++ */ ++#define VENDOR_GAMESTER 0x040b ++#define VENDOR_MICROSOFT 0x045e ++ ++static const struct usb_device_id xbox_remote_table[] = { ++ /* Gamester Xbox DVD Movie Playback Kit IR */ ++ { ++ USB_DEVICE(VENDOR_GAMESTER, 0x6521), ++ }, ++ /* Microsoft Xbox DVD Movie Playback Kit IR */ ++ { ++ USB_DEVICE(VENDOR_MICROSOFT, 0x0284), ++ }, ++ {} /* Terminating entry */ ++}; ++ ++MODULE_DEVICE_TABLE(usb, xbox_remote_table); ++ ++struct xbox_remote { ++ struct rc_dev *rdev; ++ struct usb_device *udev; ++ struct usb_interface *interface; ++ ++ struct urb *irq_urb; ++ unsigned char inbuf[DATA_BUFSIZE] __aligned(sizeof(u16)); ++ ++ char rc_name[NAME_BUFSIZE]; ++ char rc_phys[NAME_BUFSIZE]; ++}; ++ ++static int xbox_remote_rc_open(struct rc_dev *rdev) ++{ ++ struct xbox_remote *xbox_remote = rdev->priv; ++ ++ /* On first open, submit the read urb which was set up previously. */ ++ xbox_remote->irq_urb->dev = xbox_remote->udev; ++ if (usb_submit_urb(xbox_remote->irq_urb, GFP_KERNEL)) { ++ dev_err(&xbox_remote->interface->dev, ++ "%s: usb_submit_urb failed!\n", __func__); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++static void xbox_remote_rc_close(struct rc_dev *rdev) ++{ ++ struct xbox_remote *xbox_remote = rdev->priv; ++ ++ usb_kill_urb(xbox_remote->irq_urb); ++} ++ ++/* ++ * xbox_remote_report_input ++ */ ++static void xbox_remote_input_report(struct urb *urb) ++{ ++ struct xbox_remote *xbox_remote = urb->context; ++ unsigned char *data = xbox_remote->inbuf; ++ ++ /* ++ * data[0] = 0x00 ++ * data[1] = length - always 0x06 ++ * data[2] = the key code ++ * data[3] = high part of key code ++ * data[4] = last_press_ms (low) ++ * data[5] = last_press_ms (high) ++ */ ++ ++ /* Deal with strange looking inputs */ ++ if (urb->actual_length != 6 || urb->actual_length != data[1]) { ++ dev_warn(&urb->dev->dev, "Weird data, len=%d: %*ph\n", ++ urb->actual_length, urb->actual_length, data); ++ return; ++ } ++ ++ rc_keydown(xbox_remote->rdev, RC_PROTO_UNKNOWN, ++ le16_to_cpup((__le16*)(data + 2)), 0); ++} ++ ++/* ++ * xbox_remote_irq_in ++ */ ++static void xbox_remote_irq_in(struct urb *urb) ++{ ++ struct xbox_remote *xbox_remote = urb->context; ++ int retval; ++ ++ switch (urb->status) { ++ case 0: /* success */ ++ xbox_remote_input_report(urb); ++ break; ++ case -ECONNRESET: /* unlink */ ++ case -ENOENT: ++ case -ESHUTDOWN: ++ dev_dbg(&xbox_remote->interface->dev, ++ "%s: urb error status, unlink?\n", ++ __func__); ++ return; ++ default: /* error */ ++ dev_dbg(&xbox_remote->interface->dev, ++ "%s: Nonzero urb status %d\n", ++ __func__, urb->status); ++ } ++ ++ retval = usb_submit_urb(urb, GFP_ATOMIC); ++ if (retval) ++ dev_err(&xbox_remote->interface->dev, ++ "%s: usb_submit_urb()=%d\n", ++ __func__, retval); ++} ++ ++static void xbox_remote_rc_init(struct xbox_remote *xbox_remote) ++{ ++ struct rc_dev *rdev = xbox_remote->rdev; ++ ++ rdev->priv = xbox_remote; ++ rdev->allowed_protocols = RC_PROTO_BIT_UNKNOWN; ++ rdev->driver_name = "xbox_remote"; ++ ++ rdev->open = xbox_remote_rc_open; ++ rdev->close = xbox_remote_rc_close; ++ ++ rdev->device_name = xbox_remote->rc_name; ++ rdev->input_phys = xbox_remote->rc_phys; ++ ++ usb_to_input_id(xbox_remote->udev, &rdev->input_id); ++ rdev->dev.parent = &xbox_remote->interface->dev; ++} ++ ++static int xbox_remote_initialize(struct xbox_remote *xbox_remote, ++ struct usb_endpoint_descriptor *endpoint_in) ++{ ++ struct usb_device *udev = xbox_remote->udev; ++ int pipe, maxp; ++ ++ /* Set up irq_urb */ ++ pipe = usb_rcvintpipe(udev, endpoint_in->bEndpointAddress); ++ maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); ++ maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp; ++ ++ usb_fill_int_urb(xbox_remote->irq_urb, udev, pipe, xbox_remote->inbuf, ++ maxp, xbox_remote_irq_in, xbox_remote, ++ endpoint_in->bInterval); ++ ++ return 0; ++} ++ ++/* ++ * xbox_remote_probe ++ */ ++static int xbox_remote_probe(struct usb_interface *interface, ++ const struct usb_device_id *id) ++{ ++ struct usb_device *udev = interface_to_usbdev(interface); ++ struct usb_host_interface *iface_host = interface->cur_altsetting; ++ struct usb_endpoint_descriptor *endpoint_in; ++ struct xbox_remote *xbox_remote; ++ struct rc_dev *rc_dev; ++ int err = -ENOMEM; ++ ++ // why is there also a device with no endpoints? ++ if (iface_host->desc.bNumEndpoints == 0) ++ return -ENODEV; ++ ++ if (iface_host->desc.bNumEndpoints != 1) { ++ pr_err("%s: Unexpected desc.bNumEndpoints: %d\n", ++ __func__, iface_host->desc.bNumEndpoints); ++ return -ENODEV; ++ } ++ ++ endpoint_in = &iface_host->endpoint[0].desc; ++ ++ if (!usb_endpoint_is_int_in(endpoint_in)) { ++ pr_err("%s: Unexpected endpoint_in\n", __func__); ++ return -ENODEV; ++ } ++ if (le16_to_cpu(endpoint_in->wMaxPacketSize) == 0) { ++ pr_err("%s: endpoint_in message size==0?\n", __func__); ++ return -ENODEV; ++ } ++ ++ xbox_remote = kzalloc(sizeof(*xbox_remote), GFP_KERNEL); ++ rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); ++ if (!xbox_remote || !rc_dev) ++ goto exit_free_dev_rdev; ++ ++ /* Allocate URB buffer */ ++ xbox_remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); ++ if (!xbox_remote->irq_urb) ++ goto exit_free_buffers; ++ ++ xbox_remote->udev = udev; ++ xbox_remote->rdev = rc_dev; ++ xbox_remote->interface = interface; ++ ++ usb_make_path(udev, xbox_remote->rc_phys, sizeof(xbox_remote->rc_phys)); ++ ++ strlcat(xbox_remote->rc_phys, "/input0", sizeof(xbox_remote->rc_phys)); ++ ++ snprintf(xbox_remote->rc_name, sizeof(xbox_remote->rc_name), "%s%s%s", ++ udev->manufacturer ?: "", ++ udev->manufacturer && udev->product ? " " : "", ++ udev->product ?: ""); ++ ++ if (!strlen(xbox_remote->rc_name)) ++ snprintf(xbox_remote->rc_name, sizeof(xbox_remote->rc_name), ++ DRIVER_DESC "(%04x,%04x)", ++ le16_to_cpu(xbox_remote->udev->descriptor.idVendor), ++ le16_to_cpu(xbox_remote->udev->descriptor.idProduct)); ++ ++ rc_dev->map_name = RC_MAP_XBOX_DVD; /* default map */ ++ ++ xbox_remote_rc_init(xbox_remote); ++ ++ /* Device Hardware Initialization */ ++ err = xbox_remote_initialize(xbox_remote, endpoint_in); ++ if (err) ++ goto exit_kill_urbs; ++ ++ /* Set up and register rc device */ ++ err = rc_register_device(xbox_remote->rdev); ++ if (err) ++ goto exit_kill_urbs; ++ ++ usb_set_intfdata(interface, xbox_remote); ++ ++ return 0; ++ ++exit_kill_urbs: ++ usb_kill_urb(xbox_remote->irq_urb); ++exit_free_buffers: ++ usb_free_urb(xbox_remote->irq_urb); ++exit_free_dev_rdev: ++ rc_free_device(rc_dev); ++ kfree(xbox_remote); ++ ++ return err; ++} ++ ++/* ++ * xbox_remote_disconnect ++ */ ++static void xbox_remote_disconnect(struct usb_interface *interface) ++{ ++ struct xbox_remote *xbox_remote; ++ ++ xbox_remote = usb_get_intfdata(interface); ++ usb_set_intfdata(interface, NULL); ++ if (!xbox_remote) { ++ dev_warn(&interface->dev, "%s - null device?\n", __func__); ++ return; ++ } ++ ++ usb_kill_urb(xbox_remote->irq_urb); ++ rc_unregister_device(xbox_remote->rdev); ++ usb_free_urb(xbox_remote->irq_urb); ++ kfree(xbox_remote); ++} ++ ++/* usb specific object to register with the usb subsystem */ ++static struct usb_driver xbox_remote_driver = { ++ .name = "xbox_remote", ++ .probe = xbox_remote_probe, ++ .disconnect = xbox_remote_disconnect, ++ .id_table = xbox_remote_table, ++}; ++ ++module_usb_driver(xbox_remote_driver); ++ ++MODULE_AUTHOR(DRIVER_AUTHOR); ++MODULE_DESCRIPTION(DRIVER_DESC); ++MODULE_LICENSE("GPL"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index bfa3017cecba..d621acadfbf3 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -277,6 +277,7 @@ struct rc_map *rc_map_get(const char *name); + #define RC_MAP_WINFAST "rc-winfast" + #define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" + #define RC_MAP_SU3000 "rc-su3000" ++#define RC_MAP_XBOX_DVD "rc-xbox-dvd" + #define RC_MAP_ZX_IRDEC "rc-zx-irdec" + + /* +-- +2.17.1 + diff --git a/packages/linux/patches/raspberrypi/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch b/packages/linux/patches/raspberrypi/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch new file mode 100644 index 0000000000..56e2ca8655 --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch @@ -0,0 +1,72 @@ +From 7051422474e4c4e302ede3d07ffd8ef2682e07a2 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Tue, 22 Apr 2014 16:05:14 +0300 +Subject: [PATCH] [RFC] hid/sony: add autorepeat for PS3 remotes + +adapted to 4.6 + +Betreff: [RFC] hid/sony: add autorepeat for PS3 remotes +Von: David Dillow +Datum: 28.06.2013 04:28 +An: linux-input@vger.kernel.org +Kopie (CC): Stephan Raue + +Some applications using the PS3 remote would like to have autorepeat +from the device. Use the input subsystem's software emulation to provide +this capability, and enable those that don't need it to turn it off. +--- +I'm not sure this is the correct approach, or if it is even appropriate +for a remote to do autorepeat. However, the media/rc subsystem does do +it by default, and it's been requested by users, so there is at least +some demand. + +This compiled against the hid-sony driver with the PS3 remote changes +merged, but I have done no testing of it. If the approach seems +reasonable, I'll try to test it when the MythTV is idle. + +Signed-off-by: Matt DeVillier +--- + drivers/hid/hid-sony.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c +index 310436a..84f7f41 100644 +--- a/drivers/hid/hid-sony.c ++++ b/drivers/hid/hid-sony.c +@@ -1120,6 +1120,25 @@ static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi, + return 1; + } + ++static int ps3remote_setup_repeat(struct hid_device *hdev) ++{ ++ struct hid_input *hidinput = list_first_entry(&hdev->inputs, ++ struct hid_input, list); ++ struct input_dev *input = hidinput->input; ++ ++ /* ++ * Set up autorepeat defaults per the remote control subsystem; ++ * this must be done after hid_hw_start(), as having these non-zero ++ * at the time of input_register_device() tells the input system that ++ * the hardware does the autorepeat, and the PS3 remote does not. ++ */ ++ set_bit(EV_REP, input->evbit); ++ input->rep[REP_DELAY] = 500; ++ input->rep[REP_PERIOD] = 125; ++ ++ return 0; ++} ++ + static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc, + unsigned int *rsize) + { +@@ -2372,6 +2391,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) + sony_init_output_report(sc, dualshock4_send_output_report); + } else if (sc->quirks & MOTION_CONTROLLER) { + sony_init_output_report(sc, motion_send_output_report); ++ } else if (sc->quirks & PS3REMOTE) { ++ ret = ps3remote_setup_repeat(hdev); + } else { + ret = 0; + } +-- +2.5.0 diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-062-imon_pad_ignore_diagonal.patch b/packages/linux/patches/raspberrypi/linux-062-imon_pad_ignore_diagonal.patch similarity index 100% rename from projects/imx6/patches/linux/3.14-mx6-sr/linux-062-imon_pad_ignore_diagonal.patch rename to packages/linux/patches/raspberrypi/linux-062-imon_pad_ignore_diagonal.patch diff --git a/packages/linux/patches/raspberrypi/linux-901-extend-rc6-toggle-support.patch b/packages/linux/patches/raspberrypi/linux-901-extend-rc6-toggle-support.patch new file mode 100644 index 0000000000..de21628bda --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-901-extend-rc6-toggle-support.patch @@ -0,0 +1,52 @@ +From 3f1f8303b6e0be751d7a7c55031c8ab840ed5c1a Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 24 Aug 2018 23:31:51 +0200 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Kathrein + RCU-676 remote + +The Kathrein RCU-676 remote uses the 32-bit rc6 protocol and toggles +bit 15 (0x8000) on repeated button presses, like MCE remotes. + +Add it's customer code 0x80460000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index 68487ce9f79b..d96aed1343e4 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ + #endif +@@ -242,13 +243,17 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + toggle = 0; + break; + case 32: +- if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { ++ switch (scancode & RC6_6A_LCC_MASK) { ++ case RC6_6A_MCE_CC: ++ case RC6_6A_KATHREIN_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +- } else { ++ break; ++ default: + protocol = RC_PROTO_RC6_6A_32; + toggle = 0; ++ break; + } + break; + default: +-- +2.11.0 + diff --git a/packages/linux/patches/raspberrypi/linux-902-extend-rc6-toggle-support-for-zotac.patch b/packages/linux/patches/raspberrypi/linux-902-extend-rc6-toggle-support-for-zotac.patch new file mode 100644 index 0000000000..65fe5fd6c7 --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-902-extend-rc6-toggle-support-for-zotac.patch @@ -0,0 +1,41 @@ +From ae1ccaa3587c0bd3d6d01841fa2e668cdf738f1e Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 3 Feb 2019 14:24:00 +0100 +Subject: [PATCH] media: rc: ir-rc6-decoder: enable toggle bit for Zotac + remotes + +The Zotac RC2604323/01G and RC2604329/02BG remotes use the 32-bit +rc6 protocol and toggle bit 15 (0x8000) on repeated button presses, +like MCE remotes. + +Add the customer code 0x80340000 to the 32-bit rc6 toggle +handling code to get proper scancodes and toggle reports. + +Signed-off-by: Matthias Reichl +--- + drivers/media/rc/ir-rc6-decoder.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index d96aed1343e4..5cc302fa4daa 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_ZOTAC_CC 0x80340000 /* Zotac customer code */ + #define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in */ +@@ -246,6 +247,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) + switch (scancode & RC6_6A_LCC_MASK) { + case RC6_6A_MCE_CC: + case RC6_6A_KATHREIN_CC: ++ case RC6_6A_ZOTAC_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +-- +2.20.1 + diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch b/packages/linux/patches/raspberrypi/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch similarity index 100% rename from projects/imx6/patches/linux/3.14-mx6-sr/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch rename to packages/linux/patches/raspberrypi/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch diff --git a/packages/linux/patches/raspberrypi/linux-999.03-dvbskys960-fix.patch b/packages/linux/patches/raspberrypi/linux-999.03-dvbskys960-fix.patch new file mode 100644 index 0000000000..bc610f8642 --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-999.03-dvbskys960-fix.patch @@ -0,0 +1,39 @@ +From: jahutchi +Date: Fri, 11 Jan 2019 13:35:00 +0000 +Subject: [PATCH] media: m88ds3103: serialize reset messages in m88ds3103_set_frontend + +Ref: +https://bugzilla.kernel.org/show_bug.cgi?id=199323 +https://forum.libreelec.tv/thread/12452-problems-with-dvbsky-technotrend-usb-dvb-s2-tuners-since-le8/ + +DVBSky S960/S960C are partly broken since linux kernel commit (4.10rc1) +https://github.com/torvalds/linux/commit/9d659ae14b545c4296e812c70493bfdc999b5c1c + +diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c +index dffd2d4bf1..e495a26e6e 100644 +--- a/drivers/media/dvb-frontends/m88ds3103.c ++++ b/drivers/media/dvb-frontends/m88ds3103.c +@@ -309,6 +309,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) + u16 u16tmp; + u32 tuner_frequency_khz, target_mclk; + s32 s32tmp; ++ static const struct reg_sequence reset_buf[] = {{0x07, 0x80}, {0x07, 0x00}}; + + dev_dbg(&client->dev, + "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", +@@ -321,11 +322,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) + } + + /* reset */ +- ret = regmap_write(dev->regmap, 0x07, 0x80); +- if (ret) +- goto err; +- +- ret = regmap_write(dev->regmap, 0x07, 0x00); ++ ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2); + if (ret) + goto err; + +-- +2.7.4 + diff --git a/packages/linux/sysctl.d/qdisc.conf b/packages/linux/sysctl.d/qdisc.conf new file mode 100644 index 0000000000..ffd7273d37 --- /dev/null +++ b/packages/linux/sysctl.d/qdisc.conf @@ -0,0 +1 @@ +net.core.default_qdisc = fq_codel diff --git a/packages/linux/udev.d/30-disable-wakeup.rules b/packages/linux/udev.d/30-disable-wakeup.rules index 7abbac3baf..c4769477e9 100644 --- a/packages/linux/udev.d/30-disable-wakeup.rules +++ b/packages/linux/udev.d/30-disable-wakeup.rules @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) ACTION!="add|change", GOTO="end" diff --git a/packages/linux/udev.d/40-modeswitch.rules b/packages/linux/udev.d/40-modeswitch.rules index 583bc91c9b..8d3b1720c6 100644 --- a/packages/linux/udev.d/40-modeswitch.rules +++ b/packages/linux/udev.d/40-modeswitch.rules @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) ACTION!="add|change", GOTO="end_modeswitch" KERNEL!="sr[0-9]*", GOTO="end_modeswitch" diff --git a/packages/mediacenter/JsonSchemaBuilder/package.mk b/packages/mediacenter/JsonSchemaBuilder/package.mk index 935b2fe4ed..b61af9fcfc 100644 --- a/packages/mediacenter/JsonSchemaBuilder/package.mk +++ b/packages/mediacenter/JsonSchemaBuilder/package.mk @@ -1,45 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="JsonSchemaBuilder" PKG_VERSION="0" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="" -PKG_NEED_UNPACK="$ROOT/packages/mediacenter/$MEDIACENTER/package.mk" -PKG_SECTION="mediacenter" -PKG_SHORTDESC="kodi-platform:" +PKG_NEED_UNPACK="$(get_pkg_directory $MEDIACENTER)" PKG_LONGDESC="kodi-platform:" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CMAKE_SCRIPT="$(get_build_dir $MEDIACENTER)/tools/depends/native/JsonSchemaBuilder/CMakeLists.txt" PKG_CMAKE_OPTS_HOST="-Wno-dev" -pre_build_host() { - $SCRIPTS/clean $PKG_NAME -} - makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp JsonSchemaBuilder $ROOT/$TOOLCHAIN/bin + mkdir -p $TOOLCHAIN/bin + cp JsonSchemaBuilder $TOOLCHAIN/bin } diff --git a/packages/mediacenter/LibreELEC-settings/package.mk b/packages/mediacenter/LibreELEC-settings/package.mk index fb7ec18c22..d94804069e 100644 --- a/packages/mediacenter/LibreELEC-settings/package.mk +++ b/packages/mediacenter/LibreELEC-settings/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="LibreELEC-settings" -PKG_VERSION="ea5227a" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="prop." +PKG_VERSION="37e206b712a46213522a567a408382f5f082502a" +PKG_SHA256="d2d219f76ff41e3e933bac946978fd8971ef65df117459c3fd911dabb95115ad" +PKG_LICENSE="GPL" PKG_SITE="https://libreelec.tv" PKG_URL="https://github.com/LibreELEC/service.libreelec.settings/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="service.libreelec.settings-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain Python connman pygobject dbus-python" -PKG_SECTION="" -PKG_SHORTDESC="LibreELEC-settings: Settings dialog for LibreELEC" +PKG_DEPENDS_TARGET="toolchain Python2 connman pygobject dbus-python" PKG_LONGDESC="LibreELEC-settings: is a settings dialog for LibreELEC" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_MAKE_OPTS_TARGET="DISTRONAME=$DISTRONAME ROOT_PASSWORD=$ROOT_PASSWORD" if [ "$DISPLAYSERVER" = "x11" ]; then @@ -44,16 +23,13 @@ post_makeinstall_target() { mkdir -p $INSTALL/usr/lib/libreelec cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec -# # bluetooth is optional -# if [ ! "$BLUETOOTH_SUPPORT" = yes ]; then -# rm -f resources/lib/modules/bluetooth.py -# fi + ADDON_INSTALL_DIR=$INSTALL/usr/share/kodi/addons/service.libreelec.settings - python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/kodi/addons/service.libreelec.settings/resources/lib/ -f - rm -rf `find $INSTALL/usr/share/kodi/addons/service.libreelec.settings/resources/lib/ -name "*.py"` + $TOOLCHAIN/bin/python -Wi -t -B $TOOLCHAIN/lib/$PKG_PYTHON_VERSION/compileall.py $ADDON_INSTALL_DIR/resources/lib/ -f + rm -rf $(find $ADDON_INSTALL_DIR/resources/lib/ -name "*.py") - python -Wi -t -B $ROOT/$TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/kodi/addons/service.libreelec.settings/oe.py -f - rm -rf $INSTALL/usr/share/kodi/addons/service.libreelec.settings/oe.py + $TOOLCHAIN/bin/python -Wi -t -B $TOOLCHAIN/lib/$PKG_PYTHON_VERSION/compileall.py $ADDON_INSTALL_DIR/oe.py -f + rm -rf $ADDON_INSTALL_DIR/oe.py } post_install() { diff --git a/packages/mediacenter/LibreELEC-settings/scripts/backup-restore b/packages/mediacenter/LibreELEC-settings/scripts/backup-restore index da3c07f182..3ed483a5e1 100755 --- a/packages/mediacenter/LibreELEC-settings/scripts/backup-restore +++ b/packages/mediacenter/LibreELEC-settings/scripts/backup-restore @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /usr/lib/libreelec/functions diff --git a/packages/mediacenter/LibreELEC-settings/scripts/factory-reset b/packages/mediacenter/LibreELEC-settings/scripts/factory-reset index 3a8e27bd1c..a619f1d482 100755 --- a/packages/mediacenter/LibreELEC-settings/scripts/factory-reset +++ b/packages/mediacenter/LibreELEC-settings/scripts/factory-reset @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /usr/lib/libreelec/functions diff --git a/packages/mediacenter/OpenPHT-settings/package.mk b/packages/mediacenter/OpenPHT-settings/package.mk new file mode 100644 index 0000000000..268bccfd2c --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/package.mk @@ -0,0 +1,65 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="OpenPHT-settings" +PKG_VERSION="1.9" +PKG_ARCH="any" +PKG_LICENSE="prop." +PKG_SITE="http://www.rasplex.com" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain Python2 connman pygobject dbus-python" +PKG_SECTION="" +PKG_SHORTDESC="OpenPHT-settings: Settings dialog for OpenPHT-Embedded/RasPlex" +PKG_LONGDESC="OpenPHT-settings: is a settings dialog for OpenPHT-Embedded/RasPlex" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +PKG_MAKE_OPTS_TARGET="DISTRONAME=$DISTRONAME ROOT_PASSWORD=$ROOT_PASSWORD" + +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET setxkbmap" +else + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bkeymaps" +fi + +unpack() { + rm -rf $BUILD/$PKG_NAME-$PKG_VERSION + git clone --depth 1 --branch $OPENPHT_BRANCH $OPENPHT_SETTINGS_REPO $BUILD/$PKG_NAME-$PKG_VERSION +} + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec + +# # bluetooth is optional +# if [ ! "$BLUETOOTH_SUPPORT" = yes ]; then +# rm -f resources/lib/modules/bluetooth.py +# fi + + python -Wi -t -B $TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/XBMC/addons/service.libreelec.settings/resources/lib/ -f + rm -rf `find $INSTALL/usr/share/XBMC/addons/service.libreelec.settings/resources/lib/ -name "*.py"` + + python -Wi -t -B $TOOLCHAIN/lib/python2.7/compileall.py $INSTALL/usr/share/XBMC/addons/service.libreelec.settings/oe.py -f + rm -rf $INSTALL/usr/share/XBMC/addons/service.libreelec.settings/oe.py +} + +post_install() { + enable_service backup-restore.service + enable_service factory-reset.service +} diff --git a/packages/mediacenter/OpenPHT-settings/scripts/backup-restore b/packages/mediacenter/OpenPHT-settings/scripts/backup-restore new file mode 100755 index 0000000000..7d5e1fb64e --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/scripts/backup-restore @@ -0,0 +1,75 @@ +#!/bin/sh +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +. /usr/lib/libreelec/functions + +# Get NAME, which is DISTRONAME, ie. LibreELEC +. /etc/os-release + +hidecursor + +BACKUP_FILE=`ls -1 /storage/.restore/??????????????.tar 2>/dev/null | tail -1` + +if [ -f "$BACKUP_FILE" ] ; then + echo "RESTORE IN PROGRESS" + echo "" + echo "Please do not reboot or turn off your ${NAME} device!" + echo "" + + StartProgress spinner "Checking backup file... " + tar tf $BACKUP_FILE &>/dev/null + ret=$? + + if [ $ret -eq 0 ] ; then + StopProgress "OK" + + echo + echo "This may take some time to complete, please be patient." + echo + + StartProgress spinner "Restoring... " + rm -rf /storage/.plexht &>/dev/null + rm -rf /storage/.cache &>/dev/null + rm -rf /storage/.config &>/dev/null + tar xf $BACKUP_FILE -C / &>/dev/null + rm -f $BACKUP_FILE &>/dev/null + sync + StopProgress "done!" + + echo + StartProgress countdown "Rebooting in 5s... " 5 "NOW" + else + StopProgress "FAILED" + + echo + echo "Backup file is not valid, or corrupt." + + echo + StartProgress spinner "Removing file to allow normal restart... " + rm -f $BACKUP_FILE &>/dev/null + sync + StopProgress "done" + + echo + StartProgress countdown "Rebooting in 30s... " 30 "NOW" + fi +fi + +sync +reboot -f diff --git a/packages/mediacenter/OpenPHT-settings/scripts/factory-reset b/packages/mediacenter/OpenPHT-settings/scripts/factory-reset new file mode 100755 index 0000000000..3a8e27bd1c --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/scripts/factory-reset @@ -0,0 +1,99 @@ +#!/bin/sh +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +. /usr/lib/libreelec/functions + +# Get NAME, which is DISTRONAME, ie. LibreELEC +. /etc/os-release + +hidecursor + +label= +target= +uuid= + +get_target() { + for arg in $(cat /proc/cmdline); do + case $arg in + disk=*) + disk="${arg#*=}" + case $disk in + LABEL=*) + label="${disk#*=}" + target="$(blkid -L $label)" + ;; + UUID=*) + uuid="${disk#*=}" + target="$(blkid -U $uuid)" + ;; + /*) + target="$disk" + ;; + esac + ;; + esac + done +} + +show_reset_msg() { + echo "RESET IN PROGRESS" + echo "" + echo "Please do not reboot or turn off your ${NAME} device!" + echo "" +} + +if [ -f /storage/.cache/reset_oe ] ; then + # hard reset + rm -f /storage/.cache/reset_oe + get_target + if [ ! -z $target ] ; then + show_reset_msg + + StartProgress spinner "Performing hard reset... " + umount /storage + mke2fs -t ext4 -m 0 $target &>/dev/null + if [ ! -z $label ] ; then + tune2fs -U random -L $label $target &>/dev/null + fi + if [ ! -z $uuid ] ; then + tune2fs -U $uuid $target &>/dev/null + fi + StopProgress "done!" + + echo + StartProgress countdown "Rebooting in 5s... " 5 "NOW" + fi +elif [ -f /storage/.cache/reset_xbmc ] ; then + # soft reset + rm -f /storage/.cache/reset_xbmc + get_target + if [ ! -z $target ] ; then + show_reset_msg + + StartProgress spinner "Performing soft reset... " + rm -rf /storage/.??* &>/dev/null + StopProgress "done!" + + echo + StartProgress countdown "Rebooting in 5s... " 5 "NOW" + fi +fi + +sync +reboot -f diff --git a/packages/mediacenter/OpenPHT-settings/sources/OPENPHT b/packages/mediacenter/OpenPHT-settings/sources/OPENPHT new file mode 100644 index 0000000000..19935a0b0c --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/sources/OPENPHT @@ -0,0 +1 @@ +OpenPHT-Embedded diff --git a/packages/mediacenter/OpenPHT-settings/system.d/backup-restore.service b/packages/mediacenter/OpenPHT-settings/system.d/backup-restore.service new file mode 100644 index 0000000000..25f06e8589 --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/system.d/backup-restore.service @@ -0,0 +1,10 @@ +[Unit] +Description=Restoring Backup +DefaultDependencies=no + +[Service] +Type=idle +ExecStart=/usr/lib/libreelec/backup-restore +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit diff --git a/packages/mediacenter/OpenPHT-settings/system.d/backup-restore.target b/packages/mediacenter/OpenPHT-settings/system.d/backup-restore.target new file mode 100644 index 0000000000..8ade350df2 --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/system.d/backup-restore.target @@ -0,0 +1,5 @@ +[Unit] +Description=Restoring Backup target +Requires=backup-restore.service +After=backup-restore.service +AllowIsolate=yes diff --git a/packages/mediacenter/OpenPHT-settings/system.d/factory-reset.service b/packages/mediacenter/OpenPHT-settings/system.d/factory-reset.service new file mode 100644 index 0000000000..5b25d73d0a --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/system.d/factory-reset.service @@ -0,0 +1,10 @@ +[Unit] +Description=Factory reset +DefaultDependencies=no + +[Service] +Type=idle +ExecStart=/usr/lib/libreelec/factory-reset +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit diff --git a/packages/mediacenter/OpenPHT-settings/system.d/factory-reset.target b/packages/mediacenter/OpenPHT-settings/system.d/factory-reset.target new file mode 100644 index 0000000000..28c5aa4f20 --- /dev/null +++ b/packages/mediacenter/OpenPHT-settings/system.d/factory-reset.target @@ -0,0 +1,5 @@ +[Unit] +Description=Factory reset target +Requires=factory-reset.service +After=factory-reset.service +AllowIsolate=yes diff --git a/packages/mediacenter/TexturePacker/package.mk b/packages/mediacenter/TexturePacker/package.mk index af0d64926d..8faa689907 100644 --- a/packages/mediacenter/TexturePacker/package.mk +++ b/packages/mediacenter/TexturePacker/package.mk @@ -1,51 +1,24 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="TexturePacker" PKG_VERSION="0" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="" PKG_DEPENDS_HOST="lzo:host libpng:host libjpeg-turbo:host giflib:host" -PKG_NEED_UNPACK="$ROOT/packages/mediacenter/$MEDIACENTER/package.mk" -PKG_SECTION="mediacenter" -PKG_SHORTDESC="kodi-platform:" +PKG_NEED_UNPACK="$(get_pkg_directory $MEDIACENTER)" PKG_LONGDESC="kodi-platform:" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CMAKE_SCRIPT="$(get_build_dir $MEDIACENTER)/tools/depends/native/TexturePacker/CMakeLists.txt" -PKG_CMAKE_OPTS_HOST="-DCORE_SOURCE_DIR=$(get_build_dir $MEDIACENTER) \ - -Wno-dev" - -pre_build_host() { - $SCRIPTS/clean $PKG_NAME -} +PKG_CMAKE_OPTS_HOST="-Wno-dev" pre_configure_host() { - export CXXFLAGS="$CXXFLAGS -std=c++11 -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -I$(get_build_dir $MEDIACENTER)/xbmc/linux" + export CXXFLAGS="$CXXFLAGS -std=c++11 -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -I$(get_build_dir $MEDIACENTER)/xbmc/platform/linux" } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp TexturePacker $ROOT/$TOOLCHAIN/bin + mkdir -p $TOOLCHAIN/bin + cp TexturePacker $TOOLCHAIN/bin } diff --git a/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk deleted file mode 100644 index 3a8500e020..0000000000 --- a/packages/mediacenter/kodi-binary-addons/adsp.basic/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="adsp.basic" -PKG_VERSION="2ae604e" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/kodi-adsp/adsp.basic/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform libsamplerate" -PKG_SECTION="" -PKG_SHORTDESC="adsp.basic" -PKG_LONGDESC="adsp.basic" -PKG_AUTORECONF="no" - -PKG_IS_ADDON="yes" -PKG_ADDON_TYPE="kodi.adsp" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk deleted file mode 100644 index b630bbafce..0000000000 --- a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="adsp.biquad.filters" -PKG_VERSION="e08990f" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/kodi-adsp/adsp.biquad.filters/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform asplib tinyxml" -PKG_SECTION="" -PKG_SHORTDESC="adsp.biquad.filters" -PKG_LONGDESC="adsp.biquad.filters" -PKG_AUTORECONF="no" - -PKG_IS_ADDON="yes" -PKG_ADDON_TYPE="kodi.adsp" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/patches/adsp.biquad.filters-gcc-6.patch b/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/patches/adsp.biquad.filters-gcc-6.patch deleted file mode 100644 index 77ef8a8995..0000000000 --- a/packages/mediacenter/kodi-binary-addons/adsp.biquad.filters/patches/adsp.biquad.filters-gcc-6.patch +++ /dev/null @@ -1,35 +0,0 @@ -From abae62ace5cd09025acaf8e03e5edad94131ff07 Mon Sep 17 00:00:00 2001 -From: Bernd Kuhls -Date: Sun, 24 Apr 2016 22:42:07 +0200 -Subject: [PATCH] ADSPHelpers.cpp: Fix compilation with gcc6 - -Fixes https://github.com/kodi-adsp/adsp.biquad.filters/issues/13 - -Patch inspired by -https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4 ---- - src/template/ADSPHelpers.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/template/ADSPHelpers.cpp b/src/template/ADSPHelpers.cpp -index 5aa6a7d..f66e77f 100644 ---- a/src/template/ADSPHelpers.cpp -+++ b/src/template/ADSPHelpers.cpp -@@ -24,7 +24,7 @@ - using namespace std; - - #if !defined(TARGET_WINDOWS) -- inline float abs(float Val) -+ inline float iabs(float Val) - { - if(Val >= 0.0f) - { -@@ -441,7 +441,7 @@ float CADSPHelpers::Convert_dB_TO_Value(float dB) - - float CADSPHelpers::Convert_Value_TO_dB(float Scale) - { -- return 20.0f*log10f(abs(Scale)); -+ return 20.0f*log10f(iabs(Scale)); - } - - // reserved for future implementation diff --git a/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk b/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk deleted file mode 100644 index 33711ddbb3..0000000000 --- a/packages/mediacenter/kodi-binary-addons/adsp.freesurround/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="adsp.freesurround" -PKG_VERSION="61568b9" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/kodi-adsp/adsp.freesurround/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform" -PKG_SECTION="" -PKG_SHORTDESC="adsp.freesurround" -PKG_LONGDESC="adsp.freesurround" -PKG_AUTORECONF="no" - -PKG_IS_ADDON="yes" -PKG_ADDON_TYPE="kodi.adsp" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk index 7a7d2b8c7d..d539063bcb 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.2sf/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.2sf" -PKG_VERSION="05fa941" -PKG_REV="1" +PKG_VERSION="a15ec0d3380b2028277232dbf066753cd8ffcace" +PKG_SHA256="d70bf6b68d575b803daa7f7673fd1be4eda9f75a86f00858bfff3068330f321a" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.2sf" -PKG_URL="https://github.com/notspiff/audiodecoder.2sf/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.2sf" +PKG_URL="https://github.com/xbmc/audiodecoder.2sf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.2sf" PKG_LONGDESC="audiodecoder.2sf" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk index ee2763dac1..09f5a66f1c 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.asap/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.asap" -PKG_VERSION="e56a821" -PKG_REV="1" +PKG_VERSION="73c556857e31ae441e4ae797761c88614158a855" +PKG_SHA256="aa79350067fcedeabbf0ed400f34e23fa0c24532f16b9ccfbd5575855adb7194" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.asap" -PKG_URL="https://github.com/notspiff/audiodecoder.asap/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.asap" +PKG_URL="https://github.com/xbmc/audiodecoder.asap/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.asap" PKG_LONGDESC="audiodecoder.asap" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk index 6553771742..73bc9d6d8f 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.dumb/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.dumb" -PKG_VERSION="6c15ef8" -PKG_REV="1" +PKG_VERSION="12fc8fed694029754575ccf17375fc4113d3c033" +PKG_SHA256="7c72e6d5a3213ea7fbf0c699ba40eae53c8478314859357fd2ae4a0851347d96" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.dumb" -PKG_URL="https://github.com/notspiff/audiodecoder.dumb/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.dumb" +PKG_URL="https://github.com/xbmc/audiodecoder.dumb/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.dumb" PKG_LONGDESC="audiodecoder.dumb" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk index 635219b69a..b64f392666 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.fluidsynth/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.fluidsynth" -PKG_VERSION="67fd270" -PKG_REV="1" +PKG_VERSION="6c70bad814040007a180788d64d278736e9400fa" +PKG_SHA256="e4915900e79572cadf11281c33765418deb40a807c73abcc9444fb103a2a9628" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.fluidsynth" -PKG_URL="https://github.com/notspiff/audiodecoder.fluidsynth/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.fluidsynth" +PKG_URL="https://github.com/xbmc/audiodecoder.fluidsynth/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform fluidsynth" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.fluidsynth" PKG_LONGDESC="audiodecoder.fluidsynth" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk index 50b427edc3..e6b9d64334 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.gme/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.gme" -PKG_VERSION="4f8c49a" -PKG_REV="1" +PKG_VERSION="8d7401385fa4af4961318b1f3820c251381632be" +PKG_SHA256="5e69e67e8460d2f0faae2027dd5ab32681003dabfd277dc5c8bad2f7b4b0e8ed" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.gme" -PKG_URL="https://github.com/notspiff/audiodecoder.gme/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.gme" +PKG_URL="https://github.com/xbmc/audiodecoder.gme/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.gme" PKG_LONGDESC="audiodecoder.gme" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk index 01672584be..e758eb652e 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.gsf/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.gsf" -PKG_VERSION="122ff46" -PKG_REV="1" +PKG_VERSION="18e321d526039a6997151d306335bdcdbcabe148" +PKG_SHA256="0d641064b587f6a83285f1a9a92497b2ff6e9e73e096677653496bc1691884fd" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.gsf" -PKG_URL="https://github.com/notspiff/audiodecoder.gsf/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.gsf" +PKG_URL="https://github.com/xbmc/audiodecoder.gsf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.gsf" PKG_LONGDESC="audiodecoder.gsf" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk index ef27c68470..feed5a0e1a 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.modplug/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.modplug" -PKG_VERSION="8a8e961" -PKG_REV="1" +PKG_VERSION="8bc0fc5dd14cf68e87ba243e36bbc20f934c5047" +PKG_SHA256="eed2edc7092c39a20af29706721be084820d1cce92198f767c29ea2368d2dd46" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.modplug/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.modplug/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libmodplug" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.modplug" PKG_LONGDESC="audiodecoder.modplug" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk index 287742f463..5d4fc12e61 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.ncsf/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.ncsf" -PKG_VERSION="8835a04" -PKG_REV="1" +PKG_VERSION="03fb9a7e606856f982509e0e515ca158ac1dd793" +PKG_SHA256="0e4dfbaba208edad1a42b2d135171092a2643645278dfacdba505455f6869925" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.ncsf" -PKG_URL="https://github.com/notspiff/audiodecoder.ncsf/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.ncsf" +PKG_URL="https://github.com/xbmc/audiodecoder.ncsf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.ncsf" PKG_LONGDESC="audiodecoder.ncsf" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk index a863abb86c..6193610be9 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.nosefart/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.nosefart" -PKG_VERSION="1d3de76" -PKG_REV="1" +PKG_VERSION="7629ccffe3ea8f72a4ce3ea25d6c0b9cf9c310b0" +PKG_SHA256="8d41b0701d5a684820d9371e9f4f5022cc9eec8de8d12965b06741c477dd8134" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.nosefart/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.nosefart/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.nosefart" PKG_LONGDESC="audiodecoder.nosefart" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk index 8b0c74fc01..1822f07240 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.openmpt/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.openmpt" -PKG_VERSION="ceaffa1" -PKG_REV="1" +PKG_VERSION="15796e64b7359719bd766f9dc9a6c3e59fe33959" +PKG_SHA256="7ae364ad42788c464068876050a6e5a08c71b6a6af24a114fd5ddf729c81e68e" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.openmpt/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.openmpt/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libopenmpt" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.openmpt" PKG_LONGDESC="audiodecoder.openmpt" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk index 7fa1de2a89..d50562c38c 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.organya/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.organya" -PKG_VERSION="8573890" -PKG_REV="1" +PKG_VERSION="a94a3dc5c56bd43bf460b54f5c1f35d8a60db6b8" +PKG_SHA256="f8f30b4f6cba2c066cb0c2cd766152874e80d7ddf1550c58a6853b537c32ac8f" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.organya" -PKG_URL="https://github.com/notspiff/audiodecoder.organya/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.organya" +PKG_URL="https://github.com/xbmc/audiodecoder.organya/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.organya" PKG_LONGDESC="audiodecoder.organya" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk index 5f9499dc00..41618eed3b 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.qsf/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.qsf" -PKG_VERSION="5edc117" -PKG_REV="1" +PKG_VERSION="bb9b5942d756936d0b94017312b16474362f0671" +PKG_SHA256="5e3eb9f8a3cade2696ac1b2f99b78364373bd3cd9c41326db343c1710b9207c1" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.qsf" -PKG_URL="https://github.com/notspiff/audiodecoder.qsf/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.qsf" +PKG_URL="https://github.com/xbmc/audiodecoder.qsf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.qsf" PKG_LONGDESC="audiodecoder.qsf" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk index 8c3e46e370..2bedb64306 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.sidplay/package.mk @@ -1,43 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.sidplay" -PKG_VERSION="3e8a22e" -PKG_REV="1" +PKG_VERSION="dad5daa4018721914d1bce56d2551ffcd4855830" +PKG_SHA256="32ece47f2e95a45bc20ba99fbf3a98c0153b3223a98cb6cc75bba0e588ef50cc" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.sidplay/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.sidplay/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform sidplay-libs" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.sidplay" PKG_LONGDESC="audiodecoder.sidplay" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" PKG_CMAKE_OPTS_TARGET="-DSIDPLAY2_LIBRARIES=$SYSROOT_PREFIX/usr/lib" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk index e5c6355d13..1a8062b807 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.snesapu/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.snesapu" -PKG_VERSION="84b7104" -PKG_REV="1" +PKG_VERSION="32bed39a2e9bbd7df8ce2cef5fd2681579d5ec30" +PKG_SHA256="994ac5268ed46b8c2b63e749e5c3645ff95b64ddc2eeeabf5b8c439497eb0959" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.snesapu/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.snesapu/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.snesapu" PKG_LONGDESC="audiodecoder.snesapu" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk index 9db3a5b9f4..038e38ff3a 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.ssf/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.ssf" -PKG_VERSION="b12c97d" -PKG_REV="1" +PKG_VERSION="c4a47aaf4bd8d553bdac1635d07ac96ec1498964" +PKG_SHA256="1580969bdf075d59d58936a6056f548bcb28b4e2e84d823ab193317d620e8dd0" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.ssf" -PKG_URL="https://github.com/notspiff/audiodecoder.ssf/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.ssf" +PKG_URL="https://github.com/xbmc/audiodecoder.ssf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.ssf" PKG_LONGDESC="audiodecoder.ssf" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk index 4ca18b373d..0cdcc8e983 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.stsound/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.stsound" -PKG_VERSION="a306bf6" -PKG_REV="1" +PKG_VERSION="ea89e6bfbf47c970cdbcf511f297b6eeb42bfb8f" +PKG_SHA256="41a35f9212994146fa81fdf5a9198fb92bd4df3d46b0362f96242a7b94286562" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.stsound/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.stsound/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.stsound" PKG_LONGDESC="audiodecoder.stsound" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk index a36019f2b0..0bc270e9c8 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.timidity/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.timidity" -PKG_VERSION="20823d2" -PKG_REV="1" +PKG_VERSION="4f5d719ab2a79493fc9e39ed553e028e83f99252" +PKG_SHA256="6da4320f8c1ecb2b37c0a41f459c60d30d0944b28dac594fe959b36bfbab4278" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.timidity/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.timidity/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.timidity" PKG_LONGDESC="audiodecoder.timidity" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk index 4653bc1231..085556b947 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.upse/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.upse" -PKG_VERSION="23a5430" -PKG_REV="1" +PKG_VERSION="4b384df43004c7b75cce3df3c4e165988c753875" +PKG_SHA256="826d2be4c4d884447713050528cc64d6d719bf43b453b0e0227c40242f1a8348" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.upse" -PKG_URL="https://github.com/notspiff/audiodecoder.upse/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.upse" +PKG_URL="https://github.com/xbmc/audiodecoder.upse/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.upse" PKG_LONGDESC="audiodecoder.upse" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk index bdbefd3214..42e75aa1cc 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.usf/package.mk @@ -1,42 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.usf" -PKG_VERSION="ce4b75c" -PKG_REV="1" +PKG_VERSION="37369f4c048e71f1561d77042fbd7dd1e413b1d8" +PKG_SHA256="a5fbd711bf70b59f85f8b7bd63c4662a3d3a01d4e907e0c53cf0af9ccc02b40a" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.usf" -PKG_URL="https://github.com/notspiff/audiodecoder.usf/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.usf" +PKG_URL="https://github.com/xbmc/audiodecoder.usf/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.usf" PKG_LONGDESC="audiodecoder.usf" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" PKG_ADDON_PROJECTS="Generic Nvidia_Legacy RPi2 imx6 WeTek_Play" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk index a305254f26..c6096a379f 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.vgmstream/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.vgmstream" -PKG_VERSION="562c3a4" -PKG_REV="1" +PKG_VERSION="1204a2255a4422b04478160b9ae63928f1d28d3e" +PKG_SHA256="08b05e07201f70675771f97eca705ba1cc927e603bbae143c920409b899a727b" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/audiodecoder.vgmstream/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/audiodecoder.vgmstream/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.vgmstream" PKG_LONGDESC="audiodecoder.vgmstream" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk b/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk index c236d52311..1e43d6fb28 100644 --- a/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audiodecoder.wsr/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audiodecoder.wsr" -PKG_VERSION="746fcbb" -PKG_REV="1" +PKG_VERSION="fa3fa8670b297737e8401398b91cb0dd20398128" +PKG_SHA256="d8ea98ccbb717224f0cdc5f5289ba45b1048a5bd4418f0970ac105ba0c2762b4" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/audiodecoder.wsr" -PKG_URL="https://github.com/notspiff/audiodecoder.wsr/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/audiodecoder.wsr" +PKG_URL="https://github.com/xbmc/audiodecoder.wsr/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audiodecoder.wsr" PKG_LONGDESC="audiodecoder.wsr" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="kodi.audiodecoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk index 88f49f5f68..421363c788 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.flac/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audioencoder.flac" -PKG_VERSION="f7a8daa" -PKG_REV="1" +PKG_VERSION="7bce2e5aeb5b9f272520a096805a40ea9421b96d" +PKG_SHA256="5c65d789e7a9180208b539a63fcb092a84f1d4c4fadd85a53805f21bb2427c45" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform flac" PKG_SECTION="" PKG_SHORTDESC="audioencoder.flac: A audioencoder addon for Kodi" PKG_LONGDESC="audioencoder.flac is a audioencoder addon for Kodi" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.audioencoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk index f954c148b1..eada87bbb0 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.lame/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audioencoder.lame" -PKG_VERSION="6e5c838" -PKG_REV="1" +PKG_VERSION="476f4b2e70f527a1db18bd8022c045ba16957deb" +PKG_SHA256="1965fd14053cd70b5034df570ba43aa450702560d2eef2dd39e6ed1520ab4810" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform lame" PKG_SECTION="" PKG_SHORTDESC="audioencoder.lame: A audioencoder addon for Kodi" PKG_LONGDESC="audioencoder.lame is a audioencoder addon for Kodi" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.audioencoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk index 0084c9680c..8e026a8a1e 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.vorbis/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audioencoder.vorbis" -PKG_VERSION="8c928ed" -PKG_REV="1" +PKG_VERSION="acd7c796109971fa05bf33f620d7b737e5dbd0bb" +PKG_SHA256="bb624a6926ff932a657d52702d503ffcb416db5065004e9b4207d9c5019f03c4" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform libogg libvorbis" PKG_SECTION="" PKG_SHORTDESC="audioencoder.vorbis: A audioencoder addon for Kodi" PKG_LONGDESC="audioencoder.vorbis is a audioencoder addon for Kodi" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.audioencoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk b/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk index ce7f11666e..93a7eaa752 100644 --- a/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk +++ b/packages/mediacenter/kodi-binary-addons/audioencoder.wav/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="audioencoder.wav" -PKG_VERSION="10cc651" -PKG_REV="1" +PKG_VERSION="673c60888102c5b7114b5ef4276be50b88cf3460" +PKG_SHA256="4a55683433f4cf497a500436d556e30e22f864a62681be26e9ea82d7f9630a7f" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="audioencoder.wav: A audioencoder addon for Kodi" PKG_LONGDESC="audioencoder.wav is a audioencoder addon for Kodi" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.audioencoder" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.2048/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.2048/package.mk new file mode 100644 index 0000000000..95588295b3 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.2048/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.2048" +PKG_VERSION="6c6c41ed6c82732c9dcaefb26053859dee34023f" +PKG_SHA256="c2c45bd965eed4c43aec7ab00238a96002d903284f83b56c0abc3d285ed998f3" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.2048" +PKG_URL="https://github.com/kodi-game/game.libretro.2048/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-2048" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.2048: 2048 for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.4do/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.4do/package.mk new file mode 100644 index 0000000000..8feab9ca36 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.4do/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.4do" +PKG_VERSION="16800da779beed3c9e052f88bd128c310d6b6639" +PKG_SHA256="d51c029efa2150b2d3abf3951efb839ee376cbb56d90cdf8796140e9cdb0b7a5" +PKG_REV="114" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.4do" +PKG_URL="https://github.com/kodi-game/game.libretro.4do/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-4do" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.4do: 4DO for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-bsnes/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-bsnes/package.mk new file mode 100644 index 0000000000..ecd212837c --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-bsnes/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-bsnes" +PKG_VERSION="5eb2843c866ed99c604554a0066b1d0070705fb4" +PKG_SHA256="df98b80437d3f9413cc1271503ecf2307bd9dbffa4eca862c89a25b2a81b08b7" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-bsnes" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-bsnes/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-bsnes" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-bsnes: Beetle bSNES for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-gba/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-gba/package.mk new file mode 100644 index 0000000000..2392fd2934 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-gba/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-gba" +PKG_VERSION="566630f565be325b544aa89a4e99c5705f771248" +PKG_SHA256="d66b9b2a3f9fabe0a6f10a6987e841ad05093eeda1c1dd2b68c6280949a718c4" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-gba" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-gba/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-gba" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-gba: Beetle GBA for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-lynx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-lynx/package.mk new file mode 100644 index 0000000000..f0e6b235bf --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-lynx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-lynx" +PKG_VERSION="4b47ed0adbe896680771fe97763c07bc4c925afa" +PKG_SHA256="23a598766033013f1b7abe0385d2e4c0e8f846aad606b46fee0fe8842205e356" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-lynx" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-lynx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-lynx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-lynx: Beetle lynx for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-ngp/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-ngp/package.mk new file mode 100644 index 0000000000..517b1ac3c3 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-ngp/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-ngp" +PKG_VERSION="53d448732cd7408388e40c8b17da41a74533ef04" +PKG_SHA256="5d4b8ba32a4adfadf0c60f35d34405446c0b47c1b6a019e68834f650e90a8386" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-ngp" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-ngp/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-ngp" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-ngp: Beetle ngp for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-pce-fast/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-pce-fast/package.mk new file mode 100644 index 0000000000..c3ff0eaf26 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-pce-fast/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-pce-fast" +PKG_VERSION="4c7cb4fa1c513bfd51d2854418e2d0e554e6fc45" +PKG_SHA256="b204c177da6d7376724d6fa42f14397f6699bcdd97cf8d648bd89bdcaaeba47d" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-pce-fast" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-pce-fast/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-pce-fast" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-pce-fast: Beetle PCE Fast for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-pcfx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-pcfx/package.mk new file mode 100644 index 0000000000..2bf1b71667 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-pcfx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-pcfx" +PKG_VERSION="4ae47b2907a7b6b68d16e367c487729d762c7524" +PKG_SHA256="19eac7ee33394e11564bdbcd75de935fdce9a453cb6c7cb8e3fae1c1be617ebb" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-pcfx" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-pcfx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-pcfx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-pcfx: Beetle pcfx for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-psx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-psx/package.mk new file mode 100644 index 0000000000..10fbe677bf --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-psx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-psx" +PKG_VERSION="3ef5891ba353bcad05eeea236167168595d6ef49" +PKG_SHA256="5c6b5f4ae7e0f48f246891a678549a7486d0bd72cdede911549376a6287a4834" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-psx" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-psx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-psx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-psx: Beetle PSX for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-saturn/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-saturn/package.mk new file mode 100644 index 0000000000..839d505019 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-saturn/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-saturn" +PKG_VERSION="cb6cf702968eb86a6811b2b5db977083a7c5b73a" +PKG_SHA256="c374f09a6824302db123c7f166294db397cb337a10e493d0408494053d114480" +PKG_REV="113" +# no openGL suport in retroplayer yet +PKG_ARCH="none" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-saturn" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-saturn/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-saturn" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-saturn: beetle-saturn for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-supergrafx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-supergrafx/package.mk new file mode 100644 index 0000000000..dfc5d3c2fc --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-supergrafx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-supergrafx" +PKG_VERSION="d5a497f428d408b5c12480f970c9e0b9183a7ec9" +PKG_SHA256="a7db8f0576893e783162bd41cee0abd1836c2f33fb1ef80810588301a6562ee0" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-supergrafx" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-supergrafx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-supergrafx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-supergrafx: Beetle supergrafx for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-vb/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-vb/package.mk new file mode 100644 index 0000000000..ed1b7e1114 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-vb/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-vb" +PKG_VERSION="5a6391cb863d99ea217f661f0b9d912acdad4318" +PKG_SHA256="d4df9ad47389d12fd7817c885de62be00c603081c6188ea7b4bfda864120c8da" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-vb" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-vb/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-vb" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-vb: Beetle vb for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-wswan/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-wswan/package.mk new file mode 100644 index 0000000000..af0599136e --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.beetle-wswan/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.beetle-wswan" +PKG_VERSION="aea51097c4e71e44b4a8cf7b1bfb347f5357b3d2" +PKG_SHA256="56843e3b4dfc03a0b2de94873ea5895d34364099108f91c6855c9ba05d05fbcf" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.beetle-wswan" +PKG_URL="https://github.com/kodi-game/game.libretro.beetle-wswan/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-beetle-wswan" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.beetle-wswan: Beetle wswan for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.bluemsx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.bluemsx/package.mk new file mode 100644 index 0000000000..cbfbad1416 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.bluemsx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.bluemsx" +PKG_VERSION="0e6f713a655d6ba03e48d52f3b935d1eeb52ce67" +PKG_SHA256="1e503ce3d7778fc0d1a976e3d7c22bdbcf821a922c17d307562a29752379dc91" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.bluemsx" +PKG_URL="https://github.com/kodi-game/game.libretro.bluemsx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-bluemsx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.bluemsx: BlueMSX for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.bnes/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.bnes/package.mk new file mode 100644 index 0000000000..45fd043edc --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.bnes/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.bnes" +PKG_VERSION="6995dd3de6d8b29f9a35bf64156b5f06efa69daf" +PKG_SHA256="bf461f2fe9069fe9d8d17b7db55ee8a99cbb8419726fb0d311fc2c3be515ad27" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.bnes" +PKG_URL="https://github.com/kodi-game/game.libretro.bnes/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-bnes" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.bnes: bNES for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-accuracy/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-accuracy/package.mk new file mode 100644 index 0000000000..60ca05b808 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-accuracy/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.bsnes-mercury-accuracy" +PKG_VERSION="a83b6e6a94f71ebec2ee7889b28e3161543a3802" +PKG_SHA256="91ef27e64dd28372592f6745ea1ef5ec164b85bde9019c377f76c96892a13c0f" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.bsnes-mercury-accuracy" +PKG_URL="https://github.com/kodi-game/game.libretro.bsnes-mercury-accuracy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-bsnes-mercury-accuracy" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.bsnes-mercury-accuracy: bSNES Mercury for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-balanced/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-balanced/package.mk new file mode 100644 index 0000000000..5350d89782 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-balanced/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.bsnes-mercury-balanced" +PKG_VERSION="4d5d2538682d451742d70c23388e62dd4ddd3f38" +PKG_SHA256="1609c03f375091e95e10eb204fad84bdd69a6c0e9a78ed33d130b8b9fff85551" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.bsnes-mercury-balanced" +PKG_URL="https://github.com/kodi-game/game.libretro.bsnes-mercury-balanced/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-bsnes-mercury-balanced" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.bsnes-mercury-balanced: bSNES Mercury for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-performance/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-performance/package.mk new file mode 100644 index 0000000000..d46c4886fb --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.bsnes-mercury-performance/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.bsnes-mercury-performance" +PKG_VERSION="b1512ba20335a2d200f5f77b98e7699341d2560a" +PKG_SHA256="2963e562b7d1a1e454baf8bb9c7954a7805bbf9e7559f28b73103f9636a6d4ff" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.bsnes-mercury-performance" +PKG_URL="https://github.com/kodi-game/game.libretro.bsnes-mercury-performance/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-bsnes-mercury-performance" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.bsnes-mercury-performance: bSNES Mercury for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.cap32/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.cap32/package.mk new file mode 100644 index 0000000000..835234fbf5 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.cap32/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.cap32" +PKG_VERSION="f20dc7f34b46dfd8af738bf941260a4ad444f354" +PKG_SHA256="b8ae8a9693d46f0454ef660d9fda44f47e650a5b419d0f862e67dabce1514fa6" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.cap32" +PKG_URL="https://github.com/kodi-game/game.libretro.cap32/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-cap32" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.cap32: cap32 for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/package.mk new file mode 100644 index 0000000000..ca6b4e6e4d --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.desmume" +PKG_VERSION="c1ded190cb1d61a1b8738bf278484359b9d6908f" +PKG_SHA256="0f5624f854815336210a067d291d489353ca560b2e35a283b9a195d9c9a5b832" +PKG_REV="110" +# no openGL suport in retroplayer yet +PKG_ARCH="none" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.desmume" +PKG_URL="https://github.com/kodi-game/game.libretro.desmume/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-desmume" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.desmume: DESMuME GameClient for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/patches/game.libretro.desmume-0001-fix-cross-compile.patch b/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/patches/game.libretro.desmume-0001-fix-cross-compile.patch new file mode 100644 index 0000000000..342a17989d --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/patches/game.libretro.desmume-0001-fix-cross-compile.patch @@ -0,0 +1,46 @@ +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2016-10-18 13:23:32.000000000 -0700 ++++ b/CMakeLists.txt 2016-11-16 22:33:24.931252608 -0800 +@@ -4,39 +4,10 @@ + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + + find_package(Kodi REQUIRED) ++find_package(libretro-desmume REQUIRED) + +-if(CMAKE_BUILD_TYPE MATCHES Debug) +- set(LIBRETRO_DEBUG DEBUG=1) +-endif() +- +-if("${CORE_SYSTEM_NAME}" STREQUAL "windows") +- set(BUILD_COMMAND mingw32-make -f Makefile.libretro platform=win ${LIBRETRO_DEBUG}) +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "linux") +- set(BUILD_COMMAND make -f Makefile.libretro ${LIBRETRO_DEBUG}) +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "darwin") +- set(BUILD_COMMAND make -f Makefile.libretro platform=osx ${LIBRETRO_DEBUG}) +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "ios") +- # TODO +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "android") +- # TODO +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "rbpi") +- # TODO +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "freebsd") +-# TODO +-endif() +- +-include(ExternalProject) +-externalproject_add(desmume +- GIT_REPOSITORY https://github.com/libretro/desmume-libretro +- GIT_TAG 40f9af5 +- PREFIX desmume +- CONFIGURE_COMMAND "" +- INSTALL_COMMAND "" +- BUILD_COMMAND ${BUILD_COMMAND} +- BUILD_IN_SOURCE 1) +- +-set(DESMUME_CUSTOM_BINARY ${PROJECT_BINARY_DIR}/desmume/src/desmume/desmume_libretro${CMAKE_SHARED_LIBRARY_SUFFIX} ++set(DEPLIBS desmume) ++set(DESMUME_CUSTOM_BINARY ${DESMUME_LIB} + ${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + + build_addon(${PROJECT_NAME} DESMUME DEPLIBS) +-add_dependencies(${PROJECT_NAME} desmume) diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/patches/game.libretro.desmume-0002-no-nds-controller.patch b/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/patches/game.libretro.desmume-0002-no-nds-controller.patch new file mode 100644 index 0000000000..7e28f332be --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.desmume/patches/game.libretro.desmume-0002-no-nds-controller.patch @@ -0,0 +1,11 @@ +diff -Naur a/game.libretro.desmume/addon.xml.in b/game.libretro.desmume/addon.xml.in +--- a/game.libretro.desmume/addon.xml.in 2016-07-16 04:22:14.000000000 -0700 ++++ b/game.libretro.desmume/addon.xml.in 2016-08-26 12:49:51.513260529 -0700 +@@ -5,7 +5,6 @@ + provider-name="Libretro"> + + +- + + diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.dinothawr/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.dinothawr/package.mk new file mode 100644 index 0000000000..6c13e5c501 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.dinothawr/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.dinothawr" +PKG_VERSION="50c7d7bd120ab182413baa632b206a0e200b30fb" +PKG_SHA256="c3329d67e9d463e6812697339ce1ffad78724a531f9f627d94021d6a2ccc484e" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.dinothawr" +PKG_URL="https://github.com/kodi-game/game.libretro.dinothawr/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-dinothawr" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.dinothawr: dinothawr for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.dolphin/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.dolphin/package.mk new file mode 100644 index 0000000000..54bf879555 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.dolphin/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.dolphin" +PKG_VERSION="f73b307" +PKG_SHA256="039cfecbfe67c24e87708008f811538b7d4502aa2171379570ee2632a33effe6" +PKG_REV="105" +# no openGL suport in retroplayer yet +PKG_ARCH="none" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.dolphin" +PKG_URL="https://github.com/kodi-game/game.libretro.dolphin/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-dolphin" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.dolphin: Dolphin for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.dolphin/patches/game.libretro.dolphin-0001-fix-cross-compile.patch b/packages/mediacenter/kodi-binary-addons/game.libretro.dolphin/patches/game.libretro.dolphin-0001-fix-cross-compile.patch new file mode 100644 index 0000000000..a37e462a84 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.dolphin/patches/game.libretro.dolphin-0001-fix-cross-compile.patch @@ -0,0 +1,47 @@ +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2016-10-18 13:23:42.000000000 -0700 ++++ b/CMakeLists.txt 2016-11-16 22:36:08.223799504 -0800 +@@ -4,40 +4,10 @@ + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + + find_package(Kodi REQUIRED) ++find_package(libretro-dolphin REQUIRED) + +-include(ExternalProject) +- +-if(CMAKE_BUILD_TYPE MATCHES Debug) +- set(LIBRETRO_DEBUG DEBUG=1) +-endif() +- +-if("${CORE_SYSTEM_NAME}" STREQUAL "windows") +- set(BUILD_COMMAND mingw32-make -C libretro platform=win ${LIBRETRO_DEBUG}) +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "linux") +- set(BUILD_COMMAND make -C libretro ${LIBRETRO_DEBUG}) +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "darwin") +- set(BUILD_COMMAND make -C libretro platform=osx ${LIBRETRO_DEBUG}) +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "ios") +- # TODO +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "android") +- # TODO +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "rbpi") +- # TODO +-elseif("${CORE_SYSTEM_NAME}" STREQUAL "freebsd") +-# TODO +-endif() +- +-externalproject_add(dolphin +- GIT_REPOSITORY https://github.com/libretro/dolphin +- GIT_TAG 2ed82b9 +- PREFIX dolphin +- CONFIGURE_COMMAND "" +- INSTALL_COMMAND "" +- BUILD_COMMAND ${BUILD_COMMAND} +- BUILD_IN_SOURCE 1) +- +-set(DOLPHIN_CUSTOM_BINARY ${PROJECT_BINARY_DIR}/dolphin/src/dolphin/libretro/dolphin_libretro${CMAKE_SHARED_LIBRARY_SUFFIX} ++set(DEPLIBS dolphin) ++set(DOLPHIN_CUSTOM_BINARY ${DOLPHIN_LIB} + ${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + + build_addon(${PROJECT_NAME} DOLPHIN DEPLIBS) +-add_dependencies(${PROJECT_NAME} dolphin) diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.dosbox/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.dosbox/package.mk new file mode 100644 index 0000000000..fed4971218 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.dosbox/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.dosbox" +PKG_VERSION="5103cd154d758f55f2064b8dd2a1cc0b76a04e8d" +PKG_SHA256="f16dedf1c6c7dd2ba3458f2f6583f87bef04f514f95d3f98d47d894a89b08fcb" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.dosbox" +PKG_URL="https://github.com/kodi-game/game.libretro.dosbox/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-dosbox" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.dosbox: DOSBox for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.fbalpha/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.fbalpha/package.mk new file mode 100644 index 0000000000..fcdd8a2220 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.fbalpha/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.fbalpha" +PKG_VERSION="d0d97e70581549c0ca3908aca7e1b1d986983be6" +PKG_SHA256="9dabc370c5563a9267001087677b4c87ba2bff3c6df4e4f081764d7b1c75a3ca" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.fbalpha" +PKG_URL="https://github.com/kodi-game/game.libretro.fbalpha/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-fbalpha" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.fbalpha: fba for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.fceumm/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.fceumm/package.mk new file mode 100644 index 0000000000..b31e122695 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.fceumm/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.fceumm" +PKG_VERSION="576fa9831e1bcda85da964afbb4fa04fa825197a" +PKG_SHA256="b2c8df1919d933d2c8a2a55a7959fb45127e10de78e90b0c4a88a56eb24d31ef" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.fceumm" +PKG_URL="https://github.com/kodi-game/game.libretro.fceumm/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-fceumm" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.fceumm: FCEUmm emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.fmsx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.fmsx/package.mk new file mode 100644 index 0000000000..01dd3c6a0f --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.fmsx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.fmsx" +PKG_VERSION="40e6ad79dd0ae073da4c92cf9d8de00dc0d82848" +PKG_SHA256="6645ca88936d63262b11937c08ace1814e033d94d264e7b4063661469479a8ad" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.fmsx" +PKG_URL="https://github.com/kodi-game/game.libretro.fmsx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-fmsx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.fmsx: fmsx for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.fsuae/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.fsuae/package.mk new file mode 100644 index 0000000000..17fb1cae41 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.fsuae/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.fsuae" +PKG_VERSION="f615a46bd611db79465ef8de379f3174ca925fc0" +PKG_SHA256="15f6f9c805d65383d4809e48c934a25a9d6d2021e8ae3e2c887d877ab953b237" +PKG_REV="103" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.fsuae" +PKG_URL="https://github.com/kodi-game/game.libretro.fsuae/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-fsuae" +PKG_LONGDESC="game.libretro.fsuae: fsuae emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.fuse/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.fuse/package.mk new file mode 100644 index 0000000000..d71d990c78 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.fuse/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.fuse" +PKG_VERSION="7df64347d8d5557d6c102ec6f732b763d4e9d903" +PKG_SHA256="bc5d7c68e790494a6bffc2df41e743890b417c247affb85dc535b4a071ea1ee5" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.fuse" +PKG_URL="https://github.com/kodi-game/game.libretro.fuse/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-fuse" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.fuse: fuse for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.gambatte/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.gambatte/package.mk new file mode 100644 index 0000000000..23c65e15e9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.gambatte/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.gambatte" +PKG_VERSION="7493bd05cb85c3e90532381bdf2f759ca55d2bba" +PKG_SHA256="dc38fecc3f7a34ec8de90627ffeeedcb15fa6d5063b701b594602c78bf9e46b2" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.gambatte" +PKG_URL="https://github.com/kodi-game/game.libretro.gambatte/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-gambatte" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.gambatte: Gambatte emulator for Kodi" +PKG_IS_ADDON="yes" + +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.genplus/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.genplus/package.mk new file mode 100644 index 0000000000..5ffcddd9db --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.genplus/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.genplus" +PKG_VERSION="4f0803e915068ea64bba0bf61cd366e621684e15" +PKG_SHA256="9caefb8f57b63442a23db30cb8d3ce7aa937560cbcabf2891cbfb473731f5357" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.genplus" +PKG_URL="https://github.com/kodi-game/game.libretro.genplus/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-genplus" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.genplus: Genesis Plus GX emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.gw/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.gw/package.mk new file mode 100644 index 0000000000..8906ff5eec --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.gw/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.gw" +PKG_VERSION="9d745c2ba434a21c30b60fa1cad7ba72ae2993c1" +PKG_SHA256="76d1aff06eb06ea3856a8a8c74477e71cbf6d9264fd04fa45c84ad13437d9959" +PKG_REV="111" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.gw" +PKG_URL="https://github.com/kodi-game/game.libretro.gw/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-gw" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.gw: gw for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.handy/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.handy/package.mk new file mode 100644 index 0000000000..481154e702 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.handy/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.handy" +PKG_VERSION="32083ba2e27c749d2f750e106b1d0d39f776fe95" +PKG_SHA256="6d0fc7c5dd93f30be61a6b57dab6ebc7b009f6b416f1d1658a9532ff4d3f0ce8" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.handy" +PKG_URL="https://github.com/kodi-game/game.libretro.handy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-handy" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.handy: handy for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.hatari/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.hatari/package.mk new file mode 100644 index 0000000000..9d63acfd01 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.hatari/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.hatari" +PKG_VERSION="1e5a0f12c8d5d8c511d28cc1d0a6af5d7e415416" +PKG_SHA256="09f377d4ab252a74cc2cc7abdfa375b00ea148880a7940bb47f6851ad5b9cf37" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.hatari" +PKG_URL="https://github.com/kodi-game/game.libretro.hatari/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-hatari" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.hatari: hatari for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame/package.mk new file mode 100644 index 0000000000..9b588e30b9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame" +PKG_VERSION="576c4ed5d73954c47dd4b1d51f128e5cd0396983" +PKG_SHA256="29e8fb29092c2ff23c87ccdfbc88d231b66ab695f6c17f928ac2a212ee157839" +PKG_REV="108" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame" +PKG_URL="https://github.com/kodi-game/game.libretro.mame/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame: MAME emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame2000/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2000/package.mk new file mode 100644 index 0000000000..cf2b60a4eb --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2000/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame2000" +PKG_VERSION="3d01798bbb96ba1ed02b007a63eb1a2604ea5221" +PKG_SHA256="b52d11fc9fa50ae7878af5f4ba9dd2738fe488ec50da6cf5305295f10fc25afc" +PKG_REV="105" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame2000" +PKG_URL="https://github.com/kodi-game/game.libretro.mame2000/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame2000" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame2000: MAME 2000 emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame2003/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2003/package.mk new file mode 100644 index 0000000000..1ed32962c8 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2003/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame2003" +PKG_VERSION="b86620c4a7b5a7b21fd301dc806d2e9f4ef8ae5c" +PKG_SHA256="892ba5ab430a181ef5630fe03cdb4c7aacea745a365a3b16ef5d8e08e366e25a" +PKG_REV="105" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame2003" +PKG_URL="https://github.com/kodi-game/game.libretro.mame2003/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame2003" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame2003: MAME 2003 emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame2003_plus/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2003_plus/package.mk new file mode 100644 index 0000000000..ef0f1cbc2b --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2003_plus/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame2003_plus" +PKG_VERSION="776d158f1db20ebb93db0a108df210bc4462fcd0" +PKG_SHA256="db451ce39a99a99cb262a11eb58447b69ef5c02f2c5879536ad3039b285ab0db" +PKG_REV="101" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame2003_plus" +PKG_URL="https://github.com/kodi-game/game.libretro.mame2003_plus/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame2003_plus" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame2003_plus: MAME 2003 Plus emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame2010/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2010/package.mk new file mode 100644 index 0000000000..6eb0bcf3de --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2010/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame2010" +PKG_VERSION="38a6d2e976572bd064b2800a76789f9d10084bb5" +PKG_SHA256="23a049dc9ab661b9eb456a8f3790c0b812e9e66ac8d1fa3f6cc83ca12faee56f" +PKG_REV="103" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame2010" +PKG_URL="https://github.com/kodi-game/game.libretro.mame2010/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame2010" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame2010: MAME emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame2014/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2014/package.mk new file mode 100644 index 0000000000..828d20eadb --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2014/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame2014" +PKG_VERSION="a9cbc512d350af2cb1426e219a92b5bf2904c84b" +PKG_SHA256="29020ad9cf3b1ac887f4630000270083f42c03ec9abf8ab370a864ee1c36d4ac" +PKG_REV="103" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame2014" +PKG_URL="https://github.com/kodi-game/game.libretro.mame2014/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame2014" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame2014: MAME emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mame2016/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2016/package.mk new file mode 100644 index 0000000000..57aa894819 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mame2016/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mame2016" +PKG_VERSION="2581a76552da518cb82f8940e3dd1c37d07e640d" +PKG_SHA256="80379af128de18adc4c3043fb17ae7511bcb90ebef42429484744e97bf25b771" +PKG_REV="100" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mame2016" +PKG_URL="https://github.com/kodi-game/game.libretro.mame2016/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mame2016" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mame2016: MAME2016 emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.melonds/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.melonds/package.mk new file mode 100644 index 0000000000..d009462fe4 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.melonds/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.melonds" +PKG_VERSION="dec0f16c989317ba463169311b94bf964363f0ba" +PKG_SHA256="7032c9cfb2db6f75526b5b1054b7f11827e4fc59f8555ce26e4a4559e8f6ab2e" +PKG_REV="106" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.melonds" +PKG_URL="https://github.com/kodi-game/game.libretro.melonds/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-melonds" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.melonds: melonDS emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mesen/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mesen/package.mk new file mode 100644 index 0000000000..aa04e11d6c --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mesen/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mesen" +PKG_VERSION="62e31566e6459face42a8629cde4d7e9295390ce" +PKG_SHA256="cc1f8b9b70bda8db1eceb0426b670ff2f61595f812c29606720ff14e83ba8e54" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mesen" +PKG_URL="https://github.com/kodi-game/game.libretro.mesen/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mesen" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mesen: mesen for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.meteor/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.meteor/package.mk new file mode 100644 index 0000000000..3b38da03b1 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.meteor/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.meteor" +PKG_VERSION="e582cc1defcd89fb8a9b36fb9d300b59d231598e" +PKG_SHA256="e8714b336094a2856fbda4a4ddeca7b9f55c59d0690d036bbcb1b9e58cd74937" +PKG_REV="110" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.meteor" +PKG_URL="https://github.com/kodi-game/game.libretro.meteor/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-meteor" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.meteor: Meteor GBA emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mgba/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mgba/package.mk new file mode 100644 index 0000000000..cd55d3af89 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mgba/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mgba" +PKG_VERSION="13945641572d1b1acef8a7f000f60673b7dc709f" +PKG_SHA256="858ee0e5d654c2d7cf1d43685fd26074a9e7014088e67d0d9364c7cc360d8b23" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mgba" +PKG_URL="https://github.com/kodi-game/game.libretro.mgba/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mgba" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mgba: mGBA emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mrboom/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mrboom/package.mk new file mode 100644 index 0000000000..0b5a844484 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mrboom/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mrboom" +PKG_VERSION="6c797b4c8fbb8dedd6bd1e53125101c6bb65742c" +PKG_SHA256="b392398247910f1a107c30156cdadb9773b1f9c04c8a9a8b96d510d783776123" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mrboom" +PKG_URL="https://github.com/kodi-game/game.libretro.mrboom/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mrboom" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mrboom: mrboom for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.mupen64plus/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.mupen64plus/package.mk new file mode 100644 index 0000000000..75a0839302 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.mupen64plus/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.mupen64plus" +PKG_VERSION="5b620f2748071195b03baaa160159f2755117cd5" +PKG_SHA256="4d07a17291e4d17a55a7038de0c198ef5a8acb19c2acb8b61e9f7dee5ae65012" +PKG_REV="113" +# no openGL suport in retroplayer yet +PKG_ARCH="none" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.mupen64plus" +PKG_URL="https://github.com/kodi-game/game.libretro.mupen64plus/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-mupen64plus" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.mupen64plus: Mupen 64 Plus emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.nestopia/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.nestopia/package.mk new file mode 100644 index 0000000000..e47ac9e7de --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.nestopia/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.nestopia" +PKG_VERSION="4d44431c6d88a1abb5e499edd96c37ec665b6575" +PKG_SHA256="dece438eec20be967e612776126e84df84c039dacd212eb7840c17637df173ba" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.nestopia" +PKG_URL="https://github.com/kodi-game/game.libretro.nestopia/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-nestopia" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.nestopia: Nestopia emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.nx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.nx/package.mk new file mode 100644 index 0000000000..beb8cef9e2 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.nx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.nx" +PKG_VERSION="07f3bb36e4aef41097ef60bbb3f4723fee9d5063" +PKG_SHA256="f9a05f1e9977e8e6d98888af9643ddc0fa59db5a3652a206ef0cf5145f99f501" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.nx" +PKG_URL="https://github.com/kodi-game/game.libretro.nx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-nx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.nx: nx for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.o2em/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.o2em/package.mk new file mode 100644 index 0000000000..806d248947 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.o2em/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.o2em" +PKG_VERSION="0f6df08462870451ff90ac2ae39dd622246f7092" +PKG_SHA256="f5b3d55039f8d9a4048f732e0e9c7985694b0d330f979c24fdc7ce82e1bebca4" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.o2em" +PKG_URL="https://github.com/kodi-game/game.libretro.o2em/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-o2em" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.o2em: o2em for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.pcsx-rearmed/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.pcsx-rearmed/package.mk new file mode 100644 index 0000000000..ee4b0cf017 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.pcsx-rearmed/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.pcsx-rearmed" +PKG_VERSION="268048440a5acc038aa740428f1e0118b488a30a" +PKG_SHA256="cdfd9166af51318b6e4a3b24c7a8f158fd7b9f0169eae1c69a6463122f4a0ee7" +PKG_REV="115" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.pcsx-rearmed" +PKG_URL="https://github.com/kodi-game/game.libretro.pcsx-rearmed/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-pcsx-rearmed" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.pcsx-rearmed: PCSX Rearmed for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.picodrive/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.picodrive/package.mk new file mode 100644 index 0000000000..18ede2bbdb --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.picodrive/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.picodrive" +PKG_VERSION="f07574eb672776c278a92fe1f3132a7997392f82" +PKG_SHA256="8ea2c8c9a3b29a97b465155b6a65e5df2b93c2e18660988128992c4d5a92b887" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.picodrive" +PKG_URL="https://github.com/kodi-game/game.libretro.picodrive/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-picodrive" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.picodrive: picodrive for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.pokemini/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.pokemini/package.mk new file mode 100644 index 0000000000..4cc781abbb --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.pokemini/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.pokemini" +PKG_VERSION="b44d944eb2e7f5c76f95c15fd8805023ae64577c" +PKG_SHA256="25ddc6155548deb65098558d55bfed5e15151e3e8860646f7a32ae2c9e36797e" +PKG_REV="107" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.pokemini" +PKG_URL="https://github.com/kodi-game/game.libretro.pokemini/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-pokemini" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.pokemini: PokeMini emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.ppsspp/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.ppsspp/package.mk new file mode 100644 index 0000000000..083601c754 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.ppsspp/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.ppsspp" +PKG_VERSION="d24a963" +PKG_SHA256="2634b9c6f47bd32afcc2beb3f53b03b3ca3fb8d1391b502396ff24862aafca27" +PKG_REV="106" +# no openGL suport in retroplayer yet +PKG_ARCH="none" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.ppsspp" +PKG_URL="https://github.com/kodi-game/game.libretro.ppsspp/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-ppsspp" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.ppsspp: ppsspp for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.prboom/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.prboom/package.mk new file mode 100644 index 0000000000..94e6552123 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.prboom/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.prboom" +PKG_VERSION="7e315be29c8bc1309a73561e8f8e69877920021c" +PKG_SHA256="2d8fc1f0dee4b7ae6bc0d51b3eb132ad9b9478fe1930f51a403c3b6c3883c4bd" +PKG_REV="114" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.prboom" +PKG_URL="https://github.com/kodi-game/game.libretro.prboom/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-prboom" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.prboom: prboom for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.prosystem/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.prosystem/package.mk new file mode 100644 index 0000000000..bf7d994e09 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.prosystem/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.prosystem" +PKG_VERSION="75b19583254992f8c93336ab16cc8799b792caa5" +PKG_SHA256="6f1589a0a7d2583db4bb411620c8958365c93e1a37ffde7b7dd31e812628008e" +PKG_REV="114" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.prosystem" +PKG_URL="https://github.com/kodi-game/game.libretro.prosystem/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-prosystem" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.prosystem: Prosystem for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.quicknes/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.quicknes/package.mk new file mode 100644 index 0000000000..5c8d16e62b --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.quicknes/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.quicknes" +PKG_VERSION="4816e6a3deb9a89afcb20ba832463f3df1e15939" +PKG_SHA256="1ed28a78d9ead669f2edafc6a0a01596a29eae7a097ad8dbf1d03acd22d59c44" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.quicknes" +PKG_URL="https://github.com/kodi-game/game.libretro.quicknes/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-quicknes" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.quicknes: QuickNES emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.reicast/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.reicast/package.mk new file mode 100644 index 0000000000..6195c11a49 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.reicast/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.reicast" +PKG_VERSION="bf615a08d2d374fd774e6b0d277bc9280a3c064a" +PKG_SHA256="5ae936037be132f85dd1832a3bb32e6095e8135a60ed13fefe40e571546e0b0f" +PKG_REV="114" +# no openGL suport in retroplayer yet +PKG_ARCH="none" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.reicast" +PKG_URL="https://github.com/kodi-game/game.libretro.reicast/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-reicast" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.reicast: reicast for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.sameboy/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.sameboy/package.mk new file mode 100644 index 0000000000..10c3588b09 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.sameboy/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.sameboy" +PKG_VERSION="5a93b49ccc6c2a67611772137835b8850207cb26" +PKG_SHA256="ab992c93684bcb860dffd4d3b3b0cd7cd7c46f243a17ead2b2a446e86e8cc9da" +PKG_REV="106" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.sameboy" +PKG_URL="https://github.com/kodi-game/game.libretro.sameboy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-sameboy" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.sameboy: SameBoy emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.scummvm/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.scummvm/package.mk new file mode 100644 index 0000000000..59d59a7d14 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.scummvm/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.scummvm" +PKG_VERSION="76da70af46362d51950105b3dd7095245e6ccda3" +PKG_SHA256="20679170acad84a6e725110cff9d09d2ec0649040954313528d7b5b9e712e497" +PKG_REV="114" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.scummvm" +PKG_URL="https://github.com/kodi-game/game.libretro.scummvm/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-scummvm" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.scummvm: scummvm for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x/package.mk new file mode 100644 index 0000000000..bd7f88bb35 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.snes9x" +PKG_VERSION="d700274b8949fbfdd9f9fd7ff04980a811e8fc14" +PKG_SHA256="8c35ea0f311b1dcdbb0d563d1dcd06f7fe83c5fd511d0431008737817c7fed11" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.snes9x" +PKG_URL="https://github.com/kodi-game/game.libretro.snes9x/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-snes9x" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.snes9x: snes9x for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x2002/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x2002/package.mk new file mode 100644 index 0000000000..af6261c9f9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x2002/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.snes9x2002" +PKG_VERSION="6cc9851f3bd10def70a879ca88304d5f300dae68" +PKG_SHA256="7e3b7ed991dc5cde8a6c330843665e277a7d4605a3344637023b055629afd711" +PKG_REV="111" +# neon optimizations make it only useful for arm +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.snes9x2002" +PKG_URL="https://github.com/kodi-game/game.libretro.snes9x2002/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-snes9x2002" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.snes9x2002: snes9x2002 for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x2010/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x2010/package.mk new file mode 100644 index 0000000000..1c3c9ff602 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.snes9x2010/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.snes9x2010" +PKG_VERSION="79e0175346dbc39da86203473ea93361c08cf015" +PKG_SHA256="4c19bbed49cf459289b97ede13e1e17c19e4268606bdb73226515170721117ef" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.snes9x2010" +PKG_URL="https://github.com/kodi-game/game.libretro.snes9x2010/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-snes9x2010" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.snes9x2010: snes9x2010 for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.stella/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.stella/package.mk new file mode 100644 index 0000000000..c0f50392ca --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.stella/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.stella" +PKG_VERSION="f5b7d3bf1452e9beb3df3e1abaa57c76d22e8fea" +PKG_SHA256="320b454b2dd5e42ce6da3051434dbe23f772fbdab92a37a3329a19e6b6b7f37c" +PKG_REV="111" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.stella" +PKG_URL="https://github.com/kodi-game/game.libretro.stella/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-stella" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.stella: Stella emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.tgbdual/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.tgbdual/package.mk new file mode 100644 index 0000000000..83b821b988 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.tgbdual/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.tgbdual" +PKG_VERSION="095a1f09f2fe7c290e3c24927a6a51e41db8052d" +PKG_SHA256="155e426789990f5a3c8cc07d9aabdc4a5e564d7b5ea66334fd97263cff6b3951" +PKG_REV="111" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.tgbdual" +PKG_URL="https://github.com/kodi-game/game.libretro.tgbdual/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-tgbdual" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.tgbdual: tgbdual for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.tyrquake/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.tyrquake/package.mk new file mode 100644 index 0000000000..55df58b284 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.tyrquake/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.tyrquake" +PKG_VERSION="475d1e652a54e6b25d82a27f27c69b062896a50c" +PKG_SHA256="4b6cfc6ffeba7191fbc6b828cce4a969aabacb3e53dee0aef501730526bb36a8" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.tyrquake" +PKG_URL="https://github.com/kodi-game/game.libretro.tyrquake/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-tyrquake" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.tyrquake: tyrquake for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.uae/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.uae/package.mk new file mode 100644 index 0000000000..aaf72d9474 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.uae/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.uae" +PKG_VERSION="7d167cf3b2f9a7b356196316dbfeffc0cd8f4341" +PKG_SHA256="57ed8022fa74beb1e4e6d245c383e7b28ec61b2ec66c0e8e9f6d00c83a155420" +PKG_REV="106" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.uae" +PKG_URL="https://github.com/kodi-game/game.libretro.uae/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-uae" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.uae: uae emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.uae4arm/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.uae4arm/package.mk new file mode 100644 index 0000000000..650969f0a6 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.uae4arm/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.uae4arm" +PKG_VERSION="ae25a2655717032add0ad95793929b039d4a87e5" +PKG_SHA256="5c6b1cc5a5200a47d090e8dee884ee24726c191887d412c738a1a165139dc297" +PKG_REV="102" +PKG_ARCH="arm" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.uae4arm" +PKG_URL="https://github.com/kodi-game/game.libretro.uae4arm/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-uae4arm" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.uae4arm: uae4arm emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.vba-next/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.vba-next/package.mk new file mode 100644 index 0000000000..c468d35b7c --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.vba-next/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.vba-next" +PKG_VERSION="9735a9f409d5261eda742ab020feb184b126ed72" +PKG_SHA256="df678971991656580c1bc0287ddf3aba283375cd80148e08ad0a6712ba86e0d2" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.vba-next" +PKG_URL="https://github.com/kodi-game/game.libretro.vba-next/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-vba-next" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.vba-next: VBA-Next emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.vbam/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.vbam/package.mk new file mode 100644 index 0000000000..42663b0ab6 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.vbam/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.vbam" +PKG_VERSION="2e34c8fdc52880243013784984751f68d60e65ad" +PKG_SHA256="99ed6943039bf68ad2b691b562f2f90b1d99460045858b6d24f5882597c2ec29" +PKG_REV="112" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.vbam" +PKG_URL="https://github.com/kodi-game/game.libretro.vbam/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-vbam" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.vbam: VBA-M emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.vecx/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.vecx/package.mk new file mode 100644 index 0000000000..af2368d9e9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.vecx/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.vecx" +PKG_VERSION="20edd48c4fefcc3b9a3413a1e682e1d8d46b59c9" +PKG_SHA256="e965ef7ef6669357d67dec06c6e2715f7b62a0f31a17582ba05a26d956c36192" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.vecx" +PKG_URL="https://github.com/kodi-game/game.libretro.vecx/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-vecx" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.vecx: vecx for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.vice/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.vice/package.mk new file mode 100644 index 0000000000..d3dc92e959 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.vice/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.vice" +PKG_VERSION="1b3c55d3812b108b27839c2c5ab93a932c631719" +PKG_SHA256="a88d3f3d649ccdd11e1f42e06a757196bb05c84e4b1a9dccf89201b8b07ec02a" +PKG_REV="107" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.vice" +PKG_URL="https://github.com/kodi-game/game.libretro.vice/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-vice" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.vice: vice emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.virtualjaguar/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.virtualjaguar/package.mk new file mode 100644 index 0000000000..65acdb0b98 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.virtualjaguar/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.virtualjaguar" +PKG_VERSION="edcbb279aea50244240dec7e2a253f8fcf983335" +PKG_SHA256="9b55c88f89a24632b45425936cbd3829107cdd604120f31bdcec22a3cdc968b4" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.virtualjaguar" +PKG_URL="https://github.com/kodi-game/game.libretro.virtualjaguar/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-virtualjaguar" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.virtualjaguar: VirtualJaguar for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.vram-test/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.vram-test/package.mk new file mode 100644 index 0000000000..5480b4d417 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.vram-test/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.vram-test" +PKG_VERSION="92e1146" +PKG_SHA256="ab866d1cc455c4fdba6f67b44dff850cd6e713c964ef0afd366d3ee526504288" +PKG_REV="101" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.vram-test" +PKG_URL="https://github.com/kodi-game/game.libretro.vram-test/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-vram-test" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.vram-test: vram-test emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro.yabause/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro.yabause/package.mk new file mode 100644 index 0000000000..11d7c5a8c9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro.yabause/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro.yabause" +PKG_VERSION="216f5f3ea087a635f48b44fe80918917904ae458" +PKG_SHA256="e93ff9fcceba7d5b26992353aee01f94abdf94000cd570f561d7e4a89e4b2d24" +PKG_REV="114" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro.yabause" +PKG_URL="https://github.com/kodi-game/game.libretro.yabause/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libretro-yabause" +PKG_SECTION="" +PKG_LONGDESC="game.libretro.yabause: Yabause emulator for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.libretro/package.mk b/packages/mediacenter/kodi-binary-addons/game.libretro/package.mk new file mode 100644 index 0000000000..5ecc702cff --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.libretro/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.libretro" +PKG_VERSION="ab0e63d52842b2308c5c61aa0feabbc752011860" +PKG_SHA256="f26086f7c57aabc7ba996dde9e4c6a8fdf61164ae4b4172a93970b7bbf71f564" +PKG_REV="113" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.libretro" +PKG_URL="https://github.com/kodi-game/game.libretro/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform p8-platform" +PKG_SECTION="" +PKG_LONGDESC="game.libretro is a thin wrapper for libretro" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/game.netplay/package.mk b/packages/mediacenter/kodi-binary-addons/game.netplay/package.mk new file mode 100644 index 0000000000..baf8953c4e --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/game.netplay/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="game.netplay" +PKG_VERSION="e11f6a81f57420eee10d99a9773611591a2a0fae" +PKG_SHA256="bb6011de992f02d72fc8db7b6d6b032c6ebff71085d97a5b13a87daa5ca2d775" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/game.netplay" +PKG_URL="https://github.com/kodi-game/game.netplay/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform p8-platform" +PKG_SECTION="" +PKG_LONGDESC="game.netplay adds Netplay support for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.gameclient" diff --git a/packages/mediacenter/kodi-binary-addons/imagedecoder.raw/package.mk b/packages/mediacenter/kodi-binary-addons/imagedecoder.raw/package.mk new file mode 100644 index 0000000000..82f5d75ba2 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/imagedecoder.raw/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="imagedecoder.raw" +PKG_VERSION="41a370dbfeb57b647e9e3e78c19d1385bcfa584e" +PKG_SHA256="09dd5c2665be72b0c72cfe7aae253e79980c58ce7be274094a9fc1b88da89401" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/xbmc/imagedecoder.raw" +PKG_URL="https://github.com/xbmc/imagedecoder.raw/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libraw" +PKG_SECTION="" +PKG_SHORTDESC="imagedecoder.raw" +PKG_LONGDESC="imagedecoder.raw" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.imagedecoder" diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.adaptive/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.adaptive/package.mk index d4c0289f5f..374b34d6ef 100644 --- a/packages/mediacenter/kodi-binary-addons/inputstream.adaptive/package.mk +++ b/packages/mediacenter/kodi-binary-addons/inputstream.adaptive/package.mk @@ -1,26 +1,12 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="inputstream.adaptive" -PKG_VERSION="fc86263" +PKG_VERSION="b76c81fc4c2d7fd02e73c1d0091ae190351fc2fa" +PKG_SHA256="8f802b0095c52376ee213bb3b2f08370821755a317543a2eb1d0ad953991b172" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/liberty-developer/inputstream.adaptive/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/peak3d/inputstream.adaptive/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="inputstream.adaptive" @@ -28,24 +14,13 @@ PKG_LONGDESC="inputstream.adaptive" PKG_IS_ADDON="yes" -post_makeinstall_target() { - mkdir -p wv && cd wv - cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DDECRYPTERPATH=special://home/cdm \ - $ROOT/$PKG_BUILD/wvdecrypter - make - - cp -P $ROOT/$PKG_BUILD/.$TARGET_NAME/wv/libssd_wv.so $INSTALL/usr/lib -} +if [ "$TARGET_ARCH" = "x86_64" ] || [ "$TARGET_ARCH" = "arm" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET nss" +fi addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ + install_binary_addon $PKG_ADDON_ID - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/ - cp -P $PKG_BUILD/.$TARGET_NAME/wv/libssd_wv.so $ADDON_BUILD/$PKG_ADDON_ID/lib + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID + cp -P $PKG_BUILD/.$TARGET_NAME/wvdecrypter/libssd_wv.so $ADDON_BUILD/$PKG_ADDON_ID } diff --git a/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk b/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk index 6bd3cda815..5fcce38de2 100644 --- a/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk +++ b/packages/mediacenter/kodi-binary-addons/inputstream.rtmp/package.mk @@ -1,37 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="inputstream.rtmp" -PKG_VERSION="55437ac" +PKG_VERSION="6065923d5131b7db606b5ace250da3e6b0d61a9d" +PKG_SHA256="2c1939aa768c529e61a00302cacc56e5820dadf58ea655bbfc051f99997284fb" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/inputstream.rtmp/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/inputstream.rtmp/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform rtmpdump" PKG_SECTION="" PKG_SHORTDESC="inputstream.rtmp" PKG_LONGDESC="inputstream.rtmp" PKG_IS_ADDON="yes" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk index 5ae9bd40ba..acd7ba7697 100644 --- a/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk +++ b/packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk @@ -1,23 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="peripheral.joystick" -PKG_VERSION="987a818" +PKG_VERSION="dbb8a902696b2fafeda8e1b914e0bb65790e20e6" +PKG_SHA256="404754c6dd7f5dfde3f01900b2320c879ce09199b1c3a378f72ff530df2d9811" PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -27,15 +14,7 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform p8-platform" PKG_SECTION="" PKG_SHORTDESC="peripheral.joystick: Joystick support in Kodi" PKG_LONGDESC="peripheral.joystick provides joystick support and button mapping" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+lto" -PKG_IS_ADDON="yes" +PKG_IS_ADDON="embedded" PKG_ADDON_TYPE="kodi.peripheral" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/peripheral.steamcontroller/package.mk b/packages/mediacenter/kodi-binary-addons/peripheral.steamcontroller/package.mk new file mode 100644 index 0000000000..16ea610fc9 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/peripheral.steamcontroller/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="peripheral.steamcontroller" +PKG_VERSION="c4725db5f630bdf8a4981756422df9bbcf45025b" +PKG_SHA256="488593fb10936c1e50df31be64dee58e08d017173332747f71db5c05bb666e19" +PKG_REV="102" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/peripheral.steamcontroller" +PKG_URL="https://github.com/kodi-game/peripheral.steamcontroller/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="peripheral.steamcontroller: Steam controller driver for Kodi" +PKG_LONGDESC="peripheral.steamcontroller: Steam controller driver for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.peripheral" diff --git a/packages/mediacenter/kodi-binary-addons/peripheral.xarcade/package.mk b/packages/mediacenter/kodi-binary-addons/peripheral.xarcade/package.mk new file mode 100644 index 0000000000..56b82ad9bf --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/peripheral.xarcade/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="peripheral.xarcade" +PKG_VERSION="f09a0e73532184ee37fc60e25506b70dce3e3023" +PKG_SHA256="a5b36e6e77a509e6bf2943c0acdbf21b8531cca7b418e5354f72232287b8f8a0" +PKG_REV="103" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/kodi-game/peripheral.xarcade" +PKG_URL="https://github.com/kodi-game/peripheral.xarcade/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="X-Arcade Tankstick support for Kodi" +PKG_LONGDESC="X-Arcade Tankstick support for Kodi" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.peripheral" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk index b919f4fe31..3ec11a392c 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.argustv" -PKG_VERSION="08929ee" -PKG_REV="1" +PKG_VERSION="83aa1e9c588b80cdef9b2bc062e554b7ba2e609d" +PKG_SHA256="1dace85a6b2dfded2aba98f7df7afd871a27e7794211e8862053db35eeb67a14" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_SECTION="" PKG_SHORTDESC="pvr.argustv" PKG_LONGDESC="pvr.argustv" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.pvrclient" pre_configure_target() { CXXFLAGS="$CXXFLAGS -Wno-narrowing" } - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk index b2b4696a5b..8e03d095b4 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.demo" -PKG_VERSION="147fd97" -PKG_REV="1" +PKG_VERSION="964686dc47e3945b7992caf220beba2c16331111" +PKG_SHA256="7326a92f34eabed04b5833c812d654f03a903d2ef1a976b4db00ad60e96f713a" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.demo" PKG_LONGDESC="pvr.demo" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk index 89fe4640cc..a9fd5ef295 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.dvblink" -PKG_VERSION="418962c" -PKG_REV="1" +PKG_VERSION="d0bd868fbe4226dfe56df39c290daa5f61b3140c" +PKG_SHA256="7cab07f31a251fe7d704322a1f0420a38b10c629620bfd539babb3be32623f5a" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform tinyxml2" PKG_SECTION="" PKG_SHORTDESC="pvr.dvblink" PKG_LONGDESC="pvr.dvblink" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk index 305a04a1a6..33106e932e 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.dvbviewer" -PKG_VERSION="e066293" -PKG_REV="1" +PKG_VERSION="1ff63d43cbbc1e9133a9e84dec5b8e7f2c64fb17" +PKG_SHA256="bc13d4aeea6c2e2a7801abe5d6172bc4ec897a4f7984880d8cd0d830bd64bf43" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.dvbviewer" PKG_LONGDESC="pvr.dvbviewer" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk index 292d979b1a..112c6552d5 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.filmon" -PKG_VERSION="d043da6" -PKG_REV="1" +PKG_VERSION="e8506330fcb1c9027a01a26f4487df997c7c2523" +PKG_SHA256="b4d8e131f965135d773506802ece7d6679cc3fa1addd99af93f1f35dbad032d9" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_SECTION="" PKG_SHORTDESC="pvr.filmon" PKG_LONGDESC="pvr.filmon" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk index 9a9ce18444..653b5010c3 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.hdhomerun/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.hdhomerun" -PKG_VERSION="cb3f151" -PKG_REV="1" +PKG_VERSION="a9d730977ec2d529262cd19d81f0230e1def136b" +PKG_SHA256="21f872965fc81aa87213c0c182e63b7cd2058d9213eb92f0cd1e3310cfee690b" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp libhdhomerun" PKG_SECTION="" PKG_SHORTDESC="pvr.hdhomerun" PKG_LONGDESC="pvr.hdhomerun" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk index d5ae20f0a6..68b7697333 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.hts" -PKG_VERSION="0a40147" -PKG_REV="1" +PKG_VERSION="2b7348aff8172dd211d2cee608bdee711d995218" +PKG_SHA256="6861e3bad2efaf8cfa49db7ac84082d47ccaf6d5430477917c42c09215107840" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.hts" PKG_LONGDESC="pvr.hts" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk index 7d8f7989fa..439daa7084 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk @@ -1,41 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.iptvsimple" -PKG_VERSION="c9365a4" -PKG_REV="1" +PKG_VERSION="73feb2f4a3106cb3cf7f3f5432438ad1af2590a3" +PKG_SHA256="332cd69cf8991d8e789125b294fe877c3d742d8ce83afb189f366461c67b5a86" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="https://github.com/kodi-pvr/pvr.iptvsimple/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform zlib" +PKG_DEPENDS_TARGET="toolchain kodi-platform rapidxml zlib" PKG_SECTION="" PKG_SHORTDESC="pvr.iptvsimple" PKG_LONGDESC="pvr.iptvsimple" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} +PKG_CMAKE_OPTS_TARGET="-DRAPIDXML_INCLUDE_DIRS=$(get_build_dir rapidxml)" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk index 1c46b554b0..7d7fdc7788 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.mediaportal.tvserver" -PKG_VERSION="379658a" -PKG_REV="1" +PKG_VERSION="931afab54115f29fbfe013ebb6c48adb2ce6f859" +PKG_SHA256="cf043c26195a1ec6098509f2f81c3dd028435b121b04e6480c19f0afa7affc51" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,19 +14,10 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.mediaportal.tvserver" PKG_LONGDESC="pvr.mediaportal.tvserver" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" pre_configure_target() { - CXXFLAGS="$CXXFLAGS -Wno-narrowing" -} - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ + CXXFLAGS="$CXXFLAGS -Wno-narrowing -DXLOCALE_NOT_USED" } diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk index 763b09b32a..20190f7fa1 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.mythtv" -PKG_VERSION="41c3201" -PKG_REV="1" +PKG_VERSION="c954c7ebae77987369b93e989b30527c0ce2ac44" +PKG_SHA256="851611c39c2ce2c69a4d632c73317e9c188388c338bbaff8b9b9a87ddd41dc80" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/kodi-pvr/pvr.mythtv/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/janbar/pvr.mythtv" +PKG_URL="https://github.com/janbar/pvr.mythtv/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.mythtv" PKG_LONGDESC="pvr.mythtv" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk index 4b1b770cf2..c2d1056b97 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.nextpvr" -PKG_VERSION="e7430e9" -PKG_REV="1" +PKG_VERSION="78c6633a1260a911de0a550c6322a1ae0d1c650e" +PKG_SHA256="63772e0d11647765b11242105d234a5346c854a2197abc79829b700fe85b4e19" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.nextpvr" PKG_LONGDESC="pvr.nextpvr" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.pvrclient" pre_configure_target() { CXXFLAGS="$CXXFLAGS -Wno-narrowing" } - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk index f57f3691c1..f9fc4a16f3 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.njoy" -PKG_VERSION="57393bd" -PKG_REV="1" +PKG_VERSION="4467cacf819d7312482635ac45ddd52cd61ab6e0" +PKG_SHA256="a53afb0fac615d072975ba306ede4985e5c6f4a69a34656c6c22dbf31b39511b" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.njoy" PKG_LONGDESC="pvr.njoy" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.octonet/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.octonet/package.mk index 5d2350b0bc..d3024b9c13 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.octonet/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.octonet/package.mk @@ -1,24 +1,10 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.octonet" -PKG_VERSION="ff2d4a7" -PKG_REV="1" +PKG_VERSION="203f800eaaada32a010dde94679ec34818cb2916" +PKG_SHA256="8ae56c61134b8b59dacb5324fd47c84e243e5331207b3e89646575c8b774bb40" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +13,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_SECTION="" PKG_SHORTDESC="A pvr plugin for DigitalDevices Octonet Sat>IP servers" PKG_LONGDESC="A pvr plugin for DigitalDevices Octonet Sat>IP servers" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk index e5df8a7ce6..35f044e299 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.pctv" -PKG_VERSION="b7b5fe0" -PKG_REV="1" +PKG_VERSION="b60b971029d71e2169fecaccaa46a66624788d82" +PKG_SHA256="3563ef9e3690119e0c4cfd2cb3d5ff53acfc575b6cb6aebcbc5f5d0aef3cc23a" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" PKG_SECTION="" PKG_SHORTDESC="pvr.pctv" PKG_LONGDESC="pvr.pctv" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.sledovanitv.cz/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.sledovanitv.cz/package.mk new file mode 100644 index 0000000000..79a7af8fe2 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/pvr.sledovanitv.cz/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pvr.sledovanitv.cz" +PKG_VERSION="2e3a7e245f3133c7cc9a132de716d94a31a1e7ec" +PKG_SHA256="a8f9589995bc5d570f8d74692697f6b13843bf3ca78fcabbb14ebaf96f330c34" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPLv2" +PKG_SITE="https://kodi.tv" +PKG_URL="https://github.com/palinek/pvr.sledovanitv.cz/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp" +PKG_SECTION="" +PKG_SHORTDESC="pvr.sledovanitv.cz" +PKG_LONGDESC="pvr.sledovanitv.cz" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.pvrclient" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk index 82619b89a0..dfe7ec1467 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.stalker" -PKG_VERSION="c396e47" -PKG_REV="1" +PKG_VERSION="d0170c5b3fc496d8a51fe894661babcd5d7b4347" +PKG_SHA256="d82468c43b01f54084827f9e4298bbb641fff12442bff6d9eb0f4381f3afc721" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform jsoncpp tinyxml" PKG_SECTION="" PKG_SHORTDESC="pvr.stalker" PKG_LONGDESC="pvr.stalker" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.stalker/patches/pvr.stalker-001-gcc7_fix.patch b/packages/mediacenter/kodi-binary-addons/pvr.stalker/patches/pvr.stalker-001-gcc7_fix.patch new file mode 100644 index 0000000000..ffad1186aa --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/pvr.stalker/patches/pvr.stalker-001-gcc7_fix.patch @@ -0,0 +1,11 @@ +--- pvr.stalker-151e3d3/src/CWatchdog.h 2017-05-22 13:38:16.000000000 +0200 ++++ pvr.stalker-151e3d3/src/CWatchdog.h 2017-06-02 09:24:34.357505179 +0200 +@@ -20,7 +20,7 @@ + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * + */ +- ++#include + #include + + #include "SAPI.h" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.teleboy/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.teleboy/package.mk new file mode 100644 index 0000000000..2a30cd0d18 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/pvr.teleboy/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pvr.teleboy" +PKG_VERSION="1956113e4ec824ab930bd237ca8a6e662b18c19a" +PKG_SHA256="49ed188aabaff018e0624af4c242691f81591006624dde3a3ae8457bdbaaddf4" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/rbuehlma/pvr.teleboy/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="pvr.teleboy" +PKG_LONGDESC="pvr.teleboy" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.pvrclient" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk index 4299930d59..c2be84c359 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.vbox" -PKG_VERSION="46a612d" -PKG_REV="1" +PKG_VERSION="ea20464ea7ea36b4c6163c8d74e589604023d01d" +PKG_SHA256="a463278c1c8a84268cc902e802fc8f572319bdcffba3335ec93987bbf2fc49ad" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform tinyxml2" PKG_SECTION="" PKG_SHORTDESC="pvr.vbox" PKG_LONGDESC="pvr.vbox" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk index cbd1d71013..6e0c25d695 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.vdr.vnsi" -PKG_VERSION="0c9552e" -PKG_REV="1" +PKG_VERSION="cbb75abb75218afba3b7ff30728bba279b661fe4" +PKG_SHA256="b4c6cdea939d94a4549b42c8be29baa1a570d869f25795f14d992f759211eadf" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/kodi-pvr/pvr.vdr.vnsi/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/FernetMenta/pvr.vdr.vnsi" +PKG_URL="https://github.com/FernetMenta/pvr.vdr.vnsi/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.vdr.vnsi" PKG_LONGDESC="pvr.vdr.vnsi" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk index 1dba586b34..f461c66e34 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.vuplus" -PKG_VERSION="763a644" -PKG_REV="1" +PKG_VERSION="253f5d8dfbb803f946b67b15882fd9ed04456b3f" +PKG_SHA256="ea9463c04fac1eec36c9debed548f1d70791e72de46e7c8c4a3b2f43ba648af9" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="https://github.com/kodi-pvr/pvr.vuplus/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_DEPENDS_TARGET="toolchain kodi-platform nlohmann-json" PKG_SECTION="" PKG_SHORTDESC="pvr.vuplus" PKG_LONGDESC="pvr.vuplus" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk index 360771c4f0..7be4f6321d 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="pvr.wmc" -PKG_VERSION="55218f5" -PKG_REV="1" +PKG_VERSION="7b28be39bf8e71c1366a37c86d7b669689ce1691" +PKG_SHA256="5eec7c2a548f03495ebd40bbf13be1c03fe065e3b39717ea02903bb243d1d0d9" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="pvr.wmc" PKG_LONGDESC="pvr.wmc" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.pvrclient" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/pvr.zattoo/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.zattoo/package.mk new file mode 100644 index 0000000000..cce58915b7 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/pvr.zattoo/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pvr.zattoo" +PKG_VERSION="30868ce353562cc61e7413f36273dfe0911253d3" +PKG_SHA256="8ba2a7642d4b016da54d8dbe3e9f8a40be375428400e126873657588660a396b" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/rbuehlma/pvr.zattoo/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="pvr.zattoo" +PKG_LONGDESC="pvr.zattoo" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.pvrclient" diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk index 8fbf6c6ea1..8b480c2aa1 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.asteroids/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.asteroids" -PKG_VERSION="0fc066d" -PKG_REV="1" +PKG_VERSION="73fff6daf59e2a2455d10be93080457a30ba5516" +PKG_SHA256="079203678c0dddcc5d4797ff3587b9499ae7b78fd18b4a76de81e60b80daa898" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/screensaver.asteroids" -PKG_URL="https://github.com/notspiff/screensaver.asteroids/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/screensaver.asteroids" +PKG_URL="https://github.com/xbmc/screensaver.asteroids/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.asteroids" PKG_LONGDESC="screensaver.asteroids" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk index 37cf57ac3a..417feb5c77 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.asterwave/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.asterwave" -PKG_VERSION="c39ed33" -PKG_REV="1" +PKG_VERSION="6acee9c199049854bf511043c88da821e2b19459" +PKG_SHA256="554f348a7f120cf218e8f8922afd04f2e0814b1742e2bd27e2e9aadad238aebb" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.asterwave" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform soil" PKG_SECTION="" PKG_SHORTDESC="screensaver.asterwave" PKG_LONGDESC="screensaver.asterwave" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk index 0460eb418e..ecdb1098e2 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.biogenesis/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.biogenesis" -PKG_VERSION="717fea7" -PKG_REV="1" +PKG_VERSION="23050786a0b28a1fdb80104ea802bee370c6176f" +PKG_SHA256="1360eebadc0bb3cfa03b938793480329ada7014ae84e319c0caf72d794c4d2a5" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/screensaver.biogenesis" -PKG_URL="https://github.com/notspiff/screensaver.biogenesis/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/screensaver.biogenesis" +PKG_URL="https://github.com/xbmc/screensaver.biogenesis/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.biogenesis" PKG_LONGDESC="screensaver.biogenesis" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk index bcbe61b678..ce47f5515a 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.cpblobs/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.cpblobs" -PKG_VERSION="04c1938" -PKG_REV="1" +PKG_VERSION="8f9b8bcc54816b3ba6dc5aa24f11c35ffd128bf4" +PKG_SHA256="0cb103ddf4876c35e7f1a2e8ddf4871fa56b9d0d367f30324cd2f58b0b268959" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.cpblobs" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform soil" PKG_SECTION="" PKG_SHORTDESC="screensaver.cpblobs" PKG_LONGDESC="screensaver.cpblobs" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk index 76b926734d..1043192264 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.greynetic/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.greynetic" -PKG_VERSION="980e301" -PKG_REV="1" +PKG_VERSION="29693bdc474d09a1fe7ac846ad6f62b8841851fd" +PKG_SHA256="ae47f8450c427edd484ab12f25bf0a5dc4ef8b8bfcca463b1cebfdfb91104619" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/screensaver.greynetic" -PKG_URL="https://github.com/notspiff/screensaver.greynetic/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/screensaver.greynetic" +PKG_URL="https://github.com/xbmc/screensaver.greynetic/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.greynetic" PKG_LONGDESC="screensaver.greynetic" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk index 3eb10da0e2..d8128022f6 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.matrixtrails/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.matrixtrails" -PKG_VERSION="8cebb75" -PKG_REV="1" +PKG_VERSION="b652e74ad8b2fac66c548393dfc016ee89693318" +PKG_SHA256="1e9d97d2256f4d9e283b182f454a7d707fef29481d32f328bbee411f71318bac" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/screensaver.matrixtrails" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform soil" PKG_SECTION="" PKG_SHORTDESC="screensaver.matrixtrails" PKG_LONGDESC="screensaver.matrixtrails" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk index 2041b8cee1..ff7680191b 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.pingpong/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.pingpong" -PKG_VERSION="f162213" -PKG_REV="1" +PKG_VERSION="a307f670db4e6553229c4c8db19d36a2666b3c3c" +PKG_SHA256="cc629bb2dfd82a3096c6de601d37f614d1258b04db55b75a7413c8ecc40d0112" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/screensaver.pingpong" -PKG_URL="https://github.com/notspiff/screensaver.pingpong/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/screensaver.pingpong" +PKG_URL="https://github.com/xbmc/screensaver.pingpong/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.pingpong" PKG_LONGDESC="screensaver.pingpong" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk index 6cd7a4ac2e..ae30441655 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.pyro/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.pyro" -PKG_VERSION="4810d75" -PKG_REV="1" +PKG_VERSION="3b2d52c205fa06f005d8b0a1b34de09911678e6a" +PKG_SHA256="52019eeddebcecf4fad103c6a4f6aaedee5c77b42f65b600385d434fcb31bc43" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/screensaver.pyro" -PKG_URL="https://github.com/notspiff/screensaver.pyro/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/screensaver.pyro" +PKG_URL="https://github.com/xbmc/screensaver.pyro/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.pyro" PKG_LONGDESC="screensaver.pyro" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk index 0a63c26079..e6b85ded24 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.shadertoy/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.shadertoy" -PKG_VERSION="eb31b44" -PKG_REV="1" +PKG_VERSION="0290c8efc430b3b331a034eb3eb79f7cfff6c01d" +PKG_SHA256="970eed3e63db75043fafe5a172bcd218bba3b5ae5f3b418206da00865ccb4647" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/popcornmix/screensaver.shadertoy" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.shadertoy" PKG_LONGDESC="screensaver.shadertoy" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -43,21 +29,10 @@ if [ "$OPENGLES_SUPPORT" = yes ]; then fi pre_configure_target() { - if [ "$KODIPLAYER_DRIVER" = bcm2835-firmware ]; then + if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then BCM2835_INCLUDES="-I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads/ \ -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux" export CFLAGS="$CFLAGS $BCM2835_INCLUDES" export CXXFLAGS="$CXXFLAGS $BCM2835_INCLUDES" - elif [ "$KODIPLAYER_DRIVER" = libfslvpuwrap ]; then - export CFLAGS="$CFLAGS -DLINUX -DEGL_API_FB" - export CXXFLAGS="$CXXFLAGS -DLINUX -DEGL_API_FB" fi } - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk b/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk index 4ac373a3cb..8f7f97da7d 100644 --- a/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensaver.stars/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensaver.stars" -PKG_VERSION="55764aa" -PKG_REV="1" +PKG_VERSION="8664bfe8fbe4fcf53798b1e73e49b95742fc1c73" +PKG_SHA256="5abaa43742da3c3bf3f0da99e8d8eb56868e82c09a6275bbd50d985ed647de8c" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/screensaver.stars" -PKG_URL="https://github.com/notspiff/screensaver.stars/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/screensaver.stars" +PKG_URL="https://github.com/xbmc/screensaver.stars/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="screensaver.stars" PKG_LONGDESC="screensaver.stars" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.ui.screensaver" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk index b4fd4eda17..65979a24c6 100644 --- a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk +++ b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/package.mk @@ -1,25 +1,12 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="screensavers.rsxs" -PKG_VERSION="781f76f" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="be03db6e9652a465b521cb7768b692e52ed2f1e3" +PKG_SHA256="b0f35760a3f444769c2f0f948defc220b34459dde1bea06522708498eefe2e99" +PKG_REV="2" +PKG_ARCH="broken" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="https://github.com/notspiff/screensavers.rsxs/archive/$PKG_VERSION.tar.gz" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform libXt libXmu" PKG_SECTION="" PKG_SHORTDESC="screensavers.rsxs" PKG_LONGDESC="screensavers.rsxs" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.ui.screensaver" @@ -40,9 +26,7 @@ addon() { for _ADDON in $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/* ; do _ADDON_ID=$(basename $_ADDON) - mkdir -p $ADDON_BUILD/$_ADDON_ID/ - cp -PR $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$_ADDON_ID/* $ADDON_BUILD/$_ADDON_ID/ - cp -PL $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$_ADDON_ID/*.so $ADDON_BUILD/$_ADDON_ID/ + install_binary_addon $_ADDON_ID MULTI_ADDONS="$MULTI_ADDONS $_ADDON_ID" done diff --git a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0001-fix-gcc5-compile.patch b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0001-fix-gcc5-compile.patch deleted file mode 100644 index 4371244068..0000000000 --- a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0001-fix-gcc5-compile.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur screensavers.rsxs-3241d29.orig/CMakeLists.txt screensavers.rsxs-3241d29/CMakeLists.txt ---- screensavers.rsxs-3241d29.orig/CMakeLists.txt 2015-10-20 00:21:24.000000000 -0700 -+++ screensavers.rsxs-3241d29/CMakeLists.txt 2015-10-22 23:34:37.522226204 -0700 -@@ -52,6 +52,7 @@ - endif() - externalproject_add(rsxs SOURCE_DIR ${PROJECT_SOURCE_DIR}/${rsxs_dir} - CONFIGURE_COMMAND ${configure_start} -+ ac_cv_type__Bool=yes - --prefix= - --without-xscreensaver - --disable-cyclone diff --git a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0002-fix-default-include-dir.patch b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0002-fix-default-include-dir.patch index ac409a785c..8738185afd 100644 --- a/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0002-fix-default-include-dir.patch +++ b/packages/mediacenter/kodi-binary-addons/screensavers.rsxs/patches/screensavers.rsxs-0002-fix-default-include-dir.patch @@ -1,16 +1,17 @@ -diff -Naur screensavers.rsxs-3241d29.orig/CMakeLists.txt screensavers.rsxs-3241d29/CMakeLists.txt ---- screensavers.rsxs-3241d29.orig/CMakeLists.txt 2015-10-22 23:59:38.187280475 -0700 -+++ screensavers.rsxs-3241d29/CMakeLists.txt 2015-10-23 00:00:27.228113829 -0700 -@@ -17,7 +17,7 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ed0f308..74fc6bf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,7 +17,7 @@ set(rsxs_dir lib/rsxs-1.0) include_directories(${OpenGL_INCLUDE_DIR} ${PNG_INCLUDE_DIR} - ${KODI_INCLUDE_DIR} + ${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways - ${X_INCLUDE_DIRS} + ${X_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/rsxs-prefix/src/rsxs-build ${PROJECT_SOURCE_DIR}/${rsxs_dir}/src ${PROJECT_SOURCE_DIR}/${rsxs_dir}/lib -@@ -67,7 +67,7 @@ +@@ -67,7 +67,7 @@ externalproject_add(rsxs SOURCE_DIR ${PROJECT_SOURCE_DIR}/${rsxs_dir} --disable-skyrocket --disable-solarwinds --disable-sound diff --git a/packages/mediacenter/kodi-binary-addons/vfs.libarchive/package.mk b/packages/mediacenter/kodi-binary-addons/vfs.libarchive/package.mk new file mode 100644 index 0000000000..b570b23027 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/vfs.libarchive/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vfs.libarchive" +PKG_VERSION="2ba11021ef58cf7fa9ca1051e5c0d558cd2a04bc" +PKG_SHA256="634fc1189422d6e2a9590dd3b824f6b14a9c3bfc5075c51d2a5eb1779ef5aa23" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/xbmc/vfs.libarchive/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform bzip2 libarchive lz4 lzo xz zlib" +PKG_SECTION="" +PKG_SHORTDESC="vfs.libarchive" +PKG_LONGDESC="vfs.libarchive" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.vfs" diff --git a/packages/mediacenter/kodi-binary-addons/vfs.rar/package.mk b/packages/mediacenter/kodi-binary-addons/vfs.rar/package.mk new file mode 100644 index 0000000000..789777481e --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/vfs.rar/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vfs.rar" +PKG_VERSION="45a0cec35c99a3fce0586b92d9ecdedd30a11be9" +PKG_SHA256="ed7635f647634b8e590a8fd6c7af6b3a5dfa43a0f97a5a432d45826d3b01d013" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/xbmc/vfs.rar/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="vfs.rar" +PKG_LONGDESC="vfs.rar" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.vfs" diff --git a/packages/mediacenter/kodi-binary-addons/vfs.sacd/package.mk b/packages/mediacenter/kodi-binary-addons/vfs.sacd/package.mk new file mode 100644 index 0000000000..770a1dd5c7 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/vfs.sacd/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vfs.sacd" +PKG_VERSION="4ade5fe422a2d08bb61f827e5382bc141456f6fd" +PKG_SHA256="f2bdc8f74cf31d836dde7f0bbedd3e553002144d28c6649163da1c82010a2297" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.kodi.tv" +PKG_URL="https://github.com/xbmc/vfs.sacd/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="" +PKG_SHORTDESC="vfs.sacd" +PKG_LONGDESC="vfs.sacd" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.vfs" diff --git a/packages/mediacenter/kodi-binary-addons/vfs.sftp/package.mk b/packages/mediacenter/kodi-binary-addons/vfs.sftp/package.mk new file mode 100644 index 0000000000..b75a338c84 --- /dev/null +++ b/packages/mediacenter/kodi-binary-addons/vfs.sftp/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="vfs.sftp" +PKG_VERSION="b9fbb2298bb55adde3fbb46f2c2ab6ca2c2a6b0d" +PKG_SHA256="860075f0b200a798e103947cb3f1dcc65b952df0db01b9a6d24f9f71c0cc8410" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPLv2" +PKG_SITE="https://kodi.tv" +PKG_URL="https://github.com/xbmc/vfs.sftp/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain kodi-platform libssh" +PKG_SECTION="" +PKG_SHORTDESC="vfs.sftp" +PKG_LONGDESC="vfs.sftp" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="kodi.vfs" diff --git a/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk index 566005b847..00e295d56a 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.fishbmc/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.fishbmc" -PKG_VERSION="93d8845" -PKG_REV="1" +PKG_VERSION="3dae2bd6dc15dad0131fb31c3b00e41ab1caa0f0" +PKG_SHA256="471765286c6054717980510edf5d49390b0d4f38289c83830a9e0a444202825c" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,7 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="visualization.fishbmc" PKG_LONGDESC="visualization.fishbmc" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" @@ -35,11 +21,3 @@ PKG_ADDON_TYPE="xbmc.player.musicviz" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk index 01bbfaa3eb..17c625508d 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.goom/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.goom" -PKG_VERSION="a23f4ad" -PKG_REV="1" +PKG_VERSION="7c91a206769534adc8a583feaed81cdb8659f64f" +PKG_SHA256="6197847d922050b37ce8a2a20436c16d10a48566f7128570965aa082fe203fc4" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/notspiff/visualization.goom" @@ -27,7 +14,7 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="visualization.goom" PKG_LONGDESC="visualization.goom" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="cmake-make" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" @@ -35,11 +22,3 @@ PKG_ADDON_TYPE="xbmc.player.musicviz" if [ "$OPENGL" = "no" ] ; then exit 0 fi - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk index 3249d4e3c5..73c44dbe9b 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.pictureit/package.mk @@ -1,24 +1,11 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.pictureit" -PKG_VERSION="66f88ff" -PKG_REV="1" +PKG_VERSION="f08d0aa6d5f80cfa95a24adca48be15e333ca8e0" +PKG_SHA256="f29112d232907b46a738e6971f03c75ec6a61b70be70de203db82b2252ae4f8d" +PKG_REV="2" PKG_ARCH="x86_64" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" @@ -27,15 +14,6 @@ PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="visualization.pictureit" PKG_LONGDESC="visualization.pictureit" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk index c7c4c63236..7b657abac5 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.projectm/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.projectm" -PKG_VERSION="c5a86e9" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e6c5ab35f09c634d71252f333f450095ac5e6ca2" +PKG_SHA256="96e78b1fc1e5e9bfde24b8c556ad3a178ce5ba866d5b158df2a6f2761f50d5e6" +PKG_REV="2" +PKG_ARCH="x86_64" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/visualization.projectm" -PKG_URL="https://github.com/notspiff/visualization.projectm/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/visualization.projectm" +PKG_URL="https://github.com/xbmc/visualization.projectm/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform libprojectM" PKG_SECTION="" PKG_SHORTDESC="visualization.projectm" PKG_LONGDESC="visualization.projectm" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" @@ -38,12 +24,5 @@ fi pre_configure_target() { export LDFLAGS=`echo $LDFLAGS | sed -e "s|-Wl,--as-needed||"` -} - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ + sed -i "s|\${PROJECTM_PREFIX}|$SYSROOT_PREFIX\/usr|" -i $PKG_BUILD/FindProjectM.cmake } diff --git a/packages/mediacenter/kodi-binary-addons/visualization.projectm/patches/visualization.projectm-01-Revert-changed-get-rid-of-DATAPATH-definition.patch b/packages/mediacenter/kodi-binary-addons/visualization.projectm/patches/visualization.projectm-01-Revert-changed-get-rid-of-DATAPATH-definition.patch deleted file mode 100644 index bdc481a5a9..0000000000 --- a/packages/mediacenter/kodi-binary-addons/visualization.projectm/patches/visualization.projectm-01-Revert-changed-get-rid-of-DATAPATH-definition.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 79c3a7d5e2d3ae0274a7122246a6922b74e8cdaf Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sat, 4 Jul 2015 21:54:09 +0300 -Subject: [PATCH] Revert "changed: get rid of DATAPATH definition" - -This reverts commit 60467a6492adb32b7487274ceaec4f76c13eec1a. ---- - CMakeLists.txt | 2 ++ - src/Main.cpp | 28 +++------------------------- - 2 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 77bcb6e..d73d069 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -13,6 +13,8 @@ find_package(GLEW REQUIRED) - find_package(ProjectM REQUIRED) - - add_definitions(-DHAS_SDL_OPENGL) -+set(DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/xbmc/addons/visualization.projectm/resources") -+add_definitions(-DDATAPATH="${DATA_PATH}") - - set(INCLUDES ${OpenGL_INCLUDE_DIR} - ${GLEW_INCLUDE_DIR} -diff --git a/src/Main.cpp b/src/Main.cpp -index 449cb85..81205dc 100644 ---- a/src/Main.cpp -+++ b/src/Main.cpp -@@ -55,7 +55,6 @@ - - #include - #include --#include - #include - - #if !defined(__APPLE__) -@@ -79,8 +78,6 @@ bool lastLockStatus; - int lastPresetIdx; - unsigned int lastLoggedPresetIdx; - --ADDON::CHelper_libXBMC_addon *XBMC = NULL; -- - //-- Create ------------------------------------------------------------------- - // Called once when the visualisation is created by XBMC. Do any setup here. - //----------------------------------------------------------------------------- -@@ -89,15 +86,6 @@ extern "C" ADDON_STATUS ADDON_Create(void* hdl, void* props) - if (!props) - return ADDON_STATUS_UNKNOWN; - -- if (!XBMC) -- XBMC = new ADDON::CHelper_libXBMC_addon; -- -- if (!XBMC->RegisterMe(hdl)) -- { -- delete XBMC, XBMC=NULL; -- return ADDON_STATUS_PERMANENT_FAILURE; -- } -- - VIS_PROPS* visprops = (VIS_PROPS*)props; - - strcpy(g_visName, visprops->name); -@@ -109,13 +97,8 @@ extern "C" ADDON_STATUS ADDON_Create(void* hdl, void* props) - g_configPM.windowHeight = visprops->height; - g_configPM.aspectCorrection = true; - g_configPM.easterEgg = 0.0; -- char path[1024]; -- XBMC->GetSetting("__addonpath__", path); -- strcat(path,"/resources"); -- g_configPM.titleFontURL = path; -- g_configPM.titleFontURL += "/Vera.ttf"; -- g_configPM.menuFontURL = path; -- g_configPM.menuFontURL += "/VeraMono.ttf"; -+ g_configPM.titleFontURL = DATAPATH"/Vera.ttf"; -+ g_configPM.menuFontURL = DATAPATH"/VeraMono.ttf"; - lastLoggedPresetIdx = lastPresetIdx; - - return ADDON_STATUS_NEED_SAVEDSETTINGS; -@@ -351,12 +334,7 @@ void ChoosePresetPack(int pvalue) - { - g_UserPackFolder = false; - if (pvalue == 0) -- { -- char path[1024]; -- XBMC->GetSetting("__addonpath__", path); -- g_configPM.presetURL = path; -- g_configPM.presetURL += "/resources/presets"; -- } -+ g_configPM.presetURL = DATAPATH"/presets"; - else if (pvalue == 1) //User preset folder has been chosen - g_UserPackFolder = true; - } --- -2.1.4 - diff --git a/packages/mediacenter/kodi-binary-addons/visualization.projectm/patches/visualization.projectm-02-move-datapath-to-storage.patch b/packages/mediacenter/kodi-binary-addons/visualization.projectm/patches/visualization.projectm-02-move-datapath-to-storage.patch deleted file mode 100644 index 1942ab0eb4..0000000000 --- a/packages/mediacenter/kodi-binary-addons/visualization.projectm/patches/visualization.projectm-02-move-datapath-to-storage.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8e396c0586e511b746e377f36817e32413b7c5aa Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sat, 4 Jul 2015 22:21:19 +0300 -Subject: [PATCH] move datapath to /storage - ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d73d069..1043f1a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -13,7 +13,7 @@ find_package(GLEW REQUIRED) - find_package(ProjectM REQUIRED) - - add_definitions(-DHAS_SDL_OPENGL) --set(DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/xbmc/addons/visualization.projectm/resources") -+set(DATA_PATH "/storage/.kodi/addons/visualization.projectm/resources") - add_definitions(-DDATAPATH="${DATA_PATH}") - - set(INCLUDES ${OpenGL_INCLUDE_DIR} --- -2.1.4 - diff --git a/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk index e724028ca5..436171dae3 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.shadertoy/package.mk @@ -1,33 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.shadertoy" -PKG_VERSION="e88fd6e" -PKG_REV="1" +PKG_VERSION="039af915812c9d4657dee9da93336598cf083cc0" +PKG_SHA256="a3598b4f0c7f1bfcbab3f1be305f18175b062676bae179a8d13e980d05e35079" +PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/visualization.shadertoy" -PKG_URL="https://github.com/notspiff/visualization.shadertoy/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/xbmc/visualization.shadertoy" +PKG_URL="https://github.com/xbmc/visualization.shadertoy/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="visualization.shadertoy" PKG_LONGDESC="visualization.shadertoy" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" @@ -43,21 +29,10 @@ if [ "$OPENGLES_SUPPORT" = yes ]; then fi pre_configure_target() { - if [ "$KODIPLAYER_DRIVER" = bcm2835-firmware ]; then + if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then BCM2835_INCLUDES="-I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads/ \ -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux" export CFLAGS="$CFLAGS $BCM2835_INCLUDES" export CXXFLAGS="$CXXFLAGS $BCM2835_INCLUDES" - elif [ "$KODIPLAYER_DRIVER" = libfslvpuwrap ]; then - export CFLAGS="$CFLAGS -DLINUX -DEGL_API_FB" - export CXXFLAGS="$CXXFLAGS -DLINUX -DEGL_API_FB" fi } - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk index 83f470dd26..d604cbb111 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.spectrum/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.spectrum" -PKG_VERSION="73c8786" -PKG_REV="1" +PKG_VERSION="2a9956059faacc7b2b969498138ad80341ad639a" +PKG_SHA256="8714e7ff5d79dce1b4eb091465b39360715cdcc65f1c4a6c4009879be5de0f64" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/visualization.spectrum/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/visualization.spectrum/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="visualization.spectrum" PKG_LONGDESC="visualization.spectrum" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk deleted file mode 100644 index 9ed7692ec8..0000000000 --- a/packages/mediacenter/kodi-binary-addons/visualization.vsxu/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="visualization.vsxu" -PKG_VERSION="caedcbc" -PKG_REV="1" -PKG_ARCH="i386 x86_64" -PKG_LICENSE="GPL" -PKG_SITE="https://github.com/notspiff/visualization.vsxu" -PKG_URL="https://github.com/notspiff/visualization.vsxu/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform vsxu" -PKG_SECTION="" -PKG_SHORTDESC="visualization.vsxu" -PKG_LONGDESC="visualization.vsxu" -PKG_AUTORECONF="no" - -PKG_IS_ADDON="yes" -PKG_ADDON_TYPE="xbmc.player.musicviz" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk index 84e0d58324..e23e489166 100644 --- a/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk +++ b/packages/mediacenter/kodi-binary-addons/visualization.waveform/package.mk @@ -1,41 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="visualization.waveform" -PKG_VERSION="a603d10" -PKG_REV="1" +PKG_VERSION="0cf358a5fda80815089a52b44191ecc26dfdc7f3" +PKG_SHA256="804701930dcadc0a5b66266bbdf0e5a2733d05178d5af8ce18425285c97a3905" +PKG_REV="2" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/notspiff/visualization.waveform/archive/$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/xbmc/visualization.waveform/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain kodi-platform" PKG_SECTION="" PKG_SHORTDESC="visualization.waveform" PKG_LONGDESC="visualization.waveform" -PKG_AUTORECONF="no" PKG_IS_ADDON="yes" PKG_ADDON_TYPE="xbmc.player.musicviz" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-binary-addons/visualization.wavforhue/package.mk b/packages/mediacenter/kodi-binary-addons/visualization.wavforhue/package.mk deleted file mode 100644 index e0c4b82c57..0000000000 --- a/packages/mediacenter/kodi-binary-addons/visualization.wavforhue/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -PKG_NAME="visualization.wavforhue" -PKG_VERSION="b1805db" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/hardyt/visualization.wavforhue/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain kodi-platform" -PKG_SECTION="" -PKG_SHORTDESC="visualization.wavforhue" -PKG_LONGDESC="visualization.wavforhue" -PKG_AUTORECONF="no" - -PKG_IS_ADDON="yes" -PKG_ADDON_TYPE="xbmc.player.musicviz" - -addon() { - mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/ - cp -R $PKG_BUILD/.install_pkg/usr/share/$MEDIACENTER/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/ - - ADDONSO=$(xmlstarlet sel -t -v "/addon/extension/@library_linux" $ADDON_BUILD/$PKG_ADDON_ID/addon.xml) - cp -L $PKG_BUILD/.install_pkg/usr/lib/$MEDIACENTER/addons/$PKG_NAME/$ADDONSO $ADDON_BUILD/$PKG_ADDON_ID/ -} diff --git a/packages/mediacenter/kodi-platform/package.mk b/packages/mediacenter/kodi-platform/package.mk index 45d1ab7576..2e189e6a41 100644 --- a/packages/mediacenter/kodi-platform/package.mk +++ b/packages/mediacenter/kodi-platform/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="kodi-platform" -PKG_VERSION="c8188d8" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e8574b883ffa2131f2eeb96ff3724d60b21130f7" +PKG_SHA256="132d5398b3bb72c6b5394ffa473c52e556419d6df8c52eb0830555dae87eb75a" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="https://github.com/xbmc/kodi-platform/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain tinyxml $MEDIACENTER p8-platform" -PKG_SECTION="multimedia" -PKG_SHORTDESC="kodi-platform:" PKG_LONGDESC="kodi-platform:" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CMAKE_OPTS_TARGET="-DCMAKE_INSTALL_LIBDIR:STRING=lib \ -DCMAKE_INSTALL_LIBDIR_NOARCH:STRING=lib \ -DCMAKE_INSTALL_PREFIX_TOOLCHAIN=$SYSROOT_PREFIX/usr \ diff --git a/packages/mediacenter/kodi-theme-Estuary/package.mk b/packages/mediacenter/kodi-theme-Estuary/package.mk index 35661e8f36..c20c36a583 100644 --- a/packages/mediacenter/kodi-theme-Estuary/package.mk +++ b/packages/mediacenter/kodi-theme-Estuary/package.mk @@ -1,39 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="kodi-theme-Estuary" PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain kodi" -PKG_SECTION="mediacenter" -PKG_SHORTDESC="kodi-theme-Estuary: Kodi Mediacenter default theme" -PKG_LONGDESC="Kodi Media Center (which was formerly named Xbox Media Center and XBMC) is a free and open source cross-platform media player and home entertainment system software with a 10-foot user interface designed for the living-room TV. Its graphical user interface allows the user to easily manage video, photos, podcasts, and music from a computer, optical disk, local network, and the internet using a remote control." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : -} +PKG_NEED_UNPACK="$(get_pkg_directory $MEDIACENTER)" +PKG_LONGDESC="Kodi Mediacenter default theme." +PKG_TOOLCHAIN="manual" makeinstall_target() { mkdir -p $INSTALL/usr/share/kodi/addons/ diff --git a/packages/mediacenter/kodi/config/advancedsettings.xml b/packages/mediacenter/kodi/config/advancedsettings.xml index 0b5968f9b3..cf27548db1 100644 --- a/packages/mediacenter/kodi/config/advancedsettings.xml +++ b/packages/mediacenter/kodi/config/advancedsettings.xml @@ -1,18 +1,9 @@ - + /usr/bin/cputemp + /usr/bin/gputemp + false - cputemp - gputemp - + 1 30 diff --git a/packages/mediacenter/kodi/config/appliance.xml b/packages/mediacenter/kodi/config/appliance.xml index 0ad1fdccd2..e9f0a0ece4 100644 --- a/packages/mediacenter/kodi/config/appliance.xml +++ b/packages/mediacenter/kodi/config/appliance.xml @@ -1,5 +1,15 @@ - + + +
+ + + + false + + + +
@@ -7,9 +17,6 @@ false - - 1 - @@ -24,6 +31,13 @@ + + + + /storage/screenshots/ + + +
@@ -42,17 +56,17 @@ -
-
- + - - false + + 0 +
+
diff --git a/packages/mediacenter/kodi/config/guisettings.xml b/packages/mediacenter/kodi/config/guisettings.xml index 8599258e30..0cf1b76147 100755 --- a/packages/mediacenter/kodi/config/guisettings.xml +++ b/packages/mediacenter/kodi/config/guisettings.xml @@ -1,7 +1,4 @@ - - - /storage/screenshots/ - + 2 diff --git a/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml b/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml index 5d2322fcaa..24c1ac38cb 100644 --- a/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml +++ b/packages/mediacenter/kodi/config/repository.libreelec.tv/addon.xml @@ -1,12 +1,12 @@  @ADDON_URL@/addons.xml.gz - @ADDON_URL@/addons.xml.gz.md5 + @ADDON_URL@/addons.xml.gz.sha256 @ADDON_URL@ diff --git a/packages/mediacenter/kodi/libdvd/libdvd-makefile.in b/packages/mediacenter/kodi/libdvd/libdvd-makefile.in deleted file mode 100644 index e99b746177..0000000000 --- a/packages/mediacenter/kodi/libdvd/libdvd-makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -ARCH=@ARCH@ -CC=@CC@ -CXX=@CXX@ - -DVDNAV_A = $(DVD_PREFIX)/usr/lib/libdvdnav.a -DVDREAD_A = $(DVD_PREFIX)/usr/lib/libdvdread.a -DVDCSS_A = $(DVD_PREFIX)/usr/lib/libdvdcss.a - -WRAPPER = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o -WRAPPER_DEF = @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def - -SO_LDFLAGS = $(LDFLAGS) -shared -fPIC -rdynamic - -SYSDIR = @abs_top_srcdir@/system/players/VideoPlayer -SOS = libdvdcss-$(ARCH).so libdvdnav-$(ARCH).so -SLIB = $(addprefix $(SYSDIR)/, $(SOS)) - -all: $(SLIB) - -$(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) $(WRAPPER_DEF) $(DVDCSS_A) - mkdir -p libdvdcss; cd libdvdcss; $(AR) x $(DVDCSS_A) - $(CC) -o $@ $(SO_LDFLAGS) -Wl,--soname,$@ libdvdcss/*.o -Wl,--unresolved-symbols=ignore-all -lm \ - `cat $(WRAPPER_DEF)` $(WRAPPER) - -$(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(WRAPPER_DEF) $(DVDNAV_A) $(DVDREAD_A) $(DVDCSS_A) - mkdir -p libdvdread; cd libdvdread; $(AR) x $(DVDREAD_A) - mkdir -p libdvdnav; cd libdvdnav; $(AR) x $(DVDNAV_A) - mkdir -p libdvdcss; cd libdvdcss; $(AR) x $(DVDCSS_A) - $(CC) -o $@ $(SO_LDFLAGS) -Wl,--soname,$@ libdvdread/*.o libdvdnav/*.o libdvdcss/*.o -lm -Wl,--unresolved-symbols=ignore-all \ - `cat $(WRAPPER_DEF)` $(WRAPPER) - -$(WRAPPER_DEF): - $(MAKE) -C @abs_top_srcdir@/xbmc/cores/DllLoader/exports wrapper.def - diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk index b818cf6e27..4000a26467 100644 --- a/packages/mediacenter/kodi/package.mk +++ b/packages/mediacenter/kodi/package.mk @@ -1,257 +1,251 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="kodi" -PKG_VERSION="4d93228" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" -PKG_URL="https://github.com/xbmc/xbmc/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="xbmc-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain JsonSchemaBuilder:host TexturePacker:host xmlstarlet:host Python zlib systemd pciutils lzo pcre swig:host libass curl fontconfig fribidi tinyxml libjpeg-turbo freetype libcdio taglib libxml2 libxslt yajl sqlite ffmpeg crossguid giflib libdvdnav libhdhomerun" -PKG_SECTION="mediacenter" -PKG_SHORTDESC="kodi: Kodi Mediacenter" -PKG_LONGDESC="Kodi Media Center (which was formerly named Xbox Media Center or XBMC) is a free and open source cross-platform media player and home entertainment system software with a 10-foot user interface designed for the living-room TV. Its graphical user interface allows the user to easily manage video, photos, podcasts, and music from a computer, optical disk, local network, and the internet using a remote control." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CMAKE_SCRIPT="$ROOT/$PKG_BUILD/project/cmake/CMakeLists.txt" +PKG_DEPENDS_TARGET="toolchain JsonSchemaBuilder:host TexturePacker:host Python2 zlib systemd pciutils lzo pcre swig:host libass curl fontconfig fribidi tinyxml libjpeg-turbo freetype libcdio taglib libxml2 libxslt rapidjson sqlite ffmpeg crossguid giflib libdvdnav libhdhomerun libfmt lirc libfstrcmp flatbuffers:host flatbuffers" +PKG_LONGDESC="A free and open source cross-platform media player." + +PKG_PATCH_DIRS="$KODI_VENDOR" + +case $KODI_VENDOR in + raspberrypi) + PKG_VERSION="newclock5_18.1-Leia" + PKG_SHA256="22a46122a8e6f5a6507baae8e6be6beaf5a4203358478c94da525187b0681b99" + PKG_URL="https://github.com/popcornmix/xbmc/archive/$PKG_VERSION.tar.gz" + PKG_SOURCE_NAME="kodi-$KODI_VENDOR-$PKG_VERSION.tar.gz" + ;; + rockchip) + PKG_VERSION="rockchip_18.1-Leia" + PKG_SHA256="974a3b273462e99eb405ab0c8aafff5890772cfb0088c2d852aea30917528199" + PKG_URL="https://github.com/kwiboo/xbmc/archive/$PKG_VERSION.tar.gz" + PKG_SOURCE_NAME="kodi-$KODI_VENDOR-$PKG_VERSION.tar.gz" + ;; + *) + PKG_VERSION="18.1-Leia" + PKG_SHA256="bc1ef0e271d0b6ce2e1be7546ad4f7d330930d7631cc19a9bbc5f75ddc586166" + PKG_URL="https://github.com/xbmc/xbmc/archive/$PKG_VERSION.tar.gz" + PKG_SOURCE_NAME="kodi-$PKG_VERSION.tar.gz" + ;; +esac + +configure_package() { + # Single threaded LTO is very slow so rely on Kodi for parallel LTO support + if [ "$LTO_SUPPORT" = "yes" ] && ! build_with_debug; then + PKG_KODI_USE_LTO="-DUSE_LTO=$CONCURRENCY_MAKE_LEVEL" + fi get_graphicdrivers PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET dbus" -if [ "$DISPLAYSERVER" = "x11" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXext libdrm libXrandr" - KODI_XORG="-DENABLE_X11=ON" -else - KODI_XORG="-DENABLE_X11=OFF" -fi - -if [ ! "$OPENGL" = "no" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu" - KODI_OPENGL="-DENABLE_OPENGL=ON" -else - KODI_OPENGL="-DENABLE_OPENGL=OFF" -fi - -if [ "$OPENGLES_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGLES" - KODI_OPENGLES="-DENABLE_OPENGLES=ON" -else - KODI_OPENGLES="-DENABLE_OPENGLES=OFF" -fi - -if [ "$ALSA_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET alsa-lib" - KODI_ALSA="-DENABLE_ALSA=ON" -else - KODI_ALSA="-DENABLE_ALSA=OFF" -fi - -if [ "$PULSEAUDIO_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET pulseaudio" - KODI_PULSEAUDIO="-DENABLE_PULSEAUDIO=ON" -else - KODI_PULSEAUDIO="-DENABLE_PULSEAUDIO=OFF" -fi - -if [ "$ESPEAK_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET espeak" -fi - -if [ "$CEC_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libcec" - KODI_CEC="-DENABLE_CEC=ON" -else - KODI_CEC="-DENABLE_CEC=OFF" -fi - -if [ "$KODI_OPTICAL_SUPPORT" = yes ]; then - KODI_OPTICAL="-DENABLE_OPTICAL=ON" -else - KODI_OPTICAL="-DENABLE_OPTICAL=OFF" -fi - -if [ "$KODI_NONFREE_SUPPORT" = yes ]; then - KODI_NONFREE="-DENABLE_NONFREE=ON" -else - KODI_NONFREE="-DENABLE_NONFREE=OFF" -fi - -if [ "$KODI_DVDCSS_SUPPORT" = yes ]; then - KODI_DVDCSS="-DENABLE_DVDCSS=ON \ - -DLIBDVDCSS_URL=$ROOT/$SOURCES/libdvdcss/libdvdcss-$(get_pkg_version libdvdcss).tar.gz" -else - KODI_DVDCSS="-DENABLE_DVDCSS=OFF" -fi - -if [ "$KODI_BLURAY_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libbluray" - KODI_BLURAY="-DENABLE_BLURAY=ON" -else - KODI_BLURAY="-DENABLE_BLURAY=OFF" -fi - -if [ "$AVAHI_DAEMON" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi nss-mdns" - KODI_AVAHI="-DENABLE_AVAHI=ON" -else - KODI_AVAHI="-DENABLE_AVAHI=OFF" -fi - -if [ "$KODI_MYSQL_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET mysql" - KODI_MYSQL="-DENABLE_MYSQLCLIENT=ON" -else - KODI_MYSQL="-DENABLE_MYSQLCLIENT=OFF" -fi - -if [ "$KODI_AIRPLAY_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libplist" - KODI_AIRPLAY="-DENABLE_PLIST=ON" -else - KODI_AIRPLAY="-DENABLE_PLIST=OFF" -fi - -if [ "$KODI_AIRTUNES_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libshairplay" - KODI_AIRTUNES="-DENABLE_AIRTUNES=ON" -else - KODI_AIRTUNES="-DENABLE_AIRTUNES=OFF" -fi - -if [ "$KODI_NFS_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libnfs" - KODI_NFS="-DENABLE_NFS=ON" -else - KODI_NFS="-DENABLE_NFS=OFF" -fi - -if [ "$KODI_SAMBA_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET samba" - KODI_SAMBA="-DENABLE_SMBCLIENT=ON" -else - KODI_SAMBA="-DENABLE_SMBCLIENT=OFF" -fi - -if [ "$KODI_WEBSERVER_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libmicrohttpd" -fi - -if [ "$KODI_UPNP_SUPPORT" = yes ]; then - KODI_UPNP="-DENABLE_UPNP=ON" -else - KODI_UPNP="-DENABLE_UPNP=OFF" -fi - -if [ "$KODI_SSHLIB_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libssh" - KODI_SSH="-DENABLE_SSH=ON" -else - KODI_SSH="-DENABLE_SSH=OFF" -fi - -if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" - KODI_VDPAU="-DENABLE_VDPAU=ON" -else - KODI_VDPAU="-DENABLE_VDPAU=OFF" -fi - -if [ "$VAAPI_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva-intel-driver" - KODI_VAAPI="-DENABLE_VAAPI=ON" -else - KODI_VAAPI="-DENABLE_VAAPI=OFF" -fi - -if [ "$TARGET_ARCH" = "x86_64" ]; then - KODI_ARCH="-DWITH_CPU=$TARGET_ARCH" -else - KODI_ARCH="-DWITH_ARCH=$TARGET_ARCH" -fi - -if [ ! "$KODIPLAYER_DRIVER" = default ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $KODIPLAYER_DRIVER" - if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then - KODI_PLAYER="-DENABLE_MMAL=ON -DCORE_SYSTEM_NAME=rbpi" - elif [ "$KODIPLAYER_DRIVER" = libfslvpuwrap ]; then - KODI_PLAYER="-DENABLE_IMX=ON" - CFLAGS="$CFLAGS -DHAS_IMXVPU -DLINUX -DEGL_API_FB" - CXXFLAGS="$CXXFLAGS -DHAS_IMXVPU -DLINUX -DEGL_API_FB" - elif [ "$KODIPLAYER_DRIVER" = libamcodec ]; then - KODI_PLAYER="-DENABLE_AML=ON" + if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXext libdrm libXrandr" + KODI_XORG="-DCORE_PLATFORM_NAME=x11" + elif [ "$DISPLAYSERVER" = "weston" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET wayland waylandpp" + CFLAGS="$CFLAGS -DMESA_EGL_NO_X11_HEADERS" + CXXFLAGS="$CXXFLAGS -DMESA_EGL_NO_X11_HEADERS" + KODI_XORG="-DCORE_PLATFORM_NAME=wayland -DWAYLAND_RENDER_SYSTEM=gles" fi -fi - -KODI_LIBDVD="$KODI_DVDCSS \ - -DLIBDVDNAV_URL=$ROOT/$SOURCES/libdvdnav/libdvdnav-$(get_pkg_version libdvdnav).tar.gz \ - -DLIBDVDREAD_URL=$ROOT/$SOURCES/libdvdread/libdvdread-$(get_pkg_version libdvdread).tar.gz" - -PKG_CMAKE_OPTS_TARGET="-DNATIVEPREFIX=$ROOT/$TOOLCHAIN \ - -DWITH_TEXTUREPACKER=$ROOT/$TOOLCHAIN/bin/TexturePacker \ - -DDEPENDS_PATH=$ROOT/$PKG_BUILD/depends \ - -DPYTHON_INCLUDE_DIRS=$SYSROOT_PREFIX/usr/include/python2.7 \ - -DGIT_VERSION=$PKG_VERSION \ - -DENABLE_INTERNAL_FFMPEG=OFF \ - -DFFMPEG_INCLUDE_DIRS=$SYSROOT_PREFIX/usr \ - -DENABLE_INTERNAL_CROSSGUID=OFF \ - -DENABLE_SDL=OFF \ - -DENABLE_OPENSSL=ON \ - -DENABLE_UDEV=ON \ - -DENABLE_DBUS=ON \ - -DENABLE_XSLT=ON \ - -DENABLE_CCACHE=ON \ - -DENABLE_LIRC=ON \ - -DENABLE_EVENTCLIENTS=ON \ - -DENABLE_LDGOLD=OFF \ - $KODI_ARCH \ - $KODI_OPENGL \ - $KODI_OPENGLES \ - $KODI_OPENMAX \ - $KODI_VDPAU \ - $KODI_VAAPI \ - $KODI_JOYSTICK \ - $KODI_CEC \ - $KODI_XORG \ - $KODI_SAMBA \ - $KODI_NFS \ - $KODI_LIBDVD \ - $KODI_AVAHI \ - $KODI_UPNP \ - $KODI_MYSQL \ - $KODI_SSH \ - $KODI_AIRPLAY \ - $KODI_AIRTUNES \ - $KODI_NONFREE \ - $KODI_OPTICAL \ - $KODI_BLURAY \ - $KODI_PLAYER" -pre_configure_target() { -# kodi should never be built with lto - strip_lto - strip_gold + if [ ! "$OPENGL" = "no" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu" + fi + + if [ "$OPENGLES_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGLES" + fi + + if [ "$ALSA_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET alsa-lib" + KODI_ALSA="-DENABLE_ALSA=ON" + else + KODI_ALSA="-DENABLE_ALSA=OFF" + fi + + if [ "$PULSEAUDIO_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET pulseaudio" + KODI_PULSEAUDIO="-DENABLE_PULSEAUDIO=ON" + else + KODI_PULSEAUDIO="-DENABLE_PULSEAUDIO=OFF" + fi + + if [ "$ESPEAK_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET espeak" + fi + + if [ "$CEC_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libcec" + KODI_CEC="-DENABLE_CEC=ON" + else + KODI_CEC="-DENABLE_CEC=OFF" + fi + + if [ "$KODI_OPTICAL_SUPPORT" = yes ]; then + KODI_OPTICAL="-DENABLE_OPTICAL=ON" + else + KODI_OPTICAL="-DENABLE_OPTICAL=OFF" + fi + + if [ "$KODI_DVDCSS_SUPPORT" = yes ]; then + KODI_DVDCSS="-DENABLE_DVDCSS=ON \ + -DLIBDVDCSS_URL=$SOURCES/libdvdcss/libdvdcss-$(get_pkg_version libdvdcss).tar.gz" + else + KODI_DVDCSS="-DENABLE_DVDCSS=OFF" + fi + + if [ "$KODI_BLURAY_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libbluray" + KODI_BLURAY="-DENABLE_BLURAY=ON" + else + KODI_BLURAY="-DENABLE_BLURAY=OFF" + fi + + if [ "$AVAHI_DAEMON" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi nss-mdns" + KODI_AVAHI="-DENABLE_AVAHI=ON" + else + KODI_AVAHI="-DENABLE_AVAHI=OFF" + fi + + case "$KODI_MYSQL_SUPPORT" in + mysql) PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET mysql" + KODI_MYSQL="-DENABLE_MYSQLCLIENT=ON -DENABLE_MARIADBCLIENT=OFF" + ;; + mariadb) PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET mariadb-connector-c" + KODI_MYSQL="-DENABLE_MARIADBCLIENT=ON -DENABLE_MYSQLCLIENT=OFF" + ;; + *) KODI_MYSQL="-DENABLE_MYSQLCLIENT=OFF -DENABLE_MARIADBCLIENT=OFF" + esac + + if [ "$KODI_AIRPLAY_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libplist" + KODI_AIRPLAY="-DENABLE_PLIST=ON" + else + KODI_AIRPLAY="-DENABLE_PLIST=OFF" + fi + + if [ "$KODI_AIRTUNES_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libshairplay" + KODI_AIRTUNES="-DENABLE_AIRTUNES=ON" + else + KODI_AIRTUNES="-DENABLE_AIRTUNES=OFF" + fi + + if [ "$KODI_NFS_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libnfs" + KODI_NFS="-DENABLE_NFS=ON" + else + KODI_NFS="-DENABLE_NFS=OFF" + fi + + if [ "$KODI_SAMBA_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET samba" + fi + + if [ "$KODI_WEBSERVER_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libmicrohttpd" + fi - export LIBS="$LIBS -lz -lterminfo" + if [ "$KODI_UPNP_SUPPORT" = yes ]; then + KODI_UPNP="-DENABLE_UPNP=ON" + else + KODI_UPNP="-DENABLE_UPNP=OFF" + fi + + if target_has_feature neon; then + KODI_NEON="-DENABLE_NEON=ON" + else + KODI_NEON="-DENABLE_NEON=OFF" + fi + + if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" + KODI_VDPAU="-DENABLE_VDPAU=ON" + else + KODI_VDPAU="-DENABLE_VDPAU=OFF" + fi + + if [ "$VAAPI_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva" + KODI_VAAPI="-DENABLE_VAAPI=ON" + else + KODI_VAAPI="-DENABLE_VAAPI=OFF" + fi + + if [ "$TARGET_ARCH" = "x86_64" ]; then + KODI_ARCH="-DWITH_CPU=$TARGET_ARCH" + else + KODI_ARCH="-DWITH_ARCH=$TARGET_ARCH" + fi + + if [ "$DEVICE" = "Slice" -o "$DEVICE" = "Slice3" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET led_tools" + fi + + if [ ! "$KODIPLAYER_DRIVER" = default ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $KODIPLAYER_DRIVER libinput libxkbcommon" + if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then + KODI_PLAYER="-DCORE_PLATFORM_NAME=rbpi" + elif [ "$OPENGLES_SUPPORT" = yes -a "$KODIPLAYER_DRIVER" = "$OPENGLES" ]; then + KODI_PLAYER="-DCORE_PLATFORM_NAME=gbm -DGBM_RENDER_SYSTEM=gles" + CFLAGS="$CFLAGS -DMESA_EGL_NO_X11_HEADERS" + CXXFLAGS="$CXXFLAGS -DMESA_EGL_NO_X11_HEADERS" + elif [ "$KODIPLAYER_DRIVER" = libamcodec ]; then + KODI_PLAYER="-DCORE_PLATFORM_NAME=aml" + fi + fi + + KODI_LIBDVD="$KODI_DVDCSS \ + -DLIBDVDNAV_URL=$SOURCES/libdvdnav/libdvdnav-$(get_pkg_version libdvdnav).tar.gz \ + -DLIBDVDREAD_URL=$SOURCES/libdvdread/libdvdread-$(get_pkg_version libdvdread).tar.gz" + + PKG_CMAKE_OPTS_TARGET="-DNATIVEPREFIX=$TOOLCHAIN \ + -DWITH_TEXTUREPACKER=$TOOLCHAIN/bin/TexturePacker \ + -DWITH_JSONSCHEMABUILDER=$TOOLCHAIN/bin/JsonSchemaBuilder \ + -DDEPENDS_PATH=$PKG_BUILD/depends \ + -DPYTHON_EXECUTABLE=$TOOLCHAIN/bin/$PKG_PYTHON_VERSION \ + -DPYTHON_INCLUDE_DIRS=$SYSROOT_PREFIX/usr/include/$PKG_PYTHON_VERSION \ + -DGIT_VERSION=$PKG_VERSION \ + -DWITH_FFMPEG=$(get_build_dir ffmpeg) \ + -DENABLE_INTERNAL_FFMPEG=OFF \ + -DFFMPEG_INCLUDE_DIRS=$SYSROOT_PREFIX/usr \ + -DENABLE_INTERNAL_CROSSGUID=OFF \ + -DENABLE_UDEV=ON \ + -DENABLE_DBUS=ON \ + -DENABLE_XSLT=ON \ + -DENABLE_CCACHE=ON \ + -DENABLE_LIRCCLIENT=ON \ + -DENABLE_EVENTCLIENTS=ON \ + -DENABLE_LDGOLD=ON \ + -DENABLE_DEBUGFISSION=OFF \ + -DENABLE_APP_AUTONAME=OFF \ + -DENABLE_INTERNAL_FLATBUFFERS=OFF \ + $PKG_KODI_USE_LTO \ + $KODI_ARCH \ + $KODI_NEON \ + $KODI_VDPAU \ + $KODI_VAAPI \ + $KODI_CEC \ + $KODI_XORG \ + $KODI_SAMBA \ + $KODI_NFS \ + $KODI_LIBDVD \ + $KODI_AVAHI \ + $KODI_UPNP \ + $KODI_MYSQL \ + $KODI_AIRPLAY \ + $KODI_AIRTUNES \ + $KODI_OPTICAL \ + $KODI_BLURAY \ + $KODI_PLAYER" +} + +pre_configure_target() { + export LIBS="$LIBS -lncurses" } post_makeinstall_target() { @@ -269,63 +263,54 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/share/kodi/addons/visualization.vortex rm -rf $INSTALL/usr/share/xsessions - mv $INSTALL/usr/lib/python2.7/dist-packages $INSTALL/usr/lib/python2.7/site-packages - mkdir -p $INSTALL/usr/lib/kodi cp $PKG_DIR/scripts/kodi-config $INSTALL/usr/lib/kodi + cp $PKG_DIR/scripts/kodi-safe-mode $INSTALL/usr/lib/kodi cp $PKG_DIR/scripts/kodi.sh $INSTALL/usr/lib/kodi - mkdir -p $INSTALL/usr/lib/libreelec - cp $PKG_DIR/scripts/systemd-addon-wrapper $INSTALL/usr/lib/libreelec + # Configure safe mode triggers - default 5 restarts within 900 seconds/15 minutes + sed -e "s|@KODI_MAX_RESTARTS@|${KODI_MAX_RESTARTS:-5}|g" \ + -e "s|@KODI_MAX_SECONDS@|${KODI_MAX_SECONDS:-900}|g" \ + -i $INSTALL/usr/lib/kodi/kodi.sh + + mkdir -p $INSTALL/usr/sbin + cp $PKG_DIR/scripts/service-addon-wrapper $INSTALL/usr/sbin mkdir -p $INSTALL/usr/bin - cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin - ln -sf cputemp $INSTALL/usr/bin/gputemp + cp $PKG_DIR/scripts/kodi-remote $INSTALL/usr/bin cp $PKG_DIR/scripts/setwakeup.sh $INSTALL/usr/bin mkdir -p $INSTALL/usr/share/kodi/addons cp -R $PKG_DIR/config/os.openelec.tv $INSTALL/usr/share/kodi/addons - $SED "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/kodi/addons/os.openelec.tv/addon.xml + sed -e "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/kodi/addons/os.openelec.tv/addon.xml cp -R $PKG_DIR/config/os.libreelec.tv $INSTALL/usr/share/kodi/addons - $SED "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/kodi/addons/os.libreelec.tv/addon.xml + sed -e "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/kodi/addons/os.libreelec.tv/addon.xml cp -R $PKG_DIR/config/repository.libreelec.tv $INSTALL/usr/share/kodi/addons - $SED "s|@ADDON_URL@|$ADDON_URL|g" -i $INSTALL/usr/share/kodi/addons/repository.libreelec.tv/addon.xml + sed -e "s|@ADDON_URL@|$ADDON_URL|g" -i $INSTALL/usr/share/kodi/addons/repository.libreelec.tv/addon.xml cp -R $PKG_DIR/config/repository.kodi.game $INSTALL/usr/share/kodi/addons mkdir -p $INSTALL/usr/share/kodi/config - cp $PKG_DIR/config/guisettings.xml $INSTALL/usr/share/kodi/config - cp $PKG_DIR/config/sources.xml $INSTALL/usr/share/kodi/config - -# install project specific configs - if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/guisettings.xml ]; then - cp -R $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/guisettings.xml $INSTALL/usr/share/kodi/config - elif [ -f $PROJECT_DIR/$PROJECT/kodi/guisettings.xml ]; then - cp -R $PROJECT_DIR/$PROJECT/kodi/guisettings.xml $INSTALL/usr/share/kodi/config - fi + mkdir -p $INSTALL/usr/share/kodi/system/settings - if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/sources.xml ]; then - cp -R $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/sources.xml $INSTALL/usr/share/kodi/config - elif [ -f $PROJECT_DIR/$PROJECT/kodi/sources.xml ]; then - cp -R $PROJECT_DIR/$PROJECT/kodi/sources.xml $INSTALL/usr/share/kodi/config - fi + $PKG_DIR/scripts/xml_merge.py $PKG_DIR/config/guisettings.xml \ + $PROJECT_DIR/$PROJECT/kodi/guisettings.xml \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/guisettings.xml \ + > $INSTALL/usr/share/kodi/config/guisettings.xml - mkdir -p $INSTALL/usr/share/kodi/system/ - if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/advancedsettings.xml ]; then - cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/advancedsettings.xml $INSTALL/usr/share/kodi/system/ - elif [ -f $PROJECT_DIR/$PROJECT/kodi/advancedsettings.xml ]; then - cp $PROJECT_DIR/$PROJECT/kodi/advancedsettings.xml $INSTALL/usr/share/kodi/system/ - else - cp $PKG_DIR/config/advancedsettings.xml $INSTALL/usr/share/kodi/system/ - fi + $PKG_DIR/scripts/xml_merge.py $PKG_DIR/config/sources.xml \ + $PROJECT_DIR/$PROJECT/kodi/sources.xml \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/sources.xml \ + > $INSTALL/usr/share/kodi/config/sources.xml - mkdir -p $INSTALL/usr/share/kodi/system/settings - if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/appliance.xml ]; then - cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/appliance.xml $INSTALL/usr/share/kodi/system/settings - elif [ -f $PROJECT_DIR/$PROJECT/kodi/appliance.xml ]; then - cp $PROJECT_DIR/$PROJECT/kodi/appliance.xml $INSTALL/usr/share/kodi/system/settings - else - cp $PKG_DIR/config/appliance.xml $INSTALL/usr/share/kodi/system/settings - fi + $PKG_DIR/scripts/xml_merge.py $PKG_DIR/config/advancedsettings.xml \ + $PROJECT_DIR/$PROJECT/kodi/advancedsettings.xml \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/advancedsettings.xml \ + > $INSTALL/usr/share/kodi/system/advancedsettings.xml + + $PKG_DIR/scripts/xml_merge.py $PKG_DIR/config/appliance.xml \ + $PROJECT_DIR/$PROJECT/kodi/appliance.xml \ + $PROJECT_DIR/$PROJECT/devices/$DEVICE/kodi/appliance.xml \ + > $INSTALL/usr/share/kodi/system/settings/appliance.xml # update addon manifest ADDON_MANIFEST=$INSTALL/usr/share/kodi/system/addon-manifest.xml @@ -337,6 +322,14 @@ post_makeinstall_target() { xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "repository.libreelec.tv" $ADDON_MANIFEST xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "service.libreelec.settings" $ADDON_MANIFEST + if [ "$DRIVER_ADDONS_SUPPORT" = "yes" ]; then + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "script.program.driverselect" $ADDON_MANIFEST + fi + + if [ "$DEVICE" = "Slice" -o "$DEVICE" = "Slice3" ]; then + xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "service.slice" $ADDON_MANIFEST + fi + # more binaddons cross compile badness meh sed -e "s:INCLUDE_DIR /usr/include/kodi:INCLUDE_DIR $SYSROOT_PREFIX/usr/include/kodi:g" \ -e "s:CMAKE_MODULE_PATH /usr/lib/kodi /usr/share/kodi/cmake:CMAKE_MODULE_PATH $SYSROOT_PREFIX/usr/share/kodi/cmake:g" \ diff --git a/packages/mediacenter/kodi/patches/aarch64/kodi-0001-aml-Fill-audio-packets-completely-when-resampling-to.patch b/packages/mediacenter/kodi/patches/aarch64/kodi-0001-aml-Fill-audio-packets-completely-when-resampling-to.patch deleted file mode 100644 index a829e77600..0000000000 --- a/packages/mediacenter/kodi/patches/aarch64/kodi-0001-aml-Fill-audio-packets-completely-when-resampling-to.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 58415a1c26a1d0f41bc45ff66471c2a41b705edf Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Sat, 20 Sep 2014 04:43:52 +0300 -Subject: [PATCH 1/5] [aml] Fill audio packets completely when resampling to - prevent 'audio data unaligned' kernel warnings - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -index 3ca667c..304cff8 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -162,7 +162,11 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm - m_inputFormat.m_channelLayout += AE_CH_FC; - } - m_resampler = NULL; -+#ifdef HAS_LIBAMCODEC -+ m_fillPackets = true; -+#else - m_fillPackets = false; -+#endif - m_drain = false; - m_empty = true; - m_procSample = NULL; --- -1.7.10.4 - diff --git a/packages/mediacenter/kodi/patches/aarch64/kodi-0002-AESinkALSA-force-default-device-for-non-passthrough.patch b/packages/mediacenter/kodi/patches/aarch64/kodi-0002-AESinkALSA-force-default-device-for-non-passthrough.patch deleted file mode 100644 index e5f0b5181d..0000000000 --- a/packages/mediacenter/kodi/patches/aarch64/kodi-0002-AESinkALSA-force-default-device-for-non-passthrough.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 370709ff0bd108a8bf66656e1424c38341e0b0ac Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Fri, 7 Oct 2016 13:42:10 +0200 -Subject: [PATCH] AESinkALSA: force default device for non-passthrough - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 6a9066b..4d7f85d 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -535,8 +535,8 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device) - m_passthrough = false; - } - #if defined(HAS_LIBAMCODEC) -- if (aml_present()) -+ if (!m_passthrough && device.find("hdmi:CARD=AMLM8AUDIO") != std::string::npos) - { -- aml_set_audio_passthrough(m_passthrough); -+ device = "default"; - } - #endif diff --git a/packages/mediacenter/kodi/patches/aarch64/kodi-0003-EGLNativeTypeAmlogic-Enable-GUI-free_scale-when-framebuffer-size-is-less-than-output.patch b/packages/mediacenter/kodi/patches/aarch64/kodi-0003-EGLNativeTypeAmlogic-Enable-GUI-free_scale-when-framebuffer-size-is-less-than-output.patch deleted file mode 100644 index 728e967992..0000000000 --- a/packages/mediacenter/kodi/patches/aarch64/kodi-0003-EGLNativeTypeAmlogic-Enable-GUI-free_scale-when-framebuffer-size-is-less-than-output.patch +++ /dev/null @@ -1,89 +0,0 @@ -From a348ef744e260f76e1e4e1299f9181ae40352eb5 Mon Sep 17 00:00:00 2001 -From: kszaq -Date: Mon, 22 Aug 2016 06:55:00 +0200 -Subject: [PATCH] EGLNativeTypeAmlogic: Enable GUI free_scale when framebuffer - size is less than output resolution - -For 4K output Kodi renders GUI at 1080p and this results in GUI covering only 1/4 screen. -This patch enables hardware upscaling if output resolution is greater than rendered GUI -resolution. ---- - xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 33 ++++++++++++++++++++++++++--- - xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 2 ++ - 2 files changed, 32 insertions(+), 3 deletions(-) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -index 88cd385..3cbb604 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -@@ -133,6 +133,8 @@ bool CEGLNativeTypeAmlogic::GetNativeResolution(RESOLUTION_INFO *res) const - - bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) - { -+ bool result = false; -+ - #if defined(_FBDEV_WINDOW_H_) - if (m_nativeWindow) - { -@@ -144,10 +146,12 @@ bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) - // Don't set the same mode as current - std::string mode; - SysfsUtils::GetString("/sys/class/display/mode", mode); -- if (res.strId == mode) -- return false; -+ if (res.strId != mode) -+ result = SetDisplayResolution(res.strId.c_str()); -+ -+ DealWithScale(res); - -- return SetDisplayResolution(res.strId.c_str()); -+ return result; - } - - bool CEGLNativeTypeAmlogic::ProbeResolutions(std::vector &resolutions) -@@ -220,6 +224,29 @@ void CEGLNativeTypeAmlogic::SetupVideoScaling(const char *mode) - SysfsUtils::SetInt("/sys/class/graphics/fb0/blank", 0); - } - -+void CEGLNativeTypeAmlogic::DealWithScale(const RESOLUTION_INFO &res) -+{ -+ if (res.iScreenWidth > res.iWidth && res.iScreenHeight > res.iHeight) -+ EnableFreeScale(res); -+ else -+ DisableFreeScale(); -+} -+ -+void CEGLNativeTypeAmlogic::EnableFreeScale(const RESOLUTION_INFO &res) -+{ -+ char fsaxis_str[256] = {0}; -+ sprintf(fsaxis_str, "0 0 %d %d", res.iWidth-1, res.iHeight-1); -+ char waxis_str[256] = {0}; -+ sprintf(waxis_str, "0 0 %d %d", res.iScreenWidth-1, res.iScreenHeight-1); -+ -+ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0); -+ SysfsUtils::SetString("/sys/class/graphics/fb0/free_scale_axis", fsaxis_str); -+ SysfsUtils::SetString("/sys/class/graphics/fb0/window_axis", waxis_str); -+ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_width", res.iWidth); -+ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_height", res.iHeight); -+ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0x10001); -+} -+ - void CEGLNativeTypeAmlogic::DisableFreeScale() - { - // turn off frame buffer freescale -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -index cfb33ca..96aa6f7 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -@@ -53,6 +53,8 @@ public: - protected: - bool SetDisplayResolution(const char *resolution); - void SetupVideoScaling(const char *mode); -+ void DealWithScale(const RESOLUTION_INFO &res); -+ void EnableFreeScale(const RESOLUTION_INFO &res); - void DisableFreeScale(); - - private: --- -1.8.3.1 - diff --git a/packages/mediacenter/kodi/patches/aarch64/kodi-0004-powermanagement-disable-suspend.patch b/packages/mediacenter/kodi/patches/aarch64/kodi-0004-powermanagement-disable-suspend.patch deleted file mode 100644 index 42009e9ce6..0000000000 --- a/packages/mediacenter/kodi/patches/aarch64/kodi-0004-powermanagement-disable-suspend.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -index 4e5bcc6..ad5847d 100644 ---- a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -@@ -53,7 +53,7 @@ CLogindUPowerSyscall::CLogindUPowerSyscall() - m_canPowerdown = LogindCheckCapability("CanPowerOff"); - m_canReboot = LogindCheckCapability("CanReboot"); - m_canHibernate = LogindCheckCapability("CanHibernate"); -- m_canSuspend = LogindCheckCapability("CanSuspend"); -+ m_canSuspend = false; - - InhibitDelayLock(); - diff --git a/packages/mediacenter/kodi/patches/aarch64/kodi-0006-aml-Scale-video-axis-correctly-when-1080p-to-2160p-switching.patch b/packages/mediacenter/kodi/patches/aarch64/kodi-0006-aml-Scale-video-axis-correctly-when-1080p-to-2160p-switching.patch deleted file mode 100644 index 3ebef0635d..0000000000 --- a/packages/mediacenter/kodi/patches/aarch64/kodi-0006-aml-Scale-video-axis-correctly-when-1080p-to-2160p-switching.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 211edfa19b20820772b33f6042992811037a21b3 Mon Sep 17 00:00:00 2001 -From: Jamie Coldhill -Date: Thu, 6 Oct 2016 17:54:40 +0800 -Subject: [PATCH] [aml] Scale video axis correctly when 1080p to 2160p switching - Fixup 720p60hz fallback resolution - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 10 +++++++++- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 1 + - xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 2 +- - 3 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index f9b4138..2a3b413 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -2163,6 +2163,13 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) - update = true; - } - -+ RESOLUTION video_res = g_graphicsContext.GetVideoResolution(); -+ if (m_video_res != video_res) -+ { -+ m_video_res = video_res; -+ update = true; -+ } -+ - if (!update) - { - // mainvideo 'should' be showing already if we get here, make sure. -@@ -2176,7 +2183,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) - #ifdef TARGET_ANDROID - display = m_display_rect; - #else -- display = gui; -+ const RESOLUTION_INFO& video_res_info = CDisplaySettings::GetInstance().GetResolutionInfo(video_res); -+ display = m_display_rect = CRect(0, 0, video_res_info.iScreenWidth, video_res_info.iScreenHeight); - #endif - if (gui != display) - { -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 0eb5c3e..ede815d 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -93,6 +93,7 @@ private: - float m_zoom; - int m_contrast; - int m_brightness; -+ RESOLUTION m_video_res; - - PosixFilePtr m_amlVideoFile; - std::string m_defaultVfmMap; -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -index 88cd385..6d63571 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -@@ -173,7 +173,7 @@ bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const - if (!GetNativeResolution(res)) - { - // punt to 720p if we get nothing -- aml_mode_to_resolution("720p", res); -+ aml_mode_to_resolution("720p60hz", res); - } - - return true; diff --git a/packages/mediacenter/kodi/patches/kodi-100.01-enable-PYTHONOPTIMIZE-with-external-Python.patch b/packages/mediacenter/kodi/patches/kodi-100.01-enable-PYTHONOPTIMIZE-with-external-Python.patch deleted file mode 100644 index 6fbbdf343b..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-100.01-enable-PYTHONOPTIMIZE-with-external-Python.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 26d1905c371dd7e0e23bb589ccf29f2bfec5b8af Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sat, 18 Apr 2015 15:12:49 +0300 -Subject: [PATCH 01/13] enable PYTHONOPTIMIZE with external Python - ---- - xbmc/interfaces/python/XBPython.cpp | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp -index af8d608..6213dbe 100644 ---- a/xbmc/interfaces/python/XBPython.cpp -+++ b/xbmc/interfaces/python/XBPython.cpp -@@ -568,10 +568,9 @@ bool XBPython::OnScriptInitialized(ILanguageInvoker *invoker) - // at http://docs.python.org/using/cmdline.html#environment-variables - - #if !defined(TARGET_WINDOWS) && !defined(TARGET_ANDROID) -- /* PYTHONOPTIMIZE is set off intentionally when using external Python. -- Reason for this is because we cannot be sure what version of Python -- was used to compile the various Python object files (i.e. .pyo, -- .pyc, etc.). */ -+ // Required for python to find optimized code (pyo) files -+ setenv("PYTHONOPTIMIZE", "1", 1); -+ - // check if we are running as real xbmc.app or just binary - if (!CUtil::GetFrameworksPath(true).empty()) - { --- -2.5.0 - diff --git a/packages/mediacenter/kodi/patches/kodi-100.04-use-udevil-to-umount.patch b/packages/mediacenter/kodi/patches/kodi-100.04-use-udevil-to-umount.patch index 659c8e26de..65a5cae41b 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.04-use-udevil-to-umount.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.04-use-udevil-to-umount.patch @@ -1,19 +1,19 @@ -From 13eddbe7c95fb224a39991a288ed1102e0739c44 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Thu, 17 Apr 2014 12:12:50 +0300 -Subject: [PATCH 04/13] use udevil to umount +From 642638622009224d2da9a7633316f422071139a2 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 5 Apr 2018 11:42:13 +0100 +Subject: [PATCH] use udevil to mount --- - xbmc/linux/PosixMountProvider.cpp | 2 +- - xbmc/storage/linux/UDevProvider.cpp | 2 +- + xbmc/platform/linux/PosixMountProvider.cpp | 2 +- + xbmc/platform/linux/storage/UDevProvider.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/xbmc/linux/PosixMountProvider.cpp b/xbmc/linux/PosixMountProvider.cpp -index 218d10b..57e94ca 100644 ---- a/xbmc/linux/PosixMountProvider.cpp -+++ b/xbmc/linux/PosixMountProvider.cpp -@@ -133,7 +133,7 @@ bool CPosixMountProvider::Eject(const std::string& mountpath) - { +diff --git a/xbmc/platform/linux/PosixMountProvider.cpp b/xbmc/platform/linux/PosixMountProvider.cpp +index 6dd1132..a262a7c 100644 +--- a/xbmc/platform/linux/PosixMountProvider.cpp ++++ b/xbmc/platform/linux/PosixMountProvider.cpp +@@ -135,7 +135,7 @@ bool CPosixMountProvider::Eject(const std::string& mountpath) + #if !defined(TARGET_DARWIN_IOS) // just go ahead and try to umount the disk // if it does umount, life is good, if not, no loss. - std::string cmd = "umount \"" + mountpath + "\""; @@ -21,11 +21,11 @@ index 218d10b..57e94ca 100644 int status = system(cmd.c_str()); if (status == 0) -diff --git a/xbmc/storage/linux/UDevProvider.cpp b/xbmc/storage/linux/UDevProvider.cpp -index 0ca370b..dffee34 100644 ---- a/xbmc/storage/linux/UDevProvider.cpp -+++ b/xbmc/storage/linux/UDevProvider.cpp -@@ -207,7 +207,7 @@ bool CUDevProvider::Eject(const std::string& mountpath) +diff --git a/xbmc/platform/linux/storage/UDevProvider.cpp b/xbmc/platform/linux/storage/UDevProvider.cpp +index 4bcebf4..daf0d58 100644 +--- a/xbmc/platform/linux/storage/UDevProvider.cpp ++++ b/xbmc/platform/linux/storage/UDevProvider.cpp +@@ -205,7 +205,7 @@ bool CUDevProvider::Eject(const std::string& mountpath) { // just go ahead and try to umount the disk // if it does umount, life is good, if not, no loss. @@ -35,5 +35,5 @@ index 0ca370b..dffee34 100644 if (status == 0) -- -2.5.0 +2.14.1 diff --git a/packages/mediacenter/kodi/patches/kodi-100.05-make-binary-addons-executable.patch b/packages/mediacenter/kodi/patches/kodi-100.05-make-binary-addons-executable.patch index 0ff7b4b298..ba87a65391 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.05-make-binary-addons-executable.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.05-make-binary-addons-executable.patch @@ -1,7 +1,7 @@ -From 416981e6bbcf81443e3ca8f35ca26042e174c971 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Mon, 2 Mar 2015 23:50:40 +0200 -Subject: [PATCH 05/13] make binary addons executable +From 3e1f7d098726e4af7eac9c83c70cf8196e4e9e3e Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Wed, 5 Jul 2017 15:46:51 +0100 +Subject: [PATCH] make binary addons executable add executable mode to all files in addon's bin folder @@ -11,24 +11,24 @@ credits to vpeter4 for the patch 1 file changed, 26 insertions(+) diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp -index 77c2db8..6c21c87 100644 +index 07fd5bf..639ee5c 100644 --- a/xbmc/addons/Addon.cpp +++ b/xbmc/addons/Addon.cpp -@@ -46,6 +46,10 @@ - #include - #include +@@ -26,6 +26,10 @@ + #include + #include +#include +#include +#include + - using XFILE::CDirectory; - using XFILE::CFile; - -@@ -694,6 +698,28 @@ void OnPostInstall(const AddonPtr& addon, bool update, bool modal) - if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_REPOSITORY)) - CRepositoryUpdater::GetInstance().ScheduleUpdate(); //notify updater there is a new addon or version + #include "AddonManager.h" + #include "addons/Service.h" + #include "filesystem/Directory.h" +@@ -417,6 +421,28 @@ void OnPreInstall(const AddonPtr& addon) + void OnPostInstall(const AddonPtr& addon, bool update, bool modal) + { + // OE: make binary addons executable, creddits to vpeter4 + std::string addonDirPath; + std::string chmodFilePath; @@ -55,5 +55,5 @@ index 77c2db8..6c21c87 100644 } -- -2.5.0 +2.7.4 diff --git a/packages/mediacenter/kodi/patches/kodi-100.07-disable-minimize.patch b/packages/mediacenter/kodi/patches/kodi-100.07-disable-minimize.patch index 9c140bbed4..ec5c69fcdf 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.07-disable-minimize.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.07-disable-minimize.patch @@ -15,7 +15,7 @@ index 95ae98c..9aca1e3 100644 void CApplication::Minimize() { -- g_Windowing.Minimize(); +- CServiceBroker::GetWinSystem()->Minimize(); } PLAYERCOREID CApplication::GetCurrentPlayer() diff --git a/packages/mediacenter/kodi/patches/kodi-100.08-setup-timezone.patch b/packages/mediacenter/kodi/patches/kodi-100.08-setup-timezone.patch index f62ce2c9bc..1107019676 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.08-setup-timezone.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.08-setup-timezone.patch @@ -1,45 +1,45 @@ -From 867d7535140dcf7b987ce86c3947c2ec5f5c7bd4 Mon Sep 17 00:00:00 2001 +From ac5906ee4bc7b59f48457b01a318139ab15f6c8d Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Mon, 18 Aug 2014 17:46:54 +0300 -Subject: [PATCH 08/13] setup timezone +Subject: [PATCH] setup timezone on TZ country setting change, store the value in format TIMEZONE=Xx/Yyy to /storage/.cache/timezone to be used with tz-data.service --- - xbmc/linux/LinuxTimezone.cpp | 12 ++++++++++++ + xbmc/platform/linux/LinuxTimezone.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) -diff --git a/xbmc/linux/LinuxTimezone.cpp b/xbmc/linux/LinuxTimezone.cpp -index 7de8f8c..e278c6a 100644 ---- a/xbmc/linux/LinuxTimezone.cpp -+++ b/xbmc/linux/LinuxTimezone.cpp -@@ -42,6 +42,8 @@ +diff --git a/xbmc/platform/linux/LinuxTimezone.cpp b/xbmc/platform/linux/LinuxTimezone.cpp +index fae9276..2c24542 100644 +--- a/xbmc/platform/linux/LinuxTimezone.cpp ++++ b/xbmc/platform/linux/LinuxTimezone.cpp +@@ -36,6 +36,8 @@ #include +#include + - CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) + CLinuxTimezone::CLinuxTimezone() { char* line = NULL; -@@ -159,6 +161,16 @@ void CLinuxTimezone::OnSettingChanged(const CSetting *setting) +@@ -153,6 +155,16 @@ void CLinuxTimezone::OnSettingChanged(std::shared_ptr setting) const std::string &settingId = setting->GetId(); if (settingId == CSettings::SETTING_LOCALE_TIMEZONE) { + std::ofstream out("/storage/.cache/timezone"); + if (out) + { -+ const std::string tz = std::string("TIMEZONE=") + ((CSettingString*)setting)->GetValue().c_str(); ++ const std::string tz = std::string("TIMEZONE=") + (std::static_pointer_cast(setting)->GetValue().c_str()); + out << tz << std::endl; + out.flush(); + out.close(); + system("systemctl restart tz-data.service"); + } + - SetTimezone(((CSettingString*)setting)->GetValue()); + SetTimezone(std::static_pointer_cast(setting)->GetValue()); CDateTime::ResetTimezoneBias(); -- -2.5.0 +2.14.1 diff --git a/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-service-addons.patch b/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-service-addons.patch new file mode 100644 index 0000000000..40700f85b2 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-service-addons.patch @@ -0,0 +1,101 @@ +diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp +index 8343101b96..8130d99b83 100644 +--- a/xbmc/addons/Addon.cpp ++++ b/xbmc/addons/Addon.cpp +@@ -397,6 +397,37 @@ AddonVersion CAddon::GetDependencyVersion(const std::string &dependencyID) const + return AddonVersion("0.0.0"); + } + ++void LEAddonHook(const AddonPtr& addon, const LE_ADDON_CONTEXT context) { ++ ++ if (addon->Type() == ADDON_SERVICE) { ++ std::string contextStr; ++ char cmd[255]; ++ ++ switch (context) { ++ case LE_ADDON_ENABLED: ++ contextStr = "enable"; ++ break; ++ case LE_ADDON_DISABLED: ++ contextStr = "disable"; ++ break; ++ case LE_ADDON_POST_UPDATE: ++ contextStr = "post-update"; ++ break; ++ case LE_ADDON_PRE_UNINSTALL: ++ contextStr = "pre-uninstall"; ++ break; ++ default: ++ contextStr = StringUtils::Format("unknown(%d)", context); ++ break; ++ } ++ ++ snprintf(cmd, sizeof(cmd), "/usr/sbin/service-addon-wrapper %s %s %s", ++ contextStr.c_str(), addon->ID().c_str(), addon->Path().c_str()); ++ ++ system(cmd); ++ } ++} ++ + void OnPreInstall(const AddonPtr& addon) + { + //Fallback to the pre-install callback in the addon. +@@ -426,6 +457,9 @@ void OnPostInstall(const AddonPtr& addon, bool update, bool modal) + } + closedir(addonsDir); + } ++ ++ if (update) ++ LEAddonHook(addon, LE_ADDON_POST_UPDATE); + // OE + + addon->OnPostInstall(update, modal); +@@ -433,6 +466,8 @@ void OnPostInstall(const AddonPtr& addon, bool update, bool modal) + + void OnPreUnInstall(const AddonPtr& addon) + { ++ LEAddonHook(addon, LE_ADDON_PRE_UNINSTALL); ++ + addon->OnPreUnInstall(); + } + +diff --git a/xbmc/addons/Addon.h b/xbmc/addons/Addon.h +index b877839848..f7c0b717f6 100644 +--- a/xbmc/addons/Addon.h ++++ b/xbmc/addons/Addon.h +@@ -41,6 +41,15 @@ namespace ADDON + void OnPreUnInstall(const AddonPtr& addon); + void OnPostUnInstall(const AddonPtr& addon); + ++typedef enum { ++ LE_ADDON_ENABLED, ++ LE_ADDON_DISABLED, ++ LE_ADDON_POST_UPDATE, ++ LE_ADDON_PRE_UNINSTALL, ++} LE_ADDON_CONTEXT; ++ ++void LEAddonHook(const AddonPtr& addon, const LE_ADDON_CONTEXT context); ++ + class CAddon : public IAddon + { + public: +diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp +index e015f0755e..92879f19c1 100644 +--- a/xbmc/addons/AddonManager.cpp ++++ b/xbmc/addons/AddonManager.cpp +@@ -836,6 +836,7 @@ bool CAddonMgr::DisableAddon(const std::string& id) + AddonPtr addon; + if (GetAddon(id, addon, ADDON_UNKNOWN, false) && addon != NULL) + { ++ ADDON::LEAddonHook(addon, ADDON::LE_ADDON_DISABLED); + CServiceBroker::GetEventLog().Add(EventPtr(new CAddonManagementEvent(addon, 24141))); + } + +@@ -864,6 +865,7 @@ bool CAddonMgr::EnableSingle(const std::string& id) + if (!m_database.DisableAddon(id, false)) + return false; + m_disabled.erase(id); ++ ADDON::LEAddonHook(addon, ADDON::LE_ADDON_ENABLED); + + CServiceBroker::GetEventLog().Add(EventPtr(new CAddonManagementEvent(addon, 24064))); + diff --git a/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch b/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch deleted file mode 100644 index db7e1c1695..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-100.09-use-a-wrapper-to-setup-systemd-services.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp -index 476ab29..ec5faa5 100644 ---- a/xbmc/addons/Addon.cpp -+++ b/xbmc/addons/Addon.cpp -@@ -340,6 +340,13 @@ AddonVersion CAddon::GetDependencyVersion(const std::string &dependencyID) const - return AddonVersion("0.0.0"); - } - -+void CallOEWrapper(const std::string& ID, bool disable) -+{ -+ char cmd[255]; -+ snprintf(cmd, sizeof(cmd), "/usr/lib/libreelec/systemd-addon-wrapper %s %d", ID.c_str(), disable); -+ system(cmd); -+} -+ - void OnEnabled(const std::string& id) - { - // If the addon is a special, call enabled handler -@@ -348,6 +355,11 @@ void OnEnabled(const std::string& id) - CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_ADSPDLL)) - return addon->OnEnabled(); - -+ // OE: systemctl enable & start on addon enable -+ if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_SERVICE)) -+ CallOEWrapper(addon->ID(), false); -+ // OE -+ - if (CAddonMgr::GetInstance().ServicesHasStarted()) - { - if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_SERVICE)) -@@ -372,6 +384,11 @@ void OnDisabled(const std::string& id) - std::static_pointer_cast(addon)->Stop(); - } - -+ // OE: systemctl stop & disable on addon disable -+ if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_SERVICE, false)) -+ CallOEWrapper(addon->ID(), true); -+ // OE -+ - if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_CONTEXT_ITEM, false)) - CContextMenuManager::GetInstance().Unload(*std::static_pointer_cast(addon)); - } -@@ -399,6 +416,15 @@ void OnPreInstall(const AddonPtr& addon) - void OnPostInstall(const AddonPtr& addon, bool update, bool modal) - { - AddonPtr localAddon; -+ -+ // OE: systemctl stop & disable / enable & start on addon upgrade -+ if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_SERVICE)) -+ { -+ CallOEWrapper(addon->ID(), true); -+ CallOEWrapper(addon->ID(), false); -+ } -+ // OE -+ - if (CAddonMgr::GetInstance().ServicesHasStarted()) - { - if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_SERVICE)) -@@ -415,6 +441,11 @@ void OnPreUnInstall(const AddonPtr& addon) - { - AddonPtr localAddon; - -+ // OE: systemctl stop & disable on addon uninstall -+ if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_SERVICE)) -+ CallOEWrapper(addon->ID(), true); -+ // OE -+ - if (CAddonMgr::GetInstance().ServicesHasStarted()) - { - if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_SERVICE)) -diff --git a/xbmc/addons/Addon.h b/xbmc/addons/Addon.h -index 515afe1..36287d6 100644 ---- a/xbmc/addons/Addon.h -+++ b/xbmc/addons/Addon.h -@@ -121,6 +121,8 @@ public: - const InfoMap& ExtraInfo() const override { return m_props.extrainfo; } - const ADDONDEPS& GetDeps() const override { return m_props.dependencies; } - -+ void CallOEWrapper(const std::string& ID, bool disable); -+ - /*! \brief Check whether the this addon can be configured or not - \return true if the addon has settings, false otherwise - \sa LoadSettings, LoadUserSettings, SaveSettings, HasUserSettings, GetSetting, UpdateSetting diff --git a/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch b/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch index ce4f6298a4..3c30b8e201 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.10-handle-SIGTERM.patch @@ -1,7 +1,7 @@ -From 66fa8d82238e001dc81b0a266e323c6a2f8b11b2 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Mon, 15 Dec 2014 21:28:54 +0200 -Subject: [PATCH 10/13] handle SIGTERM +From ab5679fefbf2190008ba6c815e91f5c24820614e Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Mon, 27 Aug 2018 17:48:05 +0100 +Subject: [PATCH] handle SIGTERM 0. CApplication::Stop cant be trusted. (deadlocks crashes and boo) @@ -15,39 +15,39 @@ so, when shutdown/reboot is requested: 6. addons / pvrmanager / cec / everything else.. are free to deadlock / crash now, we dont care 7. KILL --- - xbmc/Application.cpp | 17 ++++++++++++----- - xbmc/Application.h | 1 + - xbmc/XBApplicationEx.cpp | 1 + - xbmc/XBApplicationEx.h | 1 + - xbmc/main/main.cpp | 15 +++++++++++++++ - 5 files changed, 30 insertions(+), 5 deletions(-) + xbmc/Application.cpp | 21 ++++++++++++++++----- + xbmc/Application.h | 1 + + xbmc/XBApplicationEx.cpp | 1 + + xbmc/XBApplicationEx.h | 1 + + xbmc/platform/posix/main.cpp | 2 +- + 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 1c906a2..99ca567 100644 +index f39a94e..80bcecb 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2490,12 +2490,12 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) - switch (pMsg->dwMessage) +@@ -2286,12 +2286,12 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) + switch (msg) { case TMSG_POWERDOWN: - Stop(EXITCODE_POWERDOWN); + SetExitCode(EXITCODE_POWERDOWN); - g_powerManager.Powerdown(); + CServiceBroker::GetPowerManager().Powerdown(); break; case TMSG_QUIT: - Stop(EXITCODE_QUIT); + SetExitCode(EXITCODE_QUIT); break; - + case TMSG_SHUTDOWN: -@@ -2539,12 +2539,13 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) +@@ -2312,12 +2312,13 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) case TMSG_RESTART: case TMSG_RESET: - Stop(EXITCODE_REBOOT); + SetExitCode(EXITCODE_REBOOT); - g_powerManager.Reboot(); + CServiceBroker::GetPowerManager().Reboot(); break; case TMSG_RESTARTAPP: @@ -56,54 +56,58 @@ index 1c906a2..99ca567 100644 Stop(EXITCODE_RESTARTAPP); #endif break; -@@ -2890,14 +2891,21 @@ bool CApplication::Cleanup() +@@ -2764,6 +2765,17 @@ bool CApplication::Cleanup() } } +void CApplication::SetExitCode(int exitCode) +{ -+ // save it for CEC -+ m_ExitCode = exitCode; -+ m_ExitCodeSet = true; ++ if (!m_ExitCodeSet) ++ { ++ CLog::Log(LOGINFO, "Saving exitCode %d", exitCode); ++ // save it for CEC ++ m_ExitCode = exitCode; ++ m_ExitCodeSet = true; ++ } +} + void CApplication::Stop(int exitCode) { - try - { + CLog::Log(LOGNOTICE, "stop player"); +@@ -2790,7 +2802,7 @@ void CApplication::Stop(int exitCode) m_frameMoveGuard.unlock(); - + CVariant vExitCode(CVariant::VariantTypeObject); - vExitCode["exitcode"] = exitCode; + vExitCode["exitcode"] = m_ExitCode; - CAnnouncementManager::GetInstance().Announce(System, "xbmc", "OnQuit", vExitCode); + CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::System, "xbmc", "OnQuit", vExitCode); // Abort any active screensaver -@@ -2922,7 +2930,6 @@ void CApplication::Stop(int exitCode) - - m_bStop = true; +@@ -2822,7 +2834,6 @@ void CApplication::Stop(int exitCode) + // Needs cleaning up + CApplicationMessenger::GetInstance().Stop(); m_AppFocused = false; - m_ExitCode = exitCode; CLog::Log(LOGNOTICE, "stop all"); // cancel any jobs from the jobmanager diff --git a/xbmc/Application.h b/xbmc/Application.h -index f1dfe0d..200abee 100644 +index 1faf9dd..379d3ca 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -154,6 +154,7 @@ public: - void StartPVRManager(); - void StopPVRManager(); + bool StartServer(enum ESERVERS eServer, bool bStart, bool bWait = false); + bool IsCurrentThread() const; + void SetExitCode(int exitCode); void Stop(int exitCode); - void RestartApp(); void UnloadSkin(bool forReload = false); + bool LoadCustomWindows(); diff --git a/xbmc/XBApplicationEx.cpp b/xbmc/XBApplicationEx.cpp -index 048a6c1..fa99ac1 100644 +index 9255271..da788b2 100644 --- a/xbmc/XBApplicationEx.cpp +++ b/xbmc/XBApplicationEx.cpp -@@ -40,6 +40,7 @@ CXBApplicationEx::CXBApplicationEx() +@@ -24,6 +24,7 @@ CXBApplicationEx::CXBApplicationEx() m_bStop = false; m_AppFocused = true; m_ExitCode = EXITCODE_QUIT; @@ -112,10 +116,10 @@ index 048a6c1..fa99ac1 100644 } diff --git a/xbmc/XBApplicationEx.h b/xbmc/XBApplicationEx.h -index c46cba1..ed3f35f 100644 +index e7534b8..8f45f04 100644 --- a/xbmc/XBApplicationEx.h +++ b/xbmc/XBApplicationEx.h -@@ -40,6 +40,7 @@ public: +@@ -29,6 +29,7 @@ public: // Variables for timing bool m_bStop; int m_ExitCode; @@ -124,37 +128,18 @@ index c46cba1..ed3f35f 100644 bool m_renderGUI; diff --git a/xbmc/platform/posix/main.cpp b/xbmc/platform/posix/main.cpp -index 01027f8..4cfb04e 100644 +index 55840fd..2828c7f 100644 --- a/xbmc/platform/posix/main.cpp +++ b/xbmc/platform/posix/main.cpp -@@ -41,12 +41,27 @@ - #include "input/linux/LIRC.h" - #endif - #include "platform/XbmcContext.h" -+#include "Application.h" -+ -+void xbmc_term_handler(int signum) -+{ -+ CLog::Log(LOGINFO, "Received SIGTERM..."); -+ if (!g_application.m_ExitCodeSet) -+ g_application.SetExitCode(EXITCODE_RESTARTAPP); -+ g_application.Stop(EXITCODE_RESTARTAPP); -+} - - #ifdef __cplusplus - extern "C" - #endif - int main(int argc, char* argv[]) - { -+ // SIGTERM handler -+ struct sigaction action; -+ memset(&action, 0, sizeof(struct sigaction)); -+ action.sa_handler = xbmc_term_handler; -+ sigaction(SIGTERM, &action, NULL); -+ - // set up some xbmc specific relationships - XBMC::Context context; +@@ -47,7 +47,7 @@ protected: + void Process() override + { + CMessagePrinter::DisplayMessage("Exiting application"); +- KODI::MESSAGING::CApplicationMessenger::GetInstance().PostMsg(TMSG_QUIT); ++ KODI::MESSAGING::CApplicationMessenger::GetInstance().PostMsg(TMSG_RESTARTAPP); + } + }; -- -2.5.0 +2.14.1 diff --git a/packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch b/packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch deleted file mode 100644 index bec2769ce6..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 993c50a689feee190557a98a34f76683cf46c589 Mon Sep 17 00:00:00 2001 -From: Stephan Raue -Date: Mon, 1 Sep 2014 03:16:37 +0200 -Subject: [PATCH 11/13] add support to read frequency output if using intel's - pstate driver - ---- - xbmc/utils/CPUInfo.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp -index 9e709e7..9b5279f 100644 ---- a/xbmc/utils/CPUInfo.cpp -+++ b/xbmc/utils/CPUInfo.cpp -@@ -271,6 +271,8 @@ CCPUInfo::CCPUInfo(void) - m_fProcTemperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); // On Raspberry PIs - - m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); -+ if (m_fCPUFreq == NULL) -+ m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq", "r"); - if (!m_fCPUFreq) - { - m_cpuInfoForFreq = true; --- -2.5.0 - diff --git a/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch b/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch index d11e02ded8..8c6cba3e7a 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.12-prevent-kodi-switching-to-windowed-mode.patch @@ -1,24 +1,24 @@ -From 84b516ffd5fbf0f7a53c30590dd412aeb4600481 Mon Sep 17 00:00:00 2001 +From a2a5ae054768afe9906bbd7ea96d4eb69bf1b857 Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Sat, 18 Apr 2015 15:45:54 +0300 -Subject: [PATCH 12/13] prevent kodi switching to windowed mode +Subject: [PATCH] prevent kodi switching to windowed mode --- xbmc/windowing/X11/WinSystemX11.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h -index 5ac2482..cb84940 100644 +index 6f8d443..3739b92 100644 --- a/xbmc/windowing/X11/WinSystemX11.h +++ b/xbmc/windowing/X11/WinSystemX11.h -@@ -54,6 +54,7 @@ public: - bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override; +@@ -49,6 +49,7 @@ public: + void FinishWindowResize(int newWidth, int newHeight) override; bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override; void UpdateResolutions() override; + bool CanDoWindowed() override { return false; } - int GetNumScreens() override { return 1; } - int GetCurrentScreen() override { return m_nScreen; } void ShowOSMouse(bool show) override; + + void NotifyAppActiveChange(bool bActivated) override; -- -2.5.0 +2.14.1 diff --git a/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch b/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch index 986e281bbf..1c23cf5c72 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.13-udevprovider-filter-out-OE-specific-mounts.patch @@ -1,17 +1,17 @@ -From 62d1013382c328c8af9aeb598a253c4699accf8d Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sun, 26 Apr 2015 15:13:15 +0300 -Subject: [PATCH 13/13] udevprovider: filter out OE specific mounts +From ba4c814c7ff26ff821ea362632fd6bb47bf93066 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 5 Apr 2018 11:42:48 +0100 +Subject: [PATCH] udevprovider: filter out OE specific mounts --- - xbmc/storage/linux/UDevProvider.cpp | 14 ++++++++++++++ + xbmc/platform/linux/storage/UDevProvider.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -diff --git a/xbmc/storage/linux/UDevProvider.cpp b/xbmc/storage/linux/UDevProvider.cpp -index dffee34..b7cd25b 100644 ---- a/xbmc/storage/linux/UDevProvider.cpp -+++ b/xbmc/storage/linux/UDevProvider.cpp -@@ -152,6 +152,20 @@ void CUDevProvider::GetDisks(VECSOURCES& disks, bool removable) +diff --git a/xbmc/platform/linux/storage/UDevProvider.cpp b/xbmc/platform/linux/storage/UDevProvider.cpp +index daf0d58..31e574f 100644 +--- a/xbmc/platform/linux/storage/UDevProvider.cpp ++++ b/xbmc/platform/linux/storage/UDevProvider.cpp +@@ -150,6 +150,20 @@ void CUDevProvider::GetDisks(VECSOURCES& disks, bool removable) continue; } @@ -33,5 +33,5 @@ index dffee34..b7cd25b 100644 const char *bus = udev_device_get_property_value(device, "ID_BUS"); const char *optical = udev_device_get_property_value(device, "ID_CDROM"); // matches also DVD, Blu-ray -- -2.5.0 +2.14.1 diff --git a/packages/mediacenter/kodi/patches/kodi-100.14-use-alsa-and-pulse-together.patch b/packages/mediacenter/kodi/patches/kodi-100.14-use-alsa-and-pulse-together.patch index cc9a5cd2b0..93ddb912f4 100644 --- a/packages/mediacenter/kodi/patches/kodi-100.14-use-alsa-and-pulse-together.patch +++ b/packages/mediacenter/kodi/patches/kodi-100.14-use-alsa-and-pulse-together.patch @@ -1,79 +1,162 @@ -diff -Naur a/xbmc/cores/AudioEngine/AESinkFactory.cpp b/xbmc/cores/AudioEngine/AESinkFactory.cpp ---- a/xbmc/cores/AudioEngine/AESinkFactory.cpp 2016-01-12 22:00:19.000000000 +0100 -+++ b/xbmc/cores/AudioEngine/AESinkFactory.cpp 2016-01-25 10:25:46.375653966 +0100 -@@ -28,6 +28,9 @@ - #elif defined(TARGET_RASPBERRY_PI) - #include "Sinks/AESinkPi.h" - #include "Sinks/AESinkALSA.h" -+ #if defined(HAS_PULSEAUDIO) -+ #include "Sinks/AESinkPULSE.h" -+ #endif - #elif defined(TARGET_DARWIN_IOS) - #include "Sinks/AESinkDARWINIOS.h" - #elif defined(TARGET_DARWIN_OSX) -@@ -67,6 +70,9 @@ - #elif defined(TARGET_RASPBERRY_PI) - driver == "PI" || - driver == "ALSA" || -+ #if defined(HAS_PULSEAUDIO) -+ driver == "PULSE" || -+ #endif - #elif defined(TARGET_DARWIN_IOS) - driver == "DARWINIOS" || - #elif defined(TARGET_DARWIN_OSX) -@@ -108,6 +114,10 @@ - #elif defined(TARGET_RASPBERRY_PI) - if (driver == "PI") - sink = new CAESinkPi(); -+ #if defined(HAS_PULSEAUDIO) -+ if (driver == "PULSE") -+ sink = new CAESinkPULSE(); -+ #endif - #if defined(HAS_ALSA) - if (driver == "ALSA") - sink = new CAESinkALSA(); -@@ -209,6 +219,16 @@ - if(!info.m_deviceInfoList.empty()) - list.push_back(info); - #endif -+ #if defined(HAS_PULSEAUDIO) -+ info.m_deviceInfoList.clear(); -+ info.m_sinkName = "PULSE"; -+ CAESinkPULSE::EnumerateDevicesEx(info.m_deviceInfoList, force); -+ if(!info.m_deviceInfoList.empty()) -+ { -+ list.push_back(info); -+ return; -+ } -+ #endif - #elif defined(TARGET_DARWIN_IOS) +From 0bb21ebfe5f26545ccc9f105560c6c0fcbce77b3 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Wed, 26 Sep 2018 02:47:03 +0100 +Subject: [PATCH] allow using alsa and pulse together + +--- + xbmc/windowing/X11/WinSystemX11GLContext.cpp | 35 ++-------------------------- + xbmc/windowing/amlogic/WinSystemAmlogic.cpp | 2 ++ + xbmc/windowing/gbm/WinSystemGbm.cpp | 34 ++------------------------- + xbmc/windowing/rpi/WinSystemRpi.cpp | 17 ++++---------- + 4 files changed, 10 insertions(+), 78 deletions(-) + +diff --git a/xbmc/windowing/X11/WinSystemX11GLContext.cpp b/xbmc/windowing/X11/WinSystemX11GLContext.cpp +index 1980916..2524716 100644 +--- a/xbmc/windowing/X11/WinSystemX11GLContext.cpp ++++ b/xbmc/windowing/X11/WinSystemX11GLContext.cpp +@@ -40,39 +40,8 @@ std::unique_ptr CWinSystemBase::CreateWinSystem() - info.m_deviceInfoList.clear(); -@@ -253,21 +273,20 @@ - CLog::Log(LOGNOTICE, "User specified Sink %s could not be enumerated", envSink.c_str()); - } + CWinSystemX11GLContext::CWinSystemX11GLContext() + { +- std::string envSink; +- if (getenv("KODI_AE_SINK")) +- envSink = getenv("KODI_AE_SINK"); +- if (StringUtils::EqualsNoCase(envSink, "ALSA")) +- { +- OPTIONALS::ALSARegister(); +- } +- else if (StringUtils::EqualsNoCase(envSink, "PULSE")) +- { +- OPTIONALS::PulseAudioRegister(); +- } +- else if (StringUtils::EqualsNoCase(envSink, "OSS")) +- { +- OPTIONALS::OSSRegister(); +- } +- else if (StringUtils::EqualsNoCase(envSink, "SNDIO")) +- { +- OPTIONALS::SndioRegister(); +- } +- else +- { +- if (!OPTIONALS::PulseAudioRegister()) +- { +- if (!OPTIONALS::ALSARegister()) +- { +- if (!OPTIONALS::SndioRegister()) +- { +- OPTIONALS::OSSRegister(); +- } +- } +- } +- } +- ++ OPTIONALS::ALSARegister(); ++ OPTIONALS::PulseAudioRegister(); + m_lirc.reset(OPTIONALS::LircRegister()); + } -- #if defined(HAS_PULSEAUDIO) -+ #if defined(HAS_ALSA) - info.m_deviceInfoList.clear(); -- info.m_sinkName = "PULSE"; -- CAESinkPULSE::EnumerateDevicesEx(info.m_deviceInfoList, force); -+ info.m_sinkName = "ALSA"; -+ CAESinkALSA::EnumerateDevicesEx(info.m_deviceInfoList, force); - if(!info.m_deviceInfoList.empty()) - { - list.push_back(info); -- return; - } - #endif +diff --git a/xbmc/windowing/amlogic/WinSystemAmlogic.cpp b/xbmc/windowing/amlogic/WinSystemAmlogic.cpp +index 9df83a6..5d41c1f 100644 +--- a/xbmc/windowing/amlogic/WinSystemAmlogic.cpp ++++ b/xbmc/windowing/amlogic/WinSystemAmlogic.cpp +@@ -20,6 +20,7 @@ + // AESink Factory + #include "cores/AudioEngine/AESinkFactory.h" + #include "cores/AudioEngine/Sinks/AESinkALSA.h" ++#include "cores/AudioEngine/Sinks/AESinkPULSE.h" + #include "windowing/GraphicContext.h" + #include "windowing/Resolution.h" + #include "platform/linux/powermanagement/LinuxPowerSyscall.h" +@@ -66,6 +67,7 @@ CWinSystemAmlogic::CWinSystemAmlogic() : + // Register sink + AE::CAESinkFactory::ClearSinks(); + CAESinkALSA::Register(); ++ CAESinkPULSE::Register(); + CLinuxPowerSyscall::Register(); + m_lirc.reset(OPTIONALS::LircRegister()); + m_libinput->Start(); +diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp +index 12f2da6..c2bdd0e 100644 +--- a/xbmc/windowing/gbm/WinSystemGbm.cpp ++++ b/xbmc/windowing/gbm/WinSystemGbm.cpp +@@ -31,38 +31,8 @@ CWinSystemGbm::CWinSystemGbm() : + m_GBM(new CGBMUtils), + m_libinput(new CLibInputHandler) + { +- std::string envSink; +- if (getenv("KODI_AE_SINK")) +- envSink = getenv("KODI_AE_SINK"); +- if (StringUtils::EqualsNoCase(envSink, "ALSA")) +- { +- OPTIONALS::ALSARegister(); +- } +- else if (StringUtils::EqualsNoCase(envSink, "PULSE")) +- { +- OPTIONALS::PulseAudioRegister(); +- } +- else if (StringUtils::EqualsNoCase(envSink, "OSS")) +- { +- OPTIONALS::OSSRegister(); +- } +- else if (StringUtils::EqualsNoCase(envSink, "SNDIO")) +- { +- OPTIONALS::SndioRegister(); +- } +- else +- { +- if (!OPTIONALS::PulseAudioRegister()) +- { +- if (!OPTIONALS::ALSARegister()) +- { +- if (!OPTIONALS::SndioRegister()) +- { +- OPTIONALS::OSSRegister(); +- } +- } +- } +- } ++ OPTIONALS::ALSARegister(); ++ OPTIONALS::PulseAudioRegister(); -- #if defined(HAS_ALSA) -+ #if defined(HAS_PULSEAUDIO) - info.m_deviceInfoList.clear(); -- info.m_sinkName = "ALSA"; -- CAESinkALSA::EnumerateDevicesEx(info.m_deviceInfoList, force); -+ info.m_sinkName = "PULSE"; -+ CAESinkPULSE::EnumerateDevicesEx(info.m_deviceInfoList, force); - if(!info.m_deviceInfoList.empty()) - { - list.push_back(info); + CLinuxPowerSyscall::Register(); + m_lirc.reset(OPTIONALS::LircRegister()); +diff --git a/xbmc/windowing/rpi/WinSystemRpi.cpp b/xbmc/windowing/rpi/WinSystemRpi.cpp +index a403464..6a68d9f 100644 +--- a/xbmc/windowing/rpi/WinSystemRpi.cpp ++++ b/xbmc/windowing/rpi/WinSystemRpi.cpp +@@ -21,7 +21,9 @@ + #include "guilib/DispResource.h" + #include "utils/log.h" + #include "cores/AudioEngine/AESinkFactory.h" ++#include "cores/AudioEngine/Sinks/AESinkALSA.h" + #include "cores/AudioEngine/Sinks/AESinkPi.h" ++#include "cores/AudioEngine/Sinks/AESinkPULSE.h" + #include "platform/linux/powermanagement/LinuxPowerSyscall.h" + + #include +@@ -44,19 +46,8 @@ CWinSystemRpi::CWinSystemRpi() : + AE::CAESinkFactory::ClearSinks(); + + CAESinkPi::Register(); +- std::string envSink; +- if (getenv("KODI_AE_SINK")) +- envSink = getenv("KODI_AE_SINK"); +- +- if (StringUtils::EqualsNoCase(envSink, "PULSE")) +- { +- OPTIONALS::PulseAudioRegister(); +- } +- else +- { +- OPTIONALS::ALSARegister(); +- } +- ++ CAESinkALSA::Register(); ++ CAESinkPULSE::Register(); + CLinuxPowerSyscall::Register(); + m_lirc.reset(OPTIONALS::LircRegister()); + m_libinput->Start(); +-- +2.14.1 + diff --git a/packages/mediacenter/kodi/patches/kodi-100.16-remove-sysinfo-battery.patch b/packages/mediacenter/kodi/patches/kodi-100.16-remove-sysinfo-battery.patch new file mode 100644 index 0000000000..cd4d881ee9 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-100.16-remove-sysinfo-battery.patch @@ -0,0 +1,10 @@ +--- a/xbmc/windows/GUIWindowSystemInfo.cpp 2013-02-21 22:09:04.765734381 +0400 ++++ b/xbmc/windows/GUIWindowSystemInfo.cpp 2013-02-22 16:12:57.942164800 +0400 +@@ -100,7 +100,6 @@ + #endif + SetControlLabel(i++, "%s: %s", 12390, SYSTEM_UPTIME); + SetControlLabel(i++, "%s: %s", 12394, SYSTEM_TOTALUPTIME); +- SetControlLabel(i++, "%s: %s", 12395, SYSTEM_BATTERY_LEVEL); + } + else if (m_section == CONTROL_BT_STORAGE) + { diff --git a/packages/mediacenter/kodi/patches/kodi-100.22-allow-static-smbclient-linking.patch b/packages/mediacenter/kodi/patches/kodi-100.22-allow-static-smbclient-linking.patch deleted file mode 100644 index 44b9d5864c..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-100.22-allow-static-smbclient-linking.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/project/cmake/modules/FindSmbClient.cmake b/project/cmake/modules/FindSmbClient.cmake -index 6455cce..379d79c 100644 ---- a/project/cmake/modules/FindSmbClient.cmake -+++ b/project/cmake/modules/FindSmbClient.cmake -@@ -14,7 +14,7 @@ - # - # SmbClient::SmbClient - The SmbClient library - --if(PKGCONFIG_FOUND) -+if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_SMBCLIENT smbclient QUIET) - endif() - -@@ -31,7 +31,19 @@ find_package_handle_standard_args(SmbClient - VERSION_VAR SMBCLIENT_VERSION) - - if(SMBCLIENT_FOUND) -- set(SMBCLIENT_LIBRARIES ${SMBCLIENT_LIBRARY}) -+ # check if smbclient libs are statically linked -+ set(SMBCLIENT_LIB_TYPE SHARED) -+ if(PC_SMBCLIENT_STATIC_LDFLAGS) -+ set(SMBCLIENT_LDFLAGS ${PC_SMBCLIENT_STATIC_LDFLAGS} CACHE STRING "smbclient linker flags" FORCE) -+ set(SMBCLIENT_LIB_TYPE STATIC) -+ find_library(TALLOC_LIBRARY talloc) -+ find_library(TDB_LIBRARY tdb) -+ find_library(TEVENT_LIBRARY tevent) -+ find_library(WBCLIENT_LIBRARY wbclient) -+ find_library(RESOLV_LIBRARY resolv) -+ set(SMBCLIENT_LIBRARIES ${SMBCLIENT_LIBRARY} ${TALLOC_LIBRARY} ${TDB_LIBRARY} ${TEVENT_LIBRARY} ${WBCLIENT_LIBRARY} ${RESOLV_LIBRARY}) -+ endif() -+ - set(SMBCLIENT_INCLUDE_DIRS ${SMBCLIENT_INCLUDE_DIR}) - set(SMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) - diff --git a/packages/mediacenter/kodi/patches/kodi-100.25-hack-fix-texture-packer-cmake-source-dir.patch b/packages/mediacenter/kodi/patches/kodi-100.25-hack-fix-texture-packer-cmake-source-dir.patch new file mode 100644 index 0000000000..427dea975a --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-100.25-hack-fix-texture-packer-cmake-source-dir.patch @@ -0,0 +1,9 @@ +diff -Naur a/tools/depends/native/TexturePacker/CMakeLists.txt b/tools/depends/native/TexturePacker/CMakeLists.txt +--- a/tools/depends/native/TexturePacker/CMakeLists.txt 2016-12-23 17:10:28.593185862 +0000 ++++ b/tools/depends/native/TexturePacker/CMakeLists.txt 2016-12-23 17:10:39.469253011 +0000 +@@ -1,3 +1,5 @@ ++set(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../../../..) ++ + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) + + if(APPLE) diff --git a/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch b/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch index b3c0376564..fd9916185b 100644 --- a/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch +++ b/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch @@ -1,15 +1,8 @@ -diff -Naur kodi-15.0-2f34a0c/system/Lircmap.xml kodi-15.0-2f34a0c.patch/system/Lircmap.xml ---- kodi-15.0-2f34a0c/system/Lircmap.xml 2015-07-22 10:07:05.000000000 +0200 -+++ kodi-15.0-2f34a0c.patch/system/Lircmap.xml 2015-07-28 10:47:41.202213181 +0200 -@@ -493,6 +493,7 @@ - KEY_TEXT - KEY_DELETE - -+ - - pause - stop -@@ -544,50 +545,93 @@ +diff --git a/system/Lircmap.xml b/system/Lircmap.xml +index ec7c6e0e6a..05dc05521e 100644 +--- a/system/Lircmap.xml ++++ b/system/Lircmap.xml +@@ -548,50 +548,85 @@ KEY_UP KEY_DOWN @@ -33,28 +26,23 @@ diff -Naur kodi-15.0-2f34a0c/system/Lircmap.xml kodi-15.0-2f34a0c.patch/system/L KEY_STOP + KEY_STOPCD KEY_FASTFORWARD -+ KEY_FFORWARD + KEY_FORWARD KEY_REWIND KEY_VOLUMEUP -+ KEY_VOLUP KEY_VOLUMEDOWN -+ KEY_VOLDOWN KEY_CHANNELUP -+ KEY_CHUP + KEY_PAGEUP KEY_CHANNELDOWN -+ KEY_CHDOWN + KEY_PAGEDOWN KEY_NEXT + KEY_NEXTSONG KEY_PREVIOUS + KEY_PREVIOUSSONG - KEY_EPG + KEY_EPG + KEY_TITLE + KEY_TV2 + KEY_CONTEXT_MENU KEY_SUBTITLE -+ KEY_TITLE KEY_LANGUAGE KEY_INFO + KEY_PROPS @@ -97,10 +85,7 @@ diff -Naur kodi-15.0-2f34a0c/system/Lircmap.xml kodi-15.0-2f34a0c.patch/system/L KEY_NUMERIC_9 + KEY_0 KEY_NUMERIC_0 -+ KEY_STAR + KEY_KPASTERISK KEY_NUMERIC_STAR -+ KEY_POUND KEY_NUMERIC_POUND KEY_RED - KEY_GREEN diff --git a/packages/mediacenter/kodi/patches/kodi-999.16-amlogic_timing.patch b/packages/mediacenter/kodi/patches/kodi-999.16-amlogic_timing.patch deleted file mode 100644 index a2ac90fceb..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.16-amlogic_timing.patch +++ /dev/null @@ -1,4375 +0,0 @@ -From f35b302861b90fb25acad6ea3430e95a58ac394e Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Fri, 18 Nov 2016 14:39:30 +0100 -Subject: [PATCH 01/32] sync kodi clock to AML clock - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 219 +++++++++++---------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 26 ++- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 34 ++-- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.h | 5 +- - .../VideoRenderers/HwDecRender/RendererAML.cpp | 137 ++++++++++--- - .../VideoRenderers/HwDecRender/RendererAML.h | 36 +++- - 6 files changed, 286 insertions(+), 171 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index c38c223..0ab8567 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -26,6 +26,7 @@ - #include "cores/VideoPlayer/DVDClock.h" - #include "cores/VideoPlayer/VideoRenderers/RenderFlags.h" - #include "cores/VideoPlayer/VideoRenderers/RenderManager.h" -+#include "settings/AdvancedSettings.h" - #include "guilib/GraphicContext.h" - #include "settings/DisplaySettings.h" - #include "settings/MediaSettings.h" -@@ -49,11 +50,11 @@ extern "C" { - #include - #include - #include --#include - #include - #include - #include - #include -+#include - #include - - // amcodec include -@@ -133,6 +134,11 @@ class DllLibamCodecInterface - virtual int codec_set_cntl_mode(codec_para_t *pcodec, unsigned int mode)=0; - virtual int codec_set_cntl_avthresh(codec_para_t *pcodec, unsigned int avthresh)=0; - virtual int codec_set_cntl_syncthresh(codec_para_t *pcodec, unsigned int syncthresh)=0; -+ -+ virtual int codec_set_av_threshold(codec_para_t *pcodec, int threshold)=0; -+ virtual int codec_set_video_delay_limited_ms(codec_para_t *pcodec,int delay_ms)=0; -+ virtual int codec_get_video_delay_limited_ms(codec_para_t *pcodec,int *delay_ms)=0; -+ virtual int codec_get_video_cur_delay_ms(codec_para_t *pcodec,int *delay_ms)=0; - }; - - class DllLibAmCodec : public DllDynamic, DllLibamCodecInterface -@@ -156,6 +162,11 @@ class DllLibAmCodec : public DllDynamic, DllLibamCodecInterface - DEFINE_METHOD2(int, codec_set_cntl_avthresh, (codec_para_t *p1, unsigned int p2)) - DEFINE_METHOD2(int, codec_set_cntl_syncthresh,(codec_para_t *p1, unsigned int p2)) - -+ DEFINE_METHOD2(int, codec_set_av_threshold, (codec_para_t *p1, int p2)) -+ DEFINE_METHOD2(int, codec_set_video_delay_limited_ms, (codec_para_t *p1, int p2)) -+ DEFINE_METHOD2(int, codec_get_video_delay_limited_ms, (codec_para_t *p1, int *p2)) -+ DEFINE_METHOD2(int, codec_get_video_cur_delay_ms, (codec_para_t *p1, int *p2)) -+ - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(codec_init) - RESOLVE_METHOD(codec_close) -@@ -172,6 +183,11 @@ class DllLibAmCodec : public DllDynamic, DllLibamCodecInterface - RESOLVE_METHOD(codec_set_cntl_mode) - RESOLVE_METHOD(codec_set_cntl_avthresh) - RESOLVE_METHOD(codec_set_cntl_syncthresh) -+ -+ RESOLVE_METHOD(codec_set_av_threshold) -+ RESOLVE_METHOD(codec_set_video_delay_limited_ms) -+ RESOLVE_METHOD(codec_get_video_delay_limited_ms) -+ RESOLVE_METHOD(codec_get_video_cur_delay_ms) - END_METHOD_RESOLVE() - - public: -@@ -273,7 +289,7 @@ class DllLibAmCodec : public DllDynamic, DllLibamCodecInterface - - #define PTS_FREQ 90000 - #define UNIT_FREQ 96000 --#define AV_SYNC_THRESH PTS_FREQ*30 -+#define AV_SYNC_THRESH PTS_FREQ*0 - - #define TRICKMODE_NONE 0x00 - #define TRICKMODE_I 0x01 -@@ -371,6 +387,18 @@ typedef struct am_private_t - bool dumpdemux; - } am_private_t; - -+typedef struct vframe_states -+{ -+ int vf_pool_size; -+ int buf_free_num; -+ int buf_recycle_num; -+ int buf_avail_num; -+} vframe_states_t; -+ -+#define AMSTREAM_IOC_MAGIC 'S' -+#define AMSTREAM_IOC_VF_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x60, unsigned long) -+ -+ - /*************************************************************************/ - /*************************************************************************/ - void dumpfile_open(am_private_t *para) -@@ -713,7 +741,7 @@ int write_av_packet(am_private_t *para, am_packet_t *pkt) - } - pkt->newflag = 0; - } -- -+ - buf = pkt->data; - size = pkt->data_size ; - if (size == 0 && pkt->isvalid) { -@@ -1380,9 +1408,12 @@ int set_header_info(am_private_t *para) - - /*************************************************************************/ - CAMLCodec::CAMLCodec() -- : CThread("CAMLCodec") -+ : m_prefill_state(PREFILL_STATE_FILLING) -+ , m_opened(false) -+ , m_ptsIs64us(false) -+ , m_last_pts(0) -+ , m_cur_pts(0) - { -- m_opened = false; - am_private = new am_private_t; - memset(am_private, 0, sizeof(am_private_t)); - m_dll = new DllLibAmCodec; -@@ -1402,12 +1433,26 @@ CAMLCodec::CAMLCodec() - - CAMLCodec::~CAMLCodec() - { -- StopThread(); - delete am_private; - am_private = NULL; - delete m_dll, m_dll = NULL; - } - -+float CAMLCodec::OMXPtsToSeconds(int omxpts) -+{ -+ return static_cast(omxpts) / PTS_FREQ; -+} -+ -+int CAMLCodec::OMXDurationToNs(int duration) -+{ -+ return static_cast(static_cast(duration) / PTS_FREQ * 1000000 ); -+} -+ -+int CAMLCodec::GetAmlDuration() const -+{ -+ return am_private ? (am_private->video_rate * PTS_FREQ) / UNIT_FREQ : 0; -+}; -+ - bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - { - #ifdef TARGET_ANDROID -@@ -1415,7 +1460,6 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - #endif - - m_speed = DVD_PLAYSPEED_NORMAL; -- m_1st_pts = 0; - m_cur_pts = 0; - m_dst_rect.SetRect(0, 0, 0, 0); - m_zoom = -1; -@@ -1615,9 +1659,10 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - am_private->dumpdemux = false; - dumpfile_open(am_private); - -- //! @bug make sure we are not stuck in pause (amcodec bug) - m_dll->codec_resume(&am_private->vcodec); -+ - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); -+ m_dll->codec_set_video_delay_limited_ms(&am_private->vcodec, 1000); - - m_dll->codec_set_cntl_avthresh(&am_private->vcodec, AV_SYNC_THRESH); - m_dll->codec_set_cntl_syncthresh(&am_private->vcodec, 0); -@@ -1627,8 +1672,6 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - am_private->am_pkt.codec = &am_private->vcodec; - pre_header_feeding(am_private, &am_private->am_pkt); - -- Create(); -- - m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iHeight); - - std::string strScaler; -@@ -1636,16 +1679,19 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - if (strScaler.find("enabled") == std::string::npos) // Scaler not enabled, use screen size - m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenHeight); - --/* -- // if display is set to 1080xxx, then disable deinterlacer for HD content -- // else bandwidth usage is too heavy and it will slow down video decoder. -- char display_mode[256] = {0}; -- SysfsUtils::GetString("/sys/class/display/mode", display_mode, 255); -- if (strstr(display_mode,"1080")) -- SysfsUtils::SetInt("/sys/module/di/parameters/bypass_all", 1); -- else -- SysfsUtils::SetInt("/sys/module/di/parameters/bypass_all", 0); --*/ -+ SysfsUtils::SetInt("/sys/class/video/freerun_mode", 0); -+ -+ -+ struct utsname un; -+ if (uname(&un) == 0) -+ { -+ int linuxversion[2]; -+ sscanf(un.release,"%d.%d", &linuxversion[0], &linuxversion[1]); -+ if (linuxversion[0] > 3 || (linuxversion[0] == 3 && linuxversion[1] >= 14)) -+ m_ptsIs64us = true; -+ } -+ -+ CLog::Log(LOGNOTICE, "CAMLCodec::OpenDecoder - using V4L2 pts format: %s", m_ptsIs64us ? "64Bit":"32Bit"); - - m_opened = true; - // vcodec is open, update speed if it was -@@ -1705,7 +1751,6 @@ void CAMLCodec::SetVfmMap(const std::string &name, const std::string &map) - void CAMLCodec::CloseDecoder() - { - CLog::Log(LOGDEBUG, "CAMLCodec::CloseDecoder"); -- StopThread(); - - // never leave vcodec ff/rw or paused. - if (m_speed != DVD_PLAYSPEED_NORMAL) -@@ -1754,6 +1799,8 @@ void CAMLCodec::Reset() - } - // reset the decoder - m_dll->codec_reset(&am_private->vcodec); -+ m_dll->codec_set_video_delay_limited_ms(&am_private->vcodec, 1000); -+ - dumpfile_close(am_private); - dumpfile_open(am_private); - -@@ -1767,9 +1814,8 @@ void CAMLCodec::Reset() - SysfsUtils::SetInt("/sys/class/video/blackout_policy", blackout_policy); - - // reset some interal vars -- m_1st_pts = 0; - m_cur_pts = 0; -- m_ptsQueue.clear(); -+ m_prefill_state = PREFILL_STATE_FILLING; - SetSpeed(m_speed); - } - -@@ -1778,6 +1824,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (!m_opened) - return VC_BUFFER; - -+ float timesize(static_cast(GetTimeSize())); - if (pData) - { - am_private->am_pkt.data = pData; -@@ -1813,9 +1860,6 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (am_private->am_pkt.avdts != (int64_t)AV_NOPTS_VALUE) - am_private->am_pkt.avdts -= m_start_dts; - -- //CLog::Log(LOGDEBUG, "CAMLCodec::Decode: iSize(%d), dts(%f), pts(%f), avdts(%llx), avpts(%llx)", -- // iSize, dts, pts, am_private->am_pkt.avdts, am_private->am_pkt.avpts); -- - // some formats need header/data tweaks. - // the actual write occurs once in write_av_packet - // and is controlled by am_pkt.newflag. -@@ -1840,47 +1884,39 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - // Decoder got stuck; Reset - Reset(); - } -- -- // if we seek, then GetTimeSize is wrong as -- // reports lastpts - cur_pts and hw decoder has -- // not started outputing new pts values yet. -- // so we grab the 1st pts sent into driver and -- // use that to calc GetTimeSize. -- if (m_1st_pts == 0) -- m_1st_pts = am_private->am_pkt.lastpts; -+ if (m_prefill_state == PREFILL_STATE_FILLING && timesize >= 1.0) -+ m_prefill_state = PREFILL_STATE_FILLED; - } - -- // if we have still frames, demux size will be small -- // and we need to pre-buffer more. -- double target_timesize = 1.0; -- if (iSize < 20) -- target_timesize = 2.0; -- -- int rtn = 0; -- -- // keep hw buffered demux above 1 second -- if (GetTimeSize() < target_timesize) -- rtn |= VC_BUFFER; -- -- // wait until we get a new frame or 25ms, -- if (m_ptsQueue.size() == 0) -- m_ready_event.WaitMSec(25); -- -- if (m_ptsQueue.size() > 0) -+ int rtn(0); -+ int64_t decode_pts = 0; -+ if (m_prefill_state == PREFILL_STATE_FILLED && timesize > 0.5 && DequeueBuffer(decode_pts) == 0) - { -- CSingleLock lock(m_ptsQueueMutex); -- m_cur_pts = m_ptsQueue.front(); -- m_ptsQueue.pop_front(); - rtn |= VC_PICTURE; -+ m_last_pts = m_cur_pts; -+ m_cur_pts = decode_pts; - } --/* -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: " -- "rtn(%d), m_cur_pictcnt(%lld), m_cur_pts(%f), lastpts(%f), GetTimeSize(%f), GetDataSize(%d)", -- rtn, m_cur_pictcnt, (float)m_cur_pts/PTS_FREQ, (float)am_private->am_pkt.lastpts/PTS_FREQ, GetTimeSize(), GetDataSize()); --*/ -+ if ((rtn & VC_PICTURE)==0 || timesize < 1.0) -+ rtn |= VC_BUFFER; -+ -+ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d dts_in: %0.6f, pts_in: %0.6f, ptsOut:%0.6f, amlpts:%d timesize:%0.2f", -+ rtn, -+ static_cast(dts)/DVD_TIME_BASE, -+ static_cast(pts)/DVD_TIME_BASE, -+ static_cast(m_cur_pts)/PTS_FREQ, -+ static_cast(m_cur_pts), -+ timesize -+ ); -+ - return rtn; - } - -+int CAMLCodec::PollFrame() -+{ -+ return m_dll->codec_poll_cntl(&am_private->vcodec); -+} -+ - int CAMLCodec::DequeueBuffer(int64_t &pts) - { - v4l2_buffer vbuf = { 0 }; -@@ -1896,7 +1932,7 @@ int CAMLCodec::DequeueBuffer(int64_t &pts) - // Since kernel 3.14 Amlogic changed length and units of PTS values reported here. - // To differentiate such PTS values we check for existence of omx_pts_interval_lower - // parameter, because it was introduced since kernel 3.14. -- if (access("/sys/module/amvideo/parameters/omx_pts_interval_lower", F_OK) != -1) -+ if (m_ptsIs64us) - { - pts = vbuf.timestamp.tv_sec & 0xFFFFFFFF; - pts <<= 32; -@@ -1917,18 +1953,17 @@ bool CAMLCodec::GetPicture(DVDVideoPicture *pDvdVideoPicture) - - pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED; - pDvdVideoPicture->format = RENDER_FMT_AML; -- pDvdVideoPicture->iDuration = (double)(am_private->video_rate * DVD_TIME_BASE) / UNIT_FREQ; - -- pDvdVideoPicture->dts = DVD_NOPTS_VALUE; -- if (m_speed == DVD_PLAYSPEED_NORMAL) -- pDvdVideoPicture->pts = (double)m_cur_pts / PTS_FREQ * DVD_TIME_BASE; -+ if (m_last_pts <= 0) -+ pDvdVideoPicture->iDuration = (double)(am_private->video_rate * DVD_TIME_BASE) / UNIT_FREQ; - else -- { -- if (m_cur_pts == 0) -- pDvdVideoPicture->pts = (double)m_1st_pts / PTS_FREQ * DVD_TIME_BASE; -- else -- pDvdVideoPicture->pts = (double)m_cur_pts / PTS_FREQ * DVD_TIME_BASE; -- } -+ pDvdVideoPicture->iDuration = (double)((m_cur_pts - m_last_pts) * DVD_TIME_BASE) / PTS_FREQ; -+ -+ pDvdVideoPicture->dts = DVD_NOPTS_VALUE; -+ pDvdVideoPicture->pts = (double)m_cur_pts / PTS_FREQ * DVD_TIME_BASE; -+ -+ //AML video is ~ 2 frames to fast - sync audio -+ pDvdVideoPicture->pts += 2*pDvdVideoPicture->iDuration; - - return true; - } -@@ -1981,17 +2016,13 @@ double CAMLCodec::GetTimeSize() - if (!m_opened) - return 0; - -- // if m_cur_pts is zero, hw decoder was not started yet -- // so we use the pts of the 1st demux packet that was send -- // to hw decoder to calc timesize. -- if (m_cur_pts == 0) -- m_timesize = (double)(am_private->am_pkt.lastpts - m_1st_pts) / PTS_FREQ; -- else -- m_timesize = (double)(am_private->am_pkt.lastpts - GetOMXPts()) / PTS_FREQ; -+ int video_delay_ms; -+ double timesize(0); -+ if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) -+ timesize = (float)video_delay_ms / 1000.0; - - // lie to VideoPlayer, it is hardcoded to a max of 8 seconds, - // if you buffer more than 8 seconds, it goes nuts. -- double timesize = m_timesize; - if (timesize < 0.0) - timesize = 0.0; - else if (timesize > 7.0) -@@ -2000,32 +2031,6 @@ double CAMLCodec::GetTimeSize() - return timesize; - } - --void CAMLCodec::Process() --{ -- CLog::Log(LOGDEBUG, "CAMLCodec::Process Started"); -- -- while (!m_bStop) -- { -- if (m_dll->codec_poll_cntl(&am_private->vcodec) < 0) -- { -- CLog::Log(LOGDEBUG, "CAMLCodec::Process: codec_poll_cntl failed"); -- Sleep(10); -- } -- -- { -- CSingleLock lock(m_ptsQueueMutex); -- int64_t pts = 0; -- if (DequeueBuffer(pts) == 0) -- { -- m_ptsQueue.push_back(pts + m_start_pts); -- m_ready_event.Set(); -- } -- } -- } -- -- CLog::Log(LOGDEBUG, "CAMLCodec::Process Stopped"); --} -- - void CAMLCodec::ShowMainVideo(const bool show) - { - static int saved_disable_video = -1; -@@ -2273,3 +2278,9 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) - // that would show video playback, so show it. - ShowMainVideo(true); - } -+ -+void CAMLCodec::SetVideoRate(int videoRate) -+{ -+ if (am_private) -+ am_private->video_rate = videoRate; -+} -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 0eb5c3e..33fa0b7 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -24,8 +24,6 @@ - #include "cores/IPlayer.h" - #include "guilib/Geometry.h" - #include "rendering/RenderSystem.h" --#include "threads/Thread.h" --#include - - typedef struct am_private_t am_private_t; - -@@ -34,7 +32,7 @@ class DllLibAmCodec; - class PosixFile; - typedef std::shared_ptr PosixFilePtr; - --class CAMLCodec : public CThread -+class CAMLCodec - { - public: - CAMLCodec(); -@@ -51,11 +49,13 @@ class CAMLCodec : public CThread - int GetDataSize(); - double GetTimeSize(); - void SetVideoRect(const CRect &SrcRect, const CRect &DestRect); -+ void SetVideoRate(int videoRate); - int64_t GetCurPts() const { return m_cur_pts; } - int GetOMXPts() const { return static_cast(m_cur_pts - m_start_pts); } -- --protected: -- virtual void Process(); -+ static float OMXPtsToSeconds(int omxpts); -+ static int OMXDurationToNs(int duration); -+ int GetAmlDuration() const; -+ int PollFrame(); - - private: - void ShowMainVideo(const bool show); -@@ -73,16 +73,15 @@ class CAMLCodec : public CThread - - DllLibAmCodec *m_dll; - bool m_opened; -+ bool m_ptsIs64us; - am_private_t *am_private; - CDVDStreamInfo m_hints; - volatile int m_speed; -- volatile int64_t m_1st_pts; - volatile int64_t m_cur_pts; -- volatile double m_timesize; - volatile int64_t m_vbufsize; - int64_t m_start_dts; - int64_t m_start_pts; -- CEvent m_ready_event; -+ int64_t m_last_pts; - - CRect m_dst_rect; - CRect m_display_rect; -@@ -94,8 +93,15 @@ class CAMLCodec : public CThread - int m_contrast; - int m_brightness; - -+ enum PREFILLSTATE -+ { -+ PREFILL_STATE_FILLING, -+ PREFILL_STATE_FILLED -+ }; -+ PREFILLSTATE m_prefill_state; -+ -+ - PosixFilePtr m_amlVideoFile; - std::string m_defaultVfmMap; -- std::deque m_ptsQueue; - CCriticalSection m_ptsQueueMutex; - }; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index a27d3e3..a0f847a 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -30,6 +30,7 @@ - #include "utils/SysfsUtils.h" - #include "threads/Atomics.h" - #include "settings/Settings.h" -+#include "threads/Thread.h" - - #define __MODULE_NAME__ "DVDVideoCodecAmlogic" - -@@ -236,6 +237,7 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - m_processInfo.SetVideoDecoderName(m_pFormatName, true); - m_processInfo.SetVideoDimensions(m_hints.width, m_hints.height); - m_processInfo.SetVideoDeintMethod("hardware"); -+ m_processInfo.SetVideoDAR(m_hints.aspect); - - CLog::Log(LOGINFO, "%s: Opened Amlogic Codec", __MODULE_NAME__); - return true; -@@ -315,7 +317,7 @@ bool CDVDVideoCodecAmlogic::GetPicture(DVDVideoPicture* pDvdVideoPicture) - m_Codec->GetPicture(&m_videobuffer); - *pDvdVideoPicture = m_videobuffer; - -- CDVDAmlogicInfo* info = new CDVDAmlogicInfo(this, m_Codec, m_Codec->GetOMXPts()); -+ CDVDAmlogicInfo* info = new CDVDAmlogicInfo(this, m_Codec, m_Codec->GetOMXPts(), m_Codec->GetAmlDuration()); - - { - CSingleLock lock(m_secure); -@@ -363,7 +365,7 @@ void CDVDVideoCodecAmlogic::SetDropState(bool bDrop) - // Freerun mode causes amvideo driver to ignore timing and process frames - // as quickly as they are coming from decoder. By enabling freerun mode we can - // skip rendering of the frames that are requested to be dropped by VideoPlayer. -- SysfsUtils::SetInt("/sys/class/video/freerun_mode", bDrop ? 1 : 0); -+ //SysfsUtils::SetInt("/sys/class/video/freerun_mode", bDrop ? 1 : 0); - } - - void CDVDVideoCodecAmlogic::SetSpeed(int iSpeed) -@@ -466,8 +468,7 @@ void CDVDVideoCodecAmlogic::FrameRateTracking(uint8_t *pData, int iSize, double - m_framerate = m_mpeg2_sequence->rate; - m_video_rate = (int)(0.5 + (96000.0 / m_framerate)); - -- CLog::Log(LOGDEBUG, "%s: detected mpeg2 aspect ratio(%f), framerate(%f), video_rate(%d)", -- __MODULE_NAME__, m_mpeg2_sequence->ratio, m_framerate, m_video_rate); -+ m_processInfo.SetVideoFps(m_framerate); - - // update m_hints for 1st frame fixup. - switch(m_mpeg2_sequence->rate_info) -@@ -526,7 +527,7 @@ void CDVDVideoCodecAmlogic::FrameRateTracking(uint8_t *pData, int iSize, double - if (cur_pts == DVD_NOPTS_VALUE) - cur_pts = m_frame_queue->dts; - -- pthread_mutex_unlock(&m_queue_mutex); -+ pthread_mutex_unlock(&m_queue_mutex); - - float duration = cur_pts - m_last_pts; - m_last_pts = cur_pts; -@@ -559,22 +560,10 @@ void CDVDVideoCodecAmlogic::FrameRateTracking(uint8_t *pData, int iSize, double - break; - - // 25.000 (40000.000000) -- case 40000: -+ case 39900 ... 40100: - framerate = 25000.0 / 1000.0; - break; - -- // 24.975 (40040.000000) -- case 40040: -- framerate = 25000.0 / 1001.0; -- break; -- -- /* -- // 24.000 (41666.666666) -- case 41667: -- framerate = 24000.0 / 1000.0; -- break; -- */ -- - // 23.976 (41708.33333) - case 40200 ... 43200: - // 23.976 seems to have the crappiest encodings :) -@@ -592,6 +581,12 @@ void CDVDVideoCodecAmlogic::FrameRateTracking(uint8_t *pData, int iSize, double - { - m_framerate = framerate; - m_video_rate = (int)(0.5 + (96000.0 / framerate)); -+ -+ if (m_Codec) -+ m_Codec->SetVideoRate(m_video_rate); -+ -+ m_processInfo.SetVideoFps(m_framerate); -+ - CLog::Log(LOGDEBUG, "%s: detected new framerate(%f), video_rate(%d)", - __MODULE_NAME__, m_framerate, m_video_rate); - } -@@ -607,11 +602,12 @@ void CDVDVideoCodecAmlogic::RemoveInfo(CDVDAmlogicInfo *info) - m_inflight.erase(m_inflight.find(info)); - } - --CDVDAmlogicInfo::CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts) -+CDVDAmlogicInfo::CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts, int amlDuration) - : m_refs(0) - , m_codec(codec) - , m_amlCodec(amlcodec) - , m_omxPts(omxPts) -+ , m_amlDuration(amlDuration) - { - } - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -index 2c44241..39f408e 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -@@ -36,7 +36,7 @@ class CDVDVideoCodecAmlogic; - class CDVDAmlogicInfo - { - public: -- CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts); -+ CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts, int amlDuration); - - // reference counting - CDVDAmlogicInfo* Retain(); -@@ -44,6 +44,7 @@ class CDVDAmlogicInfo - - CAMLCodec *getAmlCodec() const; - int GetOmxPts() const { return m_omxPts; } -+ int GetAmlDuration() const { return m_amlDuration; } - void invalidate(); - - protected: -@@ -52,7 +53,7 @@ class CDVDAmlogicInfo - - CDVDVideoCodecAmlogic* m_codec; - CAMLCodec* m_amlCodec; -- int m_omxPts; -+ int m_omxPts, m_amlDuration; - }; - - class CDVDVideoCodecAmlogic : public CDVDVideoCodec -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index d8674c8..c45e94f 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -21,26 +21,84 @@ - #include "RendererAML.h" - - #if defined(HAS_LIBAMCODEC) --#include "cores/IPlayer.h" --#include "windowing/egl/EGLWrapper.h" - #include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h" - #include "cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h" - #include "utils/log.h" --#include "utils/GLUtils.h" - #include "utils/SysfsUtils.h" - #include "settings/MediaSettings.h" - #include "windowing/WindowingFactory.h" - #include "cores/VideoPlayer/VideoRenderers/RenderCapture.h" -+#include "settings/AdvancedSettings.h" -+ -+static int get_pts(const char *strPath) -+{ -+ int fd = open(strPath, O_RDONLY); -+ if (fd >= 0) -+ { -+ char pts_str[64]; -+ int size = read(fd, pts_str, sizeof(pts_str)); -+ close(fd); -+ return strtol(pts_str, NULL, 16); -+ } -+ return 0; -+} -+ -+static void set_pts(const char *strPath, int pts) -+{ -+ int fd = open(strPath, O_WRONLY); -+ if (fd >= 0) -+ { -+ char pts_str[64]; -+ sprintf(pts_str, "0x%x", pts); -+ write(fd, pts_str, strlen(pts_str)); -+ close(fd); -+ } -+} - - CRendererAML::CRendererAML() -+ : m_prevPts(-1) -+ , m_bConfigured(false) -+ , m_iRenderBuffer(0) -+ , m_diff_counter(0) - { -- m_prevPts = -1; - } - - CRendererAML::~CRendererAML() - { - } - -+bool CRendererAML::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_formatl, unsigned int orientation) -+{ -+ m_sourceWidth = width; -+ m_sourceHeight = height; -+ m_renderOrientation = orientation; -+ -+ // Save the flags. -+ m_iFlags = flags; -+ m_format = format; -+ -+ // Calculate the input frame aspect ratio. -+ CalculateFrameAspectRatio(d_width, d_height); -+ SetViewMode(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ViewMode); -+ ManageRenderArea(); -+ -+ m_bConfigured = true; -+ -+ for (int i = 0 ; i < m_numRenderBuffers ; ++i) -+ m_buffers[i].hwDec = 0; -+ -+ return true; -+} -+ -+CRenderInfo CRendererAML::GetRenderInfo() -+{ -+ CRenderInfo info; -+ info.formats.push_back(RENDER_FMT_BYPASS); -+ info.max_buffer_size = m_numRenderBuffers; -+ info.optimal_buffer_size = m_numRenderBuffers; -+ return info; -+} -+ - bool CRendererAML::RenderCapture(CRenderCapture* capture) - { - capture->BeginRender(); -@@ -48,16 +106,28 @@ bool CRendererAML::RenderCapture(CRenderCapture* capture) - return true; - } - -+int CRendererAML::GetImage(YV12Image *image, int source, bool readonly) -+{ -+ if (image == nullptr) -+ return -1; -+ -+ /* take next available buffer */ -+ if (source == -1) -+ source = (m_iRenderBuffer + 1) % m_numRenderBuffers; -+ -+ return source; -+} -+ - void CRendererAML::AddVideoPictureHW(DVDVideoPicture &picture, int index) - { -- YUVBUFFER &buf = m_buffers[index]; -+ BUFFER &buf = m_buffers[index]; - if (picture.amlcodec) - buf.hwDec = picture.amlcodec->Retain(); - } - - void CRendererAML::ReleaseBuffer(int idx) - { -- YUVBUFFER &buf = m_buffers[idx]; -+ BUFFER &buf = m_buffers[idx]; - if (buf.hwDec) - { - CDVDAmlogicInfo *amli = static_cast(buf.hwDec); -@@ -66,9 +136,14 @@ void CRendererAML::ReleaseBuffer(int idx) - } - } - --int CRendererAML::GetImageHook(YV12Image *image, int source, bool readonly) -+void CRendererAML::FlipPage(int source) - { -- return source; -+ if( source >= 0 && source < m_numRenderBuffers ) -+ m_iRenderBuffer = source; -+ else -+ m_iRenderBuffer = (m_iRenderBuffer + 1) % m_numRenderBuffers; -+ -+ return; - } - - bool CRendererAML::IsGuiLayer() -@@ -104,37 +179,47 @@ EINTERLACEMETHOD CRendererAML::AutoInterlaceMethod() - return VS_INTERLACEMETHOD_NONE; - } - --bool CRendererAML::LoadShadersHook() -+void CRendererAML::Reset() - { -- CLog::Log(LOGNOTICE, "GL: Using AML render method"); -- m_textureTarget = GL_TEXTURE_2D; -- m_renderMethod = RENDER_BYPASS; -- return false; -+ m_prevPts = 0; -+ m_diff_counter = 0; - } - --bool CRendererAML::RenderHook(int index) --{ -- return true;// nothing to be done for aml --} -- --bool CRendererAML::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) -+void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - { - ManageRenderArea(); - -- CDVDAmlogicInfo *amli = static_cast(m_buffers[m_iYV12RenderBuffer].hwDec); -+ CDVDAmlogicInfo *amli = static_cast(m_buffers[m_iRenderBuffer].hwDec); -+ CAMLCodec *amlcodec = amli ? amli->getAmlCodec() : 0; -+ -+ if(amlcodec) -+ amlcodec->PollFrame(); -+ - if (amli && amli->GetOmxPts() != m_prevPts) - { - m_prevPts = amli->GetOmxPts(); -- SysfsUtils::SetInt("/sys/module/amvideo/parameters/omx_pts", amli->GetOmxPts()); - -- CAMLCodec *amlcodec = amli->getAmlCodec(); -+ int pcrscr(get_pts("/sys/class/tsync/pts_pcrscr")); -+ m_diff_counter += static_cast((pcrscr - m_prevPts)*1.1 / amli->GetAmlDuration()); -+ -+ if (abs(m_diff_counter) > 2) -+ { -+ int videopts(get_pts("/sys/class/tsync/pts_video")); -+ set_pts("/sys/class/tsync/pts_pcrscr", m_prevPts); -+ CLog::Log(LOGDEBUG, "RenderUpdate: Adjusting: ptsclock:%d ptsscr:%d vpts:%d diff:%d", m_prevPts, pcrscr, videopts, m_diff_counter); -+ pcrscr = m_prevPts; -+ m_diff_counter = 0; -+ } -+ else if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -+ { -+ int videopts(get_pts("/sys/class/tsync/pts_video")); -+ CLog::Log(LOGDEBUG, "RenderUpdate: ptsclock:%d ptsscr:%d vpts:%d diff:%d", m_prevPts, pcrscr, videopts, m_diff_counter); -+ } -+ SysfsUtils::SetInt("/sys/module/amvideo/parameters/omx_pts", pcrscr); -+ - if (amlcodec) - amlcodec->SetVideoRect(m_sourceRect, m_destRect); - } -- -- usleep(10000); -- -- return true; - } - - #endif -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -index 828f584a..bbef504 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -@@ -24,17 +24,29 @@ - - #if defined(HAS_LIBAMCODEC) - --#include "cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h" -+#include "cores/VideoPlayer/VideoRenderers/BaseRenderer.h" - --class CRendererAML : public CLinuxRendererGLES -+class CRendererAML : public CBaseRenderer - { - public: - CRendererAML(); - virtual ~CRendererAML(); -- -+ - virtual bool RenderCapture(CRenderCapture* capture); - virtual void AddVideoPictureHW(DVDVideoPicture &picture, int index); - virtual void ReleaseBuffer(int idx); -+ virtual bool Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags, ERenderFormat format, unsigned extended_formatl, unsigned int orientation); -+ virtual bool IsConfigured(){ return m_bConfigured; }; -+ virtual CRenderInfo GetRenderInfo(); -+ virtual int GetImage(YV12Image *image, int source = -1, bool readonly = false); -+ virtual void ReleaseImage(int source, bool preserve = false){}; -+ virtual void FlipPage(int source); -+ virtual void PreInit(){}; -+ virtual void UnInit(){}; -+ virtual void Reset(); -+ virtual void Update(){}; -+ virtual void RenderUpdate(bool clear, unsigned int flags = 0, unsigned int alpha = 255); -+ virtual bool SupportsMultiPassRendering(){ return false; }; - - // Player functions - virtual bool IsGuiLayer(); -@@ -47,16 +59,20 @@ class CRendererAML : public CLinuxRendererGLES - - virtual EINTERLACEMETHOD AutoInterlaceMethod(); - --protected: -+private: -+ -+ int m_iRenderBuffer; -+ static const int m_numRenderBuffers = 3; - -- // hooks for hw dec renderer -- virtual bool LoadShadersHook(); -- virtual bool RenderHook(int index); -- virtual int GetImageHook(YV12Image *image, int source = AUTOSOURCE, bool readonly = false); -- virtual bool RenderUpdateVideoHook(bool clear, DWORD flags = 0, DWORD alpha = 255); -+ struct BUFFER -+ { -+ void *hwDec; -+ int duration; -+ } m_buffers[m_numRenderBuffers]; - --private: - int m_prevPts; -+ bool m_bConfigured; -+ int m_diff_counter; - }; - - #endif - -From 62209dbd993a5dfe1dc5ee6083c061bbc781ff7f Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Fri, 18 Nov 2016 18:59:35 +0100 -Subject: [PATCH 02/32] Increase size of render buffers (4) - ---- - xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -index bbef504..0d9f126 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -@@ -62,7 +62,7 @@ class CRendererAML : public CBaseRenderer - private: - - int m_iRenderBuffer; -- static const int m_numRenderBuffers = 3; -+ static const int m_numRenderBuffers = 4; - - struct BUFFER - { - -From d4742523c14dbed5724e80c5160334cf09cfedc7 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Fri, 18 Nov 2016 21:38:32 +0100 -Subject: [PATCH 03/32] Limit timesize to be never > 2.0 - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 0ab8567..56884af 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1896,7 +1896,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_last_pts = m_cur_pts; - m_cur_pts = decode_pts; - } -- if ((rtn & VC_PICTURE)==0 || timesize < 1.0) -+ if (((rtn & VC_PICTURE)==0 && timesize < 2.0) || timesize < 1.0) - rtn |= VC_BUFFER; - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - -From 514370bfd06881cc972ebd7a6f29c1948f12c91c Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Sat, 19 Nov 2016 20:47:47 +0100 -Subject: [PATCH 04/32] sleep / vfs - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 56884af..6f2cfa9 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1886,6 +1886,8 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - } - if (m_prefill_state == PREFILL_STATE_FILLING && timesize >= 1.0) - m_prefill_state = PREFILL_STATE_FILLED; -+ else if (m_prefill_state == PREFILL_STATE_FILLING) -+ Sleep(1); - } - - int rtn(0); -@@ -1899,13 +1901,24 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (((rtn & VC_PICTURE)==0 && timesize < 2.0) || timesize < 1.0) - rtn |= VC_BUFFER; - -+ vframe_states_t vfs; -+ int fd(open("/dev/amvideo", RD_ONLY); -+ if(fd) -+ { -+ ioctl(fd, AMSTREAM_IOC_VF_STATUS, &vfs); -+ close(fd); -+ } -+ else -+ memset(&vfs, 0, sizeof(vfs)); -+ - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d dts_in: %0.6f, pts_in: %0.6f, ptsOut:%0.6f, amlpts:%d timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d dts_in: %0.6f, pts_in: %0.6f, ptsOut:%0.6f, amlpts:%d vfs:[%d-%d-%d-%d] timesize:%0.2f", - rtn, - static_cast(dts)/DVD_TIME_BASE, - static_cast(pts)/DVD_TIME_BASE, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), -+ vfs.vf_pool_size, vfs.buf_free_num,vfs.buf_recycle_num,vfs.buf_avail_num, - timesize - ); - - -From 383c5cd6fdaddd7be841fe9898398e0812fa56c1 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Sun, 20 Nov 2016 11:29:13 +0100 -Subject: [PATCH 05/32] log vfstates / throttle prefill - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 34 +++++++++++++--------- - 1 file changed, 20 insertions(+), 14 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 6f2cfa9..920ba29 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1408,11 +1408,11 @@ int set_header_info(am_private_t *para) - - /*************************************************************************/ - CAMLCodec::CAMLCodec() -- : m_prefill_state(PREFILL_STATE_FILLING) -- , m_opened(false) -+ : m_opened(false) - , m_ptsIs64us(false) -- , m_last_pts(0) - , m_cur_pts(0) -+ , m_last_pts(0) -+ , m_prefill_state(PREFILL_STATE_FILLING) - { - am_private = new am_private_t; - memset(am_private, 0, sizeof(am_private_t)); -@@ -1887,7 +1887,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (m_prefill_state == PREFILL_STATE_FILLING && timesize >= 1.0) - m_prefill_state = PREFILL_STATE_FILLED; - else if (m_prefill_state == PREFILL_STATE_FILLING) -- Sleep(1); -+ usleep(1000); - } - - int rtn(0); -@@ -1898,20 +1898,22 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_last_pts = m_cur_pts; - m_cur_pts = decode_pts; - } -- if (((rtn & VC_PICTURE)==0 && timesize < 2.0) || timesize < 1.0) -+ if (((rtn & VC_PICTURE) == 0 && timesize < 2.0) || timesize < 1.0) - rtn |= VC_BUFFER; - -- vframe_states_t vfs; -- int fd(open("/dev/amvideo", RD_ONLY); -- if(fd) -+ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- ioctl(fd, AMSTREAM_IOC_VF_STATUS, &vfs); -- close(fd); -- } -- else -- memset(&vfs, 0, sizeof(vfs)); -+ vframe_states_t vfs; -+ int fd(open("/dev/amvideo", O_RDONLY)); -+ if(fd) -+ { -+ if (ioctl(fd, AMSTREAM_IOC_VF_STATUS, &vfs) != 0) -+ memset(&vfs, 0, sizeof(vfs)); -+ close(fd); -+ } -+ else -+ memset(&vfs, 0, sizeof(vfs)); - -- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d dts_in: %0.6f, pts_in: %0.6f, ptsOut:%0.6f, amlpts:%d vfs:[%d-%d-%d-%d] timesize:%0.2f", - rtn, - static_cast(dts)/DVD_TIME_BASE, -@@ -1921,6 +1923,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - vfs.vf_pool_size, vfs.buf_free_num,vfs.buf_recycle_num,vfs.buf_avail_num, - timesize - ); -+ } - - return rtn; - } -@@ -1983,6 +1986,9 @@ bool CAMLCodec::GetPicture(DVDVideoPicture *pDvdVideoPicture) - - void CAMLCodec::SetSpeed(int speed) - { -+ if (m_speed == speed) -+ return; -+ - CLog::Log(LOGDEBUG, "CAMLCodec::SetSpeed, speed(%d)", speed); - - // update internal vars regardless - -From e7885610feb970c3b596c158ab09d7eb53bbe4fb Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Sun, 20 Nov 2016 15:08:31 +0100 -Subject: [PATCH 06/32] throttle during playback as well, not only at prefill - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 920ba29..d038d6a 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1886,8 +1886,6 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - } - if (m_prefill_state == PREFILL_STATE_FILLING && timesize >= 1.0) - m_prefill_state = PREFILL_STATE_FILLED; -- else if (m_prefill_state == PREFILL_STATE_FILLING) -- usleep(1000); - } - - int rtn(0); -@@ -1898,6 +1896,9 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_last_pts = m_cur_pts; - m_cur_pts = decode_pts; - } -+ else //Timesize actualizes each 10ms, throttle decode calls to avoid reading too much -+ usleep(2500); -+ - if (((rtn & VC_PICTURE) == 0 && timesize < 2.0) || timesize < 1.0) - rtn |= VC_BUFFER; - - -From 35c24254ab9eafd9bd9f5b0025c94636e3c19889 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Thu, 24 Nov 2016 10:56:07 +0100 -Subject: [PATCH 07/32] Don't use DTS in case PTS is NO_PTS, instead don't call - checkin_pts - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 47 ++++------------------ - 1 file changed, 8 insertions(+), 39 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index d038d6a..8c51ac4c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -632,46 +632,15 @@ void am_packet_release(am_packet_t *pkt) - - int check_in_pts(am_private_t *para, am_packet_t *pkt) - { -- int last_duration = 0; -- static int last_v_duration = 0; -- int64_t pts = 0; -- -- last_duration = last_v_duration; -- -- if (para->stream_type == AM_STREAM_ES) { -- if ((int64_t)INT64_0 != pkt->avpts) { -- pts = pkt->avpts; -- -- if (para->m_dll->codec_checkin_pts(pkt->codec, pts) != 0) { -- CLog::Log(LOGDEBUG, "ERROR check in pts error!"); -- return PLAYER_PTS_ERROR; -- } -- -- } else if ((int64_t)INT64_0 != pkt->avdts) { -- pts = pkt->avdts * last_duration; -- -- if (para->m_dll->codec_checkin_pts(pkt->codec, pts) != 0) { -- CLog::Log(LOGDEBUG, "ERROR check in dts error!"); -- return PLAYER_PTS_ERROR; -- } -- -- last_v_duration = pkt->avduration ? pkt->avduration : 1; -- } else { -- if (!para->check_first_pts) { -- if (para->m_dll->codec_checkin_pts(pkt->codec, 0) != 0) { -- CLog::Log(LOGDEBUG, "ERROR check in 0 to video pts error!"); -- return PLAYER_PTS_ERROR; -- } -- } -- } -- if (!para->check_first_pts) { -- para->check_first_pts = 1; -- } -+ if (para->stream_type == AM_STREAM_ES && (int64_t)INT64_0 != pkt->avpts) -+ { -+ if (para->m_dll->codec_checkin_pts(pkt->codec, pkt->avpts) != 0) -+ { -+ CLog::Log(LOGDEBUG, "ERROR check in pts error!"); -+ return PLAYER_PTS_ERROR; - } -- if (pts > 0) -- pkt->lastpts = pts; -- -- return PLAYER_SUCCESS; -+ } -+ return PLAYER_SUCCESS; - } - - static int write_header(am_private_t *para, am_packet_t *pkt) - -From afb5e69423bf5a6b3b3a1e0c654fbfcd7f4c3121 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Fri, 25 Nov 2016 16:25:44 +0100 -Subject: [PATCH 08/32] allow streams without PTS (matroska) - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 64 ++++++++++------------ - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 9 +-- - 2 files changed, 33 insertions(+), 40 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 8c51ac4c..d96c96c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -37,15 +37,6 @@ - #include "utils/SysfsUtils.h" - #include "utils/TimeUtils.h" - --#if defined(TARGET_ANDROID) --#include "platform/android/activity/AndroidFeatures.h" --#include "utils/BitstreamConverter.h" --#endif -- --extern "C" { --#include "libavutil/avutil.h" --} // extern "C" -- - #include - #include - #include -@@ -295,8 +286,7 @@ class DllLibAmCodec : public DllDynamic, DllLibamCodecInterface - #define TRICKMODE_I 0x01 - #define TRICKMODE_FFFB 0x02 - --// same as AV_NOPTS_VALUE --#define INT64_0 INT64_C(0x8000000000000000) -+static const int64_t INT64_0 = 0x8000000000000000ULL; - - #define EXTERNAL_PTS (1) - #define SYNC_OUTSIDE (2) -@@ -607,7 +597,7 @@ static void am_packet_init(am_packet_t *pkt) - pkt->avduration = 0; - pkt->isvalid = 0; - pkt->newflag = 0; -- pkt->lastpts = 0; -+ pkt->lastpts = INT64_0; - pkt->data = NULL; - pkt->buf = NULL; - pkt->data_size = 0; -@@ -632,13 +622,12 @@ void am_packet_release(am_packet_t *pkt) - - int check_in_pts(am_private_t *para, am_packet_t *pkt) - { -- if (para->stream_type == AM_STREAM_ES && (int64_t)INT64_0 != pkt->avpts) -+ if (para->stream_type == AM_STREAM_ES -+ && INT64_0 != pkt->avpts -+ && para->m_dll->codec_checkin_pts(pkt->codec, pkt->avpts) != 0) - { -- if (para->m_dll->codec_checkin_pts(pkt->codec, pkt->avpts) != 0) -- { -- CLog::Log(LOGDEBUG, "ERROR check in pts error!"); -- return PLAYER_PTS_ERROR; -- } -+ CLog::Log(LOGDEBUG, "ERROR check in pts error!"); -+ return PLAYER_PTS_ERROR; - } - return PLAYER_SUCCESS; - } -@@ -1379,9 +1368,9 @@ int set_header_info(am_private_t *para) - CAMLCodec::CAMLCodec() - : m_opened(false) - , m_ptsIs64us(false) -- , m_cur_pts(0) -+ , m_cur_pts(INT64_0) - , m_last_pts(0) -- , m_prefill_state(PREFILL_STATE_FILLING) -+ , m_state(0) - { - am_private = new am_private_t; - memset(am_private, 0, sizeof(am_private_t)); -@@ -1783,8 +1772,8 @@ void CAMLCodec::Reset() - SysfsUtils::SetInt("/sys/class/video/blackout_policy", blackout_policy); - - // reset some interal vars -- m_cur_pts = 0; -- m_prefill_state = PREFILL_STATE_FILLING; -+ m_cur_pts = INT64_0; -+ m_state = 0; - SetSpeed(m_speed); - } - -@@ -1806,28 +1795,30 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - // handle pts, including 31bit wrap, aml can only handle 31 - // bit pts as it uses an int in kernel. - if (m_hints.ptsinvalid || pts == DVD_NOPTS_VALUE) -- am_private->am_pkt.avpts = AV_NOPTS_VALUE; -+ am_private->am_pkt.avpts = INT64_0; - else - { - am_private->am_pkt.avpts = 0.5 + (pts * PTS_FREQ) / DVD_TIME_BASE;\ - if (!m_start_pts && am_private->am_pkt.avpts >= 0x7fffffff) - m_start_pts = am_private->am_pkt.avpts & ~0x0000ffff; -- } -- if (am_private->am_pkt.avpts != (int64_t)AV_NOPTS_VALUE) - am_private->am_pkt.avpts -= m_start_pts; -+ m_state |= STATE_HASPTS; -+ } - - // handle dts, including 31bit wrap, aml can only handle 31 - // bit dts as it uses an int in kernel. - if (dts == DVD_NOPTS_VALUE) -- am_private->am_pkt.avdts = AV_NOPTS_VALUE; -+ am_private->am_pkt.avdts = INT64_0; - else - { - am_private->am_pkt.avdts = 0.5 + (dts * PTS_FREQ) / DVD_TIME_BASE; - if (!m_start_dts && am_private->am_pkt.avdts >= 0x7fffffff) - m_start_dts = am_private->am_pkt.avdts & ~0x0000ffff; -- } -- if (am_private->am_pkt.avdts != (int64_t)AV_NOPTS_VALUE) - am_private->am_pkt.avdts -= m_start_dts; -+ // We use this to determine the fill state if no PTS is given -+ if (m_cur_pts == INT64_0) -+ m_cur_pts = am_private->am_pkt.avdts; -+ } - - // some formats need header/data tweaks. - // the actual write occurs once in write_av_packet -@@ -1853,13 +1844,13 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - // Decoder got stuck; Reset - Reset(); - } -- if (m_prefill_state == PREFILL_STATE_FILLING && timesize >= 1.0) -- m_prefill_state = PREFILL_STATE_FILLED; -+ if ((m_state & STATE_PREFILLED) == 0 && timesize >= 1.0) -+ m_state |= STATE_PREFILLED; - } - - int rtn(0); - int64_t decode_pts = 0; -- if (m_prefill_state == PREFILL_STATE_FILLED && timesize > 0.5 && DequeueBuffer(decode_pts) == 0) -+ if ((m_state & STATE_PREFILLED) != 0 && timesize > 0.5 && DequeueBuffer(decode_pts) == 0) - { - rtn |= VC_PICTURE; - m_last_pts = m_cur_pts; -@@ -2005,10 +1996,15 @@ double CAMLCodec::GetTimeSize() - if (!m_opened) - return 0; - -- int video_delay_ms; - double timesize(0); -- if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) -- timesize = (float)video_delay_ms / 1000.0; -+ if (m_state & STATE_HASPTS) -+ { -+ int video_delay_ms; -+ if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) -+ timesize = (float)video_delay_ms / 1000.0; -+ } -+ else if (m_cur_pts != INT64_0) -+ timesize = static_cast(am_private->am_pkt.avdts - m_cur_pts) / PTS_FREQ; - - // lie to VideoPlayer, it is hardcoded to a max of 8 seconds, - // if you buffer more than 8 seconds, it goes nuts. -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 33fa0b7..3a2d986 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -93,13 +93,10 @@ class CAMLCodec - int m_contrast; - int m_brightness; - -- enum PREFILLSTATE -- { -- PREFILL_STATE_FILLING, -- PREFILL_STATE_FILLED -- }; -- PREFILLSTATE m_prefill_state; -+ static const unsigned int STATE_PREFILLED = 1; -+ static const unsigned int STATE_HASPTS = 2; - -+ unsigned int m_state; - - PosixFilePtr m_amlVideoFile; - std::string m_defaultVfmMap; - -From f328dec6ca6dde3564c565a674c41bce215f9ab6 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Sun, 4 Dec 2016 17:34:15 +0100 -Subject: [PATCH 09/32] initialize cur_pts at Open / log oob timesizes - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index d96c96c..3e33480 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1418,7 +1418,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - #endif - - m_speed = DVD_PLAYSPEED_NORMAL; -- m_cur_pts = 0; -+ m_cur_pts = INT64_0; - m_dst_rect.SetRect(0, 0, 0, 0); - m_zoom = -1; - m_contrast = -1; -@@ -1427,6 +1427,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - m_start_dts = 0; - m_start_pts = 0; - m_hints = hints; -+ m_state = 0; - - if (!OpenAmlVideo(hints)) - { -@@ -1999,12 +2000,18 @@ double CAMLCodec::GetTimeSize() - double timesize(0); - if (m_state & STATE_HASPTS) - { -- int video_delay_ms; -+ int video_delay_ms(0); - if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) - timesize = (float)video_delay_ms / 1000.0; -+ if (timesize < 0 || timesize > 5.0) -+ CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: cur_delay_ms: %d", video_delay_ms); - } - else if (m_cur_pts != INT64_0) -+ { - timesize = static_cast(am_private->am_pkt.avdts - m_cur_pts) / PTS_FREQ; -+ if (timesize < 0 || timesize > 5.0) -+ CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: avdts: %lld cur_pts: %lld",am_private->am_pkt.avdts, m_cur_pts); -+ } - - // lie to VideoPlayer, it is hardcoded to a max of 8 seconds, - // if you buffer more than 8 seconds, it goes nuts. - -From a4aa3de63681f34a11b8c6491b2e6f49bc8b75a1 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Sun, 4 Dec 2016 21:16:17 +0100 -Subject: [PATCH 10/32] Set AV sync to 30 again - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 3e33480..c1a4359 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -280,7 +280,7 @@ class DllLibAmCodec : public DllDynamic, DllLibamCodecInterface - - #define PTS_FREQ 90000 - #define UNIT_FREQ 96000 --#define AV_SYNC_THRESH PTS_FREQ*0 -+#define AV_SYNC_THRESH PTS_FREQ*30 - - #define TRICKMODE_NONE 0x00 - #define TRICKMODE_I 0x01 - -From 11dded59ec9ab893eb2b3e75f0aaec32450d6d95 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Sun, 4 Dec 2016 21:43:51 +0100 -Subject: [PATCH 11/32] Disable audio and sub - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index c1a4359..0d3ca38 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1386,6 +1386,8 @@ CAMLCodec::CAMLCodec() - am_private->vcodec.cntl_handle = -1; - am_private->vcodec.sub_handle = -1; - am_private->vcodec.audio_utils_handle = -1; -+ am_private->vcodec.has_audio = 0; -+ am_private->vcodec.has_sub = 0; - } - - - -From 569c477ddfc180e4692b7762f47d04330d4fb5d5 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Mon, 5 Dec 2016 17:26:54 +0100 -Subject: [PATCH 12/32] remove videodelay calculation - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 35 ++++++++-------------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 6 ++-- - 2 files changed, 14 insertions(+), 27 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 0d3ca38..b41abe7 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1426,8 +1426,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - m_contrast = -1; - m_brightness = -1; - m_vbufsize = 500000 * 2; -- m_start_dts = 0; -- m_start_pts = 0; -+ m_start_adj = 0; - m_hints = hints; - m_state = 0; - -@@ -1623,7 +1622,6 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - m_dll->codec_resume(&am_private->vcodec); - - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); -- m_dll->codec_set_video_delay_limited_ms(&am_private->vcodec, 1000); - - m_dll->codec_set_cntl_avthresh(&am_private->vcodec, AV_SYNC_THRESH); - m_dll->codec_set_cntl_syncthresh(&am_private->vcodec, 0); -@@ -1802,26 +1800,25 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - else - { - am_private->am_pkt.avpts = 0.5 + (pts * PTS_FREQ) / DVD_TIME_BASE;\ -- if (!m_start_pts && am_private->am_pkt.avpts >= 0x7fffffff) -- m_start_pts = am_private->am_pkt.avpts & ~0x0000ffff; -- am_private->am_pkt.avpts -= m_start_pts; -- m_state |= STATE_HASPTS; -+ if (!m_start_adj && am_private->am_pkt.avpts >= 0x7fffffff) -+ m_start_adj = am_private->am_pkt.avpts & ~0x0000ffff; -+ am_private->am_pkt.avpts -= m_start_adj; - } - - // handle dts, including 31bit wrap, aml can only handle 31 - // bit dts as it uses an int in kernel. - if (dts == DVD_NOPTS_VALUE) -- am_private->am_pkt.avdts = INT64_0; -+ am_private->am_pkt.avdts = am_private->am_pkt.avpts; - else - { - am_private->am_pkt.avdts = 0.5 + (dts * PTS_FREQ) / DVD_TIME_BASE; -- if (!m_start_dts && am_private->am_pkt.avdts >= 0x7fffffff) -- m_start_dts = am_private->am_pkt.avdts & ~0x0000ffff; -- am_private->am_pkt.avdts -= m_start_dts; -- // We use this to determine the fill state if no PTS is given -- if (m_cur_pts == INT64_0) -- m_cur_pts = am_private->am_pkt.avdts; -+ if (!m_start_adj && am_private->am_pkt.avdts >= 0x7fffffff) -+ m_start_adj = am_private->am_pkt.avdts & ~0x0000ffff; -+ am_private->am_pkt.avdts -= m_start_adj; - } -+ // We use this to determine the fill state if no PTS is given -+ if (m_cur_pts == INT64_0) -+ m_cur_pts = am_private->am_pkt.avdts; - - // some formats need header/data tweaks. - // the actual write occurs once in write_av_packet -@@ -2000,15 +1997,7 @@ double CAMLCodec::GetTimeSize() - return 0; - - double timesize(0); -- if (m_state & STATE_HASPTS) -- { -- int video_delay_ms(0); -- if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) -- timesize = (float)video_delay_ms / 1000.0; -- if (timesize < 0 || timesize > 5.0) -- CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: cur_delay_ms: %d", video_delay_ms); -- } -- else if (m_cur_pts != INT64_0) -+ if (m_cur_pts != INT64_0) - { - timesize = static_cast(am_private->am_pkt.avdts - m_cur_pts) / PTS_FREQ; - if (timesize < 0 || timesize > 5.0) -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 3a2d986..9cdd258 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -51,7 +51,7 @@ class CAMLCodec - void SetVideoRect(const CRect &SrcRect, const CRect &DestRect); - void SetVideoRate(int videoRate); - int64_t GetCurPts() const { return m_cur_pts; } -- int GetOMXPts() const { return static_cast(m_cur_pts - m_start_pts); } -+ int GetOMXPts() const { return static_cast(m_cur_pts - m_start_adj); } - static float OMXPtsToSeconds(int omxpts); - static int OMXDurationToNs(int duration); - int GetAmlDuration() const; -@@ -79,8 +79,7 @@ class CAMLCodec - volatile int m_speed; - volatile int64_t m_cur_pts; - volatile int64_t m_vbufsize; -- int64_t m_start_dts; -- int64_t m_start_pts; -+ int64_t m_start_adj; - int64_t m_last_pts; - - CRect m_dst_rect; -@@ -94,7 +93,6 @@ class CAMLCodec - int m_brightness; - - static const unsigned int STATE_PREFILLED = 1; -- static const unsigned int STATE_HASPTS = 2; - - unsigned int m_state; - - -From aaa27fee01327a586d74ae04571b91ccd14138e1 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Tue, 6 Dec 2016 17:42:38 +0100 -Subject: [PATCH 13/32] enable seek for streams without PTS - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 9 +++++++-- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 5 +++-- - 2 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index b41abe7..405e36c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1386,8 +1386,6 @@ CAMLCodec::CAMLCodec() - am_private->vcodec.cntl_handle = -1; - am_private->vcodec.sub_handle = -1; - am_private->vcodec.audio_utils_handle = -1; -- am_private->vcodec.has_audio = 0; -- am_private->vcodec.has_sub = 0; - } - - -@@ -1622,6 +1620,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - m_dll->codec_resume(&am_private->vcodec); - - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); -+ m_dll->codec_set_video_delay_limited_ms(&am_private->vcodec, 1000); - - m_dll->codec_set_cntl_avthresh(&am_private->vcodec, AV_SYNC_THRESH); - m_dll->codec_set_cntl_syncthresh(&am_private->vcodec, 0); -@@ -1803,6 +1802,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (!m_start_adj && am_private->am_pkt.avpts >= 0x7fffffff) - m_start_adj = am_private->am_pkt.avpts & ~0x0000ffff; - am_private->am_pkt.avpts -= m_start_adj; -+ m_state |= STATE_HASPTS; - } - - // handle dts, including 31bit wrap, aml can only handle 31 -@@ -1818,7 +1818,12 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - } - // We use this to determine the fill state if no PTS is given - if (m_cur_pts == INT64_0) -+ { - m_cur_pts = am_private->am_pkt.avdts; -+ // No PTS given -> use first DTS for AML ptsserver initialization -+ if ((m_state & STATE_HASPTS) == 0) -+ am_private->am_pkt.avpts = am_private->am_pkt.avdts; -+ } - - // some formats need header/data tweaks. - // the actual write occurs once in write_av_packet -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 9cdd258..0e5334bd 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -76,8 +76,8 @@ class CAMLCodec - bool m_ptsIs64us; - am_private_t *am_private; - CDVDStreamInfo m_hints; -- volatile int m_speed; -- volatile int64_t m_cur_pts; -+ int m_speed; -+ int64_t m_cur_pts; - volatile int64_t m_vbufsize; - int64_t m_start_adj; - int64_t m_last_pts; -@@ -93,6 +93,7 @@ class CAMLCodec - int m_brightness; - - static const unsigned int STATE_PREFILLED = 1; -+ static const unsigned int STATE_HASPTS = 2; - - unsigned int m_state; - - -From 90249e2a3c6b53aa99a3ce1f4a2d301f798d896d Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Wed, 7 Dec 2016 21:16:18 +0100 -Subject: [PATCH 14/32] start with h.264 IDR frame - ---- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 32 +++++++++++++++++----- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.h | 1 + - xbmc/utils/BitstreamConverter.cpp | 19 +++++-------- - xbmc/utils/BitstreamConverter.h | 1 + - 4 files changed, 34 insertions(+), 19 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index a0f847a..4a0598c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -53,7 +53,8 @@ CDVDVideoCodecAmlogic::CDVDVideoCodecAmlogic(CProcessInfo &processInfo) : CDVDVi - m_bitparser(NULL), - m_bitstream(NULL), - m_opened(false), -- m_drop(false) -+ m_drop(false), -+ m_has_idr(false) - { - pthread_mutex_init(&m_queue_mutex, NULL); - } -@@ -132,8 +133,11 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - m_hints.extradata = malloc(m_hints.extrasize); - memcpy(m_hints.extradata, m_bitstream->GetExtraData(), m_hints.extrasize); - } -- //m_bitparser = new CBitstreamParser(); -- //m_bitparser->Open(); -+ else -+ { -+ m_bitparser = new CBitstreamParser(); -+ m_bitparser->Open(); -+ } - break; - case AV_CODEC_ID_MPEG4: - case AV_CODEC_ID_MSMPEG4V2: -@@ -239,6 +243,8 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - m_processInfo.SetVideoDeintMethod("hardware"); - m_processInfo.SetVideoDAR(m_hints.aspect); - -+ m_has_idr = false; -+ - CLog::Log(LOGINFO, "%s: Opened Amlogic Codec", __MODULE_NAME__); - return true; - } -@@ -279,13 +285,24 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - if (!m_bitstream->Convert(pData, iSize)) - return VC_ERROR; - -+ if (!m_bitstream->IdrFramePassed()) -+ { -+ CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for IDR frame", __MODULE_NAME__); -+ return VC_BUFFER; -+ } - pData = m_bitstream->GetConvertBuffer(); - iSize = m_bitstream->GetConvertSize(); - } -- -- if (m_bitparser) -- m_bitparser->FindIdrSlice(pData, iSize); -- -+ else if (!m_has_idr && m_bitparser) -+ { -+ if (!m_bitparser->FindIdrSlice(pData, iSize)) -+ { -+ CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for IDR frame", __MODULE_NAME__); -+ return VC_BUFFER; -+ } -+ else -+ m_has_idr = true; -+ } - FrameRateTracking( pData, iSize, dts, pts); - } - -@@ -309,6 +326,7 @@ void CDVDVideoCodecAmlogic::Reset(void) - - m_Codec->Reset(); - m_mpeg2_sequence_pts = 0; -+ m_has_idr = false; - } - - bool CDVDVideoCodecAmlogic::GetPicture(DVDVideoPicture* pDvdVideoPicture) -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -index 39f408e..0a2c6bb 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -@@ -99,6 +99,7 @@ class CDVDVideoCodecAmlogic : public CDVDVideoCodec - mpeg2_sequence *m_mpeg2_sequence; - double m_mpeg2_sequence_pts; - bool m_drop; -+ bool m_has_idr; - - CBitstreamParser *m_bitparser; - CBitstreamConverter *m_bitstream; -diff --git a/xbmc/utils/BitstreamConverter.cpp b/xbmc/utils/BitstreamConverter.cpp -index d0a4c20..f42c50c4 100644 ---- a/xbmc/utils/BitstreamConverter.cpp -+++ b/xbmc/utils/BitstreamConverter.cpp -@@ -269,35 +269,25 @@ bool CBitstreamParser::FindIdrSlice(const uint8_t *buf, int buf_size) - buf = find_start_code(buf, buf_end, &state); - if (buf >= buf_end) - { -- //CLog::Log(LOGDEBUG, "FindIdrSlice: buf(%p), buf_end(%p)", buf, buf_end); - break; - } - -- --buf; -- int src_length = buf_end - buf; - switch (state & 0x1f) - { -- default: -- CLog::Log(LOGDEBUG, "FindIdrSlice: found nal_type(%d)", state & 0x1f); -- break; - case AVC_NAL_SLICE: -- CLog::Log(LOGDEBUG, "FindIdrSlice: found NAL_SLICE"); - break; - case AVC_NAL_IDR_SLICE: -- CLog::Log(LOGDEBUG, "FindIdrSlice: found NAL_IDR_SLICE"); - rtn = true; - break; - case AVC_NAL_SEI: -- CLog::Log(LOGDEBUG, "FindIdrSlice: found NAL_SEI"); - break; - case AVC_NAL_SPS: -- CLog::Log(LOGDEBUG, "FindIdrSlice: found NAL_SPS"); - break; - case AVC_NAL_PPS: -- CLog::Log(LOGDEBUG, "FindIdrSlice: found NAL_PPS"); -+ break; -+ default: - break; - } -- buf += src_length; - } - - return rtn; -@@ -646,6 +636,11 @@ int CBitstreamConverter::GetExtraSize() const - return m_extrasize; - } - -+bool CBitstreamConverter::IdrFramePassed() const -+{ -+ return m_sps_pps_context.first_idr == 0; -+} -+ - bool CBitstreamConverter::BitstreamConvertInitAVC(void *in_extradata, int in_extrasize) - { - // based on h264_mp4toannexb_bsf.c (ffmpeg) -diff --git a/xbmc/utils/BitstreamConverter.h b/xbmc/utils/BitstreamConverter.h -index 9045ef9..8b66f0f 100644 ---- a/xbmc/utils/BitstreamConverter.h -+++ b/xbmc/utils/BitstreamConverter.h -@@ -157,6 +157,7 @@ class CBitstreamConverter - int GetConvertSize() const; - uint8_t* GetExtraData(void) const; - int GetExtraSize() const; -+ bool IdrFramePassed() const; - - static void bits_reader_set( bits_reader_t *br, uint8_t *buf, int len ); - static uint32_t read_bits( bits_reader_t *br, int nbits ); - -From 3164250375995ae6af361f5c946540c2199fe053 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Thu, 8 Dec 2016 08:37:36 +0100 -Subject: [PATCH 15/32] IDR and SEI:recovery are keyframes -> implement - SEI:recovery_count - ---- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 7 +- - xbmc/utils/BitstreamConverter.cpp | 91 +++++++++++++++++++--- - xbmc/utils/BitstreamConverter.h | 6 +- - 3 files changed, 90 insertions(+), 14 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index 4a0598c..386aac2 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -127,6 +127,7 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - { - m_bitstream = new CBitstreamConverter; - m_bitstream->Open(m_hints.codec, (uint8_t*)m_hints.extradata, m_hints.extrasize, true); -+ m_bitstream->ResetKeyframe(); - // make sure we do not leak the existing m_hints.extradata - free(m_hints.extradata); - m_hints.extrasize = m_bitstream->GetExtraSize(); -@@ -285,7 +286,7 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - if (!m_bitstream->Convert(pData, iSize)) - return VC_ERROR; - -- if (!m_bitstream->IdrFramePassed()) -+ if (!m_bitstream->HasKeyframe()) - { - CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for IDR frame", __MODULE_NAME__); - return VC_BUFFER; -@@ -295,7 +296,7 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - } - else if (!m_has_idr && m_bitparser) - { -- if (!m_bitparser->FindIdrSlice(pData, iSize)) -+ if (!m_bitparser->HasKeyframe(pData, iSize)) - { - CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for IDR frame", __MODULE_NAME__); - return VC_BUFFER; -@@ -327,6 +328,8 @@ void CDVDVideoCodecAmlogic::Reset(void) - m_Codec->Reset(); - m_mpeg2_sequence_pts = 0; - m_has_idr = false; -+ if (m_bitstream && m_hints.codec == AV_CODEC_ID_H264) -+ m_bitstream->ResetKeyframe(); - } - - bool CDVDVideoCodecAmlogic::GetPicture(DVDVideoPicture* pDvdVideoPicture) -diff --git a/xbmc/utils/BitstreamConverter.cpp b/xbmc/utils/BitstreamConverter.cpp -index f42c50c4..6cb25fd 100644 ---- a/xbmc/utils/BitstreamConverter.cpp -+++ b/xbmc/utils/BitstreamConverter.cpp -@@ -72,6 +72,34 @@ enum { - HEVC_NAL_SEI_SUFFIX = 40 - }; - -+enum { -+ SEI_BUFFERING_PERIOD = 0, -+ SEI_PIC_TIMING, -+ SEI_PAN_SCAN_RECT, -+ SEI_FILLER_PAYLOAD, -+ SEI_USER_DATA_REGISTERED_ITU_T_T35, -+ SEI_USER_DATA_UNREGISTERED, -+ SEI_RECOVERY_POINT, -+ SEI_DEC_REF_PIC_MARKING_REPETITION, -+ SEI_SPARE_PIC, -+ SEI_SCENE_INFO, -+ SEI_SUB_SEQ_INFO, -+ SEI_SUB_SEQ_LAYER_CHARACTERISTICS, -+ SEI_SUB_SEQ_CHARACTERISTICS, -+ SEI_FULL_FRAME_FREEZE, -+ SEI_FULL_FRAME_FREEZE_RELEASE, -+ SEI_FULL_FRAME_SNAPSHOT, -+ SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START, -+ SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END, -+ SEI_MOTION_CONSTRAINED_SLICE_GROUP_SET, -+ SEI_FILM_GRAIN_CHARACTERISTICS, -+ SEI_DEBLOCKING_FILTER_DISPLAY_PREFERENCE, -+ SEI_STEREO_VIDEO_INFO, -+ SEI_POST_FILTER_HINTS, -+ SEI_TONE_MAPPING -+}; -+ -+ - //////////////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////////////// - // GStreamer h264 parser -@@ -205,6 +233,34 @@ static const uint8_t* avc_find_startcode(const uint8_t *p, const uint8_t *end) - return out; - } - -+static bool has_sei_recovery_point(const uint8_t *p, const uint8_t *end) -+{ -+ int pt(0), ps(0), offset(1); -+ -+ do -+ { -+ pt = 0; -+ do { -+ pt += p[offset]; -+ } while (p[offset++] == 0xFF); -+ -+ ps = 0; -+ do { -+ ps += p[offset]; -+ } while (p[offset++] == 0xFF); -+ -+ if (pt == SEI_RECOVERY_POINT) -+ { -+ nal_bitstream bs; -+ nal_bs_init(&bs, p + offset, ps); -+ return nal_bs_read_ue(&bs) >= 0; -+ } -+ offset += ps; -+ } while(p + offset < end && p[offset] != 0x80); -+ -+ return false; -+} -+ - //////////////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////////////////// - CBitstreamParser::CBitstreamParser() -@@ -255,16 +311,16 @@ const uint8_t* CBitstreamParser::find_start_code(const uint8_t *p, - return p + 4; - } - --bool CBitstreamParser::FindIdrSlice(const uint8_t *buf, int buf_size) -+bool CBitstreamParser::HasKeyframe(const uint8_t *buf, int buf_size) - { - if (!buf) - return false; - - bool rtn = false; - uint32_t state = -1; -- const uint8_t *buf_end = buf + buf_size; -+ const uint8_t *buf_begin, *buf_end = buf + buf_size; - -- for(;;) -+ for(;rtn == false;) - { - buf = find_start_code(buf, buf_end, &state); - if (buf >= buf_end) -@@ -280,6 +336,10 @@ bool CBitstreamParser::FindIdrSlice(const uint8_t *buf, int buf_size) - rtn = true; - break; - case AVC_NAL_SEI: -+ buf_begin = buf; -+ buf = find_start_code(buf, buf_end, &state) - 4; -+ if (has_sei_recovery_point(buf_begin, buf)) -+ rtn = true; - break; - case AVC_NAL_SPS: - break; -@@ -308,6 +368,7 @@ CBitstreamConverter::CBitstreamConverter() - m_convert_3byteTo4byteNALSize = false; - m_convert_bytestream = false; - m_sps_pps_context.sps_pps_data = NULL; -+ m_has_keyframe = true; - } - - CBitstreamConverter::~CBitstreamConverter() -@@ -387,7 +448,7 @@ bool CBitstreamConverter::Open(enum AVCodecID codec, uint8_t *in_extradata, int - // are valid, setup to convert 3 byte NAL sizes to 4 byte. - in_extradata[4] = 0xFF; - m_convert_3byteTo4byteNALSize = true; -- -+ - m_extradata = (uint8_t *)av_malloc(in_extrasize); - memcpy(m_extradata, in_extradata, in_extrasize); - m_extrasize = in_extrasize; -@@ -498,7 +559,7 @@ void CBitstreamConverter::Close(void) - bool CBitstreamConverter::Convert(uint8_t *pData, int iSize) - { - if (m_convertBuffer) -- { -+ { - av_free(m_convertBuffer); - m_convertBuffer = NULL; - } -@@ -548,7 +609,7 @@ bool CBitstreamConverter::Convert(uint8_t *pData, int iSize) - { - m_inputSize = iSize; - m_inputBuffer = pData; -- -+ - if (m_convert_bytestream) - { - if(m_convertBuffer) -@@ -636,9 +697,14 @@ int CBitstreamConverter::GetExtraSize() const - return m_extrasize; - } - --bool CBitstreamConverter::IdrFramePassed() const -+void CBitstreamConverter::ResetKeyframe(void) -+{ -+ m_has_keyframe = false; -+} -+ -+bool CBitstreamConverter::HasKeyframe() const - { -- return m_sps_pps_context.first_idr == 0; -+ return m_has_keyframe; - } - - bool CBitstreamConverter::BitstreamConvertInitAVC(void *in_extradata, int in_extrasize) -@@ -855,7 +921,7 @@ bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t ** - int i; - uint8_t *buf = pData; - uint32_t buf_size = iSize; -- uint8_t unit_type, nal_sps, nal_pps; -+ uint8_t unit_type, nal_sps, nal_pps, nal_sei; - int32_t nal_size; - uint32_t cumul_size = 0; - const uint8_t *buf_end = buf + buf_size; -@@ -865,10 +931,12 @@ bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t ** - case AV_CODEC_ID_H264: - nal_sps = AVC_NAL_SPS; - nal_pps = AVC_NAL_PPS; -+ nal_sei = AVC_NAL_SEI; - break; - case AV_CODEC_ID_HEVC: - nal_sps = HEVC_NAL_SPS; - nal_pps = HEVC_NAL_PPS; -+ nal_sei = HEVC_NAL_SEI_PREFIX; - break; - default: - return false; -@@ -899,7 +967,10 @@ bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t ** - if (m_sps_pps_context.first_idr && (unit_type == nal_sps || unit_type == nal_pps)) - m_sps_pps_context.idr_sps_pps_seen = 1; - -- // prepend only to the first access unit of an IDR picture, if no sps/pps already present -+ if (!m_has_keyframe && (IsIDR(unit_type) || (unit_type == nal_sei && has_sei_recovery_point(buf, buf + nal_size)))) -+ m_has_keyframe = true; -+ -+ // prepend only to the first access unit of an IDR picture, if no sps/pps already present - if (m_sps_pps_context.first_idr && IsIDR(unit_type) && !m_sps_pps_context.idr_sps_pps_seen) - { - BitstreamAllocAndCopy(poutbuf, poutbuf_size, -diff --git a/xbmc/utils/BitstreamConverter.h b/xbmc/utils/BitstreamConverter.h -index 8b66f0f..d953907 100644 ---- a/xbmc/utils/BitstreamConverter.h -+++ b/xbmc/utils/BitstreamConverter.h -@@ -137,7 +137,7 @@ class CBitstreamParser - - static bool Open(); - static void Close(); -- static bool FindIdrSlice(const uint8_t *buf, int buf_size); -+ static bool HasKeyframe(const uint8_t *buf, int buf_size); - - protected: - static const uint8_t* find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state); -@@ -157,7 +157,8 @@ class CBitstreamConverter - int GetConvertSize() const; - uint8_t* GetExtraData(void) const; - int GetExtraSize() const; -- bool IdrFramePassed() const; -+ void ResetKeyframe(void); -+ bool HasKeyframe() const; - - static void bits_reader_set( bits_reader_t *br, uint8_t *buf, int len ); - static uint32_t read_bits( bits_reader_t *br, int nbits ); -@@ -208,5 +209,6 @@ class CBitstreamConverter - bool m_convert_3byteTo4byteNALSize; - bool m_convert_bytestream; - AVCodecID m_codec; -+ bool m_has_keyframe; - }; - - -From ea31d4f1ae26060752caaa87e71f840134768b5b Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Thu, 8 Dec 2016 14:47:02 +0100 -Subject: [PATCH 16/32] Fix BitsreamParser SEI start adress - ---- - .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 14 +++++++------- - .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h | 2 +- - xbmc/utils/BitstreamConverter.cpp | 2 +- - 3 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index 386aac2..a6803e4 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -54,7 +54,7 @@ CDVDVideoCodecAmlogic::CDVDVideoCodecAmlogic(CProcessInfo &processInfo) : CDVDVi - m_bitstream(NULL), - m_opened(false), - m_drop(false), -- m_has_idr(false) -+ m_has_keyframe(false) - { - pthread_mutex_init(&m_queue_mutex, NULL); - } -@@ -244,7 +244,7 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - m_processInfo.SetVideoDeintMethod("hardware"); - m_processInfo.SetVideoDAR(m_hints.aspect); - -- m_has_idr = false; -+ m_has_keyframe = false; - - CLog::Log(LOGINFO, "%s: Opened Amlogic Codec", __MODULE_NAME__); - return true; -@@ -288,21 +288,21 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - - if (!m_bitstream->HasKeyframe()) - { -- CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for IDR frame", __MODULE_NAME__); -+ CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for keyframe (bitstream)", __MODULE_NAME__); - return VC_BUFFER; - } - pData = m_bitstream->GetConvertBuffer(); - iSize = m_bitstream->GetConvertSize(); - } -- else if (!m_has_idr && m_bitparser) -+ else if (!m_has_keyframe && m_bitparser) - { - if (!m_bitparser->HasKeyframe(pData, iSize)) - { -- CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for IDR frame", __MODULE_NAME__); -+ CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for keyframe (bitparser)", __MODULE_NAME__); - return VC_BUFFER; - } - else -- m_has_idr = true; -+ m_has_keyframe = true; - } - FrameRateTracking( pData, iSize, dts, pts); - } -@@ -327,7 +327,7 @@ void CDVDVideoCodecAmlogic::Reset(void) - - m_Codec->Reset(); - m_mpeg2_sequence_pts = 0; -- m_has_idr = false; -+ m_has_keyframe = false; - if (m_bitstream && m_hints.codec == AV_CODEC_ID_H264) - m_bitstream->ResetKeyframe(); - } -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -index 0a2c6bb..a494ace 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -@@ -99,7 +99,7 @@ class CDVDVideoCodecAmlogic : public CDVDVideoCodec - mpeg2_sequence *m_mpeg2_sequence; - double m_mpeg2_sequence_pts; - bool m_drop; -- bool m_has_idr; -+ bool m_has_keyframe; - - CBitstreamParser *m_bitparser; - CBitstreamConverter *m_bitstream; -diff --git a/xbmc/utils/BitstreamConverter.cpp b/xbmc/utils/BitstreamConverter.cpp -index 6cb25fd..be942a1 100644 ---- a/xbmc/utils/BitstreamConverter.cpp -+++ b/xbmc/utils/BitstreamConverter.cpp -@@ -336,7 +336,7 @@ bool CBitstreamParser::HasKeyframe(const uint8_t *buf, int buf_size) - rtn = true; - break; - case AVC_NAL_SEI: -- buf_begin = buf; -+ buf_begin = buf - 1; - buf = find_start_code(buf, buf_end, &state) - 4; - if (has_sei_recovery_point(buf_begin, buf)) - rtn = true; - -From 2400cddfebd2d0120a396aff5cc7e3259273ea35 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Tue, 13 Dec 2016 12:07:00 +0100 -Subject: [PATCH 17/32] wait for next displayed frame for sync measurement - ---- - .../VideoRenderers/HwDecRender/RendererAML.cpp | 45 ++++++++++++++-------- - .../VideoRenderers/HwDecRender/RendererAML.h | 2 +- - 2 files changed, 31 insertions(+), 16 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index c45e94f..54a2588 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -56,7 +56,7 @@ static void set_pts(const char *strPath, int pts) - } - - CRendererAML::CRendererAML() -- : m_prevPts(-1) -+ : m_prevVPts(-1) - , m_bConfigured(false) - , m_iRenderBuffer(0) - , m_diff_counter(0) -@@ -181,7 +181,7 @@ EINTERLACEMETHOD CRendererAML::AutoInterlaceMethod() - - void CRendererAML::Reset() - { -- m_prevPts = 0; -+ m_prevVPts = -1; - m_diff_counter = 0; - } - -@@ -192,33 +192,48 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - CDVDAmlogicInfo *amli = static_cast(m_buffers[m_iRenderBuffer].hwDec); - CAMLCodec *amlcodec = amli ? amli->getAmlCodec() : 0; - -+ int videopts(0); - if(amlcodec) -- amlcodec->PollFrame(); -+ { -+ unsigned int i(0); -+ do { -+ amlcodec->PollFrame(); -+ videopts = get_pts("/sys/class/tsync/pts_video"); -+ } while (i++ < 5 && videopts == m_prevVPts); -+ } -+ m_prevVPts = videopts; - -- if (amli && amli->GetOmxPts() != m_prevPts) -+ if (amli) - { -- m_prevPts = amli->GetOmxPts(); -+ int pts = amli->GetOmxPts(); - - int pcrscr(get_pts("/sys/class/tsync/pts_pcrscr")); -- m_diff_counter += static_cast((pcrscr - m_prevPts)*1.1 / amli->GetAmlDuration()); -+ int diff(static_cast((pcrscr - pts)*1.1 / amli->GetAmlDuration())); -+ m_diff_counter += diff; -+ -+ if(!diff) -+ { -+ if (m_diff_counter > 0) -+ --m_diff_counter; -+ else if (m_diff_counter < 0) -+ ++m_diff_counter; -+ } - -- if (abs(m_diff_counter) > 2) -+ if (abs(m_diff_counter) > 10) - { -- int videopts(get_pts("/sys/class/tsync/pts_video")); -- set_pts("/sys/class/tsync/pts_pcrscr", m_prevPts); -- CLog::Log(LOGDEBUG, "RenderUpdate: Adjusting: ptsclock:%d ptsscr:%d vpts:%d diff:%d", m_prevPts, pcrscr, videopts, m_diff_counter); -- pcrscr = m_prevPts; -+ set_pts("/sys/class/tsync/pts_pcrscr", pts); -+ CLog::Log(LOGDEBUG, "RenderUpdate: Adjusting: ptsclock:%d ptsscr:%d vpts:%d dur:%d diff:%d diffsum:%d", pts, pcrscr, videopts,amli->GetAmlDuration(), diff, m_diff_counter); -+ pcrscr = pts; - m_diff_counter = 0; - } - else if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- int videopts(get_pts("/sys/class/tsync/pts_video")); -- CLog::Log(LOGDEBUG, "RenderUpdate: ptsclock:%d ptsscr:%d vpts:%d diff:%d", m_prevPts, pcrscr, videopts, m_diff_counter); -+ CLog::Log(LOGDEBUG, "RenderUpdate: ptsclock:%d ptsscr:%d vpts:%d diff:%d", pts, pcrscr, videopts, m_diff_counter); - } -+ - SysfsUtils::SetInt("/sys/module/amvideo/parameters/omx_pts", pcrscr); - -- if (amlcodec) -- amlcodec->SetVideoRect(m_sourceRect, m_destRect); -+ amlcodec->SetVideoRect(m_sourceRect, m_destRect); - } - } - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -index 0d9f126..7b4203b 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -@@ -70,7 +70,7 @@ class CRendererAML : public CBaseRenderer - int duration; - } m_buffers[m_numRenderBuffers]; - -- int m_prevPts; -+ int m_prevVPts; - bool m_bConfigured; - int m_diff_counter; - }; - -From d675e0689584f84627604a07f6a5b3d62baba88a Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Tue, 13 Dec 2016 21:23:34 +0100 -Subject: [PATCH 18/32] check for amlclodec != 0 - ---- - xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index 54a2588..cb000bb 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -233,7 +233,8 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - - SysfsUtils::SetInt("/sys/module/amvideo/parameters/omx_pts", pcrscr); - -- amlcodec->SetVideoRect(m_sourceRect, m_destRect); -+ if(amlcodec) -+ amlcodec->SetVideoRect(m_sourceRect, m_destRect); - } - } - - -From a2260af19fce474edf1378fc636feecbfc84b03d Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Tue, 13 Dec 2016 23:18:27 +0100 -Subject: [PATCH 19/32] resume aml on time we got first picture - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 8 ++++++-- - xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp | 2 +- - 2 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 405e36c..47fca3c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1617,7 +1617,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - am_private->dumpdemux = false; - dumpfile_open(am_private); - -- m_dll->codec_resume(&am_private->vcodec); -+ m_dll->codec_pause(&am_private->vcodec); - - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); - m_dll->codec_set_video_delay_limited_ms(&am_private->vcodec, 1000); -@@ -1752,9 +1752,10 @@ void CAMLCodec::Reset() - // restore the speed (some amcodec versions require this) - if (m_speed != DVD_PLAYSPEED_NORMAL) - { -- m_dll->codec_resume(&am_private->vcodec); - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); - } -+ m_dll->codec_pause(&am_private->vcodec); -+ - // reset the decoder - m_dll->codec_reset(&am_private->vcodec); - m_dll->codec_set_video_delay_limited_ms(&am_private->vcodec, 1000); -@@ -1850,7 +1851,10 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - Reset(); - } - if ((m_state & STATE_PREFILLED) == 0 && timesize >= 1.0) -+ { -+ m_dll->codec_resume(&am_private->vcodec); - m_state |= STATE_PREFILLED; -+ } - } - - int rtn(0); -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index cb000bb..e6b39f3 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -219,7 +219,7 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - ++m_diff_counter; - } - -- if (abs(m_diff_counter) > 10) -+ if (abs(m_diff_counter) > 5) - { - set_pts("/sys/class/tsync/pts_pcrscr", pts); - CLog::Log(LOGDEBUG, "RenderUpdate: Adjusting: ptsclock:%d ptsscr:%d vpts:%d dur:%d diff:%d diffsum:%d", pts, pcrscr, videopts,amli->GetAmlDuration(), diff, m_diff_counter); - -From 94031c39a596e7ac14f77170565a1a2c0f969802 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Wed, 14 Dec 2016 14:22:11 +0100 -Subject: [PATCH 20/32] more log / fix start-adjusting - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 9 ++++++--- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 4 ++-- - 2 files changed, 8 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 47fca3c..4935453 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1775,6 +1775,7 @@ void CAMLCodec::Reset() - // reset some interal vars - m_cur_pts = INT64_0; - m_state = 0; -+ m_start_adj = 0; - SetSpeed(m_speed); - } - -@@ -1884,10 +1885,12 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - else - memset(&vfs, 0, sizeof(vfs)); - -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d dts_in: %0.6f, pts_in: %0.6f, ptsOut:%0.6f, amlpts:%d vfs:[%d-%d-%d-%d] timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %llu, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d vfs:[%d-%d-%d-%d] timesize:%0.2f", - rtn, -- static_cast(dts)/DVD_TIME_BASE, -- static_cast(pts)/DVD_TIME_BASE, -+ iSize, -+ static_cast(dts)/DVD_TIME_BASE, am_private->am_pkt.avdts, -+ static_cast(pts)/DVD_TIME_BASE, am_private->am_pkt.avpts, -+ m_start_adj, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), - vfs.vf_pool_size, vfs.buf_free_num,vfs.buf_recycle_num,vfs.buf_avail_num, -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 0e5334bd..b18e6e2 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -50,8 +50,8 @@ class CAMLCodec - double GetTimeSize(); - void SetVideoRect(const CRect &SrcRect, const CRect &DestRect); - void SetVideoRate(int videoRate); -- int64_t GetCurPts() const { return m_cur_pts; } -- int GetOMXPts() const { return static_cast(m_cur_pts - m_start_adj); } -+ int64_t GetCurPts() const { return m_cur_pts + m_start_adj; } -+ int GetOMXPts() const { return static_cast(m_cur_pts); } - static float OMXPtsToSeconds(int omxpts); - static int OMXDurationToNs(int duration); - int GetAmlDuration() const; - -From 2dec8f56f8aa7614b48527739d98b6fc2d0e246d Mon Sep 17 00:00:00 2001 -From: peak3d -Date: Tue, 20 Dec 2016 13:53:03 +0100 -Subject: [PATCH 21/32] [AML] queue_buf - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 87 ++++++++++++++++------ - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 4 +- - .../VideoRenderers/HwDecRender/RendererAML.cpp | 15 ++++ - 3 files changed, 84 insertions(+), 22 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 4935453..62a7a42 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -47,6 +47,7 @@ - #include - #include - #include -+#include - - // amcodec include - extern "C" { -@@ -292,7 +293,10 @@ static const int64_t INT64_0 = 0x8000000000000000ULL; - #define SYNC_OUTSIDE (2) - - // missing tags -+#ifndef CODEC_TAG_VC_1 - #define CODEC_TAG_VC_1 (0x312D4356) -+#endif -+ - #define CODEC_TAG_RV30 (0x30335652) - #define CODEC_TAG_RV40 (0x30345652) - #define CODEC_TAG_MJPEG (0x47504a4d) -@@ -385,9 +389,10 @@ typedef struct vframe_states - int buf_avail_num; - } vframe_states_t; - -+#ifndef AMSTREAM_IOC_VF_STATUS - #define AMSTREAM_IOC_MAGIC 'S' - #define AMSTREAM_IOC_VF_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x60, unsigned long) -- -+#endif - - /*************************************************************************/ - /*************************************************************************/ -@@ -1637,7 +1642,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - if (strScaler.find("enabled") == std::string::npos) // Scaler not enabled, use screen size - m_display_rect = CRect(0, 0, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenWidth, CDisplaySettings::GetInstance().GetCurrentResolutionInfo().iScreenHeight); - -- SysfsUtils::SetInt("/sys/class/video/freerun_mode", 0); -+ SysfsUtils::SetInt("/sys/class/video/freerun_mode", 1); - - - struct utsname un; -@@ -1673,8 +1678,17 @@ bool CAMLCodec::OpenAmlVideo(const CDVDStreamInfo &hints) - m_defaultVfmMap = GetVfmMap("default"); - SetVfmMap("default", "decoder ppmgr deinterlace amlvideo amvideo"); - -- SysfsUtils::SetInt("/sys/module/amlvideodri/parameters/freerun_mode", 1); -+ SysfsUtils::SetInt("/sys/module/amlvideodri/parameters/freerun_mode", 3); - -+ struct v4l2_requestbuffers rbuf = {0}; -+ rbuf.count = 1; -+ rbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ rbuf.memory = V4L2_MEMORY_USERPTR; -+ if (m_amlVideoFile->IOControl(VIDIOC_REQBUFS, &rbuf) < 0) -+ { -+ if (errno != EAGAIN) -+ CLog::Log(LOGERROR, "CAMLCodec::OpenAML - VIDIOC_REQBUFS failed: %s", strerror(errno)); -+ } - return true; - } - -@@ -1706,6 +1720,15 @@ void CAMLCodec::SetVfmMap(const std::string &name, const std::string &map) - SysfsUtils::SetString("/sys/class/vfm/map", "add " + name + " " + map); - } - -+unsigned int CAMLCodec::GetDecodedFrameCount() -+{ -+ vframe_states_t vfs; -+ if(m_amlVideoFile->IOControl(AMSTREAM_IOC_VF_STATUS, &vfs) == 0) -+ return vfs.buf_avail_num; -+ else -+ return 0; -+} -+ - void CAMLCodec::CloseDecoder() - { - CLog::Log(LOGDEBUG, "CAMLCodec::CloseDecoder"); -@@ -1713,7 +1736,7 @@ void CAMLCodec::CloseDecoder() - // never leave vcodec ff/rw or paused. - if (m_speed != DVD_PLAYSPEED_NORMAL) - { -- m_dll->codec_resume(&am_private->vcodec); -+ //m_dll->codec_resume(&am_private->vcodec); - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); - } - m_dll->codec_close(&am_private->vcodec); -@@ -1853,7 +1876,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - } - if ((m_state & STATE_PREFILLED) == 0 && timesize >= 1.0) - { -- m_dll->codec_resume(&am_private->vcodec); -+ //m_dll->codec_resume(&am_private->vcodec); - m_state |= STATE_PREFILLED; - } - } -@@ -1875,19 +1898,12 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { - vframe_states_t vfs; -- int fd(open("/dev/amvideo", O_RDONLY)); -- if(fd) -- { -- if (ioctl(fd, AMSTREAM_IOC_VF_STATUS, &vfs) != 0) -- memset(&vfs, 0, sizeof(vfs)); -- close(fd); -- } -- else -+ if (ioctl(am_private->vcodec.handle, AMSTREAM_IOC_VF_STATUS, &vfs) != 0) - memset(&vfs, 0, sizeof(vfs)); - -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %llu, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d vfs:[%d-%d-%d-%d] timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d vfs:[0x%x-0x%x-0x%x-0x%x] timesize:%0.2f", - rtn, -- iSize, -+ static_cast(iSize), - static_cast(dts)/DVD_TIME_BASE, am_private->am_pkt.avdts, - static_cast(pts)/DVD_TIME_BASE, am_private->am_pkt.avpts, - m_start_adj, -@@ -1903,7 +1919,37 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - - int CAMLCodec::PollFrame() - { -- return m_dll->codec_poll_cntl(&am_private->vcodec); -+ struct pollfd codec_poll_fd[1]; -+ -+ if (am_private->vcodec.handle <= 0) { -+ return 0; -+ } -+ -+ codec_poll_fd[0].fd = am_private->vcodec.handle; -+ codec_poll_fd[0].events = POLLOUT; -+ -+ return poll(codec_poll_fd, 1, 100); -+} -+ -+int CAMLCodec::ReleaseFrame(unsigned long pts) -+{ -+ int ret; -+ v4l2_buffer vbuf = { 0 }; -+ vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ vbuf.memory = V4L2_MEMORY_USERPTR; -+ -+ if (m_ptsIs64us) -+ { -+ uint64_t us = (static_cast(pts) * DVD_TIME_BASE) / PTS_FREQ; -+ vbuf.timestamp.tv_sec = us >> 32; -+ vbuf.timestamp.tv_usec = us & 0xFFFFFFFF; -+ } -+ else -+ vbuf.timestamp.tv_usec = pts; -+ -+ if ((ret = m_amlVideoFile->IOControl(VIDIOC_QBUF, &vbuf)) < 0) -+ CLog::Log(LOGERROR, "CAMLCodec::ReleaseFrame - VIDIOC_QBUF failed: %s", strerror(errno)); -+ return ret; - } - - int CAMLCodec::DequeueBuffer(int64_t &pts) -@@ -1951,8 +1997,7 @@ bool CAMLCodec::GetPicture(DVDVideoPicture *pDvdVideoPicture) - pDvdVideoPicture->dts = DVD_NOPTS_VALUE; - pDvdVideoPicture->pts = (double)m_cur_pts / PTS_FREQ * DVD_TIME_BASE; - -- //AML video is ~ 2 frames to fast - sync audio -- pDvdVideoPicture->pts += 2*pDvdVideoPicture->iDuration; -+ CLog::Log(LOGERROR, "CAMLCodec::GetPicture pts: %lld", m_cur_pts); - - return true; - } -@@ -1974,15 +2019,15 @@ void CAMLCodec::SetSpeed(int speed) - switch(speed) - { - case DVD_PLAYSPEED_PAUSE: -- m_dll->codec_pause(&am_private->vcodec); -+ //m_dll->codec_pause(&am_private->vcodec); - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); - break; - case DVD_PLAYSPEED_NORMAL: -- m_dll->codec_resume(&am_private->vcodec); -+ //m_dll->codec_resume(&am_private->vcodec); - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_NONE); - break; - default: -- m_dll->codec_resume(&am_private->vcodec); -+ //m_dll->codec_resume(&am_private->vcodec); - if ((am_private->video_format == VFORMAT_H264) || (am_private->video_format == VFORMAT_H264_4K2K)) - m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_FFFB); - else -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index b18e6e2..6348647 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -51,11 +51,12 @@ class CAMLCodec - void SetVideoRect(const CRect &SrcRect, const CRect &DestRect); - void SetVideoRate(int videoRate); - int64_t GetCurPts() const { return m_cur_pts + m_start_adj; } -- int GetOMXPts() const { return static_cast(m_cur_pts); } -+ int GetOMXPts() const { return static_cast(m_cur_pts); } - static float OMXPtsToSeconds(int omxpts); - static int OMXDurationToNs(int duration); - int GetAmlDuration() const; - int PollFrame(); -+ int ReleaseFrame(unsigned long pts); - - private: - void ShowMainVideo(const bool show); -@@ -69,6 +70,7 @@ class CAMLCodec - void CloseAmlVideo(); - std::string GetVfmMap(const std::string &name); - void SetVfmMap(const std::string &name, const std::string &map); -+ unsigned int GetDecodedFrameCount(); - int DequeueBuffer(int64_t &pts); - - DllLibAmCodec *m_dll; -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index e6b39f3..d390c08 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -192,6 +192,20 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - CDVDAmlogicInfo *amli = static_cast(m_buffers[m_iRenderBuffer].hwDec); - CAMLCodec *amlcodec = amli ? amli->getAmlCodec() : 0; - -+#if 1 -+ if(amlcodec) -+ { -+ int pts = amli->GetOmxPts(); -+ if (pts != m_prevVPts) -+ { -+ CLog::Log(LOGDEBUG, "RenderUpdate: ReleaseFrame with pts:%d", pts); -+ amlcodec->ReleaseFrame(pts); -+ amlcodec->SetVideoRect(m_sourceRect, m_destRect); -+ m_prevVPts = pts; -+ } -+ amlcodec->PollFrame(); -+ } -+#else - int videopts(0); - if(amlcodec) - { -@@ -236,6 +250,7 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - if(amlcodec) - amlcodec->SetVideoRect(m_sourceRect, m_destRect); - } -+#endif - } - - #endif - -From e1557505b865a912a87e80258b5ad8ad3306cf6a Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Wed, 21 Dec 2016 23:38:53 +0100 -Subject: [PATCH 22/32] videosync impl. / cleanup - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 39 ++++------ - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 1 - - .../VideoRenderers/HwDecRender/RendererAML.cpp | 77 +------------------ - .../VideoRenderers/HwDecRender/RendererAML.h | 1 - - xbmc/video/VideoReferenceClock.cpp | 5 ++ - xbmc/video/videosync/CMakeLists.txt | 5 ++ - xbmc/video/videosync/VideoSyncAML.cpp | 86 ++++++++++++++++++++++ - xbmc/video/videosync/VideoSyncAML.h | 41 +++++++++++ - 8 files changed, 154 insertions(+), 101 deletions(-) - create mode 100644 xbmc/video/videosync/VideoSyncAML.cpp - create mode 100644 xbmc/video/videosync/VideoSyncAML.h - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 62a7a42..d081c21 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -54,6 +54,8 @@ extern "C" { - #include - } // extern "C" - -+CEvent g_aml_sync_event; -+ - class PosixFile - { - public: -@@ -1720,15 +1722,6 @@ void CAMLCodec::SetVfmMap(const std::string &name, const std::string &map) - SysfsUtils::SetString("/sys/class/vfm/map", "add " + name + " " + map); - } - --unsigned int CAMLCodec::GetDecodedFrameCount() --{ -- vframe_states_t vfs; -- if(m_amlVideoFile->IOControl(AMSTREAM_IOC_VF_STATUS, &vfs) == 0) -- return vfs.buf_avail_num; -- else -- return 0; --} -- - void CAMLCodec::CloseDecoder() - { - CLog::Log(LOGDEBUG, "CAMLCodec::CloseDecoder"); -@@ -1897,11 +1890,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- vframe_states_t vfs; -- if (ioctl(am_private->vcodec.handle, AMSTREAM_IOC_VF_STATUS, &vfs) != 0) -- memset(&vfs, 0, sizeof(vfs)); -- -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d vfs:[0x%x-0x%x-0x%x-0x%x] timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d timesize:%0.2f", - rtn, - static_cast(iSize), - static_cast(dts)/DVD_TIME_BASE, am_private->am_pkt.avdts, -@@ -1909,7 +1898,6 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_start_adj, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), -- vfs.vf_pool_size, vfs.buf_free_num,vfs.buf_recycle_num,vfs.buf_avail_num, - timesize - ); - } -@@ -1919,16 +1907,21 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - - int CAMLCodec::PollFrame() - { -- struct pollfd codec_poll_fd[1]; -+ struct pollfd codec_poll_fd[1]; - -- if (am_private->vcodec.handle <= 0) { -- return 0; -- } -+ if (am_private->vcodec.handle <= 0) { -+ return 0; -+ } - -- codec_poll_fd[0].fd = am_private->vcodec.handle; -- codec_poll_fd[0].events = POLLOUT; -+ codec_poll_fd[0].fd = am_private->vcodec.handle; -+ codec_poll_fd[0].events = POLLOUT; - -- return poll(codec_poll_fd, 1, 100); -+ if (poll(codec_poll_fd, 1, 100) == 0) -+ { -+ g_aml_sync_event.Set(); -+ return 0; -+ } -+ return false; - } - - int CAMLCodec::ReleaseFrame(unsigned long pts) -@@ -1997,8 +1990,6 @@ bool CAMLCodec::GetPicture(DVDVideoPicture *pDvdVideoPicture) - pDvdVideoPicture->dts = DVD_NOPTS_VALUE; - pDvdVideoPicture->pts = (double)m_cur_pts / PTS_FREQ * DVD_TIME_BASE; - -- CLog::Log(LOGERROR, "CAMLCodec::GetPicture pts: %lld", m_cur_pts); -- - return true; - } - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 6348647..1fb95b1 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -70,7 +70,6 @@ class CAMLCodec - void CloseAmlVideo(); - std::string GetVfmMap(const std::string &name); - void SetVfmMap(const std::string &name, const std::string &map); -- unsigned int GetDecodedFrameCount(); - int DequeueBuffer(int64_t &pts); - - DllLibAmCodec *m_dll; -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index d390c08..9ebcbf6 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -30,36 +30,10 @@ - #include "cores/VideoPlayer/VideoRenderers/RenderCapture.h" - #include "settings/AdvancedSettings.h" - --static int get_pts(const char *strPath) --{ -- int fd = open(strPath, O_RDONLY); -- if (fd >= 0) -- { -- char pts_str[64]; -- int size = read(fd, pts_str, sizeof(pts_str)); -- close(fd); -- return strtol(pts_str, NULL, 16); -- } -- return 0; --} -- --static void set_pts(const char *strPath, int pts) --{ -- int fd = open(strPath, O_WRONLY); -- if (fd >= 0) -- { -- char pts_str[64]; -- sprintf(pts_str, "0x%x", pts); -- write(fd, pts_str, strlen(pts_str)); -- close(fd); -- } --} -- - CRendererAML::CRendererAML() - : m_prevVPts(-1) - , m_bConfigured(false) - , m_iRenderBuffer(0) -- , m_diff_counter(0) - { - } - -@@ -182,7 +156,6 @@ EINTERLACEMETHOD CRendererAML::AutoInterlaceMethod() - void CRendererAML::Reset() - { - m_prevVPts = -1; -- m_diff_counter = 0; - } - - void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) -@@ -192,65 +165,19 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - CDVDAmlogicInfo *amli = static_cast(m_buffers[m_iRenderBuffer].hwDec); - CAMLCodec *amlcodec = amli ? amli->getAmlCodec() : 0; - --#if 1 - if(amlcodec) - { - int pts = amli->GetOmxPts(); - if (pts != m_prevVPts) - { -- CLog::Log(LOGDEBUG, "RenderUpdate: ReleaseFrame with pts:%d", pts); -+ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -+ CLog::Log(LOGDEBUG, "RenderUpdate: ReleaseFrame with pts:%d", pts); - amlcodec->ReleaseFrame(pts); - amlcodec->SetVideoRect(m_sourceRect, m_destRect); - m_prevVPts = pts; - } - amlcodec->PollFrame(); - } --#else -- int videopts(0); -- if(amlcodec) -- { -- unsigned int i(0); -- do { -- amlcodec->PollFrame(); -- videopts = get_pts("/sys/class/tsync/pts_video"); -- } while (i++ < 5 && videopts == m_prevVPts); -- } -- m_prevVPts = videopts; -- -- if (amli) -- { -- int pts = amli->GetOmxPts(); -- -- int pcrscr(get_pts("/sys/class/tsync/pts_pcrscr")); -- int diff(static_cast((pcrscr - pts)*1.1 / amli->GetAmlDuration())); -- m_diff_counter += diff; -- -- if(!diff) -- { -- if (m_diff_counter > 0) -- --m_diff_counter; -- else if (m_diff_counter < 0) -- ++m_diff_counter; -- } -- -- if (abs(m_diff_counter) > 5) -- { -- set_pts("/sys/class/tsync/pts_pcrscr", pts); -- CLog::Log(LOGDEBUG, "RenderUpdate: Adjusting: ptsclock:%d ptsscr:%d vpts:%d dur:%d diff:%d diffsum:%d", pts, pcrscr, videopts,amli->GetAmlDuration(), diff, m_diff_counter); -- pcrscr = pts; -- m_diff_counter = 0; -- } -- else if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- { -- CLog::Log(LOGDEBUG, "RenderUpdate: ptsclock:%d ptsscr:%d vpts:%d diff:%d", pts, pcrscr, videopts, m_diff_counter); -- } -- -- SysfsUtils::SetInt("/sys/module/amvideo/parameters/omx_pts", pcrscr); -- -- if(amlcodec) -- amlcodec->SetVideoRect(m_sourceRect, m_destRect); -- } --#endif - } - - #endif -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -index 7b4203b..cd68401 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h -@@ -72,7 +72,6 @@ class CRendererAML : public CBaseRenderer - - int m_prevVPts; - bool m_bConfigured; -- int m_diff_counter; - }; - - #endif -diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp -index a8dbdaf..e8755a1 100644 ---- a/xbmc/video/VideoReferenceClock.cpp -+++ b/xbmc/video/VideoReferenceClock.cpp -@@ -49,6 +49,9 @@ - #if defined(TARGET_ANDROID) - #include "video/videosync/VideoSyncAndroid.h" - #endif -+#if defined(HAS_LIBAMCODEC) -+#include "video/videosync/VideoSyncAML.h" -+#endif - - #ifdef TARGET_POSIX - #include "linux/XTimeUtils.h" -@@ -125,6 +128,8 @@ void CVideoReferenceClock::Process() - m_pVideoSync = new CVideoSyncIMX(this); - #elif defined(TARGET_ANDROID) - m_pVideoSync = new CVideoSyncAndroid(this); -+#elif defined(HAS_LIBAMCODEC) -+ m_pVideoSync = new CVideoSyncAML(this); - #endif - - if (m_pVideoSync) -diff --git a/xbmc/video/videosync/CMakeLists.txt b/xbmc/video/videosync/CMakeLists.txt -index 421af44..75c9011 100644 ---- a/xbmc/video/videosync/CMakeLists.txt -+++ b/xbmc/video/videosync/CMakeLists.txt -@@ -35,6 +35,11 @@ if(CORE_SYSTEM_NAME STREQUAL android) - list(APPEND HEADERS VideoSyncAndroid.h) - endif() - -+if(AML_FOUND) -+ list(APPEND SOURCES VideoSyncAML.cpp) -+ list(APPEND HEADERS VideoSyncAML.h) -+endif() -+ - if(SOURCES AND HEADERS) - core_add_library(video_sync) - endif() -diff --git a/xbmc/video/videosync/VideoSyncAML.cpp b/xbmc/video/videosync/VideoSyncAML.cpp -new file mode 100644 -index 0000000..fb744e2 ---- /dev/null -+++ b/xbmc/video/videosync/VideoSyncAML.cpp -@@ -0,0 +1,86 @@ -+/* -+ * Copyright (C) 2005-2014 Team XBMC -+ * http://xbmc.org -+ * -+ * 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, or (at your option) -+ * any later version. -+ * -+ * This Program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#include "system.h" -+ -+#if defined(HAS_LIBAMCODEC) -+ -+#include "video/videosync/VideoSyncAML.h" -+#include "guilib/GraphicContext.h" -+#include "windowing/WindowingFactory.h" -+#include "utils/TimeUtils.h" -+#include "utils/log.h" -+#include "threads/Thread.h" -+#include -+ -+extern CEvent g_aml_sync_event; -+ -+CVideoSyncAML::CVideoSyncAML(CVideoReferenceClock *clock) -+: CVideoSync(clock) -+, m_abort(false) -+{ -+} -+ -+CVideoSyncAML::~CVideoSyncAML() -+{ -+} -+ -+bool CVideoSyncAML::Setup(PUPDATECLOCK func) -+{ -+ UpdateClock = func; -+ -+ m_abort = false; -+ -+ g_Windowing.Register(this); -+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: setting up AML"); -+ -+ return true; -+} -+ -+void CVideoSyncAML::Run(std::atomic& stop) -+{ -+ while (!stop && !m_abort) -+ { -+ g_aml_sync_event.WaitMSec(100); -+ uint64_t now = CurrentHostCounter(); -+ -+ UpdateClock(1, now, m_refClock); -+ } -+} -+ -+void CVideoSyncAML::Cleanup() -+{ -+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: cleaning up AML"); -+ g_Windowing.Unregister(this); -+} -+ -+float CVideoSyncAML::GetFps() -+{ -+ m_fps = g_graphicsContext.GetFPS(); -+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: fps: %.3f", m_fps); -+ return m_fps; -+} -+ -+void CVideoSyncAML::OnResetDisplay() -+{ -+ m_abort = true; -+} -+ -+#endif -diff --git a/xbmc/video/videosync/VideoSyncAML.h b/xbmc/video/videosync/VideoSyncAML.h -new file mode 100644 -index 0000000..f48e3b4 ---- /dev/null -+++ b/xbmc/video/videosync/VideoSyncAML.h -@@ -0,0 +1,41 @@ -+#pragma once -+/* -+ * Copyright (C) 2005-2016 Team XBMC -+ * http://xbmc.org -+ * -+ * 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, or (at your option) -+ * any later version. -+ * -+ * This Program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with XBMC; see the file COPYING. If not, see -+ * . -+ * -+ */ -+ -+#if defined(HAS_LIBAMCODEC) -+ -+#include "video/videosync/VideoSync.h" -+#include "guilib/DispResource.h" -+ -+class CVideoSyncAML : public CVideoSync, IDispResource -+{ -+public: -+ CVideoSyncAML(CVideoReferenceClock *clock); -+ virtual ~CVideoSyncAML(); -+ virtual bool Setup(PUPDATECLOCK func); -+ virtual void Run(std::atomic& stop); -+ virtual void Cleanup(); -+ virtual float GetFps(); -+ virtual void OnResetDisplay(); -+private: -+ volatile bool m_abort; -+}; -+ -+#endif - -From fcc5dfb9a8a7edaa66bda89424fbf68802a83198 Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Fri, 23 Dec 2016 16:17:47 +0100 -Subject: [PATCH 23/32] pts -> buffer-index - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 45 +++++++++------------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 8 ++-- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 6 ++- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.h | 4 +- - .../VideoRenderers/HwDecRender/RendererAML.cpp | 4 +- - 5 files changed, 33 insertions(+), 34 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index d081c21..986513d 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1377,6 +1377,7 @@ CAMLCodec::CAMLCodec() - , m_ptsIs64us(false) - , m_cur_pts(INT64_0) - , m_last_pts(0) -+ , m_bufferIndex(-1) - , m_state(0) - { - am_private = new am_private_t; -@@ -1875,13 +1876,8 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - } - - int rtn(0); -- int64_t decode_pts = 0; -- if ((m_state & STATE_PREFILLED) != 0 && timesize > 0.5 && DequeueBuffer(decode_pts) == 0) -- { -+ if ((m_state & STATE_PREFILLED) != 0 && timesize > 0.5 && DequeueBuffer() == 0) - rtn |= VC_PICTURE; -- m_last_pts = m_cur_pts; -- m_cur_pts = decode_pts; -- } - else //Timesize actualizes each 10ms, throttle decode calls to avoid reading too much - usleep(2500); - -@@ -1890,7 +1886,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d, idx:%u, timesize:%0.2f", - rtn, - static_cast(iSize), - static_cast(dts)/DVD_TIME_BASE, am_private->am_pkt.avdts, -@@ -1898,6 +1894,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_start_adj, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), -+ m_bufferIndex, - timesize - ); - } -@@ -1909,43 +1906,36 @@ int CAMLCodec::PollFrame() - { - struct pollfd codec_poll_fd[1]; - -- if (am_private->vcodec.handle <= 0) { -+ if (am_private->vcodec.cntl_handle <= 0) { - return 0; - } - -- codec_poll_fd[0].fd = am_private->vcodec.handle; -+ codec_poll_fd[0].fd = am_private->vcodec.cntl_handle; - codec_poll_fd[0].events = POLLOUT; - -- if (poll(codec_poll_fd, 1, 100) == 0) -+ if (poll(codec_poll_fd, 1, 100) > 0) - { - g_aml_sync_event.Set(); - return 0; - } -+ - return false; - } - --int CAMLCodec::ReleaseFrame(unsigned long pts) -+int CAMLCodec::ReleaseFrame(const uint32_t index) - { - int ret; - v4l2_buffer vbuf = { 0 }; - vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - vbuf.memory = V4L2_MEMORY_USERPTR; -- -- if (m_ptsIs64us) -- { -- uint64_t us = (static_cast(pts) * DVD_TIME_BASE) / PTS_FREQ; -- vbuf.timestamp.tv_sec = us >> 32; -- vbuf.timestamp.tv_usec = us & 0xFFFFFFFF; -- } -- else -- vbuf.timestamp.tv_usec = pts; -+ vbuf.index = index; - - if ((ret = m_amlVideoFile->IOControl(VIDIOC_QBUF, &vbuf)) < 0) - CLog::Log(LOGERROR, "CAMLCodec::ReleaseFrame - VIDIOC_QBUF failed: %s", strerror(errno)); - return ret; - } - --int CAMLCodec::DequeueBuffer(int64_t &pts) -+int CAMLCodec::DequeueBuffer() - { - v4l2_buffer vbuf = { 0 }; - vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -@@ -1960,17 +1950,20 @@ int CAMLCodec::DequeueBuffer(int64_t &pts) - // Since kernel 3.14 Amlogic changed length and units of PTS values reported here. - // To differentiate such PTS values we check for existence of omx_pts_interval_lower - // parameter, because it was introduced since kernel 3.14. -+ m_last_pts = m_cur_pts; -+ - if (m_ptsIs64us) - { -- pts = vbuf.timestamp.tv_sec & 0xFFFFFFFF; -- pts <<= 32; -- pts += vbuf.timestamp.tv_usec & 0xFFFFFFFF; -- pts = (pts * PTS_FREQ) / DVD_TIME_BASE; -+ m_cur_pts = vbuf.timestamp.tv_sec & 0xFFFFFFFF; -+ m_cur_pts <<= 32; -+ m_cur_pts += vbuf.timestamp.tv_usec & 0xFFFFFFFF; -+ m_cur_pts = (m_cur_pts * PTS_FREQ) / DVD_TIME_BASE; - } - else - { -- pts = vbuf.timestamp.tv_usec; -+ m_cur_pts = vbuf.timestamp.tv_usec; - } -+ m_bufferIndex = vbuf.index; - return 0; - } - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 1fb95b1..b2b0950 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -52,11 +52,12 @@ class CAMLCodec - void SetVideoRate(int videoRate); - int64_t GetCurPts() const { return m_cur_pts + m_start_adj; } - int GetOMXPts() const { return static_cast(m_cur_pts); } -+ uint32_t GetBufferIndex() const { return m_bufferIndex; }; - static float OMXPtsToSeconds(int omxpts); - static int OMXDurationToNs(int duration); - int GetAmlDuration() const; - int PollFrame(); -- int ReleaseFrame(unsigned long pts); -+ int ReleaseFrame(const uint32_t index); - - private: - void ShowMainVideo(const bool show); -@@ -70,7 +71,7 @@ class CAMLCodec - void CloseAmlVideo(); - std::string GetVfmMap(const std::string &name); - void SetVfmMap(const std::string &name, const std::string &map); -- int DequeueBuffer(int64_t &pts); -+ int DequeueBuffer(); - - DllLibAmCodec *m_dll; - bool m_opened; -@@ -79,9 +80,10 @@ class CAMLCodec - CDVDStreamInfo m_hints; - int m_speed; - int64_t m_cur_pts; -- volatile int64_t m_vbufsize; -+ int64_t m_vbufsize; - int64_t m_start_adj; - int64_t m_last_pts; -+ uint32_t m_bufferIndex; - - CRect m_dst_rect; - CRect m_display_rect; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index a6803e4..1f2c6c3 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -338,7 +338,8 @@ bool CDVDVideoCodecAmlogic::GetPicture(DVDVideoPicture* pDvdVideoPicture) - m_Codec->GetPicture(&m_videobuffer); - *pDvdVideoPicture = m_videobuffer; - -- CDVDAmlogicInfo* info = new CDVDAmlogicInfo(this, m_Codec, m_Codec->GetOMXPts(), m_Codec->GetAmlDuration()); -+ CDVDAmlogicInfo* info = new CDVDAmlogicInfo(this, m_Codec, -+ m_Codec->GetOMXPts(), m_Codec->GetAmlDuration(), m_Codec->GetBufferIndex()); - - { - CSingleLock lock(m_secure); -@@ -623,12 +624,13 @@ void CDVDVideoCodecAmlogic::RemoveInfo(CDVDAmlogicInfo *info) - m_inflight.erase(m_inflight.find(info)); - } - --CDVDAmlogicInfo::CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts, int amlDuration) -+CDVDAmlogicInfo::CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts, int amlDuration, uint32_t bufferIndex) - : m_refs(0) - , m_codec(codec) - , m_amlCodec(amlcodec) - , m_omxPts(omxPts) - , m_amlDuration(amlDuration) -+ , m_bufferIndex(bufferIndex) - { - } - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -index a494ace..c28d1c4 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -@@ -36,7 +36,7 @@ class CDVDVideoCodecAmlogic; - class CDVDAmlogicInfo - { - public: -- CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts, int amlDuration); -+ CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcodec, int omxPts, int amlDuration, uint32_t bufferIndex); - - // reference counting - CDVDAmlogicInfo* Retain(); -@@ -45,6 +45,7 @@ class CDVDAmlogicInfo - CAMLCodec *getAmlCodec() const; - int GetOmxPts() const { return m_omxPts; } - int GetAmlDuration() const { return m_amlDuration; } -+ uint32_t GetBufferIndex() const { return m_bufferIndex; }; - void invalidate(); - - protected: -@@ -54,6 +55,7 @@ class CDVDAmlogicInfo - CDVDVideoCodecAmlogic* m_codec; - CAMLCodec* m_amlCodec; - int m_omxPts, m_amlDuration; -+ uint32_t m_bufferIndex; - }; - - class CDVDVideoCodecAmlogic : public CDVDVideoCodec -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index 9ebcbf6..5bd0a0f 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -171,8 +171,8 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - if (pts != m_prevVPts) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "RenderUpdate: ReleaseFrame with pts:%d", pts); -- amlcodec->ReleaseFrame(pts); -+ CLog::Log(LOGDEBUG, "RenderUpdate: ReleaseFrame with pts:%d, idx:%u", pts, amli->GetBufferIndex()); -+ amlcodec->ReleaseFrame(amli->GetBufferIndex()); - amlcodec->SetVideoRect(m_sourceRect, m_destRect); - m_prevVPts = pts; - } - -From 29cbcbe1fa813473431d1f3322d6ecd67295dc1e Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Mon, 26 Dec 2016 15:01:08 +0100 -Subject: [PATCH 24/32] implement frame drop - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 49 ++++++++++++++-------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 11 +++-- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 1 + - .../DVDCodecs/Video/DVDVideoCodecAmlogic.h | 3 ++ - .../VideoRenderers/HwDecRender/RendererAML.cpp | 13 ++++-- - 5 files changed, 52 insertions(+), 25 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 986513d..95307ae 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -31,6 +31,7 @@ - #include "settings/DisplaySettings.h" - #include "settings/MediaSettings.h" - #include "settings/Settings.h" -+#include "threads/Atomics.h" - #include "utils/AMLUtils.h" - #include "utils/log.h" - #include "utils/StringUtils.h" -@@ -1663,6 +1664,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - // vcodec is open, update speed if it was - // changed before VideoPlayer called OpenDecoder. - SetSpeed(m_speed); -+ SetPollDevice(am_private->vcodec.cntl_handle); - - return true; - } -@@ -1683,15 +1685,6 @@ bool CAMLCodec::OpenAmlVideo(const CDVDStreamInfo &hints) - - SysfsUtils::SetInt("/sys/module/amlvideodri/parameters/freerun_mode", 3); - -- struct v4l2_requestbuffers rbuf = {0}; -- rbuf.count = 1; -- rbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -- rbuf.memory = V4L2_MEMORY_USERPTR; -- if (m_amlVideoFile->IOControl(VIDIOC_REQBUFS, &rbuf) < 0) -- { -- if (errno != EAGAIN) -- CLog::Log(LOGERROR, "CAMLCodec::OpenAML - VIDIOC_REQBUFS failed: %s", strerror(errno)); -- } - return true; - } - -@@ -1727,6 +1720,8 @@ void CAMLCodec::CloseDecoder() - { - CLog::Log(LOGDEBUG, "CAMLCodec::CloseDecoder"); - -+ SetPollDevice(-1); -+ - // never leave vcodec ff/rw or paused. - if (m_speed != DVD_PLAYSPEED_NORMAL) - { -@@ -1761,6 +1756,8 @@ void CAMLCodec::Reset() - if (!m_opened) - return; - -+ SetPollDevice(-1); -+ - // set the system blackout_policy to leave the last frame showing - int blackout_policy; - SysfsUtils::GetInt("/sys/class/video/blackout_policy", blackout_policy); -@@ -1794,6 +1791,8 @@ void CAMLCodec::Reset() - m_state = 0; - m_start_adj = 0; - SetSpeed(m_speed); -+ -+ SetPollDevice(am_private->vcodec.cntl_handle); - } - - int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) -@@ -1902,34 +1901,48 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - return rtn; - } - -+long CAMLCodec::m_pollSync = 0; -+int CAMLCodec::m_pollDevice; -+ - int CAMLCodec::PollFrame() - { -- struct pollfd codec_poll_fd[1]; -- -- if (am_private->vcodec.cntl_handle <= 0) { -+ CAtomicSpinLock lock(m_pollSync); -+ if (m_pollDevice < 0) - return 0; -- } - -- codec_poll_fd[0].fd = am_private->vcodec.cntl_handle; -+ struct pollfd codec_poll_fd[1]; -+ static unsigned int pc(0); -+ -+ codec_poll_fd[0].fd = m_pollDevice; - codec_poll_fd[0].events = POLLOUT; - - if (poll(codec_poll_fd, 1, 100) > 0) - { - g_aml_sync_event.Set(); -- return 0; -+ return 1; - } -+ return 0; -+} - -- return false; -+void CAMLCodec::SetPollDevice(int dev) -+{ -+ CAtomicSpinLock lock(m_pollSync); -+ m_pollDevice = dev; - } - --int CAMLCodec::ReleaseFrame(const uint32_t index) -+int CAMLCodec::ReleaseFrame(const uint32_t index, bool drop) - { - int ret; - v4l2_buffer vbuf = { 0 }; - vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -- vbuf.memory = V4L2_MEMORY_USERPTR; - vbuf.index = index; - -+ if (drop) -+ vbuf.flags |= V4L2_BUF_FLAG_DONE; -+ -+ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -+ CLog::Log(LOGDEBUG, "CAMLCodec::ReleaseFrame idx:%u", index); -+ - if ((ret = m_amlVideoFile->IOControl(VIDIOC_QBUF, &vbuf)) < 0) - CLog::Log(LOGERROR, "CAMLCodec::ReleaseFrame - VIDIOC_QBUF failed: %s", strerror(errno)); - return ret; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index b2b0950..d5d5723 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -24,6 +24,7 @@ - #include "cores/IPlayer.h" - #include "guilib/Geometry.h" - #include "rendering/RenderSystem.h" -+#include - - typedef struct am_private_t am_private_t; - -@@ -56,8 +57,10 @@ class CAMLCodec - static float OMXPtsToSeconds(int omxpts); - static int OMXDurationToNs(int duration); - int GetAmlDuration() const; -- int PollFrame(); -- int ReleaseFrame(const uint32_t index); -+ int ReleaseFrame(const uint32_t index, bool bDrop = false); -+ -+ static int PollFrame(); -+ static void SetPollDevice(int device); - - private: - void ShowMainVideo(const bool show); -@@ -102,5 +105,7 @@ class CAMLCodec - - PosixFilePtr m_amlVideoFile; - std::string m_defaultVfmMap; -- CCriticalSection m_ptsQueueMutex; -+ -+ static long m_pollSync; -+ static int m_pollDevice; - }; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index 1f2c6c3..a31584e 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -631,6 +631,7 @@ CDVDAmlogicInfo::CDVDAmlogicInfo(CDVDVideoCodecAmlogic *codec, CAMLCodec *amlcod - , m_omxPts(omxPts) - , m_amlDuration(amlDuration) - , m_bufferIndex(bufferIndex) -+ , m_rendered(false) - { - } - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -index c28d1c4..bbebf57 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -@@ -47,6 +47,8 @@ class CDVDAmlogicInfo - int GetAmlDuration() const { return m_amlDuration; } - uint32_t GetBufferIndex() const { return m_bufferIndex; }; - void invalidate(); -+ void SetRendered() { m_rendered = true; }; -+ bool IsRendered() { return m_rendered; }; - - protected: - long m_refs; -@@ -56,6 +58,7 @@ class CDVDAmlogicInfo - CAMLCodec* m_amlCodec; - int m_omxPts, m_amlDuration; - uint32_t m_bufferIndex; -+ bool m_rendered; - }; - - class CDVDVideoCodecAmlogic : public CDVDVideoCodec -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -index 5bd0a0f..292f07b 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp -@@ -105,7 +105,13 @@ void CRendererAML::ReleaseBuffer(int idx) - if (buf.hwDec) - { - CDVDAmlogicInfo *amli = static_cast(buf.hwDec); -- SAFE_RELEASE(amli); -+ if (amli) -+ { -+ CAMLCodec *amlcodec; -+ if (!amli->IsRendered() && (amlcodec = amli->getAmlCodec())) -+ amlcodec->ReleaseFrame(amli->GetBufferIndex(), true); -+ SAFE_RELEASE(amli); -+ } - buf.hwDec = NULL; - } - } -@@ -170,14 +176,13 @@ void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - int pts = amli->GetOmxPts(); - if (pts != m_prevVPts) - { -- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "RenderUpdate: ReleaseFrame with pts:%d, idx:%u", pts, amli->GetBufferIndex()); - amlcodec->ReleaseFrame(amli->GetBufferIndex()); - amlcodec->SetVideoRect(m_sourceRect, m_destRect); -+ amli->SetRendered(); - m_prevVPts = pts; - } -- amlcodec->PollFrame(); - } -+ CAMLCodec::PollFrame(); - } - - #endif - -From 1aa22d7a3526d21a5d9abe1ac2106828bbd86c2c Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Wed, 28 Dec 2016 23:40:19 +0100 -Subject: [PATCH 25/32] log pts/dts as double, sleep in dequeue at least 10ms - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 25 +++++++++++++++++++--- - 1 file changed, 22 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 95307ae..861801f 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -49,6 +49,8 @@ - #include - #include - #include -+#include -+#include - - // amcodec include - extern "C" { -@@ -1885,11 +1887,11 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.6f[%llX], pts_in: %0.6f[%llX], adj:%llu, ptsOut:%0.6f, amlpts:%d, idx:%u, timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.4lf[%llX], pts_in: %0.4lf[%llX], adj:%llu, ptsOut:%0.4f, amlpts:%d, idx:%u, timesize:%0.2f", - rtn, - static_cast(iSize), -- static_cast(dts)/DVD_TIME_BASE, am_private->am_pkt.avdts, -- static_cast(pts)/DVD_TIME_BASE, am_private->am_pkt.avpts, -+ dts / DVD_TIME_BASE, am_private->am_pkt.avdts, -+ pts / DVD_TIME_BASE, am_private->am_pkt.avpts, - m_start_adj, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), -@@ -1953,10 +1955,19 @@ int CAMLCodec::DequeueBuffer() - v4l2_buffer vbuf = { 0 }; - vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - -+ //Driver change from 10 to 0ms latency, throttle here -+ std::chrono::time_point now(std::chrono::system_clock::now()); -+ - if (m_amlVideoFile->IOControl(VIDIOC_DQBUF, &vbuf) < 0) - { - if (errno != EAGAIN) - CLog::Log(LOGERROR, "CAMLCodec::DequeueBuffer - VIDIOC_DQBUF failed: %s", strerror(errno)); -+ -+ std::chrono::milliseconds elapsed(std::chrono::duration_cast(std::chrono::system_clock::now() - now).count()); -+ -+ if (elapsed < std::chrono::milliseconds(10)) -+ std::this_thread::sleep_for(std::chrono::milliseconds(10) - elapsed); -+ - return -errno; - } - -@@ -2051,12 +2062,20 @@ double CAMLCodec::GetTimeSize() - return 0; - - double timesize(0); -+#if 0 -+ int video_delay_ms; -+ if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) -+ timesize = (float)video_delay_ms / 1000.0; -+ if (timesize < 0 || timesize > 5.0) -+ CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: %0.4f",timesize); -+#else - if (m_cur_pts != INT64_0) - { - timesize = static_cast(am_private->am_pkt.avdts - m_cur_pts) / PTS_FREQ; - if (timesize < 0 || timesize > 5.0) - CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: avdts: %lld cur_pts: %lld",am_private->am_pkt.avdts, m_cur_pts); - } -+#endif - - // lie to VideoPlayer, it is hardcoded to a max of 8 seconds, - // if you buffer more than 8 seconds, it goes nuts. - -From 795416b9dea2e7ab9de696176845c237bcdcee0d Mon Sep 17 00:00:00 2001 -From: peak3d -Date: Thu, 29 Dec 2016 17:01:44 +0100 -Subject: [PATCH 26/32] pass readjusted PTS value in GetPicture() - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 861801f..db544ce 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -2005,7 +2005,7 @@ bool CAMLCodec::GetPicture(DVDVideoPicture *pDvdVideoPicture) - pDvdVideoPicture->iDuration = (double)((m_cur_pts - m_last_pts) * DVD_TIME_BASE) / PTS_FREQ; - - pDvdVideoPicture->dts = DVD_NOPTS_VALUE; -- pDvdVideoPicture->pts = (double)m_cur_pts / PTS_FREQ * DVD_TIME_BASE; -+ pDvdVideoPicture->pts = (double)GetCurPts() / PTS_FREQ * DVD_TIME_BASE; - - return true; - } - -From bd1554621f0310c40b133e0fa3b9296b55bc75a8 Mon Sep 17 00:00:00 2001 -From: peak3d -Date: Mon, 2 Jan 2017 18:10:35 +0100 -Subject: [PATCH 27/32] Remove GetDataSize() / GetTimeSize() - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 80 +++++----------------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 4 +- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 16 ----- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.h | 2 - - 4 files changed, 20 insertions(+), 82 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index db544ce..2cfb486 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1434,7 +1434,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - m_zoom = -1; - m_contrast = -1; - m_brightness = -1; -- m_vbufsize = 500000 * 2; -+ m_max_frame_size = 0; - m_start_adj = 0; - m_hints = hints; - m_state = 0; -@@ -1792,6 +1792,7 @@ void CAMLCodec::Reset() - m_cur_pts = INT64_0; - m_state = 0; - m_start_adj = 0; -+ m_max_frame_size = 0; - SetSpeed(m_speed); - - SetPollDevice(am_private->vcodec.cntl_handle); -@@ -1800,9 +1801,18 @@ void CAMLCodec::Reset() - int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - { - if (!m_opened) -- return VC_BUFFER; -+ return VC_ERROR; -+ -+ int rtn(0); -+ -+ struct buf_status bs; -+ m_dll->codec_get_vbuf_state(&am_private->vcodec, &bs); -+ if (!m_max_frame_size || bs.data_len < m_max_frame_size) -+ rtn = VC_BUFFER; -+ -+ //CLog::Log(LOGDEBUG, "CAMLCodec::Decode: buf status: s:%d dl:%d fl:%d rp:%u wp:%u",bs.size, bs.data_len, bs.free_len, bs.read_pointer, bs.write_pointer); -+ - -- float timesize(static_cast(GetTimeSize())); - if (pData) - { - am_private->am_pkt.data = pData; -@@ -1869,25 +1879,17 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - // Decoder got stuck; Reset - Reset(); - } -- if ((m_state & STATE_PREFILLED) == 0 && timesize >= 1.0) -- { -- //m_dll->codec_resume(&am_private->vcodec); -- m_state |= STATE_PREFILLED; -- } -+ -+ if (iSize > m_max_frame_size) -+ m_max_frame_size = iSize; - } - -- int rtn(0); -- if ((m_state & STATE_PREFILLED) != 0 && timesize > 0.5 && DequeueBuffer() == 0) -+ if (DequeueBuffer() == 0) - rtn |= VC_PICTURE; -- else //Timesize actualizes each 10ms, throttle decode calls to avoid reading too much -- usleep(2500); -- -- if (((rtn & VC_PICTURE) == 0 && timesize < 2.0) || timesize < 1.0) -- rtn |= VC_BUFFER; - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.4lf[%llX], pts_in: %0.4lf[%llX], adj:%llu, ptsOut:%0.4f, amlpts:%d, idx:%u, timesize:%0.2f", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.4lf[%llX], pts_in: %0.4lf[%llX], adj:%llu, ptsOut:%0.4f, amlpts:%d, idx:%u", - rtn, - static_cast(iSize), - dts / DVD_TIME_BASE, am_private->am_pkt.avdts, -@@ -1895,8 +1897,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_start_adj, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), -- m_bufferIndex, -- timesize -+ m_bufferIndex - ); - } - -@@ -2044,49 +2045,6 @@ void CAMLCodec::SetSpeed(int speed) - } - } - --int CAMLCodec::GetDataSize() --{ -- if (!m_opened) -- return 0; -- -- struct buf_status vbuf ={0}; -- if (m_dll->codec_get_vbuf_state(&am_private->vcodec, &vbuf) >= 0) -- m_vbufsize = vbuf.size; -- -- return vbuf.data_len; --} -- --double CAMLCodec::GetTimeSize() --{ -- if (!m_opened) -- return 0; -- -- double timesize(0); --#if 0 -- int video_delay_ms; -- if (m_dll->codec_get_video_cur_delay_ms(&am_private->vcodec, &video_delay_ms) >= 0) -- timesize = (float)video_delay_ms / 1000.0; -- if (timesize < 0 || timesize > 5.0) -- CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: %0.4f",timesize); --#else -- if (m_cur_pts != INT64_0) -- { -- timesize = static_cast(am_private->am_pkt.avdts - m_cur_pts) / PTS_FREQ; -- if (timesize < 0 || timesize > 5.0) -- CLog::Log(LOGWARNING, "CAMLCodec::GetTimeSize limits exceed: avdts: %lld cur_pts: %lld",am_private->am_pkt.avdts, m_cur_pts); -- } --#endif -- -- // lie to VideoPlayer, it is hardcoded to a max of 8 seconds, -- // if you buffer more than 8 seconds, it goes nuts. -- if (timesize < 0.0) -- timesize = 0.0; -- else if (timesize > 7.0) -- timesize = 7.0; -- -- return timesize; --} -- - void CAMLCodec::ShowMainVideo(const bool show) - { - static int saved_disable_video = -1; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index d5d5723..04146a0 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -47,8 +47,6 @@ class CAMLCodec - - bool GetPicture(DVDVideoPicture* pDvdVideoPicture); - void SetSpeed(int speed); -- int GetDataSize(); -- double GetTimeSize(); - void SetVideoRect(const CRect &SrcRect, const CRect &DestRect); - void SetVideoRate(int videoRate); - int64_t GetCurPts() const { return m_cur_pts + m_start_adj; } -@@ -83,7 +81,7 @@ class CAMLCodec - CDVDStreamInfo m_hints; - int m_speed; - int64_t m_cur_pts; -- int64_t m_vbufsize; -+ uint32_t m_max_frame_size; - int64_t m_start_adj; - int64_t m_last_pts; - uint32_t m_bufferIndex; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index a31584e..aef4060 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -396,22 +396,6 @@ void CDVDVideoCodecAmlogic::SetSpeed(int iSpeed) - m_Codec->SetSpeed(iSpeed); - } - --int CDVDVideoCodecAmlogic::GetDataSize(void) --{ -- if (m_Codec) -- return m_Codec->GetDataSize(); -- -- return 0; --} -- --double CDVDVideoCodecAmlogic::GetTimeSize(void) --{ -- if (m_Codec) -- return m_Codec->GetTimeSize(); -- -- return 0.0; --} -- - void CDVDVideoCodecAmlogic::FrameQueuePop(void) - { - if (!m_frame_queue || m_queue_depth == 0) -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -index bbebf57..9e57295 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.h -@@ -77,8 +77,6 @@ class CDVDVideoCodecAmlogic : public CDVDVideoCodec - virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture); - virtual void SetSpeed(int iSpeed); - virtual void SetDropState(bool bDrop); -- virtual int GetDataSize(void); -- virtual double GetTimeSize(void); - virtual const char* GetName(void) { return (const char*)m_pFormatName; } - - protected: - -From 48da105c90fd4518f2541b25ac8fcee3085f64fd Mon Sep 17 00:00:00 2001 -From: peak3d -Date: Wed, 4 Jan 2017 14:28:46 +0100 -Subject: [PATCH 28/32] increase buffer level - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 2cfb486..cedc177 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1880,8 +1880,8 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - Reset(); - } - -- if (iSize > m_max_frame_size) -- m_max_frame_size = iSize; -+ if (iSize*2 > m_max_frame_size) -+ m_max_frame_size = iSize*2; - } - - if (DequeueBuffer() == 0) - -From 52a6360260c590e3a7a08c5fa7a39816c4760f8d Mon Sep 17 00:00:00 2001 -From: peak3d -Date: Thu, 5 Jan 2017 14:58:20 +0100 -Subject: [PATCH 29/32] prefeed based on frame durations - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 54 +++++++++++++++------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 4 ++ - 2 files changed, 41 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index cedc177..db36553 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1382,6 +1382,7 @@ CAMLCodec::CAMLCodec() - , m_last_pts(0) - , m_bufferIndex(-1) - , m_state(0) -+ , m_frameSizeSum(0) - { - am_private = new am_private_t; - memset(am_private, 0, sizeof(am_private_t)); -@@ -1434,10 +1435,11 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - m_zoom = -1; - m_contrast = -1; - m_brightness = -1; -- m_max_frame_size = 0; - m_start_adj = 0; - m_hints = hints; - m_state = 0; -+ m_frameSizes.clear(); -+ m_frameSizeSum = 0; - - if (!OpenAmlVideo(hints)) - { -@@ -1792,7 +1794,9 @@ void CAMLCodec::Reset() - m_cur_pts = INT64_0; - m_state = 0; - m_start_adj = 0; -- m_max_frame_size = 0; -+ m_frameSizes.clear(); -+ m_frameSizeSum = 0; -+ - SetSpeed(m_speed); - - SetPollDevice(am_private->vcodec.cntl_handle); -@@ -1805,16 +1809,12 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - - int rtn(0); - -- struct buf_status bs; -- m_dll->codec_get_vbuf_state(&am_private->vcodec, &bs); -- if (!m_max_frame_size || bs.data_len < m_max_frame_size) -- rtn = VC_BUFFER; -- -- //CLog::Log(LOGDEBUG, "CAMLCodec::Decode: buf status: s:%d dl:%d fl:%d rp:%u wp:%u",bs.size, bs.data_len, bs.free_len, bs.read_pointer, bs.write_pointer); -- -- -+ float timesize(GetTimeSize()); - if (pData) - { -+ m_frameSizes.push_back(iSize); -+ m_frameSizeSum += iSize; -+ - am_private->am_pkt.data = pData; - am_private->am_pkt.data_size = iSize; - -@@ -1875,21 +1875,23 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - loop++; - } - if (loop == 100) -- { - // Decoder got stuck; Reset - Reset(); -- } - -- if (iSize*2 > m_max_frame_size) -- m_max_frame_size = iSize*2; -+ if ((m_state & STATE_PREFILLED) == 0 && timesize >= 1.0) -+ m_state |= STATE_PREFILLED; - } - -- if (DequeueBuffer() == 0) -+ if ((m_state & STATE_PREFILLED) != 0 && timesize > 0.5 && DequeueBuffer() == 0) - rtn |= VC_PICTURE; - -+ if (((rtn & VC_PICTURE) == 0 && timesize < 2.0) || timesize < 1.0) -+ rtn |= VC_BUFFER; -+ -+ - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.4lf[%llX], pts_in: %0.4lf[%llX], adj:%llu, ptsOut:%0.4f, amlpts:%d, idx:%u", -+ CLog::Log(LOGDEBUG, "CAMLCodec::Decode: ret: %d, sz: %u, dts_in: %0.4lf[%llX], pts_in: %0.4lf[%llX], adj:%llu, ptsOut:%0.4f, amlpts:%d, idx:%u, timesize:%0.4f", - rtn, - static_cast(iSize), - dts / DVD_TIME_BASE, am_private->am_pkt.avdts, -@@ -1897,7 +1899,8 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - m_start_adj, - static_cast(m_cur_pts)/PTS_FREQ, - static_cast(m_cur_pts), -- m_bufferIndex -+ m_bufferIndex, -+ timesize - ); - } - -@@ -1992,6 +1995,23 @@ int CAMLCodec::DequeueBuffer() - return 0; - } - -+float CAMLCodec::GetTimeSize() -+{ -+ struct buf_status bs; -+ m_dll->codec_get_vbuf_state(&am_private->vcodec, &bs); -+ -+ //CLog::Log(LOGDEBUG, "CAMLCodec::Decode: buf status: s:%d dl:%d fl:%d rp:%u wp:%u",bs.size, bs.data_len, bs.free_len, bs.read_pointer, bs.write_pointer); -+ while (m_frameSizeSum > bs.data_len) -+ { -+ m_frameSizeSum -= m_frameSizes.front(); -+ m_frameSizes.pop_front(); -+ } -+ if (bs.free_len < bs.data_len) -+ return 7.0; -+ -+ return (float)(m_frameSizes.size() * am_private->video_rate) / UNIT_FREQ; -+} -+ - bool CAMLCodec::GetPicture(DVDVideoPicture *pDvdVideoPicture) - { - if (!m_opened) -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -index 04146a0..2885a88 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h -@@ -73,6 +73,7 @@ class CAMLCodec - std::string GetVfmMap(const std::string &name); - void SetVfmMap(const std::string &name, const std::string &map); - int DequeueBuffer(); -+ float GetTimeSize(); - - DllLibAmCodec *m_dll; - bool m_opened; -@@ -104,6 +105,9 @@ class CAMLCodec - PosixFilePtr m_amlVideoFile; - std::string m_defaultVfmMap; - -+ std::deque m_frameSizes; -+ std::uint32_t m_frameSizeSum; -+ - static long m_pollSync; - static int m_pollDevice; - }; - -From 087c11d45925912921fe1d7434fb4eee50cbf0fd Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Mon, 9 Jan 2017 11:14:31 +0100 -Subject: [PATCH 30/32] disable h/w flv1 / vsync clock for s/w - ---- - .../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 3 +-- - .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 18 +++++++------- - xbmc/video/videosync/VideoSyncAML.cpp | 28 ++++++++++++++++++++-- - 3 files changed, 36 insertions(+), 13 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index db36553..38dcd23 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1917,7 +1917,6 @@ int CAMLCodec::PollFrame() - return 0; - - struct pollfd codec_poll_fd[1]; -- static unsigned int pc(0); - - codec_poll_fd[0].fd = m_pollDevice; - codec_poll_fd[0].events = POLLOUT; -@@ -2001,7 +2000,7 @@ float CAMLCodec::GetTimeSize() - m_dll->codec_get_vbuf_state(&am_private->vcodec, &bs); - - //CLog::Log(LOGDEBUG, "CAMLCodec::Decode: buf status: s:%d dl:%d fl:%d rp:%u wp:%u",bs.size, bs.data_len, bs.free_len, bs.read_pointer, bs.write_pointer); -- while (m_frameSizeSum > bs.data_len) -+ while (m_frameSizeSum > (unsigned int)bs.data_len) - { - m_frameSizeSum -= m_frameSizes.front(); - m_frameSizes.pop_front(); -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index aef4060..da46973 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -44,17 +44,17 @@ typedef struct frame_queue { - CDVDVideoCodecAmlogic::CDVDVideoCodecAmlogic(CProcessInfo &processInfo) : CDVDVideoCodec(processInfo), - m_Codec(NULL), - m_pFormatName("amcodec"), -+ m_opened(false), - m_last_pts(0.0), - m_frame_queue(NULL), - m_queue_depth(0), - m_framerate(0.0), - m_video_rate(0), - m_mpeg2_sequence(NULL), -- m_bitparser(NULL), -- m_bitstream(NULL), -- m_opened(false), - m_drop(false), -- m_has_keyframe(false) -+ m_has_keyframe(false), -+ m_bitparser(NULL), -+ m_bitstream(NULL) - { - pthread_mutex_init(&m_queue_mutex, NULL); - } -@@ -153,9 +153,9 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option - // amcodec can't handle h263 - return false; - break; -- case AV_CODEC_ID_FLV1: -- m_pFormatName = "am-flv1"; -- break; -+// case AV_CODEC_ID_FLV1: -+// m_pFormatName = "am-flv1"; -+// break; - case AV_CODEC_ID_RV10: - case AV_CODEC_ID_RV20: - case AV_CODEC_ID_RV30: -@@ -288,7 +288,7 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - - if (!m_bitstream->HasKeyframe()) - { -- CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for keyframe (bitstream)", __MODULE_NAME__); -+ CLog::Log(LOGDEBUG, "%s::Decode waiting for keyframe (bitstream)", __MODULE_NAME__); - return VC_BUFFER; - } - pData = m_bitstream->GetConvertBuffer(); -@@ -298,7 +298,7 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - { - if (!m_bitparser->HasKeyframe(pData, iSize)) - { -- CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::Decode waiting for keyframe (bitparser)", __MODULE_NAME__); -+ CLog::Log(LOGDEBUG, "%s::Decode waiting for keyframe (bitparser)", __MODULE_NAME__); - return VC_BUFFER; - } - else -diff --git a/xbmc/video/videosync/VideoSyncAML.cpp b/xbmc/video/videosync/VideoSyncAML.cpp -index fb744e2..02c613e 100644 ---- a/xbmc/video/videosync/VideoSyncAML.cpp -+++ b/xbmc/video/videosync/VideoSyncAML.cpp -@@ -30,6 +30,9 @@ - #include "threads/Thread.h" - #include - -+#include -+#include -+ - extern CEvent g_aml_sync_event; - - CVideoSyncAML::CVideoSyncAML(CVideoReferenceClock *clock) -@@ -56,12 +59,33 @@ bool CVideoSyncAML::Setup(PUPDATECLOCK func) - - void CVideoSyncAML::Run(std::atomic& stop) - { -+ // We use the wall clock for timout handling (no AML h/w, startup) -+ std::chrono::time_point now(std::chrono::system_clock::now()); -+ unsigned int waittime (3000 / m_fps); -+ uint64_t numVBlanks (0); -+ - while (!stop && !m_abort) - { -- g_aml_sync_event.WaitMSec(100); -+ int countVSyncs(1); -+ if( !g_aml_sync_event.WaitMSec(waittime)) -+ { -+ std::chrono::milliseconds elapsed(std::chrono::duration_cast(std::chrono::system_clock::now() - now).count()); -+ uint64_t curVBlanks = (m_fps * elapsed.count()) / 1000; -+ int64_t lastVBlankTime((curVBlanks * 1000) / m_fps); -+ if (elapsed.count() > lastVBlankTime) -+ { -+ lastVBlankTime = (++curVBlanks * 1000) / m_fps; -+ std::this_thread::sleep_for(std::chrono::milliseconds(lastVBlankTime - elapsed.count())); -+ } -+ countVSyncs = curVBlanks - numVBlanks; -+ numVBlanks = curVBlanks; -+ } -+ else -+ ++numVBlanks; -+ - uint64_t now = CurrentHostCounter(); - -- UpdateClock(1, now, m_refClock); -+ UpdateClock(countVSyncs, now, m_refClock); - } - } - - -From 2a9c9c7e4a9f1980b00b4f67719d4581db3155f5 Mon Sep 17 00:00:00 2001 -From: peak3d -Date: Fri, 13 Jan 2017 17:55:05 +0100 -Subject: [PATCH 31/32] keyframe_pts_only for vc-1 - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 38dcd23..62b5da2 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -1606,7 +1606,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - case VFORMAT_VC1: - // vc1 in an avi file - if (m_hints.ptsinvalid) -- am_private->gcodec.param = (void*)EXTERNAL_PTS; -+ am_private->gcodec.param = (void*)(EXTERNAL_PTS | 0x100); -+ am_private->gcodec.param = (void*)0x100; - break; - case VFORMAT_HEVC: - am_private->gcodec.format = VIDEO_DEC_FORMAT_HEVC; -@@ -1845,6 +1846,10 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - if (!m_start_adj && am_private->am_pkt.avdts >= 0x7fffffff) - m_start_adj = am_private->am_pkt.avdts & ~0x0000ffff; - am_private->am_pkt.avdts -= m_start_adj; -+ -+ // For VC1 AML decoder uses PTS only on I-Frames -+ if (am_private->am_pkt.avpts == INT64_0 && am_private->video_format == VFORMAT_VC1) -+ am_private->am_pkt.avpts = am_private->am_pkt.avdts; - } - // We use this to determine the fill state if no PTS is given - if (m_cur_pts == INT64_0) - -From 6c9899a90a6cbc8eb8bb1c426c743830b939333c Mon Sep 17 00:00:00 2001 -From: Markus Pfau -Date: Fri, 13 Jan 2017 22:13:35 +0100 -Subject: [PATCH 32/32] KEYFRAME_PTS_ONLY changes (mpeg4) - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 8 +++++--- - .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp | 15 +++++++++------ - 2 files changed, 14 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index 62b5da2..a5bc749 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -296,6 +296,7 @@ static const int64_t INT64_0 = 0x8000000000000000ULL; - - #define EXTERNAL_PTS (1) - #define SYNC_OUTSIDE (2) -+#define KEYFRAME_PTS_ONLY 0x100 - - // missing tags - #ifndef CODEC_TAG_VC_1 -@@ -1564,6 +1565,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - break; - case VFORMAT_MPEG4: - am_private->gcodec.param = (void*)EXTERNAL_PTS; -+ if (m_hints.ptsinvalid) -+ am_private->gcodec.param = (void*)(EXTERNAL_PTS | KEYFRAME_PTS_ONLY); - break; - case VFORMAT_H264: - case VFORMAT_H264MVC: -@@ -1606,8 +1609,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) - case VFORMAT_VC1: - // vc1 in an avi file - if (m_hints.ptsinvalid) -- am_private->gcodec.param = (void*)(EXTERNAL_PTS | 0x100); -- am_private->gcodec.param = (void*)0x100; -+ am_private->gcodec.param = (void*)KEYFRAME_PTS_ONLY; - break; - case VFORMAT_HEVC: - am_private->gcodec.format = VIDEO_DEC_FORMAT_HEVC; -@@ -1848,7 +1850,7 @@ int CAMLCodec::Decode(uint8_t *pData, size_t iSize, double dts, double pts) - am_private->am_pkt.avdts -= m_start_adj; - - // For VC1 AML decoder uses PTS only on I-Frames -- if (am_private->am_pkt.avpts == INT64_0 && am_private->video_format == VFORMAT_VC1) -+ if (am_private->am_pkt.avpts == INT64_0 && (((size_t)am_private->gcodec.param) & KEYFRAME_PTS_ONLY)) - am_private->am_pkt.avpts = am_private->am_pkt.avdts; - } - // We use this to determine the fill state if no PTS is given -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -index da46973..bcf5247 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp -@@ -305,13 +305,16 @@ int CDVDVideoCodecAmlogic::Decode(uint8_t *pData, int iSize, double dts, double - m_has_keyframe = true; - } - FrameRateTracking( pData, iSize, dts, pts); -- } - -- if (!m_opened) -- { -- if (m_Codec && !m_Codec->OpenDecoder(m_hints)) -- CLog::Log(LOGERROR, "%s: Failed to open Amlogic Codec", __MODULE_NAME__); -- m_opened = true; -+ if (!m_opened) -+ { -+ if (pts == DVD_NOPTS_VALUE) -+ m_hints.ptsinvalid = true; -+ -+ if (m_Codec && !m_Codec->OpenDecoder(m_hints)) -+ CLog::Log(LOGERROR, "%s: Failed to open Amlogic Codec", __MODULE_NAME__); -+ m_opened = true; -+ } - } - - if (m_hints.ptsinvalid) diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch b/packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch deleted file mode 100644 index 53f3705363..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch +++ /dev/null @@ -1,75 +0,0 @@ -From aabc63419df8aa69f156afdafb28820c3c9ccdc7 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sat, 1 Nov 2014 12:44:54 +0100 -Subject: [PATCH] AdvancedSettings: Add minimalSampleRate to ActiveAE cause of - broken AVRs out there - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 8 ++++++++ - xbmc/settings/AdvancedSettings.cpp | 3 +++ - xbmc/settings/AdvancedSettings.h | 2 ++ - 3 files changed, 13 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index bf7e439..1687bad 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -28,6 +28,7 @@ using namespace ActiveAE; - #include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h" - - #include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" - #include "windowing/WindowingFactory.h" - - #define MAX_CACHE_LEVEL 0.5 // total cache time of stream in seconds -@@ -1504,6 +1505,13 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett - format.m_channelLayout = AE_CH_LAYOUT_2_0; - } - -+ // OpenELEC workaround to define a minimum sample Rate for broken AVRs -+ if (format.m_sampleRate < g_advancedSettings.m_minimumSampleRate) -+ { -+ format.m_sampleRate = g_advancedSettings.m_minimumSampleRate; -+ CLog::Log(LOGDEBUG, "CActiveAE::MinimumSampleRate - Forced by use to samplerate %d", format.m_sampleRate); -+ } -+ - if (m_settings.config == AE_CONFIG_FIXED) - { - format.m_sampleRate = m_settings.samplerate; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index c4fa298..35728e4 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -108,6 +108,8 @@ void CAdvancedSettings::Initialize() - return; - - m_audioHeadRoom = 0; -+ // OpenELEC workaround for broken AVRs -+ m_minimumSampleRate = 8000; - m_ac3Gain = 12.0f; - m_audioApplyDrc = -1.0f; - m_dvdplayerIgnoreDTSinWAV = false; -@@ -464,6 +466,7 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) - { - XMLUtils::GetFloat(pElement, "ac3downmixgain", m_ac3Gain, -96.0f, 96.0f); - XMLUtils::GetInt(pElement, "headroom", m_audioHeadRoom, 0, 12); -+ XMLUtils::GetInt(pElement, "minimumsamplerate", m_minimumSampleRate, 8000, 192000); - XMLUtils::GetString(pElement, "defaultplayer", m_audioDefaultPlayer); - // 101 on purpose - can be used to never automark as watched - XMLUtils::GetFloat(pElement, "playcountminimumpercent", m_audioPlayCountMinimumPercent, 0.0f, 101.0f); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index b0b4df1..7137614 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -140,6 +140,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - static void SettingOptionsLoggingComponentsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); - - int m_audioHeadRoom; -+ // OpenELEC workaround for minimum sample Rate -+ int m_minimumSampleRate; - float m_ac3Gain; - std::string m_audioDefaultPlayer; - float m_audioPlayCountMinimumPercent; --- -2.1.4 - diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch b/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch deleted file mode 100644 index fc1ebf792c..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch +++ /dev/null @@ -1,83 +0,0 @@ -From b2db330176ca1115ae9a4bc31af082b80b87ecdb Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Thu, 11 Aug 2016 07:32:48 +0100 -Subject: [PATCH] LibreELEC: Detect intel gpus and use limited range by default - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp | 11 +++++++++++ - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h | 5 +++++ - xbmc/settings/Settings.cpp | 9 +++++++++ - 3 files changed, 25 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp -index e8071bd..83db224 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp -@@ -22,6 +22,8 @@ - #include "settings/Settings.h" - #include "settings/lib/Setting.h" - #include "windowing/WindowingFactory.h" -+#include "utils/SysfsUtils.h" -+#include "utils/StringUtils.h" - - bool CDVDVideoCodec::IsSettingVisible(const std::string &condition, const std::string &value, const CSetting *setting, void *data) - { -@@ -72,3 +74,12 @@ bool CDVDVideoCodec::IsCodecDisabled(const std::map &map - } - return false; // don't disable what we don't have - } -+ -+bool CDVDVideoCodec::IsIntel() -+{ -+ // check if we are running on intel hardware -+ std::string gpuvendor; -+ SysfsUtils::GetString("/proc/fb", gpuvendor); -+ -+ return StringUtils::EndsWith(gpuvendor, "inteldrmfb"); -+} -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -index a2da9de..cc8a574 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -257,6 +257,11 @@ public: - static bool IsSettingVisible(const std::string &condition, const std::string &value, const CSetting *setting, void *data); - - /** -+ * Check if we are using an Intel GPU -+ */ -+ static bool IsIntel(); -+ -+ /** - * Interact with user settings so that user disabled codecs are disabled - */ - static bool IsCodecDisabled(const std::map &map, AVCodecID id); -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 0e429f3..7052391 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -32,6 +32,7 @@ - #include "cores/AudioEngine/AEFactory.h" - #include "cores/playercorefactory/PlayerCoreFactory.h" - #include "cores/VideoPlayer/VideoRenderers/BaseRenderer.h" -+#include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h" - #include "filesystem/File.h" - #include "guilib/GraphicContext.h" - #include "guilib/GUIAudioManager.h" -@@ -911,6 +912,14 @@ void CSettings::InitializeDefaults() - - if (g_application.IsStandAlone()) - ((CSettingInt*)m_settingsManager->GetSetting(CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNSTATE))->SetDefault(POWERSTATE_SHUTDOWN); -+ -+#if ((defined(HAVE_LIBVA) || defined(HAVE_LIBVDPAU))) -+ bool isIntel = CDVDVideoCodec::IsIntel(); -+ // Intel driver is operating in passthrough mode so use limited range by default -+ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOSCREEN_LIMITEDRANGE))->SetDefault(isIntel); -+ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOPLAYER_USEVAAPI))->SetDefault(isIntel); -+ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOPLAYER_USEVDPAU))->SetDefault(!isIntel); -+#endif - } - - void CSettings::InitializeOptionFillers() --- -2.7.4 - diff --git a/packages/mediacenter/kodi/profile.d/00-addons.conf b/packages/mediacenter/kodi/profile.d/00-addons.conf index 5cdbd199b6..08284a2a5a 100644 --- a/packages/mediacenter/kodi/profile.d/00-addons.conf +++ b/packages/mediacenter/kodi/profile.d/00-addons.conf @@ -1,20 +1,6 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) # addons profile.d/*.profile for config in /storage/.kodi/addons/*/profile.d/*.profile; do @@ -41,7 +27,15 @@ oe_setup_addon() { fi # parse config - [ -f "$DEF" ] && eval $(cat "$DEF" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d') - [ -f "$CUR" ] && eval $(cat "$CUR" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d') + for xml_file in "$DEF" "$CUR"; do + if [ -f "$xml_file" ]; then + XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $xml_file)" + if [ "$XML_SETTINGS_VER" = "2" ]; then + eval $(xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$xml_file") + else + eval $(xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$xml_file") + fi + fi + done fi } diff --git a/packages/mediacenter/kodi/profile.d/99-kodi.conf b/packages/mediacenter/kodi/profile.d/99-kodi.conf index ca0537575d..25bd395fa1 100644 --- a/packages/mediacenter/kodi/profile.d/99-kodi.conf +++ b/packages/mediacenter/kodi/profile.d/99-kodi.conf @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # PATH for addon in /storage/.kodi/addons/*/bin /usr/lib/kodi/addons/*/bin; do diff --git a/packages/mediacenter/kodi/scripts/kodi-config b/packages/mediacenter/kodi/scripts/kodi-config index 85a650e2a9..ca88319736 100755 --- a/packages/mediacenter/kodi/scripts/kodi-config +++ b/packages/mediacenter/kodi/scripts/kodi-config @@ -1,47 +1,43 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +KODI_ROOT=$HOME/.kodi + +BOOT_STATE="$(cat $HOME/.config/boot.status 2>/dev/null)" # hack: make addon-bins executable # done in kodi on addon install. but just in case.. -chmod +x /storage/.kodi/addons/*/bin/* - -# hack: update RSSnews.xml in userdata -if [ -f /storage/.kodi/userdata/RssFeeds.xml ]; then - sed -e "s,http://libreelec.tv/news?format=feed&type=rss,http://feeds.libreelec.tv/news,g" \ - -i /storage/.kodi/userdata/RssFeeds.xml -fi +chmod +x $KODI_ROOT/addons/*/bin/* 2>/dev/null # setup Kodi sources -if [ ! -f $HOME/.kodi/userdata/sources.xml ]; then +if [ ! -f $KODI_ROOT/userdata/sources.xml ]; then if [ -f /usr/share/kodi/config/sources.xml ]; then - cp /usr/share/kodi/config/sources.xml $HOME/.kodi/userdata + cp /usr/share/kodi/config/sources.xml $KODI_ROOT/userdata fi fi # common setup guisettings -if [ ! -f $HOME/.kodi/userdata/guisettings.xml ] ; then +if [ ! -f $KODI_ROOT/userdata/guisettings.xml ] ; then if [ -f /usr/share/kodi/config/guisettings.xml ]; then - cp /usr/share/kodi/config/guisettings.xml $HOME/.kodi/userdata + cp /usr/share/kodi/config/guisettings.xml $KODI_ROOT/userdata + fi + if [ "$BOOT_STATE" = "SAFE" ]; then + [ ! -f $KODI_ROOT/userdata/guisettings.xml ] && echo '' > $KODI_ROOT/userdata/guisettings.xml + xmlstarlet ed --omit-decl --inplace -s settings -t elem -n setting -v "maroon" -i settings/setting -t attr -n id -v lookandfeel.skincolors $KODI_ROOT/userdata/guisettings.xml fi fi -KODI_ARGS="--lircdev /run/lirc/lircd" +KODI_ARGS="" echo "KODI_ARGS=\"$KODI_ARGS\"" > /run/libreelec/kodi.conf + +if [ "$(uname -m)" = "x86_64" -o "$(uname -m)" = "aarch64" ]; then + echo "MALLOC_MMAP_THRESHOLD_=524288" >> /run/libreelec/kodi.conf +else #arm + echo "MALLOC_MMAP_THRESHOLD_=8192" >> /run/libreelec/kodi.conf +fi + +[ -f /storage/.config/kodi.conf ] && cat /storage/.config/kodi.conf >>/run/libreelec/kodi.conf diff --git a/packages/mediacenter/kodi/scripts/kodi-remote b/packages/mediacenter/kodi/scripts/kodi-remote new file mode 100755 index 0000000000..37818818db --- /dev/null +++ b/packages/mediacenter/kodi/scripts/kodi-remote @@ -0,0 +1,50 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +echo "Supported keys: +↠↑ ↓ → Left | Up | Down | Right +Context Menu c +Player Debug d +Fullscreen f +Info i +Codec Info o +Pause p +Screenshot s +Skin Debug t +Stop x +Volume Down - +Volume Up + +Back Backspace +Select Enter +Quit Remote q or ctrl+c +" + +com() { + kodi-send --action="$1" > /dev/null 2>&1 + echo -ne "\r$1\e[K"; +} + +while true; do + read -r -sn1 k + case "$k" in + A) com "Up";; + B) com "Down";; + C) com "Right";; + D) com "Left";; + c) com "ContextMenu";; + d) com "PlayerDebug";; + f) com "FullScreen";; + i) com "Info";; + o) com "CodecInfo";; + p) com "Pause";; + s) com "TakeScreenshot";; + t) com "Skin.ToggleDebug";; + x) com "Stop";; + -) com "VolumeDown";; + +) com "VolumeUp";; + $'\177') com "Back";; + "") com "Select";; + q) exit + esac +done diff --git a/packages/mediacenter/kodi/scripts/kodi-safe-mode b/packages/mediacenter/kodi/scripts/kodi-safe-mode new file mode 100755 index 0000000000..1cb7667a24 --- /dev/null +++ b/packages/mediacenter/kodi/scripts/kodi-safe-mode @@ -0,0 +1,35 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +KODI_ROOT=$HOME/.kodi + +KODI_ROOT_FAILED=$KODI_ROOT.FAILED +BOOT_STATUS=$HOME/.config/boot.status + +process_boot_status() +{ + BOOT_STATE="$(cat $BOOT_STATUS 2>/dev/null)" + + if [ "${BOOT_STATE}" = "SAFE" ]; then + if [ ! -d $KODI_ROOT_FAILED ]; then + # entering safe mode - rename failed .kodi, and restart with clean .kodi + mv $KODI_ROOT $KODI_ROOT_FAILED + reboot + else + # exiting safe mode - restore failed .kodi + rm -fr $KODI_ROOT + mv $KODI_ROOT_FAILED $KODI_ROOT + echo "OK" > $BOOT_STATUS + fi + else + echo "OK" > $BOOT_STATUS + fi + + return 0 +} + +process_boot_status + +exit 0 diff --git a/packages/mediacenter/kodi/scripts/kodi.sh b/packages/mediacenter/kodi/scripts/kodi.sh index b7b33e320d..abe314efdb 100755 --- a/packages/mediacenter/kodi/scripts/kodi.sh +++ b/packages/mediacenter/kodi/scripts/kodi.sh @@ -16,8 +16,16 @@ trap cleanup TERM +KODI_ROOT=$HOME/.kodi + SAVED_ARGS="$@" -CRASHLOG_DIR=/storage/.kodi/temp +CRASHLOG_DIR=$KODI_ROOT/temp + +BOOT_STATUS=$HOME/.config/boot.status +NOSAFE_MODE=$HOME/.config/safemode.disable +CRASH_HIST=/run/libreelec/crashes.dat +KODI_MAX_RESTARTS=@KODI_MAX_RESTARTS@ +KODI_MAX_SECONDS=@KODI_MAX_SECONDS@ cleanup() { # make systemd happy by not exiting immediately but @@ -43,6 +51,41 @@ single_stacktrace() done } +detect_crash_loop() +{ + # use monotonic time (in case date/time changes after booting) + NOW_TIME=$(awk '/^now/ {print int($3 / 1000000000)}' /proc/timer_list) + echo "$NOW_TIME" >> $CRASH_HIST + + NUM_RESTARTS=$(wc -l $CRASH_HIST | cut -d' ' -f1) + FIRST_RESTART_TIME=$(tail -n $KODI_MAX_RESTARTS $CRASH_HIST | head -n 1) + + # kodi restart loop detected? fail this kodi install + if [ $NUM_RESTARTS -ge $KODI_MAX_RESTARTS -a $KODI_MAX_SECONDS -ge $((NOW_TIME - FIRST_RESTART_TIME)) ]; then + return 0 + else + return 1 + fi +} + +activate_safe_mode() +{ + [ -f $NOSAFE_MODE ] && return 0 + + BOOT_STATE="$(cat $BOOT_STATUS 2>/dev/null)" + + if [ "${BOOT_STATE:-OK}" = "OK" ]; then + # generate logfiles zip for the failed kodi + /usr/bin/createlog + lastlog=$(ls -1 /storage/logfiles/*.zip | tail -n 1) + mv $lastlog /storage/logfiles/log-$(date -u +%Y-%m-%d-%H.%M.%S)-FAILED.zip + + echo "SAFE" > $BOOT_STATUS + fi + + return 0 +} + print_crash_report() { mkdir -p $CRASHLOG_DIR @@ -74,7 +117,7 @@ print_crash_report() echo >> $FILE echo "################# LOG FILE ##################" >> $FILE echo >> $FILE - cat /storage/.kodi/temp/kodi.log >> $FILE + cat $KODI_ROOT/temp/kodi.log >> $FILE echo >> $FILE echo "############### END LOG FILE ################" >> $FILE echo >> $FILE @@ -82,6 +125,7 @@ print_crash_report() OFILE="$FILE" FILE="$CRASHLOG_DIR/kodi_crashlog_$DATE.log" mv "$OFILE" "$FILE" + ln -sf "$(basename $FILE)" "$CRASHLOG_DIR/kodi_crash.log" echo "Crash report available at $FILE" } @@ -90,7 +134,14 @@ if command_exists gdb; then fi # clean up any stale cores. just in case -rm -f /storage/.cache/cores/* +find /storage/.cache/cores -type f -delete + +# clean zero-byte database files that prevent migration/startup +for file in $KODI_ROOT/userdata/Database/*.db; do + if [ -e "$file" ]; then + [ -s $file ] || rm -f $file + fi +done /usr/lib/kodi/kodi.bin $SAVED_ARGS RET=$? @@ -101,6 +152,12 @@ if [ $(( ($RET >= 131 && $RET <= 136) || $RET == 139 )) = "1" ] ; then # Cleanup. Keep only youngest 10 reports rm -f $(ls -1t $CRASHLOG_DIR/kodi_crashlog_*.log | tail -n +11) + + # Enable safe mode if a crash loop is detected + detect_crash_loop && activate_safe_mode fi +# Filter Kodi powerdown/restartapp/reboot codes to satisfy systemd +[ "$RET" -ge 64 -a "$RET" -le 66 ] && RET=0 + exit $RET diff --git a/packages/mediacenter/kodi/scripts/service-addon-wrapper b/packages/mediacenter/kodi/scripts/service-addon-wrapper new file mode 100755 index 0000000000..78fd08c1a2 --- /dev/null +++ b/packages/mediacenter/kodi/scripts/service-addon-wrapper @@ -0,0 +1,97 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +if [ $# -ne 3 ] ; then + echo "$0 usage: context addon-id addon-path" + exit 1 +fi + +CONTEXT="$1" +ADDON_ID="$2" +ADDON_PATH="$3" + +if [ ! -d /storage/.config/system.d ] ; then + mkdir -p /storage/.config/system.d +fi + +SERVICE_FILE="${ADDON_PATH}/system.d/${ADDON_ID}.service" + +if [ -f "${SERVICE_FILE}" ] ; then + case "${CONTEXT}" in + enable) + systemctl enable "${SERVICE_FILE}" + chmod +x "${ADDON_PATH}/bin"/* + systemctl start "${ADDON_ID}.service" + ;; + disable | pre-uninstall) + systemctl stop "${ADDON_ID}.service" + systemctl disable "${ADDON_ID}.service" + ;; + post-update) + # post-update is triggered on update, + # make sure to stop and re-install service + systemctl stop "${ADDON_ID}.service" + systemctl disable "${ADDON_ID}.service" + systemctl enable "${SERVICE_FILE}" + chmod +x "${ADDON_PATH}/bin"/* + systemctl start "${ADDON_ID}.service" + ;; + restart) + systemctl restart "${ADDON_ID}.service" + ;; + reload) + systemctl reload "${ADDON_ID}.service" + ;; + *) + echo "$0: unknown service context $CONTEXT" + exit 1 + ;; + esac +fi + +if [ ! -d /storage/.cache/kernel-overlays ] ; then + mkdir -p /storage/.cache/kernel-overlays +fi + +# kernel-overlay addons built into the image have their +# files installed in the default /usr/lib/kernel-overlays +# location, not inside the kodi addon dir + +case "${ADDON_PATH}" in + /usr/share/kodi/addons/*) + OVERLAY_PATH="/usr/lib/kernel-overlays/${ADDON_ID}" + ;; + *) + OVERLAY_PATH="${ADDON_PATH}/kernel-overlay" + ;; +esac + +create_overlay_conf() { + rm -f "${OVERLAY_CONF}" + echo "${OVERLAY_PATH}" > "${OVERLAY_CONF}" +} + +if [ -d "${OVERLAY_PATH}" ] ; then + OVERLAY_CONF="/storage/.cache/kernel-overlays/50-${ADDON_ID}.conf" + + case "${CONTEXT}" in + enable | post-update ) + create_overlay_conf + ;; + disable | pre-uninstall ) + rm -f "${OVERLAY_CONF}" + ;; + update ) + if [ -e "${OVERLAY_CONF}" ] ; then + create_overlay_conf + fi + ;; + *) + echo "$0: unknown overlay context $CONTEXT" + exit 1 + ;; + esac + +fi diff --git a/packages/mediacenter/kodi/scripts/setwakeup.sh b/packages/mediacenter/kodi/scripts/setwakeup.sh index 76aa3d7c26..a85d1e201b 100755 --- a/packages/mediacenter/kodi/scripts/setwakeup.sh +++ b/packages/mediacenter/kodi/scripts/setwakeup.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) if [ -f /sys/class/rtc/rtc0/wakealarm ]; then logger -t setwakeup.sh "### Setting system wakeup time ###" diff --git a/packages/mediacenter/kodi/scripts/xml_merge.py b/packages/mediacenter/kodi/scripts/xml_merge.py new file mode 100755 index 0000000000..f7fd547f36 --- /dev/null +++ b/packages/mediacenter/kodi/scripts/xml_merge.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python2 + +# taken from http://stackoverflow.com/a/14879370 with minor modifications + +from __future__ import print_function +import os +import sys +import xml.dom.minidom +from xml.etree import ElementTree as et + +def printerr(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + +class hashabledict(dict): + def __hash__(self): + return hash(tuple(sorted(self.items()))) + +class XMLCombiner(object): + def __init__(self, filenames): + if len(filenames) == 0: + raise Exception('No filenames!') + + try: + self.roots = [et.parse(f).getroot() for f in filenames] + except xml.etree.ElementTree.ParseError: + printerr("ERROR: Unable to parse XML file %s" % f) + raise + + def prettyPrint(self, etree_xml): + minidom = xml.dom.minidom.parseString(et.tostring(etree_xml)) + return "\n".join([line for line in minidom.toprettyxml(indent=" ", encoding="utf-8").split('\n') if line.strip() != ""]) + + def combine(self): + for r in self.roots[1:]: + self.combine_element(self.roots[0], r) + return self.prettyPrint(self.roots[0]) + + def combine_element(self, one, other): + mapping = {(el.tag, hashabledict(el.attrib)): el for el in one} + for el in other: + if len(el) == 0: + try: + mapping[(el.tag, hashabledict(el.attrib))].text = el.text + except KeyError: + mapping[(el.tag, hashabledict(el.attrib))] = el + one.append(el) + else: + try: + self.combine_element(mapping[(el.tag, hashabledict(el.attrib))], el) + except KeyError: + mapping[(el.tag, hashabledict(el.attrib))] = el + one.append(el) + +if __name__ == '__main__': + xmlfiles = [file for file in sys.argv[1:] if os.path.exists(file)] + + r = XMLCombiner(xmlfiles).combine() + + print(r) diff --git a/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh b/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh old mode 100755 new mode 100644 index f7b7690d45..ccce1ae95f --- a/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh +++ b/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh @@ -1,30 +1,17 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile # see https://wiki.archlinux.org/index.php/Power_Management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep for script in $HOME/.kodi/addons/*/sleep.d/*.power; do - progress "running addon sleep script $script ($@)..." - sh $script $@ + if [ -f $script ]; then + progress "running addon sleep script $script ($@)..." + sh $script $@ + fi done exit 0 \ No newline at end of file diff --git a/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh b/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh index 3ad0e0c04e..3a6f0e7cb1 100755 --- a/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh +++ b/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh b/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh index 6b314cd7bd..2102e085c5 100755 --- a/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh +++ b/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/profile diff --git a/packages/mediacenter/kodi/system.d/kodi.service b/packages/mediacenter/kodi/system.d/kodi.service index d6d0250037..4cd8406f35 100644 --- a/packages/mediacenter/kodi/system.d/kodi.service +++ b/packages/mediacenter/kodi/system.d/kodi.service @@ -7,6 +7,7 @@ Wants=network-online.target [Service] Environment=__GL_YIELD=USLEEP Environment=DISPLAY=:0.0 +Environment=WAYLAND_DISPLAY=wayland-0 Environment=SDL_MOUSE_RELATIVE=0 Environment=HOME=/storage Environment=KODI_TEMP=/storage/.kodi/temp @@ -16,6 +17,7 @@ EnvironmentFile=-/run/libreelec/debug/kodi.conf ExecStartPre=-/usr/lib/kodi/kodi-config ExecStart=/usr/lib/kodi/kodi.sh --standalone -fs $KODI_ARGS $KODI_DEBUG ExecStop=/bin/kill -TERM $MAINPID +ExecStopPost=-/usr/lib/kodi/kodi-safe-mode TimeoutStopSec=5 Restart=always RestartSec=2 diff --git a/packages/mediacenter/kodi/tmpfiles.d/kodi-userdirs.conf b/packages/mediacenter/kodi/tmpfiles.d/kodi-userdirs.conf index 4f3c07cf3d..d1a0937661 100644 --- a/packages/mediacenter/kodi/tmpfiles.d/kodi-userdirs.conf +++ b/packages/mediacenter/kodi/tmpfiles.d/kodi-userdirs.conf @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /storage/.kodi/userdata 0755 root root - - d /storage/music 0755 root root - - diff --git a/packages/mediacenter/kodi/tmpfiles.d/kodi.conf b/packages/mediacenter/kodi/tmpfiles.d/kodi.conf index 1635e8c087..f0512629f0 100644 --- a/packages/mediacenter/kodi/tmpfiles.d/kodi.conf +++ b/packages/mediacenter/kodi/tmpfiles.d/kodi.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /run/kodi 0755 root root - - diff --git a/packages/mediacenter/p8-platform/package.mk b/packages/mediacenter/p8-platform/package.mk index f911c18c70..388a27526f 100644 --- a/packages/mediacenter/p8-platform/package.mk +++ b/packages/mediacenter/p8-platform/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="p8-platform" -PKG_VERSION="38343e0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1eb12b1b1efa6747c1e190964854e9e267e3a1e2" +PKG_SHA256="94dba139066a332d048486f817736e4cf4962393c9f892d2c7dd40d9d69ca788" PKG_LICENSE="GPL" PKG_SITE="http://www.kodi.tv" PKG_URL="https://github.com/Pulse-Eight/platform/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="platform-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="Platform support library used by libCEC and binary add-ons for Kodi" PKG_LONGDESC="Platform support library used by libCEC and binary add-ons for Kodi" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CMAKE_OPTS_TARGET="-DCMAKE_INSTALL_LIBDIR:STRING=lib \ -DCMAKE_INSTALL_LIBDIR_NOARCH:STRING=lib \ -DCMAKE_INSTALL_PREFIX_TOOLCHAIN=$SYSROOT_PREFIX/usr \ diff --git a/packages/mediacenter/p8-platform/patches/p8-platform-02-cmake_install_prefix_toolchain.patch b/packages/mediacenter/p8-platform/patches/p8-platform-02-cmake_install_prefix_toolchain.patch index 6f2a694a71..8602c31015 100644 --- a/packages/mediacenter/p8-platform/patches/p8-platform-02-cmake_install_prefix_toolchain.patch +++ b/packages/mediacenter/p8-platform/patches/p8-platform-02-cmake_install_prefix_toolchain.patch @@ -1,30 +1,30 @@ -diff -Naur a/p8-platform-config.cmake.in b/p8-platform-config.cmake.in ---- a/p8-platform-config.cmake.in 2016-01-19 20:51:52.000000000 +0100 -+++ b/p8-platform-config.cmake.in 2017-01-03 19:48:27.000000000 +0100 -@@ -10,16 +10,16 @@ +diff --git a/p8-platform-config.cmake.in b/p8-platform-config.cmake.in +index f59418d..df7ed21 100644 +--- a/p8-platform-config.cmake.in ++++ b/p8-platform-config.cmake.in +@@ -10,7 +10,7 @@ # # propagate these properties from one build system to the other set (p8-platform_VERSION "@p8-platform_VERSION_MAJOR@.@p8-platform_VERSION_MINOR@") --set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_PREFIX@/include) +-find_path (p8-platform_INCLUDE_DIRS p8-platform/os.h) +set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_PREFIX_TOOLCHAIN@/include/p8-platform) set (p8-platform_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") set (p8-platform_LINKER_FLAGS "@p8-platform_LINKER_FLAGS@") set (p8-platform_CONFIG_VARS "@p8-platform_CONFIG_VARS@") - - # libraries come from the build tree where this file was generated +@@ -19,7 +19,7 @@ set (p8-platform_CONFIG_VARS "@p8-platform_CONFIG_VARS@") if(WIN32) -- set (p8-platform_LIBRARY "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/p8-platform.lib") -+ set (p8-platform_LIBRARY "@CMAKE_INSTALL_PREFIX_TOOLCHAIN@/@CMAKE_INSTALL_LIBDIR@/p8-platform.lib") + set (p8-platform_LIBRARY "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/p8-platform.lib") else(WIN32) -- set (p8-platform_LIBRARY "-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -lp8-platform") +- find_library (p8-platform_LIBRARY p8-platform) + set (p8-platform_LIBRARY "-L@CMAKE_INSTALL_PREFIX_TOOLCHAIN@/@CMAKE_INSTALL_LIBDIR@ -lp8-platform") endif(WIN32) set (p8-platform_LIBRARIES ${p8-platform_LIBRARY} "@p8-platform_LIBRARIES@") mark_as_advanced (p8-platform_LIBRARY) -diff -Naur a/p8-platform.pc.in b/p8-platform.pc.in ---- a/p8-platform.pc.in 2016-01-19 20:51:52.000000000 +0100 -+++ b/p8-platform.pc.in 2017-01-03 19:48:13.000000000 +0100 -@@ -7,4 +7,4 @@ +diff --git a/p8-platform.pc.in b/p8-platform.pc.in +index f97a2d4..58cd057 100644 +--- a/p8-platform.pc.in ++++ b/p8-platform.pc.in +@@ -7,4 +7,4 @@ Name: @p8-platform_NAME@ Description: @p8-platform_DESCRIPTION@ @p8-platform_VERSION_MAJOR@.@p8-platform_VERSION_MINOR@ Version: @p8-platform_VERSION_MAJOR@.@p8-platform_VERSION_MINOR@.@p8-platform_VERSION_PATCH@ Libs: -L${libdir} -lp8-platform diff --git a/packages/mediacenter/plexht/config/advancedsettings.xml b/packages/mediacenter/plexht/config/advancedsettings.xml new file mode 100644 index 0000000000..49c50c55bd --- /dev/null +++ b/packages/mediacenter/plexht/config/advancedsettings.xml @@ -0,0 +1,24 @@ + + + false + 1 + cputemp + gputemp + + + 30 + + + 4.0 + + diff --git a/packages/mediacenter/plexht/config/guisettings.xml b/packages/mediacenter/plexht/config/guisettings.xml new file mode 100644 index 0000000000..8599258e30 --- /dev/null +++ b/packages/mediacenter/plexht/config/guisettings.xml @@ -0,0 +1,8 @@ + + + /storage/screenshots/ + + + 2 + + diff --git a/packages/mediacenter/plexht/config/os.libreelec.tv/addon.xml b/packages/mediacenter/plexht/config/os.libreelec.tv/addon.xml new file mode 100644 index 0000000000..6d30d320c4 --- /dev/null +++ b/packages/mediacenter/plexht/config/os.libreelec.tv/addon.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/mediacenter/plexht/config/os.openelec.tv/addon.xml b/packages/mediacenter/plexht/config/os.openelec.tv/addon.xml new file mode 100644 index 0000000000..206659f9da --- /dev/null +++ b/packages/mediacenter/plexht/config/os.openelec.tv/addon.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/mediacenter/plexht/config/sources.xml b/packages/mediacenter/plexht/config/sources.xml new file mode 100644 index 0000000000..4578d51388 --- /dev/null +++ b/packages/mediacenter/plexht/config/sources.xml @@ -0,0 +1,31 @@ + + + + + + Music + /storage/music/ + true + + + + + + Pictures + /storage/pictures/ + true + + + diff --git a/packages/mediacenter/plexht/debug.d/plexht.conf b/packages/mediacenter/plexht/debug.d/plexht.conf new file mode 100644 index 0000000000..a237fe215d --- /dev/null +++ b/packages/mediacenter/plexht/debug.d/plexht.conf @@ -0,0 +1 @@ +PLEXHT_DEBUG="--debug" diff --git a/packages/mediacenter/plexht/fonts/DejaVuSans.ttf b/packages/mediacenter/plexht/fonts/DejaVuSans.ttf new file mode 100644 index 0000000000..84ca1d7503 Binary files /dev/null and b/packages/mediacenter/plexht/fonts/DejaVuSans.ttf differ diff --git a/packages/mediacenter/plexht/package.mk b/packages/mediacenter/plexht/package.mk new file mode 100644 index 0000000000..5112aa514d --- /dev/null +++ b/packages/mediacenter/plexht/package.mk @@ -0,0 +1,383 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="plexht" +PKG_VERSION="1.9" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.openpht.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain plexht:host boost Python2 zlib bzip2 systemd pciutils lzo pcre swig:host libass enca curl rtmpdump fontconfig fribidi tinyxml libjpeg-turbo libpng tiff freetype jasper libogg libcdio libmodplug libmpeg2 taglib libxml2 libxslt yajl sqlite libvorbis flac ffmpeg" # breakpad" +PKG_DEPENDS_HOST="ninja:host lzo:host SDL:host SDL_image:host" +PKG_SECTION="mediacenter" +PKG_SHORTDESC="OpenPHT is a community driven fork of Plex Home Theater" +PKG_LONGDESC="OpenPHT is a community driven fork of Plex Home Theater" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +# configure GPU drivers and dependencies: + get_graphicdrivers + +# for dbus support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET dbus" + +if [ $PROJECT = "RPi" -o $PROJECT = "RPi2" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET" # remotepi-board" // FIXME +fi + +if [ "$DISPLAYSERVER" = "x11" ]; then +# for libX11 support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXext libdrm libXrandr" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET SDL" +fi + +if [ ! "$OPENGL" = "no" ]; then +# for OpenGL (GLX) support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu glew" +fi + +if [ "$OPENGLES_SUPPORT" = yes ]; then +# for OpenGL-ES support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGLES" +fi + +if [ "$ALSA_SUPPORT" = yes ]; then +# for ALSA support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET alsa-lib" +fi + +if [ "$PULSEAUDIO_SUPPORT" = yes ]; then +# for PulseAudio support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET pulseaudio" +fi + +if [ "$ESPEAK_SUPPORT" = yes ]; then +# for espeak support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET espeak" +fi + +if [ "$CEC_SUPPORT" = yes ]; then +# for CEC support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libcec" +fi + +if [ "$JOYSTICK_SUPPORT" = yes ]; then +# for Joystick support + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET SDL2" +fi + +if [ "$KODI_BLURAY_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libbluray" +fi + +if [ "$AVAHI_DAEMON" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi nss-mdns" +fi + +if [ "$KODI_MYSQL_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET mysql" +fi + +if [ "$KODI_AIRPLAY_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libplist" +fi + +if [ "$KODI_AIRTUNES_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libshairplay" +fi + +if [ "$KODI_NFS_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libnfs" +fi + +if [ "$KODI_SAMBA_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET samba" +fi + +if [ "$KODI_WEBSERVER_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libmicrohttpd" +fi + +if [ "$KODI_SSHLIB_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libssh" +fi + +if [ ! "$KODIPLAYER_DRIVER" = default ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $KODIPLAYER_DRIVER" + + if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then + BCM2835_INCLUDES="-I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads/ \ + -I$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux" + KODI_CFLAGS="$KODI_CFLAGS $BCM2835_INCLUDES" + KODI_CXXFLAGS="$KODI_CXXFLAGS $BCM2835_INCLUDES" + fi +fi + +ENABLE_VDPAU=OFF +if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau" + ENABLE_VDPAU=ON +fi + +ENABLE_VAAPI=OFF +if [ "$VAAPI_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva-intel-driver" + ENABLE_VAAPI=ON +fi + +export CXX_FOR_BUILD="$HOST_CXX" +export CC_FOR_BUILD="$HOST_CC" +export CXXFLAGS_FOR_BUILD="$HOST_CXXFLAGS" +export CFLAGS_FOR_BUILD="$HOST_CFLAGS" +export LDFLAGS_FOR_BUILD="$HOST_LDFLAGS" + +export PYTHON_VERSION="2.7" +export PYTHON_CPPFLAGS="-I$SYSROOT_PREFIX/usr/include/python$PYTHON_VERSION" +export PYTHON_LDFLAGS="-L$SYSROOT_PREFIX/usr/lib/python$PYTHON_VERSION -lpython$PYTHON_VERSION" +export PYTHON_SITE_PKG="$SYSROOT_PREFIX/usr/lib/python$PYTHON_VERSION/site-packages" +export ac_python_version="$PYTHON_VERSION" + +unpack() { + rm -fr $BUILD/BUILD_OPENPHT + rm -rf $BUILD/$PKG_NAME-$PKG_VERSION + git clone --depth 1 --branch $OPENPHT_BRANCH $OPENPHT_REPO $BUILD/$PKG_NAME-$PKG_VERSION +} + +post_patch() { + OPENPHT_GITREV="$(git --git-dir=$BUILD/$PKG_NAME-$PKG_VERSION/.git rev-parse HEAD)" + OPENPHT_VERSION_PREFIX=$(cat $BUILD/$PKG_NAME-$PKG_VERSION/CMakeLists.txt|awk '/VERSION_MAJOR |VERSION_MINOR |VERSION_PATCH / {gsub(/\)/,""); printf $2"."} END {print ""}'|sed 's/.$//g') + OPENPHT_VERSION="${OPENPHT_VERSION_PREFIX}.${BUILD_NUMBER:-0}-$(git --git-dir=$BUILD/$PKG_NAME-$PKG_VERSION/.git rev-parse --short=8 HEAD)" + echo "OPENPHT_GITREV=$OPENPHT_GITREV" > $BUILD/BUILD_OPENPHT + echo "OPENPHT_VERSION_PREFIX=$OPENPHT_VERSION_PREFIX" >> $BUILD/BUILD_OPENPHT + echo "OPENPHT_VERSION=$OPENPHT_VERSION" >> $BUILD/BUILD_OPENPHT +} + +configure_host() { + cmake -G Ninja -DOPENELEC=ON ../tools/TexturePacker +} + +make_host() { + ninja +} + +makeinstall_host() { + cp -PR TexturePacker $TOOLCHAIN/bin +} + +configure_target() { +# dont use some optimizations because of build problems + export LDFLAGS=`echo $LDFLAGS | sed -e "s|-Wl,--as-needed||"` + +# plexht should never be built with lto + strip_lto + +# configure the build + export PKG_CONFIG_PATH=$SYSROOT_PREFIX/usr/lib/pkgconfig + +if [ "$DEBUG" = yes ]; then + CMAKE_BUILD_TYPE="Debug" +else + CMAKE_BUILD_TYPE="RelWithDebInfo" +fi + +if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then + export PYTHON_EXEC="$SYSROOT_PREFIX/usr/bin/python2.7" + cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DSWIG_EXECUTABLE=`which swig` \ + -DSWIG_DIR="$BUILD/toolchain" \ + -DCMAKE_PREFIX_PATH="$SYSROOT_PREFIX" \ + -DCMAKE_LIBRARY_PATH="$SYSROOT_PREFIX/usr/lib" \ + -DCMAKE_INCLUDE_PATH="$SYSROOT_PREFIX/usr/include;$SYSROOT_PREFIX/usr/include/interface/vmcs_host/linux;$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads;$SYSROOT_PREFIX/usr/include/python2.7" \ + -DCOMPRESS_TEXTURES=OFF \ + -DENABLE_DUMP_SYMBOLS=ON \ + -DENABLE_AUTOUPDATE=ON \ + -DTARGET_PLATFORM=RPI \ + -DRPI_PROJECT=$PROJECT \ + -DOPENELEC=ON \ + -DLIRC_DEVICE=/run/lirc/lircd \ + -DCMAKE_INSTALL_PREFIX=/usr/lib/plexht \ + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ + .. + +# -DENABLE_PYTHON=ON \ +# -DEXTERNAL_PYTHON_HOME="$SYSROOT_PREFIX/usr" \ +# -DPYTHON_EXEC="$PYTHON_EXEC" \ + +elif [ "$KODIPLAYER_DRIVER" = libamcodec ]; then + export PYTHON_EXEC="$SYSROOT_PREFIX/usr/bin/python2.7" + cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DENABLE_PYTHON=ON \ + -DEXTERNAL_PYTHON_HOME="$SYSROOT_PREFIX/usr" \ + -DPYTHON_EXEC="$PYTHON_EXEC" \ + -DSWIG_EXECUTABLE=`which swig` \ + -DSWIG_DIR="$BUILD/toolchain" \ + -DCMAKE_PREFIX_PATH="$SYSROOT_PREFIX" \ + -DCMAKE_LIBRARY_PATH="$SYSROOT_PREFIX/usr/lib" \ + -DCMAKE_INCLUDE_PATH="$SYSROOT_PREFIX/usr/include;$SYSROOT_PREFIX/usr/include/python2.7" \ + -DCOMPRESS_TEXTURES=OFF \ + -DENABLE_DUMP_SYMBOLS=ON \ + -DENABLE_AUTOUPDATE=ON \ + -DTARGET_PLATFORM=AML \ + -DUSE_INTERNAL_FFMPEG=OFF \ + -DOPENELEC=ON \ + -DLIRC_DEVICE=/run/lirc/lircd \ + -DCMAKE_INSTALL_PREFIX=/usr/lib/plexht \ + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ + .. +else + export PYTHON_EXEC="$SYSROOT_PREFIX/usr/bin/python2.7" + cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ + -DENABLE_PYTHON=ON \ + -DEXTERNAL_PYTHON_HOME="$SYSROOT_PREFIX/usr" \ + -DPYTHON_EXEC="$PYTHON_EXEC" \ + -DSWIG_EXECUTABLE=`which swig` \ + -DSWIG_DIR="$BUILD/toolchain" \ + -DCMAKE_PREFIX_PATH="$SYSROOT_PREFIX" \ + -DCMAKE_LIBRARY_PATH="$SYSROOT_PREFIX/usr/lib" \ + -DCMAKE_INCLUDE_PATH="$SYSROOT_PREFIX/usr/include;$SYSROOT_PREFIX/usr/include/python2.7" \ + -DCOMPRESS_TEXTURES=OFF \ + -DENABLE_DUMP_SYMBOLS=ON \ + -DENABLE_AUTOUPDATE=ON \ + -DTARGET_PLATFORM=LINUX \ + -DUSE_INTERNAL_FFMPEG=OFF \ + -DOPENELEC=ON \ + -DENABLE_VDPAU=$ENABLE_VDPAU \ + -DENABLE_VAAPI=$ENABLE_VAAPI \ + -DLIRC_DEVICE=/run/lirc/lircd \ + -DCMAKE_INSTALL_PREFIX=/usr/lib/plexht \ + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ + .. +fi +} + +make_target() { +# setup skin dir from default skin + SKIN_DIR="skin.$SKIN_DEFAULT" + +# setup default skin inside the sources + sed -i -e "s|skin.confluence|$SKIN_DIR|g" $PKG_BUILD/xbmc/settings/Settings.h + + ninja -j$CONCURRENCY_MAKE_LEVEL + +# generate breakpad symbols + #ninja symbols + +# Strip the executable now that we have our breakpad symbols + #debug_strip plex/plexhometheater +} + +makeinstall_target() { + DESTDIR=$INSTALL ninja install + + rm -rf $INSTALL/usr/lib/plexht/bin/lib + rm -rf $INSTALL/usr/lib/plexht/bin/include + rm -rf $INSTALL/usr/lib/plexht/bin/*.so + mv -f $INSTALL/usr/lib/plexht/bin/* $INSTALL/usr/lib/plexht/ + rm -rf $INSTALL/usr/lib/plexht/bin + mkdir -p $INSTALL/usr/share/XBMC + mv -f $INSTALL/usr/lib/plexht/share/XBMC/* $INSTALL/usr/share/XBMC/ + mkdir -p $INSTALL/usr/lib/plexht/addons + + mkdir -p $INSTALL/usr/lib/plexht + cp $PKG_DIR/scripts/plexht-config $INSTALL/usr/lib/plexht + + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/systemd-addon-wrapper $INSTALL/usr/lib/libreelec + + mkdir -p $INSTALL/usr/bin + cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin + ln -sf cputemp $INSTALL/usr/bin/gputemp + cp $PKG_DIR/scripts/setwakeup.sh $INSTALL/usr/bin + cp ../tools/EventClients/Clients/XBMC\ Send/xbmc-send.py $INSTALL/usr/bin/xbmc-send + + if [ ! "$DISPLAYSERVER" = "x11" ]; then + rm -rf $INSTALL/usr/lib/plexht/xbmc-xrandr + fi + + rm -rf $INSTALL/usr/share/applications + rm -rf $INSTALL/usr/share/icons + rm -rf $INSTALL/usr/share/XBMC/addons/service.xbmc.versioncheck + rm -rf $INSTALL/usr/share/XBMC/addons/visualization.vortex + rm -rf $INSTALL/usr/share/xsessions + + mkdir -p $INSTALL/usr/share/XBMC/addons + cp -R $PKG_DIR/config/os.openelec.tv $INSTALL/usr/share/XBMC/addons + sed "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/XBMC/addons/os.openelec.tv/addon.xml + cp -R $PKG_DIR/config/os.libreelec.tv $INSTALL/usr/share/XBMC/addons + sed "s|@OS_VERSION@|$OS_VERSION|g" -i $INSTALL/usr/share/XBMC/addons/os.libreelec.tv/addon.xml + +# fix skin.plex + mv $INSTALL/usr/share/XBMC/addons/skin.plex/Colors $INSTALL/usr/share/XBMC/addons/skin.plex/colors + mv $INSTALL/usr/share/XBMC/addons/skin.plex/Sounds $INSTALL/usr/share/XBMC/addons/skin.plex/sounds + mv $INSTALL/usr/share/XBMC/addons/skin.plex/Media $INSTALL/usr/share/XBMC/addons/skin.plex/media + TexturePacker -input $INSTALL/usr/share/XBMC/addons/skin.plex/media/ \ + -output Textures.xbt \ + -dupecheck \ + -use_none + rm -rf $INSTALL/usr/share/XBMC/addons/skin.plex/media + mkdir -p $INSTALL/usr/share/XBMC/addons/skin.plex/media + cp Textures.xbt $INSTALL/usr/share/XBMC/addons/skin.plex/media + + mkdir -p $INSTALL/usr/lib/python"$PYTHON_VERSION"/site-packages/xbmc + cp -R ../tools/EventClients/lib/python/* $INSTALL/usr/lib/python"$PYTHON_VERSION"/site-packages/xbmc + + mkdir -p $INSTALL/usr/share/XBMC/config + cp $PKG_DIR/config/guisettings.xml $INSTALL/usr/share/XBMC/config + cp $PKG_DIR/config/sources.xml $INSTALL/usr/share/XBMC/config + +# install project specific configs + if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/plexht/guisettings.xml ]; then + cp -R $PROJECT_DIR/$PROJECT/devices/$DEVICE/plexht/guisettings.xml $INSTALL/usr/share/XBMC/config + elif [ -f $PROJECT_DIR/$PROJECT/plexht/guisettings.xml ]; then + cp -R $PROJECT_DIR/$PROJECT/plexht/guisettings.xml $INSTALL/usr/share/XBMC/config + fi + + if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/plexht/sources.xml ]; then + cp -R $PROJECT_DIR/$PROJECT/devices/$DEVICE/plexht/sources.xml $INSTALL/usr/share/XBMC/config + elif [ -f $PROJECT_DIR/$PROJECT/plexht/sources.xml ]; then + cp -R $PROJECT_DIR/$PROJECT/plexht/sources.xml $INSTALL/usr/share/XBMC/config + fi + + mkdir -p $INSTALL/usr/share/XBMC/system/ + if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/plexht/advancedsettings.xml ]; then + cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/plexht/advancedsettings.xml $INSTALL/usr/share/XBMC/system/ + elif [ -f $PROJECT_DIR/$PROJECT/plexht/advancedsettings.xml ]; then + cp $PROJECT_DIR/$PROJECT/plexht/advancedsettings.xml $INSTALL/usr/share/XBMC/system/ + else + cp $PKG_DIR/config/advancedsettings.xml $INSTALL/usr/share/XBMC/system/ + fi + + if [ "$KODI_EXTRA_FONTS" = yes ]; then + mkdir -p $INSTALL/usr/share/XBMC/media/Fonts + cp $PKG_DIR/fonts/*.ttf $INSTALL/usr/share/XBMC/media/Fonts + fi +} + +post_install() { + enable_service plexht.target + enable_service plexht-autostart.service + enable_service plexht-cleanlogs.service + enable_service plexht-halt.service + enable_service plexht-poweroff.service + enable_service plexht-reboot.service + enable_service plexht-waitonnetwork.service + enable_service plexht.service + enable_service plexht-lirc-suspend.service + enable_service storage-.kodi.mount +} diff --git a/packages/mediacenter/plexht/patches/plexht-0001-cec-update-to-libcec-4.patch b/packages/mediacenter/plexht/patches/plexht-0001-cec-update-to-libcec-4.patch new file mode 100644 index 0000000000..958dfa96d2 --- /dev/null +++ b/packages/mediacenter/plexht/patches/plexht-0001-cec-update-to-libcec-4.patch @@ -0,0 +1,671 @@ +From 44cf047ba1f18588d4e74cc44a4a12321658db16 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 19 Feb 2017 23:42:45 +0100 +Subject: [PATCH] [cec] update to libcec 4 + +--- + language/English/strings.po | 14 ++ + plex/Resources/system/peripherals.xml | 11 +- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 271 ++++++++++++---------- + xbmc/peripherals/devices/PeripheralCecAdapter.h | 18 +- + 4 files changed, 183 insertions(+), 131 deletions(-) + +diff --git a/language/English/strings.po b/language/English/strings.po +index 353968e15c..97dc4d858c 100644 +--- a/language/English/strings.po ++++ b/language/English/strings.po +@@ -11556,6 +11556,20 @@ msgctxt "#36043" + msgid "Boost center channel when downmixing" + msgstr "" + ++msgctxt "#36044" ++msgid "Stop Playback" ++msgstr "" ++ ++msgctxt "#36045" ++msgid "Pause Playback" ++msgstr "" ++ ++msgctxt "#36046" ++msgid "Force AVR to wake up when OpenPHT is activated" ++msgstr "" ++ ++#empty strings from id 36047 to 36098 ++ + msgctxt "#36434" + msgid "Allow hardware acceleration - MMAL" + msgstr "" +diff --git a/plex/Resources/system/peripherals.xml b/plex/Resources/system/peripherals.xml +index fc581906ac..aad95c524d 100644 +--- a/plex/Resources/system/peripherals.xml ++++ b/plex/Resources/system/peripherals.xml +@@ -17,21 +17,24 @@ + + + +- ++ + + +- ++ ++ + + + +- ++ + + + + + + +- ++ ++ ++ + + + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index 93061deaf9..b21ba3d0ef 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -46,7 +46,7 @@ using namespace CEC; + using namespace std; + + #ifdef LIBCEC_VERSION_TO_UINT +-#define CEC_LIB_SUPPORTED_VERSION LIBCEC_VERSION_TO_UINT(3, 0, 0) ++#define CEC_LIB_SUPPORTED_VERSION LIBCEC_VERSION_TO_UINT(4, 0, 0) + #else + #define CEC_LIB_SUPPORTED_VERSION 0x2100 + #endif +@@ -59,6 +59,13 @@ using namespace std; + #define LOCALISED_ID_TV 36037 + #define LOCALISED_ID_AVR 36038 + #define LOCALISED_ID_TV_AVR 36039 ++#define LOCALISED_ID_STOP 36044 ++#define LOCALISED_ID_PAUSE 36045 ++#define LOCALISED_ID_POWEROFF 13005 ++#define LOCALISED_ID_SUSPEND 13011 ++#define LOCALISED_ID_QUIT 13009 ++#define LOCALISED_ID_IGNORE 36028 ++ + #define LOCALISED_ID_NONE 231 + + /* time in seconds to suppress source activation after receiving OnStop */ +@@ -122,25 +129,30 @@ void CPeripheralCecAdapter::ResetMembers(void) + m_dll->CECDestroy(m_cecAdapter); + m_cecAdapter = NULL; + delete m_dll; +- m_dll = NULL; +- m_bStarted = false; +- m_bHasButton = false; +- m_bIsReady = false; +- m_bHasConnectedAudioSystem = false; +- m_strMenuLanguage = "???"; +- m_lastKeypress = 0; +- m_lastChange = VOLUME_CHANGE_NONE; +- m_iExitCode = EXITCODE_QUIT; +- m_bIsMuted = false; // TODO fetch the correct initial value when system audiostatus is implemented in libCEC +- m_bGoingToStandby = false; +- m_bIsRunning = false; +- m_bDeviceRemoved = false; +- m_bActiveSourcePending = false; +- m_bStandbyPending = false; ++ m_dll = NULL; ++ m_bStarted = false; ++ m_bHasButton = false; ++ m_bIsReady = false; ++ m_bHasConnectedAudioSystem = false; ++ m_strMenuLanguage = "???"; ++ m_lastKeypress = 0; ++ m_lastChange = VOLUME_CHANGE_NONE; ++ m_iExitCode = EXITCODE_QUIT; ++ m_bIsMuted = false; //! @todo fetch the correct initial value when system audiostatus is implemented in libCEC ++ m_bGoingToStandby = false; ++ m_bIsRunning = false; ++ m_bDeviceRemoved = false; ++ m_bActiveSourcePending = false; ++ m_bStandbyPending = false; + m_bActiveSourceBeforeStandby = false; +- m_bOnPlayReceived = false; +- m_bPlaybackPaused = false; +- m_queryThread = NULL; ++ m_bOnPlayReceived = false; ++ m_bPlaybackPaused = false; ++ m_queryThread = NULL; ++ m_bPowerOnScreensaver = false; ++ m_bUseTVMenuLanguage = false; ++ m_bSendInactiveSource = false; ++ m_bPowerOffScreensaver = false; ++ m_bShutdownOnStandby = false; + + m_currentButton.iButton = 0; + m_currentButton.iDuration = 0; +@@ -169,8 +181,8 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, + if (bIgnoreDeactivate) + CLog::Log(LOGDEBUG, "%s - ignoring OnScreensaverDeactivated for power action", __FUNCTION__); + } +- if (m_configuration.bPowerOnScreensaver == 1 && !bIgnoreDeactivate && +- m_configuration.bActivateSource == 1) ++ if (m_bPowerOnScreensaver && !bIgnoreDeactivate && ++ m_configuration.bActivateSource) + { + ActivateSource(); + } +@@ -178,7 +190,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, + else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverActivated") && m_bIsReady) + { + // Don't put devices to standby if application is currently playing +- if ((!g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused()) && m_configuration.bPowerOffScreensaver == 1) ++ if ((!g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused()) && m_bPowerOffScreensaver) + { + // only power off when we're the active source + if (m_cecAdapter->IsLibCECActiveSource()) +@@ -244,14 +256,14 @@ bool CPeripheralCecAdapter::InitialiseFeature(const PeripheralFeature feature) + + SetConfigurationFromSettings(); + m_callbacks.Clear(); +- m_callbacks.CBCecLogMessage = &CecLogMessage; +- m_callbacks.CBCecKeyPress = &CecKeyPress; +- m_callbacks.CBCecCommand = &CecCommand; +- m_callbacks.CBCecConfigurationChanged = &CecConfiguration; +- m_callbacks.CBCecAlert = &CecAlert; +- m_callbacks.CBCecSourceActivated = &CecSourceActivated; +- m_configuration.callbackParam = this; +- m_configuration.callbacks = &m_callbacks; ++ m_callbacks.logMessage = &CecLogMessage; ++ m_callbacks.keyPress = &CecKeyPress; ++ m_callbacks.commandReceived = &CecCommand; ++ m_callbacks.configurationChanged = &CecConfiguration; ++ m_callbacks.alert = &CecAlert; ++ m_callbacks.sourceActivated = &CecSourceActivated; ++ m_configuration.callbackParam = this; ++ m_configuration.callbacks = &m_callbacks; + + m_dll = new DllLibCEC; + if (m_dll->Load() && m_dll->IsLoaded()) +@@ -304,7 +316,7 @@ bool CPeripheralCecAdapter::InitialiseFeature(const PeripheralFeature feature) + void CPeripheralCecAdapter::SetVersionInfo(const libcec_configuration &configuration) + { + #ifdef LIBCEC_VERSION_TO_UINT +- m_strVersionInfo.Format("libCEC %s - firmware v%d", m_cecAdapter->VersionToString(configuration.serverVersion), configuration.iFirmwareVersion); ++ m_strVersionInfo.Format("libCEC %s - firmware v%d", m_cecAdapter->VersionToString(configuration.serverVersion).c_str(), configuration.iFirmwareVersion); + #else + m_strVersionInfo.Format("libCEC %s - firmware v%d", m_cecAdapter->ToString((cec_server_version)configuration.serverVersion), configuration.iFirmwareVersion); + #endif +@@ -427,7 +439,7 @@ void CPeripheralCecAdapter::Process(void) + m_standbySent = CDateTime::GetCurrentDateTime(); + m_cecAdapter->StandbyDevices(); + } +- else if (m_configuration.bSendInactiveSource == 1) ++ else if (m_bSendInactiveSource) + { + CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__); + m_cecAdapter->SetInactiveView(); +@@ -468,14 +480,14 @@ void CPeripheralCecAdapter::ProcessVolumeChange(void) + CecVolumeChange pendingVolumeChange = VOLUME_CHANGE_NONE; + { + CSingleLock lock(m_critSection); +- if (m_volumeChangeQueue.size() > 0) ++ if (!m_volumeChangeQueue.empty()) + { + /* get the first change from the queue */ + pendingVolumeChange = m_volumeChangeQueue.front(); + m_volumeChangeQueue.pop(); + + /* remove all dupe entries */ +- while (m_volumeChangeQueue.size() > 0 && m_volumeChangeQueue.front() == pendingVolumeChange) ++ while (!m_volumeChangeQueue.empty() && m_volumeChangeQueue.front() == pendingVolumeChange) + m_volumeChangeQueue.pop(); + + /* send another keypress after VOLUME_REFRESH_TIMEOUT ms */ +@@ -624,43 +636,66 @@ void CPeripheralCecAdapter::SetMenuLanguage(const char *strLanguage) + CLog::Log(LOGWARNING, "%s - TV menu language set to unknown value '%s'", __FUNCTION__, strLanguage); + } + +-int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command) ++void CPeripheralCecAdapter::OnTvStandby(void) + { +- CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam; ++ int iActionOnTvStandby = GetSettingInt("standby_pc_on_tv_standby"); ++ switch (iActionOnTvStandby) ++ { ++ case LOCALISED_ID_POWEROFF: ++ m_bStarted = false; ++ g_application.ExecuteXBMCAction("Shutdown"); ++ break; ++ case LOCALISED_ID_SUSPEND: ++ m_bStarted = false; ++ g_application.ExecuteXBMCAction("Suspend"); ++ break; ++ case LOCALISED_ID_QUIT: ++ m_bStarted = false; ++ g_application.ExecuteXBMCAction("Quit"); ++ break; ++ case LOCALISED_ID_PAUSE: ++ g_application.OnAction(CAction(ACTION_PAUSE)); ++ break; ++ case LOCALISED_ID_STOP: ++ g_application.StopPlaying(); ++ break; ++ default: ++ CLog::Log(LOGERROR, "%s - Unexpected [standby_pc_on_tv_standby] setting value", __FUNCTION__); ++ break; ++ } ++} ++ ++void CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command* command) ++{ ++ CPeripheralCecAdapter *adapter = static_cast(cbParam); + if (!adapter) +- return 0; ++ return; + + if (adapter->m_bIsReady) + { +- switch (command.opcode) ++ switch (command->opcode) + { + case CEC_OPCODE_STANDBY: +- /* a device was put in standby mode */ +- if (command.initiator == CECDEVICE_TV && +- (adapter->m_configuration.bPowerOffOnStandby == 1 || adapter->m_configuration.bShutdownOnStandby == 1) && ++ if (command->initiator == CECDEVICE_TV && + (!adapter->m_standbySent.IsValid() || CDateTime::GetCurrentDateTime() - adapter->m_standbySent > CDateTimeSpan(0, 0, 0, SCREENSAVER_TIMEOUT))) + { +- adapter->m_bStarted = false; +- if (adapter->m_configuration.bPowerOffOnStandby == 1) +- CApplicationMessenger::Get().Suspend(); +- else if (adapter->m_configuration.bShutdownOnStandby == 1) +- CApplicationMessenger::Get().Shutdown(); ++ adapter->OnTvStandby(); + } + break; + case CEC_OPCODE_SET_MENU_LANGUAGE: +- if (adapter->m_configuration.bUseTVMenuLanguage == 1 && command.initiator == CECDEVICE_TV && command.parameters.size == 3) ++ if (adapter->m_bUseTVMenuLanguage == 1 && command->initiator == CECDEVICE_TV && command->parameters.size == 3) + { + char strNewLanguage[4]; + for (int iPtr = 0; iPtr < 3; iPtr++) +- strNewLanguage[iPtr] = command.parameters[iPtr]; ++ strNewLanguage[iPtr] = command->parameters[iPtr]; + strNewLanguage[3] = 0; + adapter->SetMenuLanguage(strNewLanguage); + } + break; + case CEC_OPCODE_DECK_CONTROL: +- if (command.initiator == CECDEVICE_TV && +- command.parameters.size == 1 && +- command.parameters[0] == CEC_DECK_CONTROL_MODE_STOP) ++ if (command->initiator == CECDEVICE_TV && ++ command->parameters.size == 1 && ++ command->parameters[0] == CEC_DECK_CONTROL_MODE_STOP) + { + cec_keypress key; + key.duration = 500; +@@ -669,17 +704,17 @@ int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command) + } + break; + case CEC_OPCODE_PLAY: +- if (command.initiator == CECDEVICE_TV && +- command.parameters.size == 1) ++ if (command->initiator == CECDEVICE_TV && ++ command->parameters.size == 1) + { +- if (command.parameters[0] == CEC_PLAY_MODE_PLAY_FORWARD) ++ if (command->parameters[0] == CEC_PLAY_MODE_PLAY_FORWARD) + { + cec_keypress key; + key.duration = 500; + key.keycode = CEC_USER_CONTROL_CODE_PLAY; + adapter->PushCecKeypress(key); + } +- else if (command.parameters[0] == CEC_PLAY_MODE_PLAY_STILL) ++ else if (command->parameters[0] == CEC_PLAY_MODE_PLAY_STILL) + { + cec_keypress key; + key.duration = 500; +@@ -692,25 +727,23 @@ int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command) + break; + } + } +- return 1; + } + +-int CPeripheralCecAdapter::CecConfiguration(void *cbParam, const libcec_configuration config) ++void CPeripheralCecAdapter::CecConfiguration(void *cbParam, const libcec_configuration* config) + { +- CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam; ++ CPeripheralCecAdapter *adapter = static_cast(cbParam); + if (!adapter) +- return 0; ++ return; + + CSingleLock lock(adapter->m_critSection); +- adapter->SetConfigurationFromLibCEC(config); +- return 1; ++ adapter->SetConfigurationFromLibCEC(*config); + } + +-int CPeripheralCecAdapter::CecAlert(void *cbParam, const libcec_alert alert, const libcec_parameter data) ++void CPeripheralCecAdapter::CecAlert(void *cbParam, const libcec_alert alert, const libcec_parameter data) + { +- CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam; ++ CPeripheralCecAdapter *adapter = static_cast(cbParam); + if (!adapter) +- return 0; ++ return; + + bool bReopenConnection(false); + int iAlertString(0); +@@ -753,18 +786,13 @@ int CPeripheralCecAdapter::CecAlert(void *cbParam, const libcec_alert alert, con + // calls this callback function synchronously and must not be destroyed meanwhile. + adapter->ReopenConnection(true); + } +- +- return 1; + } + +-int CPeripheralCecAdapter::CecKeyPress(void *cbParam, const cec_keypress key) ++void CPeripheralCecAdapter::CecKeyPress(void *cbParam, const cec_keypress* key) + { +- CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam; +- if (!adapter) +- return 0; +- +- adapter->PushCecKeypress(key); +- return 1; ++ CPeripheralCecAdapter *adapter = static_cast(cbParam); ++ if (!!adapter) ++ adapter->PushCecKeypress(*key); + } + + void CPeripheralCecAdapter::GetNextKey(void) +@@ -1086,6 +1114,11 @@ void CPeripheralCecAdapter::PushCecKeypress(const cec_keypress &key) + case CEC_USER_CONTROL_CODE_SELECT_AV_INPUT_FUNCTION: + case CEC_USER_CONTROL_CODE_SELECT_AUDIO_INPUT_FUNCTION: + case CEC_USER_CONTROL_CODE_F5: ++ case CEC_USER_CONTROL_CODE_NUMBER_ENTRY_MODE: ++ case CEC_USER_CONTROL_CODE_NUMBER11: ++ case CEC_USER_CONTROL_CODE_NUMBER12: ++ case CEC_USER_CONTROL_CODE_SELECT_BROADCAST_TYPE: ++ case CEC_USER_CONTROL_CODE_SELECT_SOUND_PRESENTATION: + case CEC_USER_CONTROL_CODE_UNKNOWN: + default: + break; +@@ -1159,7 +1192,7 @@ void CPeripheralCecAdapter::OnSettingChanged(const CStdString &strChangedSetting + + void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_logical_address address, const uint8_t activated) + { +- CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam; ++ CPeripheralCecAdapter *adapter = static_cast(cbParam); + if (!adapter) + return; + +@@ -1167,7 +1200,7 @@ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_log + if (activated == 1) + g_application.WakeUpScreenSaverAndDPMS(); + +- if (adapter->GetSettingBool("pause_playback_on_deactivate")) ++ if (adapter->GetSettingInt("pause_or_stop_playback_on_deactivate") != LOCALISED_ID_NONE) + { + bool bShowingSlideshow = (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW); + CGUIWindowSlideShow *pSlideShow = bShowingSlideshow ? (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW) : NULL; +@@ -1180,7 +1213,8 @@ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_log + else if (bPausedAndActivated) + adapter->m_bPlaybackPaused = false; + +- if (bPlayingAndDeactivated || bPausedAndActivated) ++ if ((bPlayingAndDeactivated || bPausedAndActivated) ++ && adapter->GetSettingInt("pause_or_stop_playback_on_deactivate") == LOCALISED_ID_PAUSE) + { + if (pSlideShow) + // pause/resume slideshow +@@ -1189,17 +1223,25 @@ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_log + // pause/resume player + CApplicationMessenger::Get().MediaPause(); + } ++ else if (bPlayingAndDeactivated ++ && adapter->GetSettingInt("pause_or_stop_playback_on_deactivate") == LOCALISED_ID_STOP) ++ { ++ if (pSlideShow) ++ pSlideShow->OnAction(CAction(ACTION_STOP)); ++ else ++ CApplicationMessenger::Get().MediaStop(); ++ } + } + } + +-int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message message) ++void CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message* message) + { +- CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam; ++ CPeripheralCecAdapter *adapter = static_cast(cbParam); + if (!adapter) +- return 0; ++ return; + + int iLevel = -1; +- switch (message.level) ++ switch (message->level) + { + case CEC_LOG_ERROR: + iLevel = LOGERROR; +@@ -1219,9 +1261,7 @@ int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message me + } + + if (iLevel >= 0) +- CLog::Log(iLevel, "%s - %s", __FUNCTION__, message.message); +- +- return 1; ++ CLog::Log(iLevel, "%s - %s", __FUNCTION__, message->message); + } + + void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configuration &config) +@@ -1266,23 +1306,9 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu + bChanged |= WriteLogicalAddresses(config.powerOffDevices, "standby_devices", "standby_devices_advanced"); + + // set the boolean settings +- m_configuration.bUseTVMenuLanguage = config.bUseTVMenuLanguage; +- bChanged |= SetSetting("use_tv_menu_language", m_configuration.bUseTVMenuLanguage == 1); +- + m_configuration.bActivateSource = config.bActivateSource; + bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1); + +- m_configuration.bPowerOffScreensaver = config.bPowerOffScreensaver; +- bChanged |= SetSetting("cec_standby_screensaver", m_configuration.bPowerOffScreensaver == 1); +- +- m_configuration.bPowerOnScreensaver = config.bPowerOnScreensaver; +- bChanged |= SetSetting("cec_wake_screensaver", m_configuration.bPowerOnScreensaver == 1); +- +- m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby; +- +- m_configuration.bSendInactiveSource = config.bSendInactiveSource; +- bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); +- + #if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) + m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; + bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); +@@ -1299,18 +1325,15 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu + bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); + #endif + ++ m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby; ++ + m_configuration.iFirmwareVersion = config.iFirmwareVersion; +- m_configuration.bShutdownOnStandby = config.bShutdownOnStandby; + + memcpy(m_configuration.strDeviceLanguage, config.strDeviceLanguage, 3); + m_configuration.iFirmwareBuildDate = config.iFirmwareBuildDate; + + SetVersionInfo(m_configuration); + +- bChanged |= SetSetting("standby_pc_on_tv_standby", +- m_configuration.bPowerOffOnStandby == 1 ? 13011 : +- m_configuration.bShutdownOnStandby == 1 ? 13005 : 36028); +- + if (bChanged) + CLog::Log(LOGDEBUG, "SetConfigurationFromLibCEC - settings updated by libCEC"); + } +@@ -1319,7 +1342,7 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + { + // client version matches the version of libCEC that we originally used the API from + #ifdef LIBCEC_VERSION_TO_UINT +- m_configuration.clientVersion = LIBCEC_VERSION_TO_UINT(3, 0, 0); ++ m_configuration.clientVersion = LIBCEC_VERSION_TO_UINT(4, 0, 0); + #else + m_configuration.clientVersion = CEC_CLIENT_VERSION_CURRENT; + #endif +@@ -1387,16 +1410,17 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + ReadLogicalAddresses(GetSettingInt("standby_devices"), m_configuration.powerOffDevices); + + // read the boolean settings +- m_configuration.bUseTVMenuLanguage = GetSettingBool("use_tv_menu_language") ? 1 : 0; ++ m_bUseTVMenuLanguage = GetSettingBool("use_tv_menu_language") ? 1 : 0; + m_configuration.bActivateSource = GetSettingBool("activate_source") ? 1 : 0; +- m_configuration.bPowerOffScreensaver = GetSettingBool("cec_standby_screensaver") ? 1 : 0; +- m_configuration.bPowerOnScreensaver = GetSettingBool("cec_wake_screensaver") ? 1 : 0; +- m_configuration.bSendInactiveSource = GetSettingBool("send_inactive_source") ? 1 : 0; ++ m_bPowerOffScreensaver = GetSettingBool("cec_standby_screensaver") ? 1 : 0; ++ m_bPowerOnScreensaver = GetSettingBool("cec_wake_screensaver") ? 1 : 0; ++ m_bSendInactiveSource = GetSettingBool("send_inactive_source") ? 1 : 0; ++ m_configuration.bAutoWakeAVR = GetSettingBool("power_avr_on_as") ? 1 : 0; + + // read the mutually exclusive boolean settings + int iStandbyAction(GetSettingInt("standby_pc_on_tv_standby")); +- m_configuration.bPowerOffOnStandby = iStandbyAction == 13011 ? 1 : 0; +- m_configuration.bShutdownOnStandby = iStandbyAction == 13005 ? 1 : 0; ++ m_configuration.bPowerOffOnStandby = iStandbyAction == LOCALISED_ID_SUSPEND ? 1 : 0; ++ m_bShutdownOnStandby = iStandbyAction == LOCALISED_ID_POWEROFF; + + #if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) + // double tap prevention timeout in ms. libCEC uses 50ms units for this in 2.2.0, so divide by 50 +@@ -1409,6 +1433,12 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); + m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); + #endif ++ ++ if (GetSettingBool("pause_playback_on_deactivate")) ++ { ++ SetSetting("pause_or_stop_playback_on_deactivate", LOCALISED_ID_PAUSE); ++ SetSetting("pause_playback_on_deactivate", false); ++ } + } + + void CPeripheralCecAdapter::ReadLogicalAddresses(const CStdString &strString, cec_logical_addresses &addresses) +@@ -1471,7 +1501,7 @@ bool CPeripheralCecAdapter::WriteLogicalAddresses(const cec_logical_addresses& a + } + + CPeripheralCecAdapterUpdateThread::CPeripheralCecAdapterUpdateThread(CPeripheralCecAdapter *adapter, libcec_configuration *configuration) : +- CThread("CEC Adapter Update Thread"), ++ CThread("CECAdapterUpdate"), + m_adapter(adapter), + m_configuration(*configuration), + m_bNextConfigurationScheduled(false), +@@ -1539,14 +1569,11 @@ bool CPeripheralCecAdapterUpdateThread::WaitReady(void) + void CPeripheralCecAdapterUpdateThread::UpdateMenuLanguage(void) + { + // request the menu language of the TV +- if (m_configuration.bUseTVMenuLanguage == 1) ++ if (m_adapter->m_bUseTVMenuLanguage == 1) + { + CLog::Log(LOGDEBUG, "%s - requesting the menu language of the TV", __FUNCTION__); +- cec_menu_language language; +- if (m_adapter->m_cecAdapter->GetDeviceMenuLanguage(CECDEVICE_TV, &language)) +- m_adapter->SetMenuLanguage(language.language); +- else +- CLog::Log(LOGDEBUG, "%s - unknown menu language", __FUNCTION__); ++ CStdString language(m_adapter->m_cecAdapter->GetDeviceMenuLanguage(CECDEVICE_TV)); ++ m_adapter->SetMenuLanguage(language.c_str()); + } + else + { +@@ -1563,9 +1590,9 @@ CStdString CPeripheralCecAdapterUpdateThread::UpdateAudioSystemStatus(void) + if (m_adapter->m_cecAdapter->IsActiveDeviceType(CEC_DEVICE_TYPE_AUDIO_SYSTEM)) + { + // request the OSD name of the amp +- cec_osd_name ampName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM); +- CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.name); +- strAmpName.AppendFormat("%s", ampName.name); ++ CStdString ampName(m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM)); ++ CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.c_str()); ++ strAmpName.AppendFormat("%s", ampName.c_str()); + + // set amp present + m_adapter->SetAudioSystemConnected(true); +@@ -1602,8 +1629,8 @@ bool CPeripheralCecAdapterUpdateThread::SetInitialConfiguration(void) + + // request the OSD name of the TV + CStdString strNotification; +- cec_osd_name tvName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV); +- strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.name); ++ CStdString tvName(m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV)); ++ strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.c_str()); + + CStdString strAmpName = UpdateAudioSystemStatus(); + if (!strAmpName.empty()) +@@ -1776,7 +1803,7 @@ void CPeripheralCecAdapter::ProcessStandbyDevices(void) + m_standbySent = CDateTime::GetCurrentDateTime(); + m_cecAdapter->StandbyDevices(CECDEVICE_BROADCAST); + } +- else if (m_configuration.bSendInactiveSource == 1) ++ else if (m_bSendInactiveSource == 1) + { + CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__); + m_cecAdapter->SetInactiveView(); +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h +index be482945a7..d276018b7b 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.h ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h +@@ -49,6 +49,7 @@ namespace PERIPHERALS + #include "threads/Thread.h" + #include "threads/CriticalSection.h" + #include ++#include + + // undefine macro isset, it collides with function in cectypes.h + #ifdef isset +@@ -57,6 +58,7 @@ namespace PERIPHERALS + #include + + class DllLibCEC; ++class CVariant; + + namespace CEC + { +@@ -140,14 +142,15 @@ namespace PERIPHERALS + + void SetAudioSystemConnected(bool bSetTo); + void SetMenuLanguage(const char *strLanguage); ++ void OnTvStandby(void); + + // callbacks from libCEC +- static int CecLogMessage(void *cbParam, const CEC::cec_log_message message); +- static int CecCommand(void *cbParam, const CEC::cec_command command); +- static int CecConfiguration(void *cbParam, const CEC::libcec_configuration config); +- static int CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data); ++ static void CecLogMessage(void *cbParam, const CEC::cec_log_message* message); ++ static void CecCommand(void *cbParam, const CEC::cec_command* command); ++ static void CecConfiguration(void *cbParam, const CEC::libcec_configuration* config); ++ static void CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data); + static void CecSourceActivated(void *param, const CEC::cec_logical_address address, const uint8_t activated); +- static int CecKeyPress(void *cbParam, const CEC::cec_keypress key); ++ static void CecKeyPress(void *cbParam, const CEC::cec_keypress* key); + + DllLibCEC* m_dll; + CEC::ICECAdapter* m_cecAdapter; +@@ -178,6 +181,11 @@ namespace PERIPHERALS + bool m_bOnPlayReceived; + bool m_bPlaybackPaused; + CStdString m_strComPort; ++ bool m_bPowerOnScreensaver; ++ bool m_bUseTVMenuLanguage; ++ bool m_bSendInactiveSource; ++ bool m_bPowerOffScreensaver; ++ bool m_bShutdownOnStandby; + }; + + class CPeripheralCecAdapterUpdateThread : public CThread diff --git a/packages/mediacenter/plexht/profile.d/00-addons.conf b/packages/mediacenter/plexht/profile.d/00-addons.conf new file mode 100644 index 0000000000..96d251d1e9 --- /dev/null +++ b/packages/mediacenter/plexht/profile.d/00-addons.conf @@ -0,0 +1,47 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +# addons profile.d/*.profile +for config in /storage/.plexht/addons/*/profile.d/*.profile; do + if [ -f "$config" ] ; then + . $config + fi +done + +oe_setup_addon() { + if [ ! -z $1 ] ; then + DEF="/storage/.plexht/addons/$1/settings-default.xml" + CUR="/storage/.plexht/userdata/addon_data/$1/settings.xml" + + # export some useful variables + ADDON_DIR="$HOME/.plexht/addons/$1" + ADDON_HOME="$HOME/.plexht/userdata/addon_data/$1" + ADDON_LOG_FILE="$ADDON_HOME/service.log" + + [ ! -d $ADDON_HOME ] && mkdir -p $ADDON_HOME + + # copy defaults + if [ -f "$DEF" -a ! -f "$CUR" ] ; then + cp "$DEF" "$CUR" + fi + + # parse config + [ -f "$DEF" ] && eval $(cat "$DEF" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d') + [ -f "$CUR" ] && eval $(cat "$CUR" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d') + fi +} diff --git a/packages/mediacenter/plexht/profile.d/99-plexht.conf b/packages/mediacenter/plexht/profile.d/99-plexht.conf new file mode 100644 index 0000000000..2f701aa44c --- /dev/null +++ b/packages/mediacenter/plexht/profile.d/99-plexht.conf @@ -0,0 +1,29 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +# PATH +for addon in /storage/.plexht/addons/*/bin /usr/lib/plexht/addons/*/bin; do + [ -d "$addon" ] && PATH="$PATH:$addon" +done +export PATH + +# LD_LIBRARY_PATH +for addon in /storage/.plexht/addons/*/lib /usr/lib/plexht/addons/*/lib; do + [ -d "$addon" ] && LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$addon" +done +export LD_LIBRARY_PATH diff --git a/packages/mediacenter/kodi/scripts/cputemp b/packages/mediacenter/plexht/scripts/cputemp similarity index 100% rename from packages/mediacenter/kodi/scripts/cputemp rename to packages/mediacenter/plexht/scripts/cputemp diff --git a/packages/mediacenter/plexht/scripts/plexht-config b/packages/mediacenter/plexht/scripts/plexht-config new file mode 100755 index 0000000000..2403b851b8 --- /dev/null +++ b/packages/mediacenter/plexht/scripts/plexht-config @@ -0,0 +1,53 @@ +#!/bin/sh +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + + +# hack: make addon-bins executable +# done in kodi on addon install. but just in case.. +chmod +x /storage/.plexht/addons/*/bin/* + +# hack: update RSSnews.xml in userdata +if [ -f /storage/.plexht/userdata/RssFeeds.xml ]; then + sed -e "s,http://libreelec.tv/news?format=feed&type=rss,http://feeds.libreelec.tv/news,g" \ + -i /storage/.plexht/userdata/RssFeeds.xml +fi + +# setup OpenPHT sources +if [ ! -f $HOME/.plexht/userdata/sources.xml ]; then + if [ -f /usr/share/XBMC/config/sources.xml ]; then + cp /usr/share/XBMC/config/sources.xml $HOME/.plexht/userdata + fi +fi + +# common setup guisettings +if [ ! -f $HOME/.plexht/userdata/guisettings.xml ] ; then + if [ -f /usr/share/XBMC/config/guisettings.xml ]; then + cp /usr/share/XBMC/config/guisettings.xml $HOME/.plexht/userdata + fi +fi + +PLEXHT_ARGS="--lircdev /run/lirc/lircd" + +echo "PLEXHT_ARGS=\"$PLEXHT_ARGS\"" > /run/libreelec/plexht.conf + +if [ "$(uname -m)" = "x86_64" -o "$(uname -m)" = "aarch64" ]; then + echo "MALLOC_MMAP_THRESHOLD_=524288" >> /run/libreelec/plexht.conf + echo "MALLOC_TRIM_THRESHOLD_=1048576" >> /run/libreelec/plexht.conf + echo "MALLOC_ARENA_TEST=2" >> /run/libreelec/plexht.conf +fi diff --git a/packages/mediacenter/plexht/scripts/setwakeup.sh b/packages/mediacenter/plexht/scripts/setwakeup.sh new file mode 100755 index 0000000000..76aa3d7c26 --- /dev/null +++ b/packages/mediacenter/plexht/scripts/setwakeup.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +if [ -f /sys/class/rtc/rtc0/wakealarm ]; then + logger -t setwakeup.sh "### Setting system wakeup time ###" + echo 0 > /sys/class/rtc/rtc0/wakealarm + echo $1 > /sys/class/rtc/rtc0/wakealarm + logger -t setwakeup.sh "### $(cat /proc/driver/rtc) ###" +fi diff --git a/packages/mediacenter/kodi/scripts/systemd-addon-wrapper b/packages/mediacenter/plexht/scripts/systemd-addon-wrapper similarity index 86% rename from packages/mediacenter/kodi/scripts/systemd-addon-wrapper rename to packages/mediacenter/plexht/scripts/systemd-addon-wrapper index 32630c8ca0..60e334685d 100755 --- a/packages/mediacenter/kodi/scripts/systemd-addon-wrapper +++ b/packages/mediacenter/plexht/scripts/systemd-addon-wrapper @@ -21,15 +21,15 @@ if [ ! -d /storage/.config/system.d ] ; then mkdir -p /storage/.config/system.d fi -if [ -f "/storage/.kodi/addons/$1/system.d/$1.service" ] ; then +if [ -f "/storage/.plexht/addons/$1/system.d/$1.service" ] ; then if [ "_$2" = "_1" ] ; then # disable = true: cleanup systemctl stop "$1.service" systemctl disable "$1.service" else # disable = false: setup - systemctl enable "/storage/.kodi/addons/$1/system.d/$1.service" - chmod +x "/storage/.kodi/addons/$1/bin"/* + systemctl enable "/storage/.plexht/addons/$1/system.d/$1.service" + chmod +x "/storage/.plexht/addons/$1/bin"/* systemctl start "$1.service" fi fi diff --git a/packages/mediacenter/plexht/sleep.d.serial/10-addon-sleep.sh b/packages/mediacenter/plexht/sleep.d.serial/10-addon-sleep.sh new file mode 100755 index 0000000000..e98b9a5a6c --- /dev/null +++ b/packages/mediacenter/plexht/sleep.d.serial/10-addon-sleep.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +. /etc/profile + +# see https://wiki.archlinux.org/index.php/Power_Management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep + +for script in $HOME/.plexht/addons/*/sleep.d/*.power; do + progress "running addon sleep script $script ($@)..." + sh $script $@ +done + +exit 0 \ No newline at end of file diff --git a/packages/mediacenter/plexht/sleep.d.serial/20-custom-sleep.sh b/packages/mediacenter/plexht/sleep.d.serial/20-custom-sleep.sh new file mode 100755 index 0000000000..3ad0e0c04e --- /dev/null +++ b/packages/mediacenter/plexht/sleep.d.serial/20-custom-sleep.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +. /etc/profile + +# see https://wiki.archlinux.org/index.php/Power_Management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep + +for script in $HOME/.config/sleep.d/*.power; do + if [ -f $script ]; then + progress "running custom sleep script $script ($@)..." + sh $script $@ + fi +done + +exit 0 \ No newline at end of file diff --git a/packages/mediacenter/plexht/sleep.d/openelec-sleep.sh b/packages/mediacenter/plexht/sleep.d/openelec-sleep.sh new file mode 100755 index 0000000000..6b314cd7bd --- /dev/null +++ b/packages/mediacenter/plexht/sleep.d/openelec-sleep.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +. /etc/profile + +run_scripts() +{ + list_scripts $1 + for script in $SCRIPTS ; do + progress "running sleep script $script ($1)..." + sh /usr/lib/systemd/system-sleep.serial/$script $1 + done +} + +list_scripts() +{ + case $1 in + pre) + SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort) + ;; + post) + SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort -r) + ;; + esac +} + +run_scripts $1 + +exit 0 diff --git a/packages/mediacenter/plexht/sources/OPENPHT b/packages/mediacenter/plexht/sources/OPENPHT new file mode 100644 index 0000000000..19935a0b0c --- /dev/null +++ b/packages/mediacenter/plexht/sources/OPENPHT @@ -0,0 +1 @@ +OpenPHT-Embedded diff --git a/packages/mediacenter/plexht/system.d/plexht-autostart.service b/packages/mediacenter/plexht/system.d/plexht-autostart.service new file mode 100644 index 0000000000..112f1afc3d --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-autostart.service @@ -0,0 +1,14 @@ +[Unit] +Description=OpenPHT user autostart script +Before=plexht.service +After=network-online.target graphical.target +ConditionPathExists=/storage/.config/autostart.sh + +[Service] +Type=oneshot +Environment=HOME=/storage +ExecStart=-/bin/sh -c ". /etc/profile; exec /bin/sh /storage/.config/autostart.sh" +RemainAfterExit=yes + +[Install] +WantedBy=plexht.service diff --git a/packages/mediacenter/plexht/system.d/plexht-cleanlogs.service b/packages/mediacenter/plexht/system.d/plexht-cleanlogs.service new file mode 100644 index 0000000000..37b7e060dc --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-cleanlogs.service @@ -0,0 +1,13 @@ +[Unit] +Description=OpenPHT clean debug logs +ConditionKernelCommandLine=!debugging +ConditionPathExists=!/storage/.cache/debug.libreelec +Before=plexht.service + +[Service] +Type=oneshot +ExecStart=-/bin/sh -c 'rm -rf /storage/.plexht/userdata/addon_data/*/*.log /storage/.plexht/userdata/addon_data/*/log/*' +RemainAfterExit=yes + +[Install] +WantedBy=plexht.service diff --git a/packages/mediacenter/plexht/system.d/plexht-halt.service b/packages/mediacenter/plexht/system.d/plexht-halt.service new file mode 100644 index 0000000000..7d36dc8e35 --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-halt.service @@ -0,0 +1,15 @@ +[Unit] +Description=OpenPHT halt script +After=plexht.service +Before=systemd-halt.service +DefaultDependencies=no +ConditionPathExists=/storage/.config/shutdown.sh + +[Service] +Type=oneshot +Environment=HOME=/storage +ExecStart=-/bin/sh -c ". /etc/profile; exec /bin/sh /storage/.config/shutdown.sh halt" +RemainAfterExit=yes + +[Install] +WantedBy=halt.target diff --git a/packages/mediacenter/plexht/system.d/plexht-lirc-suspend.service b/packages/mediacenter/plexht/system.d/plexht-lirc-suspend.service new file mode 100644 index 0000000000..f229b6b193 --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-lirc-suspend.service @@ -0,0 +1,13 @@ +[Unit] +Description=LIRC sleep hook +Before=sleep.target +StopWhenUnneeded=yes + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/usr/bin/xbmc-send --host=127.0.0.1 -a "LIRC.Stop" +ExecStop=-/usr/bin/xbmc-send --host=127.0.0.1 -a "LIRC.Start" + +[Install] +WantedBy=sleep.target diff --git a/packages/mediacenter/plexht/system.d/plexht-poweroff.service b/packages/mediacenter/plexht/system.d/plexht-poweroff.service new file mode 100644 index 0000000000..886d279b8f --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-poweroff.service @@ -0,0 +1,15 @@ +[Unit] +Description=OpenPHT poweroff script +After=plexht.service +Before=systemd-poweroff.service +DefaultDependencies=no +ConditionPathExists=/storage/.config/shutdown.sh + +[Service] +Type=oneshot +Environment=HOME=/storage +ExecStart=-/bin/sh -c ". /etc/profile; exec /bin/sh /storage/.config/shutdown.sh poweroff" +RemainAfterExit=yes + +[Install] +WantedBy=poweroff.target diff --git a/packages/mediacenter/plexht/system.d/plexht-reboot.service b/packages/mediacenter/plexht/system.d/plexht-reboot.service new file mode 100644 index 0000000000..1c9c699bf7 --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-reboot.service @@ -0,0 +1,15 @@ +[Unit] +Description=OpenPHT reboot script +After=plexht.service +Before=systemd-reboot.service +DefaultDependencies=no +ConditionPathExists=/storage/.config/shutdown.sh + +[Service] +Type=oneshot +Environment=HOME=/storage +ExecStart=-/bin/sh -c ". /etc/profile; exec /bin/sh /storage/.config/shutdown.sh reboot" +RemainAfterExit=yes + +[Install] +WantedBy=reboot.target diff --git a/packages/mediacenter/plexht/system.d/plexht-waitonnetwork.service b/packages/mediacenter/plexht/system.d/plexht-waitonnetwork.service new file mode 100644 index 0000000000..555b8108a0 --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht-waitonnetwork.service @@ -0,0 +1,19 @@ +[Unit] +Description=Wait on network +Requisite=connman.service +After=connman.service +Before=network-online.target +DefaultDependencies=no +Conflicts=shutdown.target +ConditionPathExists=/storage/.cache/libreelec/network_wait + +[Service] +Type=oneshot +EnvironmentFile=/storage/.cache/libreelec/network_wait +ExecStartPre=/bin/sh -c 'echo "waiting on Network to come online ... (max. $WAIT_NETWORK_TIME sec.)"' +ExecStart=/usr/sbin/connmand-wait-online --timeout=${WAIT_NETWORK_TIME} +StandardOutput=tty +RemainAfterExit=yes + +[Install] +WantedBy=network-online.target diff --git a/packages/mediacenter/plexht/system.d/plexht.service b/packages/mediacenter/plexht/system.d/plexht.service new file mode 100644 index 0000000000..2989911b40 --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht.service @@ -0,0 +1,32 @@ +[Unit] +Description=OpenPHT +After=network-online.target graphical.target +Requires=graphical.target +Wants=network-online.target + +[Service] +Environment=__GL_YIELD=USLEEP +Environment=DISPLAY=:0.0 +Environment=SDL_MOUSE_RELATIVE=0 +Environment=HOME=/storage +Environment=XBMC_USER_HOME=/storage/.plexht +Environment=XBMC_TEMP=/storage/.plexht/temp +Environment=XBMC_BIN_HOME=/usr/lib/plexht +Environment=XBMC_HOME=/usr/share/XBMC +EnvironmentFile=-/run/libreelec/plexht.conf +EnvironmentFile=-/run/libreelec/debug/plexht.conf +ExecStartPre=-/usr/lib/plexht/plexht-config +ExecStart=/bin/sh -c ". /etc/profile; exec /usr/lib/plexht/plexhometheater --standalone -fs $PLEXHT_ARGS $PLEXHT_DEBUG" +# keep KillMode=process unless there is no good reason to switch to cgroup +KillMode=process +TimeoutStopSec=5 +Restart=always +RestartSec=2 +RestartPreventExitStatus=64 66 +StartLimitInterval=0 +LimitNOFILE=16384 + +[Install] +Alias=kodi.service +Alias=xbmc.service +WantedBy=plexht.target diff --git a/packages/mediacenter/plexht/system.d/plexht.target b/packages/mediacenter/plexht/system.d/plexht.target new file mode 100644 index 0000000000..1744530f9f --- /dev/null +++ b/packages/mediacenter/plexht/system.d/plexht.target @@ -0,0 +1,12 @@ +[Unit] +Description=OpenPHT Mediacenter Interface +Requires=multi-user.target graphical.target network-online.target +After=network-online.target graphical.target +Wants=network-online.target +Conflicts=rescue.target +AllowIsolate=yes + +[Install] +Alias=default.target +Alias=kodi.target +Alias=xbmc.target diff --git a/packages/mediacenter/plexht/system.d/storage-.kodi.mount b/packages/mediacenter/plexht/system.d/storage-.kodi.mount new file mode 100644 index 0000000000..ec7fa8d8a4 --- /dev/null +++ b/packages/mediacenter/plexht/system.d/storage-.kodi.mount @@ -0,0 +1,14 @@ +[Unit] +DefaultDependencies=no +Conflicts=umount.target +After=systemd-tmpfiles-setup.service +Before=sysinit.target umount.target + +[Mount] +What=/storage/.plexht +Where=/storage/.kodi +Type=none +Options=bind + +[Install] +WantedBy=sysinit.target diff --git a/packages/mediacenter/plexht/tmpfiles.d/plexht-userdirs.conf b/packages/mediacenter/plexht/tmpfiles.d/plexht-userdirs.conf new file mode 100644 index 0000000000..95033d1c6f --- /dev/null +++ b/packages/mediacenter/plexht/tmpfiles.d/plexht-userdirs.conf @@ -0,0 +1,25 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +d /storage/.kodi 0755 root root - - +d /storage/.plexht/userdata 0755 root root - - +d /storage/music 0755 root root - - +d /storage/pictures 0755 root root - - +d /storage/tvshows 0755 root root - - +d /storage/videos 0755 root root - - +d /storage/screenshots 0755 root root - - diff --git a/packages/mediacenter/plexht/tmpfiles.d/plexht.conf b/packages/mediacenter/plexht/tmpfiles.d/plexht.conf new file mode 100644 index 0000000000..ced88459cd --- /dev/null +++ b/packages/mediacenter/plexht/tmpfiles.d/plexht.conf @@ -0,0 +1,19 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +d /run/plexht 0755 root root - - diff --git a/packages/mediacenter/remotepi-board/config/remotepi-board.conf b/packages/mediacenter/remotepi-board/config/remotepi-board.conf new file mode 100644 index 0000000000..b661e5480f --- /dev/null +++ b/packages/mediacenter/remotepi-board/config/remotepi-board.conf @@ -0,0 +1,45 @@ +begin remote + name RemotePi1 + bits 8 + flags RC6|CONST_LENGTH + eps 30 + aeps 100 + header 2667 889 + one 444 444 + zero 444 444 + pre_data_bits 13 + pre_data 0xEFB + gap 108000 + toggle_bit_mask 0x10000 + rc6_mask 0x10000 + min_repeat 2 + suppress_repeat 6 + begin codes + KEY_OK 0xA3 + KEY_LEFT 0xA5 + KEY_RIGHT 0xA4 + KEY_DOWN 0xA6 + KEY_UP 0xA7 + KEY_EXIT 0x7C + KEY_PLAYPAUSE 0xD3 + KEY_STOP 0xCE + KEY_SUBTITLE 0xB4 + KEY_AUDIO 0xB1 + KEY_PREVIOUS 0xDE + KEY_NEXT 0xDF + KEY_HOME 0x2E + KEY_INFO 0xF0 + KEY_NUMERIC_0 0xFF + KEY_NUMERIC_1 0xFE + KEY_NUMERIC_2 0xFD + KEY_NUMERIC_3 0xFC + KEY_NUMERIC_4 0xFB + KEY_NUMERIC_5 0xFA + KEY_NUMERIC_6 0xF9 + KEY_NUMERIC_7 0xF8 + KEY_NUMERIC_8 0xF7 + KEY_NUMERIC_9 0xF6 + KEY_MUTE 0xF2 + KEY_EPG 0x7D + end codes +end remote diff --git a/packages/mediacenter/remotepi-board/package.mk b/packages/mediacenter/remotepi-board/package.mk new file mode 100644 index 0000000000..59f27cc4ec --- /dev/null +++ b/packages/mediacenter/remotepi-board/package.mk @@ -0,0 +1,46 @@ +################################################################################ +# 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. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################ + +PKG_NAME="remotepi-board" +PKG_VERSION="2015" +PKG_ARCH="any" +PKG_LICENSE="various" +PKG_SITE="http://www.msldigital.com" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="mediacenter" +PKG_SHORTDESC="Scripts for the RemotePi Board 2013/2015/Plus 2015" +PKG_LONGDESC="Scripts for the RemotePi Board 2013/2015/Plus 2015" + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +make_target() { + : # nothing todo +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp $PKG_DIR/scripts/remotepi-board $INSTALL/usr/bin + cp $PKG_DIR/scripts/remotepi-board-shutdown $INSTALL/usr/bin + + mkdir -p $INSTALL/etc/lirc/lircd.conf.d + cp -r $PKG_DIR/config/* $INSTALL/etc/lirc/lircd.conf.d +} + +post_install() { + enable_service remotepi-board.service + enable_service remotepi-board-shutdown.service +} diff --git a/packages/mediacenter/remotepi-board/scripts/remotepi-board b/packages/mediacenter/remotepi-board/scripts/remotepi-board new file mode 100755 index 0000000000..b5b7cbefd8 --- /dev/null +++ b/packages/mediacenter/remotepi-board/scripts/remotepi-board @@ -0,0 +1,43 @@ +#!/bin/sh +################################################################################ +# 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. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################ + +. /etc/profile + +if [ ! -f /storage/.cache/services/remotepi-board.conf ]; then + exit +fi + +BOARD_VERSION=2015 +. /storage/.cache/services/remotepi-board.conf + +# this is the GPIO pin receiving the shutdown signal +GPIOpin1=14 +if [ "$BOARD_VERSION" = "2013" ]; then + GPIOpin1=22 +fi + +echo "$GPIOpin1" > /sys/class/gpio/export +echo "in" > /sys/class/gpio/gpio$GPIOpin1/direction +while true; do + sleep 1 + power=$(cat /sys/class/gpio/gpio$GPIOpin1/value) + if [ $power != 0 ]; then + touch /tmp/.remotepi-board-shutdown + systemctl stop plexht + systemctl poweroff + break + fi +done diff --git a/packages/mediacenter/remotepi-board/scripts/remotepi-board-shutdown b/packages/mediacenter/remotepi-board/scripts/remotepi-board-shutdown new file mode 100755 index 0000000000..e1b20d8861 --- /dev/null +++ b/packages/mediacenter/remotepi-board/scripts/remotepi-board-shutdown @@ -0,0 +1,54 @@ +#!/bin/sh +################################################################################ +# 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. +# +# This program 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################ + +. /etc/profile + +if [ ! -f /storage/.cache/services/remotepi-board.conf ]; then + exit +fi + +BOARD_VERSION=2015 +. /storage/.cache/services/remotepi-board.conf + +if [ ! -f /tmp/.remotepi-board-shutdown -a "$BOARD_VERSION" = "2015" ]; then + GPIOpin=15 + echo "$GPIOpin" > /sys/class/gpio/export + + # execute shutdown sequence on pin + echo "out" > /sys/class/gpio/gpio$GPIOpin/direction + echo "1" > /sys/class/gpio/gpio$GPIOpin/value + usleep 125000 + echo "0" > /sys/class/gpio/gpio$GPIOpin/value + usleep 200000 + echo "1" > /sys/class/gpio/gpio$GPIOpin/value + usleep 400000 + echo "0" > /sys/class/gpio/gpio$GPIOpin/value + sleep 1 +fi + +# this is the GPIO pin receiving the shutdown signal +GPIOpin1=14 +if [ "$BOARD_VERSION" = "2013" ]; then + GPIOpin1=22 +fi + +# enable gpio export to userland +echo "$GPIOpin1" > /sys/class/gpio/export + +# write high to gpio at least 3 seconds +echo "out" > /sys/class/gpio/gpio$GPIOpin1/direction +echo "1" > /sys/class/gpio/gpio$GPIOpin1/value +sleep 3 diff --git a/packages/mediacenter/remotepi-board/system.d/remotepi-board-shutdown.service b/packages/mediacenter/remotepi-board/system.d/remotepi-board-shutdown.service new file mode 100644 index 0000000000..3fa261f163 --- /dev/null +++ b/packages/mediacenter/remotepi-board/system.d/remotepi-board-shutdown.service @@ -0,0 +1,14 @@ +[Unit] +Description=RemotePi Board shutdown service +ConditionPathExists=/storage/.cache/services/remotepi-board.conf +After=plexht.service +Before=systemd-poweroff.service +DefaultDependencies=no + +[Service] +Type=oneshot +Environment=HOME=/storage +ExecStart=/usr/bin/remotepi-board-shutdown + +[Install] +WantedBy=poweroff.target \ No newline at end of file diff --git a/packages/mediacenter/remotepi-board/system.d/remotepi-board.service b/packages/mediacenter/remotepi-board/system.d/remotepi-board.service new file mode 100644 index 0000000000..203dc30374 --- /dev/null +++ b/packages/mediacenter/remotepi-board/system.d/remotepi-board.service @@ -0,0 +1,13 @@ +[Unit] +Description=RemotePi Board service +ConditionPathExists=/storage/.cache/services/remotepi-board.conf +Before=plexht.service +After=graphical.target + +[Service] +Type=simple +Environment=HOME=/storage +ExecStart=/usr/bin/remotepi-board + +[Install] +WantedBy=plexht.service \ No newline at end of file diff --git a/packages/multimedia/SDL/package.mk b/packages/multimedia/SDL/package.mk new file mode 100644 index 0000000000..865ad49e29 --- /dev/null +++ b/packages/multimedia/SDL/package.mk @@ -0,0 +1,210 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="SDL" +PKG_VERSION="1.2.15" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.libsdl.org/" +PKG_URL="http://www.libsdl.org/release/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="yasm:host" +PKG_DEPENDS_TARGET="toolchain yasm:host alsa-lib" +PKG_SECTION="multimedia" +PKG_SHORTDESC="libsdl: A cross-platform Graphic API" +PKG_LONGDESC="Simple DirectMedia Layer is a cross-platform multimedia library designed to provide fast access to the graphics framebuffer and audio device. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of 'Civilization: Call To Power.' Simple DirectMedia Layer supports Linux, Win32, BeOS, MacOS, Solaris, IRIX, and FreeBSD." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="no" + +PKG_CONFIGURE_OPTS_HOST="--enable-rpath \ + --enable-libc \ + --disable-audio \ + --disable-events \ + --disable-joystick \ + --disable-cdrom \ + --enable-threads \ + --enable-timers \ + --enable-file \ + --enable-loadso \ + --enable-cpuinfo \ + --enable-assembly \ + --disable-oss \ + --disable-alsa \ + --disable-alsatest \ + --disable-alsa-shared \ + --disable-esd \ + --disable-esdtest \ + --disable-esd-shared \ + --disable-pulseaudio \ + --disable-pulseaudio-shared \ + --disable-arts \ + --disable-arts-shared \ + --disable-nas \ + --disable-diskaudio \ + --disable-dummyaudio \ + --disable-mintaudio \ + --disable-nasm \ + --disable-altivec \ + --disable-ipod \ + --disable-video \ + --disable-x11-shared \ + --disable-video-x11-dgamouse \ + --disable-video-x11-xinerama \ + --disable-video-x11-xme \ + --disable-video-x11-xrandr \ + --disable-video-x11 \ + --disable-video-x11-vm \ + --disable-video-x11-xv \ + --without-x \ + --disable-video-opengl \ + --disable-video-nanox \ + --disable-nanox-debug \ + --disable-nanox-share-memory \ + --disable-nanox-direct-fb \ + --disable-dga \ + --disable-video-dga \ + --disable-video-photon \ + --disable-video-carbon \ + --disable-video-cocoa \ + --disable-video-fbcon \ + --disable-video-directfb \ + --disable-video-ps2gs \ + --disable-video-ggi \ + --disable-video-svga \ + --disable-video-vgl \ + --disable-video-wscons \ + --disable-video-aalib \ + --disable-video-qtopia \ + --disable-video-picogui \ + --disable-video-dummy \ + --disable-osmesa-shared \ + --disable-input-events \ + --disable-input-tslib \ + --disable-pth \ + --enable-pthreads \ + --enable-pthread-sem \ + --disable-stdio-redirect \ + --disable-directx \ + --enable-sdl-dlopen \ + --disable-atari-ldg \ + --disable-clock_gettime" + +PKG_CONFIGURE_OPTS_TARGET="--disable-rpath \ + --enable-libc \ + --enable-audio \ + --enable-events \ + --enable-joystick \ + --enable-cdrom \ + --enable-threads \ + --enable-timers \ + --enable-file \ + --enable-loadso \ + --enable-cpuinfo \ + --enable-assembly \ + --disable-oss \ + --enable-alsa \ + --disable-alsatest \ + --enable-alsa-shared \ + --with-alsa-prefix=$SYSROOT_PREFIX/usr/lib \ + --with-alsa-inc-prefix=$SYSROOT_PREFIX/usr/include \ + --disable-esd \ + --disable-esdtest \ + --disable-esd-shared \ + --disable-arts \ + --disable-arts-shared \ + --disable-nas \ + --disable-diskaudio \ + --disable-dummyaudio \ + --disable-mintaudio \ + --disable-nasm \ + --disable-altivec \ + --disable-ipod \ + --disable-video-nanox \ + --disable-nanox-debug \ + --disable-nanox-share-memory \ + --disable-nanox-direct-fb \ + --disable-dga \ + --disable-video-dga \ + --disable-video-photon \ + --disable-video-carbon \ + --disable-video-cocoa \ + --disable-video-fbcon \ + --disable-video-directfb \ + --disable-video-ps2gs \ + --disable-video-ggi \ + --disable-video-svga \ + --disable-video-vgl \ + --disable-video-wscons \ + --disable-video-aalib \ + --disable-video-qtopia \ + --disable-video-picogui \ + --disable-video-dummy \ + --disable-osmesa-shared \ + --enable-input-events \ + --disable-input-tslib \ + --disable-pth \ + --enable-pthreads \ + --enable-pthread-sem \ + --disable-stdio-redirect \ + --disable-directx \ + --enable-sdl-dlopen \ + --disable-atari-ldg \ + --disable-clock_gettime" + +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXrandr" + + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-video --enable-x11-shared --disable-video-x11-dgamouse" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xinerama --disable-video-x11-xme" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-video-x11-xrandr --enable-video-x11" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-vm --disable-video-x11-xv --with-x" +else + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video --disable-x11-shared --disable-video-x11-dgamouse" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xinerama --disable-video-x11-xme" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xrandr --disable-video-x11" + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-vm --disable-video-x11-xv --without-x" +fi + +if [ ! "$OPENGL" = "no" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu" + + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-video-opengl" +else + PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-opengl" +fi + +pre_configure_host() { + ( cd $PKG_BUILD + # Skip autoheader because there is a problem with AC_DEFINE's in the configure.in in SDL 1.2.14. + # Added include directory 'acinclude' because SDL 1.2.14 has no Makefile.am in which to specify it. + AUTOHEADER=true autoreconf --verbose --install --force -I $SYSROOT_PREFIX/usr/share/aclocal -I acinclude + ) +} + +pre_configure_target() { + # todo: hack + pre_configure_host +} + +post_makeinstall_target() { + mkdir -p $TOOLCHAIN/bin + cp $SYSROOT_PREFIX/usr/bin/sdl-config $TOOLCHAIN/bin + $SED "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/sdl-config + + rm -rf $INSTALL/usr/bin +} diff --git a/packages/multimedia/SDL/patches/SDL-1.2.15-11_joystick_misc_axes.patch b/packages/multimedia/SDL/patches/SDL-1.2.15-11_joystick_misc_axes.patch new file mode 100644 index 0000000000..75e3755c93 --- /dev/null +++ b/packages/multimedia/SDL/patches/SDL-1.2.15-11_joystick_misc_axes.patch @@ -0,0 +1,13 @@ +diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c +index ee43974..80e46e4 100644 +--- a/src/joystick/linux/SDL_sysjoystick.c ++++ b/src/joystick/linux/SDL_sysjoystick.c +@@ -702,7 +702,7 @@ static SDL_bool EV_ConfigJoystick(SDL_Joystick *joystick, int fd) + ++joystick->nbuttons; + } + } +- for ( i=0; imod = (SDLMod)modstate; + switch (keysym->sym) { + case SDLK_UNKNOWN: ++ repeatable = 1; + break; + case SDLK_NUMLOCK: + modstate ^= KMOD_NUM; diff --git a/packages/multimedia/SDL/patches/SDL-1.2.15-libX11-1.6.patch b/packages/multimedia/SDL/patches/SDL-1.2.15-libX11-1.6.patch new file mode 100644 index 0000000000..5bb14d4b95 --- /dev/null +++ b/packages/multimedia/SDL/patches/SDL-1.2.15-libX11-1.6.patch @@ -0,0 +1,59 @@ + +# HG changeset patch +# User Azamat H. Hackimov +# Date 1370184533 -21600 +# Node ID 91ad7b43317a6387e115ecdf63a49137f47e42c8 +# Parent f7fd5c3951b9ed922fdf696f7182e71b58a13268 +Fix compilation with libX11 >= 1.5.99.902. + +These changes fixes bug #1769 for SDL 1.2 +(http://bugzilla.libsdl.org/show_bug.cgi?id=1769). + +diff -r f7fd5c3951b9 -r 91ad7b43317a configure.in +--- a/configure.in Wed Apr 17 00:56:53 2013 -0700 ++++ b/configure.in Sun Jun 02 20:48:53 2013 +0600 +@@ -1169,6 +1169,17 @@ + if test x$definitely_enable_video_x11_xrandr = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR) + fi ++ AC_MSG_CHECKING(for const parameter to _XData32) ++ have_const_param_xdata32=no ++ AC_TRY_COMPILE([ ++ #include ++ extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len); ++ ],[ ++ ],[ ++ have_const_param_xdata32=yes ++ AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32) ++ ]) ++ AC_MSG_RESULT($have_const_param_xdata32) + fi + fi + } +diff -r f7fd5c3951b9 -r 91ad7b43317a include/SDL_config.h.in +--- a/include/SDL_config.h.in Wed Apr 17 00:56:53 2013 -0700 ++++ b/include/SDL_config.h.in Sun Jun 02 20:48:53 2013 +0600 +@@ -283,6 +283,7 @@ + #undef SDL_VIDEO_DRIVER_WINDIB + #undef SDL_VIDEO_DRIVER_WSCONS + #undef SDL_VIDEO_DRIVER_X11 ++#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 + #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE + #undef SDL_VIDEO_DRIVER_X11_DYNAMIC + #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT +diff -r f7fd5c3951b9 -r 91ad7b43317a src/video/x11/SDL_x11sym.h +--- a/src/video/x11/SDL_x11sym.h Wed Apr 17 00:56:53 2013 -0700 ++++ b/src/video/x11/SDL_x11sym.h Sun Jun 02 20:48:53 2013 +0600 +@@ -165,7 +165,11 @@ + */ + #ifdef LONG64 + SDL_X11_MODULE(IO_32BIT) ++#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 ++SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return) ++#else + SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return) ++#endif + SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),) + #endif + + diff --git a/packages/multimedia/SDL/patches/SDL-1.2.15-reenable_xrandr.patch b/packages/multimedia/SDL/patches/SDL-1.2.15-reenable_xrandr.patch new file mode 100644 index 0000000000..277dc42661 --- /dev/null +++ b/packages/multimedia/SDL/patches/SDL-1.2.15-reenable_xrandr.patch @@ -0,0 +1,32 @@ + +# HG changeset patch +# User Sam Lantinga +# Date 1255169641 0 +# Node ID 8ec3036098dfd648a492a4a9e2c692c309188239 +# Parent f2f8525e60c21beefa8956e43a07ea2f5c12bc33 +Adapted from Debian patch: 320_activate_xrandr_on_default.diff + +diff -r f2f8525e60c2 -r 8ec3036098df src/video/x11/SDL_x11modes.c +--- a/src/video/x11/SDL_x11modes.c Sat Oct 10 10:10:36 2009 +0000 ++++ b/src/video/x11/SDL_x11modes.c Sat Oct 10 10:14:01 2009 +0000 +@@ -421,11 +421,16 @@ + return 0; + } + +- /* This defaults off now, due to KDE window maximize problems */ +- if ( !env ) { ++ /* This used to default off, due to KDE window maximize problems */ ++ /* Reactivated since I haven't encountered such problems with KDE, but if ++ one does encounter such problems he/she can just set ++ SDL_VIDEO_X11_XRANDR to 0 ++ Closes Debian bug: #450689 ++ */ ++/* if ( !env ) { + return 0; + } +- ++*/ + if ( !SDL_X11_HAVE_XRANDR ) { + return 0; + } + diff --git a/packages/multimedia/SDL/patches/SDL-1.2.15-rh484362.patch b/packages/multimedia/SDL/patches/SDL-1.2.15-rh484362.patch new file mode 100644 index 0000000000..c8373225fb --- /dev/null +++ b/packages/multimedia/SDL/patches/SDL-1.2.15-rh484362.patch @@ -0,0 +1,13 @@ +diff -up SDL-1.2.13/include/SDL_stdinc.h~ SDL-1.2.13/include/SDL_stdinc.h +--- SDL-1.2.13/include/SDL_stdinc.h~ 2007-12-31 05:48:36.000000000 +0100 ++++ SDL-1.2.13/include/SDL_stdinc.h 2009-02-13 11:01:34.000000000 +0100 +@@ -320,7 +320,7 @@ do { \ + #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) + #endif + +-#if defined(__GNUC__) && defined(i386) ++#if 0 + #define SDL_revcpy(dst, src, len) \ + do { \ + int u0, u1, u2; \ + diff --git a/packages/multimedia/SDL2/package.mk b/packages/multimedia/SDL2/package.mk index 8beb51f558..330996dc7d 100644 --- a/packages/multimedia/SDL2/package.mk +++ b/packages/multimedia/SDL2/package.mk @@ -1,122 +1,107 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="SDL2" -PKG_VERSION="2.0.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.0.8" +PKG_SHA256="edc77c57308661d576e843344d8638e025a7818bff73f8fbfab09c3c5fd092ec" PKG_LICENSE="GPL" PKG_SITE="https://www.libsdl.org/" PKG_URL="https://www.libsdl.org/release/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain yasm:host alsa-lib systemd dbus" -PKG_SECTION="multimedia" -PKG_SHORTDESC="SDL2: A cross-platform Graphic API" -PKG_LONGDESC="Simple DirectMedia Layer is a cross-platform multimedia library designed to provide fast access to the graphics framebuffer and audio device. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of 'Civilization: Call To Power.' Simple DirectMedia Layer supports Linux, Win32, BeOS, MacOS, Solaris, IRIX, and FreeBSD." - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static \ - --enable-libc \ - --enable-gcc-atomics \ - --enable-atomic \ - --enable-audio \ - --enable-render \ - --enable-events \ - --enable-joystick \ - --enable-haptic \ - --enable-power \ - --enable-filesystem \ - --enable-threads \ - --enable-timers \ - --enable-file \ - --enable-loadso \ - --enable-cpuinfo \ - --enable-assembly \ - --disable-altivec \ - --disable-oss \ - --enable-alsa --disable-alsatest --enable-alsa-shared \ - --with-alsa-prefix=$SYSROOT_PREFIX/usr/lib \ - --with-alsa-inc-prefix=$SYSROOT_PREFIX/usr/include \ - --disable-esd --disable-esdtest --disable-esd-shared \ - --disable-arts --disable-arts-shared \ - --disable-nas --enable-nas-shared \ - --disable-sndio --enable-sndio-shared \ - --disable-diskaudio \ - --disable-dummyaudio \ - --disable-video-wayland --enable-video-wayland-qt-touch --disable-wayland-shared \ - --disable-video-mir --disable-mir-shared \ - --disable-video-cocoa \ - --disable-video-directfb --disable-directfb-shared \ - --disable-fusionsound --disable-fusionsound-shared \ - --disable-video-dummy \ - --enable-libudev \ - --enable-dbus \ - --disable-input-tslib \ - --enable-pthreads --enable-pthread-sem \ - --disable-directx \ - --enable-sdl-dlopen \ - --disable-clock_gettime \ - --disable-rpath \ - --disable-render-d3d" +PKG_DEPENDS_TARGET="toolchain alsa-lib systemd dbus" +PKG_LONGDESC="A cross-platform multimedia library designed to provide fast access to the graphics framebuffer and audio device. " +PKG_BUILD_FLAGS="+pic" +if [ "$TARGET_ARCH" = "x86_64" ]; then + PKG_DEPENDS_TARGET+=" nasm:host" + PKG_SDL2_X86ASM="-DASSEMBLY=ON" +else + # Only x86(-64) and ppc assembly present as of 2.0.8 + PKG_SDL2_X86ASM="-DASSEMBLY=OFF" +fi +PKG_CMAKE_OPTS_TARGET="-DSDL_STATIC=ON \ + -DSDL_SHARED=OFF \ + -DLIBC=ON \ + -DGCC_ATOMICS=ON \ + $PKG_SDL2_X86ASM \ + -DALTIVEC=OFF \ + -DOSS=OFF \ + -DALSA=ON \ + -DALSA_SHARED=ON \ + -DESD=OFF \ + -DESD_SHARED=OFF \ + -DARTS=OFF \ + -DARTS_SHARED=OFF \ + -DNAS=OFF \ + -DNAS_SHARED=ON \ + -DSNDIO=OFF \ + -DDISKAUDIO=OFF \ + -DDUMMYAUDIO=OFF \ + -DVIDEO_WAYLAND=OFF \ + -DVIDEO_WAYLAND_QT_TOUCH=ON \ + -DWAYLAND_SHARED=OFF \ + -DVIDEO_MIR=OFF \ + -DMIR_SHARED=OFF \ + -DVIDEO_COCOA=OFF \ + -DVIDEO_DIRECTFB=OFF \ + -DDIRECTFB_SHARED=OFF \ + -DFUSIONSOUND=OFF \ + -DFUSIONSOUND_SHARED=OFF \ + -DVIDEO_DUMMY=OFF \ + -DINPUT_TSLIB=OFF \ + -DPTHREADS=ON \ + -DPTHREADS_SEM=ON \ + -DDIRECTX=OFF \ + -DSDL_DLOPEN=ON \ + -DCLOCK_GETTIME=OFF \ + -DRPATH=OFF \ + -DRENDER_D3D=OFF" if [ "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libX11 libXrandr" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-video --enable-video-x11 --enable-x11-shared" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xcursor --disable-video-x11-xinerama" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xinput --enable-video-x11-xrandr" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-scrnsaver --disable-video-x11-xshape" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-vm --with-x" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET \ + -DVIDEO_X11=ON \ + -DX11_SHARED=ON \ + -DVIDEO_X11_XCURSOR=OFF \ + -DVIDEO_X11_XINERAMA=OFF \ + -DVIDEO_X11_XINPUT=OFF \ + -DVIDEO_X11_XRANDR=ON \ + -DVIDEO_X11_XSCRNSAVER=OFF \ + -DVIDEO_X11_XSHAPE=OFF \ + -DVIDEO_X11_XVM=OFF" else - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video --disable-video-x11 --disable-x11-shared" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xcursor --disable-video-x11-xinerama" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-xinput --disable-video-x11-xrandr" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-scrnsaver --disable-video-x11-xshape" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-x11-vm --without-x" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET \ + -DVIDEO_X11=OFF" fi if [ ! "$OPENGL" = "no" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL glu" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-video-opengl --disable-video-opengles" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET \ + -DVIDEO_OPENGL=ON \ + -DVIDEO_OPENGLES=OFF" else - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-video-opengl --disable-video-opengles" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET \ + -DVIDEO_OPENGL=OFF \ + -DVIDEO_OPENGLES=ON" fi if [ "$PULSEAUDIO_SUPPORT" = yes ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET pulseaudio" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-pulseaudio --enable-pulseaudio-shared" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET \ + -DPULSEAUDIO=ON \ + -DPULSEAUDIO_SHARED=ON" else - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --disable-pulseaudio --disable-pulseaudio-shared" + PKG_CMAKE_OPTS_TARGET="$PKG_CMAKE_OPTS_TARGET \ + -DPULSEAUDIO=OFF \ + -DPULSEAUDIO_SHARED=OFF" fi -pre_make_target() { -# dont build parallel - MAKEFLAGS=-j1 -} - post_makeinstall_target() { - $SED "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/sdl2-config + sed -e "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/sdl2-config rm -rf $INSTALL/usr/bin } diff --git a/packages/multimedia/SDL_image/package.mk b/packages/multimedia/SDL_image/package.mk new file mode 100644 index 0000000000..f101874172 --- /dev/null +++ b/packages/multimedia/SDL_image/package.mk @@ -0,0 +1,68 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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. +# +# OpenELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +PKG_NAME="SDL_image" +PKG_VERSION="1.2.12" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.libsdl.org/" +PKG_URL="http://www.libsdl.org/projects/SDL_image/release/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="SDL:host libpng:host libjpeg-turbo:host" +PKG_DEPENDS_TARGET="toolchain SDL libjpeg-turbo libpng tiff" +PKG_SECTION="multimedia" +PKG_SHORTDESC="libsdl_image: A cross-platform Graphic API" +PKG_LONGDESC="SDL_image is an image loading library that is used with the SDL library, and almost as portable. It allows a programmer to use multiple image formats without having to code all the loading and conversion algorithms themselves." + +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" + +PKG_CONFIGURE_OPTS_HOST="--disable-bmp \ + --disable-gif \ + --enable-jpg \ + --disable-jpg-shared \ + --disable-lbm \ + --disable-pcx \ + --enable-png \ + --disable-png-shared \ + --disable-pnm \ + --disable-tga \ + --disable-tif \ + --disable-tif-shared \ + --disable-webp \ + --disable-webp-shared \ + --disable-xcf \ + --disable-xpm \ + --disable-xv \ + --with-sdl-prefix=$TOOLCHAIN" + +PKG_CONFIGURE_OPTS_TARGET="--enable-bmp \ + --enable-gif \ + --enable-jpg \ + --disable-jpg-shared \ + --disable-lbm \ + --enable-pcx \ + --enable-png \ + --disable-png-shared \ + --enable-pnm \ + --enable-tga \ + --enable-tif \ + --disable-tif-shared \ + --enable-xcf \ + --enable-xpm \ + --enable-xv \ + --with-sdl-prefix=$SYSROOT_PREFIX/usr" diff --git a/packages/multimedia/aom/package.mk b/packages/multimedia/aom/package.mk new file mode 100644 index 0000000000..641c2222cd --- /dev/null +++ b/packages/multimedia/aom/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="aom" +PKG_VERSION="06e2c4fa33edb7f27702fbe2ad2311622da956b4" +PKG_SHA256="9c4d7943de97af0153a38151f40c7a926f331d4a3b7dceea4e179173ce51c654" +PKG_LICENSE="BSD" +PKG_SITE="https://www.webmproject.org" +PKG_URL="http://repo.or.cz/aom.git/snapshot/${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="AV1 Codec Library" + +PKG_CMAKE_OPTS_TARGET="-DENABLE_CCACHE=1 \ + -DENABLE_DOCS=0 \ + -DENABLE_EXAMPLES=0 \ + -DENABLE_TESTS=0 \ + -DENABLE_TOOLS=0" + +if ! target_has_feature neon; then + PKG_CMAKE_OPTS_TARGET+=" -DENABLE_NEON=0 -DENABLE_NEON_ASM=0" +fi diff --git a/packages/multimedia/dav1d/package.mk b/packages/multimedia/dav1d/package.mk new file mode 100644 index 0000000000..275aca4d13 --- /dev/null +++ b/packages/multimedia/dav1d/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="dav1d" +PKG_VERSION="0e3c21979b5e2e6e7e49968b1377e38220c58774" +PKG_SHA256="3662184809fa29af39c920877cedec3724dc5c3cf71d94bec424f2a7ee4825cf" +PKG_LICENSE="BSD" +PKG_SITE="http://www.jbkempf.com/blog/post/2018/Introducing-dav1d" +PKG_URL="https://code.videolan.org/videolan/dav1d/-/archive/${PKG_VERSION}/dav1d-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS_TARGET="toolchain nasm:host" +PKG_LONGDESC="dav1d is an AV1 decoder :)" diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk index 75d878119b..691ae64e85 100644 --- a/packages/multimedia/ffmpeg/package.mk +++ b/packages/multimedia/ffmpeg/package.mk @@ -17,15 +17,12 @@ ################################################################################ PKG_NAME="ffmpeg" -# Current branch is: release/3.1-xbmc -PKG_VERSION="33c167d" -PKG_REV="1" +PKG_VERSION="2.8.14" PKG_ARCH="any" PKG_LICENSE="LGPLv2.1+" PKG_SITE="https://ffmpeg.org" -PKG_URL="https://github.com/xbmc/FFmpeg/archive/${PKG_VERSION}.tar.gz" -PKG_SOURCE_DIR="FFmpeg-${PKG_VERSION}*" -PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libressl speex" +PKG_URL="https://ffmpeg.org/releases/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libvorbis openssl dcadec speex" PKG_SECTION="multimedia" PKG_SHORTDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video." PKG_LONGDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video." @@ -83,14 +80,14 @@ if [ "$DISPLAYSERVER" = "x11" ]; then fi pre_configure_target() { - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME # ffmpeg fails building for x86_64 with LTO support - strip_lto + #strip_lto # ffmpeg fails running with GOLD support - strip_gold + #strip_gold if [ "$KODIPLAYER_DRIVER" = "bcm2835-driver" ]; then @@ -118,18 +115,18 @@ configure_target() { --host-ldflags="$HOST_LDFLAGS" \ --host-libs="-lm" \ --extra-cflags="$CFLAGS" \ - --extra-ldflags="$LDFLAGS" \ + --extra-ldflags="$LDFLAGS -fPIC" \ --extra-libs="$FFMPEG_LIBS" \ --disable-static \ --enable-shared \ --enable-gpl \ --disable-version3 \ - --disable-nonfree \ + --enable-nonfree \ --enable-logging \ --disable-doc \ $FFMPEG_DEBUG \ --enable-pic \ - --pkg-config="$ROOT/$TOOLCHAIN/bin/pkg-config" \ + --pkg-config="$TOOLCHAIN/bin/pkg-config" \ --enable-optimizations \ --disable-extra-warnings \ --disable-ffprobe \ @@ -189,6 +186,7 @@ configure_target() { --disable-libopencore-amrwb \ --disable-libopencv \ --disable-libdc1394 \ + --enable-libdcadec \ --disable-libfaac \ --disable-libfreetype \ --disable-libgsm \ @@ -199,8 +197,9 @@ configure_target() { --disable-libschroedinger \ --enable-libspeex \ --disable-libtheora \ + --disable-libvo-aacenc \ --disable-libvo-amrwbenc \ - --disable-libvorbis \ + --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis \ --disable-libvpx \ --disable-libx264 \ --disable-libxavs \ diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-050-libressl-is-free.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-050-libressl-is-free.patch deleted file mode 100644 index 8a06cdcb41..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-050-libressl-is-free.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/configure b/configure -index 3960b73..2d9ec93 100755 ---- a/configure -+++ b/configure -@@ -4545,7 +4545,6 @@ die_license_disabled nonfree libaacplus - die_license_disabled nonfree libfaac - die_license_disabled nonfree nvenc - enabled gpl && die_license_disabled_gpl nonfree libfdk_aac --enabled gpl && die_license_disabled_gpl nonfree openssl - - die_license_disabled version3 libopencore_amrnb - die_license_disabled version3 libopencore_amrwb diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-Resolve-plex-direct-domains.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-Resolve-plex-direct-domains.patch new file mode 100644 index 0000000000..7e377aecef --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-Resolve-plex-direct-domains.patch @@ -0,0 +1,37 @@ +commit eb2a7e1eb920cd9e44223607978344cf4b95d990 +Author: Jonas Karlman +Date: Tue Jun 16 02:47:28 2015 +0200 + + Resolve .plex.direct domains + +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index 3c3f4f5..e543c06 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -67,6 +67,8 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + int ret; + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; ++ size_t len; ++ char *c; + s->open_timeout = 5000000; + + av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), +@@ -102,6 +104,17 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + snprintf(portstr, sizeof(portstr), "%d", port); + if (s->listen) + hints.ai_flags |= AI_PASSIVE; ++ len = strlen(hostname); ++ if (len > 12 && !strcmp(hostname + len - 12, ".plex.direct")) { ++ for (c = hostname; *c; c++) { ++ if (*c == '-') { ++ *c = '.'; ++ } else if (*c == '.') { ++ *c = '\0'; ++ break; ++ } ++ } ++ } + if (!hostname[0]) + ret = getaddrinfo(NULL, portstr, &hints, &ai); + else diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-kodi.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-kodi.patch new file mode 100644 index 0000000000..27b2c1b973 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-2.8-kodi.patch @@ -0,0 +1,585 @@ +From 007ee4796d1621ef6070fdef9aa10ff227ee20b4 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 11 Sep 2011 19:04:51 +0200 +Subject: [PATCH 01/13] Support raw dvdsub palette as stored on normal dvd's + +This is how the palette is stored on dvd's. Currently +only xbmc passes the palette information to libavcodec +this way. +--- + libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c +index f009824..bbee694 100644 +--- a/libavcodec/dvdsubdec.c ++++ b/libavcodec/dvdsubdec.c +@@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * + } + } + ++static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values) ++{ ++ uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; ++ uint8_t r, g, b; ++ int i, y, cb, cr, a; ++ int r_add, g_add, b_add; ++ ++ for (i = num_values; i > 0; i--) { ++ a = *ayvu++; ++ y = *ayvu++; ++ cr = *ayvu++; ++ cb = *ayvu++; ++ YUV_TO_RGB1_CCIR(cb, cr); ++ YUV_TO_RGB2_CCIR(r, g, b, y); ++ *argb++ = (a << 24) | (r << 16) | (g << 8) | b; ++ } ++} ++ + static int decode_run_2bit(GetBitContext *gb, int *color) + { + unsigned int v, t; +@@ -708,6 +726,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) + parse_ifo_palette(ctx, ctx->ifo_str); + if (ctx->palette_str) + parse_palette(ctx, ctx->palette_str); ++ ++ if (!ctx->has_palette && avctx->extradata_size == 64) { ++ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16); ++ ctx->has_palette = 1; ++ } ++ + if (ctx->has_palette) { + int i; + av_log(avctx, AV_LOG_DEBUG, "palette:"); + +From 3b001c5375fdcb0fca89c813bf808da35f904323 Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Mon, 28 Jun 2010 01:55:31 -0400 +Subject: [PATCH 02/13] if av_read_packet returns AVERROR_IO, we are done. + ffmpeg's codecs might or might not handle returning any completed demuxed + packets correctly + +--- + libavformat/utils.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libavformat/utils.c b/libavformat/utils.c +index 30567fa..8a947d6 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -1329,6 +1329,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) + if (ret < 0) { + if (ret == AVERROR(EAGAIN)) + return ret; ++ if (ret == AVERROR(EIO)) ++ return ret; + /* flush the parsers */ + for (i = 0; i < s->nb_streams; i++) { + st = s->streams[i]; + +From 75902cb6825c581853636147020f1be99aba198c Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Mon, 28 Jun 2010 02:10:50 -0400 +Subject: [PATCH 03/13] added: Ticket #7187, TV Teletext support for DVB EBU + Teletext streams + +--- + libavcodec/avcodec.h | 4 ++++ + libavformat/mpegts.c | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h +index 9d38b59..bc1b1b9 100644 +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -532,6 +532,10 @@ enum AVCodecID { + AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska + AV_CODEC_ID_HDMV_TEXT_SUBTITLE = MKBETAG('B','D','T','X'), + ++ /* data codecs */ ++ AV_CODEC_ID_VBI_DATA= 0x17500, ++ AV_CODEC_ID_VBI_TELETEXT, ++ + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 65824dd..338861e 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -756,6 +756,8 @@ static const StreamType DESC_types[] = { + { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, + { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, + { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ ++ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */ ++ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */ + { 0 }, + }; + + +From fabf7216626da8caecf9cb34b188739e530cc8d4 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 18 Sep 2011 19:16:34 +0200 +Subject: [PATCH 04/13] Don't accept mpegts PMT that isn't current + +--- + libavformat/mpegts.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 338861e..d4168c8 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -585,6 +585,7 @@ typedef struct SectionHeader { + uint8_t tid; + uint16_t id; + uint8_t version; ++ uint8_t current; + uint8_t sec_num; + uint8_t last_sec_num; + } SectionHeader; +@@ -667,6 +668,7 @@ static int parse_section_header(SectionHeader *h, + val = get8(pp, p_end); + if (val < 0) + return val; ++ h->current = val & 0x1; + h->version = (val >> 1) & 0x1f; + val = get8(pp, p_end); + if (val < 0) +@@ -2020,6 +2022,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len + return; + if (ts->skip_changes) + return; ++ if (!h->current) ++ return; + + if (skip_identical(h, tssf)) + return; + +From 4f1d8668a50ebf7cddc03d191c72c36fca2146dc Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 18 Sep 2011 19:17:23 +0200 +Subject: [PATCH 05/13] Don't reparse PMT unless it's version has changed + +--- + libavformat/mpegts.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index d4168c8..9c6f6dc 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -91,6 +91,7 @@ struct MpegTSFilter { + int es_id; + int last_cc; /* last cc code (-1 if first packet) */ + int64_t last_pcr; ++ int last_version; /* last version of data on this pid */ + enum MpegTSFilterType type; + union { + MpegTSPESFilter pes_filter; +@@ -459,6 +460,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, + filter->es_id = -1; + filter->last_cc = -1; + filter->last_pcr= -1; ++ filter->last_version = -1; + + return filter; + } +@@ -2024,6 +2026,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len + return; + if (!h->current) + return; ++ if (h->version == filter->last_version) ++ return; ++ filter->last_version = h->version; ++ av_dlog(ts->stream, "version=%d\n", filter->last_version); + + if (skip_identical(h, tssf)) + return; + +From 72cf6cb34af9de7e81bffc6a53f7d1f450e5b624 Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Fri, 9 Jul 2010 16:43:31 -0400 +Subject: [PATCH 06/13] Read PID timestamps as well as PCR timestamps to find + location in mpegts stream + +--- + libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 46 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 9c6f6dc..a4db558 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -2519,6 +2519,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { + av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); + } + ++static int parse_timestamp(int64_t *ts, const uint8_t *buf) ++{ ++ int afc, flags; ++ const uint8_t *p; ++ ++ if(!(buf[1] & 0x40)) /* must be a start packet */ ++ return -1; ++ ++ afc = (buf[3] >> 4) & 3; ++ p = buf + 4; ++ if (afc == 0 || afc == 2) /* invalid or only adaption field */ ++ return -1; ++ if (afc == 3) ++ p += p[0] + 1; ++ if (p >= buf + TS_PACKET_SIZE) ++ return -1; ++ ++ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */ ++ return -1; ++ ++ flags = p[3] | 0x100; /* stream type */ ++ if (!((flags >= 0x1c0 && flags <= 0x1df) || ++ (flags >= 0x1e0 && flags <= 0x1ef) || ++ (flags == 0x1bd) || (flags == 0x1fd))) ++ return -1; ++ ++ flags = p[7]; ++ if ((flags & 0xc0) == 0x80) { ++ *ts = ff_parse_pes_pts(p+9); ++ return 0; ++ } else if ((flags & 0xc0) == 0xc0) { ++ *ts = ff_parse_pes_pts(p+9+5); ++ return 0; ++ } ++ return -1; ++} ++ ++ + static int mpegts_read_header(AVFormatContext *s) + { + MpegTSContext *ts = s->priv_data; +@@ -2724,6 +2762,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, + uint8_t buf[TS_PACKET_SIZE]; + int pcr_l, pcr_pid = + ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; ++ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid; + int pos47 = ts->pos47_full % ts->raw_packet_size; + pos = + ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * +@@ -2745,6 +2784,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, + *ppos = pos; + return timestamp; + } ++ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) && ++ parse_timestamp(×tamp, buf) == 0) { ++ *ppos = pos; ++ return timestamp; ++ } + pos += ts->raw_packet_size; + } + +@@ -2844,7 +2888,7 @@ AVInputFormat ff_mpegts_demuxer = { + .read_header = mpegts_read_header, + .read_packet = mpegts_read_packet, + .read_close = mpegts_read_close, +- .read_timestamp = mpegts_get_dts, ++ .read_timestamp = mpegts_get_pcr, + .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, + .priv_class = &mpegts_class, + }; +@@ -2856,7 +2900,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { + .read_header = mpegts_read_header, + .read_packet = mpegts_raw_read_packet, + .read_close = mpegts_read_close, +- .read_timestamp = mpegts_get_dts, ++ .read_timestamp = mpegts_get_pcr, + .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, + .priv_class = &mpegtsraw_class, + }; + +From ee8a688e4e6f59785180c1e92981ff867f6f5c23 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sat, 22 Oct 2011 19:01:38 +0200 +Subject: [PATCH 07/13] Get stream durations using read_timestamp + +--- + libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/libavformat/utils.c b/libavformat/utils.c +index 8a947d6..88786f1 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -2455,6 +2455,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) + #define DURATION_MAX_READ_SIZE 250000LL + #define DURATION_MAX_RETRY 6 + ++static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset) ++{ ++ AVStream *st; ++ int i, step= 1024; ++ int64_t ts, pos; ++ ++ for(i=0;inb_streams;i++) { ++ st = ic->streams[i]; ++ ++ pos = 0; ++ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE); ++ if (ts == AV_NOPTS_VALUE) ++ continue; ++ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE) ++ st->start_time = ts; ++ ++ pos = avio_size(ic->pb) - 1; ++ do { ++ pos -= step; ++ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step); ++ step += step; ++ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE); ++ ++ if (ts == AV_NOPTS_VALUE) ++ continue; ++ ++ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE) ++ st->duration = ts - st->start_time; ++ } ++ ++ fill_all_stream_timings(ic); ++ ++ avio_seek(ic->pb, old_offset, SEEK_SET); ++} ++ + /* only usable for MPEG-PS streams */ + static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) + { +@@ -2605,6 +2640,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) + * the components */ + fill_all_stream_timings(ic); + ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; ++ } else if (ic->iformat->read_timestamp && ++ file_size && ic->pb->seekable) { ++ /* get accurate estimate from the PTSes */ ++ av_estimate_timings_from_pts2(ic, old_offset); + } else { + /* less precise: use bitrate info */ + estimate_timings_from_bit_rate(ic); + +From a45171f7370c263344805d19181e08a12a65dcdd Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Wed, 8 Dec 2010 14:03:43 +0000 +Subject: [PATCH 08/13] changed: allow 4 second skew between streams in mov + before attempting to seek + +--- + libavformat/mov.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 4ce4e2d..2c364ac 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -4624,8 +4624,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) + if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || + (s->pb->seekable && + ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && +- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || +- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { ++ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) || ++ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) { + sample = current_sample; + best_dts = dts; + *st = avst; + +From c3e8fbd02c2eaba2a5d14d2b6c07fe08746f5947 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Fri, 26 Nov 2010 20:56:48 +0000 +Subject: [PATCH 09/13] fixed: memleak in mpegts demuxer on some malformed (??) + mpegts files with too large pes packets + +at-visions sample file brokenStream.mpg +--- + libavformat/mpegts.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index a4db558..492d9c7 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -868,6 +868,10 @@ static void reset_pes_packet_state(PESContext *pes) + + static void new_pes_packet(PESContext *pes, AVPacket *pkt) + { ++ if(pkt->data) { ++ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index); ++ av_free_packet(pkt); ++ } + av_init_packet(pkt); + + pkt->buf = pes->buffer; +@@ -2715,6 +2719,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) + + pkt->size = -1; + ts->pkt = pkt; ++ ts->pkt->data = NULL; ++ + ret = handle_packets(ts, 0); + if (ret < 0) { + av_free_packet(ts->pkt); + +From eba5c839b7e24f8e6800d3f923d5334c2c9e6b2d Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Mon, 28 Jun 2010 21:26:54 +0000 +Subject: [PATCH 10/13] Speed up mpegts av_find_stream_info + +--- + libavformat/mpegts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 492d9c7..29d58eb 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -1030,7 +1030,7 @@ static int mpegts_push_data(MpegTSFilter *filter, + goto skip; + + /* stream not present in PMT */ +- if (!pes->st) { ++ if (ts->auto_guess && !pes->st) { + if (ts->skip_changes) + goto skip; + + +From 2372b27243eb7d0932d9885558708ba115596d0b Mon Sep 17 00:00:00 2001 +From: marc +Date: Mon, 18 Feb 2013 17:18:18 +0000 +Subject: [PATCH 11/13] dxva-h264 Fix dxva playback of streams that don't start + with an I-Frame (adjusted to 2.7) + +--- + libavcodec/dxva2_h264.c | 8 ++++++++ + libavcodec/h264.c | 1 + + libavcodec/h264.h | 2 ++ + libavcodec/h264_slice.c | 1 + + 4 files changed, 12 insertions(+) + +diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c +index 99b80ba..eb5ecd1 100644 +--- a/libavcodec/dxva2_h264.c ++++ b/libavcodec/dxva2_h264.c +@@ -497,6 +497,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx) + + if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) + return -1; ++ ++ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs ++ if (!h->got_first_iframe) { ++ if (!(ctx_pic->pp.wBitFields & (1 << 15))) ++ return -1; ++ h->got_first_iframe = 1; ++ } ++ + ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, + &ctx_pic->pp, sizeof(ctx_pic->pp), + &ctx_pic->qm, sizeof(ctx_pic->qm), +diff --git a/libavcodec/h264.c b/libavcodec/h264.c +index 907943e..718b746 100644 +--- a/libavcodec/h264.c ++++ b/libavcodec/h264.c +@@ -1087,6 +1087,7 @@ void ff_h264_flush_change(H264Context *h) + + h->next_outputed_poc = INT_MIN; + h->prev_interlaced_frame = 1; ++ h->got_first_iframe = 0; + idr(h); + + h->prev_frame_num = -1; +diff --git a/libavcodec/h264.h b/libavcodec/h264.h +index 7356288..907ee5e 100644 +--- a/libavcodec/h264.h ++++ b/libavcodec/h264.h +@@ -813,6 +813,8 @@ typedef struct H264Context { + * slices) anymore */ + int setup_finished; + ++ int got_first_iframe; ++ + // Timestamp stuff + int sei_buffering_period_present; ///< Buffering period SEI flag + int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs +diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c +index 8be803b7..939d02b 100644 +--- a/libavcodec/h264_slice.c ++++ b/libavcodec/h264_slice.c +@@ -1043,6 +1043,7 @@ static int h264_slice_header_init(H264Context *h) + + h->first_field = 0; + h->prev_interlaced_frame = 1; ++ h->got_first_iframe = 0; + + init_scan_tables(h); + ret = ff_h264_alloc_tables(h); + +From 959b88473b6f76fb2245f329ef604d2066b2cb89 Mon Sep 17 00:00:00 2001 +From: wsnipex +Date: Mon, 16 Feb 2015 09:58:28 +0100 +Subject: [PATCH 12/13] only check for a git rev if the src tree is in a git + repo + +fixes the version string when building from the kodi depends src tree +--- + version.sh | 36 +++++++++++++++++++----------------- + 1 file changed, 19 insertions(+), 17 deletions(-) + +diff --git a/version.sh b/version.sh +index f9754eb..cc23f80 100755 +--- a/version.sh ++++ b/version.sh +@@ -2,30 +2,32 @@ + + # Usage: version.sh + ++if [ -d $1/.git ]; then # only check for a git rev, if the src tree is in a git repo + # check for git short hash +-if ! test "$revision"; then ++ if ! test "$revision"; then + if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then + revision=$(cd "$1" && git describe --tags --match N 2> /dev/null) + else + revision=$(cd "$1" && git describe --tags --always 2> /dev/null) + fi +-fi ++ fi ++ ++ # Shallow Git clones (--depth) do not have the N tag: ++ # use 'git-YYYY-MM-DD-hhhhhhh'. ++ test "$revision" || revision=$(cd "$1" && ++ git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null) + +-# Shallow Git clones (--depth) do not have the N tag: +-# use 'git-YYYY-MM-DD-hhhhhhh'. +-test "$revision" || revision=$(cd "$1" && +- git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null) +- +-# Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or +-# ffmpeg-HEAD-hhhhhhh. +-if [ -z "$revision" ]; then +- srcdir=$(cd "$1" && pwd) +- case "$srcdir" in +- */ffmpeg-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) +- git_hash="${srcdir##*-}";; +- */ffmpeg-HEAD-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) +- git_hash="${srcdir##*-}";; +- esac ++ # Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or ++ # ffmpeg-HEAD-hhhhhhh. ++ if [ -z "$revision" ]; then ++ srcdir=$(cd "$1" && pwd) ++ case "$srcdir" in ++ */ffmpeg-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ++ git_hash="${srcdir##*-}";; ++ */ffmpeg-HEAD-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ++ git_hash="${srcdir##*-}";; ++ esac ++ fi + fi + + # no revision number found diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-901-upstream.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-901-upstream.patch new file mode 100644 index 0000000000..203132fe78 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-901-upstream.patch @@ -0,0 +1,23 @@ +From 101dcdc12659e7fc2ddc1393992e2b431e2c4da1 Mon Sep 17 00:00:00 2001 +From: Hendrik Leppkes +Date: Fri, 22 Jan 2016 13:50:42 +0100 +Subject: [PATCH] dxva2_h264: fix reference field marking in long slice struct + +Fixes artifacts in interlaced decoding on old Intel GPUs. +--- + libavcodec/dxva2_h264.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c +index eb5ecd1..242a79e 100644 +--- a/libavcodec/dxva2_h264.c ++++ b/libavcodec/dxva2_h264.c +@@ -248,7 +248,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, + else + index = get_refpic_index(pp, ff_dxva2_get_surface_index(avctx, ctx, r->f)); + fill_picture_entry(&slice->RefPicList[list][i], index, +- r->reference == PICT_BOTTOM_FIELD); ++ sl->ref_list[list][i].reference == PICT_BOTTOM_FIELD); + for (plane = 0; plane < 3; plane++) { + int w, o; + if (plane == 0 && sl->luma_weight_flag[list]) { diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.0011-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.0011-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch new file mode 100644 index 0000000000..4cb8dd8fc4 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-99.0011-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch @@ -0,0 +1,48 @@ +From 84e9a1784bbd3182b68cefa5e5feae8da8b9e184 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 5 Jun 2015 22:48:33 +0100 +Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp + point + +--- + libavcodec/avcodec.h | 1 + + libavcodec/mpeg4videodec.c | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h +index 8c7c420..e63dc2d 100644 +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -2527,6 +2527,7 @@ typedef struct AVCodecContext { + #define FF_BUG_DC_CLIP 4096 + #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. + #define FF_BUG_TRUNCATED 16384 ++#define FF_BUG_GMC_UNSUPPORTED 32768 + + /** + * strictly follow the standard (MPEG4, ...). +diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c +index 9bf33dd..0b5d3b9 100644 +--- a/libavcodec/mpeg4videodec.c ++++ b/libavcodec/mpeg4videodec.c +@@ -2179,6 +2179,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) + + if (ctx->divx_version >= 0) + s->workaround_bugs |= FF_BUG_HPEL_CHROMA; ++ ++ if (ctx->num_sprite_warping_points > 1) ++ s->workaround_bugs |= FF_BUG_GMC_UNSUPPORTED; + } + + if (s->workaround_bugs & FF_BUG_STD_QPEL) { +@@ -2203,6 +2206,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) + s->workaround_bugs, ctx->lavc_build, ctx->xvid_build, + ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : ""); + ++ avctx->workaround_bugs = s->workaround_bugs; + if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 && + s->codec_id == AV_CODEC_ID_MPEG4 && + avctx->idct_algo == FF_IDCT_AUTO) { +-- +1.9.1 + diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1000-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1000-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch deleted file mode 100644 index 0e814fa3c0..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1000-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 84e9a1784bbd3182b68cefa5e5feae8da8b9e184 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 5 Jun 2015 22:48:33 +0100 -Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp - point - ---- - libavcodec/avcodec.h | 1 + - libavcodec/mpeg4videodec.c | 4 ++++ - 2 files changed, 5 insertions(+) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index 8c7c420..e63dc2d 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -2527,6 +2527,7 @@ typedef struct AVCodecContext { - #define FF_BUG_DC_CLIP 4096 - #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. - #define FF_BUG_TRUNCATED 16384 -+#define FF_BUG_GMC_UNSUPPORTED 32768 - - /** - * strictly follow the standard (MPEG4, ...). -diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c -index 9bf33dd..0b5d3b9 100644 ---- a/libavcodec/mpeg4videodec.c -+++ b/libavcodec/mpeg4videodec.c -@@ -2179,6 +2179,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) - - if (ctx->divx_version >= 0) - s->workaround_bugs |= FF_BUG_HPEL_CHROMA; -+ -+ if (ctx->num_sprite_warping_points > 1) -+ s->workaround_bugs |= FF_BUG_GMC_UNSUPPORTED; - } - - if (s->workaround_bugs & FF_BUG_STD_QPEL) { -@@ -2203,6 +2206,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) - s->workaround_bugs, ctx->lavc_build, ctx->xvid_build, - ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : ""); - -+ avctx->workaround_bugs = s->workaround_bugs; - if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 && - s->codec_id == AV_CODEC_ID_MPEG4 && - avctx->idct_algo == FF_IDCT_AUTO) { --- -1.9.1 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-hevcdsp_ARM_NEON_optimized_epel_functions.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-hevcdsp_ARM_NEON_optimized_epel_functions.patch deleted file mode 100644 index d19984b4de..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-hevcdsp_ARM_NEON_optimized_epel_functions.patch +++ /dev/null @@ -1,410 +0,0 @@ -From 29c3327a0d72a7e872ff170363cfe5ed13bca5d0 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Tue, 22 Dec 2015 18:10:24 +0000 -Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions - ---- - libavcodec/arm/Makefile | 1 + - libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++ - libavcodec/arm/hevcdsp_init_neon.c | 23 +++ - 3 files changed, 358 insertions(+) - create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S - -diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -index cdd35b0..6051ec8 100644 ---- a/libavcodec/arm/Makefile -+++ b/libavcodec/arm/Makefile -@@ -131,6 +131,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ - arm/synth_filter_neon.o - NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ - arm/hevcdsp_deblock_neon.o \ -+ arm/hevcdsp_epel_neon.o \ - arm/hevcdsp_idct_neon.o \ - arm/hevcdsp_qpel_neon.o - NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -new file mode 100644 -index 0000000..516ae5b ---- /dev/null -+++ b/libavcodec/arm/hevcdsp_epel_neon.S -@@ -0,0 +1,334 @@ -+/* -+ * Copyright (c) 2014 - 2015 Seppo Tomperi -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "libavutil/arm/asm.S" -+#include "neon.S" -+ -+#define MAX_PB_SIZE #64 -+ -+.macro vextin_d4 -+ vld1.8 {q10}, [r1], r2 -+ vmov d16, d20 -+ vext.8 d17, d20, d21, #1 -+ vext.8 d18, d20, d21, #2 -+ vext.8 d19, d20, d21, #3 -+.endm -+ -+.macro vextin_d4_8 -+ vld1.8 d16, [r1], r2 -+ vext.8 d17, d16, d16, #1 -+ vext.8 d18, d16, d16, #2 -+ vext.8 d19, d16, d16, #3 -+.endm -+ -+.macro load_coeffs_16b coeffs -+ ldr \coeffs, [\coeffs] -+ vdup.i8 d0, \coeffs -+ lsr \coeffs, #8 -+ vdup.i8 d1, \coeffs -+ lsr \coeffs, #8 -+ vdup.i8 d2, \coeffs -+ lsr \coeffs, #8 -+ vdup.i8 d3, \coeffs -+.endm -+ -+.macro epel_filter_16b out=q12 -+ vmull.u8 q3, d16, d0 -+ vmull.u8 q11, d19, d3 -+ vmull.u8 \out, d17, d1 -+ vmull.u8 q10, d18, d2 -+ vadd.s16 q3, q11 -+ vadd.s16 \out, q10 -+ vsub.s16 \out, q3 -+.endm -+ -+.macro load_coeffs_32b coeffs -+ ldr \coeffs, [\coeffs] -+ vmov.i64 d4, #0 -+ vmov.8 d4[0], \coeffs -+ lsr \coeffs, #8 -+ vmov.8 d4[2], \coeffs -+ lsr \coeffs, #8 -+ vmov.8 d4[4], \coeffs -+ lsr \coeffs, #8 -+ vmov.8 d4[6], \coeffs -+.endm -+ -+.macro epel_filter_32b -+ vmull.s16 q3, d24, d4[0] //q12 -+ vmull.s16 q4, d25, d4[0] -+ vmull.s16 q5, d30, d4[3] //q15 -+ vmull.s16 q6, d31, d4[3] -+ -+ vmull.s16 q7, d26, d4[1] // q13 -+ vmull.s16 q8, d27, d4[1] -+ vmull.s16 q9, d28, d4[2] // q14 -+ vmull.s16 q10, d29, d4[2] -+ vadd.s32 q3, q5 -+ vadd.s32 q4, q6 -+ vadd.s32 q7, q9 -+ vadd.s32 q8, q10 -+ vsub.s32 q7, q3 -+ vsub.s32 q8, q4 -+ vqshrn.s32 d6, q7, #6 -+ vqshrn.s32 d7, q8, #6 -+.endm -+ -+.macro epel_filter_32b_4 -+ vmull.s16 q3, d24, d4[0] //q12 -+ vmull.s16 q5, d30, d4[3] //q15 -+ vmull.s16 q7, d26, d4[1] // q13 -+ vmull.s16 q9, d28, d4[2] // q14 -+ vadd.s32 q3, q5 -+ vadd.s32 q7, q9 -+ vsub.s32 q7, q3 -+ vqshrn.s32 d6, q7, #6 -+.endm -+ -+function ff_hevc_put_epel_h_neon_8, export=1 -+ push {r4-r7} -+ mov r4, MAX_PB_SIZE -+ ldr r7, [sp, #16] // mx -+ ldr r5, [sp, #24] // width -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+ adrl r12, epel_coeffs -+ add r7, r12 -+ sub r1, #1 -+ lsl r4, #1 -+ load_coeffs_16b r7 -+ mov r12, r3 -+ mov r6, r0 -+ mov r7, r1 -+ cmp r5, #6 -+ bgt 8f -+ cmp r5, #4 -+ blt 2f -+ b 4f -+8: subs r3, #1 -+ pld [r1] -+ vextin_d4 -+ epel_filter_16b -+ vst1.16 {q12}, [r0], r4 -+ bne 8b -+ subs r5, #8 -+ beq 99f -+ mov r3, r12 -+ add r6, #16 -+ mov r0, r6 -+ add r7, #8 -+ mov r1, r7 -+ cmp r5, #4 -+ bgt 8b -+4: subs r3, #1 -+ pld [r1] -+ vextin_d4_8 -+ epel_filter_16b -+ vst1.16 d24, [r0], r4 -+ bne 4b -+ subs r5, #4 -+ beq 99f -+ mov r3, r12 -+ add r6, #8 -+ mov r0, r6 -+ add r7, #4 -+ mov r1, r7 -+2: subs r3, #1 -+ pld [r1] -+ vextin_d4_8 -+ epel_filter_16b -+ vst1.32 d24[0], [r0], r4 -+ bne 2b -+99: vpop {d8-d15} -+ pop {r4-r7} -+ bx lr -+endfunc -+ -+function ff_hevc_put_epel_v_neon_8, export=1 -+ push {r4-r7} -+ mov r4, MAX_PB_SIZE -+ ldr r7, [sp, #20] // my -+ ldr r5, [sp, #24] // width -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+ adrl r12, epel_coeffs -+ add r7, r12 -+ load_coeffs_16b r7 -+ sub r1, r2 -+ lsl r4, #1 -+ mov r12, r3 -+ mov r6, r0 -+ mov r7, r1 -+0: pld [r1] -+ vld1.8 {d16}, [r1], r2 -+ pld [r1] -+ vld1.8 {d17}, [r1], r2 -+ pld [r1] -+ vld1.8 {d18}, [r1], r2 -+ cmp r5, #6 -+ bgt 8f -+ cmp r5, #4 -+ blt 2f -+ b 4f -+8: pld [r1] -+ vld1.8 {d19}, [r1], r2 -+ subs r3, #1 -+ epel_filter_16b -+ vst1.16 {q12}, [r0], r4 -+ vmov d16, d17 -+ vmov d17, d18 -+ vmov d18, d19 -+ bne 8b -+ subs r5, #8 -+ beq 99f -+ mov r3, r12 -+ add r6, #16 -+ mov r0, r6 -+ add r7, #8 -+ mov r1, r7 -+ b 0b -+4: pld [r1] -+ vld1.8 {d19}, [r1], r2 -+ subs r3, #1 -+ epel_filter_16b -+ vst1.16 d24, [r0], r4 -+ vmov d16, d17 -+ vmov d17, d18 -+ vmov d18, d19 -+ bne 4b -+ subs r5, #4 -+ beq 99f -+ mov r3, r12 -+ add r6, #8 -+ mov r0, r6 -+ add r7, #4 -+ mov r1, r7 -+ b 0b -+2: pld [r1] -+ vld1.8 {d19}, [r1], r2 -+ subs r3, #1 -+ epel_filter_16b -+ vst1.32 d24[0], [r0], r4 -+ vmov d16, d17 -+ vmov d17, d18 -+ vmov d18, d19 -+ bne 2b -+99: vpop {d8-d15} -+ pop {r4-r7} -+ bx lr -+endfunc -+ -+function ff_hevc_put_epel_hv_neon_8, export=1 -+ push {r4-r7} -+ mov r4, MAX_PB_SIZE -+ ldr r6, [sp, #16] // mx -+ ldr r7, [sp, #20] // my -+ ldr r5, [sp, #24] // width -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+ adrl r12, epel_coeffs -+ sub r6, #1 -+ lsl r6, #2 -+ add r6, r12 // mx epel coeff offset -+ add r7, r12 -+ sub r1, #1 -+ sub r1, r2 -+ lsl r4, #1 -+ load_coeffs_16b r6 -+ load_coeffs_32b r7 -+ mov r12, r3 -+ mov r6, r0 -+ mov r7, r1 -+0: pld [r1] -+ vextin_d4 -+ epel_filter_16b q12 -+ pld [r1] -+ vextin_d4 -+ epel_filter_16b q13 -+ pld [r1] -+ vextin_d4 -+ epel_filter_16b q14 -+ cmp r5, #6 -+ bgt 8f -+ cmp r5, #4 -+ blt 2f -+ b 4f -+8: pld [r1] -+ vextin_d4 -+ epel_filter_16b q15 -+ subs r3, #1 -+ epel_filter_32b -+ vst1.16 {q3}, [r0], r4 -+ vmov q12, q13 -+ vmov q13, q14 -+ vmov q14, q15 -+ bne 8b -+ subs r5, #8 -+ beq 99f -+ mov r3, r12 -+ add r6, #16 -+ mov r0, r6 -+ add r7, #8 -+ mov r1, r7 -+ b 0b -+4: pld [r1] -+ vextin_d4_8 -+ epel_filter_16b q15 -+ subs r3, #1 -+ epel_filter_32b_4 -+ vst1.16 d6, [r0], r4 -+ vmov q12, q13 -+ vmov q13, q14 -+ vmov q14, q15 -+ bne 4b -+ subs r5, #4 -+ beq 99f -+ mov r3, r12 -+ add r6, #8 -+ mov r0, r6 -+ add r7, #4 -+ mov r1, r7 -+ b 0b -+2: pld [r1] -+ vextin_d4_8 -+ epel_filter_16b q15 -+ subs r3, #1 -+ epel_filter_32b_4 -+ vst1.32 d6[0], [r0], r4 -+ vmov q12, q13 -+ vmov q13, q14 -+ vmov q14, q15 -+ bne 2b -+99: vpop {d8-d15} -+ pop {r4-r7} -+ bx lr -+endfunc -+ -+epel_coeffs: -+ .byte 2, 58, 10, 2 -+ .byte 4, 54, 16, 2 -+ .byte 6, 46, 28, 4 -+ .byte 4, 36, 36, 4 -+ .byte 4, 28, 46, 6 -+ .byte 2, 16, 54, 4 -+ .byte 2, 10, 58, 2 -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 5591807..733ff08 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -58,6 +58,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); - PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); - PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); - #undef PUT_PIXELS -+void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src, -+ ptrdiff_t srcstride, int height, -+ intptr_t mx, intptr_t my, int width); -+void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src, -+ ptrdiff_t srcstride, int height, -+ intptr_t mx, intptr_t my, int width); -+void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src, -+ ptrdiff_t srcstride, int height, -+ intptr_t mx, intptr_t my, int width); - - static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, - int height, int width); -@@ -201,7 +210,21 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; - c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; - c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8; -+ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8; -+ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8; - } -+ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -+ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -+ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -+ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; -+ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; -+ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; -+ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; -+ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; -+ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; -+ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; -+ - c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; - c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; - c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; --- -2.5.0 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-added_ARM_NEON_optimized_SAO_patches.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-added_ARM_NEON_optimized_SAO_patches.patch deleted file mode 100644 index f090c38c7e..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-added_ARM_NEON_optimized_SAO_patches.patch +++ /dev/null @@ -1,3329 +0,0 @@ -From b0cb307c253d2c9f4b94a54dfc74ddb83af984cc Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Mon, 8 Dec 2014 13:24:40 +0200 -Subject: [PATCH 1/9] added ARM NEON optimized SAO band offset - ---- - libavcodec/arm/Makefile | 3 +- - libavcodec/arm/hevcdsp_init_neon.c | 47 +++++++++ - libavcodec/arm/hevcdsp_sao_neon.S | 204 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 253 insertions(+), 1 deletion(-) - create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S - -diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -index 6051ec8..093a2e8 100644 ---- a/libavcodec/arm/Makefile -+++ b/libavcodec/arm/Makefile -@@ -133,7 +133,8 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ - arm/hevcdsp_deblock_neon.o \ - arm/hevcdsp_epel_neon.o \ - arm/hevcdsp_idct_neon.o \ -- arm/hevcdsp_qpel_neon.o -+ arm/hevcdsp_qpel_neon.o \ -+ arm/hevcdsp_sao_neon.o - NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o - NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ - arm/rv40dsp_neon.o -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 733ff08..69e2b2c 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -22,6 +22,7 @@ - #include "libavutil/arm/cpu.h" - #include "libavcodec/hevcdsp.h" - #include "hevcdsp_arm.h" -+#include "../bit_depth_template.c" - - void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); - void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -@@ -43,6 +44,11 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, - void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, - ptrdiff_t stride); - -+void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ - #define PUT_PIXELS(name) \ - void name(int16_t *dst, uint8_t *src, \ - ptrdiff_t srcstride, int height, \ -@@ -151,6 +157,44 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t - put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); - } - -+static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, -+ int16_t *sao_offset_val, int sao_left_class, int width, int height) -+{ -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int8_t offset_table[32] = { 0 }; -+ int k, y, x; -+ int shift = 3; // BIT_DEPTH - 5 -+ -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+ for (k = 0; k < 4; k++) -+ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; -+ -+ switch(width){ -+ case 8: -+ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ break; -+ case 16: -+ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ break; -+ case 32: -+ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ break; -+ case 64: -+ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ break; -+ default: -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); -+ dst += stride_dst; -+ src += stride_src; -+ } -+ } -+} -+ - av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - { - if (bit_depth == 8) { -@@ -170,6 +214,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - c->transform_add[2] = ff_hevc_transform_add_16x16_neon_8; - c->transform_add[3] = ff_hevc_transform_add_32x32_neon_8; - c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; -+ for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { -+ c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; -+ } - put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; - put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; - put_hevc_qpel_neon[3][0] = ff_hevc_put_qpel_v3_neon_8; -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -new file mode 100644 -index 0000000..1f0ad64 ---- /dev/null -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -0,0 +1,204 @@ -+/* -+ * Copyright (c) 2014 Seppo Tomperi -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "libavutil/arm/asm.S" -+#include "neon.S" -+ -+function ff_hevc_sao_band_w8_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // offset_table -+ vpush {d8-d15} -+ vld1.8 {q0, q1}, [r5] // offset table -+ -+1: subs r4, #1 -+ vld1.8 {d24}, [r1], r3 -+ vshr.u8 d16, d24, #3 -+ vtbl.8 d16, {q0, q1}, d16 -+ vmovl.s8 q2, d16 -+ vmovl.u8 q6, d24 -+ vadd.s16 q2, q6 -+ vqmovun.s16 d4, q2 -+ vst1.8 {d4}, [r0], r2 -+ bne 1b -+ -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_band_w16_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // offset_table -+ vpush {d8-d15} -+ vld1.8 {q0, q1}, [r5] // offset table -+ -+1: subs r4, #1 -+ vld1.8 {q12}, [r1], r3 -+ -+ vshr.u8 q8, q12, #3 -+ -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ -+ vmovl.s8 q2, d16 -+ vmovl.s8 q3, d17 -+ -+ vmovl.u8 q6, d24 -+ vmovl.u8 q7, d25 -+ -+ vadd.s16 q2, q6 -+ vadd.s16 q3, q7 -+ -+ vqmovun.s16 d4, q2 -+ vqmovun.s16 d5, q3 -+ -+ vstm.8 r0, {q2} -+ add r0, r2 -+ bne 1b -+ -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_band_w32_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // offset_table -+ vpush {d8-d15} -+ vld1.8 {q0, q1}, [r5] // offset table -+ -+1: subs r4, #1 -+ vld1.8 {q12-q13}, [r1], r3 -+ -+ vshr.u8 q8, q12, #3 -+ vshr.u8 q9, q13, #3 -+ -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+ vtbl.8 d19, {q0, q1}, d19 -+ -+ vmovl.s8 q2, d16 -+ vmovl.s8 q3, d17 // q8 free -+ vmovl.s8 q4, d18 -+ vmovl.s8 q5, d19 // q9 free -+ -+ vmovl.u8 q6, d24 -+ vmovl.u8 q7, d25 // q12 free -+ vmovl.u8 q8, d26 -+ vmovl.u8 q9, d27 // q13 free -+ -+ vadd.s16 q2, q6 -+ vadd.s16 q3, q7 -+ vadd.s16 q4, q8 -+ vadd.s16 q5, q9 -+ -+ vqmovun.s16 d4, q2 -+ vqmovun.s16 d5, q3 -+ vqmovun.s16 d6, q4 // q4 free -+ vqmovun.s16 d7, q5 // q5 free -+ -+ vst1.8 {q2-q3}, [r0], r2 -+ bne 1b -+ -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_band_w64_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // offset_table -+ vpush {d8-d15} -+ vld1.8 {q0, q1}, [r5] // offset table -+ -+1: subs r4, #1 -+ vld1.8 {q12-q13}, [r1]! -+ vld1.8 {q14-q15}, [r1], r3 -+ sub r1, #32 -+ -+ vshr.u8 q8, q12, #3 -+ vshr.u8 q9, q13, #3 -+ vshr.u8 q10, q14, #3 -+ vshr.u8 q11, q15, #3 -+ -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+ vtbl.8 d19, {q0, q1}, d19 -+ vtbl.8 d20, {q0, q1}, d20 -+ vtbl.8 d21, {q0, q1}, d21 -+ vtbl.8 d22, {q0, q1}, d22 -+ vtbl.8 d23, {q0, q1}, d23 -+ -+ vmovl.s8 q2, d16 -+ vmovl.s8 q3, d17 // q8 free -+ vmovl.s8 q4, d18 -+ vmovl.s8 q5, d19 // q9 free -+ -+ vmovl.u8 q6, d24 -+ vmovl.u8 q7, d25 // q12 free -+ vmovl.u8 q8, d26 -+ vmovl.u8 q9, d27 // q13 free -+ -+ vadd.s16 q2, q6 -+ vadd.s16 q3, q7 -+ vadd.s16 q4, q8 -+ vadd.s16 q5, q9 -+ -+ vqmovun.s16 d4, q2 -+ vqmovun.s16 d5, q3 -+ vqmovun.s16 d6, q4 // q4 free -+ vqmovun.s16 d7, q5 // q5 free -+ -+ // free q4 -q9, q12 - q13 -+ vmovl.s8 q4, d20 -+ vmovl.s8 q5, d21 // q10 free -+ vmovl.s8 q6, d22 -+ vmovl.s8 q7, d23 // q11 free -+ -+ vmovl.u8 q8, d28 -+ vmovl.u8 q9, d29 // q14 free -+ vmovl.u8 q10, d30 -+ vmovl.u8 q11, d31 // q15 free -+ -+ vadd.s16 q4, q8 -+ vadd.s16 q5, q9 -+ vadd.s16 q6, q10 -+ vadd.s16 q7, q11 -+ -+ vqmovun.s16 d8, q4 -+ vqmovun.s16 d9, q5 -+ vqmovun.s16 d10, q6 -+ vqmovun.s16 d11, q7 -+ -+ vstm.8 r0, {q2-q5} -+ add r0, r2 -+ bne 1b -+ -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ --- -2.5.0 - - -From 8429b1de64bb871d57651ecfe3b084e2dfe0af51 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Wed, 27 May 2015 18:10:20 +0100 -Subject: [PATCH 2/9] added NEON optimized sao edge for eo1 width 64 - ---- - libavcodec/arm/hevcdsp_init_neon.c | 47 ++++++++++++ - libavcodec/arm/hevcdsp_sao_neon.S | 147 +++++++++++++++++++++++++++++++++++++ - 2 files changed, 194 insertions(+) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 69e2b2c..c7b5404 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -22,6 +22,7 @@ - #include "libavutil/arm/cpu.h" - #include "libavcodec/hevcdsp.h" - #include "hevcdsp_arm.h" -+#include "libavcodec/avcodec.h" - #include "../bit_depth_template.c" - - void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -@@ -48,6 +49,7 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d - void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); - void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); - void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); - - #define PUT_PIXELS(name) \ - void name(int16_t *dst, uint8_t *src, \ -@@ -195,6 +197,50 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ - } - } - -+#define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) -+static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst, -+ int16_t *_sao_offset_val, int eo, int width, int height) -+{ -+ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; -+ static const int8_t pos[4][2][2] = { -+ { { -1, 0 }, { 1, 0 } }, // horizontal -+ { { 0, -1 }, { 0, 1 } }, // vertical -+ { { -1, -1 }, { 1, 1 } }, // 45 degree -+ { { 1, -1 }, { -1, 1 } }, // 135 degree -+ }; -+ int8_t sao_offset_val[8]; // padding of 3 for vld -+ ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int a_stride, b_stride; -+ int x, y; -+ -+ for (x = 0; x < 5; x++) { -+ sao_offset_val[x] = _sao_offset_val[x]; -+ } -+ -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+ if (eo == 1 && width == 64) { -+ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ } else { -+ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; -+ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) { -+ int diff0 = CMP(src[x], src[x + a_stride]); -+ int diff1 = CMP(src[x], src[x + b_stride]); -+ int offset_val = edge_idx[2 + diff0 + diff1]; -+ dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -+ } -+ src += stride_src; -+ dst += stride_dst; -+ } -+ } -+} -+#undef CMP -+ - av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - { - if (bit_depth == 8) { -@@ -216,6 +262,7 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; - for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { - c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; -+ c->sao_edge_filter[x] = ff_hevc_sao_edge_neon_wrapper; - } - put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; - put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 1f0ad64..5ec2de9 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -202,3 +202,150 @@ function ff_hevc_sao_band_w64_neon_8, export=1 - bx lr - endfunc - -+function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x02 -+ vpush {d8-d15} -+1: subs r4, #1 -+ // load a -+ sub r1, r3 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #32 -+ // load c -+ vld1.8 {q4-q5}, [r1]! -+ vld1.8 {q6-q7}, [r1], r3 -+ sub r1, #32 -+ // load b -+ vld1.8 {q8-q9}, [r1]! -+ vld1.8 {q10-q11}, [r1], r3 -+ sub r1, #32 -+ -+ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+ vcgt.u8 q13, q5, q1 -+ vcgt.u8 q1, q1, q5 -+ vcgt.u8 q14, q6, q2 -+ vcgt.u8 q2, q2, q6 -+ vcgt.u8 q15, q7, q3 -+ vcgt.u8 q3, q3, q7 -+ -+ vsub.s8 q12, q0, q12 // diff0 -+ vsub.s8 q13, q1, q13 -+ vsub.s8 q14, q2, q14 -+ vsub.s8 q15, q3, q15 -+ -+ vcgt.u8 q0, q4, q8 // c > b -+ vcgt.u8 q8, q8, q4 // b > c -+ vcgt.u8 q1, q5, q9 -+ vcgt.u8 q9, q9, q5 -+ vcgt.u8 q2, q6, q10 -+ vcgt.u8 q10, q10, q6 -+ vcgt.u8 q3, q7, q11 -+ vcgt.u8 q11, q11, q7 -+ -+ vsub.s8 q0, q8, q0 // diff1 -+ vsub.s8 q1, q9, q1 -+ vsub.s8 q2, q10, q2 -+ vsub.s8 q3, q11, q3 -+ -+ veor.u8 q8, q8 // zero register -+ vdup.s8 q9, r6 // 2 to all elements -+ add r6, #1 -+ vdup.s8 q10, r6 // 3 to all elements -+ sub r6, #1 -+ -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ vadd.s8 q2, q14 -+ vadd.s8 q3, q15 -+ -+ vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 -+ vcgt.s8 q5, q1, q8 -+ vcgt.s8 q6, q2, q8 -+ vcgt.s8 q7, q3, q8 -+ -+ vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 -+ vclt.s8 q12, q1, q8 -+ vclt.s8 q13, q2, q8 -+ vclt.s8 q14, q3, q8 -+ -+ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -+ vand.8 q15, q8, q4 -+ vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 -+ vand.8 q8, q8, q11 -+ vadd.s8 q0, q15, q8 // offset_idx -+ -+ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -+ vand.8 q15, q8, q5 -+ vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 -+ vand.8 q8, q8, q12 -+ vadd.s8 q1, q15, q8 // offset_idx -+ -+ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 -+ vand.8 q15, q8, q6 -+ vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 -+ vand.8 q8, q8, q13 -+ vadd.s8 q2, q15, q8 // offset_idx -+ -+ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 -+ vand.8 q15, q8, q7 -+ vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 -+ vand.8 q8, q8, q14 -+ vadd.s8 q3, q15, q8 // offset_idx -+ // TODO: load only once -+ vld1.8 d16, [r5] -+ -+ vtbl.8 d0, {d16}, d0 -+ vtbl.8 d1, {d16}, d1 -+ vtbl.8 d2, {d16}, d2 -+ vtbl.8 d3, {d16}, d3 -+ vtbl.8 d4, {d16}, d4 -+ vtbl.8 d5, {d16}, d5 -+ vtbl.8 d6, {d16}, d6 -+ vtbl.8 d7, {d16}, d7 -+ -+ // TODO: load only once -+ // load c again -+ sub r1, r3 -+ sub r1, r3 -+ vld1.8 {q4-q5}, [r1]! -+ vld1.8 {q6-q7}, [r1], r3 -+ sub r1, #32 -+ -+ vmovl.u8 q8, d8 -+ vmovl.u8 q9, d9 -+ vmovl.u8 q10, d10 -+ vmovl.u8 q11, d11 -+ vmovl.u8 q12, d12 -+ vmovl.u8 q13, d13 -+ vmovl.u8 q14, d14 -+ vmovl.u8 q15, d15 -+ -+ vaddw.s8 q8, d0 -+ vaddw.s8 q9, d1 -+ vaddw.s8 q10, d2 -+ vaddw.s8 q11, d3 -+ vaddw.s8 q12, d4 -+ vaddw.s8 q13, d5 -+ vaddw.s8 q14, d6 -+ vaddw.s8 q15, d7 -+ -+ vqmovun.s16 d0, q8 -+ vqmovun.s16 d1, q9 -+ vqmovun.s16 d2, q10 -+ vqmovun.s16 d3, q11 -+ vqmovun.s16 d4, q12 -+ vqmovun.s16 d5, q13 -+ vqmovun.s16 d6, q14 -+ vqmovun.s16 d7, q15 -+ -+ vstm r0, {q0-q3} -+ add r0, r2 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc --- -2.5.0 - - -From 402e2bd1c5ad659c757bf9734abe6331904fb9e2 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Tue, 16 Dec 2014 16:28:25 +0200 -Subject: [PATCH 3/9] Added SAO edge offset for ARM NEON w32 and w64 - ---- - libavcodec/arm/hevcdsp_init_neon.c | 46 +++- - libavcodec/arm/hevcdsp_sao_neon.S | 510 +++++++++++++++++++++++++++++++------ - 2 files changed, 474 insertions(+), 82 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index c7b5404..c32940e 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -49,7 +49,16 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d - void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); - void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); - void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ -+void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+void ff_hevc_sao_edge_eo2_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+void ff_hevc_sao_edge_eo3_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ -+void ff_hevc_sao_edge_eo0_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); - void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+void ff_hevc_sao_edge_eo2_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+void ff_hevc_sao_edge_eo3_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); - - #define PUT_PIXELS(name) \ - void name(int16_t *dst, uint8_t *src, \ -@@ -222,9 +231,40 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t - stride_src /= sizeof(pixel); - stride_dst /= sizeof(pixel); - -- if (eo == 1 && width == 64) { -- ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -- } else { -+ switch (width) { -+ case 32: -+ switch(eo) { -+ case 0: -+ ff_hevc_sao_edge_eo0_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ case 1: -+ ff_hevc_sao_edge_eo1_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ case 2: -+ ff_hevc_sao_edge_eo2_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ case 3: -+ ff_hevc_sao_edge_eo3_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ } -+ break; -+ case 64: -+ switch(eo) { -+ case 0: -+ ff_hevc_sao_edge_eo0_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ case 1: -+ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ case 2: -+ ff_hevc_sao_edge_eo2_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ case 3: -+ ff_hevc_sao_edge_eo3_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+ break; -+ } -+ break; -+ default: - a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; - b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; - for (y = 0; y < height; y++) { -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 5ec2de9..4687012 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -202,27 +202,7 @@ function ff_hevc_sao_band_w64_neon_8, export=1 - bx lr - endfunc - --function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x02 -- vpush {d8-d15} --1: subs r4, #1 -- // load a -- sub r1, r3 -- vld1.8 {q0-q1}, [r1]! -- vld1.8 {q2-q3}, [r1], r3 -- sub r1, #32 -- // load c -- vld1.8 {q4-q5}, [r1]! -- vld1.8 {q6-q7}, [r1], r3 -- sub r1, #32 -- // load b -- vld1.8 {q8-q9}, [r1]! -- vld1.8 {q10-q11}, [r1], r3 -- sub r1, #32 -- -+.macro edge_w64_body - vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 - vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 - vcgt.u8 q13, q5, q1 -@@ -251,69 +231,61 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 - vsub.s8 q2, q10, q2 - vsub.s8 q3, q11, q3 - -- veor.u8 q8, q8 // zero register -- vdup.s8 q9, r6 // 2 to all elements -- add r6, #1 -- vdup.s8 q10, r6 // 3 to all elements -- sub r6, #1 -- - vadd.s8 q0, q12 //diff0 + diff1 - vadd.s8 q1, q13 - vadd.s8 q2, q14 - vadd.s8 q3, q15 - -- vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 -- vcgt.s8 q5, q1, q8 -- vcgt.s8 q6, q2, q8 -- vcgt.s8 q7, q3, q8 -- -- vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 -- vclt.s8 q12, q1, q8 -- vclt.s8 q13, q2, q8 -- vclt.s8 q14, q3, q8 -- -- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -- vand.8 q15, q8, q4 -- vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 -- vand.8 q8, q8, q11 -- vadd.s8 q0, q15, q8 // offset_idx -- -- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -- vand.8 q15, q8, q5 -- vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 -- vand.8 q8, q8, q12 -- vadd.s8 q1, q15, q8 // offset_idx -- -- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 -- vand.8 q15, q8, q6 -- vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 -- vand.8 q8, q8, q13 -- vadd.s8 q2, q15, q8 // offset_idx -- -- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 -- vand.8 q15, q8, q7 -- vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 -- vand.8 q8, q8, q14 -- vadd.s8 q3, q15, q8 // offset_idx -- // TODO: load only once -- vld1.8 d16, [r5] -- -- vtbl.8 d0, {d16}, d0 -- vtbl.8 d1, {d16}, d1 -- vtbl.8 d2, {d16}, d2 -- vtbl.8 d3, {d16}, d3 -- vtbl.8 d4, {d16}, d4 -- vtbl.8 d5, {d16}, d5 -- vtbl.8 d6, {d16}, d6 -- vtbl.8 d7, {d16}, d7 -- -- // TODO: load only once -- // load c again -- sub r1, r3 -- sub r1, r3 -- vld1.8 {q4-q5}, [r1]! -- vld1.8 {q6-q7}, [r1], r3 -- sub r1, #32 -+ vdup.s8 q9, r6 // 3 to all elements -+ sub r6, #1 -+ -+ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -+ vclt.s8 q13, q1, #0 -+ vclt.s8 q14, q2, #0 -+ vclt.s8 q15, q3, #0 -+ -+ vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 -+ vadd.s8 q10, q1, q9 -+ vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -+ vand.8 q13, q10, q13 -+ vadd.s8 q8, q2, q9 -+ vadd.s8 q10, q3, q9 -+ vand.8 q14, q8, q14 -+ vand.8 q15, q10, q15 -+ -+ vdup.s8 q9, r6 // 2 to all elements -+ add r6, #1 -+ -+ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -+ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -+ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+ vcgt.s8 q10, q1, #0 -+ vadd.s8 q0, q11, q12 // offset_idx -+ -+ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -+ vcgt.s8 q12, q2, #0 -+ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 -+ vadd.s8 q1, q11, q13 -+ -+ vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+ vcgt.s8 q10, q3, #0 -+ vadd.s8 q2, q11, q14 -+ -+ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 -+ vmov.32 d18[0], r7 // load offset table from general registers -+ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+ vmov.32 d18[1], r5 // load rest of offset table -+ vadd.s8 q3, q11, q15 -+ -+ vtbl.8 d0, {d18}, d0 -+ vtbl.8 d1, {d18}, d1 -+ vtbl.8 d2, {d18}, d2 -+ vtbl.8 d3, {d18}, d3 -+ vtbl.8 d4, {d18}, d4 -+ vtbl.8 d5, {d18}, d5 -+ vtbl.8 d6, {d18}, d6 -+ vtbl.8 d7, {d18}, d7 - - vmovl.u8 q8, d8 - vmovl.u8 q9, d9 -@@ -344,8 +316,388 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 - - vstm r0, {q0-q3} - add r0, r2 -+.endm -+ -+.macro edge_w32_body -+ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+ vcgt.u8 q13, q5, q1 -+ vcgt.u8 q1, q1, q5 -+ -+ vsub.s8 q12, q0, q12 // diff0 -+ vcgt.u8 q0, q4, q8 // c > b -+ vsub.s8 q13, q1, q13 // diff0 part 2 -+ -+ vcgt.u8 q6, q8, q4 // b > c -+ vcgt.u8 q1, q5, q9 -+ vcgt.u8 q7, q9, q5 -+ -+ vsub.s8 q0, q6, q0 // diff1 -+ vsub.s8 q1, q7, q1 // diff1 part 2 -+ vadd.s8 q0, q12 //diff0 + diff1 -+ -+ vdup.s8 q7, r6 // 3 to all elements -+ sub r6, #1 -+ vadd.s8 q1, q13 -+ -+ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -+ vclt.s8 q13, q1, #0 -+ -+ vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 -+ vadd.s8 q10, q1, q7 -+ vdup.s8 q7, r6 // 2 to all elements -+ add r6, #1 -+ vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -+ vand.8 q13, q10, q13 -+ -+ -+ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -+ vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 -+ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+ vcgt.s8 q10, q1, #0 -+ vadd.s8 q0, q11, q12 // offset_idx -+ -+ vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 -+ vmov.32 d14[0], r7 // load offset table from general registers -+ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+ vmov.32 d14[1], r5 // load rest of offset table -+ vadd.s8 q1, q11, q13 -+ -+ vtbl.8 d0, {d14}, d0 -+ vtbl.8 d1, {d14}, d1 -+ vtbl.8 d2, {d14}, d2 -+ vtbl.8 d3, {d14}, d3 -+ -+ vmovl.u8 q6, d8 -+ vmovl.u8 q7, d9 -+ vmovl.u8 q10, d10 -+ vmovl.u8 q11, d11 -+ -+ vaddw.s8 q6, d0 -+ vaddw.s8 q7, d1 -+ vaddw.s8 q10, d2 -+ vaddw.s8 q11, d3 -+ -+ vqmovun.s16 d0, q6 -+ vqmovun.s16 d1, q7 -+ vqmovun.s16 d2, q10 -+ vqmovun.s16 d3, q11 -+ -+ vstm r0, {q0-q1} -+ add r0, r2 -+.endm -+ -+function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+ sub r1, #8 -+1: subs r4, #1 -+ vld1.64 {q10-q11}, [r1]! -+ vld1.64 {q12-q13}, [r1]! -+ vld1.64 {q14}, [r1], r3 -+ sub r1, #64 -+ // load a -+ vext.8 q0, q10, q11, #7 -+ vext.8 q1, q11, q12, #7 -+ vext.8 q2, q12, q13, #7 -+ vext.8 q3, q13, q14, #7 -+ // load c -+ vext.8 q4, q10, q11, #8 -+ vext.8 q5, q11, q12, #8 -+ vext.8 q6, q12, q13, #8 -+ vext.8 q7, q13, q14, #8 -+ // load b -+ vext.8 q8, q10, q11, #9 -+ vext.8 q9, q11, q12, #9 -+ vext.8 q10, q12, q13, #9 -+ vext.8 q11, q13, q14, #9 -+ edge_w64_body -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+ sub r1, r3 -+ // load a -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #32 -+1: subs r4, #1 -+ // load c -+ vld1.8 {q4-q5}, [r1]! -+ vld1.8 {q6-q7}, [r1], r3 -+ sub r1, #32 -+ // load b -+ vld1.8 {q8-q9}, [r1]! -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #32 -+ edge_w64_body -+ // copy c to a -+ vmov.64 q0, q4 -+ vmov.64 q1, q5 -+ vmov.64 q2, q6 -+ vmov.64 q3, q7 - bne 1b - vpop {d8-d15} - pop {r4-r8} - bx lr - endfunc -+ -+function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+1: sub r1, r3 -+ // load a -+ // TODO: fix unaligned load -+ // don't reload a like in eo1 -+ sub r1, #1 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #31 -+ subs r4, #1 -+ // load c -+ vld1.8 {q4-q5}, [r1]! -+ vld1.8 {q6-q7}, [r1], r3 -+ sub r1, #32 -+ // load b -+ add r1, #1 -+ vld1.8 {q8-q9}, [r1]! -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #33 -+ edge_w64_body -+ // copy c to a -+ vmov.64 q0, q4 -+ vmov.64 q1, q5 -+ vmov.64 q2, q6 -+ vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+1: sub r1, r3 -+ // load a -+ // TODO: fix unaligned load -+ // don't reload a like in eo1 -+ add r1, #1 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #33 -+ subs r4, #1 -+ // load c -+ vld1.8 {q4-q5}, [r1]! -+ vld1.8 {q6-q7}, [r1], r3 -+ sub r1, #32 -+ // load b -+ sub r1, #1 -+ vld1.8 {q8-q9}, [r1]! -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #31 -+ edge_w64_body -+ // copy c to a -+ vmov.64 q0, q4 -+ vmov.64 q1, q5 -+ vmov.64 q2, q6 -+ vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+ sub r1, #8 // load 8 extra bytes -+1: subs r4, #1 -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 // only first 9 bytes are used -+ sub r1, #32 -+ // a -+ vext.8 q0, q10, q11, #7 -+ vext.8 q1, q11, q12, #7 -+ // c -+ vext.8 q4, q10, q11, #8 -+ vext.8 q5, q11, q12, #8 -+ // b -+ vext.8 q8, q10, q11, #9 -+ vext.8 q9, q11, q12, #9 -+ edge_w32_body -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+ // load a -+ sub r1, r3 -+ vld1.8 {q0-q1}, [r1], r3 -+ // load c -+ vld1.8 {q4-q5}, [r1], r3 -+1: subs r4, #1 -+ // load b -+ vld1.8 {q8-q9}, [r1], r3 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+ vmov.64 q0, q4 -+ vmov.64 q1, q5 -+ // c -+ vmov.64 q4, q8 -+ vmov.64 q5, q9 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ ldr r5, [r5] -+ vpush {d8-d15} -+ // load a -+ sub r1, r3 -+ sub r1, #8 -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 -+ sub r1, #32 -+ vext.8 q0, q10, q11, #7 -+ vext.8 q1, q11, q12, #7 -+ // load c -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 -+ sub r1, #32 -+ vext.8 q4, q10, q11, #8 -+ vext.8 q5, q11, q12, #8 -+ vext.8 q2, q10, q11, #7 -+1: subs r4, #1 -+ // load b -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 -+ sub r1, #32 -+ vext.8 q8, q10, q11, #9 -+ vext.8 q9, q11, q12, #9 -+ vext.8 q14, q10, q11, #8 -+ vext.8 q15, q11, q12, #8 -+ vext.8 q3, q10, q11, #7 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+ vmov.8 q0, q2 -+ vext.8 q1, q4, q5, #15 -+ // c -+ vmov.8 q4, q14 -+ vmov.8 q5, q15 -+ vmov.8 q2, q3 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ -+function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -+ push {r4-r8} -+ ldr r4, [sp, #20] // height -+ ldr r5, [sp, #24] // sao_offset_val_table -+ ldr r6, =0x03 -+ ldr r7, [r5] -+ add r5, #4 -+ sub r1, r3 -+ ldr r5, [r5] -+ sub r1, #8 -+ vpush {d8-d15} -+ // load a -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 -+ sub r1, #32 -+ vext.8 q0, q10, q11, #9 -+ vext.8 q1, q11, q12, #9 -+ // load c -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 -+ sub r1, #32 -+ vext.8 q4, q10, q11, #8 -+ vext.8 q5, q11, q12, #8 -+ vext.8 q2, q12, q11, #8 -+1: subs r4, #1 -+ // load b -+ vld1.8 {q10-q11}, [r1] -+ add r1, #32 -+ vld1.8 {q12}, [r1], r3 -+ sub r1, #32 -+ vext.8 q8, q10, q11, #7 -+ vext.8 q9, q11, q12, #7 -+ vext.8 q3, q12, q10, #7 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+ vext.8 q0, q4, q5, #1 -+ vext.8 q1, q5, q2, #1 -+ // c -+ vext.8 q4, q8, q9, #1 -+ vext.8 q5, q9, q3, #1 -+ vext.8 q2, q3, q1, #1 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+endfunc -+ --- -2.5.0 - - -From 1898d052a73370166d57e17cc7c52b7275887df3 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Fri, 19 Dec 2014 09:44:10 +0200 -Subject: [PATCH 4/9] Improved SAO band NEON opimizations made SAO buffer 16 - byte aligned added alignment hints to loads and stores optimized register - usage in SAO band neon assembly - ---- - libavcodec/arm/hevcdsp_sao_neon.S | 212 +++++++++++++++----------------------- - 1 file changed, 82 insertions(+), 130 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 4687012..ac21013 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -22,120 +22,84 @@ - #include "neon.S" - - function ff_hevc_sao_band_w8_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // offset_table -- vpush {d8-d15} -- vld1.8 {q0, q1}, [r5] // offset table -+ ldr r12, [sp, #4] // offset_table address -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #0] // height - --1: subs r4, #1 -- vld1.8 {d24}, [r1], r3 -+1: subs r12, #1 -+ vld1.8 {d24}, [r1,:64], r3 - vshr.u8 d16, d24, #3 - vtbl.8 d16, {q0, q1}, d16 -- vmovl.s8 q2, d16 - vmovl.u8 q6, d24 -- vadd.s16 q2, q6 -+ vaddw.s8 q6, d16 - vqmovun.s16 d4, q2 -- vst1.8 {d4}, [r0], r2 -+ vst1.8 {d4}, [r0,:64], r2 - bne 1b - -- vpop {d8-d15} -- pop {r4-r8} - bx lr - endfunc - - function ff_hevc_sao_band_w16_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // offset_table -- vpush {d8-d15} -- vld1.8 {q0, q1}, [r5] // offset table -- --1: subs r4, #1 -- vld1.8 {q12}, [r1], r3 -+ ldr r12, [sp, #4] // offset_table address -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #0] // height - -+1: subs r12, #1 -+ vld1.8 {q12}, [r1,:128], r3 - vshr.u8 q8, q12, #3 -- - vtbl.8 d16, {q0, q1}, d16 - vtbl.8 d17, {q0, q1}, d17 -- -- vmovl.s8 q2, d16 -- vmovl.s8 q3, d17 -- -- vmovl.u8 q6, d24 -- vmovl.u8 q7, d25 -- -- vadd.s16 q2, q6 -- vadd.s16 q3, q7 -- -- vqmovun.s16 d4, q2 -- vqmovun.s16 d5, q3 -- -- vstm.8 r0, {q2} -- add r0, r2 -+ vmovl.u8 q10, d24 -+ vmovl.u8 q11, d25 -+ vaddw.s8 q10, d16 -+ vaddw.s8 q11, d17 -+ vqmovun.s16 d4, q10 -+ vqmovun.s16 d5, q11 -+ vst1.8 {q2}, [r0,:128], r2 - bne 1b - -- vpop {d8-d15} -- pop {r4-r8} - bx lr - endfunc - - function ff_hevc_sao_band_w32_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // offset_table -- vpush {d8-d15} -- vld1.8 {q0, q1}, [r5] // offset table -- --1: subs r4, #1 -- vld1.8 {q12-q13}, [r1], r3 -- -- vshr.u8 q8, q12, #3 -- vshr.u8 q9, q13, #3 -- -- vtbl.8 d16, {q0, q1}, d16 -- vtbl.8 d17, {q0, q1}, d17 -- vtbl.8 d18, {q0, q1}, d18 -- vtbl.8 d19, {q0, q1}, d19 -- -- vmovl.s8 q2, d16 -- vmovl.s8 q3, d17 // q8 free -- vmovl.s8 q4, d18 -- vmovl.s8 q5, d19 // q9 free -- -- vmovl.u8 q6, d24 -- vmovl.u8 q7, d25 // q12 free -- vmovl.u8 q8, d26 -- vmovl.u8 q9, d27 // q13 free -- -- vadd.s16 q2, q6 -- vadd.s16 q3, q7 -- vadd.s16 q4, q8 -- vadd.s16 q5, q9 -- -- vqmovun.s16 d4, q2 -- vqmovun.s16 d5, q3 -- vqmovun.s16 d6, q4 // q4 free -- vqmovun.s16 d7, q5 // q5 free -- -- vst1.8 {q2-q3}, [r0], r2 -- bne 1b -- -- vpop {d8-d15} -- pop {r4-r8} -- bx lr -+ ldr r12, [sp, #4] // offset_table address -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #0] // height -+ -+1: subs r12, #1 -+ vld1.8 {q2-q3}, [r1,:128], r3 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+ vtbl.8 d19, {q0, q1}, d19 -+ vmovl.u8 q12, d4 -+ vmovl.u8 q13, d5 -+ vmovl.u8 q14, d6 -+ vmovl.u8 q15, d7 -+ vaddw.s8 q12, d16 -+ vaddw.s8 q13, d17 -+ vaddw.s8 q14, d18 -+ vaddw.s8 q15, d19 -+ vqmovun.s16 d4, q12 -+ vqmovun.s16 d5, q13 -+ vqmovun.s16 d6, q14 -+ vqmovun.s16 d7, q15 -+ vst1.8 {q2-q3}, [r0,:128], r2 -+ bne 1b -+ -+ bx lr - endfunc - - function ff_hevc_sao_band_w64_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // offset_table -- vpush {d8-d15} -- vld1.8 {q0, q1}, [r5] // offset table -+ ldr r12, [sp, #4] // offset_table address -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #0] // height - --1: subs r4, #1 -- vld1.8 {q12-q13}, [r1]! -- vld1.8 {q14-q15}, [r1], r3 -+1: subs r12, #1 -+ vld1.8 {q12-q13}, [r1,:128]! -+ vld1.8 {q14-q15}, [r1,:128], r3 - sub r1, #32 - - vshr.u8 q8, q12, #3 -@@ -152,53 +116,41 @@ function ff_hevc_sao_band_w64_neon_8, export=1 - vtbl.8 d22, {q0, q1}, d22 - vtbl.8 d23, {q0, q1}, d23 - -- vmovl.s8 q2, d16 -- vmovl.s8 q3, d17 // q8 free -- vmovl.s8 q4, d18 -- vmovl.s8 q5, d19 // q9 free -+ vmovl.u8 q2, d24 -+ vmovl.u8 q3, d25 -+ vmovl.u8 q12, d26 -+ vmovl.u8 q13, d27 - -- vmovl.u8 q6, d24 -- vmovl.u8 q7, d25 // q12 free -- vmovl.u8 q8, d26 -- vmovl.u8 q9, d27 // q13 free -- -- vadd.s16 q2, q6 -- vadd.s16 q3, q7 -- vadd.s16 q4, q8 -- vadd.s16 q5, q9 -+ vaddw.s8 q2, d16 -+ vaddw.s8 q3, d17 -+ vaddw.s8 q12, d18 -+ vaddw.s8 q13, d19 - - vqmovun.s16 d4, q2 - vqmovun.s16 d5, q3 -- vqmovun.s16 d6, q4 // q4 free -- vqmovun.s16 d7, q5 // q5 free -- -- // free q4 -q9, q12 - q13 -- vmovl.s8 q4, d20 -- vmovl.s8 q5, d21 // q10 free -- vmovl.s8 q6, d22 -- vmovl.s8 q7, d23 // q11 free -- -- vmovl.u8 q8, d28 -- vmovl.u8 q9, d29 // q14 free -- vmovl.u8 q10, d30 -- vmovl.u8 q11, d31 // q15 free -- -- vadd.s16 q4, q8 -- vadd.s16 q5, q9 -- vadd.s16 q6, q10 -- vadd.s16 q7, q11 -- -- vqmovun.s16 d8, q4 -- vqmovun.s16 d9, q5 -- vqmovun.s16 d10, q6 -- vqmovun.s16 d11, q7 -- -- vstm.8 r0, {q2-q5} -- add r0, r2 -+ vqmovun.s16 d6, q12 -+ vqmovun.s16 d7, q13 -+ -+ vmovl.u8 q12, d28 -+ vmovl.u8 q13, d29 -+ vmovl.u8 q14, d30 -+ vmovl.u8 q15, d31 -+ -+ vaddw.s8 q12, d20 -+ vaddw.s8 q13, d21 -+ vaddw.s8 q14, d22 -+ vaddw.s8 q15, d23 -+ -+ vqmovun.s16 d8, q12 -+ vqmovun.s16 d9, q13 -+ vqmovun.s16 d10, q14 -+ vqmovun.s16 d11, q15 -+ -+ vst1.8 {q2-q3}, [r0,:128]! -+ vst1.8 {q4-q5}, [r0,:128], r2 -+ sub r0, #32 - bne 1b - -- vpop {d8-d15} -- pop {r4-r8} - bx lr - endfunc - --- -2.5.0 - - -From 26bd536800db2f50ff6a021e1fda0d0394d1ea01 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Mon, 29 Dec 2014 15:00:49 +0200 -Subject: [PATCH 5/9] better code reuse in NEON SAO band - ---- - libavcodec/arm/hevcdsp_init_neon.c | 16 ++-- - libavcodec/arm/hevcdsp_sao_neon.S | 155 +++++++++++++------------------------ - 2 files changed, 61 insertions(+), 110 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index c32940e..6379810 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, - void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, - ptrdiff_t stride); - --void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); --void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); --void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); --void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); - - void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); - void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -@@ -185,16 +185,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ - - switch(width){ - case 8: -- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); - break; - case 16: -- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); - break; - case 32: -- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); - break; - case 64: -- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -+ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); - break; - default: - for (y = 0; y < height; y++) { -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index ac21013..8852550 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -21,53 +21,13 @@ - #include "libavutil/arm/asm.S" - #include "neon.S" - --function ff_hevc_sao_band_w8_neon_8, export=1 -- ldr r12, [sp, #4] // offset_table address -+.macro init_sao_band -+ ldr r12, [sp, #0] // offset_table address - vld1.8 {q0, q1}, [r12] // offset table -- ldr r12, [sp, #0] // height -- --1: subs r12, #1 -- vld1.8 {d24}, [r1,:64], r3 -- vshr.u8 d16, d24, #3 -- vtbl.8 d16, {q0, q1}, d16 -- vmovl.u8 q6, d24 -- vaddw.s8 q6, d16 -- vqmovun.s16 d4, q2 -- vst1.8 {d4}, [r0,:64], r2 -- bne 1b -- -- bx lr --endfunc -- --function ff_hevc_sao_band_w16_neon_8, export=1 -- ldr r12, [sp, #4] // offset_table address -- vld1.8 {q0, q1}, [r12] // offset table -- ldr r12, [sp, #0] // height -- --1: subs r12, #1 -- vld1.8 {q12}, [r1,:128], r3 -- vshr.u8 q8, q12, #3 -- vtbl.8 d16, {q0, q1}, d16 -- vtbl.8 d17, {q0, q1}, d17 -- vmovl.u8 q10, d24 -- vmovl.u8 q11, d25 -- vaddw.s8 q10, d16 -- vaddw.s8 q11, d17 -- vqmovun.s16 d4, q10 -- vqmovun.s16 d5, q11 -- vst1.8 {q2}, [r0,:128], r2 -- bne 1b -- -- bx lr --endfunc -- --function ff_hevc_sao_band_w32_neon_8, export=1 -- ldr r12, [sp, #4] // offset_table address -- vld1.8 {q0, q1}, [r12] // offset table -- ldr r12, [sp, #0] // height -+ ldr r12, [sp, #4] // height -+.endm - --1: subs r12, #1 -- vld1.8 {q2-q3}, [r1,:128], r3 -+.macro sao_band_32 - vshr.u8 q8, q2, #3 - vshr.u8 q9, q3, #3 - vtbl.8 d16, {q0, q1}, d16 -@@ -86,6 +46,43 @@ function ff_hevc_sao_band_w32_neon_8, export=1 - vqmovun.s16 d5, q13 - vqmovun.s16 d6, q14 - vqmovun.s16 d7, q15 -+.endm -+ -+function ff_hevc_sao_band_w8_neon_8, export=1 -+ init_sao_band -+1: subs r12, #4 -+ vld1.8 {d4}, [r1,:64], r3 -+ vld1.8 {d5}, [r1,:64], r3 -+ vld1.8 {d6}, [r1,:64], r3 -+ vld1.8 {d7}, [r1,:64], r3 -+ sao_band_32 -+ vst1.8 {d4}, [r0,:64], r2 -+ vst1.8 {d5}, [r0,:64], r2 -+ vst1.8 {d6}, [r0,:64], r2 -+ vst1.8 {d7}, [r0,:64], r2 -+ bne 1b -+ -+ bx lr -+endfunc -+ -+function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+1: subs r12, #2 -+ vld1.8 {q2}, [r1,:128], r3 -+ vld1.8 {q3}, [r1,:128], r3 -+ sao_band_32 -+ vst1.8 {q2}, [r0,:128], r2 -+ vst1.8 {q3}, [r0,:128], r2 -+ bne 1b -+ -+ bx lr -+endfunc -+ -+function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+1: subs r12, #1 -+ vld1.8 {q2-q3}, [r1,:128], r3 -+ sao_band_32 - vst1.8 {q2-q3}, [r0,:128], r2 - bne 1b - -@@ -93,63 +90,17 @@ function ff_hevc_sao_band_w32_neon_8, export=1 - endfunc - - function ff_hevc_sao_band_w64_neon_8, export=1 -- ldr r12, [sp, #4] // offset_table address -- vld1.8 {q0, q1}, [r12] // offset table -- ldr r12, [sp, #0] // height -- --1: subs r12, #1 -- vld1.8 {q12-q13}, [r1,:128]! -- vld1.8 {q14-q15}, [r1,:128], r3 -- sub r1, #32 -- -- vshr.u8 q8, q12, #3 -- vshr.u8 q9, q13, #3 -- vshr.u8 q10, q14, #3 -- vshr.u8 q11, q15, #3 -- -- vtbl.8 d16, {q0, q1}, d16 -- vtbl.8 d17, {q0, q1}, d17 -- vtbl.8 d18, {q0, q1}, d18 -- vtbl.8 d19, {q0, q1}, d19 -- vtbl.8 d20, {q0, q1}, d20 -- vtbl.8 d21, {q0, q1}, d21 -- vtbl.8 d22, {q0, q1}, d22 -- vtbl.8 d23, {q0, q1}, d23 -- -- vmovl.u8 q2, d24 -- vmovl.u8 q3, d25 -- vmovl.u8 q12, d26 -- vmovl.u8 q13, d27 -- -- vaddw.s8 q2, d16 -- vaddw.s8 q3, d17 -- vaddw.s8 q12, d18 -- vaddw.s8 q13, d19 -- -- vqmovun.s16 d4, q2 -- vqmovun.s16 d5, q3 -- vqmovun.s16 d6, q12 -- vqmovun.s16 d7, q13 -- -- vmovl.u8 q12, d28 -- vmovl.u8 q13, d29 -- vmovl.u8 q14, d30 -- vmovl.u8 q15, d31 -- -- vaddw.s8 q12, d20 -- vaddw.s8 q13, d21 -- vaddw.s8 q14, d22 -- vaddw.s8 q15, d23 -- -- vqmovun.s16 d8, q12 -- vqmovun.s16 d9, q13 -- vqmovun.s16 d10, q14 -- vqmovun.s16 d11, q15 -- -- vst1.8 {q2-q3}, [r0,:128]! -- vst1.8 {q4-q5}, [r0,:128], r2 -- sub r0, #32 -- bne 1b -+ init_sao_band -+1: subs r12, #1 -+ vld1.8 {q2-q3}, [r1,:128]! -+ sao_band_32 -+ vst1.8 {q2-q3}, [r0,:128]! -+ vld1.8 {q2-q3}, [r1,:128], r3 -+ sub r1, #32 -+ sao_band_32 -+ vst1.8 {q2-q3}, [r0,:128], r2 -+ sub r0, #32 -+ bne 1b - - bx lr - endfunc --- -2.5.0 - - -From f93646a97bc885b81759e774d04be3781916a3e7 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Wed, 7 Jan 2015 15:27:38 +0200 -Subject: [PATCH 6/9] More SAO NEON optimizations Now uses only 8 bit integers - for SAO calculations - ---- - libavcodec/arm/hevcdsp_init_neon.c | 7 +- - libavcodec/arm/hevcdsp_sao_neon.S | 664 +++++++++++++++---------------------- - 2 files changed, 272 insertions(+), 399 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 6379810..8d6e863 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -225,7 +225,7 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t - int x, y; - - for (x = 0; x < 5; x++) { -- sao_offset_val[x] = _sao_offset_val[x]; -+ sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; - } - - stride_src /= sizeof(pixel); -@@ -271,8 +271,9 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t - for (x = 0; x < width; x++) { - int diff0 = CMP(src[x], src[x + a_stride]); - int diff1 = CMP(src[x], src[x + b_stride]); -- int offset_val = edge_idx[2 + diff0 + diff1]; -- dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -+ int idx = diff0 + diff1; -+ if (idx) -+ dst[x] = av_clip_pixel(src[x] + sao_offset_val[idx+2]); - } - src += stride_src; - dst += stride_dst; -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 8852550..5fc482b 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2014 Seppo Tomperi -+ * Copyright (c) 2014 - 2015 Seppo Tomperi - * - * This file is part of FFmpeg. - * -@@ -23,6 +23,7 @@ - - .macro init_sao_band - ldr r12, [sp, #0] // offset_table address -+ pld [r1] - vld1.8 {q0, q1}, [r12] // offset table - ldr r12, [sp, #4] // height - .endm -@@ -30,36 +31,31 @@ - .macro sao_band_32 - vshr.u8 q8, q2, #3 - vshr.u8 q9, q3, #3 -+ vmov.u8 q14, #128 - vtbl.8 d16, {q0, q1}, d16 - vtbl.8 d17, {q0, q1}, d17 - vtbl.8 d18, {q0, q1}, d18 - vtbl.8 d19, {q0, q1}, d19 -- vmovl.u8 q12, d4 -- vmovl.u8 q13, d5 -- vmovl.u8 q14, d6 -- vmovl.u8 q15, d7 -- vaddw.s8 q12, d16 -- vaddw.s8 q13, d17 -- vaddw.s8 q14, d18 -- vaddw.s8 q15, d19 -- vqmovun.s16 d4, q12 -- vqmovun.s16 d5, q13 -- vqmovun.s16 d6, q14 -- vqmovun.s16 d7, q15 -+ vadd.s8 q2, q14 -+ vadd.s8 q3, q14 -+ vqadd.s8 q2, q8 -+ vqadd.s8 q3, q9 -+ vsub.s8 q2, q14 -+ vsub.s8 q3, q14 - .endm - - function ff_hevc_sao_band_w8_neon_8, export=1 - init_sao_band - 1: subs r12, #4 -- vld1.8 {d4}, [r1,:64], r3 -- vld1.8 {d5}, [r1,:64], r3 -- vld1.8 {d6}, [r1,:64], r3 -- vld1.8 {d7}, [r1,:64], r3 -+ vld1.8 {d4}, [r1, :64], r3 -+ vld1.8 {d5}, [r1, :64], r3 -+ vld1.8 {d6}, [r1, :64], r3 -+ vld1.8 {d7}, [r1, :64], r3 - sao_band_32 -- vst1.8 {d4}, [r0,:64], r2 -- vst1.8 {d5}, [r0,:64], r2 -- vst1.8 {d6}, [r0,:64], r2 -- vst1.8 {d7}, [r0,:64], r2 -+ vst1.8 {d4}, [r0, :64], r2 -+ vst1.8 {d5}, [r0, :64], r2 -+ vst1.8 {d6}, [r0, :64], r2 -+ vst1.8 {d7}, [r0, :64], r2 - bne 1b - - bx lr -@@ -68,11 +64,11 @@ endfunc - function ff_hevc_sao_band_w16_neon_8, export=1 - init_sao_band - 1: subs r12, #2 -- vld1.8 {q2}, [r1,:128], r3 -- vld1.8 {q3}, [r1,:128], r3 -+ vld1.8 {q2}, [r1, :128], r3 -+ vld1.8 {q3}, [r1, :128], r3 - sao_band_32 -- vst1.8 {q2}, [r0,:128], r2 -- vst1.8 {q3}, [r0,:128], r2 -+ vst1.8 {q2}, [r0, :128], r2 -+ vst1.8 {q3}, [r0, :128], r2 - bne 1b - - bx lr -@@ -81,9 +77,9 @@ endfunc - function ff_hevc_sao_band_w32_neon_8, export=1 - init_sao_band - 1: subs r12, #1 -- vld1.8 {q2-q3}, [r1,:128], r3 -+ vld1.8 {q2-q3}, [r1, :128], r3 - sao_band_32 -- vst1.8 {q2-q3}, [r0,:128], r2 -+ vst1.8 {q2-q3}, [r0, :128], r2 - bne 1b - - bx lr -@@ -92,263 +88,153 @@ endfunc - function ff_hevc_sao_band_w64_neon_8, export=1 - init_sao_band - 1: subs r12, #1 -- vld1.8 {q2-q3}, [r1,:128]! -+ pld [r1, r3] -+ vld1.8 {q2-q3}, [r1, :128]! - sao_band_32 -- vst1.8 {q2-q3}, [r0,:128]! -- vld1.8 {q2-q3}, [r1,:128], r3 -+ vst1.8 {q2-q3}, [r0, :128]! -+ vld1.8 {q2-q3}, [r1, :128], r3 - sub r1, #32 - sao_band_32 -- vst1.8 {q2-q3}, [r0,:128], r2 -+ vst1.8 {q2-q3}, [r0, :128], r2 - sub r0, #32 - bne 1b - - bx lr - endfunc -- -+// input -+// a in q0 - q3 -+// c in q4 - q7 -+// b in q8 - q11 -+// offset table in r7 and r5 -+// output in q0 - q3 -+// clobbers q12 - q15 - .macro edge_w64_body -- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -- vcgt.u8 q13, q5, q1 -- vcgt.u8 q1, q1, q5 -- vcgt.u8 q14, q6, q2 -- vcgt.u8 q2, q2, q6 -- vcgt.u8 q15, q7, q3 -- vcgt.u8 q3, q3, q7 -- -- vsub.s8 q12, q0, q12 // diff0 -- vsub.s8 q13, q1, q13 -- vsub.s8 q14, q2, q14 -- vsub.s8 q15, q3, q15 -- -+ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+ vcgt.u8 q13, q5, q1 -+ vcgt.u8 q1, q1, q5 -+ vsub.s8 q12, q0, q12 // diff0 - vcgt.u8 q0, q4, q8 // c > b -- vcgt.u8 q8, q8, q4 // b > c -+ vsub.s8 q13, q1, q13 -+ -+ vcgt.u8 q14, q8, q4 // b > c - vcgt.u8 q1, q5, q9 -- vcgt.u8 q9, q9, q5 -- vcgt.u8 q2, q6, q10 -- vcgt.u8 q10, q10, q6 -- vcgt.u8 q3, q7, q11 -- vcgt.u8 q11, q11, q7 -+ vcgt.u8 q15, q9, q5 -+ vsub.s8 q0, q14, q0 // diff1 - -- vsub.s8 q0, q8, q0 // diff1 -- vsub.s8 q1, q9, q1 -- vsub.s8 q2, q10, q2 -- vsub.s8 q3, q11, q3 -+ vsub.s8 q1, q15, q1 - -- vadd.s8 q0, q12 //diff0 + diff1 -- vadd.s8 q1, q13 -- vadd.s8 q2, q14 -- vadd.s8 q3, q15 -- -- vdup.s8 q9, r6 // 3 to all elements -- sub r6, #1 -- -- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -- vclt.s8 q13, q1, #0 -- vclt.s8 q14, q2, #0 -- vclt.s8 q15, q3, #0 -- -- vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 -- vadd.s8 q10, q1, q9 -- vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -- vand.8 q13, q10, q13 -- vadd.s8 q8, q2, q9 -- vadd.s8 q10, q3, q9 -- vand.8 q14, q8, q14 -- vand.8 q15, q10, q15 -- -- vdup.s8 q9, r6 // 2 to all elements -- add r6, #1 -- -- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -- vcgt.s8 q10, q1, #0 -- vadd.s8 q0, q11, q12 // offset_idx -- -- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -- vcgt.s8 q12, q2, #0 -- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 -- vadd.s8 q1, q11, q13 -- -- vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -- vcgt.s8 q10, q3, #0 -- vadd.s8 q2, q11, q14 -- -- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 -- vmov.32 d18[0], r7 // load offset table from general registers -- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -- vmov.32 d18[1], r5 // load rest of offset table -- vadd.s8 q3, q11, q15 -- -- vtbl.8 d0, {d18}, d0 -- vtbl.8 d1, {d18}, d1 -- vtbl.8 d2, {d18}, d2 -- vtbl.8 d3, {d18}, d3 -- vtbl.8 d4, {d18}, d4 -- vtbl.8 d5, {d18}, d5 -- vtbl.8 d6, {d18}, d6 -- vtbl.8 d7, {d18}, d7 -- -- vmovl.u8 q8, d8 -- vmovl.u8 q9, d9 -- vmovl.u8 q10, d10 -- vmovl.u8 q11, d11 -- vmovl.u8 q12, d12 -- vmovl.u8 q13, d13 -- vmovl.u8 q14, d14 -- vmovl.u8 q15, d15 -- -- vaddw.s8 q8, d0 -- vaddw.s8 q9, d1 -- vaddw.s8 q10, d2 -- vaddw.s8 q11, d3 -- vaddw.s8 q12, d4 -- vaddw.s8 q13, d5 -- vaddw.s8 q14, d6 -- vaddw.s8 q15, d7 -- -- vqmovun.s16 d0, q8 -- vqmovun.s16 d1, q9 -- vqmovun.s16 d2, q10 -- vqmovun.s16 d3, q11 -- vqmovun.s16 d4, q12 -- vqmovun.s16 d5, q13 -- vqmovun.s16 d6, q14 -- vqmovun.s16 d7, q15 -- -- vstm r0, {q0-q3} -- add r0, r2 --.endm -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 - --.macro edge_w32_body -- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -- vcgt.u8 q13, q5, q1 -- vcgt.u8 q1, q1, q5 -+ vcgt.u8 q14, q6, q2 -+ vcgt.u8 q2, q2, q6 -+ vcgt.u8 q15, q7, q3 -+ vcgt.u8 q3, q3, q7 - -- vsub.s8 q12, q0, q12 // diff0 -- vcgt.u8 q0, q4, q8 // c > b -- vsub.s8 q13, q1, q13 // diff0 part 2 -+ vsub.s8 q14, q2, q14 -+ vcgt.u8 q2, q6, q10 -+ vsub.s8 q15, q3, q15 - -- vcgt.u8 q6, q8, q4 // b > c -- vcgt.u8 q1, q5, q9 -- vcgt.u8 q7, q9, q5 -+ vcgt.u8 q12, q10, q6 -+ vcgt.u8 q3, q7, q11 -+ vcgt.u8 q13, q11, q7 -+ vsub.s8 q2, q12, q2 -+ vsub.s8 q3, q13, q3 - -- vsub.s8 q0, q6, q0 // diff1 -- vsub.s8 q1, q7, q1 // diff1 part 2 -- vadd.s8 q0, q12 //diff0 + diff1 -+ vmov.s8 q13, #2 // 2 to all elements - -- vdup.s8 q7, r6 // 3 to all elements -- sub r6, #1 -- vadd.s8 q1, q13 -+ vadd.s8 q2, q14 -+ vadd.s8 q3, q15 -+ -+ vmov.32 d24[0], r4 // load offset table from general registers -+ vmov.32 d24[1], r5 // load rest of offset table - -- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -- vclt.s8 q13, q1, #0 -- -- vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 -- vadd.s8 q10, q1, q7 -- vdup.s8 q7, r6 // 2 to all elements -- add r6, #1 -- vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -- vand.8 q13, q10, q13 -- -- -- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -- vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 -- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -- vcgt.s8 q10, q1, #0 -- vadd.s8 q0, q11, q12 // offset_idx -- -- vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 -- vmov.32 d14[0], r7 // load offset table from general registers -- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -- vmov.32 d14[1], r5 // load rest of offset table -- vadd.s8 q1, q11, q13 -- -- vtbl.8 d0, {d14}, d0 -- vtbl.8 d1, {d14}, d1 -- vtbl.8 d2, {d14}, d2 -- vtbl.8 d3, {d14}, d3 -- -- vmovl.u8 q6, d8 -- vmovl.u8 q7, d9 -- vmovl.u8 q10, d10 -- vmovl.u8 q11, d11 -- -- vaddw.s8 q6, d0 -- vaddw.s8 q7, d1 -- vaddw.s8 q10, d2 -- vaddw.s8 q11, d3 -- -- vqmovun.s16 d0, q6 -- vqmovun.s16 d1, q7 -- vqmovun.s16 d2, q10 -- vqmovun.s16 d3, q11 -- -- vstm r0, {q0-q1} -- add r0, r2 -+ vadd.s8 q0, q13 -+ vadd.s8 q1, q13 -+ vadd.s8 q2, q13 -+ vadd.s8 q3, q13 -+ -+ vmov.u8 q15, #128 // s8 #-128 -+ vtbl.8 d0, {d24}, d0 -+ vtbl.8 d1, {d24}, d1 -+ vtbl.8 d2, {d24}, d2 -+ vtbl.8 d3, {d24}, d3 -+ vtbl.8 d4, {d24}, d4 -+ vtbl.8 d5, {d24}, d5 -+ vtbl.8 d6, {d24}, d6 -+ vtbl.8 d7, {d24}, d7 -+ -+ vadd.s8 q12, q4, q15 -+ vadd.s8 q13, q5, q15 -+ vadd.s8 q14, q6, q15 -+ vadd.s8 q15, q7, q15 -+ vqadd.s8 q12, q0 -+ vqadd.s8 q15, q3 -+ vmov.u8 q3, #128 // s8 #-128 -+ vqadd.s8 q13, q1 -+ vqadd.s8 q14, q2 -+ vsub.s8 q0, q12, q3 -+ vsub.s8 q1, q13, q3 -+ vsub.s8 q2, q14, q3 -+ vsub.s8 q3, q15, q3 -+ vst1.8 {q0-q1}, [r0, :128]! -+ vst1.8 {q2-q3}, [r0, :128], r2 -+ sub r0, #32 - .endm - --function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -+.macro init_edge_64 -+ push {r4-r5} -+ ldr r12, [sp, #8] // height -+ ldr r5, [sp, #12] // sao_offset_val_table -+ ldr r4, [r5] - add r5, #4 - ldr r5, [r5] -+.endm -+ -+function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -+ init_edge_64 - vpush {d8-d15} - sub r1, #8 --1: subs r4, #1 -- vld1.64 {q10-q11}, [r1]! -- vld1.64 {q12-q13}, [r1]! -- vld1.64 {q14}, [r1], r3 -- sub r1, #64 -+1: subs r12, #1 -+ vld1.64 {d7}, [r1, :64]! -+ vld1.64 {q4-q5}, [r1, :128]! // load c -+ vld1.64 {q6-q7}, [r1, :128]! -+ vld1.64 {d24}, [r1, :64], r3 -+ sub r1, #72 - // load a -- vext.8 q0, q10, q11, #7 -- vext.8 q1, q11, q12, #7 -- vext.8 q2, q12, q13, #7 -- vext.8 q3, q13, q14, #7 -- // load c -- vext.8 q4, q10, q11, #8 -- vext.8 q5, q11, q12, #8 -- vext.8 q6, q12, q13, #8 -- vext.8 q7, q13, q14, #8 -+ vext.8 q0, q3, q4, #15 -+ vext.8 q1, q4, q5, #15 -+ vext.8 q2, q5, q6, #15 -+ vext.8 q3, q6, q7, #15 - // load b -- vext.8 q8, q10, q11, #9 -- vext.8 q9, q11, q12, #9 -- vext.8 q10, q12, q13, #9 -- vext.8 q11, q13, q14, #9 -+ vext.8 q8, q4, q5, #1 -+ vext.8 q9, q5, q6, #1 -+ vext.8 q10, q6, q7, #1 -+ vext.8 q11, q7, q12, #1 - edge_w64_body - bne 1b - vpop {d8-d15} -- pop {r4-r8} -+ pop {r4-r5} - bx lr - endfunc - - function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- ldr r5, [r5] -+ init_edge_64 - vpush {d8-d15} - sub r1, r3 - // load a -- vld1.8 {q0-q1}, [r1]! -- vld1.8 {q2-q3}, [r1], r3 -+ vld1.8 {q0-q1}, [r1, :128]! -+ vld1.8 {q2-q3}, [r1, :128], r3 - sub r1, #32 --1: subs r4, #1 - // load c -- vld1.8 {q4-q5}, [r1]! -- vld1.8 {q6-q7}, [r1], r3 -+ vld1.8 {q4-q5}, [r1, :128]! -+ vld1.8 {q6-q7}, [r1, :128], r3 - sub r1, #32 -+1: subs r12, #1 - // load b -- vld1.8 {q8-q9}, [r1]! -- vld1.8 {q10-q11}, [r1] -+ vld1.8 {q8-q9}, [r1, :128]! -+ vld1.8 {q10-q11}, [r1, :128], r3 - sub r1, #32 - edge_w64_body - // copy c to a -@@ -356,20 +242,19 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 - vmov.64 q1, q5 - vmov.64 q2, q6 - vmov.64 q3, q7 -+ // copy b to c -+ vmov.64 q4, q8 -+ vmov.64 q5, q9 -+ vmov.64 q6, q10 -+ vmov.64 q7, q11 - bne 1b - vpop {d8-d15} -- pop {r4-r8} -+ pop {r4-r5} - bx lr - endfunc - - function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- ldr r5, [r5] -+ init_edge_64 - vpush {d8-d15} - 1: sub r1, r3 - // load a -@@ -379,10 +264,10 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 - vld1.8 {q0-q1}, [r1]! - vld1.8 {q2-q3}, [r1], r3 - sub r1, #31 -- subs r4, #1 -+ subs r12, #1 - // load c -- vld1.8 {q4-q5}, [r1]! -- vld1.8 {q6-q7}, [r1], r3 -+ vld1.8 {q4-q5}, [r1, :128]! -+ vld1.8 {q6-q7}, [r1, :128], r3 - sub r1, #32 - // load b - add r1, #1 -@@ -390,25 +275,14 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 - vld1.8 {q10-q11}, [r1] - sub r1, #33 - edge_w64_body -- // copy c to a -- vmov.64 q0, q4 -- vmov.64 q1, q5 -- vmov.64 q2, q6 -- vmov.64 q3, q7 - bne 1b - vpop {d8-d15} -- pop {r4-r8} -+ pop {r4-r5} - bx lr - endfunc - - function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- ldr r5, [r5] -+ init_edge_64 - vpush {d8-d15} - 1: sub r1, r3 - // load a -@@ -418,10 +292,10 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 - vld1.8 {q0-q1}, [r1]! - vld1.8 {q2-q3}, [r1], r3 - sub r1, #33 -- subs r4, #1 -+ subs r12, #1 - // load c -- vld1.8 {q4-q5}, [r1]! -- vld1.8 {q6-q7}, [r1], r3 -+ vld1.8 {q4-q5}, [r1, :128]! -+ vld1.8 {q6-q7}, [r1, :128], r3 - sub r1, #32 - // load b - sub r1, #1 -@@ -429,178 +303,176 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 - vld1.8 {q10-q11}, [r1] - sub r1, #31 - edge_w64_body -- // copy c to a -- vmov.64 q0, q4 -- vmov.64 q1, q5 -- vmov.64 q2, q6 -- vmov.64 q3, q7 - bne 1b - vpop {d8-d15} -- pop {r4-r8} -+ pop {r4-r5} - bx lr - endfunc - -+// inputs: -+// a in q0, q1 -+// c in q2, q3 -+// b in q8, q9 -+// offset table in d31 -+// clobbered registers q0, q1, q10, q11, q12, q13 -+// output q0, q1 -+.macro edge_w32_body -+ vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 -+ vcgt.u8 q13, q3, q1 -+ vcgt.u8 q1, q1, q3 -+ -+ vsub.s8 q12, q0, q12 // diff0 -+ vcgt.u8 q0, q2, q8 // c > b -+ vsub.s8 q13, q1, q13 // diff0 part 2 -+ -+ vcgt.u8 q10, q8, q2 // b > c -+ vcgt.u8 q1, q3, q9 -+ vcgt.u8 q11, q9, q3 -+ -+ vsub.s8 q0, q10, q0 // diff1 -+ -+ vmov.s8 q10, #2 // 2 to all elements -+ vsub.s8 q1, q11, q1 // diff1 part 2 -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ -+ vadd.s8 q0, q10 -+ vadd.s8 q1, q10 -+ -+ vmov.u8 q10, #128 -+ vtbl.8 d0, {d31}, d0 -+ vtbl.8 d1, {d31}, d1 -+ vtbl.8 d2, {d31}, d2 -+ vtbl.8 d3, {d31}, d3 -+ -+ vadd.s8 q11, q2, q10 -+ vadd.s8 q12, q3, q10 -+ vqadd.s8 q11, q0 -+ vqadd.s8 q12, q1 -+ vsub.s8 q0, q11, q10 -+ vsub.s8 q1, q12, q10 -+ vst1.8 {q0-q1}, [r0, :128], r2 -+.endm -+ -+.macro init_edge_32 -+ ldr r12, [sp, #4] // sao_offset_val_table -+ vld1.32 {d31}, [r12] -+ ldr r12, [sp] // height -+.endm -+ - function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- ldr r5, [r5] -- vpush {d8-d15} -- sub r1, #8 // load 8 extra bytes --1: subs r4, #1 -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 // only first 9 bytes are used -- sub r1, #32 -+ init_edge_32 -+ sub r1, #4 // load 4 extra bytes -+1: subs r12, #1 -+ vld1.32 d3[1], [r1]! -+ vld1.8 {q2-q3}, [r1, :128]! // c -+ vld1.32 d20[0], [r1], r3 -+ sub r1, #36 - // a -- vext.8 q0, q10, q11, #7 -- vext.8 q1, q11, q12, #7 -- // c -- vext.8 q4, q10, q11, #8 -- vext.8 q5, q11, q12, #8 -+ vext.8 q0, q1, q2, #15 -+ vext.8 q1, q2, q3, #15 - // b -- vext.8 q8, q10, q11, #9 -- vext.8 q9, q11, q12, #9 -+ vext.8 q8, q2, q3, #1 -+ vext.8 q9, q3, q10, #1 - edge_w32_body -- bne 1b -- vpop {d8-d15} -- pop {r4-r8} -- bx lr -+ bne 1b -+ bx lr - endfunc - - function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- ldr r5, [r5] -- vpush {d8-d15} -+ init_edge_32 - // load a - sub r1, r3 -- vld1.8 {q0-q1}, [r1], r3 -+ vld1.8 {q0-q1}, [r1, :128], r3 - // load c -- vld1.8 {q4-q5}, [r1], r3 --1: subs r4, #1 -+ vld1.8 {q2-q3}, [r1, :128], r3 -+1: subs r12, #1 - // load b -- vld1.8 {q8-q9}, [r1], r3 -+ vld1.8 {q8-q9}, [r1, :128], r3 - edge_w32_body - // inputs for next loop iteration - // a -- vmov.64 q0, q4 -- vmov.64 q1, q5 -+ vmov.64 q0, q2 -+ vmov.64 q1, q3 - // c -- vmov.64 q4, q8 -- vmov.64 q5, q9 -- bne 1b -- vpop {d8-d15} -- pop {r4-r8} -- bx lr -+ vmov.64 q2, q8 -+ vmov.64 q3, q9 -+ bne 1b -+ bx lr - endfunc - - function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- ldr r5, [r5] -- vpush {d8-d15} -+ init_edge_32 -+ vpush {d8-d15} - // load a - sub r1, r3 -- sub r1, #8 -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 -- sub r1, #32 -+ sub r1, #8 -+ vld1.8 {q10-q11}, [r1, :64]! -+ vld1.8 {d24}, [r1, :64], r3 -+ sub r1, #32 - vext.8 q0, q10, q11, #7 - vext.8 q1, q11, q12, #7 - // load c -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 -- sub r1, #32 -- vext.8 q4, q10, q11, #8 -- vext.8 q5, q11, q12, #8 -- vext.8 q2, q10, q11, #7 --1: subs r4, #1 -+ vld1.8 {d9}, [r1, :64]! -+ vld1.8 {q2-q3}, [r1, :64], r3 -+ sub r1, #8 -+ vext.8 q4, q4, q2, #15 -+1: subs r12, #1 - // load b -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 -- sub r1, #32 -+ vld1.8 {q10-q11}, [r1, :64]! -+ vld1.8 {q12}, [r1, :64], r3 -+ sub r1, #32 - vext.8 q8, q10, q11, #9 - vext.8 q9, q11, q12, #9 -- vext.8 q14, q10, q11, #8 -- vext.8 q15, q11, q12, #8 -- vext.8 q3, q10, q11, #7 -+ vext.8 q6, q10, q11, #8 -+ vext.8 q7, q11, q12, #8 -+ vext.8 q5, q10, q11, #7 - edge_w32_body - // inputs for next loop iteration - // a -- vmov.8 q0, q2 -- vext.8 q1, q4, q5, #15 -+ vmov.8 q0, q4 -+ vext.8 q1, q2, q3, #15 - // c -- vmov.8 q4, q14 -- vmov.8 q5, q15 -- vmov.8 q2, q3 -- bne 1b -- vpop {d8-d15} -- pop {r4-r8} -- bx lr -+ vmov.8 q2, q6 -+ vmov.8 q3, q7 -+ vmov.8 q4, q5 -+ bne 1b -+ vpop {d8-d15} -+ bx lr - endfunc - - function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -- push {r4-r8} -- ldr r4, [sp, #20] // height -- ldr r5, [sp, #24] // sao_offset_val_table -- ldr r6, =0x03 -- ldr r7, [r5] -- add r5, #4 -- sub r1, r3 -- ldr r5, [r5] -- sub r1, #8 -- vpush {d8-d15} -+ init_edge_32 -+ sub r1, r3 - // load a -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 -- sub r1, #32 -- vext.8 q0, q10, q11, #9 -- vext.8 q1, q11, q12, #9 -+ vld1.8 {q10-q11}, [r1, :64]! -+ vld1.8 {d24}, [r1, :64], r3 -+ sub r1, #32 -+ vext.8 q0, q10, q11, #1 -+ vext.8 q1, q11, q12, #1 - // load c -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 -- sub r1, #32 -- vext.8 q4, q10, q11, #8 -- vext.8 q5, q11, q12, #8 -- vext.8 q2, q12, q11, #8 --1: subs r4, #1 -+ vld1.8 {q2-q3}, [r1, :64]! -+ vld1.8 {d30}, [r1, :64], r3 -+ sub r1, #40 -+1: subs r12, #1 - // load b -- vld1.8 {q10-q11}, [r1] -- add r1, #32 -- vld1.8 {q12}, [r1], r3 -- sub r1, #32 -+ vld1.8 {q10-q11}, [r1, :64]! -+ vld1.8 {q12}, [r1, :64], r3 -+ sub r1, #32 - vext.8 q8, q10, q11, #7 - vext.8 q9, q11, q12, #7 -- vext.8 q3, q12, q10, #7 -+ vext.8 q14, q12, q10, #7 - edge_w32_body - // inputs for next loop iteration - // a -- vext.8 q0, q4, q5, #1 -- vext.8 q1, q5, q2, #1 -+ vext.8 q0, q2, q3, #1 -+ vext.8 q1, q3, q15, #1 - // c -- vext.8 q4, q8, q9, #1 -- vext.8 q5, q9, q3, #1 -- vext.8 q2, q3, q1, #1 -- bne 1b -- vpop {d8-d15} -- pop {r4-r8} -- bx lr -+ vext.8 q2, q8, q9, #1 -+ vext.8 q3, q9, q14, #1 -+ vext.8 d30, d28, d2, #1 -+ bne 1b -+ bx lr - endfunc - --- -2.5.0 - - -From 016c39d46b86830204a4519590332d2a38f7ee51 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Thu, 8 Jan 2015 09:58:55 +0200 -Subject: [PATCH 7/9] small optimization to SAO BAND. correct path for - bit_depth_template.c - ---- - libavcodec/arm/hevcdsp_init_neon.c | 2 +- - libavcodec/arm/hevcdsp_sao_neon.S | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 8d6e863..385c35d 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -23,7 +23,7 @@ - #include "libavcodec/hevcdsp.h" - #include "hevcdsp_arm.h" - #include "libavcodec/avcodec.h" --#include "../bit_depth_template.c" -+#include "libavcodec/bit_depth_template.c" - - void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); - void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 5fc482b..710b32b 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -26,12 +26,12 @@ - pld [r1] - vld1.8 {q0, q1}, [r12] // offset table - ldr r12, [sp, #4] // height -+ vmov.u8 q14, #128 - .endm - - .macro sao_band_32 - vshr.u8 q8, q2, #3 - vshr.u8 q9, q3, #3 -- vmov.u8 q14, #128 - vtbl.8 d16, {q0, q1}, d16 - vtbl.8 d17, {q0, q1}, d17 - vtbl.8 d18, {q0, q1}, d18 --- -2.5.0 - - -From 579f1584d688e1ac24fb7d22697e2a7b64f62e8e Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Fri, 9 Jan 2015 10:28:52 +0200 -Subject: [PATCH 8/9] Added height check for SAO NEON optimizations. Faster SAO - band NEON Some reordering to use NEON pipelines more efficiently - ---- - libavcodec/arm/hevcdsp_init_neon.c | 12 +++- - libavcodec/arm/hevcdsp_sao_neon.S | 142 ++++++++++++++++++++++--------------- - 2 files changed, 93 insertions(+), 61 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 385c35d..6d0689c 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -176,6 +176,7 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ - int8_t offset_table[32] = { 0 }; - int k, y, x; - int shift = 3; // BIT_DEPTH - 5 -+ int cwidth = 0; - - stride_src /= sizeof(pixel); - stride_dst /= sizeof(pixel); -@@ -183,7 +184,10 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ - for (k = 0; k < 4; k++) - offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; - -- switch(width){ -+ if (height % 8 == 0) -+ cwidth = width; -+ -+ switch(cwidth){ - case 8: - ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); - break; -@@ -223,15 +227,19 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t - pixel *src = (pixel *)_src; - int a_stride, b_stride; - int x, y; -+ int cwidth = 0; - - for (x = 0; x < 5; x++) { - sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; - } - -+ if (height % 8 == 0) -+ cwidth = width; -+ - stride_src /= sizeof(pixel); - stride_dst /= sizeof(pixel); - -- switch (width) { -+ switch (cwidth) { - case 32: - switch(eo) { - case 0: -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 710b32b..08f50b8 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -26,36 +26,59 @@ - pld [r1] - vld1.8 {q0, q1}, [r12] // offset table - ldr r12, [sp, #4] // height -- vmov.u8 q14, #128 -+ vmov.u8 q3, #128 - .endm - --.macro sao_band_32 -- vshr.u8 q8, q2, #3 -- vshr.u8 q9, q3, #3 -- vtbl.8 d16, {q0, q1}, d16 -- vtbl.8 d17, {q0, q1}, d17 -- vtbl.8 d18, {q0, q1}, d18 -- vtbl.8 d19, {q0, q1}, d19 -- vadd.s8 q2, q14 -- vadd.s8 q3, q14 -- vqadd.s8 q2, q8 -- vqadd.s8 q3, q9 -- vsub.s8 q2, q14 -- vsub.s8 q3, q14 -+// 128 in q3 -+// input q8 - q11 -+// 32 cycles -+.macro sao_band_64 -+ vshr.u8 q12, q8, #3 -+ vshr.u8 q13, q9, #3 -+ vshr.u8 q14, q10, #3 -+ vshr.u8 q15, q11, #3 -+ vtbl.8 d24, {d0, d1, d2, d3}, d24 -+ vadd.s8 q8, q3 -+ vtbl.8 d25, {d0, d1, d2, d3}, d25 -+ vadd.s8 q9, q3 -+ vtbl.8 d26, {d0, d1, d2, d3}, d26 -+ vadd.s8 q10, q3 -+ vtbl.8 d27, {d0, d1, d2, d3}, d27 -+ vadd.s8 q11, q3 -+ vtbl.8 d28, {d0, d1, d2, d3}, d28 -+ vqadd.s8 q8, q12 -+ vtbl.8 d29, {d0, d1, d2, d3}, d29 -+ vqadd.s8 q9, q13 -+ vtbl.8 d30, {d0, d1, d2, d3}, d30 -+ vqadd.s8 q10, q14 -+ vtbl.8 d31, {d0, d1, d2, d3}, d31 -+ vqadd.s8 q11, q15 -+ vsub.s8 q8, q3 -+ vsub.s8 q9, q3 -+ vsub.s8 q10, q3 -+ vsub.s8 q11, q3 - .endm - - function ff_hevc_sao_band_w8_neon_8, export=1 - init_sao_band --1: subs r12, #4 -- vld1.8 {d4}, [r1, :64], r3 -- vld1.8 {d5}, [r1, :64], r3 -- vld1.8 {d6}, [r1, :64], r3 -- vld1.8 {d7}, [r1, :64], r3 -- sao_band_32 -- vst1.8 {d4}, [r0, :64], r2 -- vst1.8 {d5}, [r0, :64], r2 -- vst1.8 {d6}, [r0, :64], r2 -- vst1.8 {d7}, [r0, :64], r2 -+1: subs r12, #8 -+ vld1.8 {d16}, [r1, :64], r3 -+ vld1.8 {d17}, [r1, :64], r3 -+ vld1.8 {d18}, [r1, :64], r3 -+ vld1.8 {d19}, [r1, :64], r3 -+ vld1.8 {d20}, [r1, :64], r3 -+ vld1.8 {d21}, [r1, :64], r3 -+ vld1.8 {d22}, [r1, :64], r3 -+ vld1.8 {d23}, [r1, :64], r3 -+ sao_band_64 -+ vst1.8 {d16}, [r0, :64], r2 -+ vst1.8 {d17}, [r0, :64], r2 -+ vst1.8 {d18}, [r0, :64], r2 -+ vst1.8 {d19}, [r0, :64], r2 -+ vst1.8 {d20}, [r0, :64], r2 -+ vst1.8 {d21}, [r0, :64], r2 -+ vst1.8 {d22}, [r0, :64], r2 -+ vst1.8 {d23}, [r0, :64], r2 - bne 1b - - bx lr -@@ -63,12 +86,16 @@ endfunc - - function ff_hevc_sao_band_w16_neon_8, export=1 - init_sao_band --1: subs r12, #2 -- vld1.8 {q2}, [r1, :128], r3 -- vld1.8 {q3}, [r1, :128], r3 -- sao_band_32 -- vst1.8 {q2}, [r0, :128], r2 -- vst1.8 {q3}, [r0, :128], r2 -+1: subs r12, #4 -+ vld1.8 {q8}, [r1, :128], r3 -+ vld1.8 {q9}, [r1, :128], r3 -+ vld1.8 {q10}, [r1, :128], r3 -+ vld1.8 {q11}, [r1, :128], r3 -+ sao_band_64 -+ vst1.8 {q8}, [r0, :128], r2 -+ vst1.8 {q9}, [r0, :128], r2 -+ vst1.8 {q10}, [r0, :128], r2 -+ vst1.8 {q11}, [r0, :128], r2 - bne 1b - - bx lr -@@ -76,10 +103,12 @@ endfunc - - function ff_hevc_sao_band_w32_neon_8, export=1 - init_sao_band --1: subs r12, #1 -- vld1.8 {q2-q3}, [r1, :128], r3 -- sao_band_32 -- vst1.8 {q2-q3}, [r0, :128], r2 -+1: subs r12, #2 -+ vld1.8 {q8-q9}, [r1, :128], r3 -+ vld1.8 {q10-q11}, [r1, :128], r3 -+ sao_band_64 -+ vst1.8 {q8-q9}, [r0, :128], r2 -+ vst1.8 {q10-q11}, [r0, :128], r2 - bne 1b - - bx lr -@@ -89,13 +118,12 @@ function ff_hevc_sao_band_w64_neon_8, export=1 - init_sao_band - 1: subs r12, #1 - pld [r1, r3] -- vld1.8 {q2-q3}, [r1, :128]! -- sao_band_32 -- vst1.8 {q2-q3}, [r0, :128]! -- vld1.8 {q2-q3}, [r1, :128], r3 -+ vld1.8 {q8-q9}, [r1, :128]! -+ vld1.8 {q10-q11}, [r1, :128], r3 - sub r1, #32 -- sao_band_32 -- vst1.8 {q2-q3}, [r0, :128], r2 -+ sao_band_64 -+ vst1.8 {q8-q9}, [r0, :128]! -+ vst1.8 {q10-q11}, [r0, :128], r2 - sub r0, #32 - bne 1b - -@@ -121,7 +149,6 @@ endfunc - vcgt.u8 q1, q5, q9 - vcgt.u8 q15, q9, q5 - vsub.s8 q0, q14, q0 // diff1 -- - vsub.s8 q1, q15, q1 - - vadd.s8 q0, q12 //diff0 + diff1 -@@ -157,27 +184,25 @@ endfunc - - vmov.u8 q15, #128 // s8 #-128 - vtbl.8 d0, {d24}, d0 -+ vadd.s8 q13, q4, q15 - vtbl.8 d1, {d24}, d1 -+ vadd.s8 q14, q5, q15 - vtbl.8 d2, {d24}, d2 -+ vqadd.s8 q0, q13 - vtbl.8 d3, {d24}, d3 -+ vqadd.s8 q1, q14 - vtbl.8 d4, {d24}, d4 -+ vadd.s8 q13, q6, q15 - vtbl.8 d5, {d24}, d5 -+ vadd.s8 q14, q7, q15 - vtbl.8 d6, {d24}, d6 -+ vqadd.s8 q2, q13 - vtbl.8 d7, {d24}, d7 -- -- vadd.s8 q12, q4, q15 -- vadd.s8 q13, q5, q15 -- vadd.s8 q14, q6, q15 -- vadd.s8 q15, q7, q15 -- vqadd.s8 q12, q0 -- vqadd.s8 q15, q3 -- vmov.u8 q3, #128 // s8 #-128 -- vqadd.s8 q13, q1 -- vqadd.s8 q14, q2 -- vsub.s8 q0, q12, q3 -- vsub.s8 q1, q13, q3 -- vsub.s8 q2, q14, q3 -- vsub.s8 q3, q15, q3 -+ vqadd.s8 q3, q14 -+ vsub.s8 q0, q15 -+ vsub.s8 q1, q15 -+ vsub.s8 q2, q15 -+ vsub.s8 q3, q15 - vst1.8 {q0-q1}, [r0, :128]! - vst1.8 {q2-q3}, [r0, :128], r2 - sub r0, #32 -@@ -342,13 +367,12 @@ endfunc - - vmov.u8 q10, #128 - vtbl.8 d0, {d31}, d0 -+ vadd.s8 q11, q2, q10 - vtbl.8 d1, {d31}, d1 -+ vadd.s8 q12, q3, q10 - vtbl.8 d2, {d31}, d2 -+ vqadd.s8 q11, q0 - vtbl.8 d3, {d31}, d3 -- -- vadd.s8 q11, q2, q10 -- vadd.s8 q12, q3, q10 -- vqadd.s8 q11, q0 - vqadd.s8 q12, q1 - vsub.s8 q0, q11, q10 - vsub.s8 q1, q12, q10 --- -2.5.0 - - -From 026bac1824e4936e948e6b1efec82868c520ea66 Mon Sep 17 00:00:00 2001 -From: Seppo Tomperi -Date: Mon, 2 Feb 2015 16:08:27 +0200 -Subject: [PATCH 9/9] Further SAO NEON optimisations - ---- - libavcodec/arm/hevcdsp_init_neon.c | 16 +-- - libavcodec/arm/hevcdsp_sao_neon.S | 224 +++++++++++++++++++------------------ - 2 files changed, 124 insertions(+), 116 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index 6d0689c..e5da7e9 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, - void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, - ptrdiff_t stride); - --void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); --void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); --void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); --void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -+void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -+void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -+void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); - - void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); - void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -@@ -189,16 +189,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ - - switch(cwidth){ - case 8: -- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ ff_hevc_sao_band_w8_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); - break; - case 16: -- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ ff_hevc_sao_band_w16_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); - break; - case 32: -- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ ff_hevc_sao_band_w32_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); - break; - case 64: -- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ ff_hevc_sao_band_w64_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); - break; - default: - for (y = 0; y < height; y++) { -diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -index 08f50b8..9c7808d 100644 ---- a/libavcodec/arm/hevcdsp_sao_neon.S -+++ b/libavcodec/arm/hevcdsp_sao_neon.S -@@ -22,21 +22,16 @@ - #include "neon.S" - - .macro init_sao_band -- ldr r12, [sp, #0] // offset_table address - pld [r1] -- vld1.8 {q0, q1}, [r12] // offset table -- ldr r12, [sp, #4] // height -+ vld1.8 {q0, q1}, [r2] // offset table -+ ldr r2, [sp, #0] // stride_dst -+ ldr r12, [sp, #4] // height - vmov.u8 q3, #128 - .endm - - // 128 in q3 - // input q8 - q11 --// 32 cycles - .macro sao_band_64 -- vshr.u8 q12, q8, #3 -- vshr.u8 q13, q9, #3 -- vshr.u8 q14, q10, #3 -- vshr.u8 q15, q11, #3 - vtbl.8 d24, {d0, d1, d2, d3}, d24 - vadd.s8 q8, q3 - vtbl.8 d25, {d0, d1, d2, d3}, d25 -@@ -52,8 +47,8 @@ - vtbl.8 d30, {d0, d1, d2, d3}, d30 - vqadd.s8 q10, q14 - vtbl.8 d31, {d0, d1, d2, d3}, d31 -- vqadd.s8 q11, q15 - vsub.s8 q8, q3 -+ vqadd.s8 q11, q15 - vsub.s8 q9, q3 - vsub.s8 q10, q3 - vsub.s8 q11, q3 -@@ -64,12 +59,16 @@ function ff_hevc_sao_band_w8_neon_8, export=1 - 1: subs r12, #8 - vld1.8 {d16}, [r1, :64], r3 - vld1.8 {d17}, [r1, :64], r3 -+ vshr.u8 q12, q8, #3 - vld1.8 {d18}, [r1, :64], r3 - vld1.8 {d19}, [r1, :64], r3 -+ vshr.u8 q13, q9, #3 - vld1.8 {d20}, [r1, :64], r3 - vld1.8 {d21}, [r1, :64], r3 -+ vshr.u8 q14, q10, #3 - vld1.8 {d22}, [r1, :64], r3 - vld1.8 {d23}, [r1, :64], r3 -+ vshr.u8 q15, q11, #3 - sao_band_64 - vst1.8 {d16}, [r0, :64], r2 - vst1.8 {d17}, [r0, :64], r2 -@@ -88,9 +87,13 @@ function ff_hevc_sao_band_w16_neon_8, export=1 - init_sao_band - 1: subs r12, #4 - vld1.8 {q8}, [r1, :128], r3 -+ vshr.u8 q12, q8, #3 - vld1.8 {q9}, [r1, :128], r3 -+ vshr.u8 q13, q9, #3 - vld1.8 {q10}, [r1, :128], r3 -+ vshr.u8 q14, q10, #3 - vld1.8 {q11}, [r1, :128], r3 -+ vshr.u8 q15, q11, #3 - sao_band_64 - vst1.8 {q8}, [r0, :128], r2 - vst1.8 {q9}, [r0, :128], r2 -@@ -105,7 +108,11 @@ function ff_hevc_sao_band_w32_neon_8, export=1 - init_sao_band - 1: subs r12, #2 - vld1.8 {q8-q9}, [r1, :128], r3 -+ vshr.u8 q12, q8, #3 -+ vshr.u8 q13, q9, #3 - vld1.8 {q10-q11}, [r1, :128], r3 -+ vshr.u8 q14, q10, #3 -+ vshr.u8 q15, q11, #3 - sao_band_64 - vst1.8 {q8-q9}, [r0, :128], r2 - vst1.8 {q10-q11}, [r0, :128], r2 -@@ -119,7 +126,11 @@ function ff_hevc_sao_band_w64_neon_8, export=1 - 1: subs r12, #1 - pld [r1, r3] - vld1.8 {q8-q9}, [r1, :128]! -+ vshr.u8 q12, q8, #3 -+ vshr.u8 q13, q9, #3 - vld1.8 {q10-q11}, [r1, :128], r3 -+ vshr.u8 q14, q10, #3 -+ vshr.u8 q15, q11, #3 - sub r1, #32 - sao_band_64 - vst1.8 {q8-q9}, [r0, :128]! -@@ -129,51 +140,18 @@ function ff_hevc_sao_band_w64_neon_8, export=1 - - bx lr - endfunc --// input --// a in q0 - q3 --// c in q4 - q7 --// b in q8 - q11 --// offset table in r7 and r5 --// output in q0 - q3 --// clobbers q12 - q15 --.macro edge_w64_body -- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -- vcgt.u8 q13, q5, q1 -- vcgt.u8 q1, q1, q5 -- vsub.s8 q12, q0, q12 // diff0 -- vcgt.u8 q0, q4, q8 // c > b -- vsub.s8 q13, q1, q13 -- -- vcgt.u8 q14, q8, q4 // b > c -- vcgt.u8 q1, q5, q9 -- vcgt.u8 q15, q9, q5 -- vsub.s8 q0, q14, q0 // diff1 -- vsub.s8 q1, q15, q1 - -- vadd.s8 q0, q12 //diff0 + diff1 -- vadd.s8 q1, q13 -- -- vcgt.u8 q14, q6, q2 -- vcgt.u8 q2, q2, q6 -- vcgt.u8 q15, q7, q3 -- vcgt.u8 q3, q3, q7 -- -- vsub.s8 q14, q2, q14 -- vcgt.u8 q2, q6, q10 -- vsub.s8 q15, q3, q15 -- -- vcgt.u8 q12, q10, q6 -- vcgt.u8 q3, q7, q11 -- vcgt.u8 q13, q11, q7 -- vsub.s8 q2, q12, q2 -- vsub.s8 q3, q13, q3 -+.macro diff32 out0, out1, tmp0, tmp1, in0, in1, in2, in3 -+ vcgt.u8 \out0, \in2, \in0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 \tmp0, \in0, \in2 // a > c -> -1 , otherwise 0 -+ vcgt.u8 \out1, \in3, \in1 // c > a -> -1 , otherwise 0 part 2 -+ vcgt.u8 \tmp1, \in1, \in3 // a > c -> -1 , otherwise 0 part 2 -+ vsub.s8 \out0, \tmp0, \out0 // diff0 -+ vsub.s8 \out1, \tmp1, \out1 // diff0 part 2 -+.endm - -+.macro table64 - vmov.s8 q13, #2 // 2 to all elements -- -- vadd.s8 q2, q14 -- vadd.s8 q3, q15 -- - vmov.32 d24[0], r4 // load offset table from general registers - vmov.32 d24[1], r5 // load rest of offset table - -@@ -208,6 +186,28 @@ endfunc - sub r0, #32 - .endm - -+// input -+// a in q0 - q3 -+// c in q4 - q7 -+// b in q8 - q11 -+// offset table in r7 and r5 -+// output in q0 - q3 -+// clobbers q12 - q15 -+.macro edge_w64_body -+ diff32 q12, q13, q0, q1, q0, q1, q4, q5 -+ diff32 q0, q1, q14, q15, q8, q9, q4, q5 -+ -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ -+ diff32 q14, q15, q2, q3, q2, q3, q6, q7 -+ diff32 q2, q3, q12, q13, q10, q11, q6, q7 -+ -+ vadd.s8 q2, q14 -+ vadd.s8 q3, q15 -+ table64 -+.endm -+ - .macro init_edge_64 - push {r4-r5} - ldr r12, [sp, #8] // height -@@ -334,38 +334,23 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 - bx lr - endfunc - --// inputs: --// a in q0, q1 --// c in q2, q3 --// b in q8, q9 --// offset table in d31 --// clobbered registers q0, q1, q10, q11, q12, q13 --// output q0, q1 --.macro edge_w32_body -- vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 -- vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 -- vcgt.u8 q13, q3, q1 -- vcgt.u8 q1, q1, q3 -- -- vsub.s8 q12, q0, q12 // diff0 -- vcgt.u8 q0, q2, q8 // c > b -- vsub.s8 q13, q1, q13 // diff0 part 2 -- -- vcgt.u8 q10, q8, q2 // b > c -- vcgt.u8 q1, q3, q9 -- vcgt.u8 q11, q9, q3 -- -- vsub.s8 q0, q10, q0 // diff1 -- -- vmov.s8 q10, #2 // 2 to all elements -- vsub.s8 q1, q11, q1 // diff1 part 2 -- vadd.s8 q0, q12 //diff0 + diff1 -- vadd.s8 q1, q13 -+.macro init_edge_32 -+ ldr r12, [sp, #4] // sao_offset_val_table -+ vld1.32 {d31}, [r12] -+ ldr r12, [sp] // height -+.endm - -- vadd.s8 q0, q10 -- vadd.s8 q1, q10 -+.macro diff out0, tmp0, in0, in1 -+ vcgt.u8 \out0, \in1, \in0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 \tmp0, \in0, \in1 // a > c -> -1 , otherwise 0 -+ vsub.s8 \out0, \tmp0, \out0 // diff0 -+.endm - -- vmov.u8 q10, #128 -+.macro table32 -+ vmov.s8 q10, #2 -+ vadd.s8 q0, q10 -+ vadd.s8 q1, q10 -+ vmov.s8 q10, #128 - vtbl.8 d0, {d31}, d0 - vadd.s8 q11, q2, q10 - vtbl.8 d1, {d31}, d1 -@@ -373,56 +358,68 @@ endfunc - vtbl.8 d2, {d31}, d2 - vqadd.s8 q11, q0 - vtbl.8 d3, {d31}, d3 -- vqadd.s8 q12, q1 -- vsub.s8 q0, q11, q10 -- vsub.s8 q1, q12, q10 -+ vqadd.s8 q12, q1 -+ vsub.s8 q0, q11, q10 -+ vsub.s8 q1, q12, q10 - vst1.8 {q0-q1}, [r0, :128], r2 - .endm - --.macro init_edge_32 -- ldr r12, [sp, #4] // sao_offset_val_table -- vld1.32 {d31}, [r12] -- ldr r12, [sp] // height --.endm -- - function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 - init_edge_32 -- sub r1, #4 // load 4 extra bytes -+ vpush {q4-q7} -+ sub r1, #4 - 1: subs r12, #1 -- vld1.32 d3[1], [r1]! -- vld1.8 {q2-q3}, [r1, :128]! // c -- vld1.32 d20[0], [r1], r3 -- sub r1, #36 -+ vld1.8 {q13-q14}, [r1]! -+ vld1.32 d30, [r1], r3 -+ sub r1, #32 - // a -- vext.8 q0, q1, q2, #15 -- vext.8 q1, q2, q3, #15 -- // b -- vext.8 q8, q2, q3, #1 -- vext.8 q9, q3, q10, #1 -- edge_w32_body -+ vext.8 q0, q13, q14, #3 -+ vext.8 q1, q14, q15, #3 -+ vshr.u64 d24, d30, #24 -+ // c -+ vext.8 q2, q13, q14, #4 -+ vext.8 q3, q14, q15, #4 -+ vshr.u64 d16, d30, #32 -+ // diff0 -+ diff32 q13, q14, q4, q5, q0, q1, q2, q3 -+ diff d18, d25, d24, d16 -+ // -diff1 -+ vext.s8 q0, q13, q14, #1 -+ vext.s8 q1, q14, q9, #1 -+ -+ vsub.s8 q0, q13, q0 //diff0 + diff1 -+ vsub.s8 q1, q14, q1 -+ table32 - bne 1b -+ vpop {q4-q7} -+ - bx lr - endfunc - - function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 - init_edge_32 -+ vpush {q4-q7} - // load a - sub r1, r3 - vld1.8 {q0-q1}, [r1, :128], r3 - // load c - vld1.8 {q2-q3}, [r1, :128], r3 -+ diff32 q12, q13, q0, q1, q0, q1, q2, q3 // CMP ( c, a ) - 1: subs r12, #1 - // load b - vld1.8 {q8-q9}, [r1, :128], r3 -- edge_w32_body -- // inputs for next loop iteration -- // a -- vmov.64 q0, q2 -- vmov.64 q1, q3 -+ diff32 q4, q5, q10, q11, q8, q9, q2, q3 // CMP ( c, b ) -+ vadd.s8 q0, q4, q12 //diff0 + diff1 -+ vadd.s8 q1, q5, q13 -+ table32 -+ // CMP ( c, a ) -+ vneg.s8 q12, q4 -+ vneg.s8 q13, q5 - // c - vmov.64 q2, q8 - vmov.64 q3, q9 - bne 1b -+ vpop {q4-q7} - bx lr - endfunc - -@@ -452,7 +449,11 @@ function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 - vext.8 q6, q10, q11, #8 - vext.8 q7, q11, q12, #8 - vext.8 q5, q10, q11, #7 -- edge_w32_body -+ diff32 q12, q13, q0, q1, q0, q1, q2, q3 -+ diff32 q0, q1, q10, q11, q8, q9, q2, q3 -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ table32 - // inputs for next loop iteration - // a - vmov.8 q0, q4 -@@ -487,7 +488,14 @@ function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 - vext.8 q8, q10, q11, #7 - vext.8 q9, q11, q12, #7 - vext.8 q14, q12, q10, #7 -- edge_w32_body -+ -+ diff32 q12, q13, q0, q1, q0, q1, q2, q3 -+ diff32 q0, q1, q10, q11, q8, q9, q2, q3 -+ -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ table32 -+ - // inputs for next loop iteration - // a - vext.8 q0, q2, q3, #1 --- -2.5.0 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch deleted file mode 100644 index 3634d4316f..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch +++ /dev/null @@ -1,38137 +0,0 @@ -From b9b5434c61afd492a54dad5158b4d56ecbf7f01d Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 28 Apr 2015 16:18:40 +0100 -Subject: [PATCH 01/68] Added display output - ---- - ffmpeg.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 159 insertions(+) - -diff --git a/ffmpeg.c b/ffmpeg.c -index 9ffd833..50c6e86 100644 ---- a/ffmpeg.c -+++ b/ffmpeg.c -@@ -23,6 +23,11 @@ - * multimedia converter based on the FFmpeg libraries - */ - -+#ifdef RPI -+#define RPI_DISPLAY -+//#define RPI_ZERO_COPY -+#endif -+ - #include "config.h" - #include - #include -@@ -66,6 +71,20 @@ - # include "libavfilter/buffersrc.h" - # include "libavfilter/buffersink.h" - -+#ifdef RPI_DISPLAY -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#ifdef RPI_ZERO_COPY -+#include "libavcodec/rpi_qpu.h" -+#endif -+#endif -+ - #if HAVE_SYS_RESOURCE_H - #include - #include -@@ -158,6 +177,134 @@ static int restore_tty; - static void free_input_threads(void); - #endif - -+#ifdef RPI_DISPLAY -+ -+#define NUM_BUFFERS 4 -+ -+static MMAL_COMPONENT_T* rpi_display = NULL; -+static MMAL_POOL_T *rpi_pool = NULL; -+ -+#ifdef RPI_ZERO_COPY -+static uint8_t *get_vc_handle(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ return (uint8_t *)p->vc_handle; -+} -+#endif -+ -+static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+{ -+ MMAL_POOL_T* pool; -+ size_t i; -+ size_t size = (w*h*3)/2; -+#ifdef RPI_ZERO_COPY -+ mmal_port_parameter_set_boolean(port, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); // Does this mark that the buffer contains a vc_handle? Would have expected a vc_image? -+ pool = mmal_port_pool_create(port, NUM_BUFFERS, 0); -+ assert(pool); -+#else -+ pool = mmal_port_pool_create(port, NUM_BUFFERS, size); -+ -+ for (i = 0; i < NUM_BUFFERS; ++i) -+ { -+ MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; -+ void* bufPtr = buffer->data; -+ memset(bufPtr, i*30, w*h); -+ memset(bufPtr+w*h, 128, (w*h)/2); -+ } -+#endif -+ -+ return pool; -+} -+ -+static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -+ mmal_buffer_header_release(buffer); -+} -+ -+static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+{ -+ MMAL_COMPONENT_T* display; -+ int w2 = (w+31)&~31; -+ int h2 = (h+15)&~15; -+ MMAL_DISPLAYREGION_T region = -+ { -+ {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, -+ .layer = 2, -+ .fullscreen = 0, -+ .dest_rect = {x, y, w, h} -+ }; -+ bcm_host_init(); // TODO is this needed? -+ mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); -+ assert(display); -+ -+ mmal_port_parameter_set(display->input[0], ®ion.hdr); -+ -+ MMAL_ES_FORMAT_T* format = display->input[0]->format; -+ format->encoding = MMAL_ENCODING_I420; -+ format->es->video.width = w2; -+ format->es->video.height = h2; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = w; -+ format->es->video.crop.height = h; -+ mmal_port_format_commit(display->input[0]); -+ -+ mmal_component_enable(display); -+ -+ rpi_pool = display_alloc_pool(display->input[0], w2, h2); -+ -+ mmal_port_enable(display->input[0],display_cb_input); -+ mmal_port_enable(display->control,display_cb_input); -+ -+ printf("Allocated display %d %d\n",w,h); -+ -+ return display; -+} -+ -+static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) -+{ -+ int w = fr->width; -+ int h = fr->height; -+ int w2 = (w+31)&~31; -+ int h2 = (h+15)&~15; -+ if (!display || !rpi_pool) -+ return; -+ MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); -+ if (!buf) { -+ // Running too fast so drop the frame -+ return; -+ } -+ assert(buf); -+ buf->cmd = 0; -+ buf->length = (w2 * h2 * 3)/2; -+ buf->offset = 0; // Offset to valid data -+ buf->flags = 0; -+#ifdef RPI_ZERO_COPY -+ buf->data = get_vc_handle(fr->buf[0]); -+ buf->alloc_size = (w2*h2*3)/2; -+#else -+ //mmal_buffer_header_mem_lock(buf); -+ memcpy(buf->data, fr->data[0], w2 * h); -+ memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); -+ memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); -+ //mmal_buffer_header_mem_unlock(buf); -+#endif -+ -+ mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released -+} -+ -+static void display_exit(MMAL_COMPONENT_T* display) -+{ -+ if (display) { -+ mmal_component_destroy(display); -+ } -+ if (rpi_pool) { -+ mmal_port_pool_destroy(display->input[0], rpi_pool); -+ } -+} -+ -+#endif -+ -+ - /* sub2video hack: - Convert subtitles to video with alpha to insert them in filter graphs. - This is a temporary solution until libavfilter gets real subtitles support. -@@ -581,6 +728,10 @@ static void ffmpeg_cleanup(int ret) - } - term_exit(); - ffmpeg_exited = 1; -+ -+#ifdef RPI_DISPLAY -+ display_exit(rpi_display); -+#endif - } - - void remove_avoptions(AVDictionary **a, AVDictionary *b) -@@ -940,6 +1091,14 @@ static void do_video_out(AVFormatContext *s, - int frame_size = 0; - InputStream *ist = NULL; - AVFilterContext *filter = ost->filter->filter; -+#ifdef RPI_DISPLAY -+ if (next_picture) -+ { -+ if (!rpi_display) -+ rpi_display = display_init(0,0,next_picture->width,next_picture->height); -+ display_frame(rpi_display,next_picture); -+ } -+#endif - - if (ost->source_index >= 0) - ist = input_streams[ost->source_index]; --- -2.7.4 - - -From b90a5aff7bf9112ebd2a07949c8d79a49fcafe48 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 29 Apr 2015 16:49:43 +0100 -Subject: [PATCH 02/68] Split transform and intra prediction into commands - ---- - libavcodec/hevc.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++- - libavcodec/hevc.h | 58 +++++++++++++++++++++++ - libavcodec/hevc_cabac.c | 15 ++++++ - 3 files changed, 191 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index b478065..aa45dd6 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -931,6 +931,25 @@ static int hls_cross_component_pred(HEVCContext *s, int idx) { - return 0; - } - -+#ifdef RPI -+static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, int c_idx) -+{ -+ if (s->enable_rpi) { -+ HEVCLocalContext *lc = s->HEVClc; -+ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+ cmd->type = RPI_PRED_INTRA; -+ cmd->size = log2_trafo_size; -+ cmd->c_idx = c_idx; -+ cmd->x = x0; -+ cmd->y = y0; -+ cmd->na = (lc->na.cand_bottom_left<<4) + (lc->na.cand_left<<3) + (lc->na.cand_up_left<<2) + (lc->na.cand_up<<1) + lc->na.cand_up_right; -+ cmd->mode = c_idx ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; -+ } else { -+ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, c_idx); -+ } -+} -+#endif -+ - static int hls_transform_unit(HEVCContext *s, int x0, int y0, - int xBase, int yBase, int cb_xBase, int cb_yBase, - int log2_cb_size, int log2_trafo_size, -@@ -943,8 +962,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - if (lc->cu.pred_mode == MODE_INTRA) { - int trafo_size = 1 << log2_trafo_size; - ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size); -- -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size, x0, y0, 0); -+#else - s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0); -+#endif - } - - if (cbf_luma || cbf_cb[0] || cbf_cr[0] || -@@ -1030,7 +1052,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { - if (lc->cu.pred_mode == MODE_INTRA) { - ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 1); -+#else - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 1); -+#endif - } - if (cbf_cb[i]) - ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), -@@ -1059,7 +1085,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { - if (lc->cu.pred_mode == MODE_INTRA) { - ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 2); -+#else - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 2); -+#endif - } - if (cbf_cr[i]) - ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), -@@ -1088,7 +1118,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - if (lc->cu.pred_mode == MODE_INTRA) { - ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), - trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 1); -+#else - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 1); -+#endif - } - if (cbf_cb[i]) - ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), -@@ -1098,7 +1132,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - if (lc->cu.pred_mode == MODE_INTRA) { - ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), - trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 2); -+#else - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 2); -+#endif - } - if (cbf_cr[i]) - ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), -@@ -1110,26 +1148,46 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - int trafo_size_h = 1 << (log2_trafo_size_c + s->ps.sps->hshift[1]); - int trafo_size_v = 1 << (log2_trafo_size_c + s->ps.sps->vshift[1]); - ff_hevc_set_neighbour_available(s, x0, y0, trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 1); -+ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 2); -+#else - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 1); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 2); -+#endif - if (s->ps.sps->chroma_format_idc == 2) { - ff_hevc_set_neighbour_available(s, x0, y0 + (1 << log2_trafo_size_c), - trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 1); -+ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 2); -+#else - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 1); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 2); -+#endif - } - } else if (blk_idx == 3) { - int trafo_size_h = 1 << (log2_trafo_size + 1); - int trafo_size_v = 1 << (log2_trafo_size + s->ps.sps->vshift[1]); - ff_hevc_set_neighbour_available(s, xBase, yBase, - trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 1); -+ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 2); -+#else - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2); -+#endif - if (s->ps.sps->chroma_format_idc == 2) { - ff_hevc_set_neighbour_available(s, xBase, yBase + (1 << (log2_trafo_size)), - trafo_size_h, trafo_size_v); -+#ifdef RPI -+ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 1); -+ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 2); -+#else - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 1); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 2); -+#endif - } - } - } -@@ -2304,6 +2362,31 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, - lc->ctb_up_left_flag = ((x_ctb > 0) && (y_ctb > 0) && (ctb_addr_in_slice-1 >= s->ps.sps->ctb_width) && (s->ps.pps->tile_id[ctb_addr_ts] == s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1 - s->ps.sps->ctb_width]])); - } - -+#ifdef RPI -+static void rpi_execute_pred_cmds(HEVCContext *s) -+{ -+ int i; -+ HEVCPredCmd *cmd = s->univ_pred_cmds; -+ HEVCLocalContext *lc = s->HEVClc; -+ -+ for(i = s->num_pred_cmds; i > 0; i--, cmd++) { -+ if (cmd->type == RPI_PRED_INTRA) { -+ lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; -+ lc->na.cand_bottom_left = (cmd->na >> 4) & 1; -+ lc->na.cand_left = (cmd->na >> 3) & 1; -+ lc->na.cand_up_left = (cmd->na >> 2) & 1; -+ lc->na.cand_up = (cmd->na >> 1) & 1; -+ lc->na.cand_up_right = (cmd->na >> 0) & 1; -+ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -+ } else { -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -+ } -+ } -+ s->num_pred_cmds = 0; -+ s->num_coeffs = 0; -+} -+#endif -+ - static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - { - HEVCContext *s = avctxt->priv_data; -@@ -2313,6 +2396,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - int y_ctb = 0; - int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; - -+#ifdef RPI -+ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -+#endif -+ - if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { - av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); - return AVERROR_INVALIDDATA; -@@ -2342,6 +2429,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+#ifdef RPI -+ rpi_execute_pred_cmds(s); -+#endif - if (more_data < 0) { - s->tab_slice_address[ctb_addr_rs] = -1; - return more_data; -@@ -2387,6 +2477,10 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int - s = s1->sList[self_id]; - lc = s->HEVClc; - -+#ifdef RPI -+ s->enable_rpi = 0; -+#endif -+ - if(ctb_row) { - ret = init_get_bits8(&lc->gb, s->data + s->sh.offset[ctb_row - 1], s->sh.size[ctb_row - 1]); - -@@ -3075,6 +3169,13 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - - av_freep(&s->cabac_state); - -+#ifdef RPI -+ av_freep(&s->unif_mv_cmds); -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+ av_freep(&s->coeffs_buf); -+#endif -+ - for (i = 0; i < 3; i++) { - av_freep(&s->sao_pixel_buffer_h[i]); - av_freep(&s->sao_pixel_buffer_v[i]); -@@ -3129,6 +3230,22 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - s->HEVClcList[0] = s->HEVClc; - s->sList[0] = s; - -+#ifdef RPI -+ s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -+ if (!s->unif_mv_cmds) -+ goto fail; -+ s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); -+ if (!s->unif_xfm_cmds) -+ goto fail; -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+ s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); -+ if (!s->coeffs_buf) -+ goto fail; -+ s->enable_rpi = 0; -+#endif -+ - s->cabac_state = av_malloc(HEVC_CONTEXTS); - if (!s->cabac_state) - goto fail; -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index be91010..7a1c35f 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -23,6 +23,9 @@ - #ifndef AVCODEC_HEVC_H - #define AVCODEC_HEVC_H - -+// define RPI to split the CABAC/prediction/transform into separate stages -+#include "config.h" -+ - #include "libavutil/buffer.h" - #include "libavutil/md5.h" - -@@ -790,6 +793,49 @@ typedef struct HEVCLocalContext { - int boundary_flags; - } HEVCLocalContext; - -+#ifdef RPI -+ -+// RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+#define RPI_MAX_WIDTH 2048 -+ -+// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane -+#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+// Each block can have an intra prediction and a transform_add command -+#define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ -+// Command for inter prediction -+typedef struct HEVCMvCmd { -+} HEVCMvCmd; -+ -+// Command for transform to process a block of coefficients -+typedef struct HEVCXfmCmd { -+} HEVCXfmCmd; -+ -+// Command for intra prediction and transform_add of predictions to coefficients -+#define RPI_PRED_TRANSFORM_ADD 0 -+#define RPI_PRED_INTRA 1 -+typedef struct HEVCPredCmd { -+ uint8_t size; -+ uint8_t type; -+ uint8_t na; -+ uint8_t c_idx; -+ union { -+ uint8_t *dst; // RPI_PRED_TRANSFORM_ADD -+ uint32_t x; // RPI_PRED_INTRA -+ }; -+ union { -+ int16_t *buf; // RPI_PRED_TRANSFORM_ADD -+ uint32_t y; // RPI_PRED_INTRA -+ }; -+ union { -+ enum IntraPredMode mode; // RPI_PRED_TRANSFORM_ADD -+ uint32_t stride; // RPI_PRED_INTRA -+ }; -+} HEVCPredCmd; -+ -+#endif -+ - typedef struct HEVCContext { - const AVClass *c; // needed by private avoptions - AVCodecContext *avctx; -@@ -805,6 +851,18 @@ typedef struct HEVCContext { - int width; - int height; - -+#ifdef RPI -+ int enable_rpi; -+ HEVCMvCmd *unif_mv_cmds; -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+ int16_t *coeffs_buf; -+ int num_mv_cmds; -+ int num_xfm_cmds; -+ int num_pred_cmds; -+ int num_coeffs; -+#endif -+ - uint8_t *cabac_state; - - /** 1 if the independent slice segment header was successfully parsed */ -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 05b2821..4e97f06 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1510,6 +1510,21 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); - } - } -+#ifdef RPI -+ if (s->enable_rpi) { -+ int16_t *c = s->coeffs_buf + s->num_coeffs; -+ int n = trafo_size * trafo_size; -+ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+ memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy -+ s->num_coeffs += n; -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+ cmd->buf = c; -+ cmd->dst = dst; -+ cmd->stride = stride; -+ return; -+ } -+#endif - s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); - } - --- -2.7.4 - - -From f8293de11dc040d9fa2a558762a357c0c353d2c9 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 30 Apr 2015 15:23:22 +0100 -Subject: [PATCH 03/68] Added simple VPU test code - ---- - libavcodec/Makefile | 7 + - libavcodec/hevc.c | 33 +- - libavcodec/rpi_hevc_transform.h | 212 ++++++ - libavcodec/rpi_hevc_transform.s | 147 ++++ - libavcodec/rpi_mailbox.c | 293 ++++++++ - libavcodec/rpi_mailbox.h | 20 + - libavcodec/rpi_qpu.c | 652 ++++++++++++++++++ - libavcodec/rpi_qpu.h | 45 ++ - libavcodec/rpi_shader.c | 818 ++++++++++++++++++++++ - libavcodec/rpi_shader.h | 20 + - libavcodec/rpi_shader.qasm | 1413 +++++++++++++++++++++++++++++++++++++++ - libavcodec/rpi_user_vcsm.h | 425 ++++++++++++ - 12 files changed, 4084 insertions(+), 1 deletion(-) - create mode 100644 libavcodec/rpi_hevc_transform.h - create mode 100644 libavcodec/rpi_hevc_transform.s - create mode 100644 libavcodec/rpi_mailbox.c - create mode 100644 libavcodec/rpi_mailbox.h - create mode 100644 libavcodec/rpi_qpu.c - create mode 100644 libavcodec/rpi_qpu.h - create mode 100644 libavcodec/rpi_shader.c - create mode 100644 libavcodec/rpi_shader.h - create mode 100644 libavcodec/rpi_shader.qasm - create mode 100644 libavcodec/rpi_user_vcsm.h - -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index fd0d1f0..03065cd 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -5,6 +5,10 @@ NAME = avcodec - HEADERS = avcodec.h \ - avdct.h \ - avfft.h \ -+ rpi_qpu.h \ -+ rpi_shader.h \ -+ rpi_mailbox.h \ -+ rpi_hevc_transform.h \ - d3d11va.h \ - dirac.h \ - dv_profile.h \ -@@ -43,6 +47,9 @@ OBJS = allcodecs.o \ - resample.o \ - resample2.o \ - utils.o \ -+ rpi_qpu.o \ -+ rpi_shader.o \ -+ rpi_mailbox.o \ - vorbis_parser.o \ - xiph.o \ - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index aa45dd6..ab55df1 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -41,6 +41,10 @@ - #include "hevc.h" - #include "profiles.h" - -+#ifdef RPI -+#include "rpi_qpu.h" -+#endif -+ - const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; - - /** -@@ -2430,7 +2434,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); - #ifdef RPI -- rpi_execute_pred_cmds(s); -+ if (x_ctb + ctb_size >= s->ps.sps->width) { -+ rpi_execute_pred_cmds(s); -+ } - #endif - if (more_data < 0) { - s->tab_slice_address[ctb_addr_rs] = -1; -@@ -3244,6 +3250,31 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - if (!s->coeffs_buf) - goto fail; - s->enable_rpi = 0; -+ -+ // A little test program -+ { -+ GPU_MEM_PTR_T p; -+ int err = gpu_malloc_cached(16, &p); -+ short *q = (short *)p.arm; -+ int i; -+ int r; -+ printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); -+ printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); -+ printf("Preparing data %p\n",q); -+ for(i=0;i<16;i++) -+ q[i] = i; -+ printf("Flush cache\n"); -+ gpu_cache_flush(&p); -+ printf("Executing code\n"); -+ r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); -+ printf("Return value %d (",r); -+ for(i=0;i<16;i++) -+ printf("%d ",q[i]); -+ printf(")\n"); -+ gpu_free(&p); -+ goto fail; // Early out -+ } -+ - #endif - - s->cabac_state = av_malloc(HEVC_CONTEXTS); -diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -new file mode 100644 -index 0000000..85a9102 ---- /dev/null -+++ b/libavcodec/rpi_hevc_transform.h -@@ -0,0 +1,212 @@ -+unsigned char rpi_hevc_transform [] = { -+169, -+3, -+3, -+232, -+128, -+0, -+0, -+0, -+20, -+248, -+0, -+136, -+0, -+0, -+192, -+248, -+0, -+0, -+0, -+96, -+3, -+232, -+32, -+0, -+0, -+0, -+7, -+232, -+0, -+2, -+0, -+0, -+8, -+232, -+0, -+4, -+0, -+0, -+12, -+248, -+0, -+128, -+0, -+0, -+192, -+8, -+4, -+0, -+4, -+232, -+64, -+0, -+0, -+0, -+5, -+232, -+0, -+0, -+8, -+0, -+128, -+69, -+113, -+66, -+12, -+248, -+0, -+128, -+0, -+0, -+192, -+8, -+4, -+0, -+128, -+69, -+113, -+70, -+128, -+144, -+39, -+0, -+4, -+255, -+48, -+192, -+128, -+3, -+32, -+8, -+16, -+0, -+76, -+254, -+48, -+192, -+9, -+4, -+32, -+8, -+0, -+0, -+4, -+254, -+0, -+144, -+128, -+2, -+0, -+248, -+62, -+0, -+128, -+144, -+22, -+0, -+4, -+255, -+48, -+192, -+128, -+3, -+32, -+8, -+16, -+0, -+76, -+254, -+48, -+192, -+9, -+4, -+32, -+8, -+0, -+0, -+140, -+248, -+44, -+0, -+0, -+0, -+32, -+48, -+4, -+0, -+128, -+69, -+113, -+66, -+242, -+140, -+211, -+192, -+41, -+3, -+68, -+192, -+80, -+7, -+164, -+255, -+36, -+220, -+96, -+2, -+0, -+248, -+62, -+0, -+3, -+255, -+55, -+208, -+120, -+3, -+224, -+3, -+190, -+11, -+16, -+139, -+246, -+83, -+0, -+103, -+90, -+0, -+8, -+240, -+0, -+128, -+128, -+3, -+0, -+247, -+32, -+128, -+10, -+4, -+136, -+240, -+32, -+0, -+128, -+3, -+112, -+96, -+90, -+0, -+}; -diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -new file mode 100644 -index 0000000..5e2728d ---- /dev/null -+++ b/libavcodec/rpi_hevc_transform.s -@@ -0,0 +1,147 @@ -+# ****************************************************************************** -+# Argon Design Ltd. -+# (c) Copyright 2015 Argon Design Ltd. All rights reserved. -+# -+# Module : HEVC -+# Author : Peter de Rivaz -+# ****************************************************************************** -+ -+# HEVC VPU Transform -+# -+# Transform matrix can be thought of as -+# output row vector = input row vector * transMatrix2 -+# -+# The even rows of the matrix are symmetric -+# The odd rows of the matrix are antisymmetric -+# -+# So only need to compute the first half of the results, then can compute the remainder with a butterfly -+# -+# EXAMPLE -+# (a b c d) (1 2 2 1) -+# (3 4 -4 -3) -+# (5 6 6 5) -+# (7 8 -8 -7) -+# -+# x=(a c)(1 2) = 1a+5c 2a+6c -+# (5 6) -+# -+# y=(b d)(3 4) = 3b+7d 4b+8d -+# (7 8) -+# -+# u=x+y = 1a+5c+3b+7d 2a+4b+6c+8d -+# v=x-y = 1a+5c-3b-7d 2a+6c-4b-8d -+# -+# Final results are (u , v[::-1]) -+# -+# -+# For 32x1 input, load even rows into HX(0++,0), odd rows into HX(16++,0) -+# Apply the even matrix first and stop before rounding -+# Then apply the odd matrix in a full manner: -+# -+# First step is to compute partial products with the first input (16 cycles) -+# 1a 3b 5c 7d 16x1 input coefficients produce 16x16 output -+# 2a 4b 6c 8d -+# 2a -4b 6c -8d -+# 1a -3b 5c -7d -+# -+# Second step is to sum partial products into final position (8 cycles) -+# 1a+3b+5c+7d -+# 2a+4b+6c+8d -+# 2a-4b+6c-8d -+# 1a-3b+5c-7d -+# -+# Then can apply butterfly to combine even results and odd results + rounding to produce 16 rows of output at a time (need to save in transposed format) -+# -+# For 16x16 no butterfly is required and can store final results in original location (Could do 2 16x16s in parallel to make use of the trick - saves on the adds) -+# -+# For 8x8 we could compute two in parallel. -+# -+# -+ -+test_add: -+ vldh HX(0,0),(r0) -+ vadd HX(0,0),HX(0,0),10 -+ vsth HX(0,0),(r0) -+ mov r0,7 # return value -+ b lr -+ -+# Columns are transformed first -+# -+# Store top left half of transMatrix2 in -+# Store bottom left half of transMatrix2 in HX(32,32) -+# -+# For 16x16 -+# HX(0:15,0) contains input data before transform -+# HY(0:15,0) contains 32bit output data after transform -+# HX(32,0) contains even rows of left half of transMatrix2 -+# HX(32,32) contains odd rows of left half of transMatrix2 -+# HY(48,0) contains partial products ready for summing -+# -+ -+ -+# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) -+# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -+# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+# num: number of 16x16 transforms to be done -+# -+hevc_trans_16x16: -+ push r6-r15, lr # TODO cut down number of used registers -+ -+ mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes -+ vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -+ # Now use r0 to describe which matrix we are working on. -+ # Allows us to prefetch the next block of coefficients for efficiency. -+ mov r0,0 # This describes the location where we read our coefficients from -+ mov r3,16*2 # Stride of coefficients in bytes -+ mov r7,16*16*2 # Total block size -+ mov r8,64*16 # Value used to swap from current to next VRF location -+ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -+ mov r4,64 # Constant used for rounding first pass -+ mov r5,1<<19 # Constant used for rounding second pass -+ -+ # At start of block r0,r1 point to the current block (that has already been loaded) -+block_loop: -+ eor r0,r8 -+ add r1,r7 -+ # Prefetch the next block -+ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -+ eor r0,r8 -+ sub r1,r7 -+ -+ # Transform the current block -+ bl col_trans_16 -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -+ vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position -+ -+ bl col_trans_16 -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -+ -+ # Save results - note there has been a transposition during the processing so we save columns -+ vsth VX(0,32++)+r0, (r1 += r3) REP 16 -+ -+ # Move onto next block -+ eor r0,r8 -+ add r1,r7 -+ -+ addcmpbgt r2,-1,0,block_loop -+ pop r6-r15, pc -+ -+# r1,r2,r3 r7,r8 should be preserved -+# HX(0++,0)+r0 is the block to be transformed -+# HX(32++,0) is the 16x16 matrix of transform coefficients -+# Use HY(48,0) for intermediate results -+# r0 can be used, but should be returned to its original value at the end -+col_trans_16: -+ add r4,r0,16 # Final value for this loop -+col_trans_16_loop: -+ # First compute partial products for a single column -+ vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r4,col_trans_16_loop -+ sub r0,16 # but r0 back to its original value -+ b lr -diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -new file mode 100644 -index 0000000..536896f ---- /dev/null -+++ b/libavcodec/rpi_mailbox.c -@@ -0,0 +1,293 @@ -+/* -+Copyright (c) 2012, Broadcom Europe Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define MAJOR_NUM 100 -+#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) -+#define DEVICE_FILE_NAME "/dev/char_dev" -+ -+#include "rpi_mailbox.h" -+ -+#define PAGE_SIZE (4*1024) -+ -+// Shared memory will not be cached in ARM cache -+void *mapmem_shared(unsigned base, unsigned size) -+{ -+ int mem_fd; -+ unsigned offset = base % PAGE_SIZE; -+ base = base - offset; -+ /* open /dev/mem */ -+ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { -+ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); -+ return NULL; -+ } -+ void *mem = mmap( -+ 0, -+ size, -+ PROT_READ|PROT_WRITE, -+ MAP_SHARED/*|MAP_FIXED*/, -+ mem_fd, -+ base); -+#ifdef DEBUG -+ printf("base=0x%x, mem=%p\n", base, mem); -+#endif -+ if (mem == MAP_FAILED) { -+ printf("mmap error %d\n", (int)mem); -+ return NULL; -+ } -+ close(mem_fd); -+ return (char *)mem + offset; -+} -+ -+// Unshared memory will be faster as lives in ARM cache, but requires cache flushing -+void *mapmem_private(unsigned base, unsigned size) -+{ -+ int mem_fd; -+ unsigned offset = base % PAGE_SIZE; -+ base = base - offset; -+ /* open /dev/mem */ -+ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { -+ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); -+ return NULL; -+ } -+ void *mem = mmap( -+ 0, -+ size, -+ PROT_READ|PROT_WRITE, -+ MAP_PRIVATE/*|MAP_FIXED*/, -+ mem_fd, -+ base); -+#ifdef DEBUG -+ printf("base=0x%x, mem=%p\n", base, mem); -+#endif -+ if (mem == MAP_FAILED) { -+ printf("mmap error %d\n", (int)mem); -+ return NULL; -+ } -+ close(mem_fd); -+ return (char *)mem + offset; -+} -+ -+void unmapmem(void *addr, unsigned size) -+{ -+ int s = munmap(addr, size); -+ if (s != 0) { -+ printf("munmap error %d\n", s); -+ exit (-1); -+ } -+} -+ -+/* -+ * use ioctl to send mbox property message -+ */ -+ -+static int mbox_property(int file_desc, void *buf) -+{ -+ int ret_val = ioctl(file_desc, IOCTL_MBOX_PROPERTY, buf); -+ -+ if (ret_val < 0) { -+ printf("ioctl_set_msg failed:%d\n", ret_val); -+ } -+ -+#ifdef DEBUG -+ unsigned *p = buf; int i; unsigned size = *(unsigned *)buf; -+ for (i=0; i -+#include -+#include -+#include -+#include -+ -+#include "config.h" -+ -+#include -+#include -+ -+#include "rpi_mailbox.h" -+#include "rpi_qpu.h" -+#include "rpi_shader.h" -+#include "rpi_hevc_transform.h" -+ -+#ifdef RPI_USE_VCSM -+#include "rpi_user_vcsm.h" -+#endif -+ -+// On Pi2 there is no way to access the VPU L2 cache -+// GPU_MEM_FLG should be 4 for uncached memory. -+// However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -+// The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -+#define GPU_MEM_FLG 0xC -+#define GPU_MEM_MAP 0x0 -+ -+#define vcos_verify(x) ((x)>=0) -+ -+typedef unsigned char uint8_t; -+typedef signed char int8_t; -+typedef unsigned short uint16_t; -+typedef unsigned int uint32_t; -+typedef int int32_t; -+ -+/*static const unsigned code[] = -+{ -+ #include "rpi_shader.hex" -+};*/ -+ -+// Size in 32bit words -+#define QPU_CODE_SIZE 2048 -+#define VPU_CODE_SIZE 2048 -+ -+struct GPU -+{ -+ unsigned int qpu_code[QPU_CODE_SIZE]; -+ unsigned int vpu_code[VPU_CODE_SIZE]; -+ int open_count; // Number of allocated video buffers -+ unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+ int vc; // Address in GPU memory -+ int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -+}; -+ -+// Stop more than one thread trying to allocate memory or use the processing resources at once -+static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+static volatile struct GPU* gpu = NULL; -+ -+#ifdef RPI_TIME_TOTAL_QPU -+static unsigned int Microseconds(void) { -+ struct timespec ts; -+ unsigned int x; -+ static unsigned int base = 0; -+ clock_gettime(CLOCK_REALTIME, &ts); -+ x = ts.tv_sec*1000000 + ts.tv_nsec/1000; -+ if (base==0) base=x; -+ return x-base; -+} -+#endif -+ -+// Connect to QPU, returns 0 on success. -+static int gpu_init(volatile struct GPU **gpu) { -+ int mb = mbox_open(); -+ int vc; -+ int handle; -+ volatile struct GPU* ptr; -+ if (mb < 0) -+ return -1; -+ -+ if (qpu_enable(mb, 1)) return -2; -+ -+#ifdef RPI_USE_VCSM -+ vcsm_init(); -+#endif -+ -+ handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); -+ if (!handle) -+ { -+ qpu_enable(mb, 0); -+ return -3; -+ } -+ vc = mem_lock(mb, handle); -+ ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); -+ if (ptr == NULL) -+ { mem_free(mb, handle); -+ mem_unlock(mb, handle); -+ qpu_enable(mb, 0); -+ return -4; -+ } -+ -+ ptr->mb = mb; -+ ptr->vc_handle = handle; -+ ptr->vc = vc; -+ -+ *gpu = ptr; -+ -+ // Now copy over the QPU code into GPU memory -+ { -+ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); -+ assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -+ } -+ // And the VPU code -+ { -+ int num_bytes = sizeof(rpi_hevc_transform); -+ assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -+ -+ return 0; -+} -+ -+// Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -+static void gpu_lock(void) { -+ pthread_mutex_lock(&gpu_mutex); -+ if (gpu==NULL) { -+ gpu_init(&gpu); -+ } -+} -+ -+static void gpu_unlock(void) { -+ pthread_mutex_unlock(&gpu_mutex); -+} -+ -+// Allocate memory on GPU -+// Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes -+// Returns 0 on success. -+// This allocates memory that will not be cached in ARM's data cache. -+// Therefore safe to use without data cache flushing. -+int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { -+ gpu_lock(); -+ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -+ p->vcsm_handle = 0; -+ if (!p->vc_handle) -+ { -+ qpu_enable(gpu->mb, 0); -+ return -3; -+ } -+ p->vc = mem_lock(gpu->mb, p->vc_handle); -+ p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -+ p->numbytes = numbytes; -+ if (p->arm == NULL) -+ { -+ mem_free(gpu->mb, p->vc_handle); -+ mem_unlock(gpu->mb, p->vc_handle); -+ gpu_unlock(); -+ qpu_enable(gpu->mb, 0); -+ return -4; -+ } -+ gpu->open_count++; -+ gpu_unlock(); -+ return 0; -+} -+ -+void gpu_cache_flush(GPU_MEM_PTR_T *p) -+{ -+ // This only works when using RPI_USE_VCSM -+ void *tmp = vcsm_lock(p->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+} -+ -+// This allocates data that will be -+// Cached in ARM L2 -+// Uncached in VPU L2 -+int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -+ gpu_lock(); -+#ifdef RPI_USE_VCSM -+ { -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+ p->vc = mem_lock(gpu->mb, p->vc_handle); -+ } -+#else -+ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -+ p->vcsm_handle = 0; -+ if (!p->handle) -+ { -+ qpu_enable(gpu->mb, 0); -+ return -3; -+ } -+ p->vc = mem_lock(gpu->mb, p->vc_handle); -+ printf("This mapmem_private does not seem to work\n"); -+ exit(-1); -+ p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -+ p->numbytes = numbytes; -+ if (p->arm == NULL) -+ { -+ mem_free(gpu->mb, p->handle); -+ mem_unlock(gpu->mb, p->handle); -+ gpu_unlock(); -+ qpu_enable(gpu->mb, 0); -+ return -4; -+ } -+#endif -+ gpu->open_count++; -+ gpu_unlock(); -+ return 0; -+} -+ -+static void gpu_term(void) -+{ -+ int mb = gpu->mb; -+ unsigned handle = gpu->vc_handle; -+ if (gpu==NULL) -+ return; -+ unmapmem((void*)gpu, sizeof(struct GPU)); -+ mem_unlock(mb, handle); -+ mem_free(mb, handle); -+ qpu_enable(mb, 0); -+#ifdef RPI_USE_VCSM -+ vcsm_exit(); -+#endif -+ mbox_close(mb); -+ gpu = NULL; -+} -+ -+void gpu_free(GPU_MEM_PTR_T *p) { -+ int mb = gpu->mb; -+ unsigned handle = p->vc_handle; -+ gpu_lock(); -+#ifdef RPI_USE_VCSM -+ if (p->vcsm_handle) { -+ mem_unlock(mb,p->vc_handle); -+ vcsm_unlock_ptr(p->arm); -+ vcsm_free(p->vcsm_handle); -+ } else { -+ unmapmem((void*)p->arm, sizeof(struct GPU)); -+ mem_unlock(mb, handle); -+ mem_free(mb, handle); -+ } -+#else -+ unmapmem((void*)p->arm, sizeof(struct GPU)); -+ mem_unlock(mb, handle); -+ mem_free(mb, handle); -+#endif -+ -+ gpu->open_count--; -+ if (gpu->open_count==0) { -+ printf("Closing GPU\n"); -+ gpu_term(); -+ gpu = NULL; -+ } -+ gpu_unlock(); -+} -+ -+unsigned int vpu_get_fn(void) { -+ // Make sure that the gpu is initialized -+ if (gpu==NULL) { -+ printf("Preparing gpu\n"); -+ gpu_lock(); -+ gpu_unlock(); -+ } -+ return gpu->vc + offsetof(struct GPU,vpu_code); -+} -+ -+unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -+{ -+ unsigned r; -+ gpu_lock(); -+ r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); -+ gpu_unlock(); -+ return r; -+} -+ -+// Run a program on a QPU with the given code and uniform stream (given in GPU addresses) -+// The first num QPUs will start at code, the next num2 QPUs will start at code2 -+void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12) -+{ -+ int i; -+#ifdef RPI_TIME_TOTAL_QPU -+ static int last_time=0; -+ static long long on_time=0; -+ static long long off_time=0; -+ int start_time; -+ int end_time; -+ static int count=0; -+#endif -+ -+ gpu_lock(); -+#ifdef RPI_TIME_TOTAL_QPU -+ start_time = Microseconds(); -+ if (last_time==0) -+ last_time = start_time; -+ off_time += start_time-last_time; -+#endif -+ for(i=0;imail[i*2 + 1] = code; -+ } -+ for(;imail[i*2 + 1] = code2; -+ } -+ gpu->mail[0 ] = unifs1; -+ gpu->mail[2 ] = unifs2; -+ gpu->mail[4 ] = unifs3; -+ gpu->mail[6 ] = unifs4; -+ gpu->mail[8 ] = unifs5; -+ gpu->mail[10] = unifs6; -+ gpu->mail[12] = unifs7; -+ gpu->mail[14] = unifs8; -+ gpu->mail[16] = unifs9; -+ gpu->mail[18] = unifs10; -+ gpu->mail[20] = unifs11; -+ gpu->mail[22] = unifs12; -+ execute_qpu( -+ gpu->mb, -+ 12 /* Number of QPUs */, -+ gpu->vc + offsetof(struct GPU, mail), -+ 1 /* no flush */, // Don't flush VPU L1 cache -+ 5000 /* timeout ms */); -+#ifdef RPI_TIME_TOTAL_QPU -+ end_time = Microseconds(); -+ last_time = end_time; -+ on_time += end_time - start_time; -+ count++; -+ if ((count&0x7f)==0) -+ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); -+#endif -+ gpu_unlock(); -+} -+ -+unsigned int qpu_get_fn(int num) { -+ // Make sure that the gpu is initialized -+ unsigned int *fn; -+ if (gpu==NULL) { -+ printf("Preparing gpu\n"); -+ gpu_lock(); -+ gpu_unlock(); -+ } -+ switch(num) { -+ case QPU_MC_SETUP: -+ fn = mc_setup; -+ break; -+ case QPU_MC_FILTER: -+ fn = mc_filter; -+ break; -+ case QPU_MC_EXIT: -+ fn = mc_exit; -+ break; -+ case QPU_MC_INTERRUPT_EXIT: -+ fn = mc_interrupt_exit; -+ break; -+ case QPU_MC_FILTER_B: -+ fn = mc_filter_b; -+ break; -+ case QPU_MC_FILTER_HONLY: -+ fn = mc_filter_honly; -+ break; -+ case QPU_MC_SETUP_UV: -+ fn = mc_setup_uv; -+ break; -+ case QPU_MC_FILTER_UV: -+ fn = mc_filter_uv; -+ break; -+ case QPU_MC_FILTER_UV_B: -+ fn = mc_filter_uv_b; -+ break; -+ case QPU_MC_END: -+ fn = mc_end; -+ break; -+ default: -+ printf("Unknown function\n"); -+ exit(-1); -+ } -+ return gpu->vc + 4*(int)(fn-rpi_shader); -+ //return code[num] + gpu->vc; -+} -+ -+#if 0 -+ -+int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; -+//int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -+int32_t vcoeffs[] = {-2, 6, -13, 37, 115, -20, 9, -4}; -+//int32_t vcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -+ -+#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0-1) & 0xff) | ((c1-1) & 0xff) << 8 | ((c2-1) & 0xff) << 16 | ((c3-1) & 0xff) << 24); -+ -+static uint8_t av_clip_uint8(int32_t a) -+{ -+ if (a&(~255)) return (-a)>>31; -+ else return a; -+} -+ -+static int32_t filter8(const uint8_t *data, int pitch) -+{ -+ int32_t vsum = 0; -+ int x, y; -+ -+ for (y = 0; y < 8; y++) { -+ int32_t hsum = 0; -+ -+ for (x = 0; x < 8; x++) -+ hsum += hcoeffs[x]*data[x + y * pitch]; -+ -+ vsum += vcoeffs[y]*av_clip_uint8( (hsum + 64) >> 7); // Added brackets to stop compiler warning -+ } -+ -+ return av_clip_uint8( (vsum + 64) >> 7); -+} -+ -+// Note regression changes coefficients so is not thread safe -+//#define REGRESSION -+#ifdef REGRESSION -+#define CMAX 100 -+#else -+#define CMAX 2 -+#endif -+#define YMAX 16 -+ -+int rpi_test_shader(void) -+{ -+ int i, c; -+ -+ uint32_t *unifs; -+ -+ uint8_t *in_buffer; -+ uint8_t *out_buffer[2]; -+ -+ GPU_MEM_PTR_T unifs_ptr; -+ GPU_MEM_PTR_T in_buffer_ptr; -+ GPU_MEM_PTR_T out_buffer_ptr[2]; -+ -+ // Addresses in GPU memory of filter programs -+ uint32_t mc_setup = 0; -+ uint32_t mc_filter = 0; -+ uint32_t mc_exit = 0; -+ -+ int pitch = 0x500; -+ -+ if (gpu==NULL) { -+ gpu_lock(); -+ gpu_unlock(); -+ } -+ -+ printf("This needs to change to reflect new assembler\n"); -+ // Use table to compute locations of program start points -+ mc_setup = code[0] + gpu->vc; -+ mc_filter = code[1] + gpu->vc; -+ mc_exit = code[2] + gpu->vc; -+ -+ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { -+ return -2; -+ } -+ unifs = (uint32_t*)unifs_ptr.arm; -+ -+ if (!vcos_verify(gpu_malloc_uncached(64*23,&in_buffer_ptr))) { -+ return -3; -+ } -+ in_buffer = (uint8_t*)in_buffer_ptr.arm; -+ -+ if (!vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[0])) || !vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[1]))) { -+ return -4; -+ } -+ out_buffer[0] = (uint8_t*)out_buffer_ptr[0].arm; -+ out_buffer[1] = (uint8_t*)out_buffer_ptr[1].arm; -+ -+ for (c = 0; c < CMAX; c++) { -+ int xo[] = {rand()&31, rand()&31}; -+ -+#ifdef REGRESSION -+ for (i = 0; i < 8; i++) { -+ hcoeffs[i] = (int8_t)rand(); -+ vcoeffs[i] = (int8_t)rand(); -+ if (hcoeffs[i]==-128) -+ hcoeffs[i]++; -+ if (vcoeffs[i]==-128) -+ vcoeffs[i]++; -+ } -+#endif -+ -+ for (i = 0; i < 64*23; i++) { -+ //printf("%d %d %p\n",i,gpu->mb,&in_buffer[i]); -+ in_buffer[i] = rand(); -+ } -+ -+ // Clear output array -+ { -+ int b; -+ for(b=0;b<2;b++) { -+ for(i=0;i<16*16;i++) { -+ out_buffer[b][i] = 3; -+ } -+ } -+ } -+ -+ unifs[0] = mc_filter; -+ unifs[1] = in_buffer_ptr.vc+xo[0]+16; -+ unifs[2] = 64; // src pitch -+ unifs[3] = pitch; // dst pitch -+ unifs[4] = 0; // Padding -+ unifs[5] = 0; -+ unifs[6] = 0; -+ unifs[7 ] = mc_filter; -+ unifs[8 ] = in_buffer_ptr.vc+xo[1]+16; -+ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -+ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -+ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -+ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -+ unifs[13] = out_buffer_ptr[0].vc; -+ unifs[14] = mc_exit; -+ unifs[15] = in_buffer_ptr.vc+xo[1]+16; // dummy -+ unifs[16] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -+ unifs[17] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -+ unifs[18] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -+ unifs[19] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -+ unifs[20] = out_buffer_ptr[1].vc; -+ -+ printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); -+ -+ // flush_dcache(); TODO is this needed on ARM side? - tried to use the direct alias to avoid this problem -+ -+ //qpu_run_shader(mc_setup, unifs_ptr.vc); -+ //qpu_run_shader(gpu, gpu->vc, unifs_ptr.vc); -+ rpi_do_block(in_buffer_ptr.vc+xo[0]+16, 64, out_buffer_ptr[0].vc, pitch,out_buffer[0]); -+ rpi_do_block(in_buffer_ptr.vc+xo[1]+16, 64, out_buffer_ptr[1].vc, pitch,out_buffer[1]); -+ -+ if (1) -+ { -+ int x, y, b; -+ int bad = 0; -+ -+ for (b=0; b<2; ++b) -+ for (y=0; yvc; -+ mc_filter = code[1] + gpu->vc; -+ mc_exit = code[2] + gpu->vc; -+ -+ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { -+ return; -+ } -+ //gpu_malloc_uncached(16*dst_pitch,&out_buffer_ptr); -+ //out_buffer = (uint8_t*)out_buffer_ptr.arm; -+ -+ /*for (y=0; y<16; ++y) { -+ for (x=0; x<16; ++x) { -+ out_buffer[x+y*dst_pitch] = 7; -+ } -+ }*/ -+ -+ unifs = (uint32_t*)unifs_ptr.arm; -+ -+ unifs[0] = mc_filter; -+ unifs[1] = (int)in_buffer_vc; -+ unifs[2] = src_pitch; // src pitch -+ unifs[3] = dst_pitch; // dst pitch -+ unifs[4] = 0; // Padding -+ unifs[5] = 0; -+ unifs[6] = 0; -+ unifs[7 ] = mc_exit; -+ unifs[8 ] = (int)in_buffer_vc; -+ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -+ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -+ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -+ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -+ unifs[13] = (int)dst_vc; -+ //unifs[13] = (int)out_buffer_ptr.vc; -+ -+ //printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); -+ -+ qpu_run_shader(mc_setup, unifs_ptr.vc); -+ -+ /*for (y=0; y<16; ++y) { -+ for (x=0; x<16; ++x) { -+ dst[x+y*dst_pitch] = out_buffer[x+y*dst_pitch]; -+ } -+ }*/ -+ -+ gpu_free(&unifs_ptr); -+ //gpu_free(&out_buffer_ptr); -+} -+ -+ -+#endif -+ -+#endif // RPI -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -new file mode 100644 -index 0000000..4e3c35c ---- /dev/null -+++ b/libavcodec/rpi_qpu.h -@@ -0,0 +1,45 @@ -+#ifndef RPI_QPU_H -+#define RPI_QPU_H -+ -+typedef struct gpu_mem_ptr_s { -+ unsigned char *arm; // Pointer to memory mapped on ARM side -+ int vc_handle; // Videocore handle of relocatable memory -+ int vcsm_handle; // Handle for use by VCSM -+ int vc; // Address for use in GPU code -+ int numbytes; // Size of memory block -+} GPU_MEM_PTR_T; -+ -+// General GPU functions -+extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -+extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -+extern void gpu_free(GPU_MEM_PTR_T *p); -+extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+ -+// QPU specific functions -+extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -+ -+enum { -+ QPU_MC_SETUP, -+ QPU_MC_FILTER, -+ QPU_MC_EXIT, -+ QPU_MC_INTERRUPT_EXIT, -+ QPU_MC_FILTER_B, -+ QPU_MC_FILTER_HONLY, -+ QPU_MC_SETUP_UV, -+ QPU_MC_FILTER_UV, -+ QPU_MC_FILTER_UV_B, -+ QPU_MC_END -+ }; -+extern unsigned int qpu_get_fn(int num); -+ -+// VPU specific functions -+extern unsigned int vpu_get_fn(void); -+extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ -+// Simple test of shader code -+extern int rpi_test_shader(void); -+ -+extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); -+extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); -+ -+#endif -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -new file mode 100644 -index 0000000..41cc2e1 ---- /dev/null -+++ b/libavcodec/rpi_shader.c -@@ -0,0 +1,818 @@ -+#include "rpi_shader.h" -+ -+#ifdef _MSC_VER -+ #include -+ /* cast through uintptr_t to avoid warnings */ -+ #define POINTER_TO_UINT(X) ((unsigned int)(uintptr_t)(X)) -+#else -+ #define POINTER_TO_UINT(X) ((unsigned int)(X)) -+#endif -+ -+#ifdef __cplusplus -+extern "C" { /* the types are probably wrong... */ -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+#ifdef _MSC_VER -+__declspec(align(8)) -+#elif defined(__GNUC__) -+__attribute__((aligned(8))) -+#endif -+unsigned int rpi_shader[] = { -+// ::mc_setup -+/* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+/* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif -+/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 -+/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch -+/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 -+/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+// ::mc_filter_uv -+/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :uvloop -+/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_filter -+/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -+/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :loop -+/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -+/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -+/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// :fast_path -+/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :fast_loop -+/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -+/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -+/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -+/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_filter_b -+/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :bloop -+/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -+/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -+/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -+/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_filter_honly -+/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -+/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -+/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :loop_honly -+/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -+/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -+/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -+/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -+/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -+/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -+/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_exit -+/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_exit1 -+/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_interrupt_exit -+/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_interrupt_exit4 -+/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_interrupt_exit8 -+/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_setup_uv -+/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif -+/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 -+/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+// ::mc_filter_uv_b -+/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :uvloop_b -+/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_end -+}; -+#ifdef __HIGHC__ -+#pragma Align_to(8, rpi_shader) -+#endif -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -new file mode 100644 -index 0000000..db971f4 ---- /dev/null -+++ b/libavcodec/rpi_shader.h -@@ -0,0 +1,20 @@ -+#ifndef rpi_shader_H -+#define rpi_shader_H -+ -+extern unsigned int rpi_shader[]; -+ -+#define mc_setup (rpi_shader + 0) -+#define mc_filter_uv (rpi_shader + 146) -+#define mc_filter (rpi_shader + 360) -+#define mc_filter_b (rpi_shader + 670) -+#define mc_filter_honly (rpi_shader + 894) -+#define mc_exit (rpi_shader + 1048) -+#define mc_exit1 (rpi_shader + 1066) -+#define mc_interrupt_exit (rpi_shader + 1082) -+#define mc_interrupt_exit4 (rpi_shader + 1120) -+#define mc_interrupt_exit8 (rpi_shader + 1142) -+#define mc_setup_uv (rpi_shader + 1172) -+#define mc_filter_uv_b (rpi_shader + 1314) -+#define mc_end (rpi_shader + 1542) -+ -+#endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -new file mode 100644 -index 0000000..6851e83 ---- /dev/null -+++ b/libavcodec/rpi_shader.qasm -@@ -0,0 +1,1413 @@ -+# register allocation -+# -+# ra0...ra7 eight horizontal filter coefficients -+# -+# rb1...rb7 seven shifted copies of the current unfiltered row -+# -+# ra8...ra15 eight filtered rows of context (rb15 == most recent) -+# -+# (ra15 isn't clamped to zero - this happens during the -+# copy to ra14, and during its use in the vertical filter) -+# -+# rb8...rb15 eight vertical filter coefficients -+# -+# ra16 clipped(row start address+elem_num)&~3 -+# ra17 per-channel shifts -+# ra19 next ra17 -+# -+# rb16 pitch -+# rb17 height + 5 -+# rb18 height + 7 -+# rb19 next ra16 -+# -+# ra20 1 -+# ra21 64 -+# ra22 256 -+# ra23 8 -+# -+# rb20 0xffffff00 -+# rb21 64 -+# rb22 255 -+# rb23 24 -+# -+# rb24 vdw_setup_1(dst_pitch) -+# rb25 frame width-1 -+# rb26 height<<23 + width<<16 + vdw_setup_0 -+# rb27 vdw_setup_0 (depends on QPU number) -+# rb28 vpm_setup (depends on QPU number) -+# rb29 vdw_setup_1(dst_pitch-width) -+# rb30 frame height-1 -+# rb31 used as temp to count loop iterations -+# -+# ra24...ra30 15, 14, 13, 12, 11, 10, 9 -+# ra24 clipped(row start address+8+elem_num)&~3 -+# ra25 per-channel shifts 2 -+# ra26 next ra24 -+# ra27 next ra25 -+# ra28 next y -+# ra29 y for next texture access -+# -+# ra31 next kernel address -+ -+.set rb_frame_width_minus_1, rb25 -+.set rb_frame_height_minus_1, rb30 -+.set rb_pitch, rb16 -+.set ra_x_base, ra16 -+.set rb_x_base_next, rb19 -+.set ra_x2_base, ra24 -+.set ra_x2_base_next, ra26 -+.set ra_xshift, ra17 -+ -+.set ra_x2shift, ra25 -+.set ra_u2v_ref_offset, ra25 -+ -+.set ra_xshift_next, ra19 -+ -+.set ra_x2shift_next, ra27 -+.set ra_u2v_dst_offset, ra27 -+ -+.set ra_y_next, ra28 -+.set ra_y, ra29 -+ -+.set rb_const_64, rb21 -+ -+# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) -+::mc_setup -+ -+# Read starting kernel -+mov ra31, unif -+ -+# Load first request location -+add ra_x_base, unif, elem_num # Store x -+mov ra_y, unif # Store y -+mov ra_x2_base, unif # Store frame base -+ -+# Read image dimensions -+sub rb25,unif,1 -+sub rb30,unif,1 -+ -+# get source pitch -+mov rb16, unif -+ -+# get destination pitch -+mov r0, unif -+mov r1, vdw_setup_1(0) -+add rb24, r1, r0 -+ -+# load constants -+ -+mov ra20, 1 -+mov ra21, 64 -+mov ra22, 256 -+mov ra23, 8 -+ -+mov rb20, 0xffffff00 -+mov rb21, 64 -+mov rb22, 255 -+mov rb23, 24 -+ -+# touch vertical context to keep simulator happy -+ -+mov ra8, 0 -+mov ra9, 0 -+mov ra10, 0 -+mov ra11, 0 -+mov ra12, 0 -+mov ra13, 0 -+mov ra14, 0 -+mov ra15, 0 -+ -+# Compute part of VPM to use for DMA output -+mov r2, qpu_num -+and r2, r2, 15 -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 -+mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+shl r0, r0, 5 -+add rb27, r0, r1 -+ -+# Compute part of VPM to save data into -+mov r2, qpu_num -+and r2, r2, 15 -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 -+mov r1, vpm_setup(0, 4, h8p(0, 0)) -+add rb28, r0, r1 -+ -+# Compute base address for first and second access -+#add r0, unif, elem_num # x -+mov r0, ra_x_base # Load x -+add r2, r0, 8 # x+8 -+max r0, r0, 0; mov r1, ra_y # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+shl ra_xshift_next, r0, 3 -+max r2, r2, 0 -+add ra_y, r1, 1 -+min r2, r2, rb_frame_width_minus_1 -+shl ra_x2shift_next, r2, 3 -+max r1, r1, 0 # y -+min r1, r1, rb_frame_height_minus_1 -+add r0, r0, r3; mul24 r1, r1, rb_pitch -+add r2, r2, r3 -+and r0, r0, ~3 -+and r2, r2, ~3; mov ra_x_base, r0 -+# submit texture requests for first line -+add t0s, r0, r1 ; mov ra_x2_base, r2 -+add t0s, r2, r1 -+ -+# Dump padding words -+mov r0, unif -+mov r0, unif -+ -+# submit texture requests for second line -+max r1, ra_y, 0 -+min r1, r1, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 -+bra -, ra31 -+nop ; mul24 r1, r1, rb_pitch -+add t0s, r1, ra_x_base -+add t0s, r1, ra_x2_base -+ -+################################################################################ -+ -+# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+ -+# At this point we have already issued two pairs of texture requests for the current block -+# ra_x_base, ra_x16_base point to the current coordinates for this block -+::mc_filter_uv -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # x -+max r0, r0, 0; mov r1, unif # y -+min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+shl ra_xshift_next, r0, 3 -+sub r2, unif, r3 # compute offset from frame base u to frame base v -+add r0, r0, r3 -+and rb_x_base_next, r0, ~3 -+mov ra_y_next, r1 -+add ra_x2_base_next, rb_x_base_next, r2 -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ -+# get filter coefficients -+ -+mov r0, unif -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+asr rb15, r0, rb23; mul24 r0, r0, ra22 -+asr rb14, r0, rb23; mul24 r0, r0, ra22 -+asr rb13, r0, rb23; mul24 r0, r0, ra22 -+asr rb12, r0, rb23 -+ -+# r2 is elem_num -+# r3 is loop counter -+ -+mov r5rep, -8 -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+mov r3, 0 -+ -+:uvloop -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+mov r2, rb21 ; mul24 r3, r0, ra0 -+nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+sub r0, r2, r3 -+ -+mov r3, rb31 -+ -+mov ra8, ra9 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+mov ra13, ra14 -+ -+sub.setf -, r3, 8 ; mov r1, ra22 -+ -+# apply horizontal filter -+brr.anyn -, r:uvloop -+max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+asr r0, r0, 15 ; mov r1, ra21 -+min.setf ra15, r0, rb22 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r0, ra14, rb14 -+sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+sub.ifnn r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+brr.anyn -, r:uvloop -+asr r1, r1, 15 -+min r1, r1, rb22 -+max vpm, r1, 0 -+ -+# DMA out for U -+ -+mov vw_setup, rb26 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+# DMA out for V -+# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+# Could potentially push this write into the start of the next pipeline stage. -+mov r0, 16 -+mov -, vw_wait -+ -+bra -, ra31 -+add vw_setup, rb26, r0 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+################################################################################ -+ -+ -+# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+ -+# At this point we have already issued two pairs of texture requests for the current block -+# ra_x_base, ra_x16_base point to the current coordinates for this block -+::mc_filter -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+mov ra_x2shift, ra_x2shift_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # x -+add r2, r0, 8 # x+8 -+max r0, r0, 0; mov r1, unif # y -+min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+shl ra_xshift_next, r0, 3 -+max r2, r2, 0 -+min r2, r2, rb_frame_width_minus_1 -+shl ra_x2shift_next, r2, 3 -+add r0, r0, r3 -+add r2, r2, r3 -+and rb_x_base_next, r0, ~3 -+and ra_x2_base_next, r2, ~3 -+mov ra_y_next, r1 -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ -+# get filter coefficients -+ -+mov r0, unif -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+asr rb15, r0, rb23; mul24 r0, r0, ra22 -+asr rb14, r0, rb23; mul24 r0, r0, ra22 -+asr rb13, r0, rb23; mul24 r0, r0, ra22 -+brr.anynn -, r:fast_path -+asr rb12, r0, rb23 # delay slot 1 -+ -+# r2 is elem_num -+# r3 is loop counter -+ -+mov r5rep, -8 # delay slot 2 -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+## nop ; ldtmu0 # loop counter increment -+## shr r0, r4, ra17 ; ldtmu0 -+## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+## add ra16, ra16, rb16 ; mov t0s, ra16 -+## -+## # generate seven shifted versions -+## # interleave with scroll of vertical context -+## -+## mov r2, rb21 ; mul24 r3, r0, ra0 -+## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+## sub r2, r2, r3 ; ldtmu0 -+## -+## mov r0, ra22 -+## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -+## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+## add ra16, ra16, rb16 ; mov t0s, ra16 -+## -+## # apply horizontal filter -+## -+## asr r2, r2, 15 ; mul24 r3, r0, ra0 -+## min r2, r2, rb22 -+## max ra13, r2, 0 -+## -+## # generate seven shifted versions -+## # interleave with scroll of vertical context -+## -+## mov r2, rb21 -+## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+## sub r0, r2, r3 -+## -+## # apply horizontal filter -+## -+## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+## asr r0, r0, 15 -+## min r0, r0, rb22 -+## max ra14, r0, 0 -+## -+## -+## -+## -+## nop ; ldtmu0 # loop counter increment -+## shr r0, r4, ra17 ; ldtmu0 -+## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+## add ra16, ra16, rb16 ; mov t0s, ra16 -+## -+## # generate seven shifted versions -+## # interleave with scroll of vertical context -+## -+## mov r2, rb21 ; mul24 r3, r0, ra0 -+## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+## sub r0, r2, r3 -+## -+## # apply horizontal filter -+## -+## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+## asr r0, r0, 15 -+## min r0, r0, rb22 -+## max ra15, r0, 0 -+ -+ -+ -+ -+mov r3, 0 -+ -+:loop -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+mov r2, rb21 ; mul24 r3, r0, ra0 -+sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+sub r0, r2, r3 -+ -+mov r3, rb31 -+ -+mov ra8, ra9 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+mov ra13, ra14 -+ -+sub.setf -, r3, 8 ; mov r1, ra22 -+ -+# apply horizontal filter -+brr.anyn -, r:loop -+max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+asr r0, r0, 15 ; mov r1, ra21 -+min.setf ra15, r0, rb22 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r0, ra14, rb14 -+sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+sub.ifnn r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+brr.anyn -, r:loop -+asr r1, r1, 15 -+min r1, r1, rb22 -+max vpm, r1, 0 -+ -+# DMA out -+ -+bra -, ra31 -+mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+mov vw_setup, rb29 -+mov vw_addr, unif # start the VDW -+ -+#################################################### -+ -+:fast_path -+## nop ; ldtmu0 # loop counter increment -+## shr r0, r4, ra17 ; ldtmu0 -+## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+## add ra16, ra16, rb16 ; mov t0s, ra16 -+## -+## # generate seven shifted versions -+## # interleave with scroll of vertical context -+## -+## mov r2, rb21 ; mul24 r3, r0, ra0 -+## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+## sub r2, r2, r3 ; ldtmu0 -+## -+## mov r0, ra22 -+## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -+## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+## add ra16, ra16, rb16 ; mov t0s, ra16 -+## -+## # apply horizontal filter -+## -+## asr r2, r2, 15 ; mul24 r3, r0, ra0 -+## min r2, r2, rb22 -+## max ra13, r2, 0 -+## -+## # generate seven shifted versions -+## # interleave with scroll of vertical context -+## -+## mov r2, rb21 -+## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+## sub r0, r2, r3 -+## -+## # apply horizontal filter -+## -+## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+## asr r0, r0, 15 -+## min r0, r0, rb22 -+## max ra14, r0, 0 -+## -+## -+## -+## -+## nop ; ldtmu0 # loop counter increment -+## shr r0, r4, ra17 ; ldtmu0 -+## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+## add ra16, ra16, rb16 ; mov t0s, ra16 -+## -+## # generate seven shifted versions -+## # interleave with scroll of vertical context -+## -+## mov r2, rb21 ; mul24 r3, r0, ra0 -+## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+## sub r0, r2, r3 -+## -+## # apply horizontal filter -+## -+## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+## asr r0, r0, 15 -+## min r0, r0, rb22 -+## max ra15, r0, 0 -+ -+ -+mov r3, 0 # This signifies the amount of unrolling -+ -+:fast_loop -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+ -+max r2, ra_y, 0 -+min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov r2, rb21 ; mul24 r3, r0, ra0 -+sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+sub r0, r2, r3 ; mov r3, rb31 -+ -+mov ra8, ra9 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+mov ra13, ra14 -+ -+sub.setf -, r3, 8 ; mov r1, ra22 -+ -+# apply horizontal filter -+ -+brr.anyn -, r:fast_loop -+max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+asr r0, r0, 15 ; mov r1, ra21 -+min.setf ra15, r0, rb22 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r0, ra14, rb14 -+sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+sub.ifnn r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+brr.anyn -, r:fast_loop -+asr r1, r1, 15 -+min r1, r1, rb22 -+max vpm, r1, 0 -+ -+# DMA out -+ -+bra -, ra31 -+mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+mov vw_setup, rb29 -+mov vw_addr, unif # start the VDW -+ -+################################################################################ -+ -+# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+ -+# At this point we have already issued two pairs of texture requests for the current block -+# ra_x_base, ra_x16_base point to the current coordinates for this block -+::mc_filter_b -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+mov ra_x2shift, ra_x2shift_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # x -+add r2, r0, 8 # x+8 -+max r0, r0, 0; mov r1, unif # y -+min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+shl ra_xshift_next, r0, 3 -+max r2, r2, 0 -+min r2, r2, rb_frame_width_minus_1 -+shl ra_x2shift_next, r2, 3 -+add r0, r0, r3 -+add r2, r2, r3 -+and rb_x_base_next, r0, ~3 -+and ra_x2_base_next, r2, ~3 -+mov ra_y_next, r1 -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+# r0 is currently height<<7 -+# For vr_setup we want height<<20 (so 20-7=13 additional bits) -+shl r3, r0, 13 -+shl r3, r3, 8 # Mask off top 8 bits -+shr r3, r3, 8 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+# In a B frame, so also set up VPM read -+add vr_setup, r3, rb28 -+ -+# get filter coefficients -+ -+mov r0, unif -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+asr rb15, r0, rb23; mul24 r0, r0, ra22 -+asr rb14, r0, rb23; mul24 r0, r0, ra22 -+asr rb13, r0, rb23; mul24 r0, r0, ra22 -+asr rb12, r0, rb23 -+ -+# r2 is elem_num -+# r3 is loop counter -+ -+mov r5rep, -8 -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+mov r3, 0 -+ -+:bloop -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+mov r2, rb21 ; mul24 r3, r0, ra0 -+sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+sub r0, r2, r3 -+ -+mov r3, rb31 -+ -+mov ra8, ra9 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+mov ra13, ra14 -+ -+sub.setf -, r3, 8 ; mov r1, ra22 -+ -+# apply horizontal filter -+brr.anyn -, r:bloop -+max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+asr r0, r0, 15 ; mov r1, ra21 -+min.setf ra15, r0, rb22 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r0, ra14, rb14 -+sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+sub.ifnn r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+asr r1, r1, 15 ; mov -, vr_wait -+min r1, r1, rb22 -+add r0, vpm, 1 # Blend in previous VPM contents at this location -+brr.anyn -, r:bloop -+max r1, r1, 0 -+add r1, r1, r0 -+shr vpm, r1, 1 -+ -+# DMA out -+ -+bra -, ra31 -+mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+mov vw_setup, rb29 -+mov vw_addr, unif # start the VDW -+ -+################################################################################ -+ -+# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+# This filter only does horizontal filtering. -+# It is assumed that the region to fetch does not include extra rows above. -+ -+# At this point we have already issued two pairs of texture requests for the current block -+# ra_x_base, ra_x16_base point to the current coordinates for this block -+::mc_filter_honly -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+mov ra_x2shift, ra_x2shift_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # x -+add r2, r0, 8 # x+8 -+max r0, r0, 0; mov r1, unif # y -+min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+shl ra_xshift_next, r0, 3 -+max r2, r2, 0 -+min r2, r2, rb_frame_width_minus_1 -+shl ra_x2shift_next, r2, 3 -+add r0, r0, r3 -+add r2, r2, r3 -+and rb_x_base_next, r0, ~3 -+and ra_x2_base_next, r2, ~3 -+mov ra_y_next, r1 -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, -2 # Pipelining means we move data across 2 iterations early -+shl r0, r0, 7 ; mov rb18,r0 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+# get filter coefficients -+ -+mov r0, unif -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+mov r0, unif -+ -+# r2 is elem_num -+# r3 is loop counter -+mov r5rep, -8 -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -+mov r3, 0 -+ -+:loop_honly -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+mov r2, rb21 ; mul24 r3, r0, ra0 -+sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+sub r0, r2, r3 ; mov r3, rb31 -+ -+sub.setf -, r3, rb18 ; mov r1, ra22 -+ -+mov -, vw_wait ; mul24 r0, r0, r1 -+brr.anyn -, r:loop_honly -+asr r0, r0, 15 # delay 1 -+min r0, r0, rb22 # delay 2 -+max vpm, r0, 0 # delay 3 -+ -+# DMA out -+bra -, ra31 -+mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+mov vw_setup, rb29 -+mov vw_addr, unif # start the VDW -+ -+ -+################################################################################ -+ -+# mc_exit() -+ -+::mc_exit -+mov -, vw_wait # wait on the VDW -+ -+mov -,srel(0) -+ -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ -+nop ; nop ; thrend -+nop ; nop # delay slot 1 -+nop ; nop # delay slot 2 -+ -+::mc_exit1 -+mov -, vw_wait # wait on the VDW -+ -+#mov -,srel(1) -+ -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ -+nop ; nop ; thrend -+mov interrupt, 1; nop # delay slot 1 -+nop ; nop # delay slot 2 -+ -+# mc_interrupt_exit() -+::mc_interrupt_exit -+mov -, vw_wait # wait on the VDW -+ -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ -+mov -,sacq(0) # 1 -+mov -,sacq(0) # 2 -+mov -,sacq(0) # 3 -+mov -,sacq(0) # 4 -+mov -,sacq(0) # 5 -+mov -,sacq(0) # 6 -+mov -,sacq(0) # 7 -+mov -,sacq(0) # 8 -+mov -,sacq(0) # 9 -+mov -,sacq(0) # 10 -+mov -,sacq(0) # 11 -+ -+nop ; nop ; thrend -+mov interrupt, 1; nop # delay slot 1 -+nop ; nop # delay slot 2 -+ -+# mc_interrupt_exit4() -+::mc_interrupt_exit4 -+mov -, vw_wait # wait on the VDW -+ -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ -+mov -,sacq(0) # 1 -+mov -,sacq(0) # 2 -+mov -,sacq(0) # 3 -+ -+nop ; nop ; thrend -+mov interrupt, 1; nop # delay slot 1 -+nop ; nop # delay slot 2 -+ -+# mc_interrupt_exit8() -+::mc_interrupt_exit8 -+mov -, vw_wait # wait on the VDW -+ -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ -+mov -,sacq(0) # 1 -+mov -,sacq(0) # 2 -+mov -,sacq(0) # 3 -+mov -,sacq(0) # 4 -+mov -,sacq(0) # 5 -+mov -,sacq(0) # 6 -+mov -,sacq(0) # 7 -+ -+nop ; nop ; thrend -+mov interrupt, 1; nop # delay slot 1 -+nop ; nop # delay slot 2 -+ -+################################################################################ -+# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+::mc_setup_uv -+ -+# Read starting kernel -+mov ra31, unif -+ -+# Load first request location -+add ra_x_base, unif, elem_num # Store x -+mov ra_y, unif # Store y -+mov ra_x2_base, unif # Store frame u base -+nop -+sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -+ -+# Read image dimensions -+sub rb25,unif,1 -+sub rb30,unif,1 -+ -+# get source pitch -+mov rb16, unif -+ -+# get destination pitch -+mov r0, unif -+mov r1, vdw_setup_1(0) -+add rb24, r1, r0 -+ -+# load constants -+ -+mov ra20, 1 -+mov ra21, 64 -+mov ra22, 256 -+mov ra23, 8 -+ -+mov rb20, 0xffffff00 -+mov rb21, 64 -+mov rb22, 255 -+mov rb23, 24 -+ -+# touch vertical context to keep simulator happy -+ -+mov ra8, 0 -+mov ra9, 0 -+mov ra10, 0 -+mov ra11, 0 -+mov ra12, 0 -+mov ra13, 0 -+mov ra14, 0 -+mov ra15, 0 -+ -+# Compute part of VPM to use for DMA output -+mov r2, qpu_num -+and r2, r2, 15 -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 -+mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+shl r0, r0, 5 -+add rb27, r0, r1 -+ -+# Compute part of VPM to save data into -+mov r2, qpu_num -+and r2, r2, 15 -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 -+mov r1, vpm_setup(0, 4, h8p(0, 0)) -+add rb28, r0, r1 -+ -+# Compute base address for first and second access -+mov r0, ra_x_base # Load x -+max r0, r0, 0; mov r1, ra_y # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+add ra_y, r1, 1 -+add r0, r0, r3 -+and r0, r0, ~3 -+max r1, r1, 0 ; mov ra_x_base, r0 # y -+min r1, r1, rb_frame_height_minus_1 -+# submit texture requests for first line -+add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+add t0s, r0, r1 ; mov ra_x2_base, r2 -+add t0s, r2, r1 -+ -+# Dump padding words -+mov r0, unif -+mov r0, unif -+mov r0, unif -+ -+# submit texture requests for second line -+max r1, ra_y, 0 -+min r1, r1, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 -+bra -, ra31 -+nop ; mul24 r1, r1, rb_pitch -+add t0s, r1, ra_x_base -+add t0s, r1, ra_x2_base -+ -+ -+ -+################################################################################ -+ -+::mc_filter_uv_b -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # x -+max r0, r0, 0; mov r1, unif # y -+min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+shl ra_xshift_next, r0, 3 -+sub r2, unif, r3 # compute offset from frame base u to frame base v -+add r0, r0, r3 -+and rb_x_base_next, r0, ~3 -+mov ra_y_next, r1 -+add ra_x2_base_next, rb_x_base_next, r2 -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+ -+# r0 is currently height<<7 -+# For vr_setup we want height<<20 (so 20-7=13 additional bits) -+shl r3, r0, 13 -+shl r3, r3, 8 # Mask off top 8 bits -+shr r3, r3, 8 -+ -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+# In a B frame, so also set up VPM read -+add vr_setup, r3, rb28 -+ -+sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ -+# get filter coefficients -+ -+mov r0, unif -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+asr rb15, r0, rb23; mul24 r0, r0, ra22 -+asr rb14, r0, rb23; mul24 r0, r0, ra22 -+asr rb13, r0, rb23; mul24 r0, r0, ra22 -+asr rb12, r0, rb23 -+ -+# r2 is elem_num -+# r3 is loop counter -+ -+mov r5rep, -8 -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+mov r3, 0 -+ -+:uvloop_b -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+mov r2, rb21 ; mul24 r3, r0, ra0 -+nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+sub r0, r2, r3 -+ -+mov r3, rb31 -+ -+mov ra8, ra9 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+mov ra13, ra14 -+ -+sub.setf -, r3, 8 ; mov r1, ra22 -+ -+# apply horizontal filter -+brr.anyn -, r:uvloop_b -+max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+asr r0, r0, 15 ; mov r1, ra21 -+min.setf ra15, r0, rb22 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r0, ra14, rb14 -+sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+sub.ifnn r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+asr r1, r1, 15 -+min r1, r1, rb22 -+add r0, vpm, 1 # Blend in previous VPM contents at this location -+brr.anyn -, r:uvloop_b -+max r1, r1, 0 -+add r1, r1, r0 -+shr vpm, r1, 1 -+ -+ -+# DMA out for U -+ -+mov vw_setup, rb26 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+# DMA out for V -+# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+# Could potentially push this write into the start of the next pipeline stage. -+mov r0, 16 -+mov -, vw_wait -+ -+bra -, ra31 -+add vw_setup, rb26, r0 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+::mc_end -diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -new file mode 100644 -index 0000000..fbebbbe ---- /dev/null -+++ b/libavcodec/rpi_user_vcsm.h -@@ -0,0 +1,425 @@ -+/* -+Copyright (c) 2012, Broadcom Europe Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#ifndef __USER_VCSM__H__INCLUDED__ -+#define __USER_VCSM__H__INCLUDED__ -+ -+/* VideoCore Shared Memory - user interface library. -+** -+** This library provides all the necessary abstraction for any application to -+** make use of the shared memory service which is distributed accross a kernel -+** driver and a videocore service. -+** -+** It is an application design decision to choose or not to use this service. -+** -+** The logical flow of operations that a user application needs to follow when -+** using this service is: -+** -+** 1) Initialize the service. -+** 2) Allocate shared memory blocks. -+** 3) Start using the allocated blocks. -+** - In order to gain ownership on a block, lock the allocated block, -+** locking a block returns a valid address that the user application -+** can access. -+** - When finished with using the block for the current execution cycle -+** or function, and so when giving up the ownership, unlock the block. -+** 4) A block can be locked/unlocked as many times required - within or outside -+** of - a specific execution context. -+** 5) To completely release an allocated block, free it. -+** 6) If the service is no longer required, terminate it. -+** -+** -+** Some generic considerations: -+ -+** Allocating memory blocks. -+** -+** Memory blocks can be allocated in different manners depending on the cache -+** behavior desired. A given block can either be: -+ -+** - Allocated in a non cached fashion all the way through host and videocore. -+** - Allocated in a cached fashion on host OR videocore. -+** - Allocated in a cached fashion on host AND videocore. -+** -+** It is an application decision to determine how to allocate a block. Evidently -+** if the application will be doing substantial read/write accesses to a given block, -+** it is recommended to allocate the block at least in a 'host cached' fashion for -+** better results. -+** -+** -+** Locking memory blocks. -+** -+** When the memory block has been allocated in a host cached fashion, locking the -+** memory block (and so taking ownership of it) will trigger a cache invalidation. -+** -+** For the above reason and when using host cached allocation, it is important that -+** an application properly implements the lock/unlock mechanism to ensure cache will -+** stay coherent, otherwise there is no guarantee it will at all be. -+** -+** It is possible to dynamically change the host cache behavior (ie cached or non -+** cached) of a given allocation without needing to free and re-allocate the block. -+** This feature can be useful for such application which requires access to the block -+** only at certain times and not otherwise. By changing the cache behavior dynamically -+** the application can optimize performances for a given duration of use. -+** Such dynamic cache behavior remapping only applies to host cache and not videocore -+** cache. If one requires to change the videocore cache behavior, then a new block -+** must be created to replace the old one. -+** -+** On successful locking, a valid pointer is returned that the application can use -+** to access to data inside the block. There is no guarantee that the pointer will -+** stay valid following the unlock action corresponding to this lock. -+** -+** -+** Unocking memory blocks. -+** -+** When the memory block has been allocated in a host cached fashion, unlocking the -+** memory block (and so forgiving its ownership) will trigger a cache flush unless -+** explicitely asked not to flush the cache for performances reasons. -+** -+** For the above reason and when using host cached allocation, it is important that -+** an application properly implements the lock/unlock mechanism to ensure cache will -+** stay coherent, otherwise there is no guarantee it will at all be. -+** -+** -+** A complete API is defined below. -+*/ -+ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+ -+/* Different status that can be dumped. -+*/ -+typedef enum -+{ -+ VCSM_STATUS_VC_WALK_ALLOC = 0, // Walks *all* the allocation on videocore. -+ // Result of the walk is seen in the videocore -+ // log. -+ VCSM_STATUS_HOST_WALK_MAP, // Walks the *full* mapping allocation on host -+ // driver (ie for all processes). Result of -+ // the walk is seen in the kernel log. -+ VCSM_STATUS_HOST_WALK_PID_MAP, // Walks the per process mapping allocation on host -+ // driver (for current process). Result of -+ // the walk is seen in the kernel log. -+ VCSM_STATUS_HOST_WALK_PID_ALLOC, // Walks the per process host allocation on host -+ // driver (for current process). Result of -+ // the walk is seen in the kernel log. -+ VCSM_STATUS_VC_MAP_ALL, // Equivalent to both VCSM_STATUS_VC_WALK_ALLOC and -+ // VCSM_STATUS_HOST_WALK_MAP. -+ // -+ VCSM_STATUS_NONE, // Must be last - invalid. -+ -+} VCSM_STATUS_T; -+ -+/* Different kind of cache behavior. -+*/ -+typedef enum -+{ -+ VCSM_CACHE_TYPE_NONE = 0, // No caching applies. -+ VCSM_CACHE_TYPE_HOST, // Allocation is cached on host (user space). -+ VCSM_CACHE_TYPE_VC, // Allocation is cached on videocore. -+ VCSM_CACHE_TYPE_HOST_AND_VC, // Allocation is cached on both host and videocore. -+ -+} VCSM_CACHE_TYPE_T; -+ -+/* Initialize the vcsm processing. -+** -+** Must be called once before attempting to do anything else. -+** -+** Returns 0 on success, -1 on error. -+*/ -+int vcsm_init( void ); -+ -+ -+/* Terminates the vcsm processing. -+** -+** Must be called vcsm services are no longer needed, it will -+** take care of removing any allocation under the current process -+** control if deemed necessary. -+*/ -+void vcsm_exit( void ); -+ -+ -+/* Queries the status of the the vcsm. -+** -+** Triggers dump of various kind of information, see the -+** different variants specified in VCSM_STATUS_T. -+** -+** Pid is optional. -+*/ -+void vcsm_status( VCSM_STATUS_T status, int pid ); -+ -+ -+/* Allocates a non-cached block of memory of size 'size' via the vcsm memory -+** allocator. -+** -+** Returns: 0 on error -+** a non-zero opaque handle on success. -+** -+** On success, the user must invoke vcsm_lock with the returned opaque -+** handle to gain access to the memory associated with the opaque handle. -+** When finished using the memory, the user calls vcsm_unlock_xx (see those -+** function definition for more details on the one that can be used). -+** -+** A well behaved application should make every attempt to lock/unlock -+** only for the duration it needs to access the memory data associated with -+** the opaque handle. -+*/ -+unsigned int vcsm_malloc( unsigned int size, char *name ); -+ -+ -+/* Allocates a cached block of memory of size 'size' via the vcsm memory -+** allocator, the type of caching requested is passed as argument of the -+** function call. -+** -+** Returns: 0 on error -+** a non-zero opaque handle on success. -+** -+** On success, the user must invoke vcsm_lock with the returned opaque -+** handle to gain access to the memory associated with the opaque handle. -+** When finished using the memory, the user calls vcsm_unlock_xx (see those -+** function definition for more details on the one that can be used). -+** -+** A well behaved application should make every attempt to lock/unlock -+** only for the duration it needs to access the memory data associated with -+** the opaque handle. -+*/ -+unsigned int vcsm_malloc_cache( unsigned int size, VCSM_CACHE_TYPE_T cache, char *name ); -+ -+ -+/* Shares an allocated block of memory via the vcsm memory allocator. -+** -+** Returns: 0 on error -+** a non-zero opaque handle on success. -+** -+** On success, the user must invoke vcsm_lock with the returned opaque -+** handle to gain access to the memory associated with the opaque handle. -+** When finished using the memory, the user calls vcsm_unlock_xx (see those -+** function definition for more details on the one that can be used). -+** -+** A well behaved application should make every attempt to lock/unlock -+** only for the duration it needs to access the memory data associated with -+** the opaque handle. -+*/ -+unsigned int vcsm_malloc_share( unsigned int handle ); -+ -+ -+/* Resizes a block of memory allocated previously by vcsm_alloc. -+** -+** Returns: 0 on success -+** -errno on error. -+** -+** The handle must be unlocked by user prior to attempting any -+** resize action. -+** -+** On error, the original size allocated against the handle -+** remains available the same way it would be following a -+** successful vcsm_malloc. -+*/ -+int vcsm_resize( unsigned int handle, unsigned int new_size ); -+ -+ -+/* Frees a block of memory that was successfully allocated by -+** a prior call the vcms_alloc. -+** -+** The handle should be considered invalid upon return from this -+** call. -+** -+** Whether any memory is actually freed up or not as the result of -+** this call will depends on many factors, if all goes well it will -+** be freed. If something goes wrong, the memory will likely end up -+** being freed up as part of the vcsm_exit process. In the end the -+** memory is guaranteed to be freed one way or another. -+*/ -+void vcsm_free( unsigned int handle ); -+ -+ -+/* Retrieves a videocore opaque handle from a mapped user address -+** pointer. The videocore handle will correspond to the actual -+** memory mapped in videocore. -+** -+** Returns: 0 on error -+** a non-zero opaque handle on success. -+** -+** Note: the videocore opaque handle is distinct from the user -+** opaque handle (allocated via vcsm_malloc) and it is only -+** significant for such application which knows what to do -+** with it, for the others it is just a number with little -+** use since nothing can be done with it (in particular -+** for safety reason it cannot be used to map anything). -+*/ -+unsigned int vcsm_vc_hdl_from_ptr( void *usr_ptr ); -+ -+ -+/* Retrieves a videocore opaque handle from a opaque handle -+** pointer. The videocore handle will correspond to the actual -+** memory mapped in videocore. -+** -+** Returns: 0 on error -+** a non-zero opaque handle on success. -+** -+** Note: the videocore opaque handle is distinct from the user -+** opaque handle (allocated via vcsm_malloc) and it is only -+** significant for such application which knows what to do -+** with it, for the others it is just a number with little -+** use since nothing can be done with it (in particular -+** for safety reason it cannot be used to map anything). -+*/ -+unsigned int vcsm_vc_hdl_from_hdl( unsigned int handle ); -+ -+ -+/* Retrieves a user opaque handle from a mapped user address -+** pointer. -+** -+** Returns: 0 on error -+** a non-zero opaque handle on success. -+*/ -+unsigned int vcsm_usr_handle( void *usr_ptr ); -+ -+ -+/* Retrieves a mapped user address from an opaque user -+** handle. -+** -+** Returns: 0 on error -+** a non-zero address on success. -+** -+** On success, the address corresponds to the pointer -+** which can access the data allocated via the vcsm_malloc -+** call. -+*/ -+void *vcsm_usr_address( unsigned int handle ); -+ -+ -+/* Locks the memory associated with this opaque handle. -+** -+** Returns: NULL on error -+** a valid pointer on success. -+** -+** A user MUST lock the handle received from vcsm_malloc -+** in order to be able to use the memory associated with it. -+** -+** On success, the pointer returned is only valid within -+** the lock content (ie until a corresponding vcsm_unlock_xx -+** is invoked). -+*/ -+void *vcsm_lock( unsigned int handle ); -+ -+ -+/* Locks the memory associated with this opaque handle. The lock -+** also gives a chance to update the *host* cache behavior of the -+** allocated buffer if so desired. The *videocore* cache behavior -+** of the allocated buffer cannot be changed by this call and such -+** attempt will be ignored. -+** -+** The system will attempt to honour the cache_update mode request, -+** the cache_result mode will provide the final answer on which cache -+** mode is really in use. Failing to change the cache mode will not -+** result in a failure to lock the buffer as it is an application -+** decision to choose what to do if (cache_result != cache_update) -+** -+** The value returned in cache_result can only be considered valid if -+** the returned pointer is non NULL. The cache_result pointer may be -+** NULL if the application does not care about the actual outcome of -+** its action with regards to the cache behavior change. -+** -+** Returns: NULL on error -+** a valid pointer on success. -+** -+** A user MUST lock the handle received from vcsm_malloc -+** in order to be able to use the memory associated with it. -+** -+** On success, the pointer returned is only valid within -+** the lock content (ie until a corresponding vcsm_unlock_xx -+** is invoked). -+*/ -+void *vcsm_lock_cache( unsigned int handle, -+ VCSM_CACHE_TYPE_T cache_update, -+ VCSM_CACHE_TYPE_T *cache_result ); -+ -+ -+/* Unlocks the memory associated with this user mapped address. -+** -+** Returns: 0 on success -+** -errno on error. -+** -+** After unlocking a mapped address, the user should no longer -+** attempt to reference it. -+*/ -+int vcsm_unlock_ptr( void *usr_ptr ); -+ -+ -+/* Unlocks the memory associated with this user mapped address. -+** Apply special processing that would override the otherwise -+** default behavior. -+** -+** If 'cache_no_flush' is specified: -+** Do not flush cache as the result of the unlock (if cache -+** flush was otherwise applicable in this case). -+** -+** Returns: 0 on success -+** -errno on error. -+** -+** After unlocking a mapped address, the user should no longer -+** attempt to reference it. -+*/ -+int vcsm_unlock_ptr_sp( void *usr_ptr, int cache_no_flush ); -+ -+ -+/* Unlocks the memory associated with this user opaque handle. -+** -+** Returns: 0 on success -+** -errno on error. -+** -+** After unlocking an opaque handle, the user should no longer -+** attempt to reference the mapped addressed once associated -+** with it. -+*/ -+int vcsm_unlock_hdl( unsigned int handle ); -+ -+ -+/* Unlocks the memory associated with this user opaque handle. -+** Apply special processing that would override the otherwise -+** default behavior. -+** -+** If 'cache_no_flush' is specified: -+** Do not flush cache as the result of the unlock (if cache -+** flush was otherwise applicable in this case). -+** -+** Returns: 0 on success -+** -errno on error. -+** -+** After unlocking an opaque handle, the user should no longer -+** attempt to reference the mapped addressed once associated -+** with it. -+*/ -+int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* __USER_VCSM__H__INCLUDED__ */ --- -2.7.4 - - -From 6cfa5910be47865aaaf58c185587189c332765a6 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Sat, 2 May 2015 21:15:37 +0100 -Subject: [PATCH 04/68] First working version with uncached memory - ---- - libavcodec/hevc.c | 61 +++++- - libavcodec/hevc.h | 12 +- - libavcodec/hevc_cabac.c | 39 +++- - libavcodec/hevc_filter.c | 16 ++ - libavcodec/hevcpred_template.c | 6 + - libavcodec/rpi_hevc_transform.h | 422 +++++++++++++++++++++++++++++++++++++++- - libavcodec/rpi_hevc_transform.s | 153 +++++++++++++-- - libavcodec/rpi_qpu.c | 72 +++++++ - libavcodec/rpi_qpu.h | 1 + - 9 files changed, 736 insertions(+), 46 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index ab55df1..94ff709 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -45,6 +45,8 @@ - #include "rpi_qpu.h" - #endif - -+// #define DISABLE_MC -+ - const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; - - /** -@@ -1079,11 +1081,15 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - for (i = 0; i < (size * size); i++) { - coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); - } -+ printf("Cross component not supported\n"); // TODO -+ exit(-1); - s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); - } - } - - if (lc->tu.cross_pf) { -+ printf("Cross component not supported\n"); // TODO -+ exit(-1); - hls_cross_component_pred(s, 1); - } - for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -@@ -1112,6 +1118,8 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - for (i = 0; i < (size * size); i++) { - coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); - } -+ printf("Cross component not supported\n"); // TODO -+ exit(-1); - s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); - } - } -@@ -1409,6 +1417,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - int idx = ff_hevc_pel_weight[block_w]; - -+#ifdef DISABLE_MC -+ return; -+#endif -+ - x_off += mv->x >> 2; - y_off += mv->y >> 2; - src += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); -@@ -1479,6 +1491,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - uint8_t *src0 = ref0->data[0] + y_off0 * src0stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); - uint8_t *src1 = ref1->data[0] + y_off1 * src1stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); - -+#ifdef DISABLE_MC -+ return; -+#endif -+ - if (x_off0 < QPEL_EXTRA_BEFORE || y_off0 < QPEL_EXTRA_AFTER || - x_off0 >= pic_width - block_w - QPEL_EXTRA_AFTER || - y_off0 >= pic_height - block_h - QPEL_EXTRA_AFTER) { -@@ -1564,6 +1580,10 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, - intptr_t _mx = mx << (1 - hshift); - intptr_t _my = my << (1 - vshift); - -+#ifdef DISABLE_MC -+ return; -+#endif -+ - x_off += mv->x >> (2 + hshift); - y_off += mv->y >> (2 + vshift); - src0 += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); -@@ -1628,6 +1648,10 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF - int hshift = s->ps.sps->hshift[1]; - int vshift = s->ps.sps->vshift[1]; - -+#ifdef DISABLE_MC -+ return; -+#endif -+ - intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift); - intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift); - intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift); -@@ -2367,6 +2391,22 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, - } - - #ifdef RPI -+static void rpi_execute_transform(HEVCContext *s) -+{ -+ int i=2; -+ //int j; -+ //int16_t *coeffs = s->coeffs_buf_arm[i]; -+ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+ //gpu_cache_flush(&s->coeffs_buf[i]); -+ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+} -+ - static void rpi_execute_pred_cmds(HEVCContext *s) - { - int i; -@@ -2387,7 +2427,6 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - } - } - s->num_pred_cmds = 0; -- s->num_coeffs = 0; - } - #endif - -@@ -2434,7 +2473,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); - #ifdef RPI -- if (x_ctb + ctb_size >= s->ps.sps->width) { -+ if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! -+ rpi_execute_transform(s); - rpi_execute_pred_cmds(s); - } - #endif -@@ -3179,7 +3219,9 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - av_freep(&s->unif_mv_cmds); - av_freep(&s->unif_xfm_cmds); - av_freep(&s->univ_pred_cmds); -- av_freep(&s->coeffs_buf); -+ for(i = 0; i < 4; i++) { -+ gpu_free(&s->coeffs_buf[i]); -+ } - #endif - - for (i = 0; i < 3; i++) { -@@ -3246,13 +3288,16 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); - if (!s->univ_pred_cmds) - goto fail; -- s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); -- if (!s->coeffs_buf) -- goto fail; -+ for(i = 0; i < 4; i++) { -+ gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -+ s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -+ if (!s->coeffs_buf_arm[i]) -+ goto fail; -+ } - s->enable_rpi = 0; - - // A little test program -- { -+ /*{ - GPU_MEM_PTR_T p; - int err = gpu_malloc_cached(16, &p); - short *q = (short *)p.arm; -@@ -3273,7 +3318,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - printf(")\n"); - gpu_free(&p); - goto fail; // Early out -- } -+ }*/ - - #endif - -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 7a1c35f..4167985 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -40,6 +40,11 @@ - #include "thread.h" - #include "videodsp.h" - -+// define RPI to split the CABAC/prediction/transform into separate stages -+#ifdef RPI -+#include "rpi_qpu.h" -+#endif -+ - #define MAX_DPB_SIZE 16 // A.4.1 - #define MAX_REFS 16 - -@@ -856,11 +861,12 @@ typedef struct HEVCContext { - HEVCMvCmd *unif_mv_cmds; - HEVCXfmCmd *unif_xfm_cmds; - HEVCPredCmd *univ_pred_cmds; -- int16_t *coeffs_buf; -- int num_mv_cmds; -+ GPU_MEM_PTR_T coeffs_buf[4]; -+ int16_t *coeffs_buf_arm[4]; -+ int num_coeffs[4]; - int num_xfm_cmds; -+ int num_mv_cmds; - int num_pred_cmds; -- int num_coeffs; - #endif - - uint8_t *cabac_state; -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 4e97f06..d1cba86 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1031,6 +1031,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - int vshift = s->ps.sps->vshift[c_idx]; - uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + - ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -+ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; - int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); - uint8_t significant_coeff_group_flag[8][8] = {{0}}; - int explicit_rdpcm_flag = 0; -@@ -1044,6 +1045,18 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - uint8_t dc_scale; - int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : - lc->tu.intra_pred_mode_c; -+#ifdef RPI -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+ if (use_vpu) { -+ coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; -+ s->num_coeffs[log2_trafo_size - 2] += n; -+ } else { -+ coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; -+ s->num_coeffs[0] += n; -+ } -+ } -+#endif - - memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); - -@@ -1488,6 +1501,24 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { - s->hevcdsp.idct_4x4_luma(coeffs); - } else { -+#ifdef RPI -+ if (!use_vpu) { -+ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -+ if (max_xy == 0) -+ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -+ else { -+ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; -+ if (max_xy < 4) -+ col_limit = FFMIN(4, col_limit); -+ else if (max_xy < 8) -+ col_limit = FFMIN(8, col_limit); -+ else if (max_xy < 12) -+ col_limit = FFMIN(24, col_limit); -+ -+ s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); -+ } -+ } -+#else - int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); - if (max_xy == 0) - s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -@@ -1501,6 +1532,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - col_limit = FFMIN(24, col_limit); - s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); - } -+#endif - } - } - if (lc->tu.cross_pf) { -@@ -1512,14 +1544,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - } - #ifdef RPI - if (s->enable_rpi) { -- int16_t *c = s->coeffs_buf + s->num_coeffs; -- int n = trafo_size * trafo_size; - HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -- memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy -- s->num_coeffs += n; -+ //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO - cmd->type = RPI_PRED_TRANSFORM_ADD; - cmd->size = log2_trafo_size; -- cmd->buf = c; -+ cmd->buf = coeffs; - cmd->dst = dst; - cmd->stride = stride; - return; -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 1f33b0c..e4c3da7 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -22,6 +22,10 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+//#define DISABLE_SAO -+//#define DISABLE_DEBLOCK -+//#define DISABLE_STRENGTHS -+ - #include "libavutil/common.h" - #include "libavutil/internal.h" - -@@ -273,6 +277,10 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) - edges[2] = x_ctb == s->ps.sps->ctb_width - 1; - edges[3] = y_ctb == s->ps.sps->ctb_height - 1; - -+#ifdef DISABLE_SAO -+ return; -+#endif -+ - if (restore) { - if (!edges[0]) { - left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]]; -@@ -496,6 +504,10 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->ps.sps->pcm.loop_filter_disable_flag) || - s->ps.pps->transquant_bypass_enable_flag; - -+#ifdef DISABLE_DEBLOCK -+ return; -+#endif -+ - if (x0) { - left_tc_offset = s->deblock[ctb - 1].tc_offset; - left_beta_offset = s->deblock[ctb - 1].beta_offset; -@@ -726,6 +738,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - int boundary_upper, boundary_left; - int i, j, bs; - -+#ifdef DISABLE_STRENGTHS -+ return; -+#endif -+ - boundary_upper = y0 > 0 && !(y0 & 7); - if (boundary_upper && - ((!s->sh.slice_loop_filter_across_slices_enabled_flag && -diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -index 6ae87cc..71c6d52 100644 ---- a/libavcodec/hevcpred_template.c -+++ b/libavcodec/hevcpred_template.c -@@ -20,6 +20,8 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+//#define DISABLE_INTRA -+ - #include "libavutil/pixdesc.h" - - #include "bit_depth_template.c" -@@ -114,6 +116,10 @@ do { \ - int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, s->ps.sps->width) - - (x0 + size_in_luma_h)) >> hshift; - -+#ifdef DISABLE_INTRA -+ return; -+#endif -+ - if (s->ps.pps->constrained_intra_pred_flag == 1) { - int size_in_luma_pu_v = PU(size_in_luma_v); - int size_in_luma_pu_h = PU(size_in_luma_h); -diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -index 85a9102..c0c279f 100644 ---- a/libavcodec/rpi_hevc_transform.h -+++ b/libavcodec/rpi_hevc_transform.h -@@ -3,11 +3,11 @@ unsigned char rpi_hevc_transform [] = { - 3, - 3, - 232, --128, -+32, - 0, - 0, - 0, --20, -+12, - 248, - 0, - 136, -@@ -56,9 +56,9 @@ unsigned char rpi_hevc_transform [] = { - 5, - 232, - 0, --0, - 8, - 0, -+0, - 128, - 69, - 113, -@@ -108,8 +108,8 @@ unsigned char rpi_hevc_transform [] = { - 128, - 2, - 0, --248, --62, -+8, -+2, - 0, - 128, - 144, -@@ -123,13 +123,13 @@ unsigned char rpi_hevc_transform [] = { - 3, - 32, - 8, --16, -+20, - 0, - 76, - 254, - 48, - 192, --9, -+4, - 4, - 32, - 8, -@@ -155,14 +155,46 @@ unsigned char rpi_hevc_transform [] = { - 192, - 41, - 3, --68, -+70, -+192, -+80, -+7, -+164, -+255, -+36, -+204, -+96, -+2, -+0, -+248, -+62, -+0, -+3, -+255, -+55, -+208, -+120, -+3, -+224, -+3, -+190, -+11, -+16, -+139, -+246, -+91, -+0, -+103, -+90, -+0, -+70, - 192, - 80, - 7, - 164, - 255, - 36, --220, -+204, - 96, - 2, - 0, -@@ -182,7 +214,7 @@ unsigned char rpi_hevc_transform [] = { - 16, - 139, - 246, --83, -+91, - 0, - 103, - 90, -@@ -209,4 +241,374 @@ unsigned char rpi_hevc_transform [] = { - 96, - 90, - 0, -+169, -+3, -+3, -+232, -+32, -+0, -+0, -+0, -+12, -+248, -+0, -+136, -+0, -+0, -+192, -+248, -+0, -+0, -+64, -+232, -+0, -+2, -+0, -+0, -+12, -+248, -+0, -+168, -+0, -+0, -+192, -+248, -+0, -+0, -+3, -+232, -+128, -+0, -+0, -+0, -+7, -+232, -+0, -+2, -+0, -+0, -+4, -+232, -+64, -+0, -+0, -+0, -+5, -+232, -+0, -+8, -+0, -+0, -+57, -+239, -+224, -+247, -+255, -+255, -+72, -+192, -+95, -+207, -+88, -+122, -+88, -+124, -+137, -+64, -+26, -+64, -+161, -+64, -+152, -+64, -+128, -+144, -+31, -+0, -+72, -+232, -+32, -+0, -+0, -+0, -+65, -+232, -+32, -+0, -+0, -+0, -+128, -+144, -+23, -+0, -+145, -+64, -+168, -+64, -+128, -+144, -+19, -+0, -+72, -+232, -+32, -+0, -+0, -+0, -+65, -+232, -+32, -+0, -+0, -+0, -+128, -+144, -+11, -+0, -+74, -+232, -+0, -+8, -+0, -+0, -+242, -+140, -+229, -+192, -+57, -+239, -+32, -+8, -+0, -+0, -+41, -+3, -+12, -+248, -+0, -+128, -+0, -+0, -+192, -+8, -+4, -+0, -+12, -+248, -+0, -+132, -+64, -+0, -+192, -+8, -+4, -+0, -+0, -+96, -+255, -+159, -+131, -+255, -+0, -+232, -+0, -+4, -+0, -+0, -+255, -+159, -+142, -+255, -+4, -+255, -+48, -+204, -+16, -+3, -+224, -+251, -+62, -+0, -+5, -+255, -+51, -+204, -+128, -+3, -+224, -+251, -+16, -+0, -+77, -+254, -+51, -+204, -+9, -+4, -+224, -+251, -+0, -+0, -+128, -+64, -+6, -+232, -+64, -+0, -+0, -+0, -+140, -+248, -+47, -+0, -+0, -+0, -+224, -+99, -+0, -+0, -+4, -+254, -+0, -+144, -+128, -+2, -+0, -+8, -+2, -+0, -+32, -+247, -+240, -+207, -+16, -+3, -+32, -+247, -+176, -+207, -+17, -+3, -+32, -+247, -+112, -+207, -+18, -+3, -+32, -+247, -+48, -+207, -+19, -+3, -+32, -+247, -+240, -+206, -+20, -+3, -+32, -+247, -+176, -+206, -+21, -+3, -+32, -+247, -+112, -+206, -+22, -+3, -+32, -+247, -+48, -+206, -+23, -+3, -+32, -+247, -+240, -+205, -+24, -+3, -+32, -+247, -+176, -+205, -+25, -+3, -+32, -+247, -+112, -+205, -+26, -+3, -+32, -+247, -+48, -+205, -+27, -+3, -+32, -+247, -+240, -+204, -+28, -+3, -+32, -+247, -+176, -+204, -+29, -+3, -+32, -+247, -+112, -+204, -+30, -+3, -+32, -+247, -+48, -+204, -+31, -+3, -+5, -+255, -+51, -+204, -+128, -+3, -+224, -+251, -+16, -+0, -+77, -+254, -+51, -+204, -+9, -+4, -+224, -+251, -+0, -+0, -+0, -+237, -+0, -+4, -+0, -+0, -+140, -+248, -+47, -+0, -+0, -+0, -+224, -+99, -+0, -+0, -+90, -+0, - }; -diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -index 5e2728d..1e389c7 100644 ---- a/libavcodec/rpi_hevc_transform.s -+++ b/libavcodec/rpi_hevc_transform.s -@@ -58,13 +58,6 @@ - # - # - --test_add: -- vldh HX(0,0),(r0) -- vadd HX(0,0),HX(0,0),10 -- vsth HX(0,0),(r0) -- mov r0,7 # return value -- b lr -- - # Columns are transformed first - # - # Store top left half of transMatrix2 in -@@ -79,7 +72,7 @@ test_add: - # - - --# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) -+# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) # TODO add size so we can branch to correct implementation (or perhaps have coeffs32 and num32 as secondary inputs!) - # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) - # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) - # num: number of 16x16 transforms to be done -@@ -87,17 +80,17 @@ test_add: - hevc_trans_16x16: - push r6-r15, lr # TODO cut down number of used registers - -- mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes -- vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -+ mov r3, 16*2 # Stride of transMatrix2 in bytes -+ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix - # Now use r0 to describe which matrix we are working on. - # Allows us to prefetch the next block of coefficients for efficiency. - mov r0,0 # This describes the location where we read our coefficients from -- mov r3,16*2 # Stride of coefficients in bytes -+ mov r3,16*2 # Stride of coefficients in bytes (TODO remove) - mov r7,16*16*2 # Total block size - mov r8,64*16 # Value used to swap from current to next VRF location - vldh HX(0++,0)+r0,(r1 += r3) REP 16 - mov r4,64 # Constant used for rounding first pass -- mov r5,1<<19 # Constant used for rounding second pass -+ mov r5,1<<11 # Constant used for rounding second pass - - # At start of block r0,r1 point to the current block (that has already been loaded) - block_loop: -@@ -113,12 +106,12 @@ block_loop: - vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate - #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. - vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -- vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position -+ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # For simplicity transpose this back to the original position - - bl col_trans_16 -- vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -- #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -- vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r5 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # 4+12=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # This should be saturating, but the instruction above does not assemble? (Probably because it ends with ls which is interpreted as a condition flag) - - # Save results - note there has been a transposition during the processing so we save columns - vsth VX(0,32++)+r0, (r1 += r3) REP 16 -@@ -132,16 +125,136 @@ block_loop: - - # r1,r2,r3 r7,r8 should be preserved - # HX(0++,0)+r0 is the block to be transformed --# HX(32++,0) is the 16x16 matrix of transform coefficients -+# HX(32++,0)+r6 is the 16x16 matrix of transform coefficients - # Use HY(48,0) for intermediate results - # r0 can be used, but should be returned to its original value at the end - col_trans_16: -- add r4,r0,16 # Final value for this loop -+ add r6,r0,16 # Final value for this loop - col_trans_16_loop: - # First compute partial products for a single column -- vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 -+ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 - # Then sum up the results and place back - vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -- addcmpblt r0,1,r4,col_trans_16_loop -+ addcmpblt r0,1,r6,col_trans_16_loop - sub r0,16 # but r0 back to its original value - b lr -+ -+col_trans_odd_16: -+ add r6,r0,16 # Final value for this loop -+col_trans_odd_16_loop: -+ # First compute partial products for a single column -+ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_odd_16_loop -+ sub r0,16 # but r0 back to its original value -+ b lr -+ -+ -+test_add: -+ vldh HX(0,0),(r0) -+ vadd HX(0,0),HX(0,0),10 -+ vsth HX(0,0),(r0) -+ mov r0,7 # return value -+ b lr -+ -+# hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -+# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) Even followed by odd -+# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+# num: number of 16x16 transforms to be done -+# -+hevc_trans_32x32: -+ push r6-r15, lr # TODO cut down number of used registers -+ -+ # Fetch transform matrices -+ mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -+ vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -+ add r0, 16*16*2 -+ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ -+ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer -+ mov r7, 16*16*2 # Total block size -+ mov r4, 64 # Constant used for rounding first pass -+ mov r5, 1<<11 # Constant used for rounding second pass -+ sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) -+ # set r8 to 32byte aligned stack pointer -+ add r8,sp,31 -+ lsr r8,5 -+ lsl r8,5 -+ mov r9,r8 # Backup of the temporary storage -+ mov r10,r1 # Backup of the coefficient buffer -+block_loop32: -+ -+ # COLUMN TRANSFORM -+ # Transform the first 16 columns -+ mov r1,r10 # Input Coefficient buffer -+ mov r8,r9 # Output temporary storage -+ bl trans32 -+ # Transform the second 16 columns -+ add r8,32 -+ add r1,32 -+ bl trans32 -+ -+ # ROW TRANSFORM -+ mov r1,r9 # Input temporary storage -+ mov r8,r10 # Output Coefficient buffer -+ bl trans32 -+ # Transform the second 16 columns -+ add r8,32 -+ add r1,32 -+ bl trans32 -+ -+ add r10, 32*32*2 # move onto next block of coefficients -+ addcmpbgt r2,-1,0,block_loop32 -+ -+ add sp,sp,32*32*2+32 # Restore stack -+ -+ pop r6-r15, pc -+ -+trans32: -+ # We can no longer afford the VRF space to do prefetching when doing 32x32 -+ # Fetch the even rows -+ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -+ # Fetch the odd rows -+ vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -+ -+ # Transform the even rows using even matrix -+ mov r0, 0 # Even rows -+ bl col_trans_16 -+ -+ # Now transform the odd rows using odd matrix -+ mov r0, 64*16 # Odd rows -+ bl col_trans_odd_16 -+ -+ # Now apply butterfly to compute the first 16 results -+ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -+ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -+ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -+ # 16bit results now in HX(48,32) -+ mov r0,r8 -+ mov r6,32*2 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed -+ -+ # Now apply butterfly to compute the second 16 results (in reverse order) -+ vsub HY(63,0),HY(0,0),HY(16,0) -+ vsub HY(62,0),HY(0,0),HY(17,0) -+ vsub HY(61,0),HY(0,0),HY(18,0) -+ vsub HY(60,0),HY(0,0),HY(19,0) -+ vsub HY(59,0),HY(0,0),HY(20,0) -+ vsub HY(58,0),HY(0,0),HY(21,0) -+ vsub HY(57,0),HY(0,0),HY(22,0) -+ vsub HY(56,0),HY(0,0),HY(23,0) -+ vsub HY(55,0),HY(0,0),HY(24,0) -+ vsub HY(54,0),HY(0,0),HY(25,0) -+ vsub HY(53,0),HY(0,0),HY(26,0) -+ vsub HY(52,0),HY(0,0),HY(27,0) -+ vsub HY(51,0),HY(0,0),HY(28,0) -+ vsub HY(50,0),HY(0,0),HY(29,0) -+ vsub HY(49,0),HY(0,0),HY(30,0) -+ vsub HY(48,0),HY(0,0),HY(31,0) -+ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -+ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -+ add r0,r8,16*32*2 # Move to 16th row -+ vsth VX(48,32++),(r0+=r6) REP 16 -+ b lr -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index b1f50ee..d720546 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -3,6 +3,7 @@ - // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. - #define RPI_USE_VCSM - #define RPI_TIME_TOTAL_QPU -+#define RPI_TIME_TOTAL_VPU - - #include - #include -@@ -48,10 +49,47 @@ typedef int int32_t; - #define QPU_CODE_SIZE 2048 - #define VPU_CODE_SIZE 2048 - -+const short rpi_transMatrix2even[32][16] = { // Even rows first -+{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, -+{90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90}, -+{89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89}, -+{87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87}, -+{83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83}, -+{80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80}, -+{75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75}, -+{70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70}, -+{64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64}, -+{57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57}, -+{50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50}, -+{43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43}, -+{36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36}, -+{25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25}, -+{18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18}, -+{ 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9}, -+// Odd rows -+{90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4}, -+{90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13}, -+{88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22}, -+{85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31}, -+{82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38}, -+{78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46}, -+{73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54}, -+{67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61}, -+{61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67}, -+{54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73}, -+{46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78}, -+{38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82}, -+{31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85}, -+{22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88}, -+{13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90}, -+{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90} -+}; -+ - struct GPU - { - unsigned int qpu_code[QPU_CODE_SIZE]; - unsigned int vpu_code[VPU_CODE_SIZE]; -+ short transMatrix2even[16*16]; - int open_count; // Number of allocated video buffers - unsigned int vc_handle; // Handle of this memory - int mb; // Mailbox handle -@@ -123,6 +161,8 @@ static int gpu_init(volatile struct GPU **gpu) { - assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); - memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); - } -+ // And the transform coefficients -+ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); - - return 0; - } -@@ -274,11 +314,43 @@ unsigned int vpu_get_fn(void) { - return gpu->vc + offsetof(struct GPU,vpu_code); - } - -+unsigned int vpu_get_constants(void) { -+ if (gpu==NULL) { -+ gpu_lock(); -+ gpu_unlock(); -+ } -+ return gpu->vc + offsetof(struct GPU,transMatrix2even); -+} -+ - unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) - { - unsigned r; -+#ifdef RPI_TIME_TOTAL_VPU -+ static int last_time=0; -+ static long long on_time=0; -+ static long long off_time=0; -+ int start_time; -+ int end_time; -+ static int count=0; -+ static long long countr2=0; -+#endif - gpu_lock(); -+#ifdef RPI_TIME_TOTAL_VPU -+ start_time = Microseconds(); -+ if (last_time==0) -+ last_time = start_time; -+ off_time += start_time-last_time; -+#endif - r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); -+#ifdef RPI_TIME_TOTAL_VPU -+ end_time = Microseconds(); -+ last_time = end_time; -+ on_time += end_time - start_time; -+ count++; -+ countr2 += r2; -+ if ((count&0x7f)==0) -+ printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); -+#endif - gpu_unlock(); - return r; - } -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 4e3c35c..814fc3c 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -34,6 +34,7 @@ extern unsigned int qpu_get_fn(int num); - - // VPU specific functions - extern unsigned int vpu_get_fn(void); -+extern unsigned int vpu_get_constants(void); - extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); - - // Simple test of shader code --- -2.7.4 - - -From 4bb0a7ba6723650e74d63cec2123f76da4c3eb0e Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 5 May 2015 09:41:23 +0100 -Subject: [PATCH 05/68] Fixed deblocking - ---- - libavcodec/hevc.c | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 94ff709..391c57a 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2400,8 +2400,9 @@ static void rpi_execute_transform(HEVCContext *s) - // s->hevcdsp.idct[4-2](coeffs, 16); - //} - -- //gpu_cache_flush(&s->coeffs_buf[i]); -+ gpu_cache_flush(&s->coeffs_buf[i]); - vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -+ gpu_cache_flush(&s->coeffs_buf[i]); - - for(i=0;i<4;i++) - s->num_coeffs[i] = 0; -@@ -2440,6 +2441,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; - - #ifdef RPI -+ int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; - s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. - #endif - -@@ -2473,9 +2475,17 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); - #ifdef RPI -- if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+ // Transform all blocks - rpi_execute_transform(s); -+ // Perform intra prediction and residual reconstruction - rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles -+ ff_hevc_hls_filters(s, x, y_ctb, ctb_size); -+ } -+ start_ctb_x = 0; - } - #endif - if (more_data < 0) { -@@ -2486,6 +2496,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - - ctb_addr_ts++; - ff_hevc_save_states(s, ctb_addr_ts); -+#ifdef RPI -+ if (s->enable_rpi) -+ continue; -+#endif - ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); - } - -@@ -3289,7 +3303,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - if (!s->univ_pred_cmds) - goto fail; - for(i = 0; i < 4; i++) { -- gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -+ gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes - s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; - if (!s->coeffs_buf_arm[i]) - goto fail; --- -2.7.4 - - -From 9079ef888e3d81a69f3c802ddc3c5134679e74a6 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 5 May 2015 11:32:30 +0100 -Subject: [PATCH 06/68] Added 32x32 transform - ---- - libavcodec/hevc.c | 8 +- - libavcodec/hevc_cabac.c | 4 +- - libavcodec/rpi_hevc_transform.h | 200 +++++++++++++++++----------------------- - libavcodec/rpi_hevc_transform.s | 102 ++++++++++---------- - libavcodec/rpi_qpu.c | 4 +- - 5 files changed, 148 insertions(+), 170 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 391c57a..0dde6f2 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2400,9 +2400,11 @@ static void rpi_execute_transform(HEVCContext *s) - // s->hevcdsp.idct[4-2](coeffs, 16); - //} - -- gpu_cache_flush(&s->coeffs_buf[i]); -- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -- gpu_cache_flush(&s->coeffs_buf[i]); -+ gpu_cache_flush(&s->coeffs_buf[2]); -+ gpu_cache_flush(&s->coeffs_buf[3]); -+ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); -+ gpu_cache_flush(&s->coeffs_buf[2]); -+ gpu_cache_flush(&s->coeffs_buf[3]); - - for(i=0;i<4;i++) - s->num_coeffs[i] = 0; -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index d1cba86..88aa959 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1031,7 +1031,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - int vshift = s->ps.sps->vshift[c_idx]; - uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + - ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; -+#ifdef RPI -+ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; -+#endif - int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); - uint8_t significant_coeff_group_flag[8][8] = {{0}}; - int explicit_rdpcm_flag = 0; -diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -index c0c279f..6d772d7 100644 ---- a/libavcodec/rpi_hevc_transform.h -+++ b/libavcodec/rpi_hevc_transform.h -@@ -1,6 +1,10 @@ - unsigned char rpi_hevc_transform [] = { - 169, - 3, -+62, -+64, -+79, -+64, - 3, - 232, - 32, -@@ -17,6 +21,22 @@ unsigned char rpi_hevc_transform [] = { - 248, - 0, - 0, -+64, -+232, -+0, -+2, -+0, -+0, -+12, -+248, -+0, -+168, -+0, -+0, -+192, -+248, -+0, -+0, - 0, - 96, - 3, -@@ -79,7 +99,7 @@ unsigned char rpi_hevc_transform [] = { - 70, - 128, - 144, --39, -+40, - 0, - 4, - 255, -@@ -113,7 +133,7 @@ unsigned char rpi_hevc_transform [] = { - 0, - 128, - 144, --22, -+23, - 0, - 4, - 255, -@@ -153,6 +173,8 @@ unsigned char rpi_hevc_transform [] = { - 140, - 211, - 192, -+34, -+31, - 41, - 3, - 70, -@@ -195,7 +217,7 @@ unsigned char rpi_hevc_transform [] = { - 255, - 36, - 204, --96, -+224, - 2, - 0, - 248, -@@ -219,62 +241,10 @@ unsigned char rpi_hevc_transform [] = { - 103, - 90, - 0, --8, --240, --0, --128, --128, --3, --0, --247, --32, --128, --10, --4, --136, --240, --32, --0, --128, --3, --112, --96, --90, --0, --169, --3, --3, --232, --32, --0, --0, --0, --12, --248, --0, --136, --0, --0, --192, --248, --0, --0, -+225, -+64, -+242, - 64, --232, --0, --2, --0, --0, --12, --248, --0, --168, --0, --0, --192, --248, --0, --0, - 3, - 232, - 128, -@@ -287,18 +257,6 @@ unsigned char rpi_hevc_transform [] = { - 2, - 0, - 0, --4, --232, --64, --0, --0, --0, --5, --232, --0, --8, --0, --0, - 57, - 239, - 224, -@@ -317,18 +275,26 @@ unsigned char rpi_hevc_transform [] = { - 64, - 26, - 64, -+4, -+232, -+64, -+0, -+0, -+0, -+149, -+96, - 161, - 64, - 152, - 64, - 128, - 144, --31, -+35, - 0, - 72, - 232, --32, - 0, -+4, - 0, - 0, - 65, -@@ -339,8 +305,16 @@ unsigned char rpi_hevc_transform [] = { - 0, - 128, - 144, --23, -+27, -+0, -+4, -+232, -+0, -+8, - 0, -+0, -+69, -+96, - 145, - 64, - 168, -@@ -351,8 +325,8 @@ unsigned char rpi_hevc_transform [] = { - 0, - 72, - 232, --32, - 0, -+4, - 0, - 0, - 65, -@@ -373,7 +347,7 @@ unsigned char rpi_hevc_transform [] = { - 0, - 242, - 140, --229, -+221, - 192, - 57, - 239, -@@ -383,6 +357,8 @@ unsigned char rpi_hevc_transform [] = { - 0, - 41, - 3, -+239, -+3, - 12, - 248, - 0, -@@ -390,7 +366,7 @@ unsigned char rpi_hevc_transform [] = { - 0, - 0, - 192, --8, -+248, - 4, - 0, - 12, -@@ -400,14 +376,14 @@ unsigned char rpi_hevc_transform [] = { - 64, - 0, - 192, --8, -+248, - 4, - 0, - 0, - 96, - 255, - 159, --131, -+154, - 255, - 0, - 232, -@@ -417,7 +393,7 @@ unsigned char rpi_hevc_transform [] = { - 0, - 255, - 159, --142, -+165, - 255, - 4, - 255, -@@ -429,7 +405,7 @@ unsigned char rpi_hevc_transform [] = { - 251, - 62, - 0, --5, -+4, - 255, - 51, - 204, -@@ -439,15 +415,15 @@ unsigned char rpi_hevc_transform [] = { - 251, - 16, - 0, --77, -+76, - 254, - 51, - 204, --9, --4, -+128, -+3, - 224, - 251, --0, -+20, - 0, - 128, - 64, -@@ -467,16 +443,6 @@ unsigned char rpi_hevc_transform [] = { - 99, - 0, - 0, --4, --254, --0, --144, --128, --2, --0, --8, --2, --0, - 32, - 247, - 240, -@@ -488,92 +454,92 @@ unsigned char rpi_hevc_transform [] = { - 176, - 207, - 17, --3, -+19, - 32, - 247, - 112, - 207, - 18, --3, -+35, - 32, - 247, - 48, - 207, - 19, --3, -+51, - 32, - 247, - 240, - 206, - 20, --3, -+67, - 32, - 247, - 176, - 206, - 21, --3, -+83, - 32, - 247, - 112, - 206, - 22, --3, -+99, - 32, - 247, - 48, - 206, - 23, --3, -+115, - 32, - 247, - 240, - 205, - 24, --3, -+131, - 32, - 247, - 176, - 205, - 25, --3, -+147, - 32, - 247, - 112, - 205, - 26, --3, -+163, - 32, - 247, - 48, - 205, - 27, --3, -+179, - 32, - 247, - 240, - 204, - 28, --3, -+195, - 32, - 247, - 176, - 204, - 29, --3, -+211, - 32, - 247, - 112, - 204, - 30, --3, -+227, - 32, - 247, - 48, - 204, - 31, --3, --5, -+243, -+4, - 255, - 51, - 204, -@@ -583,20 +549,20 @@ unsigned char rpi_hevc_transform [] = { - 251, - 16, - 0, --77, -+76, - 254, - 51, - 204, --9, --4, -+128, -+3, - 224, - 251, --0, -+20, - 0, - 0, - 237, -+32, - 0, --4, - 0, - 0, - 140, -@@ -609,6 +575,6 @@ unsigned char rpi_hevc_transform [] = { - 99, - 0, - 0, --90, --0, -+111, -+3, - }; -diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -index 1e389c7..afdb32a 100644 ---- a/libavcodec/rpi_hevc_transform.s -+++ b/libavcodec/rpi_hevc_transform.s -@@ -76,12 +76,19 @@ - # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) - # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) - # num: number of 16x16 transforms to be done -+# coeffs32 -+# num32: number of 32x32 transforms - # - hevc_trans_16x16: - push r6-r15, lr # TODO cut down number of used registers -- -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 - mov r3, 16*2 # Stride of transMatrix2 in bytes - vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -+ -+ add r0, 16*16*2 # For 32x32 transforms we also need this matrix -+ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ - # Now use r0 to describe which matrix we are working on. - # Allows us to prefetch the next block of coefficients for efficiency. - mov r0,0 # This describes the location where we read our coefficients from -@@ -121,6 +128,10 @@ block_loop: - add r1,r7 - - addcmpbgt r2,-1,0,block_loop -+ -+ # Now go and do any 32x32 transforms -+ b hevc_trans_32x32 -+ - pop r6-r15, pc - - # r1,r2,r3 r7,r8 should be preserved -@@ -136,26 +147,18 @@ col_trans_16_loop: - # Then sum up the results and place back - vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC - addcmpblt r0,1,r6,col_trans_16_loop -- sub r0,16 # but r0 back to its original value -+ sub r0,16 # put r0 back to its original value - b lr - - col_trans_odd_16: - add r6,r0,16 # Final value for this loop - col_trans_odd_16_loop: - # First compute partial products for a single column -- vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -+ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,32++) REP 16 - # Then sum up the results and place back - vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC - addcmpblt r0,1,r6,col_trans_odd_16_loop -- sub r0,16 # but r0 back to its original value -- b lr -- -- --test_add: -- vldh HX(0,0),(r0) -- vadd HX(0,0),HX(0,0),10 -- vsth HX(0,0),(r0) -- mov r0,7 # return value -+ sub r0,16 # put r0 back to its original value - b lr - - # hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -@@ -164,18 +167,17 @@ test_add: - # num: number of 16x16 transforms to be done - # - hevc_trans_32x32: -- push r6-r15, lr # TODO cut down number of used registers -+ mov r1,r14 # coeffs -+ mov r2,r15 # num - -- # Fetch transform matrices -- mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -- vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -- add r0, 16*16*2 -- vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ # Fetch odd transform matrix -+ #mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -+ #vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -+ #add r0, 16*16*2 -+ #vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix - - mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer - mov r7, 16*16*2 # Total block size -- mov r4, 64 # Constant used for rounding first pass -- mov r5, 1<<11 # Constant used for rounding second pass - sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) - # set r8 to 32byte aligned stack pointer - add r8,sp,31 -@@ -186,21 +188,27 @@ hevc_trans_32x32: - block_loop32: - - # COLUMN TRANSFORM -+ mov r4, 64 # Constant used for rounding first pass -+ mov r5, 9 # left shift used for rounding first pass -+ - # Transform the first 16 columns - mov r1,r10 # Input Coefficient buffer - mov r8,r9 # Output temporary storage - bl trans32 - # Transform the second 16 columns -- add r8,32 -+ add r8,32*16*2 - add r1,32 - bl trans32 - - # ROW TRANSFORM -+ mov r4, 1<<11 # Constant used for rounding second pass -+ mov r5, 4 # left shift used for rounding second pass -+ - mov r1,r9 # Input temporary storage - mov r8,r10 # Output Coefficient buffer - bl trans32 - # Transform the second 16 columns -- add r8,32 -+ add r8,32*16*2 - add r1,32 - bl trans32 - -@@ -212,11 +220,12 @@ block_loop32: - pop r6-r15, pc - - trans32: -+ push lr - # We can no longer afford the VRF space to do prefetching when doing 32x32 - # Fetch the even rows -- vldh HX(0++,0)+r0,(r1 += r3) REP 16 -+ vldh HX(0++,0),(r1 += r3) REP 16 - # Fetch the odd rows -- vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -+ vldh HX(16++,0),64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 - - # Transform the even rows using even matrix - mov r0, 0 # Even rows -@@ -228,33 +237,32 @@ trans32: - - # Now apply butterfly to compute the first 16 results - vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -+ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -+ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate - # 16bit results now in HX(48,32) - mov r0,r8 - mov r6,32*2 - vsth VX(48,32++),(r0+=r6) REP 16 -- vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed - - # Now apply butterfly to compute the second 16 results (in reverse order) -- vsub HY(63,0),HY(0,0),HY(16,0) -- vsub HY(62,0),HY(0,0),HY(17,0) -- vsub HY(61,0),HY(0,0),HY(18,0) -- vsub HY(60,0),HY(0,0),HY(19,0) -- vsub HY(59,0),HY(0,0),HY(20,0) -- vsub HY(58,0),HY(0,0),HY(21,0) -- vsub HY(57,0),HY(0,0),HY(22,0) -- vsub HY(56,0),HY(0,0),HY(23,0) -- vsub HY(55,0),HY(0,0),HY(24,0) -- vsub HY(54,0),HY(0,0),HY(25,0) -- vsub HY(53,0),HY(0,0),HY(26,0) -- vsub HY(52,0),HY(0,0),HY(27,0) -- vsub HY(51,0),HY(0,0),HY(28,0) -- vsub HY(50,0),HY(0,0),HY(29,0) -- vsub HY(49,0),HY(0,0),HY(30,0) -- vsub HY(48,0),HY(0,0),HY(31,0) -- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -- add r0,r8,16*32*2 # Move to 16th row -+ vsub HY(63,0),HY(0 ,0),HY(16,0) -+ vsub HY(62,0),HY(1 ,0),HY(17,0) -+ vsub HY(61,0),HY(2 ,0),HY(18,0) -+ vsub HY(60,0),HY(3 ,0),HY(19,0) -+ vsub HY(59,0),HY(4 ,0),HY(20,0) -+ vsub HY(58,0),HY(5 ,0),HY(21,0) -+ vsub HY(57,0),HY(6 ,0),HY(22,0) -+ vsub HY(56,0),HY(7 ,0),HY(23,0) -+ vsub HY(55,0),HY(8 ,0),HY(24,0) -+ vsub HY(54,0),HY(9 ,0),HY(25,0) -+ vsub HY(53,0),HY(10,0),HY(26,0) -+ vsub HY(52,0),HY(11,0),HY(27,0) -+ vsub HY(51,0),HY(12,0),HY(28,0) -+ vsub HY(50,0),HY(13,0),HY(29,0) -+ vsub HY(49,0),HY(14,0),HY(30,0) -+ vsub HY(48,0),HY(15,0),HY(31,0) -+ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -+ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -+ add r0,r8,32 - vsth VX(48,32++),(r0+=r6) REP 16 -- b lr -+ pop pc -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index d720546..12ad5fb 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -89,7 +89,7 @@ struct GPU - { - unsigned int qpu_code[QPU_CODE_SIZE]; - unsigned int vpu_code[VPU_CODE_SIZE]; -- short transMatrix2even[16*16]; -+ short transMatrix2even[16*16*2]; - int open_count; // Number of allocated video buffers - unsigned int vc_handle; // Handle of this memory - int mb; // Mailbox handle -@@ -162,7 +162,7 @@ static int gpu_init(volatile struct GPU **gpu) { - memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); - } - // And the transform coefficients -- memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); -+ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); - - return 0; - } --- -2.7.4 - - -From 6c2ed6109c4dd5c8ab16bf16e0ae3be6ae166e50 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 5 May 2015 16:57:03 +0100 -Subject: [PATCH 07/68] Clear coefficients in advance - ---- - libavcodec/hevc.c | 129 ++++++++++++++++++++++++++++------------ - libavcodec/hevc.h | 6 +- - libavcodec/hevc_cabac.c | 7 ++- - libavcodec/rpi_hevc_transform.h | 50 ++++++++++++++++ - libavcodec/rpi_hevc_transform.s | 16 +++++ - 5 files changed, 168 insertions(+), 40 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 0dde6f2..1424007 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -43,6 +43,8 @@ - - #ifdef RPI - #include "rpi_qpu.h" -+// For some unknown reason, the code seems to crash if I do a late malloc -+#define EARLY_MALLOC - #endif - - // #define DISABLE_MC -@@ -61,6 +63,20 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - /* free everything allocated by pic_arrays_init() */ - static void pic_arrays_free(HEVCContext *s) - { -+#ifdef RPI -+#ifdef EARLY_MALLOC -+#else -+ printf("pic_arrays_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+ gpu_free(&s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = 0; -+ } -+ if (s->coeffs_buf_arm[2]) { -+ gpu_free(&s->coeffs_buf_accelerated); -+ s->coeffs_buf_arm[2] = 0; -+ } -+#endif -+#endif - av_freep(&s->sao); - av_freep(&s->deblock); - -@@ -97,6 +113,28 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - int ctb_count = sps->ctb_width * sps->ctb_height; - int min_pu_size = sps->min_pu_width * sps->min_pu_height; - -+#ifdef RPI -+#ifdef EARLY_MALLOC -+#else -+ int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+ printf("pic_arrays_init\n"); -+ printf("Allocated %d\n",coefs_per_row); -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+ if (!s->coeffs_buf_arm[0]) -+ goto fail; -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+ if (!s->coeffs_buf_arm[2]) -+ goto fail; -+ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+ printf("Done\n"); -+#endif -+#endif -+ - s->bs_width = (width >> 2) + 1; - s->bs_height = (height >> 2) + 1; - -@@ -2400,11 +2438,10 @@ static void rpi_execute_transform(HEVCContext *s) - // s->hevcdsp.idct[4-2](coeffs, 16); - //} - -- gpu_cache_flush(&s->coeffs_buf[2]); -- gpu_cache_flush(&s->coeffs_buf[3]); -- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); -- gpu_cache_flush(&s->coeffs_buf[2]); -- gpu_cache_flush(&s->coeffs_buf[3]); -+ -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -+ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); - - for(i=0;i<4;i++) - s->num_coeffs[i] = 0; -@@ -2426,7 +2463,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - lc->na.cand_up_right = (cmd->na >> 0) & 1; - s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); - } else { -+ int trafo_size = 1 << cmd->size; - s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -+ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache - } - } - s->num_pred_cmds = 0; -@@ -3235,10 +3274,18 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - av_freep(&s->unif_mv_cmds); - av_freep(&s->unif_xfm_cmds); - av_freep(&s->univ_pred_cmds); -- for(i = 0; i < 4; i++) { -- gpu_free(&s->coeffs_buf[i]); -+ -+#ifdef EARLY_MALLOC -+ if (s->coeffs_buf_arm[0]) { -+ gpu_free(&s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = 0; -+ } -+ if (s->coeffs_buf_arm[2]) { -+ gpu_free(&s->coeffs_buf_accelerated); -+ s->coeffs_buf_arm[2] = 0; - } - #endif -+#endif - - for (i = 0; i < 3; i++) { - av_freep(&s->sao_pixel_buffer_h[i]); -@@ -3281,6 +3328,16 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - return 0; - } - -+#ifdef RPI -+static av_cold void memclear16(int16_t *p, int n) -+{ -+ vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); -+ //int i; -+ //for(i=0;ipriv_data; -@@ -3304,37 +3361,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); - if (!s->univ_pred_cmds) - goto fail; -- for(i = 0; i < 4; i++) { -- gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -- s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -- if (!s->coeffs_buf_arm[i]) -- goto fail; -- } -- s->enable_rpi = 0; - -- // A little test program -- /*{ -- GPU_MEM_PTR_T p; -- int err = gpu_malloc_cached(16, &p); -- short *q = (short *)p.arm; -- int i; -- int r; -- printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); -- printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); -- printf("Preparing data %p\n",q); -- for(i=0;i<16;i++) -- q[i] = i; -- printf("Flush cache\n"); -- gpu_cache_flush(&p); -- printf("Executing code\n"); -- r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); -- printf("Return value %d (",r); -- for(i=0;i<16;i++) -- printf("%d ",q[i]); -- printf(")\n"); -- gpu_free(&p); -- goto fail; // Early out -- }*/ -+ s->coeffs_buf_arm[0] = 0; -+ s->coeffs_buf_arm[2] = 0; -+ -+#ifdef EARLY_MALLOC -+ int coeffs_in_ctb = 64*64; -+ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -+ printf("Allocated %d\n",coefs_per_row); -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+ if (!s->coeffs_buf_arm[0]) -+ goto fail; -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+ if (!s->coeffs_buf_arm[2]) -+ goto fail; -+ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+ printf("Done\n"); -+ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[2], coefs_per_row); -+ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+#endif -+ -+ s->enable_rpi = 0; - - #endif - -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 4167985..9a228f6 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -861,8 +861,12 @@ typedef struct HEVCContext { - HEVCMvCmd *unif_mv_cmds; - HEVCXfmCmd *unif_xfm_cmds; - HEVCPredCmd *univ_pred_cmds; -- GPU_MEM_PTR_T coeffs_buf[4]; -+ int buf_width; -+ GPU_MEM_PTR_T coeffs_buf_default; -+ GPU_MEM_PTR_T coeffs_buf_accelerated; - int16_t *coeffs_buf_arm[4]; -+ unsigned int coeffs_buf_vc[4]; -+ - int num_coeffs[4]; - int num_xfm_cmds; - int num_mv_cmds; -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 88aa959..dbfee85 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1058,9 +1058,13 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - s->num_coeffs[0] += n; - } - } -+ // We now do the memset after transform_add while we know the data is cached. -+ //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+#else -+ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); - #endif - -- memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ - - // Derive QP for dequant - if (!lc->cu.cu_transquant_bypass_flag) { -@@ -1547,7 +1551,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - #ifdef RPI - if (s->enable_rpi) { - HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -- //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO - cmd->type = RPI_PRED_TRANSFORM_ADD; - cmd->size = log2_trafo_size; - cmd->buf = coeffs; -diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -index 6d772d7..4f13622 100644 ---- a/libavcodec/rpi_hevc_transform.h -+++ b/libavcodec/rpi_hevc_transform.h -@@ -1,4 +1,10 @@ - unsigned char rpi_hevc_transform [] = { -+21, -+106, -+0, -+144, -+35, -+1, - 169, - 3, - 62, -@@ -577,4 +583,48 @@ unsigned char rpi_hevc_transform [] = { - 0, - 111, - 3, -+4, -+254, -+0, -+128, -+0, -+4, -+0, -+248, -+0, -+0, -+2, -+232, -+32, -+0, -+0, -+0, -+140, -+248, -+32, -+0, -+0, -+0, -+224, -+35, -+0, -+0, -+64, -+232, -+0, -+2, -+0, -+0, -+193, -+232, -+0, -+1, -+0, -+0, -+1, -+106, -+116, -+30, -+90, -+0, - }; -diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -index afdb32a..fd159bc 100644 ---- a/libavcodec/rpi_hevc_transform.s -+++ b/libavcodec/rpi_hevc_transform.s -@@ -78,8 +78,11 @@ - # num: number of 16x16 transforms to be done - # coeffs32 - # num32: number of 32x32 transforms -+# command 0 for transform, 1 for memclear16(int16_t *dst,num16) - # - hevc_trans_16x16: -+ cmp r5,1 -+ beq memclear16 - push r6-r15, lr # TODO cut down number of used registers - mov r14,r3 # coeffs32 - mov r15,r4 # num32 -@@ -266,3 +269,16 @@ trans32: - add r0,r8,32 - vsth VX(48,32++),(r0+=r6) REP 16 - pop pc -+ -+memclear16: -+ # r0 is address -+ # r1 is number of 16bits values to set to 0 (may overrun past end and clear more than specified) -+ vmov HX(0++,0),0 REP 16 -+ mov r2,32 -+loop: -+ vsth HX(0++,0),(r0+=r2) REP 16 -+ add r0,16*16*2 -+ sub r1,16*16 -+ cmp r1,0 -+ bgt loop -+ b lr --- -2.7.4 - - -From 48282c2fb55c0d9a72222f384c03c432f78a3016 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 6 May 2015 09:56:43 +0100 -Subject: [PATCH 08/68] Prepared inter offload - ---- - libavcodec/hevc.c | 116 +++++++++++++++++++++++++++++++++++++++++++----- - libavcodec/hevc.h | 29 +++++++++++- - libavcodec/hevc_cabac.c | 5 ++- - 3 files changed, 137 insertions(+), 13 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 1424007..8215201 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -45,6 +45,8 @@ - #include "rpi_qpu.h" - // For some unknown reason, the code seems to crash if I do a late malloc - #define EARLY_MALLOC -+// Move Inter prediction into separate pass -+//#define RPI_INTER - #endif - - // #define DISABLE_MC -@@ -1440,6 +1442,95 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) - * @param luma_offset additive offset applied to the luma prediction value - */ - -+#ifdef RPI_INTER -+#define RPI_REDIRECT(fn) rpi_ ## fn -+static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+{ -+ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_LUMA_UNI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+ cmd->src = ref->data[0]; -+ cmd->srcstride = ref->linesize[0]; -+ cmd->mv = *mv; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+ cmd->weight = luma_weight; -+ cmd->offset = luma_offset; -+} -+ -+static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+{ -+ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_LUMA_BI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+ cmd->src = ref->data[0]; -+ cmd->srcstride = ref->linesize[0]; -+ cmd->mv = *mv; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+ cmd->weight = luma_weight; -+ cmd->offset = luma_offset; -+ cmd->src1 = ref1->data[]; -+ cmd->srcstride1 = ref1->linesize[0]; -+ cmd->mv1 = *mv1; -+ cmd->ref_idx[0] = current_mv->ref_idx[0]; -+ cmd->ref_idx[1] = current_mv->ref_idx[1]; -+} -+ -+static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -+{ -+ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_CHROMA_UNI; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+ cmd->src = src0; -+ cmd->srcstride = srcstride; -+ cmd->mv = current_mv->mv[reflist]; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+ cmd->weight = chroma_weight; -+ cmd->offset = chroma_offset; -+} -+ -+static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -+{ -+ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+ cmd->src = ref0->data[cidx+1]; -+ cmd->srcstride = ref0->linesize[cidx+1]; -+ cmd->mv = current_mv->mv[reflist]; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+ cmd->weight = chroma_weight; -+ cmd->offset = chroma_offset; -+ cmd->src = ref1->data[cidx+1]; -+ cmd->srcstride1 = ref1->linesize[cidx+1]; -+ cmd->ref_idx[0] = current_mv->ref_idx[0]; -+ cmd->ref_idx[1] = current_mv->ref_idx[1]; -+} -+#else -+#define RPI_REDIRECT(fn) fn -+#endif -+ - static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref, const Mv *mv, int x_off, int y_off, - int block_w, int block_h, int luma_weight, int luma_offset) -@@ -1505,7 +1596,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - * @param mv1 motion vector1 (relative to block position) to get pixel data from - * @param current_mv current motion vector structure - */ -- static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref0, const Mv *mv0, int x_off, int y_off, - int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) - { -@@ -1887,16 +1978,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int nPbW_c = nPbW >> s->ps.sps->hshift[1]; - int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - -- luma_mc_uni(s, dst0, s->frame->linesize[0], ref0->frame, -+ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, - ¤t_mv.mv[0], x0, y0, nPbW, nPbH, - s->sh.luma_weight_l0[current_mv.ref_idx[0]], - s->sh.luma_offset_l0[current_mv.ref_idx[0]]); - - if (s->ps.sps->chroma_format_idc) { -- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -+ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], - 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, - s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); -- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], -+ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], - 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, - s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1]); - } -@@ -1906,17 +1997,17 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int nPbW_c = nPbW >> s->ps.sps->hshift[1]; - int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - -- luma_mc_uni(s, dst0, s->frame->linesize[0], ref1->frame, -+ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, - ¤t_mv.mv[1], x0, y0, nPbW, nPbH, - s->sh.luma_weight_l1[current_mv.ref_idx[1]], - s->sh.luma_offset_l1[current_mv.ref_idx[1]]); - - if (s->ps.sps->chroma_format_idc) { -- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -+ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], - 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, - s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); - -- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], -+ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], - 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, - s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1]); - } -@@ -1926,15 +2017,15 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int nPbW_c = nPbW >> s->ps.sps->hshift[1]; - int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - -- luma_mc_bi(s, dst0, s->frame->linesize[0], ref0->frame, -+ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, - ¤t_mv.mv[0], x0, y0, nPbW, nPbH, - ref1->frame, ¤t_mv.mv[1], ¤t_mv); - - if (s->ps.sps->chroma_format_idc) { -- chroma_mc_bi(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -+ RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, - x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); - -- chroma_mc_bi(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, -+ RPI_REDIRECT(chroma_mc_bi)(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, - x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1); - } - } -@@ -2465,7 +2556,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - } else { - int trafo_size = 1 << cmd->size; - s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -+#ifdef RPI_PRECLEAR - memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -+#endif - } - } - s->num_pred_cmds = 0; -@@ -3381,6 +3474,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; - s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; - printf("Done\n"); -+#ifdef RPI_PRECLEAR - //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); - memclear16(s->coeffs_buf_arm[0], coefs_per_row); - //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -@@ -3389,6 +3483,8 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - memclear16(s->coeffs_buf_arm[3], coefs_per_row); - #endif - -+#endif -+ - s->enable_rpi = 0; - - #endif -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 9a228f6..1ac119a 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -803,14 +803,39 @@ typedef struct HEVCLocalContext { - // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code - #define RPI_MAX_WIDTH 2048 - --// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane --#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -+#define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) - #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) - // Each block can have an intra prediction and a transform_add command - #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) - -+#define RPI_CMD_LUMA_UNI 0 -+#define RPI_CMD_CHROMA_UNI 1 -+#define RPI_CMD_LUMA_BI 2 -+#define RPI_CMD_U_BI 3 -+#define RPI_CMD_V_BI 4 -+ -+// RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? -+// #define RPI_PRECLEAR -+ - // Command for inter prediction - typedef struct HEVCMvCmd { -+ int cmd; -+ uint8_t *dst; -+ ptrdiff_t dststride; -+ uint8_t *src; -+ ptrdiff_t srcstride; -+ Mv mv; -+ int x_off; -+ int y_off; -+ int block_w; -+ int block_h; -+ int weight; -+ int offset; -+ uint8_t *src1; -+ ptrdiff_t srcstride1; -+ Mv mv1; -+ int8_t ref_idx[2]; - } HEVCMvCmd; - - // Command for transform to process a block of coefficients -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index dbfee85..4f072be 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1059,7 +1059,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - } - } - // We now do the memset after transform_add while we know the data is cached. -- //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ #ifdef RPI_PRECLEAR -+ #else -+ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ #endif - #else - memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); - #endif --- -2.7.4 - - -From 25d3b4e876febe08302a01abd85d5009160ead3e Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 6 May 2015 11:08:50 +0100 -Subject: [PATCH 09/68] Inter prediction in separate pass - ---- - libavcodec/hevc.c | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- - libavcodec/hevc.h | 2 +- - 2 files changed, 77 insertions(+), 18 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 8215201..b7bc6ad 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -46,7 +46,7 @@ - // For some unknown reason, the code seems to crash if I do a late malloc - #define EARLY_MALLOC - // Move Inter prediction into separate pass --//#define RPI_INTER -+#define RPI_INTER - #endif - - // #define DISABLE_MC -@@ -1448,7 +1448,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref, const Mv *mv, int x_off, int y_off, - int block_w, int block_h, int luma_weight, int luma_offset) - { -- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; - cmd->cmd = RPI_CMD_LUMA_UNI; - cmd->dst = dst; - cmd->dststride = dststride; -@@ -1467,31 +1467,29 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref0, const Mv *mv0, int x_off, int y_off, - int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) - { -- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; - cmd->cmd = RPI_CMD_LUMA_BI; - cmd->dst = dst; - cmd->dststride = dststride; -- cmd->src = ref->data[0]; -- cmd->srcstride = ref->linesize[0]; -- cmd->mv = *mv; -+ cmd->src = ref0->data[0]; -+ cmd->srcstride = ref0->linesize[0]; -+ cmd->mv = *mv0; - cmd->x_off = x_off; - cmd->y_off = y_off; - cmd->block_w = block_w; - cmd->block_h = block_h; -- cmd->weight = luma_weight; -- cmd->offset = luma_offset; -- cmd->src1 = ref1->data[]; -+ cmd->src1 = ref1->data[0]; - cmd->srcstride1 = ref1->linesize[0]; - cmd->mv1 = *mv1; - cmd->ref_idx[0] = current_mv->ref_idx[0]; - cmd->ref_idx[1] = current_mv->ref_idx[1]; - } - --static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, - ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, - int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) - { -- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; - cmd->cmd = RPI_CMD_CHROMA_UNI; - cmd->dst = dst0; - cmd->dststride = dststride; -@@ -1506,27 +1504,27 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, - cmd->offset = chroma_offset; - } - --static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -+static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, - int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) - { -- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; - cmd->cmd = RPI_CMD_CHROMA_BI+cidx; - cmd->dst = dst0; - cmd->dststride = dststride; - cmd->src = ref0->data[cidx+1]; - cmd->srcstride = ref0->linesize[cidx+1]; -- cmd->mv = current_mv->mv[reflist]; -+ cmd->mv = current_mv->mv[0]; -+ cmd->mv1 = current_mv->mv[1]; - cmd->x_off = x_off; - cmd->y_off = y_off; - cmd->block_w = block_w; - cmd->block_h = block_h; -- cmd->weight = chroma_weight; -- cmd->offset = chroma_offset; -- cmd->src = ref1->data[cidx+1]; -+ cmd->src1 = ref1->data[cidx+1]; - cmd->srcstride1 = ref1->linesize[cidx+1]; - cmd->ref_idx[0] = current_mv->ref_idx[0]; - cmd->ref_idx[1] = current_mv->ref_idx[1]; - } -+ - #else - #define RPI_REDIRECT(fn) fn - #endif -@@ -2554,7 +2552,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - lc->na.cand_up_right = (cmd->na >> 0) & 1; - s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); - } else { -+#ifdef RPI_PRECLEAR - int trafo_size = 1 << cmd->size; -+#endif - s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); - #ifdef RPI_PRECLEAR - memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -@@ -2563,6 +2563,61 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - } - s->num_pred_cmds = 0; - } -+ -+static void rpi_execute_inter_cmds(HEVCContext *s) -+{ -+ HEVCMvCmd *cmd = s->unif_mv_cmds; -+ int n,cidx; -+ AVFrame myref; -+ AVFrame myref1; -+ struct MvField mymv; -+ if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { -+ printf("Overflow inter_cmds\n"); -+ exit(-1); -+ } -+ for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { -+ switch(cmd->cmd) { -+ case RPI_CMD_LUMA_UNI: -+ myref.data[0] = cmd->src; -+ myref.linesize[0] = cmd->srcstride; -+ luma_mc_uni(s, cmd->dst, cmd->dststride, &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, cmd->weight, cmd->offset); -+ break; -+ case RPI_CMD_LUMA_BI: -+ myref.data[0] = cmd->src; -+ myref.linesize[0] = cmd->srcstride; -+ myref1.data[0] = cmd->src1; -+ myref1.linesize[0] = cmd->srcstride1; -+ mymv.ref_idx[0] = cmd->ref_idx[0]; -+ mymv.ref_idx[1] = cmd->ref_idx[1]; -+ luma_mc_bi(s, cmd->dst, cmd->dststride, -+ &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, -+ &myref1, &cmd->mv1, &mymv); -+ break; -+ case RPI_CMD_CHROMA_UNI: -+ mymv.mv[0] = cmd->mv; -+ chroma_mc_uni(s, cmd->dst, -+ cmd->dststride, cmd->src, cmd->srcstride, 0, -+ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cmd->weight, cmd->offset); -+ break; -+ case RPI_CMD_CHROMA_BI: -+ case RPI_CMD_CHROMA_BI+1: -+ cidx = cmd->cmd - RPI_CMD_CHROMA_BI; -+ myref.data[cidx+1] = cmd->src; -+ myref.linesize[cidx+1] = cmd->srcstride; -+ myref1.data[cidx+1] = cmd->src1; -+ myref1.linesize[cidx+1] = cmd->srcstride1; -+ mymv.ref_idx[0] = cmd->ref_idx[0]; -+ mymv.ref_idx[1] = cmd->ref_idx[1]; -+ mymv.mv[0] = cmd->mv; -+ mymv.mv[1] = cmd->mv1; -+ chroma_mc_bi(s, cmd->dst, cmd->dststride, &myref, &myref1, -+ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cidx); -+ break; -+ } -+ } -+ s->num_mv_cmds = 0; -+} -+ - #endif - - static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -@@ -2611,6 +2666,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #ifdef RPI - if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { - int x; -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); - // Transform all blocks - rpi_execute_transform(s); - // Perform intra prediction and residual reconstruction -@@ -3422,6 +3479,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - } - - #ifdef RPI -+#ifdef RPI_PRECLEAR - static av_cold void memclear16(int16_t *p, int n) - { - vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); -@@ -3430,6 +3488,7 @@ static av_cold void memclear16(int16_t *p, int n) - // p[i] = 0; - } - #endif -+#endif - - static av_cold int hevc_init_context(AVCodecContext *avctx) - { -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 1ac119a..a0eb71b 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -812,7 +812,7 @@ typedef struct HEVCLocalContext { - #define RPI_CMD_LUMA_UNI 0 - #define RPI_CMD_CHROMA_UNI 1 - #define RPI_CMD_LUMA_BI 2 --#define RPI_CMD_U_BI 3 -+#define RPI_CMD_CHROMA_BI 3 - #define RPI_CMD_V_BI 4 - - // RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? --- -2.7.4 - - -From 8af0a0a036e4bb3883f144d0567bc527772dd65b Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 6 May 2015 13:03:50 +0100 -Subject: [PATCH 10/68] Added VPU thread - ---- - libavcodec/hevc.c | 11 +++-- - libavcodec/hevc.h | 1 + - libavcodec/rpi_qpu.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++-- - libavcodec/rpi_qpu.h | 2 + - 4 files changed, 133 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index b7bc6ad..98dbd69 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2529,8 +2529,10 @@ static void rpi_execute_transform(HEVCContext *s) - - - gpu_cache_flush(&s->coeffs_buf_accelerated); -- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); - //gpu_cache_flush(&s->coeffs_buf_accelerated); -+ //vpu_wait(s->vpu_id); - - for(i=0;i<4;i++) - s->num_coeffs[i] = 0; -@@ -2666,10 +2668,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #ifdef RPI - if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { - int x; -- // Perform inter prediction -- rpi_execute_inter_cmds(s); - // Transform all blocks - rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); - // Perform intra prediction and residual reconstruction - rpi_execute_pred_cmds(s); - // Perform deblocking for CTBs in this row -@@ -3426,6 +3430,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - av_freep(&s->univ_pred_cmds); - - #ifdef EARLY_MALLOC -+ printf("hevc_decode_free\n"); - if (s->coeffs_buf_arm[0]) { - gpu_free(&s->coeffs_buf_default); - s->coeffs_buf_arm[0] = 0; -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index a0eb71b..0d8dfe9 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -896,6 +896,7 @@ typedef struct HEVCContext { - int num_xfm_cmds; - int num_mv_cmds; - int num_pred_cmds; -+ int vpu_id; - #endif - - uint8_t *cabac_state; -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 12ad5fb..378dd74 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -1,9 +1,13 @@ - #ifdef RPI --// Use the vcsm device for shared memory -+// define RPI_USE_VCSM to use the vcsm device for shared memory - // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. - #define RPI_USE_VCSM --#define RPI_TIME_TOTAL_QPU --#define RPI_TIME_TOTAL_VPU -+// define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+//#define RPI_TIME_TOTAL_QPU -+// define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+//#define RPI_TIME_TOTAL_VPU -+// define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+#define RPI_ASYNC - - #include - #include -@@ -113,6 +117,19 @@ static unsigned int Microseconds(void) { - } - #endif - -+#ifdef RPI_ASYNC -+pthread_t vpu_thread; -+static void *vpu_start(void *arg); -+ -+#define MAXCMDS 128 -+static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; -+static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+static int vpu_cmds[MAXCMDS][8]; -+static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+static volatile int vpu_async_head=0; -+#endif -+ - // Connect to QPU, returns 0 on success. - static int gpu_init(volatile struct GPU **gpu) { - int mb = mbox_open(); -@@ -164,12 +181,27 @@ static int gpu_init(volatile struct GPU **gpu) { - // And the transform coefficients - memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); - -+#ifdef RPI_ASYNC -+ { -+ int err; -+ vpu_async_tail = 0; -+ vpu_async_head = 0; -+ err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); -+ //printf("Created thread\n"); -+ if (err) { -+ printf("Failed to create vpu thread\n"); -+ return -4; -+ } -+ } -+#endif -+ - return 0; - } - - // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. - static void gpu_lock(void) { - pthread_mutex_lock(&gpu_mutex); -+ - if (gpu==NULL) { - gpu_init(&gpu); - } -@@ -264,6 +296,16 @@ static void gpu_term(void) - unsigned handle = gpu->vc_handle; - if (gpu==NULL) - return; -+ -+#ifdef RPI_ASYNC -+ { -+ void *res; -+ vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); -+ pthread_join(vpu_thread, &res); -+ } -+#endif -+ -+ - unmapmem((void*)gpu, sizeof(struct GPU)); - mem_unlock(mb, handle); - mem_free(mb, handle); -@@ -322,6 +364,79 @@ unsigned int vpu_get_constants(void) { - return gpu->vc + offsetof(struct GPU,transMatrix2even); - } - -+#ifdef RPI_ASYNC -+ -+static void *vpu_start(void *arg) { -+ while(1) { -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -+ pthread_cond_wait(&post_cond, &post_mutex); -+ } -+ int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ pthread_mutex_unlock(&post_mutex); -+ -+ if (p[6] == -1) { -+ break; // Last job -+ } -+ if (p[7]) { -+ GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+ } -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond); -+ pthread_mutex_unlock(&post_mutex); -+ } -+ -+ return NULL; -+} -+ -+// Post a command to the queue -+// Returns an id which we can use to wait for completion -+int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) -+{ -+ pthread_mutex_lock(&post_mutex); -+ { -+ int id = vpu_async_tail++; -+ int *p = vpu_cmds[id%MAXCMDS]; -+ int num = vpu_async_tail - vpu_async_head; -+ if (num>MAXCMDS) { -+ printf("Too many commands submitted\n"); -+ exit(-1); -+ } -+ p[0] = code; -+ p[1] = r0; -+ p[2] = r1; -+ p[3] = r2; -+ p[4] = r3; -+ p[5] = r4; -+ p[6] = r5; -+ p[7] = (int) buf; -+ if (num<=1) -+ pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+ return id; -+ } -+} -+ -+// Wait for completion of the given command -+void vpu_wait(int id) -+{ -+ pthread_mutex_lock(&post_mutex); -+ while( id + 1 - vpu_async_head > 0) -+ { -+ pthread_cond_wait(&post_cond, &post_mutex); -+ } -+ pthread_mutex_unlock(&post_mutex); -+} -+ -+#endif -+ -+ - unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) - { - unsigned r; -@@ -334,7 +449,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, - static int count=0; - static long long countr2=0; - #endif -+#ifndef RPI_ASYNC - gpu_lock(); -+#endif - #ifdef RPI_TIME_TOTAL_VPU - start_time = Microseconds(); - if (last_time==0) -@@ -351,7 +468,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, - if ((count&0x7f)==0) - printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); - #endif -+#ifndef RPI_ASYNC - gpu_unlock(); -+#endif - return r; - } - -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 814fc3c..3526fce 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -36,6 +36,8 @@ extern unsigned int qpu_get_fn(int num); - extern unsigned int vpu_get_fn(void); - extern unsigned int vpu_get_constants(void); - extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -+extern void vpu_wait( int id); - - // Simple test of shader code - extern int rpi_test_shader(void); --- -2.7.4 - - -From 016d3db644e60fbe272bfcf1d7c3670c82422317 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 6 May 2015 15:03:37 +0100 -Subject: [PATCH 11/68] Added different signal when tail moves - ---- - libavcodec/rpi_qpu.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 378dd74..d1c3e20 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -122,7 +122,8 @@ pthread_t vpu_thread; - static void *vpu_start(void *arg); - - #define MAXCMDS 128 --static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; -+static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -+static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; - static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; - - static int vpu_cmds[MAXCMDS][8]; -@@ -372,7 +373,7 @@ static void *vpu_start(void *arg) { - while( vpu_async_tail - vpu_async_head <= 0) - { - //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -- pthread_cond_wait(&post_cond, &post_mutex); -+ pthread_cond_wait(&post_cond_tail, &post_mutex); - } - int *p = vpu_cmds[vpu_async_head%MAXCMDS]; - pthread_mutex_unlock(&post_mutex); -@@ -388,7 +389,7 @@ static void *vpu_start(void *arg) { - - pthread_mutex_lock(&post_mutex); - vpu_async_head++; -- pthread_cond_broadcast(&post_cond); -+ pthread_cond_broadcast(&post_cond_head); - pthread_mutex_unlock(&post_mutex); - } - -@@ -417,7 +418,7 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned - p[6] = r5; - p[7] = (int) buf; - if (num<=1) -- pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake -+ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake - pthread_mutex_unlock(&post_mutex); - return id; - } -@@ -429,7 +430,7 @@ void vpu_wait(int id) - pthread_mutex_lock(&post_mutex); - while( id + 1 - vpu_async_head > 0) - { -- pthread_cond_wait(&post_cond, &post_mutex); -+ pthread_cond_wait(&post_cond_head, &post_mutex); - } - pthread_mutex_unlock(&post_mutex); - } --- -2.7.4 - - -From b04a72641253dc89fd1ec688035c3e2a946aa370 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 7 May 2015 08:57:11 +0100 -Subject: [PATCH 12/68] Add option to test for gpu_idle - ---- - libavcodec/hevc.c | 3 ++- - libavcodec/rpi_qpu.c | 18 ++++++++++++++++++ - 2 files changed, 20 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 98dbd69..2e269b6 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2527,7 +2527,6 @@ static void rpi_execute_transform(HEVCContext *s) - // s->hevcdsp.idct[4-2](coeffs, 16); - //} - -- - gpu_cache_flush(&s->coeffs_buf_accelerated); - s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); - //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -@@ -2669,6 +2668,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { - int x; - // Transform all blocks -+ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ - rpi_execute_transform(s); - // Perform inter prediction - rpi_execute_inter_cmds(s); -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index d1c3e20..85f49db 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -199,6 +199,17 @@ static int gpu_init(volatile struct GPU **gpu) { - return 0; - } - -+// Returns 1 if the gpu is currently idle -+static int gpu_idle(void) -+{ -+ int ret = pthread_mutex_trylock(&gpu_mutex); -+ if (ret==0) { -+ pthread_mutex_unlock(&gpu_mutex); -+ return 1; -+ } -+ return 0; -+} -+ - // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. - static void gpu_lock(void) { - pthread_mutex_lock(&gpu_mutex); -@@ -400,6 +411,13 @@ static void *vpu_start(void *arg) { - // Returns an id which we can use to wait for completion - int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) - { -+ // If the gpu is idle then just run the command immediately -+ // This works, but doesn't seem to give any benefit -+ // if (gpu_idle()) { -+ // vpu_execute_code( code, r0, r1, r2, r3, r4, r5); -+ // return -1; // TODO perhaps a wraparound bug here? -+ // } -+ - pthread_mutex_lock(&post_mutex); - { - int id = vpu_async_tail++; --- -2.7.4 - - -From e7b457e683d4ca92bf2677b69708fbfc3849847b Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 7 May 2015 11:01:35 +0100 -Subject: [PATCH 13/68] Added deblocking pass - ---- - libavcodec/hevc.c | 33 +++++++++++++++++++++++++++------ - libavcodec/hevc.h | 7 ++++++- - libavcodec/hevc_filter.c | 6 +++++- - libavcodec/rpi_qpu.c | 2 +- - 4 files changed, 39 insertions(+), 9 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 2e269b6..29f8415 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2518,6 +2518,17 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, - } - - #ifdef RPI -+static void rpi_execute_dblk_cmds(HEVCContext *s) -+{ -+ int n; -+ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -+ int (*p)[2] = s->dblk_cmds; -+ for(n = s->num_dblk_cmds; n>0 ;n--,p++) { -+ ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); -+ } -+ s->num_dblk_cmds = 0; -+} -+ - static void rpi_execute_transform(HEVCContext *s) - { - int i=2; -@@ -2631,7 +2642,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; - - #ifdef RPI -- int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; - s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. - #endif - -@@ -2665,7 +2675,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); - #ifdef RPI -- if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ if (s->enable_rpi) { -+ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { - int x; - // Transform all blocks - //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -@@ -2678,10 +2691,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - // Perform intra prediction and residual reconstruction - rpi_execute_pred_cmds(s); - // Perform deblocking for CTBs in this row -- for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles -- ff_hevc_hls_filters(s, x, y_ctb, ctb_size); -- } -- start_ctb_x = 0; -+ rpi_execute_dblk_cmds(s); -+ } - } - #endif - if (more_data < 0) { -@@ -2699,6 +2710,16 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); - } - -+#ifdef RPI -+ if (s->enable_rpi && s->num_dblk_cmds) { -+ rpi_execute_transform(s); -+ rpi_execute_inter_cmds(s); -+ vpu_wait(s->vpu_id); -+ rpi_execute_pred_cmds(s); -+ rpi_execute_dblk_cmds(s); -+ } -+#endif -+ - if (x_ctb + ctb_size >= s->ps.sps->width && - y_ctb + ctb_size >= s->ps.sps->height) - ff_hevc_hls_filter(s, x_ctb, y_ctb, ctb_size); -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 0d8dfe9..990bd8c 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -808,6 +808,8 @@ typedef struct HEVCLocalContext { - #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) - // Each block can have an intra prediction and a transform_add command - #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+// Worst case is 16x16 CTUs -+#define RPI_MAX_DEBLOCK_CMDS (RPI_MAX_WIDTH*4/16) - - #define RPI_CMD_LUMA_UNI 0 - #define RPI_CMD_CHROMA_UNI 1 -@@ -867,6 +869,9 @@ typedef struct HEVCPredCmd { - #endif - - typedef struct HEVCContext { -+#ifdef RPI -+ int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; -+#endif - const AVClass *c; // needed by private avoptions - AVCodecContext *avctx; - -@@ -891,11 +896,11 @@ typedef struct HEVCContext { - GPU_MEM_PTR_T coeffs_buf_accelerated; - int16_t *coeffs_buf_arm[4]; - unsigned int coeffs_buf_vc[4]; -- - int num_coeffs[4]; - int num_xfm_cmds; - int num_mv_cmds; - int num_pred_cmds; -+ int num_dblk_cmds; - int vpu_id; - #endif - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index e4c3da7..ea0af91 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -877,8 +877,12 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - if (s->threads_type & FF_THREAD_FRAME ) - ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); - } -- } else if (s->threads_type & FF_THREAD_FRAME && x_end) -+ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -+ int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } - } - - void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size) -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 85f49db..3b6dae7 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -105,7 +105,7 @@ struct GPU - static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; - static volatile struct GPU* gpu = NULL; - --#ifdef RPI_TIME_TOTAL_QPU -+#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) - static unsigned int Microseconds(void) { - struct timespec ts; - unsigned int x; --- -2.7.4 - - -From 7a443df9115f21b4428de378bd146dcdba3dd42a Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 7 May 2015 16:47:47 +0100 -Subject: [PATCH 14/68] Added option to disable deblocking for non-ref frames - ---- - libavcodec/hevc_filter.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index ea0af91..2cdd621 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -25,6 +25,8 @@ - //#define DISABLE_SAO - //#define DISABLE_DEBLOCK - //#define DISABLE_STRENGTHS -+// define DISABLE_DEBLOCK_NONREF for a 6% speed boost (by skipping deblocking on unimportant frames) -+//#define DISABLE_DEBLOCK_NONREF - - #include "libavutil/common.h" - #include "libavutil/internal.h" -@@ -504,6 +506,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->ps.sps->pcm.loop_filter_disable_flag) || - s->ps.pps->transquant_bypass_enable_flag; - -+#ifdef DISABLE_DEBLOCK_NONREF -+ if ( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N ) -+ return; // Don't deblock non-reference frames -+#endif - #ifdef DISABLE_DEBLOCK - return; - #endif --- -2.7.4 - - -From 9606e160a582db64ccf981d971cdc258d8cc02f7 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Mon, 11 May 2015 10:00:27 +0100 -Subject: [PATCH 15/68] Moved buffers to VPU memory - ---- - libavcodec/hevc_filter.c | 17 +++++++++++++- - libavcodec/utils.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ - libavutil/buffer.c | 6 +++++ - libavutil/buffer.h | 3 +++ - 4 files changed, 84 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 2cdd621..e1b32d4 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -866,6 +866,13 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - #undef CB - #undef CR - -+#ifdef RPI_INTER_QPU -+static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+} -+#endif -+ - void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - { - int x_end = x >= s->ps.sps->width - ctb_size; -@@ -888,9 +895,17 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); - } - } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -- int newh = y + ctb_size - 4; -+ //int newh = y + ctb_size - 4; - //int currh = s->ref->tf.progress->data[0]; - //if (((y + ctb_size)&63)==0) -+ if (!( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+ } - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); - } - } -diff --git a/libavcodec/utils.c b/libavcodec/utils.c -index f7adb52..708526e 100644 ---- a/libavcodec/utils.c -+++ b/libavcodec/utils.c -@@ -26,6 +26,12 @@ - */ - - #include "config.h" -+ -+#ifdef RPI -+// Move video buffers to GPU memory -+#define RPI_GPU_BUFFERS -+#endif -+ - #include "libavutil/atomic.h" - #include "libavutil/attributes.h" - #include "libavutil/avassert.h" -@@ -64,6 +70,10 @@ - #include "libavutil/ffversion.h" - const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; - -+#ifdef RPI_GPU_BUFFERS -+#include "rpi_qpu.h" -+#endif -+ - #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS - static int default_lockmgr_cb(void **arg, enum AVLockOp op) - { -@@ -503,6 +513,47 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, - return ret; - } - -+#ifdef RPI_GPU_BUFFERS -+static void rpi_buffer_default_free(void *opaque, uint8_t *data) -+{ -+ GPU_MEM_PTR_T *p = opaque; -+ gpu_free(p); -+ av_free(p); -+} -+ -+static AVBufferRef *rpi_buffer_alloc(int size) -+{ -+ AVBufferRef *ret = NULL; -+ uint8_t *data = NULL; -+ GPU_MEM_PTR_T *p; -+ -+ static int total=0; -+ total+=size; -+ -+ p = av_malloc(sizeof *p); -+ if (!p) -+ return NULL; -+ -+ if (gpu_malloc_cached(size,p)<0) // Change this line to choose cached or uncached memory. The caching here refers to the ARM data cache. -+ return NULL; -+ -+ data = p->arm; -+ printf("Rpi alloc %d/%d ARM=%p VC=%x->%x\n",size,total,p->arm,p->vc,p->vc+size); -+ //memset(data, 64, size); -+ -+ if (!data) -+ return NULL; -+ -+ ret = av_buffer_create(data, size, rpi_buffer_default_free, p, 0); -+ if (!ret) { -+ gpu_free(p); -+ av_freep(&p); -+ } -+ -+ return ret; -+} -+#endif -+ - static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) - { - FramePool *pool = avctx->internal->pool; -@@ -550,6 +601,14 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) - av_buffer_pool_uninit(&pool->pools[i]); - pool->linesize[i] = linesize[i]; - if (size[i]) { -+#ifdef RPI_GPU_BUFFERS -+ if (avctx->codec_id == AV_CODEC_ID_HEVC) -+ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, -+ CONFIG_MEMORY_POISONING ? -+ NULL : -+ rpi_buffer_alloc); -+ else -+#endif - pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, - CONFIG_MEMORY_POISONING ? - NULL : -diff --git a/libavutil/buffer.c b/libavutil/buffer.c -index 694e116..203ca7b 100644 ---- a/libavutil/buffer.c -+++ b/libavutil/buffer.c -@@ -425,3 +425,9 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) - - return ret; - } -+ -+// Return the opaque for the underlying frame (gives us a GPU_MEM_PTR_T) -+void *av_buffer_pool_opaque(AVBufferRef *ref) { -+ BufferPoolEntry *buf = av_buffer_get_opaque(ref); -+ return buf->opaque; -+} -diff --git a/libavutil/buffer.h b/libavutil/buffer.h -index 0c0ce12..82e0bc3 100644 ---- a/libavutil/buffer.h -+++ b/libavutil/buffer.h -@@ -283,6 +283,9 @@ void av_buffer_pool_uninit(AVBufferPool **pool); - */ - AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); - -+// Return the opaque for the underlying frame -+void *av_buffer_pool_opaque(AVBufferRef *ref); -+ - /** - * @} - */ --- -2.7.4 - - -From f56515b9a720c829ba3ddf6da4232a91b13e0f03 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Mon, 11 May 2015 14:04:37 +0100 -Subject: [PATCH 16/68] Prepared QPU execute code - ---- - libavcodec/hevc.c | 227 ++++++++++++++++++++++++++++++++++++++++------- - libavcodec/hevc.h | 22 ++++- - libavcodec/hevc_filter.c | 7 +- - libavcodec/rpi_qpu.c | 55 +++++++++++- - libavcodec/rpi_qpu.h | 2 + - 5 files changed, 276 insertions(+), 37 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 29f8415..66ed37a 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -42,17 +42,45 @@ - #include "profiles.h" - - #ifdef RPI --#include "rpi_qpu.h" --// For some unknown reason, the code seems to crash if I do a late malloc --#define EARLY_MALLOC --// Move Inter prediction into separate pass --#define RPI_INTER -+ #include "rpi_qpu.h" -+ // For some unknown reason, the code seems to crash if I do a late malloc -+ #define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER - #endif - - // #define DISABLE_MC - - const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; - -+ -+#ifdef RPI_INTER_QPU -+ -+#define RPI_CHROMA_COMMAND_WORDS 12 -+// The QPU code for UV blocks only works up to a block width of 8 -+#define RPI_CHROMA_BLOCK_WIDTH 8 -+ -+#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) -+ -+// TODO Chroma only needs 4 taps -+static uint32_t rpi_filter_coefs[8][2] = { -+ { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } -+}; -+ -+static uint32_t get_vc_address(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ return p->vc; -+} -+ -+#endif -+ - /** - * NOTE: Each function hls_foo correspond to the function foo in the - * specification (HLS stands for High Level Syntax). -@@ -66,6 +94,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - static void pic_arrays_free(HEVCContext *s) - { - #ifdef RPI -+ - #ifdef EARLY_MALLOC - #else - printf("pic_arrays_free\n"); -@@ -1982,6 +2011,43 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - s->sh.luma_offset_l0[current_mv.ref_idx[0]]); - - if (s->ps.sps->chroma_format_idc) { -+#ifdef RPI_INTER_QPU -+ if (s->enable_rpi) { -+ int reflist = 0; -+ int hshift = s->ps.sps->hshift[1]; -+ int vshift = s->ps.sps->vshift[1]; -+ const Mv *mv = ¤t_mv.mv[reflist]; -+ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -+ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -+ intptr_t _mx = mx << (1 - hshift); -+ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_mx][1]; -+ *u++ = rpi_filter_coefs[_my][0]; -+ *u++ = rpi_filter_coefs[_my][1]; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->u_mvs[chan & 7] = u; -+ return; -+ } -+#endif - RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], - 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, - s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); -@@ -2632,6 +2698,54 @@ static void rpi_execute_inter_cmds(HEVCContext *s) - - #endif - -+#ifdef RPI_INTER_QPU -+static void rpi_inter_clear(HEVCContext *s) -+{ -+ int i; -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -+ for(i=0;i<8;i++) { -+ s->u_mvs[i] = s->mvs_base[i]; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = pic_width; -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -+ s->u_mvs[i] += 3; // Padding words -+ } -+} -+ -+static void rpi_execute_inter_qpu(HEVCContext *s) -+{ -+ int k; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -+ -+ if (s->sh.slice_type == I_SLICE) -+ return; -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -+ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -+} -+#endif -+ - static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - { - HEVCContext *s = avctxt->priv_data; -@@ -2658,6 +2772,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - } - } - -+#ifdef RPI_INTER_QPU -+ rpi_inter_clear(s); -+#endif -+ - while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { - int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; - -@@ -2679,19 +2797,30 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; - s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; - if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -- int x; -+#ifdef RPI_INTER_QPU -+ // Kick off inter prediction on QPUs -+ rpi_execute_inter_qpu(s); -+#endif - // Transform all blocks - //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -- - rpi_execute_transform(s); - // Perform inter prediction - rpi_execute_inter_cmds(s); - // Wait for transform completion - vpu_wait(s->vpu_id); -+ -+ // Copy back reconstructed data -+ //memcpy(s->frame->data[0],s->dummy.arm,2048*64); -+ //memcpy(s->frame->data[1],s->dummy.arm,1024*32); -+ //memcpy(s->frame->data[2],s->dummy.arm,1024*32); -+ - // Perform intra prediction and residual reconstruction - rpi_execute_pred_cmds(s); - // Perform deblocking for CTBs in this row - rpi_execute_dblk_cmds(s); -+#ifdef RPI_INTER_QPU -+ rpi_inter_clear(s); -+#endif - } - } - #endif -@@ -2712,6 +2841,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - - #ifdef RPI - if (s->enable_rpi && s->num_dblk_cmds) { -+#ifdef RPI_INTER_QPU -+ rpi_execute_inter_qpu(s); -+#endif - rpi_execute_transform(s); - rpi_execute_inter_cmds(s); - vpu_wait(s->vpu_id); -@@ -3451,6 +3583,14 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - av_freep(&s->unif_xfm_cmds); - av_freep(&s->univ_pred_cmds); - -+#ifdef RPI_INTER_QPU -+ if (s->unif_mvs) { -+ gpu_free( &s->unif_mvs_ptr ); -+ s->unif_mvs = 0; -+ } -+#endif -+ //gpu_free(&s->dummy); -+ - #ifdef EARLY_MALLOC - printf("hevc_decode_free\n"); - if (s->coeffs_buf_arm[0]) { -@@ -3541,34 +3681,59 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - if (!s->univ_pred_cmds) - goto fail; - -- s->coeffs_buf_arm[0] = 0; -- s->coeffs_buf_arm[2] = 0; -+#ifdef RPI_INTER_QPU -+ // We divide the image into blocks 256 wide and 64 high -+ // We support up to 2048 widths -+ // We compute the number of chroma motion vector commands for 4:4:4 format and 4x4 chroma blocks - assuming all blocks are B predicted -+ // Also add space for the startup command for each stream. -+ -+ { -+ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -+ uint32_t *p; -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+ -+ // Set up initial locations for uniform streams -+ p = s->unif_mvs; -+ for(i = 0; i < 8; i++) { -+ s->mvs_base[i] = p; -+ p += uv_commands_per_qpu; -+ } -+ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -+ s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); -+ -+ } -+#endif -+ //gpu_malloc_uncached(2048*64,&s->dummy); - - #ifdef EARLY_MALLOC -- int coeffs_in_ctb = 64*64; -- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -- printf("Allocated %d\n",coefs_per_row); -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -- if (!s->coeffs_buf_arm[0]) -- goto fail; -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -- if (!s->coeffs_buf_arm[2]) -- goto fail; -- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -- printf("Done\n"); -+ { -+ int coeffs_in_ctb = 64*64; -+ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -+ s->coeffs_buf_arm[0] = 0; -+ s->coeffs_buf_arm[2] = 0; -+ printf("Allocated %d\n",coefs_per_row); -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+ if (!s->coeffs_buf_arm[0]) -+ goto fail; -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+ if (!s->coeffs_buf_arm[2]) -+ goto fail; -+ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+ printf("Done\n"); - #ifdef RPI_PRECLEAR -- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -- memclear16(s->coeffs_buf_arm[0], coefs_per_row); -- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -- memclear16(s->coeffs_buf_arm[2], coefs_per_row); -- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -- memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[2], coefs_per_row); -+ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[3], coefs_per_row); - #endif -- -+ } - #endif - - s->enable_rpi = 0; -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 990bd8c..da345f6 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -42,7 +42,11 @@ - - // define RPI to split the CABAC/prediction/transform into separate stages - #ifdef RPI --#include "rpi_qpu.h" -+ -+ #include "rpi_qpu.h" -+ // Use QPU for inter prediction -+ //#define RPI_INTER_QPU -+ - #endif - - #define MAX_DPB_SIZE 16 // A.4.1 -@@ -888,7 +892,7 @@ typedef struct HEVCContext { - - #ifdef RPI - int enable_rpi; -- HEVCMvCmd *unif_mv_cmds; -+ HEVCMvCmd *unif_mv_cmds; // TODO rename - HEVCXfmCmd *unif_xfm_cmds; - HEVCPredCmd *univ_pred_cmds; - int buf_width; -@@ -902,6 +906,20 @@ typedef struct HEVCContext { - int num_pred_cmds; - int num_dblk_cmds; - int vpu_id; -+ //GPU_MEM_PTR_T dummy; -+#ifdef RPI_INTER_QPU -+ GPU_MEM_PTR_T unif_mvs_ptr; -+ uint32_t *unif_mvs; // Base of memory for motion vector commands -+ -+ // _base pointers are to the start of the row -+ uint32_t *mvs_base[8]; -+ // these pointers are to the next free space -+ uint32_t *u_mvs[8]; -+ // Function pointers -+ uint32_t mc_filter_uv; -+ uint32_t mc_filter_uv_b; -+#endif -+ - #endif - - uint8_t *cabac_state; -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index e1b32d4..5b3d759 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -903,8 +903,11 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - s->nal_unit_type == NAL_STSA_N || - s->nal_unit_type == NAL_RADL_N || - s->nal_unit_type == NAL_RASL_N )) { -- flush_buffer(s->frame->buf[1]); -- flush_buffer(s->frame->buf[2]); -+ //flush_buffer(s->frame->buf[1]); -+ //flush_buffer(s->frame->buf[2]); -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); - } - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); - } -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 3b6dae7..e4dd58a 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -3,7 +3,7 @@ - // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. - #define RPI_USE_VCSM - // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code --//#define RPI_TIME_TOTAL_QPU -+#define RPI_TIME_TOTAL_QPU - // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code - //#define RPI_TIME_TOTAL_VPU - // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -@@ -30,7 +30,7 @@ - #endif - - // On Pi2 there is no way to access the VPU L2 cache --// GPU_MEM_FLG should be 4 for uncached memory. -+// GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) - // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly - // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. - #define GPU_MEM_FLG 0xC -@@ -549,6 +549,54 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un - gpu_unlock(); - } - -+// Run a program on 8 QPUs with the given code and uniform stream (given in GPU addresses) -+void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -+{ -+ int i; -+#ifdef RPI_TIME_TOTAL_QPU -+ static int last_time=0; -+ static long long on_time=0; -+ static long long off_time=0; -+ int start_time; -+ int end_time; -+ static int count=0; -+#endif -+ -+ gpu_lock(); -+#ifdef RPI_TIME_TOTAL_QPU -+ start_time = Microseconds(); -+ if (last_time==0) -+ last_time = start_time; -+ off_time += start_time-last_time; -+#endif -+ for(i=0;i<8;i++) { -+ gpu->mail[i*2 + 1] = code; -+ } -+ gpu->mail[0 ] = unifs1; -+ gpu->mail[2 ] = unifs2; -+ gpu->mail[4 ] = unifs3; -+ gpu->mail[6 ] = unifs4; -+ gpu->mail[8 ] = unifs5; -+ gpu->mail[10] = unifs6; -+ gpu->mail[12] = unifs7; -+ gpu->mail[14] = unifs8; -+ execute_qpu( -+ gpu->mb, -+ 8 /* Number of QPUs */, -+ gpu->vc + offsetof(struct GPU, mail), -+ 1 /* no flush */, // Don't flush VPU L1 cache -+ 5000 /* timeout ms */); -+#ifdef RPI_TIME_TOTAL_QPU -+ end_time = Microseconds(); -+ last_time = end_time; -+ on_time += end_time - start_time; -+ count++; -+ if ((count&0x7f)==0) -+ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); -+#endif -+ gpu_unlock(); -+} -+ - unsigned int qpu_get_fn(int num) { - // Make sure that the gpu is initialized - unsigned int *fn; -@@ -585,6 +633,9 @@ unsigned int qpu_get_fn(int num) { - case QPU_MC_FILTER_UV_B: - fn = mc_filter_uv_b; - break; -+ case QPU_MC_INTERRUPT_EXIT8: -+ fn = mc_interrupt_exit8; -+ break; - case QPU_MC_END: - fn = mc_end; - break; -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 3526fce..2b22d98 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -16,6 +16,7 @@ extern void gpu_free(GPU_MEM_PTR_T *p); - extern void gpu_cache_flush(GPU_MEM_PTR_T *p); - - // QPU specific functions -+extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); - extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); - - enum { -@@ -28,6 +29,7 @@ enum { - QPU_MC_SETUP_UV, - QPU_MC_FILTER_UV, - QPU_MC_FILTER_UV_B, -+ QPU_MC_INTERRUPT_EXIT8, - QPU_MC_END - }; - extern unsigned int qpu_get_fn(int num); --- -2.7.4 - - -From bd651e1569ebe0cdc41a6be169e139758cce069d Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 13 May 2015 11:47:23 +0100 -Subject: [PATCH 17/68] Drafted chroma interpolation on QPUs - ---- - libavcodec/hevc.c | 5 ++- - libavcodec/hevc.h | 2 +- - libavcodec/hevc_filter.c | 6 ++- - libavcodec/rpi_qpu.c | 101 +++++++++++++++++++++++++++++++++++++++++++-- - libavcodec/rpi_qpu.h | 1 + - libavcodec/rpi_shader.c | 42 +++++++++---------- - libavcodec/rpi_shader.qasm | 42 +++++++++---------- - 7 files changed, 149 insertions(+), 50 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 66ed37a..d5ea45e 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -60,11 +60,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - // The QPU code for UV blocks only works up to a block width of 8 - #define RPI_CHROMA_BLOCK_WIDTH 8 - --#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) -+#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) - - // TODO Chroma only needs 4 taps - static uint32_t rpi_filter_coefs[8][2] = { -- { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, - { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, - { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, - { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -@@ -2729,6 +2729,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - for(k=0;k<8;k++) { - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V - } - - s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index da345f6..2497c47 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -45,7 +45,7 @@ - - #include "rpi_qpu.h" - // Use QPU for inter prediction -- //#define RPI_INTER_QPU -+ // #define RPI_INTER_QPU - - #endif - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 5b3d759..9b6e26d 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -903,8 +903,10 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - s->nal_unit_type == NAL_STSA_N || - s->nal_unit_type == NAL_RADL_N || - s->nal_unit_type == NAL_RASL_N )) { -- //flush_buffer(s->frame->buf[1]); -- //flush_buffer(s->frame->buf[2]); -+#ifdef RPI_INTER_QPU -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+#endif - //memcpy(s->dummy.arm,s->frame->data[0],2048*64); - //memcpy(s->dummy.arm,s->frame->data[1],1024*32); - //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index e4dd58a..4d9eda8 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -33,7 +33,8 @@ - // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) - // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly - // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. --#define GPU_MEM_FLG 0xC -+#define GPU_MEM_FLG 0x4 -+// GPU_MEM_MAP is meaningless on the Pi2 and should be left at 0 (On Pi1 it allows ARM to access VPU L2 cache) - #define GPU_MEM_MAP 0x0 - - #define vcos_verify(x) ((x)>=0) -@@ -165,6 +166,8 @@ static int gpu_init(volatile struct GPU **gpu) { - ptr->vc_handle = handle; - ptr->vc = vc; - -+ printf("GPU allocated at 0x%x\n",vc); -+ - *gpu = ptr; - - // Now copy over the QPU code into GPU memory -@@ -304,10 +307,13 @@ int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { - - static void gpu_term(void) - { -- int mb = gpu->mb; -- unsigned handle = gpu->vc_handle; -+ int mb; -+ unsigned handle; -+ - if (gpu==NULL) - return; -+ mb = gpu->mb; -+ handle = gpu->vc_handle; - - #ifdef RPI_ASYNC - { -@@ -648,6 +654,95 @@ unsigned int qpu_get_fn(int num) { - } - - #if 0 -+typedef unsigned int uint32_t; -+ -+typedef struct mvs_s { -+ GPU_MEM_PTR_T unif_mvs_ptr; -+ uint32_t *unif_mvs; // Base of memory for motion vector commands -+ -+ // _base pointers are to the start of the row -+ uint32_t *mvs_base[8]; -+ // these pointers are to the next free space -+ uint32_t *u_mvs[8]; -+ -+} HEVCContext; -+ -+#define RPI_CHROMA_COMMAND_WORDS 12 -+ -+static void rpi_inter_clear(HEVCContext *s) -+{ -+ int i; -+ for(i=0;i<8;i++) { -+ s->u_mvs[i] = s->mvs_base[i]; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 0; -+ *s->u_mvs[i]++ = 128; // w -+ *s->u_mvs[i]++ = 128; // h -+ *s->u_mvs[i]++ = 128; // stride u -+ *s->u_mvs[i]++ = 128; // stride v -+ s->u_mvs[i] += 3; // Padding words -+ } -+} -+ -+static void rpi_execute_inter_qpu(HEVCContext *s) -+{ -+ int k; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -+ -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // dummy location for V -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -+ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -+} -+ -+void rpi_test_qpu(void) -+{ -+ HEVCContext mvs; -+ HEVCContext *s = &mvs; -+ int i; -+ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -+ uint32_t *p; -+ printf("Allocate memory\n"); -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; -+ -+ // Set up initial locations for uniform streams -+ p = s->unif_mvs; -+ for(i = 0; i < 8; i++) { -+ s->mvs_base[i] = p; -+ p += uv_commands_per_qpu; -+ } -+ // Now run a simple program that should just quit immediately after a single texture fetch -+ rpi_inter_clear(s); -+ for(i=0;i<4;i++) { -+ printf("Launch QPUs\n"); -+ rpi_execute_inter_qpu(s); -+ printf("Done\n"); -+ } -+ printf("Free memory\n"); -+ gpu_free(&s->unif_mvs_ptr); -+ return; -+} -+#endif -+ -+#if 0 - - int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; - //int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 2b22d98..f9ad333 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -18,6 +18,7 @@ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); - // QPU specific functions - extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); - extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -+extern void rpi_test_qpu(void); - - enum { - QPU_MC_SETUP, -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 41cc2e1..d7ed297 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -152,23 +152,23 @@ unsigned int rpi_shader[] = { - /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 - /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 - /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 -+/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 - /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - /* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - /* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 - /* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 - /* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 - /* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 - /* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 - /* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 - /* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 - /* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -@@ -179,20 +179,20 @@ unsigned int rpi_shader[] = { - /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 - /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop - /* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 - /* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait - /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 - /* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 - /* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 - /* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 - /* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 6851e83..02fdcb2 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -270,23 +270,23 @@ add t0s, ra_x2_base, r2 - - mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - --mov r2, rb21 ; mul24 r3, r0, ra0 --nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+mov r2, rb21 ; mul24 r2, r0, ra0 -+nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+nop ; mul24 r3, ra1 << 1, r0 << 1 - nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 - nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 - nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 - nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 - nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --sub r0, r2, r3 -+add r0, r2, r3 - - mov r3, rb31 - -@@ -302,23 +302,23 @@ sub.setf -, r3, 8 ; mov r1, ra22 - # apply horizontal filter - brr.anyn -, r:uvloop - max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr r0, r0, 15 ; mov r1, ra21 -+asr r0, r0, 14 ; mov r1, ra21 - min.setf ra15, r0, rb22 - - # apply vertical filter and write to VPM - --nop ; mul24 r0, ra14, rb14 --sub r1, r1, r0 ; mul24 r0, ra13, rb13 --sub r1, r1, r0 ; mul24 r0, ra12, rb12 --sub r1, r1, r0 ; mul24 r0, ra11, rb11 --sub r1, r1, r0 ; mul24 r0, ra10, rb10 --sub r1, r1, r0 ; mul24 r0, ra9, rb9 --sub r1, r1, r0 ; mul24 r0, ra8, rb8 --sub r1, r1, r0 ; mul24 r0, ra15, rb15 --sub.ifnn r1, r1, r0 ; mov -, vw_wait -+nop ; mul24 r1, ra14, rb14 -+nop ; mul24 r0, ra13, rb13 -+add r1, r1, r0 ; mul24 r0, ra12, rb12 -+add r1, r1, r0 ; mul24 r0, ra11, rb11 -+add r1, r1, r0 ; mul24 r0, ra10, rb10 -+add r1, r1, r0 ; mul24 r0, ra9, rb9 -+add r1, r1, r0 ; mul24 r0, ra8, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb15 -+add.ifnn r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 - brr.anyn -, r:uvloop --asr r1, r1, 15 -+asr r1, r1, 14 - min r1, r1, rb22 - max vpm, r1, 0 - --- -2.7.4 - - -From 61628063461ee5d891af6dbedfd495efcf464012 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 13 May 2015 13:54:11 +0100 -Subject: [PATCH 18/68] Fixed chroma inter prediction - ---- - libavcodec/hevc.c | 8 +- - libavcodec/hevc.h | 2 +- - libavcodec/rpi_shader.c | 1170 ++++++++++++++++++++++---------------------- - libavcodec/rpi_shader.h | 22 +- - libavcodec/rpi_shader.qasm | 24 +- - 5 files changed, 617 insertions(+), 609 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index d5ea45e..d6d78ee 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -57,9 +57,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - #ifdef RPI_INTER_QPU - - #define RPI_CHROMA_COMMAND_WORDS 12 -+#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) - // The QPU code for UV blocks only works up to a block width of 8 - #define RPI_CHROMA_BLOCK_WIDTH 8 - -+ - #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) - - // TODO Chroma only needs 4 taps -@@ -2024,7 +2026,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - - int x1_c = x0_c + (mv->x >> (2 + hshift)); - int y1_c = y0_c + (mv->y >> (2 + hshift)); -- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ int chan = x0>>8; - - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { -@@ -2730,6 +2733,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -+ assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); - } - - s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -@@ -3689,7 +3693,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - // Also add space for the startup command for each stream. - - { -- int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -+ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; - uint32_t *p; - gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); - s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 2497c47..d513579 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -45,7 +45,7 @@ - - #include "rpi_qpu.h" - // Use QPU for inter prediction -- // #define RPI_INTER_QPU -+ #define RPI_INTER_QPU - - #endif - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index d7ed297..831633b 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -33,7 +33,7 @@ unsigned int rpi_shader[] = { - /* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) - /* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 - /* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 -+/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 - /* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 - /* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 - /* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -@@ -152,7 +152,7 @@ unsigned int rpi_shader[] = { - /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 - /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 - /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 -+/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 - /* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 - /* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 - /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -@@ -178,9 +178,9 @@ unsigned int rpi_shader[] = { - /* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 - /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 - /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 --/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop - /* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 - /* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 - /* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -@@ -189,400 +189,400 @@ unsigned int rpi_shader[] = { - /* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 - /* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 - /* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait - /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter --/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next --/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif --/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 --/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 --/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path --/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -+/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :loop --/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 --/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 --/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop --/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop --/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -+/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -+/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // :fast_path --/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :fast_loop --/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 --/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch --/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 --/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 --/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 --/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop --/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop --/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -+/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -+/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -+/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_b --/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next --/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif --/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 --/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 --/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 --/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :bloop --/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 --/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 --/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop --/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait --/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop --/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -+/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -+/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -+/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_honly --/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next --/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif --/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 --/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 --/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 --/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 --/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -+/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -+/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :loop_honly --/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 --/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 --/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 --/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 --/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly --/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 --/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 --/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 --/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -+/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -+/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -+/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -+/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -+/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -+/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) - /* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_exit1 --/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait - /* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit --/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait - /* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -@@ -592,225 +592,227 @@ unsigned int rpi_shader[] = { - /* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit4 --/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait - /* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait - /* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_setup_uv --/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num --/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif --/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif --/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop --/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base --/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 --/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 --/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif --/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) --/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 --/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 --/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 --/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 --/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 --/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base --/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base --/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 --/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 --/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif -+/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 - /* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base - // ::mc_filter_uv_b --/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 --/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 --/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index db971f4..3464cdb 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -5,16 +5,16 @@ extern unsigned int rpi_shader[]; - - #define mc_setup (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 146) --#define mc_filter (rpi_shader + 360) --#define mc_filter_b (rpi_shader + 670) --#define mc_filter_honly (rpi_shader + 894) --#define mc_exit (rpi_shader + 1048) --#define mc_exit1 (rpi_shader + 1066) --#define mc_interrupt_exit (rpi_shader + 1082) --#define mc_interrupt_exit4 (rpi_shader + 1120) --#define mc_interrupt_exit8 (rpi_shader + 1142) --#define mc_setup_uv (rpi_shader + 1172) --#define mc_filter_uv_b (rpi_shader + 1314) --#define mc_end (rpi_shader + 1542) -+#define mc_filter (rpi_shader + 364) -+#define mc_filter_b (rpi_shader + 674) -+#define mc_filter_honly (rpi_shader + 898) -+#define mc_exit (rpi_shader + 1052) -+#define mc_exit1 (rpi_shader + 1070) -+#define mc_interrupt_exit (rpi_shader + 1086) -+#define mc_interrupt_exit4 (rpi_shader + 1124) -+#define mc_interrupt_exit8 (rpi_shader + 1146) -+#define mc_setup_uv (rpi_shader + 1176) -+#define mc_filter_uv_b (rpi_shader + 1318) -+#define mc_end (rpi_shader + 1546) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 02fdcb2..4809e1d 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -21,7 +21,7 @@ - # rb19 next ra16 - # - # ra20 1 --# ra21 64 -+# ra21 32 - # ra22 256 - # ra23 8 - # -@@ -97,7 +97,7 @@ add rb24, r1, r0 - # load constants - - mov ra20, 1 --mov ra21, 64 -+mov ra21, 32 - mov ra22, 256 - mov ra23, 8 - -@@ -270,7 +270,7 @@ add t0s, ra_x2_base, r2 - - mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - --mov r2, rb21 ; mul24 r2, r0, ra0 -+nop ; mul24 r2, r0, ra0 - nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 - nop ; mul24 r3, ra1 << 1, r0 << 1 - nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -@@ -301,9 +301,9 @@ sub.setf -, r3, 8 ; mov r1, ra22 - - # apply horizontal filter - brr.anyn -, r:uvloop --max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr r0, r0, 14 ; mov r1, ra21 --min.setf ra15, r0, rb22 -+mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+asr ra15, r0, 8 ; nop -+nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) - - # apply vertical filter and write to VPM - -@@ -315,12 +315,14 @@ add r1, r1, r0 ; mul24 r0, ra10, rb10 - add r1, r1, r0 ; mul24 r0, ra9, rb9 - add r1, r1, r0 ; mul24 r0, ra8, rb8 - add r1, r1, r0 ; mul24 r0, ra15, rb15 --add.ifnn r1, r1, r0 ; mov -, vw_wait -+add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --brr.anyn -, r:uvloop - asr r1, r1, 14 --min r1, r1, rb22 --max vpm, r1, 0 -+add r1, r1, ra21 -+brr.anyn -, r:uvloop -+asr r1, r1, 6 # Delay 1 -+min r1, r1, rb22 # Delay 2 -+max vpm, r1, 0 # Delay 3 - - # DMA out for U - -@@ -1161,7 +1163,7 @@ add rb24, r1, r0 - # load constants - - mov ra20, 1 --mov ra21, 64 -+mov ra21, 32 - mov ra22, 256 - mov ra23, 8 - --- -2.7.4 - - -From b7321192751956ed7deceeb3dabe22ccedb8e08d Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 13 May 2015 14:37:32 +0100 -Subject: [PATCH 19/68] Removed unused luma functions - ---- - libavcodec/hevc.c | 4 +- - libavcodec/rpi_qpu.c | 32 +- - libavcodec/rpi_shader.c | 1097 +++++++++++++------------------------------- - libavcodec/rpi_shader.h | 19 +- - libavcodec/rpi_shader.qasm | 970 +++------------------------------------ - 5 files changed, 396 insertions(+), 1726 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index d6d78ee..31b8b2f 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2731,8 +2731,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - return; - for(k=0;k<8;k++) { - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V - assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); - } - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 4d9eda8..4e90cc1 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -172,7 +172,7 @@ static int gpu_init(volatile struct GPU **gpu) { - - // Now copy over the QPU code into GPU memory - { -- int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); -+ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); - assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); - memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); - } -@@ -612,24 +612,24 @@ unsigned int qpu_get_fn(int num) { - gpu_unlock(); - } - switch(num) { -- case QPU_MC_SETUP: -- fn = mc_setup; -- break; -- case QPU_MC_FILTER: -- fn = mc_filter; -- break; -+ //case QPU_MC_SETUP: -+ // fn = mc_setup; -+ // break; -+ //case QPU_MC_FILTER: -+ // fn = mc_filter; -+ // break; - case QPU_MC_EXIT: - fn = mc_exit; - break; -- case QPU_MC_INTERRUPT_EXIT: -- fn = mc_interrupt_exit; -- break; -- case QPU_MC_FILTER_B: -- fn = mc_filter_b; -- break; -- case QPU_MC_FILTER_HONLY: -- fn = mc_filter_honly; -- break; -+ //case QPU_MC_INTERRUPT_EXIT: -+ // fn = mc_interrupt_exit; -+ // break; -+ //case QPU_MC_FILTER_B: -+ // fn = mc_filter_b; -+ // break; -+ //case QPU_MC_FILTER_HONLY: -+ // fn = mc_filter_honly; -+ // break; - case QPU_MC_SETUP_UV: - fn = mc_setup_uv; - break; -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 831633b..170e8ac 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -21,798 +21,331 @@ __declspec(align(8)) - __attribute__((aligned(8))) - #endif - unsigned int rpi_shader[] = { --// ::mc_setup -+// ::mc_setup_uv - /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif - /* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num - /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif - /* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif --/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 --/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 --/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif --/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) --/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 --/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 --/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 --/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 --/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 --/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base --/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base --/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+/* [0x00000020] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+/* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+/* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+/* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif -+/* [0x00000048] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset - /* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 - /* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch --/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 --/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 --/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base - // ::mc_filter_uv --/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --// ::mc_filter --/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next --/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif --/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 --/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 --/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path --/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 --// :loop --/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 --/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 --/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop --/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop --/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --// :fast_path --/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 --// :fast_loop --/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 --/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch --/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 --/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 --/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 --/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop --/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop --/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --// ::mc_filter_b --/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next --/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif --/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 --/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 --/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 --/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 --// :bloop --/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 --/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 --/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop --/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait --/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop --/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --// ::mc_filter_honly --/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next --/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 --/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif --/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 --/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 --/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 --/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 --/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 --/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 --/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 --/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 --// :loop_honly --/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 --/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 --/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 --/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 --/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly --/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 --/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 --/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 --/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --// ::mc_exit --/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop --// ::mc_exit1 --/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop --// ::mc_interrupt_exit --/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop --// ::mc_interrupt_exit4 --/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop --// ::mc_interrupt_exit8 --/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop --// ::mc_setup_uv --/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num --/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif --/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif --/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop --/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base --/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 --/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 --/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif --/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) --/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 --/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 --/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 --/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 --/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 --/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base --/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base --/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 --/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 --/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b --/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 --/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 --/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait --/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_exit -+/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_interrupt_exit8 -+/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 3464cdb..9de4535 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -3,18 +3,11 @@ - - extern unsigned int rpi_shader[]; - --#define mc_setup (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 146) --#define mc_filter (rpi_shader + 364) --#define mc_filter_b (rpi_shader + 674) --#define mc_filter_honly (rpi_shader + 898) --#define mc_exit (rpi_shader + 1052) --#define mc_exit1 (rpi_shader + 1070) --#define mc_interrupt_exit (rpi_shader + 1086) --#define mc_interrupt_exit4 (rpi_shader + 1124) --#define mc_interrupt_exit8 (rpi_shader + 1146) --#define mc_setup_uv (rpi_shader + 1176) --#define mc_filter_uv_b (rpi_shader + 1318) --#define mc_end (rpi_shader + 1546) -+#define mc_setup_uv (rpi_shader + 0) -+#define mc_filter_uv (rpi_shader + 142) -+#define mc_filter_uv_b (rpi_shader + 360) -+#define mc_exit (rpi_shader + 588) -+#define mc_interrupt_exit8 (rpi_shader + 606) -+#define mc_end (rpi_shader + 636) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 4809e1d..cd7346d 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -71,8 +71,10 @@ - - .set rb_const_64, rb21 - --# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) --::mc_setup -+ -+################################################################################ -+# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+::mc_setup_uv - - # Read starting kernel - mov ra31, unif -@@ -80,7 +82,9 @@ mov ra31, unif - # Load first request location - add ra_x_base, unif, elem_num # Store x - mov ra_y, unif # Store y --mov ra_x2_base, unif # Store frame base -+mov ra_x2_base, unif # Store frame u base -+nop -+sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame - - # Read image dimensions - sub rb25,unif,1 -@@ -143,29 +147,24 @@ mov r1, vpm_setup(0, 4, h8p(0, 0)) - add rb28, r0, r1 - - # Compute base address for first and second access --#add r0, unif, elem_num # x - mov r0, ra_x_base # Load x --add r2, r0, 8 # x+8 - max r0, r0, 0; mov r1, ra_y # Load y - min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base --shl ra_xshift_next, r0, 3 --max r2, r2, 0 -+shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset - add ra_y, r1, 1 --min r2, r2, rb_frame_width_minus_1 --shl ra_x2shift_next, r2, 3 --max r1, r1, 0 # y --min r1, r1, rb_frame_height_minus_1 --add r0, r0, r3; mul24 r1, r1, rb_pitch --add r2, r2, r3 -+add r0, r0, r3 - and r0, r0, ~3 --and r2, r2, ~3; mov ra_x_base, r0 -+max r1, r1, 0 ; mov ra_x_base, r0 # y -+min r1, r1, rb_frame_height_minus_1 - # submit texture requests for first line -+add r2, r2, r0 ; mul24 r1, r1, rb_pitch - add t0s, r0, r1 ; mov ra_x2_base, r2 - add t0s, r2, r1 - - # Dump padding words - mov r0, unif - mov r0, unif -+mov r0, unif - - # submit texture requests for second line - max r1, ra_y, 0 -@@ -176,6 +175,8 @@ nop ; mul24 r1, r1, rb_pitch - add t0s, r1, ra_x_base - add t0s, r1, ra_x2_base - -+ -+ - ################################################################################ - - # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -@@ -341,453 +342,26 @@ add vw_setup, rb26, r0 # VDW setup 0 - mov vw_setup, rb29 # Stride - mov vw_addr, unif # start the VDW - --################################################################################ -- -- --# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -- --# At this point we have already issued two pairs of texture requests for the current block --# ra_x_base, ra_x16_base point to the current coordinates for this block --::mc_filter --mov ra31, unif -- --# per-channel shifts were calculated on the *previous* invocation -- --mov ra_xshift, ra_xshift_next --mov ra_x2shift, ra_x2shift_next -- --# get base addresses and per-channel shifts for *next* invocation --add r0, unif, elem_num # x --add r2, r0, 8 # x+8 --max r0, r0, 0; mov r1, unif # y --min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base --shl ra_xshift_next, r0, 3 --max r2, r2, 0 --min r2, r2, rb_frame_width_minus_1 --shl ra_x2shift_next, r2, 3 --add r0, r0, r3 --add r2, r2, r3 --and rb_x_base_next, r0, ~3 --and ra_x2_base_next, r2, ~3 --mov ra_y_next, r1 -- --# set up VPM write --mov vw_setup, rb28 -- --# get width,height of block --mov r2, 16 --mov r0, unif --shr r1, r0, r2 # Extract width --sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) --and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 --shl r0, r0, 7 --add r0, r0, r1 # Combine width and height of destination area --shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register --add rb26, r0, rb27 -- --sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -- --# get filter coefficients -- --mov r0, unif --asr ra3, r0, rb23; mul24 r0, r0, ra22 --asr ra2, r0, rb23; mul24 r0, r0, ra22 --asr ra1, r0, rb23; mul24 r0, r0, ra22 --asr ra0, r0, rb23; mov r0, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif --asr rb11, r0, rb23; mul24 r0, r0, ra22 --asr rb10, r0, rb23; mul24 r0, r0, ra22 --asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif --asr rb15, r0, rb23; mul24 r0, r0, ra22 --asr rb14, r0, rb23; mul24 r0, r0, ra22 --asr rb13, r0, rb23; mul24 r0, r0, ra22 --brr.anynn -, r:fast_path --asr rb12, r0, rb23 # delay slot 1 -- --# r2 is elem_num --# r3 is loop counter -- --mov r5rep, -8 # delay slot 2 -- --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -- --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --## nop ; ldtmu0 # loop counter increment --## shr r0, r4, ra17 ; ldtmu0 --## shr r1, r4, ra17 ; v8subs r0, r0, rb20 --## add t0s, ra16, r5 ; v8subs r1, r1, rb20 --## add ra16, ra16, rb16 ; mov t0s, ra16 --## --## # generate seven shifted versions --## # interleave with scroll of vertical context --## --## mov r2, rb21 ; mul24 r3, r0, ra0 --## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --## sub r2, r2, r3 ; ldtmu0 --## --## mov r0, ra22 --## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 --## shr r1, r4, ra17 ; v8subs r0, r0, rb20 --## add t0s, ra16, r5 ; v8subs r1, r1, rb20 --## add ra16, ra16, rb16 ; mov t0s, ra16 --## --## # apply horizontal filter --## --## asr r2, r2, 15 ; mul24 r3, r0, ra0 --## min r2, r2, rb22 --## max ra13, r2, 0 --## --## # generate seven shifted versions --## # interleave with scroll of vertical context --## --## mov r2, rb21 --## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --## sub r0, r2, r3 --## --## # apply horizontal filter --## --## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero --## asr r0, r0, 15 --## min r0, r0, rb22 --## max ra14, r0, 0 --## --## --## --## --## nop ; ldtmu0 # loop counter increment --## shr r0, r4, ra17 ; ldtmu0 --## shr r1, r4, ra17 ; v8subs r0, r0, rb20 --## add t0s, ra16, r5 ; v8subs r1, r1, rb20 --## add ra16, ra16, rb16 ; mov t0s, ra16 --## --## # generate seven shifted versions --## # interleave with scroll of vertical context --## --## mov r2, rb21 ; mul24 r3, r0, ra0 --## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --## sub r0, r2, r3 --## --## # apply horizontal filter --## --## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero --## asr r0, r0, 15 --## min r0, r0, rb22 --## max ra15, r0, 0 -- -- -- -- --mov r3, 0 -- --:loop --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -- --max r2, ra_y, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --add t0s, ra_x2_base, r2 -- --# generate seven shifted versions --# interleave with scroll of vertical context -- --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -- --mov r2, rb21 ; mul24 r3, r0, ra0 --sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --sub r0, r2, r3 -- --mov r3, rb31 -- --mov ra8, ra9 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 --mov ra12, ra13 --mov ra13, ra14 -- --sub.setf -, r3, 8 ; mov r1, ra22 -- --# apply horizontal filter --brr.anyn -, r:loop --max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr r0, r0, 15 ; mov r1, ra21 --min.setf ra15, r0, rb22 -- --# apply vertical filter and write to VPM -- --nop ; mul24 r0, ra14, rb14 --sub r1, r1, r0 ; mul24 r0, ra13, rb13 --sub r1, r1, r0 ; mul24 r0, ra12, rb12 --sub r1, r1, r0 ; mul24 r0, ra11, rb11 --sub r1, r1, r0 ; mul24 r0, ra10, rb10 --sub r1, r1, r0 ; mul24 r0, ra9, rb9 --sub r1, r1, r0 ; mul24 r0, ra8, rb8 --sub r1, r1, r0 ; mul24 r0, ra15, rb15 --sub.ifnn r1, r1, r0 ; mov -, vw_wait --sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --brr.anyn -, r:loop --asr r1, r1, 15 --min r1, r1, rb22 --max vpm, r1, 0 -- --# DMA out -- --bra -, ra31 --mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long --mov vw_setup, rb29 --mov vw_addr, unif # start the VDW -- --#################################################### -- --:fast_path --## nop ; ldtmu0 # loop counter increment --## shr r0, r4, ra17 ; ldtmu0 --## shr r1, r4, ra17 ; v8subs r0, r0, rb20 --## add t0s, ra16, r5 ; v8subs r1, r1, rb20 --## add ra16, ra16, rb16 ; mov t0s, ra16 --## --## # generate seven shifted versions --## # interleave with scroll of vertical context --## --## mov r2, rb21 ; mul24 r3, r0, ra0 --## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --## sub r2, r2, r3 ; ldtmu0 --## --## mov r0, ra22 --## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 --## shr r1, r4, ra17 ; v8subs r0, r0, rb20 --## add t0s, ra16, r5 ; v8subs r1, r1, rb20 --## add ra16, ra16, rb16 ; mov t0s, ra16 --## --## # apply horizontal filter --## --## asr r2, r2, 15 ; mul24 r3, r0, ra0 --## min r2, r2, rb22 --## max ra13, r2, 0 --## --## # generate seven shifted versions --## # interleave with scroll of vertical context --## --## mov r2, rb21 --## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --## sub r0, r2, r3 --## --## # apply horizontal filter --## --## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero --## asr r0, r0, 15 --## min r0, r0, rb22 --## max ra14, r0, 0 --## --## --## --## --## nop ; ldtmu0 # loop counter increment --## shr r0, r4, ra17 ; ldtmu0 --## shr r1, r4, ra17 ; v8subs r0, r0, rb20 --## add t0s, ra16, r5 ; v8subs r1, r1, rb20 --## add ra16, ra16, rb16 ; mov t0s, ra16 --## --## # generate seven shifted versions --## # interleave with scroll of vertical context --## --## mov r2, rb21 ; mul24 r3, r0, ra0 --## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --## sub r0, r2, r3 --## --## # apply horizontal filter --## --## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero --## asr r0, r0, 15 --## min r0, r0, rb22 --## max ra15, r0, 0 -- -- --mov r3, 0 # This signifies the amount of unrolling -- --:fast_loop --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels --sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_y, ra_y_next ; mov rb31, r3 --mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -- --max r2, ra_y, 0 --min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read --add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 --add t0s, ra_x2_base, r2 -- --# generate seven shifted versions --# interleave with scroll of vertical context -- --mov r2, rb21 ; mul24 r3, r0, ra0 --sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --sub r0, r2, r3 ; mov r3, rb31 -- --mov ra8, ra9 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 --mov ra12, ra13 --mov ra13, ra14 -- --sub.setf -, r3, 8 ; mov r1, ra22 -- --# apply horizontal filter -- --brr.anyn -, r:fast_loop --max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr r0, r0, 15 ; mov r1, ra21 --min.setf ra15, r0, rb22 -- --# apply vertical filter and write to VPM -- --nop ; mul24 r0, ra14, rb14 --sub r1, r1, r0 ; mul24 r0, ra13, rb13 --sub r1, r1, r0 ; mul24 r0, ra12, rb12 --sub r1, r1, r0 ; mul24 r0, ra11, rb11 --sub r1, r1, r0 ; mul24 r0, ra10, rb10 --sub r1, r1, r0 ; mul24 r0, ra9, rb9 --sub r1, r1, r0 ; mul24 r0, ra8, rb8 --sub r1, r1, r0 ; mul24 r0, ra15, rb15 --sub.ifnn r1, r1, r0 ; mov -, vw_wait --sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --brr.anyn -, r:fast_loop --asr r1, r1, 15 --min r1, r1, rb22 --max vpm, r1, 0 -- --# DMA out -- --bra -, ra31 --mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long --mov vw_setup, rb29 --mov vw_addr, unif # start the VDW - - ################################################################################ - --# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -- --# At this point we have already issued two pairs of texture requests for the current block --# ra_x_base, ra_x16_base point to the current coordinates for this block --::mc_filter_b -+::mc_filter_uv_b - mov ra31, unif - - # per-channel shifts were calculated on the *previous* invocation - - mov ra_xshift, ra_xshift_next --mov ra_x2shift, ra_x2shift_next - - # get base addresses and per-channel shifts for *next* invocation - add r0, unif, elem_num # x --add r2, r0, 8 # x+8 - max r0, r0, 0; mov r1, unif # y --min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base - shl ra_xshift_next, r0, 3 --max r2, r2, 0 --min r2, r2, rb_frame_width_minus_1 --shl ra_x2shift_next, r2, 3 -+sub r2, unif, r3 # compute offset from frame base u to frame base v - add r0, r0, r3 --add r2, r2, r3 - and rb_x_base_next, r0, ~3 --and ra_x2_base_next, r2, ~3 - mov ra_y_next, r1 -+add ra_x2_base_next, rb_x_base_next, r2 - - # set up VPM write - mov vw_setup, rb28 -@@ -801,17 +375,22 @@ and r0, r0, rb22 # Extract height - add rb17, r0, 5 - add rb18, r0, 7 - shl r0, r0, 7 -+ - # r0 is currently height<<7 - # For vr_setup we want height<<20 (so 20-7=13 additional bits) - shl r3, r0, 13 - shl r3, r3, 8 # Mask off top 8 bits - shr r3, r3, 8 -+ - add r0, r0, r1 # Combine width and height of destination area - shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register - add rb26, r0, rb27 -+ - # In a B frame, so also set up VPM read - add vr_setup, r3, rb28 - -+sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ - # get filter coefficients - - mov r0, unif -@@ -837,9 +416,13 @@ asr rb12, r0, rb23 - - mov r5rep, -8 - mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ - mov r3, 0 - --:bloop -+:uvloop_b - # retrieve texture results and pick out bytes - # then submit two more texture requests - -@@ -847,7 +430,7 @@ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 - shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 - mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte - - max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 -@@ -861,6 +444,7 @@ add t0s, ra_x2_base, r2 - mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - - mov r2, rb21 ; mul24 r3, r0, ra0 -+nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 - sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 - nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 - sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -@@ -889,7 +473,7 @@ mov ra13, ra14 - sub.setf -, r3, 8 ; mov r1, ra22 - - # apply horizontal filter --brr.anyn -, r:bloop -+brr.anyn -, r:uvloop_b - max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero - asr r0, r0, 15 ; mov r1, ra21 - min.setf ra15, r0, rb22 -@@ -906,213 +490,50 @@ sub r1, r1, r0 ; mul24 r0, ra8, rb8 - sub r1, r1, r0 ; mul24 r0, ra15, rb15 - sub.ifnn r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 15 ; mov -, vr_wait -+asr r1, r1, 15 - min r1, r1, rb22 - add r0, vpm, 1 # Blend in previous VPM contents at this location --brr.anyn -, r:bloop -+brr.anyn -, r:uvloop_b - max r1, r1, 0 - add r1, r1, r0 - shr vpm, r1, 1 - --# DMA out -+ -+# DMA out for U -+ -+mov vw_setup, rb26 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+# DMA out for V -+# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+# Could potentially push this write into the start of the next pipeline stage. -+mov r0, 16 -+mov -, vw_wait - - bra -, ra31 --mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long --mov vw_setup, rb29 -+add vw_setup, rb26, r0 # VDW setup 0 -+mov vw_setup, rb29 # Stride - mov vw_addr, unif # start the VDW - - ################################################################################ - --# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) --# This filter only does horizontal filtering. --# It is assumed that the region to fetch does not include extra rows above. -+# mc_exit() - --# At this point we have already issued two pairs of texture requests for the current block --# ra_x_base, ra_x16_base point to the current coordinates for this block --::mc_filter_honly --mov ra31, unif -+::mc_exit -+mov -, vw_wait # wait on the VDW - --# per-channel shifts were calculated on the *previous* invocation -+mov -,srel(0) - --mov ra_xshift, ra_xshift_next --mov ra_x2shift, ra_x2shift_next -- --# get base addresses and per-channel shifts for *next* invocation --add r0, unif, elem_num # x --add r2, r0, 8 # x+8 --max r0, r0, 0; mov r1, unif # y --min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base --shl ra_xshift_next, r0, 3 --max r2, r2, 0 --min r2, r2, rb_frame_width_minus_1 --shl ra_x2shift_next, r2, 3 --add r0, r0, r3 --add r2, r2, r3 --and rb_x_base_next, r0, ~3 --and ra_x2_base_next, r2, ~3 --mov ra_y_next, r1 -- --# set up VPM write --mov vw_setup, rb28 -- --# get width,height of block --mov r2, 16 --mov r0, unif --shr r1, r0, r2 # Extract width --sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) --and r0, r0, rb22 # Extract height --add rb17, r0, -2 # Pipelining means we move data across 2 iterations early --shl r0, r0, 7 ; mov rb18,r0 --add r0, r0, r1 # Combine width and height of destination area --shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register --add rb26, r0, rb27 -- --# get filter coefficients -- --mov r0, unif --asr ra3, r0, rb23; mul24 r0, r0, ra22 --asr ra2, r0, rb23; mul24 r0, r0, ra22 --asr ra1, r0, rb23; mul24 r0, r0, ra22 --asr ra0, r0, rb23; mov r0, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif --mov r0, unif -- --# r2 is elem_num --# r3 is loop counter --mov r5rep, -8 --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 --mov r3, 0 -- --:loop_honly --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -- --max r2, ra_y, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --add t0s, ra_x2_base, r2 -- --# generate seven shifted versions --# interleave with scroll of vertical context -- --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -- --mov r2, rb21 ; mul24 r3, r0, ra0 --sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --sub r0, r2, r3 ; mov r3, rb31 -- --sub.setf -, r3, rb18 ; mov r1, ra22 -- --mov -, vw_wait ; mul24 r0, r0, r1 --brr.anyn -, r:loop_honly --asr r0, r0, 15 # delay 1 --min r0, r0, rb22 # delay 2 --max vpm, r0, 0 # delay 3 -- --# DMA out --bra -, ra31 --mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long --mov vw_setup, rb29 --mov vw_addr, unif # start the VDW -- -- --################################################################################ -- --# mc_exit() -- --::mc_exit --mov -, vw_wait # wait on the VDW -- --mov -,srel(0) -- --ldtmu0 --ldtmu0 --ldtmu0 --ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 - - nop ; nop ; thrend - nop ; nop # delay slot 1 - nop ; nop # delay slot 2 - --::mc_exit1 --mov -, vw_wait # wait on the VDW -- --#mov -,srel(1) -- --ldtmu0 --ldtmu0 --ldtmu0 --ldtmu0 -- --nop ; nop ; thrend --mov interrupt, 1; nop # delay slot 1 --nop ; nop # delay slot 2 -- --# mc_interrupt_exit() --::mc_interrupt_exit --mov -, vw_wait # wait on the VDW -- --ldtmu0 --ldtmu0 --ldtmu0 --ldtmu0 -- --mov -,sacq(0) # 1 --mov -,sacq(0) # 2 --mov -,sacq(0) # 3 --mov -,sacq(0) # 4 --mov -,sacq(0) # 5 --mov -,sacq(0) # 6 --mov -,sacq(0) # 7 --mov -,sacq(0) # 8 --mov -,sacq(0) # 9 --mov -,sacq(0) # 10 --mov -,sacq(0) # 11 -- --nop ; nop ; thrend --mov interrupt, 1; nop # delay slot 1 --nop ; nop # delay slot 2 -- --# mc_interrupt_exit4() --::mc_interrupt_exit4 --mov -, vw_wait # wait on the VDW -- --ldtmu0 --ldtmu0 --ldtmu0 --ldtmu0 -- --mov -,sacq(0) # 1 --mov -,sacq(0) # 2 --mov -,sacq(0) # 3 -- --nop ; nop ; thrend --mov interrupt, 1; nop # delay slot 1 --nop ; nop # delay slot 2 -- - # mc_interrupt_exit8() - ::mc_interrupt_exit8 - mov -, vw_wait # wait on the VDW -@@ -1134,282 +555,5 @@ nop ; nop ; thrend - mov interrupt, 1; nop # delay slot 1 - nop ; nop # delay slot 2 - --################################################################################ --# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) --::mc_setup_uv -- --# Read starting kernel --mov ra31, unif -- --# Load first request location --add ra_x_base, unif, elem_num # Store x --mov ra_y, unif # Store y --mov ra_x2_base, unif # Store frame u base --nop --sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -- --# Read image dimensions --sub rb25,unif,1 --sub rb30,unif,1 -- --# get source pitch --mov rb16, unif -- --# get destination pitch --mov r0, unif --mov r1, vdw_setup_1(0) --add rb24, r1, r0 -- --# load constants -- --mov ra20, 1 --mov ra21, 32 --mov ra22, 256 --mov ra23, 8 -- --mov rb20, 0xffffff00 --mov rb21, 64 --mov rb22, 255 --mov rb23, 24 -- --# touch vertical context to keep simulator happy -- --mov ra8, 0 --mov ra9, 0 --mov ra10, 0 --mov ra11, 0 --mov ra12, 0 --mov ra13, 0 --mov ra14, 0 --mov ra15, 0 -- --# Compute part of VPM to use for DMA output --mov r2, qpu_num --and r2, r2, 15 --mov r1, r2 --asr r1, r1, 2 --shl r1, r1, 6 --mov r0, r2 --and r0, r0, 3 --add r0, r0, r1 --mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later --shl r0, r0, 5 --add rb27, r0, r1 -- --# Compute part of VPM to save data into --mov r2, qpu_num --and r2, r2, 15 --mov r1, r2 --asr r1, r1, 2 --shl r1, r1, 6 --mov r0, r2 --and r0, r0, 3 --add r0, r0, r1 --mov r1, vpm_setup(0, 4, h8p(0, 0)) --add rb28, r0, r1 -- --# Compute base address for first and second access --mov r0, ra_x_base # Load x --max r0, r0, 0; mov r1, ra_y # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base --shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --add ra_y, r1, 1 --add r0, r0, r3 --and r0, r0, ~3 --max r1, r1, 0 ; mov ra_x_base, r0 # y --min r1, r1, rb_frame_height_minus_1 --# submit texture requests for first line --add r2, r2, r0 ; mul24 r1, r1, rb_pitch --add t0s, r0, r1 ; mov ra_x2_base, r2 --add t0s, r2, r1 -- --# Dump padding words --mov r0, unif --mov r0, unif --mov r0, unif -- --# submit texture requests for second line --max r1, ra_y, 0 --min r1, r1, rb_frame_height_minus_1 --add ra_y, ra_y, 1 --bra -, ra31 --nop ; mul24 r1, r1, rb_pitch --add t0s, r1, ra_x_base --add t0s, r1, ra_x2_base -- -- -- --################################################################################ -- --::mc_filter_uv_b --mov ra31, unif -- --# per-channel shifts were calculated on the *previous* invocation -- --mov ra_xshift, ra_xshift_next -- --# get base addresses and per-channel shifts for *next* invocation --add r0, unif, elem_num # x --max r0, r0, 0; mov r1, unif # y --min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base --shl ra_xshift_next, r0, 3 --sub r2, unif, r3 # compute offset from frame base u to frame base v --add r0, r0, r3 --and rb_x_base_next, r0, ~3 --mov ra_y_next, r1 --add ra_x2_base_next, rb_x_base_next, r2 -- --# set up VPM write --mov vw_setup, rb28 -- --# get width,height of block --mov r2, 16 --mov r0, unif --shr r1, r0, r2 # Extract width --sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) --and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 --shl r0, r0, 7 -- --# r0 is currently height<<7 --# For vr_setup we want height<<20 (so 20-7=13 additional bits) --shl r3, r0, 13 --shl r3, r3, 8 # Mask off top 8 bits --shr r3, r3, 8 -- --add r0, r0, r1 # Combine width and height of destination area --shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register --add rb26, r0, rb27 -- --# In a B frame, so also set up VPM read --add vr_setup, r3, rb28 -- --sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -- --# get filter coefficients -- --mov r0, unif --asr ra3, r0, rb23; mul24 r0, r0, ra22 --asr ra2, r0, rb23; mul24 r0, r0, ra22 --asr ra1, r0, rb23; mul24 r0, r0, ra22 --asr ra0, r0, rb23; mov r0, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif --asr rb11, r0, rb23; mul24 r0, r0, ra22 --asr rb10, r0, rb23; mul24 r0, r0, ra22 --asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif --asr rb15, r0, rb23; mul24 r0, r0, ra22 --asr rb14, r0, rb23; mul24 r0, r0, ra22 --asr rb13, r0, rb23; mul24 r0, r0, ra22 --asr rb12, r0, rb23 -- --# r2 is elem_num --# r3 is loop counter -- --mov r5rep, -8 --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -- --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --mov r3, 0 -- --:uvloop_b --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -- --max r2, ra_y, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --add t0s, ra_x2_base, r2 -- --# generate seven shifted versions --# interleave with scroll of vertical context -- --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -- --mov r2, rb21 ; mul24 r3, r0, ra0 --nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 --nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --sub r0, r2, r3 -- --mov r3, rb31 -- --mov ra8, ra9 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 --mov ra12, ra13 --mov ra13, ra14 -- --sub.setf -, r3, 8 ; mov r1, ra22 -- --# apply horizontal filter --brr.anyn -, r:uvloop_b --max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr r0, r0, 15 ; mov r1, ra21 --min.setf ra15, r0, rb22 -- --# apply vertical filter and write to VPM -- --nop ; mul24 r0, ra14, rb14 --sub r1, r1, r0 ; mul24 r0, ra13, rb13 --sub r1, r1, r0 ; mul24 r0, ra12, rb12 --sub r1, r1, r0 ; mul24 r0, ra11, rb11 --sub r1, r1, r0 ; mul24 r0, ra10, rb10 --sub r1, r1, r0 ; mul24 r0, ra9, rb9 --sub r1, r1, r0 ; mul24 r0, ra8, rb8 --sub r1, r1, r0 ; mul24 r0, ra15, rb15 --sub.ifnn r1, r1, r0 ; mov -, vw_wait --sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 15 --min r1, r1, rb22 --add r0, vpm, 1 # Blend in previous VPM contents at this location --brr.anyn -, r:uvloop_b --max r1, r1, 0 --add r1, r1, r0 --shr vpm, r1, 1 -- -- --# DMA out for U -- --mov vw_setup, rb26 # VDW setup 0 --mov vw_setup, rb29 # Stride --mov vw_addr, unif # start the VDW -- --# DMA out for V --# We need to wait for the U to complete first, but have nothing useful to compute while we wait. --# Could potentially push this write into the start of the next pipeline stage. --mov r0, 16 --mov -, vw_wait -- --bra -, ra31 --add vw_setup, rb26, r0 # VDW setup 0 --mov vw_setup, rb29 # Stride --mov vw_addr, unif # start the VDW -- - ::mc_end -+# Do not add code here because mc_end must appear after all other code. --- -2.7.4 - - -From d40d59de0f09fd1a6e7146532418b63d8e2711b7 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 13 May 2015 14:54:25 +0100 -Subject: [PATCH 20/68] Moved chroma P1 to QPUs - ---- - libavcodec/hevc.c | 38 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 31b8b2f..391d139 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2070,6 +2070,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - s->sh.luma_offset_l1[current_mv.ref_idx[1]]); - - if (s->ps.sps->chroma_format_idc) { -+#ifdef RPI_INTER_QPU -+ if (s->enable_rpi) { -+ int reflist = 1; -+ int hshift = s->ps.sps->hshift[1]; -+ int vshift = s->ps.sps->vshift[1]; -+ const Mv *mv = ¤t_mv.mv[reflist]; -+ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -+ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -+ intptr_t _mx = mx << (1 - hshift); -+ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ int chan = x0>>8; -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_mx][1]; -+ *u++ = rpi_filter_coefs[_my][0]; -+ *u++ = rpi_filter_coefs[_my][1]; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->u_mvs[chan & 7] = u; -+ return; -+ } -+#endif - RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], - 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, - s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); --- -2.7.4 - - -From 75777ba7927086e862104b14f6446e81bc789611 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 13 May 2015 15:13:47 +0100 -Subject: [PATCH 21/68] Added B prediction - not quite right - ---- - libavcodec/hevc.c | 58 ++++++++++++++++++++++++ - libavcodec/rpi_shader.c | 108 +++++++++++++++++++++++---------------------- - libavcodec/rpi_shader.h | 6 +-- - libavcodec/rpi_shader.qasm | 48 ++++++++++---------- - 4 files changed, 141 insertions(+), 79 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 391d139..47ddfff 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2127,6 +2127,64 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - ref1->frame, ¤t_mv.mv[1], ¤t_mv); - - if (s->ps.sps->chroma_format_idc) { -+#ifdef RPI_INTER_QPU -+ if (s->enable_rpi) { -+ int hshift = s->ps.sps->hshift[1]; -+ int vshift = s->ps.sps->vshift[1]; -+ const Mv *mv = ¤t_mv.mv[0]; -+ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -+ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -+ intptr_t _mx = mx << (1 - hshift); -+ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ -+ const Mv *mv2 = ¤t_mv.mv[1]; -+ intptr_t mx2 = av_mod_uintp2(mv2->x, 2 + hshift); -+ intptr_t my2 = av_mod_uintp2(mv2->y, 2 + vshift); -+ intptr_t _mx2 = mx2 << (1 - hshift); -+ intptr_t _my2 = my2 << (1 - vshift); // Fractional part of motion vector -+ -+ int x2_c = x0_c + (mv2->x >> (2 + hshift)); -+ int y2_c = y0_c + (mv2->y >> (2 + hshift)); -+ -+ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx2][0]; -+ *u++ = rpi_filter_coefs[_mx2][1]; -+ *u++ = rpi_filter_coefs[_my2][0]; -+ *u++ = rpi_filter_coefs[_my2][1]; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->u_mvs[chan & 7] = u; -+ return; -+ } -+#endif - RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, - x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 170e8ac..5d00cb2 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -265,23 +265,23 @@ unsigned int rpi_shader[] = { - /* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 - /* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 - /* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 --/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 - /* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - /* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - /* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 - /* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 - /* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 - /* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 - /* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 - /* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 - /* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 - /* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -@@ -291,61 +291,63 @@ unsigned int rpi_shader[] = { - /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 - /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 - /* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 --/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 --/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 --/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 --/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 --/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait - /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 --/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) - /* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait - /* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 9de4535..e36c4ae 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -6,8 +6,8 @@ extern unsigned int rpi_shader[]; - #define mc_setup_uv (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 142) - #define mc_filter_uv_b (rpi_shader + 360) --#define mc_exit (rpi_shader + 588) --#define mc_interrupt_exit8 (rpi_shader + 606) --#define mc_end (rpi_shader + 636) -+#define mc_exit (rpi_shader + 592) -+#define mc_interrupt_exit8 (rpi_shader + 610) -+#define mc_end (rpi_shader + 640) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index cd7346d..870437d2 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -443,23 +443,23 @@ add t0s, ra_x2_base, r2 - - mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - --mov r2, rb21 ; mul24 r3, r0, ra0 --nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 --sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24 r2, r0, ra0 -+nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+nop ; mul24 r3, ra1 << 1, r0 << 1 - nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 - nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 - nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 - nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 - nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --sub r0, r2, r3 -+add r0, r2, r3 - - mov r3, rb31 - -@@ -474,23 +474,25 @@ sub.setf -, r3, 8 ; mov r1, ra22 - - # apply horizontal filter - brr.anyn -, r:uvloop_b --max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr r0, r0, 15 ; mov r1, ra21 --min.setf ra15, r0, rb22 -+mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+asr ra15, r0, 8 ; nop -+nop ; nop - - # apply vertical filter and write to VPM - --nop ; mul24 r0, ra14, rb14 --sub r1, r1, r0 ; mul24 r0, ra13, rb13 --sub r1, r1, r0 ; mul24 r0, ra12, rb12 --sub r1, r1, r0 ; mul24 r0, ra11, rb11 --sub r1, r1, r0 ; mul24 r0, ra10, rb10 --sub r1, r1, r0 ; mul24 r0, ra9, rb9 --sub r1, r1, r0 ; mul24 r0, ra8, rb8 --sub r1, r1, r0 ; mul24 r0, ra15, rb15 --sub.ifnn r1, r1, r0 ; mov -, vw_wait -+nop ; mul24 r1, ra14, rb14 -+nop ; mul24 r0, ra13, rb13 -+add r1, r1, r0 ; mul24 r0, ra12, rb12 -+add r1, r1, r0 ; mul24 r0, ra11, rb11 -+add r1, r1, r0 ; mul24 r0, ra10, rb10 -+add r1, r1, r0 ; mul24 r0, ra9, rb9 -+add r1, r1, r0 ; mul24 r0, ra8, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb15 -+add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 15 -+asr r1, r1, 14 -+add r1, r1, ra21 -+asr r1, r1, 6 - min r1, r1, rb22 - add r0, vpm, 1 # Blend in previous VPM contents at this location - brr.anyn -, r:uvloop_b --- -2.7.4 - - -From 3d4e94b8f0b08fe4c0b582fc7f1dbe9d1d9d60ed Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 08:15:55 +0100 -Subject: [PATCH 22/68] Added flush for SAO - ---- - libavcodec/hevc.c | 2 +- - libavcodec/hevc_filter.c | 39 ++++++++++++++++++++++++++------------- - 2 files changed, 27 insertions(+), 14 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 47ddfff..93e1eba 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2903,7 +2903,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - rpi_execute_inter_qpu(s); - #endif - // Transform all blocks -- //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); - rpi_execute_transform(s); - // Perform inter prediction - rpi_execute_inter_cmds(s); -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 9b6e26d..92a8271 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -871,6 +871,21 @@ static void flush_buffer(AVBufferRef *bref) { - GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); - gpu_cache_flush(p); - } -+ -+static void ff_hevc_flush_chroma(HEVCContext *s) -+{ -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+ } -+} - #endif - - void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -@@ -886,31 +901,29 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - sao_filter_CTB(s, x - ctb_size, y); - if (y && x_end) { - sao_filter_CTB(s, x, y - ctb_size); -- if (s->threads_type & FF_THREAD_FRAME ) -+ if (s->threads_type & FF_THREAD_FRAME ) { -+#ifdef RPI_INTER_QPU -+ ff_hevc_flush_chroma(s); -+#endif - ff_thread_report_progress(&s->ref->tf, y, 0); -+ } - } - if (x_end && y_end) { - sao_filter_CTB(s, x , y); -- if (s->threads_type & FF_THREAD_FRAME ) -+ if (s->threads_type & FF_THREAD_FRAME ) { -+#ifdef RPI_INTER_QPU -+ ff_hevc_flush_chroma(s); -+#endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } - } - } else if (s->threads_type & FF_THREAD_FRAME && x_end) { - //int newh = y + ctb_size - 4; - //int currh = s->ref->tf.progress->data[0]; - //if (((y + ctb_size)&63)==0) -- if (!( s->nal_unit_type == NAL_TRAIL_N || -- s->nal_unit_type == NAL_TSA_N || -- s->nal_unit_type == NAL_STSA_N || -- s->nal_unit_type == NAL_RADL_N || -- s->nal_unit_type == NAL_RASL_N )) { - #ifdef RPI_INTER_QPU -- flush_buffer(s->frame->buf[1]); -- flush_buffer(s->frame->buf[2]); -+ ff_hevc_flush_chroma(s); - #endif -- //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -- //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -- //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -- } - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); - } - } --- -2.7.4 - - -From 3e337b9c4ef0c356a0259be2254ad1bc4d5bbe29 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 09:17:28 +0100 -Subject: [PATCH 23/68] Stopped using acceleration in unsupported cases - ---- - libavcodec/hevc.c | 14 +++++++------- - libavcodec/hevc_cabac.c | 4 ++-- - 2 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 93e1eba..bfd5a55 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -1152,15 +1152,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - for (i = 0; i < (size * size); i++) { - coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); - } -- printf("Cross component not supported\n"); // TODO -- exit(-1); - s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); - } - } - - if (lc->tu.cross_pf) { -- printf("Cross component not supported\n"); // TODO -- exit(-1); - hls_cross_component_pred(s, 1); - } - for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -@@ -1189,8 +1185,6 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, - for (i = 0; i < (size * size); i++) { - coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); - } -- printf("Cross component not supported\n"); // TODO -- exit(-1); - s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); - } - } -@@ -2857,7 +2851,13 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; - - #ifdef RPI -- s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+ && s->ps.sps->width <= RPI_MAX_WIDTH -+ && !s->ps.pps->cross_component_prediction_enabled_flag -+ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -+ && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -+ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -+ - #endif - - if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 4f072be..38f53de 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1513,9 +1513,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - #ifdef RPI - if (!use_vpu) { - int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -- if (max_xy == 0) -+ if (max_xy == 0) { - s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -- else { -+ } else { - int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; - if (max_xy < 4) - col_limit = FFMIN(4, col_limit); --- -2.7.4 - - -From 3941d3e4c2305fa037e8aba5a14cf698ac8673db Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 09:42:16 +0100 -Subject: [PATCH 24/68] Split B prediction into two passes - ---- - libavcodec/hevc.c | 1 + - libavcodec/hevc.h | 1 + - libavcodec/rpi_qpu.c | 3 + - libavcodec/rpi_qpu.h | 1 + - libavcodec/rpi_shader.c | 559 +++++++++++++++++++++++++++------------------ - libavcodec/rpi_shader.h | 11 +- - libavcodec/rpi_shader.qasm | 196 ++++++++++++++-- - 7 files changed, 531 insertions(+), 241 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index bfd5a55..4b133d2 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3801,6 +3801,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - p += uv_commands_per_qpu; - } - s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -+ s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); - s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); - - } -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index d513579..4a39e39 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -917,6 +917,7 @@ typedef struct HEVCContext { - uint32_t *u_mvs[8]; - // Function pointers - uint32_t mc_filter_uv; -+ uint32_t mc_filter_uv_b0; - uint32_t mc_filter_uv_b; - #endif - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 4e90cc1..60bf079 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -636,6 +636,9 @@ unsigned int qpu_get_fn(int num) { - case QPU_MC_FILTER_UV: - fn = mc_filter_uv; - break; -+ case QPU_MC_FILTER_UV_B0: -+ fn = mc_filter_uv_b0; -+ break; - case QPU_MC_FILTER_UV_B: - fn = mc_filter_uv_b; - break; -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index f9ad333..543c84b 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -29,6 +29,7 @@ enum { - QPU_MC_FILTER_HONLY, - QPU_MC_SETUP_UV, - QPU_MC_FILTER_UV, -+ QPU_MC_FILTER_UV_B0, - QPU_MC_FILTER_UV_B, - QPU_MC_INTERRUPT_EXIT8, - QPU_MC_END -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 5d00cb2..88ad20b 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -39,18 +39,18 @@ unsigned int rpi_shader[] = { - /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 - /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 - /* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 --/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 - /* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 - /* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 - /* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -@@ -62,176 +62,176 @@ unsigned int rpi_shader[] = { - /* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 - /* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 - /* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base --/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base --/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 --/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 --/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base - // ::mc_filter_uv --/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --// ::mc_filter_uv_b --/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_filter_uv_b0 -+/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 - /* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 - /* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif - /* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -@@ -253,7 +253,7 @@ unsigned int rpi_shader[] = { - /* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 - /* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - /* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 --// :uvloop_b -+// :uvloop_b0 - /* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 - /* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 - /* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -@@ -290,7 +290,7 @@ unsigned int rpi_shader[] = { - /* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 - /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 - /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 - /* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 - /* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop - /* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -@@ -306,48 +306,163 @@ unsigned int rpi_shader[] = { - /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 - /* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 - /* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_filter_uv_b -+/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :uvloop_b -+/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index e36c4ae..809e582 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,10 +4,11 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 142) --#define mc_filter_uv_b (rpi_shader + 360) --#define mc_exit (rpi_shader + 592) --#define mc_interrupt_exit8 (rpi_shader + 610) --#define mc_end (rpi_shader + 640) -+#define mc_filter_uv (rpi_shader + 150) -+#define mc_filter_uv_b0 (rpi_shader + 368) -+#define mc_filter_uv_b (rpi_shader + 586) -+#define mc_exit (rpi_shader + 818) -+#define mc_interrupt_exit8 (rpi_shader + 836) -+#define mc_end (rpi_shader + 866) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 870437d2..635b894 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -26,7 +26,7 @@ - # ra23 8 - # - # rb20 0xffffff00 --# rb21 64 -+# rb21 vpm_setup for writing 16bit results into VPM - # rb22 255 - # rb23 24 - # -@@ -34,7 +34,7 @@ - # rb25 frame width-1 - # rb26 height<<23 + width<<16 + vdw_setup_0 - # rb27 vdw_setup_0 (depends on QPU number) --# rb28 vpm_setup (depends on QPU number) -+# rb28 vpm_setup (depends on QPU number) for writing 8bit results into VPM - # rb29 vdw_setup_1(dst_pitch-width) - # rb30 frame height-1 - # rb31 used as temp to count loop iterations -@@ -69,8 +69,6 @@ - .set ra_y_next, ra28 - .set ra_y, ra29 - --.set rb_const_64, rb21 -- - - ################################################################################ - # mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -@@ -106,7 +104,6 @@ mov ra22, 256 - mov ra23, 8 - - mov rb20, 0xffffff00 --mov rb21, 64 - mov rb22, 255 - mov rb23, 24 - -@@ -123,6 +120,7 @@ mov ra15, 0 - - # Compute part of VPM to use for DMA output - mov r2, qpu_num -+shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) - and r2, r2, 15 - mov r1, r2 - asr r1, r1, 2 -@@ -135,16 +133,21 @@ shl r0, r0, 5 - add rb27, r0, r1 - - # Compute part of VPM to save data into --mov r2, qpu_num --and r2, r2, 15 --mov r1, r2 --asr r1, r1, 2 --shl r1, r1, 6 --mov r0, r2 --and r0, r0, 3 --add r0, r0, r1 --mov r1, vpm_setup(0, 4, h8p(0, 0)) -+mov r2, qpu_num # qpu_num = abcd -+shl r2, r2, 1 -+and r2, r2, 15 # r2 = bcd0 -+mov r1, r2 # r1 = bcd0 -+asr r1, r1, 2 # r1 = bc -+shl r1, r1, 6 # r1 = bc000000 -+mov r0, r2 # r0 = bcd0 -+and r0, r0, 3 # r0 = d0 -+add r0, r0, r1 # r0 = bc0000d0 -+mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit - add rb28, r0, r1 -+asr r0, r0, 1 # r0 = bc0000d -+# Prepare VPM command for 16bit intermediates -+mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -+add rb21, r0, r1 - - # Compute base address for first and second access - mov r0, ra_x_base # Load x -@@ -345,6 +348,171 @@ mov vw_addr, unif # start the VDW - - ################################################################################ - -+# mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+ -+# At this point we have already issued two pairs of texture requests for the current block -+# ra_x_base, ra_x16_base point to the current coordinates for this block -+::mc_filter_uv_b0 -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # x -+max r0, r0, 0; mov r1, unif # y -+min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+shl ra_xshift_next, r0, 3 -+sub r2, unif, r3 # compute offset from frame base u to frame base v -+add r0, r0, r3 -+and rb_x_base_next, r0, ~3 -+mov ra_y_next, r1 -+add ra_x2_base_next, rb_x_base_next, r2 -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ -+# get filter coefficients -+ -+mov r0, unif -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+asr rb15, r0, rb23; mul24 r0, r0, ra22 -+asr rb14, r0, rb23; mul24 r0, r0, ra22 -+asr rb13, r0, rb23; mul24 r0, r0, ra22 -+asr rb12, r0, rb23 -+ -+# r2 is elem_num -+# r3 is loop counter -+ -+mov r5rep, -8 -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+mov r3, 0 -+ -+:uvloop_b0 -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_x2_base, r2 -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+nop ; mul24 r2, r0, ra0 -+nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+nop ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+add r0, r2, r3 -+ -+mov r3, rb31 -+ -+mov ra8, ra9 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+mov ra13, ra14 -+ -+sub.setf -, r3, 8 ; mov r1, ra22 -+ -+# apply horizontal filter -+brr.anyn -, r:uvloop_b0 -+mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+asr ra15, r0, 8 ; nop -+nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r1, ra14, rb14 -+nop ; mul24 r0, ra13, rb13 -+add r1, r1, r0 ; mul24 r0, ra12, rb12 -+add r1, r1, r0 ; mul24 r0, ra11, rb11 -+add r1, r1, r0 ; mul24 r0, ra10, rb10 -+add r1, r1, r0 ; mul24 r0, ra9, rb9 -+add r1, r1, r0 ; mul24 r0, ra8, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb15 -+add r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+asr r1, r1, 14 -+add r1, r1, ra21 -+brr.anyn -, r:uvloop -+asr r1, r1, 6 # Delay 1 -+min r1, r1, rb22 # Delay 2 -+max vpm, r1, 0 # Delay 3 -+ -+# DMA out for U -+ -+mov vw_setup, rb26 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+# DMA out for V -+# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+# Could potentially push this write into the start of the next pipeline stage. -+mov r0, 16 -+mov -, vw_wait -+ -+bra -, ra31 -+add vw_setup, rb26, r0 # VDW setup 0 -+mov vw_setup, rb29 # Stride -+mov vw_addr, unif # start the VDW -+ -+################################################################################ -+ - ::mc_filter_uv_b - mov ra31, unif - --- -2.7.4 - - -From 85d0ffa2bcf6a2b94c1a0c8f84241cda9ac92ce2 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 10:04:55 +0100 -Subject: [PATCH 25/68] Switch to using 16bit temp buffers - ---- - libavcodec/hevc.c | 2 +- - libavcodec/rpi_shader.c | 4 ++-- - libavcodec/rpi_shader.qasm | 10 +++++----- - 3 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 4b133d2..28a6660 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2147,7 +2147,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -- u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 88ad20b..ffd3a07 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -220,7 +220,7 @@ unsigned int rpi_shader[] = { - /* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 - /* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 - /* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 - /* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 - /* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif - /* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -@@ -346,7 +346,7 @@ unsigned int rpi_shader[] = { - /* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 - /* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 - /* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 - /* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 - /* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif - /* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 635b894..9577121 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -26,7 +26,7 @@ - # ra23 8 - # - # rb20 0xffffff00 --# rb21 vpm_setup for writing 16bit results into VPM -+# rb21 vpm_setup for reading/writing 16bit results into VPM - # rb22 255 - # rb23 24 - # -@@ -370,8 +370,8 @@ and rb_x_base_next, r0, ~3 - mov ra_y_next, r1 - add ra_x2_base_next, rb_x_base_next, r2 - --# set up VPM write --mov vw_setup, rb28 -+# set up VPM write, we need to save 16bit precision -+mov vw_setup, rb21 - - # get width,height of block - mov r2, 16 -@@ -554,8 +554,8 @@ add r0, r0, r1 # Combine width and height of destination area - shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register - add rb26, r0, rb27 - --# In a B frame, so also set up VPM read --add vr_setup, r3, rb28 -+# In a B frame, so also set up VPM read (reading back 16bit precision) -+add vr_setup, r3, rb21 - - sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code - --- -2.7.4 - - -From abc51bf61df597082fbd7cf1bba5031e4d44318b Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 10:30:44 +0100 -Subject: [PATCH 26/68] Corrected B prediction: matching md5 sum for hobbit50 - ---- - libavcodec/rpi_shader.c | 815 ++++++++++++++++++++++----------------------- - libavcodec/rpi_shader.h | 12 +- - libavcodec/rpi_shader.qasm | 36 +- - 3 files changed, 429 insertions(+), 434 deletions(-) - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index ffd3a07..77cca46 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -38,431 +38,428 @@ unsigned int rpi_shader[] = { - /* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 - /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 - /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 --/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 --/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 --/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 --/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) --/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 --/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base --/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base --/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 --/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 --/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 - /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif - /* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base - // ::mc_filter_uv --/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop -+/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop -+/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b --/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 --/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 --/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 809e582..6562fa9 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,11 +4,11 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 150) --#define mc_filter_uv_b0 (rpi_shader + 368) --#define mc_filter_uv_b (rpi_shader + 586) --#define mc_exit (rpi_shader + 818) --#define mc_interrupt_exit8 (rpi_shader + 836) --#define mc_end (rpi_shader + 866) -+#define mc_filter_uv (rpi_shader + 152) -+#define mc_filter_uv_b0 (rpi_shader + 370) -+#define mc_filter_uv_b (rpi_shader + 584) -+#define mc_exit (rpi_shader + 812) -+#define mc_interrupt_exit8 (rpi_shader + 830) -+#define mc_end (rpi_shader + 860) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 9577121..562dc35 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -39,13 +39,13 @@ - # rb30 frame height-1 - # rb31 used as temp to count loop iterations - # --# ra24...ra30 15, 14, 13, 12, 11, 10, 9 - # ra24 clipped(row start address+8+elem_num)&~3 - # ra25 per-channel shifts 2 - # ra26 next ra24 - # ra27 next ra25 - # ra28 next y - # ra29 y for next texture access -+# ra30 64 - # - # ra31 next kernel address - -@@ -102,6 +102,7 @@ mov ra20, 1 - mov ra21, 32 - mov ra22, 256 - mov ra23, 8 -+mov ra30, 64 - - mov rb20, 0xffffff00 - mov rb22, 255 -@@ -472,7 +473,7 @@ sub.setf -, r3, 8 ; mov r1, ra22 - # apply horizontal filter - brr.anyn -, r:uvloop_b0 - mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll --asr ra15, r0, 8 ; nop -+asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? - nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) - - # apply vertical filter and write to VPM -@@ -487,18 +488,18 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 - add r1, r1, r0 ; mul24 r0, ra15, rb15 - add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 14 --add r1, r1, ra21 --brr.anyn -, r:uvloop --asr r1, r1, 6 # Delay 1 --min r1, r1, rb22 # Delay 2 --max vpm, r1, 0 # Delay 3 -+#asr r1, r1, 14 -+#add r1, r1, ra21 -+brr.anyn -, r:uvloop_b0 -+asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -+nop # Delay 2 -+nop # Delay 3 - - # DMA out for U - - mov vw_setup, rb26 # VDW setup 0 - mov vw_setup, rb29 # Stride --mov vw_addr, unif # start the VDW -+mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results - - # DMA out for V - # We need to wait for the U to complete first, but have nothing useful to compute while we wait. -@@ -639,12 +640,11 @@ mov ra12, ra13 - mov ra13, ra14 - - sub.setf -, r3, 8 ; mov r1, ra22 -- - # apply horizontal filter - brr.anyn -, r:uvloop_b - mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero - asr ra15, r0, 8 ; nop --nop ; nop -+nop ; nop # TODO improve use of delay slots - - # apply vertical filter and write to VPM - -@@ -658,15 +658,13 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 - add r1, r1, r0 ; mul24 r0, ra15, rb15 - add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 14 --add r1, r1, ra21 --asr r1, r1, 6 --min r1, r1, rb22 --add r0, vpm, 1 # Blend in previous VPM contents at this location -+asr r1, r1, 14 # shift2=6 -+add r1, r1, vpm # Blend in previous VPM contents at this location -+add r1, r1, ra30 - brr.anyn -, r:uvloop_b --max r1, r1, 0 --add r1, r1, r0 --shr vpm, r1, 1 -+asr r1, r1, 7 # Delay 1 -+min r1, r1, rb22 # Delay 2 -+max vpm, r1, 0 # Delay 3 - - - # DMA out for U --- -2.7.4 - - -From ea60373134f98099c4ebaf0d23cca666008b4bba Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 10:55:07 +0100 -Subject: [PATCH 27/68] P prediction uses 4 tap filters - ---- - libavcodec/hevc.c | 50 ++-- - libavcodec/rpi_shader.c | 631 ++++++++++++++++++++++----------------------- - libavcodec/rpi_shader.h | 10 +- - libavcodec/rpi_shader.qasm | 43 +-- - 4 files changed, 344 insertions(+), 390 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 28a6660..a47ebc5 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -65,15 +65,15 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) - - // TODO Chroma only needs 4 taps --static uint32_t rpi_filter_coefs[8][2] = { -- { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, -- { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } -+static uint32_t rpi_filter_coefs[8][1] = { -+ { ENCODE_COEFFS( 0, 64, 0, 0) }, -+ { ENCODE_COEFFS( -2, 58, 10, -2) }, -+ { ENCODE_COEFFS( -4, 54, 16, -2) }, -+ { ENCODE_COEFFS( -6, 46, 28, -4) }, -+ { ENCODE_COEFFS( -4, 36, 36, -4) }, -+ { ENCODE_COEFFS( -4, 28, 46, -6) }, -+ { ENCODE_COEFFS( -2, 16, 54, -4) }, -+ { ENCODE_COEFFS( -2, 10, 58, -2) } - }; - - static uint32_t get_vc_address(AVBufferRef *bref) { -@@ -2027,16 +2027,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); - *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; -- *u++ = rpi_filter_coefs[_mx][1]; -+ u++; - *u++ = rpi_filter_coefs[_my][0]; -- *u++ = rpi_filter_coefs[_my][1]; -+ u++; - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2084,16 +2084,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); - *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; -- *u++ = rpi_filter_coefs[_mx][1]; -+ u++; - *u++ = rpi_filter_coefs[_my][0]; -- *u++ = rpi_filter_coefs[_my][1]; -+ u++; - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2148,29 +2148,29 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); - *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -- u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; -- u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); - *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx2][0]; -- *u++ = rpi_filter_coefs[_mx2][1]; -+ u++; - *u++ = rpi_filter_coefs[_my2][0]; -- *u++ = rpi_filter_coefs[_my2][1]; -+ u++; - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 77cca46..c8d0728 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -116,8 +116,8 @@ unsigned int rpi_shader[] = { - /* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 - /* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 - /* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 - /* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 - /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 - /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -@@ -128,338 +128,315 @@ unsigned int rpi_shader[] = { - /* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 - /* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 - /* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 --/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop --/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop --/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b --/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 6562fa9..1bf7a68 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 152) --#define mc_filter_uv_b0 (rpi_shader + 370) --#define mc_filter_uv_b (rpi_shader + 584) --#define mc_exit (rpi_shader + 812) --#define mc_interrupt_exit8 (rpi_shader + 830) --#define mc_end (rpi_shader + 860) -+#define mc_filter_uv_b0 (rpi_shader + 324) -+#define mc_filter_uv_b (rpi_shader + 538) -+#define mc_exit (rpi_shader + 766) -+#define mc_interrupt_exit8 (rpi_shader + 784) -+#define mc_end (rpi_shader + 814) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 562dc35..8e4f18f 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -16,8 +16,8 @@ - # ra19 next ra17 - # - # rb16 pitch --# rb17 height + 5 --# rb18 height + 7 -+# rb17 height + 1 -+# rb18 height + 3 - # rb19 next ra16 - # - # ra20 1 -@@ -214,8 +214,8 @@ mov r0, unif - shr r1, r0, r2 # Extract width - sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) - and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 -+add rb17, r0, 1 -+add rb18, r0, 3 - shl r0, r0, 7 - add r0, r0, r1 # Combine width and height of destination area - shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -@@ -230,18 +230,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 - asr ra2, r0, rb23; mul24 r0, r0, ra22 - asr ra1, r0, rb23; mul24 r0, r0, ra22 - asr ra0, r0, rb23; mov r0, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif -+ mov r0, unif - asr rb11, r0, rb23; mul24 r0, r0, ra22 - asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 - asr rb8, r0, rb23; mov r0, unif --asr rb15, r0, rb23; mul24 r0, r0, ra22 --asr rb14, r0, rb23; mul24 r0, r0, ra22 --asr rb13, r0, rb23; mul24 r0, r0, ra22 --asr rb12, r0, rb23 - - # r2 is elem_num - # r3 is loop counter -@@ -283,26 +276,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 - add r0, r2, r3 - - mov r3, rb31 - --mov ra8, ra9 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 - mov ra12, ra13 - mov ra13, ra14 - --sub.setf -, r3, 8 ; mov r1, ra22 -+sub.setf -, r3, 4 ; mov r1, ra22 - - # apply horizontal filter - brr.anyn -, r:uvloop -@@ -312,14 +293,10 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr - - # apply vertical filter and write to VPM - --nop ; mul24 r1, ra14, rb14 --nop ; mul24 r0, ra13, rb13 --add r1, r1, r0 ; mul24 r0, ra12, rb12 --add r1, r1, r0 ; mul24 r0, ra11, rb11 --add r1, r1, r0 ; mul24 r0, ra10, rb10 --add r1, r1, r0 ; mul24 r0, ra9, rb9 --add r1, r1, r0 ; mul24 r0, ra8, rb8 --add r1, r1, r0 ; mul24 r0, ra15, rb15 -+nop ; mul24 r1, ra14, rb10 -+nop ; mul24 r0, ra13, rb9 -+add r1, r1, r0 ; mul24 r0, ra12, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb11 - add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 - asr r1, r1, 14 --- -2.7.4 - - -From e4bdd110d4640519b751ab428e7976a1e9a15802 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 11:03:51 +0100 -Subject: [PATCH 28/68] Optimised B0 pass - ---- - libavcodec/rpi_shader.c | 424 +++++++++++++++++++++------------------------ - libavcodec/rpi_shader.h | 8 +- - libavcodec/rpi_shader.qasm | 43 +---- - 3 files changed, 212 insertions(+), 263 deletions(-) - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index c8d0728..1f63ee0 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -204,239 +204,215 @@ unsigned int rpi_shader[] = { - /* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 - /* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 - /* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 - /* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 - /* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 - /* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 - /* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 --/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b --/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 1bf7a68..cb74887 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; - #define mc_setup_uv (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 152) - #define mc_filter_uv_b0 (rpi_shader + 324) --#define mc_filter_uv_b (rpi_shader + 538) --#define mc_exit (rpi_shader + 766) --#define mc_interrupt_exit8 (rpi_shader + 784) --#define mc_end (rpi_shader + 814) -+#define mc_filter_uv_b (rpi_shader + 490) -+#define mc_exit (rpi_shader + 718) -+#define mc_interrupt_exit8 (rpi_shader + 736) -+#define mc_end (rpi_shader + 766) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 8e4f18f..faa5755 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -357,15 +357,13 @@ mov r0, unif - shr r1, r0, r2 # Extract width - sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) - and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 -+add rb17, r0, 1 -+add rb18, r0, 3 - shl r0, r0, 7 - add r0, r0, r1 # Combine width and height of destination area - shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register - add rb26, r0, rb27 - --sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -- - # get filter coefficients - - mov r0, unif -@@ -373,18 +371,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 - asr ra2, r0, rb23; mul24 r0, r0, ra22 - asr ra1, r0, rb23; mul24 r0, r0, ra22 - asr ra0, r0, rb23; mov r0, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif -+ mov r0, unif - asr rb11, r0, rb23; mul24 r0, r0, ra22 - asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 - asr rb8, r0, rb23; mov r0, unif --asr rb15, r0, rb23; mul24 r0, r0, ra22 --asr rb14, r0, rb23; mul24 r0, r0, ra22 --asr rb13, r0, rb23; mul24 r0, r0, ra22 --asr rb12, r0, rb23 - - # r2 is elem_num - # r3 is loop counter -@@ -426,26 +417,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 - add r0, r2, r3 - - mov r3, rb31 - --mov ra8, ra9 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 - mov ra12, ra13 - mov ra13, ra14 - --sub.setf -, r3, 8 ; mov r1, ra22 -+sub.setf -, r3, 4 ; mov r1, ra22 - - # apply horizontal filter - brr.anyn -, r:uvloop_b0 -@@ -455,18 +434,12 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr - - # apply vertical filter and write to VPM - --nop ; mul24 r1, ra14, rb14 --nop ; mul24 r0, ra13, rb13 --add r1, r1, r0 ; mul24 r0, ra12, rb12 --add r1, r1, r0 ; mul24 r0, ra11, rb11 --add r1, r1, r0 ; mul24 r0, ra10, rb10 --add r1, r1, r0 ; mul24 r0, ra9, rb9 --add r1, r1, r0 ; mul24 r0, ra8, rb8 --add r1, r1, r0 ; mul24 r0, ra15, rb15 -+nop ; mul24 r1, ra14, rb10 -+nop ; mul24 r0, ra13, rb9 -+add r1, r1, r0 ; mul24 r0, ra12, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb11 - add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --#asr r1, r1, 14 --#add r1, r1, ra21 - brr.anyn -, r:uvloop_b0 - asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots - nop # Delay 2 --- -2.7.4 - - -From 93805e78a13d36e28ed84a0e8456da2eac45be89 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 11:12:43 +0100 -Subject: [PATCH 29/68] Optimised B pass - ---- - libavcodec/rpi_shader.c | 202 ++++++++++++++++++++------------------------- - libavcodec/rpi_shader.h | 6 +- - libavcodec/rpi_shader.qasm | 41 ++------- - 3 files changed, 100 insertions(+), 149 deletions(-) - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 1f63ee0..4e6c5ea 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -289,8 +289,8 @@ unsigned int rpi_shader[] = { - /* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 - /* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 - /* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 - /* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 - /* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 - /* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -@@ -299,120 +299,96 @@ unsigned int rpi_shader[] = { - /* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 - /* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 - /* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 --/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 --/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 --/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 --/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 --/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 --/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 --/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 --/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 --/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 --/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 --/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index cb74887..53da629 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -7,8 +7,8 @@ extern unsigned int rpi_shader[]; - #define mc_filter_uv (rpi_shader + 152) - #define mc_filter_uv_b0 (rpi_shader + 324) - #define mc_filter_uv_b (rpi_shader + 490) --#define mc_exit (rpi_shader + 718) --#define mc_interrupt_exit8 (rpi_shader + 736) --#define mc_end (rpi_shader + 766) -+#define mc_exit (rpi_shader + 670) -+#define mc_interrupt_exit8 (rpi_shader + 688) -+#define mc_end (rpi_shader + 718) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index faa5755..f38c926 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -491,8 +491,8 @@ mov r0, unif - shr r1, r0, r2 # Extract width - sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) - and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 -+add rb17, r0, 1 -+add rb18, r0, 3 - shl r0, r0, 7 - - # r0 is currently height<<7 -@@ -508,8 +508,6 @@ add rb26, r0, rb27 - # In a B frame, so also set up VPM read (reading back 16bit precision) - add vr_setup, r3, rb21 - --sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -- - # get filter coefficients - - mov r0, unif -@@ -517,18 +515,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 - asr ra2, r0, rb23; mul24 r0, r0, ra22 - asr ra1, r0, rb23; mul24 r0, r0, ra22 - asr ra0, r0, rb23; mov r0, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif -+ mov r0, unif - asr rb11, r0, rb23; mul24 r0, r0, ra22 - asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 - asr rb8, r0, rb23; mov r0, unif --asr rb15, r0, rb23; mul24 r0, r0, ra22 --asr rb14, r0, rb23; mul24 r0, r0, ra22 --asr rb13, r0, rb23; mul24 r0, r0, ra22 --asr rb12, r0, rb23 - - # r2 is elem_num - # r3 is loop counter -@@ -570,26 +561,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 - add r0, r2, r3 - - mov r3, rb31 - --mov ra8, ra9 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 - mov ra12, ra13 - mov ra13, ra14 - --sub.setf -, r3, 8 ; mov r1, ra22 -+sub.setf -, r3, 4 ; mov r1, ra22 - # apply horizontal filter - brr.anyn -, r:uvloop_b - mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -@@ -598,14 +577,10 @@ nop ; nop # TODO improve use of delay slots - - # apply vertical filter and write to VPM - --nop ; mul24 r1, ra14, rb14 --nop ; mul24 r0, ra13, rb13 --add r1, r1, r0 ; mul24 r0, ra12, rb12 --add r1, r1, r0 ; mul24 r0, ra11, rb11 --add r1, r1, r0 ; mul24 r0, ra10, rb10 --add r1, r1, r0 ; mul24 r0, ra9, rb9 --add r1, r1, r0 ; mul24 r0, ra8, rb8 --add r1, r1, r0 ; mul24 r0, ra15, rb15 -+nop ; mul24 r1, ra14, rb10 -+nop ; mul24 r0, ra13, rb9 -+add r1, r1, r0 ; mul24 r0, ra12, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb11 - add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 - asr r1, r1, 14 # shift2=6 --- -2.7.4 - - -From e48df43c16de74dddbc7c702d64dd01eaf8e6b39 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 11:17:09 +0100 -Subject: [PATCH 30/68] Used P delay slots more efficiently - ---- - libavcodec/rpi_shader.c | 437 ++++++++++++++++++++++----------------------- - libavcodec/rpi_shader.h | 10 +- - libavcodec/rpi_shader.qasm | 19 +- - 3 files changed, 228 insertions(+), 238 deletions(-) - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 4e6c5ea..a1af4e3 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -156,239 +156,236 @@ unsigned int rpi_shader[] = { - /* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - /* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - /* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop - /* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 --/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 --/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 --/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b --/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 --/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 53da629..1fb3e37 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 152) --#define mc_filter_uv_b0 (rpi_shader + 324) --#define mc_filter_uv_b (rpi_shader + 490) --#define mc_exit (rpi_shader + 670) --#define mc_interrupt_exit8 (rpi_shader + 688) --#define mc_end (rpi_shader + 718) -+#define mc_filter_uv_b0 (rpi_shader + 318) -+#define mc_filter_uv_b (rpi_shader + 484) -+#define mc_exit (rpi_shader + 664) -+#define mc_interrupt_exit8 (rpi_shader + 682) -+#define mc_end (rpi_shader + 712) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index f38c926..02e95dd 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -268,6 +268,7 @@ add t0s, ra_x2_base, r2 - - mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - -+# apply horizontal filter - nop ; mul24 r2, r0, ra0 - nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 - nop ; mul24 r3, ra1 << 1, r0 << 1 -@@ -276,20 +277,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r0, r2, r3 -- --mov r3, rb31 -- --mov ra12, ra13 --mov ra13, ra14 -- --sub.setf -, r3, 4 ; mov r1, ra22 -- --# apply horizontal filter -+add r0, r2, r3 ; mov r3, rb31 -+sub.setf -, r3, 4 ; mov ra12, ra13 - brr.anyn -, r:uvloop --mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll --asr ra15, r0, 8 ; nop --nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+mov ra13, ra14 # Delay slot 1 -+mov ra14, ra15 # Delay slot 2 -+mov ra15, r0 # Delay slot 3 - - # apply vertical filter and write to VPM - --- -2.7.4 - - -From b33dfc243ff5509299685add3c532ab7f207fd73 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 11:22:25 +0100 -Subject: [PATCH 31/68] Improved use of delay slots - ---- - libavcodec/rpi_shader.c | 503 ++++++++++++++++++++++----------------------- - libavcodec/rpi_shader.h | 10 +- - libavcodec/rpi_shader.qasm | 41 ++-- - 3 files changed, 265 insertions(+), 289 deletions(-) - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index a1af4e3..c498f28 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -122,270 +122,263 @@ unsigned int rpi_shader[] = { - /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 - /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 - /* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 --/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 --/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 --/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b --/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 --/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 --/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 --/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 --/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop --/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_interrupt_exit8 -+/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait - /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop --// ::mc_interrupt_exit8 --/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 1fb3e37..3fac45f 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 152) --#define mc_filter_uv_b0 (rpi_shader + 318) --#define mc_filter_uv_b (rpi_shader + 484) --#define mc_exit (rpi_shader + 664) --#define mc_interrupt_exit8 (rpi_shader + 682) --#define mc_end (rpi_shader + 712) -+#define mc_filter_uv_b0 (rpi_shader + 316) -+#define mc_filter_uv_b (rpi_shader + 476) -+#define mc_exit (rpi_shader + 650) -+#define mc_interrupt_exit8 (rpi_shader + 668) -+#define mc_end (rpi_shader + 698) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 02e95dd..10f5113 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -221,8 +221,6 @@ add r0, r0, r1 # Combine width and height of destination area - shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register - add rb26, r0, rb27 - --sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -- - # get filter coefficients - - mov r0, unif -@@ -410,20 +408,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r0, r2, r3 -- --mov r3, rb31 -- --mov ra12, ra13 --mov ra13, ra14 -- --sub.setf -, r3, 4 ; mov r1, ra22 -- --# apply horizontal filter -+add r0, r2, r3 ; mov r3, rb31 -+sub.setf -, r3, 4 ; mov ra12, ra13 - brr.anyn -, r:uvloop_b0 --mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll --asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? --nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+mov ra13, ra14 # Delay slot 1 -+mov ra14, ra15 # Delay slot 2 -+mov ra15, r0 # Delay slot 3 - - # apply vertical filter and write to VPM - -@@ -432,9 +422,9 @@ nop ; mul24 r0, ra13, rb9 - add r1, r1, r0 ; mul24 r0, ra12, rb8 - add r1, r1, r0 ; mul24 r0, ra15, rb11 - add r1, r1, r0 ; mov -, vw_wait --sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+sub.setf -, r3, rb18 - brr.anyn -, r:uvloop_b0 --asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -+asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision - nop # Delay 2 - nop # Delay 3 - -@@ -554,19 +544,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 - nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 - add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 - nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r0, r2, r3 -- --mov r3, rb31 -- --mov ra12, ra13 --mov ra13, ra14 -- --sub.setf -, r3, 4 ; mov r1, ra22 --# apply horizontal filter -+add r0, r2, r3 ; mov r3, rb31 -+sub.setf -, r3, 4 ; mov ra12, ra13 - brr.anyn -, r:uvloop_b --mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero --asr ra15, r0, 8 ; nop --nop ; nop # TODO improve use of delay slots -+mov ra13, ra14 # Delay slot 1 -+mov ra14, ra15 # Delay slot 2 -+mov ra15, r0 # Delay slot 3 - - # apply vertical filter and write to VPM - --- -2.7.4 - - -From af59f8e00eb977e97debc5e72ba47e0077db1787 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 11:31:23 +0100 -Subject: [PATCH 32/68] Avoid writeback of first B results - ---- - libavcodec/rpi_shader.c | 229 ++++++++++++++++++++++----------------------- - libavcodec/rpi_shader.h | 8 +- - libavcodec/rpi_shader.qasm | 18 +--- - 3 files changed, 121 insertions(+), 134 deletions(-) - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index c498f28..ba453a2 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -255,130 +255,125 @@ unsigned int rpi_shader[] = { - /* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 - /* [0x00000718] */ 0x009e7000, 0x100009e7, // nop - /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop - // ::mc_filter_uv_b --/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif - /* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 3fac45f..45dbe0e 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; - #define mc_setup_uv (rpi_shader + 0) - #define mc_filter_uv (rpi_shader + 152) - #define mc_filter_uv_b0 (rpi_shader + 316) --#define mc_filter_uv_b (rpi_shader + 476) --#define mc_exit (rpi_shader + 650) --#define mc_interrupt_exit8 (rpi_shader + 668) --#define mc_end (rpi_shader + 698) -+#define mc_filter_uv_b (rpi_shader + 466) -+#define mc_exit (rpi_shader + 640) -+#define mc_interrupt_exit8 (rpi_shader + 658) -+#define mc_end (rpi_shader + 688) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 10f5113..e138c95 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -428,22 +428,14 @@ asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still - nop # Delay 2 - nop # Delay 3 - -+# in pass0 we don't really need to save any results, but need to discard the uniforms - # DMA out for U - --mov vw_setup, rb26 # VDW setup 0 --mov vw_setup, rb29 # Stride --mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results -- --# DMA out for V --# We need to wait for the U to complete first, but have nothing useful to compute while we wait. --# Could potentially push this write into the start of the next pipeline stage. --mov r0, 16 --mov -, vw_wait -- - bra -, ra31 --add vw_setup, rb26, r0 # VDW setup 0 --mov vw_setup, rb29 # Stride --mov vw_addr, unif # start the VDW -+mov r0, unif # Delay 1 -+mov r0, unif # Delay 2 -+nop # Delay 3 -+ - - ################################################################################ - --- -2.7.4 - - -From 12e57278cb19a769d2e1488e8e94003027493d09 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 14 May 2015 11:36:24 +0100 -Subject: [PATCH 33/68] Cutdown size of chroma prediction commands - ---- - libavcodec/hevc.c | 17 +- - libavcodec/rpi_shader.c | 543 ++++++++++++++++++++++----------------------- - libavcodec/rpi_shader.h | 12 +- - libavcodec/rpi_shader.qasm | 11 +- - 4 files changed, 281 insertions(+), 302 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index a47ebc5..32b89d5 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -56,7 +56,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - - #ifdef RPI_INTER_QPU - --#define RPI_CHROMA_COMMAND_WORDS 12 -+#define RPI_CHROMA_COMMAND_WORDS 10 - #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) - // The QPU code for UV blocks only works up to a block width of 8 - #define RPI_CHROMA_BLOCK_WIDTH 8 -@@ -2032,11 +2032,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); - *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; -- u++; - *u++ = rpi_filter_coefs[_my][0]; -- u++; - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2091,9 +2088,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; -- u++; - *u++ = rpi_filter_coefs[_my][0]; -- u++; - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2154,11 +2149,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); - *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ u+=2; // Intermediate results are not written back in first pass of B filtering - - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; - u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -@@ -2166,11 +2158,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); - *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx2][0]; -- u++; - *u++ = rpi_filter_coefs[_my2][0]; -- u++; - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2808,7 +2797,7 @@ static void rpi_inter_clear(HEVCContext *s) - *s->u_mvs[i]++ = pic_height; - *s->u_mvs[i]++ = s->frame->linesize[1]; - *s->u_mvs[i]++ = s->frame->linesize[2]; -- s->u_mvs[i] += 3; // Padding words -+ s->u_mvs[i] += 1; // Padding words - } - } - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index ba453a2..b0b93b5 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -89,291 +89,286 @@ unsigned int rpi_shader[] = { - /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 - /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 - /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base - // ::mc_filter_uv --/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 --/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 --/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -+/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif - /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop - // ::mc_filter_uv_b --/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 45dbe0e..99927c4 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,11 +4,11 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 152) --#define mc_filter_uv_b0 (rpi_shader + 316) --#define mc_filter_uv_b (rpi_shader + 466) --#define mc_exit (rpi_shader + 640) --#define mc_interrupt_exit8 (rpi_shader + 658) --#define mc_end (rpi_shader + 688) -+#define mc_filter_uv (rpi_shader + 148) -+#define mc_filter_uv_b0 (rpi_shader + 310) -+#define mc_filter_uv_b (rpi_shader + 458) -+#define mc_exit (rpi_shader + 630) -+#define mc_interrupt_exit8 (rpi_shader + 648) -+#define mc_end (rpi_shader + 678) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index e138c95..d9ffcda 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -167,8 +167,6 @@ add t0s, r2, r1 - - # Dump padding words - mov r0, unif --mov r0, unif --mov r0, unif - - # submit texture requests for second line - max r1, ra_y, 0 -@@ -228,11 +226,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 - asr ra2, r0, rb23; mul24 r0, r0, ra22 - asr ra1, r0, rb23; mul24 r0, r0, ra22 - asr ra0, r0, rb23; mov r0, unif -- mov r0, unif - asr rb11, r0, rb23; mul24 r0, r0, ra22 - asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif -+asr rb8, r0, rb23 - - # r2 is elem_num - # r3 is loop counter -@@ -362,11 +359,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 - asr ra2, r0, rb23; mul24 r0, r0, ra22 - asr ra1, r0, rb23; mul24 r0, r0, ra22 - asr ra0, r0, rb23; mov r0, unif -- mov r0, unif - asr rb11, r0, rb23; mul24 r0, r0, ra22 - asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif -+asr rb8, r0, rb23 - - # r2 is elem_num - # r3 is loop counter -@@ -490,11 +486,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 - asr ra2, r0, rb23; mul24 r0, r0, ra22 - asr ra1, r0, rb23; mul24 r0, r0, ra22 - asr ra0, r0, rb23; mov r0, unif -- mov r0, unif - asr rb11, r0, rb23; mul24 r0, r0, ra22 - asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif -+asr rb8, r0, rb23 - - # r2 is elem_num - # r3 is loop counter --- -2.7.4 - - -From 3e8f02cf9d3e4bfcd07a5fcf321ace07c4f2e6f3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 14 May 2015 15:21:49 +0100 -Subject: [PATCH 34/68] hevc: don't redirect when not rpi_enabled - ---- - libavcodec/hevc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 32b89d5..2459e34 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -1468,7 +1468,7 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) - */ - - #ifdef RPI_INTER --#define RPI_REDIRECT(fn) rpi_ ## fn -+#define RPI_REDIRECT(fn) (s->enable_rpi ? rpi_ ## fn : fn) - static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref, const Mv *mv, int x_off, int y_off, - int block_w, int block_h, int luma_weight, int luma_offset) --- -2.7.4 - - -From 6da455b382b28c3c1f4e98c1703a695cdb946ad3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 14 May 2015 15:22:02 +0100 -Subject: [PATCH 35/68] Use /dev/vcio for mailbox access - ---- - libavcodec/rpi_mailbox.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -index 536896f..77a56dd 100644 ---- a/libavcodec/rpi_mailbox.c -+++ b/libavcodec/rpi_mailbox.c -@@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - #define MAJOR_NUM 100 - #define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) --#define DEVICE_FILE_NAME "/dev/char_dev" -+#define DEVICE_FILE_NAME "/dev/vcio" - - #include "rpi_mailbox.h" - --- -2.7.4 - - -From f96ef6131f16a4c03b8e2882bdf7319c3b646a6c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 14 May 2015 15:25:25 +0100 -Subject: [PATCH 36/68] Use vcsm for all memory allocations - ---- - libavcodec/rpi_qpu.c | 174 +++++++++++++++++++-------------------------------- - 1 file changed, 64 insertions(+), 110 deletions(-) - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 60bf079..f62051f 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -1,7 +1,5 @@ - #ifdef RPI --// define RPI_USE_VCSM to use the vcsm device for shared memory - // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. --#define RPI_USE_VCSM - // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code - #define RPI_TIME_TOTAL_QPU - // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -@@ -25,9 +23,7 @@ - #include "rpi_shader.h" - #include "rpi_hevc_transform.h" - --#ifdef RPI_USE_VCSM - #include "rpi_user_vcsm.h" --#endif - - // On Pi2 there is no way to access the VPU L2 cache - // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -@@ -96,7 +92,6 @@ struct GPU - unsigned int vpu_code[VPU_CODE_SIZE]; - short transMatrix2even[16*16*2]; - int open_count; // Number of allocated video buffers -- unsigned int vc_handle; // Handle of this memory - int mb; // Mailbox handle - int vc; // Address in GPU memory - int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -@@ -105,6 +100,7 @@ struct GPU - // Stop more than one thread trying to allocate memory or use the processing resources at once - static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; - static volatile struct GPU* gpu = NULL; -+static GPU_MEM_PTR_T gpu_mem_ptr; - - #if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) - static unsigned int Microseconds(void) { -@@ -132,39 +128,27 @@ static volatile int vpu_async_tail=0; // Contains the number of posted jobs - static volatile int vpu_async_head=0; - #endif - -+static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb); -+static void gpu_free_internal(GPU_MEM_PTR_T *p); -+ - // Connect to QPU, returns 0 on success. - static int gpu_init(volatile struct GPU **gpu) { - int mb = mbox_open(); - int vc; -- int handle; - volatile struct GPU* ptr; - if (mb < 0) - return -1; - - if (qpu_enable(mb, 1)) return -2; - --#ifdef RPI_USE_VCSM - vcsm_init(); --#endif -+ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -+ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -+ memset(ptr, 0, sizeof *ptr); -+ vc = gpu_mem_ptr.vc; - -- handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); -- if (!handle) -- { -- qpu_enable(mb, 0); -- return -3; -- } -- vc = mem_lock(mb, handle); -- ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); -- if (ptr == NULL) -- { mem_free(mb, handle); -- mem_unlock(mb, handle); -- qpu_enable(mb, 0); -- return -4; -- } -- -- ptr->mb = mb; -- ptr->vc_handle = handle; -- ptr->vc = vc; -+ ptr->mb = mb; -+ ptr->vc = vc; - - printf("GPU allocated at 0x%x\n",vc); - -@@ -226,94 +210,74 @@ static void gpu_unlock(void) { - pthread_mutex_unlock(&gpu_mutex); - } - -+static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+ assert(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+ assert(p->vc_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+ assert(p->arm); -+ p->vc = mem_lock(mb, p->vc_handle); -+ assert(p->vc); -+ return 0; -+} -+ - // Allocate memory on GPU - // Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes - // Returns 0 on success. - // This allocates memory that will not be cached in ARM's data cache. - // Therefore safe to use without data cache flushing. --int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { -+int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -+{ -+ int r; - gpu_lock(); -- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -- p->vcsm_handle = 0; -- if (!p->vc_handle) -- { -- qpu_enable(gpu->mb, 0); -- return -3; -- } -- p->vc = mem_lock(gpu->mb, p->vc_handle); -- p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -- p->numbytes = numbytes; -- if (p->arm == NULL) -- { -- mem_free(gpu->mb, p->vc_handle); -- mem_unlock(gpu->mb, p->vc_handle); -- gpu_unlock(); -- qpu_enable(gpu->mb, 0); -- return -4; -- } -+ r = gpu_malloc_uncached_internal(numbytes, p, gpu->mb); - gpu->open_count++; - gpu_unlock(); -- return 0; -+ return r; - } - - void gpu_cache_flush(GPU_MEM_PTR_T *p) - { -- // This only works when using RPI_USE_VCSM - void *tmp = vcsm_lock(p->vcsm_handle); - vcsm_unlock_ptr(tmp); - } - -+static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); -+ assert(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+ assert(p->vc_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+ assert(p->arm); -+ p->vc = mem_lock(gpu->mb, p->vc_handle); -+ assert(p->vc); -+ return 0; -+} -+ - // This allocates data that will be - // Cached in ARM L2 - // Uncached in VPU L2 --int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -+int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) -+{ -+ int r; - gpu_lock(); --#ifdef RPI_USE_VCSM -- { -- p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? -- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works -- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up -- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) -- p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -- p->arm = vcsm_lock(p->vcsm_handle); -- p->vc = mem_lock(gpu->mb, p->vc_handle); -- } --#else -- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -- p->vcsm_handle = 0; -- if (!p->handle) -- { -- qpu_enable(gpu->mb, 0); -- return -3; -- } -- p->vc = mem_lock(gpu->mb, p->vc_handle); -- printf("This mapmem_private does not seem to work\n"); -- exit(-1); -- p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -- p->numbytes = numbytes; -- if (p->arm == NULL) -- { -- mem_free(gpu->mb, p->handle); -- mem_unlock(gpu->mb, p->handle); -- gpu_unlock(); -- qpu_enable(gpu->mb, 0); -- return -4; -- } --#endif -+ r = gpu_malloc_cached_internal(numbytes, p); - gpu->open_count++; - gpu_unlock(); -- return 0; -+ return r; - } - - static void gpu_term(void) - { -- int mb; -- unsigned handle; -+ int mb; - - if (gpu==NULL) - return; - mb = gpu->mb; -- handle = gpu->vc_handle; - - #ifdef RPI_ASYNC - { -@@ -323,37 +287,26 @@ static void gpu_term(void) - } - #endif - -+ qpu_enable(mb, 0); -+ gpu_free_internal(&gpu_mem_ptr); - -- unmapmem((void*)gpu, sizeof(struct GPU)); -- mem_unlock(mb, handle); -- mem_free(mb, handle); -- qpu_enable(mb, 0); --#ifdef RPI_USE_VCSM - vcsm_exit(); --#endif -- mbox_close(mb); -+ -+ mbox_close(mb); - gpu = NULL; - } - --void gpu_free(GPU_MEM_PTR_T *p) { -+void gpu_free_internal(GPU_MEM_PTR_T *p) { - int mb = gpu->mb; -- unsigned handle = p->vc_handle; -+ mem_unlock(mb,p->vc_handle); -+ vcsm_unlock_ptr(p->arm); -+ vcsm_free(p->vcsm_handle); -+} -+ -+void gpu_free(GPU_MEM_PTR_T *p) { - gpu_lock(); --#ifdef RPI_USE_VCSM -- if (p->vcsm_handle) { -- mem_unlock(mb,p->vc_handle); -- vcsm_unlock_ptr(p->arm); -- vcsm_free(p->vcsm_handle); -- } else { -- unmapmem((void*)p->arm, sizeof(struct GPU)); -- mem_unlock(mb, handle); -- mem_free(mb, handle); -- } --#else -- unmapmem((void*)p->arm, sizeof(struct GPU)); -- mem_unlock(mb, handle); -- mem_free(mb, handle); --#endif -+ -+ gpu_free_internal(p); - - gpu->open_count--; - if (gpu->open_count==0) { -@@ -386,20 +339,21 @@ unsigned int vpu_get_constants(void) { - - static void *vpu_start(void *arg) { - while(1) { -+ int *p; - pthread_mutex_lock(&post_mutex); - while( vpu_async_tail - vpu_async_head <= 0) - { - //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); - pthread_cond_wait(&post_cond_tail, &post_mutex); - } -- int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ p = vpu_cmds[vpu_async_head%MAXCMDS]; - pthread_mutex_unlock(&post_mutex); - - if (p[6] == -1) { - break; // Last job - } - if (p[7]) { -- GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; - //gpu_cache_flush(buf); - } - vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); --- -2.7.4 - - -From 7c94b833b48a455d27d82eb2ca1b53a162705caf Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 14 May 2015 15:43:17 +0100 -Subject: [PATCH 37/68] Enable EARLY_MALLOC and fix sps access bug - ---- - libavcodec/hevc.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 2459e34..4e82a15 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -44,7 +44,7 @@ - #ifdef RPI - #include "rpi_qpu.h" - // For some unknown reason, the code seems to crash if I do a late malloc -- #define EARLY_MALLOC -+ //#define EARLY_MALLOC - // Move Inter prediction into separate pass - #define RPI_INTER - #endif -@@ -149,7 +149,8 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - #ifdef RPI - #ifdef EARLY_MALLOC - #else -- int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); -+ assert(sps); -+ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); - int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma - printf("pic_arrays_init\n"); - printf("Allocated %d\n",coefs_per_row); --- -2.7.4 - - -From 0a0a92817a7959d213dca9c75a242b6ad88d6b80 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 14 May 2015 16:40:51 +0100 -Subject: [PATCH 38/68] Add copy of av_mod_uintp2 for use with stable ffmpeg - ---- - libavcodec/hevc.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 4e82a15..80db603 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -51,6 +51,14 @@ - - // #define DISABLE_MC - -+#ifndef av_mod_uintp2 -+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) -+{ -+ return a & ((1 << p) - 1); -+} -+# define av_mod_uintp2 av_mod_uintp2_c -+#endif -+ - const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; - - --- -2.7.4 - - -From c48d08e968b24c2e260b0cc76c7901a1b4d75bbf Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Mon, 18 May 2015 11:11:02 +0100 -Subject: [PATCH 39/68] Added support for weighted prediction in P frames - ---- - libavcodec/hevc.c | 52 ++++- - libavcodec/rpi_shader.c | 566 +++++++++++++++++++++++---------------------- - libavcodec/rpi_shader.h | 12 +- - libavcodec/rpi_shader.qasm | 39 +++- - 4 files changed, 384 insertions(+), 285 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 80db603..9668ef8 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -64,7 +64,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - - #ifdef RPI_INTER_QPU - --#define RPI_CHROMA_COMMAND_WORDS 10 -+#define RPI_CHROMA_COMMAND_WORDS 12 - #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) - // The QPU code for UV blocks only works up to a block width of 8 - #define RPI_CHROMA_BLOCK_WIDTH 8 -@@ -2031,6 +2031,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int y1_c = y0_c + (mv->y >> (2 + hshift)); - //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width - int chan = x0>>8; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { -@@ -2043,6 +2045,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = ( (nPbW_csh.chroma_offset_l0[current_mv.ref_idx[0]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0] & 0xffff); -+ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1] & 0xffff); -+ } else { -+ *u++ = 1; // Weight of 1 and offset of 0 -+ *u++ = 1; -+ } - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2085,6 +2094,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int y1_c = y0_c + (mv->y >> (2 + hshift)); - //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width - int chan = x0>>8; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { -@@ -2098,6 +2109,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; - *u++ = rpi_filter_coefs[_my][0]; -+ if (weight_flag) { -+ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); -+ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); -+ } else { -+ *u++ = 1; // Weight of 1 and offset of 0 -+ *u++ = 1; -+ } - *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2159,6 +2177,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = ( (nPbW_cmc_filter_uv_b; -@@ -2169,6 +2188,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } -@@ -2795,6 +2815,9 @@ static void rpi_inter_clear(HEVCContext *s) - int i; - int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; - int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ - for(i=0;i<8;i++) { - s->u_mvs[i] = s->mvs_base[i]; - *s->u_mvs[i]++ = 0; -@@ -2806,6 +2829,13 @@ static void rpi_inter_clear(HEVCContext *s) - *s->u_mvs[i]++ = pic_height; - *s->u_mvs[i]++ = s->frame->linesize[1]; - *s->u_mvs[i]++ = s->frame->linesize[2]; -+ if (weight_flag) { -+ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -+ } else { -+ *s->u_mvs[i]++ = 1 << 5; -+ *s->u_mvs[i]++ = 6; -+ } - s->u_mvs[i] += 1; // Padding words - } - } -@@ -2849,12 +2879,29 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; - - #ifdef RPI -+#ifdef RPI_INTER_QPU - s->enable_rpi = s->ps.sps->bit_depth == 8 - && s->ps.sps->width <= RPI_MAX_WIDTH - && !s->ps.pps->cross_component_prediction_enabled_flag - && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -- && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) - && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -+#else -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+ && s->ps.sps->width <= RPI_MAX_WIDTH -+ && !s->ps.pps->cross_component_prediction_enabled_flag -+ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -+#endif -+ -+ /*if (!s->enable_rpi) { -+ if (s->ps.pps->cross_component_prediction_enabled_flag) -+ printf("Cross component\n"); -+ if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -+ printf("Tiles\n"); -+ if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -+ printf("Weighted P slice\n"); -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+ }*/ - - #endif - -@@ -2987,6 +3034,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int - - #ifdef RPI - s->enable_rpi = 0; -+ //printf("Wavefront\n"); - #endif - - if(ctb_row) { -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index b0b93b5..3f04d80 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -88,287 +88,307 @@ unsigned int rpi_shader[] = { - /* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch - /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 - /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif -+/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif -+/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base - // ::mc_filter_uv --/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 --/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 --/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 -+/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 -+/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 --/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 --/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop - // ::mc_filter_uv_b --/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 99927c4..cec9901 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,11 +4,11 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 148) --#define mc_filter_uv_b0 (rpi_shader + 310) --#define mc_filter_uv_b (rpi_shader + 458) --#define mc_exit (rpi_shader + 630) --#define mc_interrupt_exit8 (rpi_shader + 648) --#define mc_end (rpi_shader + 678) -+#define mc_filter_uv (rpi_shader + 152) -+#define mc_filter_uv_b0 (rpi_shader + 342) -+#define mc_filter_uv_b (rpi_shader + 494) -+#define mc_exit (rpi_shader + 670) -+#define mc_interrupt_exit8 (rpi_shader + 688) -+#define mc_end (rpi_shader + 718) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index d9ffcda..97c4c02 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -9,7 +9,12 @@ - # (ra15 isn't clamped to zero - this happens during the - # copy to ra14, and during its use in the vertical filter) - # --# rb8...rb15 eight vertical filter coefficients -+# rb8...rb11 eight vertical filter coefficients -+ -+# rb12 offset to add before shift -+# rb13 shift -+# rb14 weight (U on left, V on right) -+# rb15 offset (U on left, V on right) - # - # ra16 clipped(row start address+elem_num)&~3 - # ra17 per-channel shifts -@@ -165,6 +170,9 @@ add r2, r2, r0 ; mul24 r1, r1, rb_pitch - add t0s, r0, r1 ; mov ra_x2_base, r2 - add t0s, r2, r1 - -+mov rb12,unif # offset before shift -+mov rb13,unif # offset after shift -+ - # Dump padding words - mov r0, unif - -@@ -231,11 +239,21 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 - asr rb8, r0, rb23 - -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+mov r0, unif # U offset/weight -+asr rb15, r0, r2 # Compute offset from MSBs -+shl r0, r0, r2 -+asr rb14, r0, r2 # Compute weight from LSBs -+mov r0, unif # V offset/weight -+asr.ifnz rb15, r0, r2 -+shl r0, r0, r2 -+asr.ifnz rb14, r0, r2 -+ - # r2 is elem_num - # r3 is loop counter - - mov r5rep, -8 --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - - # retrieve texture results and pick out bytes - # then submit two more texture requests -@@ -279,6 +297,11 @@ mov ra13, ra14 # Delay slot 1 - mov ra14, ra15 # Delay slot 2 - mov ra15, r0 # Delay slot 3 - -+mov rb12,32 -+mov rb13,6 -+mov rb14,1 -+mov rb15,0 -+ - # apply vertical filter and write to VPM - - nop ; mul24 r1, ra14, rb10 -@@ -288,9 +311,11 @@ add r1, r1, r0 ; mul24 r0, ra15, rb11 - add r1, r1, r0 ; mov -, vw_wait - sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 - asr r1, r1, 14 --add r1, r1, ra21 -+nop ; mul24 r1, r1, rb14 -+add r1, r1, rb12 -+asr r1, r1, rb13 - brr.anyn -, r:uvloop --asr r1, r1, 6 # Delay 1 -+add r1, r1, rb15 # Delay 1 - min r1, r1, rb22 # Delay 2 - max vpm, r1, 0 # Delay 3 - -@@ -364,6 +389,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 - asr rb8, r0, rb23 - -+mov r0, unif # U offset/weight -+mov r0, unif # V offset/weight -+ - # r2 is elem_num - # r3 is loop counter - -@@ -491,6 +519,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 - asr rb9, r0, rb23; mul24 r0, r0, ra22 - asr rb8, r0, rb23 - -+mov r0, unif # U offset/weight -+mov r0, unif # V offset/weight -+ - # r2 is elem_num - # r3 is loop counter - --- -2.7.4 - - -From 310d994ea39e29b41a6a013abc4d94e6b90487b2 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 19 May 2015 08:43:30 +0100 -Subject: [PATCH 40/68] Improved ordering of tasks - ---- - libavcodec/hevc.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 9668ef8..951e2d3 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2943,15 +2943,15 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; - s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; - if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { --#ifdef RPI_INTER_QPU -- // Kick off inter prediction on QPUs -- rpi_execute_inter_qpu(s); --#endif - // Transform all blocks - // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); - rpi_execute_transform(s); - // Perform inter prediction - rpi_execute_inter_cmds(s); -+#ifdef RPI_INTER_QPU -+ // Kick off inter prediction on QPUs -+ rpi_execute_inter_qpu(s); -+#endif - // Wait for transform completion - vpu_wait(s->vpu_id); - --- -2.7.4 - - -From d6e1ce7898196e49e52a6223c12979b3d0014588 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 20 May 2015 19:58:19 +0100 -Subject: [PATCH 41/68] Drafted Luma inter prediction - ---- - libavcodec/rpi_shader.qasm | 594 ++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 554 insertions(+), 40 deletions(-) - -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 97c4c02..9cfc0d9 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -2,7 +2,10 @@ - # - # ra0...ra7 eight horizontal filter coefficients - # --# rb1...rb7 seven shifted copies of the current unfiltered row -+# rb0 rx_shift2 -+# rb1 ra_y2_next -+# -+# rb4...rb7 - # - # ra8...ra15 eight filtered rows of context (rb15 == most recent) - # -@@ -26,9 +29,9 @@ - # rb19 next ra16 - # - # ra20 1 --# ra21 32 -+# ra21 ra_21 - # ra22 256 --# ra23 8 -+# ra23 rx_shift2_next - # - # rb20 0xffffff00 - # rb21 vpm_setup for reading/writing 16bit results into VPM -@@ -57,16 +60,23 @@ - .set rb_frame_width_minus_1, rb25 - .set rb_frame_height_minus_1, rb30 - .set rb_pitch, rb16 --.set ra_x_base, ra16 --.set rb_x_base_next, rb19 --.set ra_x2_base, ra24 --.set ra_x2_base_next, ra26 -+.set ra_x, ra16 -+.set ra_y2, ra21 -+.set ra_y2_next, rb1 -+ -+.set rb_x_next, rb19 -+.set rx_frame_base2_next, rb19 -+ -+.set ra_frame_base, ra24 -+.set ra_frame_base_next, ra26 - .set ra_xshift, ra17 - --.set ra_x2shift, ra25 - .set ra_u2v_ref_offset, ra25 -+.set ra_frame_base2, ra25 - - .set ra_xshift_next, ra19 -+.set rx_xshift2, rb0 -+.set rx_xshift2_next, ra23 - - .set ra_x2shift_next, ra27 - .set ra_u2v_dst_offset, ra27 -@@ -83,11 +93,11 @@ - mov ra31, unif - - # Load first request location --add ra_x_base, unif, elem_num # Store x -+add ra_x, unif, elem_num # Store x - mov ra_y, unif # Store y --mov ra_x2_base, unif # Store frame u base -+mov ra_frame_base, unif # Store frame u base - nop --sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -+sub ra_u2v_ref_offset, unif, ra_frame_base # Store offset to add to move from u to v in reference frame - - # Read image dimensions - sub rb25,unif,1 -@@ -104,9 +114,7 @@ add rb24, r1, r0 - # load constants - - mov ra20, 1 --mov ra21, 32 - mov ra22, 256 --mov ra23, 8 - mov ra30, 64 - - mov rb20, 0xffffff00 -@@ -156,18 +164,18 @@ mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which i - add rb21, r0, r1 - - # Compute base address for first and second access --mov r0, ra_x_base # Load x -+mov r0, ra_x # Load x - max r0, r0, 0; mov r1, ra_y # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base # Load the frame base - shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset - add ra_y, r1, 1 - add r0, r0, r3 - and r0, r0, ~3 --max r1, r1, 0 ; mov ra_x_base, r0 # y -+max r1, r1, 0 ; mov ra_x, r0 # y - min r1, r1, rb_frame_height_minus_1 - # submit texture requests for first line - add r2, r2, r0 ; mul24 r1, r1, rb_pitch --add t0s, r0, r1 ; mov ra_x2_base, r2 -+add t0s, r0, r1 ; mov ra_frame_base, r2 - add t0s, r2, r1 - - mov rb12,unif # offset before shift -@@ -182,8 +190,8 @@ min r1, r1, rb_frame_height_minus_1 - add ra_y, ra_y, 1 - bra -, ra31 - nop ; mul24 r1, r1, rb_pitch --add t0s, r1, ra_x_base --add t0s, r1, ra_x2_base -+add t0s, r1, ra_x -+add t0s, r1, ra_frame_base - - - -@@ -192,7 +200,7 @@ add t0s, r1, ra_x2_base - # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) - - # At this point we have already issued two pairs of texture requests for the current block --# ra_x_base, ra_x16_base point to the current coordinates for this block -+# ra_x, ra_x16_base point to the current coordinates for this block - ::mc_filter_uv - mov ra31, unif - -@@ -207,9 +215,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base - shl ra_xshift_next, r0, 3 - sub r2, unif, r3 # compute offset from frame base u to frame base v - add r0, r0, r3 --and rb_x_base_next, r0, ~3 -+and rb_x_next, r0, ~3 - mov ra_y_next, r1 --add ra_x2_base_next, rb_x_base_next, r2 -+add ra_frame_base_next, rb_x_next, r2 - - # set up VPM write - mov vw_setup, rb28 -@@ -265,16 +273,16 @@ mov r3, 0 - # then submit two more texture requests - - sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch - shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte - - max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 - add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --add t0s, ra_x2_base, r2 -+add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_frame_base, r2 - - # generate seven shifted versions - # interleave with scroll of vertical context -@@ -297,7 +305,7 @@ mov ra13, ra14 # Delay slot 1 - mov ra14, ra15 # Delay slot 2 - mov ra15, r0 # Delay slot 3 - --mov rb12,32 -+mov rb12,32 # TODO remove these to make P weighted prediction work properly - mov rb13,6 - mov rb14,1 - mov rb15,0 -@@ -342,7 +350,7 @@ mov vw_addr, unif # start the VDW - # mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) - - # At this point we have already issued two pairs of texture requests for the current block --# ra_x_base, ra_x16_base point to the current coordinates for this block -+# ra_x, ra_x16_base point to the current coordinates for this block - ::mc_filter_uv_b0 - mov ra31, unif - -@@ -357,9 +365,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base - shl ra_xshift_next, r0, 3 - sub r2, unif, r3 # compute offset from frame base u to frame base v - add r0, r0, r3 --and rb_x_base_next, r0, ~3 -+and rb_x_next, r0, ~3 - mov ra_y_next, r1 --add ra_x2_base_next, rb_x_base_next, r2 -+add ra_frame_base_next, rb_x_next, r2 - - # set up VPM write, we need to save 16bit precision - mov vw_setup, rb21 -@@ -408,16 +416,16 @@ mov r3, 0 - # then submit two more texture requests - - sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch - shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte - - max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 - add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --add t0s, ra_x2_base, r2 -+add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_frame_base, r2 - - # generate seven shifted versions - # interleave with scroll of vertical context -@@ -477,9 +485,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base - shl ra_xshift_next, r0, 3 - sub r2, unif, r3 # compute offset from frame base u to frame base v - add r0, r0, r3 --and rb_x_base_next, r0, ~3 -+and rb_x_next, r0, ~3 - mov ra_y_next, r1 --add ra_x2_base_next, rb_x_base_next, r2 -+add ra_frame_base_next, rb_x_next, r2 - - # set up VPM write - mov vw_setup, rb28 -@@ -538,16 +546,16 @@ mov r3, 0 - # then submit two more texture requests - - sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch - shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte - - max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 - add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --add t0s, ra_x2_base, r2 -+add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+add t0s, ra_frame_base, r2 - - # generate seven shifted versions - # interleave with scroll of vertical context -@@ -642,5 +650,511 @@ nop ; nop ; thrend - mov interrupt, 1; nop # delay slot 1 - nop ; nop # delay slot 2 - -+ -+ -+ -+ -+# LUMA CODE -+ -+# The idea is to form B predictions by doing 8 pixels from ref0 in parallel with 8 pixels from ref1. -+# For P frames we make the second x,y coordinates offset by +8 -+ -+################################################################################ -+# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) -+::mc_setup -+ -+# Read starting kernel -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+mov ra31, unif -+ -+# Compute base address for first and second access -+add r0, unif, elem_num # Load x -+max r0, r0, 0; mov r1, unif # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+shl ra_xshift_next, r0, 3 # Compute shifts -+add ra_y, r1, 1 -+and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+add r2, r2, r0 # r2 is address for frame0 (not including y offset) -+max r1, r1, 0 -+min r1, r1, rb_frame_height_minus_1 -+nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+add t0s, r2, r1 ; mov ra_frame_base, r2 -+ -+add r0, unif, elem_num # Load x -+max r0, r0, 0; mov r1, unif # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+shl rx_xshift2_next, r0, 3 # Compute shifts -+add ra_y2, r1, 1 -+and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+add r2, r2, r0 # r2 is address for frame1 (not including y offset) -+max r1, r1, 0 -+min r1, r1, rb_frame_height_minus_1 -+nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+add t0s, r2, r1 ; mov ra_frame_base2, r2 -+ -+ -+# Read image dimensions -+sub rb25,unif,1 -+sub rb30,unif,1 -+ -+# get source pitch -+mov rb16, unif -+ -+# get destination pitch -+mov r0, unif -+mov r1, vdw_setup_1(0) -+add rb24, r1, r0 -+ -+# load constants -+ -+mov ra20, 1 -+mov ra22, 256 -+mov ra30, 64 -+ -+mov rb20, 0xffffff00 -+mov rb22, 255 -+mov rb23, 24 -+ -+# touch vertical context to keep simulator happy -+ -+mov ra8, 0 -+mov ra9, 0 -+mov ra10, 0 -+mov ra11, 0 -+mov ra12, 0 -+mov ra13, 0 -+mov ra14, 0 -+mov ra15, 0 -+ -+# Compute part of VPM to use for DMA output -+mov r2, qpu_num -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 -+mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+shl r0, r0, 5 -+add rb27, r0, r1 -+ -+# Compute part of VPM to save data into -+mov r2, qpu_num # qpu_num = abcd -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 -+mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+add rb28, r0, r1 -+ -+mov rb12,unif # offset before shift -+mov rb13,unif # shift -+ -+# Dump padding words -+mov r0, unif -+ -+# submit texture requests for second line -+max r1, ra_y, 0 -+min r1, r1, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 -+nop ; mul24 r1, r1, rb_pitch -+add t0s, r1, ra_frame_base -+ -+max r1, ra_y2, 0 -+min r1, r1, rb_frame_height_minus_1 -+bra -, ra31 -+add ra_y2, ra_y2, 1 # Delay 1 -+nop ; mul24 r1, r1, rb_pitch # Delay 2 -+add t0s, r1, ra_frame_base2 # Delay 3 -+ -+ -+################################################################################ -+ -+# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -+# In a P block, only the first half of coefficients contain used information. -+# At this point we have already issued two pairs of texture requests for the current block -+# ra_x, ra_x16_base point to the current coordinates for this block -+::mc_filter -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+mov rx_xshift2, rx_xshift2_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # Load x -+max r0, r0, 0; mov r1, unif # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+shl ra_xshift_next, r0, 3 # Compute shifts -+mov ra_y_next, r1 -+and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -+ -+add r0, unif, elem_num # Load x -+max r0, r0, 0 ; mov r1, unif # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+shl rx_xshift2_next, r0, 3 # Compute shifts -+add ra_y2_next, r1, 1 -+and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+ -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+# get filter coefficients and discard unused B frame values -+mov r0, unif -+mov.ifnz -, unif # Alternate coefficients are unused for P frames -+asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+mov.ifnz -, unif -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+asr ra4, r0, rb23; mov r0, unif -+mov.ifnz -, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+mov.ifnz -, unif -+asr rb7, r0, rb23; mul24 r0, r0, ra22 -+asr rb6, r0, rb23; mul24 r0, r0, ra22 -+asr rb5, r0, rb23; mul24 r0, r0, ra22 -+asr rb4, r0, rb23 -+ -+mov r0, unif # Frame0 offset/weight -+mov.ifnz -, unif # Frame1 offset/weight unused -+asr rb15, r0, r2 # Compute offset from MSBs -+shl r0, r0, r2 -+asr rb14, r0, r2 # Compute weight from LSBs -+ -+# r3 is loop counter -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+mov r3, 0 -+ -+:yloop -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+# If we knew there was no clipping then this code would get simpler. -+# Perhaps we could add on the pitch and clip using larger values? -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, rx_xshift2 -+mov.ifz ra_y2, ra_y2_next -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y2, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+ -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+# apply horizontal filter -+nop ; mul24 r2, r0, ra0 -+nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+nop ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+add r0, r2, r3 ; mov r3, rb31 -+sub.setf -, r3, 8 ; mov ra12, ra13 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+brr.anyn -, r:yloop -+mov ra13, ra14 # Delay slot 1 -+mov ra14, ra15 # Delay slot 2 -+mov ra15, r0 # Delay slot 3 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r1, ra14, rb10 -+nop ; mul24 r0, ra13, rb9 -+add r1, r1, r0 ; mul24 r0, ra12, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb11 -+add r1, r1, r0 ; mul24 r0, ra8, rb4 -+add r1, r1, r0 ; mul24 r0, ra9, rb5 -+add r1, r1, r0 ; mul24 r0, ra10, rb6 -+add r1, r1, r0 ; mul24 r0, ra11, rb7 -+ -+add r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+asr r1, r1, 14 -+nop ; mul24 r1, r1, rb14 -+add r1, r1, rb12 -+asr r1, r1, rb13 -+brr.anyn -, r:yloop -+add r1, r1, rb15 # Delay 1 -+min r1, r1, rb22 # Delay 2 -+max vpm, r1, 0 # Delay 3 -+ -+# DMA out -+ -+bra -, ra31 -+mov vw_setup, rb26 # VDW setup 0 Delay 1 -+mov vw_setup, rb29 # Stride Delay 2 -+mov vw_addr, unif # start the VDW Delay 3 -+ -+ -+ -+################################################################################ -+ -+# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -+# In a P block, only the first half of coefficients contain used information. -+# At this point we have already issued two pairs of texture requests for the current block -+# May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) -+# Can fill in the coefficients so only -+# Can also assume default weighted prediction for B frames. -+# Perhaps can unpack coefficients in a more efficient manner by doing H/V for a and b at the same time? -+# Or possibly by taking advantage of symmetry? -+# From 19->7 32bits per command. -+::mc_filter_b -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+mov ra31, unif -+ -+# per-channel shifts were calculated on the *previous* invocation -+ -+mov ra_xshift, ra_xshift_next -+mov rx_xshift2, rx_xshift2_next -+ -+# get base addresses and per-channel shifts for *next* invocation -+add r0, unif, elem_num # Load x -+max r0, r0, 0; mov r1, unif # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+shl ra_xshift_next, r0, 3 # Compute shifts -+mov ra_y_next, r1 -+and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -+ -+add r0, unif, elem_num # Load x -+max r0, r0, 0 ; mov r1, unif # Load y -+min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+shl rx_xshift2_next, r0, 3 # Compute shifts -+add ra_y2_next, r1, 1 -+and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+ -+ -+# set up VPM write -+mov vw_setup, rb28 -+ -+# get width,height of block -+mov r2, 16 -+mov r0, unif -+shr r1, r0, r2 # Extract width -+sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+and r0, r0, rb22 # Extract height -+add rb17, r0, 5 -+add rb18, r0, 7 -+shl r0, r0, 7 -+add r0, r0, r1 # Combine width and height of destination area -+shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+add rb26, r0, rb27 -+ -+# get filter coefficients and discard unused B frame values -+mov r0, unif -+mov r1, 1 -+mov.ifnz r0, unif # Alternate coefficients are unused for P frames -+nop ; mul24 r0, r0 << 13, r1 << 13 -+asr ra3, r0, rb23; mul24 r0, r0, ra22 -+nop ; mul24 r0, r0 << 14, r1 << 14 -+asr ra2, r0, rb23; mul24 r0, r0, ra22 -+nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right -+asr ra1, r0, rb23; mul24 r0, r0, ra22 -+asr ra0, r0, rb23; mov r0, unif -+mov.ifnz r0, unif -+nop ; mul24 r0, r0 << 9, r1 << 9 -+asr ra7, r0, rb23; mul24 r0, r0, ra22 -+nop ; mul24 r0, r0 << 10, r1 << 10 -+asr ra6, r0, rb23; mul24 r0, r0, ra22 -+nop ; mul24 r0, r0 << 11, r1 << 11 -+asr ra5, r0, rb23; mul24 r0, r0, ra22 -+nop ; mul24 r0, r0 << 12, r1 << 12 -+asr ra4, r0, rb23; mov r0, unif -+mov.ifnz r0, unif -+asr rb11, r0, rb23; mul24 r0, r0, ra22 -+asr rb10, r0, rb23; mul24 r0, r0, ra22 -+asr rb9, r0, rb23; mul24 r0, r0, ra22 -+asr rb8, r0, rb23; mov r0, unif -+mov.ifnz r0, unif -+asr rb7, r0, rb23; mul24 r0, r0, ra22 -+asr rb6, r0, rb23; mul24 r0, r0, ra22 -+asr rb5, r0, rb23; mul24 r0, r0, ra22 -+asr rb4, r0, rb23 -+ -+mov r0, unif # Frame0 offset/weight -+mov.ifnz r0, unif # Frame1 offset/weight unused -+asr rb15, r0, r2 # Compute offset from MSBs -+shl r0, r0, r2 -+asr rb14, r0, r2 # Compute weight from LSBs -+ -+# r3 is loop counter -+ -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+mov r3, 0 -+ -+:yloopb -+# retrieve texture results and pick out bytes -+# then submit two more texture requests -+ -+# If we knew there was no clipping then this code would get simpler. -+# Perhaps we could add on the pitch and clip using larger values? -+ -+sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+shr r1, r4, rx_xshift2 -+mov.ifz ra_y2, ra_y2_next -+ -+max r2, ra_y, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+max r2, ra_y2, 0 # y -+min r2, r2, rb_frame_height_minus_1 -+add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+ -+ -+# generate seven shifted versions -+# interleave with scroll of vertical context -+ -+mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+# apply horizontal filter -+nop ; mul24 r2, r0, ra0 -+nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+nop ; mul24 r3, ra1 << 1, r0 << 1 -+nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+add r0, r2, r3 ; mov r3, rb31 -+sub.setf -, r3, 8 ; mov ra12, ra13 -+mov ra9, ra10 -+mov ra10, ra11 -+mov ra11, ra12 -+mov ra12, ra13 -+brr.anyn -, r:yloopb -+mov ra13, ra14 # Delay slot 1 -+mov ra14, ra15 # Delay slot 2 -+mov ra15, r0 # Delay slot 3 -+ -+# apply vertical filter and write to VPM -+ -+nop ; mul24 r1, ra14, rb10 -+nop ; mul24 r0, ra13, rb9 -+add r1, r1, r0 ; mul24 r0, ra12, rb8 -+add r1, r1, r0 ; mul24 r0, ra15, rb11 -+add r1, r1, r0 ; mul24 r0, ra8, rb4 -+add r1, r1, r0 ; mul24 r0, ra9, rb5 -+add r1, r1, r0 ; mul24 r0, ra10, rb6 -+add r1, r1, r0 ; mul24 r0, ra11, rb7 -+ -+add r1, r1, r0 ; mov -, vw_wait -+sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+asr r1, r1, 14 -+nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves -+add r1, r1, ra30 ; mul24 r0, r1, rb14 -+add r1, r1, r0 -+brr.anyn -, r:yloopb -+asr r1, r1, 7 # Delay 1 -+min r1, r1, rb22 # Delay 2 -+max vpm, r1, 0 # Delay 3 -+ -+# DMA out -+bra -, ra31 -+mov vw_setup, rb26 # VDW setup 0 Delay 1 -+mov vw_setup, rb29 # Stride Delay 2 -+mov vw_addr, unif # start the VDW Delay 3 -+ -+################################################################################ -+ -+# mc_interrupt_exit12() -+::mc_interrupt_exit12 -+mov -, vw_wait # wait on the VDW -+ -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ldtmu0 -+ -+mov -,sacq(0) # 1 -+mov -,sacq(0) # 2 -+mov -,sacq(0) # 3 -+mov -,sacq(0) # 4 -+mov -,sacq(0) # 5 -+mov -,sacq(0) # 6 -+mov -,sacq(0) # 7 -+mov -,sacq(0) # 8 -+mov -,sacq(0) # 9 -+mov -,sacq(0) # 10 -+mov -,sacq(0) # 11 -+ -+nop ; nop ; thrend -+mov interrupt, 1; nop # delay slot 1 -+nop ; nop # delay slot 2 -+ -+ - ::mc_end - # Do not add code here because mc_end must appear after all other code. --- -2.7.4 - - -From f2ffe4186fa49cb27579953c276b51728a08a8b5 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 20 May 2015 19:58:30 +0100 -Subject: [PATCH 42/68] Added support for fast cache flush in deblocker - ---- - libavcodec/hevc_filter.c | 44 +- - libavcodec/rpi_qpu.c | 6 + - libavcodec/rpi_qpu.h | 2 + - libavcodec/rpi_shader.c | 1028 +++++++++++++++++++++++++++++--------------- - libavcodec/rpi_shader.h | 16 +- - libavcodec/rpi_user_vcsm.h | 22 + - 6 files changed, 768 insertions(+), 350 deletions(-) - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 92a8271..186317a 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -37,6 +37,11 @@ - - #include "bit_depth_template.c" - -+#ifdef RPI -+#include "rpi_user_vcsm.h" -+#include "rpi_qpu.h" -+#endif -+ - #define LUMA 0 - #define CB 1 - #define CR 2 -@@ -872,15 +877,46 @@ static void flush_buffer(AVBufferRef *bref) { - gpu_cache_flush(p); - } - --static void ff_hevc_flush_chroma(HEVCContext *s) -+// Return Physical address for this image -+static int ff_hevc_buf_base(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ return p->vc & 0x3fffffff; -+} -+ -+static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) - { - if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || - s->nal_unit_type == NAL_TSA_N || - s->nal_unit_type == NAL_STSA_N || - s->nal_unit_type == NAL_RADL_N || - s->nal_unit_type == NAL_RASL_N )) { -+#define RPI_FAST_CACHEFLUSH -+#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int curr_y = f->progress->data[0]; -+ int sz,base; -+ if (curr_y < 0) curr_y = 0; -+ if (n<=curr_y) return; // Should not happen -+ sz = s->frame->linesize[1] * (n-curr_y); -+ base = s->frame->linesize[1] * curr_y; -+ iocache.s[0].cmd = 3; // Flush L1 cache -+ iocache.s[0].addr = 0; -+ iocache.s[0].size = 0; -+ -+ iocache.s[1].cmd = 2; -+ iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; -+ iocache.s[1].size = sz; -+ -+ iocache.s[2].cmd = 2; -+ iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; -+ iocache.s[2].size = sz; -+ -+ vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); -+ -+#else - flush_buffer(s->frame->buf[1]); - flush_buffer(s->frame->buf[2]); -+#endif - //memcpy(s->dummy.arm,s->frame->data[0],2048*64); - //memcpy(s->dummy.arm,s->frame->data[1],1024*32); - //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -@@ -903,7 +939,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - sao_filter_CTB(s, x, y - ctb_size); - if (s->threads_type & FF_THREAD_FRAME ) { - #ifdef RPI_INTER_QPU -- ff_hevc_flush_chroma(s); -+ ff_hevc_flush_chroma(s,&s->ref->tf, y); - #endif - ff_thread_report_progress(&s->ref->tf, y, 0); - } -@@ -912,7 +948,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - sao_filter_CTB(s, x , y); - if (s->threads_type & FF_THREAD_FRAME ) { - #ifdef RPI_INTER_QPU -- ff_hevc_flush_chroma(s); -+ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); - #endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); - } -@@ -922,7 +958,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - //int currh = s->ref->tf.progress->data[0]; - //if (((y + ctb_size)&63)==0) - #ifdef RPI_INTER_QPU -- ff_hevc_flush_chroma(s); -+ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); - #endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); - } -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index f62051f..fd8a276 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -237,6 +237,12 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) - return r; - } - -+int gpu_get_mailbox(void) -+{ -+ assert(gpu); -+ return gpu->mb; -+} -+ - void gpu_cache_flush(GPU_MEM_PTR_T *p) - { - void *tmp = vcsm_lock(p->vcsm_handle); -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 543c84b..88965e5 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -49,4 +49,6 @@ extern int rpi_test_shader(void); - extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); - extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); - -+extern int gpu_get_mailbox(void); -+ - #endif -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 3f04d80..9c30e32 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -23,11 +23,11 @@ __attribute__((aligned(8))) - unsigned int rpi_shader[] = { - // ::mc_setup_uv - /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x, unif, elem_num - /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif --/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_frame_base, unif - /* [0x00000020] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_frame_base - /* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 - /* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 - /* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif -@@ -35,360 +35,708 @@ unsigned int rpi_shader[] = { - /* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) - /* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 - /* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 --/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 --/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 --/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 --/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 --/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 --/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 --/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) --/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 --/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base --/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base --/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 --/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 --/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif --/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif --/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base --/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+/* [0x00000068] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x00000070] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+/* [0x00000078] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -+/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif -+/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif -+/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base - // ::mc_filter_uv --/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 --/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 --/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 --/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 --/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 --/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 --/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 --/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 --/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 --/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 --/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 -+/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 -+/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 --/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 --/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop - // ::mc_filter_uv_b --/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 --/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 --/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 --/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 --/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 --/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 --/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_setup -+/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -+/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif -+/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif -+/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif -+/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -+/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -+// ::mc_filter -+/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :yloop -+/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_filter_b -+/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 -+/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -+/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -+/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -+/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -+/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -+/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -+/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -+/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+// :yloopb -+/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -+/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -+/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -+/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+// ::mc_interrupt_exit12 -+/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index cec9901..3fa8531 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,11 +4,15 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 152) --#define mc_filter_uv_b0 (rpi_shader + 342) --#define mc_filter_uv_b (rpi_shader + 494) --#define mc_exit (rpi_shader + 670) --#define mc_interrupt_exit8 (rpi_shader + 688) --#define mc_end (rpi_shader + 718) -+#define mc_filter_uv (rpi_shader + 148) -+#define mc_filter_uv_b0 (rpi_shader + 338) -+#define mc_filter_uv_b (rpi_shader + 490) -+#define mc_exit (rpi_shader + 666) -+#define mc_interrupt_exit8 (rpi_shader + 684) -+#define mc_setup (rpi_shader + 714) -+#define mc_filter (rpi_shader + 868) -+#define mc_filter_b (rpi_shader + 1108) -+#define mc_interrupt_exit12 (rpi_shader + 1364) -+#define mc_end (rpi_shader + 1402) - - #endif -diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -index fbebbbe..95e6de1 100644 ---- a/libavcodec/rpi_user_vcsm.h -+++ b/libavcodec/rpi_user_vcsm.h -@@ -418,6 +418,28 @@ int vcsm_unlock_hdl( unsigned int handle ); - */ - int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); - -+/* Clean and/or invalidate the memory associated with this user opaque handle -+** -+** Returns: non-zero on error -+** -+** structure contains a list of flush/invalidate commands. Commands are: -+** 0: nop -+** 1: invalidate given physical range in L2 -+** 2: clean given physical range in L2 -+** 3: clean+invalidate all of L1 -+** 4: flush all of L2 and all of L1 -+*/ -+struct vcsm_user_clean_invalid_s { -+ struct { -+ unsigned int cmd; -+ unsigned int addr; -+ unsigned int size; -+ } s[8]; -+}; -+ -+int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); -+ -+ - #ifdef __cplusplus - } - #endif --- -2.7.4 - - -From 09685ab55aecb9400e354522894e0fbbb6381ca9 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 20 May 2015 21:12:55 +0100 -Subject: [PATCH 43/68] Added multi mailbox - not working - ---- - libavcodec/hevc.c | 40 ++++++++++++++++++++++++++++--- - libavcodec/rpi_mailbox.c | 47 +++++++++++++++++++++++++++++++++++++ - libavcodec/rpi_mailbox.h | 5 ++++ - libavcodec/rpi_qpu.c | 61 ++++++++++++++++++++++++++++++++++++++++++++---- - libavcodec/rpi_qpu.h | 2 ++ - 5 files changed, 147 insertions(+), 8 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 951e2d3..ab63efd 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -47,6 +47,11 @@ - //#define EARLY_MALLOC - // Move Inter prediction into separate pass - #define RPI_INTER -+ -+ #ifdef RPI_INTER_QPU -+ // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU -+ #define RPI_MULTI_MAILBOX -+ #endif - #endif - - // #define DISABLE_MC -@@ -2843,10 +2848,14 @@ static void rpi_inter_clear(HEVCContext *s) - static void rpi_execute_inter_qpu(HEVCContext *s) - { - int k; -+ int i; - uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -- -- if (s->sh.slice_type == I_SLICE) -- return; -+ if (s->sh.slice_type == I_SLICE) { -+#ifdef RPI_MULTI_MAILBOX -+ rpi_execute_transform(s); -+ return; -+#endif -+ } - for(k=0;k<8;k++) { - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -@@ -2856,6 +2865,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - - s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore - -+#ifdef RPI_MULTI_MAILBOX -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+#else - qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), - (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), - (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -@@ -2866,6 +2891,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), - (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) - ); -+#endif - } - #endif - -@@ -2945,6 +2971,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { - // Transform all blocks - // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+#ifdef RPI_MULTI_MAILBOX -+ // Kick off inter prediction on QPUs -+ rpi_execute_inter_qpu(s); -+ // Perform luma inter prediction -+ rpi_execute_inter_cmds(s); -+#else - rpi_execute_transform(s); - // Perform inter prediction - rpi_execute_inter_cmds(s); -@@ -2952,6 +2984,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - // Kick off inter prediction on QPUs - rpi_execute_inter_qpu(s); - #endif -+#endif -+ - // Wait for transform completion - vpu_wait(s->vpu_id); - -diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -index 77a56dd..3904efc 100644 ---- a/libavcodec/rpi_mailbox.c -+++ b/libavcodec/rpi_mailbox.c -@@ -276,6 +276,53 @@ unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigne - return p[5]; - } - -+void execute_multi(int file_desc, -+ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, -+ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, -+ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2) { -+ int i=0; -+ unsigned p[32]; -+ -+ p[i++] = 0; // size -+ p[i++] = 0x00000000; // process request -+ p[i++] = 0x30018; // (the tag id) -+ p[i++] = 88; // (size of the buffer) -+ p[i++] = 88; // (size of the data) -+ -+ p[i++] = num_qpus; -+ p[i++] = control; -+ p[i++] = noflush; -+ p[i++] = timeout; // ms -+ -+ p[i++] = num_qpus_2; -+ p[i++] = control_2; -+ p[i++] = noflush_2; -+ p[i++] = timeout_2; // ms -+ -+ p[i++] = code; -+ p[i++] = r0; -+ p[i++] = r1; -+ p[i++] = r2; -+ p[i++] = r3; -+ p[i++] = r4; -+ p[i++] = r5; -+ -+ p[i++] = code_2; -+ p[i++] = r0_2; -+ p[i++] = r1_2; -+ p[i++] = r2_2; -+ p[i++] = r3_2; -+ p[i++] = r4_2; -+ p[i++] = r5_2; -+ -+ p[i++] = 0x00000000; // end tag -+ p[0] = i*sizeof *p; // actual size -+ -+ mbox_property(file_desc, p); -+ return; -+} -+ - int mbox_open() { - int file_desc; - -diff --git a/libavcodec/rpi_mailbox.h b/libavcodec/rpi_mailbox.h -index c264d2e..5898102 100644 ---- a/libavcodec/rpi_mailbox.h -+++ b/libavcodec/rpi_mailbox.h -@@ -15,6 +15,11 @@ extern void unmapmem(void *addr, unsigned size); - - extern unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); - extern unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout); -+extern void execute_multi(int file_desc, -+ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, -+ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, -+ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2); - extern unsigned qpu_enable(int file_desc, unsigned enable); - - #endif -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index fd8a276..feb3284 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -123,7 +123,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; - static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; - static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; - --static int vpu_cmds[MAXCMDS][8]; -+static int vpu_cmds[MAXCMDS][16]; - static volatile int vpu_async_tail=0; // Contains the number of posted jobs - static volatile int vpu_async_head=0; - #endif -@@ -346,6 +346,7 @@ unsigned int vpu_get_constants(void) { - static void *vpu_start(void *arg) { - while(1) { - int *p; -+ int qpu_code; - pthread_mutex_lock(&post_mutex); - while( vpu_async_tail - vpu_async_head <= 0) - { -@@ -358,12 +359,25 @@ static void *vpu_start(void *arg) { - if (p[6] == -1) { - break; // Last job - } -- if (p[7]) { -+ qpu_code = p[7]; -+ //if (p[7]) { - //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; - //gpu_cache_flush(buf); -- } -- vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ //} -+ if (!qpu_code) { -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ } else { -+ int i; -+ for(i=0;i<8;i++) { -+ gpu->mail[i*2] = p[8+i]; -+ gpu->mail[i*2 + 1] = qpu_code; -+ } - -+ execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ 0, 0, 0, 0, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+ } - pthread_mutex_lock(&post_mutex); - vpu_async_head++; - pthread_cond_broadcast(&post_cond_head); -@@ -400,7 +414,43 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned - p[4] = r3; - p[5] = r4; - p[6] = r5; -- p[7] = (int) buf; -+ p[7] = 0; -+ if (num<=1) -+ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+ return id; -+ } -+} -+ -+int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -+{ -+ -+ pthread_mutex_lock(&post_mutex); -+ { -+ int id = vpu_async_tail++; -+ int *p = vpu_cmds[id%MAXCMDS]; -+ int num = vpu_async_tail - vpu_async_head; -+ if (num>MAXCMDS) { -+ printf("Too many commands submitted\n"); -+ exit(-1); -+ } -+ p[0] = vpu_code; -+ p[1] = r0; -+ p[2] = r1; -+ p[3] = r2; -+ p[4] = r3; -+ p[5] = r4; -+ p[6] = r5; -+ p[7] = qpu_code; -+ p[8 ] = unifs1; -+ p[9 ] = unifs2; -+ p[10] = unifs3; -+ p[11] = unifs4; -+ p[12] = unifs5; -+ p[13] = unifs6; -+ p[14] = unifs7; -+ p[15] = unifs8; - if (num<=1) - pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake - pthread_mutex_unlock(&post_mutex); -@@ -966,6 +1016,7 @@ void rpi_do_block(const uint8_t *in_buffer_vc, int src_pitch, uint8_t *dst_vc, i - } - - -+ - #endif - - #endif // RPI -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 88965e5..2f08f03 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -41,6 +41,8 @@ extern unsigned int vpu_get_fn(void); - extern unsigned int vpu_get_constants(void); - extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); - extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -+int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); - extern void vpu_wait( int id); - - // Simple test of shader code --- -2.7.4 - - -From 311f2da06d13a98d9bdda2df8684d7cf55b9a08e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 21 May 2015 16:50:02 +0100 -Subject: [PATCH 44/68] Pass qpu number in as uniform - ---- - libavcodec/hevc.c | 2 +- - libavcodec/rpi_shader.c | 1288 ++++++++++++++++++++++---------------------- - libavcodec/rpi_shader.h | 20 +- - libavcodec/rpi_shader.qasm | 10 +- - 4 files changed, 657 insertions(+), 663 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index ab63efd..caadfaa 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -2834,6 +2834,7 @@ static void rpi_inter_clear(HEVCContext *s) - *s->u_mvs[i]++ = pic_height; - *s->u_mvs[i]++ = s->frame->linesize[1]; - *s->u_mvs[i]++ = s->frame->linesize[2]; -+ *s->u_mvs[i]++ = i; - if (weight_flag) { - *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); - *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -@@ -2841,7 +2842,6 @@ static void rpi_inter_clear(HEVCContext *s) - *s->u_mvs[i]++ = 1 << 5; - *s->u_mvs[i]++ = 6; - } -- s->u_mvs[i] += 1; // Padding words - } - } - -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index 9c30e32..a0f0282 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -48,8 +48,8 @@ unsigned int rpi_shader[] = { - /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 - /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 - /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif -+/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 - /* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 - /* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 - /* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -@@ -60,669 +60,669 @@ unsigned int rpi_shader[] = { - /* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) - /* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 - /* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 --/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 --/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) --/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 --/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x --/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base --/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 --/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 --/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif --/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif --/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x --/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -+/* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif -+/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif -+/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base - // ::mc_filter_uv --/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 --/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 --/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 --/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 --/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 --/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 --/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 --/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 --/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 --/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 --/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 --/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 --/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 --/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 --/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 -+/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 -+/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 --/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 --/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 --/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 --/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 --/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 --/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop - // ::mc_filter_uv_b --/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 --/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 --/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 --/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 --/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_setup --/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 --/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 --/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 --/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 --/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 --/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 --/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 --/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 --/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif --/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) --/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 --/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 --/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 --/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif --/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif --/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base --/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 --/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 --/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -+/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -+/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif -+/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif -+/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif -+/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -+/* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 - // ::mc_filter --/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next --/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 --/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif --/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 --/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 --/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 --/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 --/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :yloop --/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 --/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 --/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next --/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 --/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 --/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 --/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 --/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 --/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop --/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 --/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 --/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 --/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 --/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 --/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 --/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 --/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop --/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 --/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_b --/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next --/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 --/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif --/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 --/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 --/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 --/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 --/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 --/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 --/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 --/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 --/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 --/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 --/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 --/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 --/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 -+/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -+/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -+/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -+/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -+/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -+/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -+/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -+/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :yloopb --/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 --/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 --/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next --/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 --/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 --/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 --/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 --/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 --/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb --/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 --/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 --/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 --/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 --/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 --/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 --/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb --/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -+/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -+/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -+/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_interrupt_exit12 --/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 - /* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -@@ -732,11 +732,9 @@ unsigned int rpi_shader[] = { - /* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) - /* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 3fa8531..6e552d9 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,15 +4,15 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 148) --#define mc_filter_uv_b0 (rpi_shader + 338) --#define mc_filter_uv_b (rpi_shader + 490) --#define mc_exit (rpi_shader + 666) --#define mc_interrupt_exit8 (rpi_shader + 684) --#define mc_setup (rpi_shader + 714) --#define mc_filter (rpi_shader + 868) --#define mc_filter_b (rpi_shader + 1108) --#define mc_interrupt_exit12 (rpi_shader + 1364) --#define mc_end (rpi_shader + 1402) -+#define mc_filter_uv (rpi_shader + 144) -+#define mc_filter_uv_b0 (rpi_shader + 334) -+#define mc_filter_uv_b (rpi_shader + 486) -+#define mc_exit (rpi_shader + 662) -+#define mc_interrupt_exit8 (rpi_shader + 680) -+#define mc_setup (rpi_shader + 710) -+#define mc_filter (rpi_shader + 864) -+#define mc_filter_b (rpi_shader + 1104) -+#define mc_interrupt_exit12 (rpi_shader + 1360) -+#define mc_end (rpi_shader + 1398) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 9cfc0d9..a0b8e5a 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -133,8 +133,8 @@ mov ra14, 0 - mov ra15, 0 - - # Compute part of VPM to use for DMA output --mov r2, qpu_num --shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+mov r3, unif -+shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) - and r2, r2, 15 - mov r1, r2 - asr r1, r1, 2 -@@ -147,8 +147,7 @@ shl r0, r0, 5 - add rb27, r0, r1 - - # Compute part of VPM to save data into --mov r2, qpu_num # qpu_num = abcd --shl r2, r2, 1 -+shl r2, r3, 1 - and r2, r2, 15 # r2 = bcd0 - mov r1, r2 # r1 = bcd0 - asr r1, r1, 2 # r1 = bc -@@ -181,9 +180,6 @@ add t0s, r2, r1 - mov rb12,unif # offset before shift - mov rb13,unif # offset after shift - --# Dump padding words --mov r0, unif -- - # submit texture requests for second line - max r1, ra_y, 0 - min r1, r1, rb_frame_height_minus_1 --- -2.7.4 - - -From db6fe49d50e42c444b5833acc6206c0bbfaacef4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 23 May 2015 13:20:21 +0100 -Subject: [PATCH 45/68] Add new cache flushing routine - ---- - libavcodec/hevc.c | 8 +++-- - libavcodec/hevc_filter.c | 39 ++++++++++----------- - libavcodec/rpi_qpu.c | 17 +++++++-- - libavcodec/rpi_qpu.h | 2 ++ - libavcodec/rpi_user_vcsm.h | 86 ++++++++++++++++++++++++++-------------------- - 5 files changed, 91 insertions(+), 61 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index caadfaa..9d12583 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3575,9 +3575,13 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) - } - - fail: -- if (s->ref && s->threads_type == FF_THREAD_FRAME) -+ if (s->ref && s->threads_type == FF_THREAD_FRAME) { -+#ifdef RPI_INTER_QPU -+ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -+ ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); -+#endif - ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -- -+ } - return ret; - } - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 186317a..ec84e8a 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -883,36 +883,35 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { - return p->vc & 0x3fffffff; - } - --static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -+void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) - { - if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || - s->nal_unit_type == NAL_TSA_N || - s->nal_unit_type == NAL_STSA_N || - s->nal_unit_type == NAL_RADL_N || - s->nal_unit_type == NAL_RASL_N )) { --#define RPI_FAST_CACHEFLUSH - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; -- int curr_y = f->progress->data[0]; -+ int curr_y = ((int *)f->progress->data)[0]; -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; - int sz,base; -- if (curr_y < 0) curr_y = 0; -- if (n<=curr_y) return; // Should not happen -- sz = s->frame->linesize[1] * (n-curr_y); -- base = s->frame->linesize[1] * curr_y; -- iocache.s[0].cmd = 3; // Flush L1 cache -- iocache.s[0].addr = 0; -- iocache.s[0].size = 0; -- -- iocache.s[1].cmd = 2; -- iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { assert(0); return; } // Should not happen -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+ iocache.s[0].addr = p->arm + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(s->frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = p->arm + base; - iocache.s[1].size = sz; -- -- iocache.s[2].cmd = 2; -- iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; -- iocache.s[2].size = sz; -- -- vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); -- -+ vcsm_clean_invalid( &iocache ); - #else - flush_buffer(s->frame->buf[1]); - flush_buffer(s->frame->buf[2]); -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index feb3284..aa65a77 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -211,6 +211,7 @@ static void gpu_unlock(void) { - } - - static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -+ p->numbytes = numbytes; - p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); - assert(p->vcsm_handle); - p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -@@ -243,13 +244,25 @@ int gpu_get_mailbox(void) - return gpu->mb; - } - -+// Call this to clean and invalidate a region of memory - void gpu_cache_flush(GPU_MEM_PTR_T *p) - { -- void *tmp = vcsm_lock(p->vcsm_handle); -- vcsm_unlock_ptr(tmp); -+#define RPI_FAST_CACHEFLUSH -+#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+ iocache.s[0].addr = p->arm; -+ iocache.s[0].size = p->numbytes; -+ vcsm_clean_invalid( &iocache ); -+#else -+ void *tmp = vcsm_lock(p->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+#endif - } - - static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -+ p->numbytes = numbytes; - p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); - //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); - //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 2f08f03..0565a60 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -1,6 +1,8 @@ - #ifndef RPI_QPU_H - #define RPI_QPU_H - -+#define RPI_FAST_CACHEFLUSH -+ - typedef struct gpu_mem_ptr_s { - unsigned char *arm; // Pointer to memory mapped on ARM side - int vc_handle; // Videocore handle of relocatable memory -diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -index 95e6de1..db41a4d 100644 ---- a/libavcodec/rpi_user_vcsm.h -+++ b/libavcodec/rpi_user_vcsm.h -@@ -1,29 +1,41 @@ --/* --Copyright (c) 2012, Broadcom Europe Ltd --All rights reserved. -- --Redistribution and use in source and binary forms, with or without --modification, are permitted provided that the following conditions are met: -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the copyright holder nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- --THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND --ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED --WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE --DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY --DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES --(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; --LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND --ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --*/ -+/***************************************************************************** -+* Copyright 2001 - 2011 Broadcom Corporation. All rights reserved. -+* -+* This program is the proprietary software of Broadcom Corporation and/or -+* its licensors, and may only be used, duplicated, modified or distributed -+* pursuant to the terms and conditions of a separate, written license -+* agreement executed between you and Broadcom (an "Authorized License"). -+* Except as set forth in an Authorized License, Broadcom grants no license -+* (express or implied), right to use, or waiver of any kind with respect to -+* the Software, and Broadcom expressly reserves all rights in and to the -+* Software and all intellectual property rights therein. IF YOU HAVE NO -+* AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY -+* WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE ALL USE OF -+* THE SOFTWARE. -+* -+* Except as expressly set forth in the Authorized License, -+* 1. This program, including its structure, sequence and organization, -+* constitutes the valuable trade secrets of Broadcom, and you shall use -+* all reasonable efforts to protect the confidentiality thereof, and to -+* use this information only in connection with your use of Broadcom -+* integrated circuit products. -+* 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" -+* AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR -+* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH -+* RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL -+* IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS -+* FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, -+* QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. YOU -+* ASSUME THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE. -+* 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS -+* LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, -+* OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO -+* YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN -+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS -+* OF THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER -+* IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF -+* ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. -+*****************************************************************************/ - - #ifndef __USER_VCSM__H__INCLUDED__ - #define __USER_VCSM__H__INCLUDED__ -@@ -424,21 +436,21 @@ int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); - ** - ** structure contains a list of flush/invalidate commands. Commands are: - ** 0: nop --** 1: invalidate given physical range in L2 --** 2: clean given physical range in L2 --** 3: clean+invalidate all of L1 --** 4: flush all of L2 and all of L1 -+** 1: invalidate given virtual range in L1/L2 -+** 2: clean given virtual range in L1/L2 -+** 3: clean+invalidate given virtual range in L1/L2 -+** 4: flush all L1/L2 - */ - struct vcsm_user_clean_invalid_s { -- struct { -- unsigned int cmd; -- unsigned int addr; -- unsigned int size; -- } s[8]; -+ struct { -+ unsigned int cmd; -+ unsigned int handle; -+ unsigned int addr; -+ unsigned int size; -+ } s[8]; - }; - --int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); -- -+int vcsm_clean_invalid( struct vcsm_user_clean_invalid_s *s ); - - #ifdef __cplusplus - } --- -2.7.4 - - -From 87a6cb3a4f7189e711c85de6d20077b6453b2ebe Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 23 May 2015 21:10:10 +0100 -Subject: [PATCH 46/68] Fix multi mailbox extra transform call - ---- - libavcodec/hevc.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 9d12583..30f5834 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3024,7 +3024,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #ifdef RPI_INTER_QPU - rpi_execute_inter_qpu(s); - #endif -+#ifndef RPI_MULTI_MAILBOX - rpi_execute_transform(s); -+#endif - rpi_execute_inter_cmds(s); - vpu_wait(s->vpu_id); - rpi_execute_pred_cmds(s); --- -2.7.4 - - -From 2a3672a1bda0296453953bebe8b17d69445260b4 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 27 May 2015 16:44:29 +0100 -Subject: [PATCH 47/68] Added support for running luma prediction on QPUs - ---- - libavcodec/hevc.c | 237 +++++++- - libavcodec/hevc.h | 26 +- - libavcodec/hevc_filter.c | 23 +- - libavcodec/rpi_qpu.c | 156 ++++-- - libavcodec/rpi_qpu.h | 8 +- - libavcodec/rpi_shader.c | 1313 ++++++++++++++++++++++---------------------- - libavcodec/rpi_shader.h | 21 +- - libavcodec/rpi_shader.qasm | 883 ++++++++++++++--------------- - 8 files changed, 1464 insertions(+), 1203 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 30f5834..2da88ec 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -52,6 +52,11 @@ - // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU - #define RPI_MULTI_MAILBOX - #endif -+ -+ // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory -+ // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. -+ -+ - #endif - - // #define DISABLE_MC -@@ -74,6 +79,13 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - // The QPU code for UV blocks only works up to a block width of 8 - #define RPI_CHROMA_BLOCK_WIDTH 8 - -+// Split image of 2048 into parts 64 wide -+// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -+// Each block of 64*64 -+// Smallest CTU size is 16x16, so smallest block is 8x8 -+// Corresponds to a total of 83kbytes over all 12 QPUs -+#define RPI_LUMA_COMMAND_WORDS 9 -+#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) - - #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) - -@@ -2015,10 +2027,46 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int nPbW_c = nPbW >> s->ps.sps->hshift[1]; - int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - -- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -+#ifdef RPI_LUMA_QPU -+ if (s->enable_rpi) { -+ int reflist = 0; -+ const Mv *mv = ¤t_mv.mv[reflist]; -+ int mx = mv->x & 3; -+ int my = mv->y & 3; -+ int my_mx = (my<<8) + mx; -+ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -+ int x1 = x0 + (mv->x >> 2); -+ int y1 = y0 + (mv->y >> 2); -+ int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -+ } else { -+ *y++ = 1; // Weight of 1 and offset of 0 -+ } -+ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+ s->y_mvs[chan % 12] = y; -+ } else -+#endif -+ { -+ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, - ¤t_mv.mv[0], x0, y0, nPbW, nPbH, - s->sh.luma_weight_l0[current_mv.ref_idx[0]], - s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -+ } - - if (s->ps.sps->chroma_format_idc) { - #ifdef RPI_INTER_QPU -@@ -2078,10 +2126,47 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int nPbW_c = nPbW >> s->ps.sps->hshift[1]; - int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - -- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -+#ifdef RPI_LUMA_QPU -+ if (s->enable_rpi) { -+ int reflist = 1; -+ const Mv *mv = ¤t_mv.mv[reflist]; -+ int mx = mv->x & 3; -+ int my = mv->y & 3; -+ int my_mx = (my<<8) + mx; -+ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -+ int x1 = x0 + (mv->x >> 2); -+ int y1 = y0 + (mv->y >> 2); -+ int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -+ } else { -+ *y++ = 1; // Weight of 1 and offset of 0 -+ } -+ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+ s->y_mvs[chan % 12] = y; -+ } else -+#endif -+ -+ { -+ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, - ¤t_mv.mv[1], x0, y0, nPbW, nPbH, - s->sh.luma_weight_l1[current_mv.ref_idx[1]], - s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -+ } - - if (s->ps.sps->chroma_format_idc) { - #ifdef RPI_INTER_QPU -@@ -2115,8 +2200,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = rpi_filter_coefs[_mx][0]; - *u++ = rpi_filter_coefs[_my][0]; - if (weight_flag) { -- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); -- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); -+ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][0] & 0xffff); -+ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][1] & 0xffff); - } else { - *u++ = 1; // Weight of 1 and offset of 0 - *u++ = 1; -@@ -2143,9 +2228,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int nPbW_c = nPbW >> s->ps.sps->hshift[1]; - int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - -- RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -+#ifdef RPI_LUMA_QPU -+ if (s->enable_rpi) { -+ const Mv *mv = ¤t_mv.mv[0]; -+ int mx = mv->x & 3; -+ int my = mv->y & 3; -+ int my_mx = (my<<8) + mx; -+ const Mv *mv2 = ¤t_mv.mv[1]; -+ int mx2 = mv2->x & 3; -+ int my2 = mv2->y & 3; -+ int my2_mx2 = (my2<<8) + mx2; -+ int my2_mx2_my_mx = (my2_mx2 << 16) + my_mx; -+ int x1 = x0 + (mv->x >> 2); -+ int y1 = y0 + (mv->y >> 2); -+ int x2 = x0 + (mv2->x >> 2); -+ int y2 = y0 + (mv2->y >> 2); -+ int chan = x0>>6; // 64 wide blocks per QPU -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); -+ *y++ = my2_mx2_my_mx; -+ *y++ = 1; // B frame weighted prediction not supported -+ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+ s->y_mvs[chan % 12] = y; -+ } else -+#endif -+ { -+ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, - ¤t_mv.mv[0], x0, y0, nPbW, nPbH, - ref1->frame, ¤t_mv.mv[1], ¤t_mv); -+ } - - if (s->ps.sps->chroma_format_idc) { - #ifdef RPI_INTER_QPU -@@ -2834,7 +2954,6 @@ static void rpi_inter_clear(HEVCContext *s) - *s->u_mvs[i]++ = pic_height; - *s->u_mvs[i]++ = s->frame->linesize[1]; - *s->u_mvs[i]++ = s->frame->linesize[2]; -- *s->u_mvs[i]++ = i; - if (weight_flag) { - *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); - *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -@@ -2842,7 +2961,31 @@ static void rpi_inter_clear(HEVCContext *s) - *s->u_mvs[i]++ = 1 << 5; - *s->u_mvs[i]++ = 6; - } -+ *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -+ } -+ -+#ifdef RPI_LUMA_QPU -+ for(i=0;i<12;i++) { -+ s->y_mvs[i] = s->y_mvs_base[i]; -+ *s->y_mvs[i]++ = 0; // y_x -+ *s->y_mvs[i]++ = 0; // ref_y_base -+ *s->y_mvs[i]++ = 0; // y2_x2 -+ *s->y_mvs[i]++ = 0; // ref_y2_base -+ *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -+ *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch -+ *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch -+ if (weight_flag) { -+ int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); -+ int shift = s->sh.luma_log2_weight_denom + 6; -+ *s->y_mvs[i]++ = (offset << 16) + shift; -+ } else { -+ int offset = 1 << 5; -+ int shift = 6; -+ *s->y_mvs[i]++ = (offset << 16) + shift; -+ } -+ *s->y_mvs[i]++ = 0; // Next kernel - } -+#endif - } - - static void rpi_execute_inter_qpu(HEVCContext *s) -@@ -2850,6 +2993,9 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - int k; - int i; - uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -+#ifdef RPI_LUMA_QPU -+ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; -+#endif - if (s->sh.slice_type == I_SLICE) { - #ifdef RPI_MULTI_MAILBOX - rpi_execute_transform(s); -@@ -2865,8 +3011,23 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - - s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore - -+#ifdef RPI_LUMA_QPU -+ for(k=0;k<12;k++) { -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -+ } -+ s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+#endif -+ -+ - #ifdef RPI_MULTI_MAILBOX -+#ifdef RPI_CACHE_UNIF_MVS -+ gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); -+#else - gpu_cache_flush(&s->coeffs_buf_accelerated); -+#endif - s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, - qpu_get_fn(QPU_MC_SETUP_UV), - (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -@@ -2876,7 +3037,27 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), - (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), - (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+#ifdef RPI_LUMA_QPU -+ qpu_get_fn(QPU_MC_SETUP), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) -+#else -+ 0, -+ 0,0,0,0, -+ 0,0,0,0, -+ 0,0,0,0 -+#endif - ); - for(i=0;i<4;i++) - s->num_coeffs[i] = 0; -@@ -2892,6 +3073,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) - ); - #endif -+ -+ - } - #endif - -@@ -3579,8 +3762,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) - fail: - if (s->ref && s->threads_type == FF_THREAD_FRAME) { - #ifdef RPI_INTER_QPU -- void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -- ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); -+ ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); - #endif - ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); - } -@@ -3767,7 +3949,6 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - - #ifdef RPI - av_freep(&s->unif_mv_cmds); -- av_freep(&s->unif_xfm_cmds); - av_freep(&s->univ_pred_cmds); - - #ifdef RPI_INTER_QPU -@@ -3776,7 +3957,12 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - s->unif_mvs = 0; - } - #endif -- //gpu_free(&s->dummy); -+#ifdef RPI_LUMA_QPU -+ if (s->y_unif_mvs) { -+ gpu_free( &s->y_unif_mvs_ptr ); -+ s->y_unif_mvs = 0; -+ } -+#endif - - #ifdef EARLY_MALLOC - printf("hevc_decode_free\n"); -@@ -3861,9 +4047,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); - if (!s->unif_mv_cmds) - goto fail; -- s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); -- if (!s->unif_xfm_cmds) -- goto fail; - s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); - if (!s->univ_pred_cmds) - goto fail; -@@ -3877,7 +4060,11 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - { - int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; - uint32_t *p; -+#ifdef RPI_CACHE_UNIF_MVS -+ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+#else - gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+#endif - s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC - - // Set up initial locations for uniform streams -@@ -3892,6 +4079,28 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - - } - #endif -+#ifdef RPI_LUMA_QPU -+ { -+ int y_commands_per_qpu = Y_COMMANDS_PER_QPU; -+ uint32_t *p; -+#ifdef RPI_CACHE_UNIF_MVS -+ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -+#else -+ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -+#endif -+ s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+ -+ // Set up initial locations for uniform streams -+ p = s->y_unif_mvs; -+ for(i = 0; i < 12; i++) { -+ s->y_mvs_base[i] = p; -+ p += y_commands_per_qpu; -+ } -+ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -+ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -+ -+ } -+#endif - //gpu_malloc_uncached(2048*64,&s->dummy); - - #ifdef EARLY_MALLOC -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 4a39e39..5df9dcd 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -44,9 +44,13 @@ - #ifdef RPI - - #include "rpi_qpu.h" -- // Use QPU for inter prediction -+ // Define RPI_INTER_QPU to use QPU for chroma inter prediction - #define RPI_INTER_QPU - -+ #ifdef RPI_INTER_QPU -+ // Define RPI_LUMA_QPU to also use QPU for luma inter prediction -+ #define RPI_LUMA_QPU -+ #endif - #endif - - #define MAX_DPB_SIZE 16 // A.4.1 -@@ -809,7 +813,6 @@ typedef struct HEVCLocalContext { - - // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi - #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) --#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) - // Each block can have an intra prediction and a transform_add command - #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) - // Worst case is 16x16 CTUs -@@ -844,9 +847,6 @@ typedef struct HEVCMvCmd { - int8_t ref_idx[2]; - } HEVCMvCmd; - --// Command for transform to process a block of coefficients --typedef struct HEVCXfmCmd { --} HEVCXfmCmd; - - // Command for intra prediction and transform_add of predictions to coefficients - #define RPI_PRED_TRANSFORM_ADD 0 -@@ -892,8 +892,7 @@ typedef struct HEVCContext { - - #ifdef RPI - int enable_rpi; -- HEVCMvCmd *unif_mv_cmds; // TODO rename -- HEVCXfmCmd *unif_xfm_cmds; -+ HEVCMvCmd *unif_mv_cmds; - HEVCPredCmd *univ_pred_cmds; - int buf_width; - GPU_MEM_PTR_T coeffs_buf_default; -@@ -920,6 +919,15 @@ typedef struct HEVCContext { - uint32_t mc_filter_uv_b0; - uint32_t mc_filter_uv_b; - #endif -+#ifdef RPI_LUMA_QPU -+ GPU_MEM_PTR_T y_unif_mvs_ptr; -+ uint32_t *y_unif_mvs; // Base of memory for motion vector commands -+ uint32_t *y_mvs_base[12]; -+ uint32_t *y_mvs[12]; -+ // Function pointers -+ uint32_t mc_filter; -+ uint32_t mc_filter_b; -+#endif - - #endif - -@@ -1166,6 +1174,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - int log2_trafo_size, enum ScanType scan_idx, - int c_idx); - -+#ifdef RPI_INTER_QPU -+extern void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n); -+#endif -+ - void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size); - - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index ec84e8a..11629e4 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -883,8 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { - return p->vc & 0x3fffffff; - } - --void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); --void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - { - if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || - s->nal_unit_type == NAL_TSA_N || -@@ -911,10 +910,24 @@ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) - iocache.s[1].cmd = 3; // clean+invalidate - iocache.s[1].addr = p->arm + base; - iocache.s[1].size = sz; -+ -+#ifdef RPI_LUMA_QPU -+ p = av_buffer_pool_opaque(s->frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+ iocache.s[2].addr = p->arm + base; -+ iocache.s[2].size = sz; -+#endif - vcsm_clean_invalid( &iocache ); - #else - flush_buffer(s->frame->buf[1]); - flush_buffer(s->frame->buf[2]); -+#ifdef RPI_LUMA_QPU -+ flush_buffer(s->frame->buf[1]); -+#endif -+ - #endif - //memcpy(s->dummy.arm,s->frame->data[0],2048*64); - //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -@@ -938,7 +951,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - sao_filter_CTB(s, x, y - ctb_size); - if (s->threads_type & FF_THREAD_FRAME ) { - #ifdef RPI_INTER_QPU -- ff_hevc_flush_chroma(s,&s->ref->tf, y); -+ ff_hevc_flush_buffer(s,&s->ref->tf, y); - #endif - ff_thread_report_progress(&s->ref->tf, y, 0); - } -@@ -947,7 +960,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - sao_filter_CTB(s, x , y); - if (s->threads_type & FF_THREAD_FRAME ) { - #ifdef RPI_INTER_QPU -- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size); - #endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); - } -@@ -957,7 +970,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - //int currh = s->ref->tf.progress->data[0]; - //if (((y + ctb_size)&63)==0) - #ifdef RPI_INTER_QPU -- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); - #endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); - } -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index aa65a77..e12304b 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -1,9 +1,11 @@ - #ifdef RPI - // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. - // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code --#define RPI_TIME_TOTAL_QPU -+//#define RPI_TIME_TOTAL_QPU - // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code - //#define RPI_TIME_TOTAL_VPU -+// define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined -+//#define RPI_TIME_TOTAL_POSTED - // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion - #define RPI_ASYNC - -@@ -94,7 +96,8 @@ struct GPU - int open_count; // Number of allocated video buffers - int mb; // Mailbox handle - int vc; // Address in GPU memory -- int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -+ int mail[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the first QPU task -+ int mail2[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the second QPU task - }; - - // Stop more than one thread trying to allocate memory or use the processing resources at once -@@ -102,7 +105,7 @@ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; - static volatile struct GPU* gpu = NULL; - static GPU_MEM_PTR_T gpu_mem_ptr; - --#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -+#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) || defined(RPI_TIME_TOTAL_POSTED) - static unsigned int Microseconds(void) { - struct timespec ts; - unsigned int x; -@@ -123,7 +126,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; - static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; - static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; - --static int vpu_cmds[MAXCMDS][16]; -+static int vpu_cmds[MAXCMDS][32]; - static volatile int vpu_async_tail=0; // Contains the number of posted jobs - static volatile int vpu_async_head=0; - #endif -@@ -247,7 +250,6 @@ int gpu_get_mailbox(void) - // Call this to clean and invalidate a region of memory - void gpu_cache_flush(GPU_MEM_PTR_T *p) - { --#define RPI_FAST_CACHEFLUSH - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; - iocache.s[0].handle = p->vcsm_handle; -@@ -261,6 +263,34 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) - #endif - } - -+void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -+{ -+#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ iocache.s[0].handle = p0->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+ iocache.s[0].addr = (int) p0->arm; -+ iocache.s[0].size = p0->numbytes; -+ iocache.s[1].handle = p1->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = (int) p1->arm; -+ iocache.s[1].size = p1->numbytes; -+ iocache.s[2].handle = p2->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+ iocache.s[2].addr = (int) p2->arm; -+ iocache.s[2].size = p2->numbytes; -+ vcsm_clean_invalid( &iocache ); -+#else -+ void *tmp; -+ tmp = vcsm_lock(p0->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+ tmp = vcsm_lock(p1->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+ tmp = vcsm_lock(p2->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+#endif -+} -+ - static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { - p->numbytes = numbytes; - p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -@@ -357,9 +387,19 @@ unsigned int vpu_get_constants(void) { - #ifdef RPI_ASYNC - - static void *vpu_start(void *arg) { -+#ifdef RPI_TIME_TOTAL_POSTED -+ int last_time=0; -+ long long on_time=0; -+ long long off_time=0; -+ int start_time; -+ int end_time; -+ int count=0; -+#endif - while(1) { -+ int i; - int *p; - int qpu_code; -+ int qpu_codeb; - pthread_mutex_lock(&post_mutex); - while( vpu_async_tail - vpu_async_head <= 0) - { -@@ -373,24 +413,49 @@ static void *vpu_start(void *arg) { - break; // Last job - } - qpu_code = p[7]; -+ qpu_codeb = p[16]; - //if (p[7]) { - //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; - //gpu_cache_flush(buf); - //} -+ -+#ifdef RPI_TIME_TOTAL_POSTED -+ start_time = Microseconds(); -+ if (last_time==0) -+ last_time = start_time; -+ off_time += start_time-last_time; -+#endif -+ - if (!qpu_code) { - vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); - } else { -- int i; - for(i=0;i<8;i++) { - gpu->mail[i*2] = p[8+i]; - gpu->mail[i*2 + 1] = qpu_code; - } -- -- execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -- 0, 0, 0, 0, -+ for(i=0;i<12;i++) { -+ gpu->mail2[i*2] = p[17+i]; -+ gpu->mail2[i*2 + 1] = qpu_codeb; -+ } -+#if (0) -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); -+#else -+ execute_multi(gpu->mb, -+ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, - p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 - 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+#endif - } -+#ifdef RPI_TIME_TOTAL_POSTED -+ end_time = Microseconds(); -+ last_time = end_time; -+ on_time += end_time - start_time; -+ count++; -+ if ((count&0x7f)==0) -+ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -+#endif - pthread_mutex_lock(&post_mutex); - vpu_async_head++; - pthread_cond_broadcast(&post_cond_head); -@@ -436,7 +501,9 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned - } - - int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -+ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, -+ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b -+ ) - { - - pthread_mutex_lock(&post_mutex); -@@ -464,6 +531,21 @@ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, - p[13] = unifs6; - p[14] = unifs7; - p[15] = unifs8; -+ -+ p[16] = qpu_codeb; -+ p[17] = unifs1b; -+ p[18] = unifs2b; -+ p[19] = unifs3b; -+ p[20] = unifs4b; -+ p[21] = unifs5b; -+ p[22] = unifs6b; -+ p[23] = unifs7b; -+ p[24] = unifs8b; -+ p[25] = unifs9b; -+ p[26] = unifs10b; -+ p[27] = unifs11b; -+ p[28] = unifs12b; -+ - if (num<=1) - pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake - pthread_mutex_unlock(&post_mutex); -@@ -544,27 +626,27 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un - off_time += start_time-last_time; - #endif - for(i=0;imail[i*2 + 1] = code; -+ gpu->mail2[i*2 + 1] = code; - } - for(;imail[i*2 + 1] = code2; -+ gpu->mail2[i*2 + 1] = code2; - } -- gpu->mail[0 ] = unifs1; -- gpu->mail[2 ] = unifs2; -- gpu->mail[4 ] = unifs3; -- gpu->mail[6 ] = unifs4; -- gpu->mail[8 ] = unifs5; -- gpu->mail[10] = unifs6; -- gpu->mail[12] = unifs7; -- gpu->mail[14] = unifs8; -- gpu->mail[16] = unifs9; -- gpu->mail[18] = unifs10; -- gpu->mail[20] = unifs11; -- gpu->mail[22] = unifs12; -+ gpu->mail2[0 ] = unifs1; -+ gpu->mail2[2 ] = unifs2; -+ gpu->mail2[4 ] = unifs3; -+ gpu->mail2[6 ] = unifs4; -+ gpu->mail2[8 ] = unifs5; -+ gpu->mail2[10] = unifs6; -+ gpu->mail2[12] = unifs7; -+ gpu->mail2[14] = unifs8; -+ gpu->mail2[16] = unifs9; -+ gpu->mail2[18] = unifs10; -+ gpu->mail2[20] = unifs11; -+ gpu->mail2[22] = unifs12; - execute_qpu( - gpu->mb, - 12 /* Number of QPUs */, -- gpu->vc + offsetof(struct GPU, mail), -+ gpu->vc + offsetof(struct GPU, mail2), - 1 /* no flush */, // Don't flush VPU L1 cache - 5000 /* timeout ms */); - #ifdef RPI_TIME_TOTAL_QPU -@@ -635,21 +717,21 @@ unsigned int qpu_get_fn(int num) { - gpu_unlock(); - } - switch(num) { -- //case QPU_MC_SETUP: -- // fn = mc_setup; -- // break; -- //case QPU_MC_FILTER: -- // fn = mc_filter; -- // break; -+ case QPU_MC_SETUP: -+ fn = mc_setup; -+ break; -+ case QPU_MC_FILTER: -+ fn = mc_filter; -+ break; - case QPU_MC_EXIT: - fn = mc_exit; - break; -- //case QPU_MC_INTERRUPT_EXIT: -- // fn = mc_interrupt_exit; -- // break; -- //case QPU_MC_FILTER_B: -- // fn = mc_filter_b; -- // break; -+ case QPU_MC_INTERRUPT_EXIT12: -+ fn = mc_interrupt_exit12; -+ break; -+ case QPU_MC_FILTER_B: -+ fn = mc_filter_b; -+ break; - //case QPU_MC_FILTER_HONLY: - // fn = mc_filter_honly; - // break; -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 0565a60..81c2bb1 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -1,6 +1,7 @@ - #ifndef RPI_QPU_H - #define RPI_QPU_H - -+// Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code - #define RPI_FAST_CACHEFLUSH - - typedef struct gpu_mem_ptr_s { -@@ -16,6 +17,7 @@ extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); - extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); - extern void gpu_free(GPU_MEM_PTR_T *p); - extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); - - // QPU specific functions - extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -@@ -26,7 +28,7 @@ enum { - QPU_MC_SETUP, - QPU_MC_FILTER, - QPU_MC_EXIT, -- QPU_MC_INTERRUPT_EXIT, -+ QPU_MC_INTERRUPT_EXIT12, - QPU_MC_FILTER_B, - QPU_MC_FILTER_HONLY, - QPU_MC_SETUP_UV, -@@ -44,7 +46,9 @@ extern unsigned int vpu_get_constants(void); - extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); - extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); - int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, -+ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b -+ ); - extern void vpu_wait( int id); - - // Simple test of shader code -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index a0f0282..e86eb30 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -48,693 +48,674 @@ unsigned int rpi_shader[] = { - /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 - /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 - /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif --/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 --/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 --/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 --/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 --/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) --/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 --/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x --/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y --/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base --/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset --/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -+/* [0x000000d0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+/* [0x000000d8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+/* [0x000000e0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+/* [0x000000e8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+/* [0x000000f0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x000000f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000100] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000108] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -+/* [0x00000110] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000118] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+/* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+/* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 -+/* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 -+/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 -+/* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 -+/* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif -+/* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+/* [0x00000158] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+/* [0x00000160] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000168] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000170] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000178] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000180] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000188] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000190] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000198] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x000001a0] */ 0x0f9c11c0, 0xd00208a7, // asr r2, r0, 1 -+/* [0x000001a8] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+/* [0x000001b0] */ 0x0c9e7440, 0x10021567, // add rb21, r2, r1 -+/* [0x000001b8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x000001c0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x000001c8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x000001d0] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 - /* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch --/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 --/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 --/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif --/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif --/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x --/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+/* [0x000001e0] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x000001e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000001f0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x000001f8] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+/* [0x00000200] */ 0x0c627380, 0x10020f27, // add t1s, r1, ra_frame_base - // ::mc_filter_uv --/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 --/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 --/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 --/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 --/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000208] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000210] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000218] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000220] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000228] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000230] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000238] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000240] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000248] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000250] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000258] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x00000260] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000268] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000270] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000278] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000280] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000288] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000290] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000298] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000002a0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000002a8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x000002b0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x000002b8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000002c8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000002d0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000002d8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000002e0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000002e8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000002f0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000002f8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000300] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000308] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000310] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000318] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+/* [0x00000320] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000328] */ 0x0f9e7080, 0x100208e7, // asr r3, r0, r2 -+/* [0x00000330] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000338] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+/* [0x00000340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000348] */ 0x0f9e7080, 0x100608e7, // asr.ifnz r3, r0, r2 -+/* [0x00000350] */ 0x119c87c0, 0xd00213a7, // shl rb14,r3,8 -+/* [0x00000358] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop --/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 --/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 --/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 --/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 --/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 --/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 --/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 --/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 --/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 --/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop --/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 --/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000360] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000368] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+/* [0x00000370] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000378] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000380] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000003a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x000003a8] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -+/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000003b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000003c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000003c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000003d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000003d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000003e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x000003e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x000003f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000003f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000400] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000408] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000410] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000418] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000420] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000428] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000430] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000438] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000440] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000448] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000450] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000458] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000460] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x00000468] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x00000470] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x00000478] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:uvloop -+/* [0x00000480] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x00000488] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00000490] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00000498] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000004a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000004b0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000004b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000004c0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000004c8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_uv_b0 --/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 --/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 --/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 --/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x000004e0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x000004e8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x000004f0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x000004f8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000500] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000508] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000510] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000518] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000520] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000528] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000530] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x00000538] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+/* [0x00000540] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x00000548] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000550] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x00000558] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000560] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000568] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x00000570] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x00000578] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000580] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000588] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000590] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000598] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x000005c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x000005d8] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x000005e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005e8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000005f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x000005f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000600] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b0 --/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 --/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 --/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 --/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 --/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 --/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop --/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000610] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+/* [0x00000618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00000620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00000628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x00000630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00000638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00000640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x00000648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x00000650] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -+/* [0x00000658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000660] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x00000668] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x00000670] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x00000678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000680] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000690] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x000006a0] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x000006a8] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x000006b0] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x000006b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x000006c0] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000006c8] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000006d0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000006d8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000006e0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000006e8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000006f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000006f8] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+/* [0x00000700] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+/* [0x00000708] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+/* [0x00000710] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -+/* [0x00000720] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000728] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop - // ::mc_filter_uv_b --/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif --/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 --/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 --/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 --/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 --/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 --/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 --/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 --/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 --/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 --/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 --/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 --/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 --/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000740] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+/* [0x00000748] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+/* [0x00000750] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+/* [0x00000758] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+/* [0x00000760] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+/* [0x00000768] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000770] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+/* [0x00000778] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+/* [0x00000780] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+/* [0x00000788] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000790] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+/* [0x00000798] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x000007a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x000007b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+/* [0x000007b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x000007c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x000007c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+/* [0x000007d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+/* [0x000007d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x000007e0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+/* [0x000007e8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+/* [0x000007f0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+/* [0x000007f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000800] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+/* [0x00000808] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000810] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+/* [0x00000818] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000820] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000828] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000830] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000838] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+/* [0x00000840] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000848] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000850] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000858] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000860] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :uvloop_b --/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 --/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 --/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 --/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 --/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm --/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 --/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b --/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif --/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 --/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 --/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00000890] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+/* [0x000008d0] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -+/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_exit --/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) --/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop --/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a18] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a28] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_interrupt_exit8 --/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a58] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00000a68] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_setup --/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 --/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 --/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 --/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 --/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 --/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 --/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 --/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 --/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 --/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 --/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif --/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) --/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 --/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 --/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 --/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 --/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 --/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 --/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 --/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 --/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 --/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 --/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 --/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 --/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 --/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 --/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 --/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) --/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 --/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 --/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num --/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 --/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 --/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 --/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 --/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 --/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) --/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 --/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif --/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif --/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 --/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 --/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base --/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 --/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 --/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00000ac0] */ 0x00000010, 0xe00208e7, // mov r3, 16 -+/* [0x00000ac8] */ 0x15827d80, 0x10020227, // mov ra8, unif -+/* [0x00000ad0] */ 0x15827d80, 0x10020267, // mov ra9, unif -+/* [0x00000ad8] */ 0x15827d80, 0x100202a7, // mov ra10, unif -+/* [0x00000ae0] */ 0x15827d80, 0x100202e7, // mov ra11, unif -+/* [0x00000ae8] */ 0x15827d80, 0x10020867, // mov r1, unif -+/* [0x00000af0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -+/* [0x00000af8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -+/* [0x00000b00] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -+/* [0x00000b08] */ 0x0d9c13c0, 0xd0021667, // sub rb_frame_width_minus_1,r1,1 -+/* [0x00000b10] */ 0x0d9c11c0, 0xd00217a7, // sub rb_frame_height_minus_1,r0,1 -+/* [0x00000b18] */ 0x15827d80, 0x10021427, // mov rb_pitch, unif -+/* [0x00000b20] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000b28] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+/* [0x00000b30] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+/* [0x00000b38] */ 0x15227d80, 0x10020867, // mov r1, ra8 -+/* [0x00000b40] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -+/* [0x00000b48] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -+/* [0x00000b50] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -+/* [0x00000b58] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -+/* [0x00000b60] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -+/* [0x00000b68] */ 0x922591f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 -+/* [0x00000b70] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000b78] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+/* [0x00000b80] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000b88] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+/* [0x00000b90] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000b98] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000ba0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000ba8] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+/* [0x00000bb0] */ 0x152a7d80, 0x10020867, // mov r1, ra10 -+/* [0x00000bb8] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -+/* [0x00000bc0] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -+/* [0x00000bc8] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -+/* [0x00000bd0] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -+/* [0x00000bd8] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -+/* [0x00000be0] */ 0x922d91f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 -+/* [0x00000be8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x00000bf0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+/* [0x00000bf8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000c00] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+/* [0x00000c08] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+/* [0x00000c10] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000c18] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000c20] */ 0x8c9e7452, 0x10025f19, // add t1s, r2, r1 ; mov ra_frame_base2, r2 -+/* [0x00000c28] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+/* [0x00000c30] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+/* [0x00000c38] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+/* [0x00000c40] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+/* [0x00000c48] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+/* [0x00000c50] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+/* [0x00000c58] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+/* [0x00000c60] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+/* [0x00000c68] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+/* [0x00000c70] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+/* [0x00000c78] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+/* [0x00000c80] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+/* [0x00000c88] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+/* [0x00000c90] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+/* [0x00000c98] */ 0x00004000, 0xe00204a7, // mov ra18, 0x4000 -+/* [0x00000ca0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+/* [0x00000ca8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+/* [0x00000cb0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+/* [0x00000cb8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+/* [0x00000cc0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+/* [0x00000cc8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+/* [0x00000cd0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000cd8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+/* [0x00000ce0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+/* [0x00000ce8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+/* [0x00000cf0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+/* [0x00000cf8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+/* [0x00000d00] */ 0x15827d80, 0x10020867, // mov r1, unif -+/* [0x00000d08] */ 0x919c82ff, 0xd0024822, // shl r0,r1,r3 ; mov r2,8 -+/* [0x00000d10] */ 0x0f9e70c0, 0x10021367, // asr rb13,r0,r3 -+/* [0x00000d18] */ 0x0f9e72c0, 0x10021327, // asr rb12,r1,r3 -+/* [0x00000d20] */ 0x0c9cde80, 0x10021367, // add rb13,rb13,r2 -+/* [0x00000d28] */ 0x119cce80, 0x10021327, // shl rb12, rb12, r2 -+/* [0x00000d30] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+/* [0x00000d38] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+/* [0x00000d40] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+/* [0x00000d48] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+/* [0x00000d50] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+/* [0x00000d58] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+/* [0x00000d60] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 - /* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 - /* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch --/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 --// ::mc_filter -+/* [0x00000d78] */ 0x0c667380, 0x10020f27, // add t1s, r1, ra_frame_base2 -+// :per_block_setup - /* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - /* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif - /* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next - /* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next --/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 --/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif --/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 --/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 --/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 --/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000da0] */ 0x00000010, 0xe00208e7, // mov r3, 16 -+/* [0x00000da8] */ 0x15827d80, 0x10020867, // mov r1, unif -+/* [0x00000db0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -+/* [0x00000db8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -+/* [0x00000dc0] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -+/* [0x00000dc8] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -+/* [0x00000dd0] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -+/* [0x00000dd8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000de0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+/* [0x00000de8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+/* [0x00000df0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000df8] */ 0x8c827436, 0x100246a1, // add ra_frame_base_next, r2, r0 ; mov r1, unif -+/* [0x00000e00] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -+/* [0x00000e08] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -+/* [0x00000e10] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -+/* [0x00000e18] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -+/* [0x00000e20] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -+/* [0x00000e28] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+/* [0x00000e30] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+/* [0x00000e38] */ 0x159e7240, 0x10021067, // mov ra_y2_next, r1 -+/* [0x00000e40] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+/* [0x00000e48] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+/* [0x00000e50] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+/* [0x00000e58] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00000e60] */ 0x0e9e70c0, 0x10020867, // shr r1, r0, r3 -+/* [0x00000e68] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+/* [0x00000e70] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+/* [0x00000e78] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+/* [0x00000e80] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+/* [0x00000e88] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+/* [0x00000e90] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+/* [0x00000e98] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 -+/* [0x00000ea0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+/* [0x00000ea8] */ 0x95801dbf, 0xd0024821, // mov r0, unif ; mov r1,1 -+/* [0x00000eb0] */ 0x4f5971c6, 0x10024260, // asr ra9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000eb8] */ 0x4f5971c6, 0x10024220, // asr ra8, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ec0] */ 0x4f5971c6, 0x10044260, // asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 -+/* [0x00000ec8] */ 0x0f9d71c0, 0x10040227, // asr.ifz ra8, r0, rb23 -+/* [0x00000ed0] */ 0x0d243f80, 0xd0020267, // sub ra9,3,ra9 -+/* [0x00000ed8] */ 0x0d203f80, 0xd0020227, // sub ra8,3,ra8 -+/* [0x00000ee0] */ 0x11243dc0, 0xd0020267, // shl ra9,ra9,3 -+/* [0x00000ee8] */ 0x11203dc0, 0xd0020227, // shl ra8,ra8,3 -+/* [0x00000ef0] */ 0x00ffff00, 0xe0020867, // mov r1,0xffff00 -+/* [0x00000ef8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000f00] */ 0x0f9d71c0, 0x10020027, // asr ra0, r0, rb23 -+/* [0x00000f08] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 - /* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 --/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif --/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+/* [0x00000f18] */ 0x01040400, 0xe0020867, // mov r1,0x1040400 -+/* [0x00000f20] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000f28] */ 0x0f9d71c0, 0x10020067, // asr ra1, r0, rb23 -+/* [0x00000f30] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00000f38] */ 0x0f9d71c0, 0x10021167, // asr rb5, r0, rb23 -+/* [0x00000f40] */ 0xfbf5f600, 0xe0020867, // mov r1,0xfbf5f600 -+/* [0x00000f48] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000f50] */ 0x0f9d71c0, 0x100200a7, // asr ra2, r0, rb23 -+/* [0x00000f58] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00000f60] */ 0x0f9d71c0, 0x100211a7, // asr rb6, r0, rb23 -+/* [0x00000f68] */ 0x11283a40, 0xe0020867, // mov r1,0x11283a40 -+/* [0x00000f70] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000f78] */ 0x0f9d71c0, 0x100200e7, // asr ra3, r0, rb23 -+/* [0x00000f80] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00000f88] */ 0x0f9d71c0, 0x100211e7, // asr rb7, r0, rb23 -+/* [0x00000f90] */ 0x3a281100, 0xe0020867, // mov r1,0x3a281100 -+/* [0x00000f98] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000fa0] */ 0x0f9d71c0, 0x10020127, // asr ra4, r0, rb23 -+/* [0x00000fa8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00000fb0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+/* [0x00000fb8] */ 0xf6f5fb00, 0xe0020867, // mov r1,0xf6f5fb00 -+/* [0x00000fc0] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000fc8] */ 0x0f9d71c0, 0x10020167, // asr ra5, r0, rb23 -+/* [0x00000fd0] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00000fd8] */ 0x0f9d71c0, 0x10021267, // asr rb9, r0, rb23 -+/* [0x00000fe0] */ 0x04040100, 0xe0020867, // mov r1,0x4040100 -+/* [0x00000fe8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00000ff0] */ 0x0f9d71c0, 0x100201a7, // asr ra6, r0, rb23 -+/* [0x00000ff8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00001000] */ 0x0f9d71c0, 0x100212a7, // asr rb10, r0, rb23 -+/* [0x00001008] */ 0xffff0000, 0xe0020867, // mov r1,0xffff0000 -+/* [0x00001010] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -+/* [0x00001018] */ 0x0f9d71c0, 0x100201e7, // asr ra7, r0, rb23 -+/* [0x00001020] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+/* [0x00001028] */ 0x0f9d71c0, 0x100212e7, // asr rb11, r0, rb23 -+/* [0x00001030] */ 0x15827d80, 0x10020827, // mov r0, unif -+/* [0x00001038] */ 0x0f9e70c0, 0x100213e7, // asr rb15, r0, r3 -+/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+/* [0x00001048] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 -+/* [0x00001050] */ 0x8f9c00ff, 0xd0024823, // asr r0, r0, r3 ; mov r3, 0 -+/* [0x00001058] */ 0x119c81c0, 0xd00213a7, // shl rb14, r0, 8 -+// ::mc_filter - // :yloop --/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 --/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 --/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next --/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 --/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 --/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 --/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 --/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 --/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop --/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 --/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 --/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 --/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 --/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 --/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 --/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 --/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop --/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 --/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00001060] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00001068] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -+/* [0x00001070] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00001078] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00001080] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+/* [0x00001088] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+/* [0x00001090] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00001098] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000010a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000010a8] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+/* [0x000010b0] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+/* [0x000010b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000010c0] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+/* [0x000010c8] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -+/* [0x000010d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000010d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000010e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000010e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000010f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000010f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x00001100] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00001108] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00001110] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00001118] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00001120] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00001128] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00001130] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00001138] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001140] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001148] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001150] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001158] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00001160] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 -+/* [0x00001168] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001170] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001178] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001180] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001188] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+/* [0x00001190] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001198] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x000011a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000011a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000011b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000011b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000011c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000011c8] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+/* [0x000011d0] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+/* [0x000011d8] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+/* [0x000011e0] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+/* [0x000011e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000011f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000011f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+/* [0x00001200] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+/* [0x00001208] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+/* [0x00001210] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+/* [0x00001218] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+/* [0x00001220] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+/* [0x00001228] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00001230] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00001238] */ 0xfffffb28, 0xf0f809e7, // brr -, r:per_block_setup -+/* [0x00001240] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001248] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001250] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_filter_b --/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif --/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next --/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next --/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif --/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 --/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 --/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 --/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num --/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif --/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif --/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 --/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 --/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 --/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 --/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 --/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 --/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 --/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 --/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 --/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 --/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 --/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 --/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 --/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 --/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 --/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 --/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 --/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 --/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif --/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 --/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 --/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 --/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 --/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif --/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 --/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif --/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 --/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 --/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif --/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif --/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 --/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 --/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 --/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 - // :yloopb --/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 --/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 --/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next --/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 --/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 --/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 --/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 --/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 --/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 --/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 --/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 --/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 --/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 --/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 --/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 --/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 --/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 --/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb --/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 --/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 --/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 --/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 --/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 --/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 --/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 --/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 --/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 --/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 --/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 --/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait --/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 --/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 --/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 --/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 --/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb --/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 --/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 --/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 --/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 --/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 --/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 --/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+/* [0x00001258] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+/* [0x00001260] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -+/* [0x00001268] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+/* [0x00001270] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+/* [0x00001278] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+/* [0x00001280] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+/* [0x00001288] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+/* [0x00001290] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x00001298] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+/* [0x000012a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+/* [0x000012a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+/* [0x000012b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+/* [0x000012b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+/* [0x000012c0] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -+/* [0x000012c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+/* [0x000012d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+/* [0x000012d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+/* [0x000012e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+/* [0x000012e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+/* [0x000012f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+/* [0x000012f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+/* [0x00001300] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+/* [0x00001308] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+/* [0x00001310] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+/* [0x00001318] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+/* [0x00001320] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+/* [0x00001328] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+/* [0x00001330] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+/* [0x00001338] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+/* [0x00001340] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+/* [0x00001348] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+/* [0x00001350] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+/* [0x00001358] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 -+/* [0x00001360] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+/* [0x00001368] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+/* [0x00001370] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+/* [0x00001378] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+/* [0x00001380] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+/* [0x00001388] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+/* [0x00001390] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+/* [0x00001398] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+/* [0x000013a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+/* [0x000013a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+/* [0x000013b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+/* [0x000013b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+/* [0x000013c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+/* [0x000013c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+/* [0x000013d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+/* [0x000013d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+/* [0x000013e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+/* [0x000013e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+/* [0x000013f0] */ 0x0f9ce3c0, 0xd0020827, // asr r0, r1, 14 -+/* [0x000013f8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+/* [0x00001400] */ 0x405b8006, 0xd00049e0, // nop ; mul24 r0, r0 << 8, ra22 << 8 -+/* [0x00001408] */ 0x0c4a7380, 0x10020867, // add r1, r1, ra18 -+/* [0x00001410] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+/* [0x00001418] */ 0xfffffe20, 0xf06809e7, // brr.anyn -, r:yloopb -+/* [0x00001420] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+/* [0x00001428] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+/* [0x00001430] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+/* [0x00001438] */ 0xfffff928, 0xf0f809e7, // brr -, r:per_block_setup -+/* [0x00001440] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+/* [0x00001448] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+/* [0x00001450] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif - // ::mc_interrupt_exit12 --/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait --/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 --/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) --/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend --/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop --/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+/* [0x00001458] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x00001460] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001468] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001470] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00001478] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00001480] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001488] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001490] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x00001498] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+/* [0x000014d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x000014e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x000014e8] */ 0x009e7000, 0x100009e7, // nop ; nop -+// ::mc_exit1 -+/* [0x000014f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+/* [0x000014f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001500] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00001508] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+/* [0x00001510] */ 0x009e7000, 0xb00009e7, // ldtmu1 -+/* [0x00001518] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+/* [0x00001520] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+/* [0x00001528] */ 0x009e7000, 0x100009e7, // nop ; nop - // ::mc_end - }; - #ifdef __HIGHC__ -diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -index 6e552d9..760bd17 100644 ---- a/libavcodec/rpi_shader.h -+++ b/libavcodec/rpi_shader.h -@@ -4,15 +4,16 @@ - extern unsigned int rpi_shader[]; - - #define mc_setup_uv (rpi_shader + 0) --#define mc_filter_uv (rpi_shader + 144) --#define mc_filter_uv_b0 (rpi_shader + 334) --#define mc_filter_uv_b (rpi_shader + 486) --#define mc_exit (rpi_shader + 662) --#define mc_interrupt_exit8 (rpi_shader + 680) --#define mc_setup (rpi_shader + 710) --#define mc_filter (rpi_shader + 864) --#define mc_filter_b (rpi_shader + 1104) --#define mc_interrupt_exit12 (rpi_shader + 1360) --#define mc_end (rpi_shader + 1398) -+#define mc_filter_uv (rpi_shader + 130) -+#define mc_filter_uv_b0 (rpi_shader + 312) -+#define mc_filter_uv_b (rpi_shader + 464) -+#define mc_exit (rpi_shader + 640) -+#define mc_interrupt_exit8 (rpi_shader + 658) -+#define mc_setup (rpi_shader + 688) -+#define mc_filter (rpi_shader + 1048) -+#define mc_filter_b (rpi_shader + 1174) -+#define mc_interrupt_exit12 (rpi_shader + 1302) -+#define mc_exit1 (rpi_shader + 1340) -+#define mc_end (rpi_shader + 1356) - - #endif -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index a0b8e5a..60d1ec2 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -21,6 +21,7 @@ - # - # ra16 clipped(row start address+elem_num)&~3 - # ra17 per-channel shifts -+# ra18 0x4000 - # ra19 next ra17 - # - # rb16 pitch -@@ -86,7 +87,7 @@ - - - ################################################################################ --# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, offset, denom, vpm_id) - ::mc_setup_uv - - # Read starting kernel -@@ -132,36 +133,6 @@ mov ra13, 0 - mov ra14, 0 - mov ra15, 0 - --# Compute part of VPM to use for DMA output --mov r3, unif --shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) --and r2, r2, 15 --mov r1, r2 --asr r1, r1, 2 --shl r1, r1, 6 --mov r0, r2 --and r0, r0, 3 --add r0, r0, r1 --mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later --shl r0, r0, 5 --add rb27, r0, r1 -- --# Compute part of VPM to save data into --shl r2, r3, 1 --and r2, r2, 15 # r2 = bcd0 --mov r1, r2 # r1 = bcd0 --asr r1, r1, 2 # r1 = bc --shl r1, r1, 6 # r1 = bc000000 --mov r0, r2 # r0 = bcd0 --and r0, r0, 3 # r0 = d0 --add r0, r0, r1 # r0 = bc0000d0 --mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit --add rb28, r0, r1 --asr r0, r0, 1 # r0 = bc0000d --# Prepare VPM command for 16bit intermediates --mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit --add rb21, r0, r1 -- - # Compute base address for first and second access - mov r0, ra_x # Load x - max r0, r0, 0; mov r1, ra_y # Load y -@@ -175,10 +146,31 @@ min r1, r1, rb_frame_height_minus_1 - # submit texture requests for first line - add r2, r2, r0 ; mul24 r1, r1, rb_pitch - add t0s, r0, r1 ; mov ra_frame_base, r2 --add t0s, r2, r1 -+add t1s, r2, r1 -+ -+mov r2,8 -+shl rb12,unif, r2 # offset before shift -+add rb13,unif,r2 # offset after shift -+ -+# Compute part of VPM to use for DMA output -+mov r2, unif -+shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+and r2, r2, 15 -+mov r1, r2 -+asr r1, r1, 2 -+shl r1, r1, 6 -+mov r0, r2 -+and r0, r0, 3 -+add r0, r0, r1 - --mov rb12,unif # offset before shift --mov rb13,unif # offset after shift -+mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+add rb28, r0, r1 # VPM 8bit storage -+asr r2, r0, 1 # r0 = bc0000d -+mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -+add rb21, r2, r1 # VPM for 16bit intermediates -+mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+shl r0, r0, 5 -+add rb27, r0, r1 # DMA out - - # submit texture requests for second line - max r1, ra_y, 0 -@@ -187,7 +179,7 @@ add ra_y, ra_y, 1 - bra -, ra31 - nop ; mul24 r1, r1, rb_pitch - add t0s, r1, ra_x --add t0s, r1, ra_frame_base -+add t1s, r1, ra_frame_base - - - -@@ -248,17 +240,15 @@ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - mov r0, unif # U offset/weight - asr rb15, r0, r2 # Compute offset from MSBs - shl r0, r0, r2 --asr rb14, r0, r2 # Compute weight from LSBs -+asr r3, r0, r2 # Compute weight from LSBs - mov r0, unif # V offset/weight - asr.ifnz rb15, r0, r2 - shl r0, r0, r2 --asr.ifnz rb14, r0, r2 -+asr.ifnz r3, r0, r2 -+shl rb14,r3,8 # Scale up weights so we can use mul24 in signed fashion - - # r2 is elem_num - # r3 is loop counter -- --mov r5rep, -8 -- - # retrieve texture results and pick out bytes - # then submit two more texture requests - -@@ -269,7 +259,7 @@ mov r3, 0 - # then submit two more texture requests - - sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 - mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch - shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -@@ -278,7 +268,7 @@ max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 - add ra_y, ra_y, 1 ; mul24 r2, r2, r3 - add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --add t0s, ra_frame_base, r2 -+add t1s, ra_frame_base, r2 - - # generate seven shifted versions - # interleave with scroll of vertical context -@@ -301,11 +291,6 @@ mov ra13, ra14 # Delay slot 1 - mov ra14, ra15 # Delay slot 2 - mov ra15, r0 # Delay slot 3 - --mov rb12,32 # TODO remove these to make P weighted prediction work properly --mov rb13,6 --mov rb14,1 --mov rb15,0 -- - # apply vertical filter and write to VPM - - nop ; mul24 r1, ra14, rb10 -@@ -412,7 +397,7 @@ mov r3, 0 - # then submit two more texture requests - - sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 - mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch - shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -@@ -421,7 +406,7 @@ max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 - add ra_y, ra_y, 1 ; mul24 r2, r2, r3 - add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --add t0s, ra_frame_base, r2 -+add t1s, ra_frame_base, r2 - - # generate seven shifted versions - # interleave with scroll of vertical context -@@ -542,7 +527,7 @@ mov r3, 0 - # then submit two more texture requests - - sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment --shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 - mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 - mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch - shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -@@ -551,7 +536,7 @@ max r2, ra_y, 0 # y - min r2, r2, rb_frame_height_minus_1 - add ra_y, ra_y, 1 ; mul24 r2, r2, r3 - add t0s, ra_x, r2 ; v8subs r1, r1, rb20 --add t0s, ra_frame_base, r2 -+add t1s, ra_frame_base, r2 - - # generate seven shifted versions - # interleave with scroll of vertical context -@@ -617,9 +602,9 @@ mov -, vw_wait # wait on the VDW - mov -,srel(0) - - ldtmu0 -+ldtmu1 - ldtmu0 --ldtmu0 --ldtmu0 -+ldtmu1 - - nop ; nop ; thrend - nop ; nop # delay slot 1 -@@ -630,9 +615,9 @@ nop ; nop # delay slot 2 - mov -, vw_wait # wait on the VDW - - ldtmu0 -+ldtmu1 - ldtmu0 --ldtmu0 --ldtmu0 -+ldtmu1 - - mov -,sacq(0) # 1 - mov -,sacq(0) # 2 -@@ -656,200 +641,249 @@ nop ; nop # delay slot 2 - # For P frames we make the second x,y coordinates offset by +8 - - ################################################################################ --# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) -+# mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) - ::mc_setup -+ mov r3, 16 - --# Read starting kernel --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --mov ra31, unif -- --# Compute base address for first and second access --add r0, unif, elem_num # Load x --max r0, r0, 0; mov r1, unif # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base --shl ra_xshift_next, r0, 3 # Compute shifts --add ra_y, r1, 1 --and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate --add r2, r2, r0 # r2 is address for frame0 (not including y offset) --max r1, r1, 0 --min r1, r1, rb_frame_height_minus_1 --nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 --add t0s, r2, r1 ; mov ra_frame_base, r2 -- --add r0, unif, elem_num # Load x --max r0, r0, 0; mov r1, unif # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base --shl rx_xshift2_next, r0, 3 # Compute shifts --add ra_y2, r1, 1 --and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate --add r2, r2, r0 # r2 is address for frame1 (not including y offset) --max r1, r1, 0 --min r1, r1, rb_frame_height_minus_1 --nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 --add t0s, r2, r1 ; mov ra_frame_base2, r2 -- -+ # Need to save these because we need to know the frame dimensions before computing texture coordinates -+ mov ra8, unif -+ mov ra9, unif -+ mov ra10, unif -+ mov ra11, unif - - # Read image dimensions --sub rb25,unif,1 --sub rb30,unif,1 -+ mov r1, unif # width_height -+ shl r0,r1,r3 -+ asr r1,r1,r3 # width -+ asr r0,r0,r3 # height -+ sub rb_frame_width_minus_1,r1,1 -+ sub rb_frame_height_minus_1,r0,1 - - # get source pitch --mov rb16, unif -+ mov rb_pitch, unif - - # get destination pitch --mov r0, unif --mov r1, vdw_setup_1(0) --add rb24, r1, r0 -+ mov r0, unif -+ mov r1, vdw_setup_1(0) -+ add rb24, r1, r0 - --# load constants -- --mov ra20, 1 --mov ra22, 256 --mov ra30, 64 -- --mov rb20, 0xffffff00 --mov rb22, 255 --mov rb23, 24 -+# Compute base address for first and second access -+ mov r1, ra8 # y_x -+ shl r0,r1,r3 # r0 is x<<16 -+ asr r1,r1,r3 # r1 is y -+ asr r0,r0,r3 # r0 is x -+ add r0, r0, elem_num # Load x -+ max r0, r0, 0 -+ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 # Load the frame base -+ shl ra_xshift_next, r0, 3 # Compute shifts -+ add ra_y, r1, 1 -+ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+ add r2, r2, r0 # r2 is address for frame0 (not including y offset) -+ max r1, r1, 0 -+ min r1, r1, rb_frame_height_minus_1 -+ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+ add t0s, r2, r1 ; mov ra_frame_base, r2 -+ -+ mov r1, ra10 # y_x -+ shl r0,r1,r3 # r0 is x<<16 -+ asr r1,r1,r3 # r1 is y -+ asr r0,r0,r3 # r0 is x -+ add r0, r0, elem_num # Load x -+ max r0, r0, 0 -+ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 # Load the frame base -+ shl rx_xshift2_next, r0, 3 # Compute shifts -+ add ra_y2, r1, 1 -+ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+ add r2, r2, r0 # r2 is address for frame1 (not including y offset) -+ max r1, r1, 0 -+ min r1, r1, rb_frame_height_minus_1 -+ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+ add t1s, r2, r1 ; mov ra_frame_base2, r2 - --# touch vertical context to keep simulator happy - --mov ra8, 0 --mov ra9, 0 --mov ra10, 0 --mov ra11, 0 --mov ra12, 0 --mov ra13, 0 --mov ra14, 0 --mov ra15, 0 -+# load constants - --# Compute part of VPM to use for DMA output --mov r2, qpu_num --mov r1, r2 --asr r1, r1, 2 --shl r1, r1, 6 --mov r0, r2 --and r0, r0, 3 --add r0, r0, r1 --mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later --shl r0, r0, 5 --add rb27, r0, r1 -+ mov ra20, 1 -+ mov ra22, 256 -+ mov ra30, 64 - --# Compute part of VPM to save data into --mov r2, qpu_num # qpu_num = abcd --mov r1, r2 --asr r1, r1, 2 --shl r1, r1, 6 --mov r0, r2 --and r0, r0, 3 --add r0, r0, r1 --mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit --add rb28, r0, r1 -+ mov rb20, 0xffffff00 -+ mov rb22, 255 -+ mov rb23, 24 - --mov rb12,unif # offset before shift --mov rb13,unif # shift -+# touch vertical context to keep simulator happy - --# Dump padding words --mov r0, unif -+ mov ra8, 0 -+ mov ra9, 0 -+ mov ra10, 0 -+ mov ra11, 0 -+ mov ra12, 0 -+ mov ra13, 0 -+ mov ra14, 0 -+ mov ra15, 0 -+ mov ra18, 0x4000 -+ -+# Compute part of VPM to use -+ mov r2, qpu_num -+ mov r1, r2 -+ asr r1, r1, 2 -+ shl r1, r1, 6 -+ mov r0, r2 -+ and r0, r0, 3 -+ add r0, r0, r1 -+ mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+ add rb28, r0, r1 # VPM for saving data -+ mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+ shl r0, r0, 5 -+ add rb27, r0, r1 # Command for dma output -+ -+# Weighted prediction denom -+ -+ mov r1, unif # offset_shift -+ shl r0,r1,r3 ; mov r2,8 -+ asr rb13,r0,r3 # shift -+ asr rb12,r1,r3 # offset -+ add rb13,rb13,r2 # mul24 is unsigned so scale up into high bits -+ shl rb12, rb12, r2 # Account for larger shift - - # submit texture requests for second line --max r1, ra_y, 0 --min r1, r1, rb_frame_height_minus_1 --add ra_y, ra_y, 1 --nop ; mul24 r1, r1, rb_pitch --add t0s, r1, ra_frame_base -- --max r1, ra_y2, 0 --min r1, r1, rb_frame_height_minus_1 --bra -, ra31 --add ra_y2, ra_y2, 1 # Delay 1 --nop ; mul24 r1, r1, rb_pitch # Delay 2 --add t0s, r1, ra_frame_base2 # Delay 3 -- -- --################################################################################ -- --# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) --# In a P block, only the first half of coefficients contain used information. --# At this point we have already issued two pairs of texture requests for the current block --# ra_x, ra_x16_base point to the current coordinates for this block --::mc_filter --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --mov ra31, unif -+ max r1, ra_y, 0 -+ min r1, r1, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 -+ nop ; mul24 r1, r1, rb_pitch -+ add t0s, r1, ra_frame_base -+ -+ max r1, ra_y2, 0 -+ min r1, r1, rb_frame_height_minus_1 -+ add ra_y2, ra_y2, 1 -+ nop ; mul24 r1, r1, rb_pitch -+ add t1s, r1, ra_frame_base2 -+ -+# FALL THROUGHT TO PER-BLOCK SETUP -+ -+# Start of per-block setup code -+# P and B blocks share the same setup code to save on Icache space -+:per_block_setup -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ mov ra31, unif - - # per-channel shifts were calculated on the *previous* invocation -- --mov ra_xshift, ra_xshift_next --mov rx_xshift2, rx_xshift2_next -+ mov ra_xshift, ra_xshift_next -+ mov rx_xshift2, rx_xshift2_next - - # get base addresses and per-channel shifts for *next* invocation --add r0, unif, elem_num # Load x --max r0, r0, 0; mov r1, unif # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base --shl ra_xshift_next, r0, 3 # Compute shifts --mov ra_y_next, r1 --and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate --add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -- --add r0, unif, elem_num # Load x --max r0, r0, 0 ; mov r1, unif # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base --shl rx_xshift2_next, r0, 3 # Compute shifts --add ra_y2_next, r1, 1 --and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate --add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -- -+ mov r3, 16 -+ mov r1, unif # y_x -+ shl r0,r1,r3 # r0 is x<<16 -+ asr r1,r1,r3 # r1 is y -+ asr r0,r0,r3 # r0 is x -+ add r0, r0, elem_num # Load x -+ max r0, r0, 0 -+ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+ shl ra_xshift_next, r0, 3 # Compute shifts -+ mov ra_y_next, r1 -+ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+ add ra_frame_base_next, r2, r0 ; mov r1, unif # y2_x2 -+ -+ shl r0,r1,r3 # r0 is x2<<16 -+ asr r1,r1,r3 # r1 is y2 -+ asr r0,r0,r3 # r0 is x2 -+ add r0, r0, elem_num # Load x -+ max r0, r0, 0 -+ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+ shl rx_xshift2_next, r0, 3 # Compute shifts -+ mov ra_y2_next, r1 -+ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+ add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) - - # set up VPM write --mov vw_setup, rb28 -+ mov vw_setup, rb28 - - # get width,height of block --mov r2, 16 --mov r0, unif --shr r1, r0, r2 # Extract width --sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) --and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 --shl r0, r0, 7 --add r0, r0, r1 # Combine width and height of destination area --shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register --add rb26, r0, rb27 -+ mov r0, unif -+ shr r1, r0, r3 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+ add rb17, r0, 5 -+ add rb18, r0, 7 -+ shl r0, r0, 7 -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r3 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 - - # get filter coefficients and discard unused B frame values --mov r0, unif --mov.ifnz -, unif # Alternate coefficients are unused for P frames --asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly --asr ra2, r0, rb23; mul24 r0, r0, ra22 --asr ra1, r0, rb23; mul24 r0, r0, ra22 --asr ra0, r0, rb23; mov r0, unif --mov.ifnz -, unif --asr ra7, r0, rb23; mul24 r0, r0, ra22 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --asr ra4, r0, rb23; mov r0, unif --mov.ifnz -, unif --asr rb11, r0, rb23; mul24 r0, r0, ra22 --asr rb10, r0, rb23; mul24 r0, r0, ra22 --asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif --mov.ifnz -, unif --asr rb7, r0, rb23; mul24 r0, r0, ra22 --asr rb6, r0, rb23; mul24 r0, r0, ra22 --asr rb5, r0, rb23; mul24 r0, r0, ra22 --asr rb4, r0, rb23 -- --mov r0, unif # Frame0 offset/weight --mov.ifnz -, unif # Frame1 offset/weight unused --asr rb15, r0, r2 # Compute offset from MSBs --shl r0, r0, r2 --asr rb14, r0, r2 # Compute weight from LSBs -- --# r3 is loop counter -+ mov r0, unif ; mov r1,1 # Packed filter offsets, unpack into ra8... (to be used for vertical context later) -+ asr ra9, r0, rb23; mul24 r0, r0, ra22 # my2 -+ asr ra8, r0, rb23; mul24 r0, r0, ra22 # mx2 -+ asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 # my:my2 -+ asr.ifz ra8, r0, rb23 # mx:mx2 -+ sub ra9,3,ra9 -+ sub ra8,3,ra8 -+ shl ra9,ra9,3 # Scale up by 8 -+ shl ra8,ra8,3 # Scale up by 8 -+# Now if we want aligned we have a mul of 1, so put 0 coefficients at the top -+ mov r1,0xffff00 -+ shl r0, r1, ra8 -+ asr ra0, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb4, r0, rb23 -+ -+ mov r1,0x1040400 -+ shl r0, r1, ra8 -+ asr ra1, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb5, r0, rb23 -+ -+ mov r1,0xfbf5f600 -+ shl r0, r1, ra8 -+ asr ra2, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb6, r0, rb23 -+ -+ mov r1,0x11283a40 -+ shl r0, r1, ra8 -+ asr ra3, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb7, r0, rb23 -+ -+ mov r1,0x3a281100 -+ shl r0, r1, ra8 -+ asr ra4, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb8, r0, rb23 -+ -+ mov r1,0xf6f5fb00 -+ shl r0, r1, ra8 -+ asr ra5, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb9, r0, rb23 -+ -+ mov r1,0x4040100 -+ shl r0, r1, ra8 -+ asr ra6, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb10, r0, rb23 -+ -+ mov r1,0xffff0000 -+ shl r0, r1, ra8 -+ asr ra7, r0, rb23 -+ shl r0, r1, ra9 -+ asr rb11, r0, rb23 -+ -+# Extract weighted prediction information -+ mov r0, unif # offset/weight TODO move up -+ asr rb15, r0, r3 # Compute offset from MSBs -+ bra -, ra31 -+ shl r0, r0, r3 # Delay 1 -+ asr r0, r0, r3 ; mov r3, 0 # Compute weight from LSBs and reset loop counter Delay 2 -+ shl rb14, r0, 8 # Use a larger shift to avoid unsigned multiply problem Delay 3 - --# retrieve texture results and pick out bytes --# then submit two more texture requests -+################################################################################ -+# mc_filter(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -+# In a P block, y2_x2 should be y_x+8 -+# At this point we have already issued two pairs of texture requests for the current block - --mov r3, 0 -+::mc_filter - - :yloop - # retrieve texture results and pick out bytes -@@ -858,91 +892,90 @@ mov r3, 0 - # If we knew there was no clipping then this code would get simpler. - # Perhaps we could add on the pitch and clip using larger values? - --sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 --mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --shr r1, r4, rx_xshift2 --mov.ifz ra_y2, ra_y2_next -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, rx_xshift2 -+ mov.ifz ra_y2, ra_y2_next - --max r2, ra_y, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -- --max r2, ra_y2, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 --add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte - -+ max r2, ra_y2, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 - - # generate seven shifted versions - # interleave with scroll of vertical context - --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - - # apply horizontal filter --nop ; mul24 r2, r0, ra0 --nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --nop ; mul24 r3, ra1 << 1, r0 << 1 --nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --add r0, r2, r3 ; mov r3, rb31 --sub.setf -, r3, 8 ; mov ra12, ra13 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 --mov ra12, ra13 --brr.anyn -, r:yloop --mov ra13, ra14 # Delay slot 1 --mov ra14, ra15 # Delay slot 2 --mov ra15, r0 # Delay slot 3 -+ nop ; mul24 r2, r0, ra0 -+ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 ; mov r3, rb31 -+ sub.setf -, r3, 8 ; mov ra8, ra9 -+ mov ra9, ra10 -+ mov ra10, ra11 -+ mov ra11, ra12 -+ mov ra12, ra13 -+ brr.anyn -, r:yloop -+ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 - - # apply vertical filter and write to VPM - --nop ; mul24 r1, ra14, rb10 --nop ; mul24 r0, ra13, rb9 --add r1, r1, r0 ; mul24 r0, ra12, rb8 --add r1, r1, r0 ; mul24 r0, ra15, rb11 --add r1, r1, r0 ; mul24 r0, ra8, rb4 --add r1, r1, r0 ; mul24 r0, ra9, rb5 --add r1, r1, r0 ; mul24 r0, ra10, rb6 --add r1, r1, r0 ; mul24 r0, ra11, rb7 -- --add r1, r1, r0 ; mov -, vw_wait --sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 14 --nop ; mul24 r1, r1, rb14 --add r1, r1, rb12 --asr r1, r1, rb13 --brr.anyn -, r:yloop --add r1, r1, rb15 # Delay 1 --min r1, r1, rb22 # Delay 2 --max vpm, r1, 0 # Delay 3 -+ nop ; mul24 r1, ra14, rb10 -+ nop ; mul24 r0, ra13, rb9 -+ add r1, r1, r0 ; mul24 r0, ra12, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mul24 r0, ra8, rb4 -+ add r1, r1, r0 ; mul24 r0, ra9, rb5 -+ add r1, r1, r0 ; mul24 r0, ra10, rb6 -+ add r1, r1, r0 ; mul24 r0, ra11, rb7 -+ -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 -+ nop ; mul24 r1, r1, rb14 -+ add r1, r1, rb12 -+ asr r1, r1, rb13 -+ brr.anyn -, r:yloop -+ add r1, r1, rb15 # Delay 1 -+ min r1, r1, rb22 # Delay 2 -+ max vpm, r1, 0 # Delay 3 - - # DMA out - --bra -, ra31 --mov vw_setup, rb26 # VDW setup 0 Delay 1 --mov vw_setup, rb29 # Stride Delay 2 --mov vw_addr, unif # start the VDW Delay 3 -+ brr -, r:per_block_setup -+ mov vw_setup, rb26 # VDW setup 0 Delay 1 -+ mov vw_setup, rb29 # Stride Delay 2 -+ mov vw_addr, unif # start the VDW Delay 3 - - - - ################################################################################ - --# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -+# mc_filter_b(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) - # In a P block, only the first half of coefficients contain used information. - # At this point we have already issued two pairs of texture requests for the current block - # May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) -@@ -952,92 +985,6 @@ mov vw_addr, unif # start the VDW Delay 3 - # Or possibly by taking advantage of symmetry? - # From 19->7 32bits per command. - ::mc_filter_b --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] --mov ra31, unif -- --# per-channel shifts were calculated on the *previous* invocation -- --mov ra_xshift, ra_xshift_next --mov rx_xshift2, rx_xshift2_next -- --# get base addresses and per-channel shifts for *next* invocation --add r0, unif, elem_num # Load x --max r0, r0, 0; mov r1, unif # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base --shl ra_xshift_next, r0, 3 # Compute shifts --mov ra_y_next, r1 --and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate --add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -- --add r0, unif, elem_num # Load x --max r0, r0, 0 ; mov r1, unif # Load y --min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base --shl rx_xshift2_next, r0, 3 # Compute shifts --add ra_y2_next, r1, 1 --and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate --add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -- -- --# set up VPM write --mov vw_setup, rb28 -- --# get width,height of block --mov r2, 16 --mov r0, unif --shr r1, r0, r2 # Extract width --sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) --and r0, r0, rb22 # Extract height --add rb17, r0, 5 --add rb18, r0, 7 --shl r0, r0, 7 --add r0, r0, r1 # Combine width and height of destination area --shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register --add rb26, r0, rb27 -- --# get filter coefficients and discard unused B frame values --mov r0, unif --mov r1, 1 --mov.ifnz r0, unif # Alternate coefficients are unused for P frames --nop ; mul24 r0, r0 << 13, r1 << 13 --asr ra3, r0, rb23; mul24 r0, r0, ra22 --nop ; mul24 r0, r0 << 14, r1 << 14 --asr ra2, r0, rb23; mul24 r0, r0, ra22 --nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right --asr ra1, r0, rb23; mul24 r0, r0, ra22 --asr ra0, r0, rb23; mov r0, unif --mov.ifnz r0, unif --nop ; mul24 r0, r0 << 9, r1 << 9 --asr ra7, r0, rb23; mul24 r0, r0, ra22 --nop ; mul24 r0, r0 << 10, r1 << 10 --asr ra6, r0, rb23; mul24 r0, r0, ra22 --nop ; mul24 r0, r0 << 11, r1 << 11 --asr ra5, r0, rb23; mul24 r0, r0, ra22 --nop ; mul24 r0, r0 << 12, r1 << 12 --asr ra4, r0, rb23; mov r0, unif --mov.ifnz r0, unif --asr rb11, r0, rb23; mul24 r0, r0, ra22 --asr rb10, r0, rb23; mul24 r0, r0, ra22 --asr rb9, r0, rb23; mul24 r0, r0, ra22 --asr rb8, r0, rb23; mov r0, unif --mov.ifnz r0, unif --asr rb7, r0, rb23; mul24 r0, r0, ra22 --asr rb6, r0, rb23; mul24 r0, r0, ra22 --asr rb5, r0, rb23; mul24 r0, r0, ra22 --asr rb4, r0, rb23 -- --mov r0, unif # Frame0 offset/weight --mov.ifnz r0, unif # Frame1 offset/weight unused --asr rb15, r0, r2 # Compute offset from MSBs --shl r0, r0, r2 --asr rb14, r0, r2 # Compute weight from LSBs -- --# r3 is loop counter -- --# retrieve texture results and pick out bytes --# then submit two more texture requests -- --mov r3, 0 -- - :yloopb - # retrieve texture results and pick out bytes - # then submit two more texture requests -@@ -1045,111 +992,123 @@ mov r3, 0 - # If we knew there was no clipping then this code would get simpler. - # Perhaps we could add on the pitch and clip using larger values? - --sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 --shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 --mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 --mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch --shr r1, r4, rx_xshift2 --mov.ifz ra_y2, ra_y2_next -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, rx_xshift2 -+ mov.ifz ra_y2, ra_y2_next - --max r2, ra_y, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y, ra_y, 1 ; mul24 r2, r2, r3 --add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -- --max r2, ra_y2, 0 # y --min r2, r2, rb_frame_height_minus_1 --add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 --add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte - -+ max r2, ra_y2, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 - - # generate seven shifted versions - # interleave with scroll of vertical context - --mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] - - # apply horizontal filter --nop ; mul24 r2, r0, ra0 --nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 --nop ; mul24 r3, ra1 << 1, r0 << 1 --nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 --add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 --nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 --add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 --nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 --add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 --nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 --add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 --nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 --add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 --nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 --add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 --nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 --add r0, r2, r3 ; mov r3, rb31 --sub.setf -, r3, 8 ; mov ra12, ra13 --mov ra9, ra10 --mov ra10, ra11 --mov ra11, ra12 --mov ra12, ra13 --brr.anyn -, r:yloopb --mov ra13, ra14 # Delay slot 1 --mov ra14, ra15 # Delay slot 2 --mov ra15, r0 # Delay slot 3 -- --# apply vertical filter and write to VPM -- --nop ; mul24 r1, ra14, rb10 --nop ; mul24 r0, ra13, rb9 --add r1, r1, r0 ; mul24 r0, ra12, rb8 --add r1, r1, r0 ; mul24 r0, ra15, rb11 --add r1, r1, r0 ; mul24 r0, ra8, rb4 --add r1, r1, r0 ; mul24 r0, ra9, rb5 --add r1, r1, r0 ; mul24 r0, ra10, rb6 --add r1, r1, r0 ; mul24 r0, ra11, rb7 -- --add r1, r1, r0 ; mov -, vw_wait --sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 --asr r1, r1, 14 --nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves --add r1, r1, ra30 ; mul24 r0, r1, rb14 --add r1, r1, r0 --brr.anyn -, r:yloopb --asr r1, r1, 7 # Delay 1 --min r1, r1, rb22 # Delay 2 --max vpm, r1, 0 # Delay 3 -+ nop ; mul24 r2, r0, ra0 -+ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 ; mov r3, rb31 -+ sub.setf -, r3, 8 ; mov ra8, ra9 -+ mov ra9, ra10 -+ mov ra10, ra11 -+ mov ra11, ra12 -+ mov ra12, ra13 -+ brr.anyn -, r:yloopb -+ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+ nop ; mul24 r1, ra14, rb10 -+ nop ; mul24 r0, ra13, rb9 -+ add r1, r1, r0 ; mul24 r0, ra12, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mul24 r0, ra8, rb4 -+ add r1, r1, r0 ; mul24 r0, ra9, rb5 -+ add r1, r1, r0 ; mul24 r0, ra10, rb6 -+ add r1, r1, r0 ; mul24 r0, ra11, rb7 -+ -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r0, r1, 14 -+ asr r1, r1, 6 # Wait state so we can use the rotate instruction -+ nop ; mul24 r0, r0 << 8, ra22 << 8 # Rotate to align left and right halves -+ add r1, r1, ra18 -+ add r1, r1, r0 -+ brr.anyn -, r:yloopb -+ asr r1, r1, 15 # Delay 1 -+ min r1, r1, rb22 # Delay 2 -+ max vpm, r1, 0 # Delay 3 - - # DMA out --bra -, ra31 --mov vw_setup, rb26 # VDW setup 0 Delay 1 --mov vw_setup, rb29 # Stride Delay 2 --mov vw_addr, unif # start the VDW Delay 3 -+ brr -, r:per_block_setup -+ mov vw_setup, rb26 # VDW setup 0 Delay 1 -+ mov vw_setup, rb29 # Stride Delay 2 -+ mov vw_addr, unif # start the VDW Delay 3 - - ################################################################################ - - # mc_interrupt_exit12() - ::mc_interrupt_exit12 --mov -, vw_wait # wait on the VDW -- --ldtmu0 --ldtmu0 --ldtmu0 --ldtmu0 -- --mov -,sacq(0) # 1 --mov -,sacq(0) # 2 --mov -,sacq(0) # 3 --mov -,sacq(0) # 4 --mov -,sacq(0) # 5 --mov -,sacq(0) # 6 --mov -,sacq(0) # 7 --mov -,sacq(0) # 8 --mov -,sacq(0) # 9 --mov -,sacq(0) # 10 --mov -,sacq(0) # 11 -- --nop ; nop ; thrend --mov interrupt, 1; nop # delay slot 1 --nop ; nop # delay slot 2 -+ mov -, vw_wait # wait on the VDW -+ -+ ldtmu0 -+ ldtmu0 -+ ldtmu1 -+ ldtmu1 -+ -+ mov -,sacq(0) # 1 -+ mov -,sacq(0) # 2 -+ mov -,sacq(0) # 3 -+ mov -,sacq(0) # 4 -+ mov -,sacq(0) # 5 -+ mov -,sacq(0) # 6 -+ mov -,sacq(0) # 7 -+ mov -,sacq(0) # 8 -+ mov -,sacq(0) # 9 -+ mov -,sacq(0) # 10 -+ mov -,sacq(0) # 11 -+ -+ nop ; nop ; thrend -+ mov interrupt, 1; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -+ -+::mc_exit1 -+ mov -, vw_wait # wait on the VDW -+ -+ ldtmu0 -+ ldtmu1 -+ ldtmu0 -+ ldtmu1 -+ nop ; nop ; thrend -+ mov interrupt, 1; nop # delay slot 1 -+ nop ; nop # delay slot 2 - - - ::mc_end --- -2.7.4 - - -From f02ec34c772aad3caa17432c6a4860f9ed0d5dc6 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 2 Jun 2015 10:58:25 +0100 -Subject: [PATCH 48/68] Added option to simulate QPUs - ---- - libavcodec/hevc.c | 288 +++++++++++++++++++++++++++++++++++++++++++-- - libavcodec/rpi_qpu.c | 24 ++-- - libavcodec/rpi_shader.qasm | 6 +- - 3 files changed, 295 insertions(+), 23 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 2da88ec..34d92e2 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -56,6 +56,8 @@ - // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory - // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. - -+ // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs -+ //#define RPI_SIMULATE_QPUS - - #endif - -@@ -124,7 +126,6 @@ static void pic_arrays_free(HEVCContext *s) - - #ifdef EARLY_MALLOC - #else -- printf("pic_arrays_free\n"); - if (s->coeffs_buf_arm[0]) { - gpu_free(&s->coeffs_buf_default); - s->coeffs_buf_arm[0] = 0; -@@ -174,11 +175,9 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - #ifdef RPI - #ifdef EARLY_MALLOC - #else -- assert(sps); -+ av_assert0(sps); - int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); - int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -- printf("pic_arrays_init\n"); -- printf("Allocated %d\n",coefs_per_row); - gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); - s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; - if (!s->coeffs_buf_arm[0]) -@@ -2988,6 +2987,274 @@ static void rpi_inter_clear(HEVCContext *s) - #endif - } - -+ -+#ifdef RPI_SIMULATE_QPUS -+ -+static int32_t clipx(int x,int FRAME_WIDTH) -+{ -+ if (x<=0) return 0; -+ if (x>=FRAME_WIDTH) return FRAME_WIDTH-1; -+ return x; -+} -+ -+static int32_t clipy(int y,int FRAME_HEIGHT) -+{ -+ if (y<=0) return 0; -+ if (y>=FRAME_HEIGHT) return FRAME_HEIGHT-1; -+ return y; -+} -+ -+/*static int32_t filter8(uint8_t *data, int x0, int y0, int pitch, int mx, int my,int round,int denom,int weight,int offset) -+{ -+ int32_t vsum = 0; -+ int x, y; -+ -+ for (y = 0; y < 8; y++) { -+ int32_t hsum = 0; -+ -+ for (x = 0; x < 8; x++) -+ hsum += lumaFilter[mx][x]*data[clipx(x + x0) + clipy(y + y0) * pitch]; -+ -+ vsum += lumaFilter[my][y]*hsum; -+ } -+ vsum >>= 6; -+ vsum = (((vsum*weight)+round)>>denom)+offset; -+ -+ return av_clip_uint8( vsum ); -+}*/ -+ -+static int32_t filter8_chroma(uint8_t *data, int x0, int y0, int pitch, int hcoeffs, int vcoeffs,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) -+{ -+ int32_t vsum = 0; -+ int x, y; -+ int chromaFilterH[4]; -+ int chromaFilterV[4]; -+ int i; -+ int offset_after = offset_weight>>16; -+ int weight = (offset_weight<<16)>>16; -+ for(i=0;i<4;i++) { -+ chromaFilterH[i] = ((hcoeffs>>(8*i))<<24)>>24; -+ chromaFilterV[i] = ((vcoeffs>>(8*i))<<24)>>24; -+ } -+ -+ for (y = 0; y < 4; y++) { -+ int32_t hsum = 0; -+ -+ for (x = 0; x < 4; x++) -+ hsum += chromaFilterH[x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; -+ -+ vsum += chromaFilterV[y]*hsum; -+ } -+ vsum >>= 6; -+ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; -+ -+ return vsum; -+} -+ -+int lumaFilter[4][8]={ {0,0,0,64,0,0,0,0},{-1,4,-10,58,17,-5,1,0},{-1,4,-11,40,40,-11,4,-1},{0,1,-5,17,58,-10,4,-1} }; -+ -+static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) -+{ -+ int32_t vsum = 0; -+ int x, y; -+ int i; -+ int offset_after = offset_weight>>16; -+ int weight = (offset_weight<<16)>>16; -+ -+ for (y = 0; y < 8; y++) { -+ int32_t hsum = 0; -+ -+ for (x = 0; x < 8; x++) -+ hsum += lumaFilter[my_mx&3][x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; -+ -+ vsum += lumaFilter[(my_mx>>8)&3][y]*hsum; -+ } -+ vsum >>= 6; -+ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; -+ -+ return vsum; -+} -+ -+static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) -+{ -+ //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; -+ int pitch = frame->linesize[cIdx]; -+ uint32_t base = get_vc_address(frame->buf[cIdx]); -+ if (p>=base && pdata[cIdx] + (p-base); -+ } -+ return NULL; -+} -+ -+static uint8_t *compute_arm_addr(HEVCContext *s,uint32_t p, int cIdx) -+{ -+ SliceHeader *sh = &s->sh; -+ uint8_t *arm = test_frame(s,p,s->frame,cIdx); -+ int i; -+ if (arm) return arm; -+ if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) -+ { -+ for(i=0;inb_refs[L0];i++) { -+ arm = test_frame(s,p,s->ref->refPicList[0].ref[i]->frame,cIdx); -+ if (arm) return arm; -+ } -+ } -+ if (sh->slice_type == B_SLICE) { -+ for(i=0;inb_refs[L1];i++) { -+ arm = test_frame(s,p,s->ref->refPicList[1].ref[i]->frame,cIdx); -+ if (arm) return arm; -+ } -+ } -+ printf("Frame 0x%x not found! Exit=%x\n",p,qpu_get_fn(QPU_MC_EXIT)); -+ exit(-1); -+ return NULL; -+} -+ -+static void rpi_simulate_inter_chroma(HEVCContext *s,uint32_t *p) -+{ -+ uint32_t next_kernel; -+ uint32_t x0; -+ uint32_t y0; -+ uint8_t *ref_u_base; -+ uint8_t *ref_v_base; -+ uint32_t frame_width = p[5]; -+ uint32_t frame_height = p[6]; -+ uint32_t pitch = p[7]; -+ uint32_t dst_pitch = p[8]; -+ int32_t offset_before = p[9]; -+ int32_t denom = p[10]; -+ uint32_t vpm_id = p[11]; -+ uint32_t tmp_u_dst[256]; -+ uint32_t tmp_v_dst[256]; -+ while(1) { -+ p += 12; -+ next_kernel = p[0-12]; -+ x0 = p[1-12]; -+ y0 = p[2-12]; -+ if (next_kernel==s->mc_filter_uv || next_kernel==s->mc_filter_uv_b0 || next_kernel==s->mc_filter_uv_b) { -+ int x,y; -+ uint32_t width_height = p[5]; -+ uint32_t hcoeffs = p[6]; -+ uint32_t vcoeffs = p[7]; -+ uint32_t offset_weight_u = p[8]; -+ uint32_t offset_weight_v = p[9]; -+ uint8_t *this_u_dst; -+ uint8_t *this_v_dst; -+ uint32_t width = width_height >> 16; -+ uint32_t height = (width_height << 16) >> 16; -+ ref_u_base = compute_arm_addr(s,p[3-12],1); -+ ref_v_base = compute_arm_addr(s,p[4-12],2); -+ if (next_kernel!=s->mc_filter_uv_b0) -+ { -+ this_u_dst = compute_arm_addr(s,p[10],1); -+ this_v_dst = compute_arm_addr(s,p[11],2); -+ } -+ for (y=0; ymc_filter_uv) { -+ int32_t refa = filter8_chroma(ref_u_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_u,offset_before,denom,frame_width,frame_height); -+ int32_t refb = filter8_chroma(ref_v_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_v,offset_before,denom,frame_width,frame_height); -+ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); -+ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); -+ } else if (next_kernel==s->mc_filter_uv_b0) { -+ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); -+ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); -+ tmp_u_dst[x+y*16] = refa; -+ tmp_v_dst[x+y*16] = refb; -+ } else { -+ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_u_dst[x+y*16], 7, frame_width, frame_height); -+ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_v_dst[x+y*16], 7, frame_width, frame_height); -+ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); -+ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); -+ } -+ } -+ } -+ } else { -+ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT8) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); -+ break; -+ } -+ } -+} -+ -+// mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) -+static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p) -+{ -+ uint32_t next_kernel; -+ int y_x,y2_x2; -+ uint32_t x0; -+ uint32_t y0; -+ uint32_t x2; -+ uint32_t y2; -+ uint8_t *ref_y_base; -+ uint8_t *ref_y2_base; -+ uint32_t frame_width_height = p[4]; -+ uint32_t frame_width = frame_width_height>>16; -+ uint32_t frame_height = (frame_width_height<<16)>>16; -+ uint32_t pitch = p[5]; -+ uint32_t dst_pitch = p[6]; -+ int offset_shift = p[7]; -+ int32_t offset_before = offset_shift>>16; -+ int32_t denom = (offset_shift<<16)>>16; -+ while(1) { -+ p += 9; -+ next_kernel = p[8-9]; -+ y_x = p[0-9]; -+ x0 = (y_x<<16)>>16; -+ y0 = y_x>>16; -+ y2_x2 = p[2-9]; -+ x2 = (y2_x2<<16)>>16; -+ y2 = y2_x2>>16; -+ -+ if (next_kernel==s->mc_filter || next_kernel==s->mc_filter_b) { -+ // y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -+ int x,y; -+ uint32_t width_height = p[4]; -+ uint32_t my2_mx2_my_mx = p[5]; -+ uint32_t offset_weight = p[6]; -+ uint8_t *this_dst = compute_arm_addr(s,p[7],0); -+ uint32_t width = width_height >> 16; -+ uint32_t height = (width_height << 16) >> 16; -+ ref_y_base = compute_arm_addr(s,p[1-9],0); -+ ref_y2_base = compute_arm_addr(s,p[3-9],0); -+ for (y=0; ymc_filter) { -+ int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); -+ this_dst[x+y*dst_pitch] = av_clip_uint8(refa); -+ } -+ else { -+ int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); -+ int32_t refb = filter8_luma(ref_y2_base, x+x2, y+y2, pitch, my2_mx2_my_mx>>16, 1, 64 + refa, 7, frame_width, frame_height); -+ this_dst[x+y*dst_pitch] = av_clip_uint8(refb); -+ } -+ } -+ } -+ } else { -+ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT12) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); -+ break; -+ } -+ } -+} -+ -+static void rpi_simulate_inter_qpu(HEVCContext *s) -+{ -+ // First run the transform as normal -+ int i; -+ rpi_execute_transform(s); -+ for(i=0;i<8;i++) -+ { -+ rpi_simulate_inter_chroma(s,s->mvs_base[i]); -+ } -+ for(i=0;i<12;i++) -+ { -+ rpi_simulate_inter_luma(s,s->y_mvs_base[i]); -+ } -+} -+ -+#endif -+ -+ - static void rpi_execute_inter_qpu(HEVCContext *s) - { - int k; -@@ -3006,7 +3273,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined - s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -- assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); - } - - s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -@@ -3016,11 +3283,16 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined - s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request - s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -- assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -+ av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); - } - s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore - #endif - -+#ifdef RPI_SIMULATE_QPUS -+ rpi_simulate_inter_qpu(s); -+ s->vpu_id = -1; -+ return; -+#endif - - #ifdef RPI_MULTI_MAILBOX - #ifdef RPI_CACHE_UNIF_MVS -@@ -3101,7 +3373,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; - #endif - -- /*if (!s->enable_rpi) { -+ if (!s->enable_rpi) { - if (s->ps.pps->cross_component_prediction_enabled_flag) - printf("Cross component\n"); - if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -@@ -3110,7 +3382,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - printf("Weighted P slice\n"); - if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) - printf("Weighted B slice\n"); -- }*/ -+ } - - #endif - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index e12304b..4480f72 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -13,7 +13,7 @@ - #include - #include - #include --#include -+#include "libavutil/avassert.h" - - #include "config.h" - -@@ -160,13 +160,13 @@ static int gpu_init(volatile struct GPU **gpu) { - // Now copy over the QPU code into GPU memory - { - int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); -- assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ av_assert0(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); - memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); - } - // And the VPU code - { - int num_bytes = sizeof(rpi_hevc_transform); -- assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); - memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); - } - // And the transform coefficients -@@ -216,13 +216,13 @@ static void gpu_unlock(void) { - static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { - p->numbytes = numbytes; - p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -- assert(p->vcsm_handle); -+ av_assert0(p->vcsm_handle); - p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -- assert(p->vc_handle); -+ av_assert0(p->vc_handle); - p->arm = vcsm_lock(p->vcsm_handle); -- assert(p->arm); -+ av_assert0(p->arm); - p->vc = mem_lock(mb, p->vc_handle); -- assert(p->vc); -+ av_assert0(p->vc); - return 0; - } - -@@ -243,7 +243,7 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) - - int gpu_get_mailbox(void) - { -- assert(gpu); -+ av_assert0(gpu); - return gpu->mb; - } - -@@ -297,13 +297,13 @@ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { - //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); - //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); - //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); -- assert(p->vcsm_handle); -+ av_assert0(p->vcsm_handle); - p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -- assert(p->vc_handle); -+ av_assert0(p->vc_handle); - p->arm = vcsm_lock(p->vcsm_handle); -- assert(p->arm); -+ av_assert0(p->arm); - p->vc = mem_lock(gpu->mb, p->vc_handle); -- assert(p->vc); -+ av_assert0(p->vc); - return 0; - } - -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 60d1ec2..0686249 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -149,8 +149,8 @@ add t0s, r0, r1 ; mov ra_frame_base, r2 - add t1s, r2, r1 - - mov r2,8 --shl rb12,unif, r2 # offset before shift --add rb13,unif,r2 # offset after shift -+shl rb12,unif,r2 # offset before shift -+add rb13,unif,r2 # denominator - - # Compute part of VPM to use for DMA output - mov r2, unif -@@ -185,7 +185,7 @@ add t1s, r1, ra_frame_base - - ################################################################################ - --# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, width_height, hcoeffs, vcoeffs, offset_weight_u, offset_weight_v, this_u_dst, this_v_dst) - - # At this point we have already issued two pairs of texture requests for the current block - # ra_x, ra_x16_base point to the current coordinates for this block --- -2.7.4 - - -From 8bdf6b06c612ff4971c2ce99a62d093cf92468ca Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 2 Jun 2015 13:17:50 +0100 -Subject: [PATCH 49/68] Increased motion vector memory and fixed block size - computation for non-multiple of 2 block sizes - ---- - libavcodec/hevc.c | 50 +++++++++++++++++++++++++++++++------------------- - 1 file changed, 31 insertions(+), 19 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 34d92e2..3fb1e2a 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -83,11 +83,9 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - - // Split image of 2048 into parts 64 wide - // So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across --// Each block of 64*64 --// Smallest CTU size is 16x16, so smallest block is 8x8 --// Corresponds to a total of 83kbytes over all 12 QPUs -+// For each block of 64*64 the smallest block size is 8x4 - #define RPI_LUMA_COMMAND_WORDS 9 --#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) -+#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) - - #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) - -@@ -2042,11 +2040,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - uint32_t *y = s->y_mvs[chan % 12]; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); - y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); - y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -+ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); - *y++ = my2_mx2_my_mx; - if (weight_flag) { - *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -@@ -2089,12 +2089,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+ int bh = nPbH_c-start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -- *u++ = ( (nPbW_cy_mvs[chan % 12]; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); - y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); - y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -+ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); - *y++ = my2_mx2_my_mx; - if (weight_flag) { - *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -@@ -2189,12 +2193,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+ int bh = nPbH_c-start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -- *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; - *u++ = rpi_filter_coefs[_my][0]; -@@ -2246,11 +2252,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - uint32_t *y = s->y_mvs[chan % 12]; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); - y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); - y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 - y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -- *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); -+ *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); - *y++ = my2_mx2_my_mx; - *y++ = 1; // B frame weighted prediction not supported - *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -@@ -2293,12 +2301,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - uint32_t *u = s->u_mvs[chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+ int bh = nPbH_c-start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -- *u++ = ( (nPbW_cframe->buf[1]); - u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -- *u++ = ( (nPbW_c> 16; - uint32_t height = (width_height << 16) >> 16; -+ uint8_t *dst_base = s->frame->data[0]; - ref_y_base = compute_arm_addr(s,p[1-9],0); - ref_y2_base = compute_arm_addr(s,p[3-9],0); - for (y=0; ymc_filter) { - int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); -- this_dst[x+y*dst_pitch] = av_clip_uint8(refa); -+ refa = av_clip_uint8(refa); -+ this_dst[x+y*dst_pitch] = refa; - } - else { - int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); -@@ -3248,7 +3261,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) - } - for(i=0;i<12;i++) - { -- rpi_simulate_inter_luma(s,s->y_mvs_base[i]); -+ rpi_simulate_inter_luma(s,s->y_mvs_base[i],i); - } - } - -@@ -3290,7 +3303,6 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - - #ifdef RPI_SIMULATE_QPUS - rpi_simulate_inter_qpu(s); -- s->vpu_id = -1; - return; - #endif - --- -2.7.4 - - -From da5ae7e96dd961ccc7bc162c8acf336d54a50092 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 2 Jun 2015 14:36:54 +0100 -Subject: [PATCH 50/68] Added support for skip deblock - ---- - libavcodec/hevc.c | 5 +++++ - libavcodec/hevc.h | 2 ++ - libavcodec/hevc_filter.c | 14 ++++---------- - 3 files changed, 11 insertions(+), 10 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 3fb1e2a..0ac4f4c 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3397,6 +3397,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - } - - #endif -+ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N); - - if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { - av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 5df9dcd..5cb90b5 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -890,6 +890,8 @@ typedef struct HEVCContext { - int width; - int height; - -+ int used_for_ref; -+ - #ifdef RPI - int enable_rpi; - HEVCMvCmd *unif_mv_cmds; -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 11629e4..14a0952 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -512,16 +512,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->ps.pps->transquant_bypass_enable_flag; - - #ifdef DISABLE_DEBLOCK_NONREF -- if ( s->nal_unit_type == NAL_TRAIL_N || -- s->nal_unit_type == NAL_TSA_N || -- s->nal_unit_type == NAL_STSA_N || -- s->nal_unit_type == NAL_RADL_N || -- s->nal_unit_type == NAL_RASL_N ) -+ if (!s->used_for_ref) - return; // Don't deblock non-reference frames - #endif - #ifdef DISABLE_DEBLOCK - return; - #endif -+ if (!s->used_for_ref && s->avctx->skip_loop_filter >= AVDISCARD_NONREF) -+ return; - - if (x0) { - left_tc_offset = s->deblock[ctb - 1].tc_offset; -@@ -885,11 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { - - void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - { -- if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -- s->nal_unit_type == NAL_TSA_N || -- s->nal_unit_type == NAL_STSA_N || -- s->nal_unit_type == NAL_RADL_N || -- s->nal_unit_type == NAL_RASL_N )) { -+ if (s->enable_rpi && s->used_for_ref) { - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; - int curr_y = ((int *)f->progress->data)[0]; --- -2.7.4 - - -From 6401d88c310cd3bfec7be94bf3ceb6d0c5736c7e Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Tue, 2 Jun 2015 15:22:52 +0100 -Subject: [PATCH 51/68] Added support for skip_frame - ---- - libavcodec/hevc.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 0ac4f4c..639e4df 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3397,11 +3397,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - } - - #endif -- s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -- s->nal_unit_type == NAL_TSA_N || -- s->nal_unit_type == NAL_STSA_N || -- s->nal_unit_type == NAL_RADL_N || -- s->nal_unit_type == NAL_RASL_N); - - if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { - av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -@@ -3925,6 +3920,16 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) - if (ret < 0) - return ret; - -+ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N); -+ -+ if (!s->used_for_ref && s->avctx->skip_frame >= AVDISCARD_NONREF) { -+ s->is_decoded = 0; -+ break; -+ } - if (s->max_ra == INT_MAX) { - if (s->nal_unit_type == NAL_CRA_NUT || IS_BLA(s)) { - s->max_ra = s->poc; --- -2.7.4 - - -From d2951e2ca73e234d1b775621e3993948a4a2c8ea Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 3 Jun 2015 09:15:38 +0100 -Subject: [PATCH 52/68] Fixed cache flushing of luma when using old method - ---- - libavcodec/hevc_filter.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 14a0952..b286bbf 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -919,7 +919,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - flush_buffer(s->frame->buf[1]); - flush_buffer(s->frame->buf[2]); - #ifdef RPI_LUMA_QPU -- flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[0]); - #endif - - #endif --- -2.7.4 - - -From 7ae612e69c1cabcc7d0b37b65efa8c5bdcfa7bf5 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 3 Jun 2015 11:37:27 +0100 -Subject: [PATCH 53/68] Option to parallelise coefficient decode and inter - prediction and deblock for each frame - ---- - libavcodec/hevc.c | 701 +++++++++++++++++++++++++++-------------- - libavcodec/hevc.h | 74 +++-- - libavcodec/hevc_cabac.c | 12 +- - libavcodec/hevcpred_template.c | 5 +- - 4 files changed, 522 insertions(+), 270 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 639e4df..12aacc5 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -43,8 +43,6 @@ - - #ifdef RPI - #include "rpi_qpu.h" -- // For some unknown reason, the code seems to crash if I do a late malloc -- //#define EARLY_MALLOC - // Move Inter prediction into separate pass - #define RPI_INTER - -@@ -58,6 +56,21 @@ - - // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs - //#define RPI_SIMULATE_QPUS -+ #ifdef RPI_WORKER -+ #include "pthread.h" -+ #endif -+ -+ static void rpi_execute_dblk_cmds(HEVCContext *s); -+ static void rpi_execute_transform(HEVCContext *s); -+ static void rpi_execute_inter_qpu(HEVCContext *s); -+ static void rpi_execute_pred_cmds(HEVCContext *s); -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+ static void rpi_inter_clear(HEVCContext *s); -+ -+ // Define INTER_PASS0 to do inter prediction in first pass -+ //#define INTER_PASS0 -+ // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 -+ //#define LAUNCH_PASS0 - - #endif - -@@ -105,6 +118,143 @@ static uint32_t get_vc_address(AVBufferRef *bref) { - GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); - return p->vc; - } -+#endif -+ -+ -+#ifdef RPI_WORKER -+ -+//#define LOG_ENTER printf("Enter %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); -+//#define LOG_EXIT printf("Exit %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); -+ -+#define LOG_ENTER -+#define LOG_EXIT -+ -+// Call this when we have completed pass0 and wish to trigger pass1 for the current job -+static void worker_submit_job(HEVCContext *s) -+{ -+ LOG_ENTER -+ //pthread_mutex_lock(&s->worker_mutex); -+ s->worker_tail++; // This is the only place that can change tail so we do not need the mutex -+ s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved -+ //pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+} -+ -+// Call this to say we have completed pass1 -+static void worker_complete_middle_job(HEVCContext *s) -+{ -+ LOG_ENTER -+ //pthread_mutex_lock(&s->worker_mutex); -+ s->worker_middle++; // This is the only place that can change head so we do not need the mutex -+ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved -+ //pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+} -+ -+// Call this to say we have completed pass2 -+static void worker_complete_job(HEVCContext *s) -+{ -+ LOG_ENTER -+ //pthread_mutex_lock(&s->worker_mutex); -+ s->worker_head++; // This is the only place that can change head so we do not need the mutex -+ s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved -+ //pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+} -+ -+// Call this to wait for all jobs to have completed at the end of a frame -+static void worker_wait(HEVCContext *s) -+{ -+ LOG_ENTER -+ pthread_mutex_lock(&s->worker_mutex); -+ while( s->worker_head !=s->worker_tail) -+ { -+ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); -+ } -+ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+} -+ -+// Call worker_pass0_ready to wait until the s->pass0_job slot becomes -+// available to receive the next job. -+static void worker_pass0_ready(HEVCContext *s) -+{ -+ LOG_ENTER -+ pthread_mutex_lock(&s->worker_mutex); -+ // tail is number of submitted jobs -+ // head is number of completed jobs -+ // tail-head is number of outstanding jobs in the queue -+ // we need to ensure there is at least 1 space left for us to use -+ while( s->worker_tail - s->worker_head >= RPI_MAX_JOBS) -+ { -+ // Wait until another job is completed -+ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); -+ } -+ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+} -+ -+static void *worker_start(void *arg) -+{ -+ HEVCContext *s = (HEVCContext *)arg; -+ while(1) { -+ pthread_mutex_lock(&s->worker_mutex); -+ -+ while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) -+ { -+ pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); -+ } -+ pthread_mutex_unlock(&s->worker_mutex); -+ -+ if (s->kill_worker) { -+ break; -+ } -+ LOG_ENTER -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+#ifndef LAUNCH_PASS0 -+ rpi_execute_inter_qpu(s); -+#endif -+#ifndef INTER_PASS0 -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+#endif -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+ worker_complete_middle_job(s); -+ LOG_EXIT -+ } -+ return NULL; -+} -+ -+static void *worker_deblock_start(void *arg) -+{ -+ HEVCContext *s = (HEVCContext *)arg; -+ while(1) { -+ pthread_mutex_lock(&s->worker_mutex); -+ while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) -+ { -+ pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); -+ } -+ pthread_mutex_unlock(&s->worker_mutex); -+ -+ if (s->kill_worker) { -+ break; -+ } -+ LOG_ENTER -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+ -+ worker_complete_job(s); -+ LOG_EXIT -+ } -+ return NULL; -+} - - #endif - -@@ -121,19 +271,18 @@ static uint32_t get_vc_address(AVBufferRef *bref) { - static void pic_arrays_free(HEVCContext *s) - { - #ifdef RPI -- --#ifdef EARLY_MALLOC --#else -- if (s->coeffs_buf_arm[0]) { -- gpu_free(&s->coeffs_buf_default); -- s->coeffs_buf_arm[0] = 0; -- } -- if (s->coeffs_buf_arm[2]) { -- gpu_free(&s->coeffs_buf_accelerated); -- s->coeffs_buf_arm[2] = 0; -+ int job; -+ for(job=0;jobcoeffs_buf_arm[job][0]) { -+ gpu_free(&s->coeffs_buf_default[job]); -+ s->coeffs_buf_arm[job][0] = 0; -+ } -+ if (s->coeffs_buf_arm[job][2]) { -+ gpu_free(&s->coeffs_buf_accelerated[job]); -+ s->coeffs_buf_arm[job][2] = 0; -+ } - } - #endif --#endif - av_freep(&s->sao); - av_freep(&s->deblock); - -@@ -171,24 +320,26 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - int min_pu_size = sps->min_pu_width * sps->min_pu_height; - - #ifdef RPI --#ifdef EARLY_MALLOC --#else - av_assert0(sps); - int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); - int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -- if (!s->coeffs_buf_arm[0]) -- goto fail; -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -- if (!s->coeffs_buf_arm[2]) -- goto fail; -- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -- printf("Done\n"); --#endif -+ int job; -+ for(job=0;jobcoeffs_buf_default[job]); -+ s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; -+ if (!s->coeffs_buf_arm[job][0]) -+ goto fail; -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); -+ s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; -+ s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; -+ if (!s->coeffs_buf_arm[job][2]) -+ goto fail; -+ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; -+ s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; -+ } -+ } - #endif - - s->bs_width = (width >> 2) + 1; -@@ -1036,7 +1187,7 @@ static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, - { - if (s->enable_rpi) { - HEVCLocalContext *lc = s->HEVClc; -- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; - cmd->type = RPI_PRED_INTRA; - cmd->size = log2_trafo_size; - cmd->c_idx = c_idx; -@@ -1496,7 +1647,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref, const Mv *mv, int x_off, int y_off, - int block_w, int block_h, int luma_weight, int luma_offset) - { -- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; - cmd->cmd = RPI_CMD_LUMA_UNI; - cmd->dst = dst; - cmd->dststride = dststride; -@@ -1515,7 +1666,7 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, - AVFrame *ref0, const Mv *mv0, int x_off, int y_off, - int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) - { -- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; - cmd->cmd = RPI_CMD_LUMA_BI; - cmd->dst = dst; - cmd->dststride = dststride; -@@ -1537,7 +1688,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, - ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, - int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) - { -- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; - cmd->cmd = RPI_CMD_CHROMA_UNI; - cmd->dst = dst0; - cmd->dststride = dststride; -@@ -1555,7 +1706,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, - static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, - int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) - { -- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; - cmd->cmd = RPI_CMD_CHROMA_BI+cidx; - cmd->dst = dst0; - cmd->dststride = dststride; -@@ -2037,7 +2188,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int chan = x0>>6; // 64 wide blocks per QPU - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -- uint32_t *y = s->y_mvs[chan % 12]; -+ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=16) { - int bw = nPbW-start_x; -@@ -2057,7 +2208,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; - } - } -- s->y_mvs[chan % 12] = y; -+ s->y_mvs[s->pass0_job][chan % 12] = y; - } else - #endif - { -@@ -2086,7 +2237,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - -- uint32_t *u = s->u_mvs[chan & 7]; -+ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - int bw = nPbW_c-start_x; -@@ -2110,7 +2261,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } -- s->u_mvs[chan & 7] = u; -+ s->u_mvs[s->pass0_job][chan & 7] = u; - return; - } - #endif -@@ -2140,7 +2291,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int chan = x0>>6; // 64 wide blocks per QPU - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -- uint32_t *y = s->y_mvs[chan % 12]; -+ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=16) { - int bw = nPbW-start_x; -@@ -2160,7 +2311,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; - } - } -- s->y_mvs[chan % 12] = y; -+ s->y_mvs[s->pass0_job][chan % 12] = y; - } else - #endif - -@@ -2190,7 +2341,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - -- uint32_t *u = s->u_mvs[chan & 7]; -+ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - int bw = nPbW_c-start_x; -@@ -2215,7 +2366,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } -- s->u_mvs[chan & 7] = u; -+ s->u_mvs[s->pass0_job][chan & 7] = u; - return; - } - #endif -@@ -2249,7 +2400,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int x2 = x0 + (mv2->x >> 2); - int y2 = y0 + (mv2->y >> 2); - int chan = x0>>6; // 64 wide blocks per QPU -- uint32_t *y = s->y_mvs[chan % 12]; -+ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time - int bw = nPbW-start_x; -@@ -2265,7 +2416,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; - } - } -- s->y_mvs[chan % 12] = y; -+ s->y_mvs[s->pass0_job][chan % 12] = y; - } else - #endif - { -@@ -2298,7 +2449,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - - int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width - -- uint32_t *u = s->u_mvs[chan & 7]; -+ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - int bw = nPbW_c-start_x; -@@ -2327,7 +2478,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } -- s->u_mvs[chan & 7] = u; -+ s->u_mvs[s->pass0_job][chan & 7] = u; - return; - } - #endif -@@ -2832,40 +2983,54 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, - static void rpi_execute_dblk_cmds(HEVCContext *s) - { - int n; -+ int job = s->pass2_job; - int ctb_size = 1 << s->ps.sps->log2_ctb_size; -- int (*p)[2] = s->dblk_cmds; -- for(n = s->num_dblk_cmds; n>0 ;n--,p++) { -+ int (*p)[2] = s->dblk_cmds[job]; -+ for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { - ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); - } -- s->num_dblk_cmds = 0; -+ s->num_dblk_cmds[job] = 0; - } - - static void rpi_execute_transform(HEVCContext *s) - { - int i=2; -+#ifdef LAUNCH_PASS0 -+ int job = s->pass0_job; -+#else -+ int job = s->pass1_job; -+#endif - //int j; - //int16_t *coeffs = s->coeffs_buf_arm[i]; - //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { - // s->hevcdsp.idct[4-2](coeffs, 16); - //} - -- gpu_cache_flush(&s->coeffs_buf_accelerated); -- s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -+ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], -+ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], -+ s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); - //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); - //gpu_cache_flush(&s->coeffs_buf_accelerated); - //vpu_wait(s->vpu_id); - - for(i=0;i<4;i++) -- s->num_coeffs[i] = 0; -+ s->num_coeffs[job][i] = 0; - } - - static void rpi_execute_pred_cmds(HEVCContext *s) - { - int i; -- HEVCPredCmd *cmd = s->univ_pred_cmds; -+ int job = s->pass2_job; -+ HEVCPredCmd *cmd = s->univ_pred_cmds[job]; -+#ifdef RPI_WORKER -+ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -+#else - HEVCLocalContext *lc = s->HEVClc; -+#endif - -- for(i = s->num_pred_cmds; i > 0; i--, cmd++) { -+ for(i = s->num_pred_cmds[job]; i > 0; i--, cmd++) { -+ //printf("i=%d cmd=%p job1=%d job0=%d\n",i,cmd,s->pass1_job,s->pass0_job); - if (cmd->type == RPI_PRED_INTRA) { - lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; - lc->na.cand_bottom_left = (cmd->na >> 4) & 1; -@@ -2884,21 +3049,26 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - #endif - } - } -- s->num_pred_cmds = 0; -+ s->num_pred_cmds[job] = 0; - } - - static void rpi_execute_inter_cmds(HEVCContext *s) - { -- HEVCMvCmd *cmd = s->unif_mv_cmds; -+#ifdef INTER_PASS0 -+ int job = s->pass0_job; -+#else -+ int job = s->pass1_job; -+#endif -+ HEVCMvCmd *cmd = s->unif_mv_cmds[job]; - int n,cidx; - AVFrame myref; - AVFrame myref1; - struct MvField mymv; -- if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { -+ if (s->num_mv_cmds[job] > RPI_MAX_MV_CMDS) { - printf("Overflow inter_cmds\n"); - exit(-1); - } -- for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { -+ for(n = s->num_mv_cmds[job]; n>0 ; n--, cmd++) { - switch(cmd->cmd) { - case RPI_CMD_LUMA_UNI: - myref.data[0] = cmd->src; -@@ -2938,7 +3108,28 @@ static void rpi_execute_inter_cmds(HEVCContext *s) - break; - } - } -- s->num_mv_cmds = 0; -+ s->num_mv_cmds[job] = 0; -+} -+ -+static void rpi_do_all_passes(HEVCContext *s) -+{ -+#ifdef RPI_INTER_QPU -+ // Kick off inter prediction on QPUs -+ rpi_execute_inter_qpu(s); -+#else -+ rpi_execute_transform(s); -+#endif -+ // Perform luma inter prediction -+ rpi_execute_inter_cmds(s); -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+#ifdef RPI_INTER_QPU -+ rpi_inter_clear(s); -+#endif - } - - #endif -@@ -2946,6 +3137,7 @@ static void rpi_execute_inter_cmds(HEVCContext *s) - #ifdef RPI_INTER_QPU - static void rpi_inter_clear(HEVCContext *s) - { -+ int job = s->pass0_job; - int i; - int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; - int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -@@ -2953,51 +3145,50 @@ static void rpi_inter_clear(HEVCContext *s) - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - - for(i=0;i<8;i++) { -- s->u_mvs[i] = s->mvs_base[i]; -- *s->u_mvs[i]++ = 0; -- *s->u_mvs[i]++ = 0; -- *s->u_mvs[i]++ = 0; -- *s->u_mvs[i]++ = 0; -- *s->u_mvs[i]++ = 0; -- *s->u_mvs[i]++ = pic_width; -- *s->u_mvs[i]++ = pic_height; -- *s->u_mvs[i]++ = s->frame->linesize[1]; -- *s->u_mvs[i]++ = s->frame->linesize[2]; -+ s->u_mvs[job][i] = s->mvs_base[job][i]; -+ *s->u_mvs[job][i]++ = 0; -+ *s->u_mvs[job][i]++ = 0; -+ *s->u_mvs[job][i]++ = 0; -+ *s->u_mvs[job][i]++ = 0; -+ *s->u_mvs[job][i]++ = 0; -+ *s->u_mvs[job][i]++ = pic_width; -+ *s->u_mvs[job][i]++ = pic_height; -+ *s->u_mvs[job][i]++ = s->frame->linesize[1]; -+ *s->u_mvs[job][i]++ = s->frame->linesize[2]; - if (weight_flag) { -- *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -- *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -+ *s->u_mvs[job][i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+ *s->u_mvs[job][i]++ = s->sh.chroma_log2_weight_denom + 6; - } else { -- *s->u_mvs[i]++ = 1 << 5; -- *s->u_mvs[i]++ = 6; -+ *s->u_mvs[job][i]++ = 1 << 5; -+ *s->u_mvs[job][i]++ = 6; - } -- *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -+ *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) - } - - #ifdef RPI_LUMA_QPU - for(i=0;i<12;i++) { -- s->y_mvs[i] = s->y_mvs_base[i]; -- *s->y_mvs[i]++ = 0; // y_x -- *s->y_mvs[i]++ = 0; // ref_y_base -- *s->y_mvs[i]++ = 0; // y2_x2 -- *s->y_mvs[i]++ = 0; // ref_y2_base -- *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -- *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch -- *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch -+ s->y_mvs[job][i] = s->y_mvs_base[job][i]; -+ *s->y_mvs[job][i]++ = 0; // y_x -+ *s->y_mvs[job][i]++ = 0; // ref_y_base -+ *s->y_mvs[job][i]++ = 0; // y2_x2 -+ *s->y_mvs[job][i]++ = 0; // ref_y2_base -+ *s->y_mvs[job][i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -+ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // pitch -+ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // dst_pitch - if (weight_flag) { - int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); - int shift = s->sh.luma_log2_weight_denom + 6; -- *s->y_mvs[i]++ = (offset << 16) + shift; -+ *s->y_mvs[job][i]++ = (offset << 16) + shift; - } else { - int offset = 1 << 5; - int shift = 6; -- *s->y_mvs[i]++ = (offset << 16) + shift; -+ *s->y_mvs[job][i]++ = (offset << 16) + shift; - } -- *s->y_mvs[i]++ = 0; // Next kernel -+ *s->y_mvs[job][i]++ = 0; // Next kernel - } - #endif - } - -- - #ifdef RPI_SIMULATE_QPUS - - static int32_t clipx(int x,int FRAME_WIDTH) -@@ -3271,10 +3462,15 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) - static void rpi_execute_inter_qpu(HEVCContext *s) - { - int k; -+#ifdef LAUNCH_PASS0 -+ int job = s->pass0_job; -+#else -+ int job = s->pass1_job; -+#endif - int i; -- uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; - #ifdef RPI_LUMA_QPU -- uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; -+ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr[job].vc; - #endif - if (s->sh.slice_type == I_SLICE) { - #ifdef RPI_MULTI_MAILBOX -@@ -3283,22 +3479,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - #endif - } - for(k=0;k<8;k++) { -- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -- av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+ av_assert0(s->u_mvs[job][k] - s->mvs_base[job][k] < UV_COMMANDS_PER_QPU); - } - -- s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ s->u_mvs[job][8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore - - #ifdef RPI_LUMA_QPU - for(k=0;k<12;k++) { -- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -- av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -+ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -+ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ av_assert0(s->y_mvs[job][k] - s->y_mvs_base[job][k] < Y_COMMANDS_PER_QPU); - } -- s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ s->y_mvs[job][12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore - #endif - - #ifdef RPI_SIMULATE_QPUS -@@ -3308,34 +3504,34 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - - #ifdef RPI_MULTI_MAILBOX - #ifdef RPI_CACHE_UNIF_MVS -- gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); -+ gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); - #else -- gpu_cache_flush(&s->coeffs_buf_accelerated); -+ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); - #endif -- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, - qpu_get_fn(QPU_MC_SETUP_UV), -- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), - #ifdef RPI_LUMA_QPU - qpu_get_fn(QPU_MC_SETUP), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -- (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][0 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][1 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][2 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][3 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][4 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][5 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][6 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][7 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][8 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][9 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][10 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -+ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][11 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)) - #else - 0, - 0,0,0,0, -@@ -3344,17 +3540,17 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - #endif - ); - for(i=0;i<4;i++) -- s->num_coeffs[i] = 0; -+ s->num_coeffs[job][i] = 0; - #else - qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)) - ); - #endif - -@@ -3411,6 +3607,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - } - } - -+#ifdef RPI_WORKER -+ s->pass0_job = 0; -+ s->pass1_job = 0; -+ s->pass2_job = 0; -+#endif - #ifdef RPI_INTER_QPU - rpi_inter_clear(s); - #endif -@@ -3431,46 +3632,42 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ - #ifdef RPI - if (s->enable_rpi) { -- s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -- s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -+ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; -+ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; - if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -- // Transform all blocks -- // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); --#ifdef RPI_MULTI_MAILBOX -- // Kick off inter prediction on QPUs -- rpi_execute_inter_qpu(s); -- // Perform luma inter prediction -- rpi_execute_inter_cmds(s); --#else -- rpi_execute_transform(s); -- // Perform inter prediction -- rpi_execute_inter_cmds(s); --#ifdef RPI_INTER_QPU -- // Kick off inter prediction on QPUs -- rpi_execute_inter_qpu(s); --#endif --#endif -- -- // Wait for transform completion -- vpu_wait(s->vpu_id); -- -- // Copy back reconstructed data -- //memcpy(s->frame->data[0],s->dummy.arm,2048*64); -- //memcpy(s->frame->data[1],s->dummy.arm,1024*32); -- //memcpy(s->frame->data[2],s->dummy.arm,1024*32); -+#ifdef RPI_WORKER -+ if (s->used_for_ref) { -+ // Split work load onto separate threads so we make as rapid progress as possible with this frame -+ #ifdef INTER_PASS0 -+ rpi_execute_inter_cmds(s); -+ #endif -+ #ifdef LAUNCH_PASS0 -+ rpi_execute_inter_qpu(s); -+ #endif -+ // Pass on this job to worker thread -+ worker_submit_job(s); -+ // Make sure we have space to prepare the next job -+ worker_pass0_ready(s); - -- // Perform intra prediction and residual reconstruction -- rpi_execute_pred_cmds(s); -- // Perform deblocking for CTBs in this row -- rpi_execute_dblk_cmds(s); -+ // Prepare the next batch of commands - #ifdef RPI_INTER_QPU -- rpi_inter_clear(s); -+ rpi_inter_clear(s); -+#endif -+ } else { -+ // Non-ref frame so do it all on this thread -+ rpi_do_all_passes(s); -+ } -+#else -+ rpi_do_all_passes(s); - #endif - } - } - #endif -+ -+ - if (more_data < 0) { - s->tab_slice_address[ctb_addr_rs] = -1; - return more_data; -@@ -3487,18 +3684,21 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - } - - #ifdef RPI -- if (s->enable_rpi && s->num_dblk_cmds) { --#ifdef RPI_INTER_QPU -- rpi_execute_inter_qpu(s); --#endif --#ifndef RPI_MULTI_MAILBOX -- rpi_execute_transform(s); -+ -+#ifdef RPI_WORKER -+ // Wait for the worker to finish all its jobs -+ if (s->enable_rpi) { -+ worker_wait(s); -+ av_assert0(s->pass0_job==s->pass1_job); -+ av_assert0(s->pass1_job==s->pass2_job); -+ } - #endif -- rpi_execute_inter_cmds(s); -- vpu_wait(s->vpu_id); -- rpi_execute_pred_cmds(s); -- rpi_execute_dblk_cmds(s); -+ -+ // Finish off any half-completed rows -+ if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { -+ rpi_do_all_passes(s); - } -+ - #endif - - if (x_ctb + ctb_size >= s->ps.sps->width && -@@ -4230,6 +4430,48 @@ fail: - return AVERROR(ENOMEM); - } - -+#ifdef RPI_WORKER -+static av_cold void hevc_init_worker(HEVCContext *s) -+{ -+ int err; -+ pthread_cond_init(&s->worker_cond_head, NULL); -+ pthread_cond_init(&s->worker_cond_middle, NULL); -+ pthread_cond_init(&s->worker_cond_tail, NULL); -+ pthread_mutex_init(&s->worker_mutex, NULL); -+ -+ s->worker_tail=0; -+ s->worker_middle=0; -+ s->worker_head=0; -+ s->kill_worker=0; -+ err = pthread_create(&s->worker_thread, NULL, worker_start, s); -+ err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); -+ if (err) { -+ printf("Failed to create worker thread\n"); -+ exit(-1); -+ } -+} -+ -+static av_cold void hevc_exit_worker(HEVCContext *s) -+{ -+ void *res; -+ s->kill_worker=1; -+ pthread_cond_broadcast(&s->worker_cond_tail); -+ pthread_cond_broadcast(&s->worker_cond_middle); -+ pthread_join(s->worker_thread, &res); -+ pthread_join(s->worker_deblock_thread, &res); -+ -+ pthread_cond_destroy(&s->worker_cond_head); -+ pthread_cond_destroy(&s->worker_cond_middle); -+ pthread_cond_destroy(&s->worker_cond_tail); -+ pthread_mutex_destroy(&s->worker_mutex); -+ -+ s->worker_tail=0; -+ s->worker_middle=0; -+ s->worker_head=0; -+ s->kill_worker=0; -+} -+#endif -+ - static av_cold int hevc_decode_free(AVCodecContext *avctx) - { - HEVCContext *s = avctx->priv_data; -@@ -4242,33 +4484,29 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) - av_freep(&s->cabac_state); - - #ifdef RPI -- av_freep(&s->unif_mv_cmds); -- av_freep(&s->univ_pred_cmds); -+ -+#ifdef RPI_WORKER -+ hevc_exit_worker(s); -+#endif -+ -+ for(i=0;iunif_mv_cmds[i]); -+ av_freep(&s->univ_pred_cmds[i]); - - #ifdef RPI_INTER_QPU -- if (s->unif_mvs) { -- gpu_free( &s->unif_mvs_ptr ); -- s->unif_mvs = 0; -- } -+ if (s->unif_mvs[i]) { -+ gpu_free( &s->unif_mvs_ptr[i] ); -+ s->unif_mvs[i] = 0; -+ } - #endif - #ifdef RPI_LUMA_QPU -- if (s->y_unif_mvs) { -- gpu_free( &s->y_unif_mvs_ptr ); -- s->y_unif_mvs = 0; -- } -+ if (s->y_unif_mvs[i]) { -+ gpu_free( &s->y_unif_mvs_ptr[i] ); -+ s->y_unif_mvs[i] = 0; -+ } - #endif -- --#ifdef EARLY_MALLOC -- printf("hevc_decode_free\n"); -- if (s->coeffs_buf_arm[0]) { -- gpu_free(&s->coeffs_buf_default); -- s->coeffs_buf_arm[0] = 0; -- } -- if (s->coeffs_buf_arm[2]) { -- gpu_free(&s->coeffs_buf_accelerated); -- s->coeffs_buf_arm[2] = 0; - } --#endif -+ - #endif - - for (i = 0; i < 3; i++) { -@@ -4328,6 +4566,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - { - HEVCContext *s = avctx->priv_data; - int i; -+ int job; - - s->avctx = avctx; - -@@ -4338,12 +4577,14 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - s->sList[0] = s; - - #ifdef RPI -- s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -- if (!s->unif_mv_cmds) -- goto fail; -- s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -- if (!s->univ_pred_cmds) -- goto fail; -+ for(job=0;jobunif_mv_cmds[job] = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -+ if (!s->unif_mv_cmds[job]) -+ goto fail; -+ s->univ_pred_cmds[job] = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds[job]) -+ goto fail; -+ } - - #ifdef RPI_INTER_QPU - // We divide the image into blocks 256 wide and 64 high -@@ -4354,18 +4595,20 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - { - int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; - uint32_t *p; -+ for(job=0;jobunif_mvs_ptr ); -+ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); - #else -- gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); - #endif -- s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+ s->unif_mvs[job] = (uint32_t *) s->unif_mvs_ptr[job].arm; - -- // Set up initial locations for uniform streams -- p = s->unif_mvs; -- for(i = 0; i < 8; i++) { -- s->mvs_base[i] = p; -+ // Set up initial locations for uniform streams -+ p = s->unif_mvs[job]; -+ for(i = 0; i < 8; i++) { -+ s->mvs_base[job][i] = p; - p += uv_commands_per_qpu; -+ } - } - s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); - s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); -@@ -4374,61 +4617,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) - } - #endif - #ifdef RPI_LUMA_QPU -+ for(job=0;joby_unif_mvs_ptr ); -+ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); - #else -- gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -+ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); - #endif -- s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+ s->y_unif_mvs[job] = (uint32_t *) s->y_unif_mvs_ptr[job].arm; - - // Set up initial locations for uniform streams -- p = s->y_unif_mvs; -+ p = s->y_unif_mvs[job]; - for(i = 0; i < 12; i++) { -- s->y_mvs_base[i] = p; -+ s->y_mvs_base[job][i] = p; - p += y_commands_per_qpu; - } -- s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -- s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -- - } -+ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -+ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); - #endif - //gpu_malloc_uncached(2048*64,&s->dummy); - --#ifdef EARLY_MALLOC -- { -- int coeffs_in_ctb = 64*64; -- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -- s->coeffs_buf_arm[0] = 0; -- s->coeffs_buf_arm[2] = 0; -- printf("Allocated %d\n",coefs_per_row); -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -- if (!s->coeffs_buf_arm[0]) -- goto fail; -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -- if (!s->coeffs_buf_arm[2]) -- goto fail; -- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -- printf("Done\n"); --#ifdef RPI_PRECLEAR -- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -- memclear16(s->coeffs_buf_arm[0], coefs_per_row); -- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -- memclear16(s->coeffs_buf_arm[2], coefs_per_row); -- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -- memclear16(s->coeffs_buf_arm[3], coefs_per_row); --#endif -- } --#endif -- - s->enable_rpi = 0; - -+#ifdef RPI_WORKER -+ hevc_init_worker(s); -+#endif -+ - #endif - - s->cabac_state = av_malloc(HEVC_CONTEXTS); -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 5cb90b5..7bd295a 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -51,6 +51,12 @@ - // Define RPI_LUMA_QPU to also use QPU for luma inter prediction - #define RPI_LUMA_QPU - #endif -+ -+ // By passing jobs to a worker thread we hope to be able to catch up during slow frames -+ #define RPI_MAX_JOBS 2 -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+ - #endif - - #define MAX_DPB_SIZE 16 // A.4.1 -@@ -806,6 +812,13 @@ typedef struct HEVCLocalContext { - int boundary_flags; - } HEVCLocalContext; - -+#ifdef RPI_WORKER -+typedef struct HEVCLocalContextIntra { -+ TransformUnit tu; -+ NeighbourAvailable na; -+} HEVCLocalContextIntra; -+#endif -+ - #ifdef RPI - - // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -@@ -874,7 +887,7 @@ typedef struct HEVCPredCmd { - - typedef struct HEVCContext { - #ifdef RPI -- int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; -+ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; - #endif - const AVClass *c; // needed by private avoptions - AVCodecContext *avctx; -@@ -883,7 +896,9 @@ typedef struct HEVCContext { - - HEVCLocalContext *HEVClcList[MAX_NB_THREADS]; - HEVCLocalContext *HEVClc; -- -+#ifdef RPI_WORKER -+ HEVCLocalContextIntra HEVClcIntra; -+#endif - uint8_t threads_type; - uint8_t threads_number; - -@@ -894,43 +909,60 @@ typedef struct HEVCContext { - - #ifdef RPI - int enable_rpi; -- HEVCMvCmd *unif_mv_cmds; -- HEVCPredCmd *univ_pred_cmds; -+ HEVCMvCmd *unif_mv_cmds[RPI_MAX_JOBS]; -+ HEVCPredCmd *univ_pred_cmds[RPI_MAX_JOBS]; - int buf_width; -- GPU_MEM_PTR_T coeffs_buf_default; -- GPU_MEM_PTR_T coeffs_buf_accelerated; -- int16_t *coeffs_buf_arm[4]; -- unsigned int coeffs_buf_vc[4]; -- int num_coeffs[4]; -- int num_xfm_cmds; -- int num_mv_cmds; -- int num_pred_cmds; -- int num_dblk_cmds; -+ GPU_MEM_PTR_T coeffs_buf_default[RPI_MAX_JOBS]; -+ GPU_MEM_PTR_T coeffs_buf_accelerated[RPI_MAX_JOBS]; -+ int16_t *coeffs_buf_arm[RPI_MAX_JOBS][4]; -+ unsigned int coeffs_buf_vc[RPI_MAX_JOBS][4]; -+ int num_coeffs[RPI_MAX_JOBS][4]; -+ int num_xfm_cmds[RPI_MAX_JOBS]; -+ int num_mv_cmds[RPI_MAX_JOBS]; -+ int num_pred_cmds[RPI_MAX_JOBS]; -+ int num_dblk_cmds[RPI_MAX_JOBS]; - int vpu_id; - //GPU_MEM_PTR_T dummy; -+ int pass0_job; // Pass0 does coefficient decode -+ int pass1_job; // Pass1 does pixel processing -+ int pass2_job; // Pass2 does reconstruction and deblocking - #ifdef RPI_INTER_QPU -- GPU_MEM_PTR_T unif_mvs_ptr; -- uint32_t *unif_mvs; // Base of memory for motion vector commands -+ GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; -+ uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands - - // _base pointers are to the start of the row -- uint32_t *mvs_base[8]; -+ uint32_t *mvs_base[RPI_MAX_JOBS][8]; - // these pointers are to the next free space -- uint32_t *u_mvs[8]; -+ uint32_t *u_mvs[RPI_MAX_JOBS][8]; - // Function pointers - uint32_t mc_filter_uv; - uint32_t mc_filter_uv_b0; - uint32_t mc_filter_uv_b; - #endif - #ifdef RPI_LUMA_QPU -- GPU_MEM_PTR_T y_unif_mvs_ptr; -- uint32_t *y_unif_mvs; // Base of memory for motion vector commands -- uint32_t *y_mvs_base[12]; -- uint32_t *y_mvs[12]; -+ GPU_MEM_PTR_T y_unif_mvs_ptr[RPI_MAX_JOBS]; -+ uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+ uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; -+ uint32_t *y_mvs[RPI_MAX_JOBS][12]; - // Function pointers - uint32_t mc_filter; - uint32_t mc_filter_b; - #endif - -+#ifdef RPI_WORKER -+ pthread_t worker_thread; -+ pthread_t worker_deblock_thread; -+ pthread_cond_t worker_cond_head; -+ pthread_cond_t worker_cond_tail; -+ pthread_cond_t worker_cond_middle; -+ pthread_mutex_t worker_mutex; -+ -+ int worker_tail; // Contains the number of posted jobs -+ int worker_head; // Contains the number of completed jobs -+ int worker_middle; // Contains the number of completed jobs -+ int kill_worker; // set to 1 to terminate the worker -+#endif -+ - #endif - - uint8_t *cabac_state; -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 38f53de..f0982cd 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1051,11 +1051,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - if (s->enable_rpi) { - int n = trafo_size * trafo_size; - if (use_vpu) { -- coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; -- s->num_coeffs[log2_trafo_size - 2] += n; -+ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -+ s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; - } else { -- coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; -- s->num_coeffs[0] += n; -+ coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; -+ s->num_coeffs[s->pass0_job][0] += n; - } - } - // We now do the memset after transform_add while we know the data is cached. -@@ -1508,7 +1508,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); - } - } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { -- s->hevcdsp.idct_4x4_luma(coeffs); -+ s->hevcdsp.idct_4x4_luma(coeffs); - } else { - #ifdef RPI - if (!use_vpu) { -@@ -1553,7 +1553,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - } - #ifdef RPI - if (s->enable_rpi) { -- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; - cmd->type = RPI_PRED_TRANSFORM_ADD; - cmd->size = log2_trafo_size; - cmd->buf = coeffs; -diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -index 71c6d52..344e021 100644 ---- a/libavcodec/hevcpred_template.c -+++ b/libavcodec/hevcpred_template.c -@@ -71,8 +71,11 @@ do { \ - AV_WN4P(&ptr[i], a); \ - else \ - a = PIXEL_SPLAT_X4(ptr[i + 3]) -- -+#ifdef RPI_WORKER -+ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -+#else - HEVCLocalContext *lc = s->HEVClc; -+#endif - int i; - int hshift = s->ps.sps->hshift[c_idx]; - int vshift = s->ps.sps->vshift[c_idx]; --- -2.7.4 - - -From 1e0885f8d98175777fff65b4cedd708176c2abcf Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 3 Jun 2015 13:43:48 +0100 -Subject: [PATCH 54/68] Avoid lockup bug with RPI_WORKER enabled - ---- - libavcodec/hevc.c | 22 +++++++++++----------- - libavcodec/hevc_cabac.c | 1 - - 2 files changed, 11 insertions(+), 12 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 12aacc5..182a82f 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -133,11 +133,11 @@ static uint32_t get_vc_address(AVBufferRef *bref) { - static void worker_submit_job(HEVCContext *s) - { - LOG_ENTER -- //pthread_mutex_lock(&s->worker_mutex); -- s->worker_tail++; // This is the only place that can change tail so we do not need the mutex -+ pthread_mutex_lock(&s->worker_mutex); -+ s->worker_tail++; - s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot - pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved -- //pthread_mutex_unlock(&s->worker_mutex); -+ pthread_mutex_unlock(&s->worker_mutex); - LOG_EXIT - } - -@@ -145,11 +145,11 @@ static void worker_submit_job(HEVCContext *s) - static void worker_complete_middle_job(HEVCContext *s) - { - LOG_ENTER -- //pthread_mutex_lock(&s->worker_mutex); -- s->worker_middle++; // This is the only place that can change head so we do not need the mutex -+ pthread_mutex_lock(&s->worker_mutex); -+ s->worker_middle++; - s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved -- //pthread_mutex_unlock(&s->worker_mutex); -+ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved -+ pthread_mutex_unlock(&s->worker_mutex); - LOG_EXIT - } - -@@ -157,11 +157,11 @@ static void worker_complete_middle_job(HEVCContext *s) - static void worker_complete_job(HEVCContext *s) - { - LOG_ENTER -- //pthread_mutex_lock(&s->worker_mutex); -- s->worker_head++; // This is the only place that can change head so we do not need the mutex -+ pthread_mutex_lock(&s->worker_mutex); -+ s->worker_head++; - s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -- pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved -- //pthread_mutex_unlock(&s->worker_mutex); -+ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved -+ pthread_mutex_unlock(&s->worker_mutex); - LOG_EXIT - } - -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index f0982cd..6523e66 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1497,7 +1497,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - for (i = 0; i < 8; i++) - FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); - } -- - s->hevcdsp.transform_skip(coeffs, log2_trafo_size); - - if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && --- -2.7.4 - - -From 1d7ad81069dec6914ec7e9983855d7a1b5e4b123 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 3 Jun 2015 15:37:19 +0100 -Subject: [PATCH 55/68] Added code to flush buffers at start of frame - ---- - libavcodec/hevc.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 72 insertions(+) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 182a82f..e5b9f1e 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -43,6 +43,7 @@ - - #ifdef RPI - #include "rpi_qpu.h" -+ #include "rpi_user_vcsm.h" - // Move Inter prediction into separate pass - #define RPI_INTER - -@@ -3508,6 +3509,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - #else - gpu_cache_flush(&s->coeffs_buf_accelerated[job]); - #endif -+ - s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, - qpu_get_fn(QPU_MC_SETUP_UV), - (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -@@ -3558,6 +3560,71 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - } - #endif - -+#ifdef RPI -+ -+static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+} -+ -+static void flush_frame(HEVCContext *s,AVFrame *frame) -+{ -+#if 1 -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+ int curr_uv = 0; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+ iocache.s[0].addr = p->arm + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = p->arm + base; -+ iocache.s[1].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+ iocache.s[2].addr = p->arm + base; -+ iocache.s[2].size = sz; -+ vcsm_clean_invalid( &iocache ); -+#else -+ flush_buffer(frame->buf[0]); -+ flush_buffer(frame->buf[1]); -+ flush_buffer(frame->buf[2]); -+#endif -+} -+ -+static void flush_all(HEVCContext *s) -+{ -+#if 0 -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 4; // Flush all -+ iocache.s[0].addr = p->arm; -+ iocache.s[0].size = 4096; -+ vcsm_clean_invalid( &iocache ); -+#else -+ int i,k; -+ for(i=0;i<2;i++) { -+ for (k = 0; k < s->sh.nb_refs[i]; k++) { -+ flush_frame(s,s->ref->refPicList[i].ref[k]->frame); -+ } -+ } -+ flush_frame(s,s->frame); -+#endif -+} -+#endif -+ - static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - { - HEVCContext *s = avctxt->priv_data; -@@ -3592,8 +3659,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - printf("Weighted B slice\n"); - } - -+ // Now flush all reference frames and our destination frame to get everything ready for decode -+ flush_all(s); - #endif - -+ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -+ - if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { - av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); - return AVERROR_INVALIDDATA; -@@ -3664,6 +3735,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - rpi_do_all_passes(s); - #endif - } -+ - } - #endif - --- -2.7.4 - - -From 7a57f233dcd4048e20a0b5bc06bc20abb589d3fa Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 3 Jun 2015 16:42:24 +0100 -Subject: [PATCH 56/68] Reduce the amount that needs to be flushed - ---- - libavcodec/hevc.c | 35 +++++++++++------------------------ - 1 file changed, 11 insertions(+), 24 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index e5b9f1e..73d7f74 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3569,7 +3569,7 @@ static void flush_buffer(AVBufferRef *bref) { - - static void flush_frame(HEVCContext *s,AVFrame *frame) - { --#if 1 -+#ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; - int n = s->ps.sps->height; - int curr_y = 0; -@@ -3603,26 +3603,6 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - #endif - } - --static void flush_all(HEVCContext *s) --{ --#if 0 -- struct vcsm_user_clean_invalid_s iocache = {}; -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); -- iocache.s[0].handle = p->vcsm_handle; -- iocache.s[0].cmd = 4; // Flush all -- iocache.s[0].addr = p->arm; -- iocache.s[0].size = 4096; -- vcsm_clean_invalid( &iocache ); --#else -- int i,k; -- for(i=0;i<2;i++) { -- for (k = 0; k < s->sh.nb_refs[i]; k++) { -- flush_frame(s,s->ref->refPicList[i].ref[k]->frame); -- } -- } -- flush_frame(s,s->frame); --#endif --} - #endif - - static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -@@ -3658,9 +3638,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) - printf("Weighted B slice\n"); - } -- -- // Now flush all reference frames and our destination frame to get everything ready for decode -- flush_all(s); - #endif - - //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -@@ -4130,6 +4107,11 @@ static int hevc_frame_start(HEVCContext *s) - if (!s->avctx->hwaccel) - ff_thread_finish_setup(s->avctx); - -+#ifdef RPI_INTER_QPU -+ // Invalidate the output data buffer so it is ready for the QPUs to write into it. -+ flush_frame(s,s->frame); -+#endif -+ - return 0; - - fail: -@@ -4331,6 +4313,11 @@ fail: - ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); - #endif - ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -+ } else if (s->ref) { -+#ifdef RPI_INTER_QPU -+ // When running single threaded we need to flush the whole frame -+ flush_frame(s,s->frame); -+#endif - } - return ret; - } --- -2.7.4 - - -From 26eba8e3266cc5f2120e8284a1ce486d6a402010 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 4 Jun 2015 07:59:28 +0100 -Subject: [PATCH 57/68] Corrected support for disabled rpi when using - RPI_WORKER - ---- - libavcodec/hevc.h | 18 ++++++++++-------- - libavcodec/hevcpred_template.c | 2 +- - 2 files changed, 11 insertions(+), 9 deletions(-) - -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 7bd295a..3cb34bd 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -769,7 +769,17 @@ typedef struct HEVCFrame { - uint8_t flags; - } HEVCFrame; - -+#ifdef RPI_WORKER -+typedef struct HEVCLocalContextIntra { -+ TransformUnit tu; -+ NeighbourAvailable na; -+} HEVCLocalContextIntra; -+#endif -+ - typedef struct HEVCLocalContext { -+ TransformUnit tu; -+ NeighbourAvailable na; // WARNING tu and na must be the first two fields to match HEVCLocalContextIntra -+ - uint8_t cabac_state[HEVC_CONTEXTS]; - - uint8_t stat_coeff[4]; -@@ -784,7 +794,6 @@ typedef struct HEVCLocalContext { - - int qPy_pred; - -- TransformUnit tu; - - uint8_t ctb_left_flag; - uint8_t ctb_up_flag; -@@ -801,7 +810,6 @@ typedef struct HEVCLocalContext { - int ct_depth; - CodingUnit cu; - PredictionUnit pu; -- NeighbourAvailable na; - - #define BOUNDARY_LEFT_SLICE (1 << 0) - #define BOUNDARY_LEFT_TILE (1 << 1) -@@ -812,12 +820,6 @@ typedef struct HEVCLocalContext { - int boundary_flags; - } HEVCLocalContext; - --#ifdef RPI_WORKER --typedef struct HEVCLocalContextIntra { -- TransformUnit tu; -- NeighbourAvailable na; --} HEVCLocalContextIntra; --#endif - - #ifdef RPI - -diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -index 344e021..325b60e 100644 ---- a/libavcodec/hevcpred_template.c -+++ b/libavcodec/hevcpred_template.c -@@ -72,7 +72,7 @@ do { \ - else \ - a = PIXEL_SPLAT_X4(ptr[i + 3]) - #ifdef RPI_WORKER -- HEVCLocalContextIntra *lc = &s->HEVClcIntra; -+ HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; - #else - HEVCLocalContext *lc = s->HEVClc; - #endif --- -2.7.4 - - -From 5b3eee9be88a5326df7621de95095def969e05a8 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 4 Jun 2015 11:52:55 +0100 -Subject: [PATCH 58/68] Draft support for tiles - ---- - libavcodec/hevc.c | 140 +++++++++++++++++++++++------------------ - libavcodec/hevc.h | 21 +++++-- - libavcodec/hevc_filter.c | 2 +- - libavcodec/hevcpred_template.c | 2 +- - 4 files changed, 99 insertions(+), 66 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 73d7f74..ec67252 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -63,10 +63,10 @@ - - static void rpi_execute_dblk_cmds(HEVCContext *s); - static void rpi_execute_transform(HEVCContext *s); -- static void rpi_execute_inter_qpu(HEVCContext *s); -+ static void rpi_launch_vpu_qpu(HEVCContext *s); - static void rpi_execute_pred_cmds(HEVCContext *s); - static void rpi_execute_inter_cmds(HEVCContext *s); -- static void rpi_inter_clear(HEVCContext *s); -+ static void rpi_begin(HEVCContext *s); - - // Define INTER_PASS0 to do inter prediction in first pass - //#define INTER_PASS0 -@@ -90,16 +90,18 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 - - #ifdef RPI_INTER_QPU - -+// Each luma QPU processes 2*RPI_NUM_CHUNKS 64x64 blocks -+// Each chroma QPU processes 3*RPI_NUM_CHUNKS 64x64 blocks, but requires two commands for B blocks -+// For each block of 64*64 the smallest block size is 8x4 -+// We also need an extra command for the setup information -+ - #define RPI_CHROMA_COMMAND_WORDS 12 --#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+#define UV_COMMANDS_PER_QPU ((1 + 3*RPI_NUM_CHUNKS*(64*64)*2/(8*4)) * RPI_CHROMA_COMMAND_WORDS) - // The QPU code for UV blocks only works up to a block width of 8 - #define RPI_CHROMA_BLOCK_WIDTH 8 - --// Split image of 2048 into parts 64 wide --// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across --// For each block of 64*64 the smallest block size is 8x4 - #define RPI_LUMA_COMMAND_WORDS 9 --#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -+#define Y_COMMANDS_PER_QPU ((1+2*RPI_NUM_CHUNKS*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) - - #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) - -@@ -216,7 +218,7 @@ static void *worker_start(void *arg) - LOG_ENTER - // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); - #ifndef LAUNCH_PASS0 -- rpi_execute_inter_qpu(s); -+ rpi_launch_vpu_qpu(s); - #endif - #ifndef INTER_PASS0 - // Perform inter prediction -@@ -322,9 +324,14 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - - #ifdef RPI - av_assert0(sps); -- int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -- int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+ int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; -+ int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; -+ int coefs_per_row = coefs_per_luma + coefs_per_chroma; - int job; -+ s->max_ctu_count = coefs_per_luma / coefs_in_ctb; -+ s->ctu_per_y_chan = s->max_ctu_count / 12; -+ s->ctu_per_uv_chan = s->max_ctu_count / 8; - for(job=0;jobx >> 2); - int y1 = y0 + (mv->y >> 2); -- int chan = x0>>6; // 64 wide blocks per QPU - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ uint32_t *y = s->curr_y_mvs; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=16) { - int bw = nPbW-start_x; -@@ -2209,7 +2215,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; - } - } -- s->y_mvs[s->pass0_job][chan % 12] = y; -+ s->curr_y_mvs = y; - } else - #endif - { -@@ -2233,12 +2239,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - - int x1_c = x0_c + (mv->x >> (2 + hshift)); - int y1_c = y0_c + (mv->y >> (2 + hshift)); -- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -- int chan = x0>>8; - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - -- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ uint32_t *u = s->curr_u_mvs; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - int bw = nPbW_c-start_x; -@@ -2262,7 +2266,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } -- s->u_mvs[s->pass0_job][chan & 7] = u; -+ s->curr_u_mvs = u; - return; - } - #endif -@@ -2289,10 +2293,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int my2_mx2_my_mx = (my_mx << 16) + my_mx; - int x1 = x0 + (mv->x >> 2); - int y1 = y0 + (mv->y >> 2); -- int chan = x0>>6; // 64 wide blocks per QPU - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ uint32_t *y = s->curr_y_mvs; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=16) { - int bw = nPbW-start_x; -@@ -2312,7 +2315,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; - } - } -- s->y_mvs[s->pass0_job][chan % 12] = y; -+ s->curr_y_mvs = y; - } else - #endif - -@@ -2337,12 +2340,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - - int x1_c = x0_c + (mv->x >> (2 + hshift)); - int y1_c = y0_c + (mv->y >> (2 + hshift)); -- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -- int chan = x0>>8; - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || - (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); - -- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ uint32_t *u = s->curr_u_mvs; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - int bw = nPbW_c-start_x; -@@ -2367,7 +2368,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } -- s->u_mvs[s->pass0_job][chan & 7] = u; -+ s->curr_u_mvs = u; - return; - } - #endif -@@ -2400,8 +2401,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int y1 = y0 + (mv->y >> 2); - int x2 = x0 + (mv2->x >> 2); - int y2 = y0 + (mv2->y >> 2); -- int chan = x0>>6; // 64 wide blocks per QPU -- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ uint32_t *y = s->curr_y_mvs; - for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go - for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time - int bw = nPbW-start_x; -@@ -2417,7 +2417,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; - } - } -- s->y_mvs[s->pass0_job][chan % 12] = y; -+ s->curr_y_mvs = y; - } else - #endif - { -@@ -2448,9 +2448,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int x2_c = x0_c + (mv2->x >> (2 + hshift)); - int y2_c = y0_c + (mv2->y >> (2 + hshift)); - -- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width - -- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ uint32_t *u = s->curr_u_mvs; - for(int start_y=0;start_y < nPbH_c;start_y+=16) { - for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { - int bw = nPbW_c-start_x; -@@ -2479,7 +2478,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } -- s->u_mvs[s->pass0_job][chan & 7] = u; -+ s->curr_u_mvs = u; - return; - } - #endif -@@ -3114,12 +3113,8 @@ static void rpi_execute_inter_cmds(HEVCContext *s) - - static void rpi_do_all_passes(HEVCContext *s) - { --#ifdef RPI_INTER_QPU -- // Kick off inter prediction on QPUs -- rpi_execute_inter_qpu(s); --#else -- rpi_execute_transform(s); --#endif -+ // Kick off QPUs and VPUs -+ rpi_launch_vpu_qpu(s); - // Perform luma inter prediction - rpi_execute_inter_cmds(s); - // Wait for transform completion -@@ -3128,18 +3123,18 @@ static void rpi_do_all_passes(HEVCContext *s) - rpi_execute_pred_cmds(s); - // Perform deblocking for CTBs in this row - rpi_execute_dblk_cmds(s); --#ifdef RPI_INTER_QPU -- rpi_inter_clear(s); --#endif -+ // Prepare next batch -+ rpi_begin(s); - } - - #endif - --#ifdef RPI_INTER_QPU --static void rpi_inter_clear(HEVCContext *s) -+#ifdef RPI -+static void rpi_begin(HEVCContext *s) - { - int job = s->pass0_job; - int i; -+#ifdef RPI_INTER_QPU - int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; - int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; - int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -@@ -3165,6 +3160,8 @@ static void rpi_inter_clear(HEVCContext *s) - } - *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) - } -+ s->curr_u_mvs = s->u_mvs[job][0]; -+#endif - - #ifdef RPI_LUMA_QPU - for(i=0;i<12;i++) { -@@ -3187,8 +3184,11 @@ static void rpi_inter_clear(HEVCContext *s) - } - *s->y_mvs[job][i]++ = 0; // Next kernel - } -+ s->curr_y_mvs = s->y_mvs[job][0]; - #endif -+ s->ctu_count = 0; - } -+#endif - - #ifdef RPI_SIMULATE_QPUS - -@@ -3459,8 +3459,9 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) - - #endif - -+#ifdef RPI_INTER_QPU - --static void rpi_execute_inter_qpu(HEVCContext *s) -+static void rpi_launch_vpu_qpu(HEVCContext *s) - { - int k; - #ifdef LAUNCH_PASS0 -@@ -3558,6 +3559,15 @@ static void rpi_execute_inter_qpu(HEVCContext *s) - - - } -+#else -+ -+#ifdef RPI -+static void rpi_launch_vpu_qpu(HEVCContext *s) -+{ -+ rpi_execute_transform(s); -+} -+#endif -+ - #endif - - #ifdef RPI -@@ -3617,29 +3627,20 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #ifdef RPI - #ifdef RPI_INTER_QPU - s->enable_rpi = s->ps.sps->bit_depth == 8 -- && s->ps.sps->width <= RPI_MAX_WIDTH - && !s->ps.pps->cross_component_prediction_enabled_flag -- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 - && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); - #else - s->enable_rpi = s->ps.sps->bit_depth == 8 -- && s->ps.sps->width <= RPI_MAX_WIDTH -- && !s->ps.pps->cross_component_prediction_enabled_flag -- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -+ && !s->ps.pps->cross_component_prediction_enabled_flag; - #endif - - if (!s->enable_rpi) { - if (s->ps.pps->cross_component_prediction_enabled_flag) - printf("Cross component\n"); -- if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -- printf("Tiles\n"); -- if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -- printf("Weighted P slice\n"); - if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) - printf("Weighted B slice\n"); - } - #endif -- - //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); - - if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -@@ -3660,8 +3661,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->pass1_job = 0; - s->pass2_job = 0; - #endif --#ifdef RPI_INTER_QPU -- rpi_inter_clear(s); -+#ifdef RPI -+ rpi_begin(s); - #endif - - while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { -@@ -3679,13 +3680,34 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; - s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; - -+#ifdef RPI_INTER_QPU -+ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; -+#endif -+#ifdef RPI_LUMA_QPU -+ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; -+#endif -+ - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); - -+#ifdef RPI_INTER_QPU -+ s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; -+#endif -+#ifdef RPI_LUMA_QPU -+ s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; -+#endif -+ - #ifdef RPI - if (s->enable_rpi) { -+ //av_assert0(s->num_dblk_cmds[s->pass0_job]>=0); -+ //av_assert0(s->num_dblk_cmds[s->pass0_job]pass0_jobpass0_job>=0); - s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; - s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; -- if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+ s->ctu_count++; -+ //printf("%d %d/%d job=%d\n",s->ctu_count,s->num_dblk_cmds[s->pass0_job],RPI_MAX_DEBLOCK_CMDS,s->pass0_job); -+ -+ if ( s->ctu_count >= s->max_ctu_count ) { - #ifdef RPI_WORKER - if (s->used_for_ref) { - // Split work load onto separate threads so we make as rapid progress as possible with this frame -@@ -3693,7 +3715,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - rpi_execute_inter_cmds(s); - #endif - #ifdef LAUNCH_PASS0 -- rpi_execute_inter_qpu(s); -+ rpi_launch_vpu_qpu(s); - #endif - // Pass on this job to worker thread - worker_submit_job(s); -@@ -3701,9 +3723,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - worker_pass0_ready(s); - - // Prepare the next batch of commands --#ifdef RPI_INTER_QPU -- rpi_inter_clear(s); --#endif -+ rpi_begin(s); - } else { - // Non-ref frame so do it all on this thread - rpi_do_all_passes(s); -@@ -3744,7 +3764,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #endif - - // Finish off any half-completed rows -- if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { -+ if (s->enable_rpi && s->ctu_count) { - rpi_do_all_passes(s); - } - -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 3cb34bd..a141316 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -823,8 +823,15 @@ typedef struct HEVCLocalContext { - - #ifdef RPI - -+// The processing is done in chunks -+// Each chunk corresponds to 24 64x64 luma blocks (24 so it is divisible by 8 for chroma and 12 for luma) -+// This is a distance of 1536 pixels across the screen -+// Increasing RPI_NUM_CHUNKS will reduce time spent activating QPUs and cache flushing, -+// but allocate more memory and increase the latency before data in the next frame can be processed -+#define RPI_NUM_CHUNKS 1 -+ - // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code --#define RPI_MAX_WIDTH 2048 -+#define RPI_MAX_WIDTH (RPI_NUM_CHUNKS*64*24) - - // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi - #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -@@ -888,9 +895,6 @@ typedef struct HEVCPredCmd { - #endif - - typedef struct HEVCContext { --#ifdef RPI -- int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; --#endif - const AVClass *c; // needed by private avoptions - AVCodecContext *avctx; - -@@ -928,6 +932,10 @@ typedef struct HEVCContext { - int pass0_job; // Pass0 does coefficient decode - int pass1_job; // Pass1 does pixel processing - int pass2_job; // Pass2 does reconstruction and deblocking -+ int ctu_count; // Number of CTUs done in pass0 so far -+ int max_ctu_count; // Number of CTUs when we trigger a round of processing -+ int ctu_per_y_chan; // Number of CTUs per luma QPU -+ int ctu_per_uv_chan; // Number of CTUs per chroma QPU - #ifdef RPI_INTER_QPU - GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; - uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -@@ -936,6 +944,7 @@ typedef struct HEVCContext { - uint32_t *mvs_base[RPI_MAX_JOBS][8]; - // these pointers are to the next free space - uint32_t *u_mvs[RPI_MAX_JOBS][8]; -+ uint32_t *curr_u_mvs; // Current uniform stream to use for chroma - // Function pointers - uint32_t mc_filter_uv; - uint32_t mc_filter_uv_b0; -@@ -946,6 +955,7 @@ typedef struct HEVCContext { - uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands - uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; - uint32_t *y_mvs[RPI_MAX_JOBS][12]; -+ uint32_t *curr_y_mvs; // Current uniform stream for luma - // Function pointers - uint32_t mc_filter; - uint32_t mc_filter_b; -@@ -1084,6 +1094,9 @@ typedef struct HEVCContext { - uint32_t max_mastering_luminance; - uint32_t min_mastering_luminance; - -+#ifdef RPI -+ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -+#endif - } HEVCContext; - - int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index b286bbf..1f04790 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -891,7 +891,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - int n_uv = n >> s->ps.sps->vshift[1]; - int sz,base; - if (curr_uv < 0) curr_uv = 0; -- if (n_uv<=curr_uv) { assert(0); return; } // Should not happen -+ if (n_uv<=curr_uv) { return; } - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; - GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -index 325b60e..28d2653 100644 ---- a/libavcodec/hevcpred_template.c -+++ b/libavcodec/hevcpred_template.c -@@ -72,7 +72,7 @@ do { \ - else \ - a = PIXEL_SPLAT_X4(ptr[i + 3]) - #ifdef RPI_WORKER -- HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -+ HEVCLocalContextIntra *lc = (s->enable_rpi) ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; - #else - HEVCLocalContext *lc = s->HEVClc; - #endif --- -2.7.4 - - -From 1674a80d147e5342ef6ea9a4fb4ddfc640c15a05 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 4 Jun 2015 15:48:10 +0100 -Subject: [PATCH 59/68] Move deblocker into second pass - ---- - libavcodec/hevc.c | 79 +++++++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 65 insertions(+), 14 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index ec67252..6cecbdd 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -67,6 +67,8 @@ - static void rpi_execute_pred_cmds(HEVCContext *s); - static void rpi_execute_inter_cmds(HEVCContext *s); - static void rpi_begin(HEVCContext *s); -+ static void flush_frame(HEVCContext *s,AVFrame *frame); -+ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); - - // Define INTER_PASS0 to do inter prediction in first pass - //#define INTER_PASS0 -@@ -227,6 +229,11 @@ static void *worker_start(void *arg) - // Wait for transform completion - vpu_wait(s->vpu_id); - -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+ - worker_complete_middle_job(s); - LOG_EXIT - } -@@ -248,10 +255,6 @@ static void *worker_deblock_start(void *arg) - break; - } - LOG_ENTER -- // Perform intra prediction and residual reconstruction -- rpi_execute_pred_cmds(s); -- // Perform deblocking for CTBs in this row -- rpi_execute_dblk_cmds(s); - - worker_complete_job(s); - LOG_EXIT -@@ -2983,7 +2986,7 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, - static void rpi_execute_dblk_cmds(HEVCContext *s) - { - int n; -- int job = s->pass2_job; -+ int job = s->pass1_job; - int ctb_size = 1 << s->ps.sps->log2_ctb_size; - int (*p)[2] = s->dblk_cmds[job]; - for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { -@@ -3021,7 +3024,7 @@ static void rpi_execute_transform(HEVCContext *s) - static void rpi_execute_pred_cmds(HEVCContext *s) - { - int i; -- int job = s->pass2_job; -+ int job = s->pass1_job; - HEVCPredCmd *cmd = s->univ_pred_cmds[job]; - #ifdef RPI_WORKER - HEVCLocalContextIntra *lc = &s->HEVClcIntra; -@@ -3506,11 +3509,10 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) - - #ifdef RPI_MULTI_MAILBOX - #ifdef RPI_CACHE_UNIF_MVS -- gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -+ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); - #else -- gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); - #endif -- - s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, - qpu_get_fn(QPU_MC_SETUP_UV), - (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -@@ -3613,6 +3615,60 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - #endif - } - -+static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -+{ -+#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+ int curr_uv = 0; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+ iocache.s[0].addr = p->arm + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = p->arm + base; -+ iocache.s[1].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+ iocache.s[2].addr = p->arm + base; -+ iocache.s[2].size = sz; -+ -+ iocache.s[3].handle = p0->vcsm_handle; -+ iocache.s[3].cmd = 3; // clean+invalidate -+ iocache.s[3].addr = (int) p0->arm; -+ iocache.s[3].size = p0->numbytes; -+ if (p1) { -+ iocache.s[4].handle = p1->vcsm_handle; -+ iocache.s[4].cmd = 3; // clean+invalidate -+ iocache.s[4].addr = (int) p1->arm; -+ iocache.s[4].size = p1->numbytes; -+ } -+ if (p2) { -+ iocache.s[5].handle = p2->vcsm_handle; -+ iocache.s[5].cmd = 3; // clean+invalidate -+ iocache.s[5].addr = (int) p2->arm; -+ iocache.s[5].size = p2->numbytes; -+ } -+ vcsm_clean_invalid( &iocache ); -+#else -+ flush_buffer(frame->buf[0]); -+ flush_buffer(frame->buf[1]); -+ flush_buffer(frame->buf[2]); -+ gpu_cache_flush3(p0, p1, p2); -+#endif -+} -+ - #endif - - static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -@@ -4127,11 +4183,6 @@ static int hevc_frame_start(HEVCContext *s) - if (!s->avctx->hwaccel) - ff_thread_finish_setup(s->avctx); - --#ifdef RPI_INTER_QPU -- // Invalidate the output data buffer so it is ready for the QPUs to write into it. -- flush_frame(s,s->frame); --#endif -- - return 0; - - fail: --- -2.7.4 - - -From a453fe438c4ab311d6476955d0a40a5d2ed8a1c6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 4 Jun 2015 16:10:23 +0100 -Subject: [PATCH 60/68] Change order of ctu accesses to improve qpu performance - ---- - libavcodec/hevc.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 6cecbdd..ec17e64 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -3737,19 +3737,19 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; - - #ifdef RPI_INTER_QPU -- s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; -+ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count % 8]; - #endif - #ifdef RPI_LUMA_QPU -- s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; -+ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count % 12]; - #endif - - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); - - #ifdef RPI_INTER_QPU -- s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; -+ s->u_mvs[s->pass0_job][s->ctu_count % 8]= s->curr_u_mvs; - #endif - #ifdef RPI_LUMA_QPU -- s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; -+ s->y_mvs[s->pass0_job][s->ctu_count % 12] = s->curr_y_mvs; - #endif - - #ifdef RPI --- -2.7.4 - - -From 504de0435e8f660c1b7b2d6ec053dc922a2d2896 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Mon, 8 Jun 2015 09:36:59 +0100 -Subject: [PATCH 61/68] Removed deblocker thread - ---- - libavcodec/hevc.c | 77 +++---------------------------------------------------- - libavcodec/hevc.h | 4 --- - 2 files changed, 4 insertions(+), 77 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index ec17e64..1868532 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -70,11 +70,6 @@ - static void flush_frame(HEVCContext *s,AVFrame *frame); - static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); - -- // Define INTER_PASS0 to do inter prediction in first pass -- //#define INTER_PASS0 -- // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 -- //#define LAUNCH_PASS0 -- - #endif - - // #define DISABLE_MC -@@ -147,24 +142,12 @@ static void worker_submit_job(HEVCContext *s) - } - - // Call this to say we have completed pass1 --static void worker_complete_middle_job(HEVCContext *s) --{ -- LOG_ENTER -- pthread_mutex_lock(&s->worker_mutex); -- s->worker_middle++; -- s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved -- pthread_mutex_unlock(&s->worker_mutex); -- LOG_EXIT --} -- --// Call this to say we have completed pass2 - static void worker_complete_job(HEVCContext *s) - { - LOG_ENTER - pthread_mutex_lock(&s->worker_mutex); - s->worker_head++; -- s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot - pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved - pthread_mutex_unlock(&s->worker_mutex); - LOG_EXIT -@@ -208,7 +191,7 @@ static void *worker_start(void *arg) - while(1) { - pthread_mutex_lock(&s->worker_mutex); - -- while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) -+ while( !s->kill_worker && s->worker_tail - s->worker_head <= 0) - { - pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); - } -@@ -219,13 +202,9 @@ static void *worker_start(void *arg) - } - LOG_ENTER - // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); --#ifndef LAUNCH_PASS0 - rpi_launch_vpu_qpu(s); --#endif --#ifndef INTER_PASS0 - // Perform inter prediction - rpi_execute_inter_cmds(s); --#endif - // Wait for transform completion - vpu_wait(s->vpu_id); - -@@ -234,28 +213,6 @@ static void *worker_start(void *arg) - // Perform deblocking for CTBs in this row - rpi_execute_dblk_cmds(s); - -- worker_complete_middle_job(s); -- LOG_EXIT -- } -- return NULL; --} -- --static void *worker_deblock_start(void *arg) --{ -- HEVCContext *s = (HEVCContext *)arg; -- while(1) { -- pthread_mutex_lock(&s->worker_mutex); -- while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) -- { -- pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); -- } -- pthread_mutex_unlock(&s->worker_mutex); -- -- if (s->kill_worker) { -- break; -- } -- LOG_ENTER -- - worker_complete_job(s); - LOG_EXIT - } -@@ -2998,11 +2955,7 @@ static void rpi_execute_dblk_cmds(HEVCContext *s) - static void rpi_execute_transform(HEVCContext *s) - { - int i=2; --#ifdef LAUNCH_PASS0 -- int job = s->pass0_job; --#else - int job = s->pass1_job; --#endif - //int j; - //int16_t *coeffs = s->coeffs_buf_arm[i]; - //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -@@ -3057,11 +3010,7 @@ static void rpi_execute_pred_cmds(HEVCContext *s) - - static void rpi_execute_inter_cmds(HEVCContext *s) - { --#ifdef INTER_PASS0 -- int job = s->pass0_job; --#else - int job = s->pass1_job; --#endif - HEVCMvCmd *cmd = s->unif_mv_cmds[job]; - int n,cidx; - AVFrame myref; -@@ -3467,11 +3416,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) - static void rpi_launch_vpu_qpu(HEVCContext *s) - { - int k; --#ifdef LAUNCH_PASS0 -- int job = s->pass0_job; --#else - int job = s->pass1_job; --#endif - int i; - uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; - #ifdef RPI_LUMA_QPU -@@ -3574,10 +3519,12 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) - - #ifdef RPI - -+#ifndef RPI_FAST_CACHEFLUSH - static void flush_buffer(AVBufferRef *bref) { - GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); - gpu_cache_flush(p); - } -+#endif - - static void flush_frame(HEVCContext *s,AVFrame *frame) - { -@@ -3715,7 +3662,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #ifdef RPI_WORKER - s->pass0_job = 0; - s->pass1_job = 0; -- s->pass2_job = 0; - #endif - #ifdef RPI - rpi_begin(s); -@@ -3767,12 +3713,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - #ifdef RPI_WORKER - if (s->used_for_ref) { - // Split work load onto separate threads so we make as rapid progress as possible with this frame -- #ifdef INTER_PASS0 -- rpi_execute_inter_cmds(s); -- #endif -- #ifdef LAUNCH_PASS0 -- rpi_launch_vpu_qpu(s); -- #endif - // Pass on this job to worker thread - worker_submit_job(s); - // Make sure we have space to prepare the next job -@@ -3814,8 +3754,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) - // Wait for the worker to finish all its jobs - if (s->enable_rpi) { - worker_wait(s); -- av_assert0(s->pass0_job==s->pass1_job); -- av_assert0(s->pass1_job==s->pass2_job); - } - #endif - -@@ -4565,16 +4503,13 @@ static av_cold void hevc_init_worker(HEVCContext *s) - { - int err; - pthread_cond_init(&s->worker_cond_head, NULL); -- pthread_cond_init(&s->worker_cond_middle, NULL); - pthread_cond_init(&s->worker_cond_tail, NULL); - pthread_mutex_init(&s->worker_mutex, NULL); - - s->worker_tail=0; -- s->worker_middle=0; - s->worker_head=0; - s->kill_worker=0; - err = pthread_create(&s->worker_thread, NULL, worker_start, s); -- err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); - if (err) { - printf("Failed to create worker thread\n"); - exit(-1); -@@ -4586,17 +4521,13 @@ static av_cold void hevc_exit_worker(HEVCContext *s) - void *res; - s->kill_worker=1; - pthread_cond_broadcast(&s->worker_cond_tail); -- pthread_cond_broadcast(&s->worker_cond_middle); - pthread_join(s->worker_thread, &res); -- pthread_join(s->worker_deblock_thread, &res); - - pthread_cond_destroy(&s->worker_cond_head); -- pthread_cond_destroy(&s->worker_cond_middle); - pthread_cond_destroy(&s->worker_cond_tail); - pthread_mutex_destroy(&s->worker_mutex); - - s->worker_tail=0; -- s->worker_middle=0; - s->worker_head=0; - s->kill_worker=0; - } -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index a141316..ef5bfb1 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -931,7 +931,6 @@ typedef struct HEVCContext { - //GPU_MEM_PTR_T dummy; - int pass0_job; // Pass0 does coefficient decode - int pass1_job; // Pass1 does pixel processing -- int pass2_job; // Pass2 does reconstruction and deblocking - int ctu_count; // Number of CTUs done in pass0 so far - int max_ctu_count; // Number of CTUs when we trigger a round of processing - int ctu_per_y_chan; // Number of CTUs per luma QPU -@@ -963,15 +962,12 @@ typedef struct HEVCContext { - - #ifdef RPI_WORKER - pthread_t worker_thread; -- pthread_t worker_deblock_thread; - pthread_cond_t worker_cond_head; - pthread_cond_t worker_cond_tail; -- pthread_cond_t worker_cond_middle; - pthread_mutex_t worker_mutex; - - int worker_tail; // Contains the number of posted jobs - int worker_head; // Contains the number of completed jobs -- int worker_middle; // Contains the number of completed jobs - int kill_worker; // set to 1 to terminate the worker - #endif - --- -2.7.4 - - -From 74892301cdb0829de959b798debac6ffe1c71603 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Mon, 8 Jun 2015 11:04:43 +0100 -Subject: [PATCH 62/68] Reduced amount of output frame that is invalidated - ---- - libavcodec/hevc.c | 45 +++++++++++++++++++++++++++++---------------- - 1 file changed, 29 insertions(+), 16 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 1868532..cbb4f46 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -68,7 +68,7 @@ - static void rpi_execute_inter_cmds(HEVCContext *s); - static void rpi_begin(HEVCContext *s); - static void flush_frame(HEVCContext *s,AVFrame *frame); -- static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job); - - #endif - -@@ -3454,9 +3454,9 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) - - #ifdef RPI_MULTI_MAILBOX - #ifdef RPI_CACHE_UNIF_MVS -- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -+ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job], job); - #else -- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); -+ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); - #endif - s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, - qpu_get_fn(QPU_MC_SETUP_UV), -@@ -3530,6 +3530,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - { - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); - int n = s->ps.sps->height; - int curr_y = 0; - int curr_uv = 0; -@@ -3537,22 +3538,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - int sz,base; - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); - iocache.s[0].handle = p->vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = p->arm + base; -+ iocache.s[0].addr = (int)(p->arm) + base; - iocache.s[0].size = sz; - p = av_buffer_pool_opaque(frame->buf[2]); - iocache.s[1].handle = p->vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = p->arm + base; -+ iocache.s[1].addr = (int)(p->arm) + base; - iocache.s[1].size = sz; - p = av_buffer_pool_opaque(frame->buf[0]); - sz = s->frame->linesize[0] * (n-curr_y); - base = s->frame->linesize[0] * curr_y; - iocache.s[2].handle = p->vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = p->arm + base; -+ iocache.s[2].addr = (int)(p->arm) + base; - iocache.s[2].size = sz; - vcsm_clean_invalid( &iocache ); - #else -@@ -3562,33 +3562,46 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - #endif - } - --static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -+static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job) - { - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; -- int n = s->ps.sps->height; -- int curr_y = 0; -- int curr_uv = 0; -- int n_uv = n >> s->ps.sps->vshift[1]; -+ int n; -+ int curr_y; -+ int curr_uv; -+ int n_uv; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); - int sz,base; -+ int (*d)[2] = s->dblk_cmds[job]; -+ int low=(*d)[1]; -+ int high=(*d)[1]; -+ for(n = s->num_dblk_cmds[job]; n>0 ;n--,d++) { -+ int y = (*d)[1]; -+ low=FFMIN(low,y); -+ high=FFMAX(high,y); -+ } -+ curr_y = low; -+ n = high+(1 << s->ps.sps->log2_ctb_size); -+ curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ n_uv = n >> s->ps.sps->vshift[1]; -+ - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); - iocache.s[0].handle = p->vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = p->arm + base; -+ iocache.s[0].addr = (int)(p->arm) + base; - iocache.s[0].size = sz; - p = av_buffer_pool_opaque(frame->buf[2]); - iocache.s[1].handle = p->vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = p->arm + base; -+ iocache.s[1].addr = (int)(p->arm) + base; - iocache.s[1].size = sz; - p = av_buffer_pool_opaque(frame->buf[0]); - sz = s->frame->linesize[0] * (n-curr_y); - base = s->frame->linesize[0] * curr_y; - iocache.s[2].handle = p->vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = p->arm + base; -+ iocache.s[2].addr = (int)(p->arm) + base; - iocache.s[2].size = sz; - - iocache.s[3].handle = p0->vcsm_handle; --- -2.7.4 - - -From 090b6be5b501bd3c547700926e540397f0b39e69 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Mon, 8 Jun 2015 11:55:29 +0100 -Subject: [PATCH 63/68] Packed 16x16 and 32x32 into the same buffer - ---- - libavcodec/hevc.c | 24 +++++++++++++++--------- - libavcodec/hevc_cabac.c | 9 ++++++++- - libavcodec/rpi_qpu.c | 2 +- - 3 files changed, 24 insertions(+), 11 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index cbb4f46..a596534 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -299,12 +299,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; - if (!s->coeffs_buf_arm[job][0]) - goto fail; -- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); -+ gpu_malloc_cached(sizeof(int16_t) * (coefs_per_row + 32*32), &s->coeffs_buf_accelerated[job]); // We prefetch past the end so provide an extra blocks worth of data - s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; - s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; - if (!s->coeffs_buf_arm[job][2]) - goto fail; -- s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; -+ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; // This points to just beyond the end of the buffer. Coefficients fill in backwards. - s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; - } - } -@@ -2956,15 +2956,20 @@ static void rpi_execute_transform(HEVCContext *s) - { - int i=2; - int job = s->pass1_job; -- //int j; -- //int16_t *coeffs = s->coeffs_buf_arm[i]; -- //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -- // s->hevcdsp.idct[4-2](coeffs, 16); -- //} -+ /*int j; -+ int16_t *coeffs = s->coeffs_buf_arm[job][i]; -+ for(j=s->num_coeffs[job][i]; j > 0; j-= 16*16, coeffs+=16*16) { -+ s->hevcdsp.idct[4-2](coeffs, 16); -+ } -+ i=3; -+ coeffs = s->coeffs_buf_arm[job][i] - s->num_coeffs[job][i]; -+ for(j=s->num_coeffs[job][i]; j > 0; j-= 32*32, coeffs+=32*32) { -+ s->hevcdsp.idct[5-2](coeffs, 32); -+ }*/ - - gpu_cache_flush(&s->coeffs_buf_accelerated[job]); - s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], -- s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], -+ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], - s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); - //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); - //gpu_cache_flush(&s->coeffs_buf_accelerated); -@@ -3458,7 +3463,8 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) - #else - flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); - #endif -- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, -+ s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], s->num_coeffs[job][3] >> 10, 0, - qpu_get_fn(QPU_MC_SETUP_UV), - (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), - (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 6523e66..8656917 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -1051,7 +1051,14 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - if (s->enable_rpi) { - int n = trafo_size * trafo_size; - if (use_vpu) { -- coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -+ // We support size 4 and size 5. -+ // Size 4 grows from the front (Coeffs_buf_arm[2] points to start of buf) -+ // Size 5 grows from the back (Coeffs_buf_arm[3] points to end of buf) -+ // num_coeffs is indexed by log2_trafo_size-2 -+ if (log2_trafo_size == 4) -+ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -+ else -+ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] - s->num_coeffs[s->pass0_job][log2_trafo_size - 2] - n; - s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; - } else { - coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 4480f72..0121fca 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -5,7 +5,7 @@ - // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code - //#define RPI_TIME_TOTAL_VPU - // define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined --//#define RPI_TIME_TOTAL_POSTED -+#define RPI_TIME_TOTAL_POSTED - // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion - #define RPI_ASYNC - --- -2.7.4 - - -From ed359bbce56817bf9db0e54701103bd0505c353b Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Thu, 25 Jun 2015 09:02:47 +0100 -Subject: [PATCH 64/68] Moved luma deblock to VPU - ---- - libavcodec/hevc.c | 18 +- - libavcodec/hevc.h | 11 + - libavcodec/hevc_filter.c | 120 ++- - libavcodec/rpi_hevc_transform.h | 1802 ++++++++++++++++++++++++++++++++++++++- - libavcodec/rpi_hevc_transform.s | 426 +++++++++ - libavcodec/rpi_qpu.c | 12 +- - libavcodec/rpi_shader.c | 2 +- - 7 files changed, 2378 insertions(+), 13 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index a596534..4ce94a7 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -246,6 +246,12 @@ static void pic_arrays_free(HEVCContext *s) - } - } - #endif -+#ifdef RPI_DEBLOCK_VPU -+ if (s->y_setup_arm) { -+ gpu_free(&s->y_setup_ptr); -+ s->y_setup_arm = 0; -+ } -+#endif - av_freep(&s->sao); - av_freep(&s->deblock); - -@@ -283,12 +289,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - int min_pu_size = sps->min_pu_width * sps->min_pu_height; - - #ifdef RPI -- av_assert0(sps); - int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); - int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; - int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; - int coefs_per_row = coefs_per_luma + coefs_per_chroma; - int job; -+ av_assert0(sps); - s->max_ctu_count = coefs_per_luma / coefs_in_ctb; - s->ctu_per_y_chan = s->max_ctu_count / 12; - s->ctu_per_uv_chan = s->max_ctu_count / 8; -@@ -309,6 +315,16 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - } - } - #endif -+#ifdef RPI_DEBLOCK_VPU -+ s->enable_rpi_deblock = !sps->sao_enabled; -+ s->setup_width = (sps->width+15) / 16; -+ s->setup_height = (sps->height+15) / 16; -+ gpu_malloc_uncached(sizeof(*s->y_setup_arm) * s->setup_width * s->setup_height, &s->y_setup_ptr); // TODO make this cached -+ s->y_setup_arm = (void*)s->y_setup_ptr.arm; -+ s->y_setup_vc = (void*)s->y_setup_ptr.vc; -+ memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); -+ printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); -+#endif - - s->bs_width = (width >> 2) + 1; - s->bs_height = (height >> 2) + 1; -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index ef5bfb1..cf08489 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -57,6 +57,8 @@ - // Define RPI_WORKER to launch a worker thread for pixel processing tasks - #define RPI_WORKER - -+ #define RPI_DEBLOCK_VPU -+ - #endif - - #define MAX_DPB_SIZE 16 // A.4.1 -@@ -971,6 +973,15 @@ typedef struct HEVCContext { - int kill_worker; // set to 1 to terminate the worker - #endif - -+#ifdef RPI_DEBLOCK_VPU -+ int enable_rpi_deblock; -+ GPU_MEM_PTR_T y_setup_ptr; -+ uint8_t (*y_setup_arm)[2][2][2][4]; -+ uint8_t (*y_setup_vc)[2][2][2][4]; -+ int setup_width; // Number of 16x16 blocks across the image -+ int setup_height; // Number of 16x16 blocks down the image -+#endif -+ - #endif - - uint8_t *cabac_state; -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 1f04790..06371da 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -564,6 +564,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->frame->linesize[LUMA], - beta, tc, no_p, no_q); - } else -+#ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock) { -+ uint8_t (*setup)[2][2][4]; -+ int num16 = (y>>4)*s->setup_width + (x>>4); -+ int a = ((y>>3) & 1) << 1; -+ int b = (x>>3) & 1; -+ setup = s->y_setup_arm[num16]; -+ setup[0][b][0][a] = beta; -+ setup[0][b][0][a + 1] = beta; -+ setup[0][b][1][a] = tc[0]; -+ setup[0][b][1][a + 1] = tc[1]; -+ } else -+#endif - s->hevcdsp.hevc_v_loop_filter_luma(src, - s->frame->linesize[LUMA], - beta, tc, no_p, no_q); -@@ -596,6 +609,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->frame->linesize[LUMA], - beta, tc, no_p, no_q); - } else -+#ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock) { -+ uint8_t (*setup)[2][2][4]; -+ int num16 = (y>>4)*s->setup_width + (x>>4); -+ int a = ((x>>3) & 1) << 1; -+ int b = (y>>3) & 1; -+ setup = s->y_setup_arm[num16]; -+ setup[1][b][0][a] = beta; -+ setup[1][b][0][a + 1] = beta; -+ setup[1][b][1][a] = tc[0]; -+ setup[1][b][1][a + 1] = tc[1]; -+ } else -+#endif - s->hevcdsp.hevc_h_loop_filter_luma(src, - s->frame->linesize[LUMA], - beta, tc, no_p, no_q); -@@ -876,33 +902,85 @@ static void flush_buffer(AVBufferRef *bref) { - } - - // Return Physical address for this image --static int ff_hevc_buf_base(AVBufferRef *bref) { -+static uint32_t get_vc_address(AVBufferRef *bref) { - GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -- return p->vc & 0x3fffffff; -+ return p->vc; - } - -+// ff_hevc_flush_buffer_lines -+// flushes and invalidates all pixel rows in [start,end-1] -+static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) -+{ -+#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int curr_y = start; -+ int n = end; -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+ GPU_MEM_PTR_T *p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ if (flush_chroma) { -+ p = av_buffer_pool_opaque(s->frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+ iocache.s[0].addr = (int)p->arm + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(s->frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = (int)p->arm + base; -+ iocache.s[1].size = sz; -+ } -+ if (flush_luma) { -+ p = av_buffer_pool_opaque(s->frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+ iocache.s[2].addr = (int)p->arm + base; -+ iocache.s[2].size = sz; -+ } -+ vcsm_clean_invalid( &iocache ); -+#else -+ if (flush_chroma) { -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+ } -+ if (flush_luma) { -+ flush_buffer(s->frame->buf[0]); -+ } -+#endif -+} -+ -+ - void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - { - if (s->enable_rpi && s->used_for_ref) { -+ // TODO make this use ff_hevc_flush_buffer_lines - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; - int curr_y = ((int *)f->progress->data)[0]; - int curr_uv = curr_y >> s->ps.sps->vshift[1]; - int n_uv = n >> s->ps.sps->vshift[1]; - int sz,base; -+ GPU_MEM_PTR_T *p; - if (curr_uv < 0) curr_uv = 0; - if (n_uv<=curr_uv) { return; } - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -+ p = av_buffer_pool_opaque(s->frame->buf[1]); - iocache.s[0].handle = p->vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = p->arm + base; -+ iocache.s[0].addr = (int)p->arm + base; - iocache.s[0].size = sz; - p = av_buffer_pool_opaque(s->frame->buf[2]); - iocache.s[1].handle = p->vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = p->arm + base; -+ iocache.s[1].addr = (int)p->arm + base; - iocache.s[1].size = sz; - - #ifdef RPI_LUMA_QPU -@@ -911,7 +989,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - base = s->frame->linesize[0] * curr_y; - iocache.s[2].handle = p->vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = p->arm + base; -+ iocache.s[2].addr = (int)p->arm + base; - iocache.s[2].size = sz; - #endif - vcsm_clean_invalid( &iocache ); -@@ -930,11 +1008,40 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - } - #endif - -+#ifdef RPI_DEBLOCK_VPU -+/* rpi_deblock deblocks an entire row of ctbs using the VPU */ -+static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+{ -+ // Flush image, 4 lines above to bottom of ctb stripe -+ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); -+ // TODO flush buffer of beta/tc setup when it becomes cached -+ // Call VPU -+ // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion -+ vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], -+ s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), -+ ctb_size>>4, 2, 0)); // 2 means to do the deblocking code -+} -+ -+static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) -+{ -+ int y2; -+ for(y2=y;y2= s->ps.sps->width - ctb_size; - if (s->avctx->skip_loop_filter < AVDISCARD_ALL) - deblocking_filter_CTB(s, x, y); -+#ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock && x_end) -+ { -+ rpi_deblock(s, y, ctb_size); -+ } -+#endif - if (s->ps.sps->sao_enabled) { - int y_end = y >= s->ps.sps->height - ctb_size; - if (y && x) -@@ -965,6 +1072,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - //if (((y + ctb_size)&63)==0) - #ifdef RPI_INTER_QPU - ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -+ // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi - #endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); - } -diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -index 4f13622..b3f155f 100644 ---- a/libavcodec/rpi_hevc_transform.h -+++ b/libavcodec/rpi_hevc_transform.h -@@ -3,7 +3,13 @@ unsigned char rpi_hevc_transform [] = { - 106, - 0, - 144, --35, -+38, -+1, -+37, -+106, -+0, -+144, -+57, - 1, - 169, - 3, -@@ -627,4 +633,1798 @@ unsigned char rpi_hevc_transform [] = { - 30, - 90, - 0, -+169, -+3, -+73, -+64, -+52, -+64, -+45, -+64, -+2, -+64, -+10, -+64, -+64, -+198, -+1, -+7, -+8, -+232, -+63, -+0, -+0, -+0, -+6, -+232, -+253, -+255, -+255, -+255, -+0, -+246, -+0, -+0, -+0, -+4, -+215, -+64, -+3, -+96, -+2, -+248, -+0, -+35, -+0, -+0, -+64, -+56, -+0, -+0, -+4, -+248, -+0, -+36, -+0, -+0, -+64, -+56, -+8, -+0, -+0, -+240, -+64, -+0, -+132, -+3, -+128, -+240, -+0, -+0, -+132, -+3, -+128, -+144, -+137, -+0, -+131, -+98, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+129, -+0, -+131, -+102, -+0, -+158, -+67, -+0, -+2, -+248, -+0, -+35, -+0, -+0, -+64, -+56, -+0, -+0, -+4, -+248, -+0, -+36, -+0, -+0, -+64, -+56, -+8, -+0, -+0, -+240, -+64, -+0, -+132, -+3, -+128, -+240, -+0, -+0, -+132, -+3, -+128, -+144, -+108, -+0, -+131, -+98, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+100, -+0, -+131, -+102, -+0, -+248, -+64, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+128, -+248, -+0, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+128, -+144, -+161, -+0, -+188, -+64, -+67, -+232, -+0, -+2, -+0, -+0, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+150, -+0, -+195, -+232, -+0, -+2, -+0, -+0, -+12, -+128, -+7, -+192, -+130, -+248, -+0, -+0, -+112, -+192, -+224, -+16, -+195, -+31, -+132, -+248, -+1, -+0, -+112, -+0, -+224, -+16, -+203, -+31, -+3, -+99, -+131, -+71, -+68, -+232, -+32, -+0, -+0, -+0, -+0, -+99, -+2, -+99, -+23, -+102, -+7, -+106, -+127, -+156, -+182, -+255, -+0, -+248, -+64, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+128, -+248, -+0, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+128, -+144, -+112, -+0, -+188, -+64, -+67, -+232, -+0, -+2, -+0, -+0, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+101, -+0, -+195, -+232, -+0, -+2, -+0, -+0, -+12, -+128, -+7, -+192, -+130, -+248, -+0, -+0, -+112, -+192, -+224, -+16, -+195, -+31, -+132, -+248, -+1, -+0, -+112, -+0, -+224, -+16, -+203, -+31, -+25, -+102, -+9, -+106, -+2, -+30, -+41, -+3, -+26, -+87, -+162, -+64, -+64, -+198, -+1, -+23, -+127, -+158, -+103, -+255, -+239, -+3, -+0, -+254, -+0, -+143, -+92, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+64, -+143, -+93, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+128, -+143, -+94, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+143, -+95, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+142, -+208, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+128, -+142, -+209, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+64, -+142, -+210, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+0, -+142, -+211, -+0, -+0, -+240, -+12, -+0, -+128, -+144, -+107, -+0, -+8, -+255, -+99, -+23, -+0, -+212, -+192, -+51, -+0, -+0, -+8, -+255, -+163, -+23, -+0, -+228, -+192, -+51, -+0, -+0, -+8, -+255, -+227, -+23, -+0, -+244, -+192, -+51, -+0, -+0, -+8, -+255, -+35, -+52, -+0, -+180, -+192, -+51, -+0, -+0, -+8, -+255, -+99, -+52, -+0, -+164, -+192, -+51, -+0, -+0, -+8, -+255, -+163, -+52, -+0, -+148, -+192, -+51, -+0, -+0, -+111, -+3, -+239, -+3, -+0, -+254, -+0, -+143, -+12, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+64, -+143, -+13, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+128, -+143, -+14, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+143, -+15, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+142, -+16, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+128, -+142, -+17, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+64, -+142, -+18, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+0, -+142, -+19, -+0, -+0, -+240, -+12, -+0, -+128, -+144, -+33, -+0, -+8, -+255, -+99, -+3, -+0, -+212, -+192, -+51, -+0, -+0, -+8, -+255, -+163, -+3, -+0, -+228, -+192, -+51, -+0, -+0, -+8, -+255, -+227, -+3, -+0, -+244, -+192, -+51, -+0, -+0, -+8, -+255, -+35, -+4, -+0, -+180, -+192, -+51, -+0, -+0, -+8, -+255, -+99, -+4, -+0, -+164, -+192, -+51, -+0, -+0, -+8, -+255, -+163, -+4, -+0, -+148, -+192, -+51, -+0, -+0, -+111, -+3, -+32, -+246, -+192, -+11, -+1, -+16, -+32, -+246, -+2, -+137, -+47, -+240, -+40, -+246, -+2, -+140, -+47, -+240, -+128, -+245, -+99, -+140, -+5, -+4, -+0, -+247, -+99, -+140, -+1, -+20, -+88, -+246, -+99, -+140, -+1, -+20, -+0, -+247, -+35, -+136, -+62, -+226, -+32, -+247, -+35, -+136, -+32, -+210, -+0, -+247, -+34, -+136, -+63, -+2, -+208, -+246, -+34, -+136, -+0, -+4, -+0, -+247, -+99, -+136, -+58, -+162, -+32, -+247, -+99, -+136, -+33, -+146, -+0, -+247, -+98, -+136, -+59, -+18, -+208, -+246, -+98, -+136, -+0, -+20, -+0, -+247, -+162, -+136, -+33, -+2, -+88, -+246, -+98, -+137, -+2, -+68, -+88, -+246, -+162, -+137, -+3, -+68, -+208, -+254, -+227, -+136, -+60, -+242, -+192, -+243, -+188, -+11, -+208, -+254, -+227, -+136, -+56, -+178, -+192, -+243, -+188, -+10, -+32, -+255, -+226, -+136, -+38, -+58, -+192, -+243, -+60, -+0, -+208, -+254, -+227, -+136, -+59, -+242, -+192, -+243, -+60, -+128, -+32, -+255, -+226, -+136, -+49, -+58, -+192, -+243, -+60, -+128, -+0, -+255, -+226, -+136, -+34, -+34, -+192, -+243, -+60, -+128, -+32, -+255, -+226, -+136, -+37, -+58, -+192, -+243, -+60, -+128, -+0, -+254, -+192, -+136, -+1, -+4, -+0, -+240, -+0, -+160, -+0, -+255, -+194, -+8, -+0, -+52, -+195, -+243, -+0, -+128, -+0, -+255, -+202, -+40, -+0, -+52, -+195, -+243, -+0, -+128, -+0, -+254, -+0, -+240, -+35, -+10, -+0, -+240, -+60, -+0, -+0, -+254, -+192, -+136, -+1, -+4, -+0, -+240, -+0, -+160, -+0, -+255, -+226, -+140, -+34, -+34, -+195, -+243, -+60, -+0, -+32, -+255, -+227, -+140, -+36, -+58, -+192, -+243, -+60, -+0, -+0, -+254, -+192, -+136, -+0, -+4, -+0, -+240, -+0, -+160, -+16, -+246, -+226, -+136, -+35, -+50, -+16, -+246, -+226, -+136, -+35, -+50, -+32, -+246, -+226, -+136, -+35, -+50, -+32, -+254, -+226, -+136, -+35, -+58, -+192, -+243, -+60, -+0, -+11, -+96, -+0, -+254, -+0, -+240, -+1, -+4, -+0, -+240, -+64, -+115, -+5, -+106, -+0, -+144, -+173, -+1, -+27, -+96, -+0, -+254, -+0, -+240, -+1, -+4, -+0, -+240, -+64, -+147, -+5, -+106, -+0, -+144, -+227, -+0, -+64, -+246, -+163, -+140, -+1, -+4, -+0, -+246, -+192, -+175, -+63, -+2, -+0, -+246, -+192, -+174, -+59, -+2, -+0, -+246, -+128, -+175, -+62, -+2, -+0, -+246, -+128, -+174, -+58, -+2, -+0, -+246, -+64, -+175, -+61, -+2, -+0, -+246, -+64, -+174, -+57, -+2, -+0, -+255, -+43, -+240, -+4, -+212, -+192, -+243, -+128, -+11, -+64, -+254, -+43, -+240, -+1, -+228, -+192, -+243, -+128, -+10, -+64, -+254, -+43, -+240, -+1, -+244, -+192, -+243, -+128, -+10, -+64, -+254, -+43, -+240, -+1, -+180, -+192, -+243, -+128, -+10, -+64, -+254, -+43, -+141, -+0, -+164, -+192, -+243, -+128, -+10, -+88, -+246, -+35, -+141, -+3, -+68, -+32, -+247, -+35, -+141, -+191, -+66, -+240, -+246, -+35, -+141, -+50, -+66, -+0, -+255, -+235, -+143, -+52, -+242, -+192, -+243, -+60, -+128, -+0, -+255, -+43, -+240, -+2, -+212, -+192, -+243, -+128, -+11, -+0, -+255, -+43, -+240, -+191, -+226, -+192, -+243, -+188, -+10, -+64, -+254, -+43, -+141, -+0, -+180, -+192, -+243, -+128, -+10, -+88, -+246, -+35, -+141, -+2, -+68, -+32, -+247, -+35, -+141, -+190, -+66, -+240, -+246, -+35, -+141, -+50, -+66, -+0, -+255, -+171, -+143, -+52, -+226, -+192, -+243, -+60, -+128, -+0, -+255, -+43, -+240, -+4, -+180, -+192, -+243, -+128, -+11, -+0, -+255, -+43, -+240, -+191, -+226, -+192, -+243, -+188, -+10, -+128, -+253, -+43, -+240, -+3, -+212, -+192, -+243, -+128, -+10, -+64, -+254, -+35, -+141, -+1, -+196, -+192, -+243, -+128, -+10, -+88, -+246, -+35, -+141, -+3, -+68, -+32, -+247, -+35, -+141, -+189, -+66, -+240, -+246, -+35, -+141, -+50, -+66, -+0, -+255, -+107, -+143, -+52, -+210, -+192, -+243, -+60, -+128, -+0, -+255, -+43, -+240, -+4, -+148, -+192, -+243, -+128, -+11, -+64, -+254, -+43, -+240, -+1, -+164, -+192, -+243, -+128, -+10, -+64, -+254, -+43, -+240, -+1, -+180, -+192, -+243, -+128, -+10, -+64, -+254, -+43, -+240, -+1, -+244, -+192, -+243, -+128, -+10, -+64, -+254, -+43, -+141, -+0, -+228, -+192, -+243, -+128, -+10, -+88, -+246, -+35, -+141, -+3, -+68, -+32, -+247, -+35, -+141, -+187, -+66, -+240, -+246, -+35, -+141, -+50, -+66, -+0, -+255, -+235, -+142, -+52, -+178, -+192, -+243, -+60, -+128, -+0, -+255, -+43, -+240, -+2, -+148, -+192, -+243, -+128, -+11, -+0, -+255, -+43, -+240, -+187, -+162, -+192, -+243, -+188, -+10, -+64, -+254, -+43, -+141, -+0, -+244, -+192, -+243, -+128, -+10, -+88, -+246, -+35, -+141, -+2, -+68, -+32, -+247, -+35, -+141, -+186, -+66, -+240, -+246, -+35, -+141, -+50, -+66, -+0, -+255, -+171, -+142, -+52, -+162, -+192, -+243, -+60, -+128, -+0, -+255, -+43, -+240, -+4, -+244, -+192, -+243, -+128, -+11, -+0, -+255, -+43, -+240, -+187, -+162, -+192, -+243, -+188, -+10, -+128, -+253, -+43, -+240, -+3, -+148, -+192, -+243, -+128, -+10, -+64, -+254, -+35, -+141, -+1, -+132, -+192, -+243, -+128, -+10, -+88, -+246, -+35, -+141, -+3, -+68, -+32, -+247, -+35, -+141, -+185, -+66, -+240, -+246, -+35, -+141, -+50, -+66, -+0, -+255, -+107, -+142, -+52, -+146, -+192, -+243, -+60, -+128, -+64, -+255, -+98, -+141, -+0, -+52, -+192, -+243, -+0, -+0, -+0, -+254, -+0, -+240, -+53, -+10, -+0, -+240, -+60, -+0, -+0, -+254, -+0, -+240, -+1, -+4, -+0, -+240, -+64, -+147, -+5, -+106, -+0, -+144, -+177, -+0, -+88, -+246, -+163, -+140, -+1, -+4, -+128, -+245, -+99, -+141, -+10, -+4, -+88, -+246, -+162, -+138, -+1, -+68, -+0, -+247, -+162, -+138, -+36, -+162, -+88, -+254, -+162, -+138, -+3, -+164, -+192, -+243, -+128, -+11, -+0, -+255, -+226, -+137, -+32, -+2, -+195, -+243, -+60, -+0, -+32, -+247, -+226, -+137, -+42, -+114, -+0, -+255, -+34, -+138, -+33, -+18, -+195, -+243, -+60, -+0, -+32, -+247, -+34, -+138, -+42, -+130, -+16, -+246, -+98, -+138, -+40, -+114, -+16, -+246, -+98, -+138, -+41, -+146, -+32, -+246, -+98, -+138, -+41, -+146, -+32, -+246, -+226, -+137, -+41, -+146, -+40, -+246, -+34, -+138, -+41, -+146, -+32, -+247, -+163, -+141, -+63, -+178, -+32, -+247, -+227, -+141, -+62, -+162, -+0, -+254, -+0, -+240, -+8, -+4, -+0, -+240, -+128, -+11, -+128, -+253, -+35, -+240, -+9, -+100, -+192, -+243, -+128, -+10, -+128, -+253, -+163, -+141, -+128, -+115, -+192, -+243, -+152, -+10, -+88, -+246, -+163, -+141, -+4, -+100, -+208, -+246, -+35, -+139, -+0, -+100, -+32, -+255, -+34, -+139, -+53, -+202, -+192, -+243, -+60, -+128, -+0, -+254, -+0, -+139, -+0, -+4, -+0, -+240, -+0, -+160, -+240, -+246, -+163, -+141, -+48, -+98, -+0, -+247, -+99, -+139, -+63, -+210, -+0, -+247, -+98, -+139, -+1, -+212, -+88, -+254, -+98, -+139, -+1, -+212, -+192, -+243, -+128, -+11, -+32, -+255, -+99, -+139, -+62, -+98, -+192, -+243, -+188, -+10, -+88, -+246, -+98, -+139, -+1, -+212, -+240, -+246, -+98, -+139, -+50, -+210, -+0, -+247, -+163, -+128, -+59, -+146, -+0, -+247, -+160, -+128, -+1, -+36, -+88, -+254, -+160, -+128, -+1, -+36, -+192, -+243, -+128, -+11, -+0, -+247, -+163, -+128, -+58, -+98, -+64, -+255, -+35, -+240, -+0, -+100, -+192, -+243, -+128, -+10, -+64, -+255, -+163, -+128, -+0, -+164, -+192, -+243, -+128, -+10, -+88, -+246, -+160, -+128, -+1, -+36, -+240, -+246, -+160, -+128, -+50, -+34, -+8, -+255, -+227, -+143, -+54, -+242, -+192, -+243, -+60, -+128, -+40, -+255, -+227, -+142, -+54, -+178, -+192, -+243, -+60, -+128, -+0, -+254, -+0, -+240, -+39, -+10, -+0, -+240, -+60, -+128, -+8, -+255, -+163, -+143, -+45, -+226, -+192, -+243, -+60, -+128, -+0, -+254, -+0, -+240, -+44, -+10, -+0, -+240, -+60, -+0, -+0, -+254, -+0, -+240, -+40, -+10, -+0, -+240, -+60, -+128, -+8, -+255, -+163, -+142, -+2, -+162, -+192, -+243, -+60, -+128, -+90, -+0, - }; -diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -index fd159bc..b055208 100644 ---- a/libavcodec/rpi_hevc_transform.s -+++ b/libavcodec/rpi_hevc_transform.s -@@ -83,6 +83,8 @@ - hevc_trans_16x16: - cmp r5,1 - beq memclear16 -+ cmp r5,2 -+ beq hevc_deblock_16x16 - push r6-r15, lr # TODO cut down number of used registers - mov r14,r3 # coeffs32 - mov r15,r4 # num32 -@@ -282,3 +284,427 @@ loop: - cmp r1,0 - bgt loop - b lr -+ -+ -+################################################################################ -+# HEVC VPU Deblock -+# -+# Vertical edges before horizontal -+# Decision can change every 4 pixels, but only 8 pixel boundaries are deblocked -+# -+# ARM is responsible for storing beta and tc for each 4 pixels horiz and vert edge. -+# The VPU code works in units of 16x16 blocks. -+# We do vertical filtering for the current block followed by horizontal filtering for the previous (except for the first time). -+# One final horizontal filter is required at the end. -+# PCM is not allowed in this code. -+# -+# -+# H(16-4:16+15,0) contains previous block (note that we need 4 lines above of context that may get altered during filtering) -+# H(16:31,16) contains current block (note that we do not need the upper lines until the horizontal filtering. -+ -+.set P0,63 -+.set P1,62 -+.set P2,61 -+.set P3,60 -+.set Q0,59 -+.set Q1,58 -+.set Q2,57 -+.set Q3,56 -+ -+.set dp,32 -+.set dq,33 -+.set d,34 -+.set decision,35 -+.set beta,36 -+.set beta2,37 -+.set beta3,38 -+.set ptest,39 -+.set qtest,40 -+.set pqtest,41 -+.set thresh,42 -+.set deltatest, 44 -+.set deltap1, 45 -+.set tc25, 46 -+.set setup,47 -+.set tc,48 -+.set tc25,49 -+.set tc2, 50 -+.set do_filter, 51 -+.set delta, 52 -+.set tc10, 53 -+.set delta0, 54 -+.set delta1, 55 -+.set zeros, 0 -+.set setup_input, 1 -+.set deltaq1, 2 -+ -+ -+ -+# hevc_deblock_16x16 deblocks an entire row that is 16 pixels high by the full width of the image. -+# Row has num16 16x16 blocks across -+# Beta goes from 0 to 64 -+# tc goes from 0 to 24 -+# setup[block_idx][0=vert,1=horz][0=first edge, 1=second edge][0=beta,1=tc][0..3=edge number] -+# has 8 bytes per edge -+# has 16 bytes per direction -+# has 32 bytes per 16x16 block -+# hevc_deblock_16x16(uint8_t *img (r0), int stride (r1), int num16w (r2), uint8_t setup[num16][2][2][2][4](r3),int num16h(r4)) -+hevc_deblock_16x16: -+ push r6-r15, lr -+ mov r9,r4 -+ mov r4,r3 -+ mov r13,r2 -+ mov r2,r0 -+ mov r10,r0 -+ subscale4 r0,r1 -+ mov r8,63 -+ mov r6,-3 -+ vmov H(zeros,0),0 -+# r7 is number of blocks still to load -+# r0 is location of current block - 4 * stride -+# r1 is stride -+# r2 is location of current block -+# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical -+# r4 is setup -+# r5 is for temporary calculations -+# r8 holds 63 -+# r6 holds -3 -+# r9 holds the number of 16 high rows to process -+# r10 holds the original img base -+# r11 returns 0 if no filtering was done on the edge -+# r12 saves a copy of this -+# r13 is copy of width -+ -+process_row: -+ # First iteration does not do horizontal filtering on previous -+ mov r7, r13 -+ mov r3,0 -+ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block -+ vldb H(16++,16)+r3,(r2 += r1) REP 16 -+ vldb H(setup_input,0), (r4) # We may wish to prefetch these -+ vstb H(zeros,0),(r4) -+ bl vert_filter -+ add r3,8 -+ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 -+ bl vert_filter -+ sub r3,8 -+ b start_deblock_loop -+deblock_loop: -+ # Middle iterations do vertical on current block and horizontal on preceding -+ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block -+ vldb H(16++,16)+r3,(r2 += r1) REP 16 -+ vldb H(setup_input,0), (r4) -+ vstb H(zeros,0),(r4) -+ bl vert_filter -+ add r3,8 -+ vadd H(setup_input,0),H(setup_input,8),0 -+ bl vert_filter -+ sub r3,8 -+ vldb H(setup_input,0), -16(r4) -+ vstb H(zeros,0),-16(r4) -+ bl horz_filter -+ mov r12,r11 -+ add r3,8*64 -+ vadd H(setup_input,0),H(setup_input,8),0 -+ bl horz_filter -+ sub r3,8*64 -+ addcmpbeq r12,0,0,skip_save_top -+ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -+skip_save_top: -+ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -+start_deblock_loop: -+ # move onto next 16x16 (could do this with circular buffer support instead) -+ add r3,16 -+ and r3,r8 -+ add r4,32 -+ # Perform loop counter operations (may work with an addcmpbgt as well?) -+ add r0,16 -+ add r2,16 -+ sub r7,1 -+ cmp r7,0 # Are there still more blocks to load -+ bgt deblock_loop -+ -+ # Final iteration needs to just do horizontal filtering -+ vldb H(setup_input,0), -16(r4) -+ vstb H(zeros,0),-16(r4) -+ bl horz_filter -+ mov r12,r11 -+ add r3,8*64 -+ vadd H(setup_input,0),H(setup_input,8),0 -+ bl horz_filter -+ sub r3,64*8 -+ addcmpbeq r12,0,0,skip_save_top2 -+ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -+skip_save_top2: -+ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -+ -+# Now look to see if we should do another row -+ sub r9,1 -+ cmp r9,0 -+ bgt start_again -+ pop r6-r15, pc -+start_again: -+ # Need to sort out r0,r2 to point to next row down -+ addscale16 r10,r1 -+ mov r2,r10 -+ subscale4 r0,r2,r1 -+ b process_row -+ -+ -+# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered -+# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations -+ -+vert_filter: -+ push lr -+ -+ vmov HX(P3,0), V(16,12)+r3 -+ vmov HX(P2,0), V(16,13)+r3 -+ vmov HX(P1,0), V(16,14)+r3 -+ vmov HX(P0,0), V(16,15)+r3 -+ vmov HX(Q0,0), V(16,16)+r3 -+ vmov HX(Q1,0), V(16,17)+r3 -+ vmov HX(Q2,0), V(16,18)+r3 -+ vmov HX(Q3,0), V(16,19)+r3 -+ -+ bl do_luma_filter -+ -+ vadds V(16,13)+r3, HX(P2,0), 0 -+ vadds V(16,14)+r3, HX(P1,0), 0 -+ vadds V(16,15)+r3, HX(P0,0), 0 -+ # P3 and Q3 never change so don't bother saving back -+ vadds V(16,16)+r3, HX(Q0,0), 0 -+ vadds V(16,17)+r3, HX(Q1,0), 0 -+ vadds V(16,18)+r3, HX(Q2,0), 0 -+ -+ pop pc -+ -+# Filter edge at H(16,0)+r3 -+horz_filter: -+ push lr -+ -+ vmov HX(P3,0), H(12,0)+r3 -+ vmov HX(P2,0), H(13,0)+r3 -+ vmov HX(P1,0), H(14,0)+r3 -+ vmov HX(P0,0), H(15,0)+r3 -+ vmov HX(Q0,0), H(16,0)+r3 -+ vmov HX(Q1,0), H(17,0)+r3 -+ vmov HX(Q2,0), H(18,0)+r3 -+ vmov HX(Q3,0), H(19,0)+r3 -+ -+ bl do_luma_filter -+ -+ vadds H(13,0)+r3, HX(P2,0), 0 -+ vadds H(14,0)+r3, HX(P1,0), 0 -+ vadds H(15,0)+r3, HX(P0,0), 0 -+ # P3 and Q3 never change so don't bother saving back -+ vadds H(16,0)+r3, HX(Q0,0), 0 -+ vadds H(17,0)+r3, HX(Q1,0), 0 -+ vadds H(18,0)+r3, HX(Q2,0), 0 -+ -+ pop pc -+ -+# r4 points to array of beta/tc for each 4 length edge -+do_luma_filter: -+ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # b*8tc*8 -+ valtl HX(beta,0),H(setup,0),H(setup,0) -+ valtu HX(tc,0),H(setup,0),H(setup,0) -+ vmul HX(tc25,0), HX(tc,0), 5 -+ vadd HX(tc25,0),HX(tc25,0), 1 -+ vasr HX(tc25,0), HX(tc25,0), 1 -+ -+ # Compute decision -+ vadd HX(dp,0),HX(P1,0),HX(P1,0) # 2*P1 -+ vsub HX(dp,0),HX(P2,0),HX(dp,0) # P2-2*P1 -+ vadd HX(dp,0),HX(dp,0),HX(P0,0) # P2-2*P1+P0 -+ vdist HX(dp,0),HX(dp,0),0 # abs(P2-2*P1+P0) # dp0 -+ -+ vadd HX(dq,0),HX(Q1,0),HX(Q1,0) # 2*Q1 -+ vsub HX(dq,0),HX(Q2,0),HX(dq,0) # Q2-2*Q1 -+ vadd HX(dq,0),HX(dq,0),HX(Q0,0) # Q2-2*Q1+Q0 -+ vdist HX(dq,0),HX(dq,0),0 # abs(Q2-2*Q1+Q0) # dq0 -+ -+ vadd HX(d,0), HX(dp,0), HX(dq,0) -+ vasr HX(beta2,0),HX(beta,0),2 -+ vasr HX(beta3,0),HX(beta,0),3 -+ -+ # Compute flags that are negative if all conditions pass -+ vdist HX(decision,0), HX(P0,0), HX(P3,0) CLRA SACC -+ vdist HX(decision,0), HX(Q0,0), HX(Q3,0) SACC -+ vsub HX(decision,0), HX(decision,0), HX(beta3,0) SETF -+ -+ vdist HX(decision,0), HX(P0,0), HX(Q0,0) IFN -+ vsub HX(decision,0), HX(decision,0), HX(tc25,0) IFN SETF -+ vadd HX(decision,0), HX(d,0), HX(d,0) IFN -+ vsub HX(decision,0), HX(decision,0), HX(beta2,0) IFN SETF -+ vmov HX(decision,0), 1 IFNN -+ vadd H(decision,0),H(decision,3),0 IFN -+ vadd H(decision,16),H(decision,19),0 IFN -+ vmov -,HX(decision,0) SETF # N marks strong filter -+ vmov HX(decision,0), 1 IFNN # NN marks normal filter -+ -+ vadd HX(do_filter,0), HX(d,3), HX(d,0) -+ vsub HX(do_filter,0), HX(do_filter,0), HX(beta,0) SETF # IFNN means no filter -+ vmov HX(decision,0),0 IFNN # Z marks no filter -+ -+ # Expand out decision (currently valid one every 4 pixels) 0...1...2...3 -+ # First extract out even terms -+ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0.1.2.3 -+ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0123 -+ # Now expand back -+ valtl HX(decision,0),HX(decision,0),HX(decision,0) # 00112233 -+ valtl HX(decision,0),HX(decision,0),HX(decision,0) SETF # 0000111122223333 -+ -+ # HX(decision,0) is negative if want strong filtering, 1 if want normal filtering, 0 if want no filtering -+ -+ # Do a quick check to see if there is anything to do -+ mov r11, 0 # Signal no filtering -+ vmov -,1 IFNZ SUMS r5 -+ cmp r5,0 -+ beq filtering_done -+ mov r11, 1 # Signal some filtering -+ # And whether there is any strong filtering -+ vmov -,1 IFN SUMS r5 -+ cmp r5,0 -+ beq normal_filtering -+ -+ ############################################################################## -+ # Strong filtering - could maybe fast case if all have same sign? (especially if all disabled!) -+ vshl HX(tc2,0), HX(tc,0), 1 # Note that in normal filtering tx2 is tc/2, while here it is tc*2 -+ -+ # Take a copy of the original pixels for use in decision calculation -+ vmov HX(P0,32),HX(P0,0) -+ vmov HX(Q0,32),HX(Q0,0) -+ vmov HX(P1,32),HX(P1,0) -+ vmov HX(Q1,32),HX(Q1,0) -+ vmov HX(P2,32),HX(P2,0) -+ vmov HX(Q2,32),HX(Q2,0) -+ -+ vadd -,HX(P2,32),4 CLRA SACC -+ vshl -,HX(P1,32),1 SACC -+ vshl -,HX(P0,32),1 SACC -+ vshl -,HX(Q0,32),1 SACC -+ vshl HX(delta,0),HX(Q1,32),0 SACC -+ vasr HX(delta,0),HX(delta,0), 3 -+ vsub HX(delta,0),HX(delta,0),HX(P0,32) -+ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -+ vadd HX(P0,0),HX(P0,32),HX(delta,0) IFN -+ -+ vadd -,HX(P2,32),2 CLRA SACC -+ vadd -,HX(P1,32),HX(P0,32) SACC -+ vshl HX(delta,0),HX(Q0,32),0 SACC -+ vasr HX(delta,0),HX(delta,0), 2 -+ vsub HX(delta,0),HX(delta,0),HX(P1,32) -+ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -+ vadd HX(P1,0),HX(P1,32),HX(delta,0) IFN -+ -+ vadd -,HX(Q0,32),4 CLRA SACC -+ vadd -,HX(P1,32),HX(P0,32) SACC -+ vmul -,HX(P2,32),3 SACC -+ vshl HX(delta,0),HX(P3,0),1 SACC # Note that we have not made a copy of P3, so using P3,0 is correct -+ vasr HX(delta,0),HX(delta,0), 3 -+ vsub HX(delta,0),HX(delta,0),HX(P2,32) -+ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -+ vadd HX(P2,0),HX(P2,32),HX(delta,0) IFN -+ #vmov HX(P2,0),3 IFN -+ -+ # Now reverse all P/Qs -+ -+ vadd -,HX(Q2,32),4 CLRA SACC -+ vshl -,HX(Q1,32),1 SACC -+ vshl -,HX(Q0,32),1 SACC -+ vshl -,HX(P0,32),1 SACC -+ vshl HX(delta,0),HX(P1,32),0 SACC -+ vasr HX(delta,0),HX(delta,0), 3 -+ vsub HX(delta,0),HX(delta,0),HX(Q0,32) -+ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -+ vadd HX(Q0,0),HX(Q0,32),HX(delta,0) IFN -+ -+ vadd -,HX(Q2,32),2 CLRA SACC -+ vadd -,HX(Q1,32),HX(Q0,32) SACC -+ vshl HX(delta,0),HX(P0,32),0 SACC -+ vasr HX(delta,0),HX(delta,0), 2 -+ vsub HX(delta,0),HX(delta,0),HX(Q1,32) -+ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -+ vadd HX(Q1,0),HX(Q1,32),HX(delta,0) IFN -+ -+ vadd -,HX(P0,32),4 CLRA SACC -+ vadd -,HX(Q1,32),HX(Q0,32) SACC -+ vmul -,HX(Q2,32),3 SACC -+ vshl HX(delta,0),HX(Q3,0),1 SACC # Note that we have not made a copy of Q3, so using Q3,0 is correct -+ vasr HX(delta,0),HX(delta,0), 3 -+ vsub HX(delta,0),HX(delta,0),HX(Q2,32) -+ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -+ vadd HX(Q2,0),HX(Q2,32),HX(delta,0) IFN -+ -+ ############################################################################## -+ # Normal filtering -+normal_filtering: -+ # Invert the decision flags -+ # make instruction more complicated as assembler has error and loses SETF -+ vrsub HX(tc10,0), HX(decision,0), 0 SETF # IFN means normal filtering -+ vmov -, HX(tc10,0) SETF # IFN means normal filtering -+ -+ vmov -,1 IFN SUMS r5 -+ cmp r5,0 -+ beq filtering_done -+ -+ vasr HX(tc2,0), HX(tc,0), 1 -+ vmul HX(tc10,0), HX(tc,0), 10 -+ -+ vasr HX(thresh,0), HX(beta,0), 1 -+ vadd HX(thresh,0), HX(thresh,0), HX(beta,0) -+ vasr HX(thresh,0), HX(thresh,0), 3 CLRA SACC -+ -+ vadd HX(ptest,0),HX(dp,3),HX(dp,0) -+ vsub HX(ptest,0),HX(ptest,0),HX(thresh,0) # ptest is negative if we need to do the P2 pixel -+ vadd HX(qtest,0),HX(dq,3),HX(dq,0) -+ vsub HX(qtest,0),HX(qtest,0),HX(thresh,0) # qtest is negative if we need to do the Q2 pixel -+ # Expand ptest and qtest together -+ vodd HX(pqtest,0),HX(ptest,0),HX(qtest,0) # p.p.p.p.q.q.q.q -+ vodd HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppqqqq........ -+ valtl HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppppppqqqqqqqq -+ valtl HX(ptest,0),HX(pqtest,0),HX(pqtest,0) -+ valtu HX(qtest,0),HX(pqtest,0),HX(pqtest,0) -+ -+ vsub HX(delta0,0), HX(Q0,0), HX(P0,0) -+ vsub HX(delta1,0), HX(Q1,0), HX(P1,0) -+ vmov -,8 CLRA SACC -+ vmul -,HX(delta0,0), 9 SACC -+ vmul HX(delta0,0),HX(delta1,0), r6 SACC -+ vasr HX(delta0,0), HX(delta0,0), 4 -+ vdist HX(deltatest,0), HX(delta0,0), 0 -+ vsub HX(deltatest,0), HX(deltatest,0), HX(tc10,0) IFN SETF # negative if still need to do something -+ vmov HX(deltatest,0), 0 IFNN # clear if no need to do anything so we can reload flags later -+ -+ vclamps HX(delta0,0), HX(delta0,0), HX(tc,0) -+ -+ vadd HX(deltap1,0), HX(P2,0), HX(P0,0) -+ vadd HX(deltap1,0), HX(deltap1,0), 1 -+ vasr HX(deltap1,0), HX(deltap1,0), 1 CLRA SACC -+ vsub HX(deltap1,0), HX(delta0,0), HX(P1,0) SACC -+ vasr HX(deltap1,0), HX(deltap1,0), 1 -+ vclamps HX(deltap1,0), HX(deltap1,0), HX(tc2,0) -+ -+ vadd HX(deltaq1,0), HX(Q2,0), HX(Q0,0) -+ vadd HX(deltaq1,0), HX(deltaq1,0), 1 -+ vasr HX(deltaq1,0), HX(deltaq1,0), 1 CLRA SACC -+ vadd HX(deltaq1,0), HX(delta0,0), HX(Q1,0) -+ vrsub -, HX(delta0,0), 0 SACC -+ vrsub HX(deltaq1,0), HX(Q1,0), 0 SACC -+ vasr HX(deltaq1,0), HX(deltaq1,0), 1 -+ vclamps HX(deltaq1,0), HX(deltaq1,0), HX(tc2,0) -+ -+ vadds HX(P0,0), HX(P0,0), HX(delta0,0) IFN -+ vsubs HX(Q0,0), HX(Q0,0), HX(delta0,0) IFN -+ -+ vmov -,HX(ptest,0) IFN SETF # Negative if need to do p1 -+ vadds HX(P1,0), HX(P1,0), HX(deltap1,0) IFN -+ -+ vmov -,HX(deltatest,0) SETF -+ vmov -,HX(qtest,0) IFN SETF # Negative if need to do q1 -+ vadds HX(Q1,0), HX(Q1,0), HX(deltaq1,0) IFN -+ -+ #vmov HX(P2,0),1 IFN -+ -+filtering_done: -+ b lr -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 0121fca..05b2169 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -147,7 +147,7 @@ static int gpu_init(volatile struct GPU **gpu) { - vcsm_init(); - gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); - ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -- memset(ptr, 0, sizeof *ptr); -+ memset((void*)ptr, 0, sizeof *ptr); - vc = gpu_mem_ptr.vc; - - ptr->mb = mb; -@@ -254,7 +254,7 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) - struct vcsm_user_clean_invalid_s iocache = {}; - iocache.s[0].handle = p->vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = p->arm; -+ iocache.s[0].addr = (int) p->arm; - iocache.s[0].size = p->numbytes; - vcsm_clean_invalid( &iocache ); - #else -@@ -390,6 +390,7 @@ static void *vpu_start(void *arg) { - #ifdef RPI_TIME_TOTAL_POSTED - int last_time=0; - long long on_time=0; -+ long long on_time_deblock=0; - long long off_time=0; - int start_time; - int end_time; -@@ -451,10 +452,13 @@ static void *vpu_start(void *arg) { - #ifdef RPI_TIME_TOTAL_POSTED - end_time = Microseconds(); - last_time = end_time; -- on_time += end_time - start_time; -+ if (p[6]==2) -+ on_time_deblock += end_time - start_time; -+ else -+ on_time += end_time - start_time; - count++; - if ((count&0x7f)==0) -- printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -+ printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); - #endif - pthread_mutex_lock(&post_mutex); - vpu_async_head++; -diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -index e86eb30..c5d8b29 100644 ---- a/libavcodec/rpi_shader.c -+++ b/libavcodec/rpi_shader.c -@@ -61,7 +61,7 @@ unsigned int rpi_shader[] = { - /* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 - /* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 - /* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 --/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 -+/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif,r2 - /* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 - /* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif - /* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 --- -2.7.4 - - -From e9c59f0d7b42dfb10d85ab2477f95b44484a8d70 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 1 Jul 2015 09:21:17 +0100 -Subject: [PATCH 65/68] Added ability to combine jobs - ---- - libavcodec/rpi_qpu.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 80 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 05b2169..91777be 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -8,6 +8,8 @@ - #define RPI_TIME_TOTAL_POSTED - // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion - #define RPI_ASYNC -+// Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel -+#define RPI_COMBINE_JOBS - - #include - #include -@@ -398,9 +400,15 @@ static void *vpu_start(void *arg) { - #endif - while(1) { - int i; -- int *p; -+ int *p; // Pointer for a QPU/VPU job -+#ifdef RPI_COMBINE_JOBS -+ int *q = NULL; // Pointer for a VPU only job -+ int have_qpu = 0; -+ int have_vpu = 0; -+#endif - int qpu_code; - int qpu_codeb; -+ int num_jobs; // Number of jobs available - pthread_mutex_lock(&post_mutex); - while( vpu_async_tail - vpu_async_head <= 0) - { -@@ -408,13 +416,38 @@ static void *vpu_start(void *arg) { - pthread_cond_wait(&post_cond_tail, &post_mutex); - } - p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ num_jobs = vpu_async_tail - vpu_async_head; - pthread_mutex_unlock(&post_mutex); - - if (p[6] == -1) { - break; // Last job - } -+ if (p[7] == 0 && p[0] == 0 && p[16]==0) -+ goto job_done_early; -+ -+#ifdef RPI_COMBINE_JOBS -+ // First scan for a qpu job -+ for (int x=0;xmail[i*2] = p[8+i]; -+ gpu->mail[i*2 + 1] = qpu_code; -+ } -+ for(i=0;i<12;i++) { -+ gpu->mail2[i*2] = p[17+i]; -+ gpu->mail2[i*2 + 1] = qpu_codeb; -+ } -+ if (have_vpu) { -+ execute_multi(gpu->mb, -+ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 -+ q[0] = 0; -+ } else { -+ execute_multi(gpu->mb, -+ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+ } -+ p[0] = 0; -+ p[7] = 0; -+ p[16] = 0; -+ } else { -+ av_assert0(have_vpu); -+ vpu_execute_code(q[0], q[1], q[2], q[3], q[4], q[5], q[6]); -+ q[0] = 0; -+ } -+#else -+ - if (!qpu_code) { - vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); - } else { -@@ -449,17 +516,29 @@ static void *vpu_start(void *arg) { - 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 - #endif - } -+#endif -+ - #ifdef RPI_TIME_TOTAL_POSTED - end_time = Microseconds(); - last_time = end_time; -+#ifdef RPI_COMBINE_JOBS -+ // There are three cases we may wish to distinguish of VPU/QPU activity -+ on_time += end_time - start_time; -+#else - if (p[6]==2) - on_time_deblock += end_time - start_time; - else - on_time += end_time - start_time; -+#endif - count++; - if ((count&0x7f)==0) -+#ifdef RPI_COMBINE_JOBS - printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -+#else -+ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -+#endif - #endif -+job_done_early: - pthread_mutex_lock(&post_mutex); - vpu_async_head++; - pthread_cond_broadcast(&post_cond_head); --- -2.7.4 - - -From 0d54661f303b2a8903e806648ed54a34dcf315dc Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 1 Jul 2015 12:53:10 +0100 -Subject: [PATCH 66/68] Added chroma deblocking - ---- - libavcodec/hevc.c | 20 ++ - libavcodec/hevc.h | 12 +- - libavcodec/hevc_filter.c | 92 +++++- - libavcodec/rpi_hevc_transform.h | 644 +++++++++++++++++++++++++++++++++++++++- - libavcodec/rpi_hevc_transform.s | 207 +++++++++++++ - libavcodec/rpi_qpu.c | 27 +- - libavcodec/rpi_shader.qasm | 11 + - 7 files changed, 988 insertions(+), 25 deletions(-) - -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 4ce94a7..8437e10 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -251,6 +251,14 @@ static void pic_arrays_free(HEVCContext *s) - gpu_free(&s->y_setup_ptr); - s->y_setup_arm = 0; - } -+ if (s->uv_setup_arm) { -+ gpu_free(&s->uv_setup_ptr); -+ s->uv_setup_arm = 0; -+ } -+ if (s->vpu_cmds_arm) { -+ gpu_free(&s->vpu_cmds_ptr); -+ s->vpu_cmds_arm = 0; -+ } - #endif - av_freep(&s->sao); - av_freep(&s->deblock); -@@ -324,6 +332,18 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) - s->y_setup_vc = (void*)s->y_setup_ptr.vc; - memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); - printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); -+ -+ s->uv_setup_width = ( (sps->width >> sps->hshift[1]) + 15) / 16; -+ s->uv_setup_height = ( (sps->height >> sps->vshift[1]) + 15) / 16; -+ gpu_malloc_uncached(sizeof(*s->uv_setup_arm) * s->uv_setup_width * s->uv_setup_height, &s->uv_setup_ptr); // TODO make this cached -+ s->uv_setup_arm = (void*)s->uv_setup_ptr.arm; -+ s->uv_setup_vc = (void*)s->uv_setup_ptr.vc; -+ memset(s->uv_setup_arm, 0, s->uv_setup_ptr.numbytes); -+ printf("Setup uv %d by %d by %d\n",s->uv_setup_width,s->uv_setup_height,sizeof(*s->uv_setup_arm)); -+ -+ gpu_malloc_uncached(sizeof(*s->vpu_cmds_arm) * 3,&s->vpu_cmds_ptr); -+ s->vpu_cmds_arm = (void*) s->vpu_cmds_ptr.arm; -+ s->vpu_cmds_vc = s->vpu_cmds_ptr.vc; - #endif - - s->bs_width = (width >> 2) + 1; -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index cf08489..7eb37e6 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -56,7 +56,7 @@ - #define RPI_MAX_JOBS 2 - // Define RPI_WORKER to launch a worker thread for pixel processing tasks - #define RPI_WORKER -- -+ // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs - #define RPI_DEBLOCK_VPU - - #endif -@@ -980,6 +980,16 @@ typedef struct HEVCContext { - uint8_t (*y_setup_vc)[2][2][2][4]; - int setup_width; // Number of 16x16 blocks across the image - int setup_height; // Number of 16x16 blocks down the image -+ -+ GPU_MEM_PTR_T uv_setup_ptr; -+ uint8_t (*uv_setup_arm)[2][2][2][4]; // Half of this is unused [][][1][], but easier for the VPU as it allows us to store with zeros and addresses are aligned -+ uint8_t (*uv_setup_vc)[2][2][2][4]; -+ int uv_setup_width; -+ int uv_setup_height; -+ -+ GPU_MEM_PTR_T vpu_cmds_ptr; -+ int (*vpu_cmds_arm)[6]; // r0-r5 for each command -+ int vpu_cmds_vc; - #endif - - #endif -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 06371da..6367068 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -656,9 +656,23 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->frame->linesize[chroma], - c_tc, no_p, no_q); - } else -+#ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock) { -+ uint8_t (*setup)[2][2][4]; -+ int xc = x>>s->ps.sps->hshift[chroma]; -+ int yc = y>>s->ps.sps->vshift[chroma]; -+ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); -+ int a = ((yc>>3) & 1) << 1; -+ int b = (xc>>3) & 1; -+ setup = s->uv_setup_arm[num16]; -+ setup[0][b][0][a] = c_tc[0]; -+ setup[0][b][0][a + 1] = c_tc[1]; -+ } else -+#endif - s->hevcdsp.hevc_v_loop_filter_chroma(src, - s->frame->linesize[chroma], - c_tc, no_p, no_q); -+ - } - } - -@@ -689,6 +703,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - s->frame->linesize[chroma], - c_tc, no_p, no_q); - } else -+#ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock) { -+ uint8_t (*setup)[2][2][4]; -+ int xc = x>>s->ps.sps->hshift[chroma]; -+ int yc = y>>s->ps.sps->vshift[chroma]; -+ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); -+ int a = ((xc>>3) & 1) << 1; -+ int b = (yc>>3) & 1; -+ setup = s->uv_setup_arm[num16]; -+ setup[1][b][0][a] = c_tc[0]; -+ setup[1][b][0][a + 1] = c_tc[1]; -+ } else -+#endif - s->hevcdsp.hevc_h_loop_filter_chroma(src, - s->frame->linesize[chroma], - c_tc, no_p, no_q); -@@ -1013,33 +1040,56 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - static void rpi_deblock(HEVCContext *s, int y, int ctb_size) - { - // Flush image, 4 lines above to bottom of ctb stripe -- ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); -+ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 1); - // TODO flush buffer of beta/tc setup when it becomes cached -+ -+ // Prepare three commands at once to avoid calling overhead -+ s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; -+ s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; -+ s->vpu_cmds_arm[0][2] = s->setup_width; -+ s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); -+ s->vpu_cmds_arm[0][4] = ctb_size>>4; -+ s->vpu_cmds_arm[0][5] = 2; -+ -+ s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -+ s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; -+ s->vpu_cmds_arm[1][2] = s->uv_setup_width; -+ s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -+ s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -+ s->vpu_cmds_arm[1][5] = 3; -+ -+ s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -+ s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; -+ s->vpu_cmds_arm[2][2] = s->uv_setup_width; -+ s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -+ s->vpu_cmds_arm[2][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -+ s->vpu_cmds_arm[2][5] = 4; -+ - // Call VPU -- // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion -- vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], -- s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), -- ctb_size>>4, 2, 0)); // 2 means to do the deblocking code -+ vpu_wait(vpu_post_code( vpu_get_fn(), s->vpu_cmds_vc, 3, 0, 0, 0, 5, 0)); // 5 means to do all the commands - } - --static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) --{ -- int y2; -- for(y2=y;y2= s->ps.sps->width - ctb_size; -+#ifdef RPI_DEBLOCK_VPU -+ int done_deblock = 0; -+#endif - if (s->avctx->skip_loop_filter < AVDISCARD_ALL) - deblocking_filter_CTB(s, x, y); - #ifdef RPI_DEBLOCK_VPU - if (s->enable_rpi_deblock && x_end) - { -- rpi_deblock(s, y, ctb_size); -+ int y_at_end = y >= s->ps.sps->height - ctb_size; -+ int height = 64; // Deblock in units 64 high to avoid too many VPU calls -+ int y_start = y&~63; -+ if (y_at_end) height = s->ps.sps->height - y_start; -+ if ((((y+ctb_size)&63)==0) || y_at_end) { -+ done_deblock = 1; -+ rpi_deblock(s, y_start, height); -+ } - } - #endif - if (s->ps.sps->sao_enabled) { -@@ -1070,11 +1120,25 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) - //int newh = y + ctb_size - 4; - //int currh = s->ref->tf.progress->data[0]; - //if (((y + ctb_size)&63)==0) -+#ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock) { -+ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -+ if (done_deblock) { -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+ } else { -+#ifdef RPI_INTER_QPU -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -+#endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+#else - #ifdef RPI_INTER_QPU - ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -- // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -+ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi - #endif - ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+#endif - } - } - -diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -index b3f155f..4309f1c 100644 ---- a/libavcodec/rpi_hevc_transform.h -+++ b/libavcodec/rpi_hevc_transform.h -@@ -3,14 +3,32 @@ unsigned char rpi_hevc_transform [] = { - 106, - 0, - 144, --38, -+47, - 1, - 37, - 106, - 0, - 144, --57, -+66, - 1, -+53, -+106, -+0, -+144, -+192, -+4, -+69, -+106, -+0, -+144, -+192, -+4, -+85, -+106, -+0, -+144, -+220, -+5, - 169, - 3, - 62, -@@ -2427,4 +2445,626 @@ unsigned char rpi_hevc_transform [] = { - 128, - 90, - 0, -+169, -+3, -+14, -+96, -+4, -+31, -+169, -+3, -+30, -+96, -+1, -+31, -+73, -+64, -+52, -+64, -+45, -+64, -+2, -+64, -+10, -+64, -+64, -+198, -+1, -+7, -+8, -+232, -+63, -+0, -+0, -+0, -+6, -+232, -+253, -+255, -+255, -+255, -+0, -+246, -+0, -+0, -+0, -+4, -+215, -+64, -+3, -+96, -+2, -+248, -+0, -+35, -+0, -+0, -+64, -+56, -+0, -+0, -+4, -+248, -+0, -+36, -+0, -+0, -+64, -+56, -+8, -+0, -+0, -+240, -+64, -+0, -+132, -+3, -+30, -+106, -+132, -+24, -+128, -+240, -+0, -+0, -+132, -+3, -+128, -+144, -+143, -+0, -+131, -+98, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+135, -+0, -+131, -+102, -+0, -+158, -+71, -+0, -+2, -+248, -+0, -+35, -+0, -+0, -+64, -+56, -+0, -+0, -+4, -+248, -+0, -+36, -+0, -+0, -+64, -+56, -+8, -+0, -+0, -+240, -+64, -+0, -+132, -+3, -+30, -+106, -+132, -+24, -+128, -+240, -+0, -+0, -+132, -+3, -+128, -+144, -+112, -+0, -+131, -+98, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+104, -+0, -+131, -+102, -+0, -+248, -+64, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+30, -+106, -+134, -+24, -+128, -+248, -+0, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+128, -+144, -+123, -+0, -+188, -+64, -+67, -+232, -+0, -+2, -+0, -+0, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+112, -+0, -+195, -+232, -+0, -+2, -+0, -+0, -+12, -+128, -+7, -+192, -+130, -+248, -+0, -+0, -+112, -+192, -+224, -+16, -+195, -+31, -+132, -+248, -+1, -+0, -+112, -+0, -+224, -+16, -+203, -+31, -+3, -+99, -+131, -+71, -+68, -+232, -+32, -+0, -+0, -+0, -+0, -+99, -+2, -+99, -+23, -+102, -+7, -+106, -+127, -+156, -+178, -+255, -+0, -+248, -+64, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+30, -+106, -+134, -+24, -+128, -+248, -+0, -+0, -+112, -+0, -+192, -+243, -+211, -+31, -+128, -+144, -+72, -+0, -+188, -+64, -+67, -+232, -+0, -+2, -+0, -+0, -+0, -+255, -+64, -+0, -+0, -+20, -+200, -+243, -+0, -+0, -+128, -+144, -+61, -+0, -+195, -+232, -+0, -+2, -+0, -+0, -+12, -+128, -+7, -+192, -+130, -+248, -+0, -+0, -+112, -+192, -+224, -+16, -+195, -+31, -+132, -+248, -+1, -+0, -+112, -+0, -+224, -+16, -+203, -+31, -+25, -+102, -+9, -+106, -+2, -+30, -+41, -+3, -+26, -+87, -+162, -+64, -+64, -+198, -+1, -+23, -+127, -+158, -+95, -+255, -+239, -+3, -+0, -+254, -+128, -+143, -+94, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+143, -+95, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+142, -+208, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+128, -+142, -+209, -+0, -+0, -+240, -+12, -+0, -+128, -+144, -+47, -+0, -+8, -+255, -+227, -+23, -+0, -+244, -+192, -+51, -+0, -+0, -+8, -+255, -+35, -+52, -+0, -+180, -+192, -+51, -+0, -+0, -+111, -+3, -+239, -+3, -+0, -+254, -+128, -+143, -+14, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+143, -+15, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+192, -+142, -+16, -+0, -+0, -+240, -+12, -+0, -+0, -+254, -+128, -+142, -+17, -+0, -+0, -+240, -+12, -+0, -+128, -+144, -+13, -+0, -+8, -+255, -+227, -+3, -+0, -+244, -+192, -+51, -+0, -+0, -+8, -+255, -+35, -+4, -+0, -+180, -+192, -+51, -+0, -+0, -+111, -+3, -+32, -+246, -+192, -+11, -+1, -+16, -+32, -+246, -+2, -+140, -+47, -+240, -+32, -+247, -+35, -+141, -+63, -+178, -+64, -+254, -+35, -+141, -+2, -+68, -+192, -+243, -+128, -+11, -+32, -+255, -+35, -+240, -+58, -+226, -+192, -+243, -+188, -+10, -+0, -+254, -+0, -+141, -+4, -+4, -+0, -+240, -+128, -+10, -+88, -+246, -+35, -+141, -+3, -+68, -+240, -+246, -+35, -+141, -+48, -+66, -+0, -+247, -+227, -+143, -+52, -+242, -+32, -+247, -+227, -+142, -+52, -+178, -+90, -+0, -+161, -+3, -+6, -+64, -+23, -+64, -+96, -+8, -+70, -+98, -+97, -+8, -+70, -+98, -+98, -+8, -+70, -+98, -+99, -+8, -+70, -+98, -+100, -+8, -+70, -+98, -+101, -+8, -+70, -+98, -+255, -+159, -+8, -+250, -+23, -+102, -+7, -+106, -+112, -+30, -+33, -+3, - }; -diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -index b055208..5543093 100644 ---- a/libavcodec/rpi_hevc_transform.s -+++ b/libavcodec/rpi_hevc_transform.s -@@ -85,6 +85,13 @@ hevc_trans_16x16: - beq memclear16 - cmp r5,2 - beq hevc_deblock_16x16 -+ cmp r5,3 -+ beq hevc_uv_deblock_16x16 -+ cmp r5,4 -+ beq hevc_uv_deblock_16x16_with_clear -+ cmp r5,5 -+ beq hevc_run_command_list -+ - push r6-r15, lr # TODO cut down number of used registers - mov r14,r3 # coeffs32 - mov r15,r4 # num32 -@@ -708,3 +715,203 @@ normal_filtering: - - filtering_done: - b lr -+ -+ -+hevc_uv_deblock_16x16: -+ push r6-r15, lr -+ mov r14,0 -+ b hevc_uv_start -+hevc_uv_deblock_16x16_with_clear: -+ push r6-r15, lr -+ mov r14,1 -+ b hevc_uv_start -+ -+hevc_uv_start: -+ mov r9,r4 -+ mov r4,r3 -+ mov r13,r2 -+ mov r2,r0 -+ mov r10,r0 -+ subscale4 r0,r1 -+ mov r8,63 -+ mov r6,-3 -+ vmov H(zeros,0),0 -+# r7 is number of blocks still to load -+# r0 is location of current block - 4 * stride -+# r1 is stride -+# r2 is location of current block -+# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical -+# r4 is setup -+# r5 is for temporary calculations -+# r8 holds 63 -+# r6 holds -3 -+# r9 holds the number of 16 high rows to process -+# r10 holds the original img base -+# r11 returns 0 if no filtering was done on the edge -+# r12 saves a copy of this -+# r13 is copy of width -+# r14 is 1 if we should clear the old contents, or 0 if not -+ -+uv_process_row: -+ # First iteration does not do horizontal filtering on previous -+ mov r7, r13 -+ mov r3,0 -+ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block -+ vldb H(16++,16)+r3,(r2 += r1) REP 16 -+ vldb H(setup_input,0), (r4) # We may wish to prefetch these -+ cmp r14,1 -+ bne uv_skip0 -+ vstb H(zeros,0),(r4) -+uv_skip0: -+ bl uv_vert_filter -+ add r3,8 -+ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 -+ bl uv_vert_filter -+ sub r3,8 -+ b uv_start_deblock_loop -+uv_deblock_loop: -+ # Middle iterations do vertical on current block and horizontal on preceding -+ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block -+ vldb H(16++,16)+r3,(r2 += r1) REP 16 -+ vldb H(setup_input,0), (r4) -+ cmp r14,1 -+ bne uv_skip1 -+ vstb H(zeros,0),(r4) -+uv_skip1: -+ bl uv_vert_filter -+ add r3,8 -+ vadd H(setup_input,0),H(setup_input,8),0 -+ bl uv_vert_filter -+ sub r3,8 -+ vldb H(setup_input,0), -16(r4) -+ cmp r14,1 -+ bne uv_skip3 -+ vstb H(zeros,0),-16(r4) -+uv_skip3: -+ bl uv_horz_filter -+ mov r12,r11 -+ add r3,8*64 -+ vadd H(setup_input,0),H(setup_input,8),0 -+ bl uv_horz_filter -+ sub r3,8*64 -+ addcmpbeq r12,0,0,uv_skip_save_top -+ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -+uv_skip_save_top: -+ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -+uv_start_deblock_loop: -+ # move onto next 16x16 (could do this with circular buffer support instead) -+ add r3,16 -+ and r3,r8 -+ add r4,32 -+ # Perform loop counter operations (may work with an addcmpbgt as well?) -+ add r0,16 -+ add r2,16 -+ sub r7,1 -+ cmp r7,0 # Are there still more blocks to load -+ bgt uv_deblock_loop -+ -+ # Final iteration needs to just do horizontal filtering -+ vldb H(setup_input,0), -16(r4) -+ cmp r14,1 -+ bne uv_skip2 -+ vstb H(zeros,0),-16(r4) -+uv_skip2: -+ bl uv_horz_filter -+ mov r12,r11 -+ add r3,8*64 -+ vadd H(setup_input,0),H(setup_input,8),0 -+ bl uv_horz_filter -+ sub r3,64*8 -+ addcmpbeq r12,0,0,uv_skip_save_top2 -+ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -+uv_skip_save_top2: -+ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -+ -+# Now look to see if we should do another row -+ sub r9,1 -+ cmp r9,0 -+ bgt uv_start_again -+ pop r6-r15, pc -+uv_start_again: -+ # Need to sort out r0,r2 to point to next row down -+ addscale16 r10,r1 -+ mov r2,r10 -+ subscale4 r0,r2,r1 -+ b uv_process_row -+ -+ -+# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered -+# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations -+ -+uv_vert_filter: -+ push lr -+ -+ vmov HX(P1,0), V(16,14)+r3 -+ vmov HX(P0,0), V(16,15)+r3 -+ vmov HX(Q0,0), V(16,16)+r3 -+ vmov HX(Q1,0), V(16,17)+r3 -+ -+ bl do_chroma_filter -+ -+ vadds V(16,15)+r3, HX(P0,0), 0 -+ vadds V(16,16)+r3, HX(Q0,0), 0 -+ -+ pop pc -+ -+# Filter edge at H(16,0)+r3 -+uv_horz_filter: -+ push lr -+ -+ vmov HX(P1,0), H(14,0)+r3 -+ vmov HX(P0,0), H(15,0)+r3 -+ vmov HX(Q0,0), H(16,0)+r3 -+ vmov HX(Q1,0), H(17,0)+r3 -+ -+ bl do_chroma_filter -+ -+ vadds H(15,0)+r3, HX(P0,0), 0 -+ # P3 and Q3 never change so don't bother saving back -+ vadds H(16,0)+r3, HX(Q0,0), 0 -+ -+ pop pc -+ -+# r4 points to array of beta/tc for each 4 length edge -+do_chroma_filter: -+ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # tc*8 -+ valtl HX(tc,0),H(setup,0),H(setup,0) -+ -+ vsub HX(delta,0),HX(Q0,0),HX(P0,0) -+ vshl HX(delta,0),HX(delta,0),2 CLRA SACC -+ vsub -,HX(P1,0),HX(Q1,0) SACC -+ vmov HX(delta,0),4 SACC -+ vasr HX(delta,0),HX(delta,0),3 -+ vclamps HX(delta,0), HX(delta,0), HX(tc,0) -+ vadd HX(P0,0),HX(P0,0),HX(delta,0) -+ vsub HX(Q0,0),HX(Q0,0),HX(delta,0) -+ b lr -+ -+# r0 = list -+# r1 = number -+hevc_run_command_list: -+ push r6-r7, lr -+ mov r6, r0 -+ mov r7, r1 -+loop_cmds: -+ ld r0,(r6) # How to encode r6++? -+ add r6,4 -+ ld r1,(r6) -+ add r6,4 -+ ld r2,(r6) -+ add r6,4 -+ ld r3,(r6) -+ add r6,4 -+ ld r4,(r6) -+ add r6,4 -+ ld r5,(r6) -+ add r6,4 -+ bl hevc_trans_16x16 -+ sub r7,1 -+ cmp r7,0 -+ bgt loop_cmds -+ -+ pop r6-r7, pc -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 91777be..5aa0432 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -397,6 +397,8 @@ static void *vpu_start(void *arg) { - int start_time; - int end_time; - int count=0; -+ int count_deblock=0; -+ int count_qpu=0; - #endif - while(1) { - int i; -@@ -442,7 +444,7 @@ static void *vpu_start(void *arg) { - break; - } - } -- printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); -+ //printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); - #endif - qpu_code = p[7]; - qpu_codeb = p[16]; -@@ -460,6 +462,12 @@ static void *vpu_start(void *arg) { - off_time += start_time-last_time; - #endif - -+#define NO_FLUSH 1 -+#define CLEAR_PROFILE 2 -+#define OUTPUT_COUNTS 4 -+ -+#define FLAGS_FOR_PROFILING (NO_FLUSH) -+ - #ifdef RPI_COMBINE_JOBS - if (have_qpu) { - for(i=0;i<8;i++) { -@@ -472,14 +480,14 @@ static void *vpu_start(void *arg) { - } - if (have_vpu) { - execute_multi(gpu->mb, -- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -+ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, - 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, - p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 - q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 - q[0] = 0; - } else { - execute_multi(gpu->mb, -- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -+ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, - 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, - p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 - 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -@@ -510,7 +518,7 @@ static void *vpu_start(void *arg) { - execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); - #else - execute_multi(gpu->mb, -- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -+ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING , 5000, - 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, - p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 - 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -@@ -525,17 +533,20 @@ static void *vpu_start(void *arg) { - // There are three cases we may wish to distinguish of VPU/QPU activity - on_time += end_time - start_time; - #else -- if (p[6]==2) -+ if (p[6]>1) { -+ count_deblock++; - on_time_deblock += end_time - start_time; -- else -+ } else { - on_time += end_time - start_time; -+ count_qpu++; -+ } - #endif - count++; - if ((count&0x7f)==0) - #ifdef RPI_COMBINE_JOBS -- printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); --#else - printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -+#else -+ printf("Posted %d On=%dms (%d calls), On_deblock=%dms (%d calls), Off=%dms\n",count,(int)(on_time/1000),count_qpu,(int)(on_time_deblock/1000),count_deblock,(int)(off_time/1000)); - #endif - #endif - job_done_early: -diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -index 0686249..64bf5b0 100644 ---- a/libavcodec/rpi_shader.qasm -+++ b/libavcodec/rpi_shader.qasm -@@ -1077,6 +1077,17 @@ nop ; nop # delay slot 2 - ::mc_interrupt_exit12 - mov -, vw_wait # wait on the VDW - -+ # Dummy wait to test instructions -+# mov r3,1000000 -+#:dummy_loop -+# sub.setf r3, r3, 1 -+# nop -+# nop -+# brr.anynn -, r:dummy_loop -+# nop -+# nop -+# nop -+ - ldtmu0 - ldtmu0 - ldtmu1 --- -2.7.4 - - -From 12a194bddd049ab97154e9fbdd46b63b558a3bee Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Tue, 23 Jun 2015 23:42:03 +0100 -Subject: [PATCH 67/68] armv7/hevc: Optimise deblocking boundary strength - calculation - ---- - libavcodec/arm/hevcdsp_deblock_neon.S | 115 +++++++++++++++++ - libavcodec/arm/hevcdsp_init_neon.c | 9 ++ - libavcodec/hevc.h | 11 -- - libavcodec/hevc_filter.c | 224 ++++++++++++++-------------------- - libavcodec/hevcdsp.c | 116 ++++++++++++++++++ - libavcodec/hevcdsp.h | 14 +++ - 6 files changed, 344 insertions(+), 145 deletions(-) - -diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S -index 166bddb..bad4589 100644 ---- a/libavcodec/arm/hevcdsp_deblock_neon.S -+++ b/libavcodec/arm/hevcdsp_deblock_neon.S -@@ -383,3 +383,118 @@ function ff_hevc_h_loop_filter_chroma_neon, export=1 - vst1.8 {d4}, [r0] - bx lr - endfunc -+ -+/* ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, -+ * int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -+ * MvField *curr, MvField *neigh, uint8_t *bs) -+ */ -+function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ add ip, sp, #4*4 -+ push {a2-a4,v1-v8,lr} -+ ldmia ip, {v5-v7} -+1: ldmdb ip, {v1-v4} -+ ldrsb a3, [v5, #8] @ curr->ref_idx -+ ldrsb v8, [v5, #9] -+ ldrsb ip, [v6, #8] @ neigh->ref_idx -+ ldrsb lr, [v6, #9] -+ ldr v1, [v1, a3, lsl #2] -+ ldrb a3, [v5, #10] @ curr->pred_flag -+ ldr v2, [v2, v8, lsl #2] -+ ldrb v8, [v6, #10] @ neigh->pred_flag -+ ldr v3, [v3, ip, lsl #2] -+ ldr v4, [v4, lr, lsl #2] -+ teq a3, #3 -+ beq 20f -+ teq v8, #3 -+ beq 90f -+ -+ tst a3, #1 -+ ldrne a3, [v5, #0] @ curr->mv[0] -+ ldreq a3, [v5, #4] @ curr->mv[1] -+ moveq v1, v2 -+ tst v8, #1 -+ ldrne v8, [v6, #0] @ neigh->mv[0] -+ ldreq v8, [v6, #4] @ neigh->mv[1] -+ moveq v3, v4 -+ teq v1, v3 -+ bne 10f -+ ldr lr, =0xFFFCFFFC -+ ssub16 ip, v8, a3 -+ ssub16 a3, a3, v8 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ @ drop through -+10: movne a3, #1 -+11: subs a2, a2, #1 -+12: strbhs a3, [v7], a4 -+ subs a2, a2, #1 -+ bhs 12b -+ -+ ldm sp, {a2, a3} -+ add ip, sp, #16*4 -+ subs a1, a1, #1 -+ add v5, v5, a3 -+ add v6, v6, a3 -+ bhi 1b -+ pop {a2-a4,v1-v8,pc} -+ -+20: teq v8, #3 -+ bne 10b -+ -+ teq v1, v3 -+ teqeq v2, v4 -+ bne 40f -+ teq v1, v2 -+ bne 30f -+ -+ ldrd v1, v2, [v5] @ curr->mv -+ ldrd v3, v4, [v6] @ neigh->mv -+ ldr lr, =0xFFFCFFFC -+ ssub16 ip, v3, v1 -+ ssub16 a3, v1, v3 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ bne 25f -+ ssub16 ip, v4, v2 -+ ssub16 a3, v2, v4 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ beq 11b -+ @ drop through -+25: ssub16 ip, v4, v1 -+ ssub16 a3, v1, v4 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ bne 10b -+ ssub16 ip, v3, v2 -+ ssub16 a3, v2, v3 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ b 10b -+ -+30: ldrd v1, v2, [v5] @ curr->mv -+ ldrd v3, v4, [v6] @ neigh->mv -+ ldr lr, =0xFFFCFFFC -+ ssub16 ip, v3, v1 -+ ssub16 a3, v1, v3 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ bne 10b -+ ssub16 ip, v4, v2 -+ ssub16 a3, v2, v4 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ b 10b -+ -+40: teq v1, v4 -+ teqeq v2, v3 -+ bne 10b -+ -+ ldrd v1, v2, [v5] @ curr->mv -+ ldrd v3, v4, [v6] @ neigh->mv -+ ldr lr, =0xFFFCFFFC -+ b 25b -+ -+90: mov a3, #1 -+ b 11b -+endfunc -diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -index e5da7e9..49c70dd 100644 ---- a/libavcodec/arm/hevcdsp_init_neon.c -+++ b/libavcodec/arm/hevcdsp_init_neon.c -@@ -290,6 +290,10 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t - } - #undef CMP - -+void ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, -+ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -+ MvField *curr, MvField *neigh, uint8_t *bs); -+ - av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - { - if (bit_depth == 8) { -@@ -387,4 +391,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) - c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; - c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; - } -+ -+ assert(offsetof(MvField, mv) == 0); -+ assert(offsetof(MvField, ref_idx) == 8); -+ assert(offsetof(MvField, pred_flag) == 10); -+ c->hevc_deblocking_boundary_strengths = ff_hevc_deblocking_boundary_strengths_neon; - } -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 7eb37e6..496c0e1 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -684,17 +684,6 @@ typedef struct CodingUnit { - uint8_t cu_transquant_bypass_flag; - } CodingUnit; - --typedef struct Mv { -- int16_t x; ///< horizontal component of motion vector -- int16_t y; ///< vertical component of motion vector --} Mv; -- --typedef struct MvField { -- DECLARE_ALIGNED(4, Mv, mv)[2]; -- int8_t ref_idx[2]; -- int8_t pred_flag; --} MvField; -- - typedef struct NeighbourAvailable { - int cand_bottom_left; - int cand_left; -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 6367068..826a82f 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -726,69 +726,6 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) - } - } - --static int boundary_strength(HEVCContext *s, MvField *curr, MvField *neigh, -- RefPicList *neigh_refPicList) --{ -- if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -- // same L0 and L1 -- if (s->ref->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] && -- s->ref->refPicList[0].list[curr->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]] && -- neigh_refPicList[0].list[neigh->ref_idx[0]] == neigh_refPicList[1].list[neigh->ref_idx[1]]) { -- if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && -- (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) -- return 1; -- else -- return 0; -- } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && -- neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { -- if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) -- return 1; -- else -- return 0; -- } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && -- neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { -- if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) -- return 1; -- else -- return 0; -- } else { -- return 1; -- } -- } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -- Mv A, B; -- int ref_A, ref_B; -- -- if (curr->pred_flag & 1) { -- A = curr->mv[0]; -- ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]]; -- } else { -- A = curr->mv[1]; -- ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]]; -- } -- -- if (neigh->pred_flag & 1) { -- B = neigh->mv[0]; -- ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]]; -- } else { -- B = neigh->mv[1]; -- ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]]; -- } -- -- if (ref_A == ref_B) { -- if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4) -- return 1; -- else -- return 0; -- } else -- return 1; -- } -- -- return 1; --} - - void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - int log2_trafo_size) -@@ -799,10 +736,17 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - int log2_min_tu_size = s->ps.sps->log2_min_tb_size; - int min_pu_width = s->ps.sps->min_pu_width; - int min_tu_width = s->ps.sps->min_tb_width; -- int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width + -- (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA; - int boundary_upper, boundary_left; -- int i, j, bs; -+ int i, j; -+ RefPicList *rpl = s->ref->refPicList; -+ int min_pu_in_4pix = (1 << log2_min_pu_size) >> 2; -+ int trafo_in_min_pus = (1 << log2_trafo_size) >> log2_min_pu_size; -+ int y_pu = y0 >> log2_min_pu_size; -+ int x_pu = x0 >> log2_min_pu_size; -+ MvField *curr = &tab_mvf[y_pu * min_pu_width + x_pu]; -+ int is_intra = curr->pred_flag == PF_INTRA; -+ int inc = log2_min_pu_size == 2 ? 2 : 1; -+ uint8_t *bs; - - #ifdef DISABLE_STRENGTHS - return; -@@ -818,34 +762,56 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) - boundary_upper = 0; - -+ bs = &s->horizontal_bs[(x0 + y0 * s->bs_width) >> 2]; -+ - if (boundary_upper) { - RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ? - ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) : -- s->ref->refPicList; -- int yp_pu = (y0 - 1) >> log2_min_pu_size; -- int yq_pu = y0 >> log2_min_pu_size; -- int yp_tu = (y0 - 1) >> log2_min_tu_size; -- int yq_tu = y0 >> log2_min_tu_size; -+ rpl; -+ MvField *top = curr - min_pu_width; -+ -+ if (is_intra) { -+ for (i = 0; i < (1 << log2_trafo_size); i += 4) -+ bs[i >> 2] = 2; -+ -+ } else { -+ int y_tu = y0 >> log2_min_tu_size; -+ int x_tu = x0 >> log2_min_tu_size; -+ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; -+ uint8_t *top_cbf_luma = curr_cbf_luma - min_tu_width; -+ -+ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -+ min_pu_in_4pix, sizeof (MvField), 4 >> 2, -+ rpl[0].list, rpl[1].list, rpl_top[0].list, rpl_top[1].list, -+ curr, top, bs); - - for (i = 0; i < (1 << log2_trafo_size); i += 4) { -- int x_pu = (x0 + i) >> log2_min_pu_size; -- int x_tu = (x0 + i) >> log2_min_tu_size; -- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; -- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; -- uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu]; -- uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu]; -- -- if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA) -- bs = 2; -- else if (curr_cbf_luma || top_cbf_luma) -- bs = 1; -- else -- bs = boundary_strength(s, curr, top, rpl_top); -- s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs; -+ int i_pu = i >> log2_min_pu_size; -+ int i_tu = i >> log2_min_tu_size; -+ -+ if (top[i_pu].pred_flag == PF_INTRA) -+ bs[i >> 2] = 2; -+ else if (curr_cbf_luma[i_tu] || top_cbf_luma[i_tu]) -+ bs[i >> 2] = 1; - } -+ } -+ } -+ -+ if (!is_intra) { -+ for (j = inc; j < trafo_in_min_pus; j += inc) { -+ MvField *top; -+ -+ curr += min_pu_width * inc; -+ top = curr - min_pu_width; -+ bs += s->bs_width * inc << log2_min_pu_size >> 2; -+ -+ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -+ min_pu_in_4pix, sizeof (MvField), 4 >> 2, -+ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, -+ curr, top, bs); -+ } - } - -- // bs for vertical TU boundaries - boundary_left = x0 > 0 && !(x0 & 7); - if (boundary_left && - ((!s->sh.slice_loop_filter_across_slices_enabled_flag && -@@ -856,64 +822,54 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) - boundary_left = 0; - -+ curr = &tab_mvf[y_pu * min_pu_width + x_pu]; -+ bs = &s->vertical_bs[(x0 + y0 * s->bs_width) >> 2]; -+ - if (boundary_left) { - RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? - ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) : -- s->ref->refPicList; -- int xp_pu = (x0 - 1) >> log2_min_pu_size; -- int xq_pu = x0 >> log2_min_pu_size; -- int xp_tu = (x0 - 1) >> log2_min_tu_size; -- int xq_tu = x0 >> log2_min_tu_size; -- -- for (i = 0; i < (1 << log2_trafo_size); i += 4) { -- int y_pu = (y0 + i) >> log2_min_pu_size; -- int y_tu = (y0 + i) >> log2_min_tu_size; -- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -- uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu]; -- uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu]; -- -- if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA) -- bs = 2; -- else if (curr_cbf_luma || left_cbf_luma) -- bs = 1; -- else -- bs = boundary_strength(s, curr, left, rpl_left); -- s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs; -- } -- } -+ rpl; -+ MvField *left = curr - 1; - -- if (log2_trafo_size > log2_min_pu_size && !is_intra) { -- RefPicList *rpl = s->ref->refPicList; -+ if (is_intra) { -+ for (j = 0; j < (1 << log2_trafo_size); j += 4) -+ bs[j * s->bs_width >> 2] = 2; - -- // bs for TU internal horizontal PU boundaries -- for (j = 8; j < (1 << log2_trafo_size); j += 8) { -- int yp_pu = (y0 + j - 1) >> log2_min_pu_size; -- int yq_pu = (y0 + j) >> log2_min_pu_size; -- -- for (i = 0; i < (1 << log2_trafo_size); i += 4) { -- int x_pu = (x0 + i) >> log2_min_pu_size; -- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; -- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; -- -- bs = boundary_strength(s, curr, top, rpl); -- s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; -+ } else { -+ int y_tu = y0 >> log2_min_tu_size; -+ int x_tu = x0 >> log2_min_tu_size; -+ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; -+ uint8_t *left_cbf_luma = curr_cbf_luma - 1; -+ -+ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -+ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, -+ rpl[0].list, rpl[1].list, rpl_left[0].list, rpl_left[1].list, -+ curr, left, bs); -+ -+ for (j = 0; j < (1 << log2_trafo_size); j += 4) { -+ int j_pu = j >> log2_min_pu_size; -+ int j_tu = j >> log2_min_tu_size; -+ -+ if (left[j_pu * min_pu_width].pred_flag == PF_INTRA) -+ bs[j * s->bs_width >> 2] = 2; -+ else if (curr_cbf_luma[j_tu * min_tu_width] || left_cbf_luma[j_tu * min_tu_width]) -+ bs[j * s->bs_width >> 2] = 1; - } - } -+ } - -- // bs for TU internal vertical PU boundaries -- for (j = 0; j < (1 << log2_trafo_size); j += 4) { -- int y_pu = (y0 + j) >> log2_min_pu_size; -+ if (!is_intra) { -+ for (i = inc; i < trafo_in_min_pus; i += inc) { -+ MvField *left; - -- for (i = 8; i < (1 << log2_trafo_size); i += 8) { -- int xp_pu = (x0 + i - 1) >> log2_min_pu_size; -- int xq_pu = (x0 + i) >> log2_min_pu_size; -- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -+ curr += inc; -+ left = curr - 1; -+ bs += inc << log2_min_pu_size >> 2; - -- bs = boundary_strength(s, curr, left, rpl); -- s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; -- } -+ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -+ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, -+ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, -+ curr, left, bs); - } - } - } -diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c -index 9d773d9..a6534a9 100644 ---- a/libavcodec/hevcdsp.c -+++ b/libavcodec/hevcdsp.c -@@ -123,6 +123,120 @@ DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters[3][16]) = { - #include "hevcdsp_template.c" - #undef BIT_DEPTH - -+static void hevc_deblocking_boundary_strengths(int pus, int dup, int in_inc, int out_inc, -+ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -+ MvField *curr, MvField *neigh, uint8_t *bs) -+{ -+ for (; pus > 0; pus--) { -+ int strength, out; -+ int curr_refL0 = curr_rpl0[curr->ref_idx[0]]; -+ int curr_refL1 = curr_rpl1[curr->ref_idx[1]]; -+ int neigh_refL0 = neigh_rpl0[neigh->ref_idx[0]]; -+ int neigh_refL1 = neigh_rpl1[neigh->ref_idx[1]]; -+ -+#if 1 // This more directly matches the original implementation -+ if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -+ // same L0 and L1 -+ if (curr_refL0 == neigh_refL0 && -+ curr_refL0 == curr_refL1 && -+ neigh_refL0 == neigh_refL1) { -+ if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -+ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && -+ (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -+ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) -+ strength = 1; -+ else -+ strength = 0; -+ } else if (neigh_refL0 == curr_refL0 && -+ neigh_refL1 == curr_refL1) { -+ if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -+ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) -+ strength = 1; -+ else -+ strength = 0; -+ } else if (neigh_refL1 == curr_refL0 && -+ neigh_refL0 == curr_refL1) { -+ if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -+ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) -+ strength = 1; -+ else -+ strength = 0; -+ } else { -+ strength = 1; -+ } -+ } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -+ Mv curr_mv0, neigh_mv0; -+ -+ if (curr->pred_flag & 1) { -+ curr_mv0 = curr->mv[0]; -+ } else { -+ curr_mv0 = curr->mv[1]; -+ curr_refL0 = curr_refL1; -+ } -+ -+ if (neigh->pred_flag & 1) { -+ neigh_mv0 = neigh->mv[0]; -+ } else { -+ neigh_mv0 = neigh->mv[1]; -+ neigh_refL0 = neigh_refL1; -+ } -+ -+ if (curr_refL0 == neigh_refL0) { -+ if (FFABS(curr_mv0.x - neigh_mv0.x) >= 4 || FFABS(curr_mv0.y - neigh_mv0.y) >= 4) -+ strength = 1; -+ else -+ strength = 0; -+ } else -+ strength = 1; -+ } else -+ strength = 1; -+#else // This has exactly the same effect, but is more suitable for vectorisation -+ Mv curr_mv[2]; -+ Mv neigh_mv[2]; -+ memcpy(curr_mv, curr->mv, sizeof curr_mv); -+ memcpy(neigh_mv, neigh->mv, sizeof neigh_mv); -+ -+ if (!(curr->pred_flag & 2)) { -+ curr_mv[1] = curr_mv[0]; -+ curr_refL1 = curr_refL0; -+ } -+ if (!(neigh->pred_flag & 2)) { -+ neigh_mv[1] = neigh_mv[0]; -+ neigh_refL1 = neigh_refL0; -+ } -+ if (!(curr->pred_flag & 1)) { -+ curr_mv[0] = curr_mv[1]; -+ curr_refL0 = curr_refL1; -+ } -+ if (!(neigh->pred_flag & 1)) { -+ neigh_mv[0] = neigh_mv[1]; -+ neigh_refL0 = neigh_refL1; -+ } -+ -+ strength = 1; -+ -+ strength &= (neigh_refL0 != curr_refL0) | (neigh_refL1 != curr_refL1) | -+ (FFABS(neigh_mv[0].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[0].y) >= 4) | -+ (FFABS(neigh_mv[1].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[1].y) >= 4); -+ -+ strength &= (neigh_refL1 != curr_refL0) | (neigh_refL0 != curr_refL1) | -+ (FFABS(neigh_mv[1].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[0].y) >= 4) | -+ (FFABS(neigh_mv[0].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[1].y) >= 4); -+ -+ strength |= (((curr->pred_flag + 1) ^ (neigh->pred_flag + 1)) >> 2); -+#endif -+ -+ curr += in_inc / sizeof (MvField); -+ neigh += in_inc / sizeof (MvField); -+ -+ for (out = dup; out > 0; out--) -+ { -+ *bs = strength; -+ bs += out_inc; -+ } -+ } -+} -+ - void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) - { - #undef FUNC -@@ -257,6 +371,8 @@ int i = 0; - break; - } - -+ hevcdsp->hevc_deblocking_boundary_strengths = hevc_deblocking_boundary_strengths; -+ - if (ARCH_X86) - ff_hevc_dsp_init_x86(hevcdsp, bit_depth); - if (ARCH_ARM) -diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h -index 9f1f6dd..e221e54 100644 ---- a/libavcodec/hevcdsp.h -+++ b/libavcodec/hevcdsp.h -@@ -42,6 +42,17 @@ typedef struct SAOParams { - uint8_t type_idx[3]; ///< sao_type_idx - } SAOParams; - -+typedef struct Mv { -+ int16_t x; ///< horizontal component of motion vector -+ int16_t y; ///< vertical component of motion vector -+} Mv; -+ -+typedef struct MvField { -+ DECLARE_ALIGNED(4, Mv, mv)[2]; -+ int8_t ref_idx[2]; -+ int8_t pred_flag; -+} MvField; -+ - typedef struct HEVCDSPContext { - void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height, - struct GetBitContext *gb, int pcm_bit_depth); -@@ -120,6 +131,9 @@ typedef struct HEVCDSPContext { - void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride, - int32_t *tc, uint8_t *no_p, - uint8_t *no_q); -+ void (*hevc_deblocking_boundary_strengths)(int pus, int dup, int in_inc, int out_inc, -+ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -+ MvField *curr, MvField *neigh, uint8_t *bs); - } HEVCDSPContext; - - void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); --- -2.7.4 - - -From 619366d6acfd5f040a3116fda97b1146c8e40250 Mon Sep 17 00:00:00 2001 -From: Peter de Rivaz -Date: Wed, 15 Jul 2015 09:09:11 +0100 -Subject: [PATCH 68/68] Only enable qpu when needed - ---- - libavcodec/hevc.h | 2 +- - libavcodec/rpi_qpu.c | 21 ++++++++++++++++----- - 2 files changed, 17 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -index 496c0e1..ce14975 100644 ---- a/libavcodec/hevc.h -+++ b/libavcodec/hevc.h -@@ -57,7 +57,7 @@ - // Define RPI_WORKER to launch a worker thread for pixel processing tasks - #define RPI_WORKER - // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs -- #define RPI_DEBLOCK_VPU -+ //#define RPI_DEBLOCK_VPU - - #endif - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index 5aa0432..ffd13ca 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -9,7 +9,7 @@ - // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion - #define RPI_ASYNC - // Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel --#define RPI_COMBINE_JOBS -+//#define RPI_COMBINE_JOBS - - #include - #include -@@ -143,9 +143,9 @@ static int gpu_init(volatile struct GPU **gpu) { - volatile struct GPU* ptr; - if (mb < 0) - return -1; -- -+#ifndef RPI_ASYNC - if (qpu_enable(mb, 1)) return -2; -- -+#endif - vcsm_init(); - gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); - ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -@@ -336,9 +336,9 @@ static void gpu_term(void) - vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); - pthread_join(vpu_thread, &res); - } --#endif -- -+#else - qpu_enable(mb, 0); -+#endif - gpu_free_internal(&gpu_mem_ptr); - - vcsm_exit(); -@@ -400,6 +400,7 @@ static void *vpu_start(void *arg) { - int count_deblock=0; - int count_qpu=0; - #endif -+ int qpu_started = 0; - while(1) { - int i; - int *p; // Pointer for a QPU/VPU job -@@ -427,6 +428,12 @@ static void *vpu_start(void *arg) { - if (p[7] == 0 && p[0] == 0 && p[16]==0) - goto job_done_early; - -+ if (!qpu_started) { -+ int result = qpu_enable(gpu->mb, 1); -+ av_assert0(result==0); -+ qpu_started = 1; -+ } -+ - #ifdef RPI_COMBINE_JOBS - // First scan for a qpu job - for (int x=0;xmb, 0); -+ } -+ - return NULL; - } - --- -2.7.4 - -From a0d0946951b53e64ce103dd61b455f8d1f72caf9 Mon Sep 17 00:00:00 2001 -From: John Cox -Date: Tue, 9 Feb 2016 11:57:40 +0000 -Subject: [PATCH 1/2] Zero copy code v6 - -This version has GPU buffer pooling code ---- - ffmpeg.c | 123 +++++++++----- - libavcodec/Makefile | 2 + - libavcodec/avcodec.h | 6 + - libavcodec/hevc.c | 92 ++++++----- - libavcodec/hevc_filter.c | 83 +++++----- - libavcodec/rpi_qpu.c | 2 +- - libavcodec/rpi_qpu.h | 109 ++++++++++++- - libavcodec/rpi_zc.c | 406 +++++++++++++++++++++++++++++++++++++++++++++++ - libavcodec/rpi_zc.h | 83 ++++++++++ - 9 files changed, 779 insertions(+), 127 deletions(-) - create mode 100644 libavcodec/rpi_zc.c - create mode 100644 libavcodec/rpi_zc.h - -diff --git a/ffmpeg.c b/ffmpeg.c -index 50c6e86..953e5b8 100644 ---- a/ffmpeg.c -+++ b/ffmpeg.c -@@ -25,7 +25,7 @@ - - #ifdef RPI - #define RPI_DISPLAY --//#define RPI_ZERO_COPY -+#define RPI_ZERO_COPY - #endif - - #include "config.h" -@@ -80,9 +80,7 @@ - #include - #include - #include --#ifdef RPI_ZERO_COPY --#include "libavcodec/rpi_qpu.h" --#endif -+#include "libavcodec/rpi_zc.h" - #endif - - #if HAVE_SYS_RESOURCE_H -@@ -183,13 +181,7 @@ static void free_input_threads(void); - - static MMAL_COMPONENT_T* rpi_display = NULL; - static MMAL_POOL_T *rpi_pool = NULL; -- --#ifdef RPI_ZERO_COPY --static uint8_t *get_vc_handle(AVBufferRef *bref) { -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -- return (uint8_t *)p->vc_handle; --} --#endif -+static volatile int rpi_display_count = 0; - - static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) - { -@@ -206,7 +198,7 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) - for (i = 0; i < NUM_BUFFERS; ++i) - { - MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; -- void* bufPtr = buffer->data; -+ char * bufPtr = buffer->data; - memset(bufPtr, i*30, w*h); - memset(bufPtr+w*h, 128, (w*h)/2); - } -@@ -215,23 +207,31 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) - return pool; - } - --static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -+static void display_cb_input(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { -+#ifdef RPI_ZERO_COPY -+ av_rpi_zc_unref(buffer->user_data); -+ --rpi_display_count; -+#endif -+ mmal_buffer_header_release(buffer); -+} -+ -+static void display_cb_control(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { - mmal_buffer_header_release(buffer); - } - - static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) - { - MMAL_COMPONENT_T* display; -- int w2 = (w+31)&~31; -- int h2 = (h+15)&~15; - MMAL_DISPLAYREGION_T region = - { -- {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -+ .hdr = {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, - .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, - .layer = 2, - .fullscreen = 0, - .dest_rect = {x, y, w, h} - }; -+ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(w, h); -+ - bcm_host_init(); // TODO is this needed? - mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); - assert(display); -@@ -240,8 +240,8 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) - - MMAL_ES_FORMAT_T* format = display->input[0]->format; - format->encoding = MMAL_ENCODING_I420; -- format->es->video.width = w2; -- format->es->video.height = h2; -+ format->es->video.width = geo.stride_y; -+ format->es->video.height = geo.height_y; - format->es->video.crop.x = 0; - format->es->video.crop.y = 0; - format->es->video.crop.width = w; -@@ -250,46 +250,75 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) - - mmal_component_enable(display); - -- rpi_pool = display_alloc_pool(display->input[0], w2, h2); -+ rpi_pool = display_alloc_pool(display->input[0], geo.stride_y, geo.height_y); - - mmal_port_enable(display->input[0],display_cb_input); -- mmal_port_enable(display->control,display_cb_input); -+ mmal_port_enable(display->control,display_cb_control); - -- printf("Allocated display %d %d\n",w,h); -+ printf("Allocated display %dx%d in %dx%d\n", w, h, geo.stride_y, geo.height_y); - - return display; - } - --static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) -+static void display_frame(struct AVCodecContext * const s, MMAL_COMPONENT_T* const display, const AVFrame* const fr) - { -- int w = fr->width; -- int h = fr->height; -- int w2 = (w+31)&~31; -- int h2 = (h+15)&~15; - if (!display || !rpi_pool) - return; -+ -+ if (rpi_display_count >= 3) { -+ av_log(s, AV_LOG_VERBOSE, "Frame dropped\n"); -+ return; -+ } -+ - MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); - if (!buf) { -- // Running too fast so drop the frame -- return; -+ // Running too fast so drop the frame -+ printf("Q alloc failure\n"); -+ return; - } - assert(buf); - buf->cmd = 0; -- buf->length = (w2 * h2 * 3)/2; - buf->offset = 0; // Offset to valid data - buf->flags = 0; - #ifdef RPI_ZERO_COPY -- buf->data = get_vc_handle(fr->buf[0]); -- buf->alloc_size = (w2*h2*3)/2; -+{ -+ const AVRpiZcRefPtr fr_buf = av_rpi_zc_ref(s, fr, 1); -+ -+ buf->user_data = fr_buf; -+ buf->data = av_rpi_zc_vc_handle(fr_buf); -+ buf->alloc_size = -+ buf->length = av_rpi_zc_numbytes(fr_buf); -+ -+ ++rpi_display_count; -+} - #else -+{ -+#error YYY -+ int w = fr->width; -+ int h = fr->height; -+ int w2 = (w+31)&~31; -+ int h2 = (h+15)&~15; -+ -+ buf->length = (w2 * h2 * 3)/2; -+ buf->user_data = NULL; -+ - //mmal_buffer_header_mem_lock(buf); - memcpy(buf->data, fr->data[0], w2 * h); - memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); - memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); - //mmal_buffer_header_mem_unlock(buf); -+} - #endif - -- mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released -+ while (rpi_display_count >= 3) { -+ usleep(5000); -+ } -+ -+ if (mmal_port_send_buffer(display->input[0], buf) != MMAL_SUCCESS) -+ { -+ printf("** send failed: depth=%d\n", rpi_display_count); -+ display_cb_input(NULL, buf); -+ } - } - - static void display_exit(MMAL_COMPONENT_T* display) -@@ -687,6 +716,11 @@ static void ffmpeg_cleanup(int ret) - avformat_close_input(&input_files[i]->ctx); - av_freep(&input_files[i]); - } -+ -+#ifdef RPI_DISPLAY -+ display_exit(rpi_display); -+#endif -+ - for (i = 0; i < nb_input_streams; i++) { - InputStream *ist = input_streams[i]; - -@@ -698,6 +732,9 @@ static void ffmpeg_cleanup(int ret) - av_freep(&ist->filters); - av_freep(&ist->hwaccel_device); - -+#ifdef RPI_ZERO_COPY -+ av_rpi_zc_uninit(ist->dec_ctx); -+#endif - avcodec_free_context(&ist->dec_ctx); - - av_freep(&input_streams[i]); -@@ -729,9 +766,6 @@ static void ffmpeg_cleanup(int ret) - term_exit(); - ffmpeg_exited = 1; - --#ifdef RPI_DISPLAY -- display_exit(rpi_display); --#endif - } - - void remove_avoptions(AVDictionary **a, AVDictionary *b) -@@ -1091,18 +1125,19 @@ static void do_video_out(AVFormatContext *s, - int frame_size = 0; - InputStream *ist = NULL; - AVFilterContext *filter = ost->filter->filter; -+ -+ if (ost->source_index >= 0) -+ ist = input_streams[ost->source_index]; -+ - #ifdef RPI_DISPLAY -- if (next_picture) -+ if (next_picture && ist != NULL) - { -- if (!rpi_display) -+ if (!rpi_display) - rpi_display = display_init(0,0,next_picture->width,next_picture->height); -- display_frame(rpi_display,next_picture); -+ display_frame(ist->dec_ctx, rpi_display, next_picture); - } - #endif - -- if (ost->source_index >= 0) -- ist = input_streams[ost->source_index]; -- - if (filter->inputs[0]->frame_rate.num > 0 && - filter->inputs[0]->frame_rate.den > 0) - duration = 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base)); -@@ -2708,6 +2743,12 @@ static int init_input_stream(int ist_index, char *error, int error_len) - ist->dec_ctx->opaque = ist; - ist->dec_ctx->get_format = get_format; - ist->dec_ctx->get_buffer2 = get_buffer; -+ -+#ifdef RPI_ZERO_COPY -+ // Overrides the above get_buffer2 -+ av_rpi_zc_init(ist->dec_ctx); -+#endif -+ - ist->dec_ctx->thread_safe_callbacks = 1; - - av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0); -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 03065cd..21e4514 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -9,6 +9,7 @@ HEADERS = avcodec.h \ - rpi_shader.h \ - rpi_mailbox.h \ - rpi_hevc_transform.h \ -+ rpi_zc.h \ - d3d11va.h \ - dirac.h \ - dv_profile.h \ -@@ -50,6 +51,7 @@ OBJS = allcodecs.o \ - rpi_qpu.o \ - rpi_shader.o \ - rpi_mailbox.o \ -+ rpi_zc.o \ - vorbis_parser.o \ - xiph.o \ - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index 39713ed..a1ba217 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -3505,6 +3505,12 @@ typedef struct AVCodecContext { - #define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 - #endif - -+ /** -+ * Opaque pointer for use by replacement get_buffer2 code -+ * -+ * @author jc (08/02/2016) -+ */ -+ void * get_buffer_context; - } AVCodecContext; - - AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -index 8437e10..51736c7 100644 ---- a/libavcodec/hevc.c -+++ b/libavcodec/hevc.c -@@ -114,10 +114,6 @@ static uint32_t rpi_filter_coefs[8][1] = { - { ENCODE_COEFFS( -2, 10, 58, -2) } - }; - --static uint32_t get_vc_address(AVBufferRef *bref) { -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -- return p->vc; --} - #endif - - -@@ -2197,9 +2193,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int bw = nPbW-start_x; - int bh = nPbH-start_y; - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); - *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); - *y++ = my2_mx2_my_mx; - if (weight_flag) { -@@ -2207,7 +2203,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - } else { - *y++ = 1; // Weight of 1 and offset of 0 - } -- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; - } - } -@@ -2246,8 +2242,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); - *u++ = ( (bwframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } - s->curr_u_mvs = u; -@@ -2297,9 +2293,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int bw = nPbW-start_x; - int bh = nPbH-start_y; - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); - *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); - *y++ = my2_mx2_my_mx; - if (weight_flag) { -@@ -2307,7 +2303,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - } else { - *y++ = 1; // Weight of 1 and offset of 0 - } -- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; - } - } -@@ -2347,8 +2343,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); - *u++ = ( (bwsh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] - *u++ = rpi_filter_coefs[_mx][0]; -@@ -2360,8 +2356,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - *u++ = 1; // Weight of 1 and offset of 0 - *u++ = 1; - } -- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } - s->curr_u_mvs = u; -@@ -2403,13 +2399,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - int bw = nPbW-start_x; - int bh = nPbH-start_y; - y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); - y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); - *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); - *y++ = my2_mx2_my_mx; - *y++ = 1; // B frame weighted prediction not supported -- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); - y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; - } - } -@@ -2453,8 +2449,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, - u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; - u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); - *u++ = ( (bwmc_filter_uv_b; - u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; - u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); - *u++ = ( (bwframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); - } - } - s->curr_u_mvs = u; -@@ -3270,12 +3266,13 @@ static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx, - return vsum; - } - --static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) -+static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, const int cIdx) - { - //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; - int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; - int pitch = frame->linesize[cIdx]; -- uint32_t base = get_vc_address(frame->buf[cIdx]); -+ uint32_t base = c_idx == 0 ? get_vc_address_y(frame); -+ c_idx == 1 ? get_vc_address_u(frame) : get_vc_address_v(frame); - if (p>=base && pdata[cIdx] + (p-base); - } -@@ -3562,6 +3559,7 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) - #ifdef RPI - - #ifndef RPI_FAST_CACHEFLUSH -+#error RPI_FAST_CACHEFLUSH is broken - static void flush_buffer(AVBufferRef *bref) { - GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); - gpu_cache_flush(p); -@@ -3572,7 +3570,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - { - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); - int n = s->ps.sps->height; - int curr_y = 0; - int curr_uv = 0; -@@ -3580,21 +3578,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) - int sz,base; - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; -- iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].handle = p.vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = (int)(p->arm) + base; -+ iocache.s[0].addr = (int)(p.arm) + base; - iocache.s[0].size = sz; -- p = av_buffer_pool_opaque(frame->buf[2]); -- iocache.s[1].handle = p->vcsm_handle; -+ p = get_gpu_mem_ptr_v(s->frame); -+ iocache.s[1].handle = p.vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = (int)(p->arm) + base; -+ iocache.s[1].addr = (int)(p.arm) + base; - iocache.s[1].size = sz; -- p = av_buffer_pool_opaque(frame->buf[0]); -+ p = get_gpu_mem_ptr_y(s->frame); - sz = s->frame->linesize[0] * (n-curr_y); - base = s->frame->linesize[0] * curr_y; -- iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].handle = p.vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = (int)(p->arm) + base; -+ iocache.s[2].addr = (int)(p.arm) + base; - iocache.s[2].size = sz; - vcsm_clean_invalid( &iocache ); - #else -@@ -3612,7 +3610,7 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM - int curr_y; - int curr_uv; - int n_uv; -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); - int sz,base; - int (*d)[2] = s->dblk_cmds[job]; - int low=(*d)[1]; -@@ -3629,21 +3627,21 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM - - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; -- iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].handle = p.vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = (int)(p->arm) + base; -+ iocache.s[0].addr = (int)(p.arm) + base; - iocache.s[0].size = sz; -- p = av_buffer_pool_opaque(frame->buf[2]); -- iocache.s[1].handle = p->vcsm_handle; -+ p = get_gpu_mem_ptr_v(s->frame); -+ iocache.s[1].handle = p.vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = (int)(p->arm) + base; -+ iocache.s[1].addr = (int)(p.arm) + base; - iocache.s[1].size = sz; -- p = av_buffer_pool_opaque(frame->buf[0]); -+ p = get_gpu_mem_ptr_y(s->frame); - sz = s->frame->linesize[0] * (n-curr_y); - base = s->frame->linesize[0] * curr_y; -- iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].handle = p.vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = (int)(p->arm) + base; -+ iocache.s[2].addr = (int)(p.arm) + base; - iocache.s[2].size = sz; - - iocache.s[3].handle = p0->vcsm_handle; -diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -index 826a82f..c4fa305 100644 ---- a/libavcodec/hevc_filter.c -+++ b/libavcodec/hevc_filter.c -@@ -879,17 +879,25 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, - #undef CR - - #ifdef RPI_INTER_QPU --static void flush_buffer(AVBufferRef *bref) { -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -- gpu_cache_flush(p); -+static void flush_buffer_y(const AVFrame * const frame) { -+ GPU_MEM_PTR_T p = get_gpu_mem_ptr_y(frame); -+ gpu_cache_flush(&p); - } - --// Return Physical address for this image --static uint32_t get_vc_address(AVBufferRef *bref) { -- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -- return p->vc; -+static void flush_buffer_u(const AVFrame * const frame) { -+ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(frame); -+ gpu_cache_flush(&p); - } - -+static void flush_buffer_v(const AVFrame * const frame) { -+ GPU_MEM_PTR_T p = get_gpu_mem_ptr_v(frame); -+ gpu_cache_flush(&p); -+} -+ -+ -+#ifdef RPI_DEBLOCK_VPU -+#error Not fixed yet -+ - // ff_hevc_flush_buffer_lines - // flushes and invalidates all pixel rows in [start,end-1] - static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) -@@ -901,44 +909,44 @@ static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int f - int curr_uv = curr_y >> s->ps.sps->vshift[1]; - int n_uv = n >> s->ps.sps->vshift[1]; - int sz,base; -- GPU_MEM_PTR_T *p; -+ GPU_MEM_PTR_T p; - if (curr_uv < 0) curr_uv = 0; - if (n_uv<=curr_uv) { return; } - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; - if (flush_chroma) { -- p = av_buffer_pool_opaque(s->frame->buf[1]); -- iocache.s[0].handle = p->vcsm_handle; -+ p = get_gpu_mem_ptr_u(s->frame); -+ iocache.s[0].handle = p.vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = (int)p->arm + base; -+ iocache.s[0].addr = (int)p.arm + base; - iocache.s[0].size = sz; -- p = av_buffer_pool_opaque(s->frame->buf[2]); -- iocache.s[1].handle = p->vcsm_handle; -+ p = get_gpu_mem_ptr_v(s->frame); -+ iocache.s[1].handle = p.vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = (int)p->arm + base; -+ iocache.s[1].addr = (int)p.arm + base; - iocache.s[1].size = sz; - } - if (flush_luma) { -- p = av_buffer_pool_opaque(s->frame->buf[0]); -+ p = get_gpu_mem_ptr_y(s->frame); - sz = s->frame->linesize[0] * (n-curr_y); - base = s->frame->linesize[0] * curr_y; -- iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].handle = p.vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = (int)p->arm + base; -+ iocache.s[2].addr = (int)p.arm + base; - iocache.s[2].size = sz; - } - vcsm_clean_invalid( &iocache ); - #else - if (flush_chroma) { -- flush_buffer(s->frame->buf[1]); -- flush_buffer(s->frame->buf[2]); -+ flush_buffer_u(s->frame); -+ flush_buffer_v(s->frame); - } - if (flush_luma) { -- flush_buffer(s->frame->buf[0]); -+ flush_buffer_y(s->frame); - } - #endif - } -- -+#endif - - void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - { -@@ -950,37 +958,37 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - int curr_uv = curr_y >> s->ps.sps->vshift[1]; - int n_uv = n >> s->ps.sps->vshift[1]; - int sz,base; -- GPU_MEM_PTR_T *p; -+ GPU_MEM_PTR_T p; - if (curr_uv < 0) curr_uv = 0; - if (n_uv<=curr_uv) { return; } - sz = s->frame->linesize[1] * (n_uv-curr_uv); - base = s->frame->linesize[1] * curr_uv; -- p = av_buffer_pool_opaque(s->frame->buf[1]); -- iocache.s[0].handle = p->vcsm_handle; -+ p = get_gpu_mem_ptr_u(s->frame); -+ iocache.s[0].handle = p.vcsm_handle; - iocache.s[0].cmd = 3; // clean+invalidate -- iocache.s[0].addr = (int)p->arm + base; -+ iocache.s[0].addr = (int)p.arm + base; - iocache.s[0].size = sz; -- p = av_buffer_pool_opaque(s->frame->buf[2]); -- iocache.s[1].handle = p->vcsm_handle; -+ p = get_gpu_mem_ptr_v(s->frame); -+ iocache.s[1].handle = p.vcsm_handle; - iocache.s[1].cmd = 3; // clean+invalidate -- iocache.s[1].addr = (int)p->arm + base; -+ iocache.s[1].addr = (int)p.arm + base; - iocache.s[1].size = sz; - - #ifdef RPI_LUMA_QPU -- p = av_buffer_pool_opaque(s->frame->buf[0]); -+ p = get_gpu_mem_ptr_y(s->frame); - sz = s->frame->linesize[0] * (n-curr_y); - base = s->frame->linesize[0] * curr_y; -- iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].handle = p.vcsm_handle; - iocache.s[2].cmd = 3; // clean+invalidate -- iocache.s[2].addr = (int)p->arm + base; -+ iocache.s[2].addr = (int)p.arm + base; - iocache.s[2].size = sz; - #endif - vcsm_clean_invalid( &iocache ); - #else -- flush_buffer(s->frame->buf[1]); -- flush_buffer(s->frame->buf[2]); -+ flush_buffer_u(s->frame); -+ flush_buffer_v(s->frame); - #ifdef RPI_LUMA_QPU -- flush_buffer(s->frame->buf[0]); -+ flush_buffer_y(s->frame); - #endif - - #endif -@@ -992,6 +1000,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) - #endif - - #ifdef RPI_DEBLOCK_VPU -+#error XXX - /* rpi_deblock deblocks an entire row of ctbs using the VPU */ - static void rpi_deblock(HEVCContext *s, int y, int ctb_size) - { -@@ -1000,21 +1009,21 @@ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) - // TODO flush buffer of beta/tc setup when it becomes cached - - // Prepare three commands at once to avoid calling overhead -- s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; -+ s->vpu_cmds_arm[0][0] = get_vc_address_y(s->frame) + s->frame->linesize[0] * y; - s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; - s->vpu_cmds_arm[0][2] = s->setup_width; - s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); - s->vpu_cmds_arm[0][4] = ctb_size>>4; - s->vpu_cmds_arm[0][5] = 2; - -- s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -+ s->vpu_cmds_arm[1][0] = get_vc_address_u(s->frame) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); - s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; - s->vpu_cmds_arm[1][2] = s->uv_setup_width; - s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); - s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; - s->vpu_cmds_arm[1][5] = 3; - -- s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -+ s->vpu_cmds_arm[2][0] = get_vc_address_v(s->frame) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); - s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; - s->vpu_cmds_arm[2][2] = s->uv_setup_width; - s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index ffd13ca..b0c9bc5 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -250,7 +250,7 @@ int gpu_get_mailbox(void) - } - - // Call this to clean and invalidate a region of memory --void gpu_cache_flush(GPU_MEM_PTR_T *p) -+void gpu_cache_flush(const GPU_MEM_PTR_T * const p) - { - #ifdef RPI_FAST_CACHEFLUSH - struct vcsm_user_clean_invalid_s iocache = {}; -diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -index 81c2bb1..b913f79 100644 ---- a/libavcodec/rpi_qpu.h -+++ b/libavcodec/rpi_qpu.h -@@ -2,8 +2,11 @@ - #define RPI_QPU_H - - // Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code -+// *** N.B. Code has rotted & crashes if this is unset (before this set of changes) - #define RPI_FAST_CACHEFLUSH - -+#define RPI_ONE_BUF 1 -+ - typedef struct gpu_mem_ptr_s { - unsigned char *arm; // Pointer to memory mapped on ARM side - int vc_handle; // Videocore handle of relocatable memory -@@ -16,9 +19,113 @@ typedef struct gpu_mem_ptr_s { - extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); - extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); - extern void gpu_free(GPU_MEM_PTR_T *p); --extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+extern void gpu_cache_flush(const GPU_MEM_PTR_T * const p); - extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); - -+#include "libavutil/frame.h" -+#if !RPI_ONE_BUF -+static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[0]); -+ return p->vc; -+} -+ -+static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ return p->vc; -+} -+ -+static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[2]); -+ return p->vc; -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -+ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[0]); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -+ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[1]); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -+ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[2]); -+} -+ -+#else -+ -+static inline int gpu_is_buf1(const AVFrame * const frame) -+{ -+ return frame->buf[1] == NULL; -+} -+ -+static inline GPU_MEM_PTR_T * gpu_buf1_gmem(const AVFrame * const frame) -+{ -+ return av_buffer_get_opaque(frame->buf[0]); -+} -+ -+static inline GPU_MEM_PTR_T * gpu_buf3_gmem(const AVFrame * const frame, const int n) -+{ -+ return av_buffer_pool_opaque(frame->buf[n]); -+} -+ -+ -+static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -+ return gpu_is_buf1(frame) ? gpu_buf1_gmem(frame)->vc : gpu_buf3_gmem(frame, 0)->vc; -+} -+ -+static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -+ return gpu_is_buf1(frame) ? -+ gpu_buf1_gmem(frame)->vc + frame->data[1] - frame->data[0] : -+ gpu_buf3_gmem(frame, 1)->vc; -+} -+ -+static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -+ return gpu_is_buf1(frame) ? -+ gpu_buf1_gmem(frame)->vc + frame->data[2] - frame->data[0] : -+ gpu_buf3_gmem(frame, 2)->vc; -+} -+ -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -+ if (gpu_is_buf1(frame)) -+ { -+ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -+ g.numbytes = frame->data[1] - frame->data[0]; -+ return g; -+ } -+ else -+ return *gpu_buf3_gmem(frame, 0); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -+ if (gpu_is_buf1(frame)) -+ { -+ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -+ g.arm += frame->data[1] - frame->data[0]; -+ g.vc += frame->data[1] - frame->data[0]; -+ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -+ return g; -+ } -+ else -+ return *gpu_buf3_gmem(frame, 1); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -+ if (gpu_is_buf1(frame)) -+ { -+ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -+ g.arm += frame->data[2] - frame->data[0]; -+ g.vc += frame->data[2] - frame->data[0]; -+ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -+ return g; -+ } -+ else -+ return *gpu_buf3_gmem(frame, 2); -+} -+ -+#endif -+ -+ - // QPU specific functions - extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); - extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -diff --git a/libavcodec/rpi_zc.c b/libavcodec/rpi_zc.c -new file mode 100644 -index 0000000..9580165 ---- /dev/null -+++ b/libavcodec/rpi_zc.c -@@ -0,0 +1,406 @@ -+#include "config.h" -+#ifdef RPI -+#include "rpi_qpu.h" -+#include "rpi_zc.h" -+ -+#include "libavutil/buffer_internal.h" -+ -+struct ZcPoolEnt; -+ -+typedef struct ZcPool -+{ -+ int numbytes; -+ struct ZcPoolEnt * head; -+ pthread_mutex_t lock; -+} ZcPool; -+ -+typedef struct ZcPoolEnt -+{ -+ // It is important that we start with gmem as other bits of code will expect to see that -+ GPU_MEM_PTR_T gmem; -+ struct ZcPoolEnt * next; -+ struct ZcPool * pool; -+} ZcPoolEnt; -+ -+static ZcPoolEnt * zc_pool_ent_alloc(ZcPool * const pool, const int size) -+{ -+ ZcPoolEnt * const zp = av_malloc(sizeof(ZcPoolEnt)); -+ -+ if (zp == NULL) { -+ av_log(NULL, AV_LOG_ERROR, "av_malloc(ZcPoolEnt) failed\n"); -+ goto fail0; -+ } -+ -+ if (gpu_malloc_cached(size, &zp->gmem) != 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "av_gpu_malloc_cached(%d) failed\n", size); -+ goto fail1; -+ } -+ -+ zp->next = NULL; -+ zp->pool = pool; -+ return zp; -+ -+fail1: -+ av_free(zp); -+fail0: -+ return NULL; -+} -+ -+static void zc_pool_ent_free(ZcPoolEnt * const zp) -+{ -+ gpu_free(&zp->gmem); -+ av_free(zp); -+} -+ -+static void zc_pool_flush(ZcPool * const pool) -+{ -+ ZcPoolEnt * p = pool->head; -+ pool->head = NULL; -+ while (p != NULL) -+ { -+ ZcPoolEnt * const zp = p; -+ p = p->next; -+ zc_pool_ent_free(zp); -+ } -+} -+ -+static ZcPoolEnt * zc_pool_alloc(ZcPool * const pool, const int numbytes) -+{ -+ ZcPoolEnt * zp; -+ pthread_mutex_lock(&pool->lock); -+ -+ if (numbytes != pool->numbytes) -+ { -+ zc_pool_flush(pool); -+ pool->numbytes = numbytes; -+ } -+ -+ if (pool->head != NULL) -+ { -+ zp = pool->head; -+ pool->head = zp->next; -+ } -+ else -+ { -+ zp = zc_pool_ent_alloc(pool, numbytes); -+ } -+ -+ pthread_mutex_unlock(&pool->lock); -+ return zp; -+} -+ -+static void zc_pool_free(ZcPoolEnt * const zp) -+{ -+ ZcPool * const pool = zp == NULL ? NULL : zp->pool; -+ if (zp != NULL) -+ { -+ pthread_mutex_lock(&pool->lock); -+ if (pool->numbytes == zp->gmem.numbytes) -+ { -+ zp->next = pool->head; -+ pool->head = zp; -+ pthread_mutex_unlock(&pool->lock); -+ } -+ else -+ { -+ pthread_mutex_unlock(&pool->lock); -+ zc_pool_ent_free(zp); -+ } -+ } -+} -+ -+static void -+zc_pool_init(ZcPool * const pool) -+{ -+ pool->numbytes = -1; -+ pool->head = NULL; -+ pthread_mutex_init(&pool->lock, NULL); -+} -+ -+static void -+zc_pool_destroy(ZcPool * const pool) -+{ -+ pool->numbytes = -1; -+ zc_pool_flush(pool); -+ pthread_mutex_destroy(&pool->lock); -+} -+ -+ -+typedef struct AVZcEnv -+{ -+ ZcPool pool; -+} ZcEnv; -+ -+// Callback when buffer unrefed to zero -+static void rpi_free_display_buffer(void *opaque, uint8_t *data) -+{ -+ ZcPoolEnt *const zp = opaque; -+// printf("%s: data=%p\n", __func__, data); -+ zc_pool_free(zp); -+} -+ -+static inline GPU_MEM_PTR_T * pic_gm_ptr(AVBufferRef * const buf) -+{ -+ // Kludge where we check the free fn to check this is really -+ // one of our buffers - can't think of a better way -+ return buf == NULL || buf->buffer->free != rpi_free_display_buffer ? NULL : -+ av_buffer_get_opaque(buf); -+} -+ -+AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -+ const unsigned int video_width, const unsigned int video_height) -+{ -+ AVRpiZcFrameGeometry geo; -+ geo.stride_y = (video_width + 32 + 31) & ~31; -+ geo.stride_c = geo.stride_y / 2; -+// geo.height_y = (video_height + 15) & ~15; -+ geo.height_y = (video_height + 32 + 31) & ~31; -+ geo.height_c = geo.height_y / 2; -+ return geo; -+} -+ -+static AVBufferRef * rpi_buf_pool_alloc(ZcPool * const pool, int size) -+{ -+ ZcPoolEnt *const zp = zc_pool_alloc(pool, size); -+ AVBufferRef * buf; -+ -+ if (zp == NULL) { -+ av_log(NULL, AV_LOG_ERROR, "zc_pool_alloc(%d) failed\n", size); -+ goto fail0; -+ } -+ -+ if ((buf = av_buffer_create(zp->gmem.arm, size, rpi_free_display_buffer, zp, AV_BUFFER_FLAG_READONLY)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "av_buffer_create() failed\n"); -+ goto fail2; -+ } -+ -+ return buf; -+ -+fail2: -+ zc_pool_free(zp); -+fail0: -+ return NULL; -+} -+ -+static int rpi_get_display_buffer(struct AVCodecContext * const s, AVFrame * const frame) -+{ -+ ZcEnv *const zc = s->get_buffer_context; -+ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(frame->width, frame->height); -+ const unsigned int size_y = geo.stride_y * geo.height_y; -+ const unsigned int size_c = geo.stride_c * geo.height_c; -+ const unsigned int size_pic = size_y + size_c * 2; -+ AVBufferRef * buf; -+ unsigned int i; -+ -+// printf("Do local alloc: format=%#x, %dx%d: %u\n", frame->format, frame->width, frame->height, size_pic); -+ -+ if ((buf = rpi_buf_pool_alloc(&zc->pool, size_pic)) == NULL) -+ { -+ av_log(s, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); -+ return AVERROR(ENOMEM); -+ } -+ -+ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { -+ frame->buf[i] = NULL; -+ frame->data[i] = NULL; -+ frame->linesize[i] = 0; -+ } -+ -+ frame->buf[0] = buf; -+ frame->linesize[0] = geo.stride_y; -+ frame->linesize[1] = geo.stride_c; -+ frame->linesize[2] = geo.stride_c; -+ frame->data[0] = buf->data; -+ frame->data[1] = frame->data[0] + size_y; -+ frame->data[2] = frame->data[1] + size_c; -+ frame->extended_data = frame->data; -+ // Leave extended buf alone -+ -+ return 0; -+} -+ -+ -+#define RPI_GET_BUFFER2 1 -+ -+int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags) -+{ -+#if !RPI_GET_BUFFER2 -+ return avcodec_default_get_buffer2(s, frame, flags); -+#else -+ int rv; -+ -+ if ((s->codec->capabilities & AV_CODEC_CAP_DR1) == 0 || -+ frame->format != AV_PIX_FMT_YUV420P) -+ { -+// printf("Do default alloc: format=%#x\n", frame->format); -+ rv = avcodec_default_get_buffer2(s, frame, flags); -+ } -+ else -+ { -+ rv = rpi_get_display_buffer(s, frame); -+ } -+ -+#if 0 -+ printf("%s: %dx%d lsize=%d/%d/%d data=%p/%p/%p bref=%p/%p/%p opaque[0]=%p\n", __func__, -+ frame->width, frame->height, -+ frame->linesize[0], frame->linesize[1], frame->linesize[2], -+ frame->data[0], frame->data[1], frame->data[2], -+ frame->buf[0], frame->buf[1], frame->buf[2], -+ av_buffer_get_opaque(frame->buf[0])); -+#endif -+ return rv; -+#endif -+} -+ -+ -+static AVBufferRef * zc_copy(struct AVCodecContext * const s, -+ const AVFrame * const src) -+{ -+ AVFrame dest_frame; -+ AVFrame * const dest = &dest_frame; -+ unsigned int i; -+ uint8_t * psrc, * pdest; -+ -+ dest->width = src->width; -+ dest->height = src->height; -+ -+ if (rpi_get_display_buffer(s, dest) != 0) -+ { -+ return NULL; -+ } -+ -+ for (i = 0, psrc = src->data[0], pdest = dest->data[0]; -+ i != dest->height; -+ ++i, psrc += src->linesize[0], pdest += dest->linesize[0]) -+ { -+ memcpy(pdest, psrc, dest->width); -+ } -+ for (i = 0, psrc = src->data[1], pdest = dest->data[1]; -+ i != dest->height / 2; -+ ++i, psrc += src->linesize[1], pdest += dest->linesize[1]) -+ { -+ memcpy(pdest, psrc, dest->width / 2); -+ } -+ for (i = 0, psrc = src->data[2], pdest = dest->data[2]; -+ i != dest->height / 2; -+ ++i, psrc += src->linesize[2], pdest += dest->linesize[2]) -+ { -+ memcpy(pdest, psrc, dest->width / 2); -+ } -+ -+ return dest->buf[0]; -+} -+ -+ -+AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, -+ const AVFrame * const frame, const int maycopy) -+{ -+ assert(s != NULL); -+ -+ if (frame->format != AV_PIX_FMT_YUV420P) -+ { -+ av_log(s, AV_LOG_WARNING, "%s: *** Format not YUV420P: %d\n", __func__, frame->format); -+ return NULL; -+ } -+ -+ if (frame->buf[1] != NULL) -+ { -+ if (maycopy) -+ { -+ av_log(s, AV_LOG_INFO, "%s: *** Not a single buf frame: copying\n", __func__); -+ return zc_copy(s, frame); -+ } -+ else -+ { -+ av_log(s, AV_LOG_WARNING, "%s: *** Not a single buf frame: NULL\n", __func__); -+ return NULL; -+ } -+ } -+ -+ if (pic_gm_ptr(frame->buf[0]) == NULL) -+ { -+ if (maycopy) -+ { -+ av_log(s, AV_LOG_INFO, "%s: *** Not one of our buffers: copying\n", __func__); -+ return zc_copy(s, frame); -+ } -+ else -+ { -+ av_log(s, AV_LOG_WARNING, "%s: *** Not one of our buffers: NULL\n", __func__); -+ return NULL; -+ } -+ } -+ -+ return av_buffer_ref(frame->buf[0]); -+} -+ -+int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref) -+{ -+ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -+ return p == NULL ? -1 : p->vc_handle; -+} -+ -+int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref) -+{ -+ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -+ return p == NULL ? 0 : p->numbytes; -+} -+ -+void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref) -+{ -+ if (fr_ref != NULL) -+ { -+ av_buffer_unref(&fr_ref); -+ } -+} -+ -+AVZcEnvPtr av_rpi_zc_env_alloc(void) -+{ -+ ZcEnv * const zc = av_mallocz(sizeof(ZcEnv)); -+ if (zc == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "av_rpi_zc_env_alloc: Context allocation failed\n"); -+ return NULL; -+ } -+ -+ zc_pool_init(&zc->pool); -+ return zc; -+} -+ -+void av_rpi_zc_env_free(AVZcEnvPtr zc) -+{ -+ if (zc != NULL) -+ { -+ zc_pool_destroy(&zc->pool); ; -+ av_free(zc); -+ } -+} -+ -+int av_rpi_zc_init(struct AVCodecContext * const s) -+{ -+ ZcEnv * const zc = av_rpi_zc_env_alloc(); -+ if (zc == NULL) -+ { -+ return AVERROR(ENOMEM); -+ } -+ -+ s->get_buffer_context = zc; -+ s->get_buffer2 = av_rpi_zc_get_buffer2; -+ return 0; -+} -+ -+void av_rpi_zc_uninit(struct AVCodecContext * const s) -+{ -+ if (s->get_buffer2 == av_rpi_zc_get_buffer2) -+ { -+ ZcEnv * const zc = s->get_buffer_context; -+ s->get_buffer2 = avcodec_default_get_buffer2; -+ s->get_buffer_context = NULL; -+ av_rpi_zc_env_free(zc); -+ } -+} -+ -+#endif // RPI -+ -diff --git a/libavcodec/rpi_zc.h b/libavcodec/rpi_zc.h -new file mode 100644 -index 0000000..f0109f4 ---- /dev/null -+++ b/libavcodec/rpi_zc.h -@@ -0,0 +1,83 @@ -+#ifndef LIBAVCODEC_RPI_ZC_H -+#define LIBAVCODEC_RPI_ZC_H -+ -+// Zero-Copy frame code for RPi -+// RPi needs Y/U/V planes to be contiguous for display. By default -+// ffmpeg will allocate separated planes so a memcpy is needed before -+// display. This code prodes a method a making ffmpeg allocate a single -+// bit of memory for the frame when can then be refrence counted until -+// display ahs finsihed with it. -+ -+#include "libavutil/frame.h" -+#include "libavcodec/avcodec.h" -+ -+// "Opaque" pointer to whatever we are using as a buffer reference -+typedef AVBufferRef * AVRpiZcRefPtr; -+ -+struct AVZcEnv; -+typedef struct AVZcEnv * AVZcEnvPtr; -+ -+typedef struct AVRpiZcFrameGeometry -+{ -+ unsigned int stride_y; -+ unsigned int height_y; -+ unsigned int stride_c; -+ unsigned int height_c; -+} AVRpiZcFrameGeometry; -+ -+ -+AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -+ const unsigned int video_width, const unsigned int video_height); -+ -+// Replacement fn for avctx->get_buffer2 -+// Should be set before calling avcodec_decode_open2 -+// -+// N.B. in addition to to setting avctx->get_buffer2, avctx->refcounted_frames -+// must be set to 1 as otherwise the buffer info is killed before being returned -+// by avcodec_decode_video2. Note also that this means that the AVFrame that is -+// return must be manually derefed with av_frame_unref. This should be done -+// after av_rpi_zc_ref has been called. -+int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags); -+ -+// Generate a ZC reference to the buffer(s) in this frame -+// If the buffer doesn't appear to be one allocated by _get_buffer_2 -+// then the behaviour depends on maycopy: -+// If maycopy=0 then return NULL -+// If maycopy=1 && the src frame is in a form where we can easily copy -+// the data, then allocate a new buffer and copy the data into it -+// Otherwise return NULL -+AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, -+ const AVFrame * const frame, const int maycopy); -+ -+// Get the vc_handle from the frame ref -+// Returns -1 if ref doesn't look valid -+int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref); -+// Get the number of bytes allocated from the frame ref -+// Returns 0 if ref doesn't look valid -+int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref); -+ -+// Unreference the buffer refed/allocated by _zc_ref -+// If fr_ref is NULL then this will NOP -+void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref); -+ -+// Allocate an environment for the buffer pool used by the ZC code -+// This should be put in avctx->get_buffer_context so it can be found by -+// av_rpi_zc_get_buffer2 when it is called from ffmpeg -+AVZcEnvPtr av_rpi_zc_env_alloc(void); -+ -+// Allocate the environment used by the ZC code -+void av_rpi_zc_env_free(AVZcEnvPtr); -+ -+ -+// Init ZC into a context -+// There is nothing magic in this fn - it just packages setting -+// get_buffer2 & get_buffer_context -+int av_rpi_zc_init(struct AVCodecContext * const s); -+ -+// Free ZC from a context -+// There is nothing magic in this fn - it just packages unsetting -+// get_buffer2 & get_buffer_context -+void av_rpi_zc_uninit(struct AVCodecContext * const s); -+ -+#endif -+ --- -2.7.4 - - -From a6da64e1ca42f0394ccfa55dca782a456841da94 Mon Sep 17 00:00:00 2001 -From: John Cox -Date: Tue, 1 Mar 2016 14:21:25 +0000 -Subject: [PATCH 2/2] Set VPU scheduling thread to high priority after creation - ---- - libavcodec/rpi_qpu.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 47 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -index b0c9bc5..ee19231 100644 ---- a/libavcodec/rpi_qpu.c -+++ b/libavcodec/rpi_qpu.c -@@ -182,9 +182,55 @@ static int gpu_init(volatile struct GPU **gpu) { - err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); - //printf("Created thread\n"); - if (err) { -- printf("Failed to create vpu thread\n"); -+ av_log(NULL, AV_LOG_FATAL, "Failed to create vpu thread\n"); - return -4; - } -+ -+ { -+ struct sched_param param = {0}; -+ int policy = 0; -+ -+ if (pthread_getschedparam(vpu_thread, &policy, ¶m) != 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); -+ } -+ else -+ { -+ av_log(NULL, AV_LOG_INFO, "VPU thread: policy=%d (%s), pri=%d\n", -+ policy, -+ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -+ param.sched_priority); -+ -+ policy = SCHED_FIFO; -+ param.sched_priority = sched_get_priority_max(SCHED_FIFO); -+ -+ av_log(NULL, AV_LOG_INFO, "Attempt to set: policy=%d (%s), pri=%d\n", -+ policy, -+ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -+ param.sched_priority); -+ -+ if (pthread_setschedparam(vpu_thread, policy, ¶m) != 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to set VPU thread scheduling parameters\n"); -+ } -+ else -+ { -+ if (pthread_getschedparam(vpu_thread, &policy, ¶m) != 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); -+ } -+ else -+ { -+ av_log(NULL, AV_LOG_INFO, "VPU thread (after): policy=%d (%s), pri=%d\n", -+ policy, -+ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -+ param.sched_priority); -+ } -+ } -+ } -+ -+ } -+ - } - #endif - --- -2.7.4 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-0001-Squashed-commit-of-the-following.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-0001-Squashed-commit-of-the-following.patch deleted file mode 100644 index fee44ddbc6..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-0001-Squashed-commit-of-the-following.patch +++ /dev/null @@ -1,2180 +0,0 @@ -From d08594462136274636c1f2f476a6410ff92a9e16 Mon Sep 17 00:00:00 2001 -From: John Cox -Date: Wed, 13 Jan 2016 16:13:33 +0000 -Subject: [PATCH] H.265 residual decode rework (v2) - -Rework the cabac decode functions -Simplify the code flow and variable usage where possible - -(Remove profiling and other spurious deltas that were in v1) ---- - libavcodec/arm/cabac.h | 155 ++++- - libavcodec/arm/hevc_cabac.h | 491 +++++++++++++++ - libavcodec/arm/hevcdsp_deblock_neon.S | 13 +- - libavcodec/arm/hevcdsp_epel_neon.S | 9 +- - libavcodec/cabac.h | 9 +- - libavcodec/hevc_cabac.c | 1096 +++++++++++++++++++++++++-------- - 6 files changed, 1509 insertions(+), 264 deletions(-) - create mode 100644 libavcodec/arm/hevc_cabac.h - -diff --git a/libavcodec/arm/cabac.h b/libavcodec/arm/cabac.h -index fdbf86b..0a3980a 100644 ---- a/libavcodec/arm/cabac.h -+++ b/libavcodec/arm/cabac.h -@@ -26,13 +26,34 @@ - #include "libavutil/internal.h" - #include "libavcodec/cabac.h" - -+ -+#if UNCHECKED_BITSTREAM_READER -+#define LOAD_16BITS_BEHI\ -+ "ldrh %[tmp] , [%[ptr]] , #2 \n\t"\ -+ "rev %[tmp] , %[tmp] \n\t" -+#elif CONFIG_THUMB -+#define LOAD_16BITS_BEHI\ -+ "ldr %[tmp] , [%[c], %[end]] \n\t"\ -+ "cmp %[tmp] , %[ptr] \n\t"\ -+ "it cs \n\t"\ -+ "ldrhcs %[tmp] , [%[ptr]] , #2 \n\t"\ -+ "rev %[tmp] , %[tmp] \n\t" -+#else -+#define LOAD_16BITS_BEHI\ -+ "ldr %[tmp] , [%[c], %[end]] \n\t"\ -+ "cmp %[tmp] , %[ptr] \n\t"\ -+ "ldrcsh %[tmp] , [%[ptr]] , #2 \n\t"\ -+ "rev %[tmp] , %[tmp] \n\t" -+#endif -+ -+ - #define get_cabac_inline get_cabac_inline_arm - static av_always_inline int get_cabac_inline_arm(CABACContext *c, - uint8_t *const state) - { - int bit; -+#if 0 - void *reg_b, *reg_c, *tmp; -- - __asm__ volatile( - "ldrb %[bit] , [%[state]] \n\t" - "add %[r_b] , %[tables] , %[lps_off] \n\t" -@@ -100,9 +121,141 @@ static av_always_inline int get_cabac_inline_arm(CABACContext *c, - [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) - : "memory", "cc" - ); -+#else -+ // *** Not thumb compatible yet -+ unsigned int reg_b, tmp; -+ __asm__ ( -+ "ldrb %[bit] , [%[state]] \n\t" -+ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -+ "and %[tmp] , %[range] , #0xC0 \n\t" -+ "add %[r_b] , %[r_b] , %[bit] \n\t" -+ "ldrb %[tmp] , [%[r_b] , %[tmp], lsl #1] \n\t" -+// %bit = *state -+// %range = range -+// %tmp = RangeLPS -+ "sub %[range] , %[range] , %[tmp] \n\t" -+ -+ "cmp %[low] , %[range] , lsl #17 \n\t" -+ "ittt ge \n\t" -+ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -+ "mvnge %[bit] , %[bit] \n\t" -+ "movge %[range] , %[tmp] \n\t" -+ -+ "clz %[tmp] , %[range] \n\t" -+ "sub %[tmp] , #23 \n\t" -+ -+ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -+ "lsl %[low] , %[low] , %[tmp] \n\t" -+ "lsl %[range] , %[range] , %[tmp] \n\t" -+ -+ "strb %[r_b] , [%[state]] \n\t" -+ "lsls %[tmp] , %[low] , #16 \n\t" -+ -+ "bne 2f \n\t" -+ LOAD_16BITS_BEHI -+ "lsr %[tmp] , %[tmp] , #15 \n\t" -+ "movw %[r_b] , #0xFFFF \n\t" -+ "sub %[tmp] , %[tmp] , %[r_b] \n\t" -+ -+ "rbit %[r_b] , %[low] \n\t" -+ "clz %[r_b] , %[r_b] \n\t" -+ "sub %[r_b] , %[r_b] , #16 \n\t" -+#if CONFIG_THUMB -+ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -+ "add %[low] , %[low] , %[tmp] \n\t" -+#else -+ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -+#endif -+ "2: \n\t" -+ : [bit]"=&r"(bit), -+ [low]"+&r"(c->low), -+ [range]"+&r"(c->range), -+ [r_b]"=&r"(reg_b), -+ [ptr]"+&r"(c->bytestream), -+ [tmp]"=&r"(tmp) -+ : [state]"r"(state), -+ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -+ [byte]"M"(offsetof(CABACContext, bytestream)), -+#if !UNCHECKED_BITSTREAM_READER -+ [c]"r"(c), -+ [end]"M"(offsetof(CABACContext, bytestream_end)), -+#endif -+ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -+ : "memory", "cc" -+ ); -+#endif - - return bit & 1; - } -+ -+#define get_cabac_bypass get_cabac_bypass_arm -+static inline int get_cabac_bypass_arm(CABACContext * const c) -+{ -+ int rv = 0; -+ unsigned int tmp; -+ __asm ( -+ "lsl %[low] , #1 \n\t" -+ "cmp %[low] , %[range] , lsl #17 \n\t" -+ "adc %[rv] , %[rv] , #0 \n\t" -+ "it cs \n\t" -+ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" -+ "lsls %[tmp] , %[low] , #16 \n\t" -+ "bne 1f \n\t" -+ LOAD_16BITS_BEHI -+ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" -+ "movw %[tmp] , #0xFFFF \n\t" -+ "sub %[low] , %[low] , %[tmp] \n\t" -+ "1: \n\t" -+ : // Outputs -+ [rv]"+&r"(rv), -+ [low]"+&r"(c->low), -+ [tmp]"=&r"(tmp), -+ [ptr]"+&r"(c->bytestream) -+ : // Inputs -+#if !UNCHECKED_BITSTREAM_READER -+ [c]"r"(c), -+ [end]"M"(offsetof(CABACContext, bytestream_end)), -+#endif -+ [range]"r"(c->range) -+ : "cc" -+ ); -+ return rv; -+} -+ -+ -+#define get_cabac_bypass_sign get_cabac_bypass_sign_arm -+static inline int get_cabac_bypass_sign_arm(CABACContext * const c, int rv) -+{ -+ unsigned int tmp; -+ __asm ( -+ "lsl %[low] , #1 \n\t" -+ "cmp %[low] , %[range] , lsl #17 \n\t" -+ "ite cc \n\t" -+ "rsbcc %[rv] , %[rv] , #0 \n\t" -+ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" -+ "lsls %[tmp] , %[low] , #16 \n\t" -+ "bne 1f \n\t" -+ LOAD_16BITS_BEHI -+ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" -+ "movw %[tmp] , #0xFFFF \n\t" -+ "sub %[low] , %[low] , %[tmp] \n\t" -+ "1: \n\t" -+ : // Outputs -+ [rv]"+&r"(rv), -+ [low]"+&r"(c->low), -+ [tmp]"=&r"(tmp), -+ [ptr]"+&r"(c->bytestream) -+ : // Inputs -+#if !UNCHECKED_BITSTREAM_READER -+ [c]"r"(c), -+ [end]"M"(offsetof(CABACContext, bytestream_end)), -+#endif -+ [range]"r"(c->range) -+ : "cc" -+ ); -+ return rv; -+} -+ - #endif /* HAVE_ARMV6T2_INLINE */ - - #endif /* AVCODEC_ARM_CABAC_H */ -diff --git a/libavcodec/arm/hevc_cabac.h b/libavcodec/arm/hevc_cabac.h -new file mode 100644 -index 0000000..31d3c59 ---- /dev/null -+++ b/libavcodec/arm/hevc_cabac.h -@@ -0,0 +1,491 @@ -+/* -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef AVCODEC_ARM_HEVC_CABAC_H -+#define AVCODEC_ARM_HEVC_CABAC_H -+ -+#include "config.h" -+#if HAVE_ARMV6T2_INLINE -+ -+#define hevc_mem_bits32 hevc_mem_bits32_arm -+static inline uint32_t hevc_mem_bits32_arm(const void * p, const unsigned int bits) -+{ -+ unsigned int n; -+ __asm__ ( -+ "rev %[n], %[x] \n\t" -+ : [n]"=r"(n) -+ : [x]"r"(*(const uint32_t *)((const uint8_t *)p + (bits >> 3))) -+ : -+ ); -+ return n << (bits & 7); -+} -+ -+ -+// --------------------------------------------------------------------------- -+// -+// Helper fns - little bits of code where ARM has an instraction that the -+// compiler doesn't know about / use -+ -+#define trans_scale_sat trans_scale_sat_arm -+static inline int trans_scale_sat_arm(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) -+{ -+ int rv; -+ int t = ((level * (int)(scale * scale_m)) >> shift) + 1; -+ -+ __asm__ ( -+ "ssat %[rv], #16, %[t], ASR #1 \n\t" -+ : [rv]"=r"(rv) -+ : [t]"r"(t) -+ : -+ ); -+ return rv; -+} -+ -+#define update_rice update_rice_arm -+static inline void update_rice_arm(uint8_t * const stat_coeff, -+ const unsigned int last_coeff_abs_level_remaining, -+ const unsigned int c_rice_param) -+{ -+ int t; -+ __asm__ ( -+ "lsl %[t], %[coeff], #1 \n\t" -+ "lsrs %[t], %[t], %[shift] \n\t" -+ "it eq \n\t" -+ "subeq %[stat], %[stat], #1 \n\t" -+ "cmp %[t], #6 \n\t" -+ "adc %[stat], %[stat], #0 \n\t" -+ "usat %[stat], #8, %[stat] \n\t" -+ : [stat]"+&r"(*stat_coeff), -+ [t]"=&r"(t) -+ : [coeff]"r"(last_coeff_abs_level_remaining), -+ [shift]"r"(c_rice_param) -+ : "cc" -+ ); -+} -+ -+// --------------------------------------------------------------------------- -+// -+// CABAC get loops -+// -+// Where the loop is simple enough we can normally do 10-30% better than the -+// compiler -+ -+// Get the residual greater than 1 bits -+ -+#define get_cabac_greater1_bits get_cabac_greater1_bits_arm -+static inline unsigned int get_cabac_greater1_bits_arm(CABACContext * const c, const unsigned int n, -+ uint8_t * const state0) -+{ -+ unsigned int i, reg_b, st, tmp, bit, rv; -+ __asm__ ( -+ "mov %[i] , #0 \n\t" -+ "mov %[rv] , #0 \n\t" -+ "1: \n\t" -+ "add %[i] , %[i] , #1 \n\t" -+ "cmp %[rv] , #0 \n\t" -+ "ite eq \n\t" -+ "usateq %[st] , #2 , %[i] \n\t" -+ "movne %[st] , #0 \n\t" -+ -+ "ldrb %[bit] , [%[state0], %[st]] \n\t" -+ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -+ "and %[tmp] , %[range] , #0xC0 \n\t" -+ "add %[r_b] , %[r_b] , %[bit] \n\t" -+ "ldrb %[tmp] , [%[r_b], %[tmp], lsl #1] \n\t" -+ "sub %[range] , %[range] , %[tmp] \n\t" -+ -+ "cmp %[low] , %[range], lsl #17 \n\t" -+ "ittt ge \n\t" -+ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -+ "mvnge %[bit] , %[bit] \n\t" -+ "movge %[range] , %[tmp] \n\t" -+ -+ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -+ "and %[bit] , %[bit] , #1 \n\t" -+ "orr %[rv] , %[bit] , %[rv], lsl #1 \n\t" -+ -+ "clz %[tmp] , %[range] \n\t" -+ "sub %[tmp] , #23 \n\t" -+ -+ "lsl %[low] , %[low] , %[tmp] \n\t" -+ "lsl %[range] , %[range] , %[tmp] \n\t" -+ -+ "strb %[r_b] , [%[state0], %[st]] \n\t" -+// There is a small speed gain from combining both conditions, using a single -+// branch and then working out what that meant later -+ "lsls %[tmp] , %[low] , #16 \n\t" -+ "it ne \n\t" -+ "cmpne %[n] , %[i] \n\t" -+ "bne 1b \n\t" -+ -+// If reload is not required then we must have run out of flags to decode -+ "tst %[tmp] , %[tmp] \n\t" -+ "bne 2f \n\t" -+ -+// Do reload -+ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" -+ "movw %[r_b] , #0xFFFF \n\t" -+ "rev %[tmp] , %[tmp] \n\t" -+ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" -+ -+ "rbit %[r_b] , %[low] \n\t" -+ "clz %[r_b] , %[r_b] \n\t" -+ "sub %[r_b] , %[r_b] , #16 \n\t" -+ -+#if CONFIG_THUMB -+ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -+ "add %[low] , %[low] , %[tmp] \n\t" -+#else -+ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -+#endif -+ -+ "cmp %[n] , %[i] \n\t" -+ "bne 1b \n\t" -+ "2: \n\t" -+ : [bit]"=&r"(bit), -+ [low]"+&r"(c->low), -+ [range]"+&r"(c->range), -+ [r_b]"=&r"(reg_b), -+ [bptr]"+&r"(c->bytestream), -+ [i]"=&r"(i), -+ [tmp]"=&r"(tmp), -+ [st]"=&r"(st), -+ [rv]"=&r"(rv) -+ : [state0]"r"(state0), -+ [n]"r"(n), -+ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -+ [byte]"M"(offsetof(CABACContext, bytestream)), -+ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -+ : "memory", "cc" -+ ); -+ return rv; -+} -+ -+ -+// n must be > 0 on entry -+#define get_cabac_sig_coeff_flag_idxs get_cabac_sig_coeff_flag_idxs_arm -+static inline uint8_t * get_cabac_sig_coeff_flag_idxs_arm(CABACContext * const c, uint8_t * const state0, -+ unsigned int n, -+ const uint8_t const * ctx_map, -+ uint8_t * p) -+{ -+ unsigned int reg_b, tmp, st, bit; -+ __asm__ ( -+ "1: \n\t" -+// Get bin from map -+ "ldrb %[st] , [%[ctx_map], %[n]] \n\t" -+ -+// Load state & ranges -+ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -+ "ldrb %[bit] , [%[state0], %[st]] \n\t" -+ "and %[tmp] , %[range] , #0xC0 \n\t" -+ "add %[r_b] , %[r_b] , %[tmp], lsl #1 \n\t" -+ "ldrb %[tmp] , [%[r_b], %[bit]] \n\t" -+ "sub %[range] , %[range] , %[tmp] \n\t" -+ -+ "cmp %[low] , %[range], lsl #17 \n\t" -+ "ittt ge \n\t" -+ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -+ "mvnge %[bit] , %[bit] \n\t" -+ "movge %[range] , %[tmp] \n\t" -+ -+ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -+ "tst %[bit] , #1 \n\t" -+// GCC asm seems to need strbne written differently for thumb and arm -+#if CONFIG_THUMB -+ "it ne \n\t" -+ "strbne %[n] , [%[idx]] , #1 \n\t" -+#else -+ "strneb %[n] , [%[idx]] , #1 \n\t" -+#endif -+ -+// Renorm -+ "clz %[tmp] , %[range] \n\t" -+ "sub %[tmp] , #23 \n\t" -+ "lsl %[low] , %[low] , %[tmp] \n\t" -+ "lsl %[range] , %[range] , %[tmp] \n\t" -+ -+ "strb %[r_b] , [%[state0], %[st]] \n\t" -+// There is a small speed gain from combining both conditions, using a single -+// branch and then working out what that meant later -+ "subs %[n] , %[n] , #1 \n\t" -+#if CONFIG_THUMB -+ "itt ne \n\t" -+ "lslsne %[tmp] , %[low] , #16 \n\t" -+ "bne 1b \n\t" -+#else -+ "lslnes %[tmp] , %[low] , #16 \n\t" -+ "bne 1b \n\t" -+#endif -+ -+// If we have bits left then n must be 0 so give up now -+ "lsls %[tmp] , %[low] , #16 \n\t" -+ "bne 2f \n\t" -+ -+// Do reload -+ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" -+ "movw %[r_b] , #0xFFFF \n\t" -+ "rev %[tmp] , %[tmp] \n\t" -+ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" -+ -+ "rbit %[r_b] , %[low] \n\t" -+ "clz %[r_b] , %[r_b] \n\t" -+ "sub %[r_b] , %[r_b] , #16 \n\t" -+ -+#if CONFIG_THUMB -+ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -+ "add %[low] , %[low] , %[tmp] \n\t" -+#else -+ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -+#endif -+ -+// Check to see if we still have more to do -+ "cmp %[n] , #0 \n\t" -+ "bne 1b \n\t" -+ "2: \n\t" -+ : [bit]"=&r"(bit), -+ [low]"+&r"(c->low), -+ [range]"+&r"(c->range), -+ [r_b]"=&r"(reg_b), -+ [bptr]"+&r"(c->bytestream), -+ [idx]"+&r"(p), -+ [n]"+&r"(n), -+ [tmp]"=&r"(tmp), -+ [st]"=&r"(st) -+ : [state0]"r"(state0), -+ [ctx_map]"r"(ctx_map), -+ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -+ [byte]"M"(offsetof(CABACContext, bytestream)), -+ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -+ : "memory", "cc" -+ ); -+ -+ return p; -+} -+ -+// --------------------------------------------------------------------------- -+// -+// CABAC_BY22 functions -+// -+// By and large these are (at best) no faster than their C equivalents - the -+// only one worth having is _peek where we do a slightly better job than the -+// compiler -+// -+// The others have been stashed here for reference in case larger scale asm -+// is attempted in which case they might be a useful base -+ -+ -+#define get_cabac_by22_peek get_cabac_by22_peek_arm -+static inline uint32_t get_cabac_by22_peek_arm(const CABACContext *const c) -+{ -+ uint32_t rv, tmp; -+ __asm__ ( -+ "bic %[rv] , %[low], #1 \n\t" -+ "cmp %[inv] , #0 \n\t" -+ "it ne \n\t" -+ "umullne %[tmp] , %[rv] , %[inv], %[rv] \n\t" -+ : // Outputs -+ [rv]"=&r"(rv), -+ [tmp]"=r"(tmp) -+ : // Inputs -+ [low]"r"(c->low), -+ [inv]"r"(c->range) -+ : // Clobbers -+ "cc" -+ ); -+ return rv << 1; -+} -+ -+#if 0 -+ -+// ***** Slower than the C :-( -+#define get_cabac_by22_flush get_cabac_by22_flush_arm -+static inline void get_cabac_by22_flush_arm(CABACContext *const c, const unsigned int n, const uint32_t val) -+{ -+ uint32_t m, tmp; -+ __asm__ ( -+ "add %[bits], %[bits], %[n] \n\t" -+ "ldr %[m], [%[ptr], %[bits], lsr #3] \n\t" -+ -+ "rsb %[tmp], %[n], #32 \n\t" -+ "lsr %[tmp], %[val], %[tmp] \n\t" -+ "mul %[tmp], %[range], %[tmp] \n\t" -+ -+ "rev %[m], %[m] \n\t" -+ -+ "lsl %[tmp], %[tmp], #23 \n\t" -+ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -+ -+ "and %[tmp], %[bits], #7 \n\t" -+ "lsl %[m], %[m], %[tmp] \n\t" -+ -+ "orr %[low], %[low], %[m], lsr #9 \n\t" -+ : // Outputs -+ [m]"=&r"(m), -+ [tmp]"=&r"(tmp), -+ [bits]"+&r"(c->by22.bits), -+ [low]"+&r"(c->low) -+ : // Inputs -+ [n]"r"(n), -+ [val]"r"(val), -+ [inv]"r"(c->range), -+ [range]"r"(c->by22.range), -+ [ptr]"r"(c->bytestream) -+ : // Clobbers -+ ); -+} -+ -+ -+// Works but slower than C -+#define coeff_abs_level_remaining_decode_by22(c,r) coeff_abs_level_remaining_decode_by22_arm(c, r) -+static int coeff_abs_level_remaining_decode_by22_arm(CABACContext * const c, const unsigned int c_rice_param) -+{ -+ uint32_t n, val, tmp, level; -+ -+// PROFILE_START(); -+ -+ __asm__ ( -+ // Peek -+ "bic %[val], %[low], #1 \n\t" -+ "cmp %[inv], #0 \n\t" -+ "umullne %[tmp], %[val], %[inv], %[val] \n\t" -+ "lsl %[val], %[val], #1 \n\t" -+ -+ // Count bits (n = prefix) -+ "mvn %[n], %[val] \n\t" -+ "clz %[n], %[n] \n\t" -+ -+ "lsl %[level], %[val], %[n] \n\t" -+ "subs %[tmp], %[n], #3 \n\t" -+ "blo 2f \n\t" -+ -+ // prefix >= 3 -+ // < tmp = prefix - 3 -+ // > tmp = prefix + rice - 3 -+ "add %[tmp], %[tmp], %[rice] \n\t" -+ // > n = prefix * 2 + rice - 3 -+ "add %[n], %[tmp], %[n] \n\t" -+ "cmp %[n], #21 \n\t" -+ "bhi 3f \n\t" -+ -+ "orr %[level], %[level], #0x80000000 \n\t" -+ "rsb %[tmp], %[tmp], #31 \n\t" -+ "lsr %[level], %[level], %[tmp] \n\t" -+ -+ "mov %[tmp], #2 \n\t" -+ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" -+ "b 1f \n\t" -+ -+ // > 22 bits used in total - need reload -+ "3: \n\t" -+ -+ // Stash prefix + rice - 3 in level (only spare reg) -+ "mov %[level], %[tmp] \n\t" -+ // Restore n to flush value (prefix) -+ "sub %[n], %[n], %[tmp] \n\t" -+ -+ // Flush + reload -+ -+// "rsb %[tmp], %[n], #32 \n\t" -+// "lsr %[tmp], %[val], %[tmp] \n\t" -+// "mul %[tmp], %[range], %[tmp] \n\t" -+ -+ // As it happens we know that all the bits we are flushing are 1 -+ // so we can cheat slightly -+ "rsb %[tmp], %[range], %[range], lsl %[n] \n\t" -+ "lsl %[tmp], %[tmp], #23 \n\t" -+ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -+ -+ "add %[bits], %[bits], %[n] \n\t" -+ "ldr %[n], [%[ptr], %[bits], lsr #3] \n\t" -+ "rev %[n], %[n] \n\t" -+ "and %[tmp], %[bits], #7 \n\t" -+ "lsl %[n], %[n], %[tmp] \n\t" -+ -+ "orr %[low], %[low], %[n], lsr #9 \n\t" -+ -+ // (reload) -+ -+ "bic %[val], %[low], #1 \n\t" -+ "cmp %[inv], #0 \n\t" -+ "umullne %[tmp], %[val], %[inv], %[val] \n\t" -+ "lsl %[val], %[val], #1 \n\t" -+ -+ // Build value -+ -+ "mov %[n], %[level] \n\t" -+ -+ "orr %[tmp], %[val], #0x80000000 \n\t" -+ "rsb %[level], %[level], #31 \n\t" -+ "lsr %[level], %[tmp], %[level] \n\t" -+ -+ "mov %[tmp], #2 \n\t" -+ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" -+ "b 1f \n\t" -+ -+ // prefix < 3 -+ "2: \n\t" -+ "rsb %[tmp], %[rice], #31 \n\t" -+ "lsr %[level], %[level], %[tmp] \n\t" -+ "orr %[level], %[level], %[n], lsl %[rice] \n\t" -+ "add %[n], %[n], %[rice] \n\t" -+ -+ "1: \n\t" -+ // Flush -+ "add %[n], %[n], #1 \n\t" -+ -+ "rsb %[tmp], %[n], #32 \n\t" -+ "lsr %[tmp], %[val], %[tmp] \n\t" -+ -+ "add %[bits], %[bits], %[n] \n\t" -+ "ldr %[val], [%[ptr], %[bits], lsr #3] \n\t" -+ -+ "mul %[tmp], %[range], %[tmp] \n\t" -+ "lsl %[tmp], %[tmp], #23 \n\t" -+ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -+ -+ "rev %[val], %[val] \n\t" -+ "and %[tmp], %[bits], #7 \n\t" -+ "lsl %[val], %[val], %[tmp] \n\t" -+ -+ "orr %[low], %[low], %[val], lsr #9 \n\t" -+ : // Outputs -+ [level]"=&r"(level), -+ [n]"=&r"(n), -+ [val]"=&r"(val), -+ [tmp]"=&r"(tmp), -+ [bits]"+&r"(c->by22.bits), -+ [low]"+&r"(c->low) -+ : // Inputs -+ [rice]"r"(c_rice_param), -+ [inv]"r"(c->range), -+ [range]"r"(c->by22.range), -+ [ptr]"r"(c->bytestream) -+ : // Clobbers -+ "cc" -+ ); -+ -+// PROFILE_ACC(residual_abs); -+ -+ return level; -+} -+#endif -+ -+#endif /* HAVE_ARMV6T2_INLINE */ -+ -+#endif /* AVCODEC_ARM_HEVC_CABAC_H */ -diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S -index bad4589..a088cc3 100644 ---- a/libavcodec/arm/hevcdsp_deblock_neon.S -+++ b/libavcodec/arm/hevcdsp_deblock_neon.S -@@ -409,10 +409,12 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 - beq 90f - - tst a3, #1 -+ itee ne - ldrne a3, [v5, #0] @ curr->mv[0] - ldreq a3, [v5, #4] @ curr->mv[1] - moveq v1, v2 - tst v8, #1 -+ itee ne - ldrne v8, [v6, #0] @ neigh->mv[0] - ldreq v8, [v6, #4] @ neigh->mv[1] - moveq v3, v4 -@@ -424,9 +426,14 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 - sel a3, a3, ip - ands a3, a3, lr - @ drop through --10: movne a3, #1 -+10: it ne -+ movne a3, #1 - 11: subs a2, a2, #1 --12: strbhs a3, [v7], a4 -+12: -+A strbhs a3, [v7], a4 -+T itt hs -+T strbhs a3, [v7] -+T addhs v7, v7, a4 - subs a2, a2, #1 - bhs 12b - -@@ -442,6 +449,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 - bne 10b - - teq v1, v3 -+ it eq - teqeq v2, v4 - bne 40f - teq v1, v2 -@@ -487,6 +495,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 - b 10b - - 40: teq v1, v4 -+ ite eq - teqeq v2, v3 - bne 10b - -diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -index 516ae5b..00eab9e 100644 ---- a/libavcodec/arm/hevcdsp_epel_neon.S -+++ b/libavcodec/arm/hevcdsp_epel_neon.S -@@ -110,7 +110,9 @@ function ff_hevc_put_epel_h_neon_8, export=1 - sub r7, #1 - lsl r7, #2 - vpush {d8-d15} -- adrl r12, epel_coeffs -+@ adr reaches if we are in thumb mode but not in arm -+T adr r12, epel_coeffs -+A adrl r12, epel_coeffs - add r7, r12 - sub r1, #1 - lsl r4, #1 -@@ -170,7 +172,8 @@ function ff_hevc_put_epel_v_neon_8, export=1 - sub r7, #1 - lsl r7, #2 - vpush {d8-d15} -- adrl r12, epel_coeffs -+T adr r12, epel_coeffs -+A adrl r12, epel_coeffs - add r7, r12 - load_coeffs_16b r7 - sub r1, r2 -@@ -246,7 +249,7 @@ function ff_hevc_put_epel_hv_neon_8, export=1 - sub r7, #1 - lsl r7, #2 - vpush {d8-d15} -- adrl r12, epel_coeffs -+ adr r12, epel_coeffs - sub r6, #1 - lsl r6, #2 - add r6, r12 // mx epel coeff offset -diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h -index 1bf1c62..ccfa991 100644 ---- a/libavcodec/cabac.h -+++ b/libavcodec/cabac.h -@@ -43,7 +43,14 @@ extern const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63]; - typedef struct CABACContext{ - int low; - int range; -- int outstanding_count; -+ union -+ { -+ int outstanding_count; -+ struct { -+ uint16_t bits; -+ uint16_t range; -+ } by22; -+ }; - const uint8_t *bytestream_start; - const uint8_t *bytestream; - const uint8_t *bytestream_end; -diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -index 8656917..4caf720 100644 ---- a/libavcodec/hevc_cabac.c -+++ b/libavcodec/hevc_cabac.c -@@ -21,14 +21,72 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#define UNCHECKED_BITSTREAM_READER 1 -+ - #include "libavutil/attributes.h" - #include "libavutil/common.h" - --#include "cabac_functions.h" - #include "hevc.h" -+#include "cabac_functions.h" -+ -+// BY22 is probably faster than simple bypass if the processor has -+// either a fast 32-bit divide or a fast 32x32->64[63:32] instruction -+// x86 has fast int divide -+// Arm doesn't have divide or general fast 64 bit, but does have the multiply -+// * Beware: ARCH_xxx isn't set if configure --disable-asm is used -+#define USE_BY22 (HAVE_FAST_64BIT || ARCH_ARM || ARCH_X86) -+// Use native divide if we have a fast one - otherwise use mpy 1/x -+// x86 has a fast integer divide - arm doesn't - unsure about other -+// architectures -+#define USE_BY22_DIV ARCH_X86 -+ -+// Special case blocks with a single significant ceoff -+// Decreases the complexity of the code for a common case but increases the -+// code size. -+#define USE_N_END_1 1 -+ -+#if ARCH_ARM -+#include "arm/hevc_cabac.h" -+#endif - - #define CABAC_MAX_BIN 31 - -+ -+#if USE_BY22 && !USE_BY22_DIV -+#define I(x) (uint32_t)((0x10000000000ULL / (uint64_t)(x)) + 1ULL) -+ -+static const uint32_t cabac_by22_inv_range[256] = { -+ 0, I(257), I(258), I(259), -+ I(260), I(261), I(262), I(263), I(264), I(265), I(266), I(267), I(268), I(269), -+ I(270), I(271), I(272), I(273), I(274), I(275), I(276), I(277), I(278), I(279), -+ I(280), I(281), I(282), I(283), I(284), I(285), I(286), I(287), I(288), I(289), -+ I(290), I(291), I(292), I(293), I(294), I(295), I(296), I(297), I(298), I(299), -+ I(300), I(301), I(302), I(303), I(304), I(305), I(306), I(307), I(308), I(309), -+ I(310), I(311), I(312), I(313), I(314), I(315), I(316), I(317), I(318), I(319), -+ I(320), I(321), I(322), I(323), I(324), I(325), I(326), I(327), I(328), I(329), -+ I(330), I(331), I(332), I(333), I(334), I(335), I(336), I(337), I(338), I(339), -+ I(340), I(341), I(342), I(343), I(344), I(345), I(346), I(347), I(348), I(349), -+ I(350), I(351), I(352), I(353), I(354), I(355), I(356), I(357), I(358), I(359), -+ I(360), I(361), I(362), I(363), I(364), I(365), I(366), I(367), I(368), I(369), -+ I(370), I(371), I(372), I(373), I(374), I(375), I(376), I(377), I(378), I(379), -+ I(380), I(381), I(382), I(383), I(384), I(385), I(386), I(387), I(388), I(389), -+ I(390), I(391), I(392), I(393), I(394), I(395), I(396), I(397), I(398), I(399), -+ I(400), I(401), I(402), I(403), I(404), I(405), I(406), I(407), I(408), I(409), -+ I(410), I(411), I(412), I(413), I(414), I(415), I(416), I(417), I(418), I(419), -+ I(420), I(421), I(422), I(423), I(424), I(425), I(426), I(427), I(428), I(429), -+ I(430), I(431), I(432), I(433), I(434), I(435), I(436), I(437), I(438), I(439), -+ I(440), I(441), I(442), I(443), I(444), I(445), I(446), I(447), I(448), I(449), -+ I(450), I(451), I(452), I(453), I(454), I(455), I(456), I(457), I(458), I(459), -+ I(460), I(461), I(462), I(463), I(464), I(465), I(466), I(467), I(468), I(469), -+ I(470), I(471), I(472), I(473), I(474), I(475), I(476), I(477), I(478), I(479), -+ I(480), I(481), I(482), I(483), I(484), I(485), I(486), I(487), I(488), I(489), -+ I(490), I(491), I(492), I(493), I(494), I(495), I(496), I(497), I(498), I(499), -+ I(500), I(501), I(502), I(503), I(504), I(505), I(506), I(507), I(508), I(509), -+ I(510), I(511) -+}; -+#undef I -+#endif // USE_BY22 -+ - /** - * number of bin by SyntaxElement. - */ -@@ -445,6 +503,211 @@ static const uint8_t diag_scan8x8_inv[8][8] = { - { 28, 36, 43, 49, 54, 58, 61, 63, }, - }; - -+ -+typedef struct -+{ -+ uint16_t coeff; -+ uint16_t scale; -+} xy_off_t; -+ -+#define XYT_C(x,y,t) ((x) + ((y) << (t))) -+#define SCALE_TRAFO(t) ((t) > 3 ? 3 : (t)) -+#define SCALE_SHR(t) ((t) - SCALE_TRAFO(t)) -+#define XYT_S(x,y,t) (((x) >> SCALE_SHR(t)) + (((y) >> SCALE_SHR(t)) << SCALE_TRAFO(t))) -+ -+#define XYT(x,y,t) {XYT_C(x,y,t), XYT_S(x,y,t)} -+ -+#define OFF_DIAG(t) {\ -+ XYT(0,0,t), XYT(0,1,t), XYT(1,0,t), XYT(0,2,t),\ -+ XYT(1,1,t), XYT(2,0,t), XYT(0,3,t), XYT(1,2,t),\ -+ XYT(2,1,t), XYT(3,0,t), XYT(1,3,t), XYT(2,2,t),\ -+ XYT(3,1,t), XYT(2,3,t), XYT(3,2,t), XYT(3,3,t)\ -+} -+ -+#define OFF_HORIZ(t) {\ -+ XYT(0,0,t), XYT(1,0,t), XYT(2,0,t), XYT(3,0,t),\ -+ XYT(0,1,t), XYT(1,1,t), XYT(2,1,t), XYT(3,1,t),\ -+ XYT(0,2,t), XYT(1,2,t), XYT(2,2,t), XYT(3,2,t),\ -+ XYT(0,3,t), XYT(1,3,t), XYT(2,3,t), XYT(3,3,t)\ -+} -+ -+#define OFF_VERT(t) {\ -+ XYT(0,0,t), XYT(0,1,t), XYT(0,2,t), XYT(0,3,t),\ -+ XYT(1,0,t), XYT(1,1,t), XYT(1,2,t), XYT(1,3,t),\ -+ XYT(2,0,t), XYT(2,1,t), XYT(2,2,t), XYT(2,3,t),\ -+ XYT(3,0,t), XYT(3,1,t), XYT(3,2,t), XYT(3,3,t)\ -+} -+ -+static const xy_off_t off_xys[3][4][16] = -+{ -+ {OFF_DIAG(2), OFF_DIAG(3), OFF_DIAG(4), OFF_DIAG(5)}, -+ {OFF_HORIZ(2), OFF_HORIZ(3), OFF_HORIZ(4), OFF_HORIZ(5)}, -+ {OFF_VERT(2), OFF_VERT(3), OFF_VERT(4), OFF_VERT(5)} -+}; -+ -+ -+// Helper fns -+#ifndef hevc_mem_bits32 -+static av_always_inline uint32_t hevc_mem_bits32(const void * buf, const unsigned int offset) -+{ -+ return AV_RB32((const uint8_t *)buf + (offset >> 3)) << (offset & 7); -+} -+#endif -+ -+#if AV_GCC_VERSION_AT_LEAST(3,4) && !defined(hevc_clz32) -+#define hevc_clz32 hevc_clz32_builtin -+static av_always_inline unsigned int hevc_clz32_builtin(const uint32_t x) -+{ -+ // __builtin_clz says it works on ints - so adjust if int is >32 bits long -+ return __builtin_clz(x) - (sizeof(int) * 8 - 32); -+} -+#endif -+ -+// It is unlikely that we will ever need this but include for completeness -+#ifndef hevc_clz32 -+static inline unsigned int hevc_clz32(unsigned int x) -+{ -+ unsigned int n = 1; -+ if ((x & 0xffff0000) == 0) { -+ n += 16; -+ x <<= 16; -+ } -+ if ((x & 0xff000000) == 0) { -+ n += 8; -+ x <<= 8; -+ } -+ if ((x & 0xf0000000) == 0) { -+ n += 4; -+ x <<= 4; -+ } -+ if ((x & 0xc0000000) == 0) { -+ n += 2; -+ x <<= 2; -+ } -+ return n - ((x >> 31) & 1); -+} -+#endif -+ -+ -+#if !USE_BY22 -+// If no by22 then _by22 functions will revert to normal and so _peek/_flush -+// will no longer be called but the setup calls will still exist and we want -+// to null them out -+#define bypass_start(s) -+#define bypass_finish(s) -+#else -+// Use BY22 for residual bypass block -+ -+#define bypass_start(s) get_cabac_by22_start(&s->HEVClc->cc) -+#define bypass_finish(s) get_cabac_by22_finish(&s->HEVClc->cc) -+ -+// BY22 notes that bypass is simply a divide into the bitstream and so we -+// can peek out large quantities of bits at one and treat the result as if -+// it was VLC. In many cases this will lead to O(1) processing rather than -+// O(n) though the setup and teardown is sufficiently expensive that it is -+// only worth using if we expect to be dealing with more than a few bits -+// The definition of "a few bits" will vary from platform to platform but -+// tests on ARM show that it probably isn't worth it for a single coded -+// residual, but is for >1 - this is probaly reinforced that if there are -+// more residuals then they are likely to be bigger and this will make the -+// O(1) nature of the code more worthwhile. -+ -+ -+#if !USE_BY22_DIV -+// * 1/x @ 32 bits gets us 22 bits of accuracy -+#define CABAC_BY22_PEEK_BITS 22 -+#else -+// A real 32-bit divide gets us another bit -+// If we have a 64 bit int & a unit time divider then we should get a lot -+// of bits (55) but that is untested and it is unclear if it would give -+// us a large advantage -+#define CABAC_BY22_PEEK_BITS 23 -+#endif -+ -+// Bypass block start -+// Must be called before _by22_peek is used as it sets the CABAC environment -+// into the correct state. _by22_finish must be called to return to 'normal' -+// (i.e. non-bypass) cabac decoding -+static inline void get_cabac_by22_start(CABACContext * const c) -+{ -+ const unsigned int bits = __builtin_ctz(c->low); -+ const uint32_t m = hevc_mem_bits32(c->bytestream, 0); -+ uint32_t x = (c->low << (22 - CABAC_BITS)) ^ ((m ^ 0x80000000U) >> (9 + CABAC_BITS - bits)); -+#if !USE_BY22_DIV -+ const uint32_t inv = cabac_by22_inv_range[c->range & 0xff]; -+#endif -+ -+ c->bytestream -= (CABAC_BITS / 8); -+ c->by22.bits = bits; -+#if !USE_BY22_DIV -+ c->by22.range = c->range; -+ c->range = inv; -+#endif -+ c->low = x; -+} -+ -+// Bypass block finish -+// Must be called at the end of the bypass block to return to normal operation -+static inline void get_cabac_by22_finish(CABACContext * const c) -+{ -+ unsigned int used = c->by22.bits; -+ unsigned int bytes_used = (used / CABAC_BITS) * (CABAC_BITS / 8); -+ unsigned int bits_used = used & (CABAC_BITS == 16 ? 15 : 7); -+ -+ c->bytestream += bytes_used + (CABAC_BITS / 8); -+ c->low = (((uint32_t)c->low >> (22 - CABAC_BITS + bits_used)) | 1) << bits_used; -+#if !USE_BY22_DIV -+ c->range = c->by22.range; -+#endif -+} -+ -+// Peek bypass bits -+// _by22_start must be called before _by22_peek is called and _by22_flush -+// must be called afterwards to flush any used bits -+// The actual number of valid bits returned is -+// min(, CABAC_BY22_PEEK_BITS). CABAC_BY22_PEEK_BITS -+// will be at least 22 which should be long enough for any prefix or suffix -+// though probably not long enough for the worst case combination -+#ifndef get_cabac_by22_peek -+static inline uint32_t get_cabac_by22_peek(const CABACContext * const c) -+{ -+#if USE_BY22_DIV -+ return ((unsigned int)c->low / (unsigned int)c->range) << 9; -+#else -+ uint32_t x = c->low & ~1U; -+ const uint32_t inv = c->range; -+ -+ if (inv != 0) -+ x = (uint32_t)(((uint64_t)x * (uint64_t)inv) >> 32); -+ -+ return x << 1; -+#endif -+} -+#endif -+ -+// Flush bypass bits peeked by _by22_peek -+// Flush n bypass bits. n must be >= 1 to guarantee correct operation -+// val is an unmodified copy of whatever _by22_peek returned -+#ifndef get_cabac_by22_flush -+static inline void get_cabac_by22_flush(CABACContext * c, const unsigned int n, const uint32_t val) -+{ -+ // Subtract the bits used & reshift up to the top of the word -+#if USE_BY22_DIV -+ const uint32_t low = (((unsigned int)c->low << n) - (((val >> (32 - n)) * (unsigned int)c->range) << 23)); -+#else -+ const uint32_t low = (((uint32_t)c->low << n) - (((val >> (32 - n)) * c->by22.range) << 23)); -+#endif -+ -+ // and refill lower bits -+ // We will probably OR over some existing bits but that doesn't matter -+ c->by22.bits += n; -+ c->low = low | (hevc_mem_bits32(c->bytestream, c->by22.bits) >> 9); -+} -+#endif -+ -+#endif // USE_BY22 -+ -+ - void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) - { - if (s->ps.pps->entropy_coding_sync_enabled_flag && -@@ -863,19 +1126,19 @@ int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth) - return GET_CABAC(elem_offset[CBF_LUMA] + !trafo_depth); - } - --static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx) -+static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx_nz) - { -- return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + !!c_idx); -+ return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + c_idx_nz); - } - --static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx) -+static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx_nz) - { -- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + !!c_idx); -+ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + c_idx_nz); - } - --static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx) -+static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx_nz) - { -- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + !!c_idx); -+ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + c_idx_nz); - } - - int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx) { -@@ -891,14 +1154,14 @@ int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx) { - return GET_CABAC(elem_offset[RES_SCALE_SIGN_FLAG] + idx); - } - --static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx, -+static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx_nz, - int log2_size, int *last_scx_prefix, int *last_scy_prefix) - { - int i = 0; - int max = (log2_size << 1) - 1; - int ctx_offset, ctx_shift; - -- if (!c_idx) { -+ if (!c_idx_nz) { - ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2); - ctx_shift = (log2_size + 1) >> 2; - } else { -@@ -929,22 +1192,16 @@ static av_always_inline int last_significant_coeff_suffix_decode(HEVCContext *s, - return value; - } - --static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx, int ctx_cg) -+static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx_nz, int ctx_cg) - { - int inc; - -- inc = FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0); -+ inc = (ctx_cg != 0) + (c_idx_nz << 1); - - return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_GROUP_FLAG] + inc); - } --static av_always_inline int significant_coeff_flag_decode(HEVCContext *s, int x_c, int y_c, -- int offset, const uint8_t *ctx_idx_map) --{ -- int inc = ctx_idx_map[(y_c << 2) + x_c] + offset; -- return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + inc); --} - --static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int c_idx, int offset) -+static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int offset) - { - return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + offset); - } -@@ -966,65 +1223,305 @@ static av_always_inline int coeff_abs_level_greater2_flag_decode(HEVCContext *s, - return GET_CABAC(elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + inc); - } - --static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int rc_rice_param) -+ -+#if !USE_BY22 -+#define coeff_abs_level_remaining_decode_bypass(s,r) coeff_abs_level_remaining_decode(s, r) -+#endif -+ -+ -+#ifndef coeff_abs_level_remaining_decode_bypass -+static int coeff_abs_level_remaining_decode_bypass(HEVCContext * const s, const unsigned int rice_param) -+{ -+ CABACContext * const c = &s->HEVClc->cc; -+ uint32_t y; -+ unsigned int prefix; -+ unsigned int last_coeff_abs_level_remaining; -+ unsigned int n; -+ -+ y = get_cabac_by22_peek(c); -+ prefix = hevc_clz32(~y); -+ // y << prefix will always have top bit 0 -+ -+ if (prefix < 3) { -+ const unsigned int suffix = (y << prefix) >> (31 - rice_param); -+ last_coeff_abs_level_remaining = (prefix << rice_param) + suffix; -+ n = prefix + 1 + rice_param; -+ } -+ else if (prefix * 2 + rice_param <= CABAC_BY22_PEEK_BITS + 2) -+ { -+ const uint32_t suffix = ((y << prefix) | 0x80000000) >> (34 - (prefix + rice_param)); -+ -+ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; -+ n = prefix * 2 + rice_param - 2; -+ } -+ else { -+ unsigned int suffix; -+ -+ get_cabac_by22_flush(c, prefix, y); -+ y = get_cabac_by22_peek(c); -+ -+ suffix = (y | 0x80000000) >> (34 - (prefix + rice_param)); -+ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; -+ n = prefix + rice_param - 2; -+ } -+ -+ get_cabac_by22_flush(c, n, y); -+ -+ return last_coeff_abs_level_remaining; -+} -+#endif -+ -+static int coeff_abs_level_remaining_decode(HEVCContext * const s, int rc_rice_param) - { -+ CABACContext * const c = &s->HEVClc->cc; - int prefix = 0; - int suffix = 0; - int last_coeff_abs_level_remaining; - int i; - -- while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) -+ while (prefix < CABAC_MAX_BIN && get_cabac_bypass(c)) - prefix++; - if (prefix == CABAC_MAX_BIN) { - av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix); - return 0; - } -+ - if (prefix < 3) { - for (i = 0; i < rc_rice_param; i++) -- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); -+ suffix = (suffix << 1) | get_cabac_bypass(c); - last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix; - } else { - int prefix_minus3 = prefix - 3; - for (i = 0; i < prefix_minus3 + rc_rice_param; i++) -- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); -+ suffix = (suffix << 1) | get_cabac_bypass(c); - last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1) - << rc_rice_param) + suffix; - } -+ - return last_coeff_abs_level_remaining; - } - --static av_always_inline int coeff_sign_flag_decode(HEVCContext *s, uint8_t nb) -+#if !USE_BY22 -+#define coeff_sign_flag_decode_bypass coeff_sign_flag_decode -+static inline uint32_t coeff_sign_flag_decode(HEVCContext * const s, const unsigned int nb) - { -- int i; -- int ret = 0; -+ CABACContext * const c = &s->HEVClc->cc; -+ unsigned int i; -+ uint32_t ret = 0; - - for (i = 0; i < nb; i++) -- ret = (ret << 1) | get_cabac_bypass(&s->HEVClc->cc); -- return ret; -+ ret = (ret << 1) | get_cabac_bypass(c); -+ -+ return ret << (32 - nb); - } -+#endif -+ -+#ifndef coeff_sign_flag_decode_bypass -+static inline uint32_t coeff_sign_flag_decode_bypass(HEVCContext * const s, const unsigned int nb) -+{ -+ CABACContext * const c = &s->HEVClc->cc; -+ uint32_t y; -+ y = get_cabac_by22_peek(c); -+ get_cabac_by22_flush(c, nb, y); -+ return y & ~(0xffffffffU >> nb); -+} -+#endif -+ -+ -+#ifndef get_cabac_greater1_bits -+static inline unsigned int get_cabac_greater1_bits(CABACContext * const c, const unsigned int n, -+ uint8_t * const state0) -+{ -+ unsigned int i; -+ unsigned int rv = 0; -+ for (i = 0; i != n; ++i) { -+ const unsigned int idx = rv != 0 ? 0 : i < 3 ? i + 1 : 3; -+ const unsigned int b = get_cabac(c, state0 + idx); -+ rv = (rv << 1) | b; -+ } -+ return rv; -+} -+#endif -+ -+ -+// N.B. levels returned are the values assuming coeff_abs_level_remaining -+// is uncoded, so 1 must be added if it is coded. sum_abs also reflects -+// this version of events. -+static inline uint32_t get_greaterx_bits(HEVCContext * const s, const unsigned int n_end, int * const levels, -+ int * const pprev_subset_coded, int * const psum, -+ const unsigned int idx0_gt1, const unsigned int idx_gt2) -+{ -+ CABACContext * const c = &s->HEVClc->cc; -+ uint8_t * const state0 = s->HEVClc->cabac_state + idx0_gt1; -+ uint8_t * const state_gt2 = s->HEVClc->cabac_state + idx_gt2; -+ unsigned int rv; -+ unsigned int i; -+ const unsigned int n = FFMIN(n_end, 8); -+ -+ // Really this is i != n but the simple unconditional loop is cheaper -+ // and faster -+ for (i = 0; i != 8; ++i) -+ levels[i] = 1; -+ -+ rv = get_cabac_greater1_bits(c, n, state0); -+ -+ *pprev_subset_coded = 0; -+ *psum = n; -+ -+ rv <<= (32 - n); -+ if (rv != 0) -+ { -+ *pprev_subset_coded = 1; -+ *psum = n + 1; -+ i = hevc_clz32(rv); -+ levels[i] = 2; -+ if (get_cabac(c, state_gt2) == 0) -+ { -+ // Unset first coded bit -+ rv &= ~(0x80000000U >> i); -+ } -+ } -+ -+ if (n_end > 8) { -+ const unsigned int g8 = n_end - 8; -+ rv |= ((1 << g8) - 1) << (24 - g8); -+ for (i = 0; i != g8; ++i) { -+ levels[i + 8] = 0; -+ } -+ } -+ -+ return rv; -+} -+ -+// extended_precision_processing_flag must be false given we are -+// putting the result into a 16-bit array -+// So trans_coeff_level must fit in 16 bits too (7.4.9.1 definition of coeff_abs_level_remaining) -+// scale_m is uint8_t -+// -+// scale is [40 - 72] << [0..12] based on qp- worst case is (45 << 12) -+// or it can be 2 (if we have transquant_bypass) -+// shift is set to one less than we really want but would normally be -+// s->ps.sps->bit_depth (max 16, min 8) + log2_trafo_size (max 5, min 2?) - 5 = max 16 min 5? -+// however the scale shift is substracted from shift to a min 0 so scale_m worst = 45 << 6 -+// This can still theoretically lead to overflow but the coding would have to be very odd (& inefficient) -+// to achieve it -+ -+#ifndef trans_scale_sat -+static inline int trans_scale_sat(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) -+{ -+ return av_clip_int16((((level * (int)(scale * scale_m)) >> shift) + 1) >> 1); -+} -+#endif -+ -+ -+#ifndef update_rice -+static inline void update_rice(uint8_t * const stat_coeff, -+ const unsigned int last_coeff_abs_level_remaining, -+ const unsigned int c_rice_param) -+{ -+ const unsigned int x = (last_coeff_abs_level_remaining << 1) >> c_rice_param; -+ if (x >= 6) -+ (*stat_coeff)++; -+ else if (x == 0 && *stat_coeff > 0) -+ (*stat_coeff)--; -+} -+#endif -+ -+ -+// n must be > 0 on entry -+#ifndef get_cabac_sig_coeff_flag_idxs -+static inline uint8_t * get_cabac_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, -+ unsigned int n, -+ const uint8_t const * ctx_map, -+ uint8_t * p) -+{ -+ do { -+ if (get_cabac(c, state0 + ctx_map[n])) -+ *p++ = n; -+ } while (--n != 0); -+ return p; -+} -+#endif -+ -+ -+static int get_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, -+ unsigned int n, -+ const uint8_t const * ctx_map, -+ uint8_t * const flag_idx) -+{ -+ int rv; -+ -+ rv = get_cabac_sig_coeff_flag_idxs(c, state0, n, ctx_map, flag_idx) - flag_idx; -+ -+ return rv; -+} -+ -+#define H4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -+ x0, x1, x2, x3,\ -+ x4, x5, x6, x7,\ -+ x8, x9, x10, x11,\ -+ x12, x13, x14, x15} -+ -+#define V4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -+ x0, x4, x8, x12,\ -+ x1, x5, x9, x13,\ -+ x2, x6, x10, x14,\ -+ x3, x7, x11, x15} -+ -+#define D4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -+ x0, x4, x1, x8,\ -+ x5, x2, x12, x9,\ -+ x6, x3, x13, x10,\ -+ x7, x14, x11, x15} -+ -+ -+static inline int next_subset(HEVCContext * const s, int i, const int c_idx_nz, -+ uint8_t * const significant_coeff_group_flag, -+ const uint8_t * const scan_x_cg, const uint8_t * const scan_y_cg, -+ int * const pPrev_sig) -+{ -+ while (--i >= 0) { -+ unsigned int x_cg = scan_x_cg[i]; -+ unsigned int y_cg = scan_y_cg[i]; -+ -+ // For the flag decode we only care about Z/NZ but -+ // we use the full Right + Down * 2 when calculating -+ // significant coeff flags so we obtain it here -+ //. -+ // The group flag array is one longer than it needs to -+ // be so we don't need to check for y_cg limits -+ unsigned int prev_sig = ((significant_coeff_group_flag[y_cg] >> (x_cg + 1)) & 1) | -+ (((significant_coeff_group_flag[y_cg + 1] >> x_cg) & 1) << 1); -+ -+ if (i == 0 || -+ significant_coeff_group_flag_decode(s, c_idx_nz, prev_sig)) -+ { -+ significant_coeff_group_flag[y_cg] |= (1 << x_cg); -+ *pPrev_sig = prev_sig; -+ break; -+ } -+ } -+ -+ return i; -+} -+ - - void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - int log2_trafo_size, enum ScanType scan_idx, - int c_idx) - { --#define GET_COORD(offset, n) \ -- do { \ -- x_c = (x_cg << 2) + scan_x_off[n]; \ -- y_c = (y_cg << 2) + scan_y_off[n]; \ -- } while (0) -- HEVCLocalContext *lc = s->HEVClc; -- int transform_skip_flag = 0; -+ HEVCLocalContext * const lc = s->HEVClc; -+ int trans_skip_or_bypass = lc->cu.cu_transquant_bypass_flag; - - int last_significant_coeff_x, last_significant_coeff_y; -- int last_scan_pos; -- int n_end; - int num_coeff = 0; -- int greater1_ctx = 1; -+ int prev_subset_coded = 0; - - int num_last_subset; - int x_cg_last_sig, y_cg_last_sig; - -- const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off; -+ const uint8_t *scan_x_cg, *scan_y_cg; -+ const xy_off_t * scan_xy_off; - - ptrdiff_t stride = s->frame->linesize[c_idx]; - int hshift = s->ps.sps->hshift[c_idx]; -@@ -1032,21 +1529,28 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + - ((x0 >> hshift) << s->ps.sps->pixel_shift)]; - #ifdef RPI -- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; -+ //***** transform_skip_flag decoded later! -+ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag /* && !transform_skip_flag*/ && !lc->tu.cross_pf && log2_trafo_size>=4; - #endif - int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -- uint8_t significant_coeff_group_flag[8][8] = {{0}}; -+ uint8_t significant_coeff_group_flag[9] = {0}; // Allow 1 final byte that is always zero - int explicit_rdpcm_flag = 0; - int explicit_rdpcm_dir_flag; - - int trafo_size = 1 << log2_trafo_size; - int i; -- int qp,shift,add,scale,scale_m; -+ int qp,shift,scale; - static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; - const uint8_t *scale_matrix = NULL; - uint8_t dc_scale; - int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : - lc->tu.intra_pred_mode_c; -+ -+ int prev_sig = 0; -+ const int c_idx_nz = (c_idx != 0); -+ -+ int may_hide_sign; -+ - #ifdef RPI - if (s->enable_rpi) { - int n = trafo_size * trafo_size; -@@ -1078,7 +1582,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - - // Derive QP for dequant - if (!lc->cu.cu_transquant_bypass_flag) { -- static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; -+ static const uint8_t qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; - static const uint8_t rem6[51 + 4 * 6 + 1] = { - 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, - 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, -@@ -1094,9 +1598,19 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - }; - int qp_y = lc->qp_y; - -+ may_hide_sign = s->ps.pps->sign_data_hiding_flag; -+ - if (s->ps.pps->transform_skip_enabled_flag && - log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) { -- transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx); -+ int transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx_nz); -+ if (transform_skip_flag) { -+ trans_skip_or_bypass = 1; -+ if (lc->cu.pred_mode == MODE_INTRA && -+ s->ps.sps->implicit_rdpcm_enabled_flag && -+ (pred_mode_intra == 10 || pred_mode_intra == 26)) { -+ may_hide_sign = 0; -+ } -+ } - } - - if (c_idx == 0) { -@@ -1129,39 +1643,73 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - qp += s->ps.sps->qp_bd_offset; - } - -- shift = s->ps.sps->bit_depth + log2_trafo_size - 5; -- add = 1 << (shift-1); -- scale = level_scale[rem6[qp]] << (div6[qp]); -- scale_m = 16; // default when no custom scaling lists. -- dc_scale = 16; -+ // Shift is set to one less than will actually occur as the scale -+ // and saturate step adds 1 and then shifts right again -+ shift = s->ps.sps->bit_depth + log2_trafo_size - 6; -+ scale = level_scale[rem6[qp]]; -+ if (div6[qp] >= shift) { -+ scale <<= (div6[qp] - shift); -+ shift = 0; -+ } else { -+ shift -= div6[qp]; -+ } - -- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { -+ if (s->ps.sps->scaling_list_enable_flag && !(trans_skip_or_bypass && log2_trafo_size > 2)) { - const ScalingList *sl = s->ps.pps->scaling_list_data_present_flag ? -- &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; -+ &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; - int matrix_id = lc->cu.pred_mode != MODE_INTRA; - - matrix_id = 3 * matrix_id + c_idx; - - scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; -+ dc_scale = scale_matrix[0]; - if (log2_trafo_size >= 4) - dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; - } -+ else -+ { -+ static const uint8_t sixteen_scale[64] = { -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16, -+ 16, 16, 16, 16, 16, 16, 16, 16 -+ }; -+ scale_matrix = sixteen_scale; -+ dc_scale = 16; -+ } - } else { -+ static const uint8_t unit_scale[64] = { -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ 1, 1, 1, 1, 1, 1, 1, 1, -+ }; -+ scale_matrix = unit_scale; - shift = 0; -- add = 0; -- scale = 0; -- dc_scale = 0; -+ scale = 2; // We will shift right to kill this -+ dc_scale = 1; -+ -+ may_hide_sign = 0; - } - - if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag && -- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -- explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx); -+ trans_skip_or_bypass) { -+ explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx_nz); - if (explicit_rdpcm_flag) { -- explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx); -+ may_hide_sign = 0; -+ explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx_nz); - } - } - -- last_significant_coeff_xy_prefix_decode(s, c_idx, log2_trafo_size, -+ last_significant_coeff_xy_prefix_decode(s, c_idx_nz, log2_trafo_size, - &last_significant_coeff_x, &last_significant_coeff_y); - - if (last_significant_coeff_x > 3) { -@@ -1189,119 +1737,113 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - int last_x_c = last_significant_coeff_x & 3; - int last_y_c = last_significant_coeff_y & 3; - -- scan_x_off = ff_hevc_diag_scan4x4_x; -- scan_y_off = ff_hevc_diag_scan4x4_y; - num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; -- if (trafo_size == 4) { -+ -+ switch (log2_trafo_size) { -+ case 2: - scan_x_cg = scan_1x1; - scan_y_cg = scan_1x1; -- } else if (trafo_size == 8) { -+ break; -+ case 3: - num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; - scan_x_cg = diag_scan2x2_x; - scan_y_cg = diag_scan2x2_y; -- } else if (trafo_size == 16) { -+ break; -+ case 4: - num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; - scan_x_cg = ff_hevc_diag_scan4x4_x; - scan_y_cg = ff_hevc_diag_scan4x4_y; -- } else { // trafo_size == 32 -+ break; -+ case 5: -+ default: - num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; - scan_x_cg = ff_hevc_diag_scan8x8_x; - scan_y_cg = ff_hevc_diag_scan8x8_y; -+ break; - } - break; - } - case SCAN_HORIZ: - scan_x_cg = horiz_scan2x2_x; - scan_y_cg = horiz_scan2x2_y; -- scan_x_off = horiz_scan4x4_x; -- scan_y_off = horiz_scan4x4_y; - num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; - break; - default: //SCAN_VERT - scan_x_cg = horiz_scan2x2_y; - scan_y_cg = horiz_scan2x2_x; -- scan_x_off = horiz_scan4x4_y; -- scan_y_off = horiz_scan4x4_x; - num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; - break; - } - num_coeff++; - num_last_subset = (num_coeff - 1) >> 4; - -- for (i = num_last_subset; i >= 0; i--) { -- int n, m; -- int x_cg, y_cg, x_c, y_c, pos; -- int implicit_non_zero_coeff = 0; -- int64_t trans_coeff_level; -- int prev_sig = 0; -- int offset = i << 4; -- int rice_init = 0; -- -- uint8_t significant_coeff_flag_idx[16]; -- uint8_t nb_significant_coeff_flag = 0; -+ significant_coeff_group_flag[y_cg_last_sig] = 1 << x_cg_last_sig; // 1st subset always significant - -- x_cg = scan_x_cg[i]; -- y_cg = scan_y_cg[i]; -+ scan_xy_off = off_xys[scan_idx][log2_trafo_size - 2]; - -- if ((i < num_last_subset) && (i > 0)) { -- int ctx_cg = 0; -- if (x_cg < (1 << (log2_trafo_size - 2)) - 1) -- ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg]; -- if (y_cg < (1 << (log2_trafo_size - 2)) - 1) -- ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1]; -- -- significant_coeff_group_flag[x_cg][y_cg] = -- significant_coeff_group_flag_decode(s, c_idx, ctx_cg); -- implicit_non_zero_coeff = 1; -- } else { -- significant_coeff_group_flag[x_cg][y_cg] = -- ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) || -- (x_cg == 0 && y_cg == 0)); -- } -+ i = num_last_subset; -+ do { -+ int implicit_non_zero_coeff = 0; -+ int n_end; - -- last_scan_pos = num_coeff - offset - 1; -+ uint8_t significant_coeff_flag_idx[16]; -+ unsigned int nb_significant_coeff_flag = 0; - - if (i == num_last_subset) { -+ // First time through -+ int last_scan_pos = num_coeff - (i << 4) - 1; - n_end = last_scan_pos - 1; - significant_coeff_flag_idx[0] = last_scan_pos; - nb_significant_coeff_flag = 1; - } else { - n_end = 15; -+ implicit_non_zero_coeff = (i != 0); - } - -- if (x_cg < ((1 << log2_trafo_size) - 1) >> 2) -- prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg]; -- if (y_cg < ((1 << log2_trafo_size) - 1) >> 2) -- prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1); -- -- if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) { -- static const uint8_t ctx_idx_map[] = { -- 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, // log2_trafo_size == 2 -- 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 0 -- 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 1 -- 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, // prev_sig == 2 -- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 // default -+ if (n_end >= 0) { -+ static const uint8_t ctx_idx_maps_ts2[3][16] = { -+ D4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 -+ H4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 -+ V4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8) // log2_trafo_size == 2 -+ }; -+ static const uint8_t ctx_idx_maps[3][4][16] = { -+ { -+ D4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -+ D4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -+ D4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -+ D4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -+ }, -+ { -+ H4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -+ H4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -+ H4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -+ H4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -+ }, -+ { -+ V4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -+ V4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -+ V4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -+ V4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -+ } - }; - const uint8_t *ctx_idx_map_p; - int scf_offset = 0; -- if (s->ps.sps->transform_skip_context_enabled_flag && -- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16]; -- if (c_idx == 0) { -- scf_offset = 40; -- } else { -- scf_offset = 14 + 27; -- } -+ -+ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { -+ ctx_idx_map_p = ctx_idx_maps[0][3]; -+ scf_offset = 40 + c_idx_nz; - } else { -- if (c_idx != 0) -+ if (c_idx_nz != 0) - scf_offset = 27; -+ - if (log2_trafo_size == 2) { -- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[0]; -+ ctx_idx_map_p = ctx_idx_maps_ts2[scan_idx]; - } else { -- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[(prev_sig + 1) << 4]; -- if (c_idx == 0) { -- if ((x_cg > 0 || y_cg > 0)) -+ ctx_idx_map_p = ctx_idx_maps[scan_idx][prev_sig]; -+ if (!c_idx_nz) { -+ if (i != 0) - scf_offset += 3; -+ - if (log2_trafo_size == 3) { - scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; - } else { -@@ -1315,34 +1857,30 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - } - } - } -- for (n = n_end; n > 0; n--) { -- x_c = scan_x_off[n]; -- y_c = scan_y_off[n]; -- if (significant_coeff_flag_decode(s, x_c, y_c, scf_offset, ctx_idx_map_p)) { -- significant_coeff_flag_idx[nb_significant_coeff_flag] = n; -- nb_significant_coeff_flag++; -+ -+ if (n_end > 0) { -+ int cnt = get_sig_coeff_flag_idxs(&s->HEVClc->cc, -+ s->HEVClc->cabac_state + elem_offset[SIGNIFICANT_COEFF_FLAG] + scf_offset, -+ n_end, ctx_idx_map_p, -+ significant_coeff_flag_idx + nb_significant_coeff_flag); -+ -+ nb_significant_coeff_flag += cnt; -+ if (cnt != 0) { - implicit_non_zero_coeff = 0; - } - } -+ - if (implicit_non_zero_coeff == 0) { -- if (s->ps.sps->transform_skip_context_enabled_flag && -- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -- if (c_idx == 0) { -- scf_offset = 42; -- } else { -- scf_offset = 16 + 27; -- } -+ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { -+ scf_offset = 42 + c_idx_nz; - } else { - if (i == 0) { -- if (c_idx == 0) -- scf_offset = 0; -- else -- scf_offset = 27; -+ scf_offset = c_idx_nz ? 27 : 0; - } else { - scf_offset = 2 + scf_offset; - } - } -- if (significant_coeff_flag_decode_0(s, c_idx, scf_offset) == 1) { -+ if (significant_coeff_flag_decode_0(s, scf_offset) == 1) { - significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; - nb_significant_coeff_flag++; - } -@@ -1352,141 +1890,185 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - } - } - -- n_end = nb_significant_coeff_flag; -- -+ if (nb_significant_coeff_flag != 0) { -+ const unsigned int gt1_idx_delta = (c_idx_nz << 2) | -+ ((i != 0 && !c_idx_nz) ? 2 : 0) | -+ prev_subset_coded; -+ const unsigned int idx0_gt1 = elem_offset[COEFF_ABS_LEVEL_GREATER1_FLAG] + -+ (gt1_idx_delta << 2); -+ const unsigned int idx_gt2 = elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + -+ gt1_idx_delta; -+ -+ const unsigned int x_cg = scan_x_cg[i]; -+ const unsigned int y_cg = scan_y_cg[i]; -+ int16_t * const blk_coeffs = coeffs + -+ ((x_cg + (y_cg << log2_trafo_size)) << 2); -+ // This calculation is 'wrong' for log2_traffo_size == 2 -+ // but that doesn't mattor as in this case x_cg & y_cg -+ // are always 0 so result is correct (0) anyway -+ const uint8_t * const blk_scale = scale_matrix + -+ (((x_cg + (y_cg << 3)) << (5 - log2_trafo_size))); -+ -+ // * THe following code block doesn't deal with these flags: -+ // (nor did the one it replaces) -+ // -+ // cabac_bypass_alignment_enabled_flag -+ // This should be easy but I can't find a test case -+ // extended_precision_processing_flag -+ // This can extend the required precision past 16bits -+ // so is probably tricky - also no example found yet -+ -+#if USE_N_END_1 -+ if (nb_significant_coeff_flag == 1) { -+ // There is a small gain to be had from special casing the single -+ // transform coefficient case. The reduction in complexity -+ // makes up for the code duplicatioon. -+ -+ int trans_coeff_level = 1; -+ int coeff_sign_flag; -+ int coded_val = 0; -+ -+ // initialize first elem of coeff_bas_level_greater1_flag -+ prev_subset_coded = 0; -+ -+ if (get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx0_gt1 + 1)) { -+ trans_coeff_level = 2; -+ prev_subset_coded = 1; -+ coded_val = get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx_gt2); -+ } - -- if (n_end) { -- int first_nz_pos_in_cg; -- int last_nz_pos_in_cg; -- int c_rice_param = 0; -- int first_greater1_coeff_idx = -1; -- uint8_t coeff_abs_level_greater1_flag[8]; -- uint16_t coeff_sign_flag; -- int sum_abs = 0; -- int sign_hidden; -- int sb_type; -+ // Probably not worth the overhead of starting by22 for just one value -+ coeff_sign_flag = get_cabac_bypass(&s->HEVClc->cc); - -+ if (coded_val) -+ { -+ if (!s->ps.sps->persistent_rice_adaptation_enabled_flag) { -+ trans_coeff_level = 3 + coeff_abs_level_remaining_decode(s, 0); -+ } else { -+ uint8_t * const stat_coeff = -+ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); -+ const unsigned int c_rice_param = *stat_coeff >> 2; -+ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); - -- // initialize first elem of coeff_bas_level_greater1_flag -- int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0; -+ trans_coeff_level = 3 + last_coeff_abs_level_remaining; -+ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); -+ } -+ } - -- if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { -- if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag) -- sb_type = 2 * (c_idx == 0 ? 1 : 0); -- else -- sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1; -- c_rice_param = lc->stat_coeff[sb_type] / 4; -- } -+ { -+ const xy_off_t * const xy_off = scan_xy_off + significant_coeff_flag_idx[0]; -+ const int k = (int32_t)(coeff_sign_flag << 31) >> 31; -+ const unsigned int scale_m = blk_scale[xy_off->scale]; - -- if (!(i == num_last_subset) && greater1_ctx == 0) -- ctx_set++; -- greater1_ctx = 1; -- last_nz_pos_in_cg = significant_coeff_flag_idx[0]; -- -- for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) { -- int inc = (ctx_set << 2) + greater1_ctx; -- coeff_abs_level_greater1_flag[m] = -- coeff_abs_level_greater1_flag_decode(s, c_idx, inc); -- if (coeff_abs_level_greater1_flag[m]) { -- greater1_ctx = 0; -- if (first_greater1_coeff_idx == -1) -- first_greater1_coeff_idx = m; -- } else if (greater1_ctx > 0 && greater1_ctx < 3) { -- greater1_ctx++; -+ blk_coeffs[xy_off->coeff] = trans_scale_sat( -+ (trans_coeff_level ^ k) - k, // Apply sign -+ scale, -+ i == 0 && xy_off->coeff == 0 ? dc_scale : scale_m, -+ shift); - } - } -- first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1]; -- -- if (lc->cu.cu_transquant_bypass_flag || -- (lc->cu.pred_mode == MODE_INTRA && -- s->ps.sps->implicit_rdpcm_enabled_flag && transform_skip_flag && -- (pred_mode_intra == 10 || pred_mode_intra == 26 )) || -- explicit_rdpcm_flag) -- sign_hidden = 0; - else -- sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4); -+#endif -+ { -+ int sign_hidden = may_hide_sign; -+ int levels[16]; // Should be able to get away with int16_t but that fails some tests -+ uint32_t coeff_sign_flags; -+ uint32_t coded_vals = 0; -+ // Sum(abs(level[])) -+ // In fact we only need the bottom bit and in some future -+ // version that may be all we calculate -+ unsigned int sum_abs; -+ -+ coded_vals = get_greaterx_bits(s, nb_significant_coeff_flag, levels, -+ &prev_subset_coded, &sum_abs, idx0_gt1, idx_gt2); -+ -+ if (significant_coeff_flag_idx[0] - significant_coeff_flag_idx[nb_significant_coeff_flag - 1] <= 3) -+ sign_hidden = 0; -+ -+ // -- Start bypass block -+ -+ bypass_start(s); -+ -+ coeff_sign_flags = coeff_sign_flag_decode_bypass(s, nb_significant_coeff_flag - sign_hidden); -+ -+ if (coded_vals != 0) -+ { -+ const int rice_adaptation_enabled = s->ps.sps->persistent_rice_adaptation_enabled_flag; -+ uint8_t * stat_coeff = !rice_adaptation_enabled ? NULL : -+ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); -+ int c_rice_param = !rice_adaptation_enabled ? 0 : *stat_coeff >> 2; -+ int * level = levels - 1; -+ -+ do { -+ { -+ const unsigned int z = hevc_clz32(coded_vals) + 1; -+ level += z; -+ coded_vals <<= z; -+ } - -- if (first_greater1_coeff_idx != -1) { -- coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set); -- } -- if (!s->ps.pps->sign_data_hiding_flag || !sign_hidden ) { -- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); -- } else { -- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); -- } -+ { -+ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode_bypass(s, c_rice_param); -+ const int trans_coeff_level = *level + last_coeff_abs_level_remaining + 1; -+ -+ sum_abs += last_coeff_abs_level_remaining + 1; -+ *level = trans_coeff_level; - -- for (m = 0; m < n_end; m++) { -- n = significant_coeff_flag_idx[m]; -- GET_COORD(offset, n); -- if (m < 8) { -- trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m]; -- if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) { -- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -- -- trans_coeff_level += last_coeff_abs_level_remaining; -- if (trans_coeff_level > (3 << c_rice_param)) -- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); -- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { -- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; -- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) -- lc->stat_coeff[sb_type]++; -- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) -- if (lc->stat_coeff[sb_type] > 0) -- lc->stat_coeff[sb_type]--; -- rice_init = 1; -+ if (stat_coeff != NULL) -+ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); -+ stat_coeff = NULL; -+ -+ if (trans_coeff_level > (3 << c_rice_param) && -+ (c_rice_param < 4 || rice_adaptation_enabled)) -+ ++c_rice_param; - } -- } -- } else { -- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -- -- trans_coeff_level = 1 + last_coeff_abs_level_remaining; -- if (trans_coeff_level > (3 << c_rice_param)) -- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); -- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { -- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; -- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) -- lc->stat_coeff[sb_type]++; -- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) -- if (lc->stat_coeff[sb_type] > 0) -- lc->stat_coeff[sb_type]--; -- rice_init = 1; -- } -+ } while (coded_vals != 0); - } -- if (s->ps.pps->sign_data_hiding_flag && sign_hidden) { -- sum_abs += trans_coeff_level; -- if (n == first_nz_pos_in_cg && (sum_abs&1)) -- trans_coeff_level = -trans_coeff_level; -+ -+ // sign_hidden = 0 or 1 so we can combine the tests -+ if ((sign_hidden & sum_abs) != 0) { -+ levels[nb_significant_coeff_flag - 1] = -levels[nb_significant_coeff_flag - 1]; - } -- if (coeff_sign_flag >> 15) -- trans_coeff_level = -trans_coeff_level; -- coeff_sign_flag <<= 1; -- if(!lc->cu.cu_transquant_bypass_flag) { -- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { -- if(y_c || x_c || log2_trafo_size < 4) { -- switch(log2_trafo_size) { -- case 3: pos = (y_c << 3) + x_c; break; -- case 4: pos = ((y_c >> 1) << 3) + (x_c >> 1); break; -- case 5: pos = ((y_c >> 2) << 3) + (x_c >> 2); break; -- default: pos = (y_c << 2) + x_c; break; -- } -- scale_m = scale_matrix[pos]; -- } else { -- scale_m = dc_scale; -- } -+ -+ bypass_finish(s); -+ -+ // -- Finish bypass block -+ -+ // Scale loop -+ { -+ int m = nb_significant_coeff_flag - 1; -+ -+ // Deal with DC component (if any) first -+ if (i == 0 && significant_coeff_flag_idx[m] == 0) -+ { -+ const int k = (int32_t)(coeff_sign_flags << m) >> 31; -+ blk_coeffs[0] = trans_scale_sat( -+ (levels[m] ^ k) - k, scale, dc_scale, shift); -+ --m; - } -- trans_coeff_level = (trans_coeff_level * (int64_t)scale * (int64_t)scale_m + add) >> shift; -- if(trans_coeff_level < 0) { -- if((~trans_coeff_level) & 0xFffffffffff8000) -- trans_coeff_level = -32768; -- } else { -- if(trans_coeff_level & 0xffffffffffff8000) -- trans_coeff_level = 32767; -+ -+#if !USE_N_END_1 -+ // If N_END_! set then m was at least 1 initially -+ if (m >= 0) -+#endif -+ { -+ do { -+ const xy_off_t * const xy_off = scan_xy_off + -+ significant_coeff_flag_idx[m]; -+ const int k = (int32_t)(coeff_sign_flags << m) >> 31; -+ -+ blk_coeffs[xy_off->coeff] = trans_scale_sat( -+ (levels[m] ^ k) - k, -+ scale, -+ blk_scale[xy_off->scale], -+ shift); -+ } while (--m >= 0); - } - } -- coeffs[y_c * trafo_size + x_c] = trans_coeff_level; -+ - } - } -- } -+ } while ((i = next_subset(s, i, c_idx_nz, -+ significant_coeff_group_flag, scan_x_cg, scan_y_cg, &prev_sig)) >= 0); - - if (lc->cu.cu_transquant_bypass_flag) { - if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && -@@ -1496,7 +2078,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, - s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); - } - } else { -- if (transform_skip_flag) { -+ if (trans_skip_or_bypass) { // Must be trans_skip as we've already dealt with bypass - int rot = s->ps.sps->transform_skip_rotation_enabled_flag && - log2_trafo_size == 2 && - lc->cu.pred_mode == MODE_INTRA; --- -2.7.4 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1005-0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1005-0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch deleted file mode 100644 index ab7d3e981d..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1005-0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 4060f15e2d29e268110032d4366382e370e088d0 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 26 Jun 2016 20:09:18 +0100 -Subject: [PATCH] avcodec: add h264_mvc codec id and profiles - ---- - libavcodec/avcodec.h | 5 +++++ - libavcodec/codec_desc.c | 7 +++++++ - libavformat/mpegts.c | 2 +- - 3 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index a1ba217..abd2e91 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -410,6 +410,8 @@ enum AVCodecID { - AV_CODEC_ID_SHEERVIDEO, - AV_CODEC_ID_YLC, - -+ AV_CODEC_ID_H264_MVC, -+ - /* various PCM "codecs" */ - AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs - AV_CODEC_ID_PCM_S16LE = 0x10000, -@@ -3195,6 +3197,9 @@ typedef struct AVCodecContext { - #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 - #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) - #define FF_PROFILE_H264_CAVLC_444 44 -+#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 -+#define FF_PROFILE_H264_STEREO_HIGH 128 -+#define FF_PROFILE_H264_MULTIVIEW_HIGH_DEPTH 138 - - #define FF_PROFILE_VC1_SIMPLE 0 - #define FF_PROFILE_VC1_MAIN 1 -diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -index 9d94b72..535ebf0 100644 ---- a/libavcodec/codec_desc.c -+++ b/libavcodec/codec_desc.c -@@ -1563,6 +1563,13 @@ static const AVCodecDescriptor codec_descriptors[] = { - .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, -+ { -+ .id = AV_CODEC_ID_H264_MVC, -+ .type = AVMEDIA_TYPE_VIDEO, -+ .name = "h264_mvc", -+ .long_name = NULL_IF_CONFIG_SMALL("H264 MVC"), -+ .props = AV_CODEC_PROP_LOSSY, -+ }, - - /* various PCM "codecs" */ - { -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index b31d233..2767306 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -701,7 +701,7 @@ static const StreamType ISO_types[] = { - #endif - { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, - { 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC }, -- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, -+ { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264_MVC }, - { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 }, - { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC }, - { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, --- -2.7.4 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1006-0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1006-0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch deleted file mode 100644 index 4894bd781b..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1006-0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 23dd20678a05e1764e5d8d30481cb354a51b6c8b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 26 Jun 2016 20:16:03 +0100 -Subject: [PATCH] h264_parser: add support for parsing h264 mvc NALUs - ---- - libavcodec/allcodecs.c | 1 + - libavcodec/h264.h | 2 ++ - libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++---- - 3 files changed, 33 insertions(+), 4 deletions(-) - -diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index 54efaad..02a89c3 100644 ---- a/libavcodec/allcodecs.c -+++ b/libavcodec/allcodecs.c -@@ -667,6 +667,7 @@ void avcodec_register_all(void) - REGISTER_PARSER(H261, h261); - REGISTER_PARSER(H263, h263); - REGISTER_PARSER(H264, h264); -+ REGISTER_PARSER(H264_MVC, h264_mvc); - REGISTER_PARSER(HEVC, hevc); - REGISTER_PARSER(MJPEG, mjpeg); - REGISTER_PARSER(MLP, mlp); -diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index efe3555..16358aa 100644 ---- a/libavcodec/h264.h -+++ b/libavcodec/h264.h -@@ -126,7 +126,9 @@ enum { - NAL_END_STREAM = 11, - NAL_FILLER_DATA = 12, - NAL_SPS_EXT = 13, -+ NAL_SPS_SUBSET = 15, - NAL_AUXILIARY_SLICE = 19, -+ NAL_SLICE_EXT = 20, - NAL_FF_IGNORE = 0xff0f001, - }; - -diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -index ce4bab2..082ac17 100644 ---- a/libavcodec/h264_parser.c -+++ b/libavcodec/h264_parser.c -@@ -58,6 +58,7 @@ typedef struct H264ParseContext { - uint8_t parse_history[6]; - int parse_history_count; - int parse_last_mb; -+ int is_mvc; - } H264ParseContext; - - -@@ -105,14 +106,18 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, - } else if (state <= 5) { - int nalu_type = buf[i] & 0x1F; - if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || -- nalu_type == NAL_PPS || nalu_type == NAL_AUD) { -+ nalu_type == NAL_PPS || nalu_type == NAL_AUD || -+ nalu_type == NAL_SPS_SUBSET) { - if (pc->frame_start_found) { - i++; - goto found; - } - } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || -- nalu_type == NAL_IDR_SLICE) { -+ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { - state += 8; -+ -+ if (nalu_type == NAL_SLICE_EXT) -+ i += 3; // skip mvc extension - continue; - } - state = 7; -@@ -585,7 +590,8 @@ static int h264_parse(AVCodecParserContext *s, - } - } - -- parse_nal_units(s, avctx, buf, buf_size); -+ if (!p->is_mvc) -+ parse_nal_units(s, avctx, buf, buf_size); - - if (avctx->framerate.num) - avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); -@@ -622,7 +628,7 @@ static int h264_split(AVCodecContext *avctx, - if ((state & 0xFFFFFF00) != 0x100) - break; - nalu_type = state & 0x1F; -- if (nalu_type == NAL_SPS) { -+ if (nalu_type == NAL_SPS || nalu_type == NAL_SPS_SUBSET) { - has_sps = 1; - } else if (nalu_type == NAL_PPS) - has_pps = 1; -@@ -672,3 +678,23 @@ AVCodecParser ff_h264_parser = { - .parser_close = h264_close, - .split = h264_split, - }; -+ -+static av_cold int init_mvc(AVCodecParserContext *s) -+{ -+ H264ParseContext *p = s->priv_data; -+ int ret = init(s); -+ if (ret < 0) -+ return ret; -+ -+ p->is_mvc = 1; -+ return 0; -+} -+ -+AVCodecParser ff_h264_mvc_parser = { -+ .codec_ids = { AV_CODEC_ID_H264_MVC }, -+ .priv_data_size = sizeof(H264ParseContext), -+ .parser_init = init_mvc, -+ .parser_parse = h264_parse, -+ .parser_close = h264_close, -+ .split = h264_split, -+}; --- -2.7.4 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1007-h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1007-h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch deleted file mode 100644 index 1272d4889a..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1007-h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 12d99a92469e5916de3bc787dce4c13abfdd5e09 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 26 Jun 2016 20:20:04 +0100 -Subject: [PATCH] h264_parser: fix parsing of mvc slices in some corner cases - ---- - libavcodec/h264_parser.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -index 082ac17..b9b0c78 100644 ---- a/libavcodec/h264_parser.c -+++ b/libavcodec/h264_parser.c -@@ -59,6 +59,7 @@ typedef struct H264ParseContext { - int parse_history_count; - int parse_last_mb; - int is_mvc; -+ int slice_ext; - } H264ParseContext; - - -@@ -116,18 +117,17 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, - nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { - state += 8; - -- if (nalu_type == NAL_SLICE_EXT) -- i += 3; // skip mvc extension -+ p->slice_ext = (nalu_type == NAL_SLICE_EXT); - continue; - } - state = 7; - } else { - p->parse_history[p->parse_history_count++] = buf[i]; -- if (p->parse_history_count > 5) { -+ if (p->parse_history_count > 8) { - unsigned int mb, last_mb = p->parse_last_mb; - GetBitContext gb; - -- init_get_bits(&gb, p->parse_history, 8*p->parse_history_count); -+ init_get_bits8(&gb, p->parse_history + 3*p->slice_ext, p->parse_history_count - 3*p->slice_ext); - p->parse_history_count = 0; - mb= get_ue_golomb_long(&gb); - p->parse_last_mb = mb; -@@ -150,7 +150,7 @@ found: - pc->frame_start_found = 0; - if (p->is_avc) - return next_avc; -- return i - (state & 5) - 5 * (state > 7); -+ return i - (state & 5) - 8 * (state > 7); - } - - static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb, --- -2.7.4 - - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch deleted file mode 100644 index 721a065449..0000000000 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-99.1008-73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105 Mon Sep 17 00:00:00 2001 -From: Hendrik Leppkes -Date: Mon, 1 Sep 2014 11:39:09 +0200 -Subject: [PATCH] h264_parser: force grabing a new timestamp until a frame - start was found - ---- - libavcodec/h264_parser.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -index 2fd3f2b..7165652 100644 ---- a/libavcodec/h264_parser.c -+++ b/libavcodec/h264_parser.c -@@ -525,6 +525,9 @@ static int h264_parse(AVCodecParserContext *s, - } else { - next = h264_find_frame_end(p, buf, buf_size); - -+ if (next == END_NOT_FOUND && pc->frame_start_found == 0) -+ s->fetch_timestamp = 1; -+ - if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-Speed_up_wtv_index_creation.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-Speed_up_wtv_index_creation.patch new file mode 100644 index 0000000000..d829898294 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-Speed_up_wtv_index_creation.patch @@ -0,0 +1,47 @@ +commit 0e7427498cb1131671f6fe9d054245ae7e5a36f5 +Author: popcornmix +Date: Tue Mar 25 19:43:07 2014 +0000 + + [ffmpeg] Speed up wtv index creation + + The index creation is O(N^2) with number of entries (typically thousands). + On a Pi this can take more than 60 seconds to execute for a recording of a few hours. + + By replacing with an O(N) loop, this takes virtually zero time + +diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c +index e423370..70898bd 100644 +--- a/libavformat/wtvdec.c ++++ b/libavformat/wtvdec.c +@@ -980,21 +980,23 @@ static int read_header(AVFormatContext *s) + pb = wtvfile_open(s, root, root_size, ff_timeline_table_0_entries_Events_le16); + if (pb) { + int i; ++ AVIndexEntry *e = wtv->index_entries; ++ AVIndexEntry *e_end = wtv->index_entries + wtv->nb_index_entries - 1; ++ uint64_t last_position = 0; + while (1) { + uint64_t frame_nb = avio_rl64(pb); + uint64_t position = avio_rl64(pb); ++ while (frame_nb > e->size && e <= e_end) { ++ e->pos = last_position; ++ e++; ++ } + if (avio_feof(pb)) + break; +- for (i = wtv->nb_index_entries - 1; i >= 0; i--) { +- AVIndexEntry *e = wtv->index_entries + i; +- if (frame_nb > e->size) +- break; +- if (position > e->pos) +- e->pos = position; +- } ++ last_position = position; + } ++ e_end->pos = last_position; + wtvfile_close(pb); +- st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp; ++ st->duration = e_end->timestamp; + } + } + } diff --git a/packages/multimedia/imx-vpu/package.mk b/packages/multimedia/imx-vpu/package.mk deleted file mode 100644 index 5c6df0e8c5..0000000000 --- a/packages/multimedia/imx-vpu/package.mk +++ /dev/null @@ -1,41 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="imx-vpu" -PKG_VERSION="5.4.33" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="other" -PKG_SITE="http://www.freescale.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain firmware-imx" -PKG_SECTION="multimedia" -PKG_SHORTDESC="imx-vpu: platform specific unit tests for mxc platform" -PKG_LONGDESC="imx-vpu: platform specific unit tests for mxc platform" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - make DIRS="vpu" CFLAGS="$CFLAGS" PLATFORM=IMX6Q CROSS_COMPILE=$TARGET_PREFIX -} - -makeinstall_target() { - make DIRS="vpu" PLATFORM=IMX6Q DEST_DIR=$SYSROOT_PREFIX install - make DIRS="vpu" PLATFORM=IMX6Q DEST_DIR=$INSTALL install -} diff --git a/packages/multimedia/intel-vaapi-driver/package.mk b/packages/multimedia/intel-vaapi-driver/package.mk new file mode 100644 index 0000000000..84f4489692 --- /dev/null +++ b/packages/multimedia/intel-vaapi-driver/package.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="intel-vaapi-driver" +PKG_VERSION="2.3.0" +PKG_SHA256="fcc3f09291e58fd316fd015d4e1329e7e03c38cffa4651bda725d500a66aa74e" +PKG_ARCH="x86_64" +PKG_LICENSE="GPL" +PKG_SITE="https://01.org/linuxmedia" +PKG_URL="https://github.com/intel/intel-vaapi-driver/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libva libdrm" +PKG_LONGDESC="intel-vaapi-driver: VA-API user mode driver for Intel GEN Graphics family" +PKG_TOOLCHAIN="autotools" + +if [ "$DISPLAYSERVER" = "x11" ]; then + DISPLAYSERVER_LIBVA="--enable-x11 --disable-wayland" +elif [ "$DISPLAYSERVER" = "weston" ]; then + DISPLAYSERVER_LIBVA="--disable-x11 --enable-wayland" +else + DISPLAYSERVER_LIBVA="--disable-x11 --disable-wayland" +fi + +PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ + --enable-drm \ + $DISPLAYSERVER_LIBVA" diff --git a/packages/multimedia/libaacs/package.mk b/packages/multimedia/libaacs/package.mk index 9e7484c5cf..e6b6106548 100644 --- a/packages/multimedia/libaacs/package.mk +++ b/packages/multimedia/libaacs/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libaacs" -PKG_VERSION="9da2b68" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.9.0" +PKG_SHA256="47e0bdc9c9f0f6146ed7b4cc78ed1527a04a537012cf540cf5211e06a248bace" PKG_LICENSE="GPL" PKG_SITE="http://www.videolan.org/developers/libaacs.html" -PKG_URL="ftp://ftp.videolan.org/pub/videolan/libaacs/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="http://download.videolan.org/pub/videolan/libaacs/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libgcrypt" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libaacs: a research project to implement the Advanced Access Content System specification." -PKG_LONGDESC="libaacs is a research project to implement the Advanced Access Content System specification. This research project provides, through an open-source library, a way to understand how the AACS works. This research project is mainly developed by an international team of developers from Doom9." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="libaacs is a research project to implement the Advanced Access Content System specification." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-werror \ --disable-extra-warnings \ diff --git a/packages/multimedia/libamcodec/package.mk b/packages/multimedia/libamcodec/package.mk index 4f9e189650..df350e1212 100644 --- a/packages/multimedia/libamcodec/package.mk +++ b/packages/multimedia/libamcodec/package.mk @@ -1,57 +1,35 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libamcodec" -PKG_REV="1" PKG_ARCH="arm aarch64" PKG_LICENSE="other" PKG_SITE="http://openlinux.amlogic.com" -case $TARGET_ARCH in +case $TARGET_KERNEL_ARCH in arm) PKG_VERSION="5e23a81" + PKG_SHA256="412cfafbd9725f5186b884b9599ff6561d2031b44d9873e79d377631a2b5f9b9" PKG_URL="https://github.com/codesnake/libamcodec/archive/$PKG_VERSION.tar.gz" ;; - aarch64) - PKG_VERSION="210755d" - PKG_URL="http://amlinux.ru/source/$PKG_NAME-$PKG_VERSION.tar.gz" + arm64) + PKG_VERSION="bb19db7" + PKG_SHA256="81f78b37f2c14313b68cad5c43237dc3a217afaaad4f41e07a840e26673309c4" + PKG_URL="https://github.com/surkovalex/libamcodec/archive/$PKG_VERSION.tar.gz" ;; esac PKG_DEPENDS_TARGET="toolchain alsa-lib" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libamcodec: Interface library for Amlogic media codecs" PKG_LONGDESC="libamplayer: Interface library for Amlogic media codecs" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +post_unpack() { + sed -e "s|-lamadec||g" -i $PKG_BUILD/amcodec/Makefile +} make_target() { - make -C amavutils CC="$CC" PREFIX="$SYSROOT_PREFIX/usr" mkdir -p $SYSROOT_PREFIX/usr/lib - cp -PR amavutils/*.so $SYSROOT_PREFIX/usr/lib - - make -C amadec CC="$CC" PREFIX="$SYSROOT_PREFIX/usr" CROSS_PREFIX="$TARGET_PREFIX" install - make -C amcodec CC="$CC" HEADERS_DIR="$SYSROOT_PREFIX/usr/include/amcodec" PREFIX="$SYSROOT_PREFIX/usr" CROSS_PREFIX="$TARGET_PREFIX" install + make -C amcodec HEADERS_DIR="$SYSROOT_PREFIX/usr/include/amcodec" PREFIX="$SYSROOT_PREFIX/usr" install } makeinstall_target() { mkdir -p $INSTALL/usr/lib - cp -PR amavutils/*.so $INSTALL/usr/lib - - make -C amadec PREFIX="$INSTALL/usr" install make -C amcodec HEADERS_DIR="$INSTALL/usr/include/amcodec" PREFIX="$INSTALL/usr" install } diff --git a/packages/multimedia/libass/package.mk b/packages/multimedia/libass/package.mk index 96161d2dfd..693f5adf36 100644 --- a/packages/multimedia/libass/package.mk +++ b/packages/multimedia/libass/package.mk @@ -1,43 +1,23 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libass" -PKG_VERSION="0.13.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.14.0" +PKG_SHA256="881f2382af48aead75b7a0e02e65d88c5ebd369fe46bc77d9270a94aa8fd38a2" PKG_LICENSE="BSD" PKG_SITE="https://github.com/libass/libass" PKG_URL="https://github.com/libass/libass/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain freetype fontconfig fribidi" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libass: a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format." -PKG_LONGDESC="libass is a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format. It is mostly compatible with VSFilter" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain freetype fontconfig fribidi harfbuzz" +PKG_LONGDESC="A portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format." PKG_CONFIGURE_OPTS_TARGET="--disable-test \ --enable-fontconfig \ - --disable-harfbuzz \ + --enable-harfbuzz \ --disable-silent-rules \ --with-gnu-ld" if [ $TARGET_ARCH = "x86_64" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET yasm:host" - PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_TARGET --enable-asm" + PKG_DEPENDS_TARGET+=" nasm:host" + PKG_CONFIGURE_OPTS_TARGET+=" --enable-asm" fi diff --git a/packages/multimedia/libbdplus/package.mk b/packages/multimedia/libbdplus/package.mk index 35897f677f..40f8044f02 100644 --- a/packages/multimedia/libbdplus/package.mk +++ b/packages/multimedia/libbdplus/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libbdplus" PKG_VERSION="0.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="a631cae3cd34bf054db040b64edbfc8430936e762eb433b1789358ac3d3dc80a" PKG_LICENSE="GPL" PKG_SITE="https://www.videolan.org/developers/libbdplus.html" -PKG_URL="https://ftp.videolan.org/pub/videolan/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="http://download.videolan.org/pub/videolan/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libgcrypt libgpg-error" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libbdplus: A project to implement the BD+ System Specifications" PKG_LONGDESC="libbdplus is a research project to implement the BD+ System Specifications." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--disable-werror \ --disable-extra-warnings \ --disable-optimizations \ diff --git a/packages/multimedia/libbluray/package.mk b/packages/multimedia/libbluray/package.mk index 53fc8426f9..b1fd2ac442 100644 --- a/packages/multimedia/libbluray/package.mk +++ b/packages/multimedia/libbluray/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libbluray" -PKG_VERSION="0.9.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" +PKG_VERSION="1.0.2" +PKG_SHA256="6d9e7c4e416f664c330d9fa5a05ad79a3fb39b95adfc3fd6910cbed503b7aeff" +PKG_LICENSE="LGPL" PKG_SITE="https://www.videolan.org/developers/libbluray.html" -PKG_URL="https://ftp.videolan.org/pub/videolan/libbluray/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="http://download.videolan.org/pub/videolan/libbluray/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain fontconfig freetype libxml2" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libbluray: A Blu-Ray Discs playback library" -PKG_LONGDESC="libbluray is an open-source library designed for Blu-Ray Discs playback for media players, like VLC or MPlayer." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="libbluray is an open-source library designed for Blu-Ray Discs playback for media players." +PKG_TOOLCHAIN="autotools" if [ "$BLURAY_AACS_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libaacs" @@ -43,8 +24,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-werror \ --disable-extra-warnings \ --disable-optimizations \ --disable-examples \ - --disable-bdjava \ - --enable-udf \ + --disable-bdjava-jar \ --disable-doxygen-doc \ --disable-doxygen-dot \ --disable-doxygen-man \ diff --git a/packages/multimedia/libbluray/patches/libbluray-00-fix-build-with-autoconf-archive-2016-or-later.patch b/packages/multimedia/libbluray/patches/libbluray-00-fix-build-with-autoconf-archive-2016-or-later.patch new file mode 100644 index 0000000000..56a4a999a4 --- /dev/null +++ b/packages/multimedia/libbluray/patches/libbluray-00-fix-build-with-autoconf-archive-2016-or-later.patch @@ -0,0 +1,30 @@ +From bc746413e07c504535873cf860a8f2c38862896e Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 1 Feb 2018 08:15:27 +0000 +Subject: [PATCH] Fix build failure with recent ax_prog_doxygen.m4 + +Recent autotool-archives doxygen macros breaks the current build, +so this patch updates to the method of the latest autoconf-archive version. + +The required autoconf-archive macro has been committed to their repository +in November 2015, so anything later should work. + +Ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837020 +--- + Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 33813b0..f92e741 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,4 +1,5 @@ +-include $(top_srcdir)/doxygen-include.am ++# include Doxygen rules (requires autoconf-archive >2016-03-20) ++@DX_RULES@ + + ACLOCAL_AMFLAGS = -I m4 + +-- +2.14.1 + diff --git a/packages/multimedia/libbluray/patches/libbluray-01-bump_to_Nevcairie_v0.9.2.patch b/packages/multimedia/libbluray/patches/libbluray-01-bump_to_Nevcairie_v0.9.2.patch deleted file mode 100644 index fbe18b05c9..0000000000 --- a/packages/multimedia/libbluray/patches/libbluray-01-bump_to_Nevcairie_v0.9.2.patch +++ /dev/null @@ -1,1630 +0,0 @@ -diff --git a/Makefile.am b/Makefile.am -index 3a54bfc..035553b 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -161,6 +161,15 @@ noinst_HEADERS = \ - jni/win32/jni_md.h \ - jni/darwin/jni_md.h - -+ -+bdnavdir=$(pkgincludedir)/bdnav -+bdnav_HEADERS = \ -+ src/libbluray/bdnav/clpi_data.h -+ -+utildir=$(pkgincludedir)/../util -+util_HEADERS = \ -+ src/util/attributes.h -+ - pkginclude_HEADERS = \ - src/file/filesystem.h \ - src/libbluray/bluray.h \ -@@ -168,6 +177,9 @@ pkginclude_HEADERS = \ - src/libbluray/keys.h \ - src/libbluray/player_settings.h \ - src/libbluray/bdnav/clpi_data.h \ -+ src/libbluray/bdnav/clpi_parse.h \ -+ src/libbluray/bdnav/mpls_parse.h \ -+ src/libbluray/bdnav/uo_mask_table.h \ - src/libbluray/bdnav/meta_data.h \ - src/libbluray/decoders/overlay.h \ - src/util/log_control.h -diff --git a/config.h b/config.h -new file mode 100644 -index 0000000..6764704 ---- /dev/null -+++ b/config.h -@@ -0,0 +1,157 @@ -+/* config.h. Generated from config.h.in by configure. */ -+/* config.h.in. Generated from configure.ac by autoheader. */ -+ -+/* Define to 1 if libudfread is to be used for disc image access */ -+/* #undef ENABLE_UDF */ -+ -+/* Define to 1 if using libbluray J2ME stack */ -+/* #undef HAVE_BDJ_J2ME */ -+ -+/* Define to 1 if you have the header file, and it defines `DIR'. -+ */ -+/* #undef HAVE_DIRENT_H */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_DLFCN_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_ERRNO_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_FCNTL_H */ -+ -+/* Define this if you have fontconfig library */ -+/* #undef HAVE_FONTCONFIG */ -+ -+/* Define this if you have FreeType2 library */ -+/* #undef HAVE_FT2 */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_INTTYPES_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_JNI_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_LIBGEN_H 1 -+ -+/* Define to 1 if libxml2 is to be used for metadata parsing */ -+/* #undef HAVE_LIBXML2 */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_LINUX_CDROM_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_MALLOC_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_MEMORY_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_MNTENT_H */ -+ -+/* Define to 1 if you have the header file, and it defines `DIR'. */ -+/* #undef HAVE_NDIR_H */ -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_PTHREAD_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_STDARG_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_STDINT_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_STDLIB_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_STRINGS_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_STRING_H 1 -+ -+/* Define to 1 if `d_type' is a member of `struct dirent'. */ -+/* #undef HAVE_STRUCT_DIRENT_D_TYPE */ -+ -+/* Define to 1 if you have the header file, and it defines `DIR'. -+ */ -+/* #undef HAVE_SYS_DIR_H */ -+ -+/* Define to 1 if you have the header file, and it defines `DIR'. -+ */ -+/* #undef HAVE_SYS_NDIR_H */ -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_SYS_STAT_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_SYS_TIME_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_SYS_TYPES_H 1 -+ -+/* Define to 1 if you have the header file. */ -+#define HAVE_TIME_H 1 -+ -+/* Define to 1 if you have the header file. */ -+/* #undef HAVE_UNISTD_H */ -+ -+/* "Defines the architecture of the java vm." */ -+/* #undef JAVA_ARCH */ -+ -+/* "" */ -+/* #undef JDK_HOME */ -+ -+/* Define to the sub-directory where libtool stores uninstalled libraries. */ -+#define LT_OBJDIR ".libs/" -+ -+/* Name of package */ -+#define PACKAGE "libbluray" -+ -+/* Define to the address where bug reports for this package should be sent. */ -+#define PACKAGE_BUGREPORT "http://www.videolan.org/developers/libbluray.html" -+ -+/* Define to the full name of this package. */ -+#define PACKAGE_NAME "libbluray" -+ -+/* Define to the full name and version of this package. */ -+#define PACKAGE_STRING "libbluray 0.9.2" -+ -+/* Define to the one symbol short name of this package. */ -+#define PACKAGE_TARNAME "libbluray" -+ -+/* Define to the home page for this package. */ -+#define PACKAGE_URL "" -+ -+/* Define to the version of this package. */ -+#define PACKAGE_VERSION "0.9.2" -+ -+/* Define as the return type of signal handlers (`int' or `void'). */ -+#define RETSIGTYPE void -+ -+/* Define to 1 if you have the ANSI C header files. */ -+#define STDC_HEADERS 1 -+ -+/* "Define to 1 if using BD-Java" */ -+/* #undef USING_BDJAVA */ -+ -+/* Version number of package */ -+#define VERSION "0.9.2" -+ -+/* Enable large inode numbers on Mac OS X 10.5. */ -+#ifndef _DARWIN_USE_64_BIT_INODE -+# define _DARWIN_USE_64_BIT_INODE 1 -+#endif -+ -+/* Number of bits in a file offset, on hosts where this is settable. */ -+#define _FILE_OFFSET_BITS 64 -+ -+/* Define for large files, on AIX-style hosts. */ -+/* #undef _LARGE_FILES */ -+ -+/* Define to '0x0501' for IE 5.01. */ -+#define _WIN32_IE 0x0501 -+ -+/* Define to '0x0502' for Windows XP SP2 APIs. */ -+#define _WIN32_WINNT 0x0502 -diff --git a/includes/inttypes.h b/includes/inttypes.h -new file mode 100644 -index 0000000..ead903f ---- /dev/null -+++ b/includes/inttypes.h -@@ -0,0 +1,305 @@ -+// ISO C9x compliant inttypes.h for Microsoft Visual Studio -+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -+// -+// Copyright (c) 2006 Alexander Chemeris -+// -+// Redistribution and use in source and binary forms, with or without -+// modification, are permitted provided that the following conditions are met: -+// -+// 1. Redistributions of source code must retain the above copyright notice, -+// this list of conditions and the following disclaimer. -+// -+// 2. Redistributions in binary form must reproduce the above copyright -+// notice, this list of conditions and the following disclaimer in the -+// documentation and/or other materials provided with the distribution. -+// -+// 3. The name of the author may be used to endorse or promote products -+// derived from this software without specific prior written permission. -+// -+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+// -+/////////////////////////////////////////////////////////////////////////////// -+ -+#ifndef _MSC_VER // [ -+#error "Use this header only with Microsoft Visual C++ compilers!" -+#endif // _MSC_VER ] -+ -+#ifndef _MSC_INTTYPES_H_ // [ -+#define _MSC_INTTYPES_H_ -+ -+#if _MSC_VER > 1000 -+#pragma once -+#endif -+ -+#include "stdint.h" -+ -+// 7.8 Format conversion of integer types -+ -+typedef struct { -+ intmax_t quot; -+ intmax_t rem; -+} imaxdiv_t; -+ -+// 7.8.1 Macros for format specifiers -+ -+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 -+ -+// The fprintf macros for signed integers are: -+#define PRId8 "d" -+#define PRIi8 "i" -+#define PRIdLEAST8 "d" -+#define PRIiLEAST8 "i" -+#define PRIdFAST8 "d" -+#define PRIiFAST8 "i" -+ -+#define PRId16 "hd" -+#define PRIi16 "hi" -+#define PRIdLEAST16 "hd" -+#define PRIiLEAST16 "hi" -+#define PRIdFAST16 "hd" -+#define PRIiFAST16 "hi" -+ -+#define PRId32 "I32d" -+#define PRIi32 "I32i" -+#define PRIdLEAST32 "I32d" -+#define PRIiLEAST32 "I32i" -+#define PRIdFAST32 "I32d" -+#define PRIiFAST32 "I32i" -+ -+#define PRId64 "I64d" -+#define PRIi64 "I64i" -+#define PRIdLEAST64 "I64d" -+#define PRIiLEAST64 "I64i" -+#define PRIdFAST64 "I64d" -+#define PRIiFAST64 "I64i" -+ -+#define PRIdMAX "I64d" -+#define PRIiMAX "I64i" -+ -+#define PRIdPTR "Id" -+#define PRIiPTR "Ii" -+ -+// The fprintf macros for unsigned integers are: -+#define PRIo8 "o" -+#define PRIu8 "u" -+#define PRIx8 "x" -+#define PRIX8 "X" -+#define PRIoLEAST8 "o" -+#define PRIuLEAST8 "u" -+#define PRIxLEAST8 "x" -+#define PRIXLEAST8 "X" -+#define PRIoFAST8 "o" -+#define PRIuFAST8 "u" -+#define PRIxFAST8 "x" -+#define PRIXFAST8 "X" -+ -+#define PRIo16 "ho" -+#define PRIu16 "hu" -+#define PRIx16 "hx" -+#define PRIX16 "hX" -+#define PRIoLEAST16 "ho" -+#define PRIuLEAST16 "hu" -+#define PRIxLEAST16 "hx" -+#define PRIXLEAST16 "hX" -+#define PRIoFAST16 "ho" -+#define PRIuFAST16 "hu" -+#define PRIxFAST16 "hx" -+#define PRIXFAST16 "hX" -+ -+#define PRIo32 "I32o" -+#define PRIu32 "I32u" -+#define PRIx32 "I32x" -+#define PRIX32 "I32X" -+#define PRIoLEAST32 "I32o" -+#define PRIuLEAST32 "I32u" -+#define PRIxLEAST32 "I32x" -+#define PRIXLEAST32 "I32X" -+#define PRIoFAST32 "I32o" -+#define PRIuFAST32 "I32u" -+#define PRIxFAST32 "I32x" -+#define PRIXFAST32 "I32X" -+ -+#define PRIo64 "I64o" -+#define PRIu64 "I64u" -+#define PRIx64 "I64x" -+#define PRIX64 "I64X" -+#define PRIoLEAST64 "I64o" -+#define PRIuLEAST64 "I64u" -+#define PRIxLEAST64 "I64x" -+#define PRIXLEAST64 "I64X" -+#define PRIoFAST64 "I64o" -+#define PRIuFAST64 "I64u" -+#define PRIxFAST64 "I64x" -+#define PRIXFAST64 "I64X" -+ -+#define PRIoMAX "I64o" -+#define PRIuMAX "I64u" -+#define PRIxMAX "I64x" -+#define PRIXMAX "I64X" -+ -+#define PRIoPTR "Io" -+#define PRIuPTR "Iu" -+#define PRIxPTR "Ix" -+#define PRIXPTR "IX" -+ -+// The fscanf macros for signed integers are: -+#define SCNd8 "d" -+#define SCNi8 "i" -+#define SCNdLEAST8 "d" -+#define SCNiLEAST8 "i" -+#define SCNdFAST8 "d" -+#define SCNiFAST8 "i" -+ -+#define SCNd16 "hd" -+#define SCNi16 "hi" -+#define SCNdLEAST16 "hd" -+#define SCNiLEAST16 "hi" -+#define SCNdFAST16 "hd" -+#define SCNiFAST16 "hi" -+ -+#define SCNd32 "ld" -+#define SCNi32 "li" -+#define SCNdLEAST32 "ld" -+#define SCNiLEAST32 "li" -+#define SCNdFAST32 "ld" -+#define SCNiFAST32 "li" -+ -+#define SCNd64 "I64d" -+#define SCNi64 "I64i" -+#define SCNdLEAST64 "I64d" -+#define SCNiLEAST64 "I64i" -+#define SCNdFAST64 "I64d" -+#define SCNiFAST64 "I64i" -+ -+#define SCNdMAX "I64d" -+#define SCNiMAX "I64i" -+ -+#ifdef _WIN64 // [ -+# define SCNdPTR "I64d" -+# define SCNiPTR "I64i" -+#else // _WIN64 ][ -+# define SCNdPTR "ld" -+# define SCNiPTR "li" -+#endif // _WIN64 ] -+ -+// The fscanf macros for unsigned integers are: -+#define SCNo8 "o" -+#define SCNu8 "u" -+#define SCNx8 "x" -+#define SCNX8 "X" -+#define SCNoLEAST8 "o" -+#define SCNuLEAST8 "u" -+#define SCNxLEAST8 "x" -+#define SCNXLEAST8 "X" -+#define SCNoFAST8 "o" -+#define SCNuFAST8 "u" -+#define SCNxFAST8 "x" -+#define SCNXFAST8 "X" -+ -+#define SCNo16 "ho" -+#define SCNu16 "hu" -+#define SCNx16 "hx" -+#define SCNX16 "hX" -+#define SCNoLEAST16 "ho" -+#define SCNuLEAST16 "hu" -+#define SCNxLEAST16 "hx" -+#define SCNXLEAST16 "hX" -+#define SCNoFAST16 "ho" -+#define SCNuFAST16 "hu" -+#define SCNxFAST16 "hx" -+#define SCNXFAST16 "hX" -+ -+#define SCNo32 "lo" -+#define SCNu32 "lu" -+#define SCNx32 "lx" -+#define SCNX32 "lX" -+#define SCNoLEAST32 "lo" -+#define SCNuLEAST32 "lu" -+#define SCNxLEAST32 "lx" -+#define SCNXLEAST32 "lX" -+#define SCNoFAST32 "lo" -+#define SCNuFAST32 "lu" -+#define SCNxFAST32 "lx" -+#define SCNXFAST32 "lX" -+ -+#define SCNo64 "I64o" -+#define SCNu64 "I64u" -+#define SCNx64 "I64x" -+#define SCNX64 "I64X" -+#define SCNoLEAST64 "I64o" -+#define SCNuLEAST64 "I64u" -+#define SCNxLEAST64 "I64x" -+#define SCNXLEAST64 "I64X" -+#define SCNoFAST64 "I64o" -+#define SCNuFAST64 "I64u" -+#define SCNxFAST64 "I64x" -+#define SCNXFAST64 "I64X" -+ -+#define SCNoMAX "I64o" -+#define SCNuMAX "I64u" -+#define SCNxMAX "I64x" -+#define SCNXMAX "I64X" -+ -+#ifdef _WIN64 // [ -+# define SCNoPTR "I64o" -+# define SCNuPTR "I64u" -+# define SCNxPTR "I64x" -+# define SCNXPTR "I64X" -+#else // _WIN64 ][ -+# define SCNoPTR "lo" -+# define SCNuPTR "lu" -+# define SCNxPTR "lx" -+# define SCNXPTR "lX" -+#endif // _WIN64 ] -+ -+#endif // __STDC_FORMAT_MACROS ] -+ -+// 7.8.2 Functions for greatest-width integer types -+ -+// 7.8.2.1 The imaxabs function -+#define imaxabs _abs64 -+ -+// 7.8.2.2 The imaxdiv function -+ -+// This is modified version of div() function from Microsoft's div.c found -+// in %MSVC.NET%\crt\src\div.c -+#ifdef STATIC_IMAXDIV // [ -+static -+#else // STATIC_IMAXDIV ][ -+_inline -+#endif // STATIC_IMAXDIV ] -+imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -+{ -+ imaxdiv_t result; -+ -+ result.quot = numer / denom; -+ result.rem = numer % denom; -+ -+ if (numer < 0 && result.rem > 0) { -+ // did division wrong; must fix up -+ ++result.quot; -+ result.rem -= denom; -+ } -+ -+ return result; -+} -+ -+// 7.8.2.3 The strtoimax and strtoumax functions -+#define strtoimax _strtoi64 -+#define strtoumax _strtoui64 -+ -+// 7.8.2.4 The wcstoimax and wcstoumax functions -+#define wcstoimax _wcstoi64 -+#define wcstoumax _wcstoui64 -+ -+ -+#endif // _MSC_INTTYPES_H_ ] -diff --git a/libbluray.def b/libbluray.def -new file mode 100644 -index 0000000..d4c93cb ---- /dev/null -+++ b/libbluray.def -@@ -0,0 +1,63 @@ -+; libbluray.def ; declares the exports -+ -+LIBRARY "libbluray.dll" -+ -+EXPORTS -+ ; bluray.h -+ bd_get_version -+ bd_get_titles -+ bd_get_title_info -+ bd_get_playlist_info -+ bd_free_title_info -+ bd_open -+ bd_close -+ bd_seek -+ bd_seek_time -+ bd_find_seek_point -+ bd_read -+ bd_read_skip_still -+ bd_seek_chapter -+ bd_chapter_pos -+ bd_get_current_chapter -+ bd_seek_mark -+ bd_seek_playitem -+ bd_select_playlist -+ bd_select_title -+ bd_select_angle -+ bd_seamless_angle_change -+ bd_get_title_size -+ bd_get_current_title -+ bd_get_current_angle -+ bd_tell -+ bd_tell_time -+ bd_get_disc_info -+ bd_set_player_setting -+ bd_set_player_setting_str -+ bd_start_bdj -+ bd_stop_bdj -+ bd_get_event -+ bd_play -+ bd_read_ext -+ bd_play_title -+ bd_menu_call -+ bd_register_overlay_proc -+ bd_register_argb_overlay_proc -+ bd_set_scr -+ bd_user_input -+ bd_mouse_select -+ bd_get_sound_effect -+ bd_get_meta -+ bd_get_clpi -+ bd_read_clpi -+ bd_free_clpi -+ bd_read_mpls -+ bd_free_mpls -+ bd_read_mobj -+ bd_free_mobj -+ bd_get_clip_infos -+ bd_get_title_mpls -+ -+ ; additional functions -+ bd_set_debug_handler -+ bd_set_debug_mask -+ bd_get_debug_mask -diff --git a/libbluray.vcxproj b/libbluray.vcxproj -new file mode 100644 -index 0000000..c778955 ---- /dev/null -+++ b/libbluray.vcxproj -@@ -0,0 +1,231 @@ -+ -+ -+ -+ -+ DebugRelease -+ Win32 -+ -+ -+ DebugRelease -+ x64 -+ -+ -+ Debug -+ Win32 -+ -+ -+ Debug -+ x64 -+ -+ -+ Release -+ Win32 -+ -+ -+ Release -+ x64 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ {E1DA1B95-71F1-4C21-A271-121176925062} -+ Win32Proj -+ libbluray -+ -+ -+ -+ v110_xp -+ -+ -+ v120_xp -+ -+ -+ v140_xp -+ -+ -+ DynamicLibrary -+ true -+ Unicode -+ -+ -+ DynamicLibrary -+ false -+ true -+ Unicode -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ true -+ $(SolutionDir)bin_$(PlatformName)d\ -+ $(SolutionDir)bin_$(PlatformName)d\$(ProjectName)\ -+ -+ -+ false -+ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ -+ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ -+ -+ -+ -+ -+ -+ Level3 -+ Disabled -+ HAVE_CONFIG_H;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -+ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) -+ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) -+ MultiThreadedDebugDLL -+ CompileAsCpp -+ -+ -+ Windows -+ true -+ libbluray.def -+ -+ -+ xcopy /I /Y "$(OutDir)$(TargetName).lib" "$(OutDir)lib\" -+ Copy .lib into library path -+ -+ -+ -+ -+ MultiThreadedDebug -+ -+ -+ -+ -+ Level3 -+ MaxSpeed -+ true -+ true -+ HAVE_CONFIG_H;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -+ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) -+ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) -+ MultiThreaded -+ StreamingSIMDExtensions -+ CompileAsCpp -+ -+ -+ Windows -+ true -+ true -+ true -+ libbluray.def -+ true -+ -+ -+ xcopy /I /Y "$(TargetDir)$(TargetName)$(TargetExt)" "$(OutDir)..\" -+xcopy /I /Y "$(TargetDir)$(TargetName).lib" "$(OutDir)..\lib\" -+ Copy .dll/.lib into library path -+ -+ -+ -+ -+ -+ -\ No newline at end of file -diff --git a/libbluray.vcxproj.filters b/libbluray.vcxproj.filters -new file mode 100644 -index 0000000..57ff16c ---- /dev/null -+++ b/libbluray.vcxproj.filters -@@ -0,0 +1,353 @@ -+ -+ -+ -+ -+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} -+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx -+ -+ -+ {93995380-89BD-4b04-88EB-625FBE52EBFB} -+ h;hpp;hxx;hm;inl;inc;xsd -+ -+ -+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} -+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms -+ -+ -+ {1ab0e905-7c04-4090-b385-6363dd1c961c} -+ -+ -+ {b8fa3348-a089-461f-9ef5-3d9df997b8e5} -+ -+ -+ {125333e9-0b5e-45f9-a444-f0aaaf547d9b} -+ -+ -+ {a743058f-f07a-4d0f-bab6-02dc57defda9} -+ -+ -+ {7dacc7c4-ef59-452b-9e5b-392c9df07c98} -+ -+ -+ {c7895c81-c186-4d5e-a8ff-645c6d55a731} -+ -+ -+ {c8619466-211b-4c85-9d30-d1b1a822d32e} -+ -+ -+ {8afb6919-994f-4d1f-9638-ce4a06d0b473} -+ -+ -+ {0e9086a7-eebf-4b8e-a4fe-b1724d148877} -+ -+ -+ {fc5e776b-0f32-493a-b823-240288288502} -+ -+ -+ {96d2d786-cd45-4856-937d-9e6f85ced241} -+ -+ -+ {9f4ea4ae-217a-4d97-a5f3-e561ce1e49cd} -+ -+ -+ {09e1b1b8-3aa3-4918-b157-3dfc0554ccbb} -+ -+ -+ {1e02e503-752e-4765-9dfb-8cc67a7b79f8} -+ -+ -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\file -+ -+ -+ Header Files\file -+ -+ -+ Header Files\file -+ -+ -+ Header Files\libbluray -+ -+ -+ Header Files\libbluray -+ -+ -+ Header Files\libbluray -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\hdmv -+ -+ -+ Header Files\libbluray\hdmv -+ -+ -+ Header Files\libbluray\hdmv -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\bdnav -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\util -+ -+ -+ Header Files\util -+ -+ -+ Header Files\libbluray -+ -+ -+ Header Files\libbluray\decoders -+ -+ -+ Header Files\file -+ -+ -+ Header Files\libbluray -+ -+ -+ Header Files\util -+ -+ -+ Header Files\libbluray\disc -+ -+ -+ Header Files\libbluray\disc -+ -+ -+ Header Files\libbluray\disc -+ -+ -+ Header Files\libbluray\disc -+ -+ -+ Header Files\libbluray\disc -+ -+ -+ Header Files\file -+ -+ -+ -+ -+ Source Files\util -+ -+ -+ Source Files\util -+ -+ -+ Source Files\file -+ -+ -+ Source Files\libbluray -+ -+ -+ Source Files\libbluray -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\hdmv -+ -+ -+ Source Files\libbluray\hdmv -+ -+ -+ Source Files\libbluray\hdmv -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\libbluray\bdnav -+ -+ -+ Source Files\util -+ -+ -+ Source Files\file -+ -+ -+ Source Files\file -+ -+ -+ Source Files\file -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\util -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\libbluray\decoders -+ -+ -+ Source Files\file -+ -+ -+ Source Files\file -+ -+ -+ Source Files\util -+ -+ -+ Source Files\util -+ -+ -+ Source Files\libbluray\disc -+ -+ -+ Source Files\libbluray\disc -+ -+ -+ Source Files\libbluray\disc -+ -+ -+ Source Files\libbluray\disc -+ -+ -+ Source Files\util -+ -+ -+ Source Files\file -+ -+ -+ -+ -+ Source Files -+ -+ -+ -\ No newline at end of file -diff --git a/src/file/dir_win32.c b/src/file/dir_win32.c -index 2690658..f42114d 100644 ---- a/src/file/dir_win32.c -+++ b/src/file/dir_win32.c -@@ -86,8 +86,8 @@ static BD_DIR_H *_dir_open_win32(const char* dirname) - - dir->internal = priv; - -- wchar_t wfilespec[MAX_PATH]; -- if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, MAX_PATH)) -+ wchar_t wfilespec[4096 + 1] = {0}; -+ if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, 4096)) - priv->handle = _wfindfirst(wfilespec, &priv->info); - else - priv->handle = -1; -diff --git a/src/file/dirs_win32.c b/src/file/dirs_win32.c -index e165fea..3d07251 100644 ---- a/src/file/dirs_win32.c -+++ b/src/file/dirs_win32.c -@@ -36,7 +36,7 @@ - - char *win32_get_font_dir(const char *font_file) - { -- wchar_t wdir[MAX_PATH]; -+ wchar_t wdir[MAX_PATH+1] = {0}; - if (S_OK != SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir)) { - int lenght = GetWindowsDirectoryW(wdir, MAX_PATH); - if (lenght == 0 || lenght > (MAX_PATH - 8)) { -@@ -67,7 +67,7 @@ char *file_get_config_home(void) - - char *file_get_data_home(void) - { -- wchar_t wdir[MAX_PATH]; -+ wchar_t wdir[MAX_PATH+1] = {0}; - - /* Get the "Application Data" folder for the user */ - if (S_OK == SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, -@@ -92,7 +92,7 @@ char *file_get_cache_home(void) - const char *file_get_config_system(const char *dir) - { - static char *appdir = NULL; -- wchar_t wdir[MAX_PATH]; -+ wchar_t wdir[MAX_PATH+1] = {0}; - - if (!dir) { - // first call -diff --git a/src/file/dl_win32.c b/src/file/dl_win32.c -index e4492e1..7f6ae73 100644 ---- a/src/file/dl_win32.c -+++ b/src/file/dl_win32.c -@@ -57,7 +57,7 @@ void *dl_dlopen(const char *path, const char *version) - { - (void)version; - -- wchar_t wname[MAX_PATH]; -+ wchar_t wname[MAX_PATH+1] = {0}; - char *name; - void *result; - -@@ -109,7 +109,7 @@ const char *dl_get_path(void) - if (!initialized) { - initialized = 1; - -- static char path[MAX_PATH]; -+ static char path[MAX_PATH + 1]; - HMODULE hModule; - wchar_t wpath[MAX_PATH]; - -diff --git a/src/file/file_win32.c b/src/file/file_win32.c -index d9845fb..b4fb7ad 100644 ---- a/src/file/file_win32.c -+++ b/src/file/file_win32.c -@@ -107,9 +107,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) - { - BD_FILE_H *file; - FILE *fp; -- wchar_t wfilename[MAX_PATH], wmode[8]; -+ wchar_t wfilename[4096 + 1] = {0}, wmode[8] = {0}; - -- if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, MAX_PATH) || -+ if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, 4096) || - !MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mode, -1, wmode, 8)) { - - BD_DEBUG(DBG_FILE, "Error opening file %s\n", filename); -@@ -122,6 +122,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) - return NULL; - } - -+ // Set file buffer -+ setvbuf(fp, NULL, _IOFBF, 6144 * 10); -+ - file = calloc(1, sizeof(BD_FILE_H)); - if (!file) { - BD_DEBUG(DBG_FILE | DBG_CRIT, "Error opening file %s (out of memory)\n", filename); -diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c -index 394347e..39bbcef 100644 ---- a/src/libbluray/bdnav/clpi_parse.c -+++ b/src/libbluray/bdnav/clpi_parse.c -@@ -39,6 +39,7 @@ - #define CLPI_SIG1 ('H' << 24 | 'D' << 16 | 'M' << 8 | 'V') - #define CLPI_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0') - #define CLPI_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0') -+#define CLPI_SIG2C ('0' << 24 | '2' << 16 | '4' << 8 | '0') - - static void - _human_readable_sig(char *sig, uint32_t s1, uint32_t s2) -@@ -129,7 +130,8 @@ _parse_header(BITSTREAM *bits, CLPI_CL *cl) - cl->type_indicator2 = bs_read(bits, 32); - if (cl->type_indicator != CLPI_SIG1 || - (cl->type_indicator2 != CLPI_SIG2A && -- cl->type_indicator2 != CLPI_SIG2B)) { -+ cl->type_indicator2 != CLPI_SIG2B && -+ cl->type_indicator2 != CLPI_SIG2C)) { - - char sig[9]; - char expect[9]; -diff --git a/src/libbluray/bdnav/mpls_parse.c b/src/libbluray/bdnav/mpls_parse.c -index e196118..87b240a 100644 ---- a/src/libbluray/bdnav/mpls_parse.c -+++ b/src/libbluray/bdnav/mpls_parse.c -@@ -39,6 +39,7 @@ - #define MPLS_SIG1 ('M' << 24 | 'P' << 16 | 'L' << 8 | 'S') - #define MPLS_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0') - #define MPLS_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0') -+#define MPLS_SIG2C ('0' << 24 | '2' << 16 | '4' << 8 | '0') - - static void - _human_readable_sig(char *sig, uint32_t s1, uint32_t s2) -@@ -137,8 +138,9 @@ _parse_appinfo(BITSTREAM *bits, MPLS_AI *ai) - ai->random_access_flag = bs_read(bits, 1); - ai->audio_mix_flag = bs_read(bits, 1); - ai->lossless_bypass_flag = bs_read(bits, 1); -+ ai->mvc_base_view_r_flag = bs_read(bits, 1); - // Reserved -- bs_skip(bits, 13); -+ bs_skip(bits, 12); - bs_seek_byte(bits, pos + len); - return 1; - } -@@ -155,7 +157,8 @@ _parse_header(BITSTREAM *bits, MPLS_PL *pl) - pl->type_indicator2 = bs_read(bits, 32); - if (pl->type_indicator != MPLS_SIG1 || - (pl->type_indicator2 != MPLS_SIG2A && -- pl->type_indicator2 != MPLS_SIG2B)) { -+ pl->type_indicator2 != MPLS_SIG2B && -+ pl->type_indicator2 != MPLS_SIG2C)) { - - char sig[9]; - char expect[9]; -@@ -259,6 +262,7 @@ _parse_stream(BITSTREAM *bits, MPLS_STREAM *s) - break; - }; - s->lang[3] = '\0'; -+ s->ss_offset_sequence_id = 0xFF; - - bs_seek_byte(bits, pos + len); - return 1; -@@ -882,6 +886,99 @@ _parse_subpath_extension(BITSTREAM *bits, MPLS_PL *pl) - } - - static int -+_parse_stn_ss_extension(BITSTREAM *bits, MPLS_PL *pl) -+{ -+ int ii, s; -+ int64_t pos; -+ -+ for (ii = 0; ii < pl->list_count; ii++) { -+ uint32_t len = bs_read(bits, 16); -+ pos = bs_pos(bits) >> 3; -+ int Fixed_offset_during_PopUp_flag = bs_read(bits, 1); -+ bs_skip(bits, 15); // reserved -+ -+ for (s = 0; s < pl->play_item[ii].stn.num_video; s++) { -+ // stream_entry -+ uint32_t slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ // stream_attributes_ss -+ slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ bs_skip(bits, 10); // reserved -+ bs_skip(bits, 6); // number_of_offset_sequences -+ } -+ -+ for (s = 0; s < pl->play_item[ii].stn.num_pg; s++) { -+ pl->play_item[ii].stn.pg[s].ss_offset_sequence_id = bs_read(bits, 8); -+ -+ bs_skip(bits, 4); // reserved -+ bs_skip(bits, 1); // dialog_region_offset_valid_flag -+ int is_SS_PG = bs_read(bits, 1); -+ int is_top_AS_PG_textST = bs_read(bits, 1); -+ int is_bottom_AS_PG_textST = bs_read(bits, 1); -+ if (is_SS_PG) { -+ // stream_entry left eye -+ uint32_t slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ // stream_entry right eye -+ slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ bs_skip(bits, 8); // reserved -+ bs_skip(bits, 8); // PG offset -+ } -+ if (is_top_AS_PG_textST) { -+ // stream_entry -+ uint32_t slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ bs_skip(bits, 8); // reserved -+ bs_skip(bits, 8); // PG offset -+ } -+ if (is_bottom_AS_PG_textST) { -+ // stream_entry -+ uint32_t slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ bs_skip(bits, 8); // reserved -+ bs_skip(bits, 8); // PG offset -+ } -+ } -+ -+ for (s = 0; s < pl->play_item[ii].stn.num_ig; s++) { -+ if (Fixed_offset_during_PopUp_flag) -+ bs_skip(bits, 8); -+ else -+ pl->play_item[ii].stn.ig[s].ss_offset_sequence_id = bs_read(bits, 8); -+ -+ bs_skip(bits, 16); // IG_Plane_offset_during_BB_video -+ bs_skip(bits, 7); // reserved -+ int is_SS_IG = bs_read(bits, 1); -+ if (is_SS_IG) { -+ // stream_entry left eye -+ uint32_t slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ // stream_entry right eye -+ slen = bs_read(bits, 8); -+ bs_skip(bits, slen * 8); -+ -+ bs_skip(bits, 8); // reserved -+ bs_skip(bits, 8); // PG offset -+ } -+ } -+ -+ // Skip to next play item -+ bs_seek_byte(bits, pos + len); -+ } -+ -+ return 0; -+} -+ -+static int - _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) - { - MPLS_PL *pl = (MPLS_PL*)handle; -@@ -895,7 +992,7 @@ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) - - if (id1 == 2) { - if (id2 == 1) { -- return 0; -+ return _parse_stn_ss_extension(bits, pl); - } - if (id2 == 2) { - // SubPath entries extension -diff --git a/src/libbluray/bdnav/mpls_parse.h b/src/libbluray/bdnav/mpls_parse.h -index 94bfa67..c1b2c31 100644 ---- a/src/libbluray/bdnav/mpls_parse.h -+++ b/src/libbluray/bdnav/mpls_parse.h -@@ -49,6 +49,7 @@ typedef struct - uint8_t sv_num_pip_pg_ref; - uint8_t *sv_secondary_audio_ref; - uint8_t *sv_pip_pg_ref; -+ uint8_t ss_offset_sequence_id; - } MPLS_STREAM; - - typedef struct -@@ -109,6 +110,7 @@ typedef struct - uint8_t random_access_flag; - uint8_t audio_mix_flag; - uint8_t lossless_bypass_flag; -+ uint8_t mvc_base_view_r_flag; - } MPLS_AI; - - typedef struct -diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c -index 0e60b68..f633d7a 100644 ---- a/src/libbluray/bluray.c -+++ b/src/libbluray/bluray.c -@@ -1626,6 +1626,25 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick) - return bd->s_pos; - } - -+int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick) -+{ -+ uint32_t clip_pkt, out_pkt; -+ NAV_CLIP *clip; -+ -+ tick /= 2; -+ -+ if (bd->title && -+ tick < bd->title->duration) { -+ -+ // Find the closest access unit to the requested position -+ clip = nav_time_search(bd->title, (uint32_t)tick, &clip_pkt, &out_pkt); -+ -+ return (int64_t)out_pkt * 192; -+ } -+ -+ return bd->s_pos; -+} -+ - uint64_t bd_tell_time(BLURAY *bd) - { - uint32_t clip_pkt = 0, out_pkt = 0, out_time = 0; -@@ -2602,6 +2621,7 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, - BLURAY_CLIP_INFO *ci = &title_info->clips[ii]; - NAV_CLIP *nc = &title->clip_list.clip[ii]; - -+ ci->idx = nc->clip_id; - ci->pkt_count = nc->end_pkt - nc->start_pkt; - ci->start_time = (uint64_t)nc->title_time * 2; - ci->in_time = (uint64_t)pi->in_time * 2; -@@ -2628,6 +2648,8 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, - _copy_streams(nc, ci->sec_audio_streams, pi->stn.secondary_audio, ci->sec_audio_stream_count); - } - -+ title_info->mvc_base_view_r_flag = title->pl->app_info.mvc_base_view_r_flag; -+ - return title_info; - } - -@@ -3746,3 +3768,28 @@ void bd_free_bdjo(struct bdjo_data *obj) - (void)obj; - #endif - } -+ -+int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration) -+{ -+ if (bd && bd->title && bd->title->clip_list.count > clip) { -+ if (clip_start_time) -+ *clip_start_time = (uint64_t)bd->title->clip_list.clip[clip].title_time << 1; -+ if (stream_start_time) -+ *stream_start_time = (uint64_t)bd->title->clip_list.clip[clip].in_time << 1; -+ if (pos) -+ *pos = (uint64_t)bd->title->clip_list.clip[clip].title_pkt * 192; -+ if (duration) -+ *duration = (uint64_t)bd->title->clip_list.clip[clip].duration << 1; -+ -+ return 1; -+ } -+ return 0; -+} -+ -+struct mpls_pl* bd_get_title_mpls(BLURAY * bd) -+{ -+ if (bd && bd->title) { -+ return bd->title->pl; -+ } -+ return NULL; -+} -diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h -index cbf16fc..97dc1a3 100644 ---- a/src/libbluray/bluray.h -+++ b/src/libbluray/bluray.h -@@ -32,6 +32,7 @@ extern "C" { - */ - - #include -+#include "bdnav/clpi_data.h" - - #define TITLES_ALL 0 /**< all titles. */ - #define TITLES_FILTER_DUP_TITLE 0x01 /**< remove duplicate titles. */ -@@ -225,6 +226,7 @@ typedef struct bd_stream_info { - } BLURAY_STREAM_INFO; - - typedef struct bd_clip { -+ uint32_t idx; - uint32_t pkt_count; - uint8_t still_mode; - uint16_t still_time; /* seconds */ -@@ -275,6 +277,8 @@ typedef struct bd_title_info { - - uint32_t mark_count; - BLURAY_TITLE_MARK *marks; -+ -+ uint8_t mvc_base_view_r_flag; - } BLURAY_TITLE_INFO; - - /* -@@ -483,6 +487,16 @@ uint32_t bd_get_current_title(BLURAY *bd); - - /** - * -+ * Find the byte position to specific time in 90Khz ticks -+ * -+ * @param bd BLURAY ojbect -+ * @param tick tick count -+ * @return byte position -+ */ -+int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick); -+ -+/** -+ * - * Read from currently selected title file, decrypt if possible - * - * @param bd BLURAY object -@@ -1007,7 +1021,6 @@ int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y); - - /* access to internal information */ - --struct clpi_cl; - /** - * - * Get copy of clip information for requested playitem. -@@ -1060,6 +1073,28 @@ void bd_stop_bdj(BLURAY *bd); // shutdown BD-J and clean up resources - */ - int bd_read_file(BLURAY *, const char *path, void **data, int64_t *size); - -+/** -+ * -+ * Get information about the clip -+ * -+ * @param bd BLURAY object -+ * @param clip clip index -+ * @param clip_start_time start of the clip (in the total title) (in 90khz) -+ * @param stream_start_time first pts in the clip (in 90khz) -+ * @param byte position of the clip (absolute) -+ * @param duration duration of the clip (in 90khz) -+ */ -+int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration); -+ -+/** -+ * Get the MPLS struct of the current title -+ * -+ * @param bd BLURAY object -+ * @return the MPLS struct -+ * -+ * Lifetime of the MPLS pointer is limited to the lifetime of the BD title -+ */ -+struct mpls_pl* bd_get_title_mpls(BLURAY * bd); - - #ifdef __cplusplus - } -diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c -index defa084..375e6c3 100644 ---- a/src/libbluray/disc/disc.c -+++ b/src/libbluray/disc/disc.c -@@ -69,7 +69,7 @@ static BD_FILE_H *_bdrom_open_path(void *p, const char *rel_path) - return NULL; - } - -- fp = file_open(abs_path, "rb"); -+ fp = file_open(abs_path, "rbS"); - X_FREE(abs_path); - - return fp; - diff --git a/packages/multimedia/libbluray/patches/libbluray-01-bump_to_Nevcairiel_vL20170904.patch b/packages/multimedia/libbluray/patches/libbluray-01-bump_to_Nevcairiel_vL20170904.patch new file mode 100644 index 0000000000..2111faef57 --- /dev/null +++ b/packages/multimedia/libbluray/patches/libbluray-01-bump_to_Nevcairiel_vL20170904.patch @@ -0,0 +1,2247 @@ +diff --git a/Makefile.am b/Makefile.am +index 04365fd..ff15527 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,10 +1,15 @@ + include $(top_srcdir)/doxygen-include.am + + ACLOCAL_AMFLAGS = -I m4 ++DISTCHECK_CONFIGURE_FLAGS = --enable-bdjava --enable-udf + + MOSTLYCLEANFILES = $(DX_CLEANFILES) + ++if ENABLE_UDF + POSIX_C_SOURCE=200809L ++else ++POSIX_C_SOURCE=200112L ++endif + + EXTRA_DIST = \ + bootstrap \ +@@ -35,7 +40,7 @@ libbluray_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_builddir)/src/libbluray \ + $(BDJAVA_CFLAGS) \ +- -I${top_srcdir}/contrib/libudfread/src/ \ ++ $(UDF_CFLAGS) \ + $(LIBXML2_CFLAGS) \ + $(FT2_CFLAGS) \ + $(FONTCONFIG_CFLAGS) +@@ -166,6 +171,7 @@ libbluray_la_SOURCES += \ + src/libbluray/bdj/native/util.c + + # libudfread ++if ENABLE_UDF + libbluray_la_SOURCES += \ + src/libbluray/disc/udf_fs.h \ + src/libbluray/disc/udf_fs.c\ +@@ -177,6 +183,7 @@ libbluray_la_SOURCES += \ + contrib/libudfread/src/ecma167.c \ + contrib/libudfread/src/udfread.h \ + contrib/libudfread/src/udfread.c ++endif + + if HAVE_DARWIN + libbluray_la_SOURCES+= \ +@@ -223,7 +230,7 @@ pkginclude_HEADERS = \ + src/libbluray/decoders/overlay.h \ + src/util/log_control.h + +- ++if USING_BDJAVA + if USING_BDJAVA_BUILD_JAR + jardir=$(datadir)/java/ + jar_DATA=$(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar +@@ -245,6 +252,7 @@ clean-local: + -Dversion='$(BDJ_TYPE)-$(VERSION)' \ + clean + endif ++endif + + pkgconfigdir = $(libdir)/pkgconfig + pkgconfig_DATA = src/libbluray.pc +@@ -257,7 +265,6 @@ pkgconfig_DATA = src/libbluray.pc + if USING_EXAMPLES + + noinst_PROGRAMS = \ +- bdj_test \ + bdjo_dump \ + bdsplice \ + clpi_dump \ +@@ -269,6 +276,11 @@ noinst_PROGRAMS = \ + mpls_dump \ + sound_dump + ++if USING_BDJAVA ++noinst_PROGRAMS += \ ++ bdj_test ++endif ++ + bin_PROGRAMS = \ + bd_info + +diff --git a/configure.ac b/configure.ac +index 5fd3c8d..15f53ca 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -81,6 +81,16 @@ AC_ARG_ENABLE([examples], + [use_examples=$enableval], + [use_examples=yes]) + ++AC_ARG_ENABLE([bdjava], ++ [AS_HELP_STRING([--disable-bdjava], [disable BD-Java support @<:@default=enabled@:>@])], ++ [use_bdjava=$enableval], ++ [use_bdjava=yes]) ++ ++AC_ARG_ENABLE([udf], ++ [AS_HELP_STRING([--disable-udf], [disable UDF support @<:@default=enabled@:>@])], ++ [enable_udf=$enableval], ++ [enable_udf=yes]) ++ + AC_ARG_ENABLE([bdjava-jar], + [AS_HELP_STRING([--disable-bdjava-jar], + [disable building of BD-Java JAR file @<:@default=enabled@:>@])], +@@ -196,23 +206,24 @@ dnl use examples + AM_CONDITIONAL([USING_EXAMPLES], [ test $use_examples = "yes" ]) + + dnl use bdjava +-case $host_cpu in +- x86_64) java_arch=amd64 ;; +- i?86) java_arch=i386 ;; +- arm*) java_arch=arm ;; +- *) java_arch=$host_cpu ;; +-esac +-case $host_os in +- linux*) java_os=linux ;; +- win*) java_os=win32 ;; +- mingw*) java_os=win32 ;; +- freebsd*) java_os=freebsd ;; +- solaris*) java_os=solaris ;; +- darwin*) java_os=darwin ;; +- *) java_os=$host_os ;; +-esac +- +-AS_IF([test "x${JDK_HOME}" != "x"], [ ++if [[ $use_bdjava = "yes" ]]; then ++ case $host_cpu in ++ x86_64) java_arch=amd64 ;; ++ i?86) java_arch=i386 ;; ++ arm*) java_arch=arm ;; ++ *) java_arch=$host_cpu ;; ++ esac ++ case $host_os in ++ linux*) java_os=linux ;; ++ win*) java_os=win32 ;; ++ mingw*) java_os=win32 ;; ++ freebsd*) java_os=freebsd ;; ++ solaris*) java_os=solaris ;; ++ darwin*) java_os=darwin ;; ++ *) java_os=$host_os ;; ++ esac ++ ++ AS_IF([test "x${JDK_HOME}" != "x"], [ + BDJAVA_CFLAGS="-I${JDK_HOME}/include -I${JDK_HOME}/include/$java_os" + + temp_CPPFLAGS="$CPPFLAGS" +@@ -223,13 +234,16 @@ AS_IF([test "x${JDK_HOME}" != "x"], [ + BDJAVA_CFLAGS='-I${abs_top_srcdir}/jni -I${abs_top_srcdir}/jni/'"${java_os}" + ]) + +-AC_CHECK_PROG(HAVE_ANT, [ant], yes, no) +-if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then +- AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.]) +-fi ++ AC_CHECK_PROG(HAVE_ANT, [ant], yes, no) ++ if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then ++ AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.]) ++ fi + +-AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$java_arch"], ["Defines the architecture of the java vm."]) +-AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""]) ++ AC_DEFINE([USING_BDJAVA], [1], ["Define to 1 if using BD-Java"]) ++ AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$java_arch"], ["Defines the architecture of the java vm."]) ++ AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""]) ++fi ++AM_CONDITIONAL([USING_BDJAVA], [ test $use_bdjava = "yes" ]) + AM_CONDITIONAL([USING_BDJAVA_BUILD_JAR], [ test $use_bdjava_jar = "yes" ]) + + dnl BD-J type +@@ -243,13 +257,22 @@ dnl bootclasspath + AC_SUBST(BDJ_BOOTCLASSPATH) + + dnl udf support (using git submodule) +-if test ! -f "${srcdir}/contrib/libudfread/src/udfread.h"; then +- AC_MSG_ERROR("libudfread source tree not found") +-fi +-AC_CHECK_HEADERS([unistd.h fcntl.h]) +-AS_IF([test "${SYS}" != "mingw32"], [ +- AC_CHECK_FUNC([pread],, [AC_DEFINE([NEED_PREAD_IMPL], [1], [Define to 1 to use inefficient pread() replacement])]) +-]) ++AS_IF([test "x$enable_udf" = "xyes"], [ ++ if test ! -f "${srcdir}/contrib/libudfread/src/udfread.h"; then ++ AC_MSG_ERROR("libudfread source tree not found") ++ fi ++ AC_CHECK_HEADERS([unistd.h fcntl.h]) ++ AS_IF([test "${SYS}" != "mingw32"], [ ++ AC_CHECK_FUNC([pread],, [AC_MSG_ERROR("Function pread not found. Try with --disable-udf.")]) ++ ]) ++ ++ AC_DEFINE([ENABLE_UDF], [1], [Define to 1 if libudfread is to be used for disc image access]) ++ UDF_CFLAGS='-I${srcdir}/contrib/libudfread/src/' ++ AC_SUBST(UDF_CFLAGS) ++ ], ++ [enable_udf=no]) ++ ++AM_CONDITIONAL([ENABLE_UDF], [test $enable_udf = "yes" ]) + + dnl generate documentation + DX_INIT_DOXYGEN(libbluray, doc/doxygen-config, [doc/doxygen]) +@@ -279,19 +302,25 @@ dnl --------------------------------------------- + + echo " Summary:" + echo " --------" ++echo " BD-J support: $use_bdjava" ++if [[ $use_bdjava = "yes" ]]; then + echo " BD-J type: $BDJ_TYPE" + echo " build JAR: $use_bdjava_jar" + if test x"$BDJ_BOOTCLASSPATH" != x""; then + echo " BD-J bootclasspath: $BDJ_BOOTCLASSPATH" + fi ++fi + echo " Font support (freetype2): $with_freetype" + if [[ $with_freetype = "yes" ]]; then ++if [[ $use_bdjava = "yes" ]]; then + if test "${SYS}" != "mingw32"; then + echo " Use system fonts (fontconfig): $with_fontconfig" + else + echo " Use system fonts: yes" + fi + fi ++fi + echo " Metadata support (libxml2): $with_libxml2" ++echo " UDF filesystem support: $enable_udf" + echo " Build examples: $use_examples" + +diff --git a/includes/inttypes.h b/includes/inttypes.h +new file mode 100644 +index 0000000..ead903f +--- /dev/null ++++ b/includes/inttypes.h +@@ -0,0 +1,305 @@ ++// ISO C9x compliant inttypes.h for Microsoft Visual Studio ++// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 ++// ++// Copyright (c) 2006 Alexander Chemeris ++// ++// Redistribution and use in source and binary forms, with or without ++// modification, are permitted provided that the following conditions are met: ++// ++// 1. Redistributions of source code must retain the above copyright notice, ++// this list of conditions and the following disclaimer. ++// ++// 2. Redistributions in binary form must reproduce the above copyright ++// notice, this list of conditions and the following disclaimer in the ++// documentation and/or other materials provided with the distribution. ++// ++// 3. The name of the author may be used to endorse or promote products ++// derived from this software without specific prior written permission. ++// ++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED ++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO ++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ++// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++// ++/////////////////////////////////////////////////////////////////////////////// ++ ++#ifndef _MSC_VER // [ ++#error "Use this header only with Microsoft Visual C++ compilers!" ++#endif // _MSC_VER ] ++ ++#ifndef _MSC_INTTYPES_H_ // [ ++#define _MSC_INTTYPES_H_ ++ ++#if _MSC_VER > 1000 ++#pragma once ++#endif ++ ++#include "stdint.h" ++ ++// 7.8 Format conversion of integer types ++ ++typedef struct { ++ intmax_t quot; ++ intmax_t rem; ++} imaxdiv_t; ++ ++// 7.8.1 Macros for format specifiers ++ ++#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 ++ ++// The fprintf macros for signed integers are: ++#define PRId8 "d" ++#define PRIi8 "i" ++#define PRIdLEAST8 "d" ++#define PRIiLEAST8 "i" ++#define PRIdFAST8 "d" ++#define PRIiFAST8 "i" ++ ++#define PRId16 "hd" ++#define PRIi16 "hi" ++#define PRIdLEAST16 "hd" ++#define PRIiLEAST16 "hi" ++#define PRIdFAST16 "hd" ++#define PRIiFAST16 "hi" ++ ++#define PRId32 "I32d" ++#define PRIi32 "I32i" ++#define PRIdLEAST32 "I32d" ++#define PRIiLEAST32 "I32i" ++#define PRIdFAST32 "I32d" ++#define PRIiFAST32 "I32i" ++ ++#define PRId64 "I64d" ++#define PRIi64 "I64i" ++#define PRIdLEAST64 "I64d" ++#define PRIiLEAST64 "I64i" ++#define PRIdFAST64 "I64d" ++#define PRIiFAST64 "I64i" ++ ++#define PRIdMAX "I64d" ++#define PRIiMAX "I64i" ++ ++#define PRIdPTR "Id" ++#define PRIiPTR "Ii" ++ ++// The fprintf macros for unsigned integers are: ++#define PRIo8 "o" ++#define PRIu8 "u" ++#define PRIx8 "x" ++#define PRIX8 "X" ++#define PRIoLEAST8 "o" ++#define PRIuLEAST8 "u" ++#define PRIxLEAST8 "x" ++#define PRIXLEAST8 "X" ++#define PRIoFAST8 "o" ++#define PRIuFAST8 "u" ++#define PRIxFAST8 "x" ++#define PRIXFAST8 "X" ++ ++#define PRIo16 "ho" ++#define PRIu16 "hu" ++#define PRIx16 "hx" ++#define PRIX16 "hX" ++#define PRIoLEAST16 "ho" ++#define PRIuLEAST16 "hu" ++#define PRIxLEAST16 "hx" ++#define PRIXLEAST16 "hX" ++#define PRIoFAST16 "ho" ++#define PRIuFAST16 "hu" ++#define PRIxFAST16 "hx" ++#define PRIXFAST16 "hX" ++ ++#define PRIo32 "I32o" ++#define PRIu32 "I32u" ++#define PRIx32 "I32x" ++#define PRIX32 "I32X" ++#define PRIoLEAST32 "I32o" ++#define PRIuLEAST32 "I32u" ++#define PRIxLEAST32 "I32x" ++#define PRIXLEAST32 "I32X" ++#define PRIoFAST32 "I32o" ++#define PRIuFAST32 "I32u" ++#define PRIxFAST32 "I32x" ++#define PRIXFAST32 "I32X" ++ ++#define PRIo64 "I64o" ++#define PRIu64 "I64u" ++#define PRIx64 "I64x" ++#define PRIX64 "I64X" ++#define PRIoLEAST64 "I64o" ++#define PRIuLEAST64 "I64u" ++#define PRIxLEAST64 "I64x" ++#define PRIXLEAST64 "I64X" ++#define PRIoFAST64 "I64o" ++#define PRIuFAST64 "I64u" ++#define PRIxFAST64 "I64x" ++#define PRIXFAST64 "I64X" ++ ++#define PRIoMAX "I64o" ++#define PRIuMAX "I64u" ++#define PRIxMAX "I64x" ++#define PRIXMAX "I64X" ++ ++#define PRIoPTR "Io" ++#define PRIuPTR "Iu" ++#define PRIxPTR "Ix" ++#define PRIXPTR "IX" ++ ++// The fscanf macros for signed integers are: ++#define SCNd8 "d" ++#define SCNi8 "i" ++#define SCNdLEAST8 "d" ++#define SCNiLEAST8 "i" ++#define SCNdFAST8 "d" ++#define SCNiFAST8 "i" ++ ++#define SCNd16 "hd" ++#define SCNi16 "hi" ++#define SCNdLEAST16 "hd" ++#define SCNiLEAST16 "hi" ++#define SCNdFAST16 "hd" ++#define SCNiFAST16 "hi" ++ ++#define SCNd32 "ld" ++#define SCNi32 "li" ++#define SCNdLEAST32 "ld" ++#define SCNiLEAST32 "li" ++#define SCNdFAST32 "ld" ++#define SCNiFAST32 "li" ++ ++#define SCNd64 "I64d" ++#define SCNi64 "I64i" ++#define SCNdLEAST64 "I64d" ++#define SCNiLEAST64 "I64i" ++#define SCNdFAST64 "I64d" ++#define SCNiFAST64 "I64i" ++ ++#define SCNdMAX "I64d" ++#define SCNiMAX "I64i" ++ ++#ifdef _WIN64 // [ ++# define SCNdPTR "I64d" ++# define SCNiPTR "I64i" ++#else // _WIN64 ][ ++# define SCNdPTR "ld" ++# define SCNiPTR "li" ++#endif // _WIN64 ] ++ ++// The fscanf macros for unsigned integers are: ++#define SCNo8 "o" ++#define SCNu8 "u" ++#define SCNx8 "x" ++#define SCNX8 "X" ++#define SCNoLEAST8 "o" ++#define SCNuLEAST8 "u" ++#define SCNxLEAST8 "x" ++#define SCNXLEAST8 "X" ++#define SCNoFAST8 "o" ++#define SCNuFAST8 "u" ++#define SCNxFAST8 "x" ++#define SCNXFAST8 "X" ++ ++#define SCNo16 "ho" ++#define SCNu16 "hu" ++#define SCNx16 "hx" ++#define SCNX16 "hX" ++#define SCNoLEAST16 "ho" ++#define SCNuLEAST16 "hu" ++#define SCNxLEAST16 "hx" ++#define SCNXLEAST16 "hX" ++#define SCNoFAST16 "ho" ++#define SCNuFAST16 "hu" ++#define SCNxFAST16 "hx" ++#define SCNXFAST16 "hX" ++ ++#define SCNo32 "lo" ++#define SCNu32 "lu" ++#define SCNx32 "lx" ++#define SCNX32 "lX" ++#define SCNoLEAST32 "lo" ++#define SCNuLEAST32 "lu" ++#define SCNxLEAST32 "lx" ++#define SCNXLEAST32 "lX" ++#define SCNoFAST32 "lo" ++#define SCNuFAST32 "lu" ++#define SCNxFAST32 "lx" ++#define SCNXFAST32 "lX" ++ ++#define SCNo64 "I64o" ++#define SCNu64 "I64u" ++#define SCNx64 "I64x" ++#define SCNX64 "I64X" ++#define SCNoLEAST64 "I64o" ++#define SCNuLEAST64 "I64u" ++#define SCNxLEAST64 "I64x" ++#define SCNXLEAST64 "I64X" ++#define SCNoFAST64 "I64o" ++#define SCNuFAST64 "I64u" ++#define SCNxFAST64 "I64x" ++#define SCNXFAST64 "I64X" ++ ++#define SCNoMAX "I64o" ++#define SCNuMAX "I64u" ++#define SCNxMAX "I64x" ++#define SCNXMAX "I64X" ++ ++#ifdef _WIN64 // [ ++# define SCNoPTR "I64o" ++# define SCNuPTR "I64u" ++# define SCNxPTR "I64x" ++# define SCNXPTR "I64X" ++#else // _WIN64 ][ ++# define SCNoPTR "lo" ++# define SCNuPTR "lu" ++# define SCNxPTR "lx" ++# define SCNXPTR "lX" ++#endif // _WIN64 ] ++ ++#endif // __STDC_FORMAT_MACROS ] ++ ++// 7.8.2 Functions for greatest-width integer types ++ ++// 7.8.2.1 The imaxabs function ++#define imaxabs _abs64 ++ ++// 7.8.2.2 The imaxdiv function ++ ++// This is modified version of div() function from Microsoft's div.c found ++// in %MSVC.NET%\crt\src\div.c ++#ifdef STATIC_IMAXDIV // [ ++static ++#else // STATIC_IMAXDIV ][ ++_inline ++#endif // STATIC_IMAXDIV ] ++imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) ++{ ++ imaxdiv_t result; ++ ++ result.quot = numer / denom; ++ result.rem = numer % denom; ++ ++ if (numer < 0 && result.rem > 0) { ++ // did division wrong; must fix up ++ ++result.quot; ++ result.rem -= denom; ++ } ++ ++ return result; ++} ++ ++// 7.8.2.3 The strtoimax and strtoumax functions ++#define strtoimax _strtoi64 ++#define strtoumax _strtoui64 ++ ++// 7.8.2.4 The wcstoimax and wcstoumax functions ++#define wcstoimax _wcstoi64 ++#define wcstoumax _wcstoui64 ++ ++ ++#endif // _MSC_INTTYPES_H_ ] +diff --git a/libbluray.def b/libbluray.def +new file mode 100644 +index 0000000..d4c93cb +--- /dev/null ++++ b/libbluray.def +@@ -0,0 +1,63 @@ ++; libbluray.def ; declares the exports ++ ++LIBRARY "libbluray.dll" ++ ++EXPORTS ++ ; bluray.h ++ bd_get_version ++ bd_get_titles ++ bd_get_title_info ++ bd_get_playlist_info ++ bd_free_title_info ++ bd_open ++ bd_close ++ bd_seek ++ bd_seek_time ++ bd_find_seek_point ++ bd_read ++ bd_read_skip_still ++ bd_seek_chapter ++ bd_chapter_pos ++ bd_get_current_chapter ++ bd_seek_mark ++ bd_seek_playitem ++ bd_select_playlist ++ bd_select_title ++ bd_select_angle ++ bd_seamless_angle_change ++ bd_get_title_size ++ bd_get_current_title ++ bd_get_current_angle ++ bd_tell ++ bd_tell_time ++ bd_get_disc_info ++ bd_set_player_setting ++ bd_set_player_setting_str ++ bd_start_bdj ++ bd_stop_bdj ++ bd_get_event ++ bd_play ++ bd_read_ext ++ bd_play_title ++ bd_menu_call ++ bd_register_overlay_proc ++ bd_register_argb_overlay_proc ++ bd_set_scr ++ bd_user_input ++ bd_mouse_select ++ bd_get_sound_effect ++ bd_get_meta ++ bd_get_clpi ++ bd_read_clpi ++ bd_free_clpi ++ bd_read_mpls ++ bd_free_mpls ++ bd_read_mobj ++ bd_free_mobj ++ bd_get_clip_infos ++ bd_get_title_mpls ++ ++ ; additional functions ++ bd_set_debug_handler ++ bd_set_debug_mask ++ bd_get_debug_mask +diff --git a/libbluray.vcxproj b/libbluray.vcxproj +new file mode 100644 +index 0000000..6de7ad2 +--- /dev/null ++++ b/libbluray.vcxproj +@@ -0,0 +1,241 @@ ++ ++ ++ ++ ++ DebugRelease ++ Win32 ++ ++ ++ DebugRelease ++ x64 ++ ++ ++ Debug ++ Win32 ++ ++ ++ Debug ++ x64 ++ ++ ++ Release ++ Win32 ++ ++ ++ Release ++ x64 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ {E1DA1B95-71F1-4C21-A271-121176925062} ++ Win32Proj ++ libbluray ++ ++ ++ ++ v120 ++ ++ ++ v140 ++ 8.1 ++ ++ ++ v141 ++ 8.1 ++ ++ ++ DynamicLibrary ++ true ++ Unicode ++ ++ ++ DynamicLibrary ++ false ++ true ++ Unicode ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ true ++ $(SolutionDir)bin_$(PlatformName)d\ ++ $(SolutionDir)bin_$(PlatformName)d\$(ProjectName)\ ++ ++ ++ false ++ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ ++ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ ++ ++ ++ ++ ++ ++ Level3 ++ Disabled ++ HAVE_CONFIG_H;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) ++ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) ++ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) ++ MultiThreadedDebugDLL ++ CompileAsCpp ++ ++ ++ Windows ++ true ++ libbluray.def ++ ++ ++ xcopy /I /Y "$(OutDir)$(TargetName).lib" "$(OutDir)lib\" ++ Copy .lib into library path ++ ++ ++ ++ ++ MultiThreadedDebug ++ ++ ++ ++ ++ Level3 ++ MaxSpeed ++ true ++ true ++ HAVE_CONFIG_H;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) ++ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) ++ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) ++ MultiThreaded ++ StreamingSIMDExtensions ++ CompileAsCpp ++ ++ ++ Windows ++ true ++ true ++ true ++ libbluray.def ++ true ++ ++ ++ xcopy /I /Y "$(TargetDir)$(TargetName)$(TargetExt)" "$(OutDir)..\" ++xcopy /I /Y "$(TargetDir)$(TargetName).lib" "$(OutDir)..\lib\" ++ Copy .dll/.lib into library path ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff --git a/libbluray.vcxproj.filters b/libbluray.vcxproj.filters +new file mode 100644 +index 0000000..02a4161 +--- /dev/null ++++ b/libbluray.vcxproj.filters +@@ -0,0 +1,377 @@ ++ ++ ++ ++ ++ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} ++ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx ++ ++ ++ {93995380-89BD-4b04-88EB-625FBE52EBFB} ++ h;hpp;hxx;hm;inl;inc;xsd ++ ++ ++ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} ++ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms ++ ++ ++ {1ab0e905-7c04-4090-b385-6363dd1c961c} ++ ++ ++ {b8fa3348-a089-461f-9ef5-3d9df997b8e5} ++ ++ ++ {125333e9-0b5e-45f9-a444-f0aaaf547d9b} ++ ++ ++ {a743058f-f07a-4d0f-bab6-02dc57defda9} ++ ++ ++ {7dacc7c4-ef59-452b-9e5b-392c9df07c98} ++ ++ ++ {c7895c81-c186-4d5e-a8ff-645c6d55a731} ++ ++ ++ {c8619466-211b-4c85-9d30-d1b1a822d32e} ++ ++ ++ {8afb6919-994f-4d1f-9638-ce4a06d0b473} ++ ++ ++ {0e9086a7-eebf-4b8e-a4fe-b1724d148877} ++ ++ ++ {fc5e776b-0f32-493a-b823-240288288502} ++ ++ ++ {96d2d786-cd45-4856-937d-9e6f85ced241} ++ ++ ++ {9f4ea4ae-217a-4d97-a5f3-e561ce1e49cd} ++ ++ ++ {09e1b1b8-3aa3-4918-b157-3dfc0554ccbb} ++ ++ ++ {1e02e503-752e-4765-9dfb-8cc67a7b79f8} ++ ++ ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\file ++ ++ ++ Header Files\file ++ ++ ++ Header Files\file ++ ++ ++ Header Files\libbluray ++ ++ ++ Header Files\libbluray ++ ++ ++ Header Files\libbluray ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\hdmv ++ ++ ++ Header Files\libbluray\hdmv ++ ++ ++ Header Files\libbluray\hdmv ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\util ++ ++ ++ Header Files\util ++ ++ ++ Header Files\libbluray ++ ++ ++ Header Files\libbluray\decoders ++ ++ ++ Header Files\file ++ ++ ++ Header Files\libbluray ++ ++ ++ Header Files\util ++ ++ ++ Header Files\libbluray\disc ++ ++ ++ Header Files\libbluray\disc ++ ++ ++ Header Files\libbluray\disc ++ ++ ++ Header Files\libbluray\disc ++ ++ ++ Header Files\libbluray\disc ++ ++ ++ Header Files\file ++ ++ ++ Header Files\util ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\bdnav ++ ++ ++ Header Files\libbluray\disc ++ ++ ++ ++ ++ Source Files\util ++ ++ ++ Source Files\util ++ ++ ++ Source Files\file ++ ++ ++ Source Files\libbluray ++ ++ ++ Source Files\libbluray ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\hdmv ++ ++ ++ Source Files\libbluray\hdmv ++ ++ ++ Source Files\libbluray\hdmv ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\util ++ ++ ++ Source Files\file ++ ++ ++ Source Files\file ++ ++ ++ Source Files\file ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\util ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\libbluray\decoders ++ ++ ++ Source Files\file ++ ++ ++ Source Files\file ++ ++ ++ Source Files\util ++ ++ ++ Source Files\util ++ ++ ++ Source Files\libbluray\disc ++ ++ ++ Source Files\libbluray\disc ++ ++ ++ Source Files\libbluray\disc ++ ++ ++ Source Files\libbluray\disc ++ ++ ++ Source Files\util ++ ++ ++ Source Files\file ++ ++ ++ Source Files\util ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\bdnav ++ ++ ++ Source Files\libbluray\disc ++ ++ ++ ++ ++ Source Files ++ ++ ++ +\ No newline at end of file +diff --git a/src/file/dir_win32.c b/src/file/dir_win32.c +index 5cbc3c8..4030896 100644 +--- a/src/file/dir_win32.c ++++ b/src/file/dir_win32.c +@@ -76,7 +76,7 @@ static dir_data_t *_open_impl(const char *dirname) + { + dir_data_t *priv; + char *filespec; +- wchar_t wfilespec[MAX_PATH]; ++ wchar_t wfilespec[4096 + 1]; + int result; + + filespec = str_printf("%s" DIR_SEP "*", dirname); +@@ -84,7 +84,7 @@ static dir_data_t *_open_impl(const char *dirname) + return NULL; + } + +- result = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, MAX_PATH); ++ result = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, 4096); + X_FREE(filespec); + if (!result) { + return NULL; +diff --git a/src/file/dirs_win32.c b/src/file/dirs_win32.c +index e165fea..3d07251 100644 +--- a/src/file/dirs_win32.c ++++ b/src/file/dirs_win32.c +@@ -36,7 +36,7 @@ + + char *win32_get_font_dir(const char *font_file) + { +- wchar_t wdir[MAX_PATH]; ++ wchar_t wdir[MAX_PATH+1] = {0}; + if (S_OK != SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir)) { + int lenght = GetWindowsDirectoryW(wdir, MAX_PATH); + if (lenght == 0 || lenght > (MAX_PATH - 8)) { +@@ -67,7 +67,7 @@ char *file_get_config_home(void) + + char *file_get_data_home(void) + { +- wchar_t wdir[MAX_PATH]; ++ wchar_t wdir[MAX_PATH+1] = {0}; + + /* Get the "Application Data" folder for the user */ + if (S_OK == SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, +@@ -92,7 +92,7 @@ char *file_get_cache_home(void) + const char *file_get_config_system(const char *dir) + { + static char *appdir = NULL; +- wchar_t wdir[MAX_PATH]; ++ wchar_t wdir[MAX_PATH+1] = {0}; + + if (!dir) { + // first call +diff --git a/src/file/dl_win32.c b/src/file/dl_win32.c +index 6155ad6..c7e3eee 100644 +--- a/src/file/dl_win32.c ++++ b/src/file/dl_win32.c +@@ -57,7 +57,7 @@ void *dl_dlopen(const char *path, const char *version) + { + (void)version; + +- wchar_t wname[MAX_PATH]; ++ wchar_t wname[MAX_PATH+1] = {0}; + char *name; + void *result; + int iresult; +@@ -125,7 +125,7 @@ const char *dl_get_path(void) + if (!initialized) { + initialized = 1; + +- static char path[MAX_PATH]; ++ static char path[MAX_PATH + 1]; + HMODULE hModule; + wchar_t wpath[MAX_PATH]; + +diff --git a/src/file/file_win32.c b/src/file/file_win32.c +index 11aaf82..f551863 100644 +--- a/src/file/file_win32.c ++++ b/src/file/file_win32.c +@@ -107,9 +107,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) + { + BD_FILE_H *file; + FILE *fp; +- wchar_t wfilename[MAX_PATH], wmode[8]; ++ wchar_t wfilename[4096 + 1] = {0}, wmode[8] = {0}; + +- if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, MAX_PATH) || ++ if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, 4096) || + !MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mode, -1, wmode, 8)) { + + BD_DEBUG(DBG_FILE, "Error opening file %s\n", filename); +@@ -122,6 +122,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) + return NULL; + } + ++ // Set file buffer ++ setvbuf(fp, NULL, _IOFBF, 6144 * 10); ++ + file = calloc(1, sizeof(BD_FILE_H)); + if (!file) { + BD_DEBUG(DBG_FILE | DBG_CRIT, "Error opening file %s (out of memory)\n", filename); +diff --git a/src/libbluray/bdnav/bdmv_parse.c b/src/libbluray/bdnav/bdmv_parse.c +index e298ca3..2c310aa 100644 +--- a/src/libbluray/bdnav/bdmv_parse.c ++++ b/src/libbluray/bdnav/bdmv_parse.c +@@ -59,6 +59,7 @@ int bdmv_parse_header(BITSTREAM *bs, uint32_t type, uint32_t *version) + switch (ver) { + case BDMV_VERSION_0100: + case BDMV_VERSION_0200: ++ case BDMV_VERSION_0240: + case BDMV_VERSION_0300: + break; + default: +diff --git a/src/libbluray/bdnav/bdmv_parse.h b/src/libbluray/bdnav/bdmv_parse.h +index 8f953a3..9dbbed5 100644 +--- a/src/libbluray/bdnav/bdmv_parse.h ++++ b/src/libbluray/bdnav/bdmv_parse.h +@@ -27,6 +27,7 @@ + + #define BDMV_VERSION_0100 ('0' << 24 | '1' << 16 | '0' << 8 | '0') + #define BDMV_VERSION_0200 ('0' << 24 | '2' << 16 | '0' << 8 | '0') ++#define BDMV_VERSION_0240 ('0' << 24 | '2' << 16 | '4' << 8 | '0') + #define BDMV_VERSION_0300 ('0' << 24 | '3' << 16 | '0' << 8 | '0') + + BD_PRIVATE int bdmv_parse_header(BITSTREAM *bs, uint32_t type, uint32_t *version); +diff --git a/src/libbluray/bdnav/index_parse.c b/src/libbluray/bdnav/index_parse.c +index 0deb617..300a1bf 100644 +--- a/src/libbluray/bdnav/index_parse.c ++++ b/src/libbluray/bdnav/index_parse.c +@@ -105,12 +105,11 @@ static int _parse_index(BITSTREAM *bs, INDX_ROOT *index) + + index->num_titles = bs_read(bs, 16); + if (!index->num_titles) { +- BD_DEBUG(DBG_CRIT, "empty index\n"); +- return 0; ++ BD_DEBUG(DBG_NAV, "empty index\n"); + } + + index->titles = calloc(index->num_titles, sizeof(INDX_TITLE)); +- if (!index->titles) { ++ if (index->num_titles && !index->titles) { + BD_DEBUG(DBG_CRIT, "out of memory\n"); + return 0; + } +diff --git a/src/libbluray/bdnav/mpls_data.h b/src/libbluray/bdnav/mpls_data.h +index 2ceac92..d23d40e 100644 +--- a/src/libbluray/bdnav/mpls_data.h ++++ b/src/libbluray/bdnav/mpls_data.h +@@ -47,6 +47,7 @@ typedef struct + uint8_t sv_num_pip_pg_ref; + uint8_t *sv_secondary_audio_ref; + uint8_t *sv_pip_pg_ref; ++ uint8_t ss_offset_sequence_id; + } MPLS_STREAM; + + typedef struct +@@ -107,6 +108,7 @@ typedef struct + uint8_t random_access_flag; + uint8_t audio_mix_flag; + uint8_t lossless_bypass_flag; ++ uint8_t mvc_base_view_r_flag; + } MPLS_AI; + + typedef struct +diff --git a/src/libbluray/bdnav/mpls_parse.c b/src/libbluray/bdnav/mpls_parse.c +index 358b634..569c015 100644 +--- a/src/libbluray/bdnav/mpls_parse.c ++++ b/src/libbluray/bdnav/mpls_parse.c +@@ -77,9 +77,10 @@ _parse_appinfo(BITSTREAM *bits, MPLS_AI *ai) + ai->random_access_flag = bs_read(bits, 1); + ai->audio_mix_flag = bs_read(bits, 1); + ai->lossless_bypass_flag = bs_read(bits, 1); ++ ai->mvc_base_view_r_flag = bs_read(bits, 1); + #if 0 + // Reserved +- bs_skip(bits, 13); ++ bs_skip(bits, 12); + bs_seek_byte(bits, pos + len); + #endif + return 1; +@@ -194,6 +195,7 @@ _parse_stream(BITSTREAM *bits, MPLS_STREAM *s) + break; + }; + s->lang[3] = '\0'; ++ s->ss_offset_sequence_id = 0xFF; + + if (bs_seek_byte(bits, pos + len) < 0) { + return 0; +@@ -958,6 +960,99 @@ _parse_subpath_extension(BITSTREAM *bits, MPLS_PL *pl) + return 0; + } + ++static int ++_parse_stn_ss_extension(BITSTREAM *bits, MPLS_PL *pl) ++{ ++ int ii, s; ++ int64_t pos; ++ ++ for (ii = 0; ii < pl->list_count; ii++) { ++ uint32_t len = bs_read(bits, 16); ++ pos = bs_pos(bits) >> 3; ++ int Fixed_offset_during_PopUp_flag = bs_read(bits, 1); ++ bs_skip(bits, 15); // reserved ++ ++ for (s = 0; s < pl->play_item[ii].stn.num_video; s++) { ++ // stream_entry ++ uint32_t slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ // stream_attributes_ss ++ slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ bs_skip(bits, 10); // reserved ++ bs_skip(bits, 6); // number_of_offset_sequences ++ } ++ ++ for (s = 0; s < pl->play_item[ii].stn.num_pg; s++) { ++ pl->play_item[ii].stn.pg[s].ss_offset_sequence_id = bs_read(bits, 8); ++ ++ bs_skip(bits, 4); // reserved ++ bs_skip(bits, 1); // dialog_region_offset_valid_flag ++ int is_SS_PG = bs_read(bits, 1); ++ int is_top_AS_PG_textST = bs_read(bits, 1); ++ int is_bottom_AS_PG_textST = bs_read(bits, 1); ++ if (is_SS_PG) { ++ // stream_entry left eye ++ uint32_t slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ // stream_entry right eye ++ slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ bs_skip(bits, 8); // reserved ++ bs_skip(bits, 8); // PG offset ++ } ++ if (is_top_AS_PG_textST) { ++ // stream_entry ++ uint32_t slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ bs_skip(bits, 8); // reserved ++ bs_skip(bits, 8); // PG offset ++ } ++ if (is_bottom_AS_PG_textST) { ++ // stream_entry ++ uint32_t slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ bs_skip(bits, 8); // reserved ++ bs_skip(bits, 8); // PG offset ++ } ++ } ++ ++ for (s = 0; s < pl->play_item[ii].stn.num_ig; s++) { ++ if (Fixed_offset_during_PopUp_flag) ++ bs_skip(bits, 8); ++ else ++ pl->play_item[ii].stn.ig[s].ss_offset_sequence_id = bs_read(bits, 8); ++ ++ bs_skip(bits, 16); // IG_Plane_offset_during_BB_video ++ bs_skip(bits, 7); // reserved ++ int is_SS_IG = bs_read(bits, 1); ++ if (is_SS_IG) { ++ // stream_entry left eye ++ uint32_t slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ // stream_entry right eye ++ slen = bs_read(bits, 8); ++ bs_skip(bits, slen * 8); ++ ++ bs_skip(bits, 8); // reserved ++ bs_skip(bits, 8); // PG offset ++ } ++ } ++ ++ // Skip to next play item ++ bs_seek_byte(bits, pos + len); ++ } ++ ++ return 0; ++} ++ + static int + _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) + { +@@ -972,7 +1067,7 @@ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) + + if (id1 == 2) { + if (id2 == 1) { +- return 0; ++ return _parse_stn_ss_extension(bits, pl); + } + if (id2 == 2) { + // SubPath entries extension +diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c +index 883b35c..8220787 100644 +--- a/src/libbluray/bluray.c ++++ b/src/libbluray/bluray.c +@@ -51,8 +51,10 @@ + #include "disc/disc.h" + #include "disc/enc_info.h" + #include "file/file.h" ++#ifdef USING_BDJAVA + #include "bdj/bdj.h" + #include "bdj/bdjo_parse.h" ++#endif + + #include // SEEK_ + #include +@@ -150,9 +152,11 @@ struct bluray { + uint8_t hdmv_suspended; + + /* BD-J */ ++#ifdef USING_BDJAVA + BDJAVA *bdjava; + BDJ_STORAGE bdjstorage; + uint8_t bdj_wait_start; /* BD-J has selected playlist (prefetch) but not yet started playback */ ++#endif + + /* HDMV graphics */ + GRAPHICS_CONTROLLER *graphics_controller; +@@ -166,10 +170,12 @@ struct bluray { + uint64_t gc_wakeup_pos; /* stream position of gc_wakeup_time */ + + /* ARGB overlay output */ ++#ifdef USING_BDJAVA + void *argb_overlay_proc_handle; + bd_argb_overlay_proc_f argb_overlay_proc; + BD_ARGB_BUFFER *argb_buffer; + BD_MUTEX argb_buffer_mutex; ++#endif + }; + + /* Stream Packet Number = byte offset / 192. Avoid 64-bit division. */ +@@ -532,6 +538,16 @@ static void _update_uo_mask(BLURAY *bd) + bd->uo_mask = new_mask; + } + ++#ifdef USING_BDJAVA ++void bd_set_bdj_uo_mask(BLURAY *bd, unsigned mask) ++{ ++ bd->title_uo_mask.title_search = !!(mask & BDJ_TITLE_SEARCH_MASK); ++ bd->title_uo_mask.menu_call = !!(mask & BDJ_MENU_CALL_MASK); ++ ++ _update_uo_mask(bd); ++} ++#endif ++ + static void _update_hdmv_uo_mask(BLURAY *bd) + { + uint32_t mask = hdmv_vm_get_uo_mask(bd->hdmv_vm); +@@ -899,6 +915,7 @@ static int _run_gc(BLURAY *bd, gc_ctrl_e msg, uint32_t param) + + static void _check_bdj(BLURAY *bd) + { ++#ifdef USING_BDJAVA + if (!bd->disc_info.bdj_handled) { + if (!bd->disc || bd->disc_info.bdj_detected) { + +@@ -911,6 +928,7 @@ static void _check_bdj(BLURAY *bd) + } + } + } ++#endif /* USING_BDJAVA */ + } + + static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info) +@@ -940,7 +958,7 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info) + bd->disc_info.num_unsupported_titles = 0; + + bd->disc_info.bdj_detected = 0; +- bd->disc_info.bdj_supported = 1; ++ bd->disc_info.bdj_supported = 0; + + bd->disc_info.num_titles = 0; + bd->disc_info.titles = NULL; +@@ -1104,22 +1122,17 @@ const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY *bd) + } + + /* +- * bdj callbacks ++ * bdj + */ + +-void bd_set_bdj_uo_mask(BLURAY *bd, unsigned mask) +-{ +- bd->title_uo_mask.title_search = !!(mask & BDJ_TITLE_SEARCH_MASK); +- bd->title_uo_mask.menu_call = !!(mask & BDJ_MENU_CALL_MASK); +- +- _update_uo_mask(bd); +-} +- ++#ifdef USING_BDJAVA + const uint8_t *bd_get_aacs_data(BLURAY *bd, int type) + { + return disc_get_data(bd->disc, type); + } ++#endif + ++#ifdef USING_BDJAVA + uint64_t bd_get_uo_mask(BLURAY *bd) + { + /* internal function. Used by BD-J. */ +@@ -1134,25 +1147,16 @@ uint64_t bd_get_uo_mask(BLURAY *bd) + + return mask.u64; + } ++#endif + ++#ifdef USING_BDJAVA + void bd_set_bdj_kit(BLURAY *bd, int mask) + { + _queue_event(bd, BD_EVENT_KEY_INTEREST_TABLE, mask); + } ++#endif + +-int bd_bdj_sound_effect(BLURAY *bd, int id) +-{ +- if (bd->sound_effects && id >= bd->sound_effects->num_sounds) { +- return -1; +- } +- if (id < 0 || id > 0xff) { +- return -1; +- } +- +- _queue_event(bd, BD_EVENT_SOUND_EFFECT, id); +- return 0; +-} +- ++#ifdef USING_BDJAVA + void bd_select_rate(BLURAY *bd, float rate, int reason) + { + if (reason == BDJ_PLAYBACK_STOP) { +@@ -1171,26 +1175,9 @@ void bd_select_rate(BLURAY *bd, float rate, int reason) + _queue_event(bd, BD_EVENT_STILL, 0); + } + } ++#endif + +-int bd_bdj_seek(BLURAY *bd, int playitem, int playmark, int64_t time) +-{ +- bd_mutex_lock(&bd->mutex); +- +- if (playitem > 0) { +- bd_seek_playitem(bd, playitem); +- } +- if (playmark >= 0) { +- bd_seek_mark(bd, playmark); +- } +- if (time >= 0) { +- bd_seek_time(bd, time); +- } +- +- bd_mutex_unlock(&bd->mutex); +- +- return 1; +-} +- ++#ifdef USING_BDJAVA + int bd_set_virtual_package(BLURAY *bd, const char *vp_path, int psr_init_backup) + { + bd_mutex_lock(&bd->mutex); +@@ -1216,12 +1203,16 @@ int bd_set_virtual_package(BLURAY *bd, const char *vp_path, int psr_init_backup) + + return 0; + } ++#endif + ++#ifdef USING_BDJAVA + BD_DISC *bd_get_disc(BLURAY *bd) + { + return bd ? bd->disc : NULL; + } ++#endif + ++#ifdef USING_BDJAVA + uint32_t bd_reg_read(BLURAY *bd, int psr, int reg) + { + if (psr) { +@@ -1230,7 +1221,9 @@ uint32_t bd_reg_read(BLURAY *bd, int psr, int reg) + return bd_gpr_read(bd->regs, reg); + } + } ++#endif + ++#ifdef USING_BDJAVA + int bd_reg_write(BLURAY *bd, int psr, int reg, uint32_t value, uint32_t psr_value_mask) + { + if (psr) { +@@ -1247,7 +1240,9 @@ int bd_reg_write(BLURAY *bd, int psr, int reg, uint32_t value, uint32_t psr_valu + return bd_gpr_write(bd->regs, reg, value); + } + } ++#endif + ++#ifdef USING_BDJAVA + BD_ARGB_BUFFER *bd_lock_osd_buffer(BLURAY *bd) + { + bd_mutex_lock(&bd->argb_buffer_mutex); +@@ -1333,13 +1328,11 @@ void bd_bdj_osd_cb(BLURAY *bd, const unsigned *img, int w, int h, + bd->argb_buffer->dirty[BD_OVERLAY_IG].y1 = 0; + } + } +- +-/* +- * BD-J +- */ ++#endif + + static int _start_bdj(BLURAY *bd, unsigned title) + { ++#ifdef USING_BDJAVA + if (bd->bdjava == NULL) { + const char *root = disc_root(bd->disc); + bd->bdjava = bdj_open(root, bd, bd->disc_info.bdj_disc_id, &bd->bdjstorage); +@@ -1349,8 +1342,14 @@ static int _start_bdj(BLURAY *bd, unsigned title) + } + + return !bdj_process_event(bd->bdjava, BDJ_EVENT_START, title); ++#else ++ (void)bd; ++ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Title %d: BD-J not compiled in\n", title); ++ return 0; ++#endif + } + ++#ifdef USING_BDJAVA + static int _bdj_event(BLURAY *bd, unsigned ev, unsigned param) + { + if (bd->bdjava != NULL) { +@@ -1358,7 +1357,11 @@ static int _bdj_event(BLURAY *bd, unsigned ev, unsigned param) + } + return -1; + } ++#else ++#define _bdj_event(bd, ev, param) do{}while(0) ++#endif + ++#ifdef USING_BDJAVA + static void _stop_bdj(BLURAY *bd) + { + if (bd->bdjava != NULL) { +@@ -1367,7 +1370,11 @@ static void _stop_bdj(BLURAY *bd) + _queue_event(bd, BD_EVENT_KEY_INTEREST_TABLE, 0); + } + } ++#else ++#define _stop_bdj(bd) do{}while(0) ++#endif + ++#ifdef USING_BDJAVA + static void _close_bdj(BLURAY *bd) + { + if (bd->bdjava != NULL) { +@@ -1375,6 +1382,20 @@ static void _close_bdj(BLURAY *bd) + bd->bdjava = NULL; + } + } ++#else ++#define _close_bdj(bd) do{}while(0) ++#endif ++ ++#ifdef USING_BDJAVA ++static void _storage_free(BLURAY *bd) ++{ ++ X_FREE(bd->bdjstorage.cache_root); ++ X_FREE(bd->bdjstorage.persistent_root); ++ X_FREE(bd->bdjstorage.classpath); ++} ++#else ++#define _storage_free(bd) do{}while(0) ++#endif + + /* + * open / close +@@ -1401,6 +1422,7 @@ BLURAY *bd_init(void) + } + + bd_mutex_init(&bd->mutex); ++#ifdef USING_BDJAVA + bd_mutex_init(&bd->argb_buffer_mutex); + + env = getenv("LIBBLURAY_PERSISTENT_STORAGE"); +@@ -1408,6 +1430,7 @@ BLURAY *bd_init(void) + int v = (!strcmp(env, "yes")) ? 1 : (!strcmp(env, "no")) ? 0 : atoi(env); + bd->bdjstorage.no_persistent_storage = !v; + } ++#endif + + BD_DEBUG(DBG_BLURAY, "BLURAY initialized!\n"); + +@@ -1522,7 +1545,9 @@ void bd_close(BLURAY *bd) + disc_close(&bd->disc); + + bd_mutex_destroy(&bd->mutex); ++#ifdef USING_BDJAVA + bd_mutex_destroy(&bd->argb_buffer_mutex); ++#endif + + BD_DEBUG(DBG_BLURAY, "BLURAY destroyed!\n"); + +@@ -1654,6 +1679,25 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick) + return bd->s_pos; + } + ++int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick) ++{ ++ uint32_t clip_pkt, out_pkt; ++ NAV_CLIP *clip; ++ ++ tick /= 2; ++ ++ if (bd->title && ++ tick < bd->title->duration) { ++ ++ // Find the closest access unit to the requested position ++ clip = nav_time_search(bd->title, (uint32_t)tick, &clip_pkt, &out_pkt); ++ ++ return (int64_t)out_pkt * 192; ++ } ++ ++ return bd->s_pos; ++} ++ + uint64_t bd_tell_time(BLURAY *bd) + { + uint32_t clip_pkt = 0, out_pkt = 0, out_time = 0; +@@ -2394,7 +2438,26 @@ int bd_select_playlist(BLURAY *bd, uint32_t playlist) + return result; + } + +-/* BD-J callback */ ++#ifdef USING_BDJAVA ++int bd_bdj_seek(BLURAY *bd, int playitem, int playmark, int64_t time) ++{ ++ bd_mutex_lock(&bd->mutex); ++ ++ if (playitem > 0) { ++ bd_seek_playitem(bd, playitem); ++ } ++ if (playmark >= 0) { ++ bd_seek_mark(bd, playmark); ++ } ++ if (time >= 0) { ++ bd_seek_time(bd, time); ++ } ++ ++ bd_mutex_unlock(&bd->mutex); ++ ++ return 1; ++} ++ + static int _play_playlist_at(BLURAY *bd, int playlist, int playitem, int playmark, int64_t time) + { + if (playlist < 0) { +@@ -2406,14 +2469,15 @@ static int _play_playlist_at(BLURAY *bd, int playlist, int playitem, int playmar + return 0; + } + ++#ifdef USING_BDJAVA + bd->bdj_wait_start = 1; /* playback is triggered by bd_select_rate() */ ++#endif + + bd_bdj_seek(bd, playitem, playmark, time); + + return 1; + } + +-/* BD-J callback */ + int bd_play_playlist_at(BLURAY *bd, int playlist, int playitem, int playmark, int64_t time) + { + int result; +@@ -2426,6 +2490,21 @@ int bd_play_playlist_at(BLURAY *bd, int playlist, int playitem, int playmark, in + return result; + } + ++int bd_bdj_sound_effect(BLURAY *bd, int id) ++{ ++ if (bd->sound_effects && id >= bd->sound_effects->num_sounds) { ++ return -1; ++ } ++ if (id < 0 || id > 0xff) { ++ return -1; ++ } ++ ++ _queue_event(bd, BD_EVENT_SOUND_EFFECT, id); ++ return 0; ++} ++ ++#endif /* USING_BDJAVA */ ++ + // Select a title for playback + // The title index is an index into the list + // established by bd_get_titles() +@@ -2651,6 +2730,7 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, + NAV_CLIP *nc = &title->clip_list.clip[ii]; + + memcpy(ci->clip_id, pi->clip->clip_id, sizeof(ci->clip_id)); ++ ci->idx = nc->clip_id; + ci->pkt_count = nc->end_pkt - nc->start_pkt; + ci->start_time = (uint64_t)nc->title_time * 2; + ci->in_time = (uint64_t)pi->in_time * 2; +@@ -2675,6 +2755,8 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, + } + } + ++ title_info->mvc_base_view_r_flag = title->pl->app_info.mvc_base_view_r_flag; ++ + return title_info; + + error: +@@ -2802,7 +2884,7 @@ int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value) + bd_mutex_unlock(&bd->mutex); + return result; + } +- ++#ifdef USING_BDJAVA + if (idx == BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE) { + if (bd->title_type != title_undef) { + BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Can't disable persistent storage during playback\n"); +@@ -2811,6 +2893,7 @@ int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value) + bd->bdjstorage.no_persistent_storage = !value; + return 1; + } ++#endif + + for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) { + if (idx == map[i].idx) { +@@ -2835,6 +2918,7 @@ int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *s) + case BLURAY_PLAYER_SETTING_COUNTRY_CODE: + return bd_set_player_setting(bd, idx, str_to_uint32(s, 2)); + ++#ifdef USING_BDJAVA + case BLURAY_PLAYER_CACHE_ROOT: + bd_mutex_lock(&bd->mutex); + X_FREE(bd->bdjstorage.cache_root); +@@ -2850,6 +2934,7 @@ int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *s) + bd_mutex_unlock(&bd->mutex); + BD_DEBUG(DBG_BDJ, "Persistent root dir set to %s\n", bd->bdjstorage.persistent_root); + return 1; ++#endif /* USING_BDJAVA */ + + default: + return 0; +@@ -3265,7 +3350,7 @@ static int _play_title(BLURAY *bd, unsigned title) + return 0; + } + +-/* BD-J callback */ ++#ifdef USING_BDJAVA + int bd_play_title_internal(BLURAY *bd, unsigned title) + { + /* used by BD-J. Like bd_play_title() but bypasses UO mask checks. */ +@@ -3275,6 +3360,7 @@ int bd_play_title_internal(BLURAY *bd, unsigned title) + bd_mutex_unlock(&bd->mutex); + return ret; + } ++#endif + + int bd_play(BLURAY *bd) + { +@@ -3505,6 +3591,7 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event) + return 0; + } + ++#ifdef USING_BDJAVA + if (bd->title_type == title_bdj) { + if (bd->end_of_playlist == 1) { + _bdj_event(bd, BDJ_EVENT_END_OF_PLAYLIST, bd_psr_read(bd->regs, PSR_PLAYLIST)); +@@ -3523,6 +3610,7 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event) + return 0; + } + } ++#endif + + int bytes = _bd_read(bd, buf, len); + +@@ -3584,9 +3672,11 @@ static int _set_rate(BLURAY *bd, uint32_t rate) + return -1; + } + ++#ifdef USING_BDJAVA + if (bd->title_type == title_bdj) { + return _bdj_event(bd, BDJ_EVENT_RATE, rate); + } ++#endif + + return 0; + } +@@ -3613,8 +3703,10 @@ int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y) + + if (bd->title_type == title_hdmv) { + result = _run_gc(bd, GC_CTRL_MOUSE_MOVE, param); ++#ifdef USING_BDJAVA + } else if (bd->title_type == title_bdj) { + result = _bdj_event(bd, BDJ_EVENT_MOUSE, param); ++#endif + } + + bd_mutex_unlock(&bd->mutex); +@@ -3636,8 +3728,10 @@ int bd_user_input(BLURAY *bd, int64_t pts, uint32_t key) + + if (bd->title_type == title_hdmv) { + result = _run_gc(bd, GC_CTRL_VK_KEY, key); ++#ifdef USING_BDJAVA + } else if (bd->title_type == title_bdj) { + result = _bdj_event(bd, BDJ_EVENT_VK_KEY, key); ++#endif + } + + bd_mutex_unlock(&bd->mutex); +@@ -3664,6 +3758,7 @@ void bd_register_overlay_proc(BLURAY *bd, void *handle, bd_overlay_proc_f func) + + void bd_register_argb_overlay_proc(BLURAY *bd, void *handle, bd_argb_overlay_proc_f func, BD_ARGB_BUFFER *buf) + { ++#ifdef USING_BDJAVA + if (!bd) { + return; + } +@@ -3675,6 +3770,12 @@ void bd_register_argb_overlay_proc(BLURAY *bd, void *handle, bd_argb_overlay_pro + bd->argb_buffer = buf; + + bd_mutex_unlock(&bd->argb_buffer_mutex); ++#else ++ (void)bd; ++ (void)handle; ++ (void)func; ++ (void)buf; ++#endif + } + + int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, BLURAY_SOUND_EFFECT *effect) +@@ -3825,10 +3926,44 @@ void bd_free_mobj(struct mobj_objects *obj) + + struct bdjo_data *bd_read_bdjo(const char *bdjo_file) + { ++#ifdef USING_BDJAVA + return bdjo_parse(bdjo_file); ++#else ++ (void)bdjo_file; ++ return NULL; ++#endif + } + + void bd_free_bdjo(struct bdjo_data *obj) + { ++#ifdef USING_BDJAVA + bdjo_free(&obj); ++#else ++ (void)obj; ++#endif ++} ++ ++int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration) ++{ ++ if (bd && bd->title && bd->title->clip_list.count > clip) { ++ if (clip_start_time) ++ *clip_start_time = (uint64_t)bd->title->clip_list.clip[clip].title_time << 1; ++ if (stream_start_time) ++ *stream_start_time = (uint64_t)bd->title->clip_list.clip[clip].in_time << 1; ++ if (pos) ++ *pos = (uint64_t)bd->title->clip_list.clip[clip].title_pkt * 192; ++ if (duration) ++ *duration = (uint64_t)bd->title->clip_list.clip[clip].duration << 1; ++ ++ return 1; ++ } ++ return 0; ++} ++ ++struct mpls_pl* bd_get_title_mpls(BLURAY * bd) ++{ ++ if (bd && bd->title) { ++ return bd->title->pl; ++ } ++ return NULL; + } +diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h +index 70e6a84..0cd6047 100644 +--- a/src/libbluray/bluray.h ++++ b/src/libbluray/bluray.h +@@ -32,6 +32,7 @@ extern "C" { + */ + + #include ++#include "bdnav/clpi_data.h" + + #define TITLES_ALL 0 /**< all titles. */ + #define TITLES_FILTER_DUP_TITLE 0x01 /**< remove duplicate titles. */ +@@ -90,7 +91,7 @@ typedef struct { + + /* BD-J info (valid only if disc uses BD-J) */ + uint8_t bdj_detected; /* 1 if disc uses BD-J */ +- uint8_t bdj_supported; /* (deprecated) */ ++ uint8_t bdj_supported; /* 1 if BD-J support was compiled in */ + uint8_t libjvm_detected; /* 1 if usable Java VM was found */ + uint8_t bdj_handled; /* 1 if usable Java VM + libbluray.jar was found */ + +@@ -224,6 +225,7 @@ typedef struct bd_stream_info { + } BLURAY_STREAM_INFO; + + typedef struct bd_clip { ++ uint32_t idx; + uint32_t pkt_count; + uint8_t still_mode; + uint16_t still_time; /* seconds */ +@@ -274,6 +276,8 @@ typedef struct bd_title_info { + BLURAY_CLIP_INFO *clips; + BLURAY_TITLE_CHAPTER *chapters; + BLURAY_TITLE_MARK *marks; ++ ++ uint8_t mvc_base_view_r_flag; + } BLURAY_TITLE_INFO; + + /* +@@ -480,6 +484,16 @@ int bd_select_playlist(BLURAY *bd, uint32_t playlist); + */ + uint32_t bd_get_current_title(BLURAY *bd); + ++/** ++ * ++ * Find the byte position to specific time in 90Khz ticks ++ * ++ * @param bd BLURAY ojbect ++ * @param tick tick count ++ * @return byte position ++ */ ++int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick); ++ + /** + * + * Read from currently selected title file, decrypt if possible +@@ -1039,7 +1053,6 @@ int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y); + + /* access to internal information */ + +-struct clpi_cl; + /** + * + * Get copy of clip information for requested playitem. +@@ -1092,6 +1105,28 @@ void bd_stop_bdj(BLURAY *bd); // shutdown BD-J and clean up resources + */ + int bd_read_file(BLURAY *, const char *path, void **data, int64_t *size); + ++/** ++ * ++ * Get information about the clip ++ * ++ * @param bd BLURAY object ++ * @param clip clip index ++ * @param clip_start_time start of the clip (in the total title) (in 90khz) ++ * @param stream_start_time first pts in the clip (in 90khz) ++ * @param byte position of the clip (absolute) ++ * @param duration duration of the clip (in 90khz) ++ */ ++int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration); ++ ++/** ++ * Get the MPLS struct of the current title ++ * ++ * @param bd BLURAY object ++ * @return the MPLS struct ++ * ++ * Lifetime of the MPLS pointer is limited to the lifetime of the BD title ++ */ ++struct mpls_pl* bd_get_title_mpls(BLURAY * bd); + + #ifdef __cplusplus + } +diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c +index be6a279..e96539a 100644 +--- a/src/libbluray/disc/disc.c ++++ b/src/libbluray/disc/disc.c +@@ -38,7 +38,9 @@ + #include + #include + ++#ifdef ENABLE_UDF + #include "udf_fs.h" ++#endif + + struct bd_disc { + BD_MUTEX ovl_mutex; /* protect access to overlay root */ +@@ -75,7 +77,7 @@ static BD_FILE_H *_bdrom_open_path(void *p, const char *rel_path) + return NULL; + } + +- fp = file_open(abs_path, "rb"); ++ fp = file_open(abs_path, "rbS"); + X_FREE(abs_path); + + return fp; +@@ -316,6 +318,7 @@ BD_DISC *disc_open(const char *device_path, + _set_paths(p, device_path); + + /* check if disc root directory can be opened. If not, treat it as device/image file. */ ++#ifdef ENABLE_UDF + BD_DIR_H *dp_img = device_path ? dir_open(device_path) : NULL; + if (!dp_img) { + void *udf = udf_image_open(device_path, p_fs ? p_fs->fs_handle : NULL, p_fs ? p_fs->read_blocks : NULL); +@@ -336,6 +339,7 @@ BD_DISC *disc_open(const char *device_path, + dir_close(dp_img); + BD_DEBUG(DBG_FILE, "%s does not seem to be image file or device node\n", device_path); + } ++#endif + + struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path }; + p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write); diff --git a/packages/multimedia/libbluray/patches/libbluray-02-install-extra-MVC-headers.patch b/packages/multimedia/libbluray/patches/libbluray-02-install-extra-MVC-headers.patch new file mode 100644 index 0000000000..ca961f1cde --- /dev/null +++ b/packages/multimedia/libbluray/patches/libbluray-02-install-extra-MVC-headers.patch @@ -0,0 +1,42 @@ +From 316310d889d0bcffa299ef6a7fb5726847f2dd3a Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Wed, 20 Jun 2018 15:01:32 +0100 +Subject: [PATCH] add missing 3D MVC headers + +--- + Makefile.am | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index ff15527..00db9af 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -219,6 +219,14 @@ noinst_HEADERS = \ + jni/win32/jni_md.h \ + jni/darwin/jni_md.h + ++bdnavdir=$(pkgincludedir)/bdnav ++bdnav_HEADERS = \ ++ src/libbluray/bdnav/clpi_data.h ++ ++utildir=$(pkgincludedir)/util ++util_HEADERS = \ ++ src/util/attributes.h ++ + pkginclude_HEADERS = \ + src/file/filesystem.h \ + src/libbluray/bluray.h \ +@@ -226,6 +234,10 @@ pkginclude_HEADERS = \ + src/libbluray/keys.h \ + src/libbluray/player_settings.h \ + src/libbluray/bdnav/clpi_data.h \ ++ src/libbluray/bdnav/clpi_parse.h \ ++ src/libbluray/bdnav/mpls_parse.h \ ++ src/libbluray/bdnav/mpls_data.h \ ++ src/libbluray/bdnav/uo_mask_table.h \ + src/libbluray/bdnav/meta_data.h \ + src/libbluray/decoders/overlay.h \ + src/util/log_control.h +-- +2.14.1 + diff --git a/packages/multimedia/libdvdcss/package.mk b/packages/multimedia/libdvdcss/package.mk index 5bff216741..07d5443511 100644 --- a/packages/multimedia/libdvdcss/package.mk +++ b/packages/multimedia/libdvdcss/package.mk @@ -1,44 +1,13 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2009-2016 Team LibreELEC (team@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libdvdcss" -PKG_VERSION="2f12236" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.4.2-Leia-Beta-5" +PKG_SHA256="38816f8373e243bc5950449b4f3b18938c4e1c59348e3411e23f31db4072e40d" PKG_LICENSE="GPL" PKG_SITE="https://github.com/xbmc/libdvdcss" PKG_URL="https://github.com/xbmc/libdvdcss/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libdvdcss: a simple library designed for accessing DVDs as a block device without having to bother about the decryption." PKG_LONGDESC="libdvdcss is a simple library designed for accessing DVDs as a block device without having to bother about the decryption." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -configure_target() { - : -} - -make_target() { - : -} - -makeinstall_target() { - : -} +PKG_TOOLCHAIN="manual" diff --git a/packages/multimedia/libdvdnav/package.mk b/packages/multimedia/libdvdnav/package.mk index a7b85d1ed5..e6c05cacf3 100644 --- a/packages/multimedia/libdvdnav/package.mk +++ b/packages/multimedia/libdvdnav/package.mk @@ -1,44 +1,13 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2009-2016 Team LibreELEC (team@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libdvdnav" -PKG_VERSION="43b5f81" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="9277007" +PKG_SHA256="e50db40a823ddc795d1fe5f18db2517fb3e05fe0c4a88abf1578d95d7a1cce63" PKG_LICENSE="GPL" PKG_SITE="https://github.com/xbmc/libdvdnav" PKG_URL="https://github.com/xbmc/libdvdnav/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libdvdread" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libdvdnav: a library that allows easy use of sophisticated DVD navigation features such as DVD menus, multiangle playback and even interactive DVD games." PKG_LONGDESC="libdvdnav is a library that allows easy use of sophisticated DVD navigation features such as DVD menus, multiangle playback and even interactive DVD games." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -configure_target() { - : -} - -make_target() { - : -} - -makeinstall_target() { - : -} +PKG_TOOLCHAIN="manual" diff --git a/packages/multimedia/libdvdread/package.mk b/packages/multimedia/libdvdread/package.mk index 9a7e954114..7231ae7630 100644 --- a/packages/multimedia/libdvdread/package.mk +++ b/packages/multimedia/libdvdread/package.mk @@ -1,44 +1,17 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2009-2016 Team LibreELEC (team@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libdvdread" -PKG_VERSION="17d99db" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="bd6b329" +PKG_SHA256="2d9d6d185dd25a983d6dfc2a00207cafdc396a969c227d5edd84b6215b2fba89" PKG_LICENSE="GPL" PKG_SITE="https://github.com/xbmc/libdvdread" PKG_URL="https://github.com/xbmc/libdvdread/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libdvdcss" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libdvdread: a library which provides a simple foundation for reading DVDs." +PKG_DEPENDS_TARGET="toolchain" PKG_LONGDESC="libdvdread is a library which provides a simple foundation for reading DVDs." +PKG_TOOLCHAIN="manual" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -configure_target() { - : -} - -make_target() { - : -} - -makeinstall_target() { - : -} +if [ "$KODI_DVDCSS_SUPPORT" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libdvdcss" +fi diff --git a/packages/multimedia/libfslvpuwrap/package.mk b/packages/multimedia/libfslvpuwrap/package.mk deleted file mode 100644 index fd8cceb22b..0000000000 --- a/packages/multimedia/libfslvpuwrap/package.mk +++ /dev/null @@ -1,36 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="libfslvpuwrap" -PKG_VERSION="1.0.65" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="other" -PKG_SITE="http://www.freescale.com" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain imx-vpu" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libfslvpuwrap: Freescale Multimedia VPU wrapper" -PKG_LONGDESC="libfslvpuwrap: Freescale Multimedia VPU wrapper" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -post_makeinstall_target() { - rm -rf $INSTALL/usr/share -} diff --git a/packages/multimedia/libhdhomerun/package.mk b/packages/multimedia/libhdhomerun/package.mk index a1291d41db..4dea9bc3d6 100644 --- a/packages/multimedia/libhdhomerun/package.mk +++ b/packages/multimedia/libhdhomerun/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libhdhomerun" -PKG_VERSION="20150826" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="20180817" +PKG_SHA256="437888b27206f526827ee7a4c57c1c167a36483b0445232e07fb7bb7ee854b42" PKG_LICENSE="LGPL" -PKG_SITE="http://www.silicondust.com/products/hdhomerun/dvbt/" +PKG_SITE="http://www.silicondust.com" PKG_URL="http://download.silicondust.com/hdhomerun/${PKG_NAME}_${PKG_VERSION}.tgz" -PKG_SOURCE_DIR="$PKG_NAME" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="driver" -PKG_SHORTDESC="The library provides functionality to setup the HDHomeRun, change channels, setup PID filtering, get signal quality and so on." -PKG_LONGDESC="The library provides functionality to setup the HDHomeRun, change channels, setup PID filtering, get signal quality and so on." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The library provides functionality to setup the HDHomeRun." PKG_MAKE_OPTS_TARGET="CROSS_COMPILE=$TARGET_PREFIX" diff --git a/packages/multimedia/libmpeg2/package.mk b/packages/multimedia/libmpeg2/package.mk new file mode 100644 index 0000000000..692732281d --- /dev/null +++ b/packages/multimedia/libmpeg2/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libmpeg2" +PKG_VERSION="0.5.1" +PKG_SHA256="dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4" +PKG_LICENSE="GPLv2" +PKG_SITE="http://libmpeg2.sourceforge.net/" +PKG_URL="http://libmpeg2.sourceforge.net/files/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The MPEG Library is a collection of C routines to decode MPEG-1 and MPEG-2 movies." + +PKG_CONFIGURE_OPTS_TARGET="--disable-sdl \ + --without-x" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/multimedia/libva-intel-driver/package.mk b/packages/multimedia/libva-intel-driver/package.mk deleted file mode 100644 index d5b01e856c..0000000000 --- a/packages/multimedia/libva-intel-driver/package.mk +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="libva-intel-driver" -PKG_VERSION="1.7.3" -PKG_REV="1" -PKG_ARCH="x86_64" -PKG_LICENSE="GPL" -PKG_SITE="http://freedesktop.org/wiki/Software/vaapi" -PKG_URL="http://www.freedesktop.org/software/vaapi/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libva libdrm" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libva-driver-intel: Intel G45+ driver for VAAPI" -PKG_LONGDESC="libva-driver-intel: Intel G45+ driver for VAAPI" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules --with-drivers-path=/usr/lib/va" diff --git a/packages/multimedia/libva/package.mk b/packages/multimedia/libva/package.mk index d91aa12013..65a6aed13e 100644 --- a/packages/multimedia/libva/package.mk +++ b/packages/multimedia/libva/package.mk @@ -1,50 +1,29 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libva" -PKG_VERSION="1.7.3" -PKG_REV="1" +PKG_VERSION="2.3.0" +PKG_SHA256="8d95e65c4d84d0f82097581e163d3770694c600cbb040ebd827f2d375e004f4b" PKG_ARCH="x86_64" PKG_LICENSE="GPL" -PKG_SITE="http://freedesktop.org/wiki/Software/vaapi" -PKG_URL="http://www.freedesktop.org/software/vaapi/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libX11 libXext libXfixes libdrm mesa glu" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libva: The main motivation for VAAPI (Video Acceleration API) is to enable hardware accelerated video decode/encode at various entry-points (VLD, IDCT, Motion Compensation etc.) for the prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3)." -PKG_LONGDESC="The main motivation for VAAPI (Video Acceleration API) is to enable hardware accelerated video decode/encode at various entry-points (VLD, IDCT, Motion Compensation etc.) for the prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3). Extending XvMC was considered, but due to its original design for MPEG-2 MotionComp only, it made more sense to design an interface from scratch that can fully expose the video decode capabilities in today's GPUs." +PKG_SITE="https://01.org/linuxmedia" +PKG_URL="https://github.com/intel/libva/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="Libva is an implementation for VA-API (VIdeo Acceleration API)." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="toolchain libX11 libXext libXfixes libdrm" + DISPLAYSERVER_LIBVA="--enable-x11 --disable-glx --disable-wayland" +elif [ "$DISPLAYSERVER" = "weston" ]; then + DISPLAYSERVER_LIBVA="--disable-x11 --disable-glx --enable-wayland" + PKG_DEPENDS_TARGET="toolchain libdrm wayland" +else + PKG_DEPENDS_TARGET="toolchain libdrm" + DISPLAYSERVER_LIBVA="--disable-x11 --disable-glx --disable-wayland" +fi PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --disable-docs \ --enable-drm \ - --enable-x11 \ - --enable-glx \ - --enable-egl \ - --disable-wayland \ - --disable-dummy-driver \ - --with-drivers-path=/usr/lib/va" - -post_makeinstall_target() { - rm -rf $INSTALL/usr/bin - if [ "$DEVTOOLS" = yes ]; then - mkdir -p $INSTALL/usr/bin - cp test/vainfo/.libs/vainfo $INSTALL/usr/bin - fi -} + $DISPLAYSERVER_LIBVA" diff --git a/packages/multimedia/libvdpau/package.mk b/packages/multimedia/libvdpau/package.mk index 102d5e6baa..42d2d5a0bd 100644 --- a/packages/multimedia/libvdpau/package.mk +++ b/packages/multimedia/libvdpau/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libvdpau" PKG_VERSION="1.1.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="5fe093302432ef05086ca2ee429c789b7bf843e166d482d166e56859b08bef55" PKG_LICENSE="MIT" PKG_SITE="https://wiki.freedesktop.org/www/Software/VDPAU/" PKG_URL="https://secure.freedesktop.org/~aplattner/vdpau/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libX11 dri2proto libXext" -PKG_SECTION="multimedia" -PKG_SHORTDESC="libvdpau: a Video Decode and Presentation API for UNIX." -PKG_LONGDESC="VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain libX11 xorgproto libXext" +PKG_LONGDESC="VDPAU is the Video Decode and Presentation API for UNIX." PKG_CONFIGURE_OPTS_TARGET="--enable-dri2 \ --disable-documentation \ diff --git a/packages/multimedia/rkmpp/package.mk b/packages/multimedia/rkmpp/package.mk new file mode 100644 index 0000000000..9f587b4ec0 --- /dev/null +++ b/packages/multimedia/rkmpp/package.mk @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rkmpp" +PKG_VERSION="056e17df923ced58fa0c0b9e0f6ef14cbc640c8d" +PKG_SHA256="6ff910455d86ffd00bf8d388f37b6d18bbf5907fbe095048466a8cdfdc2b4db4" +PKG_ARCH="arm aarch64" +PKG_LICENSE="APL" +PKG_SITE="https://github.com/rockchip-linux/mpp" +PKG_URL="https://github.com/rockchip-linux/mpp/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libdrm" +PKG_LONGDESC="rkmpp: Rockchip Media Process Platform (MPP) module" + +if [ "$DEVICE" = "RK3328" -o "$DEVICE" = "RK3399" ]; then + PKG_ENABLE_VP9D="ON" +else + PKG_ENABLE_VP9D="OFF" +fi + +PKG_CMAKE_OPTS_TARGET="-DENABLE_VP9D=$PKG_ENABLE_VP9D \ + -DHAVE_DRM=ON" diff --git a/packages/multimedia/rkmpp/patches/rkmpp-0001-fix-32-bit-mmap-issue-on-64-bit-kernels.patch b/packages/multimedia/rkmpp/patches/rkmpp-0001-fix-32-bit-mmap-issue-on-64-bit-kernels.patch new file mode 100644 index 0000000000..d79f912843 --- /dev/null +++ b/packages/multimedia/rkmpp/patches/rkmpp-0001-fix-32-bit-mmap-issue-on-64-bit-kernels.patch @@ -0,0 +1,30 @@ +From 3b9802254aeed9a0708d6c0c6b64c6b94ede3fa5 Mon Sep 17 00:00:00 2001 +From: Jakob Unterwurzacher +Date: Mon, 29 May 2017 14:08:43 +0200 +Subject: [PATCH] fix 32-bit mmap issue on 64-bit kernels + +Running 32-bit userland on a 64-bit kernel resulted in the error: + + mpp_drm: mmap failed: Invalid argument + +Both the pagesize_mask and the mmap call truncated the offset +value to 32 bit. This patch fixes both issues. + +For details see https://github.com/rockchip-linux/kernel/issues/17 +--- + osal/allocator/allocator_drm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/osal/allocator/allocator_drm.c b/osal/allocator/allocator_drm.c +index b1dc277f..c2572716 100644 +--- a/osal/allocator/allocator_drm.c ++++ b/osal/allocator/allocator_drm.c +@@ -15,6 +15,8 @@ + */ + + #define MODULE_TAG "mpp_drm" ++/* Enable 64-bit mmap also when compiling for 32 bit */ ++#define _FILE_OFFSET_BITS 64 + + #include + #include diff --git a/packages/multimedia/rkmpp/patches/rkmpp-0002-disable-unit-tests-by-default.patch b/packages/multimedia/rkmpp/patches/rkmpp-0002-disable-unit-tests-by-default.patch new file mode 100644 index 0000000000..bbb26a9e92 --- /dev/null +++ b/packages/multimedia/rkmpp/patches/rkmpp-0002-disable-unit-tests-by-default.patch @@ -0,0 +1,31 @@ +From 9e8b370b826e662879fcec9193956ec59a7db331 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 24 Jun 2018 11:07:44 +0200 +Subject: [PATCH] disable unit tests by default + +--- + test/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 257a3efa..961086ae 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -10,7 +10,7 @@ macro(add_mpp_test module) + #message(STATUS "test_name : ${test_name}") + #message(STATUS "test_tag : ${test_tag}") + +- option(${test_tag} "Build mpp ${module} unit test" ON) ++ option(${test_tag} "Build mpp ${module} unit test" OFF) + if(${test_tag}) + add_executable(${test_name} ${test_name}.c mpp_event_trigger.c mpp_parse_cfg.c) + target_link_libraries(${test_name} ${MPP_SHARED} utils) +@@ -54,7 +54,7 @@ macro(add_legacy_test module) + #message(STATUS "test_name : ${test_name}") + #message(STATUS "test_tag : ${test_tag}") + +- option(${test_tag} "Build legacy ${module} unit test" ON) ++ option(${test_tag} "Build legacy ${module} unit test" OFF) + if(${test_tag}) + add_executable(${test_name} ${test_name}.c) + target_link_libraries(${test_name} ${VPU_SHARED} utils) diff --git a/packages/multimedia/rkmpp/patches/rkmpp-0003-h264d-fix-mpp_buf_slot_get_prop-crash.patch b/packages/multimedia/rkmpp/patches/rkmpp-0003-h264d-fix-mpp_buf_slot_get_prop-crash.patch new file mode 100644 index 0000000000..c58e86188f --- /dev/null +++ b/packages/multimedia/rkmpp/patches/rkmpp-0003-h264d-fix-mpp_buf_slot_get_prop-crash.patch @@ -0,0 +1,26 @@ +From 57a996a3c2ebf8991216c9084b476254e205c28c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 7 Sep 2018 19:53:10 +0200 +Subject: [PATCH] [h264d]: fix mpp_buf_slot_get_prop crash + +--- + mpp/codec/dec/h264/h264d_init.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/mpp/codec/dec/h264/h264d_init.c b/mpp/codec/dec/h264/h264d_init.c +index cd17776c..acad2ea7 100644 +--- a/mpp/codec/dec/h264/h264d_init.c ++++ b/mpp/codec/dec/h264/h264d_init.c +@@ -1401,7 +1401,11 @@ static RK_U32 check_ref_dbp_err(H264_DecCtx_t *p_Dec, H264_RefPicInfo_t *pref, R + for (i = 0; i < MAX_REF_SIZE; i++) { + if (pref[i].valid) { + MppFrame mframe = NULL; +- RK_U32 slot_idx = p_Dec->dpb_info[pref[i].dpb_idx].slot_index; ++ RK_S32 slot_idx = p_Dec->dpb_info[pref[i].dpb_idx].slot_index; ++ if (slot_idx < 0) { ++ dpb_error_flag |= 1; ++ break; ++ } + mpp_buf_slot_get_prop(p_Dec->frame_slots, slot_idx, SLOT_FRAME_PTR, &mframe); + if (mframe) { + if (i < active_refs) { diff --git a/packages/multimedia/rkmpp/patches/rkmpp-0004-m2vd-use-ctx-pts.patch b/packages/multimedia/rkmpp/patches/rkmpp-0004-m2vd-use-ctx-pts.patch new file mode 100644 index 0000000000..9ee09016d6 --- /dev/null +++ b/packages/multimedia/rkmpp/patches/rkmpp-0004-m2vd-use-ctx-pts.patch @@ -0,0 +1,22 @@ +From 087282d7d3fb5b5216acf7d10864ab2a42dd8473 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Thu, 1 Mar 2018 22:31:47 +0100 +Subject: [PATCH] [m2vd]: use ctx pts + +--- + mpp/codec/dec/m2v/m2vd_parser.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c +index 6a720d56..24372f85 100755 +--- a/mpp/codec/dec/m2v/m2vd_parser.c ++++ b/mpp/codec/dec/m2v/m2vd_parser.c +@@ -1151,7 +1151,7 @@ static MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx) + mpp_frame_set_hor_stride(ctx->frame_cur->f, ctx->display_width); + mpp_frame_set_ver_stride(ctx->frame_cur->f, ctx->display_height); + mpp_frame_set_errinfo(ctx->frame_cur->f, 0); +- mpp_frame_set_pts(ctx->frame_cur->f, Time * 1000); ++ mpp_frame_set_pts(ctx->frame_cur->f, ctx->pts); + ctx->frame_cur->flags = M2V_OUT_FLAG; + if (ctx->seq_ext_head.progressive_sequence) { + frametype = MPP_FRAME_FLAG_FRAME; diff --git a/packages/multimedia/rkmpp/patches/rkmpp-0005-m2vd-export-aspect-ratio-information.patch b/packages/multimedia/rkmpp/patches/rkmpp-0005-m2vd-export-aspect-ratio-information.patch new file mode 100644 index 0000000000..ed2a4ecc5b --- /dev/null +++ b/packages/multimedia/rkmpp/patches/rkmpp-0005-m2vd-export-aspect-ratio-information.patch @@ -0,0 +1,103 @@ +From e8b390f2a92a9a5668ed8f00255b75d21f9ce60a Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 15 Sep 2018 11:24:28 +0200 +Subject: [PATCH] [m2vd]: export aspect ratio information + +--- + inc/mpp_frame.h | 10 ++++++++++ + mpp/base/inc/mpp_frame_impl.h | 1 + + mpp/base/mpp_frame.cpp | 1 + + mpp/codec/dec/m2v/m2vd_parser.c | 22 ++++++++++++++++++++++ + 4 files changed, 34 insertions(+) + +diff --git a/inc/mpp_frame.h b/inc/mpp_frame.h +index 6c1b7f1d..87513a09 100644 +--- a/inc/mpp_frame.h ++++ b/inc/mpp_frame.h +@@ -190,6 +190,14 @@ typedef enum { + MPP_FMT_BUTT = MPP_FMT_COMPLEX_BUTT, + } MppFrameFormat; + ++/** ++ * Rational number (pair of numerator and denominator). ++ */ ++typedef struct MppFrameRational { ++ RK_S32 num; ///< Numerator ++ RK_S32 den; ///< Denominator ++} MppFrameRational; ++ + typedef enum { + MPP_FRAME_ERR_UNKNOW = 0x0001, + MPP_FRAME_ERR_UNSUPPORT = 0x0002, +@@ -263,6 +271,8 @@ void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chr + MppFrameFormat mpp_frame_get_fmt(MppFrame frame); + void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt); + ++MppFrameRational mpp_frame_get_sar(const MppFrame frame); ++void mpp_frame_set_sar(MppFrame frame, MppFrameRational sar); + + /* + * HDR parameter +diff --git a/mpp/base/inc/mpp_frame_impl.h b/mpp/base/inc/mpp_frame_impl.h +index 44edc184..1f13d553 100644 +--- a/mpp/base/inc/mpp_frame_impl.h ++++ b/mpp/base/inc/mpp_frame_impl.h +@@ -87,6 +87,7 @@ struct MppFrameImpl_t { + MppFrameChromaLocation chroma_location; + + MppFrameFormat fmt; ++ MppFrameRational sar; + /* + * buffer information + * NOTE: buf_size only access internally +diff --git a/mpp/base/mpp_frame.cpp b/mpp/base/mpp_frame.cpp +index cc83b6b3..984efa62 100644 +--- a/mpp/base/mpp_frame.cpp ++++ b/mpp/base/mpp_frame.cpp +@@ -184,5 +184,6 @@ MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc) + MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace) + MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location) + MPP_FRAME_ACCESSORS(MppFrameFormat, fmt) ++MPP_FRAME_ACCESSORS(MppFrameRational, sar) + MPP_FRAME_ACCESSORS(size_t, buf_size) + MPP_FRAME_ACCESSORS(RK_U32, errinfo) +diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c +index 24372f85..e44e35fb 100755 +--- a/mpp/codec/dec/m2v/m2vd_parser.c ++++ b/mpp/codec/dec/m2v/m2vd_parser.c +@@ -82,6 +82,25 @@ static int frame_period_Table[16] = { + 1 + }; + ++static const MppFrameRational mpeg2_aspect[16] = { ++ {0,1}, ++ {1,1}, ++ {4,3}, ++ {16,9}, ++ {221,100}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++ {0,1}, ++}; ++ + static inline RK_S32 m2vd_get_readbits(BitReadCtx_t *bx) + { + return bx->used_bits; +@@ -1164,6 +1183,9 @@ static MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx) + } + mpp_frame_set_mode(ctx->frame_cur->f, frametype); + ++ if (ctx->seq_head.aspect_ratio_information >= 0 && ctx->seq_head.aspect_ratio_information < 16) ++ mpp_frame_set_sar(ctx->frame_cur->f, mpeg2_aspect[ctx->seq_head.aspect_ratio_information]); ++ + mpp_buf_slot_get_unused(ctx->frame_slots, &ctx->frame_cur->slot_index); + mpp_buf_slot_set_prop(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_FRAME, ctx->frame_cur->f); + mpp_buf_slot_set_flag(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_CODEC_USE); diff --git a/packages/multimedia/rtmpdump/package.mk b/packages/multimedia/rtmpdump/package.mk index ec315a67b9..910d7feff9 100644 --- a/packages/multimedia/rtmpdump/package.mk +++ b/packages/multimedia/rtmpdump/package.mk @@ -1,37 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="rtmpdump" PKG_VERSION="fa8646d" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="dba4d4d2e1c7de6884b01d98194b83cab6784669089fa3c919152087a3a38fd2" PKG_LICENSE="GPL" PKG_SITE="http://rtmpdump.mplayerhq.hu/" PKG_URL="http://repo.or.cz/rtmpdump.git/snapshot/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain zlib libressl" -PKG_SECTION="multimedia" -PKG_SHORTDESC="rtmpdump: a toolkit for RTMP streams." -PKG_LONGDESC="rtmpdump is a toolkit for RTMP streams. All forms of RTMP are supported, including rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -MAKEFLAGS="-j1" +PKG_DEPENDS_TARGET="toolchain zlib openssl" +PKG_LONGDESC="rtmpdump is a toolkit for RTMP streams." +PKG_BUILD_FLAGS="+pic -parallel" make_target() { make prefix=/usr \ diff --git a/packages/network/avahi/config/resolv.conf b/packages/network/avahi/config/resolv.conf deleted file mode 100644 index bbc8559cd5..0000000000 --- a/packages/network/avahi/config/resolv.conf +++ /dev/null @@ -1 +0,0 @@ -nameserver 127.0.0.1 diff --git a/packages/network/avahi/config/samba.service b/packages/network/avahi/config/samba.service deleted file mode 100644 index 5b44889bc6..0000000000 --- a/packages/network/avahi/config/samba.service +++ /dev/null @@ -1,9 +0,0 @@ - - - - %h - - _smb._tcp - 445 - - diff --git a/packages/network/avahi/package.mk b/packages/network/avahi/package.mk index 17915d99e5..43bfb7be58 100644 --- a/packages/network/avahi/package.mk +++ b/packages/network/avahi/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="avahi" -PKG_VERSION="0.6.32" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.7" +PKG_SHA256="fd45480cef0559b3eab965ea3ad4fe2d7a8f27db32c851a032ee0b487c378329" PKG_LICENSE="GPL" PKG_SITE="http://avahi.org/" -PKG_URL="http://sources.openelec.tv/mirror/avahi/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://github.com/lathiat/avahi/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain expat libdaemon dbus connman" -PKG_SECTION="network" -PKG_SHORTDESC="avahi: A Zeroconf mDNS/DNS-SD responder" -PKG_LONGDESC="Avahi is a framework for Multicast DNS Service Discovery (mDNS/DNS-SD a.k.a. Zeroconf) on Linux. It allows programs to publish and discover services running on a local network with no specific configuration. For example, you can plug into a network and instantly find printers to print to, files to look at, and people to talk to." - -PKG_IS_ADDON="no" -#broken -PKG_AUTORECONF="no" - -MAKEFLAGS="-j1" +PKG_LONGDESC="Service Discovery for Linux using mDNS/DNS-SD, compatible with Bonjour." +PKG_TOOLCHAIN="configure" PKG_CONFIGURE_OPTS_TARGET="py_cv_mod_gtk_=yes \ py_cv_mod_dbus_=yes \ @@ -49,7 +26,6 @@ PKG_CONFIGURE_OPTS_TARGET="py_cv_mod_gtk_=yes \ --disable-gdbm \ --enable-libdaemon \ --disable-python \ - --disable-pygtk \ --disable-python-dbus \ --disable-mono \ --disable-monodoc \ @@ -68,7 +44,7 @@ PKG_CONFIGURE_OPTS_TARGET="py_cv_mod_gtk_=yes \ --disable-manpages \ --disable-xmltoman \ --disable-tests \ - --disable-compat-libdns_sd \ + --enable-compat-libdns_sd \ --disable-compat-howl \ --with-xml=expat \ --with-avahi-user=avahi \ @@ -102,10 +78,10 @@ post_makeinstall_target() { rm -f $INSTALL/usr/bin/avahi-bookmarks rm -f $INSTALL/usr/bin/avahi-publish* rm -f $INSTALL/usr/bin/avahi-resolve* + rm -f $INSTALL/usr/lib/libdns_sd* mkdir -p $INSTALL/usr/share/services cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services - } post_install() { diff --git a/packages/network/bluez/default.d/bluez.conf b/packages/network/bluez/default.d/bluez.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/network/bluez/package.mk b/packages/network/bluez/package.mk index 46c5e407cd..a208a1d3f3 100644 --- a/packages/network/bluez/package.mk +++ b/packages/network/bluez/package.mk @@ -1,47 +1,24 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="bluez" -PKG_VERSION="5.43" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5.50" +PKG_SHA256="c44b776660bf78e664e388b979da152976296e444dece833f3ddbd5be5a3b1b4" PKG_LICENSE="GPL" PKG_SITE="http://www.bluez.org/" -PKG_URL="http://www.kernel.org/pub/linux/bluetooth/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://git.kernel.org/pub/scm/bluetooth/bluez.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain dbus glib readline systemd" -PKG_SECTION="network" -PKG_SHORTDESC="bluez: Bluetooth Tools and System Daemons for Linux." PKG_LONGDESC="Bluetooth Tools and System Daemons for Linux." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+lto" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -if [ "$DEBUG" = "yes" ]; then +if build_with_debug; then BLUEZ_CONFIG="--enable-debug" else BLUEZ_CONFIG="--disable-debug" fi -if [ "$DEVTOOLS" = "yes" ]; then - BLUEZ_CONFIG="$BLUEZ_CONFIG --enable-monitor --enable-test" -else - BLUEZ_CONFIG="$BLUEZ_CONFIG --disable-monitor --disable-test" -fi +BLUEZ_CONFIG="$BLUEZ_CONFIG --enable-monitor --enable-test" PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \ --disable-silent-rules \ @@ -51,7 +28,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \ --disable-obex \ --enable-client \ --enable-systemd \ - --enable-tools \ + --enable-tools --enable-deprecated \ --enable-datafiles \ --disable-experimental \ --enable-sixaxis \ @@ -61,10 +38,10 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-dependency-tracking \ pre_configure_target() { # bluez fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME - export LIBS="-ltermcap" + export LIBS="-lncurses" } post_makeinstall_target() { @@ -73,9 +50,22 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/bin/bluemoon rm -rf $INSTALL/usr/bin/ciptool rm -rf $INSTALL/usr/share/dbus-1 + + mkdir -p $INSTALL/etc/bluetooth + cp src/main.conf $INSTALL/etc/bluetooth + sed -i $INSTALL/etc/bluetooth/main.conf \ + -e "s|^#\[Policy\]|\[Policy\]|g" \ + -e "s|^#AutoEnable.*|AutoEnable=true|g" + + mkdir -p $INSTALL/usr/share/services + cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services + + # bluez looks in /etc/firmware/ + ln -sf /usr/lib/firmware $INSTALL/etc/firmware } post_install() { + enable_service bluetooth-defaults.service enable_service bluetooth.service enable_service obex.service } diff --git a/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch b/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch index 60b4067e75..a2768cc551 100644 --- a/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch +++ b/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch @@ -9,48 +9,40 @@ Navigation Controller is using PID 0x042f over USB but PID 0x0268 plugins/sixaxis.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c -index fcc93bc..50db6c1 100644 --- a/plugins/sixaxis.c +++ b/plugins/sixaxis.c -@@ -54,6 +54,7 @@ static const struct { - uint16_t vid; - uint16_t pid; - uint16_t version; -+ uint16_t bt_pid; - } devices[] = { - { - .name = "PLAYSTATION(R)3 Controller", -@@ -68,6 +69,7 @@ static const struct { - .vid = 0x054c, - .pid = 0x042f, - .version = 0x0000, -+ .bt_pid = 0x0268, - }, - }; - -@@ -300,8 +302,19 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter) +@@ -363,7 +363,13 @@ info("sixaxis: setting up new device"); - - btd_device_device_set_name(device, devices[index].name); -- btd_device_set_pnpid(device, devices[index].source, devices[index].vid, -- devices[index].pid, devices[index].version); + + btd_device_device_set_name(device, cp->name); +- btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); + + /* if device reports different pid/vid on BT prefer those over USB */ -+ if (devices[index].bt_pid) -+ btd_device_set_pnpid(device, devices[index].source, -+ devices[index].vid, -+ devices[index].bt_pid, -+ devices[index].version); ++ if (cp->bt_pid) ++ btd_device_set_pnpid(device, cp->source, cp->vid, cp->bt_pid, cp->version); + else -+ btd_device_set_pnpid(device, devices[index].source, -+ devices[index].vid, -+ devices[index].pid, -+ devices[index].version); ++ btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); + - btd_device_set_temporary(device, false); - - return true; --- + btd_device_set_temporary(device, true); + + closure = g_new0(struct authentication_closure, 1); +--- a/profiles/input/sixaxis.h ++++ b/profiles/input/sixaxis.h +@@ -38,6 +38,7 @@ + uint16_t vid; + uint16_t pid; + uint16_t version; ++ uint16_t bt_pid; + CablePairingType type; + }; + +@@ -59,6 +60,7 @@ + .vid = 0x054c, + .pid = 0x042f, + .version = 0x0000, ++ .bt_pid = 0x0268, + .type = CABLE_PAIRING_SIXAXIS, + }, + { +-- 2.1.4 - diff --git a/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_50.patch b/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_50.patch new file mode 100644 index 0000000000..24311aac02 --- /dev/null +++ b/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_50.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile.obexd b/Makefile.obexd +index cd3ace4..89f1609 100644 +--- a/Makefile.obexd ++++ b/Makefile.obexd +@@ -8,8 +8,6 @@ endif + + EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service + +-if OBEX +- + obex_plugindir = $(libdir)/obex/plugins + + obexd_builtin_modules = +@@ -33,6 +31,8 @@ obexd_builtin_sources += obexd/plugins/opp.c + obexd_builtin_modules += ftp + obexd_builtin_sources += obexd/plugins/ftp.c obexd/plugins/ftp.h + ++if OBEX ++ + obexd_builtin_modules += irmc + obexd_builtin_sources += obexd/plugins/irmc.c + +@@ -47,6 +47,8 @@ obexd_builtin_sources += obexd/plugins/mas.c obexd/src/map_ap.h \ + obexd/plugins/messages.h \ + obexd/plugins/messages-dummy.c + ++endif ++ + obexd_builtin_modules += mns + obexd_builtin_sources += obexd/client/mns.c obexd/src/map_ap.h \ + obexd/client/map-event.h +@@ -90,8 +92,6 @@ obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ \ + + obexd_src_obexd_CPPFLAGS = -I$(builddir)/lib -I$(builddir)/obexd/src + +-endif +- + obexd_src_obexd_SHORTNAME = obexd + + obexd_builtin_files = obexd/src/builtin.h $(obexd_builtin_nodist) diff --git a/packages/network/bluez/patches/bluez-12_sixaxis-add-support-for-setting-SDP-record.patch b/packages/network/bluez/patches/bluez-12_sixaxis-add-support-for-setting-SDP-record.patch deleted file mode 100644 index 18a3160f58..0000000000 --- a/packages/network/bluez/patches/bluez-12_sixaxis-add-support-for-setting-SDP-record.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Szymon Janc -Subject: [PATCH 2/5] core/device: Add support for setting SDP record -Newsgroups: gmane.linux.bluez.kernel -Date: 2015-06-15 18:28:27 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) - -This allows to set SDP record for device without resolving services -over SDP. After SDP is provided profiles are probed. ---- - src/device.c | 31 +++++++++++++++++++++++++++++++ - src/device.h | 3 +++ - 2 files changed, 34 insertions(+) - -diff --git a/src/device.c b/src/device.c -index 3ef0340..859aa3c 100644 ---- a/src/device.c -+++ b/src/device.c -@@ -5542,6 +5542,37 @@ static sdp_list_t *read_device_records(struct btd_device *device) - return recs; - } - -+void btd_device_set_record(struct btd_device *device, const char *uuid, -+ sdp_record_t *rec) -+{ -+ /* This API is only used for BR/EDR */ -+ struct bearer_state *state = &device->bredr_state; -+ struct browse_req *req; -+ sdp_list_t *recs = NULL; -+ -+ if (!rec) -+ return; -+ -+ req = browse_request_new(device, NULL); -+ if (!req) -+ return; -+ -+ recs = sdp_list_append(recs, rec); -+ update_bredr_services(req, recs); -+ sdp_list_free(recs, NULL); -+ -+ device->svc_refreshed = true; -+ state->svc_resolved = true; -+ -+ device_probe_profiles(device, req->profiles_added); -+ -+ /* Propagate services changes */ -+ g_dbus_emit_property_changed(dbus_conn, req->device->path, -+ DEVICE_INTERFACE, "UUIDs"); -+ -+ device_svc_resolved(device, device->bdaddr_type, 0); -+} -+ - const sdp_record_t *btd_device_get_record(struct btd_device *device, - const char *uuid) - { -diff --git a/src/device.h b/src/device.h -index 1955f54..aee677a 100644 ---- a/src/device.h -+++ b/src/device.h -@@ -62,6 +62,9 @@ struct device_addr_type { - int device_addr_type_cmp(gconstpointer a, gconstpointer b); - GSList *btd_device_get_uuids(struct btd_device *device); - void device_probe_profiles(struct btd_device *device, GSList *profiles); -+ -+void btd_device_set_record(struct btd_device *device, const char *uuid, -+ sdp_record_t *rec); - const sdp_record_t *btd_device_get_record(struct btd_device *device, - const char *uuid); - struct gatt_primary *btd_device_get_primary(struct btd_device *device, --- -2.1.4 - diff --git a/packages/network/bluez/patches/bluez-13_sixaxis-provide-dualshock-3-SDP-record.patch b/packages/network/bluez/patches/bluez-13_sixaxis-provide-dualshock-3-SDP-record.patch deleted file mode 100644 index 91aa83af1b..0000000000 --- a/packages/network/bluez/patches/bluez-13_sixaxis-provide-dualshock-3-SDP-record.patch +++ /dev/null @@ -1,216 +0,0 @@ -From: Szymon Janc -Subject: [PATCH 3/5] sixaxis: Provide DualShock 3 SDP record while adding new device -Newsgroups: gmane.linux.bluez.kernel -Date: 2015-06-15 18:28:28 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) - -This allows to skip SDP search for DualShock 3 devices. Since some -DS3 clones were reported to not provide any SDP record this should -allow to operate them. ---- - Makefile.plugins | 1 + - plugins/sixaxis.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 167 insertions(+) - -diff --git a/Makefile.plugins b/Makefile.plugins -index cae43d9..2c2385d 100644 ---- a/Makefile.plugins -+++ b/Makefile.plugins -@@ -118,4 +118,5 @@ plugins_sixaxis_la_SOURCES = plugins/sixaxis.c - plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ - -no-undefined @UDEV_LIBS@ - plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@ -+plugins_sixaxis_la_LIBADD = lib/libbluetooth-internal.la - endif -diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c -index 50db6c1..782a89f 100644 ---- a/plugins/sixaxis.c -+++ b/plugins/sixaxis.c -@@ -40,4 +40,6 @@ - - #include "lib/bluetooth.h" -+#include "lib/sdp.h" -+#include "lib/sdp_lib.h" - #include "lib/uuid.h" - #include "src/adapter.h" -@@ -257,6 +258,170 @@ out: - return false; - } - -+static sdp_record_t *get_sdp_record(void) -+{ -+ sdp_record_t *record; -+ uint16_t hid_release, hid_parser, version, timeout; -+ uint8_t sdp_disable, battery, remote_wakeup, norm_connect, boot_device; -+ uint8_t subclass, country, virtual_cable, reconnect; -+ sdp_list_t *svclass_id, *pfseq, *apseq, *root; -+ uuid_t root_uuid, hidkb_uuid, l2cap_uuid, hidp_uuid; -+ sdp_profile_desc_t profile; -+ sdp_list_t *aproto, *proto[3]; -+ sdp_data_t *psm, *lang_lst, *lang_lst2, *hid_spec_lst, *hid_spec_lst2; -+ uint8_t dtd = SDP_UINT16; -+ uint8_t dtd2 = SDP_UINT8; -+ uint8_t dtd_data = SDP_TEXT_STR8; -+ void *dtds[2]; -+ void *values[2]; -+ void *dtds2[2]; -+ void *values2[2]; -+ int leng[2]; -+ uint8_t hid_spec_type = 0x22; -+ uint16_t hid_attr_lang[] = { 0x409, 0x100 }; -+ static const uint16_t ctrl = 0x11; -+ static const uint16_t intr = 0x13; -+ uint8_t hid_spec[] = { -+ 0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0xa1, 0x02, 0x85, 0x01, -+ 0x75, 0x08, 0x95, 0x01, 0x15, 0x00, 0x26, 0xff, 0x00, 0x81, -+ 0x03, 0x75, 0x01, 0x95, 0x13, 0x15, 0x00, 0x25, 0x01, 0x35, -+ 0x00, 0x45, 0x01, 0x05, 0x09, 0x19, 0x01, 0x29, 0x13, 0x81, -+ 0x02, 0x75, 0x01, 0x95, 0x0d, 0x06, 0x00, 0xff, 0x81, 0x03, -+ 0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x01, 0x09, 0x01, 0xa1, -+ 0x00, 0x75, 0x08, 0x95, 0x04, 0x35, 0x00, 0x46, 0xff, 0x00, -+ 0x09, 0x30, 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x81, 0x02, -+ 0xc0, 0x05, 0x01, 0x75, 0x08, 0x95, 0x27, 0x09, 0x01, 0x81, -+ 0x02, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0x91, 0x02, 0x75, -+ 0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02, -+ 0x85, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, -+ 0xc0, 0xa1, 0x02, 0x85, 0xee, 0x75, 0x08, 0x95, 0x30, 0x09, -+ 0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02, 0x85, 0xef, 0x75, 0x08, -+ 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xc0, 0x00 -+ }; -+ -+ record = sdp_record_alloc(); -+ if (!record) -+ return NULL; -+ -+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP); -+ root = sdp_list_append(0, &root_uuid); -+ sdp_set_browse_groups(record, root); -+ -+ sdp_add_lang_attr(record); -+ -+ sdp_uuid16_create(&hidkb_uuid, HID_SVCLASS_ID); -+ svclass_id = sdp_list_append(0, &hidkb_uuid); -+ sdp_set_service_classes(record, svclass_id); -+ -+ sdp_uuid16_create(&profile.uuid, HID_PROFILE_ID); -+ profile.version = 0x0100; -+ pfseq = sdp_list_append(0, &profile); -+ sdp_set_profile_descs(record, pfseq); -+ -+ /* protocols */ -+ sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID); -+ proto[1] = sdp_list_append(0, &l2cap_uuid); -+ psm = sdp_data_alloc(SDP_UINT16, &ctrl); -+ proto[1] = sdp_list_append(proto[1], psm); -+ apseq = sdp_list_append(0, proto[1]); -+ -+ sdp_uuid16_create(&hidp_uuid, HIDP_UUID); -+ proto[2] = sdp_list_append(0, &hidp_uuid); -+ apseq = sdp_list_append(apseq, proto[2]); -+ -+ aproto = sdp_list_append(0, apseq); -+ sdp_set_access_protos(record, aproto); -+ -+ /* additional protocols */ -+ proto[1] = sdp_list_append(0, &l2cap_uuid); -+ psm = sdp_data_alloc(SDP_UINT16, &intr); -+ proto[1] = sdp_list_append(proto[1], psm); -+ apseq = sdp_list_append(0, proto[1]); -+ -+ sdp_uuid16_create(&hidp_uuid, HIDP_UUID); -+ proto[2] = sdp_list_append(0, &hidp_uuid); -+ apseq = sdp_list_append(apseq, proto[2]); -+ -+ aproto = sdp_list_append(0, apseq); -+ sdp_set_add_access_protos(record, aproto); -+ -+ sdp_set_info_attr(record, "Wireless Controller", -+ "Sony Computer Entertainment", -+ "Wireless Controller"); -+ -+ hid_release = 0x0100; -+ sdp_attr_add_new(record, SDP_ATTR_HID_DEVICE_RELEASE_NUMBER, SDP_UINT16, -+ &hid_release); -+ -+ hid_parser = 0x0100; -+ sdp_attr_add_new(record, SDP_ATTR_HID_PARSER_VERSION, SDP_UINT16, -+ &hid_parser); -+ -+ subclass = 0x00; -+ sdp_attr_add_new(record, SDP_ATTR_HID_DEVICE_SUBCLASS, SDP_UINT8, -+ &subclass); -+ -+ country = 0x21; -+ sdp_attr_add_new(record, SDP_ATTR_HID_COUNTRY_CODE, SDP_UINT8, -+ &country); -+ -+ virtual_cable = 0x01; -+ sdp_attr_add_new(record, SDP_ATTR_HID_VIRTUAL_CABLE, SDP_BOOL, -+ &virtual_cable); -+ -+ reconnect = 0x01; -+ sdp_attr_add_new(record, SDP_ATTR_HID_RECONNECT_INITIATE, SDP_BOOL, -+ &reconnect); -+ -+ dtds[0] = &dtd2; -+ values[0] = &hid_spec_type; -+ dtds[1] = &dtd_data; -+ values[1] = hid_spec; -+ leng[0] = 0; -+ leng[1] = sizeof(hid_spec); -+ hid_spec_lst = sdp_seq_alloc_with_length(dtds, values, leng, 2); -+ hid_spec_lst2 = sdp_data_alloc(SDP_SEQ8, hid_spec_lst); -+ sdp_attr_add(record, SDP_ATTR_HID_DESCRIPTOR_LIST, hid_spec_lst2); -+ -+ dtds2[0] = &dtd; -+ values2[0] = &hid_attr_lang[0]; -+ dtds2[1] = &dtd; -+ values2[1] = &hid_attr_lang[1]; -+ lang_lst = sdp_seq_alloc(dtds2, values2, sizeof(hid_attr_lang) / 2); -+ lang_lst2 = sdp_data_alloc(SDP_SEQ8, lang_lst); -+ sdp_attr_add(record, SDP_ATTR_HID_LANG_ID_BASE_LIST, lang_lst2); -+ -+ sdp_disable = 0x00; -+ sdp_attr_add_new(record, SDP_ATTR_HID_SDP_DISABLE, SDP_BOOL, -+ &sdp_disable); -+ -+ battery = 0x01; -+ sdp_attr_add_new(record, SDP_ATTR_HID_BATTERY_POWER, SDP_BOOL, -+ &battery); -+ -+ remote_wakeup = 0x01; -+ sdp_attr_add_new(record, SDP_ATTR_HID_REMOTE_WAKEUP, SDP_BOOL, -+ &remote_wakeup); -+ -+ version = 0x0100; -+ sdp_attr_add_new(record, SDP_ATTR_HID_PROFILE_VERSION, SDP_UINT16, -+ &version); -+ -+ timeout = 0x3e80; -+ sdp_attr_add_new(record, SDP_ATTR_HID_SUPERVISION_TIMEOUT, SDP_UINT16, -+ &timeout); -+ -+ norm_connect = 0x00; -+ sdp_attr_add_new(record, SDP_ATTR_HID_NORMALLY_CONNECTABLE, SDP_BOOL, -+ &norm_connect); -+ -+ boot_device = 0x00; -+ sdp_attr_add_new(record, SDP_ATTR_HID_BOOT_DEVICE, SDP_BOOL, -+ &boot_device); -+ -+ return record; -+} -+ - static bool setup_device(int fd, int index, struct btd_adapter *adapter) - { - char device_addr[18], master_addr[18], adapter_addr[18]; -@@ -316,6 +481,7 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter) - devices[index].version); - - btd_device_set_temporary(device, false); -+ btd_device_set_record(device, HID_UUID, get_sdp_record()); - - return true; - } --- -2.1.4 - diff --git a/packages/network/bluez/patches/bluez-14_sixaxis-remove-not-needed-checks.patch b/packages/network/bluez/patches/bluez-14_sixaxis-remove-not-needed-checks.patch deleted file mode 100644 index 04caec68c0..0000000000 --- a/packages/network/bluez/patches/bluez-14_sixaxis-remove-not-needed-checks.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Szymon Janc -Subject: [PATCH 4/5] profiles/input: Remove not needed sixaxis checks -Newsgroups: gmane.linux.bluez.kernel -Date: 2015-06-15 18:28:29 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) - -This check is now needed only for DualShock 4. ---- - profiles/input/server.c | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/profiles/input/server.c b/profiles/input/server.c -index eb3fcf8..101108b 100644 ---- a/profiles/input/server.c -+++ b/profiles/input/server.c -@@ -131,18 +131,10 @@ static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst) - vid = btd_device_get_vendor(device); - pid = btd_device_get_product(device); - -- /* DualShock 3 */ -- if (vid == 0x054c && pid == 0x0268) -- return true; -- - /* DualShock 4 */ - if (vid == 0x054c && pid == 0x05c4) - return true; - -- /* Navigation Controller */ -- if (vid == 0x054c && pid == 0x042f) -- return true; -- - return false; - } - --- -2.1.4 - diff --git a/packages/network/bluez/patches/bluez-15_sixaxis-fix-multi-line-comments-style.patch b/packages/network/bluez/patches/bluez-15_sixaxis-fix-multi-line-comments-style.patch deleted file mode 100644 index ac8f462fbf..0000000000 --- a/packages/network/bluez/patches/bluez-15_sixaxis-fix-multi-line-comments-style.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Szymon Janc -Subject: [PATCH 5/5] sixaxis: Fix multi-line comments style -Newsgroups: gmane.linux.bluez.kernel -Date: 2015-06-15 18:28:30 GMT (36 weeks, 4 days, 21 hours and 33 minutes ago) - ---- - plugins/sixaxis.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c -index 782a89f..9b6cad4 100644 ---- a/plugins/sixaxis.c -+++ b/plugins/sixaxis.c -@@ -435,9 +435,11 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter) - if (get_master_bdaddr(fd, &master_bdaddr) < 0) - return false; - -- /* This can happen if controller was plugged while already connected -+ /* -+ * This can happen if controller was plugged while already connected - * eg. to charge up battery. -- * Don't set LEDs in that case, hence return false */ -+ * Don't set LEDs in that case, hence return false -+ */ - device = btd_adapter_find_device(adapter, &device_bdaddr, - BDADDR_BREDR); - if (device && btd_device_is_connected(device)) -@@ -533,8 +535,10 @@ static int get_js_number(struct udev_device *udevice) - if (!input_parent) - goto next; - -- /* check if this is the joystick relative to the hidraw device -- * above */ -+ /* -+ * check if this is the joystick relative to the hidraw device -+ * above -+ */ - input_id = udev_device_get_sysattr_value(input_parent, "uniq"); - - /* --- -2.1.4 - diff --git a/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch b/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch index e6daa7321a..a2ed445ba2 100644 --- a/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch +++ b/packages/network/bluez/patches/bluez-20-sixaxis-autotrust.patch @@ -1,11 +1,10 @@ -diff -Naur bluez-5.37/plugins/sixaxis.c bluez-5.37.patch/plugins/sixaxis.c ---- bluez-5.37/plugins/sixaxis.c 2016-04-21 21:38:45.805962009 +0200 -+++ bluez-5.37.patch/plugins/sixaxis.c 2016-04-24 15:22:36.852107941 +0200 -@@ -484,6 +484,7 @@ - devices[index].version); +--- a/plugins/sixaxis.c ++++ b/plugins/sixaxis.c +@@ -370,6 +370,7 @@ + else + btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); - btd_device_set_temporary(device, false); + btd_device_set_trusted(device, true); - btd_device_set_record(device, HID_UUID, get_sdp_record()); + btd_device_set_temporary(device, true); - return true; + closure = g_new0(struct authentication_closure, 1); diff --git a/packages/network/bluez/patches/bluez-21-hciattach-add-QCA9377-Tuffello-support.patch b/packages/network/bluez/patches/bluez-21-hciattach-add-QCA9377-Tuffello-support.patch new file mode 100644 index 0000000000..3d7ecabc6e --- /dev/null +++ b/packages/network/bluez/patches/bluez-21-hciattach-add-QCA9377-Tuffello-support.patch @@ -0,0 +1,2396 @@ +From 61f6745f6aac46fffc69f3c96112633cb1793fdf Mon Sep 17 00:00:00 2001 +From: Gary Bisson +Date: Wed, 17 Aug 2016 11:36:28 +0200 +Subject: [PATCH] hciattach: add QCA9377 Tuffello support + +From CodeAurora repository: +https://source.codeaurora.org/quic/la/platform/external/bluetooth/bluez/ + +Modifications: +- code indentation +- remove verbose traces +- use H4 protocol instead of IBS + +Signed-off-by: Gary Bisson +--- + Makefile.tools | 1 + + android/Android.mk | 1 + + tools/hciattach.c | 12 + + tools/hciattach.h | 1 + + tools/hciattach_rome.c | 1879 ++++++++++++++++++++++++++++++++++++++++++++++++ + tools/hciattach_rome.h | 407 +++++++++++ + 6 files changed, 2301 insertions(+) + create mode 100644 tools/hciattach_rome.c + create mode 100644 tools/hciattach_rome.h + +diff --git a/Makefile.tools b/Makefile.tools +index 561302fa1..756fed1af 100644 +--- a/Makefile.tools ++++ b/Makefile.tools +@@ -308,6 +308,7 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \ + tools/hciattach_ti.c \ + tools/hciattach_tialt.c \ + tools/hciattach_ath3k.c \ ++ tools/hciattach_rome.c \ + tools/hciattach_qualcomm.c \ + tools/hciattach_intel.c \ + tools/hciattach_bcm43xx.c +diff --git a/android/Android.mk b/android/Android.mk +index 38ef4aa97..d5045dacd 100644 +--- a/android/Android.mk ++++ b/android/Android.mk +@@ -695,6 +695,7 @@ LOCAL_SRC_FILES := \ + bluez/tools/hciattach_ti.c \ + bluez/tools/hciattach_tialt.c \ + bluez/tools/hciattach_ath3k.c \ ++ bluez/tools/hciattach_rome.c \ + bluez/tools/hciattach_qualcomm.c \ + bluez/tools/hciattach_intel.c \ + bluez/tools/hciattach_bcm43xx.c \ +diff --git a/tools/hciattach.c b/tools/hciattach.c +index fad176c9b..02a65c692 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -263,6 +263,11 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + return ath3k_post(fd, u->pm); + } + ++static int qca(int fd, struct uart_t *u, struct termios *ti) ++{ ++ return qca_soc_init(fd, u->speed, u->bdaddr); ++} ++ + static int qualcomm(int fd, struct uart_t *u, struct termios *ti) + { + return qualcomm_init(fd, u->speed, ti, u->bdaddr); +@@ -1093,6 +1098,10 @@ struct uart_t uart[] = { + { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + ++ /* QCA ROME */ ++ { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, ++ FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, ++ + /* QUALCOMM BTS */ + { "qualcomm", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, qualcomm, NULL }, +@@ -1145,6 +1154,9 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) + if (u->flags & AMP_DEV) + flags |= 1 << HCI_UART_CREATE_AMP; + ++ if (!strncmp(u->type, "qca", 3)) ++ flags |= 1 << HCI_UART_RESET_ON_INIT; ++ + fd = open(dev, O_RDWR | O_NOCTTY); + if (fd < 0) { + perror("Can't open serial port"); +diff --git a/tools/hciattach.h b/tools/hciattach.h +index 249aab49e..85c801ccf 100644 +--- a/tools/hciattach.h ++++ b/tools/hciattach.h +@@ -65,6 +65,7 @@ int bgb2xx_init(int dd, bdaddr_t *bdaddr); + int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, + struct termios *ti); + int ath3k_post(int fd, int pm); ++int qca_soc_init(int fd, int speed, char *bdaddr); + int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); + int intel_init(int fd, int init_speed, int *speed, struct termios *ti); + int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +new file mode 100644 +index 000000000..2586dbc77 +--- /dev/null ++++ b/tools/hciattach_rome.c +@@ -0,0 +1,1879 @@ ++/* ++ * ++ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. ++ * Not a Contribution. ++ * ++ * Copyright 2012 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); you ++ * may not use this file except in compliance with the License. You may ++ * obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ++ * implied. See the License for the specific language governing ++ * permissions and limitations under the License. ++ * ++ */ ++ ++/****************************************************************************** ++ * ++ * Filename: hciattach_rome.c ++ * ++ * Description: Contains controller-specific functions, like ++ * firmware patch download ++ * low power mode operations ++ * ++ ******************************************************************************/ ++ ++#define LOG_TAG "bt_vendor" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "hciattach_rome.h" ++#include "hciattach.h" ++ ++/****************************************************************************** ++ ** Variables ++ ******************************************************************************/ ++FILE *file; ++unsigned char *phdr_buffer; ++unsigned char *pdata_buffer = NULL; ++patch_info rampatch_patch_info; ++int rome_ver = ROME_VER_UNKNOWN; ++unsigned char gTlv_type; ++unsigned char gtlv_dwndcfg; ++char *rampatch_file_path; ++char *nvm_file_path; ++vnd_userial_cb_t vnd_userial; ++unsigned char wait_vsc_evt = TRUE; ++ ++/***************************************************************************** ++ ** Functions ++ *****************************************************************************/ ++ ++/******************************************************************************* ++ ** ++ ** Function userial_to_tcio_baud ++ ** ++ ** Description helper function converts USERIAL baud rates into TCIO ++ ** conforming baud rates ++ ** ++ ** Returns TRUE/FALSE ++ ** ++ *******************************************************************************/ ++unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud) ++{ ++ if (cfg_baud == USERIAL_BAUD_115200) ++ *baud = B115200; ++ else if (cfg_baud == USERIAL_BAUD_4M) ++ *baud = B4000000; ++ else if (cfg_baud == USERIAL_BAUD_3M) ++ *baud = B3000000; ++ else if (cfg_baud == USERIAL_BAUD_2M) ++ *baud = B2000000; ++ else if (cfg_baud == USERIAL_BAUD_1M) ++ *baud = B1000000; ++ else if (cfg_baud == USERIAL_BAUD_921600) ++ *baud = B921600; ++ else if (cfg_baud == USERIAL_BAUD_460800) ++ *baud = B460800; ++ else if (cfg_baud == USERIAL_BAUD_230400) ++ *baud = B230400; ++ else if (cfg_baud == USERIAL_BAUD_57600) ++ *baud = B57600; ++ else if (cfg_baud == USERIAL_BAUD_19200) ++ *baud = B19200; ++ else if (cfg_baud == USERIAL_BAUD_9600) ++ *baud = B9600; ++ else if (cfg_baud == USERIAL_BAUD_1200) ++ *baud = B1200; ++ else if (cfg_baud == USERIAL_BAUD_600) ++ *baud = B600; ++ else { ++ fprintf(stderr, "userial vendor open: unsupported baud idx %i\n", cfg_baud); ++ *baud = B115200; ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ ++ ++/******************************************************************************* ++ ** ++ ** Function userial_vendor_set_baud ++ ** ++ ** Description Set new baud rate ++ ** ++ ** Returns None ++ ** ++ *******************************************************************************/ ++void userial_vendor_set_baud(unsigned char userial_baud) ++{ ++ unsigned int tcio_baud; ++ ++ if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) { ++ perror("Can't get port settings"); ++ return; ++ } ++ cfmakeraw(&vnd_userial.termios); ++ vnd_userial.termios.c_cflag |= CLOCAL; ++ vnd_userial.termios.c_cflag |= CREAD; ++ vnd_userial.termios.c_cflag |= CS8; ++ tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); ++ ++ userial_to_tcio_baud(userial_baud, &tcio_baud); ++ ++ cfsetospeed(&vnd_userial.termios, tcio_baud); ++ cfsetispeed(&vnd_userial.termios, tcio_baud); ++ tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */ ++ ++} ++ ++ ++/******************************************************************************* ++ ** ++ ** Function userial_vendor_ioctl ++ ** ++ ** Description ioctl inteface ++ ** ++ ** Returns None ++ ** ++ *******************************************************************************/ ++int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) ++{ ++ int err = -1; ++ struct termios ti; ++ ++ if (tcgetattr(fd, &ti) < 0) { ++ perror("Can't get port settings"); ++ return -1; ++ } ++ cfmakeraw(&ti); ++ ti.c_cflag |= CLOCAL; ++ ti.c_cflag |= CREAD; ++ ti.c_cflag |= CS8; ++ ++ switch(op) { ++#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) ++ case USERIAL_OP_ASSERT_BT_WAKE: ++ VNDUSERIALDBG("## userial_vendor_ioctl: Asserting BT_Wake ##"); ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_ASSERT, NULL); ++ break; ++ ++ case USERIAL_OP_DEASSERT_BT_WAKE: ++ VNDUSERIALDBG("## userial_vendor_ioctl: De-asserting BT_Wake ##"); ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL); ++ break; ++ ++ case USERIAL_OP_GET_BT_WAKE_STATE: ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_GET_ST, p_data); ++ break; ++#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) ++ case USERIAL_OP_FLOW_ON: ++ ti.c_cflag |= CRTSCTS; ++ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { ++ perror("Can't set port settings"); ++ return -1; ++ } ++ ++ break; ++ ++ case USERIAL_OP_FLOW_OFF: ++ ti.c_cflag &= ~CRTSCTS; ++ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { ++ fprintf(stderr, "Can't set port settings"); ++ return -1; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return err; ++} ++ ++ ++int get_vs_hci_event(unsigned char *rsp) ++{ ++ int err = 0, soc_id =0; ++ unsigned char paramlen = 0; ++ ++ if ( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) ++ PR_DBG("%s: Received HCI-Vendor Specific event\n", __FUNCTION__); ++ else { ++ fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__); ++ err = -EIO; ++ goto failed; ++ } ++ ++ /* Check the status of the operation */ ++ switch ( rsp[CMD_RSP_OFFSET] ) { ++ case EDL_CMD_REQ_RES_EVT: ++ switch(rsp[RSP_TYPE_OFFSET]) { ++ case EDL_PATCH_VER_RES_EVT: ++ case EDL_APP_VER_RES_EVT: ++ PR_DBG("\t Current Product ID\t\t: 0x%08x\n", ++ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | ++ rsp[PATCH_PROD_ID_OFFSET+2] << 16 | ++ rsp[PATCH_PROD_ID_OFFSET+1] << 8 | ++ rsp[PATCH_PROD_ID_OFFSET] )); ++ ++ /* Patch Version indicates FW patch version */ ++ PR_DBG("\t Current Patch Version\t\t: 0x%04x\n", ++ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_PATCH_VER_OFFSET] )); ++ ++ /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ ++ rome_ver = (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_ROM_BUILD_VER_OFFSET]); ++ PR_DBG("\t Current ROM Build Version\t: 0x%04x\n", rome_ver); ++ ++ /* In case rome 1.0/1.1, there is no SOC ID version available */ ++ if (paramlen - 10) { ++ soc_id = (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | ++ rsp[PATCH_SOC_VER_OFFSET+2] << 16 | ++ rsp[PATCH_SOC_VER_OFFSET+1] << 8 | ++ rsp[PATCH_SOC_VER_OFFSET]); ++ PR_DBG("\t Current SOC Version\t\t: 0x%08x\n", soc_id); ++ } ++ ++ /* Rome Chipset Version can be decided by Patch version and SOC version, ++ Upper 2 bytes will be used for Patch version and Lower 2 bytes will be ++ used for SOC as combination for BT host driver */ ++ rome_ver = (rome_ver << 16) | (soc_id & 0x0000ffff); ++ break; ++ case EDL_TVL_DNLD_RES_EVT: ++ case EDL_CMD_EXE_STATUS_EVT: ++ switch (err = rsp[CMD_STATUS_OFFSET]) { ++ case HCI_CMD_SUCCESS: ++ PR_DBG("%s: Download Packet successfully!\n", __FUNCTION__); ++ break; ++ case PATCH_LEN_ERROR: ++ fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH " ++ "SET REQ cmd\n", __FUNCTION__); ++ break; ++ case PATCH_VER_ERROR: ++ fprintf(stderr, "%s: Invalid patch version argument passed for EDL PATCH " ++ "SET REQ cmd\n", __FUNCTION__); ++ break; ++ case PATCH_CRC_ERROR: ++ fprintf(stderr, "%s: CRC check of patch failed!!!\n", __FUNCTION__); ++ break; ++ case PATCH_NOT_FOUND: ++ fprintf(stderr, "%s: Invalid patch data!!!\n", __FUNCTION__); ++ break; ++ case TLV_TYPE_ERROR: ++ fprintf(stderr, "%s: TLV Type Error !!!\n", __FUNCTION__); ++ break; ++ default: ++ fprintf(stderr, "%s: Undefined error (0x%x)", __FUNCTION__, err); ++ break; ++ } ++ break; ++ } ++ break; ++ ++ case NVM_ACCESS_CODE: ++ PR_DBG("%s: NVM Access Code!!!\n", __FUNCTION__); ++ err = HCI_CMD_SUCCESS; ++ break; ++ case EDL_SET_BAUDRATE_RSP_EVT: ++ /* Rome 1.1 has bug with the response, so it should ignore it. */ ++ if (rsp[BAUDRATE_RSP_STATUS_OFFSET] != BAUDRATE_CHANGE_SUCCESS) { ++ fprintf(stderr, "%s: Set Baudrate request failed - 0x%x\n", __FUNCTION__, ++ rsp[CMD_STATUS_OFFSET]); ++ err = -1; ++ } ++ break; ++ default: ++ fprintf(stderr, "%s: Not a valid status!!!\n", __FUNCTION__); ++ err = -1; ++ break; ++ } ++ ++failed: ++ return err; ++} ++ ++ ++int wait_for_data(int fd, int maxTimeOut) ++{ ++ fd_set infids; ++ struct timeval timeout; ++ ++ if (maxTimeOut <= 0) { ++ fprintf(stderr, "%s: Invalid timeout value specified", __func__); ++ return -EINVAL; ++ } ++ ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = maxTimeOut; ++ timeout.tv_usec = 0; ++ ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { ++ fprintf(stderr, "%s: Timing out on select for %d secs.\n", __FUNCTION__, maxTimeOut); ++ return -1; ++ } ++ ++ return 1; ++} ++ ++/* ++ * Read an VS HCI event from the given file descriptor. ++ */ ++int read_vs_hci_event(int fd, unsigned char* buf, int size) ++{ ++ int remain, r, retry = 0; ++ int count = 0; ++ ++ if (size <= 0) { ++ fprintf(stderr, "Invalid size arguement!\n"); ++ return -1; ++ } ++ ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) ++ return -1; ++ ++ /* The first byte identifies the packet type. For HCI event packets, it ++ * should be 0x04, so we read until we get to the 0x04. */ ++ /* It will keep reading until find 0x04 byte */ ++ while (1) { ++ /* Read UART Buffer for HCI-DATA */ ++ r = read(fd, buf, 1); ++ if (r <= 0) { ++ fprintf(stderr, "%s: read() failed. error: %d\n", ++ __FUNCTION__, r); ++ return -1; ++ } ++ ++ /* Check if received data is HCI-DATA or not. ++ * If not HCI-DATA, then retry reading the UART Buffer once. ++ * Sometimes there could be corruption on the UART lines and to ++ * avoid that retry once reading the UART Buffer for HCI-DATA. ++ */ ++ if (buf[0] == 0x04) { /* Recvd. HCI DATA */ ++ retry = 0; ++ break; ++ } ++ else if (retry < MAX_RETRY_CNT) { /* Retry mechanism */ ++ retry++; ++ fprintf(stderr, "%s: Not an HCI-VS-Event! buf[0]: %d", ++ __FUNCTION__, buf[0]); ++ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) ++ return -1; ++ else /* Data available in UART Buffer: Continue to read */ ++ continue; ++ } ++ else { /* RETRY failed : Exiting with failure */ ++ fprintf(stderr, "%s: RETRY failed!", __FUNCTION__); ++ return -1; ++ } ++ } ++ count++; ++ ++ /* The next two bytes are the event code and parameter total length. */ ++ while (count < 3) { ++ r = read(fd, buf + count, 3 - count); ++ if ((r <= 0) || (buf[1] != 0xFF )) { ++ fprintf(stderr, "It is not VS event !!\n"); ++ return -1; ++ } ++ count += r; ++ } ++ ++ /* Now we read the parameters. */ ++ if (buf[2] < (size - 3)) ++ remain = buf[2]; ++ else ++ remain = size - 3; ++ ++ while ((count - 3) < remain) { ++ r = read(fd, buf + count, remain - (count - 3)); ++ if (r <= 0) ++ return -1; ++ count += r; ++ } ++ ++ /* Check if the set patch command is successful or not */ ++ if (get_vs_hci_event(buf) != HCI_CMD_SUCCESS) ++ return -1; ++ ++ return count; ++} ++ ++ ++int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) ++{ ++ int ret = 0; ++ ++ /* Send the HCI command packet to UART for transmission */ ++ ret = write(fd, cmd, size); ++ if (ret != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, ret); ++ goto failed; ++ } ++ ++ if (wait_vsc_evt) { ++ /* Check for response from the Controller */ ++ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { ++ ret = -ETIMEDOUT; ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto failed; ++ } ++ } ++ ++failed: ++ return ret; ++} ++ ++void frame_hci_cmd_pkt( ++ unsigned char *cmd, ++ int edl_cmd, unsigned int p_base_addr, ++ int segtNo, int size ++ ) ++{ ++ int offset = 0; ++ hci_command_hdr *cmd_hdr; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, HCI_PATCH_CMD_OCF); ++ cmd_hdr->plen = size; ++ cmd[4] = edl_cmd; ++ ++ switch (edl_cmd) { ++ case EDL_PATCH_SET_REQ_CMD: ++ /* Copy the patch header info as CMD params */ ++ memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN); ++ PR_DBG("%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); ++ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_DLD_REQ_CMD: ++ offset = ((segtNo - 1) * MAX_DATA_PER_SEGMENT); ++ p_base_addr += offset; ++ cmd_hdr->plen = (size + 6); ++ cmd[5] = (size + 4); ++ cmd[6] = EXTRACT_BYTE(p_base_addr, 0); ++ cmd[7] = EXTRACT_BYTE(p_base_addr, 1); ++ cmd[8] = EXTRACT_BYTE(p_base_addr, 2); ++ cmd[9] = EXTRACT_BYTE(p_base_addr, 3); ++ memcpy(&cmd[10], (pdata_buffer + offset), size); ++ ++ PR_DBG("%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", ++ __FUNCTION__, size); ++ PR_DBG("HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" ++ "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2], ++ cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]); ++ break; ++ case EDL_PATCH_ATCH_REQ_CMD: ++ PR_DBG("%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); ++ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_RST_REQ_CMD: ++ PR_DBG("%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); ++ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_VER_REQ_CMD: ++ PR_DBG("%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); ++ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_TLV_REQ_CMD: ++ PR_DBG("%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); ++ /* Parameter Total Length */ ++ cmd[3] = size +2; ++ ++ /* TLV Segment Length */ ++ cmd[5] = size; ++ PR_DBG("HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); ++ offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT); ++ memcpy(&cmd[6], (pdata_buffer + offset), size); ++ break; ++ default: ++ fprintf(stderr, "%s: Unknown EDL CMD !!!\n", __FUNCTION__); ++ } ++} ++ ++void rome_extract_patch_header_info(unsigned char *buf) ++{ ++ int index; ++ ++ /* Extract patch id */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_id |= ++ (LSH(buf[index + P_ID_OFFSET], (index * 8))); ++ ++ /* Extract (ROM and BUILD) version information */ ++ for (index = 0; index < 2; index++) ++ rampatch_patch_info.patch_ver.rom_version |= ++ (LSH(buf[index + P_ROME_VER_OFFSET], (index * 8))); ++ ++ for (index = 0; index < 2; index++) ++ rampatch_patch_info.patch_ver.build_version |= ++ (LSH(buf[index + P_BUILD_VER_OFFSET], (index * 8))); ++ ++ /* Extract patch base and entry addresses */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_base_addr |= ++ (LSH(buf[index + P_BASE_ADDR_OFFSET], (index * 8))); ++ ++ /* Patch BASE & ENTRY addresses are same */ ++ rampatch_patch_info.patch_entry_addr = rampatch_patch_info.patch_base_addr; ++ ++ /* Extract total length of the patch payload */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_length |= ++ (LSH(buf[index + P_LEN_OFFSET], (index * 8))); ++ ++ /* Extract the CRC checksum of the patch payload */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_crc |= ++ (LSH(buf[index + P_CRC_OFFSET], (index * 8))); ++ ++ /* Extract patch control value */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_ctrl |= ++ (LSH(buf[index + P_CONTROL_OFFSET], (index * 8))); ++ ++ fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); ++ fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); ++ fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); ++ fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); ++ fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); ++ fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); ++ fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); ++ ++} ++ ++int rome_edl_set_patch_request(int fd) ++{ ++ int size, err; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_SET_REQ_CMD, 0, ++ -1, PATCH_HDR_LEN + 1); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to set the patch info to the Controller!\n"); ++ goto error; ++ } ++ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++} ++ ++int rome_edl_patch_download_request(int fd) ++{ ++ int no_of_patch_segment; ++ int index = 1, err = 0, size = 0; ++ unsigned int p_base_addr; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ no_of_patch_segment = (rampatch_patch_info.patch_length / ++ MAX_DATA_PER_SEGMENT); ++ ++ /* Initialize the patch base address from the one read from bin file */ ++ p_base_addr = rampatch_patch_info.patch_base_addr; ++ ++ /* ++ * Depending upon size of the patch payload, download the patches in ++ * segments with a max. size of 239 bytes ++ */ ++ for (index = 1; index <= no_of_patch_segment; index++) { ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, ++ index, MAX_DATA_PER_SEGMENT); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", ++ __FUNCTION__, index); ++ goto error; ++ } ++ } ++ ++ /* Check if any pending patch data to be sent */ ++ size = (rampatch_patch_info.patch_length < MAX_DATA_PER_SEGMENT) ? ++ rampatch_patch_info.patch_length : ++ (rampatch_patch_info.patch_length % MAX_DATA_PER_SEGMENT); ++ ++ if (size) { ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, index, size); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", ++ __FUNCTION__, index); ++ goto error; ++ } ++ } ++ ++error: ++ return err; ++} ++ ++static int rome_download_rampatch(int fd) ++{ ++ int c, size, index, ret = -1; ++ ++ /* Get handle to the RAMPATCH binary file */ ++ fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); ++ file = fopen(ROME_FW_PATH, "r"); ++ if (file == NULL) { ++ fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n", ++ __FUNCTION__); ++ return -ENFILE; ++ } ++ ++ /* Allocate memory for the patch headder info */ ++ fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); ++ phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1); ++ if (phdr_buffer == NULL) { ++ fprintf(stderr, "%s: Failed to allocate memory for patch header\n", ++ __FUNCTION__); ++ goto phdr_alloc_failed; ++ } ++ for (index = 0; index < PATCH_HDR_LEN + 1; index++) ++ phdr_buffer[index] = 0x0; ++ ++ /* Read 28 bytes of patch header information */ ++ fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); ++ index = 0; ++ do { ++ c = fgetc (file); ++ phdr_buffer[index++] = (unsigned char)c; ++ } while (index != PATCH_HDR_LEN); ++ ++ /* Save the patch header info into local structure */ ++ fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); ++ rome_extract_patch_header_info((unsigned char *)phdr_buffer); ++ ++ /* Set the patch header info onto the Controller */ ++ ret = rome_edl_set_patch_request(fd); ++ if (ret < 0) { ++ fprintf(stderr, "%s: Error setting the patchheader info!\n", __FUNCTION__); ++ goto pdata_alloc_failed; ++ } ++ ++ /* Allocate memory for the patch payload */ ++ fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); ++ size = rampatch_patch_info.patch_length; ++ pdata_buffer = (unsigned char *) malloc(size+1); ++ if (pdata_buffer == NULL) { ++ fprintf(stderr, "%s: Failed to allocate memory for patch payload\n", ++ __FUNCTION__); ++ goto pdata_alloc_failed; ++ } ++ for (index = 0; index < size+1; index++) ++ pdata_buffer[index] = 0x0; ++ ++ /* Read the patch data from Rampatch binary image */ ++ fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); ++ index = 0; ++ do { ++ c = fgetc (file); ++ pdata_buffer[index++] = (unsigned char)c; ++ } while (c != EOF); ++ ++ /* Downloading patches in segments to controller */ ++ ret = rome_edl_patch_download_request(fd); ++ if (ret < 0) { ++ fprintf(stderr, "%s: Error downloading patch segments!\n", __FUNCTION__); ++ goto cleanup; ++ } ++cleanup: ++ free(pdata_buffer); ++pdata_alloc_failed: ++ free(phdr_buffer); ++phdr_alloc_failed: ++ fclose(file); ++ ++ return ret; ++} ++ ++int rome_attach_rampatch(int fd) ++{ ++ int size, err; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_ATCH_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to attach the patch segment(s)\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++} ++ ++int rome_rampatch_reset(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ struct timespec tm = { 0, 100*1000*1000 }; /* 100 ms */ ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_RST_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ ++ /* Send HCI Command packet to Controller */ ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* ++ * Controller doesn't sends any response for the patch reset ++ * command. HOST has to wait for 100ms before proceeding. ++ */ ++ nanosleep(&tm, NULL); ++ ++error: ++ return err; ++} ++ ++int get_value_from_config(char *file_path,char *param) ++{ ++ FILE *pfile = NULL; ++ char *line = NULL; ++ char *pch = NULL; ++ char param_str[20]; ++ int bytes_read = 0, position; ++ int ret = -1; ++ ++ if (!file_path || !param) { ++ fprintf(stderr,"Invalid arguments\n"); ++ return -EINVAL; ++ } ++ ++ pfile = fopen(file_path, "r" ); ++ if (!pfile) { ++ fprintf(stderr, "Failed to open %s\n", file_path); ++ return ret; ++ } ++ ++ while (getline(&line, &bytes_read, pfile) > 0 ) { ++ if (line[0] != '#' && line[0] != '\n') { ++ pch = memchr(line, '=', strlen(line)); ++ if (pch != NULL) { ++ position = pch - line; ++ strncpy(param_str, line, position); ++ if (strncmp(param_str, param, position) == 0) { ++ ret = atoi(pch + 1); ++ break; ++ } ++ } ++ } ++ } ++ free(line); ++ fclose(pfile); ++ return ret; ++} ++ ++int read_bd_address(unsigned char *bdaddr) ++{ ++ int fd = -1; ++ int readPtr = 0; ++ unsigned char data[BD_ADDR_LEN]; ++ ++ /* Open the persist file for reading device address*/ ++ fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY); ++ if (fd < 0) { ++ fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__); ++ return -1; ++ } ++ ++ /* Read the NVM Header : fp will be advanced by readPtr number of bytes */ ++ readPtr = read(fd, data, PERSIST_HEADER_LEN); ++ if (readPtr > 0) ++ fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__, ++ data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]); ++ else { ++ fprintf(stderr, "%s: Read from persist memory failed : Programming default" ++ " BD ADDR\n"); ++ close(fd); ++ return -1; ++ } ++ ++ /* Check for BD ADDR length before programming */ ++ if (data[NVITEM_SIZE] != BD_ADDR_LEN) { ++ fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n"); ++ close(fd); ++ return -1; ++ } ++ ++ /* Read the BD ADDR info */ ++ readPtr = read(fd, data, BD_ADDR_LEN); ++ if (readPtr > 0) ++ fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0], ++ data[1], data[2], data[3], data[4], data[5]); ++ else { ++ fprintf(stderr, "%s: Read from persist memory failed : Programming default" ++ " BD ADDR\n"); ++ close(fd); ++ return -1; ++ } ++ memcpy(bdaddr, data, BD_ADDR_LEN); ++ close(fd); ++ return 0; ++} ++ ++int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) ++{ ++ switch(speed) { ++ case 9600: ++ *local_baud_rate = USERIAL_BAUD_9600; ++ *controller_baud_rate = BAUDRATE_9600; ++ break; ++ case 19200: ++ *local_baud_rate = USERIAL_BAUD_19200; ++ *controller_baud_rate = BAUDRATE_19200; ++ break; ++ case 57600: ++ *local_baud_rate = USERIAL_BAUD_57600; ++ *controller_baud_rate = BAUDRATE_57600; ++ break; ++ case 115200: ++ *local_baud_rate = USERIAL_BAUD_115200; ++ *controller_baud_rate = BAUDRATE_115200; ++ break; ++ case 230400: ++ *local_baud_rate = USERIAL_BAUD_230400; ++ *controller_baud_rate = BAUDRATE_230400; ++ break; ++ case 460800: ++ *local_baud_rate = USERIAL_BAUD_460800; ++ *controller_baud_rate = BAUDRATE_460800; ++ break; ++ case 921600: ++ *local_baud_rate = USERIAL_BAUD_921600; ++ *controller_baud_rate = BAUDRATE_921600; ++ break; ++ case 1000000: ++ *local_baud_rate = USERIAL_BAUD_1M; ++ *controller_baud_rate = BAUDRATE_1000000; ++ break; ++ case 2000000: ++ *local_baud_rate = USERIAL_BAUD_2M; ++ *controller_baud_rate = BAUDRATE_2000000; ++ break; ++ case 3000000: ++ *local_baud_rate = USERIAL_BAUD_3M; ++ *controller_baud_rate = BAUDRATE_3000000; ++ break; ++ case 4000000: ++ *local_baud_rate = USERIAL_BAUD_4M; ++ *controller_baud_rate = BAUDRATE_4000000; ++ break; ++ case 300: ++ case 600: ++ case 1200: ++ case 2400: ++ default: ++ fprintf(stderr, "Invalid baud rate passed!\n"); ++ *local_baud_rate = *controller_baud_rate = -1; ++ break; ++ } ++ return -1; ++} ++ ++int rome_get_tlv_file(char *file_path) ++{ ++ FILE * pFile; ++ long fileSize; ++ int readSize, nvm_length, nvm_index, i; ++ unsigned short nvm_tag_len; ++ tlv_patch_info *ptlv_header; ++ tlv_nvm_hdr *nvm_ptr; ++ unsigned char data_buf[PRINT_BUF_SIZE]={0,}; ++ unsigned char *nvm_byte_ptr; ++ unsigned char bdaddr[6]; ++ unsigned short pcm_value, ibs_value; ++ unsigned short deep_sleep_value; ++ ++ pFile = fopen ( file_path , "r" ); ++ if (pFile==NULL) { ++ fprintf(stderr, "%s File Open Fail\n", file_path); ++ return -1; ++ } ++ ++ /* Get File Size */ ++ fseek (pFile , 0 , SEEK_END); ++ ++ if ((fileSize = ftell(pFile)) < 0) { ++ fprintf(stderr, "%s: fail to get current file position\n", file_path); ++ fclose(pFile); ++ return -1; ++ } ++ ++ if (fileSize == 0) { ++ fprintf(stderr, "%s: no content in the file\n", file_path); ++ fclose(pFile); ++ return -1; ++ } ++ ++ rewind (pFile); ++ ++ pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); ++ if (pdata_buffer == NULL) { ++ fprintf(stderr, "Allocated Memory failed\n"); ++ fclose (pFile); ++ return -1; ++ } ++ ++ /* Copy file into allocated buffer */ ++ readSize = fread (pdata_buffer,1,fileSize,pFile); ++ ++ /* File Close */ ++ fclose (pFile); ++ ++ if (readSize != fileSize) { ++ fprintf(stderr, "Read file size(%d) not matched with actual file size (%ld bytes)\n",readSize,fileSize); ++ return -1; ++ } ++ ++ ptlv_header = (tlv_patch_info *) pdata_buffer; ++ ++ /* To handle different event between rampatch and NVM */ ++ gTlv_type = ptlv_header->tlv_type; ++ gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; ++ ++ if (ptlv_header->tlv_type == TLV_TYPE_PATCH) { ++ PR_DBG("====================================================\n"); ++ PR_DBG("TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ PR_DBG("Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ PR_DBG("Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); ++ PR_DBG("Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); ++ PR_DBG("Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); ++ PR_DBG("Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ PR_DBG("Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); ++ PR_DBG("Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); ++ PR_DBG("Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); ++ PR_DBG("Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); ++ PR_DBG("Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); ++ PR_DBG("Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); ++ PR_DBG("Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); ++ PR_DBG("====================================================\n"); ++ ++ } else if (ptlv_header->tlv_type == TLV_TYPE_NVM) { ++ PR_DBG("====================================================\n"); ++ PR_DBG("TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ PR_DBG("Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ ++ if (nvm_length <= 0) ++ return readSize; ++ ++ for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0; ++ nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr) { ++ PR_DBG("TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); ++ PR_DBG("TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len); ++ PR_DBG("TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); ++ PR_DBG("TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); ++ ++ /* Increase nvm_index to NVM data */ ++ nvm_index+=sizeof(tlv_nvm_hdr); ++ nvm_byte_ptr+=sizeof(tlv_nvm_hdr); ++ ++ /* Write BD Address */ ++ if (nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(bdaddr) == 0) { ++ memcpy(nvm_byte_ptr, bdaddr, 6); ++ PR_DBG("Overriding default BD ADDR with user" ++ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", ++ *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), ++ *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); ++ } ++ ++ if (nvm_ptr->tag_id == TAG_NUM_17) { ++ if ((ibs_value = ++ get_value_from_config(FW_CONFIG_FILE_PATH, "IBS")) >= 0) { ++ if (ibs_value == FWCONF_IBS_DISABLE) { ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= ++ (~(FWCONF_IBS_ENABLE << ++ FWCONF_IBS_VAL_BIT)); ++ } else if (ibs_value == FWCONF_IBS_ENABLE) { ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] |= ++ (FWCONF_IBS_ENABLE << ++ FWCONF_IBS_VAL_BIT); ++ } ++ } ++ } ++ ++ if (nvm_ptr->tag_id == TAG_NUM_27) { ++ if ((deep_sleep_value = ++ get_value_from_config(FW_CONFIG_FILE_PATH, "DEEP_SLEEP")) >= 0) { ++ if (deep_sleep_value == FWCONF_DEEP_SLEEP_DISABLE) { ++ nvm_byte_ptr[FWCONF_DEEP_SLEEP_BYTE_OFFSET] &= ++ (~(1 << FWCONF_DEEP_SLEEP_BIT_OFFSET)); ++ } else if (deep_sleep_value == FWCONF_DEEP_SLEEP_ENABLE) { ++ nvm_byte_ptr[FWCONF_DEEP_SLEEP_BYTE_OFFSET] |= ++ (1 << FWCONF_DEEP_SLEEP_BIT_OFFSET); ++ } else { ++ fprintf(stderr, "Ignoring invalid deep sleep config value\n"); ++ } ++ } ++ } ++ ++ /* Read from file and check what PCM Configuration is required: ++ * Master = 0 /Slave = 1 */ ++ /* Override PCM configuration */ ++ if (nvm_ptr->tag_id == TAG_NUM_44) { ++ if ((pcm_value = ++ get_value_from_config(FW_CONFIG_FILE_PATH, "PCM")) >= 0) { ++ ++ if (pcm_value == FWCONF_PCM_SLAVE) { ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] |= ++ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] |= ++ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); ++ } else if (pcm_value == FWCONF_PCM_MASTER) { ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] &= ++ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] &= ++ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); ++ } ++ } ++ } ++ ++ for(i =0;(itag_len && (i*3 + 2) < PRINT_BUF_SIZE);i++) ++ snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", ++ (char *)data_buf, *(nvm_byte_ptr + i)); ++ ++ PR_DBG("TAG Data\t\t\t : %s\n", data_buf); ++ ++ /* Clear buffer */ ++ memset(data_buf, 0x0, PRINT_BUF_SIZE); ++ ++ /* increased by tag_len */ ++ nvm_index+=nvm_ptr->tag_len; ++ nvm_byte_ptr +=nvm_ptr->tag_len; ++ } ++ ++ PR_DBG("====================================================\n"); ++ ++ } else { ++ fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); ++ } ++ ++ return readSize; ++} ++ ++int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc_evt) ++{ ++ int size=0, err = -1; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller! 0x%x\n", err); ++ return err; ++ } ++ ++ if (wait_cc_evt) { ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", __FUNCTION__, index); ++ return err; ++ } ++ } ++ ++ return err; ++} ++ ++int rome_tlv_dnld_req(int fd, int tlv_size) ++{ ++ int total_segment, remain_size, i, err = -1; ++ unsigned char wait_cc_evt = FALSE; ++ unsigned int rom = rome_ver >> 16; ++ ++ total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; ++ remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ ++ tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT); ++ ++ if (gTlv_type == TLV_TYPE_PATCH) { ++ /* Prior to Rome version 3.2(including inital few rampatch release of ++ * Rome 3.2), the event handling mechanism is ROME_SKIP_EVT_NONE. After ++ * few release of rampatch for Rome 3.2, the mechamism is changed to ++ * ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now ++ */ ++ switch (gtlv_dwndcfg) ++ { ++ case ROME_SKIP_EVT_NONE: ++ wait_vsc_evt = TRUE; ++ wait_cc_evt = TRUE; ++ PR_DBG("%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); ++ break; ++ case ROME_SKIP_EVT_VSE_CC: ++ wait_vsc_evt = FALSE; ++ wait_cc_evt = FALSE; ++ PR_DBG("%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); ++ break; ++ /* Not handled for now */ ++ case ROME_SKIP_EVT_VSE: ++ case ROME_SKIP_EVT_CC: ++ default: ++ fprintf(stderr, "%s: Unsupported Event handling: %d", __func__, gtlv_dwndcfg); ++ break; ++ } ++ } else { ++ wait_vsc_evt = TRUE; ++ wait_cc_evt = TRUE; ++ } ++ ++ for(i = 0; i < total_segment; i++) { ++ if ((i+1) == total_segment) { ++ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is from 1.1 to 3.1 ++ * 1. No CCE for the last command segment but all other segment ++ * 2. All the command segments get VSE including the last one ++ */ ++ wait_cc_evt = !remain_size ? FALSE: TRUE; ++ } else if ((rom == ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is 3.2 ++ * 1. None of the command segments receive CCE ++ * 2. No command segments receive VSE except the last one ++ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is ++ * same as Rome 2.1, 2.2, 3.0 ++ */ ++ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { ++ wait_cc_evt = !remain_size ? FALSE: TRUE; ++ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { ++ wait_vsc_evt = !remain_size ? TRUE: FALSE; ++ } ++ } ++ } ++ ++ if ((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) ++ goto error; ++ } ++ ++ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is from 1.1 to 3.1 ++ * 1. No CCE for the last command segment but all other segment ++ * 2. All the command segments get VSE including the last one ++ */ ++ wait_cc_evt = remain_size ? FALSE: TRUE; ++ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is 3.2 ++ * 1. None of the command segments receive CCE ++ * 2. No command segments receive VSE except the last one ++ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is ++ * same as Rome 2.1, 2.2, 3.0 ++ */ ++ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { ++ wait_cc_evt = remain_size ? FALSE: TRUE; ++ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { ++ wait_vsc_evt = remain_size ? TRUE: FALSE; ++ } ++ } ++ ++ if (remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); ++ ++error: ++ return err; ++} ++ ++int rome_download_tlv_file(int fd) ++{ ++ int tlv_size, err = -1; ++ ++ /* Rampatch TLV file Downloading */ ++ pdata_buffer = NULL; ++ ++ if ((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0) ++ goto error; ++ ++ if ((err = rome_tlv_dnld_req(fd, tlv_size)) < 0) ++ goto error; ++ ++ if (pdata_buffer != NULL) { ++ free (pdata_buffer); ++ pdata_buffer = NULL; ++ } ++ ++ /* NVM TLV file Downloading */ ++ if ((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0) ++ goto error; ++ ++ if ((err = rome_tlv_dnld_req(fd, tlv_size)) < 0) ++ goto error; ++ ++error: ++ if (pdata_buffer != NULL) ++ free (pdata_buffer); ++ ++ return err; ++} ++ ++int rome_1_0_nvm_tag_dnld(int fd) ++{ ++ int i, size, err = 0; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++#if (NVM_VERSION >= ROME_1_0_100019) ++ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = ++ { ++ /* Tag 2 */ /* BD Address */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 9, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 2, ++ /* Tag Len */ 6, ++ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 ++ }, ++ /* Tag 6 */ /* Bluetooth Support Features */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 6, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B ++ }, ++ /* Tag 17 */ /* HCI Transport Layer Setting */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 17, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 ++ }, ++ /* Tag 35 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 58, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 35, ++ /* Tag Len */ 55, ++ /* Tag Value */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x58, 0x59, ++ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, ++ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, ++ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, ++ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, ++ 0x1B, 0x14, 0x01, 0x04, 0x48 ++ }, ++ /* Tag 36 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 15, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 36, ++ /* Tag Len */ 12, ++ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 ++ }, ++ /* Tag 39 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 7, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 39, ++ /* Tag Len */ 4, ++ /* Tag Value */ 0x12,0x00,0x00,0x00 ++ }, ++ /* Tag 41 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 91, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 41, ++ /* Tag Len */ 88, ++ /* Tag Value */ 0x15, 0x00, 0x00, 0x00, 0xF6, 0x02, 0x00, 0x00, 0x76, 0x00, ++ 0x1E, 0x00, 0x29, 0x02, 0x1F, 0x00, 0x61, 0x00, 0x1A, 0x00, ++ 0x76, 0x00, 0x1E, 0x00, 0x7D, 0x00, 0x40, 0x00, 0x91, 0x00, ++ 0x06, 0x00, 0x92, 0x00, 0x03, 0x00, 0xA6, 0x01, 0x50, 0x00, ++ 0xAA, 0x01, 0x15, 0x00, 0xAB, 0x01, 0x0A, 0x00, 0xAC, 0x01, ++ 0x00, 0x00, 0xB0, 0x01, 0xC5, 0x00, 0xB3, 0x01, 0x03, 0x00, ++ 0xB4, 0x01, 0x13, 0x00, 0xB5, 0x01, 0x0C, 0x00, 0xC5, 0x01, ++ 0x0D, 0x00, 0xC6, 0x01, 0x10, 0x00, 0xCA, 0x01, 0x2B, 0x00, ++ 0xCB, 0x01, 0x5F, 0x00, 0xCC, 0x01, 0x48, 0x00 ++ }, ++ /* Tag 42 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 63, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 42, ++ /* Tag Len */ 60, ++ /* Tag Value */ 0xD7, 0xC0, 0x00, 0x00, 0x8F, 0x5C, 0x02, 0x00, 0x80, 0x47, ++ 0x60, 0x0C, 0x70, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x01, ++ 0x42, 0x01, 0x69, 0x01, 0x95, 0x01, 0xC7, 0x01, 0xFE, 0x01, ++ 0x3D, 0x02, 0x83, 0x02, 0xD1, 0x02, 0x29, 0x03, 0x00, 0x0A, ++ 0x10, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x7F, 0x00, 0xFD, 0x00, ++ 0xF9, 0x01, 0xF1, 0x03, 0xDE, 0x07, 0x00, 0x00, 0x9A, 0x01 ++ }, ++ /* Tag 84 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 153, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 84, ++ /* Tag Len */ 150, ++ /* Tag Value */ 0x7C, 0x6A, 0x59, 0x47, 0x19, 0x36, 0x35, 0x25, 0x25, 0x28, ++ 0x2C, 0x2B, 0x2B, 0x28, 0x2C, 0x28, 0x29, 0x28, 0x29, 0x28, ++ 0x29, 0x29, 0x2C, 0x29, 0x2C, 0x29, 0x2C, 0x28, 0x29, 0x28, ++ 0x29, 0x28, 0x29, 0x2A, 0x00, 0x00, 0x2C, 0x2A, 0x2C, 0x18, ++ 0x98, 0x98, 0x98, 0x98, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, ++ 0x1E, 0x13, 0x1E, 0x1E, 0x1E, 0x1E, 0x13, 0x13, 0x11, 0x13, ++ 0x1E, 0x1E, 0x13, 0x12, 0x12, 0x12, 0x11, 0x12, 0x1F, 0x12, ++ 0x12, 0x12, 0x10, 0x0C, 0x18, 0x0D, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x0D, 0x0D, ++ 0x0E, 0x0D, 0x01, 0x01, 0x0D, 0x0D, 0x0D, 0x0D, 0x0F, 0x0D, ++ 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x05, 0x10, 0x03, 0x00, ++ 0x7E, 0x7B, 0x7B, 0x72, 0x71, 0x50, 0x50, 0x50, 0x00, 0x40, ++ 0x60, 0x60, 0x30, 0x08, 0x02, 0x0F, 0x00, 0x01, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x08, 0x16, 0x16, 0x08, 0x08, 0x00, ++ 0x00, 0x00, 0x1E, 0x34, 0x2B, 0x1B, 0x23, 0x2B, 0x15, 0x0D ++ }, ++ /* Tag 85 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 119, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 85, ++ /* Tag Len */ 116, ++ /* Tag Value */ 0x03, 0x00, 0x38, 0x00, 0x45, 0x77, 0x00, 0xE8, 0x00, 0x59, ++ 0x01, 0xCA, 0x01, 0x3B, 0x02, 0xAC, 0x02, 0x1D, 0x03, 0x8E, ++ 0x03, 0x00, 0x89, 0x01, 0x0E, 0x02, 0x5C, 0x02, 0xD7, 0x02, ++ 0xF8, 0x08, 0x01, 0x00, 0x1F, 0x00, 0x0A, 0x02, 0x55, 0x02, ++ 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xD7, 0x00, 0x00, ++ 0x00, 0x1E, 0xDE, 0x00, 0x00, 0x00, 0x14, 0x0F, 0x0A, 0x0F, ++ 0x0A, 0x0C, 0x0C, 0x0C, 0x0C, 0x04, 0x04, 0x04, 0x0C, 0x0C, ++ 0x0C, 0x0C, 0x06, 0x06, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, ++ 0x01, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, ++ 0x06, 0x0F, 0x14, 0x05, 0x47, 0xCF, 0x77, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0xAC, 0x7C, 0xFF, 0x40, 0x00, 0x00, 0x00, ++ 0x12, 0x04, 0x04, 0x01, 0x04, 0x03 ++ }, ++ {TAG_END} ++ }; ++#elif (NVM_VERSION == ROME_1_0_6002) ++ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = ++ { ++ /* Tag 2 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 9, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 2, ++ /* Tag Len */ 6, ++ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 /* BD Address */ ++ }, ++ /* Tag 6 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 6, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B ++ }, ++ /* Tag 17 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 17, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 ++ }, ++ /* Tag 36 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 15, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 36, ++ /* Tag Len */ 12, ++ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 ++ }, ++ ++ /* Tag 39 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 7, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 39, ++ /* Tag Len */ 4, ++ /* Tag Value */ 0x12,0x00,0x00,0x00 ++ }, ++ ++ /* Tag 41 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 199, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 41, ++ /* Tag Len */ 196, ++ /* Tag Value */ 0x30,0x00,0x00,0x00,0xD5,0x00,0x0E,0x00,0xD6,0x00,0x0E,0x00, ++ 0xD7,0x00,0x16,0x00,0xD8,0x00,0x16,0x00,0xD9,0x00,0x16,0x00, ++ 0xDA,0x00,0x1E,0x00,0xDB,0x00,0x26,0x00,0xDC,0x00,0x5F,0x00, ++ 0xDD,0x00,0x2F,0x00,0xDE,0x00,0x5F,0x00,0xE0,0x00,0x0E,0x00, ++ 0xE1,0x00,0x0E,0x00,0xE2,0x00,0x16,0x00,0xE3,0x00,0x16,0x00, ++ 0xE4,0x00,0x16,0x00,0xE5,0x00,0x1E,0x00,0xE6,0x00,0x26,0x00, ++ 0xE7,0x00,0x5F,0x00,0xE8,0x00,0x2F,0x00,0xE9,0x00,0x5F,0x00, ++ 0xEC,0x00,0x0C,0x00,0xED,0x00,0x08,0x00,0xEE,0x00,0x14,0x00, ++ 0xEF,0x00,0x24,0x00,0xF0,0x00,0x40,0x00,0xF1,0x00,0x4C,0x00, ++ 0xF2,0x00,0x70,0x00,0xF3,0x00,0x80,0x00,0xF4,0x00,0x80,0x00, ++ 0xF5,0x00,0x80,0x00,0xF8,0x00,0x0C,0x00,0xF9,0x00,0x18,0x00, ++ 0xFA,0x00,0x14,0x00,0xFB,0x00,0x24,0x00,0xFC,0x00,0x40,0x00, ++ 0xFD,0x00,0x4C,0x00,0xFE,0x00,0x70,0x00,0xFF,0x00,0x80,0x00, ++ 0x00,0x01,0x80,0x00,0x01,0x01,0x80,0x00,0x04,0x01,0x1B,0x00, ++ 0x05,0x01,0x14,0x00,0x06,0x01,0x01,0x00,0x07,0x01,0x04,0x00, ++ 0x08,0x01,0x00,0x00,0x09,0x01,0x00,0x00,0x0A,0x01,0x03,0x00, ++ 0x0B,0x01,0x03,0x00 ++ }, ++ ++ /* Tag 44 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 44, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 44, ++ /* Tag Len */ 41, ++ /* Tag Value */ 0x6F,0x0A,0x00,0x00,0x00,0x00,0x00,0x50,0xFF,0x10,0x02,0x02, ++ 0x01,0x00,0x14,0x01,0x06,0x28,0xA0,0x62,0x03,0x64,0x01,0x01, ++ 0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xFF,0x10,0x02,0x01, ++ 0x00,0x14,0x01,0x02,0x03 ++ }, ++ {TAG_END} ++ }; ++#endif ++ ++ for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++) { ++ /* Write BD Address */ ++ if (cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){ ++ memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6); ++ fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", ++ cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1], ++ cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3], ++ cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]); ++ } ++ size = cmds[i][3] + HCI_COMMAND_HDR_SIZE + 1; ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)&cmds[i][0], rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); ++ goto error; ++ } ++ } ++ ++error: ++ return err; ++} ++ ++ ++ ++int rome_patch_ver_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_VER_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if (err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++ ++} ++ ++static void flow_control(int fd, int opt) ++{ ++ struct termios c_opt; ++ ++ ioctl(fd, TIOCMGET, &c_opt); ++ c_opt.c_cc[VTIME] = 0; /* inter-character timer unused */ ++ c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ ++ c_opt.c_cflag &= ~CSIZE; ++ c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); ++ if (opt == MSM_ENABLE_FLOW_CTRL) ++ c_opt.c_cflag |= CRTSCTS; ++ else if (opt == MSM_DISABLE_FLOW_CTRL) ++ c_opt.c_cflag &= ~CRTSCTS; ++ else { ++ fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); ++ return; ++ } ++ c_opt.c_iflag = IGNPAR; ++ c_opt.c_oflag = 0; ++ c_opt.c_lflag = 0; ++ ioctl(fd, TIOCMSET, &c_opt); ++} ++ ++ ++int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); ++ cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; ++ cmd[4] = controller_baud_rate; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ ++ /* Flow off during baudrate change */ ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ ++ /* Send the HCI command packet to UART for transmission */ ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ /* Change Local UART baudrate to high speed UART */ ++ userial_vendor_set_baud(local_baud_rate); ++ ++ /* Flow on after changing local uart baudrate */ ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ ++ /* Check for response from the Controller */ ++ if ((err = read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto error; ++ } ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++ ++} ++ ++ ++int rome_hci_reset_req(int fd, char baud) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = HCI_RESET; ++ cmd_hdr->plen = 0; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); ++ ++ /* Flow off during baudrate change */ ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ ++ /* Send the HCI command packet to UART for transmission */ ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Change Local UART baudrate to high speed UART */ ++ userial_vendor_set_baud(baud); ++ ++ /* Flow on after changing local uart baudrate */ ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ ++error: ++ return err; ++ ++} ++ ++int qca_soc_init(int fd, int speed, char *bdaddr) ++{ ++ int err = -1; ++ int ret = 0; ++ int size, local_baud_rate = 0, controller_baud_rate = 0; ++ ++ vnd_userial.fd = fd; ++ ++ /* Get Rome version information */ ++ if ((err = rome_patch_ver_req(fd)) < 0) { ++ fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); ++ ret = -1; ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); ++ ++ switch (rome_ver){ ++ case ROME_VER_1_0: ++ /* Set and Download the RAMPATCH */ ++ fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); ++ err = rome_download_rampatch(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__); ++ ret = -1; ++ goto error; ++ } ++ ++ /* Attach the RAMPATCH */ ++ fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); ++ err = rome_attach_rampatch(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__); ++ ret = -1; ++ goto error; ++ } ++ ++ /* Send Reset */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ err = rome_rampatch_reset(fd); ++ if (err < 0) { ++ fprintf(stderr, "Failed to RESET after RAMPATCH upgrade!\n"); ++ ret = -1; ++ goto error; ++ } ++ ++ /* NVM download */ ++ fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); ++ err = rome_1_0_nvm_tag_dnld(fd); ++ if (err < 0) { ++ fprintf(stderr, "Downloading NVM Failed !!\n"); ++ ret = -1; ++ goto error; ++ } ++ ++ /* Change baud rate 115.2 kbps to 3Mbps*/ ++ err = rome_hci_reset_req(fd, local_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "HCI Reset Failed !!\n"); ++ ret = -1; ++ goto error; ++ } ++ break; ++ case ROME_VER_1_1: ++ rampatch_file_path = ROME_RAMPATCH_TLV_PATH; ++ nvm_file_path = ROME_NVM_TLV_PATH; ++ goto download; ++ case ROME_VER_1_3: ++ rampatch_file_path = ROME_RAMPATCH_TLV_1_0_3_PATH; ++ nvm_file_path = ROME_NVM_TLV_1_0_3_PATH; ++ goto download; ++ case ROME_VER_2_1: ++ rampatch_file_path = ROME_RAMPATCH_TLV_2_0_1_PATH; ++ nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; ++ goto download; ++ case ROME_VER_3_0: ++ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; ++ nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; ++ goto download; ++ case ROME_VER_3_2: ++ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_2_PATH; ++ nvm_file_path = ROME_NVM_TLV_3_0_2_PATH; ++ goto download; ++ case TUFELLO_VER_1_0: ++ rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; ++ nvm_file_path = TF_NVM_TLV_1_0_0_PATH; ++ goto download; ++ case TUFELLO_VER_1_1: ++ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH; ++ nvm_file_path = TF_NVM_TLV_1_0_1_PATH; ++download: ++ /* Check if user requested for 115200 kbps */ ++ if (speed == 115200) { ++ local_baud_rate = USERIAL_BAUD_115200; ++ controller_baud_rate = BAUDRATE_115200; ++ } ++ else { ++ /* Change only if baud rate requested is valid or not */ ++ isSpeedValid(speed, &local_baud_rate, &controller_baud_rate); ++ if (local_baud_rate < 0 || controller_baud_rate < 0) { ++ ret = -1; ++ goto error; ++ } ++ } ++ ++ /* Donwload TLV files (rampatch, NVM) */ ++ err = rome_download_tlv_file(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); ++ ret = -1; ++ goto error; ++ } ++ ++ /* FW download complete, add some delay before updating baudrate */ ++ usleep(20000); ++ ++ /* ++ * Overriding the baud rate value in NVM file with the user ++ * requested baud rate, since default baud rate in NVM file is 3M. ++ */ ++ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ ret = -1; ++ goto error; ++ } ++ ++ /* Perform HCI reset here*/ ++ err = rome_hci_reset_req(fd, local_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "HCI Reset Failed !!!\n"); ++ ret = -1; ++ goto error; ++ } ++ ++ break; ++ case ROME_VER_UNKNOWN: ++ default: ++ fprintf(stderr, "%s: Detected unknown ROME version\n", __FUNCTION__); ++ ret = -1; ++ break; ++ } ++ ++error: ++ return ret; ++} +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +new file mode 100644 +index 000000000..a356cc24f +--- /dev/null ++++ b/tools/hciattach_rome.h +@@ -0,0 +1,407 @@ ++/* ++ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. ++ * Not a Contribution. ++ * Copyright 2012 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++#ifndef HW_ROME_H ++#define HW_ROME_H ++ ++/****************************************************************************** ++** Constants & Macros ++******************************************************************************/ ++#define HCI_MAX_CMD_SIZE 260 ++#define HCI_MAX_EVENT_SIZE 260 ++#define PRINT_BUF_SIZE ((HCI_MAX_CMD_SIZE * 3) + 2) ++/* HCI Command/Event Opcode */ ++#define HCI_RESET 0x0C03 ++#define EVT_CMD_COMPLETE 0x0E ++/* HCI Packet types */ ++#define HCI_COMMAND_PKT 0x01 ++#define HCI_ACLDATA_PKT 0x02 ++#define HCI_SCODATA_PKT 0x03 ++#define HCI_EVENT_PKT 0x04 ++#define HCI_VENDOR_PKT 0xff ++#define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) ++ ++#define NVITEM 0 ++#define RDWR_PROT 1 ++#define NVITEM_SIZE 2 ++#define PERSIST_HEADER_LEN 3 ++#define BD_ADDR_LEN 6 ++#define MSM_DISABLE_FLOW_CTRL 0 ++#define MSM_ENABLE_FLOW_CTRL 1 ++ ++#ifdef _PLATFORM_MDM_ ++#define USERIAL_OP_CLK_ON 0x5441 ++#define USERIAL_OP_CLK_OFF 0x5442 ++#endif ++ ++#ifdef DEBUG ++ #define PR_DBG(fmt, arg...) printf(fmt, ## arg) ++#else ++ #define PR_DBG(fmt, arg...) ++#endif ++ ++unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; ++typedef enum { ++ USERIAL_OP_FLOW_ON, ++ USERIAL_OP_FLOW_OFF, ++ USERIAL_OP_NOP, ++} userial_vendor_ioctl_op_t; ++ ++ ++/* vendor serial control block */ ++typedef struct ++{ ++ int fd; /* fd to Bluetooth device */ ++ struct termios termios; /* serial terminal of BT port */ ++ char port_name[256]; ++} vnd_userial_cb_t; ++ ++/**** baud rates ****/ ++#define USERIAL_BAUD_300 0 ++#define USERIAL_BAUD_600 1 ++#define USERIAL_BAUD_1200 2 ++#define USERIAL_BAUD_2400 3 ++#define USERIAL_BAUD_9600 4 ++#define USERIAL_BAUD_19200 5 ++#define USERIAL_BAUD_57600 6 ++#define USERIAL_BAUD_115200 7 ++#define USERIAL_BAUD_230400 8 ++#define USERIAL_BAUD_460800 9 ++#define USERIAL_BAUD_921600 10 ++#define USERIAL_BAUD_1M 11 ++#define USERIAL_BAUD_1_5M 12 ++#define USERIAL_BAUD_2M 13 ++#define USERIAL_BAUD_3M 14 ++#define USERIAL_BAUD_4M 15 ++#define USERIAL_BAUD_AUTO 16 ++ ++/* Vendor specific baud rate values */ ++#define UART_Baud_Rate_Baud_9600 4 ++#define UART_Baud_Rate_Baud_19200 3 ++#define UART_Baud_Rate_Baud_57600 1 ++#define UART_Baud_Rate_Baud_115200 0 ++#define UART_Baud_Rate_Baud_230400 5 ++#define UART_Baud_Rate_Baud_460800 7 ++#define UART_Baud_Rate_Baud_921600 10 ++#define UART_Baud_Rate_Baud_1000000 11 ++#define UART_Baud_Rate_Baud_2000000 13 ++#define UART_Baud_Rate_Baud_3000000 14 ++#define UART_Baud_Rate_Baud_4000000 15 ++ ++#define UART_Baud_Rate_Baud_250000 6 ++#define UART_Baud_Rate_Baud_500000 8 ++#define UART_Baud_Rate_Baud_720000 9 ++#define UART_Baud_Rate_Baud_125000 12 ++#define UART_Baud_Rate_Baud_1600000 16 ++#define UART_Baud_Rate_Baud_3200000 17 ++#define UART_Baud_Rate_Baud_3500000 18 ++ ++#ifndef FALSE ++#define FALSE 0 ++#endif ++ ++#ifndef TRUE ++#define TRUE (!FALSE) ++#endif ++ ++#define HCI_CHG_BAUD_CMD_OCF 0x0C ++#define HCI_VENDOR_CMD_OGF 0x3F ++#define WRITE_BDADDR_CMD_LEN 14 ++#define WRITE_BAUD_CMD_LEN 6 ++#define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN ++#define GET_VERSION_OCF 0x1E ++ ++#define PS_HDR_LEN 4 ++#define HCI_VENDOR_CMD_OGF 0x3F ++#define HCI_PS_CMD_OCF 0x0B ++ ++#define HCI_COMMAND_HDR_SIZE 3 ++#define EVT_CMD_COMPLETE_SIZE 3 ++#define EVT_CMD_STATUS 0x0F ++#define EVT_CMD_STATUS_SIZE 4 ++#define HCI_EVENT_HDR_SIZE 2 ++#define HCI_EV_SUCCESS 0x00 ++/* HCI Socket options */ ++#define HCI_DATA_DIR 1 ++#define HCI_FILTER 2 ++#define HCI_TIME_STAMP 3 ++ ++#define P_ID_OFFSET (0) ++#define HCI_CMD_IND (1) ++#define EVENTCODE_OFFSET (1) ++#define EVT_PLEN (2) ++#define PLEN (3) ++#define CMD_RSP_OFFSET (3) ++#define RSP_TYPE_OFFSET (4) ++#define BAUDRATE_RSP_STATUS_OFFSET (4) ++#define CMD_STATUS_OFFSET (5) ++#define P_ROME_VER_OFFSET (4) ++#define P_BUILD_VER_OFFSET (6) ++#define P_BASE_ADDR_OFFSET (8) ++#define P_ENTRY_ADDR_OFFSET (12) ++#define P_LEN_OFFSET (16) ++#define P_CRC_OFFSET (20) ++#define P_CONTROL_OFFSET (24) ++#define PATCH_HDR_LEN (28) ++#define MAX_DATA_PER_SEGMENT (239) ++#define VSEVENT_CODE (0xFF) ++#define HC_VS_MAX_CMD_EVENT (0xFF) ++#define PATCH_PROD_ID_OFFSET (5) ++#define PATCH_PATCH_VER_OFFSET (9) ++#define PATCH_ROM_BUILD_VER_OFFSET (11) ++#define PATCH_SOC_VER_OFFSET (13) ++#define MAX_SIZE_PER_TLV_SEGMENT (243) ++ ++/* VS Opcode */ ++#define HCI_PATCH_CMD_OCF (0) ++#define EDL_SET_BAUDRATE_CMD_OCF (0x48) ++ ++/* VS Commands */ ++#define VSC_SET_BAUDRATE_REQ_LEN (1) ++#define EDL_PATCH_CMD_LEN (1) ++#define EDL_PATCH_CMD_REQ_LEN (1) ++#define EDL_PATCH_DLD_REQ_CMD (0x01) ++#define EDL_PATCH_RST_REQ_CMD (0x05) ++#define EDL_PATCH_SET_REQ_CMD (0x16) ++#define EDL_PATCH_ATCH_REQ_CMD (0x17) ++#define EDL_PATCH_VER_REQ_CMD (0x19) ++#define EDL_PATCH_TLV_REQ_CMD (0x1E) ++#define VSC_DISABLE_IBS_LEN (0x04) ++ ++/* VS Event */ ++#define EDL_CMD_REQ_RES_EVT (0x00) ++#define EDL_CMD_EXE_STATUS_EVT (0x00) ++#define EDL_SET_BAUDRATE_RSP_EVT (0x92) ++#define EDL_PATCH_VER_RES_EVT (0x19) ++#define EDL_TVL_DNLD_RES_EVT (0x04) ++#define EDL_APP_VER_RES_EVT (0x02) ++ ++/* Status Codes of HCI CMD execution*/ ++#define HCI_CMD_SUCCESS (0x0) ++#define PATCH_LEN_ERROR (0x1) ++#define PATCH_VER_ERROR (0x2) ++#define PATCH_CRC_ERROR (0x3) ++#define PATCH_NOT_FOUND (0x4) ++#define TLV_TYPE_ERROR (0x10) ++#define NVM_ACCESS_CODE (0x0B) ++#define BAUDRATE_CHANGE_SUCCESS (1) ++ ++/* TLV_TYPE */ ++#define TLV_TYPE_PATCH (1) ++#define TLV_TYPE_NVM (2) ++ ++/* NVM */ ++#define MAX_TAG_CMD 30 ++#define TAG_END 0xFF ++#define NVM_ACCESS_SET 0x01 ++#define TAG_NUM_OFFSET 5 ++#define TAG_NUM_2 2 ++#define TAG_NUM_17 (17) ++#define TAG_NUM_27 27 ++#define TAG_NUM_44 44 ++#define TAG_BDADDR_OFFSET 7 ++ ++/* FW PCM Configuration */ ++#define FWCONF_PCM_MS_OFFSET_1 9 ++#define FWCONF_PCM_MS_OFFSET_2 33 ++#define FWCONF_PCM_SLAVE 1 ++#define FWCONF_PCM_MASTER 0 ++#define FWCONF_PCM_ROLE_BIT_OFFSET 4 ++ ++/* FW IBS Configuration */ ++#define FWCONF_IBS_DISABLE (0) ++#define FWCONF_IBS_ENABLE (1) ++#define FWCONF_IBS_VAL_BIT (7) ++#define FWCONF_IBS_VAL_OFFSET (0) ++ ++/* FW DEEP SLEEP Configuration */ ++#define FWCONF_DEEP_SLEEP_DISABLE 0 ++#define FWCONF_DEEP_SLEEP_ENABLE 1 ++#define FWCONF_DEEP_SLEEP_BYTE_OFFSET 0 ++#define FWCONF_DEEP_SLEEP_BIT_OFFSET 0 ++ ++#define MAX_RETRY_CNT 1 ++#define SELECT_TIMEOUT 3 ++ ++/* NVM Tags specifically used for ROME 1.0 */ ++#define ROME_1_0_100022_1 0x101000221 ++#define ROME_1_0_100019 0x101000190 ++#define ROME_1_0_6002 0x100600200 ++ ++/* Default NVM Version setting for ROME 1.0 */ ++#define NVM_VERSION ROME_1_0_100022_1 ++ ++ ++#define LSH(val, n) ((unsigned int)(val) << (n)) ++#define EXTRACT_BYTE(val, pos) (char) (((val) >> (8 * (pos))) & 0xFF) ++#define CALC_SEG_SIZE(len, max) ((plen) % (max))?((plen/max)+1) : ((plen) / (max)) ++ ++#define ROME_FW_PATH "/lib/firmware/rampatch.img" ++#define ROME_RAMPATCH_TLV_PATH "/lib/firmware/rampatch_tlv.img" ++#define ROME_NVM_TLV_PATH "/lib/firmware/nvm_tlv.bin" ++#define ROME_RAMPATCH_TLV_1_0_3_PATH "/lib/firmware/rampatch_tlv_1.3.tlv" ++#define ROME_NVM_TLV_1_0_3_PATH "/lib/firmware/nvm_tlv_1.3.bin" ++#define ROME_RAMPATCH_TLV_2_0_1_PATH "/lib/firmware/rampatch_tlv_2.1.tlv" ++#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" ++#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/rampatch_tlv_3.0.tlv" ++#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/nvm_tlv_3.0.bin" ++#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/btfw32.tlv" ++#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/btnv32.bin" ++#ifdef _PLATFORM_MDM_ ++#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" ++#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" ++#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/tfbtfw11.tlv" ++#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/tfbtnv11.bin" ++#else ++#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv" ++#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin" ++#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/tfbtfw11.tlv" ++#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/tfbtnv11.bin" ++#endif ++ ++/* This header value in rampatch file decides event handling mechanism in the HOST */ ++#define ROME_SKIP_EVT_NONE 0x00 ++#define ROME_SKIP_EVT_VSE 0x01 ++#define ROME_SKIP_EVT_CC 0x02 ++#define ROME_SKIP_EVT_VSE_CC 0x03 ++ ++#define FW_CONFIG_FILE_PATH "/etc/bluetooth/firmware.conf" ++/****************************************************************************** ++** Local type definitions ++******************************************************************************/ ++ ++typedef struct { ++ unsigned char ncmd; ++ unsigned short opcode; ++} __attribute__ ((packed)) evt_cmd_complete; ++ ++typedef struct { ++ unsigned char status; ++ unsigned char ncmd; ++ unsigned short opcode; ++} __attribute__ ((packed)) evt_cmd_status; ++ ++typedef struct { ++ unsigned short opcode; ++ unsigned char plen; ++} __attribute__ ((packed)) hci_command_hdr; ++ ++typedef struct { ++ unsigned char evt; ++ unsigned char plen; ++} __attribute__ ((packed)) hci_event_hdr; ++typedef struct { ++ unsigned short rom_version; ++ unsigned short build_version; ++} __attribute__ ((packed)) patch_version; ++ ++typedef struct { ++ unsigned int patch_id; ++ patch_version patch_ver; ++ unsigned int patch_base_addr; ++ unsigned int patch_entry_addr; ++ unsigned short patch_length; ++ int patch_crc; ++ unsigned short patch_ctrl; ++} __attribute__ ((packed)) patch_info; ++ ++typedef struct { ++ unsigned int tlv_data_len; ++ unsigned int tlv_patch_data_len; ++ unsigned char sign_ver; ++ unsigned char sign_algorithm; ++ unsigned char dwnd_cfg; ++ unsigned char reserved1; ++ unsigned short prod_id; ++ unsigned short build_ver; ++ unsigned short patch_ver; ++ unsigned short reserved2; ++ unsigned int patch_entry_addr; ++} __attribute__ ((packed)) tlv_patch_hdr; ++ ++typedef struct { ++ unsigned short tag_id; ++ unsigned short tag_len; ++ unsigned int tag_ptr; ++ unsigned int tag_ex_flag; ++} __attribute__ ((packed)) tlv_nvm_hdr; ++ ++typedef struct { ++ unsigned char tlv_type; ++ unsigned char tlv_length1; ++ unsigned char tlv_length2; ++ unsigned char tlv_length3; ++ ++ union{ ++ tlv_patch_hdr patch; ++ tlv_nvm_hdr nvm; ++ }tlv; ++} __attribute__ ((packed)) tlv_patch_info; ++ ++enum{ ++ BAUDRATE_115200 = 0x00, ++ BAUDRATE_57600 = 0x01, ++ BAUDRATE_38400 = 0x02, ++ BAUDRATE_19200 = 0x03, ++ BAUDRATE_9600 = 0x04, ++ BAUDRATE_230400 = 0x05, ++ BAUDRATE_250000 = 0x06, ++ BAUDRATE_460800 = 0x07, ++ BAUDRATE_500000 = 0x08, ++ BAUDRATE_720000 = 0x09, ++ BAUDRATE_921600 = 0x0A, ++ BAUDRATE_1000000 = 0x0B, ++ BAUDRATE_1250000 = 0x0C, ++ BAUDRATE_2000000 = 0x0D, ++ BAUDRATE_3000000 = 0x0E, ++ BAUDRATE_4000000 = 0x0F, ++ BAUDRATE_1600000 = 0x10, ++ BAUDRATE_3200000 = 0x11, ++ BAUDRATE_3500000 = 0x12, ++ BAUDRATE_AUTO = 0xFE, ++ BAUDRATE_Reserved = 0xFF ++}; ++ ++enum{ ++ ROME_PATCH_VER_0100 = 0x0100, ++ ROME_PATCH_VER_0101 = 0x0101, ++ ROME_PATCH_VER_0200 = 0x0200, ++ ROME_PATCH_VER_0300 = 0x0300, ++ ROME_PATCH_VER_0302 = 0x0302 ++ }; ++ ++enum{ ++ ROME_SOC_ID_00 = 0x00000000, ++ ROME_SOC_ID_11 = 0x00000011, ++ ROME_SOC_ID_13 = 0x00000013, ++ ROME_SOC_ID_22 = 0x00000022, ++ ROME_SOC_ID_23 = 0x00000023, ++ ROME_SOC_ID_44 = 0x00000044 ++}; ++ ++enum{ ++ ROME_VER_UNKNOWN = 0, ++ ROME_VER_1_0 = ((ROME_PATCH_VER_0100 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_1_1 = ((ROME_PATCH_VER_0101 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), ++ ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), ++ ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), ++ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ), ++ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 ) ++}; ++#endif /* HW_ROME_H */ diff --git a/packages/network/bluez/patches/bluez-22-hciattach_rome-simplify-baudrate-setting.patch b/packages/network/bluez/patches/bluez-22-hciattach_rome-simplify-baudrate-setting.patch new file mode 100644 index 0000000000..5759f01471 --- /dev/null +++ b/packages/network/bluez/patches/bluez-22-hciattach_rome-simplify-baudrate-setting.patch @@ -0,0 +1,209 @@ +From c98577de4fcf3bfb410c10a05b6633fb6581afdc Mon Sep 17 00:00:00 2001 +From: Gary Bisson +Date: Wed, 27 Dec 2017 10:55:52 +0100 +Subject: [PATCH] hciattach_rome: simplify baudrate setting + +Signed-off-by: Gary Bisson +--- + tools/hciattach_rome.c | 70 +++++++++++++++++++------------------------------- + tools/hciattach_rome.h | 21 --------------- + 2 files changed, 26 insertions(+), 65 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 2586dbc77..34e7edfb5 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -908,60 +908,49 @@ int read_bd_address(unsigned char *bdaddr) + return 0; + } + +-int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) ++int isSpeedValid(int speed, unsigned char *baud_rate) + { + switch(speed) { + case 9600: +- *local_baud_rate = USERIAL_BAUD_9600; +- *controller_baud_rate = BAUDRATE_9600; ++ *baud_rate = BAUDRATE_9600; + break; + case 19200: +- *local_baud_rate = USERIAL_BAUD_19200; +- *controller_baud_rate = BAUDRATE_19200; ++ *baud_rate = BAUDRATE_19200; + break; + case 57600: +- *local_baud_rate = USERIAL_BAUD_57600; +- *controller_baud_rate = BAUDRATE_57600; ++ *baud_rate = BAUDRATE_57600; + break; + case 115200: +- *local_baud_rate = USERIAL_BAUD_115200; +- *controller_baud_rate = BAUDRATE_115200; ++ *baud_rate = BAUDRATE_115200; + break; + case 230400: +- *local_baud_rate = USERIAL_BAUD_230400; +- *controller_baud_rate = BAUDRATE_230400; ++ *baud_rate = BAUDRATE_230400; + break; + case 460800: +- *local_baud_rate = USERIAL_BAUD_460800; +- *controller_baud_rate = BAUDRATE_460800; ++ *baud_rate = BAUDRATE_460800; + break; + case 921600: +- *local_baud_rate = USERIAL_BAUD_921600; +- *controller_baud_rate = BAUDRATE_921600; ++ *baud_rate = BAUDRATE_921600; + break; + case 1000000: +- *local_baud_rate = USERIAL_BAUD_1M; +- *controller_baud_rate = BAUDRATE_1000000; ++ *baud_rate = BAUDRATE_1000000; + break; + case 2000000: +- *local_baud_rate = USERIAL_BAUD_2M; +- *controller_baud_rate = BAUDRATE_2000000; ++ *baud_rate = BAUDRATE_2000000; + break; + case 3000000: +- *local_baud_rate = USERIAL_BAUD_3M; +- *controller_baud_rate = BAUDRATE_3000000; ++ *baud_rate = BAUDRATE_3000000; + break; + case 4000000: +- *local_baud_rate = USERIAL_BAUD_4M; +- *controller_baud_rate = BAUDRATE_4000000; ++ *baud_rate = BAUDRATE_4000000; + break; + case 300: + case 600: + case 1200: + case 2400: + default: +- fprintf(stderr, "Invalid baud rate passed!\n"); +- *local_baud_rate = *controller_baud_rate = -1; ++ fprintf(stderr, "Invalid baudrate, default to 115200!\n"); ++ *baud_rate = BAUDRATE_115200; + break; + } + return -1; +@@ -1633,7 +1622,7 @@ static void flow_control(int fd, int opt) + } + + +-int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) ++int rome_set_baudrate_req(int fd, unsigned char baud_rate) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1647,7 +1636,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) + cmd[0] = HCI_COMMAND_PKT; + cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); + cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; +- cmd[4] = controller_baud_rate; ++ cmd[4] = baud_rate; + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); +@@ -1662,7 +1651,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) + goto error; + } + /* Change Local UART baudrate to high speed UART */ +- userial_vendor_set_baud(local_baud_rate); ++ userial_vendor_set_baud(baud_rate); + + /* Flow on after changing local uart baudrate */ + flow_control(fd, MSM_ENABLE_FLOW_CTRL); +@@ -1735,7 +1724,8 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + { + int err = -1; + int ret = 0; +- int size, local_baud_rate = 0, controller_baud_rate = 0; ++ int size; ++ unsigned char baud_rate = 0; + + vnd_userial.fd = fd; + +@@ -1787,7 +1777,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + } + + /* Change baud rate 115.2 kbps to 3Mbps*/ +- err = rome_hci_reset_req(fd, local_baud_rate); ++ err = rome_hci_reset_req(fd, baud_rate); + if (err < 0) { + fprintf(stderr, "HCI Reset Failed !!\n"); + ret = -1; +@@ -1822,18 +1812,10 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH; + nvm_file_path = TF_NVM_TLV_1_0_1_PATH; + download: +- /* Check if user requested for 115200 kbps */ +- if (speed == 115200) { +- local_baud_rate = USERIAL_BAUD_115200; +- controller_baud_rate = BAUDRATE_115200; +- } +- else { +- /* Change only if baud rate requested is valid or not */ +- isSpeedValid(speed, &local_baud_rate, &controller_baud_rate); +- if (local_baud_rate < 0 || controller_baud_rate < 0) { +- ret = -1; +- goto error; +- } ++ isSpeedValid(speed, &baud_rate); ++ if (baud_rate < 0) { ++ ret = -1; ++ goto error; + } + + /* Donwload TLV files (rampatch, NVM) */ +@@ -1851,7 +1833,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + * Overriding the baud rate value in NVM file with the user + * requested baud rate, since default baud rate in NVM file is 3M. + */ +- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ err = rome_set_baudrate_req(fd, baud_rate); + if (err < 0) { + fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); + ret = -1; +@@ -1859,7 +1841,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + } + + /* Perform HCI reset here*/ +- err = rome_hci_reset_req(fd, local_baud_rate); ++ err = rome_hci_reset_req(fd, baud_rate); + if (err < 0) { + fprintf(stderr, "HCI Reset Failed !!!\n"); + ret = -1; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index a356cc24f..2f5930c99 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -89,27 +89,6 @@ typedef struct + #define USERIAL_BAUD_4M 15 + #define USERIAL_BAUD_AUTO 16 + +-/* Vendor specific baud rate values */ +-#define UART_Baud_Rate_Baud_9600 4 +-#define UART_Baud_Rate_Baud_19200 3 +-#define UART_Baud_Rate_Baud_57600 1 +-#define UART_Baud_Rate_Baud_115200 0 +-#define UART_Baud_Rate_Baud_230400 5 +-#define UART_Baud_Rate_Baud_460800 7 +-#define UART_Baud_Rate_Baud_921600 10 +-#define UART_Baud_Rate_Baud_1000000 11 +-#define UART_Baud_Rate_Baud_2000000 13 +-#define UART_Baud_Rate_Baud_3000000 14 +-#define UART_Baud_Rate_Baud_4000000 15 +- +-#define UART_Baud_Rate_Baud_250000 6 +-#define UART_Baud_Rate_Baud_500000 8 +-#define UART_Baud_Rate_Baud_720000 9 +-#define UART_Baud_Rate_Baud_125000 12 +-#define UART_Baud_Rate_Baud_1600000 16 +-#define UART_Baud_Rate_Baud_3200000 17 +-#define UART_Baud_Rate_Baud_3500000 18 +- + #ifndef FALSE + #define FALSE 0 + #endif diff --git a/packages/network/bluez/patches/bluez-23-hciattach_rome-do-not-override-module-MAC.patch b/packages/network/bluez/patches/bluez-23-hciattach_rome-do-not-override-module-MAC.patch new file mode 100644 index 0000000000..779f67c3b8 --- /dev/null +++ b/packages/network/bluez/patches/bluez-23-hciattach_rome-do-not-override-module-MAC.patch @@ -0,0 +1,52 @@ +From 9041596bf7a975dec043ecafb242092cfeece631 Mon Sep 17 00:00:00 2001 +From: Gary Bisson +Date: Wed, 27 Dec 2017 11:47:01 +0100 +Subject: [PATCH] hciattach_rome: do not override module internal MAC address + +Signed-off-by: Gary Bisson +--- + tools/hciattach_rome.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 34e7edfb5..6336bdc6b 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -29,6 +29,7 @@ + * + ******************************************************************************/ + ++#define MODULE_HAS_MAC_ADDR + #define LOG_TAG "bt_vendor" + #include + #include +@@ -1057,6 +1058,7 @@ int rome_get_tlv_file(char *file_path) + nvm_index+=sizeof(tlv_nvm_hdr); + nvm_byte_ptr+=sizeof(tlv_nvm_hdr); + ++#ifndef MODULE_HAS_MAC_ADDR + /* Write BD Address */ + if (nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(bdaddr) == 0) { + memcpy(nvm_byte_ptr, bdaddr, 6); +@@ -1065,6 +1067,21 @@ int rome_get_tlv_file(char *file_path) + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } ++#else ++ /* Remove it from NVM data */ ++ if (nvm_ptr->tag_id == TAG_NUM_2) { ++ int nvm_size = nvm_ptr->tag_len + sizeof(tlv_nvm_hdr); ++ PR_DBG("Skip BD Address from NVM\n"); ++ nvm_index += nvm_ptr->tag_len; ++ nvm_byte_ptr += nvm_ptr->tag_len; ++ memmove(nvm_ptr, nvm_byte_ptr, nvm_length - nvm_index); ++ nvm_length -= nvm_size; ++ nvm_byte_ptr -= nvm_size; ++ readSize -= nvm_size; ++ nvm_index -= nvm_size; ++ continue; ++ } ++#endif + + if (nvm_ptr->tag_id == TAG_NUM_17) { + if ((ibs_value = diff --git a/packages/network/bluez/patches/bluez-24-hciattach_rome-force-IBS-to-disabled-in-NVM.patch b/packages/network/bluez/patches/bluez-24-hciattach_rome-force-IBS-to-disabled-in-NVM.patch new file mode 100644 index 0000000000..abe8e30605 --- /dev/null +++ b/packages/network/bluez/patches/bluez-24-hciattach_rome-force-IBS-to-disabled-in-NVM.patch @@ -0,0 +1,102 @@ +From 6656fc810789b929ef1ce0a510b8a2cae93e84c2 Mon Sep 17 00:00:00 2001 +From: Gary Bisson +Date: Wed, 27 Dec 2017 11:51:23 +0100 +Subject: [PATCH] hciattach_rome: force IBS to disabled in NVM + +Signed-off-by: Gary Bisson +--- + tools/hciattach_rome.c | 28 ++++++++++++---------------- + tools/hciattach_rome.h | 3 ++- + 2 files changed, 14 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 6336bdc6b..b78155b22 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -957,7 +957,7 @@ int isSpeedValid(int speed, unsigned char *baud_rate) + return -1; + } + +-int rome_get_tlv_file(char *file_path) ++int rome_get_tlv_file(char *file_path, unsigned char baud_rate) + { + FILE * pFile; + long fileSize; +@@ -1084,17 +1084,13 @@ int rome_get_tlv_file(char *file_path) + #endif + + if (nvm_ptr->tag_id == TAG_NUM_17) { +- if ((ibs_value = +- get_value_from_config(FW_CONFIG_FILE_PATH, "IBS")) >= 0) { +- if (ibs_value == FWCONF_IBS_DISABLE) { +- nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= +- (~(FWCONF_IBS_ENABLE << +- FWCONF_IBS_VAL_BIT)); +- } else if (ibs_value == FWCONF_IBS_ENABLE) { +- nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] |= +- (FWCONF_IBS_ENABLE << +- FWCONF_IBS_VAL_BIT); +- } ++ PR_DBG("Forcing IBS to be disabled\n"); ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= ++ (~(FWCONF_IBS_ENABLE << FWCONF_IBS_VAL_BIT)); ++ if (baud_rate != nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET]) { ++ PR_DBG("Change Vendor Baud from 0x%02x to 0x%02x\n", ++ nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET], baud_rate); ++ nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET] = baud_rate; + } + } + +@@ -1286,14 +1282,14 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + return err; + } + +-int rome_download_tlv_file(int fd) ++int rome_download_tlv_file(int fd, unsigned char baud_rate) + { + int tlv_size, err = -1; + + /* Rampatch TLV file Downloading */ + pdata_buffer = NULL; + +- if ((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0) ++ if ((tlv_size = rome_get_tlv_file(rampatch_file_path, baud_rate)) < 0) + goto error; + + if ((err = rome_tlv_dnld_req(fd, tlv_size)) < 0) +@@ -1305,7 +1301,7 @@ int rome_download_tlv_file(int fd) + } + + /* NVM TLV file Downloading */ +- if ((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0) ++ if ((tlv_size = rome_get_tlv_file(nvm_file_path, baud_rate)) < 0) + goto error; + + if ((err = rome_tlv_dnld_req(fd, tlv_size)) < 0) +@@ -1836,7 +1832,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + } + + /* Donwload TLV files (rampatch, NVM) */ +- err = rome_download_tlv_file(fd); ++ err = rome_download_tlv_file(fd, baud_rate); + if (err < 0) { + fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); + ret = -1; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 2f5930c99..1ea9d865b 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -201,11 +201,12 @@ typedef struct + #define FWCONF_PCM_MASTER 0 + #define FWCONF_PCM_ROLE_BIT_OFFSET 4 + +-/* FW IBS Configuration */ ++/* FW HCI Transport Layer Configuration */ + #define FWCONF_IBS_DISABLE (0) + #define FWCONF_IBS_ENABLE (1) + #define FWCONF_IBS_VAL_BIT (7) + #define FWCONF_IBS_VAL_OFFSET (0) ++#define FWCONF_BAUD_VAL_OFFSET (2) + + /* FW DEEP SLEEP Configuration */ + #define FWCONF_DEEP_SLEEP_DISABLE 0 diff --git a/packages/network/bluez/patches/bluez-25-hciattach_rome-display-ROM-and-TLV-info.patch b/packages/network/bluez/patches/bluez-25-hciattach_rome-display-ROM-and-TLV-info.patch new file mode 100644 index 0000000000..036ce5e1ee --- /dev/null +++ b/packages/network/bluez/patches/bluez-25-hciattach_rome-display-ROM-and-TLV-info.patch @@ -0,0 +1,159 @@ +From e6baaf14d9f6c2d96bcc720cb1c2e492c658e3a9 Mon Sep 17 00:00:00 2001 +From: Gary Bisson +Date: Thu, 28 Dec 2017 12:54:05 +0100 +Subject: [PATCH] hciattach_rome: display ROM and TLV info by default + +Signed-off-by: Gary Bisson +--- + tools/hciattach_rome.c | 60 ++++++++++++++++++++++++-------------------------- + tools/hciattach_rome.h | 1 + + 2 files changed, 30 insertions(+), 31 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index b78155b22..9a7f222c4 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -232,21 +232,21 @@ int get_vs_hci_event(unsigned char *rsp) + switch(rsp[RSP_TYPE_OFFSET]) { + case EDL_PATCH_VER_RES_EVT: + case EDL_APP_VER_RES_EVT: +- PR_DBG("\t Current Product ID\t\t: 0x%08x\n", ++ PR_INFO("Current Product ID\t\t: 0x%08x\n", + (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | + rsp[PATCH_PROD_ID_OFFSET+2] << 16 | + rsp[PATCH_PROD_ID_OFFSET+1] << 8 | + rsp[PATCH_PROD_ID_OFFSET] )); + + /* Patch Version indicates FW patch version */ +- PR_DBG("\t Current Patch Version\t\t: 0x%04x\n", ++ PR_INFO("Current Patch Version\t\t: 0x%04x\n", + (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | + rsp[PATCH_PATCH_VER_OFFSET] )); + + /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ + rome_ver = (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | + rsp[PATCH_ROM_BUILD_VER_OFFSET]); +- PR_DBG("\t Current ROM Build Version\t: 0x%04x\n", rome_ver); ++ PR_INFO("Current ROM Build Version\t: 0x%04x\n", rome_ver); + + /* In case rome 1.0/1.1, there is no SOC ID version available */ + if (paramlen - 10) { +@@ -254,7 +254,7 @@ int get_vs_hci_event(unsigned char *rsp) + rsp[PATCH_SOC_VER_OFFSET+2] << 16 | + rsp[PATCH_SOC_VER_OFFSET+1] << 8 | + rsp[PATCH_SOC_VER_OFFSET]); +- PR_DBG("\t Current SOC Version\t\t: 0x%08x\n", soc_id); ++ PR_INFO("Current SOC Version\t\t: 0x%08x\n", soc_id); + } + + /* Rome Chipset Version can be decided by Patch version and SOC version, +@@ -1019,30 +1019,31 @@ int rome_get_tlv_file(char *file_path, unsigned char baud_rate) + gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; + + if (ptlv_header->tlv_type == TLV_TYPE_PATCH) { +- PR_DBG("====================================================\n"); +- PR_DBG("TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); +- PR_DBG("Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | ++ PR_INFO("====================================================\n"); ++ PR_INFO("TLV Type : 0x%x\n", ptlv_header->tlv_type); ++ PR_INFO("Length : %d bytes\n", (ptlv_header->tlv_length1) | + (ptlv_header->tlv_length2 << 8) | + (ptlv_header->tlv_length3 << 16)); +- PR_DBG("Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); +- PR_DBG("Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); +- PR_DBG("Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); +- PR_DBG("Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); +- PR_DBG("Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); +- PR_DBG("Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); +- PR_DBG("Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); +- PR_DBG("Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); +- PR_DBG("Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); +- PR_DBG("Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); +- PR_DBG("Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); +- PR_DBG("====================================================\n"); ++ PR_INFO("Total Length : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); ++ PR_INFO("Patch Data Length : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); ++ PR_INFO("Signing Format Version : 0x%x\n", ptlv_header->tlv.patch.sign_ver); ++ PR_INFO("Signature Algorithm : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ PR_INFO("Event Handling : 0x%x\n", ptlv_header->tlv.patch.dwnd_cfg); ++ PR_INFO("Reserved : 0x%x\n", ptlv_header->tlv.patch.reserved1); ++ PR_INFO("Product ID : 0x%04x\n", ptlv_header->tlv.patch.prod_id); ++ PR_INFO("Rom Build Version : 0x%04x\n", ptlv_header->tlv.patch.build_ver); ++ PR_INFO("Patch Version : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); ++ PR_INFO("Reserved : 0x%x\n", ptlv_header->tlv.patch.reserved2); ++ PR_INFO("Patch Entry Address : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); ++ PR_INFO("====================================================\n"); + + } else if (ptlv_header->tlv_type == TLV_TYPE_NVM) { +- PR_DBG("====================================================\n"); +- PR_DBG("TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); +- PR_DBG("Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) | +- (ptlv_header->tlv_length2 << 8) | +- (ptlv_header->tlv_length3 << 16)); ++ PR_INFO("====================================================\n"); ++ PR_INFO("TLV Type : 0x%x\n", ptlv_header->tlv_type); ++ PR_INFO("Length : %d bytes\n", nvm_length = ++ (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); + + if (nvm_length <= 0) + return readSize; +@@ -1062,7 +1063,7 @@ int rome_get_tlv_file(char *file_path, unsigned char baud_rate) + /* Write BD Address */ + if (nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(bdaddr) == 0) { + memcpy(nvm_byte_ptr, bdaddr, 6); +- PR_DBG("Overriding default BD ADDR with user" ++ PR_INFO("Overriding default BD ADDR with user" + " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); +@@ -1071,7 +1072,7 @@ int rome_get_tlv_file(char *file_path, unsigned char baud_rate) + /* Remove it from NVM data */ + if (nvm_ptr->tag_id == TAG_NUM_2) { + int nvm_size = nvm_ptr->tag_len + sizeof(tlv_nvm_hdr); +- PR_DBG("Skip BD Address from NVM\n"); ++ PR_INFO("Skip BD Address from NVM\n"); + nvm_index += nvm_ptr->tag_len; + nvm_byte_ptr += nvm_ptr->tag_len; + memmove(nvm_ptr, nvm_byte_ptr, nvm_length - nvm_index); +@@ -1088,7 +1089,7 @@ int rome_get_tlv_file(char *file_path, unsigned char baud_rate) + nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= + (~(FWCONF_IBS_ENABLE << FWCONF_IBS_VAL_BIT)); + if (baud_rate != nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET]) { +- PR_DBG("Change Vendor Baud from 0x%02x to 0x%02x\n", ++ PR_INFO("Change Vendor Baud from 0x%02x to 0x%02x\n", + nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET], baud_rate); + nvm_byte_ptr[FWCONF_BAUD_VAL_OFFSET] = baud_rate; + } +@@ -1144,7 +1145,7 @@ int rome_get_tlv_file(char *file_path, unsigned char baud_rate) + nvm_byte_ptr +=nvm_ptr->tag_len; + } + +- PR_DBG("====================================================\n"); ++ PR_INFO("====================================================\n"); + + } else { + fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); +@@ -1839,9 +1840,6 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + goto error; + } + +- /* FW download complete, add some delay before updating baudrate */ +- usleep(20000); +- + /* + * Overriding the baud rate value in NVM file with the user + * requested baud rate, since default baud rate in NVM file is 3M. +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 1ea9d865b..597743e0b 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -48,6 +48,7 @@ + #define USERIAL_OP_CLK_OFF 0x5442 + #endif + ++#define PR_INFO(fmt, arg...) printf(fmt, ## arg) + #ifdef DEBUG + #define PR_DBG(fmt, arg...) printf(fmt, ## arg) + #else diff --git a/packages/network/bluez/patches/bluez-link_against_ncurses.patch b/packages/network/bluez/patches/bluez-link_against_ncurses.patch deleted file mode 100644 index 9bab171e90..0000000000 --- a/packages/network/bluez/patches/bluez-link_against_ncurses.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff -Naur bluez-5.35/Makefile.tools bluez-5.35.patch/Makefile.tools ---- bluez-5.35/Makefile.tools 2015-09-04 03:19:36.000000000 +0200 -+++ bluez-5.35.patch/Makefile.tools 2015-10-02 15:28:03.406835739 +0200 -@@ -8,7 +8,7 @@ - client/gatt.h client/gatt.c \ - monitor/uuid.h monitor/uuid.c - client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@ \ -- -lreadline -+ -lreadline -lncurses - endif - - if MONITOR -@@ -340,12 +340,12 @@ - attrib/utils.c src/log.c client/display.c \ - client/display.h - attrib_gatttool_LDADD = lib/libbluetooth-internal.la \ -- src/libshared-glib.la @GLIB_LIBS@ -lreadline -+ src/libshared-glib.la @GLIB_LIBS@ -lreadline -lncurses - - tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \ - tools/obex-client-tool.c - tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \ -- @GLIB_LIBS@ -lreadline -+ @GLIB_LIBS@ -lreadline -lncurses - - tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \ - tools/obex-server-tool.c -@@ -354,16 +354,16 @@ - tools_bluetooth_player_SOURCES = tools/bluetooth-player.c \ - client/display.h client/display.c - tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \ -- @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -+ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses - - tools_obexctl_SOURCES = tools/obexctl.c \ - client/display.h client/display.c - tools_obexctl_LDADD = gdbus/libgdbus-internal.la \ -- @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -+ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses - - tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c - tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \ -- -lreadline -+ -lreadline -lncurses - endif - - if EXPERIMENTAL diff --git a/packages/network/bluez/system.d/bluetooth-defaults.service b/packages/network/bluez/system.d/bluetooth-defaults.service new file mode 100644 index 0000000000..7d751631ef --- /dev/null +++ b/packages/network/bluez/system.d/bluetooth-defaults.service @@ -0,0 +1,11 @@ +[Unit] +Description=Bluetooth defaults +After=local-fs.target + +ConditionPathExists=!/storage/.cache/services/bluez.conf +ConditionPathExists=!/storage/.cache/services/bluez.disabled + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'cp /usr/share/services/bluez.conf /storage/.cache/services/' +RemainAfterExit=yes diff --git a/packages/network/bluez/system.d/bluetooth.service b/packages/network/bluez/system.d/bluetooth.service index d3514531fa..4a63139443 100644 --- a/packages/network/bluez/system.d/bluetooth.service +++ b/packages/network/bluez/system.d/bluetooth.service @@ -1,6 +1,7 @@ [Unit] Description=Bluetooth service -Requires=bluetooth.target +After=syslog.target bluetooth-defaults.service +Requires=bluetooth-defaults.service ConditionPathExists=/storage/.cache/services/bluez.conf diff --git a/packages/network/bluez/tmpfiles.d/z_05_bluez.conf b/packages/network/bluez/tmpfiles.d/z_05_bluez.conf index 58177287e3..f0df6f4b3e 100644 --- a/packages/network/bluez/tmpfiles.d/z_05_bluez.conf +++ b/packages/network/bluez/tmpfiles.d/z_05_bluez.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /storage/.cache/bluetooth 0755 root root - - diff --git a/packages/network/connman/package.mk b/packages/network/connman/package.mk index e982efcab4..5d46cfbf63 100644 --- a/packages/network/connman/package.mk +++ b/packages/network/connman/package.mk @@ -1,43 +1,22 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="connman" -PKG_VERSION="1.33" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.36" +PKG_SHA256="c789db41cc443fa41e661217ea321492ad59a004bebcd1aa013f3bc10a6e0074" PKG_LICENSE="GPL" PKG_SITE="http://www.connman.net" PKG_URL="https://www.kernel.org/pub/linux/network/connman/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain glib readline dbus iptables wpa_supplicant" -PKG_SECTION="network" -PKG_SHORTDESC="connman: Network manager daemon" -PKG_LONGDESC="The ConnMan project provides a daemon for managing internet connections within embedded devices running the Linux operating system. The Connection Manager is designed to be slim and to use as few resources as possible, so it can be easily integrated. It is a fully modular system that can be extended, through plug-ins, to support all kinds of wired or wireless technologies. Also, configuration methods, like DHCP and domain name resolving, are implemented using plug-ins. The plug-in approach allows for easy adaption and modification for various use cases." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A modular network connection manager." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="WPASUPPLICANT=/usr/bin/wpa_supplicant \ --srcdir=.. \ - --disable-gtk-doc \ --disable-debug \ --disable-hh2serial-gps \ --disable-openconnect \ - --disable-openvpn \ + --enable-openvpn --with-openvpn=/usr/sbin/openvpn \ --disable-vpnc \ --disable-l2tp \ --disable-pptp \ @@ -59,14 +38,15 @@ PKG_CONFIGURE_OPTS_TARGET="WPASUPPLICANT=/usr/bin/wpa_supplicant \ --disable-neard \ --disable-wispr \ --disable-tools \ + --disable-stats \ --enable-client \ --enable-datafiles \ --with-dbusconfdir=/etc \ --with-systemdunitdir=/usr/lib/systemd/system \ --disable-silent-rules" - PKG_MAKE_OPTS_TARGET="storagedir=/storage/.cache/connman \ + vpn_storagedir=/storage/.config/vpn-config \ statedir=/run/connman" post_makeinstall_target() { @@ -89,13 +69,14 @@ post_makeinstall_target() { cp ../src/main.conf $INSTALL/etc/connman sed -i $INSTALL/etc/connman/main.conf \ -e "s|^# BackgroundScanning.*|BackgroundScanning = true|g" \ + -e "s|^# UseGatewaysAsTimeservers.*|UseGatewaysAsTimeservers = false|g" \ -e "s|^# FallbackNameservers.*|FallbackNameservers = 8.8.8.8,8.8.4.4|g" \ -e "s|^# FallbackTimeservers.*|FallbackTimeservers = 0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org|g" \ -e "s|^# PreferredTechnologies.*|PreferredTechnologies = ethernet,wifi,cellular|g" \ -e "s|^# TetheringTechnologies.*|TetheringTechnologies = wifi|g" \ -e "s|^# AllowHostnameUpdates.*|AllowHostnameUpdates = false|g" \ -e "s|^# PersistentTetheringMode.*|PersistentTetheringMode = true|g" \ - -e "s|^# NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb|NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,docker,veth|g" + -e "s|^# NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb|NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,docker,veth,zt|g" mkdir -p $INSTALL/usr/config cp $PKG_DIR/config/hosts.conf $INSTALL/usr/config diff --git a/packages/network/connman/patches/connman-00-upstream-main-Add-UseGatewaysAsTimeservers-option.patch b/packages/network/connman/patches/connman-00-upstream-main-Add-UseGatewaysAsTimeservers-option.patch new file mode 100644 index 0000000000..fc2e2ba1b7 --- /dev/null +++ b/packages/network/connman/patches/connman-00-upstream-main-Add-UseGatewaysAsTimeservers-option.patch @@ -0,0 +1,76 @@ +From b5e589fc385a2d4a62c6d91cefe6ad1b6bd9fa68 Mon Sep 17 00:00:00 2001 +From: Chris Novakovic +Date: Sun, 8 Jul 2018 00:59:05 +0100 +Subject: [PATCH] main: Add UseGatewaysAsTimeservers option + +Add support for a new boolean option UseGatewaysAsTimeservers to the +[General] section of main.conf. + +This is upstream commit 20f2041 backported for ConnMan 1.36. +--- + src/main.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/src/main.c b/src/main.c +index 318bf02..ad8595e 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -81,6 +81,7 @@ static struct { + char *vendor_class_id; + bool enable_online_check; + bool auto_connect_roaming_services; ++ bool use_gateways_as_timeservers; + } connman_settings = { + .bg_scan = true, + .pref_timeservers = NULL, +@@ -100,6 +101,7 @@ static struct { + .vendor_class_id = NULL, + .enable_online_check = true, + .auto_connect_roaming_services = false, ++ .use_gateways_as_timeservers = false, + }; + + #define CONF_BG_SCAN "BackgroundScanning" +@@ -120,6 +122,7 @@ static struct { + #define CONF_VENDOR_CLASS_ID "VendorClassID" + #define CONF_ENABLE_ONLINE_CHECK "EnableOnlineCheck" + #define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices" ++#define CONF_USE_GATEWAYS_AS_TIMESERVERS "UseGatewayAsTimeservers" + + static const char *supported_options[] = { + CONF_BG_SCAN, +@@ -140,6 +143,7 @@ static const char *supported_options[] = { + CONF_VENDOR_CLASS_ID, + CONF_ENABLE_ONLINE_CHECK, + CONF_AUTO_CONNECT_ROAMING_SERVICES, ++ CONF_USE_GATEWAYS_AS_TIMESERVERS, + NULL + }; + +@@ -431,6 +435,13 @@ static void parse_config(GKeyFile *config) + connman_settings.auto_connect_roaming_services = boolean; + + g_clear_error(&error); ++ ++ boolean = __connman_config_get_bool(config, "General", ++ CONF_USE_GATEWAYS_AS_TIMESERVERS, &error); ++ if (!error) ++ connman_settings.use_gateways_as_timeservers = boolean; ++ ++ g_clear_error(&error); + } + + static int config_init(const char *file) +@@ -644,6 +655,9 @@ bool connman_setting_get_bool(const char *key) + if (g_str_equal(key, CONF_AUTO_CONNECT_ROAMING_SERVICES)) + return connman_settings.auto_connect_roaming_services; + ++ if (g_str_equal(key, CONF_USE_GATEWAYS_AS_TIMESERVERS)) ++ return connman_settings.use_gateways_as_timeservers; ++ + return false; + } + +-- +2.7.4 + diff --git a/packages/network/connman/patches/connman-00-upstream-timeserver-UseGatewaysAsTimeservers.patch b/packages/network/connman/patches/connman-00-upstream-timeserver-UseGatewaysAsTimeservers.patch new file mode 100644 index 0000000000..955833c55d --- /dev/null +++ b/packages/network/connman/patches/connman-00-upstream-timeserver-UseGatewaysAsTimeservers.patch @@ -0,0 +1,50 @@ +From 3ce40776cf1e9cbb02279117298e2514aba42ffe Mon Sep 17 00:00:00 2001 +From: Chris Novakovic +Date: Sun, 27 May 2018 17:02:53 +0100 +Subject: timeserver: Use gateways as timeservers if + UseGatewaysAsTimeservers=true + +Rather than always assuming that service gateways are capable of +functioning as timeservers, only do so if UseGatewaysAsTimeservers is +set to true in main.conf. +--- + src/timeserver.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +diff --git a/src/timeserver.c b/src/timeserver.c +index 393c64c..f9467a2 100644 +--- a/src/timeserver.c ++++ b/src/timeserver.c +@@ -268,15 +268,20 @@ GSList *__connman_timeserver_get_all(struct connman_service *service) + for (i = 0; service_ts && service_ts[i]; i++) + list = __connman_timeserver_add_list(list, service_ts[i]); + +- network = __connman_service_get_network(service); +- if (network) { +- index = connman_network_get_index(network); +- service_gw = __connman_ipconfig_get_gateway_from_index(index, +- CONNMAN_IPCONFIG_TYPE_ALL); +- +- /* Then add Service Gateway to the list */ +- if (service_gw) +- list = __connman_timeserver_add_list(list, service_gw); ++ /* ++ * Then add Service Gateway to the list, if UseGatewaysAsTimeservers ++ * configuration option is set to true. ++ */ ++ if (connman_setting_get_bool("UseGatewaysAsTimeservers")) { ++ network = __connman_service_get_network(service); ++ if (network) { ++ index = connman_network_get_index(network); ++ service_gw = __connman_ipconfig_get_gateway_from_index(index, ++ CONNMAN_IPCONFIG_TYPE_ALL); ++ ++ if (service_gw) ++ list = __connman_timeserver_add_list(list, service_gw); ++ } + } + + /* Then add Global Timeservers to the list */ +-- +cgit v1.1 + diff --git a/packages/network/connman/patches/connman-04-do-not-add-default-gw-as-timeserver.patch b/packages/network/connman/patches/connman-04-do-not-add-default-gw-as-timeserver.patch deleted file mode 100644 index 518e192c47..0000000000 --- a/packages/network/connman/patches/connman-04-do-not-add-default-gw-as-timeserver.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0b595ee514797c75663a9ddc4ddc81c6c82dc64a Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Sat, 7 Sep 2013 15:11:36 +0300 -Subject: [PATCH] do not add default gw as timeserver - -*always* adding default gw to timeserver list is a horrible idea - -this reverts http://git.kernel.org/cgit/network/connman/connman.git/commit/?id=bbd19813c457227a2861c05e9ebc676f8feb7f10 ---- - src/timeserver.c | 13 ------------- - 1 files changed, 0 insertions(+), 13 deletions(-) - -diff --git a/src/timeserver.c b/src/timeserver.c -index 6440611..6386521 100644 ---- a/src/timeserver.c -+++ b/src/timeserver.c -@@ -179,11 +179,9 @@ GSList *__connman_timeserver_add_list(GSList *server_list, - GSList *__connman_timeserver_get_all(struct connman_service *service) - { - GSList *list = NULL; -- struct connman_network *network; - char **timeservers; - char **service_ts; - char **service_ts_config; -- const char *service_gw; - char **fallback_ts; - int index, i; - -@@ -204,17 +202,6 @@ GSList *__connman_timeserver_get_all(struct connman_service *service) - for (i = 0; service_ts && service_ts[i]; i++) - list = __connman_timeserver_add_list(list, service_ts[i]); - -- network = __connman_service_get_network(service); -- if (network) { -- index = connman_network_get_index(network); -- service_gw = __connman_ipconfig_get_gateway_from_index(index, -- CONNMAN_IPCONFIG_TYPE_ALL); -- -- /* Then add Service Gateway to the list */ -- if (service_gw) -- list = __connman_timeserver_add_list(list, service_gw); -- } -- - /* Then add Global Timeservers to the list */ - timeservers = load_timeservers(); - --- -1.7.2.5 - diff --git a/packages/network/connman/patches/connman-05_link-against-ncurses.patch b/packages/network/connman/patches/connman-05_link-against-ncurses.patch index 659051aae6..a74af3a3e1 100644 --- a/packages/network/connman/patches/connman-05_link-against-ncurses.patch +++ b/packages/network/connman/patches/connman-05_link-against-ncurses.patch @@ -16,7 +16,7 @@ index 41efc1f..d1d3ddc 100644 client_connmanctl_LDADD = gdbus/libgdbus-internal.la @DBUS_LIBS@ @GLIB_LIBS@ \ - -lreadline -ldl -+ -lreadline -lncurses -ltermcap -ldl ++ -lreadline -lncurses -ldl endif noinst_PROGRAMS += unit/test-pbkdf2-sha1 unit/test-prf-sha1 unit/test-ippool diff --git a/packages/network/connman/patches/connman-06-fix-dns-ordering.patch b/packages/network/connman/patches/connman-06-fix-dns-ordering.patch deleted file mode 100644 index aa4f296e1a..0000000000 --- a/packages/network/connman/patches/connman-06-fix-dns-ordering.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ff413a83164b2398549ed9e94277addb9bbc36f8 Mon Sep 17 00:00:00 2001 -From: Sam Nazarko -Date: Thu, 21 Jul 2016 15:59:48 +0100 -Subject: [PATCH] [package] [connman-osmc] Fix an issue where DNS servers and - search domains are added in the reverse order - -Signed-off-by: Sam Nazarko ---- - src/resolver.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/resolver.c b/src/resolver.c -index fbe4be7..c4adbc6 100644 ---- a/src/resolver.c -+++ b/src/resolver.c -@@ -100,9 +100,9 @@ static int resolvfile_export(void) - * MAXDNSRCH/MAXNS entries are used. - */ - -- for (count = 0, list = g_list_last(resolvfile_list); -+ for (count = 0, list = g_list_first(resolvfile_list); - list && (count < MAXDNSRCH); -- list = g_list_previous(list)) { -+ list = g_list_next(list)) { - struct resolvfile_entry *entry = list->data; - - if (!entry->domain) -@@ -118,9 +118,9 @@ static int resolvfile_export(void) - if (count) - g_string_append_printf(content, "\n"); - -- for (count = 0, list = g_list_last(resolvfile_list); -+ for (count = 0, list = g_list_first(resolvfile_list); - list && (count < MAXNS); -- list = g_list_previous(list)) { -+ list = g_list_next(list)) { - struct resolvfile_entry *entry = list->data; - - if (!entry->server) --- -2.7.4 - diff --git a/packages/network/connman/scripts/connman-setup b/packages/network/connman/scripts/connman-setup index 060d0b6cce..b6388ed37e 100755 --- a/packages/network/connman/scripts/connman-setup +++ b/packages/network/connman/scripts/connman-setup @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # creating initial settings file if [ ! -f /storage/.cache/connman/settings ]; then diff --git a/packages/network/connman/system.d/connman-vpn.service b/packages/network/connman/system.d/connman-vpn.service new file mode 100644 index 0000000000..54c0ab4bcc --- /dev/null +++ b/packages/network/connman/system.d/connman-vpn.service @@ -0,0 +1,14 @@ +[Unit] +Description=ConnMan VPN service +Requires=dbus.socket +After=dbus.socket + +[Service] +Type=dbus +BusName=net.connman.vpn +EnvironmentFile=-/run/openelec/debug/connman.conf +ExecStart=/usr/sbin/connman-vpnd -n $CONNMANVPN_DEBUG +StandardOutput=null + +[Install] +WantedBy=multi-user.target diff --git a/packages/network/connman/tmpfiles.d/z_03_connman.conf b/packages/network/connman/tmpfiles.d/z_03_connman.conf index cdc18d8b8e..c104405541 100644 --- a/packages/network/connman/tmpfiles.d/z_03_connman.conf +++ b/packages/network/connman/tmpfiles.d/z_03_connman.conf @@ -1,20 +1,6 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /run/connman 0755 root root - - d /storage/.cache/connman 0755 root root - - +d /storage/.config/vpn-config 0755 root root - - diff --git a/packages/network/ethtool/package.mk b/packages/network/ethtool/package.mk index da04032898..02e16d45aa 100644 --- a/packages/network/ethtool/package.mk +++ b/packages/network/ethtool/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="ethtool" -PKG_VERSION="4.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="4.15" +PKG_SHA256="71f7fd32483ffdc7c6c4d882e230714eb101df0a46cbe396dbeb8ac78f1ef91a" PKG_LICENSE="GPL" PKG_SITE="http://www.kernel.org/pub/software/network/ethtool/" PKG_URL="http://www.kernel.org/pub/software/network/ethtool/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="ethtool: Display or change ethernet card settings" PKG_LONGDESC="Ethtool is used for querying settings of an ethernet device and changing them." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/network/ethtool/udev.d/99-wakeup-eth.rules b/packages/network/ethtool/udev.d/99-wakeup-eth.rules index 1c17fe9892..add3a4a971 100644 --- a/packages/network/ethtool/udev.d/99-wakeup-eth.rules +++ b/packages/network/ethtool/udev.d/99-wakeup-eth.rules @@ -1,27 +1,12 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -#      Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) ACTION!="add|change", GOTO="end" SUBSYSTEM!="net", GOTO="end" ENV{INTERFACE}!="eth*", GOTO="end" -RUN+="/bin/sh -c 'echo enabled >/sys/class/net/$env{INTERFACE}/device/power/wakeup' " +TEST=="/sys/class/net/$env{INTERFACE}/device/power/wakeup", RUN+="/bin/sh -c 'echo enabled >/sys/class/net/$env{INTERFACE}/device/power/wakeup'" RUN+="/usr/sbin/ethtool -s $env{INTERFACE} wol g" LABEL="end" diff --git a/packages/network/iana-etc/package.mk b/packages/network/iana-etc/package.mk deleted file mode 100644 index c7060bb8eb..0000000000 --- a/packages/network/iana-etc/package.mk +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="iana-etc" -PKG_VERSION="2.30" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.linuxfromscratch.org/lfs/view/development/chapter06/iana-etc.html" -PKG_URL="http://anduin.linuxfromscratch.org/sources/LFS/lfs-packages/conglomeration/iana-etc/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="iana-etc: The Iana-Etc package provides data for network services and protocols." -PKG_LONGDESC="The Iana-Etc package provides data for network services and protocols." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -post_make_target() { - sed -e 's,^sunrpc,rpcbind,' -i services -} - -makeinstall_target() { - mkdir -p $INSTALL/etc - cp protocols $INSTALL/etc - cp services $INSTALL/etc -} diff --git a/packages/network/iptables/config/README b/packages/network/iptables/config/README new file mode 100644 index 0000000000..77d75ff599 --- /dev/null +++ b/packages/network/iptables/config/README @@ -0,0 +1,17 @@ +To create your own set of Netfilters you can save your rules in: + +/storage/.config/iptables/rules.v4 for ipv4 +/storage/.config/iptables/rules.v6 for ipv6 + +To modify tables, edit with nano then save with: + +iptables-save >/storage/.config/iptables/rules.v4 +ip6tables-save >/storage/.config/iptables/rules.v6 + +To disable iptables use the following command: + +systemctl mask iptables + +To enable iptables again: + +systemctl unmask iptables diff --git a/packages/network/iptables/config/home.v4 b/packages/network/iptables/config/home.v4 new file mode 100644 index 0000000000..583a3e845e --- /dev/null +++ b/packages/network/iptables/config/home.v4 @@ -0,0 +1,44 @@ +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] +:DOCKER-USER - [0:0] +:private-subnets - [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A INPUT -i tether -p udp -m conntrack --ctstate NEW -j ACCEPT +-A INPUT -j private-subnets +-A FORWARD -i tether -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j ACCEPT +-A FORWARD -o tether -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A DOCKER-USER -j private-subnets +-A private-subnets -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A private-subnets -s 10.0.0.0/8 -i eth+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 172.16.0.0/12 -i eth+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 192.168.0.0/16 -i eth+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 10.0.0.0/8 -i en+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 172.16.0.0/12 -i en+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 192.168.0.0/16 -i en+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 10.0.0.0/8 -i wl+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 172.16.0.0/12 -i wl+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 192.168.0.0/16 -i wl+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 10.0.0.0/8 -i tether -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 172.16.0.0/12 -i tether -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 192.168.0.0/16 -i tether -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 10.0.0.0/8 -i docker+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 172.16.0.0/12 -i docker+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s 192.168.0.0/16 -i docker+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -j REJECT --reject-with icmp-port-unreachable +COMMIT +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT +*mangle +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT diff --git a/packages/network/iptables/config/home.v6 b/packages/network/iptables/config/home.v6 new file mode 100644 index 0000000000..44074d0908 --- /dev/null +++ b/packages/network/iptables/config/home.v6 @@ -0,0 +1,34 @@ +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] +:DOCKER-USER - [0:0] +:private-subnets - [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A INPUT -i tether -p udp -m conntrack --ctstate NEW -j ACCEPT +-A INPUT -j private-subnets +-A FORWARD -i tether -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j ACCEPT +-A FORWARD -o tether -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A DOCKER-USER -j private-subnets +-A private-subnets -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A private-subnets -s fc00::/7 -i eth+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s fc00::/7 -i en+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s fc00::/7 -i wl+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s fc00::/7 -i tether -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -s fc00::/7 -i docker+ -m conntrack --ctstate NEW -j ACCEPT +-A private-subnets -j REJECT --reject-with icmp6-port-unreachable +COMMIT +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT +*mangle +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT diff --git a/packages/network/iptables/config/public.v4 b/packages/network/iptables/config/public.v4 new file mode 100644 index 0000000000..7872e8d4bd --- /dev/null +++ b/packages/network/iptables/config/public.v4 @@ -0,0 +1,31 @@ +# Netfilter rules for public "untrusted" networks +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] +:DOCKER-USER - [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +# Allow tethered Wifi AP +-A INPUT -i tether -p udp -m conntrack --ctstate NEW -j ACCEPT +-A INPUT -i tether -s 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 -m conntrack --ctstate NEW -j ACCEPT +-A FORWARD -i tether -s 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 -m conntrack --ctstate NEW -j ACCEPT +-A FORWARD -i tether -s 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT +-A FORWARD -o tether -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT +# Block DOCKER +-A DOCKER-USER -m conntrack --ctstate RELATED,ESTABLISHED -j RETURN +-A DOCKER-USER -j REJECT --reject-with icmp-port-unreachable +COMMIT +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT +*mangle +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT diff --git a/packages/network/iptables/config/public.v6 b/packages/network/iptables/config/public.v6 new file mode 100644 index 0000000000..bddcccdd44 --- /dev/null +++ b/packages/network/iptables/config/public.v6 @@ -0,0 +1,30 @@ +# Netfilter Rules for trusted home networks. +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] +:DOCKER-USER - [0:0] +-A INPUT -i lo -j ACCEPT +-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +# Allow tethered Wifi AP +-A INPUT -i tether -p udp -m conntrack --ctstate NEW -j ACCEPT +-A INPUT -i tether -s fc00::/7 -m conntrack --ctstate NEW -j ACCEPT +-A FORWARD -i tether -s fc00::/7 -m conntrack --ctstate NEW -j ACCEPT +-A FORWARD -i tether -s fc00::/7 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT +-A FORWARD -o tether -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT +-A DOCKER-USER -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +-A DOCKER-USER -j REJECT --reject-with icmp6-port-unreachable +COMMIT +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT +*mangle +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT diff --git a/packages/network/iptables/package.mk b/packages/network/iptables/package.mk index 3c6cbbe1ac..341db5a92c 100644 --- a/packages/network/iptables/package.mk +++ b/packages/network/iptables/package.mk @@ -1,34 +1,32 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="iptables" -PKG_VERSION="1.6.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.8.2" +PKG_SHA256="a3778b50ed1a3256f9ca975de82c2204e508001fc2471238c8c97f3d1c4c12af" PKG_LICENSE="GPL" PKG_SITE="http://www.netfilter.org/" PKG_URL="http://www.netfilter.org/projects/iptables/files/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain linux libmnl libnftnl" -PKG_SECTION="network" -PKG_SHORTDESC="iptables: IP packet filter administration" -PKG_LONGDESC="Iptables is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. There are several different tables which may be defined, and each table contains a number of built-in chains, and may contain user-defined chains." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="IP packet filter administration." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--with-kernel=$(kernel_path)" + + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/config/iptables/ + cp -PR $PKG_DIR/config/README $INSTALL/usr/config/iptables/ + + mkdir -p $INSTALL/etc/iptables/ + cp -PR $PKG_DIR/config/* $INSTALL/etc/iptables/ + + mkdir -p $INSTALL/usr/lib/libreelec + cp $PKG_DIR/scripts/iptables_helper $INSTALL/usr/lib/libreelec +} + +post_install() { + enable_service iptables.service +} + diff --git a/packages/network/iptables/patches/iptables-0001-fix-build-with-pre-4.2-kernels.patch b/packages/network/iptables/patches/iptables-0001-fix-build-with-pre-4.2-kernels.patch new file mode 100644 index 0000000000..43605d62eb --- /dev/null +++ b/packages/network/iptables/patches/iptables-0001-fix-build-with-pre-4.2-kernels.patch @@ -0,0 +1,52 @@ +From fe9a5c043082a553ed1789cb478f2c48763e7f30 Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Fri, 16 Nov 2018 09:30:33 +0200 +Subject: [PATCH] include: fix build with kernel headers before 4.2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 672accf1530 (include: update kernel netfilter header files) +updated linux/netfilter.h and brought with it the update from kernel +commit a263653ed798 (netfilter: don't pull include/linux/netfilter.h +from netns headers). This triggers conflict of headers that is fixed in +kernel commit 279c6c7fa64f (api: fix compatibility of linux/in.h with +netinet/in.h) included in kernel version 4.2. For earlier kernel headers +we need a workaround that prevents the headers conflict. + +Fixes the following build failure: + +In file included from .../sysroot/usr/include/netinet/ip.h:25:0, + from ../include/libiptc/ipt_kernel_headers.h:8, + from ../include/libiptc/libiptc.h:6, + from libip4tc.c:29: +.../sysroot/usr/include/linux/in.h:26:3: error: redeclaration of enumerator ‘IPPROTO_IP’ + IPPROTO_IP = 0, /* Dummy protocol for TCP */ + ^ +.../sysroot/usr/include/netinet/in.h:33:5: note: previous definition of ‘IPPROTO_IP’ was here + IPPROTO_IP = 0, /* Dummy protocol for TCP. */ + ^~~~~~~~~~ + +Signed-off-by: Baruch Siach +Signed-off-by: Florian Westphal +--- + include/linux/netfilter.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h +index c3f087a..bacf8cd 100644 +--- a/include/linux/netfilter.h ++++ b/include/linux/netfilter.h +@@ -3,7 +3,9 @@ + + #include + ++#ifndef _NETINET_IN_H + #include ++#endif + #include + #include + +-- +2.14.1 + diff --git a/packages/network/iptables/patches/iptables-01-buildfix.patch b/packages/network/iptables/patches/iptables-01-buildfix.patch deleted file mode 100644 index cb7327868c..0000000000 --- a/packages/network/iptables/patches/iptables-01-buildfix.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naur iptables-1.6.0/extensions/GNUmakefile.in iptables-1.6.0.patch/extensions/GNUmakefile.in ---- iptables-1.6.0/extensions/GNUmakefile.in 2015-12-09 13:55:06.000000000 +0100 -+++ iptables-1.6.0.patch/extensions/GNUmakefile.in 2015-12-21 07:57:44.698366669 +0100 -@@ -21,7 +21,7 @@ - kinclude_CPPFLAGS = @kinclude_CPPFLAGS@ - - AM_CFLAGS = ${regular_CFLAGS} --AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include ${kinclude_CPPFLAGS} ${CPPFLAGS} @libnetfilter_conntrack_CFLAGS@ @libnftnl_CFLAGS@ -+AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${CPPFLAGS} @libnetfilter_conntrack_CFLAGS@ @libnftnl_CFLAGS@ - AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ - AM_LDFLAGS = @noundef_LDFLAGS@ - -diff -Naur iptables-1.6.0/iptables/Makefile.am iptables-1.6.0.patch/iptables/Makefile.am ---- iptables-1.6.0/iptables/Makefile.am 2015-12-09 13:55:06.000000000 +0100 -+++ iptables-1.6.0.patch/iptables/Makefile.am 2015-12-21 08:03:22.245954635 +0100 -@@ -1,7 +1,7 @@ - # -*- Makefile -*- - - AM_CFLAGS = ${regular_CFLAGS} --AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS} -+AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS} - AM_YFLAGS = -d - - xtables_multi_SOURCES = xtables-multi.c iptables-xml.c diff --git a/packages/network/iptables/patches/iptables-02-add-xtables-config-parser.h-to-BUILT_SOURCES.patch b/packages/network/iptables/patches/iptables-02-add-xtables-config-parser.h-to-BUILT_SOURCES.patch deleted file mode 100644 index 761c04894f..0000000000 --- a/packages/network/iptables/patches/iptables-02-add-xtables-config-parser.h-to-BUILT_SOURCES.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 4dc8e2aa91bd4151f7e5cd56d88d3731b4c1525e Mon Sep 17 00:00:00 2001 -From: Gustavo Zacarias -Date: Wed, 30 Dec 2015 14:39:35 -0300 -Subject: [PATCH] iptables: add xtables-config-parser.h to BUILT_SOURCES - -Otherwise other sources that use it might be built before it's ready leading -to build failure, for example by iptables/nft.c - -Signed-off-by: Gustavo Zacarias ---- -Status: sent upstream (mailing list, no link yet) - - iptables/Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/iptables/Makefile.am b/iptables/Makefile.am -index 3c0faa5..c3eb8a8 100644 ---- a/iptables/Makefile.am -+++ b/iptables/Makefile.am -@@ -4,6 +4,8 @@ AM_CFLAGS = ${regular_CFLAGS} - AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS} - AM_YFLAGS = -d - -+BUILT_SOURCES = -+ - xtables_multi_SOURCES = xtables-multi.c iptables-xml.c - xtables_multi_CFLAGS = ${AM_CFLAGS} - xtables_multi_LDADD = ../extensions/libext.a -@@ -27,6 +29,7 @@ xtables_multi_LDADD += ../libxtables/libxtables.la -lm - - # nftables compatibility layer - if ENABLE_NFTABLES -+BUILT_SOURCES += xtables-config-parser.h - xtables_compat_multi_SOURCES = xtables-compat-multi.c iptables-xml.c - xtables_compat_multi_CFLAGS = ${AM_CFLAGS} - xtables_compat_multi_LDADD = ../extensions/libext.a ../extensions/libext_ebt.a --- -2.4.10 - diff --git a/packages/network/iptables/scripts/iptables_helper b/packages/network/iptables/scripts/iptables_helper new file mode 100755 index 0000000000..4bbd44b899 --- /dev/null +++ b/packages/network/iptables/scripts/iptables_helper @@ -0,0 +1,92 @@ +#!/bin/sh - + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +IPTABLES4="/usr/sbin/iptables" +IPTABLES6="/usr/sbin/ip6tables" +IPTABLES_CMDS="$IPTABLES4 $IPTABLES6" +PUBLIC_RULES="/etc/iptables/public.v" +HOME_RULES="/etc/iptables/home.v" +CUSTOM_RULES="/storage/.config/iptables/rules.v" +DOCKER="service.system.docker.service" +SYSTEMCTL="/usr/bin/systemctl" +CONNMANCTL="/usr/bin/connmanctl" + +check_docker() { + $SYSTEMCTL is-active --quiet $DOCKER && $SYSTEMCTL restart $DOCKER +} + +check_tether() { + if [ -n "`$CONNMANCTL technologies|grep 'Tethering = True'`" ]; then + $CONNMANCTL tether wifi off + sleep 1 + $CONNMANCTL tether wifi on + fi +} + +flush() { + for cmd in $IPTABLES_CMDS; do + $cmd -F + $cmd -X + $cmd -t nat -F + $cmd -t nat -X + $cmd -t mangle -F + $cmd -t mangle -X + $cmd -P INPUT ACCEPT + $cmd -P FORWARD ACCEPT + $cmd -P OUTPUT ACCEPT + done + check_docker + check_tether +} + +enable() { + for cmd in $IPTABLES_CMDS; do + case "$cmd" in + *6*) + rules="$RULES6" + ipv="6" + ;; + *) + rules="$RULES4" + ipv="4" + ;; + esac + if [ -e "$rules" ]; then + "$cmd-restore" "$rules" + fi + done + check_docker + check_tether +} + +if [ "$1" = "enable" ]; then + case "${RULES}" in + "none") + flush + ;; + "public") + RULES4="${PUBLIC_RULES}4" + RULES6="${PUBLIC_RULES}6" + ;; + "home") + RULES4="${HOME_RULES}4" + RULES6="${HOME_RULES}6" + ;; + "custom") + RULES4="${CUSTOM_RULES}4" + RULES6="${CUSTOM_RULES}6" + ;; + *) + exit 1 + ;; + esac + enable +elif [ "$1" = "disable" ]; then + flush +else + exit 1 +fi + +exit 0 diff --git a/packages/network/iptables/system.d/iptables.service b/packages/network/iptables/system.d/iptables.service new file mode 100644 index 0000000000..eacb387908 --- /dev/null +++ b/packages/network/iptables/system.d/iptables.service @@ -0,0 +1,17 @@ +[Unit] +Description=IPTABLES Packet Filtering +ConditionPathExists=/usr/lib/libreelec/iptables_helper +ConditionPathExists=|/storage/.cache/services/iptables.conf +Before=network.target +Wants=network.target + +[Service] +Type=oneshot +EnvironmentFile=-/storage/.cache/services/iptables.conf +ExecStart=/usr/lib/libreelec/iptables_helper enable +ExecReload=/usr/lib/libreelec/iptables_helper enable +ExecStop=/usr/lib/libreelec/iptables_helper disable +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/packages/network/libdnet/package.mk b/packages/network/libdnet/package.mk index 7c6c4233a0..dbdd908599 100644 --- a/packages/network/libdnet/package.mk +++ b/packages/network/libdnet/package.mk @@ -1,47 +1,29 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libdnet" -PKG_VERSION="1.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="8029bf9" +PKG_SHA256="1e41cbe5e4884108b08fa92964305354f1662b7e889f62736b3749845d7a8c56" PKG_LICENSE="BSD" -PKG_SITE="http://code.google.com/p/libdnet/" -PKG_URL="http://libdnet.googlecode.com/files/$PKG_NAME-$PKG_VERSION.tgz" +PKG_SITE="https://github.com/sgeto/libdnet" +PKG_URL="https://github.com/sgeto/libdnet/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="A simplified, portable interface to several low-level networking routines" PKG_LONGDESC="A simplified, portable interface to several low-level networking routines" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_strlcat=no \ ac_cv_func_strlcpy=no \ --enable-static \ --disable-shared \ - --without-python" + --disable-python" pre_configure_target() { - sed "s|@prefix@|$SYSROOT_PREFIX/usr|g" -i $ROOT/$PKG_BUILD/dnet-config.in + export CFLAGS+=" -I$PKG_BUILD/include" } post_makeinstall_target() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp dnet-config $ROOT/$TOOLCHAIN/bin/ + cp $SYSROOT_PREFIX/usr/bin/dnet-config \ + $TOOLCHAIN/bin/dnet-config } diff --git a/packages/network/libmnl/package.mk b/packages/network/libmnl/package.mk index d1fed86830..c2122650e2 100644 --- a/packages/network/libmnl/package.mk +++ b/packages/network/libmnl/package.mk @@ -1,34 +1,13 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libmnl" PKG_VERSION="1.0.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81" PKG_LICENSE="GPL" PKG_SITE="http://netfilter.org/projects/libmnl" PKG_URL="http://netfilter.org/projects/libmnl/files/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="libmnl: a minimalistic user-space library oriented to Netlink developers." -PKG_LONGDESC="libmnl is a minimalistic user-space library oriented to Netlink developers. There are a lot of common tasks in parsing, validating, constructing of both the Netlink header and TLVs that are repetitive and easy to get wrong. This library aims to provide simple helpers that allows you to re-use code and to avoid re-inventing the wheel." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A minimalistic user-space library oriented to Netlink developers." PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" diff --git a/packages/network/libnfs/package.mk b/packages/network/libnfs/package.mk index dbb98874f3..a708e2c32a 100644 --- a/packages/network/libnfs/package.mk +++ b/packages/network/libnfs/package.mk @@ -1,38 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libnfs" -PKG_VERSION="1.11.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="38b62bcf873c778ebde79707bb0409b6a09ee608" +PKG_SHA256="12e8e2e142ca4c41e1f1a22ce6e88b205bacdedfa29daaff91a5d54cf834ea61" PKG_LICENSE="GPL" PKG_SITE="https://github.com/sahlberg/libnfs" -PKG_URL="https://github.com/sahlberg/libnfs/archive/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="$PKG_NAME-$PKG_NAME-$PKG_VERSION" +PKG_URL="https://github.com/sahlberg/libnfs/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="libnfs: a client library for accessing NFS shares over a network." -PKG_LONGDESC="LIBNFS is a client library for accessing NFS shares over a network." +PKG_LONGDESC="A client library for accessing NFS shares over a network." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--disable-examples --disable-tirpc" +PKG_CONFIGURE_OPTS_TARGET="--disable-examples" pre_configure_target() { export CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" diff --git a/packages/network/libnftnl/package.mk b/packages/network/libnftnl/package.mk index 203f551a87..fa04fc2332 100644 --- a/packages/network/libnftnl/package.mk +++ b/packages/network/libnftnl/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libnftnl" -PKG_VERSION="1.0.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.1.2" +PKG_SHA256="a5c7b7a6c13c9c5898b13fcb1126fefce2015d5a96d7c354b19aaa40b6aece5d" PKG_LICENSE="GPL" PKG_SITE="http://netfilter.org/projects/libnftnl" PKG_URL="http://netfilter.org/projects/libnftnl/files/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libmnl" -PKG_SECTION="network" -PKG_SHORTDESC="libnftnl: a userspace library providing a low-level netlink programming interface (API) to the in-kernel nf_tables subsystem." -PKG_LONGDESC="libnftnl is a userspace library providing a low-level netlink programming interface (API) to the in-kernel nf_tables subsystem. The library libnftnl has been previously known as libnftables. This library is currently used by nftables." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A userspace library providing a low-level netlink programming interface (API) to the in-kernel nf_tables subsystem." PKG_CONFIGURE_OPTS_TARGET="--disable-shared --enable-static" - diff --git a/packages/network/libnl/package.mk b/packages/network/libnl/package.mk index 0965cd516c..29abe2249b 100644 --- a/packages/network/libnl/package.mk +++ b/packages/network/libnl/package.mk @@ -1,34 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libnl" -PKG_VERSION="3.2.27" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.4.0" +PKG_SHA256="b7287637ae71c6db6f89e1422c995f0407ff2fe50cecd61a312b6a9b0921f5bf" PKG_LICENSE="LGPL" -PKG_SITE="http://people.suug.ch/~tgr/libnl/" -PKG_URL="https://github.com/thom311/$PKG_NAME/releases/download/${PKG_NAME}${PKG_VERSION//./_}/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/thom311/libnl" +PKG_URL="https://github.com/thom311/libnl/releases/download/libnl${PKG_VERSION//./_}/libnl-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="libnl: libnl - netlink library" -PKG_LONGDESC="libnl is a library for applications dealing with netlink socket. It provides an easy to use interface for raw netlink message but also netlink family specific APIs." +PKG_LONGDESC="A library for applications dealing with netlink socket." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --disable-cli" +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ + --disable-cli" diff --git a/packages/network/libshairplay/package.mk b/packages/network/libshairplay/package.mk index a1b347f289..afbe86bb4b 100644 --- a/packages/network/libshairplay/package.mk +++ b/packages/network/libshairplay/package.mk @@ -1,36 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libshairplay" -PKG_VERSION="ce80e00" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" +PKG_VERSION="096b61ad14c90169f438e690d096e3fcf87e504e" +PKG_SHA256="7e2b013ffe75ea2f13fb12b1aa38b8e2e8b1899ac292d57f05d7b352a3a181cf" +PKG_LICENSE="MIT" PKG_SITE="https://github.com/juhovh/shairplay" PKG_URL="https://github.com/juhovh/shairplay/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="shairplay-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="libshairplay: emulates AirPort Express" -PKG_LONGDESC="libshairPlay emulates an AirPort Express for the purpose of streaming music from iTunes and compatible iPods." +PKG_DEPENDS_TARGET="toolchain avahi" +PKG_LONGDESC="Apple airplay and raop protocol server" +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +pre_configure_target() { + CFLAGS="$CFLAGS -I$(get_build_dir avahi)/avahi-compat-libdns_sd" +} post_makeinstall_target() { mkdir -p $INSTALL/etc/shairplay diff --git a/packages/network/libssh/package.mk b/packages/network/libssh/package.mk index 2ed6e3a6e4..dfbdf4d44e 100644 --- a/packages/network/libssh/package.mk +++ b/packages/network/libssh/package.mk @@ -1,47 +1,29 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libssh" -PKG_VERSION="0.7.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OpenSource" +PKG_VERSION="0.8.5" +PKG_SHA256="07d2c431240fc88f6b06bcb36ae267f9afeedce2e32f6c42f8844b205ab5a335" +PKG_LICENSE="LGPL" PKG_SITE="http://www.libssh.org/" -PKG_URL="https://git.libssh.org/projects/libssh.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain zlib libressl" -PKG_SECTION="network" -PKG_SHORTDESC="libssh: A working SSH implementation by means of a library" -PKG_LONGDESC="The ssh library was designed to be used by programmers needing a working SSH implementation by the mean of a library. The complete control of the client is made by the programmer. With libssh, you can remotely execute programs, transfer files, use a secure and transparent tunnel for your remote programs. With its Secure FTP implementation, you can play with remote files easily, without third-party programs others than libcrypto (from openssl)." +PKG_URL="https://www.libssh.org/files/${PKG_VERSION%.*}/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain zlib openssl" +PKG_LONGDESC="Library for accessing ssh client services through C libraries." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CMAKE_OPTS_TARGET="-DWITH_STATIC_LIB=1 -DWITH_SERVER=OFF -DWITH_GCRYPT=OFF" +PKG_CMAKE_OPTS_TARGET="-DWITH_STATIC_LIB=1 \ + -DWITH_SERVER=OFF \ + -DWITH_GCRYPT=OFF \ + -DWITH_GSSAPI=OFF \ + -DWITH_INTERNAL_DOC=OFF" makeinstall_target() { # install static library only mkdir -p $SYSROOT_PREFIX/usr/lib cp src/libssh.a $SYSROOT_PREFIX/usr/lib - cp src/threads/libssh_threads.a $SYSROOT_PREFIX/usr/lib mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig cp libssh.pc $SYSROOT_PREFIX/usr/lib/pkgconfig - cp libssh_threads.pc $SYSROOT_PREFIX/usr/lib/pkgconfig mkdir -p $SYSROOT_PREFIX/usr/include/libssh cp ../include/libssh/callbacks.h $SYSROOT_PREFIX/usr/include/libssh diff --git a/packages/network/libssh/patches/libssh-gcc-5-fix.patch b/packages/network/libssh/patches/libssh-gcc-5-fix.patch deleted file mode 100644 index ba1965ff2b..0000000000 --- a/packages/network/libssh/patches/libssh-gcc-5-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur libssh-0.6.4/cmake/Modules/DefineCompilerFlags.cmake libssh-0.6.4.patch/cmake/Modules/DefineCompilerFlags.cmake ---- libssh-0.6.4/cmake/Modules/DefineCompilerFlags.cmake 2014-09-15 20:54:34.000000000 +0200 -+++ libssh-0.6.4.patch/cmake/Modules/DefineCompilerFlags.cmake 2015-04-08 09:43:51.643578533 +0200 -@@ -10,7 +10,7 @@ - if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)") - - # add -Wconversion ? -- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors") -+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute") diff --git a/packages/network/libtirpc/package.mk b/packages/network/libtirpc/package.mk index 1871bcdde2..902bbfbdbb 100644 --- a/packages/network/libtirpc/package.mk +++ b/packages/network/libtirpc/package.mk @@ -1,39 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libtirpc" -PKG_VERSION="1.0.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.0.2" +PKG_SHA256="723c5ce92706cbb601a8db09110df1b4b69391643158f20ff587e20e7c5f90f5" PKG_LICENSE="GPL" PKG_SITE="https://sourceforge.net/projects/libtirpc/" PKG_URL="https://downloads.sourceforge.net/project/libtirpc/libtirpc/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="libtirpc: Transport Independent RPC Library" -PKG_LONGDESC="Libtirpc is a port of Suns Transport-Independent RPC library to Linux. It's being developed by the Bull GNU/Linux NFSv4 project." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A port of Suns Transport-Independent RPC library to Linux." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ --disable-silent-rules \ --enable-ipv6 \ --disable-gssapi \ --with-gnu-ld" - diff --git a/packages/network/libtirpc/patches/libtirpc-0001-include-missing-stdint.h.patch b/packages/network/libtirpc/patches/libtirpc-0001-include-missing-stdint.h.patch new file mode 100644 index 0000000000..f832cf6dd3 --- /dev/null +++ b/packages/network/libtirpc/patches/libtirpc-0001-include-missing-stdint.h.patch @@ -0,0 +1,11 @@ +diff -Naur a/src/xdr_sizeof.c b/src/xdr_sizeof.c +--- a/src/xdr_sizeof.c 2017-07-05 08:02:23.000000000 -0700 ++++ b/src/xdr_sizeof.c 2017-08-02 16:37:31.839143976 -0700 +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include "un-namespace.h" + + /* ARGSUSED */ diff --git a/packages/network/netbase/package.mk b/packages/network/netbase/package.mk new file mode 100644 index 0000000000..9a10ca4625 --- /dev/null +++ b/packages/network/netbase/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="netbase" +PKG_VERSION="5.4" +PKG_SHA256="66ff73d2d162e2d49db43988d8b8cd328cf7fffca042db73397f14c71825e80d" +PKG_LICENSE="GPL" +PKG_SITE="https://anonscm.debian.org/cgit/users/md/netbase.git/" +PKG_URL="http://ftp.debian.org/debian/pool/main/n/netbase/netbase_$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The netbase package provides data for network services and protocols from the iana db." +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/etc + cp etc-protocols $INSTALL/etc/protocols + cp etc-services $INSTALL/etc/services +} diff --git a/packages/network/nss-mdns/package.mk b/packages/network/nss-mdns/package.mk index c8b24c9731..3a0b782778 100644 --- a/packages/network/nss-mdns/package.mk +++ b/packages/network/nss-mdns/package.mk @@ -1,41 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="nss-mdns" -PKG_VERSION="0.10" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="47edc38" +PKG_SHA256="f02e8baeceea30e82a2ecdaa8cafdbcabfdaa33a766f6942e7dc8aa81948f7b6" PKG_LICENSE="GPL" -PKG_SITE="http://0pointer.de/lennart/projects/nss-mdns/" -# PKG_URL="http://0pointer.de/lennart/projects/nss-mdns/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_URL="http://sources.openelec.tv/mirror/nss-mdns/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/lathiat/nss-mdns" +PKG_URL="https://github.com/lathiat/nss-mdns/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain avahi" -PKG_SECTION="network" -PKG_SHORTDESC="nss-mdns is a plugin for nss to allow name resolution via Multicast DNS." -PKG_LONGDESC="nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing host name resolution via Multicast DNS (aka Zeroconf, aka Apple Rendezvous, aka Apple Bonjour), effectively allowing name resolution by common Unix/Linux programs in the ad-hoc mDNS domain .local." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-lynx \ - --enable-avahi \ - --disable-legacy \ - --disable-search-domains" +PKG_LONGDESC="A plugin for nss to allow name resolution via Multicast DNS." +PKG_TOOLCHAIN="autotools" post_makeinstall_target() { mkdir -p $INSTALL/etc diff --git a/packages/network/nss-mdns/patches/nss-mdns-fix-out-of-bounds.patch b/packages/network/nss-mdns/patches/nss-mdns-fix-out-of-bounds.patch new file mode 100644 index 0000000000..a7fe5edb79 --- /dev/null +++ b/packages/network/nss-mdns/patches/nss-mdns-fix-out-of-bounds.patch @@ -0,0 +1,70 @@ +From 29fdeb2387e3a9cd49d5b1aa09ca23cdea60b91a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Tue, 15 Aug 2017 09:45:29 +0100 +Subject: [PATCH] src/nss.c: fix out-of-bounds memset() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +out-of-bounds access happens at memset() call site: + + @@ -272,9 +272,9 @@ enum nss_status _nss_mdns_gethostbyname4_r( + // Copy address + memcpy(&(tuple->addr), &(u.data.result[i].address), address_length); + if(address_length < sizeof(ipv6_address_t)) { + memset((&(tuple->addr) + address_length - sizeof(ipv6_address_t)), 0, + (sizeof(ipv6_address_t) - address_length) + ); + } + +The problem here is in 'addr' type: + struct gaih_addrtuple { + ... + uint32_t addr[4]; + ... + }; + +It means pointer addressing is not byte-based as offsets imply and memset() +wipes 12 bytes in hearby memory (of stack in glibc case). + +valgrind detects the overflow as: + + ==12732== Invalid write of size 1 + ==12732== at 0x4C11A29: memset (vg_replace_strmem.c:1239) + ==12732== by 0x57FA348: _nss_mdns_minimal_gethostbyname4_r (nss.c:292) + ==12732== by 0x4F016D8: gaih_inet.constprop.7 (getaddrinfo.c:806) + ==12732== by 0x4F02673: getaddrinfo (getaddrinfo.c:2317) + ==12732== by 0x4800B3B: main (a.c:34) + +The effect is SIGSEGV-ing getaddrinfo() call on systems with +the following nsswitch.conf: + + hosts: files mdns_minimal [NOTFOUND=return] dns + +The fix is to simplify memset()/memcpy() sequence. + +Reported-by: MichaÅ‚ Górny +Bug: https://bugs.gentoo.org/627770 +Signed-off-by: Sergei Trofimovich +--- + src/nss.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/nss.c b/src/nss.c +index ebb887c..1f50bad 100644 +--- a/src/nss.c ++++ b/src/nss.c +@@ -271,12 +271,8 @@ enum nss_status _nss_mdns_gethostbyname4_r( + tuple->family = u.data.result[i].af; + + // Copy address ++ memset(&(tuple->addr), 0, sizeof(ipv6_address_t)); + memcpy(&(tuple->addr), &(u.data.result[i].address), address_length); +- if(address_length < sizeof(ipv6_address_t)) { +- memset((&(tuple->addr) + address_length - sizeof(ipv6_address_t)), 0, +- (sizeof(ipv6_address_t) - address_length) +- ); +- } + + // Assign interface scope id + tuple->scopeid = u.data.result[i].scopeid; diff --git a/packages/network/openssh/package.mk b/packages/network/openssh/package.mk index f03913094f..54ef343f6a 100644 --- a/packages/network/openssh/package.mk +++ b/packages/network/openssh/package.mk @@ -1,37 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="openssh" -PKG_VERSION="7.3p1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="7.9p1" +PKG_SHA256="6b4b3ba2253d84ed3771c8050728d597c91cfce898713beb7b64a305b6f11aad" PKG_LICENSE="OSS" -PKG_SITE="http://www.openssh.com/" -PKG_URL="http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain zlib libressl" -PKG_SECTION="network" -PKG_SHORTDESC="openssh: An open re-implementation of the SSH package" -PKG_LONGDESC="This is a Linux port of OpenBSD's excellent OpenSSH. OpenSSH is based on the last free version of Tatu Ylonen's SSH with all patent-encumbered algorithms removed, all known security bugs fixed, new features reintroduced, and many other clean-ups. SSH (Secure Shell) is a program to log into another computer over a network, to execute commands in a remote machine, and to move files from one machine to another. It provides strong authentication and secure communications over insecure channels. It is intended as a replacement for rlogin, rsh, rcp, and rdist." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--sysconfdir=/etc/ssh \ +PKG_SITE="https://www.openssh.com/" +PKG_URL="https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain openssl zlib" +PKG_LONGDESC="An open re-implementation of the SSH package." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+lto" + +PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_rpc_types_h=no \ + --sysconfdir=/etc/ssh \ --libexecdir=/usr/lib/openssh \ --disable-strip \ --disable-lastlog \ @@ -42,6 +25,7 @@ PKG_CONFIGURE_OPTS_TARGET="--sysconfdir=/etc/ssh \ --disable-wtmpx \ --without-rpath \ --with-ssl-engine \ + --with-privsep-user=nobody \ --disable-pututline \ --disable-pututxline \ --disable-etc-default-login \ @@ -65,7 +49,6 @@ post_makeinstall_target() { sed -e "s|^#PermitRootLogin.*|PermitRootLogin yes|g" \ -e "s|^#StrictModes.*|StrictModes no|g" \ - -e "s|^#UsePrivilegeSeparation.*|UsePrivilegeSeparation no|g" \ -i $INSTALL/etc/ssh/sshd_config echo "PubkeyAcceptedKeyTypes +ssh-dss" >> $INSTALL/etc/ssh/sshd_config diff --git a/packages/network/openssh/patches/openssh-7.9p1-keydir.patch b/packages/network/openssh/patches/openssh-7.9p1-keydir.patch new file mode 100644 index 0000000000..8f20fe0caa --- /dev/null +++ b/packages/network/openssh/patches/openssh-7.9p1-keydir.patch @@ -0,0 +1,118 @@ +diff -u a/configure.ac b/configure.ac +--- a/configure.ac 2018-10-16 20:01:20.000000000 -0400 ++++ b/configure.ac 2018-12-06 04:08:42.718993760 -0500 +@@ -4903,6 +4903,19 @@ + ) + + ++# Set keydir ++AC_ARG_WITH([keydir], ++ [ --with-keydir= Specify different path for storing keys], ++ [ ++ if test -n "$withval" && test "x$withval" != "xno" && \ ++ test "x${withval}" != "xyes"; then ++ KEYDIR=$withval ++ fi ++ ] ++) ++AC_SUBST([KEYDIR]) ++ ++ + AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses]) + IPV4_IN6_HACK_MSG="no" + AC_ARG_WITH(4in6, +@@ -5277,6 +5290,7 @@ + H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}` + I=`eval echo ${user_path}` ; I=`eval echo ${I}` + J=`eval echo ${superuser_path}` ; J=`eval echo ${J}` ++K=`eval echo ${KEYDIR}` ; K=`eval echo ${K}` + + echo "" + echo "OpenSSH has been configured with the following options:" +@@ -5300,6 +5314,9 @@ + if test ! -z "$superuser_path" ; then + echo " sshd superuser user PATH: $J" + fi ++if test ! -z "$KEYDIR" ; then ++echo " sshd keydir: $K" ++fi + echo " Manpage format: $MANTYPE" + echo " PAM support: $PAM_MSG" + echo " OSF SIA support: $SIA_MSG" +Common subdirectories: a/contrib and b/contrib +diff -u a/Makefile.in b/Makefile.in +--- a/Makefile.in 2018-10-16 20:01:20.000000000 -0400 ++++ b/Makefile.in 2018-12-06 04:00:04.301968236 -0500 +@@ -28,8 +28,10 @@ + SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ + STRIP_OPT=@STRIP_OPT@ + TEST_SHELL=@TEST_SHELL@ ++KEYDIR=@KEYDIR@ + + PATHS= -DSSHDIR=\"$(sysconfdir)\" \ ++ -DKEYDIR=\"$(KEYDIR)\" \ + -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \ + -D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \ + -D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \ +@@ -133,11 +135,11 @@ + -e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \ + -e 's|/usr/libexec|$(libexecdir)|g' \ + -e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \ +- -e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \ +- -e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \ +- -e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \ +- -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \ +- -e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \ ++ -e 's|/etc/ssh/ssh_host_key|$(KEYDIR)/ssh_host_key|g' \ ++ -e 's|/etc/ssh/ssh_host_ecdsa_key|$(KEYDIR)/ssh_host_ecdsa_key|g' \ ++ -e 's|/etc/ssh/ssh_host_dsa_key|$(KEYDIR)/ssh_host_dsa_key|g' \ ++ -e 's|/etc/ssh/ssh_host_rsa_key|$(KEYDIR)/ssh_host_rsa_key|g' \ ++ -e 's|/etc/ssh/ssh_host_ed25519_key|$(KEYDIR)/ssh_host_ed25519_key|g' \ + -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \ + -e 's|/etc/moduli|$(sysconfdir)/moduli|g' \ + -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \ +Common subdirectories: a/openbsd-compat and b/openbsd-compat +diff -u a/pathnames.h b/pathnames.h +--- a/pathnames.h 2018-10-16 20:01:20.000000000 -0400 ++++ b/pathnames.h 2018-12-06 04:15:01.286012398 -0500 +@@ -18,6 +18,10 @@ + #define SSHDIR ETCDIR "/ssh" + #endif + ++#ifndef KEYDIR ++#define KEYDIR SSHDIR ++#endif ++ + #ifndef _PATH_SSH_PIDDIR + #define _PATH_SSH_PIDDIR "/var/run" + #endif +@@ -26,9 +30,9 @@ + * System-wide file containing host keys of known hosts. This file should be + * world-readable. + */ +-#define _PATH_SSH_SYSTEM_HOSTFILE SSHDIR "/ssh_known_hosts" ++#define _PATH_SSH_SYSTEM_HOSTFILE KEYDIR "/ssh_known_hosts" + /* backward compat for protocol 2 */ +-#define _PATH_SSH_SYSTEM_HOSTFILE2 SSHDIR "/ssh_known_hosts2" ++#define _PATH_SSH_SYSTEM_HOSTFILE2 KEYDIR "/ssh_known_hosts2" + + /* + * Of these, ssh_host_key must be readable only by root, whereas ssh_config +@@ -36,11 +40,11 @@ + */ + #define _PATH_SERVER_CONFIG_FILE SSHDIR "/sshd_config" + #define _PATH_HOST_CONFIG_FILE SSHDIR "/ssh_config" +-#define _PATH_HOST_DSA_KEY_FILE SSHDIR "/ssh_host_dsa_key" +-#define _PATH_HOST_ECDSA_KEY_FILE SSHDIR "/ssh_host_ecdsa_key" +-#define _PATH_HOST_ED25519_KEY_FILE SSHDIR "/ssh_host_ed25519_key" +-#define _PATH_HOST_XMSS_KEY_FILE SSHDIR "/ssh_host_xmss_key" +-#define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key" ++#define _PATH_HOST_DSA_KEY_FILE KEYDIR "/ssh_host_dsa_key" ++#define _PATH_HOST_ECDSA_KEY_FILE KEYDIR "/ssh_host_ecdsa_key" ++#define _PATH_HOST_ED25519_KEY_FILE KEYDIR "/ssh_host_ed25519_key" ++#define _PATH_HOST_XMSS_KEY_FILE KEYDIR "/ssh_host_xmss_key" ++#define _PATH_HOST_RSA_KEY_FILE KEYDIR "/ssh_host_rsa_key" + #define _PATH_DH_MODULI SSHDIR "/moduli" + + #ifndef _PATH_SSH_PROGRAM +Common subdirectories: a/regress and b/regress diff --git a/packages/network/openssh/patches/openssh-7.9p1-openssl-ver-check.patch b/packages/network/openssh/patches/openssh-7.9p1-openssl-ver-check.patch new file mode 100644 index 0000000000..1744fad05b --- /dev/null +++ b/packages/network/openssh/patches/openssh-7.9p1-openssl-ver-check.patch @@ -0,0 +1,12 @@ +diff -ru a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c +--- a/openbsd-compat/openssl-compat.c 2018-10-16 20:01:20.000000000 -0400 ++++ b/openbsd-compat/openssl-compat.c 2018-12-06 04:40:34.296087875 -0500 +@@ -76,7 +76,7 @@ + ENGINE_load_builtin_engines(); + ENGINE_register_all_complete(); + +-#if OPENSSL_VERSION_NUMBER < 0x10001000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + OPENSSL_config(NULL); + #else + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS | diff --git a/packages/network/openssh/patches/openssh-keydir.patch b/packages/network/openssh/patches/openssh-keydir.patch deleted file mode 100644 index 661a4a9548..0000000000 --- a/packages/network/openssh/patches/openssh-keydir.patch +++ /dev/null @@ -1,116 +0,0 @@ -diff --git a/Makefile.in b/Makefile.in -index 06be3d5..5272bda 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -30,8 +30,10 @@ PRIVSEP_PATH=@PRIVSEP_PATH@ - SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ - STRIP_OPT=@STRIP_OPT@ - TEST_SHELL=@TEST_SHELL@ -+KEYDIR=@KEYDIR@ - - PATHS= -DSSHDIR=\"$(sysconfdir)\" \ -+ -DKEYDIR=\"$(KEYDIR)\" \ - -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \ - -D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \ - -D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \ -@@ -121,11 +123,11 @@ PATHSUBS = \ - -e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \ - -e 's|/usr/libexec|$(libexecdir)|g' \ - -e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \ -- -e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \ -- -e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \ -- -e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \ -- -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \ -- -e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \ -+ -e 's|/etc/ssh/ssh_host_key|$(KEYDIR)/ssh_host_key|g' \ -+ -e 's|/etc/ssh/ssh_host_ecdsa_key|$(KEYDIR)/ssh_host_ecdsa_key|g' \ -+ -e 's|/etc/ssh/ssh_host_dsa_key|$(KEYDIR)/ssh_host_dsa_key|g' \ -+ -e 's|/etc/ssh/ssh_host_rsa_key|$(KEYDIR)/ssh_host_rsa_key|g' \ -+ -e 's|/etc/ssh/ssh_host_ed25519_key|$(KEYDIR)/ssh_host_ed25519_key|g' \ - -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \ - -e 's|/etc/moduli|$(sysconfdir)/moduli|g' \ - -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \ -diff --git a/configure.ac b/configure.ac -index 67c4486..b4297bf 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4429,6 +4429,17 @@ AC_ARG_WITH([superuser-path], - ] - ) - -+# Set keydir -+AC_ARG_WITH([keydir], -+ [ --with-keydir= Specify different path for storing keys], -+ [ -+ if test -n "$withval" && test "x$withval" != "xno" && \ -+ test "x${withval}" != "xyes"; then -+ KEYDIR=$withval -+ fi -+ ] -+) -+AC_SUBST([KEYDIR]) - - AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses]) - IPV4_IN6_HACK_MSG="no" -@@ -4799,6 +4810,7 @@ G=`eval echo ${piddir}` ; G=`eval echo ${G}` - H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}` - I=`eval echo ${user_path}` ; I=`eval echo ${I}` - J=`eval echo ${superuser_path}` ; J=`eval echo ${J}` -+K=`eval echo ${KEYDIR}` ; K=`eval echo ${K}` - - echo "" - echo "OpenSSH has been configured with the following options:" -@@ -4822,6 +4834,9 @@ fi - if test ! -z "$superuser_path" ; then - echo " sshd superuser user PATH: $J" - fi -+if test ! -z "$KEYDIR" ; then -+echo " sshd keydir: $K" -+fi - echo " Manpage format: $MANTYPE" - echo " PAM support: $PAM_MSG" - echo " OSF SIA support: $SIA_MSG" -diff --git a/pathnames.h b/pathnames.h -index ec89fc6..8a33ca2 100644 ---- a/pathnames.h -+++ b/pathnames.h -@@ -18,6 +18,10 @@ - #define SSHDIR ETCDIR "/ssh" - #endif - -+#ifndef KEYDIR -+#define KEYDIR SSHDIR -+#endif -+ - #ifndef _PATH_SSH_PIDDIR - #define _PATH_SSH_PIDDIR "/var/run" - #endif -@@ -26,9 +30,9 @@ - * System-wide file containing host keys of known hosts. This file should be - * world-readable. - */ --#define _PATH_SSH_SYSTEM_HOSTFILE SSHDIR "/ssh_known_hosts" -+#define _PATH_SSH_SYSTEM_HOSTFILE KEYDIR "/ssh_known_hosts" - /* backward compat for protocol 2 */ --#define _PATH_SSH_SYSTEM_HOSTFILE2 SSHDIR "/ssh_known_hosts2" -+#define _PATH_SSH_SYSTEM_HOSTFILE2 KEYDIR "/ssh_known_hosts2" - - /* - * Of these, ssh_host_key must be readable only by root, whereas ssh_config -@@ -36,11 +40,11 @@ - */ - #define _PATH_SERVER_CONFIG_FILE SSHDIR "/sshd_config" - #define _PATH_HOST_CONFIG_FILE SSHDIR "/ssh_config" --#define _PATH_HOST_KEY_FILE SSHDIR "/ssh_host_key" --#define _PATH_HOST_DSA_KEY_FILE SSHDIR "/ssh_host_dsa_key" --#define _PATH_HOST_ECDSA_KEY_FILE SSHDIR "/ssh_host_ecdsa_key" --#define _PATH_HOST_ED25519_KEY_FILE SSHDIR "/ssh_host_ed25519_key" --#define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key" -+#define _PATH_HOST_KEY_FILE KEYDIR "/ssh_host_key" -+#define _PATH_HOST_DSA_KEY_FILE KEYDIR "/ssh_host_dsa_key" -+#define _PATH_HOST_ECDSA_KEY_FILE KEYDIR "/ssh_host_ecdsa_key" -+#define _PATH_HOST_ED25519_KEY_FILE KEYDIR "/ssh_host_ed25519_key" -+#define _PATH_HOST_RSA_KEY_FILE KEYDIR "/ssh_host_rsa_key" - #define _PATH_DH_MODULI SSHDIR "/moduli" - /* Backwards compatibility */ - #define _PATH_DH_PRIMES SSHDIR "/primes" diff --git a/packages/network/openssh/tmpfiles.d/z_04_openssh.conf b/packages/network/openssh/tmpfiles.d/z_04_openssh.conf index a6212d7ac2..baae3c6626 100644 --- a/packages/network/openssh/tmpfiles.d/z_04_openssh.conf +++ b/packages/network/openssh/tmpfiles.d/z_04_openssh.conf @@ -1,20 +1,6 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +d /var/empty 0600 root root - - d /storage/.cache/ssh 0755 root root - - d /storage/.ssh 0700 root root - - diff --git a/packages/network/openvpn/package.mk b/packages/network/openvpn/package.mk index b11bbb43c4..c1ffd505a3 100644 --- a/packages/network/openvpn/package.mk +++ b/packages/network/openvpn/package.mk @@ -1,45 +1,20 @@ -################################################################################ -# This file is part of LibreELEC - http://libreelec.tv -# Copyright (C) 2016-2017 Christian Hewitt (chewitt@libreelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="openvpn" -PKG_VERSION="2.4.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.4.6" +PKG_SHA256="4f6434fa541cc9e363434ea71a16a62cf2615fb2f16af5b38f43ab5939998c26" PKG_LICENSE="GPL" -PKG_SITE="http://openvpn.net" -PKG_URL="http://swupdate.openvpn.org/community/releases/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain lzo libressl" -PKG_SECTION="network" -PKG_SHORTDESC="openvpn: a full featured SSL VPN software solution that integrates OpenVPN server capabilities." -PKG_LONGDESC="OpenVPN Access Server is a full featured SSL VPN software solution that integrates OpenVPN server capabilities, enterprise management capabilities, simplified OpenVPN Connect UI, and OpenVPN Client software packages that accommodate Windows, MAC, and Linux OS environments. OpenVPN Access Server supports a wide range of configurations, including secure and granular remote access to internal network and/ or private cloud network resources and applications with fine-grained access control." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_SITE="https://openvpn.net" +PKG_URL="https://swupdate.openvpn.org/community/releases/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain lzo openssl" +PKG_LONGDESC="A full featured SSL VPN software solution that integrates OpenVPN server capabilities." PKG_CONFIGURE_OPTS_TARGET="ac_cv_have_decl_TUNSETPERSIST=no \ --disable-server \ - --enable-password-save \ --disable-plugins \ --enable-iproute2 IPROUTE=/sbin/ip \ --enable-management \ - --disable-socks \ - --disable-http-proxy \ --enable-fragment \ --disable-multihome \ --disable-port-share \ diff --git a/packages/network/rfkill/package.mk b/packages/network/rfkill/package.mk new file mode 100644 index 0000000000..1a05ac5609 --- /dev/null +++ b/packages/network/rfkill/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rfkill" +PKG_VERSION="0.5" +PKG_SHA256="e0ae3004215e39a6c5c36e0726558740728d16f67ebdb8bea621250f6091d86a" +PKG_LICENSE="GPL" +PKG_SITE="https://wireless.wiki.kernel.org/en/users/documentation/rfkill" +PKG_URL="https://www.kernel.org/pub/software/network/rfkill/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A small userspace tool to query the state of the rfkill switches, buttons and subsystem interfaces." diff --git a/packages/network/rfkill/patches/rfkill-0001-fix-version-sh.patch b/packages/network/rfkill/patches/rfkill-0001-fix-version-sh.patch new file mode 100644 index 0000000000..8d51903639 --- /dev/null +++ b/packages/network/rfkill/patches/rfkill-0001-fix-version-sh.patch @@ -0,0 +1,23 @@ +diff -Naur a/version.sh b/version.sh +--- a/version.sh ++++ b/version.sh +@@ -12,19 +12,6 @@ + + if test "x$SUFFIX" != 'x'; then + v="$VERSION$SUFFIX" +-elif head=`git rev-parse --verify HEAD 2>/dev/null`; then +- git update-index --refresh --unmerged > /dev/null +- descr=$(git describe 2>/dev/null || echo "v$VERSION") +- +- # on git builds check that the version number above +- # is correct... +- [ "${descr%%-*}" = "v$VERSION" ] || exit 2 +- +- echo -n 'const char rfkill_version[] = "' > "$OUT" +- v="${descr#v}" +- if git diff-index --name-only HEAD | read dummy ; then +- v="$v"-dirty +- fi + else + v="$VERSION" + fi diff --git a/packages/network/rpcbind/package.mk b/packages/network/rpcbind/package.mk index 8a5c2a6e57..0c921e44cc 100644 --- a/packages/network/rpcbind/package.mk +++ b/packages/network/rpcbind/package.mk @@ -1,37 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="rpcbind" PKG_VERSION="0.2.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="074a9a530dc7c11e0d905aa59bcb0847c009313f02e98d3d798aa9568f414c66" PKG_LICENSE="OSS" PKG_SITE="http://rpcbind.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/rpcbind/rpcbind/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libtirpc" -PKG_SECTION="network" -PKG_SHORTDESC="rpcbind: a server that converts RPC program numbers into universal addresses." +PKG_DEPENDS_TARGET="toolchain libtirpc systemd" PKG_LONGDESC="The rpcbind utility is a server that converts RPC program numbers into universal addresses." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--disable-warmstarts \ +PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_rpcsvc_mount_h=no \ + --disable-warmstarts \ --disable-libwrap \ --with-statedir=/tmp \ --with-rpcuser=root" diff --git a/packages/network/samba/config/samba4-cache.txt b/packages/network/samba/config/samba4-cache.txt new file mode 100644 index 0000000000..1c7371568c --- /dev/null +++ b/packages/network/samba/config/samba4-cache.txt @@ -0,0 +1,42 @@ +Checking simple C program: OK +rpath library support: OK +-Wl,--version-script support: OK +Checking getconf LFS_CFLAGS: NO +Checking for large file support without additional flags: OK +Checking for -D_LARGE_FILES: OK +Checking correct behavior of strtoll: NO +Checking for working strptime: OK +Checking for C99 vsnprintf: OK +Checking for HAVE_SHARED_MMAP: OK +Checking for HAVE_MREMAP: OK +Checking for HAVE_INCOHERENT_MMAP: NO +Checking for HAVE_SECURE_MKSTEMP: OK +Checking for HAVE_IFACE_GETIFADDRS: OK +Checking for kernel change notify support: OK +Checking for Linux kernel oplocks: OK +Checking for kernel share modes: OK +Checking if can we convert from CP850 to UCS-2LE: OK +Checking if can we convert from UTF-8 to UCS-2LE: OK +Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK +Checking whether we can use Linux thread-specific credentials: OK +Checking whether setreuid is available: OK +Checking whether setresuid is available: OK +Checking whether seteuid is available: OK +Checking whether fcntl locking is available: OK +Checking whether fcntl lock supports open file description locks: OK +Checking for the maximum value of the 'time_t' type: OK +Checking whether the realpath function allows a NULL argument: OK +Checking whether POSIX capabilities are available: OK +Checking for ftruncate extend: OK +vfs_fileid checking for statfs() and struct statfs.f_fsid: OK +getcwd takes a NULL argument: OK +Checking uname sysname type: "Linux" +Checking uname release type: "3.0.0" +Checking uname version type: "#1 Tue Nov 1 12:34:56 UTC 2013" +Checking value of NSIG: "32" +Checking value of _NSIG: "64" +Checking value of SIGRTMAX: "64" +Checking value of SIGRTMIN: "32" +Checking errno of iconv for illegal multibyte sequence: "0" +Checking for a 64-bit host to support lmdb: NO + diff --git a/packages/network/samba/config/smb.conf b/packages/network/samba/config/smb.conf index 2a3015c7a1..e8918bdb4c 100644 --- a/packages/network/samba/config/smb.conf +++ b/packages/network/samba/config/smb.conf @@ -1,49 +1,38 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ -# samba.conf +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +# samba.conf v4 (do not remove) # This configuration file allows you to customize the samba shares # available from your machine [global] server string = LibreELEC - workgroup = WORKGROUP - netbios name = %h - security = share - guest account = root - socket options = TCP_NODELAY IPTOS_LOWDELAY - max protocol = SMB2 - min receivefile size = 16384 + browseable = yes + writeable = yes + printable = no deadtime = 30 mangled names = no - syslog only = yes - syslog = 2 - name resolve order = host bcast wins + name resolve order = host bcast printcap name = /dev/null load printers = no - browseable = yes - writeable = yes - printable = no encrypt passwords = true enable core files = no passdb backend = smbpasswd smb encrypt = disabled + + # samba share options + map to guest = Bad User + guest account = root + security = user + + # samba tuning options + socket options = TCP_NODELAY IPTOS_LOWDELAY + min receivefile size = 16384 + aio read size = 16384 + aio write size = 16384 use sendfile = yes + # The following are default values for the master selection process # local master = yes # preferred master = auto @@ -57,117 +46,117 @@ allocation roundup size = 0 # Using the following configurations as a template allows you to add -# writable shares of disks and paths under /storage +# writeable shares of disks and paths under /storage [Update] path = /storage/.update available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/.update [Videos] path = /storage/videos available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/videos [Music] path = /storage/music available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/music [TV Shows] path = /storage/tvshows available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/tvshows [Recordings] path = /storage/recordings available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/recordings [Downloads] path = /storage/downloads available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/downloads [Pictures] path = /storage/pictures available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/pictures [Emulators] path = /storage/emulators available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/emulators [Configfiles] path = /storage/.config available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/.config [Userdata] - path = /storage/.kodi/userdata + path = /storage/.plexht/userdata available = yes - browsable = yes + browseable = yes public = yes - writable = yes - root preexec = mkdir -p /storage/.kodi/userdata + writeable = yes + root preexec = mkdir -p /storage/.plexht/userdata [Screenshots] path = /storage/screenshots available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/screenshots [Logfiles] path = /storage/logfiles available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/logfiles root preexec = createlog [Backup] path = /storage/backup available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/backup [Picons] path = /storage/picons available = yes - browsable = yes + browseable = yes public = yes - writable = yes + writeable = yes root preexec = mkdir -p /storage/picons/tvh /storage/picons/vdr diff --git a/packages/network/samba/default.d/samba.conf b/packages/network/samba/default.d/samba.conf index d77b5bca24..9ad00368c3 100644 --- a/packages/network/samba/default.d/samba.conf +++ b/packages/network/samba/default.d/samba.conf @@ -2,3 +2,6 @@ SAMBA_AUTOSHARE="true" SAMBA_USERNAME="libreelec" SAMBA_PASSWORD="libreelec" SAMBA_SECURE="false" +SAMBA_MINPROTOCOL="SMB2" +SAMBA_MAXPROTOCOL="SMB3" +SAMBA_WORKGROUP="WORKGROUP" diff --git a/packages/network/samba/package.mk b/packages/network/samba/package.mk index 4f56729823..f217d01b5e 100644 --- a/packages/network/samba/package.mk +++ b/packages/network/samba/package.mk @@ -1,192 +1,165 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="samba" -PKG_VERSION="3.6.25" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" -PKG_SITE="http://www.samba.org" -PKG_URL="http://samba.org/samba/ftp/stable/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain zlib connman" -PKG_SECTION="network" -PKG_SHORTDESC="samba: The free SMB / CIFS fileserver and client" -PKG_LONGDESC="Samba is a SMB server that runs on Unix and other operating systems. It allows these operating systems (currently Unix, Netware, OS/2 and AmigaDOS) to act as a file and print server for SMB and CIFS clients. There are many Lan-Manager compatible clients such as LanManager for DOS, Windows for Workgroups, Windows NT, Windows 95, Linux smbfs, OS/2, Pathworks and more." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -if [ "$AVAHI_DAEMON" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi" - SMB_AVAHI="--enable-avahi" -else - SMB_AVAHI="--disable-avahi" -fi - -PKG_CONFIGURE_SCRIPT="source3/configure" -PKG_CONFIGURE_OPTS_TARGET="ac_cv_file__proc_sys_kernel_core_pattern=yes \ - libreplace_cv_HAVE_C99_VSNPRINTF=yes \ - libreplace_cv_HAVE_GETADDRINFO=no \ - libreplace_cv_HAVE_IFACE_IFCONF=no \ - LINUX_LFS_SUPPORT=yes \ - samba_cv_CC_NEGATIVE_ENUM_VALUES=yes \ - samba_cv_HAVE_GETTIMEOFDAY_TZ=yes \ - samba_cv_HAVE_IFACE_IFCONF=yes \ - samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes \ - samba_cv_HAVE_SECURE_MKSTEMP=yes \ - samba_cv_HAVE_WRFILE_KEYTAB=no \ - samba_cv_USE_SETREUID=yes \ - samba_cv_USE_SETRESUID=yes \ - samba_cv_have_setreuid=yes \ - samba_cv_have_setresuid=yes \ - --with-configdir=/etc/samba \ - --with-privatedir=/var/run \ - --with-codepagedir=/etc/samba \ - --with-lockdir=/var/lock \ - --with-logfilebase=/var/log \ - --with-nmbdsocketdir=/var/nmbd \ - --with-piddir=/var/run \ - --disable-shared-libs \ - --disable-debug \ - --with-libiconv="$SYSROOT_PREFIX/usr" \ - --disable-krb5developer \ - --disable-picky-developer \ - --enable-largefile \ - --disable-socket-wrapper \ - --disable-nss-wrapper \ - --disable-swat \ - --disable-cups \ - --disable-iprint \ - --disable-pie \ - --disable-relro \ - --disable-fam \ - --disable-dnssd \ - $SMB_AVAHI \ - --disable-pthreadpool \ - --disable-dmalloc \ - --with-fhs \ - --without-libtalloc \ - --disable-external-libtalloc \ - --without-libtdb \ - --disable-external-libtdb \ - --without-libnetapi \ - --with-libsmbclient \ - --without-libsmbsharemodes \ - --without-libaddns \ - --without-afs \ - --without-fake-kaserver \ - --without-vfs-afsacl \ - --without-ldap \ - --without-ads \ - --without-dnsupdate \ - --without-automount \ - --without-krb5 \ - --without-pam \ - --without-pam_smbpass \ - --without-nisplus-home \ - --with-syslog \ - --without-quotas \ - --without-sys-quotas \ - --without-utmp \ - --without-cluster-support \ - --without-acl-support \ - --without-aio-support \ - --with-sendfile-support \ - --without-libtevent \ - --without-wbclient \ - --without-winbind \ - --with-included-popt \ - --with-included-iniparser" +PKG_VERSION="4.9.4" +PKG_SHA256="6d98a8d8bcccbe788e4bbb406362e6676311aca711a3f3cc9b3a404bb9ff0b4f" +PKG_LICENSE="GPLv3+" +PKG_SITE="https://www.samba.org" +PKG_URL="https://download.samba.org/pub/samba/stable/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain attr heimdal:host e2fsprogs Python2 zlib readline popt libaio connman" +PKG_NEED_UNPACK="$(get_pkg_directory heimdal) $(get_pkg_directory e2fsprogs)" +PKG_LONGDESC="A free SMB / CIFS fileserver and client." +PKG_BUILD_FLAGS="-gold" + +configure_package() { + PKG_MAKE_OPTS_TARGET="V=1" + + if [ "$AVAHI_DAEMON" = yes ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi" + SMB_AVAHI="--enable-avahi" + else + SMB_AVAHI="--disable-avahi" + fi -pre_configure_target() { - ( cd ../source3 - sh autogen.sh - ) + if [ "$TARGET_ARCH" = x86_64 ]; then + SMB_AESNI="--accel-aes=intelaesni" + else + SMB_AESNI="--accel-aes=none" + fi + + PKG_CONFIGURE_OPTS="--prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --with-lockdir=/var/lock \ + --with-logfilebase=/var/log \ + --with-piddir=/run/samba \ + --with-privatedir=/run/samba \ + --with-modulesdir=/usr/lib \ + --with-privatelibdir=/usr/lib \ + --with-sockets-dir=/run/samba \ + --with-configdir=/run/samba \ + --with-libiconv=$SYSROOT_PREFIX/usr \ + --cross-compile \ + --cross-answers=$PKG_BUILD/cache.txt \ + --hostcc=gcc \ + --enable-fhs \ + --without-dmapi \ + --disable-glusterfs \ + --disable-rpath \ + --disable-rpath-install \ + --disable-rpath-private-install \ + $SMB_AVAHI \ + $SMB_AESNI \ + --disable-cups \ + --disable-iprint \ + --disable-gnutls \ + --with-relro \ + --with-sendfile-support \ + --without-acl-support \ + --without-ads \ + --without-ad-dc \ + --without-automount \ + --without-cluster-support \ + --without-dnsupdate \ + --without-fam \ + --without-gettext \ + --without-gpgme \ + --without-iconv \ + --without-ldap \ + --without-libarchive \ + --without-pam \ + --without-pie \ + --without-regedit \ + --without-systemd \ + --without-utmp \ + --without-winbind \ + --enable-auto-reconfigure \ + --bundled-libraries='ALL,!asn1_compile,!compile_et,!zlib' \ + --without-quotas \ + --with-syslog \ + --without-json-audit \ + --without-ldb-lmdb \ + --nopyc --nopyo" + + PKG_SAMBA_TARGET="smbclient,client/smbclient,smbtree,testparm" - CFLAGS="$CFLAGS -fPIC -DPIC" - LDFLAGS="$LDFLAGS -fwhole-program" + if [ "$SAMBA_SERVER" = "yes" ]; then + PKG_SAMBA_TARGET+=",smbd/smbd,nmbd,smbpasswd" + fi } -make_target() { - make bin/libtalloc.a - make bin/libwbclient.a - make bin/libtdb.a - make bin/libtevent.a - make bin/libsmbclient.a +pre_configure_target() { +# samba uses its own build directory + cd $PKG_BUILD + rm -rf .$TARGET_NAME - if [ "$SAMBA_SERVER" = "yes" ]; then - make bin/samba_multicall +# work around link issues + export LDFLAGS="$LDFLAGS -lreadline" + +# support 64-bit offsets and seeks on 32-bit platforms + if [ "$TARGET_ARCH" = "arm" ]; then + export CFLAGS+=" -D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED_ -Doff_t=off64_t -Dlseek=lseek64" fi } -post_make_target() { - mkdir -p $SYSROOT_PREFIX/usr/lib - cp -P bin/*.a $SYSROOT_PREFIX/usr/lib +configure_target() { + cp $PKG_DIR/config/samba4-cache.txt $PKG_BUILD/cache.txt + echo "Checking uname machine type: \"$TARGET_ARCH\"" >> $PKG_BUILD/cache.txt - mkdir -p $SYSROOT_PREFIX/usr/include - cp ../source3/include/libsmbclient.h $SYSROOT_PREFIX/usr/include + PYTHON_CONFIG="$SYSROOT_PREFIX/usr/bin/python-config" \ + python_LDFLAGS="" python_LIBDIR="" \ + ./configure $PKG_CONFIGURE_OPTS +} - mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig - # talloc/tdb/tevent/wbclient static - sed -e "s,^Libs: -lsmbclient$,Libs: -lsmbclient -ltalloc -ltdb -ltevent -lwbclient,g" -i pkgconfig/smbclient.pc - cp pkgconfig/smbclient.pc $SYSROOT_PREFIX/usr/lib/pkgconfig +make_target() { + ./buildtools/bin/waf build --targets=$PKG_SAMBA_TARGET -j$CONCURRENCY_MAKE_LEVEL } makeinstall_target() { - if [ "$SAMBA_SERVER" = "yes" ]; then - mkdir -p $INSTALL/usr/bin - cp bin/samba_multicall $INSTALL/usr/bin - ln -sf samba_multicall $INSTALL/usr/bin/smbd - ln -sf samba_multicall $INSTALL/usr/bin/nmbd - ln -sf samba_multicall $INSTALL/usr/bin/smbpasswd + ./buildtools/bin/waf install --destdir=$SYSROOT_PREFIX --targets=smbclient -j$CONCURRENCY_MAKE_LEVEL + ./buildtools/bin/waf install --destdir=$INSTALL --targets=$PKG_SAMBA_TARGET -j$CONCURRENCY_MAKE_LEVEL +} + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin + rm -rf $INSTALL/usr/lib/python* + rm -rf $INSTALL/usr/share/perl* + rm -rf $INSTALL/usr/lib64 + mkdir -p $INSTALL/usr/lib/samba + cp $PKG_DIR/scripts/samba-config $INSTALL/usr/lib/samba + cp $PKG_DIR/scripts/smbd-config $INSTALL/usr/lib/samba + cp $PKG_DIR/scripts/samba-autoshare $INSTALL/usr/lib/samba + + if find_file_path config/smb.conf; then mkdir -p $INSTALL/etc/samba - cp ../codepages/lowcase.dat $INSTALL/etc/samba - cp ../codepages/upcase.dat $INSTALL/etc/samba - cp ../codepages/valid.dat $INSTALL/etc/samba + cp ${FOUND_PATH} $INSTALL/etc/samba + mkdir -p $INSTALL/usr/config + cp $INSTALL/etc/samba/smb.conf $INSTALL/usr/config/samba.conf.sample + fi + + mkdir -p $INSTALL/usr/bin + cp -PR bin/default/source3/client/smbclient $INSTALL/usr/bin + cp -PR bin/default/source3/utils/smbtree $INSTALL/usr/bin + cp -PR bin/default/source3/utils/testparm $INSTALL/usr/bin + + if [ "$SAMBA_SERVER" = "yes" ]; then + mkdir -p $INSTALL/usr/bin + cp -PR bin/default/source3/utils/smbpasswd $INSTALL/usr/bin mkdir -p $INSTALL/usr/lib/systemd/system cp $PKG_DIR/system.d.opt/* $INSTALL/usr/lib/systemd/system mkdir -p $INSTALL/usr/share/services cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services - - mkdir -p $INSTALL/usr/lib/samba - cp $PKG_DIR/scripts/samba-config $INSTALL/usr/lib/samba - cp $PKG_DIR/scripts/samba-autoshare $INSTALL/usr/lib/samba - - if [ -f $PROJECT_DIR/$PROJECT/config/smb.conf ]; then - mkdir -p $INSTALL/etc/samba - cp $PROJECT_DIR/$PROJECT/config/smb.conf $INSTALL/etc/samba - elif [ -f $DISTRO_DIR/$DISTRO/config/smb.conf ]; then - mkdir -p $INSTALL/etc/samba - cp $DISTRO_DIR/$DISTRO/config/smb.conf $INSTALL/etc/samba - else - mkdir -p $INSTALL/etc/samba - cp $PKG_DIR/config/smb.conf $INSTALL/etc/samba - mkdir -p $INSTALL/usr/config - cp $PKG_DIR/config/smb.conf $INSTALL/usr/config/samba.conf.sample - fi - fi } post_install() { + enable_service samba-config.service + if [ "$SAMBA_SERVER" = "yes" ]; then enable_service nmbd.service enable_service smbd.service diff --git a/packages/network/samba/patches/samba-010_crosscompile-0.1.patch b/packages/network/samba/patches/samba-010_crosscompile-0.1.patch deleted file mode 100644 index 725f2d751e..0000000000 --- a/packages/network/samba/patches/samba-010_crosscompile-0.1.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff -Naur samba-3.6.0rc2/lib/replace/libreplace_network.m4 samba-3.6.0rc2.patch/lib/replace/libreplace_network.m4 ---- samba-3.6.0rc2/lib/replace/libreplace_network.m4 2011-06-07 20:13:47.000000000 +0200 -+++ samba-3.6.0rc2.patch/lib/replace/libreplace_network.m4 2011-07-03 00:23:27.924559484 +0200 -@@ -228,43 +228,6 @@ - libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)]) - - if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then -- # getaddrinfo is broken on some AIX systems -- # see bug 5910, use our replacements if we detect -- # a broken system. -- AC_TRY_RUN([ -- #include -- #include -- #include -- #include -- int main(int argc, const char *argv[]) -- { -- struct addrinfo hints = {0,}; -- struct addrinfo *ppres; -- const char hostname1[] = "0.0.0.0"; -- const char hostname2[] = "127.0.0.1"; -- const char hostname3[] = "::"; -- hints.ai_socktype = SOCK_STREAM; -- hints.ai_family = AF_UNSPEC; -- hints.ai_flags = -- AI_NUMERICHOST|AI_PASSIVE|AI_ADDRCONFIG; -- /* Test for broken flag combination on AIX. */ -- if (getaddrinfo(hostname1, NULL, &hints, &ppres) == EAI_BADFLAGS) { -- /* This fails on an IPv6-only box, but not with -- the EAI_BADFLAGS error. */ -- return 1; -- } -- if (getaddrinfo(hostname2, NULL, &hints, &ppres) == 0) { -- /* IPv4 lookup works - good enough. */ -- return 0; -- } -- /* Uh-oh, no IPv4. Are we IPv6-only ? */ -- return getaddrinfo(hostname3, NULL, &hints, &ppres) != 0 ? 1 : 0; -- }], -- libreplace_cv_HAVE_GETADDRINFO=yes, -- libreplace_cv_HAVE_GETADDRINFO=no) --fi -- --if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then - AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo]) - AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo]) - AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) -diff -Naur samba-3.6.0rc2/source3/configure.in samba-3.6.0rc2.patch/source3/configure.in ---- samba-3.6.0rc2/source3/configure.in 2011-06-07 20:13:47.000000000 +0200 -+++ samba-3.6.0rc2.patch/source3/configure.in 2011-07-03 00:02:08.391099610 +0200 -@@ -1275,36 +1275,7 @@ - # - # - # --case "$host_os" in -- *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu) -- # glibc <= 2.3.2 has a broken getgrouplist -- AC_CACHE_CHECK([for good getgrouplist],samba_cv_linux_getgrouplist_ok,[AC_TRY_RUN([ --#include --#include --main() { -- /* glibc up to 2.3 has a broken getgrouplist */ --#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) -- int libc_major = __GLIBC__; -- int libc_minor = __GLIBC_MINOR__; -- -- if (libc_major < 2) -- exit(1); -- if ((libc_major == 2) && (libc_minor <= 3)) -- exit(1); --#endif -- exit(0); --} --], [samba_cv_linux_getgrouplist_ok=yes], -- [samba_cv_linux_getgrouplist_ok=no], -- [samba_cv_linux_getgrouplist_ok=cross])]) -- if test x"$samba_cv_linux_getgrouplist_ok" = x"yes"; then -- AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist]) -- fi -- ;; -- *) -- AC_CHECK_FUNCS(getgrouplist) -- ;; --esac -+AC_CHECK_FUNCS(getgrouplist) - - # - # stat64 family may need on some systems, notably ReliantUNIX diff --git a/packages/network/samba/patches/samba-110-multicall.patch b/packages/network/samba/patches/samba-110-multicall.patch deleted file mode 100644 index e4681a2e85..0000000000 --- a/packages/network/samba/patches/samba-110-multicall.patch +++ /dev/null @@ -1,122 +0,0 @@ -diff -Naur samba-3.6.16/source3/Makefile.in samba-3.6.16.patch/source3/Makefile.in ---- samba-3.6.16/source3/Makefile.in 2013-06-19 09:35:24.000000000 +0200 -+++ samba-3.6.16.patch/source3/Makefile.in 2013-08-01 01:53:43.264428180 +0200 -@@ -73,22 +73,22 @@ - NSCD_LIBS=@NSCD_LIBS@ - UUID_LIBS=@UUID_LIBS@ - LIBWBCLIENT=@LIBWBCLIENT_STATIC@ @LIBWBCLIENT_SHARED@ --LIBWBCLIENT_LIBS=@LIBWBCLIENT_LIBS@ -+LIBWBCLIENT_LIBS=@LIBWBCLIENT_STATIC@ - PTHREAD_LDFLAGS=@PTHREAD_LDFLAGS@ - PTHREAD_CFLAGS=@PTHREAD_CFLAGS@ - DNSSD_LIBS=@DNSSD_LIBS@ - AVAHI_LIBS=@AVAHI_LIBS@ - POPT_LIBS=@POPTLIBS@ - LIBTALLOC=@LIBTALLOC_STATIC@ @LIBTALLOC_SHARED@ --LIBTALLOC_LIBS=@LIBTALLOC_LIBS@ -+LIBTALLOC_LIBS=@LIBTALLOC_STATIC@ - LIBTEVENT=@LIBTEVENT_STATIC@ @LIBTEVENT_SHARED@ --LIBTEVENT_LIBS=@LIBTEVENT_LIBS@ -+LIBTEVENT_LIBS=@LIBTEVENT_STATIC@ - LIBREPLACE_LIBS=@LIBREPLACE_LIBS@ - LIBTDB=@LIBTDB_STATIC@ @LIBTDB_SHARED@ --LIBTDB_LIBS=@LIBTDB_LIBS@ -+LIBTDB_LIBS=@LIBTDB_STATIC@ - TDB_DEPS=@TDB_DEPS@ - LIBNETAPI=@LIBNETAPI_STATIC@ @LIBNETAPI_SHARED@ --LIBNETAPI_LIBS=@LIBNETAPI_LIBS@ -+LIBNETAPI_LIBS=@LIBNETAPI_STATIC@ - LIBSMBCLIENT_LIBS=@LIBSMBCLIENT_LIBS@ - LIBSMBSHAREMODES_LIBS=@LIBSMBSHAREMODES_LIBS@ - -@@ -216,7 +216,7 @@ - - # Note that all executable programs now provide for an optional executable suffix. - --SBIN_PROGS = bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@ -+SBIN_PROGS = bin/samba_multicall@EXEEXT@ bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@ - - BIN_PROGS1 = bin/smbclient@EXEEXT@ bin/net@EXEEXT@ bin/smbspool@EXEEXT@ \ - bin/testparm@EXEEXT@ bin/smbstatus@EXEEXT@ bin/smbget@EXEEXT@ \ -@@ -1777,6 +1777,42 @@ - dir=bin $(MAKEDIR); fi - @: >> $@ || : > $@ # what a fancy emoticon! - -+smbd/server_multicall.o: smbd/server.c smbd/server.o -+ @echo Compiling $<.c -+ @$(COMPILE_CC_PATH) -Dmain=smbd_main && exit 0;\ -+ echo "The following command failed:" 1>&2;\ -+ echo "$(COMPILE_CC_PATH)" 1>&2;\ -+ $(COMPILE_CC_PATH) >/dev/null 2>&1 -+ -+nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/nmbd.o -+ @echo Compiling $<.c -+ @$(COMPILE_CC_PATH) -Dmain=nmbd_main && exit 0;\ -+ echo "The following command failed:" 1>&2;\ -+ echo "$(COMPILE_CC_PATH)" 1>&2;\ -+ $(COMPILE_CC_PATH) >/dev/null 2>&1 -+ -+utils/smbpasswd_multicall.o: utils/smbpasswd.c utils/smbpasswd.o -+ @echo Compiling $<.c -+ @$(COMPILE_CC_PATH) -Dmain=smbpasswd_main && exit 0;\ -+ echo "The following command failed:" 1>&2;\ -+ echo "$(COMPILE_CC_PATH)" 1>&2;\ -+ $(COMPILE_CC_PATH) >/dev/null 2>&1 -+ -+SMBD_MULTI_O = $(patsubst smbd/server.o,smbd/server_multicall.o,$(SMBD_OBJ)) -+NMBD_MULTI_O = $(patsubst nmbd/nmbd.o,nmbd/nmbd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(NMBD_OBJ))) -+SMBPASSWD_MULTI_O = $(patsubst utils/smbpasswd.o,utils/smbpasswd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(SMBPASSWD_OBJ))) -+MULTI_O = multi.o -+ -+MULTICALL_O = $(sort $(SMBD_MULTI_O) $(NMBD_MULTI_O) $(SMBPASSWD_MULTI_O) $(MULTI_O)) -+ -+bin/samba_multicall@EXEEXT@: $(BINARY_PREREQS) $(MULTICALL_O) $(LIBTALLOC) $(LIBTEVENT) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@ -+ @echo Linking $@ -+ @$(CC) -o $@ $(MULTICALL_O) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \ -+ $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \ -+ $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) $(AVAHI_LIBS) \ -+ $(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTEVENT_LIBS) $(LIBTDB_LIBS) \ -+ $(LIBWBCLIENT_LIBS) $(ZLIB_LIBS) -+ - bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) $(LIBTALLOC) $(LIBTEVENT) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@ - @echo Linking $@ - @$(CC) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \ -diff -Naur samba-3.6.16/source3/multi.c samba-3.6.16.patch/source3/multi.c ---- samba-3.6.16/source3/multi.c 1970-01-01 01:00:00.000000000 +0100 -+++ samba-3.6.16.patch/source3/multi.c 2013-08-01 01:24:51.794393962 +0200 -@@ -0,0 +1,35 @@ -+#include -+#include -+ -+extern int smbd_main(int argc, char **argv); -+extern int nmbd_main(int argc, char **argv); -+extern int smbpasswd_main(int argc, char **argv); -+ -+static struct { -+ const char *name; -+ int (*func)(int argc, char **argv); -+} multicall[] = { -+ { "smbd", smbd_main }, -+ { "nmbd", nmbd_main }, -+ { "smbpasswd", smbpasswd_main }, -+}; -+ -+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -+ -+int main(int argc, char **argv) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(multicall); i++) { -+ if (strstr(argv[0], multicall[i].name)) -+ return multicall[i].func(argc, argv); -+ } -+ -+ fprintf(stderr, "Invalid multicall command, available commands:"); -+ for (i = 0; i < ARRAY_SIZE(multicall); i++) -+ fprintf(stderr, " %s", multicall[i].name); -+ -+ fprintf(stderr, "\n"); -+ -+ return 1; -+} diff --git a/packages/network/samba/patches/samba-120-add_missing_ifdef.patch b/packages/network/samba/patches/samba-120-add_missing_ifdef.patch deleted file mode 100644 index dbd9adc1d7..0000000000 --- a/packages/network/samba/patches/samba-120-add_missing_ifdef.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -119,9 +119,11 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_netdfs)) { - return false; - } -+#ifdef DEVELOPER - if (!smb_register_ndr_interface(&ndr_table_rpcecho)) { - return false; - } -+#endif - if (!smb_register_ndr_interface(&ndr_table_initshutdown)) { - return false; - } ---- a/source3/rpcclient/rpcclient.c -+++ b/source3/rpcclient/rpcclient.c -@@ -628,7 +628,9 @@ static struct cmd_set *rpcclient_command - netlogon_commands, - srvsvc_commands, - dfs_commands, -+#ifdef DEVELOPER - echo_commands, -+#endif - epmapper_commands, - shutdown_commands, - test_commands, diff --git a/packages/network/samba/patches/samba-200-remove_printer_support.patch b/packages/network/samba/patches/samba-200-remove_printer_support.patch deleted file mode 100644 index 95b9ceb36a..0000000000 --- a/packages/network/samba/patches/samba-200-remove_printer_support.patch +++ /dev/null @@ -1,360 +0,0 @@ -diff -Naur samba-3.6.8/source3/librpc/rpc/rpc_common.c samba-3.6.8.patch/source3/librpc/rpc/rpc_common.c ---- samba-3.6.8/source3/librpc/rpc/rpc_common.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/librpc/rpc/rpc_common.c 2012-10-22 21:17:48.583839804 +0200 -@@ -113,9 +113,11 @@ - if (!smb_register_ndr_interface(&ndr_table_winreg)) { - return false; - } -+#ifdef PRINTER_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_spoolss)) { - return false; - } -+#endif - if (!smb_register_ndr_interface(&ndr_table_netdfs)) { - return false; - } -diff -Naur samba-3.6.8/source3/printing/spoolssd.c samba-3.6.8.patch/source3/printing/spoolssd.c ---- samba-3.6.8/source3/printing/spoolssd.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/printing/spoolssd.c 2012-10-22 21:17:48.566839461 +0200 -@@ -153,6 +153,10 @@ - NTSTATUS status; - int ret; - -+#ifndef PRINTER_SUPPORT -+ return; -+#endif -+ - DEBUG(1, ("Forking SPOOLSS Daemon\n")); - - pid = sys_fork(); -diff -Naur samba-3.6.8/source3/rpcclient/rpcclient.c samba-3.6.8.patch/source3/rpcclient/rpcclient.c ---- samba-3.6.8/source3/rpcclient/rpcclient.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/rpcclient/rpcclient.c 2012-10-22 21:17:48.565839442 +0200 -@@ -624,7 +624,9 @@ - lsarpc_commands, - ds_commands, - samr_commands, -+#ifdef PRINTER_SUPPORT - spoolss_commands, -+#endif - netlogon_commands, - srvsvc_commands, - dfs_commands, -diff -Naur samba-3.6.8/source3/rpc_server/rpc_ep_setup.c samba-3.6.8.patch/source3/rpc_server/rpc_ep_setup.c ---- samba-3.6.8/source3/rpc_server/rpc_ep_setup.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/rpc_server/rpc_ep_setup.c 2012-10-22 21:17:48.564839423 +0200 -@@ -1110,6 +1110,10 @@ - "rpc_server", - "spoolss", - "embedded"); -+#ifndef PRINTER_SUPPORT -+ if (1) { -+ } else -+#endif - if (StrCaseCmp(rpcsrv_type, "embedded") == 0) { - spoolss_cb.init = spoolss_init_cb; - spoolss_cb.shutdown = spoolss_shutdown_cb; -diff -Naur samba-3.6.8/source3/rpc_server/svcctl/srv_svcctl_nt.c samba-3.6.8.patch/source3/rpc_server/svcctl/srv_svcctl_nt.c ---- samba-3.6.8/source3/rpc_server/svcctl/srv_svcctl_nt.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/rpc_server/svcctl/srv_svcctl_nt.c 2012-10-22 21:17:48.582839784 +0200 -@@ -85,9 +85,11 @@ - - /* add builtin services */ - -+#ifdef PRINTER_SUPPORT - svcctl_ops[i].name = talloc_strdup( svcctl_ops, "Spooler" ); - svcctl_ops[i].ops = &spoolss_svc_ops; - i++; -+#endif - - svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" ); - svcctl_ops[i].ops = &netlogon_svc_ops; -diff -Naur samba-3.6.8/source3/smbd/close.c samba-3.6.8.patch/source3/smbd/close.c ---- samba-3.6.8/source3/smbd/close.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/close.c 2012-10-22 21:17:48.579839724 +0200 -@@ -643,6 +643,9 @@ - status = ntstatus_keeperror(status, tmp); - - if (fsp->print_file) { -+#ifndef PRINTER_SUPPORT -+ return NT_STATUS_OK; -+#endif - /* FIXME: return spool errors */ - print_spool_end(fsp, close_type); - file_free(req, fsp); -diff -Naur samba-3.6.8/source3/smbd/fileio.c samba-3.6.8.patch/source3/smbd/fileio.c ---- samba-3.6.8/source3/smbd/fileio.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/fileio.c 2012-10-22 21:17:48.580839744 +0200 -@@ -298,6 +298,10 @@ - uint32_t t; - int ret; - -+#ifndef PRINTER_SUPPORT -+ return -1; -+#endif -+ - ret = print_spool_write(fsp, data, n, pos, &t); - if (ret) { - errno = ret; -diff -Naur samba-3.6.8/source3/smbd/lanman.c samba-3.6.8.patch/source3/smbd/lanman.c ---- samba-3.6.8/source3/smbd/lanman.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/lanman.c 2012-10-22 21:17:48.576839664 +0200 -@@ -784,6 +784,10 @@ - union spoolss_JobInfo *job_info = NULL; - union spoolss_PrinterInfo printer_info; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -999,6 +1003,10 @@ - union spoolss_DriverInfo *driver_info; - union spoolss_JobInfo **job_info; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!param_format || !output_format1 || !p) { - return False; - } -@@ -3350,6 +3358,10 @@ - struct spoolss_DevmodeContainer devmode_ctr; - enum spoolss_JobControl command; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -3483,6 +3495,10 @@ - struct sec_desc_buf secdesc_ctr; - enum spoolss_PrinterControl command; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !QueueName) { - return False; - } -@@ -3649,6 +3665,10 @@ - union spoolss_JobInfo info; - struct spoolss_SetJobInfo1 info1; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -4792,6 +4812,10 @@ - struct spoolss_DevmodeContainer devmode_ctr; - union spoolss_JobInfo info; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -4930,6 +4954,10 @@ - uint32_t count = 0; - union spoolss_JobInfo *info; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -5135,6 +5163,10 @@ - struct spoolss_DevmodeContainer devmode_ctr; - union spoolss_PrinterInfo info; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -5271,6 +5303,10 @@ - union spoolss_PrinterInfo *info; - uint32_t count; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -5374,6 +5410,10 @@ - int succnt; - struct pack_desc desc; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -5438,6 +5478,10 @@ - int succnt; - struct pack_desc desc; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -5502,6 +5546,10 @@ - int succnt; - struct pack_desc desc; - -+#ifndef PRINTER_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -diff -Naur samba-3.6.8/source3/smbd/open.c samba-3.6.8.patch/source3/smbd/open.c ---- samba-3.6.8/source3/smbd/open.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/open.c 2012-10-22 21:17:48.578839704 +0200 -@@ -1546,6 +1546,9 @@ - * Most of the passed parameters are ignored. - */ - -+#ifndef PRINTER_SUPPORT -+ return NT_STATUS_ACCESS_DENIED; -+#endif - if (pinfo) { - *pinfo = FILE_WAS_CREATED; - } -diff -Naur samba-3.6.8/source3/smbd/process.c samba-3.6.8.patch/source3/smbd/process.c ---- samba-3.6.8/source3/smbd/process.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/process.c 2012-10-22 21:17:48.584839824 +0200 -@@ -2475,8 +2475,10 @@ - - change_to_root_user(); - -+#ifdef PRINTER_SUPPORT - /* update printer queue caches if necessary */ - update_monitored_printq_cache(sconn->msg_ctx); -+#endif - - /* check if we need to reload services */ - check_reload(sconn, time_mono(NULL)); -diff -Naur samba-3.6.8/source3/smbd/reply.c samba-3.6.8.patch/source3/smbd/reply.c ---- samba-3.6.8/source3/smbd/reply.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/reply.c 2012-10-22 21:17:48.573839604 +0200 -@@ -5196,7 +5196,11 @@ - return; - } - -- if (!CAN_PRINT(conn)) { -+ -+#ifdef PRINTER_SUPPORT -+ if (!CAN_PRINT(conn)) -+#endif -+ { - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - END_PROFILE(SMBsplopen); - return; -@@ -5302,7 +5306,10 @@ - is really quite gross and only worked when there was only - one printer - I think we should now only accept it if they - get it right (tridge) */ -- if (!CAN_PRINT(conn)) { -+#ifdef PRINTER_SUPPORT -+ if (!CAN_PRINT(conn)) -+#endif -+ { - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - END_PROFILE(SMBsplretq); - return; -diff -Naur samba-3.6.8/source3/smbd/server.c samba-3.6.8.patch/source3/smbd/server.c ---- samba-3.6.8/source3/smbd/server.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/server.c 2012-10-22 21:19:58.704461862 +0200 -@@ -126,7 +126,9 @@ - { - struct tevent_context *ev_ctx = - talloc_get_type_abort(private_data, struct tevent_context); -- -+#ifndef PRINTER_SUPPORT -+ return; -+#endif - DEBUG(10,("Got message saying pcap was updated. Reloading.\n")); - change_to_root_user(); - reload_printers(ev_ctx, msg); -@@ -1254,6 +1256,7 @@ - exit(1); - } - -+#ifdef PRINTER_SUPPORT - /* - * The print backend init also migrates the printing tdb's, - * this requires a winreg pipe. -@@ -1289,6 +1292,7 @@ - smbd_messaging_context()); - } - } -+#endif - - if (!is_daemon) { - /* inetd mode */ -diff -Naur samba-3.6.8/source3/smbd/server_exit.c samba-3.6.8.patch/source3/smbd/server_exit.c ---- samba-3.6.8/source3/smbd/server_exit.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/server_exit.c 2012-10-22 21:17:48.576839664 +0200 -@@ -141,7 +141,9 @@ - rpc_eventlog_shutdown(); - rpc_ntsvcs_shutdown(); - rpc_svcctl_shutdown(); -+#ifdef PRINTER_SUPPORT - rpc_spoolss_shutdown(); -+#endif - - rpc_srvsvc_shutdown(); - rpc_winreg_shutdown(); -diff -Naur samba-3.6.8/source3/smbd/smb2_create.c samba-3.6.8.patch/source3/smbd/smb2_create.c ---- samba-3.6.8/source3/smbd/smb2_create.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/smbd/smb2_create.c 2012-10-22 21:17:48.581839764 +0200 -@@ -485,7 +485,10 @@ - info = FILE_WAS_OPENED; - } else if (CAN_PRINT(smb1req->conn)) { - status = file_new(smb1req, smb1req->conn, &result); -- if(!NT_STATUS_IS_OK(status)) { -+#ifdef PRINTER_SUPPORT -+ if(!NT_STATUS_IS_OK(status)) -+#endif -+ { - tevent_req_nterror(req, status); - return tevent_req_post(req, ev); - } -diff -Naur samba-3.6.8/source3/utils/net_rpc.c samba-3.6.8.patch/source3/utils/net_rpc.c ---- samba-3.6.8/source3/utils/net_rpc.c 2012-09-14 10:12:09.000000000 +0200 -+++ samba-3.6.8.patch/source3/utils/net_rpc.c 2012-10-22 21:17:48.569839523 +0200 -@@ -7791,6 +7791,10 @@ - {NULL, NULL, 0, NULL, NULL} - }; - -+#ifndef PRINTER_SUPPORT -+ return 0; -+#endif -+ - if (argc == 0) { - if (c->display_usage) { - d_printf(_("Usage:\n")); diff --git a/packages/network/samba/patches/samba-210-remove_ad_support.patch b/packages/network/samba/patches/samba-210-remove_ad_support.patch deleted file mode 100644 index d6b8a7e0b2..0000000000 --- a/packages/network/samba/patches/samba-210-remove_ad_support.patch +++ /dev/null @@ -1,88 +0,0 @@ ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -95,9 +95,11 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_lsarpc)) { - return false; - } -+#ifdef ACTIVE_DIRECTORY - if (!smb_register_ndr_interface(&ndr_table_dssetup)) { - return false; - } -+#endif - if (!smb_register_ndr_interface(&ndr_table_samr)) { - return false; - } -@@ -141,9 +143,11 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_epmapper)) { - return false; - } -+#ifdef ACTIVE_DIRECTORY - if (!smb_register_ndr_interface(&ndr_table_drsuapi)) { - return false; - } -+#endif - return true; - } - ---- a/source3/rpc_server/rpc_ep_setup.c -+++ b/source3/rpc_server/rpc_ep_setup.c -@@ -918,6 +918,7 @@ static bool netdfs_init_cb(void *ptr) - return true; - } - -+#ifdef ACTIVE_DIRECTORY - static bool dssetup_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -966,6 +967,7 @@ static bool dssetup_init_cb(void *ptr) - - return true; - } -+#endif - - static bool wkssvc_init_cb(void *ptr) - { -@@ -1172,12 +1174,14 @@ bool dcesrv_ep_setup(struct tevent_conte - } - #endif - -+#ifdef ACTIVE_DIRECTORY - dssetup_cb.init = dssetup_init_cb; - dssetup_cb.shutdown = NULL; - dssetup_cb.private_data = ep_ctx; - if (!NT_STATUS_IS_OK(rpc_dssetup_init(&dssetup_cb))) { - return false; - } -+#endif - - wkssvc_cb.init = wkssvc_init_cb; - wkssvc_cb.shutdown = NULL; ---- a/source3/smbd/server_exit.c -+++ b/source3/smbd/server_exit.c -@@ -133,7 +133,9 @@ static void exit_server_common(enum serv - - if (am_parent) { - rpc_wkssvc_shutdown(); -+#ifdef ACTIVE_DIRECTORY - rpc_dssetup_shutdown(); -+#endif - #ifdef DEVELOPER - rpc_rpcecho_shutdown(); - #endif ---- a/source3/rpc_client/cli_pipe.c -+++ b/source3/rpc_client/cli_pipe.c -@@ -2874,12 +2874,14 @@ NTSTATUS cli_rpc_pipe_open_noauth_transp - status = rpc_pipe_bind(result, auth); - if (!NT_STATUS_IS_OK(status)) { - int lvl = 0; -+#ifdef ACTIVE_DIRECTORY - if (ndr_syntax_id_equal(interface, - &ndr_table_dssetup.syntax_id)) { - /* non AD domains just don't have this pipe, avoid - * level 0 statement in that case - gd */ - lvl = 3; - } -+#endif - DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe " - "%s failed with error %s\n", - get_pipe_name_from_syntax(talloc_tos(), interface), diff --git a/packages/network/samba/patches/samba-220-remove_services.patch b/packages/network/samba/patches/samba-220-remove_services.patch deleted file mode 100644 index c09721af7c..0000000000 --- a/packages/network/samba/patches/samba-220-remove_services.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -131,6 +131,7 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_initshutdown)) { - return false; - } -+#ifdef EXTRA_SERVICES - if (!smb_register_ndr_interface(&ndr_table_svcctl)) { - return false; - } -@@ -140,6 +141,7 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_ntsvcs)) { - return false; - } -+#endif - if (!smb_register_ndr_interface(&ndr_table_epmapper)) { - return false; - } ---- a/source3/rpc_server/rpc_ep_setup.c -+++ b/source3/rpc_server/rpc_ep_setup.c -@@ -697,6 +697,7 @@ static bool spoolss_shutdown_cb(void *pt - return true; - } - -+#ifdef EXTRA_SERVICES - static bool svcctl_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -733,6 +734,7 @@ static bool svcctl_init_cb(void *ptr) - - return true; - } -+#endif - - static bool svcctl_shutdown_cb(void *ptr) - { -@@ -741,6 +743,8 @@ static bool svcctl_shutdown_cb(void *ptr - return true; - } - -+#ifdef EXTRA_SERVICES -+ - static bool ntsvcs_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -802,6 +806,7 @@ static bool eventlog_init_cb(void *ptr) - - return true; - } -+#endif - - static bool initshutdown_init_cb(void *ptr) - { -@@ -1130,6 +1135,7 @@ bool dcesrv_ep_setup(struct tevent_conte - } - } - -+#ifdef EXTRA_SERVICES - svcctl_cb.init = svcctl_init_cb; - svcctl_cb.shutdown = svcctl_shutdown_cb; - svcctl_cb.private_data = ep_ctx; -@@ -1150,6 +1156,7 @@ bool dcesrv_ep_setup(struct tevent_conte - if (!NT_STATUS_IS_OK(rpc_eventlog_init(&eventlog_cb))) { - return false; - } -+#endif - - initshutdown_cb.init = initshutdown_init_cb; - initshutdown_cb.shutdown = NULL; ---- a/source3/smbd/server_exit.c -+++ b/source3/smbd/server_exit.c -@@ -141,9 +141,11 @@ static void exit_server_common(enum serv - #endif - rpc_netdfs_shutdown(); - rpc_initshutdown_shutdown(); -+#ifdef EXTRA_SERVICES - rpc_eventlog_shutdown(); -- rpc_ntsvcs_shutdown(); - rpc_svcctl_shutdown(); -+ rpc_ntsvcs_shutdown(); -+#endif - #ifdef PRINTER_SUPPORT - rpc_spoolss_shutdown(); - #endif ---- a/source3/rpcclient/rpcclient.c -+++ b/source3/rpcclient/rpcclient.c -@@ -637,9 +637,11 @@ static struct cmd_set *rpcclient_command - shutdown_commands, - test_commands, - wkssvc_commands, -+#ifdef EXTRA_SERVICES - ntsvcs_commands, - drsuapi_commands, - eventlog_commands, -+#endif - winreg_commands, - NULL - }; diff --git a/packages/network/samba/patches/samba-230-remove_winreg_support.patch b/packages/network/samba/patches/samba-230-remove_winreg_support.patch deleted file mode 100644 index 5a4f656a72..0000000000 --- a/packages/network/samba/patches/samba-230-remove_winreg_support.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/source3/rpc_server/rpc_ep_setup.c -+++ b/source3/rpc_server/rpc_ep_setup.c -@@ -409,6 +409,7 @@ static bool epmapper_shutdown_cb(void *p - return true; - } - -+#ifdef WINREG_SUPPORT - static bool winreg_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -456,6 +457,7 @@ static bool winreg_init_cb(void *ptr) - - return true; - } -+#endif - - static bool srvsvc_init_cb(void *ptr) - { -@@ -710,10 +712,12 @@ static bool svcctl_init_cb(void *ptr) - "epmapper", - "none"); - -+#ifdef WINREG_SUPPORT - ok = svcctl_init_winreg(ep_ctx->msg_ctx); - if (!ok) { - return false; - } -+#endif - - /* initialize the control hooks */ - init_service_op_table(); -@@ -785,10 +789,12 @@ static bool eventlog_init_cb(void *ptr) - "epmapper", - "none"); - -+#ifdef WINREG_SUPPORT - ok = eventlog_init_winreg(ep_ctx->msg_ctx); - if (!ok) { - return false; - } -+#endif - - if (StrCaseCmp(rpcsrv_type, "embedded") == 0 || - StrCaseCmp(rpcsrv_type, "daemon") == 0) { -@@ -1077,12 +1083,14 @@ bool dcesrv_ep_setup(struct tevent_conte - } - } - -+#ifdef WINREG_SUPPORT - winreg_cb.init = winreg_init_cb; - winreg_cb.shutdown = NULL; - winreg_cb.private_data = ep_ctx; - if (!NT_STATUS_IS_OK(rpc_winreg_init(&winreg_cb))) { - return false; - } -+#endif - - srvsvc_cb.init = srvsvc_init_cb; - srvsvc_cb.shutdown = NULL; ---- a/source3/smbd/server_exit.c -+++ b/source3/smbd/server_exit.c -@@ -151,7 +151,9 @@ static void exit_server_common(enum serv - #endif - - rpc_srvsvc_shutdown(); -+#ifdef WINREG_SUPPORT - rpc_winreg_shutdown(); -+#endif - - rpc_netlogon_shutdown(); - rpc_samr_shutdown(); ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -112,9 +112,11 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_wkssvc)) { - return false; - } -+#ifdef WINREG_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_winreg)) { - return false; - } -+#endif - #ifdef PRINTER_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_spoolss)) { - return false; ---- a/source3/rpc_server/svcctl/srv_svcctl_nt.c -+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c -@@ -95,9 +95,11 @@ bool init_service_op_table( void ) - svcctl_ops[i].ops = &netlogon_svc_ops; - i++; - -+#ifdef WINREG_SUPPORT - svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" ); - svcctl_ops[i].ops = &winreg_svc_ops; - i++; -+#endif - - svcctl_ops[i].name = talloc_strdup( svcctl_ops, "WINS" ); - svcctl_ops[i].ops = &wins_svc_ops; ---- a/source3/services/svc_winreg_glue.c -+++ b/source3/services/svc_winreg_glue.c -@@ -88,6 +88,10 @@ struct security_descriptor *svcctl_get_s - NTSTATUS status; - WERROR result = WERR_OK; - -+#ifndef WINREG_SUPPORT -+ return NULL; -+#endif -+ - key = talloc_asprintf(mem_ctx, - "%s\\%s\\Security", - TOP_LEVEL_SERVICES_KEY, name); -@@ -161,6 +165,10 @@ bool svcctl_set_secdesc(struct messaging - NTSTATUS status; - WERROR result = WERR_OK; - -+#ifndef WINREG_SUPPORT -+ return false; -+#endif -+ - tmp_ctx = talloc_stackframe(); - if (tmp_ctx == NULL) { - return false; -@@ -272,6 +280,10 @@ const char *svcctl_get_string_value(TALL - NTSTATUS status; - WERROR result = WERR_OK; - -+#ifndef WINREG_SUPPORT -+ return NULL; -+#endif -+ - tmp_ctx = talloc_stackframe(); - if (tmp_ctx == NULL) { - return NULL; ---- a/source3/rpcclient/rpcclient.c -+++ b/source3/rpcclient/rpcclient.c -@@ -642,7 +642,9 @@ static struct cmd_set *rpcclient_command - drsuapi_commands, - eventlog_commands, - #endif -+#ifdef WINREG_SUPPORT - winreg_commands, -+#endif - NULL - }; - diff --git a/packages/network/samba/patches/samba-240-remove_dfs_api.patch b/packages/network/samba/patches/samba-240-remove_dfs_api.patch deleted file mode 100644 index 30882c2633..0000000000 --- a/packages/network/samba/patches/samba-240-remove_dfs_api.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/source3/rpc_server/rpc_ep_setup.c -+++ b/source3/rpc_server/rpc_ep_setup.c -@@ -881,6 +881,7 @@ static bool rpcecho_init_cb(void *ptr) { - - #endif - -+#ifdef DFS_SUPPORT - static bool netdfs_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -928,6 +929,7 @@ static bool netdfs_init_cb(void *ptr) - - return true; - } -+#endif - - #ifdef ACTIVE_DIRECTORY - static bool dssetup_init_cb(void *ptr) -@@ -1173,12 +1175,14 @@ bool dcesrv_ep_setup(struct tevent_conte - return false; - } - -+#ifdef DFS_SUPPORT - netdfs_cb.init = netdfs_init_cb; - netdfs_cb.shutdown = NULL; - netdfs_cb.private_data = ep_ctx; - if (!NT_STATUS_IS_OK(rpc_netdfs_init(&netdfs_cb))) { - return false; - } -+#endif - - #ifdef DEVELOPER - rpcecho_cb.init = rpcecho_init_cb; ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -122,9 +122,11 @@ static bool initialize_interfaces(void) - return false; - } - #endif -+#ifdef DFS_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_netdfs)) { - return false; - } -+#endif - #ifdef DEVELOPER - if (!smb_register_ndr_interface(&ndr_table_rpcecho)) { - return false; ---- a/source3/smbd/server_exit.c -+++ b/source3/smbd/server_exit.c -@@ -139,7 +139,9 @@ static void exit_server_common(enum serv - #ifdef DEVELOPER - rpc_rpcecho_shutdown(); - #endif -+#ifdef DFS_SUPPORT - rpc_netdfs_shutdown(); -+#endif - rpc_initshutdown_shutdown(); - #ifdef EXTRA_SERVICES - rpc_eventlog_shutdown(); ---- a/source3/rpcclient/rpcclient.c -+++ b/source3/rpcclient/rpcclient.c -@@ -629,7 +629,9 @@ static struct cmd_set *rpcclient_command - #endif - netlogon_commands, - srvsvc_commands, -+#ifdef DFS_SUPPORT - dfs_commands, -+#endif - #ifdef DEVELOPER - echo_commands, - #endif diff --git a/packages/network/samba/patches/samba-250-remove_domain_logon.patch b/packages/network/samba/patches/samba-250-remove_domain_logon.patch deleted file mode 100644 index 2db6524f6b..0000000000 --- a/packages/network/samba/patches/samba-250-remove_domain_logon.patch +++ /dev/null @@ -1,185 +0,0 @@ ---- a/source3/rpc_server/rpc_ep_setup.c -+++ b/source3/rpc_server/rpc_ep_setup.c -@@ -606,6 +606,7 @@ static bool samr_init_cb(void *ptr) - return true; - } - -+#ifdef NETLOGON_SUPPORT - static bool netlogon_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -654,6 +655,7 @@ static bool netlogon_init_cb(void *ptr) - - return true; - } -+#endif - - static bool spoolss_init_cb(void *ptr) - { -@@ -1116,12 +1118,15 @@ bool dcesrv_ep_setup(struct tevent_conte - return false; - } - -+#ifdef NETLOGON_SUPPORT - netlogon_cb.init = netlogon_init_cb; - netlogon_cb.shutdown = NULL; - netlogon_cb.private_data = ep_ctx; - if (!NT_STATUS_IS_OK(rpc_netlogon_init(&netlogon_cb))) { - return false; - } -+#endif -+ - - rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, - "rpc_server", ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -103,9 +103,11 @@ static bool initialize_interfaces(void) - if (!smb_register_ndr_interface(&ndr_table_samr)) { - return false; - } -+#ifdef NETLOGON_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_netlogon)) { - return false; - } -+#endif - if (!smb_register_ndr_interface(&ndr_table_srvsvc)) { - return false; - } ---- a/source3/smbd/server_exit.c -+++ b/source3/smbd/server_exit.c -@@ -157,7 +157,9 @@ static void exit_server_common(enum serv - rpc_winreg_shutdown(); - #endif - -+#ifdef NETLOGON_SUPPORT - rpc_netlogon_shutdown(); -+#endif - rpc_samr_shutdown(); - rpc_lsarpc_shutdown(); - } ---- a/source3/rpc_server/svcctl/srv_svcctl_nt.c -+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c -@@ -91,9 +91,11 @@ bool init_service_op_table( void ) - i++; - #endif - -+#ifdef NETLOGON_SUPPORT - svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" ); - svcctl_ops[i].ops = &netlogon_svc_ops; - i++; -+#endif - - #ifdef WINREG_SUPPORT - svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" ); ---- a/source3/nmbd/nmbd_processlogon.c -+++ b/source3/nmbd/nmbd_processlogon.c -@@ -320,6 +320,10 @@ void process_logon_packet(struct packet_ - NTSTATUS status; - const char *pdc_name; - -+#ifndef NETLOGON_SUPPORT -+ return; -+#endif -+ - in_addr_to_sockaddr_storage(&ss, p->ip); - pss = iface_ip((struct sockaddr *)&ss); - if (!pss) { ---- a/source3/rpcclient/rpcclient.c -+++ b/source3/rpcclient/rpcclient.c -@@ -627,7 +627,9 @@ static struct cmd_set *rpcclient_command - #ifdef PRINTER_SUPPORT - spoolss_commands, - #endif -+#ifdef NETLOGON_SUPPORT - netlogon_commands, -+#endif - srvsvc_commands, - #ifdef DFS_SUPPORT - dfs_commands, ---- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c -+++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c -@@ -820,6 +820,10 @@ WERROR _wkssvc_NetrJoinDomain2(struct pi - WERROR werr; - struct security_token *token = p->session_info->security_token; - -+#ifndef NETLOGON_SUPPORT -+ return WERR_NOT_SUPPORTED; -+#endif -+ - if (!r->in.domain_name) { - return WERR_INVALID_PARAM; - } -@@ -897,6 +901,10 @@ WERROR _wkssvc_NetrUnjoinDomain2(struct - WERROR werr; - struct security_token *token = p->session_info->security_token; - -+#ifndef NETLOGON_SUPPORT -+ return WERR_NOT_SUPPORTED; -+#endif -+ - if (!r->in.account || !r->in.encrypted_password) { - return WERR_INVALID_PARAM; - } ---- a/source3/libsmb/trusts_util.c -+++ b/source3/libsmb/trusts_util.c -@@ -46,9 +46,11 @@ NTSTATUS trust_pw_change_and_store_it(st - NTSTATUS nt_status; - - switch (sec_channel_type) { -+#ifdef NETLOGON_SUPPORT - case SEC_CHAN_WKSTA: - case SEC_CHAN_DOMAIN: - break; -+#endif - default: - return NT_STATUS_NOT_SUPPORTED; - } -@@ -159,6 +161,11 @@ bool enumerate_domain_trusts( TALLOC_CTX - *num_domains = 0; - *sids = NULL; - -+#ifndef NETLOGON_SUPPORT -+ return False; -+#endif -+ -+ - /* lookup a DC first */ - - if ( !get_dc_name(domain, NULL, dc_name, &dc_ss) ) { -@@ -243,6 +250,10 @@ NTSTATUS change_trust_account_password( - struct cli_state *cli = NULL; - struct rpc_pipe_client *netlogon_pipe = NULL; - -+#ifndef NETLOGON_SUPPORT -+ return NT_STATUS_UNSUCCESSFUL; -+#endif -+ - DEBUG(5,("change_trust_account_password: Attempting to change trust account password in domain %s....\n", - domain)); - ---- a/source3/auth/auth_domain.c -+++ b/source3/auth/auth_domain.c -@@ -538,7 +538,9 @@ static NTSTATUS auth_init_trustdomain(st - - NTSTATUS auth_domain_init(void) - { -+#ifdef NETLOGON_SUPPORT - smb_register_auth(AUTH_INTERFACE_VERSION, "trustdomain", auth_init_trustdomain); - smb_register_auth(AUTH_INTERFACE_VERSION, "ntdomain", auth_init_ntdomain); -+#endif - return NT_STATUS_OK; - } ---- a/source3/smbd/process.c -+++ b/source3/smbd/process.c -@@ -2483,8 +2483,10 @@ static bool housekeeping_fn(const struct - /* check if we need to reload services */ - check_reload(sconn, time_mono(NULL)); - -+#ifdef NETLOGON_SUPPORT - /* Change machine password if neccessary. */ - attempt_machine_password_change(); -+#endif - - /* - * Force a log file check. diff --git a/packages/network/samba/patches/samba-260-remove_samr.patch b/packages/network/samba/patches/samba-260-remove_samr.patch deleted file mode 100644 index fb8ef3c4d0..0000000000 --- a/packages/network/samba/patches/samba-260-remove_samr.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff -Naur samba-3.6.23/source3/librpc/rpc/rpc_common.c samba-3.6.23.patch/source3/librpc/rpc/rpc_common.c ---- samba-3.6.23/source3/librpc/rpc/rpc_common.c 2014-03-12 16:10:57.120989895 +0100 -+++ samba-3.6.23.patch/source3/librpc/rpc/rpc_common.c 2014-03-12 16:11:48.361046356 +0100 -@@ -100,9 +100,11 @@ - return false; - } - #endif -+#ifdef SAMR_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_samr)) { - return false; - } -+#endif - #ifdef NETLOGON_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_netlogon)) { - return false; -diff -Naur samba-3.6.23/source3/rpcclient/rpcclient.c samba-3.6.23.patch/source3/rpcclient/rpcclient.c ---- samba-3.6.23/source3/rpcclient/rpcclient.c 2014-03-12 16:10:57.121989948 +0100 -+++ samba-3.6.23.patch/source3/rpcclient/rpcclient.c 2014-03-12 16:11:48.362046792 +0100 -@@ -623,7 +623,9 @@ - rpcclient_commands, - lsarpc_commands, - ds_commands, -+#ifdef SAMR_SUPPORT - samr_commands, -+#endif - #ifdef PRINTER_SUPPORT - spoolss_commands, - #endif -diff -Naur samba-3.6.23/source3/rpc_server/rpc_ep_setup.c samba-3.6.23.patch/source3/rpc_server/rpc_ep_setup.c ---- samba-3.6.23/source3/rpc_server/rpc_ep_setup.c 2014-03-12 16:10:57.120989895 +0100 -+++ samba-3.6.23.patch/source3/rpc_server/rpc_ep_setup.c 2014-03-12 16:11:48.361046356 +0100 -@@ -557,6 +557,7 @@ - return true; - } - -+#ifdef SAMR_SUPPORT - static bool samr_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -605,6 +606,7 @@ - - return true; - } -+#endif - - #ifdef NETLOGON_SUPPORT - static bool netlogon_init_cb(void *ptr) -@@ -1111,12 +1113,14 @@ - return false; - } - -+#ifdef SAMR_SUPPORT - samr_cb.init = samr_init_cb; - samr_cb.shutdown = NULL; - samr_cb.private_data = ep_ctx; - if (!NT_STATUS_IS_OK(rpc_samr_init(&samr_cb))) { - return false; - } -+#endif - - #ifdef NETLOGON_SUPPORT - netlogon_cb.init = netlogon_init_cb; -diff -Naur samba-3.6.23/source3/rpc_server/rpc_handles.c samba-3.6.23.patch/source3/rpc_server/rpc_handles.c ---- samba-3.6.23/source3/rpc_server/rpc_handles.c 2014-03-11 11:17:34.000000000 +0100 -+++ samba-3.6.23.patch/source3/rpc_server/rpc_handles.c 2014-03-12 16:11:48.361046356 +0100 -@@ -59,8 +59,11 @@ - - static bool is_samr_lsa_pipe(const struct ndr_syntax_id *syntax) - { -- return (ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) -- || ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id)); -+ return -+#ifdef SAMR_SUPPORT -+ ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) || -+#endif -+ ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id); - } - - size_t num_pipe_handles(struct pipes_struct *p) -diff -Naur samba-3.6.23/source3/smbd/lanman.c samba-3.6.23.patch/source3/smbd/lanman.c ---- samba-3.6.23/source3/smbd/lanman.c 2014-03-12 16:10:30.535984713 +0100 -+++ samba-3.6.23.patch/source3/smbd/lanman.c 2014-03-12 16:11:48.362046792 +0100 -@@ -2353,6 +2353,10 @@ - NTSTATUS status, result; - struct dcerpc_binding_handle *b; - -+#ifndef SAMR_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -2541,6 +2545,10 @@ - NTSTATUS status, result; - struct dcerpc_binding_handle *b; - -+#ifndef SAMR_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !UserName || !p) { - return False; - } -@@ -2741,6 +2749,10 @@ - - struct dcerpc_binding_handle *b; - -+#ifndef SAMR_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -2979,6 +2991,10 @@ - int bufsize; - struct dcerpc_binding_handle *b; - -+#ifndef SAMR_SUPPORT -+ return False; -+#endif -+ - *rparam_len = 4; - *rparam = smb_realloc_limit(*rparam,*rparam_len); - if (!*rparam) { -@@ -4020,6 +4036,10 @@ - union samr_UserInfo *info; - struct dcerpc_binding_handle *b = NULL; - -+#ifndef SAMR_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !UserName || !p) { - return False; - } -diff -Naur samba-3.6.23/source3/smbd/server_exit.c samba-3.6.23.patch/source3/smbd/server_exit.c ---- samba-3.6.23/source3/smbd/server_exit.c 2014-03-12 16:10:57.120989895 +0100 -+++ samba-3.6.23.patch/source3/smbd/server_exit.c 2014-03-12 16:11:48.361046356 +0100 -@@ -159,7 +159,9 @@ - #ifdef NETLOGON_SUPPORT - rpc_netlogon_shutdown(); - #endif -+#ifdef SAMR_SUPPORT - rpc_samr_shutdown(); -+#endif - rpc_lsarpc_shutdown(); - } - diff --git a/packages/network/samba/patches/samba-270-remove_registry_backend.patch b/packages/network/samba/patches/samba-270-remove_registry_backend.patch deleted file mode 100644 index a1cc87771a..0000000000 --- a/packages/network/samba/patches/samba-270-remove_registry_backend.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/source3/lib/smbconf/smbconf_init.c -+++ b/source3/lib/smbconf/smbconf_init.c -@@ -68,9 +68,12 @@ sbcErr smbconf_init(TALLOC_CTX *mem_ctx, - } - } - -+#ifdef REGISTRY_BACKEND - if (strequal(backend, "registry") || strequal(backend, "reg")) { - err = smbconf_init_reg(mem_ctx, conf_ctx, path); -- } else if (strequal(backend, "file") || strequal(backend, "txt")) { -+ } else -+#endif -+ if (strequal(backend, "file") || strequal(backend, "txt")) { - err = smbconf_init_txt(mem_ctx, conf_ctx, path); - } else if (sep == NULL) { - /* ---- a/source3/lib/netapi/serverinfo.c -+++ b/source3/lib/netapi/serverinfo.c -@@ -557,7 +557,10 @@ static WERROR NetServerSetInfo_l_1005(st - return WERR_INVALID_PARAM; - } - -- if (!lp_config_backend_is_registry()) { -+#ifdef REGISTRY_BACKEND -+ if (!lp_config_backend_is_registry()) -+#endif -+ { - libnetapi_set_error_string(ctx, - "Configuration manipulation requested but not " - "supported by backend"); ---- a/source3/smbd/server.c -+++ b/source3/smbd/server.c -@@ -1210,8 +1210,10 @@ extern void build_options(bool screen); - exit(1); - } - -+#ifdef REGISTRY_BACKEND - if (!W_ERROR_IS_OK(registry_init_full())) - exit(1); -+#endif - - #ifdef PRINTER_SUPPORT - if (!print_backend_init(smbd_messaging_context())) diff --git a/packages/network/samba/patches/samba-280-strip_srvsvc.patch b/packages/network/samba/patches/samba-280-strip_srvsvc.patch deleted file mode 100644 index b93e3fce6a..0000000000 --- a/packages/network/samba/patches/samba-280-strip_srvsvc.patch +++ /dev/null @@ -1,143 +0,0 @@ ---- a/source3/smbd/lanman.c -+++ b/source3/smbd/lanman.c -@@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd - struct srvsvc_NetShareInfo2 info2; - struct dcerpc_binding_handle *b; - -+#ifndef SRVSVC_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } -@@ -3838,10 +3842,7 @@ static bool api_RNetServerGetInfo(struct - NTSTATUS status; - WERROR werr; - TALLOC_CTX *mem_ctx = talloc_tos(); -- struct rpc_pipe_client *cli = NULL; -- union srvsvc_NetSrvInfo info; - int errcode; -- struct dcerpc_binding_handle *b; - - if (!str1 || !str2 || !p) { - return False; -@@ -3904,66 +3905,16 @@ static bool api_RNetServerGetInfo(struct - p = *rdata; - p2 = p + struct_len; - -- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id, -- conn->session_info, -- &conn->sconn->client_id, -- conn->sconn->msg_ctx, -- &cli); -- if (!NT_STATUS_IS_OK(status)) { -- DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n", -- nt_errstr(status))); -- errcode = W_ERROR_V(ntstatus_to_werror(status)); -- goto out; -- } -- -- b = cli->binding_handle; -- -- status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx, -- NULL, -- 101, -- &info, -- &werr); -- if (!NT_STATUS_IS_OK(status)) { -- errcode = W_ERROR_V(ntstatus_to_werror(status)); -- goto out; -- } -- if (!W_ERROR_IS_OK(werr)) { -- errcode = W_ERROR_V(werr); -- goto out; -- } -- -- if (info.info101 == NULL) { -- errcode = W_ERROR_V(WERR_INVALID_PARAM); -- goto out; -- } -- - if (uLevel != 20) { -- srvstr_push(NULL, 0, p, info.info101->server_name, 16, -+ srvstr_push(NULL, 0, p, global_myname(), 16, - STR_ASCII|STR_UPPER|STR_TERMINATE); -- } -+ } - p += 16; - if (uLevel > 0) { -- SCVAL(p,0,info.info101->version_major); -- SCVAL(p,1,info.info101->version_minor); -- SIVAL(p,2,info.info101->server_type); -- -- if (mdrcnt == struct_len) { -- SIVAL(p,6,0); -- } else { -- SIVAL(p,6,PTR_DIFF(p2,*rdata)); -- if (mdrcnt - struct_len <= 0) { -- return false; -- } -- push_ascii(p2, -- info.info101->comment, -- MIN(mdrcnt - struct_len, -- MAX_SERVER_STRING_LENGTH), -- STR_TERMINATE); -- p2 = skip_string(*rdata,*rdata_len,p2); -- if (!p2) { -- return False; -- } -- } -+ SCVAL(p,0,lp_major_announce_version()); -+ SCVAL(p,1,lp_minor_announce_version()); -+ SIVAL(p,2,lp_default_server_announce()); -+ SIVAL(p,6,0); - } - - if (uLevel > 1) { -@@ -5654,6 +5605,10 @@ static bool api_RNetSessionEnum(struct s - uint32_t totalentries, resume_handle = 0; - uint32_t count = 0; - -+#ifndef SRVSVC_SUPPORT -+ return False; -+#endif -+ - if (!str1 || !str2 || !p) { - return False; - } ---- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c -+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c -@@ -1533,6 +1533,10 @@ WERROR _srvsvc_NetShareSetInfo(struct pi - TALLOC_CTX *ctx = p->mem_ctx; - union srvsvc_NetShareInfo *info = r->in.info; - -+#ifndef FULL_SRVSVC -+ return WERR_ACCESS_DENIED; -+#endif -+ - DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__)); - - if (!r->in.share_name) { -@@ -1763,6 +1767,10 @@ WERROR _srvsvc_NetShareAdd(struct pipes_ - int max_connections = 0; - TALLOC_CTX *ctx = p->mem_ctx; - -+#ifndef FULL_SRVSVC -+ return WERR_ACCESS_DENIED; -+#endif -+ - DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__)); - - if (r->out.parm_error) { -@@ -1945,6 +1953,10 @@ WERROR _srvsvc_NetShareDel(struct pipes_ - struct share_params *params; - TALLOC_CTX *ctx = p->mem_ctx; - -+#ifndef FULL_SRVSVC -+ return WERR_ACCESS_DENIED; -+#endif -+ - DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__)); - - if (!r->in.share_name) { diff --git a/packages/network/samba/patches/samba-290-remove_lsa.patch b/packages/network/samba/patches/samba-290-remove_lsa.patch deleted file mode 100644 index 8fd48c4282..0000000000 --- a/packages/network/samba/patches/samba-290-remove_lsa.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- a/source3/librpc/rpc/rpc_common.c -+++ b/source3/librpc/rpc/rpc_common.c -@@ -92,9 +92,11 @@ bool smb_register_ndr_interface(const st - - static bool initialize_interfaces(void) - { -+#ifdef LSA_SUPPORT - if (!smb_register_ndr_interface(&ndr_table_lsarpc)) { - return false; - } -+#endif - #ifdef ACTIVE_DIRECTORY - if (!smb_register_ndr_interface(&ndr_table_dssetup)) { - return false; ---- a/source3/smbd/server_exit.c -+++ b/source3/smbd/server_exit.c -@@ -163,7 +163,9 @@ static void exit_server_common(enum serv - #ifdef SAMR_SUPPORT - rpc_samr_shutdown(); - #endif -+#ifdef LSA_SUPPORT - rpc_lsarpc_shutdown(); -+#endif - } - - /* ---- a/source3/rpc_server/rpc_ep_setup.c -+++ b/source3/rpc_server/rpc_ep_setup.c -@@ -508,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr) - return true; - } - -+#ifdef LSA_SUPPORT - static bool lsarpc_init_cb(void *ptr) - { - struct dcesrv_ep_context *ep_ctx = -@@ -556,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr) - - return true; - } -+#endif - - #ifdef SAMR_SUPPORT - static bool samr_init_cb(void *ptr) -@@ -1106,12 +1108,14 @@ bool dcesrv_ep_setup(struct tevent_conte - } - - -+#ifdef LSA_SUPPORT - lsarpc_cb.init = lsarpc_init_cb; - lsarpc_cb.shutdown = NULL; - lsarpc_cb.private_data = ep_ctx; - if (!NT_STATUS_IS_OK(rpc_lsarpc_init(&lsarpc_cb))) { - return false; - } -+#endif - - #ifdef SAMR_SUPPORT - samr_cb.init = samr_init_cb; ---- a/source3/rpc_server/rpc_handles.c -+++ b/source3/rpc_server/rpc_handles.c -@@ -63,7 +63,10 @@ static bool is_samr_lsa_pipe(const struc - #ifdef SAMR_SUPPORT - ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) || - #endif -- ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id); -+#ifdef LSA_SUPPORT -+ ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id) || -+#endif -+ false; - } - - size_t num_pipe_handles(struct pipes_struct *p) diff --git a/packages/network/samba/patches/samba-300-assert_debug_level.patch b/packages/network/samba/patches/samba-300-assert_debug_level.patch deleted file mode 100644 index c5b07168c6..0000000000 --- a/packages/network/samba/patches/samba-300-assert_debug_level.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib/util/util.h -+++ b/lib/util/util.h -@@ -53,7 +53,7 @@ extern const char *panic_action; - #else - /* redefine the assert macro for non-developer builds */ - #define SMB_ASSERT(b) do { if (!(b)) { \ -- DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \ -+ DEBUG(3,("PANIC: assert failed at %s(%d): %s\n", \ - __FILE__, __LINE__, #b)); }} while (0) - #endif - diff --git a/packages/network/samba/patches/samba-310-remove_error_strings.patch b/packages/network/samba/patches/samba-310-remove_error_strings.patch deleted file mode 100644 index 2adbc08193..0000000000 --- a/packages/network/samba/patches/samba-310-remove_error_strings.patch +++ /dev/null @@ -1,253 +0,0 @@ ---- a/libcli/util/doserr.c -+++ b/libcli/util/doserr.c -@@ -28,6 +28,7 @@ struct werror_code_struct { - - static const struct werror_code_struct dos_errs[] = - { -+#ifdef VERBOSE_ERROR - { "WERR_OK", WERR_OK }, - { "WERR_BADFILE", WERR_BADFILE }, - { "WERR_ACCESS_DENIED", WERR_ACCESS_DENIED }, -@@ -2668,6 +2669,7 @@ static const struct werror_code_struct d - { "WERR_AMBIGUOUS_SYSTEM_DEVICE", WERR_AMBIGUOUS_SYSTEM_DEVICE }, - { "WERR_SYSTEM_DEVICE_NOT_FOUND", WERR_SYSTEM_DEVICE_NOT_FOUND }, - /* END GENERATED-WIN32-ERROR-CODES */ -+#endif - { NULL, W_ERROR(0) } - }; - -@@ -2684,12 +2686,14 @@ const char *win_errstr(WERROR werror) - static char msg[40]; - int idx = 0; - -+#ifdef VERBOSE_ERROR - while (dos_errs[idx].dos_errstr != NULL) { - if (W_ERROR_V(dos_errs[idx].werror) == - W_ERROR_V(werror)) - return dos_errs[idx].dos_errstr; - idx++; - } -+#endif - - slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror)); - -@@ -2702,6 +2706,7 @@ struct werror_str_struct { - }; - - const struct werror_str_struct dos_err_strs[] = { -+#ifdef VERBOSE_ERROR - { WERR_OK, "Success" }, - { WERR_ACCESS_DENIED, "Access is denied" }, - { WERR_INVALID_PARAM, "Invalid parameter" }, -@@ -5324,6 +5329,7 @@ const struct werror_str_struct dos_err_s - { WERR_AMBIGUOUS_SYSTEM_DEVICE, "The requested system device cannot be identified due to multiple indistinguishable devices potentially matching the identification criteria." }, - { WERR_SYSTEM_DEVICE_NOT_FOUND, "The requested system device cannot be found." }, - /* END GENERATED-WIN32-ERROR-CODES-DESC */ -+#endif - }; - - -@@ -5334,6 +5340,7 @@ const struct werror_str_struct dos_err_s - - const char *get_friendly_werror_msg(WERROR werror) - { -+#ifdef VERBOSE_ERROR - int i = 0; - - for (i = 0; i < ARRAY_SIZE(dos_err_strs); i++) { -@@ -5342,6 +5349,7 @@ const char *get_friendly_werror_msg(WERR - return dos_err_strs[i].friendly_errstr; - } - } -+#endif - - return win_errstr(werror); - } ---- a/librpc/ndr/libndr.h -+++ b/librpc/ndr/libndr.h -@@ -598,4 +598,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_enum - - _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b); - -+#ifndef VERBOSE_ERROR -+#define ndr_print_bool(...) do {} while (0) -+#define ndr_print_struct(...) do {} while (0) -+#define ndr_print_null(...) do {} while (0) -+#define ndr_print_enum(...) do {} while (0) -+#define ndr_print_bitmap_flag(...) do {} while (0) -+#define ndr_print_ptr(...) do {} while (0) -+#define ndr_print_union(...) do {} while (0) -+#define ndr_print_bad_level(...) do {} while (0) -+#define ndr_print_array_uint8(...) do {} while (0) -+#define ndr_print_string_array(...) do {} while (0) -+#define ndr_print_string_array(...) do {} while (0) -+#define ndr_print_NTSTATUS(...) do {} while (0) -+#define ndr_print_WERROR(...) do {} while (0) -+#endif -+ - #endif /* __LIBNDR_H__ */ ---- a/librpc/ndr/ndr_basic.c -+++ b/librpc/ndr/ndr_basic.c -@@ -31,6 +31,19 @@ - #define NDR_SIVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVAL(ndr->data,ofs,v); } else SIVAL(ndr->data,ofs,v); } while (0) - #define NDR_SIVALS(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVALS(ndr->data,ofs,v); } else SIVALS(ndr->data,ofs,v); } while (0) - -+#undef ndr_print_bool -+#undef ndr_print_struct -+#undef ndr_print_null -+#undef ndr_print_enum -+#undef ndr_print_bitmap_flag -+#undef ndr_print_ptr -+#undef ndr_print_union -+#undef ndr_print_bad_level -+#undef ndr_print_array_uint8 -+#undef ndr_print_string_array -+#undef ndr_print_string_array -+#undef ndr_print_NTSTATUS -+#undef ndr_print_WERROR - - /* - check for data leaks from the server by looking for non-zero pad bytes ---- a/librpc/ndr/ndr_string.c -+++ b/librpc/ndr/ndr_string.c -@@ -588,6 +588,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_stri - return NDR_ERR_SUCCESS; - } - -+#undef ndr_print_string_array - _PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a) - { - uint32_t count; ---- a/librpc/rpc/dcerpc_error.c -+++ b/librpc/rpc/dcerpc_error.c -@@ -31,6 +31,7 @@ struct dcerpc_fault_table { - static const struct dcerpc_fault_table dcerpc_faults[] = - { - #define _FAULT_STR(x) { #x , x } -+#ifdef VERBOSE_ERROR - _FAULT_STR(DCERPC_NCA_S_COMM_FAILURE), - _FAULT_STR(DCERPC_NCA_S_OP_RNG_ERROR), - _FAULT_STR(DCERPC_NCA_S_UNKNOWN_IF), -@@ -78,6 +79,7 @@ static const struct dcerpc_fault_table d - _FAULT_STR(DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR), - _FAULT_STR(DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND), - _FAULT_STR(DCERPC_NCA_S_FAULT_NO_CLIENT_STUB), -+#endif - { NULL, 0 } - #undef _FAULT_STR - }; -@@ -87,12 +89,14 @@ _PUBLIC_ const char *dcerpc_errstr(TALLO - int idx = 0; - WERROR werr = W_ERROR(fault_code); - -+#ifdef VERBOSE_ERROR - while (dcerpc_faults[idx].errstr != NULL) { - if (dcerpc_faults[idx].faultcode == fault_code) { - return dcerpc_faults[idx].errstr; - } - idx++; - } -+#endif - - return win_errstr(werr); - } ---- a/source3/libsmb/nterr.c -+++ b/source3/libsmb/nterr.c -@@ -702,6 +702,7 @@ const char *nt_errstr(NTSTATUS nt_code) - NT_STATUS_DOS_CODE(nt_code)); - } - -+#ifdef VERBOSE_ERROR - while (nt_errs[idx].nt_errstr != NULL) { - if (NT_STATUS_V(nt_errs[idx].nt_errcode) == - NT_STATUS_V(nt_code)) { -@@ -709,6 +710,7 @@ const char *nt_errstr(NTSTATUS nt_code) - } - idx++; - } -+#endif - - result = talloc_asprintf(talloc_tos(), "NT code 0x%08x", - NT_STATUS_V(nt_code)); -@@ -724,12 +726,14 @@ const char *get_friendly_nt_error_msg(NT - { - int idx = 0; - -+#ifdef VERBOSE_ERROR - while (nt_err_desc[idx].nt_errstr != NULL) { - if (NT_STATUS_V(nt_err_desc[idx].nt_errcode) == NT_STATUS_V(nt_code)) { - return nt_err_desc[idx].nt_errstr; - } - idx++; - } -+#endif - - /* fall back to NT_STATUS_XXX string */ - -@@ -745,6 +749,7 @@ const char *get_nt_error_c_code(NTSTATUS - char *result; - int idx = 0; - -+#ifdef VERBOSE_ERROR - while (nt_errs[idx].nt_errstr != NULL) { - if (NT_STATUS_V(nt_errs[idx].nt_errcode) == - NT_STATUS_V(nt_code)) { -@@ -752,6 +757,7 @@ const char *get_nt_error_c_code(NTSTATUS - } - idx++; - } -+#endif - - result = talloc_asprintf(talloc_tos(), "NT_STATUS(0x%08x)", - NT_STATUS_V(nt_code)); -@@ -767,12 +773,14 @@ NTSTATUS nt_status_string_to_code(const - { - int idx = 0; - -+#ifdef VERBOSE_ERROR - while (nt_errs[idx].nt_errstr != NULL) { - if (strcasecmp(nt_errs[idx].nt_errstr, nt_status_str) == 0) { - return nt_errs[idx].nt_errcode; - } - idx++; - } -+#endif - return NT_STATUS_UNSUCCESSFUL; - } - ---- a/lib/tdb/common/tdb_private.h -+++ b/lib/tdb/common/tdb_private.h -@@ -69,7 +69,11 @@ typedef uint32_t tdb_off_t; - /* NB assumes there is a local variable called "tdb" that is the - * current context, also takes doubly-parenthesized print-style - * argument. */ -+#ifdef VERBOSE_DEBUG - #define TDB_LOG(x) tdb->log.log_fn x -+#else -+#define TDB_LOG(x) do {} while(0) -+#endif - - #ifdef TDB_TRACE - void tdb_trace(struct tdb_context *tdb, const char *op); ---- a/source3/script/mkbuildoptions.awk -+++ b/source3/script/mkbuildoptions.awk -@@ -55,7 +55,7 @@ BEGIN { - print "****************************************************************************/"; - print "void build_options(bool screen)"; - print "{"; -- print " if ((DEBUGLEVEL < 4) && (!screen)) {"; -+ print " if ((DEBUGLEVEL < 4) || (!screen)) {"; - print " return;"; - print " }"; - print ""; ---- a/source3/script/mkbuildoptions-waf.awk -+++ b/source3/script/mkbuildoptions-waf.awk -@@ -55,7 +55,7 @@ BEGIN { - print "****************************************************************************/"; - print "void build_options(bool screen)"; - print "{"; -- print " if ((DEBUGLEVEL < 4) && (!screen)) {"; -+ print " if ((DEBUGLEVEL < 4) || (!screen)) {"; - print " return;"; - print " }"; - print ""; diff --git a/packages/network/samba/patches/samba-320-debug_level_checks.patch b/packages/network/samba/patches/samba-320-debug_level_checks.patch deleted file mode 100644 index c6f2e6e0d9..0000000000 --- a/packages/network/samba/patches/samba-320-debug_level_checks.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/lib/util/debug.h -+++ b/lib/util/debug.h -@@ -45,7 +45,7 @@ bool dbghdr( int level, const char *loca - * Redefine DEBUGLEVEL because so we don't have to change every source file - * that *unnecessarily* references it. - */ --#define DEBUGLEVEL DEBUGLEVEL_CLASS[DBGC_ALL] -+#define DEBUGLEVEL 0 - - /* - * Define all new debug classes here. A class is represented by an entry in ---- a/source3/nmbd/asyncdns.c -+++ b/source3/nmbd/asyncdns.c -@@ -85,7 +85,7 @@ static void asyncdns_process(void) - struct query_record r; - unstring qname; - -- DEBUGLEVEL = -1; -+ DEBUGLEVEL_CLASS[DBGC_ALL] = -1; - - while (1) { - NTSTATUS status; diff --git a/packages/network/samba/patches/samba-330-librpc_default_print.patch b/packages/network/samba/patches/samba-330-librpc_default_print.patch deleted file mode 100644 index f17b1e2396..0000000000 --- a/packages/network/samba/patches/samba-330-librpc_default_print.patch +++ /dev/null @@ -1,8854 +0,0 @@ ---- a/source3/librpc/ndr/util.c -+++ b/source3/librpc/ndr/util.c -@@ -28,3 +28,7 @@ _PUBLIC_ void ndr_print_sockaddr_storage - char addr[INET6_ADDRSTRLEN]; - ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss)); - } -+ -+_PUBLIC_ void ndr_print_disabled(struct ndr_print *ndr, const char *name, int flags, void *r) -+{ -+} ---- a/source3/librpc/gen_ndr/ndr_atsvc.c -+++ b/source3/librpc/gen_ndr/ndr_atsvc.c -@@ -867,7 +867,7 @@ static const struct ndr_interface_call a - sizeof(struct atsvc_JobAdd), - (ndr_push_flags_fn_t) ndr_push_atsvc_JobAdd, - (ndr_pull_flags_fn_t) ndr_pull_atsvc_JobAdd, -- (ndr_print_function_t) ndr_print_atsvc_JobAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -876,7 +876,7 @@ static const struct ndr_interface_call a - sizeof(struct atsvc_JobDel), - (ndr_push_flags_fn_t) ndr_push_atsvc_JobDel, - (ndr_pull_flags_fn_t) ndr_pull_atsvc_JobDel, -- (ndr_print_function_t) ndr_print_atsvc_JobDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -885,7 +885,7 @@ static const struct ndr_interface_call a - sizeof(struct atsvc_JobEnum), - (ndr_push_flags_fn_t) ndr_push_atsvc_JobEnum, - (ndr_pull_flags_fn_t) ndr_pull_atsvc_JobEnum, -- (ndr_print_function_t) ndr_print_atsvc_JobEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -894,7 +894,7 @@ static const struct ndr_interface_call a - sizeof(struct atsvc_JobGetInfo), - (ndr_push_flags_fn_t) ndr_push_atsvc_JobGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_atsvc_JobGetInfo, -- (ndr_print_function_t) ndr_print_atsvc_JobGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_audiosrv.c -+++ b/source3/librpc/gen_ndr/ndr_audiosrv.c -@@ -594,7 +594,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_CreatezoneFactoriesList), - (ndr_push_flags_fn_t) ndr_push_audiosrv_CreatezoneFactoriesList, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_CreatezoneFactoriesList, -- (ndr_print_function_t) ndr_print_audiosrv_CreatezoneFactoriesList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -603,7 +603,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_CreateGfxFactoriesList), - (ndr_push_flags_fn_t) ndr_push_audiosrv_CreateGfxFactoriesList, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_CreateGfxFactoriesList, -- (ndr_print_function_t) ndr_print_audiosrv_CreateGfxFactoriesList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -612,7 +612,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_CreateGfxList), - (ndr_push_flags_fn_t) ndr_push_audiosrv_CreateGfxList, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_CreateGfxList, -- (ndr_print_function_t) ndr_print_audiosrv_CreateGfxList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -621,7 +621,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_RemoveGfx), - (ndr_push_flags_fn_t) ndr_push_audiosrv_RemoveGfx, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_RemoveGfx, -- (ndr_print_function_t) ndr_print_audiosrv_RemoveGfx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -630,7 +630,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_AddGfx), - (ndr_push_flags_fn_t) ndr_push_audiosrv_AddGfx, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_AddGfx, -- (ndr_print_function_t) ndr_print_audiosrv_AddGfx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -639,7 +639,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_ModifyGfx), - (ndr_push_flags_fn_t) ndr_push_audiosrv_ModifyGfx, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_ModifyGfx, -- (ndr_print_function_t) ndr_print_audiosrv_ModifyGfx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -648,7 +648,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_OpenGfx), - (ndr_push_flags_fn_t) ndr_push_audiosrv_OpenGfx, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_OpenGfx, -- (ndr_print_function_t) ndr_print_audiosrv_OpenGfx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -657,7 +657,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_Logon), - (ndr_push_flags_fn_t) ndr_push_audiosrv_Logon, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_Logon, -- (ndr_print_function_t) ndr_print_audiosrv_Logon, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -666,7 +666,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_Logoff), - (ndr_push_flags_fn_t) ndr_push_audiosrv_Logoff, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_Logoff, -- (ndr_print_function_t) ndr_print_audiosrv_Logoff, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -675,7 +675,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_RegisterSessionNotificationEvent), - (ndr_push_flags_fn_t) ndr_push_audiosrv_RegisterSessionNotificationEvent, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_RegisterSessionNotificationEvent, -- (ndr_print_function_t) ndr_print_audiosrv_RegisterSessionNotificationEvent, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -684,7 +684,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_UnregisterSessionNotificationEvent), - (ndr_push_flags_fn_t) ndr_push_audiosrv_UnregisterSessionNotificationEvent, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_UnregisterSessionNotificationEvent, -- (ndr_print_function_t) ndr_print_audiosrv_UnregisterSessionNotificationEvent, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -693,7 +693,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_SessionConnectState), - (ndr_push_flags_fn_t) ndr_push_audiosrv_SessionConnectState, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_SessionConnectState, -- (ndr_print_function_t) ndr_print_audiosrv_SessionConnectState, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -702,7 +702,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_DriverOpenDrvRegKey), - (ndr_push_flags_fn_t) ndr_push_audiosrv_DriverOpenDrvRegKey, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_DriverOpenDrvRegKey, -- (ndr_print_function_t) ndr_print_audiosrv_DriverOpenDrvRegKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -711,7 +711,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_AdvisePreferredDeviceChange), - (ndr_push_flags_fn_t) ndr_push_audiosrv_AdvisePreferredDeviceChange, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_AdvisePreferredDeviceChange, -- (ndr_print_function_t) ndr_print_audiosrv_AdvisePreferredDeviceChange, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -720,7 +720,7 @@ static const struct ndr_interface_call a - sizeof(struct audiosrv_GetPnpInfo), - (ndr_push_flags_fn_t) ndr_push_audiosrv_GetPnpInfo, - (ndr_pull_flags_fn_t) ndr_pull_audiosrv_GetPnpInfo, -- (ndr_print_function_t) ndr_print_audiosrv_GetPnpInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_backupkey.c -+++ b/source3/librpc/gen_ndr/ndr_backupkey.c -@@ -740,7 +740,7 @@ static const struct ndr_interface_call b - sizeof(struct bkrp_BackupKey), - (ndr_push_flags_fn_t) ndr_push_bkrp_BackupKey, - (ndr_pull_flags_fn_t) ndr_pull_bkrp_BackupKey, -- (ndr_print_function_t) ndr_print_bkrp_BackupKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_browser.c -+++ b/source3/librpc/gen_ndr/ndr_browser.c -@@ -928,7 +928,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrServerEnum), - (ndr_push_flags_fn_t) ndr_push_BrowserrServerEnum, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrServerEnum, -- (ndr_print_function_t) ndr_print_BrowserrServerEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -937,7 +937,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrDebugCall), - (ndr_push_flags_fn_t) ndr_push_BrowserrDebugCall, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrDebugCall, -- (ndr_print_function_t) ndr_print_BrowserrDebugCall, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -946,7 +946,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrQueryOtherDomains), - (ndr_push_flags_fn_t) ndr_push_BrowserrQueryOtherDomains, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrQueryOtherDomains, -- (ndr_print_function_t) ndr_print_BrowserrQueryOtherDomains, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -955,7 +955,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrResetNetlogonState), - (ndr_push_flags_fn_t) ndr_push_BrowserrResetNetlogonState, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrResetNetlogonState, -- (ndr_print_function_t) ndr_print_BrowserrResetNetlogonState, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -964,7 +964,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrDebugTrace), - (ndr_push_flags_fn_t) ndr_push_BrowserrDebugTrace, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrDebugTrace, -- (ndr_print_function_t) ndr_print_BrowserrDebugTrace, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -973,7 +973,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrQueryStatistics), - (ndr_push_flags_fn_t) ndr_push_BrowserrQueryStatistics, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrQueryStatistics, -- (ndr_print_function_t) ndr_print_BrowserrQueryStatistics, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -982,7 +982,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserResetStatistics), - (ndr_push_flags_fn_t) ndr_push_BrowserResetStatistics, - (ndr_pull_flags_fn_t) ndr_pull_BrowserResetStatistics, -- (ndr_print_function_t) ndr_print_BrowserResetStatistics, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -991,7 +991,7 @@ static const struct ndr_interface_call b - sizeof(struct NetrBrowserStatisticsClear), - (ndr_push_flags_fn_t) ndr_push_NetrBrowserStatisticsClear, - (ndr_pull_flags_fn_t) ndr_pull_NetrBrowserStatisticsClear, -- (ndr_print_function_t) ndr_print_NetrBrowserStatisticsClear, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1000,7 +1000,7 @@ static const struct ndr_interface_call b - sizeof(struct NetrBrowserStatisticsGet), - (ndr_push_flags_fn_t) ndr_push_NetrBrowserStatisticsGet, - (ndr_pull_flags_fn_t) ndr_pull_NetrBrowserStatisticsGet, -- (ndr_print_function_t) ndr_print_NetrBrowserStatisticsGet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1009,7 +1009,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrSetNetlogonState), - (ndr_push_flags_fn_t) ndr_push_BrowserrSetNetlogonState, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrSetNetlogonState, -- (ndr_print_function_t) ndr_print_BrowserrSetNetlogonState, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1018,7 +1018,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrQueryEmulatedDomains), - (ndr_push_flags_fn_t) ndr_push_BrowserrQueryEmulatedDomains, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrQueryEmulatedDomains, -- (ndr_print_function_t) ndr_print_BrowserrQueryEmulatedDomains, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1027,7 +1027,7 @@ static const struct ndr_interface_call b - sizeof(struct BrowserrServerEnumEx), - (ndr_push_flags_fn_t) ndr_push_BrowserrServerEnumEx, - (ndr_pull_flags_fn_t) ndr_pull_BrowserrServerEnumEx, -- (ndr_print_function_t) ndr_print_BrowserrServerEnumEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dbgidl.c -+++ b/source3/librpc/gen_ndr/ndr_dbgidl.c -@@ -48,7 +48,7 @@ static const struct ndr_interface_call d - sizeof(struct dummy_dbgidl), - (ndr_push_flags_fn_t) ndr_push_dummy_dbgidl, - (ndr_pull_flags_fn_t) ndr_pull_dummy_dbgidl, -- (ndr_print_function_t) ndr_print_dummy_dbgidl, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dcom.c -+++ b/source3/librpc/gen_ndr/ndr_dcom.c -@@ -128,7 +128,7 @@ static const struct ndr_interface_call d - sizeof(struct UseProtSeq), - (ndr_push_flags_fn_t) ndr_push_UseProtSeq, - (ndr_pull_flags_fn_t) ndr_pull_UseProtSeq, -- (ndr_print_function_t) ndr_print_UseProtSeq, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -137,7 +137,7 @@ static const struct ndr_interface_call d - sizeof(struct GetCustomProtseqInfo), - (ndr_push_flags_fn_t) ndr_push_GetCustomProtseqInfo, - (ndr_pull_flags_fn_t) ndr_pull_GetCustomProtseqInfo, -- (ndr_print_function_t) ndr_print_GetCustomProtseqInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -146,7 +146,7 @@ static const struct ndr_interface_call d - sizeof(struct UpdateResolverBindings), - (ndr_push_flags_fn_t) ndr_push_UpdateResolverBindings, - (ndr_pull_flags_fn_t) ndr_pull_UpdateResolverBindings, -- (ndr_print_function_t) ndr_print_UpdateResolverBindings, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -450,7 +450,7 @@ static const struct ndr_interface_call I - sizeof(struct QueryInterface), - (ndr_push_flags_fn_t) ndr_push_QueryInterface, - (ndr_pull_flags_fn_t) ndr_pull_QueryInterface, -- (ndr_print_function_t) ndr_print_QueryInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -459,7 +459,7 @@ static const struct ndr_interface_call I - sizeof(struct AddRef), - (ndr_push_flags_fn_t) ndr_push_AddRef, - (ndr_pull_flags_fn_t) ndr_pull_AddRef, -- (ndr_print_function_t) ndr_print_AddRef, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -468,7 +468,7 @@ static const struct ndr_interface_call I - sizeof(struct Release), - (ndr_push_flags_fn_t) ndr_push_Release, - (ndr_pull_flags_fn_t) ndr_pull_Release, -- (ndr_print_function_t) ndr_print_Release, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -849,7 +849,7 @@ static const struct ndr_interface_call I - sizeof(struct CreateInstance), - (ndr_push_flags_fn_t) ndr_push_CreateInstance, - (ndr_pull_flags_fn_t) ndr_pull_CreateInstance, -- (ndr_print_function_t) ndr_print_CreateInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -858,7 +858,7 @@ static const struct ndr_interface_call I - sizeof(struct RemoteCreateInstance), - (ndr_push_flags_fn_t) ndr_push_RemoteCreateInstance, - (ndr_pull_flags_fn_t) ndr_pull_RemoteCreateInstance, -- (ndr_print_function_t) ndr_print_RemoteCreateInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -867,7 +867,7 @@ static const struct ndr_interface_call I - sizeof(struct LockServer), - (ndr_push_flags_fn_t) ndr_push_LockServer, - (ndr_pull_flags_fn_t) ndr_pull_LockServer, -- (ndr_print_function_t) ndr_print_LockServer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -876,7 +876,7 @@ static const struct ndr_interface_call I - sizeof(struct RemoteLockServer), - (ndr_push_flags_fn_t) ndr_push_RemoteLockServer, - (ndr_pull_flags_fn_t) ndr_pull_RemoteLockServer, -- (ndr_print_function_t) ndr_print_RemoteLockServer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1434,7 +1434,7 @@ static const struct ndr_interface_call I - sizeof(struct RemQueryInterface), - (ndr_push_flags_fn_t) ndr_push_RemQueryInterface, - (ndr_pull_flags_fn_t) ndr_pull_RemQueryInterface, -- (ndr_print_function_t) ndr_print_RemQueryInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1443,7 +1443,7 @@ static const struct ndr_interface_call I - sizeof(struct RemAddRef), - (ndr_push_flags_fn_t) ndr_push_RemAddRef, - (ndr_pull_flags_fn_t) ndr_pull_RemAddRef, -- (ndr_print_function_t) ndr_print_RemAddRef, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1452,7 +1452,7 @@ static const struct ndr_interface_call I - sizeof(struct RemRelease), - (ndr_push_flags_fn_t) ndr_push_RemRelease, - (ndr_pull_flags_fn_t) ndr_pull_RemRelease, -- (ndr_print_function_t) ndr_print_RemRelease, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1590,7 +1590,7 @@ static const struct ndr_interface_call I - sizeof(struct GetClassObject), - (ndr_push_flags_fn_t) ndr_push_GetClassObject, - (ndr_pull_flags_fn_t) ndr_pull_GetClassObject, -- (ndr_print_function_t) ndr_print_GetClassObject, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1701,7 +1701,7 @@ static const struct ndr_interface_call I - sizeof(struct ISCMLocalActivator_CreateInstance), - (ndr_push_flags_fn_t) ndr_push_ISCMLocalActivator_CreateInstance, - (ndr_pull_flags_fn_t) ndr_pull_ISCMLocalActivator_CreateInstance, -- (ndr_print_function_t) ndr_print_ISCMLocalActivator_CreateInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1788,7 +1788,7 @@ static const struct ndr_interface_call I - sizeof(struct IMachineLocalActivator_foo), - (ndr_push_flags_fn_t) ndr_push_IMachineLocalActivator_foo, - (ndr_pull_flags_fn_t) ndr_pull_IMachineLocalActivator_foo, -- (ndr_print_function_t) ndr_print_IMachineLocalActivator_foo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1875,7 +1875,7 @@ static const struct ndr_interface_call I - sizeof(struct ILocalObjectExporter_Foo), - (ndr_push_flags_fn_t) ndr_push_ILocalObjectExporter_Foo, - (ndr_pull_flags_fn_t) ndr_pull_ILocalObjectExporter_Foo, -- (ndr_print_function_t) ndr_print_ILocalObjectExporter_Foo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2031,7 +2031,7 @@ static const struct ndr_interface_call I - sizeof(struct ISystemActivatorRemoteCreateInstance), - (ndr_push_flags_fn_t) ndr_push_ISystemActivatorRemoteCreateInstance, - (ndr_pull_flags_fn_t) ndr_pull_ISystemActivatorRemoteCreateInstance, -- (ndr_print_function_t) ndr_print_ISystemActivatorRemoteCreateInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2319,7 +2319,7 @@ static const struct ndr_interface_call I - sizeof(struct RemQueryInterface2), - (ndr_push_flags_fn_t) ndr_push_RemQueryInterface2, - (ndr_pull_flags_fn_t) ndr_pull_RemQueryInterface2, -- (ndr_print_function_t) ndr_print_RemQueryInterface2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3040,7 +3040,7 @@ static const struct ndr_interface_call I - sizeof(struct GetTypeInfoCount), - (ndr_push_flags_fn_t) ndr_push_GetTypeInfoCount, - (ndr_pull_flags_fn_t) ndr_pull_GetTypeInfoCount, -- (ndr_print_function_t) ndr_print_GetTypeInfoCount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3049,7 +3049,7 @@ static const struct ndr_interface_call I - sizeof(struct GetTypeInfo), - (ndr_push_flags_fn_t) ndr_push_GetTypeInfo, - (ndr_pull_flags_fn_t) ndr_pull_GetTypeInfo, -- (ndr_print_function_t) ndr_print_GetTypeInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3058,7 +3058,7 @@ static const struct ndr_interface_call I - sizeof(struct GetIDsOfNames), - (ndr_push_flags_fn_t) ndr_push_GetIDsOfNames, - (ndr_pull_flags_fn_t) ndr_pull_GetIDsOfNames, -- (ndr_print_function_t) ndr_print_GetIDsOfNames, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3067,7 +3067,7 @@ static const struct ndr_interface_call I - sizeof(struct Invoke), - (ndr_push_flags_fn_t) ndr_push_Invoke, - (ndr_pull_flags_fn_t) ndr_pull_Invoke, -- (ndr_print_function_t) ndr_print_Invoke, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3243,7 +3243,7 @@ static const struct ndr_interface_call I - sizeof(struct MarshalInterface), - (ndr_push_flags_fn_t) ndr_push_MarshalInterface, - (ndr_pull_flags_fn_t) ndr_pull_MarshalInterface, -- (ndr_print_function_t) ndr_print_MarshalInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3252,7 +3252,7 @@ static const struct ndr_interface_call I - sizeof(struct UnMarshalInterface), - (ndr_push_flags_fn_t) ndr_push_UnMarshalInterface, - (ndr_pull_flags_fn_t) ndr_pull_UnMarshalInterface, -- (ndr_print_function_t) ndr_print_UnMarshalInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3385,7 +3385,7 @@ static const struct ndr_interface_call I - sizeof(struct MakeCoffee), - (ndr_push_flags_fn_t) ndr_push_MakeCoffee, - (ndr_pull_flags_fn_t) ndr_pull_MakeCoffee, -- (ndr_print_function_t) ndr_print_MakeCoffee, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3681,7 +3681,7 @@ static const struct ndr_interface_call I - sizeof(struct Read), - (ndr_push_flags_fn_t) ndr_push_Read, - (ndr_pull_flags_fn_t) ndr_pull_Read, -- (ndr_print_function_t) ndr_print_Read, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3690,7 +3690,7 @@ static const struct ndr_interface_call I - sizeof(struct Write), - (ndr_push_flags_fn_t) ndr_push_Write, - (ndr_pull_flags_fn_t) ndr_pull_Write, -- (ndr_print_function_t) ndr_print_Write, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dfs.c -+++ b/source3/librpc/gen_ndr/ndr_dfs.c -@@ -5910,7 +5910,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_GetManagerVersion), - (ndr_push_flags_fn_t) ndr_push_dfs_GetManagerVersion, - (ndr_pull_flags_fn_t) ndr_pull_dfs_GetManagerVersion, -- (ndr_print_function_t) ndr_print_dfs_GetManagerVersion, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5919,7 +5919,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Add), - (ndr_push_flags_fn_t) ndr_push_dfs_Add, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Add, -- (ndr_print_function_t) ndr_print_dfs_Add, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5928,7 +5928,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Remove), - (ndr_push_flags_fn_t) ndr_push_dfs_Remove, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Remove, -- (ndr_print_function_t) ndr_print_dfs_Remove, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5937,7 +5937,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_SetInfo), - (ndr_push_flags_fn_t) ndr_push_dfs_SetInfo, - (ndr_pull_flags_fn_t) ndr_pull_dfs_SetInfo, -- (ndr_print_function_t) ndr_print_dfs_SetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5946,7 +5946,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_GetInfo), - (ndr_push_flags_fn_t) ndr_push_dfs_GetInfo, - (ndr_pull_flags_fn_t) ndr_pull_dfs_GetInfo, -- (ndr_print_function_t) ndr_print_dfs_GetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5955,7 +5955,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Enum), - (ndr_push_flags_fn_t) ndr_push_dfs_Enum, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Enum, -- (ndr_print_function_t) ndr_print_dfs_Enum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5964,7 +5964,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Rename), - (ndr_push_flags_fn_t) ndr_push_dfs_Rename, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Rename, -- (ndr_print_function_t) ndr_print_dfs_Rename, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5973,7 +5973,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Move), - (ndr_push_flags_fn_t) ndr_push_dfs_Move, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Move, -- (ndr_print_function_t) ndr_print_dfs_Move, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5982,7 +5982,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_ManagerGetConfigInfo), - (ndr_push_flags_fn_t) ndr_push_dfs_ManagerGetConfigInfo, - (ndr_pull_flags_fn_t) ndr_pull_dfs_ManagerGetConfigInfo, -- (ndr_print_function_t) ndr_print_dfs_ManagerGetConfigInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5991,7 +5991,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_ManagerSendSiteInfo), - (ndr_push_flags_fn_t) ndr_push_dfs_ManagerSendSiteInfo, - (ndr_pull_flags_fn_t) ndr_pull_dfs_ManagerSendSiteInfo, -- (ndr_print_function_t) ndr_print_dfs_ManagerSendSiteInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6000,7 +6000,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_AddFtRoot), - (ndr_push_flags_fn_t) ndr_push_dfs_AddFtRoot, - (ndr_pull_flags_fn_t) ndr_pull_dfs_AddFtRoot, -- (ndr_print_function_t) ndr_print_dfs_AddFtRoot, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6009,7 +6009,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_RemoveFtRoot), - (ndr_push_flags_fn_t) ndr_push_dfs_RemoveFtRoot, - (ndr_pull_flags_fn_t) ndr_pull_dfs_RemoveFtRoot, -- (ndr_print_function_t) ndr_print_dfs_RemoveFtRoot, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6018,7 +6018,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_AddStdRoot), - (ndr_push_flags_fn_t) ndr_push_dfs_AddStdRoot, - (ndr_pull_flags_fn_t) ndr_pull_dfs_AddStdRoot, -- (ndr_print_function_t) ndr_print_dfs_AddStdRoot, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6027,7 +6027,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_RemoveStdRoot), - (ndr_push_flags_fn_t) ndr_push_dfs_RemoveStdRoot, - (ndr_pull_flags_fn_t) ndr_pull_dfs_RemoveStdRoot, -- (ndr_print_function_t) ndr_print_dfs_RemoveStdRoot, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6036,7 +6036,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_ManagerInitialize), - (ndr_push_flags_fn_t) ndr_push_dfs_ManagerInitialize, - (ndr_pull_flags_fn_t) ndr_pull_dfs_ManagerInitialize, -- (ndr_print_function_t) ndr_print_dfs_ManagerInitialize, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6045,7 +6045,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_AddStdRootForced), - (ndr_push_flags_fn_t) ndr_push_dfs_AddStdRootForced, - (ndr_pull_flags_fn_t) ndr_pull_dfs_AddStdRootForced, -- (ndr_print_function_t) ndr_print_dfs_AddStdRootForced, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6054,7 +6054,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_GetDcAddress), - (ndr_push_flags_fn_t) ndr_push_dfs_GetDcAddress, - (ndr_pull_flags_fn_t) ndr_pull_dfs_GetDcAddress, -- (ndr_print_function_t) ndr_print_dfs_GetDcAddress, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6063,7 +6063,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_SetDcAddress), - (ndr_push_flags_fn_t) ndr_push_dfs_SetDcAddress, - (ndr_pull_flags_fn_t) ndr_pull_dfs_SetDcAddress, -- (ndr_print_function_t) ndr_print_dfs_SetDcAddress, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6072,7 +6072,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_FlushFtTable), - (ndr_push_flags_fn_t) ndr_push_dfs_FlushFtTable, - (ndr_pull_flags_fn_t) ndr_pull_dfs_FlushFtTable, -- (ndr_print_function_t) ndr_print_dfs_FlushFtTable, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6081,7 +6081,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Add2), - (ndr_push_flags_fn_t) ndr_push_dfs_Add2, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Add2, -- (ndr_print_function_t) ndr_print_dfs_Add2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6090,7 +6090,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_Remove2), - (ndr_push_flags_fn_t) ndr_push_dfs_Remove2, - (ndr_pull_flags_fn_t) ndr_pull_dfs_Remove2, -- (ndr_print_function_t) ndr_print_dfs_Remove2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6099,7 +6099,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_EnumEx), - (ndr_push_flags_fn_t) ndr_push_dfs_EnumEx, - (ndr_pull_flags_fn_t) ndr_pull_dfs_EnumEx, -- (ndr_print_function_t) ndr_print_dfs_EnumEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6108,7 +6108,7 @@ static const struct ndr_interface_call n - sizeof(struct dfs_SetInfo2), - (ndr_push_flags_fn_t) ndr_push_dfs_SetInfo2, - (ndr_pull_flags_fn_t) ndr_pull_dfs_SetInfo2, -- (ndr_print_function_t) ndr_print_dfs_SetInfo2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dfsblobs.c -+++ b/source3/librpc/gen_ndr/ndr_dfsblobs.c -@@ -1398,7 +1398,7 @@ static const struct ndr_interface_call d - sizeof(struct dfs_GetDFSReferral), - (ndr_push_flags_fn_t) ndr_push_dfs_GetDFSReferral, - (ndr_pull_flags_fn_t) ndr_pull_dfs_GetDFSReferral, -- (ndr_print_function_t) ndr_print_dfs_GetDFSReferral, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dns.c -+++ b/source3/librpc/gen_ndr/ndr_dns.c -@@ -860,7 +860,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_dns_name_packet), - (ndr_push_flags_fn_t) ndr_push_decode_dns_name_packet, - (ndr_pull_flags_fn_t) ndr_pull_decode_dns_name_packet, -- (ndr_print_function_t) ndr_print_decode_dns_name_packet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dnsp.c -+++ b/source3/librpc/gen_ndr/ndr_dnsp.c -@@ -700,7 +700,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_DnssrvRpcRecord), - (ndr_push_flags_fn_t) ndr_push_decode_DnssrvRpcRecord, - (ndr_pull_flags_fn_t) ndr_pull_decode_DnssrvRpcRecord, -- (ndr_print_function_t) ndr_print_decode_DnssrvRpcRecord, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dnsserver.c -+++ b/source3/librpc/gen_ndr/ndr_dnsserver.c -@@ -48,7 +48,7 @@ static const struct ndr_interface_call d - sizeof(struct dnsserver_foo), - (ndr_push_flags_fn_t) ndr_push_dnsserver_foo, - (ndr_pull_flags_fn_t) ndr_pull_dnsserver_foo, -- (ndr_print_function_t) ndr_print_dnsserver_foo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_drsblobs.c -+++ b/source3/librpc/gen_ndr/ndr_drsblobs.c -@@ -5275,7 +5275,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_replPropertyMetaData), - (ndr_push_flags_fn_t) ndr_push_decode_replPropertyMetaData, - (ndr_pull_flags_fn_t) ndr_pull_decode_replPropertyMetaData, -- (ndr_print_function_t) ndr_print_decode_replPropertyMetaData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5284,7 +5284,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_replUpToDateVector), - (ndr_push_flags_fn_t) ndr_push_decode_replUpToDateVector, - (ndr_pull_flags_fn_t) ndr_pull_decode_replUpToDateVector, -- (ndr_print_function_t) ndr_print_decode_replUpToDateVector, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5293,7 +5293,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_repsFromTo), - (ndr_push_flags_fn_t) ndr_push_decode_repsFromTo, - (ndr_pull_flags_fn_t) ndr_pull_decode_repsFromTo, -- (ndr_print_function_t) ndr_print_decode_repsFromTo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5302,7 +5302,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_partialAttributeSet), - (ndr_push_flags_fn_t) ndr_push_decode_partialAttributeSet, - (ndr_pull_flags_fn_t) ndr_pull_decode_partialAttributeSet, -- (ndr_print_function_t) ndr_print_decode_partialAttributeSet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5311,7 +5311,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_prefixMap), - (ndr_push_flags_fn_t) ndr_push_decode_prefixMap, - (ndr_pull_flags_fn_t) ndr_pull_decode_prefixMap, -- (ndr_print_function_t) ndr_print_decode_prefixMap, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5320,7 +5320,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_ldapControlDirSync), - (ndr_push_flags_fn_t) ndr_push_decode_ldapControlDirSync, - (ndr_pull_flags_fn_t) ndr_pull_decode_ldapControlDirSync, -- (ndr_print_function_t) ndr_print_decode_ldapControlDirSync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5329,7 +5329,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_supplementalCredentials), - (ndr_push_flags_fn_t) ndr_push_decode_supplementalCredentials, - (ndr_pull_flags_fn_t) ndr_pull_decode_supplementalCredentials, -- (ndr_print_function_t) ndr_print_decode_supplementalCredentials, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5338,7 +5338,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_Packages), - (ndr_push_flags_fn_t) ndr_push_decode_Packages, - (ndr_pull_flags_fn_t) ndr_pull_decode_Packages, -- (ndr_print_function_t) ndr_print_decode_Packages, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5347,7 +5347,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_PrimaryKerberos), - (ndr_push_flags_fn_t) ndr_push_decode_PrimaryKerberos, - (ndr_pull_flags_fn_t) ndr_pull_decode_PrimaryKerberos, -- (ndr_print_function_t) ndr_print_decode_PrimaryKerberos, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5356,7 +5356,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_PrimaryCLEARTEXT), - (ndr_push_flags_fn_t) ndr_push_decode_PrimaryCLEARTEXT, - (ndr_pull_flags_fn_t) ndr_pull_decode_PrimaryCLEARTEXT, -- (ndr_print_function_t) ndr_print_decode_PrimaryCLEARTEXT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5365,7 +5365,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_PrimaryWDigest), - (ndr_push_flags_fn_t) ndr_push_decode_PrimaryWDigest, - (ndr_pull_flags_fn_t) ndr_pull_decode_PrimaryWDigest, -- (ndr_print_function_t) ndr_print_decode_PrimaryWDigest, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5374,7 +5374,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_trustAuthInOut), - (ndr_push_flags_fn_t) ndr_push_decode_trustAuthInOut, - (ndr_pull_flags_fn_t) ndr_pull_decode_trustAuthInOut, -- (ndr_print_function_t) ndr_print_decode_trustAuthInOut, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5383,7 +5383,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_trustDomainPasswords), - (ndr_push_flags_fn_t) ndr_push_decode_trustDomainPasswords, - (ndr_pull_flags_fn_t) ndr_pull_decode_trustDomainPasswords, -- (ndr_print_function_t) ndr_print_decode_trustDomainPasswords, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5392,7 +5392,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_ExtendedErrorInfo), - (ndr_push_flags_fn_t) ndr_push_decode_ExtendedErrorInfo, - (ndr_pull_flags_fn_t) ndr_pull_decode_ExtendedErrorInfo, -- (ndr_print_function_t) ndr_print_decode_ExtendedErrorInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5401,7 +5401,7 @@ static const struct ndr_interface_call d - sizeof(struct decode_ForestTrustInfo), - (ndr_push_flags_fn_t) ndr_push_decode_ForestTrustInfo, - (ndr_pull_flags_fn_t) ndr_pull_decode_ForestTrustInfo, -- (ndr_print_function_t) ndr_print_decode_ForestTrustInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_drsuapi.c -+++ b/source3/librpc/gen_ndr/ndr_drsuapi.c -@@ -16500,7 +16500,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsBind), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsBind, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsBind, -- (ndr_print_function_t) ndr_print_drsuapi_DsBind, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16509,7 +16509,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsUnbind), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsUnbind, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsUnbind, -- (ndr_print_function_t) ndr_print_drsuapi_DsUnbind, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16518,7 +16518,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsReplicaSync), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsReplicaSync, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsReplicaSync, -- (ndr_print_function_t) ndr_print_drsuapi_DsReplicaSync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16527,7 +16527,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsGetNCChanges), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsGetNCChanges, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsGetNCChanges, -- (ndr_print_function_t) ndr_print_drsuapi_DsGetNCChanges, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16536,7 +16536,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsReplicaUpdateRefs), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsReplicaUpdateRefs, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsReplicaUpdateRefs, -- (ndr_print_function_t) ndr_print_drsuapi_DsReplicaUpdateRefs, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16545,7 +16545,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsReplicaAdd), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsReplicaAdd, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsReplicaAdd, -- (ndr_print_function_t) ndr_print_drsuapi_DsReplicaAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16554,7 +16554,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsReplicaDel), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsReplicaDel, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsReplicaDel, -- (ndr_print_function_t) ndr_print_drsuapi_DsReplicaDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16563,7 +16563,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsReplicaMod), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsReplicaMod, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsReplicaMod, -- (ndr_print_function_t) ndr_print_drsuapi_DsReplicaMod, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16572,7 +16572,7 @@ static const struct ndr_interface_call d - sizeof(struct DRSUAPI_VERIFY_NAMES), - (ndr_push_flags_fn_t) ndr_push_DRSUAPI_VERIFY_NAMES, - (ndr_pull_flags_fn_t) ndr_pull_DRSUAPI_VERIFY_NAMES, -- (ndr_print_function_t) ndr_print_DRSUAPI_VERIFY_NAMES, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16581,7 +16581,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsGetMemberships), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsGetMemberships, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsGetMemberships, -- (ndr_print_function_t) ndr_print_drsuapi_DsGetMemberships, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16590,7 +16590,7 @@ static const struct ndr_interface_call d - sizeof(struct DRSUAPI_INTER_DOMAIN_MOVE), - (ndr_push_flags_fn_t) ndr_push_DRSUAPI_INTER_DOMAIN_MOVE, - (ndr_pull_flags_fn_t) ndr_pull_DRSUAPI_INTER_DOMAIN_MOVE, -- (ndr_print_function_t) ndr_print_DRSUAPI_INTER_DOMAIN_MOVE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16599,7 +16599,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsGetNT4ChangeLog), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsGetNT4ChangeLog, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsGetNT4ChangeLog, -- (ndr_print_function_t) ndr_print_drsuapi_DsGetNT4ChangeLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16608,7 +16608,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsCrackNames), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsCrackNames, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsCrackNames, -- (ndr_print_function_t) ndr_print_drsuapi_DsCrackNames, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16617,7 +16617,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsWriteAccountSpn), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsWriteAccountSpn, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsWriteAccountSpn, -- (ndr_print_function_t) ndr_print_drsuapi_DsWriteAccountSpn, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16626,7 +16626,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsRemoveDSServer), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsRemoveDSServer, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsRemoveDSServer, -- (ndr_print_function_t) ndr_print_drsuapi_DsRemoveDSServer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16635,7 +16635,7 @@ static const struct ndr_interface_call d - sizeof(struct DRSUAPI_REMOVE_DS_DOMAIN), - (ndr_push_flags_fn_t) ndr_push_DRSUAPI_REMOVE_DS_DOMAIN, - (ndr_pull_flags_fn_t) ndr_pull_DRSUAPI_REMOVE_DS_DOMAIN, -- (ndr_print_function_t) ndr_print_DRSUAPI_REMOVE_DS_DOMAIN, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16644,7 +16644,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsGetDomainControllerInfo), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsGetDomainControllerInfo, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsGetDomainControllerInfo, -- (ndr_print_function_t) ndr_print_drsuapi_DsGetDomainControllerInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16653,7 +16653,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsAddEntry), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsAddEntry, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsAddEntry, -- (ndr_print_function_t) ndr_print_drsuapi_DsAddEntry, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16662,7 +16662,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsExecuteKCC), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsExecuteKCC, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsExecuteKCC, -- (ndr_print_function_t) ndr_print_drsuapi_DsExecuteKCC, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16671,7 +16671,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsReplicaGetInfo), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsReplicaGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsReplicaGetInfo, -- (ndr_print_function_t) ndr_print_drsuapi_DsReplicaGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16680,7 +16680,7 @@ static const struct ndr_interface_call d - sizeof(struct DRSUAPI_ADD_SID_HISTORY), - (ndr_push_flags_fn_t) ndr_push_DRSUAPI_ADD_SID_HISTORY, - (ndr_pull_flags_fn_t) ndr_pull_DRSUAPI_ADD_SID_HISTORY, -- (ndr_print_function_t) ndr_print_DRSUAPI_ADD_SID_HISTORY, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16689,7 +16689,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_DsGetMemberships2), - (ndr_push_flags_fn_t) ndr_push_drsuapi_DsGetMemberships2, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_DsGetMemberships2, -- (ndr_print_function_t) ndr_print_drsuapi_DsGetMemberships2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16698,7 +16698,7 @@ static const struct ndr_interface_call d - sizeof(struct DRSUAPI_REPLICA_VERIFY_OBJECTS), - (ndr_push_flags_fn_t) ndr_push_DRSUAPI_REPLICA_VERIFY_OBJECTS, - (ndr_pull_flags_fn_t) ndr_pull_DRSUAPI_REPLICA_VERIFY_OBJECTS, -- (ndr_print_function_t) ndr_print_DRSUAPI_REPLICA_VERIFY_OBJECTS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16707,7 +16707,7 @@ static const struct ndr_interface_call d - sizeof(struct DRSUAPI_GET_OBJECT_EXISTENCE), - (ndr_push_flags_fn_t) ndr_push_DRSUAPI_GET_OBJECT_EXISTENCE, - (ndr_pull_flags_fn_t) ndr_pull_DRSUAPI_GET_OBJECT_EXISTENCE, -- (ndr_print_function_t) ndr_print_DRSUAPI_GET_OBJECT_EXISTENCE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -16716,7 +16716,7 @@ static const struct ndr_interface_call d - sizeof(struct drsuapi_QuerySitesByCost), - (ndr_push_flags_fn_t) ndr_push_drsuapi_QuerySitesByCost, - (ndr_pull_flags_fn_t) ndr_pull_drsuapi_QuerySitesByCost, -- (ndr_print_function_t) ndr_print_drsuapi_QuerySitesByCost, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dsbackup.c -+++ b/source3/librpc/gen_ndr/ndr_dsbackup.c -@@ -360,7 +360,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupPrepare), - (ndr_push_flags_fn_t) ndr_push_HrRBackupPrepare, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupPrepare, -- (ndr_print_function_t) ndr_print_HrRBackupPrepare, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -369,7 +369,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupEnd), - (ndr_push_flags_fn_t) ndr_push_HrRBackupEnd, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupEnd, -- (ndr_print_function_t) ndr_print_HrRBackupEnd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -378,7 +378,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupGetAttachmentInformation), - (ndr_push_flags_fn_t) ndr_push_HrRBackupGetAttachmentInformation, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupGetAttachmentInformation, -- (ndr_print_function_t) ndr_print_HrRBackupGetAttachmentInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -387,7 +387,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupOpenFile), - (ndr_push_flags_fn_t) ndr_push_HrRBackupOpenFile, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupOpenFile, -- (ndr_print_function_t) ndr_print_HrRBackupOpenFile, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -396,7 +396,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupRead), - (ndr_push_flags_fn_t) ndr_push_HrRBackupRead, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupRead, -- (ndr_print_function_t) ndr_print_HrRBackupRead, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -405,7 +405,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupClose), - (ndr_push_flags_fn_t) ndr_push_HrRBackupClose, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupClose, -- (ndr_print_function_t) ndr_print_HrRBackupClose, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -414,7 +414,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupGetBackupLogs), - (ndr_push_flags_fn_t) ndr_push_HrRBackupGetBackupLogs, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupGetBackupLogs, -- (ndr_print_function_t) ndr_print_HrRBackupGetBackupLogs, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -423,7 +423,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupTruncateLogs), - (ndr_push_flags_fn_t) ndr_push_HrRBackupTruncateLogs, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupTruncateLogs, -- (ndr_print_function_t) ndr_print_HrRBackupTruncateLogs, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -432,7 +432,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRBackupPing), - (ndr_push_flags_fn_t) ndr_push_HrRBackupPing, - (ndr_pull_flags_fn_t) ndr_pull_HrRBackupPing, -- (ndr_print_function_t) ndr_print_HrRBackupPing, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -789,7 +789,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRIsNTDSOnline), - (ndr_push_flags_fn_t) ndr_push_HrRIsNTDSOnline, - (ndr_pull_flags_fn_t) ndr_pull_HrRIsNTDSOnline, -- (ndr_print_function_t) ndr_print_HrRIsNTDSOnline, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -798,7 +798,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestorePrepare), - (ndr_push_flags_fn_t) ndr_push_HrRRestorePrepare, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestorePrepare, -- (ndr_print_function_t) ndr_print_HrRRestorePrepare, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -807,7 +807,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestoreRegister), - (ndr_push_flags_fn_t) ndr_push_HrRRestoreRegister, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestoreRegister, -- (ndr_print_function_t) ndr_print_HrRRestoreRegister, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -816,7 +816,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestoreRegisterComplete), - (ndr_push_flags_fn_t) ndr_push_HrRRestoreRegisterComplete, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestoreRegisterComplete, -- (ndr_print_function_t) ndr_print_HrRRestoreRegisterComplete, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -825,7 +825,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestoreGetDatabaseLocations), - (ndr_push_flags_fn_t) ndr_push_HrRRestoreGetDatabaseLocations, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestoreGetDatabaseLocations, -- (ndr_print_function_t) ndr_print_HrRRestoreGetDatabaseLocations, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -834,7 +834,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestoreEnd), - (ndr_push_flags_fn_t) ndr_push_HrRRestoreEnd, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestoreEnd, -- (ndr_print_function_t) ndr_print_HrRRestoreEnd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -843,7 +843,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestoreSetCurrentLogNumber), - (ndr_push_flags_fn_t) ndr_push_HrRRestoreSetCurrentLogNumber, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestoreSetCurrentLogNumber, -- (ndr_print_function_t) ndr_print_HrRRestoreSetCurrentLogNumber, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -852,7 +852,7 @@ static const struct ndr_interface_call a - sizeof(struct HrRRestoreCheckLogsForBackup), - (ndr_push_flags_fn_t) ndr_push_HrRRestoreCheckLogsForBackup, - (ndr_pull_flags_fn_t) ndr_pull_HrRRestoreCheckLogsForBackup, -- (ndr_print_function_t) ndr_print_HrRRestoreCheckLogsForBackup, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_dssetup.c -+++ b/source3/librpc/gen_ndr/ndr_dssetup.c -@@ -995,7 +995,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleGetPrimaryDomainInformation), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetPrimaryDomainInformation, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetPrimaryDomainInformation, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleGetPrimaryDomainInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1004,7 +1004,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleDnsNameToFlatName), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDnsNameToFlatName, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDnsNameToFlatName, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleDnsNameToFlatName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1013,7 +1013,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleDcAsDc), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDcAsDc, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDcAsDc, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleDcAsDc, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1022,7 +1022,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleDcAsReplica), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDcAsReplica, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDcAsReplica, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleDcAsReplica, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1031,7 +1031,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleDemoteDc), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleDemoteDc, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleDemoteDc, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleDemoteDc, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1040,7 +1040,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleGetDcOperationProgress), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetDcOperationProgress, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetDcOperationProgress, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleGetDcOperationProgress, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1049,7 +1049,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleGetDcOperationResults), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleGetDcOperationResults, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleGetDcOperationResults, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleGetDcOperationResults, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1058,7 +1058,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleCancel), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleCancel, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleCancel, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleCancel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1067,7 +1067,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleServerSaveStateForUpgrade), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleServerSaveStateForUpgrade, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleServerSaveStateForUpgrade, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleServerSaveStateForUpgrade, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1076,7 +1076,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleUpgradeDownlevelServer), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleUpgradeDownlevelServer, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleUpgradeDownlevelServer, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleUpgradeDownlevelServer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1085,7 +1085,7 @@ static const struct ndr_interface_call d - sizeof(struct dssetup_DsRoleAbortDownlevelServerUpgrade), - (ndr_push_flags_fn_t) ndr_push_dssetup_DsRoleAbortDownlevelServerUpgrade, - (ndr_pull_flags_fn_t) ndr_pull_dssetup_DsRoleAbortDownlevelServerUpgrade, -- (ndr_print_function_t) ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_echo.c -+++ b/source3/librpc/gen_ndr/ndr_echo.c -@@ -1458,7 +1458,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_AddOne), - (ndr_push_flags_fn_t) ndr_push_echo_AddOne, - (ndr_pull_flags_fn_t) ndr_pull_echo_AddOne, -- (ndr_print_function_t) ndr_print_echo_AddOne, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1467,7 +1467,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_EchoData), - (ndr_push_flags_fn_t) ndr_push_echo_EchoData, - (ndr_pull_flags_fn_t) ndr_pull_echo_EchoData, -- (ndr_print_function_t) ndr_print_echo_EchoData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1476,7 +1476,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_SinkData), - (ndr_push_flags_fn_t) ndr_push_echo_SinkData, - (ndr_pull_flags_fn_t) ndr_pull_echo_SinkData, -- (ndr_print_function_t) ndr_print_echo_SinkData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1485,7 +1485,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_SourceData), - (ndr_push_flags_fn_t) ndr_push_echo_SourceData, - (ndr_pull_flags_fn_t) ndr_pull_echo_SourceData, -- (ndr_print_function_t) ndr_print_echo_SourceData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1494,7 +1494,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_TestCall), - (ndr_push_flags_fn_t) ndr_push_echo_TestCall, - (ndr_pull_flags_fn_t) ndr_pull_echo_TestCall, -- (ndr_print_function_t) ndr_print_echo_TestCall, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1503,7 +1503,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_TestCall2), - (ndr_push_flags_fn_t) ndr_push_echo_TestCall2, - (ndr_pull_flags_fn_t) ndr_pull_echo_TestCall2, -- (ndr_print_function_t) ndr_print_echo_TestCall2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1512,7 +1512,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_TestSleep), - (ndr_push_flags_fn_t) ndr_push_echo_TestSleep, - (ndr_pull_flags_fn_t) ndr_pull_echo_TestSleep, -- (ndr_print_function_t) ndr_print_echo_TestSleep, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1521,7 +1521,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_TestEnum), - (ndr_push_flags_fn_t) ndr_push_echo_TestEnum, - (ndr_pull_flags_fn_t) ndr_pull_echo_TestEnum, -- (ndr_print_function_t) ndr_print_echo_TestEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1530,7 +1530,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_TestSurrounding), - (ndr_push_flags_fn_t) ndr_push_echo_TestSurrounding, - (ndr_pull_flags_fn_t) ndr_pull_echo_TestSurrounding, -- (ndr_print_function_t) ndr_print_echo_TestSurrounding, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1539,7 +1539,7 @@ static const struct ndr_interface_call r - sizeof(struct echo_TestDoublePointer), - (ndr_push_flags_fn_t) ndr_push_echo_TestDoublePointer, - (ndr_pull_flags_fn_t) ndr_pull_echo_TestDoublePointer, -- (ndr_print_function_t) ndr_print_echo_TestDoublePointer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_efs.c -+++ b/source3/librpc/gen_ndr/ndr_efs.c -@@ -1327,7 +1327,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcOpenFileRaw), - (ndr_push_flags_fn_t) ndr_push_EfsRpcOpenFileRaw, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcOpenFileRaw, -- (ndr_print_function_t) ndr_print_EfsRpcOpenFileRaw, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1336,7 +1336,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcReadFileRaw), - (ndr_push_flags_fn_t) ndr_push_EfsRpcReadFileRaw, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcReadFileRaw, -- (ndr_print_function_t) ndr_print_EfsRpcReadFileRaw, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1345,7 +1345,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcWriteFileRaw), - (ndr_push_flags_fn_t) ndr_push_EfsRpcWriteFileRaw, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcWriteFileRaw, -- (ndr_print_function_t) ndr_print_EfsRpcWriteFileRaw, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1354,7 +1354,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcCloseRaw), - (ndr_push_flags_fn_t) ndr_push_EfsRpcCloseRaw, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcCloseRaw, -- (ndr_print_function_t) ndr_print_EfsRpcCloseRaw, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1363,7 +1363,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcEncryptFileSrv), - (ndr_push_flags_fn_t) ndr_push_EfsRpcEncryptFileSrv, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcEncryptFileSrv, -- (ndr_print_function_t) ndr_print_EfsRpcEncryptFileSrv, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1372,7 +1372,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcDecryptFileSrv), - (ndr_push_flags_fn_t) ndr_push_EfsRpcDecryptFileSrv, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcDecryptFileSrv, -- (ndr_print_function_t) ndr_print_EfsRpcDecryptFileSrv, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1381,7 +1381,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcQueryUsersOnFile), - (ndr_push_flags_fn_t) ndr_push_EfsRpcQueryUsersOnFile, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcQueryUsersOnFile, -- (ndr_print_function_t) ndr_print_EfsRpcQueryUsersOnFile, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1390,7 +1390,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcQueryRecoveryAgents), - (ndr_push_flags_fn_t) ndr_push_EfsRpcQueryRecoveryAgents, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcQueryRecoveryAgents, -- (ndr_print_function_t) ndr_print_EfsRpcQueryRecoveryAgents, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1399,7 +1399,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcRemoveUsersFromFile), - (ndr_push_flags_fn_t) ndr_push_EfsRpcRemoveUsersFromFile, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcRemoveUsersFromFile, -- (ndr_print_function_t) ndr_print_EfsRpcRemoveUsersFromFile, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1408,7 +1408,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcAddUsersToFile), - (ndr_push_flags_fn_t) ndr_push_EfsRpcAddUsersToFile, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcAddUsersToFile, -- (ndr_print_function_t) ndr_print_EfsRpcAddUsersToFile, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1417,7 +1417,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcSetFileEncryptionKey), - (ndr_push_flags_fn_t) ndr_push_EfsRpcSetFileEncryptionKey, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcSetFileEncryptionKey, -- (ndr_print_function_t) ndr_print_EfsRpcSetFileEncryptionKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1426,7 +1426,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcNotSupported), - (ndr_push_flags_fn_t) ndr_push_EfsRpcNotSupported, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcNotSupported, -- (ndr_print_function_t) ndr_print_EfsRpcNotSupported, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1435,7 +1435,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcFileKeyInfo), - (ndr_push_flags_fn_t) ndr_push_EfsRpcFileKeyInfo, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcFileKeyInfo, -- (ndr_print_function_t) ndr_print_EfsRpcFileKeyInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1444,7 +1444,7 @@ static const struct ndr_interface_call e - sizeof(struct EfsRpcDuplicateEncryptionInfoFile), - (ndr_push_flags_fn_t) ndr_push_EfsRpcDuplicateEncryptionInfoFile, - (ndr_pull_flags_fn_t) ndr_pull_EfsRpcDuplicateEncryptionInfoFile, -- (ndr_print_function_t) ndr_print_EfsRpcDuplicateEncryptionInfoFile, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_epmapper.c -+++ b/source3/librpc/gen_ndr/ndr_epmapper.c -@@ -2754,7 +2754,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_Insert), - (ndr_push_flags_fn_t) ndr_push_epm_Insert, - (ndr_pull_flags_fn_t) ndr_pull_epm_Insert, -- (ndr_print_function_t) ndr_print_epm_Insert, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2763,7 +2763,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_Delete), - (ndr_push_flags_fn_t) ndr_push_epm_Delete, - (ndr_pull_flags_fn_t) ndr_pull_epm_Delete, -- (ndr_print_function_t) ndr_print_epm_Delete, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2772,7 +2772,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_Lookup), - (ndr_push_flags_fn_t) ndr_push_epm_Lookup, - (ndr_pull_flags_fn_t) ndr_pull_epm_Lookup, -- (ndr_print_function_t) ndr_print_epm_Lookup, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2781,7 +2781,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_Map), - (ndr_push_flags_fn_t) ndr_push_epm_Map, - (ndr_pull_flags_fn_t) ndr_pull_epm_Map, -- (ndr_print_function_t) ndr_print_epm_Map, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2790,7 +2790,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_LookupHandleFree), - (ndr_push_flags_fn_t) ndr_push_epm_LookupHandleFree, - (ndr_pull_flags_fn_t) ndr_pull_epm_LookupHandleFree, -- (ndr_print_function_t) ndr_print_epm_LookupHandleFree, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2799,7 +2799,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_InqObject), - (ndr_push_flags_fn_t) ndr_push_epm_InqObject, - (ndr_pull_flags_fn_t) ndr_pull_epm_InqObject, -- (ndr_print_function_t) ndr_print_epm_InqObject, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2808,7 +2808,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_MgmtDelete), - (ndr_push_flags_fn_t) ndr_push_epm_MgmtDelete, - (ndr_pull_flags_fn_t) ndr_pull_epm_MgmtDelete, -- (ndr_print_function_t) ndr_print_epm_MgmtDelete, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2817,7 +2817,7 @@ static const struct ndr_interface_call e - sizeof(struct epm_MapAuth), - (ndr_push_flags_fn_t) ndr_push_epm_MapAuth, - (ndr_pull_flags_fn_t) ndr_pull_epm_MapAuth, -- (ndr_print_function_t) ndr_print_epm_MapAuth, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_eventlog.c -+++ b/source3/librpc/gen_ndr/ndr_eventlog.c -@@ -2983,7 +2983,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ClearEventLogW), - (ndr_push_flags_fn_t) ndr_push_eventlog_ClearEventLogW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ClearEventLogW, -- (ndr_print_function_t) ndr_print_eventlog_ClearEventLogW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2992,7 +2992,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_BackupEventLogW), - (ndr_push_flags_fn_t) ndr_push_eventlog_BackupEventLogW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_BackupEventLogW, -- (ndr_print_function_t) ndr_print_eventlog_BackupEventLogW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3001,7 +3001,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_CloseEventLog), - (ndr_push_flags_fn_t) ndr_push_eventlog_CloseEventLog, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_CloseEventLog, -- (ndr_print_function_t) ndr_print_eventlog_CloseEventLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3010,7 +3010,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_DeregisterEventSource), - (ndr_push_flags_fn_t) ndr_push_eventlog_DeregisterEventSource, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_DeregisterEventSource, -- (ndr_print_function_t) ndr_print_eventlog_DeregisterEventSource, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3019,7 +3019,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_GetNumRecords), - (ndr_push_flags_fn_t) ndr_push_eventlog_GetNumRecords, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_GetNumRecords, -- (ndr_print_function_t) ndr_print_eventlog_GetNumRecords, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3028,7 +3028,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_GetOldestRecord), - (ndr_push_flags_fn_t) ndr_push_eventlog_GetOldestRecord, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_GetOldestRecord, -- (ndr_print_function_t) ndr_print_eventlog_GetOldestRecord, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3037,7 +3037,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ChangeNotify), - (ndr_push_flags_fn_t) ndr_push_eventlog_ChangeNotify, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ChangeNotify, -- (ndr_print_function_t) ndr_print_eventlog_ChangeNotify, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3046,7 +3046,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_OpenEventLogW), - (ndr_push_flags_fn_t) ndr_push_eventlog_OpenEventLogW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_OpenEventLogW, -- (ndr_print_function_t) ndr_print_eventlog_OpenEventLogW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3055,7 +3055,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_RegisterEventSourceW), - (ndr_push_flags_fn_t) ndr_push_eventlog_RegisterEventSourceW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_RegisterEventSourceW, -- (ndr_print_function_t) ndr_print_eventlog_RegisterEventSourceW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3064,7 +3064,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_OpenBackupEventLogW), - (ndr_push_flags_fn_t) ndr_push_eventlog_OpenBackupEventLogW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_OpenBackupEventLogW, -- (ndr_print_function_t) ndr_print_eventlog_OpenBackupEventLogW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3073,7 +3073,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ReadEventLogW), - (ndr_push_flags_fn_t) ndr_push_eventlog_ReadEventLogW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ReadEventLogW, -- (ndr_print_function_t) ndr_print_eventlog_ReadEventLogW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3082,7 +3082,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ReportEventW), - (ndr_push_flags_fn_t) ndr_push_eventlog_ReportEventW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ReportEventW, -- (ndr_print_function_t) ndr_print_eventlog_ReportEventW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3091,7 +3091,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ClearEventLogA), - (ndr_push_flags_fn_t) ndr_push_eventlog_ClearEventLogA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ClearEventLogA, -- (ndr_print_function_t) ndr_print_eventlog_ClearEventLogA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3100,7 +3100,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_BackupEventLogA), - (ndr_push_flags_fn_t) ndr_push_eventlog_BackupEventLogA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_BackupEventLogA, -- (ndr_print_function_t) ndr_print_eventlog_BackupEventLogA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3109,7 +3109,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_OpenEventLogA), - (ndr_push_flags_fn_t) ndr_push_eventlog_OpenEventLogA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_OpenEventLogA, -- (ndr_print_function_t) ndr_print_eventlog_OpenEventLogA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3118,7 +3118,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_RegisterEventSourceA), - (ndr_push_flags_fn_t) ndr_push_eventlog_RegisterEventSourceA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_RegisterEventSourceA, -- (ndr_print_function_t) ndr_print_eventlog_RegisterEventSourceA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3127,7 +3127,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_OpenBackupEventLogA), - (ndr_push_flags_fn_t) ndr_push_eventlog_OpenBackupEventLogA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_OpenBackupEventLogA, -- (ndr_print_function_t) ndr_print_eventlog_OpenBackupEventLogA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3136,7 +3136,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ReadEventLogA), - (ndr_push_flags_fn_t) ndr_push_eventlog_ReadEventLogA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ReadEventLogA, -- (ndr_print_function_t) ndr_print_eventlog_ReadEventLogA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3145,7 +3145,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ReportEventA), - (ndr_push_flags_fn_t) ndr_push_eventlog_ReportEventA, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ReportEventA, -- (ndr_print_function_t) ndr_print_eventlog_ReportEventA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3154,7 +3154,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_RegisterClusterSvc), - (ndr_push_flags_fn_t) ndr_push_eventlog_RegisterClusterSvc, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_RegisterClusterSvc, -- (ndr_print_function_t) ndr_print_eventlog_RegisterClusterSvc, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3163,7 +3163,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_DeregisterClusterSvc), - (ndr_push_flags_fn_t) ndr_push_eventlog_DeregisterClusterSvc, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_DeregisterClusterSvc, -- (ndr_print_function_t) ndr_print_eventlog_DeregisterClusterSvc, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3172,7 +3172,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_WriteClusterEvents), - (ndr_push_flags_fn_t) ndr_push_eventlog_WriteClusterEvents, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_WriteClusterEvents, -- (ndr_print_function_t) ndr_print_eventlog_WriteClusterEvents, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3181,7 +3181,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_GetLogInformation), - (ndr_push_flags_fn_t) ndr_push_eventlog_GetLogInformation, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_GetLogInformation, -- (ndr_print_function_t) ndr_print_eventlog_GetLogInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3190,7 +3190,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_FlushEventLog), - (ndr_push_flags_fn_t) ndr_push_eventlog_FlushEventLog, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_FlushEventLog, -- (ndr_print_function_t) ndr_print_eventlog_FlushEventLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3199,7 +3199,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog_ReportEventAndSourceW), - (ndr_push_flags_fn_t) ndr_push_eventlog_ReportEventAndSourceW, - (ndr_pull_flags_fn_t) ndr_pull_eventlog_ReportEventAndSourceW, -- (ndr_print_function_t) ndr_print_eventlog_ReportEventAndSourceW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_eventlog6.c -+++ b/source3/librpc/gen_ndr/ndr_eventlog6.c -@@ -5482,7 +5482,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRegisterRemoteSubscription), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRegisterRemoteSubscription, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRegisterRemoteSubscription, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRegisterRemoteSubscription, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5491,7 +5491,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRemoteSubscriptionNextAsync), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRemoteSubscriptionNextAsync, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRemoteSubscriptionNextAsync, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRemoteSubscriptionNextAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5500,7 +5500,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRemoteSubscriptionNext), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRemoteSubscriptionNext, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRemoteSubscriptionNext, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRemoteSubscriptionNext, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5509,7 +5509,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRemoteSubscriptionWaitAsync), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRemoteSubscriptionWaitAsync, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRemoteSubscriptionWaitAsync, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRemoteSubscriptionWaitAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5518,7 +5518,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRegisterControllableOperation), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRegisterControllableOperation, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRegisterControllableOperation, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRegisterControllableOperation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5527,7 +5527,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRegisterLogQuery), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRegisterLogQuery, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRegisterLogQuery, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRegisterLogQuery, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5536,7 +5536,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcClearLog), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcClearLog, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcClearLog, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcClearLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5545,7 +5545,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcExportLog), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcExportLog, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcExportLog, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcExportLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5554,7 +5554,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcLocalizeExportLog), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcLocalizeExportLog, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcLocalizeExportLog, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcLocalizeExportLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5563,7 +5563,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcMessageRender), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcMessageRender, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcMessageRender, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcMessageRender, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5572,7 +5572,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcMessageRenderDefault), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcMessageRenderDefault, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcMessageRenderDefault, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcMessageRenderDefault, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5581,7 +5581,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcQueryNext), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcQueryNext, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcQueryNext, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcQueryNext, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5590,7 +5590,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcQuerySeek), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcQuerySeek, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcQuerySeek, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcQuerySeek, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5599,7 +5599,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcClose), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcClose, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcClose, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcClose, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5608,7 +5608,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcCancel), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcCancel, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcCancel, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcCancel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5617,7 +5617,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcAssertConfig), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcAssertConfig, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcAssertConfig, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcAssertConfig, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5626,7 +5626,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcRetractConfig), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcRetractConfig, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcRetractConfig, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcRetractConfig, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5635,7 +5635,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcOpenLogHandle), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcOpenLogHandle, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcOpenLogHandle, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcOpenLogHandle, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5644,7 +5644,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetLogFileInfo), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetLogFileInfo, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetLogFileInfo, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetLogFileInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5653,7 +5653,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetChannelList), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetChannelList, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetChannelList, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetChannelList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5662,7 +5662,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetChannelConfig), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetChannelConfig, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetChannelConfig, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetChannelConfig, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5671,7 +5671,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcPutChannelConfig), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcPutChannelConfig, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcPutChannelConfig, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcPutChannelConfig, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5680,7 +5680,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetPublisherList), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetPublisherList, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetPublisherList, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetPublisherList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5689,7 +5689,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetPublisherListForChannel), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetPublisherListForChannel, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetPublisherListForChannel, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetPublisherListForChannel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5698,7 +5698,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetPublisherMetadata), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetPublisherMetadata, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetPublisherMetadata, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetPublisherMetadata, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5707,7 +5707,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetPublisherResourceMetadata), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetPublisherResourceMetadata, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetPublisherResourceMetadata, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetPublisherResourceMetadata, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5716,7 +5716,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetEventMetadataEnum), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetEventMetadataEnum, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetEventMetadataEnum, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetEventMetadataEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5725,7 +5725,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetNextEventMetadata), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetNextEventMetadata, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetNextEventMetadata, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetNextEventMetadata, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5734,7 +5734,7 @@ static const struct ndr_interface_call e - sizeof(struct eventlog6_EvtRpcGetClassicLogDisplayName), - (ndr_push_flags_fn_t) ndr_push_eventlog6_EvtRpcGetClassicLogDisplayName, - (ndr_pull_flags_fn_t) ndr_pull_eventlog6_EvtRpcGetClassicLogDisplayName, -- (ndr_print_function_t) ndr_print_eventlog6_EvtRpcGetClassicLogDisplayName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_frsapi.c -+++ b/source3/librpc/gen_ndr/ndr_frsapi.c -@@ -979,7 +979,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSAPI_VERIFY_PROMOTION), - (ndr_push_flags_fn_t) ndr_push_FRSAPI_VERIFY_PROMOTION, - (ndr_pull_flags_fn_t) ndr_pull_FRSAPI_VERIFY_PROMOTION, -- (ndr_print_function_t) ndr_print_FRSAPI_VERIFY_PROMOTION, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -988,7 +988,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSAPI_PROMOTION_STATUS), - (ndr_push_flags_fn_t) ndr_push_FRSAPI_PROMOTION_STATUS, - (ndr_pull_flags_fn_t) ndr_pull_FRSAPI_PROMOTION_STATUS, -- (ndr_print_function_t) ndr_print_FRSAPI_PROMOTION_STATUS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -997,7 +997,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSAPI_START_DEMOTION), - (ndr_push_flags_fn_t) ndr_push_FRSAPI_START_DEMOTION, - (ndr_pull_flags_fn_t) ndr_pull_FRSAPI_START_DEMOTION, -- (ndr_print_function_t) ndr_print_FRSAPI_START_DEMOTION, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1006,7 +1006,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSAPI_COMMIT_DEMOTION), - (ndr_push_flags_fn_t) ndr_push_FRSAPI_COMMIT_DEMOTION, - (ndr_pull_flags_fn_t) ndr_pull_FRSAPI_COMMIT_DEMOTION, -- (ndr_print_function_t) ndr_print_FRSAPI_COMMIT_DEMOTION, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1015,7 +1015,7 @@ static const struct ndr_interface_call f - sizeof(struct frsapi_SetDsPollingIntervalW), - (ndr_push_flags_fn_t) ndr_push_frsapi_SetDsPollingIntervalW, - (ndr_pull_flags_fn_t) ndr_pull_frsapi_SetDsPollingIntervalW, -- (ndr_print_function_t) ndr_print_frsapi_SetDsPollingIntervalW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1024,7 +1024,7 @@ static const struct ndr_interface_call f - sizeof(struct frsapi_GetDsPollingIntervalW), - (ndr_push_flags_fn_t) ndr_push_frsapi_GetDsPollingIntervalW, - (ndr_pull_flags_fn_t) ndr_pull_frsapi_GetDsPollingIntervalW, -- (ndr_print_function_t) ndr_print_frsapi_GetDsPollingIntervalW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1033,7 +1033,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSAPI_VERIFY_PROMOTION_W), - (ndr_push_flags_fn_t) ndr_push_FRSAPI_VERIFY_PROMOTION_W, - (ndr_pull_flags_fn_t) ndr_pull_FRSAPI_VERIFY_PROMOTION_W, -- (ndr_print_function_t) ndr_print_FRSAPI_VERIFY_PROMOTION_W, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1042,7 +1042,7 @@ static const struct ndr_interface_call f - sizeof(struct frsapi_InfoW), - (ndr_push_flags_fn_t) ndr_push_frsapi_InfoW, - (ndr_pull_flags_fn_t) ndr_pull_frsapi_InfoW, -- (ndr_print_function_t) ndr_print_frsapi_InfoW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1051,7 +1051,7 @@ static const struct ndr_interface_call f - sizeof(struct frsapi_IsPathReplicated), - (ndr_push_flags_fn_t) ndr_push_frsapi_IsPathReplicated, - (ndr_pull_flags_fn_t) ndr_pull_frsapi_IsPathReplicated, -- (ndr_print_function_t) ndr_print_frsapi_IsPathReplicated, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1060,7 +1060,7 @@ static const struct ndr_interface_call f - sizeof(struct frsapi_WriterCommand), - (ndr_push_flags_fn_t) ndr_push_frsapi_WriterCommand, - (ndr_pull_flags_fn_t) ndr_pull_frsapi_WriterCommand, -- (ndr_print_function_t) ndr_print_frsapi_WriterCommand, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1069,7 +1069,7 @@ static const struct ndr_interface_call f - sizeof(struct frsapi_ForceReplication), - (ndr_push_flags_fn_t) ndr_push_frsapi_ForceReplication, - (ndr_pull_flags_fn_t) ndr_pull_frsapi_ForceReplication, -- (ndr_print_function_t) ndr_print_frsapi_ForceReplication, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_frsrpc.c -+++ b/source3/librpc/gen_ndr/ndr_frsrpc.c -@@ -2781,7 +2781,7 @@ static const struct ndr_interface_call f - sizeof(struct frsrpc_FrsSendCommPkt), - (ndr_push_flags_fn_t) ndr_push_frsrpc_FrsSendCommPkt, - (ndr_pull_flags_fn_t) ndr_pull_frsrpc_FrsSendCommPkt, -- (ndr_print_function_t) ndr_print_frsrpc_FrsSendCommPkt, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2790,7 +2790,7 @@ static const struct ndr_interface_call f - sizeof(struct frsrpc_FrsVerifyPromotionParent), - (ndr_push_flags_fn_t) ndr_push_frsrpc_FrsVerifyPromotionParent, - (ndr_pull_flags_fn_t) ndr_pull_frsrpc_FrsVerifyPromotionParent, -- (ndr_print_function_t) ndr_print_frsrpc_FrsVerifyPromotionParent, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2799,7 +2799,7 @@ static const struct ndr_interface_call f - sizeof(struct frsrpc_FrsStartPromotionParent), - (ndr_push_flags_fn_t) ndr_push_frsrpc_FrsStartPromotionParent, - (ndr_pull_flags_fn_t) ndr_pull_frsrpc_FrsStartPromotionParent, -- (ndr_print_function_t) ndr_print_frsrpc_FrsStartPromotionParent, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2808,7 +2808,7 @@ static const struct ndr_interface_call f - sizeof(struct frsrpc_FrsNOP), - (ndr_push_flags_fn_t) ndr_push_frsrpc_FrsNOP, - (ndr_pull_flags_fn_t) ndr_pull_frsrpc_FrsNOP, -- (ndr_print_function_t) ndr_print_frsrpc_FrsNOP, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2817,7 +2817,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_BACKUP_COMPLETE), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_BACKUP_COMPLETE, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_BACKUP_COMPLETE, -- (ndr_print_function_t) ndr_print_FRSRPC_BACKUP_COMPLETE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2826,7 +2826,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_BACKUP_COMPLETE_5), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_BACKUP_COMPLETE_5, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_BACKUP_COMPLETE_5, -- (ndr_print_function_t) ndr_print_FRSRPC_BACKUP_COMPLETE_5, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2835,7 +2835,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_BACKUP_COMPLETE_6), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_BACKUP_COMPLETE_6, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_BACKUP_COMPLETE_6, -- (ndr_print_function_t) ndr_print_FRSRPC_BACKUP_COMPLETE_6, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2844,7 +2844,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_BACKUP_COMPLETE_7), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_BACKUP_COMPLETE_7, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_BACKUP_COMPLETE_7, -- (ndr_print_function_t) ndr_print_FRSRPC_BACKUP_COMPLETE_7, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2853,7 +2853,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_BACKUP_COMPLETE_8), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_BACKUP_COMPLETE_8, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_BACKUP_COMPLETE_8, -- (ndr_print_function_t) ndr_print_FRSRPC_BACKUP_COMPLETE_8, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2862,7 +2862,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_BACKUP_COMPLETE_9), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_BACKUP_COMPLETE_9, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_BACKUP_COMPLETE_9, -- (ndr_print_function_t) ndr_print_FRSRPC_BACKUP_COMPLETE_9, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2871,7 +2871,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSRPC_VERIFY_PROMOTION_PARENT_EX), - (ndr_push_flags_fn_t) ndr_push_FRSRPC_VERIFY_PROMOTION_PARENT_EX, - (ndr_pull_flags_fn_t) ndr_pull_FRSRPC_VERIFY_PROMOTION_PARENT_EX, -- (ndr_print_function_t) ndr_print_FRSRPC_VERIFY_PROMOTION_PARENT_EX, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_frstrans.c -+++ b/source3/librpc/gen_ndr/ndr_frstrans.c -@@ -2331,7 +2331,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_CheckConnectivity), - (ndr_push_flags_fn_t) ndr_push_frstrans_CheckConnectivity, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_CheckConnectivity, -- (ndr_print_function_t) ndr_print_frstrans_CheckConnectivity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2340,7 +2340,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_EstablishConnection), - (ndr_push_flags_fn_t) ndr_push_frstrans_EstablishConnection, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_EstablishConnection, -- (ndr_print_function_t) ndr_print_frstrans_EstablishConnection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2349,7 +2349,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_EstablishSession), - (ndr_push_flags_fn_t) ndr_push_frstrans_EstablishSession, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_EstablishSession, -- (ndr_print_function_t) ndr_print_frstrans_EstablishSession, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2358,7 +2358,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_RequestUpdates), - (ndr_push_flags_fn_t) ndr_push_frstrans_RequestUpdates, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_RequestUpdates, -- (ndr_print_function_t) ndr_print_frstrans_RequestUpdates, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2367,7 +2367,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_RequestVersionVector), - (ndr_push_flags_fn_t) ndr_push_frstrans_RequestVersionVector, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_RequestVersionVector, -- (ndr_print_function_t) ndr_print_frstrans_RequestVersionVector, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2376,7 +2376,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_AsyncPoll), - (ndr_push_flags_fn_t) ndr_push_frstrans_AsyncPoll, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_AsyncPoll, -- (ndr_print_function_t) ndr_print_frstrans_AsyncPoll, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2385,7 +2385,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_REQUEST_RECORDS), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_REQUEST_RECORDS, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_REQUEST_RECORDS, -- (ndr_print_function_t) ndr_print_FRSTRANS_REQUEST_RECORDS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2394,7 +2394,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_UPDATE_CANCEL), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_UPDATE_CANCEL, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_UPDATE_CANCEL, -- (ndr_print_function_t) ndr_print_FRSTRANS_UPDATE_CANCEL, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2403,7 +2403,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_RAW_GET_FILE_DATA), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_RAW_GET_FILE_DATA, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_RAW_GET_FILE_DATA, -- (ndr_print_function_t) ndr_print_FRSTRANS_RAW_GET_FILE_DATA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2412,7 +2412,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_RDC_GET_SIGNATURES), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_RDC_GET_SIGNATURES, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_RDC_GET_SIGNATURES, -- (ndr_print_function_t) ndr_print_FRSTRANS_RDC_GET_SIGNATURES, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2421,7 +2421,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_RDC_PUSH_SOURCE_NEEDS), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_RDC_PUSH_SOURCE_NEEDS, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_RDC_PUSH_SOURCE_NEEDS, -- (ndr_print_function_t) ndr_print_FRSTRANS_RDC_PUSH_SOURCE_NEEDS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2430,7 +2430,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_RDC_GET_FILE_DATA), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_RDC_GET_FILE_DATA, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_RDC_GET_FILE_DATA, -- (ndr_print_function_t) ndr_print_FRSTRANS_RDC_GET_FILE_DATA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2439,7 +2439,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_RDC_CLOSE), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_RDC_CLOSE, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_RDC_CLOSE, -- (ndr_print_function_t) ndr_print_FRSTRANS_RDC_CLOSE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2448,7 +2448,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_InitializeFileTransferAsync), - (ndr_push_flags_fn_t) ndr_push_frstrans_InitializeFileTransferAsync, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_InitializeFileTransferAsync, -- (ndr_print_function_t) ndr_print_frstrans_InitializeFileTransferAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2457,7 +2457,7 @@ static const struct ndr_interface_call f - sizeof(struct FRSTRANS_OPNUM_0E_NOT_USED_ON_THE_WIRE), - (ndr_push_flags_fn_t) ndr_push_FRSTRANS_OPNUM_0E_NOT_USED_ON_THE_WIRE, - (ndr_pull_flags_fn_t) ndr_pull_FRSTRANS_OPNUM_0E_NOT_USED_ON_THE_WIRE, -- (ndr_print_function_t) ndr_print_FRSTRANS_OPNUM_0E_NOT_USED_ON_THE_WIRE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2466,7 +2466,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_RawGetFileDataAsync), - (ndr_push_flags_fn_t) ndr_push_frstrans_RawGetFileDataAsync, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_RawGetFileDataAsync, -- (ndr_print_function_t) ndr_print_frstrans_RawGetFileDataAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 1, frstrans_RawGetFileDataAsync_out_pipes }, - }, -@@ -2475,7 +2475,7 @@ static const struct ndr_interface_call f - sizeof(struct frstrans_RdcGetFileDataAsync), - (ndr_push_flags_fn_t) ndr_push_frstrans_RdcGetFileDataAsync, - (ndr_pull_flags_fn_t) ndr_pull_frstrans_RdcGetFileDataAsync, -- (ndr_print_function_t) ndr_print_frstrans_RdcGetFileDataAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 1, frstrans_RdcGetFileDataAsync_out_pipes }, - }, ---- a/source3/librpc/gen_ndr/ndr_initshutdown.c -+++ b/source3/librpc/gen_ndr/ndr_initshutdown.c -@@ -277,7 +277,7 @@ static const struct ndr_interface_call i - sizeof(struct initshutdown_Init), - (ndr_push_flags_fn_t) ndr_push_initshutdown_Init, - (ndr_pull_flags_fn_t) ndr_pull_initshutdown_Init, -- (ndr_print_function_t) ndr_print_initshutdown_Init, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -286,7 +286,7 @@ static const struct ndr_interface_call i - sizeof(struct initshutdown_Abort), - (ndr_push_flags_fn_t) ndr_push_initshutdown_Abort, - (ndr_pull_flags_fn_t) ndr_pull_initshutdown_Abort, -- (ndr_print_function_t) ndr_print_initshutdown_Abort, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -295,7 +295,7 @@ static const struct ndr_interface_call i - sizeof(struct initshutdown_InitEx), - (ndr_push_flags_fn_t) ndr_push_initshutdown_InitEx, - (ndr_pull_flags_fn_t) ndr_pull_initshutdown_InitEx, -- (ndr_print_function_t) ndr_print_initshutdown_InitEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_keysvc.c -+++ b/source3/librpc/gen_ndr/ndr_keysvc.c -@@ -51,7 +51,7 @@ static const struct ndr_interface_call k - sizeof(struct keysvc_Unknown0), - (ndr_push_flags_fn_t) ndr_push_keysvc_Unknown0, - (ndr_pull_flags_fn_t) ndr_pull_keysvc_Unknown0, -- (ndr_print_function_t) ndr_print_keysvc_Unknown0, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_krb5pac.c -+++ b/source3/librpc/gen_ndr/ndr_krb5pac.c -@@ -1002,7 +1002,7 @@ static const struct ndr_interface_call k - sizeof(struct decode_pac), - (ndr_push_flags_fn_t) ndr_push_decode_pac, - (ndr_pull_flags_fn_t) ndr_pull_decode_pac, -- (ndr_print_function_t) ndr_print_decode_pac, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1011,7 +1011,7 @@ static const struct ndr_interface_call k - sizeof(struct decode_pac_raw), - (ndr_push_flags_fn_t) ndr_push_decode_pac_raw, - (ndr_pull_flags_fn_t) ndr_pull_decode_pac_raw, -- (ndr_print_function_t) ndr_print_decode_pac_raw, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1020,7 +1020,7 @@ static const struct ndr_interface_call k - sizeof(struct decode_login_info), - (ndr_push_flags_fn_t) ndr_push_decode_login_info, - (ndr_pull_flags_fn_t) ndr_pull_decode_login_info, -- (ndr_print_function_t) ndr_print_decode_login_info, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1029,7 +1029,7 @@ static const struct ndr_interface_call k - sizeof(struct decode_login_info_ctr), - (ndr_push_flags_fn_t) ndr_push_decode_login_info_ctr, - (ndr_pull_flags_fn_t) ndr_pull_decode_login_info_ctr, -- (ndr_print_function_t) ndr_print_decode_login_info_ctr, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -1038,7 +1038,7 @@ static const struct ndr_interface_call k - sizeof(struct decode_pac_validate), - (ndr_push_flags_fn_t) ndr_push_decode_pac_validate, - (ndr_pull_flags_fn_t) ndr_pull_decode_pac_validate, -- (ndr_print_function_t) ndr_print_decode_pac_validate, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_lsa.c -+++ b/source3/librpc/gen_ndr/ndr_lsa.c -@@ -13565,7 +13565,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_Close), - (ndr_push_flags_fn_t) ndr_push_lsa_Close, - (ndr_pull_flags_fn_t) ndr_pull_lsa_Close, -- (ndr_print_function_t) ndr_print_lsa_Close, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13574,7 +13574,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_Delete), - (ndr_push_flags_fn_t) ndr_push_lsa_Delete, - (ndr_pull_flags_fn_t) ndr_pull_lsa_Delete, -- (ndr_print_function_t) ndr_print_lsa_Delete, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13583,7 +13583,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumPrivs), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumPrivs, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumPrivs, -- (ndr_print_function_t) ndr_print_lsa_EnumPrivs, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13592,7 +13592,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QuerySecurity), - (ndr_push_flags_fn_t) ndr_push_lsa_QuerySecurity, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QuerySecurity, -- (ndr_print_function_t) ndr_print_lsa_QuerySecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13601,7 +13601,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetSecObj), - (ndr_push_flags_fn_t) ndr_push_lsa_SetSecObj, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetSecObj, -- (ndr_print_function_t) ndr_print_lsa_SetSecObj, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13610,7 +13610,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_ChangePassword), - (ndr_push_flags_fn_t) ndr_push_lsa_ChangePassword, - (ndr_pull_flags_fn_t) ndr_pull_lsa_ChangePassword, -- (ndr_print_function_t) ndr_print_lsa_ChangePassword, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13619,7 +13619,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_OpenPolicy), - (ndr_push_flags_fn_t) ndr_push_lsa_OpenPolicy, - (ndr_pull_flags_fn_t) ndr_pull_lsa_OpenPolicy, -- (ndr_print_function_t) ndr_print_lsa_OpenPolicy, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13628,7 +13628,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QueryInfoPolicy), - (ndr_push_flags_fn_t) ndr_push_lsa_QueryInfoPolicy, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QueryInfoPolicy, -- (ndr_print_function_t) ndr_print_lsa_QueryInfoPolicy, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13637,7 +13637,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetInfoPolicy), - (ndr_push_flags_fn_t) ndr_push_lsa_SetInfoPolicy, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetInfoPolicy, -- (ndr_print_function_t) ndr_print_lsa_SetInfoPolicy, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13646,7 +13646,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_ClearAuditLog), - (ndr_push_flags_fn_t) ndr_push_lsa_ClearAuditLog, - (ndr_pull_flags_fn_t) ndr_pull_lsa_ClearAuditLog, -- (ndr_print_function_t) ndr_print_lsa_ClearAuditLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13655,7 +13655,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CreateAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_CreateAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CreateAccount, -- (ndr_print_function_t) ndr_print_lsa_CreateAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13664,7 +13664,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumAccounts), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumAccounts, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumAccounts, -- (ndr_print_function_t) ndr_print_lsa_EnumAccounts, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13673,7 +13673,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CreateTrustedDomain), - (ndr_push_flags_fn_t) ndr_push_lsa_CreateTrustedDomain, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CreateTrustedDomain, -- (ndr_print_function_t) ndr_print_lsa_CreateTrustedDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13682,7 +13682,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumTrustDom), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumTrustDom, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumTrustDom, -- (ndr_print_function_t) ndr_print_lsa_EnumTrustDom, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13691,7 +13691,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupNames), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupNames, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupNames, -- (ndr_print_function_t) ndr_print_lsa_LookupNames, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13700,7 +13700,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupSids), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupSids, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupSids, -- (ndr_print_function_t) ndr_print_lsa_LookupSids, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13709,7 +13709,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CreateSecret), - (ndr_push_flags_fn_t) ndr_push_lsa_CreateSecret, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CreateSecret, -- (ndr_print_function_t) ndr_print_lsa_CreateSecret, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13718,7 +13718,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_OpenAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_OpenAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_OpenAccount, -- (ndr_print_function_t) ndr_print_lsa_OpenAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13727,7 +13727,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumPrivsAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumPrivsAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumPrivsAccount, -- (ndr_print_function_t) ndr_print_lsa_EnumPrivsAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13736,7 +13736,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_AddPrivilegesToAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_AddPrivilegesToAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_AddPrivilegesToAccount, -- (ndr_print_function_t) ndr_print_lsa_AddPrivilegesToAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13745,7 +13745,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_RemovePrivilegesFromAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_RemovePrivilegesFromAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_RemovePrivilegesFromAccount, -- (ndr_print_function_t) ndr_print_lsa_RemovePrivilegesFromAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13754,7 +13754,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_GetQuotasForAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_GetQuotasForAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_GetQuotasForAccount, -- (ndr_print_function_t) ndr_print_lsa_GetQuotasForAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13763,7 +13763,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetQuotasForAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_SetQuotasForAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetQuotasForAccount, -- (ndr_print_function_t) ndr_print_lsa_SetQuotasForAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13772,7 +13772,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_GetSystemAccessAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_GetSystemAccessAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_GetSystemAccessAccount, -- (ndr_print_function_t) ndr_print_lsa_GetSystemAccessAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13781,7 +13781,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetSystemAccessAccount), - (ndr_push_flags_fn_t) ndr_push_lsa_SetSystemAccessAccount, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetSystemAccessAccount, -- (ndr_print_function_t) ndr_print_lsa_SetSystemAccessAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13790,7 +13790,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_OpenTrustedDomain), - (ndr_push_flags_fn_t) ndr_push_lsa_OpenTrustedDomain, - (ndr_pull_flags_fn_t) ndr_pull_lsa_OpenTrustedDomain, -- (ndr_print_function_t) ndr_print_lsa_OpenTrustedDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13799,7 +13799,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QueryTrustedDomainInfo), - (ndr_push_flags_fn_t) ndr_push_lsa_QueryTrustedDomainInfo, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QueryTrustedDomainInfo, -- (ndr_print_function_t) ndr_print_lsa_QueryTrustedDomainInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13808,7 +13808,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetInformationTrustedDomain), - (ndr_push_flags_fn_t) ndr_push_lsa_SetInformationTrustedDomain, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetInformationTrustedDomain, -- (ndr_print_function_t) ndr_print_lsa_SetInformationTrustedDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13817,7 +13817,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_OpenSecret), - (ndr_push_flags_fn_t) ndr_push_lsa_OpenSecret, - (ndr_pull_flags_fn_t) ndr_pull_lsa_OpenSecret, -- (ndr_print_function_t) ndr_print_lsa_OpenSecret, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13826,7 +13826,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetSecret), - (ndr_push_flags_fn_t) ndr_push_lsa_SetSecret, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetSecret, -- (ndr_print_function_t) ndr_print_lsa_SetSecret, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13835,7 +13835,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QuerySecret), - (ndr_push_flags_fn_t) ndr_push_lsa_QuerySecret, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QuerySecret, -- (ndr_print_function_t) ndr_print_lsa_QuerySecret, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13844,7 +13844,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupPrivValue), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupPrivValue, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupPrivValue, -- (ndr_print_function_t) ndr_print_lsa_LookupPrivValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13853,7 +13853,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupPrivName), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupPrivName, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupPrivName, -- (ndr_print_function_t) ndr_print_lsa_LookupPrivName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13862,7 +13862,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupPrivDisplayName), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupPrivDisplayName, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupPrivDisplayName, -- (ndr_print_function_t) ndr_print_lsa_LookupPrivDisplayName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13871,7 +13871,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_DeleteObject), - (ndr_push_flags_fn_t) ndr_push_lsa_DeleteObject, - (ndr_pull_flags_fn_t) ndr_pull_lsa_DeleteObject, -- (ndr_print_function_t) ndr_print_lsa_DeleteObject, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13880,7 +13880,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumAccountsWithUserRight), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumAccountsWithUserRight, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumAccountsWithUserRight, -- (ndr_print_function_t) ndr_print_lsa_EnumAccountsWithUserRight, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13889,7 +13889,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumAccountRights), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumAccountRights, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumAccountRights, -- (ndr_print_function_t) ndr_print_lsa_EnumAccountRights, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13898,7 +13898,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_AddAccountRights), - (ndr_push_flags_fn_t) ndr_push_lsa_AddAccountRights, - (ndr_pull_flags_fn_t) ndr_pull_lsa_AddAccountRights, -- (ndr_print_function_t) ndr_print_lsa_AddAccountRights, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13907,7 +13907,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_RemoveAccountRights), - (ndr_push_flags_fn_t) ndr_push_lsa_RemoveAccountRights, - (ndr_pull_flags_fn_t) ndr_pull_lsa_RemoveAccountRights, -- (ndr_print_function_t) ndr_print_lsa_RemoveAccountRights, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13916,7 +13916,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QueryTrustedDomainInfoBySid), - (ndr_push_flags_fn_t) ndr_push_lsa_QueryTrustedDomainInfoBySid, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QueryTrustedDomainInfoBySid, -- (ndr_print_function_t) ndr_print_lsa_QueryTrustedDomainInfoBySid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13925,7 +13925,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetTrustedDomainInfo), - (ndr_push_flags_fn_t) ndr_push_lsa_SetTrustedDomainInfo, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetTrustedDomainInfo, -- (ndr_print_function_t) ndr_print_lsa_SetTrustedDomainInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13934,7 +13934,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_DeleteTrustedDomain), - (ndr_push_flags_fn_t) ndr_push_lsa_DeleteTrustedDomain, - (ndr_pull_flags_fn_t) ndr_pull_lsa_DeleteTrustedDomain, -- (ndr_print_function_t) ndr_print_lsa_DeleteTrustedDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13943,7 +13943,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_StorePrivateData), - (ndr_push_flags_fn_t) ndr_push_lsa_StorePrivateData, - (ndr_pull_flags_fn_t) ndr_pull_lsa_StorePrivateData, -- (ndr_print_function_t) ndr_print_lsa_StorePrivateData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13952,7 +13952,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_RetrievePrivateData), - (ndr_push_flags_fn_t) ndr_push_lsa_RetrievePrivateData, - (ndr_pull_flags_fn_t) ndr_pull_lsa_RetrievePrivateData, -- (ndr_print_function_t) ndr_print_lsa_RetrievePrivateData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13961,7 +13961,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_OpenPolicy2), - (ndr_push_flags_fn_t) ndr_push_lsa_OpenPolicy2, - (ndr_pull_flags_fn_t) ndr_pull_lsa_OpenPolicy2, -- (ndr_print_function_t) ndr_print_lsa_OpenPolicy2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13970,7 +13970,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_GetUserName), - (ndr_push_flags_fn_t) ndr_push_lsa_GetUserName, - (ndr_pull_flags_fn_t) ndr_pull_lsa_GetUserName, -- (ndr_print_function_t) ndr_print_lsa_GetUserName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13979,7 +13979,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QueryInfoPolicy2), - (ndr_push_flags_fn_t) ndr_push_lsa_QueryInfoPolicy2, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QueryInfoPolicy2, -- (ndr_print_function_t) ndr_print_lsa_QueryInfoPolicy2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13988,7 +13988,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetInfoPolicy2), - (ndr_push_flags_fn_t) ndr_push_lsa_SetInfoPolicy2, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetInfoPolicy2, -- (ndr_print_function_t) ndr_print_lsa_SetInfoPolicy2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13997,7 +13997,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QueryTrustedDomainInfoByName), - (ndr_push_flags_fn_t) ndr_push_lsa_QueryTrustedDomainInfoByName, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QueryTrustedDomainInfoByName, -- (ndr_print_function_t) ndr_print_lsa_QueryTrustedDomainInfoByName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14006,7 +14006,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetTrustedDomainInfoByName), - (ndr_push_flags_fn_t) ndr_push_lsa_SetTrustedDomainInfoByName, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetTrustedDomainInfoByName, -- (ndr_print_function_t) ndr_print_lsa_SetTrustedDomainInfoByName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14015,7 +14015,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_EnumTrustedDomainsEx), - (ndr_push_flags_fn_t) ndr_push_lsa_EnumTrustedDomainsEx, - (ndr_pull_flags_fn_t) ndr_pull_lsa_EnumTrustedDomainsEx, -- (ndr_print_function_t) ndr_print_lsa_EnumTrustedDomainsEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14024,7 +14024,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CreateTrustedDomainEx), - (ndr_push_flags_fn_t) ndr_push_lsa_CreateTrustedDomainEx, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CreateTrustedDomainEx, -- (ndr_print_function_t) ndr_print_lsa_CreateTrustedDomainEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14033,7 +14033,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CloseTrustedDomainEx), - (ndr_push_flags_fn_t) ndr_push_lsa_CloseTrustedDomainEx, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CloseTrustedDomainEx, -- (ndr_print_function_t) ndr_print_lsa_CloseTrustedDomainEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14042,7 +14042,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_QueryDomainInformationPolicy), - (ndr_push_flags_fn_t) ndr_push_lsa_QueryDomainInformationPolicy, - (ndr_pull_flags_fn_t) ndr_pull_lsa_QueryDomainInformationPolicy, -- (ndr_print_function_t) ndr_print_lsa_QueryDomainInformationPolicy, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14051,7 +14051,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_SetDomainInformationPolicy), - (ndr_push_flags_fn_t) ndr_push_lsa_SetDomainInformationPolicy, - (ndr_pull_flags_fn_t) ndr_pull_lsa_SetDomainInformationPolicy, -- (ndr_print_function_t) ndr_print_lsa_SetDomainInformationPolicy, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14060,7 +14060,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_OpenTrustedDomainByName), - (ndr_push_flags_fn_t) ndr_push_lsa_OpenTrustedDomainByName, - (ndr_pull_flags_fn_t) ndr_pull_lsa_OpenTrustedDomainByName, -- (ndr_print_function_t) ndr_print_lsa_OpenTrustedDomainByName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14069,7 +14069,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_TestCall), - (ndr_push_flags_fn_t) ndr_push_lsa_TestCall, - (ndr_pull_flags_fn_t) ndr_pull_lsa_TestCall, -- (ndr_print_function_t) ndr_print_lsa_TestCall, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14078,7 +14078,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupSids2), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupSids2, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupSids2, -- (ndr_print_function_t) ndr_print_lsa_LookupSids2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14087,7 +14087,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupNames2), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupNames2, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupNames2, -- (ndr_print_function_t) ndr_print_lsa_LookupNames2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14096,7 +14096,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CreateTrustedDomainEx2), - (ndr_push_flags_fn_t) ndr_push_lsa_CreateTrustedDomainEx2, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CreateTrustedDomainEx2, -- (ndr_print_function_t) ndr_print_lsa_CreateTrustedDomainEx2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14105,7 +14105,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRWRITE), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRWRITE, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRWRITE, -- (ndr_print_function_t) ndr_print_lsa_CREDRWRITE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14114,7 +14114,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRREAD), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRREAD, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRREAD, -- (ndr_print_function_t) ndr_print_lsa_CREDRREAD, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14123,7 +14123,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRENUMERATE), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRENUMERATE, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRENUMERATE, -- (ndr_print_function_t) ndr_print_lsa_CREDRENUMERATE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14132,7 +14132,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRWRITEDOMAINCREDENTIALS), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRWRITEDOMAINCREDENTIALS, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRWRITEDOMAINCREDENTIALS, -- (ndr_print_function_t) ndr_print_lsa_CREDRWRITEDOMAINCREDENTIALS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14141,7 +14141,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRREADDOMAINCREDENTIALS), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRREADDOMAINCREDENTIALS, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRREADDOMAINCREDENTIALS, -- (ndr_print_function_t) ndr_print_lsa_CREDRREADDOMAINCREDENTIALS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14150,7 +14150,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRDELETE), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRDELETE, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRDELETE, -- (ndr_print_function_t) ndr_print_lsa_CREDRDELETE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14159,7 +14159,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRGETTARGETINFO), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRGETTARGETINFO, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRGETTARGETINFO, -- (ndr_print_function_t) ndr_print_lsa_CREDRGETTARGETINFO, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14168,7 +14168,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRPROFILELOADED), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRPROFILELOADED, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRPROFILELOADED, -- (ndr_print_function_t) ndr_print_lsa_CREDRPROFILELOADED, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14177,7 +14177,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupNames3), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupNames3, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupNames3, -- (ndr_print_function_t) ndr_print_lsa_LookupNames3, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14186,7 +14186,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRGETSESSIONTYPES), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRGETSESSIONTYPES, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRGETSESSIONTYPES, -- (ndr_print_function_t) ndr_print_lsa_CREDRGETSESSIONTYPES, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14195,7 +14195,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSARREGISTERAUDITEVENT), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARREGISTERAUDITEVENT, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARREGISTERAUDITEVENT, -- (ndr_print_function_t) ndr_print_lsa_LSARREGISTERAUDITEVENT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14204,7 +14204,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSARGENAUDITEVENT), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARGENAUDITEVENT, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARGENAUDITEVENT, -- (ndr_print_function_t) ndr_print_lsa_LSARGENAUDITEVENT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14213,7 +14213,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSARUNREGISTERAUDITEVENT), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARUNREGISTERAUDITEVENT, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARUNREGISTERAUDITEVENT, -- (ndr_print_function_t) ndr_print_lsa_LSARUNREGISTERAUDITEVENT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14222,7 +14222,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_lsaRQueryForestTrustInformation), - (ndr_push_flags_fn_t) ndr_push_lsa_lsaRQueryForestTrustInformation, - (ndr_pull_flags_fn_t) ndr_pull_lsa_lsaRQueryForestTrustInformation, -- (ndr_print_function_t) ndr_print_lsa_lsaRQueryForestTrustInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14231,7 +14231,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_lsaRSetForestTrustInformation), - (ndr_push_flags_fn_t) ndr_push_lsa_lsaRSetForestTrustInformation, - (ndr_pull_flags_fn_t) ndr_pull_lsa_lsaRSetForestTrustInformation, -- (ndr_print_function_t) ndr_print_lsa_lsaRSetForestTrustInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14240,7 +14240,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_CREDRRENAME), - (ndr_push_flags_fn_t) ndr_push_lsa_CREDRRENAME, - (ndr_pull_flags_fn_t) ndr_pull_lsa_CREDRRENAME, -- (ndr_print_function_t) ndr_print_lsa_CREDRRENAME, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14249,7 +14249,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupSids3), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupSids3, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupSids3, -- (ndr_print_function_t) ndr_print_lsa_LookupSids3, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14258,7 +14258,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LookupNames4), - (ndr_push_flags_fn_t) ndr_push_lsa_LookupNames4, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LookupNames4, -- (ndr_print_function_t) ndr_print_lsa_LookupNames4, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14267,7 +14267,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSAROPENPOLICYSCE), - (ndr_push_flags_fn_t) ndr_push_lsa_LSAROPENPOLICYSCE, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSAROPENPOLICYSCE, -- (ndr_print_function_t) ndr_print_lsa_LSAROPENPOLICYSCE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14276,7 +14276,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARADTREGISTERSECURITYEVENTSOURCE, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARADTREGISTERSECURITYEVENTSOURCE, -- (ndr_print_function_t) ndr_print_lsa_LSARADTREGISTERSECURITYEVENTSOURCE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14285,7 +14285,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, -- (ndr_print_function_t) ndr_print_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -14294,7 +14294,7 @@ static const struct ndr_interface_call l - sizeof(struct lsa_LSARADTREPORTSECURITYEVENT), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARADTREPORTSECURITYEVENT, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARADTREPORTSECURITYEVENT, -- (ndr_print_function_t) ndr_print_lsa_LSARADTREPORTSECURITYEVENT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_mgmt.c -+++ b/source3/librpc/gen_ndr/ndr_mgmt.c -@@ -515,7 +515,7 @@ static const struct ndr_interface_call m - sizeof(struct mgmt_inq_if_ids), - (ndr_push_flags_fn_t) ndr_push_mgmt_inq_if_ids, - (ndr_pull_flags_fn_t) ndr_pull_mgmt_inq_if_ids, -- (ndr_print_function_t) ndr_print_mgmt_inq_if_ids, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -524,7 +524,7 @@ static const struct ndr_interface_call m - sizeof(struct mgmt_inq_stats), - (ndr_push_flags_fn_t) ndr_push_mgmt_inq_stats, - (ndr_pull_flags_fn_t) ndr_pull_mgmt_inq_stats, -- (ndr_print_function_t) ndr_print_mgmt_inq_stats, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -533,7 +533,7 @@ static const struct ndr_interface_call m - sizeof(struct mgmt_is_server_listening), - (ndr_push_flags_fn_t) ndr_push_mgmt_is_server_listening, - (ndr_pull_flags_fn_t) ndr_pull_mgmt_is_server_listening, -- (ndr_print_function_t) ndr_print_mgmt_is_server_listening, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -542,7 +542,7 @@ static const struct ndr_interface_call m - sizeof(struct mgmt_stop_server_listening), - (ndr_push_flags_fn_t) ndr_push_mgmt_stop_server_listening, - (ndr_pull_flags_fn_t) ndr_pull_mgmt_stop_server_listening, -- (ndr_print_function_t) ndr_print_mgmt_stop_server_listening, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -551,7 +551,7 @@ static const struct ndr_interface_call m - sizeof(struct mgmt_inq_princ_name), - (ndr_push_flags_fn_t) ndr_push_mgmt_inq_princ_name, - (ndr_pull_flags_fn_t) ndr_pull_mgmt_inq_princ_name, -- (ndr_print_function_t) ndr_print_mgmt_inq_princ_name, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_msgsvc.c -+++ b/source3/librpc/gen_ndr/ndr_msgsvc.c -@@ -165,7 +165,7 @@ static const struct ndr_interface_call m - sizeof(struct NetrMessageNameAdd), - (ndr_push_flags_fn_t) ndr_push_NetrMessageNameAdd, - (ndr_pull_flags_fn_t) ndr_pull_NetrMessageNameAdd, -- (ndr_print_function_t) ndr_print_NetrMessageNameAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -174,7 +174,7 @@ static const struct ndr_interface_call m - sizeof(struct NetrMessageNameEnum), - (ndr_push_flags_fn_t) ndr_push_NetrMessageNameEnum, - (ndr_pull_flags_fn_t) ndr_pull_NetrMessageNameEnum, -- (ndr_print_function_t) ndr_print_NetrMessageNameEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -183,7 +183,7 @@ static const struct ndr_interface_call m - sizeof(struct NetrMessageNameGetInfo), - (ndr_push_flags_fn_t) ndr_push_NetrMessageNameGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_NetrMessageNameGetInfo, -- (ndr_print_function_t) ndr_print_NetrMessageNameGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -192,7 +192,7 @@ static const struct ndr_interface_call m - sizeof(struct NetrMessageNameDel), - (ndr_push_flags_fn_t) ndr_push_NetrMessageNameDel, - (ndr_pull_flags_fn_t) ndr_pull_NetrMessageNameDel, -- (ndr_print_function_t) ndr_print_NetrMessageNameDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -276,7 +276,7 @@ static const struct ndr_interface_call m - sizeof(struct NetrSendMessage), - (ndr_push_flags_fn_t) ndr_push_NetrSendMessage, - (ndr_pull_flags_fn_t) ndr_pull_NetrSendMessage, -- (ndr_print_function_t) ndr_print_NetrSendMessage, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_nbt.c -+++ b/source3/librpc/gen_ndr/ndr_nbt.c -@@ -3671,7 +3671,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_nbt_netlogon_packet), - (ndr_push_flags_fn_t) ndr_push_decode_nbt_netlogon_packet, - (ndr_pull_flags_fn_t) ndr_pull_decode_nbt_netlogon_packet, -- (ndr_print_function_t) ndr_print_decode_nbt_netlogon_packet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_netlogon.c -+++ b/source3/librpc/gen_ndr/ndr_netlogon.c -@@ -17827,7 +17827,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonUasLogon), - (ndr_push_flags_fn_t) ndr_push_netr_LogonUasLogon, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonUasLogon, -- (ndr_print_function_t) ndr_print_netr_LogonUasLogon, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17836,7 +17836,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonUasLogoff), - (ndr_push_flags_fn_t) ndr_push_netr_LogonUasLogoff, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonUasLogoff, -- (ndr_print_function_t) ndr_print_netr_LogonUasLogoff, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17845,7 +17845,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonSamLogon), - (ndr_push_flags_fn_t) ndr_push_netr_LogonSamLogon, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonSamLogon, -- (ndr_print_function_t) ndr_print_netr_LogonSamLogon, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17854,7 +17854,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonSamLogoff), - (ndr_push_flags_fn_t) ndr_push_netr_LogonSamLogoff, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonSamLogoff, -- (ndr_print_function_t) ndr_print_netr_LogonSamLogoff, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17863,7 +17863,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerReqChallenge), - (ndr_push_flags_fn_t) ndr_push_netr_ServerReqChallenge, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerReqChallenge, -- (ndr_print_function_t) ndr_print_netr_ServerReqChallenge, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17872,7 +17872,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerAuthenticate), - (ndr_push_flags_fn_t) ndr_push_netr_ServerAuthenticate, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerAuthenticate, -- (ndr_print_function_t) ndr_print_netr_ServerAuthenticate, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17881,7 +17881,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerPasswordSet), - (ndr_push_flags_fn_t) ndr_push_netr_ServerPasswordSet, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerPasswordSet, -- (ndr_print_function_t) ndr_print_netr_ServerPasswordSet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17890,7 +17890,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DatabaseDeltas), - (ndr_push_flags_fn_t) ndr_push_netr_DatabaseDeltas, - (ndr_pull_flags_fn_t) ndr_pull_netr_DatabaseDeltas, -- (ndr_print_function_t) ndr_print_netr_DatabaseDeltas, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17899,7 +17899,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DatabaseSync), - (ndr_push_flags_fn_t) ndr_push_netr_DatabaseSync, - (ndr_pull_flags_fn_t) ndr_pull_netr_DatabaseSync, -- (ndr_print_function_t) ndr_print_netr_DatabaseSync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17908,7 +17908,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_AccountDeltas), - (ndr_push_flags_fn_t) ndr_push_netr_AccountDeltas, - (ndr_pull_flags_fn_t) ndr_pull_netr_AccountDeltas, -- (ndr_print_function_t) ndr_print_netr_AccountDeltas, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17917,7 +17917,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_AccountSync), - (ndr_push_flags_fn_t) ndr_push_netr_AccountSync, - (ndr_pull_flags_fn_t) ndr_pull_netr_AccountSync, -- (ndr_print_function_t) ndr_print_netr_AccountSync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17926,7 +17926,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_GetDcName), - (ndr_push_flags_fn_t) ndr_push_netr_GetDcName, - (ndr_pull_flags_fn_t) ndr_pull_netr_GetDcName, -- (ndr_print_function_t) ndr_print_netr_GetDcName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17935,7 +17935,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonControl), - (ndr_push_flags_fn_t) ndr_push_netr_LogonControl, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonControl, -- (ndr_print_function_t) ndr_print_netr_LogonControl, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17944,7 +17944,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_GetAnyDCName), - (ndr_push_flags_fn_t) ndr_push_netr_GetAnyDCName, - (ndr_pull_flags_fn_t) ndr_pull_netr_GetAnyDCName, -- (ndr_print_function_t) ndr_print_netr_GetAnyDCName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17953,7 +17953,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonControl2), - (ndr_push_flags_fn_t) ndr_push_netr_LogonControl2, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonControl2, -- (ndr_print_function_t) ndr_print_netr_LogonControl2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17962,7 +17962,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerAuthenticate2), - (ndr_push_flags_fn_t) ndr_push_netr_ServerAuthenticate2, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerAuthenticate2, -- (ndr_print_function_t) ndr_print_netr_ServerAuthenticate2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17971,7 +17971,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DatabaseSync2), - (ndr_push_flags_fn_t) ndr_push_netr_DatabaseSync2, - (ndr_pull_flags_fn_t) ndr_pull_netr_DatabaseSync2, -- (ndr_print_function_t) ndr_print_netr_DatabaseSync2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17980,7 +17980,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DatabaseRedo), - (ndr_push_flags_fn_t) ndr_push_netr_DatabaseRedo, - (ndr_pull_flags_fn_t) ndr_pull_netr_DatabaseRedo, -- (ndr_print_function_t) ndr_print_netr_DatabaseRedo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17989,7 +17989,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonControl2Ex), - (ndr_push_flags_fn_t) ndr_push_netr_LogonControl2Ex, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonControl2Ex, -- (ndr_print_function_t) ndr_print_netr_LogonControl2Ex, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -17998,7 +17998,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NetrEnumerateTrustedDomains), - (ndr_push_flags_fn_t) ndr_push_netr_NetrEnumerateTrustedDomains, - (ndr_pull_flags_fn_t) ndr_pull_netr_NetrEnumerateTrustedDomains, -- (ndr_print_function_t) ndr_print_netr_NetrEnumerateTrustedDomains, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18007,7 +18007,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRGetDCName), - (ndr_push_flags_fn_t) ndr_push_netr_DsRGetDCName, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetDCName, -- (ndr_print_function_t) ndr_print_netr_DsRGetDCName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18016,7 +18016,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonGetCapabilities), - (ndr_push_flags_fn_t) ndr_push_netr_LogonGetCapabilities, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonGetCapabilities, -- (ndr_print_function_t) ndr_print_netr_LogonGetCapabilities, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18025,7 +18025,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NETRLOGONSETSERVICEBITS), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONSETSERVICEBITS, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONSETSERVICEBITS, -- (ndr_print_function_t) ndr_print_netr_NETRLOGONSETSERVICEBITS, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18034,7 +18034,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonGetTrustRid), - (ndr_push_flags_fn_t) ndr_push_netr_LogonGetTrustRid, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonGetTrustRid, -- (ndr_print_function_t) ndr_print_netr_LogonGetTrustRid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18043,7 +18043,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NETRLOGONCOMPUTESERVERDIGEST), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONCOMPUTESERVERDIGEST, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONCOMPUTESERVERDIGEST, -- (ndr_print_function_t) ndr_print_netr_NETRLOGONCOMPUTESERVERDIGEST, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18052,7 +18052,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NETRLOGONCOMPUTECLIENTDIGEST), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONCOMPUTECLIENTDIGEST, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONCOMPUTECLIENTDIGEST, -- (ndr_print_function_t) ndr_print_netr_NETRLOGONCOMPUTECLIENTDIGEST, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18061,7 +18061,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerAuthenticate3), - (ndr_push_flags_fn_t) ndr_push_netr_ServerAuthenticate3, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerAuthenticate3, -- (ndr_print_function_t) ndr_print_netr_ServerAuthenticate3, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18070,7 +18070,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRGetDCNameEx), - (ndr_push_flags_fn_t) ndr_push_netr_DsRGetDCNameEx, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetDCNameEx, -- (ndr_print_function_t) ndr_print_netr_DsRGetDCNameEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18079,7 +18079,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRGetSiteName), - (ndr_push_flags_fn_t) ndr_push_netr_DsRGetSiteName, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetSiteName, -- (ndr_print_function_t) ndr_print_netr_DsRGetSiteName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18088,7 +18088,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonGetDomainInfo), - (ndr_push_flags_fn_t) ndr_push_netr_LogonGetDomainInfo, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonGetDomainInfo, -- (ndr_print_function_t) ndr_print_netr_LogonGetDomainInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18097,7 +18097,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerPasswordSet2), - (ndr_push_flags_fn_t) ndr_push_netr_ServerPasswordSet2, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerPasswordSet2, -- (ndr_print_function_t) ndr_print_netr_ServerPasswordSet2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18106,7 +18106,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerPasswordGet), - (ndr_push_flags_fn_t) ndr_push_netr_ServerPasswordGet, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerPasswordGet, -- (ndr_print_function_t) ndr_print_netr_ServerPasswordGet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18115,7 +18115,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NETRLOGONSENDTOSAM), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONSENDTOSAM, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONSENDTOSAM, -- (ndr_print_function_t) ndr_print_netr_NETRLOGONSENDTOSAM, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18124,7 +18124,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRAddressToSitenamesW), - (ndr_push_flags_fn_t) ndr_push_netr_DsRAddressToSitenamesW, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRAddressToSitenamesW, -- (ndr_print_function_t) ndr_print_netr_DsRAddressToSitenamesW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18133,7 +18133,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRGetDCNameEx2), - (ndr_push_flags_fn_t) ndr_push_netr_DsRGetDCNameEx2, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetDCNameEx2, -- (ndr_print_function_t) ndr_print_netr_DsRGetDCNameEx2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18142,7 +18142,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN), - (ndr_push_flags_fn_t) ndr_push_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, -- (ndr_print_function_t) ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18151,7 +18151,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_NetrEnumerateTrustedDomainsEx), - (ndr_push_flags_fn_t) ndr_push_netr_NetrEnumerateTrustedDomainsEx, - (ndr_pull_flags_fn_t) ndr_pull_netr_NetrEnumerateTrustedDomainsEx, -- (ndr_print_function_t) ndr_print_netr_NetrEnumerateTrustedDomainsEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18160,7 +18160,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRAddressToSitenamesExW), - (ndr_push_flags_fn_t) ndr_push_netr_DsRAddressToSitenamesExW, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRAddressToSitenamesExW, -- (ndr_print_function_t) ndr_print_netr_DsRAddressToSitenamesExW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18169,7 +18169,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsrGetDcSiteCoverageW), - (ndr_push_flags_fn_t) ndr_push_netr_DsrGetDcSiteCoverageW, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsrGetDcSiteCoverageW, -- (ndr_print_function_t) ndr_print_netr_DsrGetDcSiteCoverageW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18178,7 +18178,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonSamLogonEx), - (ndr_push_flags_fn_t) ndr_push_netr_LogonSamLogonEx, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonSamLogonEx, -- (ndr_print_function_t) ndr_print_netr_LogonSamLogonEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18187,7 +18187,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsrEnumerateDomainTrusts), - (ndr_push_flags_fn_t) ndr_push_netr_DsrEnumerateDomainTrusts, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsrEnumerateDomainTrusts, -- (ndr_print_function_t) ndr_print_netr_DsrEnumerateDomainTrusts, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18196,7 +18196,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsrDeregisterDNSHostRecords), - (ndr_push_flags_fn_t) ndr_push_netr_DsrDeregisterDNSHostRecords, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsrDeregisterDNSHostRecords, -- (ndr_print_function_t) ndr_print_netr_DsrDeregisterDNSHostRecords, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18205,7 +18205,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerTrustPasswordsGet), - (ndr_push_flags_fn_t) ndr_push_netr_ServerTrustPasswordsGet, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerTrustPasswordsGet, -- (ndr_print_function_t) ndr_print_netr_ServerTrustPasswordsGet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18214,7 +18214,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsRGetForestTrustInformation), - (ndr_push_flags_fn_t) ndr_push_netr_DsRGetForestTrustInformation, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetForestTrustInformation, -- (ndr_print_function_t) ndr_print_netr_DsRGetForestTrustInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18223,7 +18223,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_GetForestTrustInformation), - (ndr_push_flags_fn_t) ndr_push_netr_GetForestTrustInformation, - (ndr_pull_flags_fn_t) ndr_pull_netr_GetForestTrustInformation, -- (ndr_print_function_t) ndr_print_netr_GetForestTrustInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18232,7 +18232,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_LogonSamLogonWithFlags), - (ndr_push_flags_fn_t) ndr_push_netr_LogonSamLogonWithFlags, - (ndr_pull_flags_fn_t) ndr_pull_netr_LogonSamLogonWithFlags, -- (ndr_print_function_t) ndr_print_netr_LogonSamLogonWithFlags, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18241,7 +18241,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_ServerGetTrustInfo), - (ndr_push_flags_fn_t) ndr_push_netr_ServerGetTrustInfo, - (ndr_pull_flags_fn_t) ndr_pull_netr_ServerGetTrustInfo, -- (ndr_print_function_t) ndr_print_netr_ServerGetTrustInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18250,7 +18250,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_Unused47), - (ndr_push_flags_fn_t) ndr_push_netr_Unused47, - (ndr_pull_flags_fn_t) ndr_pull_netr_Unused47, -- (ndr_print_function_t) ndr_print_netr_Unused47, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -18259,7 +18259,7 @@ static const struct ndr_interface_call n - sizeof(struct netr_DsrUpdateReadOnlyServerDnsRecords), - (ndr_push_flags_fn_t) ndr_push_netr_DsrUpdateReadOnlyServerDnsRecords, - (ndr_pull_flags_fn_t) ndr_pull_netr_DsrUpdateReadOnlyServerDnsRecords, -- (ndr_print_function_t) ndr_print_netr_DsrUpdateReadOnlyServerDnsRecords, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_ntlmssp.c -+++ b/source3/librpc/gen_ndr/ndr_ntlmssp.c -@@ -2408,7 +2408,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_NEGOTIATE_MESSAGE), - (ndr_push_flags_fn_t) ndr_push_decode_NEGOTIATE_MESSAGE, - (ndr_pull_flags_fn_t) ndr_pull_decode_NEGOTIATE_MESSAGE, -- (ndr_print_function_t) ndr_print_decode_NEGOTIATE_MESSAGE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2417,7 +2417,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_CHALLENGE_MESSAGE), - (ndr_push_flags_fn_t) ndr_push_decode_CHALLENGE_MESSAGE, - (ndr_pull_flags_fn_t) ndr_pull_decode_CHALLENGE_MESSAGE, -- (ndr_print_function_t) ndr_print_decode_CHALLENGE_MESSAGE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2426,7 +2426,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_AUTHENTICATE_MESSAGE), - (ndr_push_flags_fn_t) ndr_push_decode_AUTHENTICATE_MESSAGE, - (ndr_pull_flags_fn_t) ndr_pull_decode_AUTHENTICATE_MESSAGE, -- (ndr_print_function_t) ndr_print_decode_AUTHENTICATE_MESSAGE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2435,7 +2435,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_NTLMv2_CLIENT_CHALLENGE), - (ndr_push_flags_fn_t) ndr_push_decode_NTLMv2_CLIENT_CHALLENGE, - (ndr_pull_flags_fn_t) ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE, -- (ndr_print_function_t) ndr_print_decode_NTLMv2_CLIENT_CHALLENGE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2444,7 +2444,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_NTLMv2_RESPONSE), - (ndr_push_flags_fn_t) ndr_push_decode_NTLMv2_RESPONSE, - (ndr_pull_flags_fn_t) ndr_pull_decode_NTLMv2_RESPONSE, -- (ndr_print_function_t) ndr_print_decode_NTLMv2_RESPONSE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_ntprinting.c -+++ b/source3/librpc/gen_ndr/ndr_ntprinting.c -@@ -902,7 +902,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_ntprinting_form), - (ndr_push_flags_fn_t) ndr_push_decode_ntprinting_form, - (ndr_pull_flags_fn_t) ndr_pull_decode_ntprinting_form, -- (ndr_print_function_t) ndr_print_decode_ntprinting_form, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -911,7 +911,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_ntprinting_driver), - (ndr_push_flags_fn_t) ndr_push_decode_ntprinting_driver, - (ndr_pull_flags_fn_t) ndr_pull_decode_ntprinting_driver, -- (ndr_print_function_t) ndr_print_decode_ntprinting_driver, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -920,7 +920,7 @@ static const struct ndr_interface_call n - sizeof(struct decode_ntprinting_printer), - (ndr_push_flags_fn_t) ndr_push_decode_ntprinting_printer, - (ndr_pull_flags_fn_t) ndr_pull_decode_ntprinting_printer, -- (ndr_print_function_t) ndr_print_decode_ntprinting_printer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_ntsvcs.c -+++ b/source3/librpc/gen_ndr/ndr_ntsvcs.c -@@ -3466,7 +3466,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_Disconnect), - (ndr_push_flags_fn_t) ndr_push_PNP_Disconnect, - (ndr_pull_flags_fn_t) ndr_pull_PNP_Disconnect, -- (ndr_print_function_t) ndr_print_PNP_Disconnect, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3475,7 +3475,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_Connect), - (ndr_push_flags_fn_t) ndr_push_PNP_Connect, - (ndr_pull_flags_fn_t) ndr_pull_PNP_Connect, -- (ndr_print_function_t) ndr_print_PNP_Connect, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3484,7 +3484,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetVersion), - (ndr_push_flags_fn_t) ndr_push_PNP_GetVersion, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetVersion, -- (ndr_print_function_t) ndr_print_PNP_GetVersion, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3493,7 +3493,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetGlobalState), - (ndr_push_flags_fn_t) ndr_push_PNP_GetGlobalState, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetGlobalState, -- (ndr_print_function_t) ndr_print_PNP_GetGlobalState, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3502,7 +3502,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_InitDetection), - (ndr_push_flags_fn_t) ndr_push_PNP_InitDetection, - (ndr_pull_flags_fn_t) ndr_pull_PNP_InitDetection, -- (ndr_print_function_t) ndr_print_PNP_InitDetection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3511,7 +3511,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_ReportLogOn), - (ndr_push_flags_fn_t) ndr_push_PNP_ReportLogOn, - (ndr_pull_flags_fn_t) ndr_pull_PNP_ReportLogOn, -- (ndr_print_function_t) ndr_print_PNP_ReportLogOn, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3520,7 +3520,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_ValidateDeviceInstance), - (ndr_push_flags_fn_t) ndr_push_PNP_ValidateDeviceInstance, - (ndr_pull_flags_fn_t) ndr_pull_PNP_ValidateDeviceInstance, -- (ndr_print_function_t) ndr_print_PNP_ValidateDeviceInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3529,7 +3529,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetRootDeviceInstance), - (ndr_push_flags_fn_t) ndr_push_PNP_GetRootDeviceInstance, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetRootDeviceInstance, -- (ndr_print_function_t) ndr_print_PNP_GetRootDeviceInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3538,7 +3538,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetRelatedDeviceInstance), - (ndr_push_flags_fn_t) ndr_push_PNP_GetRelatedDeviceInstance, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetRelatedDeviceInstance, -- (ndr_print_function_t) ndr_print_PNP_GetRelatedDeviceInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3547,7 +3547,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_EnumerateSubKeys), - (ndr_push_flags_fn_t) ndr_push_PNP_EnumerateSubKeys, - (ndr_pull_flags_fn_t) ndr_pull_PNP_EnumerateSubKeys, -- (ndr_print_function_t) ndr_print_PNP_EnumerateSubKeys, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3556,7 +3556,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetDeviceList), - (ndr_push_flags_fn_t) ndr_push_PNP_GetDeviceList, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetDeviceList, -- (ndr_print_function_t) ndr_print_PNP_GetDeviceList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3565,7 +3565,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetDeviceListSize), - (ndr_push_flags_fn_t) ndr_push_PNP_GetDeviceListSize, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetDeviceListSize, -- (ndr_print_function_t) ndr_print_PNP_GetDeviceListSize, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3574,7 +3574,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetDepth), - (ndr_push_flags_fn_t) ndr_push_PNP_GetDepth, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetDepth, -- (ndr_print_function_t) ndr_print_PNP_GetDepth, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3583,7 +3583,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetDeviceRegProp), - (ndr_push_flags_fn_t) ndr_push_PNP_GetDeviceRegProp, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetDeviceRegProp, -- (ndr_print_function_t) ndr_print_PNP_GetDeviceRegProp, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3592,7 +3592,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_SetDeviceRegProp), - (ndr_push_flags_fn_t) ndr_push_PNP_SetDeviceRegProp, - (ndr_pull_flags_fn_t) ndr_pull_PNP_SetDeviceRegProp, -- (ndr_print_function_t) ndr_print_PNP_SetDeviceRegProp, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3601,7 +3601,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetClassInstance), - (ndr_push_flags_fn_t) ndr_push_PNP_GetClassInstance, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetClassInstance, -- (ndr_print_function_t) ndr_print_PNP_GetClassInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3610,7 +3610,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_CreateKey), - (ndr_push_flags_fn_t) ndr_push_PNP_CreateKey, - (ndr_pull_flags_fn_t) ndr_pull_PNP_CreateKey, -- (ndr_print_function_t) ndr_print_PNP_CreateKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3619,7 +3619,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_DeleteRegistryKey), - (ndr_push_flags_fn_t) ndr_push_PNP_DeleteRegistryKey, - (ndr_pull_flags_fn_t) ndr_pull_PNP_DeleteRegistryKey, -- (ndr_print_function_t) ndr_print_PNP_DeleteRegistryKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3628,7 +3628,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetClassCount), - (ndr_push_flags_fn_t) ndr_push_PNP_GetClassCount, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetClassCount, -- (ndr_print_function_t) ndr_print_PNP_GetClassCount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3637,7 +3637,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetClassName), - (ndr_push_flags_fn_t) ndr_push_PNP_GetClassName, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetClassName, -- (ndr_print_function_t) ndr_print_PNP_GetClassName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3646,7 +3646,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_DeleteClassKey), - (ndr_push_flags_fn_t) ndr_push_PNP_DeleteClassKey, - (ndr_pull_flags_fn_t) ndr_pull_PNP_DeleteClassKey, -- (ndr_print_function_t) ndr_print_PNP_DeleteClassKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3655,7 +3655,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetInterfaceDeviceAlias), - (ndr_push_flags_fn_t) ndr_push_PNP_GetInterfaceDeviceAlias, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetInterfaceDeviceAlias, -- (ndr_print_function_t) ndr_print_PNP_GetInterfaceDeviceAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3664,7 +3664,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetInterfaceDeviceList), - (ndr_push_flags_fn_t) ndr_push_PNP_GetInterfaceDeviceList, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetInterfaceDeviceList, -- (ndr_print_function_t) ndr_print_PNP_GetInterfaceDeviceList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3673,7 +3673,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetInterfaceDeviceListSize), - (ndr_push_flags_fn_t) ndr_push_PNP_GetInterfaceDeviceListSize, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetInterfaceDeviceListSize, -- (ndr_print_function_t) ndr_print_PNP_GetInterfaceDeviceListSize, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3682,7 +3682,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_RegisterDeviceClassAssociation), - (ndr_push_flags_fn_t) ndr_push_PNP_RegisterDeviceClassAssociation, - (ndr_pull_flags_fn_t) ndr_pull_PNP_RegisterDeviceClassAssociation, -- (ndr_print_function_t) ndr_print_PNP_RegisterDeviceClassAssociation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3691,7 +3691,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_UnregisterDeviceClassAssociation), - (ndr_push_flags_fn_t) ndr_push_PNP_UnregisterDeviceClassAssociation, - (ndr_pull_flags_fn_t) ndr_pull_PNP_UnregisterDeviceClassAssociation, -- (ndr_print_function_t) ndr_print_PNP_UnregisterDeviceClassAssociation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3700,7 +3700,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetClassRegProp), - (ndr_push_flags_fn_t) ndr_push_PNP_GetClassRegProp, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetClassRegProp, -- (ndr_print_function_t) ndr_print_PNP_GetClassRegProp, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3709,7 +3709,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_SetClassRegProp), - (ndr_push_flags_fn_t) ndr_push_PNP_SetClassRegProp, - (ndr_pull_flags_fn_t) ndr_pull_PNP_SetClassRegProp, -- (ndr_print_function_t) ndr_print_PNP_SetClassRegProp, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3718,7 +3718,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_CreateDevInst), - (ndr_push_flags_fn_t) ndr_push_PNP_CreateDevInst, - (ndr_pull_flags_fn_t) ndr_pull_PNP_CreateDevInst, -- (ndr_print_function_t) ndr_print_PNP_CreateDevInst, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3727,7 +3727,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_DeviceInstanceAction), - (ndr_push_flags_fn_t) ndr_push_PNP_DeviceInstanceAction, - (ndr_pull_flags_fn_t) ndr_pull_PNP_DeviceInstanceAction, -- (ndr_print_function_t) ndr_print_PNP_DeviceInstanceAction, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3736,7 +3736,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetDeviceStatus), - (ndr_push_flags_fn_t) ndr_push_PNP_GetDeviceStatus, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetDeviceStatus, -- (ndr_print_function_t) ndr_print_PNP_GetDeviceStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3745,7 +3745,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_SetDeviceProblem), - (ndr_push_flags_fn_t) ndr_push_PNP_SetDeviceProblem, - (ndr_pull_flags_fn_t) ndr_pull_PNP_SetDeviceProblem, -- (ndr_print_function_t) ndr_print_PNP_SetDeviceProblem, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3754,7 +3754,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_DisableDevInst), - (ndr_push_flags_fn_t) ndr_push_PNP_DisableDevInst, - (ndr_pull_flags_fn_t) ndr_pull_PNP_DisableDevInst, -- (ndr_print_function_t) ndr_print_PNP_DisableDevInst, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3763,7 +3763,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_UninstallDevInst), - (ndr_push_flags_fn_t) ndr_push_PNP_UninstallDevInst, - (ndr_pull_flags_fn_t) ndr_pull_PNP_UninstallDevInst, -- (ndr_print_function_t) ndr_print_PNP_UninstallDevInst, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3772,7 +3772,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_AddID), - (ndr_push_flags_fn_t) ndr_push_PNP_AddID, - (ndr_pull_flags_fn_t) ndr_pull_PNP_AddID, -- (ndr_print_function_t) ndr_print_PNP_AddID, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3781,7 +3781,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_RegisterDriver), - (ndr_push_flags_fn_t) ndr_push_PNP_RegisterDriver, - (ndr_pull_flags_fn_t) ndr_pull_PNP_RegisterDriver, -- (ndr_print_function_t) ndr_print_PNP_RegisterDriver, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3790,7 +3790,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_QueryRemove), - (ndr_push_flags_fn_t) ndr_push_PNP_QueryRemove, - (ndr_pull_flags_fn_t) ndr_pull_PNP_QueryRemove, -- (ndr_print_function_t) ndr_print_PNP_QueryRemove, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3799,7 +3799,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_RequestDeviceEject), - (ndr_push_flags_fn_t) ndr_push_PNP_RequestDeviceEject, - (ndr_pull_flags_fn_t) ndr_pull_PNP_RequestDeviceEject, -- (ndr_print_function_t) ndr_print_PNP_RequestDeviceEject, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3808,7 +3808,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_IsDockStationPresent), - (ndr_push_flags_fn_t) ndr_push_PNP_IsDockStationPresent, - (ndr_pull_flags_fn_t) ndr_pull_PNP_IsDockStationPresent, -- (ndr_print_function_t) ndr_print_PNP_IsDockStationPresent, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3817,7 +3817,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_RequestEjectPC), - (ndr_push_flags_fn_t) ndr_push_PNP_RequestEjectPC, - (ndr_pull_flags_fn_t) ndr_pull_PNP_RequestEjectPC, -- (ndr_print_function_t) ndr_print_PNP_RequestEjectPC, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3826,7 +3826,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_HwProfFlags), - (ndr_push_flags_fn_t) ndr_push_PNP_HwProfFlags, - (ndr_pull_flags_fn_t) ndr_pull_PNP_HwProfFlags, -- (ndr_print_function_t) ndr_print_PNP_HwProfFlags, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3835,7 +3835,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetHwProfInfo), - (ndr_push_flags_fn_t) ndr_push_PNP_GetHwProfInfo, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetHwProfInfo, -- (ndr_print_function_t) ndr_print_PNP_GetHwProfInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3844,7 +3844,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_AddEmptyLogConf), - (ndr_push_flags_fn_t) ndr_push_PNP_AddEmptyLogConf, - (ndr_pull_flags_fn_t) ndr_pull_PNP_AddEmptyLogConf, -- (ndr_print_function_t) ndr_print_PNP_AddEmptyLogConf, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3853,7 +3853,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_FreeLogConf), - (ndr_push_flags_fn_t) ndr_push_PNP_FreeLogConf, - (ndr_pull_flags_fn_t) ndr_pull_PNP_FreeLogConf, -- (ndr_print_function_t) ndr_print_PNP_FreeLogConf, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3862,7 +3862,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetFirstLogConf), - (ndr_push_flags_fn_t) ndr_push_PNP_GetFirstLogConf, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetFirstLogConf, -- (ndr_print_function_t) ndr_print_PNP_GetFirstLogConf, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3871,7 +3871,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetNextLogConf), - (ndr_push_flags_fn_t) ndr_push_PNP_GetNextLogConf, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetNextLogConf, -- (ndr_print_function_t) ndr_print_PNP_GetNextLogConf, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3880,7 +3880,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetLogConfPriority), - (ndr_push_flags_fn_t) ndr_push_PNP_GetLogConfPriority, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetLogConfPriority, -- (ndr_print_function_t) ndr_print_PNP_GetLogConfPriority, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3889,7 +3889,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_AddResDes), - (ndr_push_flags_fn_t) ndr_push_PNP_AddResDes, - (ndr_pull_flags_fn_t) ndr_pull_PNP_AddResDes, -- (ndr_print_function_t) ndr_print_PNP_AddResDes, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3898,7 +3898,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_FreeResDes), - (ndr_push_flags_fn_t) ndr_push_PNP_FreeResDes, - (ndr_pull_flags_fn_t) ndr_pull_PNP_FreeResDes, -- (ndr_print_function_t) ndr_print_PNP_FreeResDes, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3907,7 +3907,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetNextResDes), - (ndr_push_flags_fn_t) ndr_push_PNP_GetNextResDes, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetNextResDes, -- (ndr_print_function_t) ndr_print_PNP_GetNextResDes, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3916,7 +3916,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetResDesData), - (ndr_push_flags_fn_t) ndr_push_PNP_GetResDesData, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetResDesData, -- (ndr_print_function_t) ndr_print_PNP_GetResDesData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3925,7 +3925,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetResDesDataSize), - (ndr_push_flags_fn_t) ndr_push_PNP_GetResDesDataSize, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetResDesDataSize, -- (ndr_print_function_t) ndr_print_PNP_GetResDesDataSize, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3934,7 +3934,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_ModifyResDes), - (ndr_push_flags_fn_t) ndr_push_PNP_ModifyResDes, - (ndr_pull_flags_fn_t) ndr_pull_PNP_ModifyResDes, -- (ndr_print_function_t) ndr_print_PNP_ModifyResDes, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3943,7 +3943,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_DetectResourceLimit), - (ndr_push_flags_fn_t) ndr_push_PNP_DetectResourceLimit, - (ndr_pull_flags_fn_t) ndr_pull_PNP_DetectResourceLimit, -- (ndr_print_function_t) ndr_print_PNP_DetectResourceLimit, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3952,7 +3952,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_QueryResConfList), - (ndr_push_flags_fn_t) ndr_push_PNP_QueryResConfList, - (ndr_pull_flags_fn_t) ndr_pull_PNP_QueryResConfList, -- (ndr_print_function_t) ndr_print_PNP_QueryResConfList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3961,7 +3961,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_SetHwProf), - (ndr_push_flags_fn_t) ndr_push_PNP_SetHwProf, - (ndr_pull_flags_fn_t) ndr_pull_PNP_SetHwProf, -- (ndr_print_function_t) ndr_print_PNP_SetHwProf, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3970,7 +3970,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_QueryArbitratorFreeData), - (ndr_push_flags_fn_t) ndr_push_PNP_QueryArbitratorFreeData, - (ndr_pull_flags_fn_t) ndr_pull_PNP_QueryArbitratorFreeData, -- (ndr_print_function_t) ndr_print_PNP_QueryArbitratorFreeData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3979,7 +3979,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_QueryArbitratorFreeSize), - (ndr_push_flags_fn_t) ndr_push_PNP_QueryArbitratorFreeSize, - (ndr_pull_flags_fn_t) ndr_pull_PNP_QueryArbitratorFreeSize, -- (ndr_print_function_t) ndr_print_PNP_QueryArbitratorFreeSize, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3988,7 +3988,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_RunDetection), - (ndr_push_flags_fn_t) ndr_push_PNP_RunDetection, - (ndr_pull_flags_fn_t) ndr_pull_PNP_RunDetection, -- (ndr_print_function_t) ndr_print_PNP_RunDetection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3997,7 +3997,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_RegisterNotification), - (ndr_push_flags_fn_t) ndr_push_PNP_RegisterNotification, - (ndr_pull_flags_fn_t) ndr_pull_PNP_RegisterNotification, -- (ndr_print_function_t) ndr_print_PNP_RegisterNotification, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4006,7 +4006,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_UnregisterNotification), - (ndr_push_flags_fn_t) ndr_push_PNP_UnregisterNotification, - (ndr_pull_flags_fn_t) ndr_pull_PNP_UnregisterNotification, -- (ndr_print_function_t) ndr_print_PNP_UnregisterNotification, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4015,7 +4015,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetCustomDevProp), - (ndr_push_flags_fn_t) ndr_push_PNP_GetCustomDevProp, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetCustomDevProp, -- (ndr_print_function_t) ndr_print_PNP_GetCustomDevProp, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4024,7 +4024,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetVersionInternal), - (ndr_push_flags_fn_t) ndr_push_PNP_GetVersionInternal, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetVersionInternal, -- (ndr_print_function_t) ndr_print_PNP_GetVersionInternal, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4033,7 +4033,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetBlockedDriverInfo), - (ndr_push_flags_fn_t) ndr_push_PNP_GetBlockedDriverInfo, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetBlockedDriverInfo, -- (ndr_print_function_t) ndr_print_PNP_GetBlockedDriverInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4042,7 +4042,7 @@ static const struct ndr_interface_call n - sizeof(struct PNP_GetServerSideDeviceInstallFlags), - (ndr_push_flags_fn_t) ndr_push_PNP_GetServerSideDeviceInstallFlags, - (ndr_pull_flags_fn_t) ndr_pull_PNP_GetServerSideDeviceInstallFlags, -- (ndr_print_function_t) ndr_print_PNP_GetServerSideDeviceInstallFlags, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_oxidresolver.c -+++ b/source3/librpc/gen_ndr/ndr_oxidresolver.c -@@ -761,7 +761,7 @@ static const struct ndr_interface_call I - sizeof(struct ResolveOxid), - (ndr_push_flags_fn_t) ndr_push_ResolveOxid, - (ndr_pull_flags_fn_t) ndr_pull_ResolveOxid, -- (ndr_print_function_t) ndr_print_ResolveOxid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -770,7 +770,7 @@ static const struct ndr_interface_call I - sizeof(struct SimplePing), - (ndr_push_flags_fn_t) ndr_push_SimplePing, - (ndr_pull_flags_fn_t) ndr_pull_SimplePing, -- (ndr_print_function_t) ndr_print_SimplePing, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -779,7 +779,7 @@ static const struct ndr_interface_call I - sizeof(struct ComplexPing), - (ndr_push_flags_fn_t) ndr_push_ComplexPing, - (ndr_pull_flags_fn_t) ndr_pull_ComplexPing, -- (ndr_print_function_t) ndr_print_ComplexPing, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -788,7 +788,7 @@ static const struct ndr_interface_call I - sizeof(struct ServerAlive), - (ndr_push_flags_fn_t) ndr_push_ServerAlive, - (ndr_pull_flags_fn_t) ndr_pull_ServerAlive, -- (ndr_print_function_t) ndr_print_ServerAlive, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -797,7 +797,7 @@ static const struct ndr_interface_call I - sizeof(struct ResolveOxid2), - (ndr_push_flags_fn_t) ndr_push_ResolveOxid2, - (ndr_pull_flags_fn_t) ndr_pull_ResolveOxid2, -- (ndr_print_function_t) ndr_print_ResolveOxid2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -806,7 +806,7 @@ static const struct ndr_interface_call I - sizeof(struct ServerAlive2), - (ndr_push_flags_fn_t) ndr_push_ServerAlive2, - (ndr_pull_flags_fn_t) ndr_pull_ServerAlive2, -- (ndr_print_function_t) ndr_print_ServerAlive2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_policyagent.c -+++ b/source3/librpc/gen_ndr/ndr_policyagent.c -@@ -51,7 +51,7 @@ static const struct ndr_interface_call p - sizeof(struct policyagent_Dummy), - (ndr_push_flags_fn_t) ndr_push_policyagent_Dummy, - (ndr_pull_flags_fn_t) ndr_pull_policyagent_Dummy, -- (ndr_print_function_t) ndr_print_policyagent_Dummy, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_preg.c -+++ b/source3/librpc/gen_ndr/ndr_preg.c -@@ -204,7 +204,7 @@ static const struct ndr_interface_call p - sizeof(struct decode_preg_file), - (ndr_push_flags_fn_t) ndr_push_decode_preg_file, - (ndr_pull_flags_fn_t) ndr_pull_decode_preg_file, -- (ndr_print_function_t) ndr_print_decode_preg_file, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_remact.c -+++ b/source3/librpc/gen_ndr/ndr_remact.c -@@ -373,7 +373,7 @@ static const struct ndr_interface_call I - sizeof(struct RemoteActivation), - (ndr_push_flags_fn_t) ndr_push_RemoteActivation, - (ndr_pull_flags_fn_t) ndr_pull_RemoteActivation, -- (ndr_print_function_t) ndr_print_RemoteActivation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_rot.c -+++ b/source3/librpc/gen_ndr/ndr_rot.c -@@ -489,7 +489,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_add), - (ndr_push_flags_fn_t) ndr_push_rot_add, - (ndr_pull_flags_fn_t) ndr_pull_rot_add, -- (ndr_print_function_t) ndr_print_rot_add, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -498,7 +498,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_remove), - (ndr_push_flags_fn_t) ndr_push_rot_remove, - (ndr_pull_flags_fn_t) ndr_pull_rot_remove, -- (ndr_print_function_t) ndr_print_rot_remove, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -507,7 +507,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_is_listed), - (ndr_push_flags_fn_t) ndr_push_rot_is_listed, - (ndr_pull_flags_fn_t) ndr_pull_rot_is_listed, -- (ndr_print_function_t) ndr_print_rot_is_listed, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -516,7 +516,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_get_interface_pointer), - (ndr_push_flags_fn_t) ndr_push_rot_get_interface_pointer, - (ndr_pull_flags_fn_t) ndr_pull_rot_get_interface_pointer, -- (ndr_print_function_t) ndr_print_rot_get_interface_pointer, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -525,7 +525,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_set_modification_time), - (ndr_push_flags_fn_t) ndr_push_rot_set_modification_time, - (ndr_pull_flags_fn_t) ndr_pull_rot_set_modification_time, -- (ndr_print_function_t) ndr_print_rot_set_modification_time, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -534,7 +534,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_get_modification_time), - (ndr_push_flags_fn_t) ndr_push_rot_get_modification_time, - (ndr_pull_flags_fn_t) ndr_pull_rot_get_modification_time, -- (ndr_print_function_t) ndr_print_rot_get_modification_time, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -543,7 +543,7 @@ static const struct ndr_interface_call r - sizeof(struct rot_enum), - (ndr_push_flags_fn_t) ndr_push_rot_enum, - (ndr_pull_flags_fn_t) ndr_pull_rot_enum, -- (ndr_print_function_t) ndr_print_rot_enum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_samr.c -+++ b/source3/librpc/gen_ndr/ndr_samr.c -@@ -12674,7 +12674,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Connect), - (ndr_push_flags_fn_t) ndr_push_samr_Connect, - (ndr_pull_flags_fn_t) ndr_pull_samr_Connect, -- (ndr_print_function_t) ndr_print_samr_Connect, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12683,7 +12683,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Close), - (ndr_push_flags_fn_t) ndr_push_samr_Close, - (ndr_pull_flags_fn_t) ndr_pull_samr_Close, -- (ndr_print_function_t) ndr_print_samr_Close, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12692,7 +12692,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetSecurity), - (ndr_push_flags_fn_t) ndr_push_samr_SetSecurity, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetSecurity, -- (ndr_print_function_t) ndr_print_samr_SetSecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12701,7 +12701,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QuerySecurity), - (ndr_push_flags_fn_t) ndr_push_samr_QuerySecurity, - (ndr_pull_flags_fn_t) ndr_pull_samr_QuerySecurity, -- (ndr_print_function_t) ndr_print_samr_QuerySecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12710,7 +12710,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Shutdown), - (ndr_push_flags_fn_t) ndr_push_samr_Shutdown, - (ndr_pull_flags_fn_t) ndr_pull_samr_Shutdown, -- (ndr_print_function_t) ndr_print_samr_Shutdown, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12719,7 +12719,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_LookupDomain), - (ndr_push_flags_fn_t) ndr_push_samr_LookupDomain, - (ndr_pull_flags_fn_t) ndr_pull_samr_LookupDomain, -- (ndr_print_function_t) ndr_print_samr_LookupDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12728,7 +12728,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_EnumDomains), - (ndr_push_flags_fn_t) ndr_push_samr_EnumDomains, - (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomains, -- (ndr_print_function_t) ndr_print_samr_EnumDomains, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12737,7 +12737,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_OpenDomain), - (ndr_push_flags_fn_t) ndr_push_samr_OpenDomain, - (ndr_pull_flags_fn_t) ndr_pull_samr_OpenDomain, -- (ndr_print_function_t) ndr_print_samr_OpenDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12746,7 +12746,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryDomainInfo), - (ndr_push_flags_fn_t) ndr_push_samr_QueryDomainInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDomainInfo, -- (ndr_print_function_t) ndr_print_samr_QueryDomainInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12755,7 +12755,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetDomainInfo), - (ndr_push_flags_fn_t) ndr_push_samr_SetDomainInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetDomainInfo, -- (ndr_print_function_t) ndr_print_samr_SetDomainInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12764,7 +12764,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_CreateDomainGroup), - (ndr_push_flags_fn_t) ndr_push_samr_CreateDomainGroup, - (ndr_pull_flags_fn_t) ndr_pull_samr_CreateDomainGroup, -- (ndr_print_function_t) ndr_print_samr_CreateDomainGroup, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12773,7 +12773,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_EnumDomainGroups), - (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainGroups, - (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainGroups, -- (ndr_print_function_t) ndr_print_samr_EnumDomainGroups, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12782,7 +12782,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_CreateUser), - (ndr_push_flags_fn_t) ndr_push_samr_CreateUser, - (ndr_pull_flags_fn_t) ndr_pull_samr_CreateUser, -- (ndr_print_function_t) ndr_print_samr_CreateUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12791,7 +12791,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_EnumDomainUsers), - (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainUsers, - (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainUsers, -- (ndr_print_function_t) ndr_print_samr_EnumDomainUsers, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12800,7 +12800,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_CreateDomAlias), - (ndr_push_flags_fn_t) ndr_push_samr_CreateDomAlias, - (ndr_pull_flags_fn_t) ndr_pull_samr_CreateDomAlias, -- (ndr_print_function_t) ndr_print_samr_CreateDomAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12809,7 +12809,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_EnumDomainAliases), - (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainAliases, - (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainAliases, -- (ndr_print_function_t) ndr_print_samr_EnumDomainAliases, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12818,7 +12818,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetAliasMembership), - (ndr_push_flags_fn_t) ndr_push_samr_GetAliasMembership, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetAliasMembership, -- (ndr_print_function_t) ndr_print_samr_GetAliasMembership, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12827,7 +12827,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_LookupNames), - (ndr_push_flags_fn_t) ndr_push_samr_LookupNames, - (ndr_pull_flags_fn_t) ndr_pull_samr_LookupNames, -- (ndr_print_function_t) ndr_print_samr_LookupNames, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12836,7 +12836,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_LookupRids), - (ndr_push_flags_fn_t) ndr_push_samr_LookupRids, - (ndr_pull_flags_fn_t) ndr_pull_samr_LookupRids, -- (ndr_print_function_t) ndr_print_samr_LookupRids, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12845,7 +12845,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_OpenGroup), - (ndr_push_flags_fn_t) ndr_push_samr_OpenGroup, - (ndr_pull_flags_fn_t) ndr_pull_samr_OpenGroup, -- (ndr_print_function_t) ndr_print_samr_OpenGroup, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12854,7 +12854,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryGroupInfo), - (ndr_push_flags_fn_t) ndr_push_samr_QueryGroupInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryGroupInfo, -- (ndr_print_function_t) ndr_print_samr_QueryGroupInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12863,7 +12863,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetGroupInfo), - (ndr_push_flags_fn_t) ndr_push_samr_SetGroupInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetGroupInfo, -- (ndr_print_function_t) ndr_print_samr_SetGroupInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12872,7 +12872,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_AddGroupMember), - (ndr_push_flags_fn_t) ndr_push_samr_AddGroupMember, - (ndr_pull_flags_fn_t) ndr_pull_samr_AddGroupMember, -- (ndr_print_function_t) ndr_print_samr_AddGroupMember, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12881,7 +12881,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_DeleteDomainGroup), - (ndr_push_flags_fn_t) ndr_push_samr_DeleteDomainGroup, - (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteDomainGroup, -- (ndr_print_function_t) ndr_print_samr_DeleteDomainGroup, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12890,7 +12890,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_DeleteGroupMember), - (ndr_push_flags_fn_t) ndr_push_samr_DeleteGroupMember, - (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteGroupMember, -- (ndr_print_function_t) ndr_print_samr_DeleteGroupMember, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12899,7 +12899,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryGroupMember), - (ndr_push_flags_fn_t) ndr_push_samr_QueryGroupMember, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryGroupMember, -- (ndr_print_function_t) ndr_print_samr_QueryGroupMember, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12908,7 +12908,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetMemberAttributesOfGroup), - (ndr_push_flags_fn_t) ndr_push_samr_SetMemberAttributesOfGroup, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetMemberAttributesOfGroup, -- (ndr_print_function_t) ndr_print_samr_SetMemberAttributesOfGroup, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12917,7 +12917,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_OpenAlias), - (ndr_push_flags_fn_t) ndr_push_samr_OpenAlias, - (ndr_pull_flags_fn_t) ndr_pull_samr_OpenAlias, -- (ndr_print_function_t) ndr_print_samr_OpenAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12926,7 +12926,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryAliasInfo), - (ndr_push_flags_fn_t) ndr_push_samr_QueryAliasInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryAliasInfo, -- (ndr_print_function_t) ndr_print_samr_QueryAliasInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12935,7 +12935,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetAliasInfo), - (ndr_push_flags_fn_t) ndr_push_samr_SetAliasInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetAliasInfo, -- (ndr_print_function_t) ndr_print_samr_SetAliasInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12944,7 +12944,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_DeleteDomAlias), - (ndr_push_flags_fn_t) ndr_push_samr_DeleteDomAlias, - (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteDomAlias, -- (ndr_print_function_t) ndr_print_samr_DeleteDomAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12953,7 +12953,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_AddAliasMember), - (ndr_push_flags_fn_t) ndr_push_samr_AddAliasMember, - (ndr_pull_flags_fn_t) ndr_pull_samr_AddAliasMember, -- (ndr_print_function_t) ndr_print_samr_AddAliasMember, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12962,7 +12962,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_DeleteAliasMember), - (ndr_push_flags_fn_t) ndr_push_samr_DeleteAliasMember, - (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteAliasMember, -- (ndr_print_function_t) ndr_print_samr_DeleteAliasMember, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12971,7 +12971,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetMembersInAlias), - (ndr_push_flags_fn_t) ndr_push_samr_GetMembersInAlias, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetMembersInAlias, -- (ndr_print_function_t) ndr_print_samr_GetMembersInAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12980,7 +12980,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_OpenUser), - (ndr_push_flags_fn_t) ndr_push_samr_OpenUser, - (ndr_pull_flags_fn_t) ndr_pull_samr_OpenUser, -- (ndr_print_function_t) ndr_print_samr_OpenUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12989,7 +12989,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_DeleteUser), - (ndr_push_flags_fn_t) ndr_push_samr_DeleteUser, - (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteUser, -- (ndr_print_function_t) ndr_print_samr_DeleteUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -12998,7 +12998,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryUserInfo), - (ndr_push_flags_fn_t) ndr_push_samr_QueryUserInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryUserInfo, -- (ndr_print_function_t) ndr_print_samr_QueryUserInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13007,7 +13007,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetUserInfo), - (ndr_push_flags_fn_t) ndr_push_samr_SetUserInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetUserInfo, -- (ndr_print_function_t) ndr_print_samr_SetUserInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13016,7 +13016,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_ChangePasswordUser), - (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser, - (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser, -- (ndr_print_function_t) ndr_print_samr_ChangePasswordUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13025,7 +13025,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetGroupsForUser), - (ndr_push_flags_fn_t) ndr_push_samr_GetGroupsForUser, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetGroupsForUser, -- (ndr_print_function_t) ndr_print_samr_GetGroupsForUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13034,7 +13034,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryDisplayInfo), - (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo, -- (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13043,7 +13043,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetDisplayEnumerationIndex), - (ndr_push_flags_fn_t) ndr_push_samr_GetDisplayEnumerationIndex, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetDisplayEnumerationIndex, -- (ndr_print_function_t) ndr_print_samr_GetDisplayEnumerationIndex, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13052,7 +13052,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_TestPrivateFunctionsDomain), - (ndr_push_flags_fn_t) ndr_push_samr_TestPrivateFunctionsDomain, - (ndr_pull_flags_fn_t) ndr_pull_samr_TestPrivateFunctionsDomain, -- (ndr_print_function_t) ndr_print_samr_TestPrivateFunctionsDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13061,7 +13061,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_TestPrivateFunctionsUser), - (ndr_push_flags_fn_t) ndr_push_samr_TestPrivateFunctionsUser, - (ndr_pull_flags_fn_t) ndr_pull_samr_TestPrivateFunctionsUser, -- (ndr_print_function_t) ndr_print_samr_TestPrivateFunctionsUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13070,7 +13070,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetUserPwInfo), - (ndr_push_flags_fn_t) ndr_push_samr_GetUserPwInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetUserPwInfo, -- (ndr_print_function_t) ndr_print_samr_GetUserPwInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13079,7 +13079,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_RemoveMemberFromForeignDomain), - (ndr_push_flags_fn_t) ndr_push_samr_RemoveMemberFromForeignDomain, - (ndr_pull_flags_fn_t) ndr_pull_samr_RemoveMemberFromForeignDomain, -- (ndr_print_function_t) ndr_print_samr_RemoveMemberFromForeignDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13088,7 +13088,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryDomainInfo2), - (ndr_push_flags_fn_t) ndr_push_samr_QueryDomainInfo2, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDomainInfo2, -- (ndr_print_function_t) ndr_print_samr_QueryDomainInfo2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13097,7 +13097,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryUserInfo2), - (ndr_push_flags_fn_t) ndr_push_samr_QueryUserInfo2, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryUserInfo2, -- (ndr_print_function_t) ndr_print_samr_QueryUserInfo2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13106,7 +13106,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryDisplayInfo2), - (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo2, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo2, -- (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13115,7 +13115,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetDisplayEnumerationIndex2), - (ndr_push_flags_fn_t) ndr_push_samr_GetDisplayEnumerationIndex2, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetDisplayEnumerationIndex2, -- (ndr_print_function_t) ndr_print_samr_GetDisplayEnumerationIndex2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13124,7 +13124,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_CreateUser2), - (ndr_push_flags_fn_t) ndr_push_samr_CreateUser2, - (ndr_pull_flags_fn_t) ndr_pull_samr_CreateUser2, -- (ndr_print_function_t) ndr_print_samr_CreateUser2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13133,7 +13133,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_QueryDisplayInfo3), - (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo3, - (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo3, -- (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo3, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13142,7 +13142,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_AddMultipleMembersToAlias), - (ndr_push_flags_fn_t) ndr_push_samr_AddMultipleMembersToAlias, - (ndr_pull_flags_fn_t) ndr_pull_samr_AddMultipleMembersToAlias, -- (ndr_print_function_t) ndr_print_samr_AddMultipleMembersToAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13151,7 +13151,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_RemoveMultipleMembersFromAlias), - (ndr_push_flags_fn_t) ndr_push_samr_RemoveMultipleMembersFromAlias, - (ndr_pull_flags_fn_t) ndr_pull_samr_RemoveMultipleMembersFromAlias, -- (ndr_print_function_t) ndr_print_samr_RemoveMultipleMembersFromAlias, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13160,7 +13160,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_OemChangePasswordUser2), - (ndr_push_flags_fn_t) ndr_push_samr_OemChangePasswordUser2, - (ndr_pull_flags_fn_t) ndr_pull_samr_OemChangePasswordUser2, -- (ndr_print_function_t) ndr_print_samr_OemChangePasswordUser2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13169,7 +13169,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_ChangePasswordUser2), - (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser2, - (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser2, -- (ndr_print_function_t) ndr_print_samr_ChangePasswordUser2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13178,7 +13178,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetDomPwInfo), - (ndr_push_flags_fn_t) ndr_push_samr_GetDomPwInfo, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetDomPwInfo, -- (ndr_print_function_t) ndr_print_samr_GetDomPwInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13187,7 +13187,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Connect2), - (ndr_push_flags_fn_t) ndr_push_samr_Connect2, - (ndr_pull_flags_fn_t) ndr_pull_samr_Connect2, -- (ndr_print_function_t) ndr_print_samr_Connect2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13196,7 +13196,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetUserInfo2), - (ndr_push_flags_fn_t) ndr_push_samr_SetUserInfo2, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetUserInfo2, -- (ndr_print_function_t) ndr_print_samr_SetUserInfo2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13205,7 +13205,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetBootKeyInformation), - (ndr_push_flags_fn_t) ndr_push_samr_SetBootKeyInformation, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetBootKeyInformation, -- (ndr_print_function_t) ndr_print_samr_SetBootKeyInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13214,7 +13214,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_GetBootKeyInformation), - (ndr_push_flags_fn_t) ndr_push_samr_GetBootKeyInformation, - (ndr_pull_flags_fn_t) ndr_pull_samr_GetBootKeyInformation, -- (ndr_print_function_t) ndr_print_samr_GetBootKeyInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13223,7 +13223,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Connect3), - (ndr_push_flags_fn_t) ndr_push_samr_Connect3, - (ndr_pull_flags_fn_t) ndr_pull_samr_Connect3, -- (ndr_print_function_t) ndr_print_samr_Connect3, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13232,7 +13232,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Connect4), - (ndr_push_flags_fn_t) ndr_push_samr_Connect4, - (ndr_pull_flags_fn_t) ndr_pull_samr_Connect4, -- (ndr_print_function_t) ndr_print_samr_Connect4, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13241,7 +13241,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_ChangePasswordUser3), - (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser3, - (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser3, -- (ndr_print_function_t) ndr_print_samr_ChangePasswordUser3, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13250,7 +13250,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_Connect5), - (ndr_push_flags_fn_t) ndr_push_samr_Connect5, - (ndr_pull_flags_fn_t) ndr_pull_samr_Connect5, -- (ndr_print_function_t) ndr_print_samr_Connect5, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13259,7 +13259,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_RidToSid), - (ndr_push_flags_fn_t) ndr_push_samr_RidToSid, - (ndr_pull_flags_fn_t) ndr_pull_samr_RidToSid, -- (ndr_print_function_t) ndr_print_samr_RidToSid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13268,7 +13268,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_SetDsrmPassword), - (ndr_push_flags_fn_t) ndr_push_samr_SetDsrmPassword, - (ndr_pull_flags_fn_t) ndr_pull_samr_SetDsrmPassword, -- (ndr_print_function_t) ndr_print_samr_SetDsrmPassword, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -13277,7 +13277,7 @@ static const struct ndr_interface_call s - sizeof(struct samr_ValidatePassword), - (ndr_push_flags_fn_t) ndr_push_samr_ValidatePassword, - (ndr_pull_flags_fn_t) ndr_pull_samr_ValidatePassword, -- (ndr_print_function_t) ndr_print_samr_ValidatePassword, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_scerpc.c -+++ b/source3/librpc/gen_ndr/ndr_scerpc.c -@@ -51,7 +51,7 @@ static const struct ndr_interface_call s - sizeof(struct scerpc_Unknown0), - (ndr_push_flags_fn_t) ndr_push_scerpc_Unknown0, - (ndr_pull_flags_fn_t) ndr_pull_scerpc_Unknown0, -- (ndr_print_function_t) ndr_print_scerpc_Unknown0, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_spoolss.c -+++ b/source3/librpc/gen_ndr/ndr_spoolss.c -@@ -32660,7 +32660,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrinters), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrinters, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrinters, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrinters, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32669,7 +32669,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_OpenPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_OpenPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_OpenPrinter, -- (ndr_print_function_t) ndr_print_spoolss_OpenPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32678,7 +32678,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SetJob), - (ndr_push_flags_fn_t) ndr_push_spoolss_SetJob, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SetJob, -- (ndr_print_function_t) ndr_print_spoolss_SetJob, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32687,7 +32687,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetJob), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetJob, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetJob, -- (ndr_print_function_t) ndr_print_spoolss_GetJob, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32696,7 +32696,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumJobs), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumJobs, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumJobs, -- (ndr_print_function_t) ndr_print_spoolss_EnumJobs, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32705,7 +32705,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrinter, -- (ndr_print_function_t) ndr_print_spoolss_AddPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32714,7 +32714,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinter, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32723,7 +32723,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SetPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_SetPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SetPrinter, -- (ndr_print_function_t) ndr_print_spoolss_SetPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32732,7 +32732,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinter, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32741,7 +32741,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrinterDriver), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrinterDriver, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrinterDriver, -- (ndr_print_function_t) ndr_print_spoolss_AddPrinterDriver, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32750,7 +32750,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrinterDrivers), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrinterDrivers, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrinterDrivers, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrinterDrivers, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32759,7 +32759,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinterDriver), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinterDriver, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinterDriver, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinterDriver, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32768,7 +32768,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinterDriverDirectory), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinterDriverDirectory, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinterDriverDirectory, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinterDriverDirectory, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32777,7 +32777,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterDriver), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterDriver, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterDriver, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterDriver, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32786,7 +32786,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrintProcessor), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrintProcessor, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrintProcessor, -- (ndr_print_function_t) ndr_print_spoolss_AddPrintProcessor, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32795,7 +32795,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrintProcessors), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrintProcessors, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrintProcessors, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrintProcessors, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32804,7 +32804,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrintProcessorDirectory), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrintProcessorDirectory, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrintProcessorDirectory, -- (ndr_print_function_t) ndr_print_spoolss_GetPrintProcessorDirectory, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32813,7 +32813,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_StartDocPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_StartDocPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_StartDocPrinter, -- (ndr_print_function_t) ndr_print_spoolss_StartDocPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32822,7 +32822,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_StartPagePrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_StartPagePrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_StartPagePrinter, -- (ndr_print_function_t) ndr_print_spoolss_StartPagePrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32831,7 +32831,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_WritePrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_WritePrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_WritePrinter, -- (ndr_print_function_t) ndr_print_spoolss_WritePrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32840,7 +32840,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EndPagePrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_EndPagePrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EndPagePrinter, -- (ndr_print_function_t) ndr_print_spoolss_EndPagePrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32849,7 +32849,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AbortPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_AbortPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AbortPrinter, -- (ndr_print_function_t) ndr_print_spoolss_AbortPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32858,7 +32858,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ReadPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_ReadPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ReadPrinter, -- (ndr_print_function_t) ndr_print_spoolss_ReadPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32867,7 +32867,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EndDocPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_EndDocPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EndDocPrinter, -- (ndr_print_function_t) ndr_print_spoolss_EndDocPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32876,7 +32876,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddJob), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddJob, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddJob, -- (ndr_print_function_t) ndr_print_spoolss_AddJob, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32885,7 +32885,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ScheduleJob), - (ndr_push_flags_fn_t) ndr_push_spoolss_ScheduleJob, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ScheduleJob, -- (ndr_print_function_t) ndr_print_spoolss_ScheduleJob, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32894,7 +32894,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinterData), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinterData, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinterData, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinterData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32903,7 +32903,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SetPrinterData), - (ndr_push_flags_fn_t) ndr_push_spoolss_SetPrinterData, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SetPrinterData, -- (ndr_print_function_t) ndr_print_spoolss_SetPrinterData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32912,7 +32912,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_WaitForPrinterChange), - (ndr_push_flags_fn_t) ndr_push_spoolss_WaitForPrinterChange, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_WaitForPrinterChange, -- (ndr_print_function_t) ndr_print_spoolss_WaitForPrinterChange, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32921,7 +32921,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ClosePrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_ClosePrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ClosePrinter, -- (ndr_print_function_t) ndr_print_spoolss_ClosePrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32930,7 +32930,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddForm), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddForm, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddForm, -- (ndr_print_function_t) ndr_print_spoolss_AddForm, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32939,7 +32939,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeleteForm), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeleteForm, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeleteForm, -- (ndr_print_function_t) ndr_print_spoolss_DeleteForm, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32948,7 +32948,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetForm), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetForm, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetForm, -- (ndr_print_function_t) ndr_print_spoolss_GetForm, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32957,7 +32957,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SetForm), - (ndr_push_flags_fn_t) ndr_push_spoolss_SetForm, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SetForm, -- (ndr_print_function_t) ndr_print_spoolss_SetForm, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32966,7 +32966,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumForms), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumForms, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumForms, -- (ndr_print_function_t) ndr_print_spoolss_EnumForms, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32975,7 +32975,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPorts), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPorts, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPorts, -- (ndr_print_function_t) ndr_print_spoolss_EnumPorts, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32984,7 +32984,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumMonitors), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumMonitors, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumMonitors, -- (ndr_print_function_t) ndr_print_spoolss_EnumMonitors, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -32993,7 +32993,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPort), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPort, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPort, -- (ndr_print_function_t) ndr_print_spoolss_AddPort, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33002,7 +33002,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ConfigurePort), - (ndr_push_flags_fn_t) ndr_push_spoolss_ConfigurePort, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ConfigurePort, -- (ndr_print_function_t) ndr_print_spoolss_ConfigurePort, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33011,7 +33011,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePort), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePort, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePort, -- (ndr_print_function_t) ndr_print_spoolss_DeletePort, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33020,7 +33020,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_CreatePrinterIC), - (ndr_push_flags_fn_t) ndr_push_spoolss_CreatePrinterIC, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_CreatePrinterIC, -- (ndr_print_function_t) ndr_print_spoolss_CreatePrinterIC, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33029,7 +33029,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_PlayGDIScriptOnPrinterIC), - (ndr_push_flags_fn_t) ndr_push_spoolss_PlayGDIScriptOnPrinterIC, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_PlayGDIScriptOnPrinterIC, -- (ndr_print_function_t) ndr_print_spoolss_PlayGDIScriptOnPrinterIC, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33038,7 +33038,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterIC), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterIC, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterIC, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterIC, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33047,7 +33047,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrinterConnection), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrinterConnection, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrinterConnection, -- (ndr_print_function_t) ndr_print_spoolss_AddPrinterConnection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33056,7 +33056,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterConnection), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterConnection, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterConnection, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterConnection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33065,7 +33065,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_PrinterMessageBox), - (ndr_push_flags_fn_t) ndr_push_spoolss_PrinterMessageBox, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_PrinterMessageBox, -- (ndr_print_function_t) ndr_print_spoolss_PrinterMessageBox, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33074,7 +33074,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddMonitor), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddMonitor, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddMonitor, -- (ndr_print_function_t) ndr_print_spoolss_AddMonitor, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33083,7 +33083,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeleteMonitor), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeleteMonitor, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeleteMonitor, -- (ndr_print_function_t) ndr_print_spoolss_DeleteMonitor, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33092,7 +33092,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrintProcessor), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrintProcessor, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrintProcessor, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrintProcessor, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33101,7 +33101,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrintProvidor), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrintProvidor, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrintProvidor, -- (ndr_print_function_t) ndr_print_spoolss_AddPrintProvidor, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33110,7 +33110,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrintProvidor), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrintProvidor, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrintProvidor, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrintProvidor, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33119,7 +33119,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrintProcDataTypes), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrintProcDataTypes, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrintProcDataTypes, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrintProcDataTypes, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33128,7 +33128,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ResetPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_ResetPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ResetPrinter, -- (ndr_print_function_t) ndr_print_spoolss_ResetPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33137,7 +33137,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinterDriver2), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinterDriver2, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinterDriver2, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinterDriver2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33146,7 +33146,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_FindFirstPrinterChangeNotification), - (ndr_push_flags_fn_t) ndr_push_spoolss_FindFirstPrinterChangeNotification, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_FindFirstPrinterChangeNotification, -- (ndr_print_function_t) ndr_print_spoolss_FindFirstPrinterChangeNotification, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33155,7 +33155,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_FindNextPrinterChangeNotification), - (ndr_push_flags_fn_t) ndr_push_spoolss_FindNextPrinterChangeNotification, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_FindNextPrinterChangeNotification, -- (ndr_print_function_t) ndr_print_spoolss_FindNextPrinterChangeNotification, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33164,7 +33164,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_FindClosePrinterNotify), - (ndr_push_flags_fn_t) ndr_push_spoolss_FindClosePrinterNotify, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_FindClosePrinterNotify, -- (ndr_print_function_t) ndr_print_spoolss_FindClosePrinterNotify, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33173,7 +33173,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_RouterFindFirstPrinterChangeNotificationOld), - (ndr_push_flags_fn_t) ndr_push_spoolss_RouterFindFirstPrinterChangeNotificationOld, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_RouterFindFirstPrinterChangeNotificationOld, -- (ndr_print_function_t) ndr_print_spoolss_RouterFindFirstPrinterChangeNotificationOld, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33182,7 +33182,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ReplyOpenPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_ReplyOpenPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ReplyOpenPrinter, -- (ndr_print_function_t) ndr_print_spoolss_ReplyOpenPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33191,7 +33191,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_RouterReplyPrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_RouterReplyPrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_RouterReplyPrinter, -- (ndr_print_function_t) ndr_print_spoolss_RouterReplyPrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33200,7 +33200,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ReplyClosePrinter), - (ndr_push_flags_fn_t) ndr_push_spoolss_ReplyClosePrinter, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ReplyClosePrinter, -- (ndr_print_function_t) ndr_print_spoolss_ReplyClosePrinter, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33209,7 +33209,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPortEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPortEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPortEx, -- (ndr_print_function_t) ndr_print_spoolss_AddPortEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33218,7 +33218,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_RouterFindFirstPrinterChangeNotification), - (ndr_push_flags_fn_t) ndr_push_spoolss_RouterFindFirstPrinterChangeNotification, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_RouterFindFirstPrinterChangeNotification, -- (ndr_print_function_t) ndr_print_spoolss_RouterFindFirstPrinterChangeNotification, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33227,7 +33227,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SpoolerInit), - (ndr_push_flags_fn_t) ndr_push_spoolss_SpoolerInit, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SpoolerInit, -- (ndr_print_function_t) ndr_print_spoolss_SpoolerInit, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33236,7 +33236,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_ResetPrinterEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_ResetPrinterEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_ResetPrinterEx, -- (ndr_print_function_t) ndr_print_spoolss_ResetPrinterEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33245,7 +33245,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_RemoteFindFirstPrinterChangeNotifyEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_RemoteFindFirstPrinterChangeNotifyEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_RemoteFindFirstPrinterChangeNotifyEx, -- (ndr_print_function_t) ndr_print_spoolss_RemoteFindFirstPrinterChangeNotifyEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33254,7 +33254,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_RouterReplyPrinterEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_RouterReplyPrinterEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_RouterReplyPrinterEx, -- (ndr_print_function_t) ndr_print_spoolss_RouterReplyPrinterEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33263,7 +33263,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_RouterRefreshPrinterChangeNotify), - (ndr_push_flags_fn_t) ndr_push_spoolss_RouterRefreshPrinterChangeNotify, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_RouterRefreshPrinterChangeNotify, -- (ndr_print_function_t) ndr_print_spoolss_RouterRefreshPrinterChangeNotify, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33272,7 +33272,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_44), - (ndr_push_flags_fn_t) ndr_push_spoolss_44, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_44, -- (ndr_print_function_t) ndr_print_spoolss_44, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33281,7 +33281,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_OpenPrinterEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_OpenPrinterEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_OpenPrinterEx, -- (ndr_print_function_t) ndr_print_spoolss_OpenPrinterEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33290,7 +33290,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrinterEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrinterEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrinterEx, -- (ndr_print_function_t) ndr_print_spoolss_AddPrinterEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33299,7 +33299,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SetPort), - (ndr_push_flags_fn_t) ndr_push_spoolss_SetPort, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SetPort, -- (ndr_print_function_t) ndr_print_spoolss_SetPort, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33308,7 +33308,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrinterData), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrinterData, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrinterData, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrinterData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33317,7 +33317,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterData), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterData, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterData, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33326,7 +33326,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_4a), - (ndr_push_flags_fn_t) ndr_push_spoolss_4a, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_4a, -- (ndr_print_function_t) ndr_print_spoolss_4a, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33335,7 +33335,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_4b), - (ndr_push_flags_fn_t) ndr_push_spoolss_4b, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_4b, -- (ndr_print_function_t) ndr_print_spoolss_4b, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33344,7 +33344,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_4c), - (ndr_push_flags_fn_t) ndr_push_spoolss_4c, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_4c, -- (ndr_print_function_t) ndr_print_spoolss_4c, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33353,7 +33353,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_SetPrinterDataEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_SetPrinterDataEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_SetPrinterDataEx, -- (ndr_print_function_t) ndr_print_spoolss_SetPrinterDataEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33362,7 +33362,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinterDataEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinterDataEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinterDataEx, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinterDataEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33371,7 +33371,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrinterDataEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrinterDataEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrinterDataEx, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrinterDataEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33380,7 +33380,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPrinterKey), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPrinterKey, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPrinterKey, -- (ndr_print_function_t) ndr_print_spoolss_EnumPrinterKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33389,7 +33389,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterDataEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterDataEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterDataEx, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterDataEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33398,7 +33398,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterKey), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterKey, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterKey, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33407,7 +33407,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_53), - (ndr_push_flags_fn_t) ndr_push_spoolss_53, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_53, -- (ndr_print_function_t) ndr_print_spoolss_53, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33416,7 +33416,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePrinterDriverEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePrinterDriverEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePrinterDriverEx, -- (ndr_print_function_t) ndr_print_spoolss_DeletePrinterDriverEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33425,7 +33425,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPerMachineConnection), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPerMachineConnection, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPerMachineConnection, -- (ndr_print_function_t) ndr_print_spoolss_AddPerMachineConnection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33434,7 +33434,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_DeletePerMachineConnection), - (ndr_push_flags_fn_t) ndr_push_spoolss_DeletePerMachineConnection, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_DeletePerMachineConnection, -- (ndr_print_function_t) ndr_print_spoolss_DeletePerMachineConnection, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33443,7 +33443,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_EnumPerMachineConnections), - (ndr_push_flags_fn_t) ndr_push_spoolss_EnumPerMachineConnections, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_EnumPerMachineConnections, -- (ndr_print_function_t) ndr_print_spoolss_EnumPerMachineConnections, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33452,7 +33452,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_XcvData), - (ndr_push_flags_fn_t) ndr_push_spoolss_XcvData, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_XcvData, -- (ndr_print_function_t) ndr_print_spoolss_XcvData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33461,7 +33461,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_AddPrinterDriverEx), - (ndr_push_flags_fn_t) ndr_push_spoolss_AddPrinterDriverEx, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_AddPrinterDriverEx, -- (ndr_print_function_t) ndr_print_spoolss_AddPrinterDriverEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33470,7 +33470,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_5a), - (ndr_push_flags_fn_t) ndr_push_spoolss_5a, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_5a, -- (ndr_print_function_t) ndr_print_spoolss_5a, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33479,7 +33479,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_5b), - (ndr_push_flags_fn_t) ndr_push_spoolss_5b, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_5b, -- (ndr_print_function_t) ndr_print_spoolss_5b, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33488,7 +33488,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_5c), - (ndr_push_flags_fn_t) ndr_push_spoolss_5c, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_5c, -- (ndr_print_function_t) ndr_print_spoolss_5c, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33497,7 +33497,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_5d), - (ndr_push_flags_fn_t) ndr_push_spoolss_5d, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_5d, -- (ndr_print_function_t) ndr_print_spoolss_5d, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33506,7 +33506,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_5e), - (ndr_push_flags_fn_t) ndr_push_spoolss_5e, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_5e, -- (ndr_print_function_t) ndr_print_spoolss_5e, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33515,7 +33515,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_5f), - (ndr_push_flags_fn_t) ndr_push_spoolss_5f, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_5f, -- (ndr_print_function_t) ndr_print_spoolss_5f, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33524,7 +33524,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_60), - (ndr_push_flags_fn_t) ndr_push_spoolss_60, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_60, -- (ndr_print_function_t) ndr_print_spoolss_60, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33533,7 +33533,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_61), - (ndr_push_flags_fn_t) ndr_push_spoolss_61, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_61, -- (ndr_print_function_t) ndr_print_spoolss_61, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33542,7 +33542,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_62), - (ndr_push_flags_fn_t) ndr_push_spoolss_62, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_62, -- (ndr_print_function_t) ndr_print_spoolss_62, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33551,7 +33551,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_63), - (ndr_push_flags_fn_t) ndr_push_spoolss_63, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_63, -- (ndr_print_function_t) ndr_print_spoolss_63, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33560,7 +33560,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_64), - (ndr_push_flags_fn_t) ndr_push_spoolss_64, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_64, -- (ndr_print_function_t) ndr_print_spoolss_64, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33569,7 +33569,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_65), - (ndr_push_flags_fn_t) ndr_push_spoolss_65, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_65, -- (ndr_print_function_t) ndr_print_spoolss_65, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33578,7 +33578,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetCorePrinterDrivers), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetCorePrinterDrivers, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetCorePrinterDrivers, -- (ndr_print_function_t) ndr_print_spoolss_GetCorePrinterDrivers, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33587,7 +33587,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_67), - (ndr_push_flags_fn_t) ndr_push_spoolss_67, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_67, -- (ndr_print_function_t) ndr_print_spoolss_67, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33596,7 +33596,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_GetPrinterDriverPackagePath), - (ndr_push_flags_fn_t) ndr_push_spoolss_GetPrinterDriverPackagePath, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_GetPrinterDriverPackagePath, -- (ndr_print_function_t) ndr_print_spoolss_GetPrinterDriverPackagePath, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33605,7 +33605,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_69), - (ndr_push_flags_fn_t) ndr_push_spoolss_69, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_69, -- (ndr_print_function_t) ndr_print_spoolss_69, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33614,7 +33614,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_6a), - (ndr_push_flags_fn_t) ndr_push_spoolss_6a, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_6a, -- (ndr_print_function_t) ndr_print_spoolss_6a, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33623,7 +33623,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_6b), - (ndr_push_flags_fn_t) ndr_push_spoolss_6b, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_6b, -- (ndr_print_function_t) ndr_print_spoolss_6b, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33632,7 +33632,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_6c), - (ndr_push_flags_fn_t) ndr_push_spoolss_6c, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_6c, -- (ndr_print_function_t) ndr_print_spoolss_6c, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -33641,7 +33641,7 @@ static const struct ndr_interface_call s - sizeof(struct spoolss_6d), - (ndr_push_flags_fn_t) ndr_push_spoolss_6d, - (ndr_pull_flags_fn_t) ndr_pull_spoolss_6d, -- (ndr_print_function_t) ndr_print_spoolss_6d, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_srvsvc.c -+++ b/source3/librpc/gen_ndr/ndr_srvsvc.c -@@ -20229,7 +20229,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20238,7 +20238,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevGetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevGetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20247,7 +20247,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevControl), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevControl, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevControl, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevControl, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20256,7 +20256,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevQEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevQEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevQEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevQEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20265,7 +20265,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevQGetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevQGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevQGetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevQGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20274,7 +20274,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevQSetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevQSetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevQSetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevQSetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20283,7 +20283,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevQPurge), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevQPurge, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevQPurge, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevQPurge, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20292,7 +20292,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetCharDevQPurgeSelf), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetCharDevQPurgeSelf, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetCharDevQPurgeSelf, -- (ndr_print_function_t) ndr_print_srvsvc_NetCharDevQPurgeSelf, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20301,7 +20301,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetConnEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetConnEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetConnEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetConnEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20310,7 +20310,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetFileEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetFileEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetFileEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetFileEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20319,7 +20319,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetFileGetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetFileGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetFileGetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetFileGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20328,7 +20328,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetFileClose), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetFileClose, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetFileClose, -- (ndr_print_function_t) ndr_print_srvsvc_NetFileClose, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20337,7 +20337,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetSessEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetSessEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetSessEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetSessEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20346,7 +20346,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetSessDel), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetSessDel, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetSessDel, -- (ndr_print_function_t) ndr_print_srvsvc_NetSessDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20355,7 +20355,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareAdd), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareAdd, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareAdd, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20364,7 +20364,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareEnumAll), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareEnumAll, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareEnumAll, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareEnumAll, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20373,7 +20373,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareGetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareGetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20382,7 +20382,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareSetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareSetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareSetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareSetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20391,7 +20391,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareDel), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareDel, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareDel, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20400,7 +20400,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareDelSticky), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareDelSticky, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareDelSticky, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareDelSticky, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20409,7 +20409,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareCheck), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareCheck, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareCheck, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareCheck, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20418,7 +20418,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetSrvGetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetSrvGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetSrvGetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetSrvGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20427,7 +20427,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetSrvSetInfo), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetSrvSetInfo, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetSrvSetInfo, -- (ndr_print_function_t) ndr_print_srvsvc_NetSrvSetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20436,7 +20436,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetDiskEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetDiskEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetDiskEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetDiskEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20445,7 +20445,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetServerStatisticsGet), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetServerStatisticsGet, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetServerStatisticsGet, -- (ndr_print_function_t) ndr_print_srvsvc_NetServerStatisticsGet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20454,7 +20454,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetTransportAdd), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetTransportAdd, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetTransportAdd, -- (ndr_print_function_t) ndr_print_srvsvc_NetTransportAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20463,7 +20463,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetTransportEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetTransportEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetTransportEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetTransportEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20472,7 +20472,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetTransportDel), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetTransportDel, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetTransportDel, -- (ndr_print_function_t) ndr_print_srvsvc_NetTransportDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20481,7 +20481,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetRemoteTOD), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetRemoteTOD, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetRemoteTOD, -- (ndr_print_function_t) ndr_print_srvsvc_NetRemoteTOD, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20490,7 +20490,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetSetServiceBits), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetSetServiceBits, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetSetServiceBits, -- (ndr_print_function_t) ndr_print_srvsvc_NetSetServiceBits, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20499,7 +20499,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetPathType), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetPathType, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetPathType, -- (ndr_print_function_t) ndr_print_srvsvc_NetPathType, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20508,7 +20508,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetPathCanonicalize), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetPathCanonicalize, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetPathCanonicalize, -- (ndr_print_function_t) ndr_print_srvsvc_NetPathCanonicalize, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20517,7 +20517,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetPathCompare), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetPathCompare, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetPathCompare, -- (ndr_print_function_t) ndr_print_srvsvc_NetPathCompare, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20526,7 +20526,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetNameValidate), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetNameValidate, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetNameValidate, -- (ndr_print_function_t) ndr_print_srvsvc_NetNameValidate, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20535,7 +20535,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRPRNAMECANONICALIZE), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRPRNAMECANONICALIZE, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRPRNAMECANONICALIZE, -- (ndr_print_function_t) ndr_print_srvsvc_NETRPRNAMECANONICALIZE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20544,7 +20544,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetPRNameCompare), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetPRNameCompare, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetPRNameCompare, -- (ndr_print_function_t) ndr_print_srvsvc_NetPRNameCompare, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20553,7 +20553,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareEnum), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareEnum, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareEnum, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20562,7 +20562,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareDelStart), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareDelStart, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareDelStart, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareDelStart, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20571,7 +20571,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetShareDelCommit), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetShareDelCommit, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetShareDelCommit, -- (ndr_print_function_t) ndr_print_srvsvc_NetShareDelCommit, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20580,7 +20580,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetGetFileSecurity), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetGetFileSecurity, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetGetFileSecurity, -- (ndr_print_function_t) ndr_print_srvsvc_NetGetFileSecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20589,7 +20589,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetSetFileSecurity), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetSetFileSecurity, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetSetFileSecurity, -- (ndr_print_function_t) ndr_print_srvsvc_NetSetFileSecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20598,7 +20598,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetServerTransportAddEx), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetServerTransportAddEx, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetServerTransportAddEx, -- (ndr_print_function_t) ndr_print_srvsvc_NetServerTransportAddEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20607,7 +20607,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NetServerSetServiceBitsEx), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NetServerSetServiceBitsEx, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NetServerSetServiceBitsEx, -- (ndr_print_function_t) ndr_print_srvsvc_NetServerSetServiceBitsEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20616,7 +20616,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSGETVERSION), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSGETVERSION, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSGETVERSION, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSGETVERSION, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20625,7 +20625,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSCREATELOCALPARTITION), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSCREATELOCALPARTITION, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSCREATELOCALPARTITION, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSCREATELOCALPARTITION, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20634,7 +20634,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSDELETELOCALPARTITION), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSDELETELOCALPARTITION, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSDELETELOCALPARTITION, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSDELETELOCALPARTITION, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20643,7 +20643,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSSETLOCALVOLUMESTATE), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSSETLOCALVOLUMESTATE, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSSETLOCALVOLUMESTATE, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSSETLOCALVOLUMESTATE, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20652,7 +20652,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSSETSERVERINFO), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSSETSERVERINFO, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSSETSERVERINFO, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSSETSERVERINFO, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20661,7 +20661,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSCREATEEXITPOINT), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSCREATEEXITPOINT, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSCREATEEXITPOINT, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSCREATEEXITPOINT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20670,7 +20670,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSDELETEEXITPOINT), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSDELETEEXITPOINT, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSDELETEEXITPOINT, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSDELETEEXITPOINT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20679,7 +20679,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSMODIFYPREFIX), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSMODIFYPREFIX, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSMODIFYPREFIX, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSMODIFYPREFIX, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20688,7 +20688,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSFIXLOCALVOLUME), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSFIXLOCALVOLUME, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSFIXLOCALVOLUME, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSFIXLOCALVOLUME, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20697,7 +20697,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRDFSMANAGERREPORTSITEINFO), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRDFSMANAGERREPORTSITEINFO, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRDFSMANAGERREPORTSITEINFO, -- (ndr_print_function_t) ndr_print_srvsvc_NETRDFSMANAGERREPORTSITEINFO, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -20706,7 +20706,7 @@ static const struct ndr_interface_call s - sizeof(struct srvsvc_NETRSERVERTRANSPORTDELEX), - (ndr_push_flags_fn_t) ndr_push_srvsvc_NETRSERVERTRANSPORTDELEX, - (ndr_pull_flags_fn_t) ndr_pull_srvsvc_NETRSERVERTRANSPORTDELEX, -- (ndr_print_function_t) ndr_print_srvsvc_NETRSERVERTRANSPORTDELEX, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_svcctl.c -+++ b/source3/librpc/gen_ndr/ndr_svcctl.c -@@ -7175,7 +7175,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_CloseServiceHandle), - (ndr_push_flags_fn_t) ndr_push_svcctl_CloseServiceHandle, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_CloseServiceHandle, -- (ndr_print_function_t) ndr_print_svcctl_CloseServiceHandle, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7184,7 +7184,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_ControlService), - (ndr_push_flags_fn_t) ndr_push_svcctl_ControlService, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_ControlService, -- (ndr_print_function_t) ndr_print_svcctl_ControlService, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7193,7 +7193,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_DeleteService), - (ndr_push_flags_fn_t) ndr_push_svcctl_DeleteService, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_DeleteService, -- (ndr_print_function_t) ndr_print_svcctl_DeleteService, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7202,7 +7202,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_LockServiceDatabase), - (ndr_push_flags_fn_t) ndr_push_svcctl_LockServiceDatabase, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_LockServiceDatabase, -- (ndr_print_function_t) ndr_print_svcctl_LockServiceDatabase, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7211,7 +7211,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceObjectSecurity), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceObjectSecurity, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceObjectSecurity, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceObjectSecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7220,7 +7220,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_SetServiceObjectSecurity), - (ndr_push_flags_fn_t) ndr_push_svcctl_SetServiceObjectSecurity, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_SetServiceObjectSecurity, -- (ndr_print_function_t) ndr_print_svcctl_SetServiceObjectSecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7229,7 +7229,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceStatus), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceStatus, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceStatus, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7238,7 +7238,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_SetServiceStatus), - (ndr_push_flags_fn_t) ndr_push_svcctl_SetServiceStatus, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_SetServiceStatus, -- (ndr_print_function_t) ndr_print_svcctl_SetServiceStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7247,7 +7247,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_UnlockServiceDatabase), - (ndr_push_flags_fn_t) ndr_push_svcctl_UnlockServiceDatabase, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_UnlockServiceDatabase, -- (ndr_print_function_t) ndr_print_svcctl_UnlockServiceDatabase, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7256,7 +7256,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_NotifyBootConfigStatus), - (ndr_push_flags_fn_t) ndr_push_svcctl_NotifyBootConfigStatus, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_NotifyBootConfigStatus, -- (ndr_print_function_t) ndr_print_svcctl_NotifyBootConfigStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7265,7 +7265,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_SCSetServiceBitsW), - (ndr_push_flags_fn_t) ndr_push_svcctl_SCSetServiceBitsW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_SCSetServiceBitsW, -- (ndr_print_function_t) ndr_print_svcctl_SCSetServiceBitsW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7274,7 +7274,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_ChangeServiceConfigW), - (ndr_push_flags_fn_t) ndr_push_svcctl_ChangeServiceConfigW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_ChangeServiceConfigW, -- (ndr_print_function_t) ndr_print_svcctl_ChangeServiceConfigW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7283,7 +7283,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_CreateServiceW), - (ndr_push_flags_fn_t) ndr_push_svcctl_CreateServiceW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_CreateServiceW, -- (ndr_print_function_t) ndr_print_svcctl_CreateServiceW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7292,7 +7292,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_EnumDependentServicesW), - (ndr_push_flags_fn_t) ndr_push_svcctl_EnumDependentServicesW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_EnumDependentServicesW, -- (ndr_print_function_t) ndr_print_svcctl_EnumDependentServicesW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7301,7 +7301,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_EnumServicesStatusW), - (ndr_push_flags_fn_t) ndr_push_svcctl_EnumServicesStatusW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_EnumServicesStatusW, -- (ndr_print_function_t) ndr_print_svcctl_EnumServicesStatusW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7310,7 +7310,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_OpenSCManagerW), - (ndr_push_flags_fn_t) ndr_push_svcctl_OpenSCManagerW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_OpenSCManagerW, -- (ndr_print_function_t) ndr_print_svcctl_OpenSCManagerW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7319,7 +7319,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_OpenServiceW), - (ndr_push_flags_fn_t) ndr_push_svcctl_OpenServiceW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_OpenServiceW, -- (ndr_print_function_t) ndr_print_svcctl_OpenServiceW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7328,7 +7328,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceConfigW), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceConfigW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceConfigW, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceConfigW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7337,7 +7337,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceLockStatusW), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceLockStatusW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceLockStatusW, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceLockStatusW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7346,7 +7346,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_StartServiceW), - (ndr_push_flags_fn_t) ndr_push_svcctl_StartServiceW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_StartServiceW, -- (ndr_print_function_t) ndr_print_svcctl_StartServiceW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7355,7 +7355,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_GetServiceDisplayNameW), - (ndr_push_flags_fn_t) ndr_push_svcctl_GetServiceDisplayNameW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_GetServiceDisplayNameW, -- (ndr_print_function_t) ndr_print_svcctl_GetServiceDisplayNameW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7364,7 +7364,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_GetServiceKeyNameW), - (ndr_push_flags_fn_t) ndr_push_svcctl_GetServiceKeyNameW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_GetServiceKeyNameW, -- (ndr_print_function_t) ndr_print_svcctl_GetServiceKeyNameW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7373,7 +7373,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_SCSetServiceBitsA), - (ndr_push_flags_fn_t) ndr_push_svcctl_SCSetServiceBitsA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_SCSetServiceBitsA, -- (ndr_print_function_t) ndr_print_svcctl_SCSetServiceBitsA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7382,7 +7382,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_ChangeServiceConfigA), - (ndr_push_flags_fn_t) ndr_push_svcctl_ChangeServiceConfigA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_ChangeServiceConfigA, -- (ndr_print_function_t) ndr_print_svcctl_ChangeServiceConfigA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7391,7 +7391,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_CreateServiceA), - (ndr_push_flags_fn_t) ndr_push_svcctl_CreateServiceA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_CreateServiceA, -- (ndr_print_function_t) ndr_print_svcctl_CreateServiceA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7400,7 +7400,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_EnumDependentServicesA), - (ndr_push_flags_fn_t) ndr_push_svcctl_EnumDependentServicesA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_EnumDependentServicesA, -- (ndr_print_function_t) ndr_print_svcctl_EnumDependentServicesA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7409,7 +7409,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_EnumServicesStatusA), - (ndr_push_flags_fn_t) ndr_push_svcctl_EnumServicesStatusA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_EnumServicesStatusA, -- (ndr_print_function_t) ndr_print_svcctl_EnumServicesStatusA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7418,7 +7418,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_OpenSCManagerA), - (ndr_push_flags_fn_t) ndr_push_svcctl_OpenSCManagerA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_OpenSCManagerA, -- (ndr_print_function_t) ndr_print_svcctl_OpenSCManagerA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7427,7 +7427,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_OpenServiceA), - (ndr_push_flags_fn_t) ndr_push_svcctl_OpenServiceA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_OpenServiceA, -- (ndr_print_function_t) ndr_print_svcctl_OpenServiceA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7436,7 +7436,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceConfigA), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceConfigA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceConfigA, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceConfigA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7445,7 +7445,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceLockStatusA), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceLockStatusA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceLockStatusA, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceLockStatusA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7454,7 +7454,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_StartServiceA), - (ndr_push_flags_fn_t) ndr_push_svcctl_StartServiceA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_StartServiceA, -- (ndr_print_function_t) ndr_print_svcctl_StartServiceA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7463,7 +7463,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_GetServiceDisplayNameA), - (ndr_push_flags_fn_t) ndr_push_svcctl_GetServiceDisplayNameA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_GetServiceDisplayNameA, -- (ndr_print_function_t) ndr_print_svcctl_GetServiceDisplayNameA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7472,7 +7472,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_GetServiceKeyNameA), - (ndr_push_flags_fn_t) ndr_push_svcctl_GetServiceKeyNameA, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_GetServiceKeyNameA, -- (ndr_print_function_t) ndr_print_svcctl_GetServiceKeyNameA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7481,7 +7481,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_GetCurrentGroupeStateW), - (ndr_push_flags_fn_t) ndr_push_svcctl_GetCurrentGroupeStateW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_GetCurrentGroupeStateW, -- (ndr_print_function_t) ndr_print_svcctl_GetCurrentGroupeStateW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7490,7 +7490,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_EnumServiceGroupW), - (ndr_push_flags_fn_t) ndr_push_svcctl_EnumServiceGroupW, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_EnumServiceGroupW, -- (ndr_print_function_t) ndr_print_svcctl_EnumServiceGroupW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7499,7 +7499,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_ChangeServiceConfig2A), - (ndr_push_flags_fn_t) ndr_push_svcctl_ChangeServiceConfig2A, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_ChangeServiceConfig2A, -- (ndr_print_function_t) ndr_print_svcctl_ChangeServiceConfig2A, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7508,7 +7508,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_ChangeServiceConfig2W), - (ndr_push_flags_fn_t) ndr_push_svcctl_ChangeServiceConfig2W, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_ChangeServiceConfig2W, -- (ndr_print_function_t) ndr_print_svcctl_ChangeServiceConfig2W, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7517,7 +7517,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceConfig2A), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceConfig2A, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceConfig2A, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceConfig2A, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7526,7 +7526,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceConfig2W), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceConfig2W, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceConfig2W, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceConfig2W, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7535,7 +7535,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_QueryServiceStatusEx), - (ndr_push_flags_fn_t) ndr_push_svcctl_QueryServiceStatusEx, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_QueryServiceStatusEx, -- (ndr_print_function_t) ndr_print_svcctl_QueryServiceStatusEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7544,7 +7544,7 @@ static const struct ndr_interface_call s - sizeof(struct EnumServicesStatusExA), - (ndr_push_flags_fn_t) ndr_push_EnumServicesStatusExA, - (ndr_pull_flags_fn_t) ndr_pull_EnumServicesStatusExA, -- (ndr_print_function_t) ndr_print_EnumServicesStatusExA, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7553,7 +7553,7 @@ static const struct ndr_interface_call s - sizeof(struct EnumServicesStatusExW), - (ndr_push_flags_fn_t) ndr_push_EnumServicesStatusExW, - (ndr_pull_flags_fn_t) ndr_pull_EnumServicesStatusExW, -- (ndr_print_function_t) ndr_print_EnumServicesStatusExW, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7562,7 +7562,7 @@ static const struct ndr_interface_call s - sizeof(struct svcctl_SCSendTSMessage), - (ndr_push_flags_fn_t) ndr_push_svcctl_SCSendTSMessage, - (ndr_pull_flags_fn_t) ndr_pull_svcctl_SCSendTSMessage, -- (ndr_print_function_t) ndr_print_svcctl_SCSendTSMessage, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_trkwks.c -+++ b/source3/librpc/gen_ndr/ndr_trkwks.c -@@ -51,7 +51,7 @@ static const struct ndr_interface_call t - sizeof(struct trkwks_Unknown0), - (ndr_push_flags_fn_t) ndr_push_trkwks_Unknown0, - (ndr_pull_flags_fn_t) ndr_pull_trkwks_Unknown0, -- (ndr_print_function_t) ndr_print_trkwks_Unknown0, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_unixinfo.c -+++ b/source3/librpc/gen_ndr/ndr_unixinfo.c -@@ -472,7 +472,7 @@ static const struct ndr_interface_call u - sizeof(struct unixinfo_SidToUid), - (ndr_push_flags_fn_t) ndr_push_unixinfo_SidToUid, - (ndr_pull_flags_fn_t) ndr_pull_unixinfo_SidToUid, -- (ndr_print_function_t) ndr_print_unixinfo_SidToUid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -481,7 +481,7 @@ static const struct ndr_interface_call u - sizeof(struct unixinfo_UidToSid), - (ndr_push_flags_fn_t) ndr_push_unixinfo_UidToSid, - (ndr_pull_flags_fn_t) ndr_pull_unixinfo_UidToSid, -- (ndr_print_function_t) ndr_print_unixinfo_UidToSid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -490,7 +490,7 @@ static const struct ndr_interface_call u - sizeof(struct unixinfo_SidToGid), - (ndr_push_flags_fn_t) ndr_push_unixinfo_SidToGid, - (ndr_pull_flags_fn_t) ndr_pull_unixinfo_SidToGid, -- (ndr_print_function_t) ndr_print_unixinfo_SidToGid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -499,7 +499,7 @@ static const struct ndr_interface_call u - sizeof(struct unixinfo_GidToSid), - (ndr_push_flags_fn_t) ndr_push_unixinfo_GidToSid, - (ndr_pull_flags_fn_t) ndr_pull_unixinfo_GidToSid, -- (ndr_print_function_t) ndr_print_unixinfo_GidToSid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -508,7 +508,7 @@ static const struct ndr_interface_call u - sizeof(struct unixinfo_GetPWUid), - (ndr_push_flags_fn_t) ndr_push_unixinfo_GetPWUid, - (ndr_pull_flags_fn_t) ndr_pull_unixinfo_GetPWUid, -- (ndr_print_function_t) ndr_print_unixinfo_GetPWUid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_w32time.c -+++ b/source3/librpc/gen_ndr/ndr_w32time.c -@@ -135,7 +135,7 @@ static const struct ndr_interface_call w - sizeof(struct w32time_SyncTime), - (ndr_push_flags_fn_t) ndr_push_w32time_SyncTime, - (ndr_pull_flags_fn_t) ndr_pull_w32time_SyncTime, -- (ndr_print_function_t) ndr_print_w32time_SyncTime, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -144,7 +144,7 @@ static const struct ndr_interface_call w - sizeof(struct w32time_GetNetLogonServiceBits), - (ndr_push_flags_fn_t) ndr_push_w32time_GetNetLogonServiceBits, - (ndr_pull_flags_fn_t) ndr_pull_w32time_GetNetLogonServiceBits, -- (ndr_print_function_t) ndr_print_w32time_GetNetLogonServiceBits, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -153,7 +153,7 @@ static const struct ndr_interface_call w - sizeof(struct w32time_QueryProviderStatus), - (ndr_push_flags_fn_t) ndr_push_w32time_QueryProviderStatus, - (ndr_pull_flags_fn_t) ndr_pull_w32time_QueryProviderStatus, -- (ndr_print_function_t) ndr_print_w32time_QueryProviderStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_wbint.c -+++ b/source3/librpc/gen_ndr/ndr_wbint.c -@@ -2696,7 +2696,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_Ping), - (ndr_push_flags_fn_t) ndr_push_wbint_Ping, - (ndr_pull_flags_fn_t) ndr_pull_wbint_Ping, -- (ndr_print_function_t) ndr_print_wbint_Ping, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2705,7 +2705,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupSid), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupSid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupSid, -- (ndr_print_function_t) ndr_print_wbint_LookupSid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2714,7 +2714,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupSids), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupSids, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupSids, -- (ndr_print_function_t) ndr_print_wbint_LookupSids, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2723,7 +2723,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupName), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupName, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupName, -- (ndr_print_function_t) ndr_print_wbint_LookupName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2732,7 +2732,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_Sid2Uid), - (ndr_push_flags_fn_t) ndr_push_wbint_Sid2Uid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_Sid2Uid, -- (ndr_print_function_t) ndr_print_wbint_Sid2Uid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2741,7 +2741,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_Sid2Gid), - (ndr_push_flags_fn_t) ndr_push_wbint_Sid2Gid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_Sid2Gid, -- (ndr_print_function_t) ndr_print_wbint_Sid2Gid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2750,7 +2750,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_Sids2UnixIDs), - (ndr_push_flags_fn_t) ndr_push_wbint_Sids2UnixIDs, - (ndr_pull_flags_fn_t) ndr_pull_wbint_Sids2UnixIDs, -- (ndr_print_function_t) ndr_print_wbint_Sids2UnixIDs, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2759,7 +2759,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_Uid2Sid), - (ndr_push_flags_fn_t) ndr_push_wbint_Uid2Sid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_Uid2Sid, -- (ndr_print_function_t) ndr_print_wbint_Uid2Sid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2768,7 +2768,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_Gid2Sid), - (ndr_push_flags_fn_t) ndr_push_wbint_Gid2Sid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_Gid2Sid, -- (ndr_print_function_t) ndr_print_wbint_Gid2Sid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2777,7 +2777,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_AllocateUid), - (ndr_push_flags_fn_t) ndr_push_wbint_AllocateUid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_AllocateUid, -- (ndr_print_function_t) ndr_print_wbint_AllocateUid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2786,7 +2786,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_AllocateGid), - (ndr_push_flags_fn_t) ndr_push_wbint_AllocateGid, - (ndr_pull_flags_fn_t) ndr_pull_wbint_AllocateGid, -- (ndr_print_function_t) ndr_print_wbint_AllocateGid, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2795,7 +2795,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_QueryUser), - (ndr_push_flags_fn_t) ndr_push_wbint_QueryUser, - (ndr_pull_flags_fn_t) ndr_pull_wbint_QueryUser, -- (ndr_print_function_t) ndr_print_wbint_QueryUser, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2804,7 +2804,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupUserAliases), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupUserAliases, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupUserAliases, -- (ndr_print_function_t) ndr_print_wbint_LookupUserAliases, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2813,7 +2813,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupUserGroups), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupUserGroups, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupUserGroups, -- (ndr_print_function_t) ndr_print_wbint_LookupUserGroups, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2822,7 +2822,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_QuerySequenceNumber), - (ndr_push_flags_fn_t) ndr_push_wbint_QuerySequenceNumber, - (ndr_pull_flags_fn_t) ndr_pull_wbint_QuerySequenceNumber, -- (ndr_print_function_t) ndr_print_wbint_QuerySequenceNumber, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2831,7 +2831,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupGroupMembers), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupGroupMembers, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupGroupMembers, -- (ndr_print_function_t) ndr_print_wbint_LookupGroupMembers, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2840,7 +2840,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_QueryUserList), - (ndr_push_flags_fn_t) ndr_push_wbint_QueryUserList, - (ndr_pull_flags_fn_t) ndr_pull_wbint_QueryUserList, -- (ndr_print_function_t) ndr_print_wbint_QueryUserList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2849,7 +2849,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_QueryGroupList), - (ndr_push_flags_fn_t) ndr_push_wbint_QueryGroupList, - (ndr_pull_flags_fn_t) ndr_pull_wbint_QueryGroupList, -- (ndr_print_function_t) ndr_print_wbint_QueryGroupList, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2858,7 +2858,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_DsGetDcName), - (ndr_push_flags_fn_t) ndr_push_wbint_DsGetDcName, - (ndr_pull_flags_fn_t) ndr_pull_wbint_DsGetDcName, -- (ndr_print_function_t) ndr_print_wbint_DsGetDcName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2867,7 +2867,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_LookupRids), - (ndr_push_flags_fn_t) ndr_push_wbint_LookupRids, - (ndr_pull_flags_fn_t) ndr_pull_wbint_LookupRids, -- (ndr_print_function_t) ndr_print_wbint_LookupRids, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2876,7 +2876,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_CheckMachineAccount), - (ndr_push_flags_fn_t) ndr_push_wbint_CheckMachineAccount, - (ndr_pull_flags_fn_t) ndr_pull_wbint_CheckMachineAccount, -- (ndr_print_function_t) ndr_print_wbint_CheckMachineAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2885,7 +2885,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_ChangeMachineAccount), - (ndr_push_flags_fn_t) ndr_push_wbint_ChangeMachineAccount, - (ndr_pull_flags_fn_t) ndr_pull_wbint_ChangeMachineAccount, -- (ndr_print_function_t) ndr_print_wbint_ChangeMachineAccount, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -2894,7 +2894,7 @@ static const struct ndr_interface_call w - sizeof(struct wbint_PingDc), - (ndr_push_flags_fn_t) ndr_push_wbint_PingDc, - (ndr_pull_flags_fn_t) ndr_pull_wbint_PingDc, -- (ndr_print_function_t) ndr_print_wbint_PingDc, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_winreg.c -+++ b/source3/librpc/gen_ndr/ndr_winreg.c -@@ -4864,7 +4864,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKCR), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCR, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCR, -- (ndr_print_function_t) ndr_print_winreg_OpenHKCR, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4873,7 +4873,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKCU), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCU, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCU, -- (ndr_print_function_t) ndr_print_winreg_OpenHKCU, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4882,7 +4882,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKLM), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKLM, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKLM, -- (ndr_print_function_t) ndr_print_winreg_OpenHKLM, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4891,7 +4891,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKPD), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPD, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPD, -- (ndr_print_function_t) ndr_print_winreg_OpenHKPD, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4900,7 +4900,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKU), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKU, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKU, -- (ndr_print_function_t) ndr_print_winreg_OpenHKU, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4909,7 +4909,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_CloseKey), - (ndr_push_flags_fn_t) ndr_push_winreg_CloseKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_CloseKey, -- (ndr_print_function_t) ndr_print_winreg_CloseKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4918,7 +4918,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_CreateKey), - (ndr_push_flags_fn_t) ndr_push_winreg_CreateKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_CreateKey, -- (ndr_print_function_t) ndr_print_winreg_CreateKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4927,7 +4927,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_DeleteKey), - (ndr_push_flags_fn_t) ndr_push_winreg_DeleteKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteKey, -- (ndr_print_function_t) ndr_print_winreg_DeleteKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4936,7 +4936,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_DeleteValue), - (ndr_push_flags_fn_t) ndr_push_winreg_DeleteValue, - (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteValue, -- (ndr_print_function_t) ndr_print_winreg_DeleteValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4945,7 +4945,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_EnumKey), - (ndr_push_flags_fn_t) ndr_push_winreg_EnumKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_EnumKey, -- (ndr_print_function_t) ndr_print_winreg_EnumKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4954,7 +4954,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_EnumValue), - (ndr_push_flags_fn_t) ndr_push_winreg_EnumValue, - (ndr_pull_flags_fn_t) ndr_pull_winreg_EnumValue, -- (ndr_print_function_t) ndr_print_winreg_EnumValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4963,7 +4963,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_FlushKey), - (ndr_push_flags_fn_t) ndr_push_winreg_FlushKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_FlushKey, -- (ndr_print_function_t) ndr_print_winreg_FlushKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4972,7 +4972,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_GetKeySecurity), - (ndr_push_flags_fn_t) ndr_push_winreg_GetKeySecurity, - (ndr_pull_flags_fn_t) ndr_pull_winreg_GetKeySecurity, -- (ndr_print_function_t) ndr_print_winreg_GetKeySecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4981,7 +4981,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_LoadKey), - (ndr_push_flags_fn_t) ndr_push_winreg_LoadKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_LoadKey, -- (ndr_print_function_t) ndr_print_winreg_LoadKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4990,7 +4990,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_NotifyChangeKeyValue), - (ndr_push_flags_fn_t) ndr_push_winreg_NotifyChangeKeyValue, - (ndr_pull_flags_fn_t) ndr_pull_winreg_NotifyChangeKeyValue, -- (ndr_print_function_t) ndr_print_winreg_NotifyChangeKeyValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4999,7 +4999,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenKey), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenKey, -- (ndr_print_function_t) ndr_print_winreg_OpenKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5008,7 +5008,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_QueryInfoKey), - (ndr_push_flags_fn_t) ndr_push_winreg_QueryInfoKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryInfoKey, -- (ndr_print_function_t) ndr_print_winreg_QueryInfoKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5017,7 +5017,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_QueryValue), - (ndr_push_flags_fn_t) ndr_push_winreg_QueryValue, - (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryValue, -- (ndr_print_function_t) ndr_print_winreg_QueryValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5026,7 +5026,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_ReplaceKey), - (ndr_push_flags_fn_t) ndr_push_winreg_ReplaceKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_ReplaceKey, -- (ndr_print_function_t) ndr_print_winreg_ReplaceKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5035,7 +5035,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_RestoreKey), - (ndr_push_flags_fn_t) ndr_push_winreg_RestoreKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_RestoreKey, -- (ndr_print_function_t) ndr_print_winreg_RestoreKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5044,7 +5044,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_SaveKey), - (ndr_push_flags_fn_t) ndr_push_winreg_SaveKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_SaveKey, -- (ndr_print_function_t) ndr_print_winreg_SaveKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5053,7 +5053,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_SetKeySecurity), - (ndr_push_flags_fn_t) ndr_push_winreg_SetKeySecurity, - (ndr_pull_flags_fn_t) ndr_pull_winreg_SetKeySecurity, -- (ndr_print_function_t) ndr_print_winreg_SetKeySecurity, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5062,7 +5062,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_SetValue), - (ndr_push_flags_fn_t) ndr_push_winreg_SetValue, - (ndr_pull_flags_fn_t) ndr_pull_winreg_SetValue, -- (ndr_print_function_t) ndr_print_winreg_SetValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5071,7 +5071,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_UnLoadKey), - (ndr_push_flags_fn_t) ndr_push_winreg_UnLoadKey, - (ndr_pull_flags_fn_t) ndr_pull_winreg_UnLoadKey, -- (ndr_print_function_t) ndr_print_winreg_UnLoadKey, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5080,7 +5080,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_InitiateSystemShutdown), - (ndr_push_flags_fn_t) ndr_push_winreg_InitiateSystemShutdown, - (ndr_pull_flags_fn_t) ndr_pull_winreg_InitiateSystemShutdown, -- (ndr_print_function_t) ndr_print_winreg_InitiateSystemShutdown, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5089,7 +5089,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_AbortSystemShutdown), - (ndr_push_flags_fn_t) ndr_push_winreg_AbortSystemShutdown, - (ndr_pull_flags_fn_t) ndr_pull_winreg_AbortSystemShutdown, -- (ndr_print_function_t) ndr_print_winreg_AbortSystemShutdown, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5098,7 +5098,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_GetVersion), - (ndr_push_flags_fn_t) ndr_push_winreg_GetVersion, - (ndr_pull_flags_fn_t) ndr_pull_winreg_GetVersion, -- (ndr_print_function_t) ndr_print_winreg_GetVersion, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5107,7 +5107,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKCC), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCC, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCC, -- (ndr_print_function_t) ndr_print_winreg_OpenHKCC, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5116,7 +5116,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKDD), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKDD, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKDD, -- (ndr_print_function_t) ndr_print_winreg_OpenHKDD, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5125,7 +5125,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_QueryMultipleValues), - (ndr_push_flags_fn_t) ndr_push_winreg_QueryMultipleValues, - (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryMultipleValues, -- (ndr_print_function_t) ndr_print_winreg_QueryMultipleValues, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5134,7 +5134,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_InitiateSystemShutdownEx), - (ndr_push_flags_fn_t) ndr_push_winreg_InitiateSystemShutdownEx, - (ndr_pull_flags_fn_t) ndr_pull_winreg_InitiateSystemShutdownEx, -- (ndr_print_function_t) ndr_print_winreg_InitiateSystemShutdownEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5143,7 +5143,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_SaveKeyEx), - (ndr_push_flags_fn_t) ndr_push_winreg_SaveKeyEx, - (ndr_pull_flags_fn_t) ndr_pull_winreg_SaveKeyEx, -- (ndr_print_function_t) ndr_print_winreg_SaveKeyEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5152,7 +5152,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKPT), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPT, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPT, -- (ndr_print_function_t) ndr_print_winreg_OpenHKPT, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5161,7 +5161,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_OpenHKPN), - (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPN, - (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPN, -- (ndr_print_function_t) ndr_print_winreg_OpenHKPN, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5170,7 +5170,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_QueryMultipleValues2), - (ndr_push_flags_fn_t) ndr_push_winreg_QueryMultipleValues2, - (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryMultipleValues2, -- (ndr_print_function_t) ndr_print_winreg_QueryMultipleValues2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5179,7 +5179,7 @@ static const struct ndr_interface_call w - sizeof(struct winreg_DeleteKeyEx), - (ndr_push_flags_fn_t) ndr_push_winreg_DeleteKeyEx, - (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteKeyEx, -- (ndr_print_function_t) ndr_print_winreg_DeleteKeyEx, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_wkssvc.c -+++ b/source3/librpc/gen_ndr/ndr_wkssvc.c -@@ -11005,7 +11005,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetWkstaGetInfo), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetWkstaGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetWkstaGetInfo, -- (ndr_print_function_t) ndr_print_wkssvc_NetWkstaGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11014,7 +11014,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetWkstaSetInfo), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetWkstaSetInfo, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetWkstaSetInfo, -- (ndr_print_function_t) ndr_print_wkssvc_NetWkstaSetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11023,7 +11023,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetWkstaEnumUsers), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetWkstaEnumUsers, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetWkstaEnumUsers, -- (ndr_print_function_t) ndr_print_wkssvc_NetWkstaEnumUsers, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11032,7 +11032,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrWkstaUserGetInfo), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrWkstaUserGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrWkstaUserGetInfo, -- (ndr_print_function_t) ndr_print_wkssvc_NetrWkstaUserGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11041,7 +11041,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrWkstaUserSetInfo), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrWkstaUserSetInfo, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrWkstaUserSetInfo, -- (ndr_print_function_t) ndr_print_wkssvc_NetrWkstaUserSetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11050,7 +11050,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetWkstaTransportEnum), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetWkstaTransportEnum, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetWkstaTransportEnum, -- (ndr_print_function_t) ndr_print_wkssvc_NetWkstaTransportEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11059,7 +11059,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrWkstaTransportAdd), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrWkstaTransportAdd, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrWkstaTransportAdd, -- (ndr_print_function_t) ndr_print_wkssvc_NetrWkstaTransportAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11068,7 +11068,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrWkstaTransportDel), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrWkstaTransportDel, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrWkstaTransportDel, -- (ndr_print_function_t) ndr_print_wkssvc_NetrWkstaTransportDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11077,7 +11077,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrUseAdd), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrUseAdd, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrUseAdd, -- (ndr_print_function_t) ndr_print_wkssvc_NetrUseAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11086,7 +11086,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrUseGetInfo), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrUseGetInfo, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrUseGetInfo, -- (ndr_print_function_t) ndr_print_wkssvc_NetrUseGetInfo, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11095,7 +11095,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrUseDel), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrUseDel, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrUseDel, -- (ndr_print_function_t) ndr_print_wkssvc_NetrUseDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11104,7 +11104,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrUseEnum), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrUseEnum, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrUseEnum, -- (ndr_print_function_t) ndr_print_wkssvc_NetrUseEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11113,7 +11113,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrMessageBufferSend), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrMessageBufferSend, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrMessageBufferSend, -- (ndr_print_function_t) ndr_print_wkssvc_NetrMessageBufferSend, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11122,7 +11122,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrWorkstationStatisticsGet), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrWorkstationStatisticsGet, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrWorkstationStatisticsGet, -- (ndr_print_function_t) ndr_print_wkssvc_NetrWorkstationStatisticsGet, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11131,7 +11131,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrLogonDomainNameAdd), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrLogonDomainNameAdd, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrLogonDomainNameAdd, -- (ndr_print_function_t) ndr_print_wkssvc_NetrLogonDomainNameAdd, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11140,7 +11140,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrLogonDomainNameDel), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrLogonDomainNameDel, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrLogonDomainNameDel, -- (ndr_print_function_t) ndr_print_wkssvc_NetrLogonDomainNameDel, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11149,7 +11149,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrJoinDomain), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrJoinDomain, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrJoinDomain, -- (ndr_print_function_t) ndr_print_wkssvc_NetrJoinDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11158,7 +11158,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrUnjoinDomain), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrUnjoinDomain, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrUnjoinDomain, -- (ndr_print_function_t) ndr_print_wkssvc_NetrUnjoinDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11167,7 +11167,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrRenameMachineInDomain), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrRenameMachineInDomain, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrRenameMachineInDomain, -- (ndr_print_function_t) ndr_print_wkssvc_NetrRenameMachineInDomain, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11176,7 +11176,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrValidateName), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrValidateName, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrValidateName, -- (ndr_print_function_t) ndr_print_wkssvc_NetrValidateName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11185,7 +11185,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrGetJoinInformation), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrGetJoinInformation, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrGetJoinInformation, -- (ndr_print_function_t) ndr_print_wkssvc_NetrGetJoinInformation, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11194,7 +11194,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrGetJoinableOus), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrGetJoinableOus, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrGetJoinableOus, -- (ndr_print_function_t) ndr_print_wkssvc_NetrGetJoinableOus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11203,7 +11203,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrJoinDomain2), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrJoinDomain2, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrJoinDomain2, -- (ndr_print_function_t) ndr_print_wkssvc_NetrJoinDomain2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11212,7 +11212,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrUnjoinDomain2), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrUnjoinDomain2, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrUnjoinDomain2, -- (ndr_print_function_t) ndr_print_wkssvc_NetrUnjoinDomain2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11221,7 +11221,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrRenameMachineInDomain2), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrRenameMachineInDomain2, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrRenameMachineInDomain2, -- (ndr_print_function_t) ndr_print_wkssvc_NetrRenameMachineInDomain2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11230,7 +11230,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrValidateName2), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrValidateName2, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrValidateName2, -- (ndr_print_function_t) ndr_print_wkssvc_NetrValidateName2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11239,7 +11239,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrGetJoinableOus2), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrGetJoinableOus2, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrGetJoinableOus2, -- (ndr_print_function_t) ndr_print_wkssvc_NetrGetJoinableOus2, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11248,7 +11248,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrAddAlternateComputerName), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrAddAlternateComputerName, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrAddAlternateComputerName, -- (ndr_print_function_t) ndr_print_wkssvc_NetrAddAlternateComputerName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11257,7 +11257,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrRemoveAlternateComputerName), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrRemoveAlternateComputerName, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrRemoveAlternateComputerName, -- (ndr_print_function_t) ndr_print_wkssvc_NetrRemoveAlternateComputerName, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11266,7 +11266,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrSetPrimaryComputername), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrSetPrimaryComputername, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrSetPrimaryComputername, -- (ndr_print_function_t) ndr_print_wkssvc_NetrSetPrimaryComputername, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -11275,7 +11275,7 @@ static const struct ndr_interface_call w - sizeof(struct wkssvc_NetrEnumerateComputerNames), - (ndr_push_flags_fn_t) ndr_push_wkssvc_NetrEnumerateComputerNames, - (ndr_pull_flags_fn_t) ndr_pull_wkssvc_NetrEnumerateComputerNames, -- (ndr_print_function_t) ndr_print_wkssvc_NetrEnumerateComputerNames, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_wmi.c -+++ b/source3/librpc/gen_ndr/ndr_wmi.c -@@ -139,7 +139,7 @@ static const struct ndr_interface_call I - sizeof(struct Delete), - (ndr_push_flags_fn_t) ndr_push_Delete, - (ndr_pull_flags_fn_t) ndr_pull_Delete, -- (ndr_print_function_t) ndr_print_Delete, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3704,7 +3704,7 @@ static const struct ndr_interface_call I - sizeof(struct OpenNamespace), - (ndr_push_flags_fn_t) ndr_push_OpenNamespace, - (ndr_pull_flags_fn_t) ndr_pull_OpenNamespace, -- (ndr_print_function_t) ndr_print_OpenNamespace, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3713,7 +3713,7 @@ static const struct ndr_interface_call I - sizeof(struct CancelAsyncCall), - (ndr_push_flags_fn_t) ndr_push_CancelAsyncCall, - (ndr_pull_flags_fn_t) ndr_pull_CancelAsyncCall, -- (ndr_print_function_t) ndr_print_CancelAsyncCall, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3722,7 +3722,7 @@ static const struct ndr_interface_call I - sizeof(struct QueryObjectSink), - (ndr_push_flags_fn_t) ndr_push_QueryObjectSink, - (ndr_pull_flags_fn_t) ndr_pull_QueryObjectSink, -- (ndr_print_function_t) ndr_print_QueryObjectSink, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3731,7 +3731,7 @@ static const struct ndr_interface_call I - sizeof(struct GetObject), - (ndr_push_flags_fn_t) ndr_push_GetObject, - (ndr_pull_flags_fn_t) ndr_pull_GetObject, -- (ndr_print_function_t) ndr_print_GetObject, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3740,7 +3740,7 @@ static const struct ndr_interface_call I - sizeof(struct GetObjectAsync), - (ndr_push_flags_fn_t) ndr_push_GetObjectAsync, - (ndr_pull_flags_fn_t) ndr_pull_GetObjectAsync, -- (ndr_print_function_t) ndr_print_GetObjectAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3749,7 +3749,7 @@ static const struct ndr_interface_call I - sizeof(struct PutClass), - (ndr_push_flags_fn_t) ndr_push_PutClass, - (ndr_pull_flags_fn_t) ndr_pull_PutClass, -- (ndr_print_function_t) ndr_print_PutClass, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3758,7 +3758,7 @@ static const struct ndr_interface_call I - sizeof(struct PutClassAsync), - (ndr_push_flags_fn_t) ndr_push_PutClassAsync, - (ndr_pull_flags_fn_t) ndr_pull_PutClassAsync, -- (ndr_print_function_t) ndr_print_PutClassAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3767,7 +3767,7 @@ static const struct ndr_interface_call I - sizeof(struct DeleteClass), - (ndr_push_flags_fn_t) ndr_push_DeleteClass, - (ndr_pull_flags_fn_t) ndr_pull_DeleteClass, -- (ndr_print_function_t) ndr_print_DeleteClass, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3776,7 +3776,7 @@ static const struct ndr_interface_call I - sizeof(struct DeleteClassAsync), - (ndr_push_flags_fn_t) ndr_push_DeleteClassAsync, - (ndr_pull_flags_fn_t) ndr_pull_DeleteClassAsync, -- (ndr_print_function_t) ndr_print_DeleteClassAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3785,7 +3785,7 @@ static const struct ndr_interface_call I - sizeof(struct CreateClassEnum), - (ndr_push_flags_fn_t) ndr_push_CreateClassEnum, - (ndr_pull_flags_fn_t) ndr_pull_CreateClassEnum, -- (ndr_print_function_t) ndr_print_CreateClassEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3794,7 +3794,7 @@ static const struct ndr_interface_call I - sizeof(struct CreateClassEnumAsync), - (ndr_push_flags_fn_t) ndr_push_CreateClassEnumAsync, - (ndr_pull_flags_fn_t) ndr_pull_CreateClassEnumAsync, -- (ndr_print_function_t) ndr_print_CreateClassEnumAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3803,7 +3803,7 @@ static const struct ndr_interface_call I - sizeof(struct PutInstance), - (ndr_push_flags_fn_t) ndr_push_PutInstance, - (ndr_pull_flags_fn_t) ndr_pull_PutInstance, -- (ndr_print_function_t) ndr_print_PutInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3812,7 +3812,7 @@ static const struct ndr_interface_call I - sizeof(struct PutInstanceAsync), - (ndr_push_flags_fn_t) ndr_push_PutInstanceAsync, - (ndr_pull_flags_fn_t) ndr_pull_PutInstanceAsync, -- (ndr_print_function_t) ndr_print_PutInstanceAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3821,7 +3821,7 @@ static const struct ndr_interface_call I - sizeof(struct DeleteInstance), - (ndr_push_flags_fn_t) ndr_push_DeleteInstance, - (ndr_pull_flags_fn_t) ndr_pull_DeleteInstance, -- (ndr_print_function_t) ndr_print_DeleteInstance, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3830,7 +3830,7 @@ static const struct ndr_interface_call I - sizeof(struct DeleteInstanceAsync), - (ndr_push_flags_fn_t) ndr_push_DeleteInstanceAsync, - (ndr_pull_flags_fn_t) ndr_pull_DeleteInstanceAsync, -- (ndr_print_function_t) ndr_print_DeleteInstanceAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3839,7 +3839,7 @@ static const struct ndr_interface_call I - sizeof(struct CreateInstanceEnum), - (ndr_push_flags_fn_t) ndr_push_CreateInstanceEnum, - (ndr_pull_flags_fn_t) ndr_pull_CreateInstanceEnum, -- (ndr_print_function_t) ndr_print_CreateInstanceEnum, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3848,7 +3848,7 @@ static const struct ndr_interface_call I - sizeof(struct CreateInstanceEnumAsync), - (ndr_push_flags_fn_t) ndr_push_CreateInstanceEnumAsync, - (ndr_pull_flags_fn_t) ndr_pull_CreateInstanceEnumAsync, -- (ndr_print_function_t) ndr_print_CreateInstanceEnumAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3857,7 +3857,7 @@ static const struct ndr_interface_call I - sizeof(struct ExecQuery), - (ndr_push_flags_fn_t) ndr_push_ExecQuery, - (ndr_pull_flags_fn_t) ndr_pull_ExecQuery, -- (ndr_print_function_t) ndr_print_ExecQuery, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3866,7 +3866,7 @@ static const struct ndr_interface_call I - sizeof(struct ExecQueryAsync), - (ndr_push_flags_fn_t) ndr_push_ExecQueryAsync, - (ndr_pull_flags_fn_t) ndr_pull_ExecQueryAsync, -- (ndr_print_function_t) ndr_print_ExecQueryAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3875,7 +3875,7 @@ static const struct ndr_interface_call I - sizeof(struct ExecNotificationQuery), - (ndr_push_flags_fn_t) ndr_push_ExecNotificationQuery, - (ndr_pull_flags_fn_t) ndr_pull_ExecNotificationQuery, -- (ndr_print_function_t) ndr_print_ExecNotificationQuery, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3884,7 +3884,7 @@ static const struct ndr_interface_call I - sizeof(struct ExecNotificationQueryAsync), - (ndr_push_flags_fn_t) ndr_push_ExecNotificationQueryAsync, - (ndr_pull_flags_fn_t) ndr_pull_ExecNotificationQueryAsync, -- (ndr_print_function_t) ndr_print_ExecNotificationQueryAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3893,7 +3893,7 @@ static const struct ndr_interface_call I - sizeof(struct ExecMethod), - (ndr_push_flags_fn_t) ndr_push_ExecMethod, - (ndr_pull_flags_fn_t) ndr_pull_ExecMethod, -- (ndr_print_function_t) ndr_print_ExecMethod, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -3902,7 +3902,7 @@ static const struct ndr_interface_call I - sizeof(struct ExecMethodAsync), - (ndr_push_flags_fn_t) ndr_push_ExecMethodAsync, - (ndr_pull_flags_fn_t) ndr_pull_ExecMethodAsync, -- (ndr_print_function_t) ndr_print_ExecMethodAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4434,7 +4434,7 @@ static const struct ndr_interface_call I - sizeof(struct Reset), - (ndr_push_flags_fn_t) ndr_push_Reset, - (ndr_pull_flags_fn_t) ndr_pull_Reset, -- (ndr_print_function_t) ndr_print_Reset, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4443,7 +4443,7 @@ static const struct ndr_interface_call I - sizeof(struct IEnumWbemClassObject_Next), - (ndr_push_flags_fn_t) ndr_push_IEnumWbemClassObject_Next, - (ndr_pull_flags_fn_t) ndr_pull_IEnumWbemClassObject_Next, -- (ndr_print_function_t) ndr_print_IEnumWbemClassObject_Next, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4452,7 +4452,7 @@ static const struct ndr_interface_call I - sizeof(struct NextAsync), - (ndr_push_flags_fn_t) ndr_push_NextAsync, - (ndr_pull_flags_fn_t) ndr_pull_NextAsync, -- (ndr_print_function_t) ndr_print_NextAsync, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4461,7 +4461,7 @@ static const struct ndr_interface_call I - sizeof(struct IEnumWbemClassObject_Clone), - (ndr_push_flags_fn_t) ndr_push_IEnumWbemClassObject_Clone, - (ndr_pull_flags_fn_t) ndr_pull_IEnumWbemClassObject_Clone, -- (ndr_print_function_t) ndr_print_IEnumWbemClassObject_Clone, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -4470,7 +4470,7 @@ static const struct ndr_interface_call I - sizeof(struct Skip), - (ndr_push_flags_fn_t) ndr_push_Skip, - (ndr_pull_flags_fn_t) ndr_pull_Skip, -- (ndr_print_function_t) ndr_print_Skip, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5143,7 +5143,7 @@ static const struct ndr_interface_call I - sizeof(struct Clone), - (ndr_push_flags_fn_t) ndr_push_Clone, - (ndr_pull_flags_fn_t) ndr_pull_Clone, -- (ndr_print_function_t) ndr_print_Clone, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5152,7 +5152,7 @@ static const struct ndr_interface_call I - sizeof(struct GetNames), - (ndr_push_flags_fn_t) ndr_push_GetNames, - (ndr_pull_flags_fn_t) ndr_pull_GetNames, -- (ndr_print_function_t) ndr_print_GetNames, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5161,7 +5161,7 @@ static const struct ndr_interface_call I - sizeof(struct BeginEnumeration), - (ndr_push_flags_fn_t) ndr_push_BeginEnumeration, - (ndr_pull_flags_fn_t) ndr_pull_BeginEnumeration, -- (ndr_print_function_t) ndr_print_BeginEnumeration, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5170,7 +5170,7 @@ static const struct ndr_interface_call I - sizeof(struct Next), - (ndr_push_flags_fn_t) ndr_push_Next, - (ndr_pull_flags_fn_t) ndr_pull_Next, -- (ndr_print_function_t) ndr_print_Next, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5179,7 +5179,7 @@ static const struct ndr_interface_call I - sizeof(struct EndEnumeration), - (ndr_push_flags_fn_t) ndr_push_EndEnumeration, - (ndr_pull_flags_fn_t) ndr_pull_EndEnumeration, -- (ndr_print_function_t) ndr_print_EndEnumeration, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5188,7 +5188,7 @@ static const struct ndr_interface_call I - sizeof(struct SetValue), - (ndr_push_flags_fn_t) ndr_push_SetValue, - (ndr_pull_flags_fn_t) ndr_pull_SetValue, -- (ndr_print_function_t) ndr_print_SetValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5197,7 +5197,7 @@ static const struct ndr_interface_call I - sizeof(struct GetValue), - (ndr_push_flags_fn_t) ndr_push_GetValue, - (ndr_pull_flags_fn_t) ndr_pull_GetValue, -- (ndr_print_function_t) ndr_print_GetValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5206,7 +5206,7 @@ static const struct ndr_interface_call I - sizeof(struct DeleteValue), - (ndr_push_flags_fn_t) ndr_push_DeleteValue, - (ndr_pull_flags_fn_t) ndr_pull_DeleteValue, -- (ndr_print_function_t) ndr_print_DeleteValue, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5215,7 +5215,7 @@ static const struct ndr_interface_call I - sizeof(struct DeleteAll), - (ndr_push_flags_fn_t) ndr_push_DeleteAll, - (ndr_pull_flags_fn_t) ndr_pull_DeleteAll, -- (ndr_print_function_t) ndr_print_DeleteAll, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5963,7 +5963,7 @@ static const struct ndr_interface_call I - sizeof(struct EstablishPosition), - (ndr_push_flags_fn_t) ndr_push_EstablishPosition, - (ndr_pull_flags_fn_t) ndr_pull_EstablishPosition, -- (ndr_print_function_t) ndr_print_EstablishPosition, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5972,7 +5972,7 @@ static const struct ndr_interface_call I - sizeof(struct RequestChallenge), - (ndr_push_flags_fn_t) ndr_push_RequestChallenge, - (ndr_pull_flags_fn_t) ndr_pull_RequestChallenge, -- (ndr_print_function_t) ndr_print_RequestChallenge, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5981,7 +5981,7 @@ static const struct ndr_interface_call I - sizeof(struct WBEMLogin), - (ndr_push_flags_fn_t) ndr_push_WBEMLogin, - (ndr_pull_flags_fn_t) ndr_pull_WBEMLogin, -- (ndr_print_function_t) ndr_print_WBEMLogin, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -5990,7 +5990,7 @@ static const struct ndr_interface_call I - sizeof(struct NTLMLogin), - (ndr_push_flags_fn_t) ndr_push_NTLMLogin, - (ndr_pull_flags_fn_t) ndr_pull_NTLMLogin, -- (ndr_print_function_t) ndr_print_NTLMLogin, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6225,7 +6225,7 @@ static const struct ndr_interface_call I - sizeof(struct IWbemWCOSmartEnum_Next), - (ndr_push_flags_fn_t) ndr_push_IWbemWCOSmartEnum_Next, - (ndr_pull_flags_fn_t) ndr_pull_IWbemWCOSmartEnum_Next, -- (ndr_print_function_t) ndr_print_IWbemWCOSmartEnum_Next, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6479,7 +6479,7 @@ static const struct ndr_interface_call I - sizeof(struct Fetch), - (ndr_push_flags_fn_t) ndr_push_Fetch, - (ndr_pull_flags_fn_t) ndr_pull_Fetch, -- (ndr_print_function_t) ndr_print_Fetch, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6488,7 +6488,7 @@ static const struct ndr_interface_call I - sizeof(struct Test), - (ndr_push_flags_fn_t) ndr_push_Test, - (ndr_pull_flags_fn_t) ndr_pull_Test, -- (ndr_print_function_t) ndr_print_Test, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6920,7 +6920,7 @@ static const struct ndr_interface_call I - sizeof(struct GetResultObject), - (ndr_push_flags_fn_t) ndr_push_GetResultObject, - (ndr_pull_flags_fn_t) ndr_pull_GetResultObject, -- (ndr_print_function_t) ndr_print_GetResultObject, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6929,7 +6929,7 @@ static const struct ndr_interface_call I - sizeof(struct GetResultString), - (ndr_push_flags_fn_t) ndr_push_GetResultString, - (ndr_pull_flags_fn_t) ndr_pull_GetResultString, -- (ndr_print_function_t) ndr_print_GetResultString, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6938,7 +6938,7 @@ static const struct ndr_interface_call I - sizeof(struct GetResultServices), - (ndr_push_flags_fn_t) ndr_push_GetResultServices, - (ndr_pull_flags_fn_t) ndr_pull_GetResultServices, -- (ndr_print_function_t) ndr_print_GetResultServices, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -6947,7 +6947,7 @@ static const struct ndr_interface_call I - sizeof(struct GetCallStatus), - (ndr_push_flags_fn_t) ndr_push_GetCallStatus, - (ndr_pull_flags_fn_t) ndr_pull_GetCallStatus, -- (ndr_print_function_t) ndr_print_GetCallStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7211,7 +7211,7 @@ static const struct ndr_interface_call I - sizeof(struct SetStatus), - (ndr_push_flags_fn_t) ndr_push_SetStatus, - (ndr_pull_flags_fn_t) ndr_pull_SetStatus, -- (ndr_print_function_t) ndr_print_SetStatus, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -7220,7 +7220,7 @@ static const struct ndr_interface_call I - sizeof(struct Indicate), - (ndr_push_flags_fn_t) ndr_push_Indicate, - (ndr_pull_flags_fn_t) ndr_pull_Indicate, -- (ndr_print_function_t) ndr_print_Indicate, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_wzcsvc.c -+++ b/source3/librpc/gen_ndr/ndr_wzcsvc.c -@@ -711,7 +711,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EnumInterfaces), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EnumInterfaces, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EnumInterfaces, -- (ndr_print_function_t) ndr_print_wzcsvc_EnumInterfaces, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -720,7 +720,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_QueryInterface), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_QueryInterface, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_QueryInterface, -- (ndr_print_function_t) ndr_print_wzcsvc_QueryInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -729,7 +729,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_SetInterface), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_SetInterface, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_SetInterface, -- (ndr_print_function_t) ndr_print_wzcsvc_SetInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -738,7 +738,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_RefreshInterface), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_RefreshInterface, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_RefreshInterface, -- (ndr_print_function_t) ndr_print_wzcsvc_RefreshInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -747,7 +747,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_QueryContext), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_QueryContext, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_QueryContext, -- (ndr_print_function_t) ndr_print_wzcsvc_QueryContext, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -756,7 +756,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_SetContext), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_SetContext, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_SetContext, -- (ndr_print_function_t) ndr_print_wzcsvc_SetContext, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -765,7 +765,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolUIResponse), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolUIResponse, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolUIResponse, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolUIResponse, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -774,7 +774,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolGetCustomAuthData), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolGetCustomAuthData, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolGetCustomAuthData, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolGetCustomAuthData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -783,7 +783,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolSetCustomAuthData), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolSetCustomAuthData, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolSetCustomAuthData, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolSetCustomAuthData, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -792,7 +792,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolGetInterfaceParams), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolGetInterfaceParams, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolGetInterfaceParams, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolGetInterfaceParams, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -801,7 +801,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolSetInterfaceParams), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolSetInterfaceParams, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolSetInterfaceParams, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolSetInterfaceParams, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -810,7 +810,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolReAuthenticateInterface), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolReAuthenticateInterface, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolReAuthenticateInterface, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolReAuthenticateInterface, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -819,7 +819,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EapolQueryInterfaceState), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EapolQueryInterfaceState, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EapolQueryInterfaceState, -- (ndr_print_function_t) ndr_print_wzcsvc_EapolQueryInterfaceState, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -828,7 +828,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_OpenWZCDbLogSession), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_OpenWZCDbLogSession, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_OpenWZCDbLogSession, -- (ndr_print_function_t) ndr_print_wzcsvc_OpenWZCDbLogSession, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -837,7 +837,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_CloseWZCDbLogSession), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_CloseWZCDbLogSession, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_CloseWZCDbLogSession, -- (ndr_print_function_t) ndr_print_wzcsvc_CloseWZCDbLogSession, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -846,7 +846,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_EnumWZCDbLogRecords), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_EnumWZCDbLogRecords, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_EnumWZCDbLogRecords, -- (ndr_print_function_t) ndr_print_wzcsvc_EnumWZCDbLogRecords, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -855,7 +855,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_FlushWZCdbLog), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_FlushWZCdbLog, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_FlushWZCdbLog, -- (ndr_print_function_t) ndr_print_wzcsvc_FlushWZCdbLog, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, -@@ -864,7 +864,7 @@ static const struct ndr_interface_call w - sizeof(struct wzcsvc_GetWZCDbLogRecord), - (ndr_push_flags_fn_t) ndr_push_wzcsvc_GetWZCDbLogRecord, - (ndr_pull_flags_fn_t) ndr_pull_wzcsvc_GetWZCDbLogRecord, -- (ndr_print_function_t) ndr_print_wzcsvc_GetWZCDbLogRecord, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- a/source3/librpc/gen_ndr/ndr_xattr.c -+++ b/source3/librpc/gen_ndr/ndr_xattr.c -@@ -1101,7 +1101,7 @@ static const struct ndr_interface_call x - sizeof(struct xattr_parse_DOSATTRIB), - (ndr_push_flags_fn_t) ndr_push_xattr_parse_DOSATTRIB, - (ndr_pull_flags_fn_t) ndr_pull_xattr_parse_DOSATTRIB, -- (ndr_print_function_t) ndr_print_xattr_parse_DOSATTRIB, -+ (ndr_print_function_t) ndr_print_disabled, - { 0, NULL }, - { 0, NULL }, - }, ---- /dev/null -+++ b/source3/remove-librpc-print-calls.sh -@@ -0,0 +1,22 @@ -+#!/usr/bin/env bash -+set -e -+for file in ${1:-librpc/gen_ndr/ndr_*.c}; do -+ quilt add "$file" || true -+ awk ' -+$0 ~ /^static const struct ndr_interface_call .* = {$/ { -+ replace = 1 -+} -+ -+$0 ~ /^}$/ { -+ replace = 0; -+} -+ -+replace == 1 { -+ gsub(/.ndr_print_function_t. .*,/, "(ndr_print_function_t) ndr_print_disabled,", $0) -+} -+{ -+ print $0 -+} -+ ' < "$file" > "$file.new" -+ mv "$file.new" "$file" -+done ---- a/librpc/ndr/libndr.h -+++ b/librpc/ndr/libndr.h -@@ -597,6 +597,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_enum - _PUBLIC_ enum ndr_err_code ndr_push_enum_uint1632(struct ndr_push *ndr, int ndr_flags, uint16_t v); - - _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b); -+_PUBLIC_ void ndr_print_disabled(struct ndr_print *ndr, const char *name, int flags, void *r); - - #ifndef VERBOSE_ERROR - #define ndr_print_bool(...) do {} while (0) diff --git a/packages/network/samba/patches/samba-331-Wrap-more-function-calls-in-talloc_stackframe.patch b/packages/network/samba/patches/samba-331-Wrap-more-function-calls-in-talloc_stackframe.patch deleted file mode 100644 index f2cb455fea..0000000000 --- a/packages/network/samba/patches/samba-331-Wrap-more-function-calls-in-talloc_stackframe.patch +++ /dev/null @@ -1,138 +0,0 @@ -From d7758e2be5d810f2dcd068ccd3b577706f13120d Mon Sep 17 00:00:00 2001 -From: Andrew Bartlett -Date: Tue, 1 Apr 2014 17:03:34 +1300 -Subject: [PATCH] libsmbclient: Wrap more function calls in talloc_stackframe() - to protect against talloc_tos() calls - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=8449 - -Signed-off-by: Andrew Bartlett -Reviewed-by: Jeremy Allison ---- - source3/libsmb/libsmb_context.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c -index c2b88f5..ffa4d2d 100644 ---- a/source3/libsmb/libsmb_context.c -+++ b/source3/libsmb/libsmb_context.c -@@ -560,6 +560,7 @@ SMBCCTX * - smbc_init_context(SMBCCTX *context) - { - int pid; -+ TALLOC_CTX *frame; - - if (!context) { - errno = EBADF; -@@ -571,11 +572,14 @@ smbc_init_context(SMBCCTX *context) - return NULL; - } - -+ frame = talloc_stackframe(); -+ - if ((!smbc_getFunctionAuthData(context) && - !smbc_getFunctionAuthDataWithContext(context)) || - smbc_getDebug(context) < 0 || - smbc_getDebug(context) > 100) { - -+ TALLOC_FREE(frame); - errno = EINVAL; - return NULL; - -@@ -594,6 +598,7 @@ smbc_init_context(SMBCCTX *context) - } - - if (!user) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -602,6 +607,7 @@ smbc_init_context(SMBCCTX *context) - SAFE_FREE(user); - - if (!smbc_getUser(context)) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -624,6 +630,7 @@ smbc_init_context(SMBCCTX *context) - pid = getpid(); - netbios_name = (char *)SMB_MALLOC(17); - if (!netbios_name) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -632,6 +639,7 @@ smbc_init_context(SMBCCTX *context) - } - - if (!netbios_name) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -640,6 +648,7 @@ smbc_init_context(SMBCCTX *context) - SAFE_FREE(netbios_name); - - if (!smbc_getNetbiosName(context)) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -659,6 +668,7 @@ smbc_init_context(SMBCCTX *context) - } - - if (!workgroup) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -667,6 +677,7 @@ smbc_init_context(SMBCCTX *context) - SAFE_FREE(workgroup); - - if (!smbc_getWorkgroup(context)) { -+ TALLOC_FREE(frame); - errno = ENOMEM; - return NULL; - } -@@ -692,6 +703,7 @@ smbc_init_context(SMBCCTX *context) - smb_panic("error unlocking 'initialized_ctx_count'"); - } - -+ TALLOC_FREE(frame); - return context; - } - -@@ -727,12 +739,15 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context, - smbc_bool use_kerberos = false; - const char *signing_state = "off"; - struct user_auth_info *auth_info = NULL; -+ TALLOC_CTX *frame; - - if (! context) { - - return; - } - -+ frame = talloc_stackframe(); -+ - if (! workgroup || ! *workgroup) { - workgroup = smbc_getWorkgroup(context); - } -@@ -749,6 +764,7 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context, - - if (! auth_info) { - DEBUG(0, ("smbc_set_credentials_with_fallback: allocation fail\n")); -+ TALLOC_FREE(frame); - return; - } - -@@ -777,4 +793,5 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context, - TALLOC_FREE(context->internal->auth_info); - - context->internal->auth_info = auth_info; -+ TALLOC_FREE(frame); - } --- -1.9.1.423.g4596e3a - diff --git a/packages/network/samba/patches/samba-501-rename_string_free.patch b/packages/network/samba/patches/samba-501-rename_string_free.patch deleted file mode 100644 index 214b06c7f3..0000000000 --- a/packages/network/samba/patches/samba-501-rename_string_free.patch +++ /dev/null @@ -1,123 +0,0 @@ -diff -urN a/source3/include/proto.h b/source3/include/proto.h ---- a/source3/include/proto.h 2014-06-23 08:03:27.000000000 +0200 -+++ b/source3/include/proto.h 2014-11-01 13:02:42.918300338 +0100 -@@ -947,7 +947,7 @@ - size_t maxlength); - char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n); - bool in_list(const char *s, const char *list, bool casesensitive); --void string_free(char **s); -+void smb_string_free(char **s); - bool string_set(char **dest,const char *src); - void string_sub2(char *s,const char *pattern, const char *insert, size_t len, - bool remove_unsafe_characters, bool replace_once, -diff -urN a/source3/lib/util_str.c b/source3/lib/util_str.c ---- a/source3/lib/util_str.c 2014-06-23 08:03:27.000000000 +0200 -+++ b/source3/lib/util_str.c 2014-11-01 13:03:11.113658974 +0100 -@@ -764,7 +764,7 @@ - Free a string value. - **/ - --void string_free(char **s) -+void smb_string_free(char **s) - { - if (!s || !(*s)) - return; -@@ -780,7 +780,7 @@ - - bool string_set(char **dest,const char *src) - { -- string_free(dest); -+ smb_string_free(dest); - return(string_init(dest,src)); - } - -diff -urN a/source3/param/loadparm.c b/source3/param/loadparm.c ---- a/source3/param/loadparm.c 2014-06-23 08:03:27.000000000 +0200 -+++ b/source3/param/loadparm.c 2014-11-01 13:03:03.872057887 +0100 -@@ -4998,7 +4998,7 @@ - if ((parm.type == P_STRING) || - (parm.type == P_USTRING)) - { -- string_free((char**)parm_ptr); -+ smb_string_free((char**)parm_ptr); - } else if (parm.type == P_LIST) { - TALLOC_FREE(*((char***)parm_ptr)); - } -@@ -5160,7 +5160,7 @@ - if (!done_init) { - /* The logfile can be set before this is invoked. Free it if so. */ - if (Globals.szLogFile != NULL) { -- string_free(&Globals.szLogFile); -+ smb_string_free(&Globals.szLogFile); - Globals.szLogFile = NULL; - } - done_init = True; -@@ -6108,7 +6108,7 @@ - - while (data) { - if (strwicmp(data->key, param_key) == 0) { -- string_free(¶m_key); -+ smb_string_free(¶m_key); - return data; - } - data = data->next; -@@ -6120,14 +6120,14 @@ - data = Globals.param_opt; - while (data) { - if (strwicmp(data->key, param_key) == 0) { -- string_free(¶m_key); -+ smb_string_free(¶m_key); - return data; - } - data = data->next; - } - } - -- string_free(¶m_key); -+ smb_string_free(¶m_key); - - return NULL; - } -@@ -6350,8 +6350,8 @@ - } - opt = *popts; - while (opt != NULL) { -- string_free(&opt->key); -- string_free(&opt->value); -+ smb_string_free(&opt->key); -+ smb_string_free(&opt->value); - TALLOC_FREE(opt->list); - next_opt = opt->next; - SAFE_FREE(opt); -@@ -6375,7 +6375,7 @@ - - free_parameters(pservice); - -- string_free(&pservice->szService); -+ smb_string_free(&pservice->szService); - TALLOC_FREE(pservice->copymap); - - free_param_opts(&pservice->param_opt); -@@ -7085,7 +7085,7 @@ - overridden */ - return; - } -- string_free(&opt->value); -+ smb_string_free(&opt->value); - TALLOC_FREE(opt->list); - opt->value = SMB_STRDUP(opt_value); - opt->flags = flags; -diff -urN a/source3/smbd/conn.c b/source3/smbd/conn.c ---- a/source3/smbd/conn.c 2014-06-23 08:03:27.000000000 +0200 -+++ b/source3/smbd/conn.c 2014-11-01 13:02:49.008926676 +0100 -@@ -412,8 +412,8 @@ - free_namearray(conn->veto_oplock_list); - free_namearray(conn->aio_write_behind_list); - -- string_free(&conn->connectpath); -- string_free(&conn->origpath); -+ smb_string_free(&conn->connectpath); -+ smb_string_free(&conn->origpath); - - ZERO_STRUCTP(conn); - talloc_destroy(conn); \ No newline at end of file diff --git a/packages/network/samba/patches/samba-950-no-man.patch b/packages/network/samba/patches/samba-950-no-man.patch new file mode 100644 index 0000000000..69867e9f75 --- /dev/null +++ b/packages/network/samba/patches/samba-950-no-man.patch @@ -0,0 +1,87 @@ +diff -Naur samba-4.5.5/buildtools/wafsamba/wafsamba.py samba-4.5.5.patch/buildtools/wafsamba/wafsamba.py +--- samba-4.5.5/buildtools/wafsamba/wafsamba.py 2016-08-11 09:51:04.000000000 +0200 ++++ samba-4.5.5.patch/buildtools/wafsamba/wafsamba.py 2017-02-17 15:33:36.453169574 +0100 +@@ -330,9 +330,9 @@ + if pc_files is not None and not private_library: + bld.PKG_CONFIG_FILES(pc_files, vnum=vnum) + +- if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and +- bld.env['XSLTPROC_MANPAGES']): +- bld.MANPAGES(manpages, install) ++# if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and ++# bld.env['XSLTPROC_MANPAGES']): ++# bld.MANPAGES(manpages, install) + + + Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY +@@ -437,8 +437,8 @@ + samba_ldflags = pie_ldflags + ) + +- if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']: +- bld.MANPAGES(manpages, install) ++# if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']: ++# bld.MANPAGES(manpages, install) + + Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY + +diff -Naur samba-4.5.5/docs-xml/wscript_build samba-4.5.5.patch/docs-xml/wscript_build +--- samba-4.5.5/docs-xml/wscript_build 2016-08-11 09:51:04.000000000 +0200 ++++ samba-4.5.5.patch/docs-xml/wscript_build 2017-02-17 15:44:45.142392019 +0100 +@@ -127,23 +127,23 @@ + rule=smbdotconf_generate_parameter_list, + dep_vars=bld.dynconfig_varnames()) + +-def SMBDOTCONF_MANPAGE(bld, target): +- ''' assemble and build smb.conf.5 manual page''' +- bld.SAMBAMANPAGES(target, parameter_all) +- +-if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']): +- +- SMBDOTCONF_MANPAGE(bld, 'manpages/smb.conf.5') +- bld.SAMBAMANPAGES(manpages) +- +- if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'): +- bld.SAMBAMANPAGES(pam_winbind_manpages) +- +- if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'): +- bld.SAMBAMANPAGES(krb5_locator_manpages) +- +- if bld.CONFIG_SET('HAVE_KRB5_LOCALAUTH_PLUGIN_H'): +- bld.SAMBAMANPAGES(krb5_localauth_manpages) +- +- if bld.SAMBA3_IS_ENABLED_MODULE('vfs_zfsacl'): +- bld.SAMBAMANPAGES('manpages/vfs_zfsacl.8') ++#def SMBDOTCONF_MANPAGE(bld, target): ++# ''' assemble and build smb.conf.5 manual page''' ++# bld.SAMBAMANPAGES(target, parameter_all) ++# ++#if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']): ++# ++# SMBDOTCONF_MANPAGE(bld, 'manpages/smb.conf.5') ++# bld.SAMBAMANPAGES(manpages) ++# ++# if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'): ++# bld.SAMBAMANPAGES(pam_winbind_manpages) ++# ++# if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'): ++# bld.SAMBAMANPAGES(krb5_locator_manpages) ++# ++# if bld.CONFIG_SET('HAVE_KRB5_LOCALAUTH_PLUGIN_H'): ++# bld.SAMBAMANPAGES(krb5_localauth_manpages) ++# ++# if bld.SAMBA3_IS_ENABLED_MODULE('vfs_zfsacl'): ++# bld.SAMBAMANPAGES('manpages/vfs_zfsacl.8') +--- a/source4/scripting/wscript_build 2018-03-20 12:19:12.059332486 +0100 ++++ b/source4/scripting/wscript_build 2018-03-20 12:19:32.087429756 +0100 +@@ -12,8 +12,8 @@ + bld.INSTALL_FILES('${SBINDIR}', + sbin_files, + chmod=MODE_755, python_fixup=True, flat=True) +- if 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']: +- bld.MANPAGES(man_files, True) ++# if 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']: ++# bld.MANPAGES(man_files, True) + + if bld.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'): + bld.INSTALL_FILES('${BINDIR}', diff --git a/packages/network/samba/scripts/samba-autoshare b/packages/network/samba/scripts/samba-autoshare index 1778327093..7112925dd9 100755 --- a/packages/network/samba/scripts/samba-autoshare +++ b/packages/network/samba/scripts/samba-autoshare @@ -1,26 +1,13 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) if [ -f /storage/.cache/services/samba.conf ]; then . /storage/.cache/services/samba.conf if [ "$SAMBA_AUTOSHARE" == "true" ] ; then - systemctl restart smbd.service + /usr/lib/samba/samba-config + [ -f /run/samba/smbd.pid ] && pkill -HUP smbd fi fi diff --git a/packages/network/samba/scripts/samba-config b/packages/network/samba/scripts/samba-config index f7fe7db5bd..927010695b 100755 --- a/packages/network/samba/scripts/samba-config +++ b/packages/network/samba/scripts/samba-config @@ -1,66 +1,41 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) SMB_USERCONF="/storage/.config/samba.conf" SMB_DEFCONF="/etc/samba/smb.conf" SMB_CONF="/run/samba/smb.conf" -if [ ! -f /storage/.cache/services/samba.conf ]; then - /bin/cp /usr/share/services/samba.conf /storage/.cache/services -fi - -. /storage/.cache/services/samba.conf +SMB_USERCONF_IS_VALID=no +SMB_CONFIG_VERSION=4 -mkdir -p /run/samba +# If user config is based on legacy OpenELEC, or old version (or no version) +# then don't use it, and log a warning. if [ -f $SMB_USERCONF ]; then - cp $SMB_USERCONF $SMB_CONF -else - cp $SMB_DEFCONF $SMB_CONF + SMB_IS_LEGACY="$(awk 'NR <= 2 && /This file is part of OpenELEC/{ print }' $SMB_USERCONF)" + SMB_THIS_VER="$(awk '/^# samba.conf v[0-9\.]*/{ print substr($3,2); exit }' $SMB_USERCONF)" + if [ -n "${SMB_IS_LEGACY}" ]; then + echo "WARNING: Ignoring user config $SMB_USERCONF due to incompatibility [Old style OpenELEC]" + elif [ -z "${SMB_THIS_VER}" ]; then + echo "WARNING: Ignoring user config $SMB_USERCONF due to incompatibility [version is unknown or invalid]" + elif [ ${SMB_THIS_VER} != ${SMB_CONFIG_VERSION} ]; then + echo "WARNING: Ignoring user config $SMB_USERCONF due to incompatibility [version ${SMB_THIS_VER} is not the required version $SMB_CONFIG_VERSION]" + else + SMB_USERCONF_IS_VALID=yes + fi fi -# handle external drives -if [ "$SAMBA_AUTOSHARE" == "true" ] ; then - for dir in /media/* ; do - if [ -d "$dir" ] ; then - name=$(basename "$dir") - echo -e "[$name]\n path = $dir\n available = yes\n browsable = yes\n public = yes\n writable = yes\n" >> $SMB_CONF - fi - done -fi +mkdir -p $(dirname $SMB_CONF) + if [ $SMB_USERCONF_IS_VALID = yes ]; then + cp $SMB_USERCONF $SMB_CONF + else + cp $SMB_DEFCONF $SMB_CONF + fi -# only letters & numbers permitted for username & password -SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"` -SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"` - -if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then - # username map: first line makes sure plain root does not work all the time - # processing continues, so if user chooses root as username, second line overrides the first - # this is done always in case user uses passwords in userconf. - # many thanks to viljoviitanen for this - echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1 - echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /var/run/samba.map - - sed -e 's|^.[ \t]*.public.=.*| public = no |' -i $SMB_CONF - sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF - sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' -i $SMB_CONF -else - sed -e 's|^.[ \t]*.public.=.*| public = yes |' -i $SMB_CONF - sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF - sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF +# Generate smb.conf, unless disabled +if [ ! -f /storage/.cache/services/samba.disabled ]; then + /usr/lib/samba/smbd-config fi + +exit 0 diff --git a/packages/network/samba/scripts/smbd-config b/packages/network/samba/scripts/smbd-config new file mode 100755 index 0000000000..0d789708f9 --- /dev/null +++ b/packages/network/samba/scripts/smbd-config @@ -0,0 +1,80 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) + +SMB_CONF="/run/samba/smb.conf" +SMB_TMP="$(mktemp -p /run/samba)" + +cp -f $SMB_CONF $SMB_TMP + +if [ ! -f /storage/.cache/services/samba.conf ]; then + cp /usr/share/services/samba.conf /storage/.cache/services +fi + +# Specify defaults here, in case these new properties not yet added in .cache +SAMBA_WORKGROUP=WORKGROUP +SAMBA_MINPROTOCOL=SMB2 +SAMBA_MAXPROTOCOL=SMB3 + +. /storage/.cache/services/samba.conf + +# fixup synonyms +sed -i 's/browsable/browseable/g; s/writable/writeable/g' $SMB_TMP + +# handle external drives +if [ "$SAMBA_AUTOSHARE" == "true" ] ; then + for dir in /media/* ; do + if [ -d "$dir" ] ; then + name=$(basename "$dir") + echo -e "[$name]\n path = $dir\n available = yes\n browseable = yes\n public = yes\n writeable = yes\n" >> $SMB_TMP + fi + done +fi + +# Allow access to a "failed" (safe mode) Kodi installation +if [ -d /storage/.kodi.FAILED ]; then + echo -e "[Kodi-Failed]\n path = /storage/.kodi.FAILED\n available = yes\n browseable = yes\n public = yes\n writeable = yes\n" >> $SMB_TMP +fi + +ADD_CONFIG= + +# If workgroup is not set, don't set it - who knows, user may know better. +if [ -n "$SAMBA_WORKGROUP" ]; then + # Remove any existing workgroup setting + sed -E '/^[[:space:]]*workgroup[[:space:]]*=/d' -i $SMB_TMP + ADD_CONFIG="${ADD_CONFIG} workgroup = ${SAMBA_WORKGROUP:-WORKGROUP}\n" +fi + +ADD_CONFIG="${ADD_CONFIG} server min protocol = ${SAMBA_MINPROTOCOL/SMB1/NT1}\n" +ADD_CONFIG="${ADD_CONFIG} server max protocol = ${SAMBA_MAXPROTOCOL/SMB1/NT1}\n" + +# Add extra config after [global], escaping spaces so that all are retained by sed +sed -e "/\[global\]/ a ${ADD_CONFIG// /\\ }" -i $SMB_TMP + +# only letters & numbers permitted for username & password + SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"` + SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"` + +if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then + # username map: first line makes sure plain root does not work all the time + # processing continues, so if user chooses root as username, second line overrides the first + # this is done always in case user uses passwords in userconf. + # many thanks to viljoviitanen for this + echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1 + echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /run/samba/samba.map + + sed -e 's|^.[ \t]*.public.=.*| public = no |' \ + -e 's|^.[ \t]*.username map.=.*||' \ + -e 's|^.[ \t]*.security.=.*| security = user\n username map = /run/samba/samba.map|' \ + -e 's|^.[ \t]*.map.to.guest.=.*| map to guest = Never|' \ + -i $SMB_TMP +else + sed -e 's|^.[ \t]*.public.=.*| public = yes |' \ + -e 's|^.[ \t]*.username map.=.*||' \ + -e 's|^.[ \t]*.security.=.*| security = user|' \ + -e 's|^.[ \t]*.map.to.guest.=.*| map to guest = Bad User|' \ + -i $SMB_TMP +fi + +mv -f $SMB_TMP $SMB_CONF diff --git a/packages/network/samba/system.d.opt/nmbd.service b/packages/network/samba/system.d.opt/nmbd.service index 73b7a7f010..a2dc1b35a2 100644 --- a/packages/network/samba/system.d.opt/nmbd.service +++ b/packages/network/samba/system.d.opt/nmbd.service @@ -1,12 +1,14 @@ [Unit] Description=Samba NMB Daemon -After=network.target smbd.service -ConditionPathExists=/storage/.cache/services/samba.conf +Wants=network-online.target samba-config.service +After=network-online.target samba-config.service +ConditionPathExists=!/storage/.cache/services/samba.disabled +ConditionPathExists=/run/samba/smb.conf [Service] Type=forking -PIDFile=/var/run/nmbd-smb.conf.pid -ExecStart=/usr/bin/nmbd --configfile=/run/samba/smb.conf +PIDFile=/run/samba/nmbd.pid +ExecStart=/usr/sbin/nmbd ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=1s Restart=always diff --git a/packages/network/samba/system.d.opt/smbd.service b/packages/network/samba/system.d.opt/smbd.service index 33c04934e8..4353fa2667 100644 --- a/packages/network/samba/system.d.opt/smbd.service +++ b/packages/network/samba/system.d.opt/smbd.service @@ -1,14 +1,15 @@ [Unit] Description=Samba SMB Daemon -After=network.target -ConditionPathExists=/storage/.cache/services/samba.conf +Wants=network-online.target nmbd.service +After=network-online.target nmbd.service +ConditionPathExists=!/storage/.cache/services/samba.disabled +ConditionPathExists=/run/samba/smb.conf [Service] Type=forking -PIDFile=/var/run/smbd-smb.conf.pid +PIDFile=/run/samba/smbd.pid LimitNOFILE=16384 -ExecStart=/usr/bin/smbd --configfile=/run/samba/smb.conf -ExecStartPre=/usr/lib/samba/samba-config +ExecStart=/usr/sbin/smbd ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=1s Restart=always diff --git a/packages/network/samba/system.d/samba-config.service b/packages/network/samba/system.d/samba-config.service new file mode 100644 index 0000000000..7e77388092 --- /dev/null +++ b/packages/network/samba/system.d/samba-config.service @@ -0,0 +1,9 @@ +[Unit] +Description=Samba Configuration +DefaultDependencies=false +After=basic.target + +[Service] +Type=oneshot +ExecStart=/usr/lib/samba/samba-config +StartLimitInterval=0 diff --git a/packages/network/wireless-regdb/package.mk b/packages/network/wireless-regdb/package.mk index 6234f60b6c..3e606e2dd9 100644 --- a/packages/network/wireless-regdb/package.mk +++ b/packages/network/wireless-regdb/package.mk @@ -1,40 +1,13 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="wireless-regdb" -PKG_VERSION="2016.06.10" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2018.09.07" +PKG_SHA256="a36b8147f1a3e98e1fd44321a4b8d7ad2f03cac98cdf527ccb1693342f08d65a" PKG_LICENSE="GPL" PKG_SITE="http://wireless.kernel.org/en/developers/Regulatory" PKG_URL="https://www.kernel.org/pub/software/network/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="network" -PKG_SHORTDESC="wireless-regdb: regulatory database" PKG_LONGDESC="wireless-regdb is a regulatory database" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to do -} - -makeinstall_target() { - : # nothing to do -} +PKG_TOOLCHAIN="manual" diff --git a/packages/network/wpa_supplicant/package.mk b/packages/network/wpa_supplicant/package.mk index 71ae1b0456..561c82a1a4 100644 --- a/packages/network/wpa_supplicant/package.mk +++ b/packages/network/wpa_supplicant/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="wpa_supplicant" -PKG_VERSION="2.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.6" +PKG_SHA256="b4936d34c4e6cdd44954beba74296d964bc2c9668ecaa5255e499636fe2b1450" PKG_LICENSE="GPL" -PKG_SITE="http://hostap.epitest.fi/wpa_supplicant/" -PKG_URL="http://hostap.epitest.fi/releases/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain dbus libnl libressl" -PKG_SECTION="network" -PKG_SHORTDESC="wpa_supplicant: An IEEE 802.11i supplicant implementation" -PKG_LONGDESC="The wpa_supplicant is a free software implementation of an IEEE 802.11i supplicant. In addition to being a full-featured WPA2 supplicant, it also has support for WPA and older wireless LAN security protocols." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_SITE="https://w1.fi/wpa_supplicant/" +PKG_URL="https://w1.fi/releases/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain dbus libnl openssl" +PKG_LONGDESC="A free software implementation of an IEEE 802.11i supplicant." +PKG_TOOLCHAIN="make" +PKG_BUILD_FLAGS="+lto-parallel" PKG_MAKE_OPTS_TARGET="-C wpa_supplicant V=1 LIBDIR=/usr/lib BINDIR=/usr/bin" PKG_MAKEINSTALL_OPTS_TARGET="-C wpa_supplicant V=1 LIBDIR=/usr/lib BINDIR=/usr/bin" diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-001-krack-hostapd-Avoid-key-reinstallation-in-FT-handshake.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-001-krack-hostapd-Avoid-key-reinstallation-in-FT-handshake.patch new file mode 100644 index 0000000000..727684865d --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-001-krack-hostapd-Avoid-key-reinstallation-in-FT-handshake.patch @@ -0,0 +1,174 @@ +From cf4cab804c7afd5c45505528a8d16e46163243a2 Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Fri, 14 Jul 2017 15:15:35 +0200 +Subject: [PATCH 1/8] hostapd: Avoid key reinstallation in FT handshake + +Do not reinstall TK to the driver during Reassociation Response frame +processing if the first attempt of setting the TK succeeded. This avoids +issues related to clearing the TX/RX PN that could result in reusing +same PN values for transmitted frames (e.g., due to CCM nonce reuse and +also hitting replay protection on the receiver) and accepting replayed +frames on RX side. + +This issue was introduced by the commit +0e84c25434e6a1f283c7b4e62e483729085b78d2 ('FT: Fix PTK configuration in +authenticator') which allowed wpa_ft_install_ptk() to be called multiple +times with the same PTK. While the second configuration attempt is +needed with some drivers, it must be done only if the first attempt +failed. + +Signed-off-by: Mathy Vanhoef +--- + src/ap/ieee802_11.c | 16 +++++++++++++--- + src/ap/wpa_auth.c | 11 +++++++++++ + src/ap/wpa_auth.h | 3 ++- + src/ap/wpa_auth_ft.c | 10 ++++++++++ + src/ap/wpa_auth_i.h | 1 + + 5 files changed, 37 insertions(+), 4 deletions(-) + +diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c +index 4e04169..333035f 100644 +--- a/src/ap/ieee802_11.c ++++ b/src/ap/ieee802_11.c +@@ -1841,6 +1841,7 @@ static int add_associated_sta(struct hostapd_data *hapd, + { + struct ieee80211_ht_capabilities ht_cap; + struct ieee80211_vht_capabilities vht_cap; ++ int set = 1; + + /* + * Remove the STA entry to ensure the STA PS state gets cleared and +@@ -1848,9 +1849,18 @@ static int add_associated_sta(struct hostapd_data *hapd, + * FT-over-the-DS, where a station re-associates back to the same AP but + * skips the authentication flow, or if working with a driver that + * does not support full AP client state. ++ * ++ * Skip this if the STA has already completed FT reassociation and the ++ * TK has been configured since the TX/RX PN must not be reset to 0 for ++ * the same key. + */ +- if (!sta->added_unassoc) ++ if (!sta->added_unassoc && ++ (!(sta->flags & WLAN_STA_AUTHORIZED) || ++ !wpa_auth_sta_ft_tk_already_set(sta->wpa_sm))) { + hostapd_drv_sta_remove(hapd, sta->addr); ++ wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED); ++ set = 0; ++ } + + #ifdef CONFIG_IEEE80211N + if (sta->flags & WLAN_STA_HT) +@@ -1873,11 +1883,11 @@ static int add_associated_sta(struct hostapd_data *hapd, + sta->flags & WLAN_STA_VHT ? &vht_cap : NULL, + sta->flags | WLAN_STA_ASSOC, sta->qosinfo, + sta->vht_opmode, sta->p2p_ie ? 1 : 0, +- sta->added_unassoc)) { ++ set)) { + hostapd_logger(hapd, sta->addr, + HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_NOTICE, + "Could not %s STA to kernel driver", +- sta->added_unassoc ? "set" : "add"); ++ set ? "set" : "add"); + + if (sta->added_unassoc) { + hostapd_drv_sta_remove(hapd, sta->addr); +diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c +index 3587086..707971d 100644 +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -1745,6 +1745,9 @@ int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event) + #else /* CONFIG_IEEE80211R */ + break; + #endif /* CONFIG_IEEE80211R */ ++ case WPA_DRV_STA_REMOVED: ++ sm->tk_already_set = FALSE; ++ return 0; + } + + #ifdef CONFIG_IEEE80211R +@@ -3250,6 +3253,14 @@ int wpa_auth_sta_wpa_version(struct wpa_state_machine *sm) + } + + ++int wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm) ++{ ++ if (!sm || !wpa_key_mgmt_ft(sm->wpa_key_mgmt)) ++ return 0; ++ return sm->tk_already_set; ++} ++ ++ + int wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm, + struct rsn_pmksa_cache_entry *entry) + { +diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h +index 0de8d97..97461b0 100644 +--- a/src/ap/wpa_auth.h ++++ b/src/ap/wpa_auth.h +@@ -267,7 +267,7 @@ void wpa_receive(struct wpa_authenticator *wpa_auth, + u8 *data, size_t data_len); + enum wpa_event { + WPA_AUTH, WPA_ASSOC, WPA_DISASSOC, WPA_DEAUTH, WPA_REAUTH, +- WPA_REAUTH_EAPOL, WPA_ASSOC_FT ++ WPA_REAUTH_EAPOL, WPA_ASSOC_FT, WPA_DRV_STA_REMOVED + }; + void wpa_remove_ptk(struct wpa_state_machine *sm); + int wpa_auth_sm_event(struct wpa_state_machine *sm, enum wpa_event event); +@@ -280,6 +280,7 @@ int wpa_auth_pairwise_set(struct wpa_state_machine *sm); + int wpa_auth_get_pairwise(struct wpa_state_machine *sm); + int wpa_auth_sta_key_mgmt(struct wpa_state_machine *sm); + int wpa_auth_sta_wpa_version(struct wpa_state_machine *sm); ++int wpa_auth_sta_ft_tk_already_set(struct wpa_state_machine *sm); + int wpa_auth_sta_clear_pmksa(struct wpa_state_machine *sm, + struct rsn_pmksa_cache_entry *entry); + struct rsn_pmksa_cache_entry * +diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c +index 42242a5..e63b99a 100644 +--- a/src/ap/wpa_auth_ft.c ++++ b/src/ap/wpa_auth_ft.c +@@ -780,6 +780,14 @@ void wpa_ft_install_ptk(struct wpa_state_machine *sm) + return; + } + ++ if (sm->tk_already_set) { ++ /* Must avoid TK reconfiguration to prevent clearing of TX/RX ++ * PN in the driver */ ++ wpa_printf(MSG_DEBUG, ++ "FT: Do not re-install same PTK to the driver"); ++ return; ++ } ++ + /* FIX: add STA entry to kernel/driver here? The set_key will fail + * most likely without this.. At the moment, STA entry is added only + * after association has been completed. This function will be called +@@ -792,6 +800,7 @@ void wpa_ft_install_ptk(struct wpa_state_machine *sm) + + /* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */ + sm->pairwise_set = TRUE; ++ sm->tk_already_set = TRUE; + } + + +@@ -898,6 +907,7 @@ static int wpa_ft_process_auth_req(struct wpa_state_machine *sm, + + sm->pairwise = pairwise; + sm->PTK_valid = TRUE; ++ sm->tk_already_set = FALSE; + wpa_ft_install_ptk(sm); + + buflen = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) + +diff --git a/src/ap/wpa_auth_i.h b/src/ap/wpa_auth_i.h +index 72b7eb3..7fd8f05 100644 +--- a/src/ap/wpa_auth_i.h ++++ b/src/ap/wpa_auth_i.h +@@ -65,6 +65,7 @@ struct wpa_state_machine { + struct wpa_ptk PTK; + Boolean PTK_valid; + Boolean pairwise_set; ++ Boolean tk_already_set; + int keycount; + Boolean Pair; + struct wpa_key_replay_counter { +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-002-krack-Prevent-reinstallation-of-an-already-in-use-group-ke.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-002-krack-Prevent-reinstallation-of-an-already-in-use-group-ke.patch new file mode 100644 index 0000000000..1802d664ad --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-002-krack-Prevent-reinstallation-of-an-already-in-use-group-ke.patch @@ -0,0 +1,250 @@ +From 927f891007c402fefd1ff384645b3f07597c3ede Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Wed, 12 Jul 2017 16:03:24 +0200 +Subject: [PATCH 2/8] Prevent reinstallation of an already in-use group key + +Track the current GTK and IGTK that is in use and when receiving a +(possibly retransmitted) Group Message 1 or WNM-Sleep Mode Response, do +not install the given key if it is already in use. This prevents an +attacker from trying to trick the client into resetting or lowering the +sequence counter associated to the group key. + +Signed-off-by: Mathy Vanhoef +--- + src/common/wpa_common.h | 11 +++++ + src/rsn_supp/wpa.c | 116 ++++++++++++++++++++++++++++++------------------ + src/rsn_supp/wpa_i.h | 4 ++ + 3 files changed, 87 insertions(+), 44 deletions(-) + +diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h +index af1d0f0..d200285 100644 +--- a/src/common/wpa_common.h ++++ b/src/common/wpa_common.h +@@ -217,6 +217,17 @@ struct wpa_ptk { + size_t tk_len; + }; + ++struct wpa_gtk { ++ u8 gtk[WPA_GTK_MAX_LEN]; ++ size_t gtk_len; ++}; ++ ++#ifdef CONFIG_IEEE80211W ++struct wpa_igtk { ++ u8 igtk[WPA_IGTK_MAX_LEN]; ++ size_t igtk_len; ++}; ++#endif /* CONFIG_IEEE80211W */ + + /* WPA IE version 1 + * 00-50-f2:1 (OUI:OUI type) +diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c +index 3c47879..95bd7be 100644 +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -714,6 +714,15 @@ static int wpa_supplicant_install_gtk(struct wpa_sm *sm, + const u8 *_gtk = gd->gtk; + u8 gtk_buf[32]; + ++ /* Detect possible key reinstallation */ ++ if (sm->gtk.gtk_len == (size_t) gd->gtk_len && ++ os_memcmp(sm->gtk.gtk, gd->gtk, sm->gtk.gtk_len) == 0) { ++ wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, ++ "WPA: Not reinstalling already in-use GTK to the driver (keyidx=%d tx=%d len=%d)", ++ gd->keyidx, gd->tx, gd->gtk_len); ++ return 0; ++ } ++ + wpa_hexdump_key(MSG_DEBUG, "WPA: Group Key", gd->gtk, gd->gtk_len); + wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, + "WPA: Installing GTK to the driver (keyidx=%d tx=%d len=%d)", +@@ -748,6 +757,9 @@ static int wpa_supplicant_install_gtk(struct wpa_sm *sm, + } + os_memset(gtk_buf, 0, sizeof(gtk_buf)); + ++ sm->gtk.gtk_len = gd->gtk_len; ++ os_memcpy(sm->gtk.gtk, gd->gtk, sm->gtk.gtk_len); ++ + return 0; + } + +@@ -854,6 +866,48 @@ static int wpa_supplicant_pairwise_gtk(struct wpa_sm *sm, + } + + ++#ifdef CONFIG_IEEE80211W ++static int wpa_supplicant_install_igtk(struct wpa_sm *sm, ++ const struct wpa_igtk_kde *igtk) ++{ ++ size_t len = wpa_cipher_key_len(sm->mgmt_group_cipher); ++ u16 keyidx = WPA_GET_LE16(igtk->keyid); ++ ++ /* Detect possible key reinstallation */ ++ if (sm->igtk.igtk_len == len && ++ os_memcmp(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len) == 0) { ++ wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, ++ "WPA: Not reinstalling already in-use IGTK to the driver (keyidx=%d)", ++ keyidx); ++ return 0; ++ } ++ ++ wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, ++ "WPA: IGTK keyid %d pn %02x%02x%02x%02x%02x%02x", ++ keyidx, MAC2STR(igtk->pn)); ++ wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK", igtk->igtk, len); ++ if (keyidx > 4095) { ++ wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, ++ "WPA: Invalid IGTK KeyID %d", keyidx); ++ return -1; ++ } ++ if (wpa_sm_set_key(sm, wpa_cipher_to_alg(sm->mgmt_group_cipher), ++ broadcast_ether_addr, ++ keyidx, 0, igtk->pn, sizeof(igtk->pn), ++ igtk->igtk, len) < 0) { ++ wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, ++ "WPA: Failed to configure IGTK to the driver"); ++ return -1; ++ } ++ ++ sm->igtk.igtk_len = len; ++ os_memcpy(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len); ++ ++ return 0; ++} ++#endif /* CONFIG_IEEE80211W */ ++ ++ + static int ieee80211w_set_keys(struct wpa_sm *sm, + struct wpa_eapol_ie_parse *ie) + { +@@ -864,30 +918,14 @@ static int ieee80211w_set_keys(struct wpa_sm *sm, + if (ie->igtk) { + size_t len; + const struct wpa_igtk_kde *igtk; +- u16 keyidx; ++ + len = wpa_cipher_key_len(sm->mgmt_group_cipher); + if (ie->igtk_len != WPA_IGTK_KDE_PREFIX_LEN + len) + return -1; ++ + igtk = (const struct wpa_igtk_kde *) ie->igtk; +- keyidx = WPA_GET_LE16(igtk->keyid); +- wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, "WPA: IGTK keyid %d " +- "pn %02x%02x%02x%02x%02x%02x", +- keyidx, MAC2STR(igtk->pn)); +- wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK", +- igtk->igtk, len); +- if (keyidx > 4095) { +- wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, +- "WPA: Invalid IGTK KeyID %d", keyidx); +- return -1; +- } +- if (wpa_sm_set_key(sm, wpa_cipher_to_alg(sm->mgmt_group_cipher), +- broadcast_ether_addr, +- keyidx, 0, igtk->pn, sizeof(igtk->pn), +- igtk->igtk, len) < 0) { +- wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, +- "WPA: Failed to configure IGTK to the driver"); ++ if (wpa_supplicant_install_igtk(sm, igtk) < 0) + return -1; +- } + } + + return 0; +@@ -2307,7 +2345,7 @@ void wpa_sm_deinit(struct wpa_sm *sm) + */ + void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid) + { +- int clear_ptk = 1; ++ int clear_keys = 1; + + if (sm == NULL) + return; +@@ -2333,11 +2371,11 @@ void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid) + /* Prepare for the next transition */ + wpa_ft_prepare_auth_request(sm, NULL); + +- clear_ptk = 0; ++ clear_keys = 0; + } + #endif /* CONFIG_IEEE80211R */ + +- if (clear_ptk) { ++ if (clear_keys) { + /* + * IEEE 802.11, 8.4.10: Delete PTK SA on (re)association if + * this is not part of a Fast BSS Transition. +@@ -2347,6 +2385,10 @@ void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid) + os_memset(&sm->ptk, 0, sizeof(sm->ptk)); + sm->tptk_set = 0; + os_memset(&sm->tptk, 0, sizeof(sm->tptk)); ++ os_memset(&sm->gtk, 0, sizeof(sm->gtk)); ++#ifdef CONFIG_IEEE80211W ++ os_memset(&sm->igtk, 0, sizeof(sm->igtk)); ++#endif /* CONFIG_IEEE80211W */ + } + + #ifdef CONFIG_TDLS +@@ -2877,6 +2919,10 @@ void wpa_sm_drop_sa(struct wpa_sm *sm) + os_memset(sm->pmk, 0, sizeof(sm->pmk)); + os_memset(&sm->ptk, 0, sizeof(sm->ptk)); + os_memset(&sm->tptk, 0, sizeof(sm->tptk)); ++ os_memset(&sm->gtk, 0, sizeof(sm->gtk)); ++#ifdef CONFIG_IEEE80211W ++ os_memset(&sm->igtk, 0, sizeof(sm->igtk)); ++#endif /* CONFIG_IEEE80211W */ + #ifdef CONFIG_IEEE80211R + os_memset(sm->xxkey, 0, sizeof(sm->xxkey)); + os_memset(sm->pmk_r0, 0, sizeof(sm->pmk_r0)); +@@ -2949,29 +2995,11 @@ int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf) + os_memset(&gd, 0, sizeof(gd)); + #ifdef CONFIG_IEEE80211W + } else if (subelem_id == WNM_SLEEP_SUBELEM_IGTK) { +- struct wpa_igtk_kde igd; +- u16 keyidx; +- +- os_memset(&igd, 0, sizeof(igd)); +- keylen = wpa_cipher_key_len(sm->mgmt_group_cipher); +- os_memcpy(igd.keyid, buf + 2, 2); +- os_memcpy(igd.pn, buf + 4, 6); +- +- keyidx = WPA_GET_LE16(igd.keyid); +- os_memcpy(igd.igtk, buf + 10, keylen); +- +- wpa_hexdump_key(MSG_DEBUG, "Install IGTK (WNM SLEEP)", +- igd.igtk, keylen); +- if (wpa_sm_set_key(sm, wpa_cipher_to_alg(sm->mgmt_group_cipher), +- broadcast_ether_addr, +- keyidx, 0, igd.pn, sizeof(igd.pn), +- igd.igtk, keylen) < 0) { +- wpa_printf(MSG_DEBUG, "Failed to install the IGTK in " +- "WNM mode"); +- os_memset(&igd, 0, sizeof(igd)); ++ const struct wpa_igtk_kde *igtk; ++ ++ igtk = (const struct wpa_igtk_kde *) (buf + 2); ++ if (wpa_supplicant_install_igtk(sm, igtk) < 0) + return -1; +- } +- os_memset(&igd, 0, sizeof(igd)); + #endif /* CONFIG_IEEE80211W */ + } else { + wpa_printf(MSG_DEBUG, "Unknown element id"); +diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h +index f653ba6..afc9e37 100644 +--- a/src/rsn_supp/wpa_i.h ++++ b/src/rsn_supp/wpa_i.h +@@ -31,6 +31,10 @@ struct wpa_sm { + u8 rx_replay_counter[WPA_REPLAY_COUNTER_LEN]; + int rx_replay_counter_set; + u8 request_counter[WPA_REPLAY_COUNTER_LEN]; ++ struct wpa_gtk gtk; ++#ifdef CONFIG_IEEE80211W ++ struct wpa_igtk igtk; ++#endif /* CONFIG_IEEE80211W */ + + struct eapol_sm *eapol; /* EAPOL state machine from upper level code */ + +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-003-krack-Extend-protection-of-GTK-IGTK-reinstallation-of-WNM-.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-003-krack-Extend-protection-of-GTK-IGTK-reinstallation-of-WNM-.patch new file mode 100644 index 0000000000..e2937b851a --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-003-krack-Extend-protection-of-GTK-IGTK-reinstallation-of-WNM-.patch @@ -0,0 +1,184 @@ +From 8280294e74846ea342389a0cd17215050fa5afe8 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Oct 2017 12:12:24 +0300 +Subject: [PATCH 3/8] Extend protection of GTK/IGTK reinstallation of WNM-Sleep + Mode cases + +This extends the protection to track last configured GTK/IGTK value +separately from EAPOL-Key frames and WNM-Sleep Mode frames to cover a +corner case where these two different mechanisms may get used when the +GTK/IGTK has changed and tracking a single value is not sufficient to +detect a possible key reconfiguration. + +Signed-off-by: Jouni Malinen +--- + src/rsn_supp/wpa.c | 53 +++++++++++++++++++++++++++++++++++++--------------- + src/rsn_supp/wpa_i.h | 2 ++ + 2 files changed, 40 insertions(+), 15 deletions(-) + +diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c +index 95bd7be..7a2c68d 100644 +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -709,14 +709,17 @@ struct wpa_gtk_data { + + static int wpa_supplicant_install_gtk(struct wpa_sm *sm, + const struct wpa_gtk_data *gd, +- const u8 *key_rsc) ++ const u8 *key_rsc, int wnm_sleep) + { + const u8 *_gtk = gd->gtk; + u8 gtk_buf[32]; + + /* Detect possible key reinstallation */ +- if (sm->gtk.gtk_len == (size_t) gd->gtk_len && +- os_memcmp(sm->gtk.gtk, gd->gtk, sm->gtk.gtk_len) == 0) { ++ if ((sm->gtk.gtk_len == (size_t) gd->gtk_len && ++ os_memcmp(sm->gtk.gtk, gd->gtk, sm->gtk.gtk_len) == 0) || ++ (sm->gtk_wnm_sleep.gtk_len == (size_t) gd->gtk_len && ++ os_memcmp(sm->gtk_wnm_sleep.gtk, gd->gtk, ++ sm->gtk_wnm_sleep.gtk_len) == 0)) { + wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, + "WPA: Not reinstalling already in-use GTK to the driver (keyidx=%d tx=%d len=%d)", + gd->keyidx, gd->tx, gd->gtk_len); +@@ -757,8 +760,14 @@ static int wpa_supplicant_install_gtk(struct wpa_sm *sm, + } + os_memset(gtk_buf, 0, sizeof(gtk_buf)); + +- sm->gtk.gtk_len = gd->gtk_len; +- os_memcpy(sm->gtk.gtk, gd->gtk, sm->gtk.gtk_len); ++ if (wnm_sleep) { ++ sm->gtk_wnm_sleep.gtk_len = gd->gtk_len; ++ os_memcpy(sm->gtk_wnm_sleep.gtk, gd->gtk, ++ sm->gtk_wnm_sleep.gtk_len); ++ } else { ++ sm->gtk.gtk_len = gd->gtk_len; ++ os_memcpy(sm->gtk.gtk, gd->gtk, sm->gtk.gtk_len); ++ } + + return 0; + } +@@ -852,7 +861,7 @@ static int wpa_supplicant_pairwise_gtk(struct wpa_sm *sm, + (wpa_supplicant_check_group_cipher(sm, sm->group_cipher, + gtk_len, gtk_len, + &gd.key_rsc_len, &gd.alg) || +- wpa_supplicant_install_gtk(sm, &gd, key_rsc))) { ++ wpa_supplicant_install_gtk(sm, &gd, key_rsc, 0))) { + wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, + "RSN: Failed to install GTK"); + os_memset(&gd, 0, sizeof(gd)); +@@ -868,14 +877,18 @@ static int wpa_supplicant_pairwise_gtk(struct wpa_sm *sm, + + #ifdef CONFIG_IEEE80211W + static int wpa_supplicant_install_igtk(struct wpa_sm *sm, +- const struct wpa_igtk_kde *igtk) ++ const struct wpa_igtk_kde *igtk, ++ int wnm_sleep) + { + size_t len = wpa_cipher_key_len(sm->mgmt_group_cipher); + u16 keyidx = WPA_GET_LE16(igtk->keyid); + + /* Detect possible key reinstallation */ +- if (sm->igtk.igtk_len == len && +- os_memcmp(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len) == 0) { ++ if ((sm->igtk.igtk_len == len && ++ os_memcmp(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len) == 0) || ++ (sm->igtk_wnm_sleep.igtk_len == len && ++ os_memcmp(sm->igtk_wnm_sleep.igtk, igtk->igtk, ++ sm->igtk_wnm_sleep.igtk_len) == 0)) { + wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, + "WPA: Not reinstalling already in-use IGTK to the driver (keyidx=%d)", + keyidx); +@@ -900,8 +913,14 @@ static int wpa_supplicant_install_igtk(struct wpa_sm *sm, + return -1; + } + +- sm->igtk.igtk_len = len; +- os_memcpy(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len); ++ if (wnm_sleep) { ++ sm->igtk_wnm_sleep.igtk_len = len; ++ os_memcpy(sm->igtk_wnm_sleep.igtk, igtk->igtk, ++ sm->igtk_wnm_sleep.igtk_len); ++ } else { ++ sm->igtk.igtk_len = len; ++ os_memcpy(sm->igtk.igtk, igtk->igtk, sm->igtk.igtk_len); ++ } + + return 0; + } +@@ -924,7 +943,7 @@ static int ieee80211w_set_keys(struct wpa_sm *sm, + return -1; + + igtk = (const struct wpa_igtk_kde *) ie->igtk; +- if (wpa_supplicant_install_igtk(sm, igtk) < 0) ++ if (wpa_supplicant_install_igtk(sm, igtk, 0) < 0) + return -1; + } + +@@ -1574,7 +1593,7 @@ static void wpa_supplicant_process_1_of_2(struct wpa_sm *sm, + if (wpa_supplicant_rsc_relaxation(sm, key->key_rsc)) + key_rsc = null_rsc; + +- if (wpa_supplicant_install_gtk(sm, &gd, key_rsc) || ++ if (wpa_supplicant_install_gtk(sm, &gd, key_rsc, 0) || + wpa_supplicant_send_2_of_2(sm, key, ver, key_info) < 0) + goto failed; + os_memset(&gd, 0, sizeof(gd)); +@@ -2386,8 +2405,10 @@ void wpa_sm_notify_assoc(struct wpa_sm *sm, const u8 *bssid) + sm->tptk_set = 0; + os_memset(&sm->tptk, 0, sizeof(sm->tptk)); + os_memset(&sm->gtk, 0, sizeof(sm->gtk)); ++ os_memset(&sm->gtk_wnm_sleep, 0, sizeof(sm->gtk_wnm_sleep)); + #ifdef CONFIG_IEEE80211W + os_memset(&sm->igtk, 0, sizeof(sm->igtk)); ++ os_memset(&sm->igtk_wnm_sleep, 0, sizeof(sm->igtk_wnm_sleep)); + #endif /* CONFIG_IEEE80211W */ + } + +@@ -2920,8 +2941,10 @@ void wpa_sm_drop_sa(struct wpa_sm *sm) + os_memset(&sm->ptk, 0, sizeof(sm->ptk)); + os_memset(&sm->tptk, 0, sizeof(sm->tptk)); + os_memset(&sm->gtk, 0, sizeof(sm->gtk)); ++ os_memset(&sm->gtk_wnm_sleep, 0, sizeof(sm->gtk_wnm_sleep)); + #ifdef CONFIG_IEEE80211W + os_memset(&sm->igtk, 0, sizeof(sm->igtk)); ++ os_memset(&sm->igtk_wnm_sleep, 0, sizeof(sm->igtk_wnm_sleep)); + #endif /* CONFIG_IEEE80211W */ + #ifdef CONFIG_IEEE80211R + os_memset(sm->xxkey, 0, sizeof(sm->xxkey)); +@@ -2986,7 +3009,7 @@ int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf) + + wpa_hexdump_key(MSG_DEBUG, "Install GTK (WNM SLEEP)", + gd.gtk, gd.gtk_len); +- if (wpa_supplicant_install_gtk(sm, &gd, key_rsc)) { ++ if (wpa_supplicant_install_gtk(sm, &gd, key_rsc, 1)) { + os_memset(&gd, 0, sizeof(gd)); + wpa_printf(MSG_DEBUG, "Failed to install the GTK in " + "WNM mode"); +@@ -2998,7 +3021,7 @@ int wpa_wnmsleep_install_key(struct wpa_sm *sm, u8 subelem_id, u8 *buf) + const struct wpa_igtk_kde *igtk; + + igtk = (const struct wpa_igtk_kde *) (buf + 2); +- if (wpa_supplicant_install_igtk(sm, igtk) < 0) ++ if (wpa_supplicant_install_igtk(sm, igtk, 1) < 0) + return -1; + #endif /* CONFIG_IEEE80211W */ + } else { +diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h +index afc9e37..9a54631 100644 +--- a/src/rsn_supp/wpa_i.h ++++ b/src/rsn_supp/wpa_i.h +@@ -32,8 +32,10 @@ struct wpa_sm { + int rx_replay_counter_set; + u8 request_counter[WPA_REPLAY_COUNTER_LEN]; + struct wpa_gtk gtk; ++ struct wpa_gtk gtk_wnm_sleep; + #ifdef CONFIG_IEEE80211W + struct wpa_igtk igtk; ++ struct wpa_igtk igtk_wnm_sleep; + #endif /* CONFIG_IEEE80211W */ + + struct eapol_sm *eapol; /* EAPOL state machine from upper level code */ +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-004-krack-Prevent-installation-of-an-all-zero-TK.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-004-krack-Prevent-installation-of-an-all-zero-TK.patch new file mode 100644 index 0000000000..22ee217947 --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-004-krack-Prevent-installation-of-an-all-zero-TK.patch @@ -0,0 +1,79 @@ +From 8f82bc94e8697a9d47fa8774dfdaaede1084912c Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Fri, 29 Sep 2017 04:22:51 +0200 +Subject: [PATCH 4/8] Prevent installation of an all-zero TK + +Properly track whether a PTK has already been installed to the driver +and the TK part cleared from memory. This prevents an attacker from +trying to trick the client into installing an all-zero TK. + +This fixes the earlier fix in commit +ad00d64e7d8827b3cebd665a0ceb08adabf15e1e ('Fix TK configuration to the +driver in EAPOL-Key 3/4 retry case') which did not take into account +possibility of an extra message 1/4 showing up between retries of +message 3/4. + +Signed-off-by: Mathy Vanhoef +--- + src/common/wpa_common.h | 1 + + src/rsn_supp/wpa.c | 5 ++--- + src/rsn_supp/wpa_i.h | 1 - + 3 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h +index d200285..1021ccb 100644 +--- a/src/common/wpa_common.h ++++ b/src/common/wpa_common.h +@@ -215,6 +215,7 @@ struct wpa_ptk { + size_t kck_len; + size_t kek_len; + size_t tk_len; ++ int installed; /* 1 if key has already been installed to driver */ + }; + + struct wpa_gtk { +diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c +index 7a2c68d..0550a41 100644 +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -510,7 +510,6 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm, + os_memset(buf, 0, sizeof(buf)); + } + sm->tptk_set = 1; +- sm->tk_to_set = 1; + + kde = sm->assoc_wpa_ie; + kde_len = sm->assoc_wpa_ie_len; +@@ -615,7 +614,7 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm, + enum wpa_alg alg; + const u8 *key_rsc; + +- if (!sm->tk_to_set) { ++ if (sm->ptk.installed) { + wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG, + "WPA: Do not re-install same PTK to the driver"); + return 0; +@@ -659,7 +658,7 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm, + + /* TK is not needed anymore in supplicant */ + os_memset(sm->ptk.tk, 0, WPA_TK_MAX_LEN); +- sm->tk_to_set = 0; ++ sm->ptk.installed = 1; + + if (sm->wpa_ptk_rekey) { + eloop_cancel_timeout(wpa_sm_rekey_ptk, sm, NULL); +diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h +index 9a54631..41f371f 100644 +--- a/src/rsn_supp/wpa_i.h ++++ b/src/rsn_supp/wpa_i.h +@@ -24,7 +24,6 @@ struct wpa_sm { + struct wpa_ptk ptk, tptk; + int ptk_set, tptk_set; + unsigned int msg_3_of_4_ok:1; +- unsigned int tk_to_set:1; + u8 snonce[WPA_NONCE_LEN]; + u8 anonce[WPA_NONCE_LEN]; /* ANonce from the last 1/4 msg */ + int renew_snonce; +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-005-krack-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-005-krack-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch new file mode 100644 index 0000000000..c19c4c7102 --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-005-krack-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch @@ -0,0 +1,64 @@ +From 12fac09b437a1dc8a0f253e265934a8aaf4d2f8b Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Oct 2017 12:32:57 +0300 +Subject: [PATCH 5/8] Fix PTK rekeying to generate a new ANonce + +The Authenticator state machine path for PTK rekeying ended up bypassing +the AUTHENTICATION2 state where a new ANonce is generated when going +directly to the PTKSTART state since there is no need to try to +determine the PMK again in such a case. This is far from ideal since the +new PTK would depend on a new nonce only from the supplicant. + +Fix this by generating a new ANonce when moving to the PTKSTART state +for the purpose of starting new 4-way handshake to rekey PTK. + +Signed-off-by: Jouni Malinen +--- + src/ap/wpa_auth.c | 24 +++++++++++++++++++++--- + 1 file changed, 21 insertions(+), 3 deletions(-) + +diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c +index 707971d..bf10cc1 100644 +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -1901,6 +1901,21 @@ SM_STATE(WPA_PTK, AUTHENTICATION2) + } + + ++static int wpa_auth_sm_ptk_update(struct wpa_state_machine *sm) ++{ ++ if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) { ++ wpa_printf(MSG_ERROR, ++ "WPA: Failed to get random data for ANonce"); ++ sm->Disconnect = TRUE; ++ return -1; ++ } ++ wpa_hexdump(MSG_DEBUG, "WPA: Assign new ANonce", sm->ANonce, ++ WPA_NONCE_LEN); ++ sm->TimeoutCtr = 0; ++ return 0; ++} ++ ++ + SM_STATE(WPA_PTK, INITPMK) + { + u8 msk[2 * PMK_LEN]; +@@ -2458,9 +2473,12 @@ SM_STEP(WPA_PTK) + SM_ENTER(WPA_PTK, AUTHENTICATION); + else if (sm->ReAuthenticationRequest) + SM_ENTER(WPA_PTK, AUTHENTICATION2); +- else if (sm->PTKRequest) +- SM_ENTER(WPA_PTK, PTKSTART); +- else switch (sm->wpa_ptk_state) { ++ else if (sm->PTKRequest) { ++ if (wpa_auth_sm_ptk_update(sm) < 0) ++ SM_ENTER(WPA_PTK, DISCONNECTED); ++ else ++ SM_ENTER(WPA_PTK, PTKSTART); ++ } else switch (sm->wpa_ptk_state) { + case WPA_PTK_INITIALIZE: + break; + case WPA_PTK_DISCONNECT: +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-006-krack-TDLS-Reject-TPK-TK-reconfiguration.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-006-krack-TDLS-Reject-TPK-TK-reconfiguration.patch new file mode 100644 index 0000000000..e1bd5a5726 --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-006-krack-TDLS-Reject-TPK-TK-reconfiguration.patch @@ -0,0 +1,132 @@ +From 6c4bed4f47d1960ec04981a9d50e5076aea5223d Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 22 Sep 2017 11:03:15 +0300 +Subject: [PATCH 6/8] TDLS: Reject TPK-TK reconfiguration + +Do not try to reconfigure the same TPK-TK to the driver after it has +been successfully configured. This is an explicit check to avoid issues +related to resetting the TX/RX packet number. There was already a check +for this for TPK M2 (retries of that message are ignored completely), so +that behavior does not get modified. + +For TPK M3, the TPK-TK could have been reconfigured, but that was +followed by immediate teardown of the link due to an issue in updating +the STA entry. Furthermore, for TDLS with any real security (i.e., +ignoring open/WEP), the TPK message exchange is protected on the AP path +and simple replay attacks are not feasible. + +As an additional corner case, make sure the local nonce gets updated if +the peer uses a very unlikely "random nonce" of all zeros. + +Signed-off-by: Jouni Malinen +--- + src/rsn_supp/tdls.c | 38 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 36 insertions(+), 2 deletions(-) + +diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c +index e424168..9eb9738 100644 +--- a/src/rsn_supp/tdls.c ++++ b/src/rsn_supp/tdls.c +@@ -112,6 +112,7 @@ struct wpa_tdls_peer { + u8 tk[16]; /* TPK-TK; assuming only CCMP will be used */ + } tpk; + int tpk_set; ++ int tk_set; /* TPK-TK configured to the driver */ + int tpk_success; + int tpk_in_progress; + +@@ -192,6 +193,20 @@ static int wpa_tdls_set_key(struct wpa_sm *sm, struct wpa_tdls_peer *peer) + u8 rsc[6]; + enum wpa_alg alg; + ++ if (peer->tk_set) { ++ /* ++ * This same TPK-TK has already been configured to the driver ++ * and this new configuration attempt (likely due to an ++ * unexpected retransmitted frame) would result in clearing ++ * the TX/RX sequence number which can break security, so must ++ * not allow that to happen. ++ */ ++ wpa_printf(MSG_INFO, "TDLS: TPK-TK for the peer " MACSTR ++ " has already been configured to the driver - do not reconfigure", ++ MAC2STR(peer->addr)); ++ return -1; ++ } ++ + os_memset(rsc, 0, 6); + + switch (peer->cipher) { +@@ -209,12 +224,15 @@ static int wpa_tdls_set_key(struct wpa_sm *sm, struct wpa_tdls_peer *peer) + return -1; + } + ++ wpa_printf(MSG_DEBUG, "TDLS: Configure pairwise key for peer " MACSTR, ++ MAC2STR(peer->addr)); + if (wpa_sm_set_key(sm, alg, peer->addr, -1, 1, + rsc, sizeof(rsc), peer->tpk.tk, key_len) < 0) { + wpa_printf(MSG_WARNING, "TDLS: Failed to set TPK to the " + "driver"); + return -1; + } ++ peer->tk_set = 1; + return 0; + } + +@@ -696,7 +714,7 @@ static void wpa_tdls_peer_clear(struct wpa_sm *sm, struct wpa_tdls_peer *peer) + peer->cipher = 0; + peer->qos_info = 0; + peer->wmm_capable = 0; +- peer->tpk_set = peer->tpk_success = 0; ++ peer->tk_set = peer->tpk_set = peer->tpk_success = 0; + peer->chan_switch_enabled = 0; + os_memset(&peer->tpk, 0, sizeof(peer->tpk)); + os_memset(peer->inonce, 0, WPA_NONCE_LEN); +@@ -1159,6 +1177,7 @@ skip_rsnie: + wpa_tdls_peer_free(sm, peer); + return -1; + } ++ peer->tk_set = 0; /* A new nonce results in a new TK */ + wpa_hexdump(MSG_DEBUG, "TDLS: Initiator Nonce for TPK handshake", + peer->inonce, WPA_NONCE_LEN); + os_memcpy(ftie->Snonce, peer->inonce, WPA_NONCE_LEN); +@@ -1751,6 +1770,19 @@ static int wpa_tdls_addset_peer(struct wpa_sm *sm, struct wpa_tdls_peer *peer, + } + + ++static int tdls_nonce_set(const u8 *nonce) ++{ ++ int i; ++ ++ for (i = 0; i < WPA_NONCE_LEN; i++) { ++ if (nonce[i]) ++ return 1; ++ } ++ ++ return 0; ++} ++ ++ + static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr, + const u8 *buf, size_t len) + { +@@ -2004,7 +2036,8 @@ skip_rsn: + peer->rsnie_i_len = kde.rsn_ie_len; + peer->cipher = cipher; + +- if (os_memcmp(peer->inonce, ftie->Snonce, WPA_NONCE_LEN) != 0) { ++ if (os_memcmp(peer->inonce, ftie->Snonce, WPA_NONCE_LEN) != 0 || ++ !tdls_nonce_set(peer->inonce)) { + /* + * There is no point in updating the RNonce for every obtained + * TPK M1 frame (e.g., retransmission due to timeout) with the +@@ -2020,6 +2053,7 @@ skip_rsn: + "TDLS: Failed to get random data for responder nonce"); + goto error; + } ++ peer->tk_set = 0; /* A new nonce results in a new TK */ + } + + #if 0 +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-007-krack-WNM-Ignore-WNM-Sleep-Mode-Response-without-pending-r.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-007-krack-WNM-Ignore-WNM-Sleep-Mode-Response-without-pending-r.patch new file mode 100644 index 0000000000..85ea1d62bc --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-007-krack-WNM-Ignore-WNM-Sleep-Mode-Response-without-pending-r.patch @@ -0,0 +1,43 @@ +From 53c5eb58e95004f86e65ee9fbfccbc291b139057 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 22 Sep 2017 11:25:02 +0300 +Subject: [PATCH 7/8] WNM: Ignore WNM-Sleep Mode Response without pending + request + +Commit 03ed0a52393710be6bdae657d1b36efa146520e5 ('WNM: Ignore WNM-Sleep +Mode Response if WNM-Sleep Mode has not been used') started ignoring the +response when no WNM-Sleep Mode Request had been used during the +association. This can be made tighter by clearing the used flag when +successfully processing a response. This adds an additional layer of +protection against unexpected retransmissions of the response frame. + +Signed-off-by: Jouni Malinen +--- + wpa_supplicant/wnm_sta.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c +index 1b3409c..67a07ff 100644 +--- a/wpa_supplicant/wnm_sta.c ++++ b/wpa_supplicant/wnm_sta.c +@@ -260,7 +260,7 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s, + + if (!wpa_s->wnmsleep_used) { + wpa_printf(MSG_DEBUG, +- "WNM: Ignore WNM-Sleep Mode Response frame since WNM-Sleep Mode has not been used in this association"); ++ "WNM: Ignore WNM-Sleep Mode Response frame since WNM-Sleep Mode operation has not been requested"); + return; + } + +@@ -299,6 +299,8 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s, + return; + } + ++ wpa_s->wnmsleep_used = 0; ++ + if (wnmsleep_ie->status == WNM_STATUS_SLEEP_ACCEPT || + wnmsleep_ie->status == WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE) { + wpa_printf(MSG_DEBUG, "Successfully recv WNM-Sleep Response " +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-008-krack-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-008-krack-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch new file mode 100644 index 0000000000..b9678f6815 --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-008-krack-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch @@ -0,0 +1,82 @@ +From b372ab0b7daea719749194dc554b26e6367603f2 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 22 Sep 2017 12:06:37 +0300 +Subject: [PATCH 8/8] FT: Do not allow multiple Reassociation Response frames + +The driver is expected to not report a second association event without +the station having explicitly request a new association. As such, this +case should not be reachable. However, since reconfiguring the same +pairwise or group keys to the driver could result in nonce reuse issues, +be extra careful here and do an additional state check to avoid this +even if the local driver ends up somehow accepting an unexpected +Reassociation Response frame. + +Signed-off-by: Jouni Malinen +--- + src/rsn_supp/wpa.c | 3 +++ + src/rsn_supp/wpa_ft.c | 8 ++++++++ + src/rsn_supp/wpa_i.h | 1 + + 3 files changed, 12 insertions(+) + +diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c +index 0550a41..2a53c6f 100644 +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -2440,6 +2440,9 @@ void wpa_sm_notify_disassoc(struct wpa_sm *sm) + #ifdef CONFIG_TDLS + wpa_tdls_disassoc(sm); + #endif /* CONFIG_TDLS */ ++#ifdef CONFIG_IEEE80211R ++ sm->ft_reassoc_completed = 0; ++#endif /* CONFIG_IEEE80211R */ + + /* Keys are not needed in the WPA state machine anymore */ + wpa_sm_drop_sa(sm); +diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c +index 205793e..d45bb45 100644 +--- a/src/rsn_supp/wpa_ft.c ++++ b/src/rsn_supp/wpa_ft.c +@@ -153,6 +153,7 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len, + u16 capab; + + sm->ft_completed = 0; ++ sm->ft_reassoc_completed = 0; + + buf_len = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) + + 2 + sm->r0kh_id_len + ric_ies_len + 100; +@@ -681,6 +682,11 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, + return -1; + } + ++ if (sm->ft_reassoc_completed) { ++ wpa_printf(MSG_DEBUG, "FT: Reassociation has already been completed for this FT protocol instance - ignore unexpected retransmission"); ++ return 0; ++ } ++ + if (wpa_ft_parse_ies(ies, ies_len, &parse) < 0) { + wpa_printf(MSG_DEBUG, "FT: Failed to parse IEs"); + return -1; +@@ -781,6 +787,8 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, + return -1; + } + ++ sm->ft_reassoc_completed = 1; ++ + if (wpa_ft_process_gtk_subelem(sm, parse.gtk, parse.gtk_len) < 0) + return -1; + +diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h +index 41f371f..56f88dc 100644 +--- a/src/rsn_supp/wpa_i.h ++++ b/src/rsn_supp/wpa_i.h +@@ -128,6 +128,7 @@ struct wpa_sm { + size_t r0kh_id_len; + u8 r1kh_id[FT_R1KH_ID_LEN]; + int ft_completed; ++ int ft_reassoc_completed; + int over_the_ds_in_progress; + u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */ + int set_ptk_after_assoc; +-- +2.7.4 + diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-100-EAPOL-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-100-EAPOL-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch new file mode 100644 index 0000000000..a62b52c6b9 --- /dev/null +++ b/packages/network/wpa_supplicant/patches/wpa_supplicant-100-EAPOL-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch @@ -0,0 +1,44 @@ +From 3e34cfdff6b192fe337c6fb3f487f73e96582961 Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Sun, 15 Jul 2018 01:25:53 +0200 +Subject: [PATCH] WPA: Ignore unauthenticated encrypted EAPOL-Key data + +Ignore unauthenticated encrypted EAPOL-Key data in supplicant +processing. When using WPA2, these are frames that have the Encrypted +flag set, but not the MIC flag. + +When using WPA2, EAPOL-Key frames that had the Encrypted flag set but +not the MIC flag, had their data field decrypted without first verifying +the MIC. In case the data field was encrypted using RC4 (i.e., when +negotiating TKIP as the pairwise cipher), this meant that +unauthenticated but decrypted data would then be processed. An adversary +could abuse this as a decryption oracle to recover sensitive information +in the data field of EAPOL-Key messages (e.g., the group key). +(CVE-2018-14526) + +Signed-off-by: Mathy Vanhoef +--- + src/rsn_supp/wpa.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff -upr wpa_supplicant-2.6.orig/src/rsn_supp/wpa.c wpa_supplicant-2.6/src/rsn_supp/wpa.c +--- wpa_supplicant-2.6.orig/src/rsn_supp/wpa.c 2016-10-02 21:51:11.000000000 +0300 ++++ wpa_supplicant-2.6/src/rsn_supp/wpa.c 2018-08-08 16:55:11.506831029 +0300 +@@ -2016,6 +2016,17 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, c + + if ((sm->proto == WPA_PROTO_RSN || sm->proto == WPA_PROTO_OSEN) && + (key_info & WPA_KEY_INFO_ENCR_KEY_DATA)) { ++ /* ++ * Only decrypt the Key Data field if the frame's authenticity ++ * was verified. When using AES-SIV (FILS), the MIC flag is not ++ * set, so this check should only be performed if mic_len != 0 ++ * which is the case in this code branch. ++ */ ++ if (!(key_info & WPA_KEY_INFO_MIC)) { ++ wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, ++ "WPA: Ignore EAPOL-Key with encrypted but unauthenticated data"); ++ goto out; ++ } + if (wpa_supplicant_decrypt_key_data(sm, key, ver, key_data, + &key_data_len)) + goto out; diff --git a/packages/network/wpa_supplicant/patches/wpa_supplicant-libressl.patch b/packages/network/wpa_supplicant/patches/wpa_supplicant-libressl.patch deleted file mode 100644 index 45bae24ae2..0000000000 --- a/packages/network/wpa_supplicant/patches/wpa_supplicant-libressl.patch +++ /dev/null @@ -1,69 +0,0 @@ -$OpenBSD: patch-src_crypto_tls_openssl_c,v 1.3 2015/09/29 11:57:54 dcoppa Exp $ - -Compatibility fixes for LibreSSL - ---- a/src/crypto/tls_openssl.c.orig Sun Sep 27 21:02:05 2015 -+++ b/src/crypto/tls_openssl.c Mon Sep 28 13:43:46 2015 -@@ -2229,7 +2229,7 @@ static int tls_parse_pkcs12(struct tls_data *data, SSL - } - - if (certs) { --#if OPENSSL_VERSION_NUMBER >= 0x10002000L -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) - SSL_clear_chain_certs(ssl); - while ((cert = sk_X509_pop(certs)) != NULL) { - X509_NAME_oneline(X509_get_subject_name(cert), buf, -@@ -2247,7 +2247,7 @@ static int tls_parse_pkcs12(struct tls_data *data, SSL - /* Try to continue anyway */ - } - sk_X509_free(certs); --#ifndef OPENSSL_IS_BORINGSSL -+#if !defined(OPENSSL_IS_BORINGSSL) && !defined(LIBRESSL_VERSION_NUMBER) - res = SSL_build_cert_chain(ssl, - SSL_BUILD_CHAIN_FLAG_CHECK | - SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR); -@@ -2812,7 +2812,7 @@ int tls_connection_get_random(void *ssl_ctx, struct tl - if (conn == NULL || keys == NULL) - return -1; - ssl = conn->ssl; --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - if (ssl == NULL || ssl->s3 == NULL || ssl->session == NULL) - return -1; - -@@ -2841,7 +2841,7 @@ int tls_connection_get_random(void *ssl_ctx, struct tl - #ifndef CONFIG_FIPS - static int openssl_get_keyblock_size(SSL *ssl) - { --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - const EVP_CIPHER *c; - const EVP_MD *h; - int md_size; -@@ -2911,7 +2911,7 @@ static int openssl_tls_prf(struct tls_connection *conn - "mode"); - return -1; - #else /* CONFIG_FIPS */ --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - SSL *ssl; - u8 *rnd; - int ret = -1; -@@ -3394,7 +3394,7 @@ int tls_connection_set_cipher_list(void *tls_ctx, stru - - wpa_printf(MSG_DEBUG, "OpenSSL: cipher suites: %s", buf + 1); - --#if OPENSSL_VERSION_NUMBER >= 0x10100000L -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - #if defined(EAP_FAST) || defined(EAP_FAST_DYNAMIC) || defined(EAP_SERVER_FAST) - if (os_strstr(buf, ":ADH-")) { - /* -@@ -3977,7 +3977,7 @@ static int tls_sess_sec_cb(SSL *s, void *secret, int * - struct tls_connection *conn = arg; - int ret; - --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - if (conn == NULL || conn->session_ticket_cb == NULL) - return 0; - diff --git a/packages/oem/package.mk b/packages/oem/package.mk index 59a2c9accb..42e98d4e69 100644 --- a/packages/oem/package.mk +++ b/packages/oem/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="oem" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="various" PKG_SITE="http://www.libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain $PROJECT" PKG_SECTION="virtual" -PKG_SHORTDESC="OEM: Metapackage for various OEM packages" PKG_LONGDESC="OEM: Metapackage for various OEM packages" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/packages.mk.addon_template b/packages/packages.mk.addon_template new file mode 100644 index 0000000000..dfa398879a --- /dev/null +++ b/packages/packages.mk.addon_template @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="[package name]" +PKG_VERSION="[package version identifier or unique githash]" +PKG_REV="100" +PKG_SHA256="[sha256 hash of the source file, downloaded from PKG_URL]" +PKG_ARCH="any" +PKG_LICENSE="[license of the upstream project]" +PKG_SITE="[url to the upstream project, e.g. http://example.com/libexample" +PKG_URL="[download url, e.g. https://github.com/example/libexample/archive/$PKG_VERSION.tar.gz]" +# PKG_MAINTAINER="John Doe" # Full name or forum/GitHub nickname, if you want to be identified as the addon maintainer +PKG_DEPENDS_TARGET="[build system dependencies, e.g. toolchain zlib openssl]" +PKG_SECTION="[location under packages, e.g. database]" +PKG_SHORTDESC="[short description of the package, e.g. libexample: library to calculate examples]" +PKG_LONGDESC="[long description of the package, often taken from the package/project website, e.g. libexample: this project is created to calculate examples for x and y, with maximum efficiency and fewer errors]" +# PKG_TOOLCHAIN="auto" or one of meson, cmake, cmake-make, configure, make, ninja, autotools, manual + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="[proper name of the addon that is shown at the repo]" +PKG_ADDON_TYPE="[type]" +# PKG_ADDON_PROJECTS="[project, only set when not any]" +# PKG_ADDON_PROVIDES="executable" +# PKG_ADDON_REQUIRES="some.addon:0.0.0" + +#PKG_CMAKE_OPTS_TARGET="-DWITH_EXAMPLE_PATH=/storage/.example +# " + +#pre_configure_target() { +# do something, or drop it +#} + +addon() { + # copy needed files from other packages (which are not in the image) +} + +# see https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/readme.md for more +# take a look to other packages, for inspiration diff --git a/packages/packages.mk.template b/packages/packages.mk.template new file mode 100644 index 0000000000..6557e8bbbc --- /dev/null +++ b/packages/packages.mk.template @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="[package name]" +PKG_VERSION="[package version identifier or unique githash]" +PKG_SHA256="[sha256 hash of the source file, downloaded from PKG_URL]" +PKG_ARCH="any" +PKG_LICENSE="[license of the upstream project]" +PKG_SITE="[url to the upstream project, e.g. http://example.com/libexample" +PKG_URL="[download url, e.g. https://github.com/example/libexample/archive/$PKG_VERSION.tar.gz]" +# PKG_MAINTAINER="John Doe" # Full name or forum/GitHub nickname, if you want to be identified as the addon maintainer +PKG_DEPENDS_TARGET="[build system dependencies, e.g. toolchain zlib openssl]" +PKG_SECTION="[location under packages, e.g. database]" +PKG_SHORTDESC="[short description of the package, e.g. libexample: library to calculate examples]" +PKG_LONGDESC="[long description of the package, often taken from the package/project website, e.g. libexample: this project is created to calculate examples for x and y, with maximum efficiency and fewer errors]" +# PKG_TOOLCHAIN="auto" + +#PKG_CMAKE_OPTS_TARGET="-DWITH_EXAMPLE_PATH=/storage/.example +# " + +#pre_configure_target() { +# do something, or drop it +#} + +# see https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/readme.md for more +# take a look to other packages, for inspiration diff --git a/packages/print/freetype/package.mk b/packages/print/freetype/package.mk index c50f481208..4188f2c974 100644 --- a/packages/print/freetype/package.mk +++ b/packages/print/freetype/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="freetype" PKG_VERSION="2.6.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="e20a6e1400798fd5e3d831dd821b61c35b1f9a6465d6b18a53a9df4cf441acf0" PKG_LICENSE="GPL" PKG_SITE="http://www.freetype.org" PKG_URL="http://download.savannah.gnu.org/releases/freetype/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain zlib libpng" -PKG_SECTION="print" -PKG_SHORTDESC="freetype: TrueType font rendering library" -PKG_LONGDESC="The FreeType engine is a free and portable TrueType font rendering engine. It has been developed to provide TT support to a great variety of platforms and environments." - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The FreeType engine is a free and portable TrueType font rendering engine." +PKG_TOOLCHAIN="configure" # package specific configure options PKG_CONFIGURE_OPTS_TARGET="LIBPNG_CFLAGS=-I$SYSROOT_PREFIX/usr/include \ @@ -46,8 +26,7 @@ pre_configure_target() { } post_makeinstall_target() { - $SED "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/freetype-config - ln -v -sf $SYSROOT_PREFIX/usr/include/freetype2 $SYSROOT_PREFIX/usr/include/freetype + sed -e "s:\(['=\" ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/freetype-config rm -rf $INSTALL/usr/bin } diff --git a/packages/python/devel/Mako/package.mk b/packages/python/devel/Mako/package.mk new file mode 100644 index 0000000000..45007cf755 --- /dev/null +++ b/packages/python/devel/Mako/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="Mako" +PKG_VERSION="1.0.7" +PKG_SHA256="4e02fde57bd4abb5ec400181e4c314f56ac3e49ba4fb8b0d50bba18cb27d25ae" +PKG_LICENSE="GPL" +PKG_SITE="https://pypi.org/project/Mako" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python3:host setuptools:host MarkupSafe:host" +PKG_LONGDESC="Mako is a super-fast templating language that borrows the best ideas from the existing templating languages." +PKG_TOOLCHAIN="manual" + +makeinstall_host() { + python3 setup.py install --prefix=$TOOLCHAIN +} diff --git a/packages/python/devel/MarkupSafe/package.mk b/packages/python/devel/MarkupSafe/package.mk new file mode 100644 index 0000000000..378038122d --- /dev/null +++ b/packages/python/devel/MarkupSafe/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="MarkupSafe" +PKG_VERSION="1.0" +PKG_SHA256="a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" +PKG_LICENSE="GPL" +PKG_SITE="https://pypi.org/project/MarkupSafe/" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python3:host setuptools:host" +PKG_LONGDESC="MarkupSafe implements a XML/HTML/XHTML Markup safe string for Python" +PKG_TOOLCHAIN="manual" + +makeinstall_host() { + python3 setup.py install --prefix=$TOOLCHAIN +} diff --git a/packages/python/devel/distutilscross/package.mk b/packages/python/devel/distutilscross/package.mk index be0c567e6e..367e35a7c0 100644 --- a/packages/python/devel/distutilscross/package.mk +++ b/packages/python/devel/distutilscross/package.mk @@ -1,40 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="distutilscross" PKG_VERSION="0.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="4ed3fb427708c8a3ed5fe9c599532480f581078a1e0aec0e50f40eb58e9f0015" PKG_LICENSE="GPL" PKG_SITE="http://bitbucket.org/lambacck/distutilscross/" -PKG_URL="http://pypi.python.org/packages/source/d/distutilscross/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="Python:host setuptools:host" -PKG_SECTION="python/devel" -PKG_SHORTDESC="distutilscross: Cross Compile Python Extensions" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python2:host setuptools:host" PKG_LONGDESC="distutilscross enhances distutils to support Cross Compile of Python extensions" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_host() { - : # nothing todo -} +PKG_TOOLCHAIN="manual" makeinstall_host() { - python setup.py install --prefix=$ROOT/$TOOLCHAIN + python setup.py install --prefix=$TOOLCHAIN } diff --git a/packages/python/devel/meson/package.mk b/packages/python/devel/meson/package.mk new file mode 100644 index 0000000000..0e34988c13 --- /dev/null +++ b/packages/python/devel/meson/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="meson" +PKG_VERSION="0.47.2" +PKG_SHA256="92d8afd921751261e36151643464efd3394162f69efbe8cd53e0a66b1cf395eb" +PKG_LICENSE="Apache" +PKG_SITE="http://mesonbuild.com" +PKG_URL="https://github.com/mesonbuild/meson/releases/download/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python3:host pathlib:host" +PKG_LONGDESC="High productivity build system" +PKG_TOOLCHAIN="manual" + +make_host() { + python3 setup.py build +} + +makeinstall_host() { + python3 setup.py install --prefix=$TOOLCHAIN --skip-build + + # Avoid using full path to python3 that may exceed 128 byte limit. + # Instead use PATH as we know our toolchain is first. + for f in meson mesonconf mesontest mesonintrospect wraptool; do + sed -i '1 s/^#!.*$/#!\/usr\/bin\/env python3/' $TOOLCHAIN/bin/$f + done +} diff --git a/packages/python/devel/ninja/package.mk b/packages/python/devel/ninja/package.mk new file mode 100644 index 0000000000..ba0091cfdd --- /dev/null +++ b/packages/python/devel/ninja/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) + +PKG_NAME="ninja" +PKG_VERSION="1.8.2" +PKG_SHA256="86b8700c3d0880c2b44c2ff67ce42774aaf8c28cbf57725cb881569288c1c6f4" +PKG_LICENSE="Apache" +PKG_SITE="http://martine.github.io/ninja/" +PKG_URL="https://github.com/ninja-build/ninja/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python2:host" +PKG_LONGDESC="Small build system with a focus on speed" +PKG_TOOLCHAIN="manual" + +make_host() { + python2 configure.py --bootstrap +} + +makeinstall_host() { + cp ninja $TOOLCHAIN/bin/ +} diff --git a/packages/python/devel/pathlib/package.mk b/packages/python/devel/pathlib/package.mk new file mode 100644 index 0000000000..30c9beaa60 --- /dev/null +++ b/packages/python/devel/pathlib/package.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pathlib" +PKG_VERSION="1.0.1" +PKG_SHA256="6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f" +PKG_LICENSE="MIT" +PKG_SITE="http://pathlib.readthedocs.org" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python3:host" +PKG_LONGDESC="This module offers a set of classes featuring all the common operations on paths in an easy, object-oriented way" +PKG_TOOLCHAIN="manual" + +makeinstall_host() { + python3 setup.py install --prefix=$TOOLCHAIN +} diff --git a/packages/python/devel/pygobject/package.mk b/packages/python/devel/pygobject/package.mk index e7c2ee3e76..e6eafaebfb 100644 --- a/packages/python/devel/pygobject/package.mk +++ b/packages/python/devel/pygobject/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="pygobject" -PKG_VERSION="2.28.6" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.28.7" +PKG_SHA256="bb9d25a3442ca7511385a7c01b057492095c263784ef31231ffe589d83a96a5a" PKG_LICENSE="LGPL" PKG_SITE="http://www.pygtk.org/" -PKG_URL="http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain Python glib libffi" -PKG_SECTION="python/devel" -PKG_SHORTDESC="pygobject: The Python bindings for GObject" -PKG_LONGDESC="PyGObject provides a convenient wrapper for the GObject+ library for use in Python programs, and takes care of many of the boring details such as managing memory and type casting. When combined with PyGTK, PyORBit and gnome-python, it can be used to write full featured Gnome applications." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_URL="http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain Python2 glib libffi" +PKG_LONGDESC="A convenient wrapper for the GObject+ library for use in Python programs." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-thread --disable-introspection" diff --git a/packages/python/devel/setuptools/package.mk b/packages/python/devel/setuptools/package.mk index ef01eb7fa4..8a21964cfa 100644 --- a/packages/python/devel/setuptools/package.mk +++ b/packages/python/devel/setuptools/package.mk @@ -1,40 +1,23 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="setuptools" -PKG_VERSION="32.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="39.2.0" +PKG_SHA256="ca8119dd5c2764a7d290518817de0b880d23d790913fcd797c02ad2aa39b8c41" PKG_LICENSE="OSS" -PKG_SITE="https://pypi.python.org/pypi/setuptools" +PKG_SITE="https://pypi.org/project/setuptools" PKG_URL="https://github.com/pypa/setuptools/archive/v$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="Python:host" -PKG_SECTION="python/devel" -PKG_SHORTDESC="setuptools: A collection of enhancements to the Python distutils" -PKG_LONGDESC="Distribute is intended to replace Setuptools as the standard method for working with Python module distributions. Packages built and distributed using distribute look to the user like ordinary Python packages based on the distutils. Your users don't need to install or even know about setuptools in order to use them, and you don't have to include the entire setuptools package in your distributions. By including just a single bootstrap module (a 7K .py file), your package will automatically download and install setuptools if the user is building your package from source and doesn't have a suitable version already installed." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_HOST="Python2:host Python3:host" +PKG_LONGDESC="Replaces Setuptools as the standard method for working with Python module distributions." +PKG_TOOLCHAIN="manual" make_host() { - python bootstrap.py + python2 bootstrap.py + python3 bootstrap.py } makeinstall_host() { - python setup.py install --prefix=$ROOT/$TOOLCHAIN + python2 setup.py install --prefix=$TOOLCHAIN + python3 setup.py install --prefix=$TOOLCHAIN } diff --git a/packages/python/graphics/Pillow/package.mk b/packages/python/graphics/Pillow/package.mk index 82d8fbc62d..4cd15bb7fd 100644 --- a/packages/python/graphics/Pillow/package.mk +++ b/packages/python/graphics/Pillow/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="Pillow" -PKG_VERSION="3.2.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="5.1.0" +PKG_SHA256="cee9bc75bff455d317b6947081df0824a8f118de2786dc3d74a3503fd631f4ef" PKG_LICENSE="BSD" PKG_SITE="http://www.pythonware.com/products/pil/" -PKG_URL="https://pypi.python.org/packages/source/P/Pillow/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host zlib freetype libjpeg-turbo tiff" -PKG_SECTION="python" -PKG_SHORTDESC="pil: Imaging handling/processing for Python" -PKG_LONGDESC="The Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host zlib freetype libjpeg-turbo tiff" +PKG_LONGDESC="The Python Imaging Library adds image processing capabilities to your Python interpreter." +PKG_TOOLCHAIN="manual" pre_make_target() { export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" diff --git a/packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch b/packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch index a8593a71d1..083e5037de 100644 --- a/packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch +++ b/packages/python/graphics/Pillow/patches/Pillow-0001-crosscompiling.patch @@ -1,93 +1,13 @@ -diff -Naur Pillow-3.1.0/setup.py Pillow-3.1.0.patch/setup.py ---- Pillow-3.1.0/setup.py 2016-01-04 11:07:30.000000000 +0100 -+++ Pillow-3.1.0.patch/setup.py 2016-01-11 02:05:31.504822915 +0100 -@@ -236,65 +236,10 @@ - _add_directory(include_dirs, "/usr/X11/include") - - elif sys.platform.startswith("linux"): -- arch_tp = (plat.processor(), plat.architecture()[0]) -- if arch_tp == ("x86_64", "32bit"): -- # 32-bit build on 64-bit machine. -- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") -- else: -- for platform_ in arch_tp: -- -- if not platform_: -- continue -- -- if platform_ in ["x86_64", "64bit"]: -- _add_directory(library_dirs, "/lib64") -- _add_directory(library_dirs, "/usr/lib64") -- _add_directory(library_dirs, -- "/usr/lib/x86_64-linux-gnu") -- break -- elif platform_ in ["i386", "i686", "32bit"]: -- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") -- break -- elif platform_ in ["aarch64"]: -- _add_directory(library_dirs, "/usr/lib64") -- _add_directory(library_dirs, -- "/usr/lib/aarch64-linux-gnu") -- break -- elif platform_ in ["arm", "armv7l"]: -- _add_directory(library_dirs, -- "/usr/lib/arm-linux-gnueabi") -- break -- elif platform_ in ["ppc64"]: -- _add_directory(library_dirs, "/usr/lib64") -- _add_directory(library_dirs, -- "/usr/lib/ppc64-linux-gnu") -- _add_directory(library_dirs, -- "/usr/lib/powerpc64-linux-gnu") -- break -- elif platform_ in ["ppc"]: -- _add_directory(library_dirs, "/usr/lib/ppc-linux-gnu") -- _add_directory(library_dirs, -- "/usr/lib/powerpc-linux-gnu") -- break -- elif platform_ in ["s390x"]: -- _add_directory(library_dirs, "/usr/lib64") -- _add_directory(library_dirs, -- "/usr/lib/s390x-linux-gnu") -- break -- elif platform_ in ["s390"]: -- _add_directory(library_dirs, "/usr/lib/s390-linux-gnu") -- break -- else: -- raise ValueError( -- "Unable to identify Linux platform: `%s`" % platform_) -- -- # XXX Kludge. Above /\ we brute force support multiarch. Here we -- # try Barry's more general approach. Afterward, something should -- # work ;-) -- self.add_multiarch_paths() -+ pass - - elif sys.platform.startswith("gnu"): -- self.add_multiarch_paths() -+ pass - - elif sys.platform.startswith("freebsd"): - _add_directory(library_dirs, "/usr/local/lib") -@@ -345,21 +289,6 @@ - else: - TCL_ROOT = None - -- # add standard directories -- -- # look for tcl specific subdirectory (e.g debian) -- if _tkinter: -- tcl_dir = "/usr/include/tcl" + TCL_VERSION -- if os.path.isfile(os.path.join(tcl_dir, "tk.h")): -- _add_directory(include_dirs, tcl_dir) -- -- # standard locations -- _add_directory(library_dirs, "/usr/local/lib") -- _add_directory(include_dirs, "/usr/local/include") -- -- _add_directory(library_dirs, "/usr/lib") -- _add_directory(include_dirs, "/usr/include") -- - # on Windows, look for the OpenJPEG libraries in the location that - # the official installer puts them - if sys.platform == "win32": +diff --git a/setup.py b/setup.py +index 4a0ad86c5..c07e1a938 100755 +--- a/setup.py ++++ b/setup.py +@@ -194,7 +194,7 @@ class pil_build_ext(build_ext): + ] + + def initialize_options(self): +- self.disable_platform_guessing = None ++ self.disable_platform_guessing = True + build_ext.initialize_options(self) + for x in self.feature: + setattr(self, 'disable_%s' % x, None) diff --git a/packages/python/security/pycrypto/package.mk b/packages/python/security/pycrypto/package.mk index bfdde52145..1179b54b12 100644 --- a/packages/python/security/pycrypto/package.mk +++ b/packages/python/security/pycrypto/package.mk @@ -18,12 +18,11 @@ PKG_NAME="pycrypto" PKG_VERSION="2.6.1" -PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" PKG_SITE="https://www.dlitz.net/software/pycrypto/" PKG_URL="http://pypi.python.org/packages/source/p/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" PKG_SECTION="python/security" PKG_SHORTDESC="PyCrypto - The Python Cryptography Toolkit" PKG_LONGDESC="The Python Cryptography Toolkit describes a package containing various cryptographic modules for the Python programming language" @@ -36,7 +35,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_realloc_0_nonnull=yes \ --without-gmp --without-mpir" pre_configure_target() { - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" diff --git a/packages/python/security/pycryptodome/package.mk b/packages/python/security/pycryptodome/package.mk new file mode 100644 index 0000000000..c3f1d7ab6c --- /dev/null +++ b/packages/python/security/pycryptodome/package.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pycryptodome" +PKG_VERSION="3.6.1" +PKG_SHA256="15013007e393d0cc0e69f4329a47c4c8597b7f3d02c12c03f805405542f70c71" +PKG_LICENSE="BSD" +PKG_SITE="https://pypi.org/project/pycryptodome" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="PyCryptodome is a self-contained Python package of low-level cryptographic primitives." +PKG_TOOLCHAIN="manual" + +pre_configure_target() { + cd $PKG_BUILD + rm -rf .$TARGET_NAME + + export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" + export LDSHARED="$CC -shared" +} + +make_target() { + python setup.py build --cross-compile +} + +makeinstall_target() { + python setup.py install --root=$INSTALL --prefix=/usr + + # Remove SelfTest bloat + find $INSTALL -type d -name SelfTest -exec rm -fr "{}" \; 2>/dev/null || true + find $INSTALL -name SOURCES.txt -exec sed -i "/\/SelfTest\//d;" "{}" \; + + # Create Cryptodome as an alternative namespace to Crypto (Kodi addons may use either) + ln -sf /usr/lib/$PKG_PYTHON_VERSION/site-packages/Crypto $INSTALL/usr/lib/$PKG_PYTHON_VERSION/site-packages/Cryptodome +} + +post_makeinstall_target() { + find $INSTALL/usr/lib -name "*.py" -exec rm -rf "{}" ";" +} diff --git a/packages/python/system/dbus-python/package.mk b/packages/python/system/dbus-python/package.mk index 11118f147f..441c8f6779 100644 --- a/packages/python/system/dbus-python/package.mk +++ b/packages/python/system/dbus-python/package.mk @@ -1,37 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="dbus-python" -PKG_VERSION="1.2.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.2.8" +PKG_SHA256="abf12bbb765e300bf8e2a1b2f32f85949eab06998dbda127952c31cb63957b6f" PKG_LICENSE="GPL" PKG_SITE="https://freedesktop.org/wiki/Software/dbus" PKG_URL="https://dbus.freedesktop.org/releases/dbus-python/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python dbus dbus-glib" -PKG_SECTION="python/system" -PKG_SHORTDESC="dbus-python: A message bus system" -PKG_LONGDESC="D-BUS is a message bus, used for sending messages between applications. Conceptually, it fits somewhere in between raw sockets and CORBA in terms of complexity. D-BUS supports broadcast messages, asynchronous messages (thus decreasing latency), authentication, and more. It is designed to be low-overhead; messages are sent using a binary protocol, not using XML. D-BUS also supports a method call mapping for its messages, but it is not required; this makes using the system quite simple." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain Python2 dbus dbus-glib" +PKG_LONGDESC="D-BUS is a message bus, used for sending messages between applications." +PKG_BUILD_FLAGS="+lto" pre_configure_target() { + export PYTHON_CONFIG="$SYSROOT_PREFIX/usr/bin/python2-config" export PYTHON_INCLUDES="$($SYSROOT_PREFIX/usr/bin/python2-config --includes)" export PYTHON_LIBS="$($SYSROOT_PREFIX/usr/bin/python2-config --ldflags)" } diff --git a/packages/python/system/simplejson/package.mk b/packages/python/system/simplejson/package.mk index 39bdef1bff..07cbd708ad 100644 --- a/packages/python/system/simplejson/package.mk +++ b/packages/python/system/simplejson/package.mk @@ -1,38 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) PKG_NAME="simplejson" -PKG_VERSION="3.8.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.15.0" +PKG_SHA256="ad332f65d9551ceffc132d0a683f4ffd12e4bc7538681100190d577ced3473fb" PKG_LICENSE="OSS" -PKG_SITE="http://pypi.python.org/pypi/simplejson" -PKG_URL="http://pypi.python.org/packages/source/s/simplejson/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain Python distutilscross:host" -PKG_SECTION="python/system" -PKG_SHORTDESC="simplejson: a simple, fast, complete, correct and extensible JSON encoder and decoder for Python 2.5+." -PKG_LONGDESC="simplejson is a simple, fast, complete, correct and extensible JSON encoder and decoder for Python 2.5+. It is pure Python code with no dependencies, but includes an optional C extension for a serious speed boost." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_SITE="http://pypi.org/project/simplejson" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain Python2 distutilscross:host" +PKG_LONGDESC="A simple, fast, complete, correct and extensible JSON encoder and decoder for Python 2.5+." +PKG_TOOLCHAIN="manual" pre_make_target() { - strip_lto export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr" } diff --git a/packages/readme.md b/packages/readme.md new file mode 100644 index 0000000000..f141c19d57 --- /dev/null +++ b/packages/readme.md @@ -0,0 +1,295 @@ +# Structure of package.mk files + +## Introduction + +The package.mk file defines variables and functions to build a package. + +## Variables +To control the build behaviour of your package, use variables in the top-down order listed here. + +#### Base + +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_NAME | - | yes | Name of the packaged software application. Should be lowercase | +| PKG_VERSION | - | yes | Version of the packaged software application. If the version is a githash, please use the full githash, not the abbreviated form. | +| PKG_SHA256 | - | yes | SHA256 hashsum of the application download file | +| PKG_ARCH | any | no | Architectures for which the package builds. `any` or a space separated list of `aarch64`, `arm` or `x86_64` | +| PKG_LICENSE | - | yes | License of the software application. [Reference](https://github.com/LibreELEC/LibreELEC.tv/tree/master/licenses) | +| PKG_SITE | - | yes | Site of the software application | +| PKG_URL | - | yes | Address at which the source of the software application can be retrieved | +| PKG_MAINTAINER | - | no | Your name | +| PKG_DEPENDS_BOOTSTRAP
PKG_DEPENDS_HOST PKG_DEPENDS_INIT PKG_DEPENDS_TARGET | - | no | A space separated list of name of packages required to build the software application | +| PKG_SECTION | - | no | virtual if the package only defines dependencies | +| PKG_SHORTDESC | - | no
yes for addons | Short description of the software package | +| PKG_LONGDESC | - | yes | Long description of the package including purpose or function within LibreELEC or Kodi | + +#### Universal Build Option +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_SOURCE_DIR | - | no | Force the folder name that application sources are unpacked to. Used when sources do not automatically unpack to a folder with the `PKG_NAME-PKG_VERSION` naming convention. | +| PKG_SOURCE_NAME | - | no | Force the filename of the application sources. Used when the filename is not the basename of `PKG_URL` | +| PKG_PATCH_DIRS | - | no | Patches in `./patches` are automatically applied after package unpack. Use this option to include patches from an additional folder, e.g. `./patches/$PKG_PATCH_DIRS` | +| PKG_NEED_UNPACK | - | no | Space separated list of files or folders to include in package stamp calculation. If the stamp is invalidated through changes to package files or dependent files/folders the package is cleaned and rebuilt. e.g. `PKG_NEED_UNPACK="$(get_pkg_directory linux)"` will trigger clean/rebuild of a Linux kernel driver package when a change to the `linux` kernel package is detected. | +| PKG_TOOLCHAIN | auto | no | Control which build toolchain is used. For detailed information, see [reference](#toolchain-options). | +| PKG_BUILD_FLAGS | - | no | A space separated list of flags with which to fine-tune the build process. Flags can be enabled or disabled with a `+` or `-` prefix. For detailed information, see the [Reference](#build_flags-options). | +| PKG_PYTHON_VERSION | python2.7 | no | Define the Python version to be used. | +| PKG_IS_KERNEL_PKG | - | no | Set to `yes` for packages that include Linux kernel modules | + +#### Meson Options +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_MESON_SCRIPT | $PKG_BUILD/meson.build | no | Meson build file to use | +| PKG_MESON_OPTS_TARGET | - | no | Options directly passed to meson | + +#### CMAKE Options +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_CMAKE_SCRIPT | $PKG_BUILD/CMakeLists.txt | no | CMake build file to use | +| PKG_CMAKE_OPTS_HOST
PKG_CMAKE_OPTS_TARGET | - | no | Options directly passed to cmake | + +#### Configure Options +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_CONFIGURE_SCRIPT | $PKG_BUILD/configure | no | configure script to use | +| PKG_CONFIGURE_OPTS
PKG_CONFIGURE_OPTS_BOOTSTRAP
PKG_CONFIGURE_OPTS_HOST
PKG_CONFIGURE_OPTS_INIT
PKG_CONFIGURE_OPTS_TARGET | - | no | Options directly passed to configure | + +#### Make Options +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_MAKE_OPTS
PKG_MAKE_OPTS_BOOTSTRP
PKG_MAKE_OPTS_HOST
PKG_MAKE_OPTS_INIT
PKG_MAKE_OPTS_TARGET | - | no | Options directly passed to make in the build step +| PKG_MAKEINSTALL_OPTS_HOST
PKG_MAKEINSTALL_OPTS_TARGET | - | no | Options directly passed to make in the install step + +#### Addons +Additional options used when the package builds an addon. + +| Variable | Default | Required |Description | +|-------------|---------|----------|------------| +| PKG_REV | - | yes | The revision number of the addon (starts at 100). Must be placed after `PKG_VERSION`. Must be incremented for each new version else Kodi clients will not detect version change and download the updated addon. | +| PKG_IS_ADDON | no | yes | Must be set to `yes`
or to `embedded` when this addon is part of the image | +| PKG_ADDON_NAME | - | yes | Proper name of the addon that is shown at the repo | +| PKG_ADDON_TYPE | - | yes | See LE/config/addon/ for other possibilities | +| PKG_ADDON_VERSION | - | no | The version of the addon, used in addon.xml | +| PKG_ADDON_PROVIDES | - | no | [Provides](http://kodi.wiki/view/addon.xml#.3Cprovides.3E_element) in addon-xml | +| PKG_ADDON_REQUIRES | - | no | [Requires](http://kodi.wiki/view/addon.xml#.3Crequires.3E) used in addon.xml | +| PKG_ADDON_PROJECTS | @PROJECTS@ | no | for available projects or devices, see projects subdirectory (note: Use RPi for RPi project, and RPi1 for RPi device) | +| PKG_DISCLAIMER | - | no | [Disclaimer](https://kodi.wiki/view/Addon.xml#.3Cdisclaimer.3E) in addon-xml | +| PKG_ADDON_IS_STANDALONE | - | no | Defines if an addon depends on Kodi (on) or is standalone (yes) | +| PKG_ADDON_BROKEN | - | no | Marks an addon as broken for the user | + +#### Detailed Information for Options + +##### TOOLCHAIN options + +Application/packages needs different toolchains for build. +For instance `cmake` or the classic `./configure` or same very different. + +For the most application/packages, the auto-detection of the toolchain works proper. +But not always. To select a specific toolchain, you only need to set the `PKG_TOOLCHAIN` variable. + +| Toolchain | Description (if needed) | +|----------- |-------------------------| +| meson | [Meson Build System](http://mesonbuild.com/) | +| cmake | [CMake](https://cmake.org/) with Ninja | +| cmake-make | [CMake](https://cmake.org/) with Make | +| autotools | [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) +| configure | preconfigured [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) | +| ninja | [Ninja Build](https://ninja-build.org/) | +| make | [Makefile Based](https://www.gnu.org/software/make/) | +| manual | only runs self writen build steps, see [Functions](#functions) | + +###### Auto-Detection +The auto-detections looks for specific files in the source path. + +1. `meson.build` (PKG_MESON_SCRIPT) => meson toolchain +2. `CMakeLists.txt` (PKG_CMAKE_SCRIPT) => cmake toolchain +3. `configure` (PKG_CONFIGURE_SCRIPT) => configure toolchain +4. `Makefile` => make toolchain + +When none of these was found, the build abort and you have to set the toolchain via `PKG_TOOLCHAIN` + +##### BUILD_FLAGS options + +Build flags implement often used build options. Normally these are activated be default, but single applications/packages has problems to compile/run with these. + +Set the variable `PKG_BUILD_FLAGS` in the `package.mk` to enable/disable the single flags. It is a space separated list. The flags can enabled with a `+` prefix, and disabled with a `-`. + +| flag | default | affected stage | description | +|----------|----------|----------------|-------------| +| pic | disabled | target/init | [Position Independent Code](https://en.wikipedia.org/wiki/Position-independent_code) | +| pic:host | disabled | host/bootstrap | see above | +| lto | disabled | target/init | enable LTO (Link Time optimization) in the compiler and linker unless disabled via `LTO_SUPPORT`. Compiles non-fat LTO objects (only bytecode) and performs single-threaded optimization at link stage | +| lto-parallel | disabled | target/init | same as `lto` but enable parallel optimization at link stage. Only enable this if the package build doesn't run multiple linkers in parallel otherwise this can result in lots of parallel processes! | +| lto-fat | disabled | target/init | same as `lto` but compile fat LTO objects (bytecode plus optimized assembly). This increases compile time but can be useful to create static libraries suitable both for LTO and non-LTO linking | +| lto-off | disabled | target/init | explicitly disable LTO in the compiler and linker | +| gold | depend on `GOLD_SUPPORT` | target/init | can only disabled, use of the GOLD-Linker | +| parallel | enabled | all | `make` or `ninja` builds with multiple threads/processes (or not) | +| strip | enabled | target | strips executables (or not) | + +###### Example +``` +PKG_BUILD_FLAGS="+pic -gold" +PKG_BUILD_FLAGS="-parallel" +``` + +## Functions +All build steps in the LibreELEC build system, a done by shell function. +These functions can overwritten in the `package.mk`. But this raises problems, when the build system is updated. To reduce the problem, most function was extended by `pre_` and `post_` scripts, to use instead. + +When it is nesseary to replace configure, make and makeinstall, please use `PKG_TOOLCHAIN="manual"`. + +Some of the build steps needs to be run once, like `unpack`. Other steps needs to be run multiple times, to create the toolchain (stage bootstrap & host) or to create the LE image (stage init & target). These stage specific functions have the stage as suffix, like `make_target`. + +Full list of overwrittable functions. + +| function | stages specific | description | +|-------------------------|--------|-------------| +| configure_package | - | Optional function to implement late binding variable assignment (see below) | +| unpack
pre_unpack
post_unpack | - | Extract the source from the downloaded file | +| pre_patch
post_patch | - | Apply the patches to the source, after extraction. The patch function it self is not allowed to overwritten | +| pre_build_\[stage] | yes | Runs before of the start of the build | +| configure_\[stage]
pre_configure_\[stage]
post_configure_\[stage] | yes | Configure the package for the compile. This is only relevant for toolchain, that supports it (e.g. meson, cmake, configure, manual) | +| make_\[stage]
pre_make_\[stage]
post_make_\[stage] | yes | Build of the package | +| makeinstall_\[stage]
pre_makeinstall_\[stage]
post_makeinstall_\[stage] | yes | Installation of the files in the correct pathes
host: TOOLCHAIN
target: SYSROOT and IMAGE
bootstrap and init: temporary destination +| addon | - | Copy all files together for addon creation. This is requiered for addons | + +## Late Binding variable assignment + +A package will be loaded only once, by the call to `config/options`. During this process, additional package specific variables will be initialised, such as: + +* `PKG_BUILD` - path to the build folder +* `PKG_SOURCE_NAME` - if not already specified, generated from `PKG_URL`, `PKG_NAME` and` PKG_VERSION` + +Since these variables will not exist at the time the package is loaded, they can only be referenced **after** package has loaded. This can be accomplished by referencing these variables in the `configure_package()` function which is executed once the additional variables have been assigned. + +If necessary, the following variables would be configured in `configure_package()` as they are normally relative to `${PKG_BUILD}`: +``` + PKG_CONFIGURE_SCRIPT + PKG_CMAKE_SCRIPT + PKG_MESON_SCRIPT +``` + +Further to this, toolchain variables that are defined in `setup_toolchain()` must not be referenced "globally" in the package as they will only be configured reliably after `setup_toolchain()` has been called during `scripts/build`. Any variable in the following list must instead be referenced in a package function such as `pre_build_*`, `pre_configure_*`, `pre_make_*` etc.: +``` + TARGET_CFLAGS TARGET_CXXFLAGS TARGET_LDFLAGS + NINJA_OPTS MAKEFLAGS + DESTIMAGE + CC CXX CPP LD + AS AR NM RANLIB + OBJCOPY OBJDUMP + STRIP + CPPFLAGS CFLAGS CXXFLAGS LDFLAGS + PKG_CONFIG + PKG_CONFIG_PATH + PKG_CONFIG_LIBDIR + PKG_CONFIG_SYSROOT_DIR + PKG_CONFIG_ALLOW_SYSTEM_CFLAGS + PKG_CONFIG_ALLOW_SYSTEM_LIBS + CMAKE_CONF CMAKE + HOST_CC HOST_CXX HOSTCC HOSTCXX + CC_FOR_BUILD CXX_FOR_BUILD BUILD_CC BUILD_CXX + _python_sysroot _python_prefix _python_exec_prefix +``` + +Lastly, the following variables are assigned during `scripts/build` but some packages may need to use alternative values for these variables. To do so, the package must assign alternative values in `pre_build_*`/`pre_configure_*`/`pre_make_*` etc. functions as these functions will be called after the variables are initialised with default values in `scripts/build` but before they are used by `scripts/build`. +``` + CMAKE_GENERATOR_NINJA + + TARGET_CONFIGURE_OPTS + TARGET_CMAKE_OPTS + TARGET_MESON_OPTS + + HOST_CONFIGURE_OPTS + HOST_CMAKE_OPTS + HOST_MESON_OPTS + + INIT_CONFIGURE_OPTS + INIT_CMAKE_OPTS + INIT_MESON_OPTS + + BOOTSTRAP_CONFIGURE_OPTS + BOOTSTRAP_CMAKE_OPTS + BOOTSTRAP_MESON_OPTS +``` + +#### Example +``` +configure_package() { + # now we know where we're building, assign a value + PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/gettext-tools/configure" +} + +post_patch() { + # replace hardcoded stuff + sed -i ${PKG_CONFIGURE_SCRIPT} 's|hardcoded stuff|variable stuff|' +} + +pre_configure_target() { + # add extra flag to toolchain default + CFLAGS="$CFLAGS -DEXTRA_FLAG=yeah" +} + +post_makeinstall_target() { + # remove unused executable, install what remains + rm $INSTALL/usr/bin/bigexecutable +} +``` + +#### tools/pkgcheck + +Use `tools/pkgcheck` to verify packages. It detects the following issues: + +Issue | Level | Meaning | +| :--- | :----: | ---- | +| late binding violation | FAIL | Late binding variables referenced outside of a function - see [late binding](https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/readme.md#late-binding-variable-assignment) | +| duplicate function def | FAIL | Function defined multiple times, only last definition will be used | +| bad func - missing brace | FAIL | Opening brace (`{`) for function definition should be on same line as the function def, ie. `pre_configure_target() {` | +| intertwined vars & funcs | WARN | Variable assignments and logic is intertwined with functions - this is cosmetic, but variables and logic should be specified before all functions | +| unknown function | WARN | Could be a misspelled function, ie. `per_configure_target() {` which might fail silently.| + + +## Add a new package to the Image +1. Think about, why you need it in the image. + * new multimedia tool + * add a new network tool + * new kernel driver + * ... +2. Find a place in the packages tree + * look into the package tree structure, which is generally self explaind. + * do not place it in an existing package (directory that includes a `package.mk`) + * when you found a place, create a directory with the name of your package (use same value for `PKG_NAME`!!) +3. Create an initial `package.mk` + * you can find a template under `packages/package.mk.template`. Copy the template into the new directory and call it `package.mk` + * apply any required changes to your new `package.mk` +4. Find a place in the dependency tree + * when it extend an existing package, add it there to the `PKG_DEPENDS_TARGET`/`PKG_DEPENDS_HOST` etc. + * take a look into the path `packages/virtual`, there you should find a virtual packages, that match your new package (misc-packages should be the last option) +5. Now you can build your image + * after the build, inside the `build-*` folder you should find a directory with your package name and -version, eg. `widget-1.2.3`. + +## Example +``` +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="mariadb-connector-c" +PKG_VERSION="3.0.2" +PKG_SHA256="f44f436fc35e081db3a56516de9e3bb11ae96838e75d58910be28ddd2bc56d88" +PKG_LICENSE="LGPL" +PKG_SITE="https://mariadb.org/" +PKG_URL="https://github.com/MariaDB/mariadb-connector-c/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain zlib openssl" +PKG_LONGDESC="mariadb-connector: library to conntect to mariadb/mysql database server" +PKG_BUILD_FLAGS="-gold" + +PKG_CMAKE_OPTS_TARGET="-DWITH_EXTERNAL_ZLIB=ON \ + -DAUTH_CLEARTEXT=STATIC \ + -DAUTH_DIALOG=STATIC \ + -DAUTH_OLDPASSWORD=STATIC \ + -DREMOTEIO=OFF" + +post_makeinstall_target() { + # drop all unneeded + rm -rf $INSTALL/usr +} +``` diff --git a/packages/security/gnutls/package.mk b/packages/security/gnutls/package.mk new file mode 100644 index 0000000000..4eaf98ecb6 --- /dev/null +++ b/packages/security/gnutls/package.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="gnutls" +PKG_VERSION="3.6.5" +PKG_SHA256="073eced3acef49a3883e69ffd5f0f0b5f46e2760ad86eddc6c0866df4e7abb35" +PKG_LICENSE="LGPL2.1" +PKG_SITE="https://gnutls.org" +PKG_URL="https://www.gnupg.org/ftp/gcrypt/gnutls/v${PKG_VERSION%.*}/gnutls-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain libidn2 nettle zlib" +PKG_LONGDESC="A library which provides a secure layer over a reliable transport layer." + +PKG_CONFIGURE_OPTS_TARGET="--disable-doc \ + --disable-full-test-suite \ + --disable-guile \ + --disable-libdane \ + --disable-padlock \ + --disable-tests \ + --disable-tools \ + --disable-valgrind-tests \ + --enable-local-libopts \ + --with-idn \ + --with-included-libtasn1 \ + --with-included-unistring \ + --without-p11-kit \ + --without-tpm" +makeinstall_target() { + make install DESTDIR="$INSTALL/../.INSTALL_PKG" +} diff --git a/packages/security/libgcrypt/package.mk b/packages/security/libgcrypt/package.mk index df6bb23297..cb1fd1547c 100644 --- a/packages/security/libgcrypt/package.mk +++ b/packages/security/libgcrypt/package.mk @@ -1,47 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libgcrypt" -PKG_VERSION="1.7.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.8.3" +PKG_SHA256="66ec90be036747602f2b48f98312361a9180c97c68a690a5f376fa0f67d0af7c" PKG_LICENSE="GPLv2" PKG_SITE="https://www.gnupg.org/" PKG_URL="https://www.gnupg.org/ftp/gcrypt/libgcrypt/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libgpg-error" -PKG_SECTION="security" -PKG_SHORTDESC="libgcrypt: General purpose cryptographic library" -PKG_LONGDESC="Libgcrypt is a general purpose cryptographic library based on the code from GnuPG. It provides functions for all cryptographic building blocks: symmetric ciphers, hash algorithms, MACs, public key algorithms, large integer functions, random numbers and a lot of supporting functions." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ - ac_cv_sys_symbol_underscore=no \ - --enable-asm \ - --with-gnu-ld \ - --with-libgpg-error-prefix=$SYSROOT_PREFIX/usr \ - --disable-doc" +PKG_LONGDESC="A General purpose cryptographic library." +PKG_TOOLCHAIN="autotools" +# libgcrypt-1.7.x fails to build with LTO support +# see for example https://bugs.gentoo.org/show_bug.cgi?id=581114 pre_configure_target() { - # libgcrypt-1.7.x fails to build with LTO support - # see for example https://bugs.gentoo.org/show_bug.cgi?id=581114 - strip_lto + PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC \ + ac_cv_sys_symbol_underscore=no \ + --enable-asm \ + --with-gnu-ld \ + --with-libgpg-error-prefix=$SYSROOT_PREFIX/usr \ + --disable-doc" } post_makeinstall_target() { diff --git a/packages/security/libgpg-error/package.mk b/packages/security/libgpg-error/package.mk index 620f15c076..a5bcf19002 100644 --- a/packages/security/libgpg-error/package.mk +++ b/packages/security/libgpg-error/package.mk @@ -1,39 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libgpg-error" -PKG_VERSION="1.25" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.27" +PKG_SHA256="4f93aac6fecb7da2b92871bb9ee33032be6a87b174f54abf8ddf0911a22d29d2" PKG_LICENSE="GPLv2" PKG_SITE="https://www.gnupg.org" PKG_URL="https://www.gnupg.org/ftp/gcrypt/libgpg-error/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="security" -PKG_SHORTDESC="libgpg-error: Library that defines common error values for GnuPG components" -PKG_LONGDESC="This is a library that defines common error values for all GnuPG components. Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt, Libksba, DirMngr, Pinentry, SmartCard Daemon and possibly more in the future." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC --enable-static --disable-shared --disable-nls --disable-rpath --with-gnu-ld" +PKG_LONGDESC="A library that defines common error values for all GnuPG components." pre_configure_target() { + PKG_CONFIGURE_OPTS_TARGET="CC_FOR_BUILD=$HOST_CC --enable-static --disable-shared --disable-nls --disable-rpath --with-gnu-ld --with-pic" + # inspired by openembedded case ${TARGET_ARCH} in aarch64) @@ -54,7 +34,7 @@ pre_configure_target() { ;; esac - cp $ROOT/$PKG_BUILD/src/syscfg/lock-obj-pub.$GPGERROR_TUPLE.h $ROOT/$PKG_BUILD/src/syscfg/lock-obj-pub.$GPGERROR_TARGET.h + cp $PKG_BUILD/src/syscfg/lock-obj-pub.$GPGERROR_TUPLE.h $PKG_BUILD/src/syscfg/lock-obj-pub.$GPGERROR_TARGET.h } post_makeinstall_target() { diff --git a/packages/security/libressl/package.mk b/packages/security/libressl/package.mk deleted file mode 100644 index f1a933d145..0000000000 --- a/packages/security/libressl/package.mk +++ /dev/null @@ -1,42 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="libressl" -PKG_VERSION="2.4.4" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="BSD" -PKG_SITE="http://www.libressl.org/" -PKG_URL="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="ccache:host" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="security" -PKG_SHORTDESC="libressl: a FREE version of the SSL/TLS protocol forked from OpenSSL" -PKG_LONGDESC="LibreSSL is a FREE version of the SSL/TLS protocol forked from OpenSSL" - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="yes" - -post_makeinstall_target() { - # backwards compatibility - mkdir -p $INSTALL/etc/pki/tls - ln -sf /etc/ssl/cert.pem $INSTALL/etc/pki/tls/cacert.pem - mkdir -p $INSTALL/etc/pki/tls/certs - ln -sf /etc/ssl/cert.pem $INSTALL/etc/pki/tls/certs/ca-bundle.crt -} diff --git a/packages/security/libressl/patches/libressl-trusted-first.patch b/packages/security/libressl/patches/libressl-trusted-first.patch deleted file mode 100644 index f02b6e101a..0000000000 --- a/packages/security/libressl/patches/libressl-trusted-first.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 779c075d93f339ee4043ea026586a463376b301c Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Wed, 20 Apr 2016 22:26:49 +0200 -Subject: [PATCH] trusted first - ---- - apps/openssl/apps.c | 2 ++ - crypto/x509/x509_vfy.c | 14 ++++++++++++++ - include/openssl/x509_vfy.h | 2 ++ - 3 files changed, 18 insertions(+) - -diff --git a/apps/openssl/apps.c b/apps/openssl/apps.c -index 6e40965..cbdd080 100644 ---- a/apps/openssl/apps.c -+++ b/apps/openssl/apps.c -@@ -1943,6 +1943,8 @@ args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, - flags |= X509_V_FLAG_NOTIFY_POLICY; - else if (!strcmp(arg, "-check_ss_sig")) - flags |= X509_V_FLAG_CHECK_SS_SIGNATURE; -+ else if (!strcmp(arg, "-trusted_first")) -+ flags |= X509_V_FLAG_TRUSTED_FIRST; - else - return 0; - -diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c -index f9fd3a0..6e51edb 100644 ---- a/crypto/x509/x509_vfy.c -+++ b/crypto/x509/x509_vfy.c -@@ -209,6 +209,20 @@ X509_verify_cert(X509_STORE_CTX *ctx) - if (ctx->check_issued(ctx, x, x)) - break; - -+ /* If asked see if we can find issuer in trusted store first */ -+ if (ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) { -+ ok = ctx->get_issuer(&xtmp, ctx, x); -+ if (ok < 0) -+ goto end; -+ /* If successful for now free up cert so it -+ * will be picked up again later. -+ */ -+ if (ok > 0) { -+ X509_free(xtmp); -+ break; -+ } -+ } -+ - /* If we were passed a cert chain, use it first */ - if (ctx->untrusted != NULL) { - xtmp = find_issuer(ctx, sktmp, x); -diff --git a/include/openssl/x509_vfy.h b/include/openssl/x509_vfy.h -index e4050b2..ddf77e7 100644 ---- a/include/openssl/x509_vfy.h -+++ b/include/openssl/x509_vfy.h -@@ -383,6 +383,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); - #define X509_V_FLAG_USE_DELTAS 0x2000 - /* Check selfsigned CA signature */ - #define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 -+/* Use trusted store first */ -+#define X509_V_FLAG_TRUSTED_FIRST 0x8000 - /* Do not check certificate or CRL validity against current time. */ - #define X509_V_FLAG_NO_CHECK_TIME 0x200000 - diff --git a/packages/security/nettle/package.mk b/packages/security/nettle/package.mk new file mode 100644 index 0000000000..459d976d0d --- /dev/null +++ b/packages/security/nettle/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="nettle" +PKG_VERSION="3.4.1" +PKG_SHA256="f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad" +PKG_LICENSE="GPL2" +PKG_SITE="http://www.lysator.liu.se/~nisse/nettle" +PKG_URL="http://ftpmirror.gnu.org/gnu/nettle/nettle-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain gmp" +PKG_LONGDESC="A low-level cryptographic library." + +PKG_CONFIGURE_OPTS_TARGET="--disable-documentation \ + --disable-openssl" + +if target_has_feature neon; then + PKG_CONFIGURE_OPTS_TARGET+=" --enable-arm-neon" +fi + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin +} diff --git a/packages/security/nspr/package.mk b/packages/security/nspr/package.mk new file mode 100644 index 0000000000..7d16ac8df0 --- /dev/null +++ b/packages/security/nspr/package.mk @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) + +PKG_NAME="nspr" +PKG_VERSION="4.19" +PKG_LICENSE="Mozilla Public License" +PKG_SITE="http://www.linuxfromscratch.org/blfs/view/svn/general/nspr.html" +PKG_DEPENDS_HOST="ccache:host" +PKG_DEPENDS_TARGET="toolchain nss:host" +PKG_LONGDESC="Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions" +PKG_TOOLCHAIN="configure" +PKG_BUILD_FLAGS="-parallel" + +if [ "$TARGET_ARCH" = "x86_64" ] ; then + TARGET_USE_64="--enable-64bit" +fi + +PKG_CONFIGURE_OPTS_TARGET="--with-pthreads $TARGET_USE_64" +PKG_MAKE_OPTS_TARGET="NSINSTALL=$TOOLCHAIN/bin/nsinstall" +PKG_MAKEINSTALL_OPTS_TARGET="NSINSTALL=$TOOLCHAIN/bin/nsinstall" + +configure_host() { + cd $(get_build_dir nss)/nspr + ./configure --with-pthreads --enable-64bit --with-pthreads --prefix=$TOOLCHAIN +} + +pre_make_host() { + cd $(get_build_dir nss)/nspr + make clean +} + +configure_target() { + cd $(get_build_dir nss)/nspr + ./configure --with-pthreads $TARGET_USE_64 $TARGET_CONFIGURE_OPTS +} + +pre_make_target() { + cd $(get_build_dir nss)/nspr + make clean +} diff --git a/packages/security/nss/package.mk b/packages/security/nss/package.mk new file mode 100644 index 0000000000..540ccf7e9a --- /dev/null +++ b/packages/security/nss/package.mk @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) + +PKG_NAME="nss" +PKG_VERSION="3.37.1" +PKG_SHA256="5ac4a388b06b2785fb7f4f0ae3c909d8cbb2ab370147ff61fe2517cc5bf3c685" +PKG_LICENSE="Mozilla Public License" +PKG_SITE="http://ftp.mozilla.org/" +PKG_URL="http://ftp.mozilla.org/pub/security/nss/releases/NSS_3_37_1_RTM/src/nss-3.37.1-with-nspr-4.19.tar.gz" +PKG_DEPENDS_HOST="nspr:host zlib:host" +PKG_DEPENDS_TARGET="toolchain nss:host nspr zlib sqlite" +PKG_LONGDESC="The Network Security Services (NSS) package is a set of libraries designed to support cross-platform development of security-enabled client and server applications" +PKG_TOOLCHAIN="manual" +PKG_BUILD_FLAGS="-parallel" + +make_host() { + cd $PKG_BUILD/nss + + make clean || true + rm -rf $PKG_BUILD/dist + + INCLUDES="-I$TOOLCHAIN/include" \ + make BUILD_OPT=1 USE_64=1 \ + PREFIX=$TOOLCHAIN \ + NSPR_INCLUDE_DIR=$TOOLCHAIN/include/nspr \ + USE_SYSTEM_ZLIB=1 ZLIB_LIBS="-lz -L$TOOLCHAIN/lib" \ + SKIP_SHLIBSIGN=1 \ + NSS_TESTS="dummy" \ + CC=$CC LDFLAGS="$LDFLAGS -L$TOOLCHAIN/lib" \ + V=1 +} + +makeinstall_host() { + cd $PKG_BUILD + $STRIP dist/Linux*/lib/*.so + cp -L dist/Linux*/lib/*.so $TOOLCHAIN/lib + cp -L dist/Linux*/lib/libcrmf.a $TOOLCHAIN/lib + mkdir -p $TOOLCHAIN/include/nss + cp -RL dist/{public,private}/nss/* $TOOLCHAIN/include/nss + cp -L dist/Linux*/lib/pkgconfig/nss.pc $TOOLCHAIN/lib/pkgconfig + cp -L nss/coreconf/nsinstall/*/nsinstall $TOOLCHAIN/bin +} + +make_target() { + cd $PKG_BUILD/nss + + local TARGET_USE_64="" + [ "$TARGET_ARCH" = "x86_64" -o "$TARGET_ARCH" = "aarch64" ] && TARGET_USE_64="USE_64=1" + + make clean || true + rm -rf $PKG_BUILD/dist + + make BUILD_OPT=1 $TARGET_USE_64 \ + NSS_USE_SYSTEM_SQLITE=1 \ + NSPR_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include/nspr \ + NSS_USE_SYSTEM_SQLITE=1 \ + USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz \ + SKIP_SHLIBSIGN=1 \ + OS_TEST=$TARGET_ARCH \ + NSS_TESTS="dummy" \ + NSINSTALL=$TOOLCHAIN/bin/nsinstall \ + CPU_ARCH_TAG=$TARGET_ARCH \ + CC=$CC \ + LDFLAGS="$LDFLAGS -L$SYSROOT_PREFIX/usr/lib" \ + V=1 +} + +makeinstall_target() { + cd $PKG_BUILD + $STRIP dist/Linux*/lib/*.so + cp -L dist/Linux*/lib/*.so $SYSROOT_PREFIX/usr/lib + cp -L dist/Linux*/lib/libcrmf.a $SYSROOT_PREFIX/usr/lib + mkdir -p $SYSROOT_PREFIX/usr/include/nss + cp -RL dist/{public,private}/nss/* $SYSROOT_PREFIX/usr/include/nss + cp -L dist/Linux*/lib/pkgconfig/nss.pc $SYSROOT_PREFIX/usr/lib/pkgconfig + + mkdir -p .install_pkg/usr/lib + cp -PL dist/Linux*/lib/*.so .install_pkg/usr/lib +} diff --git a/packages/addons/addon-depends/nss/patches/nss-02_3.15.5-standalone-1.patch b/packages/security/nss/patches/nss-02_3.15.5-standalone-1.patch similarity index 97% rename from packages/addons/addon-depends/nss/patches/nss-02_3.15.5-standalone-1.patch rename to packages/security/nss/patches/nss-02_3.15.5-standalone-1.patch index 815e634fa7..b82c25d0d8 100644 --- a/packages/addons/addon-depends/nss/patches/nss-02_3.15.5-standalone-1.patch +++ b/packages/security/nss/patches/nss-02_3.15.5-standalone-1.patch @@ -222,12 +222,12 @@ Description: Adds auto-generated nss.pc and nss-config script, and a + --- a/nss/Makefile 2013-05-28 23:43:24.000000000 +0200 +++ b/nss/Makefile 2013-07-02 14:52:58.328084334 +0200 -@@ -44,7 +44,7 @@ +@@ -46,7 +46,7 @@ # (7) Execute "local" rules. (OPTIONAL). # ####################################################################### --nss_build_all: build_nspr all -+nss_build_all: all +-nss_build_all: build_nspr all latest ++nss_build_all: all latest nss_clean_all: clobber_nspr clobber @@ -237,5 +237,5 @@ Description: Adds auto-generated nss.pc and nss-config script, and a RELEASE = nss --DIRS = coreconf lib cmd external_tests +-DIRS = coreconf lib cmd cpputil gtests +DIRS = coreconf lib cmd config diff --git a/packages/security/nss/patches/nss-04-skip_shlibsign.patch b/packages/security/nss/patches/nss-04-skip_shlibsign.patch new file mode 100644 index 0000000000..dfee7cd0ed --- /dev/null +++ b/packages/security/nss/patches/nss-04-skip_shlibsign.patch @@ -0,0 +1,12 @@ +diff -Naur nss-3.29.5.orig/nss/cmd/shlibsign/Makefile nss-3.29.5/nss/cmd/shlibsign/Makefile +--- nss-3.29.5.orig/nss/cmd/shlibsign/Makefile 2017-09-08 10:56:01.663876686 +0200 ++++ nss-3.29.5/nss/cmd/shlibsign/Makefile 2017-09-08 10:57:19.659306831 +0200 +@@ -95,5 +95,7 @@ + endif + endif + +-libs install :: $(CHECKLOC) ++ifndef SKIP_SHLIBSIGN ++ libs install :: $(CHECKLOC) ++endif + diff --git a/packages/security/nss/patches/nss-05-disable_host_cflags.patch b/packages/security/nss/patches/nss-05-disable_host_cflags.patch new file mode 100644 index 0000000000..67fb94c3cc --- /dev/null +++ b/packages/security/nss/patches/nss-05-disable_host_cflags.patch @@ -0,0 +1,12 @@ +diff -Naur nss-3.29.5.orig/nspr/config/autoconf.mk.in nss-3.29.5/nspr/config/autoconf.mk.in +--- nss-3.29.5.orig/nspr/config/autoconf.mk.in 2017-09-08 11:03:27.572619156 +0200 ++++ nss-3.29.5/nspr/config/autoconf.mk.in 2017-09-08 11:03:41.100520343 +0200 +@@ -104,7 +104,7 @@ + RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@ + + HOST_CC = @HOST_CC@ +-HOST_CFLAGS = @HOST_CFLAGS@ ++#HOST_CFLAGS = @HOST_CFLAGS@ + HOST_LDFLAGS = @HOST_LDFLAGS@ + + DEFINES = @DEFINES@ @DEFS@ diff --git a/packages/security/nss/patches/nss-06-always-include-fstar.patch b/packages/security/nss/patches/nss-06-always-include-fstar.patch new file mode 100644 index 0000000000..3490e6f3f8 --- /dev/null +++ b/packages/security/nss/patches/nss-06-always-include-fstar.patch @@ -0,0 +1,20 @@ +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile +index e6a94d35c..0c714c85c 100644 +--- a/nss/lib/freebl/Makefile ++++ b/nss/lib/freebl/Makefile +@@ -535,12 +535,14 @@ ifeq (,$(filter-out i386 x386 x86 x86_64 aarch64,$(CPU_ARCH))) + # All intel architectures get the 64 bit version + # With custom uint128 if necessary (faster than generic 32 bit version). + ECL_SRCS += curve25519_64.c +- VERIFIED_SRCS += Hacl_Curve25519.c FStar.c ++ VERIFIED_SRCS += Hacl_Curve25519.c + else + # All non intel architectures get the generic 32 bit implementation (slow!) + ECL_SRCS += curve25519_32.c + endif + ++VERIFIED_SRCS += FStar.c ++ + ####################################################################### + # (5) Execute "global" rules. (OPTIONAL) # + ####################################################################### diff --git a/packages/security/openssl/cert/cacert.pem b/packages/security/openssl/cert/cacert.pem new file mode 100644 index 0000000000..d474916d57 --- /dev/null +++ b/packages/security/openssl/cert/cacert.pem @@ -0,0 +1,3314 @@ +## +## Bundle of CA Root Certificates +## +## Certificate data from Mozilla as of: Sat Sep 15 08:29:09 2018 GMT +## +## This is a bundle of X.509 certificates of public Certificate Authorities +## (CA). These were automatically extracted from Mozilla's root certificates +## file (certdata.txt). This file can be found in the mozilla source tree: +## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt +## +## It contains the certificates in PEM format and therefore +## can be directly used with curl / libcurl / php_curl, or with +## an Apache+mod_ssl webserver for SSL client authentication. +## Just configure this file as the SSLCACertificateFile. +## +## Conversion done with mk-ca-bundle.pl version 1.27. +## SHA256: c80f571d9f4ebca4a91e0ad3a546f263153d71afffc845c6f8f52ce9d1a2e8ec +## + + +GlobalSign Root CA +================== +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx +GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds +b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV +BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD +VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa +DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc +THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb +Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP +c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX +gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF +AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj +Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG +j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH +hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC +X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== +-----END CERTIFICATE----- + +GlobalSign Root CA - R2 +======================= +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv +YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh +bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT +aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln +bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6 +ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp +s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN +S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL +TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C +ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i +YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN +BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp +9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu +01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7 +9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 +TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G3 +============================================================ +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV +UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy +dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1 +EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc +cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw +EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj +055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA +ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f +j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC +/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0 +xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa +t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== +-----END CERTIFICATE----- + +Entrust.net Premium 2048 Secure Server CA +========================================= +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u +ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp +bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV +BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx +NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3 +d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl +MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u +ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL +Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr +hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW +nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi +VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ +KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy +T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf +zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT +J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e +nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE= +-----END CERTIFICATE----- + +Baltimore CyberTrust Root +========================= +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE +ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li +ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC +SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs +dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME +uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB +UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C +G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9 +XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr +l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI +VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB +BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh +cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5 +hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa +Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H +RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + +AddTrust External Root +====================== +-----BEGIN CERTIFICATE----- +MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD +VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw +NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU +cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg +Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821 ++iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw +Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo +aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy +2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7 +7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P +BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL +VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk +VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB +IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl +j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 +6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355 +e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u +G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= +-----END CERTIFICATE----- + +Entrust Root Certification Authority +==================================== +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV +BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw +b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG +A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0 +MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu +MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu +Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v +dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz +A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww +Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68 +j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN +rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw +DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1 +MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH +hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM +Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa +v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS +W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0 +tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- + +GeoTrust Global CA +================== +-----BEGIN CERTIFICATE----- +MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK +Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw +MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j +LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo +BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet +8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc +T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU +vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk +DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q +zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4 +d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2 +mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p +XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm +Mw== +-----END CERTIFICATE----- + +GeoTrust Universal CA +===================== +-----BEGIN CERTIFICATE----- +MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN +R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1 +MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu +Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t +JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e +RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs +7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d +8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V +qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga +Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB +Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu +KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08 +ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0 +XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB +hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc +aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2 +qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL +oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK +xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF +KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2 +DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK +xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU +p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI +P/rmMuGNG2+k5o7Y+SlIis5z/iw= +-----END CERTIFICATE----- + +GeoTrust Universal CA 2 +======================= +-----BEGIN CERTIFICATE----- +MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN +R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0 +MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg +SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0 +DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17 +j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q +JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a +QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2 +WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP +20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn +ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC +SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG +8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2 ++/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E +BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z +dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ +4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+ +mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq +A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg +Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP +pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d +FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp +gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm +X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS +-----END CERTIFICATE----- + +Visa eCommerce Root +=================== +-----BEGIN CERTIFICATE----- +MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG +EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug +QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2 +WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm +VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv +bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL +F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b +RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0 +TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI +/k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs +GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG +MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc +CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW +YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz +zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu +YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt +398znM/jra6O1I7mT1GvFpLgXPYHDw== +-----END CERTIFICATE----- + +Comodo AAA Services root +======================== +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS +R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg +TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw +MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl +c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV +BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG +C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs +i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW +Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH +Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK +Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f +BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl +cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz +LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm +7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z +8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C +12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + +QuoVadis Root CA +================ +-----BEGIN CERTIFICATE----- +MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE +ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz +MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp +cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD +EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk +J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL +F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL +YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen +AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w +PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y +ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7 +MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj +YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs +ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh +Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW +Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu +BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw +FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6 +tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo +fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul +LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x +gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi +5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi +5nrQNiOKSnQ2+Q== +-----END CERTIFICATE----- + +QuoVadis Root CA 2 +================== +-----BEGIN CERTIFICATE----- +MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT +EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx +ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC +DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6 +XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk +lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB +lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy +lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt +66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn +wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh +D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy +BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie +J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud +DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU +a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT +ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv +Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3 +UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm +VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK ++JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW +IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1 +WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X +f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II +4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8 +VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u +-----END CERTIFICATE----- + +QuoVadis Root CA 3 +================== +-----BEGIN CERTIFICATE----- +MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT +EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx +OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC +DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg +DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij +KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K +DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv +BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp +p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8 +nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX +MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM +Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz +uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT +BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj +YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 +aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB +BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD +VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4 +ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE +AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV +qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s +hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z +POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2 +Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp +8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC +bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu +g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p +vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr +qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto= +-----END CERTIFICATE----- + +Security Communication Root CA +============================== +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP +U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw +HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP +U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw +8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM +DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX +5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd +DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2 +JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw +DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g +0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a +mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ +s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ +6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi +FL39vmwLAw== +-----END CERTIFICATE----- + +Sonera Class 2 Root CA +====================== +-----BEGIN CERTIFICATE----- +MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG +U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw +NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh +IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3 +/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT +dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG +f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P +tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH +nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT +XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt +0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI +cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph +Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx +EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH +llpwrN9M +-----END CERTIFICATE----- + +XRamp Global CA Root +==================== +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE +BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj +dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx +HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg +U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu +IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx +foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE +zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs +AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry +xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap +oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC +AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc +/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n +nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz +8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + +Go Daddy Class 2 CA +=================== +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY +VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG +A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g +RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD +ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv +2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32 +qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j +YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY +vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O +BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o +atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu +MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG +A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim +PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt +I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI +Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b +vZ8= +-----END CERTIFICATE----- + +Starfield Class 2 CA +==================== +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc +U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo +MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG +A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG +SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY +bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ +JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm +epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN +F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF +MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f +hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo +bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs +afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM +PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD +KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3 +QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + +Taiwan GRCA +=========== +-----BEGIN CERTIFICATE----- +MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG +EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X +DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv +dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN +w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5 +BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O +1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO +htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov +J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7 +Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t +B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB +O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8 +lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV +HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2 +09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ +TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj +Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2 +Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU +D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz +DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk +Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk +7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ +CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy ++fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS +-----END CERTIFICATE----- + +DigiCert Assured ID Root CA +=========================== +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw +IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx +MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL +ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO +9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy +UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW +/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy +oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf +GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF +66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq +hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc +EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn +SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i +8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- + +DigiCert Global Root CA +======================= +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw +HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw +MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3 +dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn +TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5 +BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H +4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y +7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB +o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm +8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF +BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr +EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt +tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886 +UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- + +DigiCert High Assurance EV Root CA +================================== +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw +KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw +MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ +MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu +Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t +Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS +OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3 +MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ +NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe +h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB +Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY +JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ +V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp +myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK +mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K +-----END CERTIFICATE----- + +Certplus Class 2 Primary CA +=========================== +-----BEGIN CERTIFICATE----- +MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE +BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN +OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy +dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR +5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ +Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO +YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e +e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME +CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ +YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t +L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD +P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R +TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+ +7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW +//1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 +l7+ijrRU +-----END CERTIFICATE----- + +DST Root CA X3 +============== +-----BEGIN CERTIFICATE----- +MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK +ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X +DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1 +cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT +rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9 +UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy +xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d +utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ +MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug +dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE +GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw +RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS +fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ +-----END CERTIFICATE----- + +SwissSign Gold CA - G2 +====================== +-----BEGIN CERTIFICATE----- +MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw +EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN +MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp +c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq +t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C +jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg +vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF +ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR +AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend +jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO +peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR +7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi +GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64 +OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov +L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm +5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr +44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf +Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m +Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp +mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk +vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf +KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br +NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj +viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ +-----END CERTIFICATE----- + +SwissSign Silver CA - G2 +======================== +-----BEGIN CERTIFICATE----- +MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT +BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X +DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3 +aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG +9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644 +N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm ++/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH +6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu +MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h +qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5 +FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs +ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc +celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X +CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB +tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 +cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P +4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F +kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L +3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx +/uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa +DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP +e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu +WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ +DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub +DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority +======================================== +-----BEGIN CERTIFICATE----- +MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG +EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx +CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ +cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN +b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9 +nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge +RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt +tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI +hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K +Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN +NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa +Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG +1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= +-----END CERTIFICATE----- + +thawte Primary Root CA +====================== +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE +BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2 +aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3 +MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg +SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv +KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT +FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs +oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ +1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc +q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K +aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p +afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF +AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE +uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX +xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89 +jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH +z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA== +-----END CERTIFICATE----- + +VeriSign Class 3 Public Primary Certification Authority - G5 +============================================================ +-----BEGIN CERTIFICATE----- +MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE +BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO +ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk +IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB +yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln +biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh +dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz +j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD +Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/ +Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r +fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/ +BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv +Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy +aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG +SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+ +X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE +KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC +Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE +ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq +-----END CERTIFICATE----- + +SecureTrust CA +============== +-----BEGIN CERTIFICATE----- +MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG +EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy +dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe +BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX +OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t +DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH +GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b +01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH +ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj +aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ +KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu +SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf +mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ +nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR +3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= +-----END CERTIFICATE----- + +Secure Global CA +================ +-----BEGIN CERTIFICATE----- +MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG +EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH +bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg +MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg +Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx +YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ +bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g +8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV +HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi +0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn +oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA +MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+ +OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn +CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5 +3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc +f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW +-----END CERTIFICATE----- + +COMODO Certification Authority +============================== +-----BEGIN CERTIFICATE----- +MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE +BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG +A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1 +dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb +MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD +T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH ++7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww +xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV +4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA +1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI +rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k +b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC +AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP +OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ +RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc +IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN ++8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ== +-----END CERTIFICATE----- + +Network Solutions Certificate Authority +======================================= +-----BEGIN CERTIFICATE----- +MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG +EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr +IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx +MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu +MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx +jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT +aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT +crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc +/Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB +AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv +bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA +A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q +4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/ +GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv +wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD +ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey +-----END CERTIFICATE----- + +COMODO ECC Certification Authority +================================== +-----BEGIN CERTIFICATE----- +MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC +R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE +ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix +GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR +Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo +b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X +4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni +wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG +FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA +U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= +-----END CERTIFICATE----- + +OISTE WISeKey Global Root GA CA +=============================== +-----BEGIN CERTIFICATE----- +MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE +BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG +A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH +bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD +VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw +IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5 +IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9 +Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg +Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD +d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ +/yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R +LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ +KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm +MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4 ++vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa +hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY +okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0= +-----END CERTIFICATE----- + +Certigna +======== +-----BEGIN CERTIFICATE----- +MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw +EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3 +MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI +Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q +XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH +GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p +ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg +DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf +Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ +tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ +BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J +SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA +hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+ +ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu +PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY +1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw +WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== +-----END CERTIFICATE----- + +Deutsche Telekom Root CA 2 +========================== +-----BEGIN CERTIFICATE----- +MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT +RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG +A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5 +MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G +A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS +b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5 +bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI +KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY +AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK +Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV +jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV +HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr +E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy +zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8 +rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G +dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU +Cm26OWMohpLzGITY+9HPBVZkVw== +-----END CERTIFICATE----- + +Cybertrust Global Root +====================== +-----BEGIN CERTIFICATE----- +MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li +ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4 +MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD +ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA ++Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW +0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL +AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin +89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT +8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2 +MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G +A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO +lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi +5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2 +hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T +X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW +WL1WMRJOEcgh4LMRkWXbtKaIOM5V +-----END CERTIFICATE----- + +ePKI Root Certification Authority +================================= +-----BEGIN CERTIFICATE----- +MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG +EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg +Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx +MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq +MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs +IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi +lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv +qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX +12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O +WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+ +ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao +lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/ +vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi +Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi +MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH +ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0 +1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq +KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV +xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP +NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r +GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE +xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx +gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy +sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD +BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw= +-----END CERTIFICATE----- + +certSIGN ROOT CA +================ +-----BEGIN CERTIFICATE----- +MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD +VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa +Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE +CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I +JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH +rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2 +ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD +0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943 +AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B +Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB +AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8 +SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0 +x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt +vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz +TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority - G3 +============================================= +-----BEGIN CERTIFICATE----- +MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE +BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0 +IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy +eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz +NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo +YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT +LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j +K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE +c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C +IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu +dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr +2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9 +cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE +Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD +AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s +t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt +-----END CERTIFICATE----- + +thawte Primary Root CA - G2 +=========================== +-----BEGIN CERTIFICATE----- +MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC +VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu +IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg +Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV +MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG +b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt +IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS +LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5 +8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU +mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN +G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K +rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg== +-----END CERTIFICATE----- + +thawte Primary Root CA - G3 +=========================== +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE +BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2 +aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w +ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh +d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD +VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG +A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At +P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC ++BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY +7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW +vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ +KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK +A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu +t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC +8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm +er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A= +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority - G2 +============================================= +-----BEGIN CERTIFICATE----- +MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu +Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1 +OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg +MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl +b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG +BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc +KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD +VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+ +EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m +ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2 +npaqBA+K +-----END CERTIFICATE----- + +VeriSign Universal Root Certification Authority +=============================================== +-----BEGIN CERTIFICATE----- +MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE +BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO +ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk +IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u +IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV +UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj +1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP +MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72 +9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I +AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR +tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G +CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O +a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud +DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3 +Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx +Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx +P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P +wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4 +mJO37M2CYfE45k+XmCpajQ== +-----END CERTIFICATE----- + +VeriSign Class 3 Public Primary Certification Authority - G4 +============================================================ +-----BEGIN CERTIFICATE----- +MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC +VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3 +b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz +ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL +MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU +cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo +b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5 +IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8 +Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz +rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw +HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u +Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD +A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx +AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== +-----END CERTIFICATE----- + +NetLock Arany (Class Gold) FÅ‘tanúsítvány +======================================== +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G +A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610 +dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB +cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx +MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO +ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6 +c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu +0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw +/HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk +H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw +fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1 +neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW +qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta +YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC +bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna +NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu +dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA - G2 +================================== +-----BEGIN CERTIFICATE----- +MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC +TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l +ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ +5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn +vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj +CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil +e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR +OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI +CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65 +48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi +trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737 +qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB +AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC +ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV +HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA +A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz ++51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj +f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN +kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk +CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF +URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb +CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h +oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV +IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm +66+KAQ== +-----END CERTIFICATE----- + +Hongkong Post Root CA 1 +======================= +-----BEGIN CERTIFICATE----- +MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT +DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx +NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n +IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1 +ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr +auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh +qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY +V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV +HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i +h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio +l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei +IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps +T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT +c4afU9hDDl3WY4JxHYB0yvbiAmvZWg== +-----END CERTIFICATE----- + +SecureSign RootCA11 +=================== +-----BEGIN CERTIFICATE----- +MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi +SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS +b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw +KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1 +cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL +TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO +wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq +g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP +O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA +bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX +t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh +OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r +bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ +Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01 +y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061 +lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I= +-----END CERTIFICATE----- + +Microsec e-Szigno Root CA 2009 +============================== +-----BEGIN CERTIFICATE----- +MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER +MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv +c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o +dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE +BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt +U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA +fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG +0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA +pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm +1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC +AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf +QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE +FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o +lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX +I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 +tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02 +yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi +LXpUq3DDfSJlgnCW +-----END CERTIFICATE----- + +GlobalSign Root CA - R3 +======================= +-----BEGIN CERTIFICATE----- +MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv +YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh +bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT +aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln +bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt +iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ +0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3 +rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl +OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2 +xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7 +lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8 +EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E +bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18 +YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r +kpeDMdmztcpHWD9f +-----END CERTIFICATE----- + +Autoridad de Certificacion Firmaprofesional CIF A62634068 +========================================================= +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA +BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2 +MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw +QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB +NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD +Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P +B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY +7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH +ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI +plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX +MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX +LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK +bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU +vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud +EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH +DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp +cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA +bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx +ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx +51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk +R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP +T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f +Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl +osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR +crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR +saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD +KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi +6Et8Vcad+qMUu2WFbm5PEn4KPJ2V +-----END CERTIFICATE----- + +Izenpe.com +========== +-----BEGIN CERTIFICATE----- +MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG +EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz +MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu +QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ +03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK +ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU ++zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC +PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT +OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK +F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK +0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+ +0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB +leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID +AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+ +SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG +NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx +MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O +BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l +Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga +kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q +hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs +g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5 +aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5 +nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC +ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo +Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z +WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== +-----END CERTIFICATE----- + +Chambers of Commerce Root - 2008 +================================ +-----BEGIN CERTIFICATE----- +MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD +MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv +bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu +QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy +Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl +ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF +EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl +cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA +XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj +h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/ +ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk +NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g +D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331 +lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ +0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj +ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2 +EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI +G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ +BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh +bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh +bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC +CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH +AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1 +wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH +3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU +RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6 +M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1 +YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF +9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK +zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG +nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg +OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ +-----END CERTIFICATE----- + +Global Chambersign Root - 2008 +============================== +-----BEGIN CERTIFICATE----- +MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD +MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv +bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu +QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx +NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg +Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ +QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD +aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf +VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf +XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0 +ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB +/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA +TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M +H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe +Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF +HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh +wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB +AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT +BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE +BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm +aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm +aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp +1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0 +dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG +/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6 +ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s +dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg +9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH +foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du +qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr +P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq +c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z +09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B +-----END CERTIFICATE----- + +Go Daddy Root Certificate Authority - G2 +======================================== +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT +B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu +MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 +MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 +b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G +A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq +9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD ++qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd +fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl +NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9 +BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac +vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r +5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV +N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO +LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1 +-----END CERTIFICATE----- + +Starfield Root Certificate Authority - G2 +========================================= +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT +B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s +b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0 +eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw +DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg +VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB +dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv +W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs +bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk +N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf +ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU +JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol +TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx +4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw +F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K +pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ +c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 +-----END CERTIFICATE----- + +Starfield Services Root Certificate Authority - G2 +================================================== +-----BEGIN CERTIFICATE----- +MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT +B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s +b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl +IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV +BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT +dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg +Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2 +h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa +hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP +LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB +rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw +AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG +SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP +E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy +xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd +iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza +YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6 +-----END CERTIFICATE----- + +AffirmTrust Commercial +====================== +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS +BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw +MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly +bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb +DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV +C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6 +BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww +MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV +HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG +hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi +qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv +0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh +sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= +-----END CERTIFICATE----- + +AffirmTrust Networking +====================== +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS +BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw +MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly +bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE +Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI +dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24 +/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb +h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV +HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu +UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6 +12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23 +WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9 +/ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= +-----END CERTIFICATE----- + +AffirmTrust Premium +=================== +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS +BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy +OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy +dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn +BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV +5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs ++7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd +GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R +p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI +S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04 +6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5 +/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo ++Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv +MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg +Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC +6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S +L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK ++4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV +BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg +IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60 +g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb +zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw== +-----END CERTIFICATE----- + +AffirmTrust Premium ECC +======================= +-----BEGIN CERTIFICATE----- +MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV +BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx +MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U +cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ +N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW +BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK +BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X +57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM +eQ== +-----END CERTIFICATE----- + +Certum Trusted Network CA +========================= +-----BEGIN CERTIFICATE----- +MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK +ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy +MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU +ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC +l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J +J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4 +fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0 +cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB +Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw +DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj +jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1 +mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj +Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI +03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= +-----END CERTIFICATE----- + +TWCA Root Certification Authority +================================= +-----BEGIN CERTIFICATE----- +MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ +VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG +EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB +IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx +QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC +oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP +4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r +y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB +BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG +9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC +mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW +QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY +T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny +Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== +-----END CERTIFICATE----- + +Security Communication RootCA2 +============================== +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc +U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh +dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC +SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy +aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++ ++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R +3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV +spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K +EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8 +QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB +CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj +u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk +3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q +tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29 +mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 +-----END CERTIFICATE----- + +EC-ACC +====== +-----BEGIN CERTIFICATE----- +MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE +BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w +ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD +VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE +CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT +BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7 +MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt +SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl +Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh +cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK +w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT +ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4 +HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a +E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw +0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD +VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0 +Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l +dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ +lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa +Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe +l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2 +E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D +5EI= +-----END CERTIFICATE----- + +Hellenic Academic and Research Institutions RootCA 2011 +======================================================= +-----BEGIN CERTIFICATE----- +MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT +O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y +aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z +IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT +AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z +IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo +IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI +1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa +71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u +8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH +3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/ +MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8 +MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu +b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt +XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8 +TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD +/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N +7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4 +-----END CERTIFICATE----- + +Actalis Authentication Root CA +============================== +-----BEGIN CERTIFICATE----- +MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM +BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE +AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky +MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz +IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 +IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ +wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa +by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6 +zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f +YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2 +oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l +EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7 +hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8 +EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5 +jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY +iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt +ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI +WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0 +JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx +K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+ +Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC +4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo +2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz +lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem +OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9 +vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== +-----END CERTIFICATE----- + +Trustis FPS Root CA +=================== +-----BEGIN CERTIFICATE----- +MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG +EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290 +IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV +BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ +RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk +H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa +cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt +o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA +AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd +BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c +GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC +yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P +8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV +l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl +iB6XzCGcKQENZetX2fNXlrtIzYE= +-----END CERTIFICATE----- + +Buypass Class 2 Root CA +======================= +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU +QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X +DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1 +eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1 +g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn +9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b +/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU +CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff +awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI +zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn +Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX +Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs +M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD +VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF +AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s +A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI +osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S +aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd +DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD +LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0 +oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC +wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS +CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN +rJgWVqA= +-----END CERTIFICATE----- + +Buypass Class 3 Root CA +======================= +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU +QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X +DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1 +eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH +sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR +5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh +7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ +ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH +2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV +/afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ +RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA +Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq +j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD +VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF +AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV +cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G +uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG +Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8 +ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2 +KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz +6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug +UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe +eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi +Cp/HuZc= +-----END CERTIFICATE----- + +T-TeleSec GlobalRoot Class 3 +============================ +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM +IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU +cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx +MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz +dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD +ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK +9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU +NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF +iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W +0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr +AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb +fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT +ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h +P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml +e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw== +-----END CERTIFICATE----- + +EE Certification Centre Root CA +=============================== +-----BEGIN CERTIFICATE----- +MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG +EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy +dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw +MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB +UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy +ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM +TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2 +rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw +93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN +P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ +MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF +BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj +xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM +lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u +uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU +3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM +dcGWxZ0= +-----END CERTIFICATE----- + +D-TRUST Root Class 3 CA 2 2009 +============================== +-----BEGIN CERTIFICATE----- +MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK +DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe +Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE +LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD +ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA +BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv +KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z +p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC +AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ +4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y +eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw +MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G +PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw +OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm +2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 +o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV +dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph +X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I= +-----END CERTIFICATE----- + +D-TRUST Root Class 3 CA 2 EV 2009 +================================= +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK +DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw +OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK +DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw +OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS +egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh +zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T +7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60 +sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35 +11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv +cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v +ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El +MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp +b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh +c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+ +PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 +nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX +ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA +NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv +w9y4AyHqnxbxLFS1 +-----END CERTIFICATE----- + +CA Disig Root R2 +================ +-----BEGIN CERTIFICATE----- +MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw +EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp +ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx +EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp +c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC +w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia +xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7 +A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S +GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV +g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa +5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE +koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A +Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i +Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u +Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM +tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV +sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je +dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8 +1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx +mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01 +utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0 +sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg +UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV +7+ZtsH8tZ/3zbBt1RqPlShfppNcL +-----END CERTIFICATE----- + +ACCVRAIZ1 +========= +-----BEGIN CERTIFICATE----- +MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB +SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1 +MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH +UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC +DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM +jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0 +RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD +aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ +0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG +WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7 +8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR +5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J +9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK +Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw +Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu +Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 +VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM +Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA +QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh +AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA +YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj +AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA +IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk +aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0 +dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2 +MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI +hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E +R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN +YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49 +nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ +TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3 +sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h +I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg +Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd +3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p +EfbRD0tVNEYqi4Y7 +-----END CERTIFICATE----- + +TWCA Global Root CA +=================== +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT +CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD +QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK +EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg +Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C +nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV +r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR +Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV +tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W +KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99 +sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p +yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn +kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI +zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC +AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g +cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn +LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M +8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg +/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg +lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP +A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m +i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8 +EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3 +zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0= +-----END CERTIFICATE----- + +TeliaSonera Root CA v1 +====================== +-----BEGIN CERTIFICATE----- +MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE +CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4 +MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW +VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+ +6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA +3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k +B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn +Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH +oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3 +F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ +oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7 +gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc +TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB +AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW +DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm +zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx +0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW +pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV +G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc +c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT +JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2 +qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6 +Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems +WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= +-----END CERTIFICATE----- + +E-Tugra Certification Authority +=============================== +-----BEGIN CERTIFICATE----- +MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w +DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls +ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN +ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw +NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx +QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl +cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD +DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd +hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K +CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g +ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ +BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0 +E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz +rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq +jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn +rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5 +dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB +/wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG +MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK +kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO +XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807 +VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo +a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc +dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV +KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT +Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0 +8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G +C7TbO6Orb1wdtn7os4I07QZcJA== +-----END CERTIFICATE----- + +T-TeleSec GlobalRoot Class 2 +============================ +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM +IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU +cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx +MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz +dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD +ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ +SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F +vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970 +2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV +WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy +YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4 +r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf +vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR +3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN +9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg== +-----END CERTIFICATE----- + +Atos TrustedRoot 2011 +===================== +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU +cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4 +MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG +A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV +hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr +54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+ +DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320 +HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR +z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R +l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ +bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB +CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h +k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh +TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9 +61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G +3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed +-----END CERTIFICATE----- + +QuoVadis Root CA 1 G3 +===================== +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG +A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv +b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN +MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg +RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE +PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm +PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6 +Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN +ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l +g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV +7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX +9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f +iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg +t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI +hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC +MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3 +GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct +Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP ++V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh +3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa +wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6 +O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0 +FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV +hMJKzRwuJIczYOXD +-----END CERTIFICATE----- + +QuoVadis Root CA 2 G3 +===================== +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG +A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv +b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN +MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg +RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh +ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY +NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t +oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o +MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l +V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo +L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ +sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD +6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh +lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI +hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 +AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K +pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9 +x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz +dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X +U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw +mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD +zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN +JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr +O3jtZsSOeWmD3n+M +-----END CERTIFICATE----- + +QuoVadis Root CA 3 G3 +===================== +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG +A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv +b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN +MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg +RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286 +IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL +Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe +6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3 +I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U +VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7 +5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi +Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM +dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt +rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI +hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px +KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS +t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ +TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du +DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib +Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD +hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX +0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW +dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2 +PpxxVJkES/1Y+Zj0 +-----END CERTIFICATE----- + +DigiCert Assured ID Root G2 +=========================== +-----BEGIN CERTIFICATE----- +MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw +IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw +MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL +ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH +35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq +bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw +VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP +YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn +lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO +w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv +0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz +d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW +hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M +jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo +IhNzbM8m9Yop5w== +-----END CERTIFICATE----- + +DigiCert Assured ID Root G3 +=========================== +-----BEGIN CERTIFICATE----- +MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD +VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1 +MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ +BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb +RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs +KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF +UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy +YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy +1vUhZscv6pZjamVFkpUBtA== +-----END CERTIFICATE----- + +DigiCert Global Root G2 +======================= +-----BEGIN CERTIFICATE----- +MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw +HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx +MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3 +dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ +kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO +3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV +BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM +UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB +o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu +5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr +F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U +WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH +QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/ +iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl +MrY= +-----END CERTIFICATE----- + +DigiCert Global Root G3 +======================= +-----BEGIN CERTIFICATE----- +MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD +VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw +MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k +aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C +AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O +YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp +Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y +3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34 +VOKa5Vt8sycX +-----END CERTIFICATE----- + +DigiCert Trusted Root G4 +======================== +-----BEGIN CERTIFICATE----- +MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw +HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1 +MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G +CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp +pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o +k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa +vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY +QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6 +MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm +mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7 +f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH +dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8 +oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud +DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD +ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY +ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr +yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy +7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah +ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN +5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb +/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa +5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK +G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP +82Z+ +-----END CERTIFICATE----- + +COMODO RSA Certification Authority +================================== +-----BEGIN CERTIFICATE----- +MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE +BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG +A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC +R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE +ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn +dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ +FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+ +5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG +x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX +2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL +OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3 +sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C +GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5 +WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E +FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w +DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt +rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+ +nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg +tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW +sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp +pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA +zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq +ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52 +7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I +LaZRfyHBNVOFBkpdn627G190 +-----END CERTIFICATE----- + +USERTrust RSA Certification Authority +===================================== +-----BEGIN CERTIFICATE----- +MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK +ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK +ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz +0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j +Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn +RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O ++T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq +/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE +Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM +lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8 +yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+ +eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd +BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW +FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ +7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ +Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM +8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi +FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi +yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c +J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw +sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx +Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9 +-----END CERTIFICATE----- + +USERTrust ECC Certification Authority +===================================== +-----BEGIN CERTIFICATE----- +MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC +VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC +VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2 +0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez +nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV +HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB +HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu +9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= +-----END CERTIFICATE----- + +GlobalSign ECC Root CA - R4 +=========================== +-----BEGIN CERTIFICATE----- +MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl +OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P +AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV +MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF +JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q= +-----END CERTIFICATE----- + +GlobalSign ECC Root CA - R5 +=========================== +-----BEGIN CERTIFICATE----- +MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb +R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD +EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6 +SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS +h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd +BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx +uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7 +yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3 +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA - G3 +================================== +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC +TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l +ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y +olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t +x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy +EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K +Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur +mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5 +1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp +07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo +FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE +41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB +AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu +yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD +U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq +KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1 +v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA +8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b +8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r +mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq +1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI +JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV +tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk= +-----END CERTIFICATE----- + +Staat der Nederlanden EV Root CA +================================ +-----BEGIN CERTIFICATE----- +MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE +CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g +RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M +MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl +cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk +SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW +O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r +0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8 +Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV +XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr +08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV +0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd +74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx +fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa +ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI +eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu +c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq +5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN +b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN +f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi +5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4 +WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK +DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy +eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg== +-----END CERTIFICATE----- + +IdenTrust Commercial Root CA 1 +============================== +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG +EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS +b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES +MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB +IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld +hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/ +mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi +1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C +XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl +3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy +NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV +WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg +xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix +uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC +AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI +hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH +6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg +ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt +ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV +YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX +feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro +kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe +2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz +Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R +cGzM7vRX+Bi6hG6H +-----END CERTIFICATE----- + +IdenTrust Public Sector Root CA 1 +================================= +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG +EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv +ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV +UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS +b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy +P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6 +Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI +rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf +qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS +mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn +ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh +LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v +iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL +4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B +Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw +DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj +t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A +mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt +GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt +m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx +NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4 +Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI +ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC +ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ +3Wl9af0AVqW3rLatt8o+Ae+c +-----END CERTIFICATE----- + +Entrust Root Certification Authority - G2 +========================================= +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV +BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy +bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug +b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw +HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT +DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx +OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP +/vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz +HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU +s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y +TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx +AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6 +0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z +iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi +nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+ +vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO +e4pIb4tF9g== +-----END CERTIFICATE----- + +Entrust Root Certification Authority - EC1 +========================================== +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx +FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn +YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl +ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw +FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs +LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg +dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt +IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy +AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef +9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h +vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8 +kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- + +CFCA EV ROOT +============ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE +CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB +IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw +MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD +DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV +BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD +7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN +uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW +ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7 +xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f +py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K +gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol +hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ +tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf +BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB +/wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB +ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q +ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua +4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG +E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX +BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn +aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy +PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX +kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C +ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su +-----END CERTIFICATE----- + +Certinomis - Root CA +==================== +-----BEGIN CERTIFICATE----- +MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK +Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg +LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx +EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD +ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos +P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo +d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap +z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00 +8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x +RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE +6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t +FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV +PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH +i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj +YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I +6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF +AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV +WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw +Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX +lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ +y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9 +Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng +DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi +I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM +cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr +hkIGuUE= +-----END CERTIFICATE----- + +OISTE WISeKey Global Root GB CA +=============================== +-----BEGIN CERTIFICATE----- +MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG +EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl +ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw +MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD +VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds +b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX +scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP +rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk +9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o +Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg +GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI +hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD +dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0 +VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui +HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic +Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= +-----END CERTIFICATE----- + +SZAFIR ROOT CA2 +=============== +-----BEGIN CERTIFICATE----- +MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG +A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV +BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ +BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD +VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q +qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK +DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE +2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ +ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi +ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P +AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC +AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5 +O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67 +oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul +4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6 ++/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw== +-----END CERTIFICATE----- + +Certum Trusted Network CA 2 +=========================== +-----BEGIN CERTIFICATE----- +MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE +BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1 +bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y +ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ +TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB +IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9 +7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o +CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b +Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p +uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130 +GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ +9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB +Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye +hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM +BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI +hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW +Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA +L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo +clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM +pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb +w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo +J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm +ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX +is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7 +zAYspsbiDrW5viSP +-----END CERTIFICATE----- + +Hellenic Academic and Research Institutions RootCA 2015 +======================================================= +-----BEGIN CERTIFICATE----- +MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT +BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0 +aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl +YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx +MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg +QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV +BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw +MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv +bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh +iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+ +6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd +FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr +i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F +GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2 +fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu +iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc +Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI +hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+ +D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM +d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y +d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn +82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb +davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F +Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt +J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa +JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q +p/UsQu0yrbYhnr68 +-----END CERTIFICATE----- + +Hellenic Academic and Research Institutions ECC RootCA 2015 +=========================================================== +-----BEGIN CERTIFICATE----- +MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0 +aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u +cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj +aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw +MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj +IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD +VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290 +Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP +dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK +Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O +BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA +GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn +dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR +-----END CERTIFICATE----- + +Certplus Root CA G1 +=================== +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV +BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe +Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD +ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN +r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx +Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj +BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv +LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2 +z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc +4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd +4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj +jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+ +ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G +A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY +lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh +66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG +YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/ +2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F +6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX +CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe +tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC +VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/ ++mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+ +qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo= +-----END CERTIFICATE----- + +Certplus Root CA G2 +=================== +-----BEGIN CERTIFICATE----- +MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT +AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x +NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0 +cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA +BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN +Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD +AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud +IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV +HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl +vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw== +-----END CERTIFICATE----- + +OpenTrust Root CA G1 +==================== +-----BEGIN CERTIFICATE----- +MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx +MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM +CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa +Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87 +ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO +YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9 +xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO +9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq +3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi +n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9 +URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr +TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px +N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E +PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv +uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK +n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh +X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80 +nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm +GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/ +bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o +4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA +OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx +-----END CERTIFICATE----- + +OpenTrust Root CA G2 +==================== +-----BEGIN CERTIFICATE----- +MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy +MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM +CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+ +Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz +4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV +eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt +UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz +3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj +3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz +9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0 +0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT +y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59 +M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz +Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI +mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG +S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp +EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ +6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr +gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo +SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0 +YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm +u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK +-----END CERTIFICATE----- + +OpenTrust Root CA G3 +==================== +-----BEGIN CERTIFICATE----- +MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT +AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X +DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w +ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B +ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB +/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf +BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM +BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta +3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB +-----END CERTIFICATE----- + +ISRG Root X1 +============ +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE +BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD +EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG +EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT +DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r +Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1 +3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K +b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN +Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ +4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf +1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu +hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH +usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r +OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G +A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY +9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV +0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt +hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw +TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx +e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA +JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD +YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n +JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ +m+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- + +AC RAIZ FNMT-RCM +================ +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT +AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw +MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD +TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC +ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf +qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr +btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL +j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou +08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw +WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT +tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ +47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC +ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa +i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o +dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD +nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s +D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ +j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT +Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW ++YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7 +Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d +8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm +5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG +rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM= +-----END CERTIFICATE----- + +Amazon Root CA 1 +================ +-----BEGIN CERTIFICATE----- +MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD +VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1 +MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv +bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH +FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ +gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t +dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce +VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3 +DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM +CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy +8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa +2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2 +xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5 +-----END CERTIFICATE----- + +Amazon Root CA 2 +================ +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD +VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1 +MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv +bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC +ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4 +kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp +N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9 +AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd +fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx +kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS +btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0 +Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN +c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+ +3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw +DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA +A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY ++gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE +YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW +xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ +gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW +aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV +Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3 +KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi +JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw= +-----END CERTIFICATE----- + +Amazon Root CA 3 +================ +-----BEGIN CERTIFICATE----- +MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG +EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy +NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ +MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB +f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr +Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43 +rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc +eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw== +-----END CERTIFICATE----- + +Amazon Root CA 4 +================ +-----BEGIN CERTIFICATE----- +MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG +EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy +NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ +MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN +/sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri +83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV +HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA +MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1 +AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA== +-----END CERTIFICATE----- + +LuxTrust Global Root 2 +====================== +-----BEGIN CERTIFICATE----- +MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG +A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh +bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW +MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC +AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm +Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2 +xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC +wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm +1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm +FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF +wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/ +a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U +ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ +MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB +/zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5 +Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT ++Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ +FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN +H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW +7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu +ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA +VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR +TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt +/f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc +7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I +iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr +-----END CERTIFICATE----- + +TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 +============================================= +-----BEGIN CERTIFICATE----- +MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT +D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr +IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g +TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp +ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD +VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt +c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth +bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11 +IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8 +6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc +wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0 +3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9 +WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU +ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ +KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh +AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc +lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R +e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j +q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= +-----END CERTIFICATE----- + +GDCA TrustAUTH R5 ROOT +====================== +-----BEGIN CERTIFICATE----- +MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw +BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD +DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow +YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ +IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs +AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p +OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr +pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ +9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ +xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM +R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ +D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4 +oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx +9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg +p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9 +H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35 +6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd ++PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ +HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD +F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ +8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv +/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT +aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== +-----END CERTIFICATE----- + +TrustCor RootCert CA-1 +====================== +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP +MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig +U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp +dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx +MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu +YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe +VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy +dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq +jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4 +pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0 +JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h +gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw +/Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j +BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5 +mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf +ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C +qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P +3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk= +-----END CERTIFICATE----- + +TrustCor RootCert CA-2 +====================== +-----BEGIN CERTIFICATE----- +MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w +DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT +eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0 +eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy +MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h +bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U +cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0 +IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb +ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk +RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1 +oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb +XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1 +/p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q +jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP +eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg +rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh +8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU +2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD +VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h +Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp +kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv +2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3 +S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw +PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv +DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU +RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE +xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX +RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ +-----END CERTIFICATE----- + +TrustCor ECA-1 +============== +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP +MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig +U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp +dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw +N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5 +MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y +IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR +MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23 +xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc +p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+ +fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj +YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL +f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF +AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u +/ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F +hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs +J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC +jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g== +-----END CERTIFICATE----- + +SSL.com Root Certification Authority RSA +======================================== +-----BEGIN CERTIFICATE----- +MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM +BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x +MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw +MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx +EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM +LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C +Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8 +P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge +oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp +k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z +fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ +gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2 +UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8 +1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s +bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr +dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf +ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl +u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq +erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj +MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ +vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI +Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y +wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI +WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k= +-----END CERTIFICATE----- + +SSL.com Root Certification Authority ECC +======================================== +-----BEGIN CERTIFICATE----- +MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV +BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv +BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy +MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO +BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv +bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA +BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+ +8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR +hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT +jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW +e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z +5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl +-----END CERTIFICATE----- + +SSL.com EV Root Certification Authority RSA R2 +============================================== +-----BEGIN CERTIFICATE----- +MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w +DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u +MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy +MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI +DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD +VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh +hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w +cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO +Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+ +B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh +CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim +9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto +RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm +JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48 ++qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV +HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp +qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1 +++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx +Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G +guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz +OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7 +CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq +lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR +rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1 +hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX +9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== +-----END CERTIFICATE----- + +SSL.com EV Root Certification Authority ECC +=========================================== +-----BEGIN CERTIFICATE----- +MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV +BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy +BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw +MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx +EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM +LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy +3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O +BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe +5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ +N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm +m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== +-----END CERTIFICATE----- diff --git a/packages/security/openssl/package.mk b/packages/security/openssl/package.mk new file mode 100644 index 0000000000..9ff3df8e9f --- /dev/null +++ b/packages/security/openssl/package.mk @@ -0,0 +1,113 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="openssl" +PKG_VERSION="1.0.2q" +PKG_SHA256="5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684" +PKG_LICENSE="BSD" +PKG_SITE="https://www.openssl.org" +PKG_URL="https://www.openssl.org/source/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="ccache:host" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="The Open Source toolkit for Secure Sockets Layer and Transport Layer Security" +PKG_BUILD_FLAGS="-parallel" + +PKG_CONFIGURE_OPTS_SHARED="--libdir=lib \ + shared \ + threads \ + no-ec2m \ + no-gmp \ + no-jpake \ + no-krb5 \ + no-libunbound \ + no-md2 \ + no-rc5 \ + no-rfc3779 + no-sctp \ + no-ssl-trace \ + no-ssl2 \ + no-ssl3 \ + no-store \ + no-unit-test \ + no-weak-ssl-ciphers \ + no-zlib \ + no-zlib-dynamic \ + no-static-engine" + +PKG_CONFIGURE_OPTS_HOST="--prefix=$TOOLCHAIN \ + --openssldir=$TOOLCHAIN/etc/ssl" +PKG_CONFIGURE_OPTS_TARGET="--prefix=/usr \ + --openssldir=/etc/ssl" + +pre_configure_host() { + mkdir -p $PKG_BUILD/.$HOST_NAME + cp -a $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME/ +} + +configure_host() { + cd $PKG_BUILD/.$HOST_NAME + ./Configure $PKG_CONFIGURE_OPTS_HOST $PKG_CONFIGURE_OPTS_SHARED linux-x86_64 $CFLAGS $LDFLAGS +} + +makeinstall_host() { + make install_sw +} + +pre_configure_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -a $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME/ + + case $TARGET_ARCH in + x86_64) + OPENSSL_TARGET=linux-x86_64 + PLATFORM_FLAGS=enable-ec_nistp_64_gcc_128 + ;; + arm) + OPENSSL_TARGET=linux-armv4 + ;; + aarch64) + OPENSSL_TARGET=linux-aarch64 + ;; + esac +} + +configure_target() { + cd $PKG_BUILD/.$TARGET_NAME + ./Configure $PKG_CONFIGURE_OPTS_TARGET $PKG_CONFIGURE_OPTS_SHARED $PLATFORM_FLAGS $OPENSSL_TARGET $CFLAGS $LDFLAGS +} + +makeinstall_target() { + make INSTALL_PREFIX=$INSTALL install_sw + make INSTALL_PREFIX=$SYSROOT_PREFIX install_sw + chmod 755 $INSTALL/usr/lib/*.so* + chmod 755 $INSTALL/usr/lib/engines/*.so +} + +post_makeinstall_target() { + rm -rf $INSTALL/etc/ssl/misc + rm -rf $INSTALL/usr/bin/c_rehash + + debug_strip $INSTALL/usr/bin/openssl + + # cert from https://curl.haxx.se/docs/caextract.html + mkdir -p $INSTALL/etc/ssl + cp $PKG_DIR/cert/cacert.pem $INSTALL/etc/ssl/cacert.pem.system + + # give user the chance to include their own CA + mkdir -p $INSTALL/usr/bin + cp $PKG_DIR/scripts/openssl-config $INSTALL/usr/bin + ln -sf /run/libreelec/cacert.pem $INSTALL/etc/ssl/cacert.pem + ln -sf /run/libreelec/cacert.pem $INSTALL/etc/ssl/cert.pem + + # backwards comatibility + mkdir -p $INSTALL/etc/pki/tls + ln -sf /run/libreelec/cacert.pem $INSTALL/etc/pki/tls/cacert.pem + mkdir -p $INSTALL/etc/pki/tls/certs + ln -sf /run/libreelec/cacert.pem $INSTALL/etc/pki/tls/certs/ca-bundle.crt + mkdir -p $INSTALL/usr/lib/ssl + ln -sf /run/libreelec/cacert.pem $INSTALL/usr/lib/ssl/cert.pem +} + +post_install() { + enable_service openssl-config.service +} diff --git a/packages/security/openssl/patches/openssl-0001-ca-dir.patch b/packages/security/openssl/patches/openssl-0001-ca-dir.patch new file mode 100644 index 0000000000..55692f0aff --- /dev/null +++ b/packages/security/openssl/patches/openssl-0001-ca-dir.patch @@ -0,0 +1,33 @@ +--- openssl-1.0.2j/apps/CA.pl.in 2006-04-28 02:30:49.000000000 +0200 ++++ openssl-1.0.2j/apps/CA.pl.in 2010-04-01 00:35:02.600553509 +0200 +@@ -53,7 +53,7 @@ + $X509="$openssl x509"; + $PKCS12="$openssl pkcs12"; + +-$CATOP="./demoCA"; ++$CATOP="/etc/ssl"; + $CAKEY="cakey.pem"; + $CAREQ="careq.pem"; + $CACERT="cacert.pem"; +--- openssl-1.0.2j/apps/CA.sh 2009-10-15 19:27:47.000000000 +0200 ++++ openssl-1.0.2j/apps/CA.sh 2010-04-01 00:35:02.600553509 +0200 +@@ -68,7 +68,7 @@ + X509="$OPENSSL x509" + PKCS12="openssl pkcs12" + +-if [ -z "$CATOP" ] ; then CATOP=./demoCA ; fi ++if [ -z "$CATOP" ] ; then CATOP=/etc/ssl ; fi + CAKEY=./cakey.pem + CAREQ=./careq.pem + CACERT=./cacert.pem +--- openssl-1.0.2j/apps/openssl.cnf 2009-04-04 20:09:43.000000000 +0200 ++++ openssl-1.0.2j/apps/openssl.cnf 2010-04-01 00:35:02.607220681 +0200 +@@ -39,7 +39,7 @@ + #################################################################### + [ CA_default ] + +-dir = ./demoCA # Where everything is kept ++dir = /etc/ssl # Where everything is kept + certs = $dir/certs # Where the issued certs are kept + crl_dir = $dir/crl # Where the issued crl are kept + database = $dir/index.txt # database index file. diff --git a/packages/security/openssl/scripts/openssl-config b/packages/security/openssl/scripts/openssl-config new file mode 100755 index 0000000000..dbe273391b --- /dev/null +++ b/packages/security/openssl/scripts/openssl-config @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +cp /etc/ssl/cacert.pem.system /run/libreelec/cacert.pem + +[ -f /storage/.config/cacert.pem ] && cat /storage/.config/cacert.pem >>/run/libreelec/cacert.pem + +exit 0 diff --git a/packages/security/openssl/system.d/openssl-config.service b/packages/security/openssl/system.d/openssl-config.service new file mode 100644 index 0000000000..0f76b811df --- /dev/null +++ b/packages/security/openssl/system.d/openssl-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenSSL configuration service +DefaultDependencies=no +After=systemd-tmpfiles-setup.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/openssl-config + +[Install] +WantedBy=sysinit.target diff --git a/packages/sysutils/amremote/package.mk b/packages/sysutils/amremote/package.mk index 351deb2ead..a6a6739b21 100644 --- a/packages/sysutils/amremote/package.mk +++ b/packages/sysutils/amremote/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="amremote" PKG_VERSION="6431040" -PKG_REV="1" +PKG_SHA256="5859680b0951ed3d2265999b7ad5309060587815df4dd1c48c6fa9aae039d5c5" PKG_ARCH="arm aarch64" PKG_LICENSE="other" PKG_SITE="http://www.amlogic.com" PKG_URL="https://github.com/codesnake/amremote/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain usbutils" -PKG_SECTION="sysutils/remote" -PKG_SHORTDESC="amremote - IR remote configuration utility for Amlogic-based devices" PKG_LONGDESC="amremote - IR remote configuration utility for Amlogic-based devices" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - makeinstall_target() { mkdir -p $INSTALL/usr/bin cp remotecfg $INSTALL/usr/bin diff --git a/packages/sysutils/amremote/scripts/remote-config b/packages/sysutils/amremote/scripts/remote-config index 86bb6cfc29..b7567594c4 100755 --- a/packages/sysutils/amremote/scripts/remote-config +++ b/packages/sysutils/amremote/scripts/remote-config @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2014 Stephan Raue (stephan@openelec.tv) # check the Security chip if we run on a WeTek device lsusb -d 096e:0006 &> /dev/null diff --git a/packages/sysutils/amremote/system.d/amlogic-remotecfg.service b/packages/sysutils/amremote/system.d/amlogic-remotecfg.service index a2c8c62767..98e27badfd 100644 --- a/packages/sysutils/amremote/system.d/amlogic-remotecfg.service +++ b/packages/sysutils/amremote/system.d/amlogic-remotecfg.service @@ -1,5 +1,6 @@ [Unit] Description=Amlogic IR remote support +ConditionPathExists=/dev/amremote [Service] Type=oneshot diff --git a/packages/sysutils/atvclient/package.mk b/packages/sysutils/atvclient/package.mk index 9e6c0a3d78..4775f7d62d 100644 --- a/packages/sysutils/atvclient/package.mk +++ b/packages/sysutils/atvclient/package.mk @@ -1,34 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="atvclient" PKG_VERSION="0263b0a" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="9f741cf36655736ef578eaaca615fd9ce10e290f956cebcff3316d77152f0761" PKG_LICENSE="GPL" PKG_SITE="http://github.com/Evinyatar/atvclient/wiki" PKG_URL="https://github.com/Evinyatar/atvclient/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="atvclient-$PKG_VERSION*" PKG_DEPENDS_TARGET="toolchain libusb-compat" -PKG_SECTION="system/remote" -PKG_SHORTDESC="atvclient: a background application for Linux that reads input from the AppleTV’s internal infra-red receiver" -PKG_LONGDESC="atvclient is a background application for Linux that reads input from the AppleTV’s internal infra-red receiver and submits it to XBMC in a way very similar to how XBMCHelper does this under the native AppleTV OS. It implements most of the functionality the ATV OS HID driver supports, including pairing and control of the status LED." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - +PKG_LONGDESC="A background application for Linux that reads input from the AppleTV’s internal infra-red receiver." diff --git a/packages/sysutils/atvclient/tmpfiles.d/63_atvclient.conf b/packages/sysutils/atvclient/tmpfiles.d/63_atvclient.conf index 735d9e553e..747adb7d3e 100644 --- a/packages/sysutils/atvclient/tmpfiles.d/63_atvclient.conf +++ b/packages/sysutils/atvclient/tmpfiles.d/63_atvclient.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /storage/.cache 0755 root root - - diff --git a/packages/sysutils/atvclient/udev.d/98-appleir.rules b/packages/sysutils/atvclient/udev.d/98-appleir.rules index 6a0b732f44..420e7af0dc 100644 --- a/packages/sysutils/atvclient/udev.d/98-appleir.rules +++ b/packages/sysutils/atvclient/udev.d/98-appleir.rules @@ -1,3 +1,4 @@ ACTION=="add", SUBSYSTEM=="usb", \ ATTR{idVendor}=="05ac", ATTR{idProduct}=="824[012]", \ + RUN+="wakeup_enable", \ TAG+="systemd", ENV{SYSTEMD_WANTS}+="atvclient.service" diff --git a/packages/sysutils/bkeymaps/package.mk b/packages/sysutils/bkeymaps/package.mk index 01b0634e78..1f67dd24dc 100644 --- a/packages/sysutils/bkeymaps/package.mk +++ b/packages/sysutils/bkeymaps/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="bkeymaps" PKG_VERSION="1.13" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="59d41ddb0c7a92d8ac155a82ed2875b7880c8957ea4308afa633c8b81e5b8887" PKG_LICENSE="GPL" PKG_SITE="http://www.alpinelinux.org" PKG_URL="http://dev.alpinelinux.org/archive/bkeymaps/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain busybox" -PKG_SECTION="system" -PKG_SHORTDESC="bkeymaps: binary keyboard maps for busybox" PKG_LONGDESC="bkeymaps: binary keyboard maps for busybox" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - make_target() { : # nothing todo, we install manually } diff --git a/packages/sysutils/busybox/config/busybox-host.conf b/packages/sysutils/busybox/config/busybox-host.conf index 45899b65d8..0a5f2bdf95 100644 --- a/packages/sysutils/busybox/config/busybox-host.conf +++ b/packages/sysutils/busybox/config/busybox-host.conf @@ -1,59 +1,40 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.25.0 -# Wed Jul 20 11:53:43 2016 +# Busybox version: 1.29.2 +# Mon Aug 13 23:47:16 2018 # CONFIG_HAVE_DOT_CONFIG=y # -# Busybox Settings -# - -# -# General Configuration +# Settings # # CONFIG_DESKTOP is not set # CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEDORA_COMPAT is not set # CONFIG_INCLUDE_SUSv2 is not set -# CONFIG_USE_PORTABLE_CODE is not set -CONFIG_PLATFORM_LINUX=y -# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set -CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y -# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_LONG_OPTS=y CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y # CONFIG_FEATURE_COMPRESS_USAGE is not set -CONFIG_BUSYBOX=y -# CONFIG_FEATURE_INSTALLER is not set -CONFIG_INSTALL_NO_USR=y -# CONFIG_LOCALE_SUPPORT is not set -CONFIG_UNICODE_SUPPORT=y -# CONFIG_UNICODE_USING_LOCALE is not set -# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set -CONFIG_SUBST_WCHAR=63 -CONFIG_LAST_SUPPORTED_WCHAR=767 -# CONFIG_UNICODE_COMBINING_WCHARS is not set -# CONFIG_UNICODE_WIDE_WCHARS is not set -# CONFIG_UNICODE_BIDI_SUPPORT is not set -# CONFIG_UNICODE_NEUTRAL_TABLE is not set -# CONFIG_UNICODE_PRESERVE_BROKEN is not set +CONFIG_LFS=y # CONFIG_PAM is not set -CONFIG_FEATURE_USE_SENDFILE=y -# CONFIG_LONG_OPTS is not set # CONFIG_FEATURE_DEVPTS is not set -# CONFIG_FEATURE_CLEAN_UP is not set # CONFIG_FEATURE_UTMP is not set # CONFIG_FEATURE_WTMP is not set # CONFIG_FEATURE_PIDFILE is not set CONFIG_PID_FILE_PATH="" +CONFIG_BUSYBOX=y +# CONFIG_FEATURE_INSTALLER is not set +CONFIG_INSTALL_NO_USR=y # CONFIG_FEATURE_SUID is not set # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set -# CONFIG_SELINUX is not set CONFIG_FEATURE_PREFER_APPLETS=y CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_CLEAN_UP is not set # CONFIG_FEATURE_SYSLOG is not set -# CONFIG_FEATURE_HAVE_RPC is not set +CONFIG_PLATFORM_LINUX=y # # Build Options @@ -62,26 +43,16 @@ CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" # CONFIG_PIE is not set # CONFIG_NOMMU is not set # CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set # CONFIG_FEATURE_INDIVIDUAL is not set # CONFIG_FEATURE_SHARED_BUSYBOX is not set -CONFIG_LFS=y CONFIG_CROSS_COMPILER_PREFIX="" CONFIG_SYSROOT="" CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" CONFIG_EXTRA_LDLIBS="" - -# -# Debugging Options -# -# CONFIG_DEBUG is not set -# CONFIG_DEBUG_PESSIMIZE is not set -# CONFIG_DEBUG_SANITIZE is not set -# CONFIG_UNIT_TEST is not set -# CONFIG_WERROR is not set -CONFIG_NO_DEBUG_LIB=y -# CONFIG_DMALLOC is not set -# CONFIG_EFENCE is not set +# CONFIG_USE_PORTABLE_CODE is not set +# CONFIG_STACK_OPTIMIZATION_386 is not set # # Installation Options ("make install" behavior) @@ -96,16 +67,31 @@ CONFIG_INSTALL_APPLET_SYMLINKS=y CONFIG_PREFIX="./_install-hosttools" # -# Busybox Library Tuning +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Library Tuning # # CONFIG_FEATURE_USE_BSS_TAIL is not set # CONFIG_FEATURE_RTMINMAX is not set +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SMALL=1 CONFIG_SHA3_SMALL=0 CONFIG_FEATURE_FAST_TOP=y # CONFIG_FEATURE_ETC_NETWORKS is not set -# CONFIG_FEATURE_USE_TERMIOS is not set +# CONFIG_FEATURE_ETC_SERVICES is not set CONFIG_FEATURE_EDITING=y CONFIG_FEATURE_EDITING_MAX_LEN=1024 # CONFIG_FEATURE_EDITING_VI is not set @@ -116,9 +102,22 @@ CONFIG_FEATURE_EDITING_HISTORY=15 CONFIG_FEATURE_TAB_COMPLETION=y # CONFIG_FEATURE_USERNAME_COMPLETION is not set # CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set +# CONFIG_FEATURE_EDITING_WINCH is not set # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_UNICODE_SUPPORT=y +# CONFIG_UNICODE_USING_LOCALE is not set +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set # CONFIG_FEATURE_NON_POSIX_CP is not set CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y +CONFIG_FEATURE_USE_SENDFILE=y CONFIG_FEATURE_COPYBUF_KB=4 # CONFIG_FEATURE_SKIP_ROOTFS is not set # CONFIG_MONOTONIC_SYSCALL is not set @@ -142,80 +141,61 @@ CONFIG_FEATURE_COPYBUF_KB=4 # CONFIG_FEATURE_AR_CREATE is not set # CONFIG_UNCOMPRESS is not set # CONFIG_GUNZIP is not set +# CONFIG_ZCAT is not set # CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set # CONFIG_BUNZIP2 is not set +# CONFIG_BZCAT is not set # CONFIG_UNLZMA is not set -# CONFIG_FEATURE_LZMA_FAST is not set +# CONFIG_LZCAT is not set # CONFIG_LZMA is not set # CONFIG_UNXZ is not set +# CONFIG_XZCAT is not set # CONFIG_XZ is not set # CONFIG_BZIP2 is not set +CONFIG_BZIP2_SMALL=0 +# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set # CONFIG_CPIO is not set # CONFIG_FEATURE_CPIO_O is not set # CONFIG_FEATURE_CPIO_P is not set # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set # CONFIG_GZIP is not set # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_GZIP_FAST=0 # CONFIG_FEATURE_GZIP_LEVELS is not set +# CONFIG_FEATURE_GZIP_DECOMPRESS is not set # CONFIG_LZOP is not set +# CONFIG_UNLZOP is not set +# CONFIG_LZOPCAT is not set # CONFIG_LZOP_COMPR_HIGH is not set -# CONFIG_RPM2CPIO is not set # CONFIG_RPM is not set +# CONFIG_RPM2CPIO is not set # CONFIG_TAR is not set +# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set # CONFIG_FEATURE_TAR_CREATE is not set # CONFIG_FEATURE_TAR_AUTODETECT is not set # CONFIG_FEATURE_TAR_FROM is not set # CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set # CONFIG_FEATURE_TAR_GNU_EXTENSIONS is not set -# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set # CONFIG_FEATURE_TAR_TO_COMMAND is not set # CONFIG_FEATURE_TAR_UNAME_GNAME is not set # CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set # CONFIG_FEATURE_TAR_SELINUX is not set # CONFIG_UNZIP is not set +# CONFIG_FEATURE_UNZIP_CDF is not set +# CONFIG_FEATURE_UNZIP_BZIP2 is not set +# CONFIG_FEATURE_UNZIP_LZMA is not set +# CONFIG_FEATURE_UNZIP_XZ is not set +# CONFIG_FEATURE_LZMA_FAST is not set # # Coreutils # # CONFIG_BASENAME is not set # CONFIG_CAT is not set -# CONFIG_DATE is not set -# CONFIG_FEATURE_DATE_ISOFMT is not set -# CONFIG_FEATURE_DATE_NANO is not set -# CONFIG_FEATURE_DATE_COMPAT is not set -# CONFIG_DD is not set -# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set -# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set -# CONFIG_FEATURE_DD_IBS_OBS is not set -# CONFIG_FEATURE_DD_STATUS is not set -# CONFIG_HOSTID is not set -# CONFIG_ID is not set -# CONFIG_GROUPS is not set -# CONFIG_SHUF is not set -# CONFIG_STAT is not set -# CONFIG_FEATURE_STAT_FORMAT is not set -# CONFIG_FEATURE_STAT_FILESYSTEM is not set -# CONFIG_SYNC is not set -# CONFIG_FEATURE_SYNC_FANCY is not set -# CONFIG_TEST is not set -# CONFIG_FEATURE_TEST_64 is not set -# CONFIG_TOUCH is not set -# CONFIG_FEATURE_TOUCH_NODEREF is not set -# CONFIG_FEATURE_TOUCH_SUSV3 is not set -# CONFIG_TR is not set -# CONFIG_FEATURE_TR_CLASSES is not set -# CONFIG_FEATURE_TR_EQUIV is not set -# CONFIG_TRUNCATE is not set -# CONFIG_UNLINK is not set -# CONFIG_BASE64 is not set -# CONFIG_WHO is not set -# CONFIG_USERS is not set -# CONFIG_CAL is not set -# CONFIG_CATV is not set +# CONFIG_FEATURE_CATN is not set +# CONFIG_FEATURE_CATV is not set # CONFIG_CHGRP is not set # CONFIG_CHMOD is not set # CONFIG_CHOWN is not set @@ -226,6 +206,15 @@ CONFIG_GZIP_FAST=0 # CONFIG_CP is not set # CONFIG_FEATURE_CP_LONG_OPTIONS is not set # CONFIG_CUT is not set +# CONFIG_DATE is not set +# CONFIG_FEATURE_DATE_ISOFMT is not set +# CONFIG_FEATURE_DATE_NANO is not set +# CONFIG_FEATURE_DATE_COMPAT is not set +# CONFIG_DD is not set +# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set +# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set +# CONFIG_FEATURE_DD_IBS_OBS is not set +# CONFIG_FEATURE_DD_STATUS is not set # CONFIG_DF is not set # CONFIG_FEATURE_DF_FANCY is not set # CONFIG_DIRNAME is not set @@ -236,39 +225,51 @@ CONFIG_GZIP_FAST=0 # CONFIG_ECHO is not set # CONFIG_FEATURE_FANCY_ECHO is not set # CONFIG_ENV is not set -# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set # CONFIG_EXPAND is not set -# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set +# CONFIG_UNEXPAND is not set # CONFIG_EXPR is not set # CONFIG_EXPR_MATH_SUPPORT_64 is not set +# CONFIG_FACTOR is not set # CONFIG_FALSE is not set # CONFIG_FOLD is not set # CONFIG_FSYNC is not set # CONFIG_HEAD is not set # CONFIG_FEATURE_FANCY_HEAD is not set +# CONFIG_HOSTID is not set +# CONFIG_ID is not set +# CONFIG_GROUPS is not set # CONFIG_INSTALL is not set # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set +# CONFIG_LINK is not set # CONFIG_LN is not set # CONFIG_LOGNAME is not set # CONFIG_LS is not set # CONFIG_FEATURE_LS_FILETYPES is not set # CONFIG_FEATURE_LS_FOLLOWLINKS is not set # CONFIG_FEATURE_LS_RECURSIVE is not set +# CONFIG_FEATURE_LS_WIDTH is not set # CONFIG_FEATURE_LS_SORTFILES is not set # CONFIG_FEATURE_LS_TIMESTAMPS is not set # CONFIG_FEATURE_LS_USERNAME is not set # CONFIG_FEATURE_LS_COLOR is not set # CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set # CONFIG_MD5SUM is not set +# CONFIG_SHA1SUM is not set +# CONFIG_SHA256SUM is not set +# CONFIG_SHA512SUM is not set +# CONFIG_SHA3SUM is not set +# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set # CONFIG_MKDIR is not set -# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set # CONFIG_MKFIFO is not set # CONFIG_MKNOD is not set +# CONFIG_MKTEMP is not set # CONFIG_MV is not set -# CONFIG_FEATURE_MV_LONG_OPTIONS is not set # CONFIG_NICE is not set +# CONFIG_NL is not set # CONFIG_NOHUP is not set +# CONFIG_NPROC is not set # CONFIG_OD is not set +# CONFIG_PASTE is not set # CONFIG_PRINTENV is not set # CONFIG_PRINTF is not set # CONFIG_PWD is not set @@ -277,38 +278,57 @@ CONFIG_GZIP_FAST=0 # CONFIG_REALPATH is not set # CONFIG_RM is not set # CONFIG_RMDIR is not set -# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set # CONFIG_SEQ is not set -# CONFIG_SHA1SUM is not set -# CONFIG_SHA256SUM is not set -# CONFIG_SHA512SUM is not set -# CONFIG_SHA3SUM is not set +# CONFIG_SHRED is not set +# CONFIG_SHUF is not set # CONFIG_SLEEP is not set # CONFIG_FEATURE_FANCY_SLEEP is not set # CONFIG_FEATURE_FLOAT_SLEEP is not set # CONFIG_SORT is not set # CONFIG_FEATURE_SORT_BIG is not set +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set # CONFIG_SPLIT is not set # CONFIG_FEATURE_SPLIT_FANCY is not set +# CONFIG_STAT is not set +# CONFIG_FEATURE_STAT_FORMAT is not set +# CONFIG_FEATURE_STAT_FILESYSTEM is not set # CONFIG_STTY is not set # CONFIG_SUM is not set +# CONFIG_SYNC is not set +# CONFIG_FEATURE_SYNC_FANCY is not set # CONFIG_TAC is not set # CONFIG_TAIL is not set # CONFIG_FEATURE_FANCY_TAIL is not set # CONFIG_TEE is not set # CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set +# CONFIG_TEST is not set +# CONFIG_TEST1 is not set +# CONFIG_TEST2 is not set +# CONFIG_FEATURE_TEST_64 is not set +# CONFIG_TIMEOUT is not set +# CONFIG_TOUCH is not set +# CONFIG_FEATURE_TOUCH_NODEREF is not set +# CONFIG_FEATURE_TOUCH_SUSV3 is not set +# CONFIG_TR is not set +# CONFIG_FEATURE_TR_CLASSES is not set +# CONFIG_FEATURE_TR_EQUIV is not set # CONFIG_TRUE is not set +# CONFIG_TRUNCATE is not set # CONFIG_TTY is not set # CONFIG_UNAME is not set CONFIG_UNAME_OSNAME="" -# CONFIG_UNEXPAND is not set -# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set +CONFIG_BB_ARCH=y # CONFIG_UNIQ is not set +# CONFIG_UNLINK is not set # CONFIG_USLEEP is not set # CONFIG_UUDECODE is not set +# CONFIG_BASE64 is not set # CONFIG_UUENCODE is not set # CONFIG_WC is not set # CONFIG_FEATURE_WC_LARGE is not set +# CONFIG_WHO is not set +# CONFIG_W is not set +# CONFIG_USERS is not set # CONFIG_WHOAMI is not set # CONFIG_YES is not set @@ -317,20 +337,23 @@ CONFIG_UNAME_OSNAME="" # # CONFIG_FEATURE_VERBOSE is not set # CONFIG_FEATURE_PRESERVE_HARDLINKS is not set -# CONFIG_FEATURE_AUTOWIDTH is not set # CONFIG_FEATURE_HUMAN_READABLE is not set -# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set # # Console Utilities # # CONFIG_CHVT is not set -# CONFIG_FGCONSOLE is not set # CONFIG_CLEAR is not set # CONFIG_DEALLOCVT is not set # CONFIG_DUMPKMAP is not set +# CONFIG_FGCONSOLE is not set # CONFIG_KBD_MODE is not set # CONFIG_LOADFONT is not set +# CONFIG_SETFONT is not set +# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set +CONFIG_DEFAULT_SETFONT_DIR="" +# CONFIG_FEATURE_LOADFONT_PSF2 is not set +# CONFIG_FEATURE_LOADFONT_RAW is not set # CONFIG_LOADKMAP is not set # CONFIG_OPENVT is not set # CONFIG_RESET is not set @@ -338,28 +361,30 @@ CONFIG_UNAME_OSNAME="" # CONFIG_FEATURE_RESIZE_PRINT is not set # CONFIG_SETCONSOLE is not set # CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set -# CONFIG_SETFONT is not set -# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set -CONFIG_DEFAULT_SETFONT_DIR="" # CONFIG_SETKEYCODES is not set # CONFIG_SETLOGCONS is not set # CONFIG_SHOWKEY is not set -# CONFIG_FEATURE_LOADFONT_PSF2 is not set -# CONFIG_FEATURE_LOADFONT_RAW is not set # # Debian Utilities # -# CONFIG_MKTEMP is not set # CONFIG_PIPE_PROGRESS is not set # CONFIG_RUN_PARTS is not set # CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set # CONFIG_FEATURE_RUN_PARTS_FANCY is not set # CONFIG_START_STOP_DAEMON is not set -# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set +# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set # CONFIG_WHICH is not set +# +# klibc-utils +# +# CONFIG_MINIPS is not set +# CONFIG_NUKE is not set +# CONFIG_RESUME is not set +# CONFIG_RUN_INIT is not set + # # Editors # @@ -420,8 +445,8 @@ CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0 # CONFIG_FEATURE_FIND_CONTEXT is not set # CONFIG_FEATURE_FIND_LINKS is not set # CONFIG_GREP is not set -# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set -# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set +# CONFIG_EGREP is not set +# CONFIG_FGREP is not set # CONFIG_FEATURE_GREP_CONTEXT is not set # CONFIG_XARGS is not set # CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set @@ -429,6 +454,8 @@ CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0 # CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set # CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set # CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR is not set +# CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL is not set +# CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE is not set # # Init Utilities @@ -437,6 +464,9 @@ CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0 # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set # CONFIG_HALT is not set +# CONFIG_POWEROFF is not set +# CONFIG_REBOOT is not set +# CONFIG_FEATURE_WAIT_FOR_INIT is not set # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" # CONFIG_INIT is not set @@ -446,12 +476,10 @@ CONFIG_TELINIT_PATH="" CONFIG_FEATURE_KILL_DELAY=0 # CONFIG_FEATURE_INIT_SCTTY is not set # CONFIG_FEATURE_INIT_SYSLOG is not set -# CONFIG_FEATURE_EXTRA_QUIET is not set +# CONFIG_FEATURE_INIT_QUIET is not set # CONFIG_FEATURE_INIT_COREDUMPS is not set CONFIG_INIT_TERMINAL_TYPE="" # CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set -# CONFIG_MESG is not set -# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set # # Login/Password Management Utilities @@ -461,13 +489,11 @@ CONFIG_INIT_TERMINAL_TYPE="" # CONFIG_USE_BB_SHADOW is not set # CONFIG_USE_BB_CRYPT is not set # CONFIG_USE_BB_CRYPT_SHA is not set -# CONFIG_ADDGROUP is not set -# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set -# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set # CONFIG_ADD_SHELL is not set # CONFIG_REMOVE_SHELL is not set +# CONFIG_ADDGROUP is not set +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set # CONFIG_ADDUSER is not set -# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set # CONFIG_FEATURE_CHECK_NAMES is not set CONFIG_LAST_ID=0 CONFIG_FIRST_SYSTEM_ID=0 @@ -490,6 +516,7 @@ CONFIG_CRYPTPW=y # CONFIG_SU is not set # CONFIG_FEATURE_SU_SYSLOG is not set # CONFIG_FEATURE_SU_CHECKS_SHELLS is not set +# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set # CONFIG_SULOGIN is not set # CONFIG_VLOCK is not set @@ -504,29 +531,29 @@ CONFIG_CRYPTPW=y # # Linux Module Utilities # -# CONFIG_MODINFO is not set # CONFIG_MODPROBE_SMALL is not set -# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set -# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +# CONFIG_DEPMOD is not set # CONFIG_INSMOD is not set -# CONFIG_RMMOD is not set # CONFIG_LSMOD is not set # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set +# CONFIG_MODINFO is not set # CONFIG_MODPROBE is not set # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set -# CONFIG_DEPMOD is not set +# CONFIG_RMMOD is not set # # Options common to multiple modutils # +# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_MODUTILS_ALIAS is not set # CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="" @@ -535,42 +562,23 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # # Linux System Utilities # -# CONFIG_BLKDISCARD is not set -# CONFIG_BLOCKDEV is not set -# CONFIG_FATATTR is not set -# CONFIG_FSTRIM is not set -# CONFIG_MDEV is not set -# CONFIG_FEATURE_MDEV_CONF is not set -# CONFIG_FEATURE_MDEV_RENAME is not set -# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set -# CONFIG_FEATURE_MDEV_EXEC is not set -# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set -# CONFIG_MOUNT is not set -# CONFIG_FEATURE_MOUNT_FAKE is not set -# CONFIG_FEATURE_MOUNT_VERBOSE is not set -# CONFIG_FEATURE_MOUNT_HELPERS is not set -# CONFIG_FEATURE_MOUNT_LABEL is not set -# CONFIG_FEATURE_MOUNT_NFS is not set -# CONFIG_FEATURE_MOUNT_CIFS is not set -# CONFIG_FEATURE_MOUNT_FLAGS is not set -# CONFIG_FEATURE_MOUNT_FSTAB is not set -# CONFIG_FEATURE_MOUNT_OTHERTAB is not set -# CONFIG_NSENTER is not set -# CONFIG_FEATURE_NSENTER_LONG_OPTS is not set -# CONFIG_REV is not set -# CONFIG_SETARCH is not set -# CONFIG_UEVENT is not set -# CONFIG_UNSHARE is not set # CONFIG_ACPID is not set # CONFIG_FEATURE_ACPID_COMPAT is not set +# CONFIG_BLKDISCARD is not set # CONFIG_BLKID is not set # CONFIG_FEATURE_BLKID_TYPE is not set +# CONFIG_BLOCKDEV is not set +# CONFIG_CAL is not set +# CONFIG_CHRT is not set # CONFIG_DMESG is not set # CONFIG_FEATURE_DMESG_PRETTY is not set +# CONFIG_EJECT is not set +# CONFIG_FEATURE_EJECT_SCSI is not set +# CONFIG_FALLOCATE is not set +# CONFIG_FATATTR is not set # CONFIG_FBSET is not set # CONFIG_FEATURE_FBSET_FANCY is not set # CONFIG_FEATURE_FBSET_READMODE is not set -# CONFIG_FDFLUSH is not set # CONFIG_FDFORMAT is not set # CONFIG_FDISK is not set # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set @@ -583,42 +591,87 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # CONFIG_FEATURE_FDISK_ADVANCED is not set # CONFIG_FINDFS is not set # CONFIG_FLOCK is not set +# CONFIG_FDFLUSH is not set # CONFIG_FREERAMDISK is not set # CONFIG_FSCK_MINIX is not set -# CONFIG_MKFS_EXT2 is not set -# CONFIG_MKFS_MINIX is not set -# CONFIG_FEATURE_MINIX2 is not set -# CONFIG_MKFS_REISER is not set -# CONFIG_MKFS_VFAT is not set +# CONFIG_FSFREEZE is not set +# CONFIG_FSTRIM is not set # CONFIG_GETOPT is not set # CONFIG_FEATURE_GETOPT_LONG is not set # CONFIG_HEXDUMP is not set # CONFIG_FEATURE_HEXDUMP_REVERSE is not set # CONFIG_HD is not set +# CONFIG_XXD is not set # CONFIG_HWCLOCK is not set -# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +# CONFIG_IONICE is not set # CONFIG_IPCRM is not set # CONFIG_IPCS is not set +# CONFIG_LAST is not set +# CONFIG_FEATURE_LAST_FANCY is not set # CONFIG_LOSETUP is not set # CONFIG_LSPCI is not set # CONFIG_LSUSB is not set +# CONFIG_MDEV is not set +# CONFIG_FEATURE_MDEV_CONF is not set +# CONFIG_FEATURE_MDEV_RENAME is not set +# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set +# CONFIG_FEATURE_MDEV_EXEC is not set +# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set +# CONFIG_MESG is not set +# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set +# CONFIG_MKE2FS is not set +# CONFIG_MKFS_EXT2 is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_FEATURE_MINIX2 is not set +# CONFIG_MKFS_REISER is not set +# CONFIG_MKDOSFS is not set +# CONFIG_MKFS_VFAT is not set # CONFIG_MKSWAP is not set # CONFIG_FEATURE_MKSWAP_UUID is not set # CONFIG_MORE is not set +# CONFIG_MOUNT is not set +# CONFIG_FEATURE_MOUNT_FAKE is not set +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +# CONFIG_FEATURE_MOUNT_HELPERS is not set +# CONFIG_FEATURE_MOUNT_LABEL is not set +# CONFIG_FEATURE_MOUNT_NFS is not set +# CONFIG_FEATURE_MOUNT_CIFS is not set +# CONFIG_FEATURE_MOUNT_FLAGS is not set +# CONFIG_FEATURE_MOUNT_FSTAB is not set +# CONFIG_FEATURE_MOUNT_OTHERTAB is not set +# CONFIG_MOUNTPOINT is not set +# CONFIG_NSENTER is not set # CONFIG_PIVOT_ROOT is not set # CONFIG_RDATE is not set # CONFIG_RDEV is not set # CONFIG_READPROFILE is not set +# CONFIG_RENICE is not set +# CONFIG_REV is not set # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set -# CONFIG_SWAPONOFF is not set +# CONFIG_SETARCH is not set +# CONFIG_LINUX32 is not set +# CONFIG_LINUX64 is not set +# CONFIG_SETPRIV is not set +# CONFIG_FEATURE_SETPRIV_DUMP is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set +# CONFIG_SETSID is not set +# CONFIG_SWAPON is not set # CONFIG_FEATURE_SWAPON_DISCARD is not set # CONFIG_FEATURE_SWAPON_PRI is not set +# CONFIG_SWAPOFF is not set +# CONFIG_FEATURE_SWAPONOFF_LABEL is not set # CONFIG_SWITCH_ROOT is not set +# CONFIG_TASKSET is not set +# CONFIG_FEATURE_TASKSET_FANCY is not set +# CONFIG_UEVENT is not set # CONFIG_UMOUNT is not set # CONFIG_FEATURE_UMOUNT_ALL is not set +# CONFIG_UNSHARE is not set +# CONFIG_WALL is not set # CONFIG_FEATURE_MOUNT_LOOP is not set # CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set # CONFIG_FEATURE_MTAB_SUPPORT is not set @@ -633,9 +686,11 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # CONFIG_FEATURE_VOLUMEID_HFS is not set # CONFIG_FEATURE_VOLUMEID_ISO9660 is not set # CONFIG_FEATURE_VOLUMEID_JFS is not set +# CONFIG_FEATURE_VOLUMEID_LFS is not set # CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set # CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set # CONFIG_FEATURE_VOLUMEID_LUKS is not set +# CONFIG_FEATURE_VOLUMEID_MINIX is not set # CONFIG_FEATURE_VOLUMEID_NILFS is not set # CONFIG_FEATURE_VOLUMEID_NTFS is not set # CONFIG_FEATURE_VOLUMEID_OCFS2 is not set @@ -643,46 +698,13 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # CONFIG_FEATURE_VOLUMEID_ROMFS is not set # CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set # CONFIG_FEATURE_VOLUMEID_SYSV is not set +# CONFIG_FEATURE_VOLUMEID_UBIFS is not set # CONFIG_FEATURE_VOLUMEID_UDF is not set # CONFIG_FEATURE_VOLUMEID_XFS is not set # # Miscellaneous Utilities # -# CONFIG_CONSPY is not set -# CONFIG_CROND is not set -# CONFIG_FEATURE_CROND_D is not set -# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set -CONFIG_FEATURE_CROND_DIR="" -# CONFIG_I2CGET is not set -# CONFIG_I2CSET is not set -# CONFIG_I2CDUMP is not set -# CONFIG_I2CDETECT is not set -# CONFIG_LESS is not set -CONFIG_FEATURE_LESS_MAXLINES=0 -# CONFIG_FEATURE_LESS_BRACKETS is not set -# CONFIG_FEATURE_LESS_FLAGS is not set -# CONFIG_FEATURE_LESS_TRUNCATE is not set -# CONFIG_FEATURE_LESS_MARKS is not set -# CONFIG_FEATURE_LESS_REGEXP is not set -# CONFIG_FEATURE_LESS_WINCH is not set -# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set -# CONFIG_FEATURE_LESS_DASHCMD is not set -# CONFIG_FEATURE_LESS_LINENUMS is not set -# CONFIG_NANDWRITE is not set -# CONFIG_NANDDUMP is not set -# CONFIG_RFKILL is not set -# CONFIG_SETSERIAL is not set -# CONFIG_TASKSET is not set -# CONFIG_FEATURE_TASKSET_FANCY is not set -# CONFIG_UBIRENAME is not set -# CONFIG_UBIATTACH is not set -# CONFIG_UBIDETACH is not set -# CONFIG_UBIMKVOL is not set -# CONFIG_UBIRMVOL is not set -# CONFIG_UBIRSVOL is not set -# CONFIG_UBIUPDATEVOL is not set -# CONFIG_WALL is not set # CONFIG_ADJTIMEX is not set # CONFIG_BBCONFIG is not set # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set @@ -697,7 +719,12 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set # CONFIG_FEATURE_CHAT_CLR_ABORT is not set -# CONFIG_CHRT is not set +# CONFIG_CONSPY is not set +# CONFIG_CROND is not set +# CONFIG_FEATURE_CROND_D is not set +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set +CONFIG_FEATURE_CROND_DIR="" # CONFIG_CRONTAB is not set # CONFIG_DC is not set # CONFIG_FEATURE_DC_LIBM is not set @@ -707,17 +734,11 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set # CONFIG_DEVMEM is not set -# CONFIG_EJECT is not set -# CONFIG_FEATURE_EJECT_SCSI is not set # CONFIG_FBSPLASH is not set -# CONFIG_FLASHCP is not set +# CONFIG_FLASH_ERASEALL is not set # CONFIG_FLASH_LOCK is not set # CONFIG_FLASH_UNLOCK is not set -# CONFIG_FLASH_ERASEALL is not set -# CONFIG_IONICE is not set -# CONFIG_INOTIFYD is not set -# CONFIG_LAST is not set -# CONFIG_FEATURE_LAST_FANCY is not set +# CONFIG_FLASHCP is not set # CONFIG_HDPARM is not set # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set @@ -725,46 +746,58 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set +# CONFIG_HEXEDIT is not set +# CONFIG_I2CGET is not set +# CONFIG_I2CSET is not set +# CONFIG_I2CDUMP is not set +# CONFIG_I2CDETECT is not set +# CONFIG_INOTIFYD is not set +# CONFIG_LESS is not set +CONFIG_FEATURE_LESS_MAXLINES=0 +# CONFIG_FEATURE_LESS_BRACKETS is not set +# CONFIG_FEATURE_LESS_FLAGS is not set +# CONFIG_FEATURE_LESS_TRUNCATE is not set +# CONFIG_FEATURE_LESS_MARKS is not set +# CONFIG_FEATURE_LESS_REGEXP is not set +# CONFIG_FEATURE_LESS_WINCH is not set +# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set +# CONFIG_FEATURE_LESS_DASHCMD is not set +# CONFIG_FEATURE_LESS_LINENUMS is not set +# CONFIG_FEATURE_LESS_RAW is not set +# CONFIG_FEATURE_LESS_ENV is not set +# CONFIG_LSSCSI is not set # CONFIG_MAKEDEVS is not set # CONFIG_FEATURE_MAKEDEVS_LEAF is not set # CONFIG_FEATURE_MAKEDEVS_TABLE is not set # CONFIG_MAN is not set # CONFIG_MICROCOM is not set -# CONFIG_MOUNTPOINT is not set # CONFIG_MT is not set +# CONFIG_NANDWRITE is not set +# CONFIG_NANDDUMP is not set +# CONFIG_PARTPROBE is not set # CONFIG_RAIDAUTORUN is not set # CONFIG_READAHEAD is not set +# CONFIG_RFKILL is not set # CONFIG_RUNLEVEL is not set # CONFIG_RX is not set -# CONFIG_SETSID is not set +# CONFIG_SETFATTR is not set +# CONFIG_SETSERIAL is not set # CONFIG_STRINGS is not set # CONFIG_TIME is not set -# CONFIG_TIMEOUT is not set # CONFIG_TTYSIZE is not set +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set +# CONFIG_UBIMKVOL is not set +# CONFIG_UBIRMVOL is not set +# CONFIG_UBIRSVOL is not set +# CONFIG_UBIUPDATEVOL is not set +# CONFIG_UBIRENAME is not set # CONFIG_VOLNAME is not set # CONFIG_WATCHDOG is not set # # Networking Utilities # -# CONFIG_NAMEIF is not set -# CONFIG_FEATURE_NAMEIF_EXTENDED is not set -# CONFIG_NBDCLIENT is not set -# CONFIG_NC is not set -# CONFIG_NC_SERVER is not set -# CONFIG_NC_EXTRA is not set -# CONFIG_NC_110_COMPAT is not set -# CONFIG_PING is not set -# CONFIG_PING6 is not set -# CONFIG_FEATURE_FANCY_PING is not set -# CONFIG_WGET is not set -# CONFIG_FEATURE_WGET_STATUSBAR is not set -# CONFIG_FEATURE_WGET_AUTHENTICATION is not set -# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set -# CONFIG_FEATURE_WGET_TIMEOUT is not set -# CONFIG_FEATURE_WGET_OPENSSL is not set -# CONFIG_FEATURE_WGET_SSL_HELPER is not set -# CONFIG_WHOIS is not set # CONFIG_FEATURE_IPV6 is not set # CONFIG_FEATURE_UNIX_LOCAL is not set # CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set @@ -776,15 +809,15 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_FEATURE_BRCTL_SHOW is not set # CONFIG_DNSD is not set # CONFIG_ETHER_WAKE is not set -# CONFIG_FAKEIDENTD is not set # CONFIG_FTPD is not set -# CONFIG_FEATURE_FTP_WRITE is not set +# CONFIG_FEATURE_FTPD_WRITE is not set # CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set -# CONFIG_FEATURE_FTP_AUTHENTICATION is not set +# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set # CONFIG_FTPGET is not set # CONFIG_FTPPUT is not set # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set # CONFIG_HOSTNAME is not set +# CONFIG_DNSDOMAINNAME is not set # CONFIG_HTTPD is not set # CONFIG_FEATURE_HTTPD_RANGES is not set # CONFIG_FEATURE_HTTPD_SETUID is not set @@ -805,11 +838,10 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set # CONFIG_IFENSLAVE is not set # CONFIG_IFPLUGD is not set -# CONFIG_IFUPDOWN is not set +# CONFIG_IFUP is not set +# CONFIG_IFDOWN is not set CONFIG_IFUPDOWN_IFSTATE_PATH="" # CONFIG_FEATURE_IFUPDOWN_IP is not set -# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set -# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set # CONFIG_FEATURE_IFUPDOWN_IPV4 is not set # CONFIG_FEATURE_IFUPDOWN_IPV6 is not set # CONFIG_FEATURE_IFUPDOWN_MAPPING is not set @@ -822,6 +854,12 @@ CONFIG_IFUPDOWN_IFSTATE_PATH="" # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set # CONFIG_FEATURE_INETD_RPC is not set # CONFIG_IP is not set +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_IPTUNNEL is not set +# CONFIG_IPRULE is not set +# CONFIG_IPNEIGH is not set # CONFIG_FEATURE_IP_ADDRESS is not set # CONFIG_FEATURE_IP_LINK is not set # CONFIG_FEATURE_IP_ROUTE is not set @@ -829,68 +867,91 @@ CONFIG_FEATURE_IP_ROUTE_DIR="" # CONFIG_FEATURE_IP_TUNNEL is not set # CONFIG_FEATURE_IP_RULE is not set # CONFIG_FEATURE_IP_NEIGH is not set -# CONFIG_FEATURE_IP_SHORT_FORMS is not set # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set -# CONFIG_IPADDR is not set -# CONFIG_IPLINK is not set -# CONFIG_IPROUTE is not set -# CONFIG_IPTUNNEL is not set -# CONFIG_IPRULE is not set -# CONFIG_IPNEIGH is not set # CONFIG_IPCALC is not set -# CONFIG_FEATURE_IPCALC_FANCY is not set # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set +# CONFIG_FEATURE_IPCALC_FANCY is not set +# CONFIG_FAKEIDENTD is not set +# CONFIG_NAMEIF is not set +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +# CONFIG_NBDCLIENT is not set +# CONFIG_NC is not set +# CONFIG_NETCAT is not set +# CONFIG_NC_SERVER is not set +# CONFIG_NC_EXTRA is not set +# CONFIG_NC_110_COMPAT is not set # CONFIG_NETSTAT is not set # CONFIG_FEATURE_NETSTAT_WIDE is not set # CONFIG_FEATURE_NETSTAT_PRG is not set # CONFIG_NSLOOKUP is not set +# CONFIG_FEATURE_NSLOOKUP_BIG is not set +# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set # CONFIG_NTPD is not set # CONFIG_FEATURE_NTPD_SERVER is not set # CONFIG_FEATURE_NTPD_CONF is not set +# CONFIG_PING is not set +# CONFIG_PING6 is not set +# CONFIG_FEATURE_FANCY_PING is not set # CONFIG_PSCAN is not set # CONFIG_ROUTE is not set # CONFIG_SLATTACH is not set +# CONFIG_SSL_CLIENT is not set +# CONFIG_TC is not set +# CONFIG_FEATURE_TC_INGRESS is not set # CONFIG_TCPSVD is not set +# CONFIG_UDPSVD is not set # CONFIG_TELNET is not set # CONFIG_FEATURE_TELNET_TTYPE is not set # CONFIG_FEATURE_TELNET_AUTOLOGIN is not set +# CONFIG_FEATURE_TELNET_WIDTH is not set # CONFIG_TELNETD is not set # CONFIG_FEATURE_TELNETD_STANDALONE is not set # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set # CONFIG_TFTP is not set +# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTPD is not set # CONFIG_FEATURE_TFTP_GET is not set # CONFIG_FEATURE_TFTP_PUT is not set # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set -# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTP_DEBUG is not set +# CONFIG_TLS is not set # CONFIG_TRACEROUTE is not set # CONFIG_TRACEROUTE6 is not set # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set -# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set # CONFIG_TUNCTL is not set # CONFIG_FEATURE_TUNCTL_UG is not set -# CONFIG_UDHCPC6 is not set +# CONFIG_VCONFIG is not set +# CONFIG_WGET is not set +# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set +# CONFIG_FEATURE_WGET_STATUSBAR is not set +# CONFIG_FEATURE_WGET_AUTHENTICATION is not set +# CONFIG_FEATURE_WGET_TIMEOUT is not set +# CONFIG_FEATURE_WGET_HTTPS is not set +# CONFIG_FEATURE_WGET_OPENSSL is not set +# CONFIG_WHOIS is not set +# CONFIG_ZCIP is not set # CONFIG_UDHCPD is not set -# CONFIG_DHCPRELAY is not set -# CONFIG_DUMPLEASES is not set -# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set CONFIG_DHCPD_LEASES_FILE="" +# CONFIG_DUMPLEASES is not set +# CONFIG_DHCPRELAY is not set # CONFIG_UDHCPC is not set # CONFIG_FEATURE_UDHCPC_ARPING is not set # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set +CONFIG_UDHCPC_DEFAULT_SCRIPT="" +# CONFIG_UDHCPC6 is not set +# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set +# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set # CONFIG_FEATURE_UDHCP_PORT is not set CONFIG_UDHCP_DEBUG=0 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 # CONFIG_FEATURE_UDHCP_RFC3397 is not set # CONFIG_FEATURE_UDHCP_8021Q is not set -CONFIG_UDHCPC_DEFAULT_SCRIPT="" -CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" -# CONFIG_UDPSVD is not set -# CONFIG_VCONFIG is not set -# CONFIG_ZCIP is not set # # Print Utilities @@ -903,26 +964,45 @@ CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" # Mail Utilities # # CONFIG_MAKEMIME is not set -CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_POPMAILDIR is not set # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set # CONFIG_REFORMIME is not set # CONFIG_FEATURE_REFORMIME_COMPAT is not set # CONFIG_SENDMAIL is not set +CONFIG_FEATURE_MIME_CHARSET="" # # Process Utilities # +# CONFIG_FREE is not set +# CONFIG_FUSER is not set # CONFIG_IOSTAT is not set +# CONFIG_KILL is not set +# CONFIG_KILLALL is not set +# CONFIG_KILLALL5 is not set # CONFIG_LSOF is not set # CONFIG_MPSTAT is not set # CONFIG_NMETER is not set +# CONFIG_PGREP is not set +# CONFIG_PKILL is not set +# CONFIG_PIDOF is not set +# CONFIG_FEATURE_PIDOF_SINGLE is not set +# CONFIG_FEATURE_PIDOF_OMIT is not set # CONFIG_PMAP is not set # CONFIG_POWERTOP is not set +# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set +# CONFIG_PS is not set +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +# CONFIG_FEATURE_PS_TIME is not set +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set # CONFIG_PSTREE is not set # CONFIG_PWDX is not set # CONFIG_SMEMCAP is not set +# CONFIG_BB_SYSCTL is not set # CONFIG_TOP is not set +# CONFIG_FEATURE_TOP_INTERACTIVE is not set # CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set # CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set # CONFIG_FEATURE_TOP_SMP_CPU is not set @@ -931,26 +1011,8 @@ CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_FEATURE_TOPMEM is not set # CONFIG_UPTIME is not set # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set -# CONFIG_FREE is not set -# CONFIG_FUSER is not set -# CONFIG_KILL is not set -# CONFIG_KILLALL is not set -# CONFIG_KILLALL5 is not set -# CONFIG_PGREP is not set -# CONFIG_PIDOF is not set -# CONFIG_FEATURE_PIDOF_SINGLE is not set -# CONFIG_FEATURE_PIDOF_OMIT is not set -# CONFIG_PKILL is not set -# CONFIG_PS is not set -# CONFIG_FEATURE_PS_WIDE is not set -# CONFIG_FEATURE_PS_LONG is not set -# CONFIG_FEATURE_PS_TIME is not set -# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set -# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set -# CONFIG_RENICE is not set -# CONFIG_BB_SYSCTL is not set -# CONFIG_FEATURE_SHOW_THREADS is not set # CONFIG_WATCH is not set +# CONFIG_FEATURE_SHOW_THREADS is not set # # Runit Utilities @@ -965,46 +1027,56 @@ CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_FEATURE_RUNSVDIR_LOG is not set # CONFIG_SV is not set CONFIG_SV_DEFAULT_SERVICE_DIR="" +# CONFIG_SVC is not set +# CONFIG_SVOK is not set # CONFIG_SVLOGD is not set # CONFIG_CHCON is not set -# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set # CONFIG_GETENFORCE is not set # CONFIG_GETSEBOOL is not set # CONFIG_LOAD_POLICY is not set # CONFIG_MATCHPATHCON is not set -# CONFIG_RESTORECON is not set # CONFIG_RUNCON is not set -# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set # CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set # CONFIG_SETENFORCE is not set # CONFIG_SETFILES is not set # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set # CONFIG_SETSEBOOL is not set -# CONFIG_SESTATUS is not set # # Shells # +# CONFIG_SH_IS_ASH is not set +# CONFIG_SH_IS_HUSH is not set +CONFIG_SH_IS_NONE=y +# CONFIG_BASH_IS_ASH is not set +# CONFIG_BASH_IS_HUSH is not set +CONFIG_BASH_IS_NONE=y # CONFIG_ASH is not set +# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set +# CONFIG_ASH_INTERNAL_GLOB is not set # CONFIG_ASH_BASH_COMPAT is not set -# CONFIG_ASH_IDLE_TIMEOUT is not set +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +# CONFIG_ASH_BASH_NOT_FOUND_HOOK is not set # CONFIG_ASH_JOB_CONTROL is not set # CONFIG_ASH_ALIAS is not set -# CONFIG_ASH_GETOPTS is not set -# CONFIG_ASH_BUILTIN_ECHO is not set -# CONFIG_ASH_BUILTIN_PRINTF is not set -# CONFIG_ASH_BUILTIN_TEST is not set -# CONFIG_ASH_HELP is not set -# CONFIG_ASH_CMDCMD is not set -# CONFIG_ASH_MAIL is not set -# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set # CONFIG_ASH_RANDOM_SUPPORT is not set # CONFIG_ASH_EXPAND_PRMT is not set +# CONFIG_ASH_IDLE_TIMEOUT is not set +# CONFIG_ASH_MAIL is not set +# CONFIG_ASH_ECHO is not set +# CONFIG_ASH_PRINTF is not set +# CONFIG_ASH_TEST is not set +# CONFIG_ASH_HELP is not set +# CONFIG_ASH_GETOPTS is not set +# CONFIG_ASH_CMDCMD is not set # CONFIG_CTTYHACK is not set # CONFIG_HUSH is not set # CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BRACE_EXPANSION is not set -# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set # CONFIG_HUSH_INTERACTIVE is not set # CONFIG_HUSH_SAVEHISTORY is not set # CONFIG_HUSH_JOB is not set @@ -1015,20 +1087,37 @@ CONFIG_SV_DEFAULT_SERVICE_DIR="" # CONFIG_HUSH_FUNCTIONS is not set # CONFIG_HUSH_LOCAL is not set # CONFIG_HUSH_RANDOM_SUPPORT is not set -# CONFIG_HUSH_EXPORT_N is not set # CONFIG_HUSH_MODE_X is not set -# CONFIG_MSH is not set -# CONFIG_FEATURE_SH_IS_ASH is not set -# CONFIG_FEATURE_SH_IS_HUSH is not set -CONFIG_FEATURE_SH_IS_NONE=y -# CONFIG_FEATURE_BASH_IS_ASH is not set -# CONFIG_FEATURE_BASH_IS_HUSH is not set -CONFIG_FEATURE_BASH_IS_NONE=y -# CONFIG_SH_MATH_SUPPORT is not set -# CONFIG_SH_MATH_SUPPORT_64 is not set +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set +# CONFIG_HUSH_MEMLEAK is not set + +# +# Options common to all shells +# +# CONFIG_FEATURE_SH_MATH is not set +# CONFIG_FEATURE_SH_MATH_64 is not set # CONFIG_FEATURE_SH_EXTRA_QUIET is not set # CONFIG_FEATURE_SH_STANDALONE is not set # CONFIG_FEATURE_SH_NOFORK is not set +# CONFIG_FEATURE_SH_READ_FRAC is not set # CONFIG_FEATURE_SH_HISTFILESIZE is not set # diff --git a/packages/sysutils/busybox/config/busybox-init.conf b/packages/sysutils/busybox/config/busybox-init.conf index 23e0e73aad..6cd16f5124 100644 --- a/packages/sysutils/busybox/config/busybox-init.conf +++ b/packages/sysutils/busybox/config/busybox-init.conf @@ -1,59 +1,40 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.25.1 -# Thu Nov 24 23:29:54 2016 +# Busybox version: 1.29.2 +# Mon Aug 13 23:52:57 2018 # CONFIG_HAVE_DOT_CONFIG=y # -# Busybox Settings -# - -# -# General Configuration +# Settings # # CONFIG_DESKTOP is not set # CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEDORA_COMPAT is not set # CONFIG_INCLUDE_SUSv2 is not set -# CONFIG_USE_PORTABLE_CODE is not set -CONFIG_PLATFORM_LINUX=y -# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set -CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y -# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_LONG_OPTS=y CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y # CONFIG_FEATURE_COMPRESS_USAGE is not set -CONFIG_BUSYBOX=y -# CONFIG_FEATURE_INSTALLER is not set -CONFIG_INSTALL_NO_USR=y -# CONFIG_LOCALE_SUPPORT is not set -CONFIG_UNICODE_SUPPORT=y -# CONFIG_UNICODE_USING_LOCALE is not set -# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set -CONFIG_SUBST_WCHAR=63 -CONFIG_LAST_SUPPORTED_WCHAR=767 -# CONFIG_UNICODE_COMBINING_WCHARS is not set -# CONFIG_UNICODE_WIDE_WCHARS is not set -# CONFIG_UNICODE_BIDI_SUPPORT is not set -# CONFIG_UNICODE_NEUTRAL_TABLE is not set -# CONFIG_UNICODE_PRESERVE_BROKEN is not set +CONFIG_LFS=y # CONFIG_PAM is not set -CONFIG_FEATURE_USE_SENDFILE=y -# CONFIG_LONG_OPTS is not set CONFIG_FEATURE_DEVPTS=y -# CONFIG_FEATURE_CLEAN_UP is not set # CONFIG_FEATURE_UTMP is not set # CONFIG_FEATURE_WTMP is not set # CONFIG_FEATURE_PIDFILE is not set CONFIG_PID_FILE_PATH="" +CONFIG_BUSYBOX=y +# CONFIG_FEATURE_INSTALLER is not set +CONFIG_INSTALL_NO_USR=y # CONFIG_FEATURE_SUID is not set # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set -# CONFIG_SELINUX is not set CONFIG_FEATURE_PREFER_APPLETS=y CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" -CONFIG_FEATURE_SYSLOG=y -CONFIG_FEATURE_HAVE_RPC=y +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_CLEAN_UP is not set +# CONFIG_FEATURE_SYSLOG is not set +CONFIG_PLATFORM_LINUX=y # # Build Options @@ -62,26 +43,16 @@ CONFIG_FEATURE_HAVE_RPC=y # CONFIG_PIE is not set # CONFIG_NOMMU is not set # CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set # CONFIG_FEATURE_INDIVIDUAL is not set # CONFIG_FEATURE_SHARED_BUSYBOX is not set -CONFIG_LFS=y CONFIG_CROSS_COMPILER_PREFIX="" CONFIG_SYSROOT="" CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" -CONFIG_EXTRA_LDLIBS="" - -# -# Debugging Options -# -# CONFIG_DEBUG is not set -# CONFIG_DEBUG_PESSIMIZE is not set -# CONFIG_DEBUG_SANITIZE is not set -# CONFIG_UNIT_TEST is not set -# CONFIG_WERROR is not set -CONFIG_NO_DEBUG_LIB=y -# CONFIG_DMALLOC is not set -# CONFIG_EFENCE is not set +CONFIG_EXTRA_LDLIBS="-ltirpc -lpthread" +# CONFIG_USE_PORTABLE_CODE is not set +# CONFIG_STACK_OPTIMIZATION_386 is not set # # Installation Options ("make install" behavior) @@ -96,16 +67,31 @@ CONFIG_INSTALL_APPLET_DONT=y CONFIG_PREFIX="./_install-initramfs" # -# Busybox Library Tuning +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Library Tuning # # CONFIG_FEATURE_USE_BSS_TAIL is not set # CONFIG_FEATURE_RTMINMAX is not set +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SMALL=0 CONFIG_SHA3_SMALL=0 CONFIG_FEATURE_FAST_TOP=y # CONFIG_FEATURE_ETC_NETWORKS is not set -# CONFIG_FEATURE_USE_TERMIOS is not set +# CONFIG_FEATURE_ETC_SERVICES is not set CONFIG_FEATURE_EDITING=y CONFIG_FEATURE_EDITING_MAX_LEN=1024 # CONFIG_FEATURE_EDITING_VI is not set @@ -116,9 +102,22 @@ CONFIG_FEATURE_EDITING_HISTORY=15 CONFIG_FEATURE_TAB_COMPLETION=y # CONFIG_FEATURE_USERNAME_COMPLETION is not set # CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set +# CONFIG_FEATURE_EDITING_WINCH is not set # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_UNICODE_SUPPORT=y +# CONFIG_UNICODE_USING_LOCALE is not set +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set # CONFIG_FEATURE_NON_POSIX_CP is not set CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y +CONFIG_FEATURE_USE_SENDFILE=y CONFIG_FEATURE_COPYBUF_KB=4 CONFIG_FEATURE_SKIP_ROOTFS=y # CONFIG_MONOTONIC_SYSCALL is not set @@ -142,80 +141,61 @@ CONFIG_FEATURE_SEAMLESS_GZ=y # CONFIG_FEATURE_AR_CREATE is not set # CONFIG_UNCOMPRESS is not set CONFIG_GUNZIP=y +# CONFIG_ZCAT is not set # CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set # CONFIG_BUNZIP2 is not set +# CONFIG_BZCAT is not set # CONFIG_UNLZMA is not set -# CONFIG_FEATURE_LZMA_FAST is not set +# CONFIG_LZCAT is not set # CONFIG_LZMA is not set # CONFIG_UNXZ is not set +# CONFIG_XZCAT is not set # CONFIG_XZ is not set # CONFIG_BZIP2 is not set +CONFIG_BZIP2_SMALL=0 +# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set # CONFIG_CPIO is not set # CONFIG_FEATURE_CPIO_O is not set # CONFIG_FEATURE_CPIO_P is not set # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_GZIP_FAST=0 CONFIG_FEATURE_GZIP_LEVELS=y +CONFIG_FEATURE_GZIP_DECOMPRESS=y # CONFIG_LZOP is not set +# CONFIG_UNLZOP is not set +# CONFIG_LZOPCAT is not set # CONFIG_LZOP_COMPR_HIGH is not set -# CONFIG_RPM2CPIO is not set # CONFIG_RPM is not set +# CONFIG_RPM2CPIO is not set CONFIG_TAR=y +# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set # CONFIG_FEATURE_TAR_CREATE is not set CONFIG_FEATURE_TAR_AUTODETECT=y # CONFIG_FEATURE_TAR_FROM is not set # CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y -# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set # CONFIG_FEATURE_TAR_TO_COMMAND is not set # CONFIG_FEATURE_TAR_UNAME_GNAME is not set # CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set # CONFIG_FEATURE_TAR_SELINUX is not set # CONFIG_UNZIP is not set +# CONFIG_FEATURE_UNZIP_CDF is not set +# CONFIG_FEATURE_UNZIP_BZIP2 is not set +# CONFIG_FEATURE_UNZIP_LZMA is not set +# CONFIG_FEATURE_UNZIP_XZ is not set +# CONFIG_FEATURE_LZMA_FAST is not set # # Coreutils # CONFIG_BASENAME=y CONFIG_CAT=y -# CONFIG_DATE is not set -# CONFIG_FEATURE_DATE_ISOFMT is not set -# CONFIG_FEATURE_DATE_NANO is not set -# CONFIG_FEATURE_DATE_COMPAT is not set -CONFIG_DD=y -CONFIG_FEATURE_DD_SIGNAL_HANDLING=y -CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y -CONFIG_FEATURE_DD_IBS_OBS=y -CONFIG_FEATURE_DD_STATUS=y -# CONFIG_HOSTID is not set -# CONFIG_ID is not set -# CONFIG_GROUPS is not set -# CONFIG_SHUF is not set -CONFIG_STAT=y -# CONFIG_FEATURE_STAT_FORMAT is not set -# CONFIG_FEATURE_STAT_FILESYSTEM is not set -CONFIG_SYNC=y -CONFIG_FEATURE_SYNC_FANCY=y -# CONFIG_TEST is not set -CONFIG_FEATURE_TEST_64=y -# CONFIG_TOUCH is not set -# CONFIG_FEATURE_TOUCH_NODEREF is not set -# CONFIG_FEATURE_TOUCH_SUSV3 is not set -CONFIG_TR=y -CONFIG_FEATURE_TR_CLASSES=y -CONFIG_FEATURE_TR_EQUIV=y -# CONFIG_TRUNCATE is not set -# CONFIG_UNLINK is not set -# CONFIG_BASE64 is not set -# CONFIG_WHO is not set -# CONFIG_USERS is not set -# CONFIG_CAL is not set -# CONFIG_CATV is not set +CONFIG_FEATURE_CATN=y +# CONFIG_FEATURE_CATV is not set # CONFIG_CHGRP is not set # CONFIG_CHMOD is not set # CONFIG_CHOWN is not set @@ -226,6 +206,15 @@ CONFIG_CHROOT=y CONFIG_CP=y # CONFIG_FEATURE_CP_LONG_OPTIONS is not set # CONFIG_CUT is not set +# CONFIG_DATE is not set +# CONFIG_FEATURE_DATE_ISOFMT is not set +# CONFIG_FEATURE_DATE_NANO is not set +# CONFIG_FEATURE_DATE_COMPAT is not set +CONFIG_DD=y +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y +CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y +CONFIG_FEATURE_DD_IBS_OBS=y +CONFIG_FEATURE_DD_STATUS=y CONFIG_DF=y # CONFIG_FEATURE_DF_FANCY is not set # CONFIG_DIRNAME is not set @@ -236,39 +225,55 @@ CONFIG_DF=y # CONFIG_ECHO is not set CONFIG_FEATURE_FANCY_ECHO=y # CONFIG_ENV is not set -# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set # CONFIG_EXPAND is not set -# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set +# CONFIG_UNEXPAND is not set # CONFIG_EXPR is not set # CONFIG_EXPR_MATH_SUPPORT_64 is not set +# CONFIG_FACTOR is not set # CONFIG_FALSE is not set # CONFIG_FOLD is not set # CONFIG_FSYNC is not set CONFIG_HEAD=y # CONFIG_FEATURE_FANCY_HEAD is not set +# CONFIG_HOSTID is not set +# CONFIG_ID is not set +# CONFIG_GROUPS is not set # CONFIG_INSTALL is not set # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set +# CONFIG_LINK is not set # CONFIG_LN is not set # CONFIG_LOGNAME is not set CONFIG_LS=y # CONFIG_FEATURE_LS_FILETYPES is not set # CONFIG_FEATURE_LS_FOLLOWLINKS is not set # CONFIG_FEATURE_LS_RECURSIVE is not set +# CONFIG_FEATURE_LS_WIDTH is not set # CONFIG_FEATURE_LS_SORTFILES is not set # CONFIG_FEATURE_LS_TIMESTAMPS is not set # CONFIG_FEATURE_LS_USERNAME is not set # CONFIG_FEATURE_LS_COLOR is not set # CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set CONFIG_MD5SUM=y +# CONFIG_SHA1SUM is not set +# CONFIG_SHA256SUM is not set +# CONFIG_SHA512SUM is not set +# CONFIG_SHA3SUM is not set + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y CONFIG_MKDIR=y -# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set # CONFIG_MKFIFO is not set CONFIG_MKNOD=y +# CONFIG_MKTEMP is not set CONFIG_MV=y -# CONFIG_FEATURE_MV_LONG_OPTIONS is not set CONFIG_NICE=y +# CONFIG_NL is not set # CONFIG_NOHUP is not set +# CONFIG_NPROC is not set # CONFIG_OD is not set +# CONFIG_PASTE is not set # CONFIG_PRINTENV is not set # CONFIG_PRINTF is not set # CONFIG_PWD is not set @@ -277,38 +282,57 @@ CONFIG_NICE=y # CONFIG_REALPATH is not set CONFIG_RM=y # CONFIG_RMDIR is not set -# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set # CONFIG_SEQ is not set -# CONFIG_SHA1SUM is not set -# CONFIG_SHA256SUM is not set -# CONFIG_SHA512SUM is not set -# CONFIG_SHA3SUM is not set +# CONFIG_SHRED is not set +# CONFIG_SHUF is not set CONFIG_SLEEP=y # CONFIG_FEATURE_FANCY_SLEEP is not set # CONFIG_FEATURE_FLOAT_SLEEP is not set # CONFIG_SORT is not set # CONFIG_FEATURE_SORT_BIG is not set +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set # CONFIG_SPLIT is not set # CONFIG_FEATURE_SPLIT_FANCY is not set +CONFIG_STAT=y +# CONFIG_FEATURE_STAT_FORMAT is not set +# CONFIG_FEATURE_STAT_FILESYSTEM is not set # CONFIG_STTY is not set # CONFIG_SUM is not set +CONFIG_SYNC=y +CONFIG_FEATURE_SYNC_FANCY=y # CONFIG_TAC is not set CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y # CONFIG_TEE is not set # CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set +# CONFIG_TEST is not set +# CONFIG_TEST1 is not set +# CONFIG_TEST2 is not set +CONFIG_FEATURE_TEST_64=y +# CONFIG_TIMEOUT is not set +# CONFIG_TOUCH is not set +# CONFIG_FEATURE_TOUCH_NODEREF is not set +# CONFIG_FEATURE_TOUCH_SUSV3 is not set +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y # CONFIG_TRUE is not set +# CONFIG_TRUNCATE is not set # CONFIG_TTY is not set CONFIG_UNAME=y CONFIG_UNAME_OSNAME="GNU/Linux" -# CONFIG_UNEXPAND is not set -# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set +# CONFIG_BB_ARCH is not set # CONFIG_UNIQ is not set +# CONFIG_UNLINK is not set CONFIG_USLEEP=y # CONFIG_UUDECODE is not set +# CONFIG_BASE64 is not set # CONFIG_UUENCODE is not set # CONFIG_WC is not set # CONFIG_FEATURE_WC_LARGE is not set +# CONFIG_WHO is not set +# CONFIG_W is not set +# CONFIG_USERS is not set # CONFIG_WHOAMI is not set # CONFIG_YES is not set @@ -322,31 +346,26 @@ CONFIG_USLEEP=y # # CONFIG_FEATURE_PRESERVE_HARDLINKS is not set -# -# Common options for ls, more and telnet -# -# CONFIG_FEATURE_AUTOWIDTH is not set - # # Common options for df, du, ls # # CONFIG_FEATURE_HUMAN_READABLE is not set -# -# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum -# -CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y - # # Console Utilities # CONFIG_CHVT=y -# CONFIG_FGCONSOLE is not set CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set # CONFIG_DUMPKMAP is not set +# CONFIG_FGCONSOLE is not set # CONFIG_KBD_MODE is not set # CONFIG_LOADFONT is not set +# CONFIG_SETFONT is not set +# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set +CONFIG_DEFAULT_SETFONT_DIR="" +# CONFIG_FEATURE_LOADFONT_PSF2 is not set +# CONFIG_FEATURE_LOADFONT_RAW is not set # CONFIG_LOADKMAP is not set # CONFIG_OPENVT is not set # CONFIG_RESET is not set @@ -354,28 +373,30 @@ CONFIG_CLEAR=y # CONFIG_FEATURE_RESIZE_PRINT is not set # CONFIG_SETCONSOLE is not set # CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set -# CONFIG_SETFONT is not set -# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set -CONFIG_DEFAULT_SETFONT_DIR="" # CONFIG_SETKEYCODES is not set # CONFIG_SETLOGCONS is not set # CONFIG_SHOWKEY is not set -# CONFIG_FEATURE_LOADFONT_PSF2 is not set -# CONFIG_FEATURE_LOADFONT_RAW is not set # # Debian Utilities # -# CONFIG_MKTEMP is not set # CONFIG_PIPE_PROGRESS is not set # CONFIG_RUN_PARTS is not set # CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set # CONFIG_FEATURE_RUN_PARTS_FANCY is not set # CONFIG_START_STOP_DAEMON is not set -# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set +# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set # CONFIG_WHICH is not set +# +# klibc-utils +# +# CONFIG_MINIPS is not set +# CONFIG_NUKE is not set +# CONFIG_RESUME is not set +# CONFIG_RUN_INIT is not set + # # Editors # @@ -436,8 +457,8 @@ CONFIG_FEATURE_ALLOW_EXEC=y # CONFIG_FEATURE_FIND_CONTEXT is not set # CONFIG_FEATURE_FIND_LINKS is not set CONFIG_GREP=y -CONFIG_FEATURE_GREP_EGREP_ALIAS=y -CONFIG_FEATURE_GREP_FGREP_ALIAS=y +# CONFIG_EGREP is not set +# CONFIG_FGREP is not set CONFIG_FEATURE_GREP_CONTEXT=y # CONFIG_XARGS is not set # CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set @@ -445,6 +466,8 @@ CONFIG_FEATURE_GREP_CONTEXT=y # CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set # CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set # CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR is not set +# CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL is not set +# CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE is not set # # Init Utilities @@ -453,6 +476,9 @@ CONFIG_FEATURE_GREP_CONTEXT=y # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set CONFIG_HALT=y +CONFIG_POWEROFF=y +CONFIG_REBOOT=y +CONFIG_FEATURE_WAIT_FOR_INIT=y # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" # CONFIG_INIT is not set @@ -462,12 +488,10 @@ CONFIG_TELINIT_PATH="" CONFIG_FEATURE_KILL_DELAY=0 # CONFIG_FEATURE_INIT_SCTTY is not set # CONFIG_FEATURE_INIT_SYSLOG is not set -# CONFIG_FEATURE_EXTRA_QUIET is not set +# CONFIG_FEATURE_INIT_QUIET is not set # CONFIG_FEATURE_INIT_COREDUMPS is not set CONFIG_INIT_TERMINAL_TYPE="" # CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set -# CONFIG_MESG is not set -# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set # # Login/Password Management Utilities @@ -477,13 +501,11 @@ CONFIG_INIT_TERMINAL_TYPE="" # CONFIG_USE_BB_SHADOW is not set # CONFIG_USE_BB_CRYPT is not set # CONFIG_USE_BB_CRYPT_SHA is not set -# CONFIG_ADDGROUP is not set -# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set -# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set # CONFIG_ADD_SHELL is not set # CONFIG_REMOVE_SHELL is not set +# CONFIG_ADDGROUP is not set +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set # CONFIG_ADDUSER is not set -# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set # CONFIG_FEATURE_CHECK_NAMES is not set CONFIG_LAST_ID=0 CONFIG_FIRST_SYSTEM_ID=0 @@ -506,6 +528,7 @@ CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="" # CONFIG_SU is not set # CONFIG_FEATURE_SU_SYSLOG is not set # CONFIG_FEATURE_SU_CHECKS_SHELLS is not set +# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set # CONFIG_SULOGIN is not set # CONFIG_VLOCK is not set @@ -520,29 +543,29 @@ CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="" # # Linux Module Utilities # -# CONFIG_MODINFO is not set # CONFIG_MODPROBE_SMALL is not set -# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set -# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +# CONFIG_DEPMOD is not set CONFIG_INSMOD=y -# CONFIG_RMMOD is not set # CONFIG_LSMOD is not set # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set +# CONFIG_MODINFO is not set # CONFIG_MODPROBE is not set # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set -# CONFIG_DEPMOD is not set +# CONFIG_RMMOD is not set # # Options common to multiple modutils # +# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_MODUTILS_ALIAS is not set # CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="" @@ -551,42 +574,23 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # # Linux System Utilities # -# CONFIG_BLKDISCARD is not set -# CONFIG_BLOCKDEV is not set -# CONFIG_FATATTR is not set -CONFIG_FSTRIM=y -# CONFIG_MDEV is not set -# CONFIG_FEATURE_MDEV_CONF is not set -# CONFIG_FEATURE_MDEV_RENAME is not set -# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set -# CONFIG_FEATURE_MDEV_EXEC is not set -# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set -CONFIG_MOUNT=y -CONFIG_FEATURE_MOUNT_FAKE=y -# CONFIG_FEATURE_MOUNT_VERBOSE is not set -# CONFIG_FEATURE_MOUNT_HELPERS is not set -CONFIG_FEATURE_MOUNT_LABEL=y -CONFIG_FEATURE_MOUNT_NFS=y -# CONFIG_FEATURE_MOUNT_CIFS is not set -CONFIG_FEATURE_MOUNT_FLAGS=y -# CONFIG_FEATURE_MOUNT_FSTAB is not set -# CONFIG_FEATURE_MOUNT_OTHERTAB is not set -# CONFIG_NSENTER is not set -# CONFIG_FEATURE_NSENTER_LONG_OPTS is not set -# CONFIG_REV is not set -# CONFIG_SETARCH is not set -CONFIG_UEVENT=y -# CONFIG_UNSHARE is not set # CONFIG_ACPID is not set # CONFIG_FEATURE_ACPID_COMPAT is not set +# CONFIG_BLKDISCARD is not set CONFIG_BLKID=y CONFIG_FEATURE_BLKID_TYPE=y -# CONFIG_DMESG is not set +# CONFIG_BLOCKDEV is not set +# CONFIG_CAL is not set +# CONFIG_CHRT is not set +CONFIG_DMESG=y # CONFIG_FEATURE_DMESG_PRETTY is not set +# CONFIG_EJECT is not set +# CONFIG_FEATURE_EJECT_SCSI is not set +# CONFIG_FALLOCATE is not set +# CONFIG_FATATTR is not set CONFIG_FBSET=y CONFIG_FEATURE_FBSET_FANCY=y CONFIG_FEATURE_FBSET_READMODE=y -# CONFIG_FDFLUSH is not set # CONFIG_FDFORMAT is not set CONFIG_FDISK=y # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set @@ -599,42 +603,87 @@ CONFIG_FEATURE_GPT_LABEL=y # CONFIG_FEATURE_FDISK_ADVANCED is not set # CONFIG_FINDFS is not set # CONFIG_FLOCK is not set +# CONFIG_FDFLUSH is not set # CONFIG_FREERAMDISK is not set # CONFIG_FSCK_MINIX is not set -# CONFIG_MKFS_EXT2 is not set -# CONFIG_MKFS_MINIX is not set -# CONFIG_FEATURE_MINIX2 is not set -# CONFIG_MKFS_REISER is not set -# CONFIG_MKFS_VFAT is not set +# CONFIG_FSFREEZE is not set +# CONFIG_FSTRIM is not set # CONFIG_GETOPT is not set # CONFIG_FEATURE_GETOPT_LONG is not set # CONFIG_HEXDUMP is not set # CONFIG_FEATURE_HEXDUMP_REVERSE is not set # CONFIG_HD is not set +# CONFIG_XXD is not set # CONFIG_HWCLOCK is not set -# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +CONFIG_IONICE=y # CONFIG_IPCRM is not set # CONFIG_IPCS is not set +# CONFIG_LAST is not set +# CONFIG_FEATURE_LAST_FANCY is not set CONFIG_LOSETUP=y # CONFIG_LSPCI is not set # CONFIG_LSUSB is not set +# CONFIG_MDEV is not set +# CONFIG_FEATURE_MDEV_CONF is not set +# CONFIG_FEATURE_MDEV_RENAME is not set +# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set +# CONFIG_FEATURE_MDEV_EXEC is not set +# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set +# CONFIG_MESG is not set +# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set +# CONFIG_MKE2FS is not set +# CONFIG_MKFS_EXT2 is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_FEATURE_MINIX2 is not set +# CONFIG_MKFS_REISER is not set +# CONFIG_MKDOSFS is not set +# CONFIG_MKFS_VFAT is not set # CONFIG_MKSWAP is not set # CONFIG_FEATURE_MKSWAP_UUID is not set # CONFIG_MORE is not set +CONFIG_MOUNT=y +CONFIG_FEATURE_MOUNT_FAKE=y +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +# CONFIG_FEATURE_MOUNT_HELPERS is not set +CONFIG_FEATURE_MOUNT_LABEL=y +# CONFIG_FEATURE_MOUNT_NFS is not set +# CONFIG_FEATURE_MOUNT_CIFS is not set +CONFIG_FEATURE_MOUNT_FLAGS=y +# CONFIG_FEATURE_MOUNT_FSTAB is not set +# CONFIG_FEATURE_MOUNT_OTHERTAB is not set +CONFIG_MOUNTPOINT=y +# CONFIG_NSENTER is not set CONFIG_PIVOT_ROOT=y # CONFIG_RDATE is not set # CONFIG_RDEV is not set # CONFIG_READPROFILE is not set +# CONFIG_RENICE is not set +# CONFIG_REV is not set # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set -# CONFIG_SWAPONOFF is not set +# CONFIG_SETARCH is not set +# CONFIG_LINUX32 is not set +# CONFIG_LINUX64 is not set +# CONFIG_SETPRIV is not set +# CONFIG_FEATURE_SETPRIV_DUMP is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set +CONFIG_SETSID=y +# CONFIG_SWAPON is not set # CONFIG_FEATURE_SWAPON_DISCARD is not set # CONFIG_FEATURE_SWAPON_PRI is not set +# CONFIG_SWAPOFF is not set +# CONFIG_FEATURE_SWAPONOFF_LABEL is not set CONFIG_SWITCH_ROOT=y +# CONFIG_TASKSET is not set +# CONFIG_FEATURE_TASKSET_FANCY is not set +CONFIG_UEVENT=y CONFIG_UMOUNT=y CONFIG_FEATURE_UMOUNT_ALL=y +# CONFIG_UNSHARE is not set +# CONFIG_WALL is not set # # Common options for mount/umount @@ -657,9 +706,11 @@ CONFIG_FEATURE_VOLUMEID_FAT=y CONFIG_FEATURE_VOLUMEID_HFS=y CONFIG_FEATURE_VOLUMEID_ISO9660=y CONFIG_FEATURE_VOLUMEID_JFS=y +# CONFIG_FEATURE_VOLUMEID_LFS is not set CONFIG_FEATURE_VOLUMEID_LINUXRAID=y CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_FEATURE_VOLUMEID_LUKS=y +CONFIG_FEATURE_VOLUMEID_MINIX=y CONFIG_FEATURE_VOLUMEID_NILFS=y CONFIG_FEATURE_VOLUMEID_NTFS=y CONFIG_FEATURE_VOLUMEID_OCFS2=y @@ -667,46 +718,13 @@ CONFIG_FEATURE_VOLUMEID_REISERFS=y CONFIG_FEATURE_VOLUMEID_ROMFS=y CONFIG_FEATURE_VOLUMEID_SQUASHFS=y CONFIG_FEATURE_VOLUMEID_SYSV=y +CONFIG_FEATURE_VOLUMEID_UBIFS=y CONFIG_FEATURE_VOLUMEID_UDF=y CONFIG_FEATURE_VOLUMEID_XFS=y # # Miscellaneous Utilities # -# CONFIG_CONSPY is not set -# CONFIG_CROND is not set -# CONFIG_FEATURE_CROND_D is not set -# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set -CONFIG_FEATURE_CROND_DIR="" -# CONFIG_I2CGET is not set -# CONFIG_I2CSET is not set -# CONFIG_I2CDUMP is not set -# CONFIG_I2CDETECT is not set -# CONFIG_LESS is not set -CONFIG_FEATURE_LESS_MAXLINES=0 -# CONFIG_FEATURE_LESS_BRACKETS is not set -# CONFIG_FEATURE_LESS_FLAGS is not set -# CONFIG_FEATURE_LESS_TRUNCATE is not set -# CONFIG_FEATURE_LESS_MARKS is not set -# CONFIG_FEATURE_LESS_REGEXP is not set -# CONFIG_FEATURE_LESS_WINCH is not set -# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set -# CONFIG_FEATURE_LESS_DASHCMD is not set -# CONFIG_FEATURE_LESS_LINENUMS is not set -CONFIG_NANDWRITE=y -# CONFIG_NANDDUMP is not set -# CONFIG_RFKILL is not set -# CONFIG_SETSERIAL is not set -# CONFIG_TASKSET is not set -# CONFIG_FEATURE_TASKSET_FANCY is not set -# CONFIG_UBIRENAME is not set -# CONFIG_UBIATTACH is not set -# CONFIG_UBIDETACH is not set -# CONFIG_UBIMKVOL is not set -# CONFIG_UBIRMVOL is not set -# CONFIG_UBIRSVOL is not set -# CONFIG_UBIUPDATEVOL is not set -# CONFIG_WALL is not set # CONFIG_ADJTIMEX is not set # CONFIG_BBCONFIG is not set # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set @@ -721,7 +739,12 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set # CONFIG_FEATURE_CHAT_CLR_ABORT is not set -# CONFIG_CHRT is not set +# CONFIG_CONSPY is not set +# CONFIG_CROND is not set +# CONFIG_FEATURE_CROND_D is not set +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set +CONFIG_FEATURE_CROND_DIR="" # CONFIG_CRONTAB is not set # CONFIG_DC is not set # CONFIG_FEATURE_DC_LIBM is not set @@ -731,17 +754,11 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set # CONFIG_DEVMEM is not set -# CONFIG_EJECT is not set -# CONFIG_FEATURE_EJECT_SCSI is not set # CONFIG_FBSPLASH is not set -# CONFIG_FLASHCP is not set +CONFIG_FLASH_ERASEALL=y # CONFIG_FLASH_LOCK is not set # CONFIG_FLASH_UNLOCK is not set -CONFIG_FLASH_ERASEALL=y -CONFIG_IONICE=y -# CONFIG_INOTIFYD is not set -# CONFIG_LAST is not set -# CONFIG_FEATURE_LAST_FANCY is not set +# CONFIG_FLASHCP is not set # CONFIG_HDPARM is not set # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set @@ -749,46 +766,58 @@ CONFIG_IONICE=y # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set +# CONFIG_HEXEDIT is not set +# CONFIG_I2CGET is not set +# CONFIG_I2CSET is not set +# CONFIG_I2CDUMP is not set +# CONFIG_I2CDETECT is not set +# CONFIG_INOTIFYD is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +# CONFIG_FEATURE_LESS_BRACKETS is not set +# CONFIG_FEATURE_LESS_FLAGS is not set +# CONFIG_FEATURE_LESS_TRUNCATE is not set +# CONFIG_FEATURE_LESS_MARKS is not set +# CONFIG_FEATURE_LESS_REGEXP is not set +# CONFIG_FEATURE_LESS_WINCH is not set +# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set +# CONFIG_FEATURE_LESS_DASHCMD is not set +# CONFIG_FEATURE_LESS_LINENUMS is not set +# CONFIG_FEATURE_LESS_RAW is not set +# CONFIG_FEATURE_LESS_ENV is not set +# CONFIG_LSSCSI is not set # CONFIG_MAKEDEVS is not set # CONFIG_FEATURE_MAKEDEVS_LEAF is not set # CONFIG_FEATURE_MAKEDEVS_TABLE is not set # CONFIG_MAN is not set # CONFIG_MICROCOM is not set -CONFIG_MOUNTPOINT=y # CONFIG_MT is not set +CONFIG_NANDWRITE=y +# CONFIG_NANDDUMP is not set +# CONFIG_PARTPROBE is not set # CONFIG_RAIDAUTORUN is not set # CONFIG_READAHEAD is not set +# CONFIG_RFKILL is not set # CONFIG_RUNLEVEL is not set # CONFIG_RX is not set -# CONFIG_SETSID is not set +# CONFIG_SETFATTR is not set +# CONFIG_SETSERIAL is not set # CONFIG_STRINGS is not set # CONFIG_TIME is not set -# CONFIG_TIMEOUT is not set # CONFIG_TTYSIZE is not set +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set +# CONFIG_UBIMKVOL is not set +# CONFIG_UBIRMVOL is not set +# CONFIG_UBIRSVOL is not set +# CONFIG_UBIUPDATEVOL is not set +# CONFIG_UBIRENAME is not set # CONFIG_VOLNAME is not set # CONFIG_WATCHDOG is not set # # Networking Utilities # -# CONFIG_NAMEIF is not set -# CONFIG_FEATURE_NAMEIF_EXTENDED is not set -CONFIG_NBDCLIENT=y -# CONFIG_NC is not set -# CONFIG_NC_SERVER is not set -# CONFIG_NC_EXTRA is not set -# CONFIG_NC_110_COMPAT is not set -CONFIG_PING=y -# CONFIG_PING6 is not set -CONFIG_FEATURE_FANCY_PING=y -# CONFIG_WGET is not set -# CONFIG_FEATURE_WGET_STATUSBAR is not set -# CONFIG_FEATURE_WGET_AUTHENTICATION is not set -# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set -# CONFIG_FEATURE_WGET_TIMEOUT is not set -# CONFIG_FEATURE_WGET_OPENSSL is not set -# CONFIG_FEATURE_WGET_SSL_HELPER is not set -# CONFIG_WHOIS is not set # CONFIG_FEATURE_IPV6 is not set # CONFIG_FEATURE_UNIX_LOCAL is not set # CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set @@ -800,15 +829,15 @@ CONFIG_FEATURE_FANCY_PING=y # CONFIG_FEATURE_BRCTL_SHOW is not set # CONFIG_DNSD is not set CONFIG_ETHER_WAKE=y -# CONFIG_FAKEIDENTD is not set # CONFIG_FTPD is not set -# CONFIG_FEATURE_FTP_WRITE is not set +# CONFIG_FEATURE_FTPD_WRITE is not set # CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set -# CONFIG_FEATURE_FTP_AUTHENTICATION is not set +# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set # CONFIG_FTPGET is not set # CONFIG_FTPPUT is not set # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set # CONFIG_HOSTNAME is not set +# CONFIG_DNSDOMAINNAME is not set # CONFIG_HTTPD is not set # CONFIG_FEATURE_HTTPD_RANGES is not set # CONFIG_FEATURE_HTTPD_SETUID is not set @@ -829,11 +858,10 @@ CONFIG_ETHER_WAKE=y # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set # CONFIG_IFENSLAVE is not set # CONFIG_IFPLUGD is not set -# CONFIG_IFUPDOWN is not set +# CONFIG_IFUP is not set +# CONFIG_IFDOWN is not set CONFIG_IFUPDOWN_IFSTATE_PATH="" # CONFIG_FEATURE_IFUPDOWN_IP is not set -# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set -# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set # CONFIG_FEATURE_IFUPDOWN_IPV4 is not set # CONFIG_FEATURE_IFUPDOWN_IPV6 is not set # CONFIG_FEATURE_IFUPDOWN_MAPPING is not set @@ -846,6 +874,12 @@ CONFIG_IFUPDOWN_IFSTATE_PATH="" # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set # CONFIG_FEATURE_INETD_RPC is not set # CONFIG_IP is not set +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_IPTUNNEL is not set +# CONFIG_IPRULE is not set +# CONFIG_IPNEIGH is not set # CONFIG_FEATURE_IP_ADDRESS is not set # CONFIG_FEATURE_IP_LINK is not set # CONFIG_FEATURE_IP_ROUTE is not set @@ -853,68 +887,91 @@ CONFIG_FEATURE_IP_ROUTE_DIR="" # CONFIG_FEATURE_IP_TUNNEL is not set # CONFIG_FEATURE_IP_RULE is not set # CONFIG_FEATURE_IP_NEIGH is not set -# CONFIG_FEATURE_IP_SHORT_FORMS is not set # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set -# CONFIG_IPADDR is not set -# CONFIG_IPLINK is not set -# CONFIG_IPROUTE is not set -# CONFIG_IPTUNNEL is not set -# CONFIG_IPRULE is not set -# CONFIG_IPNEIGH is not set # CONFIG_IPCALC is not set -# CONFIG_FEATURE_IPCALC_FANCY is not set # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set +# CONFIG_FEATURE_IPCALC_FANCY is not set +# CONFIG_FAKEIDENTD is not set +# CONFIG_NAMEIF is not set +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +CONFIG_NBDCLIENT=y +# CONFIG_NC is not set +# CONFIG_NETCAT is not set +# CONFIG_NC_SERVER is not set +# CONFIG_NC_EXTRA is not set +# CONFIG_NC_110_COMPAT is not set # CONFIG_NETSTAT is not set # CONFIG_FEATURE_NETSTAT_WIDE is not set # CONFIG_FEATURE_NETSTAT_PRG is not set # CONFIG_NSLOOKUP is not set +# CONFIG_FEATURE_NSLOOKUP_BIG is not set +# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set # CONFIG_NTPD is not set # CONFIG_FEATURE_NTPD_SERVER is not set # CONFIG_FEATURE_NTPD_CONF is not set +CONFIG_PING=y +# CONFIG_PING6 is not set +CONFIG_FEATURE_FANCY_PING=y # CONFIG_PSCAN is not set # CONFIG_ROUTE is not set # CONFIG_SLATTACH is not set +# CONFIG_SSL_CLIENT is not set +# CONFIG_TC is not set +# CONFIG_FEATURE_TC_INGRESS is not set # CONFIG_TCPSVD is not set +# CONFIG_UDPSVD is not set # CONFIG_TELNET is not set # CONFIG_FEATURE_TELNET_TTYPE is not set # CONFIG_FEATURE_TELNET_AUTOLOGIN is not set +# CONFIG_FEATURE_TELNET_WIDTH is not set # CONFIG_TELNETD is not set # CONFIG_FEATURE_TELNETD_STANDALONE is not set # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set # CONFIG_TFTP is not set +# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTPD is not set # CONFIG_FEATURE_TFTP_GET is not set # CONFIG_FEATURE_TFTP_PUT is not set # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set -# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTP_DEBUG is not set +# CONFIG_TLS is not set # CONFIG_TRACEROUTE is not set # CONFIG_TRACEROUTE6 is not set # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set -# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set # CONFIG_TUNCTL is not set # CONFIG_FEATURE_TUNCTL_UG is not set -# CONFIG_UDHCPC6 is not set +# CONFIG_VCONFIG is not set +# CONFIG_WGET is not set +# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set +# CONFIG_FEATURE_WGET_STATUSBAR is not set +# CONFIG_FEATURE_WGET_AUTHENTICATION is not set +# CONFIG_FEATURE_WGET_TIMEOUT is not set +# CONFIG_FEATURE_WGET_HTTPS is not set +# CONFIG_FEATURE_WGET_OPENSSL is not set +# CONFIG_WHOIS is not set +# CONFIG_ZCIP is not set # CONFIG_UDHCPD is not set -# CONFIG_DHCPRELAY is not set -# CONFIG_DUMPLEASES is not set -# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set CONFIG_DHCPD_LEASES_FILE="" +# CONFIG_DUMPLEASES is not set +# CONFIG_DHCPRELAY is not set # CONFIG_UDHCPC is not set # CONFIG_FEATURE_UDHCPC_ARPING is not set # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set +CONFIG_UDHCPC_DEFAULT_SCRIPT="" +# CONFIG_UDHCPC6 is not set +# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set +# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set # CONFIG_FEATURE_UDHCP_PORT is not set CONFIG_UDHCP_DEBUG=0 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 # CONFIG_FEATURE_UDHCP_RFC3397 is not set # CONFIG_FEATURE_UDHCP_8021Q is not set -CONFIG_UDHCPC_DEFAULT_SCRIPT="" -CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" -# CONFIG_UDPSVD is not set -# CONFIG_VCONFIG is not set -# CONFIG_ZCIP is not set # # Print Utilities @@ -927,26 +984,45 @@ CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" # Mail Utilities # # CONFIG_MAKEMIME is not set -CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_POPMAILDIR is not set # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set # CONFIG_REFORMIME is not set # CONFIG_FEATURE_REFORMIME_COMPAT is not set # CONFIG_SENDMAIL is not set +CONFIG_FEATURE_MIME_CHARSET="" # # Process Utilities # +# CONFIG_FREE is not set +# CONFIG_FUSER is not set # CONFIG_IOSTAT is not set +# CONFIG_KILL is not set +# CONFIG_KILLALL is not set +# CONFIG_KILLALL5 is not set # CONFIG_LSOF is not set # CONFIG_MPSTAT is not set # CONFIG_NMETER is not set +# CONFIG_PGREP is not set +# CONFIG_PKILL is not set +# CONFIG_PIDOF is not set +# CONFIG_FEATURE_PIDOF_SINGLE is not set +# CONFIG_FEATURE_PIDOF_OMIT is not set # CONFIG_PMAP is not set # CONFIG_POWERTOP is not set +# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set +# CONFIG_PS is not set +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +# CONFIG_FEATURE_PS_TIME is not set +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set # CONFIG_PSTREE is not set # CONFIG_PWDX is not set # CONFIG_SMEMCAP is not set +# CONFIG_BB_SYSCTL is not set # CONFIG_TOP is not set +# CONFIG_FEATURE_TOP_INTERACTIVE is not set # CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set # CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set # CONFIG_FEATURE_TOP_SMP_CPU is not set @@ -955,26 +1031,8 @@ CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_FEATURE_TOPMEM is not set # CONFIG_UPTIME is not set # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set -# CONFIG_FREE is not set -# CONFIG_FUSER is not set -# CONFIG_KILL is not set -# CONFIG_KILLALL is not set -# CONFIG_KILLALL5 is not set -# CONFIG_PGREP is not set -# CONFIG_PIDOF is not set -# CONFIG_FEATURE_PIDOF_SINGLE is not set -# CONFIG_FEATURE_PIDOF_OMIT is not set -# CONFIG_PKILL is not set -# CONFIG_PS is not set -# CONFIG_FEATURE_PS_WIDE is not set -# CONFIG_FEATURE_PS_LONG is not set -# CONFIG_FEATURE_PS_TIME is not set -# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set -# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set -# CONFIG_RENICE is not set -# CONFIG_BB_SYSCTL is not set -# CONFIG_FEATURE_SHOW_THREADS is not set # CONFIG_WATCH is not set +# CONFIG_FEATURE_SHOW_THREADS is not set # # Runit Utilities @@ -989,46 +1047,56 @@ CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_FEATURE_RUNSVDIR_LOG is not set # CONFIG_SV is not set CONFIG_SV_DEFAULT_SERVICE_DIR="" +# CONFIG_SVC is not set +# CONFIG_SVOK is not set # CONFIG_SVLOGD is not set # CONFIG_CHCON is not set -# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set # CONFIG_GETENFORCE is not set # CONFIG_GETSEBOOL is not set # CONFIG_LOAD_POLICY is not set # CONFIG_MATCHPATHCON is not set -# CONFIG_RESTORECON is not set # CONFIG_RUNCON is not set -# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set # CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set # CONFIG_SETENFORCE is not set # CONFIG_SETFILES is not set # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set # CONFIG_SETSEBOOL is not set -# CONFIG_SESTATUS is not set # # Shells # +CONFIG_SH_IS_ASH=y +# CONFIG_SH_IS_HUSH is not set +# CONFIG_SH_IS_NONE is not set +# CONFIG_BASH_IS_ASH is not set +# CONFIG_BASH_IS_HUSH is not set +CONFIG_BASH_IS_NONE=y CONFIG_ASH=y +# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set +CONFIG_ASH_INTERNAL_GLOB=y CONFIG_ASH_BASH_COMPAT=y -# CONFIG_ASH_IDLE_TIMEOUT is not set +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +# CONFIG_ASH_BASH_NOT_FOUND_HOOK is not set CONFIG_ASH_JOB_CONTROL=y # CONFIG_ASH_ALIAS is not set -CONFIG_ASH_GETOPTS=y -CONFIG_ASH_BUILTIN_ECHO=y -# CONFIG_ASH_BUILTIN_PRINTF is not set -CONFIG_ASH_BUILTIN_TEST=y -# CONFIG_ASH_HELP is not set -# CONFIG_ASH_CMDCMD is not set -# CONFIG_ASH_MAIL is not set -# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set # CONFIG_ASH_RANDOM_SUPPORT is not set # CONFIG_ASH_EXPAND_PRMT is not set -# CONFIG_CTTYHACK is not set +# CONFIG_ASH_IDLE_TIMEOUT is not set +# CONFIG_ASH_MAIL is not set +CONFIG_ASH_ECHO=y +CONFIG_ASH_PRINTF=y +CONFIG_ASH_TEST=y +# CONFIG_ASH_HELP is not set +CONFIG_ASH_GETOPTS=y +# CONFIG_ASH_CMDCMD is not set +CONFIG_CTTYHACK=y # CONFIG_HUSH is not set # CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BRACE_EXPANSION is not set -# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set # CONFIG_HUSH_INTERACTIVE is not set # CONFIG_HUSH_SAVEHISTORY is not set # CONFIG_HUSH_JOB is not set @@ -1039,20 +1107,37 @@ CONFIG_ASH_BUILTIN_TEST=y # CONFIG_HUSH_FUNCTIONS is not set # CONFIG_HUSH_LOCAL is not set # CONFIG_HUSH_RANDOM_SUPPORT is not set -# CONFIG_HUSH_EXPORT_N is not set # CONFIG_HUSH_MODE_X is not set -# CONFIG_MSH is not set -CONFIG_FEATURE_SH_IS_ASH=y -# CONFIG_FEATURE_SH_IS_HUSH is not set -# CONFIG_FEATURE_SH_IS_NONE is not set -CONFIG_FEATURE_BASH_IS_ASH=y -# CONFIG_FEATURE_BASH_IS_HUSH is not set -# CONFIG_FEATURE_BASH_IS_NONE is not set -CONFIG_SH_MATH_SUPPORT=y -CONFIG_SH_MATH_SUPPORT_64=y +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set +# CONFIG_HUSH_MEMLEAK is not set + +# +# Options common to all shells +# +CONFIG_FEATURE_SH_MATH=y +CONFIG_FEATURE_SH_MATH_64=y CONFIG_FEATURE_SH_EXTRA_QUIET=y CONFIG_FEATURE_SH_STANDALONE=y # CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_READ_FRAC=y # CONFIG_FEATURE_SH_HISTFILESIZE is not set # diff --git a/packages/sysutils/busybox/config/busybox-target.conf b/packages/sysutils/busybox/config/busybox-target.conf index c40df53186..510b96164f 100644 --- a/packages/sysutils/busybox/config/busybox-target.conf +++ b/packages/sysutils/busybox/config/busybox-target.conf @@ -1,59 +1,40 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.25.1 -# Thu Nov 24 23:26:05 2016 +# Busybox version: 1.29.2 +# Tue Aug 14 00:01:03 2018 # CONFIG_HAVE_DOT_CONFIG=y # -# Busybox Settings -# - -# -# General Configuration +# Settings # CONFIG_DESKTOP=y # CONFIG_EXTRA_COMPAT is not set +# CONFIG_FEDORA_COMPAT is not set # CONFIG_INCLUDE_SUSv2 is not set -# CONFIG_USE_PORTABLE_CODE is not set -CONFIG_PLATFORM_LINUX=y -# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set -CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y -# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_LONG_OPTS=y CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y CONFIG_FEATURE_COMPRESS_USAGE=y -CONFIG_BUSYBOX=y -CONFIG_FEATURE_INSTALLER=y -CONFIG_INSTALL_NO_USR=y -CONFIG_LOCALE_SUPPORT=y -CONFIG_UNICODE_SUPPORT=y -CONFIG_UNICODE_USING_LOCALE=y -# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set -CONFIG_SUBST_WCHAR=63 -CONFIG_LAST_SUPPORTED_WCHAR=767 -# CONFIG_UNICODE_COMBINING_WCHARS is not set -CONFIG_UNICODE_WIDE_WCHARS=y -# CONFIG_UNICODE_BIDI_SUPPORT is not set -# CONFIG_UNICODE_NEUTRAL_TABLE is not set -# CONFIG_UNICODE_PRESERVE_BROKEN is not set +CONFIG_LFS=y # CONFIG_PAM is not set -CONFIG_FEATURE_USE_SENDFILE=y -CONFIG_LONG_OPTS=y CONFIG_FEATURE_DEVPTS=y -# CONFIG_FEATURE_CLEAN_UP is not set # CONFIG_FEATURE_UTMP is not set # CONFIG_FEATURE_WTMP is not set CONFIG_FEATURE_PIDFILE=y CONFIG_PID_FILE_PATH="/run" +CONFIG_BUSYBOX=y +CONFIG_FEATURE_INSTALLER=y +CONFIG_INSTALL_NO_USR=y CONFIG_FEATURE_SUID=y # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set -# CONFIG_SELINUX is not set # CONFIG_FEATURE_PREFER_APPLETS is not set CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_CLEAN_UP is not set CONFIG_FEATURE_SYSLOG=y -CONFIG_FEATURE_HAVE_RPC=y +CONFIG_PLATFORM_LINUX=y # # Build Options @@ -62,26 +43,16 @@ CONFIG_FEATURE_HAVE_RPC=y # CONFIG_PIE is not set # CONFIG_NOMMU is not set # CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set # CONFIG_FEATURE_INDIVIDUAL is not set # CONFIG_FEATURE_SHARED_BUSYBOX is not set -CONFIG_LFS=y CONFIG_CROSS_COMPILER_PREFIX="" CONFIG_SYSROOT="" CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" -CONFIG_EXTRA_LDLIBS="" - -# -# Debugging Options -# -# CONFIG_DEBUG is not set -# CONFIG_DEBUG_PESSIMIZE is not set -# CONFIG_DEBUG_SANITIZE is not set -# CONFIG_UNIT_TEST is not set -# CONFIG_WERROR is not set -CONFIG_NO_DEBUG_LIB=y -# CONFIG_DMALLOC is not set -# CONFIG_EFENCE is not set +CONFIG_EXTRA_LDLIBS="-ltirpc -lpthread" +# CONFIG_USE_PORTABLE_CODE is not set +# CONFIG_STACK_OPTIMIZATION_386 is not set # # Installation Options ("make install" behavior) @@ -96,16 +67,31 @@ CONFIG_INSTALL_APPLET_SYMLINKS=y CONFIG_PREFIX="./_install-system" # -# Busybox Library Tuning +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Library Tuning # # CONFIG_FEATURE_USE_BSS_TAIL is not set CONFIG_FEATURE_RTMINMAX=y +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SMALL=0 CONFIG_SHA3_SMALL=0 CONFIG_FEATURE_FAST_TOP=y # CONFIG_FEATURE_ETC_NETWORKS is not set -CONFIG_FEATURE_USE_TERMIOS=y +# CONFIG_FEATURE_ETC_SERVICES is not set CONFIG_FEATURE_EDITING=y CONFIG_FEATURE_EDITING_MAX_LEN=1024 # CONFIG_FEATURE_EDITING_VI is not set @@ -114,11 +100,24 @@ CONFIG_FEATURE_EDITING_SAVEHISTORY=y CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y CONFIG_FEATURE_REVERSE_SEARCH=y CONFIG_FEATURE_TAB_COMPLETION=y -# CONFIG_FEATURE_USERNAME_COMPLETION is not set +CONFIG_FEATURE_USERNAME_COMPLETION=y CONFIG_FEATURE_EDITING_FANCY_PROMPT=y +# CONFIG_FEATURE_EDITING_WINCH is not set # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +CONFIG_LOCALE_SUPPORT=y +CONFIG_UNICODE_SUPPORT=y +CONFIG_UNICODE_USING_LOCALE=y +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +CONFIG_UNICODE_WIDE_WCHARS=y +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set CONFIG_FEATURE_NON_POSIX_CP=y CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y +CONFIG_FEATURE_USE_SENDFILE=y CONFIG_FEATURE_COPYBUF_KB=4 CONFIG_FEATURE_SKIP_ROOTFS=y CONFIG_MONOTONIC_SYSCALL=y @@ -142,80 +141,61 @@ CONFIG_FEATURE_AR_LONG_FILENAMES=y CONFIG_FEATURE_AR_CREATE=y # CONFIG_UNCOMPRESS is not set CONFIG_GUNZIP=y +CONFIG_ZCAT=y # CONFIG_FEATURE_GUNZIP_LONG_OPTIONS is not set CONFIG_BUNZIP2=y +CONFIG_BZCAT=y # CONFIG_UNLZMA is not set -# CONFIG_FEATURE_LZMA_FAST is not set +# CONFIG_LZCAT is not set # CONFIG_LZMA is not set CONFIG_UNXZ=y +CONFIG_XZCAT=y CONFIG_XZ=y CONFIG_BZIP2=y +CONFIG_BZIP2_SMALL=8 +CONFIG_FEATURE_BZIP2_DECOMPRESS=y CONFIG_CPIO=y CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y CONFIG_GZIP_FAST=0 CONFIG_FEATURE_GZIP_LEVELS=y +CONFIG_FEATURE_GZIP_DECOMPRESS=y # CONFIG_LZOP is not set +# CONFIG_UNLZOP is not set +# CONFIG_LZOPCAT is not set # CONFIG_LZOP_COMPR_HIGH is not set -CONFIG_RPM2CPIO=y # CONFIG_RPM is not set +CONFIG_RPM2CPIO=y CONFIG_TAR=y +CONFIG_FEATURE_TAR_LONG_OPTIONS=y CONFIG_FEATURE_TAR_CREATE=y CONFIG_FEATURE_TAR_AUTODETECT=y CONFIG_FEATURE_TAR_FROM=y # CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y -CONFIG_FEATURE_TAR_LONG_OPTIONS=y CONFIG_FEATURE_TAR_TO_COMMAND=y CONFIG_FEATURE_TAR_UNAME_GNAME=y CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y # CONFIG_FEATURE_TAR_SELINUX is not set # CONFIG_UNZIP is not set +# CONFIG_FEATURE_UNZIP_CDF is not set +# CONFIG_FEATURE_UNZIP_BZIP2 is not set +# CONFIG_FEATURE_UNZIP_LZMA is not set +# CONFIG_FEATURE_UNZIP_XZ is not set +# CONFIG_FEATURE_LZMA_FAST is not set # # Coreutils # CONFIG_BASENAME=y CONFIG_CAT=y -CONFIG_DATE=y -CONFIG_FEATURE_DATE_ISOFMT=y -CONFIG_FEATURE_DATE_NANO=y -CONFIG_FEATURE_DATE_COMPAT=y -CONFIG_DD=y -CONFIG_FEATURE_DD_SIGNAL_HANDLING=y -CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y -CONFIG_FEATURE_DD_IBS_OBS=y -CONFIG_FEATURE_DD_STATUS=y -# CONFIG_HOSTID is not set -CONFIG_ID=y -CONFIG_GROUPS=y -# CONFIG_SHUF is not set -CONFIG_STAT=y -# CONFIG_FEATURE_STAT_FORMAT is not set -# CONFIG_FEATURE_STAT_FILESYSTEM is not set -CONFIG_SYNC=y -CONFIG_FEATURE_SYNC_FANCY=y -# CONFIG_TEST is not set -CONFIG_FEATURE_TEST_64=y -CONFIG_TOUCH=y -CONFIG_FEATURE_TOUCH_NODEREF=y -CONFIG_FEATURE_TOUCH_SUSV3=y -CONFIG_TR=y -CONFIG_FEATURE_TR_CLASSES=y -CONFIG_FEATURE_TR_EQUIV=y -# CONFIG_TRUNCATE is not set -# CONFIG_UNLINK is not set -# CONFIG_BASE64 is not set -# CONFIG_WHO is not set -# CONFIG_USERS is not set -# CONFIG_CAL is not set -# CONFIG_CATV is not set +CONFIG_FEATURE_CATN=y +# CONFIG_FEATURE_CATV is not set # CONFIG_CHGRP is not set CONFIG_CHMOD=y CONFIG_CHOWN=y @@ -226,6 +206,15 @@ CONFIG_CHROOT=y CONFIG_CP=y CONFIG_FEATURE_CP_LONG_OPTIONS=y CONFIG_CUT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +CONFIG_FEATURE_DATE_NANO=y +CONFIG_FEATURE_DATE_COMPAT=y +CONFIG_DD=y +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y +CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y +CONFIG_FEATURE_DD_IBS_OBS=y +CONFIG_FEATURE_DD_STATUS=y CONFIG_DF=y # CONFIG_FEATURE_DF_FANCY is not set CONFIG_DIRNAME=y @@ -236,39 +225,55 @@ CONFIG_DU=y # CONFIG_ECHO is not set CONFIG_FEATURE_FANCY_ECHO=y CONFIG_ENV=y -CONFIG_FEATURE_ENV_LONG_OPTIONS=y # CONFIG_EXPAND is not set -# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set +# CONFIG_UNEXPAND is not set # CONFIG_EXPR is not set # CONFIG_EXPR_MATH_SUPPORT_64 is not set +# CONFIG_FACTOR is not set # CONFIG_FALSE is not set # CONFIG_FOLD is not set # CONFIG_FSYNC is not set CONFIG_HEAD=y CONFIG_FEATURE_FANCY_HEAD=y +# CONFIG_HOSTID is not set +CONFIG_ID=y +CONFIG_GROUPS=y CONFIG_INSTALL=y CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y +# CONFIG_LINK is not set CONFIG_LN=y # CONFIG_LOGNAME is not set CONFIG_LS=y CONFIG_FEATURE_LS_FILETYPES=y CONFIG_FEATURE_LS_FOLLOWLINKS=y CONFIG_FEATURE_LS_RECURSIVE=y +# CONFIG_FEATURE_LS_WIDTH is not set CONFIG_FEATURE_LS_SORTFILES=y CONFIG_FEATURE_LS_TIMESTAMPS=y CONFIG_FEATURE_LS_USERNAME=y CONFIG_FEATURE_LS_COLOR=y CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y CONFIG_MD5SUM=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +CONFIG_SHA512SUM=y +# CONFIG_SHA3SUM is not set + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y CONFIG_MKDIR=y -CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y CONFIG_MKFIFO=y CONFIG_MKNOD=y +CONFIG_MKTEMP=y CONFIG_MV=y -CONFIG_FEATURE_MV_LONG_OPTIONS=y CONFIG_NICE=y +# CONFIG_NL is not set CONFIG_NOHUP=y +# CONFIG_NPROC is not set CONFIG_OD=y +# CONFIG_PASTE is not set CONFIG_PRINTENV=y # CONFIG_PRINTF is not set CONFIG_PWD=y @@ -277,38 +282,57 @@ CONFIG_FEATURE_READLINK_FOLLOW=y CONFIG_REALPATH=y CONFIG_RM=y CONFIG_RMDIR=y -CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y CONFIG_SEQ=y -CONFIG_SHA1SUM=y -CONFIG_SHA256SUM=y -CONFIG_SHA512SUM=y -# CONFIG_SHA3SUM is not set +# CONFIG_SHRED is not set +# CONFIG_SHUF is not set CONFIG_SLEEP=y CONFIG_FEATURE_FANCY_SLEEP=y CONFIG_FEATURE_FLOAT_SLEEP=y CONFIG_SORT=y CONFIG_FEATURE_SORT_BIG=y +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set # CONFIG_SPLIT is not set # CONFIG_FEATURE_SPLIT_FANCY is not set +CONFIG_STAT=y +# CONFIG_FEATURE_STAT_FORMAT is not set +# CONFIG_FEATURE_STAT_FILESYSTEM is not set # CONFIG_STTY is not set # CONFIG_SUM is not set +CONFIG_SYNC=y +CONFIG_FEATURE_SYNC_FANCY=y # CONFIG_TAC is not set CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +# CONFIG_TEST is not set +# CONFIG_TEST1 is not set +# CONFIG_TEST2 is not set +CONFIG_FEATURE_TEST_64=y +# CONFIG_TIMEOUT is not set +CONFIG_TOUCH=y +CONFIG_FEATURE_TOUCH_NODEREF=y +CONFIG_FEATURE_TOUCH_SUSV3=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y CONFIG_TRUE=y +# CONFIG_TRUNCATE is not set # CONFIG_TTY is not set CONFIG_UNAME=y CONFIG_UNAME_OSNAME="GNU/Linux" -# CONFIG_UNEXPAND is not set -# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set +CONFIG_BB_ARCH=y CONFIG_UNIQ=y +# CONFIG_UNLINK is not set CONFIG_USLEEP=y # CONFIG_UUDECODE is not set +# CONFIG_BASE64 is not set # CONFIG_UUENCODE is not set CONFIG_WC=y CONFIG_FEATURE_WC_LARGE=y +# CONFIG_WHO is not set +# CONFIG_W is not set +# CONFIG_USERS is not set CONFIG_WHOAMI=y # CONFIG_YES is not set @@ -322,31 +346,26 @@ CONFIG_FEATURE_VERBOSE=y # # CONFIG_FEATURE_PRESERVE_HARDLINKS is not set -# -# Common options for ls, more and telnet -# -CONFIG_FEATURE_AUTOWIDTH=y - # # Common options for df, du, ls # CONFIG_FEATURE_HUMAN_READABLE=y -# -# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum -# -CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y - # # Console Utilities # CONFIG_CHVT=y -CONFIG_FGCONSOLE=y CONFIG_CLEAR=y CONFIG_DEALLOCVT=y # CONFIG_DUMPKMAP is not set +CONFIG_FGCONSOLE=y # CONFIG_KBD_MODE is not set # CONFIG_LOADFONT is not set +# CONFIG_SETFONT is not set +# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set +CONFIG_DEFAULT_SETFONT_DIR="" +# CONFIG_FEATURE_LOADFONT_PSF2 is not set +# CONFIG_FEATURE_LOADFONT_RAW is not set CONFIG_LOADKMAP=y # CONFIG_OPENVT is not set CONFIG_RESET=y @@ -354,28 +373,30 @@ CONFIG_RESET=y # CONFIG_FEATURE_RESIZE_PRINT is not set CONFIG_SETCONSOLE=y CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y -# CONFIG_SETFONT is not set -# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set -CONFIG_DEFAULT_SETFONT_DIR="" # CONFIG_SETKEYCODES is not set # CONFIG_SETLOGCONS is not set # CONFIG_SHOWKEY is not set -# CONFIG_FEATURE_LOADFONT_PSF2 is not set -# CONFIG_FEATURE_LOADFONT_RAW is not set # # Debian Utilities # -CONFIG_MKTEMP=y # CONFIG_PIPE_PROGRESS is not set # CONFIG_RUN_PARTS is not set # CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set # CONFIG_FEATURE_RUN_PARTS_FANCY is not set # CONFIG_START_STOP_DAEMON is not set -# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set +# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set CONFIG_WHICH=y +# +# klibc-utils +# +# CONFIG_MINIPS is not set +# CONFIG_NUKE is not set +# CONFIG_RESUME is not set +# CONFIG_RUN_INIT is not set + # # Editors # @@ -436,8 +457,8 @@ CONFIG_FEATURE_FIND_REGEX=y # CONFIG_FEATURE_FIND_CONTEXT is not set CONFIG_FEATURE_FIND_LINKS=y CONFIG_GREP=y -CONFIG_FEATURE_GREP_EGREP_ALIAS=y -CONFIG_FEATURE_GREP_FGREP_ALIAS=y +CONFIG_EGREP=y +CONFIG_FGREP=y CONFIG_FEATURE_GREP_CONTEXT=y CONFIG_XARGS=y CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y @@ -445,6 +466,8 @@ CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y +CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y +CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y # # Init Utilities @@ -453,6 +476,9 @@ CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set # CONFIG_HALT is not set +# CONFIG_POWEROFF is not set +# CONFIG_REBOOT is not set +# CONFIG_FEATURE_WAIT_FOR_INIT is not set # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" # CONFIG_INIT is not set @@ -462,34 +488,30 @@ CONFIG_TELINIT_PATH="" CONFIG_FEATURE_KILL_DELAY=0 # CONFIG_FEATURE_INIT_SCTTY is not set # CONFIG_FEATURE_INIT_SYSLOG is not set -# CONFIG_FEATURE_EXTRA_QUIET is not set +# CONFIG_FEATURE_INIT_QUIET is not set # CONFIG_FEATURE_INIT_COREDUMPS is not set CONFIG_INIT_TERMINAL_TYPE="" # CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set -# CONFIG_MESG is not set -# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set # # Login/Password Management Utilities # CONFIG_FEATURE_SHADOWPASSWDS=y -CONFIG_USE_BB_PWD_GRP=y -CONFIG_USE_BB_SHADOW=y +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_USE_BB_SHADOW is not set CONFIG_USE_BB_CRYPT=y CONFIG_USE_BB_CRYPT_SHA=y -# CONFIG_ADDGROUP is not set -# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set -# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set # CONFIG_ADD_SHELL is not set # CONFIG_REMOVE_SHELL is not set +# CONFIG_ADDGROUP is not set +# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set # CONFIG_ADDUSER is not set -# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set # CONFIG_FEATURE_CHECK_NAMES is not set CONFIG_LAST_ID=0 CONFIG_FIRST_SYSTEM_ID=0 CONFIG_LAST_SYSTEM_ID=0 # CONFIG_CHPASSWD is not set -CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des" +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512" CONFIG_CRYPTPW=y # CONFIG_MKPASSWD is not set # CONFIG_DELUSER is not set @@ -501,11 +523,12 @@ CONFIG_LOGIN=y CONFIG_LOGIN_SCRIPTS=y # CONFIG_FEATURE_NOLOGIN is not set # CONFIG_FEATURE_SECURETTY is not set -# CONFIG_PASSWD is not set -# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set +CONFIG_PASSWD=y +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y CONFIG_SU=y CONFIG_FEATURE_SU_SYSLOG=y CONFIG_FEATURE_SU_CHECKS_SHELLS=y +# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set # CONFIG_SULOGIN is not set # CONFIG_VLOCK is not set @@ -520,29 +543,29 @@ CONFIG_FEATURE_SU_CHECKS_SHELLS=y # # Linux Module Utilities # -# CONFIG_MODINFO is not set # CONFIG_MODPROBE_SMALL is not set -# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set -# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +# CONFIG_DEPMOD is not set # CONFIG_INSMOD is not set -# CONFIG_RMMOD is not set # CONFIG_LSMOD is not set # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set +# CONFIG_MODINFO is not set # CONFIG_MODPROBE is not set # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set -# CONFIG_DEPMOD is not set +# CONFIG_RMMOD is not set # # Options common to multiple modutils # +# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set # CONFIG_FEATURE_2_4_MODULES is not set -# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set # CONFIG_FEATURE_MODUTILS_ALIAS is not set # CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="" @@ -551,42 +574,23 @@ CONFIG_DEFAULT_DEPMOD_FILE="" # # Linux System Utilities # -# CONFIG_BLKDISCARD is not set -# CONFIG_BLOCKDEV is not set -# CONFIG_FATATTR is not set -CONFIG_FSTRIM=y -# CONFIG_MDEV is not set -# CONFIG_FEATURE_MDEV_CONF is not set -# CONFIG_FEATURE_MDEV_RENAME is not set -# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set -# CONFIG_FEATURE_MDEV_EXEC is not set -# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set -CONFIG_MOUNT=y -CONFIG_FEATURE_MOUNT_FAKE=y -CONFIG_FEATURE_MOUNT_VERBOSE=y -CONFIG_FEATURE_MOUNT_HELPERS=y -CONFIG_FEATURE_MOUNT_LABEL=y -CONFIG_FEATURE_MOUNT_NFS=y -CONFIG_FEATURE_MOUNT_CIFS=y -CONFIG_FEATURE_MOUNT_FLAGS=y -# CONFIG_FEATURE_MOUNT_FSTAB is not set -# CONFIG_FEATURE_MOUNT_OTHERTAB is not set -# CONFIG_NSENTER is not set -# CONFIG_FEATURE_NSENTER_LONG_OPTS is not set -# CONFIG_REV is not set -# CONFIG_SETARCH is not set -CONFIG_UEVENT=y -# CONFIG_UNSHARE is not set # CONFIG_ACPID is not set # CONFIG_FEATURE_ACPID_COMPAT is not set +# CONFIG_BLKDISCARD is not set # CONFIG_BLKID is not set # CONFIG_FEATURE_BLKID_TYPE is not set +# CONFIG_BLOCKDEV is not set +# CONFIG_CAL is not set +# CONFIG_CHRT is not set CONFIG_DMESG=y CONFIG_FEATURE_DMESG_PRETTY=y +CONFIG_EJECT=y +CONFIG_FEATURE_EJECT_SCSI=y +# CONFIG_FALLOCATE is not set +# CONFIG_FATATTR is not set CONFIG_FBSET=y CONFIG_FEATURE_FBSET_FANCY=y CONFIG_FEATURE_FBSET_READMODE=y -# CONFIG_FDFLUSH is not set # CONFIG_FDFORMAT is not set # CONFIG_FDISK is not set # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set @@ -599,42 +603,87 @@ CONFIG_FEATURE_FBSET_READMODE=y # CONFIG_FEATURE_FDISK_ADVANCED is not set CONFIG_FINDFS=y CONFIG_FLOCK=y +# CONFIG_FDFLUSH is not set # CONFIG_FREERAMDISK is not set # CONFIG_FSCK_MINIX is not set -# CONFIG_MKFS_EXT2 is not set -# CONFIG_MKFS_MINIX is not set -# CONFIG_FEATURE_MINIX2 is not set -# CONFIG_MKFS_REISER is not set -CONFIG_MKFS_VFAT=y +# CONFIG_FSFREEZE is not set +# CONFIG_FSTRIM is not set CONFIG_GETOPT=y CONFIG_FEATURE_GETOPT_LONG=y -# CONFIG_HEXDUMP is not set +CONFIG_HEXDUMP=y # CONFIG_FEATURE_HEXDUMP_REVERSE is not set # CONFIG_HD is not set +# CONFIG_XXD is not set CONFIG_HWCLOCK=y -CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +CONFIG_IONICE=y # CONFIG_IPCRM is not set # CONFIG_IPCS is not set +# CONFIG_LAST is not set +# CONFIG_FEATURE_LAST_FANCY is not set # CONFIG_LOSETUP is not set # CONFIG_LSPCI is not set # CONFIG_LSUSB is not set +# CONFIG_MDEV is not set +# CONFIG_FEATURE_MDEV_CONF is not set +# CONFIG_FEATURE_MDEV_RENAME is not set +# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set +# CONFIG_FEATURE_MDEV_EXEC is not set +# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set +# CONFIG_MESG is not set +# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set +# CONFIG_MKE2FS is not set +# CONFIG_MKFS_EXT2 is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_FEATURE_MINIX2 is not set +# CONFIG_MKFS_REISER is not set +# CONFIG_MKDOSFS is not set +CONFIG_MKFS_VFAT=y CONFIG_MKSWAP=y CONFIG_FEATURE_MKSWAP_UUID=y CONFIG_MORE=y +CONFIG_MOUNT=y +CONFIG_FEATURE_MOUNT_FAKE=y +CONFIG_FEATURE_MOUNT_VERBOSE=y +CONFIG_FEATURE_MOUNT_HELPERS=y +CONFIG_FEATURE_MOUNT_LABEL=y +# CONFIG_FEATURE_MOUNT_NFS is not set +CONFIG_FEATURE_MOUNT_CIFS=y +CONFIG_FEATURE_MOUNT_FLAGS=y +# CONFIG_FEATURE_MOUNT_FSTAB is not set +# CONFIG_FEATURE_MOUNT_OTHERTAB is not set +CONFIG_MOUNTPOINT=y +# CONFIG_NSENTER is not set # CONFIG_PIVOT_ROOT is not set CONFIG_RDATE=y # CONFIG_RDEV is not set # CONFIG_READPROFILE is not set +CONFIG_RENICE=y +# CONFIG_REV is not set # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set -# CONFIG_SWAPONOFF is not set +# CONFIG_SETARCH is not set +# CONFIG_LINUX32 is not set +# CONFIG_LINUX64 is not set +# CONFIG_SETPRIV is not set +# CONFIG_FEATURE_SETPRIV_DUMP is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set +# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set +# CONFIG_SETSID is not set +# CONFIG_SWAPON is not set # CONFIG_FEATURE_SWAPON_DISCARD is not set # CONFIG_FEATURE_SWAPON_PRI is not set +# CONFIG_SWAPOFF is not set +# CONFIG_FEATURE_SWAPONOFF_LABEL is not set CONFIG_SWITCH_ROOT=y +# CONFIG_TASKSET is not set +# CONFIG_FEATURE_TASKSET_FANCY is not set +CONFIG_UEVENT=y CONFIG_UMOUNT=y CONFIG_FEATURE_UMOUNT_ALL=y +# CONFIG_UNSHARE is not set +# CONFIG_WALL is not set # # Common options for mount/umount @@ -657,9 +706,11 @@ CONFIG_FEATURE_VOLUMEID_FAT=y CONFIG_FEATURE_VOLUMEID_HFS=y CONFIG_FEATURE_VOLUMEID_ISO9660=y CONFIG_FEATURE_VOLUMEID_JFS=y +# CONFIG_FEATURE_VOLUMEID_LFS is not set CONFIG_FEATURE_VOLUMEID_LINUXRAID=y CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_FEATURE_VOLUMEID_LUKS=y +CONFIG_FEATURE_VOLUMEID_MINIX=y CONFIG_FEATURE_VOLUMEID_NILFS=y CONFIG_FEATURE_VOLUMEID_NTFS=y CONFIG_FEATURE_VOLUMEID_OCFS2=y @@ -667,46 +718,13 @@ CONFIG_FEATURE_VOLUMEID_REISERFS=y CONFIG_FEATURE_VOLUMEID_ROMFS=y # CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set CONFIG_FEATURE_VOLUMEID_SYSV=y +CONFIG_FEATURE_VOLUMEID_UBIFS=y CONFIG_FEATURE_VOLUMEID_UDF=y CONFIG_FEATURE_VOLUMEID_XFS=y # # Miscellaneous Utilities # -# CONFIG_CONSPY is not set -CONFIG_CROND=y -CONFIG_FEATURE_CROND_D=y -# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set -CONFIG_FEATURE_CROND_DIR="/storage/.cache/cron" -# CONFIG_I2CGET is not set -# CONFIG_I2CSET is not set -# CONFIG_I2CDUMP is not set -# CONFIG_I2CDETECT is not set -CONFIG_LESS=y -CONFIG_FEATURE_LESS_MAXLINES=9999999 -CONFIG_FEATURE_LESS_BRACKETS=y -CONFIG_FEATURE_LESS_FLAGS=y -CONFIG_FEATURE_LESS_TRUNCATE=y -CONFIG_FEATURE_LESS_MARKS=y -CONFIG_FEATURE_LESS_REGEXP=y -CONFIG_FEATURE_LESS_WINCH=y -CONFIG_FEATURE_LESS_ASK_TERMINAL=y -CONFIG_FEATURE_LESS_DASHCMD=y -CONFIG_FEATURE_LESS_LINENUMS=y -CONFIG_NANDWRITE=y -# CONFIG_NANDDUMP is not set -# CONFIG_RFKILL is not set -CONFIG_SETSERIAL=y -# CONFIG_TASKSET is not set -# CONFIG_FEATURE_TASKSET_FANCY is not set -# CONFIG_UBIRENAME is not set -# CONFIG_UBIATTACH is not set -# CONFIG_UBIDETACH is not set -# CONFIG_UBIMKVOL is not set -# CONFIG_UBIRMVOL is not set -# CONFIG_UBIRSVOL is not set -# CONFIG_UBIUPDATEVOL is not set -# CONFIG_WALL is not set # CONFIG_ADJTIMEX is not set # CONFIG_BBCONFIG is not set # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set @@ -721,7 +739,12 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0 # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set # CONFIG_FEATURE_CHAT_CLR_ABORT is not set -# CONFIG_CHRT is not set +# CONFIG_CONSPY is not set +CONFIG_CROND=y +CONFIG_FEATURE_CROND_D=y +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set +CONFIG_FEATURE_CROND_DIR="/storage/.cache/cron" CONFIG_CRONTAB=y # CONFIG_DC is not set # CONFIG_FEATURE_DC_LIBM is not set @@ -731,17 +754,11 @@ CONFIG_CRONTAB=y # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set CONFIG_DEVMEM=y -CONFIG_EJECT=y -CONFIG_FEATURE_EJECT_SCSI=y # CONFIG_FBSPLASH is not set -# CONFIG_FLASHCP is not set +CONFIG_FLASH_ERASEALL=y # CONFIG_FLASH_LOCK is not set # CONFIG_FLASH_UNLOCK is not set -CONFIG_FLASH_ERASEALL=y -CONFIG_IONICE=y -# CONFIG_INOTIFYD is not set -# CONFIG_LAST is not set -# CONFIG_FEATURE_LAST_FANCY is not set +# CONFIG_FLASHCP is not set # CONFIG_HDPARM is not set # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set @@ -749,66 +766,78 @@ CONFIG_IONICE=y # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set +# CONFIG_HEXEDIT is not set +# CONFIG_I2CGET is not set +# CONFIG_I2CSET is not set +# CONFIG_I2CDUMP is not set +# CONFIG_I2CDETECT is not set +# CONFIG_INOTIFYD is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_TRUNCATE=y +CONFIG_FEATURE_LESS_MARKS=y +CONFIG_FEATURE_LESS_REGEXP=y +CONFIG_FEATURE_LESS_WINCH=y +CONFIG_FEATURE_LESS_ASK_TERMINAL=y +CONFIG_FEATURE_LESS_DASHCMD=y +CONFIG_FEATURE_LESS_LINENUMS=y +CONFIG_FEATURE_LESS_RAW=y +CONFIG_FEATURE_LESS_ENV=y +# CONFIG_LSSCSI is not set # CONFIG_MAKEDEVS is not set # CONFIG_FEATURE_MAKEDEVS_LEAF is not set # CONFIG_FEATURE_MAKEDEVS_TABLE is not set # CONFIG_MAN is not set # CONFIG_MICROCOM is not set -CONFIG_MOUNTPOINT=y # CONFIG_MT is not set +CONFIG_NANDWRITE=y +# CONFIG_NANDDUMP is not set +# CONFIG_PARTPROBE is not set # CONFIG_RAIDAUTORUN is not set # CONFIG_READAHEAD is not set +# CONFIG_RFKILL is not set # CONFIG_RUNLEVEL is not set # CONFIG_RX is not set -# CONFIG_SETSID is not set +# CONFIG_SETFATTR is not set +CONFIG_SETSERIAL=y # CONFIG_STRINGS is not set CONFIG_TIME=y -# CONFIG_TIMEOUT is not set CONFIG_TTYSIZE=y +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set +# CONFIG_UBIMKVOL is not set +# CONFIG_UBIRMVOL is not set +# CONFIG_UBIRSVOL is not set +# CONFIG_UBIUPDATEVOL is not set +# CONFIG_UBIRENAME is not set # CONFIG_VOLNAME is not set # CONFIG_WATCHDOG is not set # # Networking Utilities # -# CONFIG_NAMEIF is not set -# CONFIG_FEATURE_NAMEIF_EXTENDED is not set -CONFIG_NBDCLIENT=y -CONFIG_NC=y -CONFIG_NC_SERVER=y -CONFIG_NC_EXTRA=y -CONFIG_NC_110_COMPAT=y -CONFIG_PING=y -CONFIG_PING6=y -CONFIG_FEATURE_FANCY_PING=y -CONFIG_WGET=y -CONFIG_FEATURE_WGET_STATUSBAR=y -CONFIG_FEATURE_WGET_AUTHENTICATION=y -CONFIG_FEATURE_WGET_LONG_OPTIONS=y -CONFIG_FEATURE_WGET_TIMEOUT=y -CONFIG_FEATURE_WGET_OPENSSL=y -CONFIG_FEATURE_WGET_SSL_HELPER=y -CONFIG_WHOIS=y CONFIG_FEATURE_IPV6=y # CONFIG_FEATURE_UNIX_LOCAL is not set CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set CONFIG_ARP=y CONFIG_ARPING=y -# CONFIG_BRCTL is not set -# CONFIG_FEATURE_BRCTL_FANCY is not set -# CONFIG_FEATURE_BRCTL_SHOW is not set +CONFIG_BRCTL=y +CONFIG_FEATURE_BRCTL_FANCY=y +CONFIG_FEATURE_BRCTL_SHOW=y # CONFIG_DNSD is not set CONFIG_ETHER_WAKE=y -# CONFIG_FAKEIDENTD is not set # CONFIG_FTPD is not set -# CONFIG_FEATURE_FTP_WRITE is not set +# CONFIG_FEATURE_FTPD_WRITE is not set # CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set -# CONFIG_FEATURE_FTP_AUTHENTICATION is not set +# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set CONFIG_FTPGET=y CONFIG_FTPPUT=y CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y CONFIG_HOSTNAME=y +CONFIG_DNSDOMAINNAME=y CONFIG_HTTPD=y CONFIG_FEATURE_HTTPD_RANGES=y CONFIG_FEATURE_HTTPD_SETUID=y @@ -829,13 +858,12 @@ CONFIG_FEATURE_IFCONFIG_HW=y CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y # CONFIG_IFENSLAVE is not set CONFIG_IFPLUGD=y -CONFIG_IFUPDOWN=y -CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" -CONFIG_FEATURE_IFUPDOWN_IP=y -CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y -# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set -CONFIG_FEATURE_IFUPDOWN_IPV4=y -CONFIG_FEATURE_IFUPDOWN_IPV6=y +# CONFIG_IFUP is not set +# CONFIG_IFDOWN is not set +CONFIG_IFUPDOWN_IFSTATE_PATH="" +# CONFIG_FEATURE_IFUPDOWN_IP is not set +# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set +# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set # CONFIG_FEATURE_IFUPDOWN_MAPPING is not set # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set # CONFIG_INETD is not set @@ -846,75 +874,104 @@ CONFIG_FEATURE_IFUPDOWN_IPV6=y # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set # CONFIG_FEATURE_INETD_RPC is not set CONFIG_IP=y +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_IPTUNNEL is not set +# CONFIG_IPRULE is not set +# CONFIG_IPNEIGH is not set CONFIG_FEATURE_IP_ADDRESS=y CONFIG_FEATURE_IP_LINK=y CONFIG_FEATURE_IP_ROUTE=y CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" CONFIG_FEATURE_IP_TUNNEL=y -# CONFIG_FEATURE_IP_RULE is not set +CONFIG_FEATURE_IP_RULE=y # CONFIG_FEATURE_IP_NEIGH is not set -# CONFIG_FEATURE_IP_SHORT_FORMS is not set # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set -# CONFIG_IPADDR is not set -# CONFIG_IPLINK is not set -# CONFIG_IPROUTE is not set -# CONFIG_IPTUNNEL is not set -# CONFIG_IPRULE is not set -# CONFIG_IPNEIGH is not set # CONFIG_IPCALC is not set -# CONFIG_FEATURE_IPCALC_FANCY is not set # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set +# CONFIG_FEATURE_IPCALC_FANCY is not set +# CONFIG_FAKEIDENTD is not set +# CONFIG_NAMEIF is not set +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +CONFIG_NBDCLIENT=y +CONFIG_NC=y +# CONFIG_NETCAT is not set +CONFIG_NC_SERVER=y +CONFIG_NC_EXTRA=y +CONFIG_NC_110_COMPAT=y CONFIG_NETSTAT=y # CONFIG_FEATURE_NETSTAT_WIDE is not set CONFIG_FEATURE_NETSTAT_PRG=y CONFIG_NSLOOKUP=y +# CONFIG_FEATURE_NSLOOKUP_BIG is not set +# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set CONFIG_NTPD=y # CONFIG_FEATURE_NTPD_SERVER is not set CONFIG_FEATURE_NTPD_CONF=y +CONFIG_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING=y # CONFIG_PSCAN is not set CONFIG_ROUTE=y # CONFIG_SLATTACH is not set +# CONFIG_SSL_CLIENT is not set +# CONFIG_TC is not set +# CONFIG_FEATURE_TC_INGRESS is not set # CONFIG_TCPSVD is not set +# CONFIG_UDPSVD is not set CONFIG_TELNET=y CONFIG_FEATURE_TELNET_TTYPE=y CONFIG_FEATURE_TELNET_AUTOLOGIN=y +# CONFIG_FEATURE_TELNET_WIDTH is not set # CONFIG_TELNETD is not set # CONFIG_FEATURE_TELNETD_STANDALONE is not set # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set # CONFIG_TFTP is not set +# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTPD is not set # CONFIG_FEATURE_TFTP_GET is not set # CONFIG_FEATURE_TFTP_PUT is not set # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set -# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTP_DEBUG is not set +# CONFIG_TLS is not set CONFIG_TRACEROUTE=y CONFIG_TRACEROUTE6=y CONFIG_FEATURE_TRACEROUTE_VERBOSE=y -# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set # CONFIG_TUNCTL is not set # CONFIG_FEATURE_TUNCTL_UG is not set -# CONFIG_UDHCPC6 is not set +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_LONG_OPTIONS=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_TIMEOUT=y +# CONFIG_FEATURE_WGET_HTTPS is not set +CONFIG_FEATURE_WGET_OPENSSL=y +CONFIG_WHOIS=y +# CONFIG_ZCIP is not set # CONFIG_UDHCPD is not set -# CONFIG_DHCPRELAY is not set -# CONFIG_DUMPLEASES is not set -# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set CONFIG_DHCPD_LEASES_FILE="" +# CONFIG_DUMPLEASES is not set +# CONFIG_DHCPRELAY is not set # CONFIG_UDHCPC is not set # CONFIG_FEATURE_UDHCPC_ARPING is not set # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set +CONFIG_UDHCPC_DEFAULT_SCRIPT="" +# CONFIG_UDHCPC6 is not set +# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set +# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set +# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set # CONFIG_FEATURE_UDHCP_PORT is not set CONFIG_UDHCP_DEBUG=0 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 # CONFIG_FEATURE_UDHCP_RFC3397 is not set # CONFIG_FEATURE_UDHCP_8021Q is not set -CONFIG_UDHCPC_DEFAULT_SCRIPT="" -CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" -# CONFIG_UDPSVD is not set -CONFIG_VCONFIG=y -# CONFIG_ZCIP is not set # # Print Utilities @@ -927,26 +984,45 @@ CONFIG_VCONFIG=y # Mail Utilities # # CONFIG_MAKEMIME is not set -CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_POPMAILDIR is not set # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set # CONFIG_REFORMIME is not set # CONFIG_FEATURE_REFORMIME_COMPAT is not set # CONFIG_SENDMAIL is not set +CONFIG_FEATURE_MIME_CHARSET="" # # Process Utilities # +CONFIG_FREE=y +CONFIG_FUSER=y CONFIG_IOSTAT=y +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y CONFIG_LSOF=y CONFIG_MPSTAT=y # CONFIG_NMETER is not set +CONFIG_PGREP=y +CONFIG_PKILL=y +CONFIG_PIDOF=y +CONFIG_FEATURE_PIDOF_SINGLE=y +CONFIG_FEATURE_PIDOF_OMIT=y CONFIG_PMAP=y # CONFIG_POWERTOP is not set +# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set +CONFIG_PS=y +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +CONFIG_FEATURE_PS_TIME=y +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y CONFIG_PSTREE=y CONFIG_PWDX=y CONFIG_SMEMCAP=y +CONFIG_BB_SYSCTL=y # CONFIG_TOP is not set +# CONFIG_FEATURE_TOP_INTERACTIVE is not set # CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set # CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set # CONFIG_FEATURE_TOP_SMP_CPU is not set @@ -955,26 +1031,8 @@ CONFIG_SMEMCAP=y # CONFIG_FEATURE_TOPMEM is not set CONFIG_UPTIME=y # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set -CONFIG_FREE=y -CONFIG_FUSER=y -CONFIG_KILL=y -CONFIG_KILLALL=y -CONFIG_KILLALL5=y -CONFIG_PGREP=y -CONFIG_PIDOF=y -CONFIG_FEATURE_PIDOF_SINGLE=y -CONFIG_FEATURE_PIDOF_OMIT=y -CONFIG_PKILL=y -CONFIG_PS=y -# CONFIG_FEATURE_PS_WIDE is not set -# CONFIG_FEATURE_PS_LONG is not set -CONFIG_FEATURE_PS_TIME=y -CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y -# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set -CONFIG_RENICE=y -CONFIG_BB_SYSCTL=y -CONFIG_FEATURE_SHOW_THREADS=y CONFIG_WATCH=y +CONFIG_FEATURE_SHOW_THREADS=y # # Runit Utilities @@ -989,46 +1047,56 @@ CONFIG_WATCH=y # CONFIG_FEATURE_RUNSVDIR_LOG is not set # CONFIG_SV is not set CONFIG_SV_DEFAULT_SERVICE_DIR="" +# CONFIG_SVC is not set +# CONFIG_SVOK is not set # CONFIG_SVLOGD is not set # CONFIG_CHCON is not set -# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set # CONFIG_GETENFORCE is not set # CONFIG_GETSEBOOL is not set # CONFIG_LOAD_POLICY is not set # CONFIG_MATCHPATHCON is not set -# CONFIG_RESTORECON is not set # CONFIG_RUNCON is not set -# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set # CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set # CONFIG_SETENFORCE is not set # CONFIG_SETFILES is not set # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set # CONFIG_SETSEBOOL is not set -# CONFIG_SESTATUS is not set # # Shells # +CONFIG_SH_IS_ASH=y +# CONFIG_SH_IS_HUSH is not set +# CONFIG_SH_IS_NONE is not set +CONFIG_BASH_IS_ASH=y +# CONFIG_BASH_IS_HUSH is not set +# CONFIG_BASH_IS_NONE is not set CONFIG_ASH=y +# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set +# CONFIG_ASH_INTERNAL_GLOB is not set CONFIG_ASH_BASH_COMPAT=y -# CONFIG_ASH_IDLE_TIMEOUT is not set +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +# CONFIG_ASH_BASH_NOT_FOUND_HOOK is not set CONFIG_ASH_JOB_CONTROL=y CONFIG_ASH_ALIAS=y -CONFIG_ASH_GETOPTS=y -CONFIG_ASH_BUILTIN_ECHO=y -CONFIG_ASH_BUILTIN_PRINTF=y -CONFIG_ASH_BUILTIN_TEST=y -CONFIG_ASH_HELP=y -CONFIG_ASH_CMDCMD=y -# CONFIG_ASH_MAIL is not set -# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set CONFIG_ASH_RANDOM_SUPPORT=y CONFIG_ASH_EXPAND_PRMT=y +# CONFIG_ASH_IDLE_TIMEOUT is not set +# CONFIG_ASH_MAIL is not set +CONFIG_ASH_ECHO=y +CONFIG_ASH_PRINTF=y +CONFIG_ASH_TEST=y +CONFIG_ASH_HELP=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_CMDCMD=y # CONFIG_CTTYHACK is not set # CONFIG_HUSH is not set # CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BRACE_EXPANSION is not set -# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set # CONFIG_HUSH_INTERACTIVE is not set # CONFIG_HUSH_SAVEHISTORY is not set # CONFIG_HUSH_JOB is not set @@ -1039,20 +1107,37 @@ CONFIG_ASH_EXPAND_PRMT=y # CONFIG_HUSH_FUNCTIONS is not set # CONFIG_HUSH_LOCAL is not set # CONFIG_HUSH_RANDOM_SUPPORT is not set -# CONFIG_HUSH_EXPORT_N is not set # CONFIG_HUSH_MODE_X is not set -# CONFIG_MSH is not set -CONFIG_FEATURE_SH_IS_ASH=y -# CONFIG_FEATURE_SH_IS_HUSH is not set -# CONFIG_FEATURE_SH_IS_NONE is not set -CONFIG_FEATURE_BASH_IS_ASH=y -# CONFIG_FEATURE_BASH_IS_HUSH is not set -# CONFIG_FEATURE_BASH_IS_NONE is not set -CONFIG_SH_MATH_SUPPORT=y -CONFIG_SH_MATH_SUPPORT_64=y +# CONFIG_HUSH_ECHO is not set +# CONFIG_HUSH_PRINTF is not set +# CONFIG_HUSH_TEST is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_EXPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_READONLY is not set +# CONFIG_HUSH_KILL is not set +# CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set +# CONFIG_HUSH_TRAP is not set +# CONFIG_HUSH_TYPE is not set +# CONFIG_HUSH_TIMES is not set +# CONFIG_HUSH_READ is not set +# CONFIG_HUSH_SET is not set +# CONFIG_HUSH_UNSET is not set +# CONFIG_HUSH_ULIMIT is not set +# CONFIG_HUSH_UMASK is not set +# CONFIG_HUSH_GETOPTS is not set +# CONFIG_HUSH_MEMLEAK is not set + +# +# Options common to all shells +# +CONFIG_FEATURE_SH_MATH=y +CONFIG_FEATURE_SH_MATH_64=y CONFIG_FEATURE_SH_EXTRA_QUIET=y # CONFIG_FEATURE_SH_STANDALONE is not set # CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_READ_FRAC=y CONFIG_FEATURE_SH_HISTFILESIZE=y # diff --git a/packages/sysutils/busybox/config/profile b/packages/sysutils/busybox/config/profile index 77986d235a..79cce3c76a 100644 --- a/packages/sysutils/busybox/config/profile +++ b/packages/sysutils/busybox/config/profile @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # parse command line arguments for arg in $(cat /proc/cmdline); do diff --git a/packages/sysutils/busybox/config/transmission.conf b/packages/sysutils/busybox/config/transmission.conf deleted file mode 100644 index d50663b4b9..0000000000 --- a/packages/sysutils/busybox/config/transmission.conf +++ /dev/null @@ -1,5 +0,0 @@ -# transmission with uTP support -# please comment out the follow line to activate this values: - -# net.core.wmem_max=1048576 -# net.core.rmem_max=4194304 diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk index e386c56986..4d8b2fbd0a 100644 --- a/packages/sysutils/busybox/package.mk +++ b/packages/sysutils/busybox/package.mk @@ -1,116 +1,82 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="busybox" -PKG_VERSION="1.25.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.29.3" +PKG_SHA256="97648636e579462296478e0218e65e4bc1e9cd69089a3b1aeb810bff7621efb7" PKG_LICENSE="GPL" PKG_SITE="http://www.busybox.net" PKG_URL="http://busybox.net/downloads/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="" -PKG_DEPENDS_TARGET="toolchain busybox:host hdparm dosfstools e2fsprogs zip unzip pciutils usbutils parted procps-ng" -PKG_DEPENDS_INIT="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="BusyBox: The Swiss Army Knife of Embedded Linux" -PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAKE_OPTS_HOST="ARCH=$TARGET_ARCH CROSS_COMPILE= KBUILD_VERBOSE=1 install" -PKG_MAKE_OPTS_TARGET="ARCH=$TARGET_ARCH \ - HOSTCC=$HOST_CC \ - CROSS_COMPILE=$TARGET_PREFIX \ - KBUILD_VERBOSE=1 \ - install" -PKG_MAKE_OPTS_INIT="ARCH=$TARGET_ARCH \ - HOSTCC=$HOST_CC \ - CROSS_COMPILE=$TARGET_PREFIX \ - KBUILD_VERBOSE=1 \ - install" +PKG_DEPENDS_TARGET="toolchain busybox:host hdparm dosfstools e2fsprogs zip unzip pciutils usbutils parted procps-ng gptfdisk libtirpc" +PKG_DEPENDS_INIT="toolchain libtirpc" +PKG_LONGDESC="BusyBox combines tiny versions of many common UNIX utilities into a single small executable." +# busybox fails to build with GOLD support enabled with binutils-2.25 +PKG_BUILD_FLAGS="-parallel -gold" # nano text editor - if [ "$NANO_EDITOR" = "yes" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET nano" - fi +if [ "$NANO_EDITOR" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET nano" +fi # nfs support if [ "$NFS_SUPPORT" = yes ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET rpcbind" fi -if [ -f $PROJECT_DIR/$PROJECT/busybox/busybox-target.conf ]; then - BUSYBOX_CFG_FILE_TARGET=$PROJECT_DIR/$PROJECT/busybox/busybox-target.conf -else - BUSYBOX_CFG_FILE_TARGET=$PKG_DIR/config/busybox-target.conf -fi - -if [ -f $PROJECT_DIR/$PROJECT/busybox/busybox-init.conf ]; then - BUSYBOX_CFG_FILE_INIT=$PROJECT_DIR/$PROJECT/busybox/busybox-init.conf -else - BUSYBOX_CFG_FILE_INIT=$PKG_DIR/config/busybox-init.conf -fi - pre_build_target() { + PKG_MAKE_OPTS_TARGET="ARCH=$TARGET_ARCH \ + HOSTCC=$HOST_CC \ + CROSS_COMPILE=$TARGET_PREFIX \ + KBUILD_VERBOSE=1 \ + install" + mkdir -p $PKG_BUILD/.$TARGET_NAME cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME } pre_build_host() { + PKG_MAKE_OPTS_HOST="ARCH=$TARGET_ARCH CROSS_COMPILE= KBUILD_VERBOSE=1 install" + mkdir -p $PKG_BUILD/.$HOST_NAME cp -RP $PKG_BUILD/* $PKG_BUILD/.$HOST_NAME } pre_build_init() { + PKG_MAKE_OPTS_INIT="ARCH=$TARGET_ARCH \ + HOSTCC=$HOST_CC \ + CROSS_COMPILE=$TARGET_PREFIX \ + KBUILD_VERBOSE=1 \ + install" + mkdir -p $PKG_BUILD/.$TARGET_NAME-init cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME-init } configure_host() { - cd $ROOT/$PKG_BUILD/.$HOST_NAME + cd $PKG_BUILD/.$HOST_NAME cp $PKG_DIR/config/busybox-host.conf .config # set install dir - sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$ROOT/$PKG_BUILD/.install_host\"|" .config + sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$PKG_BUILD/.install_host\"|" .config make oldconfig } configure_target() { - cd $ROOT/$PKG_BUILD/.$TARGET_NAME - cp $BUSYBOX_CFG_FILE_TARGET .config + cd $PKG_BUILD/.$TARGET_NAME + find_file_path config/busybox-target.conf + cp $FOUND_PATH .config # set install dir sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL/usr\"|" .config - if [ ! "$DEVTOOLS" = yes ]; then - sed -i -e "s|^CONFIG_DEVMEM=.*$|# CONFIG_DEVMEM is not set|" .config - fi - if [ ! "$CRON_SUPPORT" = "yes" ] ; then sed -i -e "s|^CONFIG_CROND=.*$|# CONFIG_CROND is not set|" .config sed -i -e "s|^CONFIG_FEATURE_CROND_D=.*$|# CONFIG_FEATURE_CROND_D is not set|" .config sed -i -e "s|^CONFIG_CRONTAB=.*$|# CONFIG_CRONTAB is not set|" .config - fi - - if [ ! "$NFS_SUPPORT" = yes ]; then - sed -i -e "s|^CONFIG_FEATURE_MOUNT_NFS=.*$|# CONFIG_FEATURE_MOUNT_NFS is not set|" .config + sed -i -e "s|^CONFIG_FEATURE_CROND_SPECIAL_TIMES=.*$|# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set|" .config fi if [ ! "$SAMBA_SUPPORT" = yes ]; then @@ -120,9 +86,7 @@ configure_target() { # optimize for size CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"` CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"` - - # busybox fails to build with GOLD support enabled with binutils-2.25 - strip_gold + CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/tirpc" LDFLAGS="$LDFLAGS -fwhole-program" @@ -130,8 +94,9 @@ configure_target() { } configure_init() { - cd $ROOT/$PKG_BUILD/.$TARGET_NAME-init - cp $BUSYBOX_CFG_FILE_INIT .config + cd $PKG_BUILD/.$TARGET_NAME-init + find_file_path config/busybox-init.conf + cp $FOUND_PATH .config # set install dir sed -i -e "s|^CONFIG_PREFIX=.*$|CONFIG_PREFIX=\"$INSTALL/usr\"|" .config @@ -139,9 +104,7 @@ configure_init() { # optimize for size CFLAGS=`echo $CFLAGS | sed -e "s|-Ofast|-Os|"` CFLAGS=`echo $CFLAGS | sed -e "s|-O.|-Os|"` - - # busybox fails to build with GOLD support enabled with binutils-2.25 - strip_gold + CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/tirpc" LDFLAGS="$LDFLAGS -fwhole-program" @@ -149,8 +112,8 @@ configure_init() { } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp -R $ROOT/$PKG_BUILD/.install_host/bin/* $ROOT/$TOOLCHAIN/bin + mkdir -p $TOOLCHAIN/bin + cp -R $PKG_BUILD/.install_host/bin/* $TOOLCHAIN/bin } makeinstall_target() { @@ -159,7 +122,6 @@ makeinstall_target() { cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/ cp $PKG_DIR/scripts/lsb_release $INSTALL/usr/bin/ cp $PKG_DIR/scripts/apt-get $INSTALL/usr/bin/ - cp $PKG_DIR/scripts/passwd $INSTALL/usr/bin/ cp $PKG_DIR/scripts/sudo $INSTALL/usr/bin/ cp $PKG_DIR/scripts/pastebinit $INSTALL/usr/bin/ ln -sf pastebinit $INSTALL/usr/bin/paste @@ -176,14 +138,11 @@ makeinstall_target() { cp $PKG_DIR/config/httpd.conf $INSTALL/etc cp $PKG_DIR/config/suspend-modules.conf $INSTALL/etc - mkdir -p $INSTALL/usr/config/sysctl.d - cp $PKG_DIR/config/transmission.conf $INSTALL/usr/config/sysctl.d - # /etc/fstab is needed by... touch $INSTALL/etc/fstab # /etc/machine-id, needed by systemd and dbus - ln -sf /storage/.cache/machine-id $INSTALL/etc/machine-id + ln -sf /storage/.cache/systemd-machine-id $INSTALL/etc/machine-id # /etc/mtab is needed by udisks etc... ln -sf /proc/self/mounts $INSTALL/etc/mtab @@ -200,10 +159,10 @@ makeinstall_target() { } post_install() { - ROOT_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $ROOT_PASSWORD`" + ROOT_PWD="`$TOOLCHAIN/bin/cryptpw -m sha512 $ROOT_PASSWORD`" echo "chmod 4755 $INSTALL/usr/bin/busybox" >> $FAKEROOT_SCRIPT - echo "chmod 000 $INSTALL/etc/shadow" >> $FAKEROOT_SCRIPT + echo "chmod 000 $INSTALL/usr/cache/shadow" >> $FAKEROOT_SCRIPT add_user root "$ROOT_PWD" 0 0 "Root User" "/storage" "/bin/sh" add_group root 0 @@ -240,12 +199,11 @@ makeinstall_init() { touch $INSTALL/etc/fstab ln -sf /proc/self/mounts $INSTALL/etc/mtab - if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/initramfs/platform_init ]; then - cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/initramfs/platform_init $INSTALL - elif [ -f $PROJECT_DIR/$PROJECT/initramfs/platform_init ]; then - cp $PROJECT_DIR/$PROJECT/initramfs/platform_init $INSTALL - fi - if [ -f $INSTALL/platform_init ]; then + if find_file_path initramfs/platform_init; then + cp ${FOUND_PATH} $INSTALL + sed -e "s/@BOOT_LABEL@/$DISTRO_BOOTLABEL/g" \ + -e "s/@DISK_LABEL@/$DISTRO_DISKLABEL/g" \ + -i $INSTALL/platform_init chmod 755 $INSTALL/platform_init fi diff --git a/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch b/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch index 21c0a8fa25..30105bdb18 100644 --- a/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch +++ b/packages/sysutils/busybox/patches/busybox-02_silence-crond-startup-logging.patch @@ -10,11 +10,11 @@ Subject: [PATCH] silence crond startup logging diff -Naur busybox-1.23.0/miscutils/crond.c busybox-1.23.0.patch/miscutils/crond.c --- busybox-1.23.0/miscutils/crond.c 2014-10-04 22:35:59.000000000 +0200 +++ busybox-1.23.0.patch/miscutils/crond.c 2014-12-26 23:07:53.386118290 +0100 -@@ -945,7 +945,6 @@ - - reopen_logfile_to_stderr(); - xchdir(G.crontab_dir_name); +@@ -1054,7 +1054,6 @@ + /* Useful on Android where DEFAULT_SHELL /bin/sh may not exist */ + G.default_shell = xstrdup(get_shell_name()); + - log8("crond (busybox "BB_VER") started, log level %d", G.log_level); rescan_crontab_dir(); write_pidfile(CONFIG_PID_FILE_PATH "/crond.pid"); - + #if ENABLE_FEATURE_CROND_SPECIAL_TIMES diff --git a/packages/sysutils/busybox/patches/busybox-04-revert-dd-fsync-change.patch b/packages/sysutils/busybox/patches/busybox-04-revert-dd-fsync-change.patch new file mode 100644 index 0000000000..e5dabec86a --- /dev/null +++ b/packages/sysutils/busybox/patches/busybox-04-revert-dd-fsync-change.patch @@ -0,0 +1,34 @@ +From 0a61b6174d86fd0300be7cd4fa0b47ff12735958 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Tue, 8 Aug 2017 22:25:03 +0100 +Subject: [PATCH] Revert "dd: call fsync() only once before exiting if + conv=fsync is specified" + +This reverts commit dba0dc1999bb1e8bfe64607e2a9385cda361fcb7. +--- + coreutils/dd.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/coreutils/dd.c b/coreutils/dd.c +index d302f35..bf0c4ab 100644 +--- a/coreutils/dd.c ++++ b/coreutils/dd.c +@@ -531,11 +531,11 @@ int dd_main(int argc UNUSED_PARAM, char **argv) + if (write_and_stats(ibuf, n, obs, outfile)) + goto out_status; + } +- } + +- if (G.flags & FLAG_FSYNC) { +- if (fsync(ofd) < 0) +- goto die_outfile; ++ if (G.flags & FLAG_FSYNC) { ++ if (fsync(ofd) < 0) ++ goto die_outfile; ++ } + } + + if (ENABLE_FEATURE_DD_IBS_OBS && oc) { +-- +2.7.4 + diff --git a/packages/sysutils/busybox/patches/busybox-05-tar.patch b/packages/sysutils/busybox/patches/busybox-05-tar.patch deleted file mode 100644 index 8443315896..0000000000 --- a/packages/sysutils/busybox/patches/busybox-05-tar.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 9655f95d0f501b03b33c7896b7b0c23d090aff81 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Fri, 11 Nov 2016 17:56:45 +0100 -Subject: tar: handle pax-encoded utf8 filenames and link names. Closes 9406 - -Signed-off-by: Denys Vlasenko ---- - archival/libarchive/get_header_tar.c | 32 +++++++++++++++++++++++++------- - testsuite/tar.tests | 20 ++++++++++++++++++++ - testsuite/tar.utf8.tar.bz2 | Bin 0 -> 519 bytes - 3 files changed, 45 insertions(+), 7 deletions(-) - create mode 100644 testsuite/tar.utf8.tar.bz2 - -diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c -index ea91a88..c7e3bc1 100644 ---- a/archival/libarchive/get_header_tar.c -+++ b/archival/libarchive/get_header_tar.c -@@ -113,11 +113,19 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g - value = end + 1; - - # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS -- if (!global && is_prefixed_with(value, "path=")) { -- value += sizeof("path=") - 1; -- free(archive_handle->tar__longname); -- archive_handle->tar__longname = xstrdup(value); -- continue; -+ if (!global) { -+ if (is_prefixed_with(value, "path=")) { -+ value += sizeof("path=") - 1; -+ free(archive_handle->tar__longname); -+ archive_handle->tar__longname = xstrdup(value); -+ continue; -+ } -+ if (is_prefixed_with(value, "linkpath=")) { -+ value += sizeof("linkpath=") - 1; -+ free(archive_handle->tar__linkname); -+ archive_handle->tar__linkname = xstrdup(value); -+ continue; -+ } - } - # endif - -@@ -179,7 +187,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) - * the message and we don't check whether we indeed - * saw zero block directly before this. */ - if (i == 0) { -- bb_error_msg("short read"); -+ /* GNU tar 1.29 will be silent if tar archive ends abruptly -+ * (if there are no zero blocks at all, and last read returns zero, -+ * not short read 0 < len < 512). Complain only if -+ * the very first read fails. Grrr. -+ */ -+ if (archive_handle->offset == 0) -+ bb_error_msg("short read"); - /* this merely signals end of archive, not exit(1): */ - return EXIT_FAILURE; - } -@@ -195,7 +209,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) - archive_handle->offset += i; - - /* If there is no filename its an empty header */ -- if (tar.name[0] == 0 && tar.prefix[0] == 0) { -+ if (tar.name[0] == 0 && tar.prefix[0] == 0 -+ /* Have seen a tar archive with pax 'x' header supplying UTF8 filename, -+ * with actual file having all name fields NUL-filled. Check this: */ -+ && !p_longname -+ ) { - if (archive_handle->tar__end) { - /* Second consecutive empty header - end of archive. - * Read until the end to empty the pipe from gz or bz2 -diff --git a/testsuite/tar.tests b/testsuite/tar.tests -index c44b7ad..ffcbe9b 100755 ---- a/testsuite/tar.tests -+++ b/testsuite/tar.tests -@@ -299,6 +299,26 @@ l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI= - " - SKIP= - -+optional UNICODE_SUPPORT -+testing "Pax-encoded UTF8 names and symlinks" '\ -+tar xvf ../tar.utf8.tar.bz2 2>&1; echo $? -+export LANG=en_US.UTF-8 -+ls -l etc/ssl/certs/* | sed "s:.*etc/:etc/:" -+unset LANG -+rm -rf etc usr -+' "\ -+etc/ssl/certs/3b2716e5.0 -+etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_SaÄŸlayıcısı.pem -+etc/ssl/certs/f80cc7f6.0 -+usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_SaÄŸlayıcısı.crt -+0 -+etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_SaÄŸlayıcısı.pem -+etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_SaÄŸlayıcısı.pem -> /usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_SaÄŸlayıcısı.crt -+etc/ssl/certs/f80cc7f6.0 -> EBG_Elektronik_Sertifika_Hizmet_SaÄŸlayıcısı.pem -+" \ -+"" "" -+SKIP= -+ - - cd .. && rm -rf tar.tempdir || exit 1 - -diff --git a/testsuite/tar.utf8.tar.bz2 b/testsuite/tar.utf8.tar.bz2 -new file mode 100644 -index 0000000..0398e1a -Binary files /dev/null and b/testsuite/tar.utf8.tar.bz2 differ --- -cgit v0.12 - diff --git a/packages/sysutils/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch b/packages/sysutils/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch new file mode 100644 index 0000000000..b2698c9808 --- /dev/null +++ b/packages/sysutils/busybox/patches/busybox-05-update-shadow-or-passwd-not-both.patch @@ -0,0 +1,12 @@ +diff -Naur a/loginutils/passwd.c b/loginutils/passwd.c +--- a/loginutils/passwd.c 2017-07-06 08:14:57.000000000 -0700 ++++ b/loginutils/passwd.c 2017-09-11 17:06:07.572805135 -0700 +@@ -220,7 +220,7 @@ + if (rc > 0) + /* password in /etc/shadow was updated */ + newp = (char*) "x"; +- if (rc >= 0) ++ if (rc == 0) + /* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */ + #endif + { diff --git a/packages/sysutils/busybox/patches/busybox-06-prevent-root-weak-passwd.patch b/packages/sysutils/busybox/patches/busybox-06-prevent-root-weak-passwd.patch new file mode 100644 index 0000000000..932848bfbb --- /dev/null +++ b/packages/sysutils/busybox/patches/busybox-06-prevent-root-weak-passwd.patch @@ -0,0 +1,10 @@ +--- a/loginutils/passwd.c ++++ b/loginutils/passwd.c +@@ -72,7 +72,6 @@ static char* new_password(const struct p + newp = xstrdup(newp); /* we are going to bb_ask_stdin() again, so save it */ + if (ENABLE_FEATURE_PASSWD_WEAK_CHECK + && obscure(orig, newp, pw) +- && myuid != 0 + ) { + goto err_ret; /* non-root is not allowed to have weak passwd */ + } diff --git a/packages/sysutils/busybox/profile.d/98-busybox.conf b/packages/sysutils/busybox/profile.d/98-busybox.conf index c9b9cc5ae4..1b33f5288c 100644 --- a/packages/sysutils/busybox/profile.d/98-busybox.conf +++ b/packages/sysutils/busybox/profile.d/98-busybox.conf @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) export HOME="/storage" export PATH="/usr/bin:/usr/sbin" diff --git a/packages/sysutils/busybox/scripts/apt-get b/packages/sysutils/busybox/scripts/apt-get index 9cd607615e..4a39902768 100755 --- a/packages/sysutils/busybox/scripts/apt-get +++ b/packages/sysutils/busybox/scripts/apt-get @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) message="$message\n There is no working 'apt-get'." message="$message\n " diff --git a/packages/sysutils/busybox/scripts/createlog b/packages/sysutils/busybox/scripts/createlog index 217c6c08e6..f14a697e7f 100755 --- a/packages/sysutils/busybox/scripts/createlog +++ b/packages/sysutils/busybox/scripts/createlog @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # create logfile @@ -24,7 +9,7 @@ DATE=`date -u +%Y-%m-%d-%H.%M.%S` BASEDIR="/tmp" LOGDIR="log-$DATE" RELEASE="`cat /etc/release`" -GIT="`cat /etc/issue |grep git`" +GIT="`cat /etc/issue | grep git`" getlog_cmd() { if command -v $1 >/dev/null; then @@ -74,8 +59,8 @@ rm -rf $BASEDIR/$LOGDIR mkdir -p $BASEDIR/$LOGDIR # kodi.log - LOGFILE="01_KODI.log" - for i in `find /storage/.kodi/temp/ -type f -name "*.log"`; do + LOGFILE="01_PHT.log" + for i in `find /storage/.plexht/temp/ -type f -name "*.log"`; do getlog_cmd cat $i done @@ -163,8 +148,8 @@ mkdir -p $BASEDIR/$LOGDIR # addons LOGFILE="11_Addons.log" - for i in /storage/.kodi/userdata/addon_data/*/*.log \ - /storage/.kodi/userdata/addon_data/*/log/* \ + for i in /storage/.plexht/userdata/addon_data/*/*.log \ + /storage/.plexht/userdata/addon_data/*/log/* \ ; do if [ -f "$i" ] ; then getlog_cmd cat $i diff --git a/packages/sysutils/busybox/scripts/fs-resize b/packages/sysutils/busybox/scripts/fs-resize index a6b9692c25..683ea134ad 100755 --- a/packages/sysutils/busybox/scripts/fs-resize +++ b/packages/sysutils/busybox/scripts/fs-resize @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) if [ -e /storage/.please_resize_me ] ; then . /usr/lib/libreelec/functions @@ -24,7 +10,7 @@ if [ -e /storage/.please_resize_me ] ; then # this sh** was never intended to be used # on already installed and runing system - if [ -d /storage/.kodi -o -d /storage/.config -o -d /storage/.cache ] ; then + if [ -d /storage/.plexht -o -d /storage/.config -o -d /storage/.cache ] ; then rm -f /storage/.please_resize_me sync echo "Resizing is not permitted - the system has already been initialised." @@ -50,28 +36,23 @@ if [ -e /storage/.please_resize_me ] ; then # just in case if [ ! -z "$DISK" -a ! -z "$PART" ] ; then - # get storage partition start - PART_START=$(parted -s -m $DISK unit b print 2>/dev/null | grep -v ^/dev | grep -v BYT | grep ^2: | cut -f2 -d ":") - - # failed to get partition start offset ? - if [ ! -z "$PART_START" ] ; then - umount $PART - - echo "PARTITION RESIZING IN PROGRESS" - echo "" - echo "Please do not reboot or turn off your @DISTRONAME@ device!" - echo "" + umount $PART - # fix any minor issues, such as gpt header not at end of disk - StartProgress spinner "Checking layout... " "parted $DISK print fix &>/dev/null" + echo "PARTITION RESIZING IN PROGRESS" + echo "" + echo "Please do not reboot or turn off your @DISTRONAME@ device!" + echo "" - StartProgress spinner "Deleting /storage... " "parted -s -m $DISK rm 2 &>/dev/null" - StartProgress spinner "Creating /storage... " "parted -s -m $DISK unit b mkpart primary $PART_START 100% &>/dev/null" - StartProgress spinner "Checking /storage... " "e2fsck -f -p $PART &>/dev/null" - StartProgress spinner "Resizing /storage... " "resize2fs $PART &>/dev/null" - - StartProgress countdown "Rebooting in 15s... " 15 "NOW" + # identify the partition scheme, and if gpt fix minor issues such as gpt header not at end of disk + SCHEME=$(blkid -s PTTYPE -o value $DISK) + if [ "$SCHEME" = "gpt" ]; then + StartProgress spinner "Checking layout... " "sgdisk -e $DISK &>/dev/null" fi + + StartProgress spinner "Resizing partition... " "parted -s -m $DISK resizepart 2 100% &>/dev/null" + StartProgress spinner "Checking file system... " "e2fsck -f -p $PART &>/dev/null" + StartProgress spinner "Resizing file system... " "resize2fs $PART &>/dev/null" + StartProgress countdown "Rebooting in 15s... " 15 "NOW" fi fi reboot -f &>/dev/null diff --git a/packages/sysutils/busybox/scripts/functions b/packages/sysutils/busybox/scripts/functions index fb31490d56..490c01e02d 100755 --- a/packages/sysutils/busybox/scripts/functions +++ b/packages/sysutils/busybox/scripts/functions @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Neil MacLeod (milhouse@kodi.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # Need a read/write location, as tmp may not always be available mkdir -p /dev/.progress @@ -159,7 +144,7 @@ ProgressTask_Countdown() { while [ ${countfrom} -gt 0 ]; do echo ${countfrom} | awk '{ printf "\b\b%2d", $1 }' - sleep 1 + read -r -s -t1 && break countfrom=$((countfrom - 1)) done diff --git a/packages/sysutils/busybox/scripts/getedid b/packages/sysutils/busybox/scripts/getedid index ab0b95e4ce..b647fe64a9 100755 --- a/packages/sysutils/busybox/scripts/getedid +++ b/packages/sysutils/busybox/scripts/getedid @@ -1,46 +1,27 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ -# + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # # exit 1 = unsupported GPU # exit 2 = dual boot system -# exit 3 = no backup file, therefore no restore +# exit 3 = no backup for syslinux.cfg or extlinux.conf # exit 4 = extlinux.conf and syslinux.cfg are available # exit 5 = changes are already made either to extlinux.conf or syslinux.cfg # exit 6 = xorg.conf already exists in /storage/.config -# exit 7 = no xorg.conf in /storage/.config -# exit 8 = more than a single device detected +# exit 7 = more than a single device detected # Help message and usage explanation help() { - clear echo "This script generates a custom EDID depending on your GPU" echo "" echo "To check which GPU you are using, use: getedid gpu" echo "" - echo "To create a custon EDID, just use this script like: getedid create" - echo "" - echo "If you have already used this script and wish to restore original behaviour, use: getedid default" + echo "To create a custom EDID, just use this script like: getedid create" echo "" echo "If you don't want to use the created EDID file anymore use: getedid delete" echo "" - echo "If you hardware has changed and you want to have a custom EDID again, then you have to delete the old EDID first." + echo "If your hardware or kernel has changed and you want to have a custom EDID again, then you have to delete the old EDID first." echo "For this use: getedid delete " echo "And then use: getedid create" } @@ -48,8 +29,8 @@ help() { # check for GPU and store string check_gpu() { - if lspci | grep -i vga | grep -i -q intel ; then - gpu="intel" + if lspci | grep -i vga | grep -i -q -E 'intel|amd' ; then + gpu="intel/amd" elif lspci | grep -i vga | grep -i -q nvidia; then gpu="nvidia" else @@ -61,7 +42,7 @@ check_gpu() { # run this first if the user already has a custom EDID but want to create a new one (TV or AVR change) del_edid() { - if [ "$gpu" = "intel" ]; then + if [ "$gpu" = "intel/amd" ]; then check_file if [ -f "$file".old ]; then mount_rw @@ -69,11 +50,10 @@ del_edid() { mv "$file".old "$file" rm -f /flash/edid.cpio mount_ro - rm -fr /storage/.config/firmware sys_reboot else echo "You don't have a backup file for $file. You did not use this script to create the custom EDID" - echo "Therefore we can't be sure the script is working prooerly. Exiting" + echo "Therefore we can't be sure the script is working properly. Exiting" exit 3 fi else @@ -86,8 +66,8 @@ del_edid() { # run main script depending on the GPU run() { - if [ "$gpu" = "intel" ]; then - intel + if [ "$gpu" = "intel/amd" ]; then + intel_amd elif [ "$gpu" = "nvidia" ]; then nvidia fi @@ -118,7 +98,7 @@ sys_reboot() { # check syslinux.cfg and/or extlinux.conf check_file() { # check boot system - if [ -d /sys/firmware/efi ]; then + if [ -d /sys/firmware/efi -a -f /flash/EFI/BOOT/syslinux.cfg ] ; then sys_boot="UEFI" sys_path="/flash/EFI/BOOT" else @@ -126,7 +106,7 @@ check_file() { sys_path="/flash" fi - #check which file is available + # check which file is available if [ -f "$sys_path/syslinux.cfg" -a -f "$sys_path/extlinux.conf" ]; then echo "Your system contains both a /flash/syslinux.cfg and a /flash/extlinux.conf file" echo "Something is wrong on your system. Exiting" @@ -145,41 +125,32 @@ check_file() { check_content() { # check if changes are already made to $file and exit if yes - if grep -q "initrd=/edid.cpio drm_kms_helper.edid_firmware=" $file ; then - echo "$file has been modified. Exiting." + if grep -q "initrd=/edid.cpio" $file ; then + echo "$file has been modified. Please run 'getedid delete' first if you want to modify it again. Exiting." exit 5 fi } -# restore the backup done by the script and depending on the GPU -restore() { - if [ "$gpu" = "intel" ]; then - check_file - if [ -f "$file".old ]; then - mount_rw - cp "$file".old "$file" # cp because of keeping the backup...just in case - sys_reboot - else - echo "You have not created a custom EDID yet, or you did not use this script for this task." - echo "Therefore we can't ensure the script is working properly." - echo "Exiting" - exit 3 - fi - elif [ "$gpu" = "nvidia" ]; then - if [ -f /storage/.config/xorg.conf ]; then - mv /storage/.config/xorg.conf /storage/.config/xorg.le.backup - systemctl restart xorg.service - else - echo "You don't have a xorg.conf in your .config folder. Everything is already at default. Exiting" - exit 7 - fi - fi +check_kernel() { + # determine which kernel is in use and store it in a compareable format. This will probably be deprecated for LE10 + kernel="$(uname -r | sed 's/[^0-9\.].*//g' | awk -F. '{ printf "%d%02d%03d\n",int($1),int($2),int($3) }')" +} + + +create_edid() { + # create edid + mkdir -p /tmp/cpio/lib/firmware/edid + cat "/sys/class/drm/$card/edid" > /tmp/cpio/lib/firmware/edid/edid.bin + + # create cpio archive + cd /tmp/cpio/ + find . -print | cpio -ov -H newc > /storage/edid.cpio } -intel() { - #check which output is connnected: +intel_amd() { + # check which output is connnected: counter=0 for i in /sys/class/drm/*; do if [ "$(cat "$i"/status 2>/dev/null)" = "connected" ]; then @@ -189,39 +160,36 @@ intel() { hdmi="$(echo "$i" | cut -d / -f 5 | sed 's/card[0-9]-//g')" else echo "More than a single device connected. Probably enable \"Disable all other monitors\" at Kodi settings. Aborting!" - exit 8 + exit 7 fi fi done - #create edid - mkdir -p /storage/.config/firmware/edid - cat "/sys/class/drm/$card/edid" > /storage/.config/firmware/edid/edid.bin + # create the edid + create_edid - #create cpio archive - cd /storage - mkdir -p cpio/lib/firmware/edid - cp /storage/.config/firmware/edid/edid.bin /storage/cpio/lib/firmware/edid/ - cd cpio/ - find . -print | cpio -ov -H newc > /storage/edid.cpio - cd /storage - rm -rf cpio - - #check extlinux.conf and syslinux.cfg + # check extlinux.conf and syslinux.cfg check_file check_content - #remount /flash to rw + # remount /flash to rw mount_rw mv /storage/edid.cpio /flash # make a backup of $file cp "$file" "$file".old + + #check kernel version + check_kernel - #add things to $file - sed -i "/ APPEND/s/$/ initrd=\/edid.cpio drm_kms_helper.edid_firmware=$hdmi:edid\/edid.bin video=$hdmi:D/" "$file" + # add boot parameters to $file in relation to the used kernel + if [ "$kernel" -lt "415000" ]; then + sed -i "/ APPEND/s/$/ initrd=\/edid.cpio drm_kms_helper.edid_firmware=$hdmi:edid\/edid.bin video=$hdmi:D/" "$file" + else + sed -i "/ APPEND/s/$/ initrd=\/edid.cpio drm.edid_firmware=edid\/edid.bin/" "$file" + fi - #reboot + # reboot sys_reboot } @@ -238,7 +206,7 @@ nvidia() { monitors="$(grep -i -w "connected" /var/log/Xorg.0.log | grep -i -o "dfp-[0-9]" | sort -u | wc -l)" if [ "$monitors" -gt "1" ]; then echo "You have more than a single monitor connected. The script doesn't support a multi-monitor setup. Aborting!" - exit 8 + exit 7 fi @@ -257,7 +225,7 @@ nvidia() { # set port and uncomment lines sed -i "s/# Option \"ConnectedMonitor\" \"DFP-0\"/ Option \"ConnectedMonitor\" \"$nv_port\"/g" /storage/.config/xorg.conf - sed -i "s/# Option \"CustomEDID\" \"DFP-0:\/storage\/.config\/edid.bin\"/ Option \"CustomEDID\" \"\"$nv_port\":\/storage\/.config\/edid.bin\"/g" /storage/.config/xorg.conf + sed -i "s/# Option \"CustomEDID\" \"DFP-0:\/storage\/.config\/edid.bin\"/ Option \"CustomEDID\" \"$nv_port:\/storage\/.config\/edid.bin\"/g" /storage/.config/xorg.conf sed -i "s/# Option \"IgnoreEDID\" \"false\"/ Option \"IgnoreEDID\" \"false\"/g" /storage/.config/xorg.conf sed -i "s/# Option \"UseEDID\" \"true\"/ Option \"UseEDID\" \"true\"/g" /storage/.config/xorg.conf @@ -272,10 +240,6 @@ case "$1" in check_gpu run ;; - 'default') - check_gpu - restore - ;; 'gpu') check_gpu echo "$gpu" @@ -288,6 +252,6 @@ case "$1" in help ;; *) - echo "Usage $0 { create | default | gpu | delete | help }" + echo "Usage $0 { create | gpu | delete | help }" ;; esac diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init index 20f8651fd7..09099d9c37 100755 --- a/packages/sysutils/busybox/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -1,24 +1,10 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) -# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) +# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # create directories /usr/bin/busybox mkdir -p /dev @@ -45,7 +31,7 @@ UPDATE_KERNEL="KERNEL" UPDATE_SYSTEM="SYSTEM" - IMAGE_KERNEL="KERNEL" + IMAGE_KERNEL="@KERNEL_NAME@" IMAGE_SYSTEM="SYSTEM" BOOT_STEP="start" @@ -53,15 +39,18 @@ RUN_FSCK="yes" RUN_FSCK_DISKS="" SYSLINUX_DEFAULT="" + GRUB_DEFAULT="" NBD_DEVS="0" FLASH_FREE_MIN="5" - INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'` + INSTALLED_MEMORY=$(cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}') SYSTEM_TORAM_LIMIT=1024000 LIVE="no" + BREAK_TRIPPED="no" + # Get a serial number if present (eg. RPi) otherwise use MAC address from eth0 MACHINE_UID="$(cat /proc/cpuinfo | awk '/^Serial/{s=$3; gsub ("^0*","",s); print s}')" [ -z "$MACHINE_UID" ] && MACHINE_UID="$(cat /sys/class/net/eth0/address 2>/dev/null | tr -d :)" @@ -88,9 +77,11 @@ case $arg in BOOT_IMAGE=*) IMAGE_KERNEL="${arg#*=}" + [ "${IMAGE_KERNEL:0:1}" = "/" ] && IMAGE_KERNEL="${IMAGE_KERNEL:1}" ;; SYSTEM_IMAGE=*) IMAGE_SYSTEM="${arg#*=}" + [ "${IMAGE_SYSTEM:0:1}" = "/" ] && IMAGE_SYSTEM="${IMAGE_SYSTEM:1}" ;; boot=*) boot="${arg#*=}" @@ -144,6 +135,9 @@ noram) SYSTEM_TORAM=no ;; + ramlimit=*) + SYSTEM_TORAM_LIMIT="${arg#*=}" + ;; live) LIVE=yes SYSLINUX_DEFAULT="live" @@ -151,6 +145,13 @@ portable) SYSLINUX_DEFAULT="run" ;; + grub_live) + LIVE=yes + GRUB_DEFAULT="Live" + ;; + grub_portable) + GRUB_DEFAULT="Run" + ;; overlay) OVERLAY=yes ;; @@ -182,27 +183,35 @@ } debug_shell() { - echo "### Starting debugging shell... type exit to quit ###" + echo "### Starting debugging shell for boot step: $BOOT_STEP... type exit to quit ###" showcursor - sh /dev/tty1 2>&1 + setsid cttyhack sh } error() { # Display fatal error message # $1:action which caused error, $2:message + # Send debug_shell output to stderr, in case caller is redirecting/consuming stdout + # Return exitcode=1 so that called may detect when an error has occurred echo "*** Error in $BOOT_STEP: $1: $2 ***" >&2 - debug_shell + debug_shell >&2 + return 1 } break_after() { - # Start debug shell after boot step $1 - case $BREAK in - all|*$1*) - debug_shell - ;; - esac + # Start debug shell after boot step $1, and all subsequent steps + if [ $BREAK_TRIPPED == yes ]; then + debug_shell + else + case $BREAK in + all|*$1*) + BREAK_TRIPPED=yes + debug_shell + ;; + esac + fi } # Mount handlers @@ -221,7 +230,8 @@ usleep 1000000 done - [ "$ERR_ENV" -ne "0" ] && error "mount_common" "Could not mount $1" + [ "$ERR_ENV" -eq "0" ] && return 0 + error "mount_common" "Could not mount $1" } get_iscsistart_options() { @@ -301,7 +311,7 @@ mount_common "$NBD_DEV" "$2" "$3" "$4" - NBD_DEVS=$(( ${NBD_DEVS} + 1 )) + NBD_DEVS=$(( NBD_DEVS + 1 )) } mount_nfs() { @@ -356,7 +366,7 @@ # mount the specified SYSTEM file and output arch from /etc/os-release get_project_arch() { - mount_part "$1" "/sysroot" "ro,loop" + mount_part "$1" "/sysroot" "ro,loop" || return if [ -f /sysroot/etc/os-release ]; then . /sysroot/etc/os-release @@ -393,8 +403,10 @@ local update_filename="${1}" local old_system="${2}" local new_system="${3}" - local old_project_arch="$(get_project_arch "${old_system}")" - local new_project_arch="$(get_project_arch "${new_system}")" + local old_project_arch new_project_arch + + old_project_arch="$(get_project_arch "${old_system}")" || return + new_project_arch="$(get_project_arch "${new_system}")" || return # If old or new project/arch isn't available then could be very old (pre-/etc/os-release) build - have to trust it if [ -n "${old_project_arch}" -a -n "${new_project_arch}" ]; then @@ -440,7 +452,7 @@ if [ -f "$UPDATE_DIR/$2" -a -b "$3" ]; then StartProgress spinner "Updating $1... " - result="$(dd if="$UPDATE_DIR/$2" of="$3" conv=fsync 2>&1)" + result="$(dd if="$UPDATE_DIR/$2" of="$3" 2>&1)" StopProgress "done" echo "${result}" fi @@ -455,7 +467,7 @@ mount_part "/flash/$IMAGE_SYSTEM" "/sysroot" "ro,loop" if [ -f $SYSTEM_ROOT/usr/share/bootloader/update.sh ]; then - StartProgress spinner "Updating Bootloader... " + StartProgress spinner "Updating Boot Files... " result="$(sh $SYSTEM_ROOT/usr/share/bootloader/update.sh 2>&1)" sync StopProgress "done" @@ -649,6 +661,10 @@ wakeonlan mount_part "$boot" "/flash" "ro,noatime" + + if [ -f /flash/post-flash.sh ] ; then + . /flash/post-flash.sh + fi } mount_storage() { @@ -664,7 +680,7 @@ if [ -n "$disk" ]; then if [ -n "$OVERLAY" ]; then - OVERLAY_DIR=`cat /sys/class/net/eth0/address | tr -d :` + OVERLAY_DIR=$(cat /sys/class/net/eth0/address | tr -d :) mount_part "$disk" "/storage" "rw,noatime" mkdir -p /storage/$OVERLAY_DIR @@ -679,7 +695,12 @@ disk="$target/$OVERLAY_DIR,$options" fi fi - mount_part "$disk" "/storage" "rw,noatime" + + if [ -f /flash/mount-storage.sh ] ; then + . /flash/mount-storage.sh + else + mount_part "$disk" "/storage" "rw,noatime" + fi else # /storage should always be writable mount -t tmpfs none /storage @@ -687,7 +708,7 @@ } # Make last bootloader label (installer, live, run etc.) as the new default - update_syslinux() { + update_bootmenu() { local crnt_default if [ -n "$SYSLINUX_DEFAULT" -a -f /flash/syslinux.cfg ]; then @@ -698,7 +719,21 @@ mount -o remount,rw /flash sed -i "s/^DEFAULT .*/DEFAULT $SYSLINUX_DEFAULT/" /flash/syslinux.cfg - [ -f /flash/EFI/BOOT/syslinux.cfg ] && cp /flash/syslinux.cfg /flash/EFI/BOOT/syslinux.cfg + rm -f /flash/EFI/BOOT/syslinux.cfg + mount -o remount,ro /flash + fi + fi + fi + + if [ -n "$GRUB_DEFAULT" -a -f /flash/EFI/BOOT/grub.cfg ]; then + if grep -q "^menuentry \"$GRUB_DEFAULT\"" /flash/EFI/BOOT/grub.cfg; then + crnt_default="$(awk '/^set default/ {print substr($2,9,19)}' /flash/EFI/BOOT/grub.cfg)" + if [ ! "$crnt_default" = "\"$GRUB_DEFAULT\"" ]; then + progress "Updating /flash/EFI/BOOT/grub.cfg [$crnt_default -> \"$GRUB_DEFAULT\"]" + + mount -o remount,rw /flash + sed -i "s/^set default=.*/set default=\"$GRUB_DEFAULT\"/" /flash/EFI/BOOT/grub.cfg + rm -f /flash/grub.cfg mount -o remount,ro /flash fi fi @@ -750,9 +785,9 @@ check_update() { progress "Checking for updates" - UPDATE_TAR=`ls -1 "$UPDATE_DIR"/*.tar 2>/dev/null | head -n 1` - UPDATE_IMG_GZ=`ls -1 "$UPDATE_DIR"/*.img.gz 2>/dev/null | head -n 1` - UPDATE_IMG=`ls -1 "$UPDATE_DIR"/*.img 2>/dev/null | head -n 1` + UPDATE_TAR=$(ls -1 "$UPDATE_DIR"/*.tar 2>/dev/null | head -n 1) + UPDATE_IMG_GZ=$(ls -1 "$UPDATE_DIR"/*.img.gz 2>/dev/null | head -n 1) + UPDATE_IMG=$(ls -1 "$UPDATE_DIR"/*.img 2>/dev/null | head -n 1) if ! [ -f "$UPDATE_DIR/$UPDATE_KERNEL" -a -f "$UPDATE_DIR/$UPDATE_SYSTEM" ] && ! [ -f "$UPDATE_TAR" -o -f "$UPDATE_IMG_GZ" -o -f "$UPDATE_IMG" ]; then @@ -766,8 +801,16 @@ return 0 fi - # remove temporary folder if exist from previous run - rm -fr "$UPDATE_DIR/.tmp" &>/dev/null + if [ -d $UPDATE_DIR/.tmp ]; then + echo "Failed update detected - performing recovery." + echo "" + do_cleanup + StartProgress countdown "Normal startup in 10s... " 10 "NOW" + return 0 + fi + + mkdir -p $UPDATE_DIR/.tmp &>/dev/null + sync echo "UPGRADE IN PROGRESS" echo "" @@ -780,7 +823,6 @@ echo "Found new .tar archive" UPDATE_FILENAME="$UPDATE_TAR" StartProgress spinner "Extracting contents of archive... " - mkdir -p $UPDATE_DIR/.tmp &>/dev/null tar -xf "$UPDATE_TAR" -C $UPDATE_DIR/.tmp 1>/dev/null 2>/tmp/tarresult.txt || TARRESULT="1" if [ "${TARRESULT}" -eq "0" ]; then @@ -834,7 +876,7 @@ losetup $LOOP $IMG_FILE # check for MBR partititon - OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^[ ]*Device/{part=1; next}; part{if ($2 == "*") {print $3} else {print $2} ; exit}') + OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^[ ]*Device/{part=1; next}; part{if ($2 == "*") {print $5} else {print $4} ; exit}') if [ -z "$OFFSET" ]; then # check for GPT partititon OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^Number/{part=1; next}; part{print $2; exit}') @@ -860,21 +902,24 @@ # don't make temporary files but instead copy # directly from mountpoint to /flash UPDATE_DIR=$UPDATE_ROOT/.tmp/mnt - if [ ! -b $IMAGE_KERNEL -o -z "@KERNEL_NAME@" ]; then - UPDATE_KERNEL=$(basename $IMAGE_KERNEL) - else - UPDATE_KERNEL="@KERNEL_NAME@" - fi + UPDATE_KERNEL="@KERNEL_NAME@" else UPDATE_FILENAME="$UPDATE_DIR/$UPDATE_SYSTEM" fi sync + if [ ! -b "/$IMAGE_KERNEL" -a ! -f "/flash/$IMAGE_KERNEL" ] || [ ! -f "/flash/$IMAGE_SYSTEM" ]; then + echo "Missing (target) ${IMAGE_KERNEL} or ${IMAGE_SYSTEM}!" + do_cleanup + StartProgress countdown "Normal startup in 30s... " 30 "NOW" + return 0 + fi + if [ ! -f "$UPDATE_DIR/$UPDATE_KERNEL" -o ! -f "$UPDATE_DIR/$UPDATE_SYSTEM" ] ; then - echo "Missing ${UPDATE_KERNEL} or ${UPDATE_SYSTEM}!" + echo "Missing (source) ${UPDATE_KERNEL} or ${UPDATE_SYSTEM}!" do_cleanup - StartProgress countdown "Normal startup in 10s... " 10 "NOW" + StartProgress countdown "Normal startup in 30s... " 30 "NOW" return 0 fi @@ -933,7 +978,7 @@ FLASH_FREE=$(( $FLASH_FREE * 1024 )) # Disregard kernel size if it's a a block device, which is the case on Amlogic/WeTek devices - if [ ! -b $IMAGE_KERNEL ]; then + if [ ! -b "/$IMAGE_KERNEL" ]; then OLD_KERNEL=$(stat -t "/flash/$IMAGE_KERNEL" | awk '{print $2}') else OLD_KERNEL="0" @@ -946,8 +991,8 @@ # old KERNEL+SYSTEM+free space - new KERNEL+SYSTEM must be higher than 5MB # at least 5MB free after update - TMP_SIZE=$(($OLD_KERNEL+$OLD_SYSTEM+$FLASH_FREE-$NEW_KERNEL-$NEW_SYSTEM)) - FLASH_FREE_MIN=$(($FLASH_FREE_MIN*1024*1024)) + TMP_SIZE=$((OLD_KERNEL + OLD_SYSTEM + FLASH_FREE - NEW_KERNEL - NEW_SYSTEM)) + FLASH_FREE_MIN=$((FLASH_FREE_MIN * 1024 * 1024)) if [ $TMP_SIZE -ge $FLASH_FREE_MIN ]; then echo "Checking size: OK" @@ -967,8 +1012,8 @@ fi # all ok, update - if [ -b $IMAGE_KERNEL ]; then - update_partition "Kernel" "$UPDATE_KERNEL" "$IMAGE_KERNEL" + if [ -b "/$IMAGE_KERNEL" ]; then + update_partition "Kernel" "$UPDATE_KERNEL" "/$IMAGE_KERNEL" else update_file "Kernel" "$UPDATE_KERNEL" "/flash/$IMAGE_KERNEL" fi @@ -991,9 +1036,9 @@ mount --move /flash /sysroot/flash mount --move /storage /sysroot/storage - if [ ! -d "/sysroot/usr/lib/modules/$(uname -r)/" -a -f "/sysroot/usr/lib/systemd/systemd" ]; then + if [ ! -d "/sysroot/usr/lib/kernel-overlays/base/lib/modules/$(uname -r)/" -a -f "/sysroot/usr/lib/systemd/systemd" ]; then echo "" - echo "NEVER TOUCH boot= in extlinux.conf / cmdline.txt!" + echo "NEVER TOUCH boot= in syslinux.conf / cmdline.txt!" echo "If you don't know what you are doing," echo "your installation is now broken." echo "" @@ -1003,6 +1048,10 @@ [ -f "/sysroot/usr/lib/systemd/systemd" ] || error "final_check" "Could not find systemd!" } + # If the network is up (due to the use of the "ip" kernel parameter) and a DNS + # server is known, allow the libc resolver to use it + grep '^\(nameserver\|domain\) ' /proc/net/pnp | grep -v '^nameserver 0\.0\.0\.0$' > /etc/resolv.conf + if [ "${boot%%=*}" = "FILE" ]; then error "check arguments" "boot argument can't be FILE type..." fi @@ -1014,7 +1063,7 @@ load_modules \ check_disks \ mount_flash \ - update_syslinux \ + update_bootmenu \ load_splash \ mount_storage \ check_update \ @@ -1049,6 +1098,11 @@ if [ "$UPDATE_DISABLED" = "yes" ] ; then echo "" > /sysroot/dev/.update_disabled fi + + if [ "$FLASH_NETBOOT" = "yes" ] ; then + echo "" > /sysroot/dev/.flash_netboot + fi + # swap can not be used over nfs.(see scripts/mount-swap) if [ "$STORAGE_NETBOOT" = "yes" ] ; then echo "" > /sysroot/dev/.storage_netboot @@ -1058,7 +1112,7 @@ INIT_UNIT="--unit=fs-resize.target" fi - BACKUP_FILE=`ls -1 /sysroot/storage/.restore/??????????????.tar 2>/dev/null | head -n 1` + BACKUP_FILE=$(ls -1 /sysroot/storage/.restore/??????????????.tar 2>/dev/null | head -n 1) if [ -f "$BACKUP_FILE" ] ; then INIT_UNIT="--unit=backup-restore.target" fi diff --git a/packages/sysutils/busybox/scripts/lsb_release b/packages/sysutils/busybox/scripts/lsb_release index 6d32401d05..54e880e9f9 100755 --- a/packages/sysutils/busybox/scripts/lsb_release +++ b/packages/sysutils/busybox/scripts/lsb_release @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # show release information . /etc/os-release diff --git a/packages/sysutils/busybox/scripts/passwd b/packages/sysutils/busybox/scripts/passwd deleted file mode 100755 index b413879a05..0000000000 --- a/packages/sysutils/busybox/scripts/passwd +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -message="$message\n There is no working 'passwd'." -message="$message\n" -message="$message\n The 'passwd' command changes passwords for user accounts." -message="$message\n" -message="$message\n With LibreELEC it is not possible to change the system password" -message="$message\n" -message="$message\n SSH is included only as a last support resort. SSH is off by default." -message="$message\n Most users never need SSH and need help using it so we need a default" -message="$message\n password. If you need to keep SSH always on then this is unsupported" -message="$message\n but can be secured with certificates." -message="$message\n" -message="$message\n TIP: disable password authentication in ssh and use public key authentication." - -echo -e $message diff --git a/packages/sysutils/busybox/scripts/pastebinit b/packages/sysutils/busybox/scripts/pastebinit index 43b9f18b82..5ba3a88400 100755 --- a/packages/sysutils/busybox/scripts/pastebinit +++ b/packages/sysutils/busybox/scripts/pastebinit @@ -1,26 +1,10 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) -# -# wrapper for curl, posting to the sprunge.us pastebin -# reads from stdin if called without an argument -# - -cat "$@" | curl -F 'sprunge=<-' http://sprunge.us +if [ -n "${PASTEUSR}" -a "${PASTEPWD}" ]; then + cat "$@" | curl -F 'f:1=<-' ${PASTEUSR}:${PASTEPWD}@ix.io +else + cat "$@" | curl -F 'f:1=<-' http://ix.io +fi diff --git a/packages/sysutils/busybox/scripts/sudo b/packages/sysutils/busybox/scripts/sudo index 67a2513390..6dc03ee040 100755 --- a/packages/sysutils/busybox/scripts/sudo +++ b/packages/sysutils/busybox/scripts/sudo @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) message="$message\n There is no working 'sudo'." message="$message\n " diff --git a/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh b/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh index 110959e27c..7e907c92c9 100755 --- a/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh +++ b/packages/sysutils/busybox/sleep.d.serial/99-suspend-modules.sh @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/suspend-modules.conf diff --git a/packages/sysutils/busybox/system.d/var.mount b/packages/sysutils/busybox/system.d/var.mount index 2207fa61a8..1eea76fa0d 100644 --- a/packages/sysutils/busybox/system.d/var.mount +++ b/packages/sysutils/busybox/system.d/var.mount @@ -10,7 +10,6 @@ Description=Variable Directory Documentation=man:hier(7) Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems DefaultDependencies=no -Conflicts=umount.target Before=local-fs.target umount.target [Mount] diff --git a/packages/sysutils/busybox/tmpfiles.d/z_01_busybox.conf b/packages/sysutils/busybox/tmpfiles.d/z_01_busybox.conf index f2345b3406..2bc4684981 100644 --- a/packages/sysutils/busybox/tmpfiles.d/z_01_busybox.conf +++ b/packages/sysutils/busybox/tmpfiles.d/z_01_busybox.conf @@ -1,25 +1,8 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -d /var/lock 0755 root root - - d /var/media 0755 root root - - -f /var/run/utmp 1777 root root - - d /storage/backup 0755 root root - - d /storage/.update 0755 root root - - d /storage/.cache/cores 0755 root root - - diff --git a/packages/sysutils/dbus/package.mk b/packages/sysutils/dbus/package.mk index a57768e94e..9d31dd48a7 100644 --- a/packages/sysutils/dbus/package.mk +++ b/packages/sysutils/dbus/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="dbus" -PKG_VERSION="1.10.14" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.11.16" +PKG_SHA256="7cf993e97df62c73b939b77dcd920e8883d8e866f9ced1a9b5c715eb28e4b031" PKG_LICENSE="GPL" PKG_SITE="https://dbus.freedesktop.org" PKG_URL="https://dbus.freedesktop.org/releases/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain expat systemd" -PKG_SECTION="system" -PKG_SHORTDESC="dbus: simple interprocess messaging system" -PKG_LONGDESC="D-Bus is a message bus, used for sending messages between applications. This package contains the D-Bus daemon and related utilities and the dbus shared library." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="D-Bus is a message bus, used for sending messages between applications." PKG_CONFIGURE_OPTS_TARGET="export ac_cv_have_abstract_sockets=yes \ --with-sysroot=$SYSROOT_PREFIX \ @@ -49,7 +28,9 @@ PKG_CONFIGURE_OPTS_TARGET="export ac_cv_have_abstract_sockets=yes \ --enable-inotify \ --without-valgrind \ --without-x \ - --with-dbus-user=dbus" + --with-dbus-user=dbus \ + --runstatedir=/run \ + --with-system-socket=/run/dbus/system_bus_socket" post_makeinstall_target() { rm -rf $INSTALL/etc/rc.d diff --git a/packages/sysutils/dbus/tmpfiles.d/z_02_dbus.conf b/packages/sysutils/dbus/tmpfiles.d/z_02_dbus.conf index 66e89dade6..1f20d1ae47 100644 --- a/packages/sysutils/dbus/tmpfiles.d/z_02_dbus.conf +++ b/packages/sysutils/dbus/tmpfiles.d/z_02_dbus.conf @@ -1,22 +1,7 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /var/lib/dbus 0755 root root - - -d /var/run/dbus 0755 root root - - +d /run/dbus 0755 root root - - L /var/lib/dbus/machine-id - - - - /etc/machine-id diff --git a/packages/sysutils/diskdev_cmds/package.mk b/packages/sysutils/diskdev_cmds/package.mk index 33fbf6b4ec..d02f6cf026 100644 --- a/packages/sysutils/diskdev_cmds/package.mk +++ b/packages/sysutils/diskdev_cmds/package.mk @@ -1,39 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="diskdev_cmds" PKG_VERSION="332.14" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="a46bec392661a02d9683355baf4442d494e2bcde0ffb094aacc1e57ddc03b3d4" PKG_LICENSE="APSL" PKG_SITE="http://src.gnu-darwin.org/DarwinSourceArchive/expanded/diskdev_cmds/" PKG_URL="http://www.opensource.apple.com/tarballs/diskdev_cmds/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain libressl" -PKG_SECTION="system" -PKG_SHORTDESC="diskdev_cmds: hfs filesystem utilities" +PKG_DEPENDS_TARGET="toolchain openssl" PKG_LONGDESC="The fsck and mkfs utliities for hfs and hfsplus filesystems." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAKE_OPTS_TARGET="-f Makefile.lnx CC=$CC" - pre_make_target() { + PKG_MAKE_OPTS_TARGET="-f Makefile.lnx CC=$CC" + export CFLAGS="$TARGET_CFLAGS -g3 -Wall -I$PKG_BUILD/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1" } diff --git a/packages/sysutils/dosfstools/package.mk b/packages/sysutils/dosfstools/package.mk index 3907a14774..6f8c72b92b 100644 --- a/packages/sysutils/dosfstools/package.mk +++ b/packages/sysutils/dosfstools/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="dosfstools" PKG_VERSION="3.0.28" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="ee95913044ecf2719b63ea11212917649709a6e53209a72d622135aaa8517ee2" PKG_LICENSE="GPLv3" PKG_SITE="https://github.com/dosfstools/dosfstools" PKG_URL="https://github.com/dosfstools/dosfstools/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" PKG_DEPENDS_INIT="toolchain dosfstools" -PKG_SECTION="tools" -PKG_SHORTDESC="dosfstools: utilities for making and checking MS-DOS FAT filesystems." PKG_LONGDESC="dosfstools contains utilities for making and checking MS-DOS FAT filesystems." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_MAKE_OPTS_TARGET="PREFIX=/usr" PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr" @@ -45,7 +24,7 @@ pre_build_host() { } make_host() { - cd $ROOT/$PKG_BUILD/.$HOST_NAME + cd $PKG_BUILD/.$HOST_NAME make PREFIX=/usr } @@ -57,7 +36,7 @@ makeinstall_init() { } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/sbin - cp mkfs.fat $ROOT/$TOOLCHAIN/sbin - ln -sf mkfs.fat $ROOT/$TOOLCHAIN/sbin/mkfs.vfat + mkdir -p $TOOLCHAIN/sbin + cp mkfs.fat $TOOLCHAIN/sbin + ln -sf mkfs.fat $TOOLCHAIN/sbin/mkfs.vfat } diff --git a/packages/sysutils/e2fsprogs/package.mk b/packages/sysutils/e2fsprogs/package.mk index 15c6d12ea6..65ba2b8c66 100644 --- a/packages/sysutils/e2fsprogs/package.mk +++ b/packages/sysutils/e2fsprogs/package.mk @@ -1,78 +1,61 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="e2fsprogs" -PKG_VERSION="1.42.13" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.43.9" +PKG_SHA256="926f8e8de1ffba55d791f21b71334e8a32b5227257ad370f2bf7e4396629e97f" PKG_LICENSE="GPL" PKG_SITE="http://e2fsprogs.sourceforge.net/" -PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_NAME/1.42/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="https://www.kernel.org/pub/linux/kernel/people/tytso/$PKG_NAME/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" PKG_DEPENDS_INIT="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="e2fsprogs: Utilities for use with the ext2 filesystem" PKG_LONGDESC="The filesystem utilities for the EXT2 filesystem, including e2fsck, mke2fs, dumpe2fs, fsck, and others." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="-parallel" if [ "$HFSTOOLS" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET diskdev_cmds" fi -PKG_CONFIGURE_OPTS_HOST="--prefix=/usr \ - --bindir=/bin \ - --sbindir=/sbin" +PKG_CONFIGURE_OPTS_HOST="--prefix=$TOOLCHAIN/ \ + --bindir=$TOOLCHAIN/bin \ + --sbindir=$TOOLCHAIN/sbin" -PKG_CONFIGURE_OPTS_TARGET="BUILD_CC=$HOST_CC \ - --enable-verbose-makecmds \ - --enable-symlink-install \ - --enable-symlink-build \ - --enable-compression \ - --enable-htree \ - --disable-elf-shlibs \ - --disable-bsd-shlibs \ - --disable-profile \ - --disable-jbd-debug \ - --disable-blkid-debug \ - --disable-testio-debug \ - --enable-libuuid \ - --enable-libblkid \ - --disable-debugfs \ - --disable-imager \ - --enable-resizer \ - --enable-fsck \ - --disable-e2initrd-helper \ - --enable-tls \ - --disable-uuidd \ - --disable-nls \ - --disable-rpath \ - --with-gnu-ld" +pre_configure_target() { + PKG_CONFIGURE_OPTS_TARGET="BUILD_CC=$HOST_CC \ + --enable-verbose-makecmds \ + --enable-symlink-install \ + --enable-symlink-build \ + --disable-elf-shlibs \ + --disable-bsd-shlibs \ + --disable-profile \ + --disable-jbd-debug \ + --disable-blkid-debug \ + --disable-testio-debug \ + --enable-libuuid \ + --enable-libblkid \ + --disable-debugfs \ + --disable-imager \ + --enable-resizer \ + --enable-fsck \ + --disable-e2initrd-helper \ + --enable-tls \ + --disable-uuidd \ + --disable-nls \ + --disable-rpath \ + --disable-fuse2fs \ + --with-gnu-ld" +} -PKG_CONFIGURE_OPTS_INIT="$PKG_CONFIGURE_OPTS_TARGET" +pre_configure_init() { + pkg_call pre_configure_target -pre_make_host() { - # dont build parallel - MAKEFLAGS=-j1 + PKG_CONFIGURE_OPTS_INIT="$PKG_CONFIGURE_OPTS_TARGET" } post_makeinstall_target() { + make -C lib/et LIBMODE=644 DESTDIR=$SYSROOT_PREFIX install + rm -rf $INSTALL/usr/sbin/badblocks rm -rf $INSTALL/usr/sbin/blkid rm -rf $INSTALL/usr/sbin/dumpe2fs @@ -108,12 +91,6 @@ make_host() { } makeinstall_host() { - make -C lib/et DESTDIR=$(pwd)/.install install - make -C lib/ext2fs DESTDIR=$(pwd)/.install install - - rm -fr $(pwd)/.install/bin - rm -fr $(pwd)/.install/usr/share - - cp -Pa $(pwd)/.install/usr/* $ROOT/$TOOLCHAIN + make -C lib/et LIBMODE=644 install + make -C lib/ext2fs LIBMODE=644 install } - diff --git a/packages/sysutils/entropy/package.mk b/packages/sysutils/entropy/package.mk index 42c93c1416..53eb0a735c 100644 --- a/packages/sysutils/entropy/package.mk +++ b/packages/sysutils/entropy/package.mk @@ -1,39 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="entropy" PKG_VERSION="0" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="A simple way to add entropy at boot" PKG_LONGDESC="A simple way to add entropy at boot" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target(){ - : -} +PKG_TOOLCHAIN="manual" makeinstall_target() { mkdir -p $INSTALL/usr/lib/entropy diff --git a/packages/sysutils/eventlircd/evmap/osmc_rf.evmap b/packages/sysutils/eventlircd/evmap/osmc_rf.evmap index ba5ebd8a44..6f179cf33b 100644 --- a/packages/sysutils/eventlircd/evmap/osmc_rf.evmap +++ b/packages/sysutils/eventlircd/evmap/osmc_rf.evmap @@ -6,9 +6,8 @@ #KEY_RIGHT = KEY_RIGHT KEY_ENTER = KEY_OK #KEY_BACK = KEY_BACK -KEY_CONTEXT_MENU = KEY_EPG +#KEY_CONTEXT_MENU = KEY_CONTEXT_MENU #KEY_PLAYPAUSE = KEY_PLAYPAUSE #KEY_STOP = KEY_STOP #KEY_REWIND = KEY_REWIND #KEY_FASTFORWARD = KEY_FASTFORWARD - diff --git a/packages/sysutils/eventlircd/evmap/osmc_rf2.evmap b/packages/sysutils/eventlircd/evmap/osmc_rf2.evmap new file mode 100644 index 0000000000..6881826b95 --- /dev/null +++ b/packages/sysutils/eventlircd/evmap/osmc_rf2.evmap @@ -0,0 +1,13 @@ +#KEY_HOME = KEY_HOME +KEY_I = KEY_INFO +#KEY_UP = KEY_UP +#KEY_DOWN = KEY_DOWN +#KEY_LEFT = KEY_LEFT +#KEY_RIGHT = KEY_RIGHT +KEY_ENTER = KEY_OK +#KEY_BACK = KEY_BACK +KEY_C = KEY_CONTEXT_MENU +#KEY_PLAYPAUSE = KEY_PLAYPAUSE +#KEY_STOP = KEY_STOP +KEY_MINUS = KEY_VOLUMEDOWN +KEY_EQUAL = KEY_VOLUMEUP diff --git a/packages/sysutils/eventlircd/evmap/xiaomibtremote.evmap b/packages/sysutils/eventlircd/evmap/xiaomibtremote.evmap new file mode 100644 index 0000000000..03b7014098 --- /dev/null +++ b/packages/sysutils/eventlircd/evmap/xiaomibtremote.evmap @@ -0,0 +1,4 @@ +KEY_POWER = KEY_MUTE +KEY_F5 = KEY_PLAYPAUSE +KEY_HOME = KEY_EPG +KEY_BACK = KEY_EXIT diff --git a/packages/sysutils/eventlircd/evmap/xiaomibtremoteAM.evmap b/packages/sysutils/eventlircd/evmap/xiaomibtremoteAM.evmap new file mode 100644 index 0000000000..4599b53859 --- /dev/null +++ b/packages/sysutils/eventlircd/evmap/xiaomibtremoteAM.evmap @@ -0,0 +1,3 @@ +KEY_POWER = KEY_MUTE +KEY_COMPOSE = KEY_STOPCD +KEY_BACK = KEY_EXIT diff --git a/packages/sysutils/eventlircd/package.mk b/packages/sysutils/eventlircd/package.mk index 6a3d185428..188d11b189 100644 --- a/packages/sysutils/eventlircd/package.mk +++ b/packages/sysutils/eventlircd/package.mk @@ -1,38 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="eventlircd" -PKG_VERSION="7faaf9d" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3b753e9" +PKG_SHA256="4eca52d0570fa568b3296a2c9bc2af252423e25c1a67654bd79680fc5a93092a" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/OpenELEC/eventlircd" -PKG_URL="https://github.com/OpenELEC/eventlircd/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}-${PKG_VERSION}*" +PKG_SITE="https://github.com/LibreELEC/eventlircd" +PKG_URL="https://github.com/LibreELEC/eventlircd/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain systemd lirc" -PKG_SECTION="system/remote" -PKG_SHORTDESC="eventlircd:The eventlircd daemon provides various functions for LIRC devices" PKG_LONGDESC="The eventlircd daemon provides four functions for LIRC devices" +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--with-udev-dir=/usr/lib/udev" +PKG_CONFIGURE_OPTS_TARGET="--with-udev-dir=/usr/lib/udev \ + --with-lircd-socket=/run/lirc/lircd" post_makeinstall_target() { # install our own evmap files and udev rules diff --git a/packages/sysutils/eventlircd/system.d/eventlircd.service b/packages/sysutils/eventlircd/system.d/eventlircd.service index 7859753e2a..15b6078315 100644 --- a/packages/sysutils/eventlircd/system.d/eventlircd.service +++ b/packages/sysutils/eventlircd/system.d/eventlircd.service @@ -2,7 +2,7 @@ Description=Eventlirc server daemon [Service] -ExecStart=/usr/sbin/eventlircd -f --evmap=/etc/eventlircd.d --socket=/run/lirc/lircd --release=_UP +ExecStart=/usr/sbin/eventlircd -f --evmap=/etc/eventlircd.d --socket=/run/lirc/lircd KillMode=process TimeoutStopSec=1s diff --git a/packages/sysutils/eventlircd/tmpfiles.d/z_62_eventlircd.conf b/packages/sysutils/eventlircd/tmpfiles.d/z_62_eventlircd.conf index e9c344b64f..be3a0035de 100644 --- a/packages/sysutils/eventlircd/tmpfiles.d/z_62_eventlircd.conf +++ b/packages/sysutils/eventlircd/tmpfiles.d/z_62_eventlircd.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /run/lirc 0755 root root - - diff --git a/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules b/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules index f75dea2ee8..e1d36d4ebe 100644 --- a/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules +++ b/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules @@ -61,26 +61,18 @@ SUBSYSTEMS=="rc", \ ENV{eventlircd_evmap}="default.evmap" #------------------------------------------------------------------------------- -# Ask eventlircd to handle power button. +# Ask eventlircd to handle input event devices. #------------------------------------------------------------------------------- -SUBSYSTEMS=="acpi", ATTRS{hid}=="LNXPWRBN", \ - ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="default.evmap" - -# WeTek Play (power button) -SUBSYSTEMS=="input", ATTRS{name}=="key_input", \ - ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="default.evmap" -# WeTek Core (power button) -SUBSYSTEMS=="input", ATTRS{name}=="gpio_keypad", \ +# Xiaomi Mi Box USA remote +SUBSYSTEMS=="input", ATTRS{name}=="Xiaomi Remote", \ ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="default.evmap" + ENV{eventlircd_evmap}="xiaomibtremote.evmap" -# Amlogic Remotes -SUBSYSTEMS=="input", ATTRS{name}=="aml_keypad", \ +# Xiaomi Mi Box aftermarket remote +SUBSYSTEMS=="input", ATTRS{name}=="å°ç±³è“ç‰™é¥æŽ§å™¨", \ ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="default.evmap" + ENV{eventlircd_evmap}="xiaomibtremoteAM.evmap" #------------------------------------------------------------------------------- # Ask eventlircd to handle USB HID devices that show up as event devices and are @@ -194,21 +186,15 @@ ENV{ID_VENDOR_ID}=="2252", ENV{ID_MODEL_ID}=="1037", \ ENV{eventlircd_enable}="true", \ ENV{eventlircd_evmap}="osmc_rf.evmap" +ENV{ID_VENDOR_ID}=="2017", ENV{ID_MODEL_ID}=="1688", \ +ENV{eventlircd_enable}="true", \ +ENV{eventlircd_evmap}="osmc_rf2.evmap" + # Enable wake-on-usb for the USB remotes. RUN+="wakeup_enable" LABEL="end-usb" -# Automatically set Delayrate to 200ms to avoid double keypresses with -# gpio-rc-recv - DRIVERS=="gpio-rc-recv", \ - RUN+="/usr/bin/ir-keytable --delay=200 --device=$devnode", \ - GOTO="end-keytable" - -# Set default delays (1000ms for first repeat, to avoid multiple keypresses). - RUN+="/usr/bin/ir-keytable --delay=1000 --device=$devnode" - -LABEL="end-keytable" #------------------------------------------------------------------------------- # Ask eventlircd to handle Bluetooth HID devices that show up as event devices # and are known to be remote controls. For simplicity, the event map file names @@ -238,4 +224,7 @@ ATTRS{name}=="Amazon Fire TV Remote", \ LABEL="end-bluetooth" +# tell libinput to ignore devices handled by eventlircd +ENV{eventlircd_enable}=="true", ENV{LIBINPUT_IGNORE_DEVICE}="1" + LABEL="end" diff --git a/packages/sysutils/fuse-exfat/package.mk b/packages/sysutils/fuse-exfat/package.mk index 605fe2b59f..3c4dbe4a07 100644 --- a/packages/sysutils/fuse-exfat/package.mk +++ b/packages/sysutils/fuse-exfat/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="fuse-exfat" -PKG_VERSION="1.2.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.2.6" +PKG_SHA256="e1105256d75860c0678f98bbae0b8fe465d4c96ed187b7035556097f152478e7" PKG_LICENSE="GPLv2+" PKG_SITE="https://github.com/relan/exfat" PKG_URL="https://github.com/relan/exfat/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain fuse" -PKG_SECTION="system" -PKG_SHORTDESC="fuse-exfat: aims to provide a full-featured exFAT file system implementation for GNU/Linux other Unix-like systems as a FUSE module." PKG_LONGDESC="This project aims to provide a full-featured exFAT file system implementation for GNU/Linux other Unix-like systems as a FUSE module." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/sysutils/fuse/package.mk b/packages/sysutils/fuse/package.mk index c8be87125d..ef0cf9bd8c 100644 --- a/packages/sysutils/fuse/package.mk +++ b/packages/sysutils/fuse/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="fuse" PKG_VERSION="2.9.7" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="832432d1ad4f833c20e13b57cf40ce5277a9d33e483205fc63c78111b3358874" PKG_LICENSE="GPL" PKG_SITE="https://github.com/libfuse/libfuse/" PKG_URL="https://github.com/libfuse/libfuse/releases/download/$PKG_NAME-$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="fuse: A simple user-space filesystem interface for Linux" -PKG_LONGDESC="FUSE provides a simple interface for userspace programs to export a virtual filesystem to the Linux kernel. FUSE also aims to provide a secure method for non privileged users to create and mount their own filesystem implementations." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="FUSE provides a simple interface for userspace programs to export a virtual filesystem to the Linux kernel." +# fuse fails to build with GOLD linker on gcc-4.9 +PKG_BUILD_FLAGS="-gold" PKG_CONFIGURE_OPTS_TARGET="MOUNT_FUSE_PATH=/usr/sbin \ --enable-lib \ @@ -39,11 +20,6 @@ PKG_CONFIGURE_OPTS_TARGET="MOUNT_FUSE_PATH=/usr/sbin \ --disable-rpath \ --with-gnu-ld" -pre_configure_target() { -# fuse fails to build with GOLD linker on gcc-4.9 - strip_gold -} - post_makeinstall_target() { rm -rf $INSTALL/etc/init.d rm -rf $INSTALL/etc/udev diff --git a/packages/sysutils/fuse/patches/fuse-0002-dont-run-update-rc.d.patch b/packages/sysutils/fuse/patches/fuse-0002-dont-run-update-rc.d.patch new file mode 100644 index 0000000000..d89103eca0 --- /dev/null +++ b/packages/sysutils/fuse/patches/fuse-0002-dont-run-update-rc.d.patch @@ -0,0 +1,13 @@ +--- a/util/Makefile.in 2017-06-23 22:47:36.762827097 +0200 ++++ b/util/Makefile.in 2017-06-23 22:47:47.358852950 +0200 +@@ -734,10 +734,6 @@ + $(INSTALL_PROGRAM) $(builddir)/mount.fuse $(DESTDIR)$(MOUNT_FUSE_PATH)/mount.fuse + $(MKDIR_P) $(DESTDIR)$(INIT_D_PATH) + $(INSTALL_SCRIPT) $(srcdir)/init_script $(DESTDIR)$(INIT_D_PATH)/fuse +- @if test -x /usr/sbin/update-rc.d; then \ +- echo "/usr/sbin/update-rc.d fuse start 34 S . start 41 0 6 . || true"; \ +- /usr/sbin/update-rc.d fuse start 34 S . start 41 0 6 . || true; \ +- fi + + install-data-local: + $(MKDIR_P) $(DESTDIR)$(UDEV_RULES_PATH) diff --git a/packages/sysutils/gptfdisk/package.mk b/packages/sysutils/gptfdisk/package.mk new file mode 100644 index 0000000000..2668ea675a --- /dev/null +++ b/packages/sysutils/gptfdisk/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="gptfdisk" +PKG_VERSION="1.0.4" +PKG_SHA256="b663391a6876f19a3cd901d862423a16e2b5ceaa2f4a3b9bb681e64b9c7ba78d" +PKG_LICENSE="GPL" +PKG_SITE="http://www.rodsbooks.com/gdisk/" +PKG_URL="https://downloads.sourceforge.net/project/$PKG_NAME/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain popt" +PKG_LONGDESC="GPT text-mode partitioning tools" + +make_target() { + make sgdisk "CC=$CC" "CXX=$CXX" +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/sbin/ + cp -p sgdisk $INSTALL/usr/sbin/ +} diff --git a/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control b/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control deleted file mode 100755 index 699706848f..0000000000 --- a/packages/sysutils/imx6-soc-fan/bin/imx6-soc-fan-control +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. /usr/lib/libreelec/imx6-system-type - -if [ "$SYSTEM_TYPE" != "matrix" ]; then - echo "Only for TBS Matrix system." - exit 12 -fi - -fan_on() { - echo 1 > /sys/class/leds/fan/brightness -} - -fan_off() { - echo 0 > /sys/class/leds/fan/brightness -} - -soc_temp() { - local temp=$(cat /sys/devices/virtual/thermal/thermal_zone0/temp) - temp="$(( $temp / 1000 ))" - echo "$temp" -} - -echo "SoC temp: $(soc_temp) C" - -ACTION=$1 -INTERVAL=$2 - -if [ -n "$ACTION" -a "$ACTION" = "on" ]; then - echo "Turning fan on." - fan_on -elif [ -n "$ACTION" -a "$ACTION" = "off" ]; then - echo "Turning fan off." - fan_off -elif [ -n "$ACTION" -a "$ACTION" = "log" ]; then - if [ -n "$INTERVAL" ]; then - interval=$INTERVAL - else - interval=60 - fi - - while true; do - echo "SoC temp: $(soc_temp) C" - - sleep $interval - done -else - echo "Unknown argument - must be on, off or log [interval]." -fi diff --git a/packages/sysutils/imx6-soc-fan/config/imx6-soc-fan-monitor.conf.sample b/packages/sysutils/imx6-soc-fan/config/imx6-soc-fan-monitor.conf.sample deleted file mode 100644 index a8da70d4d0..0000000000 --- a/packages/sysutils/imx6-soc-fan/config/imx6-soc-fan-monitor.conf.sample +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -# -# imx6-soc-fan-monitor.conf.sample - i.MX6 SoC fan monitor config file -# used only for TBS Matrix system -# - -# default limits without config file -# when fan is turned on -# high=70 -# when fan is turned off -# low=60 -# temperature checking interval -# interval=30 -# periodically show temperature -# debug=no - -high=70 -low=55 -interval=30 -debug=no diff --git a/packages/sysutils/imx6-soc-fan/package.mk b/packages/sysutils/imx6-soc-fan/package.mk deleted file mode 100644 index 6a87200b32..0000000000 --- a/packages/sysutils/imx6-soc-fan/package.mk +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="imx6-soc-fan" -PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv/" -PKG_URL="" -PKG_DEPENDS_TARGET="imx6-status-led" -PKG_SECTION="system" -PKG_SHORTDESC="i.MX6 SoC fan monitor" -PKG_LONGDESC="i.MX6 SoC fan monitor for TBS Matrix system" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/config - cp $PKG_DIR/config/* $INSTALL/usr/config - - mkdir -p $INSTALL/usr/bin - cp $PKG_DIR/bin/* $INSTALL/usr/bin - - mkdir -p $INSTALL/usr/lib/libreelec - cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec -} - -post_install() { - enable_service imx6-soc-fan-monitor.service -} diff --git a/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor b/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor deleted file mode 100755 index 4f1cbae804..0000000000 --- a/packages/sysutils/imx6-soc-fan/scripts/imx6-soc-fan-monitor +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. /usr/lib/libreelec/imx6-system-type - -if [ "$SYSTEM_TYPE" != "matrix" ]; then - echo "Only for TBS Matrix system." - exit 12 -fi - -debug_echo() { - if [ -n "$debug" -a "$debug" == "yes" ]; then - echo $* - fi -} - -fan_on() { - echo 1 > /sys/class/leds/fan/brightness -} - -fan_off() { - echo 0 > /sys/class/leds/fan/brightness -} - -soc_temp() { - local temp=$(cat /sys/devices/virtual/thermal/thermal_zone0/temp) - temp="$(( $temp / 1000 ))" - echo "$temp" -} - -# default limits -high=75 -low=60 -interval=30 -debug=no - -userconfig=/storage/.config/imx6-soc-fan-monitor.conf -if [ -e $userconfig ]; then - . $userconfig - echo "Values from config: low=$low high=$high interval=$interval debug=$debug" -else - echo "Default values: low=$low high=$high interval=$interval debug=$debug" -fi - -#( -# # turn fan on for a moment -# fan_on -# sleep 2 -# fan_off -#)& - -while true; do - temp=$(soc_temp) - debug_echo "SoC temp: $temp [low: $low, high: $high]" - if [ $temp -gt $high ]; then - debug_echo "SoC temp exceeds $high celsius, fan on" - fan_on - fi - - if [ $temp -lt $low ]; then - debug_echo "SoC temp below $low celsius, fan off" - fan_off - fi - - sleep $interval -done diff --git a/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service b/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service deleted file mode 100644 index 33053c75d9..0000000000 --- a/packages/sysutils/imx6-soc-fan/system.d/imx6-soc-fan-monitor.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=i.MX6 SoC fan monitor service - -[Service] -ExecStart=/bin/sh -c "exec /bin/sh /usr/lib/libreelec/imx6-soc-fan-monitor" -RestartPreventExitStatus=12 -TimeoutStopSec=5 -Restart=always -RestartSec=60 -StartLimitInterval=0 - -[Install] -WantedBy=multi-user.target diff --git a/packages/sysutils/imx6-status-led/package.mk b/packages/sysutils/imx6-status-led/package.mk deleted file mode 100644 index 8e22c01cd4..0000000000 --- a/packages/sysutils/imx6-status-led/package.mk +++ /dev/null @@ -1,44 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="imx6-status-led" -PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv/" -PKG_URL="" -PKG_DEPENDS_TARGET="" -PKG_SECTION="system" -PKG_SHORTDESC="i.MX6 status LED control" -PKG_LONGDESC="Front status LED control for i.MX6 systems" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/lib/libreelec - cp $PKG_DIR/scripts/* $INSTALL/usr/lib/libreelec -} - -post_install() { - enable_service imx6-status-led.service -} diff --git a/packages/sysutils/imx6-status-led/scripts/imx6-status-led b/packages/sysutils/imx6-status-led/scripts/imx6-status-led deleted file mode 100755 index d3ef9e05b0..0000000000 --- a/packages/sysutils/imx6-status-led/scripts/imx6-status-led +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. /usr/lib/libreelec/imx6-system-type - -case "$1" in - "on") - TRIGGER=default-on - ;; - "heartbeat") - TRIGGER=heartbeat - ;; - *) - exit 0 - ;; -esac - -case "$SYSTEM_TYPE" in - "matrix") - LED="/sys/class/leds/red/trigger" - ;; - "cuboxi") - LED="/sys/class/leds/imx6:red:front/trigger" - ;; - *) - exit 0 - ;; -esac - -echo "$TRIGGER" > "$LED" - diff --git a/packages/sysutils/imx6-status-led/scripts/imx6-system-type b/packages/sysutils/imx6-status-led/scripts/imx6-system-type deleted file mode 100755 index 9da8729e8a..0000000000 --- a/packages/sysutils/imx6-status-led/scripts/imx6-system-type +++ /dev/null @@ -1,44 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -# $ cat /sys/devices/soc0/machine -# Freescale i.MX6 Quad SABRE Smart Device Board -# $ cat /sys/devices/soc0/machine -# TBS Matrix -# $ cat /sys/devices/soc0/family -# Freescale i.MX -# $ cat /sys/devices/soc0/soc_id -# i.MX6Q -# $ cat /sys/devices/soc0/revision -# 1.2 - -SYSTEM_TYPE=$(cat /sys/bus/soc/devices/soc0/machine) -case "$SYSTEM_TYPE" in - "TBS Matrix") - export SYSTEM_TYPE="matrix" - ;; - "SolidRun Cubox-i Dual/Quad") - export SYSTEM_TYPE="cuboxi" - ;; - "Udoo i.MX6 Dual-lite Board"|"Udoo i.MX6 Quad Board") - export SYSTEM_TYPE="udoo" - ;; - *) - export SYSTEM_TYPE="undef" - ;; -esac diff --git a/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service b/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service deleted file mode 100644 index 464739f665..0000000000 --- a/packages/sysutils/imx6-status-led/system.d/imx6-status-led.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=i.MX6 status led -After=kodi.service - -[Service] -Type=oneshot -ExecStart=-/bin/sh -c "/usr/lib/libreelec/imx6-status-led on" -ExecStop=-/bin/sh -c "/usr/lib/libreelec/imx6-status-led heartbeat" -RemainAfterExit=yes - -[Install] -WantedBy=kodi.target diff --git a/packages/sysutils/irqbalanced/package.mk b/packages/sysutils/irqbalanced/package.mk index 8998c85e27..bcc193639c 100644 --- a/packages/sysutils/irqbalanced/package.mk +++ b/packages/sysutils/irqbalanced/package.mk @@ -1,34 +1,16 @@ -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="irqbalanced" PKG_VERSION="7f31046" -PKG_REV="1" +PKG_SHA256="e9f533bc2186fcef8456b78fb404ac981836d19f4b6ff10fede830b1df421717" PKG_ARCH="arm" PKG_LICENSE="other" PKG_SITE="http://www.freescale.com" PKG_URL="https://github.com/dv1/irqbalanced/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain systemd glib" -PKG_SECTION="system" -PKG_SHORTDESC="irqbalanced: distribute hardware interrupts across processors on a multiprocessor system." PKG_LONGDESC="irqbalanced: distribute hardware interrupts across processors on a multiprocessor system." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="configure" pre_configure_target() { sh -c ./autogen.sh diff --git a/packages/sysutils/keyutils/package.mk b/packages/sysutils/keyutils/package.mk index d516664154..5bf399522e 100644 --- a/packages/sysutils/keyutils/package.mk +++ b/packages/sysutils/keyutils/package.mk @@ -1,41 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="keyutils" -PKG_VERSION="1.5.9" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.5.10" +PKG_SHA256="115c3deae7f181778fd0e0ffaa2dad1bf1fe2f5677cf2e0e348cdb7a1c93afb6" PKG_LICENSE="GPL" PKG_SITE="http://people.redhat.com/~dhowells/keyutils/" PKG_URL="http://people.redhat.com/~dhowells/keyutils/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="keyutils: Linux Key Management Utilities" PKG_LONGDESC="Keyutils is a set of utilities for managing the key retention facility in the kernel." +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" PKG_MAKE_OPTS_TARGET="NO_ARLIB=0 NO_SOLIB=1 BINDIR=/usr/bin SBINDIR=/usr/sbin LIBDIR=/usr/lib USRLIBDIR=/usr/lib" PKG_MAKEINSTALL_OPTS_TARGET="$PKG_MAKE_OPTS_TARGET" post_makeinstall_target() { - rm -rf $INSTALL/usr/share - rmdir $INSTALL/etc/request-key.d - ln -sf /storage/.config/request-key.d $INSTALL/etc/request-key.d + rm -rf $INSTALL/usr/share + rmdir $INSTALL/etc/request-key.d + ln -sf /storage/.config/request-key.d $INSTALL/etc/request-key.d } - diff --git a/packages/sysutils/keyutils/patches/keyutils-01-allow-building-of-the-shared-library-to-be-suppressed.patch b/packages/sysutils/keyutils/patches/keyutils-01-allow-building-of-the-shared-library-to-be-suppressed.patch deleted file mode 100644 index 88d32b0cf0..0000000000 --- a/packages/sysutils/keyutils/patches/keyutils-01-allow-building-of-the-shared-library-to-be-suppressed.patch +++ /dev/null @@ -1,104 +0,0 @@ -keyutils: Allow building of the shared library to be suppressed - -Upstream patch: - https://kernel.googlesource.com/pub/scm/linux/kernel/git/dhowells/keyutils/+/a4deb71ddc05e951c8be8d46615beed9d408a5c8 - -Signed-off-by: Vicente Olivert Riera - -LIB: Allow building of the shared library to be suppressed - -Allow building of the shared library to be suppressed by passing NO_SOLIB=1 to -the Makefile. - -Reported-and-tested-by: Vicente Olivert Riera -Signed-off-by: David Howells -diff --git a/Makefile b/Makefile -index c904eaf..5dd2113 100644 ---- a/Makefile -+++ b/Makefile -@@ -5,6 +5,7 @@ - SPECFILE := keyutils.spec - NO_GLIBC_KEYERR := 0 - NO_ARLIB := 0 -+NO_SOLIB := 0 - ETCDIR := /etc - BINDIR := /bin - SBINDIR := /sbin -@@ -95,7 +96,7 @@ - # Normal build rule - # - ############################################################################### --all: $(DEVELLIB) keyctl request-key key.dns_resolver -+all: keyctl request-key key.dns_resolver - - ############################################################################### - # -@@ -104,20 +105,23 @@ - ############################################################################### - #RPATH = -Wl,-rpath,$(LIBDIR) - --ifeq ($(NO_ARLIB),0) --all: $(ARLIB) --$(ARLIB): keyutils.o -- $(AR) rcs $@ $< --endif -- - VCPPFLAGS := -DPKGBUILD="\"$(shell date -u +%F)\"" - VCPPFLAGS += -DPKGVERSION="\"keyutils-$(VERSION)\"" - VCPPFLAGS += -DAPIVERSION="\"libkeyutils-$(APIVERSION)\"" - -+ifeq ($(NO_ARLIB),0) -+all: $(ARLIB) -+$(ARLIB): keyutils.o -+ $(AR) rcs $@ $< -+ - keyutils.o: keyutils.c keyutils.h Makefile - $(CC) $(CPPFLAGS) $(VCPPFLAGS) $(CFLAGS) -UNO_GLIBC_KEYERR -o $@ -c $< -+LIB_DEPENDENCY := libkeyutils.a -+endif - - -+ifeq ($(NO_SOLIB),0) -+all: $(DEVELLIB) - $(DEVELLIB): $(SONAME) - ln -sf $< $@ - -@@ -131,6 +135,8 @@ - - keyutils.os: keyutils.c keyutils.h Makefile - $(CC) $(CPPFLAGS) $(VCPPFLAGS) $(CFLAGS) -fPIC -o $@ -c $< -+LIB_DEPENDENCY := $(DEVELLIB) -+endif - - ############################################################################### - # -@@ -140,13 +146,13 @@ - %.o: %.c keyutils.h Makefile - $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< - --keyctl: keyctl.o $(DEVELLIB) -+keyctl: keyctl.o $(LIB_DEPENDENCY) - $(CC) -L. $(CFLAGS) $(LDFLAGS) $(RPATH) -o $@ $< -lkeyutils - --request-key: request-key.o $(DEVELLIB) -+request-key: request-key.o $(LIB_DEPENDENCY) - $(CC) -L. $(CFLAGS) $(LDFLAGS) $(RPATH) -o $@ $< -lkeyutils - --key.dns_resolver: key.dns_resolver.o $(DEVELLIB) -+key.dns_resolver: key.dns_resolver.o $(LIB_DEPENDENCY) - $(CC) -L. $(CFLAGS) $(LDFLAGS) $(RPATH) -o $@ $< -lkeyutils -lresolv - - ############################################################################### -@@ -158,10 +164,12 @@ - ifeq ($(NO_ARLIB),0) - $(INSTALL) -D -m 0644 $(ARLIB) $(DESTDIR)$(USRLIBDIR)/$(ARLIB) - endif -+ifeq ($(NO_SOLIB),0) - $(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME) - $(LNS) $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME) - mkdir -p $(DESTDIR)$(USRLIBDIR) - $(LNS) $(LIBDIR)/$(SONAME) $(DESTDIR)$(USRLIBDIR)/$(DEVELLIB) -+endif - $(INSTALL) -D keyctl $(DESTDIR)$(BINDIR)/keyctl - $(INSTALL) -D request-key $(DESTDIR)$(SBINDIR)/request-key - $(INSTALL) -D request-key-debug.sh $(DESTDIR)$(SHAREDIR)/request-key-debug.sh diff --git a/packages/sysutils/kmod/package.mk b/packages/sysutils/kmod/package.mk index bd6797ead8..0cc005aeb3 100644 --- a/packages/sysutils/kmod/package.mk +++ b/packages/sysutils/kmod/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="kmod" -PKG_VERSION="23" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="24" +PKG_SHA256="610b8d1df172acc39a4fdf1eaa47a57b04873c82f32152e7a62e29b6ff9cb397" PKG_LICENSE="GPL" PKG_SITE="http://git.profusion.mobi/cgit.cgi/kmod.git/" -PKG_URL="http://ftp.kernel.org/pub/linux/utils/kernel/kmod/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://www.kernel.org/pub/linux/utils/kernel/kmod/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="toolchain" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="kmod offers the needed flexibility and fine grained control over insertion, removal, configuration and listing of kernel modules." PKG_LONGDESC="kmod offers the needed flexibility and fine grained control over insertion, removal, configuration and listing of kernel modules." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_HOST="--enable-tools \ --disable-logging \ --disable-debug \ @@ -54,7 +34,7 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-tools \ --without-zlib" post_makeinstall_host() { - ln -sf kmod $ROOT/$TOOLCHAIN/bin/depmod + ln -sf kmod $TOOLCHAIN/bin/depmod } post_makeinstall_target() { @@ -65,6 +45,7 @@ post_makeinstall_target() { ln -sf /usr/bin/kmod $INSTALL/usr/sbin/rmmod ln -sf /usr/bin/kmod $INSTALL/usr/sbin/modinfo ln -sf /usr/bin/kmod $INSTALL/usr/sbin/modprobe + ln -sf /usr/bin/kmod $INSTALL/usr/sbin/depmod mkdir -p $INSTALL/etc ln -sf /storage/.config/modprobe.d $INSTALL/etc/modprobe.d diff --git a/packages/sysutils/libevdev/package.mk b/packages/sysutils/libevdev/package.mk index 262db3a1ec..3e49abe558 100644 --- a/packages/sysutils/libevdev/package.mk +++ b/packages/sysutils/libevdev/package.mk @@ -1,42 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libevdev" -PKG_VERSION="1.5.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.5.7" +PKG_SHA256="a1e59e37a2f0d397ffd7e83b73af0e638db83b8dd08902ef0f651a21cc1dd422" PKG_LICENSE="GPL" PKG_SITE="http://www.freedesktop.org/wiki/Software/libevdev/" PKG_URL="http://www.freedesktop.org/software/libevdev/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="libevdev: a wrapper library for evdev devices." -PKG_LONGDESC="libevdev is a wrapper library for evdev devices. it moves the common tasks when dealing with evdev devices into a library and provides a library interface to the callers, thus avoiding erroneous ioctls, etc." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="libevdev is a wrapper library for evdev devices." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-shared --disable-static" -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr/bin } diff --git a/packages/sysutils/libhid/package.mk b/packages/sysutils/libhid/package.mk index 636c183cc5..dc5fab9aa4 100644 --- a/packages/sysutils/libhid/package.mk +++ b/packages/sysutils/libhid/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libhid" PKG_VERSION="0.2.16" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="f6809ab3b9c907cbb05ceba9ee6ca23a705f85fd71588518e14b3a7d9f2550e5" PKG_LICENSE="GPL" PKG_SITE="http://libhid.alioth.debian.org/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libusb-compat libusb" -PKG_SECTION="system" -PKG_SHORTDESC="libhid: userspace USB HID access library" -PKG_LONGDESC="libhid provides a generic and flexible way to access and interact with USB HID devices, much like libusb does for plain USB devices" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="libhid provides a generic and flexible way to access and interact with USB HID devices." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ --enable-static \ diff --git a/packages/sysutils/libusb-compat/package.mk b/packages/sysutils/libusb-compat/package.mk index 8764a177b8..742fb3e880 100644 --- a/packages/sysutils/libusb-compat/package.mk +++ b/packages/sysutils/libusb-compat/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libusb-compat" PKG_VERSION="0.1.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="404ef4b6b324be79ac1bfb3d839eac860fbc929e6acb1ef88793a6ea328bc55a" PKG_LICENSE="GPL" PKG_SITE="http://libusb.sourceforge.net/" PKG_URL="$SOURCEFORGE_SRC/libusb/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libusb" -PKG_SECTION="system" -PKG_SHORTDESC="libusb-compat: OS independent USB device access" -PKG_LONGDESC="The libusb project's aim is to create a Library for use by user level applications to USB devices regardless of OS." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The libusb project's aim is to create a Library for use by user level applications to USB devices." PKG_CONFIGURE_OPTS_TARGET="--disable-log --disable-debug-log --disable-examples-build" diff --git a/packages/sysutils/libusb/package.mk b/packages/sysutils/libusb/package.mk index 881f579e31..e7985a58c8 100644 --- a/packages/sysutils/libusb/package.mk +++ b/packages/sysutils/libusb/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libusb" -PKG_VERSION="1.0.20" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.0.21" +PKG_SHA256="7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b" PKG_LICENSE="LGPLv2.1" PKG_SITE="http://libusb.info/" PKG_URL="$SOURCEFORGE_SRC/libusb/files/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain systemd" -PKG_SECTION="system" -PKG_SHORTDESC="libusb: OS independent USB device access" -PKG_LONGDESC="The libusb project's aim is to create a Library for use by user level applications to USB devices regardless of OS." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The libusb project's aim is to create a Library for use by user level applications to USB devices." +#libusb sometimes fails to build if building paralell +PKG_BUILD_FLAGS="-parallel" PKG_CONFIGURE_OPTS_TARGET="--enable-shared \ --enable-static \ @@ -37,8 +18,3 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-shared \ --disable-debug-log \ --enable-udev \ --disable-examples-build" - -pre_configure_target () { - #libusb sometimes fails to build if building paralell - export MAKEFLAGS=-j1 -} diff --git a/packages/sysutils/lirc/config/lirc_options.conf b/packages/sysutils/lirc/config/lirc_options.conf new file mode 100644 index 0000000000..3fb2bf94fb --- /dev/null +++ b/packages/sysutils/lirc/config/lirc_options.conf @@ -0,0 +1,43 @@ +# These are the default options to lircd, if installed as +# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8) +# manpages for info on the different options. +# +# Some tools including mode2 and irw uses values such as +# driver, device, plugindir and loglevel as fallback values +# in not defined elsewhere. + +[lircd] +nodaemon = False +driver = default +device = /dev/lirc0 +output = /run/lirc/lircd.socket +pidfile = /run/lirc/lircd.pid +plugindir = /usr/lib/lirc/plugins +permission = 666 +allow-simulate = No +repeat-max = 600 +#effective-user = +#listen = [address:]port +#connect = host[:port] +#loglevel = 6 +#release = true +#release_suffix = _EVUP + +#logfile = ... + +[lircmd] +uinput = False +nodaemon = False + +# modinit is not supported in LibreELEC + +# [modinit] +# code = /usr/sbin/modprobe lirc_serial +# code1 = /usr/bin/setfacl -m g:lirc:rw /dev/uinput +# code2 = ... + + +# [lircd-uinput] +# add-release-events = False +# release-timeout = 200 +# release-suffix = _EVUP diff --git a/packages/sysutils/lirc/config/lircd.conf.rpi b/packages/sysutils/lirc/config/lircd.conf.rpi deleted file mode 100644 index bae7a7f869..0000000000 --- a/packages/sysutils/lirc/config/lircd.conf.rpi +++ /dev/null @@ -1,519 +0,0 @@ -# /etc/lirc/lircd.conf.rpi -# -# Lirc config for lirc_rpi (GPIO) receiver. -# Enables use of MCE Remote, Apple MacMini and XBOX remote. -# Should work with any generic receiver -# -# contributed by jenkins101 -# -######## -# -# brand: HP/Philips/Microsoft/Other -# model no. of remote control: Media Center Edition remote -# devices being controlled by this remote: myriad of devices with Media Center Edition receivers -# -# RC-6 config file -# -# source: http://home.hccnet.nl/m.majoor/projects_remote_control.htm -# http://home.hccnet.nl/m.majoor/pronto.pdf -# -# used by: Philips -# -######### -# -# Philips Media Center Edition remote control -# For use with the USB MCE ir receiver -# -# Dan Conti dconti|acm.wwu.edu -# -# Updated with codes for MCE 2005 Remote additional buttons -# *, #, Teletext, Red, Green, Yellow & Blue Buttons -# Note: TV power button transmits no code until programmed. -# Updated 12th September 2005 -# Graham Auld - mce|graham.auld.me.uk -# -# Radio, Print, RecTV are only available on the HP Media Center remote control -# -# -# Updated with codes for MCE 2007 Remote additional buttons -# Visualization, Aspect, SlideShow, Eject -# Note: -# Blue, Yellow, Green, Red, and Teletext buttons do not exist on some HP remote - -begin remote - - name mceusb - bits 16 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2667 889 - one 444 444 - zero 444 444 - pre_data_bits 21 - pre_data 0x37FF0 - gap 105000 - toggle_bit 22 - rc6_mask 0x100000000 - min_repeat 4 -# uncomment to suppress unwanted repeats - suppress_repeat 4 - - - begin codes - -#seen on HP Pavilion dv3t remote --Tim Mann, 3 Nov 2009 - KEY_VIDEO 0x00007b7f - KEY_PLAYPAUSE 0x00007b91 - - -#unused by HP remote - KEY_BLUE 0x00007ba1 - KEY_YELLOW 0x00007ba2 - KEY_GREEN 0x00007ba3 - KEY_RED 0x00007ba4 - KEY_TEXT 0x00007ba5 - -#ba6 - bae unused - BA6 0x00007ba6 - BA7 0x00007ba7 - BA8 0x00007ba8 - BA9 0x00007ba9 - BAA 0x00007baa - BAB 0x00007bab - BAC 0x00007bac - BAD 0x00007bad - BAE 0x00007bae - - KEY_RADIO 0x00007baf - Print 0x00007bb1 - -#bb2 - bb4 unused - BB2 0x00007bb2 - BB3 0x00007bb3 - BB4 0x00007bb4 - - KEY_VIDEO 0x00007bb5 - KEY_CAMERA 0x00007bb6 - KEY_PVR 0x00007bb7 - KEY_AUDIO 0x00007bb8 - KEY_TV 0x00007bb9 - -#bba - bbf unused - BBA 0x00007bba - BBB 0x00007bbb - BBC 0x00007bbc - BBD 0x00007bbd - BBE 0x00007bbe - BBF 0x00007bbf -#bc1 - bca unused - BC1 0x00007bc1 - BC2 0x00007bc2 - BC3 0x00007bc3 - BC4 0x00007bc4 - BC5 0x00007bc5 - BC6 0x00007bc6 - BC7 0x00007bc7 - BC8 0x00007bc8 - BC9 0x00007bc9 - BCA 0x00007bca - - KEY_EJECTCD 0x00007bcb - SlideShow 0x00007bcc - Visualization 0x00007bcd - -#bce - bcf unused - BCE 0x00007bce - BCF 0x00007bcf -#bd1 - bd7 unused - BD1 0x00007bd1 - BD2 0x00007bd2 - BD3 0x00007bd3 - BD4 0x00007bd4 - BD5 0x00007bd5 - BD6 0x00007bd6 - BD7 0x00007bd7 - - KEY_ANGLE 0x00007bd8 - KEY_EPG 0x00007bd9 - KEY_TV 0x00007bda - KEY_DVD 0x00007bdb -#NoGap - KEY_EXIT 0x00007bdc - KEY_OK 0x00007bdd - KEY_RIGHT 0x00007bde - KEY_LEFT 0x00007bdf - KEY_DOWN 0x00007be0 - KEY_UP 0x00007be1 -#NoGap - KEY_NUMERIC_STAR 0x00007be2 - KEY_NUMERIC_POUND 0x00007be3 -#NoGap - KEY_PREVIOUS 0x00007be4 - KEY_NEXT 0x00007be5 - KEY_STOP 0x00007be6 - KEY_PAUSE 0x00007be7 - KEY_RECORD 0x00007be8 - KEY_PLAY 0x00007be9 - KEY_REWIND 0x00007bea - KEY_FORWARD 0x00007beb -#NoGap - KEY_CHANNELDOWN 0x00007bec - KEY_CHANNELUP 0x00007bed - KEY_VOLUMEDOWN 0x00007bee - KEY_VOLUMEUP 0x00007bef -#NoGap - KEY_INFO 0x00007bf0 - KEY_MUTE 0x00007bf1 - KEY_HOME 0x00007bf2 - KEY_POWER 0x00007bf3 -#NoGap - KEY_ENTER 0x00007bf4 - KEY_CLEAR 0x00007bf5 -#NoGap - KEY_9 0x00007bf6 - KEY_8 0x00007bf7 - KEY_7 0x00007bf8 - KEY_6 0x00007bf9 - KEY_5 0x00007bfa - KEY_4 0x00007bfb - KEY_3 0x00007bfc - KEY_2 0x00007bfd - KEY_1 0x00007bfe - KEY_0 0x00007bff - end codes - -end remote - -# -# contributed by stevvie and jenkins101 -# -# brand: SIIG Vista MCE remote -# model no. of remote control: older Harmony and some vista mce remotes -# devices being controlled by this remote: -# - -begin remote - - name vista_mce - bits 16 - flags RC6 - eps 30 - aeps 100 - - header 2654 889 - one 427 427 - zero 427 427 - pre_data_bits 21 - pre_data 0x37FF0 - gap 69850 - min_repeat 4 -# increase to suppress unwanted repeats - suppress_repeat 4 - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_POWER 0xEBF3 # Power - KEY_CAMERA 0x6BB6 # Pictures - KEY_RADIO 0xEBAF # Radio - KEY_VIDEO 0x6BB5 # Videos - KEY_MUSIC 0xEBB8 # Music - KEY_RECORD 0x6BE8 # Rec - KEY_PAUSE 0xEBE7 # Pause - KEY_STOP 0x6BE6 # Stop - KEY_PREVIOUS 0xEBE4 # Skipback - KEY_PLAY 0x6BE9 # Play - KEY_NEXT 0xEBE5 # Skipfwd - KEY_REWIND 0x6BEA # Rwd - KEY_FORWARD 0xEBEB # Fwd - KEY_HOME 0x6BF2 # Start - KEY_EXIT 0xEBDC # Back - KEY_INFO 0x6BF0 # More - KEY_VOLUMEUP 0xEBEF # Volup - KEY_VOLUMEDOWN 0x6BEE # Voldown - KEY_CHANNELUP 0xEBED # Chup - KEY_CHANNELDOWN 0x6BEC # Chdown - KEY_UP 0xEBE1 # Up - KEY_DOWN 0x6BE0 # Down - KEY_LEFT 0xEBDF # Left - KEY_RIGHT 0x6BDE # Right - KEY_MUTE 0xEBF1 # Mute - KEY_PVR 0x6BB7 # Rectv - KEY_TITLE 0xEBD9 # Guide - KEY_TV 0x6BDA # Livetv - KEY_MENU 0xEBDB # Dvdmenu - KEY_1 0x6BFE # 1 - KEY_2 0xEBFD # 2 - KEY_3 0x6BFC # 3 - KEY_4 0xEBFB # 4 - KEY_5 0x6BFA # 5 - KEY_6 0xEBF9 # 6 - KEY_7 0x6BF8 # 7 - KEY_8 0xEBF7 # 8 - KEY_9 0x6BF6 # 9 - KEY_NUMERIC_STAR 0xEBE2 # * - KEY_0 0x6BFF # 0 - KEY_NUMERIC_POUND 0xEBE3 # # - KEY_CLEAR 0x6BF5 # Clear - KEY_ENTER 0xEBF4 # Enter - end codes - -end remote - -# -# this config file was automatically generated -# using lirc-0.8.2(macmini) on Tue Dec 11 11:35:26 2007 -# -# contributed by Sebastian Schaetzel -# -# brand: Apple -# model no. of remote control: A1156 -# devices being controlled by this remote: Mac mini, MacBookPro 15" -# SantaRosa (3.1), MacBook2 -# - -begin remote - - name Apple_A1156 - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - pre_data_bits 24 - pre_data 0x87EE81 - gap 211982 - toggle_bit_mask 0x0 - ignore_mask 0x0000ff01 - - begin codes - KEY_VOLUMEUP 0x0B - KEY_VOLUMEDOWN 0x0D - KEY_REWIND 0x08 - KEY_FORWARD 0x07 - KEY_PLAYPAUSE 0x04 - KEY_MENU 0x02 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.1-git(default) on Sat Jan 26 21:54:39 2013 -# -# contributed by -# -# brand: Microsoft -# model: Xbox DVD Remote -# devices being controlled by this remote: xbox - -begin remote - - name XboxDVDDongle - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - gap 63950 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats -# toggle_bit_mask 0x72 - toggle_bit_mask 0xE1 - - begin codes - KEY_OK 0x0B - KEY_OK 0xEA - KEY_STOP 0xE0 - KEY_PAUSE 0xE6 - KEY_NEXT 0xDF - KEY_PREVIOUS 0xDD - KEY_FASTFORWARD 0xE3 - KEY_REWIND 0xE2 - KEY_MEDIA 0xD5 - KEY_EPG 0xE5 - KEY_INFO 0xC3 - KEY_UP 0xA6 - KEY_DOWN 0xA7 - KEY_LEFT 0xA9 - KEY_RIGHT 0xA8 - KEY_MENU 0xF7 - KEY_EXIT 0xD8 - KEY_0 0xCF - KEY_1 0xCE - KEY_2 0xCD - KEY_3 0xCC - KEY_4 0xCB - KEY_5 0xCA - KEY_6 0xC9 - KEY_7 0xC8 - KEY_8 0xC7 - KEY_9 0xC6 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.0-pre1(default) on Sat Feb 23 12:47:57 2013 -# -# contributed by DynaMight -# -# brand: Xbox 360 remote -# model no. of remote control: -# devices being controlled by this remote: -# - -begin remote - - name Xbox 360 Remote - bits 13 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2685 886 - one 457 433 - zero 457 433 - pre_data_bits 24 - pre_data 0x1BFF80 - gap 107197 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_STOP 0x0BE6 - KEY_PLAY 0x0BE9 - KEY_VOLUMEDOWN 0x0BEE - KEY_VOLUMEUP 0x0BEF - KEY_MUTE 0x0BF1 - KEY_0 0x0BFF - KEY_1 0x0BFE - KEY_2 0x0BFD - KEY_3 0x0BFC - KEY_4 0x0BFB - KEY_5 0x0BFA - KEY_6 0x0BF9 - KEY_7 0x0BF8 - KEY_8 0x0BF7 - KEY_9 0x0BF6 - KEY_MENU 0x0BDB - KEY_YELLOW 0x0BD9 - KEY_BLUE 0x0B97 - KEY_GREEN 0x0B99 - KEY_RED 0x0BDA - KEY_REWIND 0x0BEA - KEY_PLAYPAUSE 0x0BE9 - KEY_FASTFORWARD 0x0BEB - KEY_EXIT 0x0BDC - KEY_TITLE 0x0BAE - KEY_STOP 0x0BE6 - KEY_INFO 0x0BF0 - KEY_UP 0x0BE1 - KEY_DOWN 0x0BE0 - KEY_LEFT 0x0BDF - KEY_RIGHT 0x0BDE - KEY_OK 0x0BDD - KEY_POWER 0x0BF3 - KEY_PAGEUP 0x0B93 - KEY_PAGEDOWN 0x0B92 - KEY_ENTER 0x0BF4 - KEY_RECORD 0x0BE8 - KEY_CLEAR 0x0BF5 - KEY_NEXTSONG 0x0BE5 - KEY_PREVIOUSSONG 0x0BE4 - KEY_DISPLAYTOGGLE 0x0BB0 - KEY_PAUSE 0x037FF00BE7 - end codes - -end remote - -# this config file was manually generated -# using WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Wed Feb 28 11:27:58 2007 -# -# contributed by Luca Cristoforetti -# -# brand: Dream Multimedia Dreambox 7025 -# model: URC-39930RJ0-03 -# devices being controlled by this remote: -# This is a remote with an option of a universal -# TV. Use TV CODE: 0680 -# -# (press TV, hold down shift until you got -# 2 blinks, enter the code and you get 2 -# flashes for confirmation) -# - -begin remote - - name Dream_Multimedia_URC-39930 - bits 24 - flags SPACE_ENC - eps 25 - aeps 100 - - header 3488 1710 - one 426 415 - zero 426 1287 - ptrail 426 - pre_data_bits 24 - pre_data 0xBFFBFE - gap 73939 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats - toggle_bit 0 - - - begin codes - KEY_POWER 0x0000000000FF4342 - KEY_1 0x0000000000FFF7F6 - KEY_2 0x0000000000FF7776 - KEY_3 0x0000000000FFB7B6 - KEY_4 0x0000000000FF3736 - KEY_5 0x0000000000FFD7D6 - KEY_6 0x0000000000FF5756 - KEY_7 0x0000000000FF9796 - KEY_8 0x0000000000FF1716 - KEY_9 0x0000000000FFE7E6 - KEY_0 0x0000000000FF6766 - < 0x0000000000FF5F5E - > 0x0000000000FF2322 - KEY_VOLUMEUP 0x0000000000FFFBFA - KEY_VOLUMEDOWN 0x0000000000FF7B7A - KEY_MUTE 0x0000000000FFB3B2 - KEY_EXIT 0x0000000000DF84A5 - KEY_CHANNELUP 0x0000000000FFD3D2 - KEY_CHANNELDOWN 0x0000000000FF5352 - KEY_INFO 0x0000000000FF6362 - KEY_UP 0x0000000000FFADAC - KEY_LEFT 0x0000000000FF8D8C - KEY_RIGHT 0x0000000000FF0D0C - KEY_DOWN 0x0000000000FF2D2C - KEY_OK 0x0000000000FF6D6C - KEY_MENU 0x0000000000FF1E1F - KEY_AUDIO 0x0000000000FF3435 - KEY_VIDEO 0x0000000000FF1312 - KEY_BACKSPACE 0x0000000000FFF1F0 - KEY_PLAY 0x0000000000FF7170 - KEY_PAUSE 0x0000000000FFB1B0 - KEY_FORWARD 0x0000000000FF3130 - KEY_STOP 0x00000000007F6FEE - KEY_RADIO 0x0000000000FFB5B4 - KEY_TEXT 0x00000000007F3FBE - KEY_TITLE 0x00000000007FBF3E - end codes - -end remote diff --git a/packages/sysutils/lirc/config/lircd.conf.xbox b/packages/sysutils/lirc/config/lircd.conf.xbox deleted file mode 100644 index 6733237eaa..0000000000 --- a/packages/sysutils/lirc/config/lircd.conf.xbox +++ /dev/null @@ -1,139 +0,0 @@ - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.1-git(default) on Sat Jan 26 21:54:39 2013 -# -# contributed by -# -# brand: xbox.conf -# model no. of remote control: -# devices being controlled by this remote: -# - -begin remote - - name xbox.conf - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - gap 163983 - min_repeat 4 -# suppress_repeat 4 -# uncomment to suppress unwanted repeats -# toggle_bit_mask 0x72 - toggle_bit_mask 0x0 - - begin codes - KEY_OK 0x0B - KEY_PLAY 0xEA - KEY_STOP 0xE0 - KEY_PAUSE 0xE6 - KEY_NEXT 0xDF - KEY_PREVIOUS 0xDD - KEY_FASTFORWARD 0xE3 - KEY_REWIND 0xE2 - KEY_MEDIA 0xD5 - KEY_EPG 0xE5 - KEY_INFO 0xC3 - KEY_UP 0xA6 - KEY_DOWN 0xA7 - KEY_LEFT 0xA9 - KEY_RIGHT 0xA8 - KEY_MENU 0xF7 - KEY_EXIT 0xD8 - KEY_0 0xCF - KEY_1 0xCE - KEY_2 0xCD - KEY_3 0xCC - KEY_4 0xCB - KEY_5 0xCA - KEY_6 0xC9 - KEY_7 0xC8 - KEY_8 0xC7 - KEY_9 0xC6 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.0-pre1(default) on Sat Feb 23 12:47:57 2013 -# -# contributed by DynaMight -# -# brand: Xbox 360 remote (White) /home/pi/lircd.conf -# model no. of remote control: -# devices being controlled by this remote: -# - -begin remote - - name Xbox 360 Remote - bits 13 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2685 886 - one 457 433 - zero 457 433 - pre_data_bits 24 - pre_data 0x1BFF80 - gap 107197 - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_STOP 0x0BE6 - KEY_PLAY 0x0BE9 - KEY_VOLUMEDOWN 0x0BEE - KEY_VOLUMEUP 0x0BEF - KEY_MUTE 0x0BF1 - KEY_0 0x0BFF - KEY_1 0x0BFE - KEY_2 0x0BFD - KEY_3 0x0BFC - KEY_4 0x0BFB - KEY_5 0x0BFA - KEY_6 0x0BF9 - KEY_7 0x0BF8 - KEY_8 0x0BF7 - KEY_9 0x0BF6 - KEY_MENU 0x0BDB - KEY_YELLOW 0x0BD9 - KEY_BLUE 0x0B97 - KEY_GREEN 0x0B99 - KEY_RED 0x0BDA - KEY_REWIND 0x0BEA - KEY_PLAYPAUSE 0x0BE9 - KEY_FASTFORWARD 0x0BEB - KEY_BACK 0x0BDC - KEY_TITLE 0x0BAE - KEY_STOP 0x0BE6 - KEY_INFO 0x0BF0 - KEY_UP 0x0BE1 - KEY_DOWN 0x0BE0 - KEY_LEFT 0x0BDF - KEY_RIGHT 0x0BDE - KEY_OK 0x0BDD - KEY_POWER 0x0BF3 - KEY_PAGEUP 0x0B93 - KEY_PAGEDOWN 0x0B92 - KEY_ENTER 0x0BF4 - KEY_RECORD 0x0BE8 - KEY_CLEAR 0x0BF5 - KEY_NEXTSONG 0x0BE5 - KEY_PREVIOUSSONG 0x0BE4 - KEY_DISPLAYTOGGLE 0x0BB0 - KEY_PAUSE 0x037FF00BE7 - end codes - -end remote - diff --git a/packages/sysutils/lirc/package.mk b/packages/sysutils/lirc/package.mk index 550fecb0e3..5358c9eab1 100644 --- a/packages/sysutils/lirc/package.mk +++ b/packages/sysutils/lirc/package.mk @@ -1,42 +1,34 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="lirc" -PKG_VERSION="0.9.4c" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.10.0" +PKG_SHA256="e57c2de8b1b91325d23f1c14fc553ec7912b0add7891e653d048300d38c3f553" PKG_LICENSE="GPL" PKG_SITE="http://www.lirc.org" -PKG_URL="$SOURCEFORGE_SRC/lirc/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://sourceforge.net/projects/lirc/files/LIRC/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libftdi1 libusb-compat libxslt" -PKG_SECTION="sysutils/remote" -PKG_SHORTDESC="lirc: Linux Infrared Remote Control" -PKG_LONGDESC="LIRC is a package that allows you to decode and send infra-red signals of many (but not all) commonly used remote controls." +PKG_LONGDESC="LIRC is a package that allows you to decode and send infra-red signals." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_PYTHON_WANTED=Python2 -PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_forkpty=no \ - ac_cv_lib_util_forkpty=no \ - ac_cv_prog_HAVE_PYTHON3=no \ - --localstatedir=/ \ +PKG_CONFIGURE_OPTS_TARGET="--enable-devinput \ --with-gnu-ld \ - --without-x" + --without-x \ + --runstatedir=/run" + +pre_configure_target() { + export HAVE_WORKING_POLL=yes + export HAVE_UINPUT=yes + export PYTHON=: + export PYTHON_VERSION=${PKG_PYTHON_VERSION#python} + if [ -e ${SYSROOT_PREFIX}/usr/include/linux/input-event-codes.h ] ; then + export DEVINPUT_HEADER=${SYSROOT_PREFIX}/usr/include/linux/input-event-codes.h + else + export DEVINPUT_HEADER=${SYSROOT_PREFIX}/usr/include/linux/input.h + fi +} post_makeinstall_target() { rm -rf $INSTALL/usr/lib/systemd @@ -45,14 +37,19 @@ post_makeinstall_target() { rm -rf $INSTALL/etc mkdir -p $INSTALL/etc/lirc - cp $PKG_DIR/config/lircd.conf.* $INSTALL/etc/lirc + cp -r $PKG_DIR/config/lirc_options.conf $INSTALL/etc/lirc + ln -s /storage/.config/lircd.conf $INSTALL/etc/lirc/lircd.conf mkdir -p $INSTALL/usr/lib/libreelec cp $PKG_DIR/scripts/lircd_helper $INSTALL/usr/lib/libreelec - - mkdir -p $INSTALL/usr/lib/udev - cp $PKG_DIR/scripts/lircd_wakeup_enable $INSTALL/usr/lib/udev + cp $PKG_DIR/scripts/lircd_uinput_helper $INSTALL/usr/lib/libreelec mkdir -p $INSTALL/usr/share/services cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services } + +post_install() { + enable_service lircd.socket + enable_service lircd.service + enable_service lircd-uinput.service +} diff --git a/packages/sysutils/lirc/patches/lirc-0001-always-enable-uinput.patch b/packages/sysutils/lirc/patches/lirc-0001-always-enable-uinput.patch deleted file mode 100644 index c4545e710b..0000000000 --- a/packages/sysutils/lirc/patches/lirc-0001-always-enable-uinput.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur a/configure.ac b/configure.ac ---- a/configure.ac 2016-05-23 10:18:48.000000000 -0700 -+++ b/configure.ac 2016-06-08 02:09:11.335251580 -0700 -@@ -33,7 +33,7 @@ - AC_MSG_ERROR([ - xsltproc is required to build. It usually comes with libxml]) - fi --AM_CONDITIONAL(HAVE_UINPUT, test -e /dev/uinput) -+AM_CONDITIONAL(HAVE_UINPUT, true) - AC_CHECK_PROG([MAN2HTML],[man2html],[yes],[no]) - AM_CONDITIONAL(HAVE_MAN2HTML, test x$MAN2HTML = xyes) - AC_CHECK_PROG([DOXYGEN],[doxygen],[yes],[no]) diff --git a/packages/sysutils/lirc/patches/lirc-0002-disable-python3.patch b/packages/sysutils/lirc/patches/lirc-0002-disable-python3.patch deleted file mode 100644 index 797dbccff4..0000000000 --- a/packages/sysutils/lirc/patches/lirc-0002-disable-python3.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff -Naur a/configure.ac b/configure.ac ---- a/configure.ac 2016-06-08 13:06:09.757102470 -0700 -+++ b/configure.ac 2016-06-08 13:07:04.620705345 -0700 -@@ -40,9 +40,9 @@ - AM_CONDITIONAL(HAVE_DOXYGEN, test x$DOXYGEN = xyes) - AC_PROG_LN_S - LT_INIT([disable-static]) --AM_PATH_PYTHON([3.1],,) --AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ""]) --AC_CHECK_PROG([HAVE_PYTHON3],[python3],[yes],[no]) -+AM_PATH_PYTHON([3.1],,[:]) -+AM_CONDITIONAL([HAVE_PYTHON], [false]) -+AC_CHECK_PROG([HAVE_PYTHON3],[python3],[no],[no]) - LIBUSB_CONFIG="pkg-config libusb" - - dnl Checks for header files. -diff -Naur a/tools/Makefile.am b/tools/Makefile.am ---- a/tools/Makefile.am 2016-05-23 10:18:48.000000000 -0700 -+++ b/tools/Makefile.am 2016-06-08 13:15:25.711341537 -0700 -@@ -114,22 +114,7 @@ - - install-exec-hook: - $(SED) -i -e 's/@version@/$(VERSION)/' \ -- $(DESTDIR)$(bindir)/lirc-config-tool \ -- $(DESTDIR)$(bindir)/irdb-get -- rm -f $(DESTDIR)/$(bindir)/lirc-setup -- $(srcdir)/make_rel_symlink.py \ -- $(DESTDIR)/$(pkgpythondir)/lirc-setup \ -- $(DESTDIR)/$(bindir)/lirc-setup -- --install-data-hook: -- rm -f $(DESTDIR)/$(pkgpythondir)/configs -- $(srcdir)/make_rel_symlink.py \ -- $(DESTDIR)$(pkgdatadir)/configs \ -- $(DESTDIR)$(pkgpythondir)/configs -- --uninstall-hook: -- rm -f $(DESTDIR)/$(bindir)/lirc-setup \ -- $(DESTDIR)/$(pkgpythondir)/configs -+ $(DESTDIR)$(bindir)/lirc-config-tool - - clean-local: - -find . -name __pycache__ -exec rm -r {} \; diff --git a/packages/sysutils/lirc/patches/lirc-0007-disable-python-yaml-mod.patch b/packages/sysutils/lirc/patches/lirc-0007-disable-python-yaml-mod.patch deleted file mode 100644 index f8471424df..0000000000 --- a/packages/sysutils/lirc/patches/lirc-0007-disable-python-yaml-mod.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configure.ac.orig 2016-10-17 22:23:59.484494213 +0200 -+++ b/configure.ac 2016-10-17 22:25:08.045520993 +0200 -@@ -76,7 +76,7 @@ - fi - fi - AX_PYTHON_MODULE([yaml]) --AM_CONDITIONAL([HAVE_PYMOD_YAML], test $HAVE_PYMOD_YAML = "yes") -+AM_CONDITIONAL([HAVE_PYMOD_YAML], false) - forkpty="" - AC_CHECK_FUNCS(forkpty) - if test "$ac_cv_func_forkpty" != yes; then diff --git a/packages/sysutils/lirc/patches/lirc-0008-force-have-poll-fine.patch b/packages/sysutils/lirc/patches/lirc-0008-force-have-poll-fine.patch deleted file mode 100644 index 1f82dd1a0e..0000000000 --- a/packages/sysutils/lirc/patches/lirc-0008-force-have-poll-fine.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -Naur a/configure.ac b/configure.ac ---- a/configure.ac 2016-10-22 06:21:56.000000000 +0200 -+++ b/configure.ac 2016-12-26 21:54:42.489330474 +0100 -@@ -277,36 +277,7 @@ - AM_CONDITIONAL([BUILD_ALSA_SB_RC],[false]) - fi - --dnl see https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/ --AC_MSG_CHECKING(for working poll(2)) --AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -- #include -- #include -- #include -- #include -- #include --]],[[ -- int fd = open("/dev/tty", O_RDONLY); -- if (fd == -1) return 2; -- struct pollfd pfd = {fd, 1, 0}; -- -- struct timeval before, after; -- gettimeofday(&before, NULL); -- int rc = poll(&pfd, 1, 500); -- if (rc < 0) return errno; -- if (rc > 0) return rc; -- gettimeofday(&after, NULL); -- -- suseconds_t us = (after.tv_sec - before.tv_sec) * 1000000 + -- (after.tv_usec - before.tv_usec); -- return us >= 400000 ? 0 : 1; --]])],[ -- AC_DEFINE(HAVE_POLL_FINE) -- AC_MSG_RESULT(yes) --],[ -- AC_MSG_RESULT(no) --]) -- -+AC_DEFINE(HAVE_POLL_FINE) - - dnl check for kernel-headers - AC_CHECK_HEADERS([linux/input.h], diff --git a/packages/sysutils/lirc/patches/lirc-0100-disable-python.patch b/packages/sysutils/lirc/patches/lirc-0100-disable-python.patch new file mode 100644 index 0000000000..a71e042c24 --- /dev/null +++ b/packages/sysutils/lirc/patches/lirc-0100-disable-python.patch @@ -0,0 +1,118 @@ +diff --git a/Makefile.am b/Makefile.am +index aafb4e8c..f33a0c19 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -5,7 +5,9 @@ ACLOCAL_AMFLAGS = -I m4 + AUTOMAKE_OPTIONS = 1.5 check-news dist-bzip2 -Wno-portability \ + subdir-objects + ++if HAVE_PYTHON + include pylint.mak ++endif + + GIT_COMMIT = $(shell git log -1 --pretty=format:%h || echo UNKNOWN) + GIT_DATE = $(shell git log -1 --pretty=format:%cd || echo UNKNOWN) +@@ -34,13 +36,17 @@ MANTAINERCLEANFILES = config.sub install-sh depcomp py-compile \ + AM_DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$${dc_install_base}/lib/systemd/system + ++if HAVE_PYTHON + BUILT_SOURCES = paths.h python-pkg/lirc/config.py python-pkg/VERSION ++else ++BUILT_SOURCES = paths.h ++endif + + if WITH_SYSTEMDSYSTEMUNITDIR + SYSTEMD_DIR = systemd + endif + +-SUBDIRS = lib daemons tools plugins configs doc $(SYSTEMD_DIR) ++SUBDIRS = lib daemons tools plugins $(SYSTEMD_DIR) + + if INSTALL_ETC + +@@ -61,6 +67,7 @@ endif + + dist_doc_DATA = VERSION + ++if HAVE_PYTHON + nodist_pkgdata_DATA = $(PYTHON_TARBALL) + + pkgconfigdir = $(libdir)/pkgconfig +@@ -134,6 +141,8 @@ all-local: + $(if $(VERBOSE),,-q) build + endif + ++endif ++ + install-data-hook: + $(SED) -i -e '/^plugindir/s|/usr/lib|$(libdir)|' \ + $(DESTDIR)$(lirc_confdir)/lirc_options.conf +@@ -167,6 +176,7 @@ fix-version: .phony + $(SED) -i '/DATE/s/=.*/="$(GIT_DATE)"/' $(distdir)/VERSION + $(SED) -i '/REFS/s|=.*|="$(GIT_REFS)"|' $(distdir)/VERSION + ++if HAVE_PYTHON + $(abs_builddir)/python-pkg/setup.py: + cp -ar $(top_srcdir)/python-pkg $(abs_builddir) + chmod -R u+w python-pkg +@@ -190,6 +200,7 @@ python-pkg/lirc/config.py: Makefile $(abs_builddir)/python-pkg/setup.py + @echo 'DOCDIR = "$(docdir)"' >>$@ + @echo 'MODINFO = "$(MODINFO)"' >>$@ + @echo 'VERSION = "$(VERSION)"' >>$@ ++endif + + paths.h: Makefile + @echo "#ifndef PATHS_H" >paths.h +diff --git a/configure.ac b/configure.ac +index 321a61f7..016813c1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -43,7 +43,8 @@ AC_CHECK_PROG([DOXYGEN],[doxygen],[yes],[no]) + AM_CONDITIONAL(HAVE_DOXYGEN, test x$DOXYGEN = xyes) + LT_INIT([disable-static]) + +-AM_PATH_PYTHON([3.1],,) ++AM_PATH_PYTHON([3.1],,[:]) ++AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) + PKG_CHECK_MODULES([PYTHON],[python-${PYTHON_VERSION}m],,[true]) + test -z "$PYTHON_LIBS" && \ + PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION],,[true]) +@@ -577,6 +578,7 @@ AX_REPORT_CONDITIONAL([DEVEL]) + AX_REPORT_CONDITIONAL([LINUX_KERNEL]) + AX_REPORT_CONDITIONAL([HAVE_DEVINPUT]) + AX_REPORT_CONDITIONAL([WITH_SYSTEMDSYSTEMUNITDIR]) ++AX_REPORT_CONDITIONAL([HAVE_PYTHON]) + AX_REPORT_CONDITIONAL([HAVE_PYTHON35]) + + echo +diff --git a/tools/Makefile.am b/tools/Makefile.am +index abfb9911..8aff1cff 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -71,12 +71,17 @@ xmode2_SOURCES = xmode2.cpp + xmode2_LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 @X_EXTRA_LIBS@ \ + $(LIRC_LIBS) + ++if HAVE_PYTHON + dist_bin_SCRIPTS = lirc-config-tool lirc-init-db ++else ++dist_bin_SCRIPTS = ++endif + + if HAVE_DEVINPUT + dist_bin_SCRIPTS += lirc-make-devinput + endif + ++if HAVE_PYTHON + dist_bin_SCRIPTS += pronto2lirc irdb-get irtext2udp + dist_sbin_SCRIPTS = lircd-setup + dist_noinst_SCRIPTS = make_rel_symlink.py check_configs.py +@@ -121,6 +126,7 @@ install-data-hook: + $(PYTHON) $(srcdir)/make_rel_symlink.py \ + $(DESTDIR)/$(pkgdatadir)/configs \ + $(DESTDIR)/$(setupdir)/configs ++endif + + uninstall-hook: + rm -f $(DESTDIR)/$(bindir)/lirc-setup \ diff --git a/packages/sysutils/lirc/scripts/lircd_helper b/packages/sysutils/lirc/scripts/lircd_helper index 6895403ca9..8430b4a37f 100755 --- a/packages/sysutils/lirc/scripts/lircd_helper +++ b/packages/sysutils/lirc/scripts/lircd_helper @@ -1,68 +1,10 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ -ACTION=$(echo "$1") -DEVICE=$(echo "$2" | cut -f1 -d:) -DRIVER=$(echo "$2" | cut -f2 -d:) -CONFIG=$(echo "$2" | cut -f3 -d:) +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Matthias Reichl (hias@horus.com) -case "$ACTION" in - add) - if [ "x$DRIVER" = "x" ]; then - exit 1; - fi +if [ -e "/storage/.config/lirc_options.conf" ] ; then + LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf" +fi - mkdir -p '/run/lirc' - - if [ ! -e "/run/lirc/lircd-$DEVICE.pid" ]; then - - LIRCD="/usr/sbin/lircd" - LIRCD_CONFIG="--driver=$DRIVER --device=/dev/$DEVICE" - LIRCD_CONFIG="$LIRCD_CONFIG --output=/run/lirc/lircd-$DEVICE" - LIRCD_CONFIG="$LIRCD_CONFIG --pidfile=/run/lirc/lircd-$DEVICE.pid" - LIRCD_CONFIG="$LIRCD_CONFIG --release=_UP" - - if [ -e "/storage/.config/lircd.conf" ]; then - LIRCD_CONFIG="$LIRCD_CONFIG /storage/.config/lircd.conf" - elif [ -n "$CONFIG" ]; then - if [ -e "/storage/.config/$CONFIG" ]; then - LIRCD_CONFIG="$LIRCD_CONFIG /storage/.config/$CONFIG" - elif [ -e "/etc/lirc/$CONFIG" ]; then - LIRCD_CONFIG="$LIRCD_CONFIG /etc/lirc/$CONFIG" - else - exit 0 - fi - else - exit 0 - fi - - exec $LIRCD $LIRCD_CONFIG - fi - ;; - remove) - if [ -e "/run/lirc/lircd-$DEVICE.pid" ]; then - PID=`cat /run/lirc/lircd-$DEVICE.pid` - if [ ! "x$PID" = "x" ]; then - kill $PID - fi - fi - ;; -esac - -exit 0 +exec /usr/sbin/lircd $LIRCD_OPTIONS "$@" /storage/.config/lircd.conf diff --git a/packages/sysutils/lirc/scripts/lircd_uinput_helper b/packages/sysutils/lirc/scripts/lircd_uinput_helper new file mode 100755 index 0000000000..46685cd4f7 --- /dev/null +++ b/packages/sysutils/lirc/scripts/lircd_uinput_helper @@ -0,0 +1,10 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017 Matthias Reichl (hias@horus.com) + +if [ -e "/storage/.config/lirc_options.conf" ] ; then + LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf" +fi + +exec /usr/sbin/lircd-uinput $LIRCD_OPTIONS "$@" diff --git a/packages/sysutils/lirc/scripts/lircd_wakeup_enable b/packages/sysutils/lirc/scripts/lircd_wakeup_enable deleted file mode 100755 index fb2203dce3..0000000000 --- a/packages/sysutils/lirc/scripts/lircd_wakeup_enable +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -################################################################################ -# wakeup_enable -################################################################################ - -devpath=`readlink -f "/sys/${DEVPATH}"` -while echo "${devpath}" | grep -q '^/sys/devices/' > /dev/null 2>&1 ; do - if test -e "${devpath}/power/wakeup" ; then - state=`cat "${devpath}/power/wakeup"` - if test "x${state}" = "xdisabled" ; then - echo "enabled" > "${devpath}/power/wakeup" - fi - fi - devpath=`dirname "${devpath}"` -done - -exit 0 diff --git a/packages/sysutils/lirc/system.d/lircd-defaults.service b/packages/sysutils/lirc/system.d/lircd-defaults.service deleted file mode 100644 index 31b77757ec..0000000000 --- a/packages/sysutils/lirc/system.d/lircd-defaults.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Lirc defaults -After=local-fs.target - -ConditionPathExists=!/storage/.cache/services/lircd.conf -ConditionPathExists=!/storage/.cache/services/lircd.disabled - -[Service] -Type=oneshot -ExecStart=/bin/sh -c 'cp /usr/share/services/lircd.conf /storage/.cache/services/' -RemainAfterExit=yes diff --git a/packages/sysutils/lirc/system.d/lircd-uinput.service b/packages/sysutils/lirc/system.d/lircd-uinput.service new file mode 100644 index 0000000000..f73f893e7d --- /dev/null +++ b/packages/sysutils/lirc/system.d/lircd-uinput.service @@ -0,0 +1,12 @@ +[Unit] +Documentation=http://lirc.org/html/configure.html +Description=Forward LIRC button presses as uinput events +ConditionPathExists=/storage/.config/lircd.conf +After=lircd.service + +[Service] +Type=simple +ExecStart=/usr/lib/libreelec/lircd_uinput_helper --add-release-events + +[Install] +WantedBy=multi-user.target diff --git a/packages/sysutils/lirc/system.d/lircd-uinput@.service b/packages/sysutils/lirc/system.d/lircd-uinput@.service deleted file mode 100644 index 0490aa5956..0000000000 --- a/packages/sysutils/lirc/system.d/lircd-uinput@.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=lircd-uinput with %I - -ConditionPathExists=/storage/.cache/services/lircd.conf - -[Service] -ExecStart=/usr/sbin/lircd-uinput /run/lirc/lircd-%I -Slice=system-lircd.slice -Restart=on-failure -RestartSec=2 - -[Install] -WantedBy=multi-user.target - diff --git a/packages/sysutils/lirc/system.d/lircd.service b/packages/sysutils/lirc/system.d/lircd.service new file mode 100644 index 0000000000..534dcf73f7 --- /dev/null +++ b/packages/sysutils/lirc/system.d/lircd.service @@ -0,0 +1,12 @@ +[Unit] +Documentation=http://lirc.org/html/configure.html +Description=Flexible IR remote input/output application support +ConditionPathExists=/storage/.config/lircd.conf +After=network.target + +[Service] +Type=simple +ExecStart=/usr/lib/libreelec/lircd_helper --nodaemon + +[Install] +WantedBy=multi-user.target diff --git a/packages/sysutils/lirc/system.d/lircd.socket b/packages/sysutils/lirc/system.d/lircd.socket new file mode 100644 index 0000000000..03a5c1bd5b --- /dev/null +++ b/packages/sysutils/lirc/system.d/lircd.socket @@ -0,0 +1,6 @@ +[Socket] +ListenStream=/run/lirc/lircd.socket + +[Install] +WantedBy=sockets.target +Also=lircd.service diff --git a/packages/sysutils/lirc/system.d/lircd@.service b/packages/sysutils/lirc/system.d/lircd@.service deleted file mode 100644 index 05798e5055..0000000000 --- a/packages/sysutils/lirc/system.d/lircd@.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Lirc with %I -After=lircd-defaults.service -Requires=lircd-defaults.service - -ConditionPathExists=/storage/.cache/services/lircd.conf - -[Service] -Type=oneshot -ExecStart=/usr/lib/libreelec/lircd_helper add %I -ExecStop=/usr/lib/libreelec/lircd_helper remove %I -TimeoutStopSec=1 -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/packages/sysutils/lirc/tmpfiles.d/z_61_lirc.conf b/packages/sysutils/lirc/tmpfiles.d/z_61_lirc.conf index e9c344b64f..d1f150c686 100644 --- a/packages/sysutils/lirc/tmpfiles.d/z_61_lirc.conf +++ b/packages/sysutils/lirc/tmpfiles.d/z_61_lirc.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -d /run/lirc 0755 root root - - +d /run/lirc 0755 root root - - diff --git a/packages/sysutils/lirc/udev.d/98-lircd.rules b/packages/sysutils/lirc/udev.d/98-lircd.rules deleted file mode 100644 index 0bc7714ed7..0000000000 --- a/packages/sysutils/lirc/udev.d/98-lircd.rules +++ /dev/null @@ -1,79 +0,0 @@ -################################################################################ -# An example udev rules file for lircd. -################################################################################ - -# lircd_helper only does something for "add" and "remove" actions. -ACTION!="add|remove", GOTO="end" - -KERNEL=="hiddev[0-9]*", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", GOTO="begin" -KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", GOTO="begin" -KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", SUBSYSTEMS=="i2c", GOTO="begin" -KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", SUBSYSTEMS=="usb", GOTO="begin" -KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", SUBSYSTEMS=="platform", GOTO="begin" -KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", SUBSYSTEMS=="pnp", GOTO="begin" -GOTO="end" -LABEL="begin" - -#------------------------------------------------------------------------------- -# Ask lircd_helper to lirc devices. -#------------------------------------------------------------------------------- - -SUBSYSTEM=="lirc", \ - ENV{lircd_driver}="default", \ - ENV{lircd_conf}="lircd.conf" - -### Microsoft Xbox DVD dongle -SUBSYSTEM=="lirc", DRIVERS=="lirc_xbox", \ - ENV{lircd_driver}="default", \ - ENV{lircd_conf}="lircd.conf.xbox" - -### RPi GPIO IR Receiver -SUBSYSTEM=="lirc", DRIVERS=="lirc_rpi", \ - ENV{lircd_driver}="default", \ - ENV{lircd_conf}="lircd.conf.rpi" - -### Odroid AMLogic IR Receiver -SUBSYSTEMS=="platform", DRIVERS=="meson-ir", \ - ENV{lircd_driver}="default", \ - ENV{lircd_conf}="lircd.conf.amremote" - -#------------------------------------------------------------------------------- -# Ask lircd_helper to handle USB devices that do not show up as lirc devices -# and are supported by lircd. Remote controls that are USB HID devices that show -# up as event devices are not included as as they are handled by eventlircd. -#------------------------------------------------------------------------------- -SUBSYSTEMS=="usb", GOTO="begin-usb" -GOTO="end-usb" - -LABEL="begin-usb" - -ENV{ID_USB_INTERFACES}=="", IMPORT{builtin}="usb_id" - -ENV{ID_VENDOR_ID}=="04d8", ENV{ID_MODEL_ID}=="fd08", \ - ENV{lircd_driver}="usb_irtoy", \ - ENV{lircd_conf}="lircd.conf" - -ENV{ID_VENDOR_ID}=="0fe9", ENV{ID_MODEL_ID}=="9010", \ - ENV{lircd_driver}="dvico", \ - ENV{lircd_conf}="lircd.conf" - -ENV{ID_VENDOR_ID}=="04d8", ENV{ID_MODEL_ID}=="f844", \ - ENV{lircd_driver}="irman", \ - ENV{lircd_conf}="lircd.conf" - -LABEL="end-usb" - -ENV{lircd_driver}=="?*", ENV{lircd_conf}=="?*", ACTION=="add", \ - TAG+="systemd", ENV{SYSTEMD_WANTS}+="lircd@$name:$env{lircd_driver}:$env{lircd_conf}.service", \ - RUN+="lircd_wakeup_enable" - -ENV{lircd_driver}=="?*", ENV{lircd_conf}=="?*", ACTION=="add", \ - TAG+="systemd", ENV{SYSTEMD_WANTS}+="lircd-uinput@$name.service" - -ENV{lircd_driver}=="?*", ENV{lircd_conf}=="?*", ACTION=="remove", \ - RUN+="/usr/bin/systemctl stop lircd-uinput@$name.service" - -ENV{lircd_driver}=="?*", ENV{lircd_conf}=="?*", ACTION=="remove", \ - RUN+="/usr/bin/systemctl stop lircd@$name:$env{lircd_driver}:$env{lircd_conf}.service" - -LABEL="end" diff --git a/packages/sysutils/ntfs-3g_ntfsprogs/package.mk b/packages/sysutils/ntfs-3g_ntfsprogs/package.mk index bee0778159..4961fe4574 100644 --- a/packages/sysutils/ntfs-3g_ntfsprogs/package.mk +++ b/packages/sysutils/ntfs-3g_ntfsprogs/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="ntfs-3g_ntfsprogs" -PKG_VERSION="2016.2.22" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2017.3.23" +PKG_SHA256="3e5a021d7b761261836dcb305370af299793eedbded731df3d6943802e1262d5" PKG_LICENSE="GPL" PKG_SITE="http://www.ntfs-3g.org/" PKG_URL="http://tuxera.com/opensource/$PKG_NAME-$PKG_VERSION.tgz" -PKG_DEPENDS_TARGET="toolchain fuse" -PKG_SECTION="system" -PKG_SHORTDESC="ntfs-3g_ntfsprogs: NTFS-3G Read/Write userspace driver" -PKG_LONGDESC="The NTFS-3G_ntfsprogs driver is an open source, freely available NTFS driver for Linux with read and write support. It provides safe and fast handling of the Windows XP, Windows Server 2003, Windows 2000 and Windows Vista file systems." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_DEPENDS_TARGET="toolchain fuse libgcrypt" +PKG_LONGDESC="A NTFS driver with read and write support." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+lto" PKG_CONFIGURE_OPTS_TARGET="--exec-prefix=/usr/ \ --disable-dependency-tracking \ diff --git a/packages/sysutils/ntfs-3g_ntfsprogs/patches/ntfs-3g_ntfsprogs-001-fix-mounting-after-Win10-Creators-Update.patch b/packages/sysutils/ntfs-3g_ntfsprogs/patches/ntfs-3g_ntfsprogs-001-fix-mounting-after-Win10-Creators-Update.patch new file mode 100644 index 0000000000..a5f76321a2 --- /dev/null +++ b/packages/sysutils/ntfs-3g_ntfsprogs/patches/ntfs-3g_ntfsprogs-001-fix-mounting-after-Win10-Creators-Update.patch @@ -0,0 +1,28 @@ +From 801c894b3723ed6345982e0105b342ec119f81ee Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Sat, 16 Jun 2018 15:38:06 +0100 +Subject: [PATCH] Fix for NTFS partitions mounted with Windows 10 Creators + Update + +See: https://bugzilla.redhat.com/show_bug.cgi?id=1527231 +--- + libntfs-3g/volume.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c +index 68b8ee1..d36c7d5 100644 +--- a/libntfs-3g/volume.c ++++ b/libntfs-3g/volume.c +@@ -959,7 +959,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags) + vol->mftmirr_size = l; + } + ntfs_log_debug("Comparing $MFTMirr to $MFT...\n"); +- for (i = 0; i < vol->mftmirr_size; ++i) { ++ /* Windows 10 does not update the full $MFTMirr any more */ ++ for (i = 0; (i < vol->mftmirr_size) && (i < FILE_first_user); ++i) { + MFT_RECORD *mrec, *mrec2; + const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", + "$Volume", "$AttrDef", "root directory", "$Bitmap", +-- +2.14.1 + diff --git a/packages/sysutils/ntfs-3g_ntfsprogs/patches/ntfs-3g_ntfsprogs-01-meh-gcrypt.patch b/packages/sysutils/ntfs-3g_ntfsprogs/patches/ntfs-3g_ntfsprogs-01-meh-gcrypt.patch deleted file mode 100644 index 01ed580f71..0000000000 --- a/packages/sysutils/ntfs-3g_ntfsprogs/patches/ntfs-3g_ntfsprogs-01-meh-gcrypt.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 830c5fb..f9ce6a7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -318,14 +318,6 @@ fi - compile_crypto=false - if test "$enable_crypto" != "no"; then - have_libgcrypt=false -- AM_PATH_LIBGCRYPT(1.2.2, [ have_libgcrypt=true ], -- [ -- if test "$enable_crypto" = "yes"; then -- AC_MSG_ERROR([ntfsprogs crypto code requires the gcrypt library.]) -- else -- AC_MSG_WARN([ntfsprogs crypto code requires the gcrypt library.]) -- fi -- ]) - have_libgnutls=false - PKG_CHECK_MODULES(GNUTLS, gnutls >= 1.4.4, [ have_libgnutls=true ], - if test "$enable_crypto" = "yes"; then - diff --git a/packages/sysutils/open-iscsi/package.mk b/packages/sysutils/open-iscsi/package.mk index 57ff00be0e..161d9cde87 100644 --- a/packages/sysutils/open-iscsi/package.mk +++ b/packages/sysutils/open-iscsi/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2012 Yann Cézard (eesprit@free.fr) +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="open-iscsi" PKG_VERSION="bf39941" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="92b9f0a27a9a373b14eab7b12f1bfff5d4857695a688dc4434df8e7623354588" PKG_LICENSE="GPL" PKG_SITE="https://github.com/mikechristie/open-iscsi" PKG_URL="https://github.com/mikechristie/open-iscsi/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_INIT="toolchain util-linux" -PKG_SECTION="initramfs/system" -PKG_SHORTDESC="open-iscsi: system utilities for Linux to access iSCSI targets" -PKG_LONGDESC="The open-iscsi package allows you to mount iSCSI targets. This package add support for using iscsi target as root device." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The open-iscsi package allows you to mount iSCSI targets." +PKG_TOOLCHAIN="configure" PKG_MAKE_OPTS_INIT="user" @@ -48,5 +28,5 @@ configure_init() { makeinstall_init() { mkdir -p $INSTALL/usr/sbin - cp -P $ROOT/$PKG_BUILD/usr/iscsistart $INSTALL/usr/sbin + cp -P $PKG_BUILD/usr/iscsistart $INSTALL/usr/sbin } diff --git a/packages/sysutils/open-vm-tools/package.mk b/packages/sysutils/open-vm-tools/package.mk index bb39b8f906..f91ea7339a 100644 --- a/packages/sysutils/open-vm-tools/package.mk +++ b/packages/sysutils/open-vm-tools/package.mk @@ -1,36 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com) +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="open-vm-tools" -PKG_VERSION="stable-10.0.7" -PKG_REV="1" +PKG_VERSION="stable-10.3.0" +PKG_SHA256="b3d0b5fd272a8dc35cab1ddd732f9d436f72682925212a6cdeccdab283e2f5ec" PKG_ARCH="x86_64" PKG_LICENSE="GPL" -PKG_SITE="http://open-vm-tools.sourceforge.net" +PKG_SITE="https://github.com/vmware/open-vm-tools" PKG_URL="https://github.com/vmware/open-vm-tools/archive/${PKG_VERSION}.tar.gz" -PKG_DEPENDS_TARGET="toolchain glib:host glib libdnet" -PKG_SECTION="virtualization" -PKG_SHORTDESC="open-vm-tools: open source implementation of VMware Tools" +PKG_DEPENDS_TARGET="toolchain fuse glib:host glib libdnet libtirpc" PKG_LONGDESC="open-vm-tools: open source implementation of VMware Tools" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-docs \ --disable-tests \ @@ -44,14 +26,18 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-docs \ --without-icu \ --without-procps \ --without-kernel-modules \ + --with-udev-rules-dir=/usr/lib/udev/rules.d/ \ --with-sysroot=$SYSROOT_PREFIX" post_unpack() { mv $PKG_BUILD/$PKG_NAME/* $PKG_BUILD/ + + sed -i -e 's|.*common-agent/etc/config/Makefile.*||' $PKG_BUILD/configure.ac + mkdir -p $PKG_BUILD/common-agent/etc/config } pre_configure_target() { - export LIBS="-ldnet" + export LIBS="-ldnet -ltirpc" } post_makeinstall_target() { diff --git a/packages/sysutils/open-vm-tools/patches/open-vm-tools-0001_glib-static.patch b/packages/sysutils/open-vm-tools/patches/open-vm-tools-0001_glib-static.patch deleted file mode 100644 index da5671f3ea..0000000000 --- a/packages/sysutils/open-vm-tools/patches/open-vm-tools-0001_glib-static.patch +++ /dev/null @@ -1,1507 +0,0 @@ -diff -Naur a/lib/glibUtils/fileLogger.c b/lib/glibUtils/fileLogger.c ---- a/lib/glibUtils/fileLogger.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/lib/glibUtils/fileLogger.c 2016-01-15 10:22:59.976153011 +0100 -@@ -44,7 +44,7 @@ - guint maxFiles; - gboolean append; - gboolean error; -- GStaticMutex lock; -+ GMutex lock; - } FileLogger; - - -@@ -327,7 +327,7 @@ - FileLogger *logger = data; - gsize written; - -- g_static_mutex_lock(&logger->lock); -+ g_mutex_lock(&logger->lock); - - if (logger->error) { - goto exit; -@@ -366,7 +366,7 @@ - } - - exit: -- g_static_mutex_unlock(&logger->lock); -+ g_mutex_unlock(&logger->lock); - } - - -@@ -388,7 +388,7 @@ - if (logger->file != NULL) { - g_io_channel_unref(logger->file); - } -- g_static_mutex_free(&logger->lock); -+ g_mutex_free(&logger->lock); - g_free(logger->path); - g_free(logger); - } -@@ -435,7 +435,7 @@ - data->append = append; - data->maxSize = maxSize * 1024 * 1024; - data->maxFiles = maxFiles + 1; /* To account for the active log file. */ -- g_static_mutex_init(&data->lock); -+ g_mutex_init(&data->lock); - - return &data->handler; - } -diff -Naur a/lib/glibUtils/stdLogger.c b/lib/glibUtils/stdLogger.c ---- a/lib/glibUtils/stdLogger.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/lib/glibUtils/stdLogger.c 2016-01-15 10:24:07.078256206 +0100 -@@ -66,12 +66,12 @@ - StdLogger *sdata = data; - - if (!sdata->attached) { -- g_static_mutex_lock(&gConsoleLock); -+ g_mutex_lock(&gConsoleLock); - if (gRefCount != 0 || GlibUtils_AttachConsole()) { - gRefCount++; - sdata->attached = TRUE; - } -- g_static_mutex_unlock(&gConsoleLock); -+ g_mutex_unlock(&gConsoleLock); - } - - if (!sdata->attached) { -@@ -105,11 +105,11 @@ - { - #if defined(_WIN32) - StdLogger *sdata = data; -- g_static_mutex_lock(&gConsoleLock); -+ g_mutex_lock(&gConsoleLock); - if (sdata->attached && --gRefCount == 0) { - FreeConsole(); - } -- g_static_mutex_unlock(&gConsoleLock); -+ g_mutex_unlock(&gConsoleLock); - #endif - g_free(data); - } -diff -Naur a/lib/glibUtils/sysLogger.c b/lib/glibUtils/sysLogger.c ---- a/lib/glibUtils/sysLogger.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/lib/glibUtils/sysLogger.c 2016-01-15 10:37:53.148968674 +0100 -@@ -38,7 +38,7 @@ - - - static SysLogger *gSysLogger; --static GStaticMutex gSysLoggerLock = G_STATIC_MUTEX_INIT; -+static GMutex gSysLoggerLock; - - - /* -@@ -105,7 +105,7 @@ - { - g_return_if_fail(data == gSysLogger); - g_return_if_fail(gSysLogger->refcount > 0); -- g_static_mutex_lock(&gSysLoggerLock); -+ g_mutex_lock(&gSysLoggerLock); - gSysLogger->refcount -= 1; - if (gSysLogger->refcount == 0) { - closelog(); -@@ -113,7 +113,7 @@ - g_free(gSysLogger); - gSysLogger = NULL; - } -- g_static_mutex_unlock(&gSysLoggerLock); -+ g_mutex_unlock(&gSysLoggerLock); - } - - -@@ -140,7 +140,7 @@ - GlibUtils_CreateSysLogger(const char *domain, - const char *facility) - { -- g_static_mutex_lock(&gSysLoggerLock); -+ g_mutex_lock(&gSysLoggerLock); - if (gSysLogger == NULL) { - int facid = LOG_USER; - -@@ -203,7 +203,7 @@ - } else { - gSysLogger->refcount += 1; - } -- g_static_mutex_unlock(&gSysLoggerLock); -+ g_mutex_unlock(&gSysLoggerLock); - return &gSysLogger->handler; - } - -diff -Naur a/lib/rpcChannel/rpcChannelInt.h b/lib/rpcChannel/rpcChannelInt.h ---- a/lib/rpcChannel/rpcChannelInt.h 2015-11-24 07:59:42.000000000 +0100 -+++ b/lib/rpcChannel/rpcChannelInt.h 2016-01-15 11:30:31.403376775 +0100 -@@ -53,7 +53,7 @@ - GMainContext *mainCtx; - const char *appName; - gpointer appCtx; -- GStaticMutex outLock; -+ GMutex outLock; - struct RpcIn *in; - gboolean inStarted; - gboolean outStarted; -diff -Naur a/libvmtools/vmtoolsLog.c b/libvmtools/vmtoolsLog.c ---- a/libvmtools/vmtoolsLog.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/libvmtools/vmtoolsLog.c 2016-01-15 11:34:45.221864504 +0100 -@@ -160,7 +160,7 @@ - static LogHandler *gErrorSyslog; - static GPtrArray *gDomains = NULL; - static gboolean gLogInitialized = FALSE; --static GStaticRecMutex gLogStateMutex = G_STATIC_REC_MUTEX_INIT; -+static GRecMutex gLogStateMutex; - static gboolean gLoggingStopped = FALSE; - static gboolean gLogIOSuspended = FALSE; - -@@ -1055,7 +1055,7 @@ - gLogEnabled |= force; - if (!gLogInitialized) { - gLogInitialized = TRUE; -- g_static_rec_mutex_init(&gLogStateMutex); -+ g_rec_mutex_init(&gLogStateMutex); - } - - gMaxCacheEntries = g_key_file_get_integer(cfg, LOGGING_GROUP, -@@ -1221,7 +1221,7 @@ - void - VMTools_AcquireLogStateLock(void) - { -- g_static_rec_mutex_lock(&gLogStateMutex); -+ g_rec_mutex_lock(&gLogStateMutex); - } - - -@@ -1232,7 +1232,7 @@ - void - VMTools_ReleaseLogStateLock(void) - { -- g_static_rec_mutex_unlock(&gLogStateMutex); -+ g_rec_mutex_unlock(&gLogStateMutex); - } - - -diff -Naur a/libvmtools/i18n.c b/libvmtools/i18n.c ---- a/libvmtools/i18n.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/libvmtools/i18n.c 2016-01-15 11:37:18.900142179 +0100 -@@ -54,7 +54,7 @@ - - typedef struct MsgState { - HashTable *domains; /* List of text domains. */ -- GStaticMutex lock; /* Mutex to protect shared state. */ -+ GMutex lock; /* Mutex to protect shared state. */ - } MsgState; - - -@@ -132,7 +132,7 @@ - { - ASSERT(gMsgState == NULL); - gMsgState = g_new0(MsgState, 1); -- g_static_mutex_init(&gMsgState->lock); -+ g_mutex_init(&gMsgState->lock); - return NULL; - } - -@@ -343,7 +343,7 @@ - * This lock is pretty coarse-grained, but a lot of the code below just runs - * in exceptional situations, so it should be OK. - */ -- g_static_mutex_lock(&state->lock); -+ g_mutex_lock(&state->lock); - - catalog = MsgGetCatalog(domain); - if (catalog != NULL) { -@@ -414,7 +414,7 @@ - } - } - -- g_static_mutex_unlock(&state->lock); -+ g_mutex_unlock(&state->lock); - - return strp; - } -@@ -681,7 +681,7 @@ - if (gMsgState->domains != NULL) { - HashTable_Free(gMsgState->domains); - } -- g_static_mutex_free(&gMsgState->lock); -+ g_mutex_free(&gMsgState->lock); - g_free(gMsgState); - } - } -@@ -774,9 +774,9 @@ - "catalog dir '%s'.\n", domain, lang, catdir); - } - } else { -- g_static_mutex_lock(&state->lock); -+ g_mutex_lock(&state->lock); - MsgSetCatalog(domain, catalog); -- g_static_mutex_unlock(&state->lock); -+ g_mutex_unlock(&state->lock); - } - g_free(file); - free(dfltdir); -diff -Naur a/lib/rpcChannel/rpcChannel.c b/lib/rpcChannel/rpcChannel.c ---- a/lib/rpcChannel/rpcChannel.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/lib/rpcChannel/rpcChannel.c 2016-01-15 11:46:08.061147289 +0100 -@@ -675,7 +675,7 @@ - chan = BackdoorChannel_New(); - #endif - if (chan) { -- g_static_mutex_init(&chan->outLock); -+ g_mutex_init(&chan->outLock); - } - return chan; - } -@@ -691,7 +691,7 @@ - RpcChannel_Shutdown(RpcChannel *chan) - { - if (chan != NULL) { -- g_static_mutex_free(&chan->outLock); -+ g_mutex_free(&chan->outLock); - } - - if (chan != NULL && chan->funcs != NULL && chan->funcs->shutdown != NULL) { -@@ -776,7 +776,7 @@ - g_return_if_fail(chan->funcs != NULL); - g_return_if_fail(chan->funcs->stop != NULL); - -- g_static_mutex_lock(&chan->outLock); -+ g_mutex_lock(&chan->outLock); - chan->funcs->stop(chan); - - if (chan->in != NULL) { -@@ -787,7 +787,7 @@ - } else { - ASSERT(!chan->inStarted); - } -- g_static_mutex_unlock(&chan->outLock); -+ g_mutex_unlock(&chan->outLock); - } - - -@@ -853,7 +853,7 @@ - - ASSERT(chan && chan->funcs); - -- g_static_mutex_lock(&chan->outLock); -+ g_mutex_lock(&chan->outLock); - - funcs = chan->funcs; - ASSERT(funcs->send); -@@ -902,7 +902,7 @@ - } - - exit: -- g_static_mutex_unlock(&chan->outLock); -+ g_mutex_unlock(&chan->outLock); - return ok; - } - -diff -Naur a/lib/rpcChannel/rpcChannel.c.save b/lib/rpcChannel/rpcChannel.c.save ---- a/lib/rpcChannel/rpcChannel.c.save 1970-01-01 01:00:00.000000000 +0100 -+++ b/lib/rpcChannel/rpcChannel.c.save 2016-01-15 11:44:57.245012048 +0100 -@@ -0,0 +1,1049 @@ -+/********************************************************* -+ * Copyright (C) 2008-2015 VMware, Inc. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation version 2.1 and no later version. -+ * -+ * This program 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 Lesser GNU General Public -+ * License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ *********************************************************/ -+ -+/** -+ * @file rpcChannel.c -+ * -+ * Common functions to all RPC channel implementations. -+ */ -+ -+#include -+#include "vm_assert.h" -+#include "dynxdr.h" -+#include "rpcChannelInt.h" -+#include "str.h" -+#include "strutil.h" -+#include "vmxrpc.h" -+#include "xdrutil.h" -+#include "rpcin.h" -+#include "debug.h" -+ -+/** Internal state of a channel. */ -+typedef struct RpcChannelInt { -+ RpcChannel impl; -+ gchar *appName; -+ GHashTable *rpcs; -+ GMainContext *mainCtx; -+ GSource *resetCheck; -+ gpointer appCtx; -+ RpcChannelCallback resetReg; -+ RpcChannelResetCb resetCb; -+ gpointer resetData; -+ gboolean rpcError; -+ guint rpcErrorCount; -+} RpcChannelInt; -+ -+/** Max number of times to attempt a channel restart. */ -+#define RPCIN_MAX_RESTARTS 60 -+ -+#define LGPFX "RpcChannel: " -+ -+static gboolean -+RpcChannelPing(RpcInData *data); -+ -+static RpcChannelCallback gRpcHandlers[] = { -+ { "ping", RpcChannelPing, NULL, NULL, NULL, 0 } -+}; -+ -+static gboolean gUseBackdoorOnly = FALSE; -+ -+/* -+ * Track the vSocket connection failure, so that we can -+ * avoid using vSockets until a channel reset/restart or -+ * the service itself gets restarted. -+ */ -+static gboolean gVSocketFailed = FALSE; -+ -+/** -+ * Handler for a "ping" message. Does nothing. -+ * -+ * @param[in] data The RPC data. -+ * -+ * @return TRUE. -+ */ -+ -+static gboolean -+RpcChannelPing(RpcInData *data) -+{ -+ return RPCIN_SETRETVALS(data, "", TRUE); -+} -+ -+ -+/** -+ * Callback for restarting the RPC channel. -+ * -+ * @param[in] _chan The RPC channel -+ * -+ * @return FALSE -+ */ -+ -+static gboolean -+RpcChannelRestart(gpointer _chan) -+{ -+ RpcChannelInt *chan = _chan; -+ -+ RpcChannel_Stop(&chan->impl); -+ /* Clear vSocket channel failure */ -+ Debug(LGPFX "Clearing backdoor behavior ...\n"); -+ gVSocketFailed = FALSE; -+ -+ if (!RpcChannel_Start(&chan->impl)) { -+ Warning("Channel restart failed [%d]\n", chan->rpcErrorCount); -+ if (chan->resetCb != NULL) { -+ chan->resetCb(&chan->impl, FALSE, chan->resetData); -+ } -+ } else { -+ chan->rpcError = FALSE; -+ } -+ -+ return FALSE; -+} -+ -+ -+/** -+ * Checks and potentially resets the RPC channel. This code is based on the -+ * toolsDaemon.c function "ToolsDaemon_CheckReset". -+ * -+ * @param[in] _chan The RPC channel. -+ * -+ * @return FALSE. The reset callback will schedule a new check when it's called. -+ */ -+ -+static gboolean -+RpcChannelCheckReset(gpointer _chan) -+{ -+ static int channelTimeoutAttempts = RPCIN_MAX_RESTARTS; -+ RpcChannelInt *chan = _chan; -+ -+ /* Check the channel state. */ -+ if (chan->rpcError) { -+ GSource *src; -+ -+ if (++(chan->rpcErrorCount) > channelTimeoutAttempts) { -+ Warning("Failed to reset channel after %u attempts\n", -+ chan->rpcErrorCount - 1); -+ if (chan->resetCb != NULL) { -+ chan->resetCb(&chan->impl, FALSE, chan->resetData); -+ } -+ goto exit; -+ } -+ -+ /* Schedule the channel restart for 1 sec in the future. */ -+ Debug(LGPFX "Resetting channel [%u]\n", chan->rpcErrorCount); -+ src = g_timeout_source_new(1000); -+ g_source_set_callback(src, RpcChannelRestart, chan, NULL); -+ g_source_attach(src, chan->mainCtx); -+ g_source_unref(src); -+ goto exit; -+ } -+ -+ /* Reset was successful. */ -+ Debug(LGPFX "Channel was reset successfully.\n"); -+ chan->rpcErrorCount = 0; -+ Debug(LGPFX "Clearing backdoor behavior ...\n"); -+ gVSocketFailed = FALSE; -+ -+ if (chan->resetCb != NULL) { -+ chan->resetCb(&chan->impl, TRUE, chan->resetData); -+ } -+ -+exit: -+ g_source_unref(chan->resetCheck); -+ chan->resetCheck = NULL; -+ return FALSE; -+} -+ -+ -+/** -+ * Handles an RPC reset. Calls the reset callback of all loaded plugins. -+ * -+ * @param[in] data The RPC data. -+ * -+ * @return TRUE. -+ */ -+ -+static gboolean -+RpcChannelReset(RpcInData *data) -+{ -+ gchar *msg; -+ RpcChannelInt *chan = data->clientData; -+ -+ if (chan->resetCheck == NULL) { -+ chan->resetCheck = g_idle_source_new(); -+ g_source_set_priority(chan->resetCheck, G_PRIORITY_HIGH); -+ g_source_set_callback(chan->resetCheck, RpcChannelCheckReset, chan, NULL); -+ g_source_attach(chan->resetCheck, chan->mainCtx); -+ } -+ -+ msg = Str_Asprintf(NULL, "ATR %s", chan->appName); -+ ASSERT_MEM_ALLOC(msg); -+ return RPCIN_SETRETVALSF(data, msg, TRUE); -+} -+ -+ -+/** -+ * A wrapper for standard RPC callback functions which provides automatic -+ * XDR serialization / deserialization if requested by the application. -+ * -+ * @param[in] data RpcIn data. -+ * @param[in] rpc The RPC registration data. -+ * -+ * @return Whether the RPC was handled successfully. -+ */ -+ -+static Bool -+RpcChannelXdrWrapper(RpcInData *data, -+ RpcChannelCallback *rpc) -+{ -+ Bool ret; -+ RpcInData copy; -+ void *xdrData = NULL; -+ -+ if (rpc->xdrIn != NULL) { -+ xdrData = malloc(rpc->xdrInSize); -+ if (xdrData == NULL) { -+ ret = RPCIN_SETRETVALS(data, "Out of memory.", FALSE); -+ goto exit; -+ } -+ -+ memset(xdrData, 0, rpc->xdrInSize); -+ if (!XdrUtil_Deserialize(data->args + 1, data->argsSize - 1, -+ rpc->xdrIn, xdrData)) { -+ ret = RPCIN_SETRETVALS(data, "XDR deserialization failed.", FALSE); -+ free(xdrData); -+ goto exit; -+ } -+ -+ copy.name = data->name; -+ copy.args = xdrData; -+ copy.argsSize = rpc->xdrInSize; -+ copy.result = data->result; -+ copy.resultLen = data->resultLen; -+ copy.freeResult = data->freeResult; -+ copy.appCtx = data->appCtx; -+ copy.clientData = rpc->clientData; -+ } else { -+ memcpy(©, data, sizeof copy); -+ } -+ -+ ret = rpc->callback(©); -+ -+ if (rpc->xdrIn != NULL) { -+ VMX_XDR_FREE(rpc->xdrIn, xdrData); -+ free(xdrData); -+ copy.args = NULL; -+ data->result = copy.result; -+ data->resultLen = copy.resultLen; -+ data->freeResult = copy.freeResult; -+ } -+ -+ if (rpc->xdrOut != NULL && copy.result != NULL) { -+ XDR xdrs; -+ xdrproc_t xdrProc = rpc->xdrOut; -+ -+ if (DynXdr_Create(&xdrs) == NULL) { -+ ret = RPCIN_SETRETVALS(data, "Out of memory.", FALSE); -+ goto exit; -+ } -+ -+ if (!xdrProc(&xdrs, copy.result)) { -+ ret = RPCIN_SETRETVALS(data, "XDR serialization failed.", FALSE); -+ DynXdr_Destroy(&xdrs, TRUE); -+ goto exit; -+ } -+ -+ if (copy.freeResult) { -+ VMX_XDR_FREE(rpc->xdrOut, copy.result); -+ } -+ data->result = DynXdr_Get(&xdrs); -+ data->resultLen = XDR_GETPOS(&xdrs); -+ data->freeResult = TRUE; -+ DynXdr_Destroy(&xdrs, FALSE); -+ } -+ -+exit: -+ if (copy.freeResult && copy.result != NULL) { -+ g_free(copy.result); -+ } -+ return ret; -+} -+ -+ -+/** -+ * Builds an "rpcout" command to send a XDR struct. -+ * -+ * @param[in] cmd The command name. -+ * @param[in] xdrProc Function to use for serializing the XDR struct. -+ * @param[in] xdrData The XDR struct to serialize. -+ * @param[out] result Where to store the serialized data. -+ * @param[out] resultLen Where to store the serialized data length. -+ * -+ * @return Whether successfully built the command. -+ */ -+ -+gboolean -+RpcChannel_BuildXdrCommand(const char *cmd, -+ void *xdrProc, -+ void *xdrData, -+ char **result, -+ size_t *resultLen) -+{ -+ Bool ret = FALSE; -+ xdrproc_t proc = xdrProc; -+ XDR xdrs; -+ -+ if (DynXdr_Create(&xdrs) == NULL) { -+ return FALSE; -+ } -+ -+ if (!DynXdr_AppendRaw(&xdrs, cmd, strlen(cmd))) { -+ goto exit; -+ } -+ -+ if (!DynXdr_AppendRaw(&xdrs, " ", 1)) { -+ goto exit; -+ } -+ -+ if (!proc(&xdrs, xdrData)) { -+ goto exit; -+ } -+ -+ *result = DynXdr_Get(&xdrs); -+ *resultLen = xdr_getpos(&xdrs); -+ -+ ret = TRUE; -+ -+exit: -+ DynXdr_Destroy(&xdrs, !ret); -+ return ret; -+} -+ -+ -+/** -+ * Creates a new RpcChannel without any implementation. -+ * -+ * This is mainly for use of code that is implementing a custom RpcChannel. -+ * Such implementations should provide their own "constructor"-type function -+ * which should then call this function to get an RpcChannel instance. They -+ * should then fill in the function pointers that provide the implementation -+ * for the channel before making the channel available to the callers. -+ * -+ * @return A new RpcChannel instance. -+ */ -+ -+RpcChannel * -+RpcChannel_Create(void) -+{ -+ RpcChannelInt *chan = g_new0(RpcChannelInt, 1); -+ return &chan->impl; -+} -+ -+ -+/** -+ * Dispatches the given RPC to the registered handler. This mimics the behavior -+ * of the RpcIn library (but is not tied to that particular implementation of -+ * an RPC channel). -+ * -+ * @param[in,out] data The RPC data. -+ * -+ * @return Whether the RPC was handled successfully. -+ */ -+ -+gboolean -+RpcChannel_Dispatch(RpcInData *data) -+{ -+ char *name = NULL; -+ unsigned int index = 0; -+ size_t nameLen; -+ Bool status; -+ RpcChannelCallback *rpc = NULL; -+ RpcChannelInt *chan = data->clientData; -+ -+ name = StrUtil_GetNextToken(&index, data->args, " "); -+ if (name == NULL) { -+ Debug(LGPFX "Bad command (null) received.\n"); -+ status = RPCIN_SETRETVALS(data, "Bad command", FALSE); -+ goto exit; -+ } -+ -+ if (chan->rpcs != NULL) { -+ rpc = g_hash_table_lookup(chan->rpcs, name); -+ } -+ -+ if (rpc == NULL) { -+ Debug(LGPFX "Unknown Command '%s': Handler not registered.\n", name); -+ status = RPCIN_SETRETVALS(data, "Unknown Command", FALSE); -+ goto exit; -+ } -+ -+ /* Adjust the RPC arguments. */ -+ nameLen = strlen(name); -+ data->name = name; -+ data->args = data->args + nameLen; -+ data->argsSize -= nameLen; -+ data->appCtx = chan->appCtx; -+ data->clientData = rpc->clientData; -+ -+ if (rpc->xdrIn != NULL || rpc->xdrOut != NULL) { -+ status = RpcChannelXdrWrapper(data, rpc); -+ } else { -+ status = rpc->callback(data); -+ } -+ -+ ASSERT(data->result != NULL); -+ -+exit: -+ data->name = NULL; -+ free(name); -+ return status; -+} -+ -+ -+/** -+ * Shuts down an RPC channel and release any held resources. -+ * -+ * @param[in] chan The RPC channel. -+ * -+ * @return Whether the channel was shut down successfully. -+ */ -+ -+gboolean -+RpcChannel_Destroy(RpcChannel *chan) -+{ -+ size_t i; -+ RpcChannelInt *cdata = (RpcChannelInt *) chan; -+ -+ if (cdata->impl.funcs != NULL && cdata->impl.funcs->shutdown != NULL) { -+ cdata->impl.funcs->shutdown(chan); -+ } -+ -+ RpcChannel_UnregisterCallback(chan, &cdata->resetReg); -+ for (i = 0; i < ARRAYSIZE(gRpcHandlers); i++) { -+ RpcChannel_UnregisterCallback(chan, &gRpcHandlers[i]); -+ } -+ -+ if (cdata->rpcs != NULL) { -+ g_hash_table_destroy(cdata->rpcs); -+ cdata->rpcs = NULL; -+ } -+ -+ cdata->resetCb = NULL; -+ cdata->resetData = NULL; -+ cdata->appCtx = NULL; -+ -+ g_free(cdata->appName); -+ cdata->appName = NULL; -+ -+ if (cdata->mainCtx != NULL) { -+ g_main_context_unref(cdata->mainCtx); -+ cdata->mainCtx = NULL; -+ } -+ -+ if (cdata->resetCheck != NULL) { -+ g_source_destroy(cdata->resetCheck); -+ cdata->resetCheck = NULL; -+ } -+ -+ g_free(cdata); -+ return TRUE; -+} -+ -+ -+/** -+ * Error handling function for the RPC channel. Enqueues the "check reset" -+ * function for running later, if it's not yet enqueued. -+ * -+ * @param[in] _chan The RPC channel. -+ * @param[in] status Error description. -+ */ -+ -+void -+RpcChannel_Error(void *_chan, -+ char const *status) -+{ -+ RpcChannelInt *chan = _chan; -+ chan->rpcError = TRUE; -+ /* -+ * XXX: Workaround for PR 935520. -+ * Revert the log call to Warning() after fixing PR 955746. -+ */ -+ Debug(LGPFX "Error in the RPC receive loop: %s.\n", status); -+ -+ if (chan->resetCheck == NULL) { -+ chan->resetCheck = g_idle_source_new(); -+ g_source_set_callback(chan->resetCheck, RpcChannelCheckReset, chan, NULL); -+ g_source_attach(chan->resetCheck, chan->mainCtx); -+ } -+} -+ -+ -+/** -+ * Initializes the RPC channel for inbound operations. -+ * -+ * This function must be called before starting the channel if the application -+ * wants to receive messages on the channel. Applications don't need to call it -+ * if only using the outbound functionality. -+ * -+ * @param[in] chan The RPC channel. -+ * @param[in] appName TCLO application name. -+ * @param[in] mainCtx Application event context. -+ * @param[in] appCtx Application context. -+ * @param[in] resetCb Callback for when a reset occurs. -+ * @param[in] resetData Client data for the reset callback. -+ */ -+ -+void -+RpcChannel_Setup(RpcChannel *chan, -+ const gchar *appName, -+ GMainContext *mainCtx, -+ gpointer appCtx, -+ RpcChannelResetCb resetCb, -+ gpointer resetData) -+{ -+ size_t i; -+ RpcChannelInt *cdata = (RpcChannelInt *) chan; -+ -+ cdata->appName = g_strdup(appName); -+ cdata->appCtx = appCtx; -+ cdata->mainCtx = g_main_context_ref(mainCtx); -+ cdata->resetCb = resetCb; -+ cdata->resetData = resetData; -+ -+ cdata->resetReg.name = "reset"; -+ cdata->resetReg.callback = RpcChannelReset; -+ cdata->resetReg.clientData = chan; -+ -+ /* Register the callbacks handled by the rpcChannel library. */ -+ RpcChannel_RegisterCallback(chan, &cdata->resetReg); -+ -+ for (i = 0; i < ARRAYSIZE(gRpcHandlers); i++) { -+ RpcChannel_RegisterCallback(chan, &gRpcHandlers[i]); -+ } -+ -+ if (chan->funcs != NULL && chan->funcs->setup != NULL) { -+ chan->funcs->setup(chan, mainCtx, appName, appCtx); -+ } else { -+ chan->mainCtx = g_main_context_ref(mainCtx); -+ chan->in = RpcIn_Construct(mainCtx, RpcChannel_Dispatch, chan); -+ ASSERT(chan->in != NULL); -+ } -+} -+ -+ -+/** -+ * Sets the non-freeable result of the given RPC context to the given value. -+ * The result should be a NULL-terminated string. -+ * -+ * @param[in] data RPC context. -+ * @param[in] result Result string. -+ * @param[in] retVal Return value of this function. -+ * -+ * @return @a retVal -+ */ -+ -+gboolean -+RpcChannel_SetRetVals(RpcInData *data, -+ char const *result, -+ gboolean retVal) -+{ -+ ASSERT(data); -+ -+ /* This cast is safe: data->result will not be freed. */ -+ data->result = (char *)result; -+ data->resultLen = strlen(data->result); -+ data->freeResult = FALSE; -+ -+ return retVal; -+} -+ -+ -+/** -+ * Sets the freeable result of the given RPC context to the given value. -+ * The result should be a NULL-terminated string. -+ * -+ * @param[in] data RPC context. -+ * @param[in] result Result string. -+ * @param[in] retVal Return value of this function. -+ * -+ * @return @a retVal -+ */ -+ -+gboolean -+RpcChannel_SetRetValsF(RpcInData *data, -+ char *result, -+ gboolean retVal) -+{ -+ ASSERT(data); -+ -+ data->result = result; -+ data->resultLen = strlen(data->result); -+ data->freeResult = TRUE; -+ -+ return retVal; -+} -+ -+ -+/** -+ * Registers a new RPC handler in the given RPC channel. This function is -+ * not thread-safe. -+ * -+ * @param[in] chan The channel instance. -+ * @param[in] rpc Info about the RPC being registered. -+ */ -+ -+void -+RpcChannel_RegisterCallback(RpcChannel *chan, -+ RpcChannelCallback *rpc) -+{ -+ RpcChannelInt *cdata = (RpcChannelInt *) chan; -+ ASSERT(rpc->name != NULL && strlen(rpc->name) > 0); -+ ASSERT(rpc->callback); -+ ASSERT(rpc->xdrIn == NULL || rpc->xdrInSize > 0); -+ if (cdata->rpcs == NULL) { -+ cdata->rpcs = g_hash_table_new(g_str_hash, g_str_equal); -+ } -+ if (g_hash_table_lookup(cdata->rpcs, rpc->name) != NULL) { -+ Panic("Trying to overwrite existing RPC registration for %s!\n", rpc->name); -+ } -+ g_hash_table_insert(cdata->rpcs, (gpointer) rpc->name, rpc); -+} -+ -+ -+/** -+ * Unregisters a new RPC handler from the given RPC channel. This function is -+ * not thread-safe. -+ * -+ * @param[in] chan The channel instance. -+ * @param[in] rpc Info about the RPC being unregistered. -+ */ -+ -+void -+RpcChannel_UnregisterCallback(RpcChannel *chan, -+ RpcChannelCallback *rpc) -+{ -+ RpcChannelInt *cdata = (RpcChannelInt *) chan; -+ if (cdata->rpcs != NULL) { -+ g_hash_table_remove(cdata->rpcs, rpc->name); -+ } -+} -+ -+ -+/** -+ * Force to create backdoor channels only. -+ * This provides a kill-switch to disable vsocket channels if needed. -+ * This needs to be called before RpcChannel_New to take effect. -+ */ -+ -+void -+RpcChannel_SetBackdoorOnly(void) -+{ -+ gUseBackdoorOnly = TRUE; -+ Debug(LGPFX "Using vsocket is disabled.\n"); -+} -+ -+ -+/** -+ * Create an RpcChannel instance using a prefered channel implementation, -+ * currently this is VSockChannel. -+ * -+ * @return RpcChannel -+ */ -+ -+RpcChannel * -+RpcChannel_New(void) -+{ -+ RpcChannel *chan; -+#if (defined(__linux__) && !defined(USERWORLD)) || defined(_WIN32) -+ chan = (gUseBackdoorOnly || gVSocketFailed) ? -+ BackdoorChannel_New() : VSockChannel_New(); -+#else -+ chan = BackdoorChannel_New(); -+#endif -+ if (chan) { -+ g_mutex_init(&chan->outLock); -+ } -+ return chan; -+} -+ -+ -+/** -+ * Wrapper for the shutdown function of an RPC channel struct. -+ * -+ * @param[in] chan The RPC channel instance. -+ */ -+ -+void -+RpcChannel_Shutdown(RpcChannel *chan) -+{ -+ if (chan != NULL) { -+ g_static_mutex_free(&chan->outLock); -+ } -+ -+ if (chan != NULL && chan->funcs != NULL && chan->funcs->shutdown != NULL) { -+ if (chan->in != NULL) { -+ if (chan->inStarted) { -+ RpcIn_stop(chan->in); -+ } -+ chan->inStarted = FALSE; -+ RpcIn_Destruct(chan->in); -+ chan->in = NULL; -+ } else { -+ ASSERT(!chan->inStarted); -+ } -+ -+ if (chan->mainCtx != NULL) { -+ g_main_context_unref(chan->mainCtx); -+ } -+ chan->funcs->shutdown(chan); -+ } -+} -+ -+ -+/** -+ * Start an RPC channel. We may fallback to backdoor channel when other type -+ * of channel fails to start. -+ * -+ * @param[in] chan The RPC channel instance. -+ * -+ * @return TRUE on success. -+ */ -+ -+gboolean -+RpcChannel_Start(RpcChannel *chan) -+{ -+ gboolean ok; -+ const RpcChannelFuncs *funcs; -+ -+ if (chan == NULL || chan->funcs == NULL || chan->funcs->start == NULL) { -+ return FALSE; -+ } -+ -+ if (chan->outStarted) { -+ /* Already started. Make sure both channels are in sync and return. */ -+ ASSERT(chan->in == NULL || chan->inStarted); -+ return TRUE; -+ } -+ -+ if (chan->in != NULL && !chan->inStarted) { -+ ok = RpcIn_start(chan->in, RPCIN_MAX_DELAY, RpcChannel_Error, chan); -+ chan->inStarted = ok; -+ } -+ -+ funcs = chan->funcs; -+ ok = funcs->start(chan); -+ -+ if (!ok && funcs->onStartErr != NULL) { -+ Debug(LGPFX "Fallback to backdoor ...\n"); -+ funcs->onStartErr(chan); -+ ok = BackdoorChannel_Fallback(chan); -+ /* -+ * As vSocket is not available, we stick the backdoor -+ * behavior until the channel is reset/restarted. -+ */ -+ Debug(LGPFX "Sticking backdoor behavior ...\n"); -+ gVSocketFailed = TRUE; -+ } -+ -+ return ok; -+} -+ -+ -+/** -+ * Wrapper for the stop function of an RPC channel struct. -+ * -+ * @param[in] chan The RPC channel instance. -+ */ -+ -+void -+RpcChannel_Stop(RpcChannel *chan) -+{ -+ g_return_if_fail(chan != NULL); -+ g_return_if_fail(chan->funcs != NULL); -+ g_return_if_fail(chan->funcs->stop != NULL); -+ -+ g_static_mutex_lock(&chan->outLock); -+ chan->funcs->stop(chan); -+ -+ if (chan->in != NULL) { -+ if (chan->inStarted) { -+ RpcIn_stop(chan->in); -+ } -+ chan->inStarted = FALSE; -+ } else { -+ ASSERT(!chan->inStarted); -+ } -+ g_static_mutex_unlock(&chan->outLock); -+} -+ -+ -+/** -+ * Wrapper for get channel type function of an RPC channel struct. -+ * -+ * @param[in] chan The RPC channel instance. -+ */ -+ -+RpcChannelType -+RpcChannel_GetType(RpcChannel *chan) -+{ -+ if (chan == NULL || chan->funcs == NULL || chan->funcs->getType == NULL) { -+ return RPCCHANNEL_TYPE_INACTIVE; -+ } -+ return chan->funcs->getType(chan); -+} -+ -+ -+/** -+ * Free the allocated memory for the results from RpcChannel_Send* calls. -+ * -+ * @param[in] ptr result from RpcChannel_Send* calls. -+ * -+ * @return none -+ */ -+ -+void -+RpcChannel_Free(void *ptr) -+{ -+ free(ptr); -+} -+ -+ -+/** -+ * Send function of an RPC channel struct. Retry once if it fails for -+ * non-backdoor Channels. Backdoor channel already tries inside. A second try -+ * may create a different type of channel. -+ * -+ * @param[in] chan The RPC channel instance. -+ * @param[in] data Data to send. -+ * @param[in] dataLen Number of bytes to send. -+ * @param[out] result Response from other side (should be freed by -+ * calling RpcChannel_Free). -+ * @param[out] resultLen Number of bytes in response. -+ * -+ * @return The status from the remote end (TRUE if call was successful). -+ */ -+ -+gboolean -+RpcChannel_Send(RpcChannel *chan, -+ char const *data, -+ size_t dataLen, -+ char **result, -+ size_t *resultLen) -+{ -+ gboolean ok; -+ char *res = NULL; -+ size_t resLen = 0; -+ const RpcChannelFuncs *funcs; -+ -+ Debug(LGPFX "Sending: %"FMTSZ"u bytes\n", dataLen); -+ -+ ASSERT(chan && chan->funcs); -+ -+ g_static_mutex_lock(&chan->outLock); -+ -+ funcs = chan->funcs; -+ ASSERT(funcs->send); -+ -+ if (result != NULL) { -+ *result = NULL; -+ } -+ if (resultLen != NULL) { -+ *resultLen = 0; -+ } -+ -+ ok = funcs->send(chan, data, dataLen, &res, &resLen); -+ -+ if (!ok && (funcs->getType(chan) != RPCCHANNEL_TYPE_BKDOOR) && -+ (funcs->stopRpcOut != NULL)) { -+ -+ free(res); -+ res = NULL; -+ resLen = 0; -+ -+ /* retry once */ -+ Debug(LGPFX "Stop RpcOut channel and try to send again ...\n"); -+ funcs->stopRpcOut(chan); -+ if (RpcChannel_Start(chan)) { -+ /* The channel may get switched from vsocket to backdoor */ -+ funcs = chan->funcs; -+ ASSERT(funcs->send); -+ ok = funcs->send(chan, data, dataLen, &res, &resLen); -+ goto done; -+ } -+ -+ ok = FALSE; -+ goto exit; -+ } -+ -+done: -+ if (ok) { -+ Debug(LGPFX "Recved %"FMTSZ"u bytes\n", resLen); -+ } -+ -+ if (result != NULL) { -+ *result = res; -+ } -+ if (resultLen != NULL) { -+ *resultLen = resLen; -+ } -+ -+exit: -+ g_static_mutex_unlock(&chan->outLock); -+ return ok; -+} -+ -+ -+/** -+ * Open/close RpcChannel each time for sending a Rpc message, this is a wrapper -+ * for RpcChannel APIs. -+ * -+ * @param[in] data request data -+ * @param[in] dataLen data length -+ * @param[in] result reply, should be freed by calling RpcChannel_Free. -+ * @param[in] resultLen reply length -+ -+ * @returns TRUE on success. -+ */ -+ -+gboolean -+RpcChannel_SendOneRaw(const char *data, -+ size_t dataLen, -+ char **result, -+ size_t *resultLen) -+{ -+ RpcChannel *chan; -+ gboolean status; -+ -+ status = FALSE; -+ -+ chan = RpcChannel_New(); -+ if (chan == NULL) { -+ if (result != NULL) { -+ *result = Util_SafeStrdup("RpcChannel: Unable to create " -+ "the RpcChannel object"); -+ if (resultLen != NULL) { -+ *resultLen = strlen(*result); -+ } -+ } -+ goto sent; -+ } else if (!RpcChannel_Start(chan)) { -+ if (result != NULL) { -+ *result = Util_SafeStrdup("RpcChannel: Unable to open the " -+ "communication channel"); -+ if (resultLen != NULL) { -+ *resultLen = strlen(*result); -+ } -+ } -+ goto sent; -+ } else if (!RpcChannel_Send(chan, data, dataLen, result, resultLen)) { -+ /* We already have the description of the error */ -+ goto sent; -+ } -+ -+ status = TRUE; -+ -+sent: -+ Debug(LGPFX "Request %s: reqlen=%"FMTSZ"u, replyLen=%"FMTSZ"u\n", -+ status ? "OK" : "FAILED", dataLen, resultLen ? *resultLen : 0); -+ if (chan) { -+ RpcChannel_Stop(chan); -+ RpcChannel_Destroy(chan); -+ } -+ -+ return status; -+} -+ -+ -+/** -+ * Open/close RpcChannel each time for sending a Rpc message, this is a wrapper -+ * for RpcChannel APIs. -+ * -+ * @param[out] reply reply, should be freed by calling RpcChannel_Free. -+ * @param[out] repLen reply length -+ * @param[in] reqFmt request data -+ * @param[in] ... optional arguments depending on reqFmt. -+ -+ * @returns TRUE on success. -+ */ -+ -+gboolean -+RpcChannel_SendOne(char **reply, -+ size_t *repLen, -+ char const *reqFmt, -+ ...) -+{ -+ va_list args; -+ gboolean status; -+ char *request; -+ size_t reqLen = 0; -+ -+ status = FALSE; -+ -+ /* Format the request string */ -+ va_start(args, reqFmt); -+ request = Str_Vasprintf(&reqLen, reqFmt, args); -+ va_end(args); -+ -+ /* -+ * If Str_Vasprintf failed, write NULL into the reply if the caller wanted -+ * a reply back. -+ */ -+ if (request == NULL) { -+ goto error; -+ } -+ -+ /* -+ * If the command doesn't contain a space, add one to the end to maintain -+ * compatibility with old VMXs. -+ * -+ * For a long time, the GuestRpc logic in the VMX was wired to expect a -+ * trailing space in every command, even commands without arguments. That is -+ * no longer true, but we must continue to add a trailing space because we -+ * don't know whether we're talking to an old or new VMX. -+ */ -+ if (request[reqLen - 1] != ' ') { -+ char *tmp; -+ -+ tmp = Str_Asprintf(NULL, "%s ", request); -+ free(request); -+ request = tmp; -+ -+ /* -+ * If Str_Asprintf failed, write NULL into reply if the caller wanted -+ * a reply back. -+ */ -+ if (request == NULL) { -+ goto error; -+ } -+ } -+ -+ status = RpcChannel_SendOneRaw(request, reqLen, reply, repLen); -+ -+ free(request); -+ -+ return status; -+ -+error: -+ if (reply) { -+ *reply = NULL; -+ } -+ -+ if (repLen) { -+ *repLen = 0; -+ } -+ return FALSE; -+} -diff -Naur a/services/vmtoolsd/mainLoop.c b/services/vmtoolsd/mainLoop.c ---- a/services/vmtoolsd/mainLoop.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/services/vmtoolsd/mainLoop.c 2016-01-15 11:52:19.332545573 +0100 -@@ -384,9 +384,7 @@ - GMainContext *gctx; - ToolsServiceProperty ctxProp = { TOOLS_CORE_PROP_CTX }; - -- if (!g_thread_supported()) { -- g_thread_init(NULL); -- } -+ g_thread_init(NULL); - - /* - * Useful for debugging purposes. Log the vesion and build information. -diff -Naur a/services/plugins/vmbackup/stateMachine.c b/services/plugins/vmbackup/stateMachine.c ---- a/services/plugins/vmbackup/stateMachine.c 2015-11-24 07:59:42.000000000 +0100 -+++ b/services/plugins/vmbackup/stateMachine.c 2016-01-15 11:58:56.387357439 +0100 -@@ -279,12 +279,12 @@ - g_source_unref(gBackupState->abortTimer); - } - -- g_static_mutex_lock(&gBackupState->opLock); -+ g_mutex_lock(&gBackupState->opLock); - if (gBackupState->currentOp != NULL) { - VmBackup_Cancel(gBackupState->currentOp); - VmBackup_Release(gBackupState->currentOp); - } -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - - VmBackup_SendEvent(VMBACKUP_EVENT_REQUESTOR_DONE, VMBACKUP_SUCCESS, ""); - -@@ -299,7 +299,7 @@ - } - - gBackupState->provider->release(gBackupState->provider); -- g_static_mutex_free(&gBackupState->opLock); -+ g_mutex_free(&gBackupState->opLock); - g_free(gBackupState->scriptArg); - g_free(gBackupState->volumes); - g_free(gBackupState->snapshots); -@@ -418,13 +418,13 @@ - if (gBackupState->machineState != VMBACKUP_MSTATE_SCRIPT_ERROR && - gBackupState->machineState != VMBACKUP_MSTATE_SYNC_ERROR) { - /* Mark the current operation as cancelled. */ -- g_static_mutex_lock(&gBackupState->opLock); -+ g_mutex_lock(&gBackupState->opLock); - if (gBackupState->currentOp != NULL) { - VmBackup_Cancel(gBackupState->currentOp); - VmBackup_Release(gBackupState->currentOp); - gBackupState->currentOp = NULL; - } -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - - VmBackup_SendEvent(VMBACKUP_EVENT_REQUESTOR_ABORT, - VMBACKUP_REMOTE_ABORT, -@@ -478,32 +478,32 @@ - g_source_unref(gBackupState->timerEvent); - gBackupState->timerEvent = NULL; - -- g_static_mutex_lock(&gBackupState->opLock); -+ g_mutex_lock(&gBackupState->opLock); - if (gBackupState->currentOp != NULL) { - g_debug("VmBackupAsyncCallback: checking %s\n", gBackupState->currentOpName); - status = VmBackup_QueryStatus(gBackupState->currentOp); - } -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - - switch (status) { - case VMBACKUP_STATUS_PENDING: - goto exit; - - case VMBACKUP_STATUS_FINISHED: -- g_static_mutex_lock(&gBackupState->opLock); -+ g_mutex_lock(&gBackupState->opLock); - if (gBackupState->currentOpName != NULL) { - g_debug("Async request '%s' completed\n", gBackupState->currentOpName); - VmBackup_Release(gBackupState->currentOp); - gBackupState->currentOpName = NULL; - } - gBackupState->currentOp = NULL; -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - break; - - default: - { - gchar *msg; -- g_static_mutex_lock(&gBackupState->opLock); -+ g_mutex_lock(&gBackupState->opLock); - if (gBackupState->errorMsg != NULL) { - msg = g_strdup_printf("'%s' operation failed: %s", - gBackupState->currentOpName, -@@ -519,7 +519,7 @@ - - VmBackup_Release(gBackupState->currentOp); - gBackupState->currentOp = NULL; -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - VmBackupOnError(); - goto exit; - } -@@ -534,12 +534,12 @@ - gBackupState->callback = NULL; - - if (cb(gBackupState)) { -- g_static_mutex_lock(&gBackupState->opLock); -+ g_mutex_lock(&gBackupState->opLock); - if (gBackupState->currentOp != NULL || gBackupState->forceRequeue) { -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - goto exit; - } -- g_static_mutex_unlock(&gBackupState->opLock); -+ g_mutex_unlock(&gBackupState->opLock); - } else { - VmBackupOnError(); - goto exit; -@@ -823,7 +823,7 @@ - gBackupState->freezeStatus = VMBACKUP_FREEZE_FINISHED; - gBackupState->provider = provider; - gBackupState->needsPriv = FALSE; -- g_static_mutex_init(&gBackupState->opLock); -+ g_mutex_init(&gBackupState->opLock); - gBackupState->enableNullDriver = VmBackupConfigGetBoolean(ctx->config, - "enableNullDriver", - TRUE); -diff -Naur a/services/plugins/vmbackup/vmBackupInt.h b/services/plugins/vmbackup/vmBackupInt.h ---- a/services/plugins/vmbackup/vmBackupInt.h 2015-11-24 07:59:42.000000000 +0100 -+++ b/services/plugins/vmbackup/vmBackupInt.h 2016-01-15 11:55:41.944020643 +0100 -@@ -98,7 +98,7 @@ - ToolsAppCtx *ctx; - VmBackupOp *currentOp; - const char *currentOpName; -- GStaticMutex opLock; // See note above -+ GMutex opLock; // See note above - char *volumes; - char *snapshots; - guint pollPeriod; -@@ -171,14 +171,14 @@ - ASSERT(state->currentOp == NULL); - ASSERT(currentOpName != NULL); - -- g_static_mutex_lock(&state->opLock); -+ g_mutex_lock(&state->opLock); - - state->currentOp = op; - state->callback = callback; - state->currentOpName = currentOpName; - state->forceRequeue = (callback != NULL && op == NULL); - -- g_static_mutex_unlock(&state->opLock); -+ g_mutex_unlock(&state->opLock); - - return (op != NULL); - } diff --git a/packages/sysutils/open-vm-tools/patches/open-vm-tools-0002_gcc6.patch b/packages/sysutils/open-vm-tools/patches/open-vm-tools-0002_gcc6.patch deleted file mode 100644 index 8a8098fdc5..0000000000 --- a/packages/sysutils/open-vm-tools/patches/open-vm-tools-0002_gcc6.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 08726e150faca5b67ff981680e556b908aa806d0 Mon Sep 17 00:00:00 2001 -From: Bernd Zeimetz -Date: Sat, 17 Sep 2016 11:15:12 +0200 -Subject: [PATCH] Make open-vm-tools build with gcc 6. - -diff --git a/lib/include/x86cpuid.h b/lib/include/x86cpuid.h ---- a/lib/include/x86cpuid.h -+++ b/lib/include/x86cpuid.h -@@ -909,7 +909,7 @@ FIELD(81E, 0, ECX, 8, 3, NODES_PER_PKG, NA, FALSE) - * Note: The MASK definitions must use some gymnastics to get - * around a warning when shifting left by 32. - */ --#define VMW_BIT_MASK(shift) (((1 << (shift - 1)) << 1) - 1) -+#define VMW_BIT_MASK(shift) (((1u << (shift - 1)) << 1) - 1) - - #define FIELD(lvl, ecxIn, reg, bitpos, size, name, s, c3) \ - CPUID_##name##_SHIFT = bitpos, \ -diff --git a/libDeployPkg/linuxDeployment.c b/libDeployPkg/linuxDeployment.c ---- a/libDeployPkg/linuxDeployment.c -+++ b/libDeployPkg/linuxDeployment.c -@@ -67,7 +67,6 @@ - * Constant definitions - */ - --static const char ENDOFLINEMARKER = '\n'; - static const char SPACECHAR = ' '; - static const char TABCHAR = '\t'; - static const char QUOTECHAR = '"'; -@@ -913,22 +912,28 @@ Deploy(const char* packageName) - deploymentResult = ForkExecAndWaitCommand(command); - free (command); - -- if (deploymentResult != 0) { -+ if (deploymentResult != CUST_SUCCESS) { - sLog(log_error, "Customization process returned with error. \n"); - sLog(log_debug, "Deployment result = %d \n", deploymentResult); - -- if (deploymentResult == CUST_NETWORK_ERROR || deploymentResult == CUST_NIC_ERROR) { -+ if (deploymentResult == CUST_NETWORK_ERROR || deploymentResult == CUST_NIC_ERROR || deploymentResult == CUST_DNS_ERROR) { - // Network specific error in the guest - sLog(log_info, "Setting network error status in vmx. \n"); - SetCustomizationStatusInVmx(TOOLSDEPLOYPKG_RUNNING, - GUESTCUST_EVENT_NETWORK_SETUP_FAILED, - NULL); -- } else { -+ } else if (deploymentResult == CUST_GENERIC_ERROR) { - // Generic error in the guest - sLog(log_info, "Setting generic error status in vmx. \n"); - SetCustomizationStatusInVmx(TOOLSDEPLOYPKG_RUNNING, - GUESTCUST_EVENT_CUSTOMIZE_FAILED, - NULL); -+ } else { -+ // Unknown error in the guest -+ sLog(log_info, "Setting unknown error status in vmx. \n"); -+ SetCustomizationStatusInVmx(TOOLSDEPLOYPKG_RUNNING, -+ GUESTCUST_EVENT_CUSTOMIZE_FAILED, -+ NULL); - } - - // Move to ERROR state diff --git a/packages/sysutils/parted/package.mk b/packages/sysutils/parted/package.mk index 47e788fe1e..818ab3cf0c 100644 --- a/packages/sysutils/parted/package.mk +++ b/packages/sysutils/parted/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="parted" PKG_VERSION="3.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/parted/" PKG_URL="http://ftpmirror.gnu.org/parted/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="toolchain util-linux:host" PKG_DEPENDS_TARGET="toolchain util-linux parted:host" PKG_DEPENDS_INIT="toolchain util-linux:init parted" -PKG_SECTION="system" -PKG_SHORTDESC="parted: GNU partition editor" -PKG_LONGDESC="GNU Parted is a program for creating, destroying, resizing, checking and copying partitions, and the file systems on them. This is useful for creating space for new operating systems, reorganising disk usage, copying data between hard disks and disk imaging." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_LONGDESC="GNU Parted is a program for creating, destroying, resizing, checking and copying partitions." PKG_CONFIGURE_OPTS_TARGET="--disable-device-mapper \ --disable-shared \ diff --git a/packages/sysutils/parted/patches/parted-buildfix.patch b/packages/sysutils/parted/patches/parted-0001-buildfix.patch similarity index 100% rename from packages/sysutils/parted/patches/parted-buildfix.patch rename to packages/sysutils/parted/patches/parted-0001-buildfix.patch diff --git a/packages/sysutils/parted/patches/parted-0002-buildfix-glibc-2.28.patch b/packages/sysutils/parted/patches/parted-0002-buildfix-glibc-2.28.patch new file mode 100644 index 0000000000..8e77a9600e --- /dev/null +++ b/packages/sysutils/parted/patches/parted-0002-buildfix-glibc-2.28.patch @@ -0,0 +1,29 @@ +From b79bdebf285575ec2c3e8944d951655ef8c97a23 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Tue, 21 Jun 2016 15:01:08 -0400 +Subject: [PATCH] include sysmacros.h for major/minor/makedev + +Linux C libs are moving away from including this header implicitly via +sys/types.h, so include it explicitly. + +Upstream-Status: Pending +Signed-off-by: Martin Jansa +--- + libparted/arch/linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 0f18904..b302d63 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #include + #include /* for uname() */ + #include +-- +2.14.1 + diff --git a/packages/sysutils/pciutils/package.mk b/packages/sysutils/pciutils/package.mk index 7d32740c20..9307a94117 100644 --- a/packages/sysutils/pciutils/package.mk +++ b/packages/sysutils/pciutils/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="pciutils" -PKG_VERSION="3.5.2" -PKG_REV="1" +PKG_VERSION="3.5.4" +PKG_SHA256="64293c6ab9318c40ef262b76d87bd9097531759752bac556e50979b1e63cfe66" PKG_ARCH="x86_64" PKG_LICENSE="GPL" PKG_SITE="http://mj.ucw.cz/pciutils.shtml" PKG_URL="http://www.kernel.org/pub/software/utils/pciutils/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain kmod systemd" -PKG_SECTION="system" -PKG_SHORTDESC="pciutils: Linux PCI Utilities" -PKG_LONGDESC="This package contains various utilities for inspecting and setting of devices connected to the PCI bus and the PCI vendor/product ID database." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Utilities for inspecting devices connected to the PCI bus and the PCI vendor/product ID database." PKG_MAKE_OPTS="PREFIX=/usr SHARED=no STRIP= IDSDIR=/usr/share" diff --git a/packages/sysutils/sed/package.mk b/packages/sysutils/sed/package.mk index 4a7d314c81..8ea885465c 100644 --- a/packages/sysutils/sed/package.mk +++ b/packages/sysutils/sed/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="sed" PKG_VERSION="4.2.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="f048d1838da284c8bc9753e4506b85a1e0cc1ea8999d36f6995bcb9460cddbd7" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/sed/" PKG_URL="http://ftpmirror.gnu.org/sed/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="ccache:host" -PKG_SECTION="sysutils" -PKG_SHORTDESC="sed: This is the GNU implementation of the POSIX stream editor" -PKG_LONGDESC="The sed (Stream EDitor) editor is a stream or batch (non-interactive) editor. Sed takes text as input, performs an operation or set of operations on the text and outputs the modified text. The operations that sed performs (substitutions, deletions, insertions, etc.) can be specified in a script file or from the command line." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The sed (Stream EDitor) editor is a stream or batch (non-interactive) editor." PKG_CONFIGURE_OPTS_HOST="--disable-nls --disable-acl --without-selinux" PKG_MAKEINSTALL_OPTS_HOST="-C sed install" diff --git a/packages/sysutils/squashfs/package.mk b/packages/sysutils/squashfs/package.mk index 53a7bd5734..4463fa89f0 100644 --- a/packages/sysutils/squashfs/package.mk +++ b/packages/sysutils/squashfs/package.mk @@ -1,44 +1,25 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="squashfs" -PKG_VERSION="4.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="e38956b" +PKG_SHA256="d49241e238076ee56920c6aec31f0de7b41fe770d1b2c03d1714bbffb833a98f" PKG_LICENSE="GPL" -PKG_SITE="http://squashfs.sourceforge.net/" -PKG_URL="$SOURCEFORGE_SRC/squashfs/squashfs/${PKG_NAME}${PKG_VERSION}/${PKG_NAME}${PKG_VERSION}.tar.gz" -PKG_SOURCE_DIR="${PKG_NAME}${PKG_VERSION}" -PKG_DEPENDS_HOST="ccache:host zlib:host lzo:host xz:host" -PKG_SECTION="sysutils" -PKG_SHORTDESC="squashfs-tools: A compressed read-only filesystem for Linux" -PKG_LONGDESC="Squashfs is intended to be a general read-only filesystem, for archival use (i.e. in cases where a .tar.gz file may be used), and in constrained block device/memory systems (e.g. embedded systems) where low overhead is needed. The filesystem is currently stable and has been tested on PowerPC, i386, SPARC and ARM architectures." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_SITE="https://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git" +PKG_URL="https://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git/snapshot/$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="ccache:host zlib:host lzo:host xz:host zstd:host" +PKG_NEED_UNPACK="$(get_pkg_directory zlib) $(get_pkg_directory lzo) $(get_pkg_directory xz) $(get_pkg_directory zstd)" +PKG_LONGDESC="A compressed read-only filesystem for Linux." +PKG_TOOLCHAIN="manual" make_host() { make -C squashfs-tools mksquashfs \ - XZ_SUPPORT=1 LZO_SUPPORT=1 \ - INCLUDEDIR="-I. -I$ROOT/$TOOLCHAIN/include" + XZ_SUPPORT=1 LZO_SUPPORT=1 ZSTD_SUPPORT=1 \ + XATTR_SUPPORT=0 XATTR_DEFAULT=0 \ + INCLUDEDIR="-I. -I$TOOLCHAIN/include" } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp squashfs-tools/mksquashfs $ROOT/$TOOLCHAIN/bin + mkdir -p $TOOLCHAIN/bin + cp squashfs-tools/mksquashfs $TOOLCHAIN/bin } diff --git a/packages/sysutils/squashfs/patches/fix-compilation-issue.patch b/packages/sysutils/squashfs/patches/fix-compilation-issue.patch new file mode 100644 index 0000000000..7b50a51fa8 --- /dev/null +++ b/packages/sysutils/squashfs/patches/fix-compilation-issue.patch @@ -0,0 +1,11 @@ +diff -Nur a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c +--- a/squashfs-tools/mksquashfs.c 2017-11-14 04:44:47.000000000 +0100 ++++ b/squashfs-tools/mksquashfs.c 2018-08-22 16:52:17.386482046 +0200 +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/packages/sysutils/squashfs/patches/squashfs-4.2-defaults-0.1.patch b/packages/sysutils/squashfs/patches/squashfs-4.2-defaults-0.1.patch deleted file mode 100644 index 1fbae0e61d..0000000000 --- a/packages/sysutils/squashfs/patches/squashfs-4.2-defaults-0.1.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -Naur squashfs4.2/squashfs-tools/Makefile squashfs4.2.patch/squashfs-tools/Makefile ---- squashfs4.2/squashfs-tools/Makefile 2011-02-28 21:04:15.000000000 +0100 -+++ squashfs4.2.patch/squashfs-tools/Makefile 2011-03-03 04:07:03.566708237 +0100 -@@ -78,7 +78,7 @@ - # If your C library or build/target environment doesn't support XATTRs then - # comment out the next line to build Mksquashfs and Unsquashfs without XATTR - # support --XATTR_SUPPORT = 1 -+#XATTR_SUPPORT = 1 - - # Select whether you wish xattrs to be stored by Mksquashfs and extracted - # by Unsquashfs by default. If selected users can disable xattr support by -@@ -86,7 +86,7 @@ - # - # If unselected, Mksquashfs/Unsquashfs won't store and extract xattrs by - # default. Users can enable xattrs by using the -xattrs option. --XATTR_DEFAULT = 1 -+#XATTR_DEFAULT = 1 - - - ############################################### diff --git a/packages/sysutils/systemd/config/logind.conf.d/README b/packages/sysutils/systemd/config/logind.conf.d/README new file mode 100644 index 0000000000..ea24105a8d --- /dev/null +++ b/packages/sysutils/systemd/config/logind.conf.d/README @@ -0,0 +1,233 @@ +LOGIND.CONF(5) logind.conf LOGIND.CONF(5) + +NAME + logind.conf, logind.conf.d - Login manager configuration files + +SYNOPSIS + /etc/systemd/logind.conf + + /etc/systemd/logind.conf.d/*.conf + + /run/systemd/logind.conf.d/*.conf + + /usr/lib/systemd/logind.conf.d/*.conf + +DESCRIPTION + These files configure various parameters of the systemd login manager, + systemd-logind.service(8). + +CONFIGURATION DIRECTORIES AND PRECEDENCE + The default configuration is defined during compilation, so a + configuration file is only needed when it is necessary to deviate from + those defaults. By default, the configuration file in /etc/systemd/ + contains commented out entries showing the defaults as a guide to the + administrator. This file can be edited to create local overrides. + + When packages need to customize the configuration, they can install + configuration snippets in /usr/lib/systemd/*.conf.d/. Files in /etc/ + are reserved for the local administrator, who may use this logic to + override the configuration files installed by vendor packages. The main + configuration file is read before any of the configuration directories, + and has the lowest precedence; entries in a file in any configuration + directory override entries in the single configuration file. Files in + the *.conf.d/ configuration subdirectories are sorted by their filename + in lexicographic order, regardless of which of the subdirectories they + reside in. When multiple files specify the same option, for options + which accept just a single value, the entry in the file with the + lexicographically latest name takes precedence. For options which + accept a list of values, entries are collected as they occur in files + sorted lexicographically. It is recommended to prefix all filenames in + those subdirectories with a two-digit number and a dash, to simplify + the ordering of the files. + + To disable a configuration file supplied by the vendor, the recommended + way is to place a symlink to /dev/null in the configuration directory + in /etc/, with the same filename as the vendor configuration file. + +OPTIONS + All options are configured in the "[Login]" section: + + NAutoVTs= + Takes a positive integer. Configures how many virtual terminals + (VTs) to allocate by default that, when switched to and are + previously unused, "autovt" services are automatically spawned on. + These services are instantiated from the template unit + autovt@.service for the respective VT TTY name, for example, + autovt@tty4.service. By default, autovt@.service is linked to + getty@.service. In other words, login prompts are started + dynamically as the user switches to unused virtual terminals. + Hence, this parameter controls how many login "gettys" are + available on the VTs. If a VT is already used by some other + subsystem (for example, a graphical login), this kind of activation + will not be attempted. Note that the VT configured in ReserveVT= is + always subject to this kind of activation, even if it is not one of + the VTs configured with the NAutoVTs= directive. Defaults to 6. + When set to 0, automatic spawning of "autovt" services is disabled. + + ReserveVT= + Takes a positive integer. Identifies one virtual terminal that + shall unconditionally be reserved for autovt@.service activation + (see above). The VT selected with this option will be marked busy + unconditionally, so that no other subsystem will allocate it. This + functionality is useful to ensure that, regardless of how many VTs + are allocated by other subsystems, one login "getty" is always + available. Defaults to 6 (in other words, there will always be a + "getty" available on Alt-F6.). When set to 0, VT reservation is + disabled. + + KillUserProcesses= + Takes a boolean argument. Configures whether the processes of a + user should be killed when the user logs out. If true, the scope + unit corresponding to the session and all processes inside that + scope will be terminated. If false, the scope is "abandoned", see + systemd.scope(5), and processes are not killed. Defaults to "yes", + but see the options KillOnlyUsers= and KillExcludeUsers= below. + + In addition to session processes, user process may run under the + user manager unit user@.service. Depending on the linger settings, + this may allow users to run processes independent of their login + sessions. See the description of enable-linger in loginctl(1). + + Note that setting KillUserProcesses=yes will break tools like + screen(1) and tmux(1), unless they are moved out of the session + scope. See example in systemd-run(1). + + KillOnlyUsers=, KillExcludeUsers= + These settings take space-separated lists of usernames that + override the KillUserProcesses= setting. A user name may be added + to KillExcludeUsers= to exclude the processes in the session scopes + of that user from being killed even if KillUserProcesses=yes is + set. If KillExcludeUsers= is not set, the "root" user is excluded + by default. KillExcludeUsers= may be set to an empty value to + override this default. If a user is not excluded, KillOnlyUsers= is + checked next. If this setting is specified, only the session scopes + of those users will be killed. Otherwise, users are subject to the + KillUserProcesses=yes setting. + + IdleAction= + Configures the action to take when the system is idle. Takes one of + "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", + "hibernate", "hybrid-sleep", and "lock". Defaults to "ignore". + + Note that this requires that user sessions correctly report the + idle status to the system. The system will execute the action after + all sessions report that they are idle, no idle inhibitor lock is + active, and subsequently, the time configured with IdleActionSec= + (see below) has expired. + + IdleActionSec= + Configures the delay after which the action configured in + IdleAction= (see above) is taken after the system is idle. + + InhibitDelayMaxSec= + Specifies the maximum time a system shutdown or sleep request is + delayed due to an inhibitor lock of type "delay" being active + before the inhibitor is ignored and the operation executes anyway. + Defaults to 5. + + HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, + HandleLidSwitch=, HandleLidSwitchExternalPower=, HandleLidSwitchDocked= + Controls how logind shall handle the system power and sleep keys + and the lid switch to trigger actions such as system power-off or + suspend. Can be one of "ignore", "poweroff", "reboot", "halt", + "kexec", "suspend", "hibernate", "hybrid-sleep", and "lock". If + "ignore", logind will never handle these keys. If "lock", all + running sessions will be screen-locked; otherwise, the specified + action will be taken in the respective event. Only input devices + with the "power-switch" udev tag will be watched for key/lid switch + events. HandlePowerKey= defaults to "poweroff". HandleSuspendKey= + and HandleLidSwitch= default to "suspend". + HandleLidSwitchExternalPower= is completely ignored by default (for + backwards compatibility) — an explicit value must be set before it + will be used to determine behaviour. HandleLidSwitchDocked= + defaults to "ignore". HandleHibernateKey= defaults to "hibernate". + If the system is inserted in a docking station, or if more than one + display is connected, the action specified by + HandleLidSwitchDocked= occurs; if the system is on external power + the action (if any) specified by HandleLidSwitchExternalPower= + occurs; otherwise the HandleLidSwitch= action occurs. + + A different application may disable logind's handling of system + power and sleep keys and the lid switch by taking a low-level + inhibitor lock ("handle-power-key", "handle-suspend-key", + "handle-hibernate-key", "handle-lid-switch"). This is most commonly + used by graphical desktop environments to take over suspend and + hibernation handling, and to use their own configuration + mechanisms. If a low-level inhibitor lock is taken, logind will not + take any action when that key or switch is triggered and the + Handle*= settings are irrelevant. + + PowerKeyIgnoreInhibited=, SuspendKeyIgnoreInhibited=, + HibernateKeyIgnoreInhibited=, LidSwitchIgnoreInhibited= + Controls whether actions that systemd-logind takes when the power + and sleep keys and the lid switch are triggered are subject to + high-level inhibitor locks ("shutdown", "sleep", "idle"). Low level + inhibitor locks ("handle-power-key", "handle-suspend-key", + "handle-hibernate-key", "handle-lid-switch"), are always honored, + irrespective of this setting. + + These settings take boolean arguments. If "no", the inhibitor locks + taken by applications are respected. If "yes", "shutdown", "sleep", + and "idle" inhibitor locks are ignored. PowerKeyIgnoreInhibited=, + SuspendKeyIgnoreInhibited=, and HibernateKeyIgnoreInhibited= + default to "no". LidSwitchIgnoreInhibited= defaults to "yes". This + means that when systemd-logind is handling events by itself (no low + level inhibitor locks are taken by another application), the lid + switch does not respect suspend blockers by default, but the power + and sleep keys do. + + HoldoffTimeoutSec= + Specifies the timeout after system startup or system resume in + which systemd will hold off on reacting to lid events. This is + required for the system to properly detect any hotplugged devices + so systemd can ignore lid events if external monitors, or docks, + are connected. If set to 0, systemd will always react immediately, + possibly before the kernel fully probed all hotplugged devices. + This is safe, as long as you do not care for systemd to account for + devices that have been plugged or unplugged while the system was + off. Defaults to 30s. + + RuntimeDirectorySize= + Sets the size limit on the $XDG_RUNTIME_DIR runtime directory for + each user who logs in. Takes a size in bytes, optionally suffixed + with the usual K, G, M, and T suffixes, to the base 1024 (IEC). + Alternatively, a numerical percentage suffixed by "%" may be + specified, which sets the size limit relative to the amount of + physical RAM. Defaults to 10%. Note that this size is a safety + limit only. As each runtime directory is a tmpfs file system, it + will only consume as much memory as is needed. + + InhibitorsMax= + Controls the maximum number of concurrent inhibitors to permit. + Defaults to 8192 (8K). + + SessionsMax= + Controls the maximum number of concurrent user sessions to manage. + Defaults to 8192 (8K). Depending on how the pam_systemd.so module + is included in the PAM stack configuration, further login sessions + will either be refused, or permitted but not tracked by + systemd-logind. + + UserTasksMax= + Sets the maximum number of OS tasks each user may run concurrently. + This controls the TasksMax= setting of the per-user slice unit, see + systemd.resource-control(5) for details. If assigned the special + value "infinity", no tasks limit is applied. Defaults to 33%, which + equals 10813 with the kernel's defaults on the host, but might be + smaller in OS containers. + + RemoveIPC= + Controls whether System V and POSIX IPC objects belonging to the + user shall be removed when the user fully logs out. Takes a boolean + argument. If enabled, the user may not consume IPC resources after + the last of the user's sessions terminated. This covers System V + semaphores, shared memory and message queues, as well as POSIX + shared memory and message queues. Note that IPC objects of the root + user and other system users are excluded from the effect of this + setting. Defaults to "yes". + +SEE ALSO + systemd(1), systemd-logind.service(8), loginctl(1), systemd- + system.conf(5) + +systemd 238 LOGIND.CONF(5) diff --git a/packages/sysutils/systemd/config/sleep.conf.d/README b/packages/sysutils/systemd/config/sleep.conf.d/README new file mode 100644 index 0000000000..403b99f7bd --- /dev/null +++ b/packages/sysutils/systemd/config/sleep.conf.d/README @@ -0,0 +1,59 @@ +NAME + systemd-sleep.conf, sleep.conf.d - Suspend and hibernation configuration file + +SYNOPSIS + /etc/systemd/sleep.conf + + /etc/systemd/sleep.conf.d/*.conf + + /run/systemd/sleep.conf.d/*.conf + + /usr/lib/systemd/sleep.conf.d/*.conf + +DESCRIPTION + systemd supports three general power-saving modes: + + suspend + a low-power state where execution of the OS is paused, and complete power loss might result in lost data, and which is fast to enter and exit. This corresponds to suspend, standby, or freeze states as understood by the + kernel. + + hibernate + a low-power state where execution of the OS is paused, and complete power loss does not result in lost data, and which might be slow to enter and exit. This corresponds to the hibernation as understood by the kernel. + + hybrid-sleep + a low-power state where execution of the OS is paused, which might be slow to enter, and on complete power loss does not result in lost data but might be slower to exit in that case. This mode is called suspend-to-both + by the kernel. + + Settings in these files determine what strings will be written to /sys/power/disk and /sys/power/state by systemd-sleep(8) when systemd(1) attempts to suspend or hibernate the machine. + +CONFIGURATION DIRECTORIES AND PRECEDENCE + The default configuration is defined during compilation, so a configuration file is only needed when it is necessary to deviate from those defaults. By default, the configuration file in /etc/systemd/ contains commented out + entries showing the defaults as a guide to the administrator. This file can be edited to create local overrides. + + When packages need to customize the configuration, they can install configuration snippets in /usr/lib/systemd/*.conf.d/. Files in /etc/ are reserved for the local administrator, who may use this logic to override the + configuration files installed by vendor packages. The main configuration file is read before any of the configuration directories, and has the lowest precedence; entries in a file in any configuration directory override + entries in the single configuration file. Files in the *.conf.d/ configuration subdirectories are sorted by their filename in lexicographic order, regardless of which of the subdirectories they reside in. If multiple files + specify the same option, the entry in the file with the lexicographically latest name takes precedence. It is recommended to prefix all filenames in those subdirectories with a two-digit number and a dash, to simplify the + ordering of the files. + + To disable a configuration file supplied by the vendor, the recommended way is to place a symlink to /dev/null in the configuration directory in /etc/, with the same filename as the vendor configuration file. + +OPTIONS + The following options can be configured in the "[Sleep]" section of /etc/systemd/sleep.conf or a sleep.conf.d file: + + SuspendMode=, HibernateMode=, HybridSleepMode= + The string to be written to /sys/power/disk by, respectively, systemd-suspend.service(8), systemd-hibernate.service(8), or systemd-hybrid-sleep.service(8). More than one value can be specified by separating multiple + values with whitespace. They will be tried in turn, until one is written without error. If neither succeeds, the operation will be aborted. + + SuspendState=, HibernateState=, HybridSleepState= + The string to be written to /sys/power/state by, respectively, systemd-suspend.service(8), systemd-hibernate.service(8), or systemd-hybrid-sleep.service(8). More than one value can be specified by separating multiple + values with whitespace. They will be tried in turn, until one is written without error. If neither succeeds, the operation will be aborted. + +EXAMPLE: FREEZE + Example: to exploit the “freeze†mode added in Linux 3.9, one can use systemctl suspend with + + [Sleep] + SuspendState=freeze + +SEE ALSO + systemd-sleep(8), systemd-suspend.service(8), systemd-hibernate.service(8), systemd-hybrid-sleep.service(8), systemd(1), systemd.directives(7) diff --git a/packages/sysutils/systemd/config/sleep.conf.d/sleep.conf.sample b/packages/sysutils/systemd/config/sleep.conf.d/sleep.conf.sample new file mode 100644 index 0000000000..4ca7168beb --- /dev/null +++ b/packages/sysutils/systemd/config/sleep.conf.d/sleep.conf.sample @@ -0,0 +1,3 @@ +[Sleep] +SuspendMode=false +HibernateMode=false diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index 0643e898bc..cd87598709 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -1,123 +1,101 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="systemd" -PKG_VERSION="232" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="GPL" +PKG_VERSION="239" +PKG_SHA256="8a11b1b07d620f4c06a16e95bba4dd2a97e90efdf2a5ba47ed0a935085787a14" +PKG_LICENSE="LGPL2.1+" PKG_SITE="http://www.freedesktop.org/wiki/Software/systemd" PKG_URL="https://github.com/systemd/systemd/archive/v$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain libcap kmod util-linux entropy" -PKG_SECTION="system" -PKG_SHORTDESC="systemd: a system and session manager" -PKG_LONGDESC="systemd is a system and session manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux cgroups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. It can work as a drop-in replacement for sysvinit." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ - ac_cv_have_decl_IFLA_BOND_AD_INFO=no \ - ac_cv_have_decl_IFLA_BRPORT_UNICAST_FLOOD=no \ - ac_cv_path_MOUNT_PATH="/usr/bin/mount" - ac_cv_path_UMOUNT_PATH="/usr/bin/umount" - KMOD=/usr/bin/kmod \ - --disable-nls \ - --disable-dbus \ - --disable-utmp \ - --disable-coverage \ - --enable-kmod \ - --disable-xkbcommon \ - --enable-blkid \ - --disable-seccomp \ - --disable-ima \ - --disable-selinux \ - --disable-apparmor \ - --disable-xz \ - --disable-zlib \ - --disable-bzip2 \ - --disable-lz4 \ - --disable-pam \ - --disable-acl \ - --disable-smack \ - --disable-gcrypt \ - --disable-audit \ - --disable-elfutils \ - --disable-libcryptsetup \ - --disable-qrencode \ - --disable-microhttpd \ - --disable-gnutls \ - --disable-libcurl \ - --disable-libidn \ - --disable-libiptc \ - --disable-binfmt \ - --disable-vconsole \ - --disable-quotacheck \ - --enable-tmpfiles \ - --disable-sysusers \ - --disable-firstboot \ - --disable-randomseed \ - --disable-backlight \ - --disable-rfkill \ - --enable-logind \ - --disable-machined \ - --disable-importd \ - --disable-hostnamed \ - --disable-timedated \ - --disable-timesyncd \ - --disable-localed \ - --disable-coredump \ - --disable-polkit \ - --disable-resolved \ - --disable-networkd \ - --disable-efi \ - --disable-gnuefi \ - --disable-kdbus \ - --disable-myhostname \ - --enable-hwdb \ - --disable-manpages \ - --disable-hibernate \ - --disable-ldconfig \ - --disable-split-usr \ - --disable-tests \ - --without-python \ - --with-sysvinit-path= \ - --with-sysvrcnd-path= \ - --with-tty-gid=5 \ - --with-dbuspolicydir=/etc/dbus-1/system.d \ - --with-dbussessionservicedir=/usr/share/dbus-1/services \ - --with-dbussystemservicedir=/usr/share/dbus-1/system-services \ - --with-rootprefix=/usr \ - --with-rootlibdir=/usr/lib" - -pre_build_target() { -# broken autoreconf - ( cd $PKG_BUILD - intltoolize --force - ) -} +PKG_LONGDESC="A system and session manager for Linux, compatible with SysV and LSB init scripts." + +PKG_MESON_OPTS_TARGET="--libdir=/usr/lib \ + -Drootprefix=/usr \ + -Dsplit-usr=false \ + -Dsplit-bin=true \ + -Ddefault-hierarchy=hybrid \ + -Dtty-gid=5 \ + -Dtests=false \ + -Dseccomp=false \ + -Dselinux=false \ + -Dapparmor=false \ + -Dpolkit=false \ + -Dacl=false \ + -Daudit=false \ + -Dblkid=true \ + -Dkmod=true \ + -Dpam=false \ + -Dmicrohttpd=false \ + -Dlibcryptsetup=false \ + -Dlibcurl=false \ + -Dlibidn=false \ + -Dlibidn2=false \ + -Dlibiptc=false \ + -Dqrencode=false \ + -Dgcrypt=false \ + -Dgnutls=false \ + -Delfutils=false \ + -Dzlib=false \ + -Dbzip2=false \ + -Dxz=false \ + -Dlz4=false \ + -Dxkbcommon=false \ + -Dglib=false \ + -Ddbus=false \ + -Ddefault-dnssec=no \ + -Dimportd=false \ + -Dremote=false \ + -Dutmp=false \ + -Dhibernate=false \ + -Denvironment-d=false \ + -Dbinfmt=false \ + -Dcoredump=false \ + -Dresolve=false \ + -Dlogind=true \ + -Dhostnamed=true \ + -Dlocaled=false \ + -Dmachined=false \ + -Dnetworkd=false \ + -Dtimedated=false \ + -Dtimesyncd=true \ + -Dmyhostname=false \ + -Dfirstboot=false \ + -Drandomseed=false \ + -Dbacklight=false \ + -Dvconsole=false \ + -Dquotacheck=false \ + -Dsysusers=false \ + -Dtmpfiles=true \ + -Dhwdb=true \ + -Drfkill=false \ + -Dldconfig=false \ + -Defi=false \ + -Dtpm=false \ + -Dima=false \ + -Dsmack=false \ + -Dgshadow=false \ + -Didn=false \ + -Dnss-systemd=false \ + -Dman=false \ + -Dhtml=false \ + -Dbashcompletiondir=no \ + -Dzshcompletiondir=no \ + -Dkill-path=/usr/bin/kill \ + -Dkmod-path=/usr/bin/kmod \ + -Dmount-path=/usr/bin/mount \ + -Dumount-path=/usr/bin/umount" pre_configure_target() { - export CFLAGS="$CFLAGS -fno-schedule-insns -fno-schedule-insns2" + export CFLAGS="$CFLAGS -fno-schedule-insns -fno-schedule-insns2 -Wno-format-truncation" + export LC_ALL=en_US.UTF-8 } post_makeinstall_target() { # remove unneeded stuff + rm -rf $INSTALL/etc/init.d + rm -rf $INSTALL/etc/pam.d rm -rf $INSTALL/etc/systemd/system rm -rf $INSTALL/etc/xdg rm -rf $INSTALL/etc/X11 @@ -141,6 +119,11 @@ post_makeinstall_target() { # remove Network adaper renaming rule, this is confusing rm -rf $INSTALL/usr/lib/udev/rules.d/80-net-setup-link.rules + # remove the uaccess rules as we don't build systemd with ACL (see https://github.com/systemd/systemd/issues/4107) + rm -rf $INSTALL/usr/lib/udev/rules.d/70-uaccess.rules + rm -rf $INSTALL/usr/lib/udev/rules.d/71-seat.rules + rm -rf $INSTALL/usr/lib/udev/rules.d/73-seat-late.rules + # remove debug-shell.service, we install our own rm -rf $INSTALL/usr/lib/systemd/system/debug-shell.service @@ -163,6 +146,10 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/lib/systemd/system/systemd-udev-hwdb-update.service rm -rf $INSTALL/usr/lib/systemd/system/*.target.wants/systemd-udev-hwdb-update.service + # remove systemd-user-sessions + rm -rf $INSTALL/usr/lib/systemd/system/systemd-user-sessions.service + rm -rf $INSTALL/usr/lib/systemd/system/*.target.wants/systemd-user-sessions.service + # remove nspawn rm -rf $INSTALL/usr/bin/systemd-nspawn rm -rf $INSTALL/usr/lib/systemd/system/systemd-nspawn@.service @@ -171,10 +158,17 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/lib/systemd/system-generators rm -rf $INSTALL/usr/lib/systemd/catalog + # remove partition + rm -rf $INSTALL/usr/lib/systemd/systemd-growfs + rm -rf $INSTALL/usr/lib/systemd/systemd-makefs + # distro preset policy rm -f $INSTALL/usr/lib/systemd/system-preset/* echo "disable *" > $INSTALL/usr/lib/systemd/system-preset/99-default.preset + rm -f $INSTALL/usr/lib/systemd/user-preset/* + echo "disable *" > $INSTALL/usr/lib/systemd/user-preset/90-systemd.preset + # remove networkd rm -rf $INSTALL/usr/lib/systemd/network @@ -187,6 +181,7 @@ post_makeinstall_target() { # tune logind.conf sed -e "s,^.*HandleLidSwitch=.*$,HandleLidSwitch=ignore,g" -i $INSTALL/etc/systemd/logind.conf + sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=ignore,g" -i $INSTALL/etc/systemd/logind.conf # replace systemd-machine-id-setup with ours rm -rf $INSTALL/usr/lib/systemd/systemd-machine-id-commit @@ -195,9 +190,13 @@ post_makeinstall_target() { rm -rf $INSTALL/usr/bin/systemd-machine-id-setup mkdir -p $INSTALL/usr/bin cp $PKG_DIR/scripts/systemd-machine-id-setup $INSTALL/usr/bin + cp $PKG_DIR/scripts/userconfig-setup $INSTALL/usr/bin + cp $PKG_DIR/scripts/usercache-setup $INSTALL/usr/bin - # provide 'halt', 'shutdown', 'reboot' & co. mkdir -p $INSTALL/usr/sbin + cp $PKG_DIR/scripts/kernel-overlays-setup $INSTALL/usr/sbin + + # provide 'halt', 'shutdown', 'reboot' & co. ln -sf /usr/bin/systemctl $INSTALL/usr/sbin/halt ln -sf /usr/bin/systemctl $INSTALL/usr/sbin/poweroff ln -sf /usr/bin/systemctl $INSTALL/usr/sbin/reboot @@ -214,6 +213,10 @@ post_makeinstall_target() { rm -rf $INSTALL/etc/modules-load.d ln -sf /storage/.config/modules-load.d $INSTALL/etc/modules-load.d + rm -rf $INSTALL/etc/systemd/logind.conf.d + ln -sf /storage/.config/logind.conf.d $INSTALL/etc/systemd/logind.conf.d + rm -rf $INSTALL/etc/systemd/sleep.conf.d + ln -sf /storage/.config/sleep.conf.d $INSTALL/etc/systemd/sleep.conf.d rm -rf $INSTALL/etc/sysctl.d ln -sf /storage/.config/sysctl.d $INSTALL/etc/sysctl.d rm -rf $INSTALL/etc/tmpfiles.d @@ -227,6 +230,9 @@ post_makeinstall_target() { post_install() { add_group systemd-journal 190 + add_group systemd-timesync 191 + add_user systemd-timesync x 191 191 "systemd-timesync" "/" "/bin/false" + add_group systemd-network 193 add_user systemd-network x 193 193 "systemd-network" "/" "/bin/sh" @@ -246,5 +252,7 @@ post_install() { enable_service machine-id.service enable_service debugconfig.service enable_service userconfig.service + enable_service usercache.service + enable_service kernel-overlays.service enable_service hwdb.service } diff --git a/packages/sysutils/systemd/patches/systemd-0001-move-etc-systemd-system-to-storage-.config-system.d.patch b/packages/sysutils/systemd/patches/systemd-0001-move-etc-systemd-system-to-storage-.config-system.d.patch index f7a1242fcc..de8732f376 100644 --- a/packages/sysutils/systemd/patches/systemd-0001-move-etc-systemd-system-to-storage-.config-system.d.patch +++ b/packages/sysutils/systemd/patches/systemd-0001-move-etc-systemd-system-to-storage-.config-system.d.patch @@ -1,35 +1,19 @@ -From 56daac6a053159bbc5dc22d85c6ecd66b7369aae Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Thu, 19 Dec 2013 11:21:13 +0200 -Subject: [PATCH 2/8] move /etc/systemd/system to /storage/.config/system.d +commit abce2c21148f981034acf143a3c12e5919949198 +Author: Lukas Rusak +Date: Mon Oct 9 15:26:58 2017 -0700 ---- - Makefile.am | 4 ++-- - Makefile.in | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index bf04d31..36c269e 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -166,7 +166,7 @@ udevlibexec_PROGRAMS = - AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \ -- -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \ -+ -DSYSTEM_CONFIG_UNIT_PATH=\"/storage/.config/system.d\" \ - -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \ - -DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\" \ - -DSYSTEM_SYSVRCND_PATH=\"$(SYSTEM_SYSVRCND_PATH)\" \ -@@ -6210,7 +6210,7 @@ substitutions = \ - '|SYSTEMCTL=$(rootbindir)/systemctl|' \ - '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ - '|pkgsysconfdir=$(pkgsysconfdir)|' \ -- '|SYSTEM_CONFIG_UNIT_PATH=$(pkgsysconfdir)/system|' \ -+ '|SYSTEM_CONFIG_UNIT_PATH=/storage/.config/system.d|' \ - '|USER_CONFIG_UNIT_PATH=$(pkgsysconfdir)/user|' \ - '|pkgdatadir=$(pkgdatadir)|' \ - '|systemunitdir=$(systemunitdir)|' \ --- -1.7.10.4 + move /etc/systemd/system to /storage/.config/system.d +diff --git a/meson.build b/meson.build +index f7a610a..b1144a6 100644 +--- a/meson.build ++++ b/meson.build +@@ -146,7 +146,7 @@ if pamconfdir == '' + endif + + conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) +-conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system')) ++conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', '/storage/.config/system.d') + conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir) + conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path) + conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) diff --git a/packages/sysutils/systemd/patches/systemd-0004-systemctl-disable-dangerous-options.patch b/packages/sysutils/systemd/patches/systemd-0004-systemctl-disable-dangerous-options.patch deleted file mode 100644 index a541a231b1..0000000000 --- a/packages/sysutils/systemd/patches/systemd-0004-systemctl-disable-dangerous-options.patch +++ /dev/null @@ -1,55 +0,0 @@ -commit e24e9fabeb4f91d1dc428d06e2a144bccd7538eb -Author: Lukas Rusak -Date: Tue Nov 22 23:23:19 2016 -0800 - - systemctl: disable dangerous options - -diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c -index dd3b931..6f8290d 100644 ---- a/src/systemctl/systemctl.c -+++ b/src/systemctl/systemctl.c -@@ -8009,6 +8009,11 @@ static int talk_initctl(void) { - #endif - } - -+static int nope(sd_bus *bus, char **args) { -+ printf("nope. don't do that\n"); -+ return 0; -+} -+ - static int systemctl_main(int argc, char *argv[]) { - - static const Verb verbs[] = { -@@ -8062,22 +8067,22 @@ static int systemctl_main(int argc, char *argv[]) { - { "enable", 2, VERB_ANY, 0, enable_unit }, - { "disable", 2, VERB_ANY, 0, enable_unit }, - { "is-enabled", 2, VERB_ANY, 0, unit_is_enabled }, -- { "reenable", 2, VERB_ANY, 0, enable_unit }, -- { "preset", 2, VERB_ANY, 0, enable_unit }, -- { "preset-all", VERB_ANY, 1, 0, preset_all }, -- { "mask", 2, VERB_ANY, 0, enable_unit }, -- { "unmask", 2, VERB_ANY, 0, enable_unit }, -- { "link", 2, VERB_ANY, 0, enable_unit }, -+ { "reenable", 2, VERB_ANY, 0, nope }, -+ { "preset", 2, VERB_ANY, 0, nope }, -+ { "preset-all", VERB_ANY, 1, 0, nope }, -+ { "mask", 2, VERB_ANY, 0, nope }, -+ { "unmask", 2, VERB_ANY, 0, nope }, -+ { "link", 2, VERB_ANY, 0, nope }, - { "revert", 2, VERB_ANY, 0, enable_unit }, - { "switch-root", 2, VERB_ANY, VERB_NOCHROOT, switch_root }, - { "list-dependencies", VERB_ANY, 2, VERB_NOCHROOT, list_dependencies }, -- { "set-default", 2, 2, 0, set_default }, -+ { "set-default", 2, 2, 0, nope }, - { "get-default", VERB_ANY, 1, 0, get_default }, - { "set-property", 3, VERB_ANY, VERB_NOCHROOT, set_property }, - { "is-system-running", VERB_ANY, 1, 0, is_system_running }, -- { "add-wants", 3, VERB_ANY, 0, add_dependency }, -- { "add-requires", 3, VERB_ANY, 0, add_dependency }, -- { "edit", 2, VERB_ANY, VERB_NOCHROOT, edit }, -+ { "add-wants", 3, VERB_ANY, 0, nope }, -+ { "add-requires", 3, VERB_ANY, 0, nope }, -+ { "edit", 2, VERB_ANY, VERB_NOCHROOT, nope }, - {} - }; - diff --git a/packages/sysutils/systemd/patches/systemd-0006-dont-use-the-unified-hierarchy-for-cgroups-yet.patch b/packages/sysutils/systemd/patches/systemd-0006-dont-use-the-unified-hierarchy-for-cgroups-yet.patch deleted file mode 100644 index 65cd229655..0000000000 --- a/packages/sysutils/systemd/patches/systemd-0006-dont-use-the-unified-hierarchy-for-cgroups-yet.patch +++ /dev/null @@ -1,36 +0,0 @@ -From e3d9d7d770e4d7b61ad3b4c156e0d30894c30aac Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Wed, 9 Nov 2016 08:43:57 +0100 -Subject: [PATCH] core: don't use the unified hierarchy for the systemd cgroup - yet - -Too many things don't get along with the unified hierarchy yet: - - * https://github.com/opencontainers/runc/issues/1175 - * https://github.com/docker/docker/issues/28109 - * https://github.com/lxc/lxc/issues/1280 - -So revert the default to the legacy hierarchy for now. Developers of the above -software can opt into the unified hierarchy with -"systemd.legacy_systemd_cgroup_controller=0". ---- - src/basic/cgroup-util.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index 5e73753..dc13025 100644 ---- a/src/basic/cgroup-util.c -+++ b/src/basic/cgroup-util.c -@@ -2423,10 +2423,10 @@ bool cg_is_unified_systemd_controller_wanted(void) { - - r = get_proc_cmdline_key("systemd.legacy_systemd_cgroup_controller=", &value); - if (r < 0) -- return true; -+ return false; - - if (r == 0) -- wanted = true; -+ wanted = false; - else - wanted = parse_boolean(value) <= 0; - } diff --git a/packages/sysutils/systemd/patches/systemd-0006-fix-build-with-glibc_2.28.patch b/packages/sysutils/systemd/patches/systemd-0006-fix-build-with-glibc_2.28.patch new file mode 100644 index 0000000000..57df21e7c9 --- /dev/null +++ b/packages/sysutils/systemd/patches/systemd-0006-fix-build-with-glibc_2.28.patch @@ -0,0 +1,105 @@ +From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001 +From: Filipe Brandenburger +Date: Sun, 15 Jul 2018 22:43:35 -0700 +Subject: [PATCH] build-sys: Detect whether struct statx is defined in + sys/stat.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a +definition for struct statx, in which case include file linux/stat.h should be +avoided, in order to prevent a duplicate definition. + + In file included from ../src/basic/missing.h:18, + from ../src/basic/util.h:28, + from ../src/basic/hashmap.h:10, + from ../src/shared/bus-util.h:12, + from ../src/libsystemd/sd-bus/bus-creds.c:11: + /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’ + struct statx { + ^~~~~ + In file included from /usr/include/sys/stat.h:446, + from ../src/basic/util.h:19, + from ../src/basic/hashmap.h:10, + from ../src/shared/bus-util.h:12, + from ../src/libsystemd/sd-bus/bus-creds.c:11: + /usr/include/bits/statx.h:36:8: note: originally defined here + struct statx + ^~~~~ + +Extend our meson.build to look for struct statx when only sys/stat.h is +included and, in that case, do not include linux/stat.h anymore. + +Tested that systemd builds correctly when using a glibc version that includes a +definition for struct statx. + +glibc Fedora RPM update: +https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae + +glibc upstream commit: +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd +--- + meson.build | 5 +++++ + src/basic/missing.h | 5 ++++- + src/basic/xattr-util.c | 1 - + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index dd904c71487..68423bdfa5e 100644 +--- a/meson.build ++++ b/meson.build +@@ -425,6 +425,7 @@ decl_headers = ''' + #include + ''' + # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail ++# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time + + foreach decl : ['char16_t', + 'char32_t', +@@ -439,6 +440,10 @@ foreach decl : ['char16_t', + conf.set10('HAVE_' + decl.underscorify().to_upper(), have) + endforeach + ++conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : ''' ++#include ++''', args : '-D_GNU_SOURCE') > 0) ++ + foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], + ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], + ['IFLA_VRF_TABLE', 'linux/if_link.h'], +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 71a07d05747..14ad3d49140 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -15,7 +15,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -25,6 +24,10 @@ + #include + #include + ++#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H ++#include ++#endif ++ + #if HAVE_AUDIT + #include + #endif +diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c +index c5c55ea8461..0ee0979837c 100644 +--- a/src/basic/xattr-util.c ++++ b/src/basic/xattr-util.c +@@ -2,7 +2,6 @@ + + #include + #include +-#include + #include + #include + #include diff --git a/packages/sysutils/systemd/patches/systemd-0007-fix-build-with-glibc_2.28.patch b/packages/sysutils/systemd/patches/systemd-0007-fix-build-with-glibc_2.28.patch new file mode 100644 index 0000000000..b4da33f704 --- /dev/null +++ b/packages/sysutils/systemd/patches/systemd-0007-fix-build-with-glibc_2.28.patch @@ -0,0 +1,124 @@ +From 9c869d08d82c73f62ab3527567858ce4b0cf1257 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Wed, 18 Jul 2018 17:26:17 +0200 +Subject: [PATCH 1/2] meson: unify linux/stat.h check with other checks and use + _GNU_SOURCE + +Using _GNU_SOURCE is better because that's how we include the headers in the +actual build, and some headers define different stuff when it is defined. +sys/stat.h for example defines 'struct statx' conditionally. +--- + meson.build | 20 ++++++++++++++------ + src/basic/missing.h | 2 +- + 2 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/meson.build b/meson.build +index 68423bdfa5e..99035d2306c 100644 +--- a/meson.build ++++ b/meson.build +@@ -421,11 +421,9 @@ decl_headers = ''' + #include + #include + #include +-#include + #include + ''' + # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail +-# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time + + foreach decl : ['char16_t', + 'char32_t', +@@ -436,13 +434,23 @@ foreach decl : ['char16_t', + ] + + # We get -1 if the size cannot be determined +- have = cc.sizeof(decl, prefix : decl_headers) > 0 ++ have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 ++ ++ if decl == 'struct statx' ++ if have ++ want_linux_stat_h = false ++ else ++ have = cc.sizeof(decl, ++ prefix : decl_headers + '#include ', ++ args : '-D_GNU_SOURCE') > 0 ++ want_linux_stat_h = have ++ endif ++ endif ++ + conf.set10('HAVE_' + decl.underscorify().to_upper(), have) + endforeach + +-conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : ''' +-#include +-''', args : '-D_GNU_SOURCE') > 0) ++conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) + + foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], + ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 14ad3d49140..9044683b15f 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -24,7 +24,7 @@ + #include + #include + +-#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H ++#if WANT_LINUX_STAT_H + #include + #endif + + +From 1d7aedf11a22d0c1aca40905e953a25f03252cde Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Wed, 18 Jul 2018 17:42:06 +0200 +Subject: [PATCH 2/2] meson: remove false check for key_serial_t + +key_serial_t is defined in keyutil.h, which wasn't included in the header list +in the test, so the test always failed. We were always compiling stuff with +!HAVE_KEY_SERIAL_T. + +We could try to add keyutil.h to the test, but then we'd have to first check if +it is available, which just doesn't seem worth the trouble. + +key_serial_t should always be defined as int32_t. Let's keep the uncoditional +define, since repeated compatible typedefs are not a problem, and it allows us +to compile even if the header file is missing. If there's ever a change in the +definition, we'll have to adjust the code for the different type anyway, and +our compiler will tell us. +--- + meson.build | 2 -- + src/basic/missing.h | 2 -- + 2 files changed, 4 deletions(-) + +diff --git a/meson.build b/meson.build +index 99035d2306c..84656cdc7e8 100644 +--- a/meson.build ++++ b/meson.build +@@ -423,11 +423,9 @@ decl_headers = ''' + #include + #include + ''' +-# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail + + foreach decl : ['char16_t', + 'char32_t', +- 'key_serial_t', + 'struct ethtool_link_settings', + 'struct fib_rule_uid_range', + 'struct statx', +diff --git a/src/basic/missing.h b/src/basic/missing.h +index 9044683b15f..477992fbcba 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -1183,9 +1183,7 @@ struct input_mask { + #define KEY_ALS_TOGGLE 0x230 + #endif + +-#if ! HAVE_KEY_SERIAL_T + typedef int32_t key_serial_t; +-#endif + + #ifndef KEYCTL_JOIN_SESSION_KEYRING + #define KEYCTL_JOIN_SESSION_KEYRING 1 diff --git a/packages/sysutils/systemd/patches/systemd-0200-persist-persistent-timer-stamps.patch b/packages/sysutils/systemd/patches/systemd-0200-persist-persistent-timer-stamps.patch new file mode 100644 index 0000000000..460157843e --- /dev/null +++ b/packages/sysutils/systemd/patches/systemd-0200-persist-persistent-timer-stamps.patch @@ -0,0 +1,30 @@ +From c1bcb16c35724404d30fab53017b757c886e9ab7 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Mon, 8 Jan 2018 13:46:51 +0000 +Subject: [PATCH] timers: use a persistent filesystem for persistent timers + +--- + src/core/timer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/timer.c b/src/core/timer.c +index 03935ee..bfd5c02 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -154,11 +154,11 @@ static int timer_setup_persistent(Timer *t) { + + if (MANAGER_IS_SYSTEM(UNIT(t)->manager)) { + +- r = unit_require_mounts_for(UNIT(t), "/var/lib/systemd/timers", UNIT_DEPENDENCY_FILE); ++ r = unit_require_mounts_for(UNIT(t), "/storage/.cache/systemd/timers", UNIT_DEPENDENCY_FILE); + if (r < 0) + return r; + +- t->stamp_path = strappend("/var/lib/systemd/timers/stamp-", UNIT(t)->id); ++ t->stamp_path = strappend("/storage/.cache/systemd/timers/stamp-", UNIT(t)->id); + } else { + const char *e; + +-- +2.14.1 + diff --git a/packages/sysutils/systemd/profile.d/90-systemd.conf b/packages/sysutils/systemd/profile.d/90-systemd.conf index f72cc6ee15..f950669b54 100644 --- a/packages/sysutils/systemd/profile.d/90-systemd.conf +++ b/packages/sysutils/systemd/profile.d/90-systemd.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) export SYSTEMD_COLORS=0 diff --git a/packages/sysutils/systemd/scripts/kernel-overlays-setup b/packages/sysutils/systemd/scripts/kernel-overlays-setup new file mode 100755 index 0000000000..bd6178a760 --- /dev/null +++ b/packages/sysutils/systemd/scripts/kernel-overlays-setup @@ -0,0 +1,85 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +SYSTEM_OVERLAYS_DIR=/usr/lib/kernel-overlays +OVERLAY_CONFIG_DIR=/storage/.cache/kernel-overlays +KVER=$(uname -r) +MODULES_DIR="/var/lib/modules/${KVER}" +FIRMWARE_DIR="/var/lib/firmware" +USER_FIRMWARE_DIR="/storage/.config/firmware" + +mkdir -p "${MODULES_DIR}" +mkdir -p "${FIRMWARE_DIR}" +mkdir -p "${OVERLAY_CONFIG_DIR}" + +log() { + echo "kernel-overlays-setup: $@" > /dev/kmsg +} + +apply_overlay() { + case "$1" in + /*) + modules_overlay_dir="${1}/lib/modules/${KVER}" + firmware_overlay_dir="${1}/lib/firmware" + ;; + *) + modules_overlay_dir="${SYSTEM_OVERLAYS_DIR}/${1}/lib/modules/${KVER}" + firmware_overlay_dir="${SYSTEM_OVERLAYS_DIR}/${1}/lib/firmware" + ;; + esac + + if [ -d "${modules_overlay_dir}" ] ; then + GOT_MODULE_OVERLAY="yes" + + if cp -rfs "${modules_overlay_dir}"/* "${MODULES_DIR}" ; then + log "added modules from $modules_overlay_dir" + else + log "failed to add modules from $modules_overlay_dir" + fi + fi + + if [ -d "${firmware_overlay_dir}" ] ; then + if cp -rfs "${firmware_overlay_dir}"/* "${FIRMWARE_DIR}" ; then + log "added firmware from $firmware_overlay_dir" + else + log "failed to add firmware from $firmware_overlay_dir" + fi + fi +} + +# setup system base modules + +log "setup base modules" +apply_overlay base + +# apply user-configured module overlays + +if [ -d "${OVERLAY_CONFIG_DIR}" ] ; then + log "adding overlays from ${OVERLAY_CONFIG_DIR}" + GOT_MODULE_OVERLAY="no" + + for conf in "${OVERLAY_CONFIG_DIR}/"*.conf ; do + if [ -e "$conf" ] ; then + log "processing conf $conf" + overlay=$(cat "$conf") + [ -n "$overlay" ] && apply_overlay "$overlay" + fi + done + + if [ "yes" = "$GOT_MODULE_OVERLAY" ] ; then + log "running depmod" + /usr/sbin/depmod -a + fi +fi + +if [ -d "${USER_FIRMWARE_DIR}" ] && [ -n "$(ls ${USER_FIRMWARE_DIR})" ] ; then + if cp -rfs "${USER_FIRMWARE_DIR}"/* "${FIRMWARE_DIR}" ; then + log "added firmware from ${USER_FIRMWARE_DIR}" + else + log "failed to add firmware from ${USER_FIRMWARE_DIR}" + fi +fi + +log "done" diff --git a/packages/sysutils/systemd/scripts/systemd-machine-id-setup b/packages/sysutils/systemd/scripts/systemd-machine-id-setup index 4f7142d183..5db1be3131 100755 --- a/packages/sysutils/systemd/scripts/systemd-machine-id-setup +++ b/packages/sysutils/systemd/scripts/systemd-machine-id-setup @@ -1,42 +1,17 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) -# Creates a unique machine-id based on a local MAC address which persists over -# reboots, upgrades and reinstallation. For systems with slow loading network -# drivers (no MAC's available) dbus-uuidgen is used which persists over reboot -# and upgrades but not reinstallation. If a MAC is used it is hashed to make it -# anonymous. The machine-id is used by dbus and systemd, and to collect basic -# active-installation statistics on LibreELEC users. +# remove old machine-id file +[[ -f "/storage/.cache/machine-id" ]] && rm /storage/.cache/machine-id -if [ -e "/storage/.cache/machine-id" ]; then - MACHINEID=`cat /storage/.cache/machine-id` -elif [ -e "/sys/class/net/eth0/address" ]; then - MAC_ADDRESS=`cat /sys/class/net/eth0/address` -elif [ -e "/sys/class/net/wlan0/address" ]; then - MAC_ADDRESS=`cat /sys/class/net/wlan0/address` -else - MAC_ADDRESS=`/usr/bin/dbus-uuidgen` -fi +# test systemd-machine-id exists and is 32 hex chars or generate a new uuid +MACHINEID="$(cat /storage/.cache/systemd-machine-id 2>/dev/null)" +[ "${#MACHINEID}" != "32" ] && MACHINEID= +[[ "${MACHINEID//[a-f0-9]/}" != "" ]] && MACHINEID= +[ -z "${MACHINEID}" ] && MACHINEID=$(/usr/bin/dbus-uuidgen) -if [ -z "$MACHINEID" ]; then - MACHINEID=`echo $MAC_ADDRESS | md5sum | cut -f1 -d" "` - mkdir -p /storage/.cache -fi - -echo "$MACHINEID" > /storage/.cache/machine-id +# persist uuid +mkdir -p /storage/.cache + echo "$MACHINEID" > /storage/.cache/systemd-machine-id diff --git a/packages/sysutils/systemd/scripts/usercache-setup b/packages/sysutils/systemd/scripts/usercache-setup new file mode 100755 index 0000000000..e17b7e08fe --- /dev/null +++ b/packages/sysutils/systemd/scripts/usercache-setup @@ -0,0 +1,27 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +# Fix bug in older versions creating file /storage/.cache/services +[ -f /storage/.cache/services ] && rm /storage/.cache/services && mkdir -p /storage/.cache/services + +# Copy cache files, but don't overwrite +false | cp -iRp /usr/cache/* /storage/.cache/ &>/dev/null + +# Merge default and custom shadow file details +if [ -f /storage/.cache/shadow -a -f /usr/cache/shadow ]; then + # Get existing root details (possibly user defined) + userroot="$(grep "^root:" /storage/.cache/shadow)" + + # Overwrite users shadow file with default details, replacing root with any existing value + # If current file is garbage (ie. missing root) then replace it + if [ -n "${userroot}" ]; then + sed -e "s ^root:.* ${userroot} " /usr/cache/shadow >/storage/.cache/shadow + else + cp -fp /usr/cache/shadow /storage/.cache/shadow + fi + + # Make sure we have the correct permission + chmod 000 /storage/.cache/shadow +fi diff --git a/packages/sysutils/systemd/scripts/userconfig-setup b/packages/sysutils/systemd/scripts/userconfig-setup new file mode 100755 index 0000000000..feaf8b56c7 --- /dev/null +++ b/packages/sysutils/systemd/scripts/userconfig-setup @@ -0,0 +1,12 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +# Remove those sample files that we manage +for sample in $(find /storage/.config -name '*.sample' 2>/dev/null); do + [ -f /usr/config/${sample:16} ] && rm -f ${sample} +done + +# Copy config files, but don't overwrite - this should replace our sample files +false | cp -iRp /usr/config/* /storage/.config/ &>/dev/null diff --git a/packages/sysutils/systemd/system.d/kernel-overlays.service b/packages/sysutils/systemd/system.d/kernel-overlays.service new file mode 100644 index 0000000000..5d771ac3a0 --- /dev/null +++ b/packages/sysutils/systemd/system.d/kernel-overlays.service @@ -0,0 +1,12 @@ +[Unit] +Description=Create kernel modules tree from overlays +DefaultDependencies=no +After=var.mount +Before=systemd-udevd.service systemd-udev-trigger.service systemd-modules-load.service systemd-remount-fs.service swap.service machine-id.service kmod-static-nodes.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/kernel-overlays-setup + +[Install] +WantedBy=local-fs.target diff --git a/packages/sysutils/systemd/system.d/usercache.service b/packages/sysutils/systemd/system.d/usercache.service new file mode 100644 index 0000000000..26e9b5836c --- /dev/null +++ b/packages/sysutils/systemd/system.d/usercache.service @@ -0,0 +1,12 @@ +[Unit] +Description=Setup User cache dir +DefaultDependencies=no +After=systemd-tmpfiles-setup.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/usercache-setup +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target diff --git a/packages/sysutils/systemd/system.d/userconfig.service b/packages/sysutils/systemd/system.d/userconfig.service index 1e02f8e43d..2117d8957f 100644 --- a/packages/sysutils/systemd/system.d/userconfig.service +++ b/packages/sysutils/systemd/system.d/userconfig.service @@ -5,7 +5,7 @@ After=systemd-tmpfiles-setup.service [Service] Type=oneshot -ExecStart=/bin/sh -c "false | cp -iR /usr/config/* /storage/.config/ &>/dev/null" +ExecStart=/usr/bin/userconfig-setup RemainAfterExit=yes [Install] diff --git a/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf b/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf index 0cf4959b10..07d11f550b 100644 --- a/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf +++ b/packages/sysutils/systemd/tmpfiles.d/z_01_openelec.conf @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /run/libreelec 0755 root root - - d /run/libreelec/debug 0755 root root - - diff --git a/packages/sysutils/systemd/udev.d/60-not-joysticks.rules b/packages/sysutils/systemd/udev.d/60-not-joysticks.rules new file mode 100644 index 0000000000..330c70f3c5 --- /dev/null +++ b/packages/sysutils/systemd/udev.d/60-not-joysticks.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="input", ATTRS{name}=="aml_keypad", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_INPUT_JOYSTICK}="" +SUBSYSTEM=="input", ATTRS{name}=="Remote+", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_INPUT_JOYSTICK}="" diff --git a/packages/sysutils/tz/package.mk b/packages/sysutils/tz/package.mk index 4eb666003e..2cfb68959a 100644 --- a/packages/sysutils/tz/package.mk +++ b/packages/sysutils/tz/package.mk @@ -1,45 +1,26 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="tz" -PKG_VERSION="2016i" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2018c" +PKG_SHA256="9c653d7b7b127d81f7db07920d1c3f7a0a7f1e5bc042d7907e01427593954e15" PKG_LICENSE="Public Domain" PKG_SITE="http://www.iana.org/time-zones" PKG_URL="https://github.com/eggert/tz/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="tzdata" -PKG_LONGDESC="tzdata" +PKG_LONGDESC="Time zone and daylight-saving time data." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAKE_OPTS_TARGET="CC=$HOST_CC LDFLAGS=" +pre_configure_target() { + PKG_MAKE_OPTS_TARGET="CC=$HOST_CC LDFLAGS=" +} makeinstall_target() { - make TOPDIR="$INSTALL" install + make TZDIR="$INSTALL/usr/share/zoneinfo" REDO=posix_only TOPDIR="$INSTALL" install } post_makeinstall_target() { - mkdir -p $INSTALL/usr/share/zoneinfo - mv $INSTALL/etc/zoneinfo/* $INSTALL/usr/share/zoneinfo + rm -rf $INSTALL/usr/bin $INSTALL/usr/sbin rm -rf $INSTALL/etc mkdir -p $INSTALL/etc diff --git a/packages/sysutils/tz/system.d/tz-data.service b/packages/sysutils/tz/system.d/tz-data.service index 657e153f1e..d54d32b8bb 100644 --- a/packages/sysutils/tz/system.d/tz-data.service +++ b/packages/sysutils/tz/system.d/tz-data.service @@ -2,13 +2,12 @@ Description=Setup Timezone data DefaultDependencies=no Before=systemd-udevd.service -After=var.mount +After=var.mount systemd-tmpfiles-setup.service [Service] Type=oneshot Environment=TIMEZONE=UTC EnvironmentFile=-/storage/.cache/timezone -ExecStartPre=/bin/mkdir -p /var/run ExecStart=/bin/ln -sf /usr/share/zoneinfo/${TIMEZONE} /var/run/localtime RemainAfterExit=yes StartLimitInterval=0 diff --git a/packages/sysutils/udevil/config/udevil.conf b/packages/sysutils/udevil/config/udevil.conf index 995d3c156a..d2f653a235 100644 --- a/packages/sysutils/udevil/config/udevil.conf +++ b/packages/sysutils/udevil/config/udevil.conf @@ -259,11 +259,11 @@ allowed_options_exfat = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gi # mount_point_mode_FSTYPE, if present, is used to override mount_point_mode # when mounting a specific fstype (eg ext2, nfs). # NOT SETTING A MODE CAN HAVE SECURITY IMPLICATIONS FOR SOME FSTYPES -mount_point_mode = 0755 +# mount_point_mode = 0755 # don't set a mode for some types: -mount_point_mode_sshfs = -mount_point_mode_curlftpfs = -mount_point_mode_ftpfs = +# mount_point_mode_sshfs = +# mount_point_mode_curlftpfs = +# mount_point_mode_ftpfs = # Use the settings below to change the default locations of programs used by diff --git a/packages/sysutils/udevil/package.mk b/packages/sysutils/udevil/package.mk index b44c7c5874..55b2873bbb 100644 --- a/packages/sysutils/udevil/package.mk +++ b/packages/sysutils/udevil/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="udevil" PKG_VERSION="0.4.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="ce8c51fd4d589cda7be56e75b42188deeb258c66fc911a9b3a70a3945c157739" PKG_LICENSE="GPL" PKG_SITE="https://github.com/IgnorantGuru/udevil" PKG_URL="https://github.com/IgnorantGuru/udevil/raw/pkg/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain systemd glib" -PKG_SECTION="system" -PKG_SHORTDESC="udevil: Mounts and unmounts removable devices and networks without a password." -PKG_LONGDESC="udevil Mounts and unmounts removable devices and networks without a password (set suid), shows device info, monitors device changes. Emulates mount's and udisks's command line usage and udisks v1's output. Includes the devmon automounting daemon." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Mounts and unmounts removable devices and networks without a password." PKG_CONFIGURE_OPTS_TARGET="--disable-systemd \ --with-mount-prog=/usr/bin/mount \ diff --git a/packages/sysutils/udevil/udev.d/95-udevil-mount.rules b/packages/sysutils/udevil/udev.d/95-udevil-mount.rules index 42c88d00d9..64065d04b7 100644 --- a/packages/sysutils/udevil/udev.d/95-udevil-mount.rules +++ b/packages/sysutils/udevil/udev.d/95-udevil-mount.rules @@ -16,7 +16,7 @@ GOTO="exit" # mount or umount for hdds LABEL="harddisk" -ACTION=="add", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service" +ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service" ACTION=="remove", RUN+="/usr/bin/systemctl stop udevil-mount@/dev/%k.service" GOTO="exit" diff --git a/packages/sysutils/usbutils/package.mk b/packages/sysutils/usbutils/package.mk index f19791d622..3fbf40b17f 100644 --- a/packages/sysutils/usbutils/package.mk +++ b/packages/sysutils/usbutils/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="usbutils" PKG_VERSION="008" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="44741af0bae9d402a0ef160a29b2fa700bb656ab5e0a4b3343d51249c2a44c8c" PKG_LICENSE="GPL" PKG_SITE="http://www.linux-usb.org/" PKG_URL="http://kernel.org/pub/linux/utils/usb/usbutils/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain libusb systemd" -PKG_SECTION="system" -PKG_SHORTDESC="usbutils: Linux USB Utilities" -PKG_LONGDESC="This package contains various utilities for inspecting and setting of devices connected to the USB bus. Requires a kernel version including usbdevfs support - and this usbdevfs mounted to /proc/bus/usb." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="This package contains various utilities for inspecting and setting of devices connected to the USB bus." post_makeinstall_target() { rm -rf $INSTALL/usr/bin/lsusb.py diff --git a/packages/sysutils/util-linux/config/swap.conf b/packages/sysutils/util-linux/config/swap.conf index 1b052f6b0f..d02e30b035 100644 --- a/packages/sysutils/util-linux/config/swap.conf +++ b/packages/sysutils/util-linux/config/swap.conf @@ -1,20 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) SWAPFILE="$HOME/.cache/swapfile" SWAPFILESIZE="@SWAPFILESIZE@" diff --git a/packages/sysutils/util-linux/package.mk b/packages/sysutils/util-linux/package.mk index 6d4511d1c2..07e07e8ea7 100644 --- a/packages/sysutils/util-linux/package.mk +++ b/packages/sysutils/util-linux/package.mk @@ -1,35 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="util-linux" -PKG_VERSION="2.29" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.32.1" +PKG_SHA256="86e6707a379c7ff5489c218cfaf1e3464b0b95acf7817db0bc5f179e356a67b2" PKG_LICENSE="GPL" -PKG_URL="http://www.kernel.org/pub/linux/utils/util-linux/v2.29/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://www.kernel.org/pub/linux/utils/util-linux/v${PKG_VERSION%.*}/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="" PKG_DEPENDS_TARGET="toolchain" PKG_DEPENDS_INIT="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="util-linux: Miscellaneous system utilities for Linux" -PKG_LONGDESC="The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function. Among many features, Util-linux contains the fdisk configuration tool and the login program." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="A large variety of low-level system utilities that are necessary for a Linux system to function." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic:host" UTILLINUX_CONFIG_DEFAULT="--disable-gtk-doc \ --disable-nls \ @@ -37,7 +20,6 @@ UTILLINUX_CONFIG_DEFAULT="--disable-gtk-doc \ --enable-tls \ --disable-all-programs \ --enable-chsh-only-listed \ - --enable-libmount-force-mountinfo \ --disable-bash-completion \ --disable-colors-default \ --disable-pylibmount \ @@ -50,9 +32,9 @@ UTILLINUX_CONFIG_DEFAULT="--disable-gtk-doc \ --without-audit \ --without-udev \ --without-ncurses \ + --without-ncursesw \ --without-readline \ --without-slang \ - --without-termcap \ --without-tinfo \ --without-utempter \ --without-util \ @@ -70,6 +52,7 @@ PKG_CONFIGURE_OPTS_TARGET="$UTILLINUX_CONFIG_DEFAULT \ --enable-libsmartcols \ --enable-losetup \ --enable-fsck \ + --enable-fstrim \ --enable-blkid" if [ "$SWAP_SUPPORT" = "yes" ]; then diff --git a/packages/sysutils/util-linux/patches/util-linux-blkid_swapon_mkfs_uuidgen.patch b/packages/sysutils/util-linux/patches/util-linux-blkid_swapon_mkfs_uuidgen.patch index 7504670e15..a28c8da68a 100644 --- a/packages/sysutils/util-linux/patches/util-linux-blkid_swapon_mkfs_uuidgen.patch +++ b/packages/sysutils/util-linux/patches/util-linux-blkid_swapon_mkfs_uuidgen.patch @@ -1,7 +1,8 @@ -diff -Naur util-linux-2.27/configure.ac util-linux-2.27.patch/configure.ac ---- util-linux-2.27/configure.ac 2015-09-07 09:59:25.000000000 +0200 -+++ util-linux-2.27.patch/configure.ac 2015-09-12 10:35:53.576532786 +0200 -@@ -1051,11 +1051,19 @@ +diff --git a/configure.ac b/configure.ac +index 1899ec3..e4be942 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1156,7 +1156,11 @@ AS_IF([test "x$build_uuidd" = xyes || test "x$enable_libuuid_force_uuidd" == xye AM_CONDITIONAL([BUILD_UUIDD], [test "x$build_uuidd" = xyes]) @@ -10,10 +11,14 @@ diff -Naur util-linux-2.27/configure.ac util-linux-2.27.patch/configure.ac + AS_HELP_STRING([--disable-uuidgen], [do not build uuidgen]), + [], [UL_DEFAULT_ENABLE([uuidgen], [check])] +) -+UL_BUILD_INIT([uuidgen]]) ++UL_BUILD_INIT([uuidgen]) UL_REQUIRES_BUILD([uuidgen], [libuuid]) AM_CONDITIONAL([BUILD_UUIDGEN], [test "x$build_uuidgen" = xyes]) +@@ -1165,7 +1169,11 @@ UL_REQUIRES_BUILD([uuidparse], [libuuid]) + UL_REQUIRES_BUILD([uuidparse], [libsmartcols]) + AM_CONDITIONAL([BUILD_UUIDPARSE], [test "x$build_uuidparse" = xyes]) + -UL_BUILD_INIT([blkid], [check]) +AC_ARG_ENABLE([blkid], + AS_HELP_STRING([--disable-blkid], [do not build blkid(8)]), @@ -23,11 +28,10 @@ diff -Naur util-linux-2.27/configure.ac util-linux-2.27.patch/configure.ac UL_REQUIRES_BUILD([blkid], [libblkid]) AM_CONDITIONAL([BUILD_BLKID], [test "x$build_blkid" = xyes]) -@@ -1242,21 +1250,26 @@ - UL_REQUIRES_HAVE([hwclock], [io, linuxdummy], [ioperm iopl function or Linux]) +@@ -1403,20 +1411,32 @@ UL_REQUIRES_HAVE([hwclock], [io, linuxdummy], [ioperm iopl function or Linux]) AM_CONDITIONAL([BUILD_HWCLOCK], [test "x$build_hwclock" = xyes]) -- + -UL_BUILD_INIT([mkfs], [yes]) +AC_ARG_ENABLE([mkfs], + AS_HELP_STRING([--disable-mkfs], [do not build mkfs(8)]), @@ -39,13 +43,18 @@ diff -Naur util-linux-2.27/configure.ac util-linux-2.27.patch/configure.ac UL_BUILD_INIT([isosize], [yes]) AM_CONDITIONAL([BUILD_ISOSIZE], [test "x$build_isosize" = xyes]) -- - UL_BUILD_INIT([fstrim], [check]) + +-UL_BUILD_INIT([fstrim], [check]) ++AC_ARG_ENABLE([fstrim], ++ AS_HELP_STRING([--disable-fstrim], [do not build fstrim(8)]), ++ [], [UL_DEFAULT_ENABLE([fstrim], [check])] ++) ++UL_BUILD_INIT([fstrim]) UL_REQUIRES_LINUX([fstrim]) UL_REQUIRES_BUILD([fstrim], [libmount]) AM_CONDITIONAL([BUILD_FSTRIM], [test "x$build_fstrim" = xyes]) -- + -UL_BUILD_INIT([swapon], [check]) +AC_ARG_ENABLE([swapon], + AS_HELP_STRING([--disable-swapon], [do not build swapon(8) and swapoff(8)]), diff --git a/packages/sysutils/util-linux/scripts/mount-swap b/packages/sysutils/util-linux/scripts/mount-swap index 6d9397c605..015955d3e2 100755 --- a/packages/sysutils/util-linux/scripts/mount-swap +++ b/packages/sysutils/util-linux/scripts/mount-swap @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) . /etc/swap.conf . /etc/profile diff --git a/packages/sysutils/v4l-utils/config/rc_maps.cfg.sample b/packages/sysutils/v4l-utils/config/rc_maps.cfg.sample new file mode 100644 index 0000000000..c8f6bca229 --- /dev/null +++ b/packages/sysutils/v4l-utils/config/rc_maps.cfg.sample @@ -0,0 +1,20 @@ +# Keymaps table +# +# This table creates an association between a keycode file and a kernel +# driver. It can be used to automatically override a keycode definition. +# +# +# Format: +# driver - name of the driver provided via uevent - use * for any driver +# table - RC keymap table, provided via uevent - use * for any table +# file - file name. If directory is not specified, it is first looked up +# in /storage/.config/rc_keymaps, then /usr/lib/udev/rc_keymaps +# +# For example: +# +# driver table file +# +# gpio-rc-recv rc-streamzap streamzap +# gpio-rc-recv * justboom +# * rc-rc6-mce rc6_mce_new +# * * hauppauge_new diff --git a/packages/sysutils/v4l-utils/keymaps/cubox_i b/packages/sysutils/v4l-utils/keymaps/cubox_i new file mode 100644 index 0000000000..e23b3f19a3 --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/cubox_i @@ -0,0 +1,10 @@ +# table cubox_i, type: RC6 +0x1f020b0 KEY_MEDIA +0x1f02078 KEY_UP +0x1f02044 KEY_ENTER +0x1f020f8 KEY_DOWN +0x1f02004 KEY_LEFT +0x1f02084 KEY_RIGHT +0x1f020c4 KEY_BACKSPACE +0x1f02068 KEY_PLAYPAUSE +0x1f02064 KEY_EPG diff --git a/packages/sysutils/v4l-utils/keymaps/khadas_vim b/packages/sysutils/v4l-utils/keymaps/khadas_vim new file mode 100644 index 0000000000..485e4ccb55 --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/khadas_vim @@ -0,0 +1,13 @@ +# table kvim, type: NEC +0x14 KEY_POWER +0x07 KEY_OK +0x03 KEY_UP +0x02 KEY_DOWN +0x0e KEY_LEFT +0x1a KEY_RIGHT +0x13 KEY_MENU +0x01 KEY_BACK +0x0b KEY_VOLUMEUP +0x58 KEY_VOLUMEDOWN +0x48 KEY_HOME +0x5b KEY_CONTEXT_MENU diff --git a/packages/sysutils/v4l-utils/keymaps/minix_neo b/packages/sysutils/v4l-utils/keymaps/minix_neo new file mode 100644 index 0000000000..00ffdb27aa --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/minix_neo @@ -0,0 +1,13 @@ +# table minix_neo, type: NEC +0x118 KEY_POWER +0x146 KEY_UP +0x116 KEY_DOWN +0x147 KEY_LEFT +0x115 KEY_RIGHT +0x155 KEY_ENTER +0x110 KEY_VOLUMEDOWN +0x140 KEY_BACK +0x114 KEY_VOLUMEUP +0x10d KEY_HOMEPAGE +0x104 KEY_MENU +0x112 KEY_CONFIG diff --git a/packages/sysutils/v4l-utils/keymaps/odroid b/packages/sysutils/v4l-utils/keymaps/odroid new file mode 100644 index 0000000000..49d7a17f11 --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/odroid @@ -0,0 +1,13 @@ +# table odroid, type: NEC +0xb2dc KEY_POWER +0xb288 KEY_MUTE +0xb282 KEY_HOME +0xb2ce KEY_OK +0xb2ca KEY_UP +0xb299 KEY_LEFT +0xb2c1 KEY_RIGHT +0xb2d2 KEY_DOWN +0xb2c5 KEY_MENU +0xb29a KEY_BACK +0xb281 KEY_VOLUMEDOWN +0xb280 KEY_VOLUMEUP diff --git a/packages/sysutils/v4l-utils/keymaps/wetek_hub b/packages/sysutils/v4l-utils/keymaps/wetek_hub new file mode 100644 index 0000000000..67fe25fc3d --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/wetek_hub @@ -0,0 +1,13 @@ +# table wetek_hub, type: NEC +0x77f1 KEY_POWER +0x77f2 KEY_HOME +0x77f3 KEY_MUTE +0x77f4 KEY_UP +0x77f5 KEY_DOWN +0x77f6 KEY_LEFT +0x77f7 KEY_RIGHT +0x77f8 KEY_OK +0x77f9 KEY_BACK +0x77fa KEY_MENU +0x77fb KEY_VOLUMEUP +0x77fc KEY_VOLUMEDOWN diff --git a/packages/sysutils/v4l-utils/keymaps/wetek_play_2 b/packages/sysutils/v4l-utils/keymaps/wetek_play_2 new file mode 100644 index 0000000000..1aff5942cc --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/wetek_play_2 @@ -0,0 +1,44 @@ +# table wetek_play_2, type: NEC +0x5e5f02 KEY_POWER +0x5e5f46 KEY_SLEEP +0x5e5f10 KEY_MUTE +0x5e5f22 KEY_1 +0x5e5f23 KEY_2 +0x5e5f24 KEY_3 +0x5e5f25 KEY_4 +0x5e5f26 KEY_5 +0x5e5f27 KEY_6 +0x5e5f28 KEY_7 +0x5e5f29 KEY_8 +0x5e5f30 KEY_9 +0x5e5f71 KEY_ESC +0x5e5f21 KEY_0 +0x5e5f72 KEY_CAPSLOCK +0x5e5f03 KEY_HOMEPAGE +0x5e5f48 KEY_MENU +0x5e5f61 KEY_BACKSPACE +0x5e5f83 KEY_EPG +0x5e5f84 KEY_COMPOSE +0x5e5f77 KEY_CONFIG +0x5e5f50 KEY_UP +0x5e5f4b KEY_DOWN +0x5e5f4c KEY_LEFT +0x5e5f4d KEY_RIGHT +0x5e5f47 KEY_ENTER +0x5e5f44 KEY_VOLUMEUP +0x5e5f43 KEY_VOLUMEDOWN +0x5e5f41 KEY_PAGEUP +0x5e5f42 KEY_PAGEDOWN +0x5e5f4f KEY_FAVORITES +0x5e5f82 KEY_TEXT +0x5e5f73 KEY_RED +0x5e5f74 KEY_GREEN +0x5e5f75 KEY_YELLOW +0x5e5f76 KEY_BLUE +0x5e5f67 KEY_PREVIOUSSONG +0x5e5f79 KEY_REWIND +0x5e5f80 KEY_FASTFORWARD +0x5e5f81 KEY_NEXTSONG +0x5e5f04 KEY_RECORD +0x5e5f2c KEY_PLAYPAUSE +0x5e5f2b KEY_STOP diff --git a/packages/sysutils/v4l-utils/keymaps/xbox_360 b/packages/sysutils/v4l-utils/keymaps/xbox_360 new file mode 100644 index 0000000000..66b62adc7d --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/xbox_360 @@ -0,0 +1,66 @@ +# table xbox_360, type: RC6 +0x800f7400 KEY_NUMERIC_0 +0x800f7401 KEY_NUMERIC_1 +0x800f7402 KEY_NUMERIC_2 +0x800f7403 KEY_NUMERIC_3 +0x800f7404 KEY_NUMERIC_4 +0x800f7405 KEY_NUMERIC_5 +0x800f7406 KEY_NUMERIC_6 +0x800f7407 KEY_NUMERIC_7 +0x800f7408 KEY_NUMERIC_8 +0x800f7409 KEY_NUMERIC_9 +0x800f740a KEY_DELETE +0x800f740b KEY_ENTER +0x800f740c KEY_SLEEP +0x800f740d KEY_MEDIA +0x800f7464 KEY_MEDIA +0x800f740e KEY_MUTE +0x800f740f KEY_INFO +0x800f7410 KEY_VOLUMEUP +0x800f7411 KEY_VOLUMEDOWN +0x800f7412 KEY_CHANNELUP +0x800f746C KEY_CHANNELUP +0x800f7413 KEY_CHANNELDOWN +0x800f746D KEY_CHANNELDOWN +0x800f7414 KEY_FASTFORWARD +0x800f7415 KEY_REWIND +0x800f7416 KEY_PLAY +0x800f7417 KEY_RECORD +0x800f7418 KEY_PAUSE +0x800f7419 KEY_STOP +0x800f741a KEY_NEXT +0x800f741b KEY_PREVIOUS +0x800f741c KEY_NUMERIC_POUND +0x800f741d KEY_NUMERIC_STAR +0x800f741e KEY_UP +0x800f741f KEY_DOWN +0x800f7420 KEY_LEFT +0x800f7421 KEY_RIGHT +0x800f7422 KEY_OK +0x800f7423 KEY_EXIT +0x800f7424 KEY_DVD +0x800f744f KEY_EPG +0x800f7427 KEY_ZOOM +0x800f7432 KEY_MODE +0x800f7433 KEY_PRESENTATION +0x800f7428 KEY_EJECTCD +0x800f743a KEY_BRIGHTNESSUP +0x800f7446 KEY_TV +0x800f7447 KEY_AUDIO +0x800f7448 KEY_PVR +0x800f7449 KEY_CAMERA +0x800f744a KEY_VIDEO +0x800f744c KEY_LANGUAGE +0x800f7451 KEY_TITLE +0x800f744e KEY_PRINT +0x800f7450 KEY_RADIO +0x800f745a KEY_SUBTITLE +0x800f7425 KEY_RED +0x800f7466 KEY_GREEN +0x800f7426 KEY_YELLOW +0x800f7468 KEY_BLUE +0x800f7465 KEY_POWER2 +0x800f746e KEY_PLAYPAUSE +0x800f746f KEY_PLAYER +0x800f7480 KEY_BRIGHTNESSDOWN +0x800f7481 KEY_PLAYPAUSE diff --git a/packages/sysutils/v4l-utils/keymaps/xbox_dvd b/packages/sysutils/v4l-utils/keymaps/xbox_dvd new file mode 100644 index 0000000000..582c921c98 --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/xbox_dvd @@ -0,0 +1,28 @@ +# table xbox_dvd, type: unknown +0xa0b KEY_OK +0xaa6 KEY_UP +0xaa7 KEY_DOWN +0xaa8 KEY_RIGHT +0xaa9 KEY_LEFT +0xac3 KEY_INFO +0xac6 KEY_9 +0xac7 KEY_8 +0xac8 KEY_7 +0xac9 KEY_6 +0xaca KEY_5 +0xacb KEY_4 +0xacc KEY_3 +0xacd KEY_2 +0xace KEY_1 +0xacf KEY_0 +0xad5 KEY_ANGLE +0xad8 KEY_BACK +0xadd KEY_PREVIOUSSONG +0xadf KEY_NEXTSONG +0xae0 KEY_STOP +0xae2 KEY_REWIND +0xae3 KEY_FASTFORWARD +0xae5 KEY_TITLE +0xae6 KEY_PAUSE +0xaea KEY_PLAY +0xaf7 KEY_MENU diff --git a/packages/sysutils/v4l-utils/keymaps/xbox_one b/packages/sysutils/v4l-utils/keymaps/xbox_one new file mode 100644 index 0000000000..366a58c8f6 --- /dev/null +++ b/packages/sysutils/v4l-utils/keymaps/xbox_one @@ -0,0 +1,22 @@ +# table xbox_one, type: NEC +0x80d864 KEY_MEDIA +0x80d820 KEY_LEFT +0x80d821 KEY_RIGHT +0x80d81e KEY_UP +0x80d81f KEY_DOWN +0x80d822 KEY_OK +0x80d823 KEY_EXIT +0x80d80e KEY_MUTE +0x80d810 KEY_VOLUMEUP +0x80d811 KEY_VOLUMEDOWN +0x80d812 KEY_CHANNELUP +0x80d813 KEY_CHANNELDOWN +0x80d814 KEY_FASTFORWARD +0x80d815 KEY_REWIND +0x80d870 KEY_PLAYPAUSE +0x80d819 KEY_STOP +0x80d81a KEY_NEXT +0x80d81b KEY_PREVIOUS +0x80d826 KEY_INFO +0x80d86f KEY_EPG +0x80d86e KEY_ZOOM diff --git a/packages/sysutils/v4l-utils/package.mk b/packages/sysutils/v4l-utils/package.mk index 96c8a4180c..6e37014745 100644 --- a/packages/sysutils/v4l-utils/package.mk +++ b/packages/sysutils/v4l-utils/package.mk @@ -1,49 +1,106 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) # with 1.0.0 repeat delay is broken. test on upgrade PKG_NAME="v4l-utils" -PKG_VERSION="1.8.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.14.2" +PKG_SHA256="e6b962c4b1253cf852c31da13fd6b5bb7cbe5aa9e182881aec55123bae680692" PKG_LICENSE="GPL" PKG_SITE="http://linuxtv.org/" PKG_URL="http://linuxtv.org/downloads/v4l-utils/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="system" -PKG_SHORTDESC="v4l-utils: Linux V4L2 and DVB API utilities and v4l libraries (libv4l)." PKG_LONGDESC="Linux V4L2 and DVB API utilities and v4l libraries (libv4l)." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_CONFIGURE_OPTS_TARGET="--without-jpeg \ + --enable-static \ + --disable-shared" -PKG_CONFIGURE_OPTS_TARGET="--without-jpeg" -PKG_MAKEINSTALL_OPTS_TARGET="PREFIX=/usr -C utils/keytable" +pre_configure_target() { + # cec-ctl fails to build in subdirs + cd $PKG_BUILD + rm -rf .$TARGET_NAME +} make_target() { - make -C utils/keytable CFLAGS="$TARGET_CFLAGS" + make -C utils/keytable CFLAGS="$TARGET_CFLAGS" + make -C utils/ir-ctl CFLAGS="$TARGET_CFLAGS" + if [ "$CEC_FRAMEWORK_SUPPORT" = "yes" ]; then + make -C utils/cec-ctl CFLAGS="$TARGET_CFLAGS" + fi + make -C lib CFLAGS="$TARGET_CFLAGS" + make -C utils/dvb CFLAGS="$TARGET_CFLAGS" + make -C utils/v4l2-ctl CFLAGS="$TARGET_CFLAGS" +} + +makeinstall_target() { + make install DESTDIR=$INSTALL PREFIX=/usr -C utils/keytable + make install DESTDIR=$INSTALL PREFIX=/usr -C utils/ir-ctl + if [ "$CEC_FRAMEWORK_SUPPORT" = "yes" ]; then + make install DESTDIR=$INSTALL PREFIX=/usr -C utils/cec-ctl + fi + make install DESTDIR=$INSTALL PREFIX=/usr -C utils/dvb + make install DESTDIR=$INSTALL PREFIX=/usr -C utils/v4l2-ctl +} + +create_multi_keymap() { + local f name protocols + name="$1" + protocols="$2" + shift 2 + ( + echo "# table $name, type: $protocols" + for f in "$@" ; do + echo "# $f" + grep -v "^#" $INSTALL/usr/lib/udev/rc_keymaps/$f + done + ) > $INSTALL/usr/lib/udev/rc_keymaps/$name } post_makeinstall_target() { + local f keymap + rm -rf $INSTALL/etc/rc_keymaps ln -sf /storage/.config/rc_keymaps $INSTALL/etc/rc_keymaps mkdir -p $INSTALL/usr/config cp -PR $PKG_DIR/config/* $INSTALL/usr/config + + rm -rf $INSTALL/usr/lib/udev/rules.d + mkdir -p $INSTALL/usr/lib/udev/rules.d + cp -PR $PKG_DIR/udev.d/*.rules $INSTALL/usr/lib/udev/rules.d + + # install additional keymaps without overwriting upstream maps + ( + set -C + for f in $PKG_DIR/keymaps/* ; do + if [ -e $f ] ; then + keymap=$(basename $f) + cat $f > $INSTALL/usr/lib/udev/rc_keymaps/$keymap + fi + done + ) + + # create multi keymap to support several remotes OOTB + if [ -n "$IR_REMOTE_PROTOCOLS" -a -n "$IR_REMOTE_KEYMAPS" ]; then + create_multi_keymap libreelec_multi "$IR_REMOTE_PROTOCOLS" $IR_REMOTE_KEYMAPS + + # use multi-keymap instead of default one + sed -i '/^\*\s*rc-rc6-mce\s*rc6_mce/d' $INSTALL/etc/rc_maps.cfg + + cat << EOF >> $INSTALL/etc/rc_maps.cfg +# +# Custom LibreELEC configuration starts here +# +# use combined multi-table on MCE receivers +# * rc-rc6-mce rc6_mce +* rc-rc6-mce libreelec_multi +# table for Xbox DVD Playback Kit +* rc-xbox-dvd xbox_dvd +# multi-table for amlogic devices +meson-ir * libreelec_multi +EOF + + fi } diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-0001-fix-build-with-glibc_2.28.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-0001-fix-build-with-glibc_2.28.patch new file mode 100644 index 0000000000..851406f40f --- /dev/null +++ b/packages/sysutils/v4l-utils/patches/v4l-utils-0001-fix-build-with-glibc_2.28.patch @@ -0,0 +1,37 @@ +From a46598389950a9764399667c7d30f318c95ffd0a Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Wed, 1 Aug 2018 23:21:24 +0100 +Subject: [PATCH] fix build with glibc-2.28 + +--- + lib/libv4lconvert/control/libv4lcontrol.c | 1 + + utils/v4l2-ctl/v4l2-ctl.cpp | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c +index 1e784ed..1252847 100644 +--- a/lib/libv4lconvert/control/libv4lcontrol.c ++++ b/lib/libv4lconvert/control/libv4lcontrol.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp +index e02dc75..287114b 100644 +--- a/utils/v4l2-ctl/v4l2-ctl.cpp ++++ b/utils/v4l2-ctl/v4l2-ctl.cpp +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.14.1 + diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-11-fix_keytables_xbox360-0.1.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-11-fix_keytables_xbox360-0.1.patch deleted file mode 100644 index 481d17dead..0000000000 --- a/packages/sysutils/v4l-utils/patches/v4l-utils-11-fix_keytables_xbox360-0.1.patch +++ /dev/null @@ -1,73 +0,0 @@ -diff -rupN v4l-utils-0.8.3/utils/keytable/rc_keymaps/rc6_mce v4l-utils-0.8.3.patch/utils/keytable/rc_keymaps/rc6_mce ---- v4l-utils-0.8.3/utils/keytable/rc_keymaps/rc6_mce 2011-08-19 19:08:11.000000000 +0200 -+++ v4l-utils-0.8.3.patch/utils/keytable/rc_keymaps/rc6_mce 2011-09-22 21:50:44.000000000 +0200 -@@ -60,3 +60,69 @@ - 0x800f046f KEY_MEDIA - 0x800f0480 KEY_BRIGHTNESSDOWN - 0x800f0481 KEY_PLAYPAUSE -+#xbox360 remote -+0x800f7400 KEY_NUMERIC_0 -+0x800f7401 KEY_NUMERIC_1 -+0x800f7402 KEY_NUMERIC_2 -+0x800f7403 KEY_NUMERIC_3 -+0x800f7404 KEY_NUMERIC_4 -+0x800f7405 KEY_NUMERIC_5 -+0x800f7406 KEY_NUMERIC_6 -+0x800f7407 KEY_NUMERIC_7 -+0x800f7408 KEY_NUMERIC_8 -+0x800f7409 KEY_NUMERIC_9 -+0x800f740a KEY_DELETE -+0x800f740b KEY_ENTER -+0x800f740c KEY_SLEEP -+0x800f740d KEY_MEDIA -+0x800f7464 KEY_MEDIA -+0x800f740e KEY_MUTE -+0x800f740f KEY_INFO -+0x800f7410 KEY_VOLUMEUP -+0x800f7411 KEY_VOLUMEDOWN -+0x800f7412 KEY_CHANNELUP -+0x800f746C KEY_CHANNELUP -+0x800f7413 KEY_CHANNELDOWN -+0x800f746D KEY_CHANNELDOWN -+0x800f7414 KEY_FASTFORWARD -+0x800f7415 KEY_REWIND -+0x800f7416 KEY_PLAY -+0x800f7417 KEY_RECORD -+0x800f7418 KEY_PAUSE -+0x800f7419 KEY_STOP -+0x800f741a KEY_NEXT -+0x800f741b KEY_PREVIOUS -+0x800f741c KEY_NUMERIC_POUND -+0x800f741d KEY_NUMERIC_STAR -+0x800f741e KEY_UP -+0x800f741f KEY_DOWN -+0x800f7420 KEY_LEFT -+0x800f7421 KEY_RIGHT -+0x800f7422 KEY_OK -+0x800f7423 KEY_EXIT -+0x800f7424 KEY_DVD -+0x800f744f KEY_EPG -+0x800f7427 KEY_ZOOM -+0x800f7432 KEY_MODE -+0x800f7433 KEY_PRESENTATION -+0x800f7428 KEY_EJECTCD -+0x800f743a KEY_BRIGHTNESSUP -+0x800f7446 KEY_TV -+0x800f7447 KEY_AUDIO -+0x800f7448 KEY_PVR -+0x800f7449 KEY_CAMERA -+0x800f744a KEY_VIDEO -+0x800f744c KEY_LANGUAGE -+0x800f7451 KEY_TITLE -+0x800f744e KEY_PRINT -+0x800f7450 KEY_RADIO -+0x800f745a KEY_SUBTITLE -+0x800f7425 KEY_RED -+0x800f7466 KEY_GREEN -+0x800f7426 KEY_YELLOW -+0x800f7468 KEY_BLUE -+0x800f7465 KEY_POWER2 -+0x800f746e KEY_PLAYPAUSE -+0x800f746f KEY_PLAYER -+0x800f7480 KEY_BRIGHTNESSDOWN -+0x800f7481 KEY_PLAYPAUSE diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-12-add_zbox_ad10_support-0.1.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-12-add_zbox_ad10_support-0.1.patch deleted file mode 100644 index 6bf5d021b7..0000000000 --- a/packages/sysutils/v4l-utils/patches/v4l-utils-12-add_zbox_ad10_support-0.1.patch +++ /dev/null @@ -1,52 +0,0 @@ -diff -Naur v4l-utils-0.8.3/utils/keytable/rc_keymaps/rc6_mce v4l-utils-0.8.3.patch/utils/keytable/rc_keymaps/rc6_mce ---- v4l-utils-0.8.3/utils/keytable/rc_keymaps/rc6_mce 2013-09-22 13:54:18.609413831 +0200 -+++ v4l-utils-0.8.3.patch/utils/keytable/rc_keymaps/rc6_mce 2013-09-22 13:56:37.641651436 +0200 -@@ -126,3 +127,48 @@ - 0x800f746f KEY_PLAYER - 0x800f7480 KEY_BRIGHTNESSDOWN - 0x800f7481 KEY_PLAYPAUSE -+ -+#Zotac AD10 Remote -+0x8034048e KEY_POWER -+0x8034043d KEY_POWER -+0x80340400 KEY_NUMERIC_0 -+0x80340401 KEY_NUMERIC_1 -+0x80340402 KEY_NUMERIC_2 -+0x80340403 KEY_NUMERIC_3 -+0x80340404 KEY_NUMERIC_4 -+0x80340405 KEY_NUMERIC_5 -+0x80340406 KEY_NUMERIC_6 -+0x80340407 KEY_NUMERIC_7 -+0x80340408 KEY_NUMERIC_8 -+0x80340409 KEY_NUMERIC_9 -+0x80340432 KEY_NUMERIC_POUND -+0x80340433 KEY_NUMERIC_STAR -+0x8034043a KEY_DELETE -+0x80340434 KEY_ENTER -+0x8034045d KEY_MEDIA -+0x8034040d KEY_MUTE -+0x803404cb KEY_INFO -+0x80340410 KEY_VOLUMEUP -+0x80340411 KEY_VOLUMEDOWN -+0x8034041e KEY_CHANNELUP -+0x8034041f KEY_CHANNELDOWN -+0x80340428 KEY_FASTFORWARD -+0x80340429 KEY_REWIND -+0x8034042c KEY_PLAY -+0x80340437 KEY_RECORD -+0x80340430 KEY_PAUSE -+0x80340431 KEY_STOP -+0x80340420 KEY_NEXT -+0x80340421 KEY_PREVIOUS -+0x80340458 KEY_UP -+0x80340459 KEY_DOWN -+0x8034045a KEY_LEFT -+0x8034045b KEY_RIGHT -+0x8034045c KEY_OK -+0x80340483 KEY_EXIT -+0x8034043e KEY_EPG -+0x8034042f KEY_TITLE -+0x8034046d KEY_RED -+0x8034046e KEY_GREEN -+0x8034046f KEY_YELLOW -+0x80340470 KEY_BLUE diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-20-add_samsung_keytable.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-20-add_samsung_keytable.patch deleted file mode 100644 index bb64cc3ed2..0000000000 --- a/packages/sysutils/v4l-utils/patches/v4l-utils-20-add_samsung_keytable.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -Naur v4l-utils-1.8.1/utils/keytable/rc_keymaps/samsung v4l-utils-1.8.1.patch/utils/keytable/rc_keymaps/samsung ---- v4l-utils-1.8.1/utils/keytable/rc_keymaps/samsung 1970-01-01 01:00:00.000000000 +0100 -+++ v4l-utils-1.8.1.patch/utils/keytable/rc_keymaps/samsung 2015-11-18 12:21:30.202350149 +0100 -@@ -0,0 +1,31 @@ -+# table samsung, type: NEC -+0x43532f KEY_NUMERIC_0 -+0x435341 KEY_NUMERIC_1 -+0x435342 KEY_NUMERIC_2 -+0x435343 KEY_NUMERIC_3 -+0x435344 KEY_NUMERIC_4 -+0x435345 KEY_NUMERIC_5 -+0x435346 KEY_NUMERIC_6 -+0x435347 KEY_NUMERIC_7 -+0x43533f KEY_NUMERIC_8 -+0x435337 KEY_NUMERIC_9 -+0x435305 KEY_ENTER -+0x435300 KEY_TITLE -+0x435326 KEY_INFO -+0x435323 KEY_VOLUMEUP -+0x43532b KEY_VOLUMEDOWN -+0x435375 KEY_FASTFORWARD -+0x435374 KEY_REWIND -+0x43537d KEY_PLAYPAUSE -+0x43530b KEY_STOP -+0x435313 KEY_NEXT -+0x43531b KEY_PREVIOUS -+0x43530d KEY_UP -+0x435315 KEY_DOWN -+0x435325 KEY_LEFT -+0x43531d KEY_RIGHT -+0x435336 KEY_MENU -+0x43531c KEY_EXIT -+0x43530f KEY_ZOOM -+0x43530e KEY_SUBTITLE -+0x43537e KEY_BACK -diff -Naur v4l-utils-1.8.1/utils/keytable/rc_maps.cfg v4l-utils-1.8.1.patch/utils/keytable/rc_maps.cfg ---- v4l-utils-1.8.1/utils/keytable/rc_maps.cfg 2015-09-19 20:54:17.000000000 +0200 -+++ v4l-utils-1.8.1.patch/utils/keytable/rc_maps.cfg 2015-11-18 12:22:30.963487065 +0100 -@@ -112,6 +112,7 @@ - * rc-rc6-mce rc6_mce - * rc-real-audio-220-32-keys real_audio_220_32_keys - * rc-reddo reddo -+* rc-samsung samsung - * rc-snapstream-firefly snapstream_firefly - * rc-streamzap streamzap - * rc-su3000 su3000 diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-21-add-newer-hp-mce-remote.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-21-add-newer-hp-mce-remote.patch deleted file mode 100644 index 8de1498cca..0000000000 --- a/packages/sysutils/v4l-utils/patches/v4l-utils-21-add-newer-hp-mce-remote.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff --git a/utils/keytable/rc_keymaps/rc6_mce b/utils/keytable/rc_keymaps/rc6_mce -index d469845..c833a0c 100644 ---- a/utils/keytable/rc_keymaps/rc6_mce -+++ b/utils/keytable/rc_keymaps/rc6_mce -@@ -173,3 +173,69 @@ - 0x8034046e KEY_GREEN - 0x8034046f KEY_YELLOW - 0x80340470 KEY_BLUE -+ -+#HP MCE Remote -+0x80111200 KEY_NUMERIC_0 -+0x80111201 KEY_NUMERIC_1 -+0x80111202 KEY_NUMERIC_2 -+0x80111203 KEY_NUMERIC_3 -+0x80111204 KEY_NUMERIC_4 -+0x80111205 KEY_NUMERIC_5 -+0x80111206 KEY_NUMERIC_6 -+0x80111207 KEY_NUMERIC_7 -+0x80111208 KEY_NUMERIC_8 -+0x80111209 KEY_NUMERIC_9 -+0x80111256 KEY_DELETE -+0x8011125c KEY_ENTER -+0x801112a8 KEY_POWER -+0x801112a1 KEY_MEDIA -+0x8011120d KEY_MUTE -+0x80111281 KEY_INFO -+0x80111210 KEY_VOLUMEUP -+0x80111211 KEY_VOLUMEDOWN -+0x8011121e KEY_CHANNELUP -+0x8011121f KEY_CHANNELDOWN -+0x80111228 KEY_FASTFORWARD -+0x80111229 KEY_REWIND -+0x8011122c KEY_PLAY -+0x80111237 KEY_RECORD -+0x80111230 KEY_PAUSE -+0x7011126e KEY_PLAYPAUSE -+0x80111231 KEY_STOP -+0x80111220 KEY_NEXT -+0x80111221 KEY_PREVIOUS -+0x801112a2 KEY_NUMERIC_POUND -+0x801112ac KEY_NUMERIC_STAR -+0x80111258 KEY_UP -+0x80111259 KEY_DOWN -+0x8011125a KEY_LEFT -+0x8011125b KEY_RIGHT -+0x8011125c KEY_OK -+0x80111255 KEY_EXIT -+0x70111224 KEY_DVD -+0x80111292 KEY_TUNER -+0x801112cc KEY_EPG -+0x70111227 KEY_ZOOM -+0x7011123a KEY_BRIGHTNESSUP -+0x70111246 KEY_TV -+0x70111247 KEY_AUDIO -+0x801112a0 KEY_PVR -+0x70111249 KEY_CAMERA -+0x7011124a KEY_VIDEO -+0x7011124c KEY_LANGUAGE -+0x7011124d KEY_TITLE -+0x7011124e KEY_PRINT -+0x70111250 KEY_RADIO -+0x7011125a KEY_SUBTITLE -+0x801112e4 KEY_RED -+0x801112e5 KEY_GREEN -+0x801112e6 KEY_YELLOW -+0x801112e7 KEY_BLUE -+0x8011120c KEY_POWER2 -+0x7011126e KEY_PLAYPAUSE -+0x8011120b KEY_MEDIA -+0x70111280 KEY_BRIGHTNESSDOWN -+0x80111254 KEY_SETTINGS -+0x8011129f KEY_LASTSOURCE -+0x8011128b KEY_SOURCE -+0x801112a3 KEY_SCREEN diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-22-add-XBOX_One-remote.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-22-add-XBOX_One-remote.patch deleted file mode 100644 index db4f1206d9..0000000000 --- a/packages/sysutils/v4l-utils/patches/v4l-utils-22-add-XBOX_One-remote.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -Naur v4l-utils-0.8.9/utils/keytable/rc_keymaps/rc6_mce v4l-utils-0.8.9.patch/utils/keytable/rc_keymaps/rc6_mce ---- v4l-utils-0.8.9/utils/keytable/rc_keymaps/rc6_mce 2014-05-20 14:31:04.585559227 +0200 -+++ v4l-utils-0.8.9.patch/utils/keytable/rc_keymaps/rc6_mce 2014-05-20 17:47:04.341378915 +0200 -@@ -1,4 +1,4 @@ --# table rc6_mce, type: RC6 -+# table rc6_mce, type: RC6 NEC - 0x800f0400 KEY_NUMERIC_0 - 0x800f0401 KEY_NUMERIC_1 - 0x800f0402 KEY_NUMERIC_2 -@@ -239,3 +239,26 @@ - 0x8011129f KEY_LASTSOURCE - 0x8011128b KEY_SOURCE - 0x801112a3 KEY_SCREEN -+ -+#XBOX One Remote (Protocol: NEC) -+0x80d864 KEY_MEDIA -+0x80d820 KEY_LEFT -+0x80d821 KEY_RIGHT -+0x80d81e KEY_UP -+0x80d81f KEY_DOWN -+0x80d822 KEY_OK -+0x80d823 KEY_EXIT -+0x80d80e KEY_MUTE -+0x80d810 KEY_VOLUMEUP -+0x80d811 KEY_VOLUMEDOWN -+0x80d812 KEY_CHANNELUP -+0x80d813 KEY_CHANNELDOWN -+0x80d814 KEY_FASTFORWARD -+0x80d815 KEY_REWIND -+0x80d870 KEY_PLAYPAUSE -+0x80d819 KEY_STOP -+0x80d81a KEY_NEXT -+0x80d81b KEY_PREVIOUS -+0x80d826 KEY_INFO -+0x80d86f KEY_EPG -+0x80d86e KEY_ZOOM diff --git a/packages/sysutils/v4l-utils/patches/v4l-utils-23-add-cubox-i-remote.patch b/packages/sysutils/v4l-utils/patches/v4l-utils-23-add-cubox-i-remote.patch deleted file mode 100644 index abf9aaa067..0000000000 --- a/packages/sysutils/v4l-utils/patches/v4l-utils-23-add-cubox-i-remote.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -Nru a/utils/keytable/rc_keymaps/rc6_mce b/utils/keytable/rc_keymaps/rc6_mce ---- a/utils/keytable/rc_keymaps/rc6_mce 2015-02-17 12:25:15.452561904 +0200 -+++ b/utils/keytable/rc_keymaps/rc6_mce 2015-05-27 13:22:28.089766130 +0300 -@@ -262,3 +262,15 @@ - 0x80d826 KEY_INFO - 0x80d86f KEY_EPG - 0x80d86e KEY_ZOOM -+ -+#CuBox-i and HummingBoard remote control -+0x1f020b0 KEY_MEDIA -+0x1f02078 KEY_UP -+0x1f02044 KEY_ENTER -+0x1f020f8 KEY_DOWN -+0x1f02004 KEY_LEFT -+0x1f02084 KEY_RIGHT -+0x1f020c4 KEY_BACKSPACE -+0x1f02068 KEY_PLAYPAUSE -+0x1f02064 KEY_EPG -+ diff --git a/packages/sysutils/v4l-utils/udev.d/70-infrared.rules b/packages/sysutils/v4l-utils/udev.d/70-infrared.rules new file mode 100644 index 0000000000..26728303b3 --- /dev/null +++ b/packages/sysutils/v4l-utils/udev.d/70-infrared.rules @@ -0,0 +1,19 @@ + +# Automatically load the proper keymaps after the Remote Controller device +# creation. +# +# User-defined rules can be stored in /storage/.config/rc_maps.cfg. If that +# file doesn't exist the default rules from /etc/rc_maps.cfg are used. + +ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="rc", ENV{.rc_sysdev}="$id", GOTO="begin" +GOTO="end" + +LABEL="begin" + +ENV{.rc_maps_cfg}="/etc/rc_maps.cfg" +TEST=="/storage/.config/rc_maps.cfg", ENV{.rc_maps_cfg}="/storage/.config/rc_maps.cfg" + +RUN+="/usr/bin/ir-keytable -a $env{.rc_maps_cfg} -s $env{.rc_sysdev}" + +LABEL="end" + diff --git a/packages/sysutils/v4l-utils/udev.d/70-input-repeat.rules b/packages/sysutils/v4l-utils/udev.d/70-input-repeat.rules new file mode 100644 index 0000000000..541276b87d --- /dev/null +++ b/packages/sysutils/v4l-utils/udev.d/70-input-repeat.rules @@ -0,0 +1,18 @@ +ACTION=="add", SUBSYSTEM=="input", KERNEL=="event[0-9]*", GOTO="start" +GOTO="end" +LABEL="start" + +# don't change eventlircd device settings +ATTRS{name}=="eventlircd", GOTO="end" + +# don't change settings of rc remotes +SUBSYSTEMS=="rc", GOTO="end" + +# set default repeat delay to 500ms like rc remotes +RUN+="/usr/bin/ir-keytable --delay=500 --device=$devnode" + +# make lircd-uinput use same repeat period like keyboards in kodi +ATTRS{name}=="lircd-uinput", \ + RUN+="/usr/bin/ir-keytable --period=80 --device=$devnode" + +LABEL="end" diff --git a/packages/sysutils/v86d/package.mk b/packages/sysutils/v86d/package.mk index 24c6849b81..2a2355d494 100644 --- a/packages/sysutils/v86d/package.mk +++ b/packages/sysutils/v86d/package.mk @@ -1,41 +1,22 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="v86d" PKG_VERSION="0.1.10" -PKG_REV="1" +PKG_SHA256="634964ae18ef68c8493add2ce150e3b4502badeb0d9194b4bd81241d25e6735c" PKG_ARCH="x86_64" PKG_LICENSE="GPL" PKG_SITE="http://dev.gentoo.org/~spock/projects/uvesafb/" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_INIT="toolchain gcc:init" -PKG_SECTION="system" -PKG_SHORTDESC="v86d: A userspace helper that runs x86 code in an emulated environment." -PKG_LONGDESC="v86d is the userspace helper that runs x86 code in an emulated environment. uvesafb will not work without v86d. v86d currently supports the x86 and amd64 (x86-64) architectures." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -INIT_CONFIGURE_OPTS="--with-x86emu" +PKG_LONGDESC="v86d is the userspace helper that runs x86 code in an emulated environment." pre_configure_init() { + INIT_CONFIGURE_OPTS="--with-x86emu" + # v86d fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME-init } diff --git a/packages/testing/package.mk b/packages/testing/package.mk index 6a2229cf22..184070ee43 100644 --- a/packages/testing/package.mk +++ b/packages/testing/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="testing" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="various" PKG_SITE="http://www.openelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="virtual" -PKG_SHORTDESC="testing: Metapackage for various packages to test while developing" PKG_LONGDESC="testing: Metapackage for various packages to test while developing" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/textproc/expat/package.mk b/packages/textproc/expat/package.mk index cfe511d39f..0c51e0ed94 100644 --- a/packages/textproc/expat/package.mk +++ b/packages/textproc/expat/package.mk @@ -1,39 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="expat" -PKG_VERSION="2.2.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.2.5" +PKG_SHA256="d9dc32efba7e74f788fcc4f212a43216fc37cf5f23f4c2339664d473353aedf6" PKG_LICENSE="OSS" PKG_SITE="http://expat.sourceforge.net/" -PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="https://github.com/libexpat/libexpat/releases/download/R_${PKG_VERSION//./_}/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="textproc" -PKG_SHORTDESC="expat: XML parser library" -PKG_LONGDESC="Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). An introductory article on using Expat is available on xml.com." +PKG_LONGDESC="Expat is an XML parser library written in C." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_CMAKE_OPTS_TARGET="-DBUILD_doc=OFF -DBUILD_tools=OFF -DBUILD_examples=OFF -DBUILD_tests=OFF -DBUILD_shared=ON" +PKG_CMAKE_OPTS_HOST="-DBUILD_doc=OFF -DBUILD_tools=OFF -DBUILD_examples=OFF -DBUILD_tests=OFF -DBUILD_shared=ON" -PKG_CMAKE_OPTS_TARGET="-DBUILD_tools=OFF -DBUILD_examples=OFF -DBUILD_tests=OFF -DBUILD_shared=ON" - -pre_make_target() { - # fix builderror when building in subdirs - cp -r ../doc . -} diff --git a/packages/textproc/jsoncpp/config/CMakeLists.txt b/packages/textproc/jsoncpp/config/CMakeLists.txt deleted file mode 100644 index ffcfd8a5b2..0000000000 --- a/packages/textproc/jsoncpp/config/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -project(jsoncpp) - -cmake_minimum_required(VERSION 2.6) -enable_language(CXX) - -set(SOURCES src/lib_json/json_reader.cpp - src/lib_json/json_value.cpp - src/lib_json/json_writer.cpp) - -include_directories(${PROJECT_SOURCE_DIR}/include) - -add_library(jsoncpp ${SOURCES}) - -install(TARGETS jsoncpp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) -install(DIRECTORY include/json DESTINATION ${CMAKE_INSTALL_PREFIX}/include/jsoncpp) diff --git a/packages/textproc/jsoncpp/package.mk b/packages/textproc/jsoncpp/package.mk index c16e88fbbf..ddcf4e414b 100644 --- a/packages/textproc/jsoncpp/package.mk +++ b/packages/textproc/jsoncpp/package.mk @@ -1,40 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="jsoncpp" -PKG_VERSION="src-0.5.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.8.3" +PKG_SHA256="3671ba6051e0f30849942cc66d1798fdf0362d089343a83f704c09ee7156604f" PKG_LICENSE="GPL" -PKG_SITE="http://www.kodi.tv" -PKG_URL="http://sources.openelec.tv/mirror/jsoncpp/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/open-source-parsers/jsoncpp/" +PKG_URL="https://github.com/open-source-parsers/jsoncpp/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="multimedia" -PKG_SHORTDESC="jsoncpp" -PKG_LONGDESC="jsoncpp" +PKG_LONGDESC="A C++ library for interacting with JSON." +PKG_TOOLCHAIN="cmake" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} - -pre_build_target() { - cp $PKG_DIR/config/CMakeLists.txt $ROOT/$PKG_BUILD -} +PKG_CMAKE_OPTS_TARGET="-DJSONCPP_WITH_TESTS=OFF" diff --git a/packages/textproc/libidn2/package.mk b/packages/textproc/libidn2/package.mk new file mode 100644 index 0000000000..95e8b46f2b --- /dev/null +++ b/packages/textproc/libidn2/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libidn2" +PKG_VERSION="2.1.0" +PKG_SHA256="032398dbaa9537af43f51a8d94e967e3718848547b1b2a4eb3138b20cad11d32" +PKG_LICENSE="LGPL3" +PKG_SITE="https://www.gnu.org/software/libidn/" +PKG_URL="http://ftpmirror.gnu.org/gnu/libidn/libidn2-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Free software implementation of IDNA2008, Punycode and TR46." diff --git a/packages/textproc/libxml2/package.mk b/packages/textproc/libxml2/package.mk index 11b39262c4..c0a11893cf 100644 --- a/packages/textproc/libxml2/package.mk +++ b/packages/textproc/libxml2/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libxml2" -PKG_VERSION="2.9.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.9.8" +PKG_SHA256="0b74e51595654f958148759cfef0993114ddccccbb6f31aee018f3558e8e2732" PKG_LICENSE="MIT" PKG_SITE="http://xmlsoft.org" PKG_URL="ftp://xmlsoft.org/libxml2/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="toolchain zlib:host" +PKG_DEPENDS_HOST="zlib:host" PKG_DEPENDS_TARGET="toolchain zlib" -PKG_SECTION="textproc" -PKG_SHORTDESC="libxml: XML parser library for Gnome" -PKG_LONGDESC="The libxml package contains an XML library, which allows you to manipulate XML files. XML (eXtensible Markup Language) is a data format for structured document interchange via the Web." -PKG_IS_ADDON="no" - -PKG_AUTORECONF="no" +PKG_LONGDESC="The libxml package contains an XML library, which allows you to manipulate XML files." PKG_CONFIGURE_OPTS_ALL="ac_cv_header_ansidecl_h=no \ --enable-static \ @@ -38,15 +18,15 @@ PKG_CONFIGURE_OPTS_ALL="ac_cv_header_ansidecl_h=no \ --disable-silent-rules \ --enable-ipv6 \ --without-python \ - --with-zlib=$ROOT/$TOOLCHAIN \ + --with-zlib=$TOOLCHAIN \ --without-lzma" -PKG_CONFIGURE_OPTS_HOST="$PKG_CONFIGURE_OPTS_ALL --with-zlib=$ROOT/$TOOLCHAIN" +PKG_CONFIGURE_OPTS_HOST="$PKG_CONFIGURE_OPTS_ALL --with-zlib=$TOOLCHAIN" PKG_CONFIGURE_OPTS_TARGET="$PKG_CONFIGURE_OPTS_ALL --with-zlib=$SYSROOT_PREFIX/usr --with-sysroot=$SYSROOT_PREFIX" post_makeinstall_target() { - $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/xml2-config + sed -e "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/xml2-config rm -rf $INSTALL/usr/bin rm -rf $INSTALL/usr/lib/xml2Conf.sh diff --git a/packages/textproc/libxslt/package.mk b/packages/textproc/libxslt/package.mk index 081c8a7458..8bcadd1373 100644 --- a/packages/textproc/libxslt/package.mk +++ b/packages/textproc/libxslt/package.mk @@ -1,45 +1,28 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libxslt" -PKG_VERSION="1.1.29" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.1.32" +PKG_SHA256="526ecd0abaf4a7789041622c3950c0e7f2c4c8835471515fd77eec684a355460" PKG_LICENSE="MIT" PKG_SITE="http://xmlsoft.org/xslt/" PKG_URL="ftp://xmlsoft.org/libxml2/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="toolchain libxml2:host" +PKG_DEPENDS_HOST="libxml2:host" PKG_DEPENDS_TARGET="toolchain libxml2" -PKG_SECTION="textproc" -PKG_SHORTDESC="libxslt" -PKG_LONGDESC="libxslt" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A XSLT C library." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_HOST=" ac_cv_header_ansidecl_h=no \ + ac_cv_header_xlocale_h=no \ --enable-static \ --disable-shared \ --without-python \ - --with-libxml-prefix=$ROOT/$TOOLCHAIN \ + --with-libxml-prefix=$TOOLCHAIN \ --without-crypto" PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_ansidecl_h=no \ + ac_cv_header_xlocale_h=no \ --enable-static \ --disable-shared \ --without-python \ @@ -47,7 +30,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_ansidecl_h=no \ --without-crypto" post_makeinstall_target() { - $SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $SYSROOT_PREFIX/usr/bin/xslt-config + sed -e "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $SYSROOT_PREFIX/usr/bin/xslt-config rm -rf $INSTALL/usr/bin/xsltproc rm -rf $INSTALL/usr/lib/xsltConf.sh diff --git a/packages/textproc/nlohmann-json/package.mk b/packages/textproc/nlohmann-json/package.mk new file mode 100644 index 0000000000..66d76a7fda --- /dev/null +++ b/packages/textproc/nlohmann-json/package.mk @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="nlohmann-json" +PKG_VERSION="3.5.0" +PKG_SHA256="e0b1fc6cc6ca05706cce99118a87aca5248bd9db3113e703023d23f044995c1d" +PKG_LICENSE="MIT" +PKG_SITE="https://nlohmann.github.io/json/" +PKG_URL="https://github.com/nlohmann/json/archive/v$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="JSON for Modern C++" +PKG_TOOLCHAIN="cmake" + +PKG_CMAKE_OPTS_TARGET="-DBUILD_TESTING:BOOL=OFF" diff --git a/packages/textproc/rapidxml/package.mk b/packages/textproc/rapidxml/package.mk new file mode 100644 index 0000000000..6fcdecc22c --- /dev/null +++ b/packages/textproc/rapidxml/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rapidxml" +PKG_VERSION="1.13" +PKG_SHA256="c3f0b886374981bb20fabcf323d755db4be6dba42064599481da64a85f5b3571" +PKG_LICENSE="Boost/MIT" +PKG_SITE="https://sourceforge.net/projects/rapidxml/" +PKG_URL="https://sourceforge.net/projects/rapidxml/files/$PKG_NAME-$PKG_VERSION.zip" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="A fast XML DOM parser." +PKG_TOOLCHAIN="manual" + +post_unpack() { + mkdir -p $PKG_BUILD/rapidxml + mv $PKG_BUILD/*.hpp $PKG_BUILD/rapidxml +} diff --git a/packages/textproc/tinyxml/package.mk b/packages/textproc/tinyxml/package.mk index 07ddba5c72..afb9c5b447 100644 --- a/packages/textproc/tinyxml/package.mk +++ b/packages/textproc/tinyxml/package.mk @@ -1,41 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="tinyxml" PKG_VERSION="2.6.2_2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="8164c9ad48b9028667768a584d62f7760cfbfb90d0dd6214ad174403058da10c" PKG_LICENSE="OSS" PKG_SITE="http://www.grinninglizard.com/tinyxml/" PKG_URL="http://mirrors.xbmc.org/build-deps/sources/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="textproc" -PKG_SHORTDESC="tinyxml: XML parser library" -PKG_LONGDESC="TinyXML is a simple, small, C++ XML parser that can be easily integrating into other programs." +PKG_LONGDESC="TinyXML is a simple, small, C++ XML parser." +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-pic" post_makeinstall_target() { rm -rf $INSTALL/usr diff --git a/packages/textproc/tinyxml2/package.mk b/packages/textproc/tinyxml2/package.mk index b311c0a5a7..efd5247ba3 100644 --- a/packages/textproc/tinyxml2/package.mk +++ b/packages/textproc/tinyxml2/package.mk @@ -1,42 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="tinyxml2" PKG_VERSION="1.0.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="53a4dd1b3aed4aa05b18782e303646669d2d3b2de3c1919fe21aea319b44de7f" PKG_LICENSE="zlib" PKG_SITE="http://www.grinninglizard.com/tinyxml2/index.html" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="textproc" -PKG_SHORTDESC="tinyxml2: XML parser library" -PKG_LONGDESC="TinyXML2 is a simple, small, C++ XML parser that can be easily integrating into other programs." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="TinyXML2 is a simple, small, C++ XML parser." +PKG_BUILD_FLAGS="+pic" PKG_CMAKE_OPTS_TARGET="-DBUILD_SHARED_LIBS=off -DBUILD_STATIC_LIBS=on" -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} - post_makeinstall_target() { rm -rf $INSTALL/usr } diff --git a/packages/textproc/xmlstarlet/package.mk b/packages/textproc/xmlstarlet/package.mk index e940fe564a..78967bb28e 100644 --- a/packages/textproc/xmlstarlet/package.mk +++ b/packages/textproc/xmlstarlet/package.mk @@ -1,46 +1,25 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xmlstarlet" PKG_VERSION="1.6.1" -PKG_REV="0" -PKG_ARCH="any" +PKG_SHA256="15d838c4f3375332fd95554619179b69e4ec91418a3a5296e7c631b7ed19e7ca" PKG_LICENSE="MIT" PKG_SITE="http://xmlstar.sourceforge.net" PKG_URL="http://netcologne.dl.sourceforge.net/project/xmlstar/$PKG_NAME/$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_HOST="toolchain libxml2:host libxslt:host" +PKG_DEPENDS_HOST="libxml2:host libxslt:host" PKG_DEPENDS_TARGET="toolchain libxml2 libxslt" -PKG_SECTION="tools" -PKG_SHORTDESC="XMLStarlet is a command-line XML utility which allows the modification and validation of XML documents" -PKG_LONGDESC="XMLStarlet is a command line XML toolkit which can be used to transform,query, validate, and edit XML documents and files using simple set of shellcommands in similar way it is done for plain text files using grep/sed/awk/tr/diff/patch." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="XMLStarlet is a command-line XML utility which allows the modification and validation of XML documents." PKG_CONFIGURE_OPTS_HOST=" ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes \ --enable-static-libs \ - LIBXML_CONFIG=$ROOT/$TOOLCHAIN/bin/xml2-config \ - LIBXSLT_CONFIG=$ROOT/$TOOLCHAIN/bin/xslt-config \ - --with-libxml-include-prefix=$ROOT/$TOOLCHAIN/include/libxml2 \ - --with-libxml-libs-prefix=$ROOT/$TOOLCHAIN/lib \ - --with-libxslt-include-prefix=$ROOT/$TOOLCHAIN/include \ - --with-libxslt-libs-prefix=$ROOT/$TOOLCHAIN/lib" + LIBXML_CONFIG=$TOOLCHAIN/bin/xml2-config \ + LIBXSLT_CONFIG=$TOOLCHAIN/bin/xslt-config \ + --with-libxml-include-prefix=$TOOLCHAIN/include/libxml2 \ + --with-libxml-libs-prefix=$TOOLCHAIN/lib \ + --with-libxslt-include-prefix=$TOOLCHAIN/include \ + --with-libxslt-libs-prefix=$TOOLCHAIN/lib" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes \ @@ -53,7 +32,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ --with-libxslt-libs-prefix=$SYSROOT_PREFIX/usr/lib" post_makeinstall_host() { - ln -sf xml $ROOT/$TOOLCHAIN/bin/xmlstarlet + ln -sf xml $TOOLCHAIN/bin/xmlstarlet } post_makeinstall_target() { diff --git a/packages/tools/aml-dtbtools/package.mk b/packages/tools/aml-dtbtools/package.mk new file mode 100644 index 0000000000..8e21b9bbeb --- /dev/null +++ b/packages/tools/aml-dtbtools/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="aml-dtbtools" +PKG_VERSION="cce100f" +PKG_SHA256="8bcaa83fcc9e85c9c04930e7411447d96a97da0809c5ecd9af91c8b554133c41" +PKG_LICENSE="free" +PKG_SITE="https://github.com/Wilhansen/aml-dtbtools" +PKG_URL="https://github.com/Wilhansen/aml-dtbtools/archive/${PKG_VERSION}.tar.gz" +PKG_LONGDESC="AML DTB Tools" + +PKG_MAKE_OPTS_HOST="dtbTool" + +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp dtbTool $TOOLCHAIN/bin +} diff --git a/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt b/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt index 7f31059135..e65df78b30 100644 --- a/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt +++ b/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/config.txt @@ -1,19 +1,5 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) ################################################################################ # Bootloader configuration - config.txt ################################################################################ diff --git a/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/distroconfig.txt b/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/distroconfig.txt index 7b3c713751..a97398937a 100644 --- a/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/distroconfig.txt +++ b/packages/tools/bcm2835-bootloader/files/3rdparty/bootloader/distroconfig.txt @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING! diff --git a/packages/tools/bcm2835-bootloader/package.mk b/packages/tools/bcm2835-bootloader/package.mk index f2a8f0500a..74b43d51b1 100644 --- a/packages/tools/bcm2835-bootloader/package.mk +++ b/packages/tools/bcm2835-bootloader/package.mk @@ -1,42 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bcm2835-bootloader" -PKG_VERSION="6df93de" -PKG_REV="1" +PKG_VERSION="d095b96ac33de9eb4b95539cb3261f35a3c74509" +PKG_SHA256="45fc65720e5792813a3c29ddab9da32d821020fae3b9076eecb184c73c6866d0" PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain linux" -PKG_SECTION="tools" -PKG_SHORTDESC="bcm2835-bootloader: Tool to create a bootable kernel for RaspberryPi" +PKG_DEPENDS_TARGET="toolchain linux bcmstat" PKG_LONGDESC="bcm2835-bootloader: Tool to create a bootable kernel for RaspberryPi" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - if [ -f $DISTRO_DIR/$DISTRO/config/dt-blob.dts ]; then - echo Compiling device tree blob - $(kernel_path)/scripts/dtc/dtc -O dtb -o dt-blob.bin $DISTRO_DIR/$DISTRO/config/dt-blob.dts - fi -} +PKG_TOOLCHAIN="manual" makeinstall_target() { mkdir -p $INSTALL/usr/share/bootloader @@ -44,19 +19,11 @@ makeinstall_target() { cp -PRv bootcode.bin $INSTALL/usr/share/bootloader cp -PRv fixup_x.dat $INSTALL/usr/share/bootloader/fixup.dat cp -PRv start_x.elf $INSTALL/usr/share/bootloader/start.elf - [ -f dt-blob.bin ] && cp -PRv dt-blob.bin $INSTALL/usr/share/bootloader/dt-blob.bin - cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader + find_file_path config/dt-blob.bin && cp -PRv $FOUND_PATH $INSTALL/usr/share/bootloader - if [ -f $DISTRO_DIR/$DISTRO/config/distroconfig.txt ]; then - cp -PRv $DISTRO_DIR/$DISTRO/config/distroconfig.txt $INSTALL/usr/share/bootloader - else - cp -PRv $PKG_DIR/files/3rdparty/bootloader/distroconfig.txt $INSTALL/usr/share/bootloader - fi + cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader - if [ -f $DISTRO_DIR/$DISTRO/config/config.txt ]; then - cp -PRv $DISTRO_DIR/$DISTRO/config/config.txt $INSTALL/usr/share/bootloader - else - cp -PRv $PKG_DIR/files/3rdparty/bootloader/config.txt $INSTALL/usr/share/bootloader - fi + find_file_path config/distroconfig.txt $PKG_DIR/files/3rdparty/bootloader/distroconfig.txt && cp -PRv ${FOUND_PATH} $INSTALL/usr/share/bootloader + find_file_path config/config.txt $PKG_DIR/files/3rdparty/bootloader/config.txt && cp -PRv ${FOUND_PATH} $INSTALL/usr/share/bootloader } diff --git a/packages/tools/bcm2835-bootloader/release b/packages/tools/bcm2835-bootloader/release index 577d4b473b..fbf9e5c545 100755 --- a/packages/tools/bcm2835-bootloader/release +++ b/packages/tools/bcm2835-bootloader/release @@ -1,32 +1,23 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. config/options $1 +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) mkdir -p $RELEASE_DIR/3rdparty/bootloader cp -PR $BUILD/bcm2835-bootloader-*/LICENCE* $RELEASE_DIR/3rdparty/bootloader/ cp -PR $BUILD/bcm2835-bootloader-*/bootcode.bin $RELEASE_DIR/3rdparty/bootloader/ cp -PR $BUILD/bcm2835-bootloader-*/fixup_x.dat $RELEASE_DIR/3rdparty/bootloader/fixup.dat cp -PR $BUILD/bcm2835-bootloader-*/start_x.elf $RELEASE_DIR/3rdparty/bootloader/start.elf - [ -f $BUILD/bcm2835-bootloader-*/dt-blob.bin ] && cp -PR $BUILD/bcm2835-bootloader-*/dt-blob.bin $RELEASE_DIR/3rdparty/bootloader/ + if [ -f $(get_build_dir slice-firmware)/dt-blob.bin ]; then + cp -PR $(get_build_dir slice-firmware)/dt-blob.bin $RELEASE_DIR/3rdparty/bootloader/ + fi cp -PR $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/ cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/ - cp -PR $INSTALL/usr/share/bootloader/config.txt $RELEASE_DIR/3rdparty/bootloader/ - cp -PR $INSTALL/usr/share/bootloader/distroconfig.txt $RELEASE_DIR/3rdparty/bootloader/ + + if [ -f $INSTALL/usr/share/bootloader/config.txt ]; then + cp -PR $INSTALL/usr/share/bootloader/config.txt $RELEASE_DIR/3rdparty/bootloader/ + fi + if [ -f $INSTALL/usr/share/bootloader/distroconfig.txt ]; then + cp -PR $INSTALL/usr/share/bootloader/distroconfig.txt $RELEASE_DIR/3rdparty/bootloader/ + fi diff --git a/packages/tools/bcm2835-bootloader/scripts/update.sh b/packages/tools/bcm2835-bootloader/scripts/update.sh index 6ee3917146..ead9443504 100755 --- a/packages/tools/bcm2835-bootloader/scripts/update.sh +++ b/packages/tools/bcm2835-bootloader/scripts/update.sh @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) [ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" [ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" @@ -34,6 +19,7 @@ cp -p $SYSTEM_ROOT/usr/share/bootloader/start.elf $BOOT_ROOT [ -f $SYSTEM_ROOT/usr/share/bootloader/dt-blob.bin ] && cp -p $SYSTEM_ROOT/usr/share/bootloader/dt-blob.bin $BOOT_ROOT + rm -f $BOOT_ROOT/bcm283*.dtb # cleanup excess dtb's used by upstream kernels (ie. not LE) cp -p $SYSTEM_ROOT/usr/share/bootloader/*.dtb $BOOT_ROOT cp -pR $SYSTEM_ROOT/usr/share/bootloader/overlays $BOOT_ROOT diff --git a/packages/tools/bcmstat/package.mk b/packages/tools/bcmstat/package.mk new file mode 100644 index 0000000000..b10315fa80 --- /dev/null +++ b/packages/tools/bcmstat/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="bcmstat" +PKG_VERSION="0.5.1" +PKG_SHA256="88b3b189170e7d0eee83a233565d9ef0fb323489dc1161ef2392fca50e9637d6" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/MilhouseVH/bcmstat" +PKG_URL="https://github.com/MilhouseVH/$PKG_NAME/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="Raspberry Pi monitoring script" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -PRv bcmstat.sh $INSTALL/usr/bin + chmod +x $INSTALL/usr/bin/* +} diff --git a/packages/tools/dtc/package.mk b/packages/tools/dtc/package.mk index a5587316c0..e943d3e790 100644 --- a/packages/tools/dtc/package.mk +++ b/packages/tools/dtc/package.mk @@ -1,38 +1,41 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="dtc" -PKG_VERSION="1.4.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.4.5" +PKG_SHA256="cfb9394690ebec1e4f942ee0c3b863b660eb0c4ef85bab19429f30c3469a3415" PKG_LICENSE="GPL" -PKG_SITE="https://git.kernel.org/cgit/utils/dtc/dtc.git" -PKG_URL="https://git.kernel.org/cgit/utils/dtc/dtc.git/snapshot/$PKG_VERSION.tar.xz" -PKG_SOURCE_DIR="$PKG_VERSION" +PKG_SITE="https://git.kernel.org/pub/scm/utils/dtc/dtc.git/" +PKG_URL="https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/$PKG_VERSION.tar.gz" +PKG_DEPENDS_HOST="Python2:host swig:host" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="The Device Tree Compiler" PKG_LONGDESC="The Device Tree Compiler" -PKG_AUTORECONF="no" -PKG_MAKE_OPTS_TARGET="dtc" +PKG_MAKE_OPTS_HOST="dtc libfdt" +PKG_MAKE_OPTS_TARGET="dtc fdtput fdtget libfdt" + +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp -P $PKG_BUILD/dtc $TOOLCHAIN/bin + cp -P $PKG_BUILD/libfdt/libfdt.so $TOOLCHAIN/lib/ +} + +post_makeinstall_host() { + python ./pylibfdt/setup.py build_ext --inplace + python ./pylibfdt/setup.py install --prefix=$TOOLCHAIN + + touch $TOOLCHAIN/lib/$PKG_PYTHON_VERSION/site-packages/pylibfdt/__init__.py +} + +pre_make_target() { + make clean BIN= +} makeinstall_target() { mkdir -p $INSTALL/usr/bin - cp -P $ROOT/$PKG_BUILD/dtc $INSTALL/usr/bin + cp -P $PKG_BUILD/dtc $INSTALL/usr/bin + cp -P $PKG_BUILD/fdtput $INSTALL/usr/bin/ + cp -P $PKG_BUILD/fdtget $INSTALL/usr/bin/ + mkdir -p $INSTALL/usr/lib + cp -P $PKG_BUILD/libfdt/libfdt.so $INSTALL/usr/lib/ } diff --git a/packages/tools/dtc/patches/dtc-0001-libfdt-soname-version.patch b/packages/tools/dtc/patches/dtc-0001-libfdt-soname-version.patch new file mode 100644 index 0000000000..e79f54b7a3 --- /dev/null +++ b/packages/tools/dtc/patches/dtc-0001-libfdt-soname-version.patch @@ -0,0 +1,12 @@ +diff -Naur a/Makefile b/Makefile +--- a/Makefile 2017-03-09 16:17:23.000000000 -0800 ++++ b/Makefile 2017-05-31 16:04:29.052439734 -0700 +@@ -134,7 +134,7 @@ + LIBFDT_objdir = libfdt + LIBFDT_srcdir = libfdt + LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a +-LIBFDT_lib = $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) ++LIBFDT_lib = $(LIBFDT_objdir)/libfdt.$(SHAREDLIB_EXT) + LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES)) + LIBFDT_version = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_VERSION)) + diff --git a/packages/tools/dtc/patches/dtc-0002-fix-format-errors.patch b/packages/tools/dtc/patches/dtc-0002-fix-format-errors.patch new file mode 100644 index 0000000000..0976e6e971 --- /dev/null +++ b/packages/tools/dtc/patches/dtc-0002-fix-format-errors.patch @@ -0,0 +1,43 @@ +From 497432fd2131967f349e69dc5d259072151cc4b4 Mon Sep 17 00:00:00 2001 +From: Thierry Reding +Date: Wed, 27 Sep 2017 15:04:09 +0200 +Subject: checks: Use proper format modifier for size_t + +The size of size_t can vary between architectures, so using %ld isn't +going to work on 32-bit builds. Use the %zu modifier to make sure it is +always correct. + +Signed-off-by: Thierry Reding +Acked-by: Rob Herring +Signed-off-by: David Gibson +--- + checks.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +(limited to 'checks.c') + +diff --git a/checks.c b/checks.c +index 902f2e3..08a3a29 100644 +--- a/checks.c ++++ b/checks.c +@@ -972,7 +972,7 @@ static void check_property_phandle_args(struct check *c, + int cell, cellsize = 0; + + if (prop->val.len % sizeof(cell_t)) { +- FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %ld in node %s", ++ FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s", + prop->name, prop->val.len, sizeof(cell_t), node->fullpath); + return; + } +@@ -1163,7 +1163,7 @@ static void check_interrupts_property(struct check *c, + return; + + if (irq_prop->val.len % sizeof(cell_t)) +- FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %ld in node %s", ++ FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s", + irq_prop->name, irq_prop->val.len, sizeof(cell_t), + node->fullpath); + +-- +cgit v1.1 + diff --git a/packages/tools/grub/package.mk b/packages/tools/grub/package.mk new file mode 100755 index 0000000000..9c660e855d --- /dev/null +++ b/packages/tools/grub/package.mk @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="grub" +PKG_VERSION="2.02" +PKG_SHA256="4ff6999add483bf640e130bc076ca1464901b4677ee01297901b40fe55de03c4" +PKG_ARCH="x86_64" +PKG_LICENSE="GPLv3" +PKG_SITE="https://www.gnu.org/software/grub/index.html" +PKG_URL="http://git.savannah.gnu.org/cgit/grub.git/snapshot/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain flex freetype:host" +PKG_LONGDESC="GRUB is a Multiboot boot loader." +PKG_TOOLCHAIN="configure" + +pre_configure_target() { + PKG_CONFIGURE_OPTS_TARGET="--target=i386-pc-linux \ + --disable-nls \ + --with-platform=efi" + + unset CFLAGS + unset CPPFLAGS + unset CXXFLAGS + unset LDFLAGS + unset CPP + + cd $PKG_BUILD + ./autogen.sh +} + +make_target() { + make CC=$CC \ + AR=$AR \ + RANLIB=$RANLIB \ + CFLAGS="-I$SYSROOT_PREFIX/usr/include -fomit-frame-pointer -D_FILE_OFFSET_BITS=64" \ + LDFLAGS="-L$SYSROOT_PREFIX/usr/lib" +} + +makeinstall_target() { + cd $PKG_BUILD/grub-core + $PKG_BUILD/grub-mkimage -d . -o bootia32.efi -O i386-efi -p /EFI/BOOT \ + boot chain configfile ext2 fat linux search \ + efi_gop efi_uga part_gpt gzio \ + gettext loadenv loadbios memrw + + mkdir -p $INSTALL/usr/share/grub + cp -P $PKG_BUILD/grub-core/bootia32.efi $INSTALL/usr/share/grub + + mkdir -p $TOOLCHAIN/share/grub + cp -P $PKG_BUILD/grub-core/bootia32.efi $TOOLCHAIN/share/grub +} diff --git a/packages/tools/grub/patches/001-gcc8-fix-packed-not-aligned.patch b/packages/tools/grub/patches/001-gcc8-fix-packed-not-aligned.patch new file mode 100644 index 0000000000..51ee7dc86c --- /dev/null +++ b/packages/tools/grub/patches/001-gcc8-fix-packed-not-aligned.patch @@ -0,0 +1,72 @@ +From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Mon, 26 Mar 2018 16:52:34 +0800 +Subject: Fix packed-not-aligned error on GCC 8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When building with GCC 8, there are several errors regarding packed-not-aligned. + +./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned] + +This patch fixes the build error by cleaning up the ambiguity of placing +aligned structure in a packed one. In "struct grub_btrfs_time" and "struct +grub_gpt_part_type", the aligned attribute seems to be superfluous, and also +has to be packed, to ensure the structure is bit-to-bit mapped to the format +laid on disk. I think we could blame to copy and paste error here for the +mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as +the name suggests. :) + +Signed-off-by: Michael Chang +Tested-by: Michael Chang +Tested-by: Paul Menzel +Reviewed-by: Daniel Kiper +--- + grub-core/fs/btrfs.c | 2 +- + include/grub/efiemu/runtime.h | 2 +- + include/grub/gpt_partition.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 4849c1c..be19544 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -175,7 +175,7 @@ struct grub_btrfs_time + { + grub_int64_t sec; + grub_uint32_t nanosec; +-} __attribute__ ((aligned (4))); ++} GRUB_PACKED; + + struct grub_btrfs_inode + { +diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h +index 9b6b729..36d2ded 100644 +--- a/include/grub/efiemu/runtime.h ++++ b/include/grub/efiemu/runtime.h +@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel + + struct efi_variable + { +- grub_efi_guid_t guid; ++ grub_efi_packed_guid_t guid; + grub_uint32_t namelen; + grub_uint32_t size; + grub_efi_uint32_t attributes; +diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h +index 1b32f67..9668a68 100644 +--- a/include/grub/gpt_partition.h ++++ b/include/grub/gpt_partition.h +@@ -28,7 +28,7 @@ struct grub_gpt_part_type + grub_uint16_t data2; + grub_uint16_t data3; + grub_uint8_t data4[8]; +-} __attribute__ ((aligned(8))); ++} GRUB_PACKED; + typedef struct grub_gpt_part_type grub_gpt_part_type_t; + + #define GRUB_GPT_PARTITION_TYPE_EMPTY \ +-- +cgit v1.0-41-gc330 + diff --git a/packages/tools/hdparm/package.mk b/packages/tools/hdparm/package.mk index 880e0a9e6f..908b2549b1 100644 --- a/packages/tools/hdparm/package.mk +++ b/packages/tools/hdparm/package.mk @@ -1,37 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="hdparm" -PKG_VERSION="9.49" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="9.56" +PKG_SHA256="6ff9ed695f1017396eec4101f990f114b7b0e0a04c5aa6369c0394053d16e4da" PKG_LICENSE="BSD" PKG_SITE="http://sourceforge.net/projects/hdparm/" PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="tools" -PKG_SHORTDESC="hdparm: Get/set hard disk parameters" PKG_LONGDESC="Shell utility to access/tune ioctl features of the Linux IDE driver and IDE drives." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - makeinstall_target() { mkdir -p $INSTALL/usr/sbin - cp -a $ROOT/$PKG_BUILD/hdparm $INSTALL/usr/sbin + cp -a $PKG_BUILD/hdparm $INSTALL/usr/sbin } diff --git a/packages/tools/hdparm/udev.d/61-cdrom.rules b/packages/tools/hdparm/udev.d/61-cdrom.rules index 2979ba4fd2..eb6c8b38bb 100644 --- a/packages/tools/hdparm/udev.d/61-cdrom.rules +++ b/packages/tools/hdparm/udev.d/61-cdrom.rules @@ -1,24 +1,12 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # only do anything on block devices which are not removed ACTION!="add|change", GOTO="cdrom_end" +# /dev/sr, /dev/sr_mod, /dev/srcutree are not valid +KERNEL=="sr|sr_mod|srcutree", GOTO="cdrom_end" + # set CDROM speed KERNEL=="sr*", RUN+="/sbin/hdparm -E8 /dev/%k" diff --git a/packages/tools/imx6-mfgtool2-tbs-matrix/package.mk b/packages/tools/imx6-mfgtool2-tbs-matrix/package.mk deleted file mode 100644 index 784669a687..0000000000 --- a/packages/tools/imx6-mfgtool2-tbs-matrix/package.mk +++ /dev/null @@ -1,39 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="imx6-mfgtool2-tbs-matrix" -PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="GPL" -PKG_SITE="http://sourceforge.net/projects/matrixtv/" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.zip" -PKG_DEPENDS_TARGET="" -PKG_SECTION="tools" -PKG_SHORTDESC="MfgTool2 flash tool" -PKG_LONGDESC="Freescales manufacturing tool for flashing image to TBS Matrix system" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing -} - -makeinstall_target() { - : # install from image script -} diff --git a/packages/tools/installer/config/installer.conf b/packages/tools/installer/config/installer.conf index 64779362aa..7f0fd56e67 100644 --- a/packages/tools/installer/config/installer.conf +++ b/packages/tools/installer/config/installer.conf @@ -1,20 +1,6 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) + # Disklabel for System and Storage partition DISKLABEL_SYSTEM="System" DISKLABEL_STORAGE="Storage" @@ -25,8 +11,8 @@ # Default starting offset for system partition, in sectors (1 sector = 512B), eg. 2048 PARTSIZE_SYSTEM_OFFSET="@SYSTEM_PART_START@" -# additional parameters to extlinux - EXTLINUX_PARAMETERS="@EXTLINUX_PARAMETERS@" +# additional parameters to syslinux + SYSLINUX_PARAMETERS="@SYSLINUX_PARAMETERS@" # enable BIOS update function BIOS_UPDATE="no" diff --git a/packages/tools/installer/package.mk b/packages/tools/installer/package.mk index a7f52f449b..6125d76624 100644 --- a/packages/tools/installer/package.mk +++ b/packages/tools/installer/package.mk @@ -1,43 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="installer" PKG_VERSION="1" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://libreelec.tv/" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain busybox newt parted e2fsprogs syslinux" -PKG_SECTION="tools" -PKG_SHORTDESC="installer: LibreELEC.tv Install manager" +PKG_DEPENDS_TARGET="toolchain busybox newt parted e2fsprogs syslinux grub" PKG_LONGDESC="LibreELEC.tv Install manager to install the system on any disk" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to make here -} - -makeinstall_target() { - : # nothing to install here -} +PKG_TOOLCHAIN="manual" post_install() { mkdir -p $INSTALL/usr/bin @@ -46,14 +17,11 @@ post_install() { -i $INSTALL/usr/bin/installer mkdir -p $INSTALL/etc - if [ -f $PROJECT_DIR/$PROJECT/installer/installer.conf ]; then - cp $PROJECT_DIR/$PROJECT/installer/installer.conf $INSTALL/etc - else - cp $PKG_DIR/config/installer.conf $INSTALL/etc - fi + find_file_path config/installer.conf + cp ${FOUND_PATH} $INSTALL/etc sed -e "s/@SYSTEM_SIZE@/$SYSTEM_SIZE/g" \ -e "s/@SYSTEM_PART_START@/$SYSTEM_PART_START/g" \ - -e "s/@EXTLINUX_PARAMETERS@/$EXTLINUX_PARAMETERS/g" \ + -e "s/@SYSLINUX_PARAMETERS@/$SYSLINUX_PARAMETERS/g" \ -i $INSTALL/etc/installer.conf enable_service installer.service diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index abca27aae8..9e166eafd7 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -1,22 +1,8 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # some DOCs: @@ -24,18 +10,18 @@ # cat /proc/partitions | sed -n "s/\ *[0-9][0-9]*\ *[0-9][0-9]*\ *[0-9][0-9]*\ \([a-z]*\)$/\1/p" # list all partitionnumbers from /dev/sda: -# parted -m /dev/sda print |grep -v ^/dev |grep -v ^BYT | cut -f1 -d ":" +# parted -m /dev/sda print | grep -v ^/dev | grep -v ^BYT | cut -f1 -d ":" # list device data from /dev/sda: -# parted -m /dev/sda print |grep /dev/sda +# parted -m /dev/sda print | grep /dev/sda # list mounted partitions: -# mount |grep ^/dev +# mount | grep ^/dev # list modelnumber: -# parted -m /dev/sda print |grep /dev/sda | cut -f7 -d ":" | sed "s/;//" +# parted -m /dev/sda print | grep /dev/sda | cut -f7 -d ":" | sed "s/;//" # list size: -# parted -m /dev/sda print |grep /dev/sda | cut -f2 -d ":" +# parted -m /dev/sda print | grep /dev/sda | cut -f2 -d ":" # exclude mounted partitions # for i in `cat /proc/mounts | grep ^/dev/ | cut -f1 -d " " | sed "s/[0-9]//"`; do TEST="$TEST `echo "| grep -v $i"`"; done @@ -55,6 +41,36 @@ dbglg() { echo "" >> $LOGFILE } +log_system_status() { + echo "# cat /proc/mounts" + cat /proc/mounts + echo + + echo "# df" + df + echo + + echo "# df -h" + df -h + echo + + echo "# parted -s -m -l" + parted -s -m -l + echo + + echo "# blkid" + blkid + echo + + echo "# UEFI (if directory exists)" + ls -la /sys/firmware/efi + echo + + echo "# Disk sizes (bytes)" + grep . /sys/block/*/size + echo +} + get_device_unmount() { # get all unmounted devices # usage: get_devices_unmount @@ -65,15 +81,15 @@ get_device_unmount() { DEVICES=$(parted -s -m -l 2>/dev/null | grep -E '^/dev/sd|^/dev/mmcblk|^/dev/nvme' | grep -E -v '.?rpmb|.?boot?' | cut -f1 -d ":") for i in $(cat /proc/mounts | grep -E '^/dev/sd' | cut -f1 -d " " | sed "s/[0-9].*$//"); do - DEVICES=$(echo $DEVICES |sed -e "s|$i||") + DEVICES=$(echo $DEVICES | sed -e "s|$i||") done for i in $(cat /proc/mounts | grep -E '^/dev/mmcblk' | cut -f1 -d " " | sed "s/p.*$//"); do - DEVICES=$(echo $DEVICES |sed -e "s|$i||") + DEVICES=$(echo $DEVICES | sed -e "s|$i||") done for i in $(cat /proc/mounts | grep -E '^/dev/nvme' | cut -f1 -d " " | sed "s/p.*$//"); do - DEVICES=$(echo $DEVICES |sed -e "s|$i||") + DEVICES=$(echo $DEVICES | sed -e "s|$i||") done } @@ -83,7 +99,7 @@ get_partition() { # uses: - # provides: PARTITIONS - PARTITIONS=$(parted -s -m $1 print |grep -v ^/dev |grep -v BYT | cut -f1 -d ":") + PARTITIONS=$(parted -s -m $1 print | grep -v ^/dev | grep -v BYT | cut -f1 -d ":") } create_device_list() { @@ -102,6 +118,7 @@ create_device_list() { if [ "$DEVICES" = "" ]; then msg_no_device + return 1 fi for i in $DEVICES; do @@ -110,6 +127,7 @@ create_device_list() { DEVICE_NAME=$(echo $DEVICE_MODEL ${DEVICE_SIZE} | sed 's/ /_/g') DEVICE_LIST="$DEVICE_LIST $i $DEVICE_NAME" done + return 0 } do_install_quick() { @@ -118,229 +136,198 @@ do_install_quick() { MSG_MENU="\nUse the up/down arrows to select the device you wish to install to.\n\nPlease select a device:" MSG_CANCEL="Back" - create_device_list + create_device_list || return whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ - $DIALOG_OPTIONS --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ - $DEVICE_LIST 2> $TMPDIR/device_for_install + $DIALOG_OPTIONS --title "$MSG_TITLE" --menu "$MSG_MENU" 20 50 5 \ + $DEVICE_LIST 2> $TMPDIR/device_for_install + [ $? -ne 0 ] && return # now we must do everything - case $? in - 0) - INSTALL_DEVICE=$(cat "$TMPDIR/device_for_install") - INSTALL_DEVICE_FULL=$(echo $DEVICE_LIST | sed "s|.*$INSTALL_DEVICE \([^ ]*\).*|$INSTALL_DEVICE \1|") - - case $INSTALL_DEVICE in - "/dev/mmcblk"*|"/dev/nvme"*) - PART1="p1" - PART2="p2" - ;; - *) - PART1="1" - PART2="2" - ;; - esac + INSTALL_DEVICE=$(cat "$TMPDIR/device_for_install") + INSTALL_DEVICE_FULL=$(echo $DEVICE_LIST | sed "s|.*$INSTALL_DEVICE \([^ ]*\).*|$INSTALL_DEVICE \1|") - prompt_gpt - prompt_backup_unpack - - # check for confirmation (twice!) - MSG_TITLE="Confirmation before installing" - MSG_DETAIL="\nIf you continue the contents of the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n" - DIALOG_OPTIONS="--defaultno" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ - $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 - if [ $? -ne 0 ]; then - menu_main - fi - - MSG_TITLE="Confirmation before installing" - MSG_DETAIL="\nThis is last chance to abort the installation!\n\nIf you continue the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n\n" - DIALOG_OPTIONS="--defaultno" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ - $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 - if [ $? -ne 0 ]; then - menu_main - fi - - # start the progress bar (whiptail --gauge) - { - # remove all partitions - msg_progress_install "1" "Get all partitions $INSTALL_DEVICE" - get_partition $INSTALL_DEVICE - - msg_progress_install "5" "Wiping disk $INSTALL_DEVICE" - dd if=/dev/zero of=$INSTALL_DEVICE bs=4096 count=1024 2>>$LOGFILE - - # create 2 new partitions (first $PARTSIZE_SYSTEM, second rest) - msg_progress_install "7" "Creating label on $INSTALL_DEVICE" - if [ "$GPT" = "1" ]; then - parted -s $INSTALL_DEVICE mklabel gpt >> $LOGFILE 2>&1 - else - parted -s $INSTALL_DEVICE mklabel msdos >> $LOGFILE 2>&1 - fi - - msg_progress_install "9" "Writing Master Boot Record on $INSTALL_DEVICE" - if [ "$GPT" = "1" ]; then - cat /usr/share/syslinux/gptmbr.bin > $INSTALL_DEVICE - else - cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE - fi - - partsize_system_start=$PARTSIZE_SYSTEM_OFFSET - partsize_system_end=$(((PARTSIZE_SYSTEM * 1024 * 1024 / 512) + partsize_system_start)) - partsize_storage_start=$((partsize_system_end + 2048)) - partsize_storage_end=-1024 - - msg_progress_install "10" "Creating partition on $INSTALL_DEVICE" - if [ "$UEFI" = "1" ]; then - parted -s $INSTALL_DEVICE unit s mkpart primary fat32 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 - else - parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 - fi - - msg_progress_install "13" "Creating partition on $INSTALL_DEVICE" - parted -s $INSTALL_DEVICE unit s mkpart primary ext2 -- $partsize_storage_start $partsize_storage_end >> $LOGFILE 2>&1 - - msg_progress_install "16" "Setup bootflag on partition 1 of $INSTALL_DEVICE" - parted -s $INSTALL_DEVICE set 1 boot on >> $LOGFILE 2>&1 - if [ "$GPT" = "1" ]; then - parted -s $INSTALL_DEVICE set 1 legacy_boot on >> $LOGFILE 2>&1 - fi - - msg_progress_install "20" "Tell the kernel we have a new partitiontable on $INSTALL_DEVICE" - partprobe $INSTALL_DEVICE >> $LOGFILE 2>&1 - - # create filesystem - msg_progress_install "23" "Creating filesystem on ${INSTALL_DEVICE}1" - if [ "$UEFI" = "1" ]; then - mkfs.vfat ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - else - mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - fi - - msg_progress_install "25" "Set uuid and disklabel $DISKLABEL_SYSTEM on ${INSTALL_DEVICE}${PART1}" - if [ "$UEFI" = "1" ]; then - dosfslabel ${INSTALL_DEVICE}${PART1} $DISKLABEL_SYSTEM >> $LOGFILE 2>&1 - else - tune2fs -U random -L $DISKLABEL_SYSTEM ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - fi - - msg_progress_install "28" "Creating filesystem on ${INSTALL_DEVICE}${PART2}" - mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 - - msg_progress_install "30" "Set uuid and disklabel $DISKLABEL_STORAGE on ${INSTALL_DEVICE}${PART2}" - tune2fs -U random -L $DISKLABEL_STORAGE ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 - - # mount system partition - msg_progress_install "35" "Creating $TMPDIR/part1" - mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "40" "Mounting ${INSTALL_DEVICE}${PART1} to $TMPDIR/part1" - if [ "$UEFI" = "1" ]; then - mount -t vfat ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 - else - mount -t ext4 ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 - fi - - # installing extlinux - if [ "$UEFI" = "1" ]; then - msg_progress_install "50" "Installing syslinux to $TMPDIR/part1" - syslinux -i ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 - else - msg_progress_install "50" "Installing extlinux to $TMPDIR/part1" - extlinux -i $TMPDIR/part1 >> $LOGFILE 2>&1 - fi - - # install system files - msg_progress_install "60" "Installing Kernel" - cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "65" "Installing System" - cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 - sync - - # configuring bootloader - msg_progress_install "80" "Setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE" - echo "DEFAULT linux" > $TMPDIR/part1/extlinux.conf - echo "PROMPT 0" >> $TMPDIR/part1/extlinux.conf - echo " " >> $TMPDIR/part1/extlinux.conf - echo "LABEL linux" >> $TMPDIR/part1/extlinux.conf - echo " KERNEL /KERNEL" >> $TMPDIR/part1/extlinux.conf - echo " APPEND boot=LABEL=$DISKLABEL_SYSTEM disk=LABEL=$DISKLABEL_STORAGE $EXTLINUX_PARAMETERS quiet" >> $TMPDIR/part1/extlinux.conf - # uefi boot / hybrid mode - if [ "$UEFI" = "1" ]; then - mv $TMPDIR/part1/extlinux.conf $TMPDIR/part1/syslinux.cfg - mkdir -p $TMPDIR/part1/EFI/BOOT - cp $TMPDIR/part1/syslinux.cfg $TMPDIR/part1/EFI/BOOT - cp /usr/share/syslinux/bootx64.efi $TMPDIR/part1/EFI/BOOT - cp /usr/share/syslinux/ldlinux.e64 $TMPDIR/part1/EFI/BOOT - fi - sync - - # umount system partition, remove mountpoint - msg_progress_install "85" "Unmount $TMPDIR/part1" - umount $TMPDIR/part1 >> $LOGFILE 2>&1 - - msg_progress_install "87" "Remove $TMPDIR/part1" - rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 - - if [ "$BACKUP_UNPACK" = "1" ]; then - # mount storage partition - msg_progress_install "89" "Creating $TMPDIR/part2" - mkdir -p $TMPDIR/part2 >> $LOGFILE 2>&1 - - msg_progress_install "90" "Mounting ${INSTALL_DEVICE}${PART2} to $TMPDIR/part2" - mount -t ext4 ${INSTALL_DEVICE}${PART2} $TMPDIR/part2 >> $LOGFILE 2>&1 - - msg_progress_install "92" "Restoring backup" - [ -f /flash/backup.tar.bz2 ] && tar -xjf /flash/backup.tar.bz2 -C $TMPDIR/part2 >> $LOGFILE 2>&1 - [ -f /flash/backup.zip ] && unzip -qq /flash/backup.zip -d $TMPDIR/part2 >> $LOGFILE 2>&1 - sync - - # umount system partition, remove mountpoint - msg_progress_install "97" "Unmount $TMPDIR/part2" - umount $TMPDIR/part2 >> $LOGFILE 2>&1 - - msg_progress_install "100" "Remove $TMPDIR/part2" - rmdir $TMPDIR/part2 >> $LOGFILE 2>&1 - fi - } | whiptail --backtitle "$BACKTITLE" --gauge "Please wait while your system is being setup ..." 6 73 0 - - # install complete - MSG_TITLE="@DISTRONAME@ Install Complete" - MSG_DETAIL="You may now remove the install media and reboot.\n" - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 7 52 - - menu_main - ;; - 1) - menu_main + case $INSTALL_DEVICE in + "/dev/mmcblk"*|"/dev/nvme"*) + PART1="p1" + PART2="p2" ;; - 255) - do_poweroff + *) + PART1="1" + PART2="2" ;; esac + + prompt_gpt + prompt_backup_unpack + + # check for confirmation (twice!) + MSG_TITLE="Confirmation before installing" + MSG_DETAIL="\nIf you continue the contents of the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n" + DIALOG_OPTIONS="--defaultno" + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ + $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 + [ $? -ne 0 ] && return + + MSG_TITLE="Confirmation before installing" + MSG_DETAIL="\nThis is last chance to abort the installation!\n\nIf you continue the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n\n" + DIALOG_OPTIONS="--defaultno" + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" \ + $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0 + [ $? -ne 0 ] && return + + # start the progress bar (whiptail --gauge) + { + # remove all partitions + msg_progress_install "1" "Get all partitions $INSTALL_DEVICE" + get_partition $INSTALL_DEVICE + + msg_progress_install "5" "Wiping disk $INSTALL_DEVICE" + dd if=/dev/zero of=$INSTALL_DEVICE bs=4096 count=1024 2>>$LOGFILE + + # create 2 new partitions (first $PARTSIZE_SYSTEM, second rest) + msg_progress_install "7" "Creating label on $INSTALL_DEVICE" + if [ "$GPT" = "1" ]; then + parted -s $INSTALL_DEVICE mklabel gpt >> $LOGFILE 2>&1 + else + parted -s $INSTALL_DEVICE mklabel msdos >> $LOGFILE 2>&1 + fi + + msg_progress_install "9" "Writing Master Boot Record on $INSTALL_DEVICE" + if [ "$GPT" = "1" ]; then + cat /usr/share/syslinux/gptmbr.bin > $INSTALL_DEVICE + else + cat /usr/share/syslinux/mbr.bin > $INSTALL_DEVICE + fi + + partsize_system_start=$PARTSIZE_SYSTEM_OFFSET + partsize_system_end=$(((PARTSIZE_SYSTEM * 1024 * 1024 / 512) + partsize_system_start - 1)) + partsize_storage_start=$((partsize_system_end + 1)) + partsize_storage_end=-1024 + + msg_progress_install "10" "Creating partition on $INSTALL_DEVICE" + parted -s $INSTALL_DEVICE unit s mkpart primary fat32 -- $partsize_system_start $partsize_system_end >> $LOGFILE 2>&1 + + msg_progress_install "13" "Creating partition on $INSTALL_DEVICE" + parted -s $INSTALL_DEVICE unit s mkpart primary ext4 -- $partsize_storage_start $partsize_storage_end >> $LOGFILE 2>&1 + + msg_progress_install "16" "Setup bootflag on partition 1 of $INSTALL_DEVICE" + parted -s $INSTALL_DEVICE set 1 boot on >> $LOGFILE 2>&1 + if [ "$GPT" = "1" ]; then + parted -s $INSTALL_DEVICE set 1 legacy_boot on >> $LOGFILE 2>&1 + fi + + msg_progress_install "20" "Tell the kernel we have a new partition table on $INSTALL_DEVICE" + partprobe $INSTALL_DEVICE >> $LOGFILE 2>&1 + + # create filesystem + msg_progress_install "23" "Creating filesystem on ${INSTALL_DEVICE}1" + mkfs.vfat ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 + + msg_progress_install "25" "Set uuid and disklabel $DISKLABEL_SYSTEM on ${INSTALL_DEVICE}${PART1}" + dosfslabel ${INSTALL_DEVICE}${PART1} $DISKLABEL_SYSTEM >> $LOGFILE 2>&1 + + msg_progress_install "28" "Creating filesystem on ${INSTALL_DEVICE}${PART2}" + mke2fs -t ext4 -m 0 ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 + + msg_progress_install "30" "Set uuid and disklabel $DISKLABEL_STORAGE on ${INSTALL_DEVICE}${PART2}" + tune2fs -U random -L $DISKLABEL_STORAGE ${INSTALL_DEVICE}${PART2} >> $LOGFILE 2>&1 + + UUID_SYSTEM="$(blkid --output udev ${INSTALL_DEVICE}${PART1} | grep ^ID_FS_UUID= | cut -d= -f2)" + UUID_STORAGE="$(blkid --output udev ${INSTALL_DEVICE}${PART2} | grep ^ID_FS_UUID= | cut -d= -f2)" + + echo "" >> $LOGFILE + echo "UUID_SYSTEM : ${UUID_SYSTEM}" >> $LOGFILE + echo "UUID_STORAGE: ${UUID_STORAGE}" >> $LOGFILE + + # mount system partition + msg_progress_install "35" "Creating $TMPDIR/part1" + mkdir -p $TMPDIR/part1 >> $LOGFILE 2>&1 + + msg_progress_install "40" "Mounting ${INSTALL_DEVICE}${PART1} to $TMPDIR/part1" + mount -t vfat ${INSTALL_DEVICE}${PART1} $TMPDIR/part1 >> $LOGFILE 2>&1 + + # installing syslinux + msg_progress_install "50" "Installing syslinux to $TMPDIR/part1" + syslinux -i ${INSTALL_DEVICE}${PART1} >> $LOGFILE 2>&1 + + # install system files + msg_progress_install "60" "Installing Kernel" + cp /flash/KERNEL $TMPDIR/part1 >> $LOGFILE 2>&1 + + msg_progress_install "65" "Installing System" + cp /flash/SYSTEM $TMPDIR/part1 >> $LOGFILE 2>&1 + sync + + # configuring bootloader + msg_progress_install "80" "Setup bootloader with boot label = $DISKLABEL_SYSTEM and disk label = $DISKLABEL_STORAGE" + mkdir -p $TMPDIR/part1/EFI/BOOT + cat << EOF > $TMPDIR/part1/syslinux.cfg +DEFAULT linux +PROMPT 0 + +LABEL linux + KERNEL /KERNEL + APPEND boot=UUID=$UUID_SYSTEM disk=UUID=$UUID_STORAGE $SYSLINUX_PARAMETERS quiet +EOF + + cat << EOF > $TMPDIR/part1/EFI/BOOT/grub.cfg +set timeout="0" +set default="LibreELEC" + +menuentry "LibreELEC" { + search --set -f /KERNEL + linux /KERNEL boot=UUID=$UUID_SYSTEM disk=UUID=$UUID_STORAGE quiet } +EOF -msg_no_device() { - # show a warning dialog if we dont find not mounted devices for install and return to main menu - MSG_TITLE="WARNING" - MSG_INFOBOX=" No devices were found. " + # uefi boot / hybrid mode + cp /usr/share/syslinux/bootx64.efi $TMPDIR/part1/EFI/BOOT + cp /usr/share/syslinux/ldlinux.e64 $TMPDIR/part1/EFI/BOOT + cp /usr/share/grub/bootia32.efi $TMPDIR/part1/EFI/BOOT + sync - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 73 + # umount system partition, remove mountpoint + msg_progress_install "85" "Unmount $TMPDIR/part1" + umount $TMPDIR/part1 >> $LOGFILE 2>&1 - menu_main + msg_progress_install "87" "Remove $TMPDIR/part1" + rmdir $TMPDIR/part1 >> $LOGFILE 2>&1 + + if [ "$BACKUP_UNPACK" = "1" ]; then + # mount storage partition + msg_progress_install "89" "Creating $TMPDIR/part2" + mkdir -p $TMPDIR/part2 >> $LOGFILE 2>&1 + + msg_progress_install "90" "Mounting ${INSTALL_DEVICE}${PART2} to $TMPDIR/part2" + mount -t ext4 ${INSTALL_DEVICE}${PART2} $TMPDIR/part2 >> $LOGFILE 2>&1 + + msg_progress_install "92" "Restoring backup" + [ -f /flash/backup.tar.bz2 ] && tar -xjf /flash/backup.tar.bz2 -C $TMPDIR/part2 >> $LOGFILE 2>&1 + [ -f /flash/backup.zip ] && unzip -qq /flash/backup.zip -d $TMPDIR/part2 >> $LOGFILE 2>&1 + sync + + # umount system partition, remove mountpoint + msg_progress_install "97" "Unmount $TMPDIR/part2" + umount $TMPDIR/part2 >> $LOGFILE 2>&1 + + msg_progress_install "100" "Remove $TMPDIR/part2" + rmdir $TMPDIR/part2 >> $LOGFILE 2>&1 + fi + } | whiptail --backtitle "$BACKTITLE" --gauge "Please wait while your system is being setup ..." 6 73 0 + + # install complete + MSG_TITLE="@DISTRONAME@ Install Complete" + MSG_DETAIL="You may now remove the install media and reboot.\n" + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 7 52 } -msg_target_space() { - # show an error dialog for missing space - MSG_TITLE="TARGET SPACE" - MSG_INFOBOX="Not enough target space!\nInstallation aborted.\n" +msg_no_device() { + # show a warning dialog if we dont find not mounted devices for install and return to main menu + MSG_TITLE="WARNING" + MSG_INFOBOX=" No devices were found. " whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 9 73 - - menu_main } msg_progress_install() { @@ -354,19 +341,11 @@ msg_progress_install() { echo XXX } -msg_install_ready() { - # show a dialog that we have installed - MSG_TITLE="INFORMATION" - - whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox " $1" 7 73 - - menu_main -} - prompt_gpt() { GPT="0" UEFI="0" # Get size in GB. + # 2^41 bytes is the DOS limit (2199023255552 bytes, 2.2TB). Use GUID Partition Table.>= 2200GB INSTALL_DEVICE_SIZE=$(($(cat /sys/block/${INSTALL_DEVICE#/dev/}/size)*512/1000/1000/1000)) if [ "$INSTALL_DEVICE_SIZE" -ge 2200 ] 2>/dev/null; then GPT="1" @@ -407,18 +386,20 @@ out during the installation. \ MSG_CANCEL="Close" whiptail --backtitle "$BACKTITLE" --cancel-button "$MSG_CANCEL" \ - --title "$MSG_TITLE" --menu "$MSG_MENU" 18 73 3 \ + --title "$MSG_TITLE" --menu "$MSG_MENU" 18 73 4 \ 1 "Install @DISTRONAME@" \ - 2 "Installation log" \ - 3 "Reboot" 2> $TMPDIR/mainmenu + 2 "View installation log" \ + 3 "Save installation log" \ + 4 "Reboot" 2> $TMPDIR/mainmenu case $? in 0) ITEM_MAINMENU=$(cat "$TMPDIR/mainmenu") case $ITEM_MAINMENU in - 1) do_install_quick; break;; - 2) logfile_show; break;; - 3) do_reboot; + 1) do_install_quick;; + 2) logfile_show;; + 3) logfile_save;; + 4) do_reboot;; esac ;; 1) @@ -432,8 +413,20 @@ out during the installation. \ logfile_show() { whiptail --textbox "$LOGFILE" 20 73 --scrolltext --backtitle "$BACKTITLE" - clear - menu_main +} + +logfile_save() { + mount -o remount,rw /flash + + mkdir -p $(dirname $LOGBACKUP) + cp $LOGFILE $LOGBACKUP + sync + + mount -o remount,ro /flash + + MSG_TITLE="@DISTRONAME@ Log Saved" + MSG_DETAIL="Log location: ${LOGBACKUP}\n" + whiptail --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_DETAIL" 7 52 } do_reboot() { @@ -456,6 +449,7 @@ BACKTITLE="@DISTRONAME@ Installer - $OS_VERSION" TMPDIR="/tmp/installer" LOGFILE="$TMPDIR/install.log" +LOGBACKUP="/flash/logs/$(date +%Y%m%d%H%M%S).log" export COLORTERM="1" export NEWT_COLORS="$WHIPTAIL_COLORS" @@ -468,6 +462,9 @@ mkdir -p $TMPDIR echo "@DISTRONAME@ Installer - $OS_VERSION started at:" > $LOGFILE date >> $LOGFILE +dbglg "System status" +log_system_status >> $LOGFILE 2>&1 + # generate the en_US.UTF-8 locale to enable line drawing mkdir -p $TMPDIR/locale localedef -i en_US -f UTF-8 $TMPDIR/locale/en_US.UTF-8 diff --git a/packages/tools/led_tools/package.mk b/packages/tools/led_tools/package.mk new file mode 100644 index 0000000000..838eaa827f --- /dev/null +++ b/packages/tools/led_tools/package.mk @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2014 Gordon Hollingworth (gordon@fiveninjas.com) + +PKG_NAME="led_tools" +PKG_VERSION="0.1" +PKG_SHA256="0484b4a2da9d586accef87ba7dd18595baae1d602c1b1bd9e0a8565ab50419a2" +PKG_LICENSE="GPL" +PKG_SITE="http://www.fiveninjas.com" +PKG_URL="http://updates.fiveninjas.com/src/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain zlib libpng slice-addon" +PKG_DEPENDS_HOST="toolchain" +PKG_LONGDESC="LED tools, these are a set of tools to control the LEDs on Slice" + +make_target() { + make CC="$CC" \ + CFLAGS="$CFLAGS" \ + LDFLAGS="$LDFLAGS" +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp led_png $INSTALL/usr/bin +} diff --git a/packages/tools/mkbootimg/package.mk b/packages/tools/mkbootimg/package.mk index faa422297a..0b9d83a380 100644 --- a/packages/tools/mkbootimg/package.mk +++ b/packages/tools/mkbootimg/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="mkbootimg" PKG_VERSION="6668fc2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="d84870e055414d638a3e7eb4b7a3ebf415899841218f24cb3647d06ecf6ddb17" PKG_LICENSE="GPL" PKG_SITE="https://android.googlesource.com/platform/system/core/+/master/mkbootimg/" PKG_URL="https://github.com/codesnake/mkbootimg/archive/$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="" -PKG_SECTION="tools" -PKG_SHORTDESC="mkbootimg: Creates kernel boot images for Android" PKG_LONGDESC="mkbootimg: Creates kernel boot images for Android" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - makeinstall_host() { mkdir -p $SYSROOT_PREFIX/usr/include - cp mkbootimg $ROOT/$TOOLCHAIN/bin/ + cp mkbootimg $TOOLCHAIN/bin/ } diff --git a/packages/tools/mtools/package.mk b/packages/tools/mtools/package.mk index d6668d276a..099488fbc7 100644 --- a/packages/tools/mtools/package.mk +++ b/packages/tools/mtools/package.mk @@ -1,31 +1,12 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="mtools" PKG_VERSION="4.0.18" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="59e9cf80885399c4f229e5d87e49c0c2bfeec044e1386d59fcd0b0aead6b2f85" PKG_LICENSE="GPL" PKG_SITE="http://www.gnu.org/software/mtools/" PKG_URL="http://ftpmirror.gnu.org/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_HOST="" -PKG_SECTION="tools" -PKG_SHORTDESC="mtools: A collection of utilities to access MS-DOS disks" PKG_LONGDESC="mtools: A collection of utilities to access MS-DOS disks" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" diff --git a/packages/tools/nano/package.mk b/packages/tools/nano/package.mk index 3a451557c2..6a0d663f31 100644 --- a/packages/tools/nano/package.mk +++ b/packages/tools/nano/package.mk @@ -1,39 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="nano" -PKG_VERSION="2.5.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.0" +PKG_SHA256="e0a5bca354514e64762c987c200a8758b05e7bcced3b00b3e48ea0a2d383c8a0" PKG_LICENSE="GPL" PKG_SITE="http://www.nano-editor.org/" -PKG_URL="http://ftpmirror.gnu.org/nano/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses" -PKG_SECTION="shell/texteditor" -PKG_SHORTDESC="nano: Pico editor clone with enhancements" -PKG_LONGDESC="GNU nano (Nano's ANOther editor, or Not ANOther editor) is an enhanced clone of the Pico text editor." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_URL="http://ftpmirror.gnu.org/nano/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_LONGDESC="Nano is an enhanced clone of the Pico text editor." PKG_CONFIGURE_OPTS_TARGET="--disable-utf8 \ --disable-nls \ - --disable-libmagic" + --disable-libmagic \ + --disable-wrapping" post_makeinstall_target() { rm -rf $INSTALL/usr/share/nano diff --git a/packages/tools/nano/profile.d/52-nano.conf b/packages/tools/nano/profile.d/52-nano.conf index 8b9bd9ea6e..e5fddf678a 100644 --- a/packages/tools/nano/profile.d/52-nano.conf +++ b/packages/tools/nano/profile.d/52-nano.conf @@ -1,24 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ -# Core (EDITOR) environment variable. -# -# This file contains non-OpenELEC evironment variables as well as OpenELEC -# evironment variables that are not user defined. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) export EDITOR="nano" diff --git a/packages/tools/newt/package.mk b/packages/tools/newt/package.mk index 15d1edc354..f1fe68fd8b 100644 --- a/packages/tools/newt/package.mk +++ b/packages/tools/newt/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="newt" -PKG_VERSION="0.52.19" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.52.20" +PKG_SHA256="8d66ba6beffc3f786d4ccfee9d2b43d93484680ef8db9397a4fb70b5adbb6dbc" PKG_LICENSE="GPL" -PKG_SITE="https://fedorahosted.org/newt/" -PKG_URL="https://fedorahosted.org/releases/n/e/newt/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_SITE="https://pagure.io/newt" +PKG_URL="https://releases.pagure.org/newt/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain slang popt" -PKG_SECTION="tools" -PKG_SHORTDESC="newt: A programming library for color text mode, widget based user interfaces" -PKG_LONGDESC="Newt is a programming library for color text mode, widget based user interfaces. Newt can be used to add stacked windows, entry widgets, checkboxes, radio buttons, labels, plain text fields, scrollbars, etc., to text mode user interfaces. Newt is based on the S-Lang library." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="Newt is a programming library for color text mode, widget based user interfaces." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ --without-python \ @@ -37,13 +17,12 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-nls \ pre_configure_target() { # newt fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME } pre_configure_host() { # newt fails to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$HOST_NAME } - diff --git a/packages/tools/plymouth-lite/package.mk b/packages/tools/plymouth-lite/package.mk index 3dcedf6e25..98d05d8b7e 100644 --- a/packages/tools/plymouth-lite/package.mk +++ b/packages/tools/plymouth-lite/package.mk @@ -1,43 +1,22 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="plymouth-lite" PKG_VERSION="0.6.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="fa7b581bdd38c5751668243ff9d2ebaee7c45753358cbb310fb50cfcd3a8081b" PKG_LICENSE="GPL" PKG_SITE="http://www.meego.com" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_INIT="toolchain gcc:init libpng" -PKG_SECTION="tools" -PKG_SHORTDESC="plymouth-lite: Boot splash screen based on Fedora's Plymouth code" PKG_LONGDESC="Boot splash screen based on Fedora's Plymouth code" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - if [ "$UVESAFB_SUPPORT" = yes ]; then PKG_DEPENDS_INIT="$PKG_DEPENDS_INIT v86d:init" fi pre_configure_init() { # plymouth-lite dont support to build in subdirs - cd $ROOT/$PKG_BUILD + cd $PKG_BUILD rm -rf .$TARGET_NAME-init } @@ -46,17 +25,6 @@ makeinstall_init() { cp ply-image $INSTALL/usr/bin mkdir -p $INSTALL/splash - if [ -f $PROJECT_DIR/$PROJECT/splash/splash.conf ]; then - cp $PROJECT_DIR/$PROJECT/splash/splash.conf $INSTALL/splash - cp $PROJECT_DIR/$PROJECT/splash/*.png $INSTALL/splash - elif ls $PROJECT_DIR/$PROJECT/splash/splash-*.png 1>/dev/null 2>&1; then - cp $PROJECT_DIR/$PROJECT/splash/splash-*.png $INSTALL/splash - elif [ -f $DISTRO_DIR/$DISTRO/splash/splash.conf ]; then - cp $DISTRO_DIR/$DISTRO/splash/splash.conf $INSTALL/splash - cp $DISTRO_DIR/$DISTRO/splash/*.png $INSTALL/splash - elif ls $DISTRO_DIR/$DISTRO/splash/splash-*.png 1>/dev/null 2>&1; then - cp $DISTRO_DIR/$DISTRO/splash/splash-*.png $INSTALL/splash - else - cp $PKG_DIR/splash/splash-*.png $INSTALL/splash - fi + find_file_path splash/splash.conf && cp ${FOUND_PATH} $INSTALL/splash + find_file_path "splash/splash-*.png" && cp ${FOUND_PATH} $INSTALL/splash } diff --git a/packages/tools/plymouth-lite/patches/plymouth-lite-0.6.0-31-bilinear-interpolation.patch b/packages/tools/plymouth-lite/patches/plymouth-lite-0.6.0-31-bilinear-interpolation.patch new file mode 100644 index 0000000000..bfbddd375f --- /dev/null +++ b/packages/tools/plymouth-lite/patches/plymouth-lite-0.6.0-31-bilinear-interpolation.patch @@ -0,0 +1,113 @@ +From 6a1141b74e6a7f3a1c2240d348a9fcda25f32169 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 16 May 2016 17:28:48 +0200 +Subject: [PATCH] bilinear interpolation + +--- + ply-image.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 60 insertions(+), 5 deletions(-) + +diff --git a/ply-image.c b/ply-image.c +index 291b9ce..48644d8 100644 +--- a/ply-image.c ++++ b/ply-image.c +@@ -296,6 +296,59 @@ ply_image_get_height (ply_image_t *image) + return image->height; + } + ++static inline uint32_t ++ply_image_interpolate (ply_image_t *image, ++ double x, ++ double y) ++{ ++ int ix; ++ int iy; ++ int width; ++ int height; ++ ++ int i; ++ ++ int offset_x; ++ int offset_y; ++ uint32_t pixels[2][2]; ++ uint32_t reply = 0; ++ ++ width = image->width; ++ height = image->height; ++ ++ for (offset_y = 0; offset_y < 2; offset_y++) ++ { ++ for (offset_x = 0; offset_x < 2; offset_x++) ++ { ++ ix = x + offset_x; ++ iy = y + offset_y; ++ ++ if (ix < 0 || ix >= width || iy < 0 || iy >= height) ++ pixels[offset_y][offset_x] = 0x00000000; ++ else ++ pixels[offset_y][offset_x] = image->layout.as_pixels[ix + iy * width]; ++ } ++ } ++ if (!pixels[0][0] && !pixels[0][1] && !pixels[1][0] && !pixels[1][1]) ++ return 0; ++ ++ ix = x; ++ iy = y; ++ x -= ix; ++ y -= iy; ++ for (i = 0; i < 4; i++) ++ { ++ uint32_t value = 0; ++ uint32_t mask = 0xFF << (i * 8); ++ value += ((pixels[0][0]) & mask) * (1 - x) * (1 - y); ++ value += ((pixels[0][1]) & mask) * x * (1 - y); ++ value += ((pixels[1][0]) & mask) * (1 - x) * y; ++ value += ((pixels[1][1]) & mask) * x * y; ++ reply |= value & mask; ++ } ++ return reply; ++} ++ + ply_image_t * + ply_image_resize (ply_image_t *image, + long width, +@@ -303,7 +356,8 @@ ply_image_resize (ply_image_t *image, + { + ply_image_t *new_image; + int x, y; +- int old_x, old_y, old_width, old_height; ++ double old_x, old_y; ++ int old_width, old_height; + float scale_x, scale_y; + + new_image = ply_image_new (image->filename); +@@ -316,8 +370,8 @@ ply_image_resize (ply_image_t *image, + old_width = ply_image_get_width (image); + old_height = ply_image_get_height (image); + +- scale_x = ((double) old_width) / width; +- scale_y = ((double) old_height) / height; ++ scale_x = ((double) old_width - 1) / MAX (width - 1, 1); ++ scale_y = ((double) old_height - 1) / MAX (height - 1, 1); + + for (y = 0; y < height; y++) + { +@@ -325,7 +379,7 @@ ply_image_resize (ply_image_t *image, + for (x=0; x < width; x++) + { + old_x = x * scale_x; +- new_image->layout.as_pixels[x + y * width] = image->layout.as_pixels[old_x + old_y * old_width]; ++ new_image->layout.as_pixels[x + y * width] = ply_image_interpolate (image, old_x, old_y); + } + } + return new_image; +@@ -465,7 +519,8 @@ main (int argc, + return exit_code; + } + +- image = ply_image_resize(image, buffer->area.width, buffer->area.height); ++ if (image->width != buffer->area.width || image->height != buffer->area.height) ++ image = ply_image_resize(image, buffer->area.width, buffer->area.height); + + animate_at_time (buffer, image); + diff --git a/packages/tools/populatefs/package.mk b/packages/tools/populatefs/package.mk index 35ae291cd1..196dca1cbb 100644 --- a/packages/tools/populatefs/package.mk +++ b/packages/tools/populatefs/package.mk @@ -1,42 +1,23 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="populatefs" -PKG_VERSION="95cc98b" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.0" +PKG_SHA256="e5845404188b5da3afb11229ecb38646cc1562b61400035774dbc237c3b706d2" PKG_LICENSE="GPL" -PKG_SITE="https://github.com/oskarirauta/populatefs" -PKG_URL="https://github.com/oskarirauta/populatefs/archive/$PKG_VERSION.tar.gz" +PKG_SITE="https://github.com/lipnitsk/populatefs" +PKG_URL="https://github.com/lipnitsk/$PKG_NAME/archive/v${PKG_VERSION}.tar.gz" PKG_DEPENDS_HOST="e2fsprogs:host" -PKG_SECTION="tools" -PKG_SHORTDESC="populatefs: Tool for replacing genext2fs when creating ext4 images" PKG_LONGDESC="populatefs: Tool for replacing genext2fs when creating ext4 images" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic:host" make_host() { - make EXTRA_LIBS="-lcom_err -lpthread" CFLAGS="$CFLAGS -fPIC" + make EXTRA_LIBS="-lcom_err -lpthread" } makeinstall_host() { $STRIP src/populatefs - mkdir -p $ROOT/$TOOLCHAIN/sbin - cp src/populatefs $ROOT/$TOOLCHAIN/sbin + mkdir -p $TOOLCHAIN/sbin + cp src/populatefs $TOOLCHAIN/sbin } diff --git a/packages/tools/populatefs/patches/fix-compilation-issue.patch b/packages/tools/populatefs/patches/fix-compilation-issue.patch new file mode 100644 index 0000000000..e9b360ccae --- /dev/null +++ b/packages/tools/populatefs/patches/fix-compilation-issue.patch @@ -0,0 +1,11 @@ +diff -Nur a/src/mod_path.c b/src/mod_path.c +--- a/src/mod_path.c 2016-02-24 04:15:10.000000000 +0100 ++++ b/src/mod_path.c 2018-08-22 16:58:11.884462070 +0200 +@@ -1,6 +1,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/packages/tools/procps-ng/package.mk b/packages/tools/procps-ng/package.mk index b6a0927c59..8e47503d99 100644 --- a/packages/tools/procps-ng/package.mk +++ b/packages/tools/procps-ng/package.mk @@ -1,33 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="procps-ng" PKG_VERSION="3.3.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4" PKG_LICENSE="GPL" PKG_SITE="https://gitlab.com/procps-ng/procps" PKG_URL="$SOURCEFORGE_SRC/$PKG_NAME/Production/$PKG_NAME-$PKG_VERSION.tar.xz" -PKG_DEPENDS_TARGET="toolchain netbsd-curses" -PKG_SECTION="tools" -PKG_SHORTDESC="Command line and full screen utilities for browsing procfs" -PKG_LONGDESC="Command line and full screen utilities for browsing procfs, a "pseudo" file system dynamically generated by the kernel to provide information about the status of entries in its process table." -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain ncurses" +PKG_LONGDESC="Command line and full screen utilities for browsing procfs." PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes \ @@ -37,5 +18,5 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_malloc_0_nonnull=yes \ makeinstall_target() { mkdir -p $INSTALL/usr/bin - cp -P $ROOT/$PKG_BUILD/.$TARGET_NAME/top/top $INSTALL/usr/bin + cp -P $PKG_BUILD/.$TARGET_NAME/top/top $INSTALL/usr/bin } diff --git a/packages/tools/procps-ng/patches/procps-ng-0001-netbsd-curses-fix.patch b/packages/tools/procps-ng/patches/procps-ng-0001-netbsd-curses-fix.patch deleted file mode 100644 index d598254555..0000000000 --- a/packages/tools/procps-ng/patches/procps-ng-0001-netbsd-curses-fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naur a/top/top.c b/top/top.c ---- a/top/top.c 2015-08-08 22:54:54.310117082 -0700 -+++ b/top/top.c 2016-04-22 12:17:49.833157898 -0700 -@@ -715,15 +715,15 @@ - the job's done until he/she/it has a change-of-heart */ - STRLCPY(q->cap_bold, CHKw(q, View_NOBOLD) ? Cap_norm : tIF(enter_bold_mode)) - if (CHKw(q, Show_COLORS) && max_colors > 0) { -- STRLCPY(q->capclr_sum, tparm(set_a_foreground, q->rc.summclr)) -+ STRLCPY(q->capclr_sum, tiparm(set_a_foreground, q->rc.summclr)) - snprintf(q->capclr_msg, sizeof(q->capclr_msg), "%s%s" -- , tparm(set_a_foreground, q->rc.msgsclr), Cap_reverse); -+ , tiparm(set_a_foreground, q->rc.msgsclr), Cap_reverse); - snprintf(q->capclr_pmt, sizeof(q->capclr_pmt), "%s%s" -- , tparm(set_a_foreground, q->rc.msgsclr), q->cap_bold); -+ , tiparm(set_a_foreground, q->rc.msgsclr), q->cap_bold); - snprintf(q->capclr_hdr, sizeof(q->capclr_hdr), "%s%s" -- , tparm(set_a_foreground, q->rc.headclr), Cap_reverse); -+ , tiparm(set_a_foreground, q->rc.headclr), Cap_reverse); - snprintf(q->capclr_rownorm, sizeof(q->capclr_rownorm), "%s%s" -- , Caps_off, tparm(set_a_foreground, q->rc.taskclr)); -+ , Caps_off, tiparm(set_a_foreground, q->rc.taskclr)); - } else { - q->capclr_sum[0] = '\0'; - #ifdef USE_X_COLHDR diff --git a/packages/tools/qemu/package.mk b/packages/tools/qemu/package.mk index 2fc7c3a526..883f1cbbdc 100644 --- a/packages/tools/qemu/package.mk +++ b/packages/tools/qemu/package.mk @@ -1,48 +1,30 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016- Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="qemu" -PKG_VERSION="2.7.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="3.1.0" +PKG_SHA256="6a0508df079a0a33c2487ca936a56c12122f105b8a96a44374704bef6c69abfc" PKG_LICENSE="GPL" PKG_SITE="http://wiki.qemu.org" -PKG_URL="http://wiki.qemu-project.org/download/qemu-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_HOST="toolchain Python:host zlib:host glib:host" -PKG_SECTION="tools" -PKG_SHORTDESC="QEMU is a generic and open source machine emulator and virtualizer." +PKG_URL="https://download.qemu.org/qemu-$PKG_VERSION.tar.xz" +PKG_DEPENDS_HOST="toolchain glib:host pixman:host Python2:host zlib:host" PKG_LONGDESC="QEMU is a generic and open source machine emulator and virtualizer." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -HOST_CONFIGURE_OPTS="--prefix=$ROOT/$TOOLCHAIN \ - --bindir=$ROOT/$TOOLCHAIN/bin \ - --sbindir=$ROOT/$TOOLCHAIN/sbin \ - --sysconfdir=$ROOT/$TOOLCHAIN/etc \ - --libexecdir=$ROOT/$TOOLCHAIN/lib \ - --localstatedir=$ROOT/$TOOLCHAIN/var \ - --extra-cflags=-I$ROOT/$TOOLCHAIN/include \ - --extra-ldflags=-L$ROOT/$TOOLCHAIN/lib \ - --static \ - --disable-vnc \ - --disable-werror \ - --disable-blobs \ - --disable-system \ - --disable-user \ - --disable-docs" +pre_configure_host() { + HOST_CONFIGURE_OPTS="--bindir=$TOOLCHAIN/bin \ + --extra-cflags=-I$TOOLCHAIN/include \ + --extra-ldflags=-L$TOOLCHAIN/lib \ + --libexecdir=$TOOLCHAIN/lib \ + --localstatedir=$TOOLCHAIN/var \ + --prefix=$TOOLCHAIN \ + --sbindir=$TOOLCHAIN/sbin \ + --static \ + --sysconfdir=$TOOLCHAIN/etc \ + --disable-blobs \ + --disable-docs \ + --disable-gcrypt \ + --disable-system \ + --disable-user \ + --disable-vnc \ + --disable-werror" +} diff --git a/packages/tools/rkbin/package.mk b/packages/tools/rkbin/package.mk new file mode 100644 index 0000000000..70f8db0867 --- /dev/null +++ b/packages/tools/rkbin/package.mk @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="rkbin" +# Version is: Kwiboo/tag:libreelec-ba436b9 +PKG_VERSION="ba436b9d616318a9437895457f6bbef1cc873e2b" +PKG_SHA256="72c2ef6ec1fe79da7c701056662343b9e1df1cf20e5df10bafc4ec0619ef4578" +PKG_ARCH="arm aarch64" +PKG_LICENSE="nonfree" +PKG_SITE="https://github.com/rockchip-linux/rkbin" +PKG_URL="https://github.com/rockchip-linux/rkbin/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="rkbin: Rockchip Firmware and Tool Binaries" +PKG_TOOLCHAIN="manual" diff --git a/packages/tools/slice-addon/package.mk b/packages/tools/slice-addon/package.mk new file mode 100644 index 0000000000..b96a7c16ac --- /dev/null +++ b/packages/tools/slice-addon/package.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="slice-addon" +PKG_VERSION="1.0" +PKG_REV="101" +PKG_LICENSE="GPL" +PKG_SITE="" +PKG_URL="" +PKG_DEPENDS_TARGET="" +PKG_LONGDESC="Controls the LED lights on the Slice box using Kodi actions" +PKG_TOOLCHAIN="manual" + +make_target() { +( + cd $ROOT + scripts/create_addon slice +) +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/kodi/addons + cp -R $BUILD/$ADDONS/slice/service.slice $INSTALL/usr/share/kodi/addons +} diff --git a/packages/tools/syslinux/package.mk b/packages/tools/syslinux/package.mk index 092e0dbcd7..f47bcee789 100644 --- a/packages/tools/syslinux/package.mk +++ b/packages/tools/syslinux/package.mk @@ -1,44 +1,27 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="syslinux" PKG_VERSION="6.03" -PKG_REV="1" +PKG_SHA256="26d3986d2bea109d5dc0e4f8c4822a459276cf021125e8c9f23c3cca5d8c850e" PKG_ARCH="x86_64" PKG_LICENSE="GPL" PKG_SITE="http://syslinux.zytor.com/" PKG_URL="http://www.kernel.org/pub/linux/utils/boot/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_HOST="util-linux:host" PKG_DEPENDS_TARGET="toolchain util-linux e2fsprogs syslinux:host" -PKG_SECTION="tools" -PKG_SHORTDESC="syslinux: Linux bootloader collection" -PKG_LONGDESC="The SYSLINUX project covers lightweight linux bootloaders for floppy media (syslinux), network booting (pxelinux) and bootable el-torito cd-roms (isolinux)." +PKG_LONGDESC="The SYSLINUX project covers lightweight linux bootloaders." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_MAKE_OPTS_TARGET="CC=$CC AR=$AR RANLIB=$RANLIB installer" +pre_configure_target() { + PKG_MAKE_OPTS_TARGET="CC=$CC AR=$AR RANLIB=$RANLIB installer" # Unset all compiler FLAGS unset CFLAGS unset CPPFLAGS unset CXXFLAGS unset LDFLAGS +} pre_build_target() { mkdir -p $PKG_BUILD/.$TARGET_NAME @@ -62,31 +45,28 @@ make_host() { make CC=$CC \ AR=$AR \ RANLIB=$RANLIB \ - CFLAGS="-I$ROOT/$TOOLCHAIN/include -I$ROOT/$PKG_BUILD/libinstaller -I$ROOT/$PKG_BUILD/libfat -I$ROOT/$PKG_BUILD/bios -I$ROOT/$PKG_BUILD/utils -fomit-frame-pointer -D_FILE_OFFSET_BITS=64" \ - LDFLAGS="-L$ROOT/$TOOLCHAIN/lib" \ + CFLAGS="-I$TOOLCHAIN/include -I$PKG_BUILD/libinstaller -I$PKG_BUILD/libfat -I$PKG_BUILD/bios -I$PKG_BUILD/utils -fomit-frame-pointer -D_FILE_OFFSET_BITS=64" \ + LDFLAGS="-L$TOOLCHAIN/lib" \ installer } makeinstall_host() { - mkdir -p $ROOT/$TOOLCHAIN/bin - cp bios/extlinux/extlinux $ROOT/$TOOLCHAIN/bin - cp bios/linux/syslinux $ROOT/$TOOLCHAIN/bin - cp bios/mtools/syslinux $ROOT/$TOOLCHAIN/bin/syslinux.mtools + mkdir -p $TOOLCHAIN/bin + cp bios/linux/syslinux $TOOLCHAIN/bin + cp bios/mtools/syslinux $TOOLCHAIN/bin/syslinux.mtools - mkdir -p $ROOT/$TOOLCHAIN/share/syslinux - cp bios/mbr/mbr.bin $ROOT/$TOOLCHAIN/share/syslinux - cp bios/mbr/gptmbr.bin $ROOT/$TOOLCHAIN/share/syslinux - cp efi64/efi/syslinux.efi $ROOT/$TOOLCHAIN/share/syslinux/bootx64.efi - cp efi64/com32/elflink/ldlinux/ldlinux.e64 $ROOT/$TOOLCHAIN/share/syslinux + mkdir -p $TOOLCHAIN/share/syslinux + cp bios/mbr/mbr.bin $TOOLCHAIN/share/syslinux + cp bios/mbr/gptmbr.bin $TOOLCHAIN/share/syslinux + cp efi64/efi/syslinux.efi $TOOLCHAIN/share/syslinux/bootx64.efi + cp efi64/com32/elflink/ldlinux/ldlinux.e64 $TOOLCHAIN/share/syslinux } makeinstall_target() { mkdir -p $INSTALL/usr/bin - cp bios/extlinux/extlinux $INSTALL/usr/bin cp bios/linux/syslinux $INSTALL/usr/bin $STRIP $INSTALL/usr/bin/syslinux - $STRIP $INSTALL/usr/bin/extlinux mkdir -p $INSTALL/usr/share/syslinux cp bios/mbr/mbr.bin $INSTALL/usr/share/syslinux diff --git a/packages/tools/syslinux/patches/syslinux-0001-fix-build-with-glibc_2.28.patch b/packages/tools/syslinux/patches/syslinux-0001-fix-build-with-glibc_2.28.patch new file mode 100644 index 0000000000..a39019e610 --- /dev/null +++ b/packages/tools/syslinux/patches/syslinux-0001-fix-build-with-glibc_2.28.patch @@ -0,0 +1,33 @@ +From 1a74985b2a404639b08882c57f3147229605dfd5 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Tue, 19 Apr 2016 06:50:31 -0400 +Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev + +These functions are defined in sys/sysmacros.h, so add the include to +main.c. This is already handled correctly in mountinfo.c. Otherwise +we get build failures like: + +main.o: In function 'find_device_sysfs': +extlinux/main.c:1131: undefined reference to 'minor' + +Signed-off-by: Mike Frysinger +Signed-off-by: Gene Cumm +--- + extlinux/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/extlinux/main.c b/extlinux/main.c +index a7ebd49..ebff7ea 100644 +--- a/extlinux/main.c ++++ b/extlinux/main.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.10.5.GIT + diff --git a/packages/tools/syslinux/unsupported/create_virtualimage b/packages/tools/syslinux/unsupported/create_virtualimage deleted file mode 100755 index 642f1e7fca..0000000000 --- a/packages/tools/syslinux/unsupported/create_virtualimage +++ /dev/null @@ -1,332 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -# usage: sudo ./create_virtualmachine [] [system partition size(MB)] -# example: sudo ./create_virtualmachine /home/test/VM 512 [vdi] [128] - -if [ "$(id -u)" != "0" ]; then - echo "##############################################################" - echo "# please execute with 'sudo' or -DANGEROUS!!!- as root #" - echo "# example: #" - echo "# sudo ./create_virtualmachine [] #" - echo "##############################################################" - exit 1 -fi - -if [ -z "$1" -o -z "$2" ]; then - echo "##############################################################" - echo "# please execute as follows #" - echo "# example: #" - echo "# sudo ./create_virtualmachine [] #" - echo "##############################################################" - exit 1 -fi - -if [ ! -d "$1" ]; then - echo "##############################################################" - echo "# please create target directory #" - echo "# example: #" - echo "# mkdir #" - echo "##############################################################" - exit 1 -fi - -if [ "$2" -lt "200" -o "$2" -gt "2048" ]; then - echo "##############################################################" - echo "# use a value between 200MB and 2048MB (2GB) #" - echo "# example: #" - echo "# sudo ./create_virtualmachine /home/test/VM 512 #" - echo "##############################################################" - exit 1 -fi - -if [ ! -z "$3" -a "$3" != "vdi" -a "$3" != "vmdk" ]; then - echo "##############################################################" - echo "# only vdi or vmdk types are supported #" - echo "# example: #" - echo "# sudo ./create_virtualmachine /home/test/VM 512 [vdi] #" - echo "##############################################################" - exit 1 -elif [ "$3" = "vdi" ]; then - TYPE="vdi" -elif [ -z "$3" -o "$3" = "vmdk" ]; then - TYPE="vmdk" -fi - -if [ -z "$4" ]; then - SYSTEM_SIZE=192 -else - if [ "$4" -lt "128" -o "$4" -gt "1024" -o "$4" -gt "$2" ]; then - echo "##############################################################" - echo "# use a value between 128MB and 1024MB #" - echo "# example: #" - echo "# sudo ./create_virtualmachine /home/test/VM 512 [vdi] [256] #" - echo "##############################################################" - exit 1 - else - SYSTEM_SIZE=$4 - fi -fi - -DISK="$1/OpenELEC.img" -IMAGE="$1/OpenELEC.$TYPE" -LOOP=$(losetup -f) -DISK_SIZE=$2 -STORAGE_SIZE=$(( $DISK_SIZE - $SYSTEM_SIZE )) - -echo "" -echo " folder: $1" -echo " loop: $LOOP" -echo " disk: $DISK" -echo " image: $IMAGE" -echo " type: $TYPE" -echo " disk size: $DISK_SIZE MB" -echo " system size: $SYSTEM_SIZE MB" -echo "storage size: $STORAGE_SIZE MB" - -# check for some required tools - - # this is needed to create a bootloader - which syslinux > /dev/null - if [ "$?" = "1" ]; then - echo "#########################################################" - echo "# #" - echo "# OpenELEC.tv missing tool - Installation will quit #" - echo "# #" - echo "# We can't find the required tool \"syslinux\" #" - echo "# on your system. #" - echo "# Please install it via your package manager. #" - echo "# #" - echo "#########################################################" - exit 1 - fi - - # this is needed to create a bootloader - which extlinux > /dev/null - if [ "$?" = "1" ]; then - echo "#########################################################" - echo "# #" - echo "# OpenELEC.tv missing tool - Installation will quit #" - echo "# #" - echo "# We can't find the required tool \"extlinux\" #" - echo "# on your system. #" - echo "# Please install it via your package manager. #" - echo "# #" - echo "#########################################################" - exit 1 - fi - - # this is needed by syslinux - which mcopy > /dev/null - if [ "$?" = "1" ]; then - echo "#########################################################" - echo "# #" - echo "# OpenELEC.tv missing tool - Installation will quit #" - echo "# #" - echo "# We can't find the required tool \"mcopy\" #" - echo "# on your system. #" - echo "# Please install it via your package manager. #" - echo "# NOTE: Some distributions call this package #" - echo "# \"mtools\". #" - echo "# #" - echo "#########################################################" - exit 1 - fi - - # this is needed to partion the drive - which parted > /dev/null - if [ "$?" = "1" ]; then - echo "#########################################################" - echo "# #" - echo "# OpenELEC.tv missing tool - Installation will quit #" - echo "# #" - echo "# We can't find the required tool \"parted\" #" - echo "# on your system. #" - echo "# Please install it via your package manager. #" - echo "# #" - echo "#########################################################" - exit 1 - fi - - # this is needed fo convert harddisk image to vmdk or vdi format - which qemu-img > /dev/null - if [ "$?" = "1" ]; then - echo "#########################################################" - echo "# #" - echo "# OpenELEC.tv missing tool - Installation will quit #" - echo "# #" - echo "# We can't find the required tool \"qemu-img\" #" - echo "# on your system. #" - echo "# Please install it via your package manager. #" - echo "# #" - echo "#########################################################" - exit 1 - fi - -# ensure loopX not in use - echo "" - echo "next two errors can be ignored..." - sync - umount "$LOOP" - losetup -d "$LOOP" - -# create an image - echo "" - echo "creating new empty harddisk image: $DISK..." - dd if=/dev/zero of="$DISK" bs=1M count="$DISK_SIZE" - -# write a disklabel - echo "" - echo "creating new partition table: $DISK..." - sync - losetup "$LOOP" "$DISK" - parted -s "$LOOP" mklabel msdos - -# create partition1 - echo "" - echo "creating partition1 on $DISK..." - SYSTEM_PART_END=$(( $SYSTEM_SIZE * 1024 * 1024 / 512 + 64 )) - parted -s "$LOOP" -a min unit s mkpart primary ext4 64 $SYSTEM_PART_END - -# create partition2 - echo "" - echo "creating partition2 on $DISK..." - STORAGE_PART_START=$(( $SYSTEM_PART_END + 1 )) - parted -s "$LOOP" -a min unit s mkpart primary ext4 $STORAGE_PART_START 100% - -# make partition1 active (bootable) - echo "" - echo "marking partition1 active..." - parted -s "$LOOP" set 1 boot on - -# write mbr - echo "" - echo "writing mbr..." - if [ -f /usr/lib/syslinux/mbr.bin ]; then - MBR="/usr/lib/syslinux/mbr.bin" # example: debian, ubuntu - elif [ -f /usr/share/syslinux/mbr.bin ]; then - MBR="/usr/share/syslinux/mbr.bin" # example: fedora - elif [ -f /usr/lib/syslinux/bios/mbr.bin ]; then - MBR="/usr/lib/syslinux/bios/mbr.bin" - else - echo "Can't find syslinux's mbr.bin on Host OS" - exit 1 - fi - - if [ -n "$MBR" ]; then - cat "$MBR" > "$LOOP" - fi - -# sync disk - echo "" - echo "syncing disk..." - sync - -# create filesystem on partition1 - echo "" - sync - losetup -d "$LOOP" - echo "creating filesystem on partition1..." - OFFSET=$(( 64 * 512 )) - SIZELIMIT=$(( $SYSTEM_SIZE * 1024 * 1024 )) - losetup -o $OFFSET --sizelimit $SIZELIMIT "$LOOP" "$DISK" - mke2fs -q -t ext4 -m 0 "$LOOP" - tune2fs -U random -L "System" "$LOOP" - sync - e2fsck -n "$LOOP" - -# mount partition - echo "" - echo "mounting partition1 on /tmp/vmware_install..." - mkdir -p /tmp/vmware_install - mount "$LOOP" /tmp/vmware_install - -# create bootloader configuration - echo "" - echo "creating bootloader configuration..." - - cat >/tmp/vmware_install/syslinux.cfg << EOF -DEFAULT linux -PROMPT 0 - -LABEL linux - KERNEL /KERNEL - APPEND boot=LABEL=System disk=LABEL=Storage quiet ssh - -EOF - -# install extlinux - echo "" - echo "installing extlinux to partition1..." - extlinux --heads=4 --sector=32 -i /tmp/vmware_install - -# copy files - echo "" - echo "copying files to partition1..." - cp target/KERNEL /tmp/vmware_install - cp target/SYSTEM /tmp/vmware_install - -# sync disk - echo "" - echo "syncing disk..." - sync - -# unmount partition1 - echo "" - echo "unmounting partition1..." - umount "$LOOP" - sync - -# create filesystem on partition2 - echo "" - sync - losetup -d "$LOOP" - echo "creating filesystem on partition2..." - OFFSET=$(( $STORAGE_PART_START * 512 )) - losetup -o $OFFSET "$LOOP" "$DISK" - mke2fs -q -t ext4 -m 0 "$LOOP" - tune2fs -U random -L "Storage" "$LOOP" - sync - e2fsck -n "$LOOP" - -# detach loopX - sync - losetup -d "$LOOP" - -# cleaning - echo "" - echo "cleaning tempdir..." - [ -f /tmp/vmware_install/ldlinux.sys ] && chattr -i /tmp/vmware_install/ldlinux.sys - rm -rf /tmp/vmware_install - -# convert image to vmdk or vdi - echo "" - echo "converting $DISK to $TYPE format..." - qemu-img convert -O $TYPE "$DISK" "$IMAGE" - rm -f "$DISK" - -# sync disk - echo "" - echo "syncing disk..." - sync - - echo "" - echo "installation finished..." - echo "" diff --git a/packages/tools/texturecache.py/package.mk b/packages/tools/texturecache.py/package.mk new file mode 100644 index 0000000000..fe2881659b --- /dev/null +++ b/packages/tools/texturecache.py/package.mk @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="texturecache.py" +PKG_VERSION="2.4.8" +PKG_SHA256="e4279ee57e0afd3875c9cdbdc732598b0ca12722e0652271887700b0138e3c26" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/MilhouseVH/texturecache.py" +PKG_URL="https://github.com/MilhouseVH/$PKG_NAME/archive/$PKG_VERSION.tar.gz" +PKG_LONGDESC="The Swiss Army knife for Kodi" +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -PRv texturecache.py $INSTALL/usr/bin + cp -PRv tools/mklocal.py $INSTALL/usr/bin + chmod +x $INSTALL/usr/bin/* +} diff --git a/packages/tools/u-boot-tools-aml/config/fw_env.config b/packages/tools/u-boot-tools-aml/config/fw_env.config new file mode 100644 index 0000000000..fb9211031a --- /dev/null +++ b/packages/tools/u-boot-tools-aml/config/fw_env.config @@ -0,0 +1,31 @@ +# Configuration file for fw_(printenv/setenv) utility. +# Up to two entries are valid, in this case the redundant +# environment sector is assumed present. +# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. +# Futhermore, if the Flash sector size is ommitted, this value is assumed to +# be the same as the Environment size, which is valid for NOR and SPI-dataflash + +# NOR example +# MTD device name Device offset Env. size Flash sector size Number of sectors +#/dev/mtd1 0x0000 0x4000 0x4000 +#/dev/mtd2 0x0000 0x4000 0x4000 + +# MTD SPI-dataflash example +# MTD device name Device offset Env. size Flash sector size Number of sectors +#/dev/mtd5 0x4200 0x4200 +#/dev/mtd6 0x4200 0x4200 + +# NAND example +#/dev/mtd0 0x4000 0x4000 0x20000 2 + +# Block device example +#/dev/mmcblk0 0xc0000 0x20000 + +# VFAT example +#/boot/uboot.env 0x0000 0x4000 + +# Amlogic NAND +/dev/nand_env 0x000000 0x10000 0x10000 + +# Amlogic eMMC +/dev/env 0x000000 0x10000 0x10000 diff --git a/packages/tools/u-boot-tools-aml/package.mk b/packages/tools/u-boot-tools-aml/package.mk new file mode 100644 index 0000000000..bc95cf8333 --- /dev/null +++ b/packages/tools/u-boot-tools-aml/package.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="u-boot-tools-aml" +PKG_VERSION="2016.03" +PKG_SHA256="e49337262ecac44dbdeac140f2c6ebd1eba345e0162b0464172e7f05583ed7bb" +PKG_SITE="https://www.denx.de/wiki/U-Boot" +PKG_URL="ftp://ftp.denx.de/pub/u-boot/u-boot-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain dtc:host u-boot-tools-aml:host" +PKG_LICENSE="GPL" +PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems." + +make_host() { + make mrproper + make dummy_defconfig + make tools-only +} + +make_target() { + CROSS_COMPILE="$TARGET_PREFIX" LDFLAGS="" ARCH=arm make dummy_defconfig + CROSS_COMPILE="$TARGET_PREFIX" LDFLAGS="" ARCH=arm make env +} + +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp tools/mkimage $TOOLCHAIN/bin +} + +makeinstall_target() { + mkdir -p $INSTALL/etc + cp $PKG_DIR/config/fw_env.config $INSTALL/etc/fw_env.config + + mkdir -p $INSTALL/usr/sbin + cp tools/env/fw_printenv $INSTALL/usr/sbin/fw_printenv + cp tools/env/fw_printenv $INSTALL/usr/sbin/fw_setenv +} diff --git a/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0001-dummy_defconfig.patch b/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0001-dummy_defconfig.patch new file mode 100644 index 0000000000..c25553fc61 --- /dev/null +++ b/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0001-dummy_defconfig.patch @@ -0,0 +1,5 @@ +--- a/configs/dummy_defconfig ++++ b/configs/dummy_defconfig +@@ -0,0 +1,2 @@ ++CONFIG_ARM=y ++ diff --git a/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0002-allow-multiple-entries.patch b/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0002-allow-multiple-entries.patch new file mode 100644 index 0000000000..8a993cc3eb --- /dev/null +++ b/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0002-allow-multiple-entries.patch @@ -0,0 +1,23 @@ +--- u-boot-tools-2016.01/tools/env/fw_env.c.orig 2016-01-12 15:06:54.000000000 +0100 ++++ u-boot-tools-2016.01/tools/env/fw_env.c 2016-03-22 09:47:07.014381827 +0100 +@@ -1453,6 +1453,7 @@ + int rc; + char dump[128]; + char *devname; ++ int fd_test; + + fp = fopen (fname, "r"); + if (fp == NULL) +@@ -1473,6 +1474,12 @@ + if (rc < 3) + continue; + ++ fd_test = open (devname, O_RDWR); ++ if (fd_test < 0) ++ continue; ++ if (close (fd_test)) ++ continue; ++ + DEVNAME(i) = devname; + + if (rc < 4) diff --git a/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0003-nand_env-hack.patch b/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0003-nand_env-hack.patch new file mode 100644 index 0000000000..6435f1c6d7 --- /dev/null +++ b/packages/tools/u-boot-tools-aml/patches/u-boot-tools-0003-nand_env-hack.patch @@ -0,0 +1,52 @@ +diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c +index 8b0317a..575f12a 100644 +--- a/tools/env/fw_env.c ++++ b/tools/env/fw_env.c +@@ -888,12 +888,13 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, + } + } + +- if (lseek (fd, blockstart, SEEK_SET) == -1) { +- fprintf (stderr, +- "Seek error on %s: %s\n", +- DEVNAME (dev), strerror (errno)); +- return -1; +- } ++ if (blockstart != 0) ++ if (lseek (fd, blockstart, SEEK_SET) == -1) { ++ fprintf (stderr, ++ "Seek error on %s: %s\n", ++ DEVNAME (dev), strerror (errno)); ++ return -1; ++ } + + #ifdef DEBUG + fprintf(stderr, "Write 0x%x bytes at 0x%llx\n", erasesize, +@@ -1025,25 +1026,8 @@ static int flash_read (int fd) + return -1; + } + +- if (S_ISCHR(st.st_mode)) { +- rc = ioctl(fd, MEMGETINFO, &mtdinfo); +- if (rc < 0) { +- fprintf(stderr, "Cannot get MTD information for %s\n", +- DEVNAME(dev_current)); +- return -1; +- } +- if (mtdinfo.type != MTD_NORFLASH && +- mtdinfo.type != MTD_NANDFLASH && +- mtdinfo.type != MTD_DATAFLASH && +- mtdinfo.type != MTD_UBIVOLUME) { +- fprintf (stderr, "Unsupported flash type %u on %s\n", +- mtdinfo.type, DEVNAME(dev_current)); +- return -1; +- } +- } else { +- memset(&mtdinfo, 0, sizeof(mtdinfo)); +- mtdinfo.type = MTD_ABSENT; +- } ++ memset(&mtdinfo, 0, sizeof(mtdinfo)); ++ mtdinfo.type = MTD_ABSENT; + + DEVTYPE(dev_current) = mtdinfo.type; + diff --git a/packages/tools/u-boot-v2/package.mk b/packages/tools/u-boot-v2/package.mk deleted file mode 100644 index 0e9476275c..0000000000 --- a/packages/tools/u-boot-v2/package.mk +++ /dev/null @@ -1,104 +0,0 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ -PKG_NAME="u-boot-v2" -PKG_VERSION="2016.03" -PKG_SITE="" -PKG_URL="ftp://ftp.denx.de/pub/u-boot/u-boot-$PKG_VERSION.tar.bz2" -PKG_SOURCE_DIR="u-boot-$PKG_VERSION" -PKG_DEPENDS_TARGET="toolchain" -PKG_REV="1" -PKG_ARCH="arm" -PKG_LICENSE="GPL" -PKG_SECTION="tools" -PKG_SHORTDESC="u-boot: Universal Bootloader project" -PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems, used as the default boot loader by several board vendors. It is intended to be easy to port and to debug, and runs on many supported architectures, including PPC, ARM, MIPS, x86, m68k, NIOS, and Microblaze." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - if [ -z "$UBOOT_CONFIG_V2" ]; then - echo "$TARGET_PLATFORM does not define any u-boot configuration, aborting." - echo "Please add UBOOT_CONFIG_V2 to your project options file." - exit 1 - fi - -# dont build in parallel because of problems - #MAKEFLAGS=-j1 -# hide compile line - KBUILD_VERBOSE=0 -} - -make_target() { - # get number of targets to build - UBOOT_TARGET_CNT=0 - for UBOOT_TARGET in $UBOOT_CONFIG_V2; do - UBOOT_TARGET_CNT=$((UBOOT_TARGET_CNT + 1)) - done - - # renamed files must be in subfolder or they got removed - rm -fr tmp_output - mkdir tmp_output - - for UBOOT_TARGET in $UBOOT_CONFIG_V2; do - echo "$PKG_NAME: building $UBOOT_TARGET" - make CROSS_COMPILE="$TARGET_PREFIX" CFLAGS="" LDFLAGS="" ARCH=arm mrproper - make CROSS_COMPILE="$TARGET_PREFIX" CFLAGS="" LDFLAGS="" ARCH=arm $UBOOT_TARGET - make CROSS_COMPILE="$TARGET_PREFIX" CFLAGS="" LDFLAGS="" ARCH=arm HOSTCC="$HOST_CC" HOSTSTRIP="true" - - # rename files in case of multiple targets - if [ $UBOOT_TARGET_CNT -gt 1 ]; then - if [ "$UBOOT_TARGET" = "udoo_config" ]; then - TARGET_NAME="udoo" - elif [ "$UBOOT_TARGET" = "tbs2910_config" ]; then - TARGET_NAME="matrix" - elif [ "$UBOOT_TARGET" = "wandboard_config" ]; then - TARGET_NAME="wandboard" - else - TARGET_NAME="undef" - fi - - [ -f u-boot.img ] && mv u-boot.img tmp_output/u-boot-$TARGET_NAME.img || : # - [ -f u-boot.imx ] && mv u-boot.imx tmp_output/u-boot-$TARGET_NAME.imx || : # - [ -f SPL ] && mv SPL tmp_output/SPL-$TARGET_NAME || : # - fi - done - - mv tmp_output/* . - rmdir tmp_output -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/share/bootloader - - cp $ROOT/$PKG_BUILD/u-boot-*.imx $INSTALL/usr/share/bootloader 2>/dev/null || : # - cp $ROOT/$PKG_BUILD/u-boot-*.img $INSTALL/usr/share/bootloader 2>/dev/null || : # - cp $ROOT/$PKG_BUILD/SPL-* $INSTALL/usr/share/bootloader 2>/dev/null || : # -} - -pre_install() { - # rename tbs matrix binary in main u-boot - U_BOOT_MAIN_DIR="$(get_build_dir u-boot)" - if [ -f "$U_BOOT_MAIN_DIR/u-boot-matrix.imx" ]; then - mv "$U_BOOT_MAIN_DIR/u-boot-matrix.imx" "$U_BOOT_MAIN_DIR/u-boot-matrix-v1.imx" || : # - fi - - U_BOOT_MAIN_DIR="$U_BOOT_MAIN_DIR/.install_pkg/usr/share/bootloader" - if [ -f "$U_BOOT_MAIN_DIR/u-boot-matrix.imx" ]; then - mv "$U_BOOT_MAIN_DIR/u-boot-matrix.imx" "$U_BOOT_MAIN_DIR/u-boot-matrix-v1.imx" || : # - fi -} diff --git a/packages/tools/u-boot-v2/patches/u-boot-v2-010-tbs2910.patch b/packages/tools/u-boot-v2/patches/u-boot-v2-010-tbs2910.patch deleted file mode 100644 index cf86b22638..0000000000 --- a/packages/tools/u-boot-v2/patches/u-boot-v2-010-tbs2910.patch +++ /dev/null @@ -1,185 +0,0 @@ -stuff ported from u-boot-imx6-e817fa3 - ---- a/include/configs/tbs2910.h 2015-10-12 17:14:27.000000000 +0200 -+++ b/include/configs/tbs2910.h 2015-10-19 16:46:51.396448700 +0200 -@@ -11,6 +11,19 @@ - - #include "mx6_common.h" - -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 1 -+ -+#define CONFIG_FS_FAT -+#define CONFIG_FS_EXT4 -+#define CONFIG_CMD_FS_GENERIC /* Generic load commands */ -+#define CONFIG_CMD_BOOTZ /* bootz zImage support */ -+#define CONFIG_SUPPORT_RAW_INITRD /* bootz raw initrd support */ -+#define CONFIG_CMD_EXT2 -+#define CONFIG_CMD_EXT4 -+#define CONFIG_CMD_FAT -+#define CONFIG_DOS_PARTITION -+ - /* General configuration */ - #define CONFIG_SYS_THUMB_BUILD - -@@ -183,35 +196,133 @@ - #define CONFIG_ENV_OVERWRITE - - #define CONFIG_EXTRA_ENV_SETTINGS \ -- "bootargs_mmc1=console=ttymxc0,115200 di0_primary console=tty1\0" \ -- "bootargs_mmc2=video=mxcfb0:dev=hdmi,1920x1080M@60 " \ -- "video=mxcfb1:off video=mxcfb2:off fbmem=28M\0" \ -- "bootargs_mmc3=root=/dev/mmcblk0p1 rootwait consoleblank=0 quiet\0" \ -- "bootargs_mmc=setenv bootargs ${bootargs_mmc1} ${bootargs_mmc2} " \ -- "${bootargs_mmc3}\0" \ -- "bootargs_upd=setenv bootargs console=ttymxc0,115200 " \ -- "rdinit=/sbin/init enable_wait_mode=off\0" \ -- "bootcmd_mmc=run bootargs_mmc; mmc dev 2; " \ -- "mmc read 0x10800000 0x800 0x4000; bootm 0x10800000\0" \ -- "bootcmd_up1=load mmc 1 0x10800000 uImage\0" \ -- "bootcmd_up2=load mmc 1 0x10d00000 uramdisk.img; " \ -- "run bootargs_upd; " \ -- "bootm 0x10800000 0x10d00000\0" \ -- "console=ttymxc0\0" \ -- "fan=gpio set 92\0" \ -- "set_con_serial=setenv stdin serial; " \ -- "setenv stdout serial; " \ -- "setenv stderr serial;\0" \ -- "set_con_usb_hdmi=setenv stdin serial,usbkbd; " \ -- "setenv stdout serial,vga; " \ -- "setenv stderr serial,vga;\0" -+ "zImage=KERNEL\0" \ -+ "script=boot.scr\0" \ -+ "uimage=uImage\0" \ -+ "fdt_file=imx6q-tbs2910.dtb\0" \ -+ "fdt_addr=0x18000000\0" \ -+ "boot_fdt=try\0" \ -+ "ip_dyn=yes\0" \ -+ "console=ttymxc0,115200\0" \ -+ "optargs=\0" \ -+ "video=\0" \ -+ "fdt_high=0xffffffff\0" \ -+ "initrd_high=0xffffffff\0" \ -+ "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \ -+ "mmcpart=1\0" \ -+ "update_sd_firmware=" \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "if mmc dev ${mmcdev}; then " \ -+ "if ${get_cmd} ${update_sd_firmware_filename}; then " \ -+ "setexpr fw_sz ${filesize} / 0x200; " \ -+ "setexpr fw_sz ${fw_sz} + 1; " \ -+ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ -+ "fi; " \ -+ "fi\0" \ -+ "mmcroot=/dev/mmcblk0p2 ro\0" \ -+ "mmcrootfstype=ext4 rootwait fixrtc\0" \ -+ "mmcargs=setenv bootargs console=${console}" \ -+ "${optargs} " \ -+ "root=${mmcroot} " \ -+ "rootfstype=${mmcrootfstype} " \ -+ "video=${video}\0" \ -+ "loadbootscript=" \ -+ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "bootscript=echo Running bootscript from mmc ...; " \ -+ "source\0" \ -+ "loadbootenv=" \ -+ "load mmc ${mmcdev}:${mmcpart} ${loadaddr} uEnv.txt;\0" \ -+ "importbootenv=echo Importing environment from mmc (uEnv.txt)...; " \ -+ "env import -t ${loadaddr} ${filesize}\0" \ -+ "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ -+ "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ -+ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ -+ "mmcboot=echo Booting from mmc ...; " \ -+ "run mmcargs; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if run loadfdt; then " \ -+ "bootz ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootz; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootz; " \ -+ "fi;\0" \ -+ "netargs=setenv bootargs console=${console},${baudrate} " \ -+ "root=/dev/nfs " \ -+ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ -+ "netboot=echo Booting from net ...; " \ -+ "run netargs; " \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "${get_cmd} ${uimage}; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -+ "bootz ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootz; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootz; " \ -+ "fi;\0" - - #define CONFIG_BOOTCOMMAND \ -- "mmc rescan; " \ -- "if run bootcmd_up1; then " \ -- "run bootcmd_up2; " \ -+ "echo; " \ -+ "echo SD/MMC device set to ${mmcdev} but checking 0, 1 and 2; " \ -+ "setenv mmcdevold ${mmcdev}; " \ -+ "setenv mmcdev 0; " \ -+ "echo Checking mmc dev ${mmcdev} (microSD card);" \ -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan && run loadbootenv; then " \ - "else " \ -- "run bootcmd_mmc; " \ -- "fi" -+ "setenv mmcdev 1; " \ -+ "echo Checking mmc dev ${mmcdev} (SD card);" \ -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan && run loadbootenv; then " \ -+ "else " \ -+ "setenv mmcdev 2; " \ -+ "echo Checking mmc dev ${mmcdev} (internal eMMC);" \ -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan && run loadbootenv; then " \ -+ "else " \ -+ "echo No SD/MMC with uEnv.txt found on device 0 to 2;" \ -+ "setenv mmcdev ${mmcdevold}; " \ -+ "fi; " \ -+ "fi; " \ -+ "fi; " \ -+ "setenv mmcdevold; " \ -+ "echo; " \ -+ "echo Using SD/MMC device ${mmcdev};" \ -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan; then " \ -+ "echo SD/MMC found on device ${mmcdev};" \ -+ "if run loadbootenv; then " \ -+ "run importbootenv;" \ -+ "fi;" \ -+ "echo Checking if uenvcmd is set ...;" \ -+ "if test -n $uenvcmd; then " \ -+ "echo Running uenvcmd ...;" \ -+ "run uenvcmd;" \ -+ "fi;" \ -+ "echo Running default loadzimage ...;" \ -+ "if run loadzimage; then " \ -+ "run mmcboot;" \ -+ "fi;" \ -+ "fi;" - - #endif /* __TBS2910_CONFIG_H * */ diff --git a/packages/tools/u-boot-v2/patches/u-boot-v2-020-udoo.patch b/packages/tools/u-boot-v2/patches/u-boot-v2-020-udoo.patch deleted file mode 100644 index b8a691c2e6..0000000000 --- a/packages/tools/u-boot-v2/patches/u-boot-v2-020-udoo.patch +++ /dev/null @@ -1,164 +0,0 @@ -diff -aurN a/board/udoo/udoo_spl.c b/board/udoo/udoo_spl.c ---- a/board/udoo/udoo_spl.c 2016-03-14 15:20:21.000000000 +0100 -+++ b/board/udoo/udoo_spl.c 2016-04-15 11:33:04.501383916 +0200 -@@ -214,7 +214,7 @@ - struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; - - /* enable AXI cache for VDOA/VPU/IPU */ -- writel(0xF00000FF, &iomux->gpr[4]); -+ writel(0xF00000CF, &iomux->gpr[4]); - /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */ - writel(0x007F007F, &iomux->gpr[6]); - writel(0x007F007F, &iomux->gpr[7]); -diff -aurN a/include/configs/udoo.h b/include/configs/udoo.h ---- a/include/configs/udoo.h 2016-03-14 15:20:21.000000000 +0100 -+++ b/include/configs/udoo.h 2016-04-15 11:32:41.181971400 +0200 -@@ -11,8 +11,8 @@ - - #include "mx6_common.h" - --#define CONFIG_SPL_LIBCOMMON_SUPPORT - #define CONFIG_SPL_MMC_SUPPORT -+#define CONFIG_SPL_FAT_SUPPORT - #include "imx6_spl.h" - - #define MACH_TYPE_UDOO 4800 -@@ -27,6 +27,35 @@ - #define CONFIG_MXC_UART - #define CONFIG_MXC_UART_BASE UART2_BASE - -+/* USB and USB Mass Storage support */ -+ -+#define CONFIG_CMD_USB -+#define CONFIG_CMD_FAT -+#define CONFIG_USB_EHCI -+#define CONFIG_USB_EHCI_MX6 -+#define CONFIG_USB_STORAGE -+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET -+#define CONFIG_USB_HOST_ETHER -+#define CONFIG_USB_ETHER_ASIX -+#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) -+#define CONFIG_MXC_USB_FLAGS 0 -+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 /* Enabled USB controller number */ -+#define CONFIG_USB_KEYBOARD -+ -+#define CONFIG_CI_UDC -+#define CONFIG_USBD_HS -+#define CONFIG_USB_GADGET_DUALSPEED -+ -+#define CONFIG_USB_GADGET -+#define CONFIG_CMD_USB_MASS_STORAGE -+#define CONFIG_USB_FUNCTION_MASS_STORAGE -+#define CONFIG_USB_GADGET_DOWNLOAD -+#define CONFIG_USB_GADGET_VBUS_DRAW 2 -+ -+#define CONFIG_G_DNL_VENDOR_NUM 0x0525 -+#define CONFIG_G_DNL_PRODUCT_NUM 0xa4a5 -+#define CONFIG_G_DNL_MANUFACTURER "Udoo" -+ - /* SATA Configs */ - - #define CONFIG_CMD_SATA -@@ -63,11 +92,14 @@ - /* MMC Configuration */ - #define CONFIG_SYS_FSL_ESDHC_ADDR 0 - -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 1 - #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG - - #define CONFIG_EXTRA_ENV_SETTINGS \ -+ "zImage=KERNEL\0" \ - "script=boot.scr\0" \ -- "image=zImage\0" \ -+ "image=${zImage}\0" \ - "console=ttymxc1\0" \ - "splashpos=m,m\0" \ - "fdt_high=0xffffffff\0" \ -@@ -76,9 +108,12 @@ - "fdt_addr=0x18000000\0" \ - "boot_fdt=try\0" \ - "ip_dyn=yes\0" \ -+ "optargs=\0" \ -+ "video=\0" \ - "mmcdev=0\0" \ - "mmcpart=1\0" \ -- "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ -+ "mmcroot=/dev/mmcblk0p2 ro\0" \ -+ "mmcrootfstype=ext4 rootwait\0" \ - "update_sd_firmware_filename=u-boot.imx\0" \ - "update_sd_firmware=" \ - "if test ${ip_dyn} = yes; then " \ -@@ -94,27 +129,36 @@ - "fi; " \ - "fi\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ -- "root=${mmcroot}\0" \ -+ "${optargs} " \ -+ "root=${mmcroot} " \ -+ "rootfstype=${mmcrootfstype} " \ -+ "video=${video}\0" \ -+ "loadbootenv=load mmc ${mmcdev}:${mmcpart} ${loadaddr} uEnv.txt\0" \ -+ "importbootenv=echo Importing environment from mmc (uEnv.txt)...; " \ -+ "env import -t $loadaddr $filesize\0" \ - "loadbootscript=" \ -- "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source\0" \ -- "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ -+ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ -+ "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ - "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ -+ "bootz ${loadaddr} - ${fdt_addr};\0" \ -+ "mmcbootdefault=echo Booting from mmc ...; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ -- "bootz; " \ -+ "bootz ${loadaddr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ -- "bootz; " \ -+ "bootz ${loadaddr}; " \ - "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ -@@ -150,16 +194,23 @@ - - #define CONFIG_BOOTCOMMAND \ - "run findfdt; " \ -- "mmc dev ${mmcdev}; if mmc rescan; then " \ -- "if run loadbootscript; then " \ -- "run bootscript; " \ -- "else " \ -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan; then " \ -+ "echo SD/MMC found on device ${mmcdev};" \ -+ "if run loadbootenv; then " \ -+ "run importbootenv;" \ -+ "fi;" \ -+ "echo Checking if uenvcmd is set ...;" \ -+ "if test -n $uenvcmd; then " \ -+ "echo Running uenvcmd ...;" \ -+ "run uenvcmd;" \ -+ "fi;" \ -+ "echo Running default loadimage ...;" \ - "if run loadimage; then " \ -+ "run loadfdt;" \ - "run mmcboot; " \ -- "else run netboot; " \ -- "fi; " \ - "fi; " \ -- "else run netboot; fi" -+ "fi;" - - /* Print Buffer Size */ - #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) diff --git a/packages/tools/u-boot/package.mk b/packages/tools/u-boot/package.mk index a9c686ea33..d11703c27a 100644 --- a/packages/tools/u-boot/package.mk +++ b/packages/tools/u-boot/package.mk @@ -1,147 +1,61 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="u-boot" -PKG_DEPENDS_TARGET="toolchain" -if [ "$UBOOT_VERSION" = "imx6-cuboxi" ]; then - PKG_VERSION="imx6-408544d" - PKG_SITE="http://imx.solid-run.com/wiki/index.php?title=Building_the_kernel_and_u-boot_for_the_CuBox-i_and_the_HummingBoard" - # https://github.com/SolidRun/u-boot-imx6.git - PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" - [ -n "$UBOOT_CONFIG_V2" ] && PKG_DEPENDS_TARGET="toolchain u-boot-v2" -elif [ "$UBOOT_VERSION" = "hardkernel" ]; then - PKG_VERSION="6e4e886" - PKG_SITE="https://github.com/hardkernel/u-boot" - PKG_URL="https://github.com/hardkernel/u-boot/archive/$PKG_VERSION.tar.gz" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host" -else - exit 0 -fi -PKG_REV="1" PKG_ARCH="arm aarch64" +PKG_SITE="https://www.denx.de/wiki/U-Boot" +PKG_DEPENDS_TARGET="toolchain dtc:host" PKG_LICENSE="GPL" -PKG_SECTION="tools" -PKG_SHORTDESC="u-boot: Universal Bootloader project" -PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems, used as the default boot loader by several board vendors. It is intended to be easy to port and to debug, and runs on many supported architectures, including PPC, ARM, MIPS, x86, m68k, NIOS, and Microblaze." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -pre_configure_target() { - if [ -z "$UBOOT_CONFIG" ]; then - echo "$TARGET_PLATFORM does not define any u-boot configuration, aborting." - echo "Please add UBOOT_CONFIG to your project options file." - exit 1 - fi - - if [ -z "$UBOOT_CONFIGFILE" ]; then - UBOOT_CONFIGFILE="boot.scr" - fi - - unset LDFLAGS - -# dont build in parallel because of problems - MAKEFLAGS=-j1 - -# copy compiler-gcc5.h to compiler-gcc6. for fake building - cp include/linux/compiler-gcc5.h include/linux/compiler-gcc6.h - -} +PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems." +PKG_IS_KERNEL_PKG="yes" + +PKG_NEED_UNPACK="$PROJECT_DIR/$PROJECT/bootloader" +[ -n "$DEVICE" ] && PKG_NEED_UNPACK+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader" + +case "$PROJECT" in + Rockchip) + PKG_VERSION="8659d08d2b589693d121c1298484e861b7dafc4f" + PKG_SHA256="3f9f2bbd0c28be6d7d6eb909823fee5728da023aca0ce37aef3c8f67d1179ec1" + PKG_URL="https://github.com/rockchip-linux/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_PATCH_DIRS="rockchip" + PKG_DEPENDS_TARGET+=" rkbin" + PKG_NEED_UNPACK+=" $(get_pkg_directory rkbin)" + ;; + *) + PKG_VERSION="2018.09" + PKG_SHA256="839bf23cfe8ce613a77e583a60375179d0ad324e92c82fbdd07bebf0fd142268" + PKG_URL="http://ftp.denx.de/pub/u-boot/u-boot-$PKG_VERSION.tar.bz2" + ;; +esac make_target() { - # get number of targets to build - UBOOT_TARGET_CNT=0 - for UBOOT_TARGET in $UBOOT_CONFIG; do - UBOOT_TARGET_CNT=$((UBOOT_TARGET_CNT + 1)) - done - - for UBOOT_TARGET in $UBOOT_CONFIG; do - if [ "$PROJECT" = "Odroid_C2" ]; then - export PATH=$ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/bin/:$ROOT/$TOOLCHAIN/lib/gcc-linaro-arm-eabi/bin/:$PATH - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make mrproper - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make $UBOOT_TARGET - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make HOSTCC="$HOST_CC" HOSTSTRIP="true" - else - make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm mrproper - make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm $UBOOT_TARGET - make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm HOSTCC="$HOST_CC" HOSTSTRIP="true" - fi - - # rename files in case of multiple targets - if [ $UBOOT_TARGET_CNT -gt 1 ]; then - if [ "$UBOOT_TARGET" = "mx6_cubox-i_config" ]; then - TARGET_NAME="cuboxi" - elif [ "$UBOOT_TARGET" = "matrix" ]; then - TARGET_NAME="matrix" - elif [ "$UBOOT_TARGET" = "udoo_config" ]; then - TARGET_NAME="udoo" - else - TARGET_NAME="undef" - fi - - [ -f u-boot.img ] && mv u-boot.img u-boot-$TARGET_NAME.img || : - [ -f u-boot.imx ] && mv u-boot.imx u-boot-$TARGET_NAME.imx || : - [ -f SPL ] && mv SPL SPL-$TARGET_NAME || : - fi - done + if [ -z "$UBOOT_SYSTEM" ]; then + echo "UBOOT_SYSTEM must be set to build an image" + echo "see './scripts/uboot_helper' for more information" + else + [ "${BUILD_WITH_DEBUG}" = "yes" ] && PKG_DEBUG=1 || PKG_DEBUG=0 + DEBUG=${PKG_DEBUG} CROSS_COMPILE="$TARGET_KERNEL_PREFIX" LDFLAGS="" ARCH=arm make mrproper + DEBUG=${PKG_DEBUG} CROSS_COMPILE="$TARGET_KERNEL_PREFIX" LDFLAGS="" ARCH=arm make $($ROOT/$SCRIPTS/uboot_helper $PROJECT $DEVICE $UBOOT_SYSTEM config) + DEBUG=${PKG_DEBUG} CROSS_COMPILE="$TARGET_KERNEL_PREFIX" LDFLAGS="" ARCH=arm make HOSTCC="$HOST_CC" HOSTSTRIP="true" + fi } makeinstall_target() { - mkdir -p $ROOT/$TOOLCHAIN/bin - if [ -f build/tools/mkimage ]; then - cp build/tools/mkimage $ROOT/$TOOLCHAIN/bin - else - cp tools/mkimage $ROOT/$TOOLCHAIN/bin - fi - - BOOT_CFG="$PROJECT_DIR/$PROJECT/bootloader/boot.cfg" - if [ -r "$BOOT_CFG" ]; then - cp $BOOT_CFG boot.cfg - mkimage -A "$TARGET_ARCH" \ - -O u-boot \ - -T script \ - -C none \ - -n "$DISTRONAME Boot" \ - -d boot.cfg \ - $UBOOT_CONFIGFILE - fi - mkdir -p $INSTALL/usr/share/bootloader - cp $ROOT/$PKG_BUILD/u-boot*.imx $INSTALL/usr/share/bootloader 2>/dev/null || : - cp $ROOT/$PKG_BUILD/u-boot*.img $INSTALL/usr/share/bootloader 2>/dev/null || : - cp $ROOT/$PKG_BUILD/SPL* $INSTALL/usr/share/bootloader 2>/dev/null || : - - cp $ROOT/$PKG_BUILD/$UBOOT_CONFIGFILE $INSTALL/usr/share/bootloader 2>/dev/null || : + # Only install u-boot.img et al when building a board specific image + if [ -n "$UBOOT_SYSTEM" ]; then + find_file_path bootloader/install && . ${FOUND_PATH} + fi - cp -PR $PROJECT_DIR/$PROJECT/bootloader/uEnv*.txt $INSTALL/usr/share/bootloader 2>/dev/null || : + # Always install the update script + find_file_path bootloader/update.sh && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader - case $PROJECT in - Odroid_C2) - cp -PRv $PKG_DIR/scripts/update-c2.sh $INSTALL/usr/share/bootloader/update.sh - cp -PRv $ROOT/$PKG_BUILD/u-boot.bin $INSTALL/usr/share/bootloader/u-boot - if [ -f $PROJECT_DIR/$PROJECT/splash/boot-logo.bmp.gz ]; then - cp -PRv $PROJECT_DIR/$PROJECT/splash/boot-logo.bmp.gz $INSTALL/usr/share/bootloader - elif [ -f $DISTRO_DIR/$DISTRO/splash/boot-logo.bmp.gz ]; then - cp -PRv $DISTRO_DIR/$DISTRO/splash/boot-logo.bmp.gz $INSTALL/usr/share/bootloader - fi - ;; - imx6) - cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader - ;; - esac + # Always install the canupdate script + if find_file_path bootloader/canupdate.sh; then + cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + sed -e "s/@PROJECT@/${DEVICE:-$PROJECT}/g" \ + -i $INSTALL/usr/share/bootloader/canupdate.sh + fi } diff --git a/packages/tools/u-boot/patches/2018.09/u-boot-0001-dont-build-libfdt.patch b/packages/tools/u-boot/patches/2018.09/u-boot-0001-dont-build-libfdt.patch new file mode 100644 index 0000000000..8df1270cca --- /dev/null +++ b/packages/tools/u-boot/patches/2018.09/u-boot-0001-dont-build-libfdt.patch @@ -0,0 +1,25 @@ +diff --git a/dts/Kconfig b/dts/Kconfig +index 0cef225ba9..e4e3455d4c 100644 +--- a/dts/Kconfig ++++ b/dts/Kconfig +@@ -13,7 +13,6 @@ config PYLIBFDT + + config DTOC + bool +- select PYLIBFDT + + config BINMAN + bool +diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py +index dbc338653b..04f3c5935c 100644 +--- a/tools/dtoc/fdt.py ++++ b/tools/dtoc/fdt.py +@@ -10,7 +10,7 @@ import struct + import sys + + import fdt_util +-import libfdt ++from pylibfdt import libfdt + from libfdt import QUIET_NOTFOUND + + # This deals with a device tree, presenting it as an assortment of Node and diff --git a/packages/tools/u-boot/patches/6e4e886/u-boot-0001-use-arm-eabi-for-bl301-scp_task.patch b/packages/tools/u-boot/patches/6e4e886/u-boot-0001-use-arm-eabi-for-bl301-scp_task.patch deleted file mode 100644 index de61acedbe..0000000000 --- a/packages/tools/u-boot/patches/6e4e886/u-boot-0001-use-arm-eabi-for-bl301-scp_task.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 28c3064d6d3a89962e26f5c9ae3ee105d7377090 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 8 Aug 2016 01:59:07 +0200 -Subject: [PATCH] Use arm-eabi for bl301/scp_task - -For use with Linaro toolchain 4.9-2016.02 ---- - arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile b/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile -index 865d142..d905365 100644 ---- a/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile -+++ b/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile -@@ -6,7 +6,7 @@ include $(buildtree)/include/autoconf.mk - include $(buildtree)/.config - - # Select ARMv7-m bare-metal toolchain --CROSS_COMPILE=arm-none-eabi- -+CROSS_COMPILE=arm-eabi- - ASM=$(CROSS_COMPILE)as - CC=$(CROSS_COMPILE)gcc - CPP=$(CROSS_COMPILE)cpp diff --git a/packages/tools/u-boot/patches/imx6-408544d/u-boot-001-gcc5-support.patch b/packages/tools/u-boot/patches/imx6-408544d/u-boot-001-gcc5-support.patch deleted file mode 100644 index 4d55f00a4e..0000000000 --- a/packages/tools/u-boot/patches/imx6-408544d/u-boot-001-gcc5-support.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 7 Feb 2015 22:52:40 +0100 -Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5 - -Add linux/compiler-gcc5/h from the kernel sources at: - -commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b -Author: Steven Noonan -Date: Sat Oct 25 15:09:42 2014 -0700 - - compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles - -Signed-off-by: Hans de Goede ---- - include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 65 insertions(+) - create mode 100644 include/linux/compiler-gcc5.h - -diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h -new file mode 100644 -index 0000000..c8c5659 ---- /dev/null -+++ b/include/linux/compiler-gcc5.h -@@ -0,0 +1,65 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __must_check __attribute__((warn_unused_result)) -+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -+ -+/* Mark functions as cold. gcc will assume any path leading to a call -+ to them will be unlikely. This means a lot of manual unlikely()s -+ are unnecessary now for any paths leading to the usual suspects -+ like BUG(), printk(), panic() etc. [but let's keep them for now for -+ older compilers] -+ -+ Early snapshots of gcc 4.3 don't support this and we can't detect this -+ in the preprocessor, but we can live with this because they're unreleased. -+ Maketime probing would be overkill here. -+ -+ gcc also has a __attribute__((__hot__)) to move hot functions into -+ a special section, but I don't see any sense in this right now in -+ the kernel context */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+ -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ --- -1.7.10.4 - diff --git a/packages/tools/u-boot/patches/imx6-408544d/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch b/packages/tools/u-boot/patches/imx6-408544d/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch deleted file mode 100644 index 4a5e0de4ea..0000000000 --- a/packages/tools/u-boot/patches/imx6-408544d/u-boot-002-gcc5-use_gcc_inline_version_instead_c99.patch +++ /dev/null @@ -1,56 +0,0 @@ -[RFC 08/10] inline: use the gcc inline version instead of the c99 one. - -Jeroen Hofstee jeroen at myspectrum.nl -Sat May 31 22:32:22 CEST 2014 -Previous message: [U-Boot] [RFC 07/10] ARM: make gd a function a function for clang -Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ---- -This fixes errors like: - -make[1]: Entering directory `/home/jeroen/software/u-boot/arch/arm/cpu/armv7/omap-common' -arm-linux-gnueabi-ld.bfd -r -o libomap-common.o reset.o timer.o utils.o -timer.o: In function `get_tbclk': -/home/jeroen/software/u-boot/include/asm/io.h:81: multiple definition of `__raw_writesb' -reset.o:/home/jeroen/software/u-boot/include/asm/io.h:81: first defined here -timer.o: In function `__udelay': -/home/jeroen/software/u-boot/include/asm/io.h:88: multiple definition of `__raw_writesw' -reset.o:/home/jeroen/software/u-boot/include/asm/io.h:88: first defined here -timer.o: In function `get_ticks': -/home/jeroen/software/u-boot/include/asm/io.h:95: multiple definition of `__raw_writesl' -reset.o:/home/jeroen/software/u-boot/include/asm/io.h:95: first defined here -timer.o: In function `__raw_readsb': -/home/jeroen/software/u-boot/include/asm/io.h:102: multiple definition of `__raw_readsb' -reset.o:/home/jeroen/software/u-boot/include/asm/io.h:102: first defined here -timer.o: In function `__raw_readsw': -/home/jeroen/software/u-boot/include/asm/io.h:109: multiple definition of `__raw_readsw' -reset.o:/home/jeroen/software/u-boot/include/asm/io.h:109: first defined here -timer.o: In function `__raw_readsl': -/home/jeroen/software/u-boot/include/asm/io.h:116: multiple definition of `__raw_readsl' -reset.o:/home/jeroen/software/u-boot/include/asm/io.h:116: first defined here -make[1]: *** [libomap-common.o] Error 1 -make[1]: Leaving directory `/home/jeroen/software/u-boot/arch/arm/cpu/armv7/omap-common' -make: *** [arch/arm/cpu/armv7/omap-common/libomap-common.o] Error 2 ---- - include/linux/compiler-gcc.h | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h -index 9896e54..99c6dcc 100644 ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -44,9 +44,10 @@ - */ - #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) --# define inline inline __attribute__((always_inline)) --# define __inline__ __inline__ __attribute__((always_inline)) --# define __inline __inline __attribute__((always_inline)) -+/* XXX: check __GNUC_STDC_INLINE__, fix line length */ -+# define inline inline __attribute__((always_inline)) __attribute__((__gnu_inline__)) -+# define __inline__ __inline__ __attribute__((always_inline)) __attribute__((__gnu_inline__)) -+# define __inline __inline __attribute__((always_inline)) __attribute__((__gnu_inline__)) - #endif - - #define __deprecated __attribute__((deprecated)) --- -1.8.3.2 diff --git a/packages/tools/u-boot/patches/imx6-408544d/u-boot-003-gcc5-no-unalligned-access.patch b/packages/tools/u-boot/patches/imx6-408544d/u-boot-003-gcc5-no-unalligned-access.patch deleted file mode 100644 index 0c184eadf3..0000000000 --- a/packages/tools/u-boot/patches/imx6-408544d/u-boot-003-gcc5-no-unalligned-access.patch +++ /dev/null @@ -1,19 +0,0 @@ -from https://raw.githubusercontent.com/schnitzeltony/meta-gumstix-community/master/recipes-bsp/u-boot/u-boot-overo/0013-arm-Switch-to-mno-unaligned-access-when-supported-by.patch - ---- a/arch/arm/cpu/armv7/config.mk 2015-11-22 20:44:42.744557427 +0100 -+++ b/arch/arm/cpu/armv7/config.mk 2015-11-22 20:45:26.381024395 +0100 -@@ -18,9 +18,12 @@ PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARMV7 - PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) - PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT) - --# SEE README.arm-unaligned-accesses -+# On supported platforms we set the bit which causes us to trap on unaligned -+# memory access. This is the opposite of what the compiler expects to be -+# the default so we must pass in -mno-unaligned-access so that it is aware -+# of our decision. - PF_NO_UNALIGNED := $(call cc-option, -mno-unaligned-access,) --PLATFORM_NO_UNALIGNED := $(PF_NO_UNALIGNED) -+PLATFORM_CPPFLAGS += $(PF_NO_UNALIGNED) - - ifneq ($(CONFIG_IMX_CONFIG),) - ifdef CONFIG_SPL diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0001-dont-build-libfdt.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0001-dont-build-libfdt.patch new file mode 100644 index 0000000000..e3a23befbd --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0001-dont-build-libfdt.patch @@ -0,0 +1,47 @@ +From 3f028d24ed02173fea0950c28b3192f44e40c2a9 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 2 Dec 2017 11:47:07 +0100 +Subject: [PATCH] dont build libfdt + +--- + scripts/Makefile.spl | 2 +- + scripts/dtc/Makefile | 2 +- + tools/dtoc/fdt.py | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl +index e2f0741db6..9264103366 100644 +--- a/scripts/Makefile.spl ++++ b/scripts/Makefile.spl +@@ -249,7 +249,7 @@ $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) + $(obj)/$(SPL_BIN).dtb: dts/dt-spl.dtb FORCE + $(call if_changed,copy) + +-pythonpath = PYTHONPATH=scripts/dtc/pylibfdt ++pythonpath = python + + quiet_cmd_dtocc = DTOC C $@ + cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata +diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile +index 90ef2db85c..077acd50d9 100644 +--- a/scripts/dtc/Makefile ++++ b/scripts/dtc/Makefile +@@ -31,4 +31,4 @@ $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h + clean-files := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h + + # Added for U-Boot +-subdir-$(CONFIG_PYLIBFDT) += pylibfdt ++#subdir-$(CONFIG_PYLIBFDT) += pylibfdt +diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py +index dbc338653b..04f3c5935c 100644 +--- a/tools/dtoc/fdt.py ++++ b/tools/dtoc/fdt.py +@@ -10,7 +10,7 @@ import struct + import sys + + import fdt_util +-import libfdt ++from pylibfdt import libfdt + + # This deals with a device tree, presenting it as an assortment of Node and + # Prop objects, representing nodes and properties, respectively. This file diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0002-rockchip-board-use-efuse-cpuid-to-set-ethaddr.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0002-rockchip-board-use-efuse-cpuid-to-set-ethaddr.patch new file mode 100644 index 0000000000..737894292d --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0002-rockchip-board-use-efuse-cpuid-to-set-ethaddr.patch @@ -0,0 +1,99 @@ +From 61b0555d3b8e962f3cac5cf17ab149f4fb318ca3 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Aug 2018 22:55:34 +0200 +Subject: [PATCH] rockchip: board: use efuse cpuid to set ethaddr + +--- + arch/arm/mach-rockchip/board.c | 51 ++++++++++++++++++++++++++++++++++ + 1 file changed, 51 insertions(+) + +diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c +index b56edebf13..155871f5bf 100644 +--- a/arch/arm/mach-rockchip/board.c ++++ b/arch/arm/mach-rockchip/board.c +@@ -31,6 +31,8 @@ + #include + #include + #include ++#include ++#include + + DECLARE_GLOBAL_DATA_PTR; + /* define serialno max length, the max length is 512 Bytes +@@ -44,6 +46,7 @@ DECLARE_GLOBAL_DATA_PTR; + static int rockchip_set_serialno(void) + { + char serialno_str[VENDOR_SN_MAX]; ++ char cpuid_str[CPUID_LEN * 2 + 1]; + int ret = 0, i; + u8 cpuid[CPUID_LEN] = {0}; + u8 low[CPUID_LEN / 2], high[CPUID_LEN / 2]; +@@ -73,6 +76,13 @@ static int rockchip_set_serialno(void) + printf("%s: reading cpuid from the efuses failed\n", __func__); + return ret; + } ++ ++ memset(cpuid_str, 0, sizeof(cpuid_str)); ++ for (i = 0; i < CPUID_LEN; i++) { ++ sprintf(&cpuid_str[i * 2], "%02x", cpuid[i]); ++ } ++ ++ env_set("cpuid#", cpuid_str); + #else + /* generate random cpuid */ + for (i = 0; i < CPUID_LEN; i++) { +@@ -95,6 +105,45 @@ static int rockchip_set_serialno(void) + return ret; + } + ++static void rockchip_set_ethaddr(void) ++{ ++#if CONFIG_IS_ENABLED(CMD_NET) ++ int ret; ++ const char *cpuid = env_get("cpuid#"); ++ u8 hash[SHA256_SUM_LEN]; ++ int size = sizeof(hash); ++ u8 mac_addr[6]; ++ ++ /* Only generate a MAC address, if none is set in the environment */ ++ if (env_get("ethaddr")) ++ return; ++ ++ if (!cpuid) { ++ debug("%s: could not retrieve 'cpuid#'\n", __func__); ++ return; ++ } ++ ++ ret = hash_block("sha256", (void *)cpuid, strlen(cpuid), hash, &size); ++ if (ret) { ++ debug("%s: failed to calculate SHA256\n", __func__); ++ return; ++ } ++ ++ /* Copy 6 bytes of the hash to base the MAC address on */ ++ memcpy(mac_addr, hash, 6); ++ ++ /* Make this a valid MAC address and set it */ ++ mac_addr[0] &= 0xfe; /* clear multicast bit */ ++ mac_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ ++ eth_env_set_enetaddr("ethaddr", mac_addr); ++ ++ /* Make a valid MAC address for eth1 */ ++ mac_addr[5] += 0x20; ++ mac_addr[5] &= 0xff; ++ eth_env_set_enetaddr("eth1addr", mac_addr); ++#endif ++} ++ + #if defined(CONFIG_USB_FUNCTION_FASTBOOT) + int fb_set_reboot_flag(void) + { +@@ -162,6 +211,8 @@ int board_late_init(void) + #endif + rockchip_set_serialno(); + ++ rockchip_set_ethaddr(); ++ + soc_clk_dump(); + + return rk_board_late_init(); diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0003-rockchip-rk3328-get-serial-and-ethaddr-from-efuse.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0003-rockchip-rk3328-get-serial-and-ethaddr-from-efuse.patch new file mode 100644 index 0000000000..35a18c035c --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0003-rockchip-rk3328-get-serial-and-ethaddr-from-efuse.patch @@ -0,0 +1,48 @@ +From c871e961036d58bf1d66b7e79be85777158b7137 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 18 Aug 2018 17:26:35 +0200 +Subject: [PATCH] rockchip: rk3328: get serial and ethaddr from efuse + +--- + arch/arm/dts/rk3328.dtsi | 14 ++++++++++++++ + configs/evb-rk3328_defconfig | 2 ++ + 2 files changed, 16 insertions(+) + +diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi +index 670b98d6fa..88cc185b96 100644 +--- a/arch/arm/dts/rk3328.dtsi ++++ b/arch/arm/dts/rk3328.dtsi +@@ -341,6 +341,20 @@ + }; + }; + ++ efuse: efuse@ff260000 { ++ compatible = "rockchip,rk3328-efuse"; ++ reg = <0x0 0xff260000 0x0 0x80>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ clocks = <&cru SCLK_EFUSE>; ++ clock-names = "pclk_efuse"; ++ ++ /* Data cells */ ++ cpu_id: cpu-id@7 { ++ reg = <0x07 0x10>; ++ }; ++ }; ++ + saradc: saradc@ff280000 { + compatible = "rockchip,rk3328-saradc", "rockchip,saradc"; + reg = <0x0 0xff280000 0x0 0x100>; +diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig +index 79535c760d..0897a28e1d 100644 +--- a/configs/evb-rk3328_defconfig ++++ b/configs/evb-rk3328_defconfig +@@ -52,6 +52,8 @@ CONFIG_SPL_CLK=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_DM_KEY=y ++CONFIG_MISC=y ++CONFIG_ROCKCHIP_EFUSE=y + CONFIG_MMC_DW=y + CONFIG_MMC_DW_ROCKCHIP=y + CONFIG_PHY=y diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0004-rk3328-evb-fix-sdmmc-vmmc-supply.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0004-rk3328-evb-fix-sdmmc-vmmc-supply.patch new file mode 100644 index 0000000000..49a2f91d3b --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0004-rk3328-evb-fix-sdmmc-vmmc-supply.patch @@ -0,0 +1,63 @@ +From caec69d5fc737f971439a1dae391c9b3d5ff4c31 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 10 Jan 2018 19:56:16 +0100 +Subject: [PATCH] rk3328-evb: fix sdmmc vmmc-supply + +--- + arch/arm/dts/rk3328-evb.dts | 7 +++++-- + arch/arm/dts/rk3328.dtsi | 10 ++++++---- + 2 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/dts/rk3328-evb.dts b/arch/arm/dts/rk3328-evb.dts +index aafafec649..497b040f56 100644 +--- a/arch/arm/dts/rk3328-evb.dts ++++ b/arch/arm/dts/rk3328-evb.dts +@@ -28,8 +28,10 @@ + compatible = "regulator-fixed"; + regulator-name = "vcc3v3"; + gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; +- regulator-always-on; +- regulator-boot-on; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0m1_gpio>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + }; + + vcc5v0_otg: vcc5v0-otg-drv { +@@ -75,6 +77,7 @@ + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; ++ vmmc-supply = <&vcc3v3_sdmmc>; + status = "okay"; + }; + +diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi +index 88cc185b96..e920d692ff 100644 +--- a/arch/arm/dts/rk3328.dtsi ++++ b/arch/arm/dts/rk3328.dtsi +@@ -475,8 +475,9 @@ + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff500000 0x0 0x4000>; + max-frequency = <150000000>; +- clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>; +- clock-names = "biu", "ciu"; ++ clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, ++ <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; ++ clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; + status = "disabled"; +@@ -498,8 +499,9 @@ + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff520000 0x0 0x4000>; + max-frequency = <150000000>; +- clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>; +- clock-names = "biu", "ciu"; ++ clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, ++ <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; ++ clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; + status = "disabled"; diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0005-rockchip-rk3288-get-serial-and-ethaddr-from-efuse.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0005-rockchip-rk3288-get-serial-and-ethaddr-from-efuse.patch new file mode 100644 index 0000000000..bf14232101 --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0005-rockchip-rk3288-get-serial-and-ethaddr-from-efuse.patch @@ -0,0 +1,52 @@ +From 050dd4323a9fe8515259fe855c31da6d1ad459e2 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 5 Aug 2018 20:58:54 +0200 +Subject: [PATCH] rockchip: rk3288: get serial and ethaddr from efuse + +--- + arch/arm/dts/rk3288.dtsi | 5 ++--- + configs/miqi-rk3288_defconfig | 2 ++ + configs/tinker-rk3288_defconfig | 1 + + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/dts/rk3288.dtsi b/arch/arm/dts/rk3288.dtsi +index 20adb0dece..8b085ee6dc 100644 +--- a/arch/arm/dts/rk3288.dtsi ++++ b/arch/arm/dts/rk3288.dtsi +@@ -936,9 +936,8 @@ + }; + + efuse: efuse@ffb40000 { +- compatible = "rockchip,rk3288-efuse"; +- reg = <0xffb40000 0x10000>; +- status = "disabled"; ++ compatible = "rockchip,rockchip-efuse"; ++ reg = <0xffb40000 0x20>; + }; + + gic: interrupt-controller@ffc01000 { +diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig +index 09d5979dff..ffbe701cfd 100644 +--- a/configs/miqi-rk3288_defconfig ++++ b/configs/miqi-rk3288_defconfig +@@ -48,6 +48,8 @@ CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_DM_KEY=y + CONFIG_ADC_KEY=y ++CONFIG_MISC=y ++CONFIG_ROCKCHIP_EFUSE=y + CONFIG_MMC_DW=y + CONFIG_MMC_DW_ROCKCHIP=y + CONFIG_DM_ETH=y +diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig +index 3abf7c1088..0afc0a35e1 100644 +--- a/configs/tinker-rk3288_defconfig ++++ b/configs/tinker-rk3288_defconfig +@@ -46,6 +46,7 @@ CONFIG_SPL_CLK=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_MISC=y ++CONFIG_ROCKCHIP_EFUSE=y + CONFIG_I2C_EEPROM=y + CONFIG_MMC_DW=y + CONFIG_MMC_DW_ROCKCHIP=y diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0006-rk3399-evb-use-common-get-serial-and-ethaddr-from-ef.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0006-rk3399-evb-use-common-get-serial-and-ethaddr-from-ef.patch new file mode 100644 index 0000000000..4a1fd0929b --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0006-rk3399-evb-use-common-get-serial-and-ethaddr-from-ef.patch @@ -0,0 +1,172 @@ +From 400e9e6b21878e8570ce1cb0242d93baa6c21c99 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Aug 2018 23:01:10 +0200 +Subject: [PATCH] rk3399-evb: use common get serial and ethaddr from efuse + +--- + board/rockchip/evb_rk3399/evb-rk3399.c | 119 ------------------------- + include/configs/evb_rk3399.h | 3 - + 2 files changed, 122 deletions(-) + +diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c +index b6f730852a..3a6b802a3f 100644 +--- a/board/rockchip/evb_rk3399/evb-rk3399.c ++++ b/board/rockchip/evb_rk3399/evb-rk3399.c +@@ -6,23 +6,17 @@ + + #include + #include +-#include + #include + #include + #include +-#include + #include + #include +-#include + #include + #include + #include + + DECLARE_GLOBAL_DATA_PTR; + +-#define RK3399_CPUID_OFF 0x7 +-#define RK3399_CPUID_LEN 0x10 +- + int rk_board_init(void) + { + struct udevice *pinctrl, *regulator; +@@ -74,119 +68,6 @@ out: + return 0; + } + +-static void setup_macaddr(void) +-{ +-#if CONFIG_IS_ENABLED(CMD_NET) +- int ret; +- const char *cpuid = env_get("cpuid#"); +- u8 hash[SHA256_SUM_LEN]; +- int size = sizeof(hash); +- u8 mac_addr[6]; +- +- /* Only generate a MAC address, if none is set in the environment */ +- if (env_get("ethaddr")) +- return; +- +- if (!cpuid) { +- debug("%s: could not retrieve 'cpuid#'\n", __func__); +- return; +- } +- +- ret = hash_block("sha256", (void *)cpuid, strlen(cpuid), hash, &size); +- if (ret) { +- debug("%s: failed to calculate SHA256\n", __func__); +- return; +- } +- +- /* Copy 6 bytes of the hash to base the MAC address on */ +- memcpy(mac_addr, hash, 6); +- +- /* Make this a valid MAC address and set it */ +- mac_addr[0] &= 0xfe; /* clear multicast bit */ +- mac_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ +- eth_env_set_enetaddr("ethaddr", mac_addr); +-#endif +- +- return; +-} +- +-static void setup_serial(void) +-{ +-#if CONFIG_IS_ENABLED(ROCKCHIP_EFUSE) +- struct udevice *dev; +- int ret, i; +- u8 cpuid[RK3399_CPUID_LEN]; +- u8 low[RK3399_CPUID_LEN/2], high[RK3399_CPUID_LEN/2]; +- char cpuid_str[RK3399_CPUID_LEN * 2 + 1]; +- u64 serialno; +- char serialno_str[16]; +- +- /* retrieve the device */ +- ret = uclass_get_device_by_driver(UCLASS_MISC, +- DM_GET_DRIVER(rockchip_efuse), &dev); +- if (ret) { +- debug("%s: could not find efuse device\n", __func__); +- return; +- } +- +- /* read the cpu_id range from the efuses */ +- ret = misc_read(dev, RK3399_CPUID_OFF, &cpuid, sizeof(cpuid)); +- if (ret) { +- debug("%s: reading cpuid from the efuses failed\n", +- __func__); +- return; +- } +- +- memset(cpuid_str, 0, sizeof(cpuid_str)); +- for (i = 0; i < 16; i++) +- sprintf(&cpuid_str[i * 2], "%02x", cpuid[i]); +- +- debug("cpuid: %s\n", cpuid_str); +- +- /* +- * Mix the cpuid bytes using the same rules as in +- * ${linux}/drivers/soc/rockchip/rockchip-cpuinfo.c +- */ +- for (i = 0; i < 8; i++) { +- low[i] = cpuid[1 + (i << 1)]; +- high[i] = cpuid[i << 1]; +- } +- +- serialno = crc32_no_comp(0, low, 8); +- serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32; +- snprintf(serialno_str, sizeof(serialno_str), "%llx", serialno); +- +- env_set("cpuid#", cpuid_str); +- env_set("serial#", serialno_str); +-#endif +- +- return; +-} +- +-int misc_init_r(void) +-{ +- setup_serial(); +- setup_macaddr(); +- +- return 0; +-} +- +-#ifdef CONFIG_SERIAL_TAG +-void get_board_serial(struct tag_serialnr *serialnr) +-{ +- char *serial_string; +- u64 serial = 0; +- +- serial_string = env_get("serial#"); +- +- if (serial_string) +- serial = simple_strtoull(serial_string, NULL, 16); +- +- serialnr->high = (u32)(serial >> 32); +- serialnr->low = (u32)(serial & 0xffffffff); +-} +-#endif +- + #ifdef CONFIG_USB_DWC3 + static struct dwc3_device dwc3_device_data = { + .maximum_speed = USB_SPEED_HIGH, +diff --git a/include/configs/evb_rk3399.h b/include/configs/evb_rk3399.h +index 5565c7ce53..840d63ff6d 100644 +--- a/include/configs/evb_rk3399.h ++++ b/include/configs/evb_rk3399.h +@@ -18,9 +18,6 @@ + #define CONFIG_SYS_MMC_ENV_DEV 0 + + #define SDRAM_BANK_SIZE (2UL << 30) +-#define CONFIG_MISC_INIT_R +-#define CONFIG_SERIAL_TAG +-#define CONFIG_ENV_OVERWRITE + + #define CONFIG_BMP_16BPP + #define CONFIG_BMP_24BPP diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0007-include-update-log2-header-from-the-Linux-kernel.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0007-include-update-log2-header-from-the-Linux-kernel.patch new file mode 100644 index 0000000000..b4842be48c --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0007-include-update-log2-header-from-the-Linux-kernel.patch @@ -0,0 +1,175 @@ +From dd573f1b6c8e9bd09cb9e8573270bce599553feb Mon Sep 17 00:00:00 2001 +From: Heinrich Schuchardt +Date: Mon, 7 May 2018 22:18:27 +0200 +Subject: [PATCH] include: update log2 header from the Linux kernel +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Without the patch gcc 8 produces: +warning: ignoring attribute ‘noreturn’ because it conflicts with +attribute ‘const’ [-Wattributes] + int ____ilog2_NaN(void); + +So let's update the include from Linux kernel v4.16. + +This removes static checks of ilog2() arguments. + +Signed-off-by: Heinrich Schuchardt +(cherry picked from commit 4a8e72954e11f2c2c37ee138b88a1d9362dba4da) +--- + include/linux/log2.h | 63 ++++++++++++++++++++++++++------------------ + 1 file changed, 37 insertions(+), 26 deletions(-) + +diff --git a/include/linux/log2.h b/include/linux/log2.h +index aa1de63090..b62c07b29f 100644 +--- a/include/linux/log2.h ++++ b/include/linux/log2.h +@@ -4,6 +4,11 @@ + * Written by David Howells (dhowells@redhat.com) + * + * SPDX-License-Identifier: GPL-2.0+ ++ * ++ * 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. + */ + + #ifndef _LINUX_LOG2_H +@@ -12,12 +17,6 @@ + #include + #include + +-/* +- * deal with unrepresentable constant logarithms +- */ +-extern __attribute__((const, noreturn)) +-int ____ilog2_NaN(void); +- + /* + * non-constant log of base 2 calculators + * - the arch may override these in asm/bitops.h if they can be implemented +@@ -40,19 +39,23 @@ int __ilog2_u64(u64 n) + } + #endif + +-/* +- * Determine whether some value is a power of two, where zero is ++/** ++ * is_power_of_2() - check if a value is a power of two ++ * @n: the value to check ++ * ++ * Determine whether some value is a power of two, where zero is + * *not* considered a power of two. ++ * Return: true if @n is a power of 2, otherwise false. + */ +- + static inline __attribute__((const)) + bool is_power_of_2(unsigned long n) + { + return (n != 0 && ((n & (n - 1)) == 0)); + } + +-/* +- * round up to nearest power of two ++/** ++ * __roundup_pow_of_two() - round up to nearest power of two ++ * @n: value to round up + */ + static inline __attribute__((const)) + unsigned long __roundup_pow_of_two(unsigned long n) +@@ -60,8 +63,9 @@ unsigned long __roundup_pow_of_two(unsigned long n) + return 1UL << fls_long(n - 1); + } + +-/* +- * round down to nearest power of two ++/** ++ * __rounddown_pow_of_two() - round down to nearest power of two ++ * @n: value to round down + */ + static inline __attribute__((const)) + unsigned long __rounddown_pow_of_two(unsigned long n) +@@ -70,19 +74,19 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + } + + /** +- * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value +- * @n - parameter ++ * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value ++ * @n: parameter + * + * constant-capable log of base 2 calculation + * - this can be used to initialise global variables from constant data, hence +- * the massive ternary operator construction ++ * the massive ternary operator construction + * + * selects the appropriately-sized optimised version depending on sizeof(n) + */ + #define ilog2(n) \ + ( \ + __builtin_constant_p(n) ? ( \ +- (n) < 1 ? ____ilog2_NaN() : \ ++ (n) < 2 ? 0 : \ + (n) & (1ULL << 63) ? 63 : \ + (n) & (1ULL << 62) ? 62 : \ + (n) & (1ULL << 61) ? 61 : \ +@@ -145,10 +149,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + (n) & (1ULL << 4) ? 4 : \ + (n) & (1ULL << 3) ? 3 : \ + (n) & (1ULL << 2) ? 2 : \ +- (n) & (1ULL << 1) ? 1 : \ +- (n) & (1ULL << 0) ? 0 : \ +- ____ilog2_NaN() \ +- ) : \ ++ 1) : \ + (sizeof(n) <= 4) ? \ + __ilog2_u32(n) : \ + __ilog2_u64(n) \ +@@ -156,7 +157,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + + /** + * roundup_pow_of_two - round the given value up to nearest power of two +- * @n - parameter ++ * @n: parameter + * + * round the given value up to the nearest power of two + * - the result is undefined when n == 0 +@@ -173,7 +174,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + + /** + * rounddown_pow_of_two - round the given value down to nearest power of two +- * @n - parameter ++ * @n: parameter + * + * round the given value down to the nearest power of two + * - the result is undefined when n == 0 +@@ -186,6 +187,12 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + __rounddown_pow_of_two(n) \ + ) + ++static inline __attribute_const__ ++int __order_base_2(unsigned long n) ++{ ++ return n > 1 ? ilog2(n - 1) + 1 : 0; ++} ++ + /** + * order_base_2 - calculate the (rounded up) base 2 order of the argument + * @n: parameter +@@ -199,7 +206,11 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + * ob2(5) = 3 + * ... and so on. + */ +- +-#define order_base_2(n) ilog2(roundup_pow_of_two(n)) +- ++#define order_base_2(n) \ ++( \ ++ __builtin_constant_p(n) ? ( \ ++ ((n) == 0 || (n) == 1) ? 0 : \ ++ ilog2((n) - 1) + 1) : \ ++ __order_base_2(n) \ ++) + #endif /* _LINUX_LOG2_H */ diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0008-rockchip-disable-android-boot-and-config.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0008-rockchip-disable-android-boot-and-config.patch new file mode 100644 index 0000000000..16dc6f7312 --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0008-rockchip-disable-android-boot-and-config.patch @@ -0,0 +1,192 @@ +From d0c3abbbecfe69a73b157451857ca061870ec49b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 18 Aug 2018 17:27:32 +0200 +Subject: [PATCH] rockchip: disable android boot and config + +--- + arch/arm/mach-rockchip/boot_mode.c | 2 +- + configs/evb-rk3328_defconfig | 5 ++--- + configs/evb-rk3399_defconfig | 17 +---------------- + configs/miqi-rk3288_defconfig | 12 +----------- + configs/tinker-rk3288_defconfig | 3 --- + include/configs/rockchip-common.h | 2 -- + 6 files changed, 5 insertions(+), 36 deletions(-) + +diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c +index 8a20a3a31e..9441c49477 100644 +--- a/arch/arm/mach-rockchip/boot_mode.c ++++ b/arch/arm/mach-rockchip/boot_mode.c +@@ -123,9 +123,9 @@ int setup_boot_mode(void) + int boot_mode = BOOT_MODE_NORMAL; + char env_preboot[256] = {0}; + ++#ifdef CONFIG_RKIMG_BOOTLOADER + devtype_num_envset(); + rockchip_dnl_mode_check(); +-#ifdef CONFIG_RKIMG_BOOTLOADER + boot_mode = rockchip_get_boot_mode(); + #endif + switch (boot_mode) { +diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig +index 0897a28e1d..85ee85741e 100644 +--- a/configs/evb-rk3328_defconfig ++++ b/configs/evb-rk3328_defconfig +@@ -39,8 +39,8 @@ CONFIG_TPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_TPL_OF_PLATDATA=y + CONFIG_ENV_IS_IN_MMC=y +-CONFIG_TPL_DM=y + CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_TPL_DM=y + CONFIG_REGMAP=y + CONFIG_SPL_REGMAP=y + CONFIG_TPL_REGMAP=y +@@ -56,12 +56,11 @@ CONFIG_MISC=y + CONFIG_ROCKCHIP_EFUSE=y + CONFIG_MMC_DW=y + CONFIG_MMC_DW_ROCKCHIP=y +-CONFIG_PHY=y +-CONFIG_PHY_ROCKCHIP_INNO_USB2=y + CONFIG_DM_ETH=y + CONFIG_ETH_DESIGNWARE=y + CONFIG_GMAC_ROCKCHIP=y + CONFIG_PHY=y ++CONFIG_PHY_ROCKCHIP_INNO_USB2=y + CONFIG_PINCTRL=y + CONFIG_DM_PMIC=y + CONFIG_PMIC_RK8XX=y +diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig +index 305f0a405d..96aa34b2c0 100644 +--- a/configs/evb-rk3399_defconfig ++++ b/configs/evb-rk3399_defconfig +@@ -5,16 +5,14 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y + CONFIG_SYS_MALLOC_F_LEN=0x4000 + CONFIG_ROCKCHIP_RK3399=y + CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000 +-CONFIG_RKIMG_BOOTLOADER=y +-# CONFIG_USING_KERNEL_DTB is not set + CONFIG_SPL_STACK_R_ADDR=0x80000 + CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb" + CONFIG_DEBUG_UART=y ++# CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_FIT=y + CONFIG_SPL_LOAD_FIT=y + CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py" + # CONFIG_DISPLAY_CPUINFO is not set +-CONFIG_ANDROID_BOOTLOADER=y + CONFIG_SPL_STACK_R=y + CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000 + CONFIG_SPL_ATF=y +@@ -26,18 +24,13 @@ CONFIG_FASTBOOT_FLASH_MMC_DEV=0 + CONFIG_CMD_BOOTZ=y + # CONFIG_CMD_IMLS is not set + CONFIG_CMD_GPT=y +-CONFIG_CMD_LOAD_ANDROID=y +-CONFIG_CMD_BOOT_ANDROID=y +-CONFIG_CMD_BOOT_ROCKCHIP=y + CONFIG_CMD_MMC=y + CONFIG_CMD_SF=y + CONFIG_CMD_USB=y + CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y +-CONFIG_RKPARM_PARTITION=y + CONFIG_SPL_OF_CONTROL=y +-CONFIG_OF_LIVE=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_NET_RANDOM_ETHADDR=y + CONFIG_REGMAP=y +@@ -94,13 +87,5 @@ CONFIG_USB_ETHER_ASIX88179=y + CONFIG_USB_ETHER_MCS7830=y + CONFIG_USB_ETHER_RTL8152=y + CONFIG_USB_ETHER_SMSC95XX=y +-CONFIG_DM_VIDEO=y +-CONFIG_DISPLAY=y +-CONFIG_DRM_ROCKCHIP=y +-CONFIG_DRM_ROCKCHIP_DW_MIPI_DSI=y +-CONFIG_DRM_ROCKCHIP_ANALOGIX_DP=y +-CONFIG_DRM_ROCKCHIP_LVDS=y +-CONFIG_DRM_ROCKCHIP_RGB=y +-CONFIG_LCD=y + CONFIG_USE_TINY_PRINTF=y + CONFIG_ERRNO_STR=y +diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig +index ffbe701cfd..0aa4c903e4 100644 +--- a/configs/miqi-rk3288_defconfig ++++ b/configs/miqi-rk3288_defconfig +@@ -3,12 +3,11 @@ CONFIG_ARCH_ROCKCHIP=y + CONFIG_SYS_MALLOC_F_LEN=0x2000 + CONFIG_ROCKCHIP_RK3288=y + CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y +-CONFIG_RKIMG_BOOTLOADER=y + CONFIG_TARGET_MIQI_RK3288=y + CONFIG_SPL_STACK_R_ADDR=0x80000 + CONFIG_DEFAULT_DEVICE_TREE="rk3288-miqi" + CONFIG_DEBUG_UART=y +-# CONFIG_SILENT_CONSOLE is not set ++# CONFIG_ANDROID_BOOT_IMAGE is not set + # CONFIG_DISPLAY_CPUINFO is not set + CONFIG_SPL_STACK_R=y + CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 +@@ -16,10 +15,6 @@ CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 + CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_I2C=y +-CONFIG_ANDROID_BOOT_IMAGE=y +-CONFIG_ANDROID_BOOTLOADER=y +-CONFIG_CMD_BOOT_ANDROID=y +-CONFIG_CMD_BOOT_ROCKCHIP=y + CONFIG_CMD_MMC=y + CONFIG_CMD_SF=y + CONFIG_CMD_SPI=y +@@ -80,11 +75,6 @@ CONFIG_G_DNL_PRODUCT_NUM=0x320a + CONFIG_USB_HOST_ETHER=y + CONFIG_USB_ETHER_ASIX=y + CONFIG_USB_ETHER_SMSC95XX=y +-CONFIG_DM_VIDEO=y +-CONFIG_DISPLAY=y +-CONFIG_VIDEO_ROCKCHIP=y +-CONFIG_DISPLAY_ROCKCHIP_HDMI=y +-CONFIG_CONSOLE_SCROLL_LINES=10 + CONFIG_USE_TINY_PRINTF=y + CONFIG_CMD_DHRYSTONE=y + CONFIG_ERRNO_STR=y +diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig +index 0afc0a35e1..a6f8c0cb51 100644 +--- a/configs/tinker-rk3288_defconfig ++++ b/configs/tinker-rk3288_defconfig +@@ -3,13 +3,11 @@ CONFIG_ARCH_ROCKCHIP=y + CONFIG_SYS_MALLOC_F_LEN=0x2000 + CONFIG_ROCKCHIP_RK3288=y + CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y +-CONFIG_RKIMG_BOOTLOADER=y + CONFIG_TARGET_TINKER_RK3288=y + CONFIG_SPL_STACK_R_ADDR=0x80000 + CONFIG_DEFAULT_DEVICE_TREE="rk3288-tinker" + CONFIG_DEBUG_UART=y + # CONFIG_ANDROID_BOOT_IMAGE is not set +-# CONFIG_SILENT_CONSOLE is not set + CONFIG_CONSOLE_MUX=y + # CONFIG_DISPLAY_CPUINFO is not set + CONFIG_SPL_STACK_R=y +@@ -19,7 +17,6 @@ CONFIG_SPL_I2C_SUPPORT=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_I2C=y +-CONFIG_CMD_BOOT_ROCKCHIP=y + CONFIG_CMD_MMC=y + CONFIG_CMD_SF=y + CONFIG_CMD_SPI=y +diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h +index f159cbddf3..75a0963953 100644 +--- a/include/configs/rockchip-common.h ++++ b/include/configs/rockchip-common.h +@@ -105,8 +105,6 @@ + "fi; \0" + + #define RKIMG_BOOTCOMMAND \ +- "boot_android ${devtype} ${devnum};" \ +- "bootrkp;" \ + "run distro_bootcmd;" + + #endif diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0009-configs-sync-rk3288-rk3328-and-rk3399-defconfig.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0009-configs-sync-rk3288-rk3328-and-rk3399-defconfig.patch new file mode 100644 index 0000000000..2bfe69e393 --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0009-configs-sync-rk3288-rk3328-and-rk3399-defconfig.patch @@ -0,0 +1,107 @@ +From b9d513e7d18f16cb06ef93a109fb5755f695cb60 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 29 Aug 2018 23:03:07 +0200 +Subject: [PATCH] configs: sync rk3288, rk3328 and rk3399 defconfig + +--- + configs/evb-rk3328_defconfig | 6 +++++- + configs/evb-rk3399_defconfig | 5 +++++ + configs/miqi-rk3288_defconfig | 1 - + configs/tinker-rk3288_defconfig | 2 +- + 4 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig +index 85ee85741e..4388ba32e0 100644 +--- a/configs/evb-rk3328_defconfig ++++ b/configs/evb-rk3328_defconfig +@@ -29,16 +29,20 @@ CONFIG_FASTBOOT_FLASH=y + CONFIG_FASTBOOT_FLASH_MMC_DEV=1 + CONFIG_CMD_BOOTZ=y + # CONFIG_CMD_IMLS is not set ++CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y ++CONFIG_CMD_SF=y + CONFIG_CMD_USB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y ++CONFIG_CMD_PMIC=y ++CONFIG_CMD_REGULATOR=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_TPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_TPL_OF_PLATDATA=y +-CONFIG_ENV_IS_IN_MMC=y + CONFIG_NET_RANDOM_ETHADDR=y + CONFIG_TPL_DM=y + CONFIG_REGMAP=y +diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig +index 96aa34b2c0..84b14a0a6a 100644 +--- a/configs/evb-rk3399_defconfig ++++ b/configs/evb-rk3399_defconfig +@@ -10,6 +10,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb" + CONFIG_DEBUG_UART=y + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y + CONFIG_SPL_LOAD_FIT=y + CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py" + # CONFIG_DISPLAY_CPUINFO is not set +@@ -23,6 +24,7 @@ CONFIG_FASTBOOT_FLASH=y + CONFIG_FASTBOOT_FLASH_MMC_DEV=0 + CONFIG_CMD_BOOTZ=y + # CONFIG_CMD_IMLS is not set ++CONFIG_CMD_GPIO=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_SF=y +@@ -30,6 +32,8 @@ CONFIG_CMD_USB=y + CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y ++CONFIG_CMD_PMIC=y ++CONFIG_CMD_REGULATOR=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_NET_RANDOM_ETHADDR=y +@@ -41,6 +45,7 @@ CONFIG_CLK=y + CONFIG_SPL_CLK=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_DM_KEY=y + CONFIG_MISC=y + CONFIG_ROCKCHIP_EFUSE=y + CONFIG_MMC_DW=y +diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig +index 0aa4c903e4..9559fcbaa2 100644 +--- a/configs/miqi-rk3288_defconfig ++++ b/configs/miqi-rk3288_defconfig +@@ -30,7 +30,6 @@ CONFIG_CMD_REGULATOR=y + CONFIG_SPL_PARTITION_UUIDS=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +-CONFIG_ENV_IS_IN_MMC=y + CONFIG_NET_RANDOM_ETHADDR=y + CONFIG_REGMAP=y + CONFIG_SPL_REGMAP=y +diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig +index a6f8c0cb51..9c4a9f47cf 100644 +--- a/configs/tinker-rk3288_defconfig ++++ b/configs/tinker-rk3288_defconfig +@@ -32,7 +32,6 @@ CONFIG_CMD_REGULATOR=y + CONFIG_SPL_PARTITION_UUIDS=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +-CONFIG_ENV_IS_IN_MMC=y + CONFIG_REGMAP=y + CONFIG_SPL_REGMAP=y + CONFIG_SYSCON=y +@@ -42,6 +41,7 @@ CONFIG_CLK=y + CONFIG_SPL_CLK=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_DM_KEY=y + CONFIG_MISC=y + CONFIG_ROCKCHIP_EFUSE=y + CONFIG_I2C_EEPROM=y diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0010-rk3288-tinker-enable-emmc.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0010-rk3288-tinker-enable-emmc.patch new file mode 100644 index 0000000000..8ef31dbdcb --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0010-rk3288-tinker-enable-emmc.patch @@ -0,0 +1,57 @@ +From f6ac1287103cf1abae453ddaf3e78ef9c204542a Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Thu, 13 Sep 2018 22:23:48 +0200 +Subject: [PATCH] rk3288-tinker: enable emmc + +--- + arch/arm/dts/rk3288-tinker.dtsi | 11 +++++++++++ + include/configs/tinker_rk3288.h | 13 ++++--------- + 2 files changed, 15 insertions(+), 9 deletions(-) + +diff --git a/arch/arm/dts/rk3288-tinker.dtsi b/arch/arm/dts/rk3288-tinker.dtsi +index 81f8d5a6c3..91f6e78ad3 100644 +--- a/arch/arm/dts/rk3288-tinker.dtsi ++++ b/arch/arm/dts/rk3288-tinker.dtsi +@@ -129,6 +129,17 @@ + cpu0-supply = <&vdd_cpu>; + }; + ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ disable-wp; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>; ++ status = "okay"; ++}; ++ + &sdmmc { + bus-width = <4>; + cap-mmc-highspeed; +diff --git a/include/configs/tinker_rk3288.h b/include/configs/tinker_rk3288.h +index 58eea3c405..42878ed8fa 100644 +--- a/include/configs/tinker_rk3288.h ++++ b/include/configs/tinker_rk3288.h +@@ -7,16 +7,11 @@ + #ifndef __CONFIG_H + #define __CONFIG_H + +-#define ROCKCHIP_DEVICE_SETTINGS +-#include +- +-#undef BOOT_TARGET_DEVICES ++#define ROCKCHIP_DEVICE_SETTINGS \ ++ "stdout=serial,vidconsole\0" \ ++ "stderr=serial,vidconsole\0" + +-#define BOOT_TARGET_DEVICES(func) \ +- func(MMC, mmc, 1) \ +- func(USB, usb, 0) \ +- func(PXE, pxe, na) \ +- func(DHCP, dchp, na) ++#include + + #define CONFIG_SYS_MMC_ENV_DEV 1 + diff --git a/packages/tools/u-boot/patches/rockchip/u-boot-0011-Revert-rockchip-dts-rk3328-evb-Enable-gmac2io-for-rk.patch b/packages/tools/u-boot/patches/rockchip/u-boot-0011-Revert-rockchip-dts-rk3328-evb-Enable-gmac2io-for-rk.patch new file mode 100644 index 0000000000..a54394fcea --- /dev/null +++ b/packages/tools/u-boot/patches/rockchip/u-boot-0011-Revert-rockchip-dts-rk3328-evb-Enable-gmac2io-for-rk.patch @@ -0,0 +1,68 @@ +From fc0ea138b00b1a0fb35b5b4e3e2d26c19e2f2d6a Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 16 Sep 2018 11:56:50 +0200 +Subject: [PATCH] Revert "rockchip: dts: rk3328-evb: Enable gmac2io for + rk3328-evb" + +This reverts commit 895e4b943b18d21b2c0c5c24f04bcc626bc3ad91. + +Fixes SDIO issue on RockBox +--- + arch/arm/dts/rk3328-evb.dts | 30 ------------------------------ + 1 file changed, 30 deletions(-) + +diff --git a/arch/arm/dts/rk3328-evb.dts b/arch/arm/dts/rk3328-evb.dts +index 497b040f56..6a5225b48c 100644 +--- a/arch/arm/dts/rk3328-evb.dts ++++ b/arch/arm/dts/rk3328-evb.dts +@@ -17,13 +17,6 @@ + stdout-path = &uart2; + }; + +- gmac_clkin: external-gmac-clock { +- compatible = "fixed-clock"; +- clock-frequency = <125000000>; +- clock-output-names = "gmac_clkin"; +- #clock-cells = <0>; +- }; +- + vcc3v3_sdmmc: sdmmc-pwren { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3"; +@@ -51,13 +44,6 @@ + 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; +- }; + }; + + &saradc { +@@ -93,22 +79,6 @@ + status = "okay"; + }; + +-&gmac2io { +- phy-supply = <&vcc_phy>; +- 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>; +- tx_delay = <0x26>; +- rx_delay = <0x11>; +- status = "okay"; +-}; +- + &u2phy { + status = "okay"; + }; diff --git a/packages/tools/u-boot/release b/packages/tools/u-boot/release deleted file mode 100755 index 6787a2f3fc..0000000000 --- a/packages/tools/u-boot/release +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -. config/options $1 - -if [ -z "$UBOOT_CONFIGFILE" ]; then - UBOOT_CONFIGFILE="boot.scr" -fi - -mkdir -p $RELEASE_DIR/3rdparty/bootloader - if [ -e $BUILD/u-boot-*/$UBOOT_CONFIGFILE ]; then - cp -PR $BUILD/u-boot-*/$UBOOT_CONFIGFILE $RELEASE_DIR/3rdparty/bootloader - fi - - cp -PR $BUILD/u-boot-*/SPL* $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : - cp -PR $BUILD/u-boot-*/u-boot*.imx $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : - cp -PR $BUILD/u-boot-*/u-boot*.img $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : - - cp -PR $PROJECT_DIR/$PROJECT/bootloader/uEnv*.txt $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : - - cp -PR $BUILD/linux-*/arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || : - - case $PROJECT in - Odroid_C2) - cp -PR $BUILD/$BOOTLOADER-*/u-boot.bin $RELEASE_DIR/3rdparty/bootloader/u-boot - cp -PR $PROJECT_DIR/$PROJECT/bootloader/boot.ini $RELEASE_DIR/3rdparty/bootloader - if [ -f $PROJECT_DIR/$PROJECT/splash/boot-logo.bmp.gz ]; then - cp -PR $PROJECT_DIR/$PROJECT/splash/boot-logo.bmp.gz $RELEASE_DIR/3rdparty/bootloader - elif [ -f $DISTRO_DIR/$DISTRO/splash/boot-logo.bmp.gz ]; then - cp -PR $DISTRO_DIR/$DISTRO/splash/boot-logo.bmp.gz $RELEASE_DIR/3rdparty/bootloader - fi - ;; - esac diff --git a/packages/tools/u-boot/scripts/update-c2.sh b/packages/tools/u-boot/scripts/update-c2.sh deleted file mode 100644 index c063567c0a..0000000000 --- a/packages/tools/u-boot/scripts/update-c2.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" -[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" -[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) -if [ -z "$BOOT_DISK" ]; then - case $BOOT_PART in - /dev/sd[a-z][0-9]*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") - ;; - /dev/mmcblk*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") - ;; - esac -fi - -# mount $BOOT_ROOT r/w - mount -o remount,rw $BOOT_ROOT - -# update Device Tree Blobs - for all_dtb in /flash/*.dtb /flash/DTB; do - dtb=$(basename $all_dtb) - if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then - echo "*** updating Device Tree Blob: $dtb ..." - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT - fi - done - -if [ -f $SYSTEM_ROOT/usr/share/bootloader/boot-logo.bmp.gz ]; then - echo "*** updating boot logo ..." - cp -p $SYSTEM_ROOT/usr/share/bootloader/boot-logo.bmp.gz $BOOT_ROOT -fi - -echo "*** updating u-boot for Odroid on: $BOOT_DISK ..." - -dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot of=$BOOT_DISK conv=fsync bs=1 count=112 -dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot of=$BOOT_DISK conv=fsync bs=512 skip=1 seek=1 - -# monkey patch boot.ini for updated kernel - sed -i 's|setenv odroidp1 "no_console_suspend hdmimode=${video_output} m_bpp=${video_bpp} vout=${video_mode}"|setenv odroidp1 "no_console_suspend logo=${logoopt} vout=${outputmode},enable hdmimode=${hdmimode} cvbsmode=nocvbs"|' /flash/boot.ini - sed -i 's|setenv odroidp2 "${disableuhs} consoleblank=0|setenv odroidp2 "mac=${ethaddr} consoleblank=0|' /flash/boot.ini - sed -i 's|setenv bootcmd "${kernel}; ${dtb}; ${timer}; ${bootseq}"|setenv bootcmd "${kernel}; ${dtb}; ${bootseq}"|' /flash/boot.ini - sed -i 's|setenv bootargs "${console} ${bootrootfs} ${odroid} ${cec} ${hpd} ${dac} ${libreelec}"|setenv bootargs "${console} ${bootrootfs} ${odroid} ${cec} ${libreelec}"|' /flash/boot.ini - -# mount $BOOT_ROOT r/o - sync - mount -o remount,ro $BOOT_ROOT diff --git a/packages/tools/u-boot/scripts/update.sh b/packages/tools/u-boot/scripts/update.sh deleted file mode 100755 index 146c162e87..0000000000 --- a/packages/tools/u-boot/scripts/update.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" -[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" -[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) -if [ -z "$BOOT_DISK" ]; then - case $BOOT_PART in - /dev/sd[a-z][0-9]*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") - ;; - /dev/mmcblk*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") - ;; - esac -fi - -SYSTEM_TYPE="" -if [ -f $SYSTEM_ROOT/usr/lib/libreelec/imx6-system-type ]; then - . $SYSTEM_ROOT/usr/lib/libreelec/imx6-system-type -fi - -# mount $BOOT_ROOT r/w - mount -o remount,rw $BOOT_ROOT - -# update Device Tree Blobs - for all_dtb in /flash/*.dtb; do - dtb=$(basename $all_dtb) - if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then - echo "*** updating Device Tree Blob: $dtb ..." - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT - fi - done - -# update bootloader files - if [ "$SYSTEM_TYPE" = "matrix" ]; then - if [ -f $SYSTEM_ROOT/usr/share/bootloader/u-boot-$SYSTEM_TYPE.imx ]; then - echo "*** updating u-boot image in eMMC ..." - # clean up u-boot parameters - #dd if=/dev/zero of=/dev/mmcblk0 bs=1024 seek=384 count=8 - # access boot partition 1 - echo 0 > /sys/block/mmcblk0boot0/force_ro - # write u-boot to eMMC - dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot-$SYSTEM_TYPE.imx of=/dev/mmcblk0boot0 bs=1k seek=1 conv=fsync &>/dev/null - # re-enable read-only access - echo 1 > /sys/block/mmcblk0boot0/force_ro - # enable boot partion 1 to boot - echo 8 > /sys/devices/soc0/soc.1/2100000.aips-bus/219c000.usdhc/mmc_host/mmc2/mmc2:0001/boot_config - fi - else - if [ -n "$SYSTEM_TYPE" ]; then - UBOOT_IMG_SRC=u-boot-$SYSTEM_TYPE.img - SPL_SRC=SPL-$SYSTEM_TYPE - else - UBOOT_IMG_SRC=u-boot.img - SPL_SRC=SPL - fi - - if [ -f $SYSTEM_ROOT/usr/share/bootloader/$UBOOT_IMG_SRC ]; then - echo "*** updating u-boot image: $BOOT_ROOT/u-boot.img ..." - cp -p $SYSTEM_ROOT/usr/share/bootloader/$UBOOT_IMG_SRC $BOOT_ROOT/u-boot.img - fi - - if [ -f $SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC ]; then - echo "*** updating u-boot SPL Blob on: $BOOT_DISK ..." - dd if="$SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC" of="$BOOT_DISK" bs=1k seek=1 conv=fsync &>/dev/null - fi - fi - - # prefer uEnv.txt over boot.scr - if [ -n "$SYSTEM_TYPE" -a -f $SYSTEM_ROOT/usr/share/bootloader/uEnv-$SYSTEM_TYPE.txt -a ! -f $BOOT_ROOT/uEnv.txt ]; then - cp -p $SYSTEM_ROOT/usr/share/bootloader/uEnv-$SYSTEM_TYPE.txt $BOOT_ROOT/uEnv.txt - elif [ -f $SYSTEM_ROOT/usr/share/bootloader/uEnv.txt -a ! -f $BOOT_ROOT/uEnv.txt ]; then - cp -p $SYSTEM_ROOT/usr/share/bootloader/uEnv.txt $BOOT_ROOT - elif [ -f $SYSTEM_ROOT/usr/share/bootloader/boot.scr -a ! -f $BOOT_ROOT/boot.scr ]; then - cp -p $SYSTEM_ROOT/usr/share/bootloader/boot.scr $BOOT_ROOT - fi - -# mount $BOOT_ROOT r/o - sync - mount -o remount,ro $BOOT_ROOT diff --git a/packages/virtual/alsa/package.mk b/packages/virtual/alsa/package.mk index 5d9734a6bf..cff4e25ace 100644 --- a/packages/virtual/alsa/package.mk +++ b/packages/virtual/alsa/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="alsa" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.alsa-project.org/" PKG_URL="" PKG_DEPENDS_TARGET="toolchain alsa-lib alsa-utils" PKG_SECTION="virtual" -PKG_SHORTDESC="alsa: Matapackage to install all alsa components" -PKG_LONGDESC="ALSA (Advanced Linux Sound Architecture) is the next generation Linux Sound API. It provides much finer (->better) access to the sound hardware, has a unbeatable mixer API and supports stuff like multi channel hardware, digital outs and ins, uninterleaved sound data access, and an oss emulation layer (for the old applications). It is the prefered API for professional sound apps under Linux." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Matapackage to install all alsa components." diff --git a/packages/virtual/autotools/package.mk b/packages/virtual/autotools/package.mk index cdf7bfd467..e201e386bb 100644 --- a/packages/virtual/autotools/package.mk +++ b/packages/virtual/autotools/package.mk @@ -1,33 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="autotools" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_HOST="ccache:host autoconf:host automake:host libtool:host intltool:host autoconf-archive:host" +PKG_DEPENDS_HOST="ccache:host autoconf:host automake:host intltool:host libtool:host autoconf-archive:host" PKG_SECTION="virtual" -PKG_SHORTDESC="autotools: Metapackage" -PKG_LONGDESC="" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - +PKG_LONGDESC="autotools: Metapackage" diff --git a/packages/virtual/corefonts/package.mk b/packages/virtual/corefonts/package.mk index 45218c4b4c..c269c60b38 100644 --- a/packages/virtual/corefonts/package.mk +++ b/packages/virtual/corefonts/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="corefonts" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain" PKG_SECTION="virtual" -PKG_SHORTDESC="corefonts: Metapackage for installing fonts" PKG_LONGDESC="corefonts is a Metapackage for installing fonts" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - if [ -n "$CUSTOM_FONTS" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $CUSTOM_FONTS" else diff --git a/packages/virtual/debug/package.mk b/packages/virtual/debug/package.mk index c2ced9e9dc..d2a771cc8b 100644 --- a/packages/virtual/debug/package.mk +++ b/packages/virtual/debug/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="debug" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain gdb" +PKG_DEPENDS_TARGET="toolchain gdb edid-decode memtester" PKG_SECTION="virtual" -PKG_SHORTDESC="debug: Metapackage for installing debugging tools" PKG_LONGDESC="debug is a Metapackage for installing debugging tools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - # configure GPU drivers and dependencies: get_graphicdrivers @@ -38,6 +17,10 @@ if [ "$VDPAU_SUPPORT" = "yes" -a "$DISPLAYSERVER" = "x11" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET vdpauinfo" fi -if [ "$DEBUG" = "yes" -a "$VALGRIND" = "yes" ]; then +if [ "$VAAPI_SUPPORT" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libva-utils" +fi + +if build_with_debug && [ "$VALGRIND" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET valgrind" fi diff --git a/packages/virtual/initramfs/package.mk b/packages/virtual/initramfs/package.mk index 4c2d5e77e4..ef17f196ce 100644 --- a/packages/virtual/initramfs/package.mk +++ b/packages/virtual/initramfs/package.mk @@ -1,60 +1,38 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="initramfs" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain libc:init busybox:init linux:init plymouth-lite:init util-linux:init e2fsprogs:init dosfstools:init" +PKG_DEPENDS_TARGET="toolchain libc:init busybox:init linux:init plymouth-lite:init util-linux:init e2fsprogs:init dosfstools:init fakeroot:host" PKG_SECTION="virtual" -PKG_SHORTDESC="initramfs: Metapackage for installing initramfs" PKG_LONGDESC="debug is a Metapackage for installing initramfs" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - if [ "$ISCSI_SUPPORT" = yes ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET open-iscsi:init" fi if [ "$INITRAMFS_PARTED_SUPPORT" = yes ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET util-linux:init" - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET e2fsprogs:init" PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET parted:init" fi post_install() { - ( cd $ROOT/$BUILD/initramfs - if [ "$TARGET_ARCH" = "x86_64" -o "$TARGET_ARCH" = "powerpc64" ]; then - ln -sf /usr/lib $ROOT/$BUILD/initramfs/lib64 - mkdir -p $ROOT/$BUILD/initramfs/usr - ln -sf /usr/lib $ROOT/$BUILD/initramfs/usr/lib64 + ( cd $BUILD/initramfs + if [ "$TARGET_ARCH" = "x86_64" ]; then + ln -sf /usr/lib $BUILD/initramfs/lib64 + mkdir -p $BUILD/initramfs/usr + ln -sf /usr/lib $BUILD/initramfs/usr/lib64 fi - ln -sf /usr/lib $ROOT/$BUILD/initramfs/lib - ln -sf /usr/bin $ROOT/$BUILD/initramfs/bin - ln -sf /usr/sbin $ROOT/$BUILD/initramfs/sbin + ln -sf /usr/lib $BUILD/initramfs/lib + ln -sf /usr/bin $BUILD/initramfs/bin + ln -sf /usr/sbin $BUILD/initramfs/sbin - mkdir -p $ROOT/$BUILD/image/ + mkdir -p $BUILD/image/ fakeroot -- sh -c \ - "mkdir -p dev; mknod -m 600 dev/console c 5 1; find . | cpio -H newc -ov -R 0:0 > $ROOT/$BUILD/image/initramfs.cpio" + "mkdir -p dev; mknod -m 600 dev/console c 5 1; find . | cpio -H newc -ov -R 0:0 > $BUILD/image/initramfs.cpio" ) } diff --git a/packages/virtual/libc/package.mk b/packages/virtual/libc/package.mk index 10118e3964..8eee785588 100644 --- a/packages/virtual/libc/package.mk +++ b/packages/virtual/libc/package.mk @@ -1,39 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libc" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain glibc tz" PKG_DEPENDS_INIT="toolchain glibc:init" PKG_SECTION="virtual" -PKG_SHORTDESC="libc: Metapackage" -PKG_LONGDESC="" -PKG_SHORTDESC="libc: Meta package for installing various tools and libs needed for libc" PKG_LONGDESC="Meta package for installing various tools and libs needed for libc" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - if [ "$BOOTLOADER" = "bcm2835-bootloader" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET arm-mem" PKG_DEPENDS_INIT="$PKG_DEPENDS_INIT arm-mem:init" diff --git a/packages/virtual/linux-drivers/package.mk b/packages/virtual/linux-drivers/package.mk index 1004f1e1e5..5933bc45ec 100644 --- a/packages/virtual/linux-drivers/package.mk +++ b/packages/virtual/linux-drivers/package.mk @@ -1,32 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="linux-drivers" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv" +PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain $ADDITIONAL_DRIVERS" PKG_SECTION="virtual" -PKG_SHORTDESC="linux-drivers: Meta package to install additional drivers" PKG_LONGDESC="linux-drivers is a Meta package to install additional drivers" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +if [ "$DRIVER_ADDONS_SUPPORT" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $DRIVER_ADDONS driverselect" +fi diff --git a/packages/virtual/linux-firmware/package.mk b/packages/virtual/linux-firmware/package.mk index 63dc45b6d5..fa377ebba1 100644 --- a/packages/virtual/linux-firmware/package.mk +++ b/packages/virtual/linux-firmware/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="linux-firmware" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="" PKG_URL="" PKG_DEPENDS_TARGET="toolchain $FIRMWARE" PKG_SECTION="virtual" -PKG_SHORTDESC="linux-firmware: various free firmware drivers" PKG_LONGDESC="linux-firmware is a meta-package to install various free firmware drivers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/virtual/mediacenter/package.mk b/packages/virtual/mediacenter/package.mk index 086b5cfb75..e9aa1b0dc8 100644 --- a/packages/virtual/mediacenter/package.mk +++ b/packages/virtual/mediacenter/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mediacenter" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain $MEDIACENTER" PKG_SECTION="virtual" -PKG_SHORTDESC="Mediacenter: Metapackage" -PKG_LONGDESC="" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Mediacenter: Metapackage" if [ "$MEDIACENTER" = "kodi" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $MEDIACENTER-theme-$SKIN_DEFAULT" @@ -37,13 +17,40 @@ if [ "$MEDIACENTER" = "kodi" ]; then for i in $SKINS; do PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $MEDIACENTER-theme-$i" done - + +# python-based tool for kodi management + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET texturecache.py" + +# some python stuff needed for various addons + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET Pillow \ + simplejson \ + pycryptodome" + +# settings addon + if [ -n "$DISTRO_PKG_SETTINGS" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $DISTRO_PKG_SETTINGS" + fi + +# other packages + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xmlstarlet" + + if [ "$JOYSTICK_SUPPORT" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET peripheral.joystick" + fi + + get_graphicdrivers + if listcontains "$GRAPHIC_DRIVERS" "(i915|i965)"; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET intel-vaapi-driver" + fi + +fi + +if [ "$MEDIACENTER" = "plexht" ]; then # some python stuff needed for various addons PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET Pillow \ simplejson \ pycrypto" # other packages - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET LibreELEC-settings \ - xmlstarlet \ - peripheral.joystick" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET OpenPHT-settings \ + xmlstarlet" fi diff --git a/packages/virtual/misc-packages/package.mk b/packages/virtual/misc-packages/package.mk new file mode 100644 index 0000000000..cc4a6f71ad --- /dev/null +++ b/packages/virtual/misc-packages/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="misc-packages" +PKG_VERSION="" +PKG_LICENSE="GPL" +PKG_SITE="https://libreelec.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain $ADDITIONAL_PACKAGES" +PKG_SECTION="virtual" +PKG_LONGDESC="misc-packages: Metapackage for miscellaneous packages" diff --git a/packages/virtual/network/package.mk b/packages/virtual/network/package.mk index cecc012397..76a14503a3 100644 --- a/packages/virtual/network/package.mk +++ b/packages/virtual/network/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="network" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="various" PKG_SITE="http://www.openelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="toolchain connman iana-etc ethtool openssh" +PKG_DEPENDS_TARGET="toolchain connman netbase ethtool openssh" PKG_SECTION="virtual" -PKG_SHORTDESC="network: Metapackage for packages to install network support" -PKG_LONGDESC="network: Metapackage for various packages to install network support" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Metapackage for various packages to install network support" if [ "$BLUETOOTH_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET bluez" @@ -42,3 +21,8 @@ fi if [ "$OPENVPN_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET openvpn" fi + +# nss needed by inputstream.adaptive, chromium etc. +if [ "$TARGET_ARCH" = "x86_64" ] || [ "$TARGET_ARCH" = "arm" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET nss" +fi diff --git a/packages/virtual/remote/package.mk b/packages/virtual/remote/package.mk index dd06f09e22..8a2255699a 100644 --- a/packages/virtual/remote/package.mk +++ b/packages/virtual/remote/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="remote" PKG_VERSION="1" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.openelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="toolchain eventlircd libirman v4l-utils" PKG_SECTION="virtual" -PKG_SHORTDESC="remote: Meta package for installing various tools needed for remote support" PKG_LONGDESC="Meta package for installing various tools needed for remote support" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - if [ "$ATVCLIENT_SUPPORT" = "yes" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET atvclient" fi diff --git a/packages/virtual/toolchain/package.mk b/packages/virtual/toolchain/package.mk index eb9152e264..537758c8cc 100644 --- a/packages/virtual/toolchain/package.mk +++ b/packages/virtual/toolchain/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="toolchain" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" -PKG_SITE="http://www.openelec.tv" +PKG_SITE="https://libreelec.tv" PKG_URL="" -PKG_DEPENDS_TARGET="configtools:host make:host xz:host sed:host pkg-config:host autoconf:host automake:host libtool:host intltool:host autoconf-archive:host gcc:host bison:host flex:host cmake:host yasm:host" +PKG_DEPENDS_TARGET="configtools:host make:host xz:host sed:host pkg-config:host autoconf:host automake:host intltool:host libtool:host autoconf-archive:host gcc:host bison:host flex:host cmake:host xmlstarlet:host p7zip:host ninja:host meson:host" PKG_SECTION="virtual" -PKG_SHORTDESC="toolchain: OpenELEC.tv' toolchain" -PKG_LONGDESC="a crosscompiling toolchain to compile all packages" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="LibreELEC.tv' toolchain to compile all packages" diff --git a/packages/virtual/virtual/package.mk b/packages/virtual/virtual/package.mk index 878b36e494..1cb651f2a6 100644 --- a/packages/virtual/virtual/package.mk +++ b/packages/virtual/virtual/package.mk @@ -1,32 +1,15 @@ -################################################################################ -# This file is part of LibreELEC - http://www.libreelec.tv -# Copyright (C) 2016- Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="virtual" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.libreelec.tv" PKG_URL="" PKG_DEPENDS_TARGET="qemu:host" PKG_SECTION="virtual" -PKG_SHORTDESC="virtual: Meta package to install Virtual project extra deps" PKG_LONGDESC="virtual is a Meta package to install Virtual project extra dependencies" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +get_graphicdrivers + +listcontains "$GRAPHIC_DRIVERS" "vmware" && PKG_DEPENDS_TARGET+=" open-vm-tools" || true diff --git a/packages/virtual/x11/package.mk b/packages/virtual/x11/package.mk index 953d2faa23..bd18d16abb 100644 --- a/packages/virtual/x11/package.mk +++ b/packages/virtual/x11/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="x11" PKG_VERSION="" -PKG_REV="1" -PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="" PKG_DEPENDS_TARGET="toolchain xorg-server" PKG_SECTION="virtual" -PKG_SHORTDESC="x11: the Windowing system" PKG_LONGDESC="X11 is the Windowing system" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - # Additional packages we need for using xorg-server: # Fonts PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET encodings font-xfree86-type1 font-bitstream-type1 font-misc-misc" @@ -47,7 +26,7 @@ fi get_graphicdrivers -# Drivers +# Drivers if [ -n "$LIBINPUT" ]; then PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xf86-input-libinput" else diff --git a/packages/wayland/libinput/package.mk b/packages/wayland/libinput/package.mk index 1c627057d9..938954e0b5 100644 --- a/packages/wayland/libinput/package.mk +++ b/packages/wayland/libinput/package.mk @@ -1,40 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libinput" -PKG_VERSION="1.5.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.10.4" +PKG_SHA256="2330a82f3e4b617a4f9ff0f2bf9cc217b3c4e69d767e61ca59ca07add61f68ac" PKG_LICENSE="GPL" PKG_SITE="http://www.freedesktop.org/wiki/Software/libinput/" PKG_URL="http://www.freedesktop.org/software/libinput/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_DEPENDS_TARGET="toolchain systemd libevdev mtdev" -PKG_SECTION="wayland" -PKG_SHORTDESC="libinput is a library to handle input devices in Wayland compositors and to provide a generic X.Org input driver." PKG_LONGDESC="libinput is a library to handle input devices in Wayland compositors and to provide a generic X.Org input driver." +PKG_TOOLCHAIN="meson" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--with-sysroot=$SYSROOT_PREFIX \ - --enable-shared \ - --disable-static \ - --disable-documentation \ - --disable-event-gui \ - --disable-tests \ - --disable-libwacom" +PKG_MESON_OPTS_TARGET="-Dlibwacom=false \ + -Ddebug-gui=false \ + -Dtests=false \ + -Ddocumentation=false" diff --git a/packages/wayland/libxkbcommon/package.mk b/packages/wayland/libxkbcommon/package.mk index 46811aee05..483fce9e5a 100644 --- a/packages/wayland/libxkbcommon/package.mk +++ b/packages/wayland/libxkbcommon/package.mk @@ -1,38 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libxkbcommon" -PKG_VERSION="0.6.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.7.1" +PKG_SHA256="ba59305d2e19e47c27ea065c2e0df96ebac6a3c6e97e28ae5620073b6084e68b" PKG_LICENSE="OSS" PKG_SITE="http://xkbcommon.org" PKG_URL="http://xkbcommon.org/download/${PKG_NAME}-${PKG_VERSION}.tar.xz" -PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="wayland" -PKG_SHORTDESC="xkbcommon: a library to handle keyboard descriptions" -PKG_LONGDESC="xkbcommon is a library to handle keyboard descriptions, including loading them from disk, parsing them and handling their state. It's mainly meant for client toolkits, window systems, and other system applications; currently that includes Wayland, kmscon, GTK+, Qt, Clutter, and more. It is also used by some XCB applications for proper keyboard support." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain xkeyboard-config" +PKG_LONGDESC="xkbcommon is a library to handle keyboard descriptions." if [ "$DISPLAYSERVER" = "x11" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET xkeyboard-config" PKG_CONFIGURE_OPTS_TARGET="--enable-x11" else PKG_CONFIGURE_OPTS_TARGET="--disable-x11" diff --git a/packages/wayland/mtdev/package.mk b/packages/wayland/mtdev/package.mk index 8124160e78..016a71cf57 100644 --- a/packages/wayland/mtdev/package.mk +++ b/packages/wayland/mtdev/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="mtdev" PKG_VERSION="1.1.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="6677d5708a7948840de734d8b4675d5980d4561171c5a8e89e54adf7a13eba7f" PKG_LICENSE="MIT" PKG_SITE="http://bitmath.org" PKG_URL="http://bitmath.org/code/mtdev/${PKG_NAME}-${PKG_VERSION}.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="wayland" -PKG_SHORTDESC="The mtdev is a stand-alone library which transforms all variants of kernel MT events to the slotted type B protocol." -PKG_LONGDESC="The mtdev is a stand-alone library which transforms all variants of kernel MT events to the slotted type B protocol. The events put into mtdev may be from any MT device, specifically type A without contact tracking, type A with contact tracking, or type B with contact tracking. See the kernel documentation for further details." +PKG_LONGDESC="The mtdev is a stand-alone library which transforms all variants of kernel MT events to the slotted type B protocol." +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" \ No newline at end of file +PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/wayland/wayland-protocols/package.mk b/packages/wayland/wayland-protocols/package.mk new file mode 100644 index 0000000000..67152e0b99 --- /dev/null +++ b/packages/wayland/wayland-protocols/package.mk @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="wayland-protocols" +PKG_VERSION="1.12" +PKG_SHA256="3b19e8a9e1e19474756a7069db23b90ca9b8ebb438448c6063b4a7fc89b7c8b2" +PKG_LICENSE="OSS" +PKG_SITE="https://wayland.freedesktop.org/" +PKG_URL="https://wayland.freedesktop.org/releases/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Specifications of extended Wayland protocols" + +post_makeinstall_target() { + rm -rf $INSTALL +} diff --git a/packages/wayland/wayland/package.mk b/packages/wayland/wayland/package.mk new file mode 100644 index 0000000000..2140ae69ec --- /dev/null +++ b/packages/wayland/wayland/package.mk @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="wayland" +PKG_VERSION="1.14.0" +PKG_SHA256="ed80cabc0961a759a42092e2c39aabfc1ec9a13c86c98bbe2b812f008da27ab8" +PKG_LICENSE="OSS" +PKG_SITE="https://wayland.freedesktop.org/" +PKG_URL="https://wayland.freedesktop.org/releases/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain wayland:host libxml2" +PKG_DEPENDS_HOST="libffi:host expat:host libxml2:host" +PKG_LONGDESC="a display server protocol" + +PKG_CONFIGURE_OPTS_HOST="--enable-shared \ + --disable-static \ + --disable-libraries \ + --disable-documentation \ + --with-gnu-ld" + +PKG_CONFIGURE_OPTS_TARGET="--with-sysroot=$SYSROOT_PREFIX \ + --with-host-scanner \ + --enable-shared \ + --disable-static \ + --enable-libraries \ + --disable-documentation \ + --with-gnu-ld" + +post_makeinstall_target() { + rm -rf $INSTALL/usr/bin + rm -rf $INSTALL/usr/share + + cp $TOOLCHAIN/lib/pkgconfig/wayland-scanner.pc $SYSROOT_PREFIX/usr/lib/pkgconfig/ +} diff --git a/packages/wayland/waylandpp/package.mk b/packages/wayland/waylandpp/package.mk new file mode 100644 index 0000000000..7548f0e488 --- /dev/null +++ b/packages/wayland/waylandpp/package.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="waylandpp" +PKG_VERSION="0.1.6" +PKG_SHA256="33d3ec385704c5545fb50d2283aabf4ef26aaaf3e416b292e650fea67c430d23" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/NilsBrause/waylandpp" +PKG_URL="https://github.com/NilsBrause/waylandpp/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain waylandpp:host" +PKG_LONGDESC="Wayland C++ bindings" + +PKG_CMAKE_OPTS_HOST="-DBUILD_SCANNER=ON \ + -DBUILD_LIBRARIES=OFF" + +PKG_CMAKE_OPTS_TARGET="-DBUILD_SCANNER=OFF \ + -DBUILD_LIBRARIES=ON \ + -DCMAKE_CROSSCOMPILING=ON \ + -DWAYLAND_SCANNERPP=$TOOLCHAIN/bin/wayland-scanner++" diff --git a/packages/wayland/weston/config/weston.ini b/packages/wayland/weston/config/weston.ini new file mode 100644 index 0000000000..b48f9c30c4 --- /dev/null +++ b/packages/wayland/weston/config/weston.ini @@ -0,0 +1,13 @@ +[core] +idle-time=0 + +[shell] +locking=false + +[launcher] +path=/usr/lib/kodi/kodi.bin +icon=/usr/share/kodi/media/icon16x16.png + +[launcher] +icon=/usr/share/weston/terminal.png +path=/usr/bin/weston-terminal diff --git a/packages/wayland/weston/package.mk b/packages/wayland/weston/package.mk new file mode 100644 index 0000000000..d20434169b --- /dev/null +++ b/packages/wayland/weston/package.mk @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="weston" +PKG_VERSION="3.0.0" +PKG_SHA256="cde1d55e8dd70c3cbb3d1ec72f60e60000041579caa1d6a262bd9c35e93723a5" +PKG_LICENSE="OSS" +PKG_SITE="https://wayland.freedesktop.org/" +PKG_URL="https://wayland.freedesktop.org/releases/${PKG_NAME}-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_TARGET="toolchain wayland-protocols libdrm libxkbcommon libinput cairo libjpeg-turbo dbus" +PKG_LONGDESC="Reference implementation of a Wayland compositor" + +PKG_CONFIGURE_OPTS_TARGET="CFLAGS=-DMESA_EGL_NO_X11_HEADERS \ + LIBS=-lturbojpeg \ + --with-cairo-glesv2 \ + --disable-xwayland \ + --disable-x11-compositor \ + --disable-xwayland-test \ + --disable-libunwind \ + --disable-colord \ + --disable-ivi-shell \ + --disable-fbdev-compositor \ + --disable-rdp-compositor \ + --disable-screen-sharing \ + --disable-vaapi-recorder \ + --disable-headless-compositor \ + --enable-systemd-login \ + --disable-weston-launch \ + --disable-fullscreen-shell \ + --disable-demo-clients-install \ + --enable-systemd-notify" + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/lib/weston + cp $PKG_DIR/scripts/weston-config $INSTALL/usr/lib/weston + + mkdir -p $INSTALL/usr/share/weston + cp $PKG_DIR/config/weston.ini $INSTALL/usr/share/weston + + rm -r $INSTALL/usr/share/wayland-sessions + rm -r $INSTALL/usr/lib/weston-simple-im +} + +post_install() { + enable_service weston.service +} diff --git a/packages/wayland/weston/profile.d/04-weston.conf b/packages/wayland/weston/profile.d/04-weston.conf new file mode 100644 index 0000000000..59e265882b --- /dev/null +++ b/packages/wayland/weston/profile.d/04-weston.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +export XDG_RUNTIME_DIR=/var/run/0-runtime-dir diff --git a/packages/wayland/weston/scripts/weston-config b/packages/wayland/weston/scripts/weston-config new file mode 100755 index 0000000000..b265a1b31a --- /dev/null +++ b/packages/wayland/weston/scripts/weston-config @@ -0,0 +1,15 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +export XDG_RUNTIME_DIR=/var/run/0-runtime-dir + +if [ ! -d "$XDG_RUNTIME_DIR" ]; then + mkdir "$XDG_RUNTIME_DIR" + chmod 0700 "$XDG_RUNTIME_DIR" +fi + +if [ ! -f /storage/.config/weston.ini ]; then + cp /usr/share/weston/weston.ini /storage/.config/weston.ini +fi diff --git a/packages/wayland/weston/system.d/weston.service b/packages/wayland/weston/system.d/weston.service new file mode 100644 index 0000000000..a776af3dfc --- /dev/null +++ b/packages/wayland/weston/system.d/weston.service @@ -0,0 +1,18 @@ +[Unit] +Description=Weston Launcher +Before=graphical.target +After=multi-user.target +ConditionKernelCommandLine=!installer + +[Service] +Environment=HOME=/storage +Environment=XDG_RUNTIME_DIR=/var/run/0-runtime-dir +WorkingDirectory=/storage +ExecStartPre=-/usr/lib/weston/weston-config +ExecStart=/usr/bin/weston --tty=1 --log=/var/log/weston.log +Restart=always +RestartSec=10 + +[Install] +Alias=display-manager.service +WantedBy=graphical.target diff --git a/packages/web/curl/package.mk b/packages/web/curl/package.mk index e14dc41f24..16c69226e4 100644 --- a/packages/web/curl/package.mk +++ b/packages/web/curl/package.mk @@ -1,23 +1,9 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) # Notes: -# - build curl with OpenSSL support instead GnuTLS support to +# - build curl with OpenSSL support instead GnuTLS support to # work around a long standing bug on Pi where https streams often hang on # start. This hang is normally fatal and requires a reboot. # see also http://trac.xbmc.org/ticket/14674 . @@ -25,20 +11,14 @@ # there: http://forum.xbmc.org/showthread.php?tid=177557 PKG_NAME="curl" -PKG_VERSION="7.52.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="7.62.0" +PKG_SHA256="7802c54076500be500b171fde786258579d60547a3a35b8c5a23d8c88e8f9620" PKG_LICENSE="MIT" PKG_SITE="http://curl.haxx.se" PKG_URL="http://curl.haxx.se/download/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain zlib libressl rtmpdump" -PKG_SECTION="web" -PKG_SHORTDESC="curl: Client and library for (HTTP, HTTPS, FTP, ...) transfers" -PKG_LONGDESC="Curl is a client to get documents/files from or send documents to a server, using any of the supported protocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction or any kind of interactivity." - -PKG_IS_ADDON="no" -PKG_USE_CMAKE="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain zlib openssl rtmpdump" +PKG_LONGDESC="Client and library for (HTTP, HTTPS, FTP, ...) transfers." +PKG_TOOLCHAIN="configure" PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_rtmp_RTMP_Init=yes \ ac_cv_header_librtmp_rtmp_h=yes \ @@ -87,7 +67,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_rtmp_RTMP_Init=yes \ --with-ssl \ --without-polarssl \ --without-nss \ - --with-ca-bundle=/etc/ssl/cert.pem \ + --with-ca-bundle=/run/libreelec/cacert.pem \ --without-ca-path \ --without-libpsl \ --without-libmetalink \ diff --git a/packages/web/libmicrohttpd/package.mk b/packages/web/libmicrohttpd/package.mk index df52bd0daa..885772a717 100644 --- a/packages/web/libmicrohttpd/package.mk +++ b/packages/web/libmicrohttpd/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see http://www.gnu.org/licenses/>. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libmicrohttpd" -PKG_VERSION="0.9.51" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.9.61" +PKG_SHA256="dbc469b4a930a79e61f67dc69c665317d44d9d8eb8378d1bd715775ea849d435" PKG_LICENSE="LGPLv2.1" PKG_SITE="http://www.gnu.org/software/libmicrohttpd/" PKG_URL="http://ftpmirror.gnu.org/libmicrohttpd/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="web" -PKG_SHORTDESC="libmicrohttpd: a small webserver C library" -PKG_LONGDESC="GNU libmicrohttpd is a small C library that is supposed to make it easy to run an HTTP server as part of another application." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="A small C library that is supposed to make it easy to run an HTTP server as part of another application." PKG_CONFIGURE_OPTS_TARGET="--disable-shared \ --enable-static \ diff --git a/packages/web/libmicrohttpd/patches/libmicrohttpd-001-remove-extra-unescape-PR14991.patch b/packages/web/libmicrohttpd/patches/libmicrohttpd-001-remove-extra-unescape-PR14991.patch new file mode 100644 index 0000000000..0ca847d01a --- /dev/null +++ b/packages/web/libmicrohttpd/patches/libmicrohttpd-001-remove-extra-unescape-PR14991.patch @@ -0,0 +1,15 @@ +diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c +index abc622e..cd4e825 100644 +--- a/src/microhttpd/connection.c ++++ b/src/microhttpd/connection.c +@@ -2307,10 +2307,6 @@ parse_initial_message_line (struct MHD_Connection *connection, + &connection_add_header, + &unused_num_headers); + } +- if (NULL != uri) +- daemon->unescape_callback (daemon->unescape_callback_cls, +- connection, +- uri); + connection->url = curi; + return MHD_YES; + } diff --git a/packages/x11/app/setxkbmap/package.mk b/packages/x11/app/setxkbmap/package.mk index 3a7fb60ccf..e74cf61ec7 100644 --- a/packages/x11/app/setxkbmap/package.mk +++ b/packages/x11/app/setxkbmap/package.mk @@ -1,32 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="setxkbmap" PKG_VERSION="1.3.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="a9ddb3963f263ba13f0ea105d8c45a531832140530217cc559587bb94f02d3e1" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/app/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libX11 libxkbfile" -PKG_SECTION="x11/app" -PKG_SHORTDESC="setxkbmap: Sets the keyboard using the X Keyboard Extension" PKG_LONGDESC="Setxkbmap sets the keyboard using the X Keyboard Extension." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" diff --git a/packages/x11/app/xkbcomp/package.mk b/packages/x11/app/xkbcomp/package.mk index de19e0e012..fdee2edcb6 100644 --- a/packages/x11/app/xkbcomp/package.mk +++ b/packages/x11/app/xkbcomp/package.mk @@ -1,35 +1,13 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xkbcomp" -PKG_VERSION="1.3.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.4.1" +PKG_SHA256="748dc4cf58ac95684106bd9cf163ac6ab7de9a236faec02a6f4d4006d63a5736" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/app/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros libX11" -PKG_SECTION="x11/app" -PKG_SHORTDESC="xkbcomp: Compiles XKB keyboard description" PKG_LONGDESC="The xkbcomp keymap compiler converts a description of an XKB keymap into one of several output formats." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-xkb-config-root=$XORG_PATH_XKB" - diff --git a/packages/x11/app/xrandr/package.mk b/packages/x11/app/xrandr/package.mk index 2064b24ff1..28c98e36c4 100644 --- a/packages/x11/app/xrandr/package.mk +++ b/packages/x11/app/xrandr/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xrandr" PKG_VERSION="1.5.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="c1cfd4e1d4d708c031d60801e527abc9b6d34b85f2ffa2cadd21f75ff38151cd" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/app/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros libXrandr" -PKG_SECTION="x11/app" -PKG_SHORTDESC="xrandr: A primitive command line interface to RandR extension" PKG_LONGDESC="Xrandr is a primitive command line interface to the RandR extension and used to set the screen size, orientation and/or reflection." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - post_makeinstall_target() { rm -rf $INSTALL/usr/bin/xkeystone } diff --git a/packages/x11/data/xkeyboard-config/package.mk b/packages/x11/data/xkeyboard-config/package.mk index 1f8d3f18fc..7260513fae 100644 --- a/packages/x11/data/xkeyboard-config/package.mk +++ b/packages/x11/data/xkeyboard-config/package.mk @@ -1,45 +1,33 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xkeyboard-config" -PKG_VERSION="2.19" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.23.1" +PKG_SHA256="2a4bbc05fea22151b7a7c8ac2655d549aa9b0486bedc7f5a68c72716343b02f3" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://www.x.org/releases/individual/data/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xkbcomp" -PKG_SECTION="x11/data" -PKG_SHORTDESC="xkeyboard-config: X keyboard extension data files" PKG_LONGDESC="X keyboard extension data files." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +if [ "$DISPLAYSERVER" = "x11" ]; then + PKG_DEPENDS_TARGET="toolchain util-macros xkbcomp" + DISPLAYSERVER_XKEYBOARD="XKBCOMP=/usr/bin/xkbcomp \ + --with-xkb-base=$XORG_PATH_XKB \ + --with-xkb-rules-symlink=xorg" + +else + PKG_DEPENDS_TARGET="toolchain util-macros" + DISPLAYSERVER_XKEYBOARD="" +fi -PKG_CONFIGURE_OPTS_TARGET="XKBCOMP=/usr/bin/xkbcomp \ - --without-xsltproc \ +PKG_CONFIGURE_OPTS_TARGET="--without-xsltproc \ --enable-compat-rules \ - --enable-runtime-deps \ + --disable-runtime-deps \ --enable-nls \ --disable-rpath \ - --with-xkb-base=$XORG_PATH_XKB \ - --with-xkb-rules-symlink=xorg \ - --with-gnu-ld" + --with-gnu-ld \ + $DISPLAYSERVER_XKEYBOARD" pre_build_target() { # broken autoreconf diff --git a/packages/x11/driver/xf86-input-evdev/package.mk b/packages/x11/driver/xf86-input-evdev/package.mk index 76c0a52707..e83dd8198c 100644 --- a/packages/x11/driver/xf86-input-evdev/package.mk +++ b/packages/x11/driver/xf86-input-evdev/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xf86-input-evdev" -PKG_VERSION="2.10.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.10.5" +PKG_SHA256="9edaa6205baf6d2922cc4db3d8e54a7e7773b5f733b0ae90f6be7725f983b70d" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/driver/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros inputproto libevdev mtdev systemd" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-input-evdev: Generic Xorg Linux input driver" -PKG_LONGDESC="Evdev is an Xorg input driver for Linux's generic event devices. It therefore supports all input devices that the kernel knows about, including most mice and keyboards." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_DEPENDS_TARGET="toolchain util-macros libevdev mtdev systemd" +PKG_LONGDESC="Evdev is an Xorg input driver for Linux's generic event devices." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ --with-xorg-module-dir=$XORG_PATH_MODULES \ diff --git a/packages/x11/driver/xf86-input-libinput/package.mk b/packages/x11/driver/xf86-input-libinput/package.mk index 5ccd6c288f..c806a8019a 100644 --- a/packages/x11/driver/xf86-input-libinput/package.mk +++ b/packages/x11/driver/xf86-input-libinput/package.mk @@ -1,39 +1,19 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xf86-input-libinput" -PKG_VERSION="0.23.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.26.0" +PKG_SHA256="abca558fc2226f295691f1cf3412d4c0edeaa439f677ca25b5c9fab310d2387b" PKG_LICENSE="GPL" PKG_SITE="http://www.freedesktop.org/wiki/Software/libinput/" PKG_URL="http://xorg.freedesktop.org/archive/individual/driver/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libinput" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="This is an X driver based on libinput." PKG_LONGDESC="This is an X driver based on libinput." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--with-xorg-module-dir=$XORG_PATH_MODULES" post_makeinstall_target() { mkdir -p $INSTALL/usr/share/X11/xorg.conf.d - cp $ROOT/$PKG_BUILD/conf/*-libinput.conf $INSTALL/usr/share/X11/xorg.conf.d + cp $PKG_BUILD/conf/*-libinput.conf $INSTALL/usr/share/X11/xorg.conf.d } diff --git a/packages/x11/driver/xf86-input-synaptics/package.mk b/packages/x11/driver/xf86-input-synaptics/package.mk index 347afed2ff..abbdf178aa 100644 --- a/packages/x11/driver/xf86-input-synaptics/package.mk +++ b/packages/x11/driver/xf86-input-synaptics/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xf86-input-synaptics" PKG_VERSION="1.9.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="afba3289d7a40217a19d90db98ce181772f9ca6d77e1898727b0afcf02073b5a" PKG_LICENSE="GPL" PKG_SITE="http://lists.freedesktop.org/mailman/listinfo/xorg" PKG_URL="http://xorg.freedesktop.org/archive/individual/driver/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain libXi" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="Synaptics touchpad driver for X.Org." PKG_LONGDESC="Synaptics touchpad driver for X.Org." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--with-xorg-module-dir=$XORG_PATH_MODULES" diff --git a/packages/x11/driver/xf86-video-amdgpu/package.mk b/packages/x11/driver/xf86-video-amdgpu/package.mk index 7278a8b28c..1716046e1d 100644 --- a/packages/x11/driver/xf86-video-amdgpu/package.mk +++ b/packages/x11/driver/xf86-video-amdgpu/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xf86-video-amdgpu" -PKG_VERSION="1.2.0" -PKG_REV="1" +PKG_VERSION="18.1.0" +PKG_SHA256="e11f25bb51d718b8ea938ad2b8095323c0ab16f4ddffd92091d80f9a445a9672" PKG_ARCH="x86_64" PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/driver/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain xorg-server" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-video-amdgpu - AMD Radeon video driver for the Xorg X server" -PKG_LONGDESC="AMD Xorg video driver" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="AMD Radeon video driver for the Xorg X server." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-udev \ --enable-glamor \ @@ -37,4 +18,6 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-udev \ post_makeinstall_target() { rm -r $INSTALL/usr/share + mkdir -p $INSTALL/etc/X11 + cp $PKG_BUILD/conf/10-amdgpu.conf $INSTALL/etc/X11/xorg-amdgpu.conf } diff --git a/packages/x11/driver/xf86-video-amdgpu/patches/xf86-video-amdgpu-01-screen_resize.patch b/packages/x11/driver/xf86-video-amdgpu/patches/xf86-video-amdgpu-01-screen_resize.patch new file mode 100644 index 0000000000..b8b3f66a9f --- /dev/null +++ b/packages/x11/driver/xf86-video-amdgpu/patches/xf86-video-amdgpu-01-screen_resize.patch @@ -0,0 +1,33 @@ +From aa572683d86174be2bfc09d4e173ae2a9907d40e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Wed, 10 Oct 2018 17:28:35 +0200 +Subject: Fix condition for calling set_pixmap_bo in drmmode_xf86crtc_resize + +This matches CreateScreenResources_KMS. + +Fixes crash when resizing the screen (e.g. using xrandr) with depth < +24. + +Bugzilla: https://bugs.freedesktop.org/104914 +Acked-by: Alex Deucher +--- + src/drmmode_display.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 5315747..9065e0f 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -2881,8 +2881,7 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) + if (!amdgpu_glamor_create_screen_resources(scrn->pScreen)) + goto fail; + +- if (info->use_glamor || +- (info->front_buffer->flags & AMDGPU_BO_FLAGS_GBM)) { ++ if (info->use_glamor || info->dri2.enabled) { + if (!amdgpu_set_pixmap_bo(ppix, info->front_buffer)) + goto fail; + } +-- +cgit v1.1 + diff --git a/packages/x11/driver/xf86-video-ati/package.mk b/packages/x11/driver/xf86-video-ati/package.mk index 243d4680e1..862ec2d273 100644 --- a/packages/x11/driver/xf86-video-ati/package.mk +++ b/packages/x11/driver/xf86-video-ati/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xf86-video-ati" -PKG_VERSION="7.8.0" -PKG_REV="1" +PKG_VERSION="18.1.0" +PKG_SHA256="6c335f423c1dc3d904550d41cb871ca4130ba7037dda67d82e3f1555e1bfb9ac" PKG_ARCH="x86_64" PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/driver/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain libXcomposite xorg-server" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-video-ati: The Xorg driver for ATI video chips" +PKG_DEPENDS_TARGET="toolchain xorg-server" PKG_LONGDESC="The ati driver supports various ATi, know AMD, video chips." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-glamor --with-xorg-module-dir=$XORG_PATH_MODULES" diff --git a/packages/x11/driver/xf86-video-ati/patches/xf86-video-ati-01-radeon_get_pixmap_bo_fix.patch b/packages/x11/driver/xf86-video-ati/patches/xf86-video-ati-01-radeon_get_pixmap_bo_fix.patch new file mode 100644 index 0000000000..b0b3041795 --- /dev/null +++ b/packages/x11/driver/xf86-video-ati/patches/xf86-video-ati-01-radeon_get_pixmap_bo_fix.patch @@ -0,0 +1,57 @@ +From f892d3791219d1041e0cbb1b866e15774004aa18 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Mon, 15 Oct 2018 17:14:41 +0200 +Subject: dri3: Handle radeon_get_pixmap_bo returning NULL + +We were trying to already, but testing the wrong pointer. + +Fixes: b85b7b11f5b5 "Add struct radeon_buffer" +Bug: https://bugs.debian.org/910846 +Reviewed-by: Alex Deucher +--- + src/radeon_dri3.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/radeon_dri3.c b/src/radeon_dri3.c +index 7e89a2f..25078ba 100644 +--- a/src/radeon_dri3.c ++++ b/src/radeon_dri3.c +@@ -212,7 +212,7 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen, + CARD16 *stride, + CARD32 *size) + { +- struct radeon_bo *bo; ++ struct radeon_buffer *bo; + int fd; + #ifdef USE_GLAMOR + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); +@@ -222,10 +222,10 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen, + return glamor_fd_from_pixmap(screen, pixmap, stride, size); + #endif + +- bo = radeon_get_pixmap_bo(pixmap)->bo.radeon; ++ bo = radeon_get_pixmap_bo(pixmap); + if (!bo) { + exaMoveInPixmap(pixmap); +- bo = radeon_get_pixmap_bo(pixmap)->bo.radeon; ++ bo = radeon_get_pixmap_bo(pixmap); + if (!bo) + return -1; + } +@@ -233,11 +233,11 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen, + if (pixmap->devKind > UINT16_MAX) + return -1; + +- if (radeon_gem_prime_share_bo(bo, &fd) < 0) ++ if (radeon_gem_prime_share_bo(bo->bo.radeon, &fd) < 0) + return -1; + + *stride = pixmap->devKind; +- *size = bo->size; ++ *size = bo->bo.radeon->size; + return fd; + } + +-- +cgit v1.1 + diff --git a/packages/x11/driver/xf86-video-intel/package.mk b/packages/x11/driver/xf86-video-intel/package.mk index 8814d54038..7da5b28d6c 100644 --- a/packages/x11/driver/xf86-video-intel/package.mk +++ b/packages/x11/driver/xf86-video-intel/package.mk @@ -1,36 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xf86-video-intel" -PKG_VERSION="028c946" -PKG_REV="1" +PKG_VERSION="3d39506" +PKG_SHA256="cfc7287fcb38028a68ffd7677032db0882c02112ad24038ee936de854761e8b3" PKG_ARCH="x86_64" PKG_LICENSE="OSS" PKG_SITE="http://intellinuxgraphics.org/" PKG_URL="https://cgit.freedesktop.org/xorg/driver/xf86-video-intel/snapshot/$PKG_VERSION.tar.xz" -PKG_SOURCE_DIR="$PKG_VERSION" -PKG_DEPENDS_TARGET="toolchain libXcomposite util-macros fontsproto systemd xorg-server" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-video-intel: The Xorg driver for Intel video chips" -PKG_LONGDESC="The Xorg driver for Intel i810, i815, 830M, 845G, 852GM, 855GM, 865G, 915G, 915GM and 965G video chips." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_DEPENDS_TARGET="toolchain libXcomposite libXxf86vm libXdamage libdrm util-macros systemd xorg-server" +PKG_LONGDESC="The Xorg driver for Intel i810, i815, 830M, 845G, 852GM, 855GM, 865G, 915G, 915GM and 965G." +PKG_TOOLCHAIN="autotools" +# xf86-video-intel is broken enough. dont link with LTO PKG_CONFIGURE_OPTS_TARGET="--disable-backlight \ --disable-backlight-helper \ @@ -54,11 +36,6 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-backlight \ --with-default-dri=2 \ --with-xorg-module-dir=$XORG_PATH_MODULES" -pre_configure_target() { -# xf86-video-intel is broken enough. dont link with LTO - strip_lto -} - post_makeinstall_target() { rm -rf $INSTALL/usr/share/polkit-1 } diff --git a/packages/x11/driver/xf86-video-nvidia-legacy/package.mk b/packages/x11/driver/xf86-video-nvidia-legacy/package.mk index ece3ec33eb..e2189994d9 100644 --- a/packages/x11/driver/xf86-video-nvidia-legacy/package.mk +++ b/packages/x11/driver/xf86-video-nvidia-legacy/package.mk @@ -1,36 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xf86-video-nvidia-legacy" -PKG_VERSION="340.101" -PKG_REV="1" +PKG_VERSION="340.107" +PKG_SHA256="6dc6f183c69c414670d8adef0286a2362eedd6e16ec6dfae811e48ea4a4505dc" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" PKG_SITE="http://www.nvidia.com/" PKG_URL="http://us.download.nvidia.com/XFree86/Linux-x86_64/$PKG_VERSION/NVIDIA-Linux-x86_64-$PKG_VERSION-no-compat32.run" PKG_DEPENDS_TARGET="toolchain util-macros linux xorg-server libvdpau" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-video-nvidia-legacy: The Xorg driver for NVIDIA video chips supporting Geforce 6 and Geforce 7 devices too" -PKG_LONGDESC="These binary drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server. AGP, PCIe, SLI, TV-out and flat panel displays are also supported. This version only supports GeForce 6xxx and higher of the Geforce GPUs plus complimentary Quadros and nforce." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The Xorg driver for NVIDIA video chips supporting Geforce 6 and Geforce 7 devices." +PKG_TOOLCHAIN="manual" unpack() { [ -d $PKG_BUILD ] && rm -rf $PKG_BUILD @@ -67,8 +49,8 @@ makeinstall_target() { # rename to not conflicting with Mesa libGL.so cp -P libGL.so* $INSTALL/usr/lib/libGL_nvidia-legacy.so.1 - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/nvidia - ln -sf /var/lib/nvidia.ko $INSTALL/usr/lib/modules/$(get_module_dir)/nvidia/nvidia.ko + mkdir -p $INSTALL/$(get_full_module_dir)/nvidia + ln -sf /var/lib/nvidia.ko $INSTALL/$(get_full_module_dir)/nvidia/nvidia.ko mkdir -p $INSTALL/usr/lib/nvidia-legacy cp kernel/nvidia.ko $INSTALL/usr/lib/nvidia-legacy diff --git a/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-kernel-4.9.patch b/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-kernel-4.9.patch deleted file mode 100644 index 6a47f79374..0000000000 --- a/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-kernel-4.9.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c ---- a/kernel/nv-drm.c 2016-12-15 12:41:26.000000000 +0100 -+++ b/kernel/nv-drm.c 2016-12-15 12:58:48.000000000 +0100 -@@ -115,7 +115,11 @@ - }; - - static struct drm_driver nv_drm_driver = { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) -+ .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY, -+#else - .driver_features = DRIVER_GEM | DRIVER_PRIME, -+#endif - .load = nv_drm_load, - .unload = nv_drm_unload, - .fops = &nv_drm_fops, diff --git a/packages/x11/driver/xf86-video-nvidia-legacy/udev.d b/packages/x11/driver/xf86-video-nvidia-legacy/udev.d new file mode 120000 index 0000000000..386fe9fc69 --- /dev/null +++ b/packages/x11/driver/xf86-video-nvidia-legacy/udev.d @@ -0,0 +1 @@ +../xf86-video-nvidia/udev.d/ \ No newline at end of file diff --git a/packages/x11/driver/xf86-video-nvidia/package.mk b/packages/x11/driver/xf86-video-nvidia/package.mk index 8b9edca791..8bca6408e1 100644 --- a/packages/x11/driver/xf86-video-nvidia/package.mk +++ b/packages/x11/driver/xf86-video-nvidia/package.mk @@ -1,39 +1,21 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xf86-video-nvidia" # Remember to run "python packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py" and commit changes to # "packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules" whenever bumping version. # Host may require installation of python-lxml and python-requests packages. -PKG_VERSION="375.26" -PKG_REV="1" +PKG_VERSION="410.93" +PKG_SHA256="b1ce054f8307080a257538ab82873e8b8022183f68e08e20fbb07089f7ddbb08" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" PKG_SITE="http://www.nvidia.com/" PKG_URL="http://us.download.nvidia.com/XFree86/Linux-x86_64/$PKG_VERSION/NVIDIA-Linux-x86_64-$PKG_VERSION-no-compat32.run" PKG_DEPENDS_TARGET="toolchain util-macros linux xorg-server libvdpau" PKG_NEED_UNPACK="$LINUX_DEPENDS" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-video-nvidia: The Xorg driver for NVIDIA video chips" -PKG_LONGDESC="These binary drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server. AGP, PCIe, SLI, TV-out and flat panel displays are also supported. This version only supports GeForce 8xxx and higher of the Geforce GPUs plus complimentary Quadros and nforce." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="The Xorg driver for NVIDIA video chips." +PKG_TOOLCHAIN="manual" unpack() { [ -d $PKG_BUILD ] && rm -rf $PKG_BUILD @@ -57,7 +39,7 @@ makeinstall_target() { mkdir -p $INSTALL/$XORG_PATH_MODULES/extensions # rename to not conflicting with Mesa libGL.so - cp -P libglx.so* $INSTALL/$XORG_PATH_MODULES/extensions/libglx_nvidia.so + cp -P libglxserver_nvidia.so.$PKG_VERSION $INSTALL/$XORG_PATH_MODULES/extensions/libglx_nvidia.so mkdir -p $INSTALL/etc/X11 cp $PKG_DIR/config/*.conf $INSTALL/etc/X11 @@ -70,10 +52,10 @@ makeinstall_target() { # rename to not conflicting with Mesa libGL.so cp -P libGL.so.$PKG_VERSION $INSTALL/usr/lib/libGL_nvidia.so.1 - mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/nvidia - ln -sf /var/lib/nvidia.ko $INSTALL/usr/lib/modules/$(get_module_dir)/nvidia/nvidia.ko - cp -P kernel/nvidia-uvm.ko $INSTALL/usr/lib/modules/$(get_module_dir)/nvidia - cp -P kernel/nvidia-modeset.ko $INSTALL/usr/lib/modules/$(get_module_dir)/nvidia + mkdir -p $INSTALL/$(get_full_module_dir)/nvidia + ln -sf /var/lib/nvidia.ko $INSTALL/$(get_full_module_dir)/nvidia/nvidia.ko + cp -P kernel/nvidia-uvm.ko $INSTALL/$(get_full_module_dir)/nvidia + cp -P kernel/nvidia-modeset.ko $INSTALL/$(get_full_module_dir)/nvidia mkdir -p $INSTALL/usr/lib/nvidia cp -P kernel/nvidia.ko $INSTALL/usr/lib/nvidia diff --git a/packages/x11/driver/xf86-video-nvidia/scripts/compare_nvidia.py b/packages/x11/driver/xf86-video-nvidia/scripts/compare_nvidia.py new file mode 100755 index 0000000000..fbbe4a09b3 --- /dev/null +++ b/packages/x11/driver/xf86-video-nvidia/scripts/compare_nvidia.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv + +from __future__ import print_function + +import re +import os +import requests +import sys +from lxml import html + +category = { + 1: 'Nvidia Geforce GPUs', + 2: 'Nvidia Quadro GPUs', + 3: 'Nvidia NVS GPUs', + 4: 'Nvidia Tesla GPUs', + } + +versions = [] +unique_ids = {} +all_ids = {i: [] for i in range(1, len(category))} + +def id_in_version(id, ids): + if any(id == value for value in ids): + return "x" + else: + return " " + +if len(sys.argv) <= 1: + print("Usage: python compare_nvidia.py ...") + exit() + +for version in sys.argv[1:]: + versions.append(version) + +for version in versions: + url = 'http://us.download.nvidia.com/XFree86/Linux-x86_64/' + version + '/README/supportedchips.html' + page = requests.get(url) + tree = html.fromstring(page.content) + + # These are the tables we want to use (gpu's supported by the current driver) + # NVIDIA GeForce GPUs = 1 + # NVIDIA Quadro GPUs = 2 + # NVIDIA NVS GPUs = 3 + # NVIDIA Tesla GPUs = 4 + + ids = {} + unique_ids[version] = {} + + for table in range(1, len(category)): + new_ids = tree.xpath('//html/body/div[@class="appendix"]/div[@class="informaltable"][' + str(table) + ']/table/tbody/tr[starts-with(@id, "devid")]/td[2]//text()') + new_labels = tree.xpath('//html/body/div[@class="appendix"]/div[@class="informaltable"][' + str(table) + ']/table/tbody/tr[starts-with(@id, "devid")]/td[1]//text()') + + # nvidia seems to like to change the way they do things... + if not new_ids: + new_ids = tree.xpath('//html/body/div[@class="appendix"]/div[@class="informaltable"][' + str(table) + ']/table/tbody/tr[starts-with(@id, "0x")]/td[2]//text()') + new_labels = tree.xpath('//html/body/div[@class="appendix"]/div[@class="informaltable"][' + str(table) + ']/table/tbody/tr[starts-with(@id, "0x")]/td[1]//text()') + + # just to make sure we get the raw id without 0x in front + new_ids = [re.sub(r"^0x", '', id) for id in new_ids] + + # If three IDs are listed, the first is the PCI Device ID, the second is the PCI Subsystem Vendor ID, and the third is the PCI Subsystem Device ID. + # We only want the PCI Device ID (the first value) + new_ids = [id.split()[0].lower() for id in new_ids] + + # Sort and remove duplicate ID's + ids[table] = sorted(set(zip(new_ids, new_labels))) + + # Add ids to list of all ids from all drivers being queried + all_ids[table].extend(ids[table]) + + # Add the ids for the specific driver version + unique_ids[version] = ids + +print("%s\t" % ("ID"), end='') +for version in versions: + print("%s\t" % (version), end='') +print("Card Name") + +print("-----------------------------------------------------------------------------------------------") + +for table in all_ids: + all_ids[table] = sorted(set(all_ids[table])) + print("%s" % (category[table])) + print("-----------------------------------------------------------------------------------------------") + for id in all_ids[table]: + print("%s\t" % (id[0]), end='') + for version in versions: + print("%s\t" % (id_in_version(id, unique_ids[version][table])), end='') + print("%s\t" % (id[1]), end='') + print("") + print("-----------------------------------------------------------------------------------------------\n") diff --git a/packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py b/packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py index 90e94af90d..23b8210781 100755 --- a/packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py +++ b/packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py @@ -23,10 +23,9 @@ # NVIDIA Quadro GPUs = 2 # NVIDIA NVS GPUs = 3 # NVIDIA Tesla GPUs = 4 -# NVIDIA GRID GPUs = 5 ids = [] -for table in range(1, 6): +for table in range(1, 5): ids = ids + tree.xpath('//html/body/div[@class="appendix"]/div[@class="informaltable"][' + str(table) + ']/table/tbody/tr[starts-with(@id, "devid")]/td[2]//text()') # If three IDs are listed, the first is the PCI Device ID, the second is the PCI Subsystem Vendor ID, and the third is the PCI Subsystem Device ID. diff --git a/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules b/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules index 5248b076b5..9d93888062 100644 --- a/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules +++ b/packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules @@ -3,69 +3,6 @@ SUBSYSTEM=="pci", ATTR{class}=="0x030000", ATTRS{vendor}=="0x10de", GOTO="subsys GOTO="end_video" LABEL="subsystem_pci" -ATTRS{device}=="0x06c0", GOTO="configure_nvidia" -ATTRS{device}=="0x06c4", GOTO="configure_nvidia" -ATTRS{device}=="0x06ca", GOTO="configure_nvidia" -ATTRS{device}=="0x06cd", GOTO="configure_nvidia" -ATTRS{device}=="0x06d1", GOTO="configure_nvidia" -ATTRS{device}=="0x06d2", GOTO="configure_nvidia" -ATTRS{device}=="0x06d8", GOTO="configure_nvidia" -ATTRS{device}=="0x06d9", GOTO="configure_nvidia" -ATTRS{device}=="0x06da", GOTO="configure_nvidia" -ATTRS{device}=="0x06dc", GOTO="configure_nvidia" -ATTRS{device}=="0x06dd", GOTO="configure_nvidia" -ATTRS{device}=="0x06de", GOTO="configure_nvidia" -ATTRS{device}=="0x06df", GOTO="configure_nvidia" -ATTRS{device}=="0x0dc0", GOTO="configure_nvidia" -ATTRS{device}=="0x0dc4", GOTO="configure_nvidia" -ATTRS{device}=="0x0dc5", GOTO="configure_nvidia" -ATTRS{device}=="0x0dc6", GOTO="configure_nvidia" -ATTRS{device}=="0x0dcd", GOTO="configure_nvidia" -ATTRS{device}=="0x0dce", GOTO="configure_nvidia" -ATTRS{device}=="0x0dd1", GOTO="configure_nvidia" -ATTRS{device}=="0x0dd2", GOTO="configure_nvidia" -ATTRS{device}=="0x0dd3", GOTO="configure_nvidia" -ATTRS{device}=="0x0dd6", GOTO="configure_nvidia" -ATTRS{device}=="0x0dd8", GOTO="configure_nvidia" -ATTRS{device}=="0x0dda", GOTO="configure_nvidia" -ATTRS{device}=="0x0de0", GOTO="configure_nvidia" -ATTRS{device}=="0x0de1", GOTO="configure_nvidia" -ATTRS{device}=="0x0de2", GOTO="configure_nvidia" -ATTRS{device}=="0x0de3", GOTO="configure_nvidia" -ATTRS{device}=="0x0de4", GOTO="configure_nvidia" -ATTRS{device}=="0x0de5", GOTO="configure_nvidia" -ATTRS{device}=="0x0de7", GOTO="configure_nvidia" -ATTRS{device}=="0x0de8", GOTO="configure_nvidia" -ATTRS{device}=="0x0de9", GOTO="configure_nvidia" -ATTRS{device}=="0x0dea", GOTO="configure_nvidia" -ATTRS{device}=="0x0deb", GOTO="configure_nvidia" -ATTRS{device}=="0x0dec", GOTO="configure_nvidia" -ATTRS{device}=="0x0ded", GOTO="configure_nvidia" -ATTRS{device}=="0x0dee", GOTO="configure_nvidia" -ATTRS{device}=="0x0def", GOTO="configure_nvidia" -ATTRS{device}=="0x0df0", GOTO="configure_nvidia" -ATTRS{device}=="0x0df1", GOTO="configure_nvidia" -ATTRS{device}=="0x0df2", GOTO="configure_nvidia" -ATTRS{device}=="0x0df3", GOTO="configure_nvidia" -ATTRS{device}=="0x0df4", GOTO="configure_nvidia" -ATTRS{device}=="0x0df5", GOTO="configure_nvidia" -ATTRS{device}=="0x0df6", GOTO="configure_nvidia" -ATTRS{device}=="0x0df7", GOTO="configure_nvidia" -ATTRS{device}=="0x0df8", GOTO="configure_nvidia" -ATTRS{device}=="0x0df9", GOTO="configure_nvidia" -ATTRS{device}=="0x0dfa", GOTO="configure_nvidia" -ATTRS{device}=="0x0dfc", GOTO="configure_nvidia" -ATTRS{device}=="0x0e22", GOTO="configure_nvidia" -ATTRS{device}=="0x0e23", GOTO="configure_nvidia" -ATTRS{device}=="0x0e24", GOTO="configure_nvidia" -ATTRS{device}=="0x0e30", GOTO="configure_nvidia" -ATTRS{device}=="0x0e31", GOTO="configure_nvidia" -ATTRS{device}=="0x0e3a", GOTO="configure_nvidia" -ATTRS{device}=="0x0e3b", GOTO="configure_nvidia" -ATTRS{device}=="0x0f00", GOTO="configure_nvidia" -ATTRS{device}=="0x0f01", GOTO="configure_nvidia" -ATTRS{device}=="0x0f02", GOTO="configure_nvidia" -ATTRS{device}=="0x0f03", GOTO="configure_nvidia" ATTRS{device}=="0x0fc0", GOTO="configure_nvidia" ATTRS{device}=="0x0fc1", GOTO="configure_nvidia" ATTRS{device}=="0x0fc2", GOTO="configure_nvidia" @@ -92,8 +29,6 @@ ATTRS{device}=="0x0fea", GOTO="configure_nvidia" ATTRS{device}=="0x0fec", GOTO="configure_nvidia" ATTRS{device}=="0x0fed", GOTO="configure_nvidia" ATTRS{device}=="0x0fee", GOTO="configure_nvidia" -ATTRS{device}=="0x0fef", GOTO="configure_nvidia" -ATTRS{device}=="0x0ff2", GOTO="configure_nvidia" ATTRS{device}=="0x0ff3", GOTO="configure_nvidia" ATTRS{device}=="0x0ff6", GOTO="configure_nvidia" ATTRS{device}=="0x0ff8", GOTO="configure_nvidia" @@ -123,41 +58,6 @@ ATTRS{device}=="0x102a", GOTO="configure_nvidia" ATTRS{device}=="0x102d", GOTO="configure_nvidia" ATTRS{device}=="0x103a", GOTO="configure_nvidia" ATTRS{device}=="0x103c", GOTO="configure_nvidia" -ATTRS{device}=="0x1040", GOTO="configure_nvidia" -ATTRS{device}=="0x1042", GOTO="configure_nvidia" -ATTRS{device}=="0x1048", GOTO="configure_nvidia" -ATTRS{device}=="0x1049", GOTO="configure_nvidia" -ATTRS{device}=="0x104a", GOTO="configure_nvidia" -ATTRS{device}=="0x104b", GOTO="configure_nvidia" -ATTRS{device}=="0x104c", GOTO="configure_nvidia" -ATTRS{device}=="0x1050", GOTO="configure_nvidia" -ATTRS{device}=="0x1051", GOTO="configure_nvidia" -ATTRS{device}=="0x1052", GOTO="configure_nvidia" -ATTRS{device}=="0x1054", GOTO="configure_nvidia" -ATTRS{device}=="0x1055", GOTO="configure_nvidia" -ATTRS{device}=="0x1056", GOTO="configure_nvidia" -ATTRS{device}=="0x1057", GOTO="configure_nvidia" -ATTRS{device}=="0x1058", GOTO="configure_nvidia" -ATTRS{device}=="0x1059", GOTO="configure_nvidia" -ATTRS{device}=="0x105a", GOTO="configure_nvidia" -ATTRS{device}=="0x105b", GOTO="configure_nvidia" -ATTRS{device}=="0x107c", GOTO="configure_nvidia" -ATTRS{device}=="0x107d", GOTO="configure_nvidia" -ATTRS{device}=="0x1080", GOTO="configure_nvidia" -ATTRS{device}=="0x1081", GOTO="configure_nvidia" -ATTRS{device}=="0x1082", GOTO="configure_nvidia" -ATTRS{device}=="0x1084", GOTO="configure_nvidia" -ATTRS{device}=="0x1086", GOTO="configure_nvidia" -ATTRS{device}=="0x1087", GOTO="configure_nvidia" -ATTRS{device}=="0x1088", GOTO="configure_nvidia" -ATTRS{device}=="0x1089", GOTO="configure_nvidia" -ATTRS{device}=="0x108b", GOTO="configure_nvidia" -ATTRS{device}=="0x1091", GOTO="configure_nvidia" -ATTRS{device}=="0x1094", GOTO="configure_nvidia" -ATTRS{device}=="0x1096", GOTO="configure_nvidia" -ATTRS{device}=="0x109a", GOTO="configure_nvidia" -ATTRS{device}=="0x109b", GOTO="configure_nvidia" -ATTRS{device}=="0x1140", GOTO="configure_nvidia" ATTRS{device}=="0x1180", GOTO="configure_nvidia" ATTRS{device}=="0x1183", GOTO="configure_nvidia" ATTRS{device}=="0x1184", GOTO="configure_nvidia" @@ -165,7 +65,6 @@ ATTRS{device}=="0x1185", GOTO="configure_nvidia" ATTRS{device}=="0x1187", GOTO="configure_nvidia" ATTRS{device}=="0x1188", GOTO="configure_nvidia" ATTRS{device}=="0x1189", GOTO="configure_nvidia" -ATTRS{device}=="0x118a", GOTO="configure_nvidia" ATTRS{device}=="0x118e", GOTO="configure_nvidia" ATTRS{device}=="0x118f", GOTO="configure_nvidia" ATTRS{device}=="0x1193", GOTO="configure_nvidia" @@ -190,7 +89,6 @@ ATTRS{device}=="0x11ba", GOTO="configure_nvidia" ATTRS{device}=="0x11bc", GOTO="configure_nvidia" ATTRS{device}=="0x11bd", GOTO="configure_nvidia" ATTRS{device}=="0x11be", GOTO="configure_nvidia" -ATTRS{device}=="0x11bf", GOTO="configure_nvidia" ATTRS{device}=="0x11c0", GOTO="configure_nvidia" ATTRS{device}=="0x11c2", GOTO="configure_nvidia" ATTRS{device}=="0x11c3", GOTO="configure_nvidia" @@ -205,28 +103,6 @@ ATTRS{device}=="0x11e2", GOTO="configure_nvidia" ATTRS{device}=="0x11e3", GOTO="configure_nvidia" ATTRS{device}=="0x11fa", GOTO="configure_nvidia" ATTRS{device}=="0x11fc", GOTO="configure_nvidia" -ATTRS{device}=="0x1200", GOTO="configure_nvidia" -ATTRS{device}=="0x1201", GOTO="configure_nvidia" -ATTRS{device}=="0x1203", GOTO="configure_nvidia" -ATTRS{device}=="0x1205", GOTO="configure_nvidia" -ATTRS{device}=="0x1206", GOTO="configure_nvidia" -ATTRS{device}=="0x1207", GOTO="configure_nvidia" -ATTRS{device}=="0x1208", GOTO="configure_nvidia" -ATTRS{device}=="0x1210", GOTO="configure_nvidia" -ATTRS{device}=="0x1211", GOTO="configure_nvidia" -ATTRS{device}=="0x1212", GOTO="configure_nvidia" -ATTRS{device}=="0x1213", GOTO="configure_nvidia" -ATTRS{device}=="0x1241", GOTO="configure_nvidia" -ATTRS{device}=="0x1243", GOTO="configure_nvidia" -ATTRS{device}=="0x1244", GOTO="configure_nvidia" -ATTRS{device}=="0x1245", GOTO="configure_nvidia" -ATTRS{device}=="0x1246", GOTO="configure_nvidia" -ATTRS{device}=="0x1247", GOTO="configure_nvidia" -ATTRS{device}=="0x1248", GOTO="configure_nvidia" -ATTRS{device}=="0x1249", GOTO="configure_nvidia" -ATTRS{device}=="0x124b", GOTO="configure_nvidia" -ATTRS{device}=="0x124d", GOTO="configure_nvidia" -ATTRS{device}=="0x1251", GOTO="configure_nvidia" ATTRS{device}=="0x1280", GOTO="configure_nvidia" ATTRS{device}=="0x1281", GOTO="configure_nvidia" ATTRS{device}=="0x1282", GOTO="configure_nvidia" @@ -259,6 +135,7 @@ ATTRS{device}=="0x134d", GOTO="configure_nvidia" ATTRS{device}=="0x134e", GOTO="configure_nvidia" ATTRS{device}=="0x134f", GOTO="configure_nvidia" ATTRS{device}=="0x137a", GOTO="configure_nvidia" +ATTRS{device}=="0x137b", GOTO="configure_nvidia" ATTRS{device}=="0x137d", GOTO="configure_nvidia" ATTRS{device}=="0x1380", GOTO="configure_nvidia" ATTRS{device}=="0x1381", GOTO="configure_nvidia" @@ -278,6 +155,7 @@ ATTRS{device}=="0x13b1", GOTO="configure_nvidia" ATTRS{device}=="0x13b2", GOTO="configure_nvidia" ATTRS{device}=="0x13b3", GOTO="configure_nvidia" ATTRS{device}=="0x13b4", GOTO="configure_nvidia" +ATTRS{device}=="0x13b6", GOTO="configure_nvidia" ATTRS{device}=="0x13b9", GOTO="configure_nvidia" ATTRS{device}=="0x13ba", GOTO="configure_nvidia" ATTRS{device}=="0x13bb", GOTO="configure_nvidia" @@ -303,6 +181,8 @@ ATTRS{device}=="0x1407", GOTO="configure_nvidia" ATTRS{device}=="0x1427", GOTO="configure_nvidia" ATTRS{device}=="0x1430", GOTO="configure_nvidia" ATTRS{device}=="0x1431", GOTO="configure_nvidia" +ATTRS{device}=="0x1436", GOTO="configure_nvidia" +ATTRS{device}=="0x15f0", GOTO="configure_nvidia" ATTRS{device}=="0x15f7", GOTO="configure_nvidia" ATTRS{device}=="0x15f8", GOTO="configure_nvidia" ATTRS{device}=="0x15f9", GOTO="configure_nvidia" @@ -311,6 +191,8 @@ ATTRS{device}=="0x1618", GOTO="configure_nvidia" ATTRS{device}=="0x1619", GOTO="configure_nvidia" ATTRS{device}=="0x161a", GOTO="configure_nvidia" ATTRS{device}=="0x1667", GOTO="configure_nvidia" +ATTRS{device}=="0x174d", GOTO="configure_nvidia" +ATTRS{device}=="0x174e", GOTO="configure_nvidia" ATTRS{device}=="0x179c", GOTO="configure_nvidia" ATTRS{device}=="0x17c2", GOTO="configure_nvidia" ATTRS{device}=="0x17c8", GOTO="configure_nvidia" @@ -318,23 +200,84 @@ ATTRS{device}=="0x17f0", GOTO="configure_nvidia" ATTRS{device}=="0x17f1", GOTO="configure_nvidia" ATTRS{device}=="0x17fd", GOTO="configure_nvidia" ATTRS{device}=="0x1b00", GOTO="configure_nvidia" +ATTRS{device}=="0x1b02", GOTO="configure_nvidia" +ATTRS{device}=="0x1b06", GOTO="configure_nvidia" ATTRS{device}=="0x1b30", GOTO="configure_nvidia" ATTRS{device}=="0x1b38", GOTO="configure_nvidia" ATTRS{device}=="0x1b80", GOTO="configure_nvidia" ATTRS{device}=="0x1b81", GOTO="configure_nvidia" +ATTRS{device}=="0x1b82", GOTO="configure_nvidia" +ATTRS{device}=="0x1b83", GOTO="configure_nvidia" ATTRS{device}=="0x1b84", GOTO="configure_nvidia" +ATTRS{device}=="0x1b87", GOTO="configure_nvidia" ATTRS{device}=="0x1ba0", GOTO="configure_nvidia" ATTRS{device}=="0x1ba1", GOTO="configure_nvidia" +ATTRS{device}=="0x1ba2", GOTO="configure_nvidia" ATTRS{device}=="0x1bb0", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb1", GOTO="configure_nvidia" ATTRS{device}=="0x1bb3", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb4", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb5", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb6", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb7", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb8", GOTO="configure_nvidia" +ATTRS{device}=="0x1bb9", GOTO="configure_nvidia" +ATTRS{device}=="0x1bbb", GOTO="configure_nvidia" +ATTRS{device}=="0x1bc7", GOTO="configure_nvidia" ATTRS{device}=="0x1be0", GOTO="configure_nvidia" ATTRS{device}=="0x1be1", GOTO="configure_nvidia" ATTRS{device}=="0x1c02", GOTO="configure_nvidia" ATTRS{device}=="0x1c03", GOTO="configure_nvidia" +ATTRS{device}=="0x1c04", GOTO="configure_nvidia" +ATTRS{device}=="0x1c06", GOTO="configure_nvidia" +ATTRS{device}=="0x1c07", GOTO="configure_nvidia" +ATTRS{device}=="0x1c09", GOTO="configure_nvidia" ATTRS{device}=="0x1c20", GOTO="configure_nvidia" +ATTRS{device}=="0x1c21", GOTO="configure_nvidia" +ATTRS{device}=="0x1c22", GOTO="configure_nvidia" +ATTRS{device}=="0x1c23", GOTO="configure_nvidia" +ATTRS{device}=="0x1c30", GOTO="configure_nvidia" ATTRS{device}=="0x1c60", GOTO="configure_nvidia" +ATTRS{device}=="0x1c61", GOTO="configure_nvidia" +ATTRS{device}=="0x1c62", GOTO="configure_nvidia" ATTRS{device}=="0x1c81", GOTO="configure_nvidia" ATTRS{device}=="0x1c82", GOTO="configure_nvidia" +ATTRS{device}=="0x1c83", GOTO="configure_nvidia" +ATTRS{device}=="0x1c8c", GOTO="configure_nvidia" +ATTRS{device}=="0x1c8d", GOTO="configure_nvidia" +ATTRS{device}=="0x1c8f", GOTO="configure_nvidia" +ATTRS{device}=="0x1c92", GOTO="configure_nvidia" +ATTRS{device}=="0x1cb1", GOTO="configure_nvidia" +ATTRS{device}=="0x1cb2", GOTO="configure_nvidia" +ATTRS{device}=="0x1cb3", GOTO="configure_nvidia" +ATTRS{device}=="0x1cb6", GOTO="configure_nvidia" +ATTRS{device}=="0x1cba", GOTO="configure_nvidia" +ATTRS{device}=="0x1cbb", GOTO="configure_nvidia" +ATTRS{device}=="0x1cbc", GOTO="configure_nvidia" +ATTRS{device}=="0x1d01", GOTO="configure_nvidia" +ATTRS{device}=="0x1d10", GOTO="configure_nvidia" +ATTRS{device}=="0x1d12", GOTO="configure_nvidia" +ATTRS{device}=="0x1d33", GOTO="configure_nvidia" +ATTRS{device}=="0x1d81", GOTO="configure_nvidia" +ATTRS{device}=="0x1db1", GOTO="configure_nvidia" +ATTRS{device}=="0x1db3", GOTO="configure_nvidia" +ATTRS{device}=="0x1db4", GOTO="configure_nvidia" +ATTRS{device}=="0x1db5", GOTO="configure_nvidia" +ATTRS{device}=="0x1db6", GOTO="configure_nvidia" +ATTRS{device}=="0x1db7", GOTO="configure_nvidia" +ATTRS{device}=="0x1db8", GOTO="configure_nvidia" +ATTRS{device}=="0x1dba", GOTO="configure_nvidia" +ATTRS{device}=="0x1df5", GOTO="configure_nvidia" +ATTRS{device}=="0x1e04", GOTO="configure_nvidia" +ATTRS{device}=="0x1e07", GOTO="configure_nvidia" +ATTRS{device}=="0x1e30", GOTO="configure_nvidia" +ATTRS{device}=="0x1e82", GOTO="configure_nvidia" +ATTRS{device}=="0x1e87", GOTO="configure_nvidia" +ATTRS{device}=="0x1eb0", GOTO="configure_nvidia" +ATTRS{device}=="0x1eb1", GOTO="configure_nvidia" +ATTRS{device}=="0x1eb8", GOTO="configure_nvidia" +ATTRS{device}=="0x1f02", GOTO="configure_nvidia" +ATTRS{device}=="0x1f07", GOTO="configure_nvidia" GOTO="configure_nvidia-legacy" LABEL="configure_nvidia" diff --git a/packages/x11/driver/xf86-video-vmware/package.mk b/packages/x11/driver/xf86-video-vmware/package.mk index 2ec49ebc5d..215fd086bb 100644 --- a/packages/x11/driver/xf86-video-vmware/package.mk +++ b/packages/x11/driver/xf86-video-vmware/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xf86-video-vmware" -PKG_VERSION="13.2.1" -PKG_REV="1" +PKG_VERSION="13.3.0" +PKG_SHA256="47971924659e51666a757269ad941a059ef5afe7a47b5101c174a6022ac4066c" PKG_ARCH="x86_64" PKG_LICENSE="OSS" PKG_SITE="http://www.vmware.com" PKG_URL="http://xorg.freedesktop.org/releases/individual/driver/${PKG_NAME}-${PKG_VERSION}.tar.bz2" -PKG_DEPENDS_TARGET="toolchain mesa glu libX11 xorg-server open-vm-tools" -PKG_SECTION="x11/driver" -PKG_SHORTDESC="xf86-video-vmware: The Xorg driver for vmware video" +PKG_DEPENDS_TARGET="toolchain mesa libX11 xorg-server" PKG_LONGDESC="xf86-video-vmware: The Xorg driver for vmware video" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="--enable-vmwarectrl-client \ --with-xorg-module-dir=$XORG_PATH_MODULES" diff --git a/packages/x11/font/encodings/package.mk b/packages/x11/font/encodings/package.mk index 6ee9aa0150..1269a1580c 100644 --- a/packages/x11/font/encodings/package.mk +++ b/packages/x11/font/encodings/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="encodings" PKG_VERSION="1.0.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="ced6312988a45d23812c2ac708b4595f63fd7a49c4dcd9f66bdcd50d1057d539" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/font/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros font-util:host" -PKG_SECTION="x11/font" -PKG_SHORTDESC="encodings: X font encodings" PKG_LONGDESC="X font encoding meta files." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--enable-gzip-small-encodings \ --enable-gzip-large-encodings \ --with-fontrootdir=/usr/share/fonts" diff --git a/packages/x11/font/font-bitstream-type1/package.mk b/packages/x11/font/font-bitstream-type1/package.mk index 6b7b540e98..276cd585e2 100644 --- a/packages/x11/font/font-bitstream-type1/package.mk +++ b/packages/x11/font/font-bitstream-type1/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="font-bitstream-type1" PKG_VERSION="1.0.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="c6ea0569adad2c577f140328dc3302e729cb1b1ea90cd0025caf380625f8a688" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/font/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/font" -PKG_SHORTDESC="font-bitstream-type1: Bitstream font family" PKG_LONGDESC="Bitstream font family." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-fontrootdir=/usr/share/fonts" post_install() { diff --git a/packages/x11/font/font-cursor-misc/package.mk b/packages/x11/font/font-cursor-misc/package.mk index 1f68a507e8..ae7dce292e 100644 --- a/packages/x11/font/font-cursor-misc/package.mk +++ b/packages/x11/font/font-cursor-misc/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="font-cursor-misc" PKG_VERSION="1.0.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="17363eb35eece2e08144da5f060c70103b59d0972b4f4d77fd84c9a7a2dba635" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/font/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros font-util:host" -PKG_SECTION="x11/font" -PKG_SHORTDESC="font-cursor-misc: X11 cursor fonts" PKG_LONGDESC="X11 cursor fonts." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-fontrootdir=/usr/share/fonts" post_install() { diff --git a/packages/x11/font/font-misc-misc/package.mk b/packages/x11/font/font-misc-misc/package.mk index ebd98caee4..d134791bb3 100644 --- a/packages/x11/font/font-misc-misc/package.mk +++ b/packages/x11/font/font-misc-misc/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="font-misc-misc" PKG_VERSION="1.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="b8e77940e4e1769dc47ef1805918d8c9be37c708735832a07204258bacc11794" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/font/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros font-util font-cursor-misc" -PKG_SECTION="x11/font" -PKG_SHORTDESC="font-misc-misc: A misc. public domain font" PKG_LONGDESC="A misc. public domain font." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-fontrootdir=/usr/share/fonts \ --disable-silent-rules \ --enable-iso8859-1 \ @@ -38,13 +17,11 @@ PKG_CONFIGURE_OPTS_TARGET="--with-fontrootdir=/usr/share/fonts \ --disable-iso8859-3 \ --disable-iso8859-4 \ --enable-iso8859-5 \ - --disable-iso8859-6 \ --enable-iso8859-7 \ --enable-iso8859-8 \ --enable-iso8859-9 \ --disable-iso8859-10 \ --disable-iso8859-11 \ - --disable-iso8859-12 \ --disable-iso8859-13 \ --enable-iso8859-14 \ --enable-iso8859-15 \ diff --git a/packages/x11/font/font-util/package.mk b/packages/x11/font/font-util/package.mk index 583dcc1b22..d2a637c9d9 100644 --- a/packages/x11/font/font-util/package.mk +++ b/packages/x11/font/font-util/package.mk @@ -1,37 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="font-util" PKG_VERSION="1.3.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="aa7ebdb0715106dd255082f2310dbaa2cd7e225957c2a77d719720c7cc92b921" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/font/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros" PKG_DEPENDS_HOST="util-macros" -PKG_SECTION="x11/font" -PKG_SHORTDESC="font-util: X.org font utilities" PKG_LONGDESC="X.org font utilities." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-mapdir=/usr/share/fonts/util" post_makeinstall_target() { diff --git a/packages/x11/font/font-xfree86-type1/package.mk b/packages/x11/font/font-xfree86-type1/package.mk index 5ece7f29c1..30b1fbe2d5 100644 --- a/packages/x11/font/font-xfree86-type1/package.mk +++ b/packages/x11/font/font-xfree86-type1/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="font-xfree86-type1" PKG_VERSION="1.0.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="caebf42aec7be7f3bd40e0f232d6f34881b853dc84acfcdf7458358701fbe34a" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/releases/individual/font/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/font" -PKG_SHORTDESC="font-xfree86-type1: A Xfree86 Inc. Type1 font" PKG_LONGDESC="A Xfree86 Inc. Type1 font." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-fontrootdir=/usr/share/fonts" post_install() { diff --git a/packages/x11/font/liberation-fonts-ttf/package.mk b/packages/x11/font/liberation-fonts-ttf/package.mk index fa4f96be8e..688cdaf451 100644 --- a/packages/x11/font/liberation-fonts-ttf/package.mk +++ b/packages/x11/font/liberation-fonts-ttf/package.mk @@ -1,39 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="liberation-fonts-ttf" PKG_VERSION="2.00.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="7890278a6cd17873c57d9cd785c2d230d9abdea837e96516019c5885dd271504" PKG_LICENSE="OFL1_1" PKG_SITE="https://www.redhat.com/promo/fonts/" -PKG_URL="https://fedorahosted.org/releases/l/i/liberation-fonts/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/fonts" -PKG_SHORTDESC="liberation-fonts: High quality "open-sourced" vector fonts" -PKG_LONGDESC="This packages included the high-quality and open-sourced TrueType vector fonts released by RedHat." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -make_target() { - : # nothing to make -} +PKG_LONGDESC="This packages included the high-quality and open-sourced TrueType vector fonts." +PKG_TOOLCHAIN="manual" makeinstall_target() { mkdir -p $INSTALL/usr/share/fonts/liberation diff --git a/packages/x11/lib/libICE/package.mk b/packages/x11/lib/libICE/package.mk index 0e8048376e..07bfebbb62 100644 --- a/packages/x11/lib/libICE/package.mk +++ b/packages/x11/lib/libICE/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libICE" PKG_VERSION="1.0.9" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="8f7032f2c1c64352b5423f6b48a8ebdc339cc63064af34d66a6c9aa79759e202" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros xtrans" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libICE: X Inter-Client Exchange (ICE) protocol library" PKG_LONGDESC="X Inter-Client Exchange (ICE) protocol library." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ --disable-ipv6 \ diff --git a/packages/x11/lib/libSM/package.mk b/packages/x11/lib/libSM/package.mk index 90b8e28a79..2f7e1468dc 100644 --- a/packages/x11/lib/libSM/package.mk +++ b/packages/x11/lib/libSM/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libSM" PKG_VERSION="1.2.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="0baca8c9f5d934450a70896c4ad38d06475521255ca63b717a6510fdb6e287bd" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros util-linux libICE" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libSM: X11 Inter-Client Exchange library" -PKG_LONGDESC="This package provides the main interface to the X11 Session Management library, which allows for applications to both manage sessions, and make use of session managers to save and restore their state for later use." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="This package provides the main interface to the X11 Session Management library." PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ diff --git a/packages/x11/lib/libX11/package.mk b/packages/x11/lib/libX11/package.mk index db2c6c8272..2548a07f59 100644 --- a/packages/x11/lib/libX11/package.mk +++ b/packages/x11/lib/libX11/package.mk @@ -1,38 +1,18 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libX11" -PKG_VERSION="1.6.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.6.5" +PKG_SHA256="4d3890db2ba225ba8c55ca63c6409c1ebb078a2806de59fb16342768ae63435d" PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain xproto:host xproto util-macros xextproto xcmiscproto bigreqsproto kbproto inputproto xtrans libXau libxcb util-macros" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libx11: The X11 library" +PKG_DEPENDS_TARGET="toolchain util-macros xtrans libXau libxcb" PKG_LONGDESC="LibX11 is the main X11 library containing all the client-side code to access the X11 windowing system." +PKG_TOOLCHAIN="autotools" -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" - -PKG_CONFIGURE_OPTS_TARGET="--disable-secure-rpc \ - --disable-loadable-i18n \ +PKG_CONFIGURE_OPTS_TARGET="--disable-loadable-i18n \ --disable-loadable-xcursor \ --enable-xthreads \ --disable-xcms \ @@ -50,11 +30,3 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-secure-rpc \ --disable-ipv6 \ --without-launchd \ --without-lint" - -pre_configure_target() { - export CC_FOR_BUILD="$HOST_CC" - export CPPFLAGS_FOR_BUILD="$HOST_CPPFLAGS" - export CFLAGS_FOR_BUILD="$HOST_CFLAGS" - export LDFLAGS_FOR_BUILD="$HOST_LDFLAGS" - unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS -} diff --git a/packages/x11/lib/libXau/package.mk b/packages/x11/lib/libXau/package.mk index 8afa2a0dba..8f197b2977 100644 --- a/packages/x11/lib/libXau/package.mk +++ b/packages/x11/lib/libXau/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXau" PKG_VERSION="1.0.8" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="fdd477320aeb5cdd67272838722d6b7d544887dfe7de46e1e7cc0c27c2bea4f2" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xproto" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libXau: X authorization file management libary" +PKG_DEPENDS_TARGET="toolchain util-macros xorgproto" PKG_LONGDESC="X authorization file management libary" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --enable-xthreads" - -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} diff --git a/packages/x11/lib/libXcomposite/package.mk b/packages/x11/lib/libXcomposite/package.mk index 718f60c55e..0398b21c0a 100644 --- a/packages/x11/lib/libXcomposite/package.mk +++ b/packages/x11/lib/libXcomposite/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXcomposite" PKG_VERSION="0.4.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="ede250cd207d8bee4a338265c3007d7a68d5aca791b6ac41af18e9a2aeb34178" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros compositeproto fixesproto libXfixes libXext libX11" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxcomposite: X Composite Library" +PKG_DEPENDS_TARGET="toolchain util-macros libXfixes libXext libX11" PKG_LONGDESC="X Composite Library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} diff --git a/packages/x11/lib/libXdamage/package.mk b/packages/x11/lib/libXdamage/package.mk index 2de1598cc1..6444b7a4b2 100644 --- a/packages/x11/lib/libXdamage/package.mk +++ b/packages/x11/lib/libXdamage/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXdamage" PKG_VERSION="1.1.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="7c3fe7c657e83547f4822bfde30a90d84524efb56365448768409b77f05355ad" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros damageproto fixesproto libX11 libXfixes" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libXdamage: X11 damaged region extension library" -PKG_LONGDESC="LibXdamage provides an X Window System client interface to the DAMAGE extension to the X protocol. The Damage extension provides for notification of when on-screen regions have been 'damaged' (altered)." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain util-macros libX11 libXfixes" +PKG_LONGDESC="LibXdamage provides an X Window System client interface to the DAMAGE extension to the X protocol." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} diff --git a/packages/x11/lib/libXext/package.mk b/packages/x11/lib/libXext/package.mk index d1024857a8..ef5d90d3e5 100644 --- a/packages/x11/lib/libXext/package.mk +++ b/packages/x11/lib/libXext/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXext" PKG_VERSION="1.3.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="b518d4d332231f313371fdefac59e3776f4f0823bcb23cf7c7305bfb57b16e35" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xextproto libX11" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxext: X11 miscellaneous extensions library" -PKG_LONGDESC="LibXext provides an X Window System client interface to several extensions to the X protocol, iincluding DOUBLE-BUFFER (DBE), DPMS, Extended-Visual-Information (EVI), LBX, MIT-SHM, MIT-SUNDRY-NONSTANDARD, Multi-Buffering, SECURITY, SHAPE, SHAPE, SYNC, TOG-CUP, XC-APPGROUP, XC-MISC, XTEST and possibly others." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain util-macros libX11" +PKG_LONGDESC="LibXext provides an X Window System client interface to several extensions to the X protocol." PKG_CONFIGURE_OPTS_TARGET="--enable-malloc0returnsnull --without-xmlto" diff --git a/packages/x11/lib/libXfixes/package.mk b/packages/x11/lib/libXfixes/package.mk index 87edcd12b5..5cb1060e69 100644 --- a/packages/x11/lib/libXfixes/package.mk +++ b/packages/x11/lib/libXfixes/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXfixes" PKG_VERSION="5.0.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="de1cd33aff226e08cefd0e6759341c2c8e8c9faf8ce9ac6ec38d43e287b22ad6" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros fixesproto libX11" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxfixes: X Fixes Library" +PKG_DEPENDS_TARGET="toolchain util-macros libX11" PKG_LONGDESC="X Fixes Library" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} diff --git a/packages/x11/lib/libXfont2/package.mk b/packages/x11/lib/libXfont2/package.mk index d6697576ea..b131c6f42a 100644 --- a/packages/x11/lib/libXfont2/package.mk +++ b/packages/x11/lib/libXfont2/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXfont2" -PKG_VERSION="2.0.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.0.3" +PKG_SHA256="0e8ab7fd737ccdfe87e1f02b55f221f0bd4503a1c5f28be4ed6a54586bac9c4e" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros fontcacheproto fontsproto xtrans freetype libfontenc" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxfont: X font Library" +PKG_DEPENDS_TARGET="toolchain util-macros xtrans freetype libfontenc" PKG_LONGDESC="X font Library" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ --disable-ipv6 \ --enable-freetype \ @@ -41,4 +21,3 @@ PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ --enable-fc \ --with-gnu-ld \ --without-xmlto" - diff --git a/packages/x11/lib/libXi/package.mk b/packages/x11/lib/libXi/package.mk index b785fcf7bb..8f50cc5f9c 100644 --- a/packages/x11/lib/libXi/package.mk +++ b/packages/x11/lib/libXi/package.mk @@ -1,35 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXi" -PKG_VERSION="1.7.8" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.7.9" +PKG_SHA256="c2e6b8ff84f9448386c1b5510a5cf5a16d788f76db018194dacdc200180faf45" PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros libX11 inputproto libXfixes" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxi: X11 Input extension library" +PKG_DEPENDS_TARGET="toolchain util-macros libX11 libXfixes" PKG_LONGDESC="LibXi provides an X Window System client interface to the XINPUT extension to the X protocol." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ --enable-malloc0returnsnull \ diff --git a/packages/x11/lib/libXinerama/package.mk b/packages/x11/lib/libXinerama/package.mk index 84a8cdc788..c34b1420db 100644 --- a/packages/x11/lib/libXinerama/package.mk +++ b/packages/x11/lib/libXinerama/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXinerama" PKG_VERSION="1.1.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="7a45699f1773095a3f821e491cbd5e10c887c5a5fce5d8d3fced15c2ff7698e2" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xineramaproto libXext" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libXinerama: The Xinerama library." +PKG_DEPENDS_TARGET="toolchain util-macros libXext" PKG_LONGDESC="libXinerama is the Xinerama library." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --enable-malloc0returnsnull" diff --git a/packages/x11/lib/libXmu/package.mk b/packages/x11/lib/libXmu/package.mk index c475b49356..1530b0aced 100644 --- a/packages/x11/lib/libXmu/package.mk +++ b/packages/x11/lib/libXmu/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXmu" PKG_VERSION="1.1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="756edc7c383254eef8b4e1b733c3bf1dc061b523c9f9833ac7058378b8349d0b" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xextproto libXext libX11 libXt" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxmu: X11 miscellaneous utility library" +PKG_DEPENDS_TARGET="toolchain util-macros libXext libX11 libXt" PKG_LONGDESC="LibXmu provides a set of miscellaneous utility convenience functions for X libraries to use." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-gnu-ld --without-xmlto" - -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} diff --git a/packages/x11/lib/libXrandr/package.mk b/packages/x11/lib/libXrandr/package.mk index da4bc2e0b8..492ee55a69 100644 --- a/packages/x11/lib/libXrandr/package.mk +++ b/packages/x11/lib/libXrandr/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXrandr" PKG_VERSION="1.5.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="1ff9e7fa0e4adea912b16a5f0cfa7c1d35b0dcda0e216831f7715c8a3abcf51a" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros randrproto libX11 libXrender libXext" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxrandr: X Resize, Rotate and Reflection extension client library" -PKG_LONGDESC="Xrandr is a simple library designed to interface the X Resize and Rotate Extension. This allows clients to change the size and rotation of the root window of a screen, along with the ability to reflect the screen about either axis." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain util-macros libX11 libXrender libXext" +PKG_LONGDESC="Xrandr is a simple library designed to interface the X Resize and Rotate Extension." PKG_CONFIGURE_OPTS_TARGET="--enable-malloc0returnsnull" diff --git a/packages/x11/lib/libXrender/package.mk b/packages/x11/lib/libXrender/package.mk index d11e782f51..32ceedb8a2 100644 --- a/packages/x11/lib/libXrender/package.mk +++ b/packages/x11/lib/libXrender/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXrender" PKG_VERSION="0.9.10" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="c06d5979f86e64cabbde57c223938db0b939dff49fdb5a793a1d3d0396650949" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros renderproto libX11" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxrender: X Rendering Extension client library" -PKG_LONGDESC="The X Rendering Extension (Render) introduces digital image composition as the foundation of a new rendering model within the X Window System. Rendering geometric figures is accomplished by client-side tesselation into either triangles or trapezoids." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain util-macros libX11" +PKG_LONGDESC="The X Rendering Extension introduces digital image composition within the X Window System." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --enable-malloc0returnsnull" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC" -} diff --git a/packages/x11/lib/libXt/package.mk b/packages/x11/lib/libXt/package.mk index 807c3176f2..2be3e879d9 100644 --- a/packages/x11/lib/libXt/package.mk +++ b/packages/x11/lib/libXt/package.mk @@ -1,35 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libXt" PKG_VERSION="1.1.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="46eeb6be780211fdd98c5109286618f6707712235fdd19df4ce1e6954f349f1a" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros libX11 libSM" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxt: X11 toolkit intrinsics library" -PKG_LONGDESC="LibXt provides the X Toolkit Intrinsics, an abstract widget library upon which other toolkits are based. Xt is the basis for many toolkits, including the Athena widgets (Xaw), and LessTif." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="LibXt provides the X Toolkit Intrinsics, an abstract widget library upon which other toolkits are based." PKG_CONFIGURE_OPTS_TARGET="--enable-static \ --disable-shared \ diff --git a/packages/x11/lib/libXtst/package.mk b/packages/x11/lib/libXtst/package.mk index 4550a7b65c..60d94c2561 100644 --- a/packages/x11/lib/libXtst/package.mk +++ b/packages/x11/lib/libXtst/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXtst" PKG_VERSION="1.2.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="4655498a1b8e844e3d6f21f3b2c4e2b571effb5fd83199d428a6ba7ea4bf5204" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros recordproto xextproto libXext inputproto libXi libX11" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxtst: The Xtst Library" +PKG_DEPENDS_TARGET="toolchain util-macros libXext libXi libX11" PKG_LONGDESC="The Xtst Library" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --with-gnu-ld --without-xmlto" diff --git a/packages/x11/lib/libXxf86vm/package.mk b/packages/x11/lib/libXxf86vm/package.mk index 92aeff4c5d..9b6060ef17 100644 --- a/packages/x11/lib/libXxf86vm/package.mk +++ b/packages/x11/lib/libXxf86vm/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libXxf86vm" PKG_VERSION="1.1.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="afee27f93c5f31c0ad582852c0fb36d50e4de7cd585fcf655e278a633d85cd57" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xf86vidmodeproto libX11 libXext" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxxf86vm: Extension library for the XFree86-VidMode X extension" -PKG_LONGDESC="The libxxf86vm provides an interface to the server extension XFree86-VidModeExtension which allows the video modes to be queried and adjusted dynamically and mode switching to be controlled." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain util-macros libX11 libXext" +PKG_LONGDESC="The libxxf86vm provides an interface to the server extension XFree86-VidModeExtension." +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared --enable-malloc0returnsnull" - -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} diff --git a/packages/x11/lib/libfontenc/package.mk b/packages/x11/lib/libfontenc/package.mk index 6d4172a793..2696cf614f 100644 --- a/packages/x11/lib/libfontenc/package.mk +++ b/packages/x11/lib/libfontenc/package.mk @@ -1,38 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libfontenc" PKG_VERSION="1.1.3" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="70588930e6fc9542ff38e0884778fbc6e6febf21adbab92fd8f524fe60aefd21" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xproto zlib font-util" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libfontenc: X11 font encoding library" +PKG_DEPENDS_TARGET="toolchain util-macros zlib font-util" PKG_LONGDESC="Libfontenc is a library which helps font libraries portably determine and deal with different encodings of fonts." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - export CFLAGS="$CFLAGS -fPIC -DPIC" -} diff --git a/packages/x11/lib/libpciaccess/package.mk b/packages/x11/lib/libpciaccess/package.mk index cf7cb4c394..7a5b9a92c1 100644 --- a/packages/x11/lib/libpciaccess/package.mk +++ b/packages/x11/lib/libpciaccess/package.mk @@ -1,38 +1,20 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libpciaccess" -PKG_VERSION="0.13.4" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="0.14" +PKG_SHA256="3df543e12afd41fea8eac817e48cbfde5aed8817b81670a4e9e493bb2f5bf2a4" PKG_LICENSE="OSS" PKG_SITE="http://freedesktop.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros zlib" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libpciaccess: X.org libpciaccess library" PKG_LONGDESC="X.org libpciaccess library." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" - PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_asm_mtrr_h=set \ --with-pciids-path=/usr/share \ --with-zlib " + +pre_configure_target() { + CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" +} diff --git a/packages/x11/lib/libxcb/package.mk b/packages/x11/lib/libxcb/package.mk index dabb060dd8..2405c917ee 100644 --- a/packages/x11/lib/libxcb/package.mk +++ b/packages/x11/lib/libxcb/package.mk @@ -1,48 +1,27 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="libxcb" -PKG_VERSION="1.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.13" +PKG_SHA256="188c8752193c50ff2dbe89db4554c63df2e26a2e47b0fa415a70918b5b851daa" PKG_LICENSE="OSS" PKG_SITE="http://xcb.freedesktop.org" PKG_URL="http://xcb.freedesktop.org/dist/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros Python:host xcb-proto libpthread-stubs libXau" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxcb: X C-language Bindings library" +PKG_DEPENDS_TARGET="toolchain util-macros Python2:host xcb-proto libpthread-stubs libXau" PKG_LONGDESC="X C-language Bindings library." +PKG_BUILD_FLAGS="+pic" -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared \ +PKG_CONFIGURE_OPTS_TARGET="--enable-static \ + --disable-shared \ --disable-screensaver \ --disable-xprint \ --disable-selinux \ --disable-xvmc" pre_configure_target() { - PYTHON_LIBDIR="`ls -d $SYSROOT_PREFIX/usr/lib/python*`" - PYTHON_TOOLCHAIN_PATH=`ls -d $PYTHON_LIBDIR/site-packages` + PYTHON_LIBDIR=$SYSROOT_PREFIX/usr/lib/$PKG_PYTHON_VERSION + PYTHON_TOOLCHAIN_PATH=$PYTHON_LIBDIR/site-packages PKG_CONFIG="$PKG_CONFIG --define-variable=pythondir=$PYTHON_TOOLCHAIN_PATH" PKG_CONFIG="$PKG_CONFIG --define-variable=xcbincludedir=$SYSROOT_PREFIX/usr/share/xcb" - - CFLAGS="$CFLAGS -fPIC -DPIC" } diff --git a/packages/x11/lib/libxkbfile/package.mk b/packages/x11/lib/libxkbfile/package.mk index 8d3083b70a..6a1dbd053b 100644 --- a/packages/x11/lib/libxkbfile/package.mk +++ b/packages/x11/lib/libxkbfile/package.mk @@ -1,34 +1,14 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libxkbfile" PKG_VERSION="1.0.9" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="51817e0530961975d9513b773960b4edd275f7d5c72293d5a151ed4f42aeb16a" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros kbproto libX11" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxkbfile: X11 keyboard file manipulation library" +PKG_DEPENDS_TARGET="toolchain util-macros libX11" PKG_LONGDESC="Libxkbfile provides an interface to read and manipulate description files for XKB, the X11 keyboard configuration extension." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" diff --git a/packages/x11/lib/libxshmfence/package.mk b/packages/x11/lib/libxshmfence/package.mk index 14fc5232bd..daa5868c7b 100644 --- a/packages/x11/lib/libxshmfence/package.mk +++ b/packages/x11/lib/libxshmfence/package.mk @@ -1,38 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libxshmfence" -PKG_VERSION="1.2" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.3" +PKG_SHA256="b884300d26a14961a076fbebc762a39831cb75f92bed5ccf9836345b459220c7" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros xproto" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="libxshmfence: Shared memory 'SyncFence' synchronization primitive." +PKG_DEPENDS_TARGET="toolchain util-macros" PKG_LONGDESC="libxshmfence is the Shared memory 'SyncFence' synchronization primitive." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_TOOLCHAIN="autotools" +PKG_BUILD_FLAGS="+pic" PKG_CONFIGURE_OPTS_TARGET="--enable-static --disable-shared" - -pre_configure_target() { - CFLAGS="$CFLAGS -fPIC -DPIC" -} diff --git a/packages/x11/lib/pixman/package.mk b/packages/x11/lib/pixman/package.mk index 038c91e72d..65868f22f9 100644 --- a/packages/x11/lib/pixman/package.mk +++ b/packages/x11/lib/pixman/package.mk @@ -1,43 +1,24 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="pixman" PKG_VERSION="0.34.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="39ba3438f3d17c464b0cb8be006dacbca0ab5aee97ebde69fec7ecdbf85794a0" PKG_LICENSE="OSS" PKG_SITE="http://www.x.org/" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="pixman: Pixel manipulation library" -PKG_LONGDESC="Pixman is a generic library for manipulating pixel regions, contains low-level pixel manipulation routines and is used by both xorg and cairo." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_LONGDESC="Pixman is a generic library for manipulating pixel regions, contains low-level pixel manipulation routines." if [ "$TARGET_ARCH" = arm ]; then - if [ "$TARGET_FPU" = neon -o "$TARGET_FPU" = neon-fp16 ]; then + if target_has_feature neon; then PIXMAN_NEON="--enable-arm-neon" else PIXMAN_NEON="--disable-arm-neon" fi PIXMAN_CONFIG="--disable-mmx --disable-sse2 --disable-vmx --enable-arm-simd $PIXMAN_NEON --disable-arm-iwmmxt" +elif [ "$TARGET_ARCH" = aarch64 ]; then + PIXMAN_CONFIG="--disable-mmx --disable-sse2 --disable-vmx --disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt" elif [ "$TARGET_ARCH" = x86_64 ]; then PIXMAN_CONFIG="--enable-mmx --enable-sse2 --disable-ssse3 --disable-vmx --disable-arm-simd --disable-arm-neon" fi diff --git a/packages/x11/lib/xtrans/package.mk b/packages/x11/lib/xtrans/package.mk index aa3f1869d3..7f304f4e40 100644 --- a/packages/x11/lib/xtrans/package.mk +++ b/packages/x11/lib/xtrans/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xtrans" PKG_VERSION="1.3.5" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="adbd3b36932ce4c062cd10f57d78a156ba98d618bdb6f50664da327502bc8301" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/lib/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/lib" -PKG_SHORTDESC="xtrans: Abstract network code for X" PKG_LONGDESC="Abstract network code for X." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" post_makeinstall_target() { diff --git a/packages/x11/other/fluxbox/package.mk b/packages/x11/other/fluxbox/package.mk index 08811c852f..6b686ca827 100644 --- a/packages/x11/other/fluxbox/package.mk +++ b/packages/x11/other/fluxbox/package.mk @@ -1,36 +1,16 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="fluxbox" # dont bump or go back to ratpoison then f*** all 3rdparty stuff. PKG_VERSION="1.3.7" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="c99e2baa06fff1e96342b20415059d12ff1fa2917ade0173c75b2fa570295b9f" PKG_LICENSE="OSS" PKG_SITE="http://fluxbox.org/" PKG_URL="http://sourceforge.net/projects/fluxbox/files/fluxbox/${PKG_VERSION}/$PKG_NAME-${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain libX11 libXrandr libXext libXrender" -PKG_SECTION="x11/other" -PKG_SHORTDESC="Fluxbox is a windowmanager for X that was based on the Blackbox 0.61.1 code" -PKG_LONGDESC="Fluxbox is a windowmanager for X that was based on the Blackbox 0.61.1 code. It is very light on resources and easy to handle but yet full of features to make an easy, and extremely fast, desktop experience. It is built using C++ and licensed under the MIT-License." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="Fluxbox is a windowmanager for X that was based on the Blackbox 0.61.1 code." +PKG_TOOLCHAIN="autotools" PKG_CONFIGURE_OPTS_TARGET="ac_cv_func_realloc_0_nonnull=yes \ ac_cv_func_malloc_0_nonnull=yes \ diff --git a/packages/x11/other/fontconfig/conf.d/05-kodi-fonts.conf b/packages/x11/other/fontconfig/conf.d/05-kodi-fonts.conf new file mode 100644 index 0000000000..55d376239f --- /dev/null +++ b/packages/x11/other/fontconfig/conf.d/05-kodi-fonts.conf @@ -0,0 +1,5 @@ + + + +

/storage/.kodi/media/Fonts + diff --git a/packages/x11/other/fontconfig/package.mk b/packages/x11/other/fontconfig/package.mk index 5aa4716873..1521857d7c 100644 --- a/packages/x11/other/fontconfig/package.mk +++ b/packages/x11/other/fontconfig/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="fontconfig" -PKG_VERSION="2.12.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="2.12.6" +PKG_SHA256="064b9ebf060c9e77011733ac9dc0e2ce92870b574cca2405e11f5353a683c334" PKG_LICENSE="OSS" PKG_SITE="http://www.fontconfig.org" PKG_URL="http://www.freedesktop.org/software/fontconfig/release/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_TARGET="toolchain util-macros freetype libxml2 zlib expat" -PKG_SECTION="x11/other" -PKG_SHORTDESC="fontconfig: A library for font customization and configuration" PKG_LONGDESC="Fontconfig is a library for font customization and configuration." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - PKG_CONFIGURE_OPTS_TARGET="--with-arch=$TARGET_ARCH \ --with-cache-dir=/storage/.cache/fontconfig \ --with-default-fonts=/usr/share/fonts \ @@ -42,10 +21,16 @@ pre_configure_target() { # ensure we dont use '-O3' optimization. CFLAGS=`echo $CFLAGS | sed -e "s|-O3|-O2|"` CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-O3|-O2|"` - CFLAGS="$CFLAGS -I$ROOT/$PKG_BUILD" - CXXFLAGS="$CXXFLAGS -I$ROOT/$PKG_BUILD" + CFLAGS="$CFLAGS -I$PKG_BUILD" + CXXFLAGS="$CXXFLAGS -I$PKG_BUILD" + + # Delete this as a workaround https://bugs.freedesktop.org/show_bug.cgi?id=101280 + rm -f $PKG_BUILD/src/fcobjshash.h } post_makeinstall_target() { rm -rf $INSTALL/usr/bin + + mkdir -p $INSTALL/etc/fonts/conf.d + cp $PKG_DIR/conf.d/*.conf $INSTALL/etc/fonts/conf.d } diff --git a/packages/x11/proto/bigreqsproto/package.mk b/packages/x11/proto/bigreqsproto/package.mk deleted file mode 100644 index 580e617e1b..0000000000 --- a/packages/x11/proto/bigreqsproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="bigreqsproto" -PKG_VERSION="1.1.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="bigreqsproto: BigReqs extension headers" -PKG_LONGDESC="BigReqs extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/compositeproto/package.mk b/packages/x11/proto/compositeproto/package.mk deleted file mode 100644 index b4fc68c0f7..0000000000 --- a/packages/x11/proto/compositeproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="compositeproto" -PKG_VERSION="0.4.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="compositeproto: Composite extension headers" -PKG_LONGDESC="Composite extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/damageproto/package.mk b/packages/x11/proto/damageproto/package.mk deleted file mode 100644 index 963b44e708..0000000000 --- a/packages/x11/proto/damageproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="damageproto" -PKG_VERSION="1.2.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="damageproto: Damage extension header" -PKG_LONGDESC="Damage extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/dri2proto/package.mk b/packages/x11/proto/dri2proto/package.mk deleted file mode 100644 index 087ffff83c..0000000000 --- a/packages/x11/proto/dri2proto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="dri2proto" -PKG_VERSION="2.8" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="dri2proto: X.Org DRI2 protocol headers" -PKG_LONGDESC="X.Org DRI2 protocol headers." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/dri3proto/package.mk b/packages/x11/proto/dri3proto/package.mk deleted file mode 100644 index 191493e318..0000000000 --- a/packages/x11/proto/dri3proto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="dri3proto" -PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="dri3proto: X.Org DRI3 protocol headers" -PKG_LONGDESC="X.Org DRI3 protocol headers." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/fixesproto/package.mk b/packages/x11/proto/fixesproto/package.mk deleted file mode 100644 index ce679acc4f..0000000000 --- a/packages/x11/proto/fixesproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="fixesproto" -PKG_VERSION="5.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="fixesproto: Fixes extension headers" -PKG_LONGDESC="Fixes extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/fontcacheproto/package.mk b/packages/x11/proto/fontcacheproto/package.mk deleted file mode 100644 index 4b593bbf3c..0000000000 --- a/packages/x11/proto/fontcacheproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="fontcacheproto" -PKG_VERSION="0.1.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="fontcacheproto: Fontcache extension headers" -PKG_LONGDESC="Fontcache extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/fontsproto/package.mk b/packages/x11/proto/fontsproto/package.mk deleted file mode 100644 index 0958477fa7..0000000000 --- a/packages/x11/proto/fontsproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="fontsproto" -PKG_VERSION="2.1.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="fontsproto: Fonts extension headers" -PKG_LONGDESC="Fonts extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/glproto/package.mk b/packages/x11/proto/glproto/package.mk deleted file mode 100644 index 1cefa02fd2..0000000000 --- a/packages/x11/proto/glproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="glproto" -PKG_VERSION="1.4.17" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="glproto: GL extension headers" -PKG_LONGDESC="GL extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/inputproto/package.mk b/packages/x11/proto/inputproto/package.mk deleted file mode 100644 index e784bf66d9..0000000000 --- a/packages/x11/proto/inputproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="inputproto" -PKG_VERSION="2.3.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="inputproto: Input extension headers" -PKG_LONGDESC="Input extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/kbproto/package.mk b/packages/x11/proto/kbproto/package.mk deleted file mode 100644 index 320b7f6cbc..0000000000 --- a/packages/x11/proto/kbproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="kbproto" -PKG_VERSION="1.0.7" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="kbproto: KB extension headers" -PKG_LONGDESC="KB extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/presentproto/package.mk b/packages/x11/proto/presentproto/package.mk deleted file mode 100644 index 32e214743c..0000000000 --- a/packages/x11/proto/presentproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="presentproto" -PKG_VERSION="1.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="presentproto: Present extension headers" -PKG_LONGDESC="The Present extension provides a way for applications to update their window contents from a pixmap in a well defined fashion, synchronizing with the display refresh and potentially using a more efficient mechanism than copying the contents of the source pixmap." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/randrproto/package.mk b/packages/x11/proto/randrproto/package.mk deleted file mode 100644 index ea19fb26b1..0000000000 --- a/packages/x11/proto/randrproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="randrproto" -PKG_VERSION="1.5.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="randrproto: Randr extension headers" -PKG_LONGDESC="Randr extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/recordproto/package.mk b/packages/x11/proto/recordproto/package.mk deleted file mode 100644 index cf684600e9..0000000000 --- a/packages/x11/proto/recordproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="recordproto" -PKG_VERSION="1.14.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="recordproto: Record extension headers" -PKG_LONGDESC="Record extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/renderproto/package.mk b/packages/x11/proto/renderproto/package.mk deleted file mode 100644 index 81b7a055c5..0000000000 --- a/packages/x11/proto/renderproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="renderproto" -PKG_VERSION="0.11.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="renderproto: KB extension headers" -PKG_LONGDESC="Render extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/videoproto/package.mk b/packages/x11/proto/videoproto/package.mk deleted file mode 100644 index 1210aa94d4..0000000000 --- a/packages/x11/proto/videoproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="videoproto" -PKG_VERSION="2.3.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="videoproto: KB extension headers" -PKG_LONGDESC="Video extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xcb-proto/package.mk b/packages/x11/proto/xcb-proto/package.mk index 7c0e7331f0..50e8b777ad 100644 --- a/packages/x11/proto/xcb-proto/package.mk +++ b/packages/x11/proto/xcb-proto/package.mk @@ -1,35 +1,11 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xcb-proto" -PKG_VERSION="1.12" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.13" +PKG_SHA256="7b98721e669be80284e9bbfeab02d2d0d54cd11172b72271e47a2fe875e2bde1" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xcb.freedesktop.org/dist/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros Python:host" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xcb-proto: X C-language Bindings protocol headers" +PKG_DEPENDS_TARGET="toolchain util-macros Python2:host" PKG_LONGDESC="X C-language Bindings protocol headers." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xcmiscproto/package.mk b/packages/x11/proto/xcmiscproto/package.mk deleted file mode 100644 index fb2c428986..0000000000 --- a/packages/x11/proto/xcmiscproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xcmiscproto" -PKG_VERSION="1.2.2" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OpenSource" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xcmiscproto: XCMisc extension headers" -PKG_LONGDESC="XCMisc extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xextproto/package.mk b/packages/x11/proto/xextproto/package.mk deleted file mode 100644 index f50451d642..0000000000 --- a/packages/x11/proto/xextproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xextproto" -PKG_VERSION="7.3.0" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xextproto: KB extension headers" -PKG_LONGDESC="Xext extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86dgaproto/package.mk b/packages/x11/proto/xf86dgaproto/package.mk deleted file mode 100644 index a794b8d103..0000000000 --- a/packages/x11/proto/xf86dgaproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xf86dgaproto" -PKG_VERSION="2.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xf86dgaproto: XF86DGA extension headers" -PKG_LONGDESC="XF86DGA extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86driproto/package.mk b/packages/x11/proto/xf86driproto/package.mk deleted file mode 100644 index 301fe0d67a..0000000000 --- a/packages/x11/proto/xf86driproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xf86driproto" -PKG_VERSION="2.1.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xf86driproto: XF86DRI extension headers" -PKG_LONGDESC="XF86DRI extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86miscproto/package.mk b/packages/x11/proto/xf86miscproto/package.mk deleted file mode 100644 index 2eb2a4c0b9..0000000000 --- a/packages/x11/proto/xf86miscproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xf86miscproto" -PKG_VERSION="0.9.3" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xf86miscproto: XF86Misc extension headers" -PKG_LONGDESC="XF86Misc extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xf86vidmodeproto/package.mk b/packages/x11/proto/xf86vidmodeproto/package.mk deleted file mode 100644 index a6b3d2040f..0000000000 --- a/packages/x11/proto/xf86vidmodeproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xf86vidmodeproto" -PKG_VERSION="2.3.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xf86vidmodeproto: XF86VidMode extension headers" -PKG_LONGDESC="XF86VidMode extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xineramaproto/package.mk b/packages/x11/proto/xineramaproto/package.mk deleted file mode 100644 index 3fb97041de..0000000000 --- a/packages/x11/proto/xineramaproto/package.mk +++ /dev/null @@ -1,35 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xineramaproto" -PKG_VERSION="1.2.1" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.X.org" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xineramaproto: Xinerama extension headers" -PKG_LONGDESC="Xinerama extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" diff --git a/packages/x11/proto/xorgproto/package.mk b/packages/x11/proto/xorgproto/package.mk new file mode 100644 index 0000000000..8b931c8430 --- /dev/null +++ b/packages/x11/proto/xorgproto/package.mk @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="xorgproto" +PKG_VERSION="2018.4" +PKG_SHA256="fee885e0512899ea5280c593fdb2735beb1693ad170c22ebcc844470eec415a0" +PKG_LICENSE="OSS" +PKG_SITE="http://www.X.org" +PKG_URL="https://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain util-macros" +PKG_LONGDESC="combined X.Org X11 Protocol headers" +PKG_TOOLCHAIN="meson" + +PKG_MESON_OPTS_TARGET="-Dlegacy=false" diff --git a/packages/x11/proto/xproto/package.mk b/packages/x11/proto/xproto/package.mk deleted file mode 100644 index 790cebf4ec..0000000000 --- a/packages/x11/proto/xproto/package.mk +++ /dev/null @@ -1,37 +0,0 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -PKG_NAME="xproto" -PKG_VERSION="7.0.31" -PKG_REV="1" -PKG_ARCH="any" -PKG_LICENSE="OSS" -PKG_SITE="http://www.x.org/" -PKG_URL="http://xorg.freedesktop.org/archive/individual/proto/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_HOST="util-macros" -PKG_DEPENDS_TARGET="toolchain util-macros" -PKG_SECTION="x11/proto" -PKG_SHORTDESC="xproto: KB extension headers" -PKG_LONGDESC="X11 extension headers" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - -# package specific configure options -PKG_CONFIGURE_OPTS_TARGET="--without-xmlto" -PKG_CONFIGURE_OPTS_HOST="--without-xmlto" diff --git a/packages/x11/util/util-macros/package.mk b/packages/x11/util/util-macros/package.mk index 0c5c2eb993..37ebeb6276 100644 --- a/packages/x11/util/util-macros/package.mk +++ b/packages/x11/util/util-macros/package.mk @@ -1,36 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="util-macros" -PKG_VERSION="1.19.0" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.19.2" +PKG_SHA256="d7e43376ad220411499a79735020f9d145fdc159284867e99467e0d771f3e712" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/util/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain" -PKG_SECTION="x11/util" -PKG_SHORTDESC="util-macros: X.org autoconf utilities" PKG_LONGDESC="X.org autoconf utilities such as M4 macros." -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" - post_makeinstall_target() { rm -rf $INSTALL/usr } diff --git a/packages/x11/util/xorg-launch-helper/package.mk b/packages/x11/util/xorg-launch-helper/package.mk index 16c59e5d50..34242dfc18 100644 --- a/packages/x11/util/xorg-launch-helper/package.mk +++ b/packages/x11/util/xorg-launch-helper/package.mk @@ -1,35 +1,15 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) PKG_NAME="xorg-launch-helper" PKG_VERSION="4" -PKG_REV="1" -PKG_ARCH="any" +PKG_SHA256="a7f8809a1810212506893ac5c62d8d17fee7a980fb10d59d1bef36f694767be5" PKG_LICENSE="GPL-2" PKG_SITE="https://github.com/sofar/xorg-launch-helper" PKG_URL="http://foo-projects.org/~sofar/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain systemd" -PKG_SECTION="x11/util" -PKG_SHORTDESC="Xorg-launch-helper is a small utility that transforms the X server process (XOrg) into a daemon." -PKG_LONGDESC="Xorg-launch-helper is a small utility that transforms the X server process (XOrg) into a daemon that can be used to make applications wait with starting until XOrg is ready for X11 connections" - -PKG_IS_ADDON="no" -PKG_AUTORECONF="yes" +PKG_LONGDESC="Xorg-launch-helper is a small utility that transforms the X server process (XOrg) into a daemon." +PKG_TOOLCHAIN="autotools" pre_configure_target() { export LIBS="-lsystemd" diff --git a/packages/x11/util/xorg-launch-helper/scripts/xorg-launch b/packages/x11/util/xorg-launch-helper/scripts/xorg-launch index 7e973c425f..9e6c719783 100755 --- a/packages/x11/util/xorg-launch-helper/scripts/xorg-launch +++ b/packages/x11/util/xorg-launch-helper/scripts/xorg-launch @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # wait for xorg-configure@.service # max 10 seconds diff --git a/packages/x11/xserver/xorg-server/package.mk b/packages/x11/xserver/xorg-server/package.mk index fd8e56f9e0..ce2b1bdeac 100644 --- a/packages/x11/xserver/xorg-server/package.mk +++ b/packages/x11/xserver/xorg-server/package.mk @@ -1,35 +1,17 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="xorg-server" -PKG_VERSION="1.19.1" -PKG_REV="1" -PKG_ARCH="any" +PKG_VERSION="1.20.3" +PKG_SHA256="1b3ce466c12cacbe2252b3ad5b0ed561972eef9d09e75900d65fb1e21f9201de" PKG_LICENSE="OSS" PKG_SITE="http://www.X.org" PKG_URL="http://xorg.freedesktop.org/archive/individual/xserver/$PKG_NAME-$PKG_VERSION.tar.bz2" -PKG_DEPENDS_TARGET="toolchain util-macros font-util fontsproto randrproto recordproto renderproto dri2proto dri3proto fixesproto damageproto videoproto inputproto xf86dgaproto xf86vidmodeproto xf86driproto xf86miscproto presentproto libpciaccess libX11 libXfont2 libXinerama libxshmfence libxkbfile libdrm libressl freetype pixman fontsproto systemd xorg-launch-helper" -PKG_SECTION="x11/xserver" -PKG_SHORTDESC="xorg-server: The Xorg X server" -PKG_LONGDESC="Xorg is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware." - -PKG_IS_ADDON="no" -PKG_AUTORECONF="no" +PKG_DEPENDS_TARGET="toolchain util-macros font-util xorgproto libpciaccess libX11 libXfont2 libXinerama libxshmfence libxkbfile libdrm openssl freetype pixman systemd xorg-launch-helper" +PKG_NEED_UNPACK="$(get_pkg_directory xf86-video-nvidia) $(get_pkg_directory xf86-video-nvidia-legacy)" +PKG_LONGDESC="Xorg is a full featured X server running on Intel x86 hardware." +PKG_TOOLCHAIN="autotools" get_graphicdrivers @@ -41,7 +23,7 @@ else fi if [ ! "$OPENGL" = "no" ]; then - PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET glproto $OPENGL libepoxy glu" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $OPENGL libepoxy" XORG_MESA="--enable-glx --enable-dri --enable-glamor" else XORG_MESA="--disable-glx --disable-dri --disable-glamor" @@ -57,7 +39,7 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-debug \ --disable-xselinux \ $XORG_COMPOSITE \ --enable-mitshm \ - --disable-xres \ + --enable-xres \ --enable-record \ --enable-xv \ --disable-xvmc \ @@ -74,7 +56,6 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-debug \ --disable-xace \ --disable-xselinux \ --disable-xcsecurity \ - --disable-tslib \ --enable-dbe \ --disable-xf86bigfont \ --enable-dpms \ @@ -102,11 +83,6 @@ PKG_CONFIGURE_OPTS_TARGET="--disable-debug \ --disable-xwin \ --disable-kdrive \ --disable-xephyr \ - --disable-xfake \ - --disable-xfbdev \ - --disable-kdrive-kbd \ - --disable-kdrive-mouse \ - --disable-kdrive-evdev \ --disable-libunwind \ --enable-xshmfence \ --disable-install-setuid \ @@ -145,11 +121,8 @@ post_makeinstall_target() { mkdir -p $INSTALL/usr/lib/xorg cp -P $PKG_DIR/scripts/xorg-configure $INSTALL/usr/lib/xorg - . $ROOT/packages/x11/driver/xf86-video-nvidia/package.mk - sed -i -e "s|@NVIDIA_VERSION@|${PKG_VERSION}|g" $INSTALL/usr/lib/xorg/xorg-configure - . $ROOT/packages/x11/driver/xf86-video-nvidia-legacy/package.mk - sed -i -e "s|@NVIDIA_LEGACY_VERSION@|${PKG_VERSION}|g" $INSTALL/usr/lib/xorg/xorg-configure - . $ROOT/packages/x11/xserver/xorg-server/package.mk + sed -i -e "s|@NVIDIA_VERSION@|$(get_pkg_version xf86-video-nvidia)|g" $INSTALL/usr/lib/xorg/xorg-configure + sed -i -e "s|@NVIDIA_LEGACY_VERSION@|$(get_pkg_version xf86-video-nvidia-legacy)|g" $INSTALL/usr/lib/xorg/xorg-configure if [ ! "$OPENGL" = "no" ]; then if [ -f $INSTALL/usr/lib/xorg/modules/extensions/libglx.so ]; then @@ -160,16 +133,9 @@ post_makeinstall_target() { fi mkdir -p $INSTALL/etc/X11 - if [ -f $PROJECT_DIR/$PROJECT/xorg/xorg.conf ]; then - cp $PROJECT_DIR/$PROJECT/xorg/xorg.conf $INSTALL/etc/X11 - elif [ -f $PKG_DIR/config/xorg.conf ]; then - cp $PKG_DIR/config/xorg.conf $INSTALL/etc/X11 + if find_file_path config/xorg.conf ; then + cp $FOUND_PATH $INSTALL/etc/X11 fi - - if [ ! "$DEVTOOLS" = yes ]; then - rm -rf $INSTALL/usr/bin/cvt - rm -rf $INSTALL/usr/bin/gtf - fi } post_install() { diff --git a/packages/x11/xserver/xorg-server/patches/xorg-server-1.19.0-sync_pci_ids_mesa.patch b/packages/x11/xserver/xorg-server/patches/xorg-server-1.19.0-sync_pci_ids_mesa.patch deleted file mode 100644 index aa66790677..0000000000 --- a/packages/x11/xserver/xorg-server/patches/xorg-server-1.19.0-sync_pci_ids_mesa.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- xorg-server-1.19.0/hw/xfree86/dri2/pci_ids/i965_pci_ids.h 2016-12-14 20:12:19.000000000 +0100 -+++ xorg-server-1.19.0/hw/xfree86/dri2/pci_ids/i965_pci_ids.h 2017-01-11 19:57:24.280070208 +0100 -@@ -109,6 +109,10 @@ - CHIPSET(0x162B, bdw_gt3, "Intel(R) Iris 6100 (Broadwell GT3)") - CHIPSET(0x162D, bdw_gt3, "Intel(R) Broadwell GT3") - CHIPSET(0x162E, bdw_gt3, "Intel(R) Broadwell GT3") -+CHIPSET(0x22B0, chv, "Intel(R) HD Graphics (Cherrytrail)") -+CHIPSET(0x22B1, chv, "Intel(R) HD Graphics XXX (Braswell)") /* Overridden in brw_get_renderer_string */ -+CHIPSET(0x22B2, chv, "Intel(R) HD Graphics (Cherryview)") -+CHIPSET(0x22B3, chv, "Intel(R) HD Graphics (Cherryview)") - CHIPSET(0x1902, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") - CHIPSET(0x1906, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") - CHIPSET(0x190A, skl_gt1, "Intel(R) Skylake GT1") -@@ -134,6 +138,11 @@ - CHIPSET(0x193A, skl_gt4, "Intel(R) Iris Pro Graphics P580 (Skylake GT4e)") - CHIPSET(0x193B, skl_gt4, "Intel(R) Iris Pro Graphics 580 (Skylake GT4e)") - CHIPSET(0x193D, skl_gt4, "Intel(R) Iris Pro Graphics P580 (Skylake GT4e)") -+CHIPSET(0x0A84, bxt, "Intel(R) HD Graphics (Broxton)") -+CHIPSET(0x1A84, bxt, "Intel(R) HD Graphics (Broxton)") -+CHIPSET(0x1A85, bxt_2x6, "Intel(R) HD Graphics (Broxton 2x6)") -+CHIPSET(0x5A84, bxt, "Intel(R) HD Graphics 505 (Broxton)") -+CHIPSET(0x5A85, bxt_2x6, "Intel(R) HD Graphics 500 (Broxton 2x6)") - CHIPSET(0x5902, kbl_gt1, "Intel(R) Kabylake GT1") - CHIPSET(0x5906, kbl_gt1, "Intel(R) Kabylake GT1") - CHIPSET(0x590A, kbl_gt1, "Intel(R) Kabylake GT1") -@@ -144,22 +153,15 @@ - CHIPSET(0x5915, kbl_gt1_5, "Intel(R) Kabylake GT1.5") - CHIPSET(0x5917, kbl_gt1_5, "Intel(R) Kabylake GT1.5") - CHIPSET(0x5912, kbl_gt2, "Intel(R) Kabylake GT2") --CHIPSET(0x5916, kbl_gt2, "Intel(R) Kabylake GT2") -+CHIPSET(0x5916, kbl_gt2, "Intel(R) HD Graphics 620 (Kabylake GT2)") - CHIPSET(0x591A, kbl_gt2, "Intel(R) Kabylake GT2") - CHIPSET(0x591B, kbl_gt2, "Intel(R) Kabylake GT2") - CHIPSET(0x591D, kbl_gt2, "Intel(R) Kabylake GT2") --CHIPSET(0x591E, kbl_gt2, "Intel(R) Kabylake GT2") -+CHIPSET(0x591E, kbl_gt2, "Intel(R) HD Graphics 615 (Kabylake GT2)") - CHIPSET(0x5921, kbl_gt2, "Intel(R) Kabylake GT2F") - CHIPSET(0x5923, kbl_gt3, "Intel(R) Kabylake GT3") - CHIPSET(0x5926, kbl_gt3, "Intel(R) Kabylake GT3") - CHIPSET(0x5927, kbl_gt3, "Intel(R) Kabylake GT3") - CHIPSET(0x593B, kbl_gt4, "Intel(R) Kabylake GT4") --CHIPSET(0x22B0, chv, "Intel(R) HD Graphics (Cherrytrail)") --CHIPSET(0x22B1, chv, "Intel(R) HD Graphics XXX (Braswell)") /* Overridden in brw_get_renderer_string */ --CHIPSET(0x22B2, chv, "Intel(R) HD Graphics (Cherryview)") --CHIPSET(0x22B3, chv, "Intel(R) HD Graphics (Cherryview)") --CHIPSET(0x0A84, bxt, "Intel(R) HD Graphics (Broxton)") --CHIPSET(0x1A84, bxt, "Intel(R) HD Graphics (Broxton)") --CHIPSET(0x1A85, bxt_2x6, "Intel(R) HD Graphics (Broxton 2x6)") --CHIPSET(0x5A84, bxt, "Intel(R) HD Graphics (Broxton)") --CHIPSET(0x5A85, bxt_2x6, "Intel(R) HD Graphics (Broxton 2x6)") -+CHIPSET(0x3184, glk, "Intel(R) HD Graphics (Geminilake)") -+CHIPSET(0x3185, glk_2x6, "Intel(R) HD Graphics (Geminilake 2x6)") diff --git a/packages/x11/xserver/xorg-server/profile.d/11-xorg-server.conf b/packages/x11/xserver/xorg-server/profile.d/11-xorg-server.conf index 2ed19b7b9c..f206206cb3 100644 --- a/packages/x11/xserver/xorg-server/profile.d/11-xorg-server.conf +++ b/packages/x11/xserver/xorg-server/profile.d/11-xorg-server.conf @@ -1,25 +1,5 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ -# Xorg environment variables. -# -# This file contains non-OpenELEC evironment variables as well as OpenELEC -# evironment variables that are not user defined. -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) DISPLAY=":0.0" export DISPLAY diff --git a/packages/x11/xserver/xorg-server/scripts/xorg-configure b/packages/x11/xserver/xorg-server/scripts/xorg-configure index e7c638254f..a38d84bb79 100755 --- a/packages/x11/xserver/xorg-server/scripts/xorg-configure +++ b/packages/x11/xserver/xorg-server/scripts/xorg-configure @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) ################################################################################ # creating needed directories and symlinks diff --git a/packages/x11/xserver/xorg-server/tmpfiles.d/z_90_xorg-server.conf b/packages/x11/xserver/xorg-server/tmpfiles.d/z_90_xorg-server.conf index 7c0959a1ff..673e6de5d8 100644 --- a/packages/x11/xserver/xorg-server/tmpfiles.d/z_90_xorg-server.conf +++ b/packages/x11/xserver/xorg-server/tmpfiles.d/z_90_xorg-server.conf @@ -1,19 +1,4 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) d /var/cache/xkb 0755 root root - - diff --git a/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules b/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules index c4b4ef36b0..5a63260232 100644 --- a/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules +++ b/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules @@ -1,32 +1,10 @@ -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) ACTION!="add|change", GOTO="end_video" # xorg_start only does something for subsystem "pci" and "video" class. SUBSYSTEM=="pci", ATTR{class}=="0x030000", GOTO="subsystem_pci" -SUBSYSTEM=="drivers", GOTO="subsystem_drivers" -GOTO="end_video" - -# check for drivers dont use the pci substem -LABEL="subsystem_drivers" -KERNEL=="vboxvideo", ENV{xorg_driver}="modesetting", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vboxvideo.service" -KERNEL=="vmwgfx", ENV{xorg_driver}="vmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vmware.service" GOTO="end_video" # check for drivers using the pci substem @@ -34,6 +12,8 @@ LABEL="subsystem_pci" DRIVER=="i915", ENV{xorg_driver}="i915", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@i915.service" DRIVER=="amdgpu", ENV{xorg_driver}="amdgpu", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@amdgpu.service" DRIVER=="radeon", ENV{xorg_driver}="radeon", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@radeon.service" +DRIVER=="vmwgfx", ENV{xorg_driver}="vmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@vmware.service" +DRIVER=="virtio-pci", ENV{xorg_driver}="modesetting", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@modesetting.service" GOTO="end_video" LABEL="end_video" diff --git a/projects/Amlogic/bootloader/mkimage b/projects/Amlogic/bootloader/mkimage new file mode 100644 index 0000000000..48b9652109 --- /dev/null +++ b/projects/Amlogic/bootloader/mkimage @@ -0,0 +1,30 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +# compile and copy amlogic autoscript files to part1 +mcopy $RELEASE_DIR/3rdparty/bootloader/*autoscript :: 2>&1 > /dev/null || true + +# copy device trees to part1 +for dtb in $RELEASE_DIR/3rdparty/bootloader/device_trees $RELEASE_DIR/3rdparty/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb.img ; do + [ -e "$dtb" ] && mcopy -s "$dtb" :: +done + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot" ]; then + echo "Writing u-boot to $(basename $DISK)" + dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error + dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error +fi + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.ini" ]; then + cp -p "$RELEASE_DIR/3rdparty/bootloader/boot.ini" "$LE_TMP/boot.ini" + sed -e "s/@BOOT_UUID@/$UUID_SYSTEM/" \ + -e "s/@DISK_UUID@/$UUID_STORAGE/" \ + -i "$LE_TMP/boot.ini" + mcopy "$LE_TMP/boot.ini" :: +fi + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/config.ini" ]; then + mcopy $RELEASE_DIR/3rdparty/bootloader/config.ini :: +fi diff --git a/projects/Amlogic/bootloader/release b/projects/Amlogic/bootloader/release new file mode 100755 index 0000000000..5bd680e6fb --- /dev/null +++ b/projects/Amlogic/bootloader/release @@ -0,0 +1,7 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +mkdir -p $RELEASE_DIR/3rdparty/bootloader + cp -a $INSTALL/usr/share/bootloader/* $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/Amlogic/bootloader/update.sh b/projects/Amlogic/bootloader/update.sh new file mode 100755 index 0000000000..f4d5c7fe3b --- /dev/null +++ b/projects/Amlogic/bootloader/update.sh @@ -0,0 +1,121 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" +[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" +[ -z "$UPDATE_DIR" ] && UPDATE_DIR="/storage/.update" + +UPDATE_DTB_IMG="$UPDATE_DIR/dtb.img" +UPDATE_DTB="$(ls -1 "$UPDATE_DIR"/*.dtb 2>/dev/null | head -n 1)" + +[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) +if [ -z "$BOOT_DISK" ]; then + case $BOOT_PART in + /dev/sd[a-z][0-9]*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") + ;; + /dev/mmcblk*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") + ;; + esac +fi + +mount -o rw,remount $BOOT_ROOT + +for arg in $(cat /proc/cmdline); do + case $arg in + boot=*) + boot="${arg#*=}" + case $boot in + /dev/mmc*) + BOOT_UUID="$(blkid $boot | sed 's/.* UUID="//;s/".*//g')" + ;; + UUID=*|LABEL=*) + BOOT_UUID="$(blkid | sed 's/"//g' | grep -m 1 -i " $boot " | sed 's/.* UUID=//;s/ .*//g')" + ;; + esac + + if [ -f "/proc/device-tree/le-dt-id" ] ; then + LE_DT_ID=$(cat /proc/device-tree/le-dt-id) + fi + + if [ -f "$UPDATE_DTB_IMG" ] ; then + UPDATE_DTB_SOURCE="$UPDATE_DTB_IMG" + elif [ -f "$UPDATE_DTB" ] ; then + UPDATE_DTB_SOURCE="$UPDATE_DTB" + elif [ -n "$LE_DT_ID" -a -f "$SYSTEM_ROOT/usr/share/bootloader/device_trees/$LE_DT_ID.dtb" ] ; then + UPDATE_DTB_SOURCE="$SYSTEM_ROOT/usr/share/bootloader/device_trees/$LE_DT_ID.dtb" + fi + + if [ -f "$UPDATE_DTB_SOURCE" ] ; then + echo "Updating device tree from $UPDATE_DTB_SOURCE..." + case $boot in + /dev/system) + dd if=/dev/zero of=/dev/dtb bs=256k count=1 status=none + dd if="$UPDATE_DTB_SOURCE" of=/dev/dtb bs=256k status=none + ;; + /dev/mmc*|LABEL=*|UUID=*) + cp -f "$UPDATE_DTB_SOURCE" "$BOOT_ROOT/dtb.img" + ;; + esac + fi + + for all_dtb in /flash/*.dtb ; do + if [ -f $all_dtb ] ; then + dtb=$(basename $all_dtb) + if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then + echo "Updating $dtb..." + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT + fi + fi + done + ;; + + disk=*) + disk="${arg#*=}" + case $disk in + /dev/mmc*) + DISK_UUID="$(blkid $disk | sed 's/.* UUID="//;s/".*//g')" + ;; + UUID=*|LABEL=*) + DISK_UUID="$(blkid | sed 's/"//g' | grep -m 1 -i " $disk " | sed 's/.* UUID=//;s/ .*//g')" + ;; + esac + ;; + esac +done + +if [ -d $BOOT_ROOT/device_trees ]; then + rm $BOOT_ROOT/device_trees/*.dtb + cp -p $SYSTEM_ROOT/usr/share/bootloader/*.dtb $BOOT_ROOT/device_trees/ +fi + +if [ -f $SYSTEM_ROOT/usr/share/bootloader/boot.ini ]; then + echo "Updating boot.ini..." + cp -p $SYSTEM_ROOT/usr/share/bootloader/boot.ini $BOOT_ROOT/boot.ini + sed -e "s/@BOOT_UUID@/$BOOT_UUID/" \ + -e "s/@DISK_UUID@/$DISK_UUID/" \ + -i $BOOT_ROOT/boot.ini + + if [ -f $SYSTEM_ROOT/usr/share/bootloader/config.ini ]; then + if [ ! -f $BOOT_ROOT/config.ini ]; then + echo "Creating config.ini..." + cp -p $SYSTEM_ROOT/usr/share/bootloader/config.ini $BOOT_ROOT/config.ini + fi + fi +fi + +if [ -f $SYSTEM_ROOT/usr/share/bootloader/boot-logo.bmp.gz ]; then + echo "Updating boot logo..." + cp -p $SYSTEM_ROOT/usr/share/bootloader/boot-logo.bmp.gz $BOOT_ROOT +fi + +if [ -f $SYSTEM_ROOT/usr/share/bootloader/u-boot -a ! -e /dev/system -a ! -e /dev/boot ]; then + echo "Updating u-boot on: $BOOT_DISK..." + dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot of=$BOOT_DISK conv=fsync bs=1 count=112 status=none + dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot of=$BOOT_DISK conv=fsync bs=512 skip=1 seek=1 status=none +fi + +mount -o ro,remount $BOOT_ROOT diff --git a/projects/Amlogic/devices/KVIM/bootloader/boot.ini b/projects/Amlogic/devices/KVIM/bootloader/boot.ini new file mode 100644 index 0000000000..d0a86674e9 --- /dev/null +++ b/projects/Amlogic/devices/KVIM/bootloader/boot.ini @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini +# +# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE! +# Set your own settings in config.ini +# +#------------------------------------------------------------------------------------------------------ +KHADAS-UBOOT-CONFIG + +setenv bootrootfs "BOOT_IMAGE=kernel.img boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@" +setenv condev "ttyS0,115200" +setenv hdmimode "1080p60hz" +setenv hdmioutput "1" +setenv vpu "1" +setenv libreelec "quiet" +setenv hdmi_cec "1" +setenv uenv_addr 0x13000000 + +fatload mmc 0:1 ${loadaddr} kernel.img +fatload mmc 0:1 ${dtb_mem_addr} dtb.img + +if fatload mmc 0:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi + +setenv khadas "no_console_suspend logo=osd1,loaded,0x3f800000,${hdmimode} vout=${hdmimode},enable hdmimode=${hdmimode} cvbsmode=nocvbs consoleblank=0" +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi +setenv bootargs "console=${condev} ${bootrootfs} ${khadas} ${cec} ${libreelec}" + +# Device tree modifications +bootm start +bootm loados +bootm fdt +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +# Remove aml partition layout from device tree (required for eMMC boot) +fdt rm /partitions +bootm prep + +# Boot the board +bootm go diff --git a/projects/Amlogic/devices/KVIM/bootloader/config.ini b/projects/Amlogic/devices/KVIM/bootloader/config.ini new file mode 100644 index 0000000000..3cd4f541b2 --- /dev/null +++ b/projects/Amlogic/devices/KVIM/bootloader/config.ini @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------------------------------ +# +# config.ini +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# on serial port: +# condev='ttyS0,115200' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# hdmimode='480i60hz' +# hdmimode='480p60hz' +# hdmimode='576i50hz' +# hdmimode='576p50hz' +# hdmimode='720p60hz' +# hdmimode='720p50hz' +# hdmimode='1080i60hz' +# hdmimode='1080p60hz' +# hdmimode='1080i50hz' +# hdmimode='1080p50hz' +# hdmimode='1080p30hz' +# hdmimode='1080p25hz' +# hdmimode='1080p24hz' +# hdmimode='2160p60hz' +# hdmimode='2160p50hz' +# hdmimode='2160p30hz' +# hdmimode='2160p25hz' +# hdmimode='2160p24hz' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +# +# libreelec='quiet' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# hdmi_cec='0' +# hdmi_cec='1' +# +#------------------------------------------------------------------------------------------------------ diff --git a/projects/Amlogic/devices/KVIM/options b/projects/Amlogic/devices/KVIM/options new file mode 100644 index 0000000000..943ed6369a --- /dev/null +++ b/projects/Amlogic/devices/KVIM/options @@ -0,0 +1,33 @@ + # u-boot version to use (default) + UBOOT_VERSION="vendor" + + # Configuration for u-boot + UBOOT_CONFIG="kvim_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxl_p212_2g_kvim.dtb" + + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS ap6xxx-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" + + # add OOTB support for Khadas VIM IR remote + IR_REMOTE_KEYMAPS="$IR_REMOTE_KEYMAPS khadas_vim" diff --git a/projects/Amlogic/devices/KVIM2/bootloader/boot.ini b/projects/Amlogic/devices/KVIM2/bootloader/boot.ini new file mode 100644 index 0000000000..d0a86674e9 --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/bootloader/boot.ini @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini +# +# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE! +# Set your own settings in config.ini +# +#------------------------------------------------------------------------------------------------------ +KHADAS-UBOOT-CONFIG + +setenv bootrootfs "BOOT_IMAGE=kernel.img boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@" +setenv condev "ttyS0,115200" +setenv hdmimode "1080p60hz" +setenv hdmioutput "1" +setenv vpu "1" +setenv libreelec "quiet" +setenv hdmi_cec "1" +setenv uenv_addr 0x13000000 + +fatload mmc 0:1 ${loadaddr} kernel.img +fatload mmc 0:1 ${dtb_mem_addr} dtb.img + +if fatload mmc 0:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi + +setenv khadas "no_console_suspend logo=osd1,loaded,0x3f800000,${hdmimode} vout=${hdmimode},enable hdmimode=${hdmimode} cvbsmode=nocvbs consoleblank=0" +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi +setenv bootargs "console=${condev} ${bootrootfs} ${khadas} ${cec} ${libreelec}" + +# Device tree modifications +bootm start +bootm loados +bootm fdt +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +# Remove aml partition layout from device tree (required for eMMC boot) +fdt rm /partitions +bootm prep + +# Boot the board +bootm go diff --git a/projects/Amlogic/devices/KVIM2/bootloader/config.ini b/projects/Amlogic/devices/KVIM2/bootloader/config.ini new file mode 100644 index 0000000000..3cd4f541b2 --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/bootloader/config.ini @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------------------------------ +# +# config.ini +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# on serial port: +# condev='ttyS0,115200' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# hdmimode='480i60hz' +# hdmimode='480p60hz' +# hdmimode='576i50hz' +# hdmimode='576p50hz' +# hdmimode='720p60hz' +# hdmimode='720p50hz' +# hdmimode='1080i60hz' +# hdmimode='1080p60hz' +# hdmimode='1080i50hz' +# hdmimode='1080p50hz' +# hdmimode='1080p30hz' +# hdmimode='1080p25hz' +# hdmimode='1080p24hz' +# hdmimode='2160p60hz' +# hdmimode='2160p50hz' +# hdmimode='2160p30hz' +# hdmimode='2160p25hz' +# hdmimode='2160p24hz' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +# +# libreelec='quiet' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# hdmi_cec='0' +# hdmi_cec='1' +# +#------------------------------------------------------------------------------------------------------ diff --git a/projects/Amlogic/devices/KVIM2/filesystem/usr/lib/systemd/system/cpufreq.service b/projects/Amlogic/devices/KVIM2/filesystem/usr/lib/systemd/system/cpufreq.service new file mode 100644 index 0000000000..afbc794ecb --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/filesystem/usr/lib/systemd/system/cpufreq.service @@ -0,0 +1,9 @@ +[Unit] +Description=Set minimum frequency to 1GHz for both CPU clusters + +[Service] +Type=simple +ExecStart=-/usr/bin/sh -c 'echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq; echo 1000000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq' + +[Install] +WantedBy=basic.target diff --git a/projects/Amlogic/devices/KVIM2/options b/projects/Amlogic/devices/KVIM2/options new file mode 100644 index 0000000000..9d963aae83 --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/options @@ -0,0 +1,36 @@ + # u-boot version to use (default) + UBOOT_VERSION="vendor" + + # Configuration for u-boot + UBOOT_CONFIG="kvim2_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxm_kvim2.dtb" + + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson-t82x" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="gxm" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS ap6xxx-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/LePotato/bootloader/boot.ini b/projects/Amlogic/devices/LePotato/bootloader/boot.ini new file mode 100644 index 0000000000..2f3ffdb6d0 --- /dev/null +++ b/projects/Amlogic/devices/LePotato/bootloader/boot.ini @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini +# +# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE! +# Set your own settings in config.ini +# +#------------------------------------------------------------------------------------------------------ +LIBRETECH-UBOOT-CONFIG + +setenv bootrootfs "BOOT_IMAGE=kernel.img boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@" +setenv condev "ttyS0,115200" +setenv hdmimode "1080p60hz" +setenv hdmioutput "1" +setenv vpu "1" +setenv libreelec "quiet" +setenv hdmi_cec "1" +setenv uenv_addr 0x13000000 + +fatload mmc 0:1 ${loadaddr} kernel.img +fatload mmc 0:1 ${dtb_mem_addr} dtb.img + +if fatload mmc 0:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi + +setenv libretech "no_console_suspend logo=osd1,loaded,0x3f800000,${hdmimode} vout=${hdmimode},enable hdmimode=${hdmimode} cvbsmode=nocvbs consoleblank=0" +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi +setenv bootargs "console=${condev} ${bootrootfs} ${libretech} ${cec} ${libreelec}" + +# Device tree modifications +bootm start +bootm loados +bootm fdt +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +# Remove aml partition layout from device tree (required for eMMC boot) +fdt rm /partitions +bootm prep + +# Boot the board +bootm go diff --git a/projects/Amlogic/devices/LePotato/bootloader/config.ini b/projects/Amlogic/devices/LePotato/bootloader/config.ini new file mode 100644 index 0000000000..a1858eabec --- /dev/null +++ b/projects/Amlogic/devices/LePotato/bootloader/config.ini @@ -0,0 +1,70 @@ +#------------------------------------------------------------------------------------------------------ +# +# config.ini +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# on serial port: +# condev='ttyS0,115200' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# hdmimode='480i60hz' +# hdmimode='480i_rpt' +# hdmimode='480p60hz' +# hdmimode='480p_rpt' +# hdmimode='576i50hz' +# hdmimode='576i_rpt' +# hdmimode='576p50hz' +# hdmimode='576p_rpt' +# hdmimode='720p60hz' +# hdmimode='720p50hz' +# hdmimode='1080i60hz' +# hdmimode='1080p60hz' +# hdmimode='1080i50hz' +# hdmimode='1080p50hz' +# hdmimode='1080p30hz' +# hdmimode='1080p25hz' +# hdmimode='1080p24hz' +# hdmimode='2160p60hz' +# hdmimode='2160p50hz' +# hdmimode='2160p30hz' +# hdmimode='2160p25hz' +# hdmimode='2160p24hz' +# hdmimode='2160p60hz420' +# hdmimode='2160p50hz420' +# hdmimode='smpte60hz' +# hdmimode='smpte50hz' +# hdmimode='smpte30hz' +# hdmimode='smpte25hz' +# hdmimode='smpte24hz' +# hdmimode='smpte60hz420' +# hdmimode='smpte50hz420' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +# +# libreelec='quiet' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# hdmi_cec='0' +# hdmi_cec='1' +# +#------------------------------------------------------------------------------------------------------ diff --git a/projects/Amlogic/devices/LePotato/options b/projects/Amlogic/devices/LePotato/options new file mode 100644 index 0000000000..b45d8531a5 --- /dev/null +++ b/projects/Amlogic/devices/LePotato/options @@ -0,0 +1,19 @@ + # u-boot version to use (default) + UBOOT_VERSION="vendor" + + # Configuration for u-boot + UBOOT_CONFIG="libretech_cc_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxl_p212_1g_lepotato.dtb gxl_p212_2g_lepotato.dtb" + + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/Odroid_C2/bootloader/boot.ini b/projects/Amlogic/devices/Odroid_C2/bootloader/boot.ini new file mode 100644 index 0000000000..3e2689282e --- /dev/null +++ b/projects/Amlogic/devices/Odroid_C2/bootloader/boot.ini @@ -0,0 +1,43 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini +# +# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE! +# Set your own settings in config.ini +# +#------------------------------------------------------------------------------------------------------ +ODROIDC2-UBOOT-CONFIG + +setenv bootrootfs "BOOT_IMAGE=KERNEL boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@" +setenv condev "ttyS0,115200" +setenv hdmimode "1080p60hz" +setenv hdmioutput "1" +setenv vpu "1" +setenv libreelec "quiet" +setenv hdmi_cec "1" +setenv maxcpus "4" +setenv max_freq "1536" +setenv rtc_shield "0" + +setenv kernel_addr 0x11000000 +setenv dtb_addr 0x1000000 +setenv uenv_addr 0x13000000 +fatload mmc 0:1 ${kernel_addr} KERNEL +fatload mmc 0:1 ${dtb_addr} meson64_odroidc2.dtb +if fatload mmc 0:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi + +fdt addr ${dtb_addr} +fdt resize + +setenv odroidp1 "no_console_suspend logo=osd1,loaded,0x3f800000,${hdmimode} vout=${hdmimode},enable hdmimode=${hdmimode} cvbsmode=nocvbs" +setenv odroidp2 "mac=${ethaddr} consoleblank=0 max_freq=${max_freq} maxcpus=${maxcpus}" +setenv odroid "${odroidp1} ${odroidp2}" + +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +if test "${rtc_shield}" = "0"; then fdt set "/i2c@c1108500/pcf8563@51" status disabled; fi + +setenv bootargs "console=${condev} ${bootrootfs} ${odroid} ${cec} ${libreelec} " + +booti ${kernel_addr} - ${dtb_addr} diff --git a/projects/Amlogic/devices/Odroid_C2/bootloader/config.ini b/projects/Amlogic/devices/Odroid_C2/bootloader/config.ini new file mode 100644 index 0000000000..e5efbc8b37 --- /dev/null +++ b/projects/Amlogic/devices/Odroid_C2/bootloader/config.ini @@ -0,0 +1,112 @@ +#------------------------------------------------------------------------------------------------------ +# +# config.ini +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# on serial port: +# condev='ttyS0,115200' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# hdmimode='480i60hz' +# hdmimode='480i_rpt' +# hdmimode='480p60hz' +# hdmimode='480p_rpt' +# hdmimode='576i50hz' +# hdmimode='576i_rpt' +# hdmimode='576p50hz' +# hdmimode='576p_rpt' +# hdmimode='720p60hz' +# hdmimode='720p50hz' +# hdmimode='1080i60hz' +# hdmimode='1080p60hz' +# hdmimode='1080i50hz' +# hdmimode='1080p50hz' +# hdmimode='1080p30hz' +# hdmimode='1080p25hz' +# hdmimode='1080p24hz' +# hdmimode='2160p60hz' +# hdmimode='2160p50hz' +# hdmimode='2160p30hz' +# hdmimode='2160p25hz' +# hdmimode='2160p24hz' +# hdmimode='2160p60hz420' +# hdmimode='2160p50hz420' +# hdmimode='smpte60hz' +# hdmimode='smpte50hz' +# hdmimode='smpte30hz' +# hdmimode='smpte25hz' +# hdmimode='smpte24hz' +# hdmimode='smpte60hz420' +# hdmimode='smpte50hz420' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +# +# libreelec='quiet' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# hdmi_cec='0' +# hdmi_cec='1' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable RTC Shield +# rtc_shield='0' +# rtc_shield='1' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# CPU Frequency / Cores control +# +# WARNING!!! WARNING!!! WARNING!!! +# Before changing anything here please read the wiki entry: +# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq +# +# MAX CPU's +# maxcpus='1' +# maxcpus='2' +# maxcpus='3' +# maxcpus='4' +# +# MAX Frequency +# 2.016GHz +# max_freq='2016' +# 1.944GHz +# max_freq='1944' +# 1.920GHz +# max_freq='1920' +# 1.896GHz +# max_freq='1896 +# 1.752GHz +# max_freq='1752' +# 1.680GHz +# max_freq='1680' +# 1.656GHz +# max_freq='1656' +# 1.536GHz +# max_freq='1536' +# +#------------------------------------------------------------------------------------------------------ diff --git a/projects/Amlogic/devices/Odroid_C2/filesystem/etc/lirc/lircd.conf.d/odroid-amremote.conf b/projects/Amlogic/devices/Odroid_C2/filesystem/etc/lirc/lircd.conf.d/odroid-amremote.conf new file mode 100644 index 0000000000..225d31c953 --- /dev/null +++ b/projects/Amlogic/devices/Odroid_C2/filesystem/etc/lirc/lircd.conf.d/odroid-amremote.conf @@ -0,0 +1,34 @@ +begin remote + + name odroid_amremote + bits 16 + flags SPACE_ENC|CONST_LENGTH + eps 30 + aeps 100 + + header 9000 4500 + one 563 1687 + zero 563 562 + ptrail 563 + repeat 9000 2250 + pre_data_bits 16 + pre_data 0x4DB2 + gap 0 + suppress_repeat 1 + + begin codes + KEY_POWER 0x3BC4 + KEY_MUTE 0x11EE + KEY_HOME 0x41BE + KEY_OK 0x738C + KEY_LEFT 0x9966 + KEY_RIGHT 0x837C + KEY_UP 0x53AC + KEY_DOWN 0x4BB4 + KEY_BACK 0x59A6 + KEY_MENU 0xA35C + KEY_VOLUMEDOWN 0x817E + KEY_VOLUMEUP 0x01FE + end codes + +end remote diff --git a/projects/Odroid_C2/filesystem/usr/lib/udev/rules.d/99-spidev.rules b/projects/Amlogic/devices/Odroid_C2/filesystem/usr/lib/udev/rules.d/99-spidev.rules similarity index 100% rename from projects/Odroid_C2/filesystem/usr/lib/udev/rules.d/99-spidev.rules rename to projects/Amlogic/devices/Odroid_C2/filesystem/usr/lib/udev/rules.d/99-spidev.rules diff --git a/projects/Amlogic/devices/Odroid_C2/filesystem/usr/share/bootloader/canupdate.sh b/projects/Amlogic/devices/Odroid_C2/filesystem/usr/share/bootloader/canupdate.sh new file mode 100755 index 0000000000..a5f5721636 --- /dev/null +++ b/projects/Amlogic/devices/Odroid_C2/filesystem/usr/share/bootloader/canupdate.sh @@ -0,0 +1,7 @@ +# Allow upgrades between aarch64 and arm +PROJECT="Odroid_C2" +if [ "$1" = "${PROJECT}.aarch64" ] || [ "$1" = "${PROJECT}.arm" ]; then + exit 0 +else + exit 1 +fi diff --git a/projects/Amlogic/devices/Odroid_C2/options b/projects/Amlogic/devices/Odroid_C2/options new file mode 100644 index 0000000000..2e6e17a230 --- /dev/null +++ b/projects/Amlogic/devices/Odroid_C2/options @@ -0,0 +1,30 @@ + # Configuration for u-boot + UBOOT_CONFIG="odroidc2_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel target for u-boot (default 'uImage' if BOOTLOADER=u-boot) (uImage / zImage) + KERNEL_TARGET="Image" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Build Android kernel image using mkbootimg + BUILD_ANDROID_BOOTIMG="" + + # Additional options to be passed to Android mkbootimg + ANDROID_BOOTIMG_OPTIONS="" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="dtbs" + + # kernel image name + KERNEL_NAME="KERNEL" + + # Amlogic IR remote support (yes / no) + AMREMOTE_SUPPORT="no" + + # add OOTB support for Odroid IR remote + IR_REMOTE_KEYMAPS="$IR_REMOTE_KEYMAPS odroid" + diff --git a/projects/Amlogic/devices/S905/options b/projects/Amlogic/devices/S905/options new file mode 100644 index 0000000000..3a5fa8567e --- /dev/null +++ b/projects/Amlogic/devices/S905/options @@ -0,0 +1,21 @@ + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS ap6xxx-aml mt7601u-aml mt7603u-aml \ + qca9377-aml RTL8189ES-aml RTL8189FS-aml RTL8723BS-aml \ + RTL8723DS-aml RTL8822BU-aml ssv6xxx-aml fd628-aml wetekdvb \ + avl6862-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml rtl8723bs_bt qca9377-firmware-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/S912/filesystem/usr/lib/systemd/system/cpufreq.service b/projects/Amlogic/devices/S912/filesystem/usr/lib/systemd/system/cpufreq.service new file mode 100644 index 0000000000..afbc794ecb --- /dev/null +++ b/projects/Amlogic/devices/S912/filesystem/usr/lib/systemd/system/cpufreq.service @@ -0,0 +1,9 @@ +[Unit] +Description=Set minimum frequency to 1GHz for both CPU clusters + +[Service] +Type=simple +ExecStart=-/usr/bin/sh -c 'echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq; echo 1000000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq' + +[Install] +WantedBy=basic.target diff --git a/projects/Amlogic/devices/S912/options b/projects/Amlogic/devices/S912/options new file mode 100644 index 0000000000..95dfe8cb2d --- /dev/null +++ b/projects/Amlogic/devices/S912/options @@ -0,0 +1,30 @@ + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxm_q200_2g.dtb gxm_q201_1g.dtb gxm_q201_2g.dtb" + + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson-t82x" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="gxm" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS ap6xxx-aml mt7601u-aml mt7603u-aml \ + qca9377-aml RTL8189ES-aml RTL8189FS-aml \ + RTL8723BS-aml RTL8723DS-aml RTL8822BU-aml ssv6xxx-aml fd628-aml \ + avl6862-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml rtl8723bs_bt qca9377-firmware-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Odroid_C2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf b/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/lib/alsa/cards/AML-M8AUDIO.conf similarity index 100% rename from projects/Odroid_C2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf rename to projects/Amlogic/devices/WeTek_Hub/filesystem/usr/lib/alsa/cards/AML-M8AUDIO.conf diff --git a/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/share/bootloader/canupdate.sh b/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/share/bootloader/canupdate.sh new file mode 100755 index 0000000000..d25db313df --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/share/bootloader/canupdate.sh @@ -0,0 +1,7 @@ +# Allow upgrades between aarch64 and arm +PROJECT="WeTek_Hub" +if [ "$1" = "${PROJECT}.aarch64" ] || [ "$1" = "${PROJECT}.arm" ]; then + exit 0 +else + exit 1 +fi diff --git a/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/share/bootloader/update.sh b/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/share/bootloader/update.sh new file mode 100755 index 0000000000..3daf7c6a14 --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Hub/filesystem/usr/share/bootloader/update.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" +[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" + +IMAGE_KERNEL="/flash/kernel.img" + +# parse command line arguments +for arg in $(cat /proc/cmdline); do + case $arg in + BOOT_IMAGE=*) + IMAGE_KERNEL="${arg#*=}" + ;; + esac +done + + +# mount $BOOT_ROOT r/w + mount -o remount,rw $BOOT_ROOT + +if [ -b $IMAGE_KERNEL ]; then + dd if="$SYSTEM_ROOT/usr/share/bootloader/dtb.img" of="/dev/dtb" bs=262144 2>&1 +else + cp -p $SYSTEM_ROOT/usr/share/bootloader/dtb.img $BOOT_ROOT +fi + +# mount $BOOT_ROOT r/o + sync + mount -o remount,ro $BOOT_ROOT diff --git a/projects/WeTek_Hub/install/files/bootloader.img b/projects/Amlogic/devices/WeTek_Hub/install/files/bootloader.img similarity index 100% rename from projects/WeTek_Hub/install/files/bootloader.img rename to projects/Amlogic/devices/WeTek_Hub/install/files/bootloader.img diff --git a/projects/Amlogic/devices/WeTek_Hub/install/files/logo.img b/projects/Amlogic/devices/WeTek_Hub/install/files/logo.img new file mode 100644 index 0000000000..5177de95eb Binary files /dev/null and b/projects/Amlogic/devices/WeTek_Hub/install/files/logo.img differ diff --git a/projects/WeTek_Hub/install/files/recovery.img b/projects/Amlogic/devices/WeTek_Hub/install/files/recovery.img similarity index 100% rename from projects/WeTek_Hub/install/files/recovery.img rename to projects/Amlogic/devices/WeTek_Hub/install/files/recovery.img diff --git a/projects/WeTek_Hub/install/update-binary b/projects/Amlogic/devices/WeTek_Hub/install/update-binary similarity index 100% rename from projects/WeTek_Hub/install/update-binary rename to projects/Amlogic/devices/WeTek_Hub/install/update-binary diff --git a/projects/Amlogic/devices/WeTek_Hub/install/updater-script b/projects/Amlogic/devices/WeTek_Hub/install/updater-script new file mode 100644 index 0000000000..d896a2e4a3 --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Hub/install/updater-script @@ -0,0 +1,39 @@ +show_progress(0.500000, 3); +set_bootloader_env("upgrade_step", "3"); + +ui_print("Wiping Userdata"); +format("ext4", "EMMC", "/dev/block/data", "0", "/data"); + +ui_print("Writing kernel image"); +assert(package_extract_file("KERNEL", "/tmp/boot.img"), + write_raw_image("/tmp/boot.img", "boot"), + delete("/tmp/boot.img")); + +ui_print("Writing device tree image"); +write_dtb_image(package_extract_file("dtb.img")); + +show_progress(0.020000, 0); + +ui_print("Wiping System"); +format("ext4", "EMMC", "/dev/block/system", "0", "/system"); +mount("ext4", "EMMC", "/dev/block/system", "/system"); +ui_print("Writing system files"); +package_extract_dir("system", "/system"); +unmount("/system"); + +show_progress(0.300000, 60); + +ui_print("Writing recovery"); +write_raw_image(package_extract_file("recovery.img"), "recovery"); + +show_progress(0.018000, 0); + +ui_print("Writing bootloader"); +write_raw_image(package_extract_file("bootloader.img"), "bootloader"); + +ui_print("Writing logo"); +write_raw_image(package_extract_file("logo.img"), "logo"); + +set_bootloader_env("upgrade_check", "defenv_reserv; setenv upgrade_step 2; saveenv;"); +show_progress(0.100000, 0); +ui_print("LibreELEC Installed Successfully"); diff --git a/projects/Amlogic/devices/WeTek_Hub/options b/projects/Amlogic/devices/WeTek_Hub/options new file mode 100644 index 0000000000..91bd6bfbbe --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Hub/options @@ -0,0 +1,16 @@ + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxbb_p200_1G_wetek_hub.dtb" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS brcmap6xxx-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-aml" + + # add OOTB support for Wetek Hub IR remote + IR_REMOTE_KEYMAPS="$IR_REMOTE_KEYMAPS wetek_hub" diff --git a/projects/WeTek_Hub/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf b/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf similarity index 100% rename from projects/WeTek_Hub/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf rename to projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf diff --git a/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/bootloader/canupdate.sh b/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/bootloader/canupdate.sh new file mode 100755 index 0000000000..2338439a5e --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/bootloader/canupdate.sh @@ -0,0 +1,7 @@ +# Allow upgrades between aarch64 and arm +PROJECT="WeTek_Play_2" +if [ "$1" = "${PROJECT}.aarch64" ] || [ "$1" = "${PROJECT}.arm" ]; then + exit 0 +else + exit 1 +fi diff --git a/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/bootloader/update.sh b/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/bootloader/update.sh new file mode 100755 index 0000000000..3daf7c6a14 --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Play_2/filesystem/usr/share/bootloader/update.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" +[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" + +IMAGE_KERNEL="/flash/kernel.img" + +# parse command line arguments +for arg in $(cat /proc/cmdline); do + case $arg in + BOOT_IMAGE=*) + IMAGE_KERNEL="${arg#*=}" + ;; + esac +done + + +# mount $BOOT_ROOT r/w + mount -o remount,rw $BOOT_ROOT + +if [ -b $IMAGE_KERNEL ]; then + dd if="$SYSTEM_ROOT/usr/share/bootloader/dtb.img" of="/dev/dtb" bs=262144 2>&1 +else + cp -p $SYSTEM_ROOT/usr/share/bootloader/dtb.img $BOOT_ROOT +fi + +# mount $BOOT_ROOT r/o + sync + mount -o remount,ro $BOOT_ROOT diff --git a/projects/WeTek_Play_2/install/files/bootloader.img b/projects/Amlogic/devices/WeTek_Play_2/install/files/bootloader.img similarity index 100% rename from projects/WeTek_Play_2/install/files/bootloader.img rename to projects/Amlogic/devices/WeTek_Play_2/install/files/bootloader.img diff --git a/projects/Amlogic/devices/WeTek_Play_2/install/files/logo.img b/projects/Amlogic/devices/WeTek_Play_2/install/files/logo.img new file mode 100644 index 0000000000..75ac7ec332 Binary files /dev/null and b/projects/Amlogic/devices/WeTek_Play_2/install/files/logo.img differ diff --git a/projects/WeTek_Play_2/install/files/recovery.img b/projects/Amlogic/devices/WeTek_Play_2/install/files/recovery.img similarity index 100% rename from projects/WeTek_Play_2/install/files/recovery.img rename to projects/Amlogic/devices/WeTek_Play_2/install/files/recovery.img diff --git a/projects/WeTek_Play_2/install/update-binary b/projects/Amlogic/devices/WeTek_Play_2/install/update-binary similarity index 100% rename from projects/WeTek_Play_2/install/update-binary rename to projects/Amlogic/devices/WeTek_Play_2/install/update-binary diff --git a/projects/Amlogic/devices/WeTek_Play_2/install/updater-script b/projects/Amlogic/devices/WeTek_Play_2/install/updater-script new file mode 100644 index 0000000000..d896a2e4a3 --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Play_2/install/updater-script @@ -0,0 +1,39 @@ +show_progress(0.500000, 3); +set_bootloader_env("upgrade_step", "3"); + +ui_print("Wiping Userdata"); +format("ext4", "EMMC", "/dev/block/data", "0", "/data"); + +ui_print("Writing kernel image"); +assert(package_extract_file("KERNEL", "/tmp/boot.img"), + write_raw_image("/tmp/boot.img", "boot"), + delete("/tmp/boot.img")); + +ui_print("Writing device tree image"); +write_dtb_image(package_extract_file("dtb.img")); + +show_progress(0.020000, 0); + +ui_print("Wiping System"); +format("ext4", "EMMC", "/dev/block/system", "0", "/system"); +mount("ext4", "EMMC", "/dev/block/system", "/system"); +ui_print("Writing system files"); +package_extract_dir("system", "/system"); +unmount("/system"); + +show_progress(0.300000, 60); + +ui_print("Writing recovery"); +write_raw_image(package_extract_file("recovery.img"), "recovery"); + +show_progress(0.018000, 0); + +ui_print("Writing bootloader"); +write_raw_image(package_extract_file("bootloader.img"), "bootloader"); + +ui_print("Writing logo"); +write_raw_image(package_extract_file("logo.img"), "logo"); + +set_bootloader_env("upgrade_check", "defenv_reserv; setenv upgrade_step 2; saveenv;"); +show_progress(0.100000, 0); +ui_print("LibreELEC Installed Successfully"); diff --git a/projects/Amlogic/devices/WeTek_Play_2/options b/projects/Amlogic/devices/WeTek_Play_2/options new file mode 100644 index 0000000000..e8d358439a --- /dev/null +++ b/projects/Amlogic/devices/WeTek_Play_2/options @@ -0,0 +1,17 @@ + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxbb_p200_2G_wetek_play_2.dtb" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS brcmap6xxx-aml wetekdvb" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-aml" + + # add OOTB support for Wetek Play 2 IR remote + IR_REMOTE_KEYMAPS="$IR_REMOTE_KEYMAPS wetek_play_2" + diff --git a/projects/Amlogic/filesystem/usr/bin/cputemp b/projects/Amlogic/filesystem/usr/bin/cputemp new file mode 100755 index 0000000000..11535271c5 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/bin/cputemp @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" +echo "$(( $TEMP / 1000 )) C" diff --git a/projects/Amlogic/filesystem/usr/bin/gputemp b/projects/Amlogic/filesystem/usr/bin/gputemp new file mode 120000 index 0000000000..6476b954d2 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/bin/gputemp @@ -0,0 +1 @@ +cputemp \ No newline at end of file diff --git a/projects/Amlogic/filesystem/usr/lib/kernel-overlays/base/lib/firmware/rtl_bt/rtl8723b_config b/projects/Amlogic/filesystem/usr/lib/kernel-overlays/base/lib/firmware/rtl_bt/rtl8723b_config new file mode 100644 index 0000000000..a1600b00c9 Binary files /dev/null and b/projects/Amlogic/filesystem/usr/lib/kernel-overlays/base/lib/firmware/rtl_bt/rtl8723b_config differ diff --git a/projects/Amlogic/filesystem/usr/lib/kernel-overlays/base/lib/firmware/rtl_bt/rtl8723b_fw b/projects/Amlogic/filesystem/usr/lib/kernel-overlays/base/lib/firmware/rtl_bt/rtl8723b_fw new file mode 100644 index 0000000000..d29f164033 Binary files /dev/null and b/projects/Amlogic/filesystem/usr/lib/kernel-overlays/base/lib/firmware/rtl_bt/rtl8723b_fw differ diff --git a/projects/Amlogic/filesystem/usr/lib/modprobe.d/mali.conf b/projects/Amlogic/filesystem/usr/lib/modprobe.d/mali.conf new file mode 100644 index 0000000000..547ba48727 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/lib/modprobe.d/mali.conf @@ -0,0 +1 @@ +options mali mali_shared_mem_size=0x40000000 diff --git a/projects/Amlogic/filesystem/usr/lib/modules-load.d/amlvideodri.conf b/projects/Amlogic/filesystem/usr/lib/modules-load.d/amlvideodri.conf new file mode 100644 index 0000000000..d46221c301 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/lib/modules-load.d/amlvideodri.conf @@ -0,0 +1 @@ +amlvideodri diff --git a/projects/Odroid_C2/filesystem/usr/lib/modules-load.d/meson-ir.conf b/projects/Amlogic/filesystem/usr/lib/modules-load.d/meson-ir.conf similarity index 100% rename from projects/Odroid_C2/filesystem/usr/lib/modules-load.d/meson-ir.conf rename to projects/Amlogic/filesystem/usr/lib/modules-load.d/meson-ir.conf diff --git a/projects/Amlogic/filesystem/usr/lib/modules-load.d/wifi_dummy.conf b/projects/Amlogic/filesystem/usr/lib/modules-load.d/wifi_dummy.conf new file mode 100644 index 0000000000..e3a06c7644 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/lib/modules-load.d/wifi_dummy.conf @@ -0,0 +1 @@ +wifi_dummy diff --git a/projects/Amlogic/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf b/projects/Amlogic/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf new file mode 100644 index 0000000000..4ca7168beb --- /dev/null +++ b/projects/Amlogic/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf @@ -0,0 +1,3 @@ +[Sleep] +SuspendMode=false +HibernateMode=false diff --git a/projects/Amlogic/filesystem/usr/lib/systemd/system/fstrim.service b/projects/Amlogic/filesystem/usr/lib/systemd/system/fstrim.service new file mode 100644 index 0000000000..2910418483 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/lib/systemd/system/fstrim.service @@ -0,0 +1,9 @@ +[Unit] +Description=Apply TRIM on all trimmable mounts + +[Service] +Type=simple +ExecStart=-/usr/sbin/fstrim -a -v + +[Install] +WantedBy=basic.target diff --git a/projects/WeTek_Hub/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Amlogic/filesystem/usr/lib/systemd/system/serial-console.service similarity index 100% rename from projects/WeTek_Hub/filesystem/usr/lib/systemd/system/serial-console.service rename to projects/Amlogic/filesystem/usr/lib/systemd/system/serial-console.service diff --git a/projects/WeTek_Play_2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf b/projects/Amlogic/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf similarity index 79% rename from projects/WeTek_Play_2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf rename to projects/Amlogic/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf index e7c6011f23..bfd199bf11 100644 --- a/projects/WeTek_Play_2/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf +++ b/projects/Amlogic/filesystem/usr/share/alsa/cards/AML-M8AUDIO.conf @@ -5,10 +5,21 @@ AML-M8AUDIO.pcm.default { @args [ CARD ] @args.CARD { type string } - type hw - card $CARD - device 0 - format S32_LE + type softvol + slave.pcm { + type plug + slave { + pcm { + type hw + card $CARD + device 0 + } + } + } + control { + name "PCM Playback Volume" + card $CARD + } } diff --git a/projects/Amlogic/filesystem/usr/share/bttty.conf b/projects/Amlogic/filesystem/usr/share/bttty.conf new file mode 100644 index 0000000000..9b8c4a20e1 --- /dev/null +++ b/projects/Amlogic/filesystem/usr/share/bttty.conf @@ -0,0 +1 @@ +BTTTY="/dev/ttyS1" diff --git a/projects/Amlogic/initramfs/platform_init b/projects/Amlogic/initramfs/platform_init new file mode 100755 index 0000000000..756674af3b --- /dev/null +++ b/projects/Amlogic/initramfs/platform_init @@ -0,0 +1,96 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +display_mode=$(cat /sys/class/display/mode) + +for arg in $(cat /proc/cmdline); do + case ${arg} in + bootfrom*) + bootfromext=1 + ;; + BOOT_IMAGE=*) + BOOT_IMAGE=${arg#*=} + ;; + boot=*) + boot=${arg#*=} + ;; + disk=*) + disk=${arg#*=} + ;; + hdmimode=*) + hdmimode=${arg#*=} + ;; + esac +done + +# Add information where to run LibreELEC from +if [ -z "$BOOT_IMAGE" -o -z "$boot" -o -z "$disk" ]; then + cmdline=$(cat /proc/cmdline) + if [ -n "$bootfromext" ]; then + cmdline="$cmdline BOOT_IMAGE=kernel.img boot=LABEL=@BOOT_LABEL@ disk=LABEL=@DISK_LABEL@" + else + cmdline="$cmdline BOOT_IMAGE=/dev/boot boot=/dev/system disk=/dev/data" + fi + echo "$cmdline" > /proc/cmdline +fi + +# Set colorspace to avoid no HDMI signal with non-4K output modes +echo 422,8bit > /sys/class/amhdmitx/amhdmitx0/attr + +# Enable HDMI output if cable is connected and not already enabled by u-boot +if [ "$(cat /sys/class/amhdmitx/amhdmitx0/hpd_state)" != "0" ] && [ "$display_mode" != "$hdmimode" ]; then + echo "$hdmimode" > /sys/class/display/mode + display_mode="$hdmimode" +fi + +# Set framebuffer geometry to match the resolution +case $display_mode in + 480*) X=720 Y=480 ;; + 576*) X=720 Y=576 ;; + 720p*) X=1280 Y=720 ;; + *) X=1920 Y=1080 ;; +esac + +fbset -fb /dev/fb0 -g $X $Y 1920 2160 32 +fbset -fb /dev/fb1 -g 32 32 32 32 32 +echo 0 > /sys/class/graphics/fb0/free_scale +echo 0 > /sys/class/graphics/fb1/free_scale +echo 1 > /sys/class/video/disable_video + +# Enable scaling for 4K output +case $display_mode in + 4k*|smpte*|2160*) + echo 0 0 1919 1079 > /sys/class/graphics/fb0/free_scale_axis + echo 0 0 3839 2159 > /sys/class/graphics/fb0/window_axis + echo 1920 > /sys/class/graphics/fb0/scale_width + echo 1080 > /sys/class/graphics/fb0/scale_height + echo 0x10001 > /sys/class/graphics/fb0/free_scale + ;; +esac + +# Include deinterlacer into default VFM map +echo rm default > /sys/class/vfm/map +echo add default decoder ppmgr deinterlace amvideo > /sys/class/vfm/map + +# Enable framebuffer device +echo 0 > /sys/class/graphics/fb0/blank + +# Blank fb1 to prevent static noise +echo 1 > /sys/class/graphics/fb1/blank + +# set smp_affinity +# Binary Hex +# CPU 0 0001 1 +# CPU 1 0010 2 +# CPU 2 0100 4 +# CPU 3 1000 8 +echo 2 > /proc/irq/231/smp_affinity # hdmi_aocec +echo 4 > /proc/irq/63/smp_affinity # dwc_otg, dwc_otg_hcd:usb1 +echo 8 > /proc/irq/62/smp_affinity # dwc_otg, dwc_otg_hcd:usb2, dwc_otg_pcd + +# DEC_CONTROL_FLAG_DISABLE_FAST_POC +echo 4 > /sys/module/amvdec_h264/parameters/dec_control + +echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy diff --git a/projects/Amlogic/linux/linux.aarch64.conf b/projects/Amlogic/linux/linux.aarch64.conf new file mode 100644 index 0000000000..4140c265cf --- /dev/null +++ b/projects/Amlogic/linux/linux.aarch64.conf @@ -0,0 +1,4046 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm64 3.14.29 Kernel Configuration +# +CONFIG_ARM64=y +CONFIG_ARM64_HAS_SG_CHAIN=y +CONFIG_64BIT=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_NO_IOPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +CONFIG_KERNEL_MODE_NEON=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_FHANDLE=y +# CONFIG_AUDIT is not set + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_PREEMPT_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_RCU_USER_QS is not set +CONFIG_RCU_FANOUT=64 +CONFIG_RCU_FANOUT_LEAF=16 +# CONFIG_RCU_FANOUT_EXACT is not set +# CONFIG_RCU_FAST_NO_HZ is not set +CONFIG_TREE_RCU_TRACE=y +# CONFIG_RCU_NOCB_CPU is not set +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_RESOURCE_COUNTERS=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_MEMCG_SWAP_ENABLED=y +CONFIG_MEMCG_KMEM=y +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +# CONFIG_CFS_BANDWIDTH is not set +# CONFIG_RT_GROUP_SCHED is not set +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +CONFIG_MM_OWNER=y +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE=" " +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +# CONFIG_RD_GZIP is not set +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +CONFIG_RD_LZO=y +# CONFIG_RD_LZ4 is not set +CONFIG_INITRAMFS_COMPRESSION_NONE=y +# CONFIG_INITRAMFS_COMPRESSION_LZO is not set +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_EXPERT=y +CONFIG_UID16=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +# CONFIG_PERF_EVENTS is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +# CONFIG_PROFILING is not set +CONFIG_JUMP_LABEL=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +CONFIG_STOP_MACHINE=y +CONFIG_BLOCK=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +CONFIG_BLK_DEV_THROTTLING=y +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set +CONFIG_BLOCK_COMPAT=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# Platform selection +# +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_XGENE is not set +CONFIG_ARCH_MESON64_ODROIDC2=y + +# +# Bus support +# +CONFIG_ARM_AMBA=y + +# +# ARM errata workarounds via the alternatives framework +# +CONFIG_ARM64_ERRATUM_845719=y +CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_ERRATUM_835769=y + +# +# Kernel Features +# +# CONFIG_ARM64_64K_PAGES is not set +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_SMP=y +CONFIG_SCHED_MC=y +# CONFIG_SCHED_SMT is not set +# CONFIG_DISABLE_CPU_SCHED_DOMAIN_BALANCE is not set +CONFIG_SCHED_HMP=y +# CONFIG_SCHED_HMP_PRIO_FILTER is not set +CONFIG_HMP_FAST_CPU_MASK="" +CONFIG_HMP_SLOW_CPU_MASK="" +CONFIG_HMP_VARIABLE_SCALE=y +CONFIG_HMP_FREQUENCY_INVARIANT_SCALE=y +# CONFIG_SCHED_HMP_LITTLE_PACKING is not set +CONFIG_NR_CPUS=8 +CONFIG_HOTPLUG_CPU=y +CONFIG_SWP_EMULATE=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_HZ=100 +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_ARMV7_COMPAT=y +CONFIG_ARMV7_COMPAT_CPUINFO=y +CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=0 +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +# CONFIG_TRANSPARENT_HUGEPAGE is not set +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_CLEANCACHE=y +CONFIG_FRONTSWAP=y +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_AREAS=7 +# CONFIG_ZBUD is not set +# CONFIG_ZSWAP is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +# CONFIG_XEN is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +# CONFIG_SECCOMP is not set + +# +# Boot options +# +CONFIG_CMDLINE="console=tty0 systemd.show_status=auto" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +CONFIG_BINFMT_MISC=y +CONFIG_COREDUMP=y +CONFIG_COMPAT=y +CONFIG_SYSVIPC_COMPAT=y +CONFIG_KEYS_COMPAT=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +CONFIG_HAS_WAKELOCK=y +CONFIG_HAS_EARLYSUSPEND=y +CONFIG_WAKELOCK=y +CONFIG_WAKELOCK_STAT=y +CONFIG_USER_WAKELOCK=y +CONFIG_EARLYSUSPEND=y +CONFIG_FORCE_POWER_ON_STATE_AFTER_RESUME=y +CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL=y +# CONFIG_CONSOLE_EARLYSUSPEND is not set +# CONFIG_FB_EARLYSUSPEND is not set +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM_RUNTIME=y +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +CONFIG_ARCH_HAS_OPP=y +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_CPU_PM=y +# CONFIG_SUSPEND_TIME is not set + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_HOTPLUG=y +CONFIG_CPU_FREQ_GOV_INTERACTIVE=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_GENERIC_CPUFREQ_CPU0 is not set + +# +# ARM CPU frequency scaling drivers +# +CONFIG_ARM_BIG_LITTLE_CPUFREQ=y +# CONFIG_ARM_DT_BL_CPUFREQ is not set +CONFIG_ARM_SCPI_CPUFREQ=y +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARM64_CPU_SUSPEND=y + +# +# CPU Power Management +# + +# +# CPU Idle +# +# CONFIG_CPU_IDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +# CONFIG_IP_ROUTE_VERBOSE is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +CONFIG_INET_LRO=y +# CONFIG_INET_DIAG is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_WESTWOOD is not set +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +# CONFIG_TCP_CONG_HYBLA is not set +CONFIG_TCP_CONG_VEGAS=m +CONFIG_TCP_CONG_SCALABLE=m +# CONFIG_TCP_CONG_LP is not set +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_ANDROID_PARANOID_NETWORK is not set +# CONFIG_NET_ACTIVITY_STATS is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=y + +# +# Core Netfilter Configuration +# +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +# CONFIG_IP_NF_TARGET_ULOG is not set +CONFIG_NF_NAT_IPV4=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +# CONFIG_IP_NF_MANGLE is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_CONNTRACK_IPV6=m +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RT is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +# CONFIG_IP6_NF_MANGLE is not set +# CONFIG_IP6_NF_RAW is not set +CONFIG_NF_NAT_IPV6=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_IEEE802154 is not set +CONFIG_6LOWPAN_IPHC=m +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_FQ is not set +# CONFIG_NET_SCH_HHF is not set +# CONFIG_NET_SCH_PIE is not set +# CONFIG_NET_SCH_PLUG is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_CLS_BPF is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_MMAP is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_NET_MPLS_GSO is not set +# CONFIG_HSR is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +CONFIG_CGROUP_NET_PRIO=y +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=m +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=m +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=m + +# +# Bluetooth device drivers +# +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTSDIO=m +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_LL=y +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIVHCI is not set +CONFIG_BT_MRVL=m +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +# CONFIG_AF_RXRPC is not set +CONFIG_FIB_RULES=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +# CONFIG_CFG80211_DEFAULT_PS is not set +# CONFIG_CFG80211_DEBUGFS is not set +# CONFIG_CFG80211_INTERNAL_REGDB is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +# CONFIG_MAC80211_RC_PID is not set +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +# CONFIG_WIMAX is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_PM=y +CONFIG_RFKILL_LEDS=y +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL_REGULATOR is not set +# CONFIG_RFKILL_GPIO is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set + +# +# Device Drivers +# + +# +# Amlogic Device Drivers +# +CONFIG_MESON_TIMER=y +# CONFIG_MESON_LOCAL_TIMER is not set +CONFIG_MESON_BC_TIMER=y +CONFIG_AM_UART=y +CONFIG_SERIAL_MESON_CONSOLE=y +# CONFIG_PRINTK_NOBLOCK_MODE is not set +CONFIG_AML_CPU_VERSION=y +CONFIG_AML_MESON64_VERSION=y +# CONFIG_AML_M8_VERSION is not set +CONFIG_AMLOGIC_IOMAP=y +CONFIG_PINCTRL_AMLOGIC=y + +# +# USB Support +# +CONFIG_AMLOGIC_USB=y +CONFIG_USB_DWC_OTG_HCD=m +CONFIG_USB_HOST_ELECT_TEST=y + +# +# I2C Hardware Bus support +# +CONFIG_I2C_AML=y +# CONFIG_I2C_SLAVE_AML is not set +# CONFIG_I2C_SW_AML is not set +# CONFIG_BCM2079X_I2C is not set +CONFIG_AMLOGIC_PWM=y +CONFIG_PWM_MESON=y + +# +# HDMI TX Support +# +CONFIG_AML_HDMI_TX=y +CONFIG_AML_HDMI_TX_20=y +# CONFIG_AML_HDMI_TX_14 is not set +# CONFIG_AML_RTC is not set +CONFIG_AML_VRTC=y +# CONFIG_AM_IRBLASTER is not set +# CONFIG_AML_DEBUG is not set +CONFIG_AML_REG_ACCESS=y + +# +# Power Management Support +# +# CONFIG_AML_POWER_SUPPORT is not set +# CONFIG_AML_PMU_ALGORITHM_SUPPORT is not set +CONFIG_AML_PMU4=y + +# +# Ethernet Support +# +# CONFIG_AM_PHY is not set +CONFIG_PHYLIB=y + +# +# MMC/SD/SDIO Host Controller Drivers +# + +# +# Multimedia Card support +# +CONFIG_MMC_AML=y +# CONFIG_MMC_AML_DEBUG is not set +# CONFIG_AML_MMC_DEBUG_FORCE_SINGLE_BLOCK_RW is not set + +# +# Amlogic VPU Drivers +# + +# +# Amlogic VPU Driver +# +CONFIG_AML_VPU=y +# CONFIG_AML_VPU_DYNAMIC_ADJ is not set + +# +# ION support +# +CONFIG_AMLOGIC_ION=y + +# +# Amlogic Display Driver +# +CONFIG_AML_DISPLAY=y + +# +# Amlogic VOUT Module +# +CONFIG_AM_VOUT=y +CONFIG_AM_TV_OUTPUT=y +CONFIG_AML_VOUT_FRAMERATE_AUTOMATION=y +# CONFIG_AML_VOUT_CC_BYPASS is not set +# CONFIG_AML_VDAC_HW_SWITCH is not set +CONFIG_AML_WSS=y + +# +# Amlogic OSD Module +# +CONFIG_AM_FB=y +CONFIG_FB_OSD_SUPPORT_SYNC_FENCE=y +CONFIG_FB_OSD_VSYNC_RDMA=y +CONFIG_FB_OSD2_ENABLE=y +CONFIG_FB_OSD2_CURSOR=y + +# +# Amlogic VOUT2 Module +# +# CONFIG_AM_VOUT2 is not set +# CONFIG_AM_TV_OUTPUT2 is not set + +# +# Amlogic OSD_EXT Module +# +# CONFIG_AM_FB_EXT is not set + +# +# Amlogic GE2D Module +# +CONFIG_AM_GE2D=y +# CONFIG_AM_GE2D_MORE_SECURITY is not set +CONFIG_AM_LOGO=y + +# +# Amlogic LCD Output Module +# +# CONFIG_AML_LCD is not set + +# +# Amlogic Backlight Support +# +# CONFIG_AML_BACKLIGHT is not set +CONFIG_AMLOGIC_LED=m +CONFIG_AML_LED_SYS=m +CONFIG_AML_LED_PWM=m +CONFIG_AML_LED_TRIGGER_BREATHE=m +CONFIG_AML_LED_TRIGGER_SCPI=m +CONFIG_AML_LED_TRIGGER_SCPISTOP=m +CONFIG_AML_LED_TRIGGER_DISTURB=m + +# +# Canvas management driver +# +CONFIG_AML_CANVAS=y +CONFIG_AMLOGIC_CLK=y +CONFIG_AMLOGIC_SEC=y +# CONFIG_AML_SERR is not set +CONFIG_AMLOGIC_SECURITY_KEY=y +CONFIG_AM_PTSSERVER=y +# CONFIG_H264_4K2K_SINGLE_CORE is not set +CONFIG_VSYNC_RDMA=y +# CONFIG_TVIN_VIUIN is not set +CONFIG_AM_VIDEO=y +# CONFIG_AM_VIDEO2 is not set +# CONFIG_SUPPORT_VIDEO_ON_VPP2 is not set +CONFIG_GE2D_KEEP_FRAME=y + +# +# Video Decoders +# +# CONFIG_MULTI_DEC is not set +# CONFIG_AM_VDEC_DV is not set +CONFIG_AM_VDEC_MPEG12=y +CONFIG_AM_VDEC_MPEG4=y +# CONFIG_AM_VDEC_MMPEG4 is not set +CONFIG_AM_VDEC_VC1=y +CONFIG_AM_VDEC_H264=y +# CONFIG_AM_VDEC_MH264 is not set +CONFIG_AM_VDEC_H264MVC=y +CONFIG_AM_VDEC_H264_4K2K=y +CONFIG_AM_VDEC_H265=y +CONFIG_AM_VDEC_VP9=y +CONFIG_AM_VDEC_MJPEG=y +# CONFIG_AM_VDEC_MMJPEG is not set +# CONFIG_AM_ENCODER is not set +# CONFIG_AM_JPEG_ENCODER is not set +# CONFIG_AM_PIC_DEC is not set +CONFIG_AM_VDEC_REAL=y +CONFIG_AM_VDEC_AVS=y +# CONFIG_AM_JPEGDEC is not set +CONFIG_AM_TIMESYNC=y +CONFIG_AM_STREAMING=y +CONFIG_AM_SUBTITLE=y +CONFIG_AM_VIDEOCAPTURE=y +# CONFIG_AM_HEVCENC is not set + +# +# Deinterlace driver +# +CONFIG_DEINTERLACE=y +# CONFIG_AM_DEINTERLACE_SD_ONLY is not set +CONFIG_AML_VFM=y + +# +# EFUSE Support +# +CONFIG_EFUSE=y +# CONFIG_EFUSE_WRITE_VERSION_PERMIT is not set + +# +# key management Support +# +CONFIG_KEY_MANAGE=y + +# +# Audio Interface +# +CONFIG_AMAUDIO=y + +# +# Amlogic Audio Interface V2 +# +CONFIG_AMAUDIO2=y + +# +# Audio dsp process +# +CONFIG_AML_AUDIO_DSP=y + +# +# Post Process Manager driver +# +CONFIG_POST_PROCESS_MANAGER=y +CONFIG_POST_PROCESS_MANAGER_PPSCALER=y +# CONFIG_POST_PROCESS_MANAGER_3D_PROCESS is not set + +# +# Amlogic Wifi Driver +# +CONFIG_AM_WIFI=y +CONFIG_BCMDHD_USE_STATIC_BUF=y +CONFIG_AM_WIFI_DUMMY=m +CONFIG_AML_POWER_RESET=y +# CONFIG_M8_POWER_RESET is not set +CONFIG_GXBB_POWER_RESET=y + +# +# Amlogic Bt Rfkill Driver +# +CONFIG_BT_DEVICE=y +# CONFIG_BLUESLEEP is not set + +# +# Amlogic ion video support +# +# CONFIG_VIDEOBUF2_ION is not set +# CONFIG_AMLOGIC_IONVIDEO is not set + +# +# V4L2 Video Support +# +CONFIG_V4L_AMLOGIC_VIDEO=m +# CONFIG_V4L_AMLOGIC_VIDEO2 is not set + +# +# Amlogic TVIN Drivers +# +CONFIG_TVIN=y +# CONFIG_TVIN_VDIN is not set +# CONFIG_TVIN_AFE is not set +CONFIG_TVIN_HDMI=y +# CONFIG_TVIN_HDMI_CEC is not set +# CONFIG_TVIN_HDMI_EXT is not set +# CONFIG_TVIN_BT656 is not set +# CONFIG_VIUIN is not set +# CONFIG_TVIN_ISP is not set + +# +# Amlogic VECM Drivers +# + +# +# Amlogic amvecm Driver +# +CONFIG_AM_VECM=y +CONFIG_AML_NAND=y +CONFIG_AML_NEXT_GEN_NAND=y +CONFIG_AML_NFTL_NEW=y +CONFIG_AML_NAND_KEY=y +# CONFIG_SECURE_NAND is not set + +# +# Meson NAND Device Support +# +CONFIG_AM_INPUT=y +CONFIG_AM_SARADC=y +# CONFIG_AMLOGIC_REMOTE is not set +CONFIG_MESON_INPUT_KEYBOARD=y +# CONFIG_ADC_KEYPADS_AM is not set +CONFIG_AML_GPIO_KEY=y +# CONFIG_SENSOR_DEVICES is not set +# CONFIG_AMLOGIC_AVIN_DETECT is not set +# CONFIG_AMLOGIC_MESON_CPUFREQ is not set +CONFIG_AMLOGIC_SCPI_CPUFREQ=y +CONFIG_MESON_SUSPEND=y +# CONFIG_M8M2_SUSPEND is not set +CONFIG_GXBB_SUSPEND=y + +# +# AVL6862 dvb driver +# +CONFIG_AVL6862=m + +# +# Amlogic DVB driver +# +# CONFIG_AM_DVB is not set +# CONFIG_AM_ATVDEMOD is not set + +# +# AMLOGIC CI Driver +# +# CONFIG_AM_PCMCIA is not set +# CONFIG_AM_SPI is not set +# CONFIG_AML_SMARTCARD is not set + +# +# WeTek Play driver +# +CONFIG_WETEK=m + +# +# MESON MHU mailbox Support +# +CONFIG_MESON_MHU_MBOX=y +CONFIG_ARM_SCPI_PROTOCOL=y + +# +# RDMA management driver +# +CONFIG_AML_RDMA=y + +# +# Amlogic temperature sensor +# +CONFIG_AML_TEMP_SENSOR=y +# CONFIG_AUDIO_DATA is not set +# CONFIG_INSTABOOT is not set + +# +# Amlogic Camera Support +# +# CONFIG_VIDEO_AMLOGIC_CAPTURE is not set +CONFIG_AML_CODEC_MM=y +# CONFIG_AML_WDT is not set + +# +# AMLOGIC SPI Hardware bus support +# +CONFIG_AMLOGIC_SPICC_MASTER=y +# CONFIG_AMLOGIC_JTAG is not set +CONFIG_AMLOGIC_CPU_INFO=y + +# +# defend img file update support +# +# CONFIG_DEFEND_IMG is not set + +# +# AO CEC Support +# +CONFIG_AML_AO_CEC=y + +# +# Amlogic Crypto Support +# +# CONFIG_CRYPTO_AML is not set + +# +# ESM Support +# +# CONFIG_AML_ESM is not set + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER_PATH="/sbin/mdev" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +CONFIG_FW_LOADER_USER_HELPER=y +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_HAVE_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=8 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_CONNECTOR is not set +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +# CONFIG_MTD_CMDLINE_PARTS is not set +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_SWAP is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_DATAFLASH is not set +# CONFIG_MTD_M25P80 is not set +# CONFIG_MTD_SST25L is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +CONFIG_MTD_NAND_IDS=y +CONFIG_MTD_NAND_ECC=y +# CONFIG_MTD_NAND_ECC_SMC is not set +CONFIG_MTD_NAND=y +# CONFIG_MTD_NAND_ECC_BCH is not set +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_NAND_DENALI is not set +# CONFIG_MTD_NAND_GPIO is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_DOCG4 is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR flash memory drivers +# +# CONFIG_MTD_LPDDR is not set +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_DTC=y +CONFIG_OF=y + +# +# Device Tree and Open Firmware support +# +CONFIG_PROC_DEVICETREE=y +# CONFIG_OF_SELFTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_MTD=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_VIRTIO_BLK=y +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_ATMEL_PWM is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ATMEL_SSC is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_UID_STAT is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_TGT is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +# CONFIG_SCSI_ISCSI_ATTRS is not set +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +# CONFIG_ISCSI_TCP is not set +# CONFIG_ISCSI_BOOT_SYSFS is not set +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_LIBFC is not set +# CONFIG_LIBFCOE is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_VIRTIO is not set +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_HAVE_PATA_PLATFORM=y +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +CONFIG_VXLAN=m +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +# CONFIG_NETPOLL_TRAP is not set +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +CONFIG_VETH=m +# CONFIG_VIRTIO_NET is not set +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6060 is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +# CONFIG_NET_DSA_MV88E6131 is not set +# CONFIG_NET_DSA_MV88E6123_61_65 is not set +CONFIG_ETHERNET=y +CONFIG_NET_VENDOR_ARC=y +# CONFIG_ARC_EMAC is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_CALXEDA_XGMAC is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_ETHOC is not set +# CONFIG_SH_ETH is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_DWMAC_MESON=y +# CONFIG_STMMAC_DEBUG_FS is not set +# CONFIG_STMMAC_DA is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set + +# +# MII PHY device drivers +# +CONFIG_AMLOGIC_PHY=y +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM87XX_PHY is not set +CONFIG_ICPLUS_PHY=y +CONFIG_REALTEK_PHY=y +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPPOLAC=y +CONFIG_PPPOPNS=y +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=y + +# +# USB Network Adapters +# +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=m +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_NET_INT51X1 is not set +CONFIG_USB_IPHETH=m +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +CONFIG_WLAN=y +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_AT76C50X_USB is not set +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=m +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_WIFI_CONTROL_FUNC is not set +CONFIG_ATH_COMMON=m +CONFIG_ATH_CARDS=m +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_WOW is not set +# CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set +CONFIG_ATH9K_RFKILL=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +CONFIG_AR5523=m +# CONFIG_ATH10K is not set +# CONFIG_WCN36XX is not set +CONFIG_B43=m +CONFIG_B43_SSB=y +# CONFIG_B43_SDIO is not set +CONFIG_B43_PIO=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +# CONFIG_HOSTAP is not set +# CONFIG_LIBERTAS is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_SPI is not set +CONFIG_P54_LEDS=y +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_RTL_CARDS=m +# CONFIG_RTL8192CU is not set +# CONFIG_WL_TI is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MWIFIEX is not set +# CONFIG_CW1200 is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_FF_MEMLESS=y +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KEYRESET is not set +# CONFIG_INPUT_KEYCOMBO is not set + +# +# Input Device Drivers +# +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ADS7846=m +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_W90X900 is not set +CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYCHORD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_GPIO is not set +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set + +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +CONFIG_DEVKMEM=y + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_TIMBERDALE is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SUPPORT_SYSRQ is not set +CONFIG_TTY_PRINTK=y +# CONFIG_VIRTIO_CONSOLE is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_ATMEL is not set +CONFIG_HW_RANDOM_MESON=y +# CONFIG_HW_RANDOM_VIRTIO is not set +# CONFIG_HW_RANDOM_EXYNOS is not set +# CONFIG_R3964 is not set + +# +# PCMCIA character devices +# +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +CONFIG_I2C_GPIO=y +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_CAPRI is not set +# CONFIG_PINCTRL_MSM8X74 is not set +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +# CONFIG_DEBUG_GPIO is not set +# CONFIG_GPIO_SYSFS is not set + +# +# Memory mapped GPIO drivers: +# +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SCH311X is not set +# CONFIG_GPIO_TS5500 is not set +# CONFIG_GPIO_GRGPIO is not set + +# +# I2C GPIO expanders: +# +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set + +# +# PCI GPIO expanders: +# + +# +# SPI GPIO expanders: +# +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MCP23S08 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_74X164 is not set + +# +# AC97 GPIO expanders: +# + +# +# LPC GPIO expanders: +# + +# +# MODULbus GPIO expanders: +# +# CONFIG_GPIO_BCM_KONA is not set + +# +# USB GPIO expanders: +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27x00 is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_SMB347 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_GPIO is not set +CONFIG_POWER_RESET_VEXPRESS=y +# CONFIG_POWER_RESET_XGENE is not set +# CONFIG_POWER_AVS is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VEXPRESS is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_GOV_STEP_WISE is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y +CONFIG_CPU_THERMAL=y +CONFIG_DEVFREQ_THERMAL=y +CONFIG_CPUCORE_THERMAL=y +CONFIG_GPU_THERMAL=y +CONFIG_GPUCORE_THERMAL=y +# CONFIG_THERMAL_EMULATION is not set + +# +# Texas Instruments thermal drivers +# +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +CONFIG_SSB=m +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_SILENT is not set +# CONFIG_SSB_DEBUG is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +# CONFIG_MFD_SYSCON is not set +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +CONFIG_VEXPRESS_CONFIG=y +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +# CONFIG_REGULATOR_FIXED_VOLTAGE is not set +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +# CONFIG_REGULATOR_VEXPRESS is not set +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +CONFIG_MEDIA_RC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_RESOURCE=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_RC5_SZ_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_MESON=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_TLG2300 is not set +# CONFIG_VIDEO_USBVISION is not set +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +# CONFIG_DVB_USB_A800 is not set +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +# CONFIG_DVB_USB_UMT_010 is not set +CONFIG_DVB_USB_CXUSB=m +# CONFIG_DVB_USB_M920X is not set +# CONFIG_DVB_USB_DIGITV is not set +CONFIG_DVB_USB_VP7045=m +# CONFIG_DVB_USB_VP702X is not set +# CONFIG_DVB_USB_GP8PSK is not set +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +# CONFIG_DVB_USB_FRIIO is not set +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +# CONFIG_DVB_USB_AU6610 is not set +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +# CONFIG_DVB_USB_GL861 is not set +# CONFIG_DVB_USB_IT913X is not set +CONFIG_DVB_USB_LME2510=m +# CONFIG_DVB_USB_MXL111SF is not set +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +# CONFIG_RADIO_ADAPTERS is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA18272=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_M88TS2022=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set + +# +# Graphics support +# +# CONFIG_DRM is not set +# CONFIG_VGASTATE is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +# CONFIG_VEXPRESS_DVI_CONTROL is not set +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=m +CONFIG_FB_SYS_COPYAREA=m +CONFIG_FB_SYS_IMAGEBLIT=m +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=m +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +CONFIG_FB_UDL=m +# CONFIG_FB_GOLDFISH is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_EXYNOS_VIDEO is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +# CONFIG_ADF is not set + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=m +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +# CONFIG_FB_SSD1307 is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_JACK=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_HRTIMER=m +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_VERBOSE_PROCFS is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +# CONFIG_SND_DRIVERS is not set +# CONFIG_SND_SPI is not set +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +# CONFIG_SND_USB_HIFACE is not set +CONFIG_SND_SOC=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set +CONFIG_SND_AML_M8_SOC=y +CONFIG_SND_AML_M8=y +CONFIG_SND_AML_SPLIT_MODE=y +# CONFIG_SND_AML_SPLIT_MODE_MMAP is not set +CONFIG_SND_SOC_I2C_AND_SPI=y +CONFIG_SND_SOC_TLV320AIC32X4=y +CONFIG_SND_SOC_DUMMY_CODEC=y +CONFIG_SND_SOC_TAS5707=y +CONFIG_SND_SOC_TAS5717=y +CONFIG_SND_SOC_TAS5731=y +CONFIG_SND_SOC_AMLPMU4=y +CONFIG_SND_SOC_ES8323=y +CONFIG_SND_SOC_PCM2BT=y +CONFIG_SND_SOC_AMLT9015=y +CONFIG_SND_SOC_AMLT9015S=y +CONFIG_SND_SOC_AMLTXLX_ACODEC=y +# CONFIG_SND_SIMPLE_CARD is not set +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_DIA_REMOTE is not set +# CONFIG_HID_PRODIKEYS is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_HUION is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO_TPKBD=m +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=y +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PETALYNX=y +CONFIG_HID_PICOLCD=m +CONFIG_HID_PICOLCD_FB=y +CONFIG_HID_PICOLCD_LEDS=y +# CONFIG_HID_PICOLCD_CIR is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +# CONFIG_HID_GREENASIA is not set +# CONFIG_HID_SMARTJOYPLUS is not set +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +# CONFIG_HID_XINMO is not set +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +# CONFIG_USB_DEBUG is not set +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_ROOT_HUB_TT is not set +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_HCD_SYNOPSYS=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1760_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FUSBH200_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +CONFIG_USB_OHCI_HCD=y +# CONFIG_USB_OHCI_HCD_PLATFORM is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set +# CONFIG_USB_RENESAS_USBHS is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USB_MUSB_HDRC is not set +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_HOST=y +# CONFIG_USB_DWC3_GADGET is not set +# CONFIG_USB_DWC3_DUAL_ROLE is not set + +# +# Platform Glue Driver Support +# +# CONFIG_USB_DWC3_EXYNOS is not set +# CONFIG_USB_DWC3_KEYSTONE is not set + +# +# Debugging features +# +# CONFIG_USB_DWC3_DEBUG is not set +# CONFIG_DWC3_HOST_USB3_LPM_ENABLE is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_CHIPIDEA is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_CONSOLE=y +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +CONFIG_USB_SERIAL_CH341=m +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=m +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=m +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +CONFIG_USB_SERIAL_IUU=m +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=y +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_ZTE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HSIC_USB3503 is not set + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_OTG_WAKELOCK is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_SAMSUNG_USB2PHY is not set +# CONFIG_SAMSUNG_USB3PHY is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_RCAR_PHY is not set +# CONFIG_USB_ULPI is not set +CONFIG_AMLOGIC_USBPHY=y +CONFIG_AMLOGIC_USB2PHY=y +CONFIG_AMLOGIC_USB3PHY=y +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +# CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_DUMMY_HCD is not set +# CONFIG_USB_CONFIGFS is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set +CONFIG_PXP_MMC=y +CONFIG_MMC_UNSAFE_RESUME=y +# CONFIG_MMC_CLKGATE is not set +# CONFIG_MMC_EMBEDDED_SDIO is not set +# CONFIG_MMC_PARANOID_SD_INIT is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_ARMMMCI=y +# CONFIG_MMC_SDHCI is not set +# CONFIG_MMC_SDHCI_PXAV3 is not set +# CONFIG_MMC_SDHCI_PXAV2 is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y + +# +# LED drivers +# +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_PCA9685 is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_OT200 is not set +# CONFIG_LEDS_BLINKM is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +CONFIG_SWITCH=y +# CONFIG_SWITCH_GPIO is not set +# CONFIG_ACCESSIBILITY is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +CONFIG_RTC_DRV_AML_HYM8563=y +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +CONFIG_RTC_DRV_PCF8563=m +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_DS2404 is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set +# CONFIG_RTC_DRV_MOXART is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +# CONFIG_DMADEVICES is not set +# CONFIG_AUXDISPLAY is not set +CONFIG_UIO=y +# CONFIG_UIO_PDRV_GENIRQ is not set +# CONFIG_UIO_DMEM_GENIRQ is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRTIO=y + +# +# Virtio drivers +# +# CONFIG_VIRTIO_BALLOON is not set +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_USBIP_CORE is not set +# CONFIG_W35UND is not set +# CONFIG_PRISM2_USB is not set +# CONFIG_ECHO is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +# CONFIG_RTS5139 is not set +# CONFIG_TRANZPORT is not set +# CONFIG_LINE6_USB is not set +# CONFIG_USB_SERIAL_QUATECH2 is not set +CONFIG_VT6656=m +# CONFIG_USB_ENESTORAGE is not set +# CONFIG_BCM_WIMAX is not set +# CONFIG_FT1000 is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_STAGING_MEDIA is not set + +# +# Android +# +CONFIG_ANDROID=y +# CONFIG_ANDROID_BINDER_IPC is not set +CONFIG_ASHMEM=y +# CONFIG_ANDROID_LOGGER is not set +# CONFIG_ANDROID_TIMED_OUTPUT is not set +# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set +# CONFIG_ANDROID_INTF_ALARM_DEV is not set +CONFIG_SYNC=y +CONFIG_SW_SYNC=y +CONFIG_SW_SYNC_USER=y +CONFIG_ION=y +# CONFIG_ION_TEST is not set +# CONFIG_ION_DUMMY is not set +# CONFIG_FIQ_DEBUGGER is not set +# CONFIG_FIQ_WATCHDOG is not set +# CONFIG_USB_WPAN_HCD is not set +# CONFIG_WIMAX_GDM72XX is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_CED1401 is not set +# CONFIG_DGRP is not set +# CONFIG_MTD_SPINAND_MT29F is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_XILLYBUS is not set +# CONFIG_DGAP is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +CONFIG_COMMON_CLK_VERSATILE=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI570 is not set +CONFIG_COMMON_CLK_XGENE=y +CONFIG_COMMON_CLK_SCPI=y +# CONFIG_COMMON_CLK_QCOM is not set + +# +# Hardware Spinlock drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_MAILBOX=y +# CONFIG_PL320_MBOX is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_OF_IOMMU=y +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y + +# +# DEVFREQ Drivers +# +# CONFIG_EXTCON is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_PCA9685 is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V3=y +# CONFIG_IPACK_BUS is not set +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set +# CONFIG_PHY_EXYNOS_DP_VIDEO is not set +# CONFIG_POWERCAP is not set +# CONFIG_CORESIGHT is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT23=y +# CONFIG_EXT4_FS_POSIX_ACL is not set +# CONFIG_EXT4_FS_SECURITY is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=y + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=m +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_EXFAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=m +CONFIG_HFSPLUS_FS=m +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS2_FS is not set +CONFIG_UBIFS_FS=m +# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +# CONFIG_SQUASHFS_ZLIB is not set +CONFIG_SQUASHFS_LZO=y +# CONFIG_SQUASHFS_XZ is not set +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +CONFIG_PSTORE=y +# CONFIG_PSTORE_CONSOLE is not set +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +# CONFIG_F2FS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=m +CONFIG_NFS_V2=m +CONFIG_NFS_V3=m +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=m +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +# CONFIG_NFS_V4_2 is not set +CONFIG_PNFS_FILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +# CONFIG_NFS_V4_1_MIGRATION is not set +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_LOCKD=m +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=m +CONFIG_SUNRPC_GSS=m +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=m +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_FSCACHE=y +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set +# CONFIG_VIRTUALIZATION is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +# CONFIG_LOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +CONFIG_TIMER_STATS=y + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_HAVE_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_WRITECOUNT is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_CPU_STALL_INFO is not set +CONFIG_RCU_TRACE=y +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_ENABLE_DEFAULT_TRACERS is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_PROBE_EVENTS is not set + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_MODULE is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_CHECK_ISR_TIME is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_AML_USER_FAULT is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_PID_IN_CONTEXTIDR is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_KEYS_DEBUG_PROC_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +CONFIG_SECURITYFS=y +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +# CONFIG_CRYPTO_GF128MUL is not set +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=m +# CONFIG_CRYPTO_GCM is not set +CONFIG_CRYPTO_SEQIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CTS=m +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32 is not set +CONFIG_CRYPTO_CRCT10DIF=m +# CONFIG_CRYPTO_GHASH is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=m +CONFIG_CRYPTO_SHA256=y +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=y +# CONFIG_CRYPTO_ZLIB is not set +CONFIG_CRYPTO_LZO=y +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=m +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +CONFIG_CRYPTO_HW=y +# CONFIG_ASYMMETRIC_KEY_TYPE is not set +# CONFIG_ARM64_CRYPTO is not set +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=m +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=m +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=m +# CONFIG_CRC8 is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_BCJ is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_LZO=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_REED_SOLOMON=y +CONFIG_REED_SOLOMON_ENC8=y +CONFIG_REED_SOLOMON_DEC8=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_AVERAGE=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=m +CONFIG_FONT_SUPPORT=m +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y diff --git a/projects/Amlogic/options b/projects/Amlogic/options new file mode 100644 index 0000000000..f4133b7c50 --- /dev/null +++ b/projects/Amlogic/options @@ -0,0 +1,155 @@ +################################################################################ +# setup system defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + aarch64) + # TARGET_CPU: + # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d + # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c + # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t + # arm720t arm740t strongarm strongarm110 strongarm1100 + # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t + # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi + # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e + # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s + # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 + # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. + # + TARGET_CPU="cortex-a53" + TARGET_CPU_FLAGS="+crc+fp+simd" + TARGET_FEATURES="64bit" + ;; + arm) + TARGET_KERNEL_ARCH="arm64" + TARGET_PATCH_ARCH="aarch64" + TARGET_FLOAT=hard + TARGET_CPU="cortex-a53" + TARGET_CPU_FLAGS="+crc" + TARGET_FPU="neon-fp-armv8" + TARGET_FEATURES="32bit" + ;; + esac + + # Bootloader to use (syslinux / u-boot / atv-bootloader / bcm2835-bootloader) + BOOTLOADER="u-boot" + + # u-boot version to use (default) + UBOOT_VERSION="vendor" + + # Kernel target + KERNEL_TARGET="Image.lzo" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxbb_p200.dtb gxbb_p200_2G.dtb gxl_p212_1g.dtb gxl_p212_2g.dtb gxl_p230_2g.dtb" + + # Build Android kernel image using mkbootimg + BUILD_ANDROID_BOOTIMG="yes" + + # Additional options to be passed to Android mkbootimg + ANDROID_BOOTIMG_OPTIONS="--base 0x0 --kernel_offset 0x1080000" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="" + + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="amlogic-3.14" + + # kernel image name + KERNEL_NAME="kernel.img" + +################################################################################ +# setup build defaults +################################################################################ + + # Project CFLAGS + PROJECT_CFLAGS="" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="lzo" + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / Mesa) + OPENGL="no" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="gxbb" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="no" + + # Displayserver to use (x11 / no) + DISPLAYSERVER="no" + + # Windowmanager to use (fluxbox / none) + WINDOWMANAGER="none" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" + GRAPHIC_DRIVERS="" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap / libamcodec) + KODIPLAYER_DRIVER="libamcodec" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="font softcursor bitblit fbcon dwc_otg" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="gpu-aml RTL8192CU RTL8192DU RTL8192EU RTL8812AU RTL8188EU-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware" + + # build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="no" + + # Amlogic IR remote support (yes / no) + AMREMOTE_SUPPORT="no" + + # build and install iSCSI support - iscsistart (yes / no) + ISCSI_SUPPORT="no" + + # build with installer (yes / no) + INSTALLER_SUPPORT="no" + + # build and install driver addons (yes / no) + DRIVER_ADDONS_SUPPORT="yes" + + # driver addons to install: + # for a list of additinoal drivers see packages/linux-driver-addons + # Space separated list is supported, + DRIVER_ADDONS="" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES="u-boot-tools-aml dtc" + + # build and install driver addons (yes / no) + DRIVER_ADDONS_SUPPORT="yes" + + # driver addons to install: + # for a list of additinoal drivers see packages/linux-driver-addons + # Space separated list is supported, + DRIVER_ADDONS="crazycat_aml" diff --git a/projects/Amlogic/packages/android-headers/package.mk b/projects/Amlogic/packages/android-headers/package.mk new file mode 100644 index 0000000000..fb22ae5385 --- /dev/null +++ b/projects/Amlogic/packages/android-headers/package.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="android-headers" +PKG_VERSION="25" +PKG_SHA256="1e0ecdf56c33aaa523109254e2c475878d8cfc5795ebd4bb5ecbaf80926f4fe9" +PKG_LICENSE="Apache" +PKG_SITE="https://android.googlesource.com/" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Android Platform Headers from AOSP releases." +PKG_TOOLCHAIN="manual" diff --git a/projects/Amlogic/packages/autoscript-amlogic/package.mk b/projects/Amlogic/packages/autoscript-amlogic/package.mk new file mode 100644 index 0000000000..b35cfacb70 --- /dev/null +++ b/projects/Amlogic/packages/autoscript-amlogic/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="autoscript-amlogic" +PKG_VERSION="" +PKG_LICENSE="GPL" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Autoscript package for Amlogic devices" +PKG_TOOLCHAIN="manual" + +make_target() { + for src in $PKG_DIR/scripts/*autoscript.src ; do + $TOOLCHAIN/bin/mkimage -A $TARGET_KERNEL_ARCH -O linux -T script -C none -d "$src" "$(basename $src .src)" > /dev/null + done +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/bootloader + cp -a $PKG_BUILD/*autoscript $INSTALL/usr/share/bootloader/ +} diff --git a/projects/Amlogic/packages/autoscript-amlogic/scripts/aml_autoscript.src b/projects/Amlogic/packages/autoscript-amlogic/scripts/aml_autoscript.src new file mode 100644 index 0000000000..6d85670ab2 --- /dev/null +++ b/projects/Amlogic/packages/autoscript-amlogic/scripts/aml_autoscript.src @@ -0,0 +1,12 @@ +defenv +setenv bootfromnand 0 +setenv upgrade_step 2 +setenv libreelec 'run librefromsd; run librefromusb' +setenv sddtb 'if fatload mmc 0 ${dtb_mem_addr} dtb.img; then else store dtb read $dtb_mem_addr; fi' +setenv usbdtb 'if fatload usb 0 ${dtb_mem_addr} dtb.img; then else store dtb read $dtb_mem_addr; fi' +setenv librefromsd 'mmcinfo; if fatload mmc 0 ${loadaddr} kernel.img; then run sddtb; setenv bootargs ${bootargs} bootfromsd; bootm; fi' +setenv librefromusb 'usb start 0; if fatload usb 0 ${loadaddr} kernel.img; then run usbdtb; setenv bootargs ${bootargs} bootfromusb; bootm; fi' +setenv bootcmd 'if test ${bootfromnand} = 1; then setenv bootfromnand 0; saveenv; else run libreelec; fi; run storeboot' +saveenv +run storeargs +run libreelec diff --git a/projects/Amlogic/packages/device-trees-amlogic/package.mk b/projects/Amlogic/packages/device-trees-amlogic/package.mk new file mode 100644 index 0000000000..9cd5a93fe8 --- /dev/null +++ b/projects/Amlogic/packages/device-trees-amlogic/package.mk @@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="device-trees-amlogic" +PKG_VERSION="30c9d42" +PKG_SHA256="bcbcd81abab242afaf439ff4d3b92039f2dba97ce0986285627e19e58f1c47d4" +PKG_LICENSE="GPL" +PKG_URL="https://github.com/LibreELEC/device-trees-amlogic/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_LONGDESC="Device trees for Amlogic devices." +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +make_target() { + # Enter kernel directory + pushd $BUILD/linux-$(kernel_version) > /dev/null + + # Device trees already present in kernel tree we want to include + EXTRA_TREES=( \ + gxbb_p201 gxbb_p200_1G_wetek_hub gxbb_p200_2G_wetek_play_2 \ + gxl_p212_1g gxl_p212_2g gxl_p281_1g gxl_p212_1g_lepotato gxl_p212_2g_lepotato \ + gxm_q200_2g gxm_q201_1g gxm_q201_2g \ + ) + + # Add trees to the list + for f in ${EXTRA_TREES[@]}; do + DTB_LIST="$DTB_LIST $f.dtb" + done + + # Copy all device trees to kernel source folder and create a list + cp -f $PKG_BUILD/*.dts* arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/ + for f in $PKG_BUILD/*.dts; do + DTB_NAME="$(basename $f .dts).dtb" + DTB_LIST="$DTB_LIST $DTB_NAME" + done + + # Filter device tree list depending on project + case "$DEVICE" in + S905) + for f in ${DTB_LIST[@]}; do + [[ "$f" == gxbb* ]] || [[ "$f" == gxl* ]] && DTB_LIST_FILTERED="$DTB_LIST_FILTERED $f" + done + ;; + S912) + for f in ${DTB_LIST[@]}; do + [[ "$f" == gxm* ]] && DTB_LIST_FILTERED="$DTB_LIST_FILTERED $f" + done + ;; + *) + for f in ${DTB_LIST[@]}; do + if listcontains "$KERNEL_UBOOT_EXTRA_TARGET" "$f"; then + DTB_LIST_FILTERED="$DTB_LIST_FILTERED $f" + fi + done + ;; + esac + + # Compile device trees + kernel_make $DTB_LIST_FILTERED + mv arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*.dtb $PKG_BUILD + + popd > /dev/null +} + +makeinstall_target() { + case "$DEVICE" in + S905|S912) + mkdir -p $INSTALL/usr/share/bootloader/device_trees + cp -a $PKG_BUILD/*.dtb $INSTALL/usr/share/bootloader/device_trees + ;; + esac +} diff --git a/projects/Amlogic/packages/libhybris/package.mk b/projects/Amlogic/packages/libhybris/package.mk new file mode 100644 index 0000000000..257293b2d9 --- /dev/null +++ b/projects/Amlogic/packages/libhybris/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libhybris" +PKG_VERSION="070c3ab" +PKG_SHA256="070dcf48aa424c1c56c1d95f5116051a22a76bd5ac0c877febf04b63d9559ea2" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/libhybris/libhybris" +PKG_URL="https://github.com/libhybris/libhybris/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION*/hybris" +PKG_DEPENDS_TARGET="toolchain android-headers" +PKG_LONGDESC="Allows to run bionic-based HW adaptations in glibc systems - libs." +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_TARGET="--enable-arch=$TARGET_ARCH \ + --with-default-egl-platform=fbdev \ + --with-android-headers=$BUILD/android-headers-25 \ + --with-default-hybris-ld-library-path=/system/lib \ + --enable-mali-quirks" diff --git a/projects/Amlogic/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch b/projects/Amlogic/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch new file mode 100644 index 0000000000..35178890f5 --- /dev/null +++ b/projects/Amlogic/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch @@ -0,0 +1,19 @@ +diff --git a/Makefile.am b/Makefile.am +index 906140e..75888ae 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,13 +6,7 @@ endif + if HAS_ANDROID_5_0_0 + SUBDIRS += libsync + endif +-SUBDIRS += egl glesv1 glesv2 ui sf input camera vibrator media wifi +- +-if HAS_LIBNFC_NXP_HEADERS +-SUBDIRS += libnfc_nxp libnfc_ndef_nxp +-endif +-SUBDIRS += utils tests +- ++SUBDIRS += egl glesv1 glesv2 + + MAINTAINERCLEANFILES = \ + aclocal.m4 compile config.guess config.sub \ diff --git a/projects/Amlogic/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch b/projects/Amlogic/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch new file mode 100644 index 0000000000..db135a7c1b --- /dev/null +++ b/projects/Amlogic/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch @@ -0,0 +1,51 @@ +From bd11dbc285303c0fe4039b5058360f38c5614cae Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Tue, 16 Jan 2018 23:41:52 +0100 +Subject: [PATCH] eglplatform_fbdev: open new framebuffer when creating a + window + +Framebuffer device has to be reopened when creating a new window +to adapt its size to display. This is required e.g. after screen +resolution changed. +--- + hybris/egl/platforms/fbdev/eglplatform_fbdev.cpp | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +diff --git a/egl/platforms/fbdev/eglplatform_fbdev.cpp b/egl/platforms/fbdev/eglplatform_fbdev.cpp +index c25a2d7..c75073f 100644 +--- a/egl/platforms/fbdev/eglplatform_fbdev.cpp ++++ b/egl/platforms/fbdev/eglplatform_fbdev.cpp +@@ -29,13 +29,6 @@ extern "C" void fbdevws_init_module(struct ws_egl_interface *egl_iface) + assert(0); + } + +- err = framebuffer_open((hw_module_t *) gralloc, &framebuffer); +- if (err) { +- fprintf(stderr, "ERROR: failed to open framebuffer: (%s)\n",strerror(-err)); +- assert(0); +- } +- TRACE("** framebuffer_open: status=(%s) format=x%x", strerror(-err), framebuffer->format); +- + err = gralloc_open((const hw_module_t *) gralloc, &alloc); + if (err) { + fprintf(stderr, "ERROR: failed to open gralloc: (%s)\n",strerror(-err)); +@@ -66,6 +59,16 @@ extern "C" EGLNativeWindowType fbdevws_CreateWindow(EGLNativeWindowType win, _EG + assert (gralloc != NULL); + assert (_nativewindow == NULL); + ++ if (framebuffer) ++ framebuffer_close(framebuffer); ++ ++ int err = framebuffer_open((hw_module_t *) gralloc, &framebuffer); ++ if (err) { ++ fprintf(stderr, "ERROR: failed to open framebuffer: (%s)\n",strerror(-err)); ++ assert(0); ++ } ++ TRACE("** framebuffer_open: status=(%s) format=x%x", strerror(-err), framebuffer->format); ++ + _nativewindow = new FbDevNativeWindow(alloc, framebuffer); + _nativewindow->common.incRef(&_nativewindow->common); + return (EGLNativeWindowType) static_cast(_nativewindow); +-- +2.7.4 + diff --git a/projects/Amlogic/packages/opengl-meson-t82x/package.mk b/projects/Amlogic/packages/opengl-meson-t82x/package.mk new file mode 100644 index 0000000000..050283bfe8 --- /dev/null +++ b/projects/Amlogic/packages/opengl-meson-t82x/package.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="opengl-meson-t82x" +PKG_VERSION="915cb48" +PKG_SHA256="9b5f65afa21250b67578c250da030a5829e69131ce91b2f167b01b1ed30be781" +PKG_LICENSE="nonfree" +PKG_SITE="https://github.com/kszaq/opengl-meson-t82x" +PKG_URL="https://github.com/kszaq/opengl-meson-t82x/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libhybris" +PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION*" +PKG_LONGDESC="OpenGL ES pre-compiled libraries for Mali GPUs. The libraries were extracted from Khadas VIM2 Android firmware." +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/system + cp -a system/* $INSTALL/system +} + +post_install() { + enable_service unbind-console.service +} diff --git a/projects/Amlogic/packages/opengl-meson-t82x/system.d/unbind-console.service b/projects/Amlogic/packages/opengl-meson-t82x/system.d/unbind-console.service new file mode 100644 index 0000000000..a79c37ad11 --- /dev/null +++ b/projects/Amlogic/packages/opengl-meson-t82x/system.d/unbind-console.service @@ -0,0 +1,11 @@ +[Unit] +Description=Unbind framebuffer console + +ConditionPathExists=/sys/class/vtconsole/vtcon1/bind + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'echo 0 > /sys/class/vtconsole/vtcon1/bind' + +[Install] +WantedBy=graphical.target diff --git a/projects/Amlogic/packages/u-boot/package.mk b/projects/Amlogic/packages/u-boot/package.mk new file mode 100644 index 0000000000..6a876179d8 --- /dev/null +++ b/projects/Amlogic/packages/u-boot/package.mk @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="u-boot" +PKG_SITE="https://www.denx.de/wiki/U-Boot" +PKG_DEPENDS_TARGET="toolchain gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host" +PKG_ARCH="arm aarch64" +PKG_LICENSE="GPL" +PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems." + +case "$DEVICE" in + "Odroid_C2") + PKG_VERSION="095fdbe" + PKG_URL="https://github.com/hardkernel/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_SHA256="25ee7c8208d8a97c831b8dd9222ce8984f4a0b8f95dabf9d513c130d04aa05b5" + ;; + "KVIM"*) + PKG_VERSION="ffc14fc" + PKG_URL="https://github.com/khadas/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_SHA256="1326126ca7962d314cb522d95e657dbf71966e74c84fb093181910f9e4f2c1fa" + ;; + "LePotato") + PKG_VERSION="a43076c" + PKG_URL="https://github.com/BayLibre/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_SHA256="0ae5fd97ba86fcd6cc7b2722580745a0ddbf651ffa0cc0bd188a05a9b668373f" + ;; + *) + PKG_TOOLCHAIN="manual" + ;; +esac + +PKG_NEED_UNPACK="$PROJECT_DIR/$PROJECT/bootloader" +[ -n "$DEVICE" ] && PKG_NEED_UNPACK+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader" + +post_unpack() { + sed -i "s|arm-none-eabi-|arm-eabi-|g" $PKG_BUILD/Makefile $PKG_BUILD/arch/arm/cpu/armv8/gx*/firmware/scp_task/Makefile 2>/dev/null || true +} + +make_target() { + if [ -n "$PKG_URL" ]; then + [ "${BUILD_WITH_DEBUG}" = "yes" ] && PKG_DEBUG=1 || PKG_DEBUG=0 + export PATH=$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/bin/:$TOOLCHAIN/lib/gcc-linaro-arm-eabi/bin/:$PATH + DEBUG=${PKG_DEBUG} CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make mrproper + DEBUG=${PKG_DEBUG} CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make $UBOOT_CONFIG + DEBUG=${PKG_DEBUG} CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make HOSTCC="$HOST_CC" HOSTSTRIP="true" + fi +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/bootloader + + # Only install u-boot.img et al when building a board specific image + find_file_path bootloader/install && . ${FOUND_PATH} + + # Always install the update script + find_file_path bootloader/update.sh && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + + # Always install the canupdate script + if find_file_path bootloader/canupdate.sh; then + cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + sed -e "s/@PROJECT@/${DEVICE:-$PROJECT}/g" \ + -i $INSTALL/usr/share/bootloader/canupdate.sh + fi + + find_file_path bootloader/boot.ini && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + find_file_path bootloader/config.ini && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + + case "$DEVICE" in + "Odroid_C2") + cp -av $PKG_BUILD/u-boot.bin $INSTALL/usr/share/bootloader/u-boot + ;; + "KVIM"*|"LePotato") + cp -av $PKG_BUILD/fip/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader/u-boot + ;; + esac +} diff --git a/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0002-gcc7.patch b/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0002-gcc7.patch new file mode 100644 index 0000000000..ff67462703 --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0002-gcc7.patch @@ -0,0 +1,69 @@ +diff -Naur u-boot-imx6-ad02f49.org/include/linux/compiler-gcc7.h u-boot-imx6-ad02f49/include/linux/compiler-gcc7.h +--- u-boot-imx6-ad02f49.org/include/linux/compiler-gcc7.h 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-imx6-ad02f49/include/linux/compiler-gcc7.h 2017-05-23 10:31:00.177476141 +0200 +@@ -0,0 +1,65 @@ ++#ifndef __LINUX_COMPILER_H ++#error "Please don't include directly, include instead." ++#endif ++ ++#define __used __attribute__((__used__)) ++#define __must_check __attribute__((warn_unused_result)) ++#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) ++ ++/* Mark functions as cold. gcc will assume any path leading to a call ++ to them will be unlikely. This means a lot of manual unlikely()s ++ are unnecessary now for any paths leading to the usual suspects ++ like BUG(), printk(), panic() etc. [but let's keep them for now for ++ older compilers] ++ ++ Early snapshots of gcc 4.3 don't support this and we can't detect this ++ in the preprocessor, but we can live with this because they're unreleased. ++ Maketime probing would be overkill here. ++ ++ gcc also has a __attribute__((__hot__)) to move hot functions into ++ a special section, but I don't see any sense in this right now in ++ the kernel context */ ++#define __cold __attribute__((__cold__)) ++ ++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++ ++#ifndef __CHECKER__ ++# define __compiletime_warning(message) __attribute__((warning(message))) ++# define __compiletime_error(message) __attribute__((error(message))) ++#endif /* __CHECKER__ */ ++ ++/* ++ * Mark a position in code as unreachable. This can be used to ++ * suppress control flow warnings after asm blocks that transfer ++ * control elsewhere. ++ * ++ * Early snapshots of gcc 4.5 don't support this and we can't detect ++ * this in the preprocessor, but we can live with this because they're ++ * unreleased. Really, we need to have autoconf for the kernel. ++ */ ++#define unreachable() __builtin_unreachable() ++ ++/* Mark a function definition as prohibited from being cloned. */ ++#define __noclone __attribute__((__noclone__)) ++ ++/* ++ * Tell the optimizer that something else uses this function or variable. ++ */ ++#define __visible __attribute__((externally_visible)) ++ ++/* ++ * GCC 'asm goto' miscompiles certain code sequences: ++ * ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++ * ++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++ * ++ * (asm goto is automatically volatile - the naming reflects this.) ++ */ ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++ ++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++#define __HAVE_BUILTIN_BSWAP32__ ++#define __HAVE_BUILTIN_BSWAP64__ ++#define __HAVE_BUILTIN_BSWAP16__ ++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ diff --git a/projects/Odroid_C2/patches/u-boot/u-boot-0001-set-default-boot-options.patch b/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0003-set-default-boot-options.patch similarity index 100% rename from projects/Odroid_C2/patches/u-boot/u-boot-0001-set-default-boot-options.patch rename to projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0003-set-default-boot-options.patch diff --git a/projects/Odroid_C2/patches/u-boot/u-boot-0002-update_cec_wakeup_code.patch b/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0004-update_cec_wakeup_code.patch similarity index 100% rename from projects/Odroid_C2/patches/u-boot/u-boot-0002-update_cec_wakeup_code.patch rename to projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0004-update_cec_wakeup_code.patch diff --git a/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0005-update_cec_simplink_wakeup.patch b/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0005-update_cec_simplink_wakeup.patch new file mode 100644 index 0000000000..ae9c337847 --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/095fdbe/u-boot-0005-update_cec_simplink_wakeup.patch @@ -0,0 +1,54 @@ +From 4afa1ca1f37bc084c2805f76372dc6a47e2d971a Mon Sep 17 00:00:00 2001 +From: Radostan Riedel +Date: Sun, 30 Apr 2017 15:48:53 +0200 +Subject: [PATCH 1/1] CEC: make wakeup work with LG simplink + +--- + .../cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c | 24 ++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c b/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c +index 7d397cac8b..8a3423b7cc 100644 +--- a/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c ++++ b/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c +@@ -359,6 +359,18 @@ static void cec_get_version(unsigned char initiator) + cec_triggle_tx(msg, 3); + } + ++void cec_send_simplink_init_ack(void) ++{ ++ unsigned char msg[4]; ++ ++ msg[0] = ((cec_msg.log_addr & 0xf) << 4) | CEC_TV_ADDR; ++ msg[1] = CEC_OC_VENDOR_COMMAND; ++ msg[2] = 0x2; ++ msg[3] = 0x5; ++ ++ cec_triggle_tx(msg, 4); ++} ++ + static unsigned int cec_handle_message(void) + { + unsigned char initiator = (cec_msg.msg[0] >> 4) & 0xf; +@@ -388,6 +400,18 @@ static unsigned int cec_handle_message(void) + cec_device_vendor_id(); + break; + case CEC_OC_VENDOR_COMMAND: ++ if (cec_msg.msg_len < 3) ++ break; ++ if (directly_addressed) { ++ if (cec_msg.msg[2] == 0x1) { // SL INIT ++ cec_send_simplink_init_ack(); // SL INIT ACK ++ } ++ if ((cec_msg.msg[2] == 0x3) || // SL POWER ON ++ (cec_msg.msg[2] == 0x4) || // SL CONNECT REQUEST ++ (cec_msg.msg[2] == 0xb)) { // SL RECONNECT REQUEST ++ cec_msg.cec_power = 0x1; ++ } ++ } + case CEC_OC_VENDOR_COMMAND_WITH_ID: + break; + case CEC_OC_GIVE_OSD_NAME: +-- +2.11.0 + diff --git a/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0001-remove-hardcoded-toolchain-path.patch b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0001-remove-hardcoded-toolchain-path.patch new file mode 100644 index 0000000000..f12139f4b8 --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0001-remove-hardcoded-toolchain-path.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -246,8 +246,6 @@ + CROSS_COMPILE ?= + endif + +-export CROSS_COMPILE=aarch64-none-elf- +- + KCONFIG_CONFIG ?= .config + export KCONFIG_CONFIG + diff --git a/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0002-add-linux-compiler-gcc5.h.patch b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0002-add-linux-compiler-gcc5.h.patch new file mode 100644 index 0000000000..790eb2008b --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0002-add-linux-compiler-gcc5.h.patch @@ -0,0 +1,90 @@ +From d6fe7444c27b35599f1bbae3ab321507a246dce0 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sat, 7 Feb 2015 22:52:40 +0100 +Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5 + +Add linux/compiler-gcc5/h from the kernel sources at: + +commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b +Author: Steven Noonan +Date: Sat Oct 25 15:09:42 2014 -0700 + + compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles + +Signed-off-by: Hans de Goede +--- + include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 65 insertions(+) + create mode 100644 include/linux/compiler-gcc5.h + +diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h +new file mode 100644 +index 0000000000..c8c5659525 +--- /dev/null ++++ b/include/linux/compiler-gcc5.h +@@ -0,0 +1,65 @@ ++#ifndef __LINUX_COMPILER_H ++#error "Please don't include directly, include instead." ++#endif ++ ++#define __used __attribute__((__used__)) ++#define __must_check __attribute__((warn_unused_result)) ++#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) ++ ++/* Mark functions as cold. gcc will assume any path leading to a call ++ to them will be unlikely. This means a lot of manual unlikely()s ++ are unnecessary now for any paths leading to the usual suspects ++ like BUG(), printk(), panic() etc. [but let's keep them for now for ++ older compilers] ++ ++ Early snapshots of gcc 4.3 don't support this and we can't detect this ++ in the preprocessor, but we can live with this because they're unreleased. ++ Maketime probing would be overkill here. ++ ++ gcc also has a __attribute__((__hot__)) to move hot functions into ++ a special section, but I don't see any sense in this right now in ++ the kernel context */ ++#define __cold __attribute__((__cold__)) ++ ++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++ ++#ifndef __CHECKER__ ++# define __compiletime_warning(message) __attribute__((warning(message))) ++# define __compiletime_error(message) __attribute__((error(message))) ++#endif /* __CHECKER__ */ ++ ++/* ++ * Mark a position in code as unreachable. This can be used to ++ * suppress control flow warnings after asm blocks that transfer ++ * control elsewhere. ++ * ++ * Early snapshots of gcc 4.5 don't support this and we can't detect ++ * this in the preprocessor, but we can live with this because they're ++ * unreleased. Really, we need to have autoconf for the kernel. ++ */ ++#define unreachable() __builtin_unreachable() ++ ++/* Mark a function definition as prohibited from being cloned. */ ++#define __noclone __attribute__((__noclone__)) ++ ++/* ++ * Tell the optimizer that something else uses this function or variable. ++ */ ++#define __visible __attribute__((externally_visible)) ++ ++/* ++ * GCC 'asm goto' miscompiles certain code sequences: ++ * ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++ * ++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++ * ++ * (asm goto is automatically volatile - the naming reflects this.) ++ */ ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++ ++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++#define __HAVE_BUILTIN_BSWAP32__ ++#define __HAVE_BUILTIN_BSWAP64__ ++#define __HAVE_BUILTIN_BSWAP16__ ++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ diff --git a/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0004-faster-boot.patch b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0004-faster-boot.patch new file mode 100644 index 0000000000..047d4a5b7c --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0004-faster-boot.patch @@ -0,0 +1,242 @@ +From 2896063602000eb099eb0774d001bbdc76df264a Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Mon, 12 Feb 2018 22:44:10 +0100 +Subject: [PATCH] libretech_cc: amend boot procedure for LibreELEC + +* make eMMC use MBR instead of AML partition structure +* port eMMC/SD renumbering from Hardkernel to allow booting from either SD or eMMC +* remove NAND driver (not in use) +* remove fastboot, bcb, store interface (not in use and conflicts with eMMC MBR) +* remove preboot steps that are not requried for faster booting +--- + board/amlogic/configs/libretech_cc.h | 47 ++++---------------- + board/amlogic/libretech_cc/libretech_cc.c | 71 ++++++++++++++----------------- + drivers/mmc/aml_sd_emmc.c | 1 - + 3 files changed, 41 insertions(+), 78 deletions(-) + +diff --git a/board/amlogic/configs/libretech_cc.h b/board/amlogic/configs/libretech_cc.h +index b3ccfae..84f66ae 100644 +--- a/board/amlogic/configs/libretech_cc.h ++++ b/board/amlogic/configs/libretech_cc.h +@@ -45,10 +45,10 @@ + #define CONFIG_CEC_OSD_NAME "LibreTech-CC" + #define CONFIG_CEC_WAKEUP + +-#define CONFIG_INSTABOOT ++// #define CONFIG_INSTABOOT + #define CONFIG_CMD_CFGLOAD + /* configs for dtb in boot.img */ +-//#define DTB_BIND_KERNEL ++#define DTB_BIND_KERNEL + + /* SMP Definitinos */ + #define CPU_RELEASE_ADDR secondary_boot_func +@@ -62,12 +62,6 @@ + /* support ext4*/ + #define CONFIG_CMD_EXT4 1 + +-/* Bootloader Control Block function +- That is used for recovery and the bootloader to talk to each other +- */ +-#define CONFIG_BOOTLOADER_CONTROL_BLOCK +- +- + /* Serial config */ + #define CONFIG_CONS_INDEX 2 + #define CONFIG_BAUDRATE 115200 +@@ -209,7 +203,7 @@ + "if imgread kernel ${recovery_part} ${loadaddr} ${recovery_offset}; then wipeisb; bootm ${loadaddr}; fi;"\ + "\0"\ + "init_display="\ +- "osd open;osd clear;imgread pic logo bootup $loadaddr;bmp display $bootup_offset;bmp scale"\ ++ "osd open;osd clear;"\ + "\0"\ + "cmdline_keys="\ + "if keyman init 0x1234; then "\ +@@ -236,17 +230,10 @@ + "\0"\ + + #define CONFIG_PREBOOT \ +- "run bcb_cmd; "\ +- "run factory_reset_poweroff_protect;"\ +- "run upgrade_check;"\ +- "run init_display;"\ +- "run storeargs;"\ +- "run upgrade_key;" \ +- "run switch_bootmode;" \ +- "cfgload;" +-#define CONFIG_BOOTCOMMAND "run storeboot" +- +-//#define CONFIG_ENV_IS_NOWHERE 1 ++ "run init_display;" ++#define CONFIG_BOOTCOMMAND "cfgload" ++ ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (64*1024) + #define CONFIG_FIT 1 + #define CONFIG_OF_LIBFDT 1 +@@ -283,7 +270,7 @@ + #define CONFIG_DDR_USE_EXT_VREF 0 //0:disable, 1:enable. ddr use external vref + + /* storage: emmc/nand/sd */ +-#define CONFIG_STORE_COMPATIBLE 1 ++//#define CONFIG_STORE_COMPATIBLE 1 + /* + * storage + * |---------|---------| +@@ -298,7 +285,7 @@ + /* support for mtd */ + //#define CONFIG_AML_MTD 1 + /* support for nftl */ +-#define CONFIG_AML_NAND 1 ++//#define CONFIG_AML_NAND 1 + + #if defined(CONFIG_AML_NAND) && defined(CONFIG_AML_MTD) + #error CONFIG_AML_NAND/CONFIG_AML_MTD can not support at the sametime; +@@ -389,21 +376,6 @@ + #define CONFIG_USB_XHCI_AMLOGIC_GXL 1 + #endif //#if defined(CONFIG_CMD_USB) + +-//UBOOT fastboot config +-#define CONFIG_CMD_FASTBOOT 1 +-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 +-#define CONFIG_FASTBOOT_FLASH 1 +-#define CONFIG_USB_GADGET 1 +-#define CONFIG_USBDOWNLOAD_GADGET 1 +-#define CONFIG_SYS_CACHELINE_SIZE 64 +-#define CONFIG_DEVICE_PRODUCT "libretech-cc" +- +-//UBOOT Facotry usb/sdcard burning config +-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning +-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning +-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning +-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning +- + #define CONFIG_AML_SECURITY_KEY 1 + #ifndef DTB_BIND_KERNEL + #define CONFIG_UNIFY_KEY_MANAGE 1 +@@ -449,7 +421,6 @@ + + /*file system*/ + #define CONFIG_DOS_PARTITION 1 +-#define CONFIG_AML_PARTITION 1 + #define CONFIG_MMC 1 + #define CONFIG_FS_FAT 1 + #define CONFIG_FS_EXT4 1 +diff --git a/board/amlogic/libretech_cc/libretech_cc.c b/board/amlogic/libretech_cc/libretech_cc.c +index 33bd007..fa66aaa 100644 +--- a/board/amlogic/libretech_cc/libretech_cc.c ++++ b/board/amlogic/libretech_cc/libretech_cc.c +@@ -71,6 +71,23 @@ int dram_init(void) + void secondary_boot_func(void) + { + } ++ ++/* ++ * Discover the boot device within MicroSD or eMMC ++ * and return 1 for eMMC, otherwise 0. ++ */ ++#define BOOT_DEVICE_RESERVED 0 ++#define BOOT_DEVICE_EMMC 1 ++#define BOOT_DEVICE_NAND 2 ++#define BOOT_DEVICE_SPI 3 ++#define BOOT_DEVICE_SD 4 ++#define BOOT_DEVICE_USB 5 ++ ++int get_boot_device(void) ++{ ++ return readl(AO_SEC_GP_CFG0) & 0xf; ++} ++ + void internalPhyConfig(struct phy_device *phydev) + { + /*Enable Analog and DSP register Bank access by*/ +@@ -263,8 +280,21 @@ int board_mmc_init(bd_t *bis) + #else + //board_mmc_register(SDIO_PORT_B); + #endif +- board_mmc_register(SDIO_PORT_B); +- board_mmc_register(SDIO_PORT_C); ++ switch (get_boot_device()) ++ { ++ case BOOT_DEVICE_EMMC: ++ board_mmc_register(SDIO_PORT_C); // "mmc0" ++ board_mmc_register(SDIO_PORT_B); ++ break; ++ case BOOT_DEVICE_SD: ++ board_mmc_register(SDIO_PORT_B); // "mmc0" ++ board_mmc_register(SDIO_PORT_C); ++ break; ++ default: ++ printf("No available mmc device! Check boot device!\n"); ++ do_reset(NULL, 0, 0, NULL); ++ break; ++ } + // board_mmc_register(SDIO_PORT_B1); + #if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC) + /* try emmc here. */ +@@ -417,49 +447,12 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, + #endif + #ifdef CONFIG_BOARD_LATE_INIT + int board_late_init(void){ +- //update env before anyone using it +- run_command("get_rebootmode; echo reboot_mode=${reboot_mode}; "\ +- "if test ${reboot_mode} = factory_reset; then "\ +- "defenv_reserv aml_dt;setenv upgrade_step 2;save; fi;", 0); +- run_command("if itest ${upgrade_step} == 1; then "\ +- "defenv_reserv; setenv upgrade_step 2; saveenv; fi;", 0); +- + #ifndef CONFIG_AML_IRDETECT_EARLY + /* after */ + run_command("cvbs init;hdmitx hpd", 0); + run_command("vout output $outputmode", 0); + #endif + /*add board late init function here*/ +-#ifndef DTB_BIND_KERNEL +- int ret; +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +- #ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +- #endif +- } +-#elif defined(CONFIG_DTB_MEM_ADDR) +- { +- char cmd[128]; +- int ret; +- if (!getenv("dtb_mem_addr")) { +- sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR); +- run_command(cmd, 0); +- } +- sprintf(cmd, "imgread dtb boot ${dtb_mem_addr}"); +- ret = run_command(cmd, 0); +- if (ret) { +- printf("%s(): cmd[%s] fail, ret=%d\n", __func__, cmd, ret); +- } +- } +-#endif// #ifndef DTB_BIND_KERNEL + #ifdef CONFIG_AML_V2_FACTORY_BURN + if (0x1b8ec003 == readl(P_PREG_STICKY_REG2)) + aml_try_factory_usb_burning(1, gd->bd); +diff --git a/drivers/mmc/aml_sd_emmc.c b/drivers/mmc/aml_sd_emmc.c +index 57f949d..6ea60ee 100644 +--- a/drivers/mmc/aml_sd_emmc.c ++++ b/drivers/mmc/aml_sd_emmc.c +@@ -786,7 +786,6 @@ void sd_emmc_register(struct aml_card_sd_info * aml_priv) + #endif + cfg->f_min = 400000; + cfg->f_max = 40000000; +- cfg->part_type = PART_TYPE_AML; + cfg->b_max = 256; + mmc_create(cfg,aml_priv); + } +-- +2.7.4 + diff --git a/projects/Amlogic/packages/u-boot/patches/ffc14fc/u-boot-0001-khadas_vim-amend-boot-procedure-for-LibreELEC.patch b/projects/Amlogic/packages/u-boot/patches/ffc14fc/u-boot-0001-khadas_vim-amend-boot-procedure-for-LibreELEC.patch new file mode 100644 index 0000000000..82b0e6e4d9 --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/ffc14fc/u-boot-0001-khadas_vim-amend-boot-procedure-for-LibreELEC.patch @@ -0,0 +1,464 @@ +From 1eab6c71f578b46bc9f33378252840ed46f9c443 Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Sat, 17 Feb 2018 20:30:08 +0100 +Subject: [PATCH] khadas_vim: amend boot procedure for LibreELEC + +* make eMMC use MBR instead of AML partition structure +* port eMMC/SD renumbering from Hardkernel to allow booting from either SD or eMMC +* remove NAND driver (not in use) +* remove fastboot, bcb, store interface (not in use and conflicts with eMMC MBR) +* remove preboot steps that are not requried for faster booting +* fix eMMC for KVIM2 when CONFIG_ENV_IS_NOWHERE +--- + board/khadas/configs/kvim.h | 39 ++++----------------- + board/khadas/configs/kvim2.h | 37 +++----------------- + board/khadas/kvim/kvim.c | 83 +++++++++++++++++--------------------------- + board/khadas/kvim2/kvim2.c | 80 ++++++++++++++++++++++-------------------- + drivers/mmc/aml_sd_emmc.c | 1 - + 5 files changed, 85 insertions(+), 155 deletions(-) + +diff --git a/board/khadas/configs/kvim.h b/board/khadas/configs/kvim.h +index 0189f32..e95fc98 100644 +--- a/board/khadas/configs/kvim.h ++++ b/board/khadas/configs/kvim.h +@@ -47,7 +47,7 @@ + + //#define CONFIG_INSTABOOT + /* configs for dtb in boot.img */ +-//#define DTB_BIND_KERNEL ++#define DTB_BIND_KERNEL + + /* SMP Definitinos */ + #define CPU_RELEASE_ADDR secondary_boot_func +@@ -61,12 +61,6 @@ + /* support ext4*/ + #define CONFIG_CMD_EXT4 1 + +-/* Bootloader Control Block function +- That is used for recovery and the bootloader to talk to each other +- */ +-#define CONFIG_BOOTLOADER_CONTROL_BLOCK +- +- + /* Serial config */ + #define CONFIG_CONS_INDEX 2 + #define CONFIG_BAUDRATE 115200 +@@ -109,8 +103,6 @@ + "init_display=" \ + "osd open;" \ + "osd clear;" \ +- "imgread pic logo bootup ${loadaddr};" \ +- "bmp display ${bootup_offset}; bmp scale" \ + "\0"\ + "bootdisk=ramdisk\0" \ + "bootargs=" \ +@@ -140,13 +132,11 @@ + * - ramdisk: Ubuntu or Linux distro + */ + #define CONFIG_PREBOOT \ +- "run init_display;" \ +- "run combine_key;" \ +- "run upgrade_key;" ++ "run init_display;" + +-#define CONFIG_BOOTCOMMAND "cfgload;ext4load mmc 1:5 1080000 Image;ext4load mmc 1:5 10000000 uInitrd;ext4load mmc 1:5 20000000 kvim.dtb;booti 1080000 10000000 20000000" ++#define CONFIG_BOOTCOMMAND "cfgload" + +-//#define CONFIG_ENV_IS_NOWHERE 1 ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (64*1024) + #define CONFIG_FIT 1 + #define CONFIG_OF_LIBFDT 1 +@@ -184,7 +174,7 @@ + #define CONFIG_DDR_FUNC_PRINT_WINDOW 0 //0:disable, 1:enable. print ddr training window + + /* storage: emmc/nand/sd */ +-#define CONFIG_STORE_COMPATIBLE 1 ++//#define CONFIG_STORE_COMPATIBLE 1 + /* + * storage + * |---------|---------| +@@ -199,7 +189,7 @@ + /* support for mtd */ + //#define CONFIG_AML_MTD 1 + /* support for nftl */ +-#define CONFIG_AML_NAND 1 ++// #define CONFIG_AML_NAND 1 + + #if defined(CONFIG_AML_NAND) && defined(CONFIG_AML_MTD) + #error CONFIG_AML_NAND/CONFIG_AML_MTD can not support at the sametime; +@@ -290,22 +280,6 @@ + #define CONFIG_USB_XHCI_AMLOGIC_GXL 1 + #endif //#if defined(CONFIG_CMD_USB) + +-//UBOOT fastboot config +-#define CONFIG_CMD_FASTBOOT 1 +-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 +-#define CONFIG_FASTBOOT_FLASH 1 +-#define CONFIG_USB_GADGET 1 +-#define CONFIG_USBDOWNLOAD_GADGET 1 +-#define CONFIG_SYS_CACHELINE_SIZE 64 +-#define CONFIG_FASTBOOT_MAX_DOWN_SIZE 0x8000000 +-#define CONFIG_DEVICE_PRODUCT "p212" +- +-//UBOOT Facotry usb/sdcard burning config +-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning +-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning +-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning +-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning +- + #define CONFIG_AML_SECURITY_KEY 1 + #ifndef DTB_BIND_KERNEL + #define CONFIG_UNIFY_KEY_MANAGE 1 +@@ -352,7 +326,6 @@ + + /*file system*/ + #define CONFIG_DOS_PARTITION 1 +-#define CONFIG_AML_PARTITION 1 + #define CONFIG_MMC 1 + #define CONFIG_FS_FAT 1 + #define CONFIG_FS_EXT4 1 +diff --git a/board/khadas/configs/kvim2.h b/board/khadas/configs/kvim2.h +index 2b5f832..699b0ec 100644 +--- a/board/khadas/configs/kvim2.h ++++ b/board/khadas/configs/kvim2.h +@@ -54,11 +54,6 @@ + /* support ext4*/ + #define CONFIG_CMD_EXT4 1 + +-/* Bootloader Control Block function +- That is used for recovery and the bootloader to talk to each other +- */ +-#define CONFIG_BOOTLOADER_CONTROL_BLOCK +- + #define CONFIG_CMD_SARADC 1 + #define CONFIG_PHY_REALTEK 1 + +@@ -108,8 +103,6 @@ + "init_display=" \ + "osd open;" \ + "osd clear;" \ +- "imgread pic logo bootup ${loadaddr};" \ +- "bmp display ${bootup_offset}; bmp scale" \ + "\0"\ + "bootdisk=ramdisk\0" \ + "initargs=" \ +@@ -159,14 +152,11 @@ + + #define CONFIG_PREBOOT \ + "run init_display;"\ +- "run combine_key;" \ +- "run storeargs;"\ + "run wol_init;" \ +- "run upgrade_key;" \ + "run vim2_check;" +-#define CONFIG_BOOTCOMMAND "cfgload;ext4load mmc 1:5 1080000 Image;ext4load mmc 1:5 10000000 uInitrd;ext4load mmc 1:5 20000000 kvim2.dtb;booti 1080000 10000000 20000000" ++#define CONFIG_BOOTCOMMAND "cfgload" + +-//#define CONFIG_ENV_IS_NOWHERE 1 ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (64*1024) + #define CONFIG_FIT 1 + #define CONFIG_OF_LIBFDT 1 +@@ -207,7 +197,7 @@ + #define CONFIG_DDR_PLL_BYPASS 0 //0:disable, 1:enable. ddr pll bypass function + + /* storage: emmc/nand/sd */ +-#define CONFIG_STORE_COMPATIBLE 1 ++//#define CONFIG_STORE_COMPATIBLE 1 + /* + * storage + * |---------|---------| +@@ -283,7 +273,7 @@ + + /*SPI*/ + //#define CONFIG_SPI_BOOT 1 +-#define CONFIG_AMLOGIC_SPI_FLASH 1 ++//#define CONFIG_AMLOGIC_SPI_FLASH 1 + #ifdef CONFIG_AMLOGIC_SPI_FLASH + #undef CONFIG_ENV_IS_NOWHERE + #define CONFIG_SPI_FLASH_WINBOND +@@ -329,24 +319,8 @@ + #define CONFIG_USB_XHCI_AMLOGIC_GXL 1 + #endif //#if defined(CONFIG_CMD_USB) + +-//UBOOT fastboot config +-#define CONFIG_CMD_FASTBOOT 1 +-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 +-#define CONFIG_FASTBOOT_FLASH 1 +-#define CONFIG_USB_GADGET 1 +-#define CONFIG_USBDOWNLOAD_GADGET 1 +-#define CONFIG_SYS_CACHELINE_SIZE 64 +-#define CONFIG_FASTBOOT_MAX_DOWN_SIZE 0x8000000 +-#define CONFIG_DEVICE_PRODUCT "q200" +- +-//UBOOT Facotry usb/sdcard burning config +-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning +-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning +-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning +-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning +- + #define CONFIG_AML_SECURITY_KEY 1 +-#define CONFIG_UNIFY_KEY_MANAGE 1 ++//#define CONFIG_UNIFY_KEY_MANAGE 1 + + /* net */ + #define CONFIG_CMD_NET 1 +@@ -388,7 +362,6 @@ + + /*file system*/ + #define CONFIG_DOS_PARTITION 1 +-#define CONFIG_AML_PARTITION 1 + #define CONFIG_MMC 1 + #define CONFIG_FS_FAT 1 + #define CONFIG_FS_EXT4 1 +diff --git a/board/khadas/kvim/kvim.c b/board/khadas/kvim/kvim.c +index b1fdb96..41a056a 100644 +--- a/board/khadas/kvim/kvim.c ++++ b/board/khadas/kvim/kvim.c +@@ -71,6 +71,23 @@ int dram_init(void) + void secondary_boot_func(void) + { + } ++ ++/* ++ * Discover the boot device within MicroSD or eMMC ++ * and return 1 for eMMC, otherwise 0. ++ */ ++#define BOOT_DEVICE_RESERVED 0 ++#define BOOT_DEVICE_EMMC 1 ++#define BOOT_DEVICE_NAND 2 ++#define BOOT_DEVICE_SPI 3 ++#define BOOT_DEVICE_SD 4 ++#define BOOT_DEVICE_USB 5 ++ ++int get_boot_device(void) ++{ ++ return readl(AO_SEC_GP_CFG0) & 0xf; ++} ++ + void internalPhyConfig(struct phy_device *phydev) + { + /*Enable Analog and DSP register Bank access by*/ +@@ -263,8 +280,21 @@ int board_mmc_init(bd_t *bis) + #else + //board_mmc_register(SDIO_PORT_B); + #endif +- board_mmc_register(SDIO_PORT_B); +- board_mmc_register(SDIO_PORT_C); ++ switch (get_boot_device()) ++ { ++ case BOOT_DEVICE_EMMC: ++ board_mmc_register(SDIO_PORT_C); // "mmc0" ++ board_mmc_register(SDIO_PORT_B); ++ break; ++ case BOOT_DEVICE_SD: ++ board_mmc_register(SDIO_PORT_B); // "mmc0" ++ board_mmc_register(SDIO_PORT_C); ++ break; ++ default: ++ printf("No available mmc device! Check boot device!\n"); ++ do_reset(NULL, 0, 0, NULL); ++ break; ++ } + // board_mmc_register(SDIO_PORT_B1); + #if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC) + /* try emmc here. */ +@@ -413,58 +443,9 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, + #endif + #ifdef CONFIG_BOARD_LATE_INIT + int board_late_init(void){ +- /* ENV need update in following cases: +- * - Bootloader upgrade +- * - New ROM upgrade(the built-in bootloader might be changed) +- */ +- run_command("get_rebootmode;" \ +- "echo reboot_mode=${reboot_mode};" \ +- "if test ${reboot_mode} = factory_reset; then " \ +- "defenv_reserv aml_dt;" \ +- "setenv upgrade_step 2;" \ +- "save;" \ +- "fi;", 0); +- run_command("if itest ${upgrade_step} == 1; then " \ +- "defenv_reserv;" \ +- "setenv upgrade_step 2;" \ +- "saveenv;" \ +- "fi;", 0); +- + /* HDMI setup */ + run_command("hdmitx hpd", 0); + run_command("vout output $outputmode", 0); +- /* Load DTB */ +-#ifndef DTB_BIND_KERNEL +- int ret; +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +- #ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +- #endif +- } +-#elif defined(CONFIG_DTB_MEM_ADDR) +- { +- char cmd[128]; +- int ret; +- if (!getenv("dtb_mem_addr")) { +- sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR); +- run_command(cmd, 0); +- } +- sprintf(cmd, "imgread dtb boot ${dtb_mem_addr}"); +- ret = run_command(cmd, 0); +- if (ret) { +- printf("%s(): cmd[%s] fail, ret=%d\n", __func__, cmd, ret); +- } +- } +-#endif// #ifndef DTB_BIND_KERNEL +- + /* Khadas VIM check */ + run_command("saradc open 1;" \ + "if saradc get_in_range 0x1a0 0x220; then " \ +diff --git a/board/khadas/kvim2/kvim2.c b/board/khadas/kvim2/kvim2.c +index 99a6181..3b9febf 100644 +--- a/board/khadas/kvim2/kvim2.c ++++ b/board/khadas/kvim2/kvim2.c +@@ -68,6 +68,23 @@ int dram_init(void) + void secondary_boot_func(void) + { + } ++ ++/* ++ * Discover the boot device within MicroSD or eMMC ++ * and return 1 for eMMC, otherwise 0. ++ */ ++#define BOOT_DEVICE_RESERVED 0 ++#define BOOT_DEVICE_EMMC 1 ++#define BOOT_DEVICE_NAND 2 ++#define BOOT_DEVICE_SPI 3 ++#define BOOT_DEVICE_SD 4 ++#define BOOT_DEVICE_USB 5 ++ ++int get_boot_device(void) ++{ ++ return readl(AO_SEC_GP_CFG0) & 0xf; ++} ++ + void internalPhyConfig(struct phy_device *phydev) + { + /*Enable Analog and DSP register Bank access by*/ +@@ -299,14 +316,36 @@ static void board_mmc_register(unsigned port) + } + int board_mmc_init(bd_t *bis) + { ++ __maybe_unused struct mmc *mmc; + #ifdef CONFIG_VLSI_EMULATOR + //board_mmc_register(SDIO_PORT_A); + #else + //board_mmc_register(SDIO_PORT_B); + #endif +- board_mmc_register(SDIO_PORT_B); +- board_mmc_register(SDIO_PORT_C); ++ switch (get_boot_device()) ++ { ++ case BOOT_DEVICE_EMMC: ++ board_mmc_register(SDIO_PORT_C); // "mmc0" ++ board_mmc_register(SDIO_PORT_B); ++ break; ++ case BOOT_DEVICE_SD: ++ board_mmc_register(SDIO_PORT_B); // "mmc0" ++ board_mmc_register(SDIO_PORT_C); ++ break; ++ default: ++ printf("No available mmc device! Check boot device!\n"); ++ do_reset(NULL, 0, 0, NULL); ++ break; ++ } + // board_mmc_register(SDIO_PORT_B1); ++#if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC) ++ /* try emmc here. */ ++ mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV); ++ if (!mmc) ++ printf("%s() %d: No MMC found\n", __func__, __LINE__); ++ else if (mmc_init(mmc)) ++ printf("%s() %d: MMC init failed\n", __func__, __LINE__); ++#endif + return 0; + } + +@@ -446,34 +485,13 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, + #endif + #ifdef CONFIG_BOARD_LATE_INIT + int board_late_init(void){ +- int ret; +- +- //update env before anyone using it +- run_command("get_rebootmode; echo reboot_mode=${reboot_mode}; "\ +- "if test ${reboot_mode} = factory_reset; then "\ +- "defenv_reserv aml_dt;setenv upgrade_step 2;save; fi;", 0); +- run_command("if itest ${upgrade_step} == 1; then "\ +- "defenv_reserv; setenv upgrade_step 2; saveenv; fi;", 0); + + #ifndef CONFIG_AML_IRDETECT_EARLY + /* after */ +- run_command("cvbs init;hdmitx hpd", 0); ++ run_command("hdmitx hpd", 0); + run_command("vout output $outputmode", 0); + #endif + /*add board late init function here*/ +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +- #ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +- #endif +- } + #ifdef CONFIG_AML_V2_FACTORY_BURN + if (0x1b8ec003 == readl(P_PREG_STICKY_REG2)) + aml_try_factory_usb_burning(1, gd->bd); +@@ -489,20 +507,6 @@ int board_late_init(void){ + /* load uboot pq value */ + vpp_pq_load(); + +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +-#ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +-#endif +-} +- + return 0; + } + #endif +diff --git a/drivers/mmc/aml_sd_emmc.c b/drivers/mmc/aml_sd_emmc.c +index 4d3a84f..f8aa8f7 100644 +--- a/drivers/mmc/aml_sd_emmc.c ++++ b/drivers/mmc/aml_sd_emmc.c +@@ -787,7 +787,6 @@ void sd_emmc_register(struct aml_card_sd_info * aml_priv) + #endif + cfg->f_min = 400000; + cfg->f_max = 40000000; +- cfg->part_type = PART_TYPE_AML; + cfg->b_max = 256; + mmc_create(cfg,aml_priv); + } +-- +2.7.4 + diff --git a/projects/Amlogic/patches/linux/linux-0002-use_logo_param_instead_of_vout.patch b/projects/Amlogic/patches/linux/linux-0002-use_logo_param_instead_of_vout.patch new file mode 100644 index 0000000000..cb41eacd32 --- /dev/null +++ b/projects/Amlogic/patches/linux/linux-0002-use_logo_param_instead_of_vout.patch @@ -0,0 +1,64 @@ +diff --git a/drivers/amlogic/display/logo/logo.c b/drivers/amlogic/display/logo/logo.c +index 9266be3..e3e9685 100644 +--- a/drivers/amlogic/display/logo/logo.c ++++ b/drivers/amlogic/display/logo/logo.c +@@ -117,16 +117,10 @@ int set_osd_freescaler(int index, enum vmode_e new_mode) + static int refresh_mode_and_logo(bool first) + { + enum vmode_e cur_mode = VMODE_MAX; +- int hdp_state = get_hpd_state(); + + if (!first && osd_get_logo_index() != logo_info.index) + return -1; + +- if (hdp_state) +- cur_mode = hdmimode; +- else +- cur_mode = cvbsmode; +- + if (first) { + last_mode = get_logo_vmode(); + +@@ -193,6 +187,8 @@ static int logo_info_init(char *para) + } + return 0; + } ++ else if (vmode_name_to_mode(para) < VMODE_MAX) ++ set_vout_init_vmode(para); + + return 0; + } +diff --git a/drivers/amlogic/display/vout/vout_serve.c b/drivers/amlogic/display/vout/vout_serve.c +index fae61b3..9196c2c 100644 +--- a/drivers/amlogic/display/vout/vout_serve.c ++++ b/drivers/amlogic/display/vout/vout_serve.c +@@ -666,6 +666,17 @@ static int __init get_vout_init_mode(char *str) + } + __setup("vout=", get_vout_init_mode); + ++void set_vout_init_vmode(char *str) ++{ ++ char str2[1024]; ++ strcpy(str2, str); ++ strcat(str2, ",en"); // logo was already displayed by uboot ++ get_vout_init_mode(str2); ++ pr_err("set_vout_init_vmode: %s\n", str2); ++ ++} ++EXPORT_SYMBOL(set_vout_init_vmode); ++ + MODULE_AUTHOR("Platform-BJ "); + MODULE_DESCRIPTION("VOUT Server Module"); + MODULE_LICENSE("GPL"); +diff --git a/include/linux/amlogic/vout/vout_notify.h b/include/linux/amlogic/vout/vout_notify.h +index 2e4922a..659da93 100644 +--- a/include/linux/amlogic/vout/vout_notify.h ++++ b/include/linux/amlogic/vout/vout_notify.h +@@ -102,6 +102,7 @@ extern enum vmode_e validate_vmode2(char *); + extern void set_vout2_mode_internal(char *name); + extern enum vmode_e get_logo_vmode(void); + extern int set_logo_vmode(enum vmode_e); ++extern void set_vout_init_vmode(char *); + + extern int vout2_suspend(void); + extern int vout2_resume(void); diff --git a/projects/Amlogic/patches/linux/linux-0003-proc_make_cmdline_writable.patch b/projects/Amlogic/patches/linux/linux-0003-proc_make_cmdline_writable.patch new file mode 100644 index 0000000000..8a6daeebd2 --- /dev/null +++ b/projects/Amlogic/patches/linux/linux-0003-proc_make_cmdline_writable.patch @@ -0,0 +1,64 @@ +From 8e1f02601a22dd09c80cad3f0010a2208859d4ff Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Mon, 15 Aug 2016 02:45:14 +0200 +Subject: [PATCH] proc: make cmdline writable + +--- + fs/proc/cmdline.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c +index cbd82df..24cb197 100644 +--- a/fs/proc/cmdline.c ++++ b/fs/proc/cmdline.c +@@ -3,9 +3,14 @@ + #include + #include + ++#include /* for COMMAND_LINE_SIZE */ ++#include /* copy_from_user */ ++ ++char proc_cmdline[COMMAND_LINE_SIZE]; ++ + static int cmdline_proc_show(struct seq_file *m, void *v) + { +- seq_printf(m, "%s\n", saved_command_line); ++ seq_printf(m, "%s\n", proc_cmdline); + return 0; + } + +@@ -14,15 +19,31 @@ static int cmdline_proc_open(struct inode *inode, struct file *file) + return single_open(file, cmdline_proc_show, NULL); + } + ++static int cmdline_proc_write(struct file *file, const char __user *buf, ++ size_t len, loff_t *ppos) ++{ ++ char str[COMMAND_LINE_SIZE]; ++ if (copy_from_user(str, buf, len)) { ++ printk( KERN_INFO "[cmdline] copy_from_user failed.\n"); ++ return -EFAULT; ++ } ++ str[len] = '\0'; ++ strlcpy(proc_cmdline, str, min((int)len, COMMAND_LINE_SIZE)); ++ ++ return len; ++} ++ + static const struct file_operations cmdline_proc_fops = { + .open = cmdline_proc_open, + .read = seq_read, ++ .write = cmdline_proc_write, + .llseek = seq_lseek, + .release = single_release, + }; + + static int __init proc_cmdline_init(void) + { ++ strcpy(proc_cmdline, saved_command_line); + proc_create("cmdline", 0, NULL, &cmdline_proc_fops); + return 0; + } +-- +1.8.3.1 + diff --git a/projects/Virtual/config/ovf.template b/projects/Generic/config/ovf.template similarity index 89% rename from projects/Virtual/config/ovf.template rename to projects/Generic/config/ovf.template index 488dbc3ff8..7184beb6cf 100644 --- a/projects/Virtual/config/ovf.template +++ b/projects/Generic/config/ovf.template @@ -2,11 +2,11 @@ xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - + Virtual disk information - + The list of logical networks @@ -21,12 +21,12 @@ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemS Meta-information about the installed software LibreELEC LibreELEC - http://libreelec.tv - http://libreelec.tv + https://libreelec.tv + https://libreelec.tv A human-readable annotation - LibreELEC is ‘Just enough OS’ for Kodi, a Linux distribution built to run Kodi on current and popular mediacentre hardware. + LibreELEC is ‘Just enough OS’ for Kodi, a Linux distribution built to run Kodi on current and popular mediacentre hardware. After importing the OVA image adjust CPU, RAM, and HDD storage to the required configuration before first boot. The kind of installed guest operating system @@ -36,7 +36,7 @@ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemS Virtual Hardware Family 0 LibreELEC - vmx-09 + vmx-12 hertz * 10^6 @@ -49,10 +49,10 @@ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemS byte * 2^20 Memory Size - 512MB of memory + 1024MB of memory 2 4 - 512 + 1024 0 diff --git a/projects/Generic/filesystem/usr/bin/cputemp b/projects/Generic/filesystem/usr/bin/cputemp new file mode 100755 index 0000000000..747bdb0e35 --- /dev/null +++ b/projects/Generic/filesystem/usr/bin/cputemp @@ -0,0 +1,52 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +TEMP=0 + +if [ $(basename "$0") = "gputemp" -o "$1" = "gpu" ]; then + + if [ -x /usr/bin/nvidia-smi ]; then + TEMP="$(/usr/bin/nvidia-smi -q -x | grep '' | awk '{ print $1 }' | sed 's,,,g')" + fi + + if [ "$TEMP" = "0" ]; then + for hwmon in /sys/class/hwmon/*; do + if [ -f "${hwmon}/name" ]; then + case $(cat ${hwmon}/name) in + nouveau|radeon|amdgpu) + [[ -f "${hwmon}/temp1_input" ]] && TEMP="$(cat ${hwmon}/temp1_input)" && break + [[ -f "${hwmon}/temp2_input" ]] && TEMP="$(cat ${hwmon}/temp2_input)" && break + ;; + # intel gpu is supported by cpu coretemp below + esac + fi + done + + TEMP="$(( $TEMP / 1000 ))" + fi +fi + +if [ "$1" = "cpu" -o "$TEMP" = "0" ]; then + + for hwmon in /sys/class/hwmon/*; do + if [ -f "${hwmon}/name" ]; then + case $(cat ${hwmon}/name) in + coretemp|k10temp|scpi_sensors) + [[ -f "${hwmon}/temp1_input" ]] && TEMP="$(cat ${hwmon}/temp1_input)" && break + [[ -f "${hwmon}/temp2_input" ]] && TEMP="$(cat ${hwmon}/temp2_input)" && break + ;; + esac + fi + done + + if [ "$TEMP" = "0" -a -f /sys/class/hwmon/hwmon0/device/temp1_input ]; then + TEMP="$(cat /sys/class/hwmon/hwmon0/device/temp1_input)" + fi + + TEMP="$(( $TEMP / 1000 ))" +fi + +echo "${TEMP} C" diff --git a/projects/Generic/filesystem/usr/bin/gputemp b/projects/Generic/filesystem/usr/bin/gputemp new file mode 120000 index 0000000000..6476b954d2 --- /dev/null +++ b/projects/Generic/filesystem/usr/bin/gputemp @@ -0,0 +1 @@ +cputemp \ No newline at end of file diff --git a/projects/Generic/filesystem/usr/bin/intel-fullrange.sh b/projects/Generic/filesystem/usr/bin/intel-fullrange.sh index 2b1be600dd..82f5b3066d 100644 --- a/projects/Generic/filesystem/usr/bin/intel-fullrange.sh +++ b/projects/Generic/filesystem/usr/bin/intel-fullrange.sh @@ -6,7 +6,6 @@ if [ "$FB_TYPE" == "inteldrmfb" ]; then for out in $OUTPUT ; do # Hack - something is not yet fully right /usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Full" - /usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Video 16:235 pass-through" # Seems there is a little race somewhere on some outputs # Turn the display shortly off and on again if [ -e "/storage/.config/forcedisplay" ]; then diff --git a/projects/Generic/filesystem/usr/share/bootloader/canupdate.sh b/projects/Generic/filesystem/usr/share/bootloader/canupdate.sh new file mode 100644 index 0000000000..0e4f1fac42 --- /dev/null +++ b/projects/Generic/filesystem/usr/share/bootloader/canupdate.sh @@ -0,0 +1,2 @@ +# Allow upgrades from Virtual to Generic +[ "$1" = "Virtual.x86_64" ] && exit 0 || exit 1 diff --git a/projects/Generic/kodi/advancedsettings.xml b/projects/Generic/kodi/advancedsettings.xml new file mode 100644 index 0000000000..4bd56ed2e1 --- /dev/null +++ b/projects/Generic/kodi/advancedsettings.xml @@ -0,0 +1,12 @@ + + + diff --git a/projects/Generic/linux/linux.x86_64.conf b/projects/Generic/linux/linux.x86_64.conf index 65ee3980cd..f4cd927527 100644 --- a/projects/Generic/linux/linux.x86_64.conf +++ b/projects/Generic/linux/linux.x86_64.conf @@ -1,48 +1,14 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 4.9.0 Kernel Configuration +# Linux/x86_64 4.19.16 Kernel Configuration # -CONFIG_64BIT=y -CONFIG_X86_64=y -CONFIG_X86=y -CONFIG_INSTRUCTION_DECODER=y -CONFIG_OUTPUT_FORMAT="elf64-x86-64" -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=28 -CONFIG_ARCH_MMAP_RND_BITS_MAX=32 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_GENERIC_ISA_DMA=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y -CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ZONE_DMA32=y -CONFIG_AUDIT_ARCH=y -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_X86_64_SMP=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_DEBUG_RODATA=y -CONFIG_PGTABLE_LEVELS=4 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" + +# +# Compiler: gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0 +# +CONFIG_CC_IS_GCC=y +CONFIG_GCC_VERSION=70200 +CONFIG_CLANG_VERSION=0 CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y @@ -51,10 +17,10 @@ CONFIG_THREAD_INFO_IN_TASK=y # General setup # CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set +CONFIG_BUILD_SALT="" CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y @@ -74,7 +40,6 @@ CONFIG_SYSVIPC_SYSCTL=y CONFIG_POSIX_MQUEUE=y CONFIG_POSIX_MQUEUE_SYSCTL=y CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_FHANDLE=y # CONFIG_USELIB is not set # CONFIG_AUDIT is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y @@ -84,14 +49,18 @@ CONFIG_HAVE_ARCH_AUDITSYSCALL=y # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GENERIC_PENDING_IRQ=y +CONFIG_GENERIC_IRQ_MIGRATION=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_GENERIC_MSI_IRQ=y CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y +CONFIG_GENERIC_IRQ_RESERVATION_MODE=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y +# CONFIG_GENERIC_IRQ_DEBUGFS is not set CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y @@ -111,6 +80,9 @@ CONFIG_NO_HZ_IDLE=y # CONFIG_NO_HZ_FULL is not set CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set # # CPU/Task time and stats accounting @@ -118,9 +90,11 @@ CONFIG_HIGH_RES_TIMERS=y CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set +CONFIG_HAVE_SCHED_AVG_IRQ=y CONFIG_BSD_PROCESS_ACCT=y # CONFIG_BSD_PROCESS_ACCT_V3 is not set # CONFIG_TASKSTATS is not set +CONFIG_CPU_ISOLATION=y # # RCU Subsystem @@ -128,16 +102,15 @@ CONFIG_BSD_PROCESS_ACCT=y CONFIG_TREE_RCU=y # CONFIG_RCU_EXPERT is not set CONFIG_SRCU=y -# CONFIG_TASKS_RCU is not set +CONFIG_TREE_SRCU=y CONFIG_RCU_STALL_COMMON=y -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_RCU_NEED_SEGCBLIST=y CONFIG_BUILD_BIN2C=y CONFIG_IKCONFIG=m CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=16 CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -CONFIG_NMI_LOG_BUF_SHIFT=13 +CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y @@ -149,6 +122,7 @@ CONFIG_PAGE_COUNTER=y CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_MEMCG_SWAP_ENABLED=y +CONFIG_MEMCG_KMEM=y CONFIG_BLK_CGROUP=y # CONFIG_DEBUG_BLK_CGROUP is not set CONFIG_CGROUP_WRITEBACK=y @@ -157,33 +131,35 @@ CONFIG_FAIR_GROUP_SCHED=y CONFIG_CFS_BANDWIDTH=y CONFIG_RT_GROUP_SCHED=y # CONFIG_CGROUP_PIDS is not set +# CONFIG_CGROUP_RDMA is not set CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_PROC_PID_CPUSET=y CONFIG_CGROUP_DEVICE=y CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_BPF=y # CONFIG_CGROUP_DEBUG is not set -# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_SOCK_CGROUP_DATA=y CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_IPC_NS=y # CONFIG_USER_NS is not set CONFIG_PID_NS=y CONFIG_NET_NS=y +# CONFIG_CHECKPOINT_RESTORE is not set # CONFIG_SCHED_AUTOGROUP is not set # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_INITRAMFS_SOURCE="" CONFIG_RD_GZIP=y # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set +CONFIG_INITRAMFS_COMPRESSION=".gz" CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SYSCTL=y @@ -198,10 +174,8 @@ CONFIG_MULTIUSER=y # CONFIG_SGETMASK_SYSCALL is not set # CONFIG_SYSFS_SYSCALL is not set # CONFIG_SYSCTL_SYSCALL is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y -CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y CONFIG_PRINTK=y CONFIG_PRINTK_NMI=y CONFIG_BUG=y @@ -209,19 +183,27 @@ CONFIG_ELF_CORE=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_BASE_FULL=y CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y CONFIG_EPOLL=y CONFIG_SIGNALFD=y CONFIG_TIMERFD=y CONFIG_EVENTFD=y -# CONFIG_BPF_SYSCALL is not set CONFIG_SHMEM=y -# CONFIG_AIO is not set +CONFIG_AIO=y CONFIG_ADVISE_SYSCALLS=y -# CONFIG_USERFAULTFD is not set -CONFIG_PCI_QUIRKS=y CONFIG_MEMBARRIER=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y +CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_BPF_SYSCALL=y +# CONFIG_USERFAULTFD is not set +CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +CONFIG_RSEQ=y +# CONFIG_DEBUG_RSEQ is not set # CONFIG_EMBEDDED is not set CONFIG_HAVE_PERF_EVENTS=y +# CONFIG_PC104 is not set # # Kernel Performance Events And Counters @@ -230,160 +212,57 @@ CONFIG_PERF_EVENTS=y # CONFIG_DEBUG_PERF_USE_VMALLOC is not set CONFIG_VM_EVENT_COUNTERS=y CONFIG_SLUB_DEBUG=y +# CONFIG_SLUB_MEMCG_SYSFS_ON is not set # CONFIG_COMPAT_BRK is not set # CONFIG_SLAB is not set CONFIG_SLUB=y # CONFIG_SLOB is not set +CONFIG_SLAB_MERGE_DEFAULT=y # CONFIG_SLAB_FREELIST_RANDOM is not set +# CONFIG_SLAB_FREELIST_HARDENED is not set CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_DATA_VERIFICATION is not set +CONFIG_SYSTEM_DATA_VERIFICATION=y # CONFIG_PROFILING is not set -CONFIG_HAVE_OPROFILE=y -CONFIG_OPROFILE_NMI_TIMER=y -# CONFIG_KPROBES is not set -CONFIG_JUMP_LABEL=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -# CONFIG_UPROBES is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_KPROBES_ON_FTRACE=y -CONFIG_HAVE_NMI=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y -CONFIG_HAVE_USER_RETURN_NOTIFIER=y -CONFIG_HAVE_PERF_EVENTS_NMI=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP_FILTER=y -CONFIG_HAVE_GCC_PLUGINS=y -# CONFIG_GCC_PLUGINS is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_HAVE_ARCH_SOFT_DIRTY=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_ARCH_MMAP_RND_BITS=28 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8 -CONFIG_HAVE_COPY_THREAD_TLS=y -CONFIG_HAVE_STACK_VALIDATION=y -# CONFIG_HAVE_ARCH_HASH is not set -# CONFIG_ISA_BUS_API is not set -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -CONFIG_HAVE_ARCH_VMAP_STACK=y -# CONFIG_VMAP_STACK is not set - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -CONFIG_BLOCK_COMPAT=y -CONFIG_BLK_MQ_PCI=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -# CONFIG_IOSCHED_DEADLINE is not set -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -CONFIG_DEFAULT_CFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_FREEZER=y +CONFIG_TRACEPOINTS=y +CONFIG_64BIT=y +CONFIG_X86_64=y +CONFIG_X86=y +CONFIG_INSTRUCTION_DECODER=y +CONFIG_OUTPUT_FORMAT="elf64-x86-64" +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=28 +CONFIG_ARCH_MMAP_RND_BITS_MAX=32 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_FILTER_PGPROT=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ZONE_DMA32=y +CONFIG_AUDIT_ARCH=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_X86_64_SMP=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_PGTABLE_LEVELS=4 +CONFIG_CC_HAS_SANE_STACKPROTECTOR=y # # Processor type and features @@ -391,10 +270,11 @@ CONFIG_FREEZER=y CONFIG_ZONE_DMA=y CONFIG_SMP=y CONFIG_X86_FEATURE_NAMES=y -CONFIG_X86_FAST_FEATURE_TESTS=y # CONFIG_X86_X2APIC is not set CONFIG_X86_MPPARSE=y # CONFIG_GOLDFISH is not set +CONFIG_RETPOLINE=y +# CONFIG_INTEL_RDT is not set # CONFIG_X86_EXTENDED_PLATFORM is not set CONFIG_X86_INTEL_LPSS=y CONFIG_X86_AMD_PLATFORM_DEVICE=y @@ -411,6 +291,7 @@ CONFIG_KVM_GUEST=y # CONFIG_KVM_DEBUG_FS is not set CONFIG_PARAVIRT_TIME_ACCOUNTING=y CONFIG_PARAVIRT_CLOCK=y +# CONFIG_JAILHOUSE_GUEST is not set CONFIG_NO_BOOTMEM=y # CONFIG_MK8 is not set # CONFIG_MPSC is not set @@ -433,15 +314,14 @@ CONFIG_HPET_EMULATE_RTC=y CONFIG_DMI=y CONFIG_GART_IOMMU=y # CONFIG_CALGARY_IOMMU is not set -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y # CONFIG_MAXSMP is not set +CONFIG_NR_CPUS_RANGE_BEGIN=2 +CONFIG_NR_CPUS_RANGE_END=512 +CONFIG_NR_CPUS_DEFAULT=64 CONFIG_NR_CPUS=16 CONFIG_SCHED_SMT=y CONFIG_SCHED_MC=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set +CONFIG_SCHED_MC_PRIO=y CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y # CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set @@ -453,8 +333,7 @@ CONFIG_X86_IO_APIC=y CONFIG_PERF_EVENTS_INTEL_UNCORE=y CONFIG_PERF_EVENTS_INTEL_RAPL=y CONFIG_PERF_EVENTS_INTEL_CSTATE=y -# CONFIG_PERF_EVENTS_AMD_POWER is not set -# CONFIG_VM86 is not set +CONFIG_PERF_EVENTS_AMD_POWER=y CONFIG_X86_16BIT=y CONFIG_X86_ESPFIX64=y CONFIG_X86_VSYSCALL_EMULATION=y @@ -465,9 +344,10 @@ CONFIG_MICROCODE_AMD=y CONFIG_MICROCODE_OLD_INTERFACE=y CONFIG_X86_MSR=y CONFIG_X86_CPUID=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y +# CONFIG_X86_5LEVEL is not set CONFIG_X86_DIRECT_GBPAGES=y +CONFIG_ARCH_HAS_MEM_ENCRYPT=y +# CONFIG_AMD_MEM_ENCRYPT is not set CONFIG_NUMA=y # CONFIG_AMD_NUMA is not set CONFIG_X86_64_ACPI_NUMA=y @@ -479,49 +359,6 @@ CONFIG_ARCH_SPARSEMEM_DEFAULT=y CONFIG_ARCH_SELECT_MEMORY_MODEL=y CONFIG_ARCH_PROC_KCORE_TEXT=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_NEED_MULTIPLE_NODES=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -# CONFIG_MOVABLE_NODE is not set -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -# CONFIG_MEMORY_HOTPLUG is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -CONFIG_MEMORY_BALLOON=y -CONFIG_BALLOON_COMPACTION=y -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_BOUNCE=y -CONFIG_VIRT_TO_BUS=y -CONFIG_MMU_NOTIFIER=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_TRANSPARENT_HUGEPAGE=y -# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set -CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y -CONFIG_TRANSPARENT_HUGE_PAGECACHE=y -CONFIG_CLEANCACHE=y -# CONFIG_FRONTSWAP is not set -# CONFIG_CMA is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -# CONFIG_ZSMALLOC is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y -CONFIG_ARCH_HAS_PKEYS=y # CONFIG_X86_PMEM_LEGACY is not set CONFIG_X86_CHECK_BIOS_CORRUPTION=y CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y @@ -534,6 +371,7 @@ CONFIG_X86_PAT=y CONFIG_ARCH_USES_PG_UNCACHED=y CONFIG_ARCH_RANDOM=y # CONFIG_X86_SMAP is not set +CONFIG_X86_INTEL_UMIP=y # CONFIG_X86_INTEL_MPX is not set CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y CONFIG_EFI=y @@ -551,13 +389,16 @@ CONFIG_SCHED_HRTICK=y # CONFIG_CRASH_DUMP is not set CONFIG_PHYSICAL_START=0x1000000 CONFIG_RELOCATABLE=y -# CONFIG_RANDOMIZE_BASE is not set +CONFIG_RANDOMIZE_BASE=y +CONFIG_X86_NEED_RELOCS=y CONFIG_PHYSICAL_ALIGN=0x1000000 +CONFIG_DYNAMIC_MEMORY_LAYOUT=y +CONFIG_RANDOMIZE_MEMORY=y +CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING=0x0 CONFIG_HOTPLUG_CPU=y # CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set # CONFIG_DEBUG_HOTPLUG_CPU0 is not set # CONFIG_COMPAT_VDSO is not set -# CONFIG_LEGACY_VSYSCALL_NATIVE is not set CONFIG_LEGACY_VSYSCALL_EMULATE=y # CONFIG_LEGACY_VSYSCALL_NONE is not set CONFIG_CMDLINE_BOOL=y @@ -565,8 +406,11 @@ CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=-1" # CONFIG_CMDLINE_OVERRIDE is not set CONFIG_MODIFY_LDT_SYSCALL=y CONFIG_HAVE_LIVEPATCH=y +CONFIG_ARCH_HAS_ADD_PAGES=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_USE_PERCPU_NUMA_NODE_ID=y +CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y +CONFIG_ARCH_ENABLE_THP_MIGRATION=y # # Power management and ACPI options @@ -589,11 +433,14 @@ CONFIG_PM_CLK=y CONFIG_PM_GENERIC_DOMAINS=y # CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_ARCH_SUPPORTS_ACPI=y CONFIG_ACPI=y CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y # CONFIG_ACPI_DEBUGGER is not set +CONFIG_ACPI_SPCR_TABLE=y +CONFIG_ACPI_LPIT=y CONFIG_ACPI_SLEEP=y # CONFIG_ACPI_PROCFS_POWER is not set CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y @@ -603,21 +450,21 @@ CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_VIDEO=y CONFIG_ACPI_FAN=y +# CONFIG_ACPI_TAD is not set # CONFIG_ACPI_DOCK is not set CONFIG_ACPI_CPU_FREQ_PSS=y CONFIG_ACPI_PROCESSOR_CSTATE=y CONFIG_ACPI_PROCESSOR_IDLE=y +CONFIG_ACPI_CPPC_LIB=y CONFIG_ACPI_PROCESSOR=y CONFIG_ACPI_HOTPLUG_CPU=y CONFIG_ACPI_PROCESSOR_AGGREGATOR=y CONFIG_ACPI_THERMAL=y CONFIG_ACPI_NUMA=y -# CONFIG_ACPI_CUSTOM_DSDT is not set CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y CONFIG_ACPI_TABLE_UPGRADE=y # CONFIG_ACPI_DEBUG is not set # CONFIG_ACPI_PCI_SLOT is not set -CONFIG_X86_PM_TIMER=y CONFIG_ACPI_CONTAINER=y CONFIG_ACPI_HOTPLUG_IOAPIC=y # CONFIG_ACPI_SBS is not set @@ -632,6 +479,7 @@ CONFIG_HAVE_ACPI_APEI_NMI=y # CONFIG_DPTF_POWER is not set # CONFIG_PMIC_OPREGION is not set # CONFIG_ACPI_CONFIGFS is not set +CONFIG_X86_PM_TIMER=y # CONFIG_SFI is not set # @@ -641,7 +489,6 @@ CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set @@ -678,14 +525,8 @@ CONFIG_X86_SPEEDSTEP_LIB=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set CONFIG_INTEL_IDLE=y -# -# Memory power savings -# -# CONFIG_I7300_IDLE is not set - # # Bus options (PCI etc.) # @@ -693,26 +534,27 @@ CONFIG_PCI=y CONFIG_PCI_DIRECT=y CONFIG_PCI_MMCONFIG=y CONFIG_PCI_DOMAINS=y +CONFIG_MMCONF_FAM10H=y # CONFIG_PCI_CNB20LE_QUIRK is not set CONFIG_PCIEPORTBUS=y CONFIG_PCIEAER=y -# CONFIG_PCIE_ECRC is not set # CONFIG_PCIEAER_INJECT is not set +# CONFIG_PCIE_ECRC is not set CONFIG_PCIEASPM=y # CONFIG_PCIEASPM_DEBUG is not set CONFIG_PCIEASPM_DEFAULT=y # CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set # CONFIG_PCIEASPM_PERFORMANCE is not set CONFIG_PCIE_PME=y # CONFIG_PCIE_DPC is not set # CONFIG_PCIE_PTM is not set -CONFIG_PCI_BUS_ADDR_T_64BIT=y CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PCI_QUIRKS=y # CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set # CONFIG_PCI_STUB is not set -CONFIG_HT_IRQ=y +CONFIG_PCI_LOCKLESS_CONFIG=y # CONFIG_PCI_IOV is not set # CONFIG_PCI_PRI is not set # CONFIG_PCI_PASID is not set @@ -720,10 +562,28 @@ CONFIG_PCI_LABEL=y # CONFIG_HOTPLUG_PCI is not set # -# PCI host controller drivers +# PCI controller drivers +# + +# +# Cadence PCIe controllers support # -# CONFIG_PCIE_DW_PLAT is not set # CONFIG_VMD is not set + +# +# DesignWare PCI Core Support +# +# CONFIG_PCIE_DW_PLAT_HOST is not set + +# +# PCI Endpoint +# +# CONFIG_PCI_ENDPOINT is not set + +# +# PCI switch controller drivers +# +# CONFIG_PCI_SW_SWITCHTEC is not set # CONFIG_ISA_BUS is not set CONFIG_ISA_DMA_API=y CONFIG_AMD_NB=y @@ -732,185 +592,473 @@ CONFIG_AMD_NB=y # CONFIG_X86_SYSFB is not set # -# Executable file formats / Emulations +# Binary Emulations # -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_ELFCORE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_COREDUMP=y CONFIG_IA32_EMULATION=y # CONFIG_IA32_AOUT is not set # CONFIG_X86_X32 is not set +CONFIG_COMPAT_32=y CONFIG_COMPAT=y CONFIG_COMPAT_FOR_U64_ALIGNMENT=y CONFIG_SYSVIPC_COMPAT=y -CONFIG_KEYS_COMPAT=y CONFIG_X86_DEV_DMA_OPS=y -CONFIG_PMC_ATOM=y -CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y +CONFIG_HAVE_GENERIC_GUP=y # -# Networking options +# Firmware Drivers # -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_NET_UDP_TUNNEL is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_NETWORK_SECMARK is not set -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=m +# CONFIG_EDD is not set +CONFIG_FIRMWARE_MEMMAP=y +# CONFIG_DELL_RBU is not set +# CONFIG_DCDBAS is not set +CONFIG_DMIID=y +CONFIG_DMI_SYSFS=m +CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y +CONFIG_ISCSI_IBFT_FIND=y +CONFIG_ISCSI_IBFT=y +# CONFIG_FW_CFG_SYSFS is not set +# CONFIG_GOOGLE_FIRMWARE is not set # -# Core Netfilter Configuration +# EFI (Extensible Firmware Interface) Support # -# CONFIG_NETFILTER_INGRESS is not set -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_NAT_REDIRECT is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m +CONFIG_EFI_VARS=y +CONFIG_EFI_ESRT=y +# CONFIG_EFI_FAKE_MEMMAP is not set +CONFIG_EFI_RUNTIME_WRAPPERS=y +# CONFIG_EFI_BOOTLOADER_CONTROL is not set +# CONFIG_EFI_CAPSULE_LOADER is not set +# CONFIG_EFI_TEST is not set +CONFIG_APPLE_PROPERTIES=y +# CONFIG_RESET_ATTACK_MITIGATION is not set +CONFIG_EFI_DEV_PATH_PARSER=y # -# Xtables combined modules +# Tegra firmware driver # -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set +CONFIG_HAVE_KVM=y +# CONFIG_VIRTUALIZATION is not set # -# Xtables targets +# General architecture-dependent options # -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -CONFIG_NETFILTER_XT_NAT=m -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set +CONFIG_CRASH_CORE=y +CONFIG_HOTPLUG_SMT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_OPROFILE_NMI_TIMER=y +CONFIG_KPROBES=y +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +CONFIG_OPTPROBES=y +CONFIG_KPROBES_ON_FTRACE=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_KRETPROBES=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_KPROBES_ON_FTRACE=y +CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y +CONFIG_HAVE_NMI=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y +CONFIG_HAVE_USER_RETURN_NOTIFIER=y +CONFIG_HAVE_PERF_EVENTS_NMI=y +CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_RCU_TABLE_FREE=y +CONFIG_HAVE_RCU_TABLE_INVALIDATE=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_STACKPROTECTOR=y +CONFIG_CC_HAS_STACKPROTECTOR_NONE=y +CONFIG_STACKPROTECTOR=y +CONFIG_STACKPROTECTOR_STRONG=y +CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y +CONFIG_HAVE_ARCH_HUGE_VMAP=y +CONFIG_HAVE_ARCH_SOFT_DIRTY=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_HAVE_EXIT_THREAD=y +CONFIG_ARCH_MMAP_RND_BITS=28 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8 +CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES=y +CONFIG_HAVE_COPY_THREAD_TLS=y +CONFIG_HAVE_STACK_VALIDATION=y +CONFIG_HAVE_RELIABLE_STACKTRACE=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_HAVE_ARCH_VMAP_STACK=y +# CONFIG_VMAP_STACK is not set +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_STRICT_MODULE_RWX=y +CONFIG_ARCH_HAS_REFCOUNT=y +# CONFIG_REFCOUNT_FULL is not set +CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y # -# Xtables matches +# GCOV-based kernel profiling # -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_PLUGIN_HOSTCC="" +CONFIG_HAVE_GCC_PLUGINS=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +# CONFIG_TRIM_UNUSED_KSYMS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_ZONED is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set +# CONFIG_BLK_WBT is not set +# CONFIG_BLK_CGROUP_IOLATENCY is not set +CONFIG_BLK_DEBUG_FS=y +# CONFIG_BLK_SED_OPAL is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set +CONFIG_BLOCK_COMPAT=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_MQ_VIRTIO=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_DEADLINE is not set +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +CONFIG_IOSCHED_BFQ=y +# CONFIG_BFQ_GROUP_IOSCHED is not set +CONFIG_ASN1=y +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y +CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y +CONFIG_FREEZER=y + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_ELFCORE=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +CONFIG_BINFMT_MISC=y +CONFIG_COREDUMP=y + +# +# Memory Management options +# +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_NEED_MULTIPLE_NODES=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +# CONFIG_MEMORY_HOTPLUG is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_MEMORY_BALLOON=y +CONFIG_BALLOON_COMPACTION=y +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_BOUNCE=y +CONFIG_VIRT_TO_BUS=y +CONFIG_MMU_NOTIFIER=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_TRANSPARENT_HUGEPAGE=y +# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set +CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y +CONFIG_ARCH_WANTS_THP_SWAP=y +CONFIG_THP_SWAP=y +CONFIG_TRANSPARENT_HUGE_PAGECACHE=y +CONFIG_CLEANCACHE=y +# CONFIG_FRONTSWAP is not set +# CONFIG_CMA is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_ARCH_HAS_ZONE_DEVICE=y +CONFIG_FRAME_VECTOR=y +CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y +CONFIG_ARCH_HAS_PKEYS=y +# CONFIG_PERCPU_STATS is not set +# CONFIG_GUP_BENCHMARK is not set +CONFIG_ARCH_HAS_PTE_SPECIAL=y +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_TLS is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +# CONFIG_XDP_SOCKETS is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +# CONFIG_IP_ROUTE_VERBOSE is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE_COMMON=y +CONFIG_IP_MROUTE=y +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_WESTWOOD is not set +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +# CONFIG_TCP_CONG_HYBLA is not set +CONFIG_TCP_CONG_VEGAS=m +# CONFIG_TCP_CONG_NV is not set +CONFIG_TCP_CONG_SCALABLE=m +# CONFIG_TCP_CONG_LP is not set +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +# CONFIG_TCP_CONG_DCTCP is not set +CONFIG_TCP_CONG_CDG=m +# CONFIG_TCP_CONG_BBR is not set +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_IPV6_SEG6_LWTUNNEL is not set +# CONFIG_IPV6_SEG6_HMAC is not set +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_FAMILY_BRIDGE=y +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +# CONFIG_NETFILTER_NETLINK_OSF is not set +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_LOG_NETDEV is not set +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_ZONES is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CONNTRACK_LABELS is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set # CONFIG_NETFILTER_XT_MATCH_DSCP is not set # CONFIG_NETFILTER_XT_MATCH_ECN is not set # CONFIG_NETFILTER_XT_MATCH_ESP is not set @@ -949,15 +1097,14 @@ CONFIG_NETFILTER_XT_MATCH_STATE=m # IP: Netfilter Configuration # CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_SOCKET_IPV4 is not set +# CONFIG_NF_TPROXY_IPV4 is not set # CONFIG_NF_DUP_IPV4 is not set # CONFIG_NF_LOG_ARP is not set # CONFIG_NF_LOG_IPV4 is not set CONFIG_NF_REJECT_IPV4=m CONFIG_NF_NAT_IPV4=m -CONFIG_NF_NAT_MASQUERADE_IPV4=m -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set +CONFIG_NF_NAT_MASQUERADE_IPV4=y CONFIG_IP_NF_IPTABLES=m # CONFIG_IP_NF_MATCH_AH is not set # CONFIG_IP_NF_MATCH_ECN is not set @@ -980,13 +1127,12 @@ CONFIG_IP_NF_MANGLE=m # # IPv6: Netfilter Configuration # -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m +# CONFIG_NF_SOCKET_IPV6 is not set +# CONFIG_NF_TPROXY_IPV6 is not set # CONFIG_NF_DUP_IPV6 is not set CONFIG_NF_REJECT_IPV6=m # CONFIG_NF_LOG_IPV6 is not set CONFIG_NF_NAT_IPV6=m -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set CONFIG_IP6_NF_IPTABLES=m # CONFIG_IP6_NF_MATCH_AH is not set # CONFIG_IP6_NF_MATCH_EUI64 is not set @@ -997,6 +1143,7 @@ CONFIG_IP6_NF_IPTABLES=m # CONFIG_IP6_NF_MATCH_MH is not set # CONFIG_IP6_NF_MATCH_RPFILTER is not set # CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_MATCH_SRH is not set # CONFIG_IP6_NF_TARGET_HL is not set CONFIG_IP6_NF_FILTER=m CONFIG_IP6_NF_TARGET_REJECT=m @@ -1006,7 +1153,9 @@ CONFIG_IP6_NF_MANGLE=m CONFIG_IP6_NF_NAT=m # CONFIG_IP6_NF_TARGET_MASQUERADE is not set # CONFIG_IP6_NF_TARGET_NPT is not set +CONFIG_NF_DEFRAG_IPV6=m # CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_BPFILTER is not set # CONFIG_IP_DCCP is not set # CONFIG_IP_SCTP is not set # CONFIG_RDS is not set @@ -1018,20 +1167,71 @@ CONFIG_BRIDGE=m CONFIG_BRIDGE_IGMP_SNOOPING=y # CONFIG_BRIDGE_VLAN_FILTERING is not set CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set CONFIG_VLAN_8021Q=m # CONFIG_VLAN_8021Q_GVRP is not set # CONFIG_VLAN_8021Q_MVRP is not set # CONFIG_DECNET is not set CONFIG_LLC=m # CONFIG_LLC2 is not set -# CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_PHONET is not set # CONFIG_6LOWPAN is not set # CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_CBS is not set +# CONFIG_NET_SCH_ETF is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_SKBPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_CAKE is not set +# CONFIG_NET_SCH_FQ is not set +# CONFIG_NET_SCH_HHF is not set +# CONFIG_NET_SCH_PIE is not set +# CONFIG_NET_SCH_PLUG is not set +# CONFIG_NET_SCH_DEFAULT is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_CLS_BPF is not set +# CONFIG_NET_CLS_FLOWER is not set +# CONFIG_NET_CLS_MATCHALL is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y # CONFIG_DCB is not set CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set @@ -1039,6 +1239,7 @@ CONFIG_DNS_RESOLVER=y # CONFIG_VSOCKETS is not set # CONFIG_NETLINK_DIAG is not set # CONFIG_MPLS is not set +# CONFIG_NET_NSH is not set # CONFIG_HSR is not set # CONFIG_NET_SWITCHDEV is not set # CONFIG_NET_L3_MASTER_DEV is not set @@ -1046,21 +1247,21 @@ CONFIG_DNS_RESOLVER=y CONFIG_RPS=y CONFIG_RFS_ACCEL=y CONFIG_XPS=y -# CONFIG_SOCK_CGROUP_DATA is not set # CONFIG_CGROUP_NET_PRIO is not set # CONFIG_CGROUP_NET_CLASSID is not set CONFIG_NET_RX_BUSY_POLL=y CONFIG_BQL=y # CONFIG_BPF_JIT is not set +# CONFIG_BPF_STREAM_PARSER is not set CONFIG_NET_FLOW_LIMIT=y # # Network testing # # CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set # CONFIG_HAMRADIO is not set # CONFIG_CAN is not set -# CONFIG_IRDA is not set CONFIG_BT=m CONFIG_BT_BREDR=y CONFIG_BT_RFCOMM=m @@ -1081,19 +1282,37 @@ CONFIG_BT_LE=y CONFIG_BT_INTEL=m CONFIG_BT_BCM=m CONFIG_BT_RTL=m +CONFIG_BT_QCA=m CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTUSB_AUTOSUSPEND=y CONFIG_BT_HCIBTUSB_BCM=y CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_MRVL is not set +CONFIG_BT_HCIBTSDIO=m +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_SERDEV=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_NOKIA is not set +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_LL=y +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIUART_INTEL=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HCIUART_RTL=y +CONFIG_BT_HCIUART_QCA=y +CONFIG_BT_HCIUART_AG6XX=y +CONFIG_BT_HCIUART_MRVL=y +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m +CONFIG_BT_HCIVHCI=m +CONFIG_BT_MRVL=m +CONFIG_BT_MRVL_SDIO=m CONFIG_BT_ATH3K=m +CONFIG_BT_MTKUART=m # CONFIG_AF_RXRPC is not set # CONFIG_AF_KCM is not set -# CONFIG_STREAM_PARSER is not set +CONFIG_FIB_RULES=y CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -1104,9 +1323,10 @@ CONFIG_CFG80211=m # CONFIG_NL80211_TESTMODE is not set # CONFIG_CFG80211_DEVELOPER_WARNINGS is not set # CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y +CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y CONFIG_CFG80211_DEFAULT_PS=y # CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_INTERNAL_REGDB=y # CONFIG_CFG80211_CRDA_SUPPORT is not set CONFIG_CFG80211_WEXT=y CONFIG_CFG80211_WEXT_EXPORT=y @@ -1137,10 +1357,14 @@ CONFIG_RFKILL_INPUT=y # CONFIG_CAIF is not set # CONFIG_CEPH_LIB is not set # CONFIG_NFC is not set +# CONFIG_PSAMPLE is not set +# CONFIG_NET_IFE is not set # CONFIG_LWTUNNEL is not set CONFIG_DST_CACHE=y +CONFIG_GRO_CELLS=y # CONFIG_NET_DEVLINK is not set CONFIG_MAY_USE_DEVLINK=y +CONFIG_FAILOVER=y CONFIG_HAVE_EBPF_JIT=y # @@ -1155,29 +1379,33 @@ CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_STANDALONE=y # CONFIG_PREVENT_FIRMWARE_BUILD is not set + +# +# Firmware loader +# CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_EXTRA_FIRMWARE="" CONFIG_EXTRA_FIRMWARE_DIR="external-firmware" -# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +# CONFIG_FW_LOADER_USER_HELPER is not set CONFIG_WANT_DEV_COREDUMP=y # CONFIG_ALLOW_DEV_COREDUMP is not set # CONFIG_DEBUG_DRIVER is not set # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set +# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_FENCE_TRACE is not set +# CONFIG_DMA_FENCE_TRACE is not set # # Bus devices # CONFIG_CONNECTOR=y CONFIG_PROC_EVENTS=y +# CONFIG_GNSS is not set # CONFIG_MTD is not set # CONFIG_OF is not set CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y @@ -1192,11 +1420,10 @@ CONFIG_PNPACPI=y CONFIG_BLK_DEV=y # CONFIG_BLK_DEV_NULL_BLK is not set # CONFIG_BLK_DEV_FD is not set +CONFIG_CDROM=y # CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 # CONFIG_BLK_DEV_CRYPTOLOOP is not set @@ -1210,17 +1437,22 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set CONFIG_VIRTIO_BLK=y -# CONFIG_BLK_DEV_HD is not set +# CONFIG_VIRTIO_BLK_SCSI is not set # CONFIG_BLK_DEV_RBD is not set # CONFIG_BLK_DEV_RSXX is not set + +# +# NVME Support +# CONFIG_NVME_CORE=y CONFIG_BLK_DEV_NVME=y -# CONFIG_BLK_DEV_NVME_SCSI is not set +CONFIG_NVME_MULTIPATH=y +# CONFIG_NVME_FC is not set +# CONFIG_NVME_TARGET is not set # # Misc devices # -# CONFIG_SENSORS_LIS3LV02D is not set # CONFIG_AD525X_DPOT is not set # CONFIG_DUMMY_IRQ is not set # CONFIG_IBM_ASM is not set @@ -1240,6 +1472,8 @@ CONFIG_BLK_DEV_NVME=y # CONFIG_DS1682 is not set # CONFIG_USB_SWITCH_FSA9480 is not set # CONFIG_SRAM is not set +# CONFIG_PCI_ENDPOINT_TEST is not set +CONFIG_MISC_RTSX=y # CONFIG_C2PORT is not set # @@ -1249,6 +1483,7 @@ CONFIG_BLK_DEV_NVME=y # CONFIG_EEPROM_LEGACY is not set # CONFIG_EEPROM_MAX6875 is not set CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_IDT_89HPESX is not set # CONFIG_CB710_CORE is not set # @@ -1256,16 +1491,16 @@ CONFIG_EEPROM_93CX6=m # # CONFIG_TI_ST is not set # CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# CONFIG_ALTERA_STAPL=m # CONFIG_INTEL_MEI is not set # CONFIG_INTEL_MEI_ME is not set # CONFIG_INTEL_MEI_TXE is not set # CONFIG_VMWARE_VMCI is not set +# +# Intel MIC & related support +# + # # Intel MIC Bus Driver # @@ -1302,8 +1537,8 @@ CONFIG_ALTERA_STAPL=m # # CONFIG_GENWQE is not set # CONFIG_ECHO is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set +CONFIG_MISC_RTSX_PCI=y +CONFIG_MISC_RTSX_USB=y CONFIG_HAVE_IDE=y # CONFIG_IDE is not set @@ -1314,7 +1549,6 @@ CONFIG_SCSI_MOD=y # CONFIG_RAID_ATTRS is not set CONFIG_SCSI=y CONFIG_SCSI_DMA=y -# CONFIG_SCSI_NETLINK is not set # CONFIG_SCSI_MQ_DEFAULT is not set # CONFIG_SCSI_PROC_FS is not set @@ -1379,8 +1613,6 @@ CONFIG_MEGARAID_SAS=y # CONFIG_VMWARE_PVSCSI is not set # CONFIG_SCSI_SNIC is not set # CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_GDTH is not set # CONFIG_SCSI_ISCI is not set # CONFIG_SCSI_IPS is not set @@ -1401,7 +1633,6 @@ CONFIG_MEGARAID_SAS=y # CONFIG_SCSI_DH is not set # CONFIG_SCSI_OSD_INITIATOR is not set CONFIG_ATA=y -# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_VERBOSE_ERROR is not set CONFIG_ATA_ACPI=y # CONFIG_SATA_ZPODD is not set @@ -1411,6 +1642,7 @@ CONFIG_SATA_PMP=y # Controllers with non-SFF native interface # CONFIG_SATA_AHCI=y +CONFIG_SATA_MOBILE_LPM_POLICY=0 CONFIG_SATA_AHCI_PLATFORM=y # CONFIG_SATA_INIC162X is not set # CONFIG_SATA_ACARD_AHCI is not set @@ -1516,9 +1748,11 @@ CONFIG_NET_CORE=y # CONFIG_NET_TEAM is not set CONFIG_MACVLAN=m # CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set # CONFIG_VXLAN is not set # CONFIG_MACSEC is not set CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETPOLL=y CONFIG_NET_POLL_CONTROLLER=y CONFIG_TUN=y @@ -1542,6 +1776,7 @@ CONFIG_VORTEX=y # CONFIG_TYPHOON is not set # CONFIG_NET_VENDOR_ADAPTEC is not set # CONFIG_NET_VENDOR_AGERE is not set +# CONFIG_NET_VENDOR_ALACRITECH is not set # CONFIG_NET_VENDOR_ALTEON is not set # CONFIG_ALTERA_TSE is not set CONFIG_NET_VENDOR_AMAZON=y @@ -1549,6 +1784,9 @@ CONFIG_NET_VENDOR_AMAZON=y CONFIG_NET_VENDOR_AMD=y # CONFIG_AMD8111_ETH is not set CONFIG_PCNET32=y +# CONFIG_AMD_XGBE is not set +CONFIG_NET_VENDOR_AQUANTIA=y +# CONFIG_AQTION is not set CONFIG_NET_VENDOR_ARC=y CONFIG_NET_VENDOR_ATHEROS=y CONFIG_ATL2=y @@ -1557,7 +1795,6 @@ CONFIG_ATL1E=y CONFIG_ATL1C=y CONFIG_ALX=y # CONFIG_NET_VENDOR_AURORA is not set -# CONFIG_NET_CADENCE is not set CONFIG_NET_VENDOR_BROADCOM=y CONFIG_B44=y CONFIG_B44_PCI_AUTOSELECT=y @@ -1567,17 +1804,23 @@ CONFIG_B44_PCI=y CONFIG_BNX2=y CONFIG_CNIC=y CONFIG_TIGON3=y +CONFIG_TIGON3_HWMON=y # CONFIG_BNX2X is not set +# CONFIG_SYSTEMPORT is not set # CONFIG_BNXT is not set # CONFIG_NET_VENDOR_BROCADE is not set +# CONFIG_NET_VENDOR_CADENCE is not set CONFIG_NET_VENDOR_CAVIUM=y # CONFIG_THUNDER_NIC_PF is not set # CONFIG_THUNDER_NIC_VF is not set # CONFIG_THUNDER_NIC_BGX is not set # CONFIG_THUNDER_NIC_RGX is not set +# CONFIG_CAVIUM_PTP is not set # CONFIG_LIQUIDIO is not set +# CONFIG_LIQUIDIO_VF is not set # CONFIG_NET_VENDOR_CHELSIO is not set # CONFIG_NET_VENDOR_CISCO is not set +# CONFIG_NET_VENDOR_CORTINA is not set # CONFIG_CX_ECAT is not set # CONFIG_DNET is not set CONFIG_NET_VENDOR_DEC=y @@ -1591,8 +1834,9 @@ CONFIG_ULI526X=y # CONFIG_NET_VENDOR_DLINK is not set # CONFIG_NET_VENDOR_EMULEX is not set CONFIG_NET_VENDOR_EZCHIP=y -# CONFIG_NET_VENDOR_EXAR is not set # CONFIG_NET_VENDOR_HP is not set +# CONFIG_NET_VENDOR_HUAWEI is not set +CONFIG_NET_VENDOR_I825XX=y CONFIG_NET_VENDOR_INTEL=y CONFIG_E100=y CONFIG_E1000=y @@ -1607,12 +1851,11 @@ CONFIG_IXGBE_HWMON=y # CONFIG_IXGBEVF is not set # CONFIG_I40E is not set # CONFIG_I40EVF is not set +CONFIG_ICE=y # CONFIG_FM10K is not set -CONFIG_NET_VENDOR_I825XX=y CONFIG_JME=y CONFIG_NET_VENDOR_MARVELL=y # CONFIG_MVMDIO is not set -# CONFIG_MVNETA_BM is not set CONFIG_SKGE=y # CONFIG_SKGE_DEBUG is not set CONFIG_SKGE_GENESIS=y @@ -1620,16 +1863,19 @@ CONFIG_SKY2=y # CONFIG_SKY2_DEBUG is not set # CONFIG_NET_VENDOR_MELLANOX is not set # CONFIG_NET_VENDOR_MICREL is not set +CONFIG_NET_VENDOR_MICROSEMI=y # CONFIG_NET_VENDOR_MYRI is not set # CONFIG_FEALNX is not set # CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NETERION is not set CONFIG_NET_VENDOR_NETRONOME=y -# CONFIG_NFP_NETVF is not set +# CONFIG_NFP is not set +# CONFIG_NET_VENDOR_NI is not set CONFIG_NET_VENDOR_NVIDIA=y CONFIG_FORCEDETH=y # CONFIG_NET_VENDOR_OKI is not set # CONFIG_ETHOC is not set -# CONFIG_NET_PACKET_ENGINE is not set +# CONFIG_NET_VENDOR_PACKET_ENGINES is not set CONFIG_NET_VENDOR_QLOGIC=y CONFIG_QLA3XXX=y # CONFIG_QLCNIC is not set @@ -1637,6 +1883,7 @@ CONFIG_QLA3XXX=y # CONFIG_NETXEN_NIC is not set # CONFIG_QED is not set # CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RDC is not set CONFIG_NET_VENDOR_REALTEK=y # CONFIG_8139CP is not set CONFIG_8139TOO=y @@ -1646,19 +1893,20 @@ CONFIG_8139TOO=y # CONFIG_8139_OLD_RX_RESET is not set CONFIG_R8169=y CONFIG_NET_VENDOR_RENESAS=y -# CONFIG_NET_VENDOR_RDC is not set CONFIG_NET_VENDOR_ROCKER=y # CONFIG_NET_VENDOR_SAMSUNG is not set # CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SOLARFLARE is not set # CONFIG_NET_VENDOR_SILAN is not set CONFIG_NET_VENDOR_SIS=y CONFIG_SIS900=y CONFIG_SIS190=y -# CONFIG_SFC is not set # CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_SOCIONEXT is not set # CONFIG_NET_VENDOR_STMICRO is not set # CONFIG_NET_VENDOR_SUN is not set CONFIG_NET_VENDOR_SYNOPSYS=y +# CONFIG_DWC_XLGMAC is not set # CONFIG_NET_VENDOR_TEHUTI is not set # CONFIG_NET_VENDOR_TI is not set CONFIG_NET_VENDOR_VIA=y @@ -1669,28 +1917,31 @@ CONFIG_VIA_VELOCITY=y # CONFIG_FDDI is not set # CONFIG_HIPPI is not set # CONFIG_NET_SB1000 is not set -CONFIG_PHYLIB=y - -# -# MDIO bus device drivers -# +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_BUS=y # CONFIG_MDIO_BCM_UNIMAC is not set # CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_OCTEON is not set +# CONFIG_MDIO_MSCC_MIIM is not set # CONFIG_MDIO_THUNDER is not set +CONFIG_PHYLIB=y +# CONFIG_LED_TRIGGER_PHY is not set # # MII PHY device drivers # CONFIG_AMD_PHY=y # CONFIG_AQUANTIA_PHY is not set +# CONFIG_ASIX_PHY is not set CONFIG_AT803X_PHY=y # CONFIG_BCM7XXX_PHY is not set # CONFIG_BCM87XX_PHY is not set CONFIG_BCM_NET_PHYLIB=y CONFIG_BROADCOM_PHY=y # CONFIG_CICADA_PHY is not set +# CONFIG_CORTINA_PHY is not set # CONFIG_DAVICOM_PHY is not set +# CONFIG_DP83822_PHY is not set +# CONFIG_DP83TC811_PHY is not set # CONFIG_DP83848_PHY is not set # CONFIG_DP83867_PHY is not set # CONFIG_FIXED_PHY is not set @@ -1699,12 +1950,16 @@ CONFIG_BROADCOM_PHY=y # CONFIG_LSI_ET1011C_PHY is not set # CONFIG_LXT_PHY is not set CONFIG_MARVELL_PHY=y +# CONFIG_MARVELL_10G_PHY is not set # CONFIG_MICREL_PHY is not set # CONFIG_MICROCHIP_PHY is not set +# CONFIG_MICROCHIP_T1_PHY is not set # CONFIG_MICROSEMI_PHY is not set # CONFIG_NATIONAL_PHY is not set # CONFIG_QSEMI_PHY is not set CONFIG_REALTEK_PHY=y +# CONFIG_RENESAS_PHY is not set +# CONFIG_ROCKCHIP_PHY is not set # CONFIG_SMSC_PHY is not set # CONFIG_STE10XP is not set # CONFIG_TERANETICS_PHY is not set @@ -1758,6 +2013,7 @@ CONFIG_USB_IPHETH=m # CONFIG_USB_VL600 is not set # CONFIG_USB_NET_CH9200 is not set CONFIG_WLAN=y +# CONFIG_WIRELESS_WDS is not set CONFIG_WLAN_VENDOR_ADMTEK=y # CONFIG_ADM8211 is not set CONFIG_ATH_COMMON=m @@ -1765,6 +2021,7 @@ CONFIG_WLAN_VENDOR_ATH=y # CONFIG_ATH_DEBUG is not set CONFIG_ATH5K=m # CONFIG_ATH5K_DEBUG is not set +# CONFIG_ATH5K_TRACER is not set CONFIG_ATH5K_PCI=y CONFIG_ATH9K_HW=m CONFIG_ATH9K_COMMON=m @@ -1776,7 +2033,7 @@ CONFIG_ATH9K_AHB=y # CONFIG_ATH9K_DYNACK is not set # CONFIG_ATH9K_WOW is not set CONFIG_ATH9K_RFKILL=y -# CONFIG_ATH9K_CHANNEL_CONTEXT is not set +CONFIG_ATH9K_CHANNEL_CONTEXT=y CONFIG_ATH9K_PCOEM=y CONFIG_ATH9K_HTC=m # CONFIG_ATH9K_HTC_DEBUGFS is not set @@ -1789,9 +2046,17 @@ CONFIG_ATH6KL=m # CONFIG_ATH6KL_SDIO is not set CONFIG_ATH6KL_USB=m # CONFIG_ATH6KL_DEBUG is not set +# CONFIG_ATH6KL_TRACING is not set CONFIG_AR5523=m # CONFIG_WIL6210 is not set -# CONFIG_ATH10K is not set +CONFIG_ATH10K=m +CONFIG_ATH10K_CE=y +CONFIG_ATH10K_PCI=m +# CONFIG_ATH10K_SDIO is not set +CONFIG_ATH10K_USB=m +# CONFIG_ATH10K_DEBUG is not set +# CONFIG_ATH10K_DEBUGFS is not set +# CONFIG_ATH10K_TRACING is not set CONFIG_WCN36XX=m # CONFIG_WCN36XX_DEBUGFS is not set CONFIG_WLAN_VENDOR_ATMEL=y @@ -1806,7 +2071,7 @@ CONFIG_BRCMUTIL=m CONFIG_BRCMFMAC=m CONFIG_BRCMFMAC_PROTO_BCDC=y CONFIG_BRCMFMAC_PROTO_MSGBUF=y -# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_SDIO=y CONFIG_BRCMFMAC_USB=y CONFIG_BRCMFMAC_PCIE=y # CONFIG_BRCM_TRACING is not set @@ -1845,6 +2110,7 @@ CONFIG_IWLWIFI_OPMODE_MODULAR=y # Debugging Options # # CONFIG_IWLWIFI_DEBUG is not set +CONFIG_IWLWIFI_DEVICE_TRACING=y CONFIG_WLAN_VENDOR_INTERSIL=y CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y @@ -1870,6 +2136,13 @@ CONFIG_LIBERTAS_THINFIRM_USB=m # CONFIG_MWL8K is not set CONFIG_WLAN_VENDOR_MEDIATEK=y CONFIG_MT7601U=m +CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y +CONFIG_MT76_USB=m +CONFIG_MT76x2_COMMON=m +CONFIG_MT76x0U=m +CONFIG_MT76x2E=m +CONFIG_MT76x2U=m CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2400PCI=m @@ -1919,8 +2192,7 @@ CONFIG_RTLWIFI_PCI=m CONFIG_RTL8192C_COMMON=m CONFIG_RTL8723_COMMON=m CONFIG_RTLBTCOEXIST=m -CONFIG_RTL8XXXU=m -CONFIG_RTL8XXXU_UNTESTED=y +# CONFIG_RTL8XXXU is not set CONFIG_WLAN_VENDOR_RSI=y # CONFIG_RSI_91X is not set CONFIG_WLAN_VENDOR_ST=y @@ -1934,6 +2206,7 @@ CONFIG_WLAN_VENDOR_ZYDAS=y CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set # CONFIG_MAC80211_HWSIM is not set CONFIG_USB_NET_RNDIS_WLAN=m @@ -1943,6 +2216,9 @@ CONFIG_USB_NET_RNDIS_WLAN=m # CONFIG_WAN is not set # CONFIG_VMXNET3 is not set # CONFIG_FUJITSU_ES is not set +# CONFIG_THUNDERBOLT_NET is not set +# CONFIG_NETDEVSIM is not set +CONFIG_NET_FAILOVER=y # CONFIG_ISDN is not set # CONFIG_NVM is not set @@ -1976,6 +2252,7 @@ CONFIG_INPUT_KEYBOARD=y CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_QT1070 is not set # CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_DLINK_DIR685 is not set # CONFIG_KEYBOARD_LKKBD is not set # CONFIG_KEYBOARD_GPIO is not set # CONFIG_KEYBOARD_GPIO_POLLED is not set @@ -1992,6 +2269,7 @@ CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_SAMSUNG is not set # CONFIG_KEYBOARD_STOWAWAY is not set # CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set # CONFIG_KEYBOARD_XTKBD is not set CONFIG_INPUT_MOUSE=y CONFIG_MOUSE_PS2=y @@ -1999,6 +2277,7 @@ CONFIG_MOUSE_PS2_ALPS=y CONFIG_MOUSE_PS2_BYD=y CONFIG_MOUSE_PS2_LOGIPS2PP=y CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y CONFIG_MOUSE_PS2_CYPRESS=y CONFIG_MOUSE_PS2_LIFEBOOK=y CONFIG_MOUSE_PS2_TRACKPOINT=y @@ -2007,6 +2286,7 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set # CONFIG_MOUSE_PS2_FOCALTECH is not set # CONFIG_MOUSE_PS2_VMMOUSE is not set +CONFIG_MOUSE_PS2_SMBUS=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_APPLETOUCH is not set # CONFIG_MOUSE_BCM5974 is not set @@ -2041,6 +2321,7 @@ CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=m CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_JOYSTICK_PXRC is not set # CONFIG_INPUT_TABLET is not set CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_PROPERTIES=y @@ -2048,6 +2329,8 @@ CONFIG_TOUCHSCREEN_PROPERTIES=y # CONFIG_TOUCHSCREEN_ATMEL_MXT is not set # CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set # CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_BU21029 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8505 is not set # CONFIG_TOUCHSCREEN_CY8CTMG110 is not set # CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set # CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set @@ -2055,9 +2338,12 @@ CONFIG_TOUCHSCREEN_PROPERTIES=y # CONFIG_TOUCHSCREEN_HAMPSHIRE is not set # CONFIG_TOUCHSCREEN_EETI is not set # CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set +# CONFIG_TOUCHSCREEN_EXC3000 is not set # CONFIG_TOUCHSCREEN_FUJITSU is not set # CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_HIDEEP is not set # CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_S6SY761 is not set # CONFIG_TOUCHSCREEN_GUNZE is not set # CONFIG_TOUCHSCREEN_EKTF2127 is not set CONFIG_TOUCHSCREEN_ELAN=y @@ -2105,9 +2391,11 @@ CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y # CONFIG_TOUCHSCREEN_SILEAD is not set # CONFIG_TOUCHSCREEN_SIS_I2C is not set CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_STMFTS is not set # CONFIG_TOUCHSCREEN_SUR40 is not set # CONFIG_TOUCHSCREEN_SX8654 is not set # CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZET6223 is not set # CONFIG_TOUCHSCREEN_ZFORCE is not set # CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set CONFIG_INPUT_MISC=y @@ -2115,11 +2403,9 @@ CONFIG_INPUT_MISC=y # CONFIG_INPUT_BMA150 is not set # CONFIG_INPUT_E3X0_BUTTON is not set # CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set # CONFIG_INPUT_APANEL is not set # CONFIG_INPUT_GP2A is not set # CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set # CONFIG_INPUT_GPIO_DECODER is not set # CONFIG_INPUT_ATLAS_BTNS is not set CONFIG_INPUT_ATI_REMOTE2=m @@ -2128,6 +2414,7 @@ CONFIG_INPUT_ATI_REMOTE2=m # CONFIG_INPUT_POWERMATE is not set # CONFIG_INPUT_YEALINK is not set # CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set CONFIG_INPUT_UINPUT=y # CONFIG_INPUT_PCF8574 is not set # CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set @@ -2138,7 +2425,17 @@ CONFIG_INPUT_UINPUT=y # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_RMI4_CORE is not set +CONFIG_RMI4_CORE=y +# CONFIG_RMI4_I2C is not set +# CONFIG_RMI4_SMB is not set +CONFIG_RMI4_F03=y +CONFIG_RMI4_F03_SERIO=y +CONFIG_RMI4_2D_SENSOR=y +CONFIG_RMI4_F11=y +CONFIG_RMI4_F12=y +CONFIG_RMI4_F30=y +# CONFIG_RMI4_F34 is not set +# CONFIG_RMI4_F55 is not set # # Hardware I/O ports @@ -2154,6 +2451,7 @@ CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_ALTERA_PS2 is not set # CONFIG_SERIO_PS2MULT is not set # CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_GPIO_PS2 is not set # CONFIG_USERIO is not set # CONFIG_GAMEPORT is not set @@ -2186,13 +2484,18 @@ CONFIG_SERIAL_8250_PNP=y # CONFIG_SERIAL_8250_CONSOLE is not set CONFIG_SERIAL_8250_DMA=y CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_EXAR=y +CONFIG_SERIAL_8250_NR_UARTS=32 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_DW is not set +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +CONFIG_SERIAL_8250_RSA=y +CONFIG_SERIAL_8250_DW=y # CONFIG_SERIAL_8250_RT288X is not set # CONFIG_SERIAL_8250_LPSS is not set -# CONFIG_SERIAL_8250_MID is not set +CONFIG_SERIAL_8250_MID=y # CONFIG_SERIAL_8250_MOXA is not set # @@ -2208,6 +2511,8 @@ CONFIG_SERIAL_CORE=y # CONFIG_SERIAL_ARC is not set # CONFIG_SERIAL_RP2 is not set # CONFIG_SERIAL_FSL_LPUART is not set +CONFIG_SERIAL_DEV_BUS=y +CONFIG_SERIAL_DEV_CTRL_TTYPORT=y # CONFIG_TTY_PRINTK is not set CONFIG_HVC_DRIVER=y CONFIG_VIRTIO_CONSOLE=y @@ -2229,6 +2534,7 @@ CONFIG_HW_RANDOM_VIRTIO=m # CONFIG_TELCLOCK is not set CONFIG_DEVPORT=y # CONFIG_XILLYBUS is not set +# CONFIG_RANDOM_TRUST_CPU is not set # # I2C support @@ -2244,10 +2550,11 @@ CONFIG_I2C_MUX=m # Multiplexer I2C Chip support # # CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_LTC4306 is not set # CONFIG_I2C_MUX_PCA9541 is not set # CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set # CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_MUX_MLXCPLD is not set CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_SMBUS=y CONFIG_I2C_ALGOBIT=y @@ -2287,13 +2594,13 @@ CONFIG_I2C_VIAPRO=y # CONFIG_I2C_CBUS_GPIO is not set CONFIG_I2C_DESIGNWARE_CORE=y CONFIG_I2C_DESIGNWARE_PLATFORM=y +# CONFIG_I2C_DESIGNWARE_SLAVE is not set # CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set +CONFIG_I2C_DESIGNWARE_BAYTRAIL=y # CONFIG_I2C_EMEV2 is not set # CONFIG_I2C_GPIO is not set # CONFIG_I2C_OCORES is not set # CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set # CONFIG_I2C_SIMTEC is not set # CONFIG_I2C_XILINX is not set @@ -2309,6 +2616,7 @@ CONFIG_I2C_DESIGNWARE_PLATFORM=y # # Other I2C/SMBus bus drivers # +# CONFIG_I2C_MLXCPLD is not set # CONFIG_I2C_STUB is not set # CONFIG_I2C_SLAVE is not set # CONFIG_I2C_DEBUG_CORE is not set @@ -2317,10 +2625,6 @@ CONFIG_I2C_DESIGNWARE_PLATFORM=y # CONFIG_SPI is not set # CONFIG_SPMI is not set # CONFIG_HSI is not set - -# -# PPS support -# CONFIG_PPS=y # CONFIG_PPS_DEBUG is not set @@ -2343,37 +2647,44 @@ CONFIG_PTP_1588_CLOCK=y # # Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. # +CONFIG_PTP_1588_CLOCK_KVM=y CONFIG_PINCTRL=y - -# -# Pin controllers -# CONFIG_PINMUX=y CONFIG_PINCONF=y CONFIG_GENERIC_PINCONF=y # CONFIG_DEBUG_PINCTRL is not set # CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_MCP23S08 is not set +# CONFIG_PINCTRL_SX150X is not set CONFIG_PINCTRL_BAYTRAIL=y CONFIG_PINCTRL_CHERRYVIEW=y # CONFIG_PINCTRL_BROXTON is not set +# CONFIG_PINCTRL_CANNONLAKE is not set +# CONFIG_PINCTRL_CEDARFORK is not set +# CONFIG_PINCTRL_DENVERTON is not set +# CONFIG_PINCTRL_GEMINILAKE is not set +# CONFIG_PINCTRL_ICELAKE is not set +# CONFIG_PINCTRL_LEWISBURG is not set # CONFIG_PINCTRL_SUNRISEPOINT is not set CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_FASTPATH_LIMIT=512 CONFIG_GPIO_ACPI=y CONFIG_GPIOLIB_IRQCHIP=y # CONFIG_DEBUG_GPIO is not set -# CONFIG_GPIO_SYSFS is not set +CONFIG_GPIO_SYSFS=y # # Memory mapped GPIO drivers # # CONFIG_GPIO_AMDPT is not set # CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EXAR is not set # CONFIG_GPIO_GENERIC_PLATFORM is not set # CONFIG_GPIO_ICH is not set # CONFIG_GPIO_LYNXPOINT is not set +# CONFIG_GPIO_MB86S7X is not set # CONFIG_GPIO_MOCKUP is not set # CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_ZX is not set # # Port-mapped I/O GPIO drivers @@ -2382,6 +2693,8 @@ CONFIG_GPIOLIB_IRQCHIP=y # CONFIG_GPIO_IT87 is not set # CONFIG_GPIO_SCH is not set # CONFIG_GPIO_SCH311X is not set +# CONFIG_GPIO_WINBOND is not set +# CONFIG_GPIO_WS16C48 is not set # # I2C GPIO expanders @@ -2391,9 +2704,7 @@ CONFIG_GPIOLIB_IRQCHIP=y # CONFIG_GPIO_MAX732X is not set # CONFIG_GPIO_PCA953X is not set # CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set # CONFIG_GPIO_TPIC2810 is not set -# CONFIG_GPIO_TS4900 is not set # # MFD GPIO expanders @@ -2405,12 +2716,10 @@ CONFIG_GPIOLIB_IRQCHIP=y # CONFIG_GPIO_AMD8111 is not set # CONFIG_GPIO_BT8XX is not set # CONFIG_GPIO_ML_IOH is not set +# CONFIG_GPIO_PCI_IDIO_16 is not set +# CONFIG_GPIO_PCIE_IDIO_24 is not set # CONFIG_GPIO_RDC321X is not set -# -# SPI or I2C GPIO expanders -# - # # USB GPIO expanders # @@ -2421,18 +2730,22 @@ CONFIG_POWER_SUPPLY=y # CONFIG_POWER_SUPPLY_DEBUG is not set # CONFIG_PDA_POWER is not set # CONFIG_TEST_POWER is not set +# CONFIG_CHARGER_ADP5061 is not set # CONFIG_BATTERY_DS2780 is not set # CONFIG_BATTERY_DS2781 is not set # CONFIG_BATTERY_DS2782 is not set # CONFIG_BATTERY_SBS is not set +# CONFIG_CHARGER_SBS is not set +# CONFIG_MANAGER_SBS is not set # CONFIG_BATTERY_BQ27XXX is not set # CONFIG_BATTERY_MAX17040 is not set # CONFIG_BATTERY_MAX17042 is not set # CONFIG_CHARGER_MAX8903 is not set # CONFIG_CHARGER_LP8727 is not set # CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_LTC3651 is not set # CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set # CONFIG_CHARGER_BQ25890 is not set @@ -2467,6 +2780,7 @@ CONFIG_SENSORS_K10TEMP=m CONFIG_SENSORS_FAM15H_POWER=m # CONFIG_SENSORS_APPLESMC is not set # CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ASPEED is not set # CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_DS620 is not set # CONFIG_SENSORS_DS1621 is not set @@ -2480,7 +2794,6 @@ CONFIG_SENSORS_FAM15H_POWER=m # CONFIG_SENSORS_GL520SM is not set # CONFIG_SENSORS_G760A is not set # CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set # CONFIG_SENSORS_HIH6130 is not set # CONFIG_SENSORS_I5500 is not set CONFIG_SENSORS_CORETEMP=y @@ -2500,12 +2813,14 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_MAX1619 is not set # CONFIG_SENSORS_MAX1668 is not set # CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6621 is not set # CONFIG_SENSORS_MAX6639 is not set # CONFIG_SENSORS_MAX6642 is not set # CONFIG_SENSORS_MAX6650 is not set # CONFIG_SENSORS_MAX6697 is not set # CONFIG_SENSORS_MAX31790 is not set # CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_TC654 is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM73 is not set # CONFIG_SENSORS_LM75 is not set @@ -2528,6 +2843,7 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_NCT6775 is not set # CONFIG_SENSORS_NCT7802 is not set # CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_NPCM7XX is not set # CONFIG_SENSORS_PCF8591 is not set # CONFIG_PMBUS is not set # CONFIG_SENSORS_SHT15 is not set @@ -2542,7 +2858,7 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_SMSC47M1 is not set # CONFIG_SENSORS_SMSC47M192 is not set # CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_STTS751 is not set # CONFIG_SENSORS_SMM665 is not set # CONFIG_SENSORS_ADC128D818 is not set # CONFIG_SENSORS_ADS1015 is not set @@ -2555,12 +2871,14 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_THMC50 is not set # CONFIG_SENSORS_TMP102 is not set # CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP108 is not set # CONFIG_SENSORS_TMP401 is not set # CONFIG_SENSORS_TMP421 is not set # CONFIG_SENSORS_VIA_CPUTEMP is not set # CONFIG_SENSORS_VIA686A is not set # CONFIG_SENSORS_VT1211 is not set # CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83773G is not set # CONFIG_SENSORS_W83781D is not set # CONFIG_SENSORS_W83791D is not set # CONFIG_SENSORS_W83792D is not set @@ -2570,6 +2888,7 @@ CONFIG_SENSORS_IT87=m # CONFIG_SENSORS_W83L786NG is not set # CONFIG_SENSORS_W83627HF is not set CONFIG_SENSORS_W83627EHF=y +# CONFIG_SENSORS_XGENE is not set # # ACPI drivers @@ -2577,6 +2896,8 @@ CONFIG_SENSORS_W83627EHF=y # CONFIG_SENSORS_ACPI_POWER is not set CONFIG_SENSORS_ATK0110=m CONFIG_THERMAL=y +CONFIG_THERMAL_STATISTICS=y +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y @@ -2600,27 +2921,16 @@ CONFIG_INTEL_SOC_DTS_THERMAL=m # CONFIG_INTEL_PCH_THERMAL is not set # CONFIG_WATCHDOG is not set CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# CONFIG_SSB=y CONFIG_SSB_SPROM=y CONFIG_SSB_PCIHOST_POSSIBLE=y CONFIG_SSB_PCIHOST=y -# CONFIG_SSB_B43_PCI_BRIDGE is not set CONFIG_SSB_SDIOHOST_POSSIBLE=y CONFIG_SSB_SDIOHOST=y -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y CONFIG_SSB_DRIVER_PCICORE=y # CONFIG_SSB_DRIVER_GPIO is not set CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# CONFIG_BCMA=m CONFIG_BCMA_HOST_PCI_POSSIBLE=y CONFIG_BCMA_HOST_PCI=y @@ -2638,8 +2948,10 @@ CONFIG_MFD_CORE=y # CONFIG_PMIC_ADP5520 is not set # CONFIG_MFD_AAT2870_CORE is not set # CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_BD9571MWV is not set # CONFIG_MFD_AXP20X_I2C is not set # CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_MADERA is not set # CONFIG_PMIC_DA903X is not set # CONFIG_MFD_DA9052_I2C is not set # CONFIG_MFD_DA9055 is not set @@ -2647,7 +2959,6 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_DA9063 is not set # CONFIG_MFD_DA9150 is not set # CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_EXYNOS_LPASS is not set # CONFIG_MFD_MC13XXX_I2C is not set # CONFIG_HTC_PASIC3 is not set # CONFIG_HTC_I2CPLD is not set @@ -2655,8 +2966,11 @@ CONFIG_MFD_CORE=y # CONFIG_LPC_ICH is not set CONFIG_LPC_SCH=y # CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_MFD_INTEL_LPSS_ACPI is not set -# CONFIG_MFD_INTEL_LPSS_PCI is not set +# CONFIG_INTEL_SOC_PMIC_CHTWC is not set +# CONFIG_INTEL_SOC_PMIC_CHTDC_TI is not set +CONFIG_MFD_INTEL_LPSS=y +CONFIG_MFD_INTEL_LPSS_ACPI=y +CONFIG_MFD_INTEL_LPSS_PCI=y # CONFIG_MFD_JANZ_CMODIO is not set # CONFIG_MFD_KEMPLD is not set # CONFIG_MFD_88PM800 is not set @@ -2676,9 +2990,7 @@ CONFIG_LPC_SCH=y # CONFIG_MFD_PCF50633 is not set # CONFIG_UCB1400_CORE is not set # CONFIG_MFD_RDC321X is not set -CONFIG_MFD_RTSX_PCI=y # CONFIG_MFD_RT5033 is not set -CONFIG_MFD_RTSX_USB=y # CONFIG_MFD_RC5T583 is not set # CONFIG_MFD_SEC_CORE is not set # CONFIG_MFD_SI476X_CORE is not set @@ -2690,15 +3002,15 @@ CONFIG_MFD_RTSX_USB=y # CONFIG_MFD_TI_AM335X_TSCADC is not set # CONFIG_MFD_LP3943 is not set # CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_TI_LMU is not set # CONFIG_MFD_PALMAS is not set # CONFIG_TPS6105X is not set # CONFIG_TPS65010 is not set # CONFIG_TPS6507X is not set # CONFIG_MFD_TPS65086 is not set # CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS68470 is not set # CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TPS65218 is not set # CONFIG_MFD_TPS6586X is not set # CONFIG_MFD_TPS65910 is not set # CONFIG_MFD_TPS65912_I2C is not set @@ -2707,54 +3019,52 @@ CONFIG_MFD_RTSX_USB=y # CONFIG_TWL6040_CORE is not set # CONFIG_MFD_WL1273_CORE is not set # CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TMIO is not set # CONFIG_MFD_VX855 is not set # CONFIG_MFD_ARIZONA_I2C is not set # CONFIG_MFD_WM8400 is not set # CONFIG_MFD_WM831X_I2C is not set # CONFIG_MFD_WM8350_I2C is not set # CONFIG_MFD_WM8994 is not set -# CONFIG_REGULATOR is not set -CONFIG_MEDIA_SUPPORT=m - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=m -CONFIG_VIDEO_V4L2=m -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=m -CONFIG_VIDEOBUF_DMA_SG=m -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=m -CONFIG_VIDEOBUF2_MEMOPS=m -CONFIG_VIDEOBUF2_VMALLOC=m -CONFIG_VIDEOBUF2_DMA_SG=m -CONFIG_VIDEOBUF2_DVB=m -CONFIG_DVB_CORE=m -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +# CONFIG_REGULATOR_FIXED_VOLTAGE is not set +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_88PG86X is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_PV88060 is not set +# CONFIG_REGULATOR_PV88080 is not set +# CONFIG_REGULATOR_PV88090 is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS65132 is not set +CONFIG_CEC_CORE=y CONFIG_RC_CORE=m CONFIG_RC_MAP=m +CONFIG_LIRC=y CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m CONFIG_IR_NEC_DECODER=m CONFIG_IR_RC5_DECODER=m CONFIG_IR_RC6_DECODER=m @@ -2764,11 +3074,12 @@ CONFIG_IR_SANYO_DECODER=m CONFIG_IR_SHARP_DECODER=m CONFIG_IR_MCE_KBD_DECODER=m CONFIG_IR_XMP_DECODER=m +CONFIG_IR_IMON_DECODER=m CONFIG_RC_DEVICES=y CONFIG_RC_ATI_REMOTE=m CONFIG_IR_ENE=m -# CONFIG_IR_HIX5HD2 is not set CONFIG_IR_IMON=m +CONFIG_IR_IMON_RAW=m CONFIG_IR_MCEUSB=m CONFIG_IR_ITE_CIR=m CONFIG_IR_FINTEK=m @@ -2780,7 +3091,42 @@ CONFIG_IR_IGORPLUGUSB=m CONFIG_IR_IGUANA=m CONFIG_IR_TTUSBIR=m # CONFIG_RC_LOOPBACK is not set -# CONFIG_IR_GPIO_CIR is not set +CONFIG_IR_SERIAL=m +CONFIG_IR_SERIAL_TRANSMITTER=y +# CONFIG_IR_SIR is not set +CONFIG_RC_XBOX_DVD=m +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +# CONFIG_MEDIA_CEC_SUPPORT is not set +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_DMA_SG=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_DVB_CORE=m +# CONFIG_DVB_MMAP is not set +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=64 +# CONFIG_DVB_DYNAMIC_MINORS is not set +# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set +# CONFIG_DVB_ULE_DEBUG is not set + +# +# Media drivers +# CONFIG_MEDIA_USB_SUPPORT=y # @@ -2802,10 +3148,9 @@ CONFIG_VIDEO_PVRUSB2=m CONFIG_VIDEO_PVRUSB2_SYSFS=y CONFIG_VIDEO_PVRUSB2_DVB=y # CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set +CONFIG_VIDEO_HDPVR=m # CONFIG_VIDEO_USBVISION is not set CONFIG_VIDEO_STK1160_COMMON=m -# CONFIG_VIDEO_STK1160_AC97 is not set CONFIG_VIDEO_STK1160=m # CONFIG_VIDEO_GO7007 is not set @@ -2829,18 +3174,18 @@ CONFIG_VIDEO_TM6000_DVB=m CONFIG_DVB_USB=m # CONFIG_DVB_USB_DEBUG is not set CONFIG_DVB_USB_DIB3000MC=m -# CONFIG_DVB_USB_A800 is not set +CONFIG_DVB_USB_A800=m CONFIG_DVB_USB_DIBUSB_MB=m CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y CONFIG_DVB_USB_DIBUSB_MC=m CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set +CONFIG_DVB_USB_UMT_010=m CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m CONFIG_DVB_USB_NOVA_T_USB2=m CONFIG_DVB_USB_TTUSB2=m CONFIG_DVB_USB_DTT200U=m @@ -2851,24 +3196,24 @@ CONFIG_DVB_USB_PCTV452E=m CONFIG_DVB_USB_DW2102=m CONFIG_DVB_USB_CINERGY_T2=m CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set CONFIG_DVB_USB_AZ6027=m CONFIG_DVB_USB_TECHNISAT_USB2=m CONFIG_DVB_USB_V2=m CONFIG_DVB_USB_AF9015=m CONFIG_DVB_USB_AF9035=m CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set +CONFIG_DVB_USB_AU6610=m CONFIG_DVB_USB_AZ6007=m CONFIG_DVB_USB_CE6230=m CONFIG_DVB_USB_EC168=m -# CONFIG_DVB_USB_GL861 is not set +CONFIG_DVB_USB_GL861=m CONFIG_DVB_USB_LME2510=m -# CONFIG_DVB_USB_MXL111SF is not set +CONFIG_DVB_USB_MXL111SF=m CONFIG_DVB_USB_RTL28XXU=m CONFIG_DVB_USB_DVBSKY=m -# CONFIG_DVB_TTUSB_BUDGET is not set -# CONFIG_DVB_TTUSB_DEC is not set +CONFIG_DVB_USB_ZD1301=m +CONFIG_DVB_TTUSB_BUDGET=m +CONFIG_DVB_TTUSB_DEC=m CONFIG_SMS_USB_DRV=m CONFIG_DVB_B2C2_FLEXCOP_USB=m # CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set @@ -2891,7 +3236,6 @@ CONFIG_MEDIA_PCI_SUPPORT=y # CONFIG_VIDEO_TW5864 is not set # CONFIG_VIDEO_TW68 is not set # CONFIG_VIDEO_TW686X is not set -# CONFIG_VIDEO_ZORAN is not set # # Media capture/analog TV support @@ -2909,7 +3253,8 @@ CONFIG_VIDEO_CX18=m # CONFIG_VIDEO_CX18_ALSA is not set CONFIG_VIDEO_CX23885=m CONFIG_MEDIA_ALTERA_CI=m -# CONFIG_VIDEO_CX25821 is not set +CONFIG_VIDEO_CX25821=m +# CONFIG_VIDEO_CX25821_ALSA is not set CONFIG_VIDEO_CX88=m # CONFIG_VIDEO_CX88_ALSA is not set # CONFIG_VIDEO_CX88_BLACKBIRD is not set @@ -2938,13 +3283,14 @@ CONFIG_DVB_B2C2_FLEXCOP_PCI=m # CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set # CONFIG_DVB_PLUTO2 is not set CONFIG_DVB_DM1105=m -# CONFIG_DVB_PT1 is not set -# CONFIG_DVB_PT3 is not set +CONFIG_DVB_PT1=m +CONFIG_DVB_PT3=m CONFIG_MANTIS_CORE=m CONFIG_DVB_MANTIS=m -# CONFIG_DVB_HOPPER is not set +CONFIG_DVB_HOPPER=m CONFIG_DVB_NGENE=m CONFIG_DVB_DDBRIDGE=m +# CONFIG_DVB_DDBRIDGE_MSIENABLE is not set CONFIG_DVB_SMIPCIE=m # CONFIG_V4L_PLATFORM_DRIVERS is not set # CONFIG_V4L_MEM2MEM_DRIVERS is not set @@ -2969,6 +3315,12 @@ CONFIG_MEDIA_COMMON_OPTIONS=y CONFIG_VIDEO_CX2341X=m CONFIG_VIDEO_TVEEPROM=m CONFIG_CYPRESS_FIRMWARE=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_V4L2=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_VIDEOBUF2_DMA_SG=m +CONFIG_VIDEOBUF2_DVB=m CONFIG_DVB_B2C2_FLEXCOP=m CONFIG_VIDEO_SAA7146=m CONFIG_VIDEO_SAA7146_VV=m @@ -3028,6 +3380,10 @@ CONFIG_VIDEO_CX25840=m # CONFIG_VIDEO_SAA6752HS=m +# +# SDR tuner chips +# + # # Miscellaneous helper chips # @@ -3037,6 +3393,7 @@ CONFIG_VIDEO_SAA6752HS=m # CONFIG_MEDIA_TUNER=m CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA18250=m CONFIG_MEDIA_TUNER_TDA8290=m CONFIG_MEDIA_TUNER_TDA827X=m CONFIG_MEDIA_TUNER_TDA18271=m @@ -3066,7 +3423,9 @@ CONFIG_MEDIA_TUNER_TUA9001=m CONFIG_MEDIA_TUNER_SI2157=m CONFIG_MEDIA_TUNER_IT913X=m CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_MXL301RF=m CONFIG_MEDIA_TUNER_QM1D1C0042=m +CONFIG_MEDIA_TUNER_QM1D1B0004=m # # Multistandard (satellite) frontends @@ -3074,7 +3433,10 @@ CONFIG_MEDIA_TUNER_QM1D1C0042=m CONFIG_DVB_STB0899=m CONFIG_DVB_STB6100=m CONFIG_DVB_STV090x=m +CONFIG_DVB_STV0910=m CONFIG_DVB_STV6110x=m +CONFIG_DVB_STV6111=m +CONFIG_DVB_MXL5XX=m CONFIG_DVB_M88DS3103=m # @@ -3120,10 +3482,12 @@ CONFIG_DVB_TDA10071=m # DVB-T (terrestrial) frontends # CONFIG_DVB_SP8870=m +CONFIG_DVB_CX22700=m CONFIG_DVB_CX22702=m CONFIG_DVB_DRXD=m CONFIG_DVB_L64781=m CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m CONFIG_DVB_MT352=m CONFIG_DVB_ZL10353=m CONFIG_DVB_DIB3000MB=m @@ -3135,11 +3499,13 @@ CONFIG_DVB_AF9013=m CONFIG_DVB_EC100=m CONFIG_DVB_STV0367=m CONFIG_DVB_CXD2820R=m +CONFIG_DVB_CXD2841ER=m CONFIG_DVB_RTL2830=m CONFIG_DVB_RTL2832=m CONFIG_DVB_SI2168=m CONFIG_DVB_AS102_FE=m -# CONFIG_DVB_GP8PSK_FE is not set +CONFIG_DVB_ZD1301_DEMOD=m +CONFIG_DVB_GP8PSK_FE=m # # DVB-C (cable) frontends @@ -3158,6 +3524,7 @@ CONFIG_DVB_BCM3510=m CONFIG_DVB_LGDT330X=m CONFIG_DVB_LGDT3305=m CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m CONFIG_DVB_S5H1409=m CONFIG_DVB_AU8522=m CONFIG_DVB_AU8522_DTV=m @@ -3187,13 +3554,13 @@ CONFIG_DVB_TUNER_DIB0090=m # SEC control devices for DVB-S # CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBH25=m CONFIG_DVB_LNBP21=m CONFIG_DVB_LNBP22=m CONFIG_DVB_ISL6405=m CONFIG_DVB_ISL6421=m CONFIG_DVB_ISL6423=m CONFIG_DVB_A8293=m -CONFIG_DVB_SP2=m CONFIG_DVB_LGS8GXX=m CONFIG_DVB_ATBM8830=m CONFIG_DVB_TDA665x=m @@ -3201,10 +3568,16 @@ CONFIG_DVB_IX2505V=m CONFIG_DVB_M88RS2000=m CONFIG_DVB_AF9033=m +# +# Common Interface (EN50221) controller drivers +# +CONFIG_DVB_CXD2099=m +CONFIG_DVB_SP2=m + # # Tools to develop new frontends # -# CONFIG_DVB_DUMMY_FE is not set +CONFIG_DVB_DUMMY_FE=m # # Graphics support @@ -3220,12 +3593,18 @@ CONFIG_VGA_ARB_MAX_GPUS=16 CONFIG_VGA_SWITCHEROO=y CONFIG_DRM=y CONFIG_DRM_MIPI_DSI=y -# CONFIG_DRM_DP_AUX_CHARDEV is not set +CONFIG_DRM_DP_AUX_CHARDEV=y +# CONFIG_DRM_DEBUG_MM is not set +# CONFIG_DRM_DEBUG_SELFTEST is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_KMS_FB_HELPER=y CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_FBDEV_OVERALLOC=100 +# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set CONFIG_DRM_LOAD_EDID_FIRMWARE=y +CONFIG_DRM_DP_CEC=y CONFIG_DRM_TTM=y +CONFIG_DRM_SCHED=y # # I2C encoder or helper chips @@ -3233,6 +3612,7 @@ CONFIG_DRM_TTM=y # CONFIG_DRM_I2C_CH7006 is not set # CONFIG_DRM_I2C_SIL164 is not set # CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_I2C_NXP_TDA9950 is not set CONFIG_DRM_RADEON=y # CONFIG_DRM_RADEON_USERPTR is not set CONFIG_DRM_AMDGPU=y @@ -3245,9 +3625,25 @@ CONFIG_DRM_AMDGPU_CIK=y # ACP (Audio CoProcessor) Configuration # CONFIG_DRM_AMD_ACP=y + +# +# Display Engine Configuration +# +CONFIG_DRM_AMD_DC=y +CONFIG_DRM_AMD_DC_DCN1_0=y +# CONFIG_DEBUG_KERNEL_DC is not set + +# +# AMD Library routines +# +CONFIG_CHASH=y +# CONFIG_CHASH_STATS is not set +# CONFIG_CHASH_SELFTEST is not set # CONFIG_DRM_NOUVEAU is not set CONFIG_DRM_I915=y -# CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT is not set +# CONFIG_DRM_I915_ALPHA_SUPPORT is not set +CONFIG_DRM_I915_CAPTURE_ERROR=y +CONFIG_DRM_I915_COMPRESS_ERROR=y CONFIG_DRM_I915_USERPTR=y # CONFIG_DRM_I915_GVT is not set @@ -3256,8 +3652,16 @@ CONFIG_DRM_I915_USERPTR=y # # CONFIG_DRM_I915_WERROR is not set # CONFIG_DRM_I915_DEBUG is not set +# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set +# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set +# CONFIG_DRM_I915_DEBUG_GUC is not set +# CONFIG_DRM_I915_SELFTEST is not set +# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set +# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set # CONFIG_DRM_VGEM is not set -# CONFIG_DRM_VMWGFX is not set +# CONFIG_DRM_VKMS is not set +CONFIG_DRM_VMWGFX=y +CONFIG_DRM_VMWGFX_FBCON=y # CONFIG_DRM_GMA500 is not set # CONFIG_DRM_UDL is not set # CONFIG_DRM_AST is not set @@ -3265,19 +3669,25 @@ CONFIG_DRM_I915_USERPTR=y # CONFIG_DRM_CIRRUS_QEMU is not set # CONFIG_DRM_QXL is not set # CONFIG_DRM_BOCHS is not set -# CONFIG_DRM_VIRTIO_GPU is not set +CONFIG_DRM_VIRTIO_GPU=y CONFIG_DRM_PANEL=y # # Display Panels # +# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y # # Display Interface Bridges # # CONFIG_DRM_ANALOGIX_ANX78XX is not set +CONFIG_HSA_AMD=m +# CONFIG_DRM_HISI_HIBMC is not set +# CONFIG_DRM_TINYDRM is not set # CONFIG_DRM_LEGACY is not set +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y # # Frame buffer Devices @@ -3286,21 +3696,15 @@ CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CMDLINE=y CONFIG_FB_NOTIFY=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set CONFIG_FB_SYS_FILLRECT=y CONFIG_FB_SYS_COPYAREA=y CONFIG_FB_SYS_IMAGEBLIT=y # CONFIG_FB_FOREIGN_ENDIAN is not set CONFIG_FB_SYS_FOPS=y CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set CONFIG_FB_MODE_HELPERS=y # CONFIG_FB_TILEBLITTING is not set @@ -3349,7 +3753,6 @@ CONFIG_FB_UDL=m # CONFIG_FB_METRONOME is not set # CONFIG_FB_MB862XX is not set # CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SM712 is not set CONFIG_BACKLIGHT_LCD_SUPPORT=y @@ -3365,7 +3768,7 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y # CONFIG_BACKLIGHT_GPIO is not set # CONFIG_BACKLIGHT_LV5207LP is not set # CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_VGASTATE is not set +# CONFIG_BACKLIGHT_ARCXCNN is not set CONFIG_HDMI=y # @@ -3374,15 +3777,16 @@ CONFIG_HDMI=y CONFIG_VGA_CONSOLE=y CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256 +# CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT is not set CONFIG_DUMMY_CONSOLE=y CONFIG_DUMMY_CONSOLE_COLUMNS=80 CONFIG_DUMMY_CONSOLE_ROWS=25 CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set # CONFIG_LOGO is not set CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set CONFIG_SND=y CONFIG_SND_TIMER=y CONFIG_SND_PCM=y @@ -3391,9 +3795,7 @@ CONFIG_SND_RAWMIDI=m CONFIG_SND_COMPRESS_OFFLOAD=y CONFIG_SND_JACK=y CONFIG_SND_JACK_INPUT_DEV=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set +# CONFIG_SND_OSSEMUL is not set CONFIG_SND_PCM_TIMER=y CONFIG_SND_HRTIMER=y CONFIG_SND_DYNAMIC_MINORS=y @@ -3405,15 +3807,17 @@ CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SND_DEBUG is not set CONFIG_SND_VMASTER=y CONFIG_SND_DMA_SGBUF=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set +# CONFIG_SND_SEQUENCER is not set CONFIG_SND_MPU401_UART=m CONFIG_SND_OPL3_LIB=m CONFIG_SND_AC97_CODEC=m -# CONFIG_SND_DRIVERS is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_AC97_POWER_SAVE is not set CONFIG_SND_PCI=y # CONFIG_SND_AD1889 is not set # CONFIG_SND_ALS300 is not set @@ -3507,7 +3911,9 @@ CONFIG_SND_HDA_GENERIC=m CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 CONFIG_SND_HDA_CORE=m CONFIG_SND_HDA_DSP_LOADER=y +CONFIG_SND_HDA_COMPONENT=y CONFIG_SND_HDA_I915=y +CONFIG_SND_HDA_EXT_CORE=m CONFIG_SND_HDA_PREALLOC_SIZE=2048 CONFIG_SND_USB=y CONFIG_SND_USB_AUDIO=m @@ -3532,9 +3938,15 @@ CONFIG_SND_FIREWIRE=y # CONFIG_SND_BEBOB is not set # CONFIG_SND_FIREWIRE_DIGI00X is not set # CONFIG_SND_FIREWIRE_TASCAM is not set +# CONFIG_SND_FIREWIRE_MOTU is not set +# CONFIG_SND_FIREFACE is not set CONFIG_SND_SOC=y CONFIG_SND_SOC_COMPRESS=y +CONFIG_SND_SOC_TOPOLOGY=y +CONFIG_SND_SOC_ACPI=m CONFIG_SND_SOC_AMD_ACP=m +CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH=m +CONFIG_SND_SOC_AMD_CZ_RT5645_MACH=m # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set @@ -3551,26 +3963,47 @@ CONFIG_SND_SOC_AMD_ACP=m # CONFIG_SND_SOC_FSL_SPDIF is not set # CONFIG_SND_SOC_FSL_ESAI is not set # CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_I2S_HI6210_I2S is not set # CONFIG_SND_SOC_IMG is not set -CONFIG_SND_SST_MFLD_PLATFORM=m +CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y CONFIG_SND_SST_IPC=m CONFIG_SND_SST_IPC_ACPI=m -CONFIG_SND_SOC_INTEL_SST=m CONFIG_SND_SOC_INTEL_SST_ACPI=m -CONFIG_SND_SOC_INTEL_SST_MATCH=m +CONFIG_SND_SOC_INTEL_SST=m +CONFIG_SND_SOC_INTEL_SST_FIRMWARE=m +CONFIG_SND_SOC_INTEL_HASWELL=m +CONFIG_SND_SST_ATOM_HIFI2_PLATFORM=m +# CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI is not set +CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI=m +CONFIG_SND_SOC_INTEL_SKYLAKE=m +CONFIG_SND_SOC_ACPI_INTEL_MATCH=m +CONFIG_SND_SOC_INTEL_MACH=y # CONFIG_SND_SOC_INTEL_HASWELL_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set +# CONFIG_SND_SOC_INTEL_BDW_RT5677_MACH is not set # CONFIG_SND_SOC_INTEL_BROADWELL_MACH is not set CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH=m -# CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set +CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH=m CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH=m +CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH=m +CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH=m +CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH=m +CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH=m # CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set # CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set # CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set +# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set +# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set +# CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH is not set +# CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH is not set +# CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH is not set + +# +# STMicroelectronics STM32 SOC audio support +# # CONFIG_SND_SOC_XTFPGA_I2S is not set +# CONFIG_ZX_TDM is not set CONFIG_SND_SOC_I2C_AND_SPI=y # @@ -3578,15 +4011,22 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # # CONFIG_SND_SOC_AC97_CODEC is not set # CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_ADAU7002 is not set +# CONFIG_SND_SOC_ADAU1761_I2C is not set +CONFIG_SND_SOC_ADAU7002=m +# CONFIG_SND_SOC_AK4458 is not set # CONFIG_SND_SOC_AK4554 is not set # CONFIG_SND_SOC_AK4613 is not set # CONFIG_SND_SOC_AK4642 is not set # CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_AK5558 is not set # CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_BD28623 is not set # CONFIG_SND_SOC_BT_SCO is not set # CONFIG_SND_SOC_CS35L32 is not set # CONFIG_SND_SOC_CS35L33 is not set +# CONFIG_SND_SOC_CS35L34 is not set +# CONFIG_SND_SOC_CS35L35 is not set +# CONFIG_SND_SOC_CS42L42 is not set # CONFIG_SND_SOC_CS42L51_I2C is not set # CONFIG_SND_SOC_CS42L52 is not set # CONFIG_SND_SOC_CS42L56 is not set @@ -3595,16 +4035,29 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_CS4270 is not set # CONFIG_SND_SOC_CS4271_I2C is not set # CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS43130 is not set # CONFIG_SND_SOC_CS4349 is not set # CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_ES8328 is not set +CONFIG_SND_SOC_DA7213=m +CONFIG_SND_SOC_DA7219=m +# CONFIG_SND_SOC_ES7134 is not set +# CONFIG_SND_SOC_ES7241 is not set +CONFIG_SND_SOC_ES8316=m +# CONFIG_SND_SOC_ES8328_I2C is not set # CONFIG_SND_SOC_GTM601 is not set # CONFIG_SND_SOC_INNO_RK3036 is not set CONFIG_SND_SOC_MAX98090=m +CONFIG_SND_SOC_MAX98357A=m # CONFIG_SND_SOC_MAX98504 is not set +# CONFIG_SND_SOC_MAX9867 is not set +CONFIG_SND_SOC_MAX98927=m +# CONFIG_SND_SOC_MAX98373 is not set # CONFIG_SND_SOC_MAX9860 is not set +# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set # CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1789_I2C is not set # CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM186X_I2C is not set # CONFIG_SND_SOC_PCM3168A_I2C is not set # CONFIG_SND_SOC_PCM512x_I2C is not set CONFIG_SND_SOC_RL6231=m @@ -3612,11 +4065,13 @@ CONFIG_SND_SOC_RL6231=m # CONFIG_SND_SOC_RT5631 is not set CONFIG_SND_SOC_RT5640=m CONFIG_SND_SOC_RT5645=m +CONFIG_SND_SOC_RT5651=m CONFIG_SND_SOC_RT5670=m -# CONFIG_SND_SOC_RT5677_SPI is not set # CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIMPLE_AMPLIFIER is not set # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set CONFIG_SND_SOC_SPDIF=m +# CONFIG_SND_SOC_SSM2305 is not set # CONFIG_SND_SOC_SSM2602_I2C is not set # CONFIG_SND_SOC_SSM4567 is not set # CONFIG_SND_SOC_STA32X is not set @@ -3626,13 +4081,19 @@ CONFIG_SND_SOC_SPDIF=m # CONFIG_SND_SOC_TAS5086 is not set # CONFIG_SND_SOC_TAS571X is not set # CONFIG_SND_SOC_TAS5720 is not set +# CONFIG_SND_SOC_TAS6424 is not set +# CONFIG_SND_SOC_TDA7419 is not set # CONFIG_SND_SOC_TFA9879 is not set # CONFIG_SND_SOC_TLV320AIC23_I2C is not set # CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC32X4_I2C is not set # CONFIG_SND_SOC_TLV320AIC3X is not set CONFIG_SND_SOC_TS3A227E=m +# CONFIG_SND_SOC_TSCS42XX is not set +# CONFIG_SND_SOC_TSCS454 is not set # CONFIG_SND_SOC_WM8510 is not set # CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8524 is not set # CONFIG_SND_SOC_WM8580 is not set # CONFIG_SND_SOC_WM8711 is not set # CONFIG_SND_SOC_WM8728 is not set @@ -3642,6 +4103,7 @@ CONFIG_SND_SOC_TS3A227E=m # CONFIG_SND_SOC_WM8750 is not set # CONFIG_SND_SOC_WM8753 is not set # CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8782 is not set # CONFIG_SND_SOC_WM8804_I2C is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8960 is not set @@ -3649,13 +4111,17 @@ CONFIG_SND_SOC_TS3A227E=m # CONFIG_SND_SOC_WM8974 is not set # CONFIG_SND_SOC_WM8978 is not set # CONFIG_SND_SOC_WM8985 is not set +# CONFIG_SND_SOC_ZX_AUD96P22 is not set +# CONFIG_SND_SOC_MAX9759 is not set +# CONFIG_SND_SOC_MT6351 is not set +# CONFIG_SND_SOC_NAU8540 is not set # CONFIG_SND_SOC_NAU8810 is not set +CONFIG_SND_SOC_NAU8824=m # CONFIG_SND_SOC_TPA6130A2 is not set CONFIG_SND_SIMPLE_CARD_UTILS=m CONFIG_SND_SIMPLE_CARD=m -CONFIG_SND_X86=m +CONFIG_SND_X86=y CONFIG_HDMI_LPE_AUDIO=m -# CONFIG_SOUND_PRIME is not set CONFIG_AC97_BUS=m # @@ -3671,15 +4137,18 @@ CONFIG_HID_GENERIC=y # Special HID drivers # CONFIG_HID_A4TECH=y +# CONFIG_HID_ACCUTOUCH is not set # CONFIG_HID_ACRUX is not set CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set +CONFIG_HID_APPLEIR=m +CONFIG_HID_ASUS=y CONFIG_HID_AUREAL=y CONFIG_HID_BELKIN=y # CONFIG_HID_BETOP_FF is not set CONFIG_HID_CHERRY=y CONFIG_HID_CHICONY=y # CONFIG_HID_CORSAIR is not set +# CONFIG_HID_COUGAR is not set # CONFIG_HID_PRODIKEYS is not set # CONFIG_HID_CMEDIA is not set # CONFIG_HID_CP2112 is not set @@ -3687,12 +4156,14 @@ CONFIG_HID_CYPRESS=y CONFIG_HID_DRAGONRISE=m CONFIG_DRAGONRISE_FF=y # CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELAN is not set # CONFIG_HID_ELECOM is not set # CONFIG_HID_ELO is not set CONFIG_HID_EZKEY=y # CONFIG_HID_GEMBIRD is not set # CONFIG_HID_GFRM is not set # CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GOOGLE_HAMMER is not set # CONFIG_HID_GT683R is not set # CONFIG_HID_KEYTOUCH is not set CONFIG_HID_KYE=y @@ -3700,6 +4171,8 @@ CONFIG_HID_KYE=y # CONFIG_HID_WALTOP is not set CONFIG_HID_GYRATION=y # CONFIG_HID_ICADE is not set +# CONFIG_HID_ITE is not set +# CONFIG_HID_JABRA is not set CONFIG_HID_TWINHAN=y CONFIG_HID_KENSINGTON=y CONFIG_HID_LCPOWER=y @@ -3713,9 +4186,12 @@ CONFIG_LOGIRUMBLEPAD2_FF=y CONFIG_LOGIG940_FF=y CONFIG_LOGIWHEELS_FF=y # CONFIG_HID_MAGICMOUSE is not set +# CONFIG_HID_MAYFLASH is not set +# CONFIG_HID_REDRAGON is not set CONFIG_HID_MICROSOFT=y CONFIG_HID_MONTEREY=y CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTI is not set # CONFIG_HID_NTRIG is not set CONFIG_HID_ORTEK=y CONFIG_HID_OUYA=y @@ -3726,14 +4202,15 @@ CONFIG_HID_PETALYNX=y # CONFIG_HID_PICOLCD is not set # CONFIG_HID_PLANTRONICS is not set # CONFIG_HID_PRIMAX is not set +# CONFIG_HID_RETRODE is not set # CONFIG_HID_ROCCAT is not set # CONFIG_HID_SAITEK is not set CONFIG_HID_SAMSUNG=y CONFIG_HID_SONY=y CONFIG_SONY_FF=y # CONFIG_HID_SPEEDLINK is not set +CONFIG_HID_STEAM=m # CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SPINELPLUS=y CONFIG_HID_SUNPLUS=y CONFIG_HID_RMI=y # CONFIG_HID_GREENASIA is not set @@ -3743,13 +4220,14 @@ CONFIG_HID_TIVO=y CONFIG_HID_TOPSEED=y # CONFIG_HID_THINGM is not set # CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_UDRAW_PS3 is not set # CONFIG_HID_WACOM is not set CONFIG_HID_WIIMOTE=m CONFIG_HID_XINMO=y # CONFIG_HID_ZEROPLUS is not set CONFIG_HID_ZYDACRON=y # CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set +CONFIG_HID_ALPS=m # # USB HID support @@ -3761,7 +4239,7 @@ CONFIG_USB_HIDDEV=y # # I2C HID support # -# CONFIG_I2C_HID is not set +CONFIG_I2C_HID=m # # Intel ISH HID support @@ -3772,6 +4250,7 @@ CONFIG_USB_SUPPORT=y CONFIG_USB_COMMON=y CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB=y +CONFIG_USB_PCI=y # CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set # @@ -3791,6 +4270,7 @@ CONFIG_USB_MON=m # # CONFIG_USB_C67X00_HCD is not set CONFIG_USB_XHCI_HCD=y +# CONFIG_USB_XHCI_DBGCAP is not set CONFIG_USB_XHCI_PCI=y # CONFIG_USB_XHCI_PLATFORM is not set CONFIG_USB_EHCI_HCD=y @@ -3800,7 +4280,6 @@ CONFIG_USB_EHCI_PCI=y # CONFIG_USB_EHCI_HCD_PLATFORM is not set # CONFIG_USB_OXU210HP_HCD is not set # CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set # CONFIG_USB_FOTG210_HCD is not set CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_HCD_PCI=y @@ -3879,6 +4358,7 @@ CONFIG_USB_SERIAL_FTDI_SIO=m # CONFIG_USB_SERIAL_EDGEPORT is not set # CONFIG_USB_SERIAL_EDGEPORT_TI is not set # CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_F8153X is not set # CONFIG_USB_SERIAL_GARMIN is not set # CONFIG_USB_SERIAL_IPW is not set CONFIG_USB_SERIAL_IUU=m @@ -3910,6 +4390,7 @@ CONFIG_USB_SERIAL_PL2303=m # CONFIG_USB_SERIAL_WISHBONE is not set # CONFIG_USB_SERIAL_SSU100 is not set # CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_UPD78F0730 is not set # CONFIG_USB_SERIAL_DEBUG is not set # @@ -3936,43 +4417,53 @@ CONFIG_USB_SERIAL_PL2303=m # CONFIG_USB_ISIGHTFW is not set # CONFIG_USB_YUREX is not set # CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HUB_USB251XB is not set # CONFIG_USB_HSIC_USB3503 is not set # CONFIG_USB_HSIC_USB4604 is not set # CONFIG_USB_LINK_LAYER_TEST is not set # CONFIG_USB_CHAOSKEY is not set -# CONFIG_UCSI is not set # # USB Physical Layer drivers # -# CONFIG_USB_PHY is not set # CONFIG_NOP_USB_XCEIV is not set # CONFIG_USB_GPIO_VBUS is not set # CONFIG_USB_ISP1301 is not set # CONFIG_USB_GADGET is not set +CONFIG_TYPEC=m +# CONFIG_TYPEC_TCPM is not set +# CONFIG_TYPEC_UCSI is not set +# CONFIG_TYPEC_TPS6598X is not set + +# +# USB Type-C Multiplexer/DeMultiplexer Switch support +# +# CONFIG_TYPEC_MUX_PI3USB30532 is not set + +# +# USB Type-C Alternate Mode drivers +# +# CONFIG_TYPEC_DP_ALTMODE is not set +# CONFIG_USB_ROLE_SWITCH is not set # CONFIG_USB_LED_TRIG is not set # CONFIG_USB_ULPI_BUS is not set # CONFIG_UWB is not set CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set - -# -# MMC/SD/SDIO Card Drivers -# CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y # CONFIG_SDIO_UART is not set # CONFIG_MMC_TEST is not set # # MMC/SD/SDIO Host Controller Drivers # +# CONFIG_MMC_DEBUG is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PCI=y # CONFIG_MMC_RICOH_MMC is not set CONFIG_MMC_SDHCI_ACPI=y -# CONFIG_MMC_SDHCI_PLTFM is not set +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_F_SDH30 is not set # CONFIG_MMC_WBSD is not set # CONFIG_MMC_TIFM_SD is not set # CONFIG_MMC_CB710 is not set @@ -3980,37 +4471,26 @@ CONFIG_MMC_SDHCI_ACPI=y # CONFIG_MMC_VUB300 is not set # CONFIG_MMC_USHC is not set # CONFIG_MMC_USDHI6ROL0 is not set -CONFIG_MMC_REALTEK_PCI=m -CONFIG_MMC_REALTEK_USB=m -CONFIG_MMC_TOSHIBA_PCI=m +CONFIG_MMC_REALTEK_PCI=y +CONFIG_MMC_REALTEK_USB=y +CONFIG_MMC_CQHCI=y +CONFIG_MMC_TOSHIBA_PCI=y # CONFIG_MMC_MTK is not set -CONFIG_MEMSTICK=m -# CONFIG_MEMSTICK_DEBUG is not set - -# -# MemoryStick drivers -# -# CONFIG_MEMSTICK_UNSAFE_RESUME is not set -# CONFIG_MSPRO_BLOCK is not set -# CONFIG_MS_BLOCK is not set - -# -# MemoryStick Host Controller Drivers -# -# CONFIG_MEMSTICK_TIFM_MS is not set -CONFIG_MEMSTICK_JMICRON_38X=m -# CONFIG_MEMSTICK_R592 is not set -CONFIG_MEMSTICK_REALTEK_PCI=m -CONFIG_MEMSTICK_REALTEK_USB=m +# CONFIG_MMC_SDHCI_XENON is not set +# CONFIG_MEMSTICK is not set CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS_FLASH=y +# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set # # LED drivers # +# CONFIG_LEDS_APU is not set +# CONFIG_LEDS_AS3645A is not set # CONFIG_LEDS_LM3530 is not set # CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_LM3601X is not set # CONFIG_LEDS_PCA9532 is not set # CONFIG_LEDS_GPIO is not set # CONFIG_LEDS_LP3944 is not set @@ -4019,10 +4499,10 @@ CONFIG_LEDS_CLASS_FLASH=y # CONFIG_LEDS_LP5523 is not set # CONFIG_LEDS_LP5562 is not set # CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_CLEVO_MAIL is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_REGULATOR is not set # CONFIG_LEDS_BD2802 is not set # CONFIG_LEDS_INTEL_SS4200 is not set # CONFIG_LEDS_LT3593 is not set @@ -4035,6 +4515,9 @@ CONFIG_LEDS_CLASS_FLASH=y # # CONFIG_LEDS_BLINKM is not set # CONFIG_LEDS_MLXCPLD is not set +# CONFIG_LEDS_MLXREG is not set +# CONFIG_LEDS_USER is not set +# CONFIG_LEDS_NIC78BX is not set # # LED Triggers @@ -4046,6 +4529,7 @@ CONFIG_LEDS_TRIGGERS=y # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set # CONFIG_LEDS_TRIGGER_BACKLIGHT is not set # CONFIG_LEDS_TRIGGER_CPU is not set +# CONFIG_LEDS_TRIGGER_ACTIVITY is not set # CONFIG_LEDS_TRIGGER_GPIO is not set # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set @@ -4055,6 +4539,7 @@ CONFIG_LEDS_TRIGGERS=y # CONFIG_LEDS_TRIGGER_TRANSIENT is not set # CONFIG_LEDS_TRIGGER_CAMERA is not set # CONFIG_LEDS_TRIGGER_PANIC is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set # CONFIG_ACCESSIBILITY is not set # CONFIG_INFINIBAND is not set CONFIG_EDAC_ATOMIC_SCRUB=y @@ -4068,6 +4553,7 @@ CONFIG_RTC_HCTOSYS_DEVICE="rtc0" CONFIG_RTC_SYSTOHC=y CONFIG_RTC_SYSTOHC_DEVICE="rtc0" # CONFIG_RTC_DEBUG is not set +CONFIG_RTC_NVMEM=y # # RTC interfaces @@ -4093,6 +4579,7 @@ CONFIG_RTC_INTF_DEV=y # CONFIG_RTC_DRV_X1205 is not set # CONFIG_RTC_DRV_PCF8523 is not set # CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF85363 is not set # CONFIG_RTC_DRV_PCF8563 is not set # CONFIG_RTC_DRV_PCF8583 is not set # CONFIG_RTC_DRV_M41T80 is not set @@ -4139,6 +4626,7 @@ CONFIG_RTC_DRV_CMOS=y # # on-CPU RTC drivers # +# CONFIG_RTC_DRV_FTRTC010 is not set # # HID Sensor RTC drivers @@ -4151,8 +4639,9 @@ CONFIG_DMADEVICES=y # DMA Devices # CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=m +CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DMA_ACPI=y +# CONFIG_ALTERA_MSGDMA is not set CONFIG_INTEL_IDMA64=m CONFIG_INTEL_IOATDMA=m # CONFIG_QCOM_HIDMA_MGMT is not set @@ -4160,6 +4649,7 @@ CONFIG_INTEL_IOATDMA=m CONFIG_DW_DMAC_CORE=m CONFIG_DW_DMAC=m CONFIG_DW_DMAC_PCI=m +CONFIG_HSU_DMA=y # # DMA Clients @@ -4171,7 +4661,8 @@ CONFIG_DMA_ENGINE_RAID=y # # DMABUF options # -# CONFIG_SYNC_FILE is not set +CONFIG_SYNC_FILE=y +# CONFIG_SW_SYNC is not set CONFIG_DCA=m # CONFIG_AUXDISPLAY is not set CONFIG_UIO=y @@ -4186,10 +4677,7 @@ CONFIG_UIO=y # CONFIG_UIO_MF624 is not set # CONFIG_VIRT_DRIVERS is not set CONFIG_VIRTIO=y - -# -# Virtio drivers -# +CONFIG_VIRTIO_MENU=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_PCI_LEGACY=y CONFIG_VIRTIO_BALLOON=y @@ -4202,13 +4690,14 @@ CONFIG_VIRTIO_MMIO=y # # CONFIG_HYPERV is not set CONFIG_STAGING=y -# CONFIG_SLICOSS is not set # CONFIG_PRISM2_USB is not set # CONFIG_COMEDI is not set CONFIG_RTL8192U=m # CONFIG_RTLLIB is not set +CONFIG_RTL8723BS=m CONFIG_R8712U=m # CONFIG_R8188EU is not set +# CONFIG_R8822BE is not set CONFIG_RTS5208=y # CONFIG_VT6655 is not set CONFIG_VT6656=m @@ -4220,34 +4709,89 @@ CONFIG_VT6656=m # # CONFIG_SPEAKUP is not set CONFIG_STAGING_MEDIA=y -# CONFIG_MEDIA_CEC is not set -CONFIG_DVB_CXD2099=m -CONFIG_LIRC_STAGING=y -# CONFIG_LIRC_BT829 is not set -# CONFIG_LIRC_IMON is not set -# CONFIG_LIRC_SASEM is not set -CONFIG_LIRC_SERIAL=m -CONFIG_LIRC_SERIAL_TRANSMITTER=y -# CONFIG_LIRC_SIR is not set -CONFIG_LIRC_XBOX=m -# CONFIG_LIRC_ZILOG is not set +# CONFIG_VIDEO_ZORAN is not set # # Android # # CONFIG_LTE_GDM724X is not set # CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_LNET is not set # CONFIG_DGNC is not set # CONFIG_GS_FPGABOOT is not set -# CONFIG_CRYPTO_SKEIN is not set # CONFIG_UNISYSSPAR is not set # CONFIG_WILC1000_SDIO is not set # CONFIG_MOST is not set # CONFIG_KS7010 is not set # CONFIG_GREYBUS is not set -# CONFIG_X86_PLATFORM_DEVICES is not set +# CONFIG_DRM_VBOXVIDEO is not set +# CONFIG_MTK_MMC is not set + +# +# Gasket devices +# +# CONFIG_STAGING_GASKET_FRAMEWORK is not set +# CONFIG_XIL_AXIS_FIFO is not set +# CONFIG_EROFS_FS is not set +CONFIG_X86_PLATFORM_DEVICES=y +# CONFIG_ACER_WMI is not set +# CONFIG_ACER_WIRELESS is not set +# CONFIG_ACERHDF is not set +# CONFIG_ALIENWARE_WMI is not set +# CONFIG_ASUS_LAPTOP is not set +# CONFIG_DELL_SMBIOS is not set +# CONFIG_DELL_WMI_AIO is not set +# CONFIG_DELL_WMI_LED is not set +# CONFIG_DELL_SMO8800 is not set +# CONFIG_DELL_RBTN is not set +# CONFIG_FUJITSU_LAPTOP is not set +# CONFIG_FUJITSU_TABLET is not set +# CONFIG_AMILO_RFKILL is not set +# CONFIG_GPD_POCKET_FAN is not set +# CONFIG_HP_ACCEL is not set +# CONFIG_HP_WIRELESS is not set +# CONFIG_HP_WMI is not set +# CONFIG_MSI_LAPTOP is not set +# CONFIG_PANASONIC_LAPTOP is not set +# CONFIG_COMPAL_LAPTOP is not set +# CONFIG_SONY_LAPTOP is not set +# CONFIG_IDEAPAD_LAPTOP is not set +# CONFIG_THINKPAD_ACPI is not set +# CONFIG_SENSORS_HDAPS is not set +# CONFIG_INTEL_MENLOW is not set +# CONFIG_ASUS_WIRELESS is not set +CONFIG_ACPI_WMI=y +CONFIG_WMI_BMOF=y +# CONFIG_INTEL_WMI_THUNDERBOLT is not set +# CONFIG_MSI_WMI is not set +# CONFIG_PEAQ_WMI is not set +# CONFIG_TOPSTAR_LAPTOP is not set +# CONFIG_TOSHIBA_BT_RFKILL is not set +# CONFIG_TOSHIBA_HAPS is not set +# CONFIG_TOSHIBA_WMI is not set +# CONFIG_ACPI_CMPC is not set +# CONFIG_INTEL_INT0002_VGPIO is not set +# CONFIG_INTEL_HID_EVENT is not set +# CONFIG_INTEL_VBTN is not set +# CONFIG_INTEL_IPS is not set +# CONFIG_INTEL_PMC_CORE is not set +# CONFIG_IBM_RTL is not set +# CONFIG_SAMSUNG_LAPTOP is not set +# CONFIG_MXM_WMI is not set +# CONFIG_INTEL_OAKTRAIL is not set +# CONFIG_SAMSUNG_Q10 is not set +# CONFIG_APPLE_GMUX is not set +# CONFIG_INTEL_RST is not set +# CONFIG_INTEL_SMARTCONNECT is not set +# CONFIG_PVPANIC is not set +# CONFIG_INTEL_PMC_IPC is not set +# CONFIG_SURFACE_PRO3_BUTTON is not set +# CONFIG_INTEL_PUNIT_IPC is not set +# CONFIG_MLX_PLATFORM is not set +# CONFIG_INTEL_TURBO_MAX_3 is not set +# CONFIG_I2C_MULTI_INSTANTIATE is not set +CONFIG_PMC_ATOM=y # CONFIG_CHROME_PLATFORMS is not set +# CONFIG_MELLANOX_PLATFORM is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y @@ -4255,48 +4799,64 @@ CONFIG_COMMON_CLK=y # # Common Clock Framework # +# CONFIG_COMMON_CLK_MAX9485 is not set # CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI544 is not set # CONFIG_COMMON_CLK_CDCE706 is not set # CONFIG_COMMON_CLK_CS2000_CP is not set -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_PIC32 is not set - -# -# Hardware Spinlock drivers -# +# CONFIG_HWSPINLOCK is not set # # Clock Source drivers # CONFIG_CLKEVT_I8253=y CONFIG_CLKBLD_I8253=y -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -# CONFIG_MAILBOX is not set +CONFIG_MAILBOX=y +CONFIG_PCC=y +# CONFIG_ALTERA_MBOX is not set # CONFIG_IOMMU_SUPPORT is not set # # Remoteproc drivers # -# CONFIG_STE_MODEM_RPROC is not set +# CONFIG_REMOTEPROC is not set # # Rpmsg drivers # +# CONFIG_RPMSG_QCOM_GLINK_RPM is not set +# CONFIG_RPMSG_VIRTIO is not set +# CONFIG_SOUNDWIRE is not set # # SOC (System On Chip) specific Drivers # +# +# Amlogic SoC drivers +# + # # Broadcom SoC drivers # -# CONFIG_SUNXI_SRAM is not set + +# +# NXP/Freescale QorIQ SoC drivers +# + +# +# i.MX SoC drivers +# + +# +# Qualcomm SoC drivers +# # CONFIG_SOC_TI is not set + +# +# Xilinx SoC drivers +# +# CONFIG_XILINX_VCU is not set # CONFIG_PM_DEVFREQ is not set # CONFIG_EXTCON is not set # CONFIG_MEMORY is not set @@ -4304,20 +4864,26 @@ CONFIG_CLKBLD_I8253=y # CONFIG_NTB is not set # CONFIG_VME_BUS is not set # CONFIG_PWM is not set + +# +# IRQ chip support +# CONFIG_ARM_GIC_MAX_NR=1 # CONFIG_IPACK_BUS is not set -# CONFIG_RESET_CONTROLLER is not set +CONFIG_RESET_CONTROLLER=y +# CONFIG_RESET_TI_SYSCON is not set # CONFIG_FMC is not set # # PHY Subsystem # # CONFIG_GENERIC_PHY is not set +# CONFIG_BCM_KONA_USB2_PHY is not set # CONFIG_PHY_PXA_28NM_HSIC is not set # CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_BCM_KONA_USB2_PHY is not set CONFIG_POWERCAP=y CONFIG_INTEL_RAPL=m +# CONFIG_IDLE_INJECT is not set # CONFIG_MCB is not set # @@ -4331,41 +4897,18 @@ CONFIG_THUNDERBOLT=m # # CONFIG_ANDROID is not set # CONFIG_LIBNVDIMM is not set -# CONFIG_DEV_DAX is not set -# CONFIG_NVMEM is not set -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set +# CONFIG_DAX is not set +CONFIG_NVMEM=y -# -# FPGA Configuration Support -# -# CONFIG_FPGA is not set - -# -# Firmware Drivers -# -# CONFIG_EDD is not set -CONFIG_FIRMWARE_MEMMAP=y -# CONFIG_DELL_RBU is not set -# CONFIG_DCDBAS is not set -CONFIG_DMIID=y -CONFIG_DMI_SYSFS=m -CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y -CONFIG_ISCSI_IBFT_FIND=y -CONFIG_ISCSI_IBFT=y -# CONFIG_FW_CFG_SYSFS is not set -# CONFIG_GOOGLE_FIRMWARE is not set - -# -# EFI (Extensible Firmware Interface) Support -# -CONFIG_EFI_VARS=y -CONFIG_EFI_ESRT=y -# CONFIG_EFI_FAKE_MEMMAP is not set -CONFIG_EFI_RUNTIME_WRAPPERS=y -# CONFIG_EFI_BOOTLOADER_CONTROL is not set -# CONFIG_EFI_CAPSULE_LOADER is not set -# CONFIG_EFI_TEST is not set +# +# HW tracing support +# +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set +# CONFIG_FPGA is not set +# CONFIG_UNISYS_VISORBUS is not set +# CONFIG_SIOX is not set +# CONFIG_SLIMBUS is not set # # File systems @@ -4396,20 +4939,24 @@ CONFIG_XFS_FS=m # CONFIG_XFS_QUOTA is not set # CONFIG_XFS_POSIX_ACL is not set # CONFIG_XFS_RT is not set +# CONFIG_XFS_ONLINE_SCRUB is not set # CONFIG_XFS_WARN is not set # CONFIG_XFS_DEBUG is not set # CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set CONFIG_BTRFS_FS=y # CONFIG_BTRFS_FS_POSIX_ACL is not set # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set # CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set # CONFIG_BTRFS_DEBUG is not set # CONFIG_BTRFS_ASSERT is not set +# CONFIG_BTRFS_FS_REF_VERIFY is not set # CONFIG_NILFS2_FS is not set CONFIG_F2FS_FS=y CONFIG_F2FS_STAT_FS=y # CONFIG_F2FS_FS_XATTR is not set CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set # CONFIG_F2FS_FAULT_INJECTION is not set # CONFIG_FS_DAX is not set CONFIG_FS_POSIX_ACL=y @@ -4423,16 +4970,26 @@ CONFIG_DNOTIFY=y CONFIG_INOTIFY_USER=y CONFIG_FANOTIFY=y # CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set CONFIG_AUTOFS4_FS=y +CONFIG_AUTOFS_FS=y CONFIG_FUSE_FS=m # CONFIG_CUSE is not set CONFIG_OVERLAY_FS=m +# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y +# CONFIG_OVERLAY_FS_INDEX is not set +# CONFIG_OVERLAY_FS_XINO_AUTO is not set +# CONFIG_OVERLAY_FS_METACOPY is not set # # Caches # -# CONFIG_FSCACHE is not set +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set # # CD-ROM/DVD Filesystems @@ -4441,7 +4998,6 @@ CONFIG_ISO9660_FS=m CONFIG_JOLIET=y CONFIG_ZISOFS=y CONFIG_UDF_FS=m -CONFIG_UDF_NLS=y # # DOS/FAT/NT Filesystems @@ -4468,9 +5024,8 @@ CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y # CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_ARCH_HAS_GIGANTIC_PAGE=y -# CONFIG_CONFIGFS_FS is not set +CONFIG_MEMFD_CREATE=y +CONFIG_CONFIGFS_FS=y CONFIG_EFIVAR_FS=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_ORANGEFS_FS is not set @@ -4479,11 +5034,9 @@ CONFIG_MISC_FILESYSTEMS=y # CONFIG_ECRYPT_FS is not set # CONFIG_HFS_FS is not set CONFIG_HFSPLUS_FS=m -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set -# CONFIG_LOGFS is not set # CONFIG_CRAMFS is not set CONFIG_SQUASHFS=y # CONFIG_SQUASHFS_FILE_CACHE is not set @@ -4496,6 +5049,7 @@ CONFIG_SQUASHFS_ZLIB=y CONFIG_SQUASHFS_LZ4=y CONFIG_SQUASHFS_LZO=y CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y # CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set # CONFIG_SQUASHFS_EMBEDDED is not set CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 @@ -4523,6 +5077,7 @@ CONFIG_PNFS_FLEXFILE_LAYOUT=m CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" CONFIG_NFS_V4_1_MIGRATION=y CONFIG_ROOT_NFS=y +CONFIG_NFS_FSCACHE=y # CONFIG_NFS_USE_LEGACY_DNS is not set CONFIG_NFS_USE_KERNEL_DNS=y # CONFIG_NFSD is not set @@ -4530,294 +5085,94 @@ CONFIG_GRACE_PERIOD=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y - -# -# Kernel hacking -# -CONFIG_TRACE_IRQFLAGS_SUPPORT=y - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -# CONFIG_DEBUG_INFO is not set -# CONFIG_ENABLE_WARN_DEPRECATED is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_FRAME_WARN=1024 -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_PAGE_OWNER is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -# CONFIG_FRAME_POINTER is not set -# CONFIG_STACK_VALIDATION is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_VIRTUAL is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -# CONFIG_DEBUG_STACKOVERFLOW is not set -CONFIG_HAVE_ARCH_KMEMCHECK=y -# CONFIG_KMEMCHECK is not set -CONFIG_HAVE_ARCH_KASAN=y -# CONFIG_KASAN is not set -CONFIG_ARCH_HAS_KCOV=y -# CONFIG_KCOV is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -CONFIG_LOCKUP_DETECTOR=y -CONFIG_HARDLOCKUP_DETECTOR=y -# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -CONFIG_DETECT_HUNG_TASK=y -CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 -# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set -CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHED_INFO is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_TIMER_STATS is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_STACKTRACE is not set -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_LATENCYTOP is not set -CONFIG_USER_STACKTRACE_SUPPORT=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_FENTRY=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACING_SUPPORT=y -# CONFIG_FTRACE is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_MEMTEST is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_UBSAN is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -CONFIG_STRICT_DEVMEM=y -# CONFIG_IO_STRICT_DEVMEM is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -# CONFIG_EARLY_PRINTK is not set -# CONFIG_X86_PTDUMP_CORE is not set -# CONFIG_X86_PTDUMP is not set -# CONFIG_EFI_PGT_DUMP is not set -# CONFIG_DEBUG_RODATA_TEST is not set -# CONFIG_DEBUG_WX is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_NX_TEST is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_DEBUG_TLBFLUSH is not set -# CONFIG_IOMMU_DEBUG is not set -# CONFIG_IOMMU_STRESS is not set -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DEBUG_BOOT_PARAMS is not set -# CONFIG_CPA_DEBUG is not set -CONFIG_OPTIMIZE_INLINING=y -# CONFIG_DEBUG_ENTRY is not set -# CONFIG_DEBUG_NMI_SELFTEST is not set -CONFIG_X86_DEBUG_FPU=y -# CONFIG_PUNIT_ATOM_DEBUG is not set +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS2=y +CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_FSCACHE=y +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set # # Security options # CONFIG_KEYS=y +CONFIG_KEYS_COMPAT=y # CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set # CONFIG_ENCRYPTED_KEYS is not set # CONFIG_KEY_DH_OPERATIONS is not set # CONFIG_SECURITY_DMESG_RESTRICT is not set # CONFIG_SECURITY is not set # CONFIG_SECURITYFS is not set +CONFIG_PAGE_TABLE_ISOLATION=y CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y # CONFIG_HARDENED_USERCOPY is not set +# CONFIG_FORTIFY_SOURCE is not set +# CONFIG_STATIC_USERMODEHELPER is not set CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_DEFAULT_SECURITY="" CONFIG_XOR_BLOCKS=y @@ -4828,26 +5183,29 @@ CONFIG_CRYPTO=y # CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD=y CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=m +CONFIG_CRYPTO_RNG_DEFAULT=y CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y CONFIG_CRYPTO_KPP2=y -# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_KPP=m +CONFIG_CRYPTO_ACOMP2=y +CONFIG_CRYPTO_RSA=y # CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_ECDH is not set +CONFIG_CRYPTO_ECDH=m CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y # CONFIG_CRYPTO_USER is not set # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_GF128MUL=m -CONFIG_CRYPTO_NULL=m +CONFIG_CRYPTO_NULL=y CONFIG_CRYPTO_NULL2=y # CONFIG_CRYPTO_PCRYPT is not set CONFIG_CRYPTO_WORKQUEUE=y @@ -4859,17 +5217,29 @@ CONFIG_CRYPTO_WORKQUEUE=y # # Authenticated Encryption with Associated Data # -CONFIG_CRYPTO_CCM=m +CONFIG_CRYPTO_CCM=y CONFIG_CRYPTO_GCM=m # CONFIG_CRYPTO_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_SEQIV=m +# CONFIG_CRYPTO_AEGIS128 is not set +# CONFIG_CRYPTO_AEGIS128L is not set +# CONFIG_CRYPTO_AEGIS256 is not set +# CONFIG_CRYPTO_AEGIS128_AESNI_SSE2 is not set +# CONFIG_CRYPTO_AEGIS128L_AESNI_SSE2 is not set +# CONFIG_CRYPTO_AEGIS256_AESNI_SSE2 is not set +# CONFIG_CRYPTO_MORUS640 is not set +# CONFIG_CRYPTO_MORUS640_SSE2 is not set +# CONFIG_CRYPTO_MORUS1280 is not set +# CONFIG_CRYPTO_MORUS1280_SSE2 is not set +# CONFIG_CRYPTO_MORUS1280_AVX2 is not set +CONFIG_CRYPTO_SEQIV=y CONFIG_CRYPTO_ECHAINIV=m # # Block modes # CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m +CONFIG_CRYPTO_CFB=m +CONFIG_CRYPTO_CTR=y CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_ECB=y # CONFIG_CRYPTO_LRW is not set @@ -4911,8 +5281,9 @@ CONFIG_CRYPTO_SHA1=m # CONFIG_CRYPTO_SHA256_MB is not set # CONFIG_CRYPTO_SHA512_MB is not set CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set +CONFIG_CRYPTO_SHA512=y # CONFIG_CRYPTO_SHA3 is not set +# CONFIG_CRYPTO_SM3 is not set # CONFIG_CRYPTO_TGR192 is not set # CONFIG_CRYPTO_WP512 is not set # CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set @@ -4921,6 +5292,7 @@ CONFIG_CRYPTO_SHA256=y # Ciphers # CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_AES_TI is not set # CONFIG_CRYPTO_AES_X86_64 is not set # CONFIG_CRYPTO_AES_NI_INTEL is not set # CONFIG_CRYPTO_ANUBIS is not set @@ -4940,7 +5312,6 @@ CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_FCRYPT is not set # CONFIG_CRYPTO_KHAZAD is not set # CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SALSA20_X86_64 is not set # CONFIG_CRYPTO_CHACHA20 is not set # CONFIG_CRYPTO_CHACHA20_X86_64 is not set # CONFIG_CRYPTO_SEED is not set @@ -4948,6 +5319,7 @@ CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set # CONFIG_CRYPTO_SERPENT_AVX_X86_64 is not set # CONFIG_CRYPTO_SERPENT_AVX2_X86_64 is not set +# CONFIG_CRYPTO_SM4 is not set # CONFIG_CRYPTO_TEA is not set # CONFIG_CRYPTO_TWOFISH is not set # CONFIG_CRYPTO_TWOFISH_X86_64 is not set @@ -4962,37 +5334,46 @@ CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_842 is not set # CONFIG_CRYPTO_LZ4 is not set # CONFIG_CRYPTO_LZ4HC is not set +# CONFIG_CRYPTO_ZSTD is not set # # Random Number Generation # # CONFIG_CRYPTO_ANSI_CPRNG is not set -CONFIG_CRYPTO_DRBG_MENU=m +CONFIG_CRYPTO_DRBG_MENU=y CONFIG_CRYPTO_DRBG_HMAC=y # CONFIG_CRYPTO_DRBG_HASH is not set # CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=m -CONFIG_CRYPTO_JITTERENTROPY=m +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y # CONFIG_CRYPTO_USER_API_HASH is not set # CONFIG_CRYPTO_USER_API_SKCIPHER is not set # CONFIG_CRYPTO_USER_API_RNG is not set # CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y # CONFIG_CRYPTO_HW is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set # # Certificates for signature checking # -CONFIG_HAVE_KVM=y -# CONFIG_VIRTUALIZATION is not set -# CONFIG_BINARY_PRINTF is not set +CONFIG_SYSTEM_TRUSTED_KEYRING=y +CONFIG_SYSTEM_TRUSTED_KEYS="" +# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set +# CONFIG_SECONDARY_TRUSTED_KEYRING is not set +# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set +CONFIG_BINARY_PRINTF=y # # Library routines # CONFIG_RAID6_PQ=y CONFIG_BITREVERSE=y -# CONFIG_HAVE_ARCH_BITREVERSE is not set CONFIG_RATIONAL=y CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y @@ -5000,7 +5381,6 @@ CONFIG_GENERIC_NET_UTILS=y CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IO=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y CONFIG_ARCH_HAS_FAST_MULTIPLIER=y CONFIG_CRC_CCITT=y @@ -5013,16 +5393,20 @@ CONFIG_CRC32_SLICEBY8=y # CONFIG_CRC32_SLICEBY4 is not set # CONFIG_CRC32_SARWATE is not set # CONFIG_CRC32_BIT is not set +# CONFIG_CRC64 is not set +# CONFIG_CRC4 is not set # CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m +CONFIG_LIBCRC32C=y # CONFIG_CRC8 is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +CONFIG_XXHASH=y # CONFIG_RANDOM32_SELFTEST is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y CONFIG_XZ_DEC=y # CONFIG_XZ_DEC_X86 is not set # CONFIG_XZ_DEC_POWERPC is not set @@ -5030,7 +5414,6 @@ CONFIG_XZ_DEC=y # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set # CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set # CONFIG_XZ_DEC_TEST is not set CONFIG_DECOMPRESS_GZIP=y CONFIG_INTERVAL_TREE=y @@ -5039,24 +5422,291 @@ CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_DMA_DIRECT_OPS=y +CONFIG_SWIOTLB=y +CONFIG_SGL_ALLOC=y +CONFIG_IOMMU_HELPER=y CONFIG_CHECK_SIGNATURE=y CONFIG_CPU_RMAP=y CONFIG_DQL=y CONFIG_GLOB=y # CONFIG_GLOB_SELFTEST is not set CONFIG_NLATTR=y +CONFIG_CLZ_TAB=y # CONFIG_CORDIC is not set # CONFIG_DDR is not set # CONFIG_IRQ_POLL is not set +CONFIG_MPILIB=y CONFIG_OID_REGISTRY=y CONFIG_UCS2_STRING=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y CONFIG_FONT_8x16=y -# CONFIG_SG_SPLIT is not set CONFIG_SG_POOL=y CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_ARCH_HAS_PMEM_API=y -CONFIG_ARCH_HAS_MMIO_FLUSH=y +CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y CONFIG_SBITMAP=y +# CONFIG_STRING_SELFTEST is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_CONSOLE_LOGLEVEL_QUIET=4 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +CONFIG_STACK_VALIDATION=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_PAGE_REF is not set +# CONFIG_DEBUG_RODATA_TEST is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_HAVE_DEBUG_STACKOVERFLOW=y +# CONFIG_DEBUG_STACKOVERFLOW is not set +CONFIG_HAVE_ARCH_KASAN=y +# CONFIG_KASAN is not set +CONFIG_ARCH_HAS_KCOV=y +CONFIG_CC_HAS_SANCOV_TRACE_PC=y +# CONFIG_KCOV is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +CONFIG_SOFTLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +CONFIG_HARDLOCKUP_DETECTOR_PERF=y +CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y +CONFIG_HARDLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +CONFIG_LOCK_DEBUGGING_SUPPORT=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_RWSEMS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_WW_MUTEX_SELFTEST is not set +CONFIG_TRACE_IRQFLAGS=y +CONFIG_STACKTRACE=y +# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_RCU_PERF_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +CONFIG_FUNCTION_ERROR_INJECTION=y +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_FENTRY=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACER_MAX_TRACE=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_RING_BUFFER_ALLOW_SWAP=y +CONFIG_PREEMPTIRQ_TRACEPOINTS=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y +# CONFIG_HWLAT_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_TRACER_SNAPSHOT=y +CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +CONFIG_STACK_TRACER=y +CONFIG_BLK_DEV_IO_TRACE=y +CONFIG_KPROBE_EVENTS=y +# CONFIG_KPROBE_EVENTS_ON_NOTRACE is not set +# CONFIG_UPROBE_EVENTS is not set +CONFIG_BPF_EVENTS=y +CONFIG_PROBE_EVENTS=y +CONFIG_DYNAMIC_FTRACE=y +CONFIG_DYNAMIC_FTRACE_WITH_REGS=y +# CONFIG_FUNCTION_PROFILER is not set +# CONFIG_BPF_KPROBE_OVERRIDE is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_MMIOTRACE is not set +# CONFIG_HIST_TRIGGERS is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_PREEMPTIRQ_DELAY_TEST is not set +# CONFIG_TRACE_EVAL_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +# CONFIG_DMA_API_DEBUG is not set +CONFIG_RUNTIME_TESTING_MENU=y +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_TEST_SORT is not set +# CONFIG_KPROBES_SANITY_TEST is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_BITFIELD is not set +# CONFIG_TEST_UUID is not set +# CONFIG_TEST_OVERFLOW is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_TEST_HASH is not set +# CONFIG_TEST_IDA is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_FIND_BIT_BENCHMARK is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_SYSCTL is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_TEST_KMOD is not set +# CONFIG_MEMTEST is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +CONFIG_STRICT_DEVMEM=y +# CONFIG_IO_STRICT_DEVMEM is not set +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +# CONFIG_X86_VERBOSE_BOOTUP is not set +# CONFIG_EARLY_PRINTK is not set +# CONFIG_X86_PTDUMP is not set +# CONFIG_EFI_PGT_DUMP is not set +# CONFIG_DEBUG_WX is not set +CONFIG_DOUBLEFAULT=y +# CONFIG_DEBUG_TLBFLUSH is not set +# CONFIG_IOMMU_DEBUG is not set +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +# CONFIG_X86_DECODER_SELFTEST is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DEBUG_BOOT_PARAMS is not set +# CONFIG_CPA_DEBUG is not set +CONFIG_OPTIMIZE_INLINING=y +# CONFIG_DEBUG_ENTRY is not set +# CONFIG_DEBUG_NMI_SELFTEST is not set +CONFIG_X86_DEBUG_FPU=y +# CONFIG_PUNIT_ATOM_DEBUG is not set +# CONFIG_UNWINDER_ORC is not set +CONFIG_UNWINDER_FRAME_POINTER=y +# CONFIG_UNWINDER_GUESS is not set diff --git a/projects/Generic/options b/projects/Generic/options index 82dc2622ce..99b3b9f02e 100644 --- a/projects/Generic/options +++ b/projects/Generic/options @@ -11,6 +11,7 @@ # (Intel CPUs) atom core2 nocona # TARGET_CPU="x86-64" + TARGET_FEATURES="64bit" ;; esac @@ -35,6 +36,9 @@ # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="" + # Kernel to use. values can be: # default: default mainline kernel LINUX="default" @@ -45,9 +49,9 @@ ################################################################################ # Project CFLAGS - PROJECT_CFLAGS="-mmmx -msse -msse2 -mfpmath=sse" + PROJECT_CFLAGS="" - # SquashFS compression method (gzip / lzo / xz) + # SquashFS compression method (gzip / lzo / xz / zstd) SQUASHFS_COMPRESSION="gzip" @@ -79,10 +83,21 @@ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware iwlwifi-firmware" + FIRMWARE="misc-firmware wlan-firmware iwlwifi-firmware" # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers + # for a list of additional drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta media_build" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta intel_nuc_led" + + # build and install driver addons (yes / no) + DRIVER_ADDONS_SUPPORT="yes" + + # driver addons to install: + # for a list of additional drivers see packages/linux-driver-addons + # Space separated list is supported, + DRIVER_ADDONS="crazycat digital_devices dvb-latest" + + # Default size of the ova image, in MB, eg. 4096 + OVA_SIZE="4096" diff --git a/projects/Generic/packages/linux/modprobe.d/ath9k.conf b/projects/Generic/packages/linux/modprobe.d/ath9k.conf new file mode 100644 index 0000000000..608c4b6570 --- /dev/null +++ b/projects/Generic/packages/linux/modprobe.d/ath9k.conf @@ -0,0 +1,5 @@ +# ath9k.conf: setup modload options for module ath9k. +# +# enable "Channel Context support" to avoid buffering in live TV + +options ath9k use_chanctx=1 diff --git a/projects/Generic/patches/linux/linux-030-LPE-audio-hdmi-BYT-CHT.patch b/projects/Generic/patches/linux/linux-030-LPE-audio-hdmi-BYT-CHT.patch deleted file mode 100644 index 9778657b37..0000000000 --- a/projects/Generic/patches/linux/linux-030-LPE-audio-hdmi-BYT-CHT.patch +++ /dev/null @@ -1,5124 +0,0 @@ -From b6c2cac5f8ddc368f455dcccfec397898c77bca4 Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:37 +0530 -Subject: [PATCH 1/7] drm/i915: setup bridge for HDMI LPE audio driver - -Enable support for HDMI LPE audio mode on Baytrail and -Cherrytrail when HDaudio controller is not detected - -Setup minimum required resources during i915_driver_load: -1. Create a platform device to share MMIO/IRQ resources -2. Make the platform device child of i915 device for runtime PM. -3. Create IRQ chip to forward HDMI LPE audio irqs. - -HDMI LPE audio driver (a standalone sound driver) probes the -LPE audio device and creates a new sound card. - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - drivers/gpu/drm/i915/Makefile | 3 + - drivers/gpu/drm/i915/i915_drv.c | 8 +- - drivers/gpu/drm/i915/i915_drv.h | 15 ++ - drivers/gpu/drm/i915/i915_irq.c | 27 +++ - drivers/gpu/drm/i915/i915_reg.h | 3 + - drivers/gpu/drm/i915/intel_lpe_audio.c | 363 +++++++++++++++++++++++++++++++++ - include/drm/intel_lpe_audio.h | 45 ++++ - 7 files changed, 462 insertions(+), 2 deletions(-) - create mode 100644 drivers/gpu/drm/i915/intel_lpe_audio.c - create mode 100644 include/drm/intel_lpe_audio.h - -diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile -index a998c2b..31a03caf 100644 ---- a/drivers/gpu/drm/i915/Makefile -+++ b/drivers/gpu/drm/i915/Makefile -@@ -115,6 +115,9 @@ i915-y += intel_gvt.o - include $(src)/gvt/Makefile - endif - -+# LPE Audio for VLV and CHT -+i915-y += intel_lpe_audio.o -+ - obj-$(CONFIG_DRM_I915) += i915.o - - CFLAGS_i915_trace_points.o := -I$(src) -diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c -index 18dfdd5..f15e7f6 100644 ---- a/drivers/gpu/drm/i915/i915_drv.c -+++ b/drivers/gpu/drm/i915/i915_drv.c -@@ -1134,7 +1134,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) - if (IS_GEN5(dev_priv)) - intel_gpu_ips_init(dev_priv); - -- i915_audio_component_init(dev_priv); -+ if (intel_lpe_audio_init(dev_priv) < 0) -+ i915_audio_component_init(dev_priv); - - /* - * Some ports require correctly set-up hpd registers for detection to -@@ -1152,7 +1153,10 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) - */ - static void i915_driver_unregister(struct drm_i915_private *dev_priv) - { -- i915_audio_component_cleanup(dev_priv); -+ if (HAS_LPE_AUDIO(dev_priv)) -+ intel_lpe_audio_teardown(dev_priv); -+ else -+ i915_audio_component_cleanup(dev_priv); - - intel_gpu_ips_teardown(); - acpi_video_unregister(); -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h -index 685e9e06..0970d6a 100644 ---- a/drivers/gpu/drm/i915/i915_drv.h -+++ b/drivers/gpu/drm/i915/i915_drv.h -@@ -2081,6 +2081,12 @@ struct drm_i915_private { - - struct intel_encoder *dig_port_map[I915_MAX_PORTS]; - -+ /* necessary resource sharing with HDMI LPE audio driver. */ -+ struct { -+ struct platform_device *platdev; -+ int irq; -+ } lpe_audio; -+ - /* - * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch - * will be rejected. Instead look for a better place. -@@ -2819,6 +2825,8 @@ struct drm_i915_cmd_table { - - #define HAS_POOLED_EU(dev) (INTEL_INFO(dev)->has_pooled_eu) - -+#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev != NULL) -+ - #define INTEL_PCH_DEVICE_ID_MASK 0xff00 - #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 - #define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00 -@@ -3569,6 +3577,13 @@ extern int i915_restore_state(struct drm_device *dev); - void i915_setup_sysfs(struct drm_i915_private *dev_priv); - void i915_teardown_sysfs(struct drm_i915_private *dev_priv); - -+/* i915_lpe_audio.c */ -+int intel_lpe_audio_init(struct drm_i915_private *dev_priv); -+int intel_lpe_audio_setup(struct drm_i915_private *dev_priv); -+void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv); -+void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv); -+bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv); -+ - /* intel_i2c.c */ - extern int intel_setup_gmbus(struct drm_device *dev); - extern void intel_teardown_gmbus(struct drm_device *dev); -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c -index 3fc286c..1af76e5 100644 ---- a/drivers/gpu/drm/i915/i915_irq.c -+++ b/drivers/gpu/drm/i915/i915_irq.c -@@ -1797,6 +1797,14 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg) - valleyview_pipestat_irq_ack(dev_priv, iir, pipe_stats); - - /* -+ * LPE audio interrupts are only enabled on Baytrail and -+ * CherryView platforms without HDaudio -+ */ -+ if (iir & (I915_LPE_PIPE_A_INTERRUPT | -+ I915_LPE_PIPE_B_INTERRUPT)) -+ intel_lpe_audio_irq_handler(dev_priv); -+ -+ /* - * VLV_IIR is single buffered, and reflects the level - * from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last. - */ -@@ -1877,6 +1885,15 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg) - valleyview_pipestat_irq_ack(dev_priv, iir, pipe_stats); - - /* -+ * LPE audio interrupts are only enabled on Baytrail and -+ * CherryView platforms without HDaudio -+ */ -+ if (iir & (I915_LPE_PIPE_A_INTERRUPT | -+ I915_LPE_PIPE_B_INTERRUPT | -+ I915_LPE_PIPE_C_INTERRUPT)) -+ intel_lpe_audio_irq_handler(dev_priv); -+ -+ /* - * VLV_IIR is single buffered, and reflects the level - * from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last. - */ -@@ -3263,6 +3280,7 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv) - u32 pipestat_mask; - u32 enable_mask; - enum pipe pipe; -+ u32 val; - - pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | - PIPE_CRC_DONE_INTERRUPT_STATUS; -@@ -3279,6 +3297,15 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv) - - WARN_ON(dev_priv->irq_mask != ~0); - -+ /* add interrupt masks unconditially here, the actual unmask -+ * will take place only if the LPE_AUDIO mode is detected -+ */ -+ val = (I915_LPE_PIPE_A_INTERRUPT | -+ I915_LPE_PIPE_B_INTERRUPT | -+ I915_LPE_PIPE_C_INTERRUPT); -+ -+ enable_mask |= val; -+ - dev_priv->irq_mask = ~enable_mask; - - GEN5_IRQ_INIT(VLV_, dev_priv->irq_mask, enable_mask); -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h -index 70d9616..570d293 100644 ---- a/drivers/gpu/drm/i915/i915_reg.h -+++ b/drivers/gpu/drm/i915/i915_reg.h -@@ -2133,6 +2133,9 @@ enum skl_disp_power_wells { - #define I915_ASLE_INTERRUPT (1<<0) - #define I915_BSD_USER_INTERRUPT (1<<25) - -+#define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000) -+#define I915_HDMI_LPE_AUDIO_SIZE 0x1000 -+ - #define GEN6_BSD_RNCID _MMIO(0x12198) - - #define GEN7_FF_THREAD_MODE _MMIO(0x20a0) -diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c -new file mode 100644 -index 0000000..e12e5f7 ---- /dev/null -+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c -@@ -0,0 +1,363 @@ -+/* -+ * Copyright © 2016 Intel Corporation -+ * -+ * 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 (including the next -+ * paragraph) 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. -+ * -+ * Authors: -+ * Pierre-Louis Bossart -+ * Jerome Anand -+ * based on VED patches -+ * -+ */ -+ -+/** -+ * DOC: LPE Audio integration for HDMI or DP playback -+ * -+ * Motivation: -+ * Atom platforms (e.g. valleyview and cherryTrail) integrates a DMA-based -+ * interface as an alternative to the traditional HDaudio path. While this -+ * mode is unrelated to the LPE aka SST audio engine, the documentation refers -+ * to this mode as LPE so we keep this notation for the sake of consistency. -+ * -+ * The interface is handled by a separate standalone driver maintained in the -+ * ALSA subsystem for simplicity. To minimize the interaction between the two -+ * subsystems, a bridge is setup between the hdmi-lpe-audio and i915: -+ * 1. Create a platform device to share MMIO/IRQ resources -+ * 2. Make the platform device child of i915 device for runtime PM. -+ * 3. Create IRQ chip to forward the LPE audio irqs. -+ * the hdmi-lpe-audio driver probes the lpe audio device and creates a new -+ * sound card -+ * -+ * Threats: -+ * Due to the restriction in Linux platform device model, user need manually -+ * uninstall the hdmi-lpe-audio driver before uninstalling i915 module, -+ * otherwise we might run into use-after-free issues after i915 removes the -+ * platform device: even though hdmi-lpe-audio driver is released, the modules -+ * is still in "installed" status. -+ * -+ * Implementation: -+ * The MMIO/REG platform resources are created according to the registers -+ * specification. -+ * When forwarding LPE audio irqs, the flow control handler selection depends -+ * on the platform, for example on valleyview handle_simple_irq is enough. -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include "i915_drv.h" -+#include -+#include -+ -+static struct platform_device* -+lpe_audio_platdev_create(struct drm_i915_private *dev_priv) -+{ -+ struct drm_device *dev = &dev_priv->drm; -+ int ret; -+ struct resource rsc[2] = {}; -+ struct platform_device *platdev; -+ u64 *dma_mask; -+ struct intel_hdmi_lpe_audio_pdata *pdata; -+ -+ if (dev_priv->lpe_audio.irq < 0) -+ return ERR_PTR(-EINVAL); -+ -+ platdev = platform_device_alloc("hdmi-lpe-audio", -1); -+ if (!platdev) { -+ ret = -ENOMEM; -+ DRM_ERROR("Failed to allocate LPE audio platform device\n"); -+ goto err; -+ } -+ -+ /* to work-around check_addr in nommu_map_sg() */ -+ dma_mask = kmalloc(sizeof(*platdev->dev.dma_mask), GFP_KERNEL); -+ if (!dma_mask) { -+ ret = -ENOMEM; -+ DRM_ERROR("Failed to allocate dma_mask\n"); -+ goto err_put_dev; -+ } -+ *dma_mask = DMA_BIT_MASK(32); -+ platdev->dev.dma_mask = dma_mask; -+ platdev->dev.coherent_dma_mask = *dma_mask; -+ -+ rsc[0].start = rsc[0].end = dev_priv->lpe_audio.irq; -+ rsc[0].flags = IORESOURCE_IRQ; -+ rsc[0].name = "hdmi-lpe-audio-irq"; -+ -+ rsc[1].start = pci_resource_start(dev->pdev, 0) + -+ I915_HDMI_LPE_AUDIO_BASE; -+ rsc[1].end = pci_resource_start(dev->pdev, 0) + -+ I915_HDMI_LPE_AUDIO_BASE + I915_HDMI_LPE_AUDIO_SIZE - 1; -+ rsc[1].flags = IORESOURCE_MEM; -+ rsc[1].name = "hdmi-lpe-audio-mmio"; -+ -+ ret = platform_device_add_resources(platdev, rsc, 2); -+ if (ret) { -+ DRM_ERROR("Failed to add resource for platform device: %d\n", -+ ret); -+ goto err_put_dev; -+ } -+ -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); -+ -+ if (pdata == NULL) { -+ ret = -ENOMEM; -+ goto err_put_dev; -+ } -+ platdev->dev.platform_data = pdata; -+ spin_lock_init(&pdata->lpe_audio_slock); -+ -+ /* for LPE audio driver's runtime-PM */ -+ platdev->dev.parent = dev->dev; -+ ret = platform_device_add(platdev); -+ if (ret) { -+ DRM_ERROR("Failed to add LPE audio platform device: %d\n", -+ ret); -+ goto err_put_dev; -+ } -+ -+ return platdev; -+err_put_dev: -+ platform_device_put(platdev); -+ kfree(dma_mask); -+err: -+ return ERR_PTR(ret); -+} -+ -+static void lpe_audio_platdev_destroy(struct drm_i915_private *dev_priv) -+{ -+ platform_device_unregister(dev_priv->lpe_audio.platdev); -+ kfree(dev_priv->lpe_audio.platdev->dev.dma_mask); -+} -+ -+static void lpe_audio_irq_unmask(struct irq_data *d) -+{ -+ struct drm_i915_private *dev_priv = d->chip_data; -+ unsigned long irqflags; -+ u32 val = (I915_LPE_PIPE_A_INTERRUPT | -+ I915_LPE_PIPE_B_INTERRUPT); -+ -+ spin_lock_irqsave(&dev_priv->irq_lock, irqflags); -+ -+ /* -+ * VLV_IER is already set in the vlv_display_postinstall(), -+ * we only change VLV_IIR and VLV_IMR -+ */ -+ dev_priv->irq_mask &= ~val; -+ I915_WRITE(VLV_IIR, val); -+ I915_WRITE(VLV_IIR, val); -+ I915_WRITE(VLV_IMR, dev_priv->irq_mask); -+ POSTING_READ(VLV_IMR); -+ -+ spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); -+} -+ -+static void lpe_audio_irq_mask(struct irq_data *d) -+{ -+ struct drm_i915_private *dev_priv = d->chip_data; -+ unsigned long irqflags; -+ u32 val = (I915_LPE_PIPE_A_INTERRUPT | -+ I915_LPE_PIPE_B_INTERRUPT); -+ -+ spin_lock_irqsave(&dev_priv->irq_lock, irqflags); -+ -+ /* -+ * VLV_IER is already set in the vlv_display_postinstall(), -+ * we only change VLV_IIR and VLV_IMR -+ */ -+ dev_priv->irq_mask |= val; -+ I915_WRITE(VLV_IMR, dev_priv->irq_mask); -+ I915_WRITE(VLV_IIR, val); -+ I915_WRITE(VLV_IIR, val); -+ POSTING_READ(VLV_IIR); -+ -+ spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); -+} -+ -+static struct irq_chip lpe_audio_irqchip = { -+ .name = "hdmi_lpe_audio_irqchip", -+ .irq_mask = lpe_audio_irq_mask, -+ .irq_unmask = lpe_audio_irq_unmask, -+}; -+ -+static int lpe_audio_irq_init(struct drm_i915_private *dev_priv) -+{ -+ int irq = dev_priv->lpe_audio.irq; -+ -+ WARN_ON(!intel_irqs_enabled(dev_priv)); -+ irq_set_chip_and_handler_name(irq, -+ &lpe_audio_irqchip, -+ handle_simple_irq, -+ "hdmi_lpe_audio_irq_handler"); -+ -+ return irq_set_chip_data(irq, dev_priv); -+} -+ -+/** -+ * intel_lpe_audio_irq_handler() - forwards the LPE audio irq -+ * @dev_priv: the i915 drm device private data -+ * -+ * the LPE Audio irq is forwarded to the irq handler registered by LPE audio -+ * driver. -+ */ -+void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv) -+{ -+ int ret; -+ -+ ret = generic_handle_irq(dev_priv->lpe_audio.irq); -+ if (ret) -+ DRM_ERROR_RATELIMITED("error handling LPE audio irq: %d\n", -+ ret); -+} -+ -+/** -+ * intel_lpe_audio_detect() - check & setup lpe audio if present -+ * @dev_priv: the i915 drm device private data -+ * -+ * Detect if lpe audio is present -+ * -+ * Return: true if lpe audio present else Return = false -+ */ -+bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv) -+{ -+ int lpe_present = false; -+ -+ if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { -+ static const struct pci_device_id atom_hdaudio_ids[] = { -+ /* Baytrail */ -+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0f04)}, -+ /* Braswell */ -+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2284)}, -+ {} -+ }; -+ -+ if (!pci_dev_present(atom_hdaudio_ids)) { -+ DRM_INFO("%s%s\n", "HDaudio controller not detected,", -+ "using LPE audio instead\n"); -+ lpe_present = true; -+ } -+ } -+ return lpe_present; -+} -+ -+/** -+ * intel_lpe_audio_setup() - setup the bridge between HDMI LPE Audio -+ * driver and i915 -+ * @dev_priv: the i915 drm device private data -+ * -+ * set up the minimum required resources for the bridge: irq chip, -+ * platform resource and platform device. i915 device is set as parent -+ * of the new platform device. -+ * -+ * Return: 0 if successful. non-zero if allocation/initialization fails -+ */ -+int intel_lpe_audio_setup(struct drm_i915_private *dev_priv) -+{ -+ int ret; -+ -+ dev_priv->lpe_audio.irq = irq_alloc_desc(0); -+ if (dev_priv->lpe_audio.irq < 0) { -+ DRM_ERROR("Failed to allocate IRQ desc: %d\n", -+ dev_priv->lpe_audio.irq); -+ ret = dev_priv->lpe_audio.irq; -+ goto err; -+ } -+ -+ DRM_DEBUG("irq = %d\n", dev_priv->lpe_audio.irq); -+ -+ ret = lpe_audio_irq_init(dev_priv); -+ -+ if (ret) { -+ DRM_ERROR("Failed to initialize irqchip for lpe audio: %d\n", -+ ret); -+ goto err_free_irq; -+ } -+ -+ dev_priv->lpe_audio.platdev = lpe_audio_platdev_create(dev_priv); -+ -+ if (IS_ERR(dev_priv->lpe_audio.platdev)) { -+ ret = PTR_ERR(dev_priv->lpe_audio.platdev); -+ DRM_ERROR("Failed to create lpe audio platform device: %d\n", -+ ret); -+ goto err_free_irq; -+ } -+ -+ return 0; -+err_free_irq: -+ irq_free_desc(dev_priv->lpe_audio.irq); -+err: -+ dev_priv->lpe_audio.irq = -1; -+ dev_priv->lpe_audio.platdev = NULL; -+ return ret; -+} -+ -+ -+/** -+ * intel_lpe_audio_init() - detect and setup the bridge between HDMI LPE Audio -+ * driver and i915 -+ * @dev_priv: the i915 drm device private data -+ * -+ * Return: 0 if successful. non-zero if detection or -+ * llocation/initialization fails -+ */ -+int intel_lpe_audio_init(struct drm_i915_private *dev_priv) -+{ -+ int ret = -ENODEV; -+ -+ if (intel_lpe_audio_detect(dev_priv)) { -+ ret = intel_lpe_audio_setup(dev_priv); -+ if (ret < 0) -+ DRM_ERROR("failed to setup LPE Audio bridge\n"); -+ } -+ return ret; -+} -+ -+/** -+ * intel_lpe_audio_teardown() - destroy the bridge between HDMI LPE -+ * audio driver and i915 -+ * @dev_priv: the i915 drm device private data -+ * -+ * release all the resources for LPE audio <-> i915 bridge. -+ */ -+void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) -+{ -+ unsigned long irqflags; -+ struct irq_desc *desc; -+ -+ if (!HAS_LPE_AUDIO(dev_priv)) -+ return; -+ -+ desc = irq_to_desc(dev_priv->lpe_audio.irq); -+ -+ /** -+ * mask LPE audio irq before destroying -+ */ -+ lpe_audio_irq_mask(&desc->irq_data); -+ -+ spin_lock_irqsave(&dev_priv->irq_lock, irqflags); -+ -+ lpe_audio_platdev_destroy(dev_priv); -+ -+ irq_free_desc(dev_priv->lpe_audio.irq); -+ -+ spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); -+} -diff --git a/include/drm/intel_lpe_audio.h b/include/drm/intel_lpe_audio.h -new file mode 100644 -index 0000000..a64c449 ---- /dev/null -+++ b/include/drm/intel_lpe_audio.h -@@ -0,0 +1,45 @@ -+/* -+ * Copyright © 2016 Intel Corporation -+ * -+ * 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 (including the next -+ * paragraph) 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. -+ */ -+ -+#ifndef _INTEL_LPE_AUDIO_H_ -+#define _INTEL_LPE_AUDIO_H_ -+ -+#include -+ -+#define HDMI_MAX_ELD_BYTES 128 -+ -+struct intel_hdmi_lpe_audio_eld { -+ int port_id; -+ unsigned char eld_data[HDMI_MAX_ELD_BYTES]; -+}; -+ -+struct intel_hdmi_lpe_audio_pdata { -+ bool notify_pending; -+ int tmds_clock_speed; -+ bool hdmi_connected; -+ struct intel_hdmi_lpe_audio_eld eld; -+ void (*notify_audio_lpe)(void *audio_ptr); -+ spinlock_t lpe_audio_slock; -+}; -+ -+#endif /* _I915_LPE_AUDIO_H_ */ - -From 026d0fa9c02c44917e07aaac6542ff79313bea25 Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:38 +0530 -Subject: [PATCH 2/7] drm/i915: Add support for audio driver notifications - -Notifiations like mode change, hot plug and edid to -the audio driver are added. This is inturn used by the -audio driver for its functionality. - -A new interface file capturing the notifications needed by the -audio driver is added - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - drivers/gpu/drm/i915/i915_drv.h | 3 +++ - drivers/gpu/drm/i915/intel_audio.c | 8 ++++++ - drivers/gpu/drm/i915/intel_hdmi.c | 1 + - drivers/gpu/drm/i915/intel_lpe_audio.c | 46 ++++++++++++++++++++++++++++++++++ - include/drm/intel_lpe_audio.h | 1 + - 5 files changed, 59 insertions(+) - -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h -index 0970d6a..c7c6c3a 100644 ---- a/drivers/gpu/drm/i915/i915_drv.h -+++ b/drivers/gpu/drm/i915/i915_drv.h -@@ -3583,6 +3583,9 @@ int intel_lpe_audio_setup(struct drm_i915_private *dev_priv); - void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv); - void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv); - bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv); -+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, -+ void *eld, int port, int tmds_clk_speed, -+ bool connected); - - /* intel_i2c.c */ - extern int intel_setup_gmbus(struct drm_device *dev); -diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c -index 6c70a5b..bb2817a 100644 ---- a/drivers/gpu/drm/i915/intel_audio.c -+++ b/drivers/gpu/drm/i915/intel_audio.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - #include "intel_drv.h" - - #include -@@ -525,6 +526,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) - - if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port); -+ -+ if (HAS_LPE_AUDIO(dev_priv)) -+ intel_lpe_audio_notify(dev_priv, connector->eld, port, -+ crtc->config->port_clock, true); - } - - /** -@@ -553,6 +558,9 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder) - - if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) - acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port); -+ -+ if (HAS_LPE_AUDIO(dev_priv)) -+ intel_lpe_audio_notify(dev_priv, NULL, port, 0, true); - } - - /** -diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c -index 13c30617..188e935 100644 ---- a/drivers/gpu/drm/i915/intel_hdmi.c -+++ b/drivers/gpu/drm/i915/intel_hdmi.c -@@ -36,6 +36,7 @@ - #include - #include "intel_drv.h" - #include -+#include - #include "i915_drv.h" - - static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi) -diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c -index e12e5f7..a141a9c 100644 ---- a/drivers/gpu/drm/i915/intel_lpe_audio.c -+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c -@@ -361,3 +361,49 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) - - spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); - } -+ -+ -+/** -+ * intel_lpe_audio_notify() - notify lpe audio event -+ * audio driver and i915 -+ * @dev_priv: the i915 drm device private data -+ * @eld : ELD data -+ * @port: port id -+ * @tmds_clk_speed: tmds clock frequency in Hz -+ * @connected: hdmi connected/disconnected -+ * -+ * Notify lpe audio driver of eld change. -+ */ -+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, -+ void *eld, int port, int tmds_clk_speed, -+ bool connected) -+{ -+ unsigned long irq_flags; -+ -+ if (HAS_LPE_AUDIO(dev_priv)) { -+ struct intel_hdmi_lpe_audio_pdata *pdata = dev_get_platdata( -+ &(dev_priv->lpe_audio.platdev->dev)); -+ -+ spin_lock_irqsave(&pdata->lpe_audio_slock, -+ irq_flags); -+ -+ if (eld != NULL) { -+ memcpy(pdata->eld.eld_data, eld, -+ HDMI_MAX_ELD_BYTES); -+ pdata->eld.port_id = port; -+ -+ if (tmds_clk_speed) -+ pdata->tmds_clock_speed = -+ tmds_clk_speed; -+ } -+ pdata->hdmi_connected = connected; -+ if (pdata->notify_audio_lpe) -+ pdata->notify_audio_lpe( -+ (eld != NULL) ? &pdata->eld : NULL); -+ else -+ pdata->notify_pending = true; -+ -+ spin_unlock_irqrestore(&pdata->lpe_audio_slock, -+ irq_flags); -+ } -+} -diff --git a/include/drm/intel_lpe_audio.h b/include/drm/intel_lpe_audio.h -index a64c449..952de05 100644 ---- a/include/drm/intel_lpe_audio.h -+++ b/include/drm/intel_lpe_audio.h -@@ -25,6 +25,7 @@ - #define _INTEL_LPE_AUDIO_H_ - - #include -+#include - - #define HDMI_MAX_ELD_BYTES 128 - - -From 583eb2ed11912125c7a63147a7e861c615dcb134 Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:39 +0530 -Subject: [PATCH 3/7] ALSA: add shell for Intel HDMI LPE audio driver - -On Baytrail and Cherrytrail, HDaudio may be fused out or disabled -by the BIOS. This driver enables an alternate path to the i915 -display registers and DMA. - -Although there is no hardware path between i915 display and LPE/SST -audio clusters, this HDMI capability is referred to in the documentation -as "HDMI LPE Audio" so we keep the name for consistency. There is no -hardware path or control dependencies with the LPE/SST DSP functionality. - -The hdmi-lpe-audio driver will be probed when the i915 driver creates -a child platform device. - -Since this driver is neither SoC nor PCI, a new x86 folder is added - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - sound/Kconfig | 2 + - sound/Makefile | 2 +- - sound/x86/Kconfig | 16 + - sound/x86/Makefile | 8 + - sound/x86/intel_hdmi_lpe_audio.c | 622 +++++++++++++++++++++++++++++++++++ - sound/x86/intel_hdmi_lpe_audio.h | 692 +++++++++++++++++++++++++++++++++++++++ - 6 files changed, 1341 insertions(+), 1 deletion(-) - create mode 100644 sound/x86/Kconfig - create mode 100644 sound/x86/Makefile - create mode 100644 sound/x86/intel_hdmi_lpe_audio.c - create mode 100644 sound/x86/intel_hdmi_lpe_audio.h - -diff --git a/sound/Kconfig b/sound/Kconfig -index 5a240e0..ee2e69a 100644 ---- a/sound/Kconfig -+++ b/sound/Kconfig -@@ -108,6 +108,8 @@ source "sound/parisc/Kconfig" - - source "sound/soc/Kconfig" - -+source "sound/x86/Kconfig" -+ - endif # SND - - menuconfig SOUND_PRIME -diff --git a/sound/Makefile b/sound/Makefile -index c41bdf5..6de45d2 100644 ---- a/sound/Makefile -+++ b/sound/Makefile -@@ -5,7 +5,7 @@ obj-$(CONFIG_SOUND) += soundcore.o - obj-$(CONFIG_SOUND_PRIME) += oss/ - obj-$(CONFIG_DMASOUND) += oss/ - obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \ -- firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ -+ firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ - obj-$(CONFIG_SND_AOA) += aoa/ - - # This one must be compilable even if sound is configured out -diff --git a/sound/x86/Kconfig b/sound/x86/Kconfig -new file mode 100644 -index 0000000..182adf3 ---- /dev/null -+++ b/sound/x86/Kconfig -@@ -0,0 +1,16 @@ -+menuconfig SND_X86 -+ tristate "X86 sound devices" -+ ---help--- -+ -+ X86 sound devices that don't fall under SoC or PCI categories -+ -+if SND_X86 -+ -+config HDMI_LPE_AUDIO -+ tristate "HDMI audio without HDaudio on Intel Atom platforms" -+ depends on DRM_I915 -+ default n -+ help -+ Choose this option to support HDMI LPE Audio mode -+ -+endif # SND_X86 -diff --git a/sound/x86/Makefile b/sound/x86/Makefile -new file mode 100644 -index 0000000..78b2ae1 ---- /dev/null -+++ b/sound/x86/Makefile -@@ -0,0 +1,8 @@ -+DRIVER_NAME := hdmi_lpe_audio -+ -+ccflags-y += -Idrivers/gpu/drm/i915 -+ -+$(DRIVER_NAME)-objs += \ -+ intel_hdmi_lpe_audio.o -+ -+obj-$(CONFIG_HDMI_LPE_AUDIO) += $(DRIVER_NAME).o -diff --git a/sound/x86/intel_hdmi_lpe_audio.c b/sound/x86/intel_hdmi_lpe_audio.c -new file mode 100644 -index 0000000..f31ab72 ---- /dev/null -+++ b/sound/x86/intel_hdmi_lpe_audio.c -@@ -0,0 +1,622 @@ -+/* -+ * intel_hdmi_lpe_audio.c - Intel HDMI LPE audio driver for Atom platforms -+ * -+ * Copyright (C) 2016 Intel Corp -+ * Authors: -+ * Jerome Anand -+ * Aravind Siddappaji -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ * -+ * 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; version 2 of the License. -+ * -+ * This program 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. -+ * -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ */ -+ -+#define pr_fmt(fmt) "hdmi_lpe_audio: " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "intel_hdmi_lpe_audio.h" -+ -+/* globals*/ -+struct platform_device *gpdev; -+int _hdmi_state; -+union otm_hdmi_eld_t hdmi_eld; -+ -+struct hdmi_lpe_audio_ctx { -+ int irq; -+ void __iomem *mmio_start; -+ had_event_call_back had_event_callbacks; -+ struct snd_intel_had_interface *had_interface; -+ void *had_pvt_data; -+ int tmds_clock_speed; -+ unsigned int had_config_offset; -+ int hdmi_audio_interrupt_mask; -+ struct work_struct hdmi_audio_wq; -+}; -+ -+static inline void hdmi_set_eld(void *eld) -+{ -+ int size = (sizeof(hdmi_eld)) > HDMI_MAX_ELD_BYTES ? -+ HDMI_MAX_ELD_BYTES : -+ (sizeof(hdmi_eld)); -+ -+ memcpy((void *)&hdmi_eld, eld, size); -+} -+ -+static inline int hdmi_get_eld(void *eld) -+{ -+ memcpy(eld, (void *)&hdmi_eld, sizeof(hdmi_eld)); -+ -+ { -+ int i; -+ uint8_t *eld_data = (uint8_t *)&hdmi_eld; -+ -+ pr_debug("hdmi_get_eld:\n{{"); -+ -+ for (i = 0; i < sizeof(hdmi_eld); i++) -+ pr_debug("0x%x, ", eld_data[i]); -+ -+ pr_debug("}}\n"); -+ } -+ return HAD_SUCCESS; -+} -+ -+ -+static inline struct hdmi_lpe_audio_ctx *get_hdmi_context(void) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ return ctx; -+} -+ -+/* -+ * return whether HDMI audio device is busy. -+ */ -+bool mid_hdmi_audio_is_busy(void *ddev) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ int hdmi_audio_busy = 0; -+ struct hdmi_audio_event hdmi_audio_event; -+ -+ pr_debug("%s: Enter", __func__); -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ if (_hdmi_state == hdmi_connector_status_disconnected) { -+ /* HDMI is not connected, assuming audio device is idle. */ -+ return false; -+ } -+ -+ if (ctx->had_interface) { -+ hdmi_audio_event.type = HAD_EVENT_QUERY_IS_AUDIO_BUSY; -+ hdmi_audio_busy = ctx->had_interface->query( -+ ctx->had_pvt_data, -+ hdmi_audio_event); -+ return hdmi_audio_busy != 0; -+ } -+ return false; -+} -+ -+/* -+ * return whether HDMI audio device is suspended. -+ */ -+bool mid_hdmi_audio_suspend(void *ddev) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ struct hdmi_audio_event hdmi_audio_event; -+ int ret = 0; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ if (_hdmi_state == hdmi_connector_status_disconnected) { -+ /* HDMI is not connected, assuming audio device -+ * is suspended already. -+ */ -+ return true; -+ } -+ -+ pr_debug("%s: _hdmi_state %d", __func__, -+ _hdmi_state); -+ -+ if (ctx->had_interface) { -+ hdmi_audio_event.type = 0; -+ ret = ctx->had_interface->suspend(ctx->had_pvt_data, -+ hdmi_audio_event); -+ return (ret == 0) ? true : false; -+ } -+ return true; -+} -+ -+void mid_hdmi_audio_resume(void *ddev) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ if (_hdmi_state == hdmi_connector_status_disconnected) { -+ /* HDMI is not connected, there is no need -+ * to resume audio device. -+ */ -+ return; -+ } -+ -+ pr_debug("%s: _hdmi_state %d", __func__, _hdmi_state); -+ -+ if (ctx->had_interface) -+ ctx->had_interface->resume(ctx->had_pvt_data); -+} -+ -+void mid_hdmi_audio_signal_event(enum had_event_type event) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ pr_debug("%s: Enter\n", __func__); -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ if (ctx->had_event_callbacks) -+ (*ctx->had_event_callbacks)(event, -+ ctx->had_pvt_data); -+} -+ -+/** -+ * hdmi_audio_write: -+ * used to write into display controller HDMI audio registers. -+ * -+ */ -+static int hdmi_audio_write(uint32_t reg, uint32_t val) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ pr_debug("%s: reg[0x%x] = 0x%x\n", __func__, reg, val); -+ -+ iowrite32(val, (ctx->mmio_start+reg)); -+ -+ return HAD_SUCCESS; -+} -+ -+/** -+ * hdmi_audio_read: -+ * used to get the register value read from -+ * display controller HDMI audio registers. -+ */ -+static int hdmi_audio_read(uint32_t reg, uint32_t *val) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ *val = ioread32(ctx->mmio_start+reg); -+ pr_debug("%s: reg[0x%x] = 0x%x\n", __func__, reg, *val); -+ return HAD_SUCCESS; -+} -+ -+/** -+ * hdmi_audio_rmw: -+ * used to update the masked bits in display controller HDMI -+ * audio registers. -+ */ -+static int hdmi_audio_rmw(uint32_t reg, uint32_t val, uint32_t mask) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ uint32_t val_tmp = 0; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ val_tmp = (val & mask) | -+ ((ioread32(ctx->mmio_start + reg)) & ~mask); -+ -+ iowrite32(val_tmp, (ctx->mmio_start+reg)); -+ pr_debug("%s: reg[0x%x] = 0x%x\n", __func__, reg, val_tmp); -+ -+ return HAD_SUCCESS; -+} -+ -+/** -+ * hdmi_audio_get_caps: -+ * used to return the HDMI audio capabilities. -+ * e.g. resolution, frame rate. -+ */ -+static int hdmi_audio_get_caps(enum had_caps_list get_element, -+ void *capabilities) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ int ret = HAD_SUCCESS; -+ -+ ctx = get_hdmi_context(); -+ -+ pr_debug("%s: Enter\n", __func__); -+ -+ switch (get_element) { -+ case HAD_GET_ELD: -+ ret = hdmi_get_eld(capabilities); -+ break; -+ case HAD_GET_DISPLAY_RATE: -+ /* ToDo: Verify if sampling freq logic is correct */ -+ memcpy(capabilities, &(ctx->tmds_clock_speed), -+ sizeof(uint32_t)); -+ pr_debug("%s: tmds_clock_speed = 0x%x\n", __func__, -+ ctx->tmds_clock_speed); -+ break; -+ default: -+ break; -+ } -+ -+ return ret; -+} -+ -+/** -+ * hdmi_audio_get_register_base -+ * used to get the current hdmi base address -+ */ -+int hdmi_audio_get_register_base(uint32_t **reg_base, -+ uint32_t *config_offset) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ *reg_base = (uint32_t *)(ctx->mmio_start); -+ *config_offset = ctx->had_config_offset; -+ pr_debug("%s: reg_base = 0x%p, cfg_off = 0x%x\n", __func__, -+ *reg_base, *config_offset); -+ return HAD_SUCCESS; -+} -+ -+/** -+ * hdmi_audio_set_caps: -+ * used to set the HDMI audio capabilities. -+ * e.g. Audio INT. -+ */ -+int hdmi_audio_set_caps(enum had_caps_list set_element, -+ void *capabilties) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ pr_debug("%s: cap_id = 0x%x\n", __func__, set_element); -+ -+ switch (set_element) { -+ case HAD_SET_ENABLE_AUDIO_INT: -+ { -+ uint32_t status_reg; -+ -+ hdmi_audio_read(AUD_HDMI_STATUS_v2 + -+ ctx->had_config_offset, &status_reg); -+ status_reg |= -+ HDMI_AUDIO_BUFFER_DONE | HDMI_AUDIO_UNDERRUN; -+ hdmi_audio_write(AUD_HDMI_STATUS_v2 + -+ ctx->had_config_offset, status_reg); -+ hdmi_audio_read(AUD_HDMI_STATUS_v2 + -+ ctx->had_config_offset, &status_reg); -+ -+ } -+ break; -+ default: -+ break; -+ } -+ -+ return HAD_SUCCESS; -+} -+ -+static struct hdmi_audio_registers_ops hdmi_audio_reg_ops = { -+ .hdmi_audio_get_register_base = hdmi_audio_get_register_base, -+ .hdmi_audio_read_register = hdmi_audio_read, -+ .hdmi_audio_write_register = hdmi_audio_write, -+ .hdmi_audio_read_modify = hdmi_audio_rmw, -+}; -+ -+static struct hdmi_audio_query_set_ops hdmi_audio_get_set_ops = { -+ .hdmi_audio_get_caps = hdmi_audio_get_caps, -+ .hdmi_audio_set_caps = hdmi_audio_set_caps, -+}; -+ -+int mid_hdmi_audio_setup( -+ had_event_call_back audio_callbacks, -+ struct hdmi_audio_registers_ops *reg_ops, -+ struct hdmi_audio_query_set_ops *query_ops) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ pr_debug("%s: called\n", __func__); -+ -+ reg_ops->hdmi_audio_get_register_base = -+ (hdmi_audio_reg_ops.hdmi_audio_get_register_base); -+ reg_ops->hdmi_audio_read_register = -+ (hdmi_audio_reg_ops.hdmi_audio_read_register); -+ reg_ops->hdmi_audio_write_register = -+ (hdmi_audio_reg_ops.hdmi_audio_write_register); -+ reg_ops->hdmi_audio_read_modify = -+ (hdmi_audio_reg_ops.hdmi_audio_read_modify); -+ query_ops->hdmi_audio_get_caps = -+ hdmi_audio_get_set_ops.hdmi_audio_get_caps; -+ query_ops->hdmi_audio_set_caps = -+ hdmi_audio_get_set_ops.hdmi_audio_set_caps; -+ -+ ctx->had_event_callbacks = audio_callbacks; -+ -+ return HAD_SUCCESS; -+} -+ -+void _had_wq(struct work_struct *work) -+{ -+ mid_hdmi_audio_signal_event(HAD_EVENT_HOT_PLUG); -+} -+ -+int mid_hdmi_audio_register(struct snd_intel_had_interface *driver, -+ void *had_data) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ pr_debug("%s: called\n", __func__); -+ -+ ctx->had_pvt_data = had_data; -+ ctx->had_interface = driver; -+ -+ /* The Audio driver is loading now and we need to notify -+ * it if there is an HDMI device attached -+ */ -+ INIT_WORK(&ctx->hdmi_audio_wq, _had_wq); -+ pr_debug("%s: Scheduling HDMI audio work queue\n", __func__); -+ schedule_work(&ctx->hdmi_audio_wq); -+ -+ return HAD_SUCCESS; -+} -+ -+static irqreturn_t display_pipe_interrupt_handler(int irq, void *dev_id) -+{ -+ u32 audio_stat, audio_reg; -+ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ pr_debug("%s: Enter\n", __func__); -+ -+ ctx = platform_get_drvdata(gpdev); -+ -+ audio_reg = ctx->had_config_offset + AUD_HDMI_STATUS_v2; -+ hdmi_audio_read(audio_reg, &audio_stat); -+ -+ if (audio_stat & HDMI_AUDIO_UNDERRUN) { -+ hdmi_audio_write(audio_reg, HDMI_AUDIO_UNDERRUN); -+ mid_hdmi_audio_signal_event( -+ HAD_EVENT_AUDIO_BUFFER_UNDERRUN); -+ } -+ -+ if (audio_stat & HDMI_AUDIO_BUFFER_DONE) { -+ hdmi_audio_write(audio_reg, HDMI_AUDIO_BUFFER_DONE); -+ mid_hdmi_audio_signal_event( -+ HAD_EVENT_AUDIO_BUFFER_DONE); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static void notify_audio_lpe(void *audio_ptr) -+{ -+ struct hdmi_lpe_audio_ctx *ctx = get_hdmi_context(); -+ struct intel_hdmi_lpe_audio_pdata *pdata = gpdev->dev.platform_data; -+ struct intel_hdmi_lpe_audio_eld *eld = audio_ptr; -+ -+ if (pdata->hdmi_connected != true) { -+ -+ pr_debug("%s: Event: HAD_NOTIFY_HOT_UNPLUG\n", -+ __func__); -+ -+ if (_hdmi_state == hdmi_connector_status_connected) { -+ -+ _hdmi_state = -+ hdmi_connector_status_disconnected; -+ -+ mid_hdmi_audio_signal_event( -+ HAD_EVENT_HOT_UNPLUG); -+ } else -+ pr_debug("%s: Already Unplugged!\n", __func__); -+ -+ } else if (eld != NULL) { -+ -+ hdmi_set_eld(eld->eld_data); -+ -+ mid_hdmi_audio_signal_event(HAD_EVENT_HOT_PLUG); -+ -+ _hdmi_state = hdmi_connector_status_connected; -+ -+ pr_debug("%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n", -+ __func__, eld->port_id, -+ pdata->tmds_clock_speed); -+ -+ if (pdata->tmds_clock_speed) { -+ ctx->tmds_clock_speed = pdata->tmds_clock_speed; -+ mid_hdmi_audio_signal_event(HAD_EVENT_MODE_CHANGING); -+ } -+ } else -+ pr_debug("%s: Event: NULL EDID!!\n", __func__); -+} -+ -+/** -+ * hdmi_lpe_audio_probe - start bridge with i915 -+ * -+ * This function is called when the i915 driver creates the hdmi-lpe-audio -+ * platform device. Card creation is deferred until a hot plug event is -+ * received -+ */ -+static int hdmi_lpe_audio_probe(struct platform_device *pdev) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ struct intel_hdmi_lpe_audio_pdata *pdata; -+ int irq; -+ struct resource *res_mmio; -+ void __iomem *mmio_start; -+ int ret = 0; -+ unsigned long flag_irq; -+ const struct pci_device_id cherryview_ids[] = { -+ {PCI_DEVICE(0x8086, 0x22b0)}, -+ {PCI_DEVICE(0x8086, 0x22b1)}, -+ {PCI_DEVICE(0x8086, 0x22b2)}, -+ {PCI_DEVICE(0x8086, 0x22b3)}, -+ {} -+ }; -+ -+ pr_debug("Enter %s\n", __func__); -+ -+ /*TBD:remove globals*/ -+ gpdev = pdev; -+ _hdmi_state = hdmi_connector_status_disconnected; -+ -+ /* get resources */ -+ irq = platform_get_irq(pdev, 0); -+ if (irq < 0) { -+ pr_err("Could not get irq resource\n"); -+ return -ENODEV; -+ } -+ -+ res_mmio = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res_mmio) { -+ pr_err("Could not get IO_MEM resources\n"); -+ return -ENXIO; -+ } -+ -+ pr_debug("%s: mmio_start = 0x%x, mmio_end = 0x%x\n", __func__, -+ (unsigned int)res_mmio->start, (unsigned int)res_mmio->end); -+ -+ mmio_start = ioremap_nocache(res_mmio->start, -+ (size_t)((res_mmio->end - res_mmio->start) -+ + 1)); -+ if (!mmio_start) { -+ pr_err("Could not get ioremap\n"); -+ return -EACCES; -+ } -+ -+ /* setup interrupt handler */ -+ ret = request_irq(irq, display_pipe_interrupt_handler, -+ 0, /* FIXME: is IRQF_SHARED needed ? */ -+ pdev->name, -+ NULL); -+ if (ret < 0) { -+ pr_err("request_irq failed\n"); -+ iounmap(mmio_start); -+ return -ENODEV; -+ } -+ -+ /* alloc and save context */ -+ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); -+ if (ctx == NULL) { -+ free_irq(irq, NULL); -+ iounmap(mmio_start); -+ return -ENOMEM; -+ } -+ -+ ctx->irq = irq; -+ pr_debug("hdmi lpe audio: irq num = %d\n", irq); -+ ctx->mmio_start = mmio_start; -+ ctx->tmds_clock_speed = DIS_SAMPLE_RATE_148_5; -+ -+ if (pci_dev_present(cherryview_ids)) { -+ pr_debug("%s: Cherrytrail LPE - Detected\n", __func__); -+ ctx->had_config_offset = AUDIO_HDMI_CONFIG_C; -+ } else { -+ pr_debug("%s: Baytrail LPE - Assume\n", __func__); -+ ctx->had_config_offset = AUDIO_HDMI_CONFIG_A; -+ } -+ -+ pdata = pdev->dev.platform_data; -+ -+ if (pdata == NULL) { -+ pr_err("%s: quit: pdata not allocated by i915!!\n", __func__); -+ kfree(ctx); -+ free_irq(irq, NULL); -+ iounmap(mmio_start); -+ return -ENOMEM; -+ } -+ -+ platform_set_drvdata(pdev, ctx); -+ -+ pr_debug("hdmi lpe audio: setting pin eld notify callback\n"); -+ -+ spin_lock_irqsave(&pdata->lpe_audio_slock, flag_irq); -+ pdata->notify_audio_lpe = notify_audio_lpe; -+ -+ if (pdata->notify_pending) { -+ -+ pr_debug("%s: handle pending notification\n", __func__); -+ notify_audio_lpe(&pdata->eld); -+ pdata->notify_pending = false; -+ } -+ spin_unlock_irqrestore(&pdata->lpe_audio_slock, flag_irq); -+ -+ return ret; -+} -+ -+/** -+ * hdmi_lpe_audio_remove - stop bridge with i915 -+ * -+ * This function is called when the platform device is destroyed. The sound -+ * card should have been removed on hot plug event. -+ */ -+static int hdmi_lpe_audio_remove(struct platform_device *pdev) -+{ -+ struct hdmi_lpe_audio_ctx *ctx; -+ -+ pr_debug("Enter %s\n", __func__); -+ -+ /* get context, release resources */ -+ ctx = platform_get_drvdata(pdev); -+ iounmap(ctx->mmio_start); -+ free_irq(ctx->irq, NULL); -+ kfree(ctx); -+ return HAD_SUCCESS; -+} -+ -+static int hdmi_lpe_audio_suspend(struct platform_device *pt_dev, -+ pm_message_t state) -+{ -+ pr_debug("Enter %s\n", __func__); -+ mid_hdmi_audio_suspend(NULL); -+ return HAD_SUCCESS; -+} -+ -+static int hdmi_lpe_audio_resume(struct platform_device *pt_dev) -+{ -+ pr_debug("Enter %s\n", __func__); -+ mid_hdmi_audio_resume(NULL); -+ return HAD_SUCCESS; -+} -+ -+static struct platform_driver hdmi_lpe_audio_driver = { -+ .driver = { -+ .name = "hdmi-lpe-audio", -+ }, -+ .probe = hdmi_lpe_audio_probe, -+ .remove = hdmi_lpe_audio_remove, -+ .suspend = hdmi_lpe_audio_suspend, -+ .resume = hdmi_lpe_audio_resume -+}; -+ -+module_platform_driver(hdmi_lpe_audio_driver); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:hdmi_lpe_audio"); -diff --git a/sound/x86/intel_hdmi_lpe_audio.h b/sound/x86/intel_hdmi_lpe_audio.h -new file mode 100644 -index 0000000..d4b94f0a ---- /dev/null -+++ b/sound/x86/intel_hdmi_lpe_audio.h -@@ -0,0 +1,692 @@ -+/* -+ * intel_hdmi_lpe_audio.h - Intel HDMI LPE audio driver -+ * -+ * Copyright (C) 2016 Intel Corp -+ * Authors: Sailaja Bandarupalli -+ * Ramesh Babu K V -+ * Vaibhav Agarwal -+ * Jerome Anand -+ * Aravind Siddappaji -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ * -+ * 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; version 2 of the License. -+ * -+ * This program 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. -+ * -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ */ -+#ifndef __INTEL_HDMI_LPE_AUDIO_H -+#define __INTEL_HDMI_LPE_AUDIO_H -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define HMDI_LPE_AUDIO_DRIVER_NAME "intel-hdmi-lpe-audio" -+#define HAD_DRIVER_VERSION "0.01.003" -+#define HAD_MAX_DEVICES 1 -+#define HAD_MIN_CHANNEL 2 -+#define HAD_MAX_CHANNEL 8 -+#define HAD_NUM_OF_RING_BUFS 4 -+ -+/* HDMI Audio LPE Error Codes */ -+#define HAD_SUCCESS 0 -+#define HAD_FAIL 1 -+ -+/* Assume 192KHz, 8channel, 25msec period */ -+#define HAD_MAX_BUFFER (600*1024) -+#define HAD_MIN_BUFFER (32*1024) -+#define HAD_MAX_PERIODS 4 -+#define HAD_MIN_PERIODS 4 -+#define HAD_MAX_PERIOD_BYTES (HAD_MAX_BUFFER/HAD_MIN_PERIODS) -+#define HAD_MIN_PERIOD_BYTES 256 -+#define HAD_FIFO_SIZE 0 /* fifo not being used */ -+#define MAX_SPEAKERS 8 -+/* TODO: Add own tlv when channel map is ported for user space */ -+#define USE_ALSA_DEFAULT_TLV -+ -+#define AUD_SAMPLE_RATE_32 32000 -+#define AUD_SAMPLE_RATE_44_1 44100 -+#define AUD_SAMPLE_RATE_48 48000 -+#define AUD_SAMPLE_RATE_88_2 88200 -+#define AUD_SAMPLE_RATE_96 96000 -+#define AUD_SAMPLE_RATE_176_4 176400 -+#define AUD_SAMPLE_RATE_192 192000 -+ -+#define HAD_MIN_RATE AUD_SAMPLE_RATE_32 -+#define HAD_MAX_RATE AUD_SAMPLE_RATE_192 -+ -+#define DIS_SAMPLE_RATE_25_2 25200 -+#define DIS_SAMPLE_RATE_27 27000 -+#define DIS_SAMPLE_RATE_54 54000 -+#define DIS_SAMPLE_RATE_74_25 74250 -+#define DIS_SAMPLE_RATE_148_5 148500 -+#define HAD_REG_WIDTH 0x08 -+#define HAD_MAX_HW_BUFS 0x04 -+#define HAD_MAX_DIP_WORDS 16 -+#define INTEL_HAD "IntelHdmiLpeAudio" -+ -+/* _AUD_CONFIG register MASK */ -+#define AUD_CONFIG_MASK_UNDERRUN 0xC0000000 -+#define AUD_CONFIG_MASK_SRDBG 0x00000002 -+#define AUD_CONFIG_MASK_FUNCRST 0x00000001 -+ -+#define MAX_CNT 0xFF -+#define HAD_SUSPEND_DELAY 1000 -+ -+#define OTM_HDMI_ELD_SIZE 128 -+ -+union otm_hdmi_eld_t { -+ uint8_t eld_data[OTM_HDMI_ELD_SIZE]; -+ #pragma pack(1) -+ struct { -+ /* Byte[0] = ELD Version Number */ -+ union { -+ uint8_t byte0; -+ struct { -+ uint8_t reserved:3; /* Reserf */ -+ uint8_t eld_ver:5; /* ELD Version Number */ -+ /* 00000b - reserved -+ * 00001b - first rev, obsoleted -+ * 00010b - version 2, supporting CEA version -+ * 861D or below -+ * 00011b:11111b - reserved -+ * for future -+ */ -+ }; -+ }; -+ -+ /* Byte[1] = Vendor Version Field */ -+ union { -+ uint8_t vendor_version; -+ struct { -+ uint8_t reserved1:3; -+ uint8_t veld_ver:5; /* Version number of the ELD -+ * extension. This value is -+ * provisioned and unique to -+ * each vendor. -+ */ -+ }; -+ }; -+ -+ /* Byte[2] = Baseline Length field */ -+ uint8_t baseline_eld_length; /* Length of the Baseline structure -+ * divided by Four. -+ */ -+ -+ /* Byte [3] = Reserved for future use */ -+ uint8_t byte3; -+ -+ /* Starting of the BaseLine EELD structure -+ * Byte[4] = Monitor Name Length -+ */ -+ union { -+ uint8_t byte4; -+ struct { -+ uint8_t mnl:5; -+ uint8_t cea_edid_rev_id:3; -+ }; -+ }; -+ -+ /* Byte[5] = Capabilities */ -+ union { -+ uint8_t capabilities; -+ struct { -+ uint8_t hdcp:1; /* HDCP support */ -+ uint8_t ai_support:1; /* AI support */ -+ uint8_t connection_type:2; /* Connection type -+ * 00 - HDMI -+ * 01 - DP -+ * 10 -11 Reserved -+ * for future -+ * connection types -+ */ -+ uint8_t sadc:4; /* Indicates number of 3 bytes -+ * Short Audio Descriptors. -+ */ -+ }; -+ }; -+ -+ /* Byte[6] = Audio Synch Delay */ -+ uint8_t audio_synch_delay; /* Amount of time reported by the -+ * sink that the video trails audio -+ * in milliseconds. -+ */ -+ -+ /* Byte[7] = Speaker Allocation Block */ -+ union { -+ uint8_t speaker_allocation_block; -+ struct { -+ uint8_t flr:1; /*Front Left and Right channels*/ -+ uint8_t lfe:1; /*Low Frequency Effect channel*/ -+ uint8_t fc:1; /*Center transmission channel*/ -+ uint8_t rlr:1; /*Rear Left and Right channels*/ -+ uint8_t rc:1; /*Rear Center channel*/ -+ uint8_t flrc:1; /*Front left and Right of Center -+ *transmission channels -+ */ -+ uint8_t rlrc:1; /*Rear left and Right of Center -+ *transmission channels -+ */ -+ uint8_t reserved3:1; /* Reserved */ -+ }; -+ }; -+ -+ /* Byte[8 - 15] - 8 Byte port identification value */ -+ uint8_t port_id_value[8]; -+ -+ /* Byte[16 - 17] - 2 Byte Manufacturer ID */ -+ uint8_t manufacturer_id[2]; -+ -+ /* Byte[18 - 19] - 2 Byte Product ID */ -+ uint8_t product_id[2]; -+ -+ /* Byte [20-83] - 64 Bytes of BaseLine Data */ -+ uint8_t mn_sand_sads[64]; /* This will include -+ * - ASCII string of Monitor name -+ * - List of 3 byte SADs -+ * - Zero padding -+ */ -+ -+ /* Vendor ELD Block should continue here! -+ * No Vendor ELD block defined as of now. -+ */ -+ }; -+ #pragma pack() -+}; -+ -+/** -+ * enum had_status - Audio stream states -+ * -+ * @STREAM_INIT: Stream initialized -+ * @STREAM_RUNNING: Stream running -+ * @STREAM_PAUSED: Stream paused -+ * @STREAM_DROPPED: Stream dropped -+ */ -+enum had_stream_status { -+ STREAM_INIT = 0, -+ STREAM_RUNNING = 1, -+ STREAM_PAUSED = 2, -+ STREAM_DROPPED = 3 -+}; -+ -+/** -+ * enum had_status_stream - HAD stream states -+ */ -+enum had_status_stream { -+ HAD_INIT = 0, -+ HAD_RUNNING_STREAM, -+}; -+ -+enum had_drv_status { -+ HAD_DRV_CONNECTED, -+ HAD_DRV_RUNNING, -+ HAD_DRV_DISCONNECTED, -+ HAD_DRV_SUSPENDED, -+ HAD_DRV_ERR, -+}; -+ -+/* enum intel_had_aud_buf_type - HDMI controller ring buffer types */ -+enum intel_had_aud_buf_type { -+ HAD_BUF_TYPE_A = 0, -+ HAD_BUF_TYPE_B = 1, -+ HAD_BUF_TYPE_C = 2, -+ HAD_BUF_TYPE_D = 3, -+}; -+ -+enum num_aud_ch { -+ CH_STEREO = 0, -+ CH_THREE_FOUR = 1, -+ CH_FIVE_SIX = 2, -+ CH_SEVEN_EIGHT = 3 -+}; -+ -+/* HDMI Controller register offsets - audio domain common */ -+/* Base address for below regs = 0x65000 */ -+enum hdmi_ctrl_reg_offset_common { -+ AUDIO_HDMI_CONFIG_A = 0x000, -+ AUDIO_HDMI_CONFIG_B = 0x800, -+ AUDIO_HDMI_CONFIG_C = 0x900, -+}; -+/* HDMI controller register offsets */ -+enum hdmi_ctrl_reg_offset_v1 { -+ AUD_CONFIG = 0x0, -+ AUD_CH_STATUS_0 = 0x08, -+ AUD_CH_STATUS_1 = 0x0C, -+ AUD_HDMI_CTS = 0x10, -+ AUD_N_ENABLE = 0x14, -+ AUD_SAMPLE_RATE = 0x18, -+ AUD_BUF_CONFIG = 0x20, -+ AUD_BUF_CH_SWAP = 0x24, -+ AUD_BUF_A_ADDR = 0x40, -+ AUD_BUF_A_LENGTH = 0x44, -+ AUD_BUF_B_ADDR = 0x48, -+ AUD_BUF_B_LENGTH = 0x4c, -+ AUD_BUF_C_ADDR = 0x50, -+ AUD_BUF_C_LENGTH = 0x54, -+ AUD_BUF_D_ADDR = 0x58, -+ AUD_BUF_D_LENGTH = 0x5c, -+ AUD_CNTL_ST = 0x60, -+ AUD_HDMI_STATUS = 0x68, -+ AUD_HDMIW_INFOFR = 0x114, -+}; -+ -+/* -+ * Delta changes in HDMI controller register offsets -+ * compare to v1 version -+ */ -+ -+enum hdmi_ctrl_reg_offset_v2 { -+ AUD_HDMI_STATUS_v2 = 0x64, -+ AUD_HDMIW_INFOFR_v2 = 0x68, -+}; -+ -+/* -+ * CEA speaker placement: -+ * -+ * FL FLC FC FRC FR -+ * -+ * LFE -+ * -+ * RL RLC RC RRC RR -+ * -+ * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M -+ * corresponds to CEA RL/RR; The SMPTE channel _assignment_ C/LFE is -+ * swapped to CEA LFE/FC. -+ */ -+enum cea_speaker_placement { -+ FL = (1 << 0), /* Front Left */ -+ FC = (1 << 1), /* Front Center */ -+ FR = (1 << 2), /* Front Right */ -+ FLC = (1 << 3), /* Front Left Center */ -+ FRC = (1 << 4), /* Front Right Center */ -+ RL = (1 << 5), /* Rear Left */ -+ RC = (1 << 6), /* Rear Center */ -+ RR = (1 << 7), /* Rear Right */ -+ RLC = (1 << 8), /* Rear Left Center */ -+ RRC = (1 << 9), /* Rear Right Center */ -+ LFE = (1 << 10), /* Low Frequency Effect */ -+}; -+ -+struct cea_channel_speaker_allocation { -+ int ca_index; -+ int speakers[8]; -+ -+ /* derived values, just for convenience */ -+ int channels; -+ int spk_mask; -+}; -+ -+struct channel_map_table { -+ unsigned char map; /* ALSA API channel map position */ -+ unsigned char cea_slot; /* CEA slot value */ -+ int spk_mask; /* speaker position bit mask */ -+}; -+ -+/** -+ * union aud_cfg - Audio configuration -+ * -+ * @cfg_regx: individual register bits -+ * @cfg_regval: full register value -+ * -+ */ -+union aud_cfg { -+ struct { -+ u32 aud_en:1; -+ u32 layout:1; -+ u32 fmt:2; -+ u32 num_ch:2; -+ u32 rsvd0:1; -+ u32 set:1; -+ u32 flat:1; -+ u32 val_bit:1; -+ u32 user_bit:1; -+ u32 underrun:1; -+ u32 rsvd1:20; -+ } cfg_regx; -+ struct { -+ u32 aud_en:1; -+ u32 layout:1; -+ u32 fmt:2; -+ u32 num_ch:3; -+ u32 set:1; -+ u32 flat:1; -+ u32 val_bit:1; -+ u32 user_bit:1; -+ u32 underrun:1; -+ u32 packet_mode:1; -+ u32 left_align:1; -+ u32 bogus_sample:1; -+ u32 dp_modei:1; -+ u32 rsvd:16; -+ } cfg_regx_v2; -+ u32 cfg_regval; -+}; -+ -+/** -+ * union aud_ch_status_0 - Audio Channel Status 0 Attributes -+ * -+ * @status_0_regx:individual register bits -+ * @status_0_regval:full register value -+ * -+ */ -+union aud_ch_status_0 { -+ struct { -+ u32 ch_status:1; -+ u32 lpcm_id:1; -+ u32 cp_info:1; -+ u32 format:3; -+ u32 mode:2; -+ u32 ctg_code:8; -+ u32 src_num:4; -+ u32 ch_num:4; -+ u32 samp_freq:4; -+ u32 clk_acc:2; -+ u32 rsvd:2; -+ } status_0_regx; -+ u32 status_0_regval; -+}; -+ -+/** -+ * union aud_ch_status_1 - Audio Channel Status 1 Attributes -+ * -+ * @status_1_regx: individual register bits -+ * @status_1_regval: full register value -+ * -+ */ -+union aud_ch_status_1 { -+ struct { -+ u32 max_wrd_len:1; -+ u32 wrd_len:3; -+ u32 rsvd:28; -+ } status_1_regx; -+ u32 status_1_regval; -+}; -+ -+/** -+ * union aud_hdmi_cts - CTS register -+ * -+ * @cts_regx: individual register bits -+ * @cts_regval: full register value -+ * -+ */ -+union aud_hdmi_cts { -+ struct { -+ u32 cts_val:20; -+ u32 en_cts_prog:1; -+ u32 rsvd:11; -+ } cts_regx; -+ struct { -+ u32 cts_val:24; -+ u32 en_cts_prog:1; -+ u32 rsvd:7; -+ } cts_regx_v2; -+ u32 cts_regval; -+}; -+ -+/** -+ * union aud_hdmi_n_enable - N register -+ * -+ * @n_regx: individual register bits -+ * @n_regval: full register value -+ * -+ */ -+union aud_hdmi_n_enable { -+ struct { -+ u32 n_val:20; -+ u32 en_n_prog:1; -+ u32 rsvd:11; -+ } n_regx; -+ struct { -+ u32 n_val:24; -+ u32 en_n_prog:1; -+ u32 rsvd:7; -+ } n_regx_v2; -+ u32 n_regval; -+}; -+ -+/** -+ * union aud_buf_config - Audio Buffer configurations -+ * -+ * @buf_cfg_regx: individual register bits -+ * @buf_cfgval: full register value -+ * -+ */ -+union aud_buf_config { -+ struct { -+ u32 fifo_width:8; -+ u32 rsvd0:8; -+ u32 aud_delay:8; -+ u32 rsvd1:8; -+ } buf_cfg_regx; -+ struct { -+ u32 audio_fifo_watermark:8; -+ u32 dma_fifo_watermark:3; -+ u32 rsvd0:5; -+ u32 aud_delay:8; -+ u32 rsvd1:8; -+ } buf_cfg_regx_v2; -+ u32 buf_cfgval; -+}; -+ -+/** -+ * union aud_buf_ch_swap - Audio Sample Swapping offset -+ * -+ * @buf_ch_swap_regx: individual register bits -+ * @buf_ch_swap_val: full register value -+ * -+ */ -+union aud_buf_ch_swap { -+ struct { -+ u32 first_0:3; -+ u32 second_0:3; -+ u32 first_1:3; -+ u32 second_1:3; -+ u32 first_2:3; -+ u32 second_2:3; -+ u32 first_3:3; -+ u32 second_3:3; -+ u32 rsvd:8; -+ } buf_ch_swap_regx; -+ u32 buf_ch_swap_val; -+}; -+ -+/** -+ * union aud_buf_addr - Address for Audio Buffer -+ * -+ * @buf_addr_regx: individual register bits -+ * @buf_addr_val: full register value -+ * -+ */ -+union aud_buf_addr { -+ struct { -+ u32 valid:1; -+ u32 intr_en:1; -+ u32 rsvd:4; -+ u32 addr:26; -+ } buf_addr_regx; -+ u32 buf_addr_val; -+}; -+ -+/** -+ * union aud_buf_len - Length of Audio Buffer -+ * -+ * @buf_len_regx: individual register bits -+ * @buf_len_val: full register value -+ * -+ */ -+union aud_buf_len { -+ struct { -+ u32 buf_len:20; -+ u32 rsvd:12; -+ } buf_len_regx; -+ u32 buf_len_val; -+}; -+ -+/** -+ * union aud_ctrl_st - Audio Control State Register offset -+ * -+ * @ctrl_regx: individual register bits -+ * @ctrl_val: full register value -+ * -+ */ -+union aud_ctrl_st { -+ struct { -+ u32 ram_addr:4; -+ u32 eld_ack:1; -+ u32 eld_addr:4; -+ u32 eld_buf_size:5; -+ u32 eld_valid:1; -+ u32 cp_ready:1; -+ u32 dip_freq:2; -+ u32 dip_idx:3; -+ u32 dip_en_sta:4; -+ u32 rsvd:7; -+ } ctrl_regx; -+ u32 ctrl_val; -+}; -+ -+/** -+ * union aud_info_frame1 - Audio HDMI Widget Data Island Packet offset -+ * -+ * @fr1_regx: individual register bits -+ * @fr1_val: full register value -+ * -+ */ -+union aud_info_frame1 { -+ struct { -+ u32 pkt_type:8; -+ u32 ver_num:8; -+ u32 len:5; -+ u32 rsvd:11; -+ } fr1_regx; -+ u32 fr1_val; -+}; -+ -+/** -+ * union aud_info_frame2 - DIP frame 2 -+ * -+ * @fr2_regx: individual register bits -+ * @fr2_val: full register value -+ * -+ */ -+union aud_info_frame2 { -+ struct { -+ u32 chksum:8; -+ u32 chnl_cnt:3; -+ u32 rsvd0:1; -+ u32 coding_type:4; -+ u32 smpl_size:2; -+ u32 smpl_freq:3; -+ u32 rsvd1:3; -+ u32 format:8; -+ } fr2_regx; -+ u32 fr2_val; -+}; -+ -+/** -+ * union aud_info_frame3 - DIP frame 3 -+ * -+ * @fr3_regx: individual register bits -+ * @fr3_val: full register value -+ * -+ */ -+union aud_info_frame3 { -+ struct { -+ u32 chnl_alloc:8; -+ u32 rsvd0:3; -+ u32 lsv:4; -+ u32 dm_inh:1; -+ u32 rsvd1:16; -+ } fr3_regx; -+ u32 fr3_val; -+}; -+ -+enum hdmi_connector_status { -+ hdmi_connector_status_connected = 1, -+ hdmi_connector_status_disconnected = 2, -+ hdmi_connector_status_unknown = 3, -+}; -+ -+#define HDMI_AUDIO_UNDERRUN (1UL<<31) -+#define HDMI_AUDIO_BUFFER_DONE (1UL<<29) -+ -+ -+#define PORT_ENABLE (1 << 31) -+#define SDVO_AUDIO_ENABLE (1 << 6) -+ -+enum had_caps_list { -+ HAD_GET_ELD = 1, -+ HAD_GET_DISPLAY_RATE, -+ HAD_SET_ENABLE_AUDIO, -+ HAD_SET_DISABLE_AUDIO, -+ HAD_SET_ENABLE_AUDIO_INT, -+ HAD_SET_DISABLE_AUDIO_INT, -+}; -+ -+enum had_event_type { -+ HAD_EVENT_HOT_PLUG = 1, -+ HAD_EVENT_HOT_UNPLUG, -+ HAD_EVENT_MODE_CHANGING, -+ HAD_EVENT_AUDIO_BUFFER_DONE, -+ HAD_EVENT_AUDIO_BUFFER_UNDERRUN, -+ HAD_EVENT_QUERY_IS_AUDIO_BUSY, -+ HAD_EVENT_QUERY_IS_AUDIO_SUSPENDED, -+}; -+ -+/* -+ * HDMI Display Controller Audio Interface -+ * -+ */ -+typedef int (*had_event_call_back) (enum had_event_type event_type, -+ void *ctxt_info); -+ -+struct hdmi_audio_registers_ops { -+ int (*hdmi_audio_get_register_base)(uint32_t **reg_base, -+ uint32_t *config_offset); -+ int (*hdmi_audio_read_register)(uint32_t reg_addr, uint32_t *data); -+ int (*hdmi_audio_write_register)(uint32_t reg_addr, uint32_t data); -+ int (*hdmi_audio_read_modify)(uint32_t reg_addr, uint32_t data, -+ uint32_t mask); -+}; -+ -+struct hdmi_audio_query_set_ops { -+ int (*hdmi_audio_get_caps)(enum had_caps_list query_element, -+ void *capabilties); -+ int (*hdmi_audio_set_caps)(enum had_caps_list set_element, -+ void *capabilties); -+}; -+ -+struct hdmi_audio_event { -+ int type; -+}; -+ -+struct snd_intel_had_interface { -+ const char *name; -+ int (*query)(void *had_data, struct hdmi_audio_event event); -+ int (*suspend)(void *had_data, struct hdmi_audio_event event); -+ int (*resume)(void *had_data); -+}; -+ -+bool mid_hdmi_audio_is_busy(void *dev); -+bool mid_hdmi_audio_suspend(void *dev); -+void mid_hdmi_audio_resume(void *dev); -+void mid_hdmi_audio_signal_event(enum had_event_type event); -+int mid_hdmi_audio_setup( -+ had_event_call_back audio_callbacks, -+ struct hdmi_audio_registers_ops *reg_ops, -+ struct hdmi_audio_query_set_ops *query_ops); -+int mid_hdmi_audio_register( -+ struct snd_intel_had_interface *driver, -+ void *had_data); -+ -+#endif - -From ab09831890c2b114beb548e8a6de8e23534e5d62 Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:40 +0530 -Subject: [PATCH 4/7] ALSA: x86: hdmi: Add audio support for BYT and CHT - -Hdmi audio driver based on the child platform device -created by gfx driver is implemented. -This audio driver is derived from legacy intel -hdmi audio driver. - -The interfaces for interaction between gfx and audio -are updated and the driver implementation updated to -derive interrupts in its own address space based on -irq chip framework - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - sound/x86/Makefile | 2 + - sound/x86/intel_hdmi_audio.c | 1907 ++++++++++++++++++++++++++++++++++++++ - sound/x86/intel_hdmi_audio.h | 201 ++++ - sound/x86/intel_hdmi_audio_if.c | 551 +++++++++++ - sound/x86/intel_hdmi_lpe_audio.c | 16 +- - 5 files changed, 2671 insertions(+), 6 deletions(-) - create mode 100644 sound/x86/intel_hdmi_audio.c - create mode 100644 sound/x86/intel_hdmi_audio.h - create mode 100644 sound/x86/intel_hdmi_audio_if.c - -diff --git a/sound/x86/Makefile b/sound/x86/Makefile -index 78b2ae1..bc074d0 100644 ---- a/sound/x86/Makefile -+++ b/sound/x86/Makefile -@@ -3,6 +3,8 @@ DRIVER_NAME := hdmi_lpe_audio - ccflags-y += -Idrivers/gpu/drm/i915 - - $(DRIVER_NAME)-objs += \ -+ intel_hdmi_audio.o \ -+ intel_hdmi_audio_if.o \ - intel_hdmi_lpe_audio.o - - obj-$(CONFIG_HDMI_LPE_AUDIO) += $(DRIVER_NAME).o -diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c -new file mode 100644 -index 0000000..461b7d7 ---- /dev/null -+++ b/sound/x86/intel_hdmi_audio.c -@@ -0,0 +1,1907 @@ -+/* -+ * intel_hdmi_audio.c - Intel HDMI audio driver -+ * -+ * Copyright (C) 2016 Intel Corp -+ * Authors: Sailaja Bandarupalli -+ * Ramesh Babu K V -+ * Vaibhav Agarwal -+ * Jerome Anand -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ * -+ * 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; version 2 of the License. -+ * -+ * This program 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. -+ * -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ * ALSA driver for Intel HDMI audio -+ */ -+ -+#define pr_fmt(fmt) "had: " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "intel_hdmi_audio.h" -+ -+static DEFINE_MUTEX(had_mutex); -+ -+/*standard module options for ALSA. This module supports only one card*/ -+static int hdmi_card_index = SNDRV_DEFAULT_IDX1; -+static char *hdmi_card_id = SNDRV_DEFAULT_STR1; -+static struct snd_intelhad *had_data; -+ -+module_param(hdmi_card_index, int, 0444); -+MODULE_PARM_DESC(hdmi_card_index, -+ "Index value for INTEL Intel HDMI Audio controller."); -+module_param(hdmi_card_id, charp, 0444); -+MODULE_PARM_DESC(hdmi_card_id, -+ "ID string for INTEL Intel HDMI Audio controller."); -+ -+/* -+ * ELD SA bits in the CEA Speaker Allocation data block -+*/ -+static int eld_speaker_allocation_bits[] = { -+ [0] = FL | FR, -+ [1] = LFE, -+ [2] = FC, -+ [3] = RL | RR, -+ [4] = RC, -+ [5] = FLC | FRC, -+ [6] = RLC | RRC, -+ /* the following are not defined in ELD yet */ -+ [7] = 0, -+}; -+ -+/* -+ * This is an ordered list! -+ * -+ * The preceding ones have better chances to be selected by -+ * hdmi_channel_allocation(). -+ */ -+static struct cea_channel_speaker_allocation channel_allocations[] = { -+/* channel: 7 6 5 4 3 2 1 0 */ -+{ .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, -+ /* 2.1 */ -+{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, -+ /* Dolby Surround */ -+{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, -+ /* surround40 */ -+{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, -+ /* surround41 */ -+{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, -+ /* surround50 */ -+{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, -+ /* surround51 */ -+{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, -+ /* 6.1 */ -+{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, -+ /* surround71 */ -+{ .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, -+ -+{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, -+{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, -+{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, -+{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, -+{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, -+{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, -+{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, -+{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, -+{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, -+{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, -+{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, -+{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, -+{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, -+{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, -+{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, -+{ .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, -+}; -+ -+static struct channel_map_table map_tables[] = { -+ { SNDRV_CHMAP_FL, 0x00, FL }, -+ { SNDRV_CHMAP_FR, 0x01, FR }, -+ { SNDRV_CHMAP_RL, 0x04, RL }, -+ { SNDRV_CHMAP_RR, 0x05, RR }, -+ { SNDRV_CHMAP_LFE, 0x02, LFE }, -+ { SNDRV_CHMAP_FC, 0x03, FC }, -+ { SNDRV_CHMAP_RLC, 0x06, RLC }, -+ { SNDRV_CHMAP_RRC, 0x07, RRC }, -+ {} /* terminator */ -+}; -+ -+/* hardware capability structure */ -+static const struct snd_pcm_hardware snd_intel_hadstream = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_DOUBLE | -+ SNDRV_PCM_INFO_MMAP| -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_BATCH), -+ .formats = (SNDRV_PCM_FMTBIT_S24 | -+ SNDRV_PCM_FMTBIT_U24), -+ .rates = SNDRV_PCM_RATE_32000 | -+ SNDRV_PCM_RATE_44100 | -+ SNDRV_PCM_RATE_48000 | -+ SNDRV_PCM_RATE_88200 | -+ SNDRV_PCM_RATE_96000 | -+ SNDRV_PCM_RATE_176400 | -+ SNDRV_PCM_RATE_192000, -+ .rate_min = HAD_MIN_RATE, -+ .rate_max = HAD_MAX_RATE, -+ .channels_min = HAD_MIN_CHANNEL, -+ .channels_max = HAD_MAX_CHANNEL, -+ .buffer_bytes_max = HAD_MAX_BUFFER, -+ .period_bytes_min = HAD_MIN_PERIOD_BYTES, -+ .period_bytes_max = HAD_MAX_PERIOD_BYTES, -+ .periods_min = HAD_MIN_PERIODS, -+ .periods_max = HAD_MAX_PERIODS, -+ .fifo_size = HAD_FIFO_SIZE, -+}; -+ -+/* Register access functions */ -+ -+inline int had_get_hwstate(struct snd_intelhad *intelhaddata) -+{ -+ /* Check for device presence -SW state */ -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) { -+ pr_debug("%s:Device not connected:%d\n", __func__, -+ intelhaddata->drv_status); -+ return -ENODEV; -+ } -+ -+ return 0; -+} -+ -+inline int had_get_caps(enum had_caps_list query, void *caps) -+{ -+ int retval; -+ struct snd_intelhad *intelhaddata = had_data; -+ -+ retval = had_get_hwstate(intelhaddata); -+ if (!retval) -+ retval = intelhaddata->query_ops.hdmi_audio_get_caps(query, -+ caps); -+ -+ return retval; -+} -+ -+inline int had_set_caps(enum had_caps_list set_element, void *caps) -+{ -+ int retval; -+ struct snd_intelhad *intelhaddata = had_data; -+ -+ retval = had_get_hwstate(intelhaddata); -+ if (!retval) -+ retval = intelhaddata->query_ops.hdmi_audio_set_caps( -+ set_element, caps); -+ -+ return retval; -+} -+ -+inline int had_read_register(uint32_t offset, uint32_t *data) -+{ -+ int retval; -+ struct snd_intelhad *intelhaddata = had_data; -+ -+ retval = had_get_hwstate(intelhaddata); -+ if (!retval) -+ retval = intelhaddata->reg_ops.hdmi_audio_read_register( -+ offset + intelhaddata->audio_cfg_offset, data); -+ -+ return retval; -+} -+ -+inline int had_write_register(uint32_t offset, uint32_t data) -+{ -+ int retval; -+ struct snd_intelhad *intelhaddata = had_data; -+ -+ retval = had_get_hwstate(intelhaddata); -+ if (!retval) -+ retval = intelhaddata->reg_ops.hdmi_audio_write_register( -+ offset + intelhaddata->audio_cfg_offset, data); -+ -+ return retval; -+} -+ -+inline int had_read_modify(uint32_t offset, uint32_t data, uint32_t mask) -+{ -+ int retval; -+ struct snd_intelhad *intelhaddata = had_data; -+ -+ retval = had_get_hwstate(intelhaddata); -+ if (!retval) -+ retval = intelhaddata->reg_ops.hdmi_audio_read_modify( -+ offset + intelhaddata->audio_cfg_offset, -+ data, mask); -+ -+ return retval; -+} -+/** -+ * had_read_modify_aud_config_v2 - Specific function to read-modify -+ * AUD_CONFIG register on VLV2.The had_read_modify() function should not -+ * directly be used on VLV2 for updating AUD_CONFIG register. -+ * This is because: -+ * Bit6 of AUD_CONFIG register is writeonly due to a silicon bug on VLV2 -+ * HDMI IP. As a result a read-modify of AUD_CONFIG regiter will always -+ * clear bit6. AUD_CONFIG[6:4] represents the "channels" field of the -+ * register. This field should be 1xy binary for configuration with 6 or -+ * more channels. Read-modify of AUD_CONFIG (Eg. for enabling audio) -+ * causes the "channels" field to be updated as 0xy binary resulting in -+ * bad audio. The fix is to always write the AUD_CONFIG[6:4] with -+ * appropriate value when doing read-modify of AUD_CONFIG register. -+ * -+ * @substream: the current substream or NULL if no active substream -+ * @data : data to be written -+ * @mask : mask -+ * -+ */ -+inline int had_read_modify_aud_config_v2(struct snd_pcm_substream *substream, -+ uint32_t data, uint32_t mask) -+{ -+ union aud_cfg cfg_val = {.cfg_regval = 0}; -+ u8 channels; -+ -+ /* -+ * If substream is NULL, there is no active stream. -+ * In this case just set channels to 2 -+ */ -+ if (substream) -+ channels = substream->runtime->channels; -+ else -+ channels = 2; -+ cfg_val.cfg_regx_v2.num_ch = channels - 2; -+ -+ data = data | cfg_val.cfg_regval; -+ mask = mask | AUD_CONFIG_CH_MASK_V2; -+ -+ pr_debug("%s : data = %x, mask =%x\n", __func__, data, mask); -+ -+ return had_read_modify(AUD_CONFIG, data, mask); -+} -+ -+/** -+ * snd_intelhad_enable_audio_v1 - to enable audio -+ * -+ * @substream: Current substream or NULL if no active substream. -+ * @enable: 1 if audio is to be enabled; 0 if audio is to be disabled. -+ * -+ */ -+static void snd_intelhad_enable_audio_v1(struct snd_pcm_substream *substream, -+ u8 enable) -+{ -+ had_read_modify(AUD_CONFIG, enable, BIT(0)); -+} -+ -+/** -+ * snd_intelhad_enable_audio_v2 - to enable audio -+ * -+ * @substream: Current substream or NULL if no active substream. -+ * @enable: 1 if audio is to be enabled; 0 if audio is to be disabled. -+ */ -+static void snd_intelhad_enable_audio_v2(struct snd_pcm_substream *substream, -+ u8 enable) -+{ -+ had_read_modify_aud_config_v2(substream, enable, BIT(0)); -+} -+ -+/** -+ * snd_intelhad_reset_audio_v1 - to reset audio subsystem -+ * -+ * @reset: 1 to reset audio; 0 to bring audio out of reset. -+ * -+ */ -+static void snd_intelhad_reset_audio_v1(u8 reset) -+{ -+ had_write_register(AUD_HDMI_STATUS, reset); -+} -+ -+/** -+ * snd_intelhad_reset_audio_v2 - to reset audio subsystem -+ * -+ * @reset: 1 to reset audio; 0 to bring audio out of reset. -+ * -+ */ -+static void snd_intelhad_reset_audio_v2(u8 reset) -+{ -+ had_write_register(AUD_HDMI_STATUS_v2, reset); -+} -+ -+/** -+ * had_prog_status_reg - to initialize audio channel status registers -+ * -+ * @substream:substream for which the prepare function is called -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback -+ */ -+static int had_prog_status_reg(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata) -+{ -+ union aud_ch_status_0 ch_stat0 = {.status_0_regval = 0}; -+ union aud_ch_status_1 ch_stat1 = {.status_1_regval = 0}; -+ int format; -+ -+ pr_debug("Entry %s\n", __func__); -+ -+ ch_stat0.status_0_regx.lpcm_id = (intelhaddata->aes_bits & -+ IEC958_AES0_NONAUDIO)>>1; -+ ch_stat0.status_0_regx.clk_acc = (intelhaddata->aes_bits & -+ IEC958_AES3_CON_CLOCK)>>4; -+ -+ switch (substream->runtime->rate) { -+ case AUD_SAMPLE_RATE_32: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_32KHZ; -+ break; -+ -+ case AUD_SAMPLE_RATE_44_1: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_44KHZ; -+ break; -+ case AUD_SAMPLE_RATE_48: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_48KHZ; -+ break; -+ case AUD_SAMPLE_RATE_88_2: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_88KHZ; -+ break; -+ case AUD_SAMPLE_RATE_96: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_96KHZ; -+ break; -+ case AUD_SAMPLE_RATE_176_4: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_176KHZ; -+ break; -+ case AUD_SAMPLE_RATE_192: -+ ch_stat0.status_0_regx.samp_freq = CH_STATUS_MAP_192KHZ; -+ break; -+ -+ default: -+ /* control should never come here */ -+ return -EINVAL; -+ break; -+ -+ } -+ had_write_register(AUD_CH_STATUS_0, ch_stat0.status_0_regval); -+ -+ format = substream->runtime->format; -+ -+ if (format == SNDRV_PCM_FORMAT_S16_LE) { -+ ch_stat1.status_1_regx.max_wrd_len = MAX_SMPL_WIDTH_20; -+ ch_stat1.status_1_regx.wrd_len = SMPL_WIDTH_16BITS; -+ } else if (format == SNDRV_PCM_FORMAT_S24_LE) { -+ ch_stat1.status_1_regx.max_wrd_len = MAX_SMPL_WIDTH_24; -+ ch_stat1.status_1_regx.wrd_len = SMPL_WIDTH_24BITS; -+ } else { -+ ch_stat1.status_1_regx.max_wrd_len = 0; -+ ch_stat1.status_1_regx.wrd_len = 0; -+ } -+ had_write_register(AUD_CH_STATUS_1, ch_stat1.status_1_regval); -+ return 0; -+} -+ -+/** -+ * snd_intelhad_prog_audio_ctrl_v2 - to initialize audio -+ * registers and buffer confgiuration registers -+ * -+ * @substream:substream for which the prepare function is called -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback -+ */ -+int snd_intelhad_prog_audio_ctrl_v2(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata) -+{ -+ union aud_cfg cfg_val = {.cfg_regval = 0}; -+ union aud_buf_config buf_cfg = {.buf_cfgval = 0}; -+ u8 channels; -+ -+ had_prog_status_reg(substream, intelhaddata); -+ -+ buf_cfg.buf_cfg_regx_v2.audio_fifo_watermark = FIFO_THRESHOLD; -+ buf_cfg.buf_cfg_regx_v2.dma_fifo_watermark = DMA_FIFO_THRESHOLD; -+ buf_cfg.buf_cfg_regx_v2.aud_delay = 0; -+ had_write_register(AUD_BUF_CONFIG, buf_cfg.buf_cfgval); -+ -+ channels = substream->runtime->channels; -+ cfg_val.cfg_regx_v2.num_ch = channels - 2; -+ if (channels <= 2) -+ cfg_val.cfg_regx_v2.layout = LAYOUT0; -+ else -+ cfg_val.cfg_regx_v2.layout = LAYOUT1; -+ -+ cfg_val.cfg_regx_v2.val_bit = 1; -+ had_write_register(AUD_CONFIG, cfg_val.cfg_regval); -+ return 0; -+} -+ -+/** -+ * snd_intelhad_prog_audio_ctrl_v1 - to initialize audio -+ * registers and buffer confgiuration registers -+ * -+ * @substream:substream for which the prepare function is called -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback -+ */ -+int snd_intelhad_prog_audio_ctrl_v1(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata) -+{ -+ union aud_cfg cfg_val = {.cfg_regval = 0}; -+ union aud_buf_config buf_cfg = {.buf_cfgval = 0}; -+ u8 channels; -+ -+ had_prog_status_reg(substream, intelhaddata); -+ -+ buf_cfg.buf_cfg_regx.fifo_width = FIFO_THRESHOLD; -+ buf_cfg.buf_cfg_regx.aud_delay = 0; -+ had_write_register(AUD_BUF_CONFIG, buf_cfg.buf_cfgval); -+ -+ channels = substream->runtime->channels; -+ -+ switch (channels) { -+ case 1: -+ case 2: -+ cfg_val.cfg_regx.num_ch = CH_STEREO; -+ cfg_val.cfg_regx.layout = LAYOUT0; -+ break; -+ -+ case 3: -+ case 4: -+ cfg_val.cfg_regx.num_ch = CH_THREE_FOUR; -+ cfg_val.cfg_regx.layout = LAYOUT1; -+ break; -+ -+ case 5: -+ case 6: -+ cfg_val.cfg_regx.num_ch = CH_FIVE_SIX; -+ cfg_val.cfg_regx.layout = LAYOUT1; -+ break; -+ -+ case 7: -+ case 8: -+ cfg_val.cfg_regx.num_ch = CH_SEVEN_EIGHT; -+ cfg_val.cfg_regx.layout = LAYOUT1; -+ break; -+ -+ } -+ -+ cfg_val.cfg_regx.val_bit = 1; -+ had_write_register(AUD_CONFIG, cfg_val.cfg_regval); -+ return 0; -+} -+/* -+ * Compute derived values in channel_allocations[]. -+ */ -+static void init_channel_allocations(void) -+{ -+ int i, j; -+ struct cea_channel_speaker_allocation *p; -+ -+ pr_debug("%s: Enter\n", __func__); -+ -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ p = channel_allocations + i; -+ p->channels = 0; -+ p->spk_mask = 0; -+ for (j = 0; j < ARRAY_SIZE(p->speakers); j++) -+ if (p->speakers[j]) { -+ p->channels++; -+ p->spk_mask |= p->speakers[j]; -+ } -+ } -+} -+ -+/* -+ * The transformation takes two steps: -+ * -+ * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask -+ * spk_mask => (channel_allocations[]) => ai->CA -+ * -+ * TODO: it could select the wrong CA from multiple candidates. -+*/ -+static int snd_intelhad_channel_allocation(struct snd_intelhad *intelhaddata, -+ int channels) -+{ -+ int i; -+ int ca = 0; -+ int spk_mask = 0; -+ -+ /* -+ * CA defaults to 0 for basic stereo audio -+ */ -+ if (channels <= 2) -+ return 0; -+ -+ /* -+ * expand ELD's speaker allocation mask -+ * -+ * ELD tells the speaker mask in a compact(paired) form, -+ * expand ELD's notions to match the ones used by Audio InfoFrame. -+ */ -+ -+ for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { -+ if (intelhaddata->eeld.speaker_allocation_block & (1 << i)) -+ spk_mask |= eld_speaker_allocation_bits[i]; -+ } -+ -+ /* search for the first working match in the CA table */ -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ if (channels == channel_allocations[i].channels && -+ (spk_mask & channel_allocations[i].spk_mask) == -+ channel_allocations[i].spk_mask) { -+ ca = channel_allocations[i].ca_index; -+ break; -+ } -+ } -+ -+ pr_debug("HDMI: select CA 0x%x for %d\n", ca, channels); -+ -+ return ca; -+} -+ -+/* from speaker bit mask to ALSA API channel position */ -+static int spk_to_chmap(int spk) -+{ -+ struct channel_map_table *t = map_tables; -+ -+ for (; t->map; t++) { -+ if (t->spk_mask == spk) -+ return t->map; -+ } -+ return 0; -+} -+ -+void had_build_channel_allocation_map(struct snd_intelhad *intelhaddata) -+{ -+ int i = 0, c = 0; -+ int spk_mask = 0; -+ struct snd_pcm_chmap_elem *chmap; -+ uint8_t eld_high, eld_high_mask = 0xF0; -+ uint8_t high_msb; -+ -+ chmap = kzalloc(sizeof(*chmap), GFP_KERNEL); -+ if (chmap == NULL) { -+ intelhaddata->chmap->chmap = NULL; -+ return; -+ } -+ -+ had_get_caps(HAD_GET_ELD, &intelhaddata->eeld); -+ -+ pr_debug("eeld.speaker_allocation_block = %x\n", -+ intelhaddata->eeld.speaker_allocation_block); -+ -+ /* WA: Fix the max channel supported to 8 */ -+ -+ /* -+ * Sink may support more than 8 channels, if eld_high has more than -+ * one bit set. SOC supports max 8 channels. -+ * Refer eld_speaker_allocation_bits, for sink speaker allocation -+ */ -+ -+ /* if 0x2F < eld < 0x4F fall back to 0x2f, else fall back to 0x4F */ -+ eld_high = intelhaddata->eeld.speaker_allocation_block & eld_high_mask; -+ if ((eld_high & (eld_high-1)) && (eld_high > 0x1F)) { -+ /* eld_high & (eld_high-1): if more than 1 bit set */ -+ /* 0x1F: 7 channels */ -+ for (i = 1; i < 4; i++) { -+ high_msb = eld_high & (0x80 >> i); -+ if (high_msb) { -+ intelhaddata->eeld.speaker_allocation_block &= -+ high_msb | 0xF; -+ break; -+ } -+ } -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { -+ if (intelhaddata->eeld.speaker_allocation_block & (1 << i)) -+ spk_mask |= eld_speaker_allocation_bits[i]; -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { -+ if (spk_mask == channel_allocations[i].spk_mask) { -+ for (c = 0; c < channel_allocations[i].channels; c++) { -+ chmap->map[c] = spk_to_chmap( -+ channel_allocations[i].speakers[ -+ (MAX_SPEAKERS - 1)-c]); -+ } -+ chmap->channels = channel_allocations[i].channels; -+ intelhaddata->chmap->chmap = chmap; -+ break; -+ } -+ } -+ if (i >= ARRAY_SIZE(channel_allocations)) { -+ intelhaddata->chmap->chmap = NULL; -+ kfree(chmap); -+ } -+} -+ -+/* -+ ** ALSA API channel-map control callbacks -+ **/ -+static int had_chmap_ctl_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ struct snd_intelhad *intelhaddata = info->private_data; -+ -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) -+ return -ENODEV; -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = HAD_MAX_CHANNEL; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = SNDRV_CHMAP_LAST; -+ return 0; -+} -+ -+#ifndef USE_ALSA_DEFAULT_TLV -+static int had_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, -+ unsigned int size, unsigned int __user *tlv) -+{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ struct snd_intelhad *intelhaddata = info->private_data; -+ -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) -+ return -ENODEV; -+ -+ /* TODO: Fix for query channel map */ -+ return -EPERM; -+} -+#endif -+ -+static int had_chmap_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); -+ struct snd_intelhad *intelhaddata = info->private_data; -+ int i = 0; -+ const struct snd_pcm_chmap_elem *chmap; -+ -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) -+ return -ENODEV; -+ if (intelhaddata->chmap->chmap == NULL) -+ return -ENODATA; -+ chmap = intelhaddata->chmap->chmap; -+ for (i = 0; i < chmap->channels; i++) { -+ ucontrol->value.integer.value[i] = chmap->map[i]; -+ pr_debug("chmap->map[%d] = %d\n", i, chmap->map[i]); -+ } -+ -+ return 0; -+} -+ -+static int had_chmap_ctl_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ /* TODO: Get channel map and set swap register */ -+ return -EPERM; -+} -+ -+static int had_register_chmap_ctls(struct snd_intelhad *intelhaddata, -+ struct snd_pcm *pcm) -+{ -+ int err = 0; -+ -+ err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, -+ NULL, 0, (unsigned long)intelhaddata, -+ &intelhaddata->chmap); -+ if (err < 0) -+ return err; -+ -+ intelhaddata->chmap->private_data = intelhaddata; -+ intelhaddata->kctl = intelhaddata->chmap->kctl; -+ intelhaddata->kctl->info = had_chmap_ctl_info; -+ intelhaddata->kctl->get = had_chmap_ctl_get; -+ intelhaddata->kctl->put = had_chmap_ctl_put; -+#ifndef USE_ALSA_DEFAULT_TLV -+ intelhaddata->kctl->tlv.c = had_chmap_ctl_tlv; -+#endif -+ intelhaddata->chmap->chmap = NULL; -+ return 0; -+} -+ -+/** -+ * snd_intelhad_prog_dip_v1 - to initialize Data Island Packets registers -+ * -+ * @substream:substream for which the prepare function is called -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback -+ */ -+static void snd_intelhad_prog_dip_v1(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata) -+{ -+ int i; -+ union aud_ctrl_st ctrl_state = {.ctrl_val = 0}; -+ union aud_info_frame2 frame2 = {.fr2_val = 0}; -+ union aud_info_frame3 frame3 = {.fr3_val = 0}; -+ u8 checksum = 0; -+ int channels; -+ -+ channels = substream->runtime->channels; -+ -+ had_write_register(AUD_CNTL_ST, ctrl_state.ctrl_val); -+ -+ frame2.fr2_regx.chnl_cnt = substream->runtime->channels - 1; -+ -+ frame3.fr3_regx.chnl_alloc = snd_intelhad_channel_allocation( -+ intelhaddata, channels); -+ -+ /*Calculte the byte wide checksum for all valid DIP words*/ -+ for (i = 0; i < BYTES_PER_WORD; i++) -+ checksum += (INFO_FRAME_WORD1 >> i*BITS_PER_BYTE) & MASK_BYTE0; -+ for (i = 0; i < BYTES_PER_WORD; i++) -+ checksum += (frame2.fr2_val >> i*BITS_PER_BYTE) & MASK_BYTE0; -+ for (i = 0; i < BYTES_PER_WORD; i++) -+ checksum += (frame3.fr3_val >> i*BITS_PER_BYTE) & MASK_BYTE0; -+ -+ frame2.fr2_regx.chksum = -(checksum); -+ -+ had_write_register(AUD_HDMIW_INFOFR, INFO_FRAME_WORD1); -+ had_write_register(AUD_HDMIW_INFOFR, frame2.fr2_val); -+ had_write_register(AUD_HDMIW_INFOFR, frame3.fr3_val); -+ -+ /* program remaining DIP words with zero */ -+ for (i = 0; i < HAD_MAX_DIP_WORDS-VALID_DIP_WORDS; i++) -+ had_write_register(AUD_HDMIW_INFOFR, 0x0); -+ -+ ctrl_state.ctrl_regx.dip_freq = 1; -+ ctrl_state.ctrl_regx.dip_en_sta = 1; -+ had_write_register(AUD_CNTL_ST, ctrl_state.ctrl_val); -+} -+ -+/** -+ * snd_intelhad_prog_dip_v2 - to initialize Data Island Packets registers -+ * -+ * @substream:substream for which the prepare function is called -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback -+ */ -+static void snd_intelhad_prog_dip_v2(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata) -+{ -+ int i; -+ union aud_ctrl_st ctrl_state = {.ctrl_val = 0}; -+ union aud_info_frame2 frame2 = {.fr2_val = 0}; -+ union aud_info_frame3 frame3 = {.fr3_val = 0}; -+ u8 checksum = 0; -+ int channels; -+ -+ channels = substream->runtime->channels; -+ -+ had_write_register(AUD_CNTL_ST, ctrl_state.ctrl_val); -+ -+ frame2.fr2_regx.chnl_cnt = substream->runtime->channels - 1; -+ -+ frame3.fr3_regx.chnl_alloc = snd_intelhad_channel_allocation( -+ intelhaddata, channels); -+ -+ /*Calculte the byte wide checksum for all valid DIP words*/ -+ for (i = 0; i < BYTES_PER_WORD; i++) -+ checksum += (INFO_FRAME_WORD1 >> i*BITS_PER_BYTE) & MASK_BYTE0; -+ for (i = 0; i < BYTES_PER_WORD; i++) -+ checksum += (frame2.fr2_val >> i*BITS_PER_BYTE) & MASK_BYTE0; -+ for (i = 0; i < BYTES_PER_WORD; i++) -+ checksum += (frame3.fr3_val >> i*BITS_PER_BYTE) & MASK_BYTE0; -+ -+ frame2.fr2_regx.chksum = -(checksum); -+ -+ had_write_register(AUD_HDMIW_INFOFR_v2, INFO_FRAME_WORD1); -+ had_write_register(AUD_HDMIW_INFOFR_v2, frame2.fr2_val); -+ had_write_register(AUD_HDMIW_INFOFR_v2, frame3.fr3_val); -+ -+ /* program remaining DIP words with zero */ -+ for (i = 0; i < HAD_MAX_DIP_WORDS-VALID_DIP_WORDS; i++) -+ had_write_register(AUD_HDMIW_INFOFR_v2, 0x0); -+ -+ ctrl_state.ctrl_regx.dip_freq = 1; -+ ctrl_state.ctrl_regx.dip_en_sta = 1; -+ had_write_register(AUD_CNTL_ST, ctrl_state.ctrl_val); -+} -+ -+/** -+ * snd_intelhad_prog_buffer - programs buffer -+ * address and length registers -+ * -+ * @substream:substream for which the prepare function is called -+ * @intelhaddata:substream private data -+ * -+ * This function programs ring buffer address and length into registers. -+ */ -+int snd_intelhad_prog_buffer(struct snd_intelhad *intelhaddata, -+ int start, int end) -+{ -+ u32 ring_buf_addr, ring_buf_size, period_bytes; -+ u8 i, num_periods; -+ struct snd_pcm_substream *substream; -+ -+ substream = intelhaddata->stream_info.had_substream; -+ if (!substream) { -+ pr_err("substream is NULL\n"); -+ dump_stack(); -+ return 0; -+ } -+ -+ ring_buf_addr = substream->runtime->dma_addr; -+ ring_buf_size = snd_pcm_lib_buffer_bytes(substream); -+ intelhaddata->stream_info.ring_buf_size = ring_buf_size; -+ period_bytes = frames_to_bytes(substream->runtime, -+ substream->runtime->period_size); -+ num_periods = substream->runtime->periods; -+ -+ /* -+ * buffer addr should be 64 byte aligned, period bytes -+ * will be used to calculate addr offset -+ */ -+ period_bytes &= ~0x3F; -+ -+ /* Hardware supports MAX_PERIODS buffers */ -+ if (end >= HAD_MAX_PERIODS) -+ return -EINVAL; -+ -+ for (i = start; i <= end; i++) { -+ /* Program the buf registers with addr and len */ -+ intelhaddata->buf_info[i].buf_addr = ring_buf_addr + -+ (i * period_bytes); -+ if (i < num_periods-1) -+ intelhaddata->buf_info[i].buf_size = period_bytes; -+ else -+ intelhaddata->buf_info[i].buf_size = ring_buf_size - -+ (period_bytes*i); -+ -+ had_write_register(AUD_BUF_A_ADDR + (i * HAD_REG_WIDTH), -+ intelhaddata->buf_info[i].buf_addr | -+ BIT(0) | BIT(1)); -+ had_write_register(AUD_BUF_A_LENGTH + (i * HAD_REG_WIDTH), -+ period_bytes); -+ intelhaddata->buf_info[i].is_valid = true; -+ } -+ pr_debug("%s:buf[%d-%d] addr=%#x and size=%d\n", __func__, start, end, -+ intelhaddata->buf_info[start].buf_addr, -+ intelhaddata->buf_info[start].buf_size); -+ intelhaddata->valid_buf_cnt = num_periods; -+ return 0; -+} -+ -+inline int snd_intelhad_read_len(struct snd_intelhad *intelhaddata) -+{ -+ int i, retval = 0; -+ u32 len[4]; -+ -+ for (i = 0; i < 4 ; i++) { -+ had_read_register(AUD_BUF_A_LENGTH + (i * HAD_REG_WIDTH), -+ &len[i]); -+ if (!len[i]) -+ retval++; -+ } -+ if (retval != 1) { -+ for (i = 0; i < 4 ; i++) -+ pr_debug("buf[%d] size=%d\n", i, len[i]); -+ } -+ -+ return retval; -+} -+ -+/** -+ * snd_intelhad_prog_cts_v1 - Program HDMI audio CTS value -+ * -+ * @aud_samp_freq: sampling frequency of audio data -+ * @tmds: sampling frequency of the display data -+ * @n_param: N value, depends on aud_samp_freq -+ * @intelhaddata:substream private data -+ * -+ * Program CTS register based on the audio and display sampling frequency -+ */ -+static void snd_intelhad_prog_cts_v1(u32 aud_samp_freq, u32 tmds, u32 n_param, -+ struct snd_intelhad *intelhaddata) -+{ -+ u32 cts_val; -+ u64 dividend, divisor; -+ -+ /* Calculate CTS according to HDMI 1.3a spec*/ -+ dividend = (u64)tmds * n_param*1000; -+ divisor = 128 * aud_samp_freq; -+ cts_val = div64_u64(dividend, divisor); -+ pr_debug("TMDS value=%d, N value=%d, CTS Value=%d\n", -+ tmds, n_param, cts_val); -+ had_write_register(AUD_HDMI_CTS, (BIT(20) | cts_val)); -+} -+ -+/** -+ * snd_intelhad_prog_cts_v2 - Program HDMI audio CTS value -+ * -+ * @aud_samp_freq: sampling frequency of audio data -+ * @tmds: sampling frequency of the display data -+ * @n_param: N value, depends on aud_samp_freq -+ * @intelhaddata:substream private data -+ * -+ * Program CTS register based on the audio and display sampling frequency -+ */ -+static void snd_intelhad_prog_cts_v2(u32 aud_samp_freq, u32 tmds, u32 n_param, -+ struct snd_intelhad *intelhaddata) -+{ -+ u32 cts_val; -+ u64 dividend, divisor; -+ -+ /* Calculate CTS according to HDMI 1.3a spec*/ -+ dividend = (u64)tmds * n_param*1000; -+ divisor = 128 * aud_samp_freq; -+ cts_val = div64_u64(dividend, divisor); -+ pr_debug("TMDS value=%d, N value=%d, CTS Value=%d\n", -+ tmds, n_param, cts_val); -+ had_write_register(AUD_HDMI_CTS, (BIT(24) | cts_val)); -+} -+ -+static int had_calculate_n_value(u32 aud_samp_freq) -+{ -+ s32 n_val; -+ -+ /* Select N according to HDMI 1.3a spec*/ -+ switch (aud_samp_freq) { -+ case AUD_SAMPLE_RATE_32: -+ n_val = 4096; -+ break; -+ -+ case AUD_SAMPLE_RATE_44_1: -+ n_val = 6272; -+ break; -+ -+ case AUD_SAMPLE_RATE_48: -+ n_val = 6144; -+ break; -+ -+ case AUD_SAMPLE_RATE_88_2: -+ n_val = 12544; -+ break; -+ -+ case AUD_SAMPLE_RATE_96: -+ n_val = 12288; -+ break; -+ -+ case AUD_SAMPLE_RATE_176_4: -+ n_val = 25088; -+ break; -+ -+ case HAD_MAX_RATE: -+ n_val = 24576; -+ break; -+ -+ default: -+ n_val = -EINVAL; -+ break; -+ } -+ return n_val; -+} -+ -+/** -+ * snd_intelhad_prog_n_v1 - Program HDMI audio N value -+ * -+ * @aud_samp_freq: sampling frequency of audio data -+ * @n_param: N value, depends on aud_samp_freq -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback. -+ * It programs based on the audio and display sampling frequency -+ */ -+static int snd_intelhad_prog_n_v1(u32 aud_samp_freq, u32 *n_param, -+ struct snd_intelhad *intelhaddata) -+{ -+ s32 n_val; -+ -+ n_val = had_calculate_n_value(aud_samp_freq); -+ -+ if (n_val < 0) -+ return n_val; -+ -+ had_write_register(AUD_N_ENABLE, (BIT(20) | n_val)); -+ *n_param = n_val; -+ return 0; -+} -+ -+/** -+ * snd_intelhad_prog_n_v2 - Program HDMI audio N value -+ * -+ * @aud_samp_freq: sampling frequency of audio data -+ * @n_param: N value, depends on aud_samp_freq -+ * @intelhaddata:substream private data -+ * -+ * This function is called in the prepare callback. -+ * It programs based on the audio and display sampling frequency -+ */ -+static int snd_intelhad_prog_n_v2(u32 aud_samp_freq, u32 *n_param, -+ struct snd_intelhad *intelhaddata) -+{ -+ s32 n_val; -+ -+ n_val = had_calculate_n_value(aud_samp_freq); -+ -+ if (n_val < 0) -+ return n_val; -+ -+ had_write_register(AUD_N_ENABLE, (BIT(24) | n_val)); -+ *n_param = n_val; -+ return 0; -+} -+ -+static void had_clear_underrun_intr_v1(struct snd_intelhad *intelhaddata) -+{ -+ u32 hdmi_status, i = 0; -+ -+ /* Handle Underrun interrupt within Audio Unit */ -+ had_write_register(AUD_CONFIG, 0); -+ /* Reset buffer pointers */ -+ had_write_register(AUD_HDMI_STATUS, 1); -+ had_write_register(AUD_HDMI_STATUS, 0); -+ /** -+ * The interrupt status 'sticky' bits might not be cleared by -+ * setting '1' to that bit once... -+ */ -+ do { /* clear bit30, 31 AUD_HDMI_STATUS */ -+ had_read_register(AUD_HDMI_STATUS, &hdmi_status); -+ pr_debug("HDMI status =0x%x\n", hdmi_status); -+ if (hdmi_status & AUD_CONFIG_MASK_UNDERRUN) { -+ i++; -+ hdmi_status &= (AUD_CONFIG_MASK_SRDBG | -+ AUD_CONFIG_MASK_FUNCRST); -+ hdmi_status |= ~AUD_CONFIG_MASK_UNDERRUN; -+ had_write_register(AUD_HDMI_STATUS, hdmi_status); -+ } else -+ break; -+ } while (i < MAX_CNT); -+ if (i >= MAX_CNT) -+ pr_err("Unable to clear UNDERRUN bits\n"); -+} -+ -+static void had_clear_underrun_intr_v2(struct snd_intelhad *intelhaddata) -+{ -+ u32 hdmi_status, i = 0; -+ -+ /* Handle Underrun interrupt within Audio Unit */ -+ had_write_register(AUD_CONFIG, 0); -+ /* Reset buffer pointers */ -+ had_write_register(AUD_HDMI_STATUS_v2, 1); -+ had_write_register(AUD_HDMI_STATUS_v2, 0); -+ /** -+ * The interrupt status 'sticky' bits might not be cleared by -+ * setting '1' to that bit once... -+ */ -+ do { /* clear bit30, 31 AUD_HDMI_STATUS */ -+ had_read_register(AUD_HDMI_STATUS_v2, &hdmi_status); -+ pr_debug("HDMI status =0x%x\n", hdmi_status); -+ if (hdmi_status & AUD_CONFIG_MASK_UNDERRUN) { -+ i++; -+ had_write_register(AUD_HDMI_STATUS_v2, hdmi_status); -+ } else -+ break; -+ } while (i < MAX_CNT); -+ if (i >= MAX_CNT) -+ pr_err("Unable to clear UNDERRUN bits\n"); -+} -+ -+/** -+* snd_intelhad_open - stream initializations are done here -+* @substream:substream for which the stream function is called -+* -+* This function is called whenever a PCM stream is opened -+*/ -+static int snd_intelhad_open(struct snd_pcm_substream *substream) -+{ -+ struct snd_intelhad *intelhaddata; -+ struct snd_pcm_runtime *runtime; -+ struct had_stream_pvt *stream; -+ struct had_pvt_data *had_stream; -+ int retval; -+ -+ pr_debug("snd_intelhad_open called\n"); -+ intelhaddata = snd_pcm_substream_chip(substream); -+ had_stream = intelhaddata->private_data; -+ runtime = substream->runtime; -+ -+ pm_runtime_get(intelhaddata->dev); -+ -+ if (had_get_hwstate(intelhaddata)) { -+ pr_err("%s: HDMI cable plugged-out\n", __func__); -+ retval = -ENODEV; -+ goto exit_put_handle; -+ } -+ -+ /* Check, if device already in use */ -+ if (runtime->private_data) { -+ pr_err("Device already in use\n"); -+ retval = -EBUSY; -+ goto exit_put_handle; -+ } -+ -+ /* set the runtime hw parameter with local snd_pcm_hardware struct */ -+ runtime->hw = snd_intel_hadstream; -+ -+ stream = kzalloc(sizeof(*stream), GFP_KERNEL); -+ if (!stream) { -+ retval = -ENOMEM; -+ goto exit_put_handle; -+ } -+ stream->stream_status = STREAM_INIT; -+ runtime->private_data = stream; -+ -+ retval = snd_pcm_hw_constraint_integer(runtime, -+ SNDRV_PCM_HW_PARAM_PERIODS); -+ if (retval < 0) -+ goto exit_err; -+ -+ /* Make sure, that the period size is always aligned -+ * 64byte boundary -+ */ -+ retval = snd_pcm_hw_constraint_step(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64); -+ if (retval < 0) { -+ pr_err("%s:step_size=64 failed,err=%d\n", __func__, retval); -+ goto exit_err; -+ } -+ -+ return retval; -+exit_err: -+ kfree(stream); -+exit_put_handle: -+ pm_runtime_put(intelhaddata->dev); -+ runtime->private_data = NULL; -+ return retval; -+} -+ -+/** -+* had_period_elapsed - updates the hardware pointer status -+* @had_substream:substream for which the stream function is called -+* -+*/ -+static void had_period_elapsed(void *had_substream) -+{ -+ struct snd_pcm_substream *substream = had_substream; -+ struct had_stream_pvt *stream; -+ -+ /* pr_debug("had_period_elapsed called\n"); */ -+ -+ if (!substream || !substream->runtime) -+ return; -+ stream = substream->runtime->private_data; -+ if (!stream) -+ return; -+ -+ if (stream->stream_status != STREAM_RUNNING) -+ return; -+ snd_pcm_period_elapsed(substream); -+} -+ -+/** -+* snd_intelhad_init_stream - internal function to initialize stream info -+* @substream:substream for which the stream function is called -+* -+*/ -+static int snd_intelhad_init_stream(struct snd_pcm_substream *substream) -+{ -+ struct snd_intelhad *intelhaddata = snd_pcm_substream_chip(substream); -+ -+ pr_debug("snd_intelhad_init_stream called\n"); -+ -+ pr_debug("setting buffer ptr param\n"); -+ intelhaddata->stream_info.period_elapsed = had_period_elapsed; -+ intelhaddata->stream_info.had_substream = substream; -+ intelhaddata->stream_info.buffer_ptr = 0; -+ intelhaddata->stream_info.buffer_rendered = 0; -+ intelhaddata->stream_info.sfreq = substream->runtime->rate; -+ return 0; -+} -+ -+/** -+ * snd_intelhad_close- to free parameteres when stream is stopped -+ * -+ * @substream: substream for which the function is called -+ * -+ * This function is called by ALSA framework when stream is stopped -+ */ -+static int snd_intelhad_close(struct snd_pcm_substream *substream) -+{ -+ struct snd_intelhad *intelhaddata; -+ struct snd_pcm_runtime *runtime; -+ -+ pr_debug("snd_intelhad_close called\n"); -+ -+ intelhaddata = snd_pcm_substream_chip(substream); -+ runtime = substream->runtime; -+ -+ if (!runtime->private_data) { -+ pr_debug("close() might have called after failed open"); -+ return 0; -+ } -+ -+ intelhaddata->stream_info.buffer_rendered = 0; -+ intelhaddata->stream_info.buffer_ptr = 0; -+ intelhaddata->stream_info.str_id = 0; -+ intelhaddata->stream_info.had_substream = NULL; -+ -+ /* Check if following drv_status modification is required - VA */ -+ if (intelhaddata->drv_status != HAD_DRV_DISCONNECTED) { -+ intelhaddata->drv_status = HAD_DRV_CONNECTED; -+ pr_debug("%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_CONNECTED\n", -+ __func__, __LINE__); -+ } -+ kfree(runtime->private_data); -+ runtime->private_data = NULL; -+ pm_runtime_put(intelhaddata->dev); -+ return 0; -+} -+ -+/** -+ * snd_intelhad_hw_params- to setup the hardware parameters -+ * like allocating the buffers -+ * -+ * @substream: substream for which the function is called -+ * @hw_params: hardware parameters -+ * -+ * This function is called by ALSA framework when hardware params are set -+ */ -+static int snd_intelhad_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *hw_params) -+{ -+ unsigned long addr; -+ int pages, buf_size, retval; -+ -+ pr_debug("snd_intelhad_hw_params called\n"); -+ -+ if (!hw_params) -+ return -EINVAL; -+ -+ buf_size = params_buffer_bytes(hw_params); -+ retval = snd_pcm_lib_malloc_pages(substream, buf_size); -+ if (retval < 0) -+ return retval; -+ pr_debug("%s:allocated memory = %d\n", __func__, buf_size); -+ /* mark the pages as uncached region */ -+ addr = (unsigned long) substream->runtime->dma_area; -+ pages = (substream->runtime->dma_bytes + PAGE_SIZE - 1) / PAGE_SIZE; -+ retval = set_memory_uc(addr, pages); -+ if (retval) { -+ pr_err("set_memory_uc failed.Error:%d\n", retval); -+ return retval; -+ } -+ memset(substream->runtime->dma_area, 0, buf_size); -+ -+ return retval; -+} -+ -+/** -+ * snd_intelhad_hw_free- to release the resources allocated during -+ * hardware params setup -+ * -+ * @substream: substream for which the function is called -+ * -+ * This function is called by ALSA framework before close callback. -+ * -+ */ -+static int snd_intelhad_hw_free(struct snd_pcm_substream *substream) -+{ -+ unsigned long addr; -+ u32 pages; -+ -+ pr_debug("snd_intelhad_hw_free called\n"); -+ -+ /* mark back the pages as cached/writeback region before the free */ -+ if (substream->runtime->dma_area != NULL) { -+ addr = (unsigned long) substream->runtime->dma_area; -+ pages = (substream->runtime->dma_bytes + PAGE_SIZE - 1) / -+ PAGE_SIZE; -+ set_memory_wb(addr, pages); -+ return snd_pcm_lib_free_pages(substream); -+ } -+ return 0; -+} -+ -+/** -+* snd_intelhad_pcm_trigger - stream activities are handled here -+* @substream:substream for which the stream function is called -+* @cmd:the stream commamd thats requested from upper layer -+* This function is called whenever an a stream activity is invoked -+*/ -+static int snd_intelhad_pcm_trigger(struct snd_pcm_substream *substream, -+ int cmd) -+{ -+ int caps, retval = 0; -+ unsigned long flag_irq; -+ struct snd_intelhad *intelhaddata; -+ struct had_stream_pvt *stream; -+ struct had_pvt_data *had_stream; -+ -+ pr_debug("snd_intelhad_pcm_trigger called\n"); -+ -+ intelhaddata = snd_pcm_substream_chip(substream); -+ stream = substream->runtime->private_data; -+ had_stream = intelhaddata->private_data; -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ pr_debug("Trigger Start\n"); -+ -+ /* Disable local INTRs till register prgmng is done */ -+ if (had_get_hwstate(intelhaddata)) { -+ pr_err("_START: HDMI cable plugged-out\n"); -+ retval = -ENODEV; -+ break; -+ } -+ stream->stream_status = STREAM_RUNNING; -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irq); -+ had_stream->stream_type = HAD_RUNNING_STREAM; -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irq); -+ -+ /* Enable Audio */ -+ /* -+ * ToDo: Need to enable UNDERRUN interrupts as well -+ * caps = HDMI_AUDIO_UNDERRUN | HDMI_AUDIO_BUFFER_DONE; -+ */ -+ caps = HDMI_AUDIO_BUFFER_DONE; -+ retval = had_set_caps(HAD_SET_ENABLE_AUDIO_INT, &caps); -+ retval = had_set_caps(HAD_SET_ENABLE_AUDIO, NULL); -+ intelhaddata->ops->enable_audio(substream, 1); -+ -+ pr_debug("Processed _Start\n"); -+ -+ break; -+ -+ case SNDRV_PCM_TRIGGER_STOP: -+ pr_debug("Trigger Stop\n"); -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irq); -+ intelhaddata->stream_info.str_id = 0; -+ intelhaddata->curr_buf = 0; -+ -+ /* Stop reporting BUFFER_DONE/UNDERRUN to above layers*/ -+ -+ had_stream->stream_type = HAD_INIT; -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irq); -+ /* Disable Audio */ -+ /* -+ * ToDo: Need to disable UNDERRUN interrupts as well -+ * caps = HDMI_AUDIO_UNDERRUN | HDMI_AUDIO_BUFFER_DONE; -+ */ -+ caps = HDMI_AUDIO_BUFFER_DONE; -+ had_set_caps(HAD_SET_DISABLE_AUDIO_INT, &caps); -+ intelhaddata->ops->enable_audio(substream, 0); -+ /* Reset buffer pointers */ -+ intelhaddata->ops->reset_audio(1); -+ intelhaddata->ops->reset_audio(0); -+ stream->stream_status = STREAM_DROPPED; -+ had_set_caps(HAD_SET_DISABLE_AUDIO, NULL); -+ break; -+ -+ default: -+ retval = -EINVAL; -+ } -+ return retval; -+} -+ -+/** -+* snd_intelhad_pcm_prepare- internal preparation before starting a stream -+* -+* @substream: substream for which the function is called -+* -+* This function is called when a stream is started for internal preparation. -+*/ -+static int snd_intelhad_pcm_prepare(struct snd_pcm_substream *substream) -+{ -+ int retval; -+ u32 disp_samp_freq, n_param; -+ struct snd_intelhad *intelhaddata; -+ struct snd_pcm_runtime *runtime; -+ struct had_pvt_data *had_stream; -+ -+ pr_debug("snd_intelhad_pcm_prepare called\n"); -+ -+ intelhaddata = snd_pcm_substream_chip(substream); -+ runtime = substream->runtime; -+ had_stream = intelhaddata->private_data; -+ -+ if (had_get_hwstate(intelhaddata)) { -+ pr_err("%s: HDMI cable plugged-out\n", __func__); -+ snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); -+ retval = -ENODEV; -+ goto prep_end; -+ } -+ -+ pr_debug("period_size=%d\n", -+ (int)frames_to_bytes(runtime, runtime->period_size)); -+ pr_debug("periods=%d\n", runtime->periods); -+ pr_debug("buffer_size=%d\n", (int)snd_pcm_lib_buffer_bytes(substream)); -+ pr_debug("rate=%d\n", runtime->rate); -+ pr_debug("channels=%d\n", runtime->channels); -+ -+ if (intelhaddata->stream_info.str_id) { -+ pr_debug("_prepare is called for existing str_id#%d\n", -+ intelhaddata->stream_info.str_id); -+ retval = snd_intelhad_pcm_trigger(substream, -+ SNDRV_PCM_TRIGGER_STOP); -+ return retval; -+ } -+ -+ retval = snd_intelhad_init_stream(substream); -+ if (retval) -+ goto prep_end; -+ -+ -+ /* Get N value in KHz */ -+ retval = had_get_caps(HAD_GET_DISPLAY_RATE, &disp_samp_freq); -+ if (retval) { -+ pr_err("querying display sampling freq failed %#x\n", retval); -+ goto prep_end; -+ } -+ -+ had_get_caps(HAD_GET_ELD, &intelhaddata->eeld); -+ -+ retval = intelhaddata->ops->prog_n(substream->runtime->rate, &n_param, -+ intelhaddata); -+ if (retval) { -+ pr_err("programming N value failed %#x\n", retval); -+ goto prep_end; -+ } -+ intelhaddata->ops->prog_cts(substream->runtime->rate, -+ disp_samp_freq, n_param, intelhaddata); -+ -+ intelhaddata->ops->prog_dip(substream, intelhaddata); -+ -+ retval = intelhaddata->ops->audio_ctrl(substream, intelhaddata); -+ -+ /* Prog buffer address */ -+ retval = snd_intelhad_prog_buffer(intelhaddata, -+ HAD_BUF_TYPE_A, HAD_BUF_TYPE_D); -+ -+ /* -+ * Program channel mapping in following order: -+ * FL, FR, C, LFE, RL, RR -+ */ -+ -+ had_write_register(AUD_BUF_CH_SWAP, SWAP_LFE_CENTER); -+ -+prep_end: -+ return retval; -+} -+ -+/** -+ * snd_intelhad_pcm_pointer- to send the current buffer pointerprocessed by hw -+ * -+ * @substream: substream for which the function is called -+ * -+ * This function is called by ALSA framework to get the current hw buffer ptr -+ * when a period is elapsed -+ */ -+static snd_pcm_uframes_t snd_intelhad_pcm_pointer( -+ struct snd_pcm_substream *substream) -+{ -+ struct snd_intelhad *intelhaddata; -+ u32 bytes_rendered = 0; -+ -+ /* pr_debug("snd_intelhad_pcm_pointer called\n"); */ -+ -+ intelhaddata = snd_pcm_substream_chip(substream); -+ -+ if (intelhaddata->flag_underrun) { -+ intelhaddata->flag_underrun = 0; -+ return SNDRV_PCM_POS_XRUN; -+ } -+ -+ if (intelhaddata->stream_info.buffer_rendered) -+ div_u64_rem(intelhaddata->stream_info.buffer_rendered, -+ intelhaddata->stream_info.ring_buf_size, -+ &(bytes_rendered)); -+ -+ intelhaddata->stream_info.buffer_ptr = bytes_to_frames( -+ substream->runtime, -+ bytes_rendered); -+ return intelhaddata->stream_info.buffer_ptr; -+} -+ -+/** -+* snd_intelhad_pcm_mmap- mmaps a kernel buffer to user space for copying data -+* -+* @substream: substream for which the function is called -+* @vma: struct instance of memory VMM memory area -+* -+* This function is called by OS when a user space component -+* tries to get mmap memory from driver -+*/ -+static int snd_intelhad_pcm_mmap(struct snd_pcm_substream *substream, -+ struct vm_area_struct *vma) -+{ -+ -+ pr_debug("snd_intelhad_pcm_mmap called\n"); -+ -+ pr_debug("entry with prot:%s\n", __func__); -+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -+ return remap_pfn_range(vma, vma->vm_start, -+ substream->dma_buffer.addr >> PAGE_SHIFT, -+ vma->vm_end - vma->vm_start, vma->vm_page_prot); -+} -+ -+int hdmi_audio_mode_change(struct snd_pcm_substream *substream) -+{ -+ int retval = 0; -+ u32 disp_samp_freq, n_param; -+ struct snd_intelhad *intelhaddata; -+ -+ intelhaddata = snd_pcm_substream_chip(substream); -+ -+ /* Disable Audio */ -+ intelhaddata->ops->enable_audio(substream, 0); -+ -+ /* Update CTS value */ -+ retval = had_get_caps(HAD_GET_DISPLAY_RATE, &disp_samp_freq); -+ if (retval) { -+ pr_err("querying display sampling freq failed %#x\n", retval); -+ goto out; -+ } -+ -+ retval = intelhaddata->ops->prog_n(substream->runtime->rate, &n_param, -+ intelhaddata); -+ if (retval) { -+ pr_err("programming N value failed %#x\n", retval); -+ goto out; -+ } -+ intelhaddata->ops->prog_cts(substream->runtime->rate, -+ disp_samp_freq, n_param, intelhaddata); -+ -+ /* Enable Audio */ -+ intelhaddata->ops->enable_audio(substream, 1); -+ -+out: -+ return retval; -+} -+ -+/*PCM operations structure and the calls back for the same */ -+struct snd_pcm_ops snd_intelhad_playback_ops = { -+ .open = snd_intelhad_open, -+ .close = snd_intelhad_close, -+ .ioctl = snd_pcm_lib_ioctl, -+ .hw_params = snd_intelhad_hw_params, -+ .hw_free = snd_intelhad_hw_free, -+ .prepare = snd_intelhad_pcm_prepare, -+ .trigger = snd_intelhad_pcm_trigger, -+ .pointer = snd_intelhad_pcm_pointer, -+ .mmap = snd_intelhad_pcm_mmap, -+}; -+ -+/** -+ * snd_intelhad_create - to crete alsa card instance -+ * -+ * @intelhaddata: pointer to internal context -+ * @card: pointer to card -+ * -+ * This function is called when the hdmi cable is plugged in -+ */ -+static int snd_intelhad_create( -+ struct snd_intelhad *intelhaddata, -+ struct snd_card *card) -+{ -+ int retval; -+ static struct snd_device_ops ops = { -+ }; -+ -+ pr_debug("snd_intelhad_create called\n"); -+ -+ if (!intelhaddata) -+ return -EINVAL; -+ -+ /* ALSA api to register the device */ -+ retval = snd_device_new(card, SNDRV_DEV_LOWLEVEL, intelhaddata, &ops); -+ return retval; -+} -+/** -+ * snd_intelhad_pcm_free - to free the memory allocated -+ * -+ * @pcm: pointer to pcm instance -+ * This function is called when the device is removed -+ */ -+static void snd_intelhad_pcm_free(struct snd_pcm *pcm) -+{ -+ pr_debug("Freeing PCM preallocated pages\n"); -+ snd_pcm_lib_preallocate_free_for_all(pcm); -+} -+ -+static int had_iec958_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int had_iec958_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct snd_intelhad *intelhaddata = snd_kcontrol_chip(kcontrol); -+ -+ ucontrol->value.iec958.status[0] = (intelhaddata->aes_bits >> 0) & 0xff; -+ ucontrol->value.iec958.status[1] = (intelhaddata->aes_bits >> 8) & 0xff; -+ ucontrol->value.iec958.status[2] = -+ (intelhaddata->aes_bits >> 16) & 0xff; -+ ucontrol->value.iec958.status[3] = -+ (intelhaddata->aes_bits >> 24) & 0xff; -+ return 0; -+} -+static int had_iec958_mask_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ ucontrol->value.iec958.status[0] = 0xff; -+ ucontrol->value.iec958.status[1] = 0xff; -+ ucontrol->value.iec958.status[2] = 0xff; -+ ucontrol->value.iec958.status[3] = 0xff; -+ return 0; -+} -+static int had_iec958_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ unsigned int val; -+ struct snd_intelhad *intelhaddata = snd_kcontrol_chip(kcontrol); -+ -+ pr_debug("entered had_iec958_put\n"); -+ val = (ucontrol->value.iec958.status[0] << 0) | -+ (ucontrol->value.iec958.status[1] << 8) | -+ (ucontrol->value.iec958.status[2] << 16) | -+ (ucontrol->value.iec958.status[3] << 24); -+ if (intelhaddata->aes_bits != val) { -+ intelhaddata->aes_bits = val; -+ return 1; -+ } -+ return 1; -+} -+ -+static struct snd_kcontrol_new had_control_iec958_mask = { -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, MASK), -+ .info = had_iec958_info, /* shared */ -+ .get = had_iec958_mask_get, -+}; -+ -+static struct snd_kcontrol_new had_control_iec958 = { -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), -+ .info = had_iec958_info, -+ .get = had_iec958_get, -+ .put = had_iec958_put -+}; -+ -+static struct snd_intel_had_interface had_interface = { -+ .name = "hdmi-audio", -+ .query = hdmi_audio_query, -+ .suspend = hdmi_audio_suspend, -+ .resume = hdmi_audio_resume, -+}; -+ -+static struct had_ops had_ops_v1 = { -+ .enable_audio = snd_intelhad_enable_audio_v1, -+ .reset_audio = snd_intelhad_reset_audio_v1, -+ .prog_n = snd_intelhad_prog_n_v1, -+ .prog_cts = snd_intelhad_prog_cts_v1, -+ .audio_ctrl = snd_intelhad_prog_audio_ctrl_v1, -+ .prog_dip = snd_intelhad_prog_dip_v1, -+ .handle_underrun = had_clear_underrun_intr_v1, -+}; -+ -+static struct had_ops had_ops_v2 = { -+ .enable_audio = snd_intelhad_enable_audio_v2, -+ .reset_audio = snd_intelhad_reset_audio_v2, -+ .prog_n = snd_intelhad_prog_n_v2, -+ .prog_cts = snd_intelhad_prog_cts_v2, -+ .audio_ctrl = snd_intelhad_prog_audio_ctrl_v2, -+ .prog_dip = snd_intelhad_prog_dip_v2, -+ .handle_underrun = had_clear_underrun_intr_v2, -+}; -+/** -+ * hdmi_audio_probe - to create sound card instance for HDMI audio playabck -+ * -+ *@haddata: pointer to HAD private data -+ *@card_id: card for which probe is called -+ * -+ * This function is called when the hdmi cable is plugged in. This function -+ * creates and registers the sound card with ALSA -+ */ -+int hdmi_audio_probe(void *deviceptr) -+{ -+ int retval; -+ struct snd_pcm *pcm; -+ struct snd_card *card; -+ struct had_callback_ops ops_cb; -+ struct snd_intelhad *intelhaddata; -+ struct had_pvt_data *had_stream; -+ struct platform_device *devptr = deviceptr; -+ -+ pr_debug("Enter %s\n", __func__); -+ -+ pr_debug("hdmi_audio_probe dma_mask: %p\n", devptr->dev.dma_mask); -+ -+ /* allocate memory for saving internal context and working */ -+ intelhaddata = kzalloc(sizeof(*intelhaddata), GFP_KERNEL); -+ if (!intelhaddata) -+ return -ENOMEM; -+ -+ had_stream = kzalloc(sizeof(*had_stream), GFP_KERNEL); -+ if (!had_stream) { -+ retval = -ENOMEM; -+ goto free_haddata; -+ } -+ -+ had_data = intelhaddata; -+ ops_cb.intel_had_event_call_back = had_event_handler; -+ -+ /* registering with display driver to get access to display APIs */ -+ -+ retval = mid_hdmi_audio_setup( -+ ops_cb.intel_had_event_call_back, -+ &(intelhaddata->reg_ops), -+ &(intelhaddata->query_ops)); -+ if (retval) { -+ pr_err("querying display driver APIs failed %#x\n", retval); -+ goto free_hadstream; -+ } -+ mutex_lock(&had_mutex); -+ spin_lock_init(&intelhaddata->had_spinlock); -+ intelhaddata->drv_status = HAD_DRV_DISCONNECTED; -+ pr_debug("%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_DISCONNECTED\n", -+ __func__, __LINE__); -+ -+ /* create a card instance with ALSA framework */ -+ retval = snd_card_new(&devptr->dev, hdmi_card_index, hdmi_card_id, -+ THIS_MODULE, 0, &card); -+ -+ if (retval) -+ goto unlock_mutex; -+ intelhaddata->card = card; -+ intelhaddata->card_id = hdmi_card_id; -+ intelhaddata->card_index = card->number; -+ intelhaddata->private_data = had_stream; -+ intelhaddata->flag_underrun = 0; -+ intelhaddata->aes_bits = SNDRV_PCM_DEFAULT_CON_SPDIF; -+ strncpy(card->driver, INTEL_HAD, strlen(INTEL_HAD)); -+ strncpy(card->shortname, INTEL_HAD, strlen(INTEL_HAD)); -+ -+ retval = snd_pcm_new(card, INTEL_HAD, PCM_INDEX, MAX_PB_STREAMS, -+ MAX_CAP_STREAMS, &pcm); -+ if (retval) -+ goto err; -+ -+ /* setup private data which can be retrieved when required */ -+ pcm->private_data = intelhaddata; -+ pcm->private_free = snd_intelhad_pcm_free; -+ pcm->info_flags = 0; -+ strncpy(pcm->name, card->shortname, strlen(card->shortname)); -+ /* setup the ops for palyabck */ -+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, -+ &snd_intelhad_playback_ops); -+ /* allocate dma pages for ALSA stream operations -+ * memory allocated is based on size, not max value -+ * thus using same argument for max & size -+ */ -+ retval = snd_pcm_lib_preallocate_pages_for_all(pcm, -+ SNDRV_DMA_TYPE_DEV, NULL, -+ HAD_MAX_BUFFER, HAD_MAX_BUFFER); -+ -+ if (card->dev == NULL) -+ pr_debug("card->dev is NULL!!!!! Should not be this case\n"); -+ else if (card->dev->dma_mask == NULL) -+ pr_debug("hdmi_audio_probe dma_mask is NULL!!!!!\n"); -+ else -+ pr_debug("hdmi_audio_probe dma_mask is : %p\n", -+ card->dev->dma_mask); -+ -+ if (retval) -+ goto err; -+ -+ /* internal function call to register device with ALSA */ -+ retval = snd_intelhad_create(intelhaddata, card); -+ if (retval) -+ goto err; -+ -+ card->private_data = &intelhaddata; -+ retval = snd_card_register(card); -+ if (retval) -+ goto err; -+ -+ /* IEC958 controls */ -+ retval = snd_ctl_add(card, snd_ctl_new1(&had_control_iec958_mask, -+ intelhaddata)); -+ if (retval < 0) -+ goto err; -+ retval = snd_ctl_add(card, snd_ctl_new1(&had_control_iec958, -+ intelhaddata)); -+ if (retval < 0) -+ goto err; -+ -+ init_channel_allocations(); -+ -+ /* Register channel map controls */ -+ retval = had_register_chmap_ctls(intelhaddata, pcm); -+ if (retval < 0) -+ goto err; -+ -+ intelhaddata->dev = &devptr->dev; -+ pm_runtime_set_active(intelhaddata->dev); -+ pm_runtime_enable(intelhaddata->dev); -+ -+ mutex_unlock(&had_mutex); -+ retval = mid_hdmi_audio_register(&had_interface, intelhaddata); -+ if (retval) { -+ pr_err("registering with display driver failed %#x\n", retval); -+ snd_card_free(card); -+ goto free_hadstream; -+ } -+ -+ intelhaddata->hw_silence = 1; -+ had_ops_v1 = had_ops_v1; /* unused */ -+ intelhaddata->ops = &had_ops_v2; -+ -+ return retval; -+err: -+ snd_card_free(card); -+unlock_mutex: -+ mutex_unlock(&had_mutex); -+free_hadstream: -+ kfree(had_stream); -+ pm_runtime_disable(intelhaddata->dev); -+ intelhaddata->dev = NULL; -+free_haddata: -+ kfree(intelhaddata); -+ intelhaddata = NULL; -+ pr_err("Error returned from %s api %#x\n", __func__, retval); -+ return retval; -+} -+ -+/** -+ * hdmi_audio_remove - removes the alsa card -+ * -+ *@haddata: pointer to HAD private data -+ * -+ * This function is called when the hdmi cable is un-plugged. This function -+ * free the sound card. -+ */ -+int hdmi_audio_remove(void *pdevptr) -+{ -+ struct snd_intelhad *intelhaddata = had_data; -+ int caps; -+ -+ pr_debug("Enter %s\n", __func__); -+ -+ if (!intelhaddata) -+ return 0; -+ -+ if (intelhaddata->drv_status != HAD_DRV_DISCONNECTED) { -+ caps = HDMI_AUDIO_UNDERRUN | HDMI_AUDIO_BUFFER_DONE; -+ had_set_caps(HAD_SET_DISABLE_AUDIO_INT, &caps); -+ had_set_caps(HAD_SET_DISABLE_AUDIO, NULL); -+ } -+ snd_card_free(intelhaddata->card); -+ kfree(intelhaddata->private_data); -+ kfree(intelhaddata); -+ return 0; -+} -+ -+MODULE_AUTHOR("Sailaja Bandarupalli "); -+MODULE_AUTHOR("Ramesh Babu K V "); -+MODULE_AUTHOR("Vaibhav Agarwal "); -+MODULE_AUTHOR("Jerome Anand "); -+MODULE_DESCRIPTION("Intel HDMI Audio driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_SUPPORTED_DEVICE("{Intel,Intel_HAD}"); -+MODULE_VERSION(HAD_DRIVER_VERSION); -diff --git a/sound/x86/intel_hdmi_audio.h b/sound/x86/intel_hdmi_audio.h -new file mode 100644 -index 0000000..1ef25b6 ---- /dev/null -+++ b/sound/x86/intel_hdmi_audio.h -@@ -0,0 +1,201 @@ -+/* -+ * Copyright (C) 2016 Intel Corporation -+ * Authors: Sailaja Bandarupalli -+ * Ramesh Babu K V -+ * Vaibhav Agarwal -+ * Jerome Anand -+ * -+ * 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 (including the -+ * next paragraph) 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. -+ */ -+ -+#ifndef _INTEL_HDMI_AUDIO_H_ -+#define _INTEL_HDMI_AUDIO_H_ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "intel_hdmi_lpe_audio.h" -+ -+#define PCM_INDEX 0 -+#define MAX_PB_STREAMS 1 -+#define MAX_CAP_STREAMS 0 -+#define HDMI_AUDIO_DRIVER "hdmi-audio" -+ -+#define INFO_FRAME_WORD1 0x000a0184 -+#define FIFO_THRESHOLD 0xFE -+#define DMA_FIFO_THRESHOLD 0x7 -+#define BYTES_PER_WORD 0x4 -+ -+/* Sampling rate as per IEC60958 Ver 3 */ -+#define CH_STATUS_MAP_32KHZ 0x3 -+#define CH_STATUS_MAP_44KHZ 0x0 -+#define CH_STATUS_MAP_48KHZ 0x2 -+#define CH_STATUS_MAP_88KHZ 0x8 -+#define CH_STATUS_MAP_96KHZ 0xA -+#define CH_STATUS_MAP_176KHZ 0xC -+#define CH_STATUS_MAP_192KHZ 0xE -+ -+#define MAX_SMPL_WIDTH_20 0x0 -+#define MAX_SMPL_WIDTH_24 0x1 -+#define SMPL_WIDTH_16BITS 0x1 -+#define SMPL_WIDTH_24BITS 0x5 -+#define CHANNEL_ALLOCATION 0x1F -+#define MASK_BYTE0 0x000000FF -+#define VALID_DIP_WORDS 3 -+#define LAYOUT0 0 -+#define LAYOUT1 1 -+#define SWAP_LFE_CENTER 0x00fac4c8 -+#define AUD_CONFIG_CH_MASK_V2 0x70 -+ -+struct pcm_stream_info { -+ int str_id; -+ void *had_substream; -+ void (*period_elapsed)(void *had_substream); -+ u32 buffer_ptr; -+ u64 buffer_rendered; -+ u32 ring_buf_size; -+ int sfreq; -+}; -+ -+struct ring_buf_info { -+ uint32_t buf_addr; -+ uint32_t buf_size; -+ uint8_t is_valid; -+}; -+ -+struct had_stream_pvt { -+ enum had_stream_status stream_status; -+ int stream_ops; -+ ssize_t dbg_cum_bytes; -+}; -+ -+struct had_pvt_data { -+ enum had_status_stream stream_type; -+}; -+ -+struct had_callback_ops { -+ had_event_call_back intel_had_event_call_back; -+}; -+ -+/** -+ * struct snd_intelhad - intelhad driver structure -+ * -+ * @card: ptr to hold card details -+ * @card_index: sound card index -+ * @card_id: detected sound card id -+ * @reg_ops: register operations to program registers -+ * @query_ops: caps call backs for get/set operations -+ * @drv_status: driver status -+ * @buf_info: ring buffer info -+ * @stream_info: stream information -+ * @eeld: holds EELD info -+ * @curr_buf: pointer to hold current active ring buf -+ * @valid_buf_cnt: ring buffer count for stream -+ * @had_spinlock: driver lock -+ * @aes_bits: IEC958 status bits -+ * @buff_done: id of current buffer done intr -+ * @dev: platoform device handle -+ * @kctl: holds kctl ptrs used for channel map -+ * @chmap: holds channel map info -+ * @audio_reg_base: hdmi audio register base offset -+ * @hw_silence: flag indicates SoC support for HW silence/Keep alive -+ * @ops: holds ops functions based on platform -+ */ -+struct snd_intelhad { -+ struct snd_card *card; -+ int card_index; -+ char *card_id; -+ struct hdmi_audio_registers_ops reg_ops; -+ struct hdmi_audio_query_set_ops query_ops; -+ enum had_drv_status drv_status; -+ struct ring_buf_info buf_info[HAD_NUM_OF_RING_BUFS]; -+ struct pcm_stream_info stream_info; -+ union otm_hdmi_eld_t eeld; -+ enum intel_had_aud_buf_type curr_buf; -+ int valid_buf_cnt; -+ unsigned int aes_bits; -+ int flag_underrun; -+ struct had_pvt_data *private_data; -+ spinlock_t had_spinlock; -+ enum intel_had_aud_buf_type buff_done; -+ struct device *dev; -+ struct snd_kcontrol *kctl; -+ struct snd_pcm_chmap *chmap; -+ unsigned int *audio_reg_base; -+ unsigned int audio_cfg_offset; -+ bool hw_silence; -+ struct had_ops *ops; -+}; -+ -+struct had_ops { -+ void (*enable_audio)(struct snd_pcm_substream *substream, -+ u8 enable); -+ void (*reset_audio)(u8 reset); -+ int (*prog_n)(u32 aud_samp_freq, u32 *n_param, -+ struct snd_intelhad *intelhaddata); -+ void (*prog_cts)(u32 aud_samp_freq, u32 tmds, u32 n_param, -+ struct snd_intelhad *intelhaddata); -+ int (*audio_ctrl)(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata); -+ void (*prog_dip)(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata); -+ void (*handle_underrun)(struct snd_intelhad *intelhaddata); -+}; -+ -+ -+int had_event_handler(enum had_event_type event_type, void *data); -+ -+int hdmi_audio_query(void *drv_data, struct hdmi_audio_event event); -+int hdmi_audio_suspend(void *drv_data, struct hdmi_audio_event event); -+int hdmi_audio_resume(void *drv_data); -+int hdmi_audio_mode_change(struct snd_pcm_substream *substream); -+extern struct snd_pcm_ops snd_intelhad_playback_ops; -+ -+int snd_intelhad_init_audio_ctrl(struct snd_pcm_substream *substream, -+ struct snd_intelhad *intelhaddata, -+ int flag_silence); -+int snd_intelhad_prog_buffer(struct snd_intelhad *intelhaddata, -+ int start, int end); -+int snd_intelhad_invd_buffer(int start, int end); -+inline int snd_intelhad_read_len(struct snd_intelhad *intelhaddata); -+void had_build_channel_allocation_map(struct snd_intelhad *intelhaddata); -+ -+/* Register access functions */ -+inline int had_get_hwstate(struct snd_intelhad *intelhaddata); -+inline int had_get_caps(enum had_caps_list query_element, -+ void *capabilties); -+inline int had_set_caps(enum had_caps_list set_element, -+ void *capabilties); -+inline int had_read_register(uint32_t reg_addr, uint32_t *data); -+inline int had_write_register(uint32_t reg_addr, uint32_t data); -+inline int had_read_modify(uint32_t reg_addr, uint32_t data, -+ uint32_t mask); -+ -+/**/ -+int hdmi_audio_probe(void *devptr); -+int hdmi_audio_remove(void *pdev); -+ -+#endif /* _INTEL_HDMI_AUDIO_ */ -diff --git a/sound/x86/intel_hdmi_audio_if.c b/sound/x86/intel_hdmi_audio_if.c -new file mode 100644 -index 0000000..c650ba4 ---- /dev/null -+++ b/sound/x86/intel_hdmi_audio_if.c -@@ -0,0 +1,551 @@ -+/* -+ * intel_hdmi_audio_if.c - Intel HDMI audio driver for MID -+ * -+ * Copyright (C) 2016 Intel Corp -+ * Authors: Sailaja Bandarupalli -+ * Ramesh Babu K V -+ * Vaibhav Agarwal -+ * Jerome Anand -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ * -+ * 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; version 2 of the License. -+ * -+ * This program 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. -+ * -+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ * ALSA driver for Intel MID HDMI audio controller. This file contains -+ * interface functions exposed to HDMI Display driver and code to register -+ * with ALSA framework.. -+ */ -+ -+#define pr_fmt(fmt) "had: " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include "intel_hdmi_audio.h" -+#include "intel_hdmi_lpe_audio.h" -+ -+/** -+ * hdmi_audio_query - hdmi audio query function -+ * -+ *@haddata: pointer to HAD private data -+ *@event: audio event for which this method is invoked -+ * -+ * This function is called by client driver to query the -+ * hdmi audio. -+ */ -+int hdmi_audio_query(void *haddata, struct hdmi_audio_event event) -+{ -+ struct snd_pcm_substream *substream = NULL; -+ struct had_pvt_data *had_stream; -+ unsigned long flag_irqs; -+ struct snd_intelhad *intelhaddata = (struct snd_intelhad *)haddata; -+ -+ if (intelhaddata->stream_info.had_substream) -+ substream = intelhaddata->stream_info.had_substream; -+ had_stream = intelhaddata->private_data; -+ switch (event.type) { -+ case HAD_EVENT_QUERY_IS_AUDIO_BUSY: -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ -+ if ((had_stream->stream_type == HAD_RUNNING_STREAM) || -+ substream) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, -+ flag_irqs); -+ pr_debug("Audio stream active\n"); -+ return -EBUSY; -+ } -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ break; -+ -+ case HAD_EVENT_QUERY_IS_AUDIO_SUSPENDED: -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ if (intelhaddata->drv_status == HAD_DRV_SUSPENDED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, -+ flag_irqs); -+ pr_debug("Audio is suspended\n"); -+ return 1; -+ } -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ break; -+ -+ default: -+ pr_debug("error un-handled event !!\n"); -+ return -EINVAL; -+ break; -+ -+ } -+ -+ return 0; -+} -+ -+/** -+ * hdmi_audio_suspend - power management suspend function -+ * -+ *@haddata: pointer to HAD private data -+ *@event: pm event for which this method is invoked -+ * -+ * This function is called by client driver to suspend the -+ * hdmi audio. -+ */ -+int hdmi_audio_suspend(void *haddata, struct hdmi_audio_event event) -+{ -+ int caps, retval = 0; -+ struct had_pvt_data *had_stream; -+ unsigned long flag_irqs; -+ struct snd_pcm_substream *substream; -+ struct snd_intelhad *intelhaddata = (struct snd_intelhad *)haddata; -+ -+ pr_debug("Enter:%s\n", __func__); -+ -+ had_stream = intelhaddata->private_data; -+ substream = intelhaddata->stream_info.had_substream; -+ -+ if (intelhaddata->dev->power.runtime_status != RPM_SUSPENDED) { -+ pr_err("audio stream is active\n"); -+ return -EAGAIN; -+ } -+ -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_debug("had not connected\n"); -+ return retval; -+ } -+ -+ if (intelhaddata->drv_status == HAD_DRV_SUSPENDED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_debug("had already suspended\n"); -+ return retval; -+ } -+ -+ intelhaddata->drv_status = HAD_DRV_SUSPENDED; -+ pr_debug("%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_SUSPENDED\n", -+ __func__, __LINE__); -+ -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ /* -+ * ToDo: Need to disable UNDERRUN interrupts as well -+ * caps = HDMI_AUDIO_UNDERRUN | HDMI_AUDIO_BUFFER_DONE; -+ */ -+ caps = HDMI_AUDIO_BUFFER_DONE; -+ had_set_caps(HAD_SET_DISABLE_AUDIO_INT, &caps); -+ had_set_caps(HAD_SET_DISABLE_AUDIO, NULL); -+ pr_debug("Exit:%s", __func__); -+ return retval; -+} -+ -+/** -+ * hdmi_audio_resume - power management resume function -+ * -+ *@haddata: pointer to HAD private data -+ * -+ * This function is called by client driver to resume the -+ * hdmi audio. -+ */ -+int hdmi_audio_resume(void *haddata) -+{ -+ int caps, retval = 0; -+ struct snd_intelhad *intelhaddata = (struct snd_intelhad *)haddata; -+ unsigned long flag_irqs; -+ -+ pr_debug("Enter:%s\n", __func__); -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_debug("had not connected\n"); -+ return 0; -+ } -+ -+ if (intelhaddata->drv_status != HAD_DRV_SUSPENDED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_err("had is not in suspended state\n"); -+ return 0; -+ } -+ -+ if (had_get_hwstate(intelhaddata)) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_err("Failed to resume. Device not accessible\n"); -+ return -ENODEV; -+ } -+ -+ intelhaddata->drv_status = HAD_DRV_CONNECTED; -+ pr_debug("%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_DISCONNECTED\n", -+ __func__, __LINE__); -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ /* -+ * ToDo: Need to enable UNDERRUN interrupts as well -+ * caps = HDMI_AUDIO_UNDERRUN | HDMI_AUDIO_BUFFER_DONE; -+ */ -+ caps = HDMI_AUDIO_BUFFER_DONE; -+ retval = had_set_caps(HAD_SET_ENABLE_AUDIO_INT, &caps); -+ retval = had_set_caps(HAD_SET_ENABLE_AUDIO, NULL); -+ pr_debug("Exit:%s", __func__); -+ return retval; -+} -+ -+static inline int had_chk_intrmiss(struct snd_intelhad *intelhaddata, -+ enum intel_had_aud_buf_type buf_id) -+{ -+ int i, intr_count = 0; -+ enum intel_had_aud_buf_type buff_done; -+ u32 buf_size, buf_addr; -+ struct had_pvt_data *had_stream; -+ unsigned long flag_irqs; -+ -+ had_stream = intelhaddata->private_data; -+ -+ buff_done = buf_id; -+ -+ intr_count = snd_intelhad_read_len(intelhaddata); -+ if (intr_count > 1) { -+ /* In case of active playback */ -+ pr_err("Driver detected %d missed buffer done interrupt(s)!!!!\n", -+ (intr_count - 1)); -+ if (intr_count > 3) -+ return intr_count; -+ -+ buf_id += (intr_count - 1); -+ /* Reprogram registers*/ -+ for (i = buff_done; i < buf_id; i++) { -+ int j = i % 4; -+ -+ buf_size = intelhaddata->buf_info[j].buf_size; -+ buf_addr = intelhaddata->buf_info[j].buf_addr; -+ had_write_register(AUD_BUF_A_LENGTH + -+ (j * HAD_REG_WIDTH), buf_size); -+ had_write_register( -+ AUD_BUF_A_ADDR+(j * HAD_REG_WIDTH), -+ (buf_addr | BIT(0) | BIT(1))); -+ } -+ buf_id = buf_id % 4; -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ intelhaddata->buff_done = buf_id; -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ } -+ -+ return intr_count; -+} -+ -+int had_process_buffer_done(struct snd_intelhad *intelhaddata) -+{ -+ int retval = 0; -+ u32 len = 1; -+ enum intel_had_aud_buf_type buf_id; -+ enum intel_had_aud_buf_type buff_done; -+ struct pcm_stream_info *stream; -+ u32 buf_size; -+ struct had_pvt_data *had_stream; -+ int intr_count; -+ enum had_status_stream stream_type; -+ unsigned long flag_irqs; -+ -+ had_stream = intelhaddata->private_data; -+ stream = &intelhaddata->stream_info; -+ intr_count = 1; -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_err("%s:Device already disconnected\n", __func__); -+ return retval; -+ } -+ buf_id = intelhaddata->curr_buf; -+ intelhaddata->buff_done = buf_id; -+ buff_done = intelhaddata->buff_done; -+ buf_size = intelhaddata->buf_info[buf_id].buf_size; -+ stream_type = had_stream->stream_type; -+ -+ pr_debug("Enter:%s buf_id=%d\n", __func__, buf_id); -+ -+ /* Every debug statement has an implication -+ * of ~5msec. Thus, avoid having >3 debug statements -+ * for each buffer_done handling. -+ */ -+ -+ /* Check for any intr_miss in case of active playback */ -+ if (had_stream->stream_type == HAD_RUNNING_STREAM) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ intr_count = had_chk_intrmiss(intelhaddata, buf_id); -+ if (!intr_count || (intr_count > 3)) { -+ pr_err("HAD SW state in non-recoverable!!! mode\n"); -+ pr_err("Already played stale data\n"); -+ return retval; -+ } -+ buf_id += (intr_count - 1); -+ buf_id = buf_id % 4; -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ } -+ -+ intelhaddata->buf_info[buf_id].is_valid = true; -+ if (intelhaddata->valid_buf_cnt-1 == buf_id) { -+ if (had_stream->stream_type >= HAD_RUNNING_STREAM) -+ intelhaddata->curr_buf = HAD_BUF_TYPE_A; -+ } else -+ intelhaddata->curr_buf = buf_id + 1; -+ -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ -+ if (had_get_hwstate(intelhaddata)) { -+ pr_err("HDMI cable plugged-out\n"); -+ return retval; -+ } -+ -+ /*Reprogram the registers with addr and length*/ -+ had_write_register(AUD_BUF_A_LENGTH + -+ (buf_id * HAD_REG_WIDTH), buf_size); -+ had_write_register(AUD_BUF_A_ADDR+(buf_id * HAD_REG_WIDTH), -+ intelhaddata->buf_info[buf_id].buf_addr| -+ BIT(0) | BIT(1)); -+ -+ had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), -+ &len); -+ pr_debug("%s:Enabled buf[%d]\n", __func__, buf_id); -+ -+ /* In case of actual data, -+ * report buffer_done to above ALSA layer -+ */ -+ buf_size = intelhaddata->buf_info[buf_id].buf_size; -+ if (stream_type >= HAD_RUNNING_STREAM) { -+ intelhaddata->stream_info.buffer_rendered += -+ (intr_count * buf_size); -+ stream->period_elapsed(stream->had_substream); -+ } -+ -+ return retval; -+} -+ -+int had_process_buffer_underrun(struct snd_intelhad *intelhaddata) -+{ -+ int retval = 0; -+ enum intel_had_aud_buf_type buf_id; -+ struct pcm_stream_info *stream; -+ struct had_pvt_data *had_stream; -+ enum had_status_stream stream_type; -+ unsigned long flag_irqs; -+ int drv_status; -+ -+ had_stream = intelhaddata->private_data; -+ stream = &intelhaddata->stream_info; -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ buf_id = intelhaddata->curr_buf; -+ stream_type = had_stream->stream_type; -+ intelhaddata->buff_done = buf_id; -+ drv_status = intelhaddata->drv_status; -+ if (stream_type == HAD_RUNNING_STREAM) -+ intelhaddata->curr_buf = HAD_BUF_TYPE_A; -+ -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ -+ pr_debug("Enter:%s buf_id=%d, stream_type=%d\n", -+ __func__, buf_id, stream_type); -+ -+ intelhaddata->ops->handle_underrun(intelhaddata); -+ -+ if (drv_status == HAD_DRV_DISCONNECTED) { -+ pr_err("%s:Device already disconnected\n", __func__); -+ return retval; -+ } -+ -+ if (stream_type == HAD_RUNNING_STREAM) { -+ /* Report UNDERRUN error to above layers */ -+ intelhaddata->flag_underrun = 1; -+ stream->period_elapsed(stream->had_substream); -+ } -+ -+ return retval; -+} -+ -+int had_process_hot_plug(struct snd_intelhad *intelhaddata) -+{ -+ int retval = 0; -+ enum intel_had_aud_buf_type buf_id; -+ struct snd_pcm_substream *substream; -+ struct had_pvt_data *had_stream; -+ unsigned long flag_irqs; -+ -+ pr_debug("Enter:%s\n", __func__); -+ -+ substream = intelhaddata->stream_info.had_substream; -+ had_stream = intelhaddata->private_data; -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ if (intelhaddata->drv_status == HAD_DRV_CONNECTED) { -+ pr_debug("Device already connected\n"); -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ return retval; -+ } -+ buf_id = intelhaddata->curr_buf; -+ intelhaddata->buff_done = buf_id; -+ intelhaddata->drv_status = HAD_DRV_CONNECTED; -+ pr_debug("%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_CONNECTED\n", -+ __func__, __LINE__); -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ -+ pr_debug("Processing HOT_PLUG, buf_id = %d\n", buf_id); -+ -+ /* Query display driver for audio register base */ -+ if (intelhaddata->reg_ops.hdmi_audio_get_register_base( -+ &intelhaddata->audio_reg_base, -+ &intelhaddata->audio_cfg_offset)) { -+ pr_err("Unable to get audio reg base from Display driver\n"); -+ goto err; -+ } -+ -+ if (intelhaddata->audio_reg_base == NULL) { -+ pr_err("audio reg base value is NULL\n"); -+ goto err; -+ } -+ -+ pr_debug("%s audio_reg_base = 0x%p\n", __func__, -+ intelhaddata->audio_reg_base); -+ -+ /* Safety check */ -+ if (substream) { -+ pr_debug("There should not be active PB from ALSA\n"); -+ pr_debug("Signifies, cable is plugged-in even before\n"); -+ pr_debug("processing snd_pcm_disconnect\n"); -+ /* Set runtime->state to hw_params done */ -+ snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); -+ } -+ -+ had_build_channel_allocation_map(intelhaddata); -+ -+ return retval; -+ -+err: -+ pm_runtime_disable(intelhaddata->dev); -+ intelhaddata->dev = NULL; -+ return retval; -+} -+ -+int had_process_hot_unplug(struct snd_intelhad *intelhaddata) -+{ -+ int caps, retval = 0; -+ enum intel_had_aud_buf_type buf_id; -+ struct had_pvt_data *had_stream; -+ unsigned long flag_irqs; -+ -+ pr_debug("Enter:%s\n", __func__); -+ -+ had_stream = intelhaddata->private_data; -+ buf_id = intelhaddata->curr_buf; -+ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ -+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) { -+ pr_debug("Device already disconnected\n"); -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ return retval; -+ -+ } else { -+ /* Disable Audio */ -+ caps = HDMI_AUDIO_BUFFER_DONE; -+ retval = had_set_caps(HAD_SET_DISABLE_AUDIO_INT, &caps); -+ retval = had_set_caps(HAD_SET_DISABLE_AUDIO, NULL); -+ intelhaddata->ops->enable_audio( -+ intelhaddata->stream_info.had_substream, 0); -+ } -+ -+ intelhaddata->drv_status = HAD_DRV_DISCONNECTED; -+ pr_debug("%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_DISCONNECTED\n", -+ __func__, __LINE__); -+ -+ /* Report to above ALSA layer */ -+ if (intelhaddata->stream_info.had_substream != NULL) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ pr_debug("%s: unlock -> sending pcm_stop -> lock\n", __func__); -+ snd_pcm_stop(intelhaddata->stream_info.had_substream, -+ SNDRV_PCM_STATE_DISCONNECTED); -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ } -+ -+ had_stream->stream_type = HAD_INIT; -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ kfree(intelhaddata->chmap->chmap); -+ intelhaddata->chmap->chmap = NULL; -+ intelhaddata->audio_reg_base = NULL; -+ pr_debug("%s: unlocked -> returned\n", __func__); -+ -+ return retval; -+} -+ -+/** -+ * had_event_handler - Call back function to handle events -+ * -+ * @event_type: Event type to handle -+ * @data: data related to the event_type -+ * -+ * This function is invoked to handle HDMI events from client driver. -+ */ -+int had_event_handler(enum had_event_type event_type, void *data) -+{ -+ int retval = 0; -+ struct snd_intelhad *intelhaddata = data; -+ enum intel_had_aud_buf_type buf_id; -+ struct snd_pcm_substream *substream; -+ struct had_pvt_data *had_stream; -+ unsigned long flag_irqs; -+ -+ buf_id = intelhaddata->curr_buf; -+ had_stream = intelhaddata->private_data; -+ -+ /* Switching to a function can drop atomicity even in INTR context. -+ * Thus, a big lock is acquired to maintain atomicity. -+ * This can be optimized later. -+ * Currently, only buffer_done/_underrun executes in INTR context. -+ * Also, locking is implemented separately to avoid real contention -+ * of data(struct intelhaddata) between IRQ/SOFT_IRQ/PROCESS context. -+ */ -+ substream = intelhaddata->stream_info.had_substream; -+ switch (event_type) { -+ case HAD_EVENT_AUDIO_BUFFER_DONE: -+ retval = had_process_buffer_done(intelhaddata); -+ break; -+ -+ case HAD_EVENT_AUDIO_BUFFER_UNDERRUN: -+ retval = had_process_buffer_underrun(intelhaddata); -+ break; -+ -+ case HAD_EVENT_HOT_PLUG: -+ retval = had_process_hot_plug(intelhaddata); -+ break; -+ -+ case HAD_EVENT_HOT_UNPLUG: -+ retval = had_process_hot_unplug(intelhaddata); -+ break; -+ -+ case HAD_EVENT_MODE_CHANGING: -+ pr_debug(" called _event_handler with _MODE_CHANGE event\n"); -+ /* Process only if stream is active & cable Plugged-in */ -+ spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs); -+ if (intelhaddata->drv_status >= HAD_DRV_DISCONNECTED) { -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, -+ flag_irqs); -+ break; -+ } -+ spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs); -+ if ((had_stream->stream_type == HAD_RUNNING_STREAM) -+ && substream) -+ retval = hdmi_audio_mode_change(substream); -+ break; -+ -+ default: -+ pr_debug("error un-handled event !!\n"); -+ retval = -EINVAL; -+ break; -+ -+ } -+ return retval; -+} -diff --git a/sound/x86/intel_hdmi_lpe_audio.c b/sound/x86/intel_hdmi_lpe_audio.c -index f31ab72..16194c6 100644 ---- a/sound/x86/intel_hdmi_lpe_audio.c -+++ b/sound/x86/intel_hdmi_lpe_audio.c -@@ -36,6 +36,7 @@ - #include - #include - #include "intel_hdmi_lpe_audio.h" -+#include "intel_hdmi_audio.h" - - /* globals*/ - struct platform_device *gpdev; -@@ -461,9 +462,9 @@ static void notify_audio_lpe(void *audio_ptr) - /** - * hdmi_lpe_audio_probe - start bridge with i915 - * -- * This function is called when the i915 driver creates the hdmi-lpe-audio -- * platform device. Card creation is deferred until a hot plug event is -- * received -+ * This function is called when the i915 driver creates the -+ * hdmi-lpe-audio platform device. Card creation is deferred until a -+ * hot plug event is received - */ - static int hdmi_lpe_audio_probe(struct platform_device *pdev) - { -@@ -505,8 +506,8 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) - (unsigned int)res_mmio->start, (unsigned int)res_mmio->end); - - mmio_start = ioremap_nocache(res_mmio->start, -- (size_t)((res_mmio->end - res_mmio->start) -- + 1)); -+ (size_t)((res_mmio->end - -+ res_mmio->start) + 1)); - if (!mmio_start) { - pr_err("Could not get ioremap\n"); - return -EACCES; -@@ -556,11 +557,12 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) - - platform_set_drvdata(pdev, ctx); - -+ ret = hdmi_audio_probe((void *)pdev); -+ - pr_debug("hdmi lpe audio: setting pin eld notify callback\n"); - - spin_lock_irqsave(&pdata->lpe_audio_slock, flag_irq); - pdata->notify_audio_lpe = notify_audio_lpe; -- - if (pdata->notify_pending) { - - pr_debug("%s: handle pending notification\n", __func__); -@@ -584,6 +586,8 @@ static int hdmi_lpe_audio_remove(struct platform_device *pdev) - - pr_debug("Enter %s\n", __func__); - -+ hdmi_audio_remove(pdev); -+ - /* get context, release resources */ - ctx = platform_get_drvdata(pdev); - iounmap(ctx->mmio_start); - -From c87ce8ee9ca9f95c04ce71301a3cdff449613623 Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:41 +0530 -Subject: [PATCH 5/7] ALSA: x86: hdmi: Improve position reporting - -Use a hw register to calculate sub-period position reports. -This makes PulseAudio happier. - -Signed-off-by: David Henningsson -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - sound/x86/intel_hdmi_audio.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c -index 461b7d7..d9ce750 100644 ---- a/sound/x86/intel_hdmi_audio.c -+++ b/sound/x86/intel_hdmi_audio.c -@@ -1492,6 +1492,8 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( - { - struct snd_intelhad *intelhaddata; - u32 bytes_rendered = 0; -+ u32 t; -+ int buf_id; - - /* pr_debug("snd_intelhad_pcm_pointer called\n"); */ - -@@ -1502,6 +1504,14 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( - return SNDRV_PCM_POS_XRUN; - } - -+ buf_id = intelhaddata->curr_buf % 4; -+ had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t); -+ if (t == 0) { -+ pr_debug("discovered buffer done for buf %d\n", buf_id); -+ /* had_process_buffer_done(intelhaddata); */ -+ } -+ t = intelhaddata->buf_info[buf_id].buf_size - t; -+ - if (intelhaddata->stream_info.buffer_rendered) - div_u64_rem(intelhaddata->stream_info.buffer_rendered, - intelhaddata->stream_info.ring_buf_size, -@@ -1509,7 +1519,7 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( - - intelhaddata->stream_info.buffer_ptr = bytes_to_frames( - substream->runtime, -- bytes_rendered); -+ bytes_rendered + t); - return intelhaddata->stream_info.buffer_ptr; - } - - -From a23162c1f0c53395a827e2e092cd06065f5e5593 Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:42 +0530 -Subject: [PATCH 6/7] ALSA: x86: hdmi: Fixup some monitor - -This change was given to Canonical apparently to fix an issue with -on some monitor brand. It's not clear what this patch does but it doesn't -seem to have side effects. - -Signed-off-by: David Henningsson -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - sound/x86/intel_hdmi_audio.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c -index d9ce750..9249521 100644 ---- a/sound/x86/intel_hdmi_audio.c -+++ b/sound/x86/intel_hdmi_audio.c -@@ -337,6 +337,7 @@ static void snd_intelhad_reset_audio_v2(u8 reset) - static int had_prog_status_reg(struct snd_pcm_substream *substream, - struct snd_intelhad *intelhaddata) - { -+ union aud_cfg cfg_val = {.cfg_regval = 0}; - union aud_ch_status_0 ch_stat0 = {.status_0_regval = 0}; - union aud_ch_status_1 ch_stat1 = {.status_1_regval = 0}; - int format; -@@ -347,6 +348,7 @@ static int had_prog_status_reg(struct snd_pcm_substream *substream, - IEC958_AES0_NONAUDIO)>>1; - ch_stat0.status_0_regx.clk_acc = (intelhaddata->aes_bits & - IEC958_AES3_CON_CLOCK)>>4; -+ cfg_val.cfg_regx.val_bit = ch_stat0.status_0_regx.lpcm_id; - - switch (substream->runtime->rate) { - case AUD_SAMPLE_RATE_32: -@@ -426,7 +428,6 @@ int snd_intelhad_prog_audio_ctrl_v2(struct snd_pcm_substream *substream, - else - cfg_val.cfg_regx_v2.layout = LAYOUT1; - -- cfg_val.cfg_regx_v2.val_bit = 1; - had_write_register(AUD_CONFIG, cfg_val.cfg_regval); - return 0; - } -@@ -482,7 +483,6 @@ int snd_intelhad_prog_audio_ctrl_v1(struct snd_pcm_substream *substream, - - } - -- cfg_val.cfg_regx.val_bit = 1; - had_write_register(AUD_CONFIG, cfg_val.cfg_regval); - return 0; - } - -From b499980493120fe978ddccdf0f48d0a3e2af279f Mon Sep 17 00:00:00 2001 -From: Jerome Anand -Date: Mon, 12 Dec 2016 23:40:43 +0530 -Subject: [PATCH 7/7] ALSA: x86: hdmi: continue playback even when display - resolution changes - -When the display resolution changes, the drm disables the -display pipes due to which audio rendering stops. At this -time, we need to ensure the existing audio pointers and -buffers are cleared out so that the playback can restarted -once the display pipe is enabled with a different N/CTS values - -Signed-off-by: Pierre-Louis Bossart -Signed-off-by: Jerome Anand ---- - sound/x86/intel_hdmi_audio.c | 21 ++++++++++++++++++--- - 1 file changed, 18 insertions(+), 3 deletions(-) - -diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c -index 9249521..d6fd638 100644 ---- a/sound/x86/intel_hdmi_audio.c -+++ b/sound/x86/intel_hdmi_audio.c -@@ -43,6 +43,7 @@ static DEFINE_MUTEX(had_mutex); - static int hdmi_card_index = SNDRV_DEFAULT_IDX1; - static char *hdmi_card_id = SNDRV_DEFAULT_STR1; - static struct snd_intelhad *had_data; -+static int underrun_count; - - module_param(hdmi_card_index, int, 0444); - MODULE_PARM_DESC(hdmi_card_index, -@@ -1114,6 +1115,7 @@ static int snd_intelhad_open(struct snd_pcm_substream *substream) - intelhaddata = snd_pcm_substream_chip(substream); - had_stream = intelhaddata->private_data; - runtime = substream->runtime; -+ underrun_count = 0; - - pm_runtime_get(intelhaddata->dev); - -@@ -1506,10 +1508,23 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer( - - buf_id = intelhaddata->curr_buf % 4; - had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t); -- if (t == 0) { -- pr_debug("discovered buffer done for buf %d\n", buf_id); -- /* had_process_buffer_done(intelhaddata); */ -+ -+ if ((t == 0) || (t == ((u32)-1L))) { -+ underrun_count++; -+ pr_debug("discovered buffer done for buf %d, count = %d\n", -+ buf_id, underrun_count); -+ -+ if (underrun_count > (HAD_MIN_PERIODS/2)) { -+ pr_debug("assume audio_codec_reset, underrun = %d - do xrun\n", -+ underrun_count); -+ underrun_count = 0; -+ return SNDRV_PCM_POS_XRUN; -+ } -+ } else { -+ /* Reset Counter */ -+ underrun_count = 0; - } -+ - t = intelhaddata->buf_info[buf_id].buf_size - t; - - if (intelhaddata->stream_info.buffer_rendered) diff --git a/projects/Odroid_C2/bootloader/boot.ini b/projects/Odroid_C2/bootloader/boot.ini deleted file mode 100644 index 224485b4da..0000000000 --- a/projects/Odroid_C2/bootloader/boot.ini +++ /dev/null @@ -1,160 +0,0 @@ -#------------------------------------------------------------------------------------------------------ -# -# boot.ini identification -# -#------------------------------------------------------------------------------------------------------ -ODROIDC2-UBOOT-CONFIG - -#------------------------------------------------------------------------------------------------------ -# -# Boot Specific Stuff -# -#------------------------------------------------------------------------------------------------------ -setenv bootrootfs "boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2" - -#------------------------------------------------------------------------------------------------------ -# -# Console Setup -# setenv condev "console=ttyS0,115200n8" # on serial port -# setenv condev "console=tty0" # on display (HDMI) -# setenv condev "console=tty0 console=ttyS0,115200n8" # on both -# -#------------------------------------------------------------------------------------------------------ -setenv console "console=tty0" - -#------------------------------------------------------------------------------------------------------ -# -# Video -# Setup the video output (default is 1080p60hz) -# 480 Lines (720x480) -# setenv hdmimode "480i60hz" # Interlaced 60Hz -# setenv hdmimode "480i_rpt" # Interlaced for Rear Projection Televisions 60Hz -# setenv hdmimode "480p60hz" # 480 Progressive 60Hz -# setenv hdmimode "480p_rpt" # 480 Progressive for Rear Projection Televisions 60Hz -# 576 Lines (720x576) -# setenv hdmimode "576i50hz" # Interlaced 50Hz -# setenv hdmimode "576i_rpt" # Interlaced for Rear Projection Televisions 50Hz -# setenv hdmimode "576p50hz" # Progressive 50Hz -# setenv hdmimode "576p_rpt" # Progressive for Rear Projection Televisions 50Hz -# 720 Lines (1280x720) -# setenv hdmimode "720p60hz" # Progressive 60Hz -# setenv hdmimode "720p50hz" # Progressive 50Hz -# 1080 Lines (1920x1080) -# setenv hdmimode "1080i60hz" # Interlaced 60Hz -# setenv hdmimode "1080p60hz" # Progressive 60Hz -# setenv hdmimode "1080i50hz" # Interlaced 50Hz -# setenv hdmimode "1080p50hz" # Progressive 50Hz -# setenv hdmimode "1080p30hz" # Progressive 30Hz -# setenv hdmimode "1080p25hz" # Progressive 25Hz -# setenv hdmimode "1080p24hz" # Progressive 24Hz -# 4K (3840x2160) -# setenv hdmimode "2160p60hz" # Progressive 60Hz -# setenv hdmimode "2160p50hz" # Progressive 50Hz -# setenv hdmimode "2160p30hz" # Progressive 30Hz -# setenv hdmimode "2160p25hz" # Progressive 25Hz -# setenv hdmimode "2160p24hz" # Progressive 24Hz -# setenv hdmimode "2160p60hz420" # Progressive 60Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it) -# setenv hdmimode "2160p50hz420" # Progressive 50Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it) -# 4K2K (4096x2160) -# setenv hdmimode "smpte60hz" # Progressive 60Hz SMPTE -# setenv hdmimode "smpte50hz" # Progressive 50Hz SMPTE -# setenv hdmimode "smpte30hz" # Progressive 30Hz SMPTE -# setenv hdmimode "smpte25hz" # Progressive 25Hz SMPTE -# setenv hdmimode "smpte24hz" # Progressive 24Hz SMPTE -# setenv hdmimode "smpte60hz420" # Progressive 60Hz SMPTE with YCbCr 4:2:0 (Requires TV/Monitor that supports it) -# setenv hdmimode "smpte50hz420" # Progressive 50Hz SMPTE with YCbCr 4:2:0 (Requires TV/Monitor that supports it) -# -# Enable|Disable HDMI (Saves RAM) -# setenv hdmioutput "0" # Disabled -# setenv hdmioutput "1" # Enabled -# -# Enable|Disable VPU (Saves RAM) -# setenv vpu "0" # Disabled -# setenv vpu "1" # Enabled -# -#------------------------------------------------------------------------------------------------------ -setenv hdmioutput "1" -setenv vpu "1" - -#------------------------------------------------------------------------------------------------------ -# -# LibreELEC variables -# -# Setup the LibreELEC options -# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh -#------------------------------------------------------------------------------------------------------ -setenv libreelec "quiet" - -#------------------------------------------------------------------------------------------------------ -# -# Enable|Disable HDMI CEC Control -# setenv hdmi_cec "0" # Disabled -# setenv hdmi_cec "1" # Enabled -# -#------------------------------------------------------------------------------------------------------ -setenv hdmi_cec "1" - -#------------------------------------------------------------------------------------------------------ -# -# CPU Frequency / Cores control -# -# WARNING!!! WARNING!!! WARNING!!! -# Before changing anything here please read the wiki entry: -# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq -# -# MAX CPU's -# setenv maxcpus "1" -# setenv maxcpus "2" -# setenv maxcpus "3" -# setenv maxcpus "4" -# -# MAX Frequency -# setenv max_freq "2016" # 2.016GHz -# setenv max_freq "1944" # 1.944GHz -# setenv max_freq "1944" # 1.944GHz -# setenv max_freq "1920" # 1.920GHz -# setenv max_freq "1896" # 1.896GHz -# setenv max_freq "1752" # 1.752GHz -# setenv max_freq "1680" # 1.680GHz -# setenv max_freq "1656" # 1.656GHz -# setenv max_freq "1536" # 1.536GHz -# -#------------------------------------------------------------------------------------------------------ -setenv maxcpus "4" -setenv max_freq "1536" - -#------------------------------------------------------------------------------------------------------ -# -# Odroid C2 specific -# -#------------------------------------------------------------------------------------------------------ -setenv odroidp1 "no_console_suspend logo=${logoopt} vout=${outputmode},enable hdmimode=${hdmimode} cvbsmode=nocvbs" -setenv odroidp2 "mac=${ethaddr} consoleblank=0 max_freq=${max_freq} maxcpus=${maxcpus}" -setenv odroid "${odroidp1} ${odroidp2}" - -#------------------------------------------------------------------------------------------------------ -# -# U-Boot bootcmd command -# -#------------------------------------------------------------------------------------------------------ -setenv kernel "fatload mmc 0:1 0x11000000 KERNEL" -setenv dtb "fatload mmc 0:1 0x1000000 meson64_odroidc2.dtb" -setenv bootseq "booti 0x11000000 - 0x1000000" -setenv bootcmd "${kernel}; ${dtb}; ${bootseq}" - -#------------------------------------------------------------------------------------------------------ -# -# Kernel boot -# -#------------------------------------------------------------------------------------------------------ - -# Prepare to boot -if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi -if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi -if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi - -# Populate the final bootcmd -setenv bootargs "${console} ${bootrootfs} ${odroid} ${cec} ${libreelec}" - -# Boot the board -run bootcmd diff --git a/projects/Odroid_C2/filesystem/etc/amremote/remote.conf b/projects/Odroid_C2/filesystem/etc/amremote/remote.conf deleted file mode 100644 index f1b937180b..0000000000 --- a/projects/Odroid_C2/filesystem/etc/amremote/remote.conf +++ /dev/null @@ -1,57 +0,0 @@ -#********************************************************************************************************* -#this file is configuration for each factory remote device -# work_mode 0 :software mode 1 :hardware mode -# repeat_enable 0 :disable repeat 1 :enable repeat -# -# factory_code each device has it's unique factory code. -# pattern:custom_code(16bit)+index_code(16bit) -# examble: 0xff000001 = 0xff00(custom cod) 0001 (index) -# -# release_delay unit:ms.release will report from kernel to user layer after this period of time -# from press or repeat triggered. -# -# debug_enable 0 :debug disable 1 :debug disable -# -# SW MODE: -# bit_count how many bits in each frame -# tw_leader_act time window for leader active -# tw_bit0 time window for bit0 time. -# tw_bit1 time window for bit1 time -# tw_repeat_leader time window for repeat leader -# REG -# reg_base_gen set value for PREG_IR_DEC_BASE_GEN -# reg_control set value for PREG_IR_DEC_CONTROL -# reg_leader_act set value for PREG_IR_DEC_LEADER_ACTIVE -# reg_leader_idle set value for PREG_IR_DEC_LEADER_IDLE -# reg_repeat_leader set value for PREG_IR_DEC_REPEAT_IDLE -# reg_bit0_time set value for PREG_IR_DEC_BIT0_TIME -#************************************************************************************************************* -#amlogic NEC remote -factory_code = 0x4db20001 -work_mode = 0 -repeat_enable = 1 -repeat_delay = 40 -repeat_peroid = 39 -release_delay = 121 -debug_enable = 1 - -up_key_scancode = 0xca -down_key_scancode = 0xd2 -left_key_scancode = 0x99 -right_key_scancode = 0xc1 -ok_key_scancode = 0xce - -key_begin - 0xdc 116 ; KEY_POWER - 0x88 113 ; KEY_MUTE - 0x82 102 ; KEY_HOME - 0xca 103 ; KEY_UP - 0xd2 108 ; KEY_DOWN - 0x99 105 ; KEY_LEFT - 0xc1 106 ; KEY_RIGHT - 0xce 28 ; KEY_ENTER - 0x9a 1 ; KEY_ESC - 0xc5 46 ; KEY_C - 0x80 115 ; KEY_VOLUMEUP - 0x81 114 ; KEY_VOLUMEDOWN -key_end diff --git a/projects/Odroid_C2/filesystem/etc/lirc/lircd.conf.amremote b/projects/Odroid_C2/filesystem/etc/lirc/lircd.conf.amremote deleted file mode 100644 index ccdd9a15de..0000000000 --- a/projects/Odroid_C2/filesystem/etc/lirc/lircd.conf.amremote +++ /dev/null @@ -1,554 +0,0 @@ -begin remote - - name odroid_amremote - bits 16 - flags SPACE_ENC|CONST_LENGTH - eps 30 - aeps 100 - - header 9000 4500 - one 563 1687 - zero 563 562 - ptrail 563 - repeat 9000 2250 - pre_data_bits 16 - pre_data 0x4DB2 - gap 0 - suppress_repeat 1 - - begin codes - KEY_POWER 0x3BC4 - KEY_MUTE 0x11EE - KEY_HOME 0x41BE - KEY_OK 0x738C - KEY_LEFT 0x9966 - KEY_RIGHT 0x837C - KEY_UP 0x53AC - KEY_DOWN 0x4BB4 - KEY_BACK 0x59A6 - KEY_MENU 0xA35C - KEY_VOLUMEDOWN 0x817E - KEY_VOLUMEUP 0x01FE - end codes - -end remote - -# /etc/lirc/lircd.conf.rpi -# -# Lirc config for lirc_rpi (GPIO) receiver. -# Enables use of MCE Remote, Apple MacMini and XBOX remote. -# Should work with any generic receiver -# -# contributed by jenkins101 -# -######## -# -# brand: HP/Philips/Microsoft/Other -# model no. of remote control: Media Center Edition remote -# devices being controlled by this remote: myriad of devices with Media Center Edition receivers -# -# RC-6 config file -# -# source: http://home.hccnet.nl/m.majoor/projects_remote_control.htm -# http://home.hccnet.nl/m.majoor/pronto.pdf -# -# used by: Philips -# -######### -# -# Philips Media Center Edition remote control -# For use with the USB MCE ir receiver -# -# Dan Conti dconti|acm.wwu.edu -# -# Updated with codes for MCE 2005 Remote additional buttons -# *, #, Teletext, Red, Green, Yellow & Blue Buttons -# Note: TV power button transmits no code until programmed. -# Updated 12th September 2005 -# Graham Auld - mce|graham.auld.me.uk -# -# Radio, Print, RecTV are only available on the HP Media Center remote control -# -# -# Updated with codes for MCE 2007 Remote additional buttons -# Visualization, Aspect, SlideShow, Eject -# Note: -# Blue, Yellow, Green, Red, and Teletext buttons do not exist on some HP remote - -begin remote - - name mceusb - bits 16 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2667 889 - one 444 444 - zero 444 444 - pre_data_bits 21 - pre_data 0x37FF0 - gap 105000 - toggle_bit 22 - rc6_mask 0x100000000 - min_repeat 4 -# uncomment to suppress unwanted repeats - suppress_repeat 4 - - - begin codes - -#seen on HP Pavilion dv3t remote --Tim Mann, 3 Nov 2009 - KEY_VIDEO 0x00007b7f - KEY_PLAYPAUSE 0x00007b91 - - -#unused by HP remote - KEY_BLUE 0x00007ba1 - KEY_YELLOW 0x00007ba2 - KEY_GREEN 0x00007ba3 - KEY_RED 0x00007ba4 - KEY_TEXT 0x00007ba5 - -#ba6 - bae unused - BA6 0x00007ba6 - BA7 0x00007ba7 - BA8 0x00007ba8 - BA9 0x00007ba9 - BAA 0x00007baa - BAB 0x00007bab - BAC 0x00007bac - BAD 0x00007bad - BAE 0x00007bae - - KEY_RADIO 0x00007baf - Print 0x00007bb1 - -#bb2 - bb4 unused - BB2 0x00007bb2 - BB3 0x00007bb3 - BB4 0x00007bb4 - - KEY_VIDEO 0x00007bb5 - KEY_CAMERA 0x00007bb6 - KEY_PVR 0x00007bb7 - KEY_AUDIO 0x00007bb8 - KEY_TV 0x00007bb9 - -#bba - bbf unused - BBA 0x00007bba - BBB 0x00007bbb - BBC 0x00007bbc - BBD 0x00007bbd - BBE 0x00007bbe - BBF 0x00007bbf -#bc1 - bca unused - BC1 0x00007bc1 - BC2 0x00007bc2 - BC3 0x00007bc3 - BC4 0x00007bc4 - BC5 0x00007bc5 - BC6 0x00007bc6 - BC7 0x00007bc7 - BC8 0x00007bc8 - BC9 0x00007bc9 - BCA 0x00007bca - - KEY_EJECTCD 0x00007bcb - SlideShow 0x00007bcc - Visualization 0x00007bcd - -#bce - bcf unused - BCE 0x00007bce - BCF 0x00007bcf -#bd1 - bd7 unused - BD1 0x00007bd1 - BD2 0x00007bd2 - BD3 0x00007bd3 - BD4 0x00007bd4 - BD5 0x00007bd5 - BD6 0x00007bd6 - BD7 0x00007bd7 - - KEY_ANGLE 0x00007bd8 - KEY_EPG 0x00007bd9 - KEY_TV 0x00007bda - KEY_DVD 0x00007bdb -#NoGap - KEY_EXIT 0x00007bdc - KEY_OK 0x00007bdd - KEY_RIGHT 0x00007bde - KEY_LEFT 0x00007bdf - KEY_DOWN 0x00007be0 - KEY_UP 0x00007be1 -#NoGap - KEY_NUMERIC_STAR 0x00007be2 - KEY_NUMERIC_POUND 0x00007be3 -#NoGap - KEY_PREVIOUS 0x00007be4 - KEY_NEXT 0x00007be5 - KEY_STOP 0x00007be6 - KEY_PAUSE 0x00007be7 - KEY_RECORD 0x00007be8 - KEY_PLAY 0x00007be9 - KEY_REWIND 0x00007bea - KEY_FORWARD 0x00007beb -#NoGap - KEY_CHANNELDOWN 0x00007bec - KEY_CHANNELUP 0x00007bed - KEY_VOLUMEDOWN 0x00007bee - KEY_VOLUMEUP 0x00007bef -#NoGap - KEY_INFO 0x00007bf0 - KEY_MUTE 0x00007bf1 - KEY_HOME 0x00007bf2 - KEY_POWER 0x00007bf3 -#NoGap - KEY_ENTER 0x00007bf4 - KEY_CLEAR 0x00007bf5 -#NoGap - KEY_9 0x00007bf6 - KEY_8 0x00007bf7 - KEY_7 0x00007bf8 - KEY_6 0x00007bf9 - KEY_5 0x00007bfa - KEY_4 0x00007bfb - KEY_3 0x00007bfc - KEY_2 0x00007bfd - KEY_1 0x00007bfe - KEY_0 0x00007bff - end codes - -end remote - -# -# contributed by stevvie and jenkins101 -# -# brand: SIIG Vista MCE remote -# model no. of remote control: older Harmony and some vista mce remotes -# devices being controlled by this remote: -# - -begin remote - - name vista_mce - bits 16 - flags RC6 - eps 30 - aeps 100 - - header 2654 889 - one 427 427 - zero 427 427 - pre_data_bits 21 - pre_data 0x37FF0 - gap 69850 - min_repeat 4 -# increase to suppress unwanted repeats - suppress_repeat 4 - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_POWER 0xEBF3 # Power - KEY_CAMERA 0x6BB6 # Pictures - KEY_RADIO 0xEBAF # Radio - KEY_VIDEO 0x6BB5 # Videos - KEY_MUSIC 0xEBB8 # Music - KEY_RECORD 0x6BE8 # Rec - KEY_PAUSE 0xEBE7 # Pause - KEY_STOP 0x6BE6 # Stop - KEY_PREVIOUS 0xEBE4 # Skipback - KEY_PLAY 0x6BE9 # Play - KEY_NEXT 0xEBE5 # Skipfwd - KEY_REWIND 0x6BEA # Rwd - KEY_FORWARD 0xEBEB # Fwd - KEY_HOME 0x6BF2 # Start - KEY_EXIT 0xEBDC # Back - KEY_INFO 0x6BF0 # More - KEY_VOLUMEUP 0xEBEF # Volup - KEY_VOLUMEDOWN 0x6BEE # Voldown - KEY_CHANNELUP 0xEBED # Chup - KEY_CHANNELDOWN 0x6BEC # Chdown - KEY_UP 0xEBE1 # Up - KEY_DOWN 0x6BE0 # Down - KEY_LEFT 0xEBDF # Left - KEY_RIGHT 0x6BDE # Right - KEY_MUTE 0xEBF1 # Mute - KEY_PVR 0x6BB7 # Rectv - KEY_TITLE 0xEBD9 # Guide - KEY_TV 0x6BDA # Livetv - KEY_MENU 0xEBDB # Dvdmenu - KEY_1 0x6BFE # 1 - KEY_2 0xEBFD # 2 - KEY_3 0x6BFC # 3 - KEY_4 0xEBFB # 4 - KEY_5 0x6BFA # 5 - KEY_6 0xEBF9 # 6 - KEY_7 0x6BF8 # 7 - KEY_8 0xEBF7 # 8 - KEY_9 0x6BF6 # 9 - KEY_NUMERIC_STAR 0xEBE2 # * - KEY_0 0x6BFF # 0 - KEY_NUMERIC_POUND 0xEBE3 # # - KEY_CLEAR 0x6BF5 # Clear - KEY_ENTER 0xEBF4 # Enter - end codes - -end remote - -# -# this config file was automatically generated -# using lirc-0.8.2(macmini) on Tue Dec 11 11:35:26 2007 -# -# contributed by Sebastian Schaetzel -# -# brand: Apple -# model no. of remote control: A1156 -# devices being controlled by this remote: Mac mini, MacBookPro 15" -# SantaRosa (3.1), MacBook2 -# - -begin remote - - name Apple_A1156 - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - pre_data_bits 24 - pre_data 0x87EE81 - gap 211982 - toggle_bit_mask 0x0 - ignore_mask 0x0000ff01 - - begin codes - KEY_VOLUMEUP 0x0B - KEY_VOLUMEDOWN 0x0D - KEY_REWIND 0x08 - KEY_FORWARD 0x07 - KEY_PLAYPAUSE 0x04 - KEY_MENU 0x02 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.1-git(default) on Sat Jan 26 21:54:39 2013 -# -# contributed by -# -# brand: Microsoft -# model: Xbox DVD Remote -# devices being controlled by this remote: xbox - -begin remote - - name XboxDVDDongle - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - gap 63950 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats -# toggle_bit_mask 0x72 - toggle_bit_mask 0xE1 - - begin codes - KEY_OK 0x0B - KEY_OK 0xEA - KEY_STOP 0xE0 - KEY_PAUSE 0xE6 - KEY_NEXT 0xDF - KEY_PREVIOUS 0xDD - KEY_FASTFORWARD 0xE3 - KEY_REWIND 0xE2 - KEY_MEDIA 0xD5 - KEY_EPG 0xE5 - KEY_INFO 0xC3 - KEY_UP 0xA6 - KEY_DOWN 0xA7 - KEY_LEFT 0xA9 - KEY_RIGHT 0xA8 - KEY_MENU 0xF7 - KEY_EXIT 0xD8 - KEY_0 0xCF - KEY_1 0xCE - KEY_2 0xCD - KEY_3 0xCC - KEY_4 0xCB - KEY_5 0xCA - KEY_6 0xC9 - KEY_7 0xC8 - KEY_8 0xC7 - KEY_9 0xC6 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.0-pre1(default) on Sat Feb 23 12:47:57 2013 -# -# contributed by DynaMight -# -# brand: Xbox 360 remote -# model no. of remote control: -# devices being controlled by this remote: -# - -begin remote - - name Xbox 360 Remote - bits 13 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2685 886 - one 457 433 - zero 457 433 - pre_data_bits 24 - pre_data 0x1BFF80 - gap 107197 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_STOP 0x0BE6 - KEY_PLAY 0x0BE9 - KEY_VOLUMEDOWN 0x0BEE - KEY_VOLUMEUP 0x0BEF - KEY_MUTE 0x0BF1 - KEY_0 0x0BFF - KEY_1 0x0BFE - KEY_2 0x0BFD - KEY_3 0x0BFC - KEY_4 0x0BFB - KEY_5 0x0BFA - KEY_6 0x0BF9 - KEY_7 0x0BF8 - KEY_8 0x0BF7 - KEY_9 0x0BF6 - KEY_MENU 0x0BDB - KEY_YELLOW 0x0BD9 - KEY_BLUE 0x0B97 - KEY_GREEN 0x0B99 - KEY_RED 0x0BDA - KEY_REWIND 0x0BEA - KEY_PLAYPAUSE 0x0BE9 - KEY_FASTFORWARD 0x0BEB - KEY_EXIT 0x0BDC - KEY_TITLE 0x0BAE - KEY_STOP 0x0BE6 - KEY_INFO 0x0BF0 - KEY_UP 0x0BE1 - KEY_DOWN 0x0BE0 - KEY_LEFT 0x0BDF - KEY_RIGHT 0x0BDE - KEY_OK 0x0BDD - KEY_POWER 0x0BF3 - KEY_PAGEUP 0x0B93 - KEY_PAGEDOWN 0x0B92 - KEY_ENTER 0x0BF4 - KEY_RECORD 0x0BE8 - KEY_CLEAR 0x0BF5 - KEY_NEXTSONG 0x0BE5 - KEY_PREVIOUSSONG 0x0BE4 - KEY_DISPLAYTOGGLE 0x0BB0 - KEY_PAUSE 0x037FF00BE7 - end codes - -end remote - -# this config file was manually generated -# using WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Wed Feb 28 11:27:58 2007 -# -# contributed by Luca Cristoforetti -# -# brand: Dream Multimedia Dreambox 7025 -# model: URC-39930RJ0-03 -# devices being controlled by this remote: -# This is a remote with an option of a universal -# TV. Use TV CODE: 0680 -# -# (press TV, hold down shift until you got -# 2 blinks, enter the code and you get 2 -# flashes for confirmation) -# - -begin remote - - name Dream_Multimedia_URC-39930 - bits 24 - flags SPACE_ENC - eps 25 - aeps 100 - - header 3488 1710 - one 426 415 - zero 426 1287 - ptrail 426 - pre_data_bits 24 - pre_data 0xBFFBFE - gap 73939 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats - toggle_bit 0 - - - begin codes - KEY_POWER 0x0000000000FF4342 - KEY_1 0x0000000000FFF7F6 - KEY_2 0x0000000000FF7776 - KEY_3 0x0000000000FFB7B6 - KEY_4 0x0000000000FF3736 - KEY_5 0x0000000000FFD7D6 - KEY_6 0x0000000000FF5756 - KEY_7 0x0000000000FF9796 - KEY_8 0x0000000000FF1716 - KEY_9 0x0000000000FFE7E6 - KEY_0 0x0000000000FF6766 - < 0x0000000000FF5F5E - > 0x0000000000FF2322 - KEY_VOLUMEUP 0x0000000000FFFBFA - KEY_VOLUMEDOWN 0x0000000000FF7B7A - KEY_MUTE 0x0000000000FFB3B2 - KEY_EXIT 0x0000000000DF84A5 - KEY_CHANNELUP 0x0000000000FFD3D2 - KEY_CHANNELDOWN 0x0000000000FF5352 - KEY_INFO 0x0000000000FF6362 - KEY_UP 0x0000000000FFADAC - KEY_LEFT 0x0000000000FF8D8C - KEY_RIGHT 0x0000000000FF0D0C - KEY_DOWN 0x0000000000FF2D2C - KEY_OK 0x0000000000FF6D6C - KEY_MENU 0x0000000000FF1E1F - KEY_AUDIO 0x0000000000FF3435 - KEY_VIDEO 0x0000000000FF1312 - KEY_BACKSPACE 0x0000000000FFF1F0 - KEY_PLAY 0x0000000000FF7170 - KEY_PAUSE 0x0000000000FFB1B0 - KEY_FORWARD 0x0000000000FF3130 - KEY_STOP 0x00000000007F6FEE - KEY_RADIO 0x0000000000FFB5B4 - KEY_TEXT 0x00000000007F3FBE - KEY_TITLE 0x00000000007FBF3E - end codes - -end remote diff --git a/projects/Odroid_C2/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Odroid_C2/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 29aef1d0a9..0000000000 --- a/projects/Odroid_C2/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,21 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/ttyS0 -DefaultDependencies=no -ConditionKernelCommandLine=console=ttyS0,115200n8 - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/ttyS0 -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/Odroid_C2/initramfs/platform_init b/projects/Odroid_C2/initramfs/platform_init deleted file mode 100644 index d99783f0ba..0000000000 --- a/projects/Odroid_C2/initramfs/platform_init +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -hdmimode=1080p60hz - -# Parse command line arguments -for arg in $(cat /proc/cmdline); do - case $arg in - hdmimode=*) - hdmimode="${arg#*=}" - ;; - esac -done - -# Enable first framebuffer -echo 0 > /sys/class/graphics/fb0/blank - -# Disable second framebuffer -echo 1 > /sys/class/graphics/fb1/blank - -# Disable framebuffer scaling -echo 0 > /sys/class/graphics/fb0/free_scale -echo 0 > /sys/class/graphics/fb1/free_scale - -# set initial video state -echo 1 > /sys/class/video/disable_video - -# Set framebuffer geometry to match the resolution -case $hdmimode in - 480*) X=720 Y=480 ;; - 576*) X=720 Y=576 ;; - 720p*) X=1280 Y=720 ;; - *) X=1920 Y=1080 ;; -esac - -fbset -fb /dev/fb0 -g $X $Y 1920 2160 32 -fbset -fb /dev/fb1 -g 32 32 32 32 32 - -# Enable scaling for 4K output -case $hdmimode in - 4k*|smpte*|2160*) - echo 0 0 1919 1079 > /sys/class/graphics/fb0/free_scale_axis - echo 0 0 3839 2159 > /sys/class/graphics/fb0/window_axis - echo 1920 > /sys/class/graphics/fb0/scale_width - echo 1080 > /sys/class/graphics/fb0/scale_height - echo 0x10001 > /sys/class/graphics/fb0/free_scale - ;; -esac - -# Include deinterlacer into default VFM map -echo rm default > /sys/class/vfm/map -echo add default decoder ppmgr deinterlace amvideo > /sys/class/vfm/map diff --git a/projects/Odroid_C2/linux/linux.aarch64.conf b/projects/Odroid_C2/linux/linux.aarch64.conf deleted file mode 100644 index 698f698f21..0000000000 --- a/projects/Odroid_C2/linux/linux.aarch64.conf +++ /dev/null @@ -1,3871 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm64 3.14.29 Kernel Configuration -# -CONFIG_ARM64=y -CONFIG_ARM64_HAS_SG_CHAIN=y -CONFIG_64BIT=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_NO_IOPORT=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -CONFIG_KERNEL_MODE_NEON=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_FHANDLE=y -CONFIG_AUDIT=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_SPARSE_IRQ=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_TASKSTATS=y -CONFIG_TASK_DELAY_ACCT=y -CONFIG_TASK_XACCT=y -CONFIG_TASK_IO_ACCOUNTING=y - -# -# RCU Subsystem -# -CONFIG_TREE_PREEMPT_RCU=y -CONFIG_PREEMPT_RCU=y -CONFIG_RCU_STALL_COMMON=y -# CONFIG_RCU_USER_QS is not set -CONFIG_RCU_FANOUT=64 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FANOUT_EXACT is not set -# CONFIG_RCU_FAST_NO_HZ is not set -CONFIG_TREE_RCU_TRACE=y -# CONFIG_RCU_BOOST is not set -# CONFIG_RCU_NOCB_CPU is not set -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=19 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -CONFIG_CGROUP_DEBUG=y -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_RESOURCE_COUNTERS=y -CONFIG_MEMCG=y -CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_MEMCG_KMEM=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CFS_BANDWIDTH=y -CONFIG_RT_GROUP_SCHED=y -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -CONFIG_MM_OWNER=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -CONFIG_RD_BZIP2=y -CONFIG_RD_LZMA=y -CONFIG_RD_XZ=y -CONFIG_RD_LZO=y -# CONFIG_RD_LZ4 is not set -CONFIG_INITRAMFS_COMPRESSION_NONE=y -# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set -# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set -# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set -# CONFIG_INITRAMFS_COMPRESSION_XZ is not set -# CONFIG_INITRAMFS_COMPRESSION_LZO is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_EXPERT=y -CONFIG_UID16=y -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -# CONFIG_PERF_EVENTS is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_SLUB_DEBUG=y -CONFIG_COMPAT_BRK=y -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -# CONFIG_SLUB_CPU_PARTIAL is not set -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_PROFILING is not set -CONFIG_TRACEPOINTS=y -# CONFIG_JUMP_LABEL is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP_FILTER=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -CONFIG_STOP_MACHINE=y -CONFIG_BLOCK=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -CONFIG_BLK_DEV_THROTTLING=y -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y -CONFIG_EFI_PARTITION=y -CONFIG_BLOCK_COMPAT=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -# CONFIG_DEFAULT_DEADLINE is not set -CONFIG_DEFAULT_CFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# Platform selection -# -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_XGENE is not set -CONFIG_ARCH_MESON64_ODROIDC2=y - -# -# Bus support -# -CONFIG_ARM_AMBA=y - -# -# ARM errata workarounds via the alternatives framework -# -CONFIG_ARM64_ERRATUM_845719=y -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_ERRATUM_835769=y - -# -# Kernel Features -# -# CONFIG_ARM64_64K_PAGES is not set -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_SMP=y -CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set -# CONFIG_DISABLE_CPU_SCHED_DOMAIN_BALANCE is not set -CONFIG_SCHED_HMP=y -# CONFIG_SCHED_HMP_PRIO_FILTER is not set -CONFIG_HMP_FAST_CPU_MASK="" -CONFIG_HMP_SLOW_CPU_MASK="" -# CONFIG_HMP_VARIABLE_SCALE is not set -# CONFIG_SCHED_HMP_LITTLE_PACKING is not set -CONFIG_NR_CPUS=4 -CONFIG_HOTPLUG_CPU=y -CONFIG_SWP_EMULATE=y -# CONFIG_PREEMPT_NONE is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREEMPT=y -CONFIG_PREEMPT_COUNT=y -CONFIG_HZ=100 -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_ARMV7_COMPAT=y -CONFIG_ARMV7_COMPAT_CPUINFO=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_ZONE_DMA_FLAG=0 -CONFIG_KSM=y -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -# CONFIG_TRANSPARENT_HUGEPAGE is not set -CONFIG_CROSS_MEMORY_ATTACH=y -# CONFIG_CLEANCACHE is not set -# CONFIG_FRONTSWAP is not set -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZBUD is not set -# CONFIG_ZSMALLOC is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -# CONFIG_XEN is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_SECCOMP=y - -# -# Boot options -# -CONFIG_CMDLINE="console=ttyAMA0" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -# CONFIG_CMDLINE_EXTEND is not set -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_COREDUMP=y -CONFIG_COMPAT=y -CONFIG_SYSVIPC_COMPAT=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_HAS_WAKELOCK=y -CONFIG_HAS_EARLYSUSPEND=y -CONFIG_WAKELOCK=y -CONFIG_WAKELOCK_STAT=y -CONFIG_USER_WAKELOCK=y -CONFIG_EARLYSUSPEND=y -# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set -# CONFIG_CONSOLE_EARLYSUSPEND is not set -CONFIG_FB_EARLYSUSPEND=y -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -# CONFIG_PM_RUNTIME is not set -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -CONFIG_ARCH_HAS_OPP=y -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_CPU_PM=y -# CONFIG_SUSPEND_TIME is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_HOTPLUG=y -CONFIG_CPU_FREQ_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -# CONFIG_GENERIC_CPUFREQ_CPU0 is not set - -# -# ARM CPU frequency scaling drivers -# -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARM64_CPU_SUSPEND=y - -# -# CPU Power Management -# - -# -# CPU Idle -# -# CONFIG_CPU_IDLE is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_GRE is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_ANDROID_PARANOID_NETWORK is not set -# CONFIG_NET_ACTIVITY_STATS is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=y - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -CONFIG_NF_NAT_IPV4=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_RAW is not set -CONFIG_NF_NAT_IPV6=m -# CONFIG_IP6_NF_TARGET_MASQUERADE is not set -# CONFIG_IP6_NF_TARGET_NPT is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_IEEE802154 is not set -CONFIG_6LOWPAN_IPHC=m -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_HSR is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -CONFIG_CGROUP_NET_PRIO=y -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTSDIO=m -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_LL=y -# CONFIG_BT_HCIUART_3WIRE is not set -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -# CONFIG_BT_HCIVHCI is not set -CONFIG_BT_MRVL=m -CONFIG_BT_MRVL_SDIO=m -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_INTERNAL_REGDB=y -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -# CONFIG_MAC80211_RC_PID is not set -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -# CONFIG_WIMAX is not set -# CONFIG_RFKILL is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set - -# -# Device Drivers -# - -# -# Amlogic Device Drivers -# -CONFIG_MESON_TIMER=y -# CONFIG_MESON_LOCAL_TIMER is not set -CONFIG_MESON_BC_TIMER=y -CONFIG_AM_UART=y -CONFIG_SERIAL_MESON_CONSOLE=y -# CONFIG_PRINTK_NOBLOCK_MODE is not set -CONFIG_AML_CPU_VERSION=y -CONFIG_AML_MESON64_VERSION=y -# CONFIG_AML_M8_VERSION is not set -CONFIG_AMLOGIC_IOMAP=y -CONFIG_PINCTRL_AMLOGIC=y - -# -# USB Support -# -CONFIG_AMLOGIC_USB=y -CONFIG_USB_DWC_OTG_HCD=y -CONFIG_USB_HOST_ELECT_TEST=y - -# -# I2C Hardware Bus support -# -CONFIG_I2C_AML=y -# CONFIG_I2C_SLAVE_AML is not set -# CONFIG_I2C_SW_AML is not set -# CONFIG_BCM2079X_I2C is not set -# CONFIG_AML_PWM is not set - -# -# HDMI TX Support -# -CONFIG_AML_HDMI_TX=y -CONFIG_AML_HDMI_TX_20=y -# CONFIG_AML_HDMI_TX_14 is not set -# CONFIG_AML_RTC is not set -CONFIG_AML_VRTC=y -CONFIG_AM_IRBLASTER=y -# CONFIG_AML_DEBUG is not set -CONFIG_AML_REG_ACCESS=y - -# -# Power Management Support -# -# CONFIG_AML_POWER_SUPPORT is not set -# CONFIG_AML_PMU_ALGORITHM_SUPPORT is not set -# CONFIG_AML_PMU4 is not set - -# -# Ethernet Support -# -CONFIG_AM_PHY=y -CONFIG_PHYLIB=y - -# -# MII PHY device drivers -# -CONFIG_AML_PHY=y -CONFIG_AML_SMSC=y -CONFIG_AML_ICPLUS=y -CONFIG_AML_MICREL=y -CONFIG_AML_REALTEK=y - -# -# MMC/SD/SDIO Host Controller Drivers -# - -# -# Multimedia Card support -# -CONFIG_MMC_AML=y -# CONFIG_MMC_AML_DEBUG is not set -# CONFIG_AML_MMC_DEBUG_FORCE_SINGLE_BLOCK_RW is not set - -# -# Amlogic VPU Drivers -# - -# -# Amlogic VPU Driver -# -CONFIG_AML_VPU=y -# CONFIG_AML_VPU_DYNAMIC_ADJ is not set - -# -# ION support -# -CONFIG_AMLOGIC_ION=y - -# -# Amlogic Display Driver -# -CONFIG_AML_DISPLAY=y - -# -# Amlogic VOUT Module -# -CONFIG_AM_VOUT=y -CONFIG_AM_TV_OUTPUT=y -CONFIG_AML_VOUT_FRAMERATE_AUTOMATION=y -# CONFIG_AML_VDAC_HW_SWITCH is not set - -# -# Amlogic OSD Module -# -CONFIG_AM_FB=y -CONFIG_FB_OSD_SUPPORT_SYNC_FENCE=y -CONFIG_FB_OSD_VSYNC_RDMA=y -CONFIG_FB_OSD2_ENABLE=y -CONFIG_FB_OSD2_CURSOR=y - -# -# Amlogic VOUT2 Module -# -# CONFIG_AM_VOUT2 is not set -# CONFIG_AM_TV_OUTPUT2 is not set - -# -# Amlogic OSD_EXT Module -# -# CONFIG_AM_FB_EXT is not set -CONFIG_AM_GE2D=y -CONFIG_AM_LOGO=y - -# -# Amlogic LCD Output Module -# -# CONFIG_AML_LCD is not set - -# -# Amlogic Backlight Support -# -# CONFIG_AML_BACKLIGHT is not set -# CONFIG_AMLOGIC_LED is not set - -# -# Canvas management driver -# -CONFIG_AML_CANVAS=y -CONFIG_AMLOGIC_CLK=y -CONFIG_AMLOGIC_SEC=y -# CONFIG_AML_SERR is not set -CONFIG_AMLOGIC_SECURITY_KEY=y -CONFIG_AM_PTSSERVER=y -# CONFIG_H264_4K2K_SINGLE_CORE is not set -CONFIG_VSYNC_RDMA=y -# CONFIG_TVIN_VIUIN is not set -CONFIG_AM_VIDEO=y -# CONFIG_AM_VIDEO2 is not set -# CONFIG_SUPPORT_VIDEO_ON_VPP2 is not set -CONFIG_GE2D_KEEP_FRAME=y - -# -# Video Decoders -# -CONFIG_AM_VDEC_MPEG12=y -CONFIG_AM_VDEC_MPEG4=y -CONFIG_AM_VDEC_VC1=y -CONFIG_AM_VDEC_H264=y -CONFIG_AM_VDEC_H264MVC=y -CONFIG_AM_VDEC_H264_4K2K=y -CONFIG_AM_VDEC_H265=y -CONFIG_AM_VDEC_VP9=y -CONFIG_AM_VDEC_MJPEG=y -CONFIG_AM_ENCODER=y -CONFIG_AM_JPEG_ENCODER=y -CONFIG_AM_PIC_DEC=y -CONFIG_AM_VDEC_REAL=y -CONFIG_AM_VDEC_AVS=y -# CONFIG_AM_JPEGDEC is not set -CONFIG_AM_TIMESYNC=y -CONFIG_AM_STREAMING=y -CONFIG_AM_SUBTITLE=y -CONFIG_AM_VIDEOCAPTURE=y -# CONFIG_AM_HEVCENC is not set - -# -# Deinterlace driver -# -CONFIG_DEINTERLACE=y -# CONFIG_AM_DEINTERLACE_SD_ONLY is not set -CONFIG_AML_VFM=y - -# -# EFUSE Support -# -CONFIG_EFUSE=y -# CONFIG_EFUSE_WRITE_VERSION_PERMIT is not set - -# -# key management Support -# -CONFIG_KEY_MANAGE=y - -# -# Audio Interface -# -CONFIG_AMAUDIO=y - -# -# Amlogic Audio Interface V2 -# -# CONFIG_AMAUDIO2 is not set - -# -# Audio dsp process -# -CONFIG_AML_AUDIO_DSP=y - -# -# Post Process Manager driver -# -CONFIG_POST_PROCESS_MANAGER=y -CONFIG_POST_PROCESS_MANAGER_PPSCALER=y -CONFIG_POST_PROCESS_MANAGER_3D_PROCESS=y - -# -# Amlogic Wifi Driver -# -# CONFIG_AM_WIFI is not set -CONFIG_AML_POWER_RESET=y -# CONFIG_M8_POWER_RESET is not set -CONFIG_GXBB_POWER_RESET=y - -# -# Amlogic Bt Rfkill Driver -# -# CONFIG_BLUESLEEP is not set - -# -# Amlogic ion video support -# -# CONFIG_VIDEOBUF2_ION is not set -# CONFIG_AMLOGIC_IONVIDEO is not set - -# -# V4L2 Video Support -# -CONFIG_V4L_AMLOGIC_VIDEO=y -# CONFIG_V4L_AMLOGIC_VIDEO2 is not set - -# -# Amlogic TVIN Drivers -# -CONFIG_TVIN=y -# CONFIG_TVIN_VDIN is not set -# CONFIG_TVIN_AFE is not set -CONFIG_TVIN_HDMI=y -# CONFIG_TVIN_HDMI_CEC is not set -# CONFIG_TVIN_BT656 is not set -# CONFIG_VIUIN is not set -# CONFIG_TVIN_ISP is not set - -# -# Amlogic VECM Drivers -# - -# -# Amlogic amvecm Driver -# -# CONFIG_AM_VECM is not set -# CONFIG_AML_NAND is not set -CONFIG_AM_INPUT=y -CONFIG_AM_SARADC=y -CONFIG_MESON_NEW_INPUT_REMOTE=y -CONFIG_NEW_AM_REMOTE=y -CONFIG_MESON_INPUT_KEYBOARD=y -CONFIG_ADC_KEYPADS_AM=y -CONFIG_AML_GPIO_KEY=y -# CONFIG_SENSOR_DEVICES is not set -# CONFIG_AMLOGIC_AVIN_DETECT is not set -# CONFIG_AMLOGIC_MESON_CPUFREQ is not set -CONFIG_AMLOGIC_SCPI_CPUFREQ=y -CONFIG_MESON_SUSPEND=y -# CONFIG_M8M2_SUSPEND is not set -CONFIG_GXBB_SUSPEND=y - -# -# Amlogic DVB driver -# -# CONFIG_AM_DVB is not set -# CONFIG_AM_ATVDEMOD is not set - -# -# AMLOGIC CI Driver -# -# CONFIG_AM_PCMCIA is not set -# CONFIG_AM_IOBUS is not set -# CONFIG_AML_SMARTCARD is not set - -# -# MESON MHU mailbox Support -# -CONFIG_MESON_MHU_MBOX=y -CONFIG_ARM_SCPI_PROTOCOL=y - -# -# RDMA management driver -# -CONFIG_AML_RDMA=y - -# -# Amlogic temperature sensor -# -CONFIG_AML_TEMP_SENSOR=y -CONFIG_AUDIO_DATA=y -# CONFIG_INSTABOOT is not set - -# -# Amlogic Camera Support -# -# CONFIG_VIDEO_AMLOGIC_CAPTURE is not set -CONFIG_AML_CODEC_MM=y -# CONFIG_AML_WDT is not set - -# -# AMLOGIC SPI Hardware bus support -# -CONFIG_AMLOGIC_SPICC_MASTER=y -# CONFIG_AMLOGIC_JTAG is not set -CONFIG_AMLOGIC_CPU_INFO=y - -# -# defend img file update support -# -# CONFIG_DEFEND_IMG is not set - -# -# AO CEC Support -# -CONFIG_AML_AO_CEC=y - -# -# Amlogic Crypto Support -# -# CONFIG_CRYPTO_AML is not set - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -# CONFIG_FW_LOADER_USER_HELPER is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_HAVE_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=8 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -CONFIG_CONNECTOR=y -CONFIG_PROC_EVENTS=y -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -CONFIG_MTD_OOPS=y -# CONFIG_MTD_SWAP is not set - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=y -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -# CONFIG_MTD_CFI_AMDSTD is not set -# CONFIG_MTD_CFI_STAA is not set -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PHYSMAP_OF is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_M25P80 is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_IDS=y -CONFIG_MTD_NAND_ECC=y -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND=y -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR flash memory drivers -# -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_UBI is not set -CONFIG_DTC=y -CONFIG_OF=y - -# -# Device Tree and Open Firmware support -# -CONFIG_PROC_DEVICETREE=y -# CONFIG_OF_SELFTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_MTD=y -CONFIG_OF_RESERVED_MEM=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_BLK_DEV_RBD is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_UID_STAT is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_HAVE_PATA_PLATFORM=y -# CONFIG_ATA is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_TEAM is not set -CONFIG_MACVLAN=m -# CONFIG_MACVTAP is not set -# CONFIG_VXLAN is not set -CONFIG_NETCONSOLE=y -CONFIG_NETPOLL=y -# CONFIG_NETPOLL_TRAP is not set -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -CONFIG_VETH=m -CONFIG_NLMON=m - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_ARC=y -# CONFIG_ARC_EMAC is not set -# CONFIG_NET_CADENCE is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_CALXEDA_XGMAC is not set -# CONFIG_DNET is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_ETHOC is not set -# CONFIG_SH_ETH is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_STMMAC_ETH=y -CONFIG_STMMAC_PLATFORM=y -CONFIG_DWMAC_MESON=y -CONFIG_STMMAC_DEBUG_FS=y -CONFIG_STMMAC_DA=y -CONFIG_NET_VENDOR_VIA=y -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set - -# -# MII PHY device drivers -# -# CONFIG_AMLOGIC_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_AMD_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_FIXED_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPPOLAC=y -CONFIG_PPPOPNS=y -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=y - -# -# USB Network Adapters -# -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=m -CONFIG_USB_NET_SR9700=m -CONFIG_USB_NET_SR9800=m -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=y -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -CONFIG_WLAN=y -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_AT76C50X_USB is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_WIFI_CONTROL_FUNC is not set -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_WOW is not set -# CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -CONFIG_CARL9170_HWRNG=y -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -# CONFIG_ATH6KL_TRACING is not set -CONFIG_AR5523=m -# CONFIG_ATH10K is not set -# CONFIG_WCN36XX is not set -CONFIG_B43=m -CONFIG_B43_SSB=y -# CONFIG_B43_SDIO is not set -CONFIG_B43_PIO=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -# CONFIG_BRCMFMAC_SDIO is not set -CONFIG_BRCMFMAC_USB=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -# CONFIG_HOSTAP is not set -# CONFIG_LIBERTAS is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -# CONFIG_P54_SPI is not set -CONFIG_P54_LEDS=y -CONFIG_RT2X00=m -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -# CONFIG_RTL_CARDS is not set -# CONFIG_WL_TI is not set -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_KEYRESET is not set -# CONFIG_INPUT_KEYCOMBO is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYCHORD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_GPIO is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -CONFIG_DEVKMEM=y - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SUPPORT_SYSRQ is not set -CONFIG_TTY_PRINTK=y -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_ATMEL is not set -CONFIG_HW_RANDOM_MESON=y -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_R3964 is not set - -# -# PCMCIA character devices -# -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_CAPRI is not set -# CONFIG_PINCTRL_MSM8X74 is not set -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -CONFIG_GPIO_SYSFS=y - -# -# Memory mapped GPIO drivers: -# -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_GRGPIO is not set - -# -# I2C GPIO expanders: -# -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set - -# -# PCI GPIO expanders: -# - -# -# SPI GPIO expanders: -# -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_74X164 is not set - -# -# AC97 GPIO expanders: -# - -# -# LPC GPIO expanders: -# - -# -# MODULbus GPIO expanders: -# -# CONFIG_GPIO_BCM_KONA is not set - -# -# USB GPIO expanders: -# -# CONFIG_W1 is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27x00 is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_SMB347 is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_GPIO is not set -CONFIG_POWER_RESET_VEXPRESS=y -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_AVS is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_USER_SPACE is not set -CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y -CONFIG_CPU_THERMAL=y -CONFIG_CPUCORE_THERMAL=y -CONFIG_GPU_THERMAL=y -CONFIG_GPUCORE_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set - -# -# Texas Instruments thermal drivers -# -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -CONFIG_VEXPRESS_CONFIG=y -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_REGULATOR_VEXPRESS is not set -CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_RESOURCE=y -CONFIG_VIDEOBUF_DVB=m -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=y -CONFIG_RC_MAP=m -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_RC5_SZ_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_MESON=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -# CONFIG_VIDEO_USBTV is not set - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_TLG2300 is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_STK1160_COMMON is not set - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -CONFIG_DVB_USB_GL861=m -CONFIG_DVB_USB_IT913X=m -CONFIG_DVB_USB_LME2510=m -CONFIG_DVB_USB_MXL111SF=m -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -# CONFIG_VIDEO_EM28XX_V4L2 is not set -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -# CONFIG_V4L_PLATFORM_DRIVERS is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m -# CONFIG_RADIO_ADAPTERS is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=y - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=y -CONFIG_MEDIA_TUNER_SIMPLE=y -CONFIG_MEDIA_TUNER_TDA8290=y -CONFIG_MEDIA_TUNER_TDA827X=y -CONFIG_MEDIA_TUNER_TDA18271=y -CONFIG_MEDIA_TUNER_TDA9887=y -CONFIG_MEDIA_TUNER_TEA5761=y -CONFIG_MEDIA_TUNER_TEA5767=y -CONFIG_MEDIA_TUNER_MT20XX=y -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=y -CONFIG_MEDIA_TUNER_XC5000=y -CONFIG_MEDIA_TUNER_XC4000=y -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=y -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88TS2022=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LG2160=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_IT913X_FE=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -CONFIG_DRM=y -# CONFIG_DRM_UDL is not set -# CONFIG_VGASTATE is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -CONFIG_HDMI=y -CONFIG_VEXPRESS_DVI_CONTROL=y -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -CONFIG_FB_ARMCLCD=y -# CONFIG_FB_UVESA is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_EXYNOS_VIDEO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=y -# CONFIG_BACKLIGHT_PWM is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_ADF is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=m -# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -# CONFIG_FB_SSD1307 is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_HWDEP=y -CONFIG_SND_RAWMIDI=y -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -# CONFIG_SND_HRTIMER is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -CONFIG_SND_SUPPORT_OLD_API=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_MPU401 is not set -CONFIG_SND_SPI=y -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=y -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_6FIRE=m -CONFIG_SND_USB_HIFACE=m -CONFIG_SND_SOC=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_AML_M8_SOC=y -CONFIG_SND_AML_M8=y -CONFIG_SND_AML_SPLIT_MODE=y -# CONFIG_SND_AML_SPLIT_MODE_MMAP is not set -CONFIG_SND_SOC_I2C_AND_SPI=y -CONFIG_SND_SOC_DUMMY_CODEC=y -CONFIG_SND_SOC_TAS5707=y -CONFIG_SND_SOC_TAS5717=y -CONFIG_SND_SOC_TAS5731=y -CONFIG_SND_SOC_PCM2BT=y -CONFIG_SND_SOC_AMLT9015=y -CONFIG_SND_SOC_AMLT9015S=y -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SOUND_PRIME is not set - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -# CONFIG_UHID is not set -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_DIA_REMOTE is not set -# CONFIG_HID_PRODIKEYS is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_HUION is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -CONFIG_HID_LENOVO_TPKBD=m -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PETALYNX=y -CONFIG_HID_PICOLCD=m -CONFIG_HID_PICOLCD_FB=y -CONFIG_HID_PICOLCD_BACKLIGHT=y -CONFIG_HID_PICOLCD_LCD=y -CONFIG_HID_PICOLCD_LEDS=y -# CONFIG_HID_PICOLCD_CIR is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -# CONFIG_SONY_FF is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SUNPLUS=y -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_ROOT_HUB_TT is not set -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_HCD_SYNOPSYS=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FUSBH200_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -CONFIG_USB_OHCI_HCD=y -# CONFIG_USB_OHCI_HCD_PLATFORM is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_RENESAS_USBHS is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=y -# CONFIG_USB_PRINTER is not set -CONFIG_USB_WDM=m -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_CHIPIDEA is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=y -CONFIG_USB_SERIAL_CONSOLE=y -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -# CONFIG_USB_SERIAL_CP210X is not set -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -# CONFIG_USB_SERIAL_FTDI_SIO is not set -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=y -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_ZTE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -CONFIG_USB_EMI26=m -# CONFIG_USB_ADUTUX is not set -CONFIG_USB_SEVSEG=m -CONFIG_USB_RIO500=m -CONFIG_USB_LEGOTOWER=m -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -# CONFIG_USB_CYPRESS_CY7C63 is not set -CONFIG_USB_CYTHERM=m -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -CONFIG_USB_APPLEDISPLAY=m -CONFIG_USB_SISUSBVGA=m -CONFIG_USB_SISUSBVGA_CON=y -CONFIG_USB_LD=m -CONFIG_USB_TRANCEVIBRATOR=m -CONFIG_USB_IOWARRIOR=m -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -CONFIG_USB_ISIGHTFW=m -CONFIG_USB_YUREX=m -CONFIG_USB_EZUSB_FX2=m -# CONFIG_USB_HSIC_USB3503 is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WAKELOCK is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_USB_GPIO_VBUS is not set -CONFIG_USB_ISP1301=y -# CONFIG_USB_RCAR_PHY is not set -CONFIG_USB_ULPI=y -# CONFIG_AMLOGIC_USBPHY is not set -# CONFIG_AMLOGIC_USB2PHY is not set -# CONFIG_AMLOGIC_USB3PHY is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=2 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_AUDIO is not set -# CONFIG_USB_ETH is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_PXP_MMC=y -CONFIG_MMC_UNSAFE_RESUME=y -# CONFIG_MMC_CLKGATE is not set -# CONFIG_MMC_EMBEDDED_SDIO is not set -# CONFIG_MMC_PARANOID_SD_INIT is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_ARMMMCI=y -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y - -# -# LED drivers -# -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9685 is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_BLINKM is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_LEDS_TRIGGER_BACKLIGHT=y -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -CONFIG_LEDS_TRIGGER_TRANSIENT=y -CONFIG_LEDS_TRIGGER_CAMERA=y -CONFIG_SWITCH=y -# CONFIG_SWITCH_GPIO is not set -# CONFIG_ACCESSIBILITY is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -CONFIG_RTC_DRV_PCF8563=m -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_DS2404 is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -CONFIG_RTC_DRV_PL031=y -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_MOXART is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_DMADEVICES is not set -# CONFIG_AUXDISPLAY is not set -CONFIG_UIO=y -# CONFIG_UIO_PDRV_GENIRQ is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_VIRT_DRIVERS is not set - -# -# Virtio drivers -# -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -# CONFIG_USBIP_CORE is not set -# CONFIG_W35UND is not set -# CONFIG_PRISM2_USB is not set -# CONFIG_ECHO is not set -# CONFIG_COMEDI is not set -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -# CONFIG_R8188EU is not set -# CONFIG_RTS5139 is not set -# CONFIG_TRANZPORT is not set -# CONFIG_LINE6_USB is not set -# CONFIG_USB_SERIAL_QUATECH2 is not set -CONFIG_VT6656=m -# CONFIG_USB_ENESTORAGE is not set -# CONFIG_BCM_WIMAX is not set -# CONFIG_FT1000 is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -CONFIG_STAGING_MEDIA=y -CONFIG_DVB_AS102=m -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_USB_MSI3101 is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_USB_SN9C102 is not set -# CONFIG_LIRC_STAGING is not set - -# -# Android -# -CONFIG_ANDROID=y -# CONFIG_ANDROID_BINDER_IPC is not set -# CONFIG_ASHMEM is not set -# CONFIG_ANDROID_LOGGER is not set -# CONFIG_ANDROID_TIMED_OUTPUT is not set -# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set -# CONFIG_ANDROID_INTF_ALARM_DEV is not set -CONFIG_SYNC=y -CONFIG_SW_SYNC=y -# CONFIG_SW_SYNC_USER is not set -CONFIG_ION=y -# CONFIG_ION_TEST is not set -# CONFIG_ION_DUMMY is not set -# CONFIG_FIQ_DEBUGGER is not set -# CONFIG_FIQ_WATCHDOG is not set -# CONFIG_USB_WPAN_HCD is not set -# CONFIG_WIMAX_GDM72XX is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_CED1401 is not set -# CONFIG_DGRP is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_XILLYBUS is not set -# CONFIG_DGAP is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -CONFIG_COMMON_CLK_VERSATILE=y -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -CONFIG_COMMON_CLK_XGENE=y -CONFIG_COMMON_CLK_SCPI=y -# CONFIG_COMMON_CLK_QCOM is not set - -# -# Hardware Spinlock drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_MAILBOX=y -# CONFIG_PL320_MBOX is not set -CONFIG_IOMMU_SUPPORT=y -CONFIG_OF_IOMMU=y -# CONFIG_ARM_SMMU is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# -# CONFIG_PM_DEVFREQ is not set -# CONFIG_EXTCON is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -# CONFIG_PWM_PCA9685 is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V3=y -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_POWERCAP is not set -# CONFIG_CORESIGHT is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_GFS2_FS is not set -CONFIG_BTRFS_FS=y -CONFIG_BTRFS_FS_POSIX_ACL=y -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -CONFIG_BTRFS_FS_RUN_SANITY_TESTS=y -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -# CONFIG_FANOTIFY is not set -CONFIG_QUOTA=y -# CONFIG_QUOTA_NETLINK_INTERFACE is not set -CONFIG_PRINT_QUOTA_WARNING=y -# CONFIG_QUOTA_DEBUG is not set -CONFIG_QUOTA_TREE=y -# CONFIG_QFMT_V1 is not set -CONFIG_QFMT_V2=y -CONFIG_QUOTACTL=y -CONFIG_AUTOFS4_FS=m -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=y - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_EXFAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_CONFIGFS_FS is not set -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=y -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS2_FS is not set -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -CONFIG_SQUASHFS_FILE_CACHE=y -# CONFIG_SQUASHFS_FILE_DIRECT is not set -CONFIG_SQUASHFS_DECOMP_SINGLE=y -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set -CONFIG_SQUASHFS_XATTR=y -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -# CONFIG_F2FS_CHECK_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -# CONFIG_NFS_V4_2 is not set -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -# CONFIG_NFS_V4_1_MIGRATION is not set -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_VIRTUALIZATION is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -CONFIG_DEBUG_INFO=y -# CONFIG_DEBUG_INFO_REDUCED is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=2048 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -CONFIG_SCHED_DEBUG=y -CONFIG_SCHEDSTATS=y -CONFIG_TIMER_STATS=y -CONFIG_DEBUG_PREEMPT=y - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -CONFIG_STACKTRACE=y -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU_DELAY is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -CONFIG_RCU_CPU_STALL_VERBOSE=y -# CONFIG_RCU_CPU_STALL_INFO is not set -CONFIG_RCU_TRACE=y -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -CONFIG_NOP_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_RING_BUFFER=y -CONFIG_EVENT_TRACING=y -CONFIG_CONTEXT_SWITCH_TRACER=y -CONFIG_TRACING=y -CONFIG_GENERIC_TRACER=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -CONFIG_FUNCTION_TRACER=y -CONFIG_FUNCTION_GRAPH_TRACER=y -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_SCHED_TRACER is not set -CONFIG_FTRACE_SYSCALLS=y -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -CONFIG_STACK_TRACER=y -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_PROBE_EVENTS is not set -CONFIG_DYNAMIC_FTRACE=y -CONFIG_FUNCTION_PROFILER=y -CONFIG_FTRACE_MCOUNT_RECORD=y -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_MODULE is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_CHECK_ISR_TIME is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_PID_IN_CONTEXTIDR is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -CONFIG_SECURITYFS=y -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=y -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_PCOMP2=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=m -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_CRYPTO_CRYPTD is not set -CONFIG_CRYPTO_AUTHENC=y -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=y -# CONFIG_CRYPTO_GCM is not set -CONFIG_CRYPTO_SEQIV=y - -# -# Block modes -# -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CTR=y -# CONFIG_CRYPTO_CTS is not set -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_LRW=m -CONFIG_CRYPTO_PCBC=y -CONFIG_CRYPTO_XTS=m - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set -CONFIG_CRYPTO_CRCT10DIF=y -# CONFIG_CRYPTO_GHASH is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -# CONFIG_CRYPTO_ZLIB is not set -CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=m -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -CONFIG_CRYPTO_HW=y -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ARM64_CRYPTO is not set -CONFIG_BINARY_PRINTF=y - -# -# Library routines -# -CONFIG_RAID6_PQ=y -CONFIG_BITREVERSE=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=y -CONFIG_CRC16=y -CONFIG_CRC_T10DIF=y -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=y -# CONFIG_CRC8 is not set -CONFIG_AUDIT_GENERIC=y -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DECOMPRESS_BZIP2=y -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DECOMPRESS_XZ=y -CONFIG_DECOMPRESS_LZO=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_AVERAGE=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=m -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y diff --git a/projects/Odroid_C2/options b/projects/Odroid_C2/options deleted file mode 100644 index c83839bc1b..0000000000 --- a/projects/Odroid_C2/options +++ /dev/null @@ -1,128 +0,0 @@ -################################################################################ -# setup system defaults -################################################################################ - - # The TARGET_CPU variable controls which processor should be targeted for - # generated code. - case $TARGET_ARCH in - aarch64) - # TARGET_CPU: - # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d - # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c - # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t - # arm720t arm740t strongarm strongarm110 strongarm1100 - # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t - # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi - # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e - # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s - # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 - # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. - # - TARGET_CPU="cortex-a53" - TARGET_CPU_FLAGS="+crc+fp+simd" - ;; - esac - - # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) - BOOTLOADER="u-boot" - - # u-boot version to use (default) - UBOOT_VERSION="hardkernel" - - # Configuration for u-boot - UBOOT_CONFIG="odroidc2_defconfig" - - # Target Configfile for u-boot - UBOOT_CONFIGFILE="boot.ini" - - # Kernel target for u-boot (default 'uImage' if BOOTLOADER=u-boot) (uImage / zImage) - KERNEL_TARGET="Image" - - # Kernel extra targets to build - KERNEL_UBOOT_EXTRA_TARGET="" - - # Additional kernel make parameters (for example to specify the u-boot loadaddress) - KERNEL_MAKE_EXTRACMD="dtbs" - - # Kernel to use. values can be: - # default: default mainline kernel - LINUX="amlogic-3.14" - - -################################################################################ -# setup build defaults -################################################################################ - - # Project CFLAGS - PROJECT_CFLAGS="" - - # SquashFS compression method (gzip / lzo / xz) - SQUASHFS_COMPRESSION="lzo" - -################################################################################ -# setup project defaults -################################################################################ - - # build and install ALSA Audio support (yes / no) - ALSA_SUPPORT="yes" - - # OpenGL(X) implementation to use (no / Mesa) - OPENGL="no" - - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) - OPENGLES="opengl-meson" - - # Amlogic Meson SOC family (8 / 6 / gxbb) - MESON_FAMILY="gxbb" - - # include uvesafb support (yes / no) - UVESAFB_SUPPORT="no" - - # Displayserver to use (x11 / no) - DISPLAYSERVER="no" - - # Windowmanager to use (ratpoison / fluxbox / none) - WINDOWMANAGER="none" - - # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau) - # Space separated list is supported, - # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" - GRAPHIC_DRIVERS="" - - # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap / libamcodec) - KODIPLAYER_DRIVER="libamcodec" - - # Modules to install in initramfs for early boot - INITRAMFS_MODULES="font softcursor bitblit fbcon" - - # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers - # Space separated list is supported, - # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="gpu-aml RTL8192CU RTL8192DU RTL8188EU RTL8192EU RTL8812AU" - - # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) - # Space separated list is supported, - # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware" - - # build and install ATV IR remote support (yes / no) - ATVCLIENT_SUPPORT="no" - - # Amlogic IR remote support (yes / no) - AMREMOTE_SUPPORT="no" - - # build with swap support (yes / no) - SWAP_SUPPORT="no" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - - # build with installer (yes / no) - INSTALLER_SUPPORT="no" - - # kernel image name - KERNEL_NAME="KERNEL" diff --git a/projects/Odroid_C2/patches/RTL8192CU/RTL8192CU-0001_fix-build-with-linux-hardkernel.patch b/projects/Odroid_C2/patches/RTL8192CU/RTL8192CU-0001_fix-build-with-linux-hardkernel.patch deleted file mode 100644 index 99bbcb1ba9..0000000000 --- a/projects/Odroid_C2/patches/RTL8192CU/RTL8192CU-0001_fix-build-with-linux-hardkernel.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur a/core/rtw_br_ext.c b/core/rtw_br_ext.c ---- a/core/rtw_br_ext.c 2013-09-11 05:56:55.000000000 +0200 -+++ b/core/rtw_br_ext.c 2016-02-10 08:06:48.999417391 +0100 -@@ -51,6 +51,7 @@ - #include - #include - #include -+#include - #endif - #endif - diff --git a/projects/Odroid_C2/patches/RTL8192EU/RTL8192EU-0001-fix-build-with-linux-hardkernel.patch b/projects/Odroid_C2/patches/RTL8192EU/RTL8192EU-0001-fix-build-with-linux-hardkernel.patch deleted file mode 100644 index e94ddaa65e..0000000000 --- a/projects/Odroid_C2/patches/RTL8192EU/RTL8192EU-0001-fix-build-with-linux-hardkernel.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur a/core/rtw_br_ext.c b/core/rtw_br_ext.c ---- a/core/rtw_br_ext.c 2016-01-18 10:56:14.000000000 -0800 -+++ b/core/rtw_br_ext.c 2016-04-08 00:55:50.276738518 -0700 -@@ -49,6 +49,7 @@ - #include - #include - #include -+#include - #endif - #endif - diff --git a/projects/Odroid_C2/patches/linux/linux-008-max_freq_dvfs_table.patch b/projects/Odroid_C2/patches/linux/linux-008-max_freq_dvfs_table.patch deleted file mode 100644 index 78c8305a74..0000000000 --- a/projects/Odroid_C2/patches/linux/linux-008-max_freq_dvfs_table.patch +++ /dev/null @@ -1,96 +0,0 @@ -From dee146cbbb8428b073fba85390577590fc365d86 Mon Sep 17 00:00:00 2001 -From: Joy Cho -Date: Wed, 31 Aug 2016 16:27:48 +0900 -Subject: [PATCH] ODROID-C2: Add setup routine to set max. cpu frequency of - dvfs table - -- set "max_freq" in boot.ini -- in MHz unit -ex) setenv max_freq "1656" - -Change-Id: I352c9540d0c34d3ec0ba0f470dae9d4e0786c001 ---- - drivers/amlogic/mailbox/scpi_protocol.c | 53 +++++++++++++++++++++++++++++++++ - 1 file changed, 53 insertions(+) - -diff --git a/drivers/amlogic/mailbox/scpi_protocol.c b/drivers/amlogic/mailbox/scpi_protocol.c -index ec787d2..f3aa3e0 100644 ---- a/drivers/amlogic/mailbox/scpi_protocol.c -+++ b/drivers/amlogic/mailbox/scpi_protocol.c -@@ -85,6 +85,12 @@ static int high_priority_cmds[] = { - SCPI_CMD_SENSOR_CFG_BOUNDS, - }; - -+#if defined(CONFIG_ARCH_MESON64_ODROIDC2) -+#define DVFS_COUNT_MAX 13 -+#define DVFS_COUNT_1536 6 -+static unsigned long max_freq_dvfs; -+#endif -+ - static struct scpi_opp *scpi_opps[MAX_DVFS_DOMAINS]; - - static int scpi_linux_errmap[SCPI_ERR_MAX] = { -@@ -236,6 +242,9 @@ struct scpi_opp *scpi_dvfs_get_opps(u8 domain) - struct scpi_opp *opps; - size_t opps_sz; - int count, ret; -+#if defined(CONFIG_ARCH_MESON64_ODROIDC2) -+ int i, max_index; -+#endif - - if (domain >= MAX_DVFS_DOMAINS) - return ERR_PTR(-EINVAL); -@@ -254,6 +263,27 @@ struct scpi_opp *scpi_dvfs_get_opps(u8 domain) - return ERR_PTR(-ENOMEM); - - count = DVFS_OPP_COUNT(buf.header); -+ -+#if defined(CONFIG_ARCH_MESON64_ODROIDC2) -+ max_index = 0; -+ if (max_freq_dvfs) { -+ for (i = 0; i < count; i++) { -+ if (buf.opp[i].freq_hz == max_freq_dvfs) -+ break; -+ else -+ max_index++; -+ } -+ count = max_index + 1; -+ } -+ /* if no param "max_freq_dvfs or wrong "max_freq_dvfs" -+ * from boot.ini, consider stable max value */ -+ if ((max_freq_dvfs == 0) || (count > DVFS_COUNT_MAX)) -+ count = DVFS_COUNT_1536; /* default max : 1.536GHz */ -+ -+ pr_info("dvfs [%s] - new count %d, max_freq %ld\n", __func__, -+ count, max_freq_dvfs); -+#endif -+ - opps_sz = count * sizeof(*(opps->opp)); - - opps->count = count; -@@ -422,3 +452,25 @@ int scpi_send_usr_data(u32 client_id, u32 *val, u32 size) - } - EXPORT_SYMBOL_GPL(scpi_send_usr_data); - -+#if defined(CONFIG_ARCH_MESON64_ODROIDC2) -+static int __init get_max_freq(char *str) -+{ -+ int ret; -+ -+ if (NULL == str) { -+ /* consider default set */ -+ max_freq_dvfs = 1536000000; -+ return -EINVAL; -+ } -+ -+ ret = kstrtoul(str, 0, &max_freq_dvfs); -+ -+ /* in unit Hz */ -+ max_freq_dvfs *= 1000000; -+ -+ pr_info("dvfs [%s] - max_freq : %ld\n", __func__, max_freq_dvfs); -+ -+ return 0; -+} -+__setup("max_freq=", get_max_freq); -+#endif diff --git a/projects/RPi/config/config.txt b/projects/RPi/config/config.txt new file mode 100644 index 0000000000..ddb2636d2a --- /dev/null +++ b/projects/RPi/config/config.txt @@ -0,0 +1,126 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ +# Bootloader configuration - config.txt +################################################################################ + +################################################################################ +# Memory (System/GPU configuration ) +################################################################################ + +# Default GPU memory split (do not change if you do not know what you are doing) + gpu_mem=200 + +# Configure GPU memory based on SDRAM size - overrides above setting + gpu_mem_256=112 + gpu_mem_512=200 + gpu_mem_1024=256 + +################################################################################ +# For overclocking and various other settings, see: +# https://www.raspberrypi.org/documentation/configuration/config-txt.md +################################################################################ + +# Overclock mode settings. +# +# default recommended values are: arm_freq | core_freq | sdram_freq | over_voltage +# no overclocking : 700 | 250 | 400 | 0 +# mode 'Modest' : 800 | 300 | 400 | 0 +# mode 'Medium' : 900 | 333 | 450 | 2 +# mode 'High' : 950 | 450 | 450 | 6 +# mode 'Turbo' : 1000 | 500 | 600 | 6 + +arm_freq=950 +core_freq=450 +sdram_freq=450 +over_voltage=4 + +# Set 'force_turbo=1' to disable dynamic overclocking and enable overclocking always. +force_turbo=0 + +# If you have any data corruption using Turbo Mode and overclocking +# try with this setting uncommented +# If this still fails, try to use Medium mode without "over_voltage=2" +# If it ultimately keeps failing, forget about this until it gets fixed +# Use a more conservative mode that will works fine in any cases: +# initial_turbo=30 + +# Make display smaller to stop text spilling off the screen +# +# Note that the overscan settings only affect the splash screen and not Kodi. +# +# If you experience overscan/underscan issues the best solution is to adjust +# your TV settings ("full pixel", "1-1 pixel" etc.). Alternatively, there is a +# calibration menu in the Kodi GUI. +# disable_overscan=1 + +# Adapt overscan values to your needs +# overscan_left=57 +# overscan_right=59 +# overscan_top=20 +# overscan_bottom=20 + +# Uncomment for DVI monitor +# hdmi_drive=1 + +# Force HDMI even if unplugged or powered off +hdmi_force_hotplug=1 + +# Doesn't sent initial active source message. +# Avoids bringing CEC (enabled TV) out of standby and channel switch when +# rebooting. +# hdmi_ignore_cec_init=1 + +################################################################################ +# License keys to enable GPU hardware decoding for various codecs +# to obtain keys visit the shop at http://www.raspberrypi.com +################################################################################ + +# decode_MPG2=0x00000000 +# decode_WVC1=0x00000000 + +################################################################################ +# +# >>>>>>>> RasPlex default settings override <<<<<<<<< +# +################################################################################ + +# Required overlay for LIRC to function + dtoverlay=lirc-rpi + +# Required for hyperion / lightberry + dtparam=spi=on + +# Uncomment to enable the sdhost driver +# dtoverlay=sdhost + +# Uncomment to enable HiFiBerry overlay +# NOTE: You must disable the lirc-rpi overlay (or change lirc GPIO pin) for HiFiBerry to work correctly +# dtoverlay=hifiberry-amp +# dtoverlay=hifiberry-dac +# dtoverlay=hifiberry-dacplus +# dtoverlay=hifiberry-digi + +################################################################################ +# End of default configuration +################################################################################ + +################################################################################ +# Include distribution specific config file if it exists. +################################################################################ +[all] +include distroconfig.txt diff --git a/projects/RPi/devices/RPi/linux/linux.arm.conf b/projects/RPi/devices/RPi/linux/linux.arm.conf new file mode 100644 index 0000000000..eea996e3a7 --- /dev/null +++ b/projects/RPi/devices/RPi/linux/linux.arm.conf @@ -0,0 +1,4740 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.19.20 Kernel Configuration +# + +# +# Compiler: gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0 +# +CONFIG_CC_IS_GCC=y +CONFIG_GCC_VERSION=70200 +CONFIG_CLANG_VERSION=0 +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_BUILD_SALT="" +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +# CONFIG_GENERIC_IRQ_DEBUGFS is not set +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_GENERIC_CLOCKEVENTS=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TINY_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +CONFIG_TINY_SRCU=y +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +CONFIG_MEMCG_KMEM=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_RT_GROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +# CONFIG_CGROUP_RDMA is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_BPF=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_SOCK_CGROUP_DATA=y +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_CHECKPOINT_RESTORE is not set +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_INITRAMFS_FORCE is not set +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_INITRAMFS_COMPRESSION=".gz" +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +# CONFIG_UID16 is not set +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SYSFS_SYSCALL is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y +CONFIG_PRINTK=y +CONFIG_PRINTK_NMI=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +CONFIG_MEMBARRIER=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_BPF_SYSCALL=y +# CONFIG_USERFAULTFD is not set +CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +CONFIG_RSEQ=y +# CONFIG_DEBUG_RSEQ is not set +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y +# CONFIG_PC104 is not set + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_SLUB_MEMCG_SYSFS_ON is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLAB_MERGE_DEFAULT=y +# CONFIG_SLAB_FREELIST_RANDOM is not set +# CONFIG_SLAB_FREELIST_HARDENED is not set +CONFIG_SYSTEM_DATA_VERIFICATION=y +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y +CONFIG_ARM=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIQ=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Multiple platform selection +# + +# +# CPU Core family selection +# +CONFIG_ARCH_MULTI_V6=y +# CONFIG_ARCH_MULTI_V7 is not set +CONFIG_ARCH_MULTI_V6_V7=y +# CONFIG_ARCH_ASPEED is not set +CONFIG_ARCH_BCM=y + +# +# IPROC architected SoCs +# + +# +# KONA architected SoCs +# + +# +# Other Architectures +# +CONFIG_ARCH_BCM2835=y +CONFIG_BCM2835_FAST_MEMCPY=y +# CONFIG_ARCH_CNS3XXX is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_INTEGRATOR is not set + +# +# TI OMAP/AM/DM/DRA Family +# +# CONFIG_ARCH_OMAP2 is not set +# CONFIG_ARCH_OXNAS is not set +# CONFIG_ARCH_PICOXCELL is not set +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_WM8750 is not set + +# +# Processor Type +# +CONFIG_CPU_V6K=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_32v6=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_ABRT_EV6=y +CONFIG_CPU_PABRT_V6=y +CONFIG_CPU_CACHE_V6=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V6=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +CONFIG_ARM_THUMB=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_ARM_L1_CACHE_SHIFT=5 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_ARM_ERRATA_411920=y + +# +# Bus support +# +# CONFIG_PCI is not set + +# +# PCI Endpoint +# +# CONFIG_PCI_ENDPOINT is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +# CONFIG_VMSPLIT_3G is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_ARCH_NR_GPIO=0 +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +# CONFIG_HIGHMEM is not set +# CONFIG_CPU_SW_DOMAIN_PAN is not set +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +CONFIG_UACCESS_WITH_MEMCPY=y +# CONFIG_SECCOMP is not set +# CONFIG_PARAVIRT is not set +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_AUTO_ZRELADDR=y +# CONFIG_EFI is not set + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set + +# +# CPU frequency scaling drivers +# +# CONFIG_CPUFREQ_DT is not set +CONFIG_ARM_BCM2835_CPUFREQ=y +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y + +# +# Power management options +# +# CONFIG_SUSPEND is not set +# CONFIG_HIBERNATION is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +# CONFIG_APM_EMULATION is not set +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y + +# +# Firmware Drivers +# +# CONFIG_ARM_SCMI_PROTOCOL is not set +# CONFIG_ARM_SCPI_PROTOCOL is not set +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_RASPBERRYPI_FIRMWARE=y +# CONFIG_FW_CFG_SYSFS is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# Tegra firmware driver +# +CONFIG_ARM_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM=m +CONFIG_CRYPTO_SHA256_ARM=m +# CONFIG_CRYPTO_SHA512_ARM is not set +CONFIG_CRYPTO_AES_ARM=m +# CONFIG_VIRTUALIZATION is not set + +# +# General architecture-dependent options +# +CONFIG_OPROFILE=m +CONFIG_HAVE_OPROFILE=y +CONFIG_KPROBES=y +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +CONFIG_OPTPROBES=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_KRETPROBES=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_NMI=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_STACKPROTECTOR=y +CONFIG_CC_HAS_STACKPROTECTOR_NONE=y +CONFIG_STACKPROTECTOR=y +CONFIG_STACKPROTECTOR_STRONG=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_HAVE_EXIT_THREAD=y +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +# CONFIG_STRICT_KERNEL_RWX is not set +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +# CONFIG_STRICT_MODULE_RWX is not set +CONFIG_ARCH_HAS_PHYS_TO_DMA=y +CONFIG_REFCOUNT_FULL=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_PLUGIN_HOSTCC="" +CONFIG_HAVE_GCC_PLUGINS=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +# CONFIG_TRIM_UNUSED_KSYMS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_ZONED is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set +# CONFIG_BLK_WBT is not set +# CONFIG_BLK_CGROUP_IOLATENCY is not set +CONFIG_BLK_DEBUG_FS=y +# CONFIG_BLK_SED_OPAL is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +CONFIG_IOSCHED_BFQ=y +# CONFIG_BFQ_GROUP_IOSCHED is not set +CONFIG_ASN1=y +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_FREEZER=y + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_ELF_FDPIC is not set +CONFIG_ELFCORE=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_BINFMT_FLAT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Memory Management options +# +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_NEED_PER_CPU_KM=y +CONFIG_CLEANCACHE=y +CONFIG_FRONTSWAP=y +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_DEBUGFS=y +CONFIG_CMA_AREAS=7 +# CONFIG_ZSWAP is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +# CONFIG_PERCPU_STATS is not set +# CONFIG_GUP_BENCHMARK is not set +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_TLS is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +# CONFIG_XDP_SOCKETS is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +# CONFIG_IP_ROUTE_VERBOSE is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE_COMMON=y +CONFIG_IP_MROUTE=y +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_WESTWOOD is not set +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +# CONFIG_TCP_CONG_HYBLA is not set +CONFIG_TCP_CONG_VEGAS=m +# CONFIG_TCP_CONG_NV is not set +CONFIG_TCP_CONG_SCALABLE=m +# CONFIG_TCP_CONG_LP is not set +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +# CONFIG_TCP_CONG_DCTCP is not set +CONFIG_TCP_CONG_CDG=m +# CONFIG_TCP_CONG_BBR is not set +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_IPV6_SEG6_LWTUNNEL is not set +# CONFIG_IPV6_SEG6_HMAC is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_FAMILY_BRIDGE=y +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +# CONFIG_NETFILTER_NETLINK_OSF is not set +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_LOG_NETDEV is not set +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_ZONES is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CONNTRACK_LABELS is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +# CONFIG_NF_SOCKET_IPV4 is not set +# CONFIG_NF_TPROXY_IPV4 is not set +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=y +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_SOCKET_IPV6 is not set +# CONFIG_NF_TPROXY_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +CONFIG_NF_REJECT_IPV6=m +# CONFIG_NF_LOG_IPV6 is not set +CONFIG_NF_NAT_IPV6=m +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_MATCH_SRH is not set +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +CONFIG_IP6_NF_MANGLE=m +# CONFIG_IP6_NF_RAW is not set +CONFIG_IP6_NF_NAT=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +CONFIG_NF_DEFRAG_IPV6=m +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_BPFILTER is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_CBS is not set +# CONFIG_NET_SCH_ETF is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_SKBPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_CAKE is not set +# CONFIG_NET_SCH_FQ is not set +# CONFIG_NET_SCH_HHF is not set +# CONFIG_NET_SCH_PIE is not set +# CONFIG_NET_SCH_PLUG is not set +# CONFIG_NET_SCH_DEFAULT is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_CLS_BPF is not set +# CONFIG_NET_CLS_FLOWER is not set +# CONFIG_NET_CLS_MATCHALL is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_NET_NSH is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +# CONFIG_NET_NCSI is not set +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +# CONFIG_BPF_STREAM_PARSER is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +CONFIG_BT=m +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=m +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set +# CONFIG_BT_SELFTEST is not set +# CONFIG_BT_DEBUGFS is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_HCIBTUSB=m +# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +# CONFIG_BT_HCIBTSDIO is not set +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_SERDEV=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_NOKIA is not set +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +CONFIG_BT_HCIUART_BCM=y +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set +# CONFIG_BT_HCIUART_MRVL is not set +CONFIG_BT_HCIBCM203X=m +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_MRVL is not set +CONFIG_BT_ATH3K=m +# CONFIG_BT_MTKUART is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +CONFIG_FIB_RULES=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y +CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=m +CONFIG_RFKILL_LEDS=y +CONFIG_RFKILL_INPUT=y +# CONFIG_RFKILL_GPIO is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_PSAMPLE is not set +# CONFIG_NET_IFE is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_GRO_CELLS=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y +# CONFIG_FAILOVER is not set +CONFIG_HAVE_EBPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y + +# +# Generic Driver Options +# +# CONFIG_UEVENT_HELPER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y + +# +# Firmware loader +# +CONFIG_FW_LOADER=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER is not set +# CONFIG_ALLOW_DEV_COREDUMP is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=m +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_DMA_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=5 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_SIMPLE_PM_BUS is not set +# CONFIG_VEXPRESS_CONFIG is not set +# CONFIG_CONNECTOR is not set +# CONFIG_GNSS is not set +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_KOBJ=y +CONFIG_OF_DYNAMIC=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +CONFIG_CDROM=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# NVME Support +# +# CONFIG_NVME_FC is not set +# CONFIG_NVME_TARGET is not set + +# +# Misc devices +# +CONFIG_BCM2835_SMI=m +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +CONFIG_MISC_RTSX=y +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_EEPROM_IDT_89HPESX is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC & related support +# + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# VOP Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# + +# +# VOP Driver +# +# CONFIG_ECHO is not set +CONFIG_MISC_RTSX_USB=y + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_MQ_DEFAULT is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_ETHERNET is not set +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_BUS=y +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_HISI_FEMAC is not set +# CONFIG_MDIO_MSCC_MIIM is not set +CONFIG_PHYLIB=y +CONFIG_SWPHY=y +# CONFIG_LED_TRIGGER_PHY is not set + +# +# MII PHY device drivers +# +# CONFIG_AMD_PHY is not set +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_ASIX_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_CORTINA_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_DP83822_PHY is not set +# CONFIG_DP83TC811_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +CONFIG_FIXED_PHY=y +# CONFIG_ICPLUS_PHY is not set +# CONFIG_INTEL_XWAY_PHY is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_MARVELL_10G_PHY is not set +# CONFIG_MICREL_PHY is not set +CONFIG_MICROCHIP_PHY=y +# CONFIG_MICROCHIP_T1_PHY is not set +# CONFIG_MICROSEMI_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_RENESAS_PHY is not set +# CONFIG_ROCKCHIP_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_XILINX_GMII2RGMII is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=m +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +CONFIG_USB_LAN78XX=y +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=m +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +CONFIG_USB_HSO=m +# CONFIG_USB_NET_INT51X1 is not set +CONFIG_USB_IPHETH=m +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +# CONFIG_WIRELESS_WDS is not set +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_ATH_COMMON=m +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_DYNACK is not set +# CONFIG_ATH9K_WOW is not set +CONFIG_ATH9K_RFKILL=y +CONFIG_ATH9K_CHANNEL_CONTEXT=y +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +# CONFIG_ATH6KL_TRACING is not set +CONFIG_AR5523=m +# CONFIG_ATH10K is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_B43=m +CONFIG_B43_BCMA=y +CONFIG_B43_SSB=y +CONFIG_B43_BUSES_BCMA_AND_SSB=y +# CONFIG_B43_BUSES_BCMA is not set +# CONFIG_B43_BUSES_SSB is not set +# CONFIG_B43_SDIO is not set +CONFIG_B43_BCMA_PIO=y +CONFIG_B43_PIO=y +CONFIG_B43_PHY_G=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_HT=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y +# CONFIG_HOSTAP is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_SPI is not set +CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_MWIFIEX is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y +CONFIG_MT76_USB=m +CONFIG_MT76x2_COMMON=m +CONFIG_MT76x0U=m +CONFIG_MT76x2U=m +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +CONFIG_RTL_CARDS=m +# CONFIG_RTL8192CU is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_NETDEVSIM is not set +# CONFIG_NET_FAILOVER is not set +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_POLLDEV=m +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_DLINK_DIR685 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=m +# CONFIG_KEYBOARD_GPIO_POLLED is not set +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_JOYSTICK_PSXPAD_SPI=m +CONFIG_JOYSTICK_PSXPAD_SPI_FF=y +# CONFIG_JOYSTICK_PXRC is not set +# CONFIG_JOYSTICK_RPISENSE is not set +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +CONFIG_TOUCHSCREEN_ADS7846=m +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_BU21029 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set +# CONFIG_TOUCHSCREEN_EXC3000 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_HIDEEP is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_S6SY761 is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_EKTF2127 is not set +# CONFIG_TOUCHSCREEN_ELAN is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +CONFIG_TOUCHSCREEN_RPI_FT5406=m +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +# CONFIG_TOUCHSCREEN_USB_PANJIT is not set +CONFIG_TOUCHSCREEN_USB_3M=y +# CONFIG_TOUCHSCREEN_USB_ITM is not set +# CONFIG_TOUCHSCREEN_USB_ETURBO is not set +# CONFIG_TOUCHSCREEN_USB_GUNZE is not set +# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set +# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set +# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set +# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set +# CONFIG_TOUCHSCREEN_USB_GOTOP is not set +# CONFIG_TOUCHSCREEN_USB_JASTEC is not set +# CONFIG_TOUCHSCREEN_USB_ELO is not set +# CONFIG_TOUCHSCREEN_USB_E2I is not set +# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set +# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set +# CONFIG_TOUCHSCREEN_USB_NEXIO is not set +# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_RM_TS is not set +# CONFIG_TOUCHSCREEN_SILEAD is not set +# CONFIG_TOUCHSCREEN_SIS_I2C is not set +CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_STMFTS is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZET6223 is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_ARIZONA_HAPTICS is not set +# CONFIG_INPUT_ATMEL_CAPTOUCH is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_DECODER is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_PWM_VIBRA is not set +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +CONFIG_RMI4_CORE=y +# CONFIG_RMI4_I2C is not set +# CONFIG_RMI4_SPI is not set +# CONFIG_RMI4_SMB is not set +CONFIG_RMI4_F03=y +CONFIG_RMI4_F03_SERIO=y +CONFIG_RMI4_2D_SENSOR=y +CONFIG_RMI4_F11=y +CONFIG_RMI4_F12=y +CONFIG_RMI4_F30=y +# CONFIG_RMI4_F34 is not set +# CONFIG_RMI4_F55 is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +# CONFIG_SERIO_LIBPS2 is not set +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_SERIO_GPIO_PS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_BRCM_CHAR_DRIVERS=y +CONFIG_BCM2708_VCMEM=y +CONFIG_BCM_VCIO=y +CONFIG_BCM_VC_SM=y +CONFIG_BCM2835_DEVGPIOMEM=m +CONFIG_BCM2835_SMI_DEV=m +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +# CONFIG_SERIAL_8250_FINTEK is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_DMA is not set +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_RUNTIME_UARTS=0 +CONFIG_SERIAL_8250_EXTENDED=y +# CONFIG_SERIAL_8250_MANY_PORTS is not set +# CONFIG_SERIAL_8250_ASPEED_VUART is not set +CONFIG_SERIAL_8250_SHARE_IRQ=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_BCM2835AUX=y +CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_OF_PLATFORM=y + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +CONFIG_SERIAL_DEV_BUS=m +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_BCM2835=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=m + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_GPMUX is not set +# CONFIG_I2C_MUX_LTC4306 is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_DEMUX_PINCTRL is not set +# CONFIG_I2C_MUX_MLXCPLD is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# +CONFIG_I2C_BCM2708=y +CONFIG_I2C_BCM2708_BAUDRATE=100000 + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +CONFIG_I2C_BCM2835=m +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +CONFIG_I2C_GPIO=y +# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y +# CONFIG_SPI_MEM is not set + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set +CONFIG_SPI_BCM2835=m +CONFIG_SPI_BCM2835AUX=m +# CONFIG_SPI_BCM_QSPI is not set +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPI_SLAVE is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set +# CONFIG_PPS is not set + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_MCP23S08 is not set +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PINCTRL_SX150X is not set +CONFIG_PINCTRL_BCM2835=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_FASTPATH_LIMIT=512 +CONFIG_OF_GPIO=y +CONFIG_GPIOLIB_IRQCHIP=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +CONFIG_GPIO_RASPBERRYPI_EXP=y +CONFIG_GPIO_BCM_VIRT=y +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_FTGPIO010 is not set +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_HLWD is not set +# CONFIG_GPIO_MB86S7X is not set +# CONFIG_GPIO_MOCKUP is not set +# CONFIG_GPIO_MPC8XXX is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_TPIC2810 is not set + +# +# MFD GPIO expanders +# +CONFIG_GPIO_ARIZONA=m +# CONFIG_HTC_EGPIO is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX3191X is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set +# CONFIG_GPIO_XRA1403 is not set + +# +# USB GPIO expanders +# +CONFIG_W1=m + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_DS2490 is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS1WM is not set +CONFIG_W1_MASTER_GPIO=m + +# +# 1-wire Slaves +# +CONFIG_W1_SLAVE_THERM=m +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_DS2405 is not set +# CONFIG_W1_SLAVE_DS2408 is not set +# CONFIG_W1_SLAVE_DS2413 is not set +# CONFIG_W1_SLAVE_DS2406 is not set +# CONFIG_W1_SLAVE_DS2423 is not set +# CONFIG_W1_SLAVE_DS2805 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2438 is not set +# CONFIG_W1_SLAVE_DS2780 is not set +# CONFIG_W1_SLAVE_DS2781 is not set +# CONFIG_W1_SLAVE_DS28E04 is not set +# CONFIG_W1_SLAVE_DS28E17 is not set +# CONFIG_POWER_AVS is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMKONA is not set +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_RESTART=y +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_CHARGER_ADP5061 is not set +# CONFIG_BATTERY_DS2760 is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_CHARGER_SBS is not set +# CONFIG_MANAGER_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_BATTERY_MAX1721X is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_LTC3651 is not set +# CONFIG_CHARGER_DETECTOR_MAX14656 is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_HWMON=y +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ASPEED is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_FTSTEUTATES is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX31722 is not set +# CONFIG_SENSORS_MAX6621 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_TC654 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_NPCM7XX is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +CONFIG_SENSORS_RASPBERRYPI_HWMON=y +CONFIG_SENSORS_RPI_POE_FAN=m +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHT3x is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_STTS751 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_INA3221 is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP108 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83773G is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +# CONFIG_THERMAL_STATISTICS is not set +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +# CONFIG_CPU_THERMAL is not set +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_QORIQ_THERMAL is not set + +# +# ACPI INT340X thermal drivers +# + +# +# Broadcom thermal drivers +# +CONFIG_BCM2835_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WATCHDOG_NOWAYOUT is not set +CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y +# CONFIG_WATCHDOG_SYSFS is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +# CONFIG_FTWDT010_WATCHDOG is not set +# CONFIG_DW_WATCHDOG is not set +# CONFIG_MAX63XX_WATCHDOG is not set +CONFIG_BCM2835_WDT=y +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set + +# +# Watchdog Pretimeout Governors +# +# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set +CONFIG_SSB_POSSIBLE=y +CONFIG_SSB=m +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y +CONFIG_BCMA=m +CONFIG_BCMA_BLOCKIO=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_GMAC_CMN=y +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_RPISENSE_CORE is not set +# CONFIG_MFD_ACT8945A is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_BD9571MWV is not set +# CONFIG_MFD_AXP20X_I2C is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_MADERA is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77620 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_CPCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_PM8XXX is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +# CONFIG_MFD_SYSCON is not set +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_TI_LMU is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TI_LP873X is not set +# CONFIG_MFD_TI_LP87565 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +CONFIG_MFD_ARIZONA=y +CONFIG_MFD_ARIZONA_I2C=m +CONFIG_MFD_ARIZONA_SPI=m +# CONFIG_MFD_CS47L24 is not set +CONFIG_MFD_WM5102=y +# CONFIG_MFD_WM5110 is not set +# CONFIG_MFD_WM8997 is not set +# CONFIG_MFD_WM8998 is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_MFD_ROHM_BD718XX is not set +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=m +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_88PG86X is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +CONFIG_REGULATOR_ARIZONA_LDO1=m +CONFIG_REGULATOR_ARIZONA_MICSUPP=m +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_PV88060 is not set +# CONFIG_REGULATOR_PV88080 is not set +# CONFIG_REGULATOR_PV88090 is not set +# CONFIG_REGULATOR_PWM is not set +# CONFIG_REGULATOR_SY8106A is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS65132 is not set +# CONFIG_REGULATOR_TPS6524X is not set +# CONFIG_REGULATOR_VCTRL is not set +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_LIRC=y +CONFIG_RC_DECODERS=y +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_IR_IMON_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +# CONFIG_IR_HIX5HD2 is not set +CONFIG_IR_IMON=m +CONFIG_IR_IMON_RAW=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +# CONFIG_IR_SPI is not set +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_IR_GPIO_TX=m +CONFIG_IR_PWM_TX=m +# CONFIG_IR_SERIAL is not set +# CONFIG_IR_SIR is not set +CONFIG_RC_XBOX_DVD=m +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +# CONFIG_MEDIA_SDR_SUPPORT is not set +# CONFIG_MEDIA_CEC_SUPPORT is not set +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_DVB_CORE=m +# CONFIG_DVB_MMAP is not set +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set +# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set +# CONFIG_DVB_ULE_DEBUG is not set + +# +# Media drivers +# +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_DIB3000MC=m +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_DVB_USB_ZD1301=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +# CONFIG_RADIO_ADAPTERS is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_V4L2=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# + +# +# SDR tuner chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# + +# +# Media SPI Adapters +# +CONFIG_CXD2880_SPI_DRV=m +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA18250=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_QM1D1C0042=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m +CONFIG_DVB_MN88472=m +CONFIG_DVB_MN88473=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m +CONFIG_DVB_ZD1301_DEMOD=m +CONFIG_DVB_GP8PSK_FE=m +CONFIG_DVB_CXD2880=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# +CONFIG_DVB_TC90522=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Common Interface (EN50221) controller drivers +# +CONFIG_DVB_SP2=m + +# +# Tools to develop new frontends +# + +# +# Graphics support +# +# CONFIG_IMX_IPUV3_CORE is not set +CONFIG_DRM=y +CONFIG_DRM_MIPI_DSI=y +# CONFIG_DRM_DP_AUX_CHARDEV is not set +# CONFIG_DRM_DEBUG_MM is not set +# CONFIG_DRM_DEBUG_SELFTEST is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +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_CEC is not set +CONFIG_DRM_GEM_CMA_HELPER=y +CONFIG_DRM_KMS_CMA_HELPER=y + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_I2C_NXP_TDA9950 is not set +# CONFIG_DRM_HDLCD is not set +# CONFIG_DRM_MALI_DISPLAY is not set + +# +# ACP (Audio CoProcessor) Configuration +# + +# +# AMD Library routines +# +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_VKMS is not set +# CONFIG_DRM_EXYNOS is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_ARMADA is not set +# CONFIG_DRM_RCAR_DW_HDMI is not set +# CONFIG_DRM_RCAR_LVDS is not set +# CONFIG_DRM_OMAP is not set +# CONFIG_DRM_TILCDC is not set +# CONFIG_DRM_FSL_DCU is not set +# CONFIG_DRM_STM is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +# CONFIG_DRM_PANEL_LVDS is not set +# CONFIG_DRM_PANEL_SIMPLE is not set +# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set +# CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set +# CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set +# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_ORISETECH_OTM8009A is not set +# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m +# CONFIG_DRM_PANEL_RAYDIUM_RM68200 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_ANALOGIX_ANX78XX is not set +# CONFIG_DRM_CDNS_DSI is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LVDS_ENCODER is not set +# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_SIL_SII8620 is not set +# CONFIG_DRM_SII902X is not set +# CONFIG_DRM_SII9234 is not set +# CONFIG_DRM_THINE_THC63LVD1024 is not set +# CONFIG_DRM_TOSHIBA_TC358767 is not set +# CONFIG_DRM_TI_TFP410 is not set +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_STI is not set +# CONFIG_DRM_V3D is not set +CONFIG_DRM_VC4=m +# CONFIG_DRM_VC4_HDMI_CEC is not set +# CONFIG_DRM_ARCPGU is not set +# CONFIG_DRM_MXSFB is not set +# CONFIG_DRM_TINYDRM is not set +# CONFIG_DRM_PL111 is not set +# CONFIG_DRM_TVE200 is not set +# CONFIG_DRM_LEGACY is not set +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +CONFIG_FB_BCM2708=y +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_RPISENSE is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +# CONFIG_LCD_OTM3225A is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +# CONFIG_BACKLIGHT_PWM is not set +CONFIG_BACKLIGHT_RPI=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_BACKLIGHT_ARCXCNN is not set +CONFIG_HDMI=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +CONFIG_SND=m +CONFIG_SND_TIMER=m +CONFIG_SND_PCM=m +CONFIG_SND_PCM_ELD=y +CONFIG_SND_DMAENGINE_PCM=m +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_COMPRESS_OFFLOAD=m +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_OSSEMUL is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=m +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_DRIVERS is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +CONFIG_SND_ARM=y +# CONFIG_SND_ARMAACI is not set +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_SOC=m +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +CONFIG_SND_SOC_COMPRESS=y +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_ATMEL_SOC is not set +CONFIG_SND_BCM2835_SOC_I2S=m +CONFIG_SND_BCM2708_SOC_3DLAB_NANO_PLAYER=m +CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m +CONFIG_SND_BCM2708_SOC_RPI_CIRRUS=m +CONFIG_SND_BCM2708_SOC_RPI_DAC=m +CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m +CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m +CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m +CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m +CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m +CONFIG_SND_AUDIOINJECTOR_OCTO_SOUNDCARD=m +CONFIG_SND_AUDIOSENSE_PI=m +CONFIG_SND_DIGIDAC1_SOUNDCARD=m +CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m +CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2=m +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m +CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m +CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m +CONFIG_SND_BCM2708_SOC_ALLO_KATANA_DAC=m +CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m +CONFIG_SND_PISOUND=m +CONFIG_SND_RPI_SIMPLE_SOUNDCARD=m +CONFIG_SND_RPI_WM8804_SOUNDCARD=m +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_I2S_HI6210_I2S is not set +# CONFIG_SND_SOC_IMG is not set + +# +# STMicroelectronics STM32 SOC audio support +# +# CONFIG_SND_SOC_XTFPGA_I2S is not set +# CONFIG_ZX_TDM is not set +CONFIG_SND_SOC_I2C_AND_SPI=m + +# +# CODEC drivers +# +CONFIG_SND_SOC_ARIZONA=m +CONFIG_SND_SOC_WM_ADSP=m +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_AD193X_SPI is not set +# CONFIG_SND_SOC_AD193X_I2C is not set +CONFIG_SND_SOC_ADAU1701=m +# CONFIG_SND_SOC_ADAU1761_I2C is not set +# CONFIG_SND_SOC_ADAU1761_SPI is not set +CONFIG_SND_SOC_ADAU1977=m +CONFIG_SND_SOC_ADAU1977_I2C=m +CONFIG_SND_SOC_ADAU7002=m +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4458 is not set +CONFIG_SND_SOC_AK4554=m +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_AK5558 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_BD28623 is not set +# CONFIG_SND_SOC_BT_SCO is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS35L33 is not set +# CONFIG_SND_SOC_CS35L34 is not set +# CONFIG_SND_SOC_CS35L35 is not set +# CONFIG_SND_SOC_CS42L42 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +CONFIG_SND_SOC_CS4265=m +# CONFIG_SND_SOC_CS4270 is not set +CONFIG_SND_SOC_CS4271=m +CONFIG_SND_SOC_CS4271_I2C=m +# CONFIG_SND_SOC_CS4271_SPI is not set +CONFIG_SND_SOC_CS42XX8=m +CONFIG_SND_SOC_CS42XX8_I2C=m +# CONFIG_SND_SOC_CS43130 is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CS53L30 is not set +CONFIG_SND_SOC_DMIC=m +# CONFIG_SND_SOC_ES7134 is not set +# CONFIG_SND_SOC_ES7241 is not set +# CONFIG_SND_SOC_ES8316 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8328_SPI is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_ICS43432 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set +# CONFIG_SND_SOC_MAX98504 is not set +# CONFIG_SND_SOC_MAX9867 is not set +# CONFIG_SND_SOC_MAX98927 is not set +# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX9860 is not set +# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1789_I2C is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM186X_I2C is not set +# CONFIG_SND_SOC_PCM186X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set +CONFIG_SND_SOC_PCM5102A=m +CONFIG_SND_SOC_PCM512x=m +CONFIG_SND_SOC_PCM512x_I2C=m +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5616 is not set +CONFIG_SND_SOC_PCM1794A=m +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_SGTL5000=m +CONFIG_SND_SOC_SIGMADSP=m +CONFIG_SND_SOC_SIGMADSP_I2C=m +CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=m +# CONFIG_SND_SOC_SSM2305 is not set +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +CONFIG_SND_SOC_STA32X=m +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TAS5720 is not set +# CONFIG_SND_SOC_TAS6424 is not set +# CONFIG_SND_SOC_TDA7419 is not set +# CONFIG_SND_SOC_TFA9879 is not set +CONFIG_SND_SOC_TAS5713=m +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +CONFIG_SND_SOC_TLV320AIC32X4=m +CONFIG_SND_SOC_TLV320AIC32X4_I2C=m +# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TS3A227E is not set +# CONFIG_SND_SOC_TSCS42XX is not set +# CONFIG_SND_SOC_TSCS454 is not set +CONFIG_SND_SOC_WM5102=m +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8524 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +CONFIG_SND_SOC_WM8731=m +# CONFIG_SND_SOC_WM8737 is not set +CONFIG_SND_SOC_WM8741=m +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8782 is not set +CONFIG_SND_SOC_WM8804=m +CONFIG_SND_SOC_WM8804_I2C=m +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8960 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_WM8985 is not set +# CONFIG_SND_SOC_ZX_AUD96P22 is not set +# CONFIG_SND_SOC_MAX9759 is not set +# CONFIG_SND_SOC_MT6351 is not set +# CONFIG_SND_SOC_NAU8540 is not set +# CONFIG_SND_SOC_NAU8810 is not set +# CONFIG_SND_SOC_NAU8824 is not set +CONFIG_SND_SOC_TPA6130A2=m +CONFIG_SND_SIMPLE_CARD_UTILS=m +CONFIG_SND_SIMPLE_CARD=m +# CONFIG_SND_SIMPLE_SCU_CARD is not set +CONFIG_SND_AUDIO_GRAPH_CARD=m +# CONFIG_SND_AUDIO_GRAPH_SCU_CARD is not set + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACCUTOUCH is not set +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_ASUS=y +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_BIGBEN_FF=m +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_COUGAR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELAN is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GOOGLE_HAMMER is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +# CONFIG_HID_ITE is not set +# CONFIG_HID_JABRA is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +# CONFIG_HID_LED is not set +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +# CONFIG_HID_MAYFLASH is not set +# CONFIG_HID_REDRAGON is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTI is not set +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_OUYA=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_RETRODE is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEAM is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_UDRAW_PS3 is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_ALPS is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set +CONFIG_USB_MON=m +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +CONFIG_USB_DWCOTG=y +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +# CONFIG_USB_UAS is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +CONFIG_USB_SERIAL_CH341=m +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=m +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=m +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_F8153X is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +CONFIG_USB_SERIAL_IUU=m +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=m +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_UPD78F0730 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HUB_USB251XB is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_HSIC_USB4604 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_USB_GADGET is not set +# CONFIG_TYPEC is not set +# CONFIG_USB_ROLE_SWITCH is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_USB_ULPI_BUS is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_BCM2835_MMC=y +CONFIG_MMC_BCM2835_DMA=y +CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 +CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_OF_DWCMSHC is not set +# CONFIG_MMC_SDHCI_CADENCE is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_SDHCI_IPROC is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_DW is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +CONFIG_MMC_REALTEK_USB=m +# CONFIG_MMC_CQHCI is not set +# CONFIG_MMC_BCM2835 is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MMC_SDHCI_XENON is not set +# CONFIG_MMC_SDHCI_OMAP is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=y +# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set + +# +# LED drivers +# +# CONFIG_LEDS_AAT1290 is not set +# CONFIG_LEDS_AS3645A is not set +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_CR0014114 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_LM3692X is not set +# CONFIG_LEDS_LM3601X is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP3952 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_IS31FL319X is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_MLXREG is not set +# CONFIG_LEDS_USER is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +# CONFIG_LEDS_TRIGGER_ACTIVITY is not set +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_LEDS_TRIGGER_INPUT=y +# CONFIG_LEDS_TRIGGER_PANIC is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set +CONFIG_RTC_NVMEM=y + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +CONFIG_RTC_DRV_ABX80X=m +CONFIG_RTC_DRV_DS1307=m +# CONFIG_RTC_DRV_DS1307_CENTURY is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12026 is not set +# CONFIG_RTC_DRV_X1205 is not set +CONFIG_RTC_DRV_PCF8523=m +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF85363 is not set +CONFIG_RTC_DRV_PCF8563=m +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1302 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6916 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +CONFIG_RTC_DRV_DS3232=m +CONFIG_RTC_DRV_DS3232_HWMON=y +CONFIG_RTC_DRV_PCF2127=m +# CONFIG_RTC_DRV_RV3029C2 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_FTRTC010 is not set +# CONFIG_RTC_DRV_SNVS is not set +# CONFIG_RTC_DRV_R7301 is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_OF=y +# CONFIG_ALTERA_MSGDMA is not set +# CONFIG_AMBA_PL08X is not set +CONFIG_DMA_BCM2835=y +# CONFIG_DW_AXI_DMAC is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_NBPFAXI_DMA is not set +# CONFIG_PL330_DMA is not set +CONFIG_DMA_BCM2708=y +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set + +# +# DMABUF options +# +CONFIG_SYNC_FILE=y +# CONFIG_SW_SYNC is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VIRT_DRIVERS is not set +# CONFIG_VIRTIO_MENU is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +CONFIG_RTL8723BS=m +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +CONFIG_VT6656=m + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +CONFIG_STAGING_MEDIA=y + +# +# Android +# +# CONFIG_STAGING_BOARD is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_UNISYSSPAR is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set +# CONFIG_MOST is not set +# CONFIG_KS7010 is not set +# CONFIG_GREYBUS is not set +CONFIG_BCM_VIDEOCORE=y +CONFIG_BCM2835_VCHIQ=y +CONFIG_SND_BCM2835=m +# CONFIG_VIDEO_BCM2835 is not set +# CONFIG_BCM2835_VCHIQ_MMAL is not set +# CONFIG_BCM_VC_SM_CMA is not set +# CONFIG_VIDEO_CODEC_BCM2835 is not set +# CONFIG_PI433 is not set +# CONFIG_MTK_MMC is not set + +# +# Gasket devices +# +# CONFIG_XIL_AXIS_FIFO is not set +# CONFIG_EROFS_FS is not set +# CONFIG_GOLDFISH is not set +# CONFIG_CHROME_PLATFORMS is not set +# CONFIG_MELLANOX_PLATFORM is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_CLK_HSDK is not set +# CONFIG_COMMON_CLK_MAX9485 is not set +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI544 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_VC5 is not set +# CONFIG_HWSPINLOCK is not set + +# +# Clock Source drivers +# +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_CLKSRC_MMIO=y +CONFIG_BCM2835_TIMER=y +CONFIG_ARM_TIMER_SP804=y +CONFIG_MAILBOX=y +# CONFIG_ARM_MHU is not set +# CONFIG_PLATFORM_MHU is not set +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set +CONFIG_BCM2835_MBOX=y +# CONFIG_MAILBOX_TEST is not set +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers +# +# CONFIG_REMOTEPROC is not set + +# +# Rpmsg drivers +# +# CONFIG_RPMSG_QCOM_GLINK_RPM is not set +# CONFIG_RPMSG_VIRTIO is not set +# CONFIG_SOUNDWIRE is not set + +# +# SOC (System On Chip) specific Drivers +# + +# +# Amlogic SoC drivers +# + +# +# Broadcom SoC drivers +# +CONFIG_RASPBERRYPI_POWER=y +# CONFIG_SOC_BRCMSTB is not set + +# +# NXP/Freescale QorIQ SoC drivers +# + +# +# i.MX SoC drivers +# + +# +# Qualcomm SoC drivers +# +# CONFIG_SOC_TI is not set + +# +# Xilinx SoC drivers +# +# CONFIG_XILINX_VCU is not set +# CONFIG_PM_DEVFREQ is not set +CONFIG_EXTCON=m + +# +# Extcon Device Drivers +# +CONFIG_EXTCON_ARIZONA=m +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_MAX3355 is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +CONFIG_PWM_BCM2835=m +# CONFIG_PWM_FSL_FTM is not set +# CONFIG_PWM_PCA9685 is not set + +# +# IRQ chip support +# +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 +# CONFIG_IPACK_BUS is not set +CONFIG_RESET_CONTROLLER=y +# CONFIG_RESET_TI_SYSCON is not set +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_PHY_MAPPHONE_MDM6600 is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +# CONFIG_ARM_CCN is not set +CONFIG_ARM_PMU=y +CONFIG_RPI_AXIPERF=m +# CONFIG_RAS is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_DAX is not set +CONFIG_NVMEM=y + +# +# HW tracing support +# +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set +# CONFIG_FPGA is not set +# CONFIG_FSI is not set +# CONFIG_SIOX is not set +# CONFIG_SLIMBUS is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_FS_IOMAP=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_ONLINE_SCRUB is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_BTRFS_FS_REF_VERIFY is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +# CONFIG_EXPORTFS_BLOCK_OPS is not set +CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +CONFIG_AUTOFS4_FS=y +CONFIG_AUTOFS_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m +# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y +# CONFIG_OVERLAY_FS_INDEX is not set +# CONFIG_OVERLAY_FS_XINO_AUTO is not set +# CONFIG_OVERLAY_FS_METACOPY is not set + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +CONFIG_MEMFD_CREATE=y +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_ROOT_NFS=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS2=y +CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_FSCACHE=y +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_KEY_DH_OPERATIONS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_FORTIFY_SOURCE is not set +# CONFIG_STATIC_USERMODEHELPER is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +CONFIG_CRYPTO_KPP2=y +CONFIG_CRYPTO_KPP=m +CONFIG_CRYPTO_ACOMP2=y +CONFIG_CRYPTO_RSA=y +# CONFIG_CRYPTO_DH is not set +CONFIG_CRYPTO_ECDH=m +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=m +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=m +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +# CONFIG_CRYPTO_AEGIS128 is not set +# CONFIG_CRYPTO_AEGIS128L is not set +# CONFIG_CRYPTO_AEGIS256 is not set +# CONFIG_CRYPTO_MORUS640 is not set +# CONFIG_CRYPTO_MORUS1280 is not set +CONFIG_CRYPTO_SEQIV=y +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CFB=m +CONFIG_CRYPTO_CTR=y +CONFIG_CRYPTO_CTS=m +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +# CONFIG_CRYPTO_CRCT10DIF is not set +CONFIG_CRYPTO_GHASH=m +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=m +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +# CONFIG_CRYPTO_SHA3 is not set +# CONFIG_CRYPTO_SM3 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_AES_TI is not set +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SM4 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +CONFIG_CRYPTO_LZO=m +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set +# CONFIG_CRYPTO_ZSTD is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +# CONFIG_CRYPTO_HW is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set + +# +# Certificates for signature checking +# +CONFIG_SYSTEM_TRUSTED_KEYRING=y +CONFIG_SYSTEM_TRUSTED_KEYS="" +# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set +# CONFIG_SECONDARY_TRUSTED_KEYRING is not set +# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=m +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC64 is not set +# CONFIG_CRC4 is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=m +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=m +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_COMPRESS=m +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SGL_ALLOC=y +CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set +CONFIG_NLATTR=y +CONFIG_CLZ_TAB=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set +CONFIG_MPILIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_SG_POOL=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_SBITMAP=y +# CONFIG_STRING_SELFTEST is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_CONSOLE_LOGLEVEL_QUIET=4 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_PAGE_REF is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +CONFIG_ARCH_HAS_KCOV=y +CONFIG_CC_HAS_SANCOV_TRACE_PC=y +# CONFIG_KCOV is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +# CONFIG_SOFTLOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +CONFIG_LOCK_DEBUGGING_SUPPORT=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_WW_MUTEX_SELFTEST is not set +CONFIG_TRACE_IRQFLAGS=y +CONFIG_STACKTRACE=y +# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_RCU_PERF_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACER_MAX_TRACE=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_RING_BUFFER_ALLOW_SWAP=y +CONFIG_PREEMPTIRQ_TRACEPOINTS=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y +# CONFIG_HWLAT_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_TRACER_SNAPSHOT=y +CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +CONFIG_STACK_TRACER=y +CONFIG_BLK_DEV_IO_TRACE=y +CONFIG_KPROBE_EVENTS=y +# CONFIG_UPROBE_EVENTS is not set +CONFIG_BPF_EVENTS=y +CONFIG_PROBE_EVENTS=y +CONFIG_DYNAMIC_FTRACE=y +CONFIG_DYNAMIC_FTRACE_WITH_REGS=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_PREEMPTIRQ_DELAY_TEST is not set +# CONFIG_TRACE_EVAL_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_RUNTIME_TESTING_MENU is not set +# CONFIG_MEMTEST is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_ARM_PTDUMP_DEBUGFS is not set +# CONFIG_DEBUG_WX is not set +# CONFIG_ARM_UNWIND is not set +CONFIG_OLD_MCOUNT=y +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_ARM_KPROBES_TEST is not set +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_CORESIGHT is not set diff --git a/projects/RPi/devices/RPi/options b/projects/RPi/devices/RPi/options new file mode 100644 index 0000000000..3ee3c69ab0 --- /dev/null +++ b/projects/RPi/devices/RPi/options @@ -0,0 +1,9 @@ +################################################################################ +# Device defaults +################################################################################ + + # NOOBS supported hex versions (legacy) + NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093" + + # NOOBS supported model versions + NOOBS_SUPPORTED_MODELS='"Pi Model","Pi Compute Module","Pi Zero"' diff --git a/projects/RPi/devices/RPi2/linux/linux.arm.conf b/projects/RPi/devices/RPi2/linux/linux.arm.conf new file mode 100644 index 0000000000..c12346a5ea --- /dev/null +++ b/projects/RPi/devices/RPi2/linux/linux.arm.conf @@ -0,0 +1,4868 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.19.20 Kernel Configuration +# + +# +# Compiler: gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0 +# +CONFIG_CC_IS_GCC=y +CONFIG_GCC_VERSION=70200 +CONFIG_CLANG_VERSION=0 +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_BUILD_SALT="" +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +# CONFIG_USELIB is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +# CONFIG_GENERIC_IRQ_DEBUGFS is not set +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set +CONFIG_CPU_ISOLATION=y + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +CONFIG_TREE_SRCU=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RCU_NEED_SEGCBLIST=y +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +CONFIG_MEMCG_KMEM=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +# CONFIG_FAIR_GROUP_SCHED is not set +# CONFIG_RT_GROUP_SCHED is not set +# CONFIG_CGROUP_PIDS is not set +# CONFIG_CGROUP_RDMA is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_BPF=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_SOCK_CGROUP_DATA=y +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_CHECKPOINT_RESTORE is not set +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_INITRAMFS_FORCE is not set +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +CONFIG_INITRAMFS_COMPRESSION=".gz" +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +# CONFIG_UID16 is not set +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +# CONFIG_SYSFS_SYSCALL is not set +CONFIG_SYSCTL_SYSCALL=y +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y +CONFIG_PRINTK=y +CONFIG_PRINTK_NMI=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +CONFIG_MEMBARRIER=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_BASE_RELATIVE=y +CONFIG_BPF_SYSCALL=y +# CONFIG_USERFAULTFD is not set +CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +CONFIG_RSEQ=y +# CONFIG_DEBUG_RSEQ is not set +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y +# CONFIG_PC104 is not set + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_SLUB_MEMCG_SYSFS_ON is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLAB_MERGE_DEFAULT=y +# CONFIG_SLAB_FREELIST_RANDOM is not set +# CONFIG_SLAB_FREELIST_HARDENED is not set +CONFIG_SLUB_CPU_PARTIAL=y +CONFIG_SYSTEM_DATA_VERIFICATION=y +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y +CONFIG_ARM=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_FIQ=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Multiple platform selection +# + +# +# CPU Core family selection +# +# CONFIG_ARCH_MULTI_V6 is not set +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_MULTI_V6_V7=y +# CONFIG_ARCH_VIRT is not set +# CONFIG_ARCH_ACTIONS is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_ARTPEC is not set +# CONFIG_ARCH_AT91 is not set +CONFIG_ARCH_BCM=y + +# +# IPROC architected SoCs +# +# CONFIG_ARCH_BCM_CYGNUS is not set +# CONFIG_ARCH_BCM_HR2 is not set +# CONFIG_ARCH_BCM_NSP is not set +# CONFIG_ARCH_BCM_5301X is not set + +# +# KONA architected SoCs +# +# CONFIG_ARCH_BCM_281XX is not set +# CONFIG_ARCH_BCM_21664 is not set +# CONFIG_ARCH_BCM_23550 is not set + +# +# Other Architectures +# +CONFIG_ARCH_BCM2835=y +# CONFIG_ARCH_BCM_53573 is not set +# CONFIG_ARCH_BCM_63XX is not set +# CONFIG_ARCH_BRCMSTB is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_DIGICOLOR is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_HIGHBANK is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_KEYSTONE is not set +# CONFIG_ARCH_MEDIATEK is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_NPCM is not set + +# +# TI OMAP/AM/DM/DRA Family +# +# CONFIG_ARCH_OMAP3 is not set +# CONFIG_ARCH_OMAP4 is not set +# CONFIG_SOC_OMAP5 is not set +# CONFIG_SOC_AM33XX is not set +# CONFIG_SOC_AM43XX is not set +# CONFIG_SOC_DRA7XX is not set +# CONFIG_ARCH_SIRF is not set +# CONFIG_ARCH_QCOM is not set +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_ROCKCHIP is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_RENESAS is not set +# CONFIG_ARCH_SOCFPGA is not set +# CONFIG_PLAT_SPEAR is not set +# CONFIG_ARCH_STI is not set +# CONFIG_ARCH_STM32 is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_TANGO is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_U8500 is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_WM8850 is not set +# CONFIG_ARCH_ZX is not set +# CONFIG_ARCH_ZYNQ is not set + +# +# Processor Type +# +CONFIG_CPU_V7=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARM_LPAE is not set +CONFIG_ARM_THUMB=y +# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_VIRT_EXT=y +CONFIG_SWP_EMULATE=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_CPU_SPECTRE=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y +CONFIG_KUSER_HELPERS=y +CONFIG_VDSO=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_DEBUG_ALIGN_RODATA=y +# CONFIG_ARM_ERRATA_430973 is not set +# CONFIG_ARM_ERRATA_643719 is not set +# CONFIG_ARM_ERRATA_720789 is not set +# CONFIG_ARM_ERRATA_754322 is not set +# CONFIG_ARM_ERRATA_754327 is not set +# CONFIG_ARM_ERRATA_764369 is not set +# CONFIG_ARM_ERRATA_775420 is not set +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_ERRATA_773022 is not set +# CONFIG_ARM_ERRATA_818325_852422 is not set +# CONFIG_ARM_ERRATA_821420 is not set +# CONFIG_ARM_ERRATA_825619 is not set +# CONFIG_ARM_ERRATA_852421 is not set +# CONFIG_ARM_ERRATA_852423 is not set + +# +# Bus support +# +# CONFIG_PCI is not set + +# +# PCI Endpoint +# +# CONFIG_PCI_ENDPOINT is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_HAVE_SMP=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_ARM_CPU_TOPOLOGY=y +# CONFIG_SCHED_MC is not set +# CONFIG_SCHED_SMT is not set +CONFIG_HAVE_ARM_ARCH_TIMER=y +# CONFIG_MCPM is not set +# CONFIG_BIG_LITTLE is not set +# CONFIG_VMSPLIT_3G is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_NR_CPUS=4 +# CONFIG_HOTPLUG_CPU is not set +# CONFIG_ARM_PSCI is not set +CONFIG_ARCH_NR_GPIO=0 +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_ARM_PATCH_IDIV=y +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +# CONFIG_HIGHMEM is not set +# CONFIG_CPU_SW_DOMAIN_PAN is not set +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +CONFIG_UACCESS_WITH_MEMCPY=y +# CONFIG_SECCOMP is not set +# CONFIG_PARAVIRT is not set +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set +# CONFIG_XEN is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_AUTO_ZRELADDR=y +# CONFIG_EFI is not set + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set + +# +# CPU frequency scaling drivers +# +# CONFIG_CPUFREQ_DT is not set +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +CONFIG_ARM_BCM2835_CPUFREQ=y +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_NEON=y +CONFIG_KERNEL_MODE_NEON=y + +# +# Power management options +# +# CONFIG_SUSPEND is not set +# CONFIG_HIBERNATION is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +# CONFIG_APM_EMULATION is not set +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y + +# +# Firmware Drivers +# +# CONFIG_ARM_SCMI_PROTOCOL is not set +# CONFIG_ARM_SCPI_PROTOCOL is not set +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_RASPBERRYPI_FIRMWARE=y +# CONFIG_FW_CFG_SYSFS is not set +CONFIG_HAVE_ARM_SMCCC=y +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# Tegra firmware driver +# +CONFIG_ARM_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM=y +CONFIG_CRYPTO_SHA1_ARM_NEON=y +# CONFIG_CRYPTO_SHA1_ARM_CE is not set +# CONFIG_CRYPTO_SHA2_ARM_CE is not set +CONFIG_CRYPTO_SHA256_ARM=m +# CONFIG_CRYPTO_SHA512_ARM is not set +CONFIG_CRYPTO_AES_ARM=m +CONFIG_CRYPTO_AES_ARM_BS=m +# CONFIG_CRYPTO_AES_ARM_CE is not set +# CONFIG_CRYPTO_GHASH_ARM_CE is not set +CONFIG_CRYPTO_CRC32_ARM_CE=y +# CONFIG_CRYPTO_CHACHA20_NEON is not set +# CONFIG_VIRTUALIZATION is not set + +# +# General architecture-dependent options +# +CONFIG_OPROFILE=m +CONFIG_HAVE_OPROFILE=y +CONFIG_KPROBES=y +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +CONFIG_OPTPROBES=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_KRETPROBES=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_NMI=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_STACKPROTECTOR=y +CONFIG_CC_HAS_STACKPROTECTOR_NONE=y +CONFIG_STACKPROTECTOR=y +CONFIG_STACKPROTECTOR_STRONG=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_HAVE_EXIT_THREAD=y +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_STRICT_MODULE_RWX=y +CONFIG_ARCH_HAS_PHYS_TO_DMA=y +CONFIG_REFCOUNT_FULL=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_PLUGIN_HOSTCC="" +CONFIG_HAVE_GCC_PLUGINS=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +# CONFIG_TRIM_UNUSED_KSYMS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_ZONED is not set +# CONFIG_BLK_DEV_THROTTLING is not set +# CONFIG_BLK_CMDLINE_PARSER is not set +# CONFIG_BLK_WBT is not set +# CONFIG_BLK_CGROUP_IOLATENCY is not set +CONFIG_BLK_DEBUG_FS=y +# CONFIG_BLK_SED_OPAL is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +CONFIG_IOSCHED_BFQ=y +# CONFIG_BFQ_GROUP_IOSCHED is not set +CONFIG_ASN1=y +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_ELF_FDPIC is not set +CONFIG_ELFCORE=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_BINFMT_FLAT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Memory Management options +# +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_CLEANCACHE=y +CONFIG_FRONTSWAP=y +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_DEBUGFS=y +CONFIG_CMA_AREAS=7 +# CONFIG_ZSWAP is not set +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +# CONFIG_PERCPU_STATS is not set +# CONFIG_GUP_BENCHMARK is not set +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_TLS is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +# CONFIG_XDP_SOCKETS is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +# CONFIG_IP_ROUTE_VERBOSE is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE_COMMON=y +CONFIG_IP_MROUTE=y +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +CONFIG_INET_TUNNEL=m +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_WESTWOOD is not set +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +# CONFIG_TCP_CONG_HYBLA is not set +CONFIG_TCP_CONG_VEGAS=m +# CONFIG_TCP_CONG_NV is not set +CONFIG_TCP_CONG_SCALABLE=m +# CONFIG_TCP_CONG_LP is not set +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +# CONFIG_TCP_CONG_DCTCP is not set +CONFIG_TCP_CONG_CDG=m +# CONFIG_TCP_CONG_BBR is not set +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_IPV6_SEG6_LWTUNNEL is not set +# CONFIG_IPV6_SEG6_HMAC is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_FAMILY_BRIDGE=y +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +# CONFIG_NETFILTER_NETLINK_OSF is not set +CONFIG_NF_CONNTRACK=m +# CONFIG_NF_LOG_NETDEV is not set +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_ZONES is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CONNTRACK_LABELS is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +# CONFIG_NF_CONNTRACK_TFTP is not set +CONFIG_NF_CT_NETLINK=m +# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +# CONFIG_NF_SOCKET_IPV4 is not set +# CONFIG_NF_TPROXY_IPV4 is not set +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=y +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_SOCKET_IPV6 is not set +# CONFIG_NF_TPROXY_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +CONFIG_NF_REJECT_IPV6=m +# CONFIG_NF_LOG_IPV6 is not set +CONFIG_NF_NAT_IPV6=m +CONFIG_IP6_NF_IPTABLES=m +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_RPFILTER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_MATCH_SRH is not set +# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +# CONFIG_IP6_NF_TARGET_SYNPROXY is not set +CONFIG_IP6_NF_MANGLE=m +# CONFIG_IP6_NF_RAW is not set +CONFIG_IP6_NF_NAT=m +# CONFIG_IP6_NF_TARGET_MASQUERADE is not set +# CONFIG_IP6_NF_TARGET_NPT is not set +CONFIG_NF_DEFRAG_IPV6=m +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_BPFILTER is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BRIDGE_VLAN_FILTERING is not set +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +CONFIG_VLAN_8021Q=m +# CONFIG_VLAN_8021Q_GVRP is not set +# CONFIG_VLAN_8021Q_MVRP is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_CBS is not set +# CONFIG_NET_SCH_ETF is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_SKBPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_CAKE is not set +# CONFIG_NET_SCH_FQ is not set +# CONFIG_NET_SCH_HHF is not set +# CONFIG_NET_SCH_PIE is not set +# CONFIG_NET_SCH_PLUG is not set +# CONFIG_NET_SCH_DEFAULT is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_CLS_BPF is not set +# CONFIG_NET_CLS_FLOWER is not set +# CONFIG_NET_CLS_MATCHALL is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_NET_NSH is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +# CONFIG_NET_NCSI is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +# CONFIG_BPF_STREAM_PARSER is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +CONFIG_BT=m +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=m +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_LEDS is not set +# CONFIG_BT_SELFTEST is not set +# CONFIG_BT_DEBUGFS is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_HCIBTUSB=m +# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +# CONFIG_BT_HCIBTSDIO is not set +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_SERDEV=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_NOKIA is not set +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +CONFIG_BT_HCIUART_BCM=y +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set +# CONFIG_BT_HCIUART_MRVL is not set +CONFIG_BT_HCIBCM203X=m +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=m +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_MRVL is not set +CONFIG_BT_ATH3K=m +# CONFIG_BT_MTKUART is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AF_KCM is not set +CONFIG_FIB_RULES=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y +CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=m +CONFIG_RFKILL_LEDS=y +CONFIG_RFKILL_INPUT=y +# CONFIG_RFKILL_GPIO is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_PSAMPLE is not set +# CONFIG_NET_IFE is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_GRO_CELLS=y +# CONFIG_NET_DEVLINK is not set +CONFIG_MAY_USE_DEVLINK=y +# CONFIG_FAILOVER is not set +CONFIG_HAVE_EBPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y + +# +# Generic Driver Options +# +# CONFIG_UEVENT_HELPER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y + +# +# Firmware loader +# +CONFIG_FW_LOADER=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER is not set +# CONFIG_ALLOW_DEV_COREDUMP is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_DMA_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=5 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 +CONFIG_GENERIC_ARCH_TOPOLOGY=y + +# +# Bus devices +# +# CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_SIMPLE_PM_BUS is not set +# CONFIG_VEXPRESS_CONFIG is not set +# CONFIG_CONNECTOR is not set +# CONFIG_GNSS is not set +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_KOBJ=y +CONFIG_OF_DYNAMIC=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +CONFIG_CDROM=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +CONFIG_BLK_DEV_NBD=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# NVME Support +# +# CONFIG_NVME_FC is not set +# CONFIG_NVME_TARGET is not set + +# +# Misc devices +# +CONFIG_BCM2835_SMI=m +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +CONFIG_MISC_RTSX=y +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_EEPROM_IDT_89HPESX is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC & related support +# + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# VOP Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# + +# +# VOP Driver +# +# CONFIG_ECHO is not set +CONFIG_MISC_RTSX_USB=y + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_MQ_DEFAULT is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_MACSEC is not set +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=y +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_ETHERNET is not set +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_BUS=y +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_HISI_FEMAC is not set +# CONFIG_MDIO_MSCC_MIIM is not set +CONFIG_PHYLIB=y +CONFIG_SWPHY=y +# CONFIG_LED_TRIGGER_PHY is not set + +# +# MII PHY device drivers +# +# CONFIG_AMD_PHY is not set +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_ASIX_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_CORTINA_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_DP83822_PHY is not set +# CONFIG_DP83TC811_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +CONFIG_FIXED_PHY=y +# CONFIG_ICPLUS_PHY is not set +# CONFIG_INTEL_XWAY_PHY is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_MARVELL_10G_PHY is not set +# CONFIG_MICREL_PHY is not set +CONFIG_MICROCHIP_PHY=y +# CONFIG_MICROCHIP_T1_PHY is not set +# CONFIG_MICROSEMI_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_RENESAS_PHY is not set +# CONFIG_ROCKCHIP_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_XILINX_GMII2RGMII is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_MPPE=m +# CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_SLIP is not set +CONFIG_SLHC=m +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +CONFIG_USB_RTL8152=m +CONFIG_USB_LAN78XX=y +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDC_NCM is not set +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +CONFIG_USB_NET_DM9601=y +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=y +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +CONFIG_USB_HSO=m +# CONFIG_USB_NET_INT51X1 is not set +CONFIG_USB_IPHETH=m +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +# CONFIG_WIRELESS_WDS is not set +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_ATH_COMMON=m +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_AHB=y +# CONFIG_ATH9K_DEBUGFS is not set +# CONFIG_ATH9K_DYNACK is not set +# CONFIG_ATH9K_WOW is not set +CONFIG_ATH9K_RFKILL=y +CONFIG_ATH9K_CHANNEL_CONTEXT=y +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +# CONFIG_ATH6KL_SDIO is not set +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +# CONFIG_ATH6KL_TRACING is not set +CONFIG_AR5523=m +# CONFIG_ATH10K is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_WLAN_VENDOR_ATMEL=y +# CONFIG_AT76C50X_USB is not set +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_B43=m +CONFIG_B43_BCMA=y +CONFIG_B43_SSB=y +CONFIG_B43_BUSES_BCMA_AND_SSB=y +# CONFIG_B43_BUSES_BCMA is not set +# CONFIG_B43_BUSES_SSB is not set +# CONFIG_B43_SDIO is not set +CONFIG_B43_BCMA_PIO=y +CONFIG_B43_PIO=y +CONFIG_B43_PHY_G=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_HT=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_CISCO=y +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_WLAN_VENDOR_INTERSIL=y +# CONFIG_HOSTAP is not set +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_SPI is not set +CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_MWIFIEX is not set +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y +CONFIG_MT76_USB=m +CONFIG_MT76x2_COMMON=m +CONFIG_MT76x0U=m +CONFIG_MT76x2U=m +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +CONFIG_RTL_CARDS=m +# CONFIG_RTL8192CU is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WLAN_VENDOR_RSI=y +# CONFIG_RSI_91X is not set +CONFIG_WLAN_VENDOR_ST=y +# CONFIG_CW1200 is not set +CONFIG_WLAN_VENDOR_TI=y +# CONFIG_WL1251 is not set +# CONFIG_WL12XX is not set +# CONFIG_WL18XX is not set +# CONFIG_WLCORE is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_USB_ZD1201=m +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set +# CONFIG_MAC80211_HWSIM is not set +CONFIG_USB_NET_RNDIS_WLAN=m + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_NETDEVSIM is not set +# CONFIG_NET_FAILOVER is not set +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_POLLDEV=m +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_DLINK_DIR685 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=m +# CONFIG_KEYBOARD_GPIO_POLLED is not set +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +# CONFIG_JOYSTICK_IFORCE is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_JOYSTICK_PSXPAD_SPI=m +CONFIG_JOYSTICK_PSXPAD_SPI_FF=y +# CONFIG_JOYSTICK_PXRC is not set +# CONFIG_JOYSTICK_RPISENSE is not set +# CONFIG_INPUT_TABLET is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +CONFIG_TOUCHSCREEN_ADS7846=m +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_BU21029 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +CONFIG_TOUCHSCREEN_EGALAX=m +# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set +# CONFIG_TOUCHSCREEN_EXC3000 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_HIDEEP is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_S6SY761 is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_EKTF2127 is not set +# CONFIG_TOUCHSCREEN_ELAN is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +CONFIG_TOUCHSCREEN_RPI_FT5406=m +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +# CONFIG_TOUCHSCREEN_USB_PANJIT is not set +CONFIG_TOUCHSCREEN_USB_3M=y +# CONFIG_TOUCHSCREEN_USB_ITM is not set +# CONFIG_TOUCHSCREEN_USB_ETURBO is not set +# CONFIG_TOUCHSCREEN_USB_GUNZE is not set +# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set +# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set +# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set +# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set +# CONFIG_TOUCHSCREEN_USB_GOTOP is not set +# CONFIG_TOUCHSCREEN_USB_JASTEC is not set +# CONFIG_TOUCHSCREEN_USB_ELO is not set +# CONFIG_TOUCHSCREEN_USB_E2I is not set +# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set +# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set +# CONFIG_TOUCHSCREEN_USB_NEXIO is not set +# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_RM_TS is not set +# CONFIG_TOUCHSCREEN_SILEAD is not set +# CONFIG_TOUCHSCREEN_SIS_I2C is not set +CONFIG_TOUCHSCREEN_ST1232=m +# CONFIG_TOUCHSCREEN_STMFTS is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZET6223 is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_ARIZONA_HAPTICS is not set +# CONFIG_INPUT_ATMEL_CAPTOUCH is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_DECODER is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_UINPUT=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_PWM_VIBRA is not set +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +CONFIG_RMI4_CORE=y +# CONFIG_RMI4_I2C is not set +# CONFIG_RMI4_SPI is not set +# CONFIG_RMI4_SMB is not set +CONFIG_RMI4_F03=y +CONFIG_RMI4_F03_SERIO=y +CONFIG_RMI4_2D_SENSOR=y +CONFIG_RMI4_F11=y +CONFIG_RMI4_F12=y +CONFIG_RMI4_F30=y +# CONFIG_RMI4_F34 is not set +# CONFIG_RMI4_F55 is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +# CONFIG_SERIO_LIBPS2 is not set +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_SERIO_GPIO_PS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_BRCM_CHAR_DRIVERS=y +CONFIG_BCM2708_VCMEM=y +CONFIG_BCM_VCIO=y +CONFIG_BCM_VC_SM=y +CONFIG_BCM2835_DEVGPIOMEM=m +CONFIG_BCM2835_SMI_DEV=m +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +# CONFIG_SERIAL_8250_FINTEK is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_DMA is not set +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_RUNTIME_UARTS=0 +CONFIG_SERIAL_8250_EXTENDED=y +# CONFIG_SERIAL_8250_MANY_PORTS is not set +# CONFIG_SERIAL_8250_ASPEED_VUART is not set +CONFIG_SERIAL_8250_SHARE_IRQ=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_BCM2835AUX=y +CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_8250_DW is not set +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_OF_PLATFORM=y + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +CONFIG_SERIAL_DEV_BUS=m +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_BCM2835=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=m + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_GPMUX is not set +# CONFIG_I2C_MUX_LTC4306 is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +# CONFIG_I2C_DEMUX_PINCTRL is not set +# CONFIG_I2C_MUX_MLXCPLD is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# +CONFIG_I2C_BCM2708=y +CONFIG_I2C_BCM2708_BAUDRATE=100000 + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +CONFIG_I2C_BCM2835=m +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +CONFIG_I2C_GPIO=y +# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y +# CONFIG_SPI_MEM is not set + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +# CONFIG_SPI_AXI_SPI_ENGINE is not set +CONFIG_SPI_BCM2835=m +CONFIG_SPI_BCM2835AUX=m +# CONFIG_SPI_BCM_QSPI is not set +# CONFIG_SPI_BITBANG is not set +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_DESIGNWARE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_LOOPBACK_TEST is not set +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPI_SLAVE is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set +# CONFIG_PPS is not set + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_MCP23S08 is not set +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PINCTRL_SX150X is not set +CONFIG_PINCTRL_BCM2835=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_FASTPATH_LIMIT=512 +CONFIG_OF_GPIO=y +CONFIG_GPIOLIB_IRQCHIP=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +CONFIG_GPIO_RASPBERRYPI_EXP=y +CONFIG_GPIO_BCM_VIRT=y +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_FTGPIO010 is not set +# CONFIG_GPIO_GENERIC_PLATFORM is not set +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_HLWD is not set +# CONFIG_GPIO_MB86S7X is not set +# CONFIG_GPIO_MOCKUP is not set +# CONFIG_GPIO_MPC8XXX is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_TPIC2810 is not set + +# +# MFD GPIO expanders +# +CONFIG_GPIO_ARIZONA=m +# CONFIG_HTC_EGPIO is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX3191X is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set +# CONFIG_GPIO_PISOSR is not set +# CONFIG_GPIO_XRA1403 is not set + +# +# USB GPIO expanders +# +CONFIG_W1=m + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_DS2490 is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS1WM is not set +CONFIG_W1_MASTER_GPIO=m + +# +# 1-wire Slaves +# +CONFIG_W1_SLAVE_THERM=m +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_DS2405 is not set +# CONFIG_W1_SLAVE_DS2408 is not set +# CONFIG_W1_SLAVE_DS2413 is not set +# CONFIG_W1_SLAVE_DS2406 is not set +# CONFIG_W1_SLAVE_DS2423 is not set +# CONFIG_W1_SLAVE_DS2805 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2438 is not set +# CONFIG_W1_SLAVE_DS2780 is not set +# CONFIG_W1_SLAVE_DS2781 is not set +# CONFIG_W1_SLAVE_DS28E04 is not set +# CONFIG_W1_SLAVE_DS28E17 is not set +# CONFIG_POWER_AVS is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMKONA is not set +# CONFIG_POWER_RESET_BRCMSTB is not set +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_RESTART=y +# CONFIG_POWER_RESET_VERSATILE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +# CONFIG_SYSCON_REBOOT_MODE is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_CHARGER_ADP5061 is not set +# CONFIG_BATTERY_DS2760 is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_CHARGER_SBS is not set +# CONFIG_MANAGER_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_BATTERY_MAX1721X is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_LTC3651 is not set +# CONFIG_CHARGER_DETECTOR_MAX14656 is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_HWMON=y +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ASPEED is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_FTSTEUTATES is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC2990 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX31722 is not set +# CONFIG_SENSORS_MAX6621 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_TC654 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_NPCM7XX is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +CONFIG_SENSORS_RASPBERRYPI_HWMON=y +CONFIG_SENSORS_RPI_POE_FAN=m +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHT3x is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_STTS751 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_INA3221 is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP108 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83773G is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +# CONFIG_THERMAL_STATISTICS is not set +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +# CONFIG_CPU_THERMAL is not set +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_QORIQ_THERMAL is not set + +# +# ACPI INT340X thermal drivers +# + +# +# Broadcom thermal drivers +# +CONFIG_BCM2835_THERMAL=y +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WATCHDOG_NOWAYOUT is not set +CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y +# CONFIG_WATCHDOG_SYSFS is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +# CONFIG_FTWDT010_WATCHDOG is not set +# CONFIG_DW_WATCHDOG is not set +# CONFIG_MAX63XX_WATCHDOG is not set +CONFIG_BCM2835_WDT=y +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set + +# +# Watchdog Pretimeout Governors +# +# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set +CONFIG_SSB_POSSIBLE=y +CONFIG_SSB=m +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +# CONFIG_SSB_SDIOHOST is not set +# CONFIG_SSB_DRIVER_GPIO is not set +CONFIG_BCMA_POSSIBLE=y +CONFIG_BCMA=m +CONFIG_BCMA_BLOCKIO=y +# CONFIG_BCMA_HOST_SOC is not set +CONFIG_BCMA_DRIVER_GMAC_CMN=y +# CONFIG_BCMA_DRIVER_GPIO is not set +# CONFIG_BCMA_DEBUG is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_RPISENSE_CORE is not set +# CONFIG_MFD_ACT8945A is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_BD9571MWV is not set +# CONFIG_MFD_AXP20X_I2C is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_MADERA is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77620 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_CPCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_PM8XXX is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_TI_LMU is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TI_LP873X is not set +# CONFIG_MFD_TI_LP87565 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +CONFIG_MFD_ARIZONA=y +CONFIG_MFD_ARIZONA_I2C=m +CONFIG_MFD_ARIZONA_SPI=m +# CONFIG_MFD_CS47L24 is not set +CONFIG_MFD_WM5102=y +# CONFIG_MFD_WM5110 is not set +# CONFIG_MFD_WM8997 is not set +# CONFIG_MFD_WM8998 is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_MFD_ROHM_BD718XX is not set +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=m +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_88PG86X is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +CONFIG_REGULATOR_ARIZONA_LDO1=m +CONFIG_REGULATOR_ARIZONA_MICSUPP=m +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_PV88060 is not set +# CONFIG_REGULATOR_PV88080 is not set +# CONFIG_REGULATOR_PV88090 is not set +# CONFIG_REGULATOR_PWM is not set +# CONFIG_REGULATOR_SY8106A is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS65132 is not set +# CONFIG_REGULATOR_TPS6524X is not set +# CONFIG_REGULATOR_VCTRL is not set +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_LIRC=y +CONFIG_RC_DECODERS=y +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_IR_IMON_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +# CONFIG_IR_HIX5HD2 is not set +CONFIG_IR_IMON=m +CONFIG_IR_IMON_RAW=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +# CONFIG_IR_SPI is not set +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_IR_GPIO_TX=m +CONFIG_IR_PWM_TX=m +# CONFIG_IR_SERIAL is not set +# CONFIG_IR_SIR is not set +CONFIG_RC_XBOX_DVD=m +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +# CONFIG_MEDIA_SDR_SUPPORT is not set +# CONFIG_MEDIA_CEC_SUPPORT is not set +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_DVB_CORE=m +# CONFIG_DVB_MMAP is not set +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=8 +# CONFIG_DVB_DYNAMIC_MINORS is not set +# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set +# CONFIG_DVB_ULE_DEBUG is not set + +# +# Media drivers +# +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_DIB3000MC=m +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_DVB_USB_ZD1301=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set + +# +# Supported MMC/SDIO adapters +# +CONFIG_SMS_SDIO_DRV=m +# CONFIG_RADIO_ADAPTERS is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_V4L2=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set + +# +# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Audio/Video compression chips +# + +# +# SDR tuner chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# + +# +# Media SPI Adapters +# +CONFIG_CXD2880_SPI_DRV=m +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA18250=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_QM1D1C0042=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m +CONFIG_DVB_MN88472=m +CONFIG_DVB_MN88473=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m +CONFIG_DVB_ZD1301_DEMOD=m +CONFIG_DVB_GP8PSK_FE=m +CONFIG_DVB_CXD2880=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# +CONFIG_DVB_TC90522=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Common Interface (EN50221) controller drivers +# +CONFIG_DVB_SP2=m + +# +# Tools to develop new frontends +# + +# +# Graphics support +# +# CONFIG_IMX_IPUV3_CORE is not set +CONFIG_DRM=y +CONFIG_DRM_MIPI_DSI=y +# CONFIG_DRM_DP_AUX_CHARDEV is not set +# CONFIG_DRM_DEBUG_MM is not set +# CONFIG_DRM_DEBUG_SELFTEST is not set +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +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_CEC is not set +CONFIG_DRM_GEM_CMA_HELPER=y +CONFIG_DRM_KMS_CMA_HELPER=y + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_I2C_NXP_TDA9950 is not set +# CONFIG_DRM_HDLCD is not set +# CONFIG_DRM_MALI_DISPLAY is not set + +# +# ACP (Audio CoProcessor) Configuration +# + +# +# AMD Library routines +# +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_VKMS is not set +# CONFIG_DRM_EXYNOS is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_ARMADA is not set +# CONFIG_DRM_RCAR_DW_HDMI is not set +# CONFIG_DRM_RCAR_LVDS is not set +# CONFIG_DRM_OMAP is not set +# CONFIG_DRM_TILCDC is not set +# CONFIG_DRM_FSL_DCU is not set +# CONFIG_DRM_STM is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +# CONFIG_DRM_PANEL_ARM_VERSATILE is not set +# CONFIG_DRM_PANEL_LVDS is not set +# CONFIG_DRM_PANEL_SIMPLE is not set +# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set +# CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set +# CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set +# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_ORISETECH_OTM8009A is not set +# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m +# CONFIG_DRM_PANEL_RAYDIUM_RM68200 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_ANALOGIX_ANX78XX is not set +# CONFIG_DRM_CDNS_DSI is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LVDS_ENCODER is not set +# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_SIL_SII8620 is not set +# CONFIG_DRM_SII902X is not set +# CONFIG_DRM_SII9234 is not set +# CONFIG_DRM_THINE_THC63LVD1024 is not set +# CONFIG_DRM_TOSHIBA_TC358767 is not set +# CONFIG_DRM_TI_TFP410 is not set +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_STI is not set +# CONFIG_DRM_V3D is not set +CONFIG_DRM_VC4=m +# CONFIG_DRM_VC4_HDMI_CEC is not set +# CONFIG_DRM_ARCPGU is not set +# CONFIG_DRM_MXSFB is not set +# CONFIG_DRM_TINYDRM is not set +# CONFIG_DRM_PL111 is not set +# CONFIG_DRM_TVE200 is not set +# CONFIG_DRM_LEGACY is not set +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +CONFIG_FB_NOTIFY=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +CONFIG_FB_BCM2708=y +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_RPISENSE is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LCD_S6E63M0 is not set +# CONFIG_LCD_LD9040 is not set +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +# CONFIG_LCD_OTM3225A is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +# CONFIG_BACKLIGHT_PWM is not set +CONFIG_BACKLIGHT_RPI=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +CONFIG_BACKLIGHT_GPIO=y +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_BACKLIGHT_ARCXCNN is not set +CONFIG_HDMI=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +CONFIG_SND=m +CONFIG_SND_TIMER=m +CONFIG_SND_PCM=m +CONFIG_SND_PCM_ELD=y +CONFIG_SND_DMAENGINE_PCM=m +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_COMPRESS_OFFLOAD=m +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_OSSEMUL is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=m +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_DRIVERS is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +CONFIG_SND_ARM=y +# CONFIG_SND_ARMAACI is not set +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_SOC=m +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +CONFIG_SND_SOC_COMPRESS=y +# CONFIG_SND_SOC_AMD_ACP is not set +# CONFIG_SND_ATMEL_SOC is not set +CONFIG_SND_BCM2835_SOC_I2S=m +CONFIG_SND_BCM2708_SOC_3DLAB_NANO_PLAYER=m +CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m +CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m +CONFIG_SND_BCM2708_SOC_RPI_CIRRUS=m +CONFIG_SND_BCM2708_SOC_RPI_DAC=m +CONFIG_SND_BCM2708_SOC_RPI_PROTO=m +CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m +CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m +CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m +CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m +CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m +CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m +CONFIG_SND_AUDIOINJECTOR_OCTO_SOUNDCARD=m +CONFIG_SND_AUDIOSENSE_PI=m +CONFIG_SND_DIGIDAC1_SOUNDCARD=m +CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m +CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2=m +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m +CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m +CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m +CONFIG_SND_BCM2708_SOC_ALLO_KATANA_DAC=m +CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m +CONFIG_SND_PISOUND=m +CONFIG_SND_RPI_SIMPLE_SOUNDCARD=m +CONFIG_SND_RPI_WM8804_SOUNDCARD=m +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +# CONFIG_SND_I2S_HI6210_I2S is not set +# CONFIG_SND_SOC_IMG is not set + +# +# STMicroelectronics STM32 SOC audio support +# +# CONFIG_SND_SOC_XTFPGA_I2S is not set +# CONFIG_ZX_TDM is not set +CONFIG_SND_SOC_I2C_AND_SPI=m + +# +# CODEC drivers +# +CONFIG_SND_SOC_ARIZONA=m +CONFIG_SND_SOC_WM_ADSP=m +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_AD193X_SPI is not set +# CONFIG_SND_SOC_AD193X_I2C is not set +CONFIG_SND_SOC_ADAU1701=m +# CONFIG_SND_SOC_ADAU1761_I2C is not set +# CONFIG_SND_SOC_ADAU1761_SPI is not set +CONFIG_SND_SOC_ADAU1977=m +CONFIG_SND_SOC_ADAU1977_I2C=m +CONFIG_SND_SOC_ADAU7002=m +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4458 is not set +CONFIG_SND_SOC_AK4554=m +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_AK5558 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_BD28623 is not set +# CONFIG_SND_SOC_BT_SCO is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS35L33 is not set +# CONFIG_SND_SOC_CS35L34 is not set +# CONFIG_SND_SOC_CS35L35 is not set +# CONFIG_SND_SOC_CS42L42 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +CONFIG_SND_SOC_CS4265=m +# CONFIG_SND_SOC_CS4270 is not set +CONFIG_SND_SOC_CS4271=m +CONFIG_SND_SOC_CS4271_I2C=m +# CONFIG_SND_SOC_CS4271_SPI is not set +CONFIG_SND_SOC_CS42XX8=m +CONFIG_SND_SOC_CS42XX8_I2C=m +# CONFIG_SND_SOC_CS43130 is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CS53L30 is not set +CONFIG_SND_SOC_DMIC=m +# CONFIG_SND_SOC_ES7134 is not set +# CONFIG_SND_SOC_ES7241 is not set +# CONFIG_SND_SOC_ES8316 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8328_SPI is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_ICS43432 is not set +# CONFIG_SND_SOC_INNO_RK3036 is not set +# CONFIG_SND_SOC_MAX98504 is not set +# CONFIG_SND_SOC_MAX9867 is not set +# CONFIG_SND_SOC_MAX98927 is not set +# CONFIG_SND_SOC_MAX98373 is not set +# CONFIG_SND_SOC_MAX9860 is not set +# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1789_I2C is not set +# CONFIG_SND_SOC_PCM179X_I2C is not set +# CONFIG_SND_SOC_PCM179X_SPI is not set +# CONFIG_SND_SOC_PCM186X_I2C is not set +# CONFIG_SND_SOC_PCM186X_SPI is not set +# CONFIG_SND_SOC_PCM3168A_I2C is not set +# CONFIG_SND_SOC_PCM3168A_SPI is not set +CONFIG_SND_SOC_PCM5102A=m +CONFIG_SND_SOC_PCM512x=m +CONFIG_SND_SOC_PCM512x_I2C=m +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RT5616 is not set +CONFIG_SND_SOC_PCM1794A=m +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_SGTL5000=m +CONFIG_SND_SOC_SIGMADSP=m +CONFIG_SND_SOC_SIGMADSP_I2C=m +CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=m +# CONFIG_SND_SOC_SSM2305 is not set +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +CONFIG_SND_SOC_STA32X=m +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TAS5720 is not set +# CONFIG_SND_SOC_TAS6424 is not set +# CONFIG_SND_SOC_TDA7419 is not set +# CONFIG_SND_SOC_TFA9879 is not set +CONFIG_SND_SOC_TAS5713=m +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +CONFIG_SND_SOC_TLV320AIC32X4=m +CONFIG_SND_SOC_TLV320AIC32X4_I2C=m +# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +# CONFIG_SND_SOC_TS3A227E is not set +# CONFIG_SND_SOC_TSCS42XX is not set +# CONFIG_SND_SOC_TSCS454 is not set +CONFIG_SND_SOC_WM5102=m +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8524 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +CONFIG_SND_SOC_WM8731=m +# CONFIG_SND_SOC_WM8737 is not set +CONFIG_SND_SOC_WM8741=m +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8782 is not set +CONFIG_SND_SOC_WM8804=m +CONFIG_SND_SOC_WM8804_I2C=m +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8960 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8974 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_WM8985 is not set +# CONFIG_SND_SOC_ZX_AUD96P22 is not set +# CONFIG_SND_SOC_MAX9759 is not set +# CONFIG_SND_SOC_MT6351 is not set +# CONFIG_SND_SOC_NAU8540 is not set +# CONFIG_SND_SOC_NAU8810 is not set +# CONFIG_SND_SOC_NAU8824 is not set +CONFIG_SND_SOC_TPA6130A2=m +CONFIG_SND_SIMPLE_CARD_UTILS=m +CONFIG_SND_SIMPLE_CARD=m +# CONFIG_SND_SIMPLE_SCU_CARD is not set +CONFIG_SND_AUDIO_GRAPH_CARD=m +# CONFIG_SND_AUDIO_GRAPH_SCU_CARD is not set + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACCUTOUCH is not set +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_ASUS=y +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_BIGBEN_FF=m +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_COUGAR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CMEDIA is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELAN is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GOOGLE_HAMMER is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +# CONFIG_HID_ITE is not set +# CONFIG_HID_JABRA is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +# CONFIG_HID_LED is not set +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +# CONFIG_HID_MAYFLASH is not set +# CONFIG_HID_REDRAGON is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTI is not set +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_OUYA=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_RETRODE is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEAM is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_UDRAW_PS3 is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_ALPS is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set +CONFIG_USB_MON=m +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +CONFIG_USB_DWCOTG=y +# CONFIG_USB_HCD_BCMA is not set +# CONFIG_USB_HCD_SSB is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +# CONFIG_USB_UAS is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +CONFIG_USB_SERIAL_CH341=m +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=m +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=m +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_F8153X is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +CONFIG_USB_SERIAL_IUU=m +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=m +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_QCAUX is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_UPD78F0730 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HUB_USB251XB is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_HSIC_USB4604 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_USB_GADGET is not set +# CONFIG_TYPEC is not set +# CONFIG_USB_ROLE_SWITCH is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_USB_ULPI_BUS is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_BCM2835_MMC=y +CONFIG_MMC_BCM2835_DMA=y +CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 +CONFIG_MMC_BCM2835_SDHOST=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_OF_DWCMSHC is not set +# CONFIG_MMC_SDHCI_CADENCE is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_SDHCI_IPROC is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_DW is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +CONFIG_MMC_REALTEK_USB=m +# CONFIG_MMC_CQHCI is not set +# CONFIG_MMC_BCM2835 is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MMC_SDHCI_XENON is not set +# CONFIG_MMC_SDHCI_OMAP is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=y +# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set + +# +# LED drivers +# +# CONFIG_LEDS_AAT1290 is not set +# CONFIG_LEDS_AS3645A is not set +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_CR0014114 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_LM3692X is not set +# CONFIG_LEDS_LM3601X is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP3952 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_IS31FL319X is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set +# CONFIG_LEDS_MLXREG is not set +# CONFIG_LEDS_USER is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +# CONFIG_LEDS_TRIGGER_ACTIVITY is not set +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=y +CONFIG_LEDS_TRIGGER_CAMERA=y +CONFIG_LEDS_TRIGGER_INPUT=y +# CONFIG_LEDS_TRIGGER_PANIC is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set +CONFIG_RTC_NVMEM=y + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +CONFIG_RTC_DRV_ABX80X=m +CONFIG_RTC_DRV_DS1307=m +# CONFIG_RTC_DRV_DS1307_CENTURY is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12026 is not set +# CONFIG_RTC_DRV_X1205 is not set +CONFIG_RTC_DRV_PCF8523=m +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF85363 is not set +CONFIG_RTC_DRV_PCF8563=m +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1302 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6916 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RX6110 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +CONFIG_RTC_DRV_DS3232=m +CONFIG_RTC_DRV_DS3232_HWMON=y +CONFIG_RTC_DRV_PCF2127=m +# CONFIG_RTC_DRV_RV3029C2 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_FTRTC010 is not set +# CONFIG_RTC_DRV_SNVS is not set +# CONFIG_RTC_DRV_R7301 is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_OF=y +# CONFIG_ALTERA_MSGDMA is not set +# CONFIG_AMBA_PL08X is not set +CONFIG_DMA_BCM2835=y +# CONFIG_DW_AXI_DMAC is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_NBPFAXI_DMA is not set +# CONFIG_PL330_DMA is not set +CONFIG_DMA_BCM2708=y +# CONFIG_QCOM_HIDMA_MGMT is not set +# CONFIG_QCOM_HIDMA is not set +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set + +# +# DMABUF options +# +CONFIG_SYNC_FILE=y +# CONFIG_SW_SYNC is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VIRT_DRIVERS is not set +# CONFIG_VIRTIO_MENU is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +CONFIG_RTL8723BS=m +CONFIG_R8712U=m +# CONFIG_R8188EU is not set +CONFIG_VT6656=m + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +CONFIG_STAGING_MEDIA=y + +# +# Android +# +# CONFIG_STAGING_BOARD is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_UNISYSSPAR is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_SDIO is not set +# CONFIG_WILC1000_SPI is not set +# CONFIG_MOST is not set +# CONFIG_KS7010 is not set +# CONFIG_GREYBUS is not set +CONFIG_BCM_VIDEOCORE=y +CONFIG_BCM2835_VCHIQ=y +CONFIG_SND_BCM2835=m +# CONFIG_VIDEO_BCM2835 is not set +# CONFIG_BCM2835_VCHIQ_MMAL is not set +# CONFIG_BCM_VC_SM_CMA is not set +# CONFIG_VIDEO_CODEC_BCM2835 is not set +# CONFIG_PI433 is not set +# CONFIG_MTK_MMC is not set + +# +# Gasket devices +# +# CONFIG_XIL_AXIS_FIFO is not set +# CONFIG_EROFS_FS is not set +# CONFIG_GOLDFISH is not set +# CONFIG_CHROME_PLATFORMS is not set +# CONFIG_MELLANOX_PLATFORM is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_CLK_HSDK is not set +# CONFIG_COMMON_CLK_MAX9485 is not set +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI544 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_VC5 is not set +# CONFIG_HWSPINLOCK is not set + +# +# Clock Source drivers +# +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_CLKSRC_MMIO=y +CONFIG_BCM2835_TIMER=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_TIMER_SP804=y +CONFIG_MAILBOX=y +# CONFIG_ARM_MHU is not set +# CONFIG_PLATFORM_MHU is not set +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set +CONFIG_BCM2835_MBOX=y +# CONFIG_MAILBOX_TEST is not set +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers +# +# CONFIG_REMOTEPROC is not set + +# +# Rpmsg drivers +# +# CONFIG_RPMSG_QCOM_GLINK_RPM is not set +# CONFIG_RPMSG_VIRTIO is not set +# CONFIG_SOUNDWIRE is not set + +# +# SOC (System On Chip) specific Drivers +# + +# +# Amlogic SoC drivers +# + +# +# Broadcom SoC drivers +# +CONFIG_RASPBERRYPI_POWER=y +# CONFIG_SOC_BRCMSTB is not set + +# +# NXP/Freescale QorIQ SoC drivers +# + +# +# i.MX SoC drivers +# + +# +# Qualcomm SoC drivers +# +# CONFIG_SOC_TI is not set + +# +# Xilinx SoC drivers +# +# CONFIG_XILINX_VCU is not set +# CONFIG_PM_DEVFREQ is not set +CONFIG_EXTCON=m + +# +# Extcon Device Drivers +# +CONFIG_EXTCON_ARIZONA=m +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_MAX3355 is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +CONFIG_PWM_BCM2835=m +# CONFIG_PWM_FSL_FTM is not set +# CONFIG_PWM_PCA9685 is not set + +# +# IRQ chip support +# +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC_MAX_NR=1 +# CONFIG_IPACK_BUS is not set +CONFIG_RESET_CONTROLLER=y +# CONFIG_RESET_TI_SYSCON is not set +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_PHY_MAPPHONE_MDM6600 is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +# CONFIG_ARM_CCI_PMU is not set +# CONFIG_ARM_CCN is not set +CONFIG_ARM_PMU=y +CONFIG_RPI_AXIPERF=m +# CONFIG_RAS is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_DAX is not set +CONFIG_NVMEM=y + +# +# HW tracing support +# +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set +# CONFIG_FPGA is not set +# CONFIG_FSI is not set +# CONFIG_TEE is not set +# CONFIG_SIOX is not set +# CONFIG_SLIMBUS is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_FS_IOMAP=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_ONLINE_SCRUB is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_BTRFS_FS_REF_VERIFY is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +# CONFIG_EXPORTFS_BLOCK_OPS is not set +CONFIG_FILE_LOCKING=y +CONFIG_MANDATORY_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +CONFIG_AUTOFS4_FS=y +CONFIG_AUTOFS_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m +# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y +# CONFIG_OVERLAY_FS_INDEX is not set +# CONFIG_OVERLAY_FS_XINO_AUTO is not set +# CONFIG_OVERLAY_FS_METACOPY is not set + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +CONFIG_MEMFD_CREATE=y +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ORANGEFS_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_FILE_CACHE is not set +CONFIG_SQUASHFS_FILE_DIRECT=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_ROOT_NFS=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS2=y +CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_FSCACHE=y +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_KEY_DH_OPERATIONS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_FORTIFY_SOURCE is not set +# CONFIG_STATIC_USERMODEHELPER is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +CONFIG_CRYPTO_KPP2=y +CONFIG_CRYPTO_KPP=m +CONFIG_CRYPTO_ACOMP2=y +CONFIG_CRYPTO_RSA=y +# CONFIG_CRYPTO_DH is not set +CONFIG_CRYPTO_ECDH=m +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=m +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_CRYPTD=m +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set +CONFIG_CRYPTO_SIMD=m + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=m +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +# CONFIG_CRYPTO_AEGIS128 is not set +# CONFIG_CRYPTO_AEGIS128L is not set +# CONFIG_CRYPTO_AEGIS256 is not set +# CONFIG_CRYPTO_MORUS640 is not set +# CONFIG_CRYPTO_MORUS1280 is not set +CONFIG_CRYPTO_SEQIV=y +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +CONFIG_CRYPTO_CBC=m +CONFIG_CRYPTO_CFB=m +CONFIG_CRYPTO_CTR=y +CONFIG_CRYPTO_CTS=m +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +# CONFIG_CRYPTO_CRCT10DIF is not set +CONFIG_CRYPTO_GHASH=m +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +# CONFIG_CRYPTO_SHA3 is not set +# CONFIG_CRYPTO_SM3 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_AES_TI is not set +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SM4 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +CONFIG_CRYPTO_LZO=m +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set +# CONFIG_CRYPTO_ZSTD is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +# CONFIG_CRYPTO_HW is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set + +# +# Certificates for signature checking +# +CONFIG_SYSTEM_TRUSTED_KEYRING=y +CONFIG_SYSTEM_TRUSTED_KEYS="" +# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set +# CONFIG_SECONDARY_TRUSTED_KEYRING is not set +# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=m +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC64 is not set +# CONFIG_CRC4 is not set +# CONFIG_CRC7 is not set +CONFIG_LIBCRC32C=m +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=m +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_COMPRESS=m +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +# CONFIG_XZ_DEC_ARM is not set +# CONFIG_XZ_DEC_ARMTHUMB is not set +# CONFIG_XZ_DEC_SPARC is not set +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SGL_ALLOC=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set +CONFIG_NLATTR=y +CONFIG_CLZ_TAB=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +# CONFIG_IRQ_POLL is not set +CONFIG_MPILIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_SG_POOL=y +CONFIG_ARCH_HAS_SG_CHAIN=y +CONFIG_SBITMAP=y +# CONFIG_STRING_SELFTEST is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_CONSOLE_LOGLEVEL_QUIET=4 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +# CONFIG_DEBUG_INFO is not set +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_PAGE_REF is not set +# CONFIG_DEBUG_RODATA_TEST is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_ARCH_HAS_KCOV=y +CONFIG_CC_HAS_SANCOV_TRACE_PC=y +# CONFIG_KCOV is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +# CONFIG_SOFTLOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +CONFIG_LOCK_DEBUGGING_SUPPORT=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_RWSEMS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_WW_MUTEX_SELFTEST is not set +CONFIG_TRACE_IRQFLAGS=y +CONFIG_STACKTRACE=y +# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_RCU_PERF_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACER_MAX_TRACE=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_RING_BUFFER_ALLOW_SWAP=y +CONFIG_PREEMPTIRQ_TRACEPOINTS=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y +# CONFIG_HWLAT_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_TRACER_SNAPSHOT=y +CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +CONFIG_STACK_TRACER=y +CONFIG_BLK_DEV_IO_TRACE=y +CONFIG_KPROBE_EVENTS=y +# CONFIG_UPROBE_EVENTS is not set +CONFIG_BPF_EVENTS=y +CONFIG_PROBE_EVENTS=y +CONFIG_DYNAMIC_FTRACE=y +CONFIG_DYNAMIC_FTRACE_WITH_REGS=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_PREEMPTIRQ_DELAY_TEST is not set +# CONFIG_TRACE_EVAL_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_RUNTIME_TESTING_MENU is not set +# CONFIG_MEMTEST is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_UBSAN is not set +CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_ARM_PTDUMP_DEBUGFS is not set +# CONFIG_DEBUG_WX is not set +# CONFIG_ARM_UNWIND is not set +CONFIG_OLD_MCOUNT=y +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_ARM_KPROBES_TEST is not set +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_CORESIGHT is not set diff --git a/projects/RPi/devices/RPi2/options b/projects/RPi/devices/RPi2/options new file mode 100644 index 0000000000..fc193853ce --- /dev/null +++ b/projects/RPi/devices/RPi2/options @@ -0,0 +1,9 @@ +################################################################################ +# Device defaults +################################################################################ + + # NOOBS supported hex versions (legacy) + NOOBS_HEX="1040,1041,2082" + + # NOOBS supported model versions + NOOBS_SUPPORTED_MODELS='"Pi 2","Pi 3"' diff --git a/projects/RPi/devices/Slice/config/distroconfig.txt b/projects/RPi/devices/Slice/config/distroconfig.txt new file mode 100644 index 0000000000..76154bfd88 --- /dev/null +++ b/projects/RPi/devices/Slice/config/distroconfig.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +# WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING! + +dtoverlay=slice +dtoverlay=ws2812 + diff --git a/projects/RPi/devices/Slice/config/slice-overlay.dts b/projects/RPi/devices/Slice/config/slice-overlay.dts new file mode 100644 index 0000000000..a13e86478e --- /dev/null +++ b/projects/RPi/devices/Slice/config/slice-overlay.dts @@ -0,0 +1,112 @@ +// Definitions for Slice hardware +/dts-v1/; +/plugin/; + +#include "dt-bindings/clock/bcm2835.h" +#include "dt-bindings/pinctrl/bcm2835.h" + +/ { + compatible = "brcm,bcm2708"; + + // disable analog audio + fragment@0 { + target = <&audio>; + __overlay__ { + status = "disabled"; + }; + }; + + // pinctrl definitions + fragment@1 { + target = <&gpio>; + __overlay__ { + // configure I2S to GPIO 28-31 + slice_i2s_pins: slice_i2s_pins { + brcm,pins = <28 29 30 31>; + brcm,function = ; + }; + slice_ir_pins: slice_ir_pins { + brcm,pins = <37>; + brcm,function = ; + brcm,pull = ; + }; + cs4265_reset_pins: cs4265_reset_pins { + brcm,pins = <33>; + brcm,function = ; + }; + }; + }; + + // IR receiver + fragment@2 { + target-path = "/"; + __overlay__ { + gpio_ir: ir-receiver { + compatible = "gpio-ir-receiver"; + pinctrl-names = "default"; + pinctrl-0 = <&slice_ir_pins>; + gpios = <&gpio 37 1>; + linux,rc-map-name = "rc-rc6-mce"; + status = "okay"; + }; + }; + }; + + // enable I2S + fragment@3 { + target = <&i2s>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&slice_i2s_pins>; + status = "okay"; + }; + }; + + // I2C + fragment@4 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_gpio44>; // use GPIO 44/45 for I2C1 + + clock-frequency = <100000>; + + pcf8523@68 { + compatible = "nxp,pcf8523"; + reg = <0x68>; + nxp,xtalcap-7pf; // set crystal load to 7pf + status = "okay"; + }; + + cs4265@4e { + #sound-dai-cells = <0>; + compatible = "cirrus,cs4265"; + reg = <0x4e>; + + pinctrl-names = "default"; + pinctrl-0 = <&cs4265_reset_pins>; + + cs4265-reset-gpios = <&gpio 33 0>; /* AUD_RST_N on GPIO33 */ + cirrus,no-s16le; // remove S16LE support to workaround I2S controller issue + status = "okay"; + }; + }; + }; + + // Audio driver + fragment@5 { + target = <&sound>; + __overlay__ { + compatible = "fiveninjas,slice"; + clocks = <&clocks BCM2835_CLOCK_GP0>; + clock-names = "gp0"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + +}; diff --git a/projects/RPi/devices/Slice/config/ws2812-overlay.dts b/projects/RPi/devices/Slice/config/ws2812-overlay.dts new file mode 100644 index 0000000000..f7d745bcab --- /dev/null +++ b/projects/RPi/devices/Slice/config/ws2812-overlay.dts @@ -0,0 +1,43 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + // disable pwm + fragment@0 { + target = <&pwm>; + __overlay__ { + status = "disabled"; + }; + }; + + fragment@1 { + target = <&soc>; + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + ws2812: ws2812 { + compatible = "rpi,ws2812"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_gpio40>; + reg = <0x7e20c000 0x100>; /* PWM */ + dmas = <&dma 5>; + dma-names = "pwm_dma"; + led-en-gpios = <&gpio 43 0>; + + rpi,invert = <1>; + rpi,num_leds = <25>; + + status = "okay"; + + }; + }; + }; + + __overrides__ { + invert = <&ws2812>,"rpi,invert:0"; + num_leds = <&ws2812>,"rpi,num_leds:0"; + }; +}; diff --git a/projects/RPi/devices/Slice/filesystem/usr/config/autostart.sh b/projects/RPi/devices/Slice/filesystem/usr/config/autostart.sh new file mode 100644 index 0000000000..0b6166972b --- /dev/null +++ b/projects/RPi/devices/Slice/filesystem/usr/config/autostart.sh @@ -0,0 +1,2 @@ +#!/bin/bash +hdparm -S60 /dev/sda diff --git a/projects/RPi/devices/Slice/filesystem/usr/config/shutdown.sh b/projects/RPi/devices/Slice/filesystem/usr/config/shutdown.sh new file mode 100644 index 0000000000..2c597f1186 --- /dev/null +++ b/projects/RPi/devices/Slice/filesystem/usr/config/shutdown.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +LEDDIR="/usr/share/kodi/addons/service.slice/resources/media/ledpatterns" + +case "$1" in + halt) + hdparm -y /dev/sda + led_png $LEDDIR/shutdown.png + ;; + poweroff) + hdparm -y /dev/sda + led_png $LEDDIR/shutdown.png + ;; + reboot) + led_png $LEDDIR/shutdown.png + ;; + *) + ;; +esac diff --git a/projects/RPi/devices/Slice/filesystem/usr/share/alsa/cards/snd_slice.conf b/projects/RPi/devices/Slice/filesystem/usr/share/alsa/cards/snd_slice.conf new file mode 100644 index 0000000000..298f43d8e7 --- /dev/null +++ b/projects/RPi/devices/Slice/filesystem/usr/share/alsa/cards/snd_slice.conf @@ -0,0 +1,25 @@ + + +snd_slice.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string + } + @args.AES0 { + type integer + } + @args.AES1 { + type integer + } + @args.AES2 { + type integer + } + @args.AES3 { + type integer + } + type hooks + slave.pcm { + type hw + card $CARD + } +} diff --git a/projects/RPi/devices/Slice/linux b/projects/RPi/devices/Slice/linux new file mode 120000 index 0000000000..588bc44b88 --- /dev/null +++ b/projects/RPi/devices/Slice/linux @@ -0,0 +1 @@ +../RPi/linux \ No newline at end of file diff --git a/projects/RPi/devices/Slice/options b/projects/RPi/devices/Slice/options new file mode 100644 index 0000000000..be9ad09866 --- /dev/null +++ b/projects/RPi/devices/Slice/options @@ -0,0 +1,18 @@ +################################################################################ +# Device defaults +################################################################################ + + # Additional kernel make parameters + KERNEL_MAKE_EXTRACMD+=" overlays/slice.dtbo overlays/ws2812.dtbo" + + # NOOBS supported hex versions (legacy) + NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093" + + # NOOBS supported model versions + NOOBS_SUPPORTED_MODELS='"Pi Model","Pi Compute Module","Pi Zero"' + + # Additional Firmware + FIRMWARE="${FIRMWARE} slice-firmware" + + # Additional drivers + ADDITIONAL_DRIVERS="${ADDITIONAL_DRIVERS} slice-drivers" diff --git a/projects/RPi/devices/Slice/patches/kodi/kodi-004-keyboard.patch b/projects/RPi/devices/Slice/patches/kodi/kodi-004-keyboard.patch new file mode 100644 index 0000000000..d5434ebf74 --- /dev/null +++ b/projects/RPi/devices/Slice/patches/kodi/kodi-004-keyboard.patch @@ -0,0 +1,45 @@ +--- a/system/keymaps/keyboard.xml 2016-09-17 16:35:20.000000000 +0100 ++++ b/system/keymaps/keyboard.xml 2016-10-01 19:31:07.928719606 +0100 +@@ -56,7 +56,7 @@ + Menu + ContextMenu + Menu +- Pause ++ PlayPause + Stop + SkipNext + SkipPrevious +@@ -321,8 +321,8 @@ + NextSubtitle + StepBack + StepForward +- ChapterOrBigStepForward +- ChapterOrBigStepBack ++ VolumeUp ++ VolumeDown + AudioNextLanguage + NextSubtitle + AudioDelay +@@ -425,8 +425,8 @@ + StepForward + Rewind + FastForward +- SkipNext +- SkipPrevious ++ VolumeUp ++ VolumeDown + PlayerProcessInfo + LockPreset + FullScreen +@@ -632,8 +632,8 @@ + + StepBack + StepForward +- Up +- Down ++ VolumeUp ++ VolumeDown + OSD + OSD + ActivateWindow(PVROSDChannels) + diff --git a/projects/RPi/devices/Slice/patches/linux/linux-04-rtc-pcf8523-c.patch b/projects/RPi/devices/Slice/patches/linux/linux-04-rtc-pcf8523-c.patch new file mode 100644 index 0000000000..da7593ed7e --- /dev/null +++ b/projects/RPi/devices/Slice/patches/linux/linux-04-rtc-pcf8523-c.patch @@ -0,0 +1,17 @@ +--- a/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:16:30.259771931 +0100 ++++ b/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:21:29.762638800 +0100 +@@ -291,7 +291,13 @@ static int pcf8523_probe(struct i2c_clie + if (!pcf) + return -ENOMEM; + +- err = pcf8523_select_capacitance(client, true); ++ if (of_property_read_bool(client->dev.of_node, "nxp,xtalcap-7pf")) { ++ printk(KERN_ERR "PCF8523 - set 7pF crystal load"); ++ err = pcf8523_select_capacitance(client, false); ++ } else { ++ printk(KERN_ERR "PCF8523 - set 12pF crystal load"); ++ err = pcf8523_select_capacitance(client, true); ++ } + if (err < 0) + return err; + diff --git a/projects/RPi/devices/Slice/patches/linux/linux-05-cs4265-c.patch b/projects/RPi/devices/Slice/patches/linux/linux-05-cs4265-c.patch new file mode 100644 index 0000000000..b3221302bd --- /dev/null +++ b/projects/RPi/devices/Slice/patches/linux/linux-05-cs4265-c.patch @@ -0,0 +1,11 @@ +--- linux-4.4-rc7-old/sound/soc/codecs/cs4265.c 2016-01-13 20:56:05.637652775 +0000 ++++ linux-4.4-rc7/sound/soc/codecs/cs4265.c 2016-01-17 11:21:16.977652775 +0000 +@@ -199,8 +199,6 @@ + SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_IN("DIN2", NULL, 0, + SND_SOC_NOPM, 0, 0), +- SND_SOC_DAPM_AIF_IN("TXIN", NULL, 0, +- CS4265_SPDIF_CTL2, 5, 1), + + SND_SOC_DAPM_OUTPUT("LINEOUTL"), + SND_SOC_DAPM_OUTPUT("LINEOUTR"), diff --git a/projects/RPi/devices/Slice/patches/linux/linux-999.99-slice-mmc-aliases.patch b/projects/RPi/devices/Slice/patches/linux/linux-999.99-slice-mmc-aliases.patch new file mode 100644 index 0000000000..1cd9d151c5 --- /dev/null +++ b/projects/RPi/devices/Slice/patches/linux/linux-999.99-slice-mmc-aliases.patch @@ -0,0 +1,20 @@ +--- a/arch/arm/boot/dts/bcm2708-rpi.dtsi 2017-11-18 04:56:28.149405247 +0000 ++++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi 2017-11-18 05:35:40.265159491 +0000 +@@ -21,7 +21,7 @@ + gpio = &gpio; + uart0 = &uart0; + sdhost = &sdhost; +- mmc0 = &sdhost; ++ mmc1 = &sdhost; + i2s = &i2s; + spi0 = &spi0; + i2c0 = &i2c0; +@@ -29,7 +29,7 @@ + spi1 = &spi1; + spi2 = &spi2; + mmc = &mmc; +- mmc1 = &mmc; ++ mmc0 = &mmc; + i2c1 = &i2c1; + i2c2 = &i2c2; + usb = &usb; diff --git a/projects/RPi/devices/Slice3/config/distroconfig.txt b/projects/RPi/devices/Slice3/config/distroconfig.txt new file mode 100644 index 0000000000..43790a6683 --- /dev/null +++ b/projects/RPi/devices/Slice3/config/distroconfig.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +# WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING! + +dtoverlay=slice +dtoverlay=ws2812 +dtoverlay=mmc diff --git a/projects/RPi/devices/Slice3/config/slice-overlay.dts b/projects/RPi/devices/Slice3/config/slice-overlay.dts new file mode 100644 index 0000000000..a13e86478e --- /dev/null +++ b/projects/RPi/devices/Slice3/config/slice-overlay.dts @@ -0,0 +1,112 @@ +// Definitions for Slice hardware +/dts-v1/; +/plugin/; + +#include "dt-bindings/clock/bcm2835.h" +#include "dt-bindings/pinctrl/bcm2835.h" + +/ { + compatible = "brcm,bcm2708"; + + // disable analog audio + fragment@0 { + target = <&audio>; + __overlay__ { + status = "disabled"; + }; + }; + + // pinctrl definitions + fragment@1 { + target = <&gpio>; + __overlay__ { + // configure I2S to GPIO 28-31 + slice_i2s_pins: slice_i2s_pins { + brcm,pins = <28 29 30 31>; + brcm,function = ; + }; + slice_ir_pins: slice_ir_pins { + brcm,pins = <37>; + brcm,function = ; + brcm,pull = ; + }; + cs4265_reset_pins: cs4265_reset_pins { + brcm,pins = <33>; + brcm,function = ; + }; + }; + }; + + // IR receiver + fragment@2 { + target-path = "/"; + __overlay__ { + gpio_ir: ir-receiver { + compatible = "gpio-ir-receiver"; + pinctrl-names = "default"; + pinctrl-0 = <&slice_ir_pins>; + gpios = <&gpio 37 1>; + linux,rc-map-name = "rc-rc6-mce"; + status = "okay"; + }; + }; + }; + + // enable I2S + fragment@3 { + target = <&i2s>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&slice_i2s_pins>; + status = "okay"; + }; + }; + + // I2C + fragment@4 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_gpio44>; // use GPIO 44/45 for I2C1 + + clock-frequency = <100000>; + + pcf8523@68 { + compatible = "nxp,pcf8523"; + reg = <0x68>; + nxp,xtalcap-7pf; // set crystal load to 7pf + status = "okay"; + }; + + cs4265@4e { + #sound-dai-cells = <0>; + compatible = "cirrus,cs4265"; + reg = <0x4e>; + + pinctrl-names = "default"; + pinctrl-0 = <&cs4265_reset_pins>; + + cs4265-reset-gpios = <&gpio 33 0>; /* AUD_RST_N on GPIO33 */ + cirrus,no-s16le; // remove S16LE support to workaround I2S controller issue + status = "okay"; + }; + }; + }; + + // Audio driver + fragment@5 { + target = <&sound>; + __overlay__ { + compatible = "fiveninjas,slice"; + clocks = <&clocks BCM2835_CLOCK_GP0>; + clock-names = "gp0"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + +}; diff --git a/projects/RPi/devices/Slice3/config/ws2812-overlay.dts b/projects/RPi/devices/Slice3/config/ws2812-overlay.dts new file mode 100644 index 0000000000..f7d745bcab --- /dev/null +++ b/projects/RPi/devices/Slice3/config/ws2812-overlay.dts @@ -0,0 +1,43 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + // disable pwm + fragment@0 { + target = <&pwm>; + __overlay__ { + status = "disabled"; + }; + }; + + fragment@1 { + target = <&soc>; + __overlay__ { + #address-cells = <1>; + #size-cells = <1>; + + ws2812: ws2812 { + compatible = "rpi,ws2812"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_gpio40>; + reg = <0x7e20c000 0x100>; /* PWM */ + dmas = <&dma 5>; + dma-names = "pwm_dma"; + led-en-gpios = <&gpio 43 0>; + + rpi,invert = <1>; + rpi,num_leds = <25>; + + status = "okay"; + + }; + }; + }; + + __overrides__ { + invert = <&ws2812>,"rpi,invert:0"; + num_leds = <&ws2812>,"rpi,num_leds:0"; + }; +}; diff --git a/projects/RPi/devices/Slice3/filesystem/usr/config/autostart.sh b/projects/RPi/devices/Slice3/filesystem/usr/config/autostart.sh new file mode 100644 index 0000000000..0b6166972b --- /dev/null +++ b/projects/RPi/devices/Slice3/filesystem/usr/config/autostart.sh @@ -0,0 +1,2 @@ +#!/bin/bash +hdparm -S60 /dev/sda diff --git a/projects/RPi/devices/Slice3/filesystem/usr/config/shutdown.sh b/projects/RPi/devices/Slice3/filesystem/usr/config/shutdown.sh new file mode 100644 index 0000000000..2c597f1186 --- /dev/null +++ b/projects/RPi/devices/Slice3/filesystem/usr/config/shutdown.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +LEDDIR="/usr/share/kodi/addons/service.slice/resources/media/ledpatterns" + +case "$1" in + halt) + hdparm -y /dev/sda + led_png $LEDDIR/shutdown.png + ;; + poweroff) + hdparm -y /dev/sda + led_png $LEDDIR/shutdown.png + ;; + reboot) + led_png $LEDDIR/shutdown.png + ;; + *) + ;; +esac diff --git a/projects/RPi/devices/Slice3/filesystem/usr/share/alsa/cards/snd_slice.conf b/projects/RPi/devices/Slice3/filesystem/usr/share/alsa/cards/snd_slice.conf new file mode 100644 index 0000000000..298f43d8e7 --- /dev/null +++ b/projects/RPi/devices/Slice3/filesystem/usr/share/alsa/cards/snd_slice.conf @@ -0,0 +1,25 @@ + + +snd_slice.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string + } + @args.AES0 { + type integer + } + @args.AES1 { + type integer + } + @args.AES2 { + type integer + } + @args.AES3 { + type integer + } + type hooks + slave.pcm { + type hw + card $CARD + } +} diff --git a/projects/RPi/devices/Slice3/linux b/projects/RPi/devices/Slice3/linux new file mode 120000 index 0000000000..e48fcfd9f8 --- /dev/null +++ b/projects/RPi/devices/Slice3/linux @@ -0,0 +1 @@ +../RPi2/linux \ No newline at end of file diff --git a/projects/RPi/devices/Slice3/options b/projects/RPi/devices/Slice3/options new file mode 100644 index 0000000000..fdc7c920e9 --- /dev/null +++ b/projects/RPi/devices/Slice3/options @@ -0,0 +1,18 @@ +################################################################################ +# Device defaults +################################################################################ + + # Additional kernel make parameters + KERNEL_MAKE_EXTRACMD+=" overlays/slice.dtbo overlays/ws2812.dtbo" + + # NOOBS supported hex versions (legacy) + NOOBS_HEX="1040,1041,2082" + + # NOOBS supported model versions + NOOBS_SUPPORTED_MODELS='"Pi 2","Pi 3"' + + # Additional Firmware + FIRMWARE="${FIRMWARE} slice-firmware" + + # Additional drivers + ADDITIONAL_DRIVERS="${ADDITIONAL_DRIVERS} slice-drivers" diff --git a/projects/RPi/devices/Slice3/patches/kodi/kodi-004-keyboard.patch b/projects/RPi/devices/Slice3/patches/kodi/kodi-004-keyboard.patch new file mode 100644 index 0000000000..d5434ebf74 --- /dev/null +++ b/projects/RPi/devices/Slice3/patches/kodi/kodi-004-keyboard.patch @@ -0,0 +1,45 @@ +--- a/system/keymaps/keyboard.xml 2016-09-17 16:35:20.000000000 +0100 ++++ b/system/keymaps/keyboard.xml 2016-10-01 19:31:07.928719606 +0100 +@@ -56,7 +56,7 @@ + Menu + ContextMenu + Menu +- Pause ++ PlayPause + Stop + SkipNext + SkipPrevious +@@ -321,8 +321,8 @@ + NextSubtitle + StepBack + StepForward +- ChapterOrBigStepForward +- ChapterOrBigStepBack ++ VolumeUp ++ VolumeDown + AudioNextLanguage + NextSubtitle + AudioDelay +@@ -425,8 +425,8 @@ + StepForward + Rewind + FastForward +- SkipNext +- SkipPrevious ++ VolumeUp ++ VolumeDown + PlayerProcessInfo + LockPreset + FullScreen +@@ -632,8 +632,8 @@ + + StepBack + StepForward +- Up +- Down ++ VolumeUp ++ VolumeDown + OSD + OSD + ActivateWindow(PVROSDChannels) + diff --git a/projects/RPi/devices/Slice3/patches/linux/linux-04-rtc-pcf8523-c.patch b/projects/RPi/devices/Slice3/patches/linux/linux-04-rtc-pcf8523-c.patch new file mode 100644 index 0000000000..da7593ed7e --- /dev/null +++ b/projects/RPi/devices/Slice3/patches/linux/linux-04-rtc-pcf8523-c.patch @@ -0,0 +1,17 @@ +--- a/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:16:30.259771931 +0100 ++++ b/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:21:29.762638800 +0100 +@@ -291,7 +291,13 @@ static int pcf8523_probe(struct i2c_clie + if (!pcf) + return -ENOMEM; + +- err = pcf8523_select_capacitance(client, true); ++ if (of_property_read_bool(client->dev.of_node, "nxp,xtalcap-7pf")) { ++ printk(KERN_ERR "PCF8523 - set 7pF crystal load"); ++ err = pcf8523_select_capacitance(client, false); ++ } else { ++ printk(KERN_ERR "PCF8523 - set 12pF crystal load"); ++ err = pcf8523_select_capacitance(client, true); ++ } + if (err < 0) + return err; + diff --git a/projects/RPi/devices/Slice3/patches/linux/linux-05-cs4265-c.patch b/projects/RPi/devices/Slice3/patches/linux/linux-05-cs4265-c.patch new file mode 100644 index 0000000000..b3221302bd --- /dev/null +++ b/projects/RPi/devices/Slice3/patches/linux/linux-05-cs4265-c.patch @@ -0,0 +1,11 @@ +--- linux-4.4-rc7-old/sound/soc/codecs/cs4265.c 2016-01-13 20:56:05.637652775 +0000 ++++ linux-4.4-rc7/sound/soc/codecs/cs4265.c 2016-01-17 11:21:16.977652775 +0000 +@@ -199,8 +199,6 @@ + SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_IN("DIN2", NULL, 0, + SND_SOC_NOPM, 0, 0), +- SND_SOC_DAPM_AIF_IN("TXIN", NULL, 0, +- CS4265_SPDIF_CTL2, 5, 1), + + SND_SOC_DAPM_OUTPUT("LINEOUTL"), + SND_SOC_DAPM_OUTPUT("LINEOUTR"), diff --git a/projects/RPi/devices/Slice3/patches/linux/linux-999.99-slice-mmc-aliases.patch b/projects/RPi/devices/Slice3/patches/linux/linux-999.99-slice-mmc-aliases.patch new file mode 100644 index 0000000000..1cd9d151c5 --- /dev/null +++ b/projects/RPi/devices/Slice3/patches/linux/linux-999.99-slice-mmc-aliases.patch @@ -0,0 +1,20 @@ +--- a/arch/arm/boot/dts/bcm2708-rpi.dtsi 2017-11-18 04:56:28.149405247 +0000 ++++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi 2017-11-18 05:35:40.265159491 +0000 +@@ -21,7 +21,7 @@ + gpio = &gpio; + uart0 = &uart0; + sdhost = &sdhost; +- mmc0 = &sdhost; ++ mmc1 = &sdhost; + i2s = &i2s; + spi0 = &spi0; + i2c0 = &i2c0; +@@ -29,7 +29,7 @@ + spi1 = &spi1; + spi2 = &spi2; + mmc = &mmc; +- mmc1 = &mmc; ++ mmc0 = &mmc; + i2c1 = &i2c1; + i2c2 = &i2c2; + usb = &usb; diff --git a/projects/RPi/filesystem/usr/bin/cputemp b/projects/RPi/filesystem/usr/bin/cputemp new file mode 100755 index 0000000000..11535271c5 --- /dev/null +++ b/projects/RPi/filesystem/usr/bin/cputemp @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" +echo "$(( $TEMP / 1000 )) C" diff --git a/projects/RPi/filesystem/usr/bin/gputemp b/projects/RPi/filesystem/usr/bin/gputemp new file mode 120000 index 0000000000..6476b954d2 --- /dev/null +++ b/projects/RPi/filesystem/usr/bin/gputemp @@ -0,0 +1 @@ +cputemp \ No newline at end of file diff --git a/projects/RPi/filesystem/usr/share/alsa/cards/HifiberryDigi.conf b/projects/RPi/filesystem/usr/share/alsa/cards/HifiberryDigi.conf deleted file mode 100644 index a277314988..0000000000 --- a/projects/RPi/filesystem/usr/share/alsa/cards/HifiberryDigi.conf +++ /dev/null @@ -1,24 +0,0 @@ - -HifiberryDigi.pcm.iec958.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string - } - @args.AES0 { - type integer - } - @args.AES1 { - type integer - } - @args.AES2 { - type integer - } - @args.AES3 { - type integer - } - type hooks - slave.pcm { - type hw - card $CARD - } -} diff --git a/projects/RPi/filesystem/usr/share/alsa/cards/JustBoomDigi.conf b/projects/RPi/filesystem/usr/share/alsa/cards/JustBoomDigi.conf deleted file mode 100644 index f598c680b2..0000000000 --- a/projects/RPi/filesystem/usr/share/alsa/cards/JustBoomDigi.conf +++ /dev/null @@ -1,24 +0,0 @@ - -JustBoomDigi.pcm.iec958.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string - } - @args.AES0 { - type integer - } - @args.AES1 { - type integer - } - @args.AES2 { - type integer - } - @args.AES3 { - type integer - } - type hooks - slave.pcm { - type hw - card $CARD - } -} diff --git a/projects/RPi/filesystem/usr/share/alsa/cards/RPi-WM8804.conf b/projects/RPi/filesystem/usr/share/alsa/cards/RPi-WM8804.conf new file mode 100644 index 0000000000..9a01e28ce0 --- /dev/null +++ b/projects/RPi/filesystem/usr/share/alsa/cards/RPi-WM8804.conf @@ -0,0 +1,24 @@ + +RPi-WM8804.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { + type string + } + @args.AES0 { + type integer + } + @args.AES1 { + type integer + } + @args.AES2 { + type integer + } + @args.AES3 { + type integer + } + type hooks + slave.pcm { + type hw + card $CARD + } +} diff --git a/projects/RPi/initramfs/platform_init b/projects/RPi/initramfs/platform_init index e3e2e7d50a..b44e1dcfd4 100755 --- a/projects/RPi/initramfs/platform_init +++ b/projects/RPi/initramfs/platform_init @@ -1,22 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) # Enable io_is_busy for improved sdhost performance - essentially, equivalent of force_turbo=1 but for mmc echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy diff --git a/projects/RPi/kodi/advancedsettings.xml b/projects/RPi/kodi/advancedsettings.xml index ad35244823..34d27842b4 100644 --- a/projects/RPi/kodi/advancedsettings.xml +++ b/projects/RPi/kodi/advancedsettings.xml @@ -1,11 +1,4 @@ - - false - 720 540 - - - 30 - diff --git a/projects/RPi/linux/linux.arm.conf b/projects/RPi/linux/linux.arm.conf deleted file mode 100644 index 457a6a35bf..0000000000 --- a/projects/RPi/linux/linux.arm.conf +++ /dev/null @@ -1,4170 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm 4.9.1 Kernel Configuration -# -CONFIG_ARM=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_FIQ=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_GENERIC_BUG=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_BROKEN_ON_SMP=y -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_XZ is not set -# CONFIG_KERNEL_LZO is not set -# CONFIG_KERNEL_LZ4 is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_FHANDLE=y -# CONFIG_USELIB is not set -# CONFIG_AUDIT is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -CONFIG_HANDLE_DOMAIN_IRQ=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_GENERIC_CLOCKEVENTS=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TINY_RCU=y -# CONFIG_RCU_EXPERT is not set -CONFIG_SRCU=y -# CONFIG_TASKS_RCU is not set -# CONFIG_RCU_STALL_COMMON is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_BUILD_BIN2C=y -CONFIG_IKCONFIG=m -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_NMI_LOG_BUF_SHIFT=13 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -CONFIG_PAGE_COUNTER=y -CONFIG_MEMCG=y -# CONFIG_MEMCG_SWAP is not set -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -CONFIG_CGROUP_WRITEBACK=y -CONFIG_CGROUP_SCHED=y -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_RT_GROUP_SCHED is not set -# CONFIG_CGROUP_PIDS is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_CPUACCT=y -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -# CONFIG_USER_NS is not set -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SYSFS_DEPRECATED is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_LZ4 is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_BPF=y -CONFIG_EXPERT=y -# CONFIG_UID16 is not set -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SYSFS_SYSCALL is not set -CONFIG_SYSCTL_SYSCALL=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set -CONFIG_KALLSYMS_BASE_RELATIVE=y -CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -# CONFIG_BPF_SYSCALL is not set -CONFIG_SHMEM=y -# CONFIG_AIO is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_USERFAULTFD is not set -CONFIG_MEMBARRIER=y -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -# CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -# CONFIG_SLAB_FREELIST_RANDOM is not set -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -# CONFIG_PROFILING is not set -CONFIG_HAVE_OPROFILE=y -# CONFIG_KPROBES is not set -CONFIG_JUMP_LABEL=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -# CONFIG_UPROBES is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_NMI=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_GCC_PLUGINS=y -# CONFIG_GCC_PLUGINS is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_BITS_MAX=15 -CONFIG_ARCH_MMAP_RND_BITS=8 -# CONFIG_HAVE_ARCH_HASH is not set -# CONFIG_ISA_BUS_API is not set -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OLD_SIGACTION=y -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -# CONFIG_HAVE_ARCH_VMAP_STACK is not set - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_BLOCK=y -CONFIG_LBDAF=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -# CONFIG_DEFAULT_DEADLINE is not set -# CONFIG_DEFAULT_CFQ is not set -CONFIG_DEFAULT_NOOP=y -CONFIG_DEFAULT_IOSCHED="noop" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_FREEZER=y - -# -# System Type -# -CONFIG_MMU=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_OMAP1 is not set - -# -# Multiple platform selection -# - -# -# CPU Core family selection -# -CONFIG_ARCH_MULTI_V6=y -# CONFIG_ARCH_MULTI_V7 is not set -CONFIG_ARCH_MULTI_V6_V7=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -CONFIG_ARCH_BCM=y - -# -# IPROC architected SoCs -# - -# -# KONA architected SoCs -# - -# -# Other Architectures -# -CONFIG_ARCH_BCM2835=y -CONFIG_BCM2835_FAST_MEMCPY=y -# CONFIG_ARCH_CNS3XXX is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_ASPEED is not set -# CONFIG_ARCH_MXC is not set - -# -# TI OMAP/AM/DM/DRA Family -# -# CONFIG_ARCH_OMAP2 is not set -# CONFIG_ARCH_PICOXCELL is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_WM8750 is not set - -# -# Processor Type -# -CONFIG_CPU_V6K=y -CONFIG_CPU_32v6=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_ABRT_EV6=y -CONFIG_CPU_PABRT_V6=y -CONFIG_CPU_CACHE_V6=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_TLB_V6=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y - -# -# Processor Features -# -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARM_THUMB=y -# CONFIG_CPU_ICACHE_DISABLE is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_KUSER_HELPERS=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -# CONFIG_CACHE_L2X0 is not set -CONFIG_ARM_L1_CACHE_SHIFT=5 -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_DEBUG_RODATA is not set -CONFIG_MULTI_IRQ_HANDLER=y -CONFIG_ARM_ERRATA_411920=y - -# -# Bus support -# -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS_GENERIC is not set -# CONFIG_PCI_SYSCALL is not set -# CONFIG_PCCARD is not set - -# -# Kernel Features -# -# CONFIG_VMSPLIT_3G is not set -# CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VMSPLIT_2G=y -# CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0x80000000 -CONFIG_ARCH_NR_GPIO=0 -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -CONFIG_HZ_FIXED=0 -# CONFIG_HZ_100 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_250 is not set -CONFIG_HZ_300=y -# CONFIG_HZ_500 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=300 -CONFIG_SCHED_HRTICK=y -CONFIG_AEABI=y -# CONFIG_OABI_COMPAT is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -CONFIG_HAVE_ARCH_PFN_VALID=y -# CONFIG_HIGHMEM is not set -# CONFIG_CPU_SW_DOMAIN_PAN is not set -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -# CONFIG_ARM_MODULE_PLTS is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -# CONFIG_PHYS_ADDR_T_64BIT is not set -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_NEED_PER_CPU_KM=y -CONFIG_CLEANCACHE=y -CONFIG_FRONTSWAP=y -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZSWAP is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -# CONFIG_ZSMALLOC is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_ALIGNMENT_TRAP=y -CONFIG_UACCESS_WITH_MEMCPY=y -# CONFIG_SECCOMP is not set -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -# CONFIG_PARAVIRT is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set - -# -# Boot options -# -CONFIG_USE_OF=y -CONFIG_ATAGS=y -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -# CONFIG_ARM_APPENDED_DTB is not set -CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init BOOT_IMAGE=/kernel.img usbcore.autosuspend=-1" -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_CMDLINE_EXTEND=y -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -CONFIG_AUTO_ZRELADDR=y -# CONFIG_EFI is not set - -# -# CPU Power Management -# - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set - -# -# CPU frequency scaling drivers -# -# CONFIG_CPUFREQ_DT is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_ARM_BCM2835_CPUFREQ=y -# CONFIG_QORIQ_CPUFREQ is not set - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y - -# -# ARM CPU Idle Drivers -# -# CONFIG_ARM_CPUIDLE is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_VFP=y - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_ELFCORE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_BINFMT_FLAT is not set -# CONFIG_HAVE_AOUT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y - -# -# Power management options -# -# CONFIG_SUSPEND is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -# CONFIG_APM_EMULATION is not set -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -# CONFIG_ARM_CPU_SUSPEND is not set -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_NET_UDP_TUNNEL is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NET_PTP_CLASSIFY is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=m - -# -# Core Netfilter Configuration -# -# CONFIG_NETFILTER_INGRESS is not set -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_NAT_REDIRECT is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -CONFIG_NETFILTER_XT_NAT=m -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -# CONFIG_NF_DUP_IPV4 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -CONFIG_NF_REJECT_IPV4=m -CONFIG_NF_NAT_IPV4=m -CONFIG_NF_NAT_MASQUERADE_IPV4=m -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -# CONFIG_NF_DUP_IPV6 is not set -CONFIG_NF_REJECT_IPV6=m -# CONFIG_NF_LOG_IPV6 is not set -CONFIG_NF_NAT_IPV6=m -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_RAW is not set -CONFIG_IP6_NF_NAT=m -# CONFIG_IP6_NF_TARGET_MASQUERADE is not set -# CONFIG_IP6_NF_TARGET_NPT is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_MPLS is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_NET_NCSI is not set -# CONFIG_SOCK_CGROUP_DATA is not set -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_BREDR=y -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=m -CONFIG_BT_HS=y -CONFIG_BT_LE=y -# CONFIG_BT_LEDS is not set -# CONFIG_BT_SELFTEST is not set -# CONFIG_BT_DEBUGFS is not set - -# -# Bluetooth device drivers -# -CONFIG_BT_INTEL=m -CONFIG_BT_BCM=m -CONFIG_BT_RTL=m -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTUSB_BCM=y -CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_BCSP is not set -# CONFIG_BT_HCIUART_ATH3K is not set -# CONFIG_BT_HCIUART_LL is not set -CONFIG_BT_HCIUART_3WIRE=y -# CONFIG_BT_HCIUART_INTEL is not set -CONFIG_BT_HCIUART_BCM=y -# CONFIG_BT_HCIUART_QCA is not set -# CONFIG_BT_HCIUART_AG6XX is not set -# CONFIG_BT_HCIUART_MRVL is not set -CONFIG_BT_HCIBCM203X=m -# CONFIG_BT_HCIBPA10X is not set -CONFIG_BT_HCIBFUSB=m -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_MRVL is not set -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_KCM is not set -# CONFIG_STREAM_PARSER is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_INTERNAL_REGDB=y -# CONFIG_CFG80211_CRDA_SUPPORT is not set -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_MINSTREL_VHT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set -CONFIG_RFKILL=m -CONFIG_RFKILL_LEDS=y -CONFIG_RFKILL_INPUT=y -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -# CONFIG_LWTUNNEL is not set -CONFIG_DST_CACHE=y -# CONFIG_NET_DEVLINK is not set -CONFIG_MAY_USE_DEVLINK=y -CONFIG_HAVE_CBPF_JIT=y - -# -# Device Drivers -# -CONFIG_ARM_AMBA=y - -# -# Generic Driver Options -# -# CONFIG_UEVENT_HELPER is not set -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -# CONFIG_ALLOW_DEV_COREDUMP is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=m -CONFIG_REGMAP_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_FENCE_TRACE is not set -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=5 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -# CONFIG_BRCMSTB_GISB_ARB is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_CONNECTOR is not set -# CONFIG_MTD is not set -CONFIG_DTC=y -CONFIG_OF=y -# CONFIG_OF_UNITTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_DYNAMIC=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OF_RESOLVE=y -CONFIG_OF_OVERLAY=y -CONFIG_OF_CONFIGFS=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_MG_DISK is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_NVME_TARGET is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -CONFIG_BCM2835_SMI=m -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Bus Driver -# - -# -# SCIF Bus Driver -# - -# -# VOP Bus Driver -# - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# - -# -# VOP Driver -# -# CONFIG_ECHO is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -# CONFIG_ATA is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_TEAM is not set -CONFIG_MACVLAN=m -# CONFIG_MACVTAP is not set -# CONFIG_VXLAN is not set -# CONFIG_MACSEC is not set -CONFIG_NETCONSOLE=y -# CONFIG_NETCONSOLE_DYNAMIC is not set -CONFIG_NETPOLL=y -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -# CONFIG_TUN_VNET_CROSS_LE is not set -CONFIG_VETH=m -# CONFIG_NLMON is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_ETHERNET is not set -CONFIG_PHYLIB=y -CONFIG_SWPHY=y - -# -# MDIO bus device drivers -# -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MDIO_HISI_FEMAC is not set - -# -# MII PHY device drivers -# -# CONFIG_AMD_PHY is not set -# CONFIG_AQUANTIA_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -CONFIG_FIXED_PHY=y -# CONFIG_ICPLUS_PHY is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_XILINX_GMII2RGMII is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=m -CONFIG_USB_NET_DRIVERS=y -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -# CONFIG_USB_LAN78XX is not set -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=m -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=y -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -CONFIG_USB_HSO=m -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -# CONFIG_USB_NET_CH9200 is not set -CONFIG_WLAN=y -CONFIG_WLAN_VENDOR_ADMTEK=y -CONFIG_ATH_COMMON=m -CONFIG_WLAN_VENDOR_ATH=y -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_DYNACK is not set -# CONFIG_ATH9K_WOW is not set -CONFIG_ATH9K_RFKILL=y -# CONFIG_ATH9K_CHANNEL_CONTEXT is not set -CONFIG_ATH9K_PCOEM=y -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_ATH9K_HWRNG=y -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -CONFIG_CARL9170_HWRNG=y -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -CONFIG_AR5523=m -# CONFIG_ATH10K is not set -CONFIG_WCN36XX=m -# CONFIG_WCN36XX_DEBUGFS is not set -CONFIG_WLAN_VENDOR_ATMEL=y -# CONFIG_AT76C50X_USB is not set -CONFIG_WLAN_VENDOR_BROADCOM=y -CONFIG_B43=m -CONFIG_B43_BCMA=y -CONFIG_B43_SSB=y -CONFIG_B43_BUSES_BCMA_AND_SSB=y -# CONFIG_B43_BUSES_BCMA is not set -# CONFIG_B43_BUSES_SSB is not set -# CONFIG_B43_SDIO is not set -CONFIG_B43_BCMA_PIO=y -CONFIG_B43_PIO=y -CONFIG_B43_PHY_G=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_PHY_HT=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_PROTO_BCDC=y -CONFIG_BRCMFMAC_SDIO=y -CONFIG_BRCMFMAC_USB=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -CONFIG_WLAN_VENDOR_CISCO=y -CONFIG_WLAN_VENDOR_INTEL=y -CONFIG_WLAN_VENDOR_INTERSIL=y -# CONFIG_HOSTAP is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -# CONFIG_P54_SPI is not set -CONFIG_P54_LEDS=y -CONFIG_WLAN_VENDOR_MARVELL=y -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_MWIFIEX is not set -CONFIG_WLAN_VENDOR_MEDIATEK=y -CONFIG_MT7601U=m -CONFIG_WLAN_VENDOR_RALINK=y -CONFIG_RT2X00=m -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_WLAN_VENDOR_REALTEK=y -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -CONFIG_RTL_CARDS=m -# CONFIG_RTL8192CU is not set -CONFIG_RTL8XXXU=m -CONFIG_RTL8XXXU_UNTESTED=y -CONFIG_WLAN_VENDOR_RSI=y -# CONFIG_RSI_91X is not set -CONFIG_WLAN_VENDOR_ST=y -# CONFIG_CW1200 is not set -CONFIG_WLAN_VENDOR_TI=y -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -# CONFIG_WLCORE is not set -CONFIG_WLAN_VENDOR_ZYDAS=y -CONFIG_USB_ZD1201=m -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MAC80211_HWSIM is not set -CONFIG_USB_NET_RNDIS_WLAN=m - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_ISDN is not set -# CONFIG_NVM is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_JOYSTICK_RPISENSE is not set -# CONFIG_INPUT_TABLET is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -CONFIG_TOUCHSCREEN_ADS7846=m -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -CONFIG_TOUCHSCREEN_EGALAX=m -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -CONFIG_TOUCHSCREEN_RPI_FT5406=m -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -CONFIG_TOUCHSCREEN_USB_EGALAX=y -# CONFIG_TOUCHSCREEN_USB_PANJIT is not set -CONFIG_TOUCHSCREEN_USB_3M=y -# CONFIG_TOUCHSCREEN_USB_ITM is not set -# CONFIG_TOUCHSCREEN_USB_ETURBO is not set -# CONFIG_TOUCHSCREEN_USB_GUNZE is not set -# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set -# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set -# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set -# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set -# CONFIG_TOUCHSCREEN_USB_GOTOP is not set -# CONFIG_TOUCHSCREEN_USB_JASTEC is not set -# CONFIG_TOUCHSCREEN_USB_ELO is not set -# CONFIG_TOUCHSCREEN_USB_E2I is not set -# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set -# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set -# CONFIG_TOUCHSCREEN_USB_NEXIO is not set -# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -CONFIG_TOUCHSCREEN_ST1232=m -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ARIZONA_HAPTICS is not set -# CONFIG_INPUT_ATMEL_CAPTOUCH is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_RMI4_CORE is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_BRCM_CHAR_DRIVERS=y -CONFIG_BCM_VC_CMA=y -CONFIG_BCM2708_VCMEM=y -CONFIG_BCM_VCIO=y -CONFIG_BCM_VC_SM=y -CONFIG_BCM2835_DEVGPIOMEM=m -CONFIG_BCM2835_SMI_DEV=m -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -# CONFIG_DEVKMEM is not set - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -# CONFIG_SERIAL_8250_FINTEK is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_DMA is not set -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_FSL=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_RT288X is not set -CONFIG_SERIAL_OF_PLATFORM=y - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_BCM63XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_STM32 is not set -# CONFIG_TTY_PRINTK is not set -# CONFIG_HVC_DCC is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -CONFIG_HW_RANDOM_BCM2835=y -# CONFIG_R3964 is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -# CONFIG_XILLYBUS is not set - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -# CONFIG_I2C_COMPAT is not set -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=m - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MUX_REG is not set -# CONFIG_I2C_DEMUX_PINCTRL is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# -CONFIG_I2C_BCM2708=y -CONFIG_I2C_BCM2708_BAUDRATE=100000 - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -CONFIG_I2C_BCM2835=m -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_EMEV2 is not set -CONFIG_I2C_GPIO=y -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AXI_SPI_ENGINE is not set -CONFIG_SPI_BCM2835=m -CONFIG_SPI_BCM2835AUX=m -# CONFIG_SPI_BCM_QSPI is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_LOOPBACK_TEST is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set - -# -# PPS support -# -# CONFIG_PPS is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -# CONFIG_PTP_1588_CLOCK is not set - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_BCM2835=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_GPIOLIB=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -CONFIG_GPIO_SYSFS=y - -# -# Memory mapped GPIO drivers -# -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ALTERA is not set -CONFIG_GPIO_BCM_VIRT=y -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_EM is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_GPIO_MPC8XXX is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GPIO_ZX is not set - -# -# I2C GPIO expanders -# -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_TPIC2810 is not set -# CONFIG_GPIO_TS4900 is not set - -# -# MFD GPIO expanders -# -CONFIG_GPIO_ARIZONA=m -# CONFIG_HTC_EGPIO is not set - -# -# SPI GPIO expanders -# -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_PISOSR is not set - -# -# SPI or I2C GPIO expanders -# -# CONFIG_GPIO_MCP23S08 is not set - -# -# USB GPIO expanders -# -CONFIG_W1=m - -# -# 1-wire Bus Masters -# -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS1WM is not set -CONFIG_W1_MASTER_GPIO=m - -# -# 1-wire Slaves -# -CONFIG_W1_SLAVE_THERM=m -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 is not set -# CONFIG_W1_SLAVE_DS2406 is not set -# CONFIG_W1_SLAVE_DS2423 is not set -# CONFIG_W1_SLAVE_DS2431 is not set -# CONFIG_W1_SLAVE_DS2433 is not set -# CONFIG_W1_SLAVE_DS2760 is not set -# CONFIG_W1_SLAVE_DS2780 is not set -# CONFIG_W1_SLAVE_DS2781 is not set -# CONFIG_W1_SLAVE_DS28E04 is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_POWER_AVS is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_BRCMKONA is not set -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_RESET_GPIO_RESTART=y -# CONFIG_POWER_RESET_LTC2952 is not set -CONFIG_POWER_RESET_RESTART=y -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_CHARGER_RT9455 is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FTSTEUTATES is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX31722 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -# CONFIG_THERMAL_WRITABLE_TRIPS is not set -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -# CONFIG_CPU_THERMAL is not set -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_QORIQ_THERMAL is not set -CONFIG_THERMAL_BCM2835=y - -# -# ACPI INT340X thermal drivers -# -CONFIG_WATCHDOG=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WATCHDOG_NOWAYOUT is not set -# CONFIG_WATCHDOG_SYSFS is not set - -# -# Watchdog Device Drivers -# -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_ZIIRAVE_WATCHDOG is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_MAX63XX_WATCHDOG is not set -CONFIG_BCM2835_WDT=y -# CONFIG_MEN_A21_WDT is not set - -# -# USB-based Watchdog Cards -# -# CONFIG_USBPCWATCHDOG is not set - -# -# Watchdog Pretimeout Governors -# -# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -CONFIG_BCMA=m -CONFIG_BCMA_BLOCKIO=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCMA_DRIVER_GMAC_CMN=y -# CONFIG_BCMA_DRIVER_GPIO is not set -# CONFIG_BCMA_DEBUG is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_RPISENSE_CORE is not set -# CONFIG_MFD_ACT8945A is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_EXYNOS_LPASS is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77620 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_RT5033 is not set -CONFIG_MFD_RTSX_USB=y -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TPS65218 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -CONFIG_MFD_ARIZONA=y -CONFIG_MFD_ARIZONA_I2C=m -CONFIG_MFD_ARIZONA_SPI=m -# CONFIG_MFD_CS47L24 is not set -CONFIG_MFD_WM5102=y -# CONFIG_MFD_WM5110 is not set -# CONFIG_MFD_WM8997 is not set -# CONFIG_MFD_WM8998 is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_REGULATOR is not set -CONFIG_MEDIA_SUPPORT=m - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -# CONFIG_MEDIA_SDR_SUPPORT is not set -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=m -CONFIG_VIDEO_V4L2=m -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=m -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=m -CONFIG_VIDEOBUF2_MEMOPS=m -CONFIG_VIDEOBUF2_VMALLOC=m -CONFIG_DVB_CORE=m -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=m -CONFIG_RC_MAP=m -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_SHARP_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_IR_XMP_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -# CONFIG_IR_HIX5HD2 is not set -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGORPLUGUSB=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -CONFIG_VIDEO_USBTV=m - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_USBVISION is not set -CONFIG_VIDEO_STK1160_COMMON=m -# CONFIG_VIDEO_STK1160_AC97 is not set -CONFIG_VIDEO_STK1160=m -# CONFIG_VIDEO_GO7007 is not set - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_AU0828_RC=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -CONFIG_DVB_USB_DIB3000MC=m -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -# CONFIG_DVB_USB_GL861 is not set -CONFIG_DVB_USB_LME2510=m -# CONFIG_DVB_USB_MXL111SF is not set -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_DVB_USB_DVBSKY=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set -CONFIG_DVB_AS102=m - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -# CONFIG_VIDEO_EM28XX_V4L2 is not set -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -# CONFIG_V4L_PLATFORM_DRIVERS is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m -# CONFIG_RADIO_ADAPTERS is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=m - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=m -CONFIG_MEDIA_TUNER_SIMPLE=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_TEA5761=m -CONFIG_MEDIA_TUNER_TEA5767=m -CONFIG_MEDIA_TUNER_MT20XX=m -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_SI2157=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_QM1D1C0042=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m -CONFIG_DVB_SI2165=m -CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_CX24120=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m -CONFIG_DVB_SI2168=m -CONFIG_DVB_AS102_FE=m -# CONFIG_DVB_GP8PSK_FE is not set - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LGDT3306A=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# -CONFIG_DVB_TC90522=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_DRX39XYJ=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_SP2=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -# CONFIG_IMX_IPUV3_CORE is not set -# CONFIG_DRM is not set - -# -# ACP (Audio CoProcessor) Configuration -# - -# -# Frame buffer Devices -# -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_CMDLINE=y -CONFIG_FB_NOTIFY=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -CONFIG_FB_BCM2708=y -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_RPISENSE is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=y -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -CONFIG_BACKLIGHT_RPI=y -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3639 is not set -CONFIG_BACKLIGHT_GPIO=y -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_VGASTATE is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=m -CONFIG_SND_TIMER=m -CONFIG_SND_PCM=m -CONFIG_SND_DMAENGINE_PCM=m -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_JACK=y -CONFIG_SND_JACK_INPUT_DEV=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_TIMER=y -CONFIG_SND_HRTIMER=m -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -CONFIG_SND_PROC_FS=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_AC97_CODEC=m -# CONFIG_SND_DRIVERS is not set - -# -# HD-Audio -# -CONFIG_SND_HDA_PREALLOC_SIZE=2048 -CONFIG_SND_ARM=y -# CONFIG_SND_ARMAACI is not set -CONFIG_SND_BCM2835=m -CONFIG_SND_SPI=y -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_6FIRE=m -CONFIG_SND_USB_HIFACE=m -CONFIG_SND_BCD2000=m -CONFIG_SND_USB_LINE6=m -CONFIG_SND_USB_POD=m -CONFIG_SND_USB_PODHD=m -CONFIG_SND_USB_TONEPORT=m -CONFIG_SND_USB_VARIAX=m -CONFIG_SND_SOC=m -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -# CONFIG_SND_SOC_AMD_ACP is not set -# CONFIG_SND_ATMEL_SOC is not set -CONFIG_SND_BCM2835_SOC_I2S=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -CONFIG_SND_BCM2708_SOC_RPI_DAC=m -CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -CONFIG_SND_DIGIDAC1_SOUNDCARD=m -CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -CONFIG_SND_PISOUND=m -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -# CONFIG_SND_SOC_IMG is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -CONFIG_SND_SOC_I2C_AND_SPI=m - -# -# CODEC drivers -# -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -CONFIG_SND_SOC_ADAU1977=m -CONFIG_SND_SOC_ADAU1977_I2C=m -# CONFIG_SND_SOC_ADAU7002 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS35L33 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_INNO_RK3036 is not set -# CONFIG_SND_SOC_MAX98504 is not set -# CONFIG_SND_SOC_MAX9860 is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM179X_I2C is not set -# CONFIG_SND_SOC_PCM179X_SPI is not set -# CONFIG_SND_SOC_PCM3168A_I2C is not set -# CONFIG_SND_SOC_PCM3168A_SPI is not set -CONFIG_SND_SOC_PCM5102A=m -CONFIG_SND_SOC_PCM512x=m -CONFIG_SND_SOC_PCM512x_I2C=m -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_RT5616 is not set -CONFIG_SND_SOC_PCM1794A=m -# CONFIG_SND_SOC_RT5631 is not set -# CONFIG_SND_SOC_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -CONFIG_SND_SOC_STA32X=m -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TAS5720 is not set -# CONFIG_SND_SOC_TFA9879 is not set -CONFIG_SND_SOC_TAS5713=m -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TS3A227E is not set -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -CONFIG_SND_SOC_WM8731=m -# CONFIG_SND_SOC_WM8737 is not set -CONFIG_SND_SOC_WM8741=m -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -CONFIG_SND_SOC_WM8804=m -CONFIG_SND_SOC_WM8804_I2C=m -# CONFIG_SND_SOC_WM8804_SPI is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8960 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8974 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_WM8985 is not set -# CONFIG_SND_SOC_NAU8810 is not set -CONFIG_SND_SOC_TPA6130A2=m -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIMPLE_SCU_CARD is not set -# CONFIG_SOUND_PRIME is not set -CONFIG_AC97_BUS=m - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -# CONFIG_HID_BETOP_FF is not set -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CP2112 is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -# CONFIG_HID_LED is not set -CONFIG_HID_LENOVO=y -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_HID_LOGITECH_HIDPP=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -CONFIG_HID_MULTITOUCH=m -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_OUYA=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PENMOUNT=y -CONFIG_HID_PETALYNX=y -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -CONFIG_SONY_FF=y -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SPINELPLUS=y -CONFIG_HID_SUNPLUS=y -CONFIG_HID_RMI=y -# CONFIG_HID_GREENASIA is not set -CONFIG_HID_SMARTJOYPLUS=m -CONFIG_SMARTJOYPLUS_FF=y -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -CONFIG_HID_XINMO=y -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -CONFIG_USB_MON=m -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_EHCI_HCD is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -CONFIG_USB_DWCOTG=y -# CONFIG_USB_HCD_BCMA is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_UAS is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=m -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=m -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -CONFIG_USB_SERIAL_IUU=m -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=m -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set - -# -# USB Physical Layer drivers -# -# CONFIG_USB_PHY is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_PWRSEQ_EMMC=y -CONFIG_PWRSEQ_SIMPLE=y - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_BCM2835=y -CONFIG_MMC_BCM2835_DMA=y -CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y -# CONFIG_MMC_ARMMMCI is not set -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_PLTFM=y -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDHCI_IPROC is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_USDHI6ROL0 is not set -CONFIG_MMC_REALTEK_USB=m -# CONFIG_MMC_MTK is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y -CONFIG_LEDS_CLASS_FLASH=y - -# -# LED drivers -# -# CONFIG_LEDS_AAT1290 is not set -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_KTD2692 is not set -# CONFIG_LEDS_IS31FL319X is not set -# CONFIG_LEDS_IS31FL32XX is not set - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_LEDS_TRIGGER_BACKLIGHT=y -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -CONFIG_LEDS_TRIGGER_TRANSIENT=y -CONFIG_LEDS_TRIGGER_CAMERA=y -CONFIG_LEDS_TRIGGER_INPUT=y -# CONFIG_LEDS_TRIGGER_PANIC is not set -# CONFIG_ACCESSIBILITY is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_HCTOSYS is not set -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_ABB5ZES3 is not set -CONFIG_RTC_DRV_ABX80X=m -CONFIG_RTC_DRV_DS1307=m -CONFIG_RTC_DRV_DS1307_HWMON=y -# CONFIG_RTC_DRV_DS1307_CENTURY is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_X1205 is not set -CONFIG_RTC_DRV_PCF8523=m -# CONFIG_RTC_DRV_PCF85063 is not set -CONFIG_RTC_DRV_PCF8563=m -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV8803 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1302 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6916 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX6110 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_MCP795 is not set -CONFIG_RTC_I2C_AND_SPI=y - -# -# SPI and I2C RTC drivers -# -CONFIG_RTC_DRV_DS3232=m -CONFIG_RTC_DRV_PCF2127=m -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_CMOS is not set -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_ZYNQMP is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_SNVS is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DMA_OF=y -# CONFIG_AMBA_PL08X is not set -CONFIG_DMA_BCM2835=y -# CONFIG_FSL_EDMA is not set -# CONFIG_INTEL_IDMA64 is not set -# CONFIG_NBPFAXI_DMA is not set -# CONFIG_PL330_DMA is not set -CONFIG_DMA_BCM2708=y -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_HIDMA is not set -# CONFIG_DW_DMAC is not set - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set - -# -# DMABUF options -# -# CONFIG_SYNC_FILE is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_UIO is not set -# CONFIG_VIRT_DRIVERS is not set - -# -# Virtio drivers -# -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -# CONFIG_PRISM2_USB is not set -# CONFIG_COMEDI is not set -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -# CONFIG_R8188EU is not set -CONFIG_VT6656=m - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -CONFIG_STAGING_MEDIA=y -# CONFIG_MEDIA_CEC is not set -CONFIG_LIRC_STAGING=y -# CONFIG_LIRC_IMON is not set -CONFIG_LIRC_RPI=m -# CONFIG_LIRC_SASEM is not set -# CONFIG_LIRC_SERIAL is not set -# CONFIG_LIRC_SIR is not set -# CONFIG_LIRC_XBOX is not set -# CONFIG_LIRC_ZILOG is not set - -# -# Android -# -# CONFIG_STAGING_BOARD is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LNET is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set -# CONFIG_MOST is not set -# CONFIG_KS7010 is not set -# CONFIG_GREYBUS is not set -CONFIG_BCM2708_VCHIQ=y -# CONFIG_GOLDFISH is not set -# CONFIG_CHROME_PLATFORMS is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_CDCE706 is not set -# CONFIG_COMMON_CLK_CDCE925 is not set -# CONFIG_COMMON_CLK_CS2000_CP is not set -# CONFIG_CLK_QORIQ is not set -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_PIC32 is not set - -# -# Hardware Spinlock drivers -# - -# -# Clock Source drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y -CONFIG_CLKSRC_MMIO=y -CONFIG_BCM2835_TIMER=y -CONFIG_ARM_TIMER_SP804=y -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -CONFIG_MAILBOX=y -# CONFIG_ARM_MHU is not set -# CONFIG_PLATFORM_MHU is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_ALTERA_MBOX is not set -CONFIG_BCM2835_MBOX=y -# CONFIG_MAILBOX_TEST is not set -# CONFIG_IOMMU_SUPPORT is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# - -# -# SOC (System On Chip) specific Drivers -# - -# -# Broadcom SoC drivers -# -CONFIG_RASPBERRYPI_POWER=y -# CONFIG_SOC_BRCMSTB is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SOC_TI is not set -# CONFIG_PM_DEVFREQ is not set -CONFIG_EXTCON=m - -# -# Extcon Device Drivers -# -CONFIG_EXTCON_ARIZONA=m -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_MAX3355 is not set -# CONFIG_EXTCON_QCOM_SPMI_MISC is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_PWM is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC_MAX_NR=1 -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_RESET_ATH79 is not set -# CONFIG_RESET_BERLIN is not set -# CONFIG_RESET_LPC18XX is not set -# CONFIG_RESET_MESON is not set -# CONFIG_RESET_PISTACHIO is not set -# CONFIG_RESET_SOCFPGA is not set -# CONFIG_RESET_STM32 is not set -# CONFIG_RESET_SUNXI is not set -# CONFIG_TI_SYSCON_RESET is not set -# CONFIG_RESET_ZYNQ is not set -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_POWERCAP is not set -# CONFIG_MCB is not set - -# -# Performance monitor support -# -# CONFIG_RAS is not set - -# -# Android -# -# CONFIG_ANDROID is not set -# CONFIG_NVMEM is not set -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set - -# -# FPGA Configuration Support -# -# CONFIG_FPGA is not set - -# -# Firmware Drivers -# -# CONFIG_ARM_SCPI_PROTOCOL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_RASPBERRYPI_FIRMWARE=y -# CONFIG_FW_CFG_SYSFS is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_FS_IOMAP=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -# CONFIG_EXT4_ENCRYPTION is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_REISERFS_FS_XATTR is not set -CONFIG_JFS_FS=m -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=m -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -CONFIG_F2FS_CHECK_FS=y -# CONFIG_F2FS_FAULT_INJECTION is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -CONFIG_FILE_LOCKING=y -CONFIG_MANDATORY_FILE_LOCKING=y -# CONFIG_FS_ENCRYPTION is not set -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=m - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROC_CHILDREN is not set -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=y -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZ4=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -CONFIG_NFS_V4_2=y -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_PNFS_FLEXFILE_LAYOUT=m -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -CONFIG_NFS_V4_1_MIGRATION=y -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_GRACE_PERIOD=y -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -# CONFIG_DEBUG_INFO is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_PAGE_OWNER is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -CONFIG_LOCKUP_DETECTOR=y -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHED_INFO is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_TIMER_STATS is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_STACKTRACE is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_LATENCYTOP is not set -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACING_SUPPORT=y -# CONFIG_FTRACE is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_MEMTEST is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_UBSAN is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_LL is not set -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_UART_8250 is not set -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_CORESIGHT is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y -# CONFIG_HARDENED_USERCOPY is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=m -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_KPP2=y -# CONFIG_CRYPTO_RSA is not set -# CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_ECDH is not set -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=m -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -CONFIG_CRYPTO_GCM=m -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_SEQIV=m -CONFIG_CRYPTO_ECHAINIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_KEYWRAP is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRC32=y -# CONFIG_CRYPTO_CRCT10DIF is not set -CONFIG_CRYPTO_GHASH=m -# CONFIG_CRYPTO_POLY1305 is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -# CONFIG_CRYPTO_DEFLATE is not set -CONFIG_CRYPTO_LZO=m -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -# CONFIG_CRYPTO_ANSI_CPRNG is not set -CONFIG_CRYPTO_DRBG_MENU=m -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=m -CONFIG_CRYPTO_JITTERENTROPY=m -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set - -# -# Certificates for signature checking -# -CONFIG_ARM_CRYPTO=y -CONFIG_CRYPTO_SHA1_ARM=m -CONFIG_CRYPTO_SHA256_ARM=m -# CONFIG_CRYPTO_SHA512_ARM is not set -CONFIG_CRYPTO_AES_ARM=m -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=m -CONFIG_BITREVERSE=y -# CONFIG_HAVE_ARCH_BITREVERSE is not set -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=m -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m -# CONFIG_CRC8 is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=m -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_DQL=y -CONFIG_NLATTR=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -# CONFIG_IRQ_POLL is not set -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_SG_SPLIT is not set -CONFIG_SG_POOL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_SBITMAP=y -# CONFIG_VIRTUALIZATION is not set diff --git a/projects/RPi/options b/projects/RPi/options index 97b38d543d..c7d9922b0f 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -6,35 +6,33 @@ # generated code. case $TARGET_ARCH in arm) - # TARGET_CPU: - # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d - # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c - # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t - # arm720t arm740t strongarm strongarm110 strongarm1100 - # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t - # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi - # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e - # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s - # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 - # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. - TARGET_CPU="arm1176jzf-s" + # Valid TARGET_CPU for Raspberry Pi based devices are: + # arm1176jzf-s cortex-a7 cortex-a53 + if [ "$DEVICE" = "RPi" -o "$DEVICE" = "Slice" ]; then + TARGET_CPU="arm1176jzf-s" + elif [ "$DEVICE" = "RPi2" -o "$DEVICE" = "Slice3" ]; then + TARGET_CPU="cortex-a7" + fi # TARGET_FLOAT: # Specifies which floating-point ABI to use. Permissible values are: # soft softfp hard TARGET_FLOAT="hard" - # TARGET_FPU: + # Valid TARGET_FPU for Raspberry Pi based devices: # This specifies what floating point hardware (or hardware emulation) is # available on the target. Permissible names are: - # fpa fpe2 fpe3 maverick vfp vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 - # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16 - # neon-vfpv4. - TARGET_FPU="vfp" + # vfp neon-vfpv4 neon-fp-armv8 + if [ "$DEVICE" = "RPi" -o "$DEVICE" = "Slice" ]; then + TARGET_FPU="vfp" + elif [ "$DEVICE" = "RPi2" -o "$DEVICE" = "Slice3" ]; then + TARGET_FPU="neon-vfpv4" + fi + TARGET_FEATURES="32bit" ;; esac - # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) + # Bootloader to use (bcm2835-bootloader) BOOTLOADER="bcm2835-bootloader" # u-boot version to use (default) @@ -55,15 +53,12 @@ # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="dtbs" + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="" + # Kernel to use. values can be: # default: default mainline kernel - LINUX="default" - - # NOOBS supported hex versions (legacy) - NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093" - - # NOOBS supported model versions - NOOBS_SUPPORTED_MODELS='"Pi Model","Pi Compute Module","Pi Zero"' + LINUX="raspberrypi" ################################################################################ # setup build defaults @@ -72,10 +67,9 @@ # Project CFLAGS PROJECT_CFLAGS="" - # SquashFS compression method (gzip / lzo / xz) + # SquashFS compression method (gzip / lzo / xz / zstd) SQUASHFS_COMPRESSION="lzo" - ################################################################################ # setup project defaults ################################################################################ @@ -86,7 +80,7 @@ # OpenGL(X) implementation to use (no / mesa) OPENGL="no" - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) + # OpenGL-ES implementation to use (no / bcm2835-driver / mesa) OPENGLES="bcm2835-driver" # include uvesafb support (yes / no) @@ -95,15 +89,18 @@ # Displayserver to use (x11 / no) DISPLAYSERVER="no" - # Windowmanager to use (ratpoison / fluxbox / none) + # Windowmanager to use (fluxbox / none) WINDOWMANAGER="none" - # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) + # Xorg Graphic drivers to use (all / vc4 / none) # Space separated list is supported, - # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + # e.g. GRAPHIC_DRIVERS="vc4" GRAPHIC_DRIVERS="" - # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) + # Use a vendor specific KODI repo + KODI_VENDOR="raspberrypi" + + # KODI Player implementation to use (default / bcm2835-driver / mesa) KODIPLAYER_DRIVER="bcm2835-driver" # Modules to install in initramfs for early boot @@ -112,20 +109,11 @@ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware" + FIRMWARE="misc-firmware wlan-firmware brcmfmac_sdio-firmware-rpi" # build and install ATV IR remote support (yes / no) ATVCLIENT_SUPPORT="no" - # build with swap support (yes / no) - SWAP_SUPPORT="yes" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - # build with installer (yes / no) INSTALLER_SUPPORT="no" @@ -137,7 +125,15 @@ KERNEL_NAME="kernel.img" # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers + # for a list of additional drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS media_build" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS rpi-cirrus-config" + + # build and install driver addons (yes / no) + DRIVER_ADDONS_SUPPORT="yes" + + # driver addons to install: + # for a list of additional drivers see packages/linux-driver-addons + # Space separated list is supported, + DRIVER_ADDONS="crazycat dvb-latest" diff --git a/projects/RPi/packages/linux/modprobe.d/ath9k.conf b/projects/RPi/packages/linux/modprobe.d/ath9k.conf new file mode 100644 index 0000000000..608c4b6570 --- /dev/null +++ b/projects/RPi/packages/linux/modprobe.d/ath9k.conf @@ -0,0 +1,5 @@ +# ath9k.conf: setup modload options for module ath9k. +# +# enable "Channel Context support" to avoid buffering in live TV + +options ath9k use_chanctx=1 diff --git a/projects/RPi/patches/kodi/kodi-001-backport.patch b/projects/RPi/patches/kodi/kodi-001-backport.patch deleted file mode 100644 index 6d4e7298ca..0000000000 --- a/projects/RPi/patches/kodi/kodi-001-backport.patch +++ /dev/null @@ -1,52283 +0,0 @@ -From 011217b8d0ead7798bb0a7933a2c2994aab577e6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Oct 2014 00:19:40 +0000 -Subject: [PATCH 01/62] [cec] Add settings for configuring button repeats - ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/peripherals.xml | 4 +++- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ - 3 files changed, 34 insertions(+), 1 deletion(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index abfc92bd5a9f1da9e2eed758a90416ce2d369e3b..15745a792a5a28c79c19effc4d9037e842535da6 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19714,3 +19714,18 @@ msgstr "" - msgctxt "#39010" - msgid "Select sort method" - msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38050" -+msgid "Remote button press delay before repeating (ms)" -+msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38051" -+msgid "Remote button press repeat rate (ms)" -+msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38052" -+msgid "Remote button press release time (ms)" -+msgstr "" -diff --git a/system/peripherals.xml b/system/peripherals.xml -index d5704b249c3065b2980dc92c7c81dc7b384187bc..02b1a9ed6fce1986bd864bba09a9df0621f9e041 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -31,7 +31,9 @@ - - - -- -+ -+ -+ -
- - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index d032ffd707fee5eec035e90bdf618530f7215c37..30367a3fde956090afdca9930fa52e829f35046f 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -1296,6 +1296,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu - m_configuration.bActivateSource = config.bActivateSource; - bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1); - -+#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) -+ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; -+ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); -+#else -+ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; -+ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs); -+#endif -+ -+ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; -+ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); -+ -+ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; -+ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); -+ - m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby; - - m_configuration.iFirmwareVersion = config.iFirmwareVersion; -@@ -1398,6 +1412,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) - // backwards compatibility. will be removed once the next major release of libCEC is out - m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); - #endif -+ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); -+ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); - - if (GetSettingBool("pause_playback_on_deactivate")) - { - -From 59f1631775f719f712048fc123bc6c36632a166b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 02/62] [cec] Don't suspend pi on tv switch off - it can't wake - up - ---- - system/peripherals.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/system/peripherals.xml b/system/peripherals.xml -index 02b1a9ed6fce1986bd864bba09a9df0621f9e041..54f9b70cfd5c8c82ceb99932e1b3e3251211cd20 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -16,7 +16,7 @@ - - - -- -+ - - - - -From ab59b9542257461e117a238bab492e54fff7908c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 21 Apr 2016 16:49:02 +0100 -Subject: [PATCH 03/62] Revert "[settings] remove show EXIF picture information - setting" - -This reverts commit e7d90188436b6966eff23fd695e1a9d18f4af1b4. ---- - addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ - system/settings/settings.xml | 5 +++++ - xbmc/pictures/GUIWindowPictures.cpp | 2 +- - xbmc/pictures/PictureInfoLoader.cpp | 8 ++++++-- - xbmc/pictures/PictureInfoLoader.h | 1 + - xbmc/settings/Settings.cpp | 1 + - xbmc/settings/Settings.h | 1 + - 7 files changed, 25 insertions(+), 3 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 15745a792a5a28c79c19effc4d9037e842535da6..dbd80f07e305ad99a29d90211a7596b8bb5cedec 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19729,3 +19729,13 @@ msgstr "" - msgctxt "#38052" - msgid "Remote button press release time (ms)" - msgstr "" -+ -+#. Description of setting "Pictures -> Show EXIF picture information" with label #38207 -+#: system/settings/settings.xml -+msgctxt "#38207" -+msgid "Show EXIF picture information" -+msgstr "" -+ -+msgctxt "#38208" -+msgid "If EXIF information exists (date, time, camera used, etc.), it will be displayed." -+msgstr "" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index c3804da9625186f5651a8d8be0edcedd8a2b255b..63613fc13acfd66476a880f8ebe9047a53837a33 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -1172,6 +1172,11 @@ -
- - -+ -+ 0 -+ true -+ -+ - - 0 - true -diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp -index 4b5ec502a49d5116cafd53441a6d823be0da6b54..072639baae58479ec7d746f96634de069ee87e34 100644 ---- a/xbmc/pictures/GUIWindowPictures.cpp -+++ b/xbmc/pictures/GUIWindowPictures.cpp -@@ -203,7 +203,7 @@ void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items) - if (StringUtils::EqualsNoCase(items[i]->GetLabel(), "folder.jpg")) - items.Remove(i); - -- if (items.GetFolderCount() == items.Size()) -+ if (items.GetFolderCount() == items.Size() || !CSettings::GetInstance().GetBool(CSettings::SETTING_PICTURES_USETAGS)) - return; - - // Start the music info loader thread -diff --git a/xbmc/pictures/PictureInfoLoader.cpp b/xbmc/pictures/PictureInfoLoader.cpp -index dd3347277c75c5e63a4a4db9af9cc46605bb5ea9..05304f9fc44285d5577f2056625cceb15347ae57 100644 ---- a/xbmc/pictures/PictureInfoLoader.cpp -+++ b/xbmc/pictures/PictureInfoLoader.cpp -@@ -43,6 +43,7 @@ void CPictureInfoLoader::OnLoaderStart() - m_mapFileItems->SetFastLookup(true); - - m_tagReads = 0; -+ m_loadTags = CSettings::GetInstance().GetBool(CSettings::SETTING_PICTURES_USETAGS); - - if (m_pProgressCallback) - m_pProgressCallback->SetProgressMax(m_pVecItems->GetFileCount()); -@@ -87,8 +88,11 @@ bool CPictureInfoLoader::LoadItemLookup(CFileItem* pItem) - if (pItem->HasPictureInfoTag()) - return false; - -- pItem->GetPictureInfoTag()->Load(pItem->GetPath()); -- m_tagReads++; -+ if (m_loadTags) -+ { // Nothing found, load tag from file -+ pItem->GetPictureInfoTag()->Load(pItem->GetPath()); -+ m_tagReads++; -+ } - - return true; - } -diff --git a/xbmc/pictures/PictureInfoLoader.h b/xbmc/pictures/PictureInfoLoader.h -index 000b54fe1bb1dd1963edd5cf208ea318a5a5499d..2a022ff0ff66d237f0ebd12092c7b5ce8244a511 100644 ---- a/xbmc/pictures/PictureInfoLoader.h -+++ b/xbmc/pictures/PictureInfoLoader.h -@@ -39,5 +39,6 @@ protected: - - CFileItemList* m_mapFileItems; - unsigned int m_tagReads; -+ bool m_loadTags; - }; - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 9940b6aac87971d7024c1c925846b4dac1ca98a0..6e13ba61b99217d95c1ad423131221869be6036b 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -296,6 +296,7 @@ const std::string CSettings::SETTING_AUDIOCDS_SETTINGS = "audiocds.settings"; - const std::string CSettings::SETTING_AUDIOCDS_EJECTONRIP = "audiocds.ejectonrip"; - const std::string CSettings::SETTING_MYMUSIC_SONGTHUMBINVIS = "mymusic.songthumbinvis"; - const std::string CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW = "mymusic.defaultlibview"; -+const std::string CSettings::SETTING_PICTURES_USETAGS = "pictures.usetags"; - const std::string CSettings::SETTING_PICTURES_GENERATETHUMBS = "pictures.generatethumbs"; - const std::string CSettings::SETTING_PICTURES_SHOWVIDEOS = "pictures.showvideos"; - const std::string CSettings::SETTING_PICTURES_DISPLAYRESOLUTION = "pictures.displayresolution"; -diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h -index 482f61db8aab70aff4013fee2f1c73a5b5a9b4a9..269a3a741340d60354037166c3b03ddfdd36cf01 100644 ---- a/xbmc/settings/Settings.h -+++ b/xbmc/settings/Settings.h -@@ -253,6 +253,7 @@ public: - static const std::string SETTING_AUDIOCDS_EJECTONRIP; - static const std::string SETTING_MYMUSIC_SONGTHUMBINVIS; - static const std::string SETTING_MYMUSIC_DEFAULTLIBVIEW; -+ static const std::string SETTING_PICTURES_USETAGS; - static const std::string SETTING_PICTURES_GENERATETHUMBS; - static const std::string SETTING_PICTURES_SHOWVIDEOS; - static const std::string SETTING_PICTURES_DISPLAYRESOLUTION; - -From 2b1ad46b2dbde48ef0c82dbd4cb28af3708dc2d6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 04/62] [rbp/omxplayer] When opening a stream don't try to - update gui so often - ---- - xbmc/dialogs/GUIDialogBusy.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp -index c8fe0706d128b3c67a4000894129ae0fa08bb223..8a5916299575661743131b921a27a76f0bb88409 100644 ---- a/xbmc/dialogs/GUIDialogBusy.cpp -+++ b/xbmc/dialogs/GUIDialogBusy.cpp -@@ -69,7 +69,11 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10 - { - dialog->Open(); - -+#ifdef TARGET_RASPBERRY_PI -+ while(!event.WaitMSec(100)) -+#else - while(!event.WaitMSec(1)) -+#endif - { - dialog->ProcessRenderLoop(false); - if (allowCancel && dialog->IsCanceled()) - -From 5980fa48550e82458fc62fb501a7bc7190569cb4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 05/62] [hifiberry] Hack: force it to be recognised as IEC958 - capable to enable passthrough options - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index d66993a09583d8f9f54f5f97c18fbba45dddee9b..3c0b691860ace57e0a25f01013df01a5ca4f62f5 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -1351,6 +1351,10 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev - if (snd_card_get_name(cardNr, &cardName) == 0) - info.m_displayName = cardName; - -+ // hack: hifiberry digi doesn't correctly report as iec958 device. Needs fixing in kernel driver -+ if (info.m_displayName == "snd_rpi_hifiberry_digi") -+ info.m_deviceType = AE_DEVTYPE_IEC958; -+ - if (info.m_deviceType == AE_DEVTYPE_HDMI && info.m_displayName.size() > 5 && - info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") - { - -From 6387bb9ea57ef7c7e203e0b043139ff26103df22 Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 06/62] Improved file buffering in CArchive - -Even though memcpy is typically inlined by the compiler into byte/word loads -and stores (at least for release builds), the frequency with which 1, 2 and 4 -byte loads/stores are encountered in cases where the size is *not* -determinable at compile time is still high enough that it's worth handling -these specially. On the ARM1176JZF-S in the Raspberry Pi, this improves the -total time to open a library (in the case where it's fetched from a CArchive) -by around 4%. - -It should be noted that this code uses 16-bit and 32-bit word loads and -stores that are not necessarily aligned to their respective widths. It is -possible that there are some architectures out there which do not support -this, although all ARMs since ARMv6 have supported it (and ARMs earlier than -that are probably not powerful enough to be good targets for XBMC). ---- - xbmc/utils/Archive.h | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/xbmc/utils/Archive.h b/xbmc/utils/Archive.h -index 23cac2759fb10d532da56fa75c5528c5589e9010..89d31d4db1afa7340ed8cd51a7a9fa7acce53b3a 100644 ---- a/xbmc/utils/Archive.h -+++ b/xbmc/utils/Archive.h -@@ -155,9 +155,17 @@ protected: - * than waiting until we attempt to put more data into an already full buffer */ - if (m_BufferRemain > size) - { -+ switch (size) -+ { -+ case 1: *m_BufferPos++ = *ptr; m_BufferRemain--; break; -+ case 2: *(uint16_t *) m_BufferPos = *(const uint16_t *) ptr; m_BufferPos += 2; m_BufferRemain -= 2; break; -+ case 4: *(uint32_t *) m_BufferPos = *(const uint32_t *) ptr; m_BufferPos += 4; m_BufferRemain -= 4; break; -+ default: - memcpy(m_BufferPos, ptr, size); - m_BufferPos += size; - m_BufferRemain -= size; -+ break; -+ } - return *this; - } - -@@ -170,9 +178,17 @@ protected: - /* Note, refilling the buffer is deferred until we know we need to read more from it */ - if (m_BufferRemain >= size) - { -+ switch (size) -+ { -+ case 1: *ptr = *m_BufferPos++; m_BufferRemain--; break; -+ case 2: *(uint16_t *) ptr = *(const uint16_t *) m_BufferPos; m_BufferPos += 2; m_BufferRemain -= 2; break; -+ case 4: *(uint32_t *) ptr = *(const uint32_t *) m_BufferPos; m_BufferPos += 4; m_BufferRemain -= 4; break; -+ default: - memcpy(ptr, m_BufferPos, size); - m_BufferPos += size; - m_BufferRemain -= size; -+ break; -+ } - return *this; - } - - -From ebdbce3d440c74755bf071fc064c96bbab9abc78 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 07/62] filesystem: Make support of browsing into archives - optional - -The ability to browse, scan and play content in archives can cause problems on low powered/low memory devices. -It's quite common to see reports of a large rar file that causes xbmc to crash with an out-of-memory error when browsing or scanning. -It also can be slow as any archive in the directory is opened and extracted. - -This causes issues for people who scan library with archives disabled, then subsequently enable it. -The library has the .rar files in which don't play without removing and re-adding. - -We'll let people who don't use archives disable it manually ---- - addons/resource.language.en_gb/resources/strings.po | 9 +++++++++ - system/settings/rbp.xml | 11 +++++++++++ - xbmc/Util.cpp | 4 ++-- - xbmc/filesystem/FileDirectoryFactory.cpp | 4 ++++ - 4 files changed, 26 insertions(+), 2 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index dbd80f07e305ad99a29d90211a7596b8bb5cedec..ecea05ac43622f75034c60cc3b2bd16859065a80 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19371,6 +19371,15 @@ msgstr "" - #: system/settings/rbp.xml - msgctxt "#38010" - msgid "GPU accelerated" -+ -+#: system/settings/settings.xml -+msgctxt "#38040" -+msgid "Support browsing into archives" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38041" -+msgid "Allow viewing and playing files in archives (e.g. zip, rar)" - msgstr "" - - #. Setting #38011 "Show All Items entry" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 62e9c8ed2199f8c57a640b06b0216ee4c8f0ca1e..e8b0d3d472b02fd161a4b51e957b9129e3cb9792 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -102,4 +102,15 @@ - - -
-+
-+ -+ -+ -+ 1 -+ true -+ -+ -+ -+ -+
-
-diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp -index c3567941192c724f2600494a8d7e355584b57b52..da1508dcedbd196789988d895e64548a08439d8f 100644 ---- a/xbmc/Util.cpp -+++ b/xbmc/Util.cpp -@@ -1899,7 +1899,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName, - URIUtils::RemoveExtension(strCandidate); - if (StringUtils::StartsWithNoCase(strCandidate, videoName)) - { -- if (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath())) -+ if (CSettings::GetInstance().GetBool("filelists.browsearchives") && (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath()))) - CUtil::ScanArchiveForAssociatedItems(pItem->GetPath(), "", item_exts, associatedFiles); - else - { -@@ -1909,7 +1909,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName, - } - else - { -- if (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath())) -+ if (CSettings::GetInstance().GetBool("filelists.browsearchives") && (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath()))) - CUtil::ScanArchiveForAssociatedItems(pItem->GetPath(), videoName, item_exts, associatedFiles); - } - } -diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp -index a0fd0a9011e71f4af1535110c696b6ea5c4b37db..688b71a297c7c617c6764bfe6be157d727eb49d3 100644 ---- a/xbmc/filesystem/FileDirectoryFactory.cpp -+++ b/xbmc/filesystem/FileDirectoryFactory.cpp -@@ -40,6 +40,7 @@ - #include "playlists/PlayListFactory.h" - #include "Directory.h" - #include "File.h" -+#include "settings/Settings.h" - #include "FileItem.h" - #include "utils/StringUtils.h" - #include "URL.h" -@@ -116,6 +117,8 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, - return NULL; - } - #endif -+ if (CSettings::GetInstance().GetBool("filelists.browsearchives")) -+ { - if (url.IsFileType("zip")) - { - CURL zipURL = URIUtils::CreateArchivePath("zip", url); -@@ -189,6 +192,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, - } - return NULL; - } -+ } - if (url.IsFileType("xbt")) - { - CURL xbtUrl = URIUtils::CreateArchivePath("xbt", url); - -From 2f0e7984f47266b6b5fd6a4e14ee8f2a8e9f011c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 08/62] [rbp] Make cachemembuffersize default depend on memory - size - ---- - xbmc/linux/RBP.cpp | 10 ++++++++++ - xbmc/linux/RBP.h | 1 + - xbmc/settings/AdvancedSettings.cpp | 12 +++++++++++- - 3 files changed, 22 insertions(+), 1 deletion(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 571bf9f1ae64ae6d2d80a4aaca1a164f5178bf98..5a6f780517cff0c31f1c40e5e95445d448eb2297 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -23,6 +23,7 @@ - - #include - #include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" - #include "utils/log.h" - - #include "cores/omxplayer/OMXImage.h" -@@ -58,6 +59,12 @@ CRBP::~CRBP() - delete m_DllBcmHost; - } - -+void CRBP::InitializeSettings() -+{ -+ if (m_initialized && g_advancedSettings.m_cacheMemSize == ~0U) -+ g_advancedSettings.m_cacheMemSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; -+} -+ - bool CRBP::Initialize() - { - CSingleLock lock(m_critSection); -@@ -97,6 +104,8 @@ bool CRBP::Initialize() - if (!m_gui_resolution_limit) - m_gui_resolution_limit = m_gpu_mem < 128 ? 720:1080; - -+ InitializeSettings(); -+ - g_OMXImage.Initialize(); - m_omx_image_init = true; - return true; -@@ -109,6 +118,7 @@ void CRBP::LogFirmwareVerison() - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); - CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); -+ CLog::Log(LOGNOTICE, "cache.memorysize: %dMB", g_advancedSettings.m_cacheMemSize >> 20); - m_DllBcmHost->vc_gencmd(response, sizeof response, "get_config int"); - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Config:\n%s", response); -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index a35a509a91483f13e2cf0e688fc7e9528f254290..fffa5182126159f6dfcf750b21fa0464e229e545 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -62,6 +62,7 @@ public: - ~CRBP(); - - bool Initialize(); -+ void InitializeSettings(); - void LogFirmwareVerison(); - void Deinitialize(); - int GetArmMem() { return m_arm_mem; } -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index cc37998f0c9edfb38cf609666374cfa96530bf8f..3891a7ed34acb3489a860678d56a8ec049890f6e 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -50,6 +50,9 @@ - #if defined(TARGET_DARWIN_IOS) - #include "platform/darwin/DarwinUtils.h" - #endif -+#if defined(TARGET_RASPBERRY_PI) -+#include "linux/RBP.h" -+#endif - - using namespace ADDON; - using namespace XFILE; -@@ -355,7 +358,12 @@ void CAdvancedSettings::Initialize() - m_bPVRAutoScanIconsUserSet = false; - m_iPVRNumericChannelSwitchTimeout = 1000; - -+#ifdef TARGET_RASPBERRY_PI -+ // want default to be memory dependent, but interface to gpu not available yet, so set in RBP.cpp -+ m_cacheMemSize = ~0; -+#else - m_cacheMemSize = 1024 * 1024 * 20; -+#endif - m_cacheBufferMode = CACHE_BUFFER_MODE_INTERNET; // Default (buffer all internet streams/filesystems) - // the following setting determines the readRate of a player data - // as multiply of the default data read rate -@@ -404,7 +412,9 @@ void CAdvancedSettings::Initialize() - m_extraLogLevels = 0; - - m_userAgent = g_sysinfo.GetUserAgent(); -- -+#ifdef TARGET_RASPBERRY_PI -+ g_RBP.InitializeSettings(); -+#endif - m_initialized = true; - } - - -From c84536e65bc489172be3a852a9db7496615e7ec2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 09/62] [settings] Experiment: Report DESKTOP resolution in - video settings - ---- - xbmc/settings/DisplaySettings.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp -index ef95bc286fa982790248bad26da3c3e00c1da002..da69c6960867621d4ebe9267929664d973d00beb 100644 ---- a/xbmc/settings/DisplaySettings.cpp -+++ b/xbmc/settings/DisplaySettings.cpp -@@ -704,6 +704,9 @@ void CDisplaySettings::SettingOptionsResolutionsFiller(const CSetting *setting, - std::vector resolutions = g_Windowing.ScreenResolutions(info.iScreen, info.fRefreshRate); - for (std::vector::const_iterator resolution = resolutions.begin(); resolution != resolutions.end(); ++resolution) - { -+if (resolution->ResInfo_Index == RES_DESKTOP) -+ list.push_back(std::make_pair(StringUtils::Format("DESKTOP"), resolution->ResInfo_Index)); -+else - list.push_back(std::make_pair( - StringUtils::Format("%dx%d%s", resolution->width, resolution->height, - ModeFlagsToString(resolution->flags, false).c_str()), - -From 7f0028ec330b751c0c006ab2b496c5aeb6f67ac3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 10/62] [audio] Add settings option to boost centre channel - when downmixing - -This allows a dB volume increase to be added to centre channel. -This can help improve dialgue in the presence of background music/effects. -It can go up to 30dB for testing purposes, but value of 6 is probably more reasonable. -It is recommended to ensure "Normalise levels on downmix" is enabled when boosting by large values to avoid clipping. - -Should work with Pi Sink (dvdplayer/paplayer) and omxplayer ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/settings/settings.xml | 12 ++++++++++++ - .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 7 +++++++ - .../AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 6 ++++++ - xbmc/cores/omxplayer/OMXAudio.cpp | 6 ++++++ - 5 files changed, 46 insertions(+) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ecea05ac43622f75034c60cc3b2bd16859065a80..de5eb0dd99700c0bdc7c3409c1b63f1c01c650bb 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19591,6 +19591,21 @@ msgstr "" - - #empty strings from id 38062 to 38099 - -+#: system/settings/settings.xml -+msgctxt "#38007" -+msgid "Boost centre channel when downmixing" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38008" -+msgid "Increase this value to make the dialogue louder compared to background sounds when downmixing multichannel audio" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38009" -+msgid "%i dB" -+msgstr "" -+ - #. Description of section #14200 "Player"" - #: system/settings/settings.xml - msgctxt "#38100" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 63613fc13acfd66476a880f8ebe9047a53837a33..9ce9e725aec4d8ed000200342a2a99f3bc34a749 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2358,6 +2358,18 @@ - - - -+ -+ 2 -+ 0 -+ -+ 0 -+ 1 -+ 30 -+ -+ -+ 38009 -+ -+ - - HAS_AE_QUALITY_LEVELS - 2 -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -index af5bf93116543bd282953b01d0c5bcef93bb3a84..d7165dedd242abdfa7c0607eee332451c3187298 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -@@ -20,6 +20,7 @@ - - #include "cores/AudioEngine/Utils/AEUtil.h" - #include "ActiveAEResampleFFMPEG.h" -+#include "settings/Settings.h" - #include "utils/log.h" - - extern "C" { -@@ -104,6 +105,12 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - if (remapLayout) - { -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index 78071493fca4756c6741d7085e35cbe2f27038e6..698a6ae1e2bc0cc9256caec42c0dcfb0893301b5 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -@@ -164,6 +164,12 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - if (remapLayout) - { -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index f16b822ed7b4aebe18b5d339b3f71ee66e97c23f..993d4b33a294e88c2c004b7943895ba55558c2d0 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -633,6 +633,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - // stereo upmix - if (upmix && m_src_channels == 2 && m_dst_channels > 2) - -From 970ba6a8671460e469240cf5113d574ea44905cc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 11/62] [rbp] Default extract thumbnails to false - -It can take 80 seconds for a single file on a Pi. It can cause crashes with out-of-memory errors. -It genereates a lot of support issues. Best to default to disabled and let users enable it if they must ---- - system/settings/rbp.xml | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index e8b0d3d472b02fd161a4b51e957b9129e3cb9792..289dc55ec41aa44848519a05f8ee1ccc72740085 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -43,6 +43,12 @@ - - false - -+ -+ false -+ -+ -+ false -+ - - - - -From 9fecb172939f96a23cacafe2e40cbd462cfa9da3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 12/62] [languageinvoker] Reduce priority of python threads - ---- - xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/interfaces/generic/LanguageInvokerThread.cpp b/xbmc/interfaces/generic/LanguageInvokerThread.cpp -index fcdd0633f30cd9595ae6cc4ed293677cdcb1f422..16f0c8916b5e0a9e90973d194cf2ebd12b5a81fd 100644 ---- a/xbmc/interfaces/generic/LanguageInvokerThread.cpp -+++ b/xbmc/interfaces/generic/LanguageInvokerThread.cpp -@@ -50,6 +50,11 @@ bool CLanguageInvokerThread::execute(const std::string &script, const std::vecto - m_args = arguments; - - Create(); -+ #ifdef TARGET_RASPBERRY_PI -+ /* low prio */ -+ SetPriority(GetPriority()-1); -+ #endif -+ - return true; - } - - -From d9dc2c7f2616bc989bd550ee5a7ac7a47b5d43ae Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 13/62] [rbp] hack: wait for splash to complete before changing - hdmi mode - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 52 +++++++++++++++++++++++++ - 1 file changed, 52 insertions(+) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index ee297700f8583dbb15cbe53baf8c887b36bd2ea0..bbe501d40c5e101f1d0d64b8b59b1928ae12d52f 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -32,6 +32,9 @@ - #include "guilib/StereoscopicsManager.h" - #include "rendering/RenderSystem.h" - #include -+#ifdef TARGET_POSIX -+#include "linux/XTimeUtils.h" -+#endif - - #ifndef __VIDEOCORE4__ - #define __VIDEOCORE4__ -@@ -221,12 +224,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve - } - #endif - -+#include -+ -+pid_t proc_find(const char* name) -+{ -+ DIR* dir; -+ struct dirent* ent; -+ char buf[512]; -+ -+ long pid; -+ char pname[100] = {0,}; -+ char state; -+ FILE *fp=NULL; -+ -+ if (!(dir = opendir("/proc"))) { -+ perror("can't open /proc"); -+ return -1; -+ } -+ -+ while((ent = readdir(dir)) != NULL) { -+ long lpid = atol(ent->d_name); -+ if(lpid < 0) -+ continue; -+ snprintf(buf, sizeof(buf), "/proc/%ld/stat", lpid); -+ fp = fopen(buf, "r"); -+ -+ if (fp) { -+ if ( (fscanf(fp, "%ld (%[^)]) %c", &pid, pname, &state)) != 3 ){ -+ printf("fscanf failed \n"); -+ fclose(fp); -+ closedir(dir); -+ return -1; -+ } -+ if (!strcmp(pname, name)) { -+ fclose(fp); -+ closedir(dir); -+ return (pid_t)lpid; -+ } -+ fclose(fp); -+ } -+ } -+ -+ closedir(dir); -+ return -1; -+} -+ -+ - bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - { - #if defined(TARGET_RASPBERRY_PI) - if(!m_DllBcmHost || !m_nativeWindow) - return false; - -+ while (proc_find("hello_video.bin") >= 0) -+ Sleep(100); -+ - DestroyDispmaxWindow(); - - RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode(); - -From 8f2d2d8618a4051fdeedfc528a21fc0657614d9e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 14/62] Fix for UI not showing both extractflags and - extractthumb - ---- - addons/resource.language.en_gb/resources/strings.po | 10 +++++++--- - system/settings/settings.xml | 4 ++-- - 2 files changed, 9 insertions(+), 5 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index de5eb0dd99700c0bdc7c3409c1b63f1c01c650bb..ae3aa10aa65beac6689f129d60056cadf8a5b5c1 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -12451,7 +12451,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#20433" --msgid "Extract thumbnails and video information" -+msgid "Extract video information from files" - msgstr "" - - #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -17011,7 +17011,7 @@ msgstr "" - #. Description of setting with label #20433 "Extract thumbnails and video information" - #: system/settings/settings.xml - msgctxt "#36178" --msgid "Extract thumbnails and metadata information such as codec and aspect ratio from videos." -+msgid "Extract metadata information such as codec and aspect ratio from videos." - msgstr "" - - #. Description of setting with label #20419 "Replace file names with library titles" -@@ -17023,7 +17023,7 @@ msgstr "" - #. Description of setting with label #20433 "Extract thumbnails and video information" - #: system/settings/settings.xml - msgctxt "#36180" --msgid "Extract thumbnails and information, such as codecs and aspect ratio, to display in library mode." -+msgid "Extract thumbnails, to display in library Mode." - msgstr "" - - #: system/settings/settings.xml -@@ -19763,3 +19763,7 @@ msgstr "" - msgctxt "#38208" - msgid "If EXIF information exists (date, time, camera used, etc.), it will be displayed." - msgstr "" -+ -+msgctxt "#38190" -+msgid "Extract thumbnails from video files" -+msgstr "" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 9ce9e725aec4d8ed000200342a2a99f3bc34a749..326ffbd0f08428c3b4a95208134253feeabf1b1f 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -969,8 +969,8 @@ - true - - -- -- 4 -+ -+ 1 - true - - - -From 2d8206baa4bb9229a75e71a3de87628d60e006e5 Mon Sep 17 00:00:00 2001 -From: anaconda -Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 15/62] Disable autoscrolling while on screensaver and while - opening streams. - ---- - xbmc/Application.cpp | 10 ++++++++++ - xbmc/Application.h | 2 ++ - xbmc/guilib/GUIFadeLabelControl.cpp | 4 +++- - xbmc/guilib/GUIFont.cpp | 4 ++++ - xbmc/guilib/GUILabel.cpp | 4 +++- - xbmc/guilib/GUITextBox.cpp | 3 ++- - 6 files changed, 24 insertions(+), 3 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 620366e4bcb8593484bc205af4c33fc13dab924a..cf77c3dbb84b86c755ee792294760c5c4c38742d 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -5215,3 +5215,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const - - return false; - } -+ -+bool CApplication::ScreenSaverDisablesAutoScrolling() -+{ -+ bool onBlackDimScreenSaver = IsInScreenSaver() && m_screenSaver && -+ (m_screenSaver->ID() == "screensaver.xbmc.builtin.black" || -+ m_screenSaver->ID() == "screensaver.xbmc.builtin.dim"); -+ bool openingStreams = m_pPlayer->IsPlaying() && g_windowManager.IsWindowActive(WINDOW_DIALOG_BUSY); -+ -+ return onBlackDimScreenSaver || openingStreams; -+} -diff --git a/xbmc/Application.h b/xbmc/Application.h -index 580fdce5476312c83c82bec07f48b3eaf8fe9797..e04788e1e3574aa5ecf9b14490fe1fd967ce8ec9 100644 ---- a/xbmc/Application.h -+++ b/xbmc/Application.h -@@ -392,6 +392,8 @@ public: - */ - void UnregisterActionListener(IActionListener *listener); - -+ bool ScreenSaverDisablesAutoScrolling(); -+ - std::unique_ptr m_ServiceManager; - - /*! -diff --git a/xbmc/guilib/GUIFadeLabelControl.cpp b/xbmc/guilib/GUIFadeLabelControl.cpp -index 01826a5f7ca2ccb104f897ca0670571a9b04b83d..553a6458a71009dd592c8a843eeb3bc336864d61 100644 ---- a/xbmc/guilib/GUIFadeLabelControl.cpp -+++ b/xbmc/guilib/GUIFadeLabelControl.cpp -@@ -21,6 +21,8 @@ - #include "GUIFadeLabelControl.h" - #include "utils/Random.h" - -+#include "Application.h" -+ - CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange, bool randomized) - : CGUIControl(parentID, controlID, posX, posY, width, height), m_label(labelInfo), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed) - , m_textLayout(labelInfo.font, false) -@@ -106,7 +108,7 @@ void CGUIFadeLabelControl::Process(unsigned int currentTime, CDirtyRegionList &d - m_lastLabel = m_currentLabel; - } - -- if (m_infoLabels.size() > 1 || !m_shortText) -+ if ((m_infoLabels.size() > 1 || !m_shortText) && !g_application.ScreenSaverDisablesAutoScrolling()) - { // have scrolling text - bool moveToNextLabel = false; - if (!m_scrollOut) -diff --git a/xbmc/guilib/GUIFont.cpp b/xbmc/guilib/GUIFont.cpp -index 7f1108939a63162024c7a055403a58e395f090b6..1192b74675b79d1a862de2949a60163abb916035 100644 ---- a/xbmc/guilib/GUIFont.cpp -+++ b/xbmc/guilib/GUIFont.cpp -@@ -22,6 +22,7 @@ - #include "GUIFontTTF.h" - #include "GraphicContext.h" - -+#include "Application.h" - #include "threads/SingleLock.h" - #include "utils/TimeUtils.h" - #include "utils/MathUtils.h" -@@ -128,6 +129,9 @@ bool CGUIFont::UpdateScrollInfo(const vecText &text, CScrollInfo &scrollInfo) - // If the string is smaller than the viewport, then it may be plotted even - // more times than that. - // -+ if (g_application.ScreenSaverDisablesAutoScrolling()) -+ return false; -+ - if (scrollInfo.waitTime) - { - scrollInfo.waitTime--; -diff --git a/xbmc/guilib/GUILabel.cpp b/xbmc/guilib/GUILabel.cpp -index f15e847ec43d07b44660caec9f8faca780b0a061..ba88a7c5e45da13404d59dfbf1bbc8b93d3528c1 100644 ---- a/xbmc/guilib/GUILabel.cpp -+++ b/xbmc/guilib/GUILabel.cpp -@@ -21,6 +21,8 @@ - #include "GUILabel.h" - #include - -+#include "Application.h" -+ - CGUILabel::CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, CGUILabel::OVER_FLOW overflow) - : m_label(labelInfo) - , m_textLayout(labelInfo.font, overflow == OVER_FLOW_WRAP, height) -@@ -103,7 +105,7 @@ void CGUILabel::Render() - color_t color = GetColor(); - bool renderSolid = (m_color == COLOR_DISABLED); - bool overFlows = (m_renderRect.Width() + 0.5f < m_textLayout.GetTextWidth()); // 0.5f to deal with floating point rounding issues -- if (overFlows && m_scrolling && !renderSolid) -+ if (overFlows && m_scrolling && !renderSolid && !g_application.ScreenSaverDisablesAutoScrolling()) - m_textLayout.RenderScrolling(m_renderRect.x1, m_renderRect.y1, m_label.angle, color, m_label.shadowColor, 0, m_renderRect.Width(), m_scrollInfo); - else - { -diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp -index d7bc1c5ba6067af9a460589920367288c640a915..ac766293f1c47c7f145cb46f6b152144b303f15f 100644 ---- a/xbmc/guilib/GUITextBox.cpp -+++ b/xbmc/guilib/GUITextBox.cpp -@@ -24,6 +24,7 @@ - #include "utils/MathUtils.h" - #include "utils/StringUtils.h" - #include "guiinfo/GUIInfoLabels.h" -+#include "Application.h" - - #include - -@@ -133,7 +134,7 @@ void CGUITextBox::Process(unsigned int currentTime, CDirtyRegionList &dirtyregio - // update our auto-scrolling as necessary - if (m_autoScrollTime && m_lines.size() > m_itemsPerPage) - { -- if (!m_autoScrollCondition || m_autoScrollCondition->Get()) -+ if ((!m_autoScrollCondition || m_autoScrollCondition->Get()) && !g_application.ScreenSaverDisablesAutoScrolling()) - { - if (m_lastRenderTime) - m_autoScrollDelayTime += currentTime - m_lastRenderTime; - -From 8a1f8bb315f494840e8b5807f257463c57532fd6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 16/62] [demuxer] Avoid memcpy on every demuxer packet - -Avoids an unnecessary memcpy on every demuxer packet which for -high bitrate videos can be significant. ---- - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 17 ++++++++++++----- - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | 3 +++ - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp | 7 ++++++- - 3 files changed, 21 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 33d1e5ab627d8099018190699f3b532c2b1f3b08..e015e65dea43e7b682b704edb7f468b63b8c2ac5 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -921,7 +921,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - { - if(m_pkt.pkt.stream_index == (int)m_pFormatContext->programs[m_program]->stream_index[i]) - { -- pPacket = CDVDDemuxUtils::AllocateDemuxPacket(m_pkt.pkt.size); -+ pPacket = CDVDDemuxUtils::AllocateDemuxPacket(0); - break; - } - } -@@ -930,7 +930,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - bReturnEmpty = true; - } - else -- pPacket = CDVDDemuxUtils::AllocateDemuxPacket(m_pkt.pkt.size); -+ pPacket = CDVDDemuxUtils::AllocateDemuxPacket(0); - } - else - bReturnEmpty = true; -@@ -960,9 +960,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - // copy contents into our own packet - pPacket->iSize = m_pkt.pkt.size; - -- // maybe we can avoid a memcpy here by detecting where pkt.destruct is pointing too? - if (m_pkt.pkt.data) -- memcpy(pPacket->pData, m_pkt.pkt.data, pPacket->iSize); -+ { -+ pPacket->pData = m_pkt.pkt.data; -+ // so we can free AVPacket when DemuxPacket is freed -+ pPacket->pkt = new AVPacket(m_pkt.pkt); -+ } -+ - - pPacket->pts = ConvertTimestamp(m_pkt.pkt.pts, stream->time_base.den, stream->time_base.num); - pPacket->dts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num); -@@ -1016,7 +1020,10 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - pPacket->iStreamId = m_pkt.pkt.stream_index; - } - m_pkt.result = -1; -- av_packet_unref(&m_pkt.pkt); -+ if (pPacket && pPacket->pkt) -+ memset(&m_pkt.pkt, 0, sizeof(AVPacket)); -+ else -+ av_packet_unref(&m_pkt.pkt); - } - } - } // end of lock scope -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h -index 4f471188c133deb91516311f0082e8741d9dee79..22805781c4d5a957d10fdf74ffa34387f67a25e9 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h -@@ -25,6 +25,8 @@ - #define DMX_SPECIALID_STREAMINFO -10 - #define DMX_SPECIALID_STREAMCHANGE -11 - -+struct AVPacket; -+ - typedef struct DemuxPacket - { - unsigned char* pData; // data -@@ -36,6 +38,7 @@ typedef struct DemuxPacket - double pts; // pts in DVD_TIME_BASE - double dts; // dts in DVD_TIME_BASE - double duration; // duration in DVD_TIME_BASE if available -+ AVPacket *pkt; // to allow packet to be freed - - int dispTime; - } DemuxPacket; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp -index df0f35bd49c65b302de4ccd110d859e8b881ea5f..b4b591ae4c4dd4fb0b36d4d00fedca966f86000f 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp -@@ -39,7 +39,12 @@ void CDVDDemuxUtils::FreeDemuxPacket(DemuxPacket* pPacket) - if (pPacket) - { - try { -- if (pPacket->pData) _aligned_free(pPacket->pData); -+ if (pPacket->pkt) -+ { -+ av_free_packet(pPacket->pkt); -+ delete pPacket->pkt; -+ } -+ else if (pPacket->pData) _aligned_free(pPacket->pData); - delete pPacket; - } - catch(...) { - -From 83250abe1869bc07d70466de8bb6f9d6342aec7c Mon Sep 17 00:00:00 2001 -From: anaconda -Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 17/62] Load OSD dialogs on startup. - -Fixes skipped frames the first time they're loaded in memory on less powered -devices, like a Raspberry Pi, when using DVDPlayer. -See http://forum.kodi.tv/showthread.php?tid=211501&pid=1938811#pid1938811 ---- - xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp | 1 + - xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp | 1 + - xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp | 4 +++- - xbmc/video/dialogs/GUIDialogSubtitles.cpp | 2 +- - xbmc/video/dialogs/GUIDialogVideoOSD.cpp | 2 +- - xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 4 +++- - 6 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -index 1beb8560a1030f6198b22f5d9c082a27dd85d8a8..ca7c90b0c4a7fc34a31fe6dcf787b8980d28df71 100644 ---- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -+++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -@@ -49,6 +49,7 @@ using namespace KODI::MESSAGING; - CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : - CGUIDialog(WINDOW_DIALOG_PVR_OSD_CHANNELS, "DialogPVRChannelsOSD.xml") - { -+ m_loadType = LOAD_ON_GUI_INIT; - m_vecItems = new CFileItemList; - } - -diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp -index 8b472435e26e455249637faf5120055b415fc49e..be1f64d552161f8a86a5c5d89c1bc23328574fb6 100644 ---- a/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp -+++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp -@@ -36,6 +36,7 @@ using namespace PVR; - CGUIDialogPVRGuideOSD::CGUIDialogPVRGuideOSD() - : CGUIDialog(WINDOW_DIALOG_PVR_OSD_GUIDE, "DialogPVRGuideOSD.xml") - { -+ m_loadType = LOAD_ON_GUI_INIT; - m_vecItems = new CFileItemList; - } - -diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -index eb67552344f59b8857b16c882c29e3fa62bed75c..f31572b34d376e70a35003a8c2e175b45daf8070 100644 ---- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -@@ -68,7 +68,9 @@ CGUIDialogAudioSubtitleSettings::CGUIDialogAudioSubtitleSettings() - : CGUIDialogSettingsManualBase(WINDOW_DIALOG_AUDIO_OSD_SETTINGS, "DialogSettings.xml"), - m_passthrough(false), - m_dspEnabled(false) --{ } -+{ -+ m_loadType = LOAD_ON_GUI_INIT; -+} - - CGUIDialogAudioSubtitleSettings::~CGUIDialogAudioSubtitleSettings() - { } -diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.cpp b/xbmc/video/dialogs/GUIDialogSubtitles.cpp -index 398558e4d5d0cae30ee1c73e2b70e3b2f787e8fc..4e8a9b1e307a89d3a7b68402e2ff11b57e7dccd4 100644 ---- a/xbmc/video/dialogs/GUIDialogSubtitles.cpp -+++ b/xbmc/video/dialogs/GUIDialogSubtitles.cpp -@@ -103,7 +103,7 @@ CGUIDialogSubtitles::CGUIDialogSubtitles(void) - , m_pausedOnRun(false) - , m_updateSubsList(false) - { -- m_loadType = KEEP_IN_MEMORY; -+ m_loadType = LOAD_ON_GUI_INIT; - } - - CGUIDialogSubtitles::~CGUIDialogSubtitles(void) -diff --git a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp -index e498e1fd476d9ab5300bb00bc39946a22cfd93cb..a6648d016b07e2eb3e52f8d927697cc53a42fd7b 100644 ---- a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp -+++ b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp -@@ -30,7 +30,7 @@ using namespace PVR; - CGUIDialogVideoOSD::CGUIDialogVideoOSD(void) - : CGUIDialog(WINDOW_DIALOG_VIDEO_OSD, "VideoOSD.xml") - { -- m_loadType = KEEP_IN_MEMORY; -+ m_loadType = LOAD_ON_GUI_INIT; - } - - CGUIDialogVideoOSD::~CGUIDialogVideoOSD(void) -diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -index 0534828dd85520134f7a6890e43a873e223062c1..5a86dfc1e2a54c8fe8d82cb75b612d8e1a0fd2a7 100644 ---- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -@@ -66,7 +66,9 @@ - CGUIDialogVideoSettings::CGUIDialogVideoSettings() - : CGUIDialogSettingsManualBase(WINDOW_DIALOG_VIDEO_OSD_SETTINGS, "DialogSettings.xml"), - m_viewModeChanged(false) --{ } -+{ -+ m_loadType = LOAD_ON_GUI_INIT; -+} - - CGUIDialogVideoSettings::~CGUIDialogVideoSettings() - { } - -From c75aecfa32c369f2728247347c4edd34c3cd5e6a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 14 Apr 2015 20:51:14 +0100 -Subject: [PATCH 18/62] [gui] Also limit GUI updates when in non full-screen - video mode - ---- - xbmc/Application.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index cf77c3dbb84b86c755ee792294760c5c4c38742d..adbfef5f32d3d205f2410e1aabbd8325dd90f8e2 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2762,7 +2762,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) - #if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU) - // This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode - // it makes only sense on architectures with multiple layers -- if (g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback() && m_pPlayer->IsRenderingVideoLayer()) -+ if (m_pPlayer->IsPlayingVideo() && !m_pPlayer->IsPausedPlayback() && m_pPlayer->IsRenderingVideoLayer()) - fps = CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE); - #endif - -@@ -2775,6 +2775,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) - { - if (!m_skipGuiRender) - g_windowManager.Process(CTimeUtils::GetFrameTime()); -+ else if (!g_graphicsContext.IsFullScreenVideo()) -+ g_windowManager.FrameMove(); - } - g_windowManager.FrameMove(); - } - -From 6bbda4d7e81f32b2e046e81fc7ea3d810b117eae Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:58:06 +0100 -Subject: [PATCH 19/62] [screensaver] Leave GUI contents available for - screensaver - ---- - xbmc/guilib/GUIWindowManager.cpp | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index 5808f7ed1e94d68ead7305ba6d284edd4df12bdd..2a3b7f16531c9822e79c77efabdd30acdaa2a3c9 100644 ---- a/xbmc/guilib/GUIWindowManager.cpp -+++ b/xbmc/guilib/GUIWindowManager.cpp -@@ -795,7 +795,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector - int currentWindow = GetActiveWindow(); - CGUIWindow *pWindow = GetWindow(currentWindow); - if (pWindow) -- CloseWindowSync(pWindow, iWindowID); -+ { -+ if (iWindowID == WINDOW_SCREENSAVER) -+ { -+ pWindow->Close(true, iWindowID); -+ } -+ else -+ { -+ CloseWindowSync(pWindow, iWindowID); -+ } -+ } - g_infoManager.SetNextWindow(WINDOW_INVALID); - - // Add window to the history list (we must do this before we activate it, - -From cb881f3dae6d748dcc06616d5937a7f5c806a3a6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 6 Jun 2015 18:43:57 +0100 -Subject: [PATCH 20/62] ffmpeg: Automatic switch to software decode for GMC - with more than one warp point - ---- - ...Signal-unsupported-GMC-with-more-than-one.patch | 48 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 4 +- - tools/depends/target/ffmpeg/autobuild.sh | 2 + - .../VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 6 +++ - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h | 2 + - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 2 +- - xbmc/cores/VideoPlayer/DVDStreamInfo.cpp | 3 ++ - xbmc/cores/VideoPlayer/DVDStreamInfo.h | 1 + - xbmc/cores/omxplayer/OMXHelper.cpp | 8 +++- - 9 files changed, 73 insertions(+), 3 deletions(-) - create mode 100644 tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - -diff --git a/tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch b/tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..4cb8dd8fc466220e5d2539120de79ab123e65713 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -@@ -0,0 +1,48 @@ -+From 84e9a1784bbd3182b68cefa5e5feae8da8b9e184 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Fri, 5 Jun 2015 22:48:33 +0100 -+Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp -+ point -+ -+--- -+ libavcodec/avcodec.h | 1 + -+ libavcodec/mpeg4videodec.c | 4 ++++ -+ 2 files changed, 5 insertions(+) -+ -+diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -+index 8c7c420..e63dc2d 100644 -+--- a/libavcodec/avcodec.h -++++ b/libavcodec/avcodec.h -+@@ -2527,6 +2527,7 @@ typedef struct AVCodecContext { -+ #define FF_BUG_DC_CLIP 4096 -+ #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. -+ #define FF_BUG_TRUNCATED 16384 -++#define FF_BUG_GMC_UNSUPPORTED 32768 -+ -+ /** -+ * strictly follow the standard (MPEG4, ...). -+diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c -+index 9bf33dd..0b5d3b9 100644 -+--- a/libavcodec/mpeg4videodec.c -++++ b/libavcodec/mpeg4videodec.c -+@@ -2179,6 +2179,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) -+ -+ if (ctx->divx_version >= 0) -+ s->workaround_bugs |= FF_BUG_HPEL_CHROMA; -++ -++ if (ctx->num_sprite_warping_points > 1) -++ s->workaround_bugs |= FF_BUG_GMC_UNSUPPORTED; -+ } -+ -+ if (s->workaround_bugs & FF_BUG_STD_QPEL) { -+@@ -2203,6 +2206,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) -+ s->workaround_bugs, ctx->lavc_build, ctx->xvid_build, -+ ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : ""); -+ -++ avctx->workaround_bugs = s->workaround_bugs; -+ if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 && -+ s->codec_id == AV_CODEC_ID_MPEG4 && -+ avctx->idct_algo == FF_IDCT_AUTO) { -+-- -+1.9.1 -+ -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index eaf9fc49319d5f0ee450ddd802bba569e291f0b5..8dd14cdfd053f142f386b6dee1fc0b21bb1f8d93 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,7 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ -+ 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -76,6 +77,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - rm -rf $(PLATFORM); mkdir -p $(PLATFORM) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure -+ cd $(PLATFORM); patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index 5c2976278eb5ec5b8b4a4f9f9c7174b164ab5201..dde29adf425e54f54e4104b3370352db0be6ef40 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -132,6 +132,8 @@ mkdir -p "ffmpeg-${VERSION}" - cd "ffmpeg-${VERSION}" || exit 2 - tar --strip-components=1 -xf $MYDIR/${ARCHIVE} - -+patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+ - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ - --extra-version="kodi-${VERSION}" \ -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index ff3729bde30c0e46de67c4df9b01ee5846c181ee..822b7bf75f2e732b5eed8687403d0eda503fa641 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -47,6 +47,10 @@ - - #include "linux/RBP.h" - -+#ifndef FF_BUG_GMC_UNSUPPORTED -+#define FF_BUG_GMC_UNSUPPORTED 0 -+#endif -+ - using namespace KODI::MESSAGING; - - #define CLASSNAME "CMMALVideoBuffer" -@@ -367,6 +371,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - // we always qualify even if DVDFactoryCodec does this too. - if (!CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMMAL) || hints.software) - return false; -+ if (hints.workaround_bugs & FF_BUG_GMC_UNSUPPORTED) -+ return false; - - std::list deintMethods; - deintMethods.push_back(EINTERLACEMETHOD::VS_INTERLACEMETHOD_AUTO); -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h -index 3bb003b634c83d2c1b0ecd12b53027950e58be99..24341dc23e97e86e1b20b255548573c88e02f064 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h -@@ -157,6 +157,7 @@ public: - type = STREAM_VIDEO; - iOrientation = 0; - iBitsPerPixel = 0; -+ workaround_bugs = 0; - } - - virtual ~CDemuxStreamVideo() {} -@@ -171,6 +172,7 @@ public: - int iOrientation; // orientation of the video in degress counter clockwise - int iBitsPerPixel; - std::string stereo_mode; // expected stereo mode -+ int workaround_bugs; // info for decoder - }; - - class CDemuxStreamAudio : public CDemuxStream -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index e015e65dea43e7b682b704edb7f468b63b8c2ac5..54a18c669a058b705e0276cb7e14522ae6cd04ae 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1416,7 +1416,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - if (!stereoMode.empty()) - st->stereo_mode = stereoMode; - -- -+ st->workaround_bugs = pStream->codec->workaround_bugs; - if ( m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD) ) - { - if (pStream->codec->codec_id == AV_CODEC_ID_PROBE) -diff --git a/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp b/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp -index e59c84c32ff6f108b52955523321f37bd3885986..28dbdd344473338762927f5f2d01425243187a7c 100644 ---- a/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp -+++ b/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp -@@ -74,6 +74,7 @@ void CDVDStreamInfo::Clear() - channellayout = 0; - - orientation = 0; -+ workaround_bugs = 0; - } - - bool CDVDStreamInfo::Equal(const CDVDStreamInfo& right, bool withextradata) -@@ -175,6 +176,7 @@ void CDVDStreamInfo::Assign(const CDVDStreamInfo& right, bool withextradata) - vfr = right.vfr; - software = right.software; - stereo_mode = right.stereo_mode; -+ workaround_bugs = right.workaround_bugs; - - // AUDIO - channels = right.channels; -@@ -233,6 +235,7 @@ void CDVDStreamInfo::Assign(const CDemuxStream& right, bool withextradata) - orientation = stream->iOrientation; - bitsperpixel = stream->iBitsPerPixel; - stereo_mode = stream->stereo_mode; -+ workaround_bugs = stream->workaround_bugs; - } - else if( right.type == STREAM_SUBTITLE ) - { -diff --git a/xbmc/cores/VideoPlayer/DVDStreamInfo.h b/xbmc/cores/VideoPlayer/DVDStreamInfo.h -index f14170850673ebf746df0acf8f5cf5977feae684..85e402bb4e1ddd61bdb657802cc7347c95b9a302 100644 ---- a/xbmc/cores/VideoPlayer/DVDStreamInfo.h -+++ b/xbmc/cores/VideoPlayer/DVDStreamInfo.h -@@ -73,6 +73,7 @@ public: - int orientation; // orientation of the video in degress counter clockwise - int bitsperpixel; - std::string stereo_mode; // stereoscopic 3d mode -+ int workaround_bugs; // info for decoder - - // AUDIO - int channels; -diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -index f135d423c0ca76fd70e79ae5b7d035f0cb79fc75..d9b576bc46055fdab1c134e5f2c63cd4989d015c 100644 ---- a/xbmc/cores/omxplayer/OMXHelper.cpp -+++ b/xbmc/cores/omxplayer/OMXHelper.cpp -@@ -30,6 +30,10 @@ - #include "cores/omxplayer/OMXPlayerVideo.h" - #include "threads/SystemClock.h" - -+#ifndef FF_BUG_GMC_UNSUPPORTED -+#define FF_BUG_GMC_UNSUPPORTED 0 -+#endif -+ - #define PREDICATE_RETURN(lh, rh) \ - do { \ - if((lh) != (rh)) \ -@@ -81,7 +85,9 @@ bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer - CDVDStreamInfo hint(*stream, true); - - bool supported = false; -- if ((hint.codec == AV_CODEC_ID_MPEG1VIDEO || hint.codec == AV_CODEC_ID_MPEG2VIDEO) && g_RBP.GetCodecMpg2()) -+ if (hint.workaround_bugs & FF_BUG_GMC_UNSUPPORTED) -+ ; -+ else if ((hint.codec == AV_CODEC_ID_MPEG1VIDEO || hint.codec == AV_CODEC_ID_MPEG2VIDEO) && g_RBP.GetCodecMpg2()) - supported = true; - else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) - supported = true; - -From b5b121249287c4d102d61ae0aafa05f40e79af44 Mon Sep 17 00:00:00 2001 -From: Claudio-Sjo -Date: Mon, 16 Feb 2015 14:51:26 +0100 -Subject: [PATCH 21/62] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer - - fixes #15794 - ---- - xbmc/filesystem/CDDAFile.cpp | 120 ++++++++++++++++++++++++++++++++----------- - xbmc/filesystem/CDDAFile.h | 3 ++ - 2 files changed, 92 insertions(+), 31 deletions(-) - -diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp -index 722e62602084923bd040803f0e5a5c336a42fa3b..b0f53e5d44e108d88d7af0e46913a7f29328cd31 100644 ---- a/xbmc/filesystem/CDDAFile.cpp -+++ b/xbmc/filesystem/CDDAFile.cpp -@@ -42,10 +42,14 @@ CFileCDDA::CFileCDDA(void) - m_lsnEnd = CDIO_INVALID_LSN; - m_cdio = CLibcdio::GetInstance(); - m_iSectorCount = 52; -+ m_TrackBuf = (uint8_t *) malloc(CDIO_CD_FRAMESIZE_RAW); -+ p_TrackBuf = 0; -+ f_TrackBuf = 0; - } - - CFileCDDA::~CFileCDDA(void) - { -+ free(m_TrackBuf); - Close(); - } - -@@ -53,6 +57,9 @@ bool CFileCDDA::Open(const CURL& url) - { - std::string strURL = url.GetWithoutFilename(); - -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url)) - return false; - -@@ -117,50 +124,98 @@ int CFileCDDA::Stat(const CURL& url, struct __stat64* buffer) - - ssize_t CFileCDDA::Read(void* lpBuf, size_t uiBufSize) - { -- if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -- return -1; - -- if (uiBufSize > SSIZE_MAX) -- uiBufSize = SSIZE_MAX; -+ ssize_t returnValue; -+ int iSectorCount; -+ void *destBuf; - -- // limit number of sectors that fits in buffer by m_iSectorCount -- int iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); - -- if (iSectorCount <= 0) -+ if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -+ { -+ CLog::Log(LOGERROR, "file cdda: Aborted because no disc in drive or no m_pCdIo"); - return -1; -+ } - -- // Are there enough sectors left to read -- if (m_lsnCurrent + iSectorCount > m_lsnEnd) -- iSectorCount = m_lsnEnd - m_lsnCurrent; -+ uiBufSize = std::min( uiBufSize, (size_t)SSIZE_MAX ); - -- // The loop tries to solve read error problem by lowering number of sectors to read (iSectorCount). -- // When problem is solved the proper number of sectors is stored in m_iSectorCount -- int big_iSectorCount = iSectorCount; -- while (iSectorCount > 0) -+ // If we have data in the TrackBuffer, they must be used first -+ if (f_TrackBuf) - { -- int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount); -+ // Get at most the remaining data in m_TrackBuf -+ uiBufSize = std::min(uiBufSize, CDIO_CD_FRAMESIZE_RAW - p_TrackBuf); -+ memcpy(lpBuf, m_TrackBuf + p_TrackBuf, uiBufSize); -+ // Update the data offset -+ p_TrackBuf += uiBufSize; -+ // Is m_TrackBuf empty? -+ f_TrackBuf = (CDIO_CD_FRAMESIZE_RAW == p_TrackBuf); -+ // All done, return read bytes -+ return uiBufSize; -+ } -+ -+ // No data left in buffer -+ -+ // Is this a short read? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // short request, buffer one full sector -+ iSectorCount = 1; -+ destBuf = m_TrackBuf; -+ } -+ else // normal request -+ { -+ // limit number of sectors that fits in buffer by m_iSectorCount -+ iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); -+ destBuf = lpBuf; -+ } - -+ // Are there enough sectors left to read? -+ iSectorCount = std::min(iSectorCount, m_lsnEnd - m_lsnCurrent); -+ -+ // Have we reached EOF? -+ if (iSectorCount == 0) -+ { -+ CLog::Log(LOGNOTICE, "file cdda: Read EoF"); -+ return 0; // Success, but nothing read -+ } // Reached EoF -+ -+ // At leat one sector to read -+ int retries; -+ int iret; -+ // Try reading a decresing number of sectors, then 3 times with 1 sector -+ for (retries = 3; retries > 0; iSectorCount>1 ? iSectorCount-- : retries--) -+ { -+ iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, destBuf, m_lsnCurrent, iSectorCount); - if (iret == DRIVER_OP_SUCCESS) -+ break; // Get out from the loop -+ else - { -- // If lower iSectorCount solved the problem limit it's value -- if (iSectorCount < big_iSectorCount) -- { -- m_iSectorCount = iSectorCount; -- } -- break; -- } -- -- // iSectorCount is low so it cannot solve read problem -- if (iSectorCount <= 10) -- { -- CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -- return -1; -- } -- -- iSectorCount = 10; -+ CLog::Log(LOGERROR, "file cdda: Read cdio error when reading track "); -+ } // Errors when reading file - } -+ // retries == 0 only if failed reading at least one sector -+ if (retries == 0) -+ { -+ CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -+ return -1; -+ } -+ -+ // Update position in file - m_lsnCurrent += iSectorCount; - -+ // Was it a short request? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // We copy the amount if requested data into the destination buffer -+ memcpy(lpBuf, m_TrackBuf, uiBufSize); -+ // and keep track of the first available data -+ p_TrackBuf = uiBufSize; -+ // Finally, we set the buffer flag as TRUE -+ f_TrackBuf = true; -+ // We will return uiBufSize -+ return uiBufSize; -+ } -+ -+ // Otherwise, just return the size of read data - return iSectorCount*CDIO_CD_FRAMESIZE_RAW; - } - -@@ -194,6 +249,9 @@ int64_t CFileCDDA::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/) - - void CFileCDDA::Close() - { -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (m_pCdIo) - { - m_cdio->cdio_destroy(m_pCdIo); -diff --git a/xbmc/filesystem/CDDAFile.h b/xbmc/filesystem/CDDAFile.h -index 0427af4534bfe59a343f0518c7f4242d93299836..e99236294fa8b9b613e465a8ecaf3ad3ba8b5a6f 100644 ---- a/xbmc/filesystem/CDDAFile.h -+++ b/xbmc/filesystem/CDDAFile.h -@@ -50,6 +50,9 @@ protected: - - protected: - CdIo_t* m_pCdIo; -+ uint8_t *m_TrackBuf; -+ size_t p_TrackBuf; -+ int f_TrackBuf; - lsn_t m_lsnStart; // Start of m_iTrack in logical sector number - lsn_t m_lsnCurrent; // Position inside the track in logical sector number - lsn_t m_lsnEnd; // End of m_iTrack in logical sector number - -From 2a304750b765450dfb217e6a51ceeeb2eeb79741 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 24 Jun 2016 19:38:13 +0100 -Subject: [PATCH 22/62] codecoverlay: Include codec name in overlay - ---- - xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 4 ++++ - xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 5 ++++- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 4 ++++ - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 8 +++++--- - xbmc/cores/omxplayer/OMXPlayerVideo.h | 1 - - 5 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -index f822935ab7fc919128db53f70a6c4eb84d9759bc..9db3a9cc91fd5f9b194d6c1aa66aa02121164c29 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -@@ -210,6 +210,10 @@ void CVideoPlayerAudio::UpdatePlayerInfo() - std::ostringstream s; - s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel()) << "%"; - s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0; -+ s << ", ac:" << m_processInfo.GetAudioDecoderName().c_str(); -+ if (!m_info.passthrough) -+ s << ", chan:" << m_processInfo.GetAudioChannels().c_str(); -+ s << ", " << m_streaminfo.samplerate/1000 << " kHz"; - - //print the inverse of the resample ratio, since that makes more sense - //if the resample ratio is 0.5, then we're playing twice as fast -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -index 89db27cce079e3e273050f2fa71f941f21b8280b..903f0d83527d9088ff1bf0ba056f357f6abfda81 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -@@ -895,10 +895,13 @@ int CVideoPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - - std::string CVideoPlayerVideo::GetPlayerInfo() - { -+ int width, height; -+ m_processInfo.GetVideoDimensions(width, height); - std::ostringstream s; - s << "vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; - s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0); -- s << ", fr:" << std::fixed << std::setprecision(3) << m_fFrameRate; -+ s << ", dc:" << m_processInfo.GetVideoDecoderName().c_str(); -+ s << ", " << width << "x" << height << "[" << std::setprecision(2) << m_processInfo.GetVideoDAR() << "]@" << std::fixed << std::setprecision(3) << m_processInfo.GetVideoFps() << ", deint:" << m_processInfo.GetVideoDeintMethod(); - s << ", drop:" << m_iDroppedFrames; - s << ", skip:" << m_renderManager.GetSkippedFrames(); - -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index 1e5d2b98bbef15b47994c3e4735873a9946b58c7..d43350fa0eefb5960475a02c1327efc24d138e0f 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -659,6 +659,10 @@ std::string OMXPlayerAudio::GetPlayerInfo() - std::ostringstream s; - s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel() + MathUtils::round_int(100.0/8.0*GetCacheTime())) << "%"; - s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0; -+ s << ", ac:" << m_processInfo.GetAudioDecoderName().c_str(); -+ if (!m_passthrough) -+ s << ", chan:" << m_processInfo.GetAudioChannels().c_str(); -+ s << ", " << m_processInfo.GetAudioSampleRate()/1000 << " kHz"; - - return s.str(); - } -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index a4b663d43d5b626e351256a1dd10650a282b494c..f6fb241dfec9269f4e501248de4dc83d5fdc2d3a 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -593,12 +593,14 @@ void OMXPlayerVideo::SetSpeed(int speed) - - std::string OMXPlayerVideo::GetPlayerInfo() - { -+ int width, height; -+ m_processInfo.GetVideoDimensions(width, height); - double match = 0.0f, phase = 0.0f, pll = 0.0f; - std::ostringstream s; -- s << "fr:" << std::fixed << std::setprecision(3) << m_fFrameRate; -- s << ", vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; -- s << ", dc:" << m_codecname; -+ s << "vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; - s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0); -+ s << ", dc:" << m_processInfo.GetVideoDecoderName().c_str(); -+ s << ", " << width << "x" << height << "[" << std::setprecision(2) << m_processInfo.GetVideoDAR() << "]@" << std::fixed << std::setprecision(3) << m_processInfo.GetVideoFps() << ", deint:" << m_processInfo.GetVideoDeintMethod(); - if (m_omxVideo.GetPlayerInfo(match, phase, pll)) - { - s << ", match:" << std::fixed << std::setprecision(2) << match; -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h -index 0df7e72cc9d1947173c2bac5e72eb09976b51aa5..b5050081c360d29b1b478c27e6b88291e20ecdac 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.h -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h -@@ -55,7 +55,6 @@ protected: - bool m_stalled; - IDVDStreamPlayer::ESyncState m_syncState; - bool m_flush; -- std::string m_codecname; - std::atomic_bool m_bAbortOutput; - double m_iSubtitleDelay; - bool m_bRenderSubs; - -From 9ebfa6f23b211491275577d8022c4f83b5171ba4 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Tue, 8 Mar 2016 21:20:58 +0300 -Subject: [PATCH 23/62] [DebugInfo] Add cpu usage info. - ---- - .../VideoPlayer/VideoRenderers/DebugRenderer.cpp | 56 ++++++++-------------- - .../VideoPlayer/VideoRenderers/DebugRenderer.h | 9 ++-- - .../VideoPlayer/VideoRenderers/RenderManager.cpp | 7 ++- - 3 files changed, 30 insertions(+), 42 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp -index 539a560f9554478ad25a5631121dc74e667d9b40..08721e153e5f3232585eb776d1d1b44396f63de4 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp -@@ -28,7 +28,7 @@ using namespace OVERLAY; - - CDebugRenderer::CDebugRenderer() - { -- for (int i=0; i<4; i++) -+ for (int i = 0; iRelease(); - } - } - --void CDebugRenderer::SetInfo(std::string &info1, std::string &info2, std::string &info3, std::string &info4) -+void CDebugRenderer::SetInfo(std::vector &infos) - { - m_overlayRenderer.Release(0); - -- if (info1 != m_strDebug[0]) -+ for (size_t i = 0; i < std::min(infos.size(), (size_t)DEBUG_OVERLAY_COUNT_MAX); i++) - { -- m_strDebug[0] = info1; -- if (m_overlay[0]) -- m_overlay[0]->Release(); -- m_overlay[0] = new CDVDOverlayText(); -- m_overlay[0]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[0])); -- } -- if (info2 != m_strDebug[1]) -- { -- m_strDebug[1] = info2; -- if (m_overlay[1]) -- m_overlay[1]->Release(); -- m_overlay[1] = new CDVDOverlayText(); -- m_overlay[1]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[1])); -- } -- if (info3 != m_strDebug[2]) -- { -- m_strDebug[2] = info3; -- if (m_overlay[2]) -- m_overlay[2]->Release(); -- m_overlay[2] = new CDVDOverlayText(); -- m_overlay[2]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[2])); -+ if (infos[i] != m_strDebug[i]) -+ { -+ if (infos[i].empty()) -+ continue; -+ m_strDebug[i] = infos[i]; -+ if (m_overlay[i]) -+ m_overlay[i]->Release(); -+ m_overlay[i] = new CDVDOverlayText(); -+ m_overlay[i]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[i])); -+ } -+ - } -- if (info4 != m_strDebug[3]) -+ for (size_t i = 0; i < DEBUG_OVERLAY_COUNT_MAX; i++) - { -- m_strDebug[3] = info4; -- if (m_overlay[3]) -- m_overlay[3]->Release(); -- m_overlay[3] = new CDVDOverlayText(); -- m_overlay[3]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[3])); -+ if (m_overlay[i]) -+ m_overlayRenderer.AddOverlay(m_overlay[i], 0, 0); - } -- -- m_overlayRenderer.AddOverlay(m_overlay[0], 0, 0); -- m_overlayRenderer.AddOverlay(m_overlay[1], 0, 0); -- m_overlayRenderer.AddOverlay(m_overlay[2], 0, 0); -- m_overlayRenderer.AddOverlay(m_overlay[3], 0, 0); - } - - void CDebugRenderer::Render(CRect &src, CRect &dst, CRect &view) -@@ -121,7 +103,7 @@ void CDebugRenderer::CRenderer::Render(int idx) - - COverlayText *text = dynamic_cast(o); - if (text) -- text->PrepareRender("arial.ttf", 1, 16, 0, m_font, m_fontBorder); -+ text->PrepareRender("arial.ttf", 1, 12, 0, m_font, m_fontBorder); - - RESOLUTION_INFO res = g_graphicsContext.GetResInfo(g_graphicsContext.GetVideoResolution()); - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h -index 85aefaace73994730f7d2bdff9de85c79e99b2a2..8005a13bc220be0c5c596d276197c11ed938ffb0 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h -@@ -22,6 +22,9 @@ - - #include "OverlayRenderer.h" - #include -+#include -+ -+#define DEBUG_OVERLAY_COUNT_MAX 6 - - class CDVDOverlayText; - -@@ -30,7 +33,7 @@ class CDebugRenderer - public: - CDebugRenderer(); - virtual ~CDebugRenderer(); -- void SetInfo(std::string &info1, std::string &info2, std::string &info3, std::string &info4); -+ void SetInfo(std::vector &infos); - void Render(CRect &src, CRect &dst, CRect &view); - void Flush(); - -@@ -43,7 +46,7 @@ protected: - void Render(int idx) override; - }; - -- std::string m_strDebug[4]; -- CDVDOverlayText *m_overlay[4]; -+ std::string m_strDebug[DEBUG_OVERLAY_COUNT_MAX]; -+ CDVDOverlayText *m_overlay[DEBUG_OVERLAY_COUNT_MAX]; - CRenderer m_overlayRenderer; - }; -\ No newline at end of file -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -index 17c428cb28018707d7422f344191b218903ab29b..8626a1b449ff0963089f6a7ad191a6c99512521a 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -@@ -24,6 +24,7 @@ - #include "guilib/GraphicContext.h" - #include "utils/MathUtils.h" - #include "threads/SingleLock.h" -+#include "utils/CPUInfo.h" - #include "utils/log.h" - #include "utils/StringUtils.h" - #include "windowing/WindowingFactory.h" -@@ -926,7 +927,7 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui) - - if (m_renderDebug) - { -- std::string audio, video, player, vsync; -+ std::string audio, video, player, vsync, cpu; - - m_playerPort->GetDebugInfo(audio, video, player); - -@@ -940,8 +941,10 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui) - missedvblanks, - clockspeed * 100); - } -+ cpu = g_cpuInfo.GetCoresUsageString(); - -- m_debugRenderer.SetInfo(audio, video, player, vsync); -+ std::vector infos = { audio, video, player, vsync, cpu }; -+ m_debugRenderer.SetInfo(infos); - m_debugRenderer.Render(src, dst, view); - - m_debugTimer.Set(1000); - -From 37fedb68b098941bbdc5ace022806c75c908caf6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 22 May 2015 13:56:29 +0100 -Subject: [PATCH 24/62] ffmpeg: Allow neon to be enabled in unified builds - ---- - tools/depends/target/ffmpeg/Makefile | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 8dd14cdfd053f142f386b6dee1fc0b21bb1f8d93..b5f38a458dfb341c43089e07afded153e234b9cd 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -23,7 +23,11 @@ ffmpg_config += --enable-gnutls - ffmpg_config += --enable-encoder=png --enable-encoder=mjpeg - - ifeq ($(CROSS_COMPILING), yes) -+ ifeq ($(CPU), cortex-a7) -+ ffmpg_config += --arch=arm --enable-cross-compile -+ else - ffmpg_config += --arch=$(CPU) --enable-cross-compile -+ endif - endif - ifeq ($(OS), linux) - ffmpg_config += --target-os=$(OS) --cpu=$(CPU) - -From 2bfb7a3ff98dd858389dd3d064d8a3dc52a72af8 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Feb 2015 14:37:27 +0000 -Subject: [PATCH 25/62] ffmpeg: Add some upstream HEVC optimisations - ---- - tools/depends/target/ffmpeg/Makefile | 6 +- - .../added_ARM_NEON_optimized_SAO_patches.patch | 3328 ++++++++++++++++++++ - tools/depends/target/ffmpeg/autobuild.sh | 2 + - ...hevcdsp_ARM_NEON_optimized_epel_functions.patch | 409 +++ - 4 files changed, 3744 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch - create mode 100644 tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index b5f38a458dfb341c43089e07afded153e234b9cd..c46b533e47497cb7b1e7200eff2cee1a6f2a1a2f 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,7 +1,8 @@ - include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ -- 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+ 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -82,6 +83,9 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+ cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch -+ - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch b/tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..792b5fea581613a6fe9108443357f97518f4b4db ---- /dev/null -+++ b/tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch -@@ -0,0 +1,3328 @@ -+From b0cb307c253d2c9f4b94a54dfc74ddb83af984cc Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Mon, 8 Dec 2014 13:24:40 +0200 -+Subject: [PATCH 1/9] added ARM NEON optimized SAO band offset -+ -+--- -+ libavcodec/arm/Makefile | 3 +- -+ libavcodec/arm/hevcdsp_init_neon.c | 47 +++++++++ -+ libavcodec/arm/hevcdsp_sao_neon.S | 204 +++++++++++++++++++++++++++++++++++++ -+ 3 files changed, 253 insertions(+), 1 deletion(-) -+ create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index 6051ec8..093a2e8 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -133,7 +133,8 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ -+ arm/hevcdsp_deblock_neon.o \ -+ arm/hevcdsp_epel_neon.o \ -+ arm/hevcdsp_idct_neon.o \ -+- arm/hevcdsp_qpel_neon.o -++ arm/hevcdsp_qpel_neon.o \ -++ arm/hevcdsp_sao_neon.o -+ NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -+ NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ -+ arm/rv40dsp_neon.o -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 733ff08..69e2b2c 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -22,6 +22,7 @@ -+ #include "libavutil/arm/cpu.h" -+ #include "libavcodec/hevcdsp.h" -+ #include "hevcdsp_arm.h" -++#include "../bit_depth_template.c" -+ -+ void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+ void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+@@ -43,6 +44,11 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, -+ void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, -+ ptrdiff_t stride); -+ -++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++ -+ #define PUT_PIXELS(name) \ -+ void name(int16_t *dst, uint8_t *src, \ -+ ptrdiff_t srcstride, int height, \ -+@@ -151,6 +157,44 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t -+ put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); -+ } -+ -++static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, -++ int16_t *sao_offset_val, int sao_left_class, int width, int height) -++{ -++ pixel *dst = (pixel *)_dst; -++ pixel *src = (pixel *)_src; -++ int8_t offset_table[32] = { 0 }; -++ int k, y, x; -++ int shift = 3; // BIT_DEPTH - 5 -++ -++ stride_src /= sizeof(pixel); -++ stride_dst /= sizeof(pixel); -++ -++ for (k = 0; k < 4; k++) -++ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; -++ -++ switch(width){ -++ case 8: -++ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ case 16: -++ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ case 32: -++ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ case 64: -++ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ default: -++ for (y = 0; y < height; y++) { -++ for (x = 0; x < width; x++) -++ dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); -++ dst += stride_dst; -++ src += stride_src; -++ } -++ } -++} -++ -+ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ { -+ if (bit_depth == 8) { -+@@ -170,6 +214,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->transform_add[2] = ff_hevc_transform_add_16x16_neon_8; -+ c->transform_add[3] = ff_hevc_transform_add_32x32_neon_8; -+ c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; -++ for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { -++ c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; -++ } -+ put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; -+ put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; -+ put_hevc_qpel_neon[3][0] = ff_hevc_put_qpel_v3_neon_8; -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+new file mode 100644 -+index 0000000..1f0ad64 -+--- /dev/null -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -0,0 +1,204 @@ -++/* -++ * Copyright (c) 2014 Seppo Tomperi -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++#include "neon.S" -++ -++function ff_hevc_sao_band_w8_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {d24}, [r1], r3 -++ vshr.u8 d16, d24, #3 -++ vtbl.8 d16, {q0, q1}, d16 -++ vmovl.s8 q2, d16 -++ vmovl.u8 q6, d24 -++ vadd.s16 q2, q6 -++ vqmovun.s16 d4, q2 -++ vst1.8 {d4}, [r0], r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w16_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {q12}, [r1], r3 -++ -++ vshr.u8 q8, q12, #3 -++ -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ -++ vmovl.s8 q2, d16 -++ vmovl.s8 q3, d17 -++ -++ vmovl.u8 q6, d24 -++ vmovl.u8 q7, d25 -++ -++ vadd.s16 q2, q6 -++ vadd.s16 q3, q7 -++ -++ vqmovun.s16 d4, q2 -++ vqmovun.s16 d5, q3 -++ -++ vstm.8 r0, {q2} -++ add r0, r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {q12-q13}, [r1], r3 -++ -++ vshr.u8 q8, q12, #3 -++ vshr.u8 q9, q13, #3 -++ -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ vtbl.8 d18, {q0, q1}, d18 -++ vtbl.8 d19, {q0, q1}, d19 -++ -++ vmovl.s8 q2, d16 -++ vmovl.s8 q3, d17 // q8 free -++ vmovl.s8 q4, d18 -++ vmovl.s8 q5, d19 // q9 free -++ -++ vmovl.u8 q6, d24 -++ vmovl.u8 q7, d25 // q12 free -++ vmovl.u8 q8, d26 -++ vmovl.u8 q9, d27 // q13 free -++ -++ vadd.s16 q2, q6 -++ vadd.s16 q3, q7 -++ vadd.s16 q4, q8 -++ vadd.s16 q5, q9 -++ -++ vqmovun.s16 d4, q2 -++ vqmovun.s16 d5, q3 -++ vqmovun.s16 d6, q4 // q4 free -++ vqmovun.s16 d7, q5 // q5 free -++ -++ vst1.8 {q2-q3}, [r0], r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {q12-q13}, [r1]! -++ vld1.8 {q14-q15}, [r1], r3 -++ sub r1, #32 -++ -++ vshr.u8 q8, q12, #3 -++ vshr.u8 q9, q13, #3 -++ vshr.u8 q10, q14, #3 -++ vshr.u8 q11, q15, #3 -++ -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ vtbl.8 d18, {q0, q1}, d18 -++ vtbl.8 d19, {q0, q1}, d19 -++ vtbl.8 d20, {q0, q1}, d20 -++ vtbl.8 d21, {q0, q1}, d21 -++ vtbl.8 d22, {q0, q1}, d22 -++ vtbl.8 d23, {q0, q1}, d23 -++ -++ vmovl.s8 q2, d16 -++ vmovl.s8 q3, d17 // q8 free -++ vmovl.s8 q4, d18 -++ vmovl.s8 q5, d19 // q9 free -++ -++ vmovl.u8 q6, d24 -++ vmovl.u8 q7, d25 // q12 free -++ vmovl.u8 q8, d26 -++ vmovl.u8 q9, d27 // q13 free -++ -++ vadd.s16 q2, q6 -++ vadd.s16 q3, q7 -++ vadd.s16 q4, q8 -++ vadd.s16 q5, q9 -++ -++ vqmovun.s16 d4, q2 -++ vqmovun.s16 d5, q3 -++ vqmovun.s16 d6, q4 // q4 free -++ vqmovun.s16 d7, q5 // q5 free -++ -++ // free q4 -q9, q12 - q13 -++ vmovl.s8 q4, d20 -++ vmovl.s8 q5, d21 // q10 free -++ vmovl.s8 q6, d22 -++ vmovl.s8 q7, d23 // q11 free -++ -++ vmovl.u8 q8, d28 -++ vmovl.u8 q9, d29 // q14 free -++ vmovl.u8 q10, d30 -++ vmovl.u8 q11, d31 // q15 free -++ -++ vadd.s16 q4, q8 -++ vadd.s16 q5, q9 -++ vadd.s16 q6, q10 -++ vadd.s16 q7, q11 -++ -++ vqmovun.s16 d8, q4 -++ vqmovun.s16 d9, q5 -++ vqmovun.s16 d10, q6 -++ vqmovun.s16 d11, q7 -++ -++ vstm.8 r0, {q2-q5} -++ add r0, r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -+-- -+2.5.0 -+ -+ -+From 8429b1de64bb871d57651ecfe3b084e2dfe0af51 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Wed, 27 May 2015 18:10:20 +0100 -+Subject: [PATCH 2/9] added NEON optimized sao edge for eo1 width 64 -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 47 ++++++++++++ -+ libavcodec/arm/hevcdsp_sao_neon.S | 147 +++++++++++++++++++++++++++++++++++++ -+ 2 files changed, 194 insertions(+) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 69e2b2c..c7b5404 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -22,6 +22,7 @@ -+ #include "libavutil/arm/cpu.h" -+ #include "libavcodec/hevcdsp.h" -+ #include "hevcdsp_arm.h" -++#include "libavcodec/avcodec.h" -+ #include "../bit_depth_template.c" -+ -+ void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+@@ -48,6 +49,7 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d -+ void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ -+ #define PUT_PIXELS(name) \ -+ void name(int16_t *dst, uint8_t *src, \ -+@@ -195,6 +197,50 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ } -+ } -+ -++#define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) -++static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst, -++ int16_t *_sao_offset_val, int eo, int width, int height) -++{ -++ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; -++ static const int8_t pos[4][2][2] = { -++ { { -1, 0 }, { 1, 0 } }, // horizontal -++ { { 0, -1 }, { 0, 1 } }, // vertical -++ { { -1, -1 }, { 1, 1 } }, // 45 degree -++ { { 1, -1 }, { -1, 1 } }, // 135 degree -++ }; -++ int8_t sao_offset_val[8]; // padding of 3 for vld -++ ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); -++ pixel *dst = (pixel *)_dst; -++ pixel *src = (pixel *)_src; -++ int a_stride, b_stride; -++ int x, y; -++ -++ for (x = 0; x < 5; x++) { -++ sao_offset_val[x] = _sao_offset_val[x]; -++ } -++ -++ stride_src /= sizeof(pixel); -++ stride_dst /= sizeof(pixel); -++ -++ if (eo == 1 && width == 64) { -++ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ } else { -++ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; -++ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; -++ for (y = 0; y < height; y++) { -++ for (x = 0; x < width; x++) { -++ int diff0 = CMP(src[x], src[x + a_stride]); -++ int diff1 = CMP(src[x], src[x + b_stride]); -++ int offset_val = edge_idx[2 + diff0 + diff1]; -++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -++ } -++ src += stride_src; -++ dst += stride_dst; -++ } -++ } -++} -++#undef CMP -++ -+ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ { -+ if (bit_depth == 8) { -+@@ -216,6 +262,7 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; -+ for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { -+ c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; -++ c->sao_edge_filter[x] = ff_hevc_sao_edge_neon_wrapper; -+ } -+ put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; -+ put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 1f0ad64..5ec2de9 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -202,3 +202,150 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ bx lr -+ endfunc -+ -++function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x02 -++ vpush {d8-d15} -++1: subs r4, #1 -++ // load a -++ sub r1, r3 -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #32 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1], r3 -++ sub r1, #32 -++ -++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q5, q1 -++ vcgt.u8 q1, q1, q5 -++ vcgt.u8 q14, q6, q2 -++ vcgt.u8 q2, q2, q6 -++ vcgt.u8 q15, q7, q3 -++ vcgt.u8 q3, q3, q7 -++ -++ vsub.s8 q12, q0, q12 // diff0 -++ vsub.s8 q13, q1, q13 -++ vsub.s8 q14, q2, q14 -++ vsub.s8 q15, q3, q15 -++ -++ vcgt.u8 q0, q4, q8 // c > b -++ vcgt.u8 q8, q8, q4 // b > c -++ vcgt.u8 q1, q5, q9 -++ vcgt.u8 q9, q9, q5 -++ vcgt.u8 q2, q6, q10 -++ vcgt.u8 q10, q10, q6 -++ vcgt.u8 q3, q7, q11 -++ vcgt.u8 q11, q11, q7 -++ -++ vsub.s8 q0, q8, q0 // diff1 -++ vsub.s8 q1, q9, q1 -++ vsub.s8 q2, q10, q2 -++ vsub.s8 q3, q11, q3 -++ -++ veor.u8 q8, q8 // zero register -++ vdup.s8 q9, r6 // 2 to all elements -++ add r6, #1 -++ vdup.s8 q10, r6 // 3 to all elements -++ sub r6, #1 -++ -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q15 -++ -++ vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 -++ vcgt.s8 q5, q1, q8 -++ vcgt.s8 q6, q2, q8 -++ vcgt.s8 q7, q3, q8 -++ -++ vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 -++ vclt.s8 q12, q1, q8 -++ vclt.s8 q13, q2, q8 -++ vclt.s8 q14, q3, q8 -++ -++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -++ vand.8 q15, q8, q4 -++ vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 -++ vand.8 q8, q8, q11 -++ vadd.s8 q0, q15, q8 // offset_idx -++ -++ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -++ vand.8 q15, q8, q5 -++ vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 -++ vand.8 q8, q8, q12 -++ vadd.s8 q1, q15, q8 // offset_idx -++ -++ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 -++ vand.8 q15, q8, q6 -++ vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 -++ vand.8 q8, q8, q13 -++ vadd.s8 q2, q15, q8 // offset_idx -++ -++ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 -++ vand.8 q15, q8, q7 -++ vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 -++ vand.8 q8, q8, q14 -++ vadd.s8 q3, q15, q8 // offset_idx -++ // TODO: load only once -++ vld1.8 d16, [r5] -++ -++ vtbl.8 d0, {d16}, d0 -++ vtbl.8 d1, {d16}, d1 -++ vtbl.8 d2, {d16}, d2 -++ vtbl.8 d3, {d16}, d3 -++ vtbl.8 d4, {d16}, d4 -++ vtbl.8 d5, {d16}, d5 -++ vtbl.8 d6, {d16}, d6 -++ vtbl.8 d7, {d16}, d7 -++ -++ // TODO: load only once -++ // load c again -++ sub r1, r3 -++ sub r1, r3 -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ -++ vmovl.u8 q8, d8 -++ vmovl.u8 q9, d9 -++ vmovl.u8 q10, d10 -++ vmovl.u8 q11, d11 -++ vmovl.u8 q12, d12 -++ vmovl.u8 q13, d13 -++ vmovl.u8 q14, d14 -++ vmovl.u8 q15, d15 -++ -++ vaddw.s8 q8, d0 -++ vaddw.s8 q9, d1 -++ vaddw.s8 q10, d2 -++ vaddw.s8 q11, d3 -++ vaddw.s8 q12, d4 -++ vaddw.s8 q13, d5 -++ vaddw.s8 q14, d6 -++ vaddw.s8 q15, d7 -++ -++ vqmovun.s16 d0, q8 -++ vqmovun.s16 d1, q9 -++ vqmovun.s16 d2, q10 -++ vqmovun.s16 d3, q11 -++ vqmovun.s16 d4, q12 -++ vqmovun.s16 d5, q13 -++ vqmovun.s16 d6, q14 -++ vqmovun.s16 d7, q15 -++ -++ vstm r0, {q0-q3} -++ add r0, r2 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -+-- -+2.5.0 -+ -+ -+From 402e2bd1c5ad659c757bf9734abe6331904fb9e2 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Tue, 16 Dec 2014 16:28:25 +0200 -+Subject: [PATCH 3/9] Added SAO edge offset for ARM NEON w32 and w64 -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 46 +++- -+ libavcodec/arm/hevcdsp_sao_neon.S | 510 +++++++++++++++++++++++++++++++------ -+ 2 files changed, 474 insertions(+), 82 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index c7b5404..c32940e 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -49,7 +49,16 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d -+ void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++ -++void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo2_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo3_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++ -++void ff_hevc_sao_edge_eo0_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo2_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo3_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ -+ #define PUT_PIXELS(name) \ -+ void name(int16_t *dst, uint8_t *src, \ -+@@ -222,9 +231,40 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+- if (eo == 1 && width == 64) { -+- ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+- } else { -++ switch (width) { -++ case 32: -++ switch(eo) { -++ case 0: -++ ff_hevc_sao_edge_eo0_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 1: -++ ff_hevc_sao_edge_eo1_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 2: -++ ff_hevc_sao_edge_eo2_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 3: -++ ff_hevc_sao_edge_eo3_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ } -++ break; -++ case 64: -++ switch(eo) { -++ case 0: -++ ff_hevc_sao_edge_eo0_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 1: -++ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 2: -++ ff_hevc_sao_edge_eo2_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 3: -++ ff_hevc_sao_edge_eo3_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ } -++ break; -++ default: -+ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; -+ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; -+ for (y = 0; y < height; y++) { -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 5ec2de9..4687012 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -202,27 +202,7 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ bx lr -+ endfunc -+ -+-function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x02 -+- vpush {d8-d15} -+-1: subs r4, #1 -+- // load a -+- sub r1, r3 -+- vld1.8 {q0-q1}, [r1]! -+- vld1.8 {q2-q3}, [r1], r3 -+- sub r1, #32 -+- // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -+- sub r1, #32 -+- // load b -+- vld1.8 {q8-q9}, [r1]! -+- vld1.8 {q10-q11}, [r1], r3 -+- sub r1, #32 -+- -++.macro edge_w64_body -+ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+ vcgt.u8 q13, q5, q1 -+@@ -251,69 +231,61 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ vsub.s8 q2, q10, q2 -+ vsub.s8 q3, q11, q3 -+ -+- veor.u8 q8, q8 // zero register -+- vdup.s8 q9, r6 // 2 to all elements -+- add r6, #1 -+- vdup.s8 q10, r6 // 3 to all elements -+- sub r6, #1 -+- -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ vadd.s8 q2, q14 -+ vadd.s8 q3, q15 -+ -+- vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 -+- vcgt.s8 q5, q1, q8 -+- vcgt.s8 q6, q2, q8 -+- vcgt.s8 q7, q3, q8 -+- -+- vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 -+- vclt.s8 q12, q1, q8 -+- vclt.s8 q13, q2, q8 -+- vclt.s8 q14, q3, q8 -+- -+- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -+- vand.8 q15, q8, q4 -+- vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 -+- vand.8 q8, q8, q11 -+- vadd.s8 q0, q15, q8 // offset_idx -+- -+- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -+- vand.8 q15, q8, q5 -+- vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 -+- vand.8 q8, q8, q12 -+- vadd.s8 q1, q15, q8 // offset_idx -+- -+- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 -+- vand.8 q15, q8, q6 -+- vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 -+- vand.8 q8, q8, q13 -+- vadd.s8 q2, q15, q8 // offset_idx -+- -+- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 -+- vand.8 q15, q8, q7 -+- vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 -+- vand.8 q8, q8, q14 -+- vadd.s8 q3, q15, q8 // offset_idx -+- // TODO: load only once -+- vld1.8 d16, [r5] -+- -+- vtbl.8 d0, {d16}, d0 -+- vtbl.8 d1, {d16}, d1 -+- vtbl.8 d2, {d16}, d2 -+- vtbl.8 d3, {d16}, d3 -+- vtbl.8 d4, {d16}, d4 -+- vtbl.8 d5, {d16}, d5 -+- vtbl.8 d6, {d16}, d6 -+- vtbl.8 d7, {d16}, d7 -+- -+- // TODO: load only once -+- // load c again -+- sub r1, r3 -+- sub r1, r3 -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -+- sub r1, #32 -++ vdup.s8 q9, r6 // 3 to all elements -++ sub r6, #1 -++ -++ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -++ vclt.s8 q13, q1, #0 -++ vclt.s8 q14, q2, #0 -++ vclt.s8 q15, q3, #0 -++ -++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 -++ vadd.s8 q10, q1, q9 -++ vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -++ vand.8 q13, q10, q13 -++ vadd.s8 q8, q2, q9 -++ vadd.s8 q10, q3, q9 -++ vand.8 q14, q8, q14 -++ vand.8 q15, q10, q15 -++ -++ vdup.s8 q9, r6 // 2 to all elements -++ add r6, #1 -++ -++ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vcgt.s8 q10, q1, #0 -++ vadd.s8 q0, q11, q12 // offset_idx -++ -++ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -++ vcgt.s8 q12, q2, #0 -++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 -++ vadd.s8 q1, q11, q13 -++ -++ vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vcgt.s8 q10, q3, #0 -++ vadd.s8 q2, q11, q14 -++ -++ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 -++ vmov.32 d18[0], r7 // load offset table from general registers -++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vmov.32 d18[1], r5 // load rest of offset table -++ vadd.s8 q3, q11, q15 -++ -++ vtbl.8 d0, {d18}, d0 -++ vtbl.8 d1, {d18}, d1 -++ vtbl.8 d2, {d18}, d2 -++ vtbl.8 d3, {d18}, d3 -++ vtbl.8 d4, {d18}, d4 -++ vtbl.8 d5, {d18}, d5 -++ vtbl.8 d6, {d18}, d6 -++ vtbl.8 d7, {d18}, d7 -+ -+ vmovl.u8 q8, d8 -+ vmovl.u8 q9, d9 -+@@ -344,8 +316,388 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ -+ vstm r0, {q0-q3} -+ add r0, r2 -++.endm -++ -++.macro edge_w32_body -++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q5, q1 -++ vcgt.u8 q1, q1, q5 -++ -++ vsub.s8 q12, q0, q12 // diff0 -++ vcgt.u8 q0, q4, q8 // c > b -++ vsub.s8 q13, q1, q13 // diff0 part 2 -++ -++ vcgt.u8 q6, q8, q4 // b > c -++ vcgt.u8 q1, q5, q9 -++ vcgt.u8 q7, q9, q5 -++ -++ vsub.s8 q0, q6, q0 // diff1 -++ vsub.s8 q1, q7, q1 // diff1 part 2 -++ vadd.s8 q0, q12 //diff0 + diff1 -++ -++ vdup.s8 q7, r6 // 3 to all elements -++ sub r6, #1 -++ vadd.s8 q1, q13 -++ -++ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -++ vclt.s8 q13, q1, #0 -++ -++ vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 -++ vadd.s8 q10, q1, q7 -++ vdup.s8 q7, r6 // 2 to all elements -++ add r6, #1 -++ vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -++ vand.8 q13, q10, q13 -++ -++ -++ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -++ vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 -++ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vcgt.s8 q10, q1, #0 -++ vadd.s8 q0, q11, q12 // offset_idx -++ -++ vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 -++ vmov.32 d14[0], r7 // load offset table from general registers -++ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vmov.32 d14[1], r5 // load rest of offset table -++ vadd.s8 q1, q11, q13 -++ -++ vtbl.8 d0, {d14}, d0 -++ vtbl.8 d1, {d14}, d1 -++ vtbl.8 d2, {d14}, d2 -++ vtbl.8 d3, {d14}, d3 -++ -++ vmovl.u8 q6, d8 -++ vmovl.u8 q7, d9 -++ vmovl.u8 q10, d10 -++ vmovl.u8 q11, d11 -++ -++ vaddw.s8 q6, d0 -++ vaddw.s8 q7, d1 -++ vaddw.s8 q10, d2 -++ vaddw.s8 q11, d3 -++ -++ vqmovun.s16 d0, q6 -++ vqmovun.s16 d1, q7 -++ vqmovun.s16 d2, q10 -++ vqmovun.s16 d3, q11 -++ -++ vstm r0, {q0-q1} -++ add r0, r2 -++.endm -++ -++function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ sub r1, #8 -++1: subs r4, #1 -++ vld1.64 {q10-q11}, [r1]! -++ vld1.64 {q12-q13}, [r1]! -++ vld1.64 {q14}, [r1], r3 -++ sub r1, #64 -++ // load a -++ vext.8 q0, q10, q11, #7 -++ vext.8 q1, q11, q12, #7 -++ vext.8 q2, q12, q13, #7 -++ vext.8 q3, q13, q14, #7 -++ // load c -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ vext.8 q6, q12, q13, #8 -++ vext.8 q7, q13, q14, #8 -++ // load b -++ vext.8 q8, q10, q11, #9 -++ vext.8 q9, q11, q12, #9 -++ vext.8 q10, q12, q13, #9 -++ vext.8 q11, q13, q14, #9 -++ edge_w64_body -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ sub r1, r3 -++ // load a -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #32 -++1: subs r4, #1 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1] -++ sub r1, #32 -++ edge_w64_body -++ // copy c to a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ vmov.64 q2, q6 -++ vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+ endfunc -++ -++function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++1: sub r1, r3 -++ // load a -++ // TODO: fix unaligned load -++ // don't reload a like in eo1 -++ sub r1, #1 -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #31 -++ subs r4, #1 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ add r1, #1 -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1] -++ sub r1, #33 -++ edge_w64_body -++ // copy c to a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ vmov.64 q2, q6 -++ vmov.64 q3, q7 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++1: sub r1, r3 -++ // load a -++ // TODO: fix unaligned load -++ // don't reload a like in eo1 -++ add r1, #1 -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #33 -++ subs r4, #1 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ sub r1, #1 -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1] -++ sub r1, #31 -++ edge_w64_body -++ // copy c to a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ vmov.64 q2, q6 -++ vmov.64 q3, q7 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ sub r1, #8 // load 8 extra bytes -++1: subs r4, #1 -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 // only first 9 bytes are used -++ sub r1, #32 -++ // a -++ vext.8 q0, q10, q11, #7 -++ vext.8 q1, q11, q12, #7 -++ // c -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ // b -++ vext.8 q8, q10, q11, #9 -++ vext.8 q9, q11, q12, #9 -++ edge_w32_body -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ // load a -++ sub r1, r3 -++ vld1.8 {q0-q1}, [r1], r3 -++ // load c -++ vld1.8 {q4-q5}, [r1], r3 -++1: subs r4, #1 -++ // load b -++ vld1.8 {q8-q9}, [r1], r3 -++ edge_w32_body -++ // inputs for next loop iteration -++ // a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ // c -++ vmov.64 q4, q8 -++ vmov.64 q5, q9 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ // load a -++ sub r1, r3 -++ sub r1, #8 -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q0, q10, q11, #7 -++ vext.8 q1, q11, q12, #7 -++ // load c -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ vext.8 q2, q10, q11, #7 -++1: subs r4, #1 -++ // load b -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q8, q10, q11, #9 -++ vext.8 q9, q11, q12, #9 -++ vext.8 q14, q10, q11, #8 -++ vext.8 q15, q11, q12, #8 -++ vext.8 q3, q10, q11, #7 -++ edge_w32_body -++ // inputs for next loop iteration -++ // a -++ vmov.8 q0, q2 -++ vext.8 q1, q4, q5, #15 -++ // c -++ vmov.8 q4, q14 -++ vmov.8 q5, q15 -++ vmov.8 q2, q3 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ sub r1, r3 -++ ldr r5, [r5] -++ sub r1, #8 -++ vpush {d8-d15} -++ // load a -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q0, q10, q11, #9 -++ vext.8 q1, q11, q12, #9 -++ // load c -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ vext.8 q2, q12, q11, #8 -++1: subs r4, #1 -++ // load b -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q8, q10, q11, #7 -++ vext.8 q9, q11, q12, #7 -++ vext.8 q3, q12, q10, #7 -++ edge_w32_body -++ // inputs for next loop iteration -++ // a -++ vext.8 q0, q4, q5, #1 -++ vext.8 q1, q5, q2, #1 -++ // c -++ vext.8 q4, q8, q9, #1 -++ vext.8 q5, q9, q3, #1 -++ vext.8 q2, q3, q1, #1 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -+-- -+2.5.0 -+ -+ -+From 1898d052a73370166d57e17cc7c52b7275887df3 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Fri, 19 Dec 2014 09:44:10 +0200 -+Subject: [PATCH 4/9] Improved SAO band NEON opimizations made SAO buffer 16 -+ byte aligned added alignment hints to loads and stores optimized register -+ usage in SAO band neon assembly -+ -+--- -+ libavcodec/arm/hevcdsp_sao_neon.S | 212 +++++++++++++++----------------------- -+ 1 file changed, 82 insertions(+), 130 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 4687012..ac21013 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -22,120 +22,84 @@ -+ #include "neon.S" -+ -+ function ff_hevc_sao_band_w8_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -+ -+-1: subs r4, #1 -+- vld1.8 {d24}, [r1], r3 -++1: subs r12, #1 -++ vld1.8 {d24}, [r1,:64], r3 -+ vshr.u8 d16, d24, #3 -+ vtbl.8 d16, {q0, q1}, d16 -+- vmovl.s8 q2, d16 -+ vmovl.u8 q6, d24 -+- vadd.s16 q2, q6 -++ vaddw.s8 q6, d16 -+ vqmovun.s16 d4, q2 -+- vst1.8 {d4}, [r0], r2 -++ vst1.8 {d4}, [r0,:64], r2 -+ bne 1b -+ -+- vpop {d8-d15} -+- pop {r4-r8} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_band_w16_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -+- -+-1: subs r4, #1 -+- vld1.8 {q12}, [r1], r3 -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -+ -++1: subs r12, #1 -++ vld1.8 {q12}, [r1,:128], r3 -+ vshr.u8 q8, q12, #3 -+- -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+- -+- vmovl.s8 q2, d16 -+- vmovl.s8 q3, d17 -+- -+- vmovl.u8 q6, d24 -+- vmovl.u8 q7, d25 -+- -+- vadd.s16 q2, q6 -+- vadd.s16 q3, q7 -+- -+- vqmovun.s16 d4, q2 -+- vqmovun.s16 d5, q3 -+- -+- vstm.8 r0, {q2} -+- add r0, r2 -++ vmovl.u8 q10, d24 -++ vmovl.u8 q11, d25 -++ vaddw.s8 q10, d16 -++ vaddw.s8 q11, d17 -++ vqmovun.s16 d4, q10 -++ vqmovun.s16 d5, q11 -++ vst1.8 {q2}, [r0,:128], r2 -+ bne 1b -+ -+- vpop {d8-d15} -+- pop {r4-r8} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_band_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -+- -+-1: subs r4, #1 -+- vld1.8 {q12-q13}, [r1], r3 -+- -+- vshr.u8 q8, q12, #3 -+- vshr.u8 q9, q13, #3 -+- -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vtbl.8 d18, {q0, q1}, d18 -+- vtbl.8 d19, {q0, q1}, d19 -+- -+- vmovl.s8 q2, d16 -+- vmovl.s8 q3, d17 // q8 free -+- vmovl.s8 q4, d18 -+- vmovl.s8 q5, d19 // q9 free -+- -+- vmovl.u8 q6, d24 -+- vmovl.u8 q7, d25 // q12 free -+- vmovl.u8 q8, d26 -+- vmovl.u8 q9, d27 // q13 free -+- -+- vadd.s16 q2, q6 -+- vadd.s16 q3, q7 -+- vadd.s16 q4, q8 -+- vadd.s16 q5, q9 -+- -+- vqmovun.s16 d4, q2 -+- vqmovun.s16 d5, q3 -+- vqmovun.s16 d6, q4 // q4 free -+- vqmovun.s16 d7, q5 // q5 free -+- -+- vst1.8 {q2-q3}, [r0], r2 -+- bne 1b -+- -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -++ -++1: subs r12, #1 -++ vld1.8 {q2-q3}, [r1,:128], r3 -++ vshr.u8 q8, q2, #3 -++ vshr.u8 q9, q3, #3 -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ vtbl.8 d18, {q0, q1}, d18 -++ vtbl.8 d19, {q0, q1}, d19 -++ vmovl.u8 q12, d4 -++ vmovl.u8 q13, d5 -++ vmovl.u8 q14, d6 -++ vmovl.u8 q15, d7 -++ vaddw.s8 q12, d16 -++ vaddw.s8 q13, d17 -++ vaddw.s8 q14, d18 -++ vaddw.s8 q15, d19 -++ vqmovun.s16 d4, q12 -++ vqmovun.s16 d5, q13 -++ vqmovun.s16 d6, q14 -++ vqmovun.s16 d7, q15 -++ vst1.8 {q2-q3}, [r0,:128], r2 -++ bne 1b -++ -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_band_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -+ -+-1: subs r4, #1 -+- vld1.8 {q12-q13}, [r1]! -+- vld1.8 {q14-q15}, [r1], r3 -++1: subs r12, #1 -++ vld1.8 {q12-q13}, [r1,:128]! -++ vld1.8 {q14-q15}, [r1,:128], r3 -+ sub r1, #32 -+ -+ vshr.u8 q8, q12, #3 -+@@ -152,53 +116,41 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ vtbl.8 d22, {q0, q1}, d22 -+ vtbl.8 d23, {q0, q1}, d23 -+ -+- vmovl.s8 q2, d16 -+- vmovl.s8 q3, d17 // q8 free -+- vmovl.s8 q4, d18 -+- vmovl.s8 q5, d19 // q9 free -++ vmovl.u8 q2, d24 -++ vmovl.u8 q3, d25 -++ vmovl.u8 q12, d26 -++ vmovl.u8 q13, d27 -+ -+- vmovl.u8 q6, d24 -+- vmovl.u8 q7, d25 // q12 free -+- vmovl.u8 q8, d26 -+- vmovl.u8 q9, d27 // q13 free -+- -+- vadd.s16 q2, q6 -+- vadd.s16 q3, q7 -+- vadd.s16 q4, q8 -+- vadd.s16 q5, q9 -++ vaddw.s8 q2, d16 -++ vaddw.s8 q3, d17 -++ vaddw.s8 q12, d18 -++ vaddw.s8 q13, d19 -+ -+ vqmovun.s16 d4, q2 -+ vqmovun.s16 d5, q3 -+- vqmovun.s16 d6, q4 // q4 free -+- vqmovun.s16 d7, q5 // q5 free -+- -+- // free q4 -q9, q12 - q13 -+- vmovl.s8 q4, d20 -+- vmovl.s8 q5, d21 // q10 free -+- vmovl.s8 q6, d22 -+- vmovl.s8 q7, d23 // q11 free -+- -+- vmovl.u8 q8, d28 -+- vmovl.u8 q9, d29 // q14 free -+- vmovl.u8 q10, d30 -+- vmovl.u8 q11, d31 // q15 free -+- -+- vadd.s16 q4, q8 -+- vadd.s16 q5, q9 -+- vadd.s16 q6, q10 -+- vadd.s16 q7, q11 -+- -+- vqmovun.s16 d8, q4 -+- vqmovun.s16 d9, q5 -+- vqmovun.s16 d10, q6 -+- vqmovun.s16 d11, q7 -+- -+- vstm.8 r0, {q2-q5} -+- add r0, r2 -++ vqmovun.s16 d6, q12 -++ vqmovun.s16 d7, q13 -++ -++ vmovl.u8 q12, d28 -++ vmovl.u8 q13, d29 -++ vmovl.u8 q14, d30 -++ vmovl.u8 q15, d31 -++ -++ vaddw.s8 q12, d20 -++ vaddw.s8 q13, d21 -++ vaddw.s8 q14, d22 -++ vaddw.s8 q15, d23 -++ -++ vqmovun.s16 d8, q12 -++ vqmovun.s16 d9, q13 -++ vqmovun.s16 d10, q14 -++ vqmovun.s16 d11, q15 -++ -++ vst1.8 {q2-q3}, [r0,:128]! -++ vst1.8 {q4-q5}, [r0,:128], r2 -++ sub r0, #32 -+ bne 1b -+ -+- vpop {d8-d15} -+- pop {r4-r8} -+ bx lr -+ endfunc -+ -+-- -+2.5.0 -+ -+ -+From 26bd536800db2f50ff6a021e1fda0d0394d1ea01 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Mon, 29 Dec 2014 15:00:49 +0200 -+Subject: [PATCH 5/9] better code reuse in NEON SAO band -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 16 ++-- -+ libavcodec/arm/hevcdsp_sao_neon.S | 155 +++++++++++++------------------------ -+ 2 files changed, 61 insertions(+), 110 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index c32940e..6379810 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, -+ void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, -+ ptrdiff_t stride); -+ -+-void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+-void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+-void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+-void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+ -+ void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+@@ -185,16 +185,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ -+ switch(width){ -+ case 8: -+- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ case 16: -+- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ case 32: -+- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ case 64: -+- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ default: -+ for (y = 0; y < height; y++) { -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index ac21013..8852550 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -21,53 +21,13 @@ -+ #include "libavutil/arm/asm.S" -+ #include "neon.S" -+ -+-function ff_hevc_sao_band_w8_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -++.macro init_sao_band -++ ldr r12, [sp, #0] // offset_table address -+ vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -+- -+-1: subs r12, #1 -+- vld1.8 {d24}, [r1,:64], r3 -+- vshr.u8 d16, d24, #3 -+- vtbl.8 d16, {q0, q1}, d16 -+- vmovl.u8 q6, d24 -+- vaddw.s8 q6, d16 -+- vqmovun.s16 d4, q2 -+- vst1.8 {d4}, [r0,:64], r2 -+- bne 1b -+- -+- bx lr -+-endfunc -+- -+-function ff_hevc_sao_band_w16_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -+- -+-1: subs r12, #1 -+- vld1.8 {q12}, [r1,:128], r3 -+- vshr.u8 q8, q12, #3 -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vmovl.u8 q10, d24 -+- vmovl.u8 q11, d25 -+- vaddw.s8 q10, d16 -+- vaddw.s8 q11, d17 -+- vqmovun.s16 d4, q10 -+- vqmovun.s16 d5, q11 -+- vst1.8 {q2}, [r0,:128], r2 -+- bne 1b -+- -+- bx lr -+-endfunc -+- -+-function ff_hevc_sao_band_w32_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -++ ldr r12, [sp, #4] // height -++.endm -+ -+-1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1,:128], r3 -++.macro sao_band_32 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -+ vtbl.8 d16, {q0, q1}, d16 -+@@ -86,6 +46,43 @@ function ff_hevc_sao_band_w32_neon_8, export=1 -+ vqmovun.s16 d5, q13 -+ vqmovun.s16 d6, q14 -+ vqmovun.s16 d7, q15 -++.endm -++ -++function ff_hevc_sao_band_w8_neon_8, export=1 -++ init_sao_band -++1: subs r12, #4 -++ vld1.8 {d4}, [r1,:64], r3 -++ vld1.8 {d5}, [r1,:64], r3 -++ vld1.8 {d6}, [r1,:64], r3 -++ vld1.8 {d7}, [r1,:64], r3 -++ sao_band_32 -++ vst1.8 {d4}, [r0,:64], r2 -++ vst1.8 {d5}, [r0,:64], r2 -++ vst1.8 {d6}, [r0,:64], r2 -++ vst1.8 {d7}, [r0,:64], r2 -++ bne 1b -++ -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w16_neon_8, export=1 -++ init_sao_band -++1: subs r12, #2 -++ vld1.8 {q2}, [r1,:128], r3 -++ vld1.8 {q3}, [r1,:128], r3 -++ sao_band_32 -++ vst1.8 {q2}, [r0,:128], r2 -++ vst1.8 {q3}, [r0,:128], r2 -++ bne 1b -++ -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w32_neon_8, export=1 -++ init_sao_band -++1: subs r12, #1 -++ vld1.8 {q2-q3}, [r1,:128], r3 -++ sao_band_32 -+ vst1.8 {q2-q3}, [r0,:128], r2 -+ bne 1b -+ -+@@ -93,63 +90,17 @@ function ff_hevc_sao_band_w32_neon_8, export=1 -+ endfunc -+ -+ function ff_hevc_sao_band_w64_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -+- -+-1: subs r12, #1 -+- vld1.8 {q12-q13}, [r1,:128]! -+- vld1.8 {q14-q15}, [r1,:128], r3 -+- sub r1, #32 -+- -+- vshr.u8 q8, q12, #3 -+- vshr.u8 q9, q13, #3 -+- vshr.u8 q10, q14, #3 -+- vshr.u8 q11, q15, #3 -+- -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vtbl.8 d18, {q0, q1}, d18 -+- vtbl.8 d19, {q0, q1}, d19 -+- vtbl.8 d20, {q0, q1}, d20 -+- vtbl.8 d21, {q0, q1}, d21 -+- vtbl.8 d22, {q0, q1}, d22 -+- vtbl.8 d23, {q0, q1}, d23 -+- -+- vmovl.u8 q2, d24 -+- vmovl.u8 q3, d25 -+- vmovl.u8 q12, d26 -+- vmovl.u8 q13, d27 -+- -+- vaddw.s8 q2, d16 -+- vaddw.s8 q3, d17 -+- vaddw.s8 q12, d18 -+- vaddw.s8 q13, d19 -+- -+- vqmovun.s16 d4, q2 -+- vqmovun.s16 d5, q3 -+- vqmovun.s16 d6, q12 -+- vqmovun.s16 d7, q13 -+- -+- vmovl.u8 q12, d28 -+- vmovl.u8 q13, d29 -+- vmovl.u8 q14, d30 -+- vmovl.u8 q15, d31 -+- -+- vaddw.s8 q12, d20 -+- vaddw.s8 q13, d21 -+- vaddw.s8 q14, d22 -+- vaddw.s8 q15, d23 -+- -+- vqmovun.s16 d8, q12 -+- vqmovun.s16 d9, q13 -+- vqmovun.s16 d10, q14 -+- vqmovun.s16 d11, q15 -+- -+- vst1.8 {q2-q3}, [r0,:128]! -+- vst1.8 {q4-q5}, [r0,:128], r2 -+- sub r0, #32 -+- bne 1b -++ init_sao_band -++1: subs r12, #1 -++ vld1.8 {q2-q3}, [r1,:128]! -++ sao_band_32 -++ vst1.8 {q2-q3}, [r0,:128]! -++ vld1.8 {q2-q3}, [r1,:128], r3 -++ sub r1, #32 -++ sao_band_32 -++ vst1.8 {q2-q3}, [r0,:128], r2 -++ sub r0, #32 -++ bne 1b -+ -+ bx lr -+ endfunc -+-- -+2.5.0 -+ -+ -+From f93646a97bc885b81759e774d04be3781916a3e7 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Wed, 7 Jan 2015 15:27:38 +0200 -+Subject: [PATCH 6/9] More SAO NEON optimizations Now uses only 8 bit integers -+ for SAO calculations -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 7 +- -+ libavcodec/arm/hevcdsp_sao_neon.S | 664 +++++++++++++++---------------------- -+ 2 files changed, 272 insertions(+), 399 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 6379810..8d6e863 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -225,7 +225,7 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ int x, y; -+ -+ for (x = 0; x < 5; x++) { -+- sao_offset_val[x] = _sao_offset_val[x]; -++ sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; -+ } -+ -+ stride_src /= sizeof(pixel); -+@@ -271,8 +271,9 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ for (x = 0; x < width; x++) { -+ int diff0 = CMP(src[x], src[x + a_stride]); -+ int diff1 = CMP(src[x], src[x + b_stride]); -+- int offset_val = edge_idx[2 + diff0 + diff1]; -+- dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -++ int idx = diff0 + diff1; -++ if (idx) -++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[idx+2]); -+ } -+ src += stride_src; -+ dst += stride_dst; -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 8852550..5fc482b 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2014 Seppo Tomperi -++ * Copyright (c) 2014 - 2015 Seppo Tomperi -+ * -+ * This file is part of FFmpeg. -+ * -+@@ -23,6 +23,7 @@ -+ -+ .macro init_sao_band -+ ldr r12, [sp, #0] // offset_table address -++ pld [r1] -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #4] // height -+ .endm -+@@ -30,36 +31,31 @@ -+ .macro sao_band_32 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -++ vmov.u8 q14, #128 -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+ vtbl.8 d19, {q0, q1}, d19 -+- vmovl.u8 q12, d4 -+- vmovl.u8 q13, d5 -+- vmovl.u8 q14, d6 -+- vmovl.u8 q15, d7 -+- vaddw.s8 q12, d16 -+- vaddw.s8 q13, d17 -+- vaddw.s8 q14, d18 -+- vaddw.s8 q15, d19 -+- vqmovun.s16 d4, q12 -+- vqmovun.s16 d5, q13 -+- vqmovun.s16 d6, q14 -+- vqmovun.s16 d7, q15 -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q14 -++ vqadd.s8 q2, q8 -++ vqadd.s8 q3, q9 -++ vsub.s8 q2, q14 -++ vsub.s8 q3, q14 -+ .endm -+ -+ function ff_hevc_sao_band_w8_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #4 -+- vld1.8 {d4}, [r1,:64], r3 -+- vld1.8 {d5}, [r1,:64], r3 -+- vld1.8 {d6}, [r1,:64], r3 -+- vld1.8 {d7}, [r1,:64], r3 -++ vld1.8 {d4}, [r1, :64], r3 -++ vld1.8 {d5}, [r1, :64], r3 -++ vld1.8 {d6}, [r1, :64], r3 -++ vld1.8 {d7}, [r1, :64], r3 -+ sao_band_32 -+- vst1.8 {d4}, [r0,:64], r2 -+- vst1.8 {d5}, [r0,:64], r2 -+- vst1.8 {d6}, [r0,:64], r2 -+- vst1.8 {d7}, [r0,:64], r2 -++ vst1.8 {d4}, [r0, :64], r2 -++ vst1.8 {d5}, [r0, :64], r2 -++ vst1.8 {d6}, [r0, :64], r2 -++ vst1.8 {d7}, [r0, :64], r2 -+ bne 1b -+ -+ bx lr -+@@ -68,11 +64,11 @@ endfunc -+ function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #2 -+- vld1.8 {q2}, [r1,:128], r3 -+- vld1.8 {q3}, [r1,:128], r3 -++ vld1.8 {q2}, [r1, :128], r3 -++ vld1.8 {q3}, [r1, :128], r3 -+ sao_band_32 -+- vst1.8 {q2}, [r0,:128], r2 -+- vst1.8 {q3}, [r0,:128], r2 -++ vst1.8 {q2}, [r0, :128], r2 -++ vst1.8 {q3}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -81,9 +77,9 @@ endfunc -+ function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1,:128], r3 -++ vld1.8 {q2-q3}, [r1, :128], r3 -+ sao_band_32 -+- vst1.8 {q2-q3}, [r0,:128], r2 -++ vst1.8 {q2-q3}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -92,263 +88,153 @@ endfunc -+ function ff_hevc_sao_band_w64_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1,:128]! -++ pld [r1, r3] -++ vld1.8 {q2-q3}, [r1, :128]! -+ sao_band_32 -+- vst1.8 {q2-q3}, [r0,:128]! -+- vld1.8 {q2-q3}, [r1,:128], r3 -++ vst1.8 {q2-q3}, [r0, :128]! -++ vld1.8 {q2-q3}, [r1, :128], r3 -+ sub r1, #32 -+ sao_band_32 -+- vst1.8 {q2-q3}, [r0,:128], r2 -++ vst1.8 {q2-q3}, [r0, :128], r2 -+ sub r0, #32 -+ bne 1b -+ -+ bx lr -+ endfunc -+- -++// input -++// a in q0 - q3 -++// c in q4 - q7 -++// b in q8 - q11 -++// offset table in r7 and r5 -++// output in q0 - q3 -++// clobbers q12 - q15 -+ .macro edge_w64_body -+- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q5, q1 -+- vcgt.u8 q1, q1, q5 -+- vcgt.u8 q14, q6, q2 -+- vcgt.u8 q2, q2, q6 -+- vcgt.u8 q15, q7, q3 -+- vcgt.u8 q3, q3, q7 -+- -+- vsub.s8 q12, q0, q12 // diff0 -+- vsub.s8 q13, q1, q13 -+- vsub.s8 q14, q2, q14 -+- vsub.s8 q15, q3, q15 -+- -++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q5, q1 -++ vcgt.u8 q1, q1, q5 -++ vsub.s8 q12, q0, q12 // diff0 -+ vcgt.u8 q0, q4, q8 // c > b -+- vcgt.u8 q8, q8, q4 // b > c -++ vsub.s8 q13, q1, q13 -++ -++ vcgt.u8 q14, q8, q4 // b > c -+ vcgt.u8 q1, q5, q9 -+- vcgt.u8 q9, q9, q5 -+- vcgt.u8 q2, q6, q10 -+- vcgt.u8 q10, q10, q6 -+- vcgt.u8 q3, q7, q11 -+- vcgt.u8 q11, q11, q7 -++ vcgt.u8 q15, q9, q5 -++ vsub.s8 q0, q14, q0 // diff1 -+ -+- vsub.s8 q0, q8, q0 // diff1 -+- vsub.s8 q1, q9, q1 -+- vsub.s8 q2, q10, q2 -+- vsub.s8 q3, q11, q3 -++ vsub.s8 q1, q15, q1 -+ -+- vadd.s8 q0, q12 //diff0 + diff1 -+- vadd.s8 q1, q13 -+- vadd.s8 q2, q14 -+- vadd.s8 q3, q15 -+- -+- vdup.s8 q9, r6 // 3 to all elements -+- sub r6, #1 -+- -+- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -+- vclt.s8 q13, q1, #0 -+- vclt.s8 q14, q2, #0 -+- vclt.s8 q15, q3, #0 -+- -+- vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 -+- vadd.s8 q10, q1, q9 -+- vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -+- vand.8 q13, q10, q13 -+- vadd.s8 q8, q2, q9 -+- vadd.s8 q10, q3, q9 -+- vand.8 q14, q8, q14 -+- vand.8 q15, q10, q15 -+- -+- vdup.s8 q9, r6 // 2 to all elements -+- add r6, #1 -+- -+- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -+- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -+- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vcgt.s8 q10, q1, #0 -+- vadd.s8 q0, q11, q12 // offset_idx -+- -+- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -+- vcgt.s8 q12, q2, #0 -+- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 -+- vadd.s8 q1, q11, q13 -+- -+- vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vcgt.s8 q10, q3, #0 -+- vadd.s8 q2, q11, q14 -+- -+- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 -+- vmov.32 d18[0], r7 // load offset table from general registers -+- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vmov.32 d18[1], r5 // load rest of offset table -+- vadd.s8 q3, q11, q15 -+- -+- vtbl.8 d0, {d18}, d0 -+- vtbl.8 d1, {d18}, d1 -+- vtbl.8 d2, {d18}, d2 -+- vtbl.8 d3, {d18}, d3 -+- vtbl.8 d4, {d18}, d4 -+- vtbl.8 d5, {d18}, d5 -+- vtbl.8 d6, {d18}, d6 -+- vtbl.8 d7, {d18}, d7 -+- -+- vmovl.u8 q8, d8 -+- vmovl.u8 q9, d9 -+- vmovl.u8 q10, d10 -+- vmovl.u8 q11, d11 -+- vmovl.u8 q12, d12 -+- vmovl.u8 q13, d13 -+- vmovl.u8 q14, d14 -+- vmovl.u8 q15, d15 -+- -+- vaddw.s8 q8, d0 -+- vaddw.s8 q9, d1 -+- vaddw.s8 q10, d2 -+- vaddw.s8 q11, d3 -+- vaddw.s8 q12, d4 -+- vaddw.s8 q13, d5 -+- vaddw.s8 q14, d6 -+- vaddw.s8 q15, d7 -+- -+- vqmovun.s16 d0, q8 -+- vqmovun.s16 d1, q9 -+- vqmovun.s16 d2, q10 -+- vqmovun.s16 d3, q11 -+- vqmovun.s16 d4, q12 -+- vqmovun.s16 d5, q13 -+- vqmovun.s16 d6, q14 -+- vqmovun.s16 d7, q15 -+- -+- vstm r0, {q0-q3} -+- add r0, r2 -+-.endm -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -+ -+-.macro edge_w32_body -+- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q5, q1 -+- vcgt.u8 q1, q1, q5 -++ vcgt.u8 q14, q6, q2 -++ vcgt.u8 q2, q2, q6 -++ vcgt.u8 q15, q7, q3 -++ vcgt.u8 q3, q3, q7 -+ -+- vsub.s8 q12, q0, q12 // diff0 -+- vcgt.u8 q0, q4, q8 // c > b -+- vsub.s8 q13, q1, q13 // diff0 part 2 -++ vsub.s8 q14, q2, q14 -++ vcgt.u8 q2, q6, q10 -++ vsub.s8 q15, q3, q15 -+ -+- vcgt.u8 q6, q8, q4 // b > c -+- vcgt.u8 q1, q5, q9 -+- vcgt.u8 q7, q9, q5 -++ vcgt.u8 q12, q10, q6 -++ vcgt.u8 q3, q7, q11 -++ vcgt.u8 q13, q11, q7 -++ vsub.s8 q2, q12, q2 -++ vsub.s8 q3, q13, q3 -+ -+- vsub.s8 q0, q6, q0 // diff1 -+- vsub.s8 q1, q7, q1 // diff1 part 2 -+- vadd.s8 q0, q12 //diff0 + diff1 -++ vmov.s8 q13, #2 // 2 to all elements -+ -+- vdup.s8 q7, r6 // 3 to all elements -+- sub r6, #1 -+- vadd.s8 q1, q13 -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q15 -++ -++ vmov.32 d24[0], r4 // load offset table from general registers -++ vmov.32 d24[1], r5 // load rest of offset table -+ -+- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -+- vclt.s8 q13, q1, #0 -+- -+- vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 -+- vadd.s8 q10, q1, q7 -+- vdup.s8 q7, r6 // 2 to all elements -+- add r6, #1 -+- vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -+- vand.8 q13, q10, q13 -+- -+- -+- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -+- vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 -+- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vcgt.s8 q10, q1, #0 -+- vadd.s8 q0, q11, q12 // offset_idx -+- -+- vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 -+- vmov.32 d14[0], r7 // load offset table from general registers -+- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vmov.32 d14[1], r5 // load rest of offset table -+- vadd.s8 q1, q11, q13 -+- -+- vtbl.8 d0, {d14}, d0 -+- vtbl.8 d1, {d14}, d1 -+- vtbl.8 d2, {d14}, d2 -+- vtbl.8 d3, {d14}, d3 -+- -+- vmovl.u8 q6, d8 -+- vmovl.u8 q7, d9 -+- vmovl.u8 q10, d10 -+- vmovl.u8 q11, d11 -+- -+- vaddw.s8 q6, d0 -+- vaddw.s8 q7, d1 -+- vaddw.s8 q10, d2 -+- vaddw.s8 q11, d3 -+- -+- vqmovun.s16 d0, q6 -+- vqmovun.s16 d1, q7 -+- vqmovun.s16 d2, q10 -+- vqmovun.s16 d3, q11 -+- -+- vstm r0, {q0-q1} -+- add r0, r2 -++ vadd.s8 q0, q13 -++ vadd.s8 q1, q13 -++ vadd.s8 q2, q13 -++ vadd.s8 q3, q13 -++ -++ vmov.u8 q15, #128 // s8 #-128 -++ vtbl.8 d0, {d24}, d0 -++ vtbl.8 d1, {d24}, d1 -++ vtbl.8 d2, {d24}, d2 -++ vtbl.8 d3, {d24}, d3 -++ vtbl.8 d4, {d24}, d4 -++ vtbl.8 d5, {d24}, d5 -++ vtbl.8 d6, {d24}, d6 -++ vtbl.8 d7, {d24}, d7 -++ -++ vadd.s8 q12, q4, q15 -++ vadd.s8 q13, q5, q15 -++ vadd.s8 q14, q6, q15 -++ vadd.s8 q15, q7, q15 -++ vqadd.s8 q12, q0 -++ vqadd.s8 q15, q3 -++ vmov.u8 q3, #128 // s8 #-128 -++ vqadd.s8 q13, q1 -++ vqadd.s8 q14, q2 -++ vsub.s8 q0, q12, q3 -++ vsub.s8 q1, q13, q3 -++ vsub.s8 q2, q14, q3 -++ vsub.s8 q3, q15, q3 -++ vst1.8 {q0-q1}, [r0, :128]! -++ vst1.8 {q2-q3}, [r0, :128], r2 -++ sub r0, #32 -+ .endm -+ -+-function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -++.macro init_edge_64 -++ push {r4-r5} -++ ldr r12, [sp, #8] // height -++ ldr r5, [sp, #12] // sao_offset_val_table -++ ldr r4, [r5] -+ add r5, #4 -+ ldr r5, [r5] -++.endm -++ -++function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -++ init_edge_64 -+ vpush {d8-d15} -+ sub r1, #8 -+-1: subs r4, #1 -+- vld1.64 {q10-q11}, [r1]! -+- vld1.64 {q12-q13}, [r1]! -+- vld1.64 {q14}, [r1], r3 -+- sub r1, #64 -++1: subs r12, #1 -++ vld1.64 {d7}, [r1, :64]! -++ vld1.64 {q4-q5}, [r1, :128]! // load c -++ vld1.64 {q6-q7}, [r1, :128]! -++ vld1.64 {d24}, [r1, :64], r3 -++ sub r1, #72 -+ // load a -+- vext.8 q0, q10, q11, #7 -+- vext.8 q1, q11, q12, #7 -+- vext.8 q2, q12, q13, #7 -+- vext.8 q3, q13, q14, #7 -+- // load c -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -+- vext.8 q6, q12, q13, #8 -+- vext.8 q7, q13, q14, #8 -++ vext.8 q0, q3, q4, #15 -++ vext.8 q1, q4, q5, #15 -++ vext.8 q2, q5, q6, #15 -++ vext.8 q3, q6, q7, #15 -+ // load b -+- vext.8 q8, q10, q11, #9 -+- vext.8 q9, q11, q12, #9 -+- vext.8 q10, q12, q13, #9 -+- vext.8 q11, q13, q14, #9 -++ vext.8 q8, q4, q5, #1 -++ vext.8 q9, q5, q6, #1 -++ vext.8 q10, q6, q7, #1 -++ vext.8 q11, q7, q12, #1 -+ edge_w64_body -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -++ init_edge_64 -+ vpush {d8-d15} -+ sub r1, r3 -+ // load a -+- vld1.8 {q0-q1}, [r1]! -+- vld1.8 {q2-q3}, [r1], r3 -++ vld1.8 {q0-q1}, [r1, :128]! -++ vld1.8 {q2-q3}, [r1, :128], r3 -+ sub r1, #32 -+-1: subs r4, #1 -+ // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -++ vld1.8 {q4-q5}, [r1, :128]! -++ vld1.8 {q6-q7}, [r1, :128], r3 -+ sub r1, #32 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q8-q9}, [r1]! -+- vld1.8 {q10-q11}, [r1] -++ vld1.8 {q8-q9}, [r1, :128]! -++ vld1.8 {q10-q11}, [r1, :128], r3 -+ sub r1, #32 -+ edge_w64_body -+ // copy c to a -+@@ -356,20 +242,19 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ vmov.64 q1, q5 -+ vmov.64 q2, q6 -+ vmov.64 q3, q7 -++ // copy b to c -++ vmov.64 q4, q8 -++ vmov.64 q5, q9 -++ vmov.64 q6, q10 -++ vmov.64 q7, q11 -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -++ init_edge_64 -+ vpush {d8-d15} -+ 1: sub r1, r3 -+ // load a -+@@ -379,10 +264,10 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #31 -+- subs r4, #1 -++ subs r12, #1 -+ // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -++ vld1.8 {q4-q5}, [r1, :128]! -++ vld1.8 {q6-q7}, [r1, :128], r3 -+ sub r1, #32 -+ // load b -+ add r1, #1 -+@@ -390,25 +275,14 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #33 -+ edge_w64_body -+- // copy c to a -+- vmov.64 q0, q4 -+- vmov.64 q1, q5 -+- vmov.64 q2, q6 -+- vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -++ init_edge_64 -+ vpush {d8-d15} -+ 1: sub r1, r3 -+ // load a -+@@ -418,10 +292,10 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #33 -+- subs r4, #1 -++ subs r12, #1 -+ // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -++ vld1.8 {q4-q5}, [r1, :128]! -++ vld1.8 {q6-q7}, [r1, :128], r3 -+ sub r1, #32 -+ // load b -+ sub r1, #1 -+@@ -429,178 +303,176 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #31 -+ edge_w64_body -+- // copy c to a -+- vmov.64 q0, q4 -+- vmov.64 q1, q5 -+- vmov.64 q2, q6 -+- vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -++// inputs: -++// a in q0, q1 -++// c in q2, q3 -++// b in q8, q9 -++// offset table in d31 -++// clobbered registers q0, q1, q10, q11, q12, q13 -++// output q0, q1 -++.macro edge_w32_body -++ vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q3, q1 -++ vcgt.u8 q1, q1, q3 -++ -++ vsub.s8 q12, q0, q12 // diff0 -++ vcgt.u8 q0, q2, q8 // c > b -++ vsub.s8 q13, q1, q13 // diff0 part 2 -++ -++ vcgt.u8 q10, q8, q2 // b > c -++ vcgt.u8 q1, q3, q9 -++ vcgt.u8 q11, q9, q3 -++ -++ vsub.s8 q0, q10, q0 // diff1 -++ -++ vmov.s8 q10, #2 // 2 to all elements -++ vsub.s8 q1, q11, q1 // diff1 part 2 -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ -++ vadd.s8 q0, q10 -++ vadd.s8 q1, q10 -++ -++ vmov.u8 q10, #128 -++ vtbl.8 d0, {d31}, d0 -++ vtbl.8 d1, {d31}, d1 -++ vtbl.8 d2, {d31}, d2 -++ vtbl.8 d3, {d31}, d3 -++ -++ vadd.s8 q11, q2, q10 -++ vadd.s8 q12, q3, q10 -++ vqadd.s8 q11, q0 -++ vqadd.s8 q12, q1 -++ vsub.s8 q0, q11, q10 -++ vsub.s8 q1, q12, q10 -++ vst1.8 {q0-q1}, [r0, :128], r2 -++.endm -++ -++.macro init_edge_32 -++ ldr r12, [sp, #4] // sao_offset_val_table -++ vld1.32 {d31}, [r12] -++ ldr r12, [sp] // height -++.endm -++ -+ function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -+- vpush {d8-d15} -+- sub r1, #8 // load 8 extra bytes -+-1: subs r4, #1 -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 // only first 9 bytes are used -+- sub r1, #32 -++ init_edge_32 -++ sub r1, #4 // load 4 extra bytes -++1: subs r12, #1 -++ vld1.32 d3[1], [r1]! -++ vld1.8 {q2-q3}, [r1, :128]! // c -++ vld1.32 d20[0], [r1], r3 -++ sub r1, #36 -+ // a -+- vext.8 q0, q10, q11, #7 -+- vext.8 q1, q11, q12, #7 -+- // c -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -++ vext.8 q0, q1, q2, #15 -++ vext.8 q1, q2, q3, #15 -+ // b -+- vext.8 q8, q10, q11, #9 -+- vext.8 q9, q11, q12, #9 -++ vext.8 q8, q2, q3, #1 -++ vext.8 q9, q3, q10, #1 -+ edge_w32_body -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ bne 1b -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -+- vpush {d8-d15} -++ init_edge_32 -+ // load a -+ sub r1, r3 -+- vld1.8 {q0-q1}, [r1], r3 -++ vld1.8 {q0-q1}, [r1, :128], r3 -+ // load c -+- vld1.8 {q4-q5}, [r1], r3 -+-1: subs r4, #1 -++ vld1.8 {q2-q3}, [r1, :128], r3 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q8-q9}, [r1], r3 -++ vld1.8 {q8-q9}, [r1, :128], r3 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+- vmov.64 q0, q4 -+- vmov.64 q1, q5 -++ vmov.64 q0, q2 -++ vmov.64 q1, q3 -+ // c -+- vmov.64 q4, q8 -+- vmov.64 q5, q9 -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ vmov.64 q2, q8 -++ vmov.64 q3, q9 -++ bne 1b -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -+- vpush {d8-d15} -++ init_edge_32 -++ vpush {d8-d15} -+ // load a -+ sub r1, r3 -+- sub r1, #8 -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -++ sub r1, #8 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {d24}, [r1, :64], r3 -++ sub r1, #32 -+ vext.8 q0, q10, q11, #7 -+ vext.8 q1, q11, q12, #7 -+ // load c -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -+- vext.8 q2, q10, q11, #7 -+-1: subs r4, #1 -++ vld1.8 {d9}, [r1, :64]! -++ vld1.8 {q2-q3}, [r1, :64], r3 -++ sub r1, #8 -++ vext.8 q4, q4, q2, #15 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {q12}, [r1, :64], r3 -++ sub r1, #32 -+ vext.8 q8, q10, q11, #9 -+ vext.8 q9, q11, q12, #9 -+- vext.8 q14, q10, q11, #8 -+- vext.8 q15, q11, q12, #8 -+- vext.8 q3, q10, q11, #7 -++ vext.8 q6, q10, q11, #8 -++ vext.8 q7, q11, q12, #8 -++ vext.8 q5, q10, q11, #7 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+- vmov.8 q0, q2 -+- vext.8 q1, q4, q5, #15 -++ vmov.8 q0, q4 -++ vext.8 q1, q2, q3, #15 -+ // c -+- vmov.8 q4, q14 -+- vmov.8 q5, q15 -+- vmov.8 q2, q3 -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ vmov.8 q2, q6 -++ vmov.8 q3, q7 -++ vmov.8 q4, q5 -++ bne 1b -++ vpop {d8-d15} -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- sub r1, r3 -+- ldr r5, [r5] -+- sub r1, #8 -+- vpush {d8-d15} -++ init_edge_32 -++ sub r1, r3 -+ // load a -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -+- vext.8 q0, q10, q11, #9 -+- vext.8 q1, q11, q12, #9 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {d24}, [r1, :64], r3 -++ sub r1, #32 -++ vext.8 q0, q10, q11, #1 -++ vext.8 q1, q11, q12, #1 -+ // load c -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -+- vext.8 q2, q12, q11, #8 -+-1: subs r4, #1 -++ vld1.8 {q2-q3}, [r1, :64]! -++ vld1.8 {d30}, [r1, :64], r3 -++ sub r1, #40 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {q12}, [r1, :64], r3 -++ sub r1, #32 -+ vext.8 q8, q10, q11, #7 -+ vext.8 q9, q11, q12, #7 -+- vext.8 q3, q12, q10, #7 -++ vext.8 q14, q12, q10, #7 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+- vext.8 q0, q4, q5, #1 -+- vext.8 q1, q5, q2, #1 -++ vext.8 q0, q2, q3, #1 -++ vext.8 q1, q3, q15, #1 -+ // c -+- vext.8 q4, q8, q9, #1 -+- vext.8 q5, q9, q3, #1 -+- vext.8 q2, q3, q1, #1 -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ vext.8 q2, q8, q9, #1 -++ vext.8 q3, q9, q14, #1 -++ vext.8 d30, d28, d2, #1 -++ bne 1b -++ bx lr -+ endfunc -+ -+-- -+2.5.0 -+ -+ -+From 016c39d46b86830204a4519590332d2a38f7ee51 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Thu, 8 Jan 2015 09:58:55 +0200 -+Subject: [PATCH 7/9] small optimization to SAO BAND. correct path for -+ bit_depth_template.c -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 2 +- -+ libavcodec/arm/hevcdsp_sao_neon.S | 2 +- -+ 2 files changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 8d6e863..385c35d 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -23,7 +23,7 @@ -+ #include "libavcodec/hevcdsp.h" -+ #include "hevcdsp_arm.h" -+ #include "libavcodec/avcodec.h" -+-#include "../bit_depth_template.c" -++#include "libavcodec/bit_depth_template.c" -+ -+ void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+ void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 5fc482b..710b32b 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -26,12 +26,12 @@ -+ pld [r1] -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #4] // height -++ vmov.u8 q14, #128 -+ .endm -+ -+ .macro sao_band_32 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -+- vmov.u8 q14, #128 -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+-- -+2.5.0 -+ -+ -+From 579f1584d688e1ac24fb7d22697e2a7b64f62e8e Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Fri, 9 Jan 2015 10:28:52 +0200 -+Subject: [PATCH 8/9] Added height check for SAO NEON optimizations. Faster SAO -+ band NEON Some reordering to use NEON pipelines more efficiently -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 12 +++- -+ libavcodec/arm/hevcdsp_sao_neon.S | 142 ++++++++++++++++++++++--------------- -+ 2 files changed, 93 insertions(+), 61 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 385c35d..6d0689c 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -176,6 +176,7 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ int8_t offset_table[32] = { 0 }; -+ int k, y, x; -+ int shift = 3; // BIT_DEPTH - 5 -++ int cwidth = 0; -+ -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+@@ -183,7 +184,10 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ for (k = 0; k < 4; k++) -+ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; -+ -+- switch(width){ -++ if (height % 8 == 0) -++ cwidth = width; -++ -++ switch(cwidth){ -+ case 8: -+ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+@@ -223,15 +227,19 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ pixel *src = (pixel *)_src; -+ int a_stride, b_stride; -+ int x, y; -++ int cwidth = 0; -+ -+ for (x = 0; x < 5; x++) { -+ sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; -+ } -+ -++ if (height % 8 == 0) -++ cwidth = width; -++ -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+- switch (width) { -++ switch (cwidth) { -+ case 32: -+ switch(eo) { -+ case 0: -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 710b32b..08f50b8 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -26,36 +26,59 @@ -+ pld [r1] -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #4] // height -+- vmov.u8 q14, #128 -++ vmov.u8 q3, #128 -+ .endm -+ -+-.macro sao_band_32 -+- vshr.u8 q8, q2, #3 -+- vshr.u8 q9, q3, #3 -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vtbl.8 d18, {q0, q1}, d18 -+- vtbl.8 d19, {q0, q1}, d19 -+- vadd.s8 q2, q14 -+- vadd.s8 q3, q14 -+- vqadd.s8 q2, q8 -+- vqadd.s8 q3, q9 -+- vsub.s8 q2, q14 -+- vsub.s8 q3, q14 -++// 128 in q3 -++// input q8 - q11 -++// 32 cycles -++.macro sao_band_64 -++ vshr.u8 q12, q8, #3 -++ vshr.u8 q13, q9, #3 -++ vshr.u8 q14, q10, #3 -++ vshr.u8 q15, q11, #3 -++ vtbl.8 d24, {d0, d1, d2, d3}, d24 -++ vadd.s8 q8, q3 -++ vtbl.8 d25, {d0, d1, d2, d3}, d25 -++ vadd.s8 q9, q3 -++ vtbl.8 d26, {d0, d1, d2, d3}, d26 -++ vadd.s8 q10, q3 -++ vtbl.8 d27, {d0, d1, d2, d3}, d27 -++ vadd.s8 q11, q3 -++ vtbl.8 d28, {d0, d1, d2, d3}, d28 -++ vqadd.s8 q8, q12 -++ vtbl.8 d29, {d0, d1, d2, d3}, d29 -++ vqadd.s8 q9, q13 -++ vtbl.8 d30, {d0, d1, d2, d3}, d30 -++ vqadd.s8 q10, q14 -++ vtbl.8 d31, {d0, d1, d2, d3}, d31 -++ vqadd.s8 q11, q15 -++ vsub.s8 q8, q3 -++ vsub.s8 q9, q3 -++ vsub.s8 q10, q3 -++ vsub.s8 q11, q3 -+ .endm -+ -+ function ff_hevc_sao_band_w8_neon_8, export=1 -+ init_sao_band -+-1: subs r12, #4 -+- vld1.8 {d4}, [r1, :64], r3 -+- vld1.8 {d5}, [r1, :64], r3 -+- vld1.8 {d6}, [r1, :64], r3 -+- vld1.8 {d7}, [r1, :64], r3 -+- sao_band_32 -+- vst1.8 {d4}, [r0, :64], r2 -+- vst1.8 {d5}, [r0, :64], r2 -+- vst1.8 {d6}, [r0, :64], r2 -+- vst1.8 {d7}, [r0, :64], r2 -++1: subs r12, #8 -++ vld1.8 {d16}, [r1, :64], r3 -++ vld1.8 {d17}, [r1, :64], r3 -++ vld1.8 {d18}, [r1, :64], r3 -++ vld1.8 {d19}, [r1, :64], r3 -++ vld1.8 {d20}, [r1, :64], r3 -++ vld1.8 {d21}, [r1, :64], r3 -++ vld1.8 {d22}, [r1, :64], r3 -++ vld1.8 {d23}, [r1, :64], r3 -++ sao_band_64 -++ vst1.8 {d16}, [r0, :64], r2 -++ vst1.8 {d17}, [r0, :64], r2 -++ vst1.8 {d18}, [r0, :64], r2 -++ vst1.8 {d19}, [r0, :64], r2 -++ vst1.8 {d20}, [r0, :64], r2 -++ vst1.8 {d21}, [r0, :64], r2 -++ vst1.8 {d22}, [r0, :64], r2 -++ vst1.8 {d23}, [r0, :64], r2 -+ bne 1b -+ -+ bx lr -+@@ -63,12 +86,16 @@ endfunc -+ -+ function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+-1: subs r12, #2 -+- vld1.8 {q2}, [r1, :128], r3 -+- vld1.8 {q3}, [r1, :128], r3 -+- sao_band_32 -+- vst1.8 {q2}, [r0, :128], r2 -+- vst1.8 {q3}, [r0, :128], r2 -++1: subs r12, #4 -++ vld1.8 {q8}, [r1, :128], r3 -++ vld1.8 {q9}, [r1, :128], r3 -++ vld1.8 {q10}, [r1, :128], r3 -++ vld1.8 {q11}, [r1, :128], r3 -++ sao_band_64 -++ vst1.8 {q8}, [r0, :128], r2 -++ vst1.8 {q9}, [r0, :128], r2 -++ vst1.8 {q10}, [r0, :128], r2 -++ vst1.8 {q11}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -76,10 +103,12 @@ endfunc -+ -+ function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+-1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1, :128], r3 -+- sao_band_32 -+- vst1.8 {q2-q3}, [r0, :128], r2 -++1: subs r12, #2 -++ vld1.8 {q8-q9}, [r1, :128], r3 -++ vld1.8 {q10-q11}, [r1, :128], r3 -++ sao_band_64 -++ vst1.8 {q8-q9}, [r0, :128], r2 -++ vst1.8 {q10-q11}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -89,13 +118,12 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #1 -+ pld [r1, r3] -+- vld1.8 {q2-q3}, [r1, :128]! -+- sao_band_32 -+- vst1.8 {q2-q3}, [r0, :128]! -+- vld1.8 {q2-q3}, [r1, :128], r3 -++ vld1.8 {q8-q9}, [r1, :128]! -++ vld1.8 {q10-q11}, [r1, :128], r3 -+ sub r1, #32 -+- sao_band_32 -+- vst1.8 {q2-q3}, [r0, :128], r2 -++ sao_band_64 -++ vst1.8 {q8-q9}, [r0, :128]! -++ vst1.8 {q10-q11}, [r0, :128], r2 -+ sub r0, #32 -+ bne 1b -+ -+@@ -121,7 +149,6 @@ endfunc -+ vcgt.u8 q1, q5, q9 -+ vcgt.u8 q15, q9, q5 -+ vsub.s8 q0, q14, q0 // diff1 -+- -+ vsub.s8 q1, q15, q1 -+ -+ vadd.s8 q0, q12 //diff0 + diff1 -+@@ -157,27 +184,25 @@ endfunc -+ -+ vmov.u8 q15, #128 // s8 #-128 -+ vtbl.8 d0, {d24}, d0 -++ vadd.s8 q13, q4, q15 -+ vtbl.8 d1, {d24}, d1 -++ vadd.s8 q14, q5, q15 -+ vtbl.8 d2, {d24}, d2 -++ vqadd.s8 q0, q13 -+ vtbl.8 d3, {d24}, d3 -++ vqadd.s8 q1, q14 -+ vtbl.8 d4, {d24}, d4 -++ vadd.s8 q13, q6, q15 -+ vtbl.8 d5, {d24}, d5 -++ vadd.s8 q14, q7, q15 -+ vtbl.8 d6, {d24}, d6 -++ vqadd.s8 q2, q13 -+ vtbl.8 d7, {d24}, d7 -+- -+- vadd.s8 q12, q4, q15 -+- vadd.s8 q13, q5, q15 -+- vadd.s8 q14, q6, q15 -+- vadd.s8 q15, q7, q15 -+- vqadd.s8 q12, q0 -+- vqadd.s8 q15, q3 -+- vmov.u8 q3, #128 // s8 #-128 -+- vqadd.s8 q13, q1 -+- vqadd.s8 q14, q2 -+- vsub.s8 q0, q12, q3 -+- vsub.s8 q1, q13, q3 -+- vsub.s8 q2, q14, q3 -+- vsub.s8 q3, q15, q3 -++ vqadd.s8 q3, q14 -++ vsub.s8 q0, q15 -++ vsub.s8 q1, q15 -++ vsub.s8 q2, q15 -++ vsub.s8 q3, q15 -+ vst1.8 {q0-q1}, [r0, :128]! -+ vst1.8 {q2-q3}, [r0, :128], r2 -+ sub r0, #32 -+@@ -342,13 +367,12 @@ endfunc -+ -+ vmov.u8 q10, #128 -+ vtbl.8 d0, {d31}, d0 -++ vadd.s8 q11, q2, q10 -+ vtbl.8 d1, {d31}, d1 -++ vadd.s8 q12, q3, q10 -+ vtbl.8 d2, {d31}, d2 -++ vqadd.s8 q11, q0 -+ vtbl.8 d3, {d31}, d3 -+- -+- vadd.s8 q11, q2, q10 -+- vadd.s8 q12, q3, q10 -+- vqadd.s8 q11, q0 -+ vqadd.s8 q12, q1 -+ vsub.s8 q0, q11, q10 -+ vsub.s8 q1, q12, q10 -+-- -+2.5.0 -+ -+ -+From 026bac1824e4936e948e6b1efec82868c520ea66 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Mon, 2 Feb 2015 16:08:27 +0200 -+Subject: [PATCH 9/9] Further SAO NEON optimisations -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 16 +-- -+ libavcodec/arm/hevcdsp_sao_neon.S | 224 +++++++++++++++++++------------------ -+ 2 files changed, 124 insertions(+), 116 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 6d0689c..e5da7e9 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, -+ void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, -+ ptrdiff_t stride); -+ -+-void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+-void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+-void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+-void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -+ -+ void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+@@ -189,16 +189,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ -+ switch(cwidth){ -+ case 8: -+- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w8_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ case 16: -+- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w16_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ case 32: -+- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w32_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ case 64: -+- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w64_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ default: -+ for (y = 0; y < height; y++) { -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 08f50b8..9c7808d 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -22,21 +22,16 @@ -+ #include "neon.S" -+ -+ .macro init_sao_band -+- ldr r12, [sp, #0] // offset_table address -+ pld [r1] -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #4] // height -++ vld1.8 {q0, q1}, [r2] // offset table -++ ldr r2, [sp, #0] // stride_dst -++ ldr r12, [sp, #4] // height -+ vmov.u8 q3, #128 -+ .endm -+ -+ // 128 in q3 -+ // input q8 - q11 -+-// 32 cycles -+ .macro sao_band_64 -+- vshr.u8 q12, q8, #3 -+- vshr.u8 q13, q9, #3 -+- vshr.u8 q14, q10, #3 -+- vshr.u8 q15, q11, #3 -+ vtbl.8 d24, {d0, d1, d2, d3}, d24 -+ vadd.s8 q8, q3 -+ vtbl.8 d25, {d0, d1, d2, d3}, d25 -+@@ -52,8 +47,8 @@ -+ vtbl.8 d30, {d0, d1, d2, d3}, d30 -+ vqadd.s8 q10, q14 -+ vtbl.8 d31, {d0, d1, d2, d3}, d31 -+- vqadd.s8 q11, q15 -+ vsub.s8 q8, q3 -++ vqadd.s8 q11, q15 -+ vsub.s8 q9, q3 -+ vsub.s8 q10, q3 -+ vsub.s8 q11, q3 -+@@ -64,12 +59,16 @@ function ff_hevc_sao_band_w8_neon_8, export=1 -+ 1: subs r12, #8 -+ vld1.8 {d16}, [r1, :64], r3 -+ vld1.8 {d17}, [r1, :64], r3 -++ vshr.u8 q12, q8, #3 -+ vld1.8 {d18}, [r1, :64], r3 -+ vld1.8 {d19}, [r1, :64], r3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {d20}, [r1, :64], r3 -+ vld1.8 {d21}, [r1, :64], r3 -++ vshr.u8 q14, q10, #3 -+ vld1.8 {d22}, [r1, :64], r3 -+ vld1.8 {d23}, [r1, :64], r3 -++ vshr.u8 q15, q11, #3 -+ sao_band_64 -+ vst1.8 {d16}, [r0, :64], r2 -+ vst1.8 {d17}, [r0, :64], r2 -+@@ -88,9 +87,13 @@ function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #4 -+ vld1.8 {q8}, [r1, :128], r3 -++ vshr.u8 q12, q8, #3 -+ vld1.8 {q9}, [r1, :128], r3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {q10}, [r1, :128], r3 -++ vshr.u8 q14, q10, #3 -+ vld1.8 {q11}, [r1, :128], r3 -++ vshr.u8 q15, q11, #3 -+ sao_band_64 -+ vst1.8 {q8}, [r0, :128], r2 -+ vst1.8 {q9}, [r0, :128], r2 -+@@ -105,7 +108,11 @@ function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #2 -+ vld1.8 {q8-q9}, [r1, :128], r3 -++ vshr.u8 q12, q8, #3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {q10-q11}, [r1, :128], r3 -++ vshr.u8 q14, q10, #3 -++ vshr.u8 q15, q11, #3 -+ sao_band_64 -+ vst1.8 {q8-q9}, [r0, :128], r2 -+ vst1.8 {q10-q11}, [r0, :128], r2 -+@@ -119,7 +126,11 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ 1: subs r12, #1 -+ pld [r1, r3] -+ vld1.8 {q8-q9}, [r1, :128]! -++ vshr.u8 q12, q8, #3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {q10-q11}, [r1, :128], r3 -++ vshr.u8 q14, q10, #3 -++ vshr.u8 q15, q11, #3 -+ sub r1, #32 -+ sao_band_64 -+ vst1.8 {q8-q9}, [r0, :128]! -+@@ -129,51 +140,18 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ -+ bx lr -+ endfunc -+-// input -+-// a in q0 - q3 -+-// c in q4 - q7 -+-// b in q8 - q11 -+-// offset table in r7 and r5 -+-// output in q0 - q3 -+-// clobbers q12 - q15 -+-.macro edge_w64_body -+- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q5, q1 -+- vcgt.u8 q1, q1, q5 -+- vsub.s8 q12, q0, q12 // diff0 -+- vcgt.u8 q0, q4, q8 // c > b -+- vsub.s8 q13, q1, q13 -+- -+- vcgt.u8 q14, q8, q4 // b > c -+- vcgt.u8 q1, q5, q9 -+- vcgt.u8 q15, q9, q5 -+- vsub.s8 q0, q14, q0 // diff1 -+- vsub.s8 q1, q15, q1 -+ -+- vadd.s8 q0, q12 //diff0 + diff1 -+- vadd.s8 q1, q13 -+- -+- vcgt.u8 q14, q6, q2 -+- vcgt.u8 q2, q2, q6 -+- vcgt.u8 q15, q7, q3 -+- vcgt.u8 q3, q3, q7 -+- -+- vsub.s8 q14, q2, q14 -+- vcgt.u8 q2, q6, q10 -+- vsub.s8 q15, q3, q15 -+- -+- vcgt.u8 q12, q10, q6 -+- vcgt.u8 q3, q7, q11 -+- vcgt.u8 q13, q11, q7 -+- vsub.s8 q2, q12, q2 -+- vsub.s8 q3, q13, q3 -++.macro diff32 out0, out1, tmp0, tmp1, in0, in1, in2, in3 -++ vcgt.u8 \out0, \in2, \in0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 \tmp0, \in0, \in2 // a > c -> -1 , otherwise 0 -++ vcgt.u8 \out1, \in3, \in1 // c > a -> -1 , otherwise 0 part 2 -++ vcgt.u8 \tmp1, \in1, \in3 // a > c -> -1 , otherwise 0 part 2 -++ vsub.s8 \out0, \tmp0, \out0 // diff0 -++ vsub.s8 \out1, \tmp1, \out1 // diff0 part 2 -++.endm -+ -++.macro table64 -+ vmov.s8 q13, #2 // 2 to all elements -+- -+- vadd.s8 q2, q14 -+- vadd.s8 q3, q15 -+- -+ vmov.32 d24[0], r4 // load offset table from general registers -+ vmov.32 d24[1], r5 // load rest of offset table -+ -+@@ -208,6 +186,28 @@ endfunc -+ sub r0, #32 -+ .endm -+ -++// input -++// a in q0 - q3 -++// c in q4 - q7 -++// b in q8 - q11 -++// offset table in r7 and r5 -++// output in q0 - q3 -++// clobbers q12 - q15 -++.macro edge_w64_body -++ diff32 q12, q13, q0, q1, q0, q1, q4, q5 -++ diff32 q0, q1, q14, q15, q8, q9, q4, q5 -++ -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ -++ diff32 q14, q15, q2, q3, q2, q3, q6, q7 -++ diff32 q2, q3, q12, q13, q10, q11, q6, q7 -++ -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q15 -++ table64 -++.endm -++ -+ .macro init_edge_64 -+ push {r4-r5} -+ ldr r12, [sp, #8] // height -+@@ -334,38 +334,23 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ bx lr -+ endfunc -+ -+-// inputs: -+-// a in q0, q1 -+-// c in q2, q3 -+-// b in q8, q9 -+-// offset table in d31 -+-// clobbered registers q0, q1, q10, q11, q12, q13 -+-// output q0, q1 -+-.macro edge_w32_body -+- vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q3, q1 -+- vcgt.u8 q1, q1, q3 -+- -+- vsub.s8 q12, q0, q12 // diff0 -+- vcgt.u8 q0, q2, q8 // c > b -+- vsub.s8 q13, q1, q13 // diff0 part 2 -+- -+- vcgt.u8 q10, q8, q2 // b > c -+- vcgt.u8 q1, q3, q9 -+- vcgt.u8 q11, q9, q3 -+- -+- vsub.s8 q0, q10, q0 // diff1 -+- -+- vmov.s8 q10, #2 // 2 to all elements -+- vsub.s8 q1, q11, q1 // diff1 part 2 -+- vadd.s8 q0, q12 //diff0 + diff1 -+- vadd.s8 q1, q13 -++.macro init_edge_32 -++ ldr r12, [sp, #4] // sao_offset_val_table -++ vld1.32 {d31}, [r12] -++ ldr r12, [sp] // height -++.endm -+ -+- vadd.s8 q0, q10 -+- vadd.s8 q1, q10 -++.macro diff out0, tmp0, in0, in1 -++ vcgt.u8 \out0, \in1, \in0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 \tmp0, \in0, \in1 // a > c -> -1 , otherwise 0 -++ vsub.s8 \out0, \tmp0, \out0 // diff0 -++.endm -+ -+- vmov.u8 q10, #128 -++.macro table32 -++ vmov.s8 q10, #2 -++ vadd.s8 q0, q10 -++ vadd.s8 q1, q10 -++ vmov.s8 q10, #128 -+ vtbl.8 d0, {d31}, d0 -+ vadd.s8 q11, q2, q10 -+ vtbl.8 d1, {d31}, d1 -+@@ -373,56 +358,68 @@ endfunc -+ vtbl.8 d2, {d31}, d2 -+ vqadd.s8 q11, q0 -+ vtbl.8 d3, {d31}, d3 -+- vqadd.s8 q12, q1 -+- vsub.s8 q0, q11, q10 -+- vsub.s8 q1, q12, q10 -++ vqadd.s8 q12, q1 -++ vsub.s8 q0, q11, q10 -++ vsub.s8 q1, q12, q10 -+ vst1.8 {q0-q1}, [r0, :128], r2 -+ .endm -+ -+-.macro init_edge_32 -+- ldr r12, [sp, #4] // sao_offset_val_table -+- vld1.32 {d31}, [r12] -+- ldr r12, [sp] // height -+-.endm -+- -+ function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -+ init_edge_32 -+- sub r1, #4 // load 4 extra bytes -++ vpush {q4-q7} -++ sub r1, #4 -+ 1: subs r12, #1 -+- vld1.32 d3[1], [r1]! -+- vld1.8 {q2-q3}, [r1, :128]! // c -+- vld1.32 d20[0], [r1], r3 -+- sub r1, #36 -++ vld1.8 {q13-q14}, [r1]! -++ vld1.32 d30, [r1], r3 -++ sub r1, #32 -+ // a -+- vext.8 q0, q1, q2, #15 -+- vext.8 q1, q2, q3, #15 -+- // b -+- vext.8 q8, q2, q3, #1 -+- vext.8 q9, q3, q10, #1 -+- edge_w32_body -++ vext.8 q0, q13, q14, #3 -++ vext.8 q1, q14, q15, #3 -++ vshr.u64 d24, d30, #24 -++ // c -++ vext.8 q2, q13, q14, #4 -++ vext.8 q3, q14, q15, #4 -++ vshr.u64 d16, d30, #32 -++ // diff0 -++ diff32 q13, q14, q4, q5, q0, q1, q2, q3 -++ diff d18, d25, d24, d16 -++ // -diff1 -++ vext.s8 q0, q13, q14, #1 -++ vext.s8 q1, q14, q9, #1 -++ -++ vsub.s8 q0, q13, q0 //diff0 + diff1 -++ vsub.s8 q1, q14, q1 -++ table32 -+ bne 1b -++ vpop {q4-q7} -++ -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -+ init_edge_32 -++ vpush {q4-q7} -+ // load a -+ sub r1, r3 -+ vld1.8 {q0-q1}, [r1, :128], r3 -+ // load c -+ vld1.8 {q2-q3}, [r1, :128], r3 -++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 // CMP ( c, a ) -+ 1: subs r12, #1 -+ // load b -+ vld1.8 {q8-q9}, [r1, :128], r3 -+- edge_w32_body -+- // inputs for next loop iteration -+- // a -+- vmov.64 q0, q2 -+- vmov.64 q1, q3 -++ diff32 q4, q5, q10, q11, q8, q9, q2, q3 // CMP ( c, b ) -++ vadd.s8 q0, q4, q12 //diff0 + diff1 -++ vadd.s8 q1, q5, q13 -++ table32 -++ // CMP ( c, a ) -++ vneg.s8 q12, q4 -++ vneg.s8 q13, q5 -+ // c -+ vmov.64 q2, q8 -+ vmov.64 q3, q9 -+ bne 1b -++ vpop {q4-q7} -+ bx lr -+ endfunc -+ -+@@ -452,7 +449,11 @@ function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -+ vext.8 q6, q10, q11, #8 -+ vext.8 q7, q11, q12, #8 -+ vext.8 q5, q10, q11, #7 -+- edge_w32_body -++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 -++ diff32 q0, q1, q10, q11, q8, q9, q2, q3 -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ table32 -+ // inputs for next loop iteration -+ // a -+ vmov.8 q0, q4 -+@@ -487,7 +488,14 @@ function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -+ vext.8 q8, q10, q11, #7 -+ vext.8 q9, q11, q12, #7 -+ vext.8 q14, q12, q10, #7 -+- edge_w32_body -++ -++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 -++ diff32 q0, q1, q10, q11, q8, q9, q2, q3 -++ -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ table32 -++ -+ // inputs for next loop iteration -+ // a -+ vext.8 q0, q2, q3, #1 -+-- -+2.5.0 -+ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index dde29adf425e54f54e4104b3370352db0be6ef40..83369203fef720456080f4119822e7fe3631ca1a 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -133,6 +133,8 @@ cd "ffmpeg-${VERSION}" || exit 2 - tar --strip-components=1 -xf $MYDIR/${ARCHIVE} - - patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -diff --git a/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..5e8e07d407f045fc99554f0f061d1e818716ac62 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -@@ -0,0 +1,409 @@ -+From 29c3327a0d72a7e872ff170363cfe5ed13bca5d0 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Tue, 22 Dec 2015 18:10:24 +0000 -+Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions -+ -+--- -+ libavcodec/arm/Makefile | 1 + -+ libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/hevcdsp_init_neon.c | 23 +++ -+ 3 files changed, 358 insertions(+) -+ create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index cdd35b0..6051ec8 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -131,6 +131,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ -+ arm/synth_filter_neon.o -+ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ -+ arm/hevcdsp_deblock_neon.o \ -++ arm/hevcdsp_epel_neon.o \ -+ arm/hevcdsp_idct_neon.o \ -+ arm/hevcdsp_qpel_neon.o -+ NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -+diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -+new file mode 100644 -+index 0000000..516ae5b -+--- /dev/null -++++ b/libavcodec/arm/hevcdsp_epel_neon.S -+@@ -0,0 +1,334 @@ -++/* -++ * Copyright (c) 2014 - 2015 Seppo Tomperi -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++#include "neon.S" -++ -++#define MAX_PB_SIZE #64 -++ -++.macro vextin_d4 -++ vld1.8 {q10}, [r1], r2 -++ vmov d16, d20 -++ vext.8 d17, d20, d21, #1 -++ vext.8 d18, d20, d21, #2 -++ vext.8 d19, d20, d21, #3 -++.endm -++ -++.macro vextin_d4_8 -++ vld1.8 d16, [r1], r2 -++ vext.8 d17, d16, d16, #1 -++ vext.8 d18, d16, d16, #2 -++ vext.8 d19, d16, d16, #3 -++.endm -++ -++.macro load_coeffs_16b coeffs -++ ldr \coeffs, [\coeffs] -++ vdup.i8 d0, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d1, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d2, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d3, \coeffs -++.endm -++ -++.macro epel_filter_16b out=q12 -++ vmull.u8 q3, d16, d0 -++ vmull.u8 q11, d19, d3 -++ vmull.u8 \out, d17, d1 -++ vmull.u8 q10, d18, d2 -++ vadd.s16 q3, q11 -++ vadd.s16 \out, q10 -++ vsub.s16 \out, q3 -++.endm -++ -++.macro load_coeffs_32b coeffs -++ ldr \coeffs, [\coeffs] -++ vmov.i64 d4, #0 -++ vmov.8 d4[0], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[2], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[4], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[6], \coeffs -++.endm -++ -++.macro epel_filter_32b -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q4, d25, d4[0] -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q6, d31, d4[3] -++ -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q8, d27, d4[1] -++ vmull.s16 q9, d28, d4[2] // q14 -++ vmull.s16 q10, d29, d4[2] -++ vadd.s32 q3, q5 -++ vadd.s32 q4, q6 -++ vadd.s32 q7, q9 -++ vadd.s32 q8, q10 -++ vsub.s32 q7, q3 -++ vsub.s32 q8, q4 -++ vqshrn.s32 d6, q7, #6 -++ vqshrn.s32 d7, q8, #6 -++.endm -++ -++.macro epel_filter_32b_4 -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q9, d28, d4[2] // q14 -++ vadd.s32 q3, q5 -++ vadd.s32 q7, q9 -++ vsub.s32 q7, q3 -++ vqshrn.s32 d6, q7, #6 -++.endm -++ -++function ff_hevc_put_epel_h_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #16] // mx -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ sub r1, #1 -++ lsl r4, #1 -++ load_coeffs_16b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: subs r3, #1 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ cmp r5, #4 -++ bgt 8b -++4: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++2: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_v_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ load_coeffs_16b r7 -++ sub r1, r2 -++ lsl r4, #1 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vld1.8 {d16}, [r1], r2 -++ pld [r1] -++ vld1.8 {d17}, [r1], r2 -++ pld [r1] -++ vld1.8 {d18}, [r1], r2 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_hv_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r6, [sp, #16] // mx -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ sub r6, #1 -++ lsl r6, #2 -++ add r6, r12 // mx epel coeff offset -++ add r7, r12 -++ sub r1, #1 -++ sub r1, r2 -++ lsl r4, #1 -++ load_coeffs_16b r6 -++ load_coeffs_32b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vextin_d4 -++ epel_filter_16b q12 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q13 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q14 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vextin_d4 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b -++ vst1.16 {q3}, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.16 d6, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.32 d6[0], [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++epel_coeffs: -++ .byte 2, 58, 10, 2 -++ .byte 4, 54, 16, 2 -++ .byte 6, 46, 28, 4 -++ .byte 4, 36, 36, 4 -++ .byte 4, 28, 46, 6 -++ .byte 2, 16, 54, 4 -++ .byte 2, 10, 58, 2 -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 5591807..733ff08 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -58,6 +58,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); -+ #undef PUT_PIXELS -++void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -+ -+ static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, -+ int height, int width); -+@@ -201,7 +210,21 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; -++ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8; -++ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8; -++ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8; -+ } -++ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -++ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -++ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -++ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; -++ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; -++ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; -++ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; -++ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; -++ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; -++ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; -++ -+ c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -+ c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -+ c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -+-- -+2.5.0 -+ - -From 56a954cfc65e5f4f2f2e7a506ef303b853eedb81 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 7 May 2015 14:04:18 +0100 -Subject: [PATCH 26/62] [ffmpeg] Add GPU acceleration to hevc - ---- - tools/depends/target/ffmpeg/Makefile | 4 +- - tools/depends/target/ffmpeg/autobuild.sh | 1 + - .../target/ffmpeg/pfcd_hevc_optimisations.patch | 38136 +++++++++++++++++++ - 3 files changed, 38140 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index c46b533e47497cb7b1e7200eff2cee1a6f2a1a2f..48f8d56988718dd53294e8291a53e532f0ff338d 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -2,7 +2,8 @@ include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ -- hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \ -+ pfcd_hevc_optimisations.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -85,6 +86,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch -+ cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index 83369203fef720456080f4119822e7fe3631ca1a..d6856dbd4fb4957ace700cbc08332223c01938f6 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -135,6 +135,7 @@ tar --strip-components=1 -xf $MYDIR/${ARCHIVE} - patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch -+patch -p1 < ../pfcd_hevc_optimisations.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -diff --git a/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch b/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..e172ebf157aebffe1ae50b4a2b25fd71bc708c93 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch -@@ -0,0 +1,38136 @@ -+From b9b5434c61afd492a54dad5158b4d56ecbf7f01d Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 28 Apr 2015 16:18:40 +0100 -+Subject: [PATCH 01/68] Added display output -+ -+--- -+ ffmpeg.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 159 insertions(+) -+ -+diff --git a/ffmpeg.c b/ffmpeg.c -+index 9ffd833..50c6e86 100644 -+--- a/ffmpeg.c -++++ b/ffmpeg.c -+@@ -23,6 +23,11 @@ -+ * multimedia converter based on the FFmpeg libraries -+ */ -+ -++#ifdef RPI -++#define RPI_DISPLAY -++//#define RPI_ZERO_COPY -++#endif -++ -+ #include "config.h" -+ #include -+ #include -+@@ -66,6 +71,20 @@ -+ # include "libavfilter/buffersrc.h" -+ # include "libavfilter/buffersink.h" -+ -++#ifdef RPI_DISPLAY -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#ifdef RPI_ZERO_COPY -++#include "libavcodec/rpi_qpu.h" -++#endif -++#endif -++ -+ #if HAVE_SYS_RESOURCE_H -+ #include -+ #include -+@@ -158,6 +177,134 @@ static int restore_tty; -+ static void free_input_threads(void); -+ #endif -+ -++#ifdef RPI_DISPLAY -++ -++#define NUM_BUFFERS 4 -++ -++static MMAL_COMPONENT_T* rpi_display = NULL; -++static MMAL_POOL_T *rpi_pool = NULL; -++ -++#ifdef RPI_ZERO_COPY -++static uint8_t *get_vc_handle(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ return (uint8_t *)p->vc_handle; -++} -++#endif -++ -++static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -++{ -++ MMAL_POOL_T* pool; -++ size_t i; -++ size_t size = (w*h*3)/2; -++#ifdef RPI_ZERO_COPY -++ mmal_port_parameter_set_boolean(port, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); // Does this mark that the buffer contains a vc_handle? Would have expected a vc_image? -++ pool = mmal_port_pool_create(port, NUM_BUFFERS, 0); -++ assert(pool); -++#else -++ pool = mmal_port_pool_create(port, NUM_BUFFERS, size); -++ -++ for (i = 0; i < NUM_BUFFERS; ++i) -++ { -++ MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; -++ void* bufPtr = buffer->data; -++ memset(bufPtr, i*30, w*h); -++ memset(bufPtr+w*h, 128, (w*h)/2); -++ } -++#endif -++ -++ return pool; -++} -++ -++static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -++ mmal_buffer_header_release(buffer); -++} -++ -++static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -++{ -++ MMAL_COMPONENT_T* display; -++ int w2 = (w+31)&~31; -++ int h2 = (h+15)&~15; -++ MMAL_DISPLAYREGION_T region = -++ { -++ {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, -++ .layer = 2, -++ .fullscreen = 0, -++ .dest_rect = {x, y, w, h} -++ }; -++ bcm_host_init(); // TODO is this needed? -++ mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); -++ assert(display); -++ -++ mmal_port_parameter_set(display->input[0], ®ion.hdr); -++ -++ MMAL_ES_FORMAT_T* format = display->input[0]->format; -++ format->encoding = MMAL_ENCODING_I420; -++ format->es->video.width = w2; -++ format->es->video.height = h2; -++ format->es->video.crop.x = 0; -++ format->es->video.crop.y = 0; -++ format->es->video.crop.width = w; -++ format->es->video.crop.height = h; -++ mmal_port_format_commit(display->input[0]); -++ -++ mmal_component_enable(display); -++ -++ rpi_pool = display_alloc_pool(display->input[0], w2, h2); -++ -++ mmal_port_enable(display->input[0],display_cb_input); -++ mmal_port_enable(display->control,display_cb_input); -++ -++ printf("Allocated display %d %d\n",w,h); -++ -++ return display; -++} -++ -++static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) -++{ -++ int w = fr->width; -++ int h = fr->height; -++ int w2 = (w+31)&~31; -++ int h2 = (h+15)&~15; -++ if (!display || !rpi_pool) -++ return; -++ MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); -++ if (!buf) { -++ // Running too fast so drop the frame -++ return; -++ } -++ assert(buf); -++ buf->cmd = 0; -++ buf->length = (w2 * h2 * 3)/2; -++ buf->offset = 0; // Offset to valid data -++ buf->flags = 0; -++#ifdef RPI_ZERO_COPY -++ buf->data = get_vc_handle(fr->buf[0]); -++ buf->alloc_size = (w2*h2*3)/2; -++#else -++ //mmal_buffer_header_mem_lock(buf); -++ memcpy(buf->data, fr->data[0], w2 * h); -++ memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); -++ memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); -++ //mmal_buffer_header_mem_unlock(buf); -++#endif -++ -++ mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released -++} -++ -++static void display_exit(MMAL_COMPONENT_T* display) -++{ -++ if (display) { -++ mmal_component_destroy(display); -++ } -++ if (rpi_pool) { -++ mmal_port_pool_destroy(display->input[0], rpi_pool); -++ } -++} -++ -++#endif -++ -++ -+ /* sub2video hack: -+ Convert subtitles to video with alpha to insert them in filter graphs. -+ This is a temporary solution until libavfilter gets real subtitles support. -+@@ -581,6 +728,10 @@ static void ffmpeg_cleanup(int ret) -+ } -+ term_exit(); -+ ffmpeg_exited = 1; -++ -++#ifdef RPI_DISPLAY -++ display_exit(rpi_display); -++#endif -+ } -+ -+ void remove_avoptions(AVDictionary **a, AVDictionary *b) -+@@ -940,6 +1091,14 @@ static void do_video_out(AVFormatContext *s, -+ int frame_size = 0; -+ InputStream *ist = NULL; -+ AVFilterContext *filter = ost->filter->filter; -++#ifdef RPI_DISPLAY -++ if (next_picture) -++ { -++ if (!rpi_display) -++ rpi_display = display_init(0,0,next_picture->width,next_picture->height); -++ display_frame(rpi_display,next_picture); -++ } -++#endif -+ -+ if (ost->source_index >= 0) -+ ist = input_streams[ost->source_index]; -+-- -+2.7.4 -+ -+ -+From b90a5aff7bf9112ebd2a07949c8d79a49fcafe48 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 29 Apr 2015 16:49:43 +0100 -+Subject: [PATCH 02/68] Split transform and intra prediction into commands -+ -+--- -+ libavcodec/hevc.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++- -+ libavcodec/hevc.h | 58 +++++++++++++++++++++++ -+ libavcodec/hevc_cabac.c | 15 ++++++ -+ 3 files changed, 191 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index b478065..aa45dd6 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -931,6 +931,25 @@ static int hls_cross_component_pred(HEVCContext *s, int idx) { -+ return 0; -+ } -+ -++#ifdef RPI -++static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, int c_idx) -++{ -++ if (s->enable_rpi) { -++ HEVCLocalContext *lc = s->HEVClc; -++ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ cmd->type = RPI_PRED_INTRA; -++ cmd->size = log2_trafo_size; -++ cmd->c_idx = c_idx; -++ cmd->x = x0; -++ cmd->y = y0; -++ cmd->na = (lc->na.cand_bottom_left<<4) + (lc->na.cand_left<<3) + (lc->na.cand_up_left<<2) + (lc->na.cand_up<<1) + lc->na.cand_up_right; -++ cmd->mode = c_idx ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; -++ } else { -++ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, c_idx); -++ } -++} -++#endif -++ -+ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ int xBase, int yBase, int cb_xBase, int cb_yBase, -+ int log2_cb_size, int log2_trafo_size, -+@@ -943,8 +962,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ int trafo_size = 1 << log2_trafo_size; -+ ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size); -+- -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, x0, y0, 0); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0); -++#endif -+ } -+ -+ if (cbf_luma || cbf_cb[0] || cbf_cr[0] || -+@@ -1030,7 +1052,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 1); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 1); -++#endif -+ } -+ if (cbf_cb[i]) -+ ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), -+@@ -1059,7 +1085,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 2); -++#endif -+ } -+ if (cbf_cr[i]) -+ ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), -+@@ -1088,7 +1118,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 1); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 1); -++#endif -+ } -+ if (cbf_cb[i]) -+ ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), -+@@ -1098,7 +1132,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 2); -++#endif -+ } -+ if (cbf_cr[i]) -+ ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), -+@@ -1110,26 +1148,46 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ int trafo_size_h = 1 << (log2_trafo_size_c + s->ps.sps->hshift[1]); -+ int trafo_size_v = 1 << (log2_trafo_size_c + s->ps.sps->vshift[1]); -+ ff_hevc_set_neighbour_available(s, x0, y0, trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 1); -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 1); -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 2); -++#endif -+ if (s->ps.sps->chroma_format_idc == 2) { -+ ff_hevc_set_neighbour_available(s, x0, y0 + (1 << log2_trafo_size_c), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 1); -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 1); -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 2); -++#endif -+ } -+ } else if (blk_idx == 3) { -+ int trafo_size_h = 1 << (log2_trafo_size + 1); -+ int trafo_size_v = 1 << (log2_trafo_size + s->ps.sps->vshift[1]); -+ ff_hevc_set_neighbour_available(s, xBase, yBase, -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 1); -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1); -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2); -++#endif -+ if (s->ps.sps->chroma_format_idc == 2) { -+ ff_hevc_set_neighbour_available(s, xBase, yBase + (1 << (log2_trafo_size)), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 1); -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 1); -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 2); -++#endif -+ } -+ } -+ } -+@@ -2304,6 +2362,31 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ lc->ctb_up_left_flag = ((x_ctb > 0) && (y_ctb > 0) && (ctb_addr_in_slice-1 >= s->ps.sps->ctb_width) && (s->ps.pps->tile_id[ctb_addr_ts] == s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1 - s->ps.sps->ctb_width]])); -+ } -+ -++#ifdef RPI -++static void rpi_execute_pred_cmds(HEVCContext *s) -++{ -++ int i; -++ HEVCPredCmd *cmd = s->univ_pred_cmds; -++ HEVCLocalContext *lc = s->HEVClc; -++ -++ for(i = s->num_pred_cmds; i > 0; i--, cmd++) { -++ if (cmd->type == RPI_PRED_INTRA) { -++ lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; -++ lc->na.cand_bottom_left = (cmd->na >> 4) & 1; -++ lc->na.cand_left = (cmd->na >> 3) & 1; -++ lc->na.cand_up_left = (cmd->na >> 2) & 1; -++ lc->na.cand_up = (cmd->na >> 1) & 1; -++ lc->na.cand_up_right = (cmd->na >> 0) & 1; -++ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -++ } else { -++ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -++ } -++ } -++ s->num_pred_cmds = 0; -++ s->num_coeffs = 0; -++} -++#endif -++ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ { -+ HEVCContext *s = avctxt->priv_data; -+@@ -2313,6 +2396,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int y_ctb = 0; -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -++#ifdef RPI -++ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -++#endif -++ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+ return AVERROR_INVALIDDATA; -+@@ -2342,6 +2429,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -++#ifdef RPI -++ rpi_execute_pred_cmds(s); -++#endif -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = -1; -+ return more_data; -+@@ -2387,6 +2477,10 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int -+ s = s1->sList[self_id]; -+ lc = s->HEVClc; -+ -++#ifdef RPI -++ s->enable_rpi = 0; -++#endif -++ -+ if(ctb_row) { -+ ret = init_get_bits8(&lc->gb, s->data + s->sh.offset[ctb_row - 1], s->sh.size[ctb_row - 1]); -+ -+@@ -3075,6 +3169,13 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ -+ av_freep(&s->cabac_state); -+ -++#ifdef RPI -++ av_freep(&s->unif_mv_cmds); -++ av_freep(&s->unif_xfm_cmds); -++ av_freep(&s->univ_pred_cmds); -++ av_freep(&s->coeffs_buf); -++#endif -++ -+ for (i = 0; i < 3; i++) { -+ av_freep(&s->sao_pixel_buffer_h[i]); -+ av_freep(&s->sao_pixel_buffer_v[i]); -+@@ -3129,6 +3230,22 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->HEVClcList[0] = s->HEVClc; -+ s->sList[0] = s; -+ -++#ifdef RPI -++ s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -++ if (!s->unif_mv_cmds) -++ goto fail; -++ s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); -++ if (!s->unif_xfm_cmds) -++ goto fail; -++ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -++ if (!s->univ_pred_cmds) -++ goto fail; -++ s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); -++ if (!s->coeffs_buf) -++ goto fail; -++ s->enable_rpi = 0; -++#endif -++ -+ s->cabac_state = av_malloc(HEVC_CONTEXTS); -+ if (!s->cabac_state) -+ goto fail; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index be91010..7a1c35f 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -23,6 +23,9 @@ -+ #ifndef AVCODEC_HEVC_H -+ #define AVCODEC_HEVC_H -+ -++// define RPI to split the CABAC/prediction/transform into separate stages -++#include "config.h" -++ -+ #include "libavutil/buffer.h" -+ #include "libavutil/md5.h" -+ -+@@ -790,6 +793,49 @@ typedef struct HEVCLocalContext { -+ int boundary_flags; -+ } HEVCLocalContext; -+ -++#ifdef RPI -++ -++// RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -++#define RPI_MAX_WIDTH 2048 -++ -++// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane -++#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) -++#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -++// Each block can have an intra prediction and a transform_add command -++#define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -++ -++// Command for inter prediction -++typedef struct HEVCMvCmd { -++} HEVCMvCmd; -++ -++// Command for transform to process a block of coefficients -++typedef struct HEVCXfmCmd { -++} HEVCXfmCmd; -++ -++// Command for intra prediction and transform_add of predictions to coefficients -++#define RPI_PRED_TRANSFORM_ADD 0 -++#define RPI_PRED_INTRA 1 -++typedef struct HEVCPredCmd { -++ uint8_t size; -++ uint8_t type; -++ uint8_t na; -++ uint8_t c_idx; -++ union { -++ uint8_t *dst; // RPI_PRED_TRANSFORM_ADD -++ uint32_t x; // RPI_PRED_INTRA -++ }; -++ union { -++ int16_t *buf; // RPI_PRED_TRANSFORM_ADD -++ uint32_t y; // RPI_PRED_INTRA -++ }; -++ union { -++ enum IntraPredMode mode; // RPI_PRED_TRANSFORM_ADD -++ uint32_t stride; // RPI_PRED_INTRA -++ }; -++} HEVCPredCmd; -++ -++#endif -++ -+ typedef struct HEVCContext { -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+@@ -805,6 +851,18 @@ typedef struct HEVCContext { -+ int width; -+ int height; -+ -++#ifdef RPI -++ int enable_rpi; -++ HEVCMvCmd *unif_mv_cmds; -++ HEVCXfmCmd *unif_xfm_cmds; -++ HEVCPredCmd *univ_pred_cmds; -++ int16_t *coeffs_buf; -++ int num_mv_cmds; -++ int num_xfm_cmds; -++ int num_pred_cmds; -++ int num_coeffs; -++#endif -++ -+ uint8_t *cabac_state; -+ -+ /** 1 if the independent slice segment header was successfully parsed */ -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 05b2821..4e97f06 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1510,6 +1510,21 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -+ } -++#ifdef RPI -++ if (s->enable_rpi) { -++ int16_t *c = s->coeffs_buf + s->num_coeffs; -++ int n = trafo_size * trafo_size; -++ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy -++ s->num_coeffs += n; -++ cmd->type = RPI_PRED_TRANSFORM_ADD; -++ cmd->size = log2_trafo_size; -++ cmd->buf = c; -++ cmd->dst = dst; -++ cmd->stride = stride; -++ return; -++ } -++#endif -+ s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); -+ } -+ -+-- -+2.7.4 -+ -+ -+From f8293de11dc040d9fa2a558762a357c0c353d2c9 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 30 Apr 2015 15:23:22 +0100 -+Subject: [PATCH 03/68] Added simple VPU test code -+ -+--- -+ libavcodec/Makefile | 7 + -+ libavcodec/hevc.c | 33 +- -+ libavcodec/rpi_hevc_transform.h | 212 ++++++ -+ libavcodec/rpi_hevc_transform.s | 147 ++++ -+ libavcodec/rpi_mailbox.c | 293 ++++++++ -+ libavcodec/rpi_mailbox.h | 20 + -+ libavcodec/rpi_qpu.c | 652 ++++++++++++++++++ -+ libavcodec/rpi_qpu.h | 45 ++ -+ libavcodec/rpi_shader.c | 818 ++++++++++++++++++++++ -+ libavcodec/rpi_shader.h | 20 + -+ libavcodec/rpi_shader.qasm | 1413 +++++++++++++++++++++++++++++++++++++++ -+ libavcodec/rpi_user_vcsm.h | 425 ++++++++++++ -+ 12 files changed, 4084 insertions(+), 1 deletion(-) -+ create mode 100644 libavcodec/rpi_hevc_transform.h -+ create mode 100644 libavcodec/rpi_hevc_transform.s -+ create mode 100644 libavcodec/rpi_mailbox.c -+ create mode 100644 libavcodec/rpi_mailbox.h -+ create mode 100644 libavcodec/rpi_qpu.c -+ create mode 100644 libavcodec/rpi_qpu.h -+ create mode 100644 libavcodec/rpi_shader.c -+ create mode 100644 libavcodec/rpi_shader.h -+ create mode 100644 libavcodec/rpi_shader.qasm -+ create mode 100644 libavcodec/rpi_user_vcsm.h -+ -+diff --git a/libavcodec/Makefile b/libavcodec/Makefile -+index fd0d1f0..03065cd 100644 -+--- a/libavcodec/Makefile -++++ b/libavcodec/Makefile -+@@ -5,6 +5,10 @@ NAME = avcodec -+ HEADERS = avcodec.h \ -+ avdct.h \ -+ avfft.h \ -++ rpi_qpu.h \ -++ rpi_shader.h \ -++ rpi_mailbox.h \ -++ rpi_hevc_transform.h \ -+ d3d11va.h \ -+ dirac.h \ -+ dv_profile.h \ -+@@ -43,6 +47,9 @@ OBJS = allcodecs.o \ -+ resample.o \ -+ resample2.o \ -+ utils.o \ -++ rpi_qpu.o \ -++ rpi_shader.o \ -++ rpi_mailbox.o \ -+ vorbis_parser.o \ -+ xiph.o \ -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index aa45dd6..ab55df1 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -41,6 +41,10 @@ -+ #include "hevc.h" -+ #include "profiles.h" -+ -++#ifdef RPI -++#include "rpi_qpu.h" -++#endif -++ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -+ /** -+@@ -2430,7 +2434,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- rpi_execute_pred_cmds(s); -++ if (x_ctb + ctb_size >= s->ps.sps->width) { -++ rpi_execute_pred_cmds(s); -++ } -+ #endif -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = -1; -+@@ -3244,6 +3250,31 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ if (!s->coeffs_buf) -+ goto fail; -+ s->enable_rpi = 0; -++ -++ // A little test program -++ { -++ GPU_MEM_PTR_T p; -++ int err = gpu_malloc_cached(16, &p); -++ short *q = (short *)p.arm; -++ int i; -++ int r; -++ printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); -++ printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); -++ printf("Preparing data %p\n",q); -++ for(i=0;i<16;i++) -++ q[i] = i; -++ printf("Flush cache\n"); -++ gpu_cache_flush(&p); -++ printf("Executing code\n"); -++ r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); -++ printf("Return value %d (",r); -++ for(i=0;i<16;i++) -++ printf("%d ",q[i]); -++ printf(")\n"); -++ gpu_free(&p); -++ goto fail; // Early out -++ } -++ -+ #endif -+ -+ s->cabac_state = av_malloc(HEVC_CONTEXTS); -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+new file mode 100644 -+index 0000000..85a9102 -+--- /dev/null -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -0,0 +1,212 @@ -++unsigned char rpi_hevc_transform [] = { -++169, -++3, -++3, -++232, -++128, -++0, -++0, -++0, -++20, -++248, -++0, -++136, -++0, -++0, -++192, -++248, -++0, -++0, -++0, -++96, -++3, -++232, -++32, -++0, -++0, -++0, -++7, -++232, -++0, -++2, -++0, -++0, -++8, -++232, -++0, -++4, -++0, -++0, -++12, -++248, -++0, -++128, -++0, -++0, -++192, -++8, -++4, -++0, -++4, -++232, -++64, -++0, -++0, -++0, -++5, -++232, -++0, -++0, -++8, -++0, -++128, -++69, -++113, -++66, -++12, -++248, -++0, -++128, -++0, -++0, -++192, -++8, -++4, -++0, -++128, -++69, -++113, -++70, -++128, -++144, -++39, -++0, -++4, -++255, -++48, -++192, -++128, -++3, -++32, -++8, -++16, -++0, -++76, -++254, -++48, -++192, -++9, -++4, -++32, -++8, -++0, -++0, -++4, -++254, -++0, -++144, -++128, -++2, -++0, -++248, -++62, -++0, -++128, -++144, -++22, -++0, -++4, -++255, -++48, -++192, -++128, -++3, -++32, -++8, -++16, -++0, -++76, -++254, -++48, -++192, -++9, -++4, -++32, -++8, -++0, -++0, -++140, -++248, -++44, -++0, -++0, -++0, -++32, -++48, -++4, -++0, -++128, -++69, -++113, -++66, -++242, -++140, -++211, -++192, -++41, -++3, -++68, -++192, -++80, -++7, -++164, -++255, -++36, -++220, -++96, -++2, -++0, -++248, -++62, -++0, -++3, -++255, -++55, -++208, -++120, -++3, -++224, -++3, -++190, -++11, -++16, -++139, -++246, -++83, -++0, -++103, -++90, -++0, -++8, -++240, -++0, -++128, -++128, -++3, -++0, -++247, -++32, -++128, -++10, -++4, -++136, -++240, -++32, -++0, -++128, -++3, -++112, -++96, -++90, -++0, -++}; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+new file mode 100644 -+index 0000000..5e2728d -+--- /dev/null -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -0,0 +1,147 @@ -++# ****************************************************************************** -++# Argon Design Ltd. -++# (c) Copyright 2015 Argon Design Ltd. All rights reserved. -++# -++# Module : HEVC -++# Author : Peter de Rivaz -++# ****************************************************************************** -++ -++# HEVC VPU Transform -++# -++# Transform matrix can be thought of as -++# output row vector = input row vector * transMatrix2 -++# -++# The even rows of the matrix are symmetric -++# The odd rows of the matrix are antisymmetric -++# -++# So only need to compute the first half of the results, then can compute the remainder with a butterfly -++# -++# EXAMPLE -++# (a b c d) (1 2 2 1) -++# (3 4 -4 -3) -++# (5 6 6 5) -++# (7 8 -8 -7) -++# -++# x=(a c)(1 2) = 1a+5c 2a+6c -++# (5 6) -++# -++# y=(b d)(3 4) = 3b+7d 4b+8d -++# (7 8) -++# -++# u=x+y = 1a+5c+3b+7d 2a+4b+6c+8d -++# v=x-y = 1a+5c-3b-7d 2a+6c-4b-8d -++# -++# Final results are (u , v[::-1]) -++# -++# -++# For 32x1 input, load even rows into HX(0++,0), odd rows into HX(16++,0) -++# Apply the even matrix first and stop before rounding -++# Then apply the odd matrix in a full manner: -++# -++# First step is to compute partial products with the first input (16 cycles) -++# 1a 3b 5c 7d 16x1 input coefficients produce 16x16 output -++# 2a 4b 6c 8d -++# 2a -4b 6c -8d -++# 1a -3b 5c -7d -++# -++# Second step is to sum partial products into final position (8 cycles) -++# 1a+3b+5c+7d -++# 2a+4b+6c+8d -++# 2a-4b+6c-8d -++# 1a-3b+5c-7d -++# -++# Then can apply butterfly to combine even results and odd results + rounding to produce 16 rows of output at a time (need to save in transposed format) -++# -++# For 16x16 no butterfly is required and can store final results in original location (Could do 2 16x16s in parallel to make use of the trick - saves on the adds) -++# -++# For 8x8 we could compute two in parallel. -++# -++# -++ -++test_add: -++ vldh HX(0,0),(r0) -++ vadd HX(0,0),HX(0,0),10 -++ vsth HX(0,0),(r0) -++ mov r0,7 # return value -++ b lr -++ -++# Columns are transformed first -++# -++# Store top left half of transMatrix2 in -++# Store bottom left half of transMatrix2 in HX(32,32) -++# -++# For 16x16 -++# HX(0:15,0) contains input data before transform -++# HY(0:15,0) contains 32bit output data after transform -++# HX(32,0) contains even rows of left half of transMatrix2 -++# HX(32,32) contains odd rows of left half of transMatrix2 -++# HY(48,0) contains partial products ready for summing -++# -++ -++ -++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) -++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -++# num: number of 16x16 transforms to be done -++# -++hevc_trans_16x16: -++ push r6-r15, lr # TODO cut down number of used registers -++ -++ mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes -++ vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -++ # Now use r0 to describe which matrix we are working on. -++ # Allows us to prefetch the next block of coefficients for efficiency. -++ mov r0,0 # This describes the location where we read our coefficients from -++ mov r3,16*2 # Stride of coefficients in bytes -++ mov r7,16*16*2 # Total block size -++ mov r8,64*16 # Value used to swap from current to next VRF location -++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ mov r4,64 # Constant used for rounding first pass -++ mov r5,1<<19 # Constant used for rounding second pass -++ -++ # At start of block r0,r1 point to the current block (that has already been loaded) -++block_loop: -++ eor r0,r8 -++ add r1,r7 -++ # Prefetch the next block -++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ eor r0,r8 -++ sub r1,r7 -++ -++ # Transform the current block -++ bl col_trans_16 -++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -++ vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position -++ -++ bl col_trans_16 -++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -++ -++ # Save results - note there has been a transposition during the processing so we save columns -++ vsth VX(0,32++)+r0, (r1 += r3) REP 16 -++ -++ # Move onto next block -++ eor r0,r8 -++ add r1,r7 -++ -++ addcmpbgt r2,-1,0,block_loop -++ pop r6-r15, pc -++ -++# r1,r2,r3 r7,r8 should be preserved -++# HX(0++,0)+r0 is the block to be transformed -++# HX(32++,0) is the 16x16 matrix of transform coefficients -++# Use HY(48,0) for intermediate results -++# r0 can be used, but should be returned to its original value at the end -++col_trans_16: -++ add r4,r0,16 # Final value for this loop -++col_trans_16_loop: -++ # First compute partial products for a single column -++ vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 -++ # Then sum up the results and place back -++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -++ addcmpblt r0,1,r4,col_trans_16_loop -++ sub r0,16 # but r0 back to its original value -++ b lr -+diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -+new file mode 100644 -+index 0000000..536896f -+--- /dev/null -++++ b/libavcodec/rpi_mailbox.c -+@@ -0,0 +1,293 @@ -++/* -++Copyright (c) 2012, Broadcom Europe Ltd. -++All rights reserved. -++ -++Redistribution and use in source and binary forms, with or without -++modification, are permitted provided that the following conditions are met: -++ * Redistributions of source code must retain the above copyright -++ notice, this list of conditions and the following disclaimer. -++ * Redistributions in binary form must reproduce the above copyright -++ notice, this list of conditions and the following disclaimer in the -++ documentation and/or other materials provided with the distribution. -++ * Neither the name of the copyright holder nor the -++ names of its contributors may be used to endorse or promote products -++ derived from this software without specific prior written permission. -++ -++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -++*/ -++ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++ -++#include -++ -++#define MAJOR_NUM 100 -++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) -++#define DEVICE_FILE_NAME "/dev/char_dev" -++ -++#include "rpi_mailbox.h" -++ -++#define PAGE_SIZE (4*1024) -++ -++// Shared memory will not be cached in ARM cache -++void *mapmem_shared(unsigned base, unsigned size) -++{ -++ int mem_fd; -++ unsigned offset = base % PAGE_SIZE; -++ base = base - offset; -++ /* open /dev/mem */ -++ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { -++ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); -++ return NULL; -++ } -++ void *mem = mmap( -++ 0, -++ size, -++ PROT_READ|PROT_WRITE, -++ MAP_SHARED/*|MAP_FIXED*/, -++ mem_fd, -++ base); -++#ifdef DEBUG -++ printf("base=0x%x, mem=%p\n", base, mem); -++#endif -++ if (mem == MAP_FAILED) { -++ printf("mmap error %d\n", (int)mem); -++ return NULL; -++ } -++ close(mem_fd); -++ return (char *)mem + offset; -++} -++ -++// Unshared memory will be faster as lives in ARM cache, but requires cache flushing -++void *mapmem_private(unsigned base, unsigned size) -++{ -++ int mem_fd; -++ unsigned offset = base % PAGE_SIZE; -++ base = base - offset; -++ /* open /dev/mem */ -++ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { -++ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); -++ return NULL; -++ } -++ void *mem = mmap( -++ 0, -++ size, -++ PROT_READ|PROT_WRITE, -++ MAP_PRIVATE/*|MAP_FIXED*/, -++ mem_fd, -++ base); -++#ifdef DEBUG -++ printf("base=0x%x, mem=%p\n", base, mem); -++#endif -++ if (mem == MAP_FAILED) { -++ printf("mmap error %d\n", (int)mem); -++ return NULL; -++ } -++ close(mem_fd); -++ return (char *)mem + offset; -++} -++ -++void unmapmem(void *addr, unsigned size) -++{ -++ int s = munmap(addr, size); -++ if (s != 0) { -++ printf("munmap error %d\n", s); -++ exit (-1); -++ } -++} -++ -++/* -++ * use ioctl to send mbox property message -++ */ -++ -++static int mbox_property(int file_desc, void *buf) -++{ -++ int ret_val = ioctl(file_desc, IOCTL_MBOX_PROPERTY, buf); -++ -++ if (ret_val < 0) { -++ printf("ioctl_set_msg failed:%d\n", ret_val); -++ } -++ -++#ifdef DEBUG -++ unsigned *p = buf; int i; unsigned size = *(unsigned *)buf; -++ for (i=0; i -++#include -++#include -++#include -++#include -++ -++#include "config.h" -++ -++#include -++#include -++ -++#include "rpi_mailbox.h" -++#include "rpi_qpu.h" -++#include "rpi_shader.h" -++#include "rpi_hevc_transform.h" -++ -++#ifdef RPI_USE_VCSM -++#include "rpi_user_vcsm.h" -++#endif -++ -++// On Pi2 there is no way to access the VPU L2 cache -++// GPU_MEM_FLG should be 4 for uncached memory. -++// However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -++// The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -++#define GPU_MEM_FLG 0xC -++#define GPU_MEM_MAP 0x0 -++ -++#define vcos_verify(x) ((x)>=0) -++ -++typedef unsigned char uint8_t; -++typedef signed char int8_t; -++typedef unsigned short uint16_t; -++typedef unsigned int uint32_t; -++typedef int int32_t; -++ -++/*static const unsigned code[] = -++{ -++ #include "rpi_shader.hex" -++};*/ -++ -++// Size in 32bit words -++#define QPU_CODE_SIZE 2048 -++#define VPU_CODE_SIZE 2048 -++ -++struct GPU -++{ -++ unsigned int qpu_code[QPU_CODE_SIZE]; -++ unsigned int vpu_code[VPU_CODE_SIZE]; -++ int open_count; // Number of allocated video buffers -++ unsigned int vc_handle; // Handle of this memory -++ int mb; // Mailbox handle -++ int vc; // Address in GPU memory -++ int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -++}; -++ -++// Stop more than one thread trying to allocate memory or use the processing resources at once -++static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -++static volatile struct GPU* gpu = NULL; -++ -++#ifdef RPI_TIME_TOTAL_QPU -++static unsigned int Microseconds(void) { -++ struct timespec ts; -++ unsigned int x; -++ static unsigned int base = 0; -++ clock_gettime(CLOCK_REALTIME, &ts); -++ x = ts.tv_sec*1000000 + ts.tv_nsec/1000; -++ if (base==0) base=x; -++ return x-base; -++} -++#endif -++ -++// Connect to QPU, returns 0 on success. -++static int gpu_init(volatile struct GPU **gpu) { -++ int mb = mbox_open(); -++ int vc; -++ int handle; -++ volatile struct GPU* ptr; -++ if (mb < 0) -++ return -1; -++ -++ if (qpu_enable(mb, 1)) return -2; -++ -++#ifdef RPI_USE_VCSM -++ vcsm_init(); -++#endif -++ -++ handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); -++ if (!handle) -++ { -++ qpu_enable(mb, 0); -++ return -3; -++ } -++ vc = mem_lock(mb, handle); -++ ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); -++ if (ptr == NULL) -++ { mem_free(mb, handle); -++ mem_unlock(mb, handle); -++ qpu_enable(mb, 0); -++ return -4; -++ } -++ -++ ptr->mb = mb; -++ ptr->vc_handle = handle; -++ ptr->vc = vc; -++ -++ *gpu = ptr; -++ -++ // Now copy over the QPU code into GPU memory -++ { -++ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); -++ assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -++ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -++ } -++ // And the VPU code -++ { -++ int num_bytes = sizeof(rpi_hevc_transform); -++ assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -++ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -++ } -++ -++ return 0; -++} -++ -++// Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -++static void gpu_lock(void) { -++ pthread_mutex_lock(&gpu_mutex); -++ if (gpu==NULL) { -++ gpu_init(&gpu); -++ } -++} -++ -++static void gpu_unlock(void) { -++ pthread_mutex_unlock(&gpu_mutex); -++} -++ -++// Allocate memory on GPU -++// Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes -++// Returns 0 on success. -++// This allocates memory that will not be cached in ARM's data cache. -++// Therefore safe to use without data cache flushing. -++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { -++ gpu_lock(); -++ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -++ p->vcsm_handle = 0; -++ if (!p->vc_handle) -++ { -++ qpu_enable(gpu->mb, 0); -++ return -3; -++ } -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -++ p->numbytes = numbytes; -++ if (p->arm == NULL) -++ { -++ mem_free(gpu->mb, p->vc_handle); -++ mem_unlock(gpu->mb, p->vc_handle); -++ gpu_unlock(); -++ qpu_enable(gpu->mb, 0); -++ return -4; -++ } -++ gpu->open_count++; -++ gpu_unlock(); -++ return 0; -++} -++ -++void gpu_cache_flush(GPU_MEM_PTR_T *p) -++{ -++ // This only works when using RPI_USE_VCSM -++ void *tmp = vcsm_lock(p->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++} -++ -++// This allocates data that will be -++// Cached in ARM L2 -++// Uncached in VPU L2 -++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -++ gpu_lock(); -++#ifdef RPI_USE_VCSM -++ { -++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) -++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -++ p->arm = vcsm_lock(p->vcsm_handle); -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ } -++#else -++ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -++ p->vcsm_handle = 0; -++ if (!p->handle) -++ { -++ qpu_enable(gpu->mb, 0); -++ return -3; -++ } -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ printf("This mapmem_private does not seem to work\n"); -++ exit(-1); -++ p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -++ p->numbytes = numbytes; -++ if (p->arm == NULL) -++ { -++ mem_free(gpu->mb, p->handle); -++ mem_unlock(gpu->mb, p->handle); -++ gpu_unlock(); -++ qpu_enable(gpu->mb, 0); -++ return -4; -++ } -++#endif -++ gpu->open_count++; -++ gpu_unlock(); -++ return 0; -++} -++ -++static void gpu_term(void) -++{ -++ int mb = gpu->mb; -++ unsigned handle = gpu->vc_handle; -++ if (gpu==NULL) -++ return; -++ unmapmem((void*)gpu, sizeof(struct GPU)); -++ mem_unlock(mb, handle); -++ mem_free(mb, handle); -++ qpu_enable(mb, 0); -++#ifdef RPI_USE_VCSM -++ vcsm_exit(); -++#endif -++ mbox_close(mb); -++ gpu = NULL; -++} -++ -++void gpu_free(GPU_MEM_PTR_T *p) { -++ int mb = gpu->mb; -++ unsigned handle = p->vc_handle; -++ gpu_lock(); -++#ifdef RPI_USE_VCSM -++ if (p->vcsm_handle) { -++ mem_unlock(mb,p->vc_handle); -++ vcsm_unlock_ptr(p->arm); -++ vcsm_free(p->vcsm_handle); -++ } else { -++ unmapmem((void*)p->arm, sizeof(struct GPU)); -++ mem_unlock(mb, handle); -++ mem_free(mb, handle); -++ } -++#else -++ unmapmem((void*)p->arm, sizeof(struct GPU)); -++ mem_unlock(mb, handle); -++ mem_free(mb, handle); -++#endif -++ -++ gpu->open_count--; -++ if (gpu->open_count==0) { -++ printf("Closing GPU\n"); -++ gpu_term(); -++ gpu = NULL; -++ } -++ gpu_unlock(); -++} -++ -++unsigned int vpu_get_fn(void) { -++ // Make sure that the gpu is initialized -++ if (gpu==NULL) { -++ printf("Preparing gpu\n"); -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ return gpu->vc + offsetof(struct GPU,vpu_code); -++} -++ -++unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -++{ -++ unsigned r; -++ gpu_lock(); -++ r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); -++ gpu_unlock(); -++ return r; -++} -++ -++// Run a program on a QPU with the given code and uniform stream (given in GPU addresses) -++// The first num QPUs will start at code, the next num2 QPUs will start at code2 -++void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12) -++{ -++ int i; -++#ifdef RPI_TIME_TOTAL_QPU -++ static int last_time=0; -++ static long long on_time=0; -++ static long long off_time=0; -++ int start_time; -++ int end_time; -++ static int count=0; -++#endif -++ -++ gpu_lock(); -++#ifdef RPI_TIME_TOTAL_QPU -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -++ for(i=0;imail[i*2 + 1] = code; -++ } -++ for(;imail[i*2 + 1] = code2; -++ } -++ gpu->mail[0 ] = unifs1; -++ gpu->mail[2 ] = unifs2; -++ gpu->mail[4 ] = unifs3; -++ gpu->mail[6 ] = unifs4; -++ gpu->mail[8 ] = unifs5; -++ gpu->mail[10] = unifs6; -++ gpu->mail[12] = unifs7; -++ gpu->mail[14] = unifs8; -++ gpu->mail[16] = unifs9; -++ gpu->mail[18] = unifs10; -++ gpu->mail[20] = unifs11; -++ gpu->mail[22] = unifs12; -++ execute_qpu( -++ gpu->mb, -++ 12 /* Number of QPUs */, -++ gpu->vc + offsetof(struct GPU, mail), -++ 1 /* no flush */, // Don't flush VPU L1 cache -++ 5000 /* timeout ms */); -++#ifdef RPI_TIME_TOTAL_QPU -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ if ((count&0x7f)==0) -++ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); -++#endif -++ gpu_unlock(); -++} -++ -++unsigned int qpu_get_fn(int num) { -++ // Make sure that the gpu is initialized -++ unsigned int *fn; -++ if (gpu==NULL) { -++ printf("Preparing gpu\n"); -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ switch(num) { -++ case QPU_MC_SETUP: -++ fn = mc_setup; -++ break; -++ case QPU_MC_FILTER: -++ fn = mc_filter; -++ break; -++ case QPU_MC_EXIT: -++ fn = mc_exit; -++ break; -++ case QPU_MC_INTERRUPT_EXIT: -++ fn = mc_interrupt_exit; -++ break; -++ case QPU_MC_FILTER_B: -++ fn = mc_filter_b; -++ break; -++ case QPU_MC_FILTER_HONLY: -++ fn = mc_filter_honly; -++ break; -++ case QPU_MC_SETUP_UV: -++ fn = mc_setup_uv; -++ break; -++ case QPU_MC_FILTER_UV: -++ fn = mc_filter_uv; -++ break; -++ case QPU_MC_FILTER_UV_B: -++ fn = mc_filter_uv_b; -++ break; -++ case QPU_MC_END: -++ fn = mc_end; -++ break; -++ default: -++ printf("Unknown function\n"); -++ exit(-1); -++ } -++ return gpu->vc + 4*(int)(fn-rpi_shader); -++ //return code[num] + gpu->vc; -++} -++ -++#if 0 -++ -++int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; -++//int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -++int32_t vcoeffs[] = {-2, 6, -13, 37, 115, -20, 9, -4}; -++//int32_t vcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -++ -++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0-1) & 0xff) | ((c1-1) & 0xff) << 8 | ((c2-1) & 0xff) << 16 | ((c3-1) & 0xff) << 24); -++ -++static uint8_t av_clip_uint8(int32_t a) -++{ -++ if (a&(~255)) return (-a)>>31; -++ else return a; -++} -++ -++static int32_t filter8(const uint8_t *data, int pitch) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ -++ for (y = 0; y < 8; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 8; x++) -++ hsum += hcoeffs[x]*data[x + y * pitch]; -++ -++ vsum += vcoeffs[y]*av_clip_uint8( (hsum + 64) >> 7); // Added brackets to stop compiler warning -++ } -++ -++ return av_clip_uint8( (vsum + 64) >> 7); -++} -++ -++// Note regression changes coefficients so is not thread safe -++//#define REGRESSION -++#ifdef REGRESSION -++#define CMAX 100 -++#else -++#define CMAX 2 -++#endif -++#define YMAX 16 -++ -++int rpi_test_shader(void) -++{ -++ int i, c; -++ -++ uint32_t *unifs; -++ -++ uint8_t *in_buffer; -++ uint8_t *out_buffer[2]; -++ -++ GPU_MEM_PTR_T unifs_ptr; -++ GPU_MEM_PTR_T in_buffer_ptr; -++ GPU_MEM_PTR_T out_buffer_ptr[2]; -++ -++ // Addresses in GPU memory of filter programs -++ uint32_t mc_setup = 0; -++ uint32_t mc_filter = 0; -++ uint32_t mc_exit = 0; -++ -++ int pitch = 0x500; -++ -++ if (gpu==NULL) { -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ -++ printf("This needs to change to reflect new assembler\n"); -++ // Use table to compute locations of program start points -++ mc_setup = code[0] + gpu->vc; -++ mc_filter = code[1] + gpu->vc; -++ mc_exit = code[2] + gpu->vc; -++ -++ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { -++ return -2; -++ } -++ unifs = (uint32_t*)unifs_ptr.arm; -++ -++ if (!vcos_verify(gpu_malloc_uncached(64*23,&in_buffer_ptr))) { -++ return -3; -++ } -++ in_buffer = (uint8_t*)in_buffer_ptr.arm; -++ -++ if (!vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[0])) || !vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[1]))) { -++ return -4; -++ } -++ out_buffer[0] = (uint8_t*)out_buffer_ptr[0].arm; -++ out_buffer[1] = (uint8_t*)out_buffer_ptr[1].arm; -++ -++ for (c = 0; c < CMAX; c++) { -++ int xo[] = {rand()&31, rand()&31}; -++ -++#ifdef REGRESSION -++ for (i = 0; i < 8; i++) { -++ hcoeffs[i] = (int8_t)rand(); -++ vcoeffs[i] = (int8_t)rand(); -++ if (hcoeffs[i]==-128) -++ hcoeffs[i]++; -++ if (vcoeffs[i]==-128) -++ vcoeffs[i]++; -++ } -++#endif -++ -++ for (i = 0; i < 64*23; i++) { -++ //printf("%d %d %p\n",i,gpu->mb,&in_buffer[i]); -++ in_buffer[i] = rand(); -++ } -++ -++ // Clear output array -++ { -++ int b; -++ for(b=0;b<2;b++) { -++ for(i=0;i<16*16;i++) { -++ out_buffer[b][i] = 3; -++ } -++ } -++ } -++ -++ unifs[0] = mc_filter; -++ unifs[1] = in_buffer_ptr.vc+xo[0]+16; -++ unifs[2] = 64; // src pitch -++ unifs[3] = pitch; // dst pitch -++ unifs[4] = 0; // Padding -++ unifs[5] = 0; -++ unifs[6] = 0; -++ unifs[7 ] = mc_filter; -++ unifs[8 ] = in_buffer_ptr.vc+xo[1]+16; -++ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -++ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -++ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -++ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -++ unifs[13] = out_buffer_ptr[0].vc; -++ unifs[14] = mc_exit; -++ unifs[15] = in_buffer_ptr.vc+xo[1]+16; // dummy -++ unifs[16] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -++ unifs[17] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -++ unifs[18] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -++ unifs[19] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -++ unifs[20] = out_buffer_ptr[1].vc; -++ -++ printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); -++ -++ // flush_dcache(); TODO is this needed on ARM side? - tried to use the direct alias to avoid this problem -++ -++ //qpu_run_shader(mc_setup, unifs_ptr.vc); -++ //qpu_run_shader(gpu, gpu->vc, unifs_ptr.vc); -++ rpi_do_block(in_buffer_ptr.vc+xo[0]+16, 64, out_buffer_ptr[0].vc, pitch,out_buffer[0]); -++ rpi_do_block(in_buffer_ptr.vc+xo[1]+16, 64, out_buffer_ptr[1].vc, pitch,out_buffer[1]); -++ -++ if (1) -++ { -++ int x, y, b; -++ int bad = 0; -++ -++ for (b=0; b<2; ++b) -++ for (y=0; yvc; -++ mc_filter = code[1] + gpu->vc; -++ mc_exit = code[2] + gpu->vc; -++ -++ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { -++ return; -++ } -++ //gpu_malloc_uncached(16*dst_pitch,&out_buffer_ptr); -++ //out_buffer = (uint8_t*)out_buffer_ptr.arm; -++ -++ /*for (y=0; y<16; ++y) { -++ for (x=0; x<16; ++x) { -++ out_buffer[x+y*dst_pitch] = 7; -++ } -++ }*/ -++ -++ unifs = (uint32_t*)unifs_ptr.arm; -++ -++ unifs[0] = mc_filter; -++ unifs[1] = (int)in_buffer_vc; -++ unifs[2] = src_pitch; // src pitch -++ unifs[3] = dst_pitch; // dst pitch -++ unifs[4] = 0; // Padding -++ unifs[5] = 0; -++ unifs[6] = 0; -++ unifs[7 ] = mc_exit; -++ unifs[8 ] = (int)in_buffer_vc; -++ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -++ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -++ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -++ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -++ unifs[13] = (int)dst_vc; -++ //unifs[13] = (int)out_buffer_ptr.vc; -++ -++ //printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); -++ -++ qpu_run_shader(mc_setup, unifs_ptr.vc); -++ -++ /*for (y=0; y<16; ++y) { -++ for (x=0; x<16; ++x) { -++ dst[x+y*dst_pitch] = out_buffer[x+y*dst_pitch]; -++ } -++ }*/ -++ -++ gpu_free(&unifs_ptr); -++ //gpu_free(&out_buffer_ptr); -++} -++ -++ -++#endif -++ -++#endif // RPI -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+new file mode 100644 -+index 0000000..4e3c35c -+--- /dev/null -++++ b/libavcodec/rpi_qpu.h -+@@ -0,0 +1,45 @@ -++#ifndef RPI_QPU_H -++#define RPI_QPU_H -++ -++typedef struct gpu_mem_ptr_s { -++ unsigned char *arm; // Pointer to memory mapped on ARM side -++ int vc_handle; // Videocore handle of relocatable memory -++ int vcsm_handle; // Handle for use by VCSM -++ int vc; // Address for use in GPU code -++ int numbytes; // Size of memory block -++} GPU_MEM_PTR_T; -++ -++// General GPU functions -++extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -++extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -++extern void gpu_free(GPU_MEM_PTR_T *p); -++extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -++ -++// QPU specific functions -++extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -++ -++enum { -++ QPU_MC_SETUP, -++ QPU_MC_FILTER, -++ QPU_MC_EXIT, -++ QPU_MC_INTERRUPT_EXIT, -++ QPU_MC_FILTER_B, -++ QPU_MC_FILTER_HONLY, -++ QPU_MC_SETUP_UV, -++ QPU_MC_FILTER_UV, -++ QPU_MC_FILTER_UV_B, -++ QPU_MC_END -++ }; -++extern unsigned int qpu_get_fn(int num); -++ -++// VPU specific functions -++extern unsigned int vpu_get_fn(void); -++extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -++ -++// Simple test of shader code -++extern int rpi_test_shader(void); -++ -++extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); -++extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); -++ -++#endif -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+new file mode 100644 -+index 0000000..41cc2e1 -+--- /dev/null -++++ b/libavcodec/rpi_shader.c -+@@ -0,0 +1,818 @@ -++#include "rpi_shader.h" -++ -++#ifdef _MSC_VER -++ #include -++ /* cast through uintptr_t to avoid warnings */ -++ #define POINTER_TO_UINT(X) ((unsigned int)(uintptr_t)(X)) -++#else -++ #define POINTER_TO_UINT(X) ((unsigned int)(X)) -++#endif -++ -++#ifdef __cplusplus -++extern "C" { /* the types are probably wrong... */ -++#endif -++#ifdef __cplusplus -++} -++#endif -++ -++#ifdef _MSC_VER -++__declspec(align(8)) -++#elif defined(__GNUC__) -++__attribute__((aligned(8))) -++#endif -++unsigned int rpi_shader[] = { -++// ::mc_setup -++/* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -++/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 -++/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch -++/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 -++/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++// ::mc_filter_uv -++/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :uvloop -++/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter -++/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -++/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :loop -++/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// :fast_path -++/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :fast_loop -++/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -++/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -++/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -++/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_b -++/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :bloop -++/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -++/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_honly -++/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -++/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -++/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :loop_honly -++/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -++/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -++/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -++/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -++/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -++/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -++/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_exit -++/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_exit1 -++/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit -++/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit4 -++/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit8 -++/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_setup_uv -++/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif -++/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 -++/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++// ::mc_filter_uv_b -++/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :uvloop_b -++/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_end -++}; -++#ifdef __HIGHC__ -++#pragma Align_to(8, rpi_shader) -++#endif -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+new file mode 100644 -+index 0000000..db971f4 -+--- /dev/null -++++ b/libavcodec/rpi_shader.h -+@@ -0,0 +1,20 @@ -++#ifndef rpi_shader_H -++#define rpi_shader_H -++ -++extern unsigned int rpi_shader[]; -++ -++#define mc_setup (rpi_shader + 0) -++#define mc_filter_uv (rpi_shader + 146) -++#define mc_filter (rpi_shader + 360) -++#define mc_filter_b (rpi_shader + 670) -++#define mc_filter_honly (rpi_shader + 894) -++#define mc_exit (rpi_shader + 1048) -++#define mc_exit1 (rpi_shader + 1066) -++#define mc_interrupt_exit (rpi_shader + 1082) -++#define mc_interrupt_exit4 (rpi_shader + 1120) -++#define mc_interrupt_exit8 (rpi_shader + 1142) -++#define mc_setup_uv (rpi_shader + 1172) -++#define mc_filter_uv_b (rpi_shader + 1314) -++#define mc_end (rpi_shader + 1542) -++ -++#endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+new file mode 100644 -+index 0000000..6851e83 -+--- /dev/null -++++ b/libavcodec/rpi_shader.qasm -+@@ -0,0 +1,1413 @@ -++# register allocation -++# -++# ra0...ra7 eight horizontal filter coefficients -++# -++# rb1...rb7 seven shifted copies of the current unfiltered row -++# -++# ra8...ra15 eight filtered rows of context (rb15 == most recent) -++# -++# (ra15 isn't clamped to zero - this happens during the -++# copy to ra14, and during its use in the vertical filter) -++# -++# rb8...rb15 eight vertical filter coefficients -++# -++# ra16 clipped(row start address+elem_num)&~3 -++# ra17 per-channel shifts -++# ra19 next ra17 -++# -++# rb16 pitch -++# rb17 height + 5 -++# rb18 height + 7 -++# rb19 next ra16 -++# -++# ra20 1 -++# ra21 64 -++# ra22 256 -++# ra23 8 -++# -++# rb20 0xffffff00 -++# rb21 64 -++# rb22 255 -++# rb23 24 -++# -++# rb24 vdw_setup_1(dst_pitch) -++# rb25 frame width-1 -++# rb26 height<<23 + width<<16 + vdw_setup_0 -++# rb27 vdw_setup_0 (depends on QPU number) -++# rb28 vpm_setup (depends on QPU number) -++# rb29 vdw_setup_1(dst_pitch-width) -++# rb30 frame height-1 -++# rb31 used as temp to count loop iterations -++# -++# ra24...ra30 15, 14, 13, 12, 11, 10, 9 -++# ra24 clipped(row start address+8+elem_num)&~3 -++# ra25 per-channel shifts 2 -++# ra26 next ra24 -++# ra27 next ra25 -++# ra28 next y -++# ra29 y for next texture access -++# -++# ra31 next kernel address -++ -++.set rb_frame_width_minus_1, rb25 -++.set rb_frame_height_minus_1, rb30 -++.set rb_pitch, rb16 -++.set ra_x_base, ra16 -++.set rb_x_base_next, rb19 -++.set ra_x2_base, ra24 -++.set ra_x2_base_next, ra26 -++.set ra_xshift, ra17 -++ -++.set ra_x2shift, ra25 -++.set ra_u2v_ref_offset, ra25 -++ -++.set ra_xshift_next, ra19 -++ -++.set ra_x2shift_next, ra27 -++.set ra_u2v_dst_offset, ra27 -++ -++.set ra_y_next, ra28 -++.set ra_y, ra29 -++ -++.set rb_const_64, rb21 -++ -++# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) -++::mc_setup -++ -++# Read starting kernel -++mov ra31, unif -++ -++# Load first request location -++add ra_x_base, unif, elem_num # Store x -++mov ra_y, unif # Store y -++mov ra_x2_base, unif # Store frame base -++ -++# Read image dimensions -++sub rb25,unif,1 -++sub rb30,unif,1 -++ -++# get source pitch -++mov rb16, unif -++ -++# get destination pitch -++mov r0, unif -++mov r1, vdw_setup_1(0) -++add rb24, r1, r0 -++ -++# load constants -++ -++mov ra20, 1 -++mov ra21, 64 -++mov ra22, 256 -++mov ra23, 8 -++ -++mov rb20, 0xffffff00 -++mov rb21, 64 -++mov rb22, 255 -++mov rb23, 24 -++ -++# touch vertical context to keep simulator happy -++ -++mov ra8, 0 -++mov ra9, 0 -++mov ra10, 0 -++mov ra11, 0 -++mov ra12, 0 -++mov ra13, 0 -++mov ra14, 0 -++mov ra15, 0 -++ -++# Compute part of VPM to use for DMA output -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 -++ -++# Compute part of VPM to save data into -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) -++add rb28, r0, r1 -++ -++# Compute base address for first and second access -++#add r0, unif, elem_num # x -++mov r0, ra_x_base # Load x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, ra_y # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++add ra_y, r1, 1 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++max r1, r1, 0 # y -++min r1, r1, rb_frame_height_minus_1 -++add r0, r0, r3; mul24 r1, r1, rb_pitch -++add r2, r2, r3 -++and r0, r0, ~3 -++and r2, r2, ~3; mov ra_x_base, r0 -++# submit texture requests for first line -++add t0s, r0, r1 ; mov ra_x2_base, r2 -++add t0s, r2, r1 -++ -++# Dump padding words -++mov r0, unif -++mov r0, unif -++ -++# submit texture requests for second line -++max r1, ra_y, 0 -++min r1, r1, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 -++bra -, ra31 -++nop ; mul24 r1, r1, rb_pitch -++add t0s, r1, ra_x_base -++add t0s, r1, ra_x2_base -++ -++################################################################################ -++ -++# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_uv -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -++shl ra_xshift_next, r0, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -++add r0, r0, r3 -++and rb_x_base_next, r0, ~3 -++mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:uvloop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:uvloop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++brr.anyn -, r:uvloop -++asr r1, r1, 15 -++min r1, r1, rb22 -++max vpm, r1, 0 -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -++ -++bra -, ra31 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -++ -++# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov ra_x2shift, ra_x2shift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++add r0, r0, r3 -++add r2, r2, r3 -++and rb_x_base_next, r0, ~3 -++and ra_x2_base_next, r2, ~3 -++mov ra_y_next, r1 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++brr.anynn -, r:fast_path -++asr rb12, r0, rb23 # delay slot 1 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 # delay slot 2 -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++## sub r2, r2, r3 ; ldtmu0 -++## -++## mov r0, ra22 -++## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # apply horizontal filter -++## -++## asr r2, r2, 15 ; mul24 r3, r0, ra0 -++## min r2, r2, rb22 -++## max ra13, r2, 0 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra14, r0, 0 -++## -++## -++## -++## -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra15, r0, 0 -++ -++ -++ -++ -++mov r3, 0 -++ -++:loop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:loop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++brr.anyn -, r:loop -++asr r1, r1, 15 -++min r1, r1, rb22 -++max vpm, r1, 0 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++#################################################### -++ -++:fast_path -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## sub r2, r2, r3 ; ldtmu0 -++## -++## mov r0, ra22 -++## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # apply horizontal filter -++## -++## asr r2, r2, 15 ; mul24 r3, r0, ra0 -++## min r2, r2, rb22 -++## max ra13, r2, 0 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra14, r0, 0 -++## -++## -++## -++## -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra15, r0, 0 -++ -++ -++mov r3, 0 # This signifies the amount of unrolling -++ -++:fast_loop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_y, ra_y_next ; mov rb31, r3 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -++ -++max r2, ra_y, 0 -++min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++sub r0, r2, r3 ; mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++ -++brr.anyn -, r:fast_loop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++brr.anyn -, r:fast_loop -++asr r1, r1, 15 -++min r1, r1, rb22 -++max vpm, r1, 0 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -++# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_b -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov ra_x2shift, ra_x2shift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++add r0, r0, r3 -++add r2, r2, r3 -++and rb_x_base_next, r0, ~3 -++and ra_x2_base_next, r2, ~3 -++mov ra_y_next, r1 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++# r0 is currently height<<7 -++# For vr_setup we want height<<20 (so 20-7=13 additional bits) -++shl r3, r0, 13 -++shl r3, r3, 8 # Mask off top 8 bits -++shr r3, r3, 8 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++# In a B frame, so also set up VPM read -++add vr_setup, r3, rb28 -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov r3, 0 -++ -++:bloop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:bloop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 15 ; mov -, vr_wait -++min r1, r1, rb22 -++add r0, vpm, 1 # Blend in previous VPM contents at this location -++brr.anyn -, r:bloop -++max r1, r1, 0 -++add r1, r1, r0 -++shr vpm, r1, 1 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -++# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -++# This filter only does horizontal filtering. -++# It is assumed that the region to fetch does not include extra rows above. -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_honly -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov ra_x2shift, ra_x2shift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++add r0, r0, r3 -++add r2, r2, r3 -++and rb_x_base_next, r0, ~3 -++and ra_x2_base_next, r2, ~3 -++mov ra_y_next, r1 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, -2 # Pipelining means we move data across 2 iterations early -++shl r0, r0, 7 ; mov rb18,r0 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++mov r0, unif -++ -++# r2 is elem_num -++# r3 is loop counter -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -++mov r3, 0 -++ -++:loop_honly -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 ; mov r3, rb31 -++ -++sub.setf -, r3, rb18 ; mov r1, ra22 -++ -++mov -, vw_wait ; mul24 r0, r0, r1 -++brr.anyn -, r:loop_honly -++asr r0, r0, 15 # delay 1 -++min r0, r0, rb22 # delay 2 -++max vpm, r0, 0 # delay 3 -++ -++# DMA out -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++ -++################################################################################ -++ -++# mc_exit() -++ -++::mc_exit -++mov -, vw_wait # wait on the VDW -++ -++mov -,srel(0) -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++nop ; nop ; thrend -++nop ; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++::mc_exit1 -++mov -, vw_wait # wait on the VDW -++ -++#mov -,srel(1) -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++# mc_interrupt_exit() -++::mc_interrupt_exit -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++mov -,sacq(0) # 4 -++mov -,sacq(0) # 5 -++mov -,sacq(0) # 6 -++mov -,sacq(0) # 7 -++mov -,sacq(0) # 8 -++mov -,sacq(0) # 9 -++mov -,sacq(0) # 10 -++mov -,sacq(0) # 11 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++# mc_interrupt_exit4() -++::mc_interrupt_exit4 -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++# mc_interrupt_exit8() -++::mc_interrupt_exit8 -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++mov -,sacq(0) # 4 -++mov -,sacq(0) # 5 -++mov -,sacq(0) # 6 -++mov -,sacq(0) # 7 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++################################################################################ -++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -++::mc_setup_uv -++ -++# Read starting kernel -++mov ra31, unif -++ -++# Load first request location -++add ra_x_base, unif, elem_num # Store x -++mov ra_y, unif # Store y -++mov ra_x2_base, unif # Store frame u base -++nop -++sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -++ -++# Read image dimensions -++sub rb25,unif,1 -++sub rb30,unif,1 -++ -++# get source pitch -++mov rb16, unif -++ -++# get destination pitch -++mov r0, unif -++mov r1, vdw_setup_1(0) -++add rb24, r1, r0 -++ -++# load constants -++ -++mov ra20, 1 -++mov ra21, 64 -++mov ra22, 256 -++mov ra23, 8 -++ -++mov rb20, 0xffffff00 -++mov rb21, 64 -++mov rb22, 255 -++mov rb23, 24 -++ -++# touch vertical context to keep simulator happy -++ -++mov ra8, 0 -++mov ra9, 0 -++mov ra10, 0 -++mov ra11, 0 -++mov ra12, 0 -++mov ra13, 0 -++mov ra14, 0 -++mov ra15, 0 -++ -++# Compute part of VPM to use for DMA output -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 -++ -++# Compute part of VPM to save data into -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) -++add rb28, r0, r1 -++ -++# Compute base address for first and second access -++mov r0, ra_x_base # Load x -++max r0, r0, 0; mov r1, ra_y # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -++shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++add ra_y, r1, 1 -++add r0, r0, r3 -++and r0, r0, ~3 -++max r1, r1, 0 ; mov ra_x_base, r0 # y -++min r1, r1, rb_frame_height_minus_1 -++# submit texture requests for first line -++add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++add t0s, r0, r1 ; mov ra_x2_base, r2 -++add t0s, r2, r1 -++ -++# Dump padding words -++mov r0, unif -++mov r0, unif -++mov r0, unif -++ -++# submit texture requests for second line -++max r1, ra_y, 0 -++min r1, r1, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 -++bra -, ra31 -++nop ; mul24 r1, r1, rb_pitch -++add t0s, r1, ra_x_base -++add t0s, r1, ra_x2_base -++ -++ -++ -++################################################################################ -++ -++::mc_filter_uv_b -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -++shl ra_xshift_next, r0, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -++add r0, r0, r3 -++and rb_x_base_next, r0, ~3 -++mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++ -++# r0 is currently height<<7 -++# For vr_setup we want height<<20 (so 20-7=13 additional bits) -++shl r3, r0, 13 -++shl r3, r3, 8 # Mask off top 8 bits -++shr r3, r3, 8 -++ -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# In a B frame, so also set up VPM read -++add vr_setup, r3, rb28 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:uvloop_b -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:uvloop_b -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 15 -++min r1, r1, rb22 -++add r0, vpm, 1 # Blend in previous VPM contents at this location -++brr.anyn -, r:uvloop_b -++max r1, r1, 0 -++add r1, r1, r0 -++shr vpm, r1, 1 -++ -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -++ -++bra -, ra31 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++::mc_end -+diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -+new file mode 100644 -+index 0000000..fbebbbe -+--- /dev/null -++++ b/libavcodec/rpi_user_vcsm.h -+@@ -0,0 +1,425 @@ -++/* -++Copyright (c) 2012, Broadcom Europe Ltd -++All rights reserved. -++ -++Redistribution and use in source and binary forms, with or without -++modification, are permitted provided that the following conditions are met: -++ * Redistributions of source code must retain the above copyright -++ notice, this list of conditions and the following disclaimer. -++ * Redistributions in binary form must reproduce the above copyright -++ notice, this list of conditions and the following disclaimer in the -++ documentation and/or other materials provided with the distribution. -++ * Neither the name of the copyright holder nor the -++ names of its contributors may be used to endorse or promote products -++ derived from this software without specific prior written permission. -++ -++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -++*/ -++ -++#ifndef __USER_VCSM__H__INCLUDED__ -++#define __USER_VCSM__H__INCLUDED__ -++ -++/* VideoCore Shared Memory - user interface library. -++** -++** This library provides all the necessary abstraction for any application to -++** make use of the shared memory service which is distributed accross a kernel -++** driver and a videocore service. -++** -++** It is an application design decision to choose or not to use this service. -++** -++** The logical flow of operations that a user application needs to follow when -++** using this service is: -++** -++** 1) Initialize the service. -++** 2) Allocate shared memory blocks. -++** 3) Start using the allocated blocks. -++** - In order to gain ownership on a block, lock the allocated block, -++** locking a block returns a valid address that the user application -++** can access. -++** - When finished with using the block for the current execution cycle -++** or function, and so when giving up the ownership, unlock the block. -++** 4) A block can be locked/unlocked as many times required - within or outside -++** of - a specific execution context. -++** 5) To completely release an allocated block, free it. -++** 6) If the service is no longer required, terminate it. -++** -++** -++** Some generic considerations: -++ -++** Allocating memory blocks. -++** -++** Memory blocks can be allocated in different manners depending on the cache -++** behavior desired. A given block can either be: -++ -++** - Allocated in a non cached fashion all the way through host and videocore. -++** - Allocated in a cached fashion on host OR videocore. -++** - Allocated in a cached fashion on host AND videocore. -++** -++** It is an application decision to determine how to allocate a block. Evidently -++** if the application will be doing substantial read/write accesses to a given block, -++** it is recommended to allocate the block at least in a 'host cached' fashion for -++** better results. -++** -++** -++** Locking memory blocks. -++** -++** When the memory block has been allocated in a host cached fashion, locking the -++** memory block (and so taking ownership of it) will trigger a cache invalidation. -++** -++** For the above reason and when using host cached allocation, it is important that -++** an application properly implements the lock/unlock mechanism to ensure cache will -++** stay coherent, otherwise there is no guarantee it will at all be. -++** -++** It is possible to dynamically change the host cache behavior (ie cached or non -++** cached) of a given allocation without needing to free and re-allocate the block. -++** This feature can be useful for such application which requires access to the block -++** only at certain times and not otherwise. By changing the cache behavior dynamically -++** the application can optimize performances for a given duration of use. -++** Such dynamic cache behavior remapping only applies to host cache and not videocore -++** cache. If one requires to change the videocore cache behavior, then a new block -++** must be created to replace the old one. -++** -++** On successful locking, a valid pointer is returned that the application can use -++** to access to data inside the block. There is no guarantee that the pointer will -++** stay valid following the unlock action corresponding to this lock. -++** -++** -++** Unocking memory blocks. -++** -++** When the memory block has been allocated in a host cached fashion, unlocking the -++** memory block (and so forgiving its ownership) will trigger a cache flush unless -++** explicitely asked not to flush the cache for performances reasons. -++** -++** For the above reason and when using host cached allocation, it is important that -++** an application properly implements the lock/unlock mechanism to ensure cache will -++** stay coherent, otherwise there is no guarantee it will at all be. -++** -++** -++** A complete API is defined below. -++*/ -++ -++#ifdef __cplusplus -++extern "C" -++{ -++#endif -++ -++/* Different status that can be dumped. -++*/ -++typedef enum -++{ -++ VCSM_STATUS_VC_WALK_ALLOC = 0, // Walks *all* the allocation on videocore. -++ // Result of the walk is seen in the videocore -++ // log. -++ VCSM_STATUS_HOST_WALK_MAP, // Walks the *full* mapping allocation on host -++ // driver (ie for all processes). Result of -++ // the walk is seen in the kernel log. -++ VCSM_STATUS_HOST_WALK_PID_MAP, // Walks the per process mapping allocation on host -++ // driver (for current process). Result of -++ // the walk is seen in the kernel log. -++ VCSM_STATUS_HOST_WALK_PID_ALLOC, // Walks the per process host allocation on host -++ // driver (for current process). Result of -++ // the walk is seen in the kernel log. -++ VCSM_STATUS_VC_MAP_ALL, // Equivalent to both VCSM_STATUS_VC_WALK_ALLOC and -++ // VCSM_STATUS_HOST_WALK_MAP. -++ // -++ VCSM_STATUS_NONE, // Must be last - invalid. -++ -++} VCSM_STATUS_T; -++ -++/* Different kind of cache behavior. -++*/ -++typedef enum -++{ -++ VCSM_CACHE_TYPE_NONE = 0, // No caching applies. -++ VCSM_CACHE_TYPE_HOST, // Allocation is cached on host (user space). -++ VCSM_CACHE_TYPE_VC, // Allocation is cached on videocore. -++ VCSM_CACHE_TYPE_HOST_AND_VC, // Allocation is cached on both host and videocore. -++ -++} VCSM_CACHE_TYPE_T; -++ -++/* Initialize the vcsm processing. -++** -++** Must be called once before attempting to do anything else. -++** -++** Returns 0 on success, -1 on error. -++*/ -++int vcsm_init( void ); -++ -++ -++/* Terminates the vcsm processing. -++** -++** Must be called vcsm services are no longer needed, it will -++** take care of removing any allocation under the current process -++** control if deemed necessary. -++*/ -++void vcsm_exit( void ); -++ -++ -++/* Queries the status of the the vcsm. -++** -++** Triggers dump of various kind of information, see the -++** different variants specified in VCSM_STATUS_T. -++** -++** Pid is optional. -++*/ -++void vcsm_status( VCSM_STATUS_T status, int pid ); -++ -++ -++/* Allocates a non-cached block of memory of size 'size' via the vcsm memory -++** allocator. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** On success, the user must invoke vcsm_lock with the returned opaque -++** handle to gain access to the memory associated with the opaque handle. -++** When finished using the memory, the user calls vcsm_unlock_xx (see those -++** function definition for more details on the one that can be used). -++** -++** A well behaved application should make every attempt to lock/unlock -++** only for the duration it needs to access the memory data associated with -++** the opaque handle. -++*/ -++unsigned int vcsm_malloc( unsigned int size, char *name ); -++ -++ -++/* Allocates a cached block of memory of size 'size' via the vcsm memory -++** allocator, the type of caching requested is passed as argument of the -++** function call. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** On success, the user must invoke vcsm_lock with the returned opaque -++** handle to gain access to the memory associated with the opaque handle. -++** When finished using the memory, the user calls vcsm_unlock_xx (see those -++** function definition for more details on the one that can be used). -++** -++** A well behaved application should make every attempt to lock/unlock -++** only for the duration it needs to access the memory data associated with -++** the opaque handle. -++*/ -++unsigned int vcsm_malloc_cache( unsigned int size, VCSM_CACHE_TYPE_T cache, char *name ); -++ -++ -++/* Shares an allocated block of memory via the vcsm memory allocator. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** On success, the user must invoke vcsm_lock with the returned opaque -++** handle to gain access to the memory associated with the opaque handle. -++** When finished using the memory, the user calls vcsm_unlock_xx (see those -++** function definition for more details on the one that can be used). -++** -++** A well behaved application should make every attempt to lock/unlock -++** only for the duration it needs to access the memory data associated with -++** the opaque handle. -++*/ -++unsigned int vcsm_malloc_share( unsigned int handle ); -++ -++ -++/* Resizes a block of memory allocated previously by vcsm_alloc. -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** The handle must be unlocked by user prior to attempting any -++** resize action. -++** -++** On error, the original size allocated against the handle -++** remains available the same way it would be following a -++** successful vcsm_malloc. -++*/ -++int vcsm_resize( unsigned int handle, unsigned int new_size ); -++ -++ -++/* Frees a block of memory that was successfully allocated by -++** a prior call the vcms_alloc. -++** -++** The handle should be considered invalid upon return from this -++** call. -++** -++** Whether any memory is actually freed up or not as the result of -++** this call will depends on many factors, if all goes well it will -++** be freed. If something goes wrong, the memory will likely end up -++** being freed up as part of the vcsm_exit process. In the end the -++** memory is guaranteed to be freed one way or another. -++*/ -++void vcsm_free( unsigned int handle ); -++ -++ -++/* Retrieves a videocore opaque handle from a mapped user address -++** pointer. The videocore handle will correspond to the actual -++** memory mapped in videocore. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** Note: the videocore opaque handle is distinct from the user -++** opaque handle (allocated via vcsm_malloc) and it is only -++** significant for such application which knows what to do -++** with it, for the others it is just a number with little -++** use since nothing can be done with it (in particular -++** for safety reason it cannot be used to map anything). -++*/ -++unsigned int vcsm_vc_hdl_from_ptr( void *usr_ptr ); -++ -++ -++/* Retrieves a videocore opaque handle from a opaque handle -++** pointer. The videocore handle will correspond to the actual -++** memory mapped in videocore. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** Note: the videocore opaque handle is distinct from the user -++** opaque handle (allocated via vcsm_malloc) and it is only -++** significant for such application which knows what to do -++** with it, for the others it is just a number with little -++** use since nothing can be done with it (in particular -++** for safety reason it cannot be used to map anything). -++*/ -++unsigned int vcsm_vc_hdl_from_hdl( unsigned int handle ); -++ -++ -++/* Retrieves a user opaque handle from a mapped user address -++** pointer. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++*/ -++unsigned int vcsm_usr_handle( void *usr_ptr ); -++ -++ -++/* Retrieves a mapped user address from an opaque user -++** handle. -++** -++** Returns: 0 on error -++** a non-zero address on success. -++** -++** On success, the address corresponds to the pointer -++** which can access the data allocated via the vcsm_malloc -++** call. -++*/ -++void *vcsm_usr_address( unsigned int handle ); -++ -++ -++/* Locks the memory associated with this opaque handle. -++** -++** Returns: NULL on error -++** a valid pointer on success. -++** -++** A user MUST lock the handle received from vcsm_malloc -++** in order to be able to use the memory associated with it. -++** -++** On success, the pointer returned is only valid within -++** the lock content (ie until a corresponding vcsm_unlock_xx -++** is invoked). -++*/ -++void *vcsm_lock( unsigned int handle ); -++ -++ -++/* Locks the memory associated with this opaque handle. The lock -++** also gives a chance to update the *host* cache behavior of the -++** allocated buffer if so desired. The *videocore* cache behavior -++** of the allocated buffer cannot be changed by this call and such -++** attempt will be ignored. -++** -++** The system will attempt to honour the cache_update mode request, -++** the cache_result mode will provide the final answer on which cache -++** mode is really in use. Failing to change the cache mode will not -++** result in a failure to lock the buffer as it is an application -++** decision to choose what to do if (cache_result != cache_update) -++** -++** The value returned in cache_result can only be considered valid if -++** the returned pointer is non NULL. The cache_result pointer may be -++** NULL if the application does not care about the actual outcome of -++** its action with regards to the cache behavior change. -++** -++** Returns: NULL on error -++** a valid pointer on success. -++** -++** A user MUST lock the handle received from vcsm_malloc -++** in order to be able to use the memory associated with it. -++** -++** On success, the pointer returned is only valid within -++** the lock content (ie until a corresponding vcsm_unlock_xx -++** is invoked). -++*/ -++void *vcsm_lock_cache( unsigned int handle, -++ VCSM_CACHE_TYPE_T cache_update, -++ VCSM_CACHE_TYPE_T *cache_result ); -++ -++ -++/* Unlocks the memory associated with this user mapped address. -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking a mapped address, the user should no longer -++** attempt to reference it. -++*/ -++int vcsm_unlock_ptr( void *usr_ptr ); -++ -++ -++/* Unlocks the memory associated with this user mapped address. -++** Apply special processing that would override the otherwise -++** default behavior. -++** -++** If 'cache_no_flush' is specified: -++** Do not flush cache as the result of the unlock (if cache -++** flush was otherwise applicable in this case). -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking a mapped address, the user should no longer -++** attempt to reference it. -++*/ -++int vcsm_unlock_ptr_sp( void *usr_ptr, int cache_no_flush ); -++ -++ -++/* Unlocks the memory associated with this user opaque handle. -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking an opaque handle, the user should no longer -++** attempt to reference the mapped addressed once associated -++** with it. -++*/ -++int vcsm_unlock_hdl( unsigned int handle ); -++ -++ -++/* Unlocks the memory associated with this user opaque handle. -++** Apply special processing that would override the otherwise -++** default behavior. -++** -++** If 'cache_no_flush' is specified: -++** Do not flush cache as the result of the unlock (if cache -++** flush was otherwise applicable in this case). -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking an opaque handle, the user should no longer -++** attempt to reference the mapped addressed once associated -++** with it. -++*/ -++int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -++ -++#ifdef __cplusplus -++} -++#endif -++ -++#endif /* __USER_VCSM__H__INCLUDED__ */ -+-- -+2.7.4 -+ -+ -+From 6cfa5910be47865aaaf58c185587189c332765a6 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Sat, 2 May 2015 21:15:37 +0100 -+Subject: [PATCH 04/68] First working version with uncached memory -+ -+--- -+ libavcodec/hevc.c | 61 +++++- -+ libavcodec/hevc.h | 12 +- -+ libavcodec/hevc_cabac.c | 39 +++- -+ libavcodec/hevc_filter.c | 16 ++ -+ libavcodec/hevcpred_template.c | 6 + -+ libavcodec/rpi_hevc_transform.h | 422 +++++++++++++++++++++++++++++++++++++++- -+ libavcodec/rpi_hevc_transform.s | 153 +++++++++++++-- -+ libavcodec/rpi_qpu.c | 72 +++++++ -+ libavcodec/rpi_qpu.h | 1 + -+ 9 files changed, 736 insertions(+), 46 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ab55df1..94ff709 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -45,6 +45,8 @@ -+ #include "rpi_qpu.h" -+ #endif -+ -++// #define DISABLE_MC -++ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -+ /** -+@@ -1079,11 +1081,15 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -++ printf("Cross component not supported\n"); // TODO -++ exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+ -+ if (lc->tu.cross_pf) { -++ printf("Cross component not supported\n"); // TODO -++ exit(-1); -+ hls_cross_component_pred(s, 1); -+ } -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+@@ -1112,6 +1118,8 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -++ printf("Cross component not supported\n"); // TODO -++ exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+@@ -1409,6 +1417,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ int idx = ff_hevc_pel_weight[block_w]; -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ x_off += mv->x >> 2; -+ y_off += mv->y >> 2; -+ src += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); -+@@ -1479,6 +1491,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ uint8_t *src0 = ref0->data[0] + y_off0 * src0stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); -+ uint8_t *src1 = ref1->data[0] + y_off1 * src1stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ if (x_off0 < QPEL_EXTRA_BEFORE || y_off0 < QPEL_EXTRA_AFTER || -+ x_off0 >= pic_width - block_w - QPEL_EXTRA_AFTER || -+ y_off0 >= pic_height - block_h - QPEL_EXTRA_AFTER) { -+@@ -1564,6 +1580,10 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ intptr_t _mx = mx << (1 - hshift); -+ intptr_t _my = my << (1 - vshift); -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ x_off += mv->x >> (2 + hshift); -+ y_off += mv->y >> (2 + vshift); -+ src0 += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); -+@@ -1628,6 +1648,10 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF -+ int hshift = s->ps.sps->hshift[1]; -+ int vshift = s->ps.sps->vshift[1]; -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift); -+ intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift); -+ intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift); -+@@ -2367,6 +2391,22 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ } -+ -+ #ifdef RPI -++static void rpi_execute_transform(HEVCContext *s) -++{ -++ int i=2; -++ //int j; -++ //int16_t *coeffs = s->coeffs_buf_arm[i]; -++ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -++ // s->hevcdsp.idct[4-2](coeffs, 16); -++ //} -++ -++ //gpu_cache_flush(&s->coeffs_buf[i]); -++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -++ -++ for(i=0;i<4;i++) -++ s->num_coeffs[i] = 0; -++} -++ -+ static void rpi_execute_pred_cmds(HEVCContext *s) -+ { -+ int i; -+@@ -2387,7 +2427,6 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ } -+ } -+ s->num_pred_cmds = 0; -+- s->num_coeffs = 0; -+ } -+ #endif -+ -+@@ -2434,7 +2473,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- if (x_ctb + ctb_size >= s->ps.sps->width) { -++ if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! -++ rpi_execute_transform(s); -+ rpi_execute_pred_cmds(s); -+ } -+ #endif -+@@ -3179,7 +3219,9 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->unif_mv_cmds); -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+- av_freep(&s->coeffs_buf); -++ for(i = 0; i < 4; i++) { -++ gpu_free(&s->coeffs_buf[i]); -++ } -+ #endif -+ -+ for (i = 0; i < 3; i++) { -+@@ -3246,13 +3288,16 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+- s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); -+- if (!s->coeffs_buf) -+- goto fail; -++ for(i = 0; i < 4; i++) { -++ gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -++ s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -++ if (!s->coeffs_buf_arm[i]) -++ goto fail; -++ } -+ s->enable_rpi = 0; -+ -+ // A little test program -+- { -++ /*{ -+ GPU_MEM_PTR_T p; -+ int err = gpu_malloc_cached(16, &p); -+ short *q = (short *)p.arm; -+@@ -3273,7 +3318,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ printf(")\n"); -+ gpu_free(&p); -+ goto fail; // Early out -+- } -++ }*/ -+ -+ #endif -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 7a1c35f..4167985 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -40,6 +40,11 @@ -+ #include "thread.h" -+ #include "videodsp.h" -+ -++// define RPI to split the CABAC/prediction/transform into separate stages -++#ifdef RPI -++#include "rpi_qpu.h" -++#endif -++ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+ #define MAX_REFS 16 -+ -+@@ -856,11 +861,12 @@ typedef struct HEVCContext { -+ HEVCMvCmd *unif_mv_cmds; -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+- int16_t *coeffs_buf; -+- int num_mv_cmds; -++ GPU_MEM_PTR_T coeffs_buf[4]; -++ int16_t *coeffs_buf_arm[4]; -++ int num_coeffs[4]; -+ int num_xfm_cmds; -++ int num_mv_cmds; -+ int num_pred_cmds; -+- int num_coeffs; -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 4e97f06..d1cba86 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1031,6 +1031,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int vshift = s->ps.sps->vshift[c_idx]; -+ uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + -+ ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; -+ int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -+ uint8_t significant_coeff_group_flag[8][8] = {{0}}; -+ int explicit_rdpcm_flag = 0; -+@@ -1044,6 +1045,18 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ uint8_t dc_scale; -+ int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : -+ lc->tu.intra_pred_mode_c; -++#ifdef RPI -++ if (s->enable_rpi) { -++ int n = trafo_size * trafo_size; -++ if (use_vpu) { -++ coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; -++ s->num_coeffs[log2_trafo_size - 2] += n; -++ } else { -++ coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; -++ s->num_coeffs[0] += n; -++ } -++ } -++#endif -+ -+ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ -+@@ -1488,6 +1501,24 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { -+ s->hevcdsp.idct_4x4_luma(coeffs); -+ } else { -++#ifdef RPI -++ if (!use_vpu) { -++ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -++ if (max_xy == 0) -++ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -++ else { -++ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; -++ if (max_xy < 4) -++ col_limit = FFMIN(4, col_limit); -++ else if (max_xy < 8) -++ col_limit = FFMIN(8, col_limit); -++ else if (max_xy < 12) -++ col_limit = FFMIN(24, col_limit); -++ -++ s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); -++ } -++ } -++#else -+ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -+ if (max_xy == 0) -+ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -+@@ -1501,6 +1532,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ col_limit = FFMIN(24, col_limit); -+ s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); -+ } -++#endif -+ } -+ } -+ if (lc->tu.cross_pf) { -+@@ -1512,14 +1544,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ #ifdef RPI -+ if (s->enable_rpi) { -+- int16_t *c = s->coeffs_buf + s->num_coeffs; -+- int n = trafo_size * trafo_size; -+ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+- memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy -+- s->num_coeffs += n; -++ //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+- cmd->buf = c; -++ cmd->buf = coeffs; -+ cmd->dst = dst; -+ cmd->stride = stride; -+ return; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 1f33b0c..e4c3da7 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -22,6 +22,10 @@ -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -++//#define DISABLE_SAO -++//#define DISABLE_DEBLOCK -++//#define DISABLE_STRENGTHS -++ -+ #include "libavutil/common.h" -+ #include "libavutil/internal.h" -+ -+@@ -273,6 +277,10 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) -+ edges[2] = x_ctb == s->ps.sps->ctb_width - 1; -+ edges[3] = y_ctb == s->ps.sps->ctb_height - 1; -+ -++#ifdef DISABLE_SAO -++ return; -++#endif -++ -+ if (restore) { -+ if (!edges[0]) { -+ left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]]; -+@@ -496,6 +504,10 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->ps.sps->pcm.loop_filter_disable_flag) || -+ s->ps.pps->transquant_bypass_enable_flag; -+ -++#ifdef DISABLE_DEBLOCK -++ return; -++#endif -++ -+ if (x0) { -+ left_tc_offset = s->deblock[ctb - 1].tc_offset; -+ left_beta_offset = s->deblock[ctb - 1].beta_offset; -+@@ -726,6 +738,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ int boundary_upper, boundary_left; -+ int i, j, bs; -+ -++#ifdef DISABLE_STRENGTHS -++ return; -++#endif -++ -+ boundary_upper = y0 > 0 && !(y0 & 7); -+ if (boundary_upper && -+ ((!s->sh.slice_loop_filter_across_slices_enabled_flag && -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 6ae87cc..71c6d52 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -20,6 +20,8 @@ -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -++//#define DISABLE_INTRA -++ -+ #include "libavutil/pixdesc.h" -+ -+ #include "bit_depth_template.c" -+@@ -114,6 +116,10 @@ do { \ -+ int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, s->ps.sps->width) - -+ (x0 + size_in_luma_h)) >> hshift; -+ -++#ifdef DISABLE_INTRA -++ return; -++#endif -++ -+ if (s->ps.pps->constrained_intra_pred_flag == 1) { -+ int size_in_luma_pu_v = PU(size_in_luma_v); -+ int size_in_luma_pu_h = PU(size_in_luma_h); -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index 85a9102..c0c279f 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -3,11 +3,11 @@ unsigned char rpi_hevc_transform [] = { -+ 3, -+ 3, -+ 232, -+-128, -++32, -+ 0, -+ 0, -+ 0, -+-20, -++12, -+ 248, -+ 0, -+ 136, -+@@ -56,9 +56,9 @@ unsigned char rpi_hevc_transform [] = { -+ 5, -+ 232, -+ 0, -+-0, -+ 8, -+ 0, -++0, -+ 128, -+ 69, -+ 113, -+@@ -108,8 +108,8 @@ unsigned char rpi_hevc_transform [] = { -+ 128, -+ 2, -+ 0, -+-248, -+-62, -++8, -++2, -+ 0, -+ 128, -+ 144, -+@@ -123,13 +123,13 @@ unsigned char rpi_hevc_transform [] = { -+ 3, -+ 32, -+ 8, -+-16, -++20, -+ 0, -+ 76, -+ 254, -+ 48, -+ 192, -+-9, -++4, -+ 4, -+ 32, -+ 8, -+@@ -155,14 +155,46 @@ unsigned char rpi_hevc_transform [] = { -+ 192, -+ 41, -+ 3, -+-68, -++70, -++192, -++80, -++7, -++164, -++255, -++36, -++204, -++96, -++2, -++0, -++248, -++62, -++0, -++3, -++255, -++55, -++208, -++120, -++3, -++224, -++3, -++190, -++11, -++16, -++139, -++246, -++91, -++0, -++103, -++90, -++0, -++70, -+ 192, -+ 80, -+ 7, -+ 164, -+ 255, -+ 36, -+-220, -++204, -+ 96, -+ 2, -+ 0, -+@@ -182,7 +214,7 @@ unsigned char rpi_hevc_transform [] = { -+ 16, -+ 139, -+ 246, -+-83, -++91, -+ 0, -+ 103, -+ 90, -+@@ -209,4 +241,374 @@ unsigned char rpi_hevc_transform [] = { -+ 96, -+ 90, -+ 0, -++169, -++3, -++3, -++232, -++32, -++0, -++0, -++0, -++12, -++248, -++0, -++136, -++0, -++0, -++192, -++248, -++0, -++0, -++64, -++232, -++0, -++2, -++0, -++0, -++12, -++248, -++0, -++168, -++0, -++0, -++192, -++248, -++0, -++0, -++3, -++232, -++128, -++0, -++0, -++0, -++7, -++232, -++0, -++2, -++0, -++0, -++4, -++232, -++64, -++0, -++0, -++0, -++5, -++232, -++0, -++8, -++0, -++0, -++57, -++239, -++224, -++247, -++255, -++255, -++72, -++192, -++95, -++207, -++88, -++122, -++88, -++124, -++137, -++64, -++26, -++64, -++161, -++64, -++152, -++64, -++128, -++144, -++31, -++0, -++72, -++232, -++32, -++0, -++0, -++0, -++65, -++232, -++32, -++0, -++0, -++0, -++128, -++144, -++23, -++0, -++145, -++64, -++168, -++64, -++128, -++144, -++19, -++0, -++72, -++232, -++32, -++0, -++0, -++0, -++65, -++232, -++32, -++0, -++0, -++0, -++128, -++144, -++11, -++0, -++74, -++232, -++0, -++8, -++0, -++0, -++242, -++140, -++229, -++192, -++57, -++239, -++32, -++8, -++0, -++0, -++41, -++3, -++12, -++248, -++0, -++128, -++0, -++0, -++192, -++8, -++4, -++0, -++12, -++248, -++0, -++132, -++64, -++0, -++192, -++8, -++4, -++0, -++0, -++96, -++255, -++159, -++131, -++255, -++0, -++232, -++0, -++4, -++0, -++0, -++255, -++159, -++142, -++255, -++4, -++255, -++48, -++204, -++16, -++3, -++224, -++251, -++62, -++0, -++5, -++255, -++51, -++204, -++128, -++3, -++224, -++251, -++16, -++0, -++77, -++254, -++51, -++204, -++9, -++4, -++224, -++251, -++0, -++0, -++128, -++64, -++6, -++232, -++64, -++0, -++0, -++0, -++140, -++248, -++47, -++0, -++0, -++0, -++224, -++99, -++0, -++0, -++4, -++254, -++0, -++144, -++128, -++2, -++0, -++8, -++2, -++0, -++32, -++247, -++240, -++207, -++16, -++3, -++32, -++247, -++176, -++207, -++17, -++3, -++32, -++247, -++112, -++207, -++18, -++3, -++32, -++247, -++48, -++207, -++19, -++3, -++32, -++247, -++240, -++206, -++20, -++3, -++32, -++247, -++176, -++206, -++21, -++3, -++32, -++247, -++112, -++206, -++22, -++3, -++32, -++247, -++48, -++206, -++23, -++3, -++32, -++247, -++240, -++205, -++24, -++3, -++32, -++247, -++176, -++205, -++25, -++3, -++32, -++247, -++112, -++205, -++26, -++3, -++32, -++247, -++48, -++205, -++27, -++3, -++32, -++247, -++240, -++204, -++28, -++3, -++32, -++247, -++176, -++204, -++29, -++3, -++32, -++247, -++112, -++204, -++30, -++3, -++32, -++247, -++48, -++204, -++31, -++3, -++5, -++255, -++51, -++204, -++128, -++3, -++224, -++251, -++16, -++0, -++77, -++254, -++51, -++204, -++9, -++4, -++224, -++251, -++0, -++0, -++0, -++237, -++0, -++4, -++0, -++0, -++140, -++248, -++47, -++0, -++0, -++0, -++224, -++99, -++0, -++0, -++90, -++0, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index 5e2728d..1e389c7 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -58,13 +58,6 @@ -+ # -+ # -+ -+-test_add: -+- vldh HX(0,0),(r0) -+- vadd HX(0,0),HX(0,0),10 -+- vsth HX(0,0),(r0) -+- mov r0,7 # return value -+- b lr -+- -+ # Columns are transformed first -+ # -+ # Store top left half of transMatrix2 in -+@@ -79,7 +72,7 @@ test_add: -+ # -+ -+ -+-# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) -++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) # TODO add size so we can branch to correct implementation (or perhaps have coeffs32 and num32 as secondary inputs!) -+ # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -+ # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+ # num: number of 16x16 transforms to be done -+@@ -87,17 +80,17 @@ test_add: -+ hevc_trans_16x16: -+ push r6-r15, lr # TODO cut down number of used registers -+ -+- mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes -+- vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -++ mov r3, 16*2 # Stride of transMatrix2 in bytes -++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -+ # Now use r0 to describe which matrix we are working on. -+ # Allows us to prefetch the next block of coefficients for efficiency. -+ mov r0,0 # This describes the location where we read our coefficients from -+- mov r3,16*2 # Stride of coefficients in bytes -++ mov r3,16*2 # Stride of coefficients in bytes (TODO remove) -+ mov r7,16*16*2 # Total block size -+ mov r8,64*16 # Value used to swap from current to next VRF location -+ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -+ mov r4,64 # Constant used for rounding first pass -+- mov r5,1<<19 # Constant used for rounding second pass -++ mov r5,1<<11 # Constant used for rounding second pass -+ -+ # At start of block r0,r1 point to the current block (that has already been loaded) -+ block_loop: -+@@ -113,12 +106,12 @@ block_loop: -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -+- vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position -++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # For simplicity transpose this back to the original position -+ -+ bl col_trans_16 -+- vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+- #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+- vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r5 REP 16 # Now add on rounding, shift down by 7, and saturate -++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # 4+12=16 so this ends up with the output saturated and in the top half of the word. -++ vasl HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # This should be saturating, but the instruction above does not assemble? (Probably because it ends with ls which is interpreted as a condition flag) -+ -+ # Save results - note there has been a transposition during the processing so we save columns -+ vsth VX(0,32++)+r0, (r1 += r3) REP 16 -+@@ -132,16 +125,136 @@ block_loop: -+ -+ # r1,r2,r3 r7,r8 should be preserved -+ # HX(0++,0)+r0 is the block to be transformed -+-# HX(32++,0) is the 16x16 matrix of transform coefficients -++# HX(32++,0)+r6 is the 16x16 matrix of transform coefficients -+ # Use HY(48,0) for intermediate results -+ # r0 can be used, but should be returned to its original value at the end -+ col_trans_16: -+- add r4,r0,16 # Final value for this loop -++ add r6,r0,16 # Final value for this loop -+ col_trans_16_loop: -+ # First compute partial products for a single column -+- vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 -++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+- addcmpblt r0,1,r4,col_trans_16_loop -++ addcmpblt r0,1,r6,col_trans_16_loop -+ sub r0,16 # but r0 back to its original value -+ b lr -++ -++col_trans_odd_16: -++ add r6,r0,16 # Final value for this loop -++col_trans_odd_16_loop: -++ # First compute partial products for a single column -++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -++ # Then sum up the results and place back -++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -++ addcmpblt r0,1,r6,col_trans_odd_16_loop -++ sub r0,16 # but r0 back to its original value -++ b lr -++ -++ -++test_add: -++ vldh HX(0,0),(r0) -++ vadd HX(0,0),HX(0,0),10 -++ vsth HX(0,0),(r0) -++ mov r0,7 # return value -++ b lr -++ -++# hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) Even followed by odd -++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -++# num: number of 16x16 transforms to be done -++# -++hevc_trans_32x32: -++ push r6-r15, lr # TODO cut down number of used registers -++ -++ # Fetch transform matrices -++ mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -++ add r0, 16*16*2 -++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -++ -++ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer -++ mov r7, 16*16*2 # Total block size -++ mov r4, 64 # Constant used for rounding first pass -++ mov r5, 1<<11 # Constant used for rounding second pass -++ sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) -++ # set r8 to 32byte aligned stack pointer -++ add r8,sp,31 -++ lsr r8,5 -++ lsl r8,5 -++ mov r9,r8 # Backup of the temporary storage -++ mov r10,r1 # Backup of the coefficient buffer -++block_loop32: -++ -++ # COLUMN TRANSFORM -++ # Transform the first 16 columns -++ mov r1,r10 # Input Coefficient buffer -++ mov r8,r9 # Output temporary storage -++ bl trans32 -++ # Transform the second 16 columns -++ add r8,32 -++ add r1,32 -++ bl trans32 -++ -++ # ROW TRANSFORM -++ mov r1,r9 # Input temporary storage -++ mov r8,r10 # Output Coefficient buffer -++ bl trans32 -++ # Transform the second 16 columns -++ add r8,32 -++ add r1,32 -++ bl trans32 -++ -++ add r10, 32*32*2 # move onto next block of coefficients -++ addcmpbgt r2,-1,0,block_loop32 -++ -++ add sp,sp,32*32*2+32 # Restore stack -++ -++ pop r6-r15, pc -++ -++trans32: -++ # We can no longer afford the VRF space to do prefetching when doing 32x32 -++ # Fetch the even rows -++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ # Fetch the odd rows -++ vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -++ -++ # Transform the even rows using even matrix -++ mov r0, 0 # Even rows -++ bl col_trans_16 -++ -++ # Now transform the odd rows using odd matrix -++ mov r0, 64*16 # Odd rows -++ bl col_trans_odd_16 -++ -++ # Now apply butterfly to compute the first 16 results -++ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -++ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -++ # 16bit results now in HX(48,32) -++ mov r0,r8 -++ mov r6,32*2 -++ vsth VX(48,32++),(r0+=r6) REP 16 -++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed -++ -++ # Now apply butterfly to compute the second 16 results (in reverse order) -++ vsub HY(63,0),HY(0,0),HY(16,0) -++ vsub HY(62,0),HY(0,0),HY(17,0) -++ vsub HY(61,0),HY(0,0),HY(18,0) -++ vsub HY(60,0),HY(0,0),HY(19,0) -++ vsub HY(59,0),HY(0,0),HY(20,0) -++ vsub HY(58,0),HY(0,0),HY(21,0) -++ vsub HY(57,0),HY(0,0),HY(22,0) -++ vsub HY(56,0),HY(0,0),HY(23,0) -++ vsub HY(55,0),HY(0,0),HY(24,0) -++ vsub HY(54,0),HY(0,0),HY(25,0) -++ vsub HY(53,0),HY(0,0),HY(26,0) -++ vsub HY(52,0),HY(0,0),HY(27,0) -++ vsub HY(51,0),HY(0,0),HY(28,0) -++ vsub HY(50,0),HY(0,0),HY(29,0) -++ vsub HY(49,0),HY(0,0),HY(30,0) -++ vsub HY(48,0),HY(0,0),HY(31,0) -++ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -++ add r0,r8,16*32*2 # Move to 16th row -++ vsth VX(48,32++),(r0+=r6) REP 16 -++ b lr -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index b1f50ee..d720546 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -3,6 +3,7 @@ -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ #define RPI_USE_VCSM -+ #define RPI_TIME_TOTAL_QPU -++#define RPI_TIME_TOTAL_VPU -+ -+ #include -+ #include -+@@ -48,10 +49,47 @@ typedef int int32_t; -+ #define QPU_CODE_SIZE 2048 -+ #define VPU_CODE_SIZE 2048 -+ -++const short rpi_transMatrix2even[32][16] = { // Even rows first -++{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, -++{90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90}, -++{89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89}, -++{87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87}, -++{83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83}, -++{80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80}, -++{75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75}, -++{70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70}, -++{64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64}, -++{57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57}, -++{50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50}, -++{43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43}, -++{36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36}, -++{25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25}, -++{18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18}, -++{ 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9}, -++// Odd rows -++{90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4}, -++{90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13}, -++{88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22}, -++{85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31}, -++{82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38}, -++{78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46}, -++{73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54}, -++{67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61}, -++{61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67}, -++{54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73}, -++{46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78}, -++{38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82}, -++{31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85}, -++{22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88}, -++{13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90}, -++{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90} -++}; -++ -+ struct GPU -+ { -+ unsigned int qpu_code[QPU_CODE_SIZE]; -+ unsigned int vpu_code[VPU_CODE_SIZE]; -++ short transMatrix2even[16*16]; -+ int open_count; // Number of allocated video buffers -+ unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+@@ -123,6 +161,8 @@ static int gpu_init(volatile struct GPU **gpu) { -+ assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -++ // And the transform coefficients -++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); -+ -+ return 0; -+ } -+@@ -274,11 +314,43 @@ unsigned int vpu_get_fn(void) { -+ return gpu->vc + offsetof(struct GPU,vpu_code); -+ } -+ -++unsigned int vpu_get_constants(void) { -++ if (gpu==NULL) { -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ return gpu->vc + offsetof(struct GPU,transMatrix2even); -++} -++ -+ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -+ { -+ unsigned r; -++#ifdef RPI_TIME_TOTAL_VPU -++ static int last_time=0; -++ static long long on_time=0; -++ static long long off_time=0; -++ int start_time; -++ int end_time; -++ static int count=0; -++ static long long countr2=0; -++#endif -+ gpu_lock(); -++#ifdef RPI_TIME_TOTAL_VPU -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -+ r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); -++#ifdef RPI_TIME_TOTAL_VPU -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ countr2 += r2; -++ if ((count&0x7f)==0) -++ printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); -++#endif -+ gpu_unlock(); -+ return r; -+ } -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 4e3c35c..814fc3c 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -34,6 +34,7 @@ extern unsigned int qpu_get_fn(int num); -+ -+ // VPU specific functions -+ extern unsigned int vpu_get_fn(void); -++extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ -+ // Simple test of shader code -+-- -+2.7.4 -+ -+ -+From 4bb0a7ba6723650e74d63cec2123f76da4c3eb0e Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 5 May 2015 09:41:23 +0100 -+Subject: [PATCH 05/68] Fixed deblocking -+ -+--- -+ libavcodec/hevc.c | 20 +++++++++++++++++--- -+ 1 file changed, 17 insertions(+), 3 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 94ff709..391c57a 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2400,8 +2400,9 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- //gpu_cache_flush(&s->coeffs_buf[i]); -++ gpu_cache_flush(&s->coeffs_buf[i]); -+ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -++ gpu_cache_flush(&s->coeffs_buf[i]); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2440,6 +2441,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -++ int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; -+ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -+ #endif -+ -+@@ -2473,9 +2475,17 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! -++ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -++ int x; -++ // Transform all blocks -+ rpi_execute_transform(s); -++ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles -++ ff_hevc_hls_filters(s, x, y_ctb, ctb_size); -++ } -++ start_ctb_x = 0; -+ } -+ #endif -+ if (more_data < 0) { -+@@ -2486,6 +2496,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ ctb_addr_ts++; -+ ff_hevc_save_states(s, ctb_addr_ts); -++#ifdef RPI -++ if (s->enable_rpi) -++ continue; -++#endif -+ ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); -+ } -+ -+@@ -3289,7 +3303,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ if (!s->univ_pred_cmds) -+ goto fail; -+ for(i = 0; i < 4; i++) { -+- gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -++ gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -+ s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -+ if (!s->coeffs_buf_arm[i]) -+ goto fail; -+-- -+2.7.4 -+ -+ -+From 9079ef888e3d81a69f3c802ddc3c5134679e74a6 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 5 May 2015 11:32:30 +0100 -+Subject: [PATCH 06/68] Added 32x32 transform -+ -+--- -+ libavcodec/hevc.c | 8 +- -+ libavcodec/hevc_cabac.c | 4 +- -+ libavcodec/rpi_hevc_transform.h | 200 +++++++++++++++++----------------------- -+ libavcodec/rpi_hevc_transform.s | 102 ++++++++++---------- -+ libavcodec/rpi_qpu.c | 4 +- -+ 5 files changed, 148 insertions(+), 170 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 391c57a..0dde6f2 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2400,9 +2400,11 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- gpu_cache_flush(&s->coeffs_buf[i]); -+- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -+- gpu_cache_flush(&s->coeffs_buf[i]); -++ gpu_cache_flush(&s->coeffs_buf[2]); -++ gpu_cache_flush(&s->coeffs_buf[3]); -++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); -++ gpu_cache_flush(&s->coeffs_buf[2]); -++ gpu_cache_flush(&s->coeffs_buf[3]); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index d1cba86..88aa959 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1031,7 +1031,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int vshift = s->ps.sps->vshift[c_idx]; -+ uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + -+ ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -+- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; -++#ifdef RPI -++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; -++#endif -+ int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -+ uint8_t significant_coeff_group_flag[8][8] = {{0}}; -+ int explicit_rdpcm_flag = 0; -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index c0c279f..6d772d7 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -1,6 +1,10 @@ -+ unsigned char rpi_hevc_transform [] = { -+ 169, -+ 3, -++62, -++64, -++79, -++64, -+ 3, -+ 232, -+ 32, -+@@ -17,6 +21,22 @@ unsigned char rpi_hevc_transform [] = { -+ 248, -+ 0, -+ 0, -++64, -++232, -++0, -++2, -++0, -++0, -++12, -++248, -++0, -++168, -++0, -++0, -++192, -++248, -++0, -++0, -+ 0, -+ 96, -+ 3, -+@@ -79,7 +99,7 @@ unsigned char rpi_hevc_transform [] = { -+ 70, -+ 128, -+ 144, -+-39, -++40, -+ 0, -+ 4, -+ 255, -+@@ -113,7 +133,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 128, -+ 144, -+-22, -++23, -+ 0, -+ 4, -+ 255, -+@@ -153,6 +173,8 @@ unsigned char rpi_hevc_transform [] = { -+ 140, -+ 211, -+ 192, -++34, -++31, -+ 41, -+ 3, -+ 70, -+@@ -195,7 +217,7 @@ unsigned char rpi_hevc_transform [] = { -+ 255, -+ 36, -+ 204, -+-96, -++224, -+ 2, -+ 0, -+ 248, -+@@ -219,62 +241,10 @@ unsigned char rpi_hevc_transform [] = { -+ 103, -+ 90, -+ 0, -+-8, -+-240, -+-0, -+-128, -+-128, -+-3, -+-0, -+-247, -+-32, -+-128, -+-10, -+-4, -+-136, -+-240, -+-32, -+-0, -+-128, -+-3, -+-112, -+-96, -+-90, -+-0, -+-169, -+-3, -+-3, -+-232, -+-32, -+-0, -+-0, -+-0, -+-12, -+-248, -+-0, -+-136, -+-0, -+-0, -+-192, -+-248, -+-0, -+-0, -++225, -++64, -++242, -+ 64, -+-232, -+-0, -+-2, -+-0, -+-0, -+-12, -+-248, -+-0, -+-168, -+-0, -+-0, -+-192, -+-248, -+-0, -+-0, -+ 3, -+ 232, -+ 128, -+@@ -287,18 +257,6 @@ unsigned char rpi_hevc_transform [] = { -+ 2, -+ 0, -+ 0, -+-4, -+-232, -+-64, -+-0, -+-0, -+-0, -+-5, -+-232, -+-0, -+-8, -+-0, -+-0, -+ 57, -+ 239, -+ 224, -+@@ -317,18 +275,26 @@ unsigned char rpi_hevc_transform [] = { -+ 64, -+ 26, -+ 64, -++4, -++232, -++64, -++0, -++0, -++0, -++149, -++96, -+ 161, -+ 64, -+ 152, -+ 64, -+ 128, -+ 144, -+-31, -++35, -+ 0, -+ 72, -+ 232, -+-32, -+ 0, -++4, -+ 0, -+ 0, -+ 65, -+@@ -339,8 +305,16 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 128, -+ 144, -+-23, -++27, -++0, -++4, -++232, -++0, -++8, -+ 0, -++0, -++69, -++96, -+ 145, -+ 64, -+ 168, -+@@ -351,8 +325,8 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 72, -+ 232, -+-32, -+ 0, -++4, -+ 0, -+ 0, -+ 65, -+@@ -373,7 +347,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 242, -+ 140, -+-229, -++221, -+ 192, -+ 57, -+ 239, -+@@ -383,6 +357,8 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 41, -+ 3, -++239, -++3, -+ 12, -+ 248, -+ 0, -+@@ -390,7 +366,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 0, -+ 192, -+-8, -++248, -+ 4, -+ 0, -+ 12, -+@@ -400,14 +376,14 @@ unsigned char rpi_hevc_transform [] = { -+ 64, -+ 0, -+ 192, -+-8, -++248, -+ 4, -+ 0, -+ 0, -+ 96, -+ 255, -+ 159, -+-131, -++154, -+ 255, -+ 0, -+ 232, -+@@ -417,7 +393,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 255, -+ 159, -+-142, -++165, -+ 255, -+ 4, -+ 255, -+@@ -429,7 +405,7 @@ unsigned char rpi_hevc_transform [] = { -+ 251, -+ 62, -+ 0, -+-5, -++4, -+ 255, -+ 51, -+ 204, -+@@ -439,15 +415,15 @@ unsigned char rpi_hevc_transform [] = { -+ 251, -+ 16, -+ 0, -+-77, -++76, -+ 254, -+ 51, -+ 204, -+-9, -+-4, -++128, -++3, -+ 224, -+ 251, -+-0, -++20, -+ 0, -+ 128, -+ 64, -+@@ -467,16 +443,6 @@ unsigned char rpi_hevc_transform [] = { -+ 99, -+ 0, -+ 0, -+-4, -+-254, -+-0, -+-144, -+-128, -+-2, -+-0, -+-8, -+-2, -+-0, -+ 32, -+ 247, -+ 240, -+@@ -488,92 +454,92 @@ unsigned char rpi_hevc_transform [] = { -+ 176, -+ 207, -+ 17, -+-3, -++19, -+ 32, -+ 247, -+ 112, -+ 207, -+ 18, -+-3, -++35, -+ 32, -+ 247, -+ 48, -+ 207, -+ 19, -+-3, -++51, -+ 32, -+ 247, -+ 240, -+ 206, -+ 20, -+-3, -++67, -+ 32, -+ 247, -+ 176, -+ 206, -+ 21, -+-3, -++83, -+ 32, -+ 247, -+ 112, -+ 206, -+ 22, -+-3, -++99, -+ 32, -+ 247, -+ 48, -+ 206, -+ 23, -+-3, -++115, -+ 32, -+ 247, -+ 240, -+ 205, -+ 24, -+-3, -++131, -+ 32, -+ 247, -+ 176, -+ 205, -+ 25, -+-3, -++147, -+ 32, -+ 247, -+ 112, -+ 205, -+ 26, -+-3, -++163, -+ 32, -+ 247, -+ 48, -+ 205, -+ 27, -+-3, -++179, -+ 32, -+ 247, -+ 240, -+ 204, -+ 28, -+-3, -++195, -+ 32, -+ 247, -+ 176, -+ 204, -+ 29, -+-3, -++211, -+ 32, -+ 247, -+ 112, -+ 204, -+ 30, -+-3, -++227, -+ 32, -+ 247, -+ 48, -+ 204, -+ 31, -+-3, -+-5, -++243, -++4, -+ 255, -+ 51, -+ 204, -+@@ -583,20 +549,20 @@ unsigned char rpi_hevc_transform [] = { -+ 251, -+ 16, -+ 0, -+-77, -++76, -+ 254, -+ 51, -+ 204, -+-9, -+-4, -++128, -++3, -+ 224, -+ 251, -+-0, -++20, -+ 0, -+ 0, -+ 237, -++32, -+ 0, -+-4, -+ 0, -+ 0, -+ 140, -+@@ -609,6 +575,6 @@ unsigned char rpi_hevc_transform [] = { -+ 99, -+ 0, -+ 0, -+-90, -+-0, -++111, -++3, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index 1e389c7..afdb32a 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -76,12 +76,19 @@ -+ # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -+ # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+ # num: number of 16x16 transforms to be done -++# coeffs32 -++# num32: number of 32x32 transforms -+ # -+ hevc_trans_16x16: -+ push r6-r15, lr # TODO cut down number of used registers -+- -++ mov r14,r3 # coeffs32 -++ mov r15,r4 # num32 -+ mov r3, 16*2 # Stride of transMatrix2 in bytes -+ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -++ -++ add r0, 16*16*2 # For 32x32 transforms we also need this matrix -++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -++ -+ # Now use r0 to describe which matrix we are working on. -+ # Allows us to prefetch the next block of coefficients for efficiency. -+ mov r0,0 # This describes the location where we read our coefficients from -+@@ -121,6 +128,10 @@ block_loop: -+ add r1,r7 -+ -+ addcmpbgt r2,-1,0,block_loop -++ -++ # Now go and do any 32x32 transforms -++ b hevc_trans_32x32 -++ -+ pop r6-r15, pc -+ -+ # r1,r2,r3 r7,r8 should be preserved -+@@ -136,26 +147,18 @@ col_trans_16_loop: -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_16_loop -+- sub r0,16 # but r0 back to its original value -++ sub r0,16 # put r0 back to its original value -+ b lr -+ -+ col_trans_odd_16: -+ add r6,r0,16 # Final value for this loop -+ col_trans_odd_16_loop: -+ # First compute partial products for a single column -+- vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,32++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_odd_16_loop -+- sub r0,16 # but r0 back to its original value -+- b lr -+- -+- -+-test_add: -+- vldh HX(0,0),(r0) -+- vadd HX(0,0),HX(0,0),10 -+- vsth HX(0,0),(r0) -+- mov r0,7 # return value -++ sub r0,16 # put r0 back to its original value -+ b lr -+ -+ # hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -+@@ -164,18 +167,17 @@ test_add: -+ # num: number of 16x16 transforms to be done -+ # -+ hevc_trans_32x32: -+- push r6-r15, lr # TODO cut down number of used registers -++ mov r1,r14 # coeffs -++ mov r2,r15 # num -+ -+- # Fetch transform matrices -+- mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -+- vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -+- add r0, 16*16*2 -+- vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -++ # Fetch odd transform matrix -++ #mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -++ #vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -++ #add r0, 16*16*2 -++ #vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ -+ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer -+ mov r7, 16*16*2 # Total block size -+- mov r4, 64 # Constant used for rounding first pass -+- mov r5, 1<<11 # Constant used for rounding second pass -+ sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) -+ # set r8 to 32byte aligned stack pointer -+ add r8,sp,31 -+@@ -186,21 +188,27 @@ hevc_trans_32x32: -+ block_loop32: -+ -+ # COLUMN TRANSFORM -++ mov r4, 64 # Constant used for rounding first pass -++ mov r5, 9 # left shift used for rounding first pass -++ -+ # Transform the first 16 columns -+ mov r1,r10 # Input Coefficient buffer -+ mov r8,r9 # Output temporary storage -+ bl trans32 -+ # Transform the second 16 columns -+- add r8,32 -++ add r8,32*16*2 -+ add r1,32 -+ bl trans32 -+ -+ # ROW TRANSFORM -++ mov r4, 1<<11 # Constant used for rounding second pass -++ mov r5, 4 # left shift used for rounding second pass -++ -+ mov r1,r9 # Input temporary storage -+ mov r8,r10 # Output Coefficient buffer -+ bl trans32 -+ # Transform the second 16 columns -+- add r8,32 -++ add r8,32*16*2 -+ add r1,32 -+ bl trans32 -+ -+@@ -212,11 +220,12 @@ block_loop32: -+ pop r6-r15, pc -+ -+ trans32: -++ push lr -+ # We can no longer afford the VRF space to do prefetching when doing 32x32 -+ # Fetch the even rows -+- vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ vldh HX(0++,0),(r1 += r3) REP 16 -+ # Fetch the odd rows -+- vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -++ vldh HX(16++,0),64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -+ -+ # Transform the even rows using even matrix -+ mov r0, 0 # Even rows -+@@ -228,33 +237,32 @@ trans32: -+ -+ # Now apply butterfly to compute the first 16 results -+ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -+- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -+- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -+ # 16bit results now in HX(48,32) -+ mov r0,r8 -+ mov r6,32*2 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+- vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed -+ -+ # Now apply butterfly to compute the second 16 results (in reverse order) -+- vsub HY(63,0),HY(0,0),HY(16,0) -+- vsub HY(62,0),HY(0,0),HY(17,0) -+- vsub HY(61,0),HY(0,0),HY(18,0) -+- vsub HY(60,0),HY(0,0),HY(19,0) -+- vsub HY(59,0),HY(0,0),HY(20,0) -+- vsub HY(58,0),HY(0,0),HY(21,0) -+- vsub HY(57,0),HY(0,0),HY(22,0) -+- vsub HY(56,0),HY(0,0),HY(23,0) -+- vsub HY(55,0),HY(0,0),HY(24,0) -+- vsub HY(54,0),HY(0,0),HY(25,0) -+- vsub HY(53,0),HY(0,0),HY(26,0) -+- vsub HY(52,0),HY(0,0),HY(27,0) -+- vsub HY(51,0),HY(0,0),HY(28,0) -+- vsub HY(50,0),HY(0,0),HY(29,0) -+- vsub HY(49,0),HY(0,0),HY(30,0) -+- vsub HY(48,0),HY(0,0),HY(31,0) -+- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -+- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -+- add r0,r8,16*32*2 # Move to 16th row -++ vsub HY(63,0),HY(0 ,0),HY(16,0) -++ vsub HY(62,0),HY(1 ,0),HY(17,0) -++ vsub HY(61,0),HY(2 ,0),HY(18,0) -++ vsub HY(60,0),HY(3 ,0),HY(19,0) -++ vsub HY(59,0),HY(4 ,0),HY(20,0) -++ vsub HY(58,0),HY(5 ,0),HY(21,0) -++ vsub HY(57,0),HY(6 ,0),HY(22,0) -++ vsub HY(56,0),HY(7 ,0),HY(23,0) -++ vsub HY(55,0),HY(8 ,0),HY(24,0) -++ vsub HY(54,0),HY(9 ,0),HY(25,0) -++ vsub HY(53,0),HY(10,0),HY(26,0) -++ vsub HY(52,0),HY(11,0),HY(27,0) -++ vsub HY(51,0),HY(12,0),HY(28,0) -++ vsub HY(50,0),HY(13,0),HY(29,0) -++ vsub HY(49,0),HY(14,0),HY(30,0) -++ vsub HY(48,0),HY(15,0),HY(31,0) -++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -++ add r0,r8,32 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+- b lr -++ pop pc -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index d720546..12ad5fb 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -89,7 +89,7 @@ struct GPU -+ { -+ unsigned int qpu_code[QPU_CODE_SIZE]; -+ unsigned int vpu_code[VPU_CODE_SIZE]; -+- short transMatrix2even[16*16]; -++ short transMatrix2even[16*16*2]; -+ int open_count; // Number of allocated video buffers -+ unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+@@ -162,7 +162,7 @@ static int gpu_init(volatile struct GPU **gpu) { -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -+ // And the transform coefficients -+- memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); -++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); -+ -+ return 0; -+ } -+-- -+2.7.4 -+ -+ -+From 6c2ed6109c4dd5c8ab16bf16e0ae3be6ae166e50 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 5 May 2015 16:57:03 +0100 -+Subject: [PATCH 07/68] Clear coefficients in advance -+ -+--- -+ libavcodec/hevc.c | 129 ++++++++++++++++++++++++++++------------ -+ libavcodec/hevc.h | 6 +- -+ libavcodec/hevc_cabac.c | 7 ++- -+ libavcodec/rpi_hevc_transform.h | 50 ++++++++++++++++ -+ libavcodec/rpi_hevc_transform.s | 16 +++++ -+ 5 files changed, 168 insertions(+), 40 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 0dde6f2..1424007 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -43,6 +43,8 @@ -+ -+ #ifdef RPI -+ #include "rpi_qpu.h" -++// For some unknown reason, the code seems to crash if I do a late malloc -++#define EARLY_MALLOC -+ #endif -+ -+ // #define DISABLE_MC -+@@ -61,6 +63,20 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ /* free everything allocated by pic_arrays_init() */ -+ static void pic_arrays_free(HEVCContext *s) -+ { -++#ifdef RPI -++#ifdef EARLY_MALLOC -++#else -++ printf("pic_arrays_free\n"); -++ if (s->coeffs_buf_arm[0]) { -++ gpu_free(&s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = 0; -++ } -++ if (s->coeffs_buf_arm[2]) { -++ gpu_free(&s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = 0; -++ } -++#endif -++#endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+@@ -97,6 +113,28 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ int ctb_count = sps->ctb_width * sps->ctb_height; -+ int min_pu_size = sps->min_pu_width * sps->min_pu_height; -+ -++#ifdef RPI -++#ifdef EARLY_MALLOC -++#else -++ int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); -++ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -++ printf("pic_arrays_init\n"); -++ printf("Allocated %d\n",coefs_per_row); -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -++ if (!s->coeffs_buf_arm[0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -++ if (!s->coeffs_buf_arm[2]) -++ goto fail; -++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -++ printf("Done\n"); -++#endif -++#endif -++ -+ s->bs_width = (width >> 2) + 1; -+ s->bs_height = (height >> 2) + 1; -+ -+@@ -2400,11 +2438,10 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- gpu_cache_flush(&s->coeffs_buf[2]); -+- gpu_cache_flush(&s->coeffs_buf[3]); -+- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); -+- gpu_cache_flush(&s->coeffs_buf[2]); -+- gpu_cache_flush(&s->coeffs_buf[3]); -++ -++ gpu_cache_flush(&s->coeffs_buf_accelerated); -++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -++ //gpu_cache_flush(&s->coeffs_buf_accelerated); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2426,7 +2463,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ lc->na.cand_up_right = (cmd->na >> 0) & 1; -+ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -+ } else { -++ int trafo_size = 1 << cmd->size; -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -++ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -+ } -+ } -+ s->num_pred_cmds = 0; -+@@ -3235,10 +3274,18 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->unif_mv_cmds); -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+- for(i = 0; i < 4; i++) { -+- gpu_free(&s->coeffs_buf[i]); -++ -++#ifdef EARLY_MALLOC -++ if (s->coeffs_buf_arm[0]) { -++ gpu_free(&s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = 0; -++ } -++ if (s->coeffs_buf_arm[2]) { -++ gpu_free(&s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = 0; -+ } -+ #endif -++#endif -+ -+ for (i = 0; i < 3; i++) { -+ av_freep(&s->sao_pixel_buffer_h[i]); -+@@ -3281,6 +3328,16 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ return 0; -+ } -+ -++#ifdef RPI -++static av_cold void memclear16(int16_t *p, int n) -++{ -++ vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); -++ //int i; -++ //for(i=0;ipriv_data; -+@@ -3304,37 +3361,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+- for(i = 0; i < 4; i++) { -+- gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -+- s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -+- if (!s->coeffs_buf_arm[i]) -+- goto fail; -+- } -+- s->enable_rpi = 0; -+ -+- // A little test program -+- /*{ -+- GPU_MEM_PTR_T p; -+- int err = gpu_malloc_cached(16, &p); -+- short *q = (short *)p.arm; -+- int i; -+- int r; -+- printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); -+- printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); -+- printf("Preparing data %p\n",q); -+- for(i=0;i<16;i++) -+- q[i] = i; -+- printf("Flush cache\n"); -+- gpu_cache_flush(&p); -+- printf("Executing code\n"); -+- r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); -+- printf("Return value %d (",r); -+- for(i=0;i<16;i++) -+- printf("%d ",q[i]); -+- printf(")\n"); -+- gpu_free(&p); -+- goto fail; // Early out -+- }*/ -++ s->coeffs_buf_arm[0] = 0; -++ s->coeffs_buf_arm[2] = 0; -++ -++#ifdef EARLY_MALLOC -++ int coeffs_in_ctb = 64*64; -++ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -++ printf("Allocated %d\n",coefs_per_row); -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -++ if (!s->coeffs_buf_arm[0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -++ if (!s->coeffs_buf_arm[2]) -++ goto fail; -++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -++ printf("Done\n"); -++ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -++ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[2], coefs_per_row); -++ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -++#endif -++ -++ s->enable_rpi = 0; -+ -+ #endif -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 4167985..9a228f6 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -861,8 +861,12 @@ typedef struct HEVCContext { -+ HEVCMvCmd *unif_mv_cmds; -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+- GPU_MEM_PTR_T coeffs_buf[4]; -++ int buf_width; -++ GPU_MEM_PTR_T coeffs_buf_default; -++ GPU_MEM_PTR_T coeffs_buf_accelerated; -+ int16_t *coeffs_buf_arm[4]; -++ unsigned int coeffs_buf_vc[4]; -++ -+ int num_coeffs[4]; -+ int num_xfm_cmds; -+ int num_mv_cmds; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 88aa959..dbfee85 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1058,9 +1058,13 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ s->num_coeffs[0] += n; -+ } -+ } -++ // We now do the memset after transform_add while we know the data is cached. -++ //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++#else -++ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ #endif -+ -+- memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++ -+ -+ // Derive QP for dequant -+ if (!lc->cu.cu_transquant_bypass_flag) { -+@@ -1547,7 +1551,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ #ifdef RPI -+ if (s->enable_rpi) { -+ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+- //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+ cmd->buf = coeffs; -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index 6d772d7..4f13622 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -1,4 +1,10 @@ -+ unsigned char rpi_hevc_transform [] = { -++21, -++106, -++0, -++144, -++35, -++1, -+ 169, -+ 3, -+ 62, -+@@ -577,4 +583,48 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 111, -+ 3, -++4, -++254, -++0, -++128, -++0, -++4, -++0, -++248, -++0, -++0, -++2, -++232, -++32, -++0, -++0, -++0, -++140, -++248, -++32, -++0, -++0, -++0, -++224, -++35, -++0, -++0, -++64, -++232, -++0, -++2, -++0, -++0, -++193, -++232, -++0, -++1, -++0, -++0, -++1, -++106, -++116, -++30, -++90, -++0, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index afdb32a..fd159bc 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -78,8 +78,11 @@ -+ # num: number of 16x16 transforms to be done -+ # coeffs32 -+ # num32: number of 32x32 transforms -++# command 0 for transform, 1 for memclear16(int16_t *dst,num16) -+ # -+ hevc_trans_16x16: -++ cmp r5,1 -++ beq memclear16 -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+@@ -266,3 +269,16 @@ trans32: -+ add r0,r8,32 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+ pop pc -++ -++memclear16: -++ # r0 is address -++ # r1 is number of 16bits values to set to 0 (may overrun past end and clear more than specified) -++ vmov HX(0++,0),0 REP 16 -++ mov r2,32 -++loop: -++ vsth HX(0++,0),(r0+=r2) REP 16 -++ add r0,16*16*2 -++ sub r1,16*16 -++ cmp r1,0 -++ bgt loop -++ b lr -+-- -+2.7.4 -+ -+ -+From 48282c2fb55c0d9a72222f384c03c432f78a3016 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 09:56:43 +0100 -+Subject: [PATCH 08/68] Prepared inter offload -+ -+--- -+ libavcodec/hevc.c | 116 +++++++++++++++++++++++++++++++++++++++++++----- -+ libavcodec/hevc.h | 29 +++++++++++- -+ libavcodec/hevc_cabac.c | 5 ++- -+ 3 files changed, 137 insertions(+), 13 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 1424007..8215201 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -45,6 +45,8 @@ -+ #include "rpi_qpu.h" -+ // For some unknown reason, the code seems to crash if I do a late malloc -+ #define EARLY_MALLOC -++// Move Inter prediction into separate pass -++//#define RPI_INTER -+ #endif -+ -+ // #define DISABLE_MC -+@@ -1440,6 +1442,95 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) -+ * @param luma_offset additive offset applied to the luma prediction value -+ */ -+ -++#ifdef RPI_INTER -++#define RPI_REDIRECT(fn) rpi_ ## fn -++static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -++ AVFrame *ref, const Mv *mv, int x_off, int y_off, -++ int block_w, int block_h, int luma_weight, int luma_offset) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_LUMA_UNI; -++ cmd->dst = dst; -++ cmd->dststride = dststride; -++ cmd->src = ref->data[0]; -++ cmd->srcstride = ref->linesize[0]; -++ cmd->mv = *mv; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = luma_weight; -++ cmd->offset = luma_offset; -++} -++ -++static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -++ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -++ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_LUMA_BI; -++ cmd->dst = dst; -++ cmd->dststride = dststride; -++ cmd->src = ref->data[0]; -++ cmd->srcstride = ref->linesize[0]; -++ cmd->mv = *mv; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = luma_weight; -++ cmd->offset = luma_offset; -++ cmd->src1 = ref1->data[]; -++ cmd->srcstride1 = ref1->linesize[0]; -++ cmd->mv1 = *mv1; -++ cmd->ref_idx[0] = current_mv->ref_idx[0]; -++ cmd->ref_idx[1] = current_mv->ref_idx[1]; -++} -++ -++static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -++ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -++ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_CHROMA_UNI; -++ cmd->dst = dst0; -++ cmd->dststride = dststride; -++ cmd->src = src0; -++ cmd->srcstride = srcstride; -++ cmd->mv = current_mv->mv[reflist]; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = chroma_weight; -++ cmd->offset = chroma_offset; -++} -++ -++static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -++ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -++ cmd->dst = dst0; -++ cmd->dststride = dststride; -++ cmd->src = ref0->data[cidx+1]; -++ cmd->srcstride = ref0->linesize[cidx+1]; -++ cmd->mv = current_mv->mv[reflist]; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = chroma_weight; -++ cmd->offset = chroma_offset; -++ cmd->src = ref1->data[cidx+1]; -++ cmd->srcstride1 = ref1->linesize[cidx+1]; -++ cmd->ref_idx[0] = current_mv->ref_idx[0]; -++ cmd->ref_idx[1] = current_mv->ref_idx[1]; -++} -++#else -++#define RPI_REDIRECT(fn) fn -++#endif -++ -+ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+@@ -1505,7 +1596,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ * @param mv1 motion vector1 (relative to block position) to get pixel data from -+ * @param current_mv current motion vector structure -+ */ -+- static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -++static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+ { -+@@ -1887,16 +1978,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- luma_mc_uni(s, dst0, s->frame->linesize[0], ref0->frame, -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l0[current_mv.ref_idx[0]], -+ s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -+- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -+ 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); -+- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], -+ 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1]); -+ } -+@@ -1906,17 +1997,17 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- luma_mc_uni(s, dst0, s->frame->linesize[0], ref1->frame, -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -+ ¤t_mv.mv[1], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l1[current_mv.ref_idx[1]], -+ s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -+- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -+ 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); -+ -+- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], -+ 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1]); -+ } -+@@ -1926,15 +2017,15 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- luma_mc_bi(s, dst0, s->frame->linesize[0], ref0->frame, -++ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ ref1->frame, ¤t_mv.mv[1], ¤t_mv); -+ -+ if (s->ps.sps->chroma_format_idc) { -+- chroma_mc_bi(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -++ RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -+ x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); -+ -+- chroma_mc_bi(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, -++ RPI_REDIRECT(chroma_mc_bi)(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, -+ x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1); -+ } -+ } -+@@ -2465,7 +2556,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ } else { -+ int trafo_size = 1 << cmd->size; -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -++#ifdef RPI_PRECLEAR -+ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -++#endif -+ } -+ } -+ s->num_pred_cmds = 0; -+@@ -3381,6 +3474,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+ printf("Done\n"); -++#ifdef RPI_PRECLEAR -+ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+@@ -3389,6 +3483,8 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+ #endif -+ -++#endif -++ -+ s->enable_rpi = 0; -+ -+ #endif -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 9a228f6..1ac119a 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -803,14 +803,39 @@ typedef struct HEVCLocalContext { -+ // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+ #define RPI_MAX_WIDTH 2048 -+ -+-// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane -+-#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) -++// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -++#define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+ // Each block can have an intra prediction and a transform_add command -+ #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ -++#define RPI_CMD_LUMA_UNI 0 -++#define RPI_CMD_CHROMA_UNI 1 -++#define RPI_CMD_LUMA_BI 2 -++#define RPI_CMD_U_BI 3 -++#define RPI_CMD_V_BI 4 -++ -++// RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? -++// #define RPI_PRECLEAR -++ -+ // Command for inter prediction -+ typedef struct HEVCMvCmd { -++ int cmd; -++ uint8_t *dst; -++ ptrdiff_t dststride; -++ uint8_t *src; -++ ptrdiff_t srcstride; -++ Mv mv; -++ int x_off; -++ int y_off; -++ int block_w; -++ int block_h; -++ int weight; -++ int offset; -++ uint8_t *src1; -++ ptrdiff_t srcstride1; -++ Mv mv1; -++ int8_t ref_idx[2]; -+ } HEVCMvCmd; -+ -+ // Command for transform to process a block of coefficients -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index dbfee85..4f072be 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1059,7 +1059,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ } -+ // We now do the memset after transform_add while we know the data is cached. -+- //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++ #ifdef RPI_PRECLEAR -++ #else -++ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++ #endif -+ #else -+ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ #endif -+-- -+2.7.4 -+ -+ -+From 25d3b4e876febe08302a01abd85d5009160ead3e Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 11:08:50 +0100 -+Subject: [PATCH 09/68] Inter prediction in separate pass -+ -+--- -+ libavcodec/hevc.c | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- -+ libavcodec/hevc.h | 2 +- -+ 2 files changed, 77 insertions(+), 18 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 8215201..b7bc6ad 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -46,7 +46,7 @@ -+ // For some unknown reason, the code seems to crash if I do a late malloc -+ #define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+-//#define RPI_INTER -++#define RPI_INTER -+ #endif -+ -+ // #define DISABLE_MC -+@@ -1448,7 +1448,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_LUMA_UNI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+@@ -1467,31 +1467,29 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_LUMA_BI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+- cmd->src = ref->data[0]; -+- cmd->srcstride = ref->linesize[0]; -+- cmd->mv = *mv; -++ cmd->src = ref0->data[0]; -++ cmd->srcstride = ref0->linesize[0]; -++ cmd->mv = *mv0; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+- cmd->weight = luma_weight; -+- cmd->offset = luma_offset; -+- cmd->src1 = ref1->data[]; -++ cmd->src1 = ref1->data[0]; -+ cmd->srcstride1 = ref1->linesize[0]; -+ cmd->mv1 = *mv1; -+ cmd->ref_idx[0] = current_mv->ref_idx[0]; -+ cmd->ref_idx[1] = current_mv->ref_idx[1]; -+ } -+ -+-static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -++static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_CHROMA_UNI; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+@@ -1506,27 +1504,27 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ cmd->offset = chroma_offset; -+ } -+ -+-static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -++static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+ cmd->src = ref0->data[cidx+1]; -+ cmd->srcstride = ref0->linesize[cidx+1]; -+- cmd->mv = current_mv->mv[reflist]; -++ cmd->mv = current_mv->mv[0]; -++ cmd->mv1 = current_mv->mv[1]; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+- cmd->weight = chroma_weight; -+- cmd->offset = chroma_offset; -+- cmd->src = ref1->data[cidx+1]; -++ cmd->src1 = ref1->data[cidx+1]; -+ cmd->srcstride1 = ref1->linesize[cidx+1]; -+ cmd->ref_idx[0] = current_mv->ref_idx[0]; -+ cmd->ref_idx[1] = current_mv->ref_idx[1]; -+ } -++ -+ #else -+ #define RPI_REDIRECT(fn) fn -+ #endif -+@@ -2554,7 +2552,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ lc->na.cand_up_right = (cmd->na >> 0) & 1; -+ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -+ } else { -++#ifdef RPI_PRECLEAR -+ int trafo_size = 1 << cmd->size; -++#endif -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -+ #ifdef RPI_PRECLEAR -+ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -+@@ -2563,6 +2563,61 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ } -+ s->num_pred_cmds = 0; -+ } -++ -++static void rpi_execute_inter_cmds(HEVCContext *s) -++{ -++ HEVCMvCmd *cmd = s->unif_mv_cmds; -++ int n,cidx; -++ AVFrame myref; -++ AVFrame myref1; -++ struct MvField mymv; -++ if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { -++ printf("Overflow inter_cmds\n"); -++ exit(-1); -++ } -++ for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { -++ switch(cmd->cmd) { -++ case RPI_CMD_LUMA_UNI: -++ myref.data[0] = cmd->src; -++ myref.linesize[0] = cmd->srcstride; -++ luma_mc_uni(s, cmd->dst, cmd->dststride, &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, cmd->weight, cmd->offset); -++ break; -++ case RPI_CMD_LUMA_BI: -++ myref.data[0] = cmd->src; -++ myref.linesize[0] = cmd->srcstride; -++ myref1.data[0] = cmd->src1; -++ myref1.linesize[0] = cmd->srcstride1; -++ mymv.ref_idx[0] = cmd->ref_idx[0]; -++ mymv.ref_idx[1] = cmd->ref_idx[1]; -++ luma_mc_bi(s, cmd->dst, cmd->dststride, -++ &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, -++ &myref1, &cmd->mv1, &mymv); -++ break; -++ case RPI_CMD_CHROMA_UNI: -++ mymv.mv[0] = cmd->mv; -++ chroma_mc_uni(s, cmd->dst, -++ cmd->dststride, cmd->src, cmd->srcstride, 0, -++ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cmd->weight, cmd->offset); -++ break; -++ case RPI_CMD_CHROMA_BI: -++ case RPI_CMD_CHROMA_BI+1: -++ cidx = cmd->cmd - RPI_CMD_CHROMA_BI; -++ myref.data[cidx+1] = cmd->src; -++ myref.linesize[cidx+1] = cmd->srcstride; -++ myref1.data[cidx+1] = cmd->src1; -++ myref1.linesize[cidx+1] = cmd->srcstride1; -++ mymv.ref_idx[0] = cmd->ref_idx[0]; -++ mymv.ref_idx[1] = cmd->ref_idx[1]; -++ mymv.mv[0] = cmd->mv; -++ mymv.mv[1] = cmd->mv1; -++ chroma_mc_bi(s, cmd->dst, cmd->dststride, &myref, &myref1, -++ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cidx); -++ break; -++ } -++ } -++ s->num_mv_cmds = 0; -++} -++ -+ #endif -+ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+@@ -2611,6 +2666,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -++ // Perform inter prediction -++ rpi_execute_inter_cmds(s); -+ // Transform all blocks -+ rpi_execute_transform(s); -+ // Perform intra prediction and residual reconstruction -+@@ -3422,6 +3479,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ } -+ -+ #ifdef RPI -++#ifdef RPI_PRECLEAR -+ static av_cold void memclear16(int16_t *p, int n) -+ { -+ vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); -+@@ -3430,6 +3488,7 @@ static av_cold void memclear16(int16_t *p, int n) -+ // p[i] = 0; -+ } -+ #endif -++#endif -+ -+ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 1ac119a..a0eb71b 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -812,7 +812,7 @@ typedef struct HEVCLocalContext { -+ #define RPI_CMD_LUMA_UNI 0 -+ #define RPI_CMD_CHROMA_UNI 1 -+ #define RPI_CMD_LUMA_BI 2 -+-#define RPI_CMD_U_BI 3 -++#define RPI_CMD_CHROMA_BI 3 -+ #define RPI_CMD_V_BI 4 -+ -+ // RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? -+-- -+2.7.4 -+ -+ -+From 8af0a0a036e4bb3883f144d0567bc527772dd65b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 13:03:50 +0100 -+Subject: [PATCH 10/68] Added VPU thread -+ -+--- -+ libavcodec/hevc.c | 11 +++-- -+ libavcodec/hevc.h | 1 + -+ libavcodec/rpi_qpu.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++-- -+ libavcodec/rpi_qpu.h | 2 + -+ 4 files changed, 133 insertions(+), 6 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index b7bc6ad..98dbd69 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2529,8 +2529,10 @@ static void rpi_execute_transform(HEVCContext *s) -+ -+ -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -+- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -++ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -++ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); -++ //vpu_wait(s->vpu_id); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2666,10 +2668,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+- // Perform inter prediction -+- rpi_execute_inter_cmds(s); -+ // Transform all blocks -+ rpi_execute_transform(s); -++ // Perform inter prediction -++ rpi_execute_inter_cmds(s); -++ // Wait for transform completion -++ vpu_wait(s->vpu_id); -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+@@ -3426,6 +3430,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->univ_pred_cmds); -+ -+ #ifdef EARLY_MALLOC -++ printf("hevc_decode_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+ gpu_free(&s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = 0; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index a0eb71b..0d8dfe9 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -896,6 +896,7 @@ typedef struct HEVCContext { -+ int num_xfm_cmds; -+ int num_mv_cmds; -+ int num_pred_cmds; -++ int vpu_id; -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 12ad5fb..378dd74 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -1,9 +1,13 @@ -+ #ifdef RPI -+-// Use the vcsm device for shared memory -++// define RPI_USE_VCSM to use the vcsm device for shared memory -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ #define RPI_USE_VCSM -+-#define RPI_TIME_TOTAL_QPU -+-#define RPI_TIME_TOTAL_VPU -++// define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -++//#define RPI_TIME_TOTAL_QPU -++// define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -++//#define RPI_TIME_TOTAL_VPU -++// define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -++#define RPI_ASYNC -+ -+ #include -+ #include -+@@ -113,6 +117,19 @@ static unsigned int Microseconds(void) { -+ } -+ #endif -+ -++#ifdef RPI_ASYNC -++pthread_t vpu_thread; -++static void *vpu_start(void *arg); -++ -++#define MAXCMDS 128 -++static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; -++static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -++ -++static int vpu_cmds[MAXCMDS][8]; -++static volatile int vpu_async_tail=0; // Contains the number of posted jobs -++static volatile int vpu_async_head=0; -++#endif -++ -+ // Connect to QPU, returns 0 on success. -+ static int gpu_init(volatile struct GPU **gpu) { -+ int mb = mbox_open(); -+@@ -164,12 +181,27 @@ static int gpu_init(volatile struct GPU **gpu) { -+ // And the transform coefficients -+ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); -+ -++#ifdef RPI_ASYNC -++ { -++ int err; -++ vpu_async_tail = 0; -++ vpu_async_head = 0; -++ err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); -++ //printf("Created thread\n"); -++ if (err) { -++ printf("Failed to create vpu thread\n"); -++ return -4; -++ } -++ } -++#endif -++ -+ return 0; -+ } -+ -+ // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -+ static void gpu_lock(void) { -+ pthread_mutex_lock(&gpu_mutex); -++ -+ if (gpu==NULL) { -+ gpu_init(&gpu); -+ } -+@@ -264,6 +296,16 @@ static void gpu_term(void) -+ unsigned handle = gpu->vc_handle; -+ if (gpu==NULL) -+ return; -++ -++#ifdef RPI_ASYNC -++ { -++ void *res; -++ vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); -++ pthread_join(vpu_thread, &res); -++ } -++#endif -++ -++ -+ unmapmem((void*)gpu, sizeof(struct GPU)); -+ mem_unlock(mb, handle); -+ mem_free(mb, handle); -+@@ -322,6 +364,79 @@ unsigned int vpu_get_constants(void) { -+ return gpu->vc + offsetof(struct GPU,transMatrix2even); -+ } -+ -++#ifdef RPI_ASYNC -++ -++static void *vpu_start(void *arg) { -++ while(1) { -++ pthread_mutex_lock(&post_mutex); -++ while( vpu_async_tail - vpu_async_head <= 0) -++ { -++ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -++ pthread_cond_wait(&post_cond, &post_mutex); -++ } -++ int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -++ pthread_mutex_unlock(&post_mutex); -++ -++ if (p[6] == -1) { -++ break; // Last job -++ } -++ if (p[7]) { -++ GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -++ //gpu_cache_flush(buf); -++ } -++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ -++ pthread_mutex_lock(&post_mutex); -++ vpu_async_head++; -++ pthread_cond_broadcast(&post_cond); -++ pthread_mutex_unlock(&post_mutex); -++ } -++ -++ return NULL; -++} -++ -++// Post a command to the queue -++// Returns an id which we can use to wait for completion -++int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) -++{ -++ pthread_mutex_lock(&post_mutex); -++ { -++ int id = vpu_async_tail++; -++ int *p = vpu_cmds[id%MAXCMDS]; -++ int num = vpu_async_tail - vpu_async_head; -++ if (num>MAXCMDS) { -++ printf("Too many commands submitted\n"); -++ exit(-1); -++ } -++ p[0] = code; -++ p[1] = r0; -++ p[2] = r1; -++ p[3] = r2; -++ p[4] = r3; -++ p[5] = r4; -++ p[6] = r5; -++ p[7] = (int) buf; -++ if (num<=1) -++ pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake -++ pthread_mutex_unlock(&post_mutex); -++ return id; -++ } -++} -++ -++// Wait for completion of the given command -++void vpu_wait(int id) -++{ -++ pthread_mutex_lock(&post_mutex); -++ while( id + 1 - vpu_async_head > 0) -++ { -++ pthread_cond_wait(&post_cond, &post_mutex); -++ } -++ pthread_mutex_unlock(&post_mutex); -++} -++ -++#endif -++ -++ -+ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -+ { -+ unsigned r; -+@@ -334,7 +449,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, -+ static int count=0; -+ static long long countr2=0; -+ #endif -++#ifndef RPI_ASYNC -+ gpu_lock(); -++#endif -+ #ifdef RPI_TIME_TOTAL_VPU -+ start_time = Microseconds(); -+ if (last_time==0) -+@@ -351,7 +468,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, -+ if ((count&0x7f)==0) -+ printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); -+ #endif -++#ifndef RPI_ASYNC -+ gpu_unlock(); -++#endif -+ return r; -+ } -+ -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 814fc3c..3526fce 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -36,6 +36,8 @@ extern unsigned int qpu_get_fn(int num); -+ extern unsigned int vpu_get_fn(void); -+ extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -++extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -++extern void vpu_wait( int id); -+ -+ // Simple test of shader code -+ extern int rpi_test_shader(void); -+-- -+2.7.4 -+ -+ -+From 016d3db644e60fbe272bfcf1d7c3670c82422317 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 15:03:37 +0100 -+Subject: [PATCH 11/68] Added different signal when tail moves -+ -+--- -+ libavcodec/rpi_qpu.c | 11 ++++++----- -+ 1 file changed, 6 insertions(+), 5 deletions(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 378dd74..d1c3e20 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -122,7 +122,8 @@ pthread_t vpu_thread; -+ static void *vpu_start(void *arg); -+ -+ #define MAXCMDS 128 -+-static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; -++static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -++static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; -+ static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+ static int vpu_cmds[MAXCMDS][8]; -+@@ -372,7 +373,7 @@ static void *vpu_start(void *arg) { -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -+- pthread_cond_wait(&post_cond, &post_mutex); -++ pthread_cond_wait(&post_cond_tail, &post_mutex); -+ } -+ int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ pthread_mutex_unlock(&post_mutex); -+@@ -388,7 +389,7 @@ static void *vpu_start(void *arg) { -+ -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+- pthread_cond_broadcast(&post_cond); -++ pthread_cond_broadcast(&post_cond_head); -+ pthread_mutex_unlock(&post_mutex); -+ } -+ -+@@ -417,7 +418,7 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned -+ p[6] = r5; -+ p[7] = (int) buf; -+ if (num<=1) -+- pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake -++ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+ return id; -+ } -+@@ -429,7 +430,7 @@ void vpu_wait(int id) -+ pthread_mutex_lock(&post_mutex); -+ while( id + 1 - vpu_async_head > 0) -+ { -+- pthread_cond_wait(&post_cond, &post_mutex); -++ pthread_cond_wait(&post_cond_head, &post_mutex); -+ } -+ pthread_mutex_unlock(&post_mutex); -+ } -+-- -+2.7.4 -+ -+ -+From b04a72641253dc89fd1ec688035c3e2a946aa370 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 7 May 2015 08:57:11 +0100 -+Subject: [PATCH 12/68] Add option to test for gpu_idle -+ -+--- -+ libavcodec/hevc.c | 3 ++- -+ libavcodec/rpi_qpu.c | 18 ++++++++++++++++++ -+ 2 files changed, 20 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 98dbd69..2e269b6 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2527,7 +2527,6 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -+ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+@@ -2669,6 +2668,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+ // Transform all blocks -++ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++ -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index d1c3e20..85f49db 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -199,6 +199,17 @@ static int gpu_init(volatile struct GPU **gpu) { -+ return 0; -+ } -+ -++// Returns 1 if the gpu is currently idle -++static int gpu_idle(void) -++{ -++ int ret = pthread_mutex_trylock(&gpu_mutex); -++ if (ret==0) { -++ pthread_mutex_unlock(&gpu_mutex); -++ return 1; -++ } -++ return 0; -++} -++ -+ // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -+ static void gpu_lock(void) { -+ pthread_mutex_lock(&gpu_mutex); -+@@ -400,6 +411,13 @@ static void *vpu_start(void *arg) { -+ // Returns an id which we can use to wait for completion -+ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) -+ { -++ // If the gpu is idle then just run the command immediately -++ // This works, but doesn't seem to give any benefit -++ // if (gpu_idle()) { -++ // vpu_execute_code( code, r0, r1, r2, r3, r4, r5); -++ // return -1; // TODO perhaps a wraparound bug here? -++ // } -++ -+ pthread_mutex_lock(&post_mutex); -+ { -+ int id = vpu_async_tail++; -+-- -+2.7.4 -+ -+ -+From e7b457e683d4ca92bf2677b69708fbfc3849847b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 7 May 2015 11:01:35 +0100 -+Subject: [PATCH 13/68] Added deblocking pass -+ -+--- -+ libavcodec/hevc.c | 33 +++++++++++++++++++++++++++------ -+ libavcodec/hevc.h | 7 ++++++- -+ libavcodec/hevc_filter.c | 6 +++++- -+ libavcodec/rpi_qpu.c | 2 +- -+ 4 files changed, 39 insertions(+), 9 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 2e269b6..29f8415 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2518,6 +2518,17 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ } -+ -+ #ifdef RPI -++static void rpi_execute_dblk_cmds(HEVCContext *s) -++{ -++ int n; -++ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -++ int (*p)[2] = s->dblk_cmds; -++ for(n = s->num_dblk_cmds; n>0 ;n--,p++) { -++ ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); -++ } -++ s->num_dblk_cmds = 0; -++} -++ -+ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -+@@ -2631,7 +2642,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -+- int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; -+ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -+ #endif -+ -+@@ -2665,7 +2675,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -++ if (s->enable_rpi) { -++ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -++ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -++ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+ // Transform all blocks -+ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+@@ -2678,10 +2691,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+- for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles -+- ff_hevc_hls_filters(s, x, y_ctb, ctb_size); -+- } -+- start_ctb_x = 0; -++ rpi_execute_dblk_cmds(s); -++ } -+ } -+ #endif -+ if (more_data < 0) { -+@@ -2699,6 +2710,16 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); -+ } -+ -++#ifdef RPI -++ if (s->enable_rpi && s->num_dblk_cmds) { -++ rpi_execute_transform(s); -++ rpi_execute_inter_cmds(s); -++ vpu_wait(s->vpu_id); -++ rpi_execute_pred_cmds(s); -++ rpi_execute_dblk_cmds(s); -++ } -++#endif -++ -+ if (x_ctb + ctb_size >= s->ps.sps->width && -+ y_ctb + ctb_size >= s->ps.sps->height) -+ ff_hevc_hls_filter(s, x_ctb, y_ctb, ctb_size); -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 0d8dfe9..990bd8c 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -808,6 +808,8 @@ typedef struct HEVCLocalContext { -+ #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+ // Each block can have an intra prediction and a transform_add command -+ #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -++// Worst case is 16x16 CTUs -++#define RPI_MAX_DEBLOCK_CMDS (RPI_MAX_WIDTH*4/16) -+ -+ #define RPI_CMD_LUMA_UNI 0 -+ #define RPI_CMD_CHROMA_UNI 1 -+@@ -867,6 +869,9 @@ typedef struct HEVCPredCmd { -+ #endif -+ -+ typedef struct HEVCContext { -++#ifdef RPI -++ int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; -++#endif -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+ -+@@ -891,11 +896,11 @@ typedef struct HEVCContext { -+ GPU_MEM_PTR_T coeffs_buf_accelerated; -+ int16_t *coeffs_buf_arm[4]; -+ unsigned int coeffs_buf_vc[4]; -+- -+ int num_coeffs[4]; -+ int num_xfm_cmds; -+ int num_mv_cmds; -+ int num_pred_cmds; -++ int num_dblk_cmds; -+ int vpu_id; -+ #endif -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index e4c3da7..ea0af91 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -877,8 +877,12 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ if (s->threads_type & FF_THREAD_FRAME ) -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+- } else if (s->threads_type & FF_THREAD_FRAME && x_end) -++ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -++ int newh = y + ctb_size - 4; -++ //int currh = s->ref->tf.progress->data[0]; -++ //if (((y + ctb_size)&63)==0) -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++ } -+ } -+ -+ void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size) -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 85f49db..3b6dae7 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -105,7 +105,7 @@ struct GPU -+ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+ static volatile struct GPU* gpu = NULL; -+ -+-#ifdef RPI_TIME_TOTAL_QPU -++#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -+ static unsigned int Microseconds(void) { -+ struct timespec ts; -+ unsigned int x; -+-- -+2.7.4 -+ -+ -+From 7a443df9115f21b4428de378bd146dcdba3dd42a Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 7 May 2015 16:47:47 +0100 -+Subject: [PATCH 14/68] Added option to disable deblocking for non-ref frames -+ -+--- -+ libavcodec/hevc_filter.c | 10 ++++++++++ -+ 1 file changed, 10 insertions(+) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index ea0af91..2cdd621 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -25,6 +25,8 @@ -+ //#define DISABLE_SAO -+ //#define DISABLE_DEBLOCK -+ //#define DISABLE_STRENGTHS -++// define DISABLE_DEBLOCK_NONREF for a 6% speed boost (by skipping deblocking on unimportant frames) -++//#define DISABLE_DEBLOCK_NONREF -+ -+ #include "libavutil/common.h" -+ #include "libavutil/internal.h" -+@@ -504,6 +506,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->ps.sps->pcm.loop_filter_disable_flag) || -+ s->ps.pps->transquant_bypass_enable_flag; -+ -++#ifdef DISABLE_DEBLOCK_NONREF -++ if ( s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N ) -++ return; // Don't deblock non-reference frames -++#endif -+ #ifdef DISABLE_DEBLOCK -+ return; -+ #endif -+-- -+2.7.4 -+ -+ -+From 9606e160a582db64ccf981d971cdc258d8cc02f7 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 11 May 2015 10:00:27 +0100 -+Subject: [PATCH 15/68] Moved buffers to VPU memory -+ -+--- -+ libavcodec/hevc_filter.c | 17 +++++++++++++- -+ libavcodec/utils.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ -+ libavutil/buffer.c | 6 +++++ -+ libavutil/buffer.h | 3 +++ -+ 4 files changed, 84 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 2cdd621..e1b32d4 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -866,6 +866,13 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ #undef CB -+ #undef CR -+ -++#ifdef RPI_INTER_QPU -++static void flush_buffer(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ gpu_cache_flush(p); -++} -++#endif -++ -+ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ { -+ int x_end = x >= s->ps.sps->width - ctb_size; -+@@ -888,9 +895,17 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -+- int newh = y + ctb_size - 4; -++ //int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -++ if (!( s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N )) { -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++ } -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+ } -+diff --git a/libavcodec/utils.c b/libavcodec/utils.c -+index f7adb52..708526e 100644 -+--- a/libavcodec/utils.c -++++ b/libavcodec/utils.c -+@@ -26,6 +26,12 @@ -+ */ -+ -+ #include "config.h" -++ -++#ifdef RPI -++// Move video buffers to GPU memory -++#define RPI_GPU_BUFFERS -++#endif -++ -+ #include "libavutil/atomic.h" -+ #include "libavutil/attributes.h" -+ #include "libavutil/avassert.h" -+@@ -64,6 +70,10 @@ -+ #include "libavutil/ffversion.h" -+ const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; -+ -++#ifdef RPI_GPU_BUFFERS -++#include "rpi_qpu.h" -++#endif -++ -+ #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS -+ static int default_lockmgr_cb(void **arg, enum AVLockOp op) -+ { -+@@ -503,6 +513,47 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, -+ return ret; -+ } -+ -++#ifdef RPI_GPU_BUFFERS -++static void rpi_buffer_default_free(void *opaque, uint8_t *data) -++{ -++ GPU_MEM_PTR_T *p = opaque; -++ gpu_free(p); -++ av_free(p); -++} -++ -++static AVBufferRef *rpi_buffer_alloc(int size) -++{ -++ AVBufferRef *ret = NULL; -++ uint8_t *data = NULL; -++ GPU_MEM_PTR_T *p; -++ -++ static int total=0; -++ total+=size; -++ -++ p = av_malloc(sizeof *p); -++ if (!p) -++ return NULL; -++ -++ if (gpu_malloc_cached(size,p)<0) // Change this line to choose cached or uncached memory. The caching here refers to the ARM data cache. -++ return NULL; -++ -++ data = p->arm; -++ printf("Rpi alloc %d/%d ARM=%p VC=%x->%x\n",size,total,p->arm,p->vc,p->vc+size); -++ //memset(data, 64, size); -++ -++ if (!data) -++ return NULL; -++ -++ ret = av_buffer_create(data, size, rpi_buffer_default_free, p, 0); -++ if (!ret) { -++ gpu_free(p); -++ av_freep(&p); -++ } -++ -++ return ret; -++} -++#endif -++ -+ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) -+ { -+ FramePool *pool = avctx->internal->pool; -+@@ -550,6 +601,14 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) -+ av_buffer_pool_uninit(&pool->pools[i]); -+ pool->linesize[i] = linesize[i]; -+ if (size[i]) { -++#ifdef RPI_GPU_BUFFERS -++ if (avctx->codec_id == AV_CODEC_ID_HEVC) -++ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, -++ CONFIG_MEMORY_POISONING ? -++ NULL : -++ rpi_buffer_alloc); -++ else -++#endif -+ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, -+ CONFIG_MEMORY_POISONING ? -+ NULL : -+diff --git a/libavutil/buffer.c b/libavutil/buffer.c -+index 694e116..203ca7b 100644 -+--- a/libavutil/buffer.c -++++ b/libavutil/buffer.c -+@@ -425,3 +425,9 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) -+ -+ return ret; -+ } -++ -++// Return the opaque for the underlying frame (gives us a GPU_MEM_PTR_T) -++void *av_buffer_pool_opaque(AVBufferRef *ref) { -++ BufferPoolEntry *buf = av_buffer_get_opaque(ref); -++ return buf->opaque; -++} -+diff --git a/libavutil/buffer.h b/libavutil/buffer.h -+index 0c0ce12..82e0bc3 100644 -+--- a/libavutil/buffer.h -++++ b/libavutil/buffer.h -+@@ -283,6 +283,9 @@ void av_buffer_pool_uninit(AVBufferPool **pool); -+ */ -+ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); -+ -++// Return the opaque for the underlying frame -++void *av_buffer_pool_opaque(AVBufferRef *ref); -++ -+ /** -+ * @} -+ */ -+-- -+2.7.4 -+ -+ -+From f56515b9a720c829ba3ddf6da4232a91b13e0f03 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 11 May 2015 14:04:37 +0100 -+Subject: [PATCH 16/68] Prepared QPU execute code -+ -+--- -+ libavcodec/hevc.c | 227 ++++++++++++++++++++++++++++++++++++++++------- -+ libavcodec/hevc.h | 22 ++++- -+ libavcodec/hevc_filter.c | 7 +- -+ libavcodec/rpi_qpu.c | 55 +++++++++++- -+ libavcodec/rpi_qpu.h | 2 + -+ 5 files changed, 276 insertions(+), 37 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 29f8415..66ed37a 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -42,17 +42,45 @@ -+ #include "profiles.h" -+ -+ #ifdef RPI -+-#include "rpi_qpu.h" -+-// For some unknown reason, the code seems to crash if I do a late malloc -+-#define EARLY_MALLOC -+-// Move Inter prediction into separate pass -+-#define RPI_INTER -++ #include "rpi_qpu.h" -++ // For some unknown reason, the code seems to crash if I do a late malloc -++ #define EARLY_MALLOC -++ // Move Inter prediction into separate pass -++ #define RPI_INTER -+ #endif -+ -+ // #define DISABLE_MC -+ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -++ -++#ifdef RPI_INTER_QPU -++ -++#define RPI_CHROMA_COMMAND_WORDS 12 -++// The QPU code for UV blocks only works up to a block width of 8 -++#define RPI_CHROMA_BLOCK_WIDTH 8 -++ -++#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) -++ -++// TODO Chroma only needs 4 taps -++static uint32_t rpi_filter_coefs[8][2] = { -++ { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } -++}; -++ -++static uint32_t get_vc_address(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ return p->vc; -++} -++ -++#endif -++ -+ /** -+ * NOTE: Each function hls_foo correspond to the function foo in the -+ * specification (HLS stands for High Level Syntax). -+@@ -66,6 +94,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ static void pic_arrays_free(HEVCContext *s) -+ { -+ #ifdef RPI -++ -+ #ifdef EARLY_MALLOC -+ #else -+ printf("pic_arrays_free\n"); -+@@ -1982,6 +2011,43 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -++#ifdef RPI_INTER_QPU -++ if (s->enable_rpi) { -++ int reflist = 0; -++ int hshift = s->ps.sps->hshift[1]; -++ int vshift = s->ps.sps->vshift[1]; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -++ intptr_t _mx = mx << (1 - hshift); -++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -++ -++ int x1_c = x0_c + (mv->x >> (2 + hshift)); -++ int y1_c = y0_c + (mv->y >> (2 + hshift)); -++ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ -++ uint32_t *u = s->u_mvs[chan & 7]; -++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -++ *u++ = rpi_filter_coefs[_mx][0]; -++ *u++ = rpi_filter_coefs[_mx][1]; -++ *u++ = rpi_filter_coefs[_my][0]; -++ *u++ = rpi_filter_coefs[_my][1]; -++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ } -++ } -++ s->u_mvs[chan & 7] = u; -++ return; -++ } -++#endif -+ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -+ 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); -+@@ -2632,6 +2698,54 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ -+ #endif -+ -++#ifdef RPI_INTER_QPU -++static void rpi_inter_clear(HEVCContext *s) -++{ -++ int i; -++ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -++ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -++ for(i=0;i<8;i++) { -++ s->u_mvs[i] = s->mvs_base[i]; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = pic_width; -++ *s->u_mvs[i]++ = pic_height; -++ *s->u_mvs[i]++ = s->frame->linesize[1]; -++ *s->u_mvs[i]++ = s->frame->linesize[2]; -++ s->u_mvs[i] += 3; // Padding words -++ } -++} -++ -++static void rpi_execute_inter_qpu(HEVCContext *s) -++{ -++ int k; -++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++ -++ if (s->sh.slice_type == I_SLICE) -++ return; -++ for(k=0;k<8;k++) { -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ } -++ -++ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ -++ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ ); -++} -++#endif -++ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ { -+ HEVCContext *s = avctxt->priv_data; -+@@ -2658,6 +2772,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ } -+ -++#ifdef RPI_INTER_QPU -++ rpi_inter_clear(s); -++#endif -++ -+ while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { -+ int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ -+@@ -2679,19 +2797,30 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+- int x; -++#ifdef RPI_INTER_QPU -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++#endif -+ // Transform all blocks -+ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+- -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -++ -++ // Copy back reconstructed data -++ //memcpy(s->frame->data[0],s->dummy.arm,2048*64); -++ //memcpy(s->frame->data[1],s->dummy.arm,1024*32); -++ //memcpy(s->frame->data[2],s->dummy.arm,1024*32); -++ -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -++#ifdef RPI_INTER_QPU -++ rpi_inter_clear(s); -++#endif -+ } -+ } -+ #endif -+@@ -2712,6 +2841,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ #ifdef RPI -+ if (s->enable_rpi && s->num_dblk_cmds) { -++#ifdef RPI_INTER_QPU -++ rpi_execute_inter_qpu(s); -++#endif -+ rpi_execute_transform(s); -+ rpi_execute_inter_cmds(s); -+ vpu_wait(s->vpu_id); -+@@ -3451,6 +3583,14 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+ -++#ifdef RPI_INTER_QPU -++ if (s->unif_mvs) { -++ gpu_free( &s->unif_mvs_ptr ); -++ s->unif_mvs = 0; -++ } -++#endif -++ //gpu_free(&s->dummy); -++ -+ #ifdef EARLY_MALLOC -+ printf("hevc_decode_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+@@ -3541,34 +3681,59 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ if (!s->univ_pred_cmds) -+ goto fail; -+ -+- s->coeffs_buf_arm[0] = 0; -+- s->coeffs_buf_arm[2] = 0; -++#ifdef RPI_INTER_QPU -++ // We divide the image into blocks 256 wide and 64 high -++ // We support up to 2048 widths -++ // We compute the number of chroma motion vector commands for 4:4:4 format and 4x4 chroma blocks - assuming all blocks are B predicted -++ // Also add space for the startup command for each stream. -++ -++ { -++ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -++ uint32_t *p; -++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ -++ // Set up initial locations for uniform streams -++ p = s->unif_mvs; -++ for(i = 0; i < 8; i++) { -++ s->mvs_base[i] = p; -++ p += uv_commands_per_qpu; -++ } -++ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -++ s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); -++ -++ } -++#endif -++ //gpu_malloc_uncached(2048*64,&s->dummy); -+ -+ #ifdef EARLY_MALLOC -+- int coeffs_in_ctb = 64*64; -+- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -+- printf("Allocated %d\n",coefs_per_row); -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+- if (!s->coeffs_buf_arm[0]) -+- goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+- if (!s->coeffs_buf_arm[2]) -+- goto fail; -+- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+- printf("Done\n"); -++ { -++ int coeffs_in_ctb = 64*64; -++ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -++ s->coeffs_buf_arm[0] = 0; -++ s->coeffs_buf_arm[2] = 0; -++ printf("Allocated %d\n",coefs_per_row); -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -++ if (!s->coeffs_buf_arm[0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -++ if (!s->coeffs_buf_arm[2]) -++ goto fail; -++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -++ printf("Done\n"); -+ #ifdef RPI_PRECLEAR -+- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[2], coefs_per_row); -+- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[3], coefs_per_row); -++ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -++ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[2], coefs_per_row); -++ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+ #endif -+- -++ } -+ #endif -+ -+ s->enable_rpi = 0; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 990bd8c..da345f6 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -42,7 +42,11 @@ -+ -+ // define RPI to split the CABAC/prediction/transform into separate stages -+ #ifdef RPI -+-#include "rpi_qpu.h" -++ -++ #include "rpi_qpu.h" -++ // Use QPU for inter prediction -++ //#define RPI_INTER_QPU -++ -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -888,7 +892,7 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI -+ int enable_rpi; -+- HEVCMvCmd *unif_mv_cmds; -++ HEVCMvCmd *unif_mv_cmds; // TODO rename -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+ int buf_width; -+@@ -902,6 +906,20 @@ typedef struct HEVCContext { -+ int num_pred_cmds; -+ int num_dblk_cmds; -+ int vpu_id; -++ //GPU_MEM_PTR_T dummy; -++#ifdef RPI_INTER_QPU -++ GPU_MEM_PTR_T unif_mvs_ptr; -++ uint32_t *unif_mvs; // Base of memory for motion vector commands -++ -++ // _base pointers are to the start of the row -++ uint32_t *mvs_base[8]; -++ // these pointers are to the next free space -++ uint32_t *u_mvs[8]; -++ // Function pointers -++ uint32_t mc_filter_uv; -++ uint32_t mc_filter_uv_b; -++#endif -++ -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index e1b32d4..5b3d759 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -903,8 +903,11 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ //flush_buffer(s->frame->buf[1]); -++ //flush_buffer(s->frame->buf[2]); -++ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -++ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -++ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+ } -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 3b6dae7..e4dd58a 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -3,7 +3,7 @@ -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ #define RPI_USE_VCSM -+ // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+-//#define RPI_TIME_TOTAL_QPU -++#define RPI_TIME_TOTAL_QPU -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+ //#define RPI_TIME_TOTAL_VPU -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+@@ -30,7 +30,7 @@ -+ #endif -+ -+ // On Pi2 there is no way to access the VPU L2 cache -+-// GPU_MEM_FLG should be 4 for uncached memory. -++// GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -+ // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -+ // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -+ #define GPU_MEM_FLG 0xC -+@@ -549,6 +549,54 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un -+ gpu_unlock(); -+ } -+ -++// Run a program on 8 QPUs with the given code and uniform stream (given in GPU addresses) -++void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -++{ -++ int i; -++#ifdef RPI_TIME_TOTAL_QPU -++ static int last_time=0; -++ static long long on_time=0; -++ static long long off_time=0; -++ int start_time; -++ int end_time; -++ static int count=0; -++#endif -++ -++ gpu_lock(); -++#ifdef RPI_TIME_TOTAL_QPU -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -++ for(i=0;i<8;i++) { -++ gpu->mail[i*2 + 1] = code; -++ } -++ gpu->mail[0 ] = unifs1; -++ gpu->mail[2 ] = unifs2; -++ gpu->mail[4 ] = unifs3; -++ gpu->mail[6 ] = unifs4; -++ gpu->mail[8 ] = unifs5; -++ gpu->mail[10] = unifs6; -++ gpu->mail[12] = unifs7; -++ gpu->mail[14] = unifs8; -++ execute_qpu( -++ gpu->mb, -++ 8 /* Number of QPUs */, -++ gpu->vc + offsetof(struct GPU, mail), -++ 1 /* no flush */, // Don't flush VPU L1 cache -++ 5000 /* timeout ms */); -++#ifdef RPI_TIME_TOTAL_QPU -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ if ((count&0x7f)==0) -++ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); -++#endif -++ gpu_unlock(); -++} -++ -+ unsigned int qpu_get_fn(int num) { -+ // Make sure that the gpu is initialized -+ unsigned int *fn; -+@@ -585,6 +633,9 @@ unsigned int qpu_get_fn(int num) { -+ case QPU_MC_FILTER_UV_B: -+ fn = mc_filter_uv_b; -+ break; -++ case QPU_MC_INTERRUPT_EXIT8: -++ fn = mc_interrupt_exit8; -++ break; -+ case QPU_MC_END: -+ fn = mc_end; -+ break; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 3526fce..2b22d98 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -16,6 +16,7 @@ extern void gpu_free(GPU_MEM_PTR_T *p); -+ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+ -+ // QPU specific functions -++extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -+ -+ enum { -+@@ -28,6 +29,7 @@ enum { -+ QPU_MC_SETUP_UV, -+ QPU_MC_FILTER_UV, -+ QPU_MC_FILTER_UV_B, -++ QPU_MC_INTERRUPT_EXIT8, -+ QPU_MC_END -+ }; -+ extern unsigned int qpu_get_fn(int num); -+-- -+2.7.4 -+ -+ -+From bd651e1569ebe0cdc41a6be169e139758cce069d Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 11:47:23 +0100 -+Subject: [PATCH 17/68] Drafted chroma interpolation on QPUs -+ -+--- -+ libavcodec/hevc.c | 5 ++- -+ libavcodec/hevc.h | 2 +- -+ libavcodec/hevc_filter.c | 6 ++- -+ libavcodec/rpi_qpu.c | 101 +++++++++++++++++++++++++++++++++++++++++++-- -+ libavcodec/rpi_qpu.h | 1 + -+ libavcodec/rpi_shader.c | 42 +++++++++---------- -+ libavcodec/rpi_shader.qasm | 42 +++++++++---------- -+ 7 files changed, 149 insertions(+), 50 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 66ed37a..d5ea45e 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -60,11 +60,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -+-#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) -++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ // TODO Chroma only needs 4 taps -+ static uint32_t rpi_filter_coefs[8][2] = { -+- { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -+@@ -2729,6 +2729,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index da345f6..2497c47 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -45,7 +45,7 @@ -+ -+ #include "rpi_qpu.h" -+ // Use QPU for inter prediction -+- //#define RPI_INTER_QPU -++ // #define RPI_INTER_QPU -+ -+ #endif -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 5b3d759..9b6e26d 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -903,8 +903,10 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+- //flush_buffer(s->frame->buf[1]); -+- //flush_buffer(s->frame->buf[2]); -++#ifdef RPI_INTER_QPU -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++#endif -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index e4dd58a..4d9eda8 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -33,7 +33,8 @@ -+ // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -+ // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -+ // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -+-#define GPU_MEM_FLG 0xC -++#define GPU_MEM_FLG 0x4 -++// GPU_MEM_MAP is meaningless on the Pi2 and should be left at 0 (On Pi1 it allows ARM to access VPU L2 cache) -+ #define GPU_MEM_MAP 0x0 -+ -+ #define vcos_verify(x) ((x)>=0) -+@@ -165,6 +166,8 @@ static int gpu_init(volatile struct GPU **gpu) { -+ ptr->vc_handle = handle; -+ ptr->vc = vc; -+ -++ printf("GPU allocated at 0x%x\n",vc); -++ -+ *gpu = ptr; -+ -+ // Now copy over the QPU code into GPU memory -+@@ -304,10 +307,13 @@ int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -+ -+ static void gpu_term(void) -+ { -+- int mb = gpu->mb; -+- unsigned handle = gpu->vc_handle; -++ int mb; -++ unsigned handle; -++ -+ if (gpu==NULL) -+ return; -++ mb = gpu->mb; -++ handle = gpu->vc_handle; -+ -+ #ifdef RPI_ASYNC -+ { -+@@ -648,6 +654,95 @@ unsigned int qpu_get_fn(int num) { -+ } -+ -+ #if 0 -++typedef unsigned int uint32_t; -++ -++typedef struct mvs_s { -++ GPU_MEM_PTR_T unif_mvs_ptr; -++ uint32_t *unif_mvs; // Base of memory for motion vector commands -++ -++ // _base pointers are to the start of the row -++ uint32_t *mvs_base[8]; -++ // these pointers are to the next free space -++ uint32_t *u_mvs[8]; -++ -++} HEVCContext; -++ -++#define RPI_CHROMA_COMMAND_WORDS 12 -++ -++static void rpi_inter_clear(HEVCContext *s) -++{ -++ int i; -++ for(i=0;i<8;i++) { -++ s->u_mvs[i] = s->mvs_base[i]; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 128; // w -++ *s->u_mvs[i]++ = 128; // h -++ *s->u_mvs[i]++ = 128; // stride u -++ *s->u_mvs[i]++ = 128; // stride v -++ s->u_mvs[i] += 3; // Padding words -++ } -++} -++ -++static void rpi_execute_inter_qpu(HEVCContext *s) -++{ -++ int k; -++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++ -++ for(k=0;k<8;k++) { -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // dummy location for V -++ } -++ -++ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ -++ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ ); -++} -++ -++void rpi_test_qpu(void) -++{ -++ HEVCContext mvs; -++ HEVCContext *s = &mvs; -++ int i; -++ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -++ uint32_t *p; -++ printf("Allocate memory\n"); -++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; -++ -++ // Set up initial locations for uniform streams -++ p = s->unif_mvs; -++ for(i = 0; i < 8; i++) { -++ s->mvs_base[i] = p; -++ p += uv_commands_per_qpu; -++ } -++ // Now run a simple program that should just quit immediately after a single texture fetch -++ rpi_inter_clear(s); -++ for(i=0;i<4;i++) { -++ printf("Launch QPUs\n"); -++ rpi_execute_inter_qpu(s); -++ printf("Done\n"); -++ } -++ printf("Free memory\n"); -++ gpu_free(&s->unif_mvs_ptr); -++ return; -++} -++#endif -++ -++#if 0 -+ -+ int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; -+ //int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 2b22d98..f9ad333 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -18,6 +18,7 @@ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+ // QPU specific functions -+ extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -++extern void rpi_test_qpu(void); -+ -+ enum { -+ QPU_MC_SETUP, -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 41cc2e1..d7ed297 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -152,23 +152,23 @@ unsigned int rpi_shader[] = { -+ /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+ /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+ /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 -++/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+ /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ /* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ /* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ /* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ /* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ /* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ /* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+ /* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+ /* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+ /* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+@@ -179,20 +179,20 @@ unsigned int rpi_shader[] = { -+ /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+ /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+ /* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 -+ /* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait -+ /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ /* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+ /* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+ /* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+ /* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 6851e83..02fdcb2 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -270,23 +270,23 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++mov r2, rb21 ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -++add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+@@ -302,23 +302,23 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ # apply horizontal filter -+ brr.anyn -, r:uvloop -+ max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -++asr r0, r0, 14 ; mov r1, ra21 -+ min.setf ra15, r0, rb22 -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -++nop ; mul24 r1, ra14, rb14 -++nop ; mul24 r0, ra13, rb13 -++add r1, r1, r0 ; mul24 r0, ra12, rb12 -++add r1, r1, r0 ; mul24 r0, ra11, rb11 -++add r1, r1, r0 ; mul24 r0, ra10, rb10 -++add r1, r1, r0 ; mul24 r0, ra9, rb9 -++add r1, r1, r0 ; mul24 r0, ra8, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb15 -++add.ifnn r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ brr.anyn -, r:uvloop -+-asr r1, r1, 15 -++asr r1, r1, 14 -+ min r1, r1, rb22 -+ max vpm, r1, 0 -+ -+-- -+2.7.4 -+ -+ -+From 61628063461ee5d891af6dbedfd495efcf464012 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 13:54:11 +0100 -+Subject: [PATCH 18/68] Fixed chroma inter prediction -+ -+--- -+ libavcodec/hevc.c | 8 +- -+ libavcodec/hevc.h | 2 +- -+ libavcodec/rpi_shader.c | 1170 ++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 22 +- -+ libavcodec/rpi_shader.qasm | 24 +- -+ 5 files changed, 617 insertions(+), 609 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index d5ea45e..d6d78ee 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -57,9 +57,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ #ifdef RPI_INTER_QPU -+ -+ #define RPI_CHROMA_COMMAND_WORDS 12 -++#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -++ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ // TODO Chroma only needs 4 taps -+@@ -2024,7 +2026,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ int chan = x0>>8; -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+@@ -2730,6 +2733,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -++ assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+@@ -3689,7 +3693,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ // Also add space for the startup command for each stream. -+ -+ { -+- int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -++ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; -+ uint32_t *p; -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 2497c47..d513579 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -45,7 +45,7 @@ -+ -+ #include "rpi_qpu.h" -+ // Use QPU for inter prediction -+- // #define RPI_INTER_QPU -++ #define RPI_INTER_QPU -+ -+ #endif -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index d7ed297..831633b 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -33,7 +33,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+ /* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+ /* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 -++/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+ /* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+ /* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+ /* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+@@ -152,7 +152,7 @@ unsigned int rpi_shader[] = { -+ /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+ /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+ /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 -++/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+ /* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ /* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+ /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+@@ -178,9 +178,9 @@ unsigned int rpi_shader[] = { -+ /* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+ /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+ /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 -+-/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ /* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+ /* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+ /* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+@@ -189,400 +189,400 @@ unsigned int rpi_shader[] = { -+ /* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+ /* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ /* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+ /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter -+-/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -+-/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -++/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :loop -+-/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // :fast_path -+-/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :fast_loop -+-/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+-/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+-/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -+-/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -++/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -++/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -++/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_b -+-/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :bloop -+-/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -+-/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -++/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_honly -+-/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -+-/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -+-/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -++/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -++/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :loop_honly -+-/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -+-/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -+-/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -+-/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -+-/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -+-/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -+-/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -++/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -++/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -++/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -++/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -++/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -++/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+ /* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_exit1 -+-/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit -+-/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+@@ -592,225 +592,227 @@ unsigned int rpi_shader[] = { -+ /* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit4 -+-/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_setup_uv -+-/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+-/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+-/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+-/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+-/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 -+-/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif -++/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 -++/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+ /* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv_b -+-/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index db971f4..3464cdb 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,16 +5,16 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 146) -+-#define mc_filter (rpi_shader + 360) -+-#define mc_filter_b (rpi_shader + 670) -+-#define mc_filter_honly (rpi_shader + 894) -+-#define mc_exit (rpi_shader + 1048) -+-#define mc_exit1 (rpi_shader + 1066) -+-#define mc_interrupt_exit (rpi_shader + 1082) -+-#define mc_interrupt_exit4 (rpi_shader + 1120) -+-#define mc_interrupt_exit8 (rpi_shader + 1142) -+-#define mc_setup_uv (rpi_shader + 1172) -+-#define mc_filter_uv_b (rpi_shader + 1314) -+-#define mc_end (rpi_shader + 1542) -++#define mc_filter (rpi_shader + 364) -++#define mc_filter_b (rpi_shader + 674) -++#define mc_filter_honly (rpi_shader + 898) -++#define mc_exit (rpi_shader + 1052) -++#define mc_exit1 (rpi_shader + 1070) -++#define mc_interrupt_exit (rpi_shader + 1086) -++#define mc_interrupt_exit4 (rpi_shader + 1124) -++#define mc_interrupt_exit8 (rpi_shader + 1146) -++#define mc_setup_uv (rpi_shader + 1176) -++#define mc_filter_uv_b (rpi_shader + 1318) -++#define mc_end (rpi_shader + 1546) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 02fdcb2..4809e1d 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -21,7 +21,7 @@ -+ # rb19 next ra16 -+ # -+ # ra20 1 -+-# ra21 64 -++# ra21 32 -+ # ra22 256 -+ # ra23 8 -+ # -+@@ -97,7 +97,7 @@ add rb24, r1, r0 -+ # load constants -+ -+ mov ra20, 1 -+-mov ra21, 64 -++mov ra21, 32 -+ mov ra22, 256 -+ mov ra23, 8 -+ -+@@ -270,7 +270,7 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+-mov r2, rb21 ; mul24 r2, r0, ra0 -++nop ; mul24 r2, r0, ra0 -+ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+@@ -301,9 +301,9 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 14 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -++asr ra15, r0, 8 ; nop -++nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+ -+ # apply vertical filter and write to VPM -+ -+@@ -315,12 +315,14 @@ add r1, r1, r0 ; mul24 r0, ra10, rb10 -+ add r1, r1, r0 ; mul24 r0, ra9, rb9 -+ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-add.ifnn r1, r1, r0 ; mov -, vw_wait -++add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-brr.anyn -, r:uvloop -+ asr r1, r1, 14 -+-min r1, r1, rb22 -+-max vpm, r1, 0 -++add r1, r1, ra21 -++brr.anyn -, r:uvloop -++asr r1, r1, 6 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -+ -+ # DMA out for U -+ -+@@ -1161,7 +1163,7 @@ add rb24, r1, r0 -+ # load constants -+ -+ mov ra20, 1 -+-mov ra21, 64 -++mov ra21, 32 -+ mov ra22, 256 -+ mov ra23, 8 -+ -+-- -+2.7.4 -+ -+ -+From b7321192751956ed7deceeb3dabe22ccedb8e08d Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 14:37:32 +0100 -+Subject: [PATCH 19/68] Removed unused luma functions -+ -+--- -+ libavcodec/hevc.c | 4 +- -+ libavcodec/rpi_qpu.c | 32 +- -+ libavcodec/rpi_shader.c | 1097 +++++++++++++------------------------------- -+ libavcodec/rpi_shader.h | 19 +- -+ libavcodec/rpi_shader.qasm | 970 +++------------------------------------ -+ 5 files changed, 396 insertions(+), 1726 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index d6d78ee..31b8b2f 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2731,8 +2731,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ return; -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+ assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ } -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 4d9eda8..4e90cc1 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -172,7 +172,7 @@ static int gpu_init(volatile struct GPU **gpu) { -+ -+ // Now copy over the QPU code into GPU memory -+ { -+- int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); -++ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); -+ assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -+ } -+@@ -612,24 +612,24 @@ unsigned int qpu_get_fn(int num) { -+ gpu_unlock(); -+ } -+ switch(num) { -+- case QPU_MC_SETUP: -+- fn = mc_setup; -+- break; -+- case QPU_MC_FILTER: -+- fn = mc_filter; -+- break; -++ //case QPU_MC_SETUP: -++ // fn = mc_setup; -++ // break; -++ //case QPU_MC_FILTER: -++ // fn = mc_filter; -++ // break; -+ case QPU_MC_EXIT: -+ fn = mc_exit; -+ break; -+- case QPU_MC_INTERRUPT_EXIT: -+- fn = mc_interrupt_exit; -+- break; -+- case QPU_MC_FILTER_B: -+- fn = mc_filter_b; -+- break; -+- case QPU_MC_FILTER_HONLY: -+- fn = mc_filter_honly; -+- break; -++ //case QPU_MC_INTERRUPT_EXIT: -++ // fn = mc_interrupt_exit; -++ // break; -++ //case QPU_MC_FILTER_B: -++ // fn = mc_filter_b; -++ // break; -++ //case QPU_MC_FILTER_HONLY: -++ // fn = mc_filter_honly; -++ // break; -+ case QPU_MC_SETUP_UV: -+ fn = mc_setup_uv; -+ break; -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 831633b..170e8ac 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -21,798 +21,331 @@ __declspec(align(8)) -+ __attribute__((aligned(8))) -+ #endif -+ unsigned int rpi_shader[] = { -+-// ::mc_setup -++// ::mc_setup_uv -+ /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+ /* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+ /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+ /* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+-/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+-/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000020] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000048] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -++/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+ /* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+ /* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch -+-/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 -+-/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter -+-/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -+-/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :loop -+-/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// :fast_path -+-/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :fast_loop -+-/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+-/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+-/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -+-/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter_b -+-/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :bloop -+-/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -+-/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter_honly -+-/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -+-/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -+-/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :loop_honly -+-/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -+-/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -+-/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -+-/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -+-/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -+-/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -+-/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_exit -+-/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_exit1 -+-/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit -+-/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit4 -+-/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit8 -+-/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_setup_uv -+-/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+-/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+-/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+-/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+-/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+-/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_exit -++/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit8 -++/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 3464cdb..9de4535 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -3,18 +3,11 @@ -+ -+ extern unsigned int rpi_shader[]; -+ -+-#define mc_setup (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 146) -+-#define mc_filter (rpi_shader + 364) -+-#define mc_filter_b (rpi_shader + 674) -+-#define mc_filter_honly (rpi_shader + 898) -+-#define mc_exit (rpi_shader + 1052) -+-#define mc_exit1 (rpi_shader + 1070) -+-#define mc_interrupt_exit (rpi_shader + 1086) -+-#define mc_interrupt_exit4 (rpi_shader + 1124) -+-#define mc_interrupt_exit8 (rpi_shader + 1146) -+-#define mc_setup_uv (rpi_shader + 1176) -+-#define mc_filter_uv_b (rpi_shader + 1318) -+-#define mc_end (rpi_shader + 1546) -++#define mc_setup_uv (rpi_shader + 0) -++#define mc_filter_uv (rpi_shader + 142) -++#define mc_filter_uv_b (rpi_shader + 360) -++#define mc_exit (rpi_shader + 588) -++#define mc_interrupt_exit8 (rpi_shader + 606) -++#define mc_end (rpi_shader + 636) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 4809e1d..cd7346d 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -71,8 +71,10 @@ -+ -+ .set rb_const_64, rb21 -+ -+-# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) -+-::mc_setup -++ -++################################################################################ -++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -++::mc_setup_uv -+ -+ # Read starting kernel -+ mov ra31, unif -+@@ -80,7 +82,9 @@ mov ra31, unif -+ # Load first request location -+ add ra_x_base, unif, elem_num # Store x -+ mov ra_y, unif # Store y -+-mov ra_x2_base, unif # Store frame base -++mov ra_x2_base, unif # Store frame u base -++nop -++sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -+ -+ # Read image dimensions -+ sub rb25,unif,1 -+@@ -143,29 +147,24 @@ mov r1, vpm_setup(0, 4, h8p(0, 0)) -+ add rb28, r0, r1 -+ -+ # Compute base address for first and second access -+-#add r0, unif, elem_num # x -+ mov r0, ra_x_base # Load x -+-add r2, r0, 8 # x+8 -+ max r0, r0, 0; mov r1, ra_y # Load y -+ min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+-shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -++shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+ add ra_y, r1, 1 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -+-max r1, r1, 0 # y -+-min r1, r1, rb_frame_height_minus_1 -+-add r0, r0, r3; mul24 r1, r1, rb_pitch -+-add r2, r2, r3 -++add r0, r0, r3 -+ and r0, r0, ~3 -+-and r2, r2, ~3; mov ra_x_base, r0 -++max r1, r1, 0 ; mov ra_x_base, r0 # y -++min r1, r1, rb_frame_height_minus_1 -+ # submit texture requests for first line -++add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ add t0s, r0, r1 ; mov ra_x2_base, r2 -+ add t0s, r2, r1 -+ -+ # Dump padding words -+ mov r0, unif -+ mov r0, unif -++mov r0, unif -+ -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+@@ -176,6 +175,8 @@ nop ; mul24 r1, r1, rb_pitch -+ add t0s, r1, ra_x_base -+ add t0s, r1, ra_x2_base -+ -++ -++ -+ ################################################################################ -+ -+ # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+@@ -341,453 +342,26 @@ add vw_setup, rb26, r0 # VDW setup 0 -+ mov vw_setup, rb29 # Stride -+ mov vw_addr, unif # start the VDW -+ -+-################################################################################ -+- -+- -+-# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+- -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -+-::mc_filter -+-mov ra31, unif -+- -+-# per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+-mov ra_x2shift, ra_x2shift_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # x -+-add r2, r0, 8 # x+8 -+-max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+-shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -+-add r0, r0, r3 -+-add r2, r2, r3 -+-and rb_x_base_next, r0, ~3 -+-and ra_x2_base_next, r2, ~3 -+-mov ra_y_next, r1 -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+-# get filter coefficients -+- -+-mov r0, unif -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-brr.anynn -, r:fast_path -+-asr rb12, r0, rb23 # delay slot 1 -+- -+-# r2 is elem_num -+-# r3 is loop counter -+- -+-mov r5rep, -8 # delay slot 2 -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -+- -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-## sub r2, r2, r3 ; ldtmu0 -+-## -+-## mov r0, ra22 -+-## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # apply horizontal filter -+-## -+-## asr r2, r2, 15 ; mul24 r3, r0, ra0 -+-## min r2, r2, rb22 -+-## max ra13, r2, 0 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra14, r0, 0 -+-## -+-## -+-## -+-## -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra15, r0, 0 -+- -+- -+- -+- -+-mov r3, 0 -+- -+-:loop -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 8 ; mov r1, ra22 -+- -+-# apply horizontal filter -+-brr.anyn -, r:loop -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-brr.anyn -, r:loop -+-asr r1, r1, 15 -+-min r1, r1, rb22 -+-max vpm, r1, 0 -+- -+-# DMA out -+- -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -+-mov vw_addr, unif # start the VDW -+- -+-#################################################### -+- -+-:fast_path -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## sub r2, r2, r3 ; ldtmu0 -+-## -+-## mov r0, ra22 -+-## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # apply horizontal filter -+-## -+-## asr r2, r2, 15 ; mul24 r3, r0, ra0 -+-## min r2, r2, rb22 -+-## max ra13, r2, 0 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra14, r0, 0 -+-## -+-## -+-## -+-## -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra15, r0, 0 -+- -+- -+-mov r3, 0 # This signifies the amount of unrolling -+- -+-:fast_loop -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+- -+-max r2, ra_y, 0 -+-min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-sub r0, r2, r3 ; mov r3, rb31 -+- -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 8 ; mov r1, ra22 -+- -+-# apply horizontal filter -+- -+-brr.anyn -, r:fast_loop -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-brr.anyn -, r:fast_loop -+-asr r1, r1, 15 -+-min r1, r1, rb22 -+-max vpm, r1, 0 -+- -+-# DMA out -+- -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -+-mov vw_addr, unif # start the VDW -+ -+ ################################################################################ -+ -+-# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+- -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -+-::mc_filter_b -++::mc_filter_uv_b -+ mov ra31, unif -+ -+ # per-channel shifts were calculated on the *previous* invocation -+ -+ mov ra_xshift, ra_xshift_next -+-mov ra_x2shift, ra_x2shift_next -+ -+ # get base addresses and per-channel shifts for *next* invocation -+ add r0, unif, elem_num # x -+-add r2, r0, 8 # x+8 -+ max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-add r2, r2, r3 -+ and rb_x_base_next, r0, ~3 -+-and ra_x2_base_next, r2, ~3 -+ mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -+ -+ # set up VPM write -+ mov vw_setup, rb28 -+@@ -801,17 +375,22 @@ and r0, r0, rb22 # Extract height -+ add rb17, r0, 5 -+ add rb18, r0, 7 -+ shl r0, r0, 7 -++ -+ # r0 is currently height<<7 -+ # For vr_setup we want height<<20 (so 20-7=13 additional bits) -+ shl r3, r0, 13 -+ shl r3, r3, 8 # Mask off top 8 bits -+ shr r3, r3, 8 -++ -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -++ -+ # In a B frame, so also set up VPM read -+ add vr_setup, r3, rb28 -+ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -837,9 +416,13 @@ asr rb12, r0, rb23 -+ -+ mov r5rep, -8 -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -+ mov r3, 0 -+ -+-:bloop -++:uvloop_b -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+ -+@@ -847,7 +430,7 @@ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+ shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+ mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+@@ -861,6 +444,7 @@ add t0s, ra_x2_base, r2 -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ mov r2, rb21 ; mul24 r3, r0, ra0 -++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+ sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+ sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+@@ -889,7 +473,7 @@ mov ra13, ra14 -+ sub.setf -, r3, 8 ; mov r1, ra22 -+ -+ # apply horizontal filter -+-brr.anyn -, r:bloop -++brr.anyn -, r:uvloop_b -+ max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+ asr r0, r0, 15 ; mov r1, ra21 -+ min.setf ra15, r0, rb22 -+@@ -906,213 +490,50 @@ sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+ sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+ sub.ifnn r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 15 ; mov -, vr_wait -++asr r1, r1, 15 -+ min r1, r1, rb22 -+ add r0, vpm, 1 # Blend in previous VPM contents at this location -+-brr.anyn -, r:bloop -++brr.anyn -, r:uvloop_b -+ max r1, r1, 0 -+ add r1, r1, r0 -+ shr vpm, r1, 1 -+ -+-# DMA out -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -+ -+ bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -+ mov vw_addr, unif # start the VDW -+ -+ ################################################################################ -+ -+-# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+-# This filter only does horizontal filtering. -+-# It is assumed that the region to fetch does not include extra rows above. -++# mc_exit() -+ -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -+-::mc_filter_honly -+-mov ra31, unif -++::mc_exit -++mov -, vw_wait # wait on the VDW -+ -+-# per-channel shifts were calculated on the *previous* invocation -++mov -,srel(0) -+ -+-mov ra_xshift, ra_xshift_next -+-mov ra_x2shift, ra_x2shift_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # x -+-add r2, r0, 8 # x+8 -+-max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+-shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -+-add r0, r0, r3 -+-add r2, r2, r3 -+-and rb_x_base_next, r0, ~3 -+-and ra_x2_base_next, r2, ~3 -+-mov ra_y_next, r1 -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, -2 # Pipelining means we move data across 2 iterations early -+-shl r0, r0, 7 ; mov rb18,r0 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-# get filter coefficients -+- -+-mov r0, unif -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-mov r0, unif -+- -+-# r2 is elem_num -+-# r3 is loop counter -+-mov r5rep, -8 -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -+-mov r3, 0 -+- -+-:loop_honly -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 ; mov r3, rb31 -+- -+-sub.setf -, r3, rb18 ; mov r1, ra22 -+- -+-mov -, vw_wait ; mul24 r0, r0, r1 -+-brr.anyn -, r:loop_honly -+-asr r0, r0, 15 # delay 1 -+-min r0, r0, rb22 # delay 2 -+-max vpm, r0, 0 # delay 3 -+- -+-# DMA out -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -+-mov vw_addr, unif # start the VDW -+- -+- -+-################################################################################ -+- -+-# mc_exit() -+- -+-::mc_exit -+-mov -, vw_wait # wait on the VDW -+- -+-mov -,srel(0) -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -+ -+ nop ; nop ; thrend -+ nop ; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -+-::mc_exit1 -+-mov -, vw_wait # wait on the VDW -+- -+-#mov -,srel(1) -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -+- -+-# mc_interrupt_exit() -+-::mc_interrupt_exit -+-mov -, vw_wait # wait on the VDW -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-mov -,sacq(0) # 1 -+-mov -,sacq(0) # 2 -+-mov -,sacq(0) # 3 -+-mov -,sacq(0) # 4 -+-mov -,sacq(0) # 5 -+-mov -,sacq(0) # 6 -+-mov -,sacq(0) # 7 -+-mov -,sacq(0) # 8 -+-mov -,sacq(0) # 9 -+-mov -,sacq(0) # 10 -+-mov -,sacq(0) # 11 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -+- -+-# mc_interrupt_exit4() -+-::mc_interrupt_exit4 -+-mov -, vw_wait # wait on the VDW -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-mov -,sacq(0) # 1 -+-mov -,sacq(0) # 2 -+-mov -,sacq(0) # 3 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -+- -+ # mc_interrupt_exit8() -+ ::mc_interrupt_exit8 -+ mov -, vw_wait # wait on the VDW -+@@ -1134,282 +555,5 @@ nop ; nop ; thrend -+ mov interrupt, 1; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -+-################################################################################ -+-# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+-::mc_setup_uv -+- -+-# Read starting kernel -+-mov ra31, unif -+- -+-# Load first request location -+-add ra_x_base, unif, elem_num # Store x -+-mov ra_y, unif # Store y -+-mov ra_x2_base, unif # Store frame u base -+-nop -+-sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -+- -+-# Read image dimensions -+-sub rb25,unif,1 -+-sub rb30,unif,1 -+- -+-# get source pitch -+-mov rb16, unif -+- -+-# get destination pitch -+-mov r0, unif -+-mov r1, vdw_setup_1(0) -+-add rb24, r1, r0 -+- -+-# load constants -+- -+-mov ra20, 1 -+-mov ra21, 32 -+-mov ra22, 256 -+-mov ra23, 8 -+- -+-mov rb20, 0xffffff00 -+-mov rb21, 64 -+-mov rb22, 255 -+-mov rb23, 24 -+- -+-# touch vertical context to keep simulator happy -+- -+-mov ra8, 0 -+-mov ra9, 0 -+-mov ra10, 0 -+-mov ra11, 0 -+-mov ra12, 0 -+-mov ra13, 0 -+-mov ra14, 0 -+-mov ra15, 0 -+- -+-# Compute part of VPM to use for DMA output -+-mov r2, qpu_num -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+-shl r0, r0, 5 -+-add rb27, r0, r1 -+- -+-# Compute part of VPM to save data into -+-mov r2, qpu_num -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-add rb28, r0, r1 -+- -+-# Compute base address for first and second access -+-mov r0, ra_x_base # Load x -+-max r0, r0, 0; mov r1, ra_y # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+-shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-add ra_y, r1, 1 -+-add r0, r0, r3 -+-and r0, r0, ~3 -+-max r1, r1, 0 ; mov ra_x_base, r0 # y -+-min r1, r1, rb_frame_height_minus_1 -+-# submit texture requests for first line -+-add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-add t0s, r0, r1 ; mov ra_x2_base, r2 -+-add t0s, r2, r1 -+- -+-# Dump padding words -+-mov r0, unif -+-mov r0, unif -+-mov r0, unif -+- -+-# submit texture requests for second line -+-max r1, ra_y, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 -+-bra -, ra31 -+-nop ; mul24 r1, r1, rb_pitch -+-add t0s, r1, ra_x_base -+-add t0s, r1, ra_x2_base -+- -+- -+- -+-################################################################################ -+- -+-::mc_filter_uv_b -+-mov ra31, unif -+- -+-# per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # x -+-max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+-shl ra_xshift_next, r0, 3 -+-sub r2, unif, r3 # compute offset from frame base u to frame base v -+-add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -+-mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+- -+-# r0 is currently height<<7 -+-# For vr_setup we want height<<20 (so 20-7=13 additional bits) -+-shl r3, r0, 13 -+-shl r3, r3, 8 # Mask off top 8 bits -+-shr r3, r3, 8 -+- -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-# In a B frame, so also set up VPM read -+-add vr_setup, r3, rb28 -+- -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+-# get filter coefficients -+- -+-mov r0, unif -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+- -+-# r2 is elem_num -+-# r3 is loop counter -+- -+-mov r5rep, -8 -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-mov r3, 0 -+- -+-:uvloop_b -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 8 ; mov r1, ra22 -+- -+-# apply horizontal filter -+-brr.anyn -, r:uvloop_b -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 15 -+-min r1, r1, rb22 -+-add r0, vpm, 1 # Blend in previous VPM contents at this location -+-brr.anyn -, r:uvloop_b -+-max r1, r1, 0 -+-add r1, r1, r0 -+-shr vpm, r1, 1 -+- -+- -+-# DMA out for U -+- -+-mov vw_setup, rb26 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -+- -+-# DMA out for V -+-# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+-# Could potentially push this write into the start of the next pipeline stage. -+-mov r0, 16 -+-mov -, vw_wait -+- -+-bra -, ra31 -+-add vw_setup, rb26, r0 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -+- -+ ::mc_end -++# Do not add code here because mc_end must appear after all other code. -+-- -+2.7.4 -+ -+ -+From d40d59de0f09fd1a6e7146532418b63d8e2711b7 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 14:54:25 +0100 -+Subject: [PATCH 20/68] Moved chroma P1 to QPUs -+ -+--- -+ libavcodec/hevc.c | 38 ++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 38 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 31b8b2f..391d139 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2070,6 +2070,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -++#ifdef RPI_INTER_QPU -++ if (s->enable_rpi) { -++ int reflist = 1; -++ int hshift = s->ps.sps->hshift[1]; -++ int vshift = s->ps.sps->vshift[1]; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -++ intptr_t _mx = mx << (1 - hshift); -++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -++ -++ int x1_c = x0_c + (mv->x >> (2 + hshift)); -++ int y1_c = y0_c + (mv->y >> (2 + hshift)); -++ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ int chan = x0>>8; -++ -++ uint32_t *u = s->u_mvs[chan & 7]; -++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -++ *u++ = rpi_filter_coefs[_mx][0]; -++ *u++ = rpi_filter_coefs[_mx][1]; -++ *u++ = rpi_filter_coefs[_my][0]; -++ *u++ = rpi_filter_coefs[_my][1]; -++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ } -++ } -++ s->u_mvs[chan & 7] = u; -++ return; -++ } -++#endif -+ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -+ 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); -+-- -+2.7.4 -+ -+ -+From 75777ba7927086e862104b14f6446e81bc789611 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 15:13:47 +0100 -+Subject: [PATCH 21/68] Added B prediction - not quite right -+ -+--- -+ libavcodec/hevc.c | 58 ++++++++++++++++++++++++ -+ libavcodec/rpi_shader.c | 108 +++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 6 +-- -+ libavcodec/rpi_shader.qasm | 48 ++++++++++---------- -+ 4 files changed, 141 insertions(+), 79 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 391d139..47ddfff 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2127,6 +2127,64 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ ref1->frame, ¤t_mv.mv[1], ¤t_mv); -+ -+ if (s->ps.sps->chroma_format_idc) { -++#ifdef RPI_INTER_QPU -++ if (s->enable_rpi) { -++ int hshift = s->ps.sps->hshift[1]; -++ int vshift = s->ps.sps->vshift[1]; -++ const Mv *mv = ¤t_mv.mv[0]; -++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -++ intptr_t _mx = mx << (1 - hshift); -++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -++ int x1_c = x0_c + (mv->x >> (2 + hshift)); -++ int y1_c = y0_c + (mv->y >> (2 + hshift)); -++ -++ const Mv *mv2 = ¤t_mv.mv[1]; -++ intptr_t mx2 = av_mod_uintp2(mv2->x, 2 + hshift); -++ intptr_t my2 = av_mod_uintp2(mv2->y, 2 + vshift); -++ intptr_t _mx2 = mx2 << (1 - hshift); -++ intptr_t _my2 = my2 << (1 - vshift); // Fractional part of motion vector -++ -++ int x2_c = x0_c + (mv2->x >> (2 + hshift)); -++ int y2_c = y0_c + (mv2->y >> (2 + hshift)); -++ -++ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ -++ uint32_t *u = s->u_mvs[chan & 7]; -++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -++ *u++ = rpi_filter_coefs[_mx2][0]; -++ *u++ = rpi_filter_coefs[_mx2][1]; -++ *u++ = rpi_filter_coefs[_my2][0]; -++ *u++ = rpi_filter_coefs[_my2][1]; -++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ } -++ } -++ s->u_mvs[chan & 7] = u; -++ return; -++ } -++#endif -+ RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -+ x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 170e8ac..5d00cb2 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -265,23 +265,23 @@ unsigned int rpi_shader[] = { -+ /* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+ /* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+ /* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+ /* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ /* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ /* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ /* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ /* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ /* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ /* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+ /* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+ /* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+ /* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+@@ -291,61 +291,63 @@ unsigned int rpi_shader[] = { -+ /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+ /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+ /* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+ /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+ /* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 9de4535..e36c4ae 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -6,8 +6,8 @@ extern unsigned int rpi_shader[]; -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 142) -+ #define mc_filter_uv_b (rpi_shader + 360) -+-#define mc_exit (rpi_shader + 588) -+-#define mc_interrupt_exit8 (rpi_shader + 606) -+-#define mc_end (rpi_shader + 636) -++#define mc_exit (rpi_shader + 592) -++#define mc_interrupt_exit8 (rpi_shader + 610) -++#define mc_end (rpi_shader + 640) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index cd7346d..870437d2 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -443,23 +443,23 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -++add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+@@ -474,23 +474,25 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr ra15, r0, 8 ; nop -++nop ; nop -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -++nop ; mul24 r1, ra14, rb14 -++nop ; mul24 r0, ra13, rb13 -++add r1, r1, r0 ; mul24 r0, ra12, rb12 -++add r1, r1, r0 ; mul24 r0, ra11, rb11 -++add r1, r1, r0 ; mul24 r0, ra10, rb10 -++add r1, r1, r0 ; mul24 r0, ra9, rb9 -++add r1, r1, r0 ; mul24 r0, ra8, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb15 -++add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 15 -++asr r1, r1, 14 -++add r1, r1, ra21 -++asr r1, r1, 6 -+ min r1, r1, rb22 -+ add r0, vpm, 1 # Blend in previous VPM contents at this location -+ brr.anyn -, r:uvloop_b -+-- -+2.7.4 -+ -+ -+From 3d4e94b8f0b08fe4c0b582fc7f1dbe9d1d9d60ed Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 08:15:55 +0100 -+Subject: [PATCH 22/68] Added flush for SAO -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ libavcodec/hevc_filter.c | 39 ++++++++++++++++++++++++++------------- -+ 2 files changed, 27 insertions(+), 14 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 47ddfff..93e1eba 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2903,7 +2903,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ rpi_execute_inter_qpu(s); -+ #endif -+ // Transform all blocks -+- //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 9b6e26d..92a8271 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -871,6 +871,21 @@ static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+ } -++ -++static void ff_hevc_flush_chroma(HEVCContext *s) -++{ -++ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N )) { -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -++ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -++ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -++ } -++} -+ #endif -+ -+ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+@@ -886,31 +901,29 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x - ctb_size, y); -+ if (y && x_end) { -+ sao_filter_CTB(s, x, y - ctb_size); -+- if (s->threads_type & FF_THREAD_FRAME ) -++ if (s->threads_type & FF_THREAD_FRAME ) { -++#ifdef RPI_INTER_QPU -++ ff_hevc_flush_chroma(s); -++#endif -+ ff_thread_report_progress(&s->ref->tf, y, 0); -++ } -+ } -+ if (x_end && y_end) { -+ sao_filter_CTB(s, x , y); -+- if (s->threads_type & FF_THREAD_FRAME ) -++ if (s->threads_type & FF_THREAD_FRAME ) { -++#ifdef RPI_INTER_QPU -++ ff_hevc_flush_chroma(s); -++#endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -++ } -+ } -+ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -+ //int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -+- if (!( s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N )) { -+ #ifdef RPI_INTER_QPU -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ ff_hevc_flush_chroma(s); -+ #endif -+- //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+- //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+- //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+- } -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+ } -+-- -+2.7.4 -+ -+ -+From 3e337b9c4ef0c356a0259be2254ad1bc4d5bbe29 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 09:17:28 +0100 -+Subject: [PATCH 23/68] Stopped using acceleration in unsupported cases -+ -+--- -+ libavcodec/hevc.c | 14 +++++++------- -+ libavcodec/hevc_cabac.c | 4 ++-- -+ 2 files changed, 9 insertions(+), 9 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 93e1eba..bfd5a55 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -1152,15 +1152,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -+- printf("Cross component not supported\n"); // TODO -+- exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+ -+ if (lc->tu.cross_pf) { -+- printf("Cross component not supported\n"); // TODO -+- exit(-1); -+ hls_cross_component_pred(s, 1); -+ } -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+@@ -1189,8 +1185,6 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -+- printf("Cross component not supported\n"); // TODO -+- exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+@@ -2857,7 +2851,13 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -+- s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -++ s->enable_rpi = s->ps.sps->bit_depth == 8 -++ && s->ps.sps->width <= RPI_MAX_WIDTH -++ && !s->ps.pps->cross_component_prediction_enabled_flag -++ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -++ && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -++ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -++ -+ #endif -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 4f072be..38f53de 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1513,9 +1513,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ #ifdef RPI -+ if (!use_vpu) { -+ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -+- if (max_xy == 0) -++ if (max_xy == 0) { -+ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -+- else { -++ } else { -+ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; -+ if (max_xy < 4) -+ col_limit = FFMIN(4, col_limit); -+-- -+2.7.4 -+ -+ -+From 3941d3e4c2305fa037e8aba5a14cf698ac8673db Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 09:42:16 +0100 -+Subject: [PATCH 24/68] Split B prediction into two passes -+ -+--- -+ libavcodec/hevc.c | 1 + -+ libavcodec/hevc.h | 1 + -+ libavcodec/rpi_qpu.c | 3 + -+ libavcodec/rpi_qpu.h | 1 + -+ libavcodec/rpi_shader.c | 559 +++++++++++++++++++++++++++------------------ -+ libavcodec/rpi_shader.h | 11 +- -+ libavcodec/rpi_shader.qasm | 196 ++++++++++++++-- -+ 7 files changed, 531 insertions(+), 241 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index bfd5a55..4b133d2 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3801,6 +3801,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ p += uv_commands_per_qpu; -+ } -+ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -++ s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); -+ s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); -+ -+ } -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index d513579..4a39e39 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -917,6 +917,7 @@ typedef struct HEVCContext { -+ uint32_t *u_mvs[8]; -+ // Function pointers -+ uint32_t mc_filter_uv; -++ uint32_t mc_filter_uv_b0; -+ uint32_t mc_filter_uv_b; -+ #endif -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 4e90cc1..60bf079 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -636,6 +636,9 @@ unsigned int qpu_get_fn(int num) { -+ case QPU_MC_FILTER_UV: -+ fn = mc_filter_uv; -+ break; -++ case QPU_MC_FILTER_UV_B0: -++ fn = mc_filter_uv_b0; -++ break; -+ case QPU_MC_FILTER_UV_B: -+ fn = mc_filter_uv_b; -+ break; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index f9ad333..543c84b 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -29,6 +29,7 @@ enum { -+ QPU_MC_FILTER_HONLY, -+ QPU_MC_SETUP_UV, -+ QPU_MC_FILTER_UV, -++ QPU_MC_FILTER_UV_B0, -+ QPU_MC_FILTER_UV_B, -+ QPU_MC_INTERRUPT_EXIT8, -+ QPU_MC_END -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 5d00cb2..88ad20b 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -39,18 +39,18 @@ unsigned int rpi_shader[] = { -+ /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+ /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+ /* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+ /* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+ /* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+ /* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+@@ -62,176 +62,176 @@ unsigned int rpi_shader[] = { -+ /* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+ /* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+ /* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter_uv_b -+-/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_uv_b0 -++/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+ /* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+ /* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+@@ -253,7 +253,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+ /* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ /* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :uvloop_b -++// :uvloop_b0 -+ /* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+ /* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+ /* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+@@ -290,7 +290,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+ /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+ /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+ /* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+ /* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+ /* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -+@@ -306,48 +306,163 @@ unsigned int rpi_shader[] = { -+ /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ /* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+ /* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_uv_b -++/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :uvloop_b -++/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index e36c4ae..809e582 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,10 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 142) -+-#define mc_filter_uv_b (rpi_shader + 360) -+-#define mc_exit (rpi_shader + 592) -+-#define mc_interrupt_exit8 (rpi_shader + 610) -+-#define mc_end (rpi_shader + 640) -++#define mc_filter_uv (rpi_shader + 150) -++#define mc_filter_uv_b0 (rpi_shader + 368) -++#define mc_filter_uv_b (rpi_shader + 586) -++#define mc_exit (rpi_shader + 818) -++#define mc_interrupt_exit8 (rpi_shader + 836) -++#define mc_end (rpi_shader + 866) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 870437d2..635b894 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -26,7 +26,7 @@ -+ # ra23 8 -+ # -+ # rb20 0xffffff00 -+-# rb21 64 -++# rb21 vpm_setup for writing 16bit results into VPM -+ # rb22 255 -+ # rb23 24 -+ # -+@@ -34,7 +34,7 @@ -+ # rb25 frame width-1 -+ # rb26 height<<23 + width<<16 + vdw_setup_0 -+ # rb27 vdw_setup_0 (depends on QPU number) -+-# rb28 vpm_setup (depends on QPU number) -++# rb28 vpm_setup (depends on QPU number) for writing 8bit results into VPM -+ # rb29 vdw_setup_1(dst_pitch-width) -+ # rb30 frame height-1 -+ # rb31 used as temp to count loop iterations -+@@ -69,8 +69,6 @@ -+ .set ra_y_next, ra28 -+ .set ra_y, ra29 -+ -+-.set rb_const_64, rb21 -+- -+ -+ ################################################################################ -+ # mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+@@ -106,7 +104,6 @@ mov ra22, 256 -+ mov ra23, 8 -+ -+ mov rb20, 0xffffff00 -+-mov rb21, 64 -+ mov rb22, 255 -+ mov rb23, 24 -+ -+@@ -123,6 +120,7 @@ mov ra15, 0 -+ -+ # Compute part of VPM to use for DMA output -+ mov r2, qpu_num -++shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+ and r2, r2, 15 -+ mov r1, r2 -+ asr r1, r1, 2 -+@@ -135,16 +133,21 @@ shl r0, r0, 5 -+ add rb27, r0, r1 -+ -+ # Compute part of VPM to save data into -+-mov r2, qpu_num -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) -++mov r2, qpu_num # qpu_num = abcd -++shl r2, r2, 1 -++and r2, r2, 15 # r2 = bcd0 -++mov r1, r2 # r1 = bcd0 -++asr r1, r1, 2 # r1 = bc -++shl r1, r1, 6 # r1 = bc000000 -++mov r0, r2 # r0 = bcd0 -++and r0, r0, 3 # r0 = d0 -++add r0, r0, r1 # r0 = bc0000d0 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+ add rb28, r0, r1 -++asr r0, r0, 1 # r0 = bc0000d -++# Prepare VPM command for 16bit intermediates -++mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -++add rb21, r0, r1 -+ -+ # Compute base address for first and second access -+ mov r0, ra_x_base # Load x -+@@ -345,6 +348,171 @@ mov vw_addr, unif # start the VDW -+ -+ ################################################################################ -+ -++# mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_uv_b0 -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -++shl ra_xshift_next, r0, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -++add r0, r0, r3 -++and rb_x_base_next, r0, ~3 -++mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:uvloop_b0 -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++add r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:uvloop_b0 -++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -++asr ra15, r0, 8 ; nop -++nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r1, ra14, rb14 -++nop ; mul24 r0, ra13, rb13 -++add r1, r1, r0 ; mul24 r0, ra12, rb12 -++add r1, r1, r0 ; mul24 r0, ra11, rb11 -++add r1, r1, r0 ; mul24 r0, ra10, rb10 -++add r1, r1, r0 ; mul24 r0, ra9, rb9 -++add r1, r1, r0 ; mul24 r0, ra8, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb15 -++add r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 14 -++add r1, r1, ra21 -++brr.anyn -, r:uvloop -++asr r1, r1, 6 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -++ -++bra -, ra31 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -+ ::mc_filter_uv_b -+ mov ra31, unif -+ -+-- -+2.7.4 -+ -+ -+From 85d0ffa2bcf6a2b94c1a0c8f84241cda9ac92ce2 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 10:04:55 +0100 -+Subject: [PATCH 25/68] Switch to using 16bit temp buffers -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ libavcodec/rpi_shader.c | 4 ++-- -+ libavcodec/rpi_shader.qasm | 10 +++++----- -+ 3 files changed, 8 insertions(+), 8 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 4b133d2..28a6660 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2147,7 +2147,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+- u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 88ad20b..ffd3a07 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -220,7 +220,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+ /* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+ /* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+ /* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+ /* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+@@ -346,7 +346,7 @@ unsigned int rpi_shader[] = { -+ /* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+ /* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+ /* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 635b894..9577121 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -26,7 +26,7 @@ -+ # ra23 8 -+ # -+ # rb20 0xffffff00 -+-# rb21 vpm_setup for writing 16bit results into VPM -++# rb21 vpm_setup for reading/writing 16bit results into VPM -+ # rb22 255 -+ # rb23 24 -+ # -+@@ -370,8 +370,8 @@ and rb_x_base_next, r0, ~3 -+ mov ra_y_next, r1 -+ add ra_x2_base_next, rb_x_base_next, r2 -+ -+-# set up VPM write -+-mov vw_setup, rb28 -++# set up VPM write, we need to save 16bit precision -++mov vw_setup, rb21 -+ -+ # get width,height of block -+ mov r2, 16 -+@@ -554,8 +554,8 @@ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -+ -+-# In a B frame, so also set up VPM read -+-add vr_setup, r3, rb28 -++# In a B frame, so also set up VPM read (reading back 16bit precision) -++add vr_setup, r3, rb21 -+ -+ sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ -+-- -+2.7.4 -+ -+ -+From abc51bf61df597082fbd7cf1bba5031e4d44318b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 10:30:44 +0100 -+Subject: [PATCH 26/68] Corrected B prediction: matching md5 sum for hobbit50 -+ -+--- -+ libavcodec/rpi_shader.c | 815 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 12 +- -+ libavcodec/rpi_shader.qasm | 36 +- -+ 3 files changed, 429 insertions(+), 434 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index ffd3a07..77cca46 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -38,431 +38,428 @@ unsigned int rpi_shader[] = { -+ /* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+ /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+ /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+ /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop -++/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop -++/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 809e582..6562fa9 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 150) -+-#define mc_filter_uv_b0 (rpi_shader + 368) -+-#define mc_filter_uv_b (rpi_shader + 586) -+-#define mc_exit (rpi_shader + 818) -+-#define mc_interrupt_exit8 (rpi_shader + 836) -+-#define mc_end (rpi_shader + 866) -++#define mc_filter_uv (rpi_shader + 152) -++#define mc_filter_uv_b0 (rpi_shader + 370) -++#define mc_filter_uv_b (rpi_shader + 584) -++#define mc_exit (rpi_shader + 812) -++#define mc_interrupt_exit8 (rpi_shader + 830) -++#define mc_end (rpi_shader + 860) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 9577121..562dc35 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -39,13 +39,13 @@ -+ # rb30 frame height-1 -+ # rb31 used as temp to count loop iterations -+ # -+-# ra24...ra30 15, 14, 13, 12, 11, 10, 9 -+ # ra24 clipped(row start address+8+elem_num)&~3 -+ # ra25 per-channel shifts 2 -+ # ra26 next ra24 -+ # ra27 next ra25 -+ # ra28 next y -+ # ra29 y for next texture access -++# ra30 64 -+ # -+ # ra31 next kernel address -+ -+@@ -102,6 +102,7 @@ mov ra20, 1 -+ mov ra21, 32 -+ mov ra22, 256 -+ mov ra23, 8 -++mov ra30, 64 -+ -+ mov rb20, 0xffffff00 -+ mov rb22, 255 -+@@ -472,7 +473,7 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b0 -+ mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+-asr ra15, r0, 8 ; nop -++asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? -+ nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+ -+ # apply vertical filter and write to VPM -+@@ -487,18 +488,18 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb15 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-add r1, r1, ra21 -+-brr.anyn -, r:uvloop -+-asr r1, r1, 6 # Delay 1 -+-min r1, r1, rb22 # Delay 2 -+-max vpm, r1, 0 # Delay 3 -++#asr r1, r1, 14 -++#add r1, r1, ra21 -++brr.anyn -, r:uvloop_b0 -++asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -++nop # Delay 2 -++nop # Delay 3 -+ -+ # DMA out for U -+ -+ mov vw_setup, rb26 # VDW setup 0 -+ mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -++mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results -+ -+ # DMA out for V -+ # We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+@@ -639,12 +640,11 @@ mov ra12, ra13 -+ mov ra13, ra14 -+ -+ sub.setf -, r3, 8 ; mov r1, ra22 -+- -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b -+ mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+ asr ra15, r0, 8 ; nop -+-nop ; nop -++nop ; nop # TODO improve use of delay slots -+ -+ # apply vertical filter and write to VPM -+ -+@@ -658,15 +658,13 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb15 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-add r1, r1, ra21 -+-asr r1, r1, 6 -+-min r1, r1, rb22 -+-add r0, vpm, 1 # Blend in previous VPM contents at this location -++asr r1, r1, 14 # shift2=6 -++add r1, r1, vpm # Blend in previous VPM contents at this location -++add r1, r1, ra30 -+ brr.anyn -, r:uvloop_b -+-max r1, r1, 0 -+-add r1, r1, r0 -+-shr vpm, r1, 1 -++asr r1, r1, 7 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -+ -+ -+ # DMA out for U -+-- -+2.7.4 -+ -+ -+From ea60373134f98099c4ebaf0d23cca666008b4bba Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 10:55:07 +0100 -+Subject: [PATCH 27/68] P prediction uses 4 tap filters -+ -+--- -+ libavcodec/hevc.c | 50 ++-- -+ libavcodec/rpi_shader.c | 631 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 10 +- -+ libavcodec/rpi_shader.qasm | 43 +-- -+ 4 files changed, 344 insertions(+), 390 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 28a6660..a47ebc5 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -65,15 +65,15 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ // TODO Chroma only needs 4 taps -+-static uint32_t rpi_filter_coefs[8][2] = { -+- { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } -++static uint32_t rpi_filter_coefs[8][1] = { -++ { ENCODE_COEFFS( 0, 64, 0, 0) }, -++ { ENCODE_COEFFS( -2, 58, 10, -2) }, -++ { ENCODE_COEFFS( -4, 54, 16, -2) }, -++ { ENCODE_COEFFS( -6, 46, 28, -4) }, -++ { ENCODE_COEFFS( -4, 36, 36, -4) }, -++ { ENCODE_COEFFS( -4, 28, 46, -6) }, -++ { ENCODE_COEFFS( -2, 16, 54, -4) }, -++ { ENCODE_COEFFS( -2, 10, 58, -2) } -+ }; -+ -+ static uint32_t get_vc_address(AVBufferRef *bref) { -+@@ -2027,16 +2027,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- *u++ = rpi_filter_coefs[_mx][1]; -++ u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- *u++ = rpi_filter_coefs[_my][1]; -++ u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2084,16 +2084,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- *u++ = rpi_filter_coefs[_mx][1]; -++ u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- *u++ = rpi_filter_coefs[_my][1]; -++ u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2148,29 +2148,29 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx2][0]; -+- *u++ = rpi_filter_coefs[_mx2][1]; -++ u++; -+ *u++ = rpi_filter_coefs[_my2][0]; -+- *u++ = rpi_filter_coefs[_my2][1]; -++ u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 77cca46..c8d0728 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -116,8 +116,8 @@ unsigned int rpi_shader[] = { -+ /* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+ /* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+ /* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+ /* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+ /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+@@ -128,338 +128,315 @@ unsigned int rpi_shader[] = { -+ /* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ /* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ /* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 6562fa9..1bf7a68 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 370) -+-#define mc_filter_uv_b (rpi_shader + 584) -+-#define mc_exit (rpi_shader + 812) -+-#define mc_interrupt_exit8 (rpi_shader + 830) -+-#define mc_end (rpi_shader + 860) -++#define mc_filter_uv_b0 (rpi_shader + 324) -++#define mc_filter_uv_b (rpi_shader + 538) -++#define mc_exit (rpi_shader + 766) -++#define mc_interrupt_exit8 (rpi_shader + 784) -++#define mc_end (rpi_shader + 814) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 562dc35..8e4f18f 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -16,8 +16,8 @@ -+ # ra19 next ra17 -+ # -+ # rb16 pitch -+-# rb17 height + 5 -+-# rb18 height + 7 -++# rb17 height + 1 -++# rb18 height + 3 -+ # rb19 next ra16 -+ # -+ # ra20 1 -+@@ -214,8 +214,8 @@ mov r0, unif -+ shr r1, r0, r2 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -++add rb17, r0, 1 -++add rb18, r0, 3 -+ shl r0, r0, 7 -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+@@ -230,18 +230,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -++ mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -283,26 +276,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+ mov ra12, ra13 -+ mov ra13, ra14 -+ -+-sub.setf -, r3, 8 ; mov r1, ra22 -++sub.setf -, r3, 4 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop -+@@ -312,14 +293,10 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb14 -+-nop ; mul24 r0, ra13, rb13 -+-add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb15 -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 -+-- -+2.7.4 -+ -+ -+From e4bdd110d4640519b751ab428e7976a1e9a15802 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:03:51 +0100 -+Subject: [PATCH 28/68] Optimised B0 pass -+ -+--- -+ libavcodec/rpi_shader.c | 424 +++++++++++++++++++++------------------------ -+ libavcodec/rpi_shader.h | 8 +- -+ libavcodec/rpi_shader.qasm | 43 +---- -+ 3 files changed, 212 insertions(+), 263 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index c8d0728..1f63ee0 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -204,239 +204,215 @@ unsigned int rpi_shader[] = { -+ /* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+ /* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+ /* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+ /* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+ /* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 1bf7a68..cb74887 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+ #define mc_filter_uv_b0 (rpi_shader + 324) -+-#define mc_filter_uv_b (rpi_shader + 538) -+-#define mc_exit (rpi_shader + 766) -+-#define mc_interrupt_exit8 (rpi_shader + 784) -+-#define mc_end (rpi_shader + 814) -++#define mc_filter_uv_b (rpi_shader + 490) -++#define mc_exit (rpi_shader + 718) -++#define mc_interrupt_exit8 (rpi_shader + 736) -++#define mc_end (rpi_shader + 766) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 8e4f18f..faa5755 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -357,15 +357,13 @@ mov r0, unif -+ shr r1, r0, r2 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -++add rb17, r0, 1 -++add rb18, r0, 3 -+ shl r0, r0, 7 -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -+ -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -373,18 +371,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -++ mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -426,26 +417,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+ mov ra12, ra13 -+ mov ra13, ra14 -+ -+-sub.setf -, r3, 8 ; mov r1, ra22 -++sub.setf -, r3, 4 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b0 -+@@ -455,18 +434,12 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb14 -+-nop ; mul24 r0, ra13, rb13 -+-add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb15 -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-#asr r1, r1, 14 -+-#add r1, r1, ra21 -+ brr.anyn -, r:uvloop_b0 -+ asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -+ nop # Delay 2 -+-- -+2.7.4 -+ -+ -+From 93805e78a13d36e28ed84a0e8456da2eac45be89 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:12:43 +0100 -+Subject: [PATCH 29/68] Optimised B pass -+ -+--- -+ libavcodec/rpi_shader.c | 202 ++++++++++++++++++++------------------------- -+ libavcodec/rpi_shader.h | 6 +- -+ libavcodec/rpi_shader.qasm | 41 ++------- -+ 3 files changed, 100 insertions(+), 149 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 1f63ee0..4e6c5ea 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -289,8 +289,8 @@ unsigned int rpi_shader[] = { -+ /* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+ /* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+ /* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+ /* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+ /* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+ /* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+@@ -299,120 +299,96 @@ unsigned int rpi_shader[] = { -+ /* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+ /* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index cb74887..53da629 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -7,8 +7,8 @@ extern unsigned int rpi_shader[]; -+ #define mc_filter_uv (rpi_shader + 152) -+ #define mc_filter_uv_b0 (rpi_shader + 324) -+ #define mc_filter_uv_b (rpi_shader + 490) -+-#define mc_exit (rpi_shader + 718) -+-#define mc_interrupt_exit8 (rpi_shader + 736) -+-#define mc_end (rpi_shader + 766) -++#define mc_exit (rpi_shader + 670) -++#define mc_interrupt_exit8 (rpi_shader + 688) -++#define mc_end (rpi_shader + 718) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index faa5755..f38c926 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -491,8 +491,8 @@ mov r0, unif -+ shr r1, r0, r2 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -++add rb17, r0, 1 -++add rb18, r0, 3 -+ shl r0, r0, 7 -+ -+ # r0 is currently height<<7 -+@@ -508,8 +508,6 @@ add rb26, r0, rb27 -+ # In a B frame, so also set up VPM read (reading back 16bit precision) -+ add vr_setup, r3, rb21 -+ -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -517,18 +515,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -++ mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -570,26 +561,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+ mov ra12, ra13 -+ mov ra13, ra14 -+ -+-sub.setf -, r3, 8 ; mov r1, ra22 -++sub.setf -, r3, 4 ; mov r1, ra22 -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b -+ mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+@@ -598,14 +577,10 @@ nop ; nop # TODO improve use of delay slots -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb14 -+-nop ; mul24 r0, ra13, rb13 -+-add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb15 -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 # shift2=6 -+-- -+2.7.4 -+ -+ -+From e48df43c16de74dddbc7c702d64dd01eaf8e6b39 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:17:09 +0100 -+Subject: [PATCH 30/68] Used P delay slots more efficiently -+ -+--- -+ libavcodec/rpi_shader.c | 437 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 10 +- -+ libavcodec/rpi_shader.qasm | 19 +- -+ 3 files changed, 228 insertions(+), 238 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 4e6c5ea..a1af4e3 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -156,239 +156,236 @@ unsigned int rpi_shader[] = { -+ /* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ /* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ /* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+ /* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 53da629..1fb3e37 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 324) -+-#define mc_filter_uv_b (rpi_shader + 490) -+-#define mc_exit (rpi_shader + 670) -+-#define mc_interrupt_exit8 (rpi_shader + 688) -+-#define mc_end (rpi_shader + 718) -++#define mc_filter_uv_b0 (rpi_shader + 318) -++#define mc_filter_uv_b (rpi_shader + 484) -++#define mc_exit (rpi_shader + 664) -++#define mc_interrupt_exit8 (rpi_shader + 682) -++#define mc_end (rpi_shader + 712) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index f38c926..02e95dd 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -268,6 +268,7 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -++# apply horizontal filter -+ nop ; mul24 r2, r0, ra0 -+ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ nop ; mul24 r3, ra1 << 1, r0 << 1 -+@@ -276,20 +277,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 4 ; mov r1, ra22 -+- -+-# apply horizontal filter -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 4 ; mov ra12, ra13 -+ brr.anyn -, r:uvloop -+-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+-asr ra15, r0, 8 ; nop -+-nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+-- -+2.7.4 -+ -+ -+From b33dfc243ff5509299685add3c532ab7f207fd73 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:22:25 +0100 -+Subject: [PATCH 31/68] Improved use of delay slots -+ -+--- -+ libavcodec/rpi_shader.c | 503 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 10 +- -+ libavcodec/rpi_shader.qasm | 41 ++-- -+ 3 files changed, 265 insertions(+), 289 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index a1af4e3..c498f28 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -122,270 +122,263 @@ unsigned int rpi_shader[] = { -+ /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit8 -++/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit8 -+-/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 1fb3e37..3fac45f 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 318) -+-#define mc_filter_uv_b (rpi_shader + 484) -+-#define mc_exit (rpi_shader + 664) -+-#define mc_interrupt_exit8 (rpi_shader + 682) -+-#define mc_end (rpi_shader + 712) -++#define mc_filter_uv_b0 (rpi_shader + 316) -++#define mc_filter_uv_b (rpi_shader + 476) -++#define mc_exit (rpi_shader + 650) -++#define mc_interrupt_exit8 (rpi_shader + 668) -++#define mc_end (rpi_shader + 698) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 02e95dd..10f5113 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -221,8 +221,6 @@ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -+ -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -410,20 +408,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 4 ; mov r1, ra22 -+- -+-# apply horizontal filter -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 4 ; mov ra12, ra13 -+ brr.anyn -, r:uvloop_b0 -+-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+-asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? -+-nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+@@ -432,9 +422,9 @@ nop ; mul24 r0, ra13, rb9 -+ add r1, r1, r0 ; mul24 r0, ra12, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++sub.setf -, r3, rb18 -+ brr.anyn -, r:uvloop_b0 -+-asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -++asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision -+ nop # Delay 2 -+ nop # Delay 3 -+ -+@@ -554,19 +544,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 4 ; mov r1, ra22 -+-# apply horizontal filter -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 4 ; mov ra12, ra13 -+ brr.anyn -, r:uvloop_b -+-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr ra15, r0, 8 ; nop -+-nop ; nop # TODO improve use of delay slots -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+-- -+2.7.4 -+ -+ -+From af59f8e00eb977e97debc5e72ba47e0077db1787 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:31:23 +0100 -+Subject: [PATCH 32/68] Avoid writeback of first B results -+ -+--- -+ libavcodec/rpi_shader.c | 229 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 8 +- -+ libavcodec/rpi_shader.qasm | 18 +--- -+ 3 files changed, 121 insertions(+), 134 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index c498f28..ba453a2 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -255,130 +255,125 @@ unsigned int rpi_shader[] = { -+ /* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+ /* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -+ /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+ /* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 3fac45f..45dbe0e 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+ #define mc_filter_uv_b0 (rpi_shader + 316) -+-#define mc_filter_uv_b (rpi_shader + 476) -+-#define mc_exit (rpi_shader + 650) -+-#define mc_interrupt_exit8 (rpi_shader + 668) -+-#define mc_end (rpi_shader + 698) -++#define mc_filter_uv_b (rpi_shader + 466) -++#define mc_exit (rpi_shader + 640) -++#define mc_interrupt_exit8 (rpi_shader + 658) -++#define mc_end (rpi_shader + 688) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 10f5113..e138c95 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -428,22 +428,14 @@ asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still -+ nop # Delay 2 -+ nop # Delay 3 -+ -++# in pass0 we don't really need to save any results, but need to discard the uniforms -+ # DMA out for U -+ -+-mov vw_setup, rb26 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results -+- -+-# DMA out for V -+-# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+-# Could potentially push this write into the start of the next pipeline stage. -+-mov r0, 16 -+-mov -, vw_wait -+- -+ bra -, ra31 -+-add vw_setup, rb26, r0 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -++mov r0, unif # Delay 1 -++mov r0, unif # Delay 2 -++nop # Delay 3 -++ -+ -+ ################################################################################ -+ -+-- -+2.7.4 -+ -+ -+From 12e57278cb19a769d2e1488e8e94003027493d09 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:36:24 +0100 -+Subject: [PATCH 33/68] Cutdown size of chroma prediction commands -+ -+--- -+ libavcodec/hevc.c | 17 +- -+ libavcodec/rpi_shader.c | 543 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 12 +- -+ libavcodec/rpi_shader.qasm | 11 +- -+ 4 files changed, 281 insertions(+), 302 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index a47ebc5..32b89d5 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -56,7 +56,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ #ifdef RPI_INTER_QPU -+ -+-#define RPI_CHROMA_COMMAND_WORDS 12 -++#define RPI_CHROMA_COMMAND_WORDS 10 -+ #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+@@ -2032,11 +2032,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2091,9 +2088,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2154,11 +2149,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ u+=2; // Intermediate results are not written back in first pass of B filtering -+ -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -+@@ -2166,11 +2158,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx2][0]; -+- u++; -+ *u++ = rpi_filter_coefs[_my2][0]; -+- u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2808,7 +2797,7 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -+- s->u_mvs[i] += 3; // Padding words -++ s->u_mvs[i] += 1; // Padding words -+ } -+ } -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index ba453a2..b0b93b5 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -89,291 +89,286 @@ unsigned int rpi_shader[] = { -+ /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+ /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+ /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -++/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 45dbe0e..99927c4 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 316) -+-#define mc_filter_uv_b (rpi_shader + 466) -+-#define mc_exit (rpi_shader + 640) -+-#define mc_interrupt_exit8 (rpi_shader + 658) -+-#define mc_end (rpi_shader + 688) -++#define mc_filter_uv (rpi_shader + 148) -++#define mc_filter_uv_b0 (rpi_shader + 310) -++#define mc_filter_uv_b (rpi_shader + 458) -++#define mc_exit (rpi_shader + 630) -++#define mc_interrupt_exit8 (rpi_shader + 648) -++#define mc_end (rpi_shader + 678) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index e138c95..d9ffcda 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -167,8 +167,6 @@ add t0s, r2, r1 -+ -+ # Dump padding words -+ mov r0, unif -+-mov r0, unif -+-mov r0, unif -+ -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+@@ -228,11 +226,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+- mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -++asr rb8, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -362,11 +359,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+- mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -++asr rb8, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -490,11 +486,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+- mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -++asr rb8, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+-- -+2.7.4 -+ -+ -+From 3e8f02cf9d3e4bfcd07a5fcf321ace07c4f2e6f3 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:21:49 +0100 -+Subject: [PATCH 34/68] hevc: don't redirect when not rpi_enabled -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 32b89d5..2459e34 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -1468,7 +1468,7 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) -+ */ -+ -+ #ifdef RPI_INTER -+-#define RPI_REDIRECT(fn) rpi_ ## fn -++#define RPI_REDIRECT(fn) (s->enable_rpi ? rpi_ ## fn : fn) -+ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+-- -+2.7.4 -+ -+ -+From 6da455b382b28c3c1f4e98c1703a695cdb946ad3 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:22:02 +0100 -+Subject: [PATCH 35/68] Use /dev/vcio for mailbox access -+ -+--- -+ libavcodec/rpi_mailbox.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -+index 536896f..77a56dd 100644 -+--- a/libavcodec/rpi_mailbox.c -++++ b/libavcodec/rpi_mailbox.c -+@@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+ #define MAJOR_NUM 100 -+ #define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) -+-#define DEVICE_FILE_NAME "/dev/char_dev" -++#define DEVICE_FILE_NAME "/dev/vcio" -+ -+ #include "rpi_mailbox.h" -+ -+-- -+2.7.4 -+ -+ -+From f96ef6131f16a4c03b8e2882bdf7319c3b646a6c Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:25:25 +0100 -+Subject: [PATCH 36/68] Use vcsm for all memory allocations -+ -+--- -+ libavcodec/rpi_qpu.c | 174 +++++++++++++++++++-------------------------------- -+ 1 file changed, 64 insertions(+), 110 deletions(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 60bf079..f62051f 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -1,7 +1,5 @@ -+ #ifdef RPI -+-// define RPI_USE_VCSM to use the vcsm device for shared memory -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+-#define RPI_USE_VCSM -+ // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+ #define RPI_TIME_TOTAL_QPU -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+@@ -25,9 +23,7 @@ -+ #include "rpi_shader.h" -+ #include "rpi_hevc_transform.h" -+ -+-#ifdef RPI_USE_VCSM -+ #include "rpi_user_vcsm.h" -+-#endif -+ -+ // On Pi2 there is no way to access the VPU L2 cache -+ // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -+@@ -96,7 +92,6 @@ struct GPU -+ unsigned int vpu_code[VPU_CODE_SIZE]; -+ short transMatrix2even[16*16*2]; -+ int open_count; // Number of allocated video buffers -+- unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+ int vc; // Address in GPU memory -+ int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -+@@ -105,6 +100,7 @@ struct GPU -+ // Stop more than one thread trying to allocate memory or use the processing resources at once -+ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+ static volatile struct GPU* gpu = NULL; -++static GPU_MEM_PTR_T gpu_mem_ptr; -+ -+ #if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -+ static unsigned int Microseconds(void) { -+@@ -132,39 +128,27 @@ static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+ static volatile int vpu_async_head=0; -+ #endif -+ -++static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb); -++static void gpu_free_internal(GPU_MEM_PTR_T *p); -++ -+ // Connect to QPU, returns 0 on success. -+ static int gpu_init(volatile struct GPU **gpu) { -+ int mb = mbox_open(); -+ int vc; -+- int handle; -+ volatile struct GPU* ptr; -+ if (mb < 0) -+ return -1; -+ -+ if (qpu_enable(mb, 1)) return -2; -+ -+-#ifdef RPI_USE_VCSM -+ vcsm_init(); -+-#endif -++ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -++ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -++ memset(ptr, 0, sizeof *ptr); -++ vc = gpu_mem_ptr.vc; -+ -+- handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); -+- if (!handle) -+- { -+- qpu_enable(mb, 0); -+- return -3; -+- } -+- vc = mem_lock(mb, handle); -+- ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); -+- if (ptr == NULL) -+- { mem_free(mb, handle); -+- mem_unlock(mb, handle); -+- qpu_enable(mb, 0); -+- return -4; -+- } -+- -+- ptr->mb = mb; -+- ptr->vc_handle = handle; -+- ptr->vc = vc; -++ ptr->mb = mb; -++ ptr->vc = vc; -+ -+ printf("GPU allocated at 0x%x\n",vc); -+ -+@@ -226,94 +210,74 @@ static void gpu_unlock(void) { -+ pthread_mutex_unlock(&gpu_mutex); -+ } -+ -++static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -++ assert(p->vcsm_handle); -++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -++ assert(p->vc_handle); -++ p->arm = vcsm_lock(p->vcsm_handle); -++ assert(p->arm); -++ p->vc = mem_lock(mb, p->vc_handle); -++ assert(p->vc); -++ return 0; -++} -++ -+ // Allocate memory on GPU -+ // Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes -+ // Returns 0 on success. -+ // This allocates memory that will not be cached in ARM's data cache. -+ // Therefore safe to use without data cache flushing. -+-int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { -++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -++{ -++ int r; -+ gpu_lock(); -+- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -+- p->vcsm_handle = 0; -+- if (!p->vc_handle) -+- { -+- qpu_enable(gpu->mb, 0); -+- return -3; -+- } -+- p->vc = mem_lock(gpu->mb, p->vc_handle); -+- p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -+- p->numbytes = numbytes; -+- if (p->arm == NULL) -+- { -+- mem_free(gpu->mb, p->vc_handle); -+- mem_unlock(gpu->mb, p->vc_handle); -+- gpu_unlock(); -+- qpu_enable(gpu->mb, 0); -+- return -4; -+- } -++ r = gpu_malloc_uncached_internal(numbytes, p, gpu->mb); -+ gpu->open_count++; -+ gpu_unlock(); -+- return 0; -++ return r; -+ } -+ -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+- // This only works when using RPI_USE_VCSM -+ void *tmp = vcsm_lock(p->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+ } -+ -++static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); -++ assert(p->vcsm_handle); -++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -++ assert(p->vc_handle); -++ p->arm = vcsm_lock(p->vcsm_handle); -++ assert(p->arm); -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ assert(p->vc); -++ return 0; -++} -++ -+ // This allocates data that will be -+ // Cached in ARM L2 -+ // Uncached in VPU L2 -+-int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) -++{ -++ int r; -+ gpu_lock(); -+-#ifdef RPI_USE_VCSM -+- { -+- p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? -+- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works -+- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up -+- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) -+- p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+- p->arm = vcsm_lock(p->vcsm_handle); -+- p->vc = mem_lock(gpu->mb, p->vc_handle); -+- } -+-#else -+- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -+- p->vcsm_handle = 0; -+- if (!p->handle) -+- { -+- qpu_enable(gpu->mb, 0); -+- return -3; -+- } -+- p->vc = mem_lock(gpu->mb, p->vc_handle); -+- printf("This mapmem_private does not seem to work\n"); -+- exit(-1); -+- p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -+- p->numbytes = numbytes; -+- if (p->arm == NULL) -+- { -+- mem_free(gpu->mb, p->handle); -+- mem_unlock(gpu->mb, p->handle); -+- gpu_unlock(); -+- qpu_enable(gpu->mb, 0); -+- return -4; -+- } -+-#endif -++ r = gpu_malloc_cached_internal(numbytes, p); -+ gpu->open_count++; -+ gpu_unlock(); -+- return 0; -++ return r; -+ } -+ -+ static void gpu_term(void) -+ { -+- int mb; -+- unsigned handle; -++ int mb; -+ -+ if (gpu==NULL) -+ return; -+ mb = gpu->mb; -+- handle = gpu->vc_handle; -+ -+ #ifdef RPI_ASYNC -+ { -+@@ -323,37 +287,26 @@ static void gpu_term(void) -+ } -+ #endif -+ -++ qpu_enable(mb, 0); -++ gpu_free_internal(&gpu_mem_ptr); -+ -+- unmapmem((void*)gpu, sizeof(struct GPU)); -+- mem_unlock(mb, handle); -+- mem_free(mb, handle); -+- qpu_enable(mb, 0); -+-#ifdef RPI_USE_VCSM -+ vcsm_exit(); -+-#endif -+- mbox_close(mb); -++ -++ mbox_close(mb); -+ gpu = NULL; -+ } -+ -+-void gpu_free(GPU_MEM_PTR_T *p) { -++void gpu_free_internal(GPU_MEM_PTR_T *p) { -+ int mb = gpu->mb; -+- unsigned handle = p->vc_handle; -++ mem_unlock(mb,p->vc_handle); -++ vcsm_unlock_ptr(p->arm); -++ vcsm_free(p->vcsm_handle); -++} -++ -++void gpu_free(GPU_MEM_PTR_T *p) { -+ gpu_lock(); -+-#ifdef RPI_USE_VCSM -+- if (p->vcsm_handle) { -+- mem_unlock(mb,p->vc_handle); -+- vcsm_unlock_ptr(p->arm); -+- vcsm_free(p->vcsm_handle); -+- } else { -+- unmapmem((void*)p->arm, sizeof(struct GPU)); -+- mem_unlock(mb, handle); -+- mem_free(mb, handle); -+- } -+-#else -+- unmapmem((void*)p->arm, sizeof(struct GPU)); -+- mem_unlock(mb, handle); -+- mem_free(mb, handle); -+-#endif -++ -++ gpu_free_internal(p); -+ -+ gpu->open_count--; -+ if (gpu->open_count==0) { -+@@ -386,20 +339,21 @@ unsigned int vpu_get_constants(void) { -+ -+ static void *vpu_start(void *arg) { -+ while(1) { -++ int *p; -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -+ pthread_cond_wait(&post_cond_tail, &post_mutex); -+ } -+- int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -++ p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ pthread_mutex_unlock(&post_mutex); -+ -+ if (p[6] == -1) { -+ break; // Last job -+ } -+ if (p[7]) { -+- GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -++ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+ } -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+-- -+2.7.4 -+ -+ -+From 7c94b833b48a455d27d82eb2ca1b53a162705caf Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:43:17 +0100 -+Subject: [PATCH 37/68] Enable EARLY_MALLOC and fix sps access bug -+ -+--- -+ libavcodec/hevc.c | 5 +++-- -+ 1 file changed, 3 insertions(+), 2 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 2459e34..4e82a15 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -44,7 +44,7 @@ -+ #ifdef RPI -+ #include "rpi_qpu.h" -+ // For some unknown reason, the code seems to crash if I do a late malloc -+- #define EARLY_MALLOC -++ //#define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -+ #endif -+@@ -149,7 +149,8 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ #ifdef RPI -+ #ifdef EARLY_MALLOC -+ #else -+- int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); -++ assert(sps); -++ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+ printf("pic_arrays_init\n"); -+ printf("Allocated %d\n",coefs_per_row); -+-- -+2.7.4 -+ -+ -+From 0a0a92817a7959d213dca9c75a242b6ad88d6b80 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 16:40:51 +0100 -+Subject: [PATCH 38/68] Add copy of av_mod_uintp2 for use with stable ffmpeg -+ -+--- -+ libavcodec/hevc.c | 8 ++++++++ -+ 1 file changed, 8 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 4e82a15..80db603 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -51,6 +51,14 @@ -+ -+ // #define DISABLE_MC -+ -++#ifndef av_mod_uintp2 -++static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) -++{ -++ return a & ((1 << p) - 1); -++} -++# define av_mod_uintp2 av_mod_uintp2_c -++#endif -++ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -+ -+-- -+2.7.4 -+ -+ -+From c48d08e968b24c2e260b0cc76c7901a1b4d75bbf Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 18 May 2015 11:11:02 +0100 -+Subject: [PATCH 39/68] Added support for weighted prediction in P frames -+ -+--- -+ libavcodec/hevc.c | 52 ++++- -+ libavcodec/rpi_shader.c | 566 +++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 12 +- -+ libavcodec/rpi_shader.qasm | 39 +++- -+ 4 files changed, 384 insertions(+), 285 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 80db603..9668ef8 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -64,7 +64,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ #ifdef RPI_INTER_QPU -+ -+-#define RPI_CHROMA_COMMAND_WORDS 10 -++#define RPI_CHROMA_COMMAND_WORDS 12 -+ #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+@@ -2031,6 +2031,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ int chan = x0>>8; -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+@@ -2043,6 +2045,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_csh.chroma_offset_l0[current_mv.ref_idx[0]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1] & 0xffff); -++ } else { -++ *u++ = 1; // Weight of 1 and offset of 0 -++ *u++ = 1; -++ } -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2085,6 +2094,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ int chan = x0>>8; -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+@@ -2098,6 +2109,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_my][0]; -++ if (weight_flag) { -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); -++ } else { -++ *u++ = 1; // Weight of 1 and offset of 0 -++ *u++ = 1; -++ } -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2159,6 +2177,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_cmc_filter_uv_b; -+@@ -2169,6 +2188,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2795,6 +2815,9 @@ static void rpi_inter_clear(HEVCContext *s) -+ int i; -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -++ -+ for(i=0;i<8;i++) { -+ s->u_mvs[i] = s->mvs_base[i]; -+ *s->u_mvs[i]++ = 0; -+@@ -2806,6 +2829,13 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -++ if (weight_flag) { -++ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -++ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -++ } else { -++ *s->u_mvs[i]++ = 1 << 5; -++ *s->u_mvs[i]++ = 6; -++ } -+ s->u_mvs[i] += 1; // Padding words -+ } -+ } -+@@ -2849,12 +2879,29 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -++#ifdef RPI_INTER_QPU -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+ && s->ps.sps->width <= RPI_MAX_WIDTH -+ && !s->ps.pps->cross_component_prediction_enabled_flag -+ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -+- && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -+ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -++#else -++ s->enable_rpi = s->ps.sps->bit_depth == 8 -++ && s->ps.sps->width <= RPI_MAX_WIDTH -++ && !s->ps.pps->cross_component_prediction_enabled_flag -++ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -++#endif -++ -++ /*if (!s->enable_rpi) { -++ if (s->ps.pps->cross_component_prediction_enabled_flag) -++ printf("Cross component\n"); -++ if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -++ printf("Tiles\n"); -++ if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -++ printf("Weighted P slice\n"); -++ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -++ printf("Weighted B slice\n"); -++ }*/ -+ -+ #endif -+ -+@@ -2987,6 +3034,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int -+ -+ #ifdef RPI -+ s->enable_rpi = 0; -++ //printf("Wavefront\n"); -+ #endif -+ -+ if(ctb_row) { -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index b0b93b5..3f04d80 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -88,287 +88,307 @@ unsigned int rpi_shader[] = { -+ /* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+ /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -++/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 -++/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 -++/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 -++/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 -++/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 99927c4..cec9901 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 148) -+-#define mc_filter_uv_b0 (rpi_shader + 310) -+-#define mc_filter_uv_b (rpi_shader + 458) -+-#define mc_exit (rpi_shader + 630) -+-#define mc_interrupt_exit8 (rpi_shader + 648) -+-#define mc_end (rpi_shader + 678) -++#define mc_filter_uv (rpi_shader + 152) -++#define mc_filter_uv_b0 (rpi_shader + 342) -++#define mc_filter_uv_b (rpi_shader + 494) -++#define mc_exit (rpi_shader + 670) -++#define mc_interrupt_exit8 (rpi_shader + 688) -++#define mc_end (rpi_shader + 718) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index d9ffcda..97c4c02 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -9,7 +9,12 @@ -+ # (ra15 isn't clamped to zero - this happens during the -+ # copy to ra14, and during its use in the vertical filter) -+ # -+-# rb8...rb15 eight vertical filter coefficients -++# rb8...rb11 eight vertical filter coefficients -++ -++# rb12 offset to add before shift -++# rb13 shift -++# rb14 weight (U on left, V on right) -++# rb15 offset (U on left, V on right) -+ # -+ # ra16 clipped(row start address+elem_num)&~3 -+ # ra17 per-channel shifts -+@@ -165,6 +170,9 @@ add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ add t0s, r0, r1 ; mov ra_x2_base, r2 -+ add t0s, r2, r1 -+ -++mov rb12,unif # offset before shift -++mov rb13,unif # offset after shift -++ -+ # Dump padding words -+ mov r0, unif -+ -+@@ -231,11 +239,21 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23 -+ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r0, unif # U offset/weight -++asr rb15, r0, r2 # Compute offset from MSBs -++shl r0, r0, r2 -++asr rb14, r0, r2 # Compute weight from LSBs -++mov r0, unif # V offset/weight -++asr.ifnz rb15, r0, r2 -++shl r0, r0, r2 -++asr.ifnz rb14, r0, r2 -++ -+ # r2 is elem_num -+ # r3 is loop counter -+ -+ mov r5rep, -8 -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+@@ -279,6 +297,11 @@ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -++mov rb12,32 -++mov rb13,6 -++mov rb14,1 -++mov rb15,0 -++ -+ # apply vertical filter and write to VPM -+ -+ nop ; mul24 r1, ra14, rb10 -+@@ -288,9 +311,11 @@ add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 -+-add r1, r1, ra21 -++nop ; mul24 r1, r1, rb14 -++add r1, r1, rb12 -++asr r1, r1, rb13 -+ brr.anyn -, r:uvloop -+-asr r1, r1, 6 # Delay 1 -++add r1, r1, rb15 # Delay 1 -+ min r1, r1, rb22 # Delay 2 -+ max vpm, r1, 0 # Delay 3 -+ -+@@ -364,6 +389,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23 -+ -++mov r0, unif # U offset/weight -++mov r0, unif # V offset/weight -++ -+ # r2 is elem_num -+ # r3 is loop counter -+ -+@@ -491,6 +519,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23 -+ -++mov r0, unif # U offset/weight -++mov r0, unif # V offset/weight -++ -+ # r2 is elem_num -+ # r3 is loop counter -+ -+-- -+2.7.4 -+ -+ -+From 310d994ea39e29b41a6a013abc4d94e6b90487b2 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 19 May 2015 08:43:30 +0100 -+Subject: [PATCH 40/68] Improved ordering of tasks -+ -+--- -+ libavcodec/hevc.c | 8 ++++---- -+ 1 file changed, 4 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 9668ef8..951e2d3 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2943,15 +2943,15 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+-#ifdef RPI_INTER_QPU -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+-#endif -+ // Transform all blocks -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -++#ifdef RPI_INTER_QPU -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++#endif -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+-- -+2.7.4 -+ -+ -+From d6e1ce7898196e49e52a6223c12979b3d0014588 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 20 May 2015 19:58:19 +0100 -+Subject: [PATCH 41/68] Drafted Luma inter prediction -+ -+--- -+ libavcodec/rpi_shader.qasm | 594 ++++++++++++++++++++++++++++++++++++++++++--- -+ 1 file changed, 554 insertions(+), 40 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 97c4c02..9cfc0d9 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -2,7 +2,10 @@ -+ # -+ # ra0...ra7 eight horizontal filter coefficients -+ # -+-# rb1...rb7 seven shifted copies of the current unfiltered row -++# rb0 rx_shift2 -++# rb1 ra_y2_next -++# -++# rb4...rb7 -+ # -+ # ra8...ra15 eight filtered rows of context (rb15 == most recent) -+ # -+@@ -26,9 +29,9 @@ -+ # rb19 next ra16 -+ # -+ # ra20 1 -+-# ra21 32 -++# ra21 ra_21 -+ # ra22 256 -+-# ra23 8 -++# ra23 rx_shift2_next -+ # -+ # rb20 0xffffff00 -+ # rb21 vpm_setup for reading/writing 16bit results into VPM -+@@ -57,16 +60,23 @@ -+ .set rb_frame_width_minus_1, rb25 -+ .set rb_frame_height_minus_1, rb30 -+ .set rb_pitch, rb16 -+-.set ra_x_base, ra16 -+-.set rb_x_base_next, rb19 -+-.set ra_x2_base, ra24 -+-.set ra_x2_base_next, ra26 -++.set ra_x, ra16 -++.set ra_y2, ra21 -++.set ra_y2_next, rb1 -++ -++.set rb_x_next, rb19 -++.set rx_frame_base2_next, rb19 -++ -++.set ra_frame_base, ra24 -++.set ra_frame_base_next, ra26 -+ .set ra_xshift, ra17 -+ -+-.set ra_x2shift, ra25 -+ .set ra_u2v_ref_offset, ra25 -++.set ra_frame_base2, ra25 -+ -+ .set ra_xshift_next, ra19 -++.set rx_xshift2, rb0 -++.set rx_xshift2_next, ra23 -+ -+ .set ra_x2shift_next, ra27 -+ .set ra_u2v_dst_offset, ra27 -+@@ -83,11 +93,11 @@ -+ mov ra31, unif -+ -+ # Load first request location -+-add ra_x_base, unif, elem_num # Store x -++add ra_x, unif, elem_num # Store x -+ mov ra_y, unif # Store y -+-mov ra_x2_base, unif # Store frame u base -++mov ra_frame_base, unif # Store frame u base -+ nop -+-sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -++sub ra_u2v_ref_offset, unif, ra_frame_base # Store offset to add to move from u to v in reference frame -+ -+ # Read image dimensions -+ sub rb25,unif,1 -+@@ -104,9 +114,7 @@ add rb24, r1, r0 -+ # load constants -+ -+ mov ra20, 1 -+-mov ra21, 32 -+ mov ra22, 256 -+-mov ra23, 8 -+ mov ra30, 64 -+ -+ mov rb20, 0xffffff00 -+@@ -156,18 +164,18 @@ mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which i -+ add rb21, r0, r1 -+ -+ # Compute base address for first and second access -+-mov r0, ra_x_base # Load x -++mov r0, ra_x # Load x -+ max r0, r0, 0; mov r1, ra_y # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base # Load the frame base -+ shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+ add ra_y, r1, 1 -+ add r0, r0, r3 -+ and r0, r0, ~3 -+-max r1, r1, 0 ; mov ra_x_base, r0 # y -++max r1, r1, 0 ; mov ra_x, r0 # y -+ min r1, r1, rb_frame_height_minus_1 -+ # submit texture requests for first line -+ add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-add t0s, r0, r1 ; mov ra_x2_base, r2 -++add t0s, r0, r1 ; mov ra_frame_base, r2 -+ add t0s, r2, r1 -+ -+ mov rb12,unif # offset before shift -+@@ -182,8 +190,8 @@ min r1, r1, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 -+ bra -, ra31 -+ nop ; mul24 r1, r1, rb_pitch -+-add t0s, r1, ra_x_base -+-add t0s, r1, ra_x2_base -++add t0s, r1, ra_x -++add t0s, r1, ra_frame_base -+ -+ -+ -+@@ -192,7 +200,7 @@ add t0s, r1, ra_x2_base -+ # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+ -+ # At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -++# ra_x, ra_x16_base point to the current coordinates for this block -+ ::mc_filter_uv -+ mov ra31, unif -+ -+@@ -207,9 +215,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+ sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -++and rb_x_next, r0, ~3 -+ mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -++add ra_frame_base_next, rb_x_next, r2 -+ -+ # set up VPM write -+ mov vw_setup, rb28 -+@@ -265,16 +273,16 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -297,7 +305,7 @@ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -+-mov rb12,32 -++mov rb12,32 # TODO remove these to make P weighted prediction work properly -+ mov rb13,6 -+ mov rb14,1 -+ mov rb15,0 -+@@ -342,7 +350,7 @@ mov vw_addr, unif # start the VDW -+ # mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+ -+ # At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -++# ra_x, ra_x16_base point to the current coordinates for this block -+ ::mc_filter_uv_b0 -+ mov ra31, unif -+ -+@@ -357,9 +365,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+ sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -++and rb_x_next, r0, ~3 -+ mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -++add ra_frame_base_next, rb_x_next, r2 -+ -+ # set up VPM write, we need to save 16bit precision -+ mov vw_setup, rb21 -+@@ -408,16 +416,16 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -477,9 +485,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+ sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -++and rb_x_next, r0, ~3 -+ mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -++add ra_frame_base_next, rb_x_next, r2 -+ -+ # set up VPM write -+ mov vw_setup, rb28 -+@@ -538,16 +546,16 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -642,5 +650,511 @@ nop ; nop ; thrend -+ mov interrupt, 1; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -++ -++ -++ -++ -++# LUMA CODE -++ -++# The idea is to form B predictions by doing 8 pixels from ref0 in parallel with 8 pixels from ref1. -++# For P frames we make the second x,y coordinates offset by +8 -++ -++################################################################################ -++# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) -++::mc_setup -++ -++# Read starting kernel -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov ra31, unif -++ -++# Compute base address for first and second access -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl ra_xshift_next, r0, 3 # Compute shifts -++add ra_y, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add r2, r2, r0 # r2 is address for frame0 (not including y offset) -++max r1, r1, 0 -++min r1, r1, rb_frame_height_minus_1 -++nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++add t0s, r2, r1 ; mov ra_frame_base, r2 -++ -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl rx_xshift2_next, r0, 3 # Compute shifts -++add ra_y2, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add r2, r2, r0 # r2 is address for frame1 (not including y offset) -++max r1, r1, 0 -++min r1, r1, rb_frame_height_minus_1 -++nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++add t0s, r2, r1 ; mov ra_frame_base2, r2 -++ -++ -++# Read image dimensions -++sub rb25,unif,1 -++sub rb30,unif,1 -++ -++# get source pitch -++mov rb16, unif -++ -++# get destination pitch -++mov r0, unif -++mov r1, vdw_setup_1(0) -++add rb24, r1, r0 -++ -++# load constants -++ -++mov ra20, 1 -++mov ra22, 256 -++mov ra30, 64 -++ -++mov rb20, 0xffffff00 -++mov rb22, 255 -++mov rb23, 24 -++ -++# touch vertical context to keep simulator happy -++ -++mov ra8, 0 -++mov ra9, 0 -++mov ra10, 0 -++mov ra11, 0 -++mov ra12, 0 -++mov ra13, 0 -++mov ra14, 0 -++mov ra15, 0 -++ -++# Compute part of VPM to use for DMA output -++mov r2, qpu_num -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 -++ -++# Compute part of VPM to save data into -++mov r2, qpu_num # qpu_num = abcd -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -++add rb28, r0, r1 -++ -++mov rb12,unif # offset before shift -++mov rb13,unif # shift -++ -++# Dump padding words -++mov r0, unif -++ -++# submit texture requests for second line -++max r1, ra_y, 0 -++min r1, r1, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 -++nop ; mul24 r1, r1, rb_pitch -++add t0s, r1, ra_frame_base -++ -++max r1, ra_y2, 0 -++min r1, r1, rb_frame_height_minus_1 -++bra -, ra31 -++add ra_y2, ra_y2, 1 # Delay 1 -++nop ; mul24 r1, r1, rb_pitch # Delay 2 -++add t0s, r1, ra_frame_base2 # Delay 3 -++ -++ -++################################################################################ -++ -++# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -++# In a P block, only the first half of coefficients contain used information. -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x, ra_x16_base point to the current coordinates for this block -++::mc_filter -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov rx_xshift2, rx_xshift2_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl ra_xshift_next, r0, 3 # Compute shifts -++mov ra_y_next, r1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -++ -++add r0, unif, elem_num # Load x -++max r0, r0, 0 ; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl rx_xshift2_next, r0, 3 # Compute shifts -++add ra_y2_next, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -++ -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# get filter coefficients and discard unused B frame values -++mov r0, unif -++mov.ifnz -, unif # Alternate coefficients are unused for P frames -++asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++mov.ifnz -, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++mov.ifnz -, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++mov.ifnz -, unif -++asr rb7, r0, rb23; mul24 r0, r0, ra22 -++asr rb6, r0, rb23; mul24 r0, r0, ra22 -++asr rb5, r0, rb23; mul24 r0, r0, ra22 -++asr rb4, r0, rb23 -++ -++mov r0, unif # Frame0 offset/weight -++mov.ifnz -, unif # Frame1 offset/weight unused -++asr rb15, r0, r2 # Compute offset from MSBs -++shl r0, r0, r2 -++asr rb14, r0, r2 # Compute weight from LSBs -++ -++# r3 is loop counter -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:yloop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++# If we knew there was no clipping then this code would get simpler. -++# Perhaps we could add on the pitch and clip using larger values? -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, rx_xshift2 -++mov.ifz ra_y2, ra_y2_next -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y2, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# apply horizontal filter -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 8 ; mov ra12, ra13 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++brr.anyn -, r:yloop -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -++add r1, r1, r0 ; mul24 r0, ra8, rb4 -++add r1, r1, r0 ; mul24 r0, ra9, rb5 -++add r1, r1, r0 ; mul24 r0, ra10, rb6 -++add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++add r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 14 -++nop ; mul24 r1, r1, rb14 -++add r1, r1, rb12 -++asr r1, r1, rb13 -++brr.anyn -, r:yloop -++add r1, r1, rb15 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW setup 0 Delay 1 -++mov vw_setup, rb29 # Stride Delay 2 -++mov vw_addr, unif # start the VDW Delay 3 -++ -++ -++ -++################################################################################ -++ -++# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -++# In a P block, only the first half of coefficients contain used information. -++# At this point we have already issued two pairs of texture requests for the current block -++# May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) -++# Can fill in the coefficients so only -++# Can also assume default weighted prediction for B frames. -++# Perhaps can unpack coefficients in a more efficient manner by doing H/V for a and b at the same time? -++# Or possibly by taking advantage of symmetry? -++# From 19->7 32bits per command. -++::mc_filter_b -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov rx_xshift2, rx_xshift2_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl ra_xshift_next, r0, 3 # Compute shifts -++mov ra_y_next, r1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -++ -++add r0, unif, elem_num # Load x -++max r0, r0, 0 ; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl rx_xshift2_next, r0, 3 # Compute shifts -++add ra_y2_next, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -++ -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# get filter coefficients and discard unused B frame values -++mov r0, unif -++mov r1, 1 -++mov.ifnz r0, unif # Alternate coefficients are unused for P frames -++nop ; mul24 r0, r0 << 13, r1 << 13 -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 14, r1 << 14 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++mov.ifnz r0, unif -++nop ; mul24 r0, r0 << 9, r1 << 9 -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 10, r1 << 10 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 11, r1 << 11 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 12, r1 << 12 -++asr ra4, r0, rb23; mov r0, unif -++mov.ifnz r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++mov.ifnz r0, unif -++asr rb7, r0, rb23; mul24 r0, r0, ra22 -++asr rb6, r0, rb23; mul24 r0, r0, ra22 -++asr rb5, r0, rb23; mul24 r0, r0, ra22 -++asr rb4, r0, rb23 -++ -++mov r0, unif # Frame0 offset/weight -++mov.ifnz r0, unif # Frame1 offset/weight unused -++asr rb15, r0, r2 # Compute offset from MSBs -++shl r0, r0, r2 -++asr rb14, r0, r2 # Compute weight from LSBs -++ -++# r3 is loop counter -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:yloopb -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++# If we knew there was no clipping then this code would get simpler. -++# Perhaps we could add on the pitch and clip using larger values? -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, rx_xshift2 -++mov.ifz ra_y2, ra_y2_next -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y2, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# apply horizontal filter -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 8 ; mov ra12, ra13 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++brr.anyn -, r:yloopb -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -++add r1, r1, r0 ; mul24 r0, ra8, rb4 -++add r1, r1, r0 ; mul24 r0, ra9, rb5 -++add r1, r1, r0 ; mul24 r0, ra10, rb6 -++add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++add r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 14 -++nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves -++add r1, r1, ra30 ; mul24 r0, r1, rb14 -++add r1, r1, r0 -++brr.anyn -, r:yloopb -++asr r1, r1, 7 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -++ -++# DMA out -++bra -, ra31 -++mov vw_setup, rb26 # VDW setup 0 Delay 1 -++mov vw_setup, rb29 # Stride Delay 2 -++mov vw_addr, unif # start the VDW Delay 3 -++ -++################################################################################ -++ -++# mc_interrupt_exit12() -++::mc_interrupt_exit12 -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++mov -,sacq(0) # 4 -++mov -,sacq(0) # 5 -++mov -,sacq(0) # 6 -++mov -,sacq(0) # 7 -++mov -,sacq(0) # 8 -++mov -,sacq(0) # 9 -++mov -,sacq(0) # 10 -++mov -,sacq(0) # 11 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++ -+ ::mc_end -+ # Do not add code here because mc_end must appear after all other code. -+-- -+2.7.4 -+ -+ -+From f2ffe4186fa49cb27579953c276b51728a08a8b5 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 20 May 2015 19:58:30 +0100 -+Subject: [PATCH 42/68] Added support for fast cache flush in deblocker -+ -+--- -+ libavcodec/hevc_filter.c | 44 +- -+ libavcodec/rpi_qpu.c | 6 + -+ libavcodec/rpi_qpu.h | 2 + -+ libavcodec/rpi_shader.c | 1028 +++++++++++++++++++++++++++++--------------- -+ libavcodec/rpi_shader.h | 16 +- -+ libavcodec/rpi_user_vcsm.h | 22 + -+ 6 files changed, 768 insertions(+), 350 deletions(-) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 92a8271..186317a 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -37,6 +37,11 @@ -+ -+ #include "bit_depth_template.c" -+ -++#ifdef RPI -++#include "rpi_user_vcsm.h" -++#include "rpi_qpu.h" -++#endif -++ -+ #define LUMA 0 -+ #define CB 1 -+ #define CR 2 -+@@ -872,15 +877,46 @@ static void flush_buffer(AVBufferRef *bref) { -+ gpu_cache_flush(p); -+ } -+ -+-static void ff_hevc_flush_chroma(HEVCContext *s) -++// Return Physical address for this image -++static int ff_hevc_buf_base(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ return p->vc & 0x3fffffff; -++} -++ -++static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -++#define RPI_FAST_CACHEFLUSH -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int curr_y = f->progress->data[0]; -++ int sz,base; -++ if (curr_y < 0) curr_y = 0; -++ if (n<=curr_y) return; // Should not happen -++ sz = s->frame->linesize[1] * (n-curr_y); -++ base = s->frame->linesize[1] * curr_y; -++ iocache.s[0].cmd = 3; // Flush L1 cache -++ iocache.s[0].addr = 0; -++ iocache.s[0].size = 0; -++ -++ iocache.s[1].cmd = 2; -++ iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; -++ iocache.s[1].size = sz; -++ -++ iocache.s[2].cmd = 2; -++ iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; -++ iocache.s[2].size = sz; -++ -++ vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); -++ -++#else -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -++#endif -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+@@ -903,7 +939,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x, y - ctb_size); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s); -++ ff_hevc_flush_chroma(s,&s->ref->tf, y); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y, 0); -+ } -+@@ -912,7 +948,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x , y); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s); -++ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+@@ -922,7 +958,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s); -++ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index f62051f..fd8a276 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -237,6 +237,12 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -+ return r; -+ } -+ -++int gpu_get_mailbox(void) -++{ -++ assert(gpu); -++ return gpu->mb; -++} -++ -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+ void *tmp = vcsm_lock(p->vcsm_handle); -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 543c84b..88965e5 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -49,4 +49,6 @@ extern int rpi_test_shader(void); -+ extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); -+ extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); -+ -++extern int gpu_get_mailbox(void); -++ -+ #endif -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 3f04d80..9c30e32 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -23,11 +23,11 @@ __attribute__((aligned(8))) -+ unsigned int rpi_shader[] = { -+ // ::mc_setup_uv -+ /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x, unif, elem_num -+ /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+-/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_frame_base, unif -+ /* [0x00000020] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_frame_base -+ /* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+ /* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+ /* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif -+@@ -35,360 +35,708 @@ unsigned int rpi_shader[] = { -+ /* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+ /* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+ /* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+-/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+-/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000068] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000070] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000078] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -++/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -++/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -++/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -++/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+ // ::mc_filter_uv -+-/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+-/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+-/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -++/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 -+-/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 -+-/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+-/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+-/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 -++/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 -++/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 -++/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 -++/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_setup -++/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -++/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -++/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -++/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -++/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -++/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -++// ::mc_filter -++/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :yloop -++/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_b -++/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 -++/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -++/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -++/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -++/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -++/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -++/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -++/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -++/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :yloopb -++/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -++/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -++/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_interrupt_exit12 -++/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index cec9901..3fa8531 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,15 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 342) -+-#define mc_filter_uv_b (rpi_shader + 494) -+-#define mc_exit (rpi_shader + 670) -+-#define mc_interrupt_exit8 (rpi_shader + 688) -+-#define mc_end (rpi_shader + 718) -++#define mc_filter_uv (rpi_shader + 148) -++#define mc_filter_uv_b0 (rpi_shader + 338) -++#define mc_filter_uv_b (rpi_shader + 490) -++#define mc_exit (rpi_shader + 666) -++#define mc_interrupt_exit8 (rpi_shader + 684) -++#define mc_setup (rpi_shader + 714) -++#define mc_filter (rpi_shader + 868) -++#define mc_filter_b (rpi_shader + 1108) -++#define mc_interrupt_exit12 (rpi_shader + 1364) -++#define mc_end (rpi_shader + 1402) -+ -+ #endif -+diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -+index fbebbbe..95e6de1 100644 -+--- a/libavcodec/rpi_user_vcsm.h -++++ b/libavcodec/rpi_user_vcsm.h -+@@ -418,6 +418,28 @@ int vcsm_unlock_hdl( unsigned int handle ); -+ */ -+ int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -+ -++/* Clean and/or invalidate the memory associated with this user opaque handle -++** -++** Returns: non-zero on error -++** -++** structure contains a list of flush/invalidate commands. Commands are: -++** 0: nop -++** 1: invalidate given physical range in L2 -++** 2: clean given physical range in L2 -++** 3: clean+invalidate all of L1 -++** 4: flush all of L2 and all of L1 -++*/ -++struct vcsm_user_clean_invalid_s { -++ struct { -++ unsigned int cmd; -++ unsigned int addr; -++ unsigned int size; -++ } s[8]; -++}; -++ -++int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); -++ -++ -+ #ifdef __cplusplus -+ } -+ #endif -+-- -+2.7.4 -+ -+ -+From 09685ab55aecb9400e354522894e0fbbb6381ca9 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 20 May 2015 21:12:55 +0100 -+Subject: [PATCH 43/68] Added multi mailbox - not working -+ -+--- -+ libavcodec/hevc.c | 40 ++++++++++++++++++++++++++++--- -+ libavcodec/rpi_mailbox.c | 47 +++++++++++++++++++++++++++++++++++++ -+ libavcodec/rpi_mailbox.h | 5 ++++ -+ libavcodec/rpi_qpu.c | 61 ++++++++++++++++++++++++++++++++++++++++++++---- -+ libavcodec/rpi_qpu.h | 2 ++ -+ 5 files changed, 147 insertions(+), 8 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 951e2d3..ab63efd 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -47,6 +47,11 @@ -+ //#define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -++ -++ #ifdef RPI_INTER_QPU -++ // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU -++ #define RPI_MULTI_MAILBOX -++ #endif -+ #endif -+ -+ // #define DISABLE_MC -+@@ -2843,10 +2848,14 @@ static void rpi_inter_clear(HEVCContext *s) -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+ { -+ int k; -++ int i; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -+- -+- if (s->sh.slice_type == I_SLICE) -+- return; -++ if (s->sh.slice_type == I_SLICE) { -++#ifdef RPI_MULTI_MAILBOX -++ rpi_execute_transform(s); -++ return; -++#endif -++ } -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+@@ -2856,6 +2865,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -++#ifdef RPI_MULTI_MAILBOX -++ gpu_cache_flush(&s->coeffs_buf_accelerated); -++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -++ qpu_get_fn(QPU_MC_SETUP_UV), -++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ ); -++ for(i=0;i<4;i++) -++ s->num_coeffs[i] = 0; -++#else -+ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+@@ -2866,6 +2891,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -++#endif -+ } -+ #endif -+ -+@@ -2945,6 +2971,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+ // Transform all blocks -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++#ifdef RPI_MULTI_MAILBOX -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++ // Perform luma inter prediction -++ rpi_execute_inter_cmds(s); -++#else -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+@@ -2952,6 +2984,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ // Kick off inter prediction on QPUs -+ rpi_execute_inter_qpu(s); -+ #endif -++#endif -++ -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -+index 77a56dd..3904efc 100644 -+--- a/libavcodec/rpi_mailbox.c -++++ b/libavcodec/rpi_mailbox.c -+@@ -276,6 +276,53 @@ unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigne -+ return p[5]; -+ } -+ -++void execute_multi(int file_desc, -++ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, -++ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, -++ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2) { -++ int i=0; -++ unsigned p[32]; -++ -++ p[i++] = 0; // size -++ p[i++] = 0x00000000; // process request -++ p[i++] = 0x30018; // (the tag id) -++ p[i++] = 88; // (size of the buffer) -++ p[i++] = 88; // (size of the data) -++ -++ p[i++] = num_qpus; -++ p[i++] = control; -++ p[i++] = noflush; -++ p[i++] = timeout; // ms -++ -++ p[i++] = num_qpus_2; -++ p[i++] = control_2; -++ p[i++] = noflush_2; -++ p[i++] = timeout_2; // ms -++ -++ p[i++] = code; -++ p[i++] = r0; -++ p[i++] = r1; -++ p[i++] = r2; -++ p[i++] = r3; -++ p[i++] = r4; -++ p[i++] = r5; -++ -++ p[i++] = code_2; -++ p[i++] = r0_2; -++ p[i++] = r1_2; -++ p[i++] = r2_2; -++ p[i++] = r3_2; -++ p[i++] = r4_2; -++ p[i++] = r5_2; -++ -++ p[i++] = 0x00000000; // end tag -++ p[0] = i*sizeof *p; // actual size -++ -++ mbox_property(file_desc, p); -++ return; -++} -++ -+ int mbox_open() { -+ int file_desc; -+ -+diff --git a/libavcodec/rpi_mailbox.h b/libavcodec/rpi_mailbox.h -+index c264d2e..5898102 100644 -+--- a/libavcodec/rpi_mailbox.h -++++ b/libavcodec/rpi_mailbox.h -+@@ -15,6 +15,11 @@ extern void unmapmem(void *addr, unsigned size); -+ -+ extern unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ extern unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout); -++extern void execute_multi(int file_desc, -++ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, -++ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, -++ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2); -+ extern unsigned qpu_enable(int file_desc, unsigned enable); -+ -+ #endif -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index fd8a276..feb3284 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -123,7 +123,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -+ static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; -+ static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+-static int vpu_cmds[MAXCMDS][8]; -++static int vpu_cmds[MAXCMDS][16]; -+ static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+ static volatile int vpu_async_head=0; -+ #endif -+@@ -346,6 +346,7 @@ unsigned int vpu_get_constants(void) { -+ static void *vpu_start(void *arg) { -+ while(1) { -+ int *p; -++ int qpu_code; -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+@@ -358,12 +359,25 @@ static void *vpu_start(void *arg) { -+ if (p[6] == -1) { -+ break; // Last job -+ } -+- if (p[7]) { -++ qpu_code = p[7]; -++ //if (p[7]) { -+ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+- } -+- vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ //} -++ if (!qpu_code) { -++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ } else { -++ int i; -++ for(i=0;i<8;i++) { -++ gpu->mail[i*2] = p[8+i]; -++ gpu->mail[i*2 + 1] = qpu_code; -++ } -+ -++ execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -++ 0, 0, 0, 0, -++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -++ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -++ } -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond_head); -+@@ -400,7 +414,43 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned -+ p[4] = r3; -+ p[5] = r4; -+ p[6] = r5; -+- p[7] = (int) buf; -++ p[7] = 0; -++ if (num<=1) -++ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -++ pthread_mutex_unlock(&post_mutex); -++ return id; -++ } -++} -++ -++int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -++{ -++ -++ pthread_mutex_lock(&post_mutex); -++ { -++ int id = vpu_async_tail++; -++ int *p = vpu_cmds[id%MAXCMDS]; -++ int num = vpu_async_tail - vpu_async_head; -++ if (num>MAXCMDS) { -++ printf("Too many commands submitted\n"); -++ exit(-1); -++ } -++ p[0] = vpu_code; -++ p[1] = r0; -++ p[2] = r1; -++ p[3] = r2; -++ p[4] = r3; -++ p[5] = r4; -++ p[6] = r5; -++ p[7] = qpu_code; -++ p[8 ] = unifs1; -++ p[9 ] = unifs2; -++ p[10] = unifs3; -++ p[11] = unifs4; -++ p[12] = unifs5; -++ p[13] = unifs6; -++ p[14] = unifs7; -++ p[15] = unifs8; -+ if (num<=1) -+ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+@@ -966,6 +1016,7 @@ void rpi_do_block(const uint8_t *in_buffer_vc, int src_pitch, uint8_t *dst_vc, i -+ } -+ -+ -++ -+ #endif -+ -+ #endif // RPI -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 88965e5..2f08f03 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -41,6 +41,8 @@ extern unsigned int vpu_get_fn(void); -+ extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -++int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void vpu_wait( int id); -+ -+ // Simple test of shader code -+-- -+2.7.4 -+ -+ -+From 311f2da06d13a98d9bdda2df8684d7cf55b9a08e Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 21 May 2015 16:50:02 +0100 -+Subject: [PATCH 44/68] Pass qpu number in as uniform -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ libavcodec/rpi_shader.c | 1288 ++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 20 +- -+ libavcodec/rpi_shader.qasm | 10 +- -+ 4 files changed, 657 insertions(+), 663 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ab63efd..caadfaa 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2834,6 +2834,7 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -++ *s->u_mvs[i]++ = i; -+ if (weight_flag) { -+ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -+@@ -2841,7 +2842,6 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = 1 << 5; -+ *s->u_mvs[i]++ = 6; -+ } -+- s->u_mvs[i] += 1; // Padding words -+ } -+ } -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 9c30e32..a0f0282 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -48,8 +48,8 @@ unsigned int rpi_shader[] = { -+ /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+ /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+ /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif -++/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+ /* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+ /* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+ /* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+@@ -60,669 +60,669 @@ unsigned int rpi_shader[] = { -+ /* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+ /* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+ /* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+-/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+-/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -+-/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+-/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+-/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -++/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x -++/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -++/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -++/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -++/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+ // ::mc_filter_uv -+-/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+-/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+-/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -++/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 -+-/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 -+-/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+-/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+-/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 -++/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 -++/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 -++/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 -++/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_setup -+-/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+-/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+-/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -+-/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+-/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+-/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+-/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -+-/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -++/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -++/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -++/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -++/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -++/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -++/* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -+ // ::mc_filter -+-/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :yloop -+-/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_b -+-/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 -+-/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -+-/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -+-/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -+-/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -+-/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -+-/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -+-/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -+-/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 -++/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -++/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -++/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -++/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -++/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -++/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -++/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -++/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :yloopb -+-/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -+-/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -+-/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -++/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -++/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_interrupt_exit12 -+-/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+@@ -732,11 +732,9 @@ unsigned int rpi_shader[] = { -+ /* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 3fa8531..6e552d9 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,15 +4,15 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 148) -+-#define mc_filter_uv_b0 (rpi_shader + 338) -+-#define mc_filter_uv_b (rpi_shader + 490) -+-#define mc_exit (rpi_shader + 666) -+-#define mc_interrupt_exit8 (rpi_shader + 684) -+-#define mc_setup (rpi_shader + 714) -+-#define mc_filter (rpi_shader + 868) -+-#define mc_filter_b (rpi_shader + 1108) -+-#define mc_interrupt_exit12 (rpi_shader + 1364) -+-#define mc_end (rpi_shader + 1402) -++#define mc_filter_uv (rpi_shader + 144) -++#define mc_filter_uv_b0 (rpi_shader + 334) -++#define mc_filter_uv_b (rpi_shader + 486) -++#define mc_exit (rpi_shader + 662) -++#define mc_interrupt_exit8 (rpi_shader + 680) -++#define mc_setup (rpi_shader + 710) -++#define mc_filter (rpi_shader + 864) -++#define mc_filter_b (rpi_shader + 1104) -++#define mc_interrupt_exit12 (rpi_shader + 1360) -++#define mc_end (rpi_shader + 1398) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 9cfc0d9..a0b8e5a 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -133,8 +133,8 @@ mov ra14, 0 -+ mov ra15, 0 -+ -+ # Compute part of VPM to use for DMA output -+-mov r2, qpu_num -+-shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -++mov r3, unif -++shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+ and r2, r2, 15 -+ mov r1, r2 -+ asr r1, r1, 2 -+@@ -147,8 +147,7 @@ shl r0, r0, 5 -+ add rb27, r0, r1 -+ -+ # Compute part of VPM to save data into -+-mov r2, qpu_num # qpu_num = abcd -+-shl r2, r2, 1 -++shl r2, r3, 1 -+ and r2, r2, 15 # r2 = bcd0 -+ mov r1, r2 # r1 = bcd0 -+ asr r1, r1, 2 # r1 = bc -+@@ -181,9 +180,6 @@ add t0s, r2, r1 -+ mov rb12,unif # offset before shift -+ mov rb13,unif # offset after shift -+ -+-# Dump padding words -+-mov r0, unif -+- -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+ min r1, r1, rb_frame_height_minus_1 -+-- -+2.7.4 -+ -+ -+From db6fe49d50e42c444b5833acc6206c0bbfaacef4 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sat, 23 May 2015 13:20:21 +0100 -+Subject: [PATCH 45/68] Add new cache flushing routine -+ -+--- -+ libavcodec/hevc.c | 8 +++-- -+ libavcodec/hevc_filter.c | 39 ++++++++++----------- -+ libavcodec/rpi_qpu.c | 17 +++++++-- -+ libavcodec/rpi_qpu.h | 2 ++ -+ libavcodec/rpi_user_vcsm.h | 86 ++++++++++++++++++++++++++-------------------- -+ 5 files changed, 91 insertions(+), 61 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index caadfaa..9d12583 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3575,9 +3575,13 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) -+ } -+ -+ fail: -+- if (s->ref && s->threads_type == FF_THREAD_FRAME) -++ if (s->ref && s->threads_type == FF_THREAD_FRAME) { -++#ifdef RPI_INTER_QPU -++ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -++ ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); -++#endif -+ ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -+- -++ } -+ return ret; -+ } -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 186317a..ec84e8a 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -883,36 +883,35 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { -+ return p->vc & 0x3fffffff; -+ } -+ -+-static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -++void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -++void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+-#define RPI_FAST_CACHEFLUSH -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+- int curr_y = f->progress->data[0]; -++ int curr_y = ((int *)f->progress->data)[0]; -++ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -++ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+- if (curr_y < 0) curr_y = 0; -+- if (n<=curr_y) return; // Should not happen -+- sz = s->frame->linesize[1] * (n-curr_y); -+- base = s->frame->linesize[1] * curr_y; -+- iocache.s[0].cmd = 3; // Flush L1 cache -+- iocache.s[0].addr = 0; -+- iocache.s[0].size = 0; -+- -+- iocache.s[1].cmd = 2; -+- iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; -++ if (curr_uv < 0) curr_uv = 0; -++ if (n_uv<=curr_uv) { assert(0); return; } // Should not happen -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(s->frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = p->arm + base; -+ iocache.s[1].size = sz; -+- -+- iocache.s[2].cmd = 2; -+- iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; -+- iocache.s[2].size = sz; -+- -+- vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); -+- -++ vcsm_clean_invalid( &iocache ); -+ #else -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index feb3284..aa65a77 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -211,6 +211,7 @@ static void gpu_unlock(void) { -+ } -+ -+ static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -++ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+ assert(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+@@ -243,13 +244,25 @@ int gpu_get_mailbox(void) -+ return gpu->mb; -+ } -+ -++// Call this to clean and invalidate a region of memory -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+- void *tmp = vcsm_lock(p->vcsm_handle); -+- vcsm_unlock_ptr(tmp); -++#define RPI_FAST_CACHEFLUSH -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm; -++ iocache.s[0].size = p->numbytes; -++ vcsm_clean_invalid( &iocache ); -++#else -++ void *tmp = vcsm_lock(p->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++#endif -+ } -+ -+ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -++ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 2f08f03..0565a60 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -1,6 +1,8 @@ -+ #ifndef RPI_QPU_H -+ #define RPI_QPU_H -+ -++#define RPI_FAST_CACHEFLUSH -++ -+ typedef struct gpu_mem_ptr_s { -+ unsigned char *arm; // Pointer to memory mapped on ARM side -+ int vc_handle; // Videocore handle of relocatable memory -+diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -+index 95e6de1..db41a4d 100644 -+--- a/libavcodec/rpi_user_vcsm.h -++++ b/libavcodec/rpi_user_vcsm.h -+@@ -1,29 +1,41 @@ -+-/* -+-Copyright (c) 2012, Broadcom Europe Ltd -+-All rights reserved. -+- -+-Redistribution and use in source and binary forms, with or without -+-modification, are permitted provided that the following conditions are met: -+- * Redistributions of source code must retain the above copyright -+- notice, this list of conditions and the following disclaimer. -+- * Redistributions in binary form must reproduce the above copyright -+- notice, this list of conditions and the following disclaimer in the -+- documentation and/or other materials provided with the distribution. -+- * Neither the name of the copyright holder nor the -+- names of its contributors may be used to endorse or promote products -+- derived from this software without specific prior written permission. -+- -+-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+-*/ -++/***************************************************************************** -++* Copyright 2001 - 2011 Broadcom Corporation. All rights reserved. -++* -++* This program is the proprietary software of Broadcom Corporation and/or -++* its licensors, and may only be used, duplicated, modified or distributed -++* pursuant to the terms and conditions of a separate, written license -++* agreement executed between you and Broadcom (an "Authorized License"). -++* Except as set forth in an Authorized License, Broadcom grants no license -++* (express or implied), right to use, or waiver of any kind with respect to -++* the Software, and Broadcom expressly reserves all rights in and to the -++* Software and all intellectual property rights therein. IF YOU HAVE NO -++* AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY -++* WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE ALL USE OF -++* THE SOFTWARE. -++* -++* Except as expressly set forth in the Authorized License, -++* 1. This program, including its structure, sequence and organization, -++* constitutes the valuable trade secrets of Broadcom, and you shall use -++* all reasonable efforts to protect the confidentiality thereof, and to -++* use this information only in connection with your use of Broadcom -++* integrated circuit products. -++* 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" -++* AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR -++* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH -++* RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL -++* IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS -++* FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, -++* QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. YOU -++* ASSUME THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE. -++* 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS -++* LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, -++* OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO -++* YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN -++* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS -++* OF THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER -++* IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF -++* ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. -++*****************************************************************************/ -+ -+ #ifndef __USER_VCSM__H__INCLUDED__ -+ #define __USER_VCSM__H__INCLUDED__ -+@@ -424,21 +436,21 @@ int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -+ ** -+ ** structure contains a list of flush/invalidate commands. Commands are: -+ ** 0: nop -+-** 1: invalidate given physical range in L2 -+-** 2: clean given physical range in L2 -+-** 3: clean+invalidate all of L1 -+-** 4: flush all of L2 and all of L1 -++** 1: invalidate given virtual range in L1/L2 -++** 2: clean given virtual range in L1/L2 -++** 3: clean+invalidate given virtual range in L1/L2 -++** 4: flush all L1/L2 -+ */ -+ struct vcsm_user_clean_invalid_s { -+- struct { -+- unsigned int cmd; -+- unsigned int addr; -+- unsigned int size; -+- } s[8]; -++ struct { -++ unsigned int cmd; -++ unsigned int handle; -++ unsigned int addr; -++ unsigned int size; -++ } s[8]; -+ }; -+ -+-int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); -+- -++int vcsm_clean_invalid( struct vcsm_user_clean_invalid_s *s ); -+ -+ #ifdef __cplusplus -+ } -+-- -+2.7.4 -+ -+ -+From 87a6cb3a4f7189e711c85de6d20077b6453b2ebe Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sat, 23 May 2015 21:10:10 +0100 -+Subject: [PATCH 46/68] Fix multi mailbox extra transform call -+ -+--- -+ libavcodec/hevc.c | 2 ++ -+ 1 file changed, 2 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 9d12583..30f5834 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3024,7 +3024,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI_INTER_QPU -+ rpi_execute_inter_qpu(s); -+ #endif -++#ifndef RPI_MULTI_MAILBOX -+ rpi_execute_transform(s); -++#endif -+ rpi_execute_inter_cmds(s); -+ vpu_wait(s->vpu_id); -+ rpi_execute_pred_cmds(s); -+-- -+2.7.4 -+ -+ -+From 2a3672a1bda0296453953bebe8b17d69445260b4 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 27 May 2015 16:44:29 +0100 -+Subject: [PATCH 47/68] Added support for running luma prediction on QPUs -+ -+--- -+ libavcodec/hevc.c | 237 +++++++- -+ libavcodec/hevc.h | 26 +- -+ libavcodec/hevc_filter.c | 23 +- -+ libavcodec/rpi_qpu.c | 156 ++++-- -+ libavcodec/rpi_qpu.h | 8 +- -+ libavcodec/rpi_shader.c | 1313 ++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 21 +- -+ libavcodec/rpi_shader.qasm | 883 ++++++++++++++--------------- -+ 8 files changed, 1464 insertions(+), 1203 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 30f5834..2da88ec 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -52,6 +52,11 @@ -+ // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU -+ #define RPI_MULTI_MAILBOX -+ #endif -++ -++ // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory -++ // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. -++ -++ -+ #endif -+ -+ // #define DISABLE_MC -+@@ -74,6 +79,13 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -++// Split image of 2048 into parts 64 wide -++// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -++// Each block of 64*64 -++// Smallest CTU size is 16x16, so smallest block is 8x8 -++// Corresponds to a total of 83kbytes over all 12 QPUs -++#define RPI_LUMA_COMMAND_WORDS 9 -++#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) -+ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+@@ -2015,10 +2027,46 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -++#ifdef RPI_LUMA_QPU -++ if (s->enable_rpi) { -++ int reflist = 0; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ int mx = mv->x & 3; -++ int my = mv->y & 3; -++ int my_mx = (my<<8) + mx; -++ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -++ int x1 = x0 + (mv->x >> 2); -++ int y1 = y0 + (mv->y >> 2); -++ int chan = x0>>6; // 64 wide blocks per QPU -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -++ uint32_t *y = s->y_mvs[chan % 12]; -++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -++ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = my2_mx2_my_mx; -++ if (weight_flag) { -++ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -++ } else { -++ *y++ = 1; // Weight of 1 and offset of 0 -++ } -++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -++ } -++ } -++ s->y_mvs[chan % 12] = y; -++ } else -++#endif -++ { -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l0[current_mv.ref_idx[0]], -+ s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -++ } -+ -+ if (s->ps.sps->chroma_format_idc) { -+ #ifdef RPI_INTER_QPU -+@@ -2078,10 +2126,47 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -++#ifdef RPI_LUMA_QPU -++ if (s->enable_rpi) { -++ int reflist = 1; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ int mx = mv->x & 3; -++ int my = mv->y & 3; -++ int my_mx = (my<<8) + mx; -++ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -++ int x1 = x0 + (mv->x >> 2); -++ int y1 = y0 + (mv->y >> 2); -++ int chan = x0>>6; // 64 wide blocks per QPU -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -++ uint32_t *y = s->y_mvs[chan % 12]; -++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -++ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = my2_mx2_my_mx; -++ if (weight_flag) { -++ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -++ } else { -++ *y++ = 1; // Weight of 1 and offset of 0 -++ } -++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -++ } -++ } -++ s->y_mvs[chan % 12] = y; -++ } else -++#endif -++ -++ { -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -+ ¤t_mv.mv[1], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l1[current_mv.ref_idx[1]], -+ s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -++ } -+ -+ if (s->ps.sps->chroma_format_idc) { -+ #ifdef RPI_INTER_QPU -+@@ -2115,8 +2200,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_my][0]; -+ if (weight_flag) { -+- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); -+- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][0] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][1] & 0xffff); -+ } else { -+ *u++ = 1; // Weight of 1 and offset of 0 -+ *u++ = 1; -+@@ -2143,9 +2228,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -++#ifdef RPI_LUMA_QPU -++ if (s->enable_rpi) { -++ const Mv *mv = ¤t_mv.mv[0]; -++ int mx = mv->x & 3; -++ int my = mv->y & 3; -++ int my_mx = (my<<8) + mx; -++ const Mv *mv2 = ¤t_mv.mv[1]; -++ int mx2 = mv2->x & 3; -++ int my2 = mv2->y & 3; -++ int my2_mx2 = (my2<<8) + mx2; -++ int my2_mx2_my_mx = (my2_mx2 << 16) + my_mx; -++ int x1 = x0 + (mv->x >> 2); -++ int y1 = y0 + (mv->y >> 2); -++ int x2 = x0 + (mv2->x >> 2); -++ int y2 = y0 + (mv2->y >> 2); -++ int chan = x0>>6; // 64 wide blocks per QPU -++ uint32_t *y = s->y_mvs[chan % 12]; -++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -++ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = my2_mx2_my_mx; -++ *y++ = 1; // B frame weighted prediction not supported -++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -++ } -++ } -++ s->y_mvs[chan % 12] = y; -++ } else -++#endif -++ { -++ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ ref1->frame, ¤t_mv.mv[1], ¤t_mv); -++ } -+ -+ if (s->ps.sps->chroma_format_idc) { -+ #ifdef RPI_INTER_QPU -+@@ -2834,7 +2954,6 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -+- *s->u_mvs[i]++ = i; -+ if (weight_flag) { -+ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -+@@ -2842,7 +2961,31 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = 1 << 5; -+ *s->u_mvs[i]++ = 6; -+ } -++ *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -++ } -++ -++#ifdef RPI_LUMA_QPU -++ for(i=0;i<12;i++) { -++ s->y_mvs[i] = s->y_mvs_base[i]; -++ *s->y_mvs[i]++ = 0; // y_x -++ *s->y_mvs[i]++ = 0; // ref_y_base -++ *s->y_mvs[i]++ = 0; // y2_x2 -++ *s->y_mvs[i]++ = 0; // ref_y2_base -++ *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -++ *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch -++ *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch -++ if (weight_flag) { -++ int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); -++ int shift = s->sh.luma_log2_weight_denom + 6; -++ *s->y_mvs[i]++ = (offset << 16) + shift; -++ } else { -++ int offset = 1 << 5; -++ int shift = 6; -++ *s->y_mvs[i]++ = (offset << 16) + shift; -++ } -++ *s->y_mvs[i]++ = 0; // Next kernel -+ } -++#endif -+ } -+ -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+@@ -2850,6 +2993,9 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ int k; -+ int i; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++#ifdef RPI_LUMA_QPU -++ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; -++#endif -+ if (s->sh.slice_type == I_SLICE) { -+ #ifdef RPI_MULTI_MAILBOX -+ rpi_execute_transform(s); -+@@ -2865,8 +3011,23 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -++#ifdef RPI_LUMA_QPU -++ for(k=0;k<12;k++) { -++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -++ } -++ s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++#endif -++ -++ -+ #ifdef RPI_MULTI_MAILBOX -++#ifdef RPI_CACHE_UNIF_MVS -++ gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); -++#else -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -++#endif -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+@@ -2876,7 +3037,27 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++#ifdef RPI_LUMA_QPU -++ qpu_get_fn(QPU_MC_SETUP), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) -++#else -++ 0, -++ 0,0,0,0, -++ 0,0,0,0, -++ 0,0,0,0 -++#endif -+ ); -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2892,6 +3073,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -+ #endif -++ -++ -+ } -+ #endif -+ -+@@ -3579,8 +3762,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) -+ fail: -+ if (s->ref && s->threads_type == FF_THREAD_FRAME) { -+ #ifdef RPI_INTER_QPU -+- void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -+- ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); -++ ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -+ } -+@@ -3767,7 +3949,6 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ -+ #ifdef RPI -+ av_freep(&s->unif_mv_cmds); -+- av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+ -+ #ifdef RPI_INTER_QPU -+@@ -3776,7 +3957,12 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ s->unif_mvs = 0; -+ } -+ #endif -+- //gpu_free(&s->dummy); -++#ifdef RPI_LUMA_QPU -++ if (s->y_unif_mvs) { -++ gpu_free( &s->y_unif_mvs_ptr ); -++ s->y_unif_mvs = 0; -++ } -++#endif -+ -+ #ifdef EARLY_MALLOC -+ printf("hevc_decode_free\n"); -+@@ -3861,9 +4047,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -+ if (!s->unif_mv_cmds) -+ goto fail; -+- s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); -+- if (!s->unif_xfm_cmds) -+- goto fail; -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+@@ -3877,7 +4060,11 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; -+ uint32_t *p; -++#ifdef RPI_CACHE_UNIF_MVS -++ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++#else -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++#endif -+ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+ -+ // Set up initial locations for uniform streams -+@@ -3892,6 +4079,28 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ -+ } -+ #endif -++#ifdef RPI_LUMA_QPU -++ { -++ int y_commands_per_qpu = Y_COMMANDS_PER_QPU; -++ uint32_t *p; -++#ifdef RPI_CACHE_UNIF_MVS -++ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -++#else -++ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -++#endif -++ s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ -++ // Set up initial locations for uniform streams -++ p = s->y_unif_mvs; -++ for(i = 0; i < 12; i++) { -++ s->y_mvs_base[i] = p; -++ p += y_commands_per_qpu; -++ } -++ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -++ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -++ -++ } -++#endif -+ //gpu_malloc_uncached(2048*64,&s->dummy); -+ -+ #ifdef EARLY_MALLOC -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 4a39e39..5df9dcd 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -44,9 +44,13 @@ -+ #ifdef RPI -+ -+ #include "rpi_qpu.h" -+- // Use QPU for inter prediction -++ // Define RPI_INTER_QPU to use QPU for chroma inter prediction -+ #define RPI_INTER_QPU -+ -++ #ifdef RPI_INTER_QPU -++ // Define RPI_LUMA_QPU to also use QPU for luma inter prediction -++ #define RPI_LUMA_QPU -++ #endif -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -809,7 +813,6 @@ typedef struct HEVCLocalContext { -+ -+ // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -+ #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+-#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+ // Each block can have an intra prediction and a transform_add command -+ #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ // Worst case is 16x16 CTUs -+@@ -844,9 +847,6 @@ typedef struct HEVCMvCmd { -+ int8_t ref_idx[2]; -+ } HEVCMvCmd; -+ -+-// Command for transform to process a block of coefficients -+-typedef struct HEVCXfmCmd { -+-} HEVCXfmCmd; -+ -+ // Command for intra prediction and transform_add of predictions to coefficients -+ #define RPI_PRED_TRANSFORM_ADD 0 -+@@ -892,8 +892,7 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI -+ int enable_rpi; -+- HEVCMvCmd *unif_mv_cmds; // TODO rename -+- HEVCXfmCmd *unif_xfm_cmds; -++ HEVCMvCmd *unif_mv_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+ int buf_width; -+ GPU_MEM_PTR_T coeffs_buf_default; -+@@ -920,6 +919,15 @@ typedef struct HEVCContext { -+ uint32_t mc_filter_uv_b0; -+ uint32_t mc_filter_uv_b; -+ #endif -++#ifdef RPI_LUMA_QPU -++ GPU_MEM_PTR_T y_unif_mvs_ptr; -++ uint32_t *y_unif_mvs; // Base of memory for motion vector commands -++ uint32_t *y_mvs_base[12]; -++ uint32_t *y_mvs[12]; -++ // Function pointers -++ uint32_t mc_filter; -++ uint32_t mc_filter_b; -++#endif -+ -+ #endif -+ -+@@ -1166,6 +1174,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int log2_trafo_size, enum ScanType scan_idx, -+ int c_idx); -+ -++#ifdef RPI_INTER_QPU -++extern void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n); -++#endif -++ -+ void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size); -+ -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index ec84e8a..11629e4 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -883,8 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { -+ return p->vc & 0x3fffffff; -+ } -+ -+-void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -+-void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -++void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+@@ -911,10 +910,24 @@ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = p->arm + base; -+ iocache.s[1].size = sz; -++ -++#ifdef RPI_LUMA_QPU -++ p = av_buffer_pool_opaque(s->frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = p->arm + base; -++ iocache.s[2].size = sz; -++#endif -+ vcsm_clean_invalid( &iocache ); -+ #else -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -++#ifdef RPI_LUMA_QPU -++ flush_buffer(s->frame->buf[1]); -++#endif -++ -+ #endif -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+@@ -938,7 +951,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x, y - ctb_size); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s,&s->ref->tf, y); -++ ff_hevc_flush_buffer(s,&s->ref->tf, y); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y, 0); -+ } -+@@ -947,7 +960,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x , y); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); -++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+@@ -957,7 +970,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); -++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index aa65a77..e12304b 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -1,9 +1,11 @@ -+ #ifdef RPI -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+-#define RPI_TIME_TOTAL_QPU -++//#define RPI_TIME_TOTAL_QPU -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+ //#define RPI_TIME_TOTAL_VPU -++// define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined -++//#define RPI_TIME_TOTAL_POSTED -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -+ -+@@ -94,7 +96,8 @@ struct GPU -+ int open_count; // Number of allocated video buffers -+ int mb; // Mailbox handle -+ int vc; // Address in GPU memory -+- int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -++ int mail[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the first QPU task -++ int mail2[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the second QPU task -+ }; -+ -+ // Stop more than one thread trying to allocate memory or use the processing resources at once -+@@ -102,7 +105,7 @@ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+ static volatile struct GPU* gpu = NULL; -+ static GPU_MEM_PTR_T gpu_mem_ptr; -+ -+-#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -++#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) || defined(RPI_TIME_TOTAL_POSTED) -+ static unsigned int Microseconds(void) { -+ struct timespec ts; -+ unsigned int x; -+@@ -123,7 +126,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -+ static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; -+ static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+-static int vpu_cmds[MAXCMDS][16]; -++static int vpu_cmds[MAXCMDS][32]; -+ static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+ static volatile int vpu_async_head=0; -+ #endif -+@@ -247,7 +250,6 @@ int gpu_get_mailbox(void) -+ // Call this to clean and invalidate a region of memory -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+-#define RPI_FAST_CACHEFLUSH -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ iocache.s[0].handle = p->vcsm_handle; -+@@ -261,6 +263,34 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ #endif -+ } -+ -++void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -++{ -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ iocache.s[0].handle = p0->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = (int) p0->arm; -++ iocache.s[0].size = p0->numbytes; -++ iocache.s[1].handle = p1->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = (int) p1->arm; -++ iocache.s[1].size = p1->numbytes; -++ iocache.s[2].handle = p2->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = (int) p2->arm; -++ iocache.s[2].size = p2->numbytes; -++ vcsm_clean_invalid( &iocache ); -++#else -++ void *tmp; -++ tmp = vcsm_lock(p0->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++ tmp = vcsm_lock(p1->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++ tmp = vcsm_lock(p2->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++#endif -++} -++ -+ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -+ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -+@@ -357,9 +387,19 @@ unsigned int vpu_get_constants(void) { -+ #ifdef RPI_ASYNC -+ -+ static void *vpu_start(void *arg) { -++#ifdef RPI_TIME_TOTAL_POSTED -++ int last_time=0; -++ long long on_time=0; -++ long long off_time=0; -++ int start_time; -++ int end_time; -++ int count=0; -++#endif -+ while(1) { -++ int i; -+ int *p; -+ int qpu_code; -++ int qpu_codeb; -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+@@ -373,24 +413,49 @@ static void *vpu_start(void *arg) { -+ break; // Last job -+ } -+ qpu_code = p[7]; -++ qpu_codeb = p[16]; -+ //if (p[7]) { -+ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+ //} -++ -++#ifdef RPI_TIME_TOTAL_POSTED -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -++ -+ if (!qpu_code) { -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ } else { -+- int i; -+ for(i=0;i<8;i++) { -+ gpu->mail[i*2] = p[8+i]; -+ gpu->mail[i*2 + 1] = qpu_code; -+ } -+- -+- execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+- 0, 0, 0, 0, -++ for(i=0;i<12;i++) { -++ gpu->mail2[i*2] = p[17+i]; -++ gpu->mail2[i*2 + 1] = qpu_codeb; -++ } -++#if (0) -++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); -++#else -++ execute_multi(gpu->mb, -++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -++#endif -+ } -++#ifdef RPI_TIME_TOTAL_POSTED -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ if ((count&0x7f)==0) -++ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++#endif -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond_head); -+@@ -436,7 +501,9 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned -+ } -+ -+ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, -++ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b -++ ) -+ { -+ -+ pthread_mutex_lock(&post_mutex); -+@@ -464,6 +531,21 @@ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, -+ p[13] = unifs6; -+ p[14] = unifs7; -+ p[15] = unifs8; -++ -++ p[16] = qpu_codeb; -++ p[17] = unifs1b; -++ p[18] = unifs2b; -++ p[19] = unifs3b; -++ p[20] = unifs4b; -++ p[21] = unifs5b; -++ p[22] = unifs6b; -++ p[23] = unifs7b; -++ p[24] = unifs8b; -++ p[25] = unifs9b; -++ p[26] = unifs10b; -++ p[27] = unifs11b; -++ p[28] = unifs12b; -++ -+ if (num<=1) -+ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+@@ -544,27 +626,27 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un -+ off_time += start_time-last_time; -+ #endif -+ for(i=0;imail[i*2 + 1] = code; -++ gpu->mail2[i*2 + 1] = code; -+ } -+ for(;imail[i*2 + 1] = code2; -++ gpu->mail2[i*2 + 1] = code2; -+ } -+- gpu->mail[0 ] = unifs1; -+- gpu->mail[2 ] = unifs2; -+- gpu->mail[4 ] = unifs3; -+- gpu->mail[6 ] = unifs4; -+- gpu->mail[8 ] = unifs5; -+- gpu->mail[10] = unifs6; -+- gpu->mail[12] = unifs7; -+- gpu->mail[14] = unifs8; -+- gpu->mail[16] = unifs9; -+- gpu->mail[18] = unifs10; -+- gpu->mail[20] = unifs11; -+- gpu->mail[22] = unifs12; -++ gpu->mail2[0 ] = unifs1; -++ gpu->mail2[2 ] = unifs2; -++ gpu->mail2[4 ] = unifs3; -++ gpu->mail2[6 ] = unifs4; -++ gpu->mail2[8 ] = unifs5; -++ gpu->mail2[10] = unifs6; -++ gpu->mail2[12] = unifs7; -++ gpu->mail2[14] = unifs8; -++ gpu->mail2[16] = unifs9; -++ gpu->mail2[18] = unifs10; -++ gpu->mail2[20] = unifs11; -++ gpu->mail2[22] = unifs12; -+ execute_qpu( -+ gpu->mb, -+ 12 /* Number of QPUs */, -+- gpu->vc + offsetof(struct GPU, mail), -++ gpu->vc + offsetof(struct GPU, mail2), -+ 1 /* no flush */, // Don't flush VPU L1 cache -+ 5000 /* timeout ms */); -+ #ifdef RPI_TIME_TOTAL_QPU -+@@ -635,21 +717,21 @@ unsigned int qpu_get_fn(int num) { -+ gpu_unlock(); -+ } -+ switch(num) { -+- //case QPU_MC_SETUP: -+- // fn = mc_setup; -+- // break; -+- //case QPU_MC_FILTER: -+- // fn = mc_filter; -+- // break; -++ case QPU_MC_SETUP: -++ fn = mc_setup; -++ break; -++ case QPU_MC_FILTER: -++ fn = mc_filter; -++ break; -+ case QPU_MC_EXIT: -+ fn = mc_exit; -+ break; -+- //case QPU_MC_INTERRUPT_EXIT: -+- // fn = mc_interrupt_exit; -+- // break; -+- //case QPU_MC_FILTER_B: -+- // fn = mc_filter_b; -+- // break; -++ case QPU_MC_INTERRUPT_EXIT12: -++ fn = mc_interrupt_exit12; -++ break; -++ case QPU_MC_FILTER_B: -++ fn = mc_filter_b; -++ break; -+ //case QPU_MC_FILTER_HONLY: -+ // fn = mc_filter_honly; -+ // break; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 0565a60..81c2bb1 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -1,6 +1,7 @@ -+ #ifndef RPI_QPU_H -+ #define RPI_QPU_H -+ -++// Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code -+ #define RPI_FAST_CACHEFLUSH -+ -+ typedef struct gpu_mem_ptr_s { -+@@ -16,6 +17,7 @@ extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -+ extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -+ extern void gpu_free(GPU_MEM_PTR_T *p); -+ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -++extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -+ // QPU specific functions -+ extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+@@ -26,7 +28,7 @@ enum { -+ QPU_MC_SETUP, -+ QPU_MC_FILTER, -+ QPU_MC_EXIT, -+- QPU_MC_INTERRUPT_EXIT, -++ QPU_MC_INTERRUPT_EXIT12, -+ QPU_MC_FILTER_B, -+ QPU_MC_FILTER_HONLY, -+ QPU_MC_SETUP_UV, -+@@ -44,7 +46,9 @@ extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -+ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, -++ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b -++ ); -+ extern void vpu_wait( int id); -+ -+ // Simple test of shader code -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index a0f0282..e86eb30 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -48,693 +48,674 @@ unsigned int rpi_shader[] = { -+ /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+ /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+ /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif -+-/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+-/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+-/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+-/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+-/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x000000d0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -++/* [0x000000d8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000000e0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -++/* [0x000000e8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000000f0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000000f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000100] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000108] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x00000110] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000118] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -++/* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 -++/* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 -++/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 -++/* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 -++/* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif -++/* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000158] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000160] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000168] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000170] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000178] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000180] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000188] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000190] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000198] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x000001a0] */ 0x0f9c11c0, 0xd00208a7, // asr r2, r0, 1 -++/* [0x000001a8] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x000001b0] */ 0x0c9e7440, 0x10021567, // add rb21, r2, r1 -++/* [0x000001b8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x000001c0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x000001c8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x000001d0] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+ /* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+-/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+-/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x000001e0] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x000001e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000001f0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x000001f8] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -++/* [0x00000200] */ 0x0c627380, 0x10020f27, // add t1s, r1, ra_frame_base -+ // ::mc_filter_uv -+-/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+-/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+-/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000208] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000210] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000218] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000220] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000228] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000230] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000238] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000240] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000248] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000250] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000258] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000260] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000268] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000270] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000278] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000280] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000288] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000290] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000298] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002a0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002a8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002b0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002b8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002d0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002d8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002e0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000002e8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002f0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002f8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000300] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000308] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000310] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000318] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000320] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000328] */ 0x0f9e7080, 0x100208e7, // asr r3, r0, r2 -++/* [0x00000330] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000338] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000348] */ 0x0f9e7080, 0x100608e7, // asr.ifnz r3, r0, r2 -++/* [0x00000350] */ 0x119c87c0, 0xd00213a7, // shl rb14,r3,8 -++/* [0x00000358] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 -+-/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 -+-/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+-/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+-/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000360] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000368] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -++/* [0x00000370] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000378] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000380] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000003a8] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -++/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000003d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000003e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000003e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000003f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000003f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000400] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000408] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000410] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000418] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000420] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000428] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000430] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000438] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000440] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000448] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000450] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000458] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000460] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x00000468] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x00000470] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00000478] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000480] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00000488] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000490] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000498] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004b0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004c0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004c8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004e0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000004e8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000004f0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000004f8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000500] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000508] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000510] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000518] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000520] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000528] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000530] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000538] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000540] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000548] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000550] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000558] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000560] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000568] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000570] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000578] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000580] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000588] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000590] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000598] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d8] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000005e0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005e8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000005f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000610] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -++/* [0x00000618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x00000650] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -++/* [0x00000658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000660] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000668] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000670] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000680] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000690] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006a0] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x000006a8] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x000006b0] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006c0] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000006c8] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000006d0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000006d8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000006e0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000006e8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000006f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000006f8] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000700] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000708] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000710] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000720] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000728] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000740] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000748] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000750] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000758] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000760] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000768] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000770] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000778] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000780] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000788] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000790] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000798] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000007d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000007d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000007e0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000007e8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000007f0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000007f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000800] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000808] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000810] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000818] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000820] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000828] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000830] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000838] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000840] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000848] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000850] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000858] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000860] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000890] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -++/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000008d0] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a18] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a28] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a58] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a68] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_setup -+-/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+-/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+-/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -+-/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+-/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+-/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+-/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000ac0] */ 0x00000010, 0xe00208e7, // mov r3, 16 -++/* [0x00000ac8] */ 0x15827d80, 0x10020227, // mov ra8, unif -++/* [0x00000ad0] */ 0x15827d80, 0x10020267, // mov ra9, unif -++/* [0x00000ad8] */ 0x15827d80, 0x100202a7, // mov ra10, unif -++/* [0x00000ae0] */ 0x15827d80, 0x100202e7, // mov ra11, unif -++/* [0x00000ae8] */ 0x15827d80, 0x10020867, // mov r1, unif -++/* [0x00000af0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000af8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000b00] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000b08] */ 0x0d9c13c0, 0xd0021667, // sub rb_frame_width_minus_1,r1,1 -++/* [0x00000b10] */ 0x0d9c11c0, 0xd00217a7, // sub rb_frame_height_minus_1,r0,1 -++/* [0x00000b18] */ 0x15827d80, 0x10021427, // mov rb_pitch, unif -++/* [0x00000b20] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b28] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000b30] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000b38] */ 0x15227d80, 0x10020867, // mov r1, ra8 -++/* [0x00000b40] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000b48] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000b50] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000b58] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000b60] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000b68] */ 0x922591f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 -++/* [0x00000b70] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000b78] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00000b80] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000b88] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000b90] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000b98] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000ba0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000ba8] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -++/* [0x00000bb0] */ 0x152a7d80, 0x10020867, // mov r1, ra10 -++/* [0x00000bb8] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000bc0] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000bc8] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000bd0] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000bd8] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000be0] */ 0x922d91f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 -++/* [0x00000be8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000bf0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -++/* [0x00000bf8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000c00] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000c08] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000c10] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000c18] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000c20] */ 0x8c9e7452, 0x10025f19, // add t1s, r2, r1 ; mov ra_frame_base2, r2 -++/* [0x00000c28] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000c30] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000c38] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000c40] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000c48] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000c50] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000c58] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000c60] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00000c68] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00000c70] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00000c78] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00000c80] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00000c88] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00000c90] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00000c98] */ 0x00004000, 0xe00204a7, // mov ra18, 0x4000 -++/* [0x00000ca0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000ca8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000cb0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000cb8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000cc0] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000cc8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000cd0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000cd8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000ce0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000ce8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000cf0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000cf8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000d00] */ 0x15827d80, 0x10020867, // mov r1, unif -++/* [0x00000d08] */ 0x919c82ff, 0xd0024822, // shl r0,r1,r3 ; mov r2,8 -++/* [0x00000d10] */ 0x0f9e70c0, 0x10021367, // asr rb13,r0,r3 -++/* [0x00000d18] */ 0x0f9e72c0, 0x10021327, // asr rb12,r1,r3 -++/* [0x00000d20] */ 0x0c9cde80, 0x10021367, // add rb13,rb13,r2 -++/* [0x00000d28] */ 0x119cce80, 0x10021327, // shl rb12, rb12, r2 -++/* [0x00000d30] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000d38] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d40] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000d48] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d50] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000d58] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -++/* [0x00000d60] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+ /* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -+ /* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -+-// ::mc_filter -++/* [0x00000d78] */ 0x0c667380, 0x10020f27, // add t1s, r1, ra_frame_base2 -++// :per_block_setup -+ /* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ /* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+ /* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+ /* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000da0] */ 0x00000010, 0xe00208e7, // mov r3, 16 -++/* [0x00000da8] */ 0x15827d80, 0x10020867, // mov r1, unif -++/* [0x00000db0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000db8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000dc0] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000dc8] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000dd0] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000dd8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000de0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000de8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000df0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000df8] */ 0x8c827436, 0x100246a1, // add ra_frame_base_next, r2, r0 ; mov r1, unif -++/* [0x00000e00] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000e08] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000e10] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000e18] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000e20] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000e28] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000e30] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000e38] */ 0x159e7240, 0x10021067, // mov ra_y2_next, r1 -++/* [0x00000e40] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000e48] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x00000e50] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e58] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e60] */ 0x0e9e70c0, 0x10020867, // shr r1, r0, r3 -++/* [0x00000e68] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000e70] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000e78] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000e80] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000e88] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000e90] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000e98] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 -++/* [0x00000ea0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000ea8] */ 0x95801dbf, 0xd0024821, // mov r0, unif ; mov r1,1 -++/* [0x00000eb0] */ 0x4f5971c6, 0x10024260, // asr ra9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000eb8] */ 0x4f5971c6, 0x10024220, // asr ra8, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec0] */ 0x4f5971c6, 0x10044260, // asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec8] */ 0x0f9d71c0, 0x10040227, // asr.ifz ra8, r0, rb23 -++/* [0x00000ed0] */ 0x0d243f80, 0xd0020267, // sub ra9,3,ra9 -++/* [0x00000ed8] */ 0x0d203f80, 0xd0020227, // sub ra8,3,ra8 -++/* [0x00000ee0] */ 0x11243dc0, 0xd0020267, // shl ra9,ra9,3 -++/* [0x00000ee8] */ 0x11203dc0, 0xd0020227, // shl ra8,ra8,3 -++/* [0x00000ef0] */ 0x00ffff00, 0xe0020867, // mov r1,0xffff00 -++/* [0x00000ef8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f00] */ 0x0f9d71c0, 0x10020027, // asr ra0, r0, rb23 -++/* [0x00000f08] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+ /* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000f18] */ 0x01040400, 0xe0020867, // mov r1,0x1040400 -++/* [0x00000f20] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f28] */ 0x0f9d71c0, 0x10020067, // asr ra1, r0, rb23 -++/* [0x00000f30] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000f38] */ 0x0f9d71c0, 0x10021167, // asr rb5, r0, rb23 -++/* [0x00000f40] */ 0xfbf5f600, 0xe0020867, // mov r1,0xfbf5f600 -++/* [0x00000f48] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f50] */ 0x0f9d71c0, 0x100200a7, // asr ra2, r0, rb23 -++/* [0x00000f58] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000f60] */ 0x0f9d71c0, 0x100211a7, // asr rb6, r0, rb23 -++/* [0x00000f68] */ 0x11283a40, 0xe0020867, // mov r1,0x11283a40 -++/* [0x00000f70] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f78] */ 0x0f9d71c0, 0x100200e7, // asr ra3, r0, rb23 -++/* [0x00000f80] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000f88] */ 0x0f9d71c0, 0x100211e7, // asr rb7, r0, rb23 -++/* [0x00000f90] */ 0x3a281100, 0xe0020867, // mov r1,0x3a281100 -++/* [0x00000f98] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000fa0] */ 0x0f9d71c0, 0x10020127, // asr ra4, r0, rb23 -++/* [0x00000fa8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000fb0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000fb8] */ 0xf6f5fb00, 0xe0020867, // mov r1,0xf6f5fb00 -++/* [0x00000fc0] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000fc8] */ 0x0f9d71c0, 0x10020167, // asr ra5, r0, rb23 -++/* [0x00000fd0] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000fd8] */ 0x0f9d71c0, 0x10021267, // asr rb9, r0, rb23 -++/* [0x00000fe0] */ 0x04040100, 0xe0020867, // mov r1,0x4040100 -++/* [0x00000fe8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000ff0] */ 0x0f9d71c0, 0x100201a7, // asr ra6, r0, rb23 -++/* [0x00000ff8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00001000] */ 0x0f9d71c0, 0x100212a7, // asr rb10, r0, rb23 -++/* [0x00001008] */ 0xffff0000, 0xe0020867, // mov r1,0xffff0000 -++/* [0x00001010] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00001018] */ 0x0f9d71c0, 0x100201e7, // asr ra7, r0, rb23 -++/* [0x00001020] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00001028] */ 0x0f9d71c0, 0x100212e7, // asr rb11, r0, rb23 -++/* [0x00001030] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001038] */ 0x0f9e70c0, 0x100213e7, // asr rb15, r0, r3 -++/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001048] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 -++/* [0x00001050] */ 0x8f9c00ff, 0xd0024823, // asr r0, r0, r3 ; mov r3, 0 -++/* [0x00001058] */ 0x119c81c0, 0xd00213a7, // shl rb14, r0, 8 -++// ::mc_filter -+ // :yloop -+-/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001060] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001068] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++/* [0x00001070] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001078] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001080] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001088] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001090] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001098] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000010a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000010a8] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x000010b0] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000010b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000010c0] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000010c8] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -++/* [0x000010d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000010d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000010e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000010e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000010f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000010f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00001100] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001108] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001110] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001118] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001120] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001128] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001130] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001138] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001140] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001148] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001150] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001158] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001160] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 -++/* [0x00001168] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001170] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001178] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001180] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001188] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001190] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001198] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000011a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000011a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000011b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000011b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000011c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000011c8] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000011d0] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000011d8] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000011e0] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000011e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000011f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000011f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00001200] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x00001208] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x00001210] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00001218] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001220] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00001228] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001230] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001238] */ 0xfffffb28, 0xf0f809e7, // brr -, r:per_block_setup -++/* [0x00001240] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001248] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001250] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_b -+-/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 -+-/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -+-/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -+-/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -+-/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -+-/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -+-/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -+-/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -+-/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :yloopb -+-/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -+-/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -+-/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001258] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001260] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++/* [0x00001268] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001270] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001278] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001280] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001288] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001290] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001298] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000012a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x000012a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000012b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000012b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000012c0] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -++/* [0x000012c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000012d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000012d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000012e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000012e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000012f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000012f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001300] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001308] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001310] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001318] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001320] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001328] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001330] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001338] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001340] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001348] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001350] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001358] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 -++/* [0x00001360] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001368] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001370] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001378] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001380] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001388] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001390] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001398] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000013a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000013a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000013b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000013b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000013c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000013c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000013d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000013d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000013e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000013e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000013f0] */ 0x0f9ce3c0, 0xd0020827, // asr r0, r1, 14 -++/* [0x000013f8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00001400] */ 0x405b8006, 0xd00049e0, // nop ; mul24 r0, r0 << 8, ra22 << 8 -++/* [0x00001408] */ 0x0c4a7380, 0x10020867, // add r1, r1, ra18 -++/* [0x00001410] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00001418] */ 0xfffffe20, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001420] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00001428] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001430] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001438] */ 0xfffff928, 0xf0f809e7, // brr -, r:per_block_setup -++/* [0x00001440] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001448] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001450] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_interrupt_exit12 -+-/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001458] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001460] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001468] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001470] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001478] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001480] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001488] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001490] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001498] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000014e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000014e8] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_exit1 -++/* [0x000014f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000014f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001500] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001508] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001510] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001518] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001520] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001528] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 6e552d9..760bd17 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,15 +4,16 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 144) -+-#define mc_filter_uv_b0 (rpi_shader + 334) -+-#define mc_filter_uv_b (rpi_shader + 486) -+-#define mc_exit (rpi_shader + 662) -+-#define mc_interrupt_exit8 (rpi_shader + 680) -+-#define mc_setup (rpi_shader + 710) -+-#define mc_filter (rpi_shader + 864) -+-#define mc_filter_b (rpi_shader + 1104) -+-#define mc_interrupt_exit12 (rpi_shader + 1360) -+-#define mc_end (rpi_shader + 1398) -++#define mc_filter_uv (rpi_shader + 130) -++#define mc_filter_uv_b0 (rpi_shader + 312) -++#define mc_filter_uv_b (rpi_shader + 464) -++#define mc_exit (rpi_shader + 640) -++#define mc_interrupt_exit8 (rpi_shader + 658) -++#define mc_setup (rpi_shader + 688) -++#define mc_filter (rpi_shader + 1048) -++#define mc_filter_b (rpi_shader + 1174) -++#define mc_interrupt_exit12 (rpi_shader + 1302) -++#define mc_exit1 (rpi_shader + 1340) -++#define mc_end (rpi_shader + 1356) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index a0b8e5a..60d1ec2 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -21,6 +21,7 @@ -+ # -+ # ra16 clipped(row start address+elem_num)&~3 -+ # ra17 per-channel shifts -++# ra18 0x4000 -+ # ra19 next ra17 -+ # -+ # rb16 pitch -+@@ -86,7 +87,7 @@ -+ -+ -+ ################################################################################ -+-# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, offset, denom, vpm_id) -+ ::mc_setup_uv -+ -+ # Read starting kernel -+@@ -132,36 +133,6 @@ mov ra13, 0 -+ mov ra14, 0 -+ mov ra15, 0 -+ -+-# Compute part of VPM to use for DMA output -+-mov r3, unif -+-shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+-shl r0, r0, 5 -+-add rb27, r0, r1 -+- -+-# Compute part of VPM to save data into -+-shl r2, r3, 1 -+-and r2, r2, 15 # r2 = bcd0 -+-mov r1, r2 # r1 = bcd0 -+-asr r1, r1, 2 # r1 = bc -+-shl r1, r1, 6 # r1 = bc000000 -+-mov r0, r2 # r0 = bcd0 -+-and r0, r0, 3 # r0 = d0 -+-add r0, r0, r1 # r0 = bc0000d0 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+-add rb28, r0, r1 -+-asr r0, r0, 1 # r0 = bc0000d -+-# Prepare VPM command for 16bit intermediates -+-mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -+-add rb21, r0, r1 -+- -+ # Compute base address for first and second access -+ mov r0, ra_x # Load x -+ max r0, r0, 0; mov r1, ra_y # Load y -+@@ -175,10 +146,31 @@ min r1, r1, rb_frame_height_minus_1 -+ # submit texture requests for first line -+ add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ add t0s, r0, r1 ; mov ra_frame_base, r2 -+-add t0s, r2, r1 -++add t1s, r2, r1 -++ -++mov r2,8 -++shl rb12,unif, r2 # offset before shift -++add rb13,unif,r2 # offset after shift -++ -++# Compute part of VPM to use for DMA output -++mov r2, unif -++shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -+ -+-mov rb12,unif # offset before shift -+-mov rb13,unif # offset after shift -++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -++add rb28, r0, r1 # VPM 8bit storage -++asr r2, r0, 1 # r0 = bc0000d -++mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -++add rb21, r2, r1 # VPM for 16bit intermediates -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 # DMA out -+ -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+@@ -187,7 +179,7 @@ add ra_y, ra_y, 1 -+ bra -, ra31 -+ nop ; mul24 r1, r1, rb_pitch -+ add t0s, r1, ra_x -+-add t0s, r1, ra_frame_base -++add t1s, r1, ra_frame_base -+ -+ -+ -+@@ -248,17 +240,15 @@ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ mov r0, unif # U offset/weight -+ asr rb15, r0, r2 # Compute offset from MSBs -+ shl r0, r0, r2 -+-asr rb14, r0, r2 # Compute weight from LSBs -++asr r3, r0, r2 # Compute weight from LSBs -+ mov r0, unif # V offset/weight -+ asr.ifnz rb15, r0, r2 -+ shl r0, r0, r2 -+-asr.ifnz rb14, r0, r2 -++asr.ifnz r3, r0, r2 -++shl rb14,r3,8 # Scale up weights so we can use mul24 in signed fashion -+ -+ # r2 is elem_num -+ # r3 is loop counter -+- -+-mov r5rep, -8 -+- -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+ -+@@ -269,7 +259,7 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+@@ -278,7 +268,7 @@ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_frame_base, r2 -++add t1s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -301,11 +291,6 @@ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -+-mov rb12,32 # TODO remove these to make P weighted prediction work properly -+-mov rb13,6 -+-mov rb14,1 -+-mov rb15,0 -+- -+ # apply vertical filter and write to VPM -+ -+ nop ; mul24 r1, ra14, rb10 -+@@ -412,7 +397,7 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+@@ -421,7 +406,7 @@ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_frame_base, r2 -++add t1s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -542,7 +527,7 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+@@ -551,7 +536,7 @@ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_frame_base, r2 -++add t1s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -617,9 +602,9 @@ mov -, vw_wait # wait on the VDW -+ mov -,srel(0) -+ -+ ldtmu0 -++ldtmu1 -+ ldtmu0 -+-ldtmu0 -+-ldtmu0 -++ldtmu1 -+ -+ nop ; nop ; thrend -+ nop ; nop # delay slot 1 -+@@ -630,9 +615,9 @@ nop ; nop # delay slot 2 -+ mov -, vw_wait # wait on the VDW -+ -+ ldtmu0 -++ldtmu1 -+ ldtmu0 -+-ldtmu0 -+-ldtmu0 -++ldtmu1 -+ -+ mov -,sacq(0) # 1 -+ mov -,sacq(0) # 2 -+@@ -656,200 +641,249 @@ nop ; nop # delay slot 2 -+ # For P frames we make the second x,y coordinates offset by +8 -+ -+ ################################################################################ -+-# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) -++# mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) -+ ::mc_setup -++ mov r3, 16 -+ -+-# Read starting kernel -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-mov ra31, unif -+- -+-# Compute base address for first and second access -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl ra_xshift_next, r0, 3 # Compute shifts -+-add ra_y, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add r2, r2, r0 # r2 is address for frame0 (not including y offset) -+-max r1, r1, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+-add t0s, r2, r1 ; mov ra_frame_base, r2 -+- -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl rx_xshift2_next, r0, 3 # Compute shifts -+-add ra_y2, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add r2, r2, r0 # r2 is address for frame1 (not including y offset) -+-max r1, r1, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+-add t0s, r2, r1 ; mov ra_frame_base2, r2 -+- -++ # Need to save these because we need to know the frame dimensions before computing texture coordinates -++ mov ra8, unif -++ mov ra9, unif -++ mov ra10, unif -++ mov ra11, unif -+ -+ # Read image dimensions -+-sub rb25,unif,1 -+-sub rb30,unif,1 -++ mov r1, unif # width_height -++ shl r0,r1,r3 -++ asr r1,r1,r3 # width -++ asr r0,r0,r3 # height -++ sub rb_frame_width_minus_1,r1,1 -++ sub rb_frame_height_minus_1,r0,1 -+ -+ # get source pitch -+-mov rb16, unif -++ mov rb_pitch, unif -+ -+ # get destination pitch -+-mov r0, unif -+-mov r1, vdw_setup_1(0) -+-add rb24, r1, r0 -++ mov r0, unif -++ mov r1, vdw_setup_1(0) -++ add rb24, r1, r0 -+ -+-# load constants -+- -+-mov ra20, 1 -+-mov ra22, 256 -+-mov ra30, 64 -+- -+-mov rb20, 0xffffff00 -+-mov rb22, 255 -+-mov rb23, 24 -++# Compute base address for first and second access -++ mov r1, ra8 # y_x -++ shl r0,r1,r3 # r0 is x<<16 -++ asr r1,r1,r3 # r1 is y -++ asr r0,r0,r3 # r0 is x -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 # Load the frame base -++ shl ra_xshift_next, r0, 3 # Compute shifts -++ add ra_y, r1, 1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add r2, r2, r0 # r2 is address for frame0 (not including y offset) -++ max r1, r1, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++ add t0s, r2, r1 ; mov ra_frame_base, r2 -++ -++ mov r1, ra10 # y_x -++ shl r0,r1,r3 # r0 is x<<16 -++ asr r1,r1,r3 # r1 is y -++ asr r0,r0,r3 # r0 is x -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 # Load the frame base -++ shl rx_xshift2_next, r0, 3 # Compute shifts -++ add ra_y2, r1, 1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add r2, r2, r0 # r2 is address for frame1 (not including y offset) -++ max r1, r1, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++ add t1s, r2, r1 ; mov ra_frame_base2, r2 -+ -+-# touch vertical context to keep simulator happy -+ -+-mov ra8, 0 -+-mov ra9, 0 -+-mov ra10, 0 -+-mov ra11, 0 -+-mov ra12, 0 -+-mov ra13, 0 -+-mov ra14, 0 -+-mov ra15, 0 -++# load constants -+ -+-# Compute part of VPM to use for DMA output -+-mov r2, qpu_num -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+-shl r0, r0, 5 -+-add rb27, r0, r1 -++ mov ra20, 1 -++ mov ra22, 256 -++ mov ra30, 64 -+ -+-# Compute part of VPM to save data into -+-mov r2, qpu_num # qpu_num = abcd -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+-add rb28, r0, r1 -++ mov rb20, 0xffffff00 -++ mov rb22, 255 -++ mov rb23, 24 -+ -+-mov rb12,unif # offset before shift -+-mov rb13,unif # shift -++# touch vertical context to keep simulator happy -+ -+-# Dump padding words -+-mov r0, unif -++ mov ra8, 0 -++ mov ra9, 0 -++ mov ra10, 0 -++ mov ra11, 0 -++ mov ra12, 0 -++ mov ra13, 0 -++ mov ra14, 0 -++ mov ra15, 0 -++ mov ra18, 0x4000 -++ -++# Compute part of VPM to use -++ mov r2, qpu_num -++ mov r1, r2 -++ asr r1, r1, 2 -++ shl r1, r1, 6 -++ mov r0, r2 -++ and r0, r0, 3 -++ add r0, r0, r1 -++ mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -++ add rb28, r0, r1 # VPM for saving data -++ mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++ shl r0, r0, 5 -++ add rb27, r0, r1 # Command for dma output -++ -++# Weighted prediction denom -++ -++ mov r1, unif # offset_shift -++ shl r0,r1,r3 ; mov r2,8 -++ asr rb13,r0,r3 # shift -++ asr rb12,r1,r3 # offset -++ add rb13,rb13,r2 # mul24 is unsigned so scale up into high bits -++ shl rb12, rb12, r2 # Account for larger shift -+ -+ # submit texture requests for second line -+-max r1, ra_y, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 -+-nop ; mul24 r1, r1, rb_pitch -+-add t0s, r1, ra_frame_base -+- -+-max r1, ra_y2, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-bra -, ra31 -+-add ra_y2, ra_y2, 1 # Delay 1 -+-nop ; mul24 r1, r1, rb_pitch # Delay 2 -+-add t0s, r1, ra_frame_base2 # Delay 3 -+- -+- -+-################################################################################ -+- -+-# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -+-# In a P block, only the first half of coefficients contain used information. -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x, ra_x16_base point to the current coordinates for this block -+-::mc_filter -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-mov ra31, unif -++ max r1, ra_y, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ add ra_y, ra_y, 1 -++ nop ; mul24 r1, r1, rb_pitch -++ add t0s, r1, ra_frame_base -++ -++ max r1, ra_y2, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ add ra_y2, ra_y2, 1 -++ nop ; mul24 r1, r1, rb_pitch -++ add t1s, r1, ra_frame_base2 -++ -++# FALL THROUGHT TO PER-BLOCK SETUP -++ -++# Start of per-block setup code -++# P and B blocks share the same setup code to save on Icache space -++:per_block_setup -++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ mov ra31, unif -+ -+ # per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+-mov rx_xshift2, rx_xshift2_next -++ mov ra_xshift, ra_xshift_next -++ mov rx_xshift2, rx_xshift2_next -+ -+ # get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl ra_xshift_next, r0, 3 # Compute shifts -+-mov ra_y_next, r1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -+- -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0 ; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl rx_xshift2_next, r0, 3 # Compute shifts -+-add ra_y2_next, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+- -++ mov r3, 16 -++ mov r1, unif # y_x -++ shl r0,r1,r3 # r0 is x<<16 -++ asr r1,r1,r3 # r1 is y -++ asr r0,r0,r3 # r0 is x -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++ shl ra_xshift_next, r0, 3 # Compute shifts -++ mov ra_y_next, r1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add ra_frame_base_next, r2, r0 ; mov r1, unif # y2_x2 -++ -++ shl r0,r1,r3 # r0 is x2<<16 -++ asr r1,r1,r3 # r1 is y2 -++ asr r0,r0,r3 # r0 is x2 -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++ shl rx_xshift2_next, r0, 3 # Compute shifts -++ mov ra_y2_next, r1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+ -+ # set up VPM write -+-mov vw_setup, rb28 -++ mov vw_setup, rb28 -+ -+ # get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -++ mov r0, unif -++ shr r1, r0, r3 # Extract width -++ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++ and r0, r0, rb22 # Extract height -++ add rb17, r0, 5 -++ add rb18, r0, 7 -++ shl r0, r0, 7 -++ add r0, r0, r1 # Combine width and height of destination area -++ shl r0, r0, r3 # Shift into bits 16 upwards of the vdw_setup0 register -++ add rb26, r0, rb27 -+ -+ # get filter coefficients and discard unused B frame values -+-mov r0, unif -+-mov.ifnz -, unif # Alternate coefficients are unused for P frames -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-mov.ifnz -, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-mov.ifnz -, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-mov.ifnz -, unif -+-asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-asr rb4, r0, rb23 -+- -+-mov r0, unif # Frame0 offset/weight -+-mov.ifnz -, unif # Frame1 offset/weight unused -+-asr rb15, r0, r2 # Compute offset from MSBs -+-shl r0, r0, r2 -+-asr rb14, r0, r2 # Compute weight from LSBs -+- -+-# r3 is loop counter -++ mov r0, unif ; mov r1,1 # Packed filter offsets, unpack into ra8... (to be used for vertical context later) -++ asr ra9, r0, rb23; mul24 r0, r0, ra22 # my2 -++ asr ra8, r0, rb23; mul24 r0, r0, ra22 # mx2 -++ asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 # my:my2 -++ asr.ifz ra8, r0, rb23 # mx:mx2 -++ sub ra9,3,ra9 -++ sub ra8,3,ra8 -++ shl ra9,ra9,3 # Scale up by 8 -++ shl ra8,ra8,3 # Scale up by 8 -++# Now if we want aligned we have a mul of 1, so put 0 coefficients at the top -++ mov r1,0xffff00 -++ shl r0, r1, ra8 -++ asr ra0, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb4, r0, rb23 -++ -++ mov r1,0x1040400 -++ shl r0, r1, ra8 -++ asr ra1, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb5, r0, rb23 -++ -++ mov r1,0xfbf5f600 -++ shl r0, r1, ra8 -++ asr ra2, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb6, r0, rb23 -++ -++ mov r1,0x11283a40 -++ shl r0, r1, ra8 -++ asr ra3, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb7, r0, rb23 -++ -++ mov r1,0x3a281100 -++ shl r0, r1, ra8 -++ asr ra4, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb8, r0, rb23 -++ -++ mov r1,0xf6f5fb00 -++ shl r0, r1, ra8 -++ asr ra5, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb9, r0, rb23 -++ -++ mov r1,0x4040100 -++ shl r0, r1, ra8 -++ asr ra6, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb10, r0, rb23 -++ -++ mov r1,0xffff0000 -++ shl r0, r1, ra8 -++ asr ra7, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb11, r0, rb23 -++ -++# Extract weighted prediction information -++ mov r0, unif # offset/weight TODO move up -++ asr rb15, r0, r3 # Compute offset from MSBs -++ bra -, ra31 -++ shl r0, r0, r3 # Delay 1 -++ asr r0, r0, r3 ; mov r3, 0 # Compute weight from LSBs and reset loop counter Delay 2 -++ shl rb14, r0, 8 # Use a larger shift to avoid unsigned multiply problem Delay 3 -+ -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -++################################################################################ -++# mc_filter(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -++# In a P block, y2_x2 should be y_x+8 -++# At this point we have already issued two pairs of texture requests for the current block -+ -+-mov r3, 0 -++::mc_filter -+ -+ :yloop -+ # retrieve texture results and pick out bytes -+@@ -858,91 +892,90 @@ mov r3, 0 -+ # If we knew there was no clipping then this code would get simpler. -+ # Perhaps we could add on the pitch and clip using larger values? -+ -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, rx_xshift2 -+-mov.ifz ra_y2, ra_y2_next -++ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++ shr r1, r4, rx_xshift2 -++ mov.ifz ra_y2, ra_y2_next -+ -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y2, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ max r2, ra_y, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -++ max r2, ra_y2, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+ -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ # apply horizontal filter -+-nop ; mul24 r2, r0, ra0 -+-nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-nop ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-add r0, r2, r3 ; mov r3, rb31 -+-sub.setf -, r3, 8 ; mov ra12, ra13 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-brr.anyn -, r:yloop -+-mov ra13, ra14 # Delay slot 1 -+-mov ra14, ra15 # Delay slot 2 -+-mov ra15, r0 # Delay slot 3 -++ nop ; mul24 r2, r0, ra0 -++ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++ nop ; mul24 r3, ra1 << 1, r0 << 1 -++ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++ add r0, r2, r3 ; mov r3, rb31 -++ sub.setf -, r3, 8 ; mov ra8, ra9 -++ mov ra9, ra10 -++ mov ra10, ra11 -++ mov ra11, ra12 -++ mov ra12, ra13 -++ brr.anyn -, r:yloop -++ mov ra13, ra14 # Delay slot 1 -++ mov ra14, ra15 # Delay slot 2 -++ mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb10 -+-nop ; mul24 r0, ra13, rb9 -+-add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-add r1, r1, r0 ; mul24 r0, ra11, rb7 -+- -+-add r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-nop ; mul24 r1, r1, rb14 -+-add r1, r1, rb12 -+-asr r1, r1, rb13 -+-brr.anyn -, r:yloop -+-add r1, r1, rb15 # Delay 1 -+-min r1, r1, rb22 # Delay 2 -+-max vpm, r1, 0 # Delay 3 -++ nop ; mul24 r1, ra14, rb10 -++ nop ; mul24 r0, ra13, rb9 -++ add r1, r1, r0 ; mul24 r0, ra12, rb8 -++ add r1, r1, r0 ; mul24 r0, ra15, rb11 -++ add r1, r1, r0 ; mul24 r0, ra8, rb4 -++ add r1, r1, r0 ; mul24 r0, ra9, rb5 -++ add r1, r1, r0 ; mul24 r0, ra10, rb6 -++ add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++ add r1, r1, r0 ; mov -, vw_wait -++ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++ asr r1, r1, 14 -++ nop ; mul24 r1, r1, rb14 -++ add r1, r1, rb12 -++ asr r1, r1, rb13 -++ brr.anyn -, r:yloop -++ add r1, r1, rb15 # Delay 1 -++ min r1, r1, rb22 # Delay 2 -++ max vpm, r1, 0 # Delay 3 -+ -+ # DMA out -+ -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW setup 0 Delay 1 -+-mov vw_setup, rb29 # Stride Delay 2 -+-mov vw_addr, unif # start the VDW Delay 3 -++ brr -, r:per_block_setup -++ mov vw_setup, rb26 # VDW setup 0 Delay 1 -++ mov vw_setup, rb29 # Stride Delay 2 -++ mov vw_addr, unif # start the VDW Delay 3 -+ -+ -+ -+ ################################################################################ -+ -+-# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -++# mc_filter_b(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -+ # In a P block, only the first half of coefficients contain used information. -+ # At this point we have already issued two pairs of texture requests for the current block -+ # May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) -+@@ -952,92 +985,6 @@ mov vw_addr, unif # start the VDW Delay 3 -+ # Or possibly by taking advantage of symmetry? -+ # From 19->7 32bits per command. -+ ::mc_filter_b -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-mov ra31, unif -+- -+-# per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+-mov rx_xshift2, rx_xshift2_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl ra_xshift_next, r0, 3 # Compute shifts -+-mov ra_y_next, r1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -+- -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0 ; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl rx_xshift2_next, r0, 3 # Compute shifts -+-add ra_y2_next, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+- -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-# get filter coefficients and discard unused B frame values -+-mov r0, unif -+-mov r1, 1 -+-mov.ifnz r0, unif # Alternate coefficients are unused for P frames -+-nop ; mul24 r0, r0 << 13, r1 << 13 -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 14, r1 << 14 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-mov.ifnz r0, unif -+-nop ; mul24 r0, r0 << 9, r1 << 9 -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 10, r1 << 10 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 11, r1 << 11 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 12, r1 << 12 -+-asr ra4, r0, rb23; mov r0, unif -+-mov.ifnz r0, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-mov.ifnz r0, unif -+-asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-asr rb4, r0, rb23 -+- -+-mov r0, unif # Frame0 offset/weight -+-mov.ifnz r0, unif # Frame1 offset/weight unused -+-asr rb15, r0, r2 # Compute offset from MSBs -+-shl r0, r0, r2 -+-asr rb14, r0, r2 # Compute weight from LSBs -+- -+-# r3 is loop counter -+- -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-mov r3, 0 -+- -+ :yloopb -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+@@ -1045,111 +992,123 @@ mov r3, 0 -+ # If we knew there was no clipping then this code would get simpler. -+ # Perhaps we could add on the pitch and clip using larger values? -+ -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, rx_xshift2 -+-mov.ifz ra_y2, ra_y2_next -++ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++ shr r1, r4, rx_xshift2 -++ mov.ifz ra_y2, ra_y2_next -+ -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y2, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ max r2, ra_y, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -++ max r2, ra_y2, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+ -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ # apply horizontal filter -+-nop ; mul24 r2, r0, ra0 -+-nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-nop ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-add r0, r2, r3 ; mov r3, rb31 -+-sub.setf -, r3, 8 ; mov ra12, ra13 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-brr.anyn -, r:yloopb -+-mov ra13, ra14 # Delay slot 1 -+-mov ra14, ra15 # Delay slot 2 -+-mov ra15, r0 # Delay slot 3 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r1, ra14, rb10 -+-nop ; mul24 r0, ra13, rb9 -+-add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-add r1, r1, r0 ; mul24 r0, ra11, rb7 -+- -+-add r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves -+-add r1, r1, ra30 ; mul24 r0, r1, rb14 -+-add r1, r1, r0 -+-brr.anyn -, r:yloopb -+-asr r1, r1, 7 # Delay 1 -+-min r1, r1, rb22 # Delay 2 -+-max vpm, r1, 0 # Delay 3 -++ nop ; mul24 r2, r0, ra0 -++ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++ nop ; mul24 r3, ra1 << 1, r0 << 1 -++ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++ add r0, r2, r3 ; mov r3, rb31 -++ sub.setf -, r3, 8 ; mov ra8, ra9 -++ mov ra9, ra10 -++ mov ra10, ra11 -++ mov ra11, ra12 -++ mov ra12, ra13 -++ brr.anyn -, r:yloopb -++ mov ra13, ra14 # Delay slot 1 -++ mov ra14, ra15 # Delay slot 2 -++ mov ra15, r0 # Delay slot 3 -++ -++ # apply vertical filter and write to VPM -++ -++ nop ; mul24 r1, ra14, rb10 -++ nop ; mul24 r0, ra13, rb9 -++ add r1, r1, r0 ; mul24 r0, ra12, rb8 -++ add r1, r1, r0 ; mul24 r0, ra15, rb11 -++ add r1, r1, r0 ; mul24 r0, ra8, rb4 -++ add r1, r1, r0 ; mul24 r0, ra9, rb5 -++ add r1, r1, r0 ; mul24 r0, ra10, rb6 -++ add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++ add r1, r1, r0 ; mov -, vw_wait -++ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++ asr r0, r1, 14 -++ asr r1, r1, 6 # Wait state so we can use the rotate instruction -++ nop ; mul24 r0, r0 << 8, ra22 << 8 # Rotate to align left and right halves -++ add r1, r1, ra18 -++ add r1, r1, r0 -++ brr.anyn -, r:yloopb -++ asr r1, r1, 15 # Delay 1 -++ min r1, r1, rb22 # Delay 2 -++ max vpm, r1, 0 # Delay 3 -+ -+ # DMA out -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW setup 0 Delay 1 -+-mov vw_setup, rb29 # Stride Delay 2 -+-mov vw_addr, unif # start the VDW Delay 3 -++ brr -, r:per_block_setup -++ mov vw_setup, rb26 # VDW setup 0 Delay 1 -++ mov vw_setup, rb29 # Stride Delay 2 -++ mov vw_addr, unif # start the VDW Delay 3 -+ -+ ################################################################################ -+ -+ # mc_interrupt_exit12() -+ ::mc_interrupt_exit12 -+-mov -, vw_wait # wait on the VDW -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-mov -,sacq(0) # 1 -+-mov -,sacq(0) # 2 -+-mov -,sacq(0) # 3 -+-mov -,sacq(0) # 4 -+-mov -,sacq(0) # 5 -+-mov -,sacq(0) # 6 -+-mov -,sacq(0) # 7 -+-mov -,sacq(0) # 8 -+-mov -,sacq(0) # 9 -+-mov -,sacq(0) # 10 -+-mov -,sacq(0) # 11 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -++ mov -, vw_wait # wait on the VDW -++ -++ ldtmu0 -++ ldtmu0 -++ ldtmu1 -++ ldtmu1 -++ -++ mov -,sacq(0) # 1 -++ mov -,sacq(0) # 2 -++ mov -,sacq(0) # 3 -++ mov -,sacq(0) # 4 -++ mov -,sacq(0) # 5 -++ mov -,sacq(0) # 6 -++ mov -,sacq(0) # 7 -++ mov -,sacq(0) # 8 -++ mov -,sacq(0) # 9 -++ mov -,sacq(0) # 10 -++ mov -,sacq(0) # 11 -++ -++ nop ; nop ; thrend -++ mov interrupt, 1; nop # delay slot 1 -++ nop ; nop # delay slot 2 -++ -++ -++::mc_exit1 -++ mov -, vw_wait # wait on the VDW -++ -++ ldtmu0 -++ ldtmu1 -++ ldtmu0 -++ ldtmu1 -++ nop ; nop ; thrend -++ mov interrupt, 1; nop # delay slot 1 -++ nop ; nop # delay slot 2 -+ -+ -+ ::mc_end -+-- -+2.7.4 -+ -+ -+From f02ec34c772aad3caa17432c6a4860f9ed0d5dc6 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 10:58:25 +0100 -+Subject: [PATCH 48/68] Added option to simulate QPUs -+ -+--- -+ libavcodec/hevc.c | 288 +++++++++++++++++++++++++++++++++++++++++++-- -+ libavcodec/rpi_qpu.c | 24 ++-- -+ libavcodec/rpi_shader.qasm | 6 +- -+ 3 files changed, 295 insertions(+), 23 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 2da88ec..34d92e2 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -56,6 +56,8 @@ -+ // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory -+ // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. -+ -++ // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs -++ //#define RPI_SIMULATE_QPUS -+ -+ #endif -+ -+@@ -124,7 +126,6 @@ static void pic_arrays_free(HEVCContext *s) -+ -+ #ifdef EARLY_MALLOC -+ #else -+- printf("pic_arrays_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+ gpu_free(&s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = 0; -+@@ -174,11 +175,9 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ #ifdef RPI -+ #ifdef EARLY_MALLOC -+ #else -+- assert(sps); -++ av_assert0(sps); -+ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+- printf("pic_arrays_init\n"); -+- printf("Allocated %d\n",coefs_per_row); -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+ if (!s->coeffs_buf_arm[0]) -+@@ -2988,6 +2987,274 @@ static void rpi_inter_clear(HEVCContext *s) -+ #endif -+ } -+ -++ -++#ifdef RPI_SIMULATE_QPUS -++ -++static int32_t clipx(int x,int FRAME_WIDTH) -++{ -++ if (x<=0) return 0; -++ if (x>=FRAME_WIDTH) return FRAME_WIDTH-1; -++ return x; -++} -++ -++static int32_t clipy(int y,int FRAME_HEIGHT) -++{ -++ if (y<=0) return 0; -++ if (y>=FRAME_HEIGHT) return FRAME_HEIGHT-1; -++ return y; -++} -++ -++/*static int32_t filter8(uint8_t *data, int x0, int y0, int pitch, int mx, int my,int round,int denom,int weight,int offset) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ -++ for (y = 0; y < 8; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 8; x++) -++ hsum += lumaFilter[mx][x]*data[clipx(x + x0) + clipy(y + y0) * pitch]; -++ -++ vsum += lumaFilter[my][y]*hsum; -++ } -++ vsum >>= 6; -++ vsum = (((vsum*weight)+round)>>denom)+offset; -++ -++ return av_clip_uint8( vsum ); -++}*/ -++ -++static int32_t filter8_chroma(uint8_t *data, int x0, int y0, int pitch, int hcoeffs, int vcoeffs,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ int chromaFilterH[4]; -++ int chromaFilterV[4]; -++ int i; -++ int offset_after = offset_weight>>16; -++ int weight = (offset_weight<<16)>>16; -++ for(i=0;i<4;i++) { -++ chromaFilterH[i] = ((hcoeffs>>(8*i))<<24)>>24; -++ chromaFilterV[i] = ((vcoeffs>>(8*i))<<24)>>24; -++ } -++ -++ for (y = 0; y < 4; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 4; x++) -++ hsum += chromaFilterH[x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; -++ -++ vsum += chromaFilterV[y]*hsum; -++ } -++ vsum >>= 6; -++ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; -++ -++ return vsum; -++} -++ -++int lumaFilter[4][8]={ {0,0,0,64,0,0,0,0},{-1,4,-10,58,17,-5,1,0},{-1,4,-11,40,40,-11,4,-1},{0,1,-5,17,58,-10,4,-1} }; -++ -++static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ int i; -++ int offset_after = offset_weight>>16; -++ int weight = (offset_weight<<16)>>16; -++ -++ for (y = 0; y < 8; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 8; x++) -++ hsum += lumaFilter[my_mx&3][x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; -++ -++ vsum += lumaFilter[(my_mx>>8)&3][y]*hsum; -++ } -++ vsum >>= 6; -++ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; -++ -++ return vsum; -++} -++ -++static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) -++{ -++ //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; -++ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; -++ int pitch = frame->linesize[cIdx]; -++ uint32_t base = get_vc_address(frame->buf[cIdx]); -++ if (p>=base && pdata[cIdx] + (p-base); -++ } -++ return NULL; -++} -++ -++static uint8_t *compute_arm_addr(HEVCContext *s,uint32_t p, int cIdx) -++{ -++ SliceHeader *sh = &s->sh; -++ uint8_t *arm = test_frame(s,p,s->frame,cIdx); -++ int i; -++ if (arm) return arm; -++ if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) -++ { -++ for(i=0;inb_refs[L0];i++) { -++ arm = test_frame(s,p,s->ref->refPicList[0].ref[i]->frame,cIdx); -++ if (arm) return arm; -++ } -++ } -++ if (sh->slice_type == B_SLICE) { -++ for(i=0;inb_refs[L1];i++) { -++ arm = test_frame(s,p,s->ref->refPicList[1].ref[i]->frame,cIdx); -++ if (arm) return arm; -++ } -++ } -++ printf("Frame 0x%x not found! Exit=%x\n",p,qpu_get_fn(QPU_MC_EXIT)); -++ exit(-1); -++ return NULL; -++} -++ -++static void rpi_simulate_inter_chroma(HEVCContext *s,uint32_t *p) -++{ -++ uint32_t next_kernel; -++ uint32_t x0; -++ uint32_t y0; -++ uint8_t *ref_u_base; -++ uint8_t *ref_v_base; -++ uint32_t frame_width = p[5]; -++ uint32_t frame_height = p[6]; -++ uint32_t pitch = p[7]; -++ uint32_t dst_pitch = p[8]; -++ int32_t offset_before = p[9]; -++ int32_t denom = p[10]; -++ uint32_t vpm_id = p[11]; -++ uint32_t tmp_u_dst[256]; -++ uint32_t tmp_v_dst[256]; -++ while(1) { -++ p += 12; -++ next_kernel = p[0-12]; -++ x0 = p[1-12]; -++ y0 = p[2-12]; -++ if (next_kernel==s->mc_filter_uv || next_kernel==s->mc_filter_uv_b0 || next_kernel==s->mc_filter_uv_b) { -++ int x,y; -++ uint32_t width_height = p[5]; -++ uint32_t hcoeffs = p[6]; -++ uint32_t vcoeffs = p[7]; -++ uint32_t offset_weight_u = p[8]; -++ uint32_t offset_weight_v = p[9]; -++ uint8_t *this_u_dst; -++ uint8_t *this_v_dst; -++ uint32_t width = width_height >> 16; -++ uint32_t height = (width_height << 16) >> 16; -++ ref_u_base = compute_arm_addr(s,p[3-12],1); -++ ref_v_base = compute_arm_addr(s,p[4-12],2); -++ if (next_kernel!=s->mc_filter_uv_b0) -++ { -++ this_u_dst = compute_arm_addr(s,p[10],1); -++ this_v_dst = compute_arm_addr(s,p[11],2); -++ } -++ for (y=0; ymc_filter_uv) { -++ int32_t refa = filter8_chroma(ref_u_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_u,offset_before,denom,frame_width,frame_height); -++ int32_t refb = filter8_chroma(ref_v_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_v,offset_before,denom,frame_width,frame_height); -++ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); -++ } else if (next_kernel==s->mc_filter_uv_b0) { -++ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); -++ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); -++ tmp_u_dst[x+y*16] = refa; -++ tmp_v_dst[x+y*16] = refb; -++ } else { -++ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_u_dst[x+y*16], 7, frame_width, frame_height); -++ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_v_dst[x+y*16], 7, frame_width, frame_height); -++ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); -++ } -++ } -++ } -++ } else { -++ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT8) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); -++ break; -++ } -++ } -++} -++ -++// mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) -++static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p) -++{ -++ uint32_t next_kernel; -++ int y_x,y2_x2; -++ uint32_t x0; -++ uint32_t y0; -++ uint32_t x2; -++ uint32_t y2; -++ uint8_t *ref_y_base; -++ uint8_t *ref_y2_base; -++ uint32_t frame_width_height = p[4]; -++ uint32_t frame_width = frame_width_height>>16; -++ uint32_t frame_height = (frame_width_height<<16)>>16; -++ uint32_t pitch = p[5]; -++ uint32_t dst_pitch = p[6]; -++ int offset_shift = p[7]; -++ int32_t offset_before = offset_shift>>16; -++ int32_t denom = (offset_shift<<16)>>16; -++ while(1) { -++ p += 9; -++ next_kernel = p[8-9]; -++ y_x = p[0-9]; -++ x0 = (y_x<<16)>>16; -++ y0 = y_x>>16; -++ y2_x2 = p[2-9]; -++ x2 = (y2_x2<<16)>>16; -++ y2 = y2_x2>>16; -++ -++ if (next_kernel==s->mc_filter || next_kernel==s->mc_filter_b) { -++ // y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -++ int x,y; -++ uint32_t width_height = p[4]; -++ uint32_t my2_mx2_my_mx = p[5]; -++ uint32_t offset_weight = p[6]; -++ uint8_t *this_dst = compute_arm_addr(s,p[7],0); -++ uint32_t width = width_height >> 16; -++ uint32_t height = (width_height << 16) >> 16; -++ ref_y_base = compute_arm_addr(s,p[1-9],0); -++ ref_y2_base = compute_arm_addr(s,p[3-9],0); -++ for (y=0; ymc_filter) { -++ int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); -++ this_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ } -++ else { -++ int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); -++ int32_t refb = filter8_luma(ref_y2_base, x+x2, y+y2, pitch, my2_mx2_my_mx>>16, 1, 64 + refa, 7, frame_width, frame_height); -++ this_dst[x+y*dst_pitch] = av_clip_uint8(refb); -++ } -++ } -++ } -++ } else { -++ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT12) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); -++ break; -++ } -++ } -++} -++ -++static void rpi_simulate_inter_qpu(HEVCContext *s) -++{ -++ // First run the transform as normal -++ int i; -++ rpi_execute_transform(s); -++ for(i=0;i<8;i++) -++ { -++ rpi_simulate_inter_chroma(s,s->mvs_base[i]); -++ } -++ for(i=0;i<12;i++) -++ { -++ rpi_simulate_inter_luma(s,s->y_mvs_base[i]); -++ } -++} -++ -++#endif -++ -++ -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+ { -+ int k; -+@@ -3006,7 +3273,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+- assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -++ av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+@@ -3016,11 +3283,16 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -++ av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -+ } -+ s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ #endif -+ -++#ifdef RPI_SIMULATE_QPUS -++ rpi_simulate_inter_qpu(s); -++ s->vpu_id = -1; -++ return; -++#endif -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+@@ -3101,7 +3373,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -+ #endif -+ -+- /*if (!s->enable_rpi) { -++ if (!s->enable_rpi) { -+ if (s->ps.pps->cross_component_prediction_enabled_flag) -+ printf("Cross component\n"); -+ if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -+@@ -3110,7 +3382,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ printf("Weighted P slice\n"); -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+- }*/ -++ } -+ -+ #endif -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index e12304b..4480f72 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -13,7 +13,7 @@ -+ #include -+ #include -+ #include -+-#include -++#include "libavutil/avassert.h" -+ -+ #include "config.h" -+ -+@@ -160,13 +160,13 @@ static int gpu_init(volatile struct GPU **gpu) { -+ // Now copy over the QPU code into GPU memory -+ { -+ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); -+- assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -++ av_assert0(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -+ } -+ // And the VPU code -+ { -+ int num_bytes = sizeof(rpi_hevc_transform); -+- assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -++ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -+ // And the transform coefficients -+@@ -216,13 +216,13 @@ static void gpu_unlock(void) { -+ static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -+ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+- assert(p->vcsm_handle); -++ av_assert0(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+- assert(p->vc_handle); -++ av_assert0(p->vc_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+- assert(p->arm); -++ av_assert0(p->arm); -+ p->vc = mem_lock(mb, p->vc_handle); -+- assert(p->vc); -++ av_assert0(p->vc); -+ return 0; -+ } -+ -+@@ -243,7 +243,7 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -+ -+ int gpu_get_mailbox(void) -+ { -+- assert(gpu); -++ av_assert0(gpu); -+ return gpu->mb; -+ } -+ -+@@ -297,13 +297,13 @@ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); -+- assert(p->vcsm_handle); -++ av_assert0(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+- assert(p->vc_handle); -++ av_assert0(p->vc_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+- assert(p->arm); -++ av_assert0(p->arm); -+ p->vc = mem_lock(gpu->mb, p->vc_handle); -+- assert(p->vc); -++ av_assert0(p->vc); -+ return 0; -+ } -+ -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 60d1ec2..0686249 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -149,8 +149,8 @@ add t0s, r0, r1 ; mov ra_frame_base, r2 -+ add t1s, r2, r1 -+ -+ mov r2,8 -+-shl rb12,unif, r2 # offset before shift -+-add rb13,unif,r2 # offset after shift -++shl rb12,unif,r2 # offset before shift -++add rb13,unif,r2 # denominator -+ -+ # Compute part of VPM to use for DMA output -+ mov r2, unif -+@@ -185,7 +185,7 @@ add t1s, r1, ra_frame_base -+ -+ ################################################################################ -+ -+-# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -++# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, width_height, hcoeffs, vcoeffs, offset_weight_u, offset_weight_v, this_u_dst, this_v_dst) -+ -+ # At this point we have already issued two pairs of texture requests for the current block -+ # ra_x, ra_x16_base point to the current coordinates for this block -+-- -+2.7.4 -+ -+ -+From 8bdf6b06c612ff4971c2ce99a62d093cf92468ca Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 13:17:50 +0100 -+Subject: [PATCH 49/68] Increased motion vector memory and fixed block size -+ computation for non-multiple of 2 block sizes -+ -+--- -+ libavcodec/hevc.c | 50 +++++++++++++++++++++++++++++++------------------- -+ 1 file changed, 31 insertions(+), 19 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 34d92e2..3fb1e2a 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -83,11 +83,9 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ // Split image of 2048 into parts 64 wide -+ // So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -+-// Each block of 64*64 -+-// Smallest CTU size is 16x16, so smallest block is 8x8 -+-// Corresponds to a total of 83kbytes over all 12 QPUs -++// For each block of 64*64 the smallest block size is 8x4 -+ #define RPI_LUMA_COMMAND_WORDS 9 -+-#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) -++#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -+ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+@@ -2042,11 +2040,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ int bw = nPbW-start_x; -++ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -+@@ -2089,12 +2089,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ int bw = nPbW_c-start_x; -++ int bh = nPbH_c-start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+- *u++ = ( (nPbW_cy_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ int bw = nPbW-start_x; -++ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -+@@ -2189,12 +2193,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ int bw = nPbW_c-start_x; -++ int bh = nPbH_c-start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+- *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_my][0]; -+@@ -2246,11 +2252,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -++ int bw = nPbW-start_x; -++ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+- *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ *y++ = 1; // B frame weighted prediction not supported -+ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+@@ -2293,12 +2301,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ int bw = nPbW_c-start_x; -++ int bh = nPbH_c-start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+- *u++ = ( (nPbW_cframe->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+- *u++ = ( (nPbW_c> 16; -+ uint32_t height = (width_height << 16) >> 16; -++ uint8_t *dst_base = s->frame->data[0]; -+ ref_y_base = compute_arm_addr(s,p[1-9],0); -+ ref_y2_base = compute_arm_addr(s,p[3-9],0); -+ for (y=0; ymc_filter) { -+ int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); -+- this_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ refa = av_clip_uint8(refa); -++ this_dst[x+y*dst_pitch] = refa; -+ } -+ else { -+ int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); -+@@ -3248,7 +3261,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ } -+ for(i=0;i<12;i++) -+ { -+- rpi_simulate_inter_luma(s,s->y_mvs_base[i]); -++ rpi_simulate_inter_luma(s,s->y_mvs_base[i],i); -+ } -+ } -+ -+@@ -3290,7 +3303,6 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ #ifdef RPI_SIMULATE_QPUS -+ rpi_simulate_inter_qpu(s); -+- s->vpu_id = -1; -+ return; -+ #endif -+ -+-- -+2.7.4 -+ -+ -+From da5ae7e96dd961ccc7bc162c8acf336d54a50092 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 14:36:54 +0100 -+Subject: [PATCH 50/68] Added support for skip deblock -+ -+--- -+ libavcodec/hevc.c | 5 +++++ -+ libavcodec/hevc.h | 2 ++ -+ libavcodec/hevc_filter.c | 14 ++++---------- -+ 3 files changed, 11 insertions(+), 10 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 3fb1e2a..0ac4f4c 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3397,6 +3397,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ -+ #endif -++ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N); -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 5df9dcd..5cb90b5 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -890,6 +890,8 @@ typedef struct HEVCContext { -+ int width; -+ int height; -+ -++ int used_for_ref; -++ -+ #ifdef RPI -+ int enable_rpi; -+ HEVCMvCmd *unif_mv_cmds; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 11629e4..14a0952 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -512,16 +512,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->ps.pps->transquant_bypass_enable_flag; -+ -+ #ifdef DISABLE_DEBLOCK_NONREF -+- if ( s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N ) -++ if (!s->used_for_ref) -+ return; // Don't deblock non-reference frames -+ #endif -+ #ifdef DISABLE_DEBLOCK -+ return; -+ #endif -++ if (!s->used_for_ref && s->avctx->skip_loop_filter >= AVDISCARD_NONREF) -++ return; -+ -+ if (x0) { -+ left_tc_offset = s->deblock[ctb - 1].tc_offset; -+@@ -885,11 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { -+ -+ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+- if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N )) { -++ if (s->enable_rpi && s->used_for_ref) { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int curr_y = ((int *)f->progress->data)[0]; -+-- -+2.7.4 -+ -+ -+From 6401d88c310cd3bfec7be94bf3ceb6d0c5736c7e Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 15:22:52 +0100 -+Subject: [PATCH 51/68] Added support for skip_frame -+ -+--- -+ libavcodec/hevc.c | 15 ++++++++++----- -+ 1 file changed, 10 insertions(+), 5 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 0ac4f4c..639e4df 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3397,11 +3397,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ -+ #endif -+- s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N); -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+@@ -3925,6 +3920,16 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) -+ if (ret < 0) -+ return ret; -+ -++ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N); -++ -++ if (!s->used_for_ref && s->avctx->skip_frame >= AVDISCARD_NONREF) { -++ s->is_decoded = 0; -++ break; -++ } -+ if (s->max_ra == INT_MAX) { -+ if (s->nal_unit_type == NAL_CRA_NUT || IS_BLA(s)) { -+ s->max_ra = s->poc; -+-- -+2.7.4 -+ -+ -+From d2951e2ca73e234d1b775621e3993948a4a2c8ea Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 09:15:38 +0100 -+Subject: [PATCH 52/68] Fixed cache flushing of luma when using old method -+ -+--- -+ libavcodec/hevc_filter.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 14a0952..b286bbf 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -919,7 +919,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+ #ifdef RPI_LUMA_QPU -+- flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[0]); -+ #endif -+ -+ #endif -+-- -+2.7.4 -+ -+ -+From 7ae612e69c1cabcc7d0b37b65efa8c5bdcfa7bf5 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 11:37:27 +0100 -+Subject: [PATCH 53/68] Option to parallelise coefficient decode and inter -+ prediction and deblock for each frame -+ -+--- -+ libavcodec/hevc.c | 701 +++++++++++++++++++++++++++-------------- -+ libavcodec/hevc.h | 74 +++-- -+ libavcodec/hevc_cabac.c | 12 +- -+ libavcodec/hevcpred_template.c | 5 +- -+ 4 files changed, 522 insertions(+), 270 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 639e4df..12aacc5 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -43,8 +43,6 @@ -+ -+ #ifdef RPI -+ #include "rpi_qpu.h" -+- // For some unknown reason, the code seems to crash if I do a late malloc -+- //#define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -+ -+@@ -58,6 +56,21 @@ -+ -+ // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs -+ //#define RPI_SIMULATE_QPUS -++ #ifdef RPI_WORKER -++ #include "pthread.h" -++ #endif -++ -++ static void rpi_execute_dblk_cmds(HEVCContext *s); -++ static void rpi_execute_transform(HEVCContext *s); -++ static void rpi_execute_inter_qpu(HEVCContext *s); -++ static void rpi_execute_pred_cmds(HEVCContext *s); -++ static void rpi_execute_inter_cmds(HEVCContext *s); -++ static void rpi_inter_clear(HEVCContext *s); -++ -++ // Define INTER_PASS0 to do inter prediction in first pass -++ //#define INTER_PASS0 -++ // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 -++ //#define LAUNCH_PASS0 -+ -+ #endif -+ -+@@ -105,6 +118,143 @@ static uint32_t get_vc_address(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ return p->vc; -+ } -++#endif -++ -++ -++#ifdef RPI_WORKER -++ -++//#define LOG_ENTER printf("Enter %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); -++//#define LOG_EXIT printf("Exit %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); -++ -++#define LOG_ENTER -++#define LOG_EXIT -++ -++// Call this when we have completed pass0 and wish to trigger pass1 for the current job -++static void worker_submit_job(HEVCContext *s) -++{ -++ LOG_ENTER -++ //pthread_mutex_lock(&s->worker_mutex); -++ s->worker_tail++; // This is the only place that can change tail so we do not need the mutex -++ s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved -++ //pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call this to say we have completed pass1 -++static void worker_complete_middle_job(HEVCContext *s) -++{ -++ LOG_ENTER -++ //pthread_mutex_lock(&s->worker_mutex); -++ s->worker_middle++; // This is the only place that can change head so we do not need the mutex -++ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved -++ //pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call this to say we have completed pass2 -++static void worker_complete_job(HEVCContext *s) -++{ -++ LOG_ENTER -++ //pthread_mutex_lock(&s->worker_mutex); -++ s->worker_head++; // This is the only place that can change head so we do not need the mutex -++ s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved -++ //pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call this to wait for all jobs to have completed at the end of a frame -++static void worker_wait(HEVCContext *s) -++{ -++ LOG_ENTER -++ pthread_mutex_lock(&s->worker_mutex); -++ while( s->worker_head !=s->worker_tail) -++ { -++ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call worker_pass0_ready to wait until the s->pass0_job slot becomes -++// available to receive the next job. -++static void worker_pass0_ready(HEVCContext *s) -++{ -++ LOG_ENTER -++ pthread_mutex_lock(&s->worker_mutex); -++ // tail is number of submitted jobs -++ // head is number of completed jobs -++ // tail-head is number of outstanding jobs in the queue -++ // we need to ensure there is at least 1 space left for us to use -++ while( s->worker_tail - s->worker_head >= RPI_MAX_JOBS) -++ { -++ // Wait until another job is completed -++ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++static void *worker_start(void *arg) -++{ -++ HEVCContext *s = (HEVCContext *)arg; -++ while(1) { -++ pthread_mutex_lock(&s->worker_mutex); -++ -++ while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) -++ { -++ pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ -++ if (s->kill_worker) { -++ break; -++ } -++ LOG_ENTER -++ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++#ifndef LAUNCH_PASS0 -++ rpi_execute_inter_qpu(s); -++#endif -++#ifndef INTER_PASS0 -++ // Perform inter prediction -++ rpi_execute_inter_cmds(s); -++#endif -++ // Wait for transform completion -++ vpu_wait(s->vpu_id); -++ -++ worker_complete_middle_job(s); -++ LOG_EXIT -++ } -++ return NULL; -++} -++ -++static void *worker_deblock_start(void *arg) -++{ -++ HEVCContext *s = (HEVCContext *)arg; -++ while(1) { -++ pthread_mutex_lock(&s->worker_mutex); -++ while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) -++ { -++ pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ -++ if (s->kill_worker) { -++ break; -++ } -++ LOG_ENTER -++ // Perform intra prediction and residual reconstruction -++ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ rpi_execute_dblk_cmds(s); -++ -++ worker_complete_job(s); -++ LOG_EXIT -++ } -++ return NULL; -++} -+ -+ #endif -+ -+@@ -121,19 +271,18 @@ static uint32_t get_vc_address(AVBufferRef *bref) { -+ static void pic_arrays_free(HEVCContext *s) -+ { -+ #ifdef RPI -+- -+-#ifdef EARLY_MALLOC -+-#else -+- if (s->coeffs_buf_arm[0]) { -+- gpu_free(&s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = 0; -+- } -+- if (s->coeffs_buf_arm[2]) { -+- gpu_free(&s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = 0; -++ int job; -++ for(job=0;jobcoeffs_buf_arm[job][0]) { -++ gpu_free(&s->coeffs_buf_default[job]); -++ s->coeffs_buf_arm[job][0] = 0; -++ } -++ if (s->coeffs_buf_arm[job][2]) { -++ gpu_free(&s->coeffs_buf_accelerated[job]); -++ s->coeffs_buf_arm[job][2] = 0; -++ } -+ } -+ #endif -+-#endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+@@ -171,24 +320,26 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ int min_pu_size = sps->min_pu_width * sps->min_pu_height; -+ -+ #ifdef RPI -+-#ifdef EARLY_MALLOC -+-#else -+ av_assert0(sps); -+ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+- if (!s->coeffs_buf_arm[0]) -+- goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+- if (!s->coeffs_buf_arm[2]) -+- goto fail; -+- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+- printf("Done\n"); -+-#endif -++ int job; -++ for(job=0;jobcoeffs_buf_default[job]); -++ s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; -++ if (!s->coeffs_buf_arm[job][0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); -++ s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; -++ s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; -++ if (!s->coeffs_buf_arm[job][2]) -++ goto fail; -++ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; -++ s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; -++ } -++ } -+ #endif -+ -+ s->bs_width = (width >> 2) + 1; -+@@ -1036,7 +1187,7 @@ static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, -+ { -+ if (s->enable_rpi) { -+ HEVCLocalContext *lc = s->HEVClc; -+- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; -+ cmd->type = RPI_PRED_INTRA; -+ cmd->size = log2_trafo_size; -+ cmd->c_idx = c_idx; -+@@ -1496,7 +1647,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_LUMA_UNI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+@@ -1515,7 +1666,7 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_LUMA_BI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+@@ -1537,7 +1688,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_CHROMA_UNI; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+@@ -1555,7 +1706,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+@@ -2037,7 +2188,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[chan % 12]; -++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2057,7 +2208,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[chan % 12] = y; -++ s->y_mvs[s->pass0_job][chan % 12] = y; -+ } else -+ #endif -+ { -+@@ -2086,7 +2237,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[chan & 7]; -++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2110,7 +2261,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[chan & 7] = u; -++ s->u_mvs[s->pass0_job][chan & 7] = u; -+ return; -+ } -+ #endif -+@@ -2140,7 +2291,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[chan % 12]; -++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2160,7 +2311,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[chan % 12] = y; -++ s->y_mvs[s->pass0_job][chan % 12] = y; -+ } else -+ #endif -+ -+@@ -2190,7 +2341,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[chan & 7]; -++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2215,7 +2366,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[chan & 7] = u; -++ s->u_mvs[s->pass0_job][chan & 7] = u; -+ return; -+ } -+ #endif -+@@ -2249,7 +2400,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int x2 = x0 + (mv2->x >> 2); -+ int y2 = y0 + (mv2->y >> 2); -+ int chan = x0>>6; // 64 wide blocks per QPU -+- uint32_t *y = s->y_mvs[chan % 12]; -++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -+ int bw = nPbW-start_x; -+@@ -2265,7 +2416,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+- s->y_mvs[chan % 12] = y; -++ s->y_mvs[s->pass0_job][chan % 12] = y; -+ } else -+ #endif -+ { -+@@ -2298,7 +2449,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ -+- uint32_t *u = s->u_mvs[chan & 7]; -++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2327,7 +2478,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[chan & 7] = u; -++ s->u_mvs[s->pass0_job][chan & 7] = u; -+ return; -+ } -+ #endif -+@@ -2832,40 +2983,54 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ static void rpi_execute_dblk_cmds(HEVCContext *s) -+ { -+ int n; -++ int job = s->pass2_job; -+ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -+- int (*p)[2] = s->dblk_cmds; -+- for(n = s->num_dblk_cmds; n>0 ;n--,p++) { -++ int (*p)[2] = s->dblk_cmds[job]; -++ for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { -+ ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); -+ } -+- s->num_dblk_cmds = 0; -++ s->num_dblk_cmds[job] = 0; -+ } -+ -+ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -++#ifdef LAUNCH_PASS0 -++ int job = s->pass0_job; -++#else -++ int job = s->pass1_job; -++#endif -+ //int j; -+ //int16_t *coeffs = s->coeffs_buf_arm[i]; -+ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- gpu_cache_flush(&s->coeffs_buf_accelerated); -+- s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -++ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -++ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], -++ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], -++ s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); -+ //vpu_wait(s->vpu_id); -+ -+ for(i=0;i<4;i++) -+- s->num_coeffs[i] = 0; -++ s->num_coeffs[job][i] = 0; -+ } -+ -+ static void rpi_execute_pred_cmds(HEVCContext *s) -+ { -+ int i; -+- HEVCPredCmd *cmd = s->univ_pred_cmds; -++ int job = s->pass2_job; -++ HEVCPredCmd *cmd = s->univ_pred_cmds[job]; -++#ifdef RPI_WORKER -++ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -++#else -+ HEVCLocalContext *lc = s->HEVClc; -++#endif -+ -+- for(i = s->num_pred_cmds; i > 0; i--, cmd++) { -++ for(i = s->num_pred_cmds[job]; i > 0; i--, cmd++) { -++ //printf("i=%d cmd=%p job1=%d job0=%d\n",i,cmd,s->pass1_job,s->pass0_job); -+ if (cmd->type == RPI_PRED_INTRA) { -+ lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; -+ lc->na.cand_bottom_left = (cmd->na >> 4) & 1; -+@@ -2884,21 +3049,26 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ #endif -+ } -+ } -+- s->num_pred_cmds = 0; -++ s->num_pred_cmds[job] = 0; -+ } -+ -+ static void rpi_execute_inter_cmds(HEVCContext *s) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds; -++#ifdef INTER_PASS0 -++ int job = s->pass0_job; -++#else -++ int job = s->pass1_job; -++#endif -++ HEVCMvCmd *cmd = s->unif_mv_cmds[job]; -+ int n,cidx; -+ AVFrame myref; -+ AVFrame myref1; -+ struct MvField mymv; -+- if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { -++ if (s->num_mv_cmds[job] > RPI_MAX_MV_CMDS) { -+ printf("Overflow inter_cmds\n"); -+ exit(-1); -+ } -+- for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { -++ for(n = s->num_mv_cmds[job]; n>0 ; n--, cmd++) { -+ switch(cmd->cmd) { -+ case RPI_CMD_LUMA_UNI: -+ myref.data[0] = cmd->src; -+@@ -2938,7 +3108,28 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ break; -+ } -+ } -+- s->num_mv_cmds = 0; -++ s->num_mv_cmds[job] = 0; -++} -++ -++static void rpi_do_all_passes(HEVCContext *s) -++{ -++#ifdef RPI_INTER_QPU -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++#else -++ rpi_execute_transform(s); -++#endif -++ // Perform luma inter prediction -++ rpi_execute_inter_cmds(s); -++ // Wait for transform completion -++ vpu_wait(s->vpu_id); -++ // Perform intra prediction and residual reconstruction -++ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ rpi_execute_dblk_cmds(s); -++#ifdef RPI_INTER_QPU -++ rpi_inter_clear(s); -++#endif -+ } -+ -+ #endif -+@@ -2946,6 +3137,7 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ #ifdef RPI_INTER_QPU -+ static void rpi_inter_clear(HEVCContext *s) -+ { -++ int job = s->pass0_job; -+ int i; -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -+@@ -2953,51 +3145,50 @@ static void rpi_inter_clear(HEVCContext *s) -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+ for(i=0;i<8;i++) { -+- s->u_mvs[i] = s->mvs_base[i]; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = pic_width; -+- *s->u_mvs[i]++ = pic_height; -+- *s->u_mvs[i]++ = s->frame->linesize[1]; -+- *s->u_mvs[i]++ = s->frame->linesize[2]; -++ s->u_mvs[job][i] = s->mvs_base[job][i]; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = pic_width; -++ *s->u_mvs[job][i]++ = pic_height; -++ *s->u_mvs[job][i]++ = s->frame->linesize[1]; -++ *s->u_mvs[job][i]++ = s->frame->linesize[2]; -+ if (weight_flag) { -+- *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+- *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -++ *s->u_mvs[job][i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -++ *s->u_mvs[job][i]++ = s->sh.chroma_log2_weight_denom + 6; -+ } else { -+- *s->u_mvs[i]++ = 1 << 5; -+- *s->u_mvs[i]++ = 6; -++ *s->u_mvs[job][i]++ = 1 << 5; -++ *s->u_mvs[job][i]++ = 6; -+ } -+- *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -++ *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -+ } -+ -+ #ifdef RPI_LUMA_QPU -+ for(i=0;i<12;i++) { -+- s->y_mvs[i] = s->y_mvs_base[i]; -+- *s->y_mvs[i]++ = 0; // y_x -+- *s->y_mvs[i]++ = 0; // ref_y_base -+- *s->y_mvs[i]++ = 0; // y2_x2 -+- *s->y_mvs[i]++ = 0; // ref_y2_base -+- *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -+- *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch -+- *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch -++ s->y_mvs[job][i] = s->y_mvs_base[job][i]; -++ *s->y_mvs[job][i]++ = 0; // y_x -++ *s->y_mvs[job][i]++ = 0; // ref_y_base -++ *s->y_mvs[job][i]++ = 0; // y2_x2 -++ *s->y_mvs[job][i]++ = 0; // ref_y2_base -++ *s->y_mvs[job][i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -++ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // pitch -++ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // dst_pitch -+ if (weight_flag) { -+ int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); -+ int shift = s->sh.luma_log2_weight_denom + 6; -+- *s->y_mvs[i]++ = (offset << 16) + shift; -++ *s->y_mvs[job][i]++ = (offset << 16) + shift; -+ } else { -+ int offset = 1 << 5; -+ int shift = 6; -+- *s->y_mvs[i]++ = (offset << 16) + shift; -++ *s->y_mvs[job][i]++ = (offset << 16) + shift; -+ } -+- *s->y_mvs[i]++ = 0; // Next kernel -++ *s->y_mvs[job][i]++ = 0; // Next kernel -+ } -+ #endif -+ } -+ -+- -+ #ifdef RPI_SIMULATE_QPUS -+ -+ static int32_t clipx(int x,int FRAME_WIDTH) -+@@ -3271,10 +3462,15 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+ { -+ int k; -++#ifdef LAUNCH_PASS0 -++ int job = s->pass0_job; -++#else -++ int job = s->pass1_job; -++#endif -+ int i; -+- uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; -+ #ifdef RPI_LUMA_QPU -+- uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; -++ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr[job].vc; -+ #endif -+ if (s->sh.slice_type == I_SLICE) { -+ #ifdef RPI_MULTI_MAILBOX -+@@ -3283,22 +3479,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ #endif -+ } -+ for(k=0;k<8;k++) { -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+- av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -++ av_assert0(s->u_mvs[job][k] - s->mvs_base[job][k] < UV_COMMANDS_PER_QPU); -+ } -+ -+- s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ s->u_mvs[job][8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -+ #ifdef RPI_LUMA_QPU -+ for(k=0;k<12;k++) { -+- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -+- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ av_assert0(s->y_mvs[job][k] - s->y_mvs_base[job][k] < Y_COMMANDS_PER_QPU); -+ } -+- s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ s->y_mvs[job][12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ #endif -+ -+ #ifdef RPI_SIMULATE_QPUS -+@@ -3308,34 +3504,34 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+- gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); -++ gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -+ #else -+- gpu_cache_flush(&s->coeffs_buf_accelerated); -++ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ #endif -+- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ #ifdef RPI_LUMA_QPU -+ qpu_get_fn(QPU_MC_SETUP), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][0 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][1 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][2 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][3 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][4 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][5 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][6 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][7 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][8 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][9 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][10 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][11 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)) -+ #else -+ 0, -+ 0,0,0,0, -+@@ -3344,17 +3540,17 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ #endif -+ ); -+ for(i=0;i<4;i++) -+- s->num_coeffs[i] = 0; -++ s->num_coeffs[job][i] = 0; -+ #else -+ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -+- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)) -+ ); -+ #endif -+ -+@@ -3411,6 +3607,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ } -+ -++#ifdef RPI_WORKER -++ s->pass0_job = 0; -++ s->pass1_job = 0; -++ s->pass2_job = 0; -++#endif -+ #ifdef RPI_INTER_QPU -+ rpi_inter_clear(s); -+ #endif -+@@ -3431,46 +3632,42 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -++ -+ #ifdef RPI -+ if (s->enable_rpi) { -+- s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+- s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -++ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; -++ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+- // Transform all blocks -+- // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+-#ifdef RPI_MULTI_MAILBOX -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+- // Perform luma inter prediction -+- rpi_execute_inter_cmds(s); -+-#else -+- rpi_execute_transform(s); -+- // Perform inter prediction -+- rpi_execute_inter_cmds(s); -+-#ifdef RPI_INTER_QPU -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+-#endif -+-#endif -+- -+- // Wait for transform completion -+- vpu_wait(s->vpu_id); -+- -+- // Copy back reconstructed data -+- //memcpy(s->frame->data[0],s->dummy.arm,2048*64); -+- //memcpy(s->frame->data[1],s->dummy.arm,1024*32); -+- //memcpy(s->frame->data[2],s->dummy.arm,1024*32); -++#ifdef RPI_WORKER -++ if (s->used_for_ref) { -++ // Split work load onto separate threads so we make as rapid progress as possible with this frame -++ #ifdef INTER_PASS0 -++ rpi_execute_inter_cmds(s); -++ #endif -++ #ifdef LAUNCH_PASS0 -++ rpi_execute_inter_qpu(s); -++ #endif -++ // Pass on this job to worker thread -++ worker_submit_job(s); -++ // Make sure we have space to prepare the next job -++ worker_pass0_ready(s); -+ -+- // Perform intra prediction and residual reconstruction -+- rpi_execute_pred_cmds(s); -+- // Perform deblocking for CTBs in this row -+- rpi_execute_dblk_cmds(s); -++ // Prepare the next batch of commands -+ #ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -++ rpi_inter_clear(s); -++#endif -++ } else { -++ // Non-ref frame so do it all on this thread -++ rpi_do_all_passes(s); -++ } -++#else -++ rpi_do_all_passes(s); -+ #endif -+ } -+ } -+ #endif -++ -++ -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = -1; -+ return more_data; -+@@ -3487,18 +3684,21 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ -+ #ifdef RPI -+- if (s->enable_rpi && s->num_dblk_cmds) { -+-#ifdef RPI_INTER_QPU -+- rpi_execute_inter_qpu(s); -+-#endif -+-#ifndef RPI_MULTI_MAILBOX -+- rpi_execute_transform(s); -++ -++#ifdef RPI_WORKER -++ // Wait for the worker to finish all its jobs -++ if (s->enable_rpi) { -++ worker_wait(s); -++ av_assert0(s->pass0_job==s->pass1_job); -++ av_assert0(s->pass1_job==s->pass2_job); -++ } -+ #endif -+- rpi_execute_inter_cmds(s); -+- vpu_wait(s->vpu_id); -+- rpi_execute_pred_cmds(s); -+- rpi_execute_dblk_cmds(s); -++ -++ // Finish off any half-completed rows -++ if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { -++ rpi_do_all_passes(s); -+ } -++ -+ #endif -+ -+ if (x_ctb + ctb_size >= s->ps.sps->width && -+@@ -4230,6 +4430,48 @@ fail: -+ return AVERROR(ENOMEM); -+ } -+ -++#ifdef RPI_WORKER -++static av_cold void hevc_init_worker(HEVCContext *s) -++{ -++ int err; -++ pthread_cond_init(&s->worker_cond_head, NULL); -++ pthread_cond_init(&s->worker_cond_middle, NULL); -++ pthread_cond_init(&s->worker_cond_tail, NULL); -++ pthread_mutex_init(&s->worker_mutex, NULL); -++ -++ s->worker_tail=0; -++ s->worker_middle=0; -++ s->worker_head=0; -++ s->kill_worker=0; -++ err = pthread_create(&s->worker_thread, NULL, worker_start, s); -++ err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); -++ if (err) { -++ printf("Failed to create worker thread\n"); -++ exit(-1); -++ } -++} -++ -++static av_cold void hevc_exit_worker(HEVCContext *s) -++{ -++ void *res; -++ s->kill_worker=1; -++ pthread_cond_broadcast(&s->worker_cond_tail); -++ pthread_cond_broadcast(&s->worker_cond_middle); -++ pthread_join(s->worker_thread, &res); -++ pthread_join(s->worker_deblock_thread, &res); -++ -++ pthread_cond_destroy(&s->worker_cond_head); -++ pthread_cond_destroy(&s->worker_cond_middle); -++ pthread_cond_destroy(&s->worker_cond_tail); -++ pthread_mutex_destroy(&s->worker_mutex); -++ -++ s->worker_tail=0; -++ s->worker_middle=0; -++ s->worker_head=0; -++ s->kill_worker=0; -++} -++#endif -++ -+ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ { -+ HEVCContext *s = avctx->priv_data; -+@@ -4242,33 +4484,29 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->cabac_state); -+ -+ #ifdef RPI -+- av_freep(&s->unif_mv_cmds); -+- av_freep(&s->univ_pred_cmds); -++ -++#ifdef RPI_WORKER -++ hevc_exit_worker(s); -++#endif -++ -++ for(i=0;iunif_mv_cmds[i]); -++ av_freep(&s->univ_pred_cmds[i]); -+ -+ #ifdef RPI_INTER_QPU -+- if (s->unif_mvs) { -+- gpu_free( &s->unif_mvs_ptr ); -+- s->unif_mvs = 0; -+- } -++ if (s->unif_mvs[i]) { -++ gpu_free( &s->unif_mvs_ptr[i] ); -++ s->unif_mvs[i] = 0; -++ } -+ #endif -+ #ifdef RPI_LUMA_QPU -+- if (s->y_unif_mvs) { -+- gpu_free( &s->y_unif_mvs_ptr ); -+- s->y_unif_mvs = 0; -+- } -++ if (s->y_unif_mvs[i]) { -++ gpu_free( &s->y_unif_mvs_ptr[i] ); -++ s->y_unif_mvs[i] = 0; -++ } -+ #endif -+- -+-#ifdef EARLY_MALLOC -+- printf("hevc_decode_free\n"); -+- if (s->coeffs_buf_arm[0]) { -+- gpu_free(&s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = 0; -+- } -+- if (s->coeffs_buf_arm[2]) { -+- gpu_free(&s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = 0; -+ } -+-#endif -++ -+ #endif -+ -+ for (i = 0; i < 3; i++) { -+@@ -4328,6 +4566,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+ HEVCContext *s = avctx->priv_data; -+ int i; -++ int job; -+ -+ s->avctx = avctx; -+ -+@@ -4338,12 +4577,14 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->sList[0] = s; -+ -+ #ifdef RPI -+- s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -+- if (!s->unif_mv_cmds) -+- goto fail; -+- s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+- if (!s->univ_pred_cmds) -+- goto fail; -++ for(job=0;jobunif_mv_cmds[job] = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -++ if (!s->unif_mv_cmds[job]) -++ goto fail; -++ s->univ_pred_cmds[job] = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -++ if (!s->univ_pred_cmds[job]) -++ goto fail; -++ } -+ -+ #ifdef RPI_INTER_QPU -+ // We divide the image into blocks 256 wide and 64 high -+@@ -4354,18 +4595,20 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; -+ uint32_t *p; -++ for(job=0;jobunif_mvs_ptr ); -++ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); -+ #else -+- gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); -+ #endif -+- s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ s->unif_mvs[job] = (uint32_t *) s->unif_mvs_ptr[job].arm; -+ -+- // Set up initial locations for uniform streams -+- p = s->unif_mvs; -+- for(i = 0; i < 8; i++) { -+- s->mvs_base[i] = p; -++ // Set up initial locations for uniform streams -++ p = s->unif_mvs[job]; -++ for(i = 0; i < 8; i++) { -++ s->mvs_base[job][i] = p; -+ p += uv_commands_per_qpu; -++ } -+ } -+ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -+ s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); -+@@ -4374,61 +4617,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ } -+ #endif -+ #ifdef RPI_LUMA_QPU -++ for(job=0;joby_unif_mvs_ptr ); -++ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); -+ #else -+- gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -++ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); -+ #endif -+- s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ s->y_unif_mvs[job] = (uint32_t *) s->y_unif_mvs_ptr[job].arm; -+ -+ // Set up initial locations for uniform streams -+- p = s->y_unif_mvs; -++ p = s->y_unif_mvs[job]; -+ for(i = 0; i < 12; i++) { -+- s->y_mvs_base[i] = p; -++ s->y_mvs_base[job][i] = p; -+ p += y_commands_per_qpu; -+ } -+- s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -+- s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -+- -+ } -++ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -++ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -+ #endif -+ //gpu_malloc_uncached(2048*64,&s->dummy); -+ -+-#ifdef EARLY_MALLOC -+- { -+- int coeffs_in_ctb = 64*64; -+- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -+- s->coeffs_buf_arm[0] = 0; -+- s->coeffs_buf_arm[2] = 0; -+- printf("Allocated %d\n",coefs_per_row); -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+- if (!s->coeffs_buf_arm[0]) -+- goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+- if (!s->coeffs_buf_arm[2]) -+- goto fail; -+- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+- printf("Done\n"); -+-#ifdef RPI_PRECLEAR -+- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[2], coefs_per_row); -+- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+-#endif -+- } -+-#endif -+- -+ s->enable_rpi = 0; -+ -++#ifdef RPI_WORKER -++ hevc_init_worker(s); -++#endif -++ -+ #endif -+ -+ s->cabac_state = av_malloc(HEVC_CONTEXTS); -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 5cb90b5..7bd295a 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -51,6 +51,12 @@ -+ // Define RPI_LUMA_QPU to also use QPU for luma inter prediction -+ #define RPI_LUMA_QPU -+ #endif -++ -++ // By passing jobs to a worker thread we hope to be able to catch up during slow frames -++ #define RPI_MAX_JOBS 2 -++ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -++ #define RPI_WORKER -++ -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -806,6 +812,13 @@ typedef struct HEVCLocalContext { -+ int boundary_flags; -+ } HEVCLocalContext; -+ -++#ifdef RPI_WORKER -++typedef struct HEVCLocalContextIntra { -++ TransformUnit tu; -++ NeighbourAvailable na; -++} HEVCLocalContextIntra; -++#endif -++ -+ #ifdef RPI -+ -+ // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+@@ -874,7 +887,7 @@ typedef struct HEVCPredCmd { -+ -+ typedef struct HEVCContext { -+ #ifdef RPI -+- int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; -++ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -+ #endif -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+@@ -883,7 +896,9 @@ typedef struct HEVCContext { -+ -+ HEVCLocalContext *HEVClcList[MAX_NB_THREADS]; -+ HEVCLocalContext *HEVClc; -+- -++#ifdef RPI_WORKER -++ HEVCLocalContextIntra HEVClcIntra; -++#endif -+ uint8_t threads_type; -+ uint8_t threads_number; -+ -+@@ -894,43 +909,60 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI -+ int enable_rpi; -+- HEVCMvCmd *unif_mv_cmds; -+- HEVCPredCmd *univ_pred_cmds; -++ HEVCMvCmd *unif_mv_cmds[RPI_MAX_JOBS]; -++ HEVCPredCmd *univ_pred_cmds[RPI_MAX_JOBS]; -+ int buf_width; -+- GPU_MEM_PTR_T coeffs_buf_default; -+- GPU_MEM_PTR_T coeffs_buf_accelerated; -+- int16_t *coeffs_buf_arm[4]; -+- unsigned int coeffs_buf_vc[4]; -+- int num_coeffs[4]; -+- int num_xfm_cmds; -+- int num_mv_cmds; -+- int num_pred_cmds; -+- int num_dblk_cmds; -++ GPU_MEM_PTR_T coeffs_buf_default[RPI_MAX_JOBS]; -++ GPU_MEM_PTR_T coeffs_buf_accelerated[RPI_MAX_JOBS]; -++ int16_t *coeffs_buf_arm[RPI_MAX_JOBS][4]; -++ unsigned int coeffs_buf_vc[RPI_MAX_JOBS][4]; -++ int num_coeffs[RPI_MAX_JOBS][4]; -++ int num_xfm_cmds[RPI_MAX_JOBS]; -++ int num_mv_cmds[RPI_MAX_JOBS]; -++ int num_pred_cmds[RPI_MAX_JOBS]; -++ int num_dblk_cmds[RPI_MAX_JOBS]; -+ int vpu_id; -+ //GPU_MEM_PTR_T dummy; -++ int pass0_job; // Pass0 does coefficient decode -++ int pass1_job; // Pass1 does pixel processing -++ int pass2_job; // Pass2 does reconstruction and deblocking -+ #ifdef RPI_INTER_QPU -+- GPU_MEM_PTR_T unif_mvs_ptr; -+- uint32_t *unif_mvs; // Base of memory for motion vector commands -++ GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; -++ uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+ -+ // _base pointers are to the start of the row -+- uint32_t *mvs_base[8]; -++ uint32_t *mvs_base[RPI_MAX_JOBS][8]; -+ // these pointers are to the next free space -+- uint32_t *u_mvs[8]; -++ uint32_t *u_mvs[RPI_MAX_JOBS][8]; -+ // Function pointers -+ uint32_t mc_filter_uv; -+ uint32_t mc_filter_uv_b0; -+ uint32_t mc_filter_uv_b; -+ #endif -+ #ifdef RPI_LUMA_QPU -+- GPU_MEM_PTR_T y_unif_mvs_ptr; -+- uint32_t *y_unif_mvs; // Base of memory for motion vector commands -+- uint32_t *y_mvs_base[12]; -+- uint32_t *y_mvs[12]; -++ GPU_MEM_PTR_T y_unif_mvs_ptr[RPI_MAX_JOBS]; -++ uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -++ uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; -++ uint32_t *y_mvs[RPI_MAX_JOBS][12]; -+ // Function pointers -+ uint32_t mc_filter; -+ uint32_t mc_filter_b; -+ #endif -+ -++#ifdef RPI_WORKER -++ pthread_t worker_thread; -++ pthread_t worker_deblock_thread; -++ pthread_cond_t worker_cond_head; -++ pthread_cond_t worker_cond_tail; -++ pthread_cond_t worker_cond_middle; -++ pthread_mutex_t worker_mutex; -++ -++ int worker_tail; // Contains the number of posted jobs -++ int worker_head; // Contains the number of completed jobs -++ int worker_middle; // Contains the number of completed jobs -++ int kill_worker; // set to 1 to terminate the worker -++#endif -++ -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 38f53de..f0982cd 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1051,11 +1051,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+ if (use_vpu) { -+- coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; -+- s->num_coeffs[log2_trafo_size - 2] += n; -++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -++ s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; -+ } else { -+- coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; -+- s->num_coeffs[0] += n; -++ coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; -++ s->num_coeffs[s->pass0_job][0] += n; -+ } -+ } -+ // We now do the memset after transform_add while we know the data is cached. -+@@ -1508,7 +1508,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); -+ } -+ } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { -+- s->hevcdsp.idct_4x4_luma(coeffs); -++ s->hevcdsp.idct_4x4_luma(coeffs); -+ } else { -+ #ifdef RPI -+ if (!use_vpu) { -+@@ -1553,7 +1553,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ #ifdef RPI -+ if (s->enable_rpi) { -+- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+ cmd->buf = coeffs; -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 71c6d52..344e021 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -71,8 +71,11 @@ do { \ -+ AV_WN4P(&ptr[i], a); \ -+ else \ -+ a = PIXEL_SPLAT_X4(ptr[i + 3]) -+- -++#ifdef RPI_WORKER -++ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -++#else -+ HEVCLocalContext *lc = s->HEVClc; -++#endif -+ int i; -+ int hshift = s->ps.sps->hshift[c_idx]; -+ int vshift = s->ps.sps->vshift[c_idx]; -+-- -+2.7.4 -+ -+ -+From 1e0885f8d98175777fff65b4cedd708176c2abcf Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 13:43:48 +0100 -+Subject: [PATCH 54/68] Avoid lockup bug with RPI_WORKER enabled -+ -+--- -+ libavcodec/hevc.c | 22 +++++++++++----------- -+ libavcodec/hevc_cabac.c | 1 - -+ 2 files changed, 11 insertions(+), 12 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 12aacc5..182a82f 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -133,11 +133,11 @@ static uint32_t get_vc_address(AVBufferRef *bref) { -+ static void worker_submit_job(HEVCContext *s) -+ { -+ LOG_ENTER -+- //pthread_mutex_lock(&s->worker_mutex); -+- s->worker_tail++; // This is the only place that can change tail so we do not need the mutex -++ pthread_mutex_lock(&s->worker_mutex); -++ s->worker_tail++; -+ s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved -+- //pthread_mutex_unlock(&s->worker_mutex); -++ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+ } -+ -+@@ -145,11 +145,11 @@ static void worker_submit_job(HEVCContext *s) -+ static void worker_complete_middle_job(HEVCContext *s) -+ { -+ LOG_ENTER -+- //pthread_mutex_lock(&s->worker_mutex); -+- s->worker_middle++; // This is the only place that can change head so we do not need the mutex -++ pthread_mutex_lock(&s->worker_mutex); -++ s->worker_middle++; -+ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved -+- //pthread_mutex_unlock(&s->worker_mutex); -++ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved -++ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+ } -+ -+@@ -157,11 +157,11 @@ static void worker_complete_middle_job(HEVCContext *s) -+ static void worker_complete_job(HEVCContext *s) -+ { -+ LOG_ENTER -+- //pthread_mutex_lock(&s->worker_mutex); -+- s->worker_head++; // This is the only place that can change head so we do not need the mutex -++ pthread_mutex_lock(&s->worker_mutex); -++ s->worker_head++; -+ s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+- pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved -+- //pthread_mutex_unlock(&s->worker_mutex); -++ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved -++ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+ } -+ -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index f0982cd..6523e66 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1497,7 +1497,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < 8; i++) -+ FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); -+ } -+- -+ s->hevcdsp.transform_skip(coeffs, log2_trafo_size); -+ -+ if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && -+-- -+2.7.4 -+ -+ -+From 1d7ad81069dec6914ec7e9983855d7a1b5e4b123 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 15:37:19 +0100 -+Subject: [PATCH 55/68] Added code to flush buffers at start of frame -+ -+--- -+ libavcodec/hevc.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 72 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 182a82f..e5b9f1e 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -43,6 +43,7 @@ -+ -+ #ifdef RPI -+ #include "rpi_qpu.h" -++ #include "rpi_user_vcsm.h" -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -+ -+@@ -3508,6 +3509,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ #else -+ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ #endif -++ -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+@@ -3558,6 +3560,71 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ } -+ #endif -+ -++#ifdef RPI -++ -++static void flush_buffer(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ gpu_cache_flush(p); -++} -++ -++static void flush_frame(HEVCContext *s,AVFrame *frame) -++{ -++#if 1 -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int n = s->ps.sps->height; -++ int curr_y = 0; -++ int curr_uv = 0; -++ int n_uv = n >> s->ps.sps->vshift[1]; -++ int sz,base; -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = p->arm + base; -++ iocache.s[1].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = p->arm + base; -++ iocache.s[2].size = sz; -++ vcsm_clean_invalid( &iocache ); -++#else -++ flush_buffer(frame->buf[0]); -++ flush_buffer(frame->buf[1]); -++ flush_buffer(frame->buf[2]); -++#endif -++} -++ -++static void flush_all(HEVCContext *s) -++{ -++#if 0 -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 4; // Flush all -++ iocache.s[0].addr = p->arm; -++ iocache.s[0].size = 4096; -++ vcsm_clean_invalid( &iocache ); -++#else -++ int i,k; -++ for(i=0;i<2;i++) { -++ for (k = 0; k < s->sh.nb_refs[i]; k++) { -++ flush_frame(s,s->ref->refPicList[i].ref[k]->frame); -++ } -++ } -++ flush_frame(s,s->frame); -++#endif -++} -++#endif -++ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ { -+ HEVCContext *s = avctxt->priv_data; -+@@ -3592,8 +3659,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ printf("Weighted B slice\n"); -+ } -+ -++ // Now flush all reference frames and our destination frame to get everything ready for decode -++ flush_all(s); -+ #endif -+ -++ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -++ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+ return AVERROR_INVALIDDATA; -+@@ -3664,6 +3735,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ rpi_do_all_passes(s); -+ #endif -+ } -++ -+ } -+ #endif -+ -+-- -+2.7.4 -+ -+ -+From 7a57f233dcd4048e20a0b5bc06bc20abb589d3fa Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 16:42:24 +0100 -+Subject: [PATCH 56/68] Reduce the amount that needs to be flushed -+ -+--- -+ libavcodec/hevc.c | 35 +++++++++++------------------------ -+ 1 file changed, 11 insertions(+), 24 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index e5b9f1e..73d7f74 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3569,7 +3569,7 @@ static void flush_buffer(AVBufferRef *bref) { -+ -+ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+-#if 1 -++#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+@@ -3603,26 +3603,6 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ #endif -+ } -+ -+-static void flush_all(HEVCContext *s) -+-{ -+-#if 0 -+- struct vcsm_user_clean_invalid_s iocache = {}; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); -+- iocache.s[0].handle = p->vcsm_handle; -+- iocache.s[0].cmd = 4; // Flush all -+- iocache.s[0].addr = p->arm; -+- iocache.s[0].size = 4096; -+- vcsm_clean_invalid( &iocache ); -+-#else -+- int i,k; -+- for(i=0;i<2;i++) { -+- for (k = 0; k < s->sh.nb_refs[i]; k++) { -+- flush_frame(s,s->ref->refPicList[i].ref[k]->frame); -+- } -+- } -+- flush_frame(s,s->frame); -+-#endif -+-} -+ #endif -+ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+@@ -3658,9 +3638,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+ } -+- -+- // Now flush all reference frames and our destination frame to get everything ready for decode -+- flush_all(s); -+ #endif -+ -+ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -+@@ -4130,6 +4107,11 @@ static int hevc_frame_start(HEVCContext *s) -+ if (!s->avctx->hwaccel) -+ ff_thread_finish_setup(s->avctx); -+ -++#ifdef RPI_INTER_QPU -++ // Invalidate the output data buffer so it is ready for the QPUs to write into it. -++ flush_frame(s,s->frame); -++#endif -++ -+ return 0; -+ -+ fail: -+@@ -4331,6 +4313,11 @@ fail: -+ ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -++ } else if (s->ref) { -++#ifdef RPI_INTER_QPU -++ // When running single threaded we need to flush the whole frame -++ flush_frame(s,s->frame); -++#endif -+ } -+ return ret; -+ } -+-- -+2.7.4 -+ -+ -+From 26eba8e3266cc5f2120e8284a1ce486d6a402010 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 4 Jun 2015 07:59:28 +0100 -+Subject: [PATCH 57/68] Corrected support for disabled rpi when using -+ RPI_WORKER -+ -+--- -+ libavcodec/hevc.h | 18 ++++++++++-------- -+ libavcodec/hevcpred_template.c | 2 +- -+ 2 files changed, 11 insertions(+), 9 deletions(-) -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 7bd295a..3cb34bd 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -769,7 +769,17 @@ typedef struct HEVCFrame { -+ uint8_t flags; -+ } HEVCFrame; -+ -++#ifdef RPI_WORKER -++typedef struct HEVCLocalContextIntra { -++ TransformUnit tu; -++ NeighbourAvailable na; -++} HEVCLocalContextIntra; -++#endif -++ -+ typedef struct HEVCLocalContext { -++ TransformUnit tu; -++ NeighbourAvailable na; // WARNING tu and na must be the first two fields to match HEVCLocalContextIntra -++ -+ uint8_t cabac_state[HEVC_CONTEXTS]; -+ -+ uint8_t stat_coeff[4]; -+@@ -784,7 +794,6 @@ typedef struct HEVCLocalContext { -+ -+ int qPy_pred; -+ -+- TransformUnit tu; -+ -+ uint8_t ctb_left_flag; -+ uint8_t ctb_up_flag; -+@@ -801,7 +810,6 @@ typedef struct HEVCLocalContext { -+ int ct_depth; -+ CodingUnit cu; -+ PredictionUnit pu; -+- NeighbourAvailable na; -+ -+ #define BOUNDARY_LEFT_SLICE (1 << 0) -+ #define BOUNDARY_LEFT_TILE (1 << 1) -+@@ -812,12 +820,6 @@ typedef struct HEVCLocalContext { -+ int boundary_flags; -+ } HEVCLocalContext; -+ -+-#ifdef RPI_WORKER -+-typedef struct HEVCLocalContextIntra { -+- TransformUnit tu; -+- NeighbourAvailable na; -+-} HEVCLocalContextIntra; -+-#endif -+ -+ #ifdef RPI -+ -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 344e021..325b60e 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -72,7 +72,7 @@ do { \ -+ else \ -+ a = PIXEL_SPLAT_X4(ptr[i + 3]) -+ #ifdef RPI_WORKER -+- HEVCLocalContextIntra *lc = &s->HEVClcIntra; -++ HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -+ #else -+ HEVCLocalContext *lc = s->HEVClc; -+ #endif -+-- -+2.7.4 -+ -+ -+From 5b3eee9be88a5326df7621de95095def969e05a8 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 4 Jun 2015 11:52:55 +0100 -+Subject: [PATCH 58/68] Draft support for tiles -+ -+--- -+ libavcodec/hevc.c | 140 +++++++++++++++++++++++------------------ -+ libavcodec/hevc.h | 21 +++++-- -+ libavcodec/hevc_filter.c | 2 +- -+ libavcodec/hevcpred_template.c | 2 +- -+ 4 files changed, 99 insertions(+), 66 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 73d7f74..ec67252 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -63,10 +63,10 @@ -+ -+ static void rpi_execute_dblk_cmds(HEVCContext *s); -+ static void rpi_execute_transform(HEVCContext *s); -+- static void rpi_execute_inter_qpu(HEVCContext *s); -++ static void rpi_launch_vpu_qpu(HEVCContext *s); -+ static void rpi_execute_pred_cmds(HEVCContext *s); -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+- static void rpi_inter_clear(HEVCContext *s); -++ static void rpi_begin(HEVCContext *s); -+ -+ // Define INTER_PASS0 to do inter prediction in first pass -+ //#define INTER_PASS0 -+@@ -90,16 +90,18 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ #ifdef RPI_INTER_QPU -+ -++// Each luma QPU processes 2*RPI_NUM_CHUNKS 64x64 blocks -++// Each chroma QPU processes 3*RPI_NUM_CHUNKS 64x64 blocks, but requires two commands for B blocks -++// For each block of 64*64 the smallest block size is 8x4 -++// We also need an extra command for the setup information -++ -+ #define RPI_CHROMA_COMMAND_WORDS 12 -+-#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -++#define UV_COMMANDS_PER_QPU ((1 + 3*RPI_NUM_CHUNKS*(64*64)*2/(8*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -+-// Split image of 2048 into parts 64 wide -+-// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -+-// For each block of 64*64 the smallest block size is 8x4 -+ #define RPI_LUMA_COMMAND_WORDS 9 -+-#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -++#define Y_COMMANDS_PER_QPU ((1+2*RPI_NUM_CHUNKS*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -+ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+@@ -216,7 +218,7 @@ static void *worker_start(void *arg) -+ LOG_ENTER -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ #ifndef LAUNCH_PASS0 -+- rpi_execute_inter_qpu(s); -++ rpi_launch_vpu_qpu(s); -+ #endif -+ #ifndef INTER_PASS0 -+ // Perform inter prediction -+@@ -322,9 +324,14 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ -+ #ifdef RPI -+ av_assert0(sps); -+- int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+- int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -++ int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -++ int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; -++ int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; -++ int coefs_per_row = coefs_per_luma + coefs_per_chroma; -+ int job; -++ s->max_ctu_count = coefs_per_luma / coefs_in_ctb; -++ s->ctu_per_y_chan = s->max_ctu_count / 12; -++ s->ctu_per_uv_chan = s->max_ctu_count / 8; -+ for(job=0;jobx >> 2); -+ int y1 = y0 + (mv->y >> 2); -+- int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -++ uint32_t *y = s->curr_y_mvs; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2209,7 +2215,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[s->pass0_job][chan % 12] = y; -++ s->curr_y_mvs = y; -+ } else -+ #endif -+ { -+@@ -2233,12 +2239,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+- int chan = x0>>8; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -++ uint32_t *u = s->curr_u_mvs; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2262,7 +2266,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[s->pass0_job][chan & 7] = u; -++ s->curr_u_mvs = u; -+ return; -+ } -+ #endif -+@@ -2289,10 +2293,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -+ int x1 = x0 + (mv->x >> 2); -+ int y1 = y0 + (mv->y >> 2); -+- int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -++ uint32_t *y = s->curr_y_mvs; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2312,7 +2315,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[s->pass0_job][chan % 12] = y; -++ s->curr_y_mvs = y; -+ } else -+ #endif -+ -+@@ -2337,12 +2340,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+- int chan = x0>>8; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -++ uint32_t *u = s->curr_u_mvs; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2367,7 +2368,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[s->pass0_job][chan & 7] = u; -++ s->curr_u_mvs = u; -+ return; -+ } -+ #endif -+@@ -2400,8 +2401,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int y1 = y0 + (mv->y >> 2); -+ int x2 = x0 + (mv2->x >> 2); -+ int y2 = y0 + (mv2->y >> 2); -+- int chan = x0>>6; // 64 wide blocks per QPU -+- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -++ uint32_t *y = s->curr_y_mvs; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -+ int bw = nPbW-start_x; -+@@ -2417,7 +2417,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+- s->y_mvs[s->pass0_job][chan % 12] = y; -++ s->curr_y_mvs = y; -+ } else -+ #endif -+ { -+@@ -2448,9 +2448,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int x2_c = x0_c + (mv2->x >> (2 + hshift)); -+ int y2_c = y0_c + (mv2->y >> (2 + hshift)); -+ -+- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ -+- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -++ uint32_t *u = s->curr_u_mvs; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2479,7 +2478,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[s->pass0_job][chan & 7] = u; -++ s->curr_u_mvs = u; -+ return; -+ } -+ #endif -+@@ -3114,12 +3113,8 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ -+ static void rpi_do_all_passes(HEVCContext *s) -+ { -+-#ifdef RPI_INTER_QPU -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+-#else -+- rpi_execute_transform(s); -+-#endif -++ // Kick off QPUs and VPUs -++ rpi_launch_vpu_qpu(s); -+ // Perform luma inter prediction -+ rpi_execute_inter_cmds(s); -+ // Wait for transform completion -+@@ -3128,18 +3123,18 @@ static void rpi_do_all_passes(HEVCContext *s) -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+-#ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -+-#endif -++ // Prepare next batch -++ rpi_begin(s); -+ } -+ -+ #endif -+ -+-#ifdef RPI_INTER_QPU -+-static void rpi_inter_clear(HEVCContext *s) -++#ifdef RPI -++static void rpi_begin(HEVCContext *s) -+ { -+ int job = s->pass0_job; -+ int i; -++#ifdef RPI_INTER_QPU -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+@@ -3165,6 +3160,8 @@ static void rpi_inter_clear(HEVCContext *s) -+ } -+ *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -+ } -++ s->curr_u_mvs = s->u_mvs[job][0]; -++#endif -+ -+ #ifdef RPI_LUMA_QPU -+ for(i=0;i<12;i++) { -+@@ -3187,8 +3184,11 @@ static void rpi_inter_clear(HEVCContext *s) -+ } -+ *s->y_mvs[job][i]++ = 0; // Next kernel -+ } -++ s->curr_y_mvs = s->y_mvs[job][0]; -+ #endif -++ s->ctu_count = 0; -+ } -++#endif -+ -+ #ifdef RPI_SIMULATE_QPUS -+ -+@@ -3459,8 +3459,9 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ -+ #endif -+ -++#ifdef RPI_INTER_QPU -+ -+-static void rpi_execute_inter_qpu(HEVCContext *s) -++static void rpi_launch_vpu_qpu(HEVCContext *s) -+ { -+ int k; -+ #ifdef LAUNCH_PASS0 -+@@ -3558,6 +3559,15 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ -+ } -++#else -++ -++#ifdef RPI -++static void rpi_launch_vpu_qpu(HEVCContext *s) -++{ -++ rpi_execute_transform(s); -++} -++#endif -++ -+ #endif -+ -+ #ifdef RPI -+@@ -3617,29 +3627,20 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI -+ #ifdef RPI_INTER_QPU -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+- && s->ps.sps->width <= RPI_MAX_WIDTH -+ && !s->ps.pps->cross_component_prediction_enabled_flag -+- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -+ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -+ #else -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+- && s->ps.sps->width <= RPI_MAX_WIDTH -+- && !s->ps.pps->cross_component_prediction_enabled_flag -+- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -++ && !s->ps.pps->cross_component_prediction_enabled_flag; -+ #endif -+ -+ if (!s->enable_rpi) { -+ if (s->ps.pps->cross_component_prediction_enabled_flag) -+ printf("Cross component\n"); -+- if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -+- printf("Tiles\n"); -+- if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -+- printf("Weighted P slice\n"); -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+ } -+ #endif -+- -+ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+@@ -3660,8 +3661,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->pass1_job = 0; -+ s->pass2_job = 0; -+ #endif -+-#ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -++#ifdef RPI -++ rpi_begin(s); -+ #endif -+ -+ while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { -+@@ -3679,13 +3680,34 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -++#ifdef RPI_INTER_QPU -++ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; -++#endif -++#ifdef RPI_LUMA_QPU -++ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; -++#endif -++ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ -++#ifdef RPI_INTER_QPU -++ s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; -++#endif -++#ifdef RPI_LUMA_QPU -++ s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; -++#endif -++ -+ #ifdef RPI -+ if (s->enable_rpi) { -++ //av_assert0(s->num_dblk_cmds[s->pass0_job]>=0); -++ //av_assert0(s->num_dblk_cmds[s->pass0_job]pass0_jobpass0_job>=0); -+ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; -+ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; -+- if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -++ s->ctu_count++; -++ //printf("%d %d/%d job=%d\n",s->ctu_count,s->num_dblk_cmds[s->pass0_job],RPI_MAX_DEBLOCK_CMDS,s->pass0_job); -++ -++ if ( s->ctu_count >= s->max_ctu_count ) { -+ #ifdef RPI_WORKER -+ if (s->used_for_ref) { -+ // Split work load onto separate threads so we make as rapid progress as possible with this frame -+@@ -3693,7 +3715,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ rpi_execute_inter_cmds(s); -+ #endif -+ #ifdef LAUNCH_PASS0 -+- rpi_execute_inter_qpu(s); -++ rpi_launch_vpu_qpu(s); -+ #endif -+ // Pass on this job to worker thread -+ worker_submit_job(s); -+@@ -3701,9 +3723,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ worker_pass0_ready(s); -+ -+ // Prepare the next batch of commands -+-#ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -+-#endif -++ rpi_begin(s); -+ } else { -+ // Non-ref frame so do it all on this thread -+ rpi_do_all_passes(s); -+@@ -3744,7 +3764,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #endif -+ -+ // Finish off any half-completed rows -+- if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { -++ if (s->enable_rpi && s->ctu_count) { -+ rpi_do_all_passes(s); -+ } -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 3cb34bd..a141316 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -823,8 +823,15 @@ typedef struct HEVCLocalContext { -+ -+ #ifdef RPI -+ -++// The processing is done in chunks -++// Each chunk corresponds to 24 64x64 luma blocks (24 so it is divisible by 8 for chroma and 12 for luma) -++// This is a distance of 1536 pixels across the screen -++// Increasing RPI_NUM_CHUNKS will reduce time spent activating QPUs and cache flushing, -++// but allocate more memory and increase the latency before data in the next frame can be processed -++#define RPI_NUM_CHUNKS 1 -++ -+ // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+-#define RPI_MAX_WIDTH 2048 -++#define RPI_MAX_WIDTH (RPI_NUM_CHUNKS*64*24) -+ -+ // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -+ #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+@@ -888,9 +895,6 @@ typedef struct HEVCPredCmd { -+ #endif -+ -+ typedef struct HEVCContext { -+-#ifdef RPI -+- int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -+-#endif -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+ -+@@ -928,6 +932,10 @@ typedef struct HEVCContext { -+ int pass0_job; // Pass0 does coefficient decode -+ int pass1_job; // Pass1 does pixel processing -+ int pass2_job; // Pass2 does reconstruction and deblocking -++ int ctu_count; // Number of CTUs done in pass0 so far -++ int max_ctu_count; // Number of CTUs when we trigger a round of processing -++ int ctu_per_y_chan; // Number of CTUs per luma QPU -++ int ctu_per_uv_chan; // Number of CTUs per chroma QPU -+ #ifdef RPI_INTER_QPU -+ GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; -+ uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+@@ -936,6 +944,7 @@ typedef struct HEVCContext { -+ uint32_t *mvs_base[RPI_MAX_JOBS][8]; -+ // these pointers are to the next free space -+ uint32_t *u_mvs[RPI_MAX_JOBS][8]; -++ uint32_t *curr_u_mvs; // Current uniform stream to use for chroma -+ // Function pointers -+ uint32_t mc_filter_uv; -+ uint32_t mc_filter_uv_b0; -+@@ -946,6 +955,7 @@ typedef struct HEVCContext { -+ uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+ uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; -+ uint32_t *y_mvs[RPI_MAX_JOBS][12]; -++ uint32_t *curr_y_mvs; // Current uniform stream for luma -+ // Function pointers -+ uint32_t mc_filter; -+ uint32_t mc_filter_b; -+@@ -1084,6 +1094,9 @@ typedef struct HEVCContext { -+ uint32_t max_mastering_luminance; -+ uint32_t min_mastering_luminance; -+ -++#ifdef RPI -++ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -++#endif -+ } HEVCContext; -+ -+ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index b286bbf..1f04790 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -891,7 +891,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+ if (curr_uv < 0) curr_uv = 0; -+- if (n_uv<=curr_uv) { assert(0); return; } // Should not happen -++ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 325b60e..28d2653 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -72,7 +72,7 @@ do { \ -+ else \ -+ a = PIXEL_SPLAT_X4(ptr[i + 3]) -+ #ifdef RPI_WORKER -+- HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -++ HEVCLocalContextIntra *lc = (s->enable_rpi) ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -+ #else -+ HEVCLocalContext *lc = s->HEVClc; -+ #endif -+-- -+2.7.4 -+ -+ -+From 1674a80d147e5342ef6ea9a4fb4ddfc640c15a05 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 4 Jun 2015 15:48:10 +0100 -+Subject: [PATCH 59/68] Move deblocker into second pass -+ -+--- -+ libavcodec/hevc.c | 79 +++++++++++++++++++++++++++++++++++++++++++++---------- -+ 1 file changed, 65 insertions(+), 14 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ec67252..6cecbdd 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -67,6 +67,8 @@ -+ static void rpi_execute_pred_cmds(HEVCContext *s); -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+ static void rpi_begin(HEVCContext *s); -++ static void flush_frame(HEVCContext *s,AVFrame *frame); -++ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -+ // Define INTER_PASS0 to do inter prediction in first pass -+ //#define INTER_PASS0 -+@@ -227,6 +229,11 @@ static void *worker_start(void *arg) -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -++ // Perform intra prediction and residual reconstruction -++ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ rpi_execute_dblk_cmds(s); -++ -+ worker_complete_middle_job(s); -+ LOG_EXIT -+ } -+@@ -248,10 +255,6 @@ static void *worker_deblock_start(void *arg) -+ break; -+ } -+ LOG_ENTER -+- // Perform intra prediction and residual reconstruction -+- rpi_execute_pred_cmds(s); -+- // Perform deblocking for CTBs in this row -+- rpi_execute_dblk_cmds(s); -+ -+ worker_complete_job(s); -+ LOG_EXIT -+@@ -2983,7 +2986,7 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ static void rpi_execute_dblk_cmds(HEVCContext *s) -+ { -+ int n; -+- int job = s->pass2_job; -++ int job = s->pass1_job; -+ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -+ int (*p)[2] = s->dblk_cmds[job]; -+ for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { -+@@ -3021,7 +3024,7 @@ static void rpi_execute_transform(HEVCContext *s) -+ static void rpi_execute_pred_cmds(HEVCContext *s) -+ { -+ int i; -+- int job = s->pass2_job; -++ int job = s->pass1_job; -+ HEVCPredCmd *cmd = s->univ_pred_cmds[job]; -+ #ifdef RPI_WORKER -+ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -+@@ -3506,11 +3509,10 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+- gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -+ #else -+- gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); -+ #endif -+- -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+@@ -3613,6 +3615,60 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ #endif -+ } -+ -++static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -++{ -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int n = s->ps.sps->height; -++ int curr_y = 0; -++ int curr_uv = 0; -++ int n_uv = n >> s->ps.sps->vshift[1]; -++ int sz,base; -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = p->arm + base; -++ iocache.s[1].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = p->arm + base; -++ iocache.s[2].size = sz; -++ -++ iocache.s[3].handle = p0->vcsm_handle; -++ iocache.s[3].cmd = 3; // clean+invalidate -++ iocache.s[3].addr = (int) p0->arm; -++ iocache.s[3].size = p0->numbytes; -++ if (p1) { -++ iocache.s[4].handle = p1->vcsm_handle; -++ iocache.s[4].cmd = 3; // clean+invalidate -++ iocache.s[4].addr = (int) p1->arm; -++ iocache.s[4].size = p1->numbytes; -++ } -++ if (p2) { -++ iocache.s[5].handle = p2->vcsm_handle; -++ iocache.s[5].cmd = 3; // clean+invalidate -++ iocache.s[5].addr = (int) p2->arm; -++ iocache.s[5].size = p2->numbytes; -++ } -++ vcsm_clean_invalid( &iocache ); -++#else -++ flush_buffer(frame->buf[0]); -++ flush_buffer(frame->buf[1]); -++ flush_buffer(frame->buf[2]); -++ gpu_cache_flush3(p0, p1, p2); -++#endif -++} -++ -+ #endif -+ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+@@ -4127,11 +4183,6 @@ static int hevc_frame_start(HEVCContext *s) -+ if (!s->avctx->hwaccel) -+ ff_thread_finish_setup(s->avctx); -+ -+-#ifdef RPI_INTER_QPU -+- // Invalidate the output data buffer so it is ready for the QPUs to write into it. -+- flush_frame(s,s->frame); -+-#endif -+- -+ return 0; -+ -+ fail: -+-- -+2.7.4 -+ -+ -+From a453fe438c4ab311d6476955d0a40a5d2ed8a1c6 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 4 Jun 2015 16:10:23 +0100 -+Subject: [PATCH 60/68] Change order of ctu accesses to improve qpu performance -+ -+--- -+ libavcodec/hevc.c | 8 ++++---- -+ 1 file changed, 4 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 6cecbdd..ec17e64 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3737,19 +3737,19 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ #ifdef RPI_INTER_QPU -+- s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; -++ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count % 8]; -+ #endif -+ #ifdef RPI_LUMA_QPU -+- s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; -++ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count % 12]; -+ #endif -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ -+ #ifdef RPI_INTER_QPU -+- s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; -++ s->u_mvs[s->pass0_job][s->ctu_count % 8]= s->curr_u_mvs; -+ #endif -+ #ifdef RPI_LUMA_QPU -+- s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; -++ s->y_mvs[s->pass0_job][s->ctu_count % 12] = s->curr_y_mvs; -+ #endif -+ -+ #ifdef RPI -+-- -+2.7.4 -+ -+ -+From 504de0435e8f660c1b7b2d6ec053dc922a2d2896 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 8 Jun 2015 09:36:59 +0100 -+Subject: [PATCH 61/68] Removed deblocker thread -+ -+--- -+ libavcodec/hevc.c | 77 +++---------------------------------------------------- -+ libavcodec/hevc.h | 4 --- -+ 2 files changed, 4 insertions(+), 77 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ec17e64..1868532 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -70,11 +70,6 @@ -+ static void flush_frame(HEVCContext *s,AVFrame *frame); -+ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -+- // Define INTER_PASS0 to do inter prediction in first pass -+- //#define INTER_PASS0 -+- // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 -+- //#define LAUNCH_PASS0 -+- -+ #endif -+ -+ // #define DISABLE_MC -+@@ -147,24 +142,12 @@ static void worker_submit_job(HEVCContext *s) -+ } -+ -+ // Call this to say we have completed pass1 -+-static void worker_complete_middle_job(HEVCContext *s) -+-{ -+- LOG_ENTER -+- pthread_mutex_lock(&s->worker_mutex); -+- s->worker_middle++; -+- s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved -+- pthread_mutex_unlock(&s->worker_mutex); -+- LOG_EXIT -+-} -+- -+-// Call this to say we have completed pass2 -+ static void worker_complete_job(HEVCContext *s) -+ { -+ LOG_ENTER -+ pthread_mutex_lock(&s->worker_mutex); -+ s->worker_head++; -+- s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved -+ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+@@ -208,7 +191,7 @@ static void *worker_start(void *arg) -+ while(1) { -+ pthread_mutex_lock(&s->worker_mutex); -+ -+- while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) -++ while( !s->kill_worker && s->worker_tail - s->worker_head <= 0) -+ { -+ pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); -+ } -+@@ -219,13 +202,9 @@ static void *worker_start(void *arg) -+ } -+ LOG_ENTER -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+-#ifndef LAUNCH_PASS0 -+ rpi_launch_vpu_qpu(s); -+-#endif -+-#ifndef INTER_PASS0 -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+-#endif -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+@@ -234,28 +213,6 @@ static void *worker_start(void *arg) -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+ -+- worker_complete_middle_job(s); -+- LOG_EXIT -+- } -+- return NULL; -+-} -+- -+-static void *worker_deblock_start(void *arg) -+-{ -+- HEVCContext *s = (HEVCContext *)arg; -+- while(1) { -+- pthread_mutex_lock(&s->worker_mutex); -+- while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) -+- { -+- pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); -+- } -+- pthread_mutex_unlock(&s->worker_mutex); -+- -+- if (s->kill_worker) { -+- break; -+- } -+- LOG_ENTER -+- -+ worker_complete_job(s); -+ LOG_EXIT -+ } -+@@ -2998,11 +2955,7 @@ static void rpi_execute_dblk_cmds(HEVCContext *s) -+ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -+-#ifdef LAUNCH_PASS0 -+- int job = s->pass0_job; -+-#else -+ int job = s->pass1_job; -+-#endif -+ //int j; -+ //int16_t *coeffs = s->coeffs_buf_arm[i]; -+ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+@@ -3057,11 +3010,7 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ -+ static void rpi_execute_inter_cmds(HEVCContext *s) -+ { -+-#ifdef INTER_PASS0 -+- int job = s->pass0_job; -+-#else -+ int job = s->pass1_job; -+-#endif -+ HEVCMvCmd *cmd = s->unif_mv_cmds[job]; -+ int n,cidx; -+ AVFrame myref; -+@@ -3467,11 +3416,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ { -+ int k; -+-#ifdef LAUNCH_PASS0 -+- int job = s->pass0_job; -+-#else -+ int job = s->pass1_job; -+-#endif -+ int i; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; -+ #ifdef RPI_LUMA_QPU -+@@ -3574,10 +3519,12 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ -+ #ifdef RPI -+ -++#ifndef RPI_FAST_CACHEFLUSH -+ static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+ } -++#endif -+ -+ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+@@ -3715,7 +3662,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI_WORKER -+ s->pass0_job = 0; -+ s->pass1_job = 0; -+- s->pass2_job = 0; -+ #endif -+ #ifdef RPI -+ rpi_begin(s); -+@@ -3767,12 +3713,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI_WORKER -+ if (s->used_for_ref) { -+ // Split work load onto separate threads so we make as rapid progress as possible with this frame -+- #ifdef INTER_PASS0 -+- rpi_execute_inter_cmds(s); -+- #endif -+- #ifdef LAUNCH_PASS0 -+- rpi_launch_vpu_qpu(s); -+- #endif -+ // Pass on this job to worker thread -+ worker_submit_job(s); -+ // Make sure we have space to prepare the next job -+@@ -3814,8 +3754,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ // Wait for the worker to finish all its jobs -+ if (s->enable_rpi) { -+ worker_wait(s); -+- av_assert0(s->pass0_job==s->pass1_job); -+- av_assert0(s->pass1_job==s->pass2_job); -+ } -+ #endif -+ -+@@ -4565,16 +4503,13 @@ static av_cold void hevc_init_worker(HEVCContext *s) -+ { -+ int err; -+ pthread_cond_init(&s->worker_cond_head, NULL); -+- pthread_cond_init(&s->worker_cond_middle, NULL); -+ pthread_cond_init(&s->worker_cond_tail, NULL); -+ pthread_mutex_init(&s->worker_mutex, NULL); -+ -+ s->worker_tail=0; -+- s->worker_middle=0; -+ s->worker_head=0; -+ s->kill_worker=0; -+ err = pthread_create(&s->worker_thread, NULL, worker_start, s); -+- err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); -+ if (err) { -+ printf("Failed to create worker thread\n"); -+ exit(-1); -+@@ -4586,17 +4521,13 @@ static av_cold void hevc_exit_worker(HEVCContext *s) -+ void *res; -+ s->kill_worker=1; -+ pthread_cond_broadcast(&s->worker_cond_tail); -+- pthread_cond_broadcast(&s->worker_cond_middle); -+ pthread_join(s->worker_thread, &res); -+- pthread_join(s->worker_deblock_thread, &res); -+ -+ pthread_cond_destroy(&s->worker_cond_head); -+- pthread_cond_destroy(&s->worker_cond_middle); -+ pthread_cond_destroy(&s->worker_cond_tail); -+ pthread_mutex_destroy(&s->worker_mutex); -+ -+ s->worker_tail=0; -+- s->worker_middle=0; -+ s->worker_head=0; -+ s->kill_worker=0; -+ } -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index a141316..ef5bfb1 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -931,7 +931,6 @@ typedef struct HEVCContext { -+ //GPU_MEM_PTR_T dummy; -+ int pass0_job; // Pass0 does coefficient decode -+ int pass1_job; // Pass1 does pixel processing -+- int pass2_job; // Pass2 does reconstruction and deblocking -+ int ctu_count; // Number of CTUs done in pass0 so far -+ int max_ctu_count; // Number of CTUs when we trigger a round of processing -+ int ctu_per_y_chan; // Number of CTUs per luma QPU -+@@ -963,15 +962,12 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI_WORKER -+ pthread_t worker_thread; -+- pthread_t worker_deblock_thread; -+ pthread_cond_t worker_cond_head; -+ pthread_cond_t worker_cond_tail; -+- pthread_cond_t worker_cond_middle; -+ pthread_mutex_t worker_mutex; -+ -+ int worker_tail; // Contains the number of posted jobs -+ int worker_head; // Contains the number of completed jobs -+- int worker_middle; // Contains the number of completed jobs -+ int kill_worker; // set to 1 to terminate the worker -+ #endif -+ -+-- -+2.7.4 -+ -+ -+From 74892301cdb0829de959b798debac6ffe1c71603 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 8 Jun 2015 11:04:43 +0100 -+Subject: [PATCH 62/68] Reduced amount of output frame that is invalidated -+ -+--- -+ libavcodec/hevc.c | 45 +++++++++++++++++++++++++++++---------------- -+ 1 file changed, 29 insertions(+), 16 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 1868532..cbb4f46 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -68,7 +68,7 @@ -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+ static void rpi_begin(HEVCContext *s); -+ static void flush_frame(HEVCContext *s,AVFrame *frame); -+- static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -++ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job); -+ -+ #endif -+ -+@@ -3454,9 +3454,9 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job], job); -+ #else -+- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); -+ #endif -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+@@ -3530,6 +3530,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+ int curr_uv = 0; -+@@ -3537,22 +3538,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ int sz,base; -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm + base; -++ iocache.s[0].addr = (int)(p->arm) + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = p->arm + base; -++ iocache.s[1].addr = (int)(p->arm) + base; -+ iocache.s[1].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = p->arm + base; -++ iocache.s[2].addr = (int)(p->arm) + base; -+ iocache.s[2].size = sz; -+ vcsm_clean_invalid( &iocache ); -+ #else -+@@ -3562,33 +3562,46 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ #endif -+ } -+ -+-static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -++static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+- int n = s->ps.sps->height; -+- int curr_y = 0; -+- int curr_uv = 0; -+- int n_uv = n >> s->ps.sps->vshift[1]; -++ int n; -++ int curr_y; -++ int curr_uv; -++ int n_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ int sz,base; -++ int (*d)[2] = s->dblk_cmds[job]; -++ int low=(*d)[1]; -++ int high=(*d)[1]; -++ for(n = s->num_dblk_cmds[job]; n>0 ;n--,d++) { -++ int y = (*d)[1]; -++ low=FFMIN(low,y); -++ high=FFMAX(high,y); -++ } -++ curr_y = low; -++ n = high+(1 << s->ps.sps->log2_ctb_size); -++ curr_uv = curr_y >> s->ps.sps->vshift[1]; -++ n_uv = n >> s->ps.sps->vshift[1]; -++ -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm + base; -++ iocache.s[0].addr = (int)(p->arm) + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = p->arm + base; -++ iocache.s[1].addr = (int)(p->arm) + base; -+ iocache.s[1].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = p->arm + base; -++ iocache.s[2].addr = (int)(p->arm) + base; -+ iocache.s[2].size = sz; -+ -+ iocache.s[3].handle = p0->vcsm_handle; -+-- -+2.7.4 -+ -+ -+From 090b6be5b501bd3c547700926e540397f0b39e69 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 8 Jun 2015 11:55:29 +0100 -+Subject: [PATCH 63/68] Packed 16x16 and 32x32 into the same buffer -+ -+--- -+ libavcodec/hevc.c | 24 +++++++++++++++--------- -+ libavcodec/hevc_cabac.c | 9 ++++++++- -+ libavcodec/rpi_qpu.c | 2 +- -+ 3 files changed, 24 insertions(+), 11 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index cbb4f46..a596534 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -299,12 +299,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; -+ if (!s->coeffs_buf_arm[job][0]) -+ goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); -++ gpu_malloc_cached(sizeof(int16_t) * (coefs_per_row + 32*32), &s->coeffs_buf_accelerated[job]); // We prefetch past the end so provide an extra blocks worth of data -+ s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; -+ s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; -+ if (!s->coeffs_buf_arm[job][2]) -+ goto fail; -+- s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; -++ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; // This points to just beyond the end of the buffer. Coefficients fill in backwards. -+ s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; -+ } -+ } -+@@ -2956,15 +2956,20 @@ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -+ int job = s->pass1_job; -+- //int j; -+- //int16_t *coeffs = s->coeffs_buf_arm[i]; -+- //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+- // s->hevcdsp.idct[4-2](coeffs, 16); -+- //} -++ /*int j; -++ int16_t *coeffs = s->coeffs_buf_arm[job][i]; -++ for(j=s->num_coeffs[job][i]; j > 0; j-= 16*16, coeffs+=16*16) { -++ s->hevcdsp.idct[4-2](coeffs, 16); -++ } -++ i=3; -++ coeffs = s->coeffs_buf_arm[job][i] - s->num_coeffs[job][i]; -++ for(j=s->num_coeffs[job][i]; j > 0; j-= 32*32, coeffs+=32*32) { -++ s->hevcdsp.idct[5-2](coeffs, 32); -++ }*/ -+ -+ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], -+- s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], -++ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], -+ s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); -+@@ -3458,7 +3463,8 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ #else -+ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); -+ #endif -+- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, -++ s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 6523e66..8656917 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1051,7 +1051,14 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+ if (use_vpu) { -+- coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -++ // We support size 4 and size 5. -++ // Size 4 grows from the front (Coeffs_buf_arm[2] points to start of buf) -++ // Size 5 grows from the back (Coeffs_buf_arm[3] points to end of buf) -++ // num_coeffs is indexed by log2_trafo_size-2 -++ if (log2_trafo_size == 4) -++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -++ else -++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] - s->num_coeffs[s->pass0_job][log2_trafo_size - 2] - n; -+ s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; -+ } else { -+ coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 4480f72..0121fca 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -5,7 +5,7 @@ -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+ //#define RPI_TIME_TOTAL_VPU -+ // define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined -+-//#define RPI_TIME_TOTAL_POSTED -++#define RPI_TIME_TOTAL_POSTED -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -+ -+-- -+2.7.4 -+ -+ -+From ed359bbce56817bf9db0e54701103bd0505c353b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 25 Jun 2015 09:02:47 +0100 -+Subject: [PATCH 64/68] Moved luma deblock to VPU -+ -+--- -+ libavcodec/hevc.c | 18 +- -+ libavcodec/hevc.h | 11 + -+ libavcodec/hevc_filter.c | 120 ++- -+ libavcodec/rpi_hevc_transform.h | 1802 ++++++++++++++++++++++++++++++++++++++- -+ libavcodec/rpi_hevc_transform.s | 426 +++++++++ -+ libavcodec/rpi_qpu.c | 12 +- -+ libavcodec/rpi_shader.c | 2 +- -+ 7 files changed, 2378 insertions(+), 13 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index a596534..4ce94a7 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -246,6 +246,12 @@ static void pic_arrays_free(HEVCContext *s) -+ } -+ } -+ #endif -++#ifdef RPI_DEBLOCK_VPU -++ if (s->y_setup_arm) { -++ gpu_free(&s->y_setup_ptr); -++ s->y_setup_arm = 0; -++ } -++#endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+@@ -283,12 +289,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ int min_pu_size = sps->min_pu_width * sps->min_pu_height; -+ -+ #ifdef RPI -+- av_assert0(sps); -+ int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; -+ int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; -+ int coefs_per_row = coefs_per_luma + coefs_per_chroma; -+ int job; -++ av_assert0(sps); -+ s->max_ctu_count = coefs_per_luma / coefs_in_ctb; -+ s->ctu_per_y_chan = s->max_ctu_count / 12; -+ s->ctu_per_uv_chan = s->max_ctu_count / 8; -+@@ -309,6 +315,16 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ } -+ } -+ #endif -++#ifdef RPI_DEBLOCK_VPU -++ s->enable_rpi_deblock = !sps->sao_enabled; -++ s->setup_width = (sps->width+15) / 16; -++ s->setup_height = (sps->height+15) / 16; -++ gpu_malloc_uncached(sizeof(*s->y_setup_arm) * s->setup_width * s->setup_height, &s->y_setup_ptr); // TODO make this cached -++ s->y_setup_arm = (void*)s->y_setup_ptr.arm; -++ s->y_setup_vc = (void*)s->y_setup_ptr.vc; -++ memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); -++ printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); -++#endif -+ -+ s->bs_width = (width >> 2) + 1; -+ s->bs_height = (height >> 2) + 1; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index ef5bfb1..cf08489 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -57,6 +57,8 @@ -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+ -++ #define RPI_DEBLOCK_VPU -++ -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -971,6 +973,15 @@ typedef struct HEVCContext { -+ int kill_worker; // set to 1 to terminate the worker -+ #endif -+ -++#ifdef RPI_DEBLOCK_VPU -++ int enable_rpi_deblock; -++ GPU_MEM_PTR_T y_setup_ptr; -++ uint8_t (*y_setup_arm)[2][2][2][4]; -++ uint8_t (*y_setup_vc)[2][2][2][4]; -++ int setup_width; // Number of 16x16 blocks across the image -++ int setup_height; // Number of 16x16 blocks down the image -++#endif -++ -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 1f04790..06371da 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -564,6 +564,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int num16 = (y>>4)*s->setup_width + (x>>4); -++ int a = ((y>>3) & 1) << 1; -++ int b = (x>>3) & 1; -++ setup = s->y_setup_arm[num16]; -++ setup[0][b][0][a] = beta; -++ setup[0][b][0][a + 1] = beta; -++ setup[0][b][1][a] = tc[0]; -++ setup[0][b][1][a + 1] = tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_v_loop_filter_luma(src, -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+@@ -596,6 +609,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int num16 = (y>>4)*s->setup_width + (x>>4); -++ int a = ((x>>3) & 1) << 1; -++ int b = (y>>3) & 1; -++ setup = s->y_setup_arm[num16]; -++ setup[1][b][0][a] = beta; -++ setup[1][b][0][a + 1] = beta; -++ setup[1][b][1][a] = tc[0]; -++ setup[1][b][1][a + 1] = tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_h_loop_filter_luma(src, -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+@@ -876,33 +902,85 @@ static void flush_buffer(AVBufferRef *bref) { -+ } -+ -+ // Return Physical address for this image -+-static int ff_hevc_buf_base(AVBufferRef *bref) { -++static uint32_t get_vc_address(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return p->vc & 0x3fffffff; -++ return p->vc; -+ } -+ -++// ff_hevc_flush_buffer_lines -++// flushes and invalidates all pixel rows in [start,end-1] -++static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) -++{ -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int curr_y = start; -++ int n = end; -++ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -++ int n_uv = n >> s->ps.sps->vshift[1]; -++ int sz,base; -++ GPU_MEM_PTR_T *p; -++ if (curr_uv < 0) curr_uv = 0; -++ if (n_uv<=curr_uv) { return; } -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ if (flush_chroma) { -++ p = av_buffer_pool_opaque(s->frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = (int)p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(s->frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = (int)p->arm + base; -++ iocache.s[1].size = sz; -++ } -++ if (flush_luma) { -++ p = av_buffer_pool_opaque(s->frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = (int)p->arm + base; -++ iocache.s[2].size = sz; -++ } -++ vcsm_clean_invalid( &iocache ); -++#else -++ if (flush_chroma) { -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++ } -++ if (flush_luma) { -++ flush_buffer(s->frame->buf[0]); -++ } -++#endif -++} -++ -++ -+ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && s->used_for_ref) { -++ // TODO make this use ff_hevc_flush_buffer_lines -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int curr_y = ((int *)f->progress->data)[0]; -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -++ GPU_MEM_PTR_T *p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -++ p = av_buffer_pool_opaque(s->frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm + base; -++ iocache.s[0].addr = (int)p->arm + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(s->frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = p->arm + base; -++ iocache.s[1].addr = (int)p->arm + base; -+ iocache.s[1].size = sz; -+ -+ #ifdef RPI_LUMA_QPU -+@@ -911,7 +989,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = p->arm + base; -++ iocache.s[2].addr = (int)p->arm + base; -+ iocache.s[2].size = sz; -+ #endif -+ vcsm_clean_invalid( &iocache ); -+@@ -930,11 +1008,40 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ } -+ #endif -+ -++#ifdef RPI_DEBLOCK_VPU -++/* rpi_deblock deblocks an entire row of ctbs using the VPU */ -++static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -++{ -++ // Flush image, 4 lines above to bottom of ctb stripe -++ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); -++ // TODO flush buffer of beta/tc setup when it becomes cached -++ // Call VPU -++ // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion -++ vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], -++ s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), -++ ctb_size>>4, 2, 0)); // 2 means to do the deblocking code -++} -++ -++static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) -++{ -++ int y2; -++ for(y2=y;y2= s->ps.sps->width - ctb_size; -+ if (s->avctx->skip_loop_filter < AVDISCARD_ALL) -+ deblocking_filter_CTB(s, x, y); -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock && x_end) -++ { -++ rpi_deblock(s, y, ctb_size); -++ } -++#endif -+ if (s->ps.sps->sao_enabled) { -+ int y_end = y >= s->ps.sps->height - ctb_size; -+ if (y && x) -+@@ -965,6 +1072,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //if (((y + ctb_size)&63)==0) -+ #ifdef RPI_INTER_QPU -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -++ // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index 4f13622..b3f155f 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -3,7 +3,13 @@ unsigned char rpi_hevc_transform [] = { -+ 106, -+ 0, -+ 144, -+-35, -++38, -++1, -++37, -++106, -++0, -++144, -++57, -+ 1, -+ 169, -+ 3, -+@@ -627,4 +633,1798 @@ unsigned char rpi_hevc_transform [] = { -+ 30, -+ 90, -+ 0, -++169, -++3, -++73, -++64, -++52, -++64, -++45, -++64, -++2, -++64, -++10, -++64, -++64, -++198, -++1, -++7, -++8, -++232, -++63, -++0, -++0, -++0, -++6, -++232, -++253, -++255, -++255, -++255, -++0, -++246, -++0, -++0, -++0, -++4, -++215, -++64, -++3, -++96, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++137, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++129, -++0, -++131, -++102, -++0, -++158, -++67, -++0, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++108, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++100, -++0, -++131, -++102, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++161, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++150, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++3, -++99, -++131, -++71, -++68, -++232, -++32, -++0, -++0, -++0, -++0, -++99, -++2, -++99, -++23, -++102, -++7, -++106, -++127, -++156, -++182, -++255, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++112, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++101, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++25, -++102, -++9, -++106, -++2, -++30, -++41, -++3, -++26, -++87, -++162, -++64, -++64, -++198, -++1, -++23, -++127, -++158, -++103, -++255, -++239, -++3, -++0, -++254, -++0, -++143, -++92, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++143, -++93, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++143, -++94, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++95, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++208, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++209, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++142, -++210, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++0, -++142, -++211, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++107, -++0, -++8, -++255, -++99, -++23, -++0, -++212, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++23, -++0, -++228, -++192, -++51, -++0, -++0, -++8, -++255, -++227, -++23, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++52, -++0, -++180, -++192, -++51, -++0, -++0, -++8, -++255, -++99, -++52, -++0, -++164, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++52, -++0, -++148, -++192, -++51, -++0, -++0, -++111, -++3, -++239, -++3, -++0, -++254, -++0, -++143, -++12, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++143, -++13, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++143, -++14, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++15, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++16, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++17, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++142, -++18, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++0, -++142, -++19, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++33, -++0, -++8, -++255, -++99, -++3, -++0, -++212, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++3, -++0, -++228, -++192, -++51, -++0, -++0, -++8, -++255, -++227, -++3, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++4, -++0, -++180, -++192, -++51, -++0, -++0, -++8, -++255, -++99, -++4, -++0, -++164, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++4, -++0, -++148, -++192, -++51, -++0, -++0, -++111, -++3, -++32, -++246, -++192, -++11, -++1, -++16, -++32, -++246, -++2, -++137, -++47, -++240, -++40, -++246, -++2, -++140, -++47, -++240, -++128, -++245, -++99, -++140, -++5, -++4, -++0, -++247, -++99, -++140, -++1, -++20, -++88, -++246, -++99, -++140, -++1, -++20, -++0, -++247, -++35, -++136, -++62, -++226, -++32, -++247, -++35, -++136, -++32, -++210, -++0, -++247, -++34, -++136, -++63, -++2, -++208, -++246, -++34, -++136, -++0, -++4, -++0, -++247, -++99, -++136, -++58, -++162, -++32, -++247, -++99, -++136, -++33, -++146, -++0, -++247, -++98, -++136, -++59, -++18, -++208, -++246, -++98, -++136, -++0, -++20, -++0, -++247, -++162, -++136, -++33, -++2, -++88, -++246, -++98, -++137, -++2, -++68, -++88, -++246, -++162, -++137, -++3, -++68, -++208, -++254, -++227, -++136, -++60, -++242, -++192, -++243, -++188, -++11, -++208, -++254, -++227, -++136, -++56, -++178, -++192, -++243, -++188, -++10, -++32, -++255, -++226, -++136, -++38, -++58, -++192, -++243, -++60, -++0, -++208, -++254, -++227, -++136, -++59, -++242, -++192, -++243, -++60, -++128, -++32, -++255, -++226, -++136, -++49, -++58, -++192, -++243, -++60, -++128, -++0, -++255, -++226, -++136, -++34, -++34, -++192, -++243, -++60, -++128, -++32, -++255, -++226, -++136, -++37, -++58, -++192, -++243, -++60, -++128, -++0, -++254, -++192, -++136, -++1, -++4, -++0, -++240, -++0, -++160, -++0, -++255, -++194, -++8, -++0, -++52, -++195, -++243, -++0, -++128, -++0, -++255, -++202, -++40, -++0, -++52, -++195, -++243, -++0, -++128, -++0, -++254, -++0, -++240, -++35, -++10, -++0, -++240, -++60, -++0, -++0, -++254, -++192, -++136, -++1, -++4, -++0, -++240, -++0, -++160, -++0, -++255, -++226, -++140, -++34, -++34, -++195, -++243, -++60, -++0, -++32, -++255, -++227, -++140, -++36, -++58, -++192, -++243, -++60, -++0, -++0, -++254, -++192, -++136, -++0, -++4, -++0, -++240, -++0, -++160, -++16, -++246, -++226, -++136, -++35, -++50, -++16, -++246, -++226, -++136, -++35, -++50, -++32, -++246, -++226, -++136, -++35, -++50, -++32, -++254, -++226, -++136, -++35, -++58, -++192, -++243, -++60, -++0, -++11, -++96, -++0, -++254, -++0, -++240, -++1, -++4, -++0, -++240, -++64, -++115, -++5, -++106, -++0, -++144, -++173, -++1, -++27, -++96, -++0, -++254, -++0, -++240, -++1, -++4, -++0, -++240, -++64, -++147, -++5, -++106, -++0, -++144, -++227, -++0, -++64, -++246, -++163, -++140, -++1, -++4, -++0, -++246, -++192, -++175, -++63, -++2, -++0, -++246, -++192, -++174, -++59, -++2, -++0, -++246, -++128, -++175, -++62, -++2, -++0, -++246, -++128, -++174, -++58, -++2, -++0, -++246, -++64, -++175, -++61, -++2, -++0, -++246, -++64, -++174, -++57, -++2, -++0, -++255, -++43, -++240, -++4, -++212, -++192, -++243, -++128, -++11, -++64, -++254, -++43, -++240, -++1, -++228, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++244, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++180, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++141, -++0, -++164, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++191, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++235, -++143, -++52, -++242, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++2, -++212, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++191, -++226, -++192, -++243, -++188, -++10, -++64, -++254, -++43, -++141, -++0, -++180, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++2, -++68, -++32, -++247, -++35, -++141, -++190, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++171, -++143, -++52, -++226, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++4, -++180, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++191, -++226, -++192, -++243, -++188, -++10, -++128, -++253, -++43, -++240, -++3, -++212, -++192, -++243, -++128, -++10, -++64, -++254, -++35, -++141, -++1, -++196, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++189, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++107, -++143, -++52, -++210, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++4, -++148, -++192, -++243, -++128, -++11, -++64, -++254, -++43, -++240, -++1, -++164, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++180, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++244, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++141, -++0, -++228, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++187, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++235, -++142, -++52, -++178, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++2, -++148, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++187, -++162, -++192, -++243, -++188, -++10, -++64, -++254, -++43, -++141, -++0, -++244, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++2, -++68, -++32, -++247, -++35, -++141, -++186, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++171, -++142, -++52, -++162, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++4, -++244, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++187, -++162, -++192, -++243, -++188, -++10, -++128, -++253, -++43, -++240, -++3, -++148, -++192, -++243, -++128, -++10, -++64, -++254, -++35, -++141, -++1, -++132, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++185, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++107, -++142, -++52, -++146, -++192, -++243, -++60, -++128, -++64, -++255, -++98, -++141, -++0, -++52, -++192, -++243, -++0, -++0, -++0, -++254, -++0, -++240, -++53, -++10, -++0, -++240, -++60, -++0, -++0, -++254, -++0, -++240, -++1, -++4, -++0, -++240, -++64, -++147, -++5, -++106, -++0, -++144, -++177, -++0, -++88, -++246, -++163, -++140, -++1, -++4, -++128, -++245, -++99, -++141, -++10, -++4, -++88, -++246, -++162, -++138, -++1, -++68, -++0, -++247, -++162, -++138, -++36, -++162, -++88, -++254, -++162, -++138, -++3, -++164, -++192, -++243, -++128, -++11, -++0, -++255, -++226, -++137, -++32, -++2, -++195, -++243, -++60, -++0, -++32, -++247, -++226, -++137, -++42, -++114, -++0, -++255, -++34, -++138, -++33, -++18, -++195, -++243, -++60, -++0, -++32, -++247, -++34, -++138, -++42, -++130, -++16, -++246, -++98, -++138, -++40, -++114, -++16, -++246, -++98, -++138, -++41, -++146, -++32, -++246, -++98, -++138, -++41, -++146, -++32, -++246, -++226, -++137, -++41, -++146, -++40, -++246, -++34, -++138, -++41, -++146, -++32, -++247, -++163, -++141, -++63, -++178, -++32, -++247, -++227, -++141, -++62, -++162, -++0, -++254, -++0, -++240, -++8, -++4, -++0, -++240, -++128, -++11, -++128, -++253, -++35, -++240, -++9, -++100, -++192, -++243, -++128, -++10, -++128, -++253, -++163, -++141, -++128, -++115, -++192, -++243, -++152, -++10, -++88, -++246, -++163, -++141, -++4, -++100, -++208, -++246, -++35, -++139, -++0, -++100, -++32, -++255, -++34, -++139, -++53, -++202, -++192, -++243, -++60, -++128, -++0, -++254, -++0, -++139, -++0, -++4, -++0, -++240, -++0, -++160, -++240, -++246, -++163, -++141, -++48, -++98, -++0, -++247, -++99, -++139, -++63, -++210, -++0, -++247, -++98, -++139, -++1, -++212, -++88, -++254, -++98, -++139, -++1, -++212, -++192, -++243, -++128, -++11, -++32, -++255, -++99, -++139, -++62, -++98, -++192, -++243, -++188, -++10, -++88, -++246, -++98, -++139, -++1, -++212, -++240, -++246, -++98, -++139, -++50, -++210, -++0, -++247, -++163, -++128, -++59, -++146, -++0, -++247, -++160, -++128, -++1, -++36, -++88, -++254, -++160, -++128, -++1, -++36, -++192, -++243, -++128, -++11, -++0, -++247, -++163, -++128, -++58, -++98, -++64, -++255, -++35, -++240, -++0, -++100, -++192, -++243, -++128, -++10, -++64, -++255, -++163, -++128, -++0, -++164, -++192, -++243, -++128, -++10, -++88, -++246, -++160, -++128, -++1, -++36, -++240, -++246, -++160, -++128, -++50, -++34, -++8, -++255, -++227, -++143, -++54, -++242, -++192, -++243, -++60, -++128, -++40, -++255, -++227, -++142, -++54, -++178, -++192, -++243, -++60, -++128, -++0, -++254, -++0, -++240, -++39, -++10, -++0, -++240, -++60, -++128, -++8, -++255, -++163, -++143, -++45, -++226, -++192, -++243, -++60, -++128, -++0, -++254, -++0, -++240, -++44, -++10, -++0, -++240, -++60, -++0, -++0, -++254, -++0, -++240, -++40, -++10, -++0, -++240, -++60, -++128, -++8, -++255, -++163, -++142, -++2, -++162, -++192, -++243, -++60, -++128, -++90, -++0, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index fd159bc..b055208 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -83,6 +83,8 @@ -+ hevc_trans_16x16: -+ cmp r5,1 -+ beq memclear16 -++ cmp r5,2 -++ beq hevc_deblock_16x16 -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+@@ -282,3 +284,427 @@ loop: -+ cmp r1,0 -+ bgt loop -+ b lr -++ -++ -++################################################################################ -++# HEVC VPU Deblock -++# -++# Vertical edges before horizontal -++# Decision can change every 4 pixels, but only 8 pixel boundaries are deblocked -++# -++# ARM is responsible for storing beta and tc for each 4 pixels horiz and vert edge. -++# The VPU code works in units of 16x16 blocks. -++# We do vertical filtering for the current block followed by horizontal filtering for the previous (except for the first time). -++# One final horizontal filter is required at the end. -++# PCM is not allowed in this code. -++# -++# -++# H(16-4:16+15,0) contains previous block (note that we need 4 lines above of context that may get altered during filtering) -++# H(16:31,16) contains current block (note that we do not need the upper lines until the horizontal filtering. -++ -++.set P0,63 -++.set P1,62 -++.set P2,61 -++.set P3,60 -++.set Q0,59 -++.set Q1,58 -++.set Q2,57 -++.set Q3,56 -++ -++.set dp,32 -++.set dq,33 -++.set d,34 -++.set decision,35 -++.set beta,36 -++.set beta2,37 -++.set beta3,38 -++.set ptest,39 -++.set qtest,40 -++.set pqtest,41 -++.set thresh,42 -++.set deltatest, 44 -++.set deltap1, 45 -++.set tc25, 46 -++.set setup,47 -++.set tc,48 -++.set tc25,49 -++.set tc2, 50 -++.set do_filter, 51 -++.set delta, 52 -++.set tc10, 53 -++.set delta0, 54 -++.set delta1, 55 -++.set zeros, 0 -++.set setup_input, 1 -++.set deltaq1, 2 -++ -++ -++ -++# hevc_deblock_16x16 deblocks an entire row that is 16 pixels high by the full width of the image. -++# Row has num16 16x16 blocks across -++# Beta goes from 0 to 64 -++# tc goes from 0 to 24 -++# setup[block_idx][0=vert,1=horz][0=first edge, 1=second edge][0=beta,1=tc][0..3=edge number] -++# has 8 bytes per edge -++# has 16 bytes per direction -++# has 32 bytes per 16x16 block -++# hevc_deblock_16x16(uint8_t *img (r0), int stride (r1), int num16w (r2), uint8_t setup[num16][2][2][2][4](r3),int num16h(r4)) -++hevc_deblock_16x16: -++ push r6-r15, lr -++ mov r9,r4 -++ mov r4,r3 -++ mov r13,r2 -++ mov r2,r0 -++ mov r10,r0 -++ subscale4 r0,r1 -++ mov r8,63 -++ mov r6,-3 -++ vmov H(zeros,0),0 -++# r7 is number of blocks still to load -++# r0 is location of current block - 4 * stride -++# r1 is stride -++# r2 is location of current block -++# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical -++# r4 is setup -++# r5 is for temporary calculations -++# r8 holds 63 -++# r6 holds -3 -++# r9 holds the number of 16 high rows to process -++# r10 holds the original img base -++# r11 returns 0 if no filtering was done on the edge -++# r12 saves a copy of this -++# r13 is copy of width -++ -++process_row: -++ # First iteration does not do horizontal filtering on previous -++ mov r7, r13 -++ mov r3,0 -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) # We may wish to prefetch these -++ vstb H(zeros,0),(r4) -++ bl vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 -++ bl vert_filter -++ sub r3,8 -++ b start_deblock_loop -++deblock_loop: -++ # Middle iterations do vertical on current block and horizontal on preceding -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) -++ vstb H(zeros,0),(r4) -++ bl vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl vert_filter -++ sub r3,8 -++ vldb H(setup_input,0), -16(r4) -++ vstb H(zeros,0),-16(r4) -++ bl horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl horz_filter -++ sub r3,8*64 -++ addcmpbeq r12,0,0,skip_save_top -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++skip_save_top: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++start_deblock_loop: -++ # move onto next 16x16 (could do this with circular buffer support instead) -++ add r3,16 -++ and r3,r8 -++ add r4,32 -++ # Perform loop counter operations (may work with an addcmpbgt as well?) -++ add r0,16 -++ add r2,16 -++ sub r7,1 -++ cmp r7,0 # Are there still more blocks to load -++ bgt deblock_loop -++ -++ # Final iteration needs to just do horizontal filtering -++ vldb H(setup_input,0), -16(r4) -++ vstb H(zeros,0),-16(r4) -++ bl horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl horz_filter -++ sub r3,64*8 -++ addcmpbeq r12,0,0,skip_save_top2 -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++skip_save_top2: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++ -++# Now look to see if we should do another row -++ sub r9,1 -++ cmp r9,0 -++ bgt start_again -++ pop r6-r15, pc -++start_again: -++ # Need to sort out r0,r2 to point to next row down -++ addscale16 r10,r1 -++ mov r2,r10 -++ subscale4 r0,r2,r1 -++ b process_row -++ -++ -++# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered -++# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations -++ -++vert_filter: -++ push lr -++ -++ vmov HX(P3,0), V(16,12)+r3 -++ vmov HX(P2,0), V(16,13)+r3 -++ vmov HX(P1,0), V(16,14)+r3 -++ vmov HX(P0,0), V(16,15)+r3 -++ vmov HX(Q0,0), V(16,16)+r3 -++ vmov HX(Q1,0), V(16,17)+r3 -++ vmov HX(Q2,0), V(16,18)+r3 -++ vmov HX(Q3,0), V(16,19)+r3 -++ -++ bl do_luma_filter -++ -++ vadds V(16,13)+r3, HX(P2,0), 0 -++ vadds V(16,14)+r3, HX(P1,0), 0 -++ vadds V(16,15)+r3, HX(P0,0), 0 -++ # P3 and Q3 never change so don't bother saving back -++ vadds V(16,16)+r3, HX(Q0,0), 0 -++ vadds V(16,17)+r3, HX(Q1,0), 0 -++ vadds V(16,18)+r3, HX(Q2,0), 0 -++ -++ pop pc -++ -++# Filter edge at H(16,0)+r3 -++horz_filter: -++ push lr -++ -++ vmov HX(P3,0), H(12,0)+r3 -++ vmov HX(P2,0), H(13,0)+r3 -++ vmov HX(P1,0), H(14,0)+r3 -++ vmov HX(P0,0), H(15,0)+r3 -++ vmov HX(Q0,0), H(16,0)+r3 -++ vmov HX(Q1,0), H(17,0)+r3 -++ vmov HX(Q2,0), H(18,0)+r3 -++ vmov HX(Q3,0), H(19,0)+r3 -++ -++ bl do_luma_filter -++ -++ vadds H(13,0)+r3, HX(P2,0), 0 -++ vadds H(14,0)+r3, HX(P1,0), 0 -++ vadds H(15,0)+r3, HX(P0,0), 0 -++ # P3 and Q3 never change so don't bother saving back -++ vadds H(16,0)+r3, HX(Q0,0), 0 -++ vadds H(17,0)+r3, HX(Q1,0), 0 -++ vadds H(18,0)+r3, HX(Q2,0), 0 -++ -++ pop pc -++ -++# r4 points to array of beta/tc for each 4 length edge -++do_luma_filter: -++ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # b*8tc*8 -++ valtl HX(beta,0),H(setup,0),H(setup,0) -++ valtu HX(tc,0),H(setup,0),H(setup,0) -++ vmul HX(tc25,0), HX(tc,0), 5 -++ vadd HX(tc25,0),HX(tc25,0), 1 -++ vasr HX(tc25,0), HX(tc25,0), 1 -++ -++ # Compute decision -++ vadd HX(dp,0),HX(P1,0),HX(P1,0) # 2*P1 -++ vsub HX(dp,0),HX(P2,0),HX(dp,0) # P2-2*P1 -++ vadd HX(dp,0),HX(dp,0),HX(P0,0) # P2-2*P1+P0 -++ vdist HX(dp,0),HX(dp,0),0 # abs(P2-2*P1+P0) # dp0 -++ -++ vadd HX(dq,0),HX(Q1,0),HX(Q1,0) # 2*Q1 -++ vsub HX(dq,0),HX(Q2,0),HX(dq,0) # Q2-2*Q1 -++ vadd HX(dq,0),HX(dq,0),HX(Q0,0) # Q2-2*Q1+Q0 -++ vdist HX(dq,0),HX(dq,0),0 # abs(Q2-2*Q1+Q0) # dq0 -++ -++ vadd HX(d,0), HX(dp,0), HX(dq,0) -++ vasr HX(beta2,0),HX(beta,0),2 -++ vasr HX(beta3,0),HX(beta,0),3 -++ -++ # Compute flags that are negative if all conditions pass -++ vdist HX(decision,0), HX(P0,0), HX(P3,0) CLRA SACC -++ vdist HX(decision,0), HX(Q0,0), HX(Q3,0) SACC -++ vsub HX(decision,0), HX(decision,0), HX(beta3,0) SETF -++ -++ vdist HX(decision,0), HX(P0,0), HX(Q0,0) IFN -++ vsub HX(decision,0), HX(decision,0), HX(tc25,0) IFN SETF -++ vadd HX(decision,0), HX(d,0), HX(d,0) IFN -++ vsub HX(decision,0), HX(decision,0), HX(beta2,0) IFN SETF -++ vmov HX(decision,0), 1 IFNN -++ vadd H(decision,0),H(decision,3),0 IFN -++ vadd H(decision,16),H(decision,19),0 IFN -++ vmov -,HX(decision,0) SETF # N marks strong filter -++ vmov HX(decision,0), 1 IFNN # NN marks normal filter -++ -++ vadd HX(do_filter,0), HX(d,3), HX(d,0) -++ vsub HX(do_filter,0), HX(do_filter,0), HX(beta,0) SETF # IFNN means no filter -++ vmov HX(decision,0),0 IFNN # Z marks no filter -++ -++ # Expand out decision (currently valid one every 4 pixels) 0...1...2...3 -++ # First extract out even terms -++ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0.1.2.3 -++ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0123 -++ # Now expand back -++ valtl HX(decision,0),HX(decision,0),HX(decision,0) # 00112233 -++ valtl HX(decision,0),HX(decision,0),HX(decision,0) SETF # 0000111122223333 -++ -++ # HX(decision,0) is negative if want strong filtering, 1 if want normal filtering, 0 if want no filtering -++ -++ # Do a quick check to see if there is anything to do -++ mov r11, 0 # Signal no filtering -++ vmov -,1 IFNZ SUMS r5 -++ cmp r5,0 -++ beq filtering_done -++ mov r11, 1 # Signal some filtering -++ # And whether there is any strong filtering -++ vmov -,1 IFN SUMS r5 -++ cmp r5,0 -++ beq normal_filtering -++ -++ ############################################################################## -++ # Strong filtering - could maybe fast case if all have same sign? (especially if all disabled!) -++ vshl HX(tc2,0), HX(tc,0), 1 # Note that in normal filtering tx2 is tc/2, while here it is tc*2 -++ -++ # Take a copy of the original pixels for use in decision calculation -++ vmov HX(P0,32),HX(P0,0) -++ vmov HX(Q0,32),HX(Q0,0) -++ vmov HX(P1,32),HX(P1,0) -++ vmov HX(Q1,32),HX(Q1,0) -++ vmov HX(P2,32),HX(P2,0) -++ vmov HX(Q2,32),HX(Q2,0) -++ -++ vadd -,HX(P2,32),4 CLRA SACC -++ vshl -,HX(P1,32),1 SACC -++ vshl -,HX(P0,32),1 SACC -++ vshl -,HX(Q0,32),1 SACC -++ vshl HX(delta,0),HX(Q1,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(P0,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(P0,0),HX(P0,32),HX(delta,0) IFN -++ -++ vadd -,HX(P2,32),2 CLRA SACC -++ vadd -,HX(P1,32),HX(P0,32) SACC -++ vshl HX(delta,0),HX(Q0,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 2 -++ vsub HX(delta,0),HX(delta,0),HX(P1,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(P1,0),HX(P1,32),HX(delta,0) IFN -++ -++ vadd -,HX(Q0,32),4 CLRA SACC -++ vadd -,HX(P1,32),HX(P0,32) SACC -++ vmul -,HX(P2,32),3 SACC -++ vshl HX(delta,0),HX(P3,0),1 SACC # Note that we have not made a copy of P3, so using P3,0 is correct -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(P2,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(P2,0),HX(P2,32),HX(delta,0) IFN -++ #vmov HX(P2,0),3 IFN -++ -++ # Now reverse all P/Qs -++ -++ vadd -,HX(Q2,32),4 CLRA SACC -++ vshl -,HX(Q1,32),1 SACC -++ vshl -,HX(Q0,32),1 SACC -++ vshl -,HX(P0,32),1 SACC -++ vshl HX(delta,0),HX(P1,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(Q0,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(Q0,0),HX(Q0,32),HX(delta,0) IFN -++ -++ vadd -,HX(Q2,32),2 CLRA SACC -++ vadd -,HX(Q1,32),HX(Q0,32) SACC -++ vshl HX(delta,0),HX(P0,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 2 -++ vsub HX(delta,0),HX(delta,0),HX(Q1,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(Q1,0),HX(Q1,32),HX(delta,0) IFN -++ -++ vadd -,HX(P0,32),4 CLRA SACC -++ vadd -,HX(Q1,32),HX(Q0,32) SACC -++ vmul -,HX(Q2,32),3 SACC -++ vshl HX(delta,0),HX(Q3,0),1 SACC # Note that we have not made a copy of Q3, so using Q3,0 is correct -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(Q2,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(Q2,0),HX(Q2,32),HX(delta,0) IFN -++ -++ ############################################################################## -++ # Normal filtering -++normal_filtering: -++ # Invert the decision flags -++ # make instruction more complicated as assembler has error and loses SETF -++ vrsub HX(tc10,0), HX(decision,0), 0 SETF # IFN means normal filtering -++ vmov -, HX(tc10,0) SETF # IFN means normal filtering -++ -++ vmov -,1 IFN SUMS r5 -++ cmp r5,0 -++ beq filtering_done -++ -++ vasr HX(tc2,0), HX(tc,0), 1 -++ vmul HX(tc10,0), HX(tc,0), 10 -++ -++ vasr HX(thresh,0), HX(beta,0), 1 -++ vadd HX(thresh,0), HX(thresh,0), HX(beta,0) -++ vasr HX(thresh,0), HX(thresh,0), 3 CLRA SACC -++ -++ vadd HX(ptest,0),HX(dp,3),HX(dp,0) -++ vsub HX(ptest,0),HX(ptest,0),HX(thresh,0) # ptest is negative if we need to do the P2 pixel -++ vadd HX(qtest,0),HX(dq,3),HX(dq,0) -++ vsub HX(qtest,0),HX(qtest,0),HX(thresh,0) # qtest is negative if we need to do the Q2 pixel -++ # Expand ptest and qtest together -++ vodd HX(pqtest,0),HX(ptest,0),HX(qtest,0) # p.p.p.p.q.q.q.q -++ vodd HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppqqqq........ -++ valtl HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppppppqqqqqqqq -++ valtl HX(ptest,0),HX(pqtest,0),HX(pqtest,0) -++ valtu HX(qtest,0),HX(pqtest,0),HX(pqtest,0) -++ -++ vsub HX(delta0,0), HX(Q0,0), HX(P0,0) -++ vsub HX(delta1,0), HX(Q1,0), HX(P1,0) -++ vmov -,8 CLRA SACC -++ vmul -,HX(delta0,0), 9 SACC -++ vmul HX(delta0,0),HX(delta1,0), r6 SACC -++ vasr HX(delta0,0), HX(delta0,0), 4 -++ vdist HX(deltatest,0), HX(delta0,0), 0 -++ vsub HX(deltatest,0), HX(deltatest,0), HX(tc10,0) IFN SETF # negative if still need to do something -++ vmov HX(deltatest,0), 0 IFNN # clear if no need to do anything so we can reload flags later -++ -++ vclamps HX(delta0,0), HX(delta0,0), HX(tc,0) -++ -++ vadd HX(deltap1,0), HX(P2,0), HX(P0,0) -++ vadd HX(deltap1,0), HX(deltap1,0), 1 -++ vasr HX(deltap1,0), HX(deltap1,0), 1 CLRA SACC -++ vsub HX(deltap1,0), HX(delta0,0), HX(P1,0) SACC -++ vasr HX(deltap1,0), HX(deltap1,0), 1 -++ vclamps HX(deltap1,0), HX(deltap1,0), HX(tc2,0) -++ -++ vadd HX(deltaq1,0), HX(Q2,0), HX(Q0,0) -++ vadd HX(deltaq1,0), HX(deltaq1,0), 1 -++ vasr HX(deltaq1,0), HX(deltaq1,0), 1 CLRA SACC -++ vadd HX(deltaq1,0), HX(delta0,0), HX(Q1,0) -++ vrsub -, HX(delta0,0), 0 SACC -++ vrsub HX(deltaq1,0), HX(Q1,0), 0 SACC -++ vasr HX(deltaq1,0), HX(deltaq1,0), 1 -++ vclamps HX(deltaq1,0), HX(deltaq1,0), HX(tc2,0) -++ -++ vadds HX(P0,0), HX(P0,0), HX(delta0,0) IFN -++ vsubs HX(Q0,0), HX(Q0,0), HX(delta0,0) IFN -++ -++ vmov -,HX(ptest,0) IFN SETF # Negative if need to do p1 -++ vadds HX(P1,0), HX(P1,0), HX(deltap1,0) IFN -++ -++ vmov -,HX(deltatest,0) SETF -++ vmov -,HX(qtest,0) IFN SETF # Negative if need to do q1 -++ vadds HX(Q1,0), HX(Q1,0), HX(deltaq1,0) IFN -++ -++ #vmov HX(P2,0),1 IFN -++ -++filtering_done: -++ b lr -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 0121fca..05b2169 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -147,7 +147,7 @@ static int gpu_init(volatile struct GPU **gpu) { -+ vcsm_init(); -+ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -+ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -+- memset(ptr, 0, sizeof *ptr); -++ memset((void*)ptr, 0, sizeof *ptr); -+ vc = gpu_mem_ptr.vc; -+ -+ ptr->mb = mb; -+@@ -254,7 +254,7 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm; -++ iocache.s[0].addr = (int) p->arm; -+ iocache.s[0].size = p->numbytes; -+ vcsm_clean_invalid( &iocache ); -+ #else -+@@ -390,6 +390,7 @@ static void *vpu_start(void *arg) { -+ #ifdef RPI_TIME_TOTAL_POSTED -+ int last_time=0; -+ long long on_time=0; -++ long long on_time_deblock=0; -+ long long off_time=0; -+ int start_time; -+ int end_time; -+@@ -451,10 +452,13 @@ static void *vpu_start(void *arg) { -+ #ifdef RPI_TIME_TOTAL_POSTED -+ end_time = Microseconds(); -+ last_time = end_time; -+- on_time += end_time - start_time; -++ if (p[6]==2) -++ on_time_deblock += end_time - start_time; -++ else -++ on_time += end_time - start_time; -+ count++; -+ if ((count&0x7f)==0) -+- printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++ printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -+ #endif -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index e86eb30..c5d8b29 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -61,7 +61,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+ /* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 -+ /* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 -+-/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 -++/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif,r2 -+ /* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 -+ /* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif -+ /* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-- -+2.7.4 -+ -+ -+From e9c59f0d7b42dfb10d85ab2477f95b44484a8d70 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 1 Jul 2015 09:21:17 +0100 -+Subject: [PATCH 65/68] Added ability to combine jobs -+ -+--- -+ libavcodec/rpi_qpu.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++- -+ 1 file changed, 80 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 05b2169..91777be 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -8,6 +8,8 @@ -+ #define RPI_TIME_TOTAL_POSTED -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -++// Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel -++#define RPI_COMBINE_JOBS -+ -+ #include -+ #include -+@@ -398,9 +400,15 @@ static void *vpu_start(void *arg) { -+ #endif -+ while(1) { -+ int i; -+- int *p; -++ int *p; // Pointer for a QPU/VPU job -++#ifdef RPI_COMBINE_JOBS -++ int *q = NULL; // Pointer for a VPU only job -++ int have_qpu = 0; -++ int have_vpu = 0; -++#endif -+ int qpu_code; -+ int qpu_codeb; -++ int num_jobs; // Number of jobs available -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+@@ -408,13 +416,38 @@ static void *vpu_start(void *arg) { -+ pthread_cond_wait(&post_cond_tail, &post_mutex); -+ } -+ p = vpu_cmds[vpu_async_head%MAXCMDS]; -++ num_jobs = vpu_async_tail - vpu_async_head; -+ pthread_mutex_unlock(&post_mutex); -+ -+ if (p[6] == -1) { -+ break; // Last job -+ } -++ if (p[7] == 0 && p[0] == 0 && p[16]==0) -++ goto job_done_early; -++ -++#ifdef RPI_COMBINE_JOBS -++ // First scan for a qpu job -++ for (int x=0;xmail[i*2] = p[8+i]; -++ gpu->mail[i*2 + 1] = qpu_code; -++ } -++ for(i=0;i<12;i++) { -++ gpu->mail2[i*2] = p[17+i]; -++ gpu->mail2[i*2 + 1] = qpu_codeb; -++ } -++ if (have_vpu) { -++ execute_multi(gpu->mb, -++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -++ q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 -++ q[0] = 0; -++ } else { -++ execute_multi(gpu->mb, -++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -++ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -++ } -++ p[0] = 0; -++ p[7] = 0; -++ p[16] = 0; -++ } else { -++ av_assert0(have_vpu); -++ vpu_execute_code(q[0], q[1], q[2], q[3], q[4], q[5], q[6]); -++ q[0] = 0; -++ } -++#else -++ -+ if (!qpu_code) { -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ } else { -+@@ -449,17 +516,29 @@ static void *vpu_start(void *arg) { -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+ #endif -+ } -++#endif -++ -+ #ifdef RPI_TIME_TOTAL_POSTED -+ end_time = Microseconds(); -+ last_time = end_time; -++#ifdef RPI_COMBINE_JOBS -++ // There are three cases we may wish to distinguish of VPU/QPU activity -++ on_time += end_time - start_time; -++#else -+ if (p[6]==2) -+ on_time_deblock += end_time - start_time; -+ else -+ on_time += end_time - start_time; -++#endif -+ count++; -+ if ((count&0x7f)==0) -++#ifdef RPI_COMBINE_JOBS -+ printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -++#else -++ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++#endif -+ #endif -++job_done_early: -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond_head); -+-- -+2.7.4 -+ -+ -+From 0d54661f303b2a8903e806648ed54a34dcf315dc Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 1 Jul 2015 12:53:10 +0100 -+Subject: [PATCH 66/68] Added chroma deblocking -+ -+--- -+ libavcodec/hevc.c | 20 ++ -+ libavcodec/hevc.h | 12 +- -+ libavcodec/hevc_filter.c | 92 +++++- -+ libavcodec/rpi_hevc_transform.h | 644 +++++++++++++++++++++++++++++++++++++++- -+ libavcodec/rpi_hevc_transform.s | 207 +++++++++++++ -+ libavcodec/rpi_qpu.c | 27 +- -+ libavcodec/rpi_shader.qasm | 11 + -+ 7 files changed, 988 insertions(+), 25 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 4ce94a7..8437e10 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -251,6 +251,14 @@ static void pic_arrays_free(HEVCContext *s) -+ gpu_free(&s->y_setup_ptr); -+ s->y_setup_arm = 0; -+ } -++ if (s->uv_setup_arm) { -++ gpu_free(&s->uv_setup_ptr); -++ s->uv_setup_arm = 0; -++ } -++ if (s->vpu_cmds_arm) { -++ gpu_free(&s->vpu_cmds_ptr); -++ s->vpu_cmds_arm = 0; -++ } -+ #endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+@@ -324,6 +332,18 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ s->y_setup_vc = (void*)s->y_setup_ptr.vc; -+ memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); -+ printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); -++ -++ s->uv_setup_width = ( (sps->width >> sps->hshift[1]) + 15) / 16; -++ s->uv_setup_height = ( (sps->height >> sps->vshift[1]) + 15) / 16; -++ gpu_malloc_uncached(sizeof(*s->uv_setup_arm) * s->uv_setup_width * s->uv_setup_height, &s->uv_setup_ptr); // TODO make this cached -++ s->uv_setup_arm = (void*)s->uv_setup_ptr.arm; -++ s->uv_setup_vc = (void*)s->uv_setup_ptr.vc; -++ memset(s->uv_setup_arm, 0, s->uv_setup_ptr.numbytes); -++ printf("Setup uv %d by %d by %d\n",s->uv_setup_width,s->uv_setup_height,sizeof(*s->uv_setup_arm)); -++ -++ gpu_malloc_uncached(sizeof(*s->vpu_cmds_arm) * 3,&s->vpu_cmds_ptr); -++ s->vpu_cmds_arm = (void*) s->vpu_cmds_ptr.arm; -++ s->vpu_cmds_vc = s->vpu_cmds_ptr.vc; -+ #endif -+ -+ s->bs_width = (width >> 2) + 1; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index cf08489..7eb37e6 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -56,7 +56,7 @@ -+ #define RPI_MAX_JOBS 2 -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+- -++ // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs -+ #define RPI_DEBLOCK_VPU -+ -+ #endif -+@@ -980,6 +980,16 @@ typedef struct HEVCContext { -+ uint8_t (*y_setup_vc)[2][2][2][4]; -+ int setup_width; // Number of 16x16 blocks across the image -+ int setup_height; // Number of 16x16 blocks down the image -++ -++ GPU_MEM_PTR_T uv_setup_ptr; -++ uint8_t (*uv_setup_arm)[2][2][2][4]; // Half of this is unused [][][1][], but easier for the VPU as it allows us to store with zeros and addresses are aligned -++ uint8_t (*uv_setup_vc)[2][2][2][4]; -++ int uv_setup_width; -++ int uv_setup_height; -++ -++ GPU_MEM_PTR_T vpu_cmds_ptr; -++ int (*vpu_cmds_arm)[6]; // r0-r5 for each command -++ int vpu_cmds_vc; -+ #endif -+ -+ #endif -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 06371da..6367068 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -656,9 +656,23 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int xc = x>>s->ps.sps->hshift[chroma]; -++ int yc = y>>s->ps.sps->vshift[chroma]; -++ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); -++ int a = ((yc>>3) & 1) << 1; -++ int b = (xc>>3) & 1; -++ setup = s->uv_setup_arm[num16]; -++ setup[0][b][0][a] = c_tc[0]; -++ setup[0][b][0][a + 1] = c_tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_v_loop_filter_chroma(src, -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -++ -+ } -+ } -+ -+@@ -689,6 +703,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int xc = x>>s->ps.sps->hshift[chroma]; -++ int yc = y>>s->ps.sps->vshift[chroma]; -++ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); -++ int a = ((xc>>3) & 1) << 1; -++ int b = (yc>>3) & 1; -++ setup = s->uv_setup_arm[num16]; -++ setup[1][b][0][a] = c_tc[0]; -++ setup[1][b][0][a + 1] = c_tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_h_loop_filter_chroma(src, -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -+@@ -1013,33 +1040,56 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+ { -+ // Flush image, 4 lines above to bottom of ctb stripe -+- ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); -++ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 1); -+ // TODO flush buffer of beta/tc setup when it becomes cached -++ -++ // Prepare three commands at once to avoid calling overhead -++ s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; -++ s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; -++ s->vpu_cmds_arm[0][2] = s->setup_width; -++ s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); -++ s->vpu_cmds_arm[0][4] = ctb_size>>4; -++ s->vpu_cmds_arm[0][5] = 2; -++ -++ s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -++ s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; -++ s->vpu_cmds_arm[1][2] = s->uv_setup_width; -++ s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -++ s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -++ s->vpu_cmds_arm[1][5] = 3; -++ -++ s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -++ s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; -++ s->vpu_cmds_arm[2][2] = s->uv_setup_width; -++ s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -++ s->vpu_cmds_arm[2][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -++ s->vpu_cmds_arm[2][5] = 4; -++ -+ // Call VPU -+- // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion -+- vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], -+- s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), -+- ctb_size>>4, 2, 0)); // 2 means to do the deblocking code -++ vpu_wait(vpu_post_code( vpu_get_fn(), s->vpu_cmds_vc, 3, 0, 0, 0, 5, 0)); // 5 means to do all the commands -+ } -+ -+-static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) -+-{ -+- int y2; -+- for(y2=y;y2= s->ps.sps->width - ctb_size; -++#ifdef RPI_DEBLOCK_VPU -++ int done_deblock = 0; -++#endif -+ if (s->avctx->skip_loop_filter < AVDISCARD_ALL) -+ deblocking_filter_CTB(s, x, y); -+ #ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock && x_end) -+ { -+- rpi_deblock(s, y, ctb_size); -++ int y_at_end = y >= s->ps.sps->height - ctb_size; -++ int height = 64; // Deblock in units 64 high to avoid too many VPU calls -++ int y_start = y&~63; -++ if (y_at_end) height = s->ps.sps->height - y_start; -++ if ((((y+ctb_size)&63)==0) || y_at_end) { -++ done_deblock = 1; -++ rpi_deblock(s, y_start, height); -++ } -+ } -+ #endif -+ if (s->ps.sps->sao_enabled) { -+@@ -1070,11 +1120,25 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -++ if (done_deblock) { -++ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++ } -++ } else { -++#ifdef RPI_INTER_QPU -++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -++#endif -++ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++ } -++#else -+ #ifdef RPI_INTER_QPU -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -+- // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -++ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++#endif -+ } -+ } -+ -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index b3f155f..4309f1c 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -3,14 +3,32 @@ unsigned char rpi_hevc_transform [] = { -+ 106, -+ 0, -+ 144, -+-38, -++47, -+ 1, -+ 37, -+ 106, -+ 0, -+ 144, -+-57, -++66, -+ 1, -++53, -++106, -++0, -++144, -++192, -++4, -++69, -++106, -++0, -++144, -++192, -++4, -++85, -++106, -++0, -++144, -++220, -++5, -+ 169, -+ 3, -+ 62, -+@@ -2427,4 +2445,626 @@ unsigned char rpi_hevc_transform [] = { -+ 128, -+ 90, -+ 0, -++169, -++3, -++14, -++96, -++4, -++31, -++169, -++3, -++30, -++96, -++1, -++31, -++73, -++64, -++52, -++64, -++45, -++64, -++2, -++64, -++10, -++64, -++64, -++198, -++1, -++7, -++8, -++232, -++63, -++0, -++0, -++0, -++6, -++232, -++253, -++255, -++255, -++255, -++0, -++246, -++0, -++0, -++0, -++4, -++215, -++64, -++3, -++96, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++30, -++106, -++132, -++24, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++143, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++135, -++0, -++131, -++102, -++0, -++158, -++71, -++0, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++30, -++106, -++132, -++24, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++112, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++104, -++0, -++131, -++102, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++30, -++106, -++134, -++24, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++123, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++112, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++3, -++99, -++131, -++71, -++68, -++232, -++32, -++0, -++0, -++0, -++0, -++99, -++2, -++99, -++23, -++102, -++7, -++106, -++127, -++156, -++178, -++255, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++30, -++106, -++134, -++24, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++72, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++61, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++25, -++102, -++9, -++106, -++2, -++30, -++41, -++3, -++26, -++87, -++162, -++64, -++64, -++198, -++1, -++23, -++127, -++158, -++95, -++255, -++239, -++3, -++0, -++254, -++128, -++143, -++94, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++95, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++208, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++209, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++47, -++0, -++8, -++255, -++227, -++23, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++52, -++0, -++180, -++192, -++51, -++0, -++0, -++111, -++3, -++239, -++3, -++0, -++254, -++128, -++143, -++14, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++15, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++16, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++17, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++13, -++0, -++8, -++255, -++227, -++3, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++4, -++0, -++180, -++192, -++51, -++0, -++0, -++111, -++3, -++32, -++246, -++192, -++11, -++1, -++16, -++32, -++246, -++2, -++140, -++47, -++240, -++32, -++247, -++35, -++141, -++63, -++178, -++64, -++254, -++35, -++141, -++2, -++68, -++192, -++243, -++128, -++11, -++32, -++255, -++35, -++240, -++58, -++226, -++192, -++243, -++188, -++10, -++0, -++254, -++0, -++141, -++4, -++4, -++0, -++240, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++240, -++246, -++35, -++141, -++48, -++66, -++0, -++247, -++227, -++143, -++52, -++242, -++32, -++247, -++227, -++142, -++52, -++178, -++90, -++0, -++161, -++3, -++6, -++64, -++23, -++64, -++96, -++8, -++70, -++98, -++97, -++8, -++70, -++98, -++98, -++8, -++70, -++98, -++99, -++8, -++70, -++98, -++100, -++8, -++70, -++98, -++101, -++8, -++70, -++98, -++255, -++159, -++8, -++250, -++23, -++102, -++7, -++106, -++112, -++30, -++33, -++3, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index b055208..5543093 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -85,6 +85,13 @@ hevc_trans_16x16: -+ beq memclear16 -+ cmp r5,2 -+ beq hevc_deblock_16x16 -++ cmp r5,3 -++ beq hevc_uv_deblock_16x16 -++ cmp r5,4 -++ beq hevc_uv_deblock_16x16_with_clear -++ cmp r5,5 -++ beq hevc_run_command_list -++ -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+@@ -708,3 +715,203 @@ normal_filtering: -+ -+ filtering_done: -+ b lr -++ -++ -++hevc_uv_deblock_16x16: -++ push r6-r15, lr -++ mov r14,0 -++ b hevc_uv_start -++hevc_uv_deblock_16x16_with_clear: -++ push r6-r15, lr -++ mov r14,1 -++ b hevc_uv_start -++ -++hevc_uv_start: -++ mov r9,r4 -++ mov r4,r3 -++ mov r13,r2 -++ mov r2,r0 -++ mov r10,r0 -++ subscale4 r0,r1 -++ mov r8,63 -++ mov r6,-3 -++ vmov H(zeros,0),0 -++# r7 is number of blocks still to load -++# r0 is location of current block - 4 * stride -++# r1 is stride -++# r2 is location of current block -++# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical -++# r4 is setup -++# r5 is for temporary calculations -++# r8 holds 63 -++# r6 holds -3 -++# r9 holds the number of 16 high rows to process -++# r10 holds the original img base -++# r11 returns 0 if no filtering was done on the edge -++# r12 saves a copy of this -++# r13 is copy of width -++# r14 is 1 if we should clear the old contents, or 0 if not -++ -++uv_process_row: -++ # First iteration does not do horizontal filtering on previous -++ mov r7, r13 -++ mov r3,0 -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) # We may wish to prefetch these -++ cmp r14,1 -++ bne uv_skip0 -++ vstb H(zeros,0),(r4) -++uv_skip0: -++ bl uv_vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 -++ bl uv_vert_filter -++ sub r3,8 -++ b uv_start_deblock_loop -++uv_deblock_loop: -++ # Middle iterations do vertical on current block and horizontal on preceding -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) -++ cmp r14,1 -++ bne uv_skip1 -++ vstb H(zeros,0),(r4) -++uv_skip1: -++ bl uv_vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl uv_vert_filter -++ sub r3,8 -++ vldb H(setup_input,0), -16(r4) -++ cmp r14,1 -++ bne uv_skip3 -++ vstb H(zeros,0),-16(r4) -++uv_skip3: -++ bl uv_horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl uv_horz_filter -++ sub r3,8*64 -++ addcmpbeq r12,0,0,uv_skip_save_top -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++uv_skip_save_top: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++uv_start_deblock_loop: -++ # move onto next 16x16 (could do this with circular buffer support instead) -++ add r3,16 -++ and r3,r8 -++ add r4,32 -++ # Perform loop counter operations (may work with an addcmpbgt as well?) -++ add r0,16 -++ add r2,16 -++ sub r7,1 -++ cmp r7,0 # Are there still more blocks to load -++ bgt uv_deblock_loop -++ -++ # Final iteration needs to just do horizontal filtering -++ vldb H(setup_input,0), -16(r4) -++ cmp r14,1 -++ bne uv_skip2 -++ vstb H(zeros,0),-16(r4) -++uv_skip2: -++ bl uv_horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl uv_horz_filter -++ sub r3,64*8 -++ addcmpbeq r12,0,0,uv_skip_save_top2 -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++uv_skip_save_top2: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++ -++# Now look to see if we should do another row -++ sub r9,1 -++ cmp r9,0 -++ bgt uv_start_again -++ pop r6-r15, pc -++uv_start_again: -++ # Need to sort out r0,r2 to point to next row down -++ addscale16 r10,r1 -++ mov r2,r10 -++ subscale4 r0,r2,r1 -++ b uv_process_row -++ -++ -++# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered -++# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations -++ -++uv_vert_filter: -++ push lr -++ -++ vmov HX(P1,0), V(16,14)+r3 -++ vmov HX(P0,0), V(16,15)+r3 -++ vmov HX(Q0,0), V(16,16)+r3 -++ vmov HX(Q1,0), V(16,17)+r3 -++ -++ bl do_chroma_filter -++ -++ vadds V(16,15)+r3, HX(P0,0), 0 -++ vadds V(16,16)+r3, HX(Q0,0), 0 -++ -++ pop pc -++ -++# Filter edge at H(16,0)+r3 -++uv_horz_filter: -++ push lr -++ -++ vmov HX(P1,0), H(14,0)+r3 -++ vmov HX(P0,0), H(15,0)+r3 -++ vmov HX(Q0,0), H(16,0)+r3 -++ vmov HX(Q1,0), H(17,0)+r3 -++ -++ bl do_chroma_filter -++ -++ vadds H(15,0)+r3, HX(P0,0), 0 -++ # P3 and Q3 never change so don't bother saving back -++ vadds H(16,0)+r3, HX(Q0,0), 0 -++ -++ pop pc -++ -++# r4 points to array of beta/tc for each 4 length edge -++do_chroma_filter: -++ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # tc*8 -++ valtl HX(tc,0),H(setup,0),H(setup,0) -++ -++ vsub HX(delta,0),HX(Q0,0),HX(P0,0) -++ vshl HX(delta,0),HX(delta,0),2 CLRA SACC -++ vsub -,HX(P1,0),HX(Q1,0) SACC -++ vmov HX(delta,0),4 SACC -++ vasr HX(delta,0),HX(delta,0),3 -++ vclamps HX(delta,0), HX(delta,0), HX(tc,0) -++ vadd HX(P0,0),HX(P0,0),HX(delta,0) -++ vsub HX(Q0,0),HX(Q0,0),HX(delta,0) -++ b lr -++ -++# r0 = list -++# r1 = number -++hevc_run_command_list: -++ push r6-r7, lr -++ mov r6, r0 -++ mov r7, r1 -++loop_cmds: -++ ld r0,(r6) # How to encode r6++? -++ add r6,4 -++ ld r1,(r6) -++ add r6,4 -++ ld r2,(r6) -++ add r6,4 -++ ld r3,(r6) -++ add r6,4 -++ ld r4,(r6) -++ add r6,4 -++ ld r5,(r6) -++ add r6,4 -++ bl hevc_trans_16x16 -++ sub r7,1 -++ cmp r7,0 -++ bgt loop_cmds -++ -++ pop r6-r7, pc -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 91777be..5aa0432 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -397,6 +397,8 @@ static void *vpu_start(void *arg) { -+ int start_time; -+ int end_time; -+ int count=0; -++ int count_deblock=0; -++ int count_qpu=0; -+ #endif -+ while(1) { -+ int i; -+@@ -442,7 +444,7 @@ static void *vpu_start(void *arg) { -+ break; -+ } -+ } -+- printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); -++ //printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); -+ #endif -+ qpu_code = p[7]; -+ qpu_codeb = p[16]; -+@@ -460,6 +462,12 @@ static void *vpu_start(void *arg) { -+ off_time += start_time-last_time; -+ #endif -+ -++#define NO_FLUSH 1 -++#define CLEAR_PROFILE 2 -++#define OUTPUT_COUNTS 4 -++ -++#define FLAGS_FOR_PROFILING (NO_FLUSH) -++ -+ #ifdef RPI_COMBINE_JOBS -+ if (have_qpu) { -+ for(i=0;i<8;i++) { -+@@ -472,14 +480,14 @@ static void *vpu_start(void *arg) { -+ } -+ if (have_vpu) { -+ execute_multi(gpu->mb, -+- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 -+ q[0] = 0; -+ } else { -+ execute_multi(gpu->mb, -+- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+@@ -510,7 +518,7 @@ static void *vpu_start(void *arg) { -+ execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); -+ #else -+ execute_multi(gpu->mb, -+- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING , 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+@@ -525,17 +533,20 @@ static void *vpu_start(void *arg) { -+ // There are three cases we may wish to distinguish of VPU/QPU activity -+ on_time += end_time - start_time; -+ #else -+- if (p[6]==2) -++ if (p[6]>1) { -++ count_deblock++; -+ on_time_deblock += end_time - start_time; -+- else -++ } else { -+ on_time += end_time - start_time; -++ count_qpu++; -++ } -+ #endif -+ count++; -+ if ((count&0x7f)==0) -+ #ifdef RPI_COMBINE_JOBS -+- printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -+-#else -+ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++#else -++ printf("Posted %d On=%dms (%d calls), On_deblock=%dms (%d calls), Off=%dms\n",count,(int)(on_time/1000),count_qpu,(int)(on_time_deblock/1000),count_deblock,(int)(off_time/1000)); -+ #endif -+ #endif -+ job_done_early: -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 0686249..64bf5b0 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -1077,6 +1077,17 @@ nop ; nop # delay slot 2 -+ ::mc_interrupt_exit12 -+ mov -, vw_wait # wait on the VDW -+ -++ # Dummy wait to test instructions -++# mov r3,1000000 -++#:dummy_loop -++# sub.setf r3, r3, 1 -++# nop -++# nop -++# brr.anynn -, r:dummy_loop -++# nop -++# nop -++# nop -++ -+ ldtmu0 -+ ldtmu0 -+ ldtmu1 -+-- -+2.7.4 -+ -+ -+From 12a194bddd049ab97154e9fbdd46b63b558a3bee Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Tue, 23 Jun 2015 23:42:03 +0100 -+Subject: [PATCH 67/68] armv7/hevc: Optimise deblocking boundary strength -+ calculation -+ -+--- -+ libavcodec/arm/hevcdsp_deblock_neon.S | 115 +++++++++++++++++ -+ libavcodec/arm/hevcdsp_init_neon.c | 9 ++ -+ libavcodec/hevc.h | 11 -- -+ libavcodec/hevc_filter.c | 224 ++++++++++++++-------------------- -+ libavcodec/hevcdsp.c | 116 ++++++++++++++++++ -+ libavcodec/hevcdsp.h | 14 +++ -+ 6 files changed, 344 insertions(+), 145 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S -+index 166bddb..bad4589 100644 -+--- a/libavcodec/arm/hevcdsp_deblock_neon.S -++++ b/libavcodec/arm/hevcdsp_deblock_neon.S -+@@ -383,3 +383,118 @@ function ff_hevc_h_loop_filter_chroma_neon, export=1 -+ vst1.8 {d4}, [r0] -+ bx lr -+ endfunc -++ -++/* ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, -++ * int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ * MvField *curr, MvField *neigh, uint8_t *bs) -++ */ -++function ff_hevc_deblocking_boundary_strengths_neon, export=1 -++ add ip, sp, #4*4 -++ push {a2-a4,v1-v8,lr} -++ ldmia ip, {v5-v7} -++1: ldmdb ip, {v1-v4} -++ ldrsb a3, [v5, #8] @ curr->ref_idx -++ ldrsb v8, [v5, #9] -++ ldrsb ip, [v6, #8] @ neigh->ref_idx -++ ldrsb lr, [v6, #9] -++ ldr v1, [v1, a3, lsl #2] -++ ldrb a3, [v5, #10] @ curr->pred_flag -++ ldr v2, [v2, v8, lsl #2] -++ ldrb v8, [v6, #10] @ neigh->pred_flag -++ ldr v3, [v3, ip, lsl #2] -++ ldr v4, [v4, lr, lsl #2] -++ teq a3, #3 -++ beq 20f -++ teq v8, #3 -++ beq 90f -++ -++ tst a3, #1 -++ ldrne a3, [v5, #0] @ curr->mv[0] -++ ldreq a3, [v5, #4] @ curr->mv[1] -++ moveq v1, v2 -++ tst v8, #1 -++ ldrne v8, [v6, #0] @ neigh->mv[0] -++ ldreq v8, [v6, #4] @ neigh->mv[1] -++ moveq v3, v4 -++ teq v1, v3 -++ bne 10f -++ ldr lr, =0xFFFCFFFC -++ ssub16 ip, v8, a3 -++ ssub16 a3, a3, v8 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ @ drop through -++10: movne a3, #1 -++11: subs a2, a2, #1 -++12: strbhs a3, [v7], a4 -++ subs a2, a2, #1 -++ bhs 12b -++ -++ ldm sp, {a2, a3} -++ add ip, sp, #16*4 -++ subs a1, a1, #1 -++ add v5, v5, a3 -++ add v6, v6, a3 -++ bhi 1b -++ pop {a2-a4,v1-v8,pc} -++ -++20: teq v8, #3 -++ bne 10b -++ -++ teq v1, v3 -++ teqeq v2, v4 -++ bne 40f -++ teq v1, v2 -++ bne 30f -++ -++ ldrd v1, v2, [v5] @ curr->mv -++ ldrd v3, v4, [v6] @ neigh->mv -++ ldr lr, =0xFFFCFFFC -++ ssub16 ip, v3, v1 -++ ssub16 a3, v1, v3 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ bne 25f -++ ssub16 ip, v4, v2 -++ ssub16 a3, v2, v4 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ beq 11b -++ @ drop through -++25: ssub16 ip, v4, v1 -++ ssub16 a3, v1, v4 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ bne 10b -++ ssub16 ip, v3, v2 -++ ssub16 a3, v2, v3 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ b 10b -++ -++30: ldrd v1, v2, [v5] @ curr->mv -++ ldrd v3, v4, [v6] @ neigh->mv -++ ldr lr, =0xFFFCFFFC -++ ssub16 ip, v3, v1 -++ ssub16 a3, v1, v3 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ bne 10b -++ ssub16 ip, v4, v2 -++ ssub16 a3, v2, v4 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ b 10b -++ -++40: teq v1, v4 -++ teqeq v2, v3 -++ bne 10b -++ -++ ldrd v1, v2, [v5] @ curr->mv -++ ldrd v3, v4, [v6] @ neigh->mv -++ ldr lr, =0xFFFCFFFC -++ b 25b -++ -++90: mov a3, #1 -++ b 11b -++endfunc -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index e5da7e9..49c70dd 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -290,6 +290,10 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ } -+ #undef CMP -+ -++void ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, -++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ MvField *curr, MvField *neigh, uint8_t *bs); -++ -+ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ { -+ if (bit_depth == 8) { -+@@ -387,4 +391,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; -+ c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; -+ } -++ -++ assert(offsetof(MvField, mv) == 0); -++ assert(offsetof(MvField, ref_idx) == 8); -++ assert(offsetof(MvField, pred_flag) == 10); -++ c->hevc_deblocking_boundary_strengths = ff_hevc_deblocking_boundary_strengths_neon; -+ } -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 7eb37e6..496c0e1 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -684,17 +684,6 @@ typedef struct CodingUnit { -+ uint8_t cu_transquant_bypass_flag; -+ } CodingUnit; -+ -+-typedef struct Mv { -+- int16_t x; ///< horizontal component of motion vector -+- int16_t y; ///< vertical component of motion vector -+-} Mv; -+- -+-typedef struct MvField { -+- DECLARE_ALIGNED(4, Mv, mv)[2]; -+- int8_t ref_idx[2]; -+- int8_t pred_flag; -+-} MvField; -+- -+ typedef struct NeighbourAvailable { -+ int cand_bottom_left; -+ int cand_left; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 6367068..826a82f 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -726,69 +726,6 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ } -+ } -+ -+-static int boundary_strength(HEVCContext *s, MvField *curr, MvField *neigh, -+- RefPicList *neigh_refPicList) -+-{ -+- if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -+- // same L0 and L1 -+- if (s->ref->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] && -+- s->ref->refPicList[0].list[curr->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]] && -+- neigh_refPicList[0].list[neigh->ref_idx[0]] == neigh_refPicList[1].list[neigh->ref_idx[1]]) { -+- if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && -+- (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) -+- return 1; -+- else -+- return 0; -+- } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && -+- neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { -+- if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) -+- return 1; -+- else -+- return 0; -+- } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && -+- neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { -+- if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) -+- return 1; -+- else -+- return 0; -+- } else { -+- return 1; -+- } -+- } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -+- Mv A, B; -+- int ref_A, ref_B; -+- -+- if (curr->pred_flag & 1) { -+- A = curr->mv[0]; -+- ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]]; -+- } else { -+- A = curr->mv[1]; -+- ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]]; -+- } -+- -+- if (neigh->pred_flag & 1) { -+- B = neigh->mv[0]; -+- ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]]; -+- } else { -+- B = neigh->mv[1]; -+- ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]]; -+- } -+- -+- if (ref_A == ref_B) { -+- if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4) -+- return 1; -+- else -+- return 0; -+- } else -+- return 1; -+- } -+- -+- return 1; -+-} -+ -+ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ int log2_trafo_size) -+@@ -799,10 +736,17 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ int log2_min_tu_size = s->ps.sps->log2_min_tb_size; -+ int min_pu_width = s->ps.sps->min_pu_width; -+ int min_tu_width = s->ps.sps->min_tb_width; -+- int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width + -+- (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA; -+ int boundary_upper, boundary_left; -+- int i, j, bs; -++ int i, j; -++ RefPicList *rpl = s->ref->refPicList; -++ int min_pu_in_4pix = (1 << log2_min_pu_size) >> 2; -++ int trafo_in_min_pus = (1 << log2_trafo_size) >> log2_min_pu_size; -++ int y_pu = y0 >> log2_min_pu_size; -++ int x_pu = x0 >> log2_min_pu_size; -++ MvField *curr = &tab_mvf[y_pu * min_pu_width + x_pu]; -++ int is_intra = curr->pred_flag == PF_INTRA; -++ int inc = log2_min_pu_size == 2 ? 2 : 1; -++ uint8_t *bs; -+ -+ #ifdef DISABLE_STRENGTHS -+ return; -+@@ -818,34 +762,56 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) -+ boundary_upper = 0; -+ -++ bs = &s->horizontal_bs[(x0 + y0 * s->bs_width) >> 2]; -++ -+ if (boundary_upper) { -+ RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ? -+ ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) : -+- s->ref->refPicList; -+- int yp_pu = (y0 - 1) >> log2_min_pu_size; -+- int yq_pu = y0 >> log2_min_pu_size; -+- int yp_tu = (y0 - 1) >> log2_min_tu_size; -+- int yq_tu = y0 >> log2_min_tu_size; -++ rpl; -++ MvField *top = curr - min_pu_width; -++ -++ if (is_intra) { -++ for (i = 0; i < (1 << log2_trafo_size); i += 4) -++ bs[i >> 2] = 2; -++ -++ } else { -++ int y_tu = y0 >> log2_min_tu_size; -++ int x_tu = x0 >> log2_min_tu_size; -++ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; -++ uint8_t *top_cbf_luma = curr_cbf_luma - min_tu_width; -++ -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, sizeof (MvField), 4 >> 2, -++ rpl[0].list, rpl[1].list, rpl_top[0].list, rpl_top[1].list, -++ curr, top, bs); -+ -+ for (i = 0; i < (1 << log2_trafo_size); i += 4) { -+- int x_pu = (x0 + i) >> log2_min_pu_size; -+- int x_tu = (x0 + i) >> log2_min_tu_size; -+- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; -+- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; -+- uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu]; -+- uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu]; -+- -+- if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA) -+- bs = 2; -+- else if (curr_cbf_luma || top_cbf_luma) -+- bs = 1; -+- else -+- bs = boundary_strength(s, curr, top, rpl_top); -+- s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs; -++ int i_pu = i >> log2_min_pu_size; -++ int i_tu = i >> log2_min_tu_size; -++ -++ if (top[i_pu].pred_flag == PF_INTRA) -++ bs[i >> 2] = 2; -++ else if (curr_cbf_luma[i_tu] || top_cbf_luma[i_tu]) -++ bs[i >> 2] = 1; -+ } -++ } -++ } -++ -++ if (!is_intra) { -++ for (j = inc; j < trafo_in_min_pus; j += inc) { -++ MvField *top; -++ -++ curr += min_pu_width * inc; -++ top = curr - min_pu_width; -++ bs += s->bs_width * inc << log2_min_pu_size >> 2; -++ -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, sizeof (MvField), 4 >> 2, -++ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, -++ curr, top, bs); -++ } -+ } -+ -+- // bs for vertical TU boundaries -+ boundary_left = x0 > 0 && !(x0 & 7); -+ if (boundary_left && -+ ((!s->sh.slice_loop_filter_across_slices_enabled_flag && -+@@ -856,64 +822,54 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) -+ boundary_left = 0; -+ -++ curr = &tab_mvf[y_pu * min_pu_width + x_pu]; -++ bs = &s->vertical_bs[(x0 + y0 * s->bs_width) >> 2]; -++ -+ if (boundary_left) { -+ RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? -+ ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) : -+- s->ref->refPicList; -+- int xp_pu = (x0 - 1) >> log2_min_pu_size; -+- int xq_pu = x0 >> log2_min_pu_size; -+- int xp_tu = (x0 - 1) >> log2_min_tu_size; -+- int xq_tu = x0 >> log2_min_tu_size; -+- -+- for (i = 0; i < (1 << log2_trafo_size); i += 4) { -+- int y_pu = (y0 + i) >> log2_min_pu_size; -+- int y_tu = (y0 + i) >> log2_min_tu_size; -+- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -+- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -+- uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu]; -+- uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu]; -+- -+- if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA) -+- bs = 2; -+- else if (curr_cbf_luma || left_cbf_luma) -+- bs = 1; -+- else -+- bs = boundary_strength(s, curr, left, rpl_left); -+- s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs; -+- } -+- } -++ rpl; -++ MvField *left = curr - 1; -+ -+- if (log2_trafo_size > log2_min_pu_size && !is_intra) { -+- RefPicList *rpl = s->ref->refPicList; -++ if (is_intra) { -++ for (j = 0; j < (1 << log2_trafo_size); j += 4) -++ bs[j * s->bs_width >> 2] = 2; -+ -+- // bs for TU internal horizontal PU boundaries -+- for (j = 8; j < (1 << log2_trafo_size); j += 8) { -+- int yp_pu = (y0 + j - 1) >> log2_min_pu_size; -+- int yq_pu = (y0 + j) >> log2_min_pu_size; -+- -+- for (i = 0; i < (1 << log2_trafo_size); i += 4) { -+- int x_pu = (x0 + i) >> log2_min_pu_size; -+- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; -+- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; -+- -+- bs = boundary_strength(s, curr, top, rpl); -+- s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; -++ } else { -++ int y_tu = y0 >> log2_min_tu_size; -++ int x_tu = x0 >> log2_min_tu_size; -++ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; -++ uint8_t *left_cbf_luma = curr_cbf_luma - 1; -++ -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, -++ rpl[0].list, rpl[1].list, rpl_left[0].list, rpl_left[1].list, -++ curr, left, bs); -++ -++ for (j = 0; j < (1 << log2_trafo_size); j += 4) { -++ int j_pu = j >> log2_min_pu_size; -++ int j_tu = j >> log2_min_tu_size; -++ -++ if (left[j_pu * min_pu_width].pred_flag == PF_INTRA) -++ bs[j * s->bs_width >> 2] = 2; -++ else if (curr_cbf_luma[j_tu * min_tu_width] || left_cbf_luma[j_tu * min_tu_width]) -++ bs[j * s->bs_width >> 2] = 1; -+ } -+ } -++ } -+ -+- // bs for TU internal vertical PU boundaries -+- for (j = 0; j < (1 << log2_trafo_size); j += 4) { -+- int y_pu = (y0 + j) >> log2_min_pu_size; -++ if (!is_intra) { -++ for (i = inc; i < trafo_in_min_pus; i += inc) { -++ MvField *left; -+ -+- for (i = 8; i < (1 << log2_trafo_size); i += 8) { -+- int xp_pu = (x0 + i - 1) >> log2_min_pu_size; -+- int xq_pu = (x0 + i) >> log2_min_pu_size; -+- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -+- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -++ curr += inc; -++ left = curr - 1; -++ bs += inc << log2_min_pu_size >> 2; -+ -+- bs = boundary_strength(s, curr, left, rpl); -+- s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; -+- } -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, -++ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, -++ curr, left, bs); -+ } -+ } -+ } -+diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c -+index 9d773d9..a6534a9 100644 -+--- a/libavcodec/hevcdsp.c -++++ b/libavcodec/hevcdsp.c -+@@ -123,6 +123,120 @@ DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters[3][16]) = { -+ #include "hevcdsp_template.c" -+ #undef BIT_DEPTH -+ -++static void hevc_deblocking_boundary_strengths(int pus, int dup, int in_inc, int out_inc, -++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ MvField *curr, MvField *neigh, uint8_t *bs) -++{ -++ for (; pus > 0; pus--) { -++ int strength, out; -++ int curr_refL0 = curr_rpl0[curr->ref_idx[0]]; -++ int curr_refL1 = curr_rpl1[curr->ref_idx[1]]; -++ int neigh_refL0 = neigh_rpl0[neigh->ref_idx[0]]; -++ int neigh_refL1 = neigh_rpl1[neigh->ref_idx[1]]; -++ -++#if 1 // This more directly matches the original implementation -++ if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -++ // same L0 and L1 -++ if (curr_refL0 == neigh_refL0 && -++ curr_refL0 == curr_refL1 && -++ neigh_refL0 == neigh_refL1) { -++ if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && -++ (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) -++ strength = 1; -++ else -++ strength = 0; -++ } else if (neigh_refL0 == curr_refL0 && -++ neigh_refL1 == curr_refL1) { -++ if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) -++ strength = 1; -++ else -++ strength = 0; -++ } else if (neigh_refL1 == curr_refL0 && -++ neigh_refL0 == curr_refL1) { -++ if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) -++ strength = 1; -++ else -++ strength = 0; -++ } else { -++ strength = 1; -++ } -++ } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -++ Mv curr_mv0, neigh_mv0; -++ -++ if (curr->pred_flag & 1) { -++ curr_mv0 = curr->mv[0]; -++ } else { -++ curr_mv0 = curr->mv[1]; -++ curr_refL0 = curr_refL1; -++ } -++ -++ if (neigh->pred_flag & 1) { -++ neigh_mv0 = neigh->mv[0]; -++ } else { -++ neigh_mv0 = neigh->mv[1]; -++ neigh_refL0 = neigh_refL1; -++ } -++ -++ if (curr_refL0 == neigh_refL0) { -++ if (FFABS(curr_mv0.x - neigh_mv0.x) >= 4 || FFABS(curr_mv0.y - neigh_mv0.y) >= 4) -++ strength = 1; -++ else -++ strength = 0; -++ } else -++ strength = 1; -++ } else -++ strength = 1; -++#else // This has exactly the same effect, but is more suitable for vectorisation -++ Mv curr_mv[2]; -++ Mv neigh_mv[2]; -++ memcpy(curr_mv, curr->mv, sizeof curr_mv); -++ memcpy(neigh_mv, neigh->mv, sizeof neigh_mv); -++ -++ if (!(curr->pred_flag & 2)) { -++ curr_mv[1] = curr_mv[0]; -++ curr_refL1 = curr_refL0; -++ } -++ if (!(neigh->pred_flag & 2)) { -++ neigh_mv[1] = neigh_mv[0]; -++ neigh_refL1 = neigh_refL0; -++ } -++ if (!(curr->pred_flag & 1)) { -++ curr_mv[0] = curr_mv[1]; -++ curr_refL0 = curr_refL1; -++ } -++ if (!(neigh->pred_flag & 1)) { -++ neigh_mv[0] = neigh_mv[1]; -++ neigh_refL0 = neigh_refL1; -++ } -++ -++ strength = 1; -++ -++ strength &= (neigh_refL0 != curr_refL0) | (neigh_refL1 != curr_refL1) | -++ (FFABS(neigh_mv[0].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[0].y) >= 4) | -++ (FFABS(neigh_mv[1].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[1].y) >= 4); -++ -++ strength &= (neigh_refL1 != curr_refL0) | (neigh_refL0 != curr_refL1) | -++ (FFABS(neigh_mv[1].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[0].y) >= 4) | -++ (FFABS(neigh_mv[0].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[1].y) >= 4); -++ -++ strength |= (((curr->pred_flag + 1) ^ (neigh->pred_flag + 1)) >> 2); -++#endif -++ -++ curr += in_inc / sizeof (MvField); -++ neigh += in_inc / sizeof (MvField); -++ -++ for (out = dup; out > 0; out--) -++ { -++ *bs = strength; -++ bs += out_inc; -++ } -++ } -++} -++ -+ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) -+ { -+ #undef FUNC -+@@ -257,6 +371,8 @@ int i = 0; -+ break; -+ } -+ -++ hevcdsp->hevc_deblocking_boundary_strengths = hevc_deblocking_boundary_strengths; -++ -+ if (ARCH_X86) -+ ff_hevc_dsp_init_x86(hevcdsp, bit_depth); -+ if (ARCH_ARM) -+diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h -+index 9f1f6dd..e221e54 100644 -+--- a/libavcodec/hevcdsp.h -++++ b/libavcodec/hevcdsp.h -+@@ -42,6 +42,17 @@ typedef struct SAOParams { -+ uint8_t type_idx[3]; ///< sao_type_idx -+ } SAOParams; -+ -++typedef struct Mv { -++ int16_t x; ///< horizontal component of motion vector -++ int16_t y; ///< vertical component of motion vector -++} Mv; -++ -++typedef struct MvField { -++ DECLARE_ALIGNED(4, Mv, mv)[2]; -++ int8_t ref_idx[2]; -++ int8_t pred_flag; -++} MvField; -++ -+ typedef struct HEVCDSPContext { -+ void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height, -+ struct GetBitContext *gb, int pcm_bit_depth); -+@@ -120,6 +131,9 @@ typedef struct HEVCDSPContext { -+ void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride, -+ int32_t *tc, uint8_t *no_p, -+ uint8_t *no_q); -++ void (*hevc_deblocking_boundary_strengths)(int pus, int dup, int in_inc, int out_inc, -++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ MvField *curr, MvField *neigh, uint8_t *bs); -+ } HEVCDSPContext; -+ -+ void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); -+-- -+2.7.4 -+ -+ -+From 619366d6acfd5f040a3116fda97b1146c8e40250 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 15 Jul 2015 09:09:11 +0100 -+Subject: [PATCH 68/68] Only enable qpu when needed -+ -+--- -+ libavcodec/hevc.h | 2 +- -+ libavcodec/rpi_qpu.c | 21 ++++++++++++++++----- -+ 2 files changed, 17 insertions(+), 6 deletions(-) -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 496c0e1..ce14975 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -57,7 +57,7 @@ -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+ // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs -+- #define RPI_DEBLOCK_VPU -++ //#define RPI_DEBLOCK_VPU -+ -+ #endif -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 5aa0432..ffd13ca 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -9,7 +9,7 @@ -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -+ // Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel -+-#define RPI_COMBINE_JOBS -++//#define RPI_COMBINE_JOBS -+ -+ #include -+ #include -+@@ -143,9 +143,9 @@ static int gpu_init(volatile struct GPU **gpu) { -+ volatile struct GPU* ptr; -+ if (mb < 0) -+ return -1; -+- -++#ifndef RPI_ASYNC -+ if (qpu_enable(mb, 1)) return -2; -+- -++#endif -+ vcsm_init(); -+ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -+ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -+@@ -336,9 +336,9 @@ static void gpu_term(void) -+ vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); -+ pthread_join(vpu_thread, &res); -+ } -+-#endif -+- -++#else -+ qpu_enable(mb, 0); -++#endif -+ gpu_free_internal(&gpu_mem_ptr); -+ -+ vcsm_exit(); -+@@ -400,6 +400,7 @@ static void *vpu_start(void *arg) { -+ int count_deblock=0; -+ int count_qpu=0; -+ #endif -++ int qpu_started = 0; -+ while(1) { -+ int i; -+ int *p; // Pointer for a QPU/VPU job -+@@ -427,6 +428,12 @@ static void *vpu_start(void *arg) { -+ if (p[7] == 0 && p[0] == 0 && p[16]==0) -+ goto job_done_early; -+ -++ if (!qpu_started) { -++ int result = qpu_enable(gpu->mb, 1); -++ av_assert0(result==0); -++ qpu_started = 1; -++ } -++ -+ #ifdef RPI_COMBINE_JOBS -+ // First scan for a qpu job -+ for (int x=0;xmb, 0); -++ } -++ -+ return NULL; -+ } -+ -+-- -+2.7.4 -+ -+From a0d0946951b53e64ce103dd61b455f8d1f72caf9 Mon Sep 17 00:00:00 2001 -+From: John Cox -+Date: Tue, 9 Feb 2016 11:57:40 +0000 -+Subject: [PATCH 1/2] Zero copy code v6 -+ -+This version has GPU buffer pooling code -+--- -+ ffmpeg.c | 123 +++++++++----- -+ libavcodec/Makefile | 2 + -+ libavcodec/avcodec.h | 6 + -+ libavcodec/hevc.c | 92 ++++++----- -+ libavcodec/hevc_filter.c | 83 +++++----- -+ libavcodec/rpi_qpu.c | 2 +- -+ libavcodec/rpi_qpu.h | 109 ++++++++++++- -+ libavcodec/rpi_zc.c | 406 +++++++++++++++++++++++++++++++++++++++++++++++ -+ libavcodec/rpi_zc.h | 83 ++++++++++ -+ 9 files changed, 779 insertions(+), 127 deletions(-) -+ create mode 100644 libavcodec/rpi_zc.c -+ create mode 100644 libavcodec/rpi_zc.h -+ -+diff --git a/ffmpeg.c b/ffmpeg.c -+index 50c6e86..953e5b8 100644 -+--- a/ffmpeg.c -++++ b/ffmpeg.c -+@@ -25,7 +25,7 @@ -+ -+ #ifdef RPI -+ #define RPI_DISPLAY -+-//#define RPI_ZERO_COPY -++#define RPI_ZERO_COPY -+ #endif -+ -+ #include "config.h" -+@@ -80,9 +80,7 @@ -+ #include -+ #include -+ #include -+-#ifdef RPI_ZERO_COPY -+-#include "libavcodec/rpi_qpu.h" -+-#endif -++#include "libavcodec/rpi_zc.h" -+ #endif -+ -+ #if HAVE_SYS_RESOURCE_H -+@@ -183,13 +181,7 @@ static void free_input_threads(void); -+ -+ static MMAL_COMPONENT_T* rpi_display = NULL; -+ static MMAL_POOL_T *rpi_pool = NULL; -+- -+-#ifdef RPI_ZERO_COPY -+-static uint8_t *get_vc_handle(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return (uint8_t *)p->vc_handle; -+-} -+-#endif -++static volatile int rpi_display_count = 0; -+ -+ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+ { -+@@ -206,7 +198,7 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+ for (i = 0; i < NUM_BUFFERS; ++i) -+ { -+ MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; -+- void* bufPtr = buffer->data; -++ char * bufPtr = buffer->data; -+ memset(bufPtr, i*30, w*h); -+ memset(bufPtr+w*h, 128, (w*h)/2); -+ } -+@@ -215,23 +207,31 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+ return pool; -+ } -+ -+-static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -++static void display_cb_input(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { -++#ifdef RPI_ZERO_COPY -++ av_rpi_zc_unref(buffer->user_data); -++ --rpi_display_count; -++#endif -++ mmal_buffer_header_release(buffer); -++} -++ -++static void display_cb_control(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -+ mmal_buffer_header_release(buffer); -+ } -+ -+ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+ { -+ MMAL_COMPONENT_T* display; -+- int w2 = (w+31)&~31; -+- int h2 = (h+15)&~15; -+ MMAL_DISPLAYREGION_T region = -+ { -+- {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -++ .hdr = {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, -+ .layer = 2, -+ .fullscreen = 0, -+ .dest_rect = {x, y, w, h} -+ }; -++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(w, h); -++ -+ bcm_host_init(); // TODO is this needed? -+ mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); -+ assert(display); -+@@ -240,8 +240,8 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+ -+ MMAL_ES_FORMAT_T* format = display->input[0]->format; -+ format->encoding = MMAL_ENCODING_I420; -+- format->es->video.width = w2; -+- format->es->video.height = h2; -++ format->es->video.width = geo.stride_y; -++ format->es->video.height = geo.height_y; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = w; -+@@ -250,46 +250,75 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+ -+ mmal_component_enable(display); -+ -+- rpi_pool = display_alloc_pool(display->input[0], w2, h2); -++ rpi_pool = display_alloc_pool(display->input[0], geo.stride_y, geo.height_y); -+ -+ mmal_port_enable(display->input[0],display_cb_input); -+- mmal_port_enable(display->control,display_cb_input); -++ mmal_port_enable(display->control,display_cb_control); -+ -+- printf("Allocated display %d %d\n",w,h); -++ printf("Allocated display %dx%d in %dx%d\n", w, h, geo.stride_y, geo.height_y); -+ -+ return display; -+ } -+ -+-static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) -++static void display_frame(struct AVCodecContext * const s, MMAL_COMPONENT_T* const display, const AVFrame* const fr) -+ { -+- int w = fr->width; -+- int h = fr->height; -+- int w2 = (w+31)&~31; -+- int h2 = (h+15)&~15; -+ if (!display || !rpi_pool) -+ return; -++ -++ if (rpi_display_count >= 3) { -++ av_log(s, AV_LOG_VERBOSE, "Frame dropped\n"); -++ return; -++ } -++ -+ MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); -+ if (!buf) { -+- // Running too fast so drop the frame -+- return; -++ // Running too fast so drop the frame -++ printf("Q alloc failure\n"); -++ return; -+ } -+ assert(buf); -+ buf->cmd = 0; -+- buf->length = (w2 * h2 * 3)/2; -+ buf->offset = 0; // Offset to valid data -+ buf->flags = 0; -+ #ifdef RPI_ZERO_COPY -+- buf->data = get_vc_handle(fr->buf[0]); -+- buf->alloc_size = (w2*h2*3)/2; -++{ -++ const AVRpiZcRefPtr fr_buf = av_rpi_zc_ref(s, fr, 1); -++ -++ buf->user_data = fr_buf; -++ buf->data = av_rpi_zc_vc_handle(fr_buf); -++ buf->alloc_size = -++ buf->length = av_rpi_zc_numbytes(fr_buf); -++ -++ ++rpi_display_count; -++} -+ #else -++{ -++#error YYY -++ int w = fr->width; -++ int h = fr->height; -++ int w2 = (w+31)&~31; -++ int h2 = (h+15)&~15; -++ -++ buf->length = (w2 * h2 * 3)/2; -++ buf->user_data = NULL; -++ -+ //mmal_buffer_header_mem_lock(buf); -+ memcpy(buf->data, fr->data[0], w2 * h); -+ memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); -+ memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); -+ //mmal_buffer_header_mem_unlock(buf); -++} -+ #endif -+ -+- mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released -++ while (rpi_display_count >= 3) { -++ usleep(5000); -++ } -++ -++ if (mmal_port_send_buffer(display->input[0], buf) != MMAL_SUCCESS) -++ { -++ printf("** send failed: depth=%d\n", rpi_display_count); -++ display_cb_input(NULL, buf); -++ } -+ } -+ -+ static void display_exit(MMAL_COMPONENT_T* display) -+@@ -687,6 +716,11 @@ static void ffmpeg_cleanup(int ret) -+ avformat_close_input(&input_files[i]->ctx); -+ av_freep(&input_files[i]); -+ } -++ -++#ifdef RPI_DISPLAY -++ display_exit(rpi_display); -++#endif -++ -+ for (i = 0; i < nb_input_streams; i++) { -+ InputStream *ist = input_streams[i]; -+ -+@@ -698,6 +732,9 @@ static void ffmpeg_cleanup(int ret) -+ av_freep(&ist->filters); -+ av_freep(&ist->hwaccel_device); -+ -++#ifdef RPI_ZERO_COPY -++ av_rpi_zc_uninit(ist->dec_ctx); -++#endif -+ avcodec_free_context(&ist->dec_ctx); -+ -+ av_freep(&input_streams[i]); -+@@ -729,9 +766,6 @@ static void ffmpeg_cleanup(int ret) -+ term_exit(); -+ ffmpeg_exited = 1; -+ -+-#ifdef RPI_DISPLAY -+- display_exit(rpi_display); -+-#endif -+ } -+ -+ void remove_avoptions(AVDictionary **a, AVDictionary *b) -+@@ -1091,18 +1125,19 @@ static void do_video_out(AVFormatContext *s, -+ int frame_size = 0; -+ InputStream *ist = NULL; -+ AVFilterContext *filter = ost->filter->filter; -++ -++ if (ost->source_index >= 0) -++ ist = input_streams[ost->source_index]; -++ -+ #ifdef RPI_DISPLAY -+- if (next_picture) -++ if (next_picture && ist != NULL) -+ { -+- if (!rpi_display) -++ if (!rpi_display) -+ rpi_display = display_init(0,0,next_picture->width,next_picture->height); -+- display_frame(rpi_display,next_picture); -++ display_frame(ist->dec_ctx, rpi_display, next_picture); -+ } -+ #endif -+ -+- if (ost->source_index >= 0) -+- ist = input_streams[ost->source_index]; -+- -+ if (filter->inputs[0]->frame_rate.num > 0 && -+ filter->inputs[0]->frame_rate.den > 0) -+ duration = 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base)); -+@@ -2708,6 +2743,12 @@ static int init_input_stream(int ist_index, char *error, int error_len) -+ ist->dec_ctx->opaque = ist; -+ ist->dec_ctx->get_format = get_format; -+ ist->dec_ctx->get_buffer2 = get_buffer; -++ -++#ifdef RPI_ZERO_COPY -++ // Overrides the above get_buffer2 -++ av_rpi_zc_init(ist->dec_ctx); -++#endif -++ -+ ist->dec_ctx->thread_safe_callbacks = 1; -+ -+ av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0); -+diff --git a/libavcodec/Makefile b/libavcodec/Makefile -+index 03065cd..21e4514 100644 -+--- a/libavcodec/Makefile -++++ b/libavcodec/Makefile -+@@ -9,6 +9,7 @@ HEADERS = avcodec.h \ -+ rpi_shader.h \ -+ rpi_mailbox.h \ -+ rpi_hevc_transform.h \ -++ rpi_zc.h \ -+ d3d11va.h \ -+ dirac.h \ -+ dv_profile.h \ -+@@ -50,6 +51,7 @@ OBJS = allcodecs.o \ -+ rpi_qpu.o \ -+ rpi_shader.o \ -+ rpi_mailbox.o \ -++ rpi_zc.o \ -+ vorbis_parser.o \ -+ xiph.o \ -+ -+diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -+index 39713ed..a1ba217 100644 -+--- a/libavcodec/avcodec.h -++++ b/libavcodec/avcodec.h -+@@ -3505,6 +3505,12 @@ typedef struct AVCodecContext { -+ #define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 -+ #endif -+ -++ /** -++ * Opaque pointer for use by replacement get_buffer2 code -++ * -++ * @author jc (08/02/2016) -++ */ -++ void * get_buffer_context; -+ } AVCodecContext; -+ -+ AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 8437e10..51736c7 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -114,10 +114,6 @@ static uint32_t rpi_filter_coefs[8][1] = { -+ { ENCODE_COEFFS( -2, 10, 58, -2) } -+ }; -+ -+-static uint32_t get_vc_address(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return p->vc; -+-} -+ #endif -+ -+ -+@@ -2197,9 +2193,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); -+ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+@@ -2207,7 +2203,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ } else { -+ *y++ = 1; // Weight of 1 and offset of 0 -+ } -+- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+@@ -2246,8 +2242,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); -+ *u++ = ( (bwframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->curr_u_mvs = u; -+@@ -2297,9 +2293,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); -+ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+@@ -2307,7 +2303,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ } else { -+ *y++ = 1; // Weight of 1 and offset of 0 -+ } -+- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+@@ -2347,8 +2343,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); -+ *u++ = ( (bwsh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+@@ -2360,8 +2356,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = 1; // Weight of 1 and offset of 0 -+ *u++ = 1; -+ } -+- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->curr_u_mvs = u; -+@@ -2403,13 +2399,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); -+ *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ *y++ = 1; // B frame weighted prediction not supported -+- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+@@ -2453,8 +2449,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); -+ *u++ = ( (bwmc_filter_uv_b; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); -+ *u++ = ( (bwframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->curr_u_mvs = u; -+@@ -3270,12 +3266,13 @@ static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx, -+ return vsum; -+ } -+ -+-static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) -++static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, const int cIdx) -+ { -+ //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; -+ int pitch = frame->linesize[cIdx]; -+- uint32_t base = get_vc_address(frame->buf[cIdx]); -++ uint32_t base = c_idx == 0 ? get_vc_address_y(frame); -++ c_idx == 1 ? get_vc_address_u(frame) : get_vc_address_v(frame); -+ if (p>=base && pdata[cIdx] + (p-base); -+ } -+@@ -3562,6 +3559,7 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ #ifdef RPI -+ -+ #ifndef RPI_FAST_CACHEFLUSH -++#error RPI_FAST_CACHEFLUSH is broken -+ static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+@@ -3572,7 +3570,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+ int curr_uv = 0; -+@@ -3580,21 +3578,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ int sz,base; -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)(p->arm) + base; -++ iocache.s[0].addr = (int)(p.arm) + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)(p->arm) + base; -++ iocache.s[1].addr = (int)(p.arm) + base; -+ iocache.s[1].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)(p->arm) + base; -++ iocache.s[2].addr = (int)(p.arm) + base; -+ iocache.s[2].size = sz; -+ vcsm_clean_invalid( &iocache ); -+ #else -+@@ -3612,7 +3610,7 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM -+ int curr_y; -+ int curr_uv; -+ int n_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); -+ int sz,base; -+ int (*d)[2] = s->dblk_cmds[job]; -+ int low=(*d)[1]; -+@@ -3629,21 +3627,21 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM -+ -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)(p->arm) + base; -++ iocache.s[0].addr = (int)(p.arm) + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)(p->arm) + base; -++ iocache.s[1].addr = (int)(p.arm) + base; -+ iocache.s[1].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)(p->arm) + base; -++ iocache.s[2].addr = (int)(p.arm) + base; -+ iocache.s[2].size = sz; -+ -+ iocache.s[3].handle = p0->vcsm_handle; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 826a82f..c4fa305 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -879,17 +879,25 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ #undef CR -+ -+ #ifdef RPI_INTER_QPU -+-static void flush_buffer(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- gpu_cache_flush(p); -++static void flush_buffer_y(const AVFrame * const frame) { -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_y(frame); -++ gpu_cache_flush(&p); -+ } -+ -+-// Return Physical address for this image -+-static uint32_t get_vc_address(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return p->vc; -++static void flush_buffer_u(const AVFrame * const frame) { -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(frame); -++ gpu_cache_flush(&p); -+ } -+ -++static void flush_buffer_v(const AVFrame * const frame) { -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_v(frame); -++ gpu_cache_flush(&p); -++} -++ -++ -++#ifdef RPI_DEBLOCK_VPU -++#error Not fixed yet -++ -+ // ff_hevc_flush_buffer_lines -+ // flushes and invalidates all pixel rows in [start,end-1] -+ static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) -+@@ -901,44 +909,44 @@ static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int f -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+- GPU_MEM_PTR_T *p; -++ GPU_MEM_PTR_T p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ if (flush_chroma) { -+- p = av_buffer_pool_opaque(s->frame->buf[1]); -+- iocache.s[0].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_u(s->frame); -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)p->arm + base; -++ iocache.s[0].addr = (int)p.arm + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(s->frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)p->arm + base; -++ iocache.s[1].addr = (int)p.arm + base; -+ iocache.s[1].size = sz; -+ } -+ if (flush_luma) { -+- p = av_buffer_pool_opaque(s->frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)p->arm + base; -++ iocache.s[2].addr = (int)p.arm + base; -+ iocache.s[2].size = sz; -+ } -+ vcsm_clean_invalid( &iocache ); -+ #else -+ if (flush_chroma) { -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ flush_buffer_u(s->frame); -++ flush_buffer_v(s->frame); -+ } -+ if (flush_luma) { -+- flush_buffer(s->frame->buf[0]); -++ flush_buffer_y(s->frame); -+ } -+ #endif -+ } -+- -++#endif -+ -+ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+@@ -950,37 +958,37 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+- GPU_MEM_PTR_T *p; -++ GPU_MEM_PTR_T p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- p = av_buffer_pool_opaque(s->frame->buf[1]); -+- iocache.s[0].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_u(s->frame); -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)p->arm + base; -++ iocache.s[0].addr = (int)p.arm + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(s->frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)p->arm + base; -++ iocache.s[1].addr = (int)p.arm + base; -+ iocache.s[1].size = sz; -+ -+ #ifdef RPI_LUMA_QPU -+- p = av_buffer_pool_opaque(s->frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)p->arm + base; -++ iocache.s[2].addr = (int)p.arm + base; -+ iocache.s[2].size = sz; -+ #endif -+ vcsm_clean_invalid( &iocache ); -+ #else -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ flush_buffer_u(s->frame); -++ flush_buffer_v(s->frame); -+ #ifdef RPI_LUMA_QPU -+- flush_buffer(s->frame->buf[0]); -++ flush_buffer_y(s->frame); -+ #endif -+ -+ #endif -+@@ -992,6 +1000,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ #endif -+ -+ #ifdef RPI_DEBLOCK_VPU -++#error XXX -+ /* rpi_deblock deblocks an entire row of ctbs using the VPU */ -+ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+ { -+@@ -1000,21 +1009,21 @@ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+ // TODO flush buffer of beta/tc setup when it becomes cached -+ -+ // Prepare three commands at once to avoid calling overhead -+- s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; -++ s->vpu_cmds_arm[0][0] = get_vc_address_y(s->frame) + s->frame->linesize[0] * y; -+ s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; -+ s->vpu_cmds_arm[0][2] = s->setup_width; -+ s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); -+ s->vpu_cmds_arm[0][4] = ctb_size>>4; -+ s->vpu_cmds_arm[0][5] = 2; -+ -+- s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -++ s->vpu_cmds_arm[1][0] = get_vc_address_u(s->frame) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -+ s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; -+ s->vpu_cmds_arm[1][2] = s->uv_setup_width; -+ s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -+ s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -+ s->vpu_cmds_arm[1][5] = 3; -+ -+- s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -++ s->vpu_cmds_arm[2][0] = get_vc_address_v(s->frame) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -+ s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; -+ s->vpu_cmds_arm[2][2] = s->uv_setup_width; -+ s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index ffd13ca..b0c9bc5 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -250,7 +250,7 @@ int gpu_get_mailbox(void) -+ } -+ -+ // Call this to clean and invalidate a region of memory -+-void gpu_cache_flush(GPU_MEM_PTR_T *p) -++void gpu_cache_flush(const GPU_MEM_PTR_T * const p) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 81c2bb1..b913f79 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -2,8 +2,11 @@ -+ #define RPI_QPU_H -+ -+ // Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code -++// *** N.B. Code has rotted & crashes if this is unset (before this set of changes) -+ #define RPI_FAST_CACHEFLUSH -+ -++#define RPI_ONE_BUF 1 -++ -+ typedef struct gpu_mem_ptr_s { -+ unsigned char *arm; // Pointer to memory mapped on ARM side -+ int vc_handle; // Videocore handle of relocatable memory -+@@ -16,9 +19,113 @@ typedef struct gpu_mem_ptr_s { -+ extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -+ extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -+ extern void gpu_free(GPU_MEM_PTR_T *p); -+-extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -++extern void gpu_cache_flush(const GPU_MEM_PTR_T * const p); -+ extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -++#include "libavutil/frame.h" -++#if !RPI_ONE_BUF -++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[0]); -++ return p->vc; -++} -++ -++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ return p->vc; -++} -++ -++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[2]); -++ return p->vc; -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[0]); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[1]); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[2]); -++} -++ -++#else -++ -++static inline int gpu_is_buf1(const AVFrame * const frame) -++{ -++ return frame->buf[1] == NULL; -++} -++ -++static inline GPU_MEM_PTR_T * gpu_buf1_gmem(const AVFrame * const frame) -++{ -++ return av_buffer_get_opaque(frame->buf[0]); -++} -++ -++static inline GPU_MEM_PTR_T * gpu_buf3_gmem(const AVFrame * const frame, const int n) -++{ -++ return av_buffer_pool_opaque(frame->buf[n]); -++} -++ -++ -++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -++ return gpu_is_buf1(frame) ? gpu_buf1_gmem(frame)->vc : gpu_buf3_gmem(frame, 0)->vc; -++} -++ -++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -++ return gpu_is_buf1(frame) ? -++ gpu_buf1_gmem(frame)->vc + frame->data[1] - frame->data[0] : -++ gpu_buf3_gmem(frame, 1)->vc; -++} -++ -++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -++ return gpu_is_buf1(frame) ? -++ gpu_buf1_gmem(frame)->vc + frame->data[2] - frame->data[0] : -++ gpu_buf3_gmem(frame, 2)->vc; -++} -++ -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -++ if (gpu_is_buf1(frame)) -++ { -++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -++ g.numbytes = frame->data[1] - frame->data[0]; -++ return g; -++ } -++ else -++ return *gpu_buf3_gmem(frame, 0); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -++ if (gpu_is_buf1(frame)) -++ { -++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -++ g.arm += frame->data[1] - frame->data[0]; -++ g.vc += frame->data[1] - frame->data[0]; -++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -++ return g; -++ } -++ else -++ return *gpu_buf3_gmem(frame, 1); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -++ if (gpu_is_buf1(frame)) -++ { -++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -++ g.arm += frame->data[2] - frame->data[0]; -++ g.vc += frame->data[2] - frame->data[0]; -++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -++ return g; -++ } -++ else -++ return *gpu_buf3_gmem(frame, 2); -++} -++ -++#endif -++ -++ -+ // QPU specific functions -+ extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -+diff --git a/libavcodec/rpi_zc.c b/libavcodec/rpi_zc.c -+new file mode 100644 -+index 0000000..9580165 -+--- /dev/null -++++ b/libavcodec/rpi_zc.c -+@@ -0,0 +1,406 @@ -++#include "config.h" -++#ifdef RPI -++#include "rpi_qpu.h" -++#include "rpi_zc.h" -++ -++#include "libavutil/buffer_internal.h" -++ -++struct ZcPoolEnt; -++ -++typedef struct ZcPool -++{ -++ int numbytes; -++ struct ZcPoolEnt * head; -++ pthread_mutex_t lock; -++} ZcPool; -++ -++typedef struct ZcPoolEnt -++{ -++ // It is important that we start with gmem as other bits of code will expect to see that -++ GPU_MEM_PTR_T gmem; -++ struct ZcPoolEnt * next; -++ struct ZcPool * pool; -++} ZcPoolEnt; -++ -++static ZcPoolEnt * zc_pool_ent_alloc(ZcPool * const pool, const int size) -++{ -++ ZcPoolEnt * const zp = av_malloc(sizeof(ZcPoolEnt)); -++ -++ if (zp == NULL) { -++ av_log(NULL, AV_LOG_ERROR, "av_malloc(ZcPoolEnt) failed\n"); -++ goto fail0; -++ } -++ -++ if (gpu_malloc_cached(size, &zp->gmem) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "av_gpu_malloc_cached(%d) failed\n", size); -++ goto fail1; -++ } -++ -++ zp->next = NULL; -++ zp->pool = pool; -++ return zp; -++ -++fail1: -++ av_free(zp); -++fail0: -++ return NULL; -++} -++ -++static void zc_pool_ent_free(ZcPoolEnt * const zp) -++{ -++ gpu_free(&zp->gmem); -++ av_free(zp); -++} -++ -++static void zc_pool_flush(ZcPool * const pool) -++{ -++ ZcPoolEnt * p = pool->head; -++ pool->head = NULL; -++ while (p != NULL) -++ { -++ ZcPoolEnt * const zp = p; -++ p = p->next; -++ zc_pool_ent_free(zp); -++ } -++} -++ -++static ZcPoolEnt * zc_pool_alloc(ZcPool * const pool, const int numbytes) -++{ -++ ZcPoolEnt * zp; -++ pthread_mutex_lock(&pool->lock); -++ -++ if (numbytes != pool->numbytes) -++ { -++ zc_pool_flush(pool); -++ pool->numbytes = numbytes; -++ } -++ -++ if (pool->head != NULL) -++ { -++ zp = pool->head; -++ pool->head = zp->next; -++ } -++ else -++ { -++ zp = zc_pool_ent_alloc(pool, numbytes); -++ } -++ -++ pthread_mutex_unlock(&pool->lock); -++ return zp; -++} -++ -++static void zc_pool_free(ZcPoolEnt * const zp) -++{ -++ ZcPool * const pool = zp == NULL ? NULL : zp->pool; -++ if (zp != NULL) -++ { -++ pthread_mutex_lock(&pool->lock); -++ if (pool->numbytes == zp->gmem.numbytes) -++ { -++ zp->next = pool->head; -++ pool->head = zp; -++ pthread_mutex_unlock(&pool->lock); -++ } -++ else -++ { -++ pthread_mutex_unlock(&pool->lock); -++ zc_pool_ent_free(zp); -++ } -++ } -++} -++ -++static void -++zc_pool_init(ZcPool * const pool) -++{ -++ pool->numbytes = -1; -++ pool->head = NULL; -++ pthread_mutex_init(&pool->lock, NULL); -++} -++ -++static void -++zc_pool_destroy(ZcPool * const pool) -++{ -++ pool->numbytes = -1; -++ zc_pool_flush(pool); -++ pthread_mutex_destroy(&pool->lock); -++} -++ -++ -++typedef struct AVZcEnv -++{ -++ ZcPool pool; -++} ZcEnv; -++ -++// Callback when buffer unrefed to zero -++static void rpi_free_display_buffer(void *opaque, uint8_t *data) -++{ -++ ZcPoolEnt *const zp = opaque; -++// printf("%s: data=%p\n", __func__, data); -++ zc_pool_free(zp); -++} -++ -++static inline GPU_MEM_PTR_T * pic_gm_ptr(AVBufferRef * const buf) -++{ -++ // Kludge where we check the free fn to check this is really -++ // one of our buffers - can't think of a better way -++ return buf == NULL || buf->buffer->free != rpi_free_display_buffer ? NULL : -++ av_buffer_get_opaque(buf); -++} -++ -++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -++ const unsigned int video_width, const unsigned int video_height) -++{ -++ AVRpiZcFrameGeometry geo; -++ geo.stride_y = (video_width + 32 + 31) & ~31; -++ geo.stride_c = geo.stride_y / 2; -++// geo.height_y = (video_height + 15) & ~15; -++ geo.height_y = (video_height + 32 + 31) & ~31; -++ geo.height_c = geo.height_y / 2; -++ return geo; -++} -++ -++static AVBufferRef * rpi_buf_pool_alloc(ZcPool * const pool, int size) -++{ -++ ZcPoolEnt *const zp = zc_pool_alloc(pool, size); -++ AVBufferRef * buf; -++ -++ if (zp == NULL) { -++ av_log(NULL, AV_LOG_ERROR, "zc_pool_alloc(%d) failed\n", size); -++ goto fail0; -++ } -++ -++ if ((buf = av_buffer_create(zp->gmem.arm, size, rpi_free_display_buffer, zp, AV_BUFFER_FLAG_READONLY)) == NULL) -++ { -++ av_log(NULL, AV_LOG_ERROR, "av_buffer_create() failed\n"); -++ goto fail2; -++ } -++ -++ return buf; -++ -++fail2: -++ zc_pool_free(zp); -++fail0: -++ return NULL; -++} -++ -++static int rpi_get_display_buffer(struct AVCodecContext * const s, AVFrame * const frame) -++{ -++ ZcEnv *const zc = s->get_buffer_context; -++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(frame->width, frame->height); -++ const unsigned int size_y = geo.stride_y * geo.height_y; -++ const unsigned int size_c = geo.stride_c * geo.height_c; -++ const unsigned int size_pic = size_y + size_c * 2; -++ AVBufferRef * buf; -++ unsigned int i; -++ -++// printf("Do local alloc: format=%#x, %dx%d: %u\n", frame->format, frame->width, frame->height, size_pic); -++ -++ if ((buf = rpi_buf_pool_alloc(&zc->pool, size_pic)) == NULL) -++ { -++ av_log(s, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); -++ return AVERROR(ENOMEM); -++ } -++ -++ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { -++ frame->buf[i] = NULL; -++ frame->data[i] = NULL; -++ frame->linesize[i] = 0; -++ } -++ -++ frame->buf[0] = buf; -++ frame->linesize[0] = geo.stride_y; -++ frame->linesize[1] = geo.stride_c; -++ frame->linesize[2] = geo.stride_c; -++ frame->data[0] = buf->data; -++ frame->data[1] = frame->data[0] + size_y; -++ frame->data[2] = frame->data[1] + size_c; -++ frame->extended_data = frame->data; -++ // Leave extended buf alone -++ -++ return 0; -++} -++ -++ -++#define RPI_GET_BUFFER2 1 -++ -++int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags) -++{ -++#if !RPI_GET_BUFFER2 -++ return avcodec_default_get_buffer2(s, frame, flags); -++#else -++ int rv; -++ -++ if ((s->codec->capabilities & AV_CODEC_CAP_DR1) == 0 || -++ frame->format != AV_PIX_FMT_YUV420P) -++ { -++// printf("Do default alloc: format=%#x\n", frame->format); -++ rv = avcodec_default_get_buffer2(s, frame, flags); -++ } -++ else -++ { -++ rv = rpi_get_display_buffer(s, frame); -++ } -++ -++#if 0 -++ printf("%s: %dx%d lsize=%d/%d/%d data=%p/%p/%p bref=%p/%p/%p opaque[0]=%p\n", __func__, -++ frame->width, frame->height, -++ frame->linesize[0], frame->linesize[1], frame->linesize[2], -++ frame->data[0], frame->data[1], frame->data[2], -++ frame->buf[0], frame->buf[1], frame->buf[2], -++ av_buffer_get_opaque(frame->buf[0])); -++#endif -++ return rv; -++#endif -++} -++ -++ -++static AVBufferRef * zc_copy(struct AVCodecContext * const s, -++ const AVFrame * const src) -++{ -++ AVFrame dest_frame; -++ AVFrame * const dest = &dest_frame; -++ unsigned int i; -++ uint8_t * psrc, * pdest; -++ -++ dest->width = src->width; -++ dest->height = src->height; -++ -++ if (rpi_get_display_buffer(s, dest) != 0) -++ { -++ return NULL; -++ } -++ -++ for (i = 0, psrc = src->data[0], pdest = dest->data[0]; -++ i != dest->height; -++ ++i, psrc += src->linesize[0], pdest += dest->linesize[0]) -++ { -++ memcpy(pdest, psrc, dest->width); -++ } -++ for (i = 0, psrc = src->data[1], pdest = dest->data[1]; -++ i != dest->height / 2; -++ ++i, psrc += src->linesize[1], pdest += dest->linesize[1]) -++ { -++ memcpy(pdest, psrc, dest->width / 2); -++ } -++ for (i = 0, psrc = src->data[2], pdest = dest->data[2]; -++ i != dest->height / 2; -++ ++i, psrc += src->linesize[2], pdest += dest->linesize[2]) -++ { -++ memcpy(pdest, psrc, dest->width / 2); -++ } -++ -++ return dest->buf[0]; -++} -++ -++ -++AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, -++ const AVFrame * const frame, const int maycopy) -++{ -++ assert(s != NULL); -++ -++ if (frame->format != AV_PIX_FMT_YUV420P) -++ { -++ av_log(s, AV_LOG_WARNING, "%s: *** Format not YUV420P: %d\n", __func__, frame->format); -++ return NULL; -++ } -++ -++ if (frame->buf[1] != NULL) -++ { -++ if (maycopy) -++ { -++ av_log(s, AV_LOG_INFO, "%s: *** Not a single buf frame: copying\n", __func__); -++ return zc_copy(s, frame); -++ } -++ else -++ { -++ av_log(s, AV_LOG_WARNING, "%s: *** Not a single buf frame: NULL\n", __func__); -++ return NULL; -++ } -++ } -++ -++ if (pic_gm_ptr(frame->buf[0]) == NULL) -++ { -++ if (maycopy) -++ { -++ av_log(s, AV_LOG_INFO, "%s: *** Not one of our buffers: copying\n", __func__); -++ return zc_copy(s, frame); -++ } -++ else -++ { -++ av_log(s, AV_LOG_WARNING, "%s: *** Not one of our buffers: NULL\n", __func__); -++ return NULL; -++ } -++ } -++ -++ return av_buffer_ref(frame->buf[0]); -++} -++ -++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref) -++{ -++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -++ return p == NULL ? -1 : p->vc_handle; -++} -++ -++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref) -++{ -++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -++ return p == NULL ? 0 : p->numbytes; -++} -++ -++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref) -++{ -++ if (fr_ref != NULL) -++ { -++ av_buffer_unref(&fr_ref); -++ } -++} -++ -++AVZcEnvPtr av_rpi_zc_env_alloc(void) -++{ -++ ZcEnv * const zc = av_mallocz(sizeof(ZcEnv)); -++ if (zc == NULL) -++ { -++ av_log(NULL, AV_LOG_ERROR, "av_rpi_zc_env_alloc: Context allocation failed\n"); -++ return NULL; -++ } -++ -++ zc_pool_init(&zc->pool); -++ return zc; -++} -++ -++void av_rpi_zc_env_free(AVZcEnvPtr zc) -++{ -++ if (zc != NULL) -++ { -++ zc_pool_destroy(&zc->pool); ; -++ av_free(zc); -++ } -++} -++ -++int av_rpi_zc_init(struct AVCodecContext * const s) -++{ -++ ZcEnv * const zc = av_rpi_zc_env_alloc(); -++ if (zc == NULL) -++ { -++ return AVERROR(ENOMEM); -++ } -++ -++ s->get_buffer_context = zc; -++ s->get_buffer2 = av_rpi_zc_get_buffer2; -++ return 0; -++} -++ -++void av_rpi_zc_uninit(struct AVCodecContext * const s) -++{ -++ if (s->get_buffer2 == av_rpi_zc_get_buffer2) -++ { -++ ZcEnv * const zc = s->get_buffer_context; -++ s->get_buffer2 = avcodec_default_get_buffer2; -++ s->get_buffer_context = NULL; -++ av_rpi_zc_env_free(zc); -++ } -++} -++ -++#endif // RPI -++ -+diff --git a/libavcodec/rpi_zc.h b/libavcodec/rpi_zc.h -+new file mode 100644 -+index 0000000..f0109f4 -+--- /dev/null -++++ b/libavcodec/rpi_zc.h -+@@ -0,0 +1,83 @@ -++#ifndef LIBAVCODEC_RPI_ZC_H -++#define LIBAVCODEC_RPI_ZC_H -++ -++// Zero-Copy frame code for RPi -++// RPi needs Y/U/V planes to be contiguous for display. By default -++// ffmpeg will allocate separated planes so a memcpy is needed before -++// display. This code prodes a method a making ffmpeg allocate a single -++// bit of memory for the frame when can then be refrence counted until -++// display ahs finsihed with it. -++ -++#include "libavutil/frame.h" -++#include "libavcodec/avcodec.h" -++ -++// "Opaque" pointer to whatever we are using as a buffer reference -++typedef AVBufferRef * AVRpiZcRefPtr; -++ -++struct AVZcEnv; -++typedef struct AVZcEnv * AVZcEnvPtr; -++ -++typedef struct AVRpiZcFrameGeometry -++{ -++ unsigned int stride_y; -++ unsigned int height_y; -++ unsigned int stride_c; -++ unsigned int height_c; -++} AVRpiZcFrameGeometry; -++ -++ -++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -++ const unsigned int video_width, const unsigned int video_height); -++ -++// Replacement fn for avctx->get_buffer2 -++// Should be set before calling avcodec_decode_open2 -++// -++// N.B. in addition to to setting avctx->get_buffer2, avctx->refcounted_frames -++// must be set to 1 as otherwise the buffer info is killed before being returned -++// by avcodec_decode_video2. Note also that this means that the AVFrame that is -++// return must be manually derefed with av_frame_unref. This should be done -++// after av_rpi_zc_ref has been called. -++int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags); -++ -++// Generate a ZC reference to the buffer(s) in this frame -++// If the buffer doesn't appear to be one allocated by _get_buffer_2 -++// then the behaviour depends on maycopy: -++// If maycopy=0 then return NULL -++// If maycopy=1 && the src frame is in a form where we can easily copy -++// the data, then allocate a new buffer and copy the data into it -++// Otherwise return NULL -++AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, -++ const AVFrame * const frame, const int maycopy); -++ -++// Get the vc_handle from the frame ref -++// Returns -1 if ref doesn't look valid -++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref); -++// Get the number of bytes allocated from the frame ref -++// Returns 0 if ref doesn't look valid -++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref); -++ -++// Unreference the buffer refed/allocated by _zc_ref -++// If fr_ref is NULL then this will NOP -++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref); -++ -++// Allocate an environment for the buffer pool used by the ZC code -++// This should be put in avctx->get_buffer_context so it can be found by -++// av_rpi_zc_get_buffer2 when it is called from ffmpeg -++AVZcEnvPtr av_rpi_zc_env_alloc(void); -++ -++// Allocate the environment used by the ZC code -++void av_rpi_zc_env_free(AVZcEnvPtr); -++ -++ -++// Init ZC into a context -++// There is nothing magic in this fn - it just packages setting -++// get_buffer2 & get_buffer_context -++int av_rpi_zc_init(struct AVCodecContext * const s); -++ -++// Free ZC from a context -++// There is nothing magic in this fn - it just packages unsetting -++// get_buffer2 & get_buffer_context -++void av_rpi_zc_uninit(struct AVCodecContext * const s); -++ -++#endif -++ -+-- -+2.7.4 -+ -+ -+From a6da64e1ca42f0394ccfa55dca782a456841da94 Mon Sep 17 00:00:00 2001 -+From: John Cox -+Date: Tue, 1 Mar 2016 14:21:25 +0000 -+Subject: [PATCH 2/2] Set VPU scheduling thread to high priority after creation -+ -+--- -+ libavcodec/rpi_qpu.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- -+ 1 file changed, 47 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index b0c9bc5..ee19231 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -182,9 +182,55 @@ static int gpu_init(volatile struct GPU **gpu) { -+ err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); -+ //printf("Created thread\n"); -+ if (err) { -+- printf("Failed to create vpu thread\n"); -++ av_log(NULL, AV_LOG_FATAL, "Failed to create vpu thread\n"); -+ return -4; -+ } -++ -++ { -++ struct sched_param param = {0}; -++ int policy = 0; -++ -++ if (pthread_getschedparam(vpu_thread, &policy, ¶m) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); -++ } -++ else -++ { -++ av_log(NULL, AV_LOG_INFO, "VPU thread: policy=%d (%s), pri=%d\n", -++ policy, -++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -++ param.sched_priority); -++ -++ policy = SCHED_FIFO; -++ param.sched_priority = sched_get_priority_max(SCHED_FIFO); -++ -++ av_log(NULL, AV_LOG_INFO, "Attempt to set: policy=%d (%s), pri=%d\n", -++ policy, -++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -++ param.sched_priority); -++ -++ if (pthread_setschedparam(vpu_thread, policy, ¶m) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "Unable to set VPU thread scheduling parameters\n"); -++ } -++ else -++ { -++ if (pthread_getschedparam(vpu_thread, &policy, ¶m) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); -++ } -++ else -++ { -++ av_log(NULL, AV_LOG_INFO, "VPU thread (after): policy=%d (%s), pri=%d\n", -++ policy, -++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -++ param.sched_priority); -++ } -++ } -++ } -++ -++ } -++ -+ } -+ #endif -+ -+-- -+2.7.4 -+ - -From 8e5e6f713dc181bc3f3b4bfb728d11aca00c846e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 12 Jan 2016 16:29:57 +0000 -Subject: [PATCH 27/62] ffmpeg: Add cabac opimisations for hevc - ---- - .../0001-Squashed-commit-of-the-following.patch | 2179 ++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 5 +- - tools/depends/target/ffmpeg/autobuild.sh | 2 + - 3 files changed, 2185 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch - -diff --git a/tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch b/tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..38554af0af30a85b7d88d31b7d21775cf294b0e3 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch -@@ -0,0 +1,2179 @@ -+From d08594462136274636c1f2f476a6410ff92a9e16 Mon Sep 17 00:00:00 2001 -+From: John Cox -+Date: Wed, 13 Jan 2016 16:13:33 +0000 -+Subject: [PATCH] H.265 residual decode rework (v2) -+ -+Rework the cabac decode functions -+Simplify the code flow and variable usage where possible -+ -+(Remove profiling and other spurious deltas that were in v1) -+--- -+ libavcodec/arm/cabac.h | 155 ++++- -+ libavcodec/arm/hevc_cabac.h | 491 +++++++++++++++ -+ libavcodec/arm/hevcdsp_deblock_neon.S | 13 +- -+ libavcodec/arm/hevcdsp_epel_neon.S | 9 +- -+ libavcodec/cabac.h | 9 +- -+ libavcodec/hevc_cabac.c | 1096 +++++++++++++++++++++++++-------- -+ 6 files changed, 1509 insertions(+), 264 deletions(-) -+ create mode 100644 libavcodec/arm/hevc_cabac.h -+ -+diff --git a/libavcodec/arm/cabac.h b/libavcodec/arm/cabac.h -+index fdbf86b..0a3980a 100644 -+--- a/libavcodec/arm/cabac.h -++++ b/libavcodec/arm/cabac.h -+@@ -26,13 +26,34 @@ -+ #include "libavutil/internal.h" -+ #include "libavcodec/cabac.h" -+ -++ -++#if UNCHECKED_BITSTREAM_READER -++#define LOAD_16BITS_BEHI\ -++ "ldrh %[tmp] , [%[ptr]] , #2 \n\t"\ -++ "rev %[tmp] , %[tmp] \n\t" -++#elif CONFIG_THUMB -++#define LOAD_16BITS_BEHI\ -++ "ldr %[tmp] , [%[c], %[end]] \n\t"\ -++ "cmp %[tmp] , %[ptr] \n\t"\ -++ "it cs \n\t"\ -++ "ldrhcs %[tmp] , [%[ptr]] , #2 \n\t"\ -++ "rev %[tmp] , %[tmp] \n\t" -++#else -++#define LOAD_16BITS_BEHI\ -++ "ldr %[tmp] , [%[c], %[end]] \n\t"\ -++ "cmp %[tmp] , %[ptr] \n\t"\ -++ "ldrcsh %[tmp] , [%[ptr]] , #2 \n\t"\ -++ "rev %[tmp] , %[tmp] \n\t" -++#endif -++ -++ -+ #define get_cabac_inline get_cabac_inline_arm -+ static av_always_inline int get_cabac_inline_arm(CABACContext *c, -+ uint8_t *const state) -+ { -+ int bit; -++#if 0 -+ void *reg_b, *reg_c, *tmp; -+- -+ __asm__ volatile( -+ "ldrb %[bit] , [%[state]] \n\t" -+ "add %[r_b] , %[tables] , %[lps_off] \n\t" -+@@ -100,9 +121,141 @@ static av_always_inline int get_cabac_inline_arm(CABACContext *c, -+ [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) -+ : "memory", "cc" -+ ); -++#else -++ // *** Not thumb compatible yet -++ unsigned int reg_b, tmp; -++ __asm__ ( -++ "ldrb %[bit] , [%[state]] \n\t" -++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -++ "and %[tmp] , %[range] , #0xC0 \n\t" -++ "add %[r_b] , %[r_b] , %[bit] \n\t" -++ "ldrb %[tmp] , [%[r_b] , %[tmp], lsl #1] \n\t" -++// %bit = *state -++// %range = range -++// %tmp = RangeLPS -++ "sub %[range] , %[range] , %[tmp] \n\t" -++ -++ "cmp %[low] , %[range] , lsl #17 \n\t" -++ "ittt ge \n\t" -++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -++ "mvnge %[bit] , %[bit] \n\t" -++ "movge %[range] , %[tmp] \n\t" -++ -++ "clz %[tmp] , %[range] \n\t" -++ "sub %[tmp] , #23 \n\t" -++ -++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -++ "lsl %[low] , %[low] , %[tmp] \n\t" -++ "lsl %[range] , %[range] , %[tmp] \n\t" -++ -++ "strb %[r_b] , [%[state]] \n\t" -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ -++ "bne 2f \n\t" -++ LOAD_16BITS_BEHI -++ "lsr %[tmp] , %[tmp] , #15 \n\t" -++ "movw %[r_b] , #0xFFFF \n\t" -++ "sub %[tmp] , %[tmp] , %[r_b] \n\t" -++ -++ "rbit %[r_b] , %[low] \n\t" -++ "clz %[r_b] , %[r_b] \n\t" -++ "sub %[r_b] , %[r_b] , #16 \n\t" -++#if CONFIG_THUMB -++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -++ "add %[low] , %[low] , %[tmp] \n\t" -++#else -++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -++#endif -++ "2: \n\t" -++ : [bit]"=&r"(bit), -++ [low]"+&r"(c->low), -++ [range]"+&r"(c->range), -++ [r_b]"=&r"(reg_b), -++ [ptr]"+&r"(c->bytestream), -++ [tmp]"=&r"(tmp) -++ : [state]"r"(state), -++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -++ [byte]"M"(offsetof(CABACContext, bytestream)), -++#if !UNCHECKED_BITSTREAM_READER -++ [c]"r"(c), -++ [end]"M"(offsetof(CABACContext, bytestream_end)), -++#endif -++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -++ : "memory", "cc" -++ ); -++#endif -+ -+ return bit & 1; -+ } -++ -++#define get_cabac_bypass get_cabac_bypass_arm -++static inline int get_cabac_bypass_arm(CABACContext * const c) -++{ -++ int rv = 0; -++ unsigned int tmp; -++ __asm ( -++ "lsl %[low] , #1 \n\t" -++ "cmp %[low] , %[range] , lsl #17 \n\t" -++ "adc %[rv] , %[rv] , #0 \n\t" -++ "it cs \n\t" -++ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "bne 1f \n\t" -++ LOAD_16BITS_BEHI -++ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" -++ "movw %[tmp] , #0xFFFF \n\t" -++ "sub %[low] , %[low] , %[tmp] \n\t" -++ "1: \n\t" -++ : // Outputs -++ [rv]"+&r"(rv), -++ [low]"+&r"(c->low), -++ [tmp]"=&r"(tmp), -++ [ptr]"+&r"(c->bytestream) -++ : // Inputs -++#if !UNCHECKED_BITSTREAM_READER -++ [c]"r"(c), -++ [end]"M"(offsetof(CABACContext, bytestream_end)), -++#endif -++ [range]"r"(c->range) -++ : "cc" -++ ); -++ return rv; -++} -++ -++ -++#define get_cabac_bypass_sign get_cabac_bypass_sign_arm -++static inline int get_cabac_bypass_sign_arm(CABACContext * const c, int rv) -++{ -++ unsigned int tmp; -++ __asm ( -++ "lsl %[low] , #1 \n\t" -++ "cmp %[low] , %[range] , lsl #17 \n\t" -++ "ite cc \n\t" -++ "rsbcc %[rv] , %[rv] , #0 \n\t" -++ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "bne 1f \n\t" -++ LOAD_16BITS_BEHI -++ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" -++ "movw %[tmp] , #0xFFFF \n\t" -++ "sub %[low] , %[low] , %[tmp] \n\t" -++ "1: \n\t" -++ : // Outputs -++ [rv]"+&r"(rv), -++ [low]"+&r"(c->low), -++ [tmp]"=&r"(tmp), -++ [ptr]"+&r"(c->bytestream) -++ : // Inputs -++#if !UNCHECKED_BITSTREAM_READER -++ [c]"r"(c), -++ [end]"M"(offsetof(CABACContext, bytestream_end)), -++#endif -++ [range]"r"(c->range) -++ : "cc" -++ ); -++ return rv; -++} -++ -+ #endif /* HAVE_ARMV6T2_INLINE */ -+ -+ #endif /* AVCODEC_ARM_CABAC_H */ -+diff --git a/libavcodec/arm/hevc_cabac.h b/libavcodec/arm/hevc_cabac.h -+new file mode 100644 -+index 0000000..31d3c59 -+--- /dev/null -++++ b/libavcodec/arm/hevc_cabac.h -+@@ -0,0 +1,491 @@ -++/* -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#ifndef AVCODEC_ARM_HEVC_CABAC_H -++#define AVCODEC_ARM_HEVC_CABAC_H -++ -++#include "config.h" -++#if HAVE_ARMV6T2_INLINE -++ -++#define hevc_mem_bits32 hevc_mem_bits32_arm -++static inline uint32_t hevc_mem_bits32_arm(const void * p, const unsigned int bits) -++{ -++ unsigned int n; -++ __asm__ ( -++ "rev %[n], %[x] \n\t" -++ : [n]"=r"(n) -++ : [x]"r"(*(const uint32_t *)((const uint8_t *)p + (bits >> 3))) -++ : -++ ); -++ return n << (bits & 7); -++} -++ -++ -++// --------------------------------------------------------------------------- -++// -++// Helper fns - little bits of code where ARM has an instraction that the -++// compiler doesn't know about / use -++ -++#define trans_scale_sat trans_scale_sat_arm -++static inline int trans_scale_sat_arm(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) -++{ -++ int rv; -++ int t = ((level * (int)(scale * scale_m)) >> shift) + 1; -++ -++ __asm__ ( -++ "ssat %[rv], #16, %[t], ASR #1 \n\t" -++ : [rv]"=r"(rv) -++ : [t]"r"(t) -++ : -++ ); -++ return rv; -++} -++ -++#define update_rice update_rice_arm -++static inline void update_rice_arm(uint8_t * const stat_coeff, -++ const unsigned int last_coeff_abs_level_remaining, -++ const unsigned int c_rice_param) -++{ -++ int t; -++ __asm__ ( -++ "lsl %[t], %[coeff], #1 \n\t" -++ "lsrs %[t], %[t], %[shift] \n\t" -++ "it eq \n\t" -++ "subeq %[stat], %[stat], #1 \n\t" -++ "cmp %[t], #6 \n\t" -++ "adc %[stat], %[stat], #0 \n\t" -++ "usat %[stat], #8, %[stat] \n\t" -++ : [stat]"+&r"(*stat_coeff), -++ [t]"=&r"(t) -++ : [coeff]"r"(last_coeff_abs_level_remaining), -++ [shift]"r"(c_rice_param) -++ : "cc" -++ ); -++} -++ -++// --------------------------------------------------------------------------- -++// -++// CABAC get loops -++// -++// Where the loop is simple enough we can normally do 10-30% better than the -++// compiler -++ -++// Get the residual greater than 1 bits -++ -++#define get_cabac_greater1_bits get_cabac_greater1_bits_arm -++static inline unsigned int get_cabac_greater1_bits_arm(CABACContext * const c, const unsigned int n, -++ uint8_t * const state0) -++{ -++ unsigned int i, reg_b, st, tmp, bit, rv; -++ __asm__ ( -++ "mov %[i] , #0 \n\t" -++ "mov %[rv] , #0 \n\t" -++ "1: \n\t" -++ "add %[i] , %[i] , #1 \n\t" -++ "cmp %[rv] , #0 \n\t" -++ "ite eq \n\t" -++ "usateq %[st] , #2 , %[i] \n\t" -++ "movne %[st] , #0 \n\t" -++ -++ "ldrb %[bit] , [%[state0], %[st]] \n\t" -++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -++ "and %[tmp] , %[range] , #0xC0 \n\t" -++ "add %[r_b] , %[r_b] , %[bit] \n\t" -++ "ldrb %[tmp] , [%[r_b], %[tmp], lsl #1] \n\t" -++ "sub %[range] , %[range] , %[tmp] \n\t" -++ -++ "cmp %[low] , %[range], lsl #17 \n\t" -++ "ittt ge \n\t" -++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -++ "mvnge %[bit] , %[bit] \n\t" -++ "movge %[range] , %[tmp] \n\t" -++ -++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -++ "and %[bit] , %[bit] , #1 \n\t" -++ "orr %[rv] , %[bit] , %[rv], lsl #1 \n\t" -++ -++ "clz %[tmp] , %[range] \n\t" -++ "sub %[tmp] , #23 \n\t" -++ -++ "lsl %[low] , %[low] , %[tmp] \n\t" -++ "lsl %[range] , %[range] , %[tmp] \n\t" -++ -++ "strb %[r_b] , [%[state0], %[st]] \n\t" -++// There is a small speed gain from combining both conditions, using a single -++// branch and then working out what that meant later -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "it ne \n\t" -++ "cmpne %[n] , %[i] \n\t" -++ "bne 1b \n\t" -++ -++// If reload is not required then we must have run out of flags to decode -++ "tst %[tmp] , %[tmp] \n\t" -++ "bne 2f \n\t" -++ -++// Do reload -++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" -++ "movw %[r_b] , #0xFFFF \n\t" -++ "rev %[tmp] , %[tmp] \n\t" -++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" -++ -++ "rbit %[r_b] , %[low] \n\t" -++ "clz %[r_b] , %[r_b] \n\t" -++ "sub %[r_b] , %[r_b] , #16 \n\t" -++ -++#if CONFIG_THUMB -++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -++ "add %[low] , %[low] , %[tmp] \n\t" -++#else -++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -++#endif -++ -++ "cmp %[n] , %[i] \n\t" -++ "bne 1b \n\t" -++ "2: \n\t" -++ : [bit]"=&r"(bit), -++ [low]"+&r"(c->low), -++ [range]"+&r"(c->range), -++ [r_b]"=&r"(reg_b), -++ [bptr]"+&r"(c->bytestream), -++ [i]"=&r"(i), -++ [tmp]"=&r"(tmp), -++ [st]"=&r"(st), -++ [rv]"=&r"(rv) -++ : [state0]"r"(state0), -++ [n]"r"(n), -++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -++ [byte]"M"(offsetof(CABACContext, bytestream)), -++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -++ : "memory", "cc" -++ ); -++ return rv; -++} -++ -++ -++// n must be > 0 on entry -++#define get_cabac_sig_coeff_flag_idxs get_cabac_sig_coeff_flag_idxs_arm -++static inline uint8_t * get_cabac_sig_coeff_flag_idxs_arm(CABACContext * const c, uint8_t * const state0, -++ unsigned int n, -++ const uint8_t const * ctx_map, -++ uint8_t * p) -++{ -++ unsigned int reg_b, tmp, st, bit; -++ __asm__ ( -++ "1: \n\t" -++// Get bin from map -++ "ldrb %[st] , [%[ctx_map], %[n]] \n\t" -++ -++// Load state & ranges -++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -++ "ldrb %[bit] , [%[state0], %[st]] \n\t" -++ "and %[tmp] , %[range] , #0xC0 \n\t" -++ "add %[r_b] , %[r_b] , %[tmp], lsl #1 \n\t" -++ "ldrb %[tmp] , [%[r_b], %[bit]] \n\t" -++ "sub %[range] , %[range] , %[tmp] \n\t" -++ -++ "cmp %[low] , %[range], lsl #17 \n\t" -++ "ittt ge \n\t" -++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -++ "mvnge %[bit] , %[bit] \n\t" -++ "movge %[range] , %[tmp] \n\t" -++ -++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -++ "tst %[bit] , #1 \n\t" -++// GCC asm seems to need strbne written differently for thumb and arm -++#if CONFIG_THUMB -++ "it ne \n\t" -++ "strbne %[n] , [%[idx]] , #1 \n\t" -++#else -++ "strneb %[n] , [%[idx]] , #1 \n\t" -++#endif -++ -++// Renorm -++ "clz %[tmp] , %[range] \n\t" -++ "sub %[tmp] , #23 \n\t" -++ "lsl %[low] , %[low] , %[tmp] \n\t" -++ "lsl %[range] , %[range] , %[tmp] \n\t" -++ -++ "strb %[r_b] , [%[state0], %[st]] \n\t" -++// There is a small speed gain from combining both conditions, using a single -++// branch and then working out what that meant later -++ "subs %[n] , %[n] , #1 \n\t" -++#if CONFIG_THUMB -++ "itt ne \n\t" -++ "lslsne %[tmp] , %[low] , #16 \n\t" -++ "bne 1b \n\t" -++#else -++ "lslnes %[tmp] , %[low] , #16 \n\t" -++ "bne 1b \n\t" -++#endif -++ -++// If we have bits left then n must be 0 so give up now -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "bne 2f \n\t" -++ -++// Do reload -++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" -++ "movw %[r_b] , #0xFFFF \n\t" -++ "rev %[tmp] , %[tmp] \n\t" -++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" -++ -++ "rbit %[r_b] , %[low] \n\t" -++ "clz %[r_b] , %[r_b] \n\t" -++ "sub %[r_b] , %[r_b] , #16 \n\t" -++ -++#if CONFIG_THUMB -++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -++ "add %[low] , %[low] , %[tmp] \n\t" -++#else -++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -++#endif -++ -++// Check to see if we still have more to do -++ "cmp %[n] , #0 \n\t" -++ "bne 1b \n\t" -++ "2: \n\t" -++ : [bit]"=&r"(bit), -++ [low]"+&r"(c->low), -++ [range]"+&r"(c->range), -++ [r_b]"=&r"(reg_b), -++ [bptr]"+&r"(c->bytestream), -++ [idx]"+&r"(p), -++ [n]"+&r"(n), -++ [tmp]"=&r"(tmp), -++ [st]"=&r"(st) -++ : [state0]"r"(state0), -++ [ctx_map]"r"(ctx_map), -++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -++ [byte]"M"(offsetof(CABACContext, bytestream)), -++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -++ : "memory", "cc" -++ ); -++ -++ return p; -++} -++ -++// --------------------------------------------------------------------------- -++// -++// CABAC_BY22 functions -++// -++// By and large these are (at best) no faster than their C equivalents - the -++// only one worth having is _peek where we do a slightly better job than the -++// compiler -++// -++// The others have been stashed here for reference in case larger scale asm -++// is attempted in which case they might be a useful base -++ -++ -++#define get_cabac_by22_peek get_cabac_by22_peek_arm -++static inline uint32_t get_cabac_by22_peek_arm(const CABACContext *const c) -++{ -++ uint32_t rv, tmp; -++ __asm__ ( -++ "bic %[rv] , %[low], #1 \n\t" -++ "cmp %[inv] , #0 \n\t" -++ "it ne \n\t" -++ "umullne %[tmp] , %[rv] , %[inv], %[rv] \n\t" -++ : // Outputs -++ [rv]"=&r"(rv), -++ [tmp]"=r"(tmp) -++ : // Inputs -++ [low]"r"(c->low), -++ [inv]"r"(c->range) -++ : // Clobbers -++ "cc" -++ ); -++ return rv << 1; -++} -++ -++#if 0 -++ -++// ***** Slower than the C :-( -++#define get_cabac_by22_flush get_cabac_by22_flush_arm -++static inline void get_cabac_by22_flush_arm(CABACContext *const c, const unsigned int n, const uint32_t val) -++{ -++ uint32_t m, tmp; -++ __asm__ ( -++ "add %[bits], %[bits], %[n] \n\t" -++ "ldr %[m], [%[ptr], %[bits], lsr #3] \n\t" -++ -++ "rsb %[tmp], %[n], #32 \n\t" -++ "lsr %[tmp], %[val], %[tmp] \n\t" -++ "mul %[tmp], %[range], %[tmp] \n\t" -++ -++ "rev %[m], %[m] \n\t" -++ -++ "lsl %[tmp], %[tmp], #23 \n\t" -++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -++ -++ "and %[tmp], %[bits], #7 \n\t" -++ "lsl %[m], %[m], %[tmp] \n\t" -++ -++ "orr %[low], %[low], %[m], lsr #9 \n\t" -++ : // Outputs -++ [m]"=&r"(m), -++ [tmp]"=&r"(tmp), -++ [bits]"+&r"(c->by22.bits), -++ [low]"+&r"(c->low) -++ : // Inputs -++ [n]"r"(n), -++ [val]"r"(val), -++ [inv]"r"(c->range), -++ [range]"r"(c->by22.range), -++ [ptr]"r"(c->bytestream) -++ : // Clobbers -++ ); -++} -++ -++ -++// Works but slower than C -++#define coeff_abs_level_remaining_decode_by22(c,r) coeff_abs_level_remaining_decode_by22_arm(c, r) -++static int coeff_abs_level_remaining_decode_by22_arm(CABACContext * const c, const unsigned int c_rice_param) -++{ -++ uint32_t n, val, tmp, level; -++ -++// PROFILE_START(); -++ -++ __asm__ ( -++ // Peek -++ "bic %[val], %[low], #1 \n\t" -++ "cmp %[inv], #0 \n\t" -++ "umullne %[tmp], %[val], %[inv], %[val] \n\t" -++ "lsl %[val], %[val], #1 \n\t" -++ -++ // Count bits (n = prefix) -++ "mvn %[n], %[val] \n\t" -++ "clz %[n], %[n] \n\t" -++ -++ "lsl %[level], %[val], %[n] \n\t" -++ "subs %[tmp], %[n], #3 \n\t" -++ "blo 2f \n\t" -++ -++ // prefix >= 3 -++ // < tmp = prefix - 3 -++ // > tmp = prefix + rice - 3 -++ "add %[tmp], %[tmp], %[rice] \n\t" -++ // > n = prefix * 2 + rice - 3 -++ "add %[n], %[tmp], %[n] \n\t" -++ "cmp %[n], #21 \n\t" -++ "bhi 3f \n\t" -++ -++ "orr %[level], %[level], #0x80000000 \n\t" -++ "rsb %[tmp], %[tmp], #31 \n\t" -++ "lsr %[level], %[level], %[tmp] \n\t" -++ -++ "mov %[tmp], #2 \n\t" -++ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" -++ "b 1f \n\t" -++ -++ // > 22 bits used in total - need reload -++ "3: \n\t" -++ -++ // Stash prefix + rice - 3 in level (only spare reg) -++ "mov %[level], %[tmp] \n\t" -++ // Restore n to flush value (prefix) -++ "sub %[n], %[n], %[tmp] \n\t" -++ -++ // Flush + reload -++ -++// "rsb %[tmp], %[n], #32 \n\t" -++// "lsr %[tmp], %[val], %[tmp] \n\t" -++// "mul %[tmp], %[range], %[tmp] \n\t" -++ -++ // As it happens we know that all the bits we are flushing are 1 -++ // so we can cheat slightly -++ "rsb %[tmp], %[range], %[range], lsl %[n] \n\t" -++ "lsl %[tmp], %[tmp], #23 \n\t" -++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -++ -++ "add %[bits], %[bits], %[n] \n\t" -++ "ldr %[n], [%[ptr], %[bits], lsr #3] \n\t" -++ "rev %[n], %[n] \n\t" -++ "and %[tmp], %[bits], #7 \n\t" -++ "lsl %[n], %[n], %[tmp] \n\t" -++ -++ "orr %[low], %[low], %[n], lsr #9 \n\t" -++ -++ // (reload) -++ -++ "bic %[val], %[low], #1 \n\t" -++ "cmp %[inv], #0 \n\t" -++ "umullne %[tmp], %[val], %[inv], %[val] \n\t" -++ "lsl %[val], %[val], #1 \n\t" -++ -++ // Build value -++ -++ "mov %[n], %[level] \n\t" -++ -++ "orr %[tmp], %[val], #0x80000000 \n\t" -++ "rsb %[level], %[level], #31 \n\t" -++ "lsr %[level], %[tmp], %[level] \n\t" -++ -++ "mov %[tmp], #2 \n\t" -++ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" -++ "b 1f \n\t" -++ -++ // prefix < 3 -++ "2: \n\t" -++ "rsb %[tmp], %[rice], #31 \n\t" -++ "lsr %[level], %[level], %[tmp] \n\t" -++ "orr %[level], %[level], %[n], lsl %[rice] \n\t" -++ "add %[n], %[n], %[rice] \n\t" -++ -++ "1: \n\t" -++ // Flush -++ "add %[n], %[n], #1 \n\t" -++ -++ "rsb %[tmp], %[n], #32 \n\t" -++ "lsr %[tmp], %[val], %[tmp] \n\t" -++ -++ "add %[bits], %[bits], %[n] \n\t" -++ "ldr %[val], [%[ptr], %[bits], lsr #3] \n\t" -++ -++ "mul %[tmp], %[range], %[tmp] \n\t" -++ "lsl %[tmp], %[tmp], #23 \n\t" -++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -++ -++ "rev %[val], %[val] \n\t" -++ "and %[tmp], %[bits], #7 \n\t" -++ "lsl %[val], %[val], %[tmp] \n\t" -++ -++ "orr %[low], %[low], %[val], lsr #9 \n\t" -++ : // Outputs -++ [level]"=&r"(level), -++ [n]"=&r"(n), -++ [val]"=&r"(val), -++ [tmp]"=&r"(tmp), -++ [bits]"+&r"(c->by22.bits), -++ [low]"+&r"(c->low) -++ : // Inputs -++ [rice]"r"(c_rice_param), -++ [inv]"r"(c->range), -++ [range]"r"(c->by22.range), -++ [ptr]"r"(c->bytestream) -++ : // Clobbers -++ "cc" -++ ); -++ -++// PROFILE_ACC(residual_abs); -++ -++ return level; -++} -++#endif -++ -++#endif /* HAVE_ARMV6T2_INLINE */ -++ -++#endif /* AVCODEC_ARM_HEVC_CABAC_H */ -+diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S -+index bad4589..a088cc3 100644 -+--- a/libavcodec/arm/hevcdsp_deblock_neon.S -++++ b/libavcodec/arm/hevcdsp_deblock_neon.S -+@@ -409,10 +409,12 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ beq 90f -+ -+ tst a3, #1 -++ itee ne -+ ldrne a3, [v5, #0] @ curr->mv[0] -+ ldreq a3, [v5, #4] @ curr->mv[1] -+ moveq v1, v2 -+ tst v8, #1 -++ itee ne -+ ldrne v8, [v6, #0] @ neigh->mv[0] -+ ldreq v8, [v6, #4] @ neigh->mv[1] -+ moveq v3, v4 -+@@ -424,9 +426,14 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ @ drop through -+-10: movne a3, #1 -++10: it ne -++ movne a3, #1 -+ 11: subs a2, a2, #1 -+-12: strbhs a3, [v7], a4 -++12: -++A strbhs a3, [v7], a4 -++T itt hs -++T strbhs a3, [v7] -++T addhs v7, v7, a4 -+ subs a2, a2, #1 -+ bhs 12b -+ -+@@ -442,6 +449,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ bne 10b -+ -+ teq v1, v3 -++ it eq -+ teqeq v2, v4 -+ bne 40f -+ teq v1, v2 -+@@ -487,6 +495,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ b 10b -+ -+ 40: teq v1, v4 -++ ite eq -+ teqeq v2, v3 -+ bne 10b -+ -+diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -+index 516ae5b..00eab9e 100644 -+--- a/libavcodec/arm/hevcdsp_epel_neon.S -++++ b/libavcodec/arm/hevcdsp_epel_neon.S -+@@ -110,7 +110,9 @@ function ff_hevc_put_epel_h_neon_8, export=1 -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+- adrl r12, epel_coeffs -++@ adr reaches if we are in thumb mode but not in arm -++T adr r12, epel_coeffs -++A adrl r12, epel_coeffs -+ add r7, r12 -+ sub r1, #1 -+ lsl r4, #1 -+@@ -170,7 +172,8 @@ function ff_hevc_put_epel_v_neon_8, export=1 -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+- adrl r12, epel_coeffs -++T adr r12, epel_coeffs -++A adrl r12, epel_coeffs -+ add r7, r12 -+ load_coeffs_16b r7 -+ sub r1, r2 -+@@ -246,7 +249,7 @@ function ff_hevc_put_epel_hv_neon_8, export=1 -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+- adrl r12, epel_coeffs -++ adr r12, epel_coeffs -+ sub r6, #1 -+ lsl r6, #2 -+ add r6, r12 // mx epel coeff offset -+diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h -+index 1bf1c62..ccfa991 100644 -+--- a/libavcodec/cabac.h -++++ b/libavcodec/cabac.h -+@@ -43,7 +43,14 @@ extern const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63]; -+ typedef struct CABACContext{ -+ int low; -+ int range; -+- int outstanding_count; -++ union -++ { -++ int outstanding_count; -++ struct { -++ uint16_t bits; -++ uint16_t range; -++ } by22; -++ }; -+ const uint8_t *bytestream_start; -+ const uint8_t *bytestream; -+ const uint8_t *bytestream_end; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 8656917..4caf720 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -21,14 +21,72 @@ -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -++#define UNCHECKED_BITSTREAM_READER 1 -++ -+ #include "libavutil/attributes.h" -+ #include "libavutil/common.h" -+ -+-#include "cabac_functions.h" -+ #include "hevc.h" -++#include "cabac_functions.h" -++ -++// BY22 is probably faster than simple bypass if the processor has -++// either a fast 32-bit divide or a fast 32x32->64[63:32] instruction -++// x86 has fast int divide -++// Arm doesn't have divide or general fast 64 bit, but does have the multiply -++// * Beware: ARCH_xxx isn't set if configure --disable-asm is used -++#define USE_BY22 (HAVE_FAST_64BIT || ARCH_ARM || ARCH_X86) -++// Use native divide if we have a fast one - otherwise use mpy 1/x -++// x86 has a fast integer divide - arm doesn't - unsure about other -++// architectures -++#define USE_BY22_DIV ARCH_X86 -++ -++// Special case blocks with a single significant ceoff -++// Decreases the complexity of the code for a common case but increases the -++// code size. -++#define USE_N_END_1 1 -++ -++#if ARCH_ARM -++#include "arm/hevc_cabac.h" -++#endif -+ -+ #define CABAC_MAX_BIN 31 -+ -++ -++#if USE_BY22 && !USE_BY22_DIV -++#define I(x) (uint32_t)((0x10000000000ULL / (uint64_t)(x)) + 1ULL) -++ -++static const uint32_t cabac_by22_inv_range[256] = { -++ 0, I(257), I(258), I(259), -++ I(260), I(261), I(262), I(263), I(264), I(265), I(266), I(267), I(268), I(269), -++ I(270), I(271), I(272), I(273), I(274), I(275), I(276), I(277), I(278), I(279), -++ I(280), I(281), I(282), I(283), I(284), I(285), I(286), I(287), I(288), I(289), -++ I(290), I(291), I(292), I(293), I(294), I(295), I(296), I(297), I(298), I(299), -++ I(300), I(301), I(302), I(303), I(304), I(305), I(306), I(307), I(308), I(309), -++ I(310), I(311), I(312), I(313), I(314), I(315), I(316), I(317), I(318), I(319), -++ I(320), I(321), I(322), I(323), I(324), I(325), I(326), I(327), I(328), I(329), -++ I(330), I(331), I(332), I(333), I(334), I(335), I(336), I(337), I(338), I(339), -++ I(340), I(341), I(342), I(343), I(344), I(345), I(346), I(347), I(348), I(349), -++ I(350), I(351), I(352), I(353), I(354), I(355), I(356), I(357), I(358), I(359), -++ I(360), I(361), I(362), I(363), I(364), I(365), I(366), I(367), I(368), I(369), -++ I(370), I(371), I(372), I(373), I(374), I(375), I(376), I(377), I(378), I(379), -++ I(380), I(381), I(382), I(383), I(384), I(385), I(386), I(387), I(388), I(389), -++ I(390), I(391), I(392), I(393), I(394), I(395), I(396), I(397), I(398), I(399), -++ I(400), I(401), I(402), I(403), I(404), I(405), I(406), I(407), I(408), I(409), -++ I(410), I(411), I(412), I(413), I(414), I(415), I(416), I(417), I(418), I(419), -++ I(420), I(421), I(422), I(423), I(424), I(425), I(426), I(427), I(428), I(429), -++ I(430), I(431), I(432), I(433), I(434), I(435), I(436), I(437), I(438), I(439), -++ I(440), I(441), I(442), I(443), I(444), I(445), I(446), I(447), I(448), I(449), -++ I(450), I(451), I(452), I(453), I(454), I(455), I(456), I(457), I(458), I(459), -++ I(460), I(461), I(462), I(463), I(464), I(465), I(466), I(467), I(468), I(469), -++ I(470), I(471), I(472), I(473), I(474), I(475), I(476), I(477), I(478), I(479), -++ I(480), I(481), I(482), I(483), I(484), I(485), I(486), I(487), I(488), I(489), -++ I(490), I(491), I(492), I(493), I(494), I(495), I(496), I(497), I(498), I(499), -++ I(500), I(501), I(502), I(503), I(504), I(505), I(506), I(507), I(508), I(509), -++ I(510), I(511) -++}; -++#undef I -++#endif // USE_BY22 -++ -+ /** -+ * number of bin by SyntaxElement. -+ */ -+@@ -445,6 +503,211 @@ static const uint8_t diag_scan8x8_inv[8][8] = { -+ { 28, 36, 43, 49, 54, 58, 61, 63, }, -+ }; -+ -++ -++typedef struct -++{ -++ uint16_t coeff; -++ uint16_t scale; -++} xy_off_t; -++ -++#define XYT_C(x,y,t) ((x) + ((y) << (t))) -++#define SCALE_TRAFO(t) ((t) > 3 ? 3 : (t)) -++#define SCALE_SHR(t) ((t) - SCALE_TRAFO(t)) -++#define XYT_S(x,y,t) (((x) >> SCALE_SHR(t)) + (((y) >> SCALE_SHR(t)) << SCALE_TRAFO(t))) -++ -++#define XYT(x,y,t) {XYT_C(x,y,t), XYT_S(x,y,t)} -++ -++#define OFF_DIAG(t) {\ -++ XYT(0,0,t), XYT(0,1,t), XYT(1,0,t), XYT(0,2,t),\ -++ XYT(1,1,t), XYT(2,0,t), XYT(0,3,t), XYT(1,2,t),\ -++ XYT(2,1,t), XYT(3,0,t), XYT(1,3,t), XYT(2,2,t),\ -++ XYT(3,1,t), XYT(2,3,t), XYT(3,2,t), XYT(3,3,t)\ -++} -++ -++#define OFF_HORIZ(t) {\ -++ XYT(0,0,t), XYT(1,0,t), XYT(2,0,t), XYT(3,0,t),\ -++ XYT(0,1,t), XYT(1,1,t), XYT(2,1,t), XYT(3,1,t),\ -++ XYT(0,2,t), XYT(1,2,t), XYT(2,2,t), XYT(3,2,t),\ -++ XYT(0,3,t), XYT(1,3,t), XYT(2,3,t), XYT(3,3,t)\ -++} -++ -++#define OFF_VERT(t) {\ -++ XYT(0,0,t), XYT(0,1,t), XYT(0,2,t), XYT(0,3,t),\ -++ XYT(1,0,t), XYT(1,1,t), XYT(1,2,t), XYT(1,3,t),\ -++ XYT(2,0,t), XYT(2,1,t), XYT(2,2,t), XYT(2,3,t),\ -++ XYT(3,0,t), XYT(3,1,t), XYT(3,2,t), XYT(3,3,t)\ -++} -++ -++static const xy_off_t off_xys[3][4][16] = -++{ -++ {OFF_DIAG(2), OFF_DIAG(3), OFF_DIAG(4), OFF_DIAG(5)}, -++ {OFF_HORIZ(2), OFF_HORIZ(3), OFF_HORIZ(4), OFF_HORIZ(5)}, -++ {OFF_VERT(2), OFF_VERT(3), OFF_VERT(4), OFF_VERT(5)} -++}; -++ -++ -++// Helper fns -++#ifndef hevc_mem_bits32 -++static av_always_inline uint32_t hevc_mem_bits32(const void * buf, const unsigned int offset) -++{ -++ return AV_RB32((const uint8_t *)buf + (offset >> 3)) << (offset & 7); -++} -++#endif -++ -++#if AV_GCC_VERSION_AT_LEAST(3,4) && !defined(hevc_clz32) -++#define hevc_clz32 hevc_clz32_builtin -++static av_always_inline unsigned int hevc_clz32_builtin(const uint32_t x) -++{ -++ // __builtin_clz says it works on ints - so adjust if int is >32 bits long -++ return __builtin_clz(x) - (sizeof(int) * 8 - 32); -++} -++#endif -++ -++// It is unlikely that we will ever need this but include for completeness -++#ifndef hevc_clz32 -++static inline unsigned int hevc_clz32(unsigned int x) -++{ -++ unsigned int n = 1; -++ if ((x & 0xffff0000) == 0) { -++ n += 16; -++ x <<= 16; -++ } -++ if ((x & 0xff000000) == 0) { -++ n += 8; -++ x <<= 8; -++ } -++ if ((x & 0xf0000000) == 0) { -++ n += 4; -++ x <<= 4; -++ } -++ if ((x & 0xc0000000) == 0) { -++ n += 2; -++ x <<= 2; -++ } -++ return n - ((x >> 31) & 1); -++} -++#endif -++ -++ -++#if !USE_BY22 -++// If no by22 then _by22 functions will revert to normal and so _peek/_flush -++// will no longer be called but the setup calls will still exist and we want -++// to null them out -++#define bypass_start(s) -++#define bypass_finish(s) -++#else -++// Use BY22 for residual bypass block -++ -++#define bypass_start(s) get_cabac_by22_start(&s->HEVClc->cc) -++#define bypass_finish(s) get_cabac_by22_finish(&s->HEVClc->cc) -++ -++// BY22 notes that bypass is simply a divide into the bitstream and so we -++// can peek out large quantities of bits at one and treat the result as if -++// it was VLC. In many cases this will lead to O(1) processing rather than -++// O(n) though the setup and teardown is sufficiently expensive that it is -++// only worth using if we expect to be dealing with more than a few bits -++// The definition of "a few bits" will vary from platform to platform but -++// tests on ARM show that it probably isn't worth it for a single coded -++// residual, but is for >1 - this is probaly reinforced that if there are -++// more residuals then they are likely to be bigger and this will make the -++// O(1) nature of the code more worthwhile. -++ -++ -++#if !USE_BY22_DIV -++// * 1/x @ 32 bits gets us 22 bits of accuracy -++#define CABAC_BY22_PEEK_BITS 22 -++#else -++// A real 32-bit divide gets us another bit -++// If we have a 64 bit int & a unit time divider then we should get a lot -++// of bits (55) but that is untested and it is unclear if it would give -++// us a large advantage -++#define CABAC_BY22_PEEK_BITS 23 -++#endif -++ -++// Bypass block start -++// Must be called before _by22_peek is used as it sets the CABAC environment -++// into the correct state. _by22_finish must be called to return to 'normal' -++// (i.e. non-bypass) cabac decoding -++static inline void get_cabac_by22_start(CABACContext * const c) -++{ -++ const unsigned int bits = __builtin_ctz(c->low); -++ const uint32_t m = hevc_mem_bits32(c->bytestream, 0); -++ uint32_t x = (c->low << (22 - CABAC_BITS)) ^ ((m ^ 0x80000000U) >> (9 + CABAC_BITS - bits)); -++#if !USE_BY22_DIV -++ const uint32_t inv = cabac_by22_inv_range[c->range & 0xff]; -++#endif -++ -++ c->bytestream -= (CABAC_BITS / 8); -++ c->by22.bits = bits; -++#if !USE_BY22_DIV -++ c->by22.range = c->range; -++ c->range = inv; -++#endif -++ c->low = x; -++} -++ -++// Bypass block finish -++// Must be called at the end of the bypass block to return to normal operation -++static inline void get_cabac_by22_finish(CABACContext * const c) -++{ -++ unsigned int used = c->by22.bits; -++ unsigned int bytes_used = (used / CABAC_BITS) * (CABAC_BITS / 8); -++ unsigned int bits_used = used & (CABAC_BITS == 16 ? 15 : 7); -++ -++ c->bytestream += bytes_used + (CABAC_BITS / 8); -++ c->low = (((uint32_t)c->low >> (22 - CABAC_BITS + bits_used)) | 1) << bits_used; -++#if !USE_BY22_DIV -++ c->range = c->by22.range; -++#endif -++} -++ -++// Peek bypass bits -++// _by22_start must be called before _by22_peek is called and _by22_flush -++// must be called afterwards to flush any used bits -++// The actual number of valid bits returned is -++// min(, CABAC_BY22_PEEK_BITS). CABAC_BY22_PEEK_BITS -++// will be at least 22 which should be long enough for any prefix or suffix -++// though probably not long enough for the worst case combination -++#ifndef get_cabac_by22_peek -++static inline uint32_t get_cabac_by22_peek(const CABACContext * const c) -++{ -++#if USE_BY22_DIV -++ return ((unsigned int)c->low / (unsigned int)c->range) << 9; -++#else -++ uint32_t x = c->low & ~1U; -++ const uint32_t inv = c->range; -++ -++ if (inv != 0) -++ x = (uint32_t)(((uint64_t)x * (uint64_t)inv) >> 32); -++ -++ return x << 1; -++#endif -++} -++#endif -++ -++// Flush bypass bits peeked by _by22_peek -++// Flush n bypass bits. n must be >= 1 to guarantee correct operation -++// val is an unmodified copy of whatever _by22_peek returned -++#ifndef get_cabac_by22_flush -++static inline void get_cabac_by22_flush(CABACContext * c, const unsigned int n, const uint32_t val) -++{ -++ // Subtract the bits used & reshift up to the top of the word -++#if USE_BY22_DIV -++ const uint32_t low = (((unsigned int)c->low << n) - (((val >> (32 - n)) * (unsigned int)c->range) << 23)); -++#else -++ const uint32_t low = (((uint32_t)c->low << n) - (((val >> (32 - n)) * c->by22.range) << 23)); -++#endif -++ -++ // and refill lower bits -++ // We will probably OR over some existing bits but that doesn't matter -++ c->by22.bits += n; -++ c->low = low | (hevc_mem_bits32(c->bytestream, c->by22.bits) >> 9); -++} -++#endif -++ -++#endif // USE_BY22 -++ -++ -+ void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) -+ { -+ if (s->ps.pps->entropy_coding_sync_enabled_flag && -+@@ -863,19 +1126,19 @@ int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth) -+ return GET_CABAC(elem_offset[CBF_LUMA] + !trafo_depth); -+ } -+ -+-static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx) -++static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx_nz) -+ { -+- return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + !!c_idx); -++ return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + c_idx_nz); -+ } -+ -+-static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx) -++static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx_nz) -+ { -+- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + !!c_idx); -++ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + c_idx_nz); -+ } -+ -+-static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx) -++static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx_nz) -+ { -+- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + !!c_idx); -++ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + c_idx_nz); -+ } -+ -+ int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx) { -+@@ -891,14 +1154,14 @@ int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx) { -+ return GET_CABAC(elem_offset[RES_SCALE_SIGN_FLAG] + idx); -+ } -+ -+-static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx, -++static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx_nz, -+ int log2_size, int *last_scx_prefix, int *last_scy_prefix) -+ { -+ int i = 0; -+ int max = (log2_size << 1) - 1; -+ int ctx_offset, ctx_shift; -+ -+- if (!c_idx) { -++ if (!c_idx_nz) { -+ ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2); -+ ctx_shift = (log2_size + 1) >> 2; -+ } else { -+@@ -929,22 +1192,16 @@ static av_always_inline int last_significant_coeff_suffix_decode(HEVCContext *s, -+ return value; -+ } -+ -+-static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx, int ctx_cg) -++static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx_nz, int ctx_cg) -+ { -+ int inc; -+ -+- inc = FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0); -++ inc = (ctx_cg != 0) + (c_idx_nz << 1); -+ -+ return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_GROUP_FLAG] + inc); -+ } -+-static av_always_inline int significant_coeff_flag_decode(HEVCContext *s, int x_c, int y_c, -+- int offset, const uint8_t *ctx_idx_map) -+-{ -+- int inc = ctx_idx_map[(y_c << 2) + x_c] + offset; -+- return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + inc); -+-} -+ -+-static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int c_idx, int offset) -++static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int offset) -+ { -+ return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + offset); -+ } -+@@ -966,65 +1223,305 @@ static av_always_inline int coeff_abs_level_greater2_flag_decode(HEVCContext *s, -+ return GET_CABAC(elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + inc); -+ } -+ -+-static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int rc_rice_param) -++ -++#if !USE_BY22 -++#define coeff_abs_level_remaining_decode_bypass(s,r) coeff_abs_level_remaining_decode(s, r) -++#endif -++ -++ -++#ifndef coeff_abs_level_remaining_decode_bypass -++static int coeff_abs_level_remaining_decode_bypass(HEVCContext * const s, const unsigned int rice_param) -++{ -++ CABACContext * const c = &s->HEVClc->cc; -++ uint32_t y; -++ unsigned int prefix; -++ unsigned int last_coeff_abs_level_remaining; -++ unsigned int n; -++ -++ y = get_cabac_by22_peek(c); -++ prefix = hevc_clz32(~y); -++ // y << prefix will always have top bit 0 -++ -++ if (prefix < 3) { -++ const unsigned int suffix = (y << prefix) >> (31 - rice_param); -++ last_coeff_abs_level_remaining = (prefix << rice_param) + suffix; -++ n = prefix + 1 + rice_param; -++ } -++ else if (prefix * 2 + rice_param <= CABAC_BY22_PEEK_BITS + 2) -++ { -++ const uint32_t suffix = ((y << prefix) | 0x80000000) >> (34 - (prefix + rice_param)); -++ -++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; -++ n = prefix * 2 + rice_param - 2; -++ } -++ else { -++ unsigned int suffix; -++ -++ get_cabac_by22_flush(c, prefix, y); -++ y = get_cabac_by22_peek(c); -++ -++ suffix = (y | 0x80000000) >> (34 - (prefix + rice_param)); -++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; -++ n = prefix + rice_param - 2; -++ } -++ -++ get_cabac_by22_flush(c, n, y); -++ -++ return last_coeff_abs_level_remaining; -++} -++#endif -++ -++static int coeff_abs_level_remaining_decode(HEVCContext * const s, int rc_rice_param) -+ { -++ CABACContext * const c = &s->HEVClc->cc; -+ int prefix = 0; -+ int suffix = 0; -+ int last_coeff_abs_level_remaining; -+ int i; -+ -+- while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) -++ while (prefix < CABAC_MAX_BIN && get_cabac_bypass(c)) -+ prefix++; -+ if (prefix == CABAC_MAX_BIN) { -+ av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix); -+ return 0; -+ } -++ -+ if (prefix < 3) { -+ for (i = 0; i < rc_rice_param; i++) -+- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); -++ suffix = (suffix << 1) | get_cabac_bypass(c); -+ last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix; -+ } else { -+ int prefix_minus3 = prefix - 3; -+ for (i = 0; i < prefix_minus3 + rc_rice_param; i++) -+- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); -++ suffix = (suffix << 1) | get_cabac_bypass(c); -+ last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1) -+ << rc_rice_param) + suffix; -+ } -++ -+ return last_coeff_abs_level_remaining; -+ } -+ -+-static av_always_inline int coeff_sign_flag_decode(HEVCContext *s, uint8_t nb) -++#if !USE_BY22 -++#define coeff_sign_flag_decode_bypass coeff_sign_flag_decode -++static inline uint32_t coeff_sign_flag_decode(HEVCContext * const s, const unsigned int nb) -+ { -+- int i; -+- int ret = 0; -++ CABACContext * const c = &s->HEVClc->cc; -++ unsigned int i; -++ uint32_t ret = 0; -+ -+ for (i = 0; i < nb; i++) -+- ret = (ret << 1) | get_cabac_bypass(&s->HEVClc->cc); -+- return ret; -++ ret = (ret << 1) | get_cabac_bypass(c); -++ -++ return ret << (32 - nb); -+ } -++#endif -++ -++#ifndef coeff_sign_flag_decode_bypass -++static inline uint32_t coeff_sign_flag_decode_bypass(HEVCContext * const s, const unsigned int nb) -++{ -++ CABACContext * const c = &s->HEVClc->cc; -++ uint32_t y; -++ y = get_cabac_by22_peek(c); -++ get_cabac_by22_flush(c, nb, y); -++ return y & ~(0xffffffffU >> nb); -++} -++#endif -++ -++ -++#ifndef get_cabac_greater1_bits -++static inline unsigned int get_cabac_greater1_bits(CABACContext * const c, const unsigned int n, -++ uint8_t * const state0) -++{ -++ unsigned int i; -++ unsigned int rv = 0; -++ for (i = 0; i != n; ++i) { -++ const unsigned int idx = rv != 0 ? 0 : i < 3 ? i + 1 : 3; -++ const unsigned int b = get_cabac(c, state0 + idx); -++ rv = (rv << 1) | b; -++ } -++ return rv; -++} -++#endif -++ -++ -++// N.B. levels returned are the values assuming coeff_abs_level_remaining -++// is uncoded, so 1 must be added if it is coded. sum_abs also reflects -++// this version of events. -++static inline uint32_t get_greaterx_bits(HEVCContext * const s, const unsigned int n_end, int * const levels, -++ int * const pprev_subset_coded, int * const psum, -++ const unsigned int idx0_gt1, const unsigned int idx_gt2) -++{ -++ CABACContext * const c = &s->HEVClc->cc; -++ uint8_t * const state0 = s->HEVClc->cabac_state + idx0_gt1; -++ uint8_t * const state_gt2 = s->HEVClc->cabac_state + idx_gt2; -++ unsigned int rv; -++ unsigned int i; -++ const unsigned int n = FFMIN(n_end, 8); -++ -++ // Really this is i != n but the simple unconditional loop is cheaper -++ // and faster -++ for (i = 0; i != 8; ++i) -++ levels[i] = 1; -++ -++ rv = get_cabac_greater1_bits(c, n, state0); -++ -++ *pprev_subset_coded = 0; -++ *psum = n; -++ -++ rv <<= (32 - n); -++ if (rv != 0) -++ { -++ *pprev_subset_coded = 1; -++ *psum = n + 1; -++ i = hevc_clz32(rv); -++ levels[i] = 2; -++ if (get_cabac(c, state_gt2) == 0) -++ { -++ // Unset first coded bit -++ rv &= ~(0x80000000U >> i); -++ } -++ } -++ -++ if (n_end > 8) { -++ const unsigned int g8 = n_end - 8; -++ rv |= ((1 << g8) - 1) << (24 - g8); -++ for (i = 0; i != g8; ++i) { -++ levels[i + 8] = 0; -++ } -++ } -++ -++ return rv; -++} -++ -++// extended_precision_processing_flag must be false given we are -++// putting the result into a 16-bit array -++// So trans_coeff_level must fit in 16 bits too (7.4.9.1 definition of coeff_abs_level_remaining) -++// scale_m is uint8_t -++// -++// scale is [40 - 72] << [0..12] based on qp- worst case is (45 << 12) -++// or it can be 2 (if we have transquant_bypass) -++// shift is set to one less than we really want but would normally be -++// s->ps.sps->bit_depth (max 16, min 8) + log2_trafo_size (max 5, min 2?) - 5 = max 16 min 5? -++// however the scale shift is substracted from shift to a min 0 so scale_m worst = 45 << 6 -++// This can still theoretically lead to overflow but the coding would have to be very odd (& inefficient) -++// to achieve it -++ -++#ifndef trans_scale_sat -++static inline int trans_scale_sat(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) -++{ -++ return av_clip_int16((((level * (int)(scale * scale_m)) >> shift) + 1) >> 1); -++} -++#endif -++ -++ -++#ifndef update_rice -++static inline void update_rice(uint8_t * const stat_coeff, -++ const unsigned int last_coeff_abs_level_remaining, -++ const unsigned int c_rice_param) -++{ -++ const unsigned int x = (last_coeff_abs_level_remaining << 1) >> c_rice_param; -++ if (x >= 6) -++ (*stat_coeff)++; -++ else if (x == 0 && *stat_coeff > 0) -++ (*stat_coeff)--; -++} -++#endif -++ -++ -++// n must be > 0 on entry -++#ifndef get_cabac_sig_coeff_flag_idxs -++static inline uint8_t * get_cabac_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, -++ unsigned int n, -++ const uint8_t const * ctx_map, -++ uint8_t * p) -++{ -++ do { -++ if (get_cabac(c, state0 + ctx_map[n])) -++ *p++ = n; -++ } while (--n != 0); -++ return p; -++} -++#endif -++ -++ -++static int get_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, -++ unsigned int n, -++ const uint8_t const * ctx_map, -++ uint8_t * const flag_idx) -++{ -++ int rv; -++ -++ rv = get_cabac_sig_coeff_flag_idxs(c, state0, n, ctx_map, flag_idx) - flag_idx; -++ -++ return rv; -++} -++ -++#define H4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -++ x0, x1, x2, x3,\ -++ x4, x5, x6, x7,\ -++ x8, x9, x10, x11,\ -++ x12, x13, x14, x15} -++ -++#define V4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -++ x0, x4, x8, x12,\ -++ x1, x5, x9, x13,\ -++ x2, x6, x10, x14,\ -++ x3, x7, x11, x15} -++ -++#define D4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -++ x0, x4, x1, x8,\ -++ x5, x2, x12, x9,\ -++ x6, x3, x13, x10,\ -++ x7, x14, x11, x15} -++ -++ -++static inline int next_subset(HEVCContext * const s, int i, const int c_idx_nz, -++ uint8_t * const significant_coeff_group_flag, -++ const uint8_t * const scan_x_cg, const uint8_t * const scan_y_cg, -++ int * const pPrev_sig) -++{ -++ while (--i >= 0) { -++ unsigned int x_cg = scan_x_cg[i]; -++ unsigned int y_cg = scan_y_cg[i]; -++ -++ // For the flag decode we only care about Z/NZ but -++ // we use the full Right + Down * 2 when calculating -++ // significant coeff flags so we obtain it here -++ //. -++ // The group flag array is one longer than it needs to -++ // be so we don't need to check for y_cg limits -++ unsigned int prev_sig = ((significant_coeff_group_flag[y_cg] >> (x_cg + 1)) & 1) | -++ (((significant_coeff_group_flag[y_cg + 1] >> x_cg) & 1) << 1); -++ -++ if (i == 0 || -++ significant_coeff_group_flag_decode(s, c_idx_nz, prev_sig)) -++ { -++ significant_coeff_group_flag[y_cg] |= (1 << x_cg); -++ *pPrev_sig = prev_sig; -++ break; -++ } -++ } -++ -++ return i; -++} -++ -+ -+ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int log2_trafo_size, enum ScanType scan_idx, -+ int c_idx) -+ { -+-#define GET_COORD(offset, n) \ -+- do { \ -+- x_c = (x_cg << 2) + scan_x_off[n]; \ -+- y_c = (y_cg << 2) + scan_y_off[n]; \ -+- } while (0) -+- HEVCLocalContext *lc = s->HEVClc; -+- int transform_skip_flag = 0; -++ HEVCLocalContext * const lc = s->HEVClc; -++ int trans_skip_or_bypass = lc->cu.cu_transquant_bypass_flag; -+ -+ int last_significant_coeff_x, last_significant_coeff_y; -+- int last_scan_pos; -+- int n_end; -+ int num_coeff = 0; -+- int greater1_ctx = 1; -++ int prev_subset_coded = 0; -+ -+ int num_last_subset; -+ int x_cg_last_sig, y_cg_last_sig; -+ -+- const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off; -++ const uint8_t *scan_x_cg, *scan_y_cg; -++ const xy_off_t * scan_xy_off; -+ -+ ptrdiff_t stride = s->frame->linesize[c_idx]; -+ int hshift = s->ps.sps->hshift[c_idx]; -+@@ -1032,21 +1529,28 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + -+ ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -+ #ifdef RPI -+- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; -++ //***** transform_skip_flag decoded later! -++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag /* && !transform_skip_flag*/ && !lc->tu.cross_pf && log2_trafo_size>=4; -+ #endif -+ int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -+- uint8_t significant_coeff_group_flag[8][8] = {{0}}; -++ uint8_t significant_coeff_group_flag[9] = {0}; // Allow 1 final byte that is always zero -+ int explicit_rdpcm_flag = 0; -+ int explicit_rdpcm_dir_flag; -+ -+ int trafo_size = 1 << log2_trafo_size; -+ int i; -+- int qp,shift,add,scale,scale_m; -++ int qp,shift,scale; -+ static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; -+ const uint8_t *scale_matrix = NULL; -+ uint8_t dc_scale; -+ int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : -+ lc->tu.intra_pred_mode_c; -++ -++ int prev_sig = 0; -++ const int c_idx_nz = (c_idx != 0); -++ -++ int may_hide_sign; -++ -+ #ifdef RPI -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+@@ -1078,7 +1582,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ -+ // Derive QP for dequant -+ if (!lc->cu.cu_transquant_bypass_flag) { -+- static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; -++ static const uint8_t qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; -+ static const uint8_t rem6[51 + 4 * 6 + 1] = { -+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, -+ 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, -+@@ -1094,9 +1598,19 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ }; -+ int qp_y = lc->qp_y; -+ -++ may_hide_sign = s->ps.pps->sign_data_hiding_flag; -++ -+ if (s->ps.pps->transform_skip_enabled_flag && -+ log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) { -+- transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx); -++ int transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx_nz); -++ if (transform_skip_flag) { -++ trans_skip_or_bypass = 1; -++ if (lc->cu.pred_mode == MODE_INTRA && -++ s->ps.sps->implicit_rdpcm_enabled_flag && -++ (pred_mode_intra == 10 || pred_mode_intra == 26)) { -++ may_hide_sign = 0; -++ } -++ } -+ } -+ -+ if (c_idx == 0) { -+@@ -1129,39 +1643,73 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ qp += s->ps.sps->qp_bd_offset; -+ } -+ -+- shift = s->ps.sps->bit_depth + log2_trafo_size - 5; -+- add = 1 << (shift-1); -+- scale = level_scale[rem6[qp]] << (div6[qp]); -+- scale_m = 16; // default when no custom scaling lists. -+- dc_scale = 16; -++ // Shift is set to one less than will actually occur as the scale -++ // and saturate step adds 1 and then shifts right again -++ shift = s->ps.sps->bit_depth + log2_trafo_size - 6; -++ scale = level_scale[rem6[qp]]; -++ if (div6[qp] >= shift) { -++ scale <<= (div6[qp] - shift); -++ shift = 0; -++ } else { -++ shift -= div6[qp]; -++ } -+ -+- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { -++ if (s->ps.sps->scaling_list_enable_flag && !(trans_skip_or_bypass && log2_trafo_size > 2)) { -+ const ScalingList *sl = s->ps.pps->scaling_list_data_present_flag ? -+- &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; -++ &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; -+ int matrix_id = lc->cu.pred_mode != MODE_INTRA; -+ -+ matrix_id = 3 * matrix_id + c_idx; -+ -+ scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; -++ dc_scale = scale_matrix[0]; -+ if (log2_trafo_size >= 4) -+ dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; -+ } -++ else -++ { -++ static const uint8_t sixteen_scale[64] = { -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16 -++ }; -++ scale_matrix = sixteen_scale; -++ dc_scale = 16; -++ } -+ } else { -++ static const uint8_t unit_scale[64] = { -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ }; -++ scale_matrix = unit_scale; -+ shift = 0; -+- add = 0; -+- scale = 0; -+- dc_scale = 0; -++ scale = 2; // We will shift right to kill this -++ dc_scale = 1; -++ -++ may_hide_sign = 0; -+ } -+ -+ if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag && -+- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -+- explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx); -++ trans_skip_or_bypass) { -++ explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx_nz); -+ if (explicit_rdpcm_flag) { -+- explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx); -++ may_hide_sign = 0; -++ explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx_nz); -+ } -+ } -+ -+- last_significant_coeff_xy_prefix_decode(s, c_idx, log2_trafo_size, -++ last_significant_coeff_xy_prefix_decode(s, c_idx_nz, log2_trafo_size, -+ &last_significant_coeff_x, &last_significant_coeff_y); -+ -+ if (last_significant_coeff_x > 3) { -+@@ -1189,119 +1737,113 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int last_x_c = last_significant_coeff_x & 3; -+ int last_y_c = last_significant_coeff_y & 3; -+ -+- scan_x_off = ff_hevc_diag_scan4x4_x; -+- scan_y_off = ff_hevc_diag_scan4x4_y; -+ num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; -+- if (trafo_size == 4) { -++ -++ switch (log2_trafo_size) { -++ case 2: -+ scan_x_cg = scan_1x1; -+ scan_y_cg = scan_1x1; -+- } else if (trafo_size == 8) { -++ break; -++ case 3: -+ num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; -+ scan_x_cg = diag_scan2x2_x; -+ scan_y_cg = diag_scan2x2_y; -+- } else if (trafo_size == 16) { -++ break; -++ case 4: -+ num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; -+ scan_x_cg = ff_hevc_diag_scan4x4_x; -+ scan_y_cg = ff_hevc_diag_scan4x4_y; -+- } else { // trafo_size == 32 -++ break; -++ case 5: -++ default: -+ num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; -+ scan_x_cg = ff_hevc_diag_scan8x8_x; -+ scan_y_cg = ff_hevc_diag_scan8x8_y; -++ break; -+ } -+ break; -+ } -+ case SCAN_HORIZ: -+ scan_x_cg = horiz_scan2x2_x; -+ scan_y_cg = horiz_scan2x2_y; -+- scan_x_off = horiz_scan4x4_x; -+- scan_y_off = horiz_scan4x4_y; -+ num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; -+ break; -+ default: //SCAN_VERT -+ scan_x_cg = horiz_scan2x2_y; -+ scan_y_cg = horiz_scan2x2_x; -+- scan_x_off = horiz_scan4x4_y; -+- scan_y_off = horiz_scan4x4_x; -+ num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; -+ break; -+ } -+ num_coeff++; -+ num_last_subset = (num_coeff - 1) >> 4; -+ -+- for (i = num_last_subset; i >= 0; i--) { -+- int n, m; -+- int x_cg, y_cg, x_c, y_c, pos; -+- int implicit_non_zero_coeff = 0; -+- int64_t trans_coeff_level; -+- int prev_sig = 0; -+- int offset = i << 4; -+- int rice_init = 0; -+- -+- uint8_t significant_coeff_flag_idx[16]; -+- uint8_t nb_significant_coeff_flag = 0; -++ significant_coeff_group_flag[y_cg_last_sig] = 1 << x_cg_last_sig; // 1st subset always significant -+ -+- x_cg = scan_x_cg[i]; -+- y_cg = scan_y_cg[i]; -++ scan_xy_off = off_xys[scan_idx][log2_trafo_size - 2]; -+ -+- if ((i < num_last_subset) && (i > 0)) { -+- int ctx_cg = 0; -+- if (x_cg < (1 << (log2_trafo_size - 2)) - 1) -+- ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg]; -+- if (y_cg < (1 << (log2_trafo_size - 2)) - 1) -+- ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1]; -+- -+- significant_coeff_group_flag[x_cg][y_cg] = -+- significant_coeff_group_flag_decode(s, c_idx, ctx_cg); -+- implicit_non_zero_coeff = 1; -+- } else { -+- significant_coeff_group_flag[x_cg][y_cg] = -+- ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) || -+- (x_cg == 0 && y_cg == 0)); -+- } -++ i = num_last_subset; -++ do { -++ int implicit_non_zero_coeff = 0; -++ int n_end; -+ -+- last_scan_pos = num_coeff - offset - 1; -++ uint8_t significant_coeff_flag_idx[16]; -++ unsigned int nb_significant_coeff_flag = 0; -+ -+ if (i == num_last_subset) { -++ // First time through -++ int last_scan_pos = num_coeff - (i << 4) - 1; -+ n_end = last_scan_pos - 1; -+ significant_coeff_flag_idx[0] = last_scan_pos; -+ nb_significant_coeff_flag = 1; -+ } else { -+ n_end = 15; -++ implicit_non_zero_coeff = (i != 0); -+ } -+ -+- if (x_cg < ((1 << log2_trafo_size) - 1) >> 2) -+- prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg]; -+- if (y_cg < ((1 << log2_trafo_size) - 1) >> 2) -+- prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1); -+- -+- if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) { -+- static const uint8_t ctx_idx_map[] = { -+- 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, // log2_trafo_size == 2 -+- 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 0 -+- 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 1 -+- 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, // prev_sig == 2 -+- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 // default -++ if (n_end >= 0) { -++ static const uint8_t ctx_idx_maps_ts2[3][16] = { -++ D4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 -++ H4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 -++ V4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8) // log2_trafo_size == 2 -++ }; -++ static const uint8_t ctx_idx_maps[3][4][16] = { -++ { -++ D4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -++ D4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -++ D4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -++ D4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -++ }, -++ { -++ H4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -++ H4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -++ H4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -++ H4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -++ }, -++ { -++ V4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -++ V4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -++ V4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -++ V4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -++ } -+ }; -+ const uint8_t *ctx_idx_map_p; -+ int scf_offset = 0; -+- if (s->ps.sps->transform_skip_context_enabled_flag && -+- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -+- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16]; -+- if (c_idx == 0) { -+- scf_offset = 40; -+- } else { -+- scf_offset = 14 + 27; -+- } -++ -++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { -++ ctx_idx_map_p = ctx_idx_maps[0][3]; -++ scf_offset = 40 + c_idx_nz; -+ } else { -+- if (c_idx != 0) -++ if (c_idx_nz != 0) -+ scf_offset = 27; -++ -+ if (log2_trafo_size == 2) { -+- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[0]; -++ ctx_idx_map_p = ctx_idx_maps_ts2[scan_idx]; -+ } else { -+- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[(prev_sig + 1) << 4]; -+- if (c_idx == 0) { -+- if ((x_cg > 0 || y_cg > 0)) -++ ctx_idx_map_p = ctx_idx_maps[scan_idx][prev_sig]; -++ if (!c_idx_nz) { -++ if (i != 0) -+ scf_offset += 3; -++ -+ if (log2_trafo_size == 3) { -+ scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; -+ } else { -+@@ -1315,34 +1857,30 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ } -+ } -+- for (n = n_end; n > 0; n--) { -+- x_c = scan_x_off[n]; -+- y_c = scan_y_off[n]; -+- if (significant_coeff_flag_decode(s, x_c, y_c, scf_offset, ctx_idx_map_p)) { -+- significant_coeff_flag_idx[nb_significant_coeff_flag] = n; -+- nb_significant_coeff_flag++; -++ -++ if (n_end > 0) { -++ int cnt = get_sig_coeff_flag_idxs(&s->HEVClc->cc, -++ s->HEVClc->cabac_state + elem_offset[SIGNIFICANT_COEFF_FLAG] + scf_offset, -++ n_end, ctx_idx_map_p, -++ significant_coeff_flag_idx + nb_significant_coeff_flag); -++ -++ nb_significant_coeff_flag += cnt; -++ if (cnt != 0) { -+ implicit_non_zero_coeff = 0; -+ } -+ } -++ -+ if (implicit_non_zero_coeff == 0) { -+- if (s->ps.sps->transform_skip_context_enabled_flag && -+- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -+- if (c_idx == 0) { -+- scf_offset = 42; -+- } else { -+- scf_offset = 16 + 27; -+- } -++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { -++ scf_offset = 42 + c_idx_nz; -+ } else { -+ if (i == 0) { -+- if (c_idx == 0) -+- scf_offset = 0; -+- else -+- scf_offset = 27; -++ scf_offset = c_idx_nz ? 27 : 0; -+ } else { -+ scf_offset = 2 + scf_offset; -+ } -+ } -+- if (significant_coeff_flag_decode_0(s, c_idx, scf_offset) == 1) { -++ if (significant_coeff_flag_decode_0(s, scf_offset) == 1) { -+ significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; -+ nb_significant_coeff_flag++; -+ } -+@@ -1352,141 +1890,185 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ } -+ -+- n_end = nb_significant_coeff_flag; -+- -++ if (nb_significant_coeff_flag != 0) { -++ const unsigned int gt1_idx_delta = (c_idx_nz << 2) | -++ ((i != 0 && !c_idx_nz) ? 2 : 0) | -++ prev_subset_coded; -++ const unsigned int idx0_gt1 = elem_offset[COEFF_ABS_LEVEL_GREATER1_FLAG] + -++ (gt1_idx_delta << 2); -++ const unsigned int idx_gt2 = elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + -++ gt1_idx_delta; -++ -++ const unsigned int x_cg = scan_x_cg[i]; -++ const unsigned int y_cg = scan_y_cg[i]; -++ int16_t * const blk_coeffs = coeffs + -++ ((x_cg + (y_cg << log2_trafo_size)) << 2); -++ // This calculation is 'wrong' for log2_traffo_size == 2 -++ // but that doesn't mattor as in this case x_cg & y_cg -++ // are always 0 so result is correct (0) anyway -++ const uint8_t * const blk_scale = scale_matrix + -++ (((x_cg + (y_cg << 3)) << (5 - log2_trafo_size))); -++ -++ // * THe following code block doesn't deal with these flags: -++ // (nor did the one it replaces) -++ // -++ // cabac_bypass_alignment_enabled_flag -++ // This should be easy but I can't find a test case -++ // extended_precision_processing_flag -++ // This can extend the required precision past 16bits -++ // so is probably tricky - also no example found yet -++ -++#if USE_N_END_1 -++ if (nb_significant_coeff_flag == 1) { -++ // There is a small gain to be had from special casing the single -++ // transform coefficient case. The reduction in complexity -++ // makes up for the code duplicatioon. -++ -++ int trans_coeff_level = 1; -++ int coeff_sign_flag; -++ int coded_val = 0; -++ -++ // initialize first elem of coeff_bas_level_greater1_flag -++ prev_subset_coded = 0; -++ -++ if (get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx0_gt1 + 1)) { -++ trans_coeff_level = 2; -++ prev_subset_coded = 1; -++ coded_val = get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx_gt2); -++ } -+ -+- if (n_end) { -+- int first_nz_pos_in_cg; -+- int last_nz_pos_in_cg; -+- int c_rice_param = 0; -+- int first_greater1_coeff_idx = -1; -+- uint8_t coeff_abs_level_greater1_flag[8]; -+- uint16_t coeff_sign_flag; -+- int sum_abs = 0; -+- int sign_hidden; -+- int sb_type; -++ // Probably not worth the overhead of starting by22 for just one value -++ coeff_sign_flag = get_cabac_bypass(&s->HEVClc->cc); -+ -++ if (coded_val) -++ { -++ if (!s->ps.sps->persistent_rice_adaptation_enabled_flag) { -++ trans_coeff_level = 3 + coeff_abs_level_remaining_decode(s, 0); -++ } else { -++ uint8_t * const stat_coeff = -++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); -++ const unsigned int c_rice_param = *stat_coeff >> 2; -++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -+ -+- // initialize first elem of coeff_bas_level_greater1_flag -+- int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0; -++ trans_coeff_level = 3 + last_coeff_abs_level_remaining; -++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); -++ } -++ } -+ -+- if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { -+- if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag) -+- sb_type = 2 * (c_idx == 0 ? 1 : 0); -+- else -+- sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1; -+- c_rice_param = lc->stat_coeff[sb_type] / 4; -+- } -++ { -++ const xy_off_t * const xy_off = scan_xy_off + significant_coeff_flag_idx[0]; -++ const int k = (int32_t)(coeff_sign_flag << 31) >> 31; -++ const unsigned int scale_m = blk_scale[xy_off->scale]; -+ -+- if (!(i == num_last_subset) && greater1_ctx == 0) -+- ctx_set++; -+- greater1_ctx = 1; -+- last_nz_pos_in_cg = significant_coeff_flag_idx[0]; -+- -+- for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) { -+- int inc = (ctx_set << 2) + greater1_ctx; -+- coeff_abs_level_greater1_flag[m] = -+- coeff_abs_level_greater1_flag_decode(s, c_idx, inc); -+- if (coeff_abs_level_greater1_flag[m]) { -+- greater1_ctx = 0; -+- if (first_greater1_coeff_idx == -1) -+- first_greater1_coeff_idx = m; -+- } else if (greater1_ctx > 0 && greater1_ctx < 3) { -+- greater1_ctx++; -++ blk_coeffs[xy_off->coeff] = trans_scale_sat( -++ (trans_coeff_level ^ k) - k, // Apply sign -++ scale, -++ i == 0 && xy_off->coeff == 0 ? dc_scale : scale_m, -++ shift); -+ } -+ } -+- first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1]; -+- -+- if (lc->cu.cu_transquant_bypass_flag || -+- (lc->cu.pred_mode == MODE_INTRA && -+- s->ps.sps->implicit_rdpcm_enabled_flag && transform_skip_flag && -+- (pred_mode_intra == 10 || pred_mode_intra == 26 )) || -+- explicit_rdpcm_flag) -+- sign_hidden = 0; -+ else -+- sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4); -++#endif -++ { -++ int sign_hidden = may_hide_sign; -++ int levels[16]; // Should be able to get away with int16_t but that fails some tests -++ uint32_t coeff_sign_flags; -++ uint32_t coded_vals = 0; -++ // Sum(abs(level[])) -++ // In fact we only need the bottom bit and in some future -++ // version that may be all we calculate -++ unsigned int sum_abs; -++ -++ coded_vals = get_greaterx_bits(s, nb_significant_coeff_flag, levels, -++ &prev_subset_coded, &sum_abs, idx0_gt1, idx_gt2); -++ -++ if (significant_coeff_flag_idx[0] - significant_coeff_flag_idx[nb_significant_coeff_flag - 1] <= 3) -++ sign_hidden = 0; -++ -++ // -- Start bypass block -++ -++ bypass_start(s); -++ -++ coeff_sign_flags = coeff_sign_flag_decode_bypass(s, nb_significant_coeff_flag - sign_hidden); -++ -++ if (coded_vals != 0) -++ { -++ const int rice_adaptation_enabled = s->ps.sps->persistent_rice_adaptation_enabled_flag; -++ uint8_t * stat_coeff = !rice_adaptation_enabled ? NULL : -++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); -++ int c_rice_param = !rice_adaptation_enabled ? 0 : *stat_coeff >> 2; -++ int * level = levels - 1; -++ -++ do { -++ { -++ const unsigned int z = hevc_clz32(coded_vals) + 1; -++ level += z; -++ coded_vals <<= z; -++ } -+ -+- if (first_greater1_coeff_idx != -1) { -+- coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set); -+- } -+- if (!s->ps.pps->sign_data_hiding_flag || !sign_hidden ) { -+- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); -+- } else { -+- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); -+- } -++ { -++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode_bypass(s, c_rice_param); -++ const int trans_coeff_level = *level + last_coeff_abs_level_remaining + 1; -++ -++ sum_abs += last_coeff_abs_level_remaining + 1; -++ *level = trans_coeff_level; -+ -+- for (m = 0; m < n_end; m++) { -+- n = significant_coeff_flag_idx[m]; -+- GET_COORD(offset, n); -+- if (m < 8) { -+- trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m]; -+- if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) { -+- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -+- -+- trans_coeff_level += last_coeff_abs_level_remaining; -+- if (trans_coeff_level > (3 << c_rice_param)) -+- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); -+- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { -+- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; -+- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) -+- lc->stat_coeff[sb_type]++; -+- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) -+- if (lc->stat_coeff[sb_type] > 0) -+- lc->stat_coeff[sb_type]--; -+- rice_init = 1; -++ if (stat_coeff != NULL) -++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); -++ stat_coeff = NULL; -++ -++ if (trans_coeff_level > (3 << c_rice_param) && -++ (c_rice_param < 4 || rice_adaptation_enabled)) -++ ++c_rice_param; -+ } -+- } -+- } else { -+- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -+- -+- trans_coeff_level = 1 + last_coeff_abs_level_remaining; -+- if (trans_coeff_level > (3 << c_rice_param)) -+- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); -+- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { -+- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; -+- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) -+- lc->stat_coeff[sb_type]++; -+- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) -+- if (lc->stat_coeff[sb_type] > 0) -+- lc->stat_coeff[sb_type]--; -+- rice_init = 1; -+- } -++ } while (coded_vals != 0); -+ } -+- if (s->ps.pps->sign_data_hiding_flag && sign_hidden) { -+- sum_abs += trans_coeff_level; -+- if (n == first_nz_pos_in_cg && (sum_abs&1)) -+- trans_coeff_level = -trans_coeff_level; -++ -++ // sign_hidden = 0 or 1 so we can combine the tests -++ if ((sign_hidden & sum_abs) != 0) { -++ levels[nb_significant_coeff_flag - 1] = -levels[nb_significant_coeff_flag - 1]; -+ } -+- if (coeff_sign_flag >> 15) -+- trans_coeff_level = -trans_coeff_level; -+- coeff_sign_flag <<= 1; -+- if(!lc->cu.cu_transquant_bypass_flag) { -+- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { -+- if(y_c || x_c || log2_trafo_size < 4) { -+- switch(log2_trafo_size) { -+- case 3: pos = (y_c << 3) + x_c; break; -+- case 4: pos = ((y_c >> 1) << 3) + (x_c >> 1); break; -+- case 5: pos = ((y_c >> 2) << 3) + (x_c >> 2); break; -+- default: pos = (y_c << 2) + x_c; break; -+- } -+- scale_m = scale_matrix[pos]; -+- } else { -+- scale_m = dc_scale; -+- } -++ -++ bypass_finish(s); -++ -++ // -- Finish bypass block -++ -++ // Scale loop -++ { -++ int m = nb_significant_coeff_flag - 1; -++ -++ // Deal with DC component (if any) first -++ if (i == 0 && significant_coeff_flag_idx[m] == 0) -++ { -++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; -++ blk_coeffs[0] = trans_scale_sat( -++ (levels[m] ^ k) - k, scale, dc_scale, shift); -++ --m; -+ } -+- trans_coeff_level = (trans_coeff_level * (int64_t)scale * (int64_t)scale_m + add) >> shift; -+- if(trans_coeff_level < 0) { -+- if((~trans_coeff_level) & 0xFffffffffff8000) -+- trans_coeff_level = -32768; -+- } else { -+- if(trans_coeff_level & 0xffffffffffff8000) -+- trans_coeff_level = 32767; -++ -++#if !USE_N_END_1 -++ // If N_END_! set then m was at least 1 initially -++ if (m >= 0) -++#endif -++ { -++ do { -++ const xy_off_t * const xy_off = scan_xy_off + -++ significant_coeff_flag_idx[m]; -++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; -++ -++ blk_coeffs[xy_off->coeff] = trans_scale_sat( -++ (levels[m] ^ k) - k, -++ scale, -++ blk_scale[xy_off->scale], -++ shift); -++ } while (--m >= 0); -+ } -+ } -+- coeffs[y_c * trafo_size + x_c] = trans_coeff_level; -++ -+ } -+ } -+- } -++ } while ((i = next_subset(s, i, c_idx_nz, -++ significant_coeff_group_flag, scan_x_cg, scan_y_cg, &prev_sig)) >= 0); -+ -+ if (lc->cu.cu_transquant_bypass_flag) { -+ if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && -+@@ -1496,7 +2078,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); -+ } -+ } else { -+- if (transform_skip_flag) { -++ if (trans_skip_or_bypass) { // Must be trans_skip as we've already dealt with bypass -+ int rot = s->ps.sps->transform_skip_rotation_enabled_flag && -+ log2_trafo_size == 2 && -+ lc->cu.pred_mode == MODE_INTRA; -+-- -+2.7.4 -+ -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 48f8d56988718dd53294e8291a53e532f0ff338d..337dbaab927919858e44d79f647207ef0513eea1 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -3,7 +3,8 @@ include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ - hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \ -- pfcd_hevc_optimisations.patch -+ pfcd_hevc_optimisations.patch \ -+ 0001-Squashed-commit-of-the-following.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -71,6 +72,7 @@ ifeq ($(Configuration), Release) - ffmpg_config += --disable-debug - endif - -+ffmpg_config += --extra-cflags="-DRPI=1" - - CLEAN_FILES=$(ARCHIVE) $(PLATFORM) - -@@ -87,6 +89,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch -+ cd $(PLATFORM); patch -p1 < ../0001-Squashed-commit-of-the-following.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index d6856dbd4fb4957ace700cbc08332223c01938f6..a61357f14cb2139e8125ae04684bed1b29fefb12 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -136,6 +136,7 @@ patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - patch -p1 < ../pfcd_hevc_optimisations.patch -+patch -p1 < ../0001-Squashed-commit-of-the-following.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -@@ -170,6 +171,7 @@ CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - --enable-zlib \ - --disable-mipsdsp \ - --disable-mipsdspr2 \ -+ --extra-cflags="-DRPI=1" \ - ${FLAGS} - - make -j ${BUILDTHREADS} - -From 74ed08120dcf15fe8429da268d7dd63711e7fc48 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 16 Sep 2015 19:05:12 +0100 -Subject: [PATCH 28/62] [3d] Make MVC a valid 3D filename tag - ---- - xbmc/guilib/StereoscopicsManager.cpp | 9 +++++++++ - xbmc/settings/AdvancedSettings.cpp | 2 ++ - xbmc/settings/AdvancedSettings.h | 1 + - 3 files changed, 12 insertions(+) - -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index b34873cba6534086ae243326550385867a03256a..1443acaf0f25df458ae49766e13dd0323454f2eb 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -197,6 +197,15 @@ std::string CStereoscopicsManager::DetectStereoModeByString(const std::string &n - if (re.RegFind(searchString) > -1) - stereoMode = "top_bottom"; - -+ if (!re.RegComp(g_advancedSettings.m_stereoscopicregex_mvc.c_str())) -+ { -+ CLog::Log(LOGERROR, "%s: Invalid RegExp for matching 3d MVC content:'%s'", __FUNCTION__, g_advancedSettings.m_stereoscopicregex_mvc.c_str()); -+ return stereoMode; -+ } -+ -+ if (re.RegFind(searchString) > -1) -+ stereoMode = "left_right"; -+ - return stereoMode; - } - -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 3891a7ed34acb3489a860678d56a8ec049890f6e..974305ff329eb6999c908d5e05d723f93137ae33 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -402,6 +402,7 @@ void CAdvancedSettings::Initialize() - m_stereoscopicregex_3d = "[-. _]3d[-. _]"; - m_stereoscopicregex_sbs = "[-. _]h?sbs[-. _]"; - m_stereoscopicregex_tab = "[-. _]h?tab[-. _]"; -+ m_stereoscopicregex_mvc = "[-. _]h?mvc[-. _]"; - - m_useDisplayControlHWStereo = false; - -@@ -551,6 +552,7 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) - XMLUtils::GetString(pElement, "stereoscopicregex3d", m_stereoscopicregex_3d); - XMLUtils::GetString(pElement, "stereoscopicregexsbs", m_stereoscopicregex_sbs); - XMLUtils::GetString(pElement, "stereoscopicregextab", m_stereoscopicregex_tab); -+ XMLUtils::GetString(pElement, "stereoscopicregexmvc", m_stereoscopicregex_mvc); - XMLUtils::GetFloat(pElement, "subsdelayrange", m_videoSubsDelayRange, 10, 600); - XMLUtils::GetFloat(pElement, "audiodelayrange", m_videoAudioDelayRange, 10, 600); - XMLUtils::GetString(pElement, "defaultplayer", m_videoDefaultPlayer); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index fc526d11c3a78bc74125429120e29bf295bd3b16..6b0e3b8cf9e3ff40e6af758c54fe7eefb89a131c 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -372,6 +372,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - std::string m_stereoscopicregex_3d; - std::string m_stereoscopicregex_sbs; - std::string m_stereoscopicregex_tab; -+ std::string m_stereoscopicregex_mvc; - - bool m_useDisplayControlHWStereo; - - -From 4c051282f501f503dd7fffa2c5de404c7f226bf5 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 5 Oct 2015 14:58:05 +0100 -Subject: [PATCH 29/62] [3d] Swap top/bottom sides of GUI - ---- - xbmc/guilib/GraphicContext.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp -index 3706e4d80b3b31da4c5be0a1b21f36e59d2910f2..e170b3fb05279ffa316794dbce1d4f9dc5697bd0 100644 ---- a/xbmc/guilib/GraphicContext.cpp -+++ b/xbmc/guilib/GraphicContext.cpp -@@ -266,7 +266,7 @@ CPoint CGraphicContext::StereoCorrection(const CPoint &point) const - { - const RESOLUTION_INFO info = GetResInfo(); - -- if(m_stereoView == RENDER_STEREO_VIEW_RIGHT) -+ if(m_stereoView == RENDER_STEREO_VIEW_LEFT) - res.y += info.iHeight + info.iBlanking; - } - if(m_stereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL) - -From f29ad40c8e501bebc8aa27133b3197ed9b7314dc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Oct 2015 20:51:37 +0100 -Subject: [PATCH 30/62] Revert "Revert "Disable extra logging by default"" - -This reverts commit a880554325be187b877cd8f0e2b338e7267da636. ---- - system/settings/settings.xml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 326ffbd0f08428c3b4a95208134253feeabf1b1f..22dcff1c06577055f84c3d2c2fda73cfa16c53d4 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2822,12 +2822,12 @@ - - - 1 -- true -+ false - - - - 1 -- 32768 -+ - - loggingcomponents - , - -From 27644a4501775081bd9d7e70c3dc327b2edf5575 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 21 Dec 2015 22:17:25 +0000 -Subject: [PATCH 31/62] [omximage] Fall back to arm jpeg encode/decode when gpu - is busy - ---- - xbmc/cores/omxplayer/OMXImage.cpp | 50 ++++++++++++++++++++++++++++++++------- - xbmc/cores/omxplayer/OMXImage.h | 7 ++++++ - 2 files changed, 48 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index d2560aa78980e44d5f2d1483bce976cb83353502..e16dbf00b8d8192df4c6e946a48d8f20a72d762d 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -57,12 +57,17 @@ static XbmcThreads::ConditionVariable g_count_cond; - static CCriticalSection g_count_lock; - static int g_count_val; - --static void limit_calls_enter() -+static bool limit_calls_enter() - { - CSingleLock lock(g_count_lock); -+ // on Pi2 fall back to arm decode if the queue is getting big -+ if (g_RBP.RasberryPiVersion() > 1 && g_count_val >= 2) -+ return false; -+ - while (g_count_val >= 3) - g_count_cond.wait(lock); - g_count_val++; -+ return true; - } - - static void limit_calls_leave() -@@ -112,6 +117,9 @@ bool COMXImage::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int w - unsigned int format, unsigned int pitch, const std::string& destFile) - { - COMXImageEnc omxImageEnc; -+ if (!omxImageEnc.Gpu()) -+ return false; -+ - bool ret = omxImageEnc.CreateThumbnailFromSurface(buffer, width, height, format, pitch, destFile); - if (!ret) - CLog::Log(LOGNOTICE, "%s: unable to create thumbnail %s %dx%d", __func__, destFile.c_str(), width, height); -@@ -205,6 +213,8 @@ bool COMXImage::CreateThumb(const std::string& srcFile, unsigned int maxHeight, - bool okay = false; - COMXImageFile file; - COMXImageReEnc reenc; -+ if (!reenc.Gpu()) -+ return false; - void *pDestBuffer; - unsigned int nDestSize; - int orientation = additional_info == "flipped" ? 1:0; -@@ -310,6 +320,9 @@ bool COMXImage::DecodeJpegToTexture(COMXImageFile *file, unsigned int width, uns - bool ret = false; - COMXTexture omx_image; - -+ if (!omx_image.Gpu()) -+ return false; -+ - struct textureinfo *tex = new struct textureinfo; - if (!tex) - return NULL; -@@ -924,7 +937,7 @@ bool COMXImageFile::ReadFile(const std::string& inputFile, int orientation) - - COMXImageDec::COMXImageDec() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - m_decoded_buffer = NULL; - OMX_INIT_STRUCTURE(m_decoded_format); - m_success = false; -@@ -936,7 +949,8 @@ COMXImageDec::~COMXImageDec() - - OMX_INIT_STRUCTURE(m_decoded_format); - m_decoded_buffer = NULL; -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - void COMXImageDec::Close() -@@ -1086,6 +1100,9 @@ bool COMXImageDec::HandlePortSettingChange(unsigned int resize_width, unsigned i - - bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, unsigned width, unsigned height, unsigned stride, void *pixels) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - OMX_BUFFERHEADERTYPE *omx_buffer = NULL; -@@ -1223,7 +1240,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes - - COMXImageEnc::COMXImageEnc() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - CSingleLock lock(m_OMXSection); - OMX_INIT_STRUCTURE(m_encoded_format); - m_encoded_buffer = NULL; -@@ -1247,11 +1264,15 @@ COMXImageEnc::~COMXImageEnc() - m_omx_encoder.Deinitialize(); - } - } -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsigned height, unsigned int pitch) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - - unsigned int demuxer_bytes = 0; -@@ -1432,6 +1453,9 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const std::string& destFile) - { -+ if (!m_gpu) -+ return false; -+ - if(format != XB_FMT_A8R8G8B8 || !buffer) - { - CLog::Log(LOGDEBUG, "%s::%s : %s failed format=0x%x\n", CLASSNAME, __func__, destFile.c_str(), format); -@@ -1465,7 +1489,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in - - COMXImageReEnc::COMXImageReEnc() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - m_encoded_buffer = NULL; - m_pDestBuffer = NULL; - m_nDestAllocSize = 0; -@@ -1479,7 +1503,8 @@ COMXImageReEnc::~COMXImageReEnc() - free (m_pDestBuffer); - m_pDestBuffer = NULL; - m_nDestAllocSize = 0; -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - void COMXImageReEnc::Close() -@@ -1771,6 +1796,9 @@ bool COMXImageReEnc::HandlePortSettingChange(unsigned int resize_width, unsigned - - bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, unsigned int maxHeight, void * &pDestBuffer, unsigned int &nDestSize) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - -@@ -1943,14 +1971,15 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - - COMXTexture::COMXTexture() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - m_success = false; - } - - COMXTexture::~COMXTexture() - { - Close(); -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - void COMXTexture::Close() -@@ -2134,6 +2163,9 @@ bool COMXTexture::HandlePortSettingChange(unsigned int resize_width, unsigned in - - bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, unsigned int width, unsigned int height, void *egl_image) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - -diff --git a/xbmc/cores/omxplayer/OMXImage.h b/xbmc/cores/omxplayer/OMXImage.h -index a93aa82663903fb1bf712058c2e259290ee742e6..6f38dbc7e5cc721c59a3633935f08218eb1dd169 100644 ---- a/xbmc/cores/omxplayer/OMXImage.h -+++ b/xbmc/cores/omxplayer/OMXImage.h -@@ -133,6 +133,7 @@ protected: - OMX_PARAM_PORTDEFINITIONTYPE m_decoded_format; - CCriticalSection m_OMXSection; - bool m_success; -+ bool m_gpu; - }; - - class COMXImageEnc -@@ -144,6 +145,7 @@ public: - // Required overrides - bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const std::string& destFile); -+ bool Gpu() { return m_gpu; } - protected: - bool Encode(unsigned char *buffer, int size, unsigned int width, unsigned int height, unsigned int pitch); - // Components -@@ -152,6 +154,7 @@ protected: - OMX_PARAM_PORTDEFINITIONTYPE m_encoded_format; - CCriticalSection m_OMXSection; - bool m_success; -+ bool m_gpu; - }; - - class COMXImageReEnc -@@ -163,6 +166,7 @@ public: - // Required overrides - void Close(); - bool ReEncode(COMXImageFile &srcFile, unsigned int width, unsigned int height, void * &pDestBuffer, unsigned int &nDestSize); -+ bool Gpu() { return m_gpu; } - protected: - bool HandlePortSettingChange(unsigned int resize_width, unsigned int resize_height, int orientation, bool port_settings_changed); - // Components -@@ -176,6 +180,7 @@ protected: - void *m_pDestBuffer; - unsigned int m_nDestAllocSize; - bool m_success; -+ bool m_gpu; - }; - - class COMXTexture -@@ -187,6 +192,7 @@ public: - // Required overrides - void Close(void); - bool Decode(const uint8_t *data, unsigned size, unsigned int width, unsigned int height, void *egl_image); -+ bool Gpu() { return m_gpu; } - protected: - bool HandlePortSettingChange(unsigned int resize_width, unsigned int resize_height, void *egl_image, bool port_settings_changed); - -@@ -201,6 +207,7 @@ protected: - OMX_BUFFERHEADERTYPE *m_egl_buffer; - CCriticalSection m_OMXSection; - bool m_success; -+ bool m_gpu; - }; - - extern COMXImage g_OMXImage; - -From 7d8d250f20930ac4d8684579b45c122f80b19bdd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 9 Dec 2015 13:31:14 +0000 -Subject: [PATCH 32/62] [mmalcodec] Fail to open when width is invalid. Can - happen with mpegts files - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index 822b7bf75f2e732b5eed8687403d0eda503fa641..c43952d4d29b42f3a5c7605573294568f79ca010 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -368,6 +368,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d renderer:%p", CLASSNAME, __func__, CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMMAL), hints.software, hints.width, hints.height, options.m_opaque_pointer); - -+ // This occurs at start of m2ts files before streams have been fully identified - just ignore -+ if (!hints.width) -+ return false; - // we always qualify even if DVDFactoryCodec does this too. - if (!CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMMAL) || hints.software) - return false; - -From d458533c19e59c92917de490a1214fd883f59ab2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 33/62] [videoplayer/rbp] Add pi specific option to maintain - vsync with pll adjustment - -New A/V sync option in settings/video/playback to do "Adjust PLL". -This uses video clock (so perfect video syncing) but avoids having to resample -or drop/dupe audio packets which is normally required. ---- - .../resource.language.en_gb/resources/strings.po | 32 ++++++++++++++++++++++ - system/settings/rbp.xml | 14 ++++++++++ - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 25 +++++++++++------ - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 9 +++++- - .../Engines/ActiveAE/ActiveAEStream.cpp | 24 +++++++++++++--- - .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 7 +++-- - xbmc/cores/AudioEngine/Interfaces/AEStream.h | 10 ++++++- - xbmc/cores/VideoPlayer/DVDAudio.cpp | 4 +-- - xbmc/cores/VideoPlayer/DVDAudio.h | 2 +- - xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 12 ++++++-- - xbmc/linux/RBP.cpp | 20 ++++++++++++++ - xbmc/linux/RBP.h | 5 ++++ - 12 files changed, 143 insertions(+), 21 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ae3aa10aa65beac6689f129d60056cadf8a5b5c1..7c7969d381bf15ac1ba2fd8f16e463f6b12fe4c3 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19767,3 +19767,35 @@ msgstr "" - msgctxt "#38190" - msgid "Extract thumbnails from video files" - msgstr "" -+ -+#. Description of setting "System -> Audio Ouput -> A/V sync method" with label #38200 -+#: system/settings/settings.xml -+msgctxt "#38200" -+msgid "PLL adjustment to maintain audio/video sync" -+msgstr "" -+ -+#. Description of setting "Videos -> Playback -> A/V sync method" with label #38201 -+#: system/settings/settings.xml -+msgctxt "#38201" -+msgid "Allows sync adjustment without resampling. Lower the settings if you get audio/video dropouts." -+msgstr "" -+ -+msgctxt "#38202" -+msgid "Off" -+msgstr "" -+ -+msgctxt "#38203" -+msgid "Low" -+msgstr "" -+ -+msgctxt "#38204" -+msgid "Medium" -+msgstr "" -+ -+msgctxt "#38205" -+msgid "High" -+msgstr "" -+ -+msgctxt "#38206" -+msgid "Max" -+msgstr "" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 289dc55ec41aa44848519a05f8ee1ccc72740085..2572e25753712186f69390965ee1448bff3fadd5 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -101,6 +101,20 @@ - - 100 - -+ -+ 3 -+ 0 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index f5671b8dfb03216301d936ae3b08bfc3e8225729..68399ab14faf813bd195d2fdf03a4a376307b4cd 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -363,11 +363,12 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::APPFOCUSED, msg->data, sizeof(bool)); - return; - case CActiveAEControlProtocol::STREAMRESAMPLEMODE: -- MsgStreamParameter *par; -- par = (MsgStreamParameter*)msg->data; -+ MsgStreamResample *par; -+ par = (MsgStreamResample*)msg->data; - if (par->stream) - { -- par->stream->m_resampleMode = par->parameter.int_par; -+ par->stream->m_resampleMode = par->mode; -+ par->stream->m_pllAdjust = par->plladjust; - par->stream->m_resampleIntegral = 0.0; - } - return; -@@ -2456,7 +2457,14 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream) - { - if (stream->m_processingBuffers) - { -- stream->m_processingBuffers->SetRR(stream->CalcResampleRatio(error), m_settings.atempoThreshold); -+ double pllAdjustRequest = 0.0, pllAdjustActual = 0.0, e = 0.0; -+ if (stream->m_pllAdjust > 0.0) -+ { -+ e = std::max(std::min(error / 50.0, 1.0), - 1.0); -+ pllAdjustRequest = 1.0 + e * stream->m_pllAdjust; -+ } -+ stream->m_processingBuffers->SetRR(stream->CalcResampleRatio(error), m_settings.atempoThreshold, pllAdjustRequest, stream->m_pllAdjust, pllAdjustActual); -+ CLog::Log(LOGDEBUG, "ActiveAE::%s pll:%.5f (act:%.5f lim:%.5f) rr:%.5f threshold:%.3f error:%.6f", __FUNCTION__, pllAdjustRequest, pllAdjustActual, stream->m_pllAdjust, stream->m_processingBuffers->GetRR(), m_settings.atempoThreshold, error ); - } - } - else if (stream->m_processingBuffers) -@@ -3322,13 +3330,14 @@ void CActiveAE::SetStreamResampleRatio(CActiveAEStream *stream, double ratio) - &msg, sizeof(MsgStreamParameter)); - } - --void CActiveAE::SetStreamResampleMode(CActiveAEStream *stream, int mode) -+void CActiveAE::SetStreamResampleMode(CActiveAEStream *stream, int mode, float plladjust) - { -- MsgStreamParameter msg; -+ MsgStreamResample msg; - msg.stream = stream; -- msg.parameter.int_par = mode; -+ msg.mode = mode; -+ msg.plladjust = plladjust; - m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMRESAMPLEMODE, -- &msg, sizeof(MsgStreamParameter)); -+ &msg, sizeof(MsgStreamResample)); - } - - void CActiveAE::SetStreamFFmpegInfo(CActiveAEStream *stream, int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type) -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index e29eb5719a2e24562a16180e53b2decd955e50a5..e2d3a6824ca0dc93fb08f3374c745ac1dcc63db3 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -177,6 +177,13 @@ struct MsgStreamFFmpegInfo - enum AVAudioServiceType audio_service_type; - }; - -+struct MsgStreamResample -+{ -+ CActiveAEStream *stream; -+ int mode; -+ float plladjust; -+}; -+ - class CEngineStats - { - public: -@@ -293,7 +300,7 @@ protected: - void SetStreamReplaygain(CActiveAEStream *stream, float rgain); - void SetStreamVolume(CActiveAEStream *stream, float volume); - void SetStreamResampleRatio(CActiveAEStream *stream, double ratio); -- void SetStreamResampleMode(CActiveAEStream *stream, int mode); -+ void SetStreamResampleMode(CActiveAEStream *stream, int mode, float plladjust); - void SetStreamFFmpegInfo(CActiveAEStream *stream, int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type); - void SetStreamFade(CActiveAEStream *stream, float from, float target, unsigned int millis); - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -index 246d7e6c05242f1d64bbc3983b7342e24423ba8c..6b009dcea60e7431d418286c7602e1c29e793cb5 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -@@ -29,6 +29,10 @@ - #include "ActiveAE.h" - #include "ActiveAEStream.h" - -+#if defined(TARGET_RASPBERRY_PI) -+#include "linux/RBP.h" -+#endif -+ - using namespace ActiveAE; - - /* typecast AE to CActiveAE */ -@@ -71,6 +75,7 @@ CActiveAEStream::CActiveAEStream(AEAudioFormat *format, unsigned int streamid) - m_lastPtsJump = 0; - m_errorInterval = 1000; - m_clockSpeed = 1.0; -+ m_pllAdjust = 0.0f; - } - - CActiveAEStream::~CActiveAEStream() -@@ -509,11 +514,12 @@ void CActiveAEStream::SetResampleRatio(double ratio) - m_streamResampleRatio = ratio; - } - --void CActiveAEStream::SetResampleMode(int mode) -+void CActiveAEStream::SetResampleMode(int mode, float plladjust) - { -- if (mode != m_streamResampleMode) -- AE.SetStreamResampleMode(this, mode); -+ if (mode != m_streamResampleMode || plladjust != m_streamPllAdjust) -+ AE.SetStreamResampleMode(this, mode, plladjust); - m_streamResampleMode = mode; -+ m_streamPllAdjust = plladjust; - } - - void CActiveAEStream::SetFFmpegInfo(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type) -@@ -714,8 +720,18 @@ bool CActiveAEStreamBuffers::IsDrained() - return false; - } - --void CActiveAEStreamBuffers::SetRR(double rr, double atempoThreshold) -+void CActiveAEStreamBuffers::SetRR(double rr, double atempoThreshold, double pllAdjustRequest, double pllThreshold, double &pllAdjustActual) - { -+#if defined(TARGET_RASPBERRY_PI) -+ if (pllAdjustRequest > 0.0f) // pll adjust -+ { -+ pllAdjustActual = g_RBP.AdjustHDMIClock(pllAdjustRequest); -+ rr = 1.0; -+ } -+ else -+ pllAdjustActual = g_RBP.AdjustHDMIClock(1.0); -+#endif -+ - if (fabs(rr - 1.0) < atempoThreshold) - { - m_resampleBuffers->SetRR(rr); -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -index 531dedc71f8b342d1556518e1fb7cb051f334e88..80ab096a417d53fcdf7703d11437f92df23f6f46 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -@@ -103,7 +103,8 @@ public: - void Flush(); - void SetDrain(bool drain); - bool IsDrained(); -- void SetRR(double rr, double atempoThreshold); -+ void SetRR(double rr, double atempoThreshold, double pllAdjustRequest, double pllThreshold, double &pllAdjustActual); -+ void SetRR(double rr, double atempoThreshold) { double pllAdjustActual; SetRR(rr, atempoThreshold, 0.0, 0.0, pllAdjustActual); } - double GetRR(); - void FillBuffer(); - bool DoesNormalize(); -@@ -169,7 +170,7 @@ public: - - virtual double GetResampleRatio(); - virtual void SetResampleRatio(double ratio); -- virtual void SetResampleMode(int mode); -+ virtual void SetResampleMode(int mode, float plladjust); - virtual void RegisterAudioCallback(IAudioCallback* pCallback); - virtual void UnRegisterAudioCallback(); - virtual void FadeVolume(float from, float to, unsigned int time); -@@ -186,6 +187,7 @@ protected: - float m_streamAmplify; - double m_streamResampleRatio; - int m_streamResampleMode; -+ float m_streamPllAdjust; - unsigned int m_streamSpace; - bool m_streamDraining; - bool m_streamDrained; -@@ -226,6 +228,7 @@ protected: - int m_fadingTime; - int m_profile; - int m_resampleMode; -+ float m_pllAdjust; - double m_resampleIntegral; - double m_clockSpeed; - enum AVMatrixEncoding m_matrixEncoding; -diff --git a/xbmc/cores/AudioEngine/Interfaces/AEStream.h b/xbmc/cores/AudioEngine/Interfaces/AEStream.h -index 533f6715d4e39215942d9ddd59f1242336daf32d..9e33493fd1a9f252162b8aa982609f161532d8ac 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AEStream.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AEStream.h -@@ -41,6 +41,14 @@ public: - class CAESyncInfo - { - public: -+ CAESyncInfo() -+ { -+ delay = 0.0; -+ error = 0.0; -+ rr = 1.0; -+ errortime = 0; -+ state = SYNC_OFF; -+ } - double delay; - double error; - double rr; -@@ -231,7 +239,7 @@ public: - /** - * Sets the resamplling on/ff - */ -- virtual void SetResampleMode(int mode) = 0; -+ virtual void SetResampleMode(int mode, float plladjust) = 0; - - /** - * Registers the audio callback to call with each block of data, this is used by Audio Visualizations -diff --git a/xbmc/cores/VideoPlayer/DVDAudio.cpp b/xbmc/cores/VideoPlayer/DVDAudio.cpp -index 2dd9b3689a37874a8199ff6edf64ba0b26d8c69f..8a7c2a7d86422bf7573d00a1f9d3084367ff19aa 100644 ---- a/xbmc/cores/VideoPlayer/DVDAudio.cpp -+++ b/xbmc/cores/VideoPlayer/DVDAudio.cpp -@@ -313,12 +313,12 @@ double CDVDAudio::GetResampleRatio() - return m_resampleRatio; - } - --void CDVDAudio::SetResampleMode(int mode) -+void CDVDAudio::SetResampleMode(int mode, float plladjust) - { - CSingleLock lock (m_critSection); - if(m_pAudioStream) - { -- m_pAudioStream->SetResampleMode(mode); -+ m_pAudioStream->SetResampleMode(mode, plladjust); - } - } - -diff --git a/xbmc/cores/VideoPlayer/DVDAudio.h b/xbmc/cores/VideoPlayer/DVDAudio.h -index 81882a1a3828e3f95df26c1bd88c061d3b994b44..ed6974b1155a7272f3ef5bfed3f749674b831b93 100644 ---- a/xbmc/cores/VideoPlayer/DVDAudio.h -+++ b/xbmc/cores/VideoPlayer/DVDAudio.h -@@ -61,7 +61,7 @@ public: - double GetSyncError(); - void SetSyncErrorCorrection(double correction); - double GetResampleRatio(); -- void SetResampleMode(int mode); -+ void SetResampleMode(int mode, float plladjust); - void Flush(); - void Drain(); - void AbortAddPackets(); -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -index 9db3a9cc91fd5f9b194d6c1aa66aa02121164c29..56170f48cda417554c57b2adf934c2df58a23abf 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -@@ -96,6 +96,7 @@ bool CVideoPlayerAudio::OpenStream(CDVDStreamInfo &hints) - bool allowpassthrough = !CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEDISPLAYASCLOCK); - if (hints.realtime) - allowpassthrough = false; -+ allowpassthrough |= CSettings::GetInstance().GetInt("audiooutput.plladjust") > 0; - CDVDAudioCodec* codec = CDVDFactoryCodec::CreateAudioCodec(hints, m_processInfo, allowpassthrough, m_processInfo.AllowDTSHDDecode()); - if(!codec) - { -@@ -217,8 +218,12 @@ void CVideoPlayerAudio::UpdatePlayerInfo() - - //print the inverse of the resample ratio, since that makes more sense - //if the resample ratio is 0.5, then we're playing twice as fast -+#ifdef TARGET_RASPBERRY_PI -+ s << ", rr:" << std::fixed << std::setprecision(5) << 1.0 / m_dvdAudio.GetResampleRatio() << ", pll:" << std::fixed << std::setprecision(5) << g_RBP.GetAdjustHDMIClock() << ", err:" << std::fixed << std::setprecision(1) << m_dvdAudio.GetSyncError() * 1e-3 << "ms"; -+#else - if (m_synctype == SYNC_RESAMPLE) - s << ", rr:" << std::fixed << std::setprecision(5) << 1.0 / m_dvdAudio.GetResampleRatio(); -+#endif - - s << ", att:" << std::fixed << std::setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; - -@@ -541,10 +546,12 @@ void CVideoPlayerAudio::SetSyncType(bool passthrough) - int synctype = (m_synctype >= 0 && m_synctype <= 1) ? m_synctype : 2; - CLog::Log(LOGDEBUG, "CVideoPlayerAudio:: synctype set to %i: %s", m_synctype, synctypes[synctype]); - m_prevsynctype = m_synctype; -+ const float plladjusts[] = { 0.0f, 0.00001f, 0.0001f, 0.001f, 0.01f }; -+ float plladjust = plladjusts[CSettings::GetInstance().GetInt("audiooutput.plladjust")]; - if (m_synctype == SYNC_RESAMPLE) -- m_dvdAudio.SetResampleMode(1); -+ m_dvdAudio.SetResampleMode(1, plladjust); - else -- m_dvdAudio.SetResampleMode(0); -+ m_dvdAudio.SetResampleMode(0, plladjust); - } - } - -@@ -602,6 +609,7 @@ bool CVideoPlayerAudio::SwitchCodecIfNeeded() - bool allowpassthrough = !CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEDISPLAYASCLOCK); - if (m_streaminfo.realtime) - allowpassthrough = false; -+ allowpassthrough |= CSettings::GetInstance().GetInt("audiooutput.plladjust") > 0; - CDVDAudioCodec *codec = CDVDFactoryCodec::CreateAudioCodec(m_streaminfo, m_processInfo, allowpassthrough, m_processInfo.AllowDTSHDDecode()); - if (!codec || codec->NeedPassthrough() == m_pAudioCodec->NeedPassthrough()) { - // passthrough state has not changed -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 5a6f780517cff0c31f1c40e5e95445d448eb2297..6e8529001b1a464b4547a846f553d98f5bc0b6c0 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -46,6 +46,8 @@ CRBP::CRBP() - m_DllBcmHost = new DllBcmHost(); - m_OMX = new COMXCore(); - m_display = DISPMANX_NO_HANDLE; -+ m_requested_pll_adjust = -1.0; -+ m_actual_pll_adjust = -1.0; - m_mb = mbox_open(); - vcsm_init(); - m_vsync_count = 0; -@@ -153,6 +155,8 @@ void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) - assert(s == 0); - vc_dispmanx_display_close(m_display); - m_display = DISPMANX_NO_HANDLE; -+ m_requested_pll_adjust = -1.0; -+ m_actual_pll_adjust = -1.0; - } - - void CRBP::GetDisplaySize(int &width, int &height) -@@ -366,4 +370,20 @@ void CGPUMEM::Flush() - vcsm_clean_invalid( &iocache ); - } - -+double CRBP::AdjustHDMIClock(double adjust) -+{ -+ char response[80]; -+ -+ if (adjust == m_requested_pll_adjust) -+ return m_actual_pll_adjust; -+ -+ m_requested_pll_adjust = adjust; -+ vc_gencmd(response, sizeof response, "hdmi_adjust_clock %f", adjust); -+ char *p = strchr(response, '='); -+ if (p) -+ m_actual_pll_adjust = atof(p+1); -+ CLog::Log(LOGDEBUG, "CRBP::%s(%.5f) = %.5f", __func__, adjust, m_actual_pll_adjust); -+ return m_actual_pll_adjust; -+} -+ - #endif -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index fffa5182126159f6dfcf750b21fa0464e229e545..815d758e7086d73b4d4eb16849fdbb509a3c251d 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -82,6 +82,8 @@ public: - uint32_t WaitVsync(uint32_t target = ~0U); - void VSyncCallback(); - int GetMBox() { return m_mb; } -+ double AdjustHDMIClock(double adjust); -+ double GetAdjustHDMIClock() { return m_actual_pll_adjust; } - - private: - DllBcmHost *m_DllBcmHost; -@@ -103,6 +105,9 @@ private: - CCriticalSection m_critSection; - - int m_mb; -+ double m_requested_pll_adjust; -+ double m_actual_pll_adjust; -+ public: - }; - - extern CRBP g_RBP; - -From 5798c44c892111b789e14fb89e15dec6e8a5dcb4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 7 May 2015 15:35:43 +0100 -Subject: [PATCH 34/62] rbp: Support zero copy interface with hevc acceleration - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 9 +++++++++ - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp | 5 +++-- - 2 files changed, 12 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 4129d3d6a77ce1a3f15bad045746970f6e640ea6..619515c9411172261d8f0bef24c5d679c35e5d7d 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -368,6 +368,15 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options - if (tryhw && m_decoderState == STATE_NONE) - { - m_decoderState = STATE_HW_SINGLE; -+#ifdef TARGET_RASPBERRY_PI -+ int num_threads = g_cpuInfo.getCPUCount() * 3 / 2; -+ num_threads = std::max(1, std::min(num_threads, 16)); -+ if (pCodec->id == AV_CODEC_ID_HEVC) -+ num_threads = 8; -+ m_pCodecContext->thread_count = num_threads; -+ m_pCodecContext->thread_safe_callbacks = 0; -+ CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - open frame threaded with %d threads", num_threads); -+#endif - } - else - { -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp -index 77ae3273bc8e224fe6c193300ccef32fb7fbafe1..c0b3f19f2ef9cdef9adf00cf81154803b12feb4f 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp -@@ -296,8 +296,9 @@ bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture - picture->MMALBuffer->mmal_buffer->alloc_size = picture->MMALBuffer->mmal_buffer->length = gmem->m_numbytes; - picture->MMALBuffer->m_stills = m_hints.stills; - -- // need to flush ARM cache so GPU can see it -- gmem->Flush(); -+ // need to flush ARM cache so GPU can see it (HEVC will have already done this) -+ if (avctx->codec_id != AV_CODEC_ID_HEVC) -+ gmem->Flush(); - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - mmal:%p dts:%.3f pts:%.3f buf:%p gpu:%p", CLASSNAME, __FUNCTION__, picture->MMALBuffer->mmal_buffer, 1e-6*picture->dts, 1e-6*picture->pts, picture->MMALBuffer, gmem); - -From 0a99bc0eb1d4a036f4df0d9f88c0f8bb3c6b0e6d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 16 May 2015 18:26:04 +0100 -Subject: [PATCH 35/62] ffmpeg: use upstream mvc patches - ---- - ...vcodec-add-h264_mvc-codec-id-and-profiles.patch | 68 ++++++++++++ - ...er-add-support-for-parsing-h264-mvc-NALUs.patch | 116 +++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 7 +- - tools/depends/target/ffmpeg/autobuild.sh | 3 + - ...arsing_of_mvc_slices_in_some_corner_cases.patch | 55 ++++++++++ - 5 files changed, 248 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch - create mode 100644 tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch - create mode 100644 tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - -diff --git a/tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch b/tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..2e7381fe6538089759ebc7288c0a5d908cd0973c ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -@@ -0,0 +1,68 @@ -+From 4060f15e2d29e268110032d4366382e370e088d0 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sun, 26 Jun 2016 20:09:18 +0100 -+Subject: [PATCH] avcodec: add h264_mvc codec id and profiles -+ -+--- -+ libavcodec/avcodec.h | 5 +++++ -+ libavcodec/codec_desc.c | 7 +++++++ -+ libavformat/mpegts.c | 2 +- -+ 3 files changed, 13 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -+index a1ba217..abd2e91 100644 -+--- a/libavcodec/avcodec.h -++++ b/libavcodec/avcodec.h -+@@ -410,6 +410,8 @@ enum AVCodecID { -+ AV_CODEC_ID_SHEERVIDEO, -+ AV_CODEC_ID_YLC, -+ -++ AV_CODEC_ID_H264_MVC, -++ -+ /* various PCM "codecs" */ -+ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs -+ AV_CODEC_ID_PCM_S16LE = 0x10000, -+@@ -3195,6 +3197,9 @@ typedef struct AVCodecContext { -+ #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 -+ #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) -+ #define FF_PROFILE_H264_CAVLC_444 44 -++#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 -++#define FF_PROFILE_H264_STEREO_HIGH 128 -++#define FF_PROFILE_H264_MULTIVIEW_HIGH_DEPTH 138 -+ -+ #define FF_PROFILE_VC1_SIMPLE 0 -+ #define FF_PROFILE_VC1_MAIN 1 -+diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -+index 9d94b72..535ebf0 100644 -+--- a/libavcodec/codec_desc.c -++++ b/libavcodec/codec_desc.c -+@@ -1563,6 +1563,13 @@ static const AVCodecDescriptor codec_descriptors[] = { -+ .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"), -+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, -+ }, -++ { -++ .id = AV_CODEC_ID_H264_MVC, -++ .type = AVMEDIA_TYPE_VIDEO, -++ .name = "h264_mvc", -++ .long_name = NULL_IF_CONFIG_SMALL("H264 MVC"), -++ .props = AV_CODEC_PROP_LOSSY, -++ }, -+ -+ /* various PCM "codecs" */ -+ { -+diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -+index b31d233..2767306 100644 -+--- a/libavformat/mpegts.c -++++ b/libavformat/mpegts.c -+@@ -701,7 +701,7 @@ static const StreamType ISO_types[] = { -+ #endif -+ { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, -+ { 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC }, -+- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, -++ { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264_MVC }, -+ { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 }, -+ { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC }, -+ { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, -+-- -+2.7.4 -+ -diff --git a/tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch b/tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..399e8a95984771e4388bfe4785423ff3f664f89b ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -@@ -0,0 +1,116 @@ -+From 23dd20678a05e1764e5d8d30481cb354a51b6c8b Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sun, 26 Jun 2016 20:16:03 +0100 -+Subject: [PATCH] h264_parser: add support for parsing h264 mvc NALUs -+ -+--- -+ libavcodec/allcodecs.c | 1 + -+ libavcodec/h264.h | 2 ++ -+ libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++---- -+ 3 files changed, 33 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -+index 54efaad..02a89c3 100644 -+--- a/libavcodec/allcodecs.c -++++ b/libavcodec/allcodecs.c -+@@ -667,6 +667,7 @@ void avcodec_register_all(void) -+ REGISTER_PARSER(H261, h261); -+ REGISTER_PARSER(H263, h263); -+ REGISTER_PARSER(H264, h264); -++ REGISTER_PARSER(H264_MVC, h264_mvc); -+ REGISTER_PARSER(HEVC, hevc); -+ REGISTER_PARSER(MJPEG, mjpeg); -+ REGISTER_PARSER(MLP, mlp); -+diff --git a/libavcodec/h264.h b/libavcodec/h264.h -+index efe3555..16358aa 100644 -+--- a/libavcodec/h264.h -++++ b/libavcodec/h264.h -+@@ -126,7 +126,9 @@ enum { -+ NAL_END_STREAM = 11, -+ NAL_FILLER_DATA = 12, -+ NAL_SPS_EXT = 13, -++ NAL_SPS_SUBSET = 15, -+ NAL_AUXILIARY_SLICE = 19, -++ NAL_SLICE_EXT = 20, -+ NAL_FF_IGNORE = 0xff0f001, -+ }; -+ -+diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -+index ce4bab2..082ac17 100644 -+--- a/libavcodec/h264_parser.c -++++ b/libavcodec/h264_parser.c -+@@ -58,6 +58,7 @@ typedef struct H264ParseContext { -+ uint8_t parse_history[6]; -+ int parse_history_count; -+ int parse_last_mb; -++ int is_mvc; -+ } H264ParseContext; -+ -+ -+@@ -105,14 +106,18 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, -+ } else if (state <= 5) { -+ int nalu_type = buf[i] & 0x1F; -+ if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || -+- nalu_type == NAL_PPS || nalu_type == NAL_AUD) { -++ nalu_type == NAL_PPS || nalu_type == NAL_AUD || -++ nalu_type == NAL_SPS_SUBSET) { -+ if (pc->frame_start_found) { -+ i++; -+ goto found; -+ } -+ } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || -+- nalu_type == NAL_IDR_SLICE) { -++ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { -+ state += 8; -++ -++ if (nalu_type == NAL_SLICE_EXT) -++ i += 3; // skip mvc extension -+ continue; -+ } -+ state = 7; -+@@ -585,7 +590,8 @@ static int h264_parse(AVCodecParserContext *s, -+ } -+ } -+ -+- parse_nal_units(s, avctx, buf, buf_size); -++ if (!p->is_mvc) -++ parse_nal_units(s, avctx, buf, buf_size); -+ -+ if (avctx->framerate.num) -+ avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); -+@@ -622,7 +628,7 @@ static int h264_split(AVCodecContext *avctx, -+ if ((state & 0xFFFFFF00) != 0x100) -+ break; -+ nalu_type = state & 0x1F; -+- if (nalu_type == NAL_SPS) { -++ if (nalu_type == NAL_SPS || nalu_type == NAL_SPS_SUBSET) { -+ has_sps = 1; -+ } else if (nalu_type == NAL_PPS) -+ has_pps = 1; -+@@ -672,3 +678,23 @@ AVCodecParser ff_h264_parser = { -+ .parser_close = h264_close, -+ .split = h264_split, -+ }; -++ -++static av_cold int init_mvc(AVCodecParserContext *s) -++{ -++ H264ParseContext *p = s->priv_data; -++ int ret = init(s); -++ if (ret < 0) -++ return ret; -++ -++ p->is_mvc = 1; -++ return 0; -++} -++ -++AVCodecParser ff_h264_mvc_parser = { -++ .codec_ids = { AV_CODEC_ID_H264_MVC }, -++ .priv_data_size = sizeof(H264ParseContext), -++ .parser_init = init_mvc, -++ .parser_parse = h264_parse, -++ .parser_close = h264_close, -++ .split = h264_split, -++}; -+-- -+2.7.4 -+ -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 337dbaab927919858e44d79f647207ef0513eea1..7e97e4d91a443d46d933df528763422ff5e8f4fa 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -4,7 +4,9 @@ DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ - hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \ - pfcd_hevc_optimisations.patch \ -- 0001-Squashed-commit-of-the-following.patch -+ 0001-Squashed-commit-of-the-following.patch \ -+ 0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch 0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch \ -+ h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -90,6 +92,9 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch - cd $(PLATFORM); patch -p1 < ../0001-Squashed-commit-of-the-following.patch -+ cd $(PLATFORM); patch -p1 < ../0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -+ cd $(PLATFORM); patch -p1 < ../0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -+ cd $(PLATFORM); patch -p1 < ../h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index a61357f14cb2139e8125ae04684bed1b29fefb12..9f6c26c8acd08ed603aadeb4d9d81b07026e7506 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -137,6 +137,9 @@ patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - patch -p1 < ../pfcd_hevc_optimisations.patch - patch -p1 < ../0001-Squashed-commit-of-the-following.patch -+patch -p1 < ../0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -+patch -p1 < ../0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -+patch -p1 < ../h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -diff --git a/tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch b/tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..b39480ad098b9cd0882fcf75b96afb1b98686bcc ---- /dev/null -+++ b/tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -@@ -0,0 +1,55 @@ -+From 12d99a92469e5916de3bc787dce4c13abfdd5e09 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sun, 26 Jun 2016 20:20:04 +0100 -+Subject: [PATCH] h264_parser: fix parsing of mvc slices in some corner cases -+ -+--- -+ libavcodec/h264_parser.c | 10 +++++----- -+ 1 file changed, 5 insertions(+), 5 deletions(-) -+ -+diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -+index 082ac17..b9b0c78 100644 -+--- a/libavcodec/h264_parser.c -++++ b/libavcodec/h264_parser.c -+@@ -59,6 +59,7 @@ typedef struct H264ParseContext { -+ int parse_history_count; -+ int parse_last_mb; -+ int is_mvc; -++ int slice_ext; -+ } H264ParseContext; -+ -+ -+@@ -116,18 +117,17 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, -+ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { -+ state += 8; -+ -+- if (nalu_type == NAL_SLICE_EXT) -+- i += 3; // skip mvc extension -++ p->slice_ext = (nalu_type == NAL_SLICE_EXT); -+ continue; -+ } -+ state = 7; -+ } else { -+ p->parse_history[p->parse_history_count++] = buf[i]; -+- if (p->parse_history_count > 5) { -++ if (p->parse_history_count > 8) { -+ unsigned int mb, last_mb = p->parse_last_mb; -+ GetBitContext gb; -+ -+- init_get_bits(&gb, p->parse_history, 8*p->parse_history_count); -++ init_get_bits8(&gb, p->parse_history + 3*p->slice_ext, p->parse_history_count - 3*p->slice_ext); -+ p->parse_history_count = 0; -+ mb= get_ue_golomb_long(&gb); -+ p->parse_last_mb = mb; -+@@ -150,7 +150,7 @@ found: -+ pc->frame_start_found = 0; -+ if (p->is_avc) -+ return next_avc; -+- return i - (state & 5) - 5 * (state > 7); -++ return i - (state & 5) - 8 * (state > 7); -+ } -+ -+ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb, -+-- -+2.7.4 -+ - -From 7d4ef5a5e251a218f9609c0e2bb0cb7d3093f8b9 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 29 Jan 2016 17:18:50 +0300 -Subject: [PATCH 36/62] [win32] Settings: Added setting to enable/disable MVC - decoder. - ---- - system/settings/win32.xml | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/system/settings/win32.xml b/system/settings/win32.xml -index a017d30c24232fb01220b87b29398403b8ed9662..2fcee72a64e8b701c8e895143410bbe9fd617356 100644 ---- a/system/settings/win32.xml -+++ b/system/settings/win32.xml -@@ -12,6 +12,17 @@ - false - - -+

-+ -+ -+ -+ 2 -+ true -+ -+ -+ -+ -+
-
- - - -From 492201a86d20da77a664e197a42f4a32945420be Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Wed, 20 Jan 2016 17:02:16 +0300 -Subject: [PATCH 37/62] [VideoPlayer] DemuxFFmpeg: Properly demuxing h264_mvc - streams. - ---- - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 23 +++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 54a18c669a058b705e0276cb7e14522ae6cd04ae..55431978dcfabee8da95e2e76292ff815cc74433 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -25,6 +25,7 @@ - - #include "commons/Exception.h" - #include "cores/FFmpeg.h" -+#include "DVDCodecs/DVDCodecUtils.h" - #include "DVDClock.h" // for DVD_TIME_BASE - #include "DVDDemuxUtils.h" - #include "DVDInputStreams/DVDInputStream.h" -@@ -1355,6 +1356,15 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - } - case AVMEDIA_TYPE_VIDEO: - { -+ if (pStream->codec->codec_id == AV_CODEC_ID_H264_MVC) -+ { -+ // ignore MVC extension streams, they are handled specially -+ stream = new CDemuxStream(); -+ stream->type = STREAM_DATA; -+ stream->disabled = true; -+ pStream->need_parsing = AVSTREAM_PARSE_NONE; -+ break; -+ } - CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(this, pStream); - stream = st; - if(strcmp(m_pFormatContext->iformat->name, "flv") == 0) -@@ -1363,7 +1373,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - st->bVFR = false; - - // never trust pts in avi files with h264. -- if (m_bAVI && pStream->codec->codec_id == AV_CODEC_ID_H264) -+ if (m_bAVI && (pStream->codec->codec_id == AV_CODEC_ID_H264 || pStream->codec->codec_id == AV_CODEC_ID_H264_MVC)) - st->bPTSInvalid = true; - - #if defined(AVFORMAT_HAS_STREAM_GET_R_FRAME_RATE) -@@ -1434,6 +1444,17 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - if (av_dict_get(pStream->metadata, "title", NULL, 0)) - st->m_description = av_dict_get(pStream->metadata, "title", NULL, 0)->value; - -+ if (pStream->codec->codec_id == AV_CODEC_ID_H264) -+ { -+ if (CDVDCodecUtils::IsH264AnnexB(m_pFormatContext->iformat->name, pStream)) -+ { -+ // TODO -+ } -+ else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size)) -+ { -+ pStream->codec->codec_tag = MKTAG('M', 'V', 'C', '1'); -+ } -+ } - break; - } - case AVMEDIA_TYPE_DATA: - -From f32639c9513373f4c25dac7d9697f8c04760a7c8 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 25 Feb 2016 11:21:25 +0300 -Subject: [PATCH 38/62] [Stereo3D] Added block_lr and block_rl to supported - modes. - ---- - xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp | 4 ++-- - xbmc/guilib/StereoscopicsManager.cpp | 8 +++++--- - 2 files changed, 7 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp -index 24b1b10519467cbbfd96f7048efaf49aab7700cc..49f7f7ca7e144a259f6d06bd11cd97aa0b3242aa 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp -@@ -102,8 +102,8 @@ namespace RenderManager { - convert["right_left"] = CONF_FLAGS_STEREO_MODE_SBS | CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT; - convert["anaglyph_green_magenta"] = 0u; - convert["anaglyph_yellow_blue"] = 0u; -- convert["block_lr"] = 0u; -- convert["block_rl"] = 0u; -+ convert["block_lr"] = CONF_FLAGS_STEREO_CADANCE_LEFT_RIGHT; -+ convert["block_rl"] = CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT; - } - return convert[mode]; - } -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index 1443acaf0f25df458ae49766e13dd0323454f2eb..6aaa82f4d883b8cae0ccdedf6c5a6814e7aaa720 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -70,8 +70,10 @@ static const struct StereoModeMap VideoModeToGuiModeMap[] = - { "anaglyph_cyan_red", RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN }, - { "anaglyph_green_magenta", RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA }, - { "anaglyph_yellow_blue", RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE }, -- { "block_lr", RENDER_STEREO_MODE_OFF }, // unsupported -- { "block_rl", RENDER_STEREO_MODE_OFF }, // unsupported -+ { "block_lr", RENDER_STEREO_MODE_HARDWAREBASED }, -+ { "block_rl", RENDER_STEREO_MODE_HARDWAREBASED }, -+ { "block_lr", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback -+ { "block_rl", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback - {} - }; - -@@ -310,7 +312,7 @@ int CStereoscopicsManager::ConvertVideoToGuiStereoMode(const std::string &mode) - size_t i = 0; - while (VideoModeToGuiModeMap[i].name) - { -- if (mode == VideoModeToGuiModeMap[i].name) -+ if (mode == VideoModeToGuiModeMap[i].name && g_Windowing.SupportsStereo(VideoModeToGuiModeMap[i].mode)) - return VideoModeToGuiModeMap[i].mode; - i++; - } - -From 653902ed14aa61b97188eb1ce3bcfa47bc95046e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Sat, 23 Jan 2016 10:21:32 +0300 -Subject: [PATCH 39/62] [VideoPlayer] Fix possible wrong aspect. - ---- - xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -index 903f0d83527d9088ff1bf0ba056f357f6abfda81..a5a33d34c70892cde77ad4d8f3cb65fdd9703081 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -@@ -181,7 +181,7 @@ void CVideoPlayerVideo::OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec) - } - - // use aspect in stream if available -- if(hint.forced_aspect) -+ if (hint.forced_aspect && !std::isnan(hint.aspect)) - m_fForcedAspectRatio = hint.aspect; - else - m_fForcedAspectRatio = 0.0; - -From bb360aef2259c1ac131f9829726f42aaf7ddde8e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 22 Jan 2016 18:18:33 +0300 -Subject: [PATCH 40/62] [VideoPlayer] DemuxFFmpeg: ssif remux - ---- - xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt | 2 + - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 47 ++++++- - .../cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h | 2 + - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 156 +++++++++++++++++++++ - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h | 49 +++++++ - xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in | 1 + - xbmc/settings/AdvancedSettings.cpp | 2 +- - 7 files changed, 251 insertions(+), 8 deletions(-) - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -index 63776b1333bb66483303e44d6ebe60f3cd7e14d7..156ec2021002d9d7a355db2f0dcf099aabb1db48 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -@@ -5,6 +5,7 @@ set(SOURCES DemuxMultiSource.cpp - DVDDemuxCDDA.cpp - DVDDemuxClient.cpp - DVDDemuxFFmpeg.cpp -+ DemuxStreamSSIF.cpp - DVDDemuxUtils.cpp - DVDDemuxVobsub.cpp - DVDFactoryDemuxer.cpp) -@@ -16,6 +17,7 @@ set(HEADERS DemuxMultiSource.h - DVDDemuxCDDA.h - DVDDemuxClient.h - DVDDemuxFFmpeg.h -+ DemuxStreamSSIF.h - DVDDemuxPacket.h - DVDDemuxUtils.h - DVDDemuxVobsub.h -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 55431978dcfabee8da95e2e76292ff815cc74433..6df586ac1f2d00e55307358228a4be89278ce67e 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -166,6 +166,7 @@ CDVDDemuxFFmpeg::CDVDDemuxFFmpeg() : CDVDDemux() - m_currentPts = DVD_NOPTS_VALUE; - m_bMatroska = false; - m_bAVI = false; -+ m_pSSIF = nullptr; - m_speed = DVD_PLAYSPEED_NORMAL; - m_program = UINT_MAX; - m_pkt.result = -1; -@@ -553,6 +554,8 @@ void CDVDDemuxFFmpeg::Dispose() - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -+ SAFE_DELETE(m_pSSIF); -+ - if (m_pFormatContext) - { - for (unsigned int i = 0; i < m_pFormatContext->nb_streams; i++) -@@ -606,6 +609,9 @@ void CDVDDemuxFFmpeg::Flush() - - m_displayTime = 0; - m_dtsAtDisplayTime = DVD_NOPTS_VALUE; -+ -+ if (m_pSSIF) -+ m_pSSIF->Flush(); - } - - void CDVDDemuxFFmpeg::Abort() -@@ -878,7 +884,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - { - Flush(); - } -- else if (IsProgramChange()) -+ // libavformat is confused by the interleaved SSIF. -+ // Disable program management for those -+ else if (!m_pSSIF && IsProgramChange()) - { - // update streams - CreateStreams(m_program); -@@ -906,6 +914,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); -+ -+ if (m_pSSIF) -+ m_pSSIF->Flush(); - } - else - { -@@ -915,7 +926,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - - if (IsVideoReady()) - { -- if (m_program != UINT_MAX) -+ // libavformat is confused by the interleaved SSIF. -+ // Disable program management for those -+ if (!m_pSSIF && m_program != UINT_MAX ) - { - /* check so packet belongs to selected program */ - for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++) -@@ -1064,6 +1077,15 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - stream = AddStream(pPacket->iStreamId); - } - } -+ if (stream && m_pSSIF) -+ { -+ if (stream->type == STREAM_VIDEO || -+ stream->type == STREAM_DATA) -+ pPacket = m_pSSIF->AddPacket(pPacket); -+ -+ if (stream->type == STREAM_DATA && stream->codec == AV_CODEC_ID_H264_MVC && pPacket->iSize) -+ stream = GetStream(pPacket->iStreamId); -+ } - if (!stream) - { - CLog::Log(LOGERROR, "CDVDDemuxFFmpeg::AddStream - internal error, stream is null"); -@@ -1093,6 +1115,9 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double *startpts) - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -+ if (m_pSSIF) -+ m_pSSIF->Flush(); -+ - CDVDInputStream::IPosTime* ist = m_pInput->GetIPosTime(); - if (ist) - { -@@ -1173,6 +1198,9 @@ bool CDVDDemuxFFmpeg::SeekByte(int64_t pos) - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -+ if (m_pSSIF) -+ m_pSSIF->Flush(); -+ - return (ret >= 0); - } - -@@ -1358,11 +1386,12 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - { - if (pStream->codec->codec_id == AV_CODEC_ID_H264_MVC) - { -- // ignore MVC extension streams, they are handled specially -+ m_pSSIF = new CDemuxStreamSSIF(); -+ m_pSSIF->SetMVCStreamId(streamIdx); -+ - stream = new CDemuxStream(); - stream->type = STREAM_DATA; -- stream->disabled = true; -- pStream->need_parsing = AVSTREAM_PARSE_NONE; -+ pStream->codec->codec_type = AVMEDIA_TYPE_DATA; - break; - } - CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(this, pStream); -@@ -1448,7 +1477,11 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - { - if (CDVDCodecUtils::IsH264AnnexB(m_pFormatContext->iformat->name, pStream)) - { -- // TODO -+ if (m_pSSIF) -+ { -+ m_pSSIF->SetH264StreamId(streamIdx); -+ pStream->codec->codec_tag = MKTAG('A', 'M', 'V', 'C'); -+ } - } - else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size)) - { -@@ -1560,7 +1593,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - if (langTag) - strncpy(stream->language, langTag->value, 3); - -- if( stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0 ) -+ if (stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0) - { - stream->ExtraSize = pStream->codec->extradata_size; - stream->ExtraData = new uint8_t[pStream->codec->extradata_size]; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h -index 0bc498e8e387c7ff0aef065832c121d1367454aa..85ce39ee858992a5f095cdf6b4d35398c7ce7dcc 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h -@@ -21,6 +21,7 @@ - */ - - #include "DVDDemux.h" -+#include "DemuxStreamSSIF.h" - #include "threads/CriticalSection.h" - #include "threads/SystemClock.h" - #include -@@ -152,6 +153,7 @@ protected: - double m_currentPts; // used for stream length estimation - bool m_bMatroska; - bool m_bAVI; -+ CDemuxStreamSSIF* m_pSSIF; - int m_speed; - unsigned m_program; - XbmcThreads::EndTime m_timeout; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..f75532016a1395782b59dc124676835c7254de56 ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -0,0 +1,156 @@ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DemuxStreamSSIF.h" -+#include "DVDClock.h" -+#include "DVDDemuxUtils.h" -+#include "utils/log.h" -+ -+//#define DEBUG_VERBOSE -+ -+DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) -+{ -+ if (srcPkt->iStreamId != m_h264StreamId && -+ srcPkt->iStreamId != m_mvcStreamId) -+ return srcPkt; -+ -+ if (srcPkt->iStreamId == m_h264StreamId) -+ { -+ m_H264queue.push(srcPkt); -+ } -+ else if (srcPkt->iStreamId == m_mvcStreamId) -+ { -+ m_MVCqueue.push(srcPkt); -+ } -+ -+ return GetMVCPacket(); -+} -+ -+void CDemuxStreamSSIF::Flush() -+{ -+ while (!m_H264queue.empty()) -+ { -+ CDVDDemuxUtils::FreeDemuxPacket(m_H264queue.front()); -+ m_H264queue.pop(); -+ } -+ while (!m_MVCqueue.empty()) -+ { -+ CDVDDemuxUtils::FreeDemuxPacket(m_MVCqueue.front()); -+ m_MVCqueue.pop(); -+ } -+} -+ -+DemuxPacket* CDemuxStreamSSIF::MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt) -+{ -+ DemuxPacket* newpkt = NULL; -+ newpkt = CDVDDemuxUtils::AllocateDemuxPacket(srcPkt->iSize + appendPkt->iSize); -+ newpkt->iSize = srcPkt->iSize + appendPkt->iSize; -+ -+ newpkt->pts = srcPkt->pts; -+ newpkt->dts = srcPkt->dts; -+ newpkt->duration = srcPkt->duration; -+ newpkt->iGroupId = srcPkt->iGroupId; -+ newpkt->iStreamId = srcPkt->iStreamId; -+ memcpy(newpkt->pData, srcPkt->pData, srcPkt->iSize); -+ memcpy(newpkt->pData + srcPkt->iSize, appendPkt->pData, appendPkt->iSize); -+ -+ CDVDDemuxUtils::FreeDemuxPacket(srcPkt); -+ srcPkt = NULL; -+ CDVDDemuxUtils::FreeDemuxPacket(appendPkt); -+ appendPkt = NULL; -+ -+ return newpkt; -+} -+ -+DemuxPacket* CDemuxStreamSSIF::GetMVCPacket() -+{ -+ // Here, we recreate a h264 MVC packet from the base one + buffered MVC NALU's -+ while (!m_H264queue.empty() && !m_MVCqueue.empty()) -+ { -+ DemuxPacket* h264pkt = m_H264queue.front(); -+ double tsH264 = (h264pkt->dts != DVD_NOPTS_VALUE ? h264pkt->dts : h264pkt->pts); -+ DemuxPacket* mvcpkt = m_MVCqueue.front(); -+ double tsMVC = (mvcpkt->dts != DVD_NOPTS_VALUE ? mvcpkt->dts : mvcpkt->pts); -+ -+ if (tsH264 == tsMVC) -+ { -+ m_H264queue.pop(); -+ m_MVCqueue.pop(); -+ -+ while (!m_H264queue.empty()) -+ { -+ DemuxPacket* pkt = m_H264queue.front(); -+ double ts = (pkt->dts != DVD_NOPTS_VALUE ? pkt->dts : pkt->pts); -+ if (ts == DVD_NOPTS_VALUE) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC merge h264 fragment: %6d+%6d, pts(%.3f/%.3f) dts(%.3f/%.3f)", h264pkt->iSize, pkt->iSize, h264pkt->pts*1e-6, pkt->pts*1e-6, h264pkt->dts*1e-6, pkt->dts*1e-6); -+#endif -+ h264pkt = MergePacket(h264pkt, pkt); -+ m_H264queue.pop(); -+ } -+ else -+ break; -+ } -+ while (!m_MVCqueue.empty()) -+ { -+ DemuxPacket* pkt = m_MVCqueue.front(); -+ double ts = (pkt->dts != DVD_NOPTS_VALUE ? pkt->dts : pkt->pts); -+ if (ts == DVD_NOPTS_VALUE) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC merge mvc fragment: %6d+%6d, pts(%.3f/%.3f) dts(%.3f/%.3f)", mvcpkt->iSize, pkt->iSize, mvcpkt->pts*1e-6, pkt->pts*1e-6, mvcpkt->dts*1e-6, pkt->dts*1e-6); -+#endif -+ mvcpkt = MergePacket(mvcpkt, pkt); -+ m_MVCqueue.pop(); -+ } -+ else -+ break; -+ } -+ -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC merge packet: %6d+%6d, pts(%.3f/%.3f) dts(%.3f/%.3f)", h264pkt->iSize, mvcpkt->iSize, h264pkt->pts*1e-6, mvcpkt->pts*1e-6, h264pkt->dts*1e-6, mvcpkt->dts*1e-6); -+#endif -+ return MergePacket(h264pkt, mvcpkt); -+ } -+ else if (tsH264 > tsMVC) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d, pts(%.3f) dts(%.3f)", mvcpkt->iSize, mvcpkt->pts*1e-6, mvcpkt->dts*1e-6); -+#endif -+ CDVDDemuxUtils::FreeDemuxPacket(mvcpkt); -+ m_MVCqueue.pop(); -+ } -+ else -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC discard h264: %6d, pts(%.3f) dts(%.3f)", h264pkt->iSize, h264pkt->pts*1e-6, h264pkt->dts*1e-6); -+#endif -+ CDVDDemuxUtils::FreeDemuxPacket(h264pkt); -+ m_H264queue.pop(); -+ } -+ } -+ -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC waiting. MVC(%d) H264(%d)", m_MVCqueue.size(), m_H264queue.size()); -+#endif -+ -+ return CDVDDemuxUtils::AllocateDemuxPacket(0); -+} -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -new file mode 100644 -index 0000000000000000000000000000000000000000..1dafdc58db3f9cb5eac032c591942439117e13c4 ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -@@ -0,0 +1,49 @@ -+#pragma once -+ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DVDDemuxPacket.h" -+#include -+ -+extern "C" { -+#include "libavformat/avformat.h" -+} -+ -+class CDemuxStreamSSIF -+{ -+public: -+ CDemuxStreamSSIF() {}; -+ ~CDemuxStreamSSIF() { Flush(); } -+ -+ DemuxPacket* AddPacket(DemuxPacket* &scrPkt); -+ void Flush(); -+ void SetH264StreamId(int id) { m_h264StreamId = id; }; -+ void SetMVCStreamId(int id) { m_mvcStreamId = id; }; -+ -+private: -+ DemuxPacket* GetMVCPacket(); -+ DemuxPacket* MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt); -+ -+ std::queue m_H264queue; -+ std::queue m_MVCqueue; -+ int m_h264StreamId = 0; -+ int m_mvcStreamId = 0; -+}; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -index e4f8aed0af96fe0dceec4d8517087742f2c7df81..30076937bd084936571abf0e6eeecf5ad916c7b3 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -@@ -10,6 +10,7 @@ SRCS += DVDDemuxUtils.cpp - SRCS += DVDDemuxVobsub.cpp - SRCS += DVDDemuxCC.cpp - SRCS += DVDFactoryDemuxer.cpp -+SRCS += DemuxStreamSSIF.cpp - - LIB = DVDDemuxers.a - -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 974305ff329eb6999c908d5e05d723f93137ae33..985ecf9722141d78471c00e90da15bfad931462a 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -391,7 +391,7 @@ void CAdvancedSettings::Initialize() - - m_pictureExtensions = ".png|.jpg|.jpeg|.bmp|.gif|.ico|.tif|.tiff|.tga|.pcx|.cbz|.zip|.cbr|.rar|.rss|.webp|.jp2|.apng"; - m_musicExtensions = ".nsv|.m4a|.flac|.aac|.strm|.pls|.rm|.rma|.mpa|.wav|.wma|.ogg|.mp3|.mp2|.m3u|.gdm|.imf|.m15|.sfx|.uni|.ac3|.dts|.cue|.aif|.aiff|.wpl|.ape|.mac|.mpc|.mp+|.mpp|.shn|.zip|.rar|.wv|.dsp|.xsp|.xwav|.waa|.wvs|.wam|.gcm|.idsp|.mpdsp|.mss|.spt|.rsd|.sap|.cmc|.cmr|.dmc|.mpt|.mpd|.rmt|.tmc|.tm8|.tm2|.oga|.url|.pxml|.tta|.rss|.wtv|.mka|.tak|.opus|.dff|.dsf"; -- m_videoExtensions = ".m4v|.3g2|.3gp|.nsv|.tp|.ts|.ty|.strm|.pls|.rm|.rmvb|.mpd|.m3u|.m3u8|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.mk3d|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp|.mts|.m2t|.m2ts|.evo|.ogv|.sdp|.avs|.rec|.url|.pxml|.vc1|.h264|.rcv|.rss|.mpls|.webm|.bdmv|.wtv"; -+ m_videoExtensions = ".m4v|.3g2|.3gp|.nsv|.tp|.ts|.ty|.strm|.pls|.rm|.rmvb|.mpd|.m3u|.m3u8|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.mk3d|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp|.mts|.m2t|.m2ts|.evo|.ogv|.sdp|.avs|.rec|.url|.pxml|.vc1|.h264|.rcv|.rss|.mpls|.webm|.bdmv|.wtv|.ssif"; - m_subtitlesExtensions = ".utf|.utf8|.utf-8|.sub|.srt|.smi|.rt|.txt|.ssa|.text|.ssa|.aqt|.jss|.ass|.idx|.ifo|.rar|.zip"; - m_discStubExtensions = ".disc"; - // internal music extensions - -From d5804f4eeee51ca51afea69ff07b5afcd17ed8d9 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Tue, 23 Feb 2016 16:02:46 +0300 -Subject: [PATCH 41/62] [3DBD] Added support of 3D-BluRay playback. - ---- - lib/DllLibbluray.h | 8 + - xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt | 2 + - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 51 +++- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp | 266 +++++++++++++++++++++ - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h | 57 +++++ - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 40 +++- - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h | 12 +- - xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in | 1 + - .../DVDInputStreams/DVDInputStreamBluray.cpp | 159 ++++++++++-- - .../DVDInputStreams/DVDInputStreamBluray.h | 20 ++ - 10 files changed, 581 insertions(+), 35 deletions(-) - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h - -diff --git a/lib/DllLibbluray.h b/lib/DllLibbluray.h -index f5a337fe19beff472557c97ff7a203ad30a912b2..03f93391265e164837c2a17a8fe6d7da41c2f13e 100644 ---- a/lib/DllLibbluray.h -+++ b/lib/DllLibbluray.h -@@ -31,6 +31,8 @@ extern "C" - #include - #include - #include -+#include -+#include - } - - class DllLibblurayInterface -@@ -80,6 +82,8 @@ public: - #endif - virtual int bd_menu_call (BLURAY *bd, int64_t pts)=0; - virtual int bd_mouse_select (BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)=0; -+ virtual MPLS_PL* bd_get_title_mpls (BLURAY *bd) = 0; -+ virtual int bd_get_clip_infos (BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration) = 0; - }; - - class DllLibbluray : public DllDynamic, DllLibblurayInterface -@@ -128,6 +132,8 @@ class DllLibbluray : public DllDynamic, DllLibblurayInterface - #endif - DEFINE_METHOD2(int, bd_menu_call, (BLURAY *p1, int64_t p2)) - DEFINE_METHOD4(int, bd_mouse_select, (BLURAY *p1, int64_t p2, uint16_t p3, uint16_t p4)) -+ DEFINE_METHOD1(MPLS_PL*, bd_get_title_mpls, (BLURAY *p1)) -+ DEFINE_METHOD6(int, bd_get_clip_infos, (BLURAY *p1, unsigned p2, uint64_t *p3, uint64_t *p4, uint64_t *p5, uint64_t *p6)) - - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(bd_get_titles) -@@ -172,6 +178,8 @@ class DllLibbluray : public DllDynamic, DllLibblurayInterface - #endif - RESOLVE_METHOD(bd_menu_call) - RESOLVE_METHOD(bd_mouse_select) -+ RESOLVE_METHOD(bd_get_title_mpls) -+ RESOLVE_METHOD(bd_get_clip_infos) - END_METHOD_RESOLVE() - - public: -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -index 156ec2021002d9d7a355db2f0dcf099aabb1db48..87d27b666f703743bb0170252cf1190da5bce261 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -@@ -6,6 +6,7 @@ set(SOURCES DemuxMultiSource.cpp - DVDDemuxClient.cpp - DVDDemuxFFmpeg.cpp - DemuxStreamSSIF.cpp -+ DemuxMVC.cpp - DVDDemuxUtils.cpp - DVDDemuxVobsub.cpp - DVDFactoryDemuxer.cpp) -@@ -18,6 +19,7 @@ set(HEADERS DemuxMultiSource.h - DVDDemuxClient.h - DVDDemuxFFmpeg.h - DemuxStreamSSIF.h -+ DemuxMVC.h - DVDDemuxPacket.h - DVDDemuxUtils.h - DVDDemuxVobsub.h -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 6df586ac1f2d00e55307358228a4be89278ce67e..b7e5081bc0fc32eaaae42d894a288e7971139356 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -27,6 +27,7 @@ - #include "cores/FFmpeg.h" - #include "DVDCodecs/DVDCodecUtils.h" - #include "DVDClock.h" // for DVD_TIME_BASE -+#include "DemuxMVC.h" - #include "DVDDemuxUtils.h" - #include "DVDInputStreams/DVDInputStream.h" - #include "DVDInputStreams/DVDInputStreamFFmpeg.h" -@@ -503,6 +504,16 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein - - UpdateCurrentPTS(); - -+ if (!fileinfo && m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ { -+ CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -+ if (bluRay->HasMVC()) -+ { -+ SAFE_DELETE(m_pSSIF); -+ m_pSSIF = new CDemuxStreamSSIF(); -+ m_pSSIF->SetBluRay(bluRay); -+ } -+ } - // in case of mpegts and we have not seen pat/pmt, defer creation of streams - if (!skipCreateStreams || m_pFormatContext->nb_programs > 0) - { -@@ -884,9 +895,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - { - Flush(); - } -- // libavformat is confused by the interleaved SSIF. -- // Disable program management for those -- else if (!m_pSSIF && IsProgramChange()) -+ else if (IsProgramChange()) - { - // update streams - CreateStreams(m_program); -@@ -927,8 +936,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - if (IsVideoReady()) - { - // libavformat is confused by the interleaved SSIF. -- // Disable program management for those -- if (!m_pSSIF && m_program != UINT_MAX ) -+ if ((!m_pSSIF || m_pSSIF->IsBluRay()) && m_program != UINT_MAX) - { - /* check so packet belongs to selected program */ - for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++) -@@ -1079,10 +1087,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - } - if (stream && m_pSSIF) - { -- if (stream->type == STREAM_VIDEO || -- stream->type == STREAM_DATA) -- pPacket = m_pSSIF->AddPacket(pPacket); -- -+ pPacket = m_pSSIF->AddPacket(pPacket); - if (stream->type == STREAM_DATA && stream->codec == AV_CODEC_ID_H264_MVC && pPacket->iSize) - stream = GetStream(pPacket->iStreamId); - } -@@ -1481,6 +1486,29 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - { - m_pSSIF->SetH264StreamId(streamIdx); - pStream->codec->codec_tag = MKTAG('A', 'M', 'V', 'C'); -+ -+ AVStream* mvcStream = nullptr; -+ if (m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ { -+ CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -+ if (bluRay->HasMVC()) -+ { -+ st->stereo_mode = bluRay->AreEyesFlipped() ? "block_rl" : "block_lr"; -+ mvcStream = static_cast(bluRay->GetDemuxMVC())->GetAVStream(); -+ } -+ } -+ else -+ mvcStream = m_pFormatContext->streams[m_pSSIF->GetMVCStreamId()]; -+ -+ if (mvcStream && pStream->codec->extradata_size > 0 && mvcStream->codec->extradata_size > 0) -+ { -+ uint8_t* extr = pStream->codec->extradata; -+ pStream->codec->extradata = (uint8_t*)av_mallocz(pStream->codec->extradata_size + mvcStream->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); -+ memcpy(pStream->codec->extradata, extr, pStream->codec->extradata_size); -+ memcpy(pStream->codec->extradata + pStream->codec->extradata_size, mvcStream->codec->extradata, mvcStream->codec->extradata_size); -+ pStream->codec->extradata_size += mvcStream->codec->extradata_size; -+ av_free(extr); -+ } - } - } - else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size)) -@@ -1804,6 +1832,11 @@ std::string CDVDDemuxFFmpeg::GetStreamCodecName(int iStreamId) - - bool CDVDDemuxFFmpeg::IsProgramChange() - { -+ // libavformat is confused by the interleaved SSIF. -+ // disable program management for those -+ if (m_pSSIF && !m_pSSIF->IsBluRay()) -+ return false; -+ - if (m_program == UINT_MAX) - return false; - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..ade6a4454fc3915b0c787b1a4f72aedbd74903db ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -@@ -0,0 +1,266 @@ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DemuxMVC.h" -+#include "DVDDemuxUtils.h" -+#include "DVDInputStreams/DVDInputStream.h" -+#include "DVDClock.h" -+#include "cores/FFmpeg.h" -+#include "utils/log.h" -+ -+extern "C" { -+#include "libavutil/opt.h" -+}; -+ -+#define MVC_SEEK_TIME_WINDOW 75000 // experimental value depends on seeking accurate -+ -+static int mvc_file_read(void *h, uint8_t* buf, int size) -+{ -+ CDVDInputStream* pInputStream = static_cast(h)->m_pInput; -+ return pInputStream->Read(buf, size); -+} -+ -+static int64_t mvc_file_seek(void *h, int64_t pos, int whence) -+{ -+ CDVDInputStream* pInputStream = static_cast(h)->m_pInput; -+ if (whence == AVSEEK_SIZE) -+ return pInputStream->GetLength(); -+ else -+ return pInputStream->Seek(pos, whence & ~AVSEEK_FORCE); -+} -+ -+CDemuxMVC::CDemuxMVC() -+{ -+ m_ioContext = nullptr; -+ m_pFormatContext = nullptr; -+ m_pInput = nullptr; -+ m_nStreamIndex = -1; -+} -+ -+CDemuxMVC::~CDemuxMVC() -+{ -+ Dispose(); -+} -+ -+bool CDemuxMVC::Open(CDVDInputStream* pInput) -+{ -+ int ret; -+ -+ if (!pInput) -+ return false; -+ m_pInput = pInput; -+ -+ unsigned char* buffer = (unsigned char*)av_malloc(FFMPEG_FILE_BUFFER_SIZE); -+ m_ioContext = avio_alloc_context(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, this, mvc_file_read, NULL, mvc_file_seek); -+ m_ioContext->max_packet_size = m_pInput->GetBlockSize(); -+ if (m_ioContext->max_packet_size) -+ m_ioContext->max_packet_size *= FFMPEG_FILE_BUFFER_SIZE / m_ioContext->max_packet_size; -+ -+ m_pFormatContext = avformat_alloc_context(); -+ m_pFormatContext->pb = m_ioContext; -+ -+ AVInputFormat *format = av_find_input_format("mpegts"); -+ ret = avformat_open_input(&m_pFormatContext, m_pInput->GetFileName().c_str(), format, nullptr); -+ if (ret < 0) -+ { -+ CLog::Log(LOGDEBUG, "%s: Opening MVC demuxing context failed (%d)", __FUNCTION__, ret); -+ Dispose(); -+ return false; -+ } -+ -+ av_opt_set_int(m_pFormatContext, "analyzeduration", 500000, 0); -+ av_opt_set_int(m_pFormatContext, "correct_ts_overflow", 0, 0); -+ m_pFormatContext->flags |= AVFMT_FLAG_KEEP_SIDE_DATA; -+ -+ // Find the streams -+ ret = avformat_find_stream_info(m_pFormatContext, nullptr); -+ //it always returns -1 so just ignore it -+ //if (ret < 0) -+ //{ -+ // CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::OpenMVCDemuxer(): avformat_find_stream_info failed (%d)", ret); -+ // Dispose(); -+ // return false; -+ //} -+ -+ // print some extra information -+ av_dump_format(m_pFormatContext, 0, m_pInput->GetFileName().c_str(), 0); -+ -+ // Find and select our MVC stream -+ CLog::Log(LOGDEBUG, "%s: MVC m2ts has %d streams", __FUNCTION__, m_pFormatContext->nb_streams); -+ for (unsigned i = 0; i < m_pFormatContext->nb_streams; i++) -+ { -+ if (m_pFormatContext->streams[i]->codec->codec_id == AV_CODEC_ID_H264_MVC -+ && m_pFormatContext->streams[i]->codec->extradata_size > 0) -+ { -+ m_nStreamIndex = i; -+ break; -+ } -+ else -+ m_pFormatContext->streams[i]->discard = AVDISCARD_ALL; -+ } -+ -+ if (m_nStreamIndex < 0) -+ { -+ CLog::Log(LOGDEBUG, "%s: MVC Stream not found", __FUNCTION__); -+ Dispose(); -+ return false; -+ } -+ -+ return true; -+} -+ -+void CDemuxMVC::Reset() -+{ -+ CDVDInputStream* pInput = m_pInput; -+ Dispose(); -+ Open(pInput); -+} -+ -+void CDemuxMVC::Abort() -+{ -+} -+ -+void CDemuxMVC::Flush() -+{ -+ if (m_pFormatContext) -+ { -+ if (m_pFormatContext->pb) -+ avio_flush(m_pFormatContext->pb); -+ avformat_flush(m_pFormatContext); -+ } -+} -+ -+DemuxPacket* CDemuxMVC::Read() -+{ -+ int ret; -+ AVPacket mvcPacket = { 0 }; -+ av_init_packet(&mvcPacket); -+ -+ while (true) -+ { -+ ret = av_read_frame(m_pFormatContext, &mvcPacket); -+ -+ if (ret == AVERROR(EINTR) || ret == AVERROR(EAGAIN)) -+ continue; -+ else if (ret == AVERROR_EOF) -+ break; -+ else if (mvcPacket.size <= 0 || mvcPacket.stream_index != m_nStreamIndex) -+ { -+ av_packet_unref(&mvcPacket); -+ continue; -+ } -+ else -+ { -+ AVStream *stream = m_pFormatContext->streams[mvcPacket.stream_index]; -+ double dts = ConvertTimestamp(mvcPacket.dts, stream->time_base.den, stream->time_base.num); -+ double pts = ConvertTimestamp(mvcPacket.pts, stream->time_base.den, stream->time_base.num); -+ -+ DemuxPacket* newPkt = CDVDDemuxUtils::AllocateDemuxPacket(mvcPacket.size); -+ if (mvcPacket.data) -+ memcpy(newPkt->pData, mvcPacket.data, mvcPacket.size); -+ newPkt->iSize = mvcPacket.size; -+ newPkt->dts = dts; -+ newPkt->pts = pts; -+ newPkt->iStreamId = stream->id; -+ -+ av_packet_unref(&mvcPacket); -+ return newPkt; -+ } -+ } -+ -+ return nullptr; -+} -+ -+bool CDemuxMVC::SeekTime(int time, bool backwords, double* startpts) -+{ -+ if (!m_pInput) -+ return false; -+ -+ AVRational time_base = m_pFormatContext->streams[m_nStreamIndex]->time_base; -+ int64_t seek_pts = av_rescale(DVD_MSEC_TO_TIME(time), time_base.den, (int64_t)time_base.num * AV_TIME_BASE); -+ int64_t starttime = 0; -+ -+ if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE) -+ starttime = av_rescale(m_pFormatContext->start_time, time_base.den, (int64_t)time_base.num * AV_TIME_BASE); -+ if (starttime != 0) -+ seek_pts += starttime; -+ if (seek_pts < MVC_SEEK_TIME_WINDOW) -+ seek_pts = 0; -+ else -+ seek_pts -= MVC_SEEK_TIME_WINDOW; -+ -+ av_seek_frame(m_pFormatContext, m_nStreamIndex, seek_pts, AVSEEK_FLAG_BACKWARD); -+ return true; -+} -+ -+std::string CDemuxMVC::GetFileName() -+{ -+ return m_pInput->GetFileName(); -+} -+ -+AVStream* CDemuxMVC::GetAVStream() -+{ -+ return m_pFormatContext ? m_pFormatContext->streams[m_nStreamIndex] : nullptr; -+} -+ -+void CDemuxMVC::Dispose() -+{ -+ if (m_pFormatContext) -+ avformat_close_input(&m_pFormatContext); -+ -+ if (m_ioContext) -+ { -+ av_free(m_ioContext->buffer); -+ av_free(m_ioContext); -+ } -+ -+ m_ioContext = nullptr; -+ m_pFormatContext = nullptr; -+ m_pInput = nullptr; -+ m_nStreamIndex = -1; -+} -+ -+double CDemuxMVC::ConvertTimestamp(int64_t pts, int den, int num) -+{ -+ if (pts == (int64_t)AV_NOPTS_VALUE) -+ return DVD_NOPTS_VALUE; -+ -+ // do calculations in floats as they can easily overflow otherwise -+ // we don't care for having a completly exact timestamp anyway -+ double timestamp = (double)pts * num / den; -+ double starttime = 0.0f; -+ -+ /*if (m_MVCFormatContext->start_time != (int64_t)AV_NOPTS_VALUE) -+ starttime = (double)m_MVCFormatContext->start_time / AV_TIME_BASE;*/ -+ -+ if (timestamp > starttime) -+ timestamp -= starttime; -+ // allow for largest possible difference in pts and dts for a single packet -+ else if (timestamp + 0.5f > starttime) -+ timestamp = 0; -+ -+ return timestamp * DVD_TIME_BASE; -+} -+ -+std::vector CDemuxMVC::GetStreams() const -+{ -+ std::vector streams; -+ return streams; -+} -\ No newline at end of file -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -new file mode 100644 -index 0000000000000000000000000000000000000000..bbb836a61344689a83af68c821c05c212a86b097 ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -@@ -0,0 +1,57 @@ -+#pragma once -+ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DVDDemux.h" -+ -+extern "C" { -+#include "libavformat/avformat.h" -+} -+ -+class CDemuxMVC : public CDVDDemux -+{ -+public: -+ CDemuxMVC(); -+ virtual ~CDemuxMVC(); -+ bool Open(CDVDInputStream* pInput); -+ virtual void Reset(); -+ virtual void Abort(); -+ virtual void Flush(); -+ virtual DemuxPacket* Read(); -+ virtual bool SeekTime(int time, bool backwords = false, double* startpts = nullptr); -+ virtual void SetSpeed(int iSpeed) { }; -+ virtual int GetStreamLength() { return 0; }; -+ virtual CDemuxStream* GetStream(int iStreamId) const override { return nullptr; }; -+ virtual std::vector GetStreams() const override; -+ virtual int GetNrOfStreams() const override { return 1; }; -+ virtual std::string GetFileName(); -+ -+ AVStream* GetAVStream(); -+ CDVDInputStream* m_pInput; -+ -+private: -+ void Dispose(); -+ double ConvertTimestamp(int64_t pts, int den, int num); -+ -+ AVIOContext *m_ioContext = nullptr; -+ AVFormatContext *m_pFormatContext = nullptr; -+ int m_nStreamIndex = -1; -+}; -\ No newline at end of file -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -index f75532016a1395782b59dc124676835c7254de56..2c7e66f7ee5683a0fbcde5ad5c65ebfd6853f3d0 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -19,11 +19,13 @@ - */ - - #include "DemuxStreamSSIF.h" -+#include "DVDDemux.h" - #include "DVDClock.h" - #include "DVDDemuxUtils.h" - #include "utils/log.h" - - //#define DEBUG_VERBOSE -+#define MVC_QUEUE_SIZE 100 - - DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) - { -@@ -37,7 +39,7 @@ DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) - } - else if (srcPkt->iStreamId == m_mvcStreamId) - { -- m_MVCqueue.push(srcPkt); -+ AddMVCExtPacket(srcPkt); - } - - return GetMVCPacket(); -@@ -81,6 +83,10 @@ DemuxPacket* CDemuxStreamSSIF::MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &a - - DemuxPacket* CDemuxStreamSSIF::GetMVCPacket() - { -+ // if input is a bluray fill mvc queue before processing -+ if (m_bluRay && m_MVCqueue.empty() && !m_H264queue.empty()) -+ FillMVCQueue(m_H264queue.front()->dts); -+ - // Here, we recreate a h264 MVC packet from the base one + buffered MVC NALU's - while (!m_H264queue.empty() && !m_MVCqueue.empty()) - { -@@ -151,6 +157,36 @@ DemuxPacket* CDemuxStreamSSIF::GetMVCPacket() - #if defined(DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, ">>> MVC waiting. MVC(%d) H264(%d)", m_MVCqueue.size(), m_H264queue.size()); - #endif -- - return CDVDDemuxUtils::AllocateDemuxPacket(0); - } -+ -+void CDemuxStreamSSIF::AddMVCExtPacket(DemuxPacket* &mvcExtPkt) -+{ -+ m_MVCqueue.push(mvcExtPkt); -+} -+ -+bool CDemuxStreamSSIF::FillMVCQueue(double dtsBase) -+{ -+ if (!m_bluRay) -+ return false; -+ -+ CDVDDemux* demux = m_bluRay->GetDemuxMVC(); -+ DemuxPacket* mvc; -+ while ((m_MVCqueue.size() < MVC_QUEUE_SIZE) && (mvc = demux->Read())) -+ { -+ if (dtsBase == DVD_NOPTS_VALUE || mvc->dts == DVD_NOPTS_VALUE) -+ { -+ // do nothing, can't compare timestamps when they are not set -+ } -+ else if (mvc->dts < dtsBase) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d, pts(%.3f) dts(%.3f)", mvc->iSize, mvc->pts*1e-6, mvc->dts*1e-6); -+#endif -+ CDVDDemuxUtils::FreeDemuxPacket(mvc); -+ continue; -+ } -+ AddMVCExtPacket(mvc); -+ }; -+ return m_MVCqueue.size() == MVC_QUEUE_SIZE; -+} -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -index 1dafdc58db3f9cb5eac032c591942439117e13c4..508e9debd3e6679a1433842a65649fa68ead76ec 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -@@ -21,6 +21,7 @@ - */ - - #include "DVDDemuxPacket.h" -+#include "DVDInputStreams/DVDInputStreamBluray.h" - #include - - extern "C" { -@@ -37,13 +38,20 @@ public: - void Flush(); - void SetH264StreamId(int id) { m_h264StreamId = id; }; - void SetMVCStreamId(int id) { m_mvcStreamId = id; }; -+ int GetH264StreamId() { return m_h264StreamId; }; -+ int GetMVCStreamId() { return m_mvcStreamId; }; -+ void AddMVCExtPacket(DemuxPacket* &scrPkt); -+ void SetBluRay(CDVDInputStreamBluray* &bluRay) { m_bluRay = bluRay; }; -+ bool IsBluRay() { return m_bluRay != nullptr; }; - - private: - DemuxPacket* GetMVCPacket(); - DemuxPacket* MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt); -+ bool FillMVCQueue(double dtsBase); - -+ CDVDInputStreamBluray* m_bluRay = nullptr; - std::queue m_H264queue; - std::queue m_MVCqueue; -- int m_h264StreamId = 0; -- int m_mvcStreamId = 0; -+ int m_h264StreamId = -1; -+ int m_mvcStreamId = -1; - }; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -index 30076937bd084936571abf0e6eeecf5ad916c7b3..0359426b85683a4c3a80ef0e0d52f7a79564daaa 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -@@ -11,6 +11,7 @@ SRCS += DVDDemuxVobsub.cpp - SRCS += DVDDemuxCC.cpp - SRCS += DVDFactoryDemuxer.cpp - SRCS += DemuxStreamSSIF.cpp -+SRCS += DVDDemuxMVC.cpp - - LIB = DVDDemuxers.a - -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index 6ccd9a8c00fdc5175df3ecbb3a5d30dc93e319ab..ad2c65ba5b80c5ac5d055d621a1e8319e3f770c0 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -26,6 +26,8 @@ - #include "IVideoPlayer.h" - #include "DVDCodecs/Overlay/DVDOverlay.h" - #include "DVDCodecs/Overlay/DVDOverlayImage.h" -+#include "DVDInputStreamFile.h" -+#include "DVDDemuxers/DemuxMVC.h" - #include "settings/Settings.h" - #include "LangInfo.h" - #include "utils/log.h" -@@ -231,10 +233,8 @@ bool CDVDInputStreamBluray::IsEOF() - - BLURAY_TITLE_INFO* CDVDInputStreamBluray::GetTitleLongest() - { -- int titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0); -- - BLURAY_TITLE_INFO *s = NULL; -- for(int i=0; i < titles; i++) -+ for(int i=0; i < m_nTitles; i++) - { - BLURAY_TITLE_INFO *t = m_dll->bd_get_title_info(m_bd, i, 0); - if(!t) -@@ -326,6 +326,7 @@ bool CDVDInputStreamBluray::Open() - return false; - } - -+ m_root = root; - const BLURAY_DISC_INFO *disc_info; - - disc_info = m_dll->bd_get_disc_info(m_bd); -@@ -349,6 +350,7 @@ bool CDVDInputStreamBluray::Open() - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - BD+ detected : %d", disc_info->bdplus_detected); - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - libbdplus detected : %d", disc_info->libbdplus_detected); - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - BD+ handled : %d", disc_info->bdplus_handled); -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - 3D content exist : %d", disc_info->content_exist_3D); - } - else - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - BluRay not detected"); -@@ -365,6 +367,7 @@ bool CDVDInputStreamBluray::Open() - return false; - } - -+ m_nTitles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0); - int mode = CSettings::GetInstance().GetInt(CSettings::SETTING_DISC_PLAYBACK); - - if (URIUtils::HasExtension(filename, ".mpls")) -@@ -393,18 +396,17 @@ bool CDVDInputStreamBluray::Open() - m_title = GetTitleLongest(); - } - -- if(m_navmode) -+ SetupPlayerSettings(); -+ m_dll->bd_get_event(m_bd, NULL); -+ -+ if (m_navmode) - { -- SetupPlayerSettings(); - - m_dll->bd_register_overlay_proc (m_bd, this, bluray_overlay_cb); - #ifdef HAVE_LIBBLURAY_BDJ - m_dll->bd_register_argb_overlay_proc (m_bd, this, bluray_overlay_argb_cb, NULL); - #endif - -- m_dll->bd_get_event(m_bd, NULL); -- -- - if(m_dll->bd_play(m_bd) <= 0) - { - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed play disk %s", strPath.c_str()); -@@ -419,21 +421,25 @@ bool CDVDInputStreamBluray::Open() - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to get title info"); - return false; - } -- -- if(m_dll->bd_select_playlist(m_bd, m_title->playlist) == 0 ) -+ if (m_dll->bd_select_playlist(m_bd, m_title->playlist) == 0) - { - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to select title %d", m_title->idx); - return false; - } -- m_clip = 0; - } - -+ // Process any events that occured during opening -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ - return true; - } - - // close file and reset everyting - void CDVDInputStreamBluray::Close() - { -+ CloseMVCDemux(); -+ - if (!m_dll) - return; - if(m_title) -@@ -449,7 +455,7 @@ void CDVDInputStreamBluray::Close() - - void CDVDInputStreamBluray::ProcessEvent() { - -- int pid = -1; -+ int pid = -1, ret; - switch (m_event.event) { - - case BD_EVENT_ERROR: -@@ -514,15 +520,17 @@ void CDVDInputStreamBluray::ProcessEvent() { - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - BD_EVENT_PLAYLIST %d", - m_event.param); - m_playlist = m_event.param; -- if(m_title) -- m_dll->bd_free_title_info(m_title); -- m_title = m_dll->bd_get_playlist_info(m_bd, m_playlist, m_angle); -+ ProcessItem(m_playlist); - break; - - case BD_EVENT_PLAYITEM: - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - BD_EVENT_PLAYITEM %d", - m_event.param); - m_clip = m_event.param; -+ uint64_t clip_start, clip_in, bytepos; -+ ret = m_dll->bd_get_clip_infos(m_bd, m_clip, &clip_start, &clip_in, &bytepos, nullptr); -+ if (ret) -+ m_clipStartTime = clip_start / 90; - break; - - case BD_EVENT_CHAPTER: -@@ -601,14 +609,20 @@ void CDVDInputStreamBluray::ProcessEvent() { - - /* event has been consumed */ - m_event.event = BD_EVENT_NONE; -+ -+ if (m_bMVCPlayback && m_clip >= 0 && m_title && m_clip < m_title->clip_count && m_nMVCClip != m_clip) -+ { -+ CloseMVCDemux(); -+ OpenMVCDemux(m_clip); -+ } - } - - int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size) - { -+ int result = 0; - m_dispTimeBeforeRead = (int)(m_dll->bd_tell_time(m_bd) / 90); - if(m_navmode) - { -- int result = 0; - do { - - if(m_hold == HOLD_HELD) -@@ -658,10 +672,14 @@ int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size) - - } while(result == 0); - -- return result; - } - else -- return m_dll->bd_read(m_bd, buf, buf_size); -+ { -+ result = m_dll->bd_read(m_bd, buf, buf_size); -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ } -+ return result; - } - - static uint8_t clamp(double v) -@@ -909,8 +927,12 @@ bool CDVDInputStreamBluray::PosTime(int ms) - { - if(m_dll->bd_seek_time(m_bd, ms * 90) < 0) - return false; -- else -- return true; -+ -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ -+ SeekMVCDemux(ms - m_clipStartTime); -+ return true; - } - - int CDVDInputStreamBluray::GetChapterCount() -@@ -933,8 +955,12 @@ bool CDVDInputStreamBluray::SeekChapter(int ch) - { - if(m_title && m_dll->bd_seek_chapter(m_bd, ch-1) < 0) - return false; -- else -- return true; -+ -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ -+ SeekMVCDemux(GetChapterPos(ch) * 1000 - m_clipStartTime); -+ return true; - } - - int64_t CDVDInputStreamBluray::GetChapterPos(int ch) -@@ -1132,6 +1158,95 @@ bool CDVDInputStreamBluray::HasMenu() - return m_navmode; - } - -+bool CDVDInputStreamBluray::ProcessItem(int playitem) -+{ -+ if (m_title) -+ m_dll->bd_free_title_info(m_title); -+ -+ m_title = m_dll->bd_get_playlist_info(m_bd, playitem, m_angle); -+ -+ if (CSettings::GetInstance().GetBool("videoplayer.supportmvc")) -+ { -+ MPLS_PL * mpls = m_dll->bd_get_title_mpls(m_bd); -+ if (mpls) -+ { -+ for (int i = 0; i < mpls->ext_sub_count; i++) -+ { -+ if (mpls->ext_sub_path[i].type == 8 -+ && mpls->ext_sub_path[i].sub_playitem_count == mpls->list_count) -+ { -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - Enabling BD3D MVC demuxing"); -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - MVC_Base_view_R_flag: %d", m_title->mvc_base_view_r_flag); -+ m_bMVCPlayback = true; -+ m_nMVCSubPathIndex = i; -+ m_bFlipEyes = m_title->mvc_base_view_r_flag != 0; -+ break; -+ } -+ } -+ } -+ } -+ CloseMVCDemux(); -+ return true; -+} -+ -+bool CDVDInputStreamBluray::OpenMVCDemux(int playItem) -+{ -+ MPLS_PL *pl = m_dll->bd_get_title_mpls(m_bd); -+ if (!pl) -+ return false; -+ -+ std::string strFileName; -+ strFileName.append(m_root); -+ strFileName.append("/BDMV/STREAM/"); -+ strFileName.append(pl->ext_sub_path[m_nMVCSubPathIndex].sub_play_item[playItem].clip->clip_id); -+ strFileName.append(".m2ts"); -+ -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::OpenMVCDemuxer(): Opening MVC extension stream at %s", strFileName.c_str()); -+ -+ CFileItem fileitem(CURL(strFileName), false); -+ m_pMVCInput = new CDVDInputStreamFile(fileitem); -+ -+ // Try to open the MVC stream -+ if (!m_pMVCInput->Open()) -+ { -+ CloseMVCDemux(); -+ m_bMVCPlayback = false; -+ return false; -+ } -+ -+ if (m_pMVCDemux) -+ SAFE_DELETE(m_pMVCDemux); -+ -+ CDemuxMVC* pMVCDemux = new CDemuxMVC; -+ m_pMVCDemux = pMVCDemux; -+ -+ if (!pMVCDemux->Open(m_pMVCInput)) -+ { -+ CloseMVCDemux(); -+ m_bMVCPlayback = false; -+ return false; -+ } -+ -+ m_nMVCClip = playItem; -+ return true; -+} -+ -+bool CDVDInputStreamBluray::CloseMVCDemux() -+{ -+ if (m_pMVCDemux) -+ SAFE_DELETE(m_pMVCDemux); -+ -+ SAFE_DELETE(m_pMVCInput); -+ m_nMVCClip = -1; -+ return true; -+} -+ -+void CDVDInputStreamBluray::SeekMVCDemux(int64_t time) -+{ -+ if (m_bMVCPlayback && m_pMVCDemux) -+ m_pMVCDemux->SeekTime(time); -+} -+ - void CDVDInputStreamBluray::SetupPlayerSettings() - { - int region = CSettings::GetInstance().GetInt(CSettings::SETTING_BLURAY_PLAYERREGION); -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -index b967a85e6557e42a7f1235cdd804d5a0263b866f..561fb5cd4f971bc9ee4f41218a60bb3d5bc5625f 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -38,6 +38,7 @@ extern "C" - class CDVDOverlayImage; - class DllLibbluray; - class IVideoPlayer; -+class CDVDDemux; - - class CDVDInputStreamBluray - : public CDVDInputStream -@@ -119,6 +120,9 @@ public: - BLURAY_TITLE_INFO* GetTitleFile(const std::string& name); - - void ProcessEvent(); -+ CDVDDemux* GetDemuxMVC() { return m_pMVCDemux; }; -+ bool HasMVC() { return m_bMVCPlayback; } -+ bool AreEyesFlipped() { return m_bFlipEyes; } - - protected: - struct SPlane; -@@ -127,6 +131,11 @@ protected: - void OverlayClose(); - static void OverlayClear(SPlane& plane, int x, int y, int w, int h); - static void OverlayInit (SPlane& plane, int w, int h); -+ bool ProcessItem(int playitem); -+ -+ bool OpenMVCDemux(int playItem); -+ bool CloseMVCDemux(); -+ void SeekMVCDemux(int64_t time); - - IVideoPlayer* m_player; - DllLibbluray* m_dll; -@@ -138,6 +147,17 @@ protected: - bool m_menu; - bool m_navmode; - int m_dispTimeBeforeRead; -+ int m_nTitles = -1; -+ std::string m_root; -+ -+ // MVC related members -+ CDVDDemux* m_pMVCDemux = nullptr; -+ CDVDInputStream *m_pMVCInput = nullptr; -+ bool m_bMVCPlayback = false; -+ int m_nMVCSubPathIndex = 0; -+ int m_nMVCClip = -1; -+ bool m_bFlipEyes = false; -+ uint64_t m_clipStartTime = 0; - - typedef std::shared_ptr SOverlay; - typedef std::list SOverlays; - -From ba23ff0a3563eb2bf120bf5b7b068120112448a8 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 11 Mar 2016 16:58:53 +0300 -Subject: [PATCH 42/62] [VideoPlayer] HasVideo returns true if video stream - exists. This don't allow start visualization if audio is opened before video. - ---- - xbmc/cores/VideoPlayer/VideoPlayer.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -index dded334532841911a34d75808c3c350709d881f7..b9b0d866fe112d291a8d80a8269c3f572d254447 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -@@ -3115,7 +3115,7 @@ void CVideoPlayer::Pause() - - bool CVideoPlayer::HasVideo() const - { -- return m_HasVideo; -+ return m_HasVideo || GetVideoStream() >= 0; - } - - bool CVideoPlayer::HasAudio() const - -From 6faee73797c05d2c8140c6c11c7eace3231ea20e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 10 Mar 2016 18:11:33 +0300 -Subject: [PATCH 43/62] fixup! Revert supporting crappy tab/sbs subtitles. this - fixes regular subtitles. - ---- - .../cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -index 3a080d06c90b0762482816928642e6de7810b539..a8323f419e404037c4e5fb4d78fa1b45409337a7 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -@@ -243,20 +243,20 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay() - } - } - -- RENDER_STEREO_MODE render_stereo_mode = g_graphicsContext.GetStereoMode(); -+ /*RENDER_STEREO_MODE render_stereo_mode = g_graphicsContext.GetStereoMode(); - if (render_stereo_mode != RENDER_STEREO_MODE_OFF) - { -- if (rect.h > m_height / 2) -+ if ((rect.h - rect.y) > m_height / 2) - { - m_height /= 2; - rect.h /= 2; - } -- else if (rect.w > m_width / 2) -+ else if ((rect.w - rect.x) > m_width / 2) - { - m_width /= 2; - rect.w /= 2; - } -- } -+ }*/ - - CDVDOverlayImage* overlay = new CDVDOverlayImage(); - - -From b9eb944c52a9e09bfa084f4bd8f8862f13ec6f7e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 7 Apr 2016 17:28:50 +0300 -Subject: [PATCH 44/62] [VideoPlayer] Disable reading extension stream from - input stream if decoder doesn't support it. - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h | 5 +++++ - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 18 +++++++++--------- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 4 +++- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h | 6 +++--- - .../cores/VideoPlayer/DVDInputStreams/DVDInputStream.h | 11 +++++++++++ - .../DVDInputStreams/DVDInputStreamBluray.cpp | 9 ++++++++- - .../VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h | 9 ++++++--- - xbmc/cores/VideoPlayer/IVideoPlayer.h | 1 + - xbmc/cores/VideoPlayer/VideoPlayer.cpp | 4 ++++ - xbmc/cores/VideoPlayer/VideoPlayerVideo.h | 1 + - 10 files changed, 51 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -index a2da9de4375939f3711c594dc854b9a533c755b4..8101b6eeff0341a94736df7ee815dd4c18337a32 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -311,6 +311,11 @@ public: - */ - virtual void Reopen() {}; - -+ /** -+ * Indicates that the decoder supports extention streams. -+ */ -+ virtual bool SupportsExtention() { return false; } -+ - protected: - CProcessInfo &m_processInfo; - }; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index b7e5081bc0fc32eaaae42d894a288e7971139356..6ea1a19173e36d49f7391b6f350c8ae3173db7ff 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -504,14 +504,14 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein - - UpdateCurrentPTS(); - -- if (!fileinfo && m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ if (!fileinfo) - { -- CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -- if (bluRay->HasMVC()) -+ CDVDInputStream::IExtentionStream* pExt = dynamic_cast(m_pInput); -+ if (pExt && pExt->HasExtention()) - { - SAFE_DELETE(m_pSSIF); - m_pSSIF = new CDemuxStreamSSIF(); -- m_pSSIF->SetBluRay(bluRay); -+ m_pSSIF->SetBluRay(pExt); - } - } - // in case of mpegts and we have not seen pat/pmt, defer creation of streams -@@ -1488,13 +1488,13 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - pStream->codec->codec_tag = MKTAG('A', 'M', 'V', 'C'); - - AVStream* mvcStream = nullptr; -- if (m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ CDVDInputStream::IExtentionStream* pExt = dynamic_cast(m_pInput); -+ if (pExt) - { -- CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -- if (bluRay->HasMVC()) -+ if (pExt->HasExtention()) - { -- st->stereo_mode = bluRay->AreEyesFlipped() ? "block_rl" : "block_lr"; -- mvcStream = static_cast(bluRay->GetDemuxMVC())->GetAVStream(); -+ st->stereo_mode = pExt->AreEyesFlipped() ? "block_rl" : "block_lr"; -+ mvcStream = static_cast(pExt->GetExtentionDemux())->GetAVStream(); - } - } - else -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -index 2c7e66f7ee5683a0fbcde5ad5c65ebfd6853f3d0..7c8719ce40e725e27b7551250398022a1f1a4fc6 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -35,6 +35,8 @@ DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) - - if (srcPkt->iStreamId == m_h264StreamId) - { -+ if (m_bluRay && !m_bluRay->HasExtention()) -+ return srcPkt; - m_H264queue.push(srcPkt); - } - else if (srcPkt->iStreamId == m_mvcStreamId) -@@ -170,7 +172,7 @@ bool CDemuxStreamSSIF::FillMVCQueue(double dtsBase) - if (!m_bluRay) - return false; - -- CDVDDemux* demux = m_bluRay->GetDemuxMVC(); -+ CDVDDemux* demux = m_bluRay->GetExtentionDemux(); - DemuxPacket* mvc; - while ((m_MVCqueue.size() < MVC_QUEUE_SIZE) && (mvc = demux->Read())) - { -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -index 508e9debd3e6679a1433842a65649fa68ead76ec..26cd97dddcae208afacfb241e96b4935ad0f81f3 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -@@ -21,7 +21,7 @@ - */ - - #include "DVDDemuxPacket.h" --#include "DVDInputStreams/DVDInputStreamBluray.h" -+#include "DVDInputStreams/DVDInputStream.h" - #include - - extern "C" { -@@ -41,7 +41,7 @@ public: - int GetH264StreamId() { return m_h264StreamId; }; - int GetMVCStreamId() { return m_mvcStreamId; }; - void AddMVCExtPacket(DemuxPacket* &scrPkt); -- void SetBluRay(CDVDInputStreamBluray* &bluRay) { m_bluRay = bluRay; }; -+ void SetBluRay(CDVDInputStream::IExtentionStream* &bluRay) { m_bluRay = bluRay; }; - bool IsBluRay() { return m_bluRay != nullptr; }; - - private: -@@ -49,7 +49,7 @@ private: - DemuxPacket* MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt); - bool FillMVCQueue(double dtsBase); - -- CDVDInputStreamBluray* m_bluRay = nullptr; -+ CDVDInputStream::IExtentionStream* m_bluRay = nullptr; - std::queue m_H264queue; - std::queue m_MVCqueue; - int m_h264StreamId = -1; -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -index 932f0e4093c836453b07932df9075afc6f6e5ae5..7aee35cef8f42d080882e4bdd20a4a9ed234a8c2 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -@@ -57,6 +57,7 @@ namespace XFILE - - struct DemuxPacket; - class CDemuxStream; -+class CDVDDemux; - - class CDVDInputStream - { -@@ -131,6 +132,16 @@ public: - virtual void SetVideoResolution(int width, int height) {}; - }; - -+ class IExtentionStream -+ { -+ public: -+ virtual ~IExtentionStream() {} -+ virtual bool HasExtention() = 0; -+ virtual bool AreEyesFlipped() = 0; -+ virtual CDVDDemux* GetExtentionDemux() = 0; -+ virtual void DisableExtention() = 0; -+ }; -+ - enum ENextStream - { - NEXTSTREAM_NONE, -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index ad2c65ba5b80c5ac5d055d621a1e8319e3f770c0..74e8e1fc2da66d3c98a5bab04faa2f6bf16539ff 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -617,6 +617,13 @@ void CDVDInputStreamBluray::ProcessEvent() { - } - } - -+void CDVDInputStreamBluray::DisableExtention() -+{ -+ CloseMVCDemux(); -+ m_bMVCDisabled = true; -+ m_bMVCPlayback = false; -+} -+ - int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size) - { - int result = 0; -@@ -1165,7 +1172,7 @@ bool CDVDInputStreamBluray::ProcessItem(int playitem) - - m_title = m_dll->bd_get_playlist_info(m_bd, playitem, m_angle); - -- if (CSettings::GetInstance().GetBool("videoplayer.supportmvc")) -+ if (CSettings::GetInstance().GetBool("videoplayer.supportmvc") && !m_bMVCDisabled) - { - MPLS_PL * mpls = m_dll->bd_get_title_mpls(m_bd); - if (mpls) -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -index 561fb5cd4f971bc9ee4f41218a60bb3d5bc5625f..f70657c9e31fb2460d12910c635dba5163282e74 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -46,6 +46,7 @@ class CDVDInputStreamBluray - , public CDVDInputStream::IChapter - , public CDVDInputStream::IPosTime - , public CDVDInputStream::IMenus -+ , public CDVDInputStream::IExtentionStream - { - public: - CDVDInputStreamBluray(IVideoPlayer* player, const CFileItem& fileitem); -@@ -120,9 +121,10 @@ public: - BLURAY_TITLE_INFO* GetTitleFile(const std::string& name); - - void ProcessEvent(); -- CDVDDemux* GetDemuxMVC() { return m_pMVCDemux; }; -- bool HasMVC() { return m_bMVCPlayback; } -- bool AreEyesFlipped() { return m_bFlipEyes; } -+ CDVDDemux* GetExtentionDemux() override { return m_pMVCDemux; }; -+ bool HasExtention() override { return m_bMVCPlayback; } -+ bool AreEyesFlipped() override { return m_bFlipEyes; } -+ void DisableExtention() override; - - protected: - struct SPlane; -@@ -157,6 +159,7 @@ protected: - int m_nMVCSubPathIndex = 0; - int m_nMVCClip = -1; - bool m_bFlipEyes = false; -+ bool m_bMVCDisabled = false; - uint64_t m_clipStartTime = 0; - - typedef std::shared_ptr SOverlay; -diff --git a/xbmc/cores/VideoPlayer/IVideoPlayer.h b/xbmc/cores/VideoPlayer/IVideoPlayer.h -index 0b676c9b611fe956f1aa721013412e41ff5b62f6..6762e733848d1298a75a862b0aaf81aa5690537d 100644 ---- a/xbmc/cores/VideoPlayer/IVideoPlayer.h -+++ b/xbmc/cores/VideoPlayer/IVideoPlayer.h -@@ -111,6 +111,7 @@ public: - virtual int GetDecoderBufferSize() { return 0; } - virtual int GetDecoderFreeSpace() = 0; - virtual bool IsEOS() { return false; }; -+ virtual bool SupportsExtention() const = 0; - }; - - class CDVDAudioCodec; -diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -index b9b0d866fe112d291a8d80a8269c3f572d254447..d74c03d1ef7e0146a57964376dbff190876a8598 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -@@ -3891,6 +3891,10 @@ bool CVideoPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) - if (!player->OpenStream(hint)) - return false; - -+ CDVDInputStream::IExtentionStream* pExt = dynamic_cast(m_pInputStream); -+ if (pExt && !static_cast(player)->SupportsExtention()) -+ pExt->DisableExtention(); -+ - s.stereo_mode = static_cast(player)->GetStereoMode(); - if (s.stereo_mode == "mono") - s.stereo_mode = ""; -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.h b/xbmc/cores/VideoPlayer/VideoPlayerVideo.h -index 0d4100e58e9db7e5035bcf9ae23b0147f80cec8f..69570153f0810a5840f3780c7a6681a102b85cec 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.h -+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.h -@@ -91,6 +91,7 @@ public: - int GetVideoBitrate(); - std::string GetStereoMode(); - void SetSpeed(int iSpeed); -+ bool SupportsExtention() const override { return m_pVideoCodec && m_pVideoCodec->SupportsExtention(); } - - // classes - CDVDOverlayContainer* m_pOverlayContainer; - -From a5dcb2315b90a4868559d51964f9d59b69901773 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 16 Sep 2016 11:37:48 +0300 -Subject: [PATCH 45/62] [Settings] move SETTING_VIDEOPLAYER_SUPPORTMVC from - platform settings to common settings. - ---- - system/settings/rbp.xml | 7 ------- - system/settings/settings.xml | 6 ++++++ - system/settings/win32.xml | 11 ----------- - .../VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp | 2 +- - xbmc/settings/SettingConditions.cpp | 3 +++ - 5 files changed, 10 insertions(+), 19 deletions(-) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 2572e25753712186f69390965ee1448bff3fadd5..7098edf32dff8c00e192229c3ffb060be6a42482 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -28,13 +28,6 @@ - - - -- -- -- 2 -- true -- -- -- - -
-
-diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 22dcff1c06577055f84c3d2c2fda73cfa16c53d4..eb610a8aaa795d2caeaf2ab12bcf61b1148524b4 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -343,6 +343,12 @@ - true - - -+ -+ 2 -+ true -+ -+ HAS_MVC -+ - - - -diff --git a/system/settings/win32.xml b/system/settings/win32.xml -index 2fcee72a64e8b701c8e895143410bbe9fd617356..a017d30c24232fb01220b87b29398403b8ed9662 100644 ---- a/system/settings/win32.xml -+++ b/system/settings/win32.xml -@@ -12,17 +12,6 @@ - false - -
--
-- -- -- -- 2 -- true -- -- -- -- --
-
- - -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index 74e8e1fc2da66d3c98a5bab04faa2f6bf16539ff..7dd85f0173bd636f4f5ae6e7fc43b3064e2ff822 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -1172,7 +1172,7 @@ bool CDVDInputStreamBluray::ProcessItem(int playitem) - - m_title = m_dll->bd_get_playlist_info(m_bd, playitem, m_angle); - -- if (CSettings::GetInstance().GetBool("videoplayer.supportmvc") && !m_bMVCDisabled) -+ if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC) && !m_bMVCDisabled) - { - MPLS_PL * mpls = m_dll->bd_get_title_mpls(m_bd); - if (mpls) -diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp -index 6b1f2b6d757354d6065c2862b44dfb47184a1dcc..9163ec85bd0feb48a698a025d9870bf40042c675 100644 ---- a/xbmc/settings/SettingConditions.cpp -+++ b/xbmc/settings/SettingConditions.cpp -@@ -327,6 +327,9 @@ void CSettingConditions::Initialize() - m_simpleConditions.insert("has_dx"); - m_simpleConditions.insert("hasdxva2"); - #endif -+#if defined(HAVE_LIBMFX) || defined(TARGET_RASPBERRY_PI) -+ m_simpleConditions.insert("has_mvc"); -+#endif - #ifdef HAVE_LCMS2 - m_simpleConditions.insert("have_lcms2"); - #endif - -From b5a7b94739f0da0c2de4e33a3fff027c412d93f6 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 4 Nov 2016 22:56:56 +0300 -Subject: [PATCH 46/62] [VideoPlayer] SSIF: fix for corner case when mvc stream - is switched before the last packet is read from previous stream. - ---- - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 5 ++- - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 7 ++-- - .../VideoPlayer/DVDInputStreams/DVDInputStream.h | 1 + - .../DVDInputStreams/DVDInputStreamBluray.cpp | 39 +++++++++++++++++++--- - .../DVDInputStreams/DVDInputStreamBluray.h | 3 ++ - 5 files changed, 45 insertions(+), 10 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 6ea1a19173e36d49f7391b6f350c8ae3173db7ff..9149698884c8ae6a23649abbaa0e659587dfe982 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1120,9 +1120,6 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double *startpts) - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -- if (m_pSSIF) -- m_pSSIF->Flush(); -- - CDVDInputStream::IPosTime* ist = m_pInput->GetIPosTime(); - if (ist) - { -@@ -1136,6 +1133,8 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double *startpts) - - return true; - } -+ else if (m_pSSIF) -+ m_pSSIF->Flush(); - - if (!m_pInput->Seek(0, SEEK_POSSIBLE) && - !m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -index 7c8719ce40e725e27b7551250398022a1f1a4fc6..c675e31f731bc6afb8aabc37bbb5495aed45f4f6 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -183,12 +183,15 @@ bool CDemuxStreamSSIF::FillMVCQueue(double dtsBase) - else if (mvc->dts < dtsBase) - { - #if defined(DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d, pts(%.3f) dts(%.3f)", mvc->iSize, mvc->pts*1e-6, mvc->dts*1e-6); -+ CLog::Log(LOGDEBUG, ">>> MVC drop mvc: %6d, pts(%.3f) dts(%.3f)", mvc->iSize, mvc->pts*1e-6, mvc->dts*1e-6); - #endif - CDVDDemuxUtils::FreeDemuxPacket(mvc); - continue; - } - AddMVCExtPacket(mvc); - }; -- return m_MVCqueue.size() == MVC_QUEUE_SIZE; -+ if (m_MVCqueue.size() != MVC_QUEUE_SIZE) -+ m_bluRay->OpenNextStream(); -+ -+ return true; - } -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -index 7aee35cef8f42d080882e4bdd20a4a9ed234a8c2..ea138f95bac915a946800f6bc7b964bd928e1a89 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -@@ -140,6 +140,7 @@ public: - virtual bool AreEyesFlipped() = 0; - virtual CDVDDemux* GetExtentionDemux() = 0; - virtual void DisableExtention() = 0; -+ virtual bool OpenNextStream() = 0; - }; - - enum ENextStream -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index 7dd85f0173bd636f4f5ae6e7fc43b3064e2ff822..23053d7f8ebf494c7b35bf41bcf9952fa9a5f261 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -48,6 +48,7 @@ - #endif - - #define LIBBLURAY_BYTESEEK 0 -+#define EMPTY_QUEUE(x) { while(!x.empty()) x.pop(); } - - using namespace XFILE; - -@@ -432,6 +433,8 @@ bool CDVDInputStreamBluray::Open() - while (m_dll->bd_get_event(m_bd, &m_event)) - ProcessEvent(); - -+ OpenNextStream(); -+ - return true; - } - -@@ -610,10 +613,14 @@ void CDVDInputStreamBluray::ProcessEvent() { - /* event has been consumed */ - m_event.event = BD_EVENT_NONE; - -- if (m_bMVCPlayback && m_clip >= 0 && m_title && m_clip < m_title->clip_count && m_nMVCClip != m_clip) -+ if ( m_bMVCPlayback && m_clip >= 0 -+ && m_title -+ && m_clip < m_title->clip_count -+ && m_nMVCClip != m_clip -+ && (m_clipQueue.empty() -+ || m_clip != m_clipQueue.front())) - { -- CloseMVCDemux(); -- OpenMVCDemux(m_clip); -+ m_clipQueue.push(m_clip); - } - } - -@@ -935,10 +942,15 @@ bool CDVDInputStreamBluray::PosTime(int ms) - if(m_dll->bd_seek_time(m_bd, ms * 90) < 0) - return false; - -+ EMPTY_QUEUE(m_clipQueue); - while (m_dll->bd_get_event(m_bd, &m_event)) - ProcessEvent(); - -- SeekMVCDemux(ms - m_clipStartTime); -+ if (m_bMVCPlayback) -+ { -+ OpenNextStream(); -+ SeekMVCDemux(ms - m_clipStartTime); -+ } - return true; - } - -@@ -963,10 +975,15 @@ bool CDVDInputStreamBluray::SeekChapter(int ch) - if(m_title && m_dll->bd_seek_chapter(m_bd, ch-1) < 0) - return false; - -+ EMPTY_QUEUE(m_clipQueue); - while (m_dll->bd_get_event(m_bd, &m_event)) - ProcessEvent(); - -- SeekMVCDemux(GetChapterPos(ch) * 1000 - m_clipStartTime); -+ if (m_bMVCPlayback) -+ { -+ OpenNextStream(); -+ SeekMVCDemux(GetChapterPos(ch) * 1000 - m_clipStartTime); -+ } - return true; - } - -@@ -1196,6 +1213,18 @@ bool CDVDInputStreamBluray::ProcessItem(int playitem) - return true; - } - -+bool CDVDInputStreamBluray::OpenNextStream() -+{ -+ if (m_clipQueue.empty()) -+ return false; -+ -+ int clip = m_clipQueue.front(); -+ m_clipQueue.pop(); -+ -+ CloseMVCDemux(); -+ return OpenMVCDemux(clip); -+} -+ - bool CDVDInputStreamBluray::OpenMVCDemux(int playItem) - { - MPLS_PL *pl = m_dll->bd_get_title_mpls(m_bd); -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -index f70657c9e31fb2460d12910c635dba5163282e74..a11ec77903d2a9b2c68106a8e2301af93823b0bd 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -23,6 +23,7 @@ - #include "DVDInputStream.h" - #include - #include -+#include - - extern "C" - { -@@ -125,6 +126,7 @@ public: - bool HasExtention() override { return m_bMVCPlayback; } - bool AreEyesFlipped() override { return m_bFlipEyes; } - void DisableExtention() override; -+ bool OpenNextStream() override; - - protected: - struct SPlane; -@@ -161,6 +163,7 @@ protected: - bool m_bFlipEyes = false; - bool m_bMVCDisabled = false; - uint64_t m_clipStartTime = 0; -+ std::queue m_clipQueue; - - typedef std::shared_ptr SOverlay; - typedef std::list SOverlays; - -From 68303efd88570df113b4e6d4816255f671ff02ef Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Tue, 23 Feb 2016 16:01:08 +0300 -Subject: [PATCH 47/62] [libbluray] bump libbluray to 0.9.2-mvc. - ---- - project/BuildDependencies/scripts/0_package.list | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/project/BuildDependencies/scripts/0_package.list b/project/BuildDependencies/scripts/0_package.list -index e6c608023a46d377ef520bf23e9863ee0350d980..f8db70ab3861835f33f0e4be79cf3d193093a45f 100644 ---- a/project/BuildDependencies/scripts/0_package.list -+++ b/project/BuildDependencies/scripts/0_package.list -@@ -17,7 +17,7 @@ freetype-2.6.3-win32-vc140.7z - giflib-5.1.4-win32-vc140.7z - jsonschemabuilder-1.0.0-win32-3.7z - libass-542975a-win32-vc140.7z --libbluray-0.9.3-win32-vc140.7z -+libbluray-0.9.2-mvc-win32-vc120.7z - libcdio-0.9.3-win32-vc140.7z - libcec-4.0.0-win32-vc140-2.7z - libfribidi-0.19.2-win32.7z - -From 535c34fdcb4be388fa3554b364f3dcaebac7ef19 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 29 Feb 2016 17:00:50 +0000 -Subject: [PATCH 48/62] libbluray: Bump to Nevcairie's v0.9.2 - -This includes 3D support ---- - tools/depends/target/libbluray/Makefile | 1 + - .../libbluray/bump_to_Nevcairie_v0.9.2.patch | 1629 ++++++++++++++++++++ - 2 files changed, 1630 insertions(+) - create mode 100644 tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch - -diff --git a/tools/depends/target/libbluray/Makefile b/tools/depends/target/libbluray/Makefile -index 09d2a8e04ef4ef694f3d7a6152ab9be0e294ce2f..741a820df47fd8014192f6c0c546abb72d33ab1f 100644 ---- a/tools/depends/target/libbluray/Makefile -+++ b/tools/depends/target/libbluray/Makefile -@@ -24,6 +24,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - # libbluray has borked Makefile.am with respect to CFLAGS, remove the offending line - sed -i -e "s|CFLAGS=|#CFLAGS=|" $(PLATFORM)/Makefile.am -+ cd $(PLATFORM); patch -p1 < ../bump_to_Nevcairie_v0.9.2.patch - cd $(PLATFORM); ./bootstrap - cd $(PLATFORM); $(CONFIGURE) - -diff --git a/tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch b/tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..5ef0124e35c9d81143921a328e272220640fb84e ---- /dev/null -+++ b/tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch -@@ -0,0 +1,1629 @@ -+diff --git a/Makefile.am b/Makefile.am -+index 3a54bfc..035553b 100644 -+--- a/Makefile.am -++++ b/Makefile.am -+@@ -161,6 +161,15 @@ noinst_HEADERS = \ -+ jni/win32/jni_md.h \ -+ jni/darwin/jni_md.h -+ -++ -++bdnavdir=$(pkgincludedir)/bdnav -++bdnav_HEADERS = \ -++ src/libbluray/bdnav/clpi_data.h -++ -++utildir=$(pkgincludedir)/../util -++util_HEADERS = \ -++ src/util/attributes.h -++ -+ pkginclude_HEADERS = \ -+ src/file/filesystem.h \ -+ src/libbluray/bluray.h \ -+@@ -168,6 +177,9 @@ pkginclude_HEADERS = \ -+ src/libbluray/keys.h \ -+ src/libbluray/player_settings.h \ -+ src/libbluray/bdnav/clpi_data.h \ -++ src/libbluray/bdnav/clpi_parse.h \ -++ src/libbluray/bdnav/mpls_parse.h \ -++ src/libbluray/bdnav/uo_mask_table.h \ -+ src/libbluray/bdnav/meta_data.h \ -+ src/libbluray/decoders/overlay.h \ -+ src/util/log_control.h -+diff --git a/config.h b/config.h -+new file mode 100644 -+index 0000000..6764704 -+--- /dev/null -++++ b/config.h -+@@ -0,0 +1,157 @@ -++/* config.h. Generated from config.h.in by configure. */ -++/* config.h.in. Generated from configure.ac by autoheader. */ -++ -++/* Define to 1 if libudfread is to be used for disc image access */ -++/* #undef ENABLE_UDF */ -++ -++/* Define to 1 if using libbluray J2ME stack */ -++/* #undef HAVE_BDJ_J2ME */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. -++ */ -++/* #undef HAVE_DIRENT_H */ -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_DLFCN_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_ERRNO_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_FCNTL_H */ -++ -++/* Define this if you have fontconfig library */ -++/* #undef HAVE_FONTCONFIG */ -++ -++/* Define this if you have FreeType2 library */ -++/* #undef HAVE_FT2 */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_INTTYPES_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_JNI_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_LIBGEN_H 1 -++ -++/* Define to 1 if libxml2 is to be used for metadata parsing */ -++/* #undef HAVE_LIBXML2 */ -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_LINUX_CDROM_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_MALLOC_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_MEMORY_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_MNTENT_H */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. */ -++/* #undef HAVE_NDIR_H */ -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_PTHREAD_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STDARG_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STDINT_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STDLIB_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_STRINGS_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STRING_H 1 -++ -++/* Define to 1 if `d_type' is a member of `struct dirent'. */ -++/* #undef HAVE_STRUCT_DIRENT_D_TYPE */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. -++ */ -++/* #undef HAVE_SYS_DIR_H */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. -++ */ -++/* #undef HAVE_SYS_NDIR_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_SYS_STAT_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_SYS_TIME_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_SYS_TYPES_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_TIME_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_UNISTD_H */ -++ -++/* "Defines the architecture of the java vm." */ -++/* #undef JAVA_ARCH */ -++ -++/* "" */ -++/* #undef JDK_HOME */ -++ -++/* Define to the sub-directory where libtool stores uninstalled libraries. */ -++#define LT_OBJDIR ".libs/" -++ -++/* Name of package */ -++#define PACKAGE "libbluray" -++ -++/* Define to the address where bug reports for this package should be sent. */ -++#define PACKAGE_BUGREPORT "http://www.videolan.org/developers/libbluray.html" -++ -++/* Define to the full name of this package. */ -++#define PACKAGE_NAME "libbluray" -++ -++/* Define to the full name and version of this package. */ -++#define PACKAGE_STRING "libbluray 0.9.2" -++ -++/* Define to the one symbol short name of this package. */ -++#define PACKAGE_TARNAME "libbluray" -++ -++/* Define to the home page for this package. */ -++#define PACKAGE_URL "" -++ -++/* Define to the version of this package. */ -++#define PACKAGE_VERSION "0.9.2" -++ -++/* Define as the return type of signal handlers (`int' or `void'). */ -++#define RETSIGTYPE void -++ -++/* Define to 1 if you have the ANSI C header files. */ -++#define STDC_HEADERS 1 -++ -++/* "Define to 1 if using BD-Java" */ -++/* #undef USING_BDJAVA */ -++ -++/* Version number of package */ -++#define VERSION "0.9.2" -++ -++/* Enable large inode numbers on Mac OS X 10.5. */ -++#ifndef _DARWIN_USE_64_BIT_INODE -++# define _DARWIN_USE_64_BIT_INODE 1 -++#endif -++ -++/* Number of bits in a file offset, on hosts where this is settable. */ -++#define _FILE_OFFSET_BITS 64 -++ -++/* Define for large files, on AIX-style hosts. */ -++/* #undef _LARGE_FILES */ -++ -++/* Define to '0x0501' for IE 5.01. */ -++#define _WIN32_IE 0x0501 -++ -++/* Define to '0x0502' for Windows XP SP2 APIs. */ -++#define _WIN32_WINNT 0x0502 -+diff --git a/includes/inttypes.h b/includes/inttypes.h -+new file mode 100644 -+index 0000000..ead903f -+--- /dev/null -++++ b/includes/inttypes.h -+@@ -0,0 +1,305 @@ -++// ISO C9x compliant inttypes.h for Microsoft Visual Studio -++// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -++// -++// Copyright (c) 2006 Alexander Chemeris -++// -++// Redistribution and use in source and binary forms, with or without -++// modification, are permitted provided that the following conditions are met: -++// -++// 1. Redistributions of source code must retain the above copyright notice, -++// this list of conditions and the following disclaimer. -++// -++// 2. Redistributions in binary form must reproduce the above copyright -++// notice, this list of conditions and the following disclaimer in the -++// documentation and/or other materials provided with the distribution. -++// -++// 3. The name of the author may be used to endorse or promote products -++// derived from this software without specific prior written permission. -++// -++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -++// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -++// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -++// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -++// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -++// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -++// -++/////////////////////////////////////////////////////////////////////////////// -++ -++#ifndef _MSC_VER // [ -++#error "Use this header only with Microsoft Visual C++ compilers!" -++#endif // _MSC_VER ] -++ -++#ifndef _MSC_INTTYPES_H_ // [ -++#define _MSC_INTTYPES_H_ -++ -++#if _MSC_VER > 1000 -++#pragma once -++#endif -++ -++#include "stdint.h" -++ -++// 7.8 Format conversion of integer types -++ -++typedef struct { -++ intmax_t quot; -++ intmax_t rem; -++} imaxdiv_t; -++ -++// 7.8.1 Macros for format specifiers -++ -++#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 -++ -++// The fprintf macros for signed integers are: -++#define PRId8 "d" -++#define PRIi8 "i" -++#define PRIdLEAST8 "d" -++#define PRIiLEAST8 "i" -++#define PRIdFAST8 "d" -++#define PRIiFAST8 "i" -++ -++#define PRId16 "hd" -++#define PRIi16 "hi" -++#define PRIdLEAST16 "hd" -++#define PRIiLEAST16 "hi" -++#define PRIdFAST16 "hd" -++#define PRIiFAST16 "hi" -++ -++#define PRId32 "I32d" -++#define PRIi32 "I32i" -++#define PRIdLEAST32 "I32d" -++#define PRIiLEAST32 "I32i" -++#define PRIdFAST32 "I32d" -++#define PRIiFAST32 "I32i" -++ -++#define PRId64 "I64d" -++#define PRIi64 "I64i" -++#define PRIdLEAST64 "I64d" -++#define PRIiLEAST64 "I64i" -++#define PRIdFAST64 "I64d" -++#define PRIiFAST64 "I64i" -++ -++#define PRIdMAX "I64d" -++#define PRIiMAX "I64i" -++ -++#define PRIdPTR "Id" -++#define PRIiPTR "Ii" -++ -++// The fprintf macros for unsigned integers are: -++#define PRIo8 "o" -++#define PRIu8 "u" -++#define PRIx8 "x" -++#define PRIX8 "X" -++#define PRIoLEAST8 "o" -++#define PRIuLEAST8 "u" -++#define PRIxLEAST8 "x" -++#define PRIXLEAST8 "X" -++#define PRIoFAST8 "o" -++#define PRIuFAST8 "u" -++#define PRIxFAST8 "x" -++#define PRIXFAST8 "X" -++ -++#define PRIo16 "ho" -++#define PRIu16 "hu" -++#define PRIx16 "hx" -++#define PRIX16 "hX" -++#define PRIoLEAST16 "ho" -++#define PRIuLEAST16 "hu" -++#define PRIxLEAST16 "hx" -++#define PRIXLEAST16 "hX" -++#define PRIoFAST16 "ho" -++#define PRIuFAST16 "hu" -++#define PRIxFAST16 "hx" -++#define PRIXFAST16 "hX" -++ -++#define PRIo32 "I32o" -++#define PRIu32 "I32u" -++#define PRIx32 "I32x" -++#define PRIX32 "I32X" -++#define PRIoLEAST32 "I32o" -++#define PRIuLEAST32 "I32u" -++#define PRIxLEAST32 "I32x" -++#define PRIXLEAST32 "I32X" -++#define PRIoFAST32 "I32o" -++#define PRIuFAST32 "I32u" -++#define PRIxFAST32 "I32x" -++#define PRIXFAST32 "I32X" -++ -++#define PRIo64 "I64o" -++#define PRIu64 "I64u" -++#define PRIx64 "I64x" -++#define PRIX64 "I64X" -++#define PRIoLEAST64 "I64o" -++#define PRIuLEAST64 "I64u" -++#define PRIxLEAST64 "I64x" -++#define PRIXLEAST64 "I64X" -++#define PRIoFAST64 "I64o" -++#define PRIuFAST64 "I64u" -++#define PRIxFAST64 "I64x" -++#define PRIXFAST64 "I64X" -++ -++#define PRIoMAX "I64o" -++#define PRIuMAX "I64u" -++#define PRIxMAX "I64x" -++#define PRIXMAX "I64X" -++ -++#define PRIoPTR "Io" -++#define PRIuPTR "Iu" -++#define PRIxPTR "Ix" -++#define PRIXPTR "IX" -++ -++// The fscanf macros for signed integers are: -++#define SCNd8 "d" -++#define SCNi8 "i" -++#define SCNdLEAST8 "d" -++#define SCNiLEAST8 "i" -++#define SCNdFAST8 "d" -++#define SCNiFAST8 "i" -++ -++#define SCNd16 "hd" -++#define SCNi16 "hi" -++#define SCNdLEAST16 "hd" -++#define SCNiLEAST16 "hi" -++#define SCNdFAST16 "hd" -++#define SCNiFAST16 "hi" -++ -++#define SCNd32 "ld" -++#define SCNi32 "li" -++#define SCNdLEAST32 "ld" -++#define SCNiLEAST32 "li" -++#define SCNdFAST32 "ld" -++#define SCNiFAST32 "li" -++ -++#define SCNd64 "I64d" -++#define SCNi64 "I64i" -++#define SCNdLEAST64 "I64d" -++#define SCNiLEAST64 "I64i" -++#define SCNdFAST64 "I64d" -++#define SCNiFAST64 "I64i" -++ -++#define SCNdMAX "I64d" -++#define SCNiMAX "I64i" -++ -++#ifdef _WIN64 // [ -++# define SCNdPTR "I64d" -++# define SCNiPTR "I64i" -++#else // _WIN64 ][ -++# define SCNdPTR "ld" -++# define SCNiPTR "li" -++#endif // _WIN64 ] -++ -++// The fscanf macros for unsigned integers are: -++#define SCNo8 "o" -++#define SCNu8 "u" -++#define SCNx8 "x" -++#define SCNX8 "X" -++#define SCNoLEAST8 "o" -++#define SCNuLEAST8 "u" -++#define SCNxLEAST8 "x" -++#define SCNXLEAST8 "X" -++#define SCNoFAST8 "o" -++#define SCNuFAST8 "u" -++#define SCNxFAST8 "x" -++#define SCNXFAST8 "X" -++ -++#define SCNo16 "ho" -++#define SCNu16 "hu" -++#define SCNx16 "hx" -++#define SCNX16 "hX" -++#define SCNoLEAST16 "ho" -++#define SCNuLEAST16 "hu" -++#define SCNxLEAST16 "hx" -++#define SCNXLEAST16 "hX" -++#define SCNoFAST16 "ho" -++#define SCNuFAST16 "hu" -++#define SCNxFAST16 "hx" -++#define SCNXFAST16 "hX" -++ -++#define SCNo32 "lo" -++#define SCNu32 "lu" -++#define SCNx32 "lx" -++#define SCNX32 "lX" -++#define SCNoLEAST32 "lo" -++#define SCNuLEAST32 "lu" -++#define SCNxLEAST32 "lx" -++#define SCNXLEAST32 "lX" -++#define SCNoFAST32 "lo" -++#define SCNuFAST32 "lu" -++#define SCNxFAST32 "lx" -++#define SCNXFAST32 "lX" -++ -++#define SCNo64 "I64o" -++#define SCNu64 "I64u" -++#define SCNx64 "I64x" -++#define SCNX64 "I64X" -++#define SCNoLEAST64 "I64o" -++#define SCNuLEAST64 "I64u" -++#define SCNxLEAST64 "I64x" -++#define SCNXLEAST64 "I64X" -++#define SCNoFAST64 "I64o" -++#define SCNuFAST64 "I64u" -++#define SCNxFAST64 "I64x" -++#define SCNXFAST64 "I64X" -++ -++#define SCNoMAX "I64o" -++#define SCNuMAX "I64u" -++#define SCNxMAX "I64x" -++#define SCNXMAX "I64X" -++ -++#ifdef _WIN64 // [ -++# define SCNoPTR "I64o" -++# define SCNuPTR "I64u" -++# define SCNxPTR "I64x" -++# define SCNXPTR "I64X" -++#else // _WIN64 ][ -++# define SCNoPTR "lo" -++# define SCNuPTR "lu" -++# define SCNxPTR "lx" -++# define SCNXPTR "lX" -++#endif // _WIN64 ] -++ -++#endif // __STDC_FORMAT_MACROS ] -++ -++// 7.8.2 Functions for greatest-width integer types -++ -++// 7.8.2.1 The imaxabs function -++#define imaxabs _abs64 -++ -++// 7.8.2.2 The imaxdiv function -++ -++// This is modified version of div() function from Microsoft's div.c found -++// in %MSVC.NET%\crt\src\div.c -++#ifdef STATIC_IMAXDIV // [ -++static -++#else // STATIC_IMAXDIV ][ -++_inline -++#endif // STATIC_IMAXDIV ] -++imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -++{ -++ imaxdiv_t result; -++ -++ result.quot = numer / denom; -++ result.rem = numer % denom; -++ -++ if (numer < 0 && result.rem > 0) { -++ // did division wrong; must fix up -++ ++result.quot; -++ result.rem -= denom; -++ } -++ -++ return result; -++} -++ -++// 7.8.2.3 The strtoimax and strtoumax functions -++#define strtoimax _strtoi64 -++#define strtoumax _strtoui64 -++ -++// 7.8.2.4 The wcstoimax and wcstoumax functions -++#define wcstoimax _wcstoi64 -++#define wcstoumax _wcstoui64 -++ -++ -++#endif // _MSC_INTTYPES_H_ ] -+diff --git a/libbluray.def b/libbluray.def -+new file mode 100644 -+index 0000000..d4c93cb -+--- /dev/null -++++ b/libbluray.def -+@@ -0,0 +1,63 @@ -++; libbluray.def ; declares the exports -++ -++LIBRARY "libbluray.dll" -++ -++EXPORTS -++ ; bluray.h -++ bd_get_version -++ bd_get_titles -++ bd_get_title_info -++ bd_get_playlist_info -++ bd_free_title_info -++ bd_open -++ bd_close -++ bd_seek -++ bd_seek_time -++ bd_find_seek_point -++ bd_read -++ bd_read_skip_still -++ bd_seek_chapter -++ bd_chapter_pos -++ bd_get_current_chapter -++ bd_seek_mark -++ bd_seek_playitem -++ bd_select_playlist -++ bd_select_title -++ bd_select_angle -++ bd_seamless_angle_change -++ bd_get_title_size -++ bd_get_current_title -++ bd_get_current_angle -++ bd_tell -++ bd_tell_time -++ bd_get_disc_info -++ bd_set_player_setting -++ bd_set_player_setting_str -++ bd_start_bdj -++ bd_stop_bdj -++ bd_get_event -++ bd_play -++ bd_read_ext -++ bd_play_title -++ bd_menu_call -++ bd_register_overlay_proc -++ bd_register_argb_overlay_proc -++ bd_set_scr -++ bd_user_input -++ bd_mouse_select -++ bd_get_sound_effect -++ bd_get_meta -++ bd_get_clpi -++ bd_read_clpi -++ bd_free_clpi -++ bd_read_mpls -++ bd_free_mpls -++ bd_read_mobj -++ bd_free_mobj -++ bd_get_clip_infos -++ bd_get_title_mpls -++ -++ ; additional functions -++ bd_set_debug_handler -++ bd_set_debug_mask -++ bd_get_debug_mask -+diff --git a/libbluray.vcxproj b/libbluray.vcxproj -+new file mode 100644 -+index 0000000..c778955 -+--- /dev/null -++++ b/libbluray.vcxproj -+@@ -0,0 +1,231 @@ -++ -++ -++ -++ -++ DebugRelease -++ Win32 -++ -++ -++ DebugRelease -++ x64 -++ -++ -++ Debug -++ Win32 -++ -++ -++ Debug -++ x64 -++ -++ -++ Release -++ Win32 -++ -++ -++ Release -++ x64 -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ {E1DA1B95-71F1-4C21-A271-121176925062} -++ Win32Proj -++ libbluray -++ -++ -++ -++ v110_xp -++ -++ -++ v120_xp -++ -++ -++ v140_xp -++ -++ -++ DynamicLibrary -++ true -++ Unicode -++ -++ -++ DynamicLibrary -++ false -++ true -++ Unicode -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ true -++ $(SolutionDir)bin_$(PlatformName)d\ -++ $(SolutionDir)bin_$(PlatformName)d\$(ProjectName)\ -++ -++ -++ false -++ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ -++ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ -++ -++ -++ -++ -++ -++ Level3 -++ Disabled -++ HAVE_CONFIG_H;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -++ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) -++ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) -++ MultiThreadedDebugDLL -++ CompileAsCpp -++ -++ -++ Windows -++ true -++ libbluray.def -++ -++ -++ xcopy /I /Y "$(OutDir)$(TargetName).lib" "$(OutDir)lib\" -++ Copy .lib into library path -++ -++ -++ -++ -++ MultiThreadedDebug -++ -++ -++ -++ -++ Level3 -++ MaxSpeed -++ true -++ true -++ HAVE_CONFIG_H;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -++ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) -++ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) -++ MultiThreaded -++ StreamingSIMDExtensions -++ CompileAsCpp -++ -++ -++ Windows -++ true -++ true -++ true -++ libbluray.def -++ true -++ -++ -++ xcopy /I /Y "$(TargetDir)$(TargetName)$(TargetExt)" "$(OutDir)..\" -++xcopy /I /Y "$(TargetDir)$(TargetName).lib" "$(OutDir)..\lib\" -++ Copy .dll/.lib into library path -++ -++ -++ -++ -++ -++ -+\ No newline at end of file -+diff --git a/libbluray.vcxproj.filters b/libbluray.vcxproj.filters -+new file mode 100644 -+index 0000000..57ff16c -+--- /dev/null -++++ b/libbluray.vcxproj.filters -+@@ -0,0 +1,353 @@ -++ -++ -++ -++ -++ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} -++ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx -++ -++ -++ {93995380-89BD-4b04-88EB-625FBE52EBFB} -++ h;hpp;hxx;hm;inl;inc;xsd -++ -++ -++ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} -++ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms -++ -++ -++ {1ab0e905-7c04-4090-b385-6363dd1c961c} -++ -++ -++ {b8fa3348-a089-461f-9ef5-3d9df997b8e5} -++ -++ -++ {125333e9-0b5e-45f9-a444-f0aaaf547d9b} -++ -++ -++ {a743058f-f07a-4d0f-bab6-02dc57defda9} -++ -++ -++ {7dacc7c4-ef59-452b-9e5b-392c9df07c98} -++ -++ -++ {c7895c81-c186-4d5e-a8ff-645c6d55a731} -++ -++ -++ {c8619466-211b-4c85-9d30-d1b1a822d32e} -++ -++ -++ {8afb6919-994f-4d1f-9638-ce4a06d0b473} -++ -++ -++ {0e9086a7-eebf-4b8e-a4fe-b1724d148877} -++ -++ -++ {fc5e776b-0f32-493a-b823-240288288502} -++ -++ -++ {96d2d786-cd45-4856-937d-9e6f85ced241} -++ -++ -++ {9f4ea4ae-217a-4d97-a5f3-e561ce1e49cd} -++ -++ -++ {09e1b1b8-3aa3-4918-b157-3dfc0554ccbb} -++ -++ -++ {1e02e503-752e-4765-9dfb-8cc67a7b79f8} -++ -++ -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\file -++ -++ -++ Header Files\file -++ -++ -++ Header Files\file -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\hdmv -++ -++ -++ Header Files\libbluray\hdmv -++ -++ -++ Header Files\libbluray\hdmv -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\file -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\util -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\file -++ -++ -++ -++ -++ Source Files\util -++ -++ -++ Source Files\util -++ -++ -++ Source Files\file -++ -++ -++ Source Files\libbluray -++ -++ -++ Source Files\libbluray -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\hdmv -++ -++ -++ Source Files\libbluray\hdmv -++ -++ -++ Source Files\libbluray\hdmv -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\util -++ -++ -++ Source Files\file -++ -++ -++ Source Files\file -++ -++ -++ Source Files\file -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\util -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\file -++ -++ -++ Source Files\file -++ -++ -++ Source Files\util -++ -++ -++ Source Files\util -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\util -++ -++ -++ Source Files\file -++ -++ -++ -++ -++ Source Files -++ -++ -++ -+\ No newline at end of file -+diff --git a/src/file/dir_win32.c b/src/file/dir_win32.c -+index 2690658..f42114d 100644 -+--- a/src/file/dir_win32.c -++++ b/src/file/dir_win32.c -+@@ -86,8 +86,8 @@ static BD_DIR_H *_dir_open_win32(const char* dirname) -+ -+ dir->internal = priv; -+ -+- wchar_t wfilespec[MAX_PATH]; -+- if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, MAX_PATH)) -++ wchar_t wfilespec[4096 + 1] = {0}; -++ if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, 4096)) -+ priv->handle = _wfindfirst(wfilespec, &priv->info); -+ else -+ priv->handle = -1; -+diff --git a/src/file/dirs_win32.c b/src/file/dirs_win32.c -+index e165fea..3d07251 100644 -+--- a/src/file/dirs_win32.c -++++ b/src/file/dirs_win32.c -+@@ -36,7 +36,7 @@ -+ -+ char *win32_get_font_dir(const char *font_file) -+ { -+- wchar_t wdir[MAX_PATH]; -++ wchar_t wdir[MAX_PATH+1] = {0}; -+ if (S_OK != SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir)) { -+ int lenght = GetWindowsDirectoryW(wdir, MAX_PATH); -+ if (lenght == 0 || lenght > (MAX_PATH - 8)) { -+@@ -67,7 +67,7 @@ char *file_get_config_home(void) -+ -+ char *file_get_data_home(void) -+ { -+- wchar_t wdir[MAX_PATH]; -++ wchar_t wdir[MAX_PATH+1] = {0}; -+ -+ /* Get the "Application Data" folder for the user */ -+ if (S_OK == SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, -+@@ -92,7 +92,7 @@ char *file_get_cache_home(void) -+ const char *file_get_config_system(const char *dir) -+ { -+ static char *appdir = NULL; -+- wchar_t wdir[MAX_PATH]; -++ wchar_t wdir[MAX_PATH+1] = {0}; -+ -+ if (!dir) { -+ // first call -+diff --git a/src/file/dl_win32.c b/src/file/dl_win32.c -+index e4492e1..7f6ae73 100644 -+--- a/src/file/dl_win32.c -++++ b/src/file/dl_win32.c -+@@ -57,7 +57,7 @@ void *dl_dlopen(const char *path, const char *version) -+ { -+ (void)version; -+ -+- wchar_t wname[MAX_PATH]; -++ wchar_t wname[MAX_PATH+1] = {0}; -+ char *name; -+ void *result; -+ -+@@ -109,7 +109,7 @@ const char *dl_get_path(void) -+ if (!initialized) { -+ initialized = 1; -+ -+- static char path[MAX_PATH]; -++ static char path[MAX_PATH + 1]; -+ HMODULE hModule; -+ wchar_t wpath[MAX_PATH]; -+ -+diff --git a/src/file/file_win32.c b/src/file/file_win32.c -+index d9845fb..b4fb7ad 100644 -+--- a/src/file/file_win32.c -++++ b/src/file/file_win32.c -+@@ -107,9 +107,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) -+ { -+ BD_FILE_H *file; -+ FILE *fp; -+- wchar_t wfilename[MAX_PATH], wmode[8]; -++ wchar_t wfilename[4096 + 1] = {0}, wmode[8] = {0}; -+ -+- if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, MAX_PATH) || -++ if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, 4096) || -+ !MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mode, -1, wmode, 8)) { -+ -+ BD_DEBUG(DBG_FILE, "Error opening file %s\n", filename); -+@@ -122,6 +122,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) -+ return NULL; -+ } -+ -++ // Set file buffer -++ setvbuf(fp, NULL, _IOFBF, 6144 * 10); -++ -+ file = calloc(1, sizeof(BD_FILE_H)); -+ if (!file) { -+ BD_DEBUG(DBG_FILE | DBG_CRIT, "Error opening file %s (out of memory)\n", filename); -+diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c -+index 394347e..39bbcef 100644 -+--- a/src/libbluray/bdnav/clpi_parse.c -++++ b/src/libbluray/bdnav/clpi_parse.c -+@@ -39,6 +39,7 @@ -+ #define CLPI_SIG1 ('H' << 24 | 'D' << 16 | 'M' << 8 | 'V') -+ #define CLPI_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0') -+ #define CLPI_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0') -++#define CLPI_SIG2C ('0' << 24 | '2' << 16 | '4' << 8 | '0') -+ -+ static void -+ _human_readable_sig(char *sig, uint32_t s1, uint32_t s2) -+@@ -129,7 +130,8 @@ _parse_header(BITSTREAM *bits, CLPI_CL *cl) -+ cl->type_indicator2 = bs_read(bits, 32); -+ if (cl->type_indicator != CLPI_SIG1 || -+ (cl->type_indicator2 != CLPI_SIG2A && -+- cl->type_indicator2 != CLPI_SIG2B)) { -++ cl->type_indicator2 != CLPI_SIG2B && -++ cl->type_indicator2 != CLPI_SIG2C)) { -+ -+ char sig[9]; -+ char expect[9]; -+diff --git a/src/libbluray/bdnav/mpls_parse.c b/src/libbluray/bdnav/mpls_parse.c -+index e196118..87b240a 100644 -+--- a/src/libbluray/bdnav/mpls_parse.c -++++ b/src/libbluray/bdnav/mpls_parse.c -+@@ -39,6 +39,7 @@ -+ #define MPLS_SIG1 ('M' << 24 | 'P' << 16 | 'L' << 8 | 'S') -+ #define MPLS_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0') -+ #define MPLS_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0') -++#define MPLS_SIG2C ('0' << 24 | '2' << 16 | '4' << 8 | '0') -+ -+ static void -+ _human_readable_sig(char *sig, uint32_t s1, uint32_t s2) -+@@ -137,8 +138,9 @@ _parse_appinfo(BITSTREAM *bits, MPLS_AI *ai) -+ ai->random_access_flag = bs_read(bits, 1); -+ ai->audio_mix_flag = bs_read(bits, 1); -+ ai->lossless_bypass_flag = bs_read(bits, 1); -++ ai->mvc_base_view_r_flag = bs_read(bits, 1); -+ // Reserved -+- bs_skip(bits, 13); -++ bs_skip(bits, 12); -+ bs_seek_byte(bits, pos + len); -+ return 1; -+ } -+@@ -155,7 +157,8 @@ _parse_header(BITSTREAM *bits, MPLS_PL *pl) -+ pl->type_indicator2 = bs_read(bits, 32); -+ if (pl->type_indicator != MPLS_SIG1 || -+ (pl->type_indicator2 != MPLS_SIG2A && -+- pl->type_indicator2 != MPLS_SIG2B)) { -++ pl->type_indicator2 != MPLS_SIG2B && -++ pl->type_indicator2 != MPLS_SIG2C)) { -+ -+ char sig[9]; -+ char expect[9]; -+@@ -259,6 +262,7 @@ _parse_stream(BITSTREAM *bits, MPLS_STREAM *s) -+ break; -+ }; -+ s->lang[3] = '\0'; -++ s->ss_offset_sequence_id = 0xFF; -+ -+ bs_seek_byte(bits, pos + len); -+ return 1; -+@@ -882,6 +886,99 @@ _parse_subpath_extension(BITSTREAM *bits, MPLS_PL *pl) -+ } -+ -+ static int -++_parse_stn_ss_extension(BITSTREAM *bits, MPLS_PL *pl) -++{ -++ int ii, s; -++ int64_t pos; -++ -++ for (ii = 0; ii < pl->list_count; ii++) { -++ uint32_t len = bs_read(bits, 16); -++ pos = bs_pos(bits) >> 3; -++ int Fixed_offset_during_PopUp_flag = bs_read(bits, 1); -++ bs_skip(bits, 15); // reserved -++ -++ for (s = 0; s < pl->play_item[ii].stn.num_video; s++) { -++ // stream_entry -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ // stream_attributes_ss -++ slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 10); // reserved -++ bs_skip(bits, 6); // number_of_offset_sequences -++ } -++ -++ for (s = 0; s < pl->play_item[ii].stn.num_pg; s++) { -++ pl->play_item[ii].stn.pg[s].ss_offset_sequence_id = bs_read(bits, 8); -++ -++ bs_skip(bits, 4); // reserved -++ bs_skip(bits, 1); // dialog_region_offset_valid_flag -++ int is_SS_PG = bs_read(bits, 1); -++ int is_top_AS_PG_textST = bs_read(bits, 1); -++ int is_bottom_AS_PG_textST = bs_read(bits, 1); -++ if (is_SS_PG) { -++ // stream_entry left eye -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ // stream_entry right eye -++ slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ if (is_top_AS_PG_textST) { -++ // stream_entry -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ if (is_bottom_AS_PG_textST) { -++ // stream_entry -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ } -++ -++ for (s = 0; s < pl->play_item[ii].stn.num_ig; s++) { -++ if (Fixed_offset_during_PopUp_flag) -++ bs_skip(bits, 8); -++ else -++ pl->play_item[ii].stn.ig[s].ss_offset_sequence_id = bs_read(bits, 8); -++ -++ bs_skip(bits, 16); // IG_Plane_offset_during_BB_video -++ bs_skip(bits, 7); // reserved -++ int is_SS_IG = bs_read(bits, 1); -++ if (is_SS_IG) { -++ // stream_entry left eye -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ // stream_entry right eye -++ slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ } -++ -++ // Skip to next play item -++ bs_seek_byte(bits, pos + len); -++ } -++ -++ return 0; -++} -++ -++static int -+ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) -+ { -+ MPLS_PL *pl = (MPLS_PL*)handle; -+@@ -895,7 +992,7 @@ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) -+ -+ if (id1 == 2) { -+ if (id2 == 1) { -+- return 0; -++ return _parse_stn_ss_extension(bits, pl); -+ } -+ if (id2 == 2) { -+ // SubPath entries extension -+diff --git a/src/libbluray/bdnav/mpls_parse.h b/src/libbluray/bdnav/mpls_parse.h -+index 94bfa67..c1b2c31 100644 -+--- a/src/libbluray/bdnav/mpls_parse.h -++++ b/src/libbluray/bdnav/mpls_parse.h -+@@ -49,6 +49,7 @@ typedef struct -+ uint8_t sv_num_pip_pg_ref; -+ uint8_t *sv_secondary_audio_ref; -+ uint8_t *sv_pip_pg_ref; -++ uint8_t ss_offset_sequence_id; -+ } MPLS_STREAM; -+ -+ typedef struct -+@@ -109,6 +110,7 @@ typedef struct -+ uint8_t random_access_flag; -+ uint8_t audio_mix_flag; -+ uint8_t lossless_bypass_flag; -++ uint8_t mvc_base_view_r_flag; -+ } MPLS_AI; -+ -+ typedef struct -+diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c -+index 0e60b68..f633d7a 100644 -+--- a/src/libbluray/bluray.c -++++ b/src/libbluray/bluray.c -+@@ -1626,6 +1626,25 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick) -+ return bd->s_pos; -+ } -+ -++int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick) -++{ -++ uint32_t clip_pkt, out_pkt; -++ NAV_CLIP *clip; -++ -++ tick /= 2; -++ -++ if (bd->title && -++ tick < bd->title->duration) { -++ -++ // Find the closest access unit to the requested position -++ clip = nav_time_search(bd->title, (uint32_t)tick, &clip_pkt, &out_pkt); -++ -++ return (int64_t)out_pkt * 192; -++ } -++ -++ return bd->s_pos; -++} -++ -+ uint64_t bd_tell_time(BLURAY *bd) -+ { -+ uint32_t clip_pkt = 0, out_pkt = 0, out_time = 0; -+@@ -2602,6 +2621,7 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, -+ BLURAY_CLIP_INFO *ci = &title_info->clips[ii]; -+ NAV_CLIP *nc = &title->clip_list.clip[ii]; -+ -++ ci->idx = nc->clip_id; -+ ci->pkt_count = nc->end_pkt - nc->start_pkt; -+ ci->start_time = (uint64_t)nc->title_time * 2; -+ ci->in_time = (uint64_t)pi->in_time * 2; -+@@ -2628,6 +2648,8 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, -+ _copy_streams(nc, ci->sec_audio_streams, pi->stn.secondary_audio, ci->sec_audio_stream_count); -+ } -+ -++ title_info->mvc_base_view_r_flag = title->pl->app_info.mvc_base_view_r_flag; -++ -+ return title_info; -+ } -+ -+@@ -3746,3 +3768,28 @@ void bd_free_bdjo(struct bdjo_data *obj) -+ (void)obj; -+ #endif -+ } -++ -++int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration) -++{ -++ if (bd && bd->title && bd->title->clip_list.count > clip) { -++ if (clip_start_time) -++ *clip_start_time = (uint64_t)bd->title->clip_list.clip[clip].title_time << 1; -++ if (stream_start_time) -++ *stream_start_time = (uint64_t)bd->title->clip_list.clip[clip].in_time << 1; -++ if (pos) -++ *pos = (uint64_t)bd->title->clip_list.clip[clip].title_pkt * 192; -++ if (duration) -++ *duration = (uint64_t)bd->title->clip_list.clip[clip].duration << 1; -++ -++ return 1; -++ } -++ return 0; -++} -++ -++struct mpls_pl* bd_get_title_mpls(BLURAY * bd) -++{ -++ if (bd && bd->title) { -++ return bd->title->pl; -++ } -++ return NULL; -++} -+diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h -+index cbf16fc..97dc1a3 100644 -+--- a/src/libbluray/bluray.h -++++ b/src/libbluray/bluray.h -+@@ -32,6 +32,7 @@ extern "C" { -+ */ -+ -+ #include -++#include "bdnav/clpi_data.h" -+ -+ #define TITLES_ALL 0 /**< all titles. */ -+ #define TITLES_FILTER_DUP_TITLE 0x01 /**< remove duplicate titles. */ -+@@ -225,6 +226,7 @@ typedef struct bd_stream_info { -+ } BLURAY_STREAM_INFO; -+ -+ typedef struct bd_clip { -++ uint32_t idx; -+ uint32_t pkt_count; -+ uint8_t still_mode; -+ uint16_t still_time; /* seconds */ -+@@ -275,6 +277,8 @@ typedef struct bd_title_info { -+ -+ uint32_t mark_count; -+ BLURAY_TITLE_MARK *marks; -++ -++ uint8_t mvc_base_view_r_flag; -+ } BLURAY_TITLE_INFO; -+ -+ /* -+@@ -483,6 +487,16 @@ uint32_t bd_get_current_title(BLURAY *bd); -+ -+ /** -+ * -++ * Find the byte position to specific time in 90Khz ticks -++ * -++ * @param bd BLURAY ojbect -++ * @param tick tick count -++ * @return byte position -++ */ -++int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick); -++ -++/** -++ * -+ * Read from currently selected title file, decrypt if possible -+ * -+ * @param bd BLURAY object -+@@ -1007,7 +1021,6 @@ int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y); -+ -+ /* access to internal information */ -+ -+-struct clpi_cl; -+ /** -+ * -+ * Get copy of clip information for requested playitem. -+@@ -1060,6 +1073,28 @@ void bd_stop_bdj(BLURAY *bd); // shutdown BD-J and clean up resources -+ */ -+ int bd_read_file(BLURAY *, const char *path, void **data, int64_t *size); -+ -++/** -++ * -++ * Get information about the clip -++ * -++ * @param bd BLURAY object -++ * @param clip clip index -++ * @param clip_start_time start of the clip (in the total title) (in 90khz) -++ * @param stream_start_time first pts in the clip (in 90khz) -++ * @param byte position of the clip (absolute) -++ * @param duration duration of the clip (in 90khz) -++ */ -++int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration); -++ -++/** -++ * Get the MPLS struct of the current title -++ * -++ * @param bd BLURAY object -++ * @return the MPLS struct -++ * -++ * Lifetime of the MPLS pointer is limited to the lifetime of the BD title -++ */ -++struct mpls_pl* bd_get_title_mpls(BLURAY * bd); -+ -+ #ifdef __cplusplus -+ } -+diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c -+index defa084..375e6c3 100644 -+--- a/src/libbluray/disc/disc.c -++++ b/src/libbluray/disc/disc.c -+@@ -69,7 +69,7 @@ static BD_FILE_H *_bdrom_open_path(void *p, const char *rel_path) -+ return NULL; -+ } -+ -+- fp = file_open(abs_path, "rb"); -++ fp = file_open(abs_path, "rbS"); -+ X_FREE(abs_path); -+ -+ return fp; - -From 10e05003e7721f2e77e20c286b1849c22ef1e5f6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 6 Mar 2016 12:54:59 +0000 -Subject: [PATCH 49/62] mvc: Automatically enable stereo mode - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 6 +++++- - xbmc/cores/omxplayer/OMXVideo.cpp | 6 +++++- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index c43952d4d29b42f3a5c7605573294568f79ca010..68459e35bc2cda048c150c7079fb30eb0ffb823c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -403,13 +403,17 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - switch (hints.codec) - { - case AV_CODEC_ID_H264: -+ case AV_CODEC_ID_H264_MVC: - // H.264 - m_codingType = MMAL_ENCODING_H264; - m_pFormatName = "mmal-h264"; -- if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) -+ if ((hints.codec_tag == MKTAG('M', 'V', 'C', '1') || hints.codec_tag == MKTAG('A', 'M', 'V', 'C')) && -+ CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) - { - m_codingType = MMAL_ENCODING_MVC; - m_pFormatName= "mmal-mvc"; -+ if (hints.stereo_mode == "mono") -+ hints.stereo_mode = "mvc_lr"; - } - break; - case AV_CODEC_ID_H263: -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 311dd6689236d660919c4c4483c51dca2752514a..536332c43e22ccb229e72b88518e54dd8a23ac41 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -398,6 +398,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool hdmi_clock_syn - switch (hints.codec) - { - case AV_CODEC_ID_H264: -+ case AV_CODEC_ID_H264_MVC: - { - switch(hints.profile) - { -@@ -434,10 +435,13 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool hdmi_clock_syn - break; - } - } -- if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) -+ if ((hints.codec_tag == MKTAG('M', 'V', 'C', '1') || hints.codec_tag == MKTAG('A', 'M', 'V', 'C')) && -+ CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) - { - m_codingType = OMX_VIDEO_CodingMVC; - m_video_codec_name = "omx-mvc"; -+ if (hints.stereo_mode == "mono") -+ hints.stereo_mode = "mvc_lr"; - } - break; - case AV_CODEC_ID_MPEG4: - -From 1707fe3577c485f641a9b44974bdd72658f2ba05 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 24 Mar 2016 13:02:58 +0000 -Subject: [PATCH 50/62] ffmpeg: mvc: fix for pixelation from packets with no - pts/dts - ---- - .../73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch | 24 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 4 +++- - 2 files changed, 27 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch - -diff --git a/tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch b/tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..5240cf58ce40c28d12354db63b7e29143ba46978 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch -@@ -0,0 +1,24 @@ -+From 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105 Mon Sep 17 00:00:00 2001 -+From: Hendrik Leppkes -+Date: Mon, 1 Sep 2014 11:39:09 +0200 -+Subject: [PATCH] h264_parser: force grabing a new timestamp until a frame -+ start was found -+ -+--- -+ libavcodec/h264_parser.c | 3 +++ -+ 1 file changed, 3 insertions(+) -+ -+diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -+index 2fd3f2b..7165652 100644 -+--- a/libavcodec/h264_parser.c -++++ b/libavcodec/h264_parser.c -+@@ -525,6 +525,9 @@ static int h264_parse(AVCodecParserContext *s, -+ } else { -+ next = h264_find_frame_end(p, buf, buf_size); -+ -++ if (next == END_NOT_FOUND && pc->frame_start_found == 0) -++ s->fetch_timestamp = 1; -++ -+ if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { -+ *poutbuf = NULL; -+ *poutbuf_size = 0; -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 7e97e4d91a443d46d933df528763422ff5e8f4fa..d4f279fd4f2ceb260698cd6fedb124bae61018d0 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -6,7 +6,8 @@ DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - pfcd_hevc_optimisations.patch \ - 0001-Squashed-commit-of-the-following.patch \ - 0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch 0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch \ -- h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -+ h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch \ -+ 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -95,6 +96,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch - cd $(PLATFORM); patch -p1 < ../0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch - cd $(PLATFORM); patch -p1 < ../h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -+ cd $(PLATFORM); patch -p1 < ../73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - -From 0043ac6433c7b39bbf2eb1da01b83ffc491faf07 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 11 Nov 2016 15:53:53 +0000 -Subject: [PATCH 51/62] stereoscopicmanager: fixups for rbp - ---- - xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp | 61 ++++++++++++++++++++++ - xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h | 4 ++ - .../VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 9 +++- - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h | 1 + - xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in | 2 +- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 5 ++ - xbmc/cores/omxplayer/OMXPlayerVideo.h | 1 + - xbmc/cores/omxplayer/OMXVideo.cpp | 2 +- - xbmc/guilib/StereoscopicsManager.cpp | 3 ++ - 9 files changed, 84 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp -index ac4e063460a39888a1a1113aab37b74cbf0a0766..0d88acfb85333e88b3774144499eb4421abc4566 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp -@@ -24,6 +24,7 @@ - #include "utils/log.h" - #include "cores/FFmpeg.h" - #include "Util.h" -+#include - - #ifdef TARGET_WINDOWS - #pragma comment(lib, "avcodec.lib") -@@ -37,6 +38,7 @@ - - extern "C" { - #include "libswscale/swscale.h" -+#include "libavutil/intreadwrite.h" - } - - // allocate a new picture (AV_PIX_FMT_YUV420P) -@@ -402,6 +404,65 @@ double CDVDCodecUtils::NormalizeFrameduration(double frameduration, bool *match) - } - } - -+bool CDVDCodecUtils::IsH264AnnexB(std::string format, AVStream *avstream) -+{ -+ assert(avstream->codec->codec_id == AV_CODEC_ID_H264 || avstream->codec->codec_id == AV_CODEC_ID_H264_MVC); -+ if (avstream->codec->extradata_size < 4) -+ return true; -+ if (avstream->codec->extradata[0] == 1) -+ return false; -+ if (format == "avi") -+ { -+ BYTE *src = avstream->codec->extradata; -+ unsigned startcode = AV_RB32(src); -+ if (startcode == 0x00000001 || (startcode & 0xffffff00) == 0x00000100) -+ return true; -+ if (avstream->codec->codec_tag == MKTAG('A', 'V', 'C', '1') || avstream->codec->codec_tag == MKTAG('a', 'v', 'c', '1')) -+ return false; -+ } -+ return true; -+} -+ -+bool CDVDCodecUtils::ProcessH264MVCExtradata(uint8_t *data, int data_size, uint8_t **mvc_data, int *mvc_data_size) -+{ -+ uint8_t* extradata = data; -+ int extradata_size = data_size; -+ -+ if (extradata_size > 4 && *(char *)extradata == 1) -+ { -+ // Find "mvcC" atom -+ uint32_t state = -1; -+ int i = 0; -+ for (; i < extradata_size; i++) -+ { -+ state = (state << 8) | extradata[i]; -+ if (state == MKBETAG('m', 'v', 'c', 'C')) -+ break; -+ } -+ if (i >= 8 && i < extradata_size) -+ { -+ // Update pointers to the start of the mvcC atom -+ extradata = extradata + i - 7; -+ extradata_size = extradata_size - i + 7; -+ // verify size atom and actual size -+ if (extradata_size >= 14 && (AV_RB32(extradata) + 4) <= extradata_size) -+ { -+ extradata += 8; -+ extradata_size -= 8; -+ if (*(char *)extradata == 1) -+ { -+ if (mvc_data) -+ *mvc_data = extradata; -+ if (mvc_data_size) -+ *mvc_data_size = extradata_size; -+ return true; -+ } -+ } -+ } -+ } -+ return false; -+} -+ - struct EFormatMap { - AVPixelFormat pix_fmt; - ERenderFormat format; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h -index 361c96623660305fc393273b1eaea4db096c417d..8ec50bbf79e9e163ccae25e30f3a40bfbb0d3450 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h -@@ -28,6 +28,7 @@ extern "C" { - } - - struct YV12Image; -+class AVStream; - - class CDVDCodecUtils - { -@@ -46,6 +47,9 @@ public: - - static double NormalizeFrameduration(double frameduration, bool *match = NULL); - -+ static bool IsH264AnnexB(std::string format, AVStream *avstream); -+ static bool ProcessH264MVCExtradata(uint8_t *extradata, int extradata_size, uint8_t **mvc_extradata = nullptr, int *mvc_extradata_size = nullptr); -+ - static ERenderFormat EFormatFromPixfmt(int fmt); - static AVPixelFormat PixfmtFromEFormat(ERenderFormat format); - }; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index 68459e35bc2cda048c150c7079fb30eb0ffb823c..dca872373080156100618d58d9782e2461fa2648 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -362,6 +362,11 @@ bool CMMALVideo::SendCodecConfigData() - return true; - } - -+bool CMMALVideo::SupportsExtention() -+{ -+ return CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC); -+} -+ - bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - { - CSingleLock lock(m_sharedSection); -@@ -408,12 +413,12 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - m_codingType = MMAL_ENCODING_H264; - m_pFormatName = "mmal-h264"; - if ((hints.codec_tag == MKTAG('M', 'V', 'C', '1') || hints.codec_tag == MKTAG('A', 'M', 'V', 'C')) && -- CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) -+ SupportsExtention()) - { - m_codingType = MMAL_ENCODING_MVC; - m_pFormatName= "mmal-mvc"; - if (hints.stereo_mode == "mono") -- hints.stereo_mode = "mvc_lr"; -+ hints.stereo_mode = "block_lr"; - } - break; - case AV_CODEC_ID_H263: -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h -index baff1f031149da5d669536711cc0057b2db078e3..1e49f09574c2a93b938d5eb405ebcb06543dec01 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h -@@ -104,6 +104,7 @@ public: - virtual bool GetCodecStats(double &pts, int &droppedPics); - virtual void SetCodecControl(int flags); - virtual void SetSpeed(int iSpeed); -+ virtual bool SupportsExtention(); - - // MMAL decoder callback routines. - void dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -index 0359426b85683a4c3a80ef0e0d52f7a79564daaa..7d19ec3c56fdea514628d27cf36e641707be030f 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -@@ -11,7 +11,7 @@ SRCS += DVDDemuxVobsub.cpp - SRCS += DVDDemuxCC.cpp - SRCS += DVDFactoryDemuxer.cpp - SRCS += DemuxStreamSSIF.cpp --SRCS += DVDDemuxMVC.cpp -+SRCS += DemuxMVC.cpp - - LIB = DVDDemuxers.a - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index f6fb241dfec9269f4e501248de4dc83d5fdc2d3a..58ad6672e3351edbec537ad5b142ff14cb7389ea 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -111,6 +111,11 @@ OMXPlayerVideo::~OMXPlayerVideo() - CloseStream(false); - } - -+bool OMXPlayerVideo::SupportsExtention() const -+{ -+ return CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC); -+} -+ - bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints) - { - m_hints = hints; -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h -index b5050081c360d29b1b478c27e6b88291e20ecdac..c880fa6bbb128b99f8a5393056586821143d99ff 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.h -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h -@@ -96,6 +96,7 @@ public: - void WaitForBuffers() { m_messageQueue.WaitUntilEmpty(); } - int GetLevel() const { return m_messageQueue.GetLevel(); } - bool IsStalled() const { return m_stalled; } -+ bool SupportsExtention() const; - bool IsEOS(); - void CloseStream(bool bWaitForBuffers); - void Output(double pts, bool bDropPacket); -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 536332c43e22ccb229e72b88518e54dd8a23ac41..39bc0530cecd54ae8c3a5481c92f1a6a18a4d9c5 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -441,7 +441,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool hdmi_clock_syn - m_codingType = OMX_VIDEO_CodingMVC; - m_video_codec_name = "omx-mvc"; - if (hints.stereo_mode == "mono") -- hints.stereo_mode = "mvc_lr"; -+ hints.stereo_mode = "block_lr"; - } - break; - case AV_CODEC_ID_MPEG4: -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index 6aaa82f4d883b8cae0ccdedf6c5a6814e7aaa720..cc929b599125a44ac128713fd4331782d9931791 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -70,10 +70,13 @@ static const struct StereoModeMap VideoModeToGuiModeMap[] = - { "anaglyph_cyan_red", RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN }, - { "anaglyph_green_magenta", RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA }, - { "anaglyph_yellow_blue", RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE }, -+#ifndef TARGET_RASPBERRY_PI - { "block_lr", RENDER_STEREO_MODE_HARDWAREBASED }, - { "block_rl", RENDER_STEREO_MODE_HARDWAREBASED }, -+#else - { "block_lr", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback - { "block_rl", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback -+#endif - {} - }; - - -From 56bda93bf04b76e40175db4eebfe7fa26585b90b Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 10 Mar 2016 18:11:33 +0300 -Subject: [PATCH 52/62] fixup! Revert supporting crappy tab/sbs subtitles. this - fixes regular subtitles. - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -index a8323f419e404037c4e5fb4d78fa1b45409337a7..7c0b70777556ac7694e7fc511cd4bb189fc42e08 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -@@ -290,6 +290,7 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay() - - m_SubtitleIndex++; - -+ CLog::Log(LOGDEBUG, "Overlay: x:%d y:%d w:%d h:%d", overlay->x, overlay->y, overlay->width, overlay->height); - return overlay; - } - - -From 40f9ac9217dbe0a5f3ea5d7e8f6b36f79d9455fe Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Nov 2016 18:24:18 +0000 -Subject: [PATCH 53/62] DemuxMVC: fixup after SeekTime API change - ---- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp | 2 +- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -index ade6a4454fc3915b0c787b1a4f72aedbd74903db..baefe44ca932ee98e482f1bed70d8949be71cfac 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -@@ -188,7 +188,7 @@ DemuxPacket* CDemuxMVC::Read() - return nullptr; - } - --bool CDemuxMVC::SeekTime(int time, bool backwords, double* startpts) -+bool CDemuxMVC::SeekTime(double time, bool backwords, double* startpts) - { - if (!m_pInput) - return false; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -index bbb836a61344689a83af68c821c05c212a86b097..54f91a02391368fbfbb4d669c003f42568347f62 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -@@ -36,7 +36,7 @@ public: - virtual void Abort(); - virtual void Flush(); - virtual DemuxPacket* Read(); -- virtual bool SeekTime(int time, bool backwords = false, double* startpts = nullptr); -+ virtual bool SeekTime(double time, bool backwords = false, double* startpts = nullptr); - virtual void SetSpeed(int iSpeed) { }; - virtual int GetStreamLength() { return 0; }; - virtual CDemuxStream* GetStream(int iStreamId) const override { return nullptr; }; - -From 07af63a05c028937005d37d901c1e3be4aaa8784 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 23:17:46 +0000 -Subject: [PATCH 54/62] [cec] Don't discard buttons when repeat mode is enabled - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 30367a3fde956090afdca9930fa52e829f35046f..febacb3b7964eab3b8615a6a807e0f27d911b4da 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -803,7 +803,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); - - CSingleLock lock(m_critSection); -- if (key.iDuration > 0) -+ // avoid the queue getting too long -+ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) -+ return; -+ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) - { - if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) - { - -From 4066e9289576eb4def863476331d73d081f9ac85 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 4 Nov 2014 18:50:00 +0000 -Subject: [PATCH 55/62] [cec] Temp - more logging - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index febacb3b7964eab3b8615a6a807e0f27d911b4da..52d6e6a7ab68ce91faf5a3881b23ea7adde96cb8 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -800,12 +800,15 @@ void CPeripheralCecAdapter::GetNextKey(void) - - void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - { -- CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); -+ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d (rep:%d size:%d)", __FUNCTION__, key.iButton, key.iDuration, m_configuration.iButtonRepeatRateMs, m_buttonQueue.size()); - - CSingleLock lock(m_critSection); - // avoid the queue getting too long - if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) -+ { -+ CLog::Log(LOGDEBUG, "%s - discarded key %2x", __FUNCTION__, key.iButton); - return; -+ } - if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) - { - if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) -@@ -814,6 +817,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - if (m_bHasButton) - m_currentButton.iDuration = key.iDuration; - // ignore this one, since it's already been handled by xbmc -+ CLog::Log(LOGDEBUG, "%s - ignored key %2x", __FUNCTION__, key.iButton); - return; - } - // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it -@@ -824,6 +828,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - if ((*it).iDuration == 0) - { - // replace this entry -+ CLog::Log(LOGDEBUG, "%s - replaced key %2x", __FUNCTION__, key.iButton); - (*it).iDuration = key.iDuration; - return; - } -@@ -833,6 +838,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - } - } - -+ CLog::Log(LOGDEBUG, "%s - added key %2x", __FUNCTION__, key.iButton); - m_buttonQueue.push_back(key); - } - - -From 9771f5dd741a349b93481848ea2be760106755bc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 25 May 2016 18:31:17 +0100 -Subject: [PATCH 56/62] rbp: Hard code the number of buffers to improve audio - sync - ---- - system/settings/rbp.xml | 6 ++++++ - xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp | 4 ++++ - 2 files changed, 10 insertions(+) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 7098edf32dff8c00e192229c3ffb060be6a42482..0ce6735e11fabd1d07a4860b9d985a4e1fd5f35a 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -85,6 +85,12 @@ - - - -+ -+ -+ false -+ 2 -+ -+ - - - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -index 8626a1b449ff0963089f6a7ad191a6c99512521a..53fc987b4ebb0555a804477bfb5b1d8443a98bcd 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -@@ -1067,7 +1067,11 @@ void CRenderManager::UpdateDisplayLatency() - refresh = 0; // No idea about refresh rate when windowed, just get the default latency - m_displayLatency = (double) g_advancedSettings.GetDisplayLatency(refresh); - -+#ifdef TARGET_RASPBERRY_PI -+ int buffers = CSettings::GetInstance().GetBool("videoplayer.usedisplayasclock") ? 1:2; -+#else - int buffers = g_Windowing.NoOfBuffers(); -+#endif - m_displayLatency += (buffers - 1) / fps; - - } - -From 77b9beb43349ae1335090f53d2a4d4f08aff928e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 4 Jul 2016 18:30:03 +0100 -Subject: [PATCH 57/62] rbp: Update the GL libs to new naming scheme - -As the opensource mesa GL library is getting more usable, the name collision wih the firmware GL driver is causing issues. -As such we are renaming the firmware GL driver to avoid this. - -The new names are libbrcmEGL.so and libbrcmGLESv2.so. Both will be supported for some time, but the original name -will be dropped at some point ---- - configure.ac | 2 +- - project/cmake/modules/FindOpenGLES.cmake | 6 +++--- - tools/depends/configure.ac | 2 +- - 3 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/configure.ac b/configure.ac -index d2186cbda52213aa85b5734b6c8f45a69e5e2e20..75e264b24629480880d4ea758c25db26c754bc9b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -949,7 +949,7 @@ if test "$use_gles" = "yes"; then - AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) - AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) - AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) -- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" -+ LIBS="$LIBS -lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" - else - AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) - AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) -diff --git a/project/cmake/modules/FindOpenGLES.cmake b/project/cmake/modules/FindOpenGLES.cmake -index ab06f968b3e314fca1ae001139f687dce9a5098b..87f1faa248b91a2e50758b23c0b9e5b09e4a69ff 100644 ---- a/project/cmake/modules/FindOpenGLES.cmake -+++ b/project/cmake/modules/FindOpenGLES.cmake -@@ -13,7 +13,7 @@ - find_package(EMBEDDED) - - if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi") -- pkg_check_modules(PC_OPENGLES glesv2 QUIET) -+ pkg_check_modules(PC_OPENGLES brcmglesv2 QUIET) - if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND) - set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH}) - endif() -@@ -22,9 +22,9 @@ endif() - if(NOT CORE_SYSTEM_NAME STREQUAL ios) - find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h - PATHS ${PC_OPENGLES_INCLUDEDIR}) -- find_library(OPENGLES_gl_LIBRARY NAMES GLESv2 -+ find_library(OPENGLES_gl_LIBRARY NAMES brcmGLESv2 - PATHS ${PC_OPENGLES_LIBDIR}) -- find_library(OPENGLES_egl_LIBRARY NAMES EGL -+ find_library(OPENGLES_egl_LIBRARY NAMES brcmEGL - PATHS ${PC_OPENGLES_LIBDIR}) - else() - find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES -diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac -index 3626ea5204eb561dc1ae0b64c6bb7253d2ec59ec..100ff3178bafe7434bd5456100b5bb7189a5378d 100644 ---- a/tools/depends/configure.ac -+++ b/tools/depends/configure.ac -@@ -433,7 +433,7 @@ if test "$target_platform" = "raspberry-pi" ; then - -isystem${use_firmware}/opt/vc/include \ - -isystem${use_firmware}/opt/vc/include/interface/vcos/pthreads \ - -isystem${use_firmware}/opt/vc/include/interface/vmcs_host/linux" -- platform_ldflags+=" -L${use_firmware}/opt/vc/lib -lEGL -lGLESv2 -lbcm_host -lvcos \ -+ platform_ldflags+=" -L${use_firmware}/opt/vc/lib -lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvcos \ - -lvchiq_arm" - fi - - -From 16d9562395384270f1dca8ef062d0048b08ca2dc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Jun 2016 14:46:01 +0100 -Subject: [PATCH 58/62] ffmpeg: hacky fix for files with GMC - ---- - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 9149698884c8ae6a23649abbaa0e659587dfe982..84d515e9e2df6a4c1c448a52a42f4675deab7991 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1458,8 +1458,8 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - stereoMode = GetStereoModeFromMetadata(m_pFormatContext->metadata); - if (!stereoMode.empty()) - st->stereo_mode = stereoMode; -- -- st->workaround_bugs = pStream->codec->workaround_bugs; -+ AVCodecContext *c = (AVCodecContext *)(((uint32_t *)pStream->internal)[4]); /* Eek! */ -+ st->workaround_bugs = c->workaround_bugs; - if ( m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD) ) - { - if (pStream->codec->codec_id == AV_CODEC_ID_PROBE) - -From 7d20983a4ed4a55b9e465ae121dc621a4527464a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 19 Jul 2016 20:39:18 +0100 -Subject: [PATCH 59/62] mmalrender: Add sharpness control - ---- - addons/resource.language.en_gb/resources/strings.po | 2 +- - .../VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp | 13 ++++++++++++- - .../VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h | 1 + - 3 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 7c7969d381bf15ac1ba2fd8f16e463f6b12fe4c3..45cf0830ea6079a0f2ad22792f2497c5ad53b625 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -8694,7 +8694,7 @@ msgstr "" - - #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp - msgctxt "#16313" --msgid "VDPAU - Sharpness" -+msgid "Sharpness" - msgstr "" - - #empty string with id 16314 -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp -index 84953d116610e9fd262de968ffe26d6063a9193b..f5f0f0d01227b3b4dcebb4a22a54dbcaac2d5ee9 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp -@@ -411,6 +411,7 @@ CMMALRenderer::CMMALRenderer() : CThread("MMALRenderer"), m_processThread(this, - m_frameInterval = 0.0; - m_frameIntervalDiff = 1e5; - m_vsync_count = ~0U; -+ m_sharpness = -2.0f; - m_vout_width = 0; - m_vout_height = 0; - m_vout_aligned_width = 0; -@@ -847,6 +848,15 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - goto exit; - } - -+ // if sharpness setting has changed, we should update it -+ if (m_sharpness != CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Sharpness) -+ { -+ m_sharpness = CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Sharpness; -+ char command[80], response[80]; -+ sprintf(command, "scaling_sharpness %d", ((int)(50.0f * (m_sharpness + 1.0f) + 0.5f))); -+ vc_gencmd(response, sizeof response, command); -+ } -+ - if (m_format != RENDER_FMT_MMAL) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -1023,7 +1033,8 @@ bool CMMALRenderer::Supports(ERENDERFEATURE feature) - feature == RENDERFEATURE_ZOOM || - feature == RENDERFEATURE_ROTATION || - feature == RENDERFEATURE_VERTICAL_SHIFT || -- feature == RENDERFEATURE_PIXEL_RATIO) -+ feature == RENDERFEATURE_PIXEL_RATIO || -+ feature == RENDERFEATURE_SHARPNESS) - return true; - - return false; -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h -index e0e6f7c0e0546013ca74265aef54704fd332f8e4..69eae6cbef0131d20dc979dcb35915cd73967592 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h -@@ -140,6 +140,7 @@ protected: - RENDER_STEREO_MODE m_video_stereo_mode; - RENDER_STEREO_MODE m_display_stereo_mode; - bool m_StereoInvert; -+ float m_sharpness; - - CCriticalSection m_sharedSection; - MMAL_COMPONENT_T *m_vout; - -From 4767086e68edac21dc112be1262e38c5c83d1aea Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 14 Oct 2016 15:37:53 +0100 -Subject: [PATCH 60/62] MMALFFMpeg: Report as SW decode in codec overlay info - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 619515c9411172261d8f0bef24c5d679c35e5d7d..b31c984c0a507891f2754146a4c62802f0096505 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -579,7 +579,7 @@ void CDVDVideoCodecFFmpeg::UpdateName() - if(m_pHardware) - m_name += "-" + m_pHardware->Name(); - -- m_processInfo.SetVideoDecoderName(m_name, m_pHardware ? true : false); -+ m_processInfo.SetVideoDecoderName(m_name, m_pHardware && m_pHardware->Name() != "mmal" ? true : false); - - CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - Updated codec: %s", m_name.c_str()); - } - -From bc4cb4cb7618aecf4735f783e5ef97f0cae72d83 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Nov 2016 18:28:01 +0000 -Subject: [PATCH 61/62] advancedsettings: Add option to set cache size on - libass - -E.g to set total cache size in libass to 32M - - - 32 - - -When unset it defaults to 192M ---- - xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp | 3 +++ - xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h | 3 +++ - xbmc/settings/AdvancedSettings.cpp | 5 +++++ - xbmc/settings/AdvancedSettings.h | 2 ++ - 4 files changed, 13 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp b/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp -index 0f5e1ace4c85f65a0ab5dbd8e6f1c2715d60467d..7a236080bc96466d34e14b9b0d82ba4084276abd 100644 ---- a/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp -+++ b/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp -@@ -28,6 +28,7 @@ - #include "utils/StringUtils.h" - #include "threads/SingleLock.h" - #include "guilib/GraphicContext.h" -+#include "settings/AdvancedSettings.h" - - static void libass_log(int level, const char *fmt, va_list args, void *data) - { -@@ -75,6 +76,8 @@ CDVDSubtitlesLibass::CDVDSubtitlesLibass() - if(!m_renderer) - return; - -+ m_dll.ass_set_cache_limits(m_renderer, 0, g_advancedSettings.m_libAssCache); -+ - //Setting default font to the Arial in \media\fonts (used if FontConfig fails) - strPath = URIUtils::AddFileToFolder("special://home/media/Fonts/", CSettings::GetInstance().GetString(CSettings::SETTING_SUBTITLES_FONT)); - if (!XFILE::CFile::Exists(strPath)) -diff --git a/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h b/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h -index f9de4f15e7c612d69ef46e7cad870ecb61afaec3..b5303fd100f1a930eb5c010a951932064d5190c4 100644 ---- a/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h -+++ b/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h -@@ -64,6 +64,7 @@ public: - virtual void ass_set_message_cb(ASS_Library *priv - , void (*msg_cb)(int level, const char *fmt, va_list args, void *data) - , void *data)=0; -+ virtual void ass_set_cache_limits(ASS_Renderer *render_priv, int glyph_max, int bitmap_max)=0; - }; - - class DllLibass : public DllDynamic, DllLibassInterface -@@ -91,6 +92,7 @@ class DllLibass : public DllDynamic, DllLibassInterface - DEFINE_METHOD5(void, ass_process_chunk, (ASS_Track* p1, char* p2, int p3, long long p4, long long p5)) - DEFINE_METHOD3(void, ass_process_codec_private, (ASS_Track* p1, char* p2, int p3)) - DEFINE_METHOD3(void, ass_set_message_cb, (ASS_Library* p1, void (*p2)(int level, const char *fmt, va_list args, void *data), void* p3)) -+ DEFINE_METHOD3(void, ass_set_cache_limits, (ASS_Renderer *p1, int p2, int p3)) - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(ass_set_extract_fonts) - RESOLVE_METHOD(ass_set_fonts_dir) -@@ -114,5 +116,6 @@ class DllLibass : public DllDynamic, DllLibassInterface - RESOLVE_METHOD(ass_process_chunk) - RESOLVE_METHOD(ass_process_codec_private) - RESOLVE_METHOD(ass_set_message_cb) -+ RESOLVE_METHOD(ass_set_cache_limits) - END_METHOD_RESOLVE() - }; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 985ecf9722141d78471c00e90da15bfad931462a..a33581ba02a26110105a2d0ae810d96c410efbf1 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -364,6 +364,8 @@ void CAdvancedSettings::Initialize() - #else - m_cacheMemSize = 1024 * 1024 * 20; - #endif -+ m_libAssCache = 0; -+ - m_cacheBufferMode = CACHE_BUFFER_MODE_INTERNET; // Default (buffer all internet streams/filesystems) - // the following setting determines the readRate of a player data - // as multiply of the default data read rate -@@ -1026,6 +1028,9 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) - XMLUtils::GetFloat(pRootElement, "controllerdeadzone", m_controllerDeadzone, 0.0f, 1.0f); - XMLUtils::GetUInt(pRootElement, "fanartres", m_fanartRes, 0, 1080); - XMLUtils::GetUInt(pRootElement, "imageres", m_imageRes, 0, 1080); -+ -+ XMLUtils::GetUInt(pRootElement, "libasscache", m_libAssCache, 0, 1024); -+ - if (XMLUtils::GetString(pRootElement, "imagescalingalgorithm", tmp)) - m_imageScalingAlgorithm = CPictureScalingAlgorithm::FromString(tmp); - XMLUtils::GetBoolean(pRootElement, "playlistasfolders", m_playlistAsFolders); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 6b0e3b8cf9e3ff40e6af758c54fe7eefb89a131c..35bf38719f0eaaa5ac29e9495480ae97f6aceca7 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -345,6 +345,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - unsigned int m_cacheBufferMode; - float m_cacheReadFactor; - -+ unsigned int m_libAssCache; -+ - bool m_jsonOutputCompact; - unsigned int m_jsonTcpPort; - - -From 567ad87b2bdbf86ae8540720c58716fd4f3ac46b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 13 Nov 2016 20:30:15 +0000 -Subject: [PATCH 62/62] [rbp] Experimental limit libass cache size depending on - arm memory size - ---- - xbmc/linux/RBP.cpp | 4 +++- - xbmc/settings/AdvancedSettings.cpp | 2 ++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 6e8529001b1a464b4547a846f553d98f5bc0b6c0..238eba372af2cbab11d7543c857ee47640901d13 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -65,6 +65,8 @@ void CRBP::InitializeSettings() - { - if (m_initialized && g_advancedSettings.m_cacheMemSize == ~0U) - g_advancedSettings.m_cacheMemSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; -+ if (m_initialized && g_advancedSettings.m_libAssCache == ~0U) -+ g_advancedSettings.m_libAssCache = m_arm_mem < 256 ? 21 : m_arm_mem < 512 ? 42 : 96; - } - - bool CRBP::Initialize() -@@ -120,7 +122,7 @@ void CRBP::LogFirmwareVerison() - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); - CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); -- CLog::Log(LOGNOTICE, "cache.memorysize: %dMB", g_advancedSettings.m_cacheMemSize >> 20); -+ CLog::Log(LOGNOTICE, "cache.memorysize: %dMB libass.cache: %dMB", g_advancedSettings.m_cacheMemSize >> 20, g_advancedSettings.m_libAssCache); - m_DllBcmHost->vc_gencmd(response, sizeof response, "get_config int"); - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Config:\n%s", response); -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index a33581ba02a26110105a2d0ae810d96c410efbf1..d70e2cf3113bbe0dad60dfc7accc8d77f7f30c30 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -361,8 +361,10 @@ void CAdvancedSettings::Initialize() - #ifdef TARGET_RASPBERRY_PI - // want default to be memory dependent, but interface to gpu not available yet, so set in RBP.cpp - m_cacheMemSize = ~0; -+ m_libAssCache = ~0; - #else - m_cacheMemSize = 1024 * 1024 * 20; -+ m_libAssCache = 0; - #endif - m_libAssCache = 0; - diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch deleted file mode 100644 index 53be0e10d6..0000000000 --- a/projects/RPi/patches/linux/linux-01-RPi_support.patch +++ /dev/null @@ -1,127016 +0,0 @@ -From 726155a02a2642c4f992655ae4a4c062a0761260 Mon Sep 17 00:00:00 2001 -From: Steve Glendinning -Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/122] smsx95xx: fix crimes against truesize - -smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. - -This patch stops smsc95xx from changing truesize. - -Signed-off-by: Steve Glendinning ---- - drivers/net/usb/smsc95xx.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 831aa33d078ae7d2dd57fdded5de71d1eb915f99..b77935bded8c0ff7808b00f170ff10e594300ad0 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -82,6 +82,10 @@ static bool turbo_mode = true; - module_param(turbo_mode, bool, 0644); - MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); - -+static bool truesize_mode = false; -+module_param(truesize_mode, bool, 0644); -+MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); -+ - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -1951,7 +1955,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(skb); - skb_trim(skb, skb->len - 4); /* remove fcs */ -- skb->truesize = size + sizeof(struct sk_buff); -+ if (truesize_mode) -+ skb->truesize = size + sizeof(struct sk_buff); - - return 1; - } -@@ -1969,7 +1974,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(ax_skb); - skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ -- ax_skb->truesize = size + sizeof(struct sk_buff); -+ if (truesize_mode) -+ ax_skb->truesize = size + sizeof(struct sk_buff); - - usbnet_skb_return(dev, ax_skb); - } - -From f1afc1dcb1c34955d1a9d756abb1b61c3a9f1da8 Mon Sep 17 00:00:00 2001 -From: Sam Nazarko -Date: Fri, 1 Apr 2016 17:27:21 +0100 -Subject: [PATCH 002/122] smsc95xx: Experimental: Enable turbo_mode and - packetsize=2560 by default - -See: http://forum.kodi.tv/showthread.php?tid=285288 ---- - drivers/net/usb/smsc95xx.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index b77935bded8c0ff7808b00f170ff10e594300ad0..693f163684de921404738e33244881e0aab92ec9 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -86,6 +86,10 @@ static bool truesize_mode = false; - module_param(truesize_mode, bool, 0644); - MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); - -+static int packetsize = 2560; -+module_param(packetsize, int, 0644); -+MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); -+ - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -1106,13 +1110,13 @@ static int smsc95xx_reset(struct usbnet *dev) - - if (!turbo_mode) { - burst_cap = 0; -- dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE; -+ dev->rx_urb_size = packetsize ? packetsize : MAX_SINGLE_PACKET_SIZE; - } else if (dev->udev->speed == USB_SPEED_HIGH) { -- burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; -- dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE; -+ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_HS_BURST_CAP_SIZE; -+ burst_cap = dev->rx_urb_size / HS_USB_PKT_SIZE; - } else { -- burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE; -- dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; -+ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_FS_BURST_CAP_SIZE; -+ burst_cap = dev->rx_urb_size / FS_USB_PKT_SIZE; - } - - netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", - -From 69f6712212df74f6c27b1dfec7e3cc1408416653 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 003/122] Allow mac address to be set in smsc95xx - -Signed-off-by: popcornmix ---- - drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 693f163684de921404738e33244881e0aab92ec9..df60c989fc229bf0aab3c27e95ccd45323367840 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -60,6 +60,7 @@ - #define SUSPEND_SUSPEND3 (0x08) - #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ - SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) -+#define MAC_ADDR_LEN (6) - - #define CARRIER_CHECK_DELAY (2 * HZ) - -@@ -90,6 +91,10 @@ static int packetsize = 2560; - module_param(packetsize, int, 0644); - MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); - -+static char *macaddr = ":"; -+module_param(macaddr, charp, 0); -+MODULE_PARM_DESC(macaddr, "MAC address"); -+ - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -918,6 +923,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) - return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); - } - -+/* Check the macaddr module parameter for a MAC address */ -+static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) -+{ -+ int i, j, got_num, num; -+ u8 mtbl[MAC_ADDR_LEN]; -+ -+ if (macaddr[0] == ':') -+ return 0; -+ -+ i = 0; -+ j = 0; -+ num = 0; -+ got_num = 0; -+ while (j < MAC_ADDR_LEN) { -+ if (macaddr[i] && macaddr[i] != ':') { -+ got_num++; -+ if ('0' <= macaddr[i] && macaddr[i] <= '9') -+ num = num * 16 + macaddr[i] - '0'; -+ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') -+ num = num * 16 + 10 + macaddr[i] - 'A'; -+ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') -+ num = num * 16 + 10 + macaddr[i] - 'a'; -+ else -+ break; -+ i++; -+ } else if (got_num == 2) { -+ mtbl[j++] = (u8) num; -+ num = 0; -+ got_num = 0; -+ i++; -+ } else { -+ break; -+ } -+ } -+ -+ if (j == MAC_ADDR_LEN) { -+ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " -+ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], -+ mtbl[3], mtbl[4], mtbl[5]); -+ for (i = 0; i < MAC_ADDR_LEN; i++) -+ dev_mac[i] = mtbl[i]; -+ return 1; -+ } else { -+ return 0; -+ } -+} -+ - static void smsc95xx_init_mac_address(struct usbnet *dev) - { - const u8 *mac_addr; -@@ -939,6 +991,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) - } - } - -+ /* Check module parameters */ -+ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -+ return; -+ - /* no useful static MAC address found. generate a random one */ - eth_hw_addr_random(dev->net); - netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); - -From 10945e4697799ceff36fbdea420081b746d67429 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 13 Mar 2015 12:43:36 +0000 -Subject: [PATCH 004/122] Protect __release_resource against resources without - parents - -Without this patch, removing a device tree overlay can crash here. - -Signed-off-by: Phil Elwell ---- - kernel/resource.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/kernel/resource.c b/kernel/resource.c -index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b4010644bdc882 100644 ---- a/kernel/resource.c -+++ b/kernel/resource.c -@@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) - { - struct resource *tmp, **p, *chd; - -+ if (!old->parent) { -+ WARN(old->sibling, "sibling but no parent"); -+ if (old->sibling) -+ return -EINVAL; -+ return 0; -+ } - p = &old->parent->child; - for (;;) { - tmp = *p; - -From ab1aef30de5e9424f87d7d6e1edb1a5240a76ae5 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 005/122] mm: Remove the PFN busy warning - -See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is -expected sometimes when using CMA. However, that commit still spams -my kernel log with these warnings. - -Signed-off-by: Eric Anholt ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 34ada718ef47c4b27730214d584f9350fefb9883..3fa01a5280db96075798e4cbd58d5520ddf36d88 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -7297,8 +7297,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } - -From a1c2520dc2663b442e4b43010df6917f233ff40e Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 006/122] irq-bcm2836: Prevent spurious interrupts, and trap - them early - -The old arch-specific IRQ macros included a dsb to ensure the -write to clear the mailbox interrupt completed before returning -from the interrupt. The BCM2836 irqchip driver needs the same -precaution to avoid spurious interrupts. - -Spurious interrupts are still possible for other reasons, -though, so trap them early. ---- - drivers/irqchip/irq-bcm2836.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c -index d96b2c947e74e3edab3917551c64fbd1ced0f34c..93e3f7660c4230c9f1dd3b195958cb498949b0ca 100644 ---- a/drivers/irqchip/irq-bcm2836.c -+++ b/drivers/irqchip/irq-bcm2836.c -@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) - u32 ipi = ffs(mbox_val) - 1; - - writel(1 << ipi, mailbox0); -+ dsb(sy); - handle_IPI(ipi, regs); - #endif - } else if (stat) { - -From 2d51d14c0cea3d9d52f323b58a0a5d99a65eef24 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 007/122] irqchip: bcm2835: Add FIQ support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add a duplicate irq range with an offset on the hwirq's so the -driver can detect that enable_fiq() is used. -Tested with downstream dwc_otg USB controller driver. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt -Acked-by: Stephen Warren ---- - arch/arm/mach-bcm/Kconfig | 1 + - drivers/irqchip/irq-bcm2835.c | 51 ++++++++++++++++++++++++++++++++++++++----- - 2 files changed, 47 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index a0e66d8200c5cf8f2ea592abf870a32800213fa2..4ff30d5278a7ce093c9629d4c25d37e3bbbda752 100644 ---- a/arch/arm/mach-bcm/Kconfig -+++ b/arch/arm/mach-bcm/Kconfig -@@ -152,6 +152,7 @@ config ARCH_BCM2835 - select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 - select CLKSRC_OF - select BCM2835_TIMER -+ select FIQ - select PINCTRL - select PINCTRL_BCM2835 - help -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index 44d7c38dde479d771f3552e914bf8c1c1f5019f7..42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -54,7 +54,7 @@ - #include - - /* Put the bank and irq (32 bits) into the hwirq */ --#define MAKE_HWIRQ(b, n) ((b << 5) | (n)) -+#define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) - #define HWIRQ_BANK(i) (i >> 5) - #define HWIRQ_BIT(i) BIT(i & 0x1f) - -@@ -70,9 +70,13 @@ - | SHORTCUT1_MASK | SHORTCUT2_MASK) - - #define REG_FIQ_CONTROL 0x0c -+#define REG_FIQ_ENABLE 0x80 -+#define REG_FIQ_DISABLE 0 - - #define NR_BANKS 3 - #define IRQS_PER_BANK 32 -+#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) -+#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) - - static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; - static const int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; -@@ -97,14 +101,38 @@ static void __exception_irq_entry bcm2835_handle_irq( - struct pt_regs *regs); - static void bcm2836_chained_handle_irq(struct irq_desc *desc); - -+static inline unsigned int hwirq_to_fiq(unsigned long hwirq) -+{ -+ hwirq -= NUMBER_IRQS; -+ /* -+ * The hwirq numbering used in this driver is: -+ * BASE (0-7) GPU1 (32-63) GPU2 (64-95). -+ * This differ from the one used in the FIQ register: -+ * GPU1 (0-31) GPU2 (32-63) BASE (64-71) -+ */ -+ if (hwirq >= 32) -+ return hwirq - 32; -+ -+ return hwirq + 64; -+} -+ - static void armctrl_mask_irq(struct irq_data *d) - { -- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); -+ if (d->hwirq >= NUMBER_IRQS) -+ writel_relaxed(REG_FIQ_DISABLE, intc.base + REG_FIQ_CONTROL); -+ else -+ writel_relaxed(HWIRQ_BIT(d->hwirq), -+ intc.disable[HWIRQ_BANK(d->hwirq)]); - } - - static void armctrl_unmask_irq(struct irq_data *d) - { -- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); -+ if (d->hwirq >= NUMBER_IRQS) -+ writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), -+ intc.base + REG_FIQ_CONTROL); -+ else -+ writel_relaxed(HWIRQ_BIT(d->hwirq), -+ intc.enable[HWIRQ_BANK(d->hwirq)]); - } - - static struct irq_chip armctrl_chip = { -@@ -150,8 +178,9 @@ static int __init armctrl_of_init(struct device_node *node, - panic("%s: unable to map IC registers\n", - node->full_name); - -- intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), -- &armctrl_ops, NULL); -+ intc.base = base; -+ intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2, -+ &armctrl_ops, NULL); - if (!intc.domain) - panic("%s: unable to create IRQ domain\n", node->full_name); - -@@ -181,6 +210,18 @@ static int __init armctrl_of_init(struct device_node *node, - set_handle_irq(bcm2835_handle_irq); - } - -+ /* Make a duplicate irq range which is used to enable FIQ */ -+ for (b = 0; b < NR_BANKS; b++) { -+ for (i = 0; i < bank_irqs[b]; i++) { -+ irq = irq_create_mapping(intc.domain, -+ MAKE_HWIRQ(b, i) + NUMBER_IRQS); -+ BUG_ON(irq <= 0); -+ irq_set_chip(irq, &armctrl_chip); -+ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); -+ } -+ } -+ init_FIQ(FIQ_START); -+ - return 0; - } - - -From 2d9b0ef8dc1a5975dfccfb7e78b8f5a94ab5f2bb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 008/122] irqchip: irq-bcm2835: Add 2836 FIQ support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Noralf Trønnes ---- - drivers/irqchip/irq-bcm2835.c | 43 +++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 41 insertions(+), 2 deletions(-) - -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index 42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008..eccf6ed025299cb480884f5bcbe77abf55a6bbb1 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -50,8 +50,11 @@ - #include - #include - #include -+#include -+#include - - #include -+#include - - /* Put the bank and irq (32 bits) into the hwirq */ - #define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) -@@ -69,6 +72,9 @@ - #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \ - | SHORTCUT1_MASK | SHORTCUT2_MASK) - -+#undef ARM_LOCAL_GPU_INT_ROUTING -+#define ARM_LOCAL_GPU_INT_ROUTING 0x0c -+ - #define REG_FIQ_CONTROL 0x0c - #define REG_FIQ_ENABLE 0x80 - #define REG_FIQ_DISABLE 0 -@@ -94,6 +100,7 @@ struct armctrl_ic { - void __iomem *enable[NR_BANKS]; - void __iomem *disable[NR_BANKS]; - struct irq_domain *domain; -+ struct regmap *local_regmap; - }; - - static struct armctrl_ic intc __read_mostly; -@@ -127,12 +134,35 @@ static void armctrl_mask_irq(struct irq_data *d) - - static void armctrl_unmask_irq(struct irq_data *d) - { -- if (d->hwirq >= NUMBER_IRQS) -+ if (d->hwirq >= NUMBER_IRQS) { -+ if (num_online_cpus() > 1) { -+ unsigned int data; -+ int ret; -+ -+ if (!intc.local_regmap) { -+ pr_err("FIQ is disabled due to missing regmap\n"); -+ return; -+ } -+ -+ ret = regmap_read(intc.local_regmap, -+ ARM_LOCAL_GPU_INT_ROUTING, &data); -+ if (ret) { -+ pr_err("Failed to read int routing %d\n", ret); -+ return; -+ } -+ -+ data &= ~0xc; -+ data |= (1 << 2); -+ regmap_write(intc.local_regmap, -+ ARM_LOCAL_GPU_INT_ROUTING, data); -+ } -+ - writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), - intc.base + REG_FIQ_CONTROL); -- else -+ } else { - writel_relaxed(HWIRQ_BIT(d->hwirq), - intc.enable[HWIRQ_BANK(d->hwirq)]); -+ } - } - - static struct irq_chip armctrl_chip = { -@@ -210,6 +240,15 @@ static int __init armctrl_of_init(struct device_node *node, - set_handle_irq(bcm2835_handle_irq); - } - -+ if (is_2836) { -+ intc.local_regmap = -+ syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local"); -+ if (IS_ERR(intc.local_regmap)) { -+ pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n"); -+ intc.local_regmap = NULL; -+ } -+ } -+ - /* Make a duplicate irq range which is used to enable FIQ */ - for (b = 0; b < NR_BANKS; b++) { - for (i = 0; i < bank_irqs[b]; i++) { - -From 39974a29633d89316e5de24d87294b444b24f381 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 009/122] spidev: Add "spidev" compatible string to silence - warning - -See: https://github.com/raspberrypi/linux/issues/1054 ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c -index 2e05046f866bd01bf87edcdeff0d5b76d4d0aea7..d780491b8013a4e97fa843958964454e4463fe5e 100644 ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -696,6 +696,7 @@ static struct class *spidev_class; - static const struct of_device_id spidev_dt_ids[] = { - { .compatible = "rohm,dh2228fv" }, - { .compatible = "lineartechnology,ltc2488" }, -+ { .compatible = "spidev" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); - -From 51c39f512e9b370f126afcdcf6306561ea1f50f2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 010/122] serial: 8250: Don't crash when nr_uarts is 0 - ---- - drivers/tty/serial/8250/8250_core.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c -index 240a361b674fe72ce657067e5303156b7add6a6f..14f6cdfd744209482056d206dc476d9427cba9ba 100644 ---- a/drivers/tty/serial/8250/8250_core.c -+++ b/drivers/tty/serial/8250/8250_core.c -@@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void) - - if (nr_uarts > UART_NR) - nr_uarts = UART_NR; -+ if (!nr_uarts) -+ return; - - for (i = 0; i < nr_uarts; i++) { - struct uart_8250_port *up = &serial8250_ports[i]; - -From f56196076549fabcdf0cca5685d1ea3e0308622a Mon Sep 17 00:00:00 2001 -From: notro -Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 011/122] pinctrl-bcm2835: Set base to 0 give expected gpio - numbering - -Signed-off-by: Noralf Tronnes ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index fa77165fab2c1348163979da507df17e7168c49b..d11e2e4ea189466e686d762cb6c6fef9111ecf8e 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -386,7 +386,7 @@ static struct gpio_chip bcm2835_gpio_chip = { - .get = bcm2835_gpio_get, - .set = bcm2835_gpio_set, - .to_irq = bcm2835_gpio_to_irq, -- .base = -1, -+ .base = 0, - .ngpio = BCM2835_NUM_GPIOS, - .can_sleep = false, - }; - -From 40a7420d0d585951fbc02f232df97a15beff7a57 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 012/122] pinctrl-bcm2835: Fix interrupt handling for GPIOs - 28-31 and 46-53 - -Contrary to the documentation, the BCM2835 GPIO controller actually has -four interrupt lines - one each for the three IRQ groups and one common. Rather -confusingly, the GPIO interrupt groups don't correspond directly with the GPIO -control banks. Instead, GPIOs 0-27 generate IRQ GPIO0, 28-45 GPIO1 and -46-53 GPIO2. - -Awkwardly, the GPIOS for IRQ GPIO1 straddle two 32-entry GPIO banks, so it is -cleaner to split out a function to process the interrupts for a single GPIO -bank. - -This bug has only just been observed because GPIOs above 27 can only be -accessed on an old Raspberry Pi with the optional P5 header fitted, where -the pins are often used for I2S instead. ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 51 ++++++++++++++++++++++++++--------- - 1 file changed, 39 insertions(+), 12 deletions(-) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index d11e2e4ea189466e686d762cb6c6fef9111ecf8e..107ad7d58de8f8a7f55e09c9cdcf7d66fa7ab66b 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -47,6 +47,7 @@ - #define MODULE_NAME "pinctrl-bcm2835" - #define BCM2835_NUM_GPIOS 54 - #define BCM2835_NUM_BANKS 2 -+#define BCM2835_NUM_IRQS 3 - - #define BCM2835_PIN_BITMAP_SZ \ - DIV_ROUND_UP(BCM2835_NUM_GPIOS, sizeof(unsigned long) * 8) -@@ -88,13 +89,13 @@ enum bcm2835_pinconf_pull { - - struct bcm2835_gpio_irqdata { - struct bcm2835_pinctrl *pc; -- int bank; -+ int irqgroup; - }; - - struct bcm2835_pinctrl { - struct device *dev; - void __iomem *base; -- int irq[BCM2835_NUM_BANKS]; -+ int irq[BCM2835_NUM_IRQS]; - - /* note: locking assumes each bank will have its own unsigned long */ - unsigned long enabled_irq_map[BCM2835_NUM_BANKS]; -@@ -105,7 +106,7 @@ struct bcm2835_pinctrl { - struct gpio_chip gpio_chip; - struct pinctrl_gpio_range gpio_range; - -- struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_BANKS]; -+ struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_IRQS]; - spinlock_t irq_lock[BCM2835_NUM_BANKS]; - }; - -@@ -391,17 +392,16 @@ static struct gpio_chip bcm2835_gpio_chip = { - .can_sleep = false, - }; - --static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) -+static int bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc, -+ unsigned int bank, u32 mask) - { -- struct bcm2835_gpio_irqdata *irqdata = dev_id; -- struct bcm2835_pinctrl *pc = irqdata->pc; -- int bank = irqdata->bank; - unsigned long events; - unsigned offset; - unsigned gpio; - unsigned int type; - - events = bcm2835_gpio_rd(pc, GPEDS0 + bank * 4); -+ events &= mask; - events &= pc->enabled_irq_map[bank]; - for_each_set_bit(offset, &events, 32) { - gpio = (32 * bank) + offset; -@@ -409,7 +409,30 @@ static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) - - generic_handle_irq(irq_linear_revmap(pc->irq_domain, gpio)); - } -- return events ? IRQ_HANDLED : IRQ_NONE; -+ -+ return (events != 0); -+} -+ -+static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) -+{ -+ struct bcm2835_gpio_irqdata *irqdata = dev_id; -+ struct bcm2835_pinctrl *pc = irqdata->pc; -+ int handled = 0; -+ -+ switch (irqdata->irqgroup) { -+ case 0: /* IRQ0 covers GPIOs 0-27 */ -+ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0x0fffffff); -+ break; -+ case 1: /* IRQ1 covers GPIOs 28-45 */ -+ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0xf0000000) | -+ bcm2835_gpio_irq_handle_bank(pc, 1, 0x00003fff); -+ break; -+ case 2: /* IRQ2 covers GPIOs 46-53 */ -+ handled = bcm2835_gpio_irq_handle_bank(pc, 1, 0x003fc000); -+ break; -+ } -+ -+ return handled ? IRQ_HANDLED : IRQ_NONE; - } - - static inline void __bcm2835_gpio_irq_config(struct bcm2835_pinctrl *pc, -@@ -998,8 +1021,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) - for (i = 0; i < BCM2835_NUM_BANKS; i++) { - unsigned long events; - unsigned offset; -- int len; -- char *name; - - /* clear event detection flags */ - bcm2835_gpio_wr(pc, GPREN0 + i * 4, 0); -@@ -1014,10 +1035,15 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) - for_each_set_bit(offset, &events, 32) - bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset)); - -+ spin_lock_init(&pc->irq_lock[i]); -+ } -+ -+ for (i = 0; i < BCM2835_NUM_IRQS; i++) { -+ int len; -+ char *name; - pc->irq[i] = irq_of_parse_and_map(np, i); - pc->irq_data[i].pc = pc; -- pc->irq_data[i].bank = i; -- spin_lock_init(&pc->irq_lock[i]); -+ pc->irq_data[i].irqgroup = i; - - len = strlen(dev_name(pc->dev)) + 16; - name = devm_kzalloc(pc->dev, len, GFP_KERNEL); -@@ -1074,6 +1100,7 @@ static struct platform_driver bcm2835_pinctrl_driver = { - .remove = bcm2835_pinctrl_remove, - .driver = { - .name = MODULE_NAME, -+ .owner = THIS_MODULE, - .of_match_table = bcm2835_pinctrl_match, - }, - }; - -From a19df9159eb1e9745593febf2ef6aa5868e8d12f Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 013/122] pinctrl-bcm2835: Only request the interrupts listed - in the DTB - -Although the GPIO controller can generate three interrupts (four counting -the common one), the device tree files currently only specify two. In the -absence of the third, simply don't register that interrupt (as opposed to -registering 0), which has the effect of making it impossible to generate -interrupts for GPIOs 46-53 which, since they share pins with the SD card -interface, is unlikely to be a problem. ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 107ad7d58de8f8a7f55e09c9cdcf7d66fa7ab66b..644bdecbcfcb79d3b84a33769265fca5d3d0c9e5 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -1042,6 +1042,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) - int len; - char *name; - pc->irq[i] = irq_of_parse_and_map(np, i); -+ if (pc->irq[i] == 0) -+ break; - pc->irq_data[i].pc = pc; - pc->irq_data[i].irqgroup = i; - - -From eee7c2b51a8b1753aca3d01ecda24713576d14e5 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 6 May 2016 12:32:47 +0100 -Subject: [PATCH 014/122] pinctrl-bcm2835: Return pins to inputs when freed - -When dynamically unloading overlays, it is important that freed pins are -restored to being inputs to prevent functions from being enabled in -multiple places at once. - -Signed-off-by: Phil Elwell ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 644bdecbcfcb79d3b84a33769265fca5d3d0c9e5..81a66cba2ab0f7e3ae179de7edd10122630e7abc 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -844,6 +844,16 @@ static const struct pinctrl_ops bcm2835_pctl_ops = { - .dt_free_map = bcm2835_pctl_dt_free_map, - }; - -+static int bcm2835_pmx_free(struct pinctrl_dev *pctldev, -+ unsigned offset) -+{ -+ struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable by setting to GPIO_IN */ -+ bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); -+ return 0; -+} -+ - static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev) - { - return BCM2835_FSEL_COUNT; -@@ -903,6 +913,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, - } - - static const struct pinmux_ops bcm2835_pmx_ops = { -+ .free = bcm2835_pmx_free, - .get_functions_count = bcm2835_pmx_get_functions_count, - .get_function_name = bcm2835_pmx_get_function_name, - .get_function_groups = bcm2835_pmx_get_function_groups, - -From 7d54b896b5523a49b1038dd301b2d359d2321ef2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 015/122] spi-bcm2835: Support pin groups other than 7-11 - -The spi-bcm2835 driver automatically uses GPIO chip-selects due to -some unreliability of the native ones. In doing so it chooses the -same pins as the native chip-selects would use, but the existing -code always uses pins 7 and 8, wherever the SPI function is mapped. - -Search the pinctrl group assigned to the driver for pins that -correspond to native chip-selects, and use those for GPIO chip- -selects. - -Signed-off-by: Phil Elwell ---- - drivers/spi/spi-bcm2835.c | 45 +++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 37 insertions(+), 8 deletions(-) - -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index f35cc10772f6670397ea923ad30158270dd68578..5dfe20ffc2866fa6789825016c585175a29705b6 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -688,6 +688,8 @@ static int bcm2835_spi_setup(struct spi_device *spi) - { - int err; - struct gpio_chip *chip; -+ struct device_node *pins; -+ u32 pingroup_index; - /* - * sanity checking the native-chipselects - */ -@@ -704,15 +706,42 @@ static int bcm2835_spi_setup(struct spi_device *spi) - "setup: only two native chip-selects are supported\n"); - return -EINVAL; - } -- /* now translate native cs to GPIO */ -- -- /* get the gpio chip for the base */ -- chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); -- if (!chip) -- return 0; - -- /* and calculate the real CS */ -- spi->cs_gpio = chip->base + 8 - spi->chip_select; -+ /* now translate native cs to GPIO */ -+ /* first look for chip select pins in the devices pin groups */ -+ for (pingroup_index = 0; -+ (pins = of_parse_phandle(spi->master->dev.of_node, -+ "pinctrl-0", -+ pingroup_index)) != 0; -+ pingroup_index++) { -+ u32 pin; -+ u32 pin_index; -+ for (pin_index = 0; -+ of_property_read_u32_index(pins, -+ "brcm,pins", -+ pin_index, -+ &pin) == 0; -+ pin_index++) { -+ if (((spi->chip_select == 0) && -+ ((pin == 8) || (pin == 36) || (pin == 46))) || -+ ((spi->chip_select == 1) && -+ ((pin == 7) || (pin == 35)))) { -+ spi->cs_gpio = pin; -+ break; -+ } -+ } -+ of_node_put(pins); -+ } -+ /* if that fails, assume GPIOs 7-11 are used */ -+ if (!gpio_is_valid(spi->cs_gpio) ) { -+ /* get the gpio chip for the base */ -+ chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); -+ if (!chip) -+ return 0; -+ -+ /* and calculate the real CS */ -+ spi->cs_gpio = chip->base + 8 - spi->chip_select; -+ } - - /* and set up the "mode" and level */ - dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", - -From de045c3b6df0c0d56f02c0f782627249bbad09d2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 016/122] spi-bcm2835: Disable forced software CS - -Select software CS in bcm2708_common.dtsi, and disable the automatic -conversion in the driver to allow hardware CS to be re-enabled with an -overlay. - -See: https://github.com/raspberrypi/linux/issues/1547 - -Signed-off-by: Phil Elwell ---- - drivers/spi/spi-bcm2835.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 5dfe20ffc2866fa6789825016c585175a29705b6..8493474d286f7a1ac6454a22c61c8c2cef9121bf 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -707,6 +707,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) - return -EINVAL; - } - -+#if 0 - /* now translate native cs to GPIO */ - /* first look for chip select pins in the devices pin groups */ - for (pingroup_index = 0; -@@ -756,6 +757,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) - spi->chip_select, spi->cs_gpio, err); - return err; - } -+#endif - - return 0; - } - -From a161509667da54c9d5066a0c6bc0584d093a8923 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 8 Nov 2016 21:35:38 +0000 -Subject: [PATCH 017/122] spi-bcm2835: Remove unused code - ---- - drivers/spi/spi-bcm2835.c | 61 ----------------------------------------------- - 1 file changed, 61 deletions(-) - -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 8493474d286f7a1ac6454a22c61c8c2cef9121bf..33d75ad38a7f77d085321ace9101900a83bebcac 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -679,17 +679,8 @@ static void bcm2835_spi_set_cs(struct spi_device *spi, bool gpio_level) - bcm2835_wr(bs, BCM2835_SPI_CS, cs); - } - --static int chip_match_name(struct gpio_chip *chip, void *data) --{ -- return !strcmp(chip->label, data); --} -- - static int bcm2835_spi_setup(struct spi_device *spi) - { -- int err; -- struct gpio_chip *chip; -- struct device_node *pins; -- u32 pingroup_index; - /* - * sanity checking the native-chipselects - */ -@@ -707,58 +698,6 @@ static int bcm2835_spi_setup(struct spi_device *spi) - return -EINVAL; - } - --#if 0 -- /* now translate native cs to GPIO */ -- /* first look for chip select pins in the devices pin groups */ -- for (pingroup_index = 0; -- (pins = of_parse_phandle(spi->master->dev.of_node, -- "pinctrl-0", -- pingroup_index)) != 0; -- pingroup_index++) { -- u32 pin; -- u32 pin_index; -- for (pin_index = 0; -- of_property_read_u32_index(pins, -- "brcm,pins", -- pin_index, -- &pin) == 0; -- pin_index++) { -- if (((spi->chip_select == 0) && -- ((pin == 8) || (pin == 36) || (pin == 46))) || -- ((spi->chip_select == 1) && -- ((pin == 7) || (pin == 35)))) { -- spi->cs_gpio = pin; -- break; -- } -- } -- of_node_put(pins); -- } -- /* if that fails, assume GPIOs 7-11 are used */ -- if (!gpio_is_valid(spi->cs_gpio) ) { -- /* get the gpio chip for the base */ -- chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); -- if (!chip) -- return 0; -- -- /* and calculate the real CS */ -- spi->cs_gpio = chip->base + 8 - spi->chip_select; -- } -- -- /* and set up the "mode" and level */ -- dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -- spi->chip_select, spi->cs_gpio); -- -- /* set up GPIO as output and pull to the correct level */ -- err = gpio_direction_output(spi->cs_gpio, -- (spi->mode & SPI_CS_HIGH) ? 0 : 1); -- if (err) { -- dev_err(&spi->dev, -- "could not set CS%i gpio %i as output: %i", -- spi->chip_select, spi->cs_gpio, err); -- return err; -- } --#endif -- - return 0; - } - - -From 2ec6cfba14ff71b08f797c69d1a9c5bd53fc66a6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 018/122] ARM: bcm2835: Set Serial number and Revision -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The VideoCore bootloader passes in Serial number and -Revision number through Device Tree. Make these available to -userspace through /proc/cpuinfo. - -Mainline status: - -There is a commit in linux-next that standardize passing the serial -number through Device Tree (string: /serial-number): -ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo - -There was an attempt to do the same with the revision number, but it -didn't get in: -[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision - -Signed-off-by: Noralf Trønnes ---- - arch/arm/mach-bcm/board_bcm2835.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158ed2079834 100644 ---- a/arch/arm/mach-bcm/board_bcm2835.c -+++ b/arch/arm/mach-bcm/board_bcm2835.c -@@ -16,13 +16,23 @@ - #include - #include - #include -+#include - - #include - #include - - static void __init bcm2835_init(void) - { -+ struct device_node *np = of_find_node_by_path("/system"); -+ u32 val; -+ u64 val64; -+ - bcm2835_init_clocks(); -+ -+ if (!of_property_read_u32(np, "linux,revision", &val)) -+ system_rev = val; -+ if (!of_property_read_u64(np, "linux,serial", &val64)) -+ system_serial_low = val64; - } - - static const char * const bcm2835_compat[] = { - -From 7cd4e838461cb6cefa1ca5246ef3a6773363f0e0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 019/122] dmaengine: bcm2835: Load driver early and support - legacy API -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Load driver early since at least bcm2708_fb doesn't support deferred -probing and even if it did, we don't want the video driver deferred. -Support the legacy DMA API which is needed by bcm2708_fb. -Don't mask out channel 2. - -Signed-off-by: Noralf Trønnes ---- - drivers/dma/Kconfig | 2 +- - drivers/dma/bcm2835-dma.c | 26 +++++++++++++++++++++++++- - 2 files changed, 26 insertions(+), 2 deletions(-) - -diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 141aefbe37ec93d1f4f38d1be5e2cf8d93266725..9c931d36c6a499a02f4f215f8cd77d3f2254a3b9 100644 ---- a/drivers/dma/Kconfig -+++ b/drivers/dma/Kconfig -@@ -108,7 +108,7 @@ config COH901318 - - config DMA_BCM2835 - tristate "BCM2835 DMA engine support" -- depends on ARCH_BCM2835 -+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 - select DMA_ENGINE - select DMA_VIRTUAL_CHANNELS - -diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index e18dc596cf2447fa9ef7e41b62d9396e29043426..80d35f760b4a4a51e60c355a84d538bac3892a4d 100644 ---- a/drivers/dma/bcm2835-dma.c -+++ b/drivers/dma/bcm2835-dma.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -48,6 +49,7 @@ - - #define BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED 14 - #define BCM2835_DMA_CHAN_NAME_SIZE 8 -+#define BCM2835_DMA_BULK_MASK BIT(0) - - struct bcm2835_dmadev { - struct dma_device ddev; -@@ -922,6 +924,9 @@ static int bcm2835_dma_probe(struct platform_device *pdev) - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); -+ rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK); -+ if (rc) -+ dev_err(&pdev->dev, "Failed to initialize the legacy API\n"); - - od->base = base; - -@@ -959,6 +964,9 @@ static int bcm2835_dma_probe(struct platform_device *pdev) - goto err_no_dma; - } - -+ /* Channel 0 is used by the legacy API */ -+ chans_available &= ~BCM2835_DMA_BULK_MASK; -+ - /* get irqs for each channel that we support */ - for (i = 0; i <= BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED; i++) { - /* skip masked out channels */ -@@ -1033,6 +1041,7 @@ static int bcm2835_dma_remove(struct platform_device *pdev) - { - struct bcm2835_dmadev *od = platform_get_drvdata(pdev); - -+ bcm_dmaman_remove(pdev); - dma_async_device_unregister(&od->ddev); - bcm2835_dma_free(od); - -@@ -1048,7 +1057,22 @@ static struct platform_driver bcm2835_dma_driver = { - }, - }; - --module_platform_driver(bcm2835_dma_driver); -+static int bcm2835_dma_init(void) -+{ -+ return platform_driver_register(&bcm2835_dma_driver); -+} -+ -+static void bcm2835_dma_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_dma_driver); -+} -+ -+/* -+ * Load after serial driver (arch_initcall) so we see the messages if it fails, -+ * but before drivers (module_init) that need a DMA channel. -+ */ -+subsys_initcall(bcm2835_dma_init); -+module_exit(bcm2835_dma_exit); - - MODULE_ALIAS("platform:bcm2835-dma"); - MODULE_DESCRIPTION("BCM2835 DMA engine driver"); - -From e19d2f37545f78b50f4f82b72099b036f42d2bcd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 25 Jan 2016 17:25:12 +0000 -Subject: [PATCH 020/122] firmware: Updated mailbox header - ---- - include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 3fb357193f09914fe21f8555a4b8613f74f22bc3..227a107214a02deadcca3db202da265eba1fdd21 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -63,6 +63,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, - RPI_FIRMWARE_GET_TURBO = 0x00030009, - RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, -+ RPI_FIRMWARE_GET_STC = 0x0003000b, - RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, - RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, - RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, -@@ -72,12 +73,15 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, - RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, - RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, -+ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, - RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030, - RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, - RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, - RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, - RPI_FIRMWARE_SET_TURBO = 0x00038009, -+ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, - RPI_FIRMWARE_SET_DOMAIN_STATE = 0x00038030, -+ RPI_FIRMWARE_SET_SDHOST_CLOCK = 0x00038042, - - /* Dispmanx TAGS */ - RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -@@ -91,6 +95,8 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, - RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, - RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, - RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, - RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, - RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, -@@ -100,6 +106,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, - RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, - RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, -+ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, - RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, - RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, - RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, -@@ -108,6 +115,10 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -+ -+ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, - - RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, - RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, - -From 99e1f06dcc2bf78742380b9697c354b627fd02c2 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 9 May 2016 17:28:18 -0700 -Subject: [PATCH 021/122] clk: bcm2835: Mark GPIO clocks enabled at boot as - critical. - -These divide off of PLLD_PER and are used for the ethernet and wifi -PHYs source PLLs. Neither of them is currently represented by a phy -device that would grab the clock for us. - -This keeps other drivers from killing the networking PHYs when they -disable their own clocks and trigger PLLD_PER's refcount going to 0. - -v2: Skip marking as critical if they aren't on at boot. - -Signed-off-by: Eric Anholt ---- - drivers/clk/bcm/clk-bcm2835.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c -index 3bbd2a58db470a89b870a793e59ddf9fc4f48e57..7040c6426e35c11608121893b662c601cd8d6543 100644 ---- a/drivers/clk/bcm/clk-bcm2835.c -+++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1262,6 +1262,15 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, - init.name = data->name; - init.flags = data->flags | CLK_IGNORE_UNUSED; - -+ /* -+ * Some GPIO clocks for ethernet/wifi PLLs are marked as -+ * critical (since some platforms use them), but if the -+ * firmware didn't have them turned on then they clearly -+ * aren't actually critical. -+ */ -+ if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0) -+ init.flags &= ~CLK_IS_CRITICAL; -+ - if (data->is_vpu_clock) { - init.ops = &bcm2835_vpu_clock_clk_ops; - } else { - -From 946babad832c9ed45bbb31fd89fce025a9f7db48 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 15 Jun 2016 16:48:41 +0100 -Subject: [PATCH 022/122] rtc: Add SPI alias for pcf2123 driver - -Without this alias, Device Tree won't cause the driver -to be loaded. - -See: https://github.com/raspberrypi/linux/pull/1510 ---- - drivers/rtc/rtc-pcf2123.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c -index 8895f77726e8da5444afcd602dceff8f25a9b3fd..1833b8853ceb0e6147cceb93a00e558c3a5db10c 100644 ---- a/drivers/rtc/rtc-pcf2123.c -+++ b/drivers/rtc/rtc-pcf2123.c -@@ -472,3 +472,4 @@ module_spi_driver(pcf2123_driver); - MODULE_AUTHOR("Chris Verges "); - MODULE_DESCRIPTION("NXP PCF2123 RTC driver"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("spi:rtc-pcf2123"); - -From a929f2b203a1bafb1ca88f7022cb286f28fa98bd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 7 Oct 2016 16:50:59 +0200 -Subject: [PATCH 023/122] watchdog: bcm2835: Support setting reboot partition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Raspberry Pi firmware looks at the RSTS register to know which -partition to boot from. The reboot syscall command -LINUX_REBOOT_CMD_RESTART2 supports passing in a string argument. - -Add support for passing in a partition number 0..63 to boot from. -Partition 63 is a special partiton indicating halt. -If the partition doesn't exist, the firmware falls back to partition 0. - -Signed-off-by: Noralf Trønnes ---- - drivers/watchdog/bcm2835_wdt.c | 61 +++++++++++++++++++++++++----------------- - 1 file changed, 36 insertions(+), 25 deletions(-) - -diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c -index 4dddd8298a227d64862f2e92954a465f2e44b3f6..1f545e024422f59280932713e6a1b05150b39b22 100644 ---- a/drivers/watchdog/bcm2835_wdt.c -+++ b/drivers/watchdog/bcm2835_wdt.c -@@ -35,13 +35,7 @@ - #define PM_RSTC_WRCFG_SET 0x00000030 - #define PM_RSTC_WRCFG_FULL_RESET 0x00000020 - #define PM_RSTC_RESET 0x00000102 -- --/* -- * The Raspberry Pi firmware uses the RSTS register to know which partiton -- * to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10. -- * Partiton 63 is a special partition used by the firmware to indicate halt. -- */ --#define PM_RSTS_RASPBERRYPI_HALT 0x555 -+#define PM_RSTS_PARTITION_CLR 0xfffffaaa - - #define SECS_TO_WDOG_TICKS(x) ((x) << 16) - #define WDOG_TICKS_TO_SECS(x) ((x) >> 16) -@@ -111,15 +105,28 @@ static struct watchdog_device bcm2835_wdt_wdd = { - .timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET), - }; - --static int --bcm2835_restart(struct notifier_block *this, unsigned long mode, void *cmd) -+/* -+ * The Raspberry Pi firmware uses the RSTS register to know which partiton -+ * to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10. -+ * Partiton 63 is a special partition used by the firmware to indicate halt. -+ */ -+ -+static void bcm2835_restart(struct bcm2835_wdt *wdt, u8 partition) - { -- struct bcm2835_wdt *wdt = container_of(this, struct bcm2835_wdt, -- restart_handler); -- u32 val; -+ u32 val, rsts; -+ -+ rsts = (partition & BIT(0)) | ((partition & BIT(1)) << 1) | -+ ((partition & BIT(2)) << 2) | ((partition & BIT(3)) << 3) | -+ ((partition & BIT(4)) << 4) | ((partition & BIT(5)) << 5); -+ -+ val = readl_relaxed(wdt->base + PM_RSTS); -+ val &= PM_RSTS_PARTITION_CLR; -+ val |= PM_PASSWORD | rsts; -+ writel_relaxed(val, wdt->base + PM_RSTS); - - /* use a timeout of 10 ticks (~150us) */ - writel_relaxed(10 | PM_PASSWORD, wdt->base + PM_WDOG); -+ - val = readl_relaxed(wdt->base + PM_RSTC); - val &= PM_RSTC_WRCFG_CLR; - val |= PM_PASSWORD | PM_RSTC_WRCFG_FULL_RESET; -@@ -127,6 +134,20 @@ bcm2835_restart(struct notifier_block *this, unsigned long mode, void *cmd) - - /* No sleeping, possibly atomic. */ - mdelay(1); -+} -+ -+static int bcm2835_restart_notifier_call(struct notifier_block *this, -+ unsigned long mode, void *cmd) -+{ -+ struct bcm2835_wdt *wdt = container_of(this, struct bcm2835_wdt, -+ restart_handler); -+ unsigned long long val; -+ u8 partition = 0; -+ -+ if (cmd && !kstrtoull(cmd, 0, &val) && val <= 63) -+ partition = val; -+ -+ bcm2835_restart(wdt, partition); - - return 0; - } -@@ -142,19 +163,9 @@ static void bcm2835_power_off(void) - of_find_compatible_node(NULL, NULL, "brcm,bcm2835-pm-wdt"); - struct platform_device *pdev = of_find_device_by_node(np); - struct bcm2835_wdt *wdt = platform_get_drvdata(pdev); -- u32 val; -- -- /* -- * We set the watchdog hard reset bit here to distinguish this reset -- * from the normal (full) reset. bootcode.bin will not reboot after a -- * hard reset. -- */ -- val = readl_relaxed(wdt->base + PM_RSTS); -- val |= PM_PASSWORD | PM_RSTS_RASPBERRYPI_HALT; -- writel_relaxed(val, wdt->base + PM_RSTS); - -- /* Continue with normal reset mechanism */ -- bcm2835_restart(&wdt->restart_handler, REBOOT_HARD, NULL); -+ /* Partition 63 tells the firmware that this is a halt */ -+ bcm2835_restart(wdt, 63); - } - - static int bcm2835_wdt_probe(struct platform_device *pdev) -@@ -188,7 +199,7 @@ static int bcm2835_wdt_probe(struct platform_device *pdev) - return err; - } - -- wdt->restart_handler.notifier_call = bcm2835_restart; -+ wdt->restart_handler.notifier_call = bcm2835_restart_notifier_call; - wdt->restart_handler.priority = 128; - register_restart_handler(&wdt->restart_handler); - if (pm_power_off == NULL) - -From 2e7833eae38410bc31d3a86166868a55d0999394 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 Apr 2016 19:40:12 +0100 -Subject: [PATCH 024/122] reboot: Use power off rather than busy spinning when - halt is requested - ---- - arch/arm/kernel/reboot.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c -index 3fa867a2aae672755c6ce6448f4148c989dbf964..80dca8dcd6709034b643c6a3f35729e00fb59a19 100644 ---- a/arch/arm/kernel/reboot.c -+++ b/arch/arm/kernel/reboot.c -@@ -102,9 +102,7 @@ void machine_shutdown(void) - */ - void machine_halt(void) - { -- local_irq_disable(); -- smp_send_stop(); -- while (1); -+ machine_power_off(); - } - - /* - -From 0d4700ca51eb31fa70e10da67fa92e986275f2d3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 9 Nov 2016 13:02:52 +0000 -Subject: [PATCH 025/122] bcm: Make RASPBERRYPI_POWER depend on PM - ---- - drivers/soc/bcm/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig -index a39b0d58ddd0fdf0ac1cc7295f8aafb12546e226..e037a6dd79d1881a09e3ca911578270917888846 100644 ---- a/drivers/soc/bcm/Kconfig -+++ b/drivers/soc/bcm/Kconfig -@@ -4,6 +4,7 @@ config RASPBERRYPI_POWER - bool "Raspberry Pi power domain driver" - depends on ARCH_BCM2835 || (COMPILE_TEST && OF) - depends on RASPBERRYPI_FIRMWARE=y -+ depends on PM - select PM_GENERIC_DOMAINS if PM - help - This enables support for the RPi power domains which can be enabled - -From 53b503a7256d432bfa51f5ffba58a446c2cc6ebb Mon Sep 17 00:00:00 2001 -From: Martin Sperl -Date: Fri, 2 Sep 2016 16:45:27 +0100 -Subject: [PATCH 026/122] Register the clocks early during the boot process, so - that special/critical clocks can get enabled early on in the boot process - avoiding the risk of disabling a clock, pll_divider or pll when a claiming - driver fails to install propperly - maybe it needs to defer. - -Signed-off-by: Martin Sperl ---- - drivers/clk/bcm/clk-bcm2835.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c -index 7040c6426e35c11608121893b662c601cd8d6543..21e2a538ff0d0ab4e63adff9b93705f3d45fa15d 100644 ---- a/drivers/clk/bcm/clk-bcm2835.c -+++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1903,8 +1903,15 @@ static int bcm2835_clk_probe(struct platform_device *pdev) - if (ret) - return ret; - -- return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, -+ ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, - &cprman->onecell); -+ if (ret) -+ return ret; -+ -+ /* note that we have registered all the clocks */ -+ dev_dbg(dev, "registered %d clocks\n", asize); -+ -+ return 0; - } - - static const struct of_device_id bcm2835_clk_of_match[] = { -@@ -1921,7 +1928,11 @@ static struct platform_driver bcm2835_clk_driver = { - .probe = bcm2835_clk_probe, - }; - --builtin_platform_driver(bcm2835_clk_driver); -+static int __init __bcm2835_clk_driver_init(void) -+{ -+ return platform_driver_register(&bcm2835_clk_driver); -+} -+core_initcall(__bcm2835_clk_driver_init); - - MODULE_AUTHOR("Eric Anholt "); - MODULE_DESCRIPTION("BCM2835 clock driver"); - -From e367c208dc6a9d92e5c0d6e5e089e7b56c7cf189 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 6 Dec 2016 17:05:39 +0000 -Subject: [PATCH 027/122] bcm2835-rng: Avoid initialising if already enabled - -Avoids the 0x40000 cycles of warmup again if firmware has already used it ---- - drivers/char/hw_random/bcm2835-rng.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c -index 574211a495491d9d6021dcaefe4274a63ed02055..e66c0fca8c6090e32f72796c0877a1cf1d499fb6 100644 ---- a/drivers/char/hw_random/bcm2835-rng.c -+++ b/drivers/char/hw_random/bcm2835-rng.c -@@ -102,9 +102,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev) - rng_setup(rng_base); - - /* set warm-up count & enable */ -- __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS); -- __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL); -- -+ if (!(__raw_readl(rng_base + RNG_CTRL) & RNG_RBGEN)) { -+ __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS); -+ __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL); -+ } - /* register driver */ - err = hwrng_register(&bcm2835_rng_ops); - if (err) { - -From da0b1ac76230b33baa5cd0391388d32d43889d69 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 24 Aug 2016 16:28:44 +0100 -Subject: [PATCH 028/122] kbuild: Ignore dtco targets when filtering symbols - ---- - scripts/Kbuild.include | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include -index 179219845dfcdfbeb586d12c5ec1296095d9fbf4..e0743e44f84188667a0c322e8c3d36f18385dcd3 100644 ---- a/scripts/Kbuild.include -+++ b/scripts/Kbuild.include -@@ -284,7 +284,7 @@ ksym_dep_filter = \ - $(CPP) $(call flags_nodeps,c_flags) -D__KSYM_DEPS__ $< ;; \ - as_*_S|cpp_s_S) \ - $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \ -- boot*|build*|*cpp_lds_S|dtc|host*|vdso*) : ;; \ -+ boot*|build*|*cpp_lds_S|dtc*|host*|vdso*) : ;; \ - *) echo "Don't know how to preprocess $(1)" >&2; false ;; \ - esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' - - -From f96bacbe5b20000d29c0b1bc81f66f5b15231b48 Mon Sep 17 00:00:00 2001 -From: Robert Tiemann -Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 029/122] BCM2835_DT: Fix I2S register map - ---- - Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- - Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt -index baf9b34d20bfb5b5493e0a69841362530c900a77..11c052acf65e74f032ae77bfd2749db860762b2d 100644 ---- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt -+++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt -@@ -74,8 +74,8 @@ Example: - - bcm2835_i2s: i2s@7e203000 { - compatible = "brcm,bcm2835-i2s"; -- reg = < 0x7e203000 0x20>, -- < 0x7e101098 0x02>; -+ reg = < 0x7e203000 0x24>, -+ < 0x7e101098 0x08>; - - dmas = <&dma 2>, - <&dma 3>; -diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt -index 65783de0aedf3da79adc36fd077b7a89954ddb6b..a89fe4220fdc3f26f75ee66daf187554427118a2 100644 ---- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt -+++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt -@@ -16,8 +16,8 @@ Example: - - bcm2835_i2s: i2s@7e203000 { - compatible = "brcm,bcm2835-i2s"; -- reg = <0x7e203000 0x20>, -- <0x7e101098 0x02>; -+ reg = <0x7e203000 0x24>, -+ <0x7e101098 0x08>; - - dmas = <&dma 2>, - <&dma 3>; - -From 967e1d016f69607cb5f1d8337f9249ef31e19d81 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 030/122] Main bcm2708/bcm2709 linux port -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix -Signed-off-by: Noralf Trønnes - -bcm2709: Drop platform smp and timer init code - -irq-bcm2836 handles this through these functions: -bcm2835_init_local_timer_frequency() -bcm2836_arm_irqchip_smp_init() - -Signed-off-by: Noralf Trønnes - -bcm270x: Use watchdog for reboot/poweroff - -The watchdog driver already has support for reboot/poweroff. -Make use of this and remove the code from the platform files. - -Signed-off-by: Noralf Trønnes ---- - arch/arm/mach-bcm/Kconfig | 1 + - arch/arm/mach-bcm/board_bcm2835.c | 17 +++++++++++++++++ - arch/arm/mm/proc-v6.S | 15 ++++++++++++--- - drivers/irqchip/irq-bcm2835.c | 7 ++++++- - drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- - 5 files changed, 52 insertions(+), 6 deletions(-) - -diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 4ff30d5278a7ce093c9629d4c25d37e3bbbda752..333dc3c2e5ffbb2c5ab8fcfb6115b6162643cf20 100644 ---- a/arch/arm/mach-bcm/Kconfig -+++ b/arch/arm/mach-bcm/Kconfig -@@ -155,6 +155,7 @@ config ARCH_BCM2835 - select FIQ - select PINCTRL - select PINCTRL_BCM2835 -+ select MFD_SYSCON if ARCH_MULTI_V7 - help - This enables support for the Broadcom BCM2835 and BCM2836 SoCs. - This SoC is used in the Raspberry Pi and Roku 2 devices. -diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 8f152266ba9b470df2eaaed9ebcf158ed2079834..133338f0a21237fda9b7660d2c57a33b991f08ae 100644 ---- a/arch/arm/mach-bcm/board_bcm2835.c -+++ b/arch/arm/mach-bcm/board_bcm2835.c -@@ -16,17 +16,21 @@ - #include - #include - #include -+#include - #include - - #include - #include - -+#include -+ - static void __init bcm2835_init(void) - { - struct device_node *np = of_find_node_by_path("/system"); - u32 val; - u64 val64; - -+ vc_cma_early_init(); - bcm2835_init_clocks(); - - if (!of_property_read_u32(np, "linux,revision", &val)) -@@ -35,6 +39,17 @@ static void __init bcm2835_init(void) - system_serial_low = val64; - } - -+static void __init bcm2835_init_early(void) -+{ -+ /* dwc_otg needs this for bounce buffers on non-aligned transfers */ -+ init_dma_coherent_pool_size(SZ_1M); -+} -+ -+static void __init bcm2835_board_reserve(void) -+{ -+ vc_cma_reserve(); -+} -+ - static const char * const bcm2835_compat[] = { - #ifdef CONFIG_ARCH_MULTI_V6 - "brcm,bcm2835", -@@ -47,5 +62,7 @@ static const char * const bcm2835_compat[] = { - - DT_MACHINE_START(BCM2835, "BCM2835") - .init_machine = bcm2835_init, -+ .reserve = bcm2835_board_reserve, -+ .init_early = bcm2835_init_early, - .dt_compat = bcm2835_compat - MACHINE_END -diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S -index 06d890a2342b1600e2eae6e350994ad59f5c3a08..30d96e81c0e052c725bdb00bb3df56194023ab9f 100644 ---- a/arch/arm/mm/proc-v6.S -+++ b/arch/arm/mm/proc-v6.S -@@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset) - * - * IRQs are already disabled. - */ -+ -+/* See jira SW-5991 for details of this workaround */ - ENTRY(cpu_v6_do_idle) -- mov r1, #0 -- mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode -- mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt -+ .align 5 -+ mov r1, #2 -+1: subs r1, #1 -+ nop -+ mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode -+ mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt -+ nop -+ nop -+ nop -+ bne 1b - ret lr - - ENTRY(cpu_v6_dcache_clean_area) -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index eccf6ed025299cb480884f5bcbe77abf55a6bbb1..8ed457fd74bd23bee27b64a2c9e3828ce0e4fb87 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -54,7 +54,9 @@ - #include - - #include -+#ifndef CONFIG_ARM64 - #include -+#endif - - /* Put the bank and irq (32 bits) into the hwirq */ - #define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) -@@ -82,6 +84,7 @@ - #define NR_BANKS 3 - #define IRQS_PER_BANK 32 - #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) -+#undef FIQ_START - #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) - - static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; -@@ -256,10 +259,12 @@ static int __init armctrl_of_init(struct device_node *node, - MAKE_HWIRQ(b, i) + NUMBER_IRQS); - BUG_ON(irq <= 0); - irq_set_chip(irq, &armctrl_chip); -- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); -+ irq_set_probe(irq); - } - } -+#ifndef CONFIG_ARM64 - init_FIQ(FIQ_START); -+#endif - - return 0; - } -diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c -index cfb4b4496dd9f61362dea012176c146120fada07..d9c6c217c4d6a2408abe2665bf7f27006f4edd15 100644 ---- a/drivers/mailbox/bcm2835-mailbox.c -+++ b/drivers/mailbox/bcm2835-mailbox.c -@@ -51,12 +51,15 @@ - #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) - #define MAIL1_STA (ARM_0_MAIL1 + 0x18) - -+/* On ARCH_BCM270x these come through (arm_control.h ) */ -+#ifndef ARM_MS_FULL - /* Status register: FIFO state. */ - #define ARM_MS_FULL BIT(31) - #define ARM_MS_EMPTY BIT(30) - - /* Configuration register: Enable interrupts. */ - #define ARM_MC_IHAVEDATAIRQEN BIT(0) -+#endif - - struct bcm2835_mbox { - void __iomem *regs; -@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) - return -ENOMEM; - spin_lock_init(&mbox->lock); - -- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), -+ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), - bcm2835_mbox_irq, 0, dev_name(dev), mbox); - if (ret) { - dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", -@@ -209,7 +212,18 @@ static struct platform_driver bcm2835_mbox_driver = { - .probe = bcm2835_mbox_probe, - .remove = bcm2835_mbox_remove, - }; --module_platform_driver(bcm2835_mbox_driver); -+ -+static int __init bcm2835_mbox_init(void) -+{ -+ return platform_driver_register(&bcm2835_mbox_driver); -+} -+arch_initcall(bcm2835_mbox_init); -+ -+static void __init bcm2835_mbox_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_mbox_driver); -+} -+module_exit(bcm2835_mbox_exit); - - MODULE_AUTHOR("Lubomir Rintel "); - MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); - -From 9ccdf13082f318de0091066517c7f7309b245456 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 031/122] Add dwc_otg driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -usb: dwc: fix lockdep false positive - -Signed-off-by: Kari Suvanto - -usb: dwc: fix inconsistent lock state - -Signed-off-by: Kari Suvanto - -Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance. -Thanks to Gordon and Costas - -Avoid dynamic memory allocation for channel lock in USB driver. Thanks ddv2005. - -Add NAK holdoff scheme. Enabled by default, disable with dwc_otg.nak_holdoff_enable=0. Thanks gsh - -Make sure we wait for the reset to finish - -dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent kernel - memory corruption, escalating to OOPS under high USB load. - -dwc_otg: Fix unsafe access of QTD during URB enqueue - -In dwc_otg_hcd_urb_enqueue during qtd creation, it was possible that the -transaction could complete almost immediately after the qtd was assigned -to a host channel during URB enqueue, which meant the qtd pointer was no -longer valid having been completed and removed. Usually, this resulted in -an OOPS during URB submission. By predetermining whether transactions -need to be queued or not, this unsafe pointer access is avoided. - -This bug was only evident on the Pi model A where a device was attached -that had no periodic endpoints (e.g. USB pendrive or some wlan devices). - -dwc_otg: Fix incorrect URB allocation error handling - -If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS -because for some reason a member of the *unallocated* struct was set to -zero. Error handling changed to fail correctly. - -dwc_otg: fix potential use-after-free case in interrupt handler - -If a transaction had previously aborted, certain interrupts are -enabled to track error counts and reset where necessary. On IN -endpoints the host generates an ACK interrupt near-simultaneously -with completion of transfer. In the case where this transfer had -previously had an error, this results in a use-after-free on -the QTD memory space with a 1-byte length being overwritten to -0x00. - -dwc_otg: add handling of SPLIT transaction data toggle errors - -Previously a data toggle error on packets from a USB1.1 device behind -a TT would result in the Pi locking up as the driver never handled -the associated interrupt. Patch adds basic retry mechanism and -interrupt acknowledgement to cater for either a chance toggle error or -for devices that have a broken initial toggle state (FT8U232/FT232BM). - -dwc_otg: implement tasklet for returning URBs to usbcore hcd layer - -The dwc_otg driver interrupt handler for transfer completion will spend -a very long time with interrupts disabled when a URB is completed - -this is because usb_hcd_giveback_urb is called from within the handler -which for a USB device driver with complicated processing (e.g. webcam) -will take an exorbitant amount of time to complete. This results in -missed completion interrupts for other USB packets which lead to them -being dropped due to microframe overruns. - -This patch splits returning the URB to the usb hcd layer into a -high-priority tasklet. This will have most benefit for isochronous IN -transfers but will also have incidental benefit where multiple periodic -devices are active at once. - -dwc_otg: fix NAK holdoff and allow on split transactions only - -This corrects a bug where if a single active non-periodic endpoint -had at least one transaction in its qh, on frnum == MAX_FRNUM the qh -would get skipped and never get queued again. This would result in -a silent device until error detection (automatic or otherwise) would -either reset the device or flush and requeue the URBs. - -Additionally the NAK holdoff was enabled for all transactions - this -would potentially stall a HS endpoint for 1ms if a previous error state -enabled this interrupt and the next response was a NAK. Fix so that -only split transactions get held off. - -dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler - -usb_hcd_unlink_urb_from_ep must be called with the HCD lock held. Calling it -asynchronously in the tasklet was not safe (regression in -c4564d4a1a0a9b10d4419e48239f5d99e88d2667). - -This change unlinks it from the endpoint prior to queueing it for handling in -the tasklet, and also adds a check to ensure the urb is OK to be unlinked -before doing so. - -NULL pointer dereference kernel oopses had been observed in usb_hcd_giveback_urb -when a USB device was unplugged/replugged during data transfer. This effect -was reproduced using automated USB port power control, hundreds of replug -events were performed during active transfers to confirm that the problem was -eliminated. - -USB fix using a FIQ to implement split transactions - -This commit adds a FIQ implementaion that schedules -the split transactions using a FIQ so we don't get -held off by the interrupt latency of Linux - -dwc_otg: fix device attributes and avoid kernel warnings on boot - -dcw_otg: avoid logging function that can cause panics - -See: https://github.com/raspberrypi/firmware/issues/21 -Thanks to cleverca22 for fix - -dwc_otg: mask correct interrupts after transaction error recovery - -The dwc_otg driver will unmask certain interrupts on a transaction -that previously halted in the error state in order to reset the -QTD error count. The various fine-grained interrupt handlers do not -consider that other interrupts besides themselves were unmasked. - -By disabling the two other interrupts only ever enabled in DMA mode -for this purpose, we can avoid unnecessary function calls in the -IRQ handler. This will also prevent an unneccesary FIQ interrupt -from being generated if the FIQ is enabled. - -dwc_otg: fiq: prevent FIQ thrash and incorrect state passing to IRQ - -In the case of a transaction to a device that had previously aborted -due to an error, several interrupts are enabled to reset the error -count when a device responds. This has the side-effect of making the -FIQ thrash because the hardware will generate multiple instances of -a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK -on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the -associated interrupts. - -Additionally, on non-split transactions make sure that only unmasked -interrupts are cleared. This caused a hard-to-trigger but serious -race condition when you had the combination of an endpoint awaiting -error recovery and a transaction completed on an endpoint - due to -the sequencing and timing of interrupts generated by the dwc_otg core, -it was possible to confuse the IRQ handler. - -Fix function tracing - -dwc_otg: whitespace cleanup in dwc_otg_urb_enqueue - -dwc_otg: prevent OOPSes during device disconnects - -The dwc_otg_urb_enqueue function is thread-unsafe. In particular the -access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and -friends does not occur within a critical section and so if a device -was unplugged during activity there was a high chance that the -usbcore hub_thread would try to disable the endpoint with partially- -formed entries in the URB queue. This would result in BUG() or null -pointer dereferences. - -Fix so that access of urb->hcpriv, enqueuing to the hardware and -adding to usbcore endpoint URB lists is contained within a single -critical section. - -dwc_otg: prevent BUG() in TT allocation if hub address is > 16 - -A fixed-size array is used to track TT allocation. This was -previously set to 16 which caused a crash because -dwc_otg_hcd_allocate_port would read past the end of the array. - -This was hit if a hub was plugged in which enumerated as addr > 16, -due to previous device resets or unplugs. - -Also add #ifdef FIQ_DEBUG around hcd->hub_port_alloc[], which grows -to a large size if 128 hub addresses are supported. This field is -for debug only for tracking which frame an allocate happened in. - -dwc_otg: make channel halts with unknown state less damaging - -If the IRQ received a channel halt interrupt through the FIQ -with no other bits set, the IRQ would not release the host -channel and never complete the URB. - -Add catchall handling to treat as a transaction error and retry. - -dwc_otg: fiq_split: use TTs with more granularity - -This fixes certain issues with split transaction scheduling. - -- Isochronous multi-packet OUT transactions now hog the TT until - they are completed - this prevents hubs aborting transactions - if they get a periodic start-split out-of-order -- Don't perform TT allocation on non-periodic endpoints - this - allows simultaneous use of the TT's bulk/control and periodic - transaction buffers - -This commit will mainly affect USB audio playback. - -dwc_otg: fix potential sleep while atomic during urb enqueue - -Fixes a regression introduced with eb1b482a. Kmalloc called from -dwc_otg_hcd_qtd_add / dwc_otg_hcd_qtd_create did not always have -the GPF_ATOMIC flag set. Force this flag when inside the larger -critical section. - -dwc_otg: make fiq_split_enable imply fiq_fix_enable - -Failing to set up the FIQ correctly would result in -"IRQ 32: nobody cared" errors in dmesg. - -dwc_otg: prevent crashes on host port disconnects - -Fix several issues resulting in crashes or inconsistent state -if a Model A root port was disconnected. - -- Clean up queue heads properly in kill_urbs_in_qh_list by - removing the empty QHs from the schedule lists -- Set the halt status properly to prevent IRQ handlers from - using freed memory -- Add fiq_split related cleanup for saved registers -- Make microframe scheduling reclaim host channels if - active during a disconnect -- Abort URBs with -ESHUTDOWN status response, informing - device drivers so they respond in a more correct fashion - and don't try to resubmit URBs -- Prevent IRQ handlers from attempting to handle channel - interrupts if the associated URB was dequeued (and the - driver state was cleared) - -dwc_otg: prevent leaking URBs during enqueue - -A dwc_otg_urb would get leaked if the HCD enqueue function -failed for any reason. Free the URB at the appropriate points. - -dwc_otg: Enable NAK holdoff for control split transactions - -Certain low-speed devices take a very long time to complete a -data or status stage of a control transaction, producing NAK -responses until they complete internal processing - the USB2.0 -spec limit is up to 500mS. This causes the same type of interrupt -storm as seen with USB-serial dongles prior to c8edb238. - -In certain circumstances, usually while booting, this interrupt -storm could cause SD card timeouts. - -dwc_otg: Fix for occasional lockup on boot when doing a USB reset - -dwc_otg: Don't issue traffic to LS devices in FS mode - -Issuing low-speed packets when the root port is in full-speed mode -causes the root port to stop responding. Explicitly fail when -enqueuing URBs to a LS endpoint on a FS bus. - -Fix ARM architecture issue with local_irq_restore() - -If local_fiq_enable() is called before a local_irq_restore(flags) where -the flags variable has the F bit set, the FIQ will be erroneously disabled. - -Fixup arch_local_irq_restore to avoid trampling the F bit in CPSR. - -Also fix some of the hacks previously implemented for previous dwc_otg -incarnations. - -dwc_otg: fiq_fsm: Base commit for driver rewrite - -This commit removes the previous FIQ fixes entirely and adds fiq_fsm. - -This rewrite features much more complete support for split transactions -and takes into account several OTG hardware bugs. High-speed -isochronous transactions are also capable of being performed by fiq_fsm. - -All driver options have been removed and replaced with: - - dwc_otg.fiq_enable (bool) - - dwc_otg.fiq_fsm_enable (bool) - - dwc_otg.fiq_fsm_mask (bitmask) - - dwc_otg.nak_holdoff (unsigned int) - -Defaults are specified such that fiq_fsm behaves similarly to the -previously implemented FIQ fixes. - -fiq_fsm: Push error recovery into the FIQ when fiq_fsm is used - -If the transfer associated with a QTD failed due to a bus error, the HCD -would retry the transfer up to 3 times (implementing the USB2.0 -three-strikes retry in software). - -Due to the masking mechanism used by fiq_fsm, it is only possible to pass -a single interrupt through to the HCD per-transfer. - -In this instance host channels would fall off the radar because the error -reset would function, but the subsequent channel halt would be lost. - -Push the error count reset into the FIQ handler. - -fiq_fsm: Implement timeout mechanism - -For full-speed endpoints with a large packet size, interrupt latency -runs the risk of the FIQ starting a transaction too late in a full-speed -frame. If the device is still transmitting data when EOF2 for the -downstream frame occurs, the hub will disable the port. This change is -not reflected in the hub status endpoint and the device becomes -unresponsive. - -Prevent high-bandwidth transactions from being started too late in a -frame. The mechanism is not guaranteed: a combination of bit stuffing -and hub latency may still result in a device overrunning. - -fiq_fsm: fix bounce buffer utilisation for Isochronous OUT - -Multi-packet isochronous OUT transactions were subject to a few bounday -bugs. Fix them. - -Audio playback is now much more robust: however, an issue stands with -devices that have adaptive sinks - ALSA plays samples too fast. - -dwc_otg: Return full-speed frame numbers in HS mode - -The frame counter increments on every *microframe* in high-speed mode. -Most device drivers expect this number to be in full-speed frames - this -caused considerable confusion to e.g. snd_usb_audio which uses the -frame counter to estimate the number of samples played. - -fiq_fsm: save PID on completion of interrupt OUT transfers - -Also add edge case handling for interrupt transports. - -Note that for periodic split IN, data toggles are unimplemented in the -OTG host hardware - it unconditionally accepts any PID. - -fiq_fsm: add missing case for fiq_fsm_tt_in_use() - -Certain combinations of bitrate and endpoint activity could -result in a periodic transaction erroneously getting started -while the previous Isochronous OUT was still active. - -fiq_fsm: clear hcintmsk for aborted transactions - -Prevents the FIQ from erroneously handling interrupts -on a timed out channel. - -fiq_fsm: enable by default - -fiq_fsm: fix dequeues for non-periodic split transactions - -If a dequeue happened between the SSPLIT and CSPLIT phases of the -transaction, the HCD would never receive an interrupt. - -fiq_fsm: Disable by default - -fiq_fsm: Handle HC babble errors - -The HCTSIZ transfer size field raises a babble interrupt if -the counter wraps. Handle the resulting interrupt in this case. - -dwc_otg: fix interrupt registration for fiq_enable=0 - -Additionally make the module parameter conditional for wherever -hcd->fiq_state is touched. - -fiq_fsm: Enable by default - -dwc_otg: Fix various issues with root port and transaction errors - -Process the host port interrupts correctly (and don't trample them). -Root port hotplug now functional again. - -Fix a few thinkos with the transaction error passthrough for fiq_fsm. - -fiq_fsm: Implement hack for Split Interrupt transactions - -Hubs aren't too picky about which endpoint we send Control type split -transactions to. By treating Interrupt transfers as Control, it is -possible to use the non-periodic queue in the OTG core as well as the -non-periodic FIFOs in the hub itself. This massively reduces the -microframe exclusivity/contention that periodic split transactions -otherwise have to enforce. - -It goes without saying that this is a fairly egregious USB specification -violation, but it works. - -Original idea by Hans Petter Selasky @ FreeBSD.org. - -dwc_otg: FIQ support on SMP. Set up FIQ stack and handler on Core 0 only. - -dwc_otg: introduce fiq_fsm_spin(un|)lock() - -SMP safety for the FIQ relies on register read-modify write cycles being -completed in the correct order. Several places in the DWC code modify -registers also touched by the FIQ. Protect these by a bare-bones lock -mechanism. - -This also makes it possible to run the FIQ and IRQ handlers on different -cores. - -fiq_fsm: fix build on bcm2708 and bcm2709 platforms - -dwc_otg: put some barriers back where they should be for UP - -bcm2709/dwc_otg: Setup FIQ on core 1 if >1 core active - -dwc_otg: fixup read-modify-write in critical paths - -Be more careful about read-modify-write on registers that the FIQ -also touches. - -Guard fiq_fsm_spin_lock with fiq_enable check - -fiq_fsm: Falling out of the state machine isn't fatal - -This edge case can be hit if the port is disabled while the FIQ is -in the middle of a transaction. Make the effects less severe. - -Also get rid of the useless return value. - -squash: dwc_otg: Allow to build without SMP - -usb: core: make overcurrent messages more prominent - -Hub overcurrent messages are more serious than "debug". Increase loglevel. - -usb: dwc_otg: Don't use dma_to_virt() - -Commit 6ce0d20 changes dma_to_virt() which breaks this driver. -Open code the old dma_to_virt() implementation to work around this. - -Limit the use of __bus_to_virt() to cases where transfer_buffer_length -is set and transfer_buffer is not set. This is done to increase the -chance that this driver will also work on ARCH_BCM2835. - -transfer_buffer should not be NULL if the length is set, but the -comment in the code indicates that there are situations where this -might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar -comment pointing to a possible: 'usb storage / SCSI bug'. - -Signed-off-by: Noralf Trønnes - -dwc_otg: Fix crash when fiq_enable=0 - -dwc_otg: fiq_fsm: Make high-speed isochronous strided transfers work properly - -Certain low-bandwidth high-speed USB devices (specialist audio devices, -compressed-frame webcams) have packet intervals > 1 microframe. - -Stride these transfers in the FIQ by using the start-of-frame interrupt -to restart the channel at the right time. - -dwc_otg: Force host mode to fix incorrect compute module boards - -dwc_otg: Add ARCH_BCM2835 support - -Signed-off-by: Noralf Trønnes - -dwc_otg: Simplify FIQ irq number code - -Dropping ATAGS means we can simplify the FIQ irq number code. -Also add error checking on the returned irq number. - -Signed-off-by: Noralf Trønnes - -dwc_otg: Remove duplicate gadget probe/unregister function - -dwc_otg: Properly set the HFIR - -Douglas Anderson reported: - -According to the most up to date version of the dwc2 databook, the FRINT -field of the HFIR register should be programmed to: -* 125 us * (PHY clock freq for HS) - 1 -* 1000 us * (PHY clock freq for FS/LS) - 1 - -This is opposed to older versions of the doc that claimed it should be: -* 125 us * (PHY clock freq for HS) -* 1000 us * (PHY clock freq for FS/LS) - -and reported lower timing jitter on a USB analyser - -dcw_otg: trim xfer length when buffer larger than allocated size is received - -dwc_otg: Don't free qh align buffers in atomic context - -dwc_otg: Enable the hack for Split Interrupt transactions by default - -dwc_otg.fiq_fsm_mask=0xF has long been a suggestion for users with audio stutters or other USB bandwidth issues. -So far we are aware of many success stories but no failure caused by this setting. -Make it a default to learn more. - -See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=70437 - -Signed-off-by: popcornmix - -dwc_otg: Use kzalloc when suitable - -dwc_otg: Pass struct device to dma_alloc*() - -This makes it possible to get the bus address from Device Tree. - -Signed-off-by: Noralf Trønnes ---- - arch/arm/include/asm/irqflags.h | 16 +- - arch/arm/kernel/fiqasm.S | 4 + - drivers/usb/Makefile | 1 + - drivers/usb/core/generic.c | 1 + - drivers/usb/core/hub.c | 2 +- - drivers/usb/core/message.c | 79 + - drivers/usb/core/otg_whitelist.h | 114 +- - drivers/usb/gadget/file_storage.c | 3676 ++++++++++ - drivers/usb/host/Kconfig | 13 + - drivers/usb/host/Makefile | 2 + - drivers/usb/host/dwc_common_port/Makefile | 58 + - drivers/usb/host/dwc_common_port/Makefile.fbsd | 17 + - drivers/usb/host/dwc_common_port/Makefile.linux | 49 + - drivers/usb/host/dwc_common_port/changes.txt | 174 + - drivers/usb/host/dwc_common_port/doc/doxygen.cfg | 270 + - drivers/usb/host/dwc_common_port/dwc_cc.c | 532 ++ - drivers/usb/host/dwc_common_port/dwc_cc.h | 224 + - drivers/usb/host/dwc_common_port/dwc_common_fbsd.c | 1308 ++++ - .../usb/host/dwc_common_port/dwc_common_linux.c | 1418 ++++ - drivers/usb/host/dwc_common_port/dwc_common_nbsd.c | 1275 ++++ - drivers/usb/host/dwc_common_port/dwc_crypto.c | 308 + - drivers/usb/host/dwc_common_port/dwc_crypto.h | 111 + - drivers/usb/host/dwc_common_port/dwc_dh.c | 291 + - drivers/usb/host/dwc_common_port/dwc_dh.h | 106 + - drivers/usb/host/dwc_common_port/dwc_list.h | 594 ++ - drivers/usb/host/dwc_common_port/dwc_mem.c | 245 + - drivers/usb/host/dwc_common_port/dwc_modpow.c | 636 ++ - drivers/usb/host/dwc_common_port/dwc_modpow.h | 34 + - drivers/usb/host/dwc_common_port/dwc_notifier.c | 319 + - drivers/usb/host/dwc_common_port/dwc_notifier.h | 122 + - drivers/usb/host/dwc_common_port/dwc_os.h | 1276 ++++ - drivers/usb/host/dwc_common_port/usb.h | 946 +++ - drivers/usb/host/dwc_otg/Makefile | 82 + - drivers/usb/host/dwc_otg/doc/doxygen.cfg | 224 + - drivers/usb/host/dwc_otg/dummy_audio.c | 1574 +++++ - drivers/usb/host/dwc_otg/dwc_cfi_common.h | 142 + - drivers/usb/host/dwc_otg/dwc_otg_adp.c | 854 +++ - drivers/usb/host/dwc_otg/dwc_otg_adp.h | 80 + - drivers/usb/host/dwc_otg/dwc_otg_attr.c | 1210 ++++ - drivers/usb/host/dwc_otg/dwc_otg_attr.h | 89 + - drivers/usb/host/dwc_otg/dwc_otg_cfi.c | 1876 +++++ - drivers/usb/host/dwc_otg/dwc_otg_cfi.h | 320 + - drivers/usb/host/dwc_otg/dwc_otg_cil.c | 7141 ++++++++++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_cil.h | 1464 ++++ - drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c | 1594 +++++ - drivers/usb/host/dwc_otg/dwc_otg_core_if.h | 705 ++ - drivers/usb/host/dwc_otg/dwc_otg_dbg.h | 117 + - drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1757 +++++ - drivers/usb/host/dwc_otg/dwc_otg_driver.h | 86 + - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 1355 ++++ - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 370 + - drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S | 80 + - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 4260 ++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 868 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1139 ++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2727 ++++++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1005 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 963 +++ - drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + - drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2725 ++++++++ - drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 273 + - drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h | 361 + - drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 5148 ++++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c | 1280 ++++ - drivers/usb/host/dwc_otg/dwc_otg_regs.h | 2550 +++++++ - drivers/usb/host/dwc_otg/test/Makefile | 16 + - drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + - drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + - drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + - 70 files changed, 59908 insertions(+), 16 deletions(-) - create mode 100644 drivers/usb/gadget/file_storage.c - create mode 100644 drivers/usb/host/dwc_common_port/Makefile - create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd - create mode 100644 drivers/usb/host/dwc_common_port/Makefile.linux - create mode 100644 drivers/usb/host/dwc_common_port/changes.txt - create mode 100644 drivers/usb/host/dwc_common_port/doc/doxygen.cfg - create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_fbsd.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_linux.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_nbsd.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_list.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_mem.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_os.h - create mode 100644 drivers/usb/host/dwc_common_port/usb.h - create mode 100644 drivers/usb/host/dwc_otg/Makefile - create mode 100644 drivers/usb/host/dwc_otg/doc/doxygen.cfg - create mode 100644 drivers/usb/host/dwc_otg/dummy_audio.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_cfi_common.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_core_if.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_dbg.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_os_dep.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_regs.h - create mode 100644 drivers/usb/host/dwc_otg/test/Makefile - create mode 100644 drivers/usb/host/dwc_otg/test/dwc_otg_test.pm - create mode 100644 drivers/usb/host/dwc_otg/test/test_mod_param.pl - create mode 100644 drivers/usb/host/dwc_otg/test/test_sysfs.pl - -diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h -index e6b70d9d084ea5d369c237f9a3f81c92e331a429..a48ccf7c73d873eb236b61e25a9e1cbde93b60e7 100644 ---- a/arch/arm/include/asm/irqflags.h -+++ b/arch/arm/include/asm/irqflags.h -@@ -162,13 +162,23 @@ static inline unsigned long arch_local_save_flags(void) - } - - /* -- * restore saved IRQ & FIQ state -+ * restore saved IRQ state - */ - #define arch_local_irq_restore arch_local_irq_restore - static inline void arch_local_irq_restore(unsigned long flags) - { -- asm volatile( -- " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore" -+ unsigned long temp = 0; -+ flags &= ~(1 << 6); -+ asm volatile ( -+ " mrs %0, cpsr" -+ : "=r" (temp) -+ : -+ : "memory", "cc"); -+ /* Preserve FIQ bit */ -+ temp &= (1 << 6); -+ flags = flags | temp; -+ asm volatile ( -+ " msr cpsr_c, %0 @ local_irq_restore" - : - : "r" (flags) - : "memory", "cc"); -diff --git a/arch/arm/kernel/fiqasm.S b/arch/arm/kernel/fiqasm.S -index 8dd26e1a9bd69051a1548d99c157cad2e65ba81b..eef484756af2179be8acd76b9ddbd3e983605990 100644 ---- a/arch/arm/kernel/fiqasm.S -+++ b/arch/arm/kernel/fiqasm.S -@@ -47,3 +47,7 @@ ENTRY(__get_fiq_regs) - mov r0, r0 @ avoid hazard prior to ARMv4 - ret lr - ENDPROC(__get_fiq_regs) -+ -+ENTRY(__FIQ_Branch) -+ mov pc, r8 -+ENDPROC(__FIQ_Branch) -diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index dca78565eb5500263051e9e1c889d84d6afd8fd9..5c467de6914e742b2ba25eb16e0c08b2e363532c 100644 ---- a/drivers/usb/Makefile -+++ b/drivers/usb/Makefile -@@ -7,6 +7,7 @@ - obj-$(CONFIG_USB) += core/ - obj-$(CONFIG_USB_SUPPORT) += phy/ - -+obj-$(CONFIG_USB_DWCOTG) += host/ - obj-$(CONFIG_USB_DWC3) += dwc3/ - obj-$(CONFIG_USB_DWC2) += dwc2/ - obj-$(CONFIG_USB_ISP1760) += isp1760/ -diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c -index 358ca8dd784fe43700ae070764fa783500a792fe..abaac7c7142d8887c1516957fc52162c0e1683f7 100644 ---- a/drivers/usb/core/generic.c -+++ b/drivers/usb/core/generic.c -@@ -152,6 +152,7 @@ int usb_choose_configuration(struct usb_device *udev) - dev_warn(&udev->dev, - "no configuration chosen from %d choice%s\n", - num_configs, plural(num_configs)); -+ dev_warn(&udev->dev, "No support over %dmA\n", udev->bus_mA); - } - return i; - } -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index aef81a16e2c8534701b8583392400faf77971d23..4197a5b5fb7abae67bd4aa32c29cb84c1f2fe22e 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -5009,7 +5009,7 @@ static void port_event(struct usb_hub *hub, int port1) - if (portchange & USB_PORT_STAT_C_OVERCURRENT) { - u16 status = 0, unused; - -- dev_dbg(&port_dev->dev, "over-current change\n"); -+ dev_notice(&port_dev->dev, "over-current change\n"); - usb_clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_OVER_CURRENT); - msleep(100); /* Cool down */ -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index 3a47077461578f2af47af8d551353c2c7cb12f0e..85b7ff6f24b8023e1b589aa1a3557885c48d7a13 100644 ---- a/drivers/usb/core/message.c -+++ b/drivers/usb/core/message.c -@@ -1908,6 +1908,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) - if (cp->string == NULL && - !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) - cp->string = usb_cache_string(dev, cp->desc.iConfiguration); -+/* Uncomment this define to enable the HS Electrical Test support */ -+#define DWC_HS_ELECT_TST 1 -+#ifdef DWC_HS_ELECT_TST -+ /* Here we implement the HS Electrical Test support. The -+ * tester uses a vendor ID of 0x1A0A to indicate we should -+ * run a special test sequence. The product ID tells us -+ * which sequence to run. We invoke the test sequence by -+ * sending a non-standard SetFeature command to our root -+ * hub port. Our dwc_otg_hcd_hub_control() routine will -+ * recognize the command and perform the desired test -+ * sequence. -+ */ -+ if (dev->descriptor.idVendor == 0x1A0A) { -+ /* HSOTG Electrical Test */ -+ dev_warn(&dev->dev, "VID from HSOTG Electrical Test Fixture\n"); -+ -+ if (dev->bus && dev->bus->root_hub) { -+ struct usb_device *hdev = dev->bus->root_hub; -+ dev_warn(&dev->dev, "Got PID 0x%x\n", dev->descriptor.idProduct); -+ -+ switch (dev->descriptor.idProduct) { -+ case 0x0101: /* TEST_SE0_NAK */ -+ dev_warn(&dev->dev, "TEST_SE0_NAK\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x300, NULL, 0, HZ); -+ break; -+ -+ case 0x0102: /* TEST_J */ -+ dev_warn(&dev->dev, "TEST_J\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x100, NULL, 0, HZ); -+ break; -+ -+ case 0x0103: /* TEST_K */ -+ dev_warn(&dev->dev, "TEST_K\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x200, NULL, 0, HZ); -+ break; -+ -+ case 0x0104: /* TEST_PACKET */ -+ dev_warn(&dev->dev, "TEST_PACKET\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x400, NULL, 0, HZ); -+ break; -+ -+ case 0x0105: /* TEST_FORCE_ENABLE */ -+ dev_warn(&dev->dev, "TEST_FORCE_ENABLE\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x500, NULL, 0, HZ); -+ break; -+ -+ case 0x0106: /* HS_HOST_PORT_SUSPEND_RESUME */ -+ dev_warn(&dev->dev, "HS_HOST_PORT_SUSPEND_RESUME\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x600, NULL, 0, 40 * HZ); -+ break; -+ -+ case 0x0107: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ -+ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x700, NULL, 0, 40 * HZ); -+ break; -+ -+ case 0x0108: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ -+ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x800, NULL, 0, 40 * HZ); -+ } -+ } -+ } -+#endif /* DWC_HS_ELECT_TST */ - - /* Now that the interfaces are installed, re-enable LPM. */ - usb_unlocked_enable_lpm(dev); -diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h -index 085049d37d7a5b23ff8dbf44b02afc1837fe3b68..63a461a21cc14b9c6f14db7c1d03c7a2ebcdba65 100644 ---- a/drivers/usb/core/otg_whitelist.h -+++ b/drivers/usb/core/otg_whitelist.h -@@ -19,33 +19,82 @@ - static struct usb_device_id whitelist_table[] = { - - /* hubs are optional in OTG, but very handy ... */ -+#define CERT_WITHOUT_HUBS -+#if defined(CERT_WITHOUT_HUBS) -+{ USB_DEVICE( 0x0000, 0x0000 ), }, /* Root HUB Only*/ -+#else - { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, - { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), }, -+{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 2), }, -+#endif - - #ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */ - /* FIXME actually, printers are NOT supposed to use device classes; - * they're supposed to use interface classes... - */ --{ USB_DEVICE_INFO(7, 1, 1) }, --{ USB_DEVICE_INFO(7, 1, 2) }, --{ USB_DEVICE_INFO(7, 1, 3) }, -+//{ USB_DEVICE_INFO(7, 1, 1) }, -+//{ USB_DEVICE_INFO(7, 1, 2) }, -+//{ USB_DEVICE_INFO(7, 1, 3) }, - #endif - - #ifdef CONFIG_USB_NET_CDCETHER - /* Linux-USB CDC Ethernet gadget */ --{ USB_DEVICE(0x0525, 0xa4a1), }, -+//{ USB_DEVICE(0x0525, 0xa4a1), }, - /* Linux-USB CDC Ethernet + RNDIS gadget */ --{ USB_DEVICE(0x0525, 0xa4a2), }, -+//{ USB_DEVICE(0x0525, 0xa4a2), }, - #endif - - #if IS_ENABLED(CONFIG_USB_TEST) - /* gadget zero, for testing */ --{ USB_DEVICE(0x0525, 0xa4a0), }, -+//{ USB_DEVICE(0x0525, 0xa4a0), }, - #endif - -+/* OPT Tester */ -+{ USB_DEVICE( 0x1a0a, 0x0101 ), }, /* TEST_SE0_NAK */ -+{ USB_DEVICE( 0x1a0a, 0x0102 ), }, /* Test_J */ -+{ USB_DEVICE( 0x1a0a, 0x0103 ), }, /* Test_K */ -+{ USB_DEVICE( 0x1a0a, 0x0104 ), }, /* Test_PACKET */ -+{ USB_DEVICE( 0x1a0a, 0x0105 ), }, /* Test_FORCE_ENABLE */ -+{ USB_DEVICE( 0x1a0a, 0x0106 ), }, /* HS_PORT_SUSPEND_RESUME */ -+{ USB_DEVICE( 0x1a0a, 0x0107 ), }, /* SINGLE_STEP_GET_DESCRIPTOR setup */ -+{ USB_DEVICE( 0x1a0a, 0x0108 ), }, /* SINGLE_STEP_GET_DESCRIPTOR execute */ -+ -+/* Sony cameras */ -+{ USB_DEVICE_VER(0x054c,0x0010,0x0410, 0x0500), }, -+ -+/* Memory Devices */ -+//{ USB_DEVICE( 0x0781, 0x5150 ), }, /* SanDisk */ -+//{ USB_DEVICE( 0x05DC, 0x0080 ), }, /* Lexar */ -+//{ USB_DEVICE( 0x4146, 0x9281 ), }, /* IOMEGA */ -+//{ USB_DEVICE( 0x067b, 0x2507 ), }, /* Hammer 20GB External HD */ -+{ USB_DEVICE( 0x0EA0, 0x2168 ), }, /* Ours Technology Inc. (BUFFALO ClipDrive)*/ -+//{ USB_DEVICE( 0x0457, 0x0150 ), }, /* Silicon Integrated Systems Corp. */ -+ -+/* HP Printers */ -+//{ USB_DEVICE( 0x03F0, 0x1102 ), }, /* HP Photosmart 245 */ -+//{ USB_DEVICE( 0x03F0, 0x1302 ), }, /* HP Photosmart 370 Series */ -+ -+/* Speakers */ -+//{ USB_DEVICE( 0x0499, 0x3002 ), }, /* YAMAHA YST-MS35D USB Speakers */ -+//{ USB_DEVICE( 0x0672, 0x1041 ), }, /* Labtec USB Headset */ -+ - { } /* Terminating entry */ - }; - -+static inline void report_errors(struct usb_device *dev) -+{ -+ /* OTG MESSAGE: report errors here, customize to match your product */ -+ dev_info(&dev->dev, "device Vendor:%04x Product:%04x is not supported\n", -+ le16_to_cpu(dev->descriptor.idVendor), -+ le16_to_cpu(dev->descriptor.idProduct)); -+ if (USB_CLASS_HUB == dev->descriptor.bDeviceClass){ -+ dev_printk(KERN_CRIT, &dev->dev, "Unsupported Hub Topology\n"); -+ } else { -+ dev_printk(KERN_CRIT, &dev->dev, "Attached Device is not Supported\n"); -+ } -+} -+ -+ - static int is_targeted(struct usb_device *dev) - { - struct usb_device_id *id = whitelist_table; -@@ -95,16 +144,57 @@ static int is_targeted(struct usb_device *dev) - continue; - - return 1; -- } -+ /* NOTE: can't use usb_match_id() since interface caches -+ * aren't set up yet. this is cut/paste from that code. -+ */ -+ for (id = whitelist_table; id->match_flags; id++) { -+#ifdef DEBUG -+ dev_dbg(&dev->dev, -+ "ID: V:%04x P:%04x DC:%04x SC:%04x PR:%04x \n", -+ id->idVendor, -+ id->idProduct, -+ id->bDeviceClass, -+ id->bDeviceSubClass, -+ id->bDeviceProtocol); -+#endif - -- /* add other match criteria here ... */ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && -+ id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) -+ continue; - -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && -+ id->idProduct != le16_to_cpu(dev->descriptor.idProduct)) -+ continue; - -- /* OTG MESSAGE: report errors here, customize to match your product */ -- dev_err(&dev->dev, "device v%04x p%04x is not supported\n", -- le16_to_cpu(dev->descriptor.idVendor), -- le16_to_cpu(dev->descriptor.idProduct)); -+ /* No need to test id->bcdDevice_lo != 0, since 0 is never -+ greater than any unsigned number. */ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && -+ (id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice))) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && -+ (id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice))) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && -+ (id->bDeviceClass != dev->descriptor.bDeviceClass)) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && -+ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && -+ (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) -+ continue; -+ -+ return 1; -+ } -+ } -+ -+ /* add other match criteria here ... */ - -+ report_errors(dev); - return 0; - } - -diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c -new file mode 100644 -index 0000000000000000000000000000000000000000..a896d73f7a9336f5a34015c44ea5a6b04ce34f10 ---- /dev/null -+++ b/drivers/usb/gadget/file_storage.c -@@ -0,0 +1,3676 @@ -+/* -+ * file_storage.c -- File-backed USB Storage Gadget, for USB development -+ * -+ * Copyright (C) 2003-2008 Alan Stern -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") as published by the Free Software -+ * Foundation, either version 2 of that License or (at your option) any -+ * later version. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+ -+/* -+ * The File-backed Storage Gadget acts as a USB Mass Storage device, -+ * appearing to the host as a disk drive or as a CD-ROM drive. In addition -+ * to providing an example of a genuinely useful gadget driver for a USB -+ * device, it also illustrates a technique of double-buffering for increased -+ * throughput. Last but not least, it gives an easy way to probe the -+ * behavior of the Mass Storage drivers in a USB host. -+ * -+ * Backing storage is provided by a regular file or a block device, specified -+ * by the "file" module parameter. Access can be limited to read-only by -+ * setting the optional "ro" module parameter. (For CD-ROM emulation, -+ * access is always read-only.) The gadget will indicate that it has -+ * removable media if the optional "removable" module parameter is set. -+ * -+ * The gadget supports the Control-Bulk (CB), Control-Bulk-Interrupt (CBI), -+ * and Bulk-Only (also known as Bulk-Bulk-Bulk or BBB) transports, selected -+ * by the optional "transport" module parameter. It also supports the -+ * following protocols: RBC (0x01), ATAPI or SFF-8020i (0x02), QIC-157 (0c03), -+ * UFI (0x04), SFF-8070i (0x05), and transparent SCSI (0x06), selected by -+ * the optional "protocol" module parameter. In addition, the default -+ * Vendor ID, Product ID, release number and serial number can be overridden. -+ * -+ * There is support for multiple logical units (LUNs), each of which has -+ * its own backing file. The number of LUNs can be set using the optional -+ * "luns" module parameter (anywhere from 1 to 8), and the corresponding -+ * files are specified using comma-separated lists for "file" and "ro". -+ * The default number of LUNs is taken from the number of "file" elements; -+ * it is 1 if "file" is not given. If "removable" is not set then a backing -+ * file must be specified for each LUN. If it is set, then an unspecified -+ * or empty backing filename means the LUN's medium is not loaded. Ideally -+ * each LUN would be settable independently as a disk drive or a CD-ROM -+ * drive, but currently all LUNs have to be the same type. The CD-ROM -+ * emulation includes a single data track and no audio tracks; hence there -+ * need be only one backing file per LUN. -+ * -+ * Requirements are modest; only a bulk-in and a bulk-out endpoint are -+ * needed (an interrupt-out endpoint is also needed for CBI). The memory -+ * requirement amounts to two 16K buffers, size configurable by a parameter. -+ * Support is included for both full-speed and high-speed operation. -+ * -+ * Note that the driver is slightly non-portable in that it assumes a -+ * single memory/DMA buffer will be useable for bulk-in, bulk-out, and -+ * interrupt-in endpoints. With most device controllers this isn't an -+ * issue, but there may be some with hardware restrictions that prevent -+ * a buffer from being used by more than one endpoint. -+ * -+ * Module options: -+ * -+ * file=filename[,filename...] -+ * Required if "removable" is not set, names of -+ * the files or block devices used for -+ * backing storage -+ * serial=HHHH... Required serial number (string of hex chars) -+ * ro=b[,b...] Default false, booleans for read-only access -+ * removable Default false, boolean for removable media -+ * luns=N Default N = number of filenames, number of -+ * LUNs to support -+ * nofua=b[,b...] Default false, booleans for ignore FUA flag -+ * in SCSI WRITE(10,12) commands -+ * stall Default determined according to the type of -+ * USB device controller (usually true), -+ * boolean to permit the driver to halt -+ * bulk endpoints -+ * cdrom Default false, boolean for whether to emulate -+ * a CD-ROM drive -+ * transport=XXX Default BBB, transport name (CB, CBI, or BBB) -+ * protocol=YYY Default SCSI, protocol name (RBC, 8020 or -+ * ATAPI, QIC, UFI, 8070, or SCSI; -+ * also 1 - 6) -+ * vendor=0xVVVV Default 0x0525 (NetChip), USB Vendor ID -+ * product=0xPPPP Default 0xa4a5 (FSG), USB Product ID -+ * release=0xRRRR Override the USB release number (bcdDevice) -+ * buflen=N Default N=16384, buffer size used (will be -+ * rounded down to a multiple of -+ * PAGE_CACHE_SIZE) -+ * -+ * If CONFIG_USB_FILE_STORAGE_TEST is not set, only the "file", "serial", "ro", -+ * "removable", "luns", "nofua", "stall", and "cdrom" options are available; -+ * default values are used for everything else. -+ * -+ * The pathnames of the backing files and the ro settings are available in -+ * the attribute files "file", "nofua", and "ro" in the lun subdirectory of -+ * the gadget's sysfs directory. If the "removable" option is set, writing to -+ * these files will simulate ejecting/loading the medium (writing an empty -+ * line means eject) and adjusting a write-enable tab. Changes to the ro -+ * setting are not allowed when the medium is loaded or if CD-ROM emulation -+ * is being used. -+ * -+ * This gadget driver is heavily based on "Gadget Zero" by David Brownell. -+ * The driver's SCSI command interface was based on the "Information -+ * technology - Small Computer System Interface - 2" document from -+ * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at -+ * . The single exception -+ * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the -+ * "Universal Serial Bus Mass Storage Class UFI Command Specification" -+ * document, Revision 1.0, December 14, 1998, available at -+ * . -+ */ -+ -+ -+/* -+ * Driver Design -+ * -+ * The FSG driver is fairly straightforward. There is a main kernel -+ * thread that handles most of the work. Interrupt routines field -+ * callbacks from the controller driver: bulk- and interrupt-request -+ * completion notifications, endpoint-0 events, and disconnect events. -+ * Completion events are passed to the main thread by wakeup calls. Many -+ * ep0 requests are handled at interrupt time, but SetInterface, -+ * SetConfiguration, and device reset requests are forwarded to the -+ * thread in the form of "exceptions" using SIGUSR1 signals (since they -+ * should interrupt any ongoing file I/O operations). -+ * -+ * The thread's main routine implements the standard command/data/status -+ * parts of a SCSI interaction. It and its subroutines are full of tests -+ * for pending signals/exceptions -- all this polling is necessary since -+ * the kernel has no setjmp/longjmp equivalents. (Maybe this is an -+ * indication that the driver really wants to be running in userspace.) -+ * An important point is that so long as the thread is alive it keeps an -+ * open reference to the backing file. This will prevent unmounting -+ * the backing file's underlying filesystem and could cause problems -+ * during system shutdown, for example. To prevent such problems, the -+ * thread catches INT, TERM, and KILL signals and converts them into -+ * an EXIT exception. -+ * -+ * In normal operation the main thread is started during the gadget's -+ * fsg_bind() callback and stopped during fsg_unbind(). But it can also -+ * exit when it receives a signal, and there's no point leaving the -+ * gadget running when the thread is dead. So just before the thread -+ * exits, it deregisters the gadget driver. This makes things a little -+ * tricky: The driver is deregistered at two places, and the exiting -+ * thread can indirectly call fsg_unbind() which in turn can tell the -+ * thread to exit. The first problem is resolved through the use of the -+ * REGISTERED atomic bitflag; the driver will only be deregistered once. -+ * The second problem is resolved by having fsg_unbind() check -+ * fsg->state; it won't try to stop the thread if the state is already -+ * FSG_STATE_TERMINATED. -+ * -+ * To provide maximum throughput, the driver uses a circular pipeline of -+ * buffer heads (struct fsg_buffhd). In principle the pipeline can be -+ * arbitrarily long; in practice the benefits don't justify having more -+ * than 2 stages (i.e., double buffering). But it helps to think of the -+ * pipeline as being a long one. Each buffer head contains a bulk-in and -+ * a bulk-out request pointer (since the buffer can be used for both -+ * output and input -- directions always are given from the host's -+ * point of view) as well as a pointer to the buffer and various state -+ * variables. -+ * -+ * Use of the pipeline follows a simple protocol. There is a variable -+ * (fsg->next_buffhd_to_fill) that points to the next buffer head to use. -+ * At any time that buffer head may still be in use from an earlier -+ * request, so each buffer head has a state variable indicating whether -+ * it is EMPTY, FULL, or BUSY. Typical use involves waiting for the -+ * buffer head to be EMPTY, filling the buffer either by file I/O or by -+ * USB I/O (during which the buffer head is BUSY), and marking the buffer -+ * head FULL when the I/O is complete. Then the buffer will be emptied -+ * (again possibly by USB I/O, during which it is marked BUSY) and -+ * finally marked EMPTY again (possibly by a completion routine). -+ * -+ * A module parameter tells the driver to avoid stalling the bulk -+ * endpoints wherever the transport specification allows. This is -+ * necessary for some UDCs like the SuperH, which cannot reliably clear a -+ * halt on a bulk endpoint. However, under certain circumstances the -+ * Bulk-only specification requires a stall. In such cases the driver -+ * will halt the endpoint and set a flag indicating that it should clear -+ * the halt in software during the next device reset. Hopefully this -+ * will permit everything to work correctly. Furthermore, although the -+ * specification allows the bulk-out endpoint to halt when the host sends -+ * too much data, implementing this would cause an unavoidable race. -+ * The driver will always use the "no-stall" approach for OUT transfers. -+ * -+ * One subtle point concerns sending status-stage responses for ep0 -+ * requests. Some of these requests, such as device reset, can involve -+ * interrupting an ongoing file I/O operation, which might take an -+ * arbitrarily long time. During that delay the host might give up on -+ * the original ep0 request and issue a new one. When that happens the -+ * driver should not notify the host about completion of the original -+ * request, as the host will no longer be waiting for it. So the driver -+ * assigns to each ep0 request a unique tag, and it keeps track of the -+ * tag value of the request associated with a long-running exception -+ * (device-reset, interface-change, or configuration-change). When the -+ * exception handler is finished, the status-stage response is submitted -+ * only if the current ep0 request tag is equal to the exception request -+ * tag. Thus only the most recently received ep0 request will get a -+ * status-stage response. -+ * -+ * Warning: This driver source file is too long. It ought to be split up -+ * into a header file plus about 3 separate .c files, to handle the details -+ * of the Gadget, USB Mass Storage, and SCSI protocols. -+ */ -+ -+ -+/* #define VERBOSE_DEBUG */ -+/* #define DUMP_MSGS */ -+ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "gadget_chips.h" -+ -+ -+ -+/* -+ * Kbuild is not very cooperative with respect to linking separately -+ * compiled library objects into one module. So for now we won't use -+ * separate compilation ... ensuring init/exit sections work to shrink -+ * the runtime footprint, and giving us at least some parts of what -+ * a "gcc --combine ... part1.c part2.c part3.c ... " build would. -+ */ -+#include "usbstring.c" -+#include "config.c" -+#include "epautoconf.c" -+ -+/*-------------------------------------------------------------------------*/ -+ -+#define DRIVER_DESC "File-backed Storage Gadget" -+#define DRIVER_NAME "g_file_storage" -+#define DRIVER_VERSION "1 September 2010" -+ -+static char fsg_string_manufacturer[64]; -+static const char fsg_string_product[] = DRIVER_DESC; -+static const char fsg_string_config[] = "Self-powered"; -+static const char fsg_string_interface[] = "Mass Storage"; -+ -+ -+#include "storage_common.c" -+ -+ -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_AUTHOR("Alan Stern"); -+MODULE_LICENSE("Dual BSD/GPL"); -+ -+/* -+ * This driver assumes self-powered hardware and has no way for users to -+ * trigger remote wakeup. It uses autoconfiguration to select endpoints -+ * and endpoint addresses. -+ */ -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+ -+/* Encapsulate the module parameter settings */ -+ -+static struct { -+ char *file[FSG_MAX_LUNS]; -+ char *serial; -+ bool ro[FSG_MAX_LUNS]; -+ bool nofua[FSG_MAX_LUNS]; -+ unsigned int num_filenames; -+ unsigned int num_ros; -+ unsigned int num_nofuas; -+ unsigned int nluns; -+ -+ bool removable; -+ bool can_stall; -+ bool cdrom; -+ -+ char *transport_parm; -+ char *protocol_parm; -+ unsigned short vendor; -+ unsigned short product; -+ unsigned short release; -+ unsigned int buflen; -+ -+ int transport_type; -+ char *transport_name; -+ int protocol_type; -+ char *protocol_name; -+ -+} mod_data = { // Default values -+ .transport_parm = "BBB", -+ .protocol_parm = "SCSI", -+ .removable = 0, -+ .can_stall = 1, -+ .cdrom = 0, -+ .vendor = FSG_VENDOR_ID, -+ .product = FSG_PRODUCT_ID, -+ .release = 0xffff, // Use controller chip type -+ .buflen = 16384, -+ }; -+ -+ -+module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames, -+ S_IRUGO); -+MODULE_PARM_DESC(file, "names of backing files or devices"); -+ -+module_param_named(serial, mod_data.serial, charp, S_IRUGO); -+MODULE_PARM_DESC(serial, "USB serial number"); -+ -+module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO); -+MODULE_PARM_DESC(ro, "true to force read-only"); -+ -+module_param_array_named(nofua, mod_data.nofua, bool, &mod_data.num_nofuas, -+ S_IRUGO); -+MODULE_PARM_DESC(nofua, "true to ignore SCSI WRITE(10,12) FUA bit"); -+ -+module_param_named(luns, mod_data.nluns, uint, S_IRUGO); -+MODULE_PARM_DESC(luns, "number of LUNs"); -+ -+module_param_named(removable, mod_data.removable, bool, S_IRUGO); -+MODULE_PARM_DESC(removable, "true to simulate removable media"); -+ -+module_param_named(stall, mod_data.can_stall, bool, S_IRUGO); -+MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); -+ -+module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO); -+MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk"); -+ -+/* In the non-TEST version, only the module parameters listed above -+ * are available. */ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ -+module_param_named(transport, mod_data.transport_parm, charp, S_IRUGO); -+MODULE_PARM_DESC(transport, "type of transport (BBB, CBI, or CB)"); -+ -+module_param_named(protocol, mod_data.protocol_parm, charp, S_IRUGO); -+MODULE_PARM_DESC(protocol, "type of protocol (RBC, 8020, QIC, UFI, " -+ "8070, or SCSI)"); -+ -+module_param_named(vendor, mod_data.vendor, ushort, S_IRUGO); -+MODULE_PARM_DESC(vendor, "USB Vendor ID"); -+ -+module_param_named(product, mod_data.product, ushort, S_IRUGO); -+MODULE_PARM_DESC(product, "USB Product ID"); -+ -+module_param_named(release, mod_data.release, ushort, S_IRUGO); -+MODULE_PARM_DESC(release, "USB release number"); -+ -+module_param_named(buflen, mod_data.buflen, uint, S_IRUGO); -+MODULE_PARM_DESC(buflen, "I/O buffer size"); -+ -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+/* -+ * These definitions will permit the compiler to avoid generating code for -+ * parts of the driver that aren't used in the non-TEST version. Even gcc -+ * can recognize when a test of a constant expression yields a dead code -+ * path. -+ */ -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ -+#define transport_is_bbb() (mod_data.transport_type == USB_PR_BULK) -+#define transport_is_cbi() (mod_data.transport_type == USB_PR_CBI) -+#define protocol_is_scsi() (mod_data.protocol_type == USB_SC_SCSI) -+ -+#else -+ -+#define transport_is_bbb() 1 -+#define transport_is_cbi() 0 -+#define protocol_is_scsi() 1 -+ -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+ -+struct fsg_dev { -+ /* lock protects: state, all the req_busy's, and cbbuf_cmnd */ -+ spinlock_t lock; -+ struct usb_gadget *gadget; -+ -+ /* filesem protects: backing files in use */ -+ struct rw_semaphore filesem; -+ -+ /* reference counting: wait until all LUNs are released */ -+ struct kref ref; -+ -+ struct usb_ep *ep0; // Handy copy of gadget->ep0 -+ struct usb_request *ep0req; // For control responses -+ unsigned int ep0_req_tag; -+ const char *ep0req_name; -+ -+ struct usb_request *intreq; // For interrupt responses -+ int intreq_busy; -+ struct fsg_buffhd *intr_buffhd; -+ -+ unsigned int bulk_out_maxpacket; -+ enum fsg_state state; // For exception handling -+ unsigned int exception_req_tag; -+ -+ u8 config, new_config; -+ -+ unsigned int running : 1; -+ unsigned int bulk_in_enabled : 1; -+ unsigned int bulk_out_enabled : 1; -+ unsigned int intr_in_enabled : 1; -+ unsigned int phase_error : 1; -+ unsigned int short_packet_received : 1; -+ unsigned int bad_lun_okay : 1; -+ -+ unsigned long atomic_bitflags; -+#define REGISTERED 0 -+#define IGNORE_BULK_OUT 1 -+#define SUSPENDED 2 -+ -+ struct usb_ep *bulk_in; -+ struct usb_ep *bulk_out; -+ struct usb_ep *intr_in; -+ -+ struct fsg_buffhd *next_buffhd_to_fill; -+ struct fsg_buffhd *next_buffhd_to_drain; -+ -+ int thread_wakeup_needed; -+ struct completion thread_notifier; -+ struct task_struct *thread_task; -+ -+ int cmnd_size; -+ u8 cmnd[MAX_COMMAND_SIZE]; -+ enum data_direction data_dir; -+ u32 data_size; -+ u32 data_size_from_cmnd; -+ u32 tag; -+ unsigned int lun; -+ u32 residue; -+ u32 usb_amount_left; -+ -+ /* The CB protocol offers no way for a host to know when a command -+ * has completed. As a result the next command may arrive early, -+ * and we will still have to handle it. For that reason we need -+ * a buffer to store new commands when using CB (or CBI, which -+ * does not oblige a host to wait for command completion either). */ -+ int cbbuf_cmnd_size; -+ u8 cbbuf_cmnd[MAX_COMMAND_SIZE]; -+ -+ unsigned int nluns; -+ struct fsg_lun *luns; -+ struct fsg_lun *curlun; -+ /* Must be the last entry */ -+ struct fsg_buffhd buffhds[]; -+}; -+ -+typedef void (*fsg_routine_t)(struct fsg_dev *); -+ -+static int exception_in_progress(struct fsg_dev *fsg) -+{ -+ return (fsg->state > FSG_STATE_IDLE); -+} -+ -+/* Make bulk-out requests be divisible by the maxpacket size */ -+static void set_bulk_out_req_length(struct fsg_dev *fsg, -+ struct fsg_buffhd *bh, unsigned int length) -+{ -+ unsigned int rem; -+ -+ bh->bulk_out_intended_length = length; -+ rem = length % fsg->bulk_out_maxpacket; -+ if (rem > 0) -+ length += fsg->bulk_out_maxpacket - rem; -+ bh->outreq->length = length; -+} -+ -+static struct fsg_dev *the_fsg; -+static struct usb_gadget_driver fsg_driver; -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) -+{ -+ const char *name; -+ -+ if (ep == fsg->bulk_in) -+ name = "bulk-in"; -+ else if (ep == fsg->bulk_out) -+ name = "bulk-out"; -+ else -+ name = ep->name; -+ DBG(fsg, "%s set halt\n", name); -+ return usb_ep_set_halt(ep); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* -+ * DESCRIPTORS ... most are static, but strings and (full) configuration -+ * descriptors are built on demand. Also the (static) config and interface -+ * descriptors are adjusted during fsg_bind(). -+ */ -+ -+/* There is only one configuration. */ -+#define CONFIG_VALUE 1 -+ -+static struct usb_device_descriptor -+device_desc = { -+ .bLength = sizeof device_desc, -+ .bDescriptorType = USB_DT_DEVICE, -+ -+ .bcdUSB = cpu_to_le16(0x0200), -+ .bDeviceClass = USB_CLASS_PER_INTERFACE, -+ -+ /* The next three values can be overridden by module parameters */ -+ .idVendor = cpu_to_le16(FSG_VENDOR_ID), -+ .idProduct = cpu_to_le16(FSG_PRODUCT_ID), -+ .bcdDevice = cpu_to_le16(0xffff), -+ -+ .iManufacturer = FSG_STRING_MANUFACTURER, -+ .iProduct = FSG_STRING_PRODUCT, -+ .iSerialNumber = FSG_STRING_SERIAL, -+ .bNumConfigurations = 1, -+}; -+ -+static struct usb_config_descriptor -+config_desc = { -+ .bLength = sizeof config_desc, -+ .bDescriptorType = USB_DT_CONFIG, -+ -+ /* wTotalLength computed by usb_gadget_config_buf() */ -+ .bNumInterfaces = 1, -+ .bConfigurationValue = CONFIG_VALUE, -+ .iConfiguration = FSG_STRING_CONFIG, -+ .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, -+ .bMaxPower = CONFIG_USB_GADGET_VBUS_DRAW / 2, -+}; -+ -+ -+static struct usb_qualifier_descriptor -+dev_qualifier = { -+ .bLength = sizeof dev_qualifier, -+ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, -+ -+ .bcdUSB = cpu_to_le16(0x0200), -+ .bDeviceClass = USB_CLASS_PER_INTERFACE, -+ -+ .bNumConfigurations = 1, -+}; -+ -+static int populate_bos(struct fsg_dev *fsg, u8 *buf) -+{ -+ memcpy(buf, &fsg_bos_desc, USB_DT_BOS_SIZE); -+ buf += USB_DT_BOS_SIZE; -+ -+ memcpy(buf, &fsg_ext_cap_desc, USB_DT_USB_EXT_CAP_SIZE); -+ buf += USB_DT_USB_EXT_CAP_SIZE; -+ -+ memcpy(buf, &fsg_ss_cap_desc, USB_DT_USB_SS_CAP_SIZE); -+ -+ return USB_DT_BOS_SIZE + USB_DT_USB_SS_CAP_SIZE -+ + USB_DT_USB_EXT_CAP_SIZE; -+} -+ -+/* -+ * Config descriptors must agree with the code that sets configurations -+ * and with code managing interfaces and their altsettings. They must -+ * also handle different speeds and other-speed requests. -+ */ -+static int populate_config_buf(struct usb_gadget *gadget, -+ u8 *buf, u8 type, unsigned index) -+{ -+ enum usb_device_speed speed = gadget->speed; -+ int len; -+ const struct usb_descriptor_header **function; -+ -+ if (index > 0) -+ return -EINVAL; -+ -+ if (gadget_is_dualspeed(gadget) && type == USB_DT_OTHER_SPEED_CONFIG) -+ speed = (USB_SPEED_FULL + USB_SPEED_HIGH) - speed; -+ function = gadget_is_dualspeed(gadget) && speed == USB_SPEED_HIGH -+ ? (const struct usb_descriptor_header **)fsg_hs_function -+ : (const struct usb_descriptor_header **)fsg_fs_function; -+ -+ /* for now, don't advertise srp-only devices */ -+ if (!gadget_is_otg(gadget)) -+ function++; -+ -+ len = usb_gadget_config_buf(&config_desc, buf, EP0_BUFSIZE, function); -+ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; -+ return len; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* These routines may be called in process context or in_irq */ -+ -+/* Caller must hold fsg->lock */ -+static void wakeup_thread(struct fsg_dev *fsg) -+{ -+ /* Tell the main thread that something has happened */ -+ fsg->thread_wakeup_needed = 1; -+ if (fsg->thread_task) -+ wake_up_process(fsg->thread_task); -+} -+ -+ -+static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) -+{ -+ unsigned long flags; -+ -+ /* Do nothing if a higher-priority exception is already in progress. -+ * If a lower-or-equal priority exception is in progress, preempt it -+ * and notify the main thread by sending it a signal. */ -+ spin_lock_irqsave(&fsg->lock, flags); -+ if (fsg->state <= new_state) { -+ fsg->exception_req_tag = fsg->ep0_req_tag; -+ fsg->state = new_state; -+ if (fsg->thread_task) -+ send_sig_info(SIGUSR1, SEND_SIG_FORCED, -+ fsg->thread_task); -+ } -+ spin_unlock_irqrestore(&fsg->lock, flags); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* The disconnect callback and ep0 routines. These always run in_irq, -+ * except that ep0_queue() is called in the main thread to acknowledge -+ * completion of various requests: set config, set interface, and -+ * Bulk-only device reset. */ -+ -+static void fsg_disconnect(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ -+ DBG(fsg, "disconnect or port reset\n"); -+ raise_exception(fsg, FSG_STATE_DISCONNECT); -+} -+ -+ -+static int ep0_queue(struct fsg_dev *fsg) -+{ -+ int rc; -+ -+ rc = usb_ep_queue(fsg->ep0, fsg->ep0req, GFP_ATOMIC); -+ if (rc != 0 && rc != -ESHUTDOWN) { -+ -+ /* We can't do much more than wait for a reset */ -+ WARNING(fsg, "error in submission: %s --> %d\n", -+ fsg->ep0->name, rc); -+ } -+ return rc; -+} -+ -+static void ep0_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ -+ if (req->actual > 0) -+ dump_msg(fsg, fsg->ep0req_name, req->buf, req->actual); -+ if (req->status || req->actual != req->length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, req->length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ if (req->status == 0 && req->context) -+ ((fsg_routine_t) (req->context))(fsg); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Bulk and interrupt endpoint completion handlers. -+ * These always run in_irq. */ -+ -+static void bulk_in_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ struct fsg_buffhd *bh = req->context; -+ -+ if (req->status || req->actual != req->length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, req->length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ /* Hold the lock while we update the request and buffer states */ -+ smp_wmb(); -+ spin_lock(&fsg->lock); -+ bh->inreq_busy = 0; -+ bh->state = BUF_STATE_EMPTY; -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+static void bulk_out_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ struct fsg_buffhd *bh = req->context; -+ -+ dump_msg(fsg, "bulk-out", req->buf, req->actual); -+ if (req->status || req->actual != bh->bulk_out_intended_length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, -+ bh->bulk_out_intended_length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ /* Hold the lock while we update the request and buffer states */ -+ smp_wmb(); -+ spin_lock(&fsg->lock); -+ bh->outreq_busy = 0; -+ bh->state = BUF_STATE_FULL; -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ struct fsg_buffhd *bh = req->context; -+ -+ if (req->status || req->actual != req->length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, req->length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ /* Hold the lock while we update the request and buffer states */ -+ smp_wmb(); -+ spin_lock(&fsg->lock); -+ fsg->intreq_busy = 0; -+ bh->state = BUF_STATE_EMPTY; -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+#else -+static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) -+{} -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Ep0 class-specific handlers. These always run in_irq. */ -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct usb_request *req = fsg->ep0req; -+ static u8 cbi_reset_cmnd[6] = { -+ SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; -+ -+ /* Error in command transfer? */ -+ if (req->status || req->length != req->actual || -+ req->actual < 6 || req->actual > MAX_COMMAND_SIZE) { -+ -+ /* Not all controllers allow a protocol stall after -+ * receiving control-out data, but we'll try anyway. */ -+ fsg_set_halt(fsg, fsg->ep0); -+ return; // Wait for reset -+ } -+ -+ /* Is it the special reset command? */ -+ if (req->actual >= sizeof cbi_reset_cmnd && -+ memcmp(req->buf, cbi_reset_cmnd, -+ sizeof cbi_reset_cmnd) == 0) { -+ -+ /* Raise an exception to stop the current operation -+ * and reinitialize our state. */ -+ DBG(fsg, "cbi reset request\n"); -+ raise_exception(fsg, FSG_STATE_RESET); -+ return; -+ } -+ -+ VDBG(fsg, "CB[I] accept device-specific command\n"); -+ spin_lock(&fsg->lock); -+ -+ /* Save the command for later */ -+ if (fsg->cbbuf_cmnd_size) -+ WARNING(fsg, "CB[I] overwriting previous command\n"); -+ fsg->cbbuf_cmnd_size = req->actual; -+ memcpy(fsg->cbbuf_cmnd, req->buf, fsg->cbbuf_cmnd_size); -+ -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+#else -+static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{} -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+static int class_setup_req(struct fsg_dev *fsg, -+ const struct usb_ctrlrequest *ctrl) -+{ -+ struct usb_request *req = fsg->ep0req; -+ int value = -EOPNOTSUPP; -+ u16 w_index = le16_to_cpu(ctrl->wIndex); -+ u16 w_value = le16_to_cpu(ctrl->wValue); -+ u16 w_length = le16_to_cpu(ctrl->wLength); -+ -+ if (!fsg->config) -+ return value; -+ -+ /* Handle Bulk-only class-specific requests */ -+ if (transport_is_bbb()) { -+ switch (ctrl->bRequest) { -+ -+ case US_BULK_RESET_REQUEST: -+ if (ctrl->bRequestType != (USB_DIR_OUT | -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) -+ break; -+ if (w_index != 0 || w_value != 0 || w_length != 0) { -+ value = -EDOM; -+ break; -+ } -+ -+ /* Raise an exception to stop the current operation -+ * and reinitialize our state. */ -+ DBG(fsg, "bulk reset request\n"); -+ raise_exception(fsg, FSG_STATE_RESET); -+ value = DELAYED_STATUS; -+ break; -+ -+ case US_BULK_GET_MAX_LUN: -+ if (ctrl->bRequestType != (USB_DIR_IN | -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) -+ break; -+ if (w_index != 0 || w_value != 0 || w_length != 1) { -+ value = -EDOM; -+ break; -+ } -+ VDBG(fsg, "get max LUN\n"); -+ *(u8 *) req->buf = fsg->nluns - 1; -+ value = 1; -+ break; -+ } -+ } -+ -+ /* Handle CBI class-specific requests */ -+ else { -+ switch (ctrl->bRequest) { -+ -+ case USB_CBI_ADSC_REQUEST: -+ if (ctrl->bRequestType != (USB_DIR_OUT | -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) -+ break; -+ if (w_index != 0 || w_value != 0) { -+ value = -EDOM; -+ break; -+ } -+ if (w_length > MAX_COMMAND_SIZE) { -+ value = -EOVERFLOW; -+ break; -+ } -+ value = w_length; -+ fsg->ep0req->context = received_cbi_adsc; -+ break; -+ } -+ } -+ -+ if (value == -EOPNOTSUPP) -+ VDBG(fsg, -+ "unknown class-specific control req " -+ "%02x.%02x v%04x i%04x l%u\n", -+ ctrl->bRequestType, ctrl->bRequest, -+ le16_to_cpu(ctrl->wValue), w_index, w_length); -+ return value; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Ep0 standard request handlers. These always run in_irq. */ -+ -+static int standard_setup_req(struct fsg_dev *fsg, -+ const struct usb_ctrlrequest *ctrl) -+{ -+ struct usb_request *req = fsg->ep0req; -+ int value = -EOPNOTSUPP; -+ u16 w_index = le16_to_cpu(ctrl->wIndex); -+ u16 w_value = le16_to_cpu(ctrl->wValue); -+ -+ /* Usually this just stores reply data in the pre-allocated ep0 buffer, -+ * but config change events will also reconfigure hardware. */ -+ switch (ctrl->bRequest) { -+ -+ case USB_REQ_GET_DESCRIPTOR: -+ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | -+ USB_RECIP_DEVICE)) -+ break; -+ switch (w_value >> 8) { -+ -+ case USB_DT_DEVICE: -+ VDBG(fsg, "get device descriptor\n"); -+ device_desc.bMaxPacketSize0 = fsg->ep0->maxpacket; -+ value = sizeof device_desc; -+ memcpy(req->buf, &device_desc, value); -+ break; -+ case USB_DT_DEVICE_QUALIFIER: -+ VDBG(fsg, "get device qualifier\n"); -+ if (!gadget_is_dualspeed(fsg->gadget) || -+ fsg->gadget->speed == USB_SPEED_SUPER) -+ break; -+ /* -+ * Assume ep0 uses the same maxpacket value for both -+ * speeds -+ */ -+ dev_qualifier.bMaxPacketSize0 = fsg->ep0->maxpacket; -+ value = sizeof dev_qualifier; -+ memcpy(req->buf, &dev_qualifier, value); -+ break; -+ -+ case USB_DT_OTHER_SPEED_CONFIG: -+ VDBG(fsg, "get other-speed config descriptor\n"); -+ if (!gadget_is_dualspeed(fsg->gadget) || -+ fsg->gadget->speed == USB_SPEED_SUPER) -+ break; -+ goto get_config; -+ case USB_DT_CONFIG: -+ VDBG(fsg, "get configuration descriptor\n"); -+get_config: -+ value = populate_config_buf(fsg->gadget, -+ req->buf, -+ w_value >> 8, -+ w_value & 0xff); -+ break; -+ -+ case USB_DT_STRING: -+ VDBG(fsg, "get string descriptor\n"); -+ -+ /* wIndex == language code */ -+ value = usb_gadget_get_string(&fsg_stringtab, -+ w_value & 0xff, req->buf); -+ break; -+ -+ case USB_DT_BOS: -+ VDBG(fsg, "get bos descriptor\n"); -+ -+ if (gadget_is_superspeed(fsg->gadget)) -+ value = populate_bos(fsg, req->buf); -+ break; -+ } -+ -+ break; -+ -+ /* One config, two speeds */ -+ case USB_REQ_SET_CONFIGURATION: -+ if (ctrl->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD | -+ USB_RECIP_DEVICE)) -+ break; -+ VDBG(fsg, "set configuration\n"); -+ if (w_value == CONFIG_VALUE || w_value == 0) { -+ fsg->new_config = w_value; -+ -+ /* Raise an exception to wipe out previous transaction -+ * state (queued bufs, etc) and set the new config. */ -+ raise_exception(fsg, FSG_STATE_CONFIG_CHANGE); -+ value = DELAYED_STATUS; -+ } -+ break; -+ case USB_REQ_GET_CONFIGURATION: -+ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | -+ USB_RECIP_DEVICE)) -+ break; -+ VDBG(fsg, "get configuration\n"); -+ *(u8 *) req->buf = fsg->config; -+ value = 1; -+ break; -+ -+ case USB_REQ_SET_INTERFACE: -+ if (ctrl->bRequestType != (USB_DIR_OUT| USB_TYPE_STANDARD | -+ USB_RECIP_INTERFACE)) -+ break; -+ if (fsg->config && w_index == 0) { -+ -+ /* Raise an exception to wipe out previous transaction -+ * state (queued bufs, etc) and install the new -+ * interface altsetting. */ -+ raise_exception(fsg, FSG_STATE_INTERFACE_CHANGE); -+ value = DELAYED_STATUS; -+ } -+ break; -+ case USB_REQ_GET_INTERFACE: -+ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | -+ USB_RECIP_INTERFACE)) -+ break; -+ if (!fsg->config) -+ break; -+ if (w_index != 0) { -+ value = -EDOM; -+ break; -+ } -+ VDBG(fsg, "get interface\n"); -+ *(u8 *) req->buf = 0; -+ value = 1; -+ break; -+ -+ default: -+ VDBG(fsg, -+ "unknown control req %02x.%02x v%04x i%04x l%u\n", -+ ctrl->bRequestType, ctrl->bRequest, -+ w_value, w_index, le16_to_cpu(ctrl->wLength)); -+ } -+ -+ return value; -+} -+ -+ -+static int fsg_setup(struct usb_gadget *gadget, -+ const struct usb_ctrlrequest *ctrl) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ int rc; -+ int w_length = le16_to_cpu(ctrl->wLength); -+ -+ ++fsg->ep0_req_tag; // Record arrival of a new request -+ fsg->ep0req->context = NULL; -+ fsg->ep0req->length = 0; -+ dump_msg(fsg, "ep0-setup", (u8 *) ctrl, sizeof(*ctrl)); -+ -+ if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_CLASS) -+ rc = class_setup_req(fsg, ctrl); -+ else -+ rc = standard_setup_req(fsg, ctrl); -+ -+ /* Respond with data/status or defer until later? */ -+ if (rc >= 0 && rc != DELAYED_STATUS) { -+ rc = min(rc, w_length); -+ fsg->ep0req->length = rc; -+ fsg->ep0req->zero = rc < w_length; -+ fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ? -+ "ep0-in" : "ep0-out"); -+ rc = ep0_queue(fsg); -+ } -+ -+ /* Device either stalls (rc < 0) or reports success */ -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* All the following routines run in process context */ -+ -+ -+/* Use this for bulk or interrupt transfers, not ep0 */ -+static void start_transfer(struct fsg_dev *fsg, struct usb_ep *ep, -+ struct usb_request *req, int *pbusy, -+ enum fsg_buffer_state *state) -+{ -+ int rc; -+ -+ if (ep == fsg->bulk_in) -+ dump_msg(fsg, "bulk-in", req->buf, req->length); -+ else if (ep == fsg->intr_in) -+ dump_msg(fsg, "intr-in", req->buf, req->length); -+ -+ spin_lock_irq(&fsg->lock); -+ *pbusy = 1; -+ *state = BUF_STATE_BUSY; -+ spin_unlock_irq(&fsg->lock); -+ rc = usb_ep_queue(ep, req, GFP_KERNEL); -+ if (rc != 0) { -+ *pbusy = 0; -+ *state = BUF_STATE_EMPTY; -+ -+ /* We can't do much more than wait for a reset */ -+ -+ /* Note: currently the net2280 driver fails zero-length -+ * submissions if DMA is enabled. */ -+ if (rc != -ESHUTDOWN && !(rc == -EOPNOTSUPP && -+ req->length == 0)) -+ WARNING(fsg, "error in submission: %s --> %d\n", -+ ep->name, rc); -+ } -+} -+ -+ -+static int sleep_thread(struct fsg_dev *fsg) -+{ -+ int rc = 0; -+ -+ /* Wait until a signal arrives or we are woken up */ -+ for (;;) { -+ try_to_freeze(); -+ set_current_state(TASK_INTERRUPTIBLE); -+ if (signal_pending(current)) { -+ rc = -EINTR; -+ break; -+ } -+ if (fsg->thread_wakeup_needed) -+ break; -+ schedule(); -+ } -+ __set_current_state(TASK_RUNNING); -+ fsg->thread_wakeup_needed = 0; -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_read(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba; -+ struct fsg_buffhd *bh; -+ int rc; -+ u32 amount_left; -+ loff_t file_offset, file_offset_tmp; -+ unsigned int amount; -+ ssize_t nread; -+ -+ /* Get the starting Logical Block Address and check that it's -+ * not too big */ -+ if (fsg->cmnd[0] == READ_6) -+ lba = get_unaligned_be24(&fsg->cmnd[1]); -+ else { -+ lba = get_unaligned_be32(&fsg->cmnd[2]); -+ -+ /* We allow DPO (Disable Page Out = don't save data in the -+ * cache) and FUA (Force Unit Access = don't read from the -+ * cache), but we don't implement them. */ -+ if ((fsg->cmnd[1] & ~0x18) != 0) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ } -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ file_offset = ((loff_t) lba) << curlun->blkbits; -+ -+ /* Carry out the file reads */ -+ amount_left = fsg->data_size_from_cmnd; -+ if (unlikely(amount_left == 0)) -+ return -EIO; // No default reply -+ -+ for (;;) { -+ -+ /* Figure out how much we need to read: -+ * Try to read the remaining amount. -+ * But don't read more than the buffer size. -+ * And don't try to read past the end of the file. -+ */ -+ amount = min((unsigned int) amount_left, mod_data.buflen); -+ amount = min((loff_t) amount, -+ curlun->file_length - file_offset); -+ -+ /* Wait for the next buffer to become available */ -+ bh = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ /* If we were asked to read past the end of file, -+ * end with an empty buffer. */ -+ if (amount == 0) { -+ curlun->sense_data = -+ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ bh->inreq->length = 0; -+ bh->state = BUF_STATE_FULL; -+ break; -+ } -+ -+ /* Perform the read */ -+ file_offset_tmp = file_offset; -+ nread = vfs_read(curlun->filp, -+ (char __user *) bh->buf, -+ amount, &file_offset_tmp); -+ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, -+ (unsigned long long) file_offset, -+ (int) nread); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ if (nread < 0) { -+ LDBG(curlun, "error in file read: %d\n", -+ (int) nread); -+ nread = 0; -+ } else if (nread < amount) { -+ LDBG(curlun, "partial file read: %d/%u\n", -+ (int) nread, amount); -+ nread = round_down(nread, curlun->blksize); -+ } -+ file_offset += nread; -+ amount_left -= nread; -+ fsg->residue -= nread; -+ -+ /* Except at the end of the transfer, nread will be -+ * equal to the buffer size, which is divisible by the -+ * bulk-in maxpacket size. -+ */ -+ bh->inreq->length = nread; -+ bh->state = BUF_STATE_FULL; -+ -+ /* If an error occurred, report it and its position */ -+ if (nread < amount) { -+ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ if (amount_left == 0) -+ break; // No more left to read -+ -+ /* Send this buffer and go read some more */ -+ bh->inreq->zero = 0; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ } -+ -+ return -EIO; // No default reply -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_write(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba; -+ struct fsg_buffhd *bh; -+ int get_some_more; -+ u32 amount_left_to_req, amount_left_to_write; -+ loff_t usb_offset, file_offset, file_offset_tmp; -+ unsigned int amount; -+ ssize_t nwritten; -+ int rc; -+ -+ if (curlun->ro) { -+ curlun->sense_data = SS_WRITE_PROTECTED; -+ return -EINVAL; -+ } -+ spin_lock(&curlun->filp->f_lock); -+ curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait -+ spin_unlock(&curlun->filp->f_lock); -+ -+ /* Get the starting Logical Block Address and check that it's -+ * not too big */ -+ if (fsg->cmnd[0] == WRITE_6) -+ lba = get_unaligned_be24(&fsg->cmnd[1]); -+ else { -+ lba = get_unaligned_be32(&fsg->cmnd[2]); -+ -+ /* We allow DPO (Disable Page Out = don't save data in the -+ * cache) and FUA (Force Unit Access = write directly to the -+ * medium). We don't implement DPO; we implement FUA by -+ * performing synchronous output. */ -+ if ((fsg->cmnd[1] & ~0x18) != 0) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ /* FUA */ -+ if (!curlun->nofua && (fsg->cmnd[1] & 0x08)) { -+ spin_lock(&curlun->filp->f_lock); -+ curlun->filp->f_flags |= O_DSYNC; -+ spin_unlock(&curlun->filp->f_lock); -+ } -+ } -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ -+ /* Carry out the file writes */ -+ get_some_more = 1; -+ file_offset = usb_offset = ((loff_t) lba) << curlun->blkbits; -+ amount_left_to_req = amount_left_to_write = fsg->data_size_from_cmnd; -+ -+ while (amount_left_to_write > 0) { -+ -+ /* Queue a request for more data from the host */ -+ bh = fsg->next_buffhd_to_fill; -+ if (bh->state == BUF_STATE_EMPTY && get_some_more) { -+ -+ /* Figure out how much we want to get: -+ * Try to get the remaining amount, -+ * but not more than the buffer size. -+ */ -+ amount = min(amount_left_to_req, mod_data.buflen); -+ -+ /* Beyond the end of the backing file? */ -+ if (usb_offset >= curlun->file_length) { -+ get_some_more = 0; -+ curlun->sense_data = -+ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ curlun->sense_data_info = usb_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ continue; -+ } -+ -+ /* Get the next buffer */ -+ usb_offset += amount; -+ fsg->usb_amount_left -= amount; -+ amount_left_to_req -= amount; -+ if (amount_left_to_req == 0) -+ get_some_more = 0; -+ -+ /* Except at the end of the transfer, amount will be -+ * equal to the buffer size, which is divisible by -+ * the bulk-out maxpacket size. -+ */ -+ set_bulk_out_req_length(fsg, bh, amount); -+ start_transfer(fsg, fsg->bulk_out, bh->outreq, -+ &bh->outreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ continue; -+ } -+ -+ /* Write the received data to the backing file */ -+ bh = fsg->next_buffhd_to_drain; -+ if (bh->state == BUF_STATE_EMPTY && !get_some_more) -+ break; // We stopped early -+ if (bh->state == BUF_STATE_FULL) { -+ smp_rmb(); -+ fsg->next_buffhd_to_drain = bh->next; -+ bh->state = BUF_STATE_EMPTY; -+ -+ /* Did something go wrong with the transfer? */ -+ if (bh->outreq->status != 0) { -+ curlun->sense_data = SS_COMMUNICATION_FAILURE; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ amount = bh->outreq->actual; -+ if (curlun->file_length - file_offset < amount) { -+ LERROR(curlun, -+ "write %u @ %llu beyond end %llu\n", -+ amount, (unsigned long long) file_offset, -+ (unsigned long long) curlun->file_length); -+ amount = curlun->file_length - file_offset; -+ } -+ -+ /* Don't accept excess data. The spec doesn't say -+ * what to do in this case. We'll ignore the error. -+ */ -+ amount = min(amount, bh->bulk_out_intended_length); -+ -+ /* Don't write a partial block */ -+ amount = round_down(amount, curlun->blksize); -+ if (amount == 0) -+ goto empty_write; -+ -+ /* Perform the write */ -+ file_offset_tmp = file_offset; -+ nwritten = vfs_write(curlun->filp, -+ (char __user *) bh->buf, -+ amount, &file_offset_tmp); -+ VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, -+ (unsigned long long) file_offset, -+ (int) nwritten); -+ if (signal_pending(current)) -+ return -EINTR; // Interrupted! -+ -+ if (nwritten < 0) { -+ LDBG(curlun, "error in file write: %d\n", -+ (int) nwritten); -+ nwritten = 0; -+ } else if (nwritten < amount) { -+ LDBG(curlun, "partial file write: %d/%u\n", -+ (int) nwritten, amount); -+ nwritten = round_down(nwritten, curlun->blksize); -+ } -+ file_offset += nwritten; -+ amount_left_to_write -= nwritten; -+ fsg->residue -= nwritten; -+ -+ /* If an error occurred, report it and its position */ -+ if (nwritten < amount) { -+ curlun->sense_data = SS_WRITE_ERROR; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ empty_write: -+ /* Did the host decide to stop early? */ -+ if (bh->outreq->actual < bh->bulk_out_intended_length) { -+ fsg->short_packet_received = 1; -+ break; -+ } -+ continue; -+ } -+ -+ /* Wait for something to happen */ -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ return -EIO; // No default reply -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_synchronize_cache(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int rc; -+ -+ /* We ignore the requested LBA and write out all file's -+ * dirty data buffers. */ -+ rc = fsg_lun_fsync_sub(curlun); -+ if (rc) -+ curlun->sense_data = SS_WRITE_ERROR; -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void invalidate_sub(struct fsg_lun *curlun) -+{ -+ struct file *filp = curlun->filp; -+ struct inode *inode = filp->f_path.dentry->d_inode; -+ unsigned long rc; -+ -+ rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); -+ VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc); -+} -+ -+static int do_verify(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba; -+ u32 verification_length; -+ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; -+ loff_t file_offset, file_offset_tmp; -+ u32 amount_left; -+ unsigned int amount; -+ ssize_t nread; -+ -+ /* Get the starting Logical Block Address and check that it's -+ * not too big */ -+ lba = get_unaligned_be32(&fsg->cmnd[2]); -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ -+ /* We allow DPO (Disable Page Out = don't save data in the -+ * cache) but we don't implement it. */ -+ if ((fsg->cmnd[1] & ~0x10) != 0) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ verification_length = get_unaligned_be16(&fsg->cmnd[7]); -+ if (unlikely(verification_length == 0)) -+ return -EIO; // No default reply -+ -+ /* Prepare to carry out the file verify */ -+ amount_left = verification_length << curlun->blkbits; -+ file_offset = ((loff_t) lba) << curlun->blkbits; -+ -+ /* Write out all the dirty buffers before invalidating them */ -+ fsg_lun_fsync_sub(curlun); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ invalidate_sub(curlun); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ /* Just try to read the requested blocks */ -+ while (amount_left > 0) { -+ -+ /* Figure out how much we need to read: -+ * Try to read the remaining amount, but not more than -+ * the buffer size. -+ * And don't try to read past the end of the file. -+ */ -+ amount = min((unsigned int) amount_left, mod_data.buflen); -+ amount = min((loff_t) amount, -+ curlun->file_length - file_offset); -+ if (amount == 0) { -+ curlun->sense_data = -+ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ /* Perform the read */ -+ file_offset_tmp = file_offset; -+ nread = vfs_read(curlun->filp, -+ (char __user *) bh->buf, -+ amount, &file_offset_tmp); -+ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, -+ (unsigned long long) file_offset, -+ (int) nread); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ if (nread < 0) { -+ LDBG(curlun, "error in file verify: %d\n", -+ (int) nread); -+ nread = 0; -+ } else if (nread < amount) { -+ LDBG(curlun, "partial file verify: %d/%u\n", -+ (int) nread, amount); -+ nread = round_down(nread, curlun->blksize); -+ } -+ if (nread == 0) { -+ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ file_offset += nread; -+ amount_left -= nread; -+ } -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ u8 *buf = (u8 *) bh->buf; -+ -+ static char vendor_id[] = "Linux "; -+ static char product_disk_id[] = "File-Stor Gadget"; -+ static char product_cdrom_id[] = "File-CD Gadget "; -+ -+ if (!fsg->curlun) { // Unsupported LUNs are okay -+ fsg->bad_lun_okay = 1; -+ memset(buf, 0, 36); -+ buf[0] = 0x7f; // Unsupported, no device-type -+ buf[4] = 31; // Additional length -+ return 36; -+ } -+ -+ memset(buf, 0, 8); -+ buf[0] = (mod_data.cdrom ? TYPE_ROM : TYPE_DISK); -+ if (mod_data.removable) -+ buf[1] = 0x80; -+ buf[2] = 2; // ANSI SCSI level 2 -+ buf[3] = 2; // SCSI-2 INQUIRY data format -+ buf[4] = 31; // Additional length -+ // No special options -+ sprintf(buf + 8, "%-8s%-16s%04x", vendor_id, -+ (mod_data.cdrom ? product_cdrom_id : -+ product_disk_id), -+ mod_data.release); -+ return 36; -+} -+ -+ -+static int do_request_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u8 *buf = (u8 *) bh->buf; -+ u32 sd, sdinfo; -+ int valid; -+ -+ /* -+ * From the SCSI-2 spec., section 7.9 (Unit attention condition): -+ * -+ * If a REQUEST SENSE command is received from an initiator -+ * with a pending unit attention condition (before the target -+ * generates the contingent allegiance condition), then the -+ * target shall either: -+ * a) report any pending sense data and preserve the unit -+ * attention condition on the logical unit, or, -+ * b) report the unit attention condition, may discard any -+ * pending sense data, and clear the unit attention -+ * condition on the logical unit for that initiator. -+ * -+ * FSG normally uses option a); enable this code to use option b). -+ */ -+#if 0 -+ if (curlun && curlun->unit_attention_data != SS_NO_SENSE) { -+ curlun->sense_data = curlun->unit_attention_data; -+ curlun->unit_attention_data = SS_NO_SENSE; -+ } -+#endif -+ -+ if (!curlun) { // Unsupported LUNs are okay -+ fsg->bad_lun_okay = 1; -+ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; -+ sdinfo = 0; -+ valid = 0; -+ } else { -+ sd = curlun->sense_data; -+ sdinfo = curlun->sense_data_info; -+ valid = curlun->info_valid << 7; -+ curlun->sense_data = SS_NO_SENSE; -+ curlun->sense_data_info = 0; -+ curlun->info_valid = 0; -+ } -+ -+ memset(buf, 0, 18); -+ buf[0] = valid | 0x70; // Valid, current error -+ buf[2] = SK(sd); -+ put_unaligned_be32(sdinfo, &buf[3]); /* Sense information */ -+ buf[7] = 18 - 8; // Additional sense length -+ buf[12] = ASC(sd); -+ buf[13] = ASCQ(sd); -+ return 18; -+} -+ -+ -+static int do_read_capacity(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); -+ int pmi = fsg->cmnd[8]; -+ u8 *buf = (u8 *) bh->buf; -+ -+ /* Check the PMI and LBA fields */ -+ if (pmi > 1 || (pmi == 0 && lba != 0)) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); -+ /* Max logical block */ -+ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ -+ return 8; -+} -+ -+ -+static int do_read_header(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int msf = fsg->cmnd[1] & 0x02; -+ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); -+ u8 *buf = (u8 *) bh->buf; -+ -+ if ((fsg->cmnd[1] & ~0x02) != 0) { /* Mask away MSF */ -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ -+ memset(buf, 0, 8); -+ buf[0] = 0x01; /* 2048 bytes of user data, rest is EC */ -+ store_cdrom_address(&buf[4], msf, lba); -+ return 8; -+} -+ -+ -+static int do_read_toc(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int msf = fsg->cmnd[1] & 0x02; -+ int start_track = fsg->cmnd[6]; -+ u8 *buf = (u8 *) bh->buf; -+ -+ if ((fsg->cmnd[1] & ~0x02) != 0 || /* Mask away MSF */ -+ start_track > 1) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ memset(buf, 0, 20); -+ buf[1] = (20-2); /* TOC data length */ -+ buf[2] = 1; /* First track number */ -+ buf[3] = 1; /* Last track number */ -+ buf[5] = 0x16; /* Data track, copying allowed */ -+ buf[6] = 0x01; /* Only track is number 1 */ -+ store_cdrom_address(&buf[8], msf, 0); -+ -+ buf[13] = 0x16; /* Lead-out track is data */ -+ buf[14] = 0xAA; /* Lead-out track number */ -+ store_cdrom_address(&buf[16], msf, curlun->num_sectors); -+ return 20; -+} -+ -+ -+static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int mscmnd = fsg->cmnd[0]; -+ u8 *buf = (u8 *) bh->buf; -+ u8 *buf0 = buf; -+ int pc, page_code; -+ int changeable_values, all_pages; -+ int valid_page = 0; -+ int len, limit; -+ -+ if ((fsg->cmnd[1] & ~0x08) != 0) { // Mask away DBD -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ pc = fsg->cmnd[2] >> 6; -+ page_code = fsg->cmnd[2] & 0x3f; -+ if (pc == 3) { -+ curlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; -+ return -EINVAL; -+ } -+ changeable_values = (pc == 1); -+ all_pages = (page_code == 0x3f); -+ -+ /* Write the mode parameter header. Fixed values are: default -+ * medium type, no cache control (DPOFUA), and no block descriptors. -+ * The only variable value is the WriteProtect bit. We will fill in -+ * the mode data length later. */ -+ memset(buf, 0, 8); -+ if (mscmnd == MODE_SENSE) { -+ buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA -+ buf += 4; -+ limit = 255; -+ } else { // MODE_SENSE_10 -+ buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA -+ buf += 8; -+ limit = 65535; // Should really be mod_data.buflen -+ } -+ -+ /* No block descriptors */ -+ -+ /* The mode pages, in numerical order. The only page we support -+ * is the Caching page. */ -+ if (page_code == 0x08 || all_pages) { -+ valid_page = 1; -+ buf[0] = 0x08; // Page code -+ buf[1] = 10; // Page length -+ memset(buf+2, 0, 10); // None of the fields are changeable -+ -+ if (!changeable_values) { -+ buf[2] = 0x04; // Write cache enable, -+ // Read cache not disabled -+ // No cache retention priorities -+ put_unaligned_be16(0xffff, &buf[4]); -+ /* Don't disable prefetch */ -+ /* Minimum prefetch = 0 */ -+ put_unaligned_be16(0xffff, &buf[8]); -+ /* Maximum prefetch */ -+ put_unaligned_be16(0xffff, &buf[10]); -+ /* Maximum prefetch ceiling */ -+ } -+ buf += 12; -+ } -+ -+ /* Check that a valid page was requested and the mode data length -+ * isn't too long. */ -+ len = buf - buf0; -+ if (!valid_page || len > limit) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ /* Store the mode data length */ -+ if (mscmnd == MODE_SENSE) -+ buf0[0] = len - 1; -+ else -+ put_unaligned_be16(len - 2, buf0); -+ return len; -+} -+ -+ -+static int do_start_stop(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int loej, start; -+ -+ if (!mod_data.removable) { -+ curlun->sense_data = SS_INVALID_COMMAND; -+ return -EINVAL; -+ } -+ -+ // int immed = fsg->cmnd[1] & 0x01; -+ loej = fsg->cmnd[4] & 0x02; -+ start = fsg->cmnd[4] & 0x01; -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ if ((fsg->cmnd[1] & ~0x01) != 0 || // Mask away Immed -+ (fsg->cmnd[4] & ~0x03) != 0) { // Mask LoEj, Start -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ if (!start) { -+ -+ /* Are we allowed to unload the media? */ -+ if (curlun->prevent_medium_removal) { -+ LDBG(curlun, "unload attempt prevented\n"); -+ curlun->sense_data = SS_MEDIUM_REMOVAL_PREVENTED; -+ return -EINVAL; -+ } -+ if (loej) { // Simulate an unload/eject -+ up_read(&fsg->filesem); -+ down_write(&fsg->filesem); -+ fsg_lun_close(curlun); -+ up_write(&fsg->filesem); -+ down_read(&fsg->filesem); -+ } -+ } else { -+ -+ /* Our emulation doesn't support mounting; the medium is -+ * available for use as soon as it is loaded. */ -+ if (!fsg_lun_is_open(curlun)) { -+ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; -+ return -EINVAL; -+ } -+ } -+#endif -+ return 0; -+} -+ -+ -+static int do_prevent_allow(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int prevent; -+ -+ if (!mod_data.removable) { -+ curlun->sense_data = SS_INVALID_COMMAND; -+ return -EINVAL; -+ } -+ -+ prevent = fsg->cmnd[4] & 0x01; -+ if ((fsg->cmnd[4] & ~0x01) != 0) { // Mask away Prevent -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ if (curlun->prevent_medium_removal && !prevent) -+ fsg_lun_fsync_sub(curlun); -+ curlun->prevent_medium_removal = prevent; -+ return 0; -+} -+ -+ -+static int do_read_format_capacities(struct fsg_dev *fsg, -+ struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u8 *buf = (u8 *) bh->buf; -+ -+ buf[0] = buf[1] = buf[2] = 0; -+ buf[3] = 8; // Only the Current/Maximum Capacity Descriptor -+ buf += 4; -+ -+ put_unaligned_be32(curlun->num_sectors, &buf[0]); -+ /* Number of blocks */ -+ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ -+ buf[4] = 0x02; /* Current capacity */ -+ return 12; -+} -+ -+ -+static int do_mode_select(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ -+ /* We don't support MODE SELECT */ -+ curlun->sense_data = SS_INVALID_COMMAND; -+ return -EINVAL; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int halt_bulk_in_endpoint(struct fsg_dev *fsg) -+{ -+ int rc; -+ -+ rc = fsg_set_halt(fsg, fsg->bulk_in); -+ if (rc == -EAGAIN) -+ VDBG(fsg, "delayed bulk-in endpoint halt\n"); -+ while (rc != 0) { -+ if (rc != -EAGAIN) { -+ WARNING(fsg, "usb_ep_set_halt -> %d\n", rc); -+ rc = 0; -+ break; -+ } -+ -+ /* Wait for a short time and then try again */ -+ if (msleep_interruptible(100) != 0) -+ return -EINTR; -+ rc = usb_ep_set_halt(fsg->bulk_in); -+ } -+ return rc; -+} -+ -+static int wedge_bulk_in_endpoint(struct fsg_dev *fsg) -+{ -+ int rc; -+ -+ DBG(fsg, "bulk-in set wedge\n"); -+ rc = usb_ep_set_wedge(fsg->bulk_in); -+ if (rc == -EAGAIN) -+ VDBG(fsg, "delayed bulk-in endpoint wedge\n"); -+ while (rc != 0) { -+ if (rc != -EAGAIN) { -+ WARNING(fsg, "usb_ep_set_wedge -> %d\n", rc); -+ rc = 0; -+ break; -+ } -+ -+ /* Wait for a short time and then try again */ -+ if (msleep_interruptible(100) != 0) -+ return -EINTR; -+ rc = usb_ep_set_wedge(fsg->bulk_in); -+ } -+ return rc; -+} -+ -+static int throw_away_data(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh; -+ u32 amount; -+ int rc; -+ -+ while ((bh = fsg->next_buffhd_to_drain)->state != BUF_STATE_EMPTY || -+ fsg->usb_amount_left > 0) { -+ -+ /* Throw away the data in a filled buffer */ -+ if (bh->state == BUF_STATE_FULL) { -+ smp_rmb(); -+ bh->state = BUF_STATE_EMPTY; -+ fsg->next_buffhd_to_drain = bh->next; -+ -+ /* A short packet or an error ends everything */ -+ if (bh->outreq->actual < bh->bulk_out_intended_length || -+ bh->outreq->status != 0) { -+ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); -+ return -EINTR; -+ } -+ continue; -+ } -+ -+ /* Try to submit another request if we need one */ -+ bh = fsg->next_buffhd_to_fill; -+ if (bh->state == BUF_STATE_EMPTY && fsg->usb_amount_left > 0) { -+ amount = min(fsg->usb_amount_left, -+ (u32) mod_data.buflen); -+ -+ /* Except at the end of the transfer, amount will be -+ * equal to the buffer size, which is divisible by -+ * the bulk-out maxpacket size. -+ */ -+ set_bulk_out_req_length(fsg, bh, amount); -+ start_transfer(fsg, fsg->bulk_out, bh->outreq, -+ &bh->outreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ fsg->usb_amount_left -= amount; -+ continue; -+ } -+ -+ /* Otherwise wait for something to happen */ -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ return 0; -+} -+ -+ -+static int finish_reply(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; -+ int rc = 0; -+ -+ switch (fsg->data_dir) { -+ case DATA_DIR_NONE: -+ break; // Nothing to send -+ -+ /* If we don't know whether the host wants to read or write, -+ * this must be CB or CBI with an unknown command. We mustn't -+ * try to send or receive any data. So stall both bulk pipes -+ * if we can and wait for a reset. */ -+ case DATA_DIR_UNKNOWN: -+ if (mod_data.can_stall) { -+ fsg_set_halt(fsg, fsg->bulk_out); -+ rc = halt_bulk_in_endpoint(fsg); -+ } -+ break; -+ -+ /* All but the last buffer of data must have already been sent */ -+ case DATA_DIR_TO_HOST: -+ if (fsg->data_size == 0) -+ ; // Nothing to send -+ -+ /* If there's no residue, simply send the last buffer */ -+ else if (fsg->residue == 0) { -+ bh->inreq->zero = 0; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ } -+ -+ /* There is a residue. For CB and CBI, simply mark the end -+ * of the data with a short packet. However, if we are -+ * allowed to stall, there was no data at all (residue == -+ * data_size), and the command failed (invalid LUN or -+ * sense data is set), then halt the bulk-in endpoint -+ * instead. */ -+ else if (!transport_is_bbb()) { -+ if (mod_data.can_stall && -+ fsg->residue == fsg->data_size && -+ (!fsg->curlun || fsg->curlun->sense_data != SS_NO_SENSE)) { -+ bh->state = BUF_STATE_EMPTY; -+ rc = halt_bulk_in_endpoint(fsg); -+ } else { -+ bh->inreq->zero = 1; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ } -+ } -+ -+ /* -+ * For Bulk-only, mark the end of the data with a short -+ * packet. If we are allowed to stall, halt the bulk-in -+ * endpoint. (Note: This violates the Bulk-Only Transport -+ * specification, which requires us to pad the data if we -+ * don't halt the endpoint. Presumably nobody will mind.) -+ */ -+ else { -+ bh->inreq->zero = 1; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ if (mod_data.can_stall) -+ rc = halt_bulk_in_endpoint(fsg); -+ } -+ break; -+ -+ /* We have processed all we want from the data the host has sent. -+ * There may still be outstanding bulk-out requests. */ -+ case DATA_DIR_FROM_HOST: -+ if (fsg->residue == 0) -+ ; // Nothing to receive -+ -+ /* Did the host stop sending unexpectedly early? */ -+ else if (fsg->short_packet_received) { -+ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); -+ rc = -EINTR; -+ } -+ -+ /* We haven't processed all the incoming data. Even though -+ * we may be allowed to stall, doing so would cause a race. -+ * The controller may already have ACK'ed all the remaining -+ * bulk-out packets, in which case the host wouldn't see a -+ * STALL. Not realizing the endpoint was halted, it wouldn't -+ * clear the halt -- leading to problems later on. */ -+#if 0 -+ else if (mod_data.can_stall) { -+ fsg_set_halt(fsg, fsg->bulk_out); -+ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); -+ rc = -EINTR; -+ } -+#endif -+ -+ /* We can't stall. Read in the excess data and throw it -+ * all away. */ -+ else -+ rc = throw_away_data(fsg); -+ break; -+ } -+ return rc; -+} -+ -+ -+static int send_status(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ struct fsg_buffhd *bh; -+ int rc; -+ u8 status = US_BULK_STAT_OK; -+ u32 sd, sdinfo = 0; -+ -+ /* Wait for the next buffer to become available */ -+ bh = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ if (curlun) { -+ sd = curlun->sense_data; -+ sdinfo = curlun->sense_data_info; -+ } else if (fsg->bad_lun_okay) -+ sd = SS_NO_SENSE; -+ else -+ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; -+ -+ if (fsg->phase_error) { -+ DBG(fsg, "sending phase-error status\n"); -+ status = US_BULK_STAT_PHASE; -+ sd = SS_INVALID_COMMAND; -+ } else if (sd != SS_NO_SENSE) { -+ DBG(fsg, "sending command-failure status\n"); -+ status = US_BULK_STAT_FAIL; -+ VDBG(fsg, " sense data: SK x%02x, ASC x%02x, ASCQ x%02x;" -+ " info x%x\n", -+ SK(sd), ASC(sd), ASCQ(sd), sdinfo); -+ } -+ -+ if (transport_is_bbb()) { -+ struct bulk_cs_wrap *csw = bh->buf; -+ -+ /* Store and send the Bulk-only CSW */ -+ csw->Signature = cpu_to_le32(US_BULK_CS_SIGN); -+ csw->Tag = fsg->tag; -+ csw->Residue = cpu_to_le32(fsg->residue); -+ csw->Status = status; -+ -+ bh->inreq->length = US_BULK_CS_WRAP_LEN; -+ bh->inreq->zero = 0; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ -+ } else if (mod_data.transport_type == USB_PR_CB) { -+ -+ /* Control-Bulk transport has no status phase! */ -+ return 0; -+ -+ } else { // USB_PR_CBI -+ struct interrupt_data *buf = bh->buf; -+ -+ /* Store and send the Interrupt data. UFI sends the ASC -+ * and ASCQ bytes. Everything else sends a Type (which -+ * is always 0) and the status Value. */ -+ if (mod_data.protocol_type == USB_SC_UFI) { -+ buf->bType = ASC(sd); -+ buf->bValue = ASCQ(sd); -+ } else { -+ buf->bType = 0; -+ buf->bValue = status; -+ } -+ fsg->intreq->length = CBI_INTERRUPT_DATA_LEN; -+ -+ fsg->intr_buffhd = bh; // Point to the right buffhd -+ fsg->intreq->buf = bh->inreq->buf; -+ fsg->intreq->context = bh; -+ start_transfer(fsg, fsg->intr_in, fsg->intreq, -+ &fsg->intreq_busy, &bh->state); -+ } -+ -+ fsg->next_buffhd_to_fill = bh->next; -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Check whether the command is properly formed and whether its data size -+ * and direction agree with the values we already have. */ -+static int check_command(struct fsg_dev *fsg, int cmnd_size, -+ enum data_direction data_dir, unsigned int mask, -+ int needs_medium, const char *name) -+{ -+ int i; -+ int lun = fsg->cmnd[1] >> 5; -+ static const char dirletter[4] = {'u', 'o', 'i', 'n'}; -+ char hdlen[20]; -+ struct fsg_lun *curlun; -+ -+ /* Adjust the expected cmnd_size for protocol encapsulation padding. -+ * Transparent SCSI doesn't pad. */ -+ if (protocol_is_scsi()) -+ ; -+ -+ /* There's some disagreement as to whether RBC pads commands or not. -+ * We'll play it safe and accept either form. */ -+ else if (mod_data.protocol_type == USB_SC_RBC) { -+ if (fsg->cmnd_size == 12) -+ cmnd_size = 12; -+ -+ /* All the other protocols pad to 12 bytes */ -+ } else -+ cmnd_size = 12; -+ -+ hdlen[0] = 0; -+ if (fsg->data_dir != DATA_DIR_UNKNOWN) -+ sprintf(hdlen, ", H%c=%u", dirletter[(int) fsg->data_dir], -+ fsg->data_size); -+ VDBG(fsg, "SCSI command: %s; Dc=%d, D%c=%u; Hc=%d%s\n", -+ name, cmnd_size, dirletter[(int) data_dir], -+ fsg->data_size_from_cmnd, fsg->cmnd_size, hdlen); -+ -+ /* We can't reply at all until we know the correct data direction -+ * and size. */ -+ if (fsg->data_size_from_cmnd == 0) -+ data_dir = DATA_DIR_NONE; -+ if (fsg->data_dir == DATA_DIR_UNKNOWN) { // CB or CBI -+ fsg->data_dir = data_dir; -+ fsg->data_size = fsg->data_size_from_cmnd; -+ -+ } else { // Bulk-only -+ if (fsg->data_size < fsg->data_size_from_cmnd) { -+ -+ /* Host data size < Device data size is a phase error. -+ * Carry out the command, but only transfer as much -+ * as we are allowed. */ -+ fsg->data_size_from_cmnd = fsg->data_size; -+ fsg->phase_error = 1; -+ } -+ } -+ fsg->residue = fsg->usb_amount_left = fsg->data_size; -+ -+ /* Conflicting data directions is a phase error */ -+ if (fsg->data_dir != data_dir && fsg->data_size_from_cmnd > 0) { -+ fsg->phase_error = 1; -+ return -EINVAL; -+ } -+ -+ /* Verify the length of the command itself */ -+ if (cmnd_size != fsg->cmnd_size) { -+ -+ /* Special case workaround: There are plenty of buggy SCSI -+ * implementations. Many have issues with cbw->Length -+ * field passing a wrong command size. For those cases we -+ * always try to work around the problem by using the length -+ * sent by the host side provided it is at least as large -+ * as the correct command length. -+ * Examples of such cases would be MS-Windows, which issues -+ * REQUEST SENSE with cbw->Length == 12 where it should -+ * be 6, and xbox360 issuing INQUIRY, TEST UNIT READY and -+ * REQUEST SENSE with cbw->Length == 10 where it should -+ * be 6 as well. -+ */ -+ if (cmnd_size <= fsg->cmnd_size) { -+ DBG(fsg, "%s is buggy! Expected length %d " -+ "but we got %d\n", name, -+ cmnd_size, fsg->cmnd_size); -+ cmnd_size = fsg->cmnd_size; -+ } else { -+ fsg->phase_error = 1; -+ return -EINVAL; -+ } -+ } -+ -+ /* Check that the LUN values are consistent */ -+ if (transport_is_bbb()) { -+ if (fsg->lun != lun) -+ DBG(fsg, "using LUN %d from CBW, " -+ "not LUN %d from CDB\n", -+ fsg->lun, lun); -+ } -+ -+ /* Check the LUN */ -+ curlun = fsg->curlun; -+ if (curlun) { -+ if (fsg->cmnd[0] != REQUEST_SENSE) { -+ curlun->sense_data = SS_NO_SENSE; -+ curlun->sense_data_info = 0; -+ curlun->info_valid = 0; -+ } -+ } else { -+ fsg->bad_lun_okay = 0; -+ -+ /* INQUIRY and REQUEST SENSE commands are explicitly allowed -+ * to use unsupported LUNs; all others may not. */ -+ if (fsg->cmnd[0] != INQUIRY && -+ fsg->cmnd[0] != REQUEST_SENSE) { -+ DBG(fsg, "unsupported LUN %d\n", fsg->lun); -+ return -EINVAL; -+ } -+ } -+ -+ /* If a unit attention condition exists, only INQUIRY and -+ * REQUEST SENSE commands are allowed; anything else must fail. */ -+ if (curlun && curlun->unit_attention_data != SS_NO_SENSE && -+ fsg->cmnd[0] != INQUIRY && -+ fsg->cmnd[0] != REQUEST_SENSE) { -+ curlun->sense_data = curlun->unit_attention_data; -+ curlun->unit_attention_data = SS_NO_SENSE; -+ return -EINVAL; -+ } -+ -+ /* Check that only command bytes listed in the mask are non-zero */ -+ fsg->cmnd[1] &= 0x1f; // Mask away the LUN -+ for (i = 1; i < cmnd_size; ++i) { -+ if (fsg->cmnd[i] && !(mask & (1 << i))) { -+ if (curlun) -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ } -+ -+ /* If the medium isn't mounted and the command needs to access -+ * it, return an error. */ -+ if (curlun && !fsg_lun_is_open(curlun) && needs_medium) { -+ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/* wrapper of check_command for data size in blocks handling */ -+static int check_command_size_in_blocks(struct fsg_dev *fsg, int cmnd_size, -+ enum data_direction data_dir, unsigned int mask, -+ int needs_medium, const char *name) -+{ -+ if (fsg->curlun) -+ fsg->data_size_from_cmnd <<= fsg->curlun->blkbits; -+ return check_command(fsg, cmnd_size, data_dir, -+ mask, needs_medium, name); -+} -+ -+static int do_scsi_command(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh; -+ int rc; -+ int reply = -EINVAL; -+ int i; -+ static char unknown[16]; -+ -+ dump_cdb(fsg); -+ -+ /* Wait for the next buffer to become available for data or status */ -+ bh = fsg->next_buffhd_to_drain = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ fsg->phase_error = 0; -+ fsg->short_packet_received = 0; -+ -+ down_read(&fsg->filesem); // We're using the backing file -+ switch (fsg->cmnd[0]) { -+ -+ case INQUIRY: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, -+ (1<<4), 0, -+ "INQUIRY")) == 0) -+ reply = do_inquiry(fsg, bh); -+ break; -+ -+ case MODE_SELECT: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, -+ (1<<1) | (1<<4), 0, -+ "MODE SELECT(6)")) == 0) -+ reply = do_mode_select(fsg, bh); -+ break; -+ -+ case MODE_SELECT_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, -+ (1<<1) | (3<<7), 0, -+ "MODE SELECT(10)")) == 0) -+ reply = do_mode_select(fsg, bh); -+ break; -+ -+ case MODE_SENSE: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, -+ (1<<1) | (1<<2) | (1<<4), 0, -+ "MODE SENSE(6)")) == 0) -+ reply = do_mode_sense(fsg, bh); -+ break; -+ -+ case MODE_SENSE_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (1<<1) | (1<<2) | (3<<7), 0, -+ "MODE SENSE(10)")) == 0) -+ reply = do_mode_sense(fsg, bh); -+ break; -+ -+ case ALLOW_MEDIUM_REMOVAL: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, -+ (1<<4), 0, -+ "PREVENT-ALLOW MEDIUM REMOVAL")) == 0) -+ reply = do_prevent_allow(fsg); -+ break; -+ -+ case READ_6: -+ i = fsg->cmnd[4]; -+ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; -+ if ((reply = check_command_size_in_blocks(fsg, 6, -+ DATA_DIR_TO_HOST, -+ (7<<1) | (1<<4), 1, -+ "READ(6)")) == 0) -+ reply = do_read(fsg); -+ break; -+ -+ case READ_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command_size_in_blocks(fsg, 10, -+ DATA_DIR_TO_HOST, -+ (1<<1) | (0xf<<2) | (3<<7), 1, -+ "READ(10)")) == 0) -+ reply = do_read(fsg); -+ break; -+ -+ case READ_12: -+ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); -+ if ((reply = check_command_size_in_blocks(fsg, 12, -+ DATA_DIR_TO_HOST, -+ (1<<1) | (0xf<<2) | (0xf<<6), 1, -+ "READ(12)")) == 0) -+ reply = do_read(fsg); -+ break; -+ -+ case READ_CAPACITY: -+ fsg->data_size_from_cmnd = 8; -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (0xf<<2) | (1<<8), 1, -+ "READ CAPACITY")) == 0) -+ reply = do_read_capacity(fsg, bh); -+ break; -+ -+ case READ_HEADER: -+ if (!mod_data.cdrom) -+ goto unknown_cmnd; -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (3<<7) | (0x1f<<1), 1, -+ "READ HEADER")) == 0) -+ reply = do_read_header(fsg, bh); -+ break; -+ -+ case READ_TOC: -+ if (!mod_data.cdrom) -+ goto unknown_cmnd; -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (7<<6) | (1<<1), 1, -+ "READ TOC")) == 0) -+ reply = do_read_toc(fsg, bh); -+ break; -+ -+ case READ_FORMAT_CAPACITIES: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (3<<7), 1, -+ "READ FORMAT CAPACITIES")) == 0) -+ reply = do_read_format_capacities(fsg, bh); -+ break; -+ -+ case REQUEST_SENSE: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, -+ (1<<4), 0, -+ "REQUEST SENSE")) == 0) -+ reply = do_request_sense(fsg, bh); -+ break; -+ -+ case START_STOP: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, -+ (1<<1) | (1<<4), 0, -+ "START-STOP UNIT")) == 0) -+ reply = do_start_stop(fsg); -+ break; -+ -+ case SYNCHRONIZE_CACHE: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, -+ (0xf<<2) | (3<<7), 1, -+ "SYNCHRONIZE CACHE")) == 0) -+ reply = do_synchronize_cache(fsg); -+ break; -+ -+ case TEST_UNIT_READY: -+ fsg->data_size_from_cmnd = 0; -+ reply = check_command(fsg, 6, DATA_DIR_NONE, -+ 0, 1, -+ "TEST UNIT READY"); -+ break; -+ -+ /* Although optional, this command is used by MS-Windows. We -+ * support a minimal version: BytChk must be 0. */ -+ case VERIFY: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, -+ (1<<1) | (0xf<<2) | (3<<7), 1, -+ "VERIFY")) == 0) -+ reply = do_verify(fsg); -+ break; -+ -+ case WRITE_6: -+ i = fsg->cmnd[4]; -+ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; -+ if ((reply = check_command_size_in_blocks(fsg, 6, -+ DATA_DIR_FROM_HOST, -+ (7<<1) | (1<<4), 1, -+ "WRITE(6)")) == 0) -+ reply = do_write(fsg); -+ break; -+ -+ case WRITE_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command_size_in_blocks(fsg, 10, -+ DATA_DIR_FROM_HOST, -+ (1<<1) | (0xf<<2) | (3<<7), 1, -+ "WRITE(10)")) == 0) -+ reply = do_write(fsg); -+ break; -+ -+ case WRITE_12: -+ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); -+ if ((reply = check_command_size_in_blocks(fsg, 12, -+ DATA_DIR_FROM_HOST, -+ (1<<1) | (0xf<<2) | (0xf<<6), 1, -+ "WRITE(12)")) == 0) -+ reply = do_write(fsg); -+ break; -+ -+ /* Some mandatory commands that we recognize but don't implement. -+ * They don't mean much in this setting. It's left as an exercise -+ * for anyone interested to implement RESERVE and RELEASE in terms -+ * of Posix locks. */ -+ case FORMAT_UNIT: -+ case RELEASE: -+ case RESERVE: -+ case SEND_DIAGNOSTIC: -+ // Fall through -+ -+ default: -+ unknown_cmnd: -+ fsg->data_size_from_cmnd = 0; -+ sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); -+ if ((reply = check_command(fsg, fsg->cmnd_size, -+ DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { -+ fsg->curlun->sense_data = SS_INVALID_COMMAND; -+ reply = -EINVAL; -+ } -+ break; -+ } -+ up_read(&fsg->filesem); -+ -+ if (reply == -EINTR || signal_pending(current)) -+ return -EINTR; -+ -+ /* Set up the single reply buffer for finish_reply() */ -+ if (reply == -EINVAL) -+ reply = 0; // Error reply length -+ if (reply >= 0 && fsg->data_dir == DATA_DIR_TO_HOST) { -+ reply = min((u32) reply, fsg->data_size_from_cmnd); -+ bh->inreq->length = reply; -+ bh->state = BUF_STATE_FULL; -+ fsg->residue -= reply; -+ } // Otherwise it's already set -+ -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct usb_request *req = bh->outreq; -+ struct bulk_cb_wrap *cbw = req->buf; -+ -+ /* Was this a real packet? Should it be ignored? */ -+ if (req->status || test_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) -+ return -EINVAL; -+ -+ /* Is the CBW valid? */ -+ if (req->actual != US_BULK_CB_WRAP_LEN || -+ cbw->Signature != cpu_to_le32( -+ US_BULK_CB_SIGN)) { -+ DBG(fsg, "invalid CBW: len %u sig 0x%x\n", -+ req->actual, -+ le32_to_cpu(cbw->Signature)); -+ -+ /* The Bulk-only spec says we MUST stall the IN endpoint -+ * (6.6.1), so it's unavoidable. It also says we must -+ * retain this state until the next reset, but there's -+ * no way to tell the controller driver it should ignore -+ * Clear-Feature(HALT) requests. -+ * -+ * We aren't required to halt the OUT endpoint; instead -+ * we can simply accept and discard any data received -+ * until the next reset. */ -+ wedge_bulk_in_endpoint(fsg); -+ set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); -+ return -EINVAL; -+ } -+ -+ /* Is the CBW meaningful? */ -+ if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN || -+ cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) { -+ DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, " -+ "cmdlen %u\n", -+ cbw->Lun, cbw->Flags, cbw->Length); -+ -+ /* We can do anything we want here, so let's stall the -+ * bulk pipes if we are allowed to. */ -+ if (mod_data.can_stall) { -+ fsg_set_halt(fsg, fsg->bulk_out); -+ halt_bulk_in_endpoint(fsg); -+ } -+ return -EINVAL; -+ } -+ -+ /* Save the command for later */ -+ fsg->cmnd_size = cbw->Length; -+ memcpy(fsg->cmnd, cbw->CDB, fsg->cmnd_size); -+ if (cbw->Flags & US_BULK_FLAG_IN) -+ fsg->data_dir = DATA_DIR_TO_HOST; -+ else -+ fsg->data_dir = DATA_DIR_FROM_HOST; -+ fsg->data_size = le32_to_cpu(cbw->DataTransferLength); -+ if (fsg->data_size == 0) -+ fsg->data_dir = DATA_DIR_NONE; -+ fsg->lun = cbw->Lun; -+ fsg->tag = cbw->Tag; -+ return 0; -+} -+ -+ -+static int get_next_command(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh; -+ int rc = 0; -+ -+ if (transport_is_bbb()) { -+ -+ /* Wait for the next buffer to become available */ -+ bh = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ /* Queue a request to read a Bulk-only CBW */ -+ set_bulk_out_req_length(fsg, bh, US_BULK_CB_WRAP_LEN); -+ start_transfer(fsg, fsg->bulk_out, bh->outreq, -+ &bh->outreq_busy, &bh->state); -+ -+ /* We will drain the buffer in software, which means we -+ * can reuse it for the next filling. No need to advance -+ * next_buffhd_to_fill. */ -+ -+ /* Wait for the CBW to arrive */ -+ while (bh->state != BUF_STATE_FULL) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ smp_rmb(); -+ rc = received_cbw(fsg, bh); -+ bh->state = BUF_STATE_EMPTY; -+ -+ } else { // USB_PR_CB or USB_PR_CBI -+ -+ /* Wait for the next command to arrive */ -+ while (fsg->cbbuf_cmnd_size == 0) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ /* Is the previous status interrupt request still busy? -+ * The host is allowed to skip reading the status, -+ * so we must cancel it. */ -+ if (fsg->intreq_busy) -+ usb_ep_dequeue(fsg->intr_in, fsg->intreq); -+ -+ /* Copy the command and mark the buffer empty */ -+ fsg->data_dir = DATA_DIR_UNKNOWN; -+ spin_lock_irq(&fsg->lock); -+ fsg->cmnd_size = fsg->cbbuf_cmnd_size; -+ memcpy(fsg->cmnd, fsg->cbbuf_cmnd, fsg->cmnd_size); -+ fsg->cbbuf_cmnd_size = 0; -+ spin_unlock_irq(&fsg->lock); -+ -+ /* Use LUN from the command */ -+ fsg->lun = fsg->cmnd[1] >> 5; -+ } -+ -+ /* Update current lun */ -+ if (fsg->lun >= 0 && fsg->lun < fsg->nluns) -+ fsg->curlun = &fsg->luns[fsg->lun]; -+ else -+ fsg->curlun = NULL; -+ -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int enable_endpoint(struct fsg_dev *fsg, struct usb_ep *ep, -+ const struct usb_endpoint_descriptor *d) -+{ -+ int rc; -+ -+ ep->driver_data = fsg; -+ ep->desc = d; -+ rc = usb_ep_enable(ep); -+ if (rc) -+ ERROR(fsg, "can't enable %s, result %d\n", ep->name, rc); -+ return rc; -+} -+ -+static int alloc_request(struct fsg_dev *fsg, struct usb_ep *ep, -+ struct usb_request **preq) -+{ -+ *preq = usb_ep_alloc_request(ep, GFP_ATOMIC); -+ if (*preq) -+ return 0; -+ ERROR(fsg, "can't allocate request for %s\n", ep->name); -+ return -ENOMEM; -+} -+ -+/* -+ * Reset interface setting and re-init endpoint state (toggle etc). -+ * Call with altsetting < 0 to disable the interface. The only other -+ * available altsetting is 0, which enables the interface. -+ */ -+static int do_set_interface(struct fsg_dev *fsg, int altsetting) -+{ -+ int rc = 0; -+ int i; -+ const struct usb_endpoint_descriptor *d; -+ -+ if (fsg->running) -+ DBG(fsg, "reset interface\n"); -+ -+reset: -+ /* Deallocate the requests */ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ struct fsg_buffhd *bh = &fsg->buffhds[i]; -+ -+ if (bh->inreq) { -+ usb_ep_free_request(fsg->bulk_in, bh->inreq); -+ bh->inreq = NULL; -+ } -+ if (bh->outreq) { -+ usb_ep_free_request(fsg->bulk_out, bh->outreq); -+ bh->outreq = NULL; -+ } -+ } -+ if (fsg->intreq) { -+ usb_ep_free_request(fsg->intr_in, fsg->intreq); -+ fsg->intreq = NULL; -+ } -+ -+ /* Disable the endpoints */ -+ if (fsg->bulk_in_enabled) { -+ usb_ep_disable(fsg->bulk_in); -+ fsg->bulk_in_enabled = 0; -+ } -+ if (fsg->bulk_out_enabled) { -+ usb_ep_disable(fsg->bulk_out); -+ fsg->bulk_out_enabled = 0; -+ } -+ if (fsg->intr_in_enabled) { -+ usb_ep_disable(fsg->intr_in); -+ fsg->intr_in_enabled = 0; -+ } -+ -+ fsg->running = 0; -+ if (altsetting < 0 || rc != 0) -+ return rc; -+ -+ DBG(fsg, "set interface %d\n", altsetting); -+ -+ /* Enable the endpoints */ -+ d = fsg_ep_desc(fsg->gadget, -+ &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc, -+ &fsg_ss_bulk_in_desc); -+ if ((rc = enable_endpoint(fsg, fsg->bulk_in, d)) != 0) -+ goto reset; -+ fsg->bulk_in_enabled = 1; -+ -+ d = fsg_ep_desc(fsg->gadget, -+ &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc, -+ &fsg_ss_bulk_out_desc); -+ if ((rc = enable_endpoint(fsg, fsg->bulk_out, d)) != 0) -+ goto reset; -+ fsg->bulk_out_enabled = 1; -+ fsg->bulk_out_maxpacket = usb_endpoint_maxp(d); -+ clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); -+ -+ if (transport_is_cbi()) { -+ d = fsg_ep_desc(fsg->gadget, -+ &fsg_fs_intr_in_desc, &fsg_hs_intr_in_desc, -+ &fsg_ss_intr_in_desc); -+ if ((rc = enable_endpoint(fsg, fsg->intr_in, d)) != 0) -+ goto reset; -+ fsg->intr_in_enabled = 1; -+ } -+ -+ /* Allocate the requests */ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ struct fsg_buffhd *bh = &fsg->buffhds[i]; -+ -+ if ((rc = alloc_request(fsg, fsg->bulk_in, &bh->inreq)) != 0) -+ goto reset; -+ if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) -+ goto reset; -+ bh->inreq->buf = bh->outreq->buf = bh->buf; -+ bh->inreq->context = bh->outreq->context = bh; -+ bh->inreq->complete = bulk_in_complete; -+ bh->outreq->complete = bulk_out_complete; -+ } -+ if (transport_is_cbi()) { -+ if ((rc = alloc_request(fsg, fsg->intr_in, &fsg->intreq)) != 0) -+ goto reset; -+ fsg->intreq->complete = intr_in_complete; -+ } -+ -+ fsg->running = 1; -+ for (i = 0; i < fsg->nluns; ++i) -+ fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; -+ return rc; -+} -+ -+ -+/* -+ * Change our operational configuration. This code must agree with the code -+ * that returns config descriptors, and with interface altsetting code. -+ * -+ * It's also responsible for power management interactions. Some -+ * configurations might not work with our current power sources. -+ * For now we just assume the gadget is always self-powered. -+ */ -+static int do_set_config(struct fsg_dev *fsg, u8 new_config) -+{ -+ int rc = 0; -+ -+ /* Disable the single interface */ -+ if (fsg->config != 0) { -+ DBG(fsg, "reset config\n"); -+ fsg->config = 0; -+ rc = do_set_interface(fsg, -1); -+ } -+ -+ /* Enable the interface */ -+ if (new_config != 0) { -+ fsg->config = new_config; -+ if ((rc = do_set_interface(fsg, 0)) != 0) -+ fsg->config = 0; // Reset on errors -+ else -+ INFO(fsg, "%s config #%d\n", -+ usb_speed_string(fsg->gadget->speed), -+ fsg->config); -+ } -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void handle_exception(struct fsg_dev *fsg) -+{ -+ siginfo_t info; -+ int sig; -+ int i; -+ int num_active; -+ struct fsg_buffhd *bh; -+ enum fsg_state old_state; -+ u8 new_config; -+ struct fsg_lun *curlun; -+ unsigned int exception_req_tag; -+ int rc; -+ -+ /* Clear the existing signals. Anything but SIGUSR1 is converted -+ * into a high-priority EXIT exception. */ -+ for (;;) { -+ sig = dequeue_signal_lock(current, ¤t->blocked, &info); -+ if (!sig) -+ break; -+ if (sig != SIGUSR1) { -+ if (fsg->state < FSG_STATE_EXIT) -+ DBG(fsg, "Main thread exiting on signal\n"); -+ raise_exception(fsg, FSG_STATE_EXIT); -+ } -+ } -+ -+ /* Cancel all the pending transfers */ -+ if (fsg->intreq_busy) -+ usb_ep_dequeue(fsg->intr_in, fsg->intreq); -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ bh = &fsg->buffhds[i]; -+ if (bh->inreq_busy) -+ usb_ep_dequeue(fsg->bulk_in, bh->inreq); -+ if (bh->outreq_busy) -+ usb_ep_dequeue(fsg->bulk_out, bh->outreq); -+ } -+ -+ /* Wait until everything is idle */ -+ for (;;) { -+ num_active = fsg->intreq_busy; -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ bh = &fsg->buffhds[i]; -+ num_active += bh->inreq_busy + bh->outreq_busy; -+ } -+ if (num_active == 0) -+ break; -+ if (sleep_thread(fsg)) -+ return; -+ } -+ -+ /* Clear out the controller's fifos */ -+ if (fsg->bulk_in_enabled) -+ usb_ep_fifo_flush(fsg->bulk_in); -+ if (fsg->bulk_out_enabled) -+ usb_ep_fifo_flush(fsg->bulk_out); -+ if (fsg->intr_in_enabled) -+ usb_ep_fifo_flush(fsg->intr_in); -+ -+ /* Reset the I/O buffer states and pointers, the SCSI -+ * state, and the exception. Then invoke the handler. */ -+ spin_lock_irq(&fsg->lock); -+ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ bh = &fsg->buffhds[i]; -+ bh->state = BUF_STATE_EMPTY; -+ } -+ fsg->next_buffhd_to_fill = fsg->next_buffhd_to_drain = -+ &fsg->buffhds[0]; -+ -+ exception_req_tag = fsg->exception_req_tag; -+ new_config = fsg->new_config; -+ old_state = fsg->state; -+ -+ if (old_state == FSG_STATE_ABORT_BULK_OUT) -+ fsg->state = FSG_STATE_STATUS_PHASE; -+ else { -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ curlun->prevent_medium_removal = 0; -+ curlun->sense_data = curlun->unit_attention_data = -+ SS_NO_SENSE; -+ curlun->sense_data_info = 0; -+ curlun->info_valid = 0; -+ } -+ fsg->state = FSG_STATE_IDLE; -+ } -+ spin_unlock_irq(&fsg->lock); -+ -+ /* Carry out any extra actions required for the exception */ -+ switch (old_state) { -+ default: -+ break; -+ -+ case FSG_STATE_ABORT_BULK_OUT: -+ send_status(fsg); -+ spin_lock_irq(&fsg->lock); -+ if (fsg->state == FSG_STATE_STATUS_PHASE) -+ fsg->state = FSG_STATE_IDLE; -+ spin_unlock_irq(&fsg->lock); -+ break; -+ -+ case FSG_STATE_RESET: -+ /* In case we were forced against our will to halt a -+ * bulk endpoint, clear the halt now. (The SuperH UDC -+ * requires this.) */ -+ if (test_and_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) -+ usb_ep_clear_halt(fsg->bulk_in); -+ -+ if (transport_is_bbb()) { -+ if (fsg->ep0_req_tag == exception_req_tag) -+ ep0_queue(fsg); // Complete the status stage -+ -+ } else if (transport_is_cbi()) -+ send_status(fsg); // Status by interrupt pipe -+ -+ /* Technically this should go here, but it would only be -+ * a waste of time. Ditto for the INTERFACE_CHANGE and -+ * CONFIG_CHANGE cases. */ -+ // for (i = 0; i < fsg->nluns; ++i) -+ // fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; -+ break; -+ -+ case FSG_STATE_INTERFACE_CHANGE: -+ rc = do_set_interface(fsg, 0); -+ if (fsg->ep0_req_tag != exception_req_tag) -+ break; -+ if (rc != 0) // STALL on errors -+ fsg_set_halt(fsg, fsg->ep0); -+ else // Complete the status stage -+ ep0_queue(fsg); -+ break; -+ -+ case FSG_STATE_CONFIG_CHANGE: -+ rc = do_set_config(fsg, new_config); -+ if (fsg->ep0_req_tag != exception_req_tag) -+ break; -+ if (rc != 0) // STALL on errors -+ fsg_set_halt(fsg, fsg->ep0); -+ else // Complete the status stage -+ ep0_queue(fsg); -+ break; -+ -+ case FSG_STATE_DISCONNECT: -+ for (i = 0; i < fsg->nluns; ++i) -+ fsg_lun_fsync_sub(fsg->luns + i); -+ do_set_config(fsg, 0); // Unconfigured state -+ break; -+ -+ case FSG_STATE_EXIT: -+ case FSG_STATE_TERMINATED: -+ do_set_config(fsg, 0); // Free resources -+ spin_lock_irq(&fsg->lock); -+ fsg->state = FSG_STATE_TERMINATED; // Stop the thread -+ spin_unlock_irq(&fsg->lock); -+ break; -+ } -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int fsg_main_thread(void *fsg_) -+{ -+ struct fsg_dev *fsg = fsg_; -+ -+ /* Allow the thread to be killed by a signal, but set the signal mask -+ * to block everything but INT, TERM, KILL, and USR1. */ -+ allow_signal(SIGINT); -+ allow_signal(SIGTERM); -+ allow_signal(SIGKILL); -+ allow_signal(SIGUSR1); -+ -+ /* Allow the thread to be frozen */ -+ set_freezable(); -+ -+ /* Arrange for userspace references to be interpreted as kernel -+ * pointers. That way we can pass a kernel pointer to a routine -+ * that expects a __user pointer and it will work okay. */ -+ set_fs(get_ds()); -+ -+ /* The main loop */ -+ while (fsg->state != FSG_STATE_TERMINATED) { -+ if (exception_in_progress(fsg) || signal_pending(current)) { -+ handle_exception(fsg); -+ continue; -+ } -+ -+ if (!fsg->running) { -+ sleep_thread(fsg); -+ continue; -+ } -+ -+ if (get_next_command(fsg)) -+ continue; -+ -+ spin_lock_irq(&fsg->lock); -+ if (!exception_in_progress(fsg)) -+ fsg->state = FSG_STATE_DATA_PHASE; -+ spin_unlock_irq(&fsg->lock); -+ -+ if (do_scsi_command(fsg) || finish_reply(fsg)) -+ continue; -+ -+ spin_lock_irq(&fsg->lock); -+ if (!exception_in_progress(fsg)) -+ fsg->state = FSG_STATE_STATUS_PHASE; -+ spin_unlock_irq(&fsg->lock); -+ -+ if (send_status(fsg)) -+ continue; -+ -+ spin_lock_irq(&fsg->lock); -+ if (!exception_in_progress(fsg)) -+ fsg->state = FSG_STATE_IDLE; -+ spin_unlock_irq(&fsg->lock); -+ } -+ -+ spin_lock_irq(&fsg->lock); -+ fsg->thread_task = NULL; -+ spin_unlock_irq(&fsg->lock); -+ -+ /* If we are exiting because of a signal, unregister the -+ * gadget driver. */ -+ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) -+ usb_gadget_unregister_driver(&fsg_driver); -+ -+ /* Let the unbind and cleanup routines know the thread has exited */ -+ complete_and_exit(&fsg->thread_notifier, 0); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+ -+/* The write permissions and store_xxx pointers are set in fsg_bind() */ -+static DEVICE_ATTR(ro, 0444, fsg_show_ro, NULL); -+static DEVICE_ATTR(nofua, 0644, fsg_show_nofua, NULL); -+static DEVICE_ATTR(file, 0444, fsg_show_file, NULL); -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void fsg_release(struct kref *ref) -+{ -+ struct fsg_dev *fsg = container_of(ref, struct fsg_dev, ref); -+ -+ kfree(fsg->luns); -+ kfree(fsg); -+} -+ -+static void lun_release(struct device *dev) -+{ -+ struct rw_semaphore *filesem = dev_get_drvdata(dev); -+ struct fsg_dev *fsg = -+ container_of(filesem, struct fsg_dev, filesem); -+ -+ kref_put(&fsg->ref, fsg_release); -+} -+ -+static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ int i; -+ struct fsg_lun *curlun; -+ struct usb_request *req = fsg->ep0req; -+ -+ DBG(fsg, "unbind\n"); -+ clear_bit(REGISTERED, &fsg->atomic_bitflags); -+ -+ /* If the thread isn't already dead, tell it to exit now */ -+ if (fsg->state != FSG_STATE_TERMINATED) { -+ raise_exception(fsg, FSG_STATE_EXIT); -+ wait_for_completion(&fsg->thread_notifier); -+ -+ /* The cleanup routine waits for this completion also */ -+ complete(&fsg->thread_notifier); -+ } -+ -+ /* Unregister the sysfs attribute files and the LUNs */ -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ if (curlun->registered) { -+ device_remove_file(&curlun->dev, &dev_attr_nofua); -+ device_remove_file(&curlun->dev, &dev_attr_ro); -+ device_remove_file(&curlun->dev, &dev_attr_file); -+ fsg_lun_close(curlun); -+ device_unregister(&curlun->dev); -+ curlun->registered = 0; -+ } -+ } -+ -+ /* Free the data buffers */ -+ for (i = 0; i < fsg_num_buffers; ++i) -+ kfree(fsg->buffhds[i].buf); -+ -+ /* Free the request and buffer for endpoint 0 */ -+ if (req) { -+ kfree(req->buf); -+ usb_ep_free_request(fsg->ep0, req); -+ } -+ -+ set_gadget_data(gadget, NULL); -+} -+ -+ -+static int __init check_parameters(struct fsg_dev *fsg) -+{ -+ int prot; -+ int gcnum; -+ -+ /* Store the default values */ -+ mod_data.transport_type = USB_PR_BULK; -+ mod_data.transport_name = "Bulk-only"; -+ mod_data.protocol_type = USB_SC_SCSI; -+ mod_data.protocol_name = "Transparent SCSI"; -+ -+ /* Some peripheral controllers are known not to be able to -+ * halt bulk endpoints correctly. If one of them is present, -+ * disable stalls. -+ */ -+ if (gadget_is_at91(fsg->gadget)) -+ mod_data.can_stall = 0; -+ -+ if (mod_data.release == 0xffff) { // Parameter wasn't set -+ gcnum = usb_gadget_controller_number(fsg->gadget); -+ if (gcnum >= 0) -+ mod_data.release = 0x0300 + gcnum; -+ else { -+ WARNING(fsg, "controller '%s' not recognized\n", -+ fsg->gadget->name); -+ mod_data.release = 0x0399; -+ } -+ } -+ -+ prot = simple_strtol(mod_data.protocol_parm, NULL, 0); -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ if (strnicmp(mod_data.transport_parm, "BBB", 10) == 0) { -+ ; // Use default setting -+ } else if (strnicmp(mod_data.transport_parm, "CB", 10) == 0) { -+ mod_data.transport_type = USB_PR_CB; -+ mod_data.transport_name = "Control-Bulk"; -+ } else if (strnicmp(mod_data.transport_parm, "CBI", 10) == 0) { -+ mod_data.transport_type = USB_PR_CBI; -+ mod_data.transport_name = "Control-Bulk-Interrupt"; -+ } else { -+ ERROR(fsg, "invalid transport: %s\n", mod_data.transport_parm); -+ return -EINVAL; -+ } -+ -+ if (strnicmp(mod_data.protocol_parm, "SCSI", 10) == 0 || -+ prot == USB_SC_SCSI) { -+ ; // Use default setting -+ } else if (strnicmp(mod_data.protocol_parm, "RBC", 10) == 0 || -+ prot == USB_SC_RBC) { -+ mod_data.protocol_type = USB_SC_RBC; -+ mod_data.protocol_name = "RBC"; -+ } else if (strnicmp(mod_data.protocol_parm, "8020", 4) == 0 || -+ strnicmp(mod_data.protocol_parm, "ATAPI", 10) == 0 || -+ prot == USB_SC_8020) { -+ mod_data.protocol_type = USB_SC_8020; -+ mod_data.protocol_name = "8020i (ATAPI)"; -+ } else if (strnicmp(mod_data.protocol_parm, "QIC", 3) == 0 || -+ prot == USB_SC_QIC) { -+ mod_data.protocol_type = USB_SC_QIC; -+ mod_data.protocol_name = "QIC-157"; -+ } else if (strnicmp(mod_data.protocol_parm, "UFI", 10) == 0 || -+ prot == USB_SC_UFI) { -+ mod_data.protocol_type = USB_SC_UFI; -+ mod_data.protocol_name = "UFI"; -+ } else if (strnicmp(mod_data.protocol_parm, "8070", 4) == 0 || -+ prot == USB_SC_8070) { -+ mod_data.protocol_type = USB_SC_8070; -+ mod_data.protocol_name = "8070i"; -+ } else { -+ ERROR(fsg, "invalid protocol: %s\n", mod_data.protocol_parm); -+ return -EINVAL; -+ } -+ -+ mod_data.buflen &= PAGE_CACHE_MASK; -+ if (mod_data.buflen <= 0) { -+ ERROR(fsg, "invalid buflen\n"); -+ return -ETOOSMALL; -+ } -+ -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ /* Serial string handling. -+ * On a real device, the serial string would be loaded -+ * from permanent storage. */ -+ if (mod_data.serial) { -+ const char *ch; -+ unsigned len = 0; -+ -+ /* Sanity check : -+ * The CB[I] specification limits the serial string to -+ * 12 uppercase hexadecimal characters. -+ * BBB need at least 12 uppercase hexadecimal characters, -+ * with a maximum of 126. */ -+ for (ch = mod_data.serial; *ch; ++ch) { -+ ++len; -+ if ((*ch < '0' || *ch > '9') && -+ (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */ -+ WARNING(fsg, -+ "Invalid serial string character: %c\n", -+ *ch); -+ goto no_serial; -+ } -+ } -+ if (len > 126 || -+ (mod_data.transport_type == USB_PR_BULK && len < 12) || -+ (mod_data.transport_type != USB_PR_BULK && len > 12)) { -+ WARNING(fsg, "Invalid serial string length!\n"); -+ goto no_serial; -+ } -+ fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial; -+ } else { -+ WARNING(fsg, "No serial-number string provided!\n"); -+ no_serial: -+ device_desc.iSerialNumber = 0; -+ } -+ -+ return 0; -+} -+ -+ -+static int __init fsg_bind(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = the_fsg; -+ int rc; -+ int i; -+ struct fsg_lun *curlun; -+ struct usb_ep *ep; -+ struct usb_request *req; -+ char *pathbuf, *p; -+ -+ fsg->gadget = gadget; -+ set_gadget_data(gadget, fsg); -+ fsg->ep0 = gadget->ep0; -+ fsg->ep0->driver_data = fsg; -+ -+ if ((rc = check_parameters(fsg)) != 0) -+ goto out; -+ -+ if (mod_data.removable) { // Enable the store_xxx attributes -+ dev_attr_file.attr.mode = 0644; -+ dev_attr_file.store = fsg_store_file; -+ if (!mod_data.cdrom) { -+ dev_attr_ro.attr.mode = 0644; -+ dev_attr_ro.store = fsg_store_ro; -+ } -+ } -+ -+ /* Only for removable media? */ -+ dev_attr_nofua.attr.mode = 0644; -+ dev_attr_nofua.store = fsg_store_nofua; -+ -+ /* Find out how many LUNs there should be */ -+ i = mod_data.nluns; -+ if (i == 0) -+ i = max(mod_data.num_filenames, 1u); -+ if (i > FSG_MAX_LUNS) { -+ ERROR(fsg, "invalid number of LUNs: %d\n", i); -+ rc = -EINVAL; -+ goto out; -+ } -+ -+ /* Create the LUNs, open their backing files, and register the -+ * LUN devices in sysfs. */ -+ fsg->luns = kzalloc(i * sizeof(struct fsg_lun), GFP_KERNEL); -+ if (!fsg->luns) { -+ rc = -ENOMEM; -+ goto out; -+ } -+ fsg->nluns = i; -+ -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ curlun->cdrom = !!mod_data.cdrom; -+ curlun->ro = mod_data.cdrom || mod_data.ro[i]; -+ curlun->initially_ro = curlun->ro; -+ curlun->removable = mod_data.removable; -+ curlun->nofua = mod_data.nofua[i]; -+ curlun->dev.release = lun_release; -+ curlun->dev.parent = &gadget->dev; -+ curlun->dev.driver = &fsg_driver.driver; -+ dev_set_drvdata(&curlun->dev, &fsg->filesem); -+ dev_set_name(&curlun->dev,"%s-lun%d", -+ dev_name(&gadget->dev), i); -+ -+ kref_get(&fsg->ref); -+ rc = device_register(&curlun->dev); -+ if (rc) { -+ INFO(fsg, "failed to register LUN%d: %d\n", i, rc); -+ put_device(&curlun->dev); -+ goto out; -+ } -+ curlun->registered = 1; -+ -+ rc = device_create_file(&curlun->dev, &dev_attr_ro); -+ if (rc) -+ goto out; -+ rc = device_create_file(&curlun->dev, &dev_attr_nofua); -+ if (rc) -+ goto out; -+ rc = device_create_file(&curlun->dev, &dev_attr_file); -+ if (rc) -+ goto out; -+ -+ if (mod_data.file[i] && *mod_data.file[i]) { -+ rc = fsg_lun_open(curlun, mod_data.file[i]); -+ if (rc) -+ goto out; -+ } else if (!mod_data.removable) { -+ ERROR(fsg, "no file given for LUN%d\n", i); -+ rc = -EINVAL; -+ goto out; -+ } -+ } -+ -+ /* Find all the endpoints we will use */ -+ usb_ep_autoconfig_reset(gadget); -+ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_in_desc); -+ if (!ep) -+ goto autoconf_fail; -+ ep->driver_data = fsg; // claim the endpoint -+ fsg->bulk_in = ep; -+ -+ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_out_desc); -+ if (!ep) -+ goto autoconf_fail; -+ ep->driver_data = fsg; // claim the endpoint -+ fsg->bulk_out = ep; -+ -+ if (transport_is_cbi()) { -+ ep = usb_ep_autoconfig(gadget, &fsg_fs_intr_in_desc); -+ if (!ep) -+ goto autoconf_fail; -+ ep->driver_data = fsg; // claim the endpoint -+ fsg->intr_in = ep; -+ } -+ -+ /* Fix up the descriptors */ -+ device_desc.idVendor = cpu_to_le16(mod_data.vendor); -+ device_desc.idProduct = cpu_to_le16(mod_data.product); -+ device_desc.bcdDevice = cpu_to_le16(mod_data.release); -+ -+ i = (transport_is_cbi() ? 3 : 2); // Number of endpoints -+ fsg_intf_desc.bNumEndpoints = i; -+ fsg_intf_desc.bInterfaceSubClass = mod_data.protocol_type; -+ fsg_intf_desc.bInterfaceProtocol = mod_data.transport_type; -+ fsg_fs_function[i + FSG_FS_FUNCTION_PRE_EP_ENTRIES] = NULL; -+ -+ if (gadget_is_dualspeed(gadget)) { -+ fsg_hs_function[i + FSG_HS_FUNCTION_PRE_EP_ENTRIES] = NULL; -+ -+ /* Assume endpoint addresses are the same for both speeds */ -+ fsg_hs_bulk_in_desc.bEndpointAddress = -+ fsg_fs_bulk_in_desc.bEndpointAddress; -+ fsg_hs_bulk_out_desc.bEndpointAddress = -+ fsg_fs_bulk_out_desc.bEndpointAddress; -+ fsg_hs_intr_in_desc.bEndpointAddress = -+ fsg_fs_intr_in_desc.bEndpointAddress; -+ } -+ -+ if (gadget_is_superspeed(gadget)) { -+ unsigned max_burst; -+ -+ fsg_ss_function[i + FSG_SS_FUNCTION_PRE_EP_ENTRIES] = NULL; -+ -+ /* Calculate bMaxBurst, we know packet size is 1024 */ -+ max_burst = min_t(unsigned, mod_data.buflen / 1024, 15); -+ -+ /* Assume endpoint addresses are the same for both speeds */ -+ fsg_ss_bulk_in_desc.bEndpointAddress = -+ fsg_fs_bulk_in_desc.bEndpointAddress; -+ fsg_ss_bulk_in_comp_desc.bMaxBurst = max_burst; -+ -+ fsg_ss_bulk_out_desc.bEndpointAddress = -+ fsg_fs_bulk_out_desc.bEndpointAddress; -+ fsg_ss_bulk_out_comp_desc.bMaxBurst = max_burst; -+ } -+ -+ if (gadget_is_otg(gadget)) -+ fsg_otg_desc.bmAttributes |= USB_OTG_HNP; -+ -+ rc = -ENOMEM; -+ -+ /* Allocate the request and buffer for endpoint 0 */ -+ fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); -+ if (!req) -+ goto out; -+ req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); -+ if (!req->buf) -+ goto out; -+ req->complete = ep0_complete; -+ -+ /* Allocate the data buffers */ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ struct fsg_buffhd *bh = &fsg->buffhds[i]; -+ -+ /* Allocate for the bulk-in endpoint. We assume that -+ * the buffer will also work with the bulk-out (and -+ * interrupt-in) endpoint. */ -+ bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); -+ if (!bh->buf) -+ goto out; -+ bh->next = bh + 1; -+ } -+ fsg->buffhds[fsg_num_buffers - 1].next = &fsg->buffhds[0]; -+ -+ /* This should reflect the actual gadget power source */ -+ usb_gadget_set_selfpowered(gadget); -+ -+ snprintf(fsg_string_manufacturer, sizeof fsg_string_manufacturer, -+ "%s %s with %s", -+ init_utsname()->sysname, init_utsname()->release, -+ gadget->name); -+ -+ fsg->thread_task = kthread_create(fsg_main_thread, fsg, -+ "file-storage-gadget"); -+ if (IS_ERR(fsg->thread_task)) { -+ rc = PTR_ERR(fsg->thread_task); -+ goto out; -+ } -+ -+ INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); -+ INFO(fsg, "NOTE: This driver is deprecated. " -+ "Consider using g_mass_storage instead.\n"); -+ INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); -+ -+ pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ if (fsg_lun_is_open(curlun)) { -+ p = NULL; -+ if (pathbuf) { -+ p = d_path(&curlun->filp->f_path, -+ pathbuf, PATH_MAX); -+ if (IS_ERR(p)) -+ p = NULL; -+ } -+ LINFO(curlun, "ro=%d, nofua=%d, file: %s\n", -+ curlun->ro, curlun->nofua, (p ? p : "(error)")); -+ } -+ } -+ kfree(pathbuf); -+ -+ DBG(fsg, "transport=%s (x%02x)\n", -+ mod_data.transport_name, mod_data.transport_type); -+ DBG(fsg, "protocol=%s (x%02x)\n", -+ mod_data.protocol_name, mod_data.protocol_type); -+ DBG(fsg, "VendorID=x%04x, ProductID=x%04x, Release=x%04x\n", -+ mod_data.vendor, mod_data.product, mod_data.release); -+ DBG(fsg, "removable=%d, stall=%d, cdrom=%d, buflen=%u\n", -+ mod_data.removable, mod_data.can_stall, -+ mod_data.cdrom, mod_data.buflen); -+ DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task)); -+ -+ set_bit(REGISTERED, &fsg->atomic_bitflags); -+ -+ /* Tell the thread to start working */ -+ wake_up_process(fsg->thread_task); -+ return 0; -+ -+autoconf_fail: -+ ERROR(fsg, "unable to autoconfigure all endpoints\n"); -+ rc = -ENOTSUPP; -+ -+out: -+ fsg->state = FSG_STATE_TERMINATED; // The thread is dead -+ fsg_unbind(gadget); -+ complete(&fsg->thread_notifier); -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void fsg_suspend(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ -+ DBG(fsg, "suspend\n"); -+ set_bit(SUSPENDED, &fsg->atomic_bitflags); -+} -+ -+static void fsg_resume(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ -+ DBG(fsg, "resume\n"); -+ clear_bit(SUSPENDED, &fsg->atomic_bitflags); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static struct usb_gadget_driver fsg_driver = { -+ .max_speed = USB_SPEED_SUPER, -+ .function = (char *) fsg_string_product, -+ .unbind = fsg_unbind, -+ .disconnect = fsg_disconnect, -+ .setup = fsg_setup, -+ .suspend = fsg_suspend, -+ .resume = fsg_resume, -+ -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ // .release = ... -+ // .suspend = ... -+ // .resume = ... -+ }, -+}; -+ -+ -+static int __init fsg_alloc(void) -+{ -+ struct fsg_dev *fsg; -+ -+ fsg = kzalloc(sizeof *fsg + -+ fsg_num_buffers * sizeof *(fsg->buffhds), GFP_KERNEL); -+ -+ if (!fsg) -+ return -ENOMEM; -+ spin_lock_init(&fsg->lock); -+ init_rwsem(&fsg->filesem); -+ kref_init(&fsg->ref); -+ init_completion(&fsg->thread_notifier); -+ -+ the_fsg = fsg; -+ return 0; -+} -+ -+ -+static int __init fsg_init(void) -+{ -+ int rc; -+ struct fsg_dev *fsg; -+ -+ rc = fsg_num_buffers_validate(); -+ if (rc != 0) -+ return rc; -+ -+ if ((rc = fsg_alloc()) != 0) -+ return rc; -+ fsg = the_fsg; -+ if ((rc = usb_gadget_probe_driver(&fsg_driver, fsg_bind)) != 0) -+ kref_put(&fsg->ref, fsg_release); -+ return rc; -+} -+module_init(fsg_init); -+ -+ -+static void __exit fsg_cleanup(void) -+{ -+ struct fsg_dev *fsg = the_fsg; -+ -+ /* Unregister the driver iff the thread hasn't already done so */ -+ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) -+ usb_gadget_unregister_driver(&fsg_driver); -+ -+ /* Wait for the thread to finish up */ -+ wait_for_completion(&fsg->thread_notifier); -+ -+ kref_put(&fsg->ref, fsg_release); -+} -+module_exit(fsg_cleanup); -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 0b80cee30da4740e8c28c6ea7a4cc700163a12ee..f17b939c149562527937f49d90e23c7ab8b72328 100644 ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -762,6 +762,19 @@ config USB_HWA_HCD - To compile this driver a module, choose M here: the module - will be called "hwa-hc". - -+config USB_DWCOTG -+ tristate "Synopsis DWC host support" -+ depends on USB -+ help -+ The Synopsis DWC controller is a dual-role -+ host/peripheral/OTG ("On The Go") USB controllers. -+ -+ Enable this option to support this IP in host controller mode. -+ If unsure, say N. -+ -+ To compile this driver as a module, choose M here: the -+ modules built will be called dwc_otg and dwc_common_port. -+ - config USB_IMX21_HCD - tristate "i.MX21 HCD support" - depends on ARM && ARCH_MXC -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index 6ef785b0ea8ff0b5f4ee3bc40ba22d17c855478f..c28acc1b2877b6ac43604d1968351ce42e9470a5 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -74,6 +74,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o - obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o - obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o - obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ - obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o - obj-$(CONFIG_USB_FSL_USB2) += fsl-mph-dr-of.o - obj-$(CONFIG_USB_EHCI_FSL) += fsl-mph-dr-of.o -diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..f10d466d1aea8696fb394aebebb9945e6b79a991 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile -@@ -0,0 +1,58 @@ -+# -+# Makefile for DWC_common library -+# -+ -+ifneq ($(KERNELRELEASE),) -+ -+ccflags-y += -DDWC_LINUX -+#ccflags-y += -DDEBUG -+#ccflags-y += -DDWC_DEBUG_REGS -+#ccflags-y += -DDWC_DEBUG_MEMORY -+ -+ccflags-y += -DDWC_LIBMODULE -+ccflags-y += -DDWC_CCLIB -+#ccflags-y += -DDWC_CRYPTOLIB -+ccflags-y += -DDWC_NOTIFYLIB -+ccflags-y += -DDWC_UTFLIB -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o -+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ -+ dwc_crypto.o dwc_notifier.o \ -+ dwc_common_linux.o dwc_mem.o -+ -+kernrelwd := $(subst ., ,$(KERNELRELEASE)) -+kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) -+ -+ifneq ($(kernrel3),2.6.20) -+# grayg - I only know that we use ccflags-y in 2.6.31 actually -+ccflags-y += $(CPPFLAGS) -+endif -+ -+else -+ -+#ifeq ($(KDIR),) -+#$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) -+#endif -+ -+ifeq ($(ARCH),) -+$(error Must give "ARCH=" on command line or in environment. Also, if \ -+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") -+endif -+ -+ifeq ($(DOXYGEN),) -+DOXYGEN := doxygen -+endif -+ -+default: -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+endif -+ -+clean: -+ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ -diff --git a/drivers/usb/host/dwc_common_port/Makefile.fbsd b/drivers/usb/host/dwc_common_port/Makefile.fbsd -new file mode 100644 -index 0000000000000000000000000000000000000000..45db9915b9d31f39dd9aaf97772b3c31234c4ce6 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile.fbsd -@@ -0,0 +1,17 @@ -+CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include -+CFLAGS += -DDWC_FREEBSD -+CFLAGS += -DDEBUG -+#CFLAGS += -DDWC_DEBUG_REGS -+#CFLAGS += -DDWC_DEBUG_MEMORY -+ -+#CFLAGS += -DDWC_LIBMODULE -+#CFLAGS += -DDWC_CCLIB -+#CFLAGS += -DDWC_CRYPTOLIB -+#CFLAGS += -DDWC_NOTIFYLIB -+#CFLAGS += -DDWC_UTFLIB -+ -+KMOD = dwc_common_port_lib -+SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \ -+ dwc_common_fbsd.c dwc_mem.c -+ -+.include -diff --git a/drivers/usb/host/dwc_common_port/Makefile.linux b/drivers/usb/host/dwc_common_port/Makefile.linux -new file mode 100644 -index 0000000000000000000000000000000000000000..0cef7b461bd5084f261b28ebd05d62418956956e ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile.linux -@@ -0,0 +1,49 @@ -+# -+# Makefile for DWC_common library -+# -+ifneq ($(KERNELRELEASE),) -+ -+ccflags-y += -DDWC_LINUX -+#ccflags-y += -DDEBUG -+#ccflags-y += -DDWC_DEBUG_REGS -+#ccflags-y += -DDWC_DEBUG_MEMORY -+ -+ccflags-y += -DDWC_LIBMODULE -+ccflags-y += -DDWC_CCLIB -+ccflags-y += -DDWC_CRYPTOLIB -+ccflags-y += -DDWC_NOTIFYLIB -+ccflags-y += -DDWC_UTFLIB -+ -+obj-m := dwc_common_port_lib.o -+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ -+ dwc_crypto.o dwc_notifier.o \ -+ dwc_common_linux.o dwc_mem.o -+ -+else -+ -+ifeq ($(KDIR),) -+$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) -+endif -+ -+ifeq ($(ARCH),) -+$(error Must give "ARCH=" on command line or in environment. Also, if \ -+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") -+endif -+ -+ifeq ($(DOXYGEN),) -+DOXYGEN := doxygen -+endif -+ -+default: -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+endif -+ -+clean: -+ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ -diff --git a/drivers/usb/host/dwc_common_port/changes.txt b/drivers/usb/host/dwc_common_port/changes.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..f6839f92c2760d8dc29e514a1f6833d356cfd217 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/changes.txt -@@ -0,0 +1,174 @@ -+ -+dwc_read_reg32() and friends now take an additional parameter, a pointer to an -+IO context struct. The IO context struct should live in an os-dependent struct -+in your driver. As an example, the dwc_usb3 driver has an os-dependent struct -+named 'os_dep' embedded in the main device struct. So there these calls look -+like this: -+ -+ dwc_read_reg32(&usb3_dev->os_dep.ioctx, &pcd->dev_global_regs->dcfg); -+ -+ dwc_write_reg32(&usb3_dev->os_dep.ioctx, -+ &pcd->dev_global_regs->dcfg, 0); -+ -+Note that for the existing Linux driver ports, it is not necessary to actually -+define the 'ioctx' member in the os-dependent struct. Since Linux does not -+require an IO context, its macros for dwc_read_reg32() and friends do not -+use the context pointer, so it is optimized away by the compiler. But it is -+necessary to add the pointer parameter to all of the call sites, to be ready -+for any future ports (such as FreeBSD) which do require an IO context. -+ -+ -+Similarly, dwc_alloc(), dwc_alloc_atomic(), dwc_strdup(), and dwc_free() now -+take an additional parameter, a pointer to a memory context. Examples: -+ -+ addr = dwc_alloc(&usb3_dev->os_dep.memctx, size); -+ -+ dwc_free(&usb3_dev->os_dep.memctx, addr); -+ -+Again, for the Linux ports, it is not necessary to actually define the memctx -+member, but it is necessary to add the pointer parameter to all of the call -+sites. -+ -+ -+Same for dwc_dma_alloc() and dwc_dma_free(). Examples: -+ -+ virt_addr = dwc_dma_alloc(&usb3_dev->os_dep.dmactx, size, &phys_addr); -+ -+ dwc_dma_free(&usb3_dev->os_dep.dmactx, size, virt_addr, phys_addr); -+ -+ -+Same for dwc_mutex_alloc() and dwc_mutex_free(). Examples: -+ -+ mutex = dwc_mutex_alloc(&usb3_dev->os_dep.mtxctx); -+ -+ dwc_mutex_free(&usb3_dev->os_dep.mtxctx, mutex); -+ -+ -+Same for dwc_spinlock_alloc() and dwc_spinlock_free(). Examples: -+ -+ lock = dwc_spinlock_alloc(&usb3_dev->osdep.splctx); -+ -+ dwc_spinlock_free(&usb3_dev->osdep.splctx, lock); -+ -+ -+Same for dwc_timer_alloc(). Example: -+ -+ timer = dwc_timer_alloc(&usb3_dev->os_dep.tmrctx, "dwc_usb3_tmr1", -+ cb_func, cb_data); -+ -+ -+Same for dwc_waitq_alloc(). Example: -+ -+ waitq = dwc_waitq_alloc(&usb3_dev->os_dep.wtqctx); -+ -+ -+Same for dwc_thread_run(). Example: -+ -+ thread = dwc_thread_run(&usb3_dev->os_dep.thdctx, func, -+ "dwc_usb3_thd1", data); -+ -+ -+Same for dwc_workq_alloc(). Example: -+ -+ workq = dwc_workq_alloc(&usb3_dev->osdep.wkqctx, "dwc_usb3_wkq1"); -+ -+ -+Same for dwc_task_alloc(). Example: -+ -+ task = dwc_task_alloc(&usb3_dev->os_dep.tskctx, "dwc_usb3_tsk1", -+ cb_func, cb_data); -+ -+ -+In addition to the context pointer additions, a few core functions have had -+other changes made to their parameters: -+ -+The 'flags' parameter to dwc_spinlock_irqsave() and dwc_spinunlock_irqrestore() -+has been changed from a uint64_t to a dwc_irqflags_t. -+ -+dwc_thread_should_stop() now takes a 'dwc_thread_t *' parameter, because the -+FreeBSD equivalent of that function requires it. -+ -+And, in addition to the context pointer, dwc_task_alloc() also adds a -+'char *name' parameter, to be consistent with dwc_thread_run() and -+dwc_workq_alloc(), and because the FreeBSD equivalent of that function -+requires a unique name. -+ -+ -+Here is a complete list of the core functions that now take a pointer to a -+context as their first parameter: -+ -+ dwc_read_reg32 -+ dwc_read_reg64 -+ dwc_write_reg32 -+ dwc_write_reg64 -+ dwc_modify_reg32 -+ dwc_modify_reg64 -+ dwc_alloc -+ dwc_alloc_atomic -+ dwc_strdup -+ dwc_free -+ dwc_dma_alloc -+ dwc_dma_free -+ dwc_mutex_alloc -+ dwc_mutex_free -+ dwc_spinlock_alloc -+ dwc_spinlock_free -+ dwc_timer_alloc -+ dwc_waitq_alloc -+ dwc_thread_run -+ dwc_workq_alloc -+ dwc_task_alloc Also adds a 'char *name' as its 2nd parameter -+ -+And here are the core functions that have other changes to their parameters: -+ -+ dwc_spinlock_irqsave 'flags' param is now a 'dwc_irqflags_t *' -+ dwc_spinunlock_irqrestore 'flags' param is now a 'dwc_irqflags_t' -+ dwc_thread_should_stop Adds a 'dwc_thread_t *' parameter -+ -+ -+ -+The changes to the core functions also require some of the other library -+functions to change: -+ -+ dwc_cc_if_alloc() and dwc_cc_if_free() now take a 'void *memctx' -+ (for memory allocation) as the 1st param and a 'void *mtxctx' -+ (for mutex allocation) as the 2nd param. -+ -+ dwc_cc_clear(), dwc_cc_add(), dwc_cc_change(), dwc_cc_remove(), -+ dwc_cc_data_for_save(), and dwc_cc_restore_from_data() now take a -+ 'void *memctx' as the 1st param. -+ -+ dwc_dh_modpow(), dwc_dh_pk(), and dwc_dh_derive_keys() now take a -+ 'void *memctx' as the 1st param. -+ -+ dwc_modpow() now takes a 'void *memctx' as the 1st param. -+ -+ dwc_alloc_notification_manager() now takes a 'void *memctx' as the -+ 1st param and a 'void *wkqctx' (for work queue allocation) as the 2nd -+ param, and also now returns an integer value that is non-zero if -+ allocation of its data structures or work queue fails. -+ -+ dwc_register_notifier() now takes a 'void *memctx' as the 1st param. -+ -+ dwc_memory_debug_start() now takes a 'void *mem_ctx' as the first -+ param, and also now returns an integer value that is non-zero if -+ allocation of its data structures fails. -+ -+ -+ -+Other miscellaneous changes: -+ -+The DEBUG_MEMORY and DEBUG_REGS #define's have been renamed to -+DWC_DEBUG_MEMORY and DWC_DEBUG_REGS. -+ -+The following #define's have been added to allow selectively compiling library -+features: -+ -+ DWC_CCLIB -+ DWC_CRYPTOLIB -+ DWC_NOTIFYLIB -+ DWC_UTFLIB -+ -+A DWC_LIBMODULE #define has also been added. If this is not defined, then the -+module code in dwc_common_linux.c is not compiled in. This allows linking the -+library code directly into a driver module, instead of as a standalone module. -diff --git a/drivers/usb/host/dwc_common_port/doc/doxygen.cfg b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg -new file mode 100644 -index 0000000000000000000000000000000000000000..89aa887af29dfc3a71580acec4f10dc7cf00185d ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg -@@ -0,0 +1,270 @@ -+# Doxyfile 1.4.5 -+ -+#--------------------------------------------------------------------------- -+# Project related configuration options -+#--------------------------------------------------------------------------- -+PROJECT_NAME = "Synopsys DWC Portability and Common Library for UWB" -+PROJECT_NUMBER = -+OUTPUT_DIRECTORY = doc -+CREATE_SUBDIRS = NO -+OUTPUT_LANGUAGE = English -+BRIEF_MEMBER_DESC = YES -+REPEAT_BRIEF = YES -+ABBREVIATE_BRIEF = "The $name class" \ -+ "The $name widget" \ -+ "The $name file" \ -+ is \ -+ provides \ -+ specifies \ -+ contains \ -+ represents \ -+ a \ -+ an \ -+ the -+ALWAYS_DETAILED_SEC = YES -+INLINE_INHERITED_MEMB = NO -+FULL_PATH_NAMES = NO -+STRIP_FROM_PATH = .. -+STRIP_FROM_INC_PATH = -+SHORT_NAMES = NO -+JAVADOC_AUTOBRIEF = YES -+MULTILINE_CPP_IS_BRIEF = NO -+DETAILS_AT_TOP = YES -+INHERIT_DOCS = YES -+SEPARATE_MEMBER_PAGES = NO -+TAB_SIZE = 8 -+ALIASES = -+OPTIMIZE_OUTPUT_FOR_C = YES -+OPTIMIZE_OUTPUT_JAVA = NO -+BUILTIN_STL_SUPPORT = NO -+DISTRIBUTE_GROUP_DOC = NO -+SUBGROUPING = NO -+#--------------------------------------------------------------------------- -+# Build related configuration options -+#--------------------------------------------------------------------------- -+EXTRACT_ALL = NO -+EXTRACT_PRIVATE = NO -+EXTRACT_STATIC = YES -+EXTRACT_LOCAL_CLASSES = NO -+EXTRACT_LOCAL_METHODS = NO -+HIDE_UNDOC_MEMBERS = NO -+HIDE_UNDOC_CLASSES = NO -+HIDE_FRIEND_COMPOUNDS = NO -+HIDE_IN_BODY_DOCS = NO -+INTERNAL_DOCS = NO -+CASE_SENSE_NAMES = YES -+HIDE_SCOPE_NAMES = NO -+SHOW_INCLUDE_FILES = NO -+INLINE_INFO = YES -+SORT_MEMBER_DOCS = NO -+SORT_BRIEF_DOCS = NO -+SORT_BY_SCOPE_NAME = NO -+GENERATE_TODOLIST = YES -+GENERATE_TESTLIST = YES -+GENERATE_BUGLIST = YES -+GENERATE_DEPRECATEDLIST= YES -+ENABLED_SECTIONS = -+MAX_INITIALIZER_LINES = 30 -+SHOW_USED_FILES = YES -+SHOW_DIRECTORIES = YES -+FILE_VERSION_FILTER = -+#--------------------------------------------------------------------------- -+# configuration options related to warning and progress messages -+#--------------------------------------------------------------------------- -+QUIET = YES -+WARNINGS = YES -+WARN_IF_UNDOCUMENTED = NO -+WARN_IF_DOC_ERROR = YES -+WARN_NO_PARAMDOC = YES -+WARN_FORMAT = "$file:$line: $text" -+WARN_LOGFILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the input files -+#--------------------------------------------------------------------------- -+INPUT = . -+FILE_PATTERNS = *.c \ -+ *.cc \ -+ *.cxx \ -+ *.cpp \ -+ *.c++ \ -+ *.d \ -+ *.java \ -+ *.ii \ -+ *.ixx \ -+ *.ipp \ -+ *.i++ \ -+ *.inl \ -+ *.h \ -+ *.hh \ -+ *.hxx \ -+ *.hpp \ -+ *.h++ \ -+ *.idl \ -+ *.odl \ -+ *.cs \ -+ *.php \ -+ *.php3 \ -+ *.inc \ -+ *.m \ -+ *.mm \ -+ *.dox \ -+ *.py \ -+ *.C \ -+ *.CC \ -+ *.C++ \ -+ *.II \ -+ *.I++ \ -+ *.H \ -+ *.HH \ -+ *.H++ \ -+ *.CS \ -+ *.PHP \ -+ *.PHP3 \ -+ *.M \ -+ *.MM \ -+ *.PY -+RECURSIVE = NO -+EXCLUDE = -+EXCLUDE_SYMLINKS = NO -+EXCLUDE_PATTERNS = -+EXAMPLE_PATH = -+EXAMPLE_PATTERNS = * -+EXAMPLE_RECURSIVE = NO -+IMAGE_PATH = -+INPUT_FILTER = -+FILTER_PATTERNS = -+FILTER_SOURCE_FILES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to source browsing -+#--------------------------------------------------------------------------- -+SOURCE_BROWSER = NO -+INLINE_SOURCES = NO -+STRIP_CODE_COMMENTS = YES -+REFERENCED_BY_RELATION = YES -+REFERENCES_RELATION = YES -+USE_HTAGS = NO -+VERBATIM_HEADERS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the alphabetical class index -+#--------------------------------------------------------------------------- -+ALPHABETICAL_INDEX = NO -+COLS_IN_ALPHA_INDEX = 5 -+IGNORE_PREFIX = -+#--------------------------------------------------------------------------- -+# configuration options related to the HTML output -+#--------------------------------------------------------------------------- -+GENERATE_HTML = YES -+HTML_OUTPUT = html -+HTML_FILE_EXTENSION = .html -+HTML_HEADER = -+HTML_FOOTER = -+HTML_STYLESHEET = -+HTML_ALIGN_MEMBERS = YES -+GENERATE_HTMLHELP = NO -+CHM_FILE = -+HHC_LOCATION = -+GENERATE_CHI = NO -+BINARY_TOC = NO -+TOC_EXPAND = NO -+DISABLE_INDEX = NO -+ENUM_VALUES_PER_LINE = 4 -+GENERATE_TREEVIEW = YES -+TREEVIEW_WIDTH = 250 -+#--------------------------------------------------------------------------- -+# configuration options related to the LaTeX output -+#--------------------------------------------------------------------------- -+GENERATE_LATEX = NO -+LATEX_OUTPUT = latex -+LATEX_CMD_NAME = latex -+MAKEINDEX_CMD_NAME = makeindex -+COMPACT_LATEX = NO -+PAPER_TYPE = a4wide -+EXTRA_PACKAGES = -+LATEX_HEADER = -+PDF_HYPERLINKS = NO -+USE_PDFLATEX = NO -+LATEX_BATCHMODE = NO -+LATEX_HIDE_INDICES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the RTF output -+#--------------------------------------------------------------------------- -+GENERATE_RTF = NO -+RTF_OUTPUT = rtf -+COMPACT_RTF = NO -+RTF_HYPERLINKS = NO -+RTF_STYLESHEET_FILE = -+RTF_EXTENSIONS_FILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the man page output -+#--------------------------------------------------------------------------- -+GENERATE_MAN = NO -+MAN_OUTPUT = man -+MAN_EXTENSION = .3 -+MAN_LINKS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the XML output -+#--------------------------------------------------------------------------- -+GENERATE_XML = NO -+XML_OUTPUT = xml -+XML_SCHEMA = -+XML_DTD = -+XML_PROGRAMLISTING = YES -+#--------------------------------------------------------------------------- -+# configuration options for the AutoGen Definitions output -+#--------------------------------------------------------------------------- -+GENERATE_AUTOGEN_DEF = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the Perl module output -+#--------------------------------------------------------------------------- -+GENERATE_PERLMOD = NO -+PERLMOD_LATEX = NO -+PERLMOD_PRETTY = YES -+PERLMOD_MAKEVAR_PREFIX = -+#--------------------------------------------------------------------------- -+# Configuration options related to the preprocessor -+#--------------------------------------------------------------------------- -+ENABLE_PREPROCESSING = YES -+MACRO_EXPANSION = NO -+EXPAND_ONLY_PREDEF = NO -+SEARCH_INCLUDES = YES -+INCLUDE_PATH = -+INCLUDE_FILE_PATTERNS = -+PREDEFINED = DEBUG DEBUG_MEMORY -+EXPAND_AS_DEFINED = -+SKIP_FUNCTION_MACROS = YES -+#--------------------------------------------------------------------------- -+# Configuration::additions related to external references -+#--------------------------------------------------------------------------- -+TAGFILES = -+GENERATE_TAGFILE = -+ALLEXTERNALS = NO -+EXTERNAL_GROUPS = YES -+PERL_PATH = /usr/bin/perl -+#--------------------------------------------------------------------------- -+# Configuration options related to the dot tool -+#--------------------------------------------------------------------------- -+CLASS_DIAGRAMS = YES -+HIDE_UNDOC_RELATIONS = YES -+HAVE_DOT = NO -+CLASS_GRAPH = YES -+COLLABORATION_GRAPH = YES -+GROUP_GRAPHS = YES -+UML_LOOK = NO -+TEMPLATE_RELATIONS = NO -+INCLUDE_GRAPH = NO -+INCLUDED_BY_GRAPH = YES -+CALL_GRAPH = NO -+GRAPHICAL_HIERARCHY = YES -+DIRECTORY_GRAPH = YES -+DOT_IMAGE_FORMAT = png -+DOT_PATH = -+DOTFILE_DIRS = -+MAX_DOT_GRAPH_DEPTH = 1000 -+DOT_TRANSPARENT = NO -+DOT_MULTI_TARGETS = NO -+GENERATE_LEGEND = YES -+DOT_CLEANUP = YES -+#--------------------------------------------------------------------------- -+# Configuration::additions related to the search engine -+#--------------------------------------------------------------------------- -+SEARCHENGINE = NO -diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.c b/drivers/usb/host/dwc_common_port/dwc_cc.c -new file mode 100644 -index 0000000000000000000000000000000000000000..5ec2ae28698c15d1c441d3104706b04e9f1dde27 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_cc.c -@@ -0,0 +1,532 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.c $ -+ * $Revision: #4 $ -+ * $Date: 2010/11/04 $ -+ * $Change: 1621692 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifdef DWC_CCLIB -+ -+#include "dwc_cc.h" -+ -+typedef struct dwc_cc -+{ -+ uint32_t uid; -+ uint8_t chid[16]; -+ uint8_t cdid[16]; -+ uint8_t ck[16]; -+ uint8_t *name; -+ uint8_t length; -+ DWC_CIRCLEQ_ENTRY(dwc_cc) list_entry; -+} dwc_cc_t; -+ -+DWC_CIRCLEQ_HEAD(context_list, dwc_cc); -+ -+/** The main structure for CC management. */ -+struct dwc_cc_if -+{ -+ dwc_mutex_t *mutex; -+ char *filename; -+ -+ unsigned is_host:1; -+ -+ dwc_notifier_t *notifier; -+ -+ struct context_list list; -+}; -+ -+#ifdef DEBUG -+static inline void dump_bytes(char *name, uint8_t *bytes, int len) -+{ -+ int i; -+ DWC_PRINTF("%s: ", name); -+ for (i=0; ilength = length; -+ cc->name = dwc_alloc(mem_ctx, length); -+ if (!cc->name) { -+ dwc_free(mem_ctx, cc); -+ return NULL; -+ } -+ -+ DWC_MEMCPY(cc->name, name, length); -+ } -+ -+ return cc; -+} -+ -+static void free_cc(void *mem_ctx, dwc_cc_t *cc) -+{ -+ if (cc->name) { -+ dwc_free(mem_ctx, cc->name); -+ } -+ dwc_free(mem_ctx, cc); -+} -+ -+static uint32_t next_uid(dwc_cc_if_t *cc_if) -+{ -+ uint32_t uid = 0; -+ dwc_cc_t *cc; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (cc->uid > uid) { -+ uid = cc->uid; -+ } -+ } -+ -+ if (uid == 0) { -+ uid = 255; -+ } -+ -+ return uid + 1; -+} -+ -+static dwc_cc_t *cc_find(dwc_cc_if_t *cc_if, uint32_t uid) -+{ -+ dwc_cc_t *cc; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (cc->uid == uid) { -+ return cc; -+ } -+ } -+ return NULL; -+} -+ -+static unsigned int cc_data_size(dwc_cc_if_t *cc_if) -+{ -+ unsigned int size = 0; -+ dwc_cc_t *cc; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ size += (48 + 1); -+ if (cc->name) { -+ size += cc->length; -+ } -+ } -+ return size; -+} -+ -+static uint32_t cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) -+{ -+ uint32_t uid = 0; -+ dwc_cc_t *cc; -+ -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (DWC_MEMCMP(cc->chid, chid, 16) == 0) { -+ uid = cc->uid; -+ break; -+ } -+ } -+ return uid; -+} -+static uint32_t cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) -+{ -+ uint32_t uid = 0; -+ dwc_cc_t *cc; -+ -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (DWC_MEMCMP(cc->cdid, cdid, 16) == 0) { -+ uid = cc->uid; -+ break; -+ } -+ } -+ return uid; -+} -+ -+/* Internal cc_add */ -+static int32_t cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) -+{ -+ dwc_cc_t *cc; -+ uint32_t uid; -+ -+ if (cc_if->is_host) { -+ uid = cc_match_cdid(cc_if, cdid); -+ } -+ else { -+ uid = cc_match_chid(cc_if, chid); -+ } -+ -+ if (uid) { -+ DWC_DEBUGC("Replacing previous connection context id=%d name=%p name_len=%d", uid, name, length); -+ cc = cc_find(cc_if, uid); -+ } -+ else { -+ cc = alloc_cc(mem_ctx, name, length); -+ cc->uid = next_uid(cc_if); -+ DWC_CIRCLEQ_INSERT_TAIL(&cc_if->list, cc, list_entry); -+ } -+ -+ DWC_MEMCPY(&(cc->chid[0]), chid, 16); -+ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); -+ DWC_MEMCPY(&(cc->ck[0]), ck, 16); -+ -+ DWC_DEBUGC("Added connection context id=%d name=%p name_len=%d", cc->uid, name, length); -+ dump_bytes("CHID", cc->chid, 16); -+ dump_bytes("CDID", cc->cdid, 16); -+ dump_bytes("CK", cc->ck, 16); -+ return cc->uid; -+} -+ -+/* Internal cc_clear */ -+static void cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) -+{ -+ while (!DWC_CIRCLEQ_EMPTY(&cc_if->list)) { -+ dwc_cc_t *cc = DWC_CIRCLEQ_FIRST(&cc_if->list); -+ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); -+ free_cc(mem_ctx, cc); -+ } -+} -+ -+dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, -+ dwc_notifier_t *notifier, unsigned is_host) -+{ -+ dwc_cc_if_t *cc_if = NULL; -+ -+ /* Allocate a common_cc_if structure */ -+ cc_if = dwc_alloc(mem_ctx, sizeof(dwc_cc_if_t)); -+ -+ if (!cc_if) -+ return NULL; -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+ DWC_MUTEX_ALLOC_LINUX_DEBUG(cc_if->mutex); -+#else -+ cc_if->mutex = dwc_mutex_alloc(mtx_ctx); -+#endif -+ if (!cc_if->mutex) { -+ dwc_free(mem_ctx, cc_if); -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INIT(&cc_if->list); -+ cc_if->is_host = is_host; -+ cc_if->notifier = notifier; -+ return cc_if; -+} -+ -+void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if) -+{ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+ DWC_MUTEX_FREE(cc_if->mutex); -+#else -+ dwc_mutex_free(mtx_ctx, cc_if->mutex); -+#endif -+ cc_clear(mem_ctx, cc_if); -+ dwc_free(mem_ctx, cc_if); -+} -+ -+static void cc_changed(dwc_cc_if_t *cc_if) -+{ -+ if (cc_if->notifier) { -+ dwc_notify(cc_if->notifier, DWC_CC_LIST_CHANGED_NOTIFICATION, cc_if); -+ } -+} -+ -+void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) -+{ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc_clear(mem_ctx, cc_if); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ cc_changed(cc_if); -+} -+ -+int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) -+{ -+ uint32_t uid; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ uid = cc_add(mem_ctx, cc_if, chid, cdid, ck, name, length); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ cc_changed(cc_if); -+ -+ return uid; -+} -+ -+void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) -+{ -+ dwc_cc_t* cc; -+ -+ DWC_DEBUGC("Change connection context %d", id); -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (!cc) { -+ DWC_ERROR("Uid %d not found in cc list\n", id); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return; -+ } -+ -+ if (chid) { -+ DWC_MEMCPY(&(cc->chid[0]), chid, 16); -+ } -+ if (cdid) { -+ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); -+ } -+ if (ck) { -+ DWC_MEMCPY(&(cc->ck[0]), ck, 16); -+ } -+ -+ if (name) { -+ if (cc->name) { -+ dwc_free(mem_ctx, cc->name); -+ } -+ cc->name = dwc_alloc(mem_ctx, length); -+ if (!cc->name) { -+ DWC_ERROR("Out of memory in dwc_cc_change()\n"); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return; -+ } -+ cc->length = length; -+ DWC_MEMCPY(cc->name, name, length); -+ } -+ -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ cc_changed(cc_if); -+ -+ DWC_DEBUGC("Changed connection context id=%d\n", id); -+ dump_bytes("New CHID", cc->chid, 16); -+ dump_bytes("New CDID", cc->cdid, 16); -+ dump_bytes("New CK", cc->ck, 16); -+} -+ -+void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id) -+{ -+ dwc_cc_t *cc; -+ -+ DWC_DEBUGC("Removing connection context %d", id); -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (!cc) { -+ DWC_ERROR("Uid %d not found in cc list\n", id); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return; -+ } -+ -+ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ free_cc(mem_ctx, cc); -+ -+ cc_changed(cc_if); -+} -+ -+uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, unsigned int *length) -+{ -+ uint8_t *buf, *x; -+ uint8_t zero = 0; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ *length = cc_data_size(cc_if); -+ if (!(*length)) { -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return NULL; -+ } -+ -+ DWC_DEBUGC("Creating data for saving (length=%d)", *length); -+ -+ buf = dwc_alloc(mem_ctx, *length); -+ if (!buf) { -+ *length = 0; -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return NULL; -+ } -+ -+ x = buf; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ DWC_MEMCPY(x, cc->chid, 16); -+ x += 16; -+ DWC_MEMCPY(x, cc->cdid, 16); -+ x += 16; -+ DWC_MEMCPY(x, cc->ck, 16); -+ x += 16; -+ if (cc->name) { -+ DWC_MEMCPY(x, &cc->length, 1); -+ x += 1; -+ DWC_MEMCPY(x, cc->name, cc->length); -+ x += cc->length; -+ } -+ else { -+ DWC_MEMCPY(x, &zero, 1); -+ x += 1; -+ } -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return buf; -+} -+ -+void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *data, uint32_t length) -+{ -+ uint8_t name_length; -+ uint8_t *name; -+ uint8_t *chid; -+ uint8_t *cdid; -+ uint8_t *ck; -+ uint32_t i = 0; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc_clear(mem_ctx, cc_if); -+ -+ while (i < length) { -+ chid = &data[i]; -+ i += 16; -+ cdid = &data[i]; -+ i += 16; -+ ck = &data[i]; -+ i += 16; -+ -+ name_length = data[i]; -+ i ++; -+ -+ if (name_length) { -+ name = &data[i]; -+ i += name_length; -+ } -+ else { -+ name = NULL; -+ } -+ -+ /* check to see if we haven't overflown the buffer */ -+ if (i > length) { -+ DWC_ERROR("Data format error while attempting to load CCs " -+ "(nlen=%d, iter=%d, buflen=%d).\n", name_length, i, length); -+ break; -+ } -+ -+ cc_add(mem_ctx, cc_if, chid, cdid, ck, name, name_length); -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ cc_changed(cc_if); -+} -+ -+uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) -+{ -+ uint32_t uid = 0; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ uid = cc_match_chid(cc_if, chid); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return uid; -+} -+uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) -+{ -+ uint32_t uid = 0; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ uid = cc_match_cdid(cc_if, cdid); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return uid; -+} -+ -+uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id) -+{ -+ uint8_t *ck = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ ck = cc->ck; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return ck; -+ -+} -+ -+uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id) -+{ -+ uint8_t *retval = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ retval = cc->chid; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return retval; -+} -+ -+uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id) -+{ -+ uint8_t *retval = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ retval = cc->cdid; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return retval; -+} -+ -+uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length) -+{ -+ uint8_t *retval = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ *length = 0; -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ *length = cc->length; -+ retval = cc->name; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return retval; -+} -+ -+#endif /* DWC_CCLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.h b/drivers/usb/host/dwc_common_port/dwc_cc.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f86e6f21792b9961bda7d569f4d35f7076947546 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_cc.h -@@ -0,0 +1,224 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.h $ -+ * $Revision: #4 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifndef _DWC_CC_H_ -+#define _DWC_CC_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** @file -+ * -+ * This file defines the Context Context library. -+ * -+ * The main data structure is dwc_cc_if_t which is returned by either the -+ * dwc_cc_if_alloc function or returned by the module to the user via a provided -+ * function. The data structure is opaque and should only be manipulated via the -+ * functions provied in this API. -+ * -+ * It manages a list of connection contexts and operations can be performed to -+ * add, remove, query, search, and change, those contexts. Additionally, -+ * a dwc_notifier_t object can be requested from the manager so that -+ * the user can be notified whenever the context list has changed. -+ */ -+ -+#include "dwc_os.h" -+#include "dwc_list.h" -+#include "dwc_notifier.h" -+ -+ -+/* Notifications */ -+#define DWC_CC_LIST_CHANGED_NOTIFICATION "DWC_CC_LIST_CHANGED_NOTIFICATION" -+ -+struct dwc_cc_if; -+typedef struct dwc_cc_if dwc_cc_if_t; -+ -+ -+/** @name Connection Context Operations */ -+/** @{ */ -+ -+/** This function allocates memory for a dwc_cc_if_t structure, initializes -+ * fields to default values, and returns a pointer to the structure or NULL on -+ * error. */ -+extern dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, -+ dwc_notifier_t *notifier, unsigned is_host); -+ -+/** Frees the memory for the specified CC structure allocated from -+ * dwc_cc_if_alloc(). */ -+extern void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if); -+ -+/** Removes all contexts from the connection context list */ -+extern void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if); -+ -+/** Adds a connection context (CHID, CK, CDID, Name) to the connection context list. -+ * If a CHID already exists, the CK and name are overwritten. Statistics are -+ * not overwritten. -+ * -+ * @param cc_if The cc_if structure. -+ * @param chid A pointer to the 16-byte CHID. This value will be copied. -+ * @param ck A pointer to the 16-byte CK. This value will be copied. -+ * @param cdid A pointer to the 16-byte CDID. This value will be copied. -+ * @param name An optional host friendly name as defined in the association model -+ * spec. Must be a UTF16-LE unicode string. Can be NULL to indicated no name. -+ * @param length The length othe unicode string. -+ * @return A unique identifier used to refer to this context that is valid for -+ * as long as this context is still in the list. */ -+extern int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, -+ uint8_t length); -+ -+/** Changes the CHID, CK, CDID, or Name values of a connection context in the -+ * list, preserving any accumulated statistics. This would typically be called -+ * if the host decideds to change the context with a SET_CONNECTION request. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @param chid A pointer to the 16-byte CHID. This value will be copied. NULL -+ * indicates no change. -+ * @param cdid A pointer to the 16-byte CDID. This value will be copied. NULL -+ * indicates no change. -+ * @param ck A pointer to the 16-byte CK. This value will be copied. NULL -+ * indicates no change. -+ * @param name Host friendly name UTF16-LE. NULL indicates no change. -+ * @param length Length of name. */ -+extern void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, -+ uint8_t *chid, uint8_t *cdid, uint8_t *ck, -+ uint8_t *name, uint8_t length); -+ -+/** Remove the specified connection context. -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context to remove. */ -+extern void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id); -+ -+/** Get a binary block of data for the connection context list and attributes. -+ * This data can be used by the OS specific driver to save the connection -+ * context list into non-volatile memory. -+ * -+ * @param cc_if The cc_if structure. -+ * @param length Return the length of the data buffer. -+ * @return A pointer to the data buffer. The memory for this buffer should be -+ * freed with DWC_FREE() after use. */ -+extern uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, -+ unsigned int *length); -+ -+/** Restore the connection context list from the binary data that was previously -+ * returned from a call to dwc_cc_data_for_save. This can be used by the OS specific -+ * driver to load a connection context list from non-volatile memory. -+ * -+ * @param cc_if The cc_if structure. -+ * @param data The data bytes as returned from dwc_cc_data_for_save. -+ * @param length The length of the data. */ -+extern void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, -+ uint8_t *data, unsigned int length); -+ -+/** Find the connection context from the specified CHID. -+ * -+ * @param cc_if The cc_if structure. -+ * @param chid A pointer to the CHID data. -+ * @return A non-zero identifier of the connection context if the CHID matches. -+ * Otherwise returns 0. */ -+extern uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid); -+ -+/** Find the connection context from the specified CDID. -+ * -+ * @param cc_if The cc_if structure. -+ * @param cdid A pointer to the CDID data. -+ * @return A non-zero identifier of the connection context if the CHID matches. -+ * Otherwise returns 0. */ -+extern uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid); -+ -+/** Retrieve the CK from the specified connection context. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @return A pointer to the CK data. The memory does not need to be freed. */ -+extern uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id); -+ -+/** Retrieve the CHID from the specified connection context. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @return A pointer to the CHID data. The memory does not need to be freed. */ -+extern uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id); -+ -+/** Retrieve the CDID from the specified connection context. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @return A pointer to the CDID data. The memory does not need to be freed. */ -+extern uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id); -+ -+extern uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length); -+ -+/** Checks a buffer for non-zero. -+ * @param id A pointer to a 16 byte buffer. -+ * @return true if the 16 byte value is non-zero. */ -+static inline unsigned dwc_assoc_is_not_zero_id(uint8_t *id) { -+ int i; -+ for (i=0; i<16; i++) { -+ if (id[i]) return 1; -+ } -+ return 0; -+} -+ -+/** Checks a buffer for zero. -+ * @param id A pointer to a 16 byte buffer. -+ * @return true if the 16 byte value is zero. */ -+static inline unsigned dwc_assoc_is_zero_id(uint8_t *id) { -+ return !dwc_assoc_is_not_zero_id(id); -+} -+ -+/** Prints an ASCII representation for the 16-byte chid, cdid, or ck, into -+ * buffer. */ -+static inline int dwc_print_id_string(char *buffer, uint8_t *id) { -+ char *ptr = buffer; -+ int i; -+ for (i=0; i<16; i++) { -+ ptr += DWC_SPRINTF(ptr, "%02x", id[i]); -+ if (i < 15) { -+ ptr += DWC_SPRINTF(ptr, " "); -+ } -+ } -+ return ptr - buffer; -+} -+ -+/** @} */ -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_CC_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..6dd04b58f8f6c6d5ddad3b0b0148ff5dd936ac28 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c -@@ -0,0 +1,1308 @@ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+#ifdef DWC_CCLIB -+# include "dwc_cc.h" -+#endif -+ -+#ifdef DWC_CRYPTOLIB -+# include "dwc_modpow.h" -+# include "dwc_dh.h" -+# include "dwc_crypto.h" -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+# include "dwc_notifier.h" -+#endif -+ -+/* OS-Level Implementations */ -+ -+/* This is the FreeBSD 7.0 kernel implementation of the DWC platform library. */ -+ -+ -+/* MISC */ -+ -+void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) -+{ -+ return memset(dest, byte, size); -+} -+ -+void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) -+{ -+ return memcpy(dest, src, size); -+} -+ -+void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) -+{ -+ bcopy(src, dest, size); -+ return dest; -+} -+ -+int DWC_MEMCMP(void *m1, void *m2, uint32_t size) -+{ -+ return memcmp(m1, m2, size); -+} -+ -+int DWC_STRNCMP(void *s1, void *s2, uint32_t size) -+{ -+ return strncmp(s1, s2, size); -+} -+ -+int DWC_STRCMP(void *s1, void *s2) -+{ -+ return strcmp(s1, s2); -+} -+ -+int DWC_STRLEN(char const *str) -+{ -+ return strlen(str); -+} -+ -+char *DWC_STRCPY(char *to, char const *from) -+{ -+ return strcpy(to, from); -+} -+ -+char *DWC_STRDUP(char const *str) -+{ -+ int len = DWC_STRLEN(str) + 1; -+ char *new = DWC_ALLOC_ATOMIC(len); -+ -+ if (!new) { -+ return NULL; -+ } -+ -+ DWC_MEMCPY(new, str, len); -+ return new; -+} -+ -+int DWC_ATOI(char *str, int32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = strtol(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+int DWC_ATOUI(char *str, uint32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+ -+#ifdef DWC_UTFLIB -+/* From usbstring.c */ -+ -+int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+ -+#endif /* DWC_UTFLIB */ -+ -+ -+/* dwc_debug.h */ -+ -+dwc_bool_t DWC_IN_IRQ(void) -+{ -+// return in_irq(); -+ return 0; -+} -+ -+dwc_bool_t DWC_IN_BH(void) -+{ -+// return in_softirq(); -+ return 0; -+} -+ -+void DWC_VPRINTF(char *format, va_list args) -+{ -+ vprintf(format, args); -+} -+ -+int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) -+{ -+ return vsnprintf(str, size, format, args); -+} -+ -+void DWC_PRINTF(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+int DWC_SPRINTF(char *buffer, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsprintf(buffer, format, args); -+ va_end(args); -+ return retval; -+} -+ -+int DWC_SNPRINTF(char *buffer, int size, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsnprintf(buffer, size, format, args); -+ va_end(args); -+ return retval; -+} -+ -+void __DWC_WARN(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void __DWC_ERROR(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void DWC_EXCEPTION(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+// BUG_ON(1); ??? -+} -+ -+#ifdef DEBUG -+void __DWC_DEBUG(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+#endif -+ -+ -+/* dwc_mem.h */ -+ -+#if 0 -+dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, -+ uint32_t align, -+ uint32_t alloc) -+{ -+ struct dma_pool *pool = dma_pool_create("Pool", NULL, -+ size, align, alloc); -+ return (dwc_pool_t *)pool; -+} -+ -+void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) -+{ -+ dma_pool_destroy((struct dma_pool *)pool); -+} -+ -+void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); -+ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); -+} -+ -+void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); -+ memset(..); -+} -+ -+void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) -+{ -+ dma_pool_free(pool, vaddr, daddr); -+} -+#endif -+ -+static void dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) -+{ -+ if (error) -+ return; -+ *(bus_addr_t *)arg = segs[0].ds_addr; -+} -+ -+void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ int error; -+ -+ error = bus_dma_tag_create( -+#if __FreeBSD_version >= 700000 -+ bus_get_dma_tag(dma->dev), /* parent */ -+#else -+ NULL, /* parent */ -+#endif -+ 4, 0, /* alignment, bounds */ -+ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ -+ BUS_SPACE_MAXADDR, /* highaddr */ -+ NULL, NULL, /* filter, filterarg */ -+ size, /* maxsize */ -+ 1, /* nsegments */ -+ size, /* maxsegsize */ -+ 0, /* flags */ -+ NULL, /* lockfunc */ -+ NULL, /* lockarg */ -+ &dma->dma_tag); -+ if (error) { -+ device_printf(dma->dev, "%s: bus_dma_tag_create failed: %d\n", -+ __func__, error); -+ goto fail_0; -+ } -+ -+ error = bus_dmamem_alloc(dma->dma_tag, &dma->dma_vaddr, -+ BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &dma->dma_map); -+ if (error) { -+ device_printf(dma->dev, "%s: bus_dmamem_alloc(%ju) failed: %d\n", -+ __func__, (uintmax_t)size, error); -+ goto fail_1; -+ } -+ -+ dma->dma_paddr = 0; -+ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, size, -+ dmamap_cb, &dma->dma_paddr, BUS_DMA_NOWAIT); -+ if (error || dma->dma_paddr == 0) { -+ device_printf(dma->dev, "%s: bus_dmamap_load failed: %d\n", -+ __func__, error); -+ goto fail_2; -+ } -+ -+ *dma_addr = dma->dma_paddr; -+ return dma->dma_vaddr; -+ -+fail_2: -+ bus_dmamap_unload(dma->dma_tag, dma->dma_map); -+fail_1: -+ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); -+ bus_dma_tag_destroy(dma->dma_tag); -+fail_0: -+ dma->dma_map = NULL; -+ dma->dma_tag = NULL; -+ -+ return NULL; -+} -+ -+void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ -+ if (dma->dma_tag == NULL) -+ return; -+ if (dma->dma_map != NULL) { -+ bus_dmamap_sync(dma->dma_tag, dma->dma_map, -+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); -+ bus_dmamap_unload(dma->dma_tag, dma->dma_map); -+ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); -+ dma->dma_map = NULL; -+ } -+ -+ bus_dma_tag_destroy(dma->dma_tag); -+ dma->dma_tag = NULL; -+} -+ -+void *__DWC_ALLOC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); -+} -+ -+void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); -+} -+ -+void __DWC_FREE(void *mem_ctx, void *addr) -+{ -+ free(addr, M_DEVBUF); -+} -+ -+ -+#ifdef DWC_CRYPTOLIB -+/* dwc_crypto.h */ -+ -+void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) -+{ -+ get_random_bytes(buffer, length); -+} -+ -+int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) -+{ -+ struct crypto_blkcipher *tfm; -+ struct blkcipher_desc desc; -+ struct scatterlist sgd; -+ struct scatterlist sgs; -+ -+ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); -+ if (tfm == NULL) { -+ printk("failed to load transform for aes CBC\n"); -+ return -1; -+ } -+ -+ crypto_blkcipher_setkey(tfm, key, keylen); -+ crypto_blkcipher_set_iv(tfm, iv, 16); -+ -+ sg_init_one(&sgd, out, messagelen); -+ sg_init_one(&sgs, message, messagelen); -+ -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { -+ crypto_free_blkcipher(tfm); -+ DWC_ERROR("AES CBC encryption failed"); -+ return -1; -+ } -+ -+ crypto_free_blkcipher(tfm); -+ return 0; -+} -+ -+int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, len); -+ crypto_hash_digest(&desc, &sg, len, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, -+ uint8_t *key, uint32_t keylen, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, messagelen); -+ crypto_hash_setkey(tfm, key, keylen); -+ crypto_hash_digest(&desc, &sg, messagelen, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/* Byte Ordering Conversions */ -+ -+uint32_t DWC_CPU_TO_LE32(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_CPU_TO_BE32(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_LE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_BE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_LE16(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_BE16(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_LE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_BE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+ -+/* Registers */ -+ -+uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_4(io->iot, io->ioh, ior); -+} -+ -+#if 0 -+uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_8(io->iot, io->ioh, ior); -+} -+#endif -+ -+void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, value); -+} -+ -+#if 0 -+void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, value); -+} -+#endif -+ -+void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, -+ uint32_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, -+ (bus_space_read_4(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+ -+#if 0 -+void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, -+ uint64_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, -+ (bus_space_read_8(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+#endif -+ -+ -+/* Locking */ -+ -+dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) -+{ -+ struct mtx *sl = DWC_ALLOC(sizeof(*sl)); -+ -+ if (!sl) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ return NULL; -+ } -+ -+ mtx_init(sl, "dw3spn", NULL, MTX_SPIN); -+ return (dwc_spinlock_t *)sl; -+} -+ -+void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) -+{ -+ struct mtx *sl = (struct mtx *)lock; -+ -+ mtx_destroy(sl); -+ DWC_FREE(sl); -+} -+ -+void DWC_SPINLOCK(dwc_spinlock_t *lock) -+{ -+ mtx_lock_spin((struct mtx *)lock); // ??? -+} -+ -+void DWC_SPINUNLOCK(dwc_spinlock_t *lock) -+{ -+ mtx_unlock_spin((struct mtx *)lock); // ??? -+} -+ -+void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) -+{ -+ mtx_lock_spin((struct mtx *)lock); -+} -+ -+void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) -+{ -+ mtx_unlock_spin((struct mtx *)lock); -+} -+ -+dwc_mutex_t *DWC_MUTEX_ALLOC(void) -+{ -+ struct mtx *m; -+ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mtx)); -+ -+ if (!mutex) { -+ DWC_ERROR("Cannot allocate memory for mutex"); -+ return NULL; -+ } -+ -+ m = (struct mtx *)mutex; -+ mtx_init(m, "dw3mtx", NULL, MTX_DEF); -+ return mutex; -+} -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+#else -+void DWC_MUTEX_FREE(dwc_mutex_t *mutex) -+{ -+ mtx_destroy((struct mtx *)mutex); -+ DWC_FREE(mutex); -+} -+#endif -+ -+void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) -+{ -+ struct mtx *m = (struct mtx *)mutex; -+ -+ mtx_lock(m); -+} -+ -+int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) -+{ -+ struct mtx *m = (struct mtx *)mutex; -+ -+ return mtx_trylock(m); -+} -+ -+void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) -+{ -+ struct mtx *m = (struct mtx *)mutex; -+ -+ mtx_unlock(m); -+} -+ -+ -+/* Timing */ -+ -+void DWC_UDELAY(uint32_t usecs) -+{ -+ DELAY(usecs); -+} -+ -+void DWC_MDELAY(uint32_t msecs) -+{ -+ do { -+ DELAY(1000); -+ } while (--msecs); -+} -+ -+void DWC_MSLEEP(uint32_t msecs) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ pause("dw3slp", tvtohz(&tv)); -+} -+ -+uint32_t DWC_TIME(void) -+{ -+ struct timeval tv; -+ -+ microuptime(&tv); // or getmicrouptime? (less precise, but faster) -+ return tv.tv_sec * 1000 + tv.tv_usec / 1000; -+} -+ -+ -+/* Timers */ -+ -+struct dwc_timer { -+ struct callout t; -+ char *name; -+ dwc_spinlock_t *lock; -+ dwc_timer_callback_t cb; -+ void *data; -+}; -+ -+dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) -+{ -+ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (!t) { -+ DWC_ERROR("Cannot allocate memory for timer"); -+ return NULL; -+ } -+ -+ callout_init(&t->t, 1); -+ -+ t->name = DWC_STRDUP(name); -+ if (!t->name) { -+ DWC_ERROR("Cannot allocate memory for timer->name"); -+ goto no_name; -+ } -+ -+ t->lock = DWC_SPINLOCK_ALLOC(); -+ if (!t->lock) { -+ DWC_ERROR("Cannot allocate memory for lock"); -+ goto no_lock; -+ } -+ -+ t->cb = cb; -+ t->data = data; -+ -+ return t; -+ -+ no_lock: -+ DWC_FREE(t->name); -+ no_name: -+ DWC_FREE(t); -+ -+ return NULL; -+} -+ -+void DWC_TIMER_FREE(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+ DWC_SPINLOCK_FREE(timer->lock); -+ DWC_FREE(timer->name); -+ DWC_FREE(timer); -+} -+ -+void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); -+} -+ -+void DWC_TIMER_CANCEL(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+} -+ -+ -+/* Wait Queues */ -+ -+struct dwc_waitq { -+ struct mtx lock; -+ int abort; -+}; -+ -+dwc_waitq_t *DWC_WAITQ_ALLOC(void) -+{ -+ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ return NULL; -+ } -+ -+ mtx_init(&wq->lock, "dw3wtq", NULL, MTX_DEF); -+ wq->abort = 0; -+ -+ return wq; -+} -+ -+void DWC_WAITQ_FREE(dwc_waitq_t *wq) -+{ -+ mtx_destroy(&wq->lock); -+ DWC_FREE(wq); -+} -+ -+int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) -+{ -+// intrmask_t ipl; -+ int result = 0; -+ -+ mtx_lock(&wq->lock); -+// ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+// splx(ipl); -+ result = msleep(wq, &wq->lock, PCATCH, "dw3wat", 0); // infinite timeout -+// ipl = splbio(); -+ } -+ -+ if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ -+ } else if (result == EINTR) { // signaled - interrupt -+ result = -DWC_E_ABORT; -+ -+ } else if (wq->abort) { -+ result = -DWC_E_ABORT; -+ -+ } else { -+ result = 0; -+ } -+ -+ wq->abort = 0; -+// splx(ipl); -+ mtx_unlock(&wq->lock); -+ return result; -+} -+ -+int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs) -+{ -+ struct timeval tv, tv1, tv2; -+// intrmask_t ipl; -+ int result = 0; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ -+ mtx_lock(&wq->lock); -+// ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+// splx(ipl); -+ getmicrouptime(&tv1); -+ result = msleep(wq, &wq->lock, PCATCH, "dw3wto", tvtohz(&tv)); -+ getmicrouptime(&tv2); -+// ipl = splbio(); -+ } -+ -+ if (result == 0) { // awoken -+ if (wq->abort) { -+ result = -DWC_E_ABORT; -+ } else { -+ tv2.tv_usec -= tv1.tv_usec; -+ if (tv2.tv_usec < 0) { -+ tv2.tv_usec += 1000000; -+ tv2.tv_sec--; -+ } -+ -+ tv2.tv_sec -= tv1.tv_sec; -+ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; -+ result = msecs - result; -+ if (result <= 0) -+ result = 1; -+ } -+ } else if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ -+ } else if (result == EINTR) { // signaled - interrupt -+ result = -DWC_E_ABORT; -+ -+ } else { // timed out -+ result = -DWC_E_TIMEOUT; -+ } -+ -+ wq->abort = 0; -+// splx(ipl); -+ mtx_unlock(&wq->lock); -+ return result; -+} -+ -+void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) -+{ -+ wakeup(wq); -+} -+ -+void DWC_WAITQ_ABORT(dwc_waitq_t *wq) -+{ -+// intrmask_t ipl; -+ -+ mtx_lock(&wq->lock); -+// ipl = splbio(); -+ wq->abort = 1; -+ wakeup(wq); -+// splx(ipl); -+ mtx_unlock(&wq->lock); -+} -+ -+ -+/* Threading */ -+ -+struct dwc_thread { -+ struct proc *proc; -+ int abort; -+}; -+ -+dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) -+{ -+ int retval; -+ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); -+ -+ if (!thread) { -+ return NULL; -+ } -+ -+ thread->abort = 0; -+ retval = kthread_create((void (*)(void *))func, data, &thread->proc, -+ RFPROC | RFNOWAIT, 0, "%s", name); -+ if (retval) { -+ DWC_FREE(thread); -+ return NULL; -+ } -+ -+ return thread; -+} -+ -+int DWC_THREAD_STOP(dwc_thread_t *thread) -+{ -+ int retval; -+ -+ thread->abort = 1; -+ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); -+ -+ if (retval == 0) { -+ /* DWC_THREAD_EXIT() will free the thread struct */ -+ return 0; -+ } -+ -+ /* NOTE: We leak the thread struct if thread doesn't die */ -+ -+ if (retval == EWOULDBLOCK) { -+ return -DWC_E_TIMEOUT; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) -+{ -+ return thread->abort; -+} -+ -+void DWC_THREAD_EXIT(dwc_thread_t *thread) -+{ -+ wakeup(&thread->abort); -+ DWC_FREE(thread); -+ kthread_exit(0); -+} -+ -+ -+/* tasklets -+ - Runs in interrupt context (cannot sleep) -+ - Each tasklet runs on a single CPU [ How can we ensure this on FreeBSD? Does it matter? ] -+ - Different tasklets can be running simultaneously on different CPUs [ shouldn't matter ] -+ */ -+struct dwc_tasklet { -+ struct task t; -+ dwc_tasklet_callback_t cb; -+ void *data; -+}; -+ -+static void tasklet_callback(void *data, int pending) // what to do with pending ??? -+{ -+ dwc_tasklet_t *task = (dwc_tasklet_t *)data; -+ -+ task->cb(task->data); -+} -+ -+dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) -+{ -+ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); -+ -+ if (task) { -+ task->cb = cb; -+ task->data = data; -+ TASK_INIT(&task->t, 0, tasklet_callback, task); -+ } else { -+ DWC_ERROR("Cannot allocate memory for tasklet"); -+ } -+ -+ return task; -+} -+ -+void DWC_TASK_FREE(dwc_tasklet_t *task) -+{ -+ taskqueue_drain(taskqueue_fast, &task->t); // ??? -+ DWC_FREE(task); -+} -+ -+void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) -+{ -+ /* Uses predefined system queue */ -+ taskqueue_enqueue_fast(taskqueue_fast, &task->t); -+} -+ -+ -+/* workqueues -+ - Runs in process context (can sleep) -+ */ -+typedef struct work_container { -+ dwc_work_callback_t cb; -+ void *data; -+ dwc_workq_t *wq; -+ char *name; -+ int hz; -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_ENTRY(work_container) entry; -+#endif -+ struct task task; -+} work_container_t; -+ -+#ifdef DEBUG -+DWC_CIRCLEQ_HEAD(work_container_queue, work_container); -+#endif -+ -+struct dwc_workq { -+ struct taskqueue *taskq; -+ dwc_spinlock_t *lock; -+ dwc_waitq_t *waitq; -+ int pending; -+ -+#ifdef DEBUG -+ struct work_container_queue entries; -+#endif -+}; -+ -+static void do_work(void *data, int pending) // what to do with pending ??? -+{ -+ work_container_t *container = (work_container_t *)data; -+ dwc_workq_t *wq = container->wq; -+ dwc_irqflags_t flags; -+ -+ if (container->hz) { -+ pause("dw3wrk", container->hz); -+ } -+ -+ container->cb(container->data); -+ DWC_DEBUG("Work done: %s, container=%p", container->name, container); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); -+#endif -+ if (container->name) -+ DWC_FREE(container->name); -+ DWC_FREE(container); -+ wq->pending--; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+} -+ -+static int work_done(void *data) -+{ -+ dwc_workq_t *workq = (dwc_workq_t *)data; -+ -+ return workq->pending == 0; -+} -+ -+int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) -+{ -+ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); -+} -+ -+dwc_workq_t *DWC_WORKQ_ALLOC(char *name) -+{ -+ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for workqueue"); -+ return NULL; -+ } -+ -+ wq->taskq = taskqueue_create(name, M_NOWAIT, taskqueue_thread_enqueue, &wq->taskq); -+ if (!wq->taskq) { -+ DWC_ERROR("Cannot allocate memory for taskqueue"); -+ goto no_taskq; -+ } -+ -+ wq->pending = 0; -+ -+ wq->lock = DWC_SPINLOCK_ALLOC(); -+ if (!wq->lock) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ goto no_lock; -+ } -+ -+ wq->waitq = DWC_WAITQ_ALLOC(); -+ if (!wq->waitq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ goto no_waitq; -+ } -+ -+ taskqueue_start_threads(&wq->taskq, 1, PWAIT, "%s taskq", "dw3tsk"); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INIT(&wq->entries); -+#endif -+ return wq; -+ -+ no_waitq: -+ DWC_SPINLOCK_FREE(wq->lock); -+ no_lock: -+ taskqueue_free(wq->taskq); -+ no_taskq: -+ DWC_FREE(wq); -+ -+ return NULL; -+} -+ -+void DWC_WORKQ_FREE(dwc_workq_t *wq) -+{ -+#ifdef DEBUG -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ -+ if (wq->pending != 0) { -+ struct work_container *container; -+ -+ DWC_ERROR("Destroying work queue with pending work"); -+ -+ DWC_CIRCLEQ_FOREACH(container, &wq->entries, entry) { -+ DWC_ERROR("Work %s still pending", container->name); -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+#endif -+ DWC_WAITQ_FREE(wq->waitq); -+ DWC_SPINLOCK_FREE(wq->lock); -+ taskqueue_free(wq->taskq); -+ DWC_FREE(wq); -+} -+ -+void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, -+ char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ container->hz = 0; -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ -+ TASK_INIT(&container->task, 0, do_work, container); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ taskqueue_enqueue_fast(wq->taskq, &container->task); -+} -+ -+void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ struct timeval tv; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ container->hz = tvtohz(&tv); -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ -+ TASK_INIT(&container->task, 0, do_work, container); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ taskqueue_enqueue_fast(wq->taskq, &container->task); -+} -+ -+int DWC_WORKQ_PENDING(dwc_workq_t *wq) -+{ -+ return wq->pending; -+} -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_linux.c b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -new file mode 100644 -index 0000000000000000000000000000000000000000..0d641e6da24beeb07109e23847d1d6e81dc7d4ea ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -@@ -0,0 +1,1418 @@ -+#include -+#include -+#include -+#include -+ -+#ifdef DWC_CCLIB -+# include "dwc_cc.h" -+#endif -+ -+#ifdef DWC_CRYPTOLIB -+# include "dwc_modpow.h" -+# include "dwc_dh.h" -+# include "dwc_crypto.h" -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+# include "dwc_notifier.h" -+#endif -+ -+/* OS-Level Implementations */ -+ -+/* This is the Linux kernel implementation of the DWC platform library. */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -+# include -+#else -+# include -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+ -+/* MISC */ -+ -+void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) -+{ -+ return memset(dest, byte, size); -+} -+ -+void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) -+{ -+ return memcpy(dest, src, size); -+} -+ -+void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) -+{ -+ return memmove(dest, src, size); -+} -+ -+int DWC_MEMCMP(void *m1, void *m2, uint32_t size) -+{ -+ return memcmp(m1, m2, size); -+} -+ -+int DWC_STRNCMP(void *s1, void *s2, uint32_t size) -+{ -+ return strncmp(s1, s2, size); -+} -+ -+int DWC_STRCMP(void *s1, void *s2) -+{ -+ return strcmp(s1, s2); -+} -+ -+int DWC_STRLEN(char const *str) -+{ -+ return strlen(str); -+} -+ -+char *DWC_STRCPY(char *to, char const *from) -+{ -+ return strcpy(to, from); -+} -+ -+char *DWC_STRDUP(char const *str) -+{ -+ int len = DWC_STRLEN(str) + 1; -+ char *new = DWC_ALLOC_ATOMIC(len); -+ -+ if (!new) { -+ return NULL; -+ } -+ -+ DWC_MEMCPY(new, str, len); -+ return new; -+} -+ -+int DWC_ATOI(const char *str, int32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = simple_strtol(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+int DWC_ATOUI(const char *str, uint32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = simple_strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+ -+#ifdef DWC_UTFLIB -+/* From usbstring.c */ -+ -+int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+#endif /* DWC_UTFLIB */ -+ -+ -+/* dwc_debug.h */ -+ -+dwc_bool_t DWC_IN_IRQ(void) -+{ -+ return in_irq(); -+} -+ -+dwc_bool_t DWC_IN_BH(void) -+{ -+ return in_softirq(); -+} -+ -+void DWC_VPRINTF(char *format, va_list args) -+{ -+ vprintk(format, args); -+} -+ -+int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) -+{ -+ return vsnprintf(str, size, format, args); -+} -+ -+void DWC_PRINTF(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+int DWC_SPRINTF(char *buffer, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsprintf(buffer, format, args); -+ va_end(args); -+ return retval; -+} -+ -+int DWC_SNPRINTF(char *buffer, int size, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsnprintf(buffer, size, format, args); -+ va_end(args); -+ return retval; -+} -+ -+void __DWC_WARN(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_WARNING); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void __DWC_ERROR(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_ERR); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void DWC_EXCEPTION(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_ERR); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+ BUG_ON(1); -+} -+ -+#ifdef DEBUG -+void __DWC_DEBUG(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_DEBUG); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+#endif -+ -+ -+/* dwc_mem.h */ -+ -+#if 0 -+dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, -+ uint32_t align, -+ uint32_t alloc) -+{ -+ struct dma_pool *pool = dma_pool_create("Pool", NULL, -+ size, align, alloc); -+ return (dwc_pool_t *)pool; -+} -+ -+void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) -+{ -+ dma_pool_destroy((struct dma_pool *)pool); -+} -+ -+void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); -+} -+ -+void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); -+ memset(..); -+} -+ -+void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) -+{ -+ dma_pool_free(pool, vaddr, daddr); -+} -+#endif -+ -+void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ return dma_zalloc_coherent(dma_ctx, size, dma_addr, GFP_KERNEL | GFP_DMA32); -+} -+ -+void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ return dma_zalloc_coherent(dma_ctx, size, dma_addr, GFP_ATOMIC); -+} -+ -+void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) -+{ -+ dma_free_coherent(dma_ctx, size, virt_addr, dma_addr); -+} -+ -+void *__DWC_ALLOC(void *mem_ctx, uint32_t size) -+{ -+ return kzalloc(size, GFP_KERNEL); -+} -+ -+void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) -+{ -+ return kzalloc(size, GFP_ATOMIC); -+} -+ -+void __DWC_FREE(void *mem_ctx, void *addr) -+{ -+ kfree(addr); -+} -+ -+ -+#ifdef DWC_CRYPTOLIB -+/* dwc_crypto.h */ -+ -+void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) -+{ -+ get_random_bytes(buffer, length); -+} -+ -+int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) -+{ -+ struct crypto_blkcipher *tfm; -+ struct blkcipher_desc desc; -+ struct scatterlist sgd; -+ struct scatterlist sgs; -+ -+ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); -+ if (tfm == NULL) { -+ printk("failed to load transform for aes CBC\n"); -+ return -1; -+ } -+ -+ crypto_blkcipher_setkey(tfm, key, keylen); -+ crypto_blkcipher_set_iv(tfm, iv, 16); -+ -+ sg_init_one(&sgd, out, messagelen); -+ sg_init_one(&sgs, message, messagelen); -+ -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { -+ crypto_free_blkcipher(tfm); -+ DWC_ERROR("AES CBC encryption failed"); -+ return -1; -+ } -+ -+ crypto_free_blkcipher(tfm); -+ return 0; -+} -+ -+int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for sha256: %ld\n", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, len); -+ crypto_hash_digest(&desc, &sg, len, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, -+ uint8_t *key, uint32_t keylen, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for hmac(sha256): %ld\n", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, messagelen); -+ crypto_hash_setkey(tfm, key, keylen); -+ crypto_hash_digest(&desc, &sg, messagelen, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/* Byte Ordering Conversions */ -+ -+uint32_t DWC_CPU_TO_LE32(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_CPU_TO_BE32(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_LE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_BE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_LE16(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_BE16(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_LE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_BE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+ -+/* Registers */ -+ -+uint32_t DWC_READ_REG32(uint32_t volatile *reg) -+{ -+ return readl(reg); -+} -+ -+#if 0 -+uint64_t DWC_READ_REG64(uint64_t volatile *reg) -+{ -+} -+#endif -+ -+void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value) -+{ -+ writel(value, reg); -+} -+ -+#if 0 -+void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value) -+{ -+} -+#endif -+ -+void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask) -+{ -+ writel((readl(reg) & ~clear_mask) | set_mask, reg); -+} -+ -+#if 0 -+void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask) -+{ -+} -+#endif -+ -+ -+/* Locking */ -+ -+dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) -+{ -+ spinlock_t *sl = (spinlock_t *)1; -+ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ sl = DWC_ALLOC(sizeof(*sl)); -+ if (!sl) { -+ DWC_ERROR("Cannot allocate memory for spinlock\n"); -+ return NULL; -+ } -+ -+ spin_lock_init(sl); -+#endif -+ return (dwc_spinlock_t *)sl; -+} -+ -+void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ DWC_FREE(lock); -+#endif -+} -+ -+void DWC_SPINLOCK(dwc_spinlock_t *lock) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_lock((spinlock_t *)lock); -+#endif -+} -+ -+void DWC_SPINUNLOCK(dwc_spinlock_t *lock) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_unlock((spinlock_t *)lock); -+#endif -+} -+ -+void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) -+{ -+ dwc_irqflags_t f; -+ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_lock_irqsave((spinlock_t *)lock, f); -+#else -+ local_irq_save(f); -+#endif -+ *flags = f; -+} -+ -+void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_unlock_irqrestore((spinlock_t *)lock, flags); -+#else -+ local_irq_restore(flags); -+#endif -+} -+ -+dwc_mutex_t *DWC_MUTEX_ALLOC(void) -+{ -+ struct mutex *m; -+ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); -+ -+ if (!mutex) { -+ DWC_ERROR("Cannot allocate memory for mutex\n"); -+ return NULL; -+ } -+ -+ m = (struct mutex *)mutex; -+ mutex_init(m); -+ return mutex; -+} -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+#else -+void DWC_MUTEX_FREE(dwc_mutex_t *mutex) -+{ -+ mutex_destroy((struct mutex *)mutex); -+ DWC_FREE(mutex); -+} -+#endif -+ -+void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) -+{ -+ struct mutex *m = (struct mutex *)mutex; -+ mutex_lock(m); -+} -+ -+int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) -+{ -+ struct mutex *m = (struct mutex *)mutex; -+ return mutex_trylock(m); -+} -+ -+void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) -+{ -+ struct mutex *m = (struct mutex *)mutex; -+ mutex_unlock(m); -+} -+ -+ -+/* Timing */ -+ -+void DWC_UDELAY(uint32_t usecs) -+{ -+ udelay(usecs); -+} -+ -+void DWC_MDELAY(uint32_t msecs) -+{ -+ mdelay(msecs); -+} -+ -+void DWC_MSLEEP(uint32_t msecs) -+{ -+ msleep(msecs); -+} -+ -+uint32_t DWC_TIME(void) -+{ -+ return jiffies_to_msecs(jiffies); -+} -+ -+ -+/* Timers */ -+ -+struct dwc_timer { -+ struct timer_list *t; -+ char *name; -+ dwc_timer_callback_t cb; -+ void *data; -+ uint8_t scheduled; -+ dwc_spinlock_t *lock; -+}; -+ -+static void timer_callback(unsigned long data) -+{ -+ dwc_timer_t *timer = (dwc_timer_t *)data; -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); -+ timer->scheduled = 0; -+ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); -+ DWC_DEBUGC("Timer %s callback", timer->name); -+ timer->cb(timer->data); -+} -+ -+dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) -+{ -+ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (!t) { -+ DWC_ERROR("Cannot allocate memory for timer"); -+ return NULL; -+ } -+ -+ t->t = DWC_ALLOC(sizeof(*t->t)); -+ if (!t->t) { -+ DWC_ERROR("Cannot allocate memory for timer->t"); -+ goto no_timer; -+ } -+ -+ t->name = DWC_STRDUP(name); -+ if (!t->name) { -+ DWC_ERROR("Cannot allocate memory for timer->name"); -+ goto no_name; -+ } -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(t->lock); -+#else -+ t->lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ if (!t->lock) { -+ DWC_ERROR("Cannot allocate memory for lock"); -+ goto no_lock; -+ } -+ -+ t->scheduled = 0; -+ t->t->expires = jiffies; -+ setup_timer(t->t, timer_callback, (unsigned long)t); -+ -+ t->cb = cb; -+ t->data = data; -+ -+ return t; -+ -+ no_lock: -+ DWC_FREE(t->name); -+ no_name: -+ DWC_FREE(t->t); -+ no_timer: -+ DWC_FREE(t); -+ return NULL; -+} -+ -+void DWC_TIMER_FREE(dwc_timer_t *timer) -+{ -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); -+ -+ if (timer->scheduled) { -+ del_timer(timer->t); -+ timer->scheduled = 0; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); -+ DWC_SPINLOCK_FREE(timer->lock); -+ DWC_FREE(timer->t); -+ DWC_FREE(timer->name); -+ DWC_FREE(timer); -+} -+ -+void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) -+{ -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); -+ -+ if (!timer->scheduled) { -+ timer->scheduled = 1; -+ DWC_DEBUGC("Scheduling timer %s to expire in +%d msec", timer->name, time); -+ timer->t->expires = jiffies + msecs_to_jiffies(time); -+ add_timer(timer->t); -+ } else { -+ DWC_DEBUGC("Modifying timer %s to expire in +%d msec", timer->name, time); -+ mod_timer(timer->t, jiffies + msecs_to_jiffies(time)); -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); -+} -+ -+void DWC_TIMER_CANCEL(dwc_timer_t *timer) -+{ -+ del_timer(timer->t); -+} -+ -+ -+/* Wait Queues */ -+ -+struct dwc_waitq { -+ wait_queue_head_t queue; -+ int abort; -+}; -+ -+dwc_waitq_t *DWC_WAITQ_ALLOC(void) -+{ -+ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue\n"); -+ return NULL; -+ } -+ -+ init_waitqueue_head(&wq->queue); -+ wq->abort = 0; -+ return wq; -+} -+ -+void DWC_WAITQ_FREE(dwc_waitq_t *wq) -+{ -+ DWC_FREE(wq); -+} -+ -+int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) -+{ -+ int result = wait_event_interruptible(wq->queue, -+ cond(data) || wq->abort); -+ if (result == -ERESTARTSYS) { -+ wq->abort = 0; -+ return -DWC_E_RESTART; -+ } -+ -+ if (wq->abort == 1) { -+ wq->abort = 0; -+ return -DWC_E_ABORT; -+ } -+ -+ wq->abort = 0; -+ -+ if (result == 0) { -+ return 0; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs) -+{ -+ int32_t tmsecs; -+ int result = wait_event_interruptible_timeout(wq->queue, -+ cond(data) || wq->abort, -+ msecs_to_jiffies(msecs)); -+ if (result == -ERESTARTSYS) { -+ wq->abort = 0; -+ return -DWC_E_RESTART; -+ } -+ -+ if (wq->abort == 1) { -+ wq->abort = 0; -+ return -DWC_E_ABORT; -+ } -+ -+ wq->abort = 0; -+ -+ if (result > 0) { -+ tmsecs = jiffies_to_msecs(result); -+ if (!tmsecs) { -+ return 1; -+ } -+ -+ return tmsecs; -+ } -+ -+ if (result == 0) { -+ return -DWC_E_TIMEOUT; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) -+{ -+ wq->abort = 0; -+ wake_up_interruptible(&wq->queue); -+} -+ -+void DWC_WAITQ_ABORT(dwc_waitq_t *wq) -+{ -+ wq->abort = 1; -+ wake_up_interruptible(&wq->queue); -+} -+ -+ -+/* Threading */ -+ -+dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) -+{ -+ struct task_struct *thread = kthread_run(func, data, name); -+ -+ if (thread == ERR_PTR(-ENOMEM)) { -+ return NULL; -+ } -+ -+ return (dwc_thread_t *)thread; -+} -+ -+int DWC_THREAD_STOP(dwc_thread_t *thread) -+{ -+ return kthread_stop((struct task_struct *)thread); -+} -+ -+dwc_bool_t DWC_THREAD_SHOULD_STOP(void) -+{ -+ return kthread_should_stop(); -+} -+ -+ -+/* tasklets -+ - run in interrupt context (cannot sleep) -+ - each tasklet runs on a single CPU -+ - different tasklets can be running simultaneously on different CPUs -+ */ -+struct dwc_tasklet { -+ struct tasklet_struct t; -+ dwc_tasklet_callback_t cb; -+ void *data; -+}; -+ -+static void tasklet_callback(unsigned long data) -+{ -+ dwc_tasklet_t *t = (dwc_tasklet_t *)data; -+ t->cb(t->data); -+} -+ -+dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) -+{ -+ dwc_tasklet_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (t) { -+ t->cb = cb; -+ t->data = data; -+ tasklet_init(&t->t, tasklet_callback, (unsigned long)t); -+ } else { -+ DWC_ERROR("Cannot allocate memory for tasklet\n"); -+ } -+ -+ return t; -+} -+ -+void DWC_TASK_FREE(dwc_tasklet_t *task) -+{ -+ DWC_FREE(task); -+} -+ -+void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) -+{ -+ tasklet_schedule(&task->t); -+} -+ -+void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task) -+{ -+ tasklet_hi_schedule(&task->t); -+} -+ -+ -+/* workqueues -+ - run in process context (can sleep) -+ */ -+typedef struct work_container { -+ dwc_work_callback_t cb; -+ void *data; -+ dwc_workq_t *wq; -+ char *name; -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_ENTRY(work_container) entry; -+#endif -+ struct delayed_work work; -+} work_container_t; -+ -+#ifdef DEBUG -+DWC_CIRCLEQ_HEAD(work_container_queue, work_container); -+#endif -+ -+struct dwc_workq { -+ struct workqueue_struct *wq; -+ dwc_spinlock_t *lock; -+ dwc_waitq_t *waitq; -+ int pending; -+ -+#ifdef DEBUG -+ struct work_container_queue entries; -+#endif -+}; -+ -+static void do_work(struct work_struct *work) -+{ -+ dwc_irqflags_t flags; -+ struct delayed_work *dw = container_of(work, struct delayed_work, work); -+ work_container_t *container = container_of(dw, struct work_container, work); -+ dwc_workq_t *wq = container->wq; -+ -+ container->cb(container->data); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); -+#endif -+ DWC_DEBUGC("Work done: %s, container=%p", container->name, container); -+ if (container->name) { -+ DWC_FREE(container->name); -+ } -+ DWC_FREE(container); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending--; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+} -+ -+static int work_done(void *data) -+{ -+ dwc_workq_t *workq = (dwc_workq_t *)data; -+ return workq->pending == 0; -+} -+ -+int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) -+{ -+ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); -+} -+ -+dwc_workq_t *DWC_WORKQ_ALLOC(char *name) -+{ -+ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ return NULL; -+ } -+ -+ wq->wq = create_singlethread_workqueue(name); -+ if (!wq->wq) { -+ goto no_wq; -+ } -+ -+ wq->pending = 0; -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(wq->lock); -+#else -+ wq->lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ if (!wq->lock) { -+ goto no_lock; -+ } -+ -+ wq->waitq = DWC_WAITQ_ALLOC(); -+ if (!wq->waitq) { -+ goto no_waitq; -+ } -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INIT(&wq->entries); -+#endif -+ return wq; -+ -+ no_waitq: -+ DWC_SPINLOCK_FREE(wq->lock); -+ no_lock: -+ destroy_workqueue(wq->wq); -+ no_wq: -+ DWC_FREE(wq); -+ -+ return NULL; -+} -+ -+void DWC_WORKQ_FREE(dwc_workq_t *wq) -+{ -+#ifdef DEBUG -+ if (wq->pending != 0) { -+ struct work_container *wc; -+ DWC_ERROR("Destroying work queue with pending work"); -+ DWC_CIRCLEQ_FOREACH(wc, &wq->entries, entry) { -+ DWC_ERROR("Work %s still pending", wc->name); -+ } -+ } -+#endif -+ destroy_workqueue(wq->wq); -+ DWC_SPINLOCK_FREE(wq->lock); -+ DWC_WAITQ_FREE(wq->waitq); -+ DWC_FREE(wq); -+} -+ -+void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, -+ char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container\n"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name\n"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); -+ INIT_WORK(&container->work.work, do_work); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ queue_work(wq->wq, &container->work.work); -+} -+ -+void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container\n"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name\n"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); -+ INIT_DELAYED_WORK(&container->work, do_work); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ queue_delayed_work(wq->wq, &container->work, msecs_to_jiffies(time)); -+} -+ -+int DWC_WORKQ_PENDING(dwc_workq_t *wq) -+{ -+ return wq->pending; -+} -+ -+ -+#ifdef DWC_LIBMODULE -+ -+#ifdef DWC_CCLIB -+/* CC */ -+EXPORT_SYMBOL(dwc_cc_if_alloc); -+EXPORT_SYMBOL(dwc_cc_if_free); -+EXPORT_SYMBOL(dwc_cc_clear); -+EXPORT_SYMBOL(dwc_cc_add); -+EXPORT_SYMBOL(dwc_cc_remove); -+EXPORT_SYMBOL(dwc_cc_change); -+EXPORT_SYMBOL(dwc_cc_data_for_save); -+EXPORT_SYMBOL(dwc_cc_restore_from_data); -+EXPORT_SYMBOL(dwc_cc_match_chid); -+EXPORT_SYMBOL(dwc_cc_match_cdid); -+EXPORT_SYMBOL(dwc_cc_ck); -+EXPORT_SYMBOL(dwc_cc_chid); -+EXPORT_SYMBOL(dwc_cc_cdid); -+EXPORT_SYMBOL(dwc_cc_name); -+#endif /* DWC_CCLIB */ -+ -+#ifdef DWC_CRYPTOLIB -+# ifndef CONFIG_MACH_IPMATE -+/* Modpow */ -+EXPORT_SYMBOL(dwc_modpow); -+ -+/* DH */ -+EXPORT_SYMBOL(dwc_dh_modpow); -+EXPORT_SYMBOL(dwc_dh_derive_keys); -+EXPORT_SYMBOL(dwc_dh_pk); -+# endif /* CONFIG_MACH_IPMATE */ -+ -+/* Crypto */ -+EXPORT_SYMBOL(dwc_wusb_aes_encrypt); -+EXPORT_SYMBOL(dwc_wusb_cmf); -+EXPORT_SYMBOL(dwc_wusb_prf); -+EXPORT_SYMBOL(dwc_wusb_fill_ccm_nonce); -+EXPORT_SYMBOL(dwc_wusb_gen_nonce); -+EXPORT_SYMBOL(dwc_wusb_gen_key); -+EXPORT_SYMBOL(dwc_wusb_gen_mic); -+#endif /* DWC_CRYPTOLIB */ -+ -+/* Notification */ -+#ifdef DWC_NOTIFYLIB -+EXPORT_SYMBOL(dwc_alloc_notification_manager); -+EXPORT_SYMBOL(dwc_free_notification_manager); -+EXPORT_SYMBOL(dwc_register_notifier); -+EXPORT_SYMBOL(dwc_unregister_notifier); -+EXPORT_SYMBOL(dwc_add_observer); -+EXPORT_SYMBOL(dwc_remove_observer); -+EXPORT_SYMBOL(dwc_notify); -+#endif -+ -+/* Memory Debugging Routines */ -+#ifdef DWC_DEBUG_MEMORY -+EXPORT_SYMBOL(dwc_alloc_debug); -+EXPORT_SYMBOL(dwc_alloc_atomic_debug); -+EXPORT_SYMBOL(dwc_free_debug); -+EXPORT_SYMBOL(dwc_dma_alloc_debug); -+EXPORT_SYMBOL(dwc_dma_free_debug); -+#endif -+ -+EXPORT_SYMBOL(DWC_MEMSET); -+EXPORT_SYMBOL(DWC_MEMCPY); -+EXPORT_SYMBOL(DWC_MEMMOVE); -+EXPORT_SYMBOL(DWC_MEMCMP); -+EXPORT_SYMBOL(DWC_STRNCMP); -+EXPORT_SYMBOL(DWC_STRCMP); -+EXPORT_SYMBOL(DWC_STRLEN); -+EXPORT_SYMBOL(DWC_STRCPY); -+EXPORT_SYMBOL(DWC_STRDUP); -+EXPORT_SYMBOL(DWC_ATOI); -+EXPORT_SYMBOL(DWC_ATOUI); -+ -+#ifdef DWC_UTFLIB -+EXPORT_SYMBOL(DWC_UTF8_TO_UTF16LE); -+#endif /* DWC_UTFLIB */ -+ -+EXPORT_SYMBOL(DWC_IN_IRQ); -+EXPORT_SYMBOL(DWC_IN_BH); -+EXPORT_SYMBOL(DWC_VPRINTF); -+EXPORT_SYMBOL(DWC_VSNPRINTF); -+EXPORT_SYMBOL(DWC_PRINTF); -+EXPORT_SYMBOL(DWC_SPRINTF); -+EXPORT_SYMBOL(DWC_SNPRINTF); -+EXPORT_SYMBOL(__DWC_WARN); -+EXPORT_SYMBOL(__DWC_ERROR); -+EXPORT_SYMBOL(DWC_EXCEPTION); -+ -+#ifdef DEBUG -+EXPORT_SYMBOL(__DWC_DEBUG); -+#endif -+ -+EXPORT_SYMBOL(__DWC_DMA_ALLOC); -+EXPORT_SYMBOL(__DWC_DMA_ALLOC_ATOMIC); -+EXPORT_SYMBOL(__DWC_DMA_FREE); -+EXPORT_SYMBOL(__DWC_ALLOC); -+EXPORT_SYMBOL(__DWC_ALLOC_ATOMIC); -+EXPORT_SYMBOL(__DWC_FREE); -+ -+#ifdef DWC_CRYPTOLIB -+EXPORT_SYMBOL(DWC_RANDOM_BYTES); -+EXPORT_SYMBOL(DWC_AES_CBC); -+EXPORT_SYMBOL(DWC_SHA256); -+EXPORT_SYMBOL(DWC_HMAC_SHA256); -+#endif -+ -+EXPORT_SYMBOL(DWC_CPU_TO_LE32); -+EXPORT_SYMBOL(DWC_CPU_TO_BE32); -+EXPORT_SYMBOL(DWC_LE32_TO_CPU); -+EXPORT_SYMBOL(DWC_BE32_TO_CPU); -+EXPORT_SYMBOL(DWC_CPU_TO_LE16); -+EXPORT_SYMBOL(DWC_CPU_TO_BE16); -+EXPORT_SYMBOL(DWC_LE16_TO_CPU); -+EXPORT_SYMBOL(DWC_BE16_TO_CPU); -+EXPORT_SYMBOL(DWC_READ_REG32); -+EXPORT_SYMBOL(DWC_WRITE_REG32); -+EXPORT_SYMBOL(DWC_MODIFY_REG32); -+ -+#if 0 -+EXPORT_SYMBOL(DWC_READ_REG64); -+EXPORT_SYMBOL(DWC_WRITE_REG64); -+EXPORT_SYMBOL(DWC_MODIFY_REG64); -+#endif -+ -+EXPORT_SYMBOL(DWC_SPINLOCK_ALLOC); -+EXPORT_SYMBOL(DWC_SPINLOCK_FREE); -+EXPORT_SYMBOL(DWC_SPINLOCK); -+EXPORT_SYMBOL(DWC_SPINUNLOCK); -+EXPORT_SYMBOL(DWC_SPINLOCK_IRQSAVE); -+EXPORT_SYMBOL(DWC_SPINUNLOCK_IRQRESTORE); -+EXPORT_SYMBOL(DWC_MUTEX_ALLOC); -+ -+#if (!defined(DWC_LINUX) || !defined(CONFIG_DEBUG_MUTEXES)) -+EXPORT_SYMBOL(DWC_MUTEX_FREE); -+#endif -+ -+EXPORT_SYMBOL(DWC_MUTEX_LOCK); -+EXPORT_SYMBOL(DWC_MUTEX_TRYLOCK); -+EXPORT_SYMBOL(DWC_MUTEX_UNLOCK); -+EXPORT_SYMBOL(DWC_UDELAY); -+EXPORT_SYMBOL(DWC_MDELAY); -+EXPORT_SYMBOL(DWC_MSLEEP); -+EXPORT_SYMBOL(DWC_TIME); -+EXPORT_SYMBOL(DWC_TIMER_ALLOC); -+EXPORT_SYMBOL(DWC_TIMER_FREE); -+EXPORT_SYMBOL(DWC_TIMER_SCHEDULE); -+EXPORT_SYMBOL(DWC_TIMER_CANCEL); -+EXPORT_SYMBOL(DWC_WAITQ_ALLOC); -+EXPORT_SYMBOL(DWC_WAITQ_FREE); -+EXPORT_SYMBOL(DWC_WAITQ_WAIT); -+EXPORT_SYMBOL(DWC_WAITQ_WAIT_TIMEOUT); -+EXPORT_SYMBOL(DWC_WAITQ_TRIGGER); -+EXPORT_SYMBOL(DWC_WAITQ_ABORT); -+EXPORT_SYMBOL(DWC_THREAD_RUN); -+EXPORT_SYMBOL(DWC_THREAD_STOP); -+EXPORT_SYMBOL(DWC_THREAD_SHOULD_STOP); -+EXPORT_SYMBOL(DWC_TASK_ALLOC); -+EXPORT_SYMBOL(DWC_TASK_FREE); -+EXPORT_SYMBOL(DWC_TASK_SCHEDULE); -+EXPORT_SYMBOL(DWC_WORKQ_WAIT_WORK_DONE); -+EXPORT_SYMBOL(DWC_WORKQ_ALLOC); -+EXPORT_SYMBOL(DWC_WORKQ_FREE); -+EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE); -+EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE_DELAYED); -+EXPORT_SYMBOL(DWC_WORKQ_PENDING); -+ -+static int dwc_common_port_init_module(void) -+{ -+ int result = 0; -+ -+ printk(KERN_DEBUG "Module dwc_common_port init\n" ); -+ -+#ifdef DWC_DEBUG_MEMORY -+ result = dwc_memory_debug_start(NULL); -+ if (result) { -+ printk(KERN_ERR -+ "dwc_memory_debug_start() failed with error %d\n", -+ result); -+ return result; -+ } -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+ result = dwc_alloc_notification_manager(NULL, NULL); -+ if (result) { -+ printk(KERN_ERR -+ "dwc_alloc_notification_manager() failed with error %d\n", -+ result); -+ return result; -+ } -+#endif -+ return result; -+} -+ -+static void dwc_common_port_exit_module(void) -+{ -+ printk(KERN_DEBUG "Module dwc_common_port exit\n" ); -+ -+#ifdef DWC_NOTIFYLIB -+ dwc_free_notification_manager(); -+#endif -+ -+#ifdef DWC_DEBUG_MEMORY -+ dwc_memory_debug_stop(); -+#endif -+} -+ -+module_init(dwc_common_port_init_module); -+module_exit(dwc_common_port_exit_module); -+ -+MODULE_DESCRIPTION("DWC Common Library - Portable version"); -+MODULE_AUTHOR("Synopsys Inc."); -+MODULE_LICENSE ("GPL"); -+ -+#endif /* DWC_LIBMODULE */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..49b07e1722645105e0433dceaec91add3412523f ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c -@@ -0,0 +1,1275 @@ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+#ifdef DWC_CCLIB -+# include "dwc_cc.h" -+#endif -+ -+#ifdef DWC_CRYPTOLIB -+# include "dwc_modpow.h" -+# include "dwc_dh.h" -+# include "dwc_crypto.h" -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+# include "dwc_notifier.h" -+#endif -+ -+/* OS-Level Implementations */ -+ -+/* This is the NetBSD 4.0.1 kernel implementation of the DWC platform library. */ -+ -+ -+/* MISC */ -+ -+void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) -+{ -+ return memset(dest, byte, size); -+} -+ -+void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) -+{ -+ return memcpy(dest, src, size); -+} -+ -+void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) -+{ -+ bcopy(src, dest, size); -+ return dest; -+} -+ -+int DWC_MEMCMP(void *m1, void *m2, uint32_t size) -+{ -+ return memcmp(m1, m2, size); -+} -+ -+int DWC_STRNCMP(void *s1, void *s2, uint32_t size) -+{ -+ return strncmp(s1, s2, size); -+} -+ -+int DWC_STRCMP(void *s1, void *s2) -+{ -+ return strcmp(s1, s2); -+} -+ -+int DWC_STRLEN(char const *str) -+{ -+ return strlen(str); -+} -+ -+char *DWC_STRCPY(char *to, char const *from) -+{ -+ return strcpy(to, from); -+} -+ -+char *DWC_STRDUP(char const *str) -+{ -+ int len = DWC_STRLEN(str) + 1; -+ char *new = DWC_ALLOC_ATOMIC(len); -+ -+ if (!new) { -+ return NULL; -+ } -+ -+ DWC_MEMCPY(new, str, len); -+ return new; -+} -+ -+int DWC_ATOI(char *str, int32_t *value) -+{ -+ char *end = NULL; -+ -+ /* NetBSD doesn't have 'strtol' in the kernel, but 'strtoul' -+ * should be equivalent on 2's complement machines -+ */ -+ *value = strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+int DWC_ATOUI(char *str, uint32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+ -+#ifdef DWC_UTFLIB -+/* From usbstring.c */ -+ -+int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+ -+#endif /* DWC_UTFLIB */ -+ -+ -+/* dwc_debug.h */ -+ -+dwc_bool_t DWC_IN_IRQ(void) -+{ -+// return in_irq(); -+ return 0; -+} -+ -+dwc_bool_t DWC_IN_BH(void) -+{ -+// return in_softirq(); -+ return 0; -+} -+ -+void DWC_VPRINTF(char *format, va_list args) -+{ -+ vprintf(format, args); -+} -+ -+int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) -+{ -+ return vsnprintf(str, size, format, args); -+} -+ -+void DWC_PRINTF(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+int DWC_SPRINTF(char *buffer, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsprintf(buffer, format, args); -+ va_end(args); -+ return retval; -+} -+ -+int DWC_SNPRINTF(char *buffer, int size, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsnprintf(buffer, size, format, args); -+ va_end(args); -+ return retval; -+} -+ -+void __DWC_WARN(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void __DWC_ERROR(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void DWC_EXCEPTION(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+// BUG_ON(1); ??? -+} -+ -+#ifdef DEBUG -+void __DWC_DEBUG(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+#endif -+ -+ -+/* dwc_mem.h */ -+ -+#if 0 -+dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, -+ uint32_t align, -+ uint32_t alloc) -+{ -+ struct dma_pool *pool = dma_pool_create("Pool", NULL, -+ size, align, alloc); -+ return (dwc_pool_t *)pool; -+} -+ -+void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) -+{ -+ dma_pool_destroy((struct dma_pool *)pool); -+} -+ -+void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); -+ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); -+} -+ -+void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); -+ memset(..); -+} -+ -+void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) -+{ -+ dma_pool_free(pool, vaddr, daddr); -+} -+#endif -+ -+void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ int error; -+ -+ error = bus_dmamem_alloc(dma->dma_tag, size, 1, size, dma->segs, -+ sizeof(dma->segs) / sizeof(dma->segs[0]), -+ &dma->nsegs, BUS_DMA_NOWAIT); -+ if (error) { -+ printf("%s: bus_dmamem_alloc(%ju) failed: %d\n", __func__, -+ (uintmax_t)size, error); -+ goto fail_0; -+ } -+ -+ error = bus_dmamem_map(dma->dma_tag, dma->segs, dma->nsegs, size, -+ (caddr_t *)&dma->dma_vaddr, -+ BUS_DMA_NOWAIT | BUS_DMA_COHERENT); -+ if (error) { -+ printf("%s: bus_dmamem_map failed: %d\n", __func__, error); -+ goto fail_1; -+ } -+ -+ error = bus_dmamap_create(dma->dma_tag, size, 1, size, 0, -+ BUS_DMA_NOWAIT, &dma->dma_map); -+ if (error) { -+ printf("%s: bus_dmamap_create failed: %d\n", __func__, error); -+ goto fail_2; -+ } -+ -+ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, -+ size, NULL, BUS_DMA_NOWAIT); -+ if (error) { -+ printf("%s: bus_dmamap_load failed: %d\n", __func__, error); -+ goto fail_3; -+ } -+ -+ dma->dma_paddr = (bus_addr_t)dma->segs[0].ds_addr; -+ *dma_addr = dma->dma_paddr; -+ return dma->dma_vaddr; -+ -+fail_3: -+ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); -+fail_2: -+ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); -+fail_1: -+ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); -+fail_0: -+ dma->dma_map = NULL; -+ dma->dma_vaddr = NULL; -+ dma->nsegs = 0; -+ -+ return NULL; -+} -+ -+void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ -+ if (dma->dma_map != NULL) { -+ bus_dmamap_sync(dma->dma_tag, dma->dma_map, 0, size, -+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); -+ bus_dmamap_unload(dma->dma_tag, dma->dma_map); -+ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); -+ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); -+ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); -+ dma->dma_paddr = 0; -+ dma->dma_map = NULL; -+ dma->dma_vaddr = NULL; -+ dma->nsegs = 0; -+ } -+} -+ -+void *__DWC_ALLOC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); -+} -+ -+void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); -+} -+ -+void __DWC_FREE(void *mem_ctx, void *addr) -+{ -+ free(addr, M_DEVBUF); -+} -+ -+ -+#ifdef DWC_CRYPTOLIB -+/* dwc_crypto.h */ -+ -+void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) -+{ -+ get_random_bytes(buffer, length); -+} -+ -+int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) -+{ -+ struct crypto_blkcipher *tfm; -+ struct blkcipher_desc desc; -+ struct scatterlist sgd; -+ struct scatterlist sgs; -+ -+ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); -+ if (tfm == NULL) { -+ printk("failed to load transform for aes CBC\n"); -+ return -1; -+ } -+ -+ crypto_blkcipher_setkey(tfm, key, keylen); -+ crypto_blkcipher_set_iv(tfm, iv, 16); -+ -+ sg_init_one(&sgd, out, messagelen); -+ sg_init_one(&sgs, message, messagelen); -+ -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { -+ crypto_free_blkcipher(tfm); -+ DWC_ERROR("AES CBC encryption failed"); -+ return -1; -+ } -+ -+ crypto_free_blkcipher(tfm); -+ return 0; -+} -+ -+int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, len); -+ crypto_hash_digest(&desc, &sg, len, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, -+ uint8_t *key, uint32_t keylen, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, messagelen); -+ crypto_hash_setkey(tfm, key, keylen); -+ crypto_hash_digest(&desc, &sg, messagelen, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/* Byte Ordering Conversions */ -+ -+uint32_t DWC_CPU_TO_LE32(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_CPU_TO_BE32(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_LE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_BE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_LE16(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_BE16(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_LE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_BE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+ -+/* Registers */ -+ -+uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_4(io->iot, io->ioh, ior); -+} -+ -+#if 0 -+uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_8(io->iot, io->ioh, ior); -+} -+#endif -+ -+void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, value); -+} -+ -+#if 0 -+void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, value); -+} -+#endif -+ -+void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, -+ uint32_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, -+ (bus_space_read_4(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+ -+#if 0 -+void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, -+ uint64_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, -+ (bus_space_read_8(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+#endif -+ -+ -+/* Locking */ -+ -+dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) -+{ -+ struct simplelock *sl = DWC_ALLOC(sizeof(*sl)); -+ -+ if (!sl) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ return NULL; -+ } -+ -+ simple_lock_init(sl); -+ return (dwc_spinlock_t *)sl; -+} -+ -+void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) -+{ -+ struct simplelock *sl = (struct simplelock *)lock; -+ -+ DWC_FREE(sl); -+} -+ -+void DWC_SPINLOCK(dwc_spinlock_t *lock) -+{ -+ simple_lock((struct simplelock *)lock); -+} -+ -+void DWC_SPINUNLOCK(dwc_spinlock_t *lock) -+{ -+ simple_unlock((struct simplelock *)lock); -+} -+ -+void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) -+{ -+ simple_lock((struct simplelock *)lock); -+ *flags = splbio(); -+} -+ -+void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) -+{ -+ splx(flags); -+ simple_unlock((struct simplelock *)lock); -+} -+ -+dwc_mutex_t *DWC_MUTEX_ALLOC(void) -+{ -+ dwc_mutex_t *mutex = DWC_ALLOC(sizeof(struct lock)); -+ -+ if (!mutex) { -+ DWC_ERROR("Cannot allocate memory for mutex"); -+ return NULL; -+ } -+ -+ lockinit((struct lock *)mutex, 0, "dw3mtx", 0, 0); -+ return mutex; -+} -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+#else -+void DWC_MUTEX_FREE(dwc_mutex_t *mutex) -+{ -+ DWC_FREE(mutex); -+} -+#endif -+ -+void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) -+{ -+ lockmgr((struct lock *)mutex, LK_EXCLUSIVE, NULL); -+} -+ -+int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) -+{ -+ int status; -+ -+ status = lockmgr((struct lock *)mutex, LK_EXCLUSIVE | LK_NOWAIT, NULL); -+ return status == 0; -+} -+ -+void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) -+{ -+ lockmgr((struct lock *)mutex, LK_RELEASE, NULL); -+} -+ -+ -+/* Timing */ -+ -+void DWC_UDELAY(uint32_t usecs) -+{ -+ DELAY(usecs); -+} -+ -+void DWC_MDELAY(uint32_t msecs) -+{ -+ do { -+ DELAY(1000); -+ } while (--msecs); -+} -+ -+void DWC_MSLEEP(uint32_t msecs) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ tsleep(&tv, 0, "dw3slp", tvtohz(&tv)); -+} -+ -+uint32_t DWC_TIME(void) -+{ -+ struct timeval tv; -+ -+ microuptime(&tv); // or getmicrouptime? (less precise, but faster) -+ return tv.tv_sec * 1000 + tv.tv_usec / 1000; -+} -+ -+ -+/* Timers */ -+ -+struct dwc_timer { -+ struct callout t; -+ char *name; -+ dwc_spinlock_t *lock; -+ dwc_timer_callback_t cb; -+ void *data; -+}; -+ -+dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) -+{ -+ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (!t) { -+ DWC_ERROR("Cannot allocate memory for timer"); -+ return NULL; -+ } -+ -+ callout_init(&t->t); -+ -+ t->name = DWC_STRDUP(name); -+ if (!t->name) { -+ DWC_ERROR("Cannot allocate memory for timer->name"); -+ goto no_name; -+ } -+ -+ t->lock = DWC_SPINLOCK_ALLOC(); -+ if (!t->lock) { -+ DWC_ERROR("Cannot allocate memory for timer->lock"); -+ goto no_lock; -+ } -+ -+ t->cb = cb; -+ t->data = data; -+ -+ return t; -+ -+ no_lock: -+ DWC_FREE(t->name); -+ no_name: -+ DWC_FREE(t); -+ -+ return NULL; -+} -+ -+void DWC_TIMER_FREE(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+ DWC_SPINLOCK_FREE(timer->lock); -+ DWC_FREE(timer->name); -+ DWC_FREE(timer); -+} -+ -+void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); -+} -+ -+void DWC_TIMER_CANCEL(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+} -+ -+ -+/* Wait Queues */ -+ -+struct dwc_waitq { -+ struct simplelock lock; -+ int abort; -+}; -+ -+dwc_waitq_t *DWC_WAITQ_ALLOC(void) -+{ -+ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ return NULL; -+ } -+ -+ simple_lock_init(&wq->lock); -+ wq->abort = 0; -+ -+ return wq; -+} -+ -+void DWC_WAITQ_FREE(dwc_waitq_t *wq) -+{ -+ DWC_FREE(wq); -+} -+ -+int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) -+{ -+ int ipl; -+ int result = 0; -+ -+ simple_lock(&wq->lock); -+ ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+ splx(ipl); -+ result = ltsleep(wq, PCATCH, "dw3wat", 0, &wq->lock); // infinite timeout -+ ipl = splbio(); -+ } -+ -+ if (result == 0) { // awoken -+ if (wq->abort) { -+ wq->abort = 0; -+ result = -DWC_E_ABORT; -+ } else { -+ result = 0; -+ } -+ -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ } else { -+ wq->abort = 0; -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ -+ if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ } else { // signaled - must be EINTR -+ result = -DWC_E_ABORT; -+ } -+ } -+ -+ return result; -+} -+ -+int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs) -+{ -+ struct timeval tv, tv1, tv2; -+ int ipl; -+ int result = 0; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ -+ simple_lock(&wq->lock); -+ ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+ splx(ipl); -+ getmicrouptime(&tv1); -+ result = ltsleep(wq, PCATCH, "dw3wto", tvtohz(&tv), &wq->lock); -+ getmicrouptime(&tv2); -+ ipl = splbio(); -+ } -+ -+ if (result == 0) { // awoken -+ if (wq->abort) { -+ wq->abort = 0; -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ result = -DWC_E_ABORT; -+ } else { -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ -+ tv2.tv_usec -= tv1.tv_usec; -+ if (tv2.tv_usec < 0) { -+ tv2.tv_usec += 1000000; -+ tv2.tv_sec--; -+ } -+ -+ tv2.tv_sec -= tv1.tv_sec; -+ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; -+ result = msecs - result; -+ if (result <= 0) -+ result = 1; -+ } -+ } else { -+ wq->abort = 0; -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ -+ if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ -+ } else if (result == EINTR) { // signaled - interrupt -+ result = -DWC_E_ABORT; -+ -+ } else { // timed out -+ result = -DWC_E_TIMEOUT; -+ } -+ } -+ -+ return result; -+} -+ -+void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) -+{ -+ wakeup(wq); -+} -+ -+void DWC_WAITQ_ABORT(dwc_waitq_t *wq) -+{ -+ int ipl; -+ -+ simple_lock(&wq->lock); -+ ipl = splbio(); -+ wq->abort = 1; -+ wakeup(wq); -+ splx(ipl); -+ simple_unlock(&wq->lock); -+} -+ -+ -+/* Threading */ -+ -+struct dwc_thread { -+ struct proc *proc; -+ int abort; -+}; -+ -+dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) -+{ -+ int retval; -+ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); -+ -+ if (!thread) { -+ return NULL; -+ } -+ -+ thread->abort = 0; -+ retval = kthread_create1((void (*)(void *))func, data, &thread->proc, -+ "%s", name); -+ if (retval) { -+ DWC_FREE(thread); -+ return NULL; -+ } -+ -+ return thread; -+} -+ -+int DWC_THREAD_STOP(dwc_thread_t *thread) -+{ -+ int retval; -+ -+ thread->abort = 1; -+ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); -+ -+ if (retval == 0) { -+ /* DWC_THREAD_EXIT() will free the thread struct */ -+ return 0; -+ } -+ -+ /* NOTE: We leak the thread struct if thread doesn't die */ -+ -+ if (retval == EWOULDBLOCK) { -+ return -DWC_E_TIMEOUT; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) -+{ -+ return thread->abort; -+} -+ -+void DWC_THREAD_EXIT(dwc_thread_t *thread) -+{ -+ wakeup(&thread->abort); -+ DWC_FREE(thread); -+ kthread_exit(0); -+} -+ -+/* tasklets -+ - Runs in interrupt context (cannot sleep) -+ - Each tasklet runs on a single CPU -+ - Different tasklets can be running simultaneously on different CPUs -+ [ On NetBSD there is no corresponding mechanism, drivers don't have bottom- -+ halves. So we just call the callback directly from DWC_TASK_SCHEDULE() ] -+ */ -+struct dwc_tasklet { -+ dwc_tasklet_callback_t cb; -+ void *data; -+}; -+ -+static void tasklet_callback(void *data) -+{ -+ dwc_tasklet_t *task = (dwc_tasklet_t *)data; -+ -+ task->cb(task->data); -+} -+ -+dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) -+{ -+ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); -+ -+ if (task) { -+ task->cb = cb; -+ task->data = data; -+ } else { -+ DWC_ERROR("Cannot allocate memory for tasklet"); -+ } -+ -+ return task; -+} -+ -+void DWC_TASK_FREE(dwc_tasklet_t *task) -+{ -+ DWC_FREE(task); -+} -+ -+void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) -+{ -+ tasklet_callback(task); -+} -+ -+ -+/* workqueues -+ - Runs in process context (can sleep) -+ */ -+typedef struct work_container { -+ dwc_work_callback_t cb; -+ void *data; -+ dwc_workq_t *wq; -+ char *name; -+ int hz; -+ struct work task; -+} work_container_t; -+ -+struct dwc_workq { -+ struct workqueue *taskq; -+ dwc_spinlock_t *lock; -+ dwc_waitq_t *waitq; -+ int pending; -+ struct work_container *container; -+}; -+ -+static void do_work(struct work *task, void *data) -+{ -+ dwc_workq_t *wq = (dwc_workq_t *)data; -+ work_container_t *container = wq->container; -+ dwc_irqflags_t flags; -+ -+ if (container->hz) { -+ tsleep(container, 0, "dw3wrk", container->hz); -+ } -+ -+ container->cb(container->data); -+ DWC_DEBUG("Work done: %s, container=%p", container->name, container); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ if (container->name) -+ DWC_FREE(container->name); -+ DWC_FREE(container); -+ wq->pending--; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+} -+ -+static int work_done(void *data) -+{ -+ dwc_workq_t *workq = (dwc_workq_t *)data; -+ -+ return workq->pending == 0; -+} -+ -+int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) -+{ -+ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); -+} -+ -+dwc_workq_t *DWC_WORKQ_ALLOC(char *name) -+{ -+ int result; -+ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for workqueue"); -+ return NULL; -+ } -+ -+ result = workqueue_create(&wq->taskq, name, do_work, wq, 0 /*PWAIT*/, -+ IPL_BIO, 0); -+ if (result) { -+ DWC_ERROR("Cannot create workqueue"); -+ goto no_taskq; -+ } -+ -+ wq->pending = 0; -+ -+ wq->lock = DWC_SPINLOCK_ALLOC(); -+ if (!wq->lock) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ goto no_lock; -+ } -+ -+ wq->waitq = DWC_WAITQ_ALLOC(); -+ if (!wq->waitq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ goto no_waitq; -+ } -+ -+ return wq; -+ -+ no_waitq: -+ DWC_SPINLOCK_FREE(wq->lock); -+ no_lock: -+ workqueue_destroy(wq->taskq); -+ no_taskq: -+ DWC_FREE(wq); -+ -+ return NULL; -+} -+ -+void DWC_WORKQ_FREE(dwc_workq_t *wq) -+{ -+#ifdef DEBUG -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ -+ if (wq->pending != 0) { -+ struct work_container *container = wq->container; -+ -+ DWC_ERROR("Destroying work queue with pending work"); -+ -+ if (container && container->name) { -+ DWC_ERROR("Work %s still pending", container->name); -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+#endif -+ DWC_WAITQ_FREE(wq->waitq); -+ DWC_SPINLOCK_FREE(wq->lock); -+ workqueue_destroy(wq->taskq); -+ DWC_FREE(wq); -+} -+ -+void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, -+ char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ container->hz = 0; -+ wq->container = container; -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ workqueue_enqueue(wq->taskq, &container->task); -+} -+ -+void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ struct timeval tv; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ container->hz = tvtohz(&tv); -+ wq->container = container; -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ workqueue_enqueue(wq->taskq, &container->task); -+} -+ -+int DWC_WORKQ_PENDING(dwc_workq_t *wq) -+{ -+ return wq->pending; -+} -diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.c b/drivers/usb/host/dwc_common_port/dwc_crypto.c -new file mode 100644 -index 0000000000000000000000000000000000000000..3b0353296148f6297b5bdc2f45e9fe92a17c680d ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_crypto.c -@@ -0,0 +1,308 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.c $ -+ * $Revision: #5 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+ -+/** @file -+ * This file contains the WUSB cryptographic routines. -+ */ -+ -+#ifdef DWC_CRYPTOLIB -+ -+#include "dwc_crypto.h" -+#include "usb.h" -+ -+#ifdef DEBUG -+static inline void dump_bytes(char *name, uint8_t *bytes, int len) -+{ -+ int i; -+ DWC_PRINTF("%s: ", name); -+ for (i=0; idst == src, then the bytes will be encrypted -+ * in-place. -+ * -+ * @return 0 on success, negative error code on error. -+ */ -+int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst) -+{ -+ u8 block_t[16]; -+ DWC_MEMSET(block_t, 0, 16); -+ -+ return DWC_AES_CBC(src, 16, key, 16, block_t, dst); -+} -+ -+/** -+ * The CCM-MAC-FUNCTION described in section 6.5 of the WUSB spec. -+ * This function takes a data string and returns the encrypted CBC -+ * Counter-mode MIC. -+ * -+ * @param key The 128-bit symmetric key. -+ * @param nonce The CCM nonce. -+ * @param label The unique 14-byte ASCII text label. -+ * @param bytes The byte array to be encrypted. -+ * @param len Length of the byte array. -+ * @param result Byte array to receive the 8-byte encrypted MIC. -+ */ -+void dwc_wusb_cmf(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ u8 block_m[16]; -+ u8 block_x[16]; -+ u8 block_t[8]; -+ int idx, blkNum; -+ u16 la = (u16)(len + 14); -+ -+ /* Set the AES-128 key */ -+ //dwc_aes_setkey(tfm, key, 16); -+ -+ /* Fill block B0 from flags = 0x59, N, and l(m) = 0 */ -+ block_m[0] = 0x59; -+ for (idx = 0; idx < 13; idx++) -+ block_m[idx + 1] = nonce[idx]; -+ block_m[14] = 0; -+ block_m[15] = 0; -+ -+ /* Produce the CBC IV */ -+ dwc_wusb_aes_encrypt(block_m, key, block_x); -+ show_block(block_m, "CBC IV in: ", "\n", 0); -+ show_block(block_x, "CBC IV out:", "\n", 0); -+ -+ /* Fill block B1 from l(a) = Blen + 14, and A */ -+ block_x[0] ^= (u8)(la >> 8); -+ block_x[1] ^= (u8)la; -+ for (idx = 0; idx < 14; idx++) -+ block_x[idx + 2] ^= label[idx]; -+ show_block(block_x, "After xor: ", "b1\n", 16); -+ -+ dwc_wusb_aes_encrypt(block_x, key, block_x); -+ show_block(block_x, "After AES: ", "b1\n", 16); -+ -+ idx = 0; -+ blkNum = 0; -+ -+ /* Fill remaining blocks with B */ -+ while (len-- > 0) { -+ block_x[idx] ^= *bytes++; -+ if (++idx >= 16) { -+ idx = 0; -+ show_block(block_x, "After xor: ", "\n", blkNum); -+ dwc_wusb_aes_encrypt(block_x, key, block_x); -+ show_block(block_x, "After AES: ", "\n", blkNum); -+ blkNum++; -+ } -+ } -+ -+ /* Handle partial last block */ -+ if (idx > 0) { -+ show_block(block_x, "After xor: ", "\n", blkNum); -+ dwc_wusb_aes_encrypt(block_x, key, block_x); -+ show_block(block_x, "After AES: ", "\n", blkNum); -+ } -+ -+ /* Save the MIC tag */ -+ DWC_MEMCPY(block_t, block_x, 8); -+ show_block(block_t, "MIC tag : ", NULL, 8); -+ -+ /* Fill block A0 from flags = 0x01, N, and counter = 0 */ -+ block_m[0] = 0x01; -+ block_m[14] = 0; -+ block_m[15] = 0; -+ -+ /* Encrypt the counter */ -+ dwc_wusb_aes_encrypt(block_m, key, block_x); -+ show_block(block_x, "CTR[MIC] : ", NULL, 8); -+ -+ /* XOR with MIC tag */ -+ for (idx = 0; idx < 8; idx++) { -+ block_t[idx] ^= block_x[idx]; -+ } -+ -+ /* Return result to caller */ -+ DWC_MEMCPY(result, block_t, 8); -+ show_block(result, "CCM-MIC : ", NULL, 8); -+ -+} -+ -+/** -+ * The PRF function described in section 6.5 of the WUSB spec. This function -+ * concatenates MIC values returned from dwc_cmf() to create a value of -+ * the requested length. -+ * -+ * @param prf_len Length of the PRF function in bits (64, 128, or 256). -+ * @param key, nonce, label, bytes, len Same as for dwc_cmf(). -+ * @param result Byte array to receive the result. -+ */ -+void dwc_wusb_prf(int prf_len, u8 *key, -+ u8 *nonce, char *label, u8 *bytes, int len, u8 *result) -+{ -+ int i; -+ -+ nonce[0] = 0; -+ for (i = 0; i < prf_len >> 6; i++, nonce[0]++) { -+ dwc_wusb_cmf(key, nonce, label, bytes, len, result); -+ result += 8; -+ } -+} -+ -+/** -+ * Fills in CCM Nonce per the WUSB spec. -+ * -+ * @param[in] haddr Host address. -+ * @param[in] daddr Device address. -+ * @param[in] tkid Session Key(PTK) identifier. -+ * @param[out] nonce Pointer to where the CCM Nonce output is to be written. -+ */ -+void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, -+ uint8_t *nonce) -+{ -+ -+ DWC_DEBUG("%s %x %x\n", __func__, daddr, haddr); -+ -+ DWC_MEMSET(&nonce[0], 0, 16); -+ -+ DWC_MEMCPY(&nonce[6], tkid, 3); -+ nonce[9] = daddr & 0xFF; -+ nonce[10] = (daddr >> 8) & 0xFF; -+ nonce[11] = haddr & 0xFF; -+ nonce[12] = (haddr >> 8) & 0xFF; -+ -+ dump_bytes("CCM nonce", nonce, 16); -+} -+ -+/** -+ * Generates a 16-byte cryptographic-grade random number for the Host/Device -+ * Nonce. -+ */ -+void dwc_wusb_gen_nonce(uint16_t addr, uint8_t *nonce) -+{ -+ uint8_t inonce[16]; -+ uint32_t temp[4]; -+ -+ /* Fill in the Nonce */ -+ DWC_MEMSET(&inonce[0], 0, sizeof(inonce)); -+ inonce[9] = addr & 0xFF; -+ inonce[10] = (addr >> 8) & 0xFF; -+ inonce[11] = inonce[9]; -+ inonce[12] = inonce[10]; -+ -+ /* Collect "randomness samples" */ -+ DWC_RANDOM_BYTES((uint8_t *)temp, 16); -+ -+ dwc_wusb_prf_128((uint8_t *)temp, nonce, -+ "Random Numbers", (uint8_t *)temp, sizeof(temp), -+ nonce); -+} -+ -+/** -+ * Generates the Session Key (PTK) and Key Confirmation Key (KCK) per the -+ * WUSB spec. -+ * -+ * @param[in] ccm_nonce Pointer to CCM Nonce. -+ * @param[in] mk Master Key to derive the session from -+ * @param[in] hnonce Pointer to Host Nonce. -+ * @param[in] dnonce Pointer to Device Nonce. -+ * @param[out] kck Pointer to where the KCK output is to be written. -+ * @param[out] ptk Pointer to where the PTK output is to be written. -+ */ -+void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, uint8_t *hnonce, -+ uint8_t *dnonce, uint8_t *kck, uint8_t *ptk) -+{ -+ uint8_t idata[32]; -+ uint8_t odata[32]; -+ -+ dump_bytes("ck", mk, 16); -+ dump_bytes("hnonce", hnonce, 16); -+ dump_bytes("dnonce", dnonce, 16); -+ -+ /* The data is the HNonce and DNonce concatenated */ -+ DWC_MEMCPY(&idata[0], hnonce, 16); -+ DWC_MEMCPY(&idata[16], dnonce, 16); -+ -+ dwc_wusb_prf_256(mk, ccm_nonce, "Pair-wise keys", idata, 32, odata); -+ -+ /* Low 16 bytes of the result is the KCK, high 16 is the PTK */ -+ DWC_MEMCPY(kck, &odata[0], 16); -+ DWC_MEMCPY(ptk, &odata[16], 16); -+ -+ dump_bytes("kck", kck, 16); -+ dump_bytes("ptk", ptk, 16); -+} -+ -+/** -+ * Generates the Message Integrity Code over the Handshake data per the -+ * WUSB spec. -+ * -+ * @param ccm_nonce Pointer to CCM Nonce. -+ * @param kck Pointer to Key Confirmation Key. -+ * @param data Pointer to Handshake data to be checked. -+ * @param mic Pointer to where the MIC output is to be written. -+ */ -+void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t *kck, -+ uint8_t *data, uint8_t *mic) -+{ -+ -+ dwc_wusb_prf_64(kck, ccm_nonce, "out-of-bandMIC", -+ data, WUSB_HANDSHAKE_LEN_FOR_MIC, mic); -+} -+ -+#endif /* DWC_CRYPTOLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.h b/drivers/usb/host/dwc_common_port/dwc_crypto.h -new file mode 100644 -index 0000000000000000000000000000000000000000..26fcddcfe9ba4b83c921cd2ef8498021176a287f ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_crypto.h -@@ -0,0 +1,111 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.h $ -+ * $Revision: #3 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+ -+#ifndef _DWC_CRYPTO_H_ -+#define _DWC_CRYPTO_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** @file -+ * -+ * This file contains declarations for the WUSB Cryptographic routines as -+ * defined in the WUSB spec. They are only to be used internally by the DWC UWB -+ * modules. -+ */ -+ -+#include "dwc_os.h" -+ -+int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst); -+ -+void dwc_wusb_cmf(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result); -+void dwc_wusb_prf(int prf_len, u8 *key, -+ u8 *nonce, char *label, u8 *bytes, int len, u8 *result); -+ -+/** -+ * The PRF-64 function described in section 6.5 of the WUSB spec. -+ * -+ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). -+ */ -+static inline void dwc_wusb_prf_64(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ dwc_wusb_prf(64, key, nonce, label, bytes, len, result); -+} -+ -+/** -+ * The PRF-128 function described in section 6.5 of the WUSB spec. -+ * -+ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). -+ */ -+static inline void dwc_wusb_prf_128(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ dwc_wusb_prf(128, key, nonce, label, bytes, len, result); -+} -+ -+/** -+ * The PRF-256 function described in section 6.5 of the WUSB spec. -+ * -+ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). -+ */ -+static inline void dwc_wusb_prf_256(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ dwc_wusb_prf(256, key, nonce, label, bytes, len, result); -+} -+ -+ -+void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, -+ uint8_t *nonce); -+void dwc_wusb_gen_nonce(uint16_t addr, -+ uint8_t *nonce); -+ -+void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, -+ uint8_t *hnonce, uint8_t *dnonce, -+ uint8_t *kck, uint8_t *ptk); -+ -+ -+void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t -+ *kck, uint8_t *data, uint8_t *mic); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_CRYPTO_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_dh.c b/drivers/usb/host/dwc_common_port/dwc_dh.c -new file mode 100644 -index 0000000000000000000000000000000000000000..2b429a32aaf0903c2b73e9aa30ef78ba280393ee ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_dh.c -@@ -0,0 +1,291 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.c $ -+ * $Revision: #3 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifdef DWC_CRYPTOLIB -+ -+#ifndef CONFIG_MACH_IPMATE -+ -+#include "dwc_dh.h" -+#include "dwc_modpow.h" -+ -+#ifdef DEBUG -+/* This function prints out a buffer in the format described in the Association -+ * Model specification. */ -+static void dh_dump(char *str, void *_num, int len) -+{ -+ uint8_t *num = _num; -+ int i; -+ DWC_PRINTF("%s\n", str); -+ for (i = 0; i < len; i ++) { -+ DWC_PRINTF("%02x", num[i]); -+ if (((i + 1) % 2) == 0) DWC_PRINTF(" "); -+ if (((i + 1) % 26) == 0) DWC_PRINTF("\n"); -+ } -+ -+ DWC_PRINTF("\n"); -+} -+#else -+#define dh_dump(_x...) do {; } while(0) -+#endif -+ -+/* Constant g value */ -+static __u32 dh_g[] = { -+ 0x02000000, -+}; -+ -+/* Constant p value */ -+static __u32 dh_p[] = { -+ 0xFFFFFFFF, 0xFFFFFFFF, 0xA2DA0FC9, 0x34C26821, 0x8B62C6C4, 0xD11CDC80, 0x084E0229, 0x74CC678A, -+ 0xA6BE0B02, 0x229B133B, 0x79084A51, 0xDD04348E, 0xB31995EF, 0x1B433ACD, 0x6D0A2B30, 0x37145FF2, -+ 0x6D35E14F, 0x45C2516D, 0x76B585E4, 0xC67E5E62, 0xE9424CF4, 0x6BED37A6, 0xB65CFF0B, 0xEDB706F4, -+ 0xFB6B38EE, 0xA59F895A, 0x11249FAE, 0xE61F4B7C, 0x51662849, 0x3D5BE4EC, 0xB87C00C2, 0x05BF63A1, -+ 0x3648DA98, 0x9AD3551C, 0xA83F1669, 0x5FCF24FD, 0x235D6583, 0x96ADA3DC, 0x56F3621C, 0xBB528520, -+ 0x0729D59E, 0x6D969670, 0x4E350C67, 0x0498BC4A, 0x086C74F1, 0x7C2118CA, 0x465E9032, 0x3BCE362E, -+ 0x2C779EE3, 0x03860E18, 0xA283279B, 0x8FA207EC, 0xF05DC5B5, 0xC9524C6F, 0xF6CB2BDE, 0x18175895, -+ 0x7C499539, 0xE56A95EA, 0x1826D215, 0x1005FA98, 0x5A8E7215, 0x2DC4AA8A, 0x0D1733AD, 0x337A5004, -+ 0xAB2155A8, 0x64BA1CDF, 0x0485FBEC, 0x0AEFDB58, 0x5771EA8A, 0x7D0C065D, 0x850F97B3, 0xC7E4E1A6, -+ 0x8CAEF5AB, 0xD73309DB, 0xE0948C1E, 0x9D61254A, 0x26D2E3CE, 0x6BEED21A, 0x06FA2FF1, 0x64088AD9, -+ 0x730276D8, 0x646AC83E, 0x182B1F52, 0x0C207B17, 0x5717E1BB, 0x6C5D617A, 0xC0880977, 0xE246D9BA, -+ 0xA04FE208, 0x31ABE574, 0xFC5BDB43, 0x8E10FDE0, 0x20D1824B, 0xCAD23AA9, 0xFFFFFFFF, 0xFFFFFFFF, -+}; -+ -+static void dh_swap_bytes(void *_in, void *_out, uint32_t len) -+{ -+ uint8_t *in = _in; -+ uint8_t *out = _out; -+ int i; -+ for (i=0; inext = (link); \ -+ (link)->prev = (link); \ -+} while (0) -+ -+#define DWC_LIST_FIRST(link) ((link)->next) -+#define DWC_LIST_LAST(link) ((link)->prev) -+#define DWC_LIST_END(link) (link) -+#define DWC_LIST_NEXT(link) ((link)->next) -+#define DWC_LIST_PREV(link) ((link)->prev) -+#define DWC_LIST_EMPTY(link) \ -+ (DWC_LIST_FIRST(link) == DWC_LIST_END(link)) -+#define DWC_LIST_ENTRY(link, type, field) \ -+ (type *)((uint8_t *)(link) - (size_t)(&((type *)0)->field)) -+ -+#if 0 -+#define DWC_LIST_INSERT_HEAD(list, link) do { \ -+ (link)->next = (list)->next; \ -+ (link)->prev = (list); \ -+ (list)->next->prev = (link); \ -+ (list)->next = (link); \ -+} while (0) -+ -+#define DWC_LIST_INSERT_TAIL(list, link) do { \ -+ (link)->next = (list); \ -+ (link)->prev = (list)->prev; \ -+ (list)->prev->next = (link); \ -+ (list)->prev = (link); \ -+} while (0) -+#else -+#define DWC_LIST_INSERT_HEAD(list, link) do { \ -+ dwc_list_link_t *__next__ = (list)->next; \ -+ __next__->prev = (link); \ -+ (link)->next = __next__; \ -+ (link)->prev = (list); \ -+ (list)->next = (link); \ -+} while (0) -+ -+#define DWC_LIST_INSERT_TAIL(list, link) do { \ -+ dwc_list_link_t *__prev__ = (list)->prev; \ -+ (list)->prev = (link); \ -+ (link)->next = (list); \ -+ (link)->prev = __prev__; \ -+ __prev__->next = (link); \ -+} while (0) -+#endif -+ -+#if 0 -+static inline void __list_add(struct list_head *new, -+ struct list_head *prev, -+ struct list_head *next) -+{ -+ next->prev = new; -+ new->next = next; -+ new->prev = prev; -+ prev->next = new; -+} -+ -+static inline void list_add(struct list_head *new, struct list_head *head) -+{ -+ __list_add(new, head, head->next); -+} -+ -+static inline void list_add_tail(struct list_head *new, struct list_head *head) -+{ -+ __list_add(new, head->prev, head); -+} -+ -+static inline void __list_del(struct list_head * prev, struct list_head * next) -+{ -+ next->prev = prev; -+ prev->next = next; -+} -+ -+static inline void list_del(struct list_head *entry) -+{ -+ __list_del(entry->prev, entry->next); -+ entry->next = LIST_POISON1; -+ entry->prev = LIST_POISON2; -+} -+#endif -+ -+#define DWC_LIST_REMOVE(link) do { \ -+ (link)->next->prev = (link)->prev; \ -+ (link)->prev->next = (link)->next; \ -+} while (0) -+ -+#define DWC_LIST_REMOVE_INIT(link) do { \ -+ DWC_LIST_REMOVE(link); \ -+ DWC_LIST_INIT(link); \ -+} while (0) -+ -+#define DWC_LIST_MOVE_HEAD(list, link) do { \ -+ DWC_LIST_REMOVE(link); \ -+ DWC_LIST_INSERT_HEAD(list, link); \ -+} while (0) -+ -+#define DWC_LIST_MOVE_TAIL(list, link) do { \ -+ DWC_LIST_REMOVE(link); \ -+ DWC_LIST_INSERT_TAIL(list, link); \ -+} while (0) -+ -+#define DWC_LIST_FOREACH(var, list) \ -+ for((var) = DWC_LIST_FIRST(list); \ -+ (var) != DWC_LIST_END(list); \ -+ (var) = DWC_LIST_NEXT(var)) -+ -+#define DWC_LIST_FOREACH_SAFE(var, var2, list) \ -+ for((var) = DWC_LIST_FIRST(list), (var2) = DWC_LIST_NEXT(var); \ -+ (var) != DWC_LIST_END(list); \ -+ (var) = (var2), (var2) = DWC_LIST_NEXT(var2)) -+ -+#define DWC_LIST_FOREACH_REVERSE(var, list) \ -+ for((var) = DWC_LIST_LAST(list); \ -+ (var) != DWC_LIST_END(list); \ -+ (var) = DWC_LIST_PREV(var)) -+ -+/* -+ * Singly-linked List definitions. -+ */ -+#define DWC_SLIST_HEAD(name, type) \ -+struct name { \ -+ struct type *slh_first; /* first element */ \ -+} -+ -+#define DWC_SLIST_HEAD_INITIALIZER(head) \ -+ { NULL } -+ -+#define DWC_SLIST_ENTRY(type) \ -+struct { \ -+ struct type *sle_next; /* next element */ \ -+} -+ -+/* -+ * Singly-linked List access methods. -+ */ -+#define DWC_SLIST_FIRST(head) ((head)->slh_first) -+#define DWC_SLIST_END(head) NULL -+#define DWC_SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) -+#define DWC_SLIST_NEXT(elm, field) ((elm)->field.sle_next) -+ -+#define DWC_SLIST_FOREACH(var, head, field) \ -+ for((var) = SLIST_FIRST(head); \ -+ (var) != SLIST_END(head); \ -+ (var) = SLIST_NEXT(var, field)) -+ -+#define DWC_SLIST_FOREACH_PREVPTR(var, varp, head, field) \ -+ for((varp) = &SLIST_FIRST((head)); \ -+ ((var) = *(varp)) != SLIST_END(head); \ -+ (varp) = &SLIST_NEXT((var), field)) -+ -+/* -+ * Singly-linked List functions. -+ */ -+#define DWC_SLIST_INIT(head) { \ -+ SLIST_FIRST(head) = SLIST_END(head); \ -+} -+ -+#define DWC_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ -+ (elm)->field.sle_next = (slistelm)->field.sle_next; \ -+ (slistelm)->field.sle_next = (elm); \ -+} while (0) -+ -+#define DWC_SLIST_INSERT_HEAD(head, elm, field) do { \ -+ (elm)->field.sle_next = (head)->slh_first; \ -+ (head)->slh_first = (elm); \ -+} while (0) -+ -+#define DWC_SLIST_REMOVE_NEXT(head, elm, field) do { \ -+ (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ -+} while (0) -+ -+#define DWC_SLIST_REMOVE_HEAD(head, field) do { \ -+ (head)->slh_first = (head)->slh_first->field.sle_next; \ -+} while (0) -+ -+#define DWC_SLIST_REMOVE(head, elm, type, field) do { \ -+ if ((head)->slh_first == (elm)) { \ -+ SLIST_REMOVE_HEAD((head), field); \ -+ } \ -+ else { \ -+ struct type *curelm = (head)->slh_first; \ -+ while( curelm->field.sle_next != (elm) ) \ -+ curelm = curelm->field.sle_next; \ -+ curelm->field.sle_next = \ -+ curelm->field.sle_next->field.sle_next; \ -+ } \ -+} while (0) -+ -+/* -+ * Simple queue definitions. -+ */ -+#define DWC_SIMPLEQ_HEAD(name, type) \ -+struct name { \ -+ struct type *sqh_first; /* first element */ \ -+ struct type **sqh_last; /* addr of last next element */ \ -+} -+ -+#define DWC_SIMPLEQ_HEAD_INITIALIZER(head) \ -+ { NULL, &(head).sqh_first } -+ -+#define DWC_SIMPLEQ_ENTRY(type) \ -+struct { \ -+ struct type *sqe_next; /* next element */ \ -+} -+ -+/* -+ * Simple queue access methods. -+ */ -+#define DWC_SIMPLEQ_FIRST(head) ((head)->sqh_first) -+#define DWC_SIMPLEQ_END(head) NULL -+#define DWC_SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) -+#define DWC_SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) -+ -+#define DWC_SIMPLEQ_FOREACH(var, head, field) \ -+ for((var) = SIMPLEQ_FIRST(head); \ -+ (var) != SIMPLEQ_END(head); \ -+ (var) = SIMPLEQ_NEXT(var, field)) -+ -+/* -+ * Simple queue functions. -+ */ -+#define DWC_SIMPLEQ_INIT(head) do { \ -+ (head)->sqh_first = NULL; \ -+ (head)->sqh_last = &(head)->sqh_first; \ -+} while (0) -+ -+#define DWC_SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ -+ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ -+ (head)->sqh_last = &(elm)->field.sqe_next; \ -+ (head)->sqh_first = (elm); \ -+} while (0) -+ -+#define DWC_SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ -+ (elm)->field.sqe_next = NULL; \ -+ *(head)->sqh_last = (elm); \ -+ (head)->sqh_last = &(elm)->field.sqe_next; \ -+} while (0) -+ -+#define DWC_SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ -+ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ -+ (head)->sqh_last = &(elm)->field.sqe_next; \ -+ (listelm)->field.sqe_next = (elm); \ -+} while (0) -+ -+#define DWC_SIMPLEQ_REMOVE_HEAD(head, field) do { \ -+ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ -+ (head)->sqh_last = &(head)->sqh_first; \ -+} while (0) -+ -+/* -+ * Tail queue definitions. -+ */ -+#define DWC_TAILQ_HEAD(name, type) \ -+struct name { \ -+ struct type *tqh_first; /* first element */ \ -+ struct type **tqh_last; /* addr of last next element */ \ -+} -+ -+#define DWC_TAILQ_HEAD_INITIALIZER(head) \ -+ { NULL, &(head).tqh_first } -+ -+#define DWC_TAILQ_ENTRY(type) \ -+struct { \ -+ struct type *tqe_next; /* next element */ \ -+ struct type **tqe_prev; /* address of previous next element */ \ -+} -+ -+/* -+ * tail queue access methods -+ */ -+#define DWC_TAILQ_FIRST(head) ((head)->tqh_first) -+#define DWC_TAILQ_END(head) NULL -+#define DWC_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -+#define DWC_TAILQ_LAST(head, headname) \ -+ (*(((struct headname *)((head)->tqh_last))->tqh_last)) -+/* XXX */ -+#define DWC_TAILQ_PREV(elm, headname, field) \ -+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -+#define DWC_TAILQ_EMPTY(head) \ -+ (DWC_TAILQ_FIRST(head) == DWC_TAILQ_END(head)) -+ -+#define DWC_TAILQ_FOREACH(var, head, field) \ -+ for ((var) = DWC_TAILQ_FIRST(head); \ -+ (var) != DWC_TAILQ_END(head); \ -+ (var) = DWC_TAILQ_NEXT(var, field)) -+ -+#define DWC_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ -+ for ((var) = DWC_TAILQ_LAST(head, headname); \ -+ (var) != DWC_TAILQ_END(head); \ -+ (var) = DWC_TAILQ_PREV(var, headname, field)) -+ -+/* -+ * Tail queue functions. -+ */ -+#define DWC_TAILQ_INIT(head) do { \ -+ (head)->tqh_first = NULL; \ -+ (head)->tqh_last = &(head)->tqh_first; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_HEAD(head, elm, field) do { \ -+ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ -+ (head)->tqh_first->field.tqe_prev = \ -+ &(elm)->field.tqe_next; \ -+ else \ -+ (head)->tqh_last = &(elm)->field.tqe_next; \ -+ (head)->tqh_first = (elm); \ -+ (elm)->field.tqe_prev = &(head)->tqh_first; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_TAIL(head, elm, field) do { \ -+ (elm)->field.tqe_next = NULL; \ -+ (elm)->field.tqe_prev = (head)->tqh_last; \ -+ *(head)->tqh_last = (elm); \ -+ (head)->tqh_last = &(elm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ -+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ -+ (elm)->field.tqe_next->field.tqe_prev = \ -+ &(elm)->field.tqe_next; \ -+ else \ -+ (head)->tqh_last = &(elm)->field.tqe_next; \ -+ (listelm)->field.tqe_next = (elm); \ -+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ -+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ -+ (elm)->field.tqe_next = (listelm); \ -+ *(listelm)->field.tqe_prev = (elm); \ -+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_REMOVE(head, elm, field) do { \ -+ if (((elm)->field.tqe_next) != NULL) \ -+ (elm)->field.tqe_next->field.tqe_prev = \ -+ (elm)->field.tqe_prev; \ -+ else \ -+ (head)->tqh_last = (elm)->field.tqe_prev; \ -+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_REPLACE(head, elm, elm2, field) do { \ -+ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ -+ (elm2)->field.tqe_next->field.tqe_prev = \ -+ &(elm2)->field.tqe_next; \ -+ else \ -+ (head)->tqh_last = &(elm2)->field.tqe_next; \ -+ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ -+ *(elm2)->field.tqe_prev = (elm2); \ -+} while (0) -+ -+/* -+ * Circular queue definitions. -+ */ -+#define DWC_CIRCLEQ_HEAD(name, type) \ -+struct name { \ -+ struct type *cqh_first; /* first element */ \ -+ struct type *cqh_last; /* last element */ \ -+} -+ -+#define DWC_CIRCLEQ_HEAD_INITIALIZER(head) \ -+ { DWC_CIRCLEQ_END(&head), DWC_CIRCLEQ_END(&head) } -+ -+#define DWC_CIRCLEQ_ENTRY(type) \ -+struct { \ -+ struct type *cqe_next; /* next element */ \ -+ struct type *cqe_prev; /* previous element */ \ -+} -+ -+/* -+ * Circular queue access methods -+ */ -+#define DWC_CIRCLEQ_FIRST(head) ((head)->cqh_first) -+#define DWC_CIRCLEQ_LAST(head) ((head)->cqh_last) -+#define DWC_CIRCLEQ_END(head) ((void *)(head)) -+#define DWC_CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -+#define DWC_CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) -+#define DWC_CIRCLEQ_EMPTY(head) \ -+ (DWC_CIRCLEQ_FIRST(head) == DWC_CIRCLEQ_END(head)) -+ -+#define DWC_CIRCLEQ_EMPTY_ENTRY(elm, field) (((elm)->field.cqe_next == NULL) && ((elm)->field.cqe_prev == NULL)) -+ -+#define DWC_CIRCLEQ_FOREACH(var, head, field) \ -+ for((var) = DWC_CIRCLEQ_FIRST(head); \ -+ (var) != DWC_CIRCLEQ_END(head); \ -+ (var) = DWC_CIRCLEQ_NEXT(var, field)) -+ -+#define DWC_CIRCLEQ_FOREACH_SAFE(var, var2, head, field) \ -+ for((var) = DWC_CIRCLEQ_FIRST(head), var2 = DWC_CIRCLEQ_NEXT(var, field); \ -+ (var) != DWC_CIRCLEQ_END(head); \ -+ (var) = var2, var2 = DWC_CIRCLEQ_NEXT(var, field)) -+ -+#define DWC_CIRCLEQ_FOREACH_REVERSE(var, head, field) \ -+ for((var) = DWC_CIRCLEQ_LAST(head); \ -+ (var) != DWC_CIRCLEQ_END(head); \ -+ (var) = DWC_CIRCLEQ_PREV(var, field)) -+ -+/* -+ * Circular queue functions. -+ */ -+#define DWC_CIRCLEQ_INIT(head) do { \ -+ (head)->cqh_first = DWC_CIRCLEQ_END(head); \ -+ (head)->cqh_last = DWC_CIRCLEQ_END(head); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INIT_ENTRY(elm, field) do { \ -+ (elm)->field.cqe_next = NULL; \ -+ (elm)->field.cqe_prev = NULL; \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ -+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ -+ (elm)->field.cqe_prev = (listelm); \ -+ if ((listelm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_last = (elm); \ -+ else \ -+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ -+ (listelm)->field.cqe_next = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ -+ (elm)->field.cqe_next = (listelm); \ -+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ -+ if ((listelm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_first = (elm); \ -+ else \ -+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ -+ (listelm)->field.cqe_prev = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ -+ (elm)->field.cqe_next = (head)->cqh_first; \ -+ (elm)->field.cqe_prev = DWC_CIRCLEQ_END(head); \ -+ if ((head)->cqh_last == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_last = (elm); \ -+ else \ -+ (head)->cqh_first->field.cqe_prev = (elm); \ -+ (head)->cqh_first = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ -+ (elm)->field.cqe_next = DWC_CIRCLEQ_END(head); \ -+ (elm)->field.cqe_prev = (head)->cqh_last; \ -+ if ((head)->cqh_first == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_first = (elm); \ -+ else \ -+ (head)->cqh_last->field.cqe_next = (elm); \ -+ (head)->cqh_last = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_REMOVE(head, elm, field) do { \ -+ if ((elm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_last = (elm)->field.cqe_prev; \ -+ else \ -+ (elm)->field.cqe_next->field.cqe_prev = \ -+ (elm)->field.cqe_prev; \ -+ if ((elm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_first = (elm)->field.cqe_next; \ -+ else \ -+ (elm)->field.cqe_prev->field.cqe_next = \ -+ (elm)->field.cqe_next; \ -+} while (0) -+ -+#define DWC_CIRCLEQ_REMOVE_INIT(head, elm, field) do { \ -+ DWC_CIRCLEQ_REMOVE(head, elm, field); \ -+ DWC_CIRCLEQ_INIT_ENTRY(elm, field); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ -+ if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \ -+ DWC_CIRCLEQ_END(head)) \ -+ (head).cqh_last = (elm2); \ -+ else \ -+ (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ -+ if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \ -+ DWC_CIRCLEQ_END(head)) \ -+ (head).cqh_first = (elm2); \ -+ else \ -+ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ -+} while (0) -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_LIST_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_mem.c b/drivers/usb/host/dwc_common_port/dwc_mem.c -new file mode 100644 -index 0000000000000000000000000000000000000000..ad645ff1ba7e06c852440396767e69279b3b31db ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_mem.c -@@ -0,0 +1,245 @@ -+/* Memory Debugging */ -+#ifdef DWC_DEBUG_MEMORY -+ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+struct allocation { -+ void *addr; -+ void *ctx; -+ char *func; -+ int line; -+ uint32_t size; -+ int dma; -+ DWC_CIRCLEQ_ENTRY(allocation) entry; -+}; -+ -+DWC_CIRCLEQ_HEAD(allocation_queue, allocation); -+ -+struct allocation_manager { -+ void *mem_ctx; -+ struct allocation_queue allocations; -+ -+ /* statistics */ -+ int num; -+ int num_freed; -+ int num_active; -+ uint32_t total; -+ uint32_t cur; -+ uint32_t max; -+}; -+ -+static struct allocation_manager *manager = NULL; -+ -+static int add_allocation(void *ctx, uint32_t size, char const *func, int line, void *addr, -+ int dma) -+{ -+ struct allocation *a; -+ -+ DWC_ASSERT(manager != NULL, "manager not allocated"); -+ -+ a = __DWC_ALLOC_ATOMIC(manager->mem_ctx, sizeof(*a)); -+ if (!a) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ a->func = __DWC_ALLOC_ATOMIC(manager->mem_ctx, DWC_STRLEN(func) + 1); -+ if (!a->func) { -+ __DWC_FREE(manager->mem_ctx, a); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_MEMCPY(a->func, func, DWC_STRLEN(func) + 1); -+ a->addr = addr; -+ a->ctx = ctx; -+ a->line = line; -+ a->size = size; -+ a->dma = dma; -+ DWC_CIRCLEQ_INSERT_TAIL(&manager->allocations, a, entry); -+ -+ /* Update stats */ -+ manager->num++; -+ manager->num_active++; -+ manager->total += size; -+ manager->cur += size; -+ -+ if (manager->max < manager->cur) { -+ manager->max = manager->cur; -+ } -+ -+ return 0; -+} -+ -+static struct allocation *find_allocation(void *ctx, void *addr) -+{ -+ struct allocation *a; -+ -+ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { -+ if (a->ctx == ctx && a->addr == addr) { -+ return a; -+ } -+ } -+ -+ return NULL; -+} -+ -+static void free_allocation(void *ctx, void *addr, char const *func, int line) -+{ -+ struct allocation *a = find_allocation(ctx, addr); -+ -+ if (!a) { -+ DWC_ASSERT(0, -+ "Free of address %p that was never allocated or already freed %s:%d", -+ addr, func, line); -+ return; -+ } -+ -+ DWC_CIRCLEQ_REMOVE(&manager->allocations, a, entry); -+ -+ manager->num_active--; -+ manager->num_freed++; -+ manager->cur -= a->size; -+ __DWC_FREE(manager->mem_ctx, a->func); -+ __DWC_FREE(manager->mem_ctx, a); -+} -+ -+int dwc_memory_debug_start(void *mem_ctx) -+{ -+ DWC_ASSERT(manager == NULL, "Memory debugging has already started\n"); -+ -+ if (manager) { -+ return -DWC_E_BUSY; -+ } -+ -+ manager = __DWC_ALLOC(mem_ctx, sizeof(*manager)); -+ if (!manager) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_CIRCLEQ_INIT(&manager->allocations); -+ manager->mem_ctx = mem_ctx; -+ manager->num = 0; -+ manager->num_freed = 0; -+ manager->num_active = 0; -+ manager->total = 0; -+ manager->cur = 0; -+ manager->max = 0; -+ -+ return 0; -+} -+ -+void dwc_memory_debug_stop(void) -+{ -+ struct allocation *a; -+ -+ dwc_memory_debug_report(); -+ -+ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { -+ DWC_ERROR("Memory leaked from %s:%d\n", a->func, a->line); -+ free_allocation(a->ctx, a->addr, NULL, -1); -+ } -+ -+ __DWC_FREE(manager->mem_ctx, manager); -+} -+ -+void dwc_memory_debug_report(void) -+{ -+ struct allocation *a; -+ -+ DWC_PRINTF("\n\n\n----------------- Memory Debugging Report -----------------\n\n"); -+ DWC_PRINTF("Num Allocations = %d\n", manager->num); -+ DWC_PRINTF("Freed = %d\n", manager->num_freed); -+ DWC_PRINTF("Active = %d\n", manager->num_active); -+ DWC_PRINTF("Current Memory Used = %d\n", manager->cur); -+ DWC_PRINTF("Total Memory Used = %d\n", manager->total); -+ DWC_PRINTF("Maximum Memory Used at Once = %d\n", manager->max); -+ DWC_PRINTF("Unfreed allocations:\n"); -+ -+ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { -+ DWC_PRINTF(" addr=%p, size=%d from %s:%d, DMA=%d\n", -+ a->addr, a->size, a->func, a->line, a->dma); -+ } -+} -+ -+/* The replacement functions */ -+void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line) -+{ -+ void *addr = __DWC_ALLOC(mem_ctx, size); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { -+ __DWC_FREE(mem_ctx, addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, -+ int line) -+{ -+ void *addr = __DWC_ALLOC_ATOMIC(mem_ctx, size); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { -+ __DWC_FREE(mem_ctx, addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line) -+{ -+ free_allocation(mem_ctx, addr, func, line); -+ __DWC_FREE(mem_ctx, addr); -+} -+ -+void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, -+ char const *func, int line) -+{ -+ void *addr = __DWC_DMA_ALLOC(dma_ctx, size, dma_addr); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { -+ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, -+ dwc_dma_t *dma_addr, char const *func, int line) -+{ -+ void *addr = __DWC_DMA_ALLOC_ATOMIC(dma_ctx, size, dma_addr); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { -+ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, -+ dwc_dma_t dma_addr, char const *func, int line) -+{ -+ free_allocation(dma_ctx, virt_addr, func, line); -+ __DWC_DMA_FREE(dma_ctx, size, virt_addr, dma_addr); -+} -+ -+#endif /* DWC_DEBUG_MEMORY */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.c b/drivers/usb/host/dwc_common_port/dwc_modpow.c -new file mode 100644 -index 0000000000000000000000000000000000000000..20045381208a31d5dfb420318b0a4fbb1eca51a1 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_modpow.c -@@ -0,0 +1,636 @@ -+/* Bignum routines adapted from PUTTY sources. PuTTY copyright notice follows. -+ * -+ * PuTTY is copyright 1997-2007 Simon Tatham. -+ * -+ * Portions copyright Robert de Bath, Joris van Rantwijk, Delian -+ * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, -+ * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus -+ * Kuhn, and CORE SDI S.A. -+ * -+ * 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 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. -+ * -+ */ -+#ifdef DWC_CRYPTOLIB -+ -+#ifndef CONFIG_MACH_IPMATE -+ -+#include "dwc_modpow.h" -+ -+#define BIGNUM_INT_MASK 0xFFFFFFFFUL -+#define BIGNUM_TOP_BIT 0x80000000UL -+#define BIGNUM_INT_BITS 32 -+ -+ -+static void *snmalloc(void *mem_ctx, size_t n, size_t size) -+{ -+ void *p; -+ size *= n; -+ if (size == 0) size = 1; -+ p = dwc_alloc(mem_ctx, size); -+ return p; -+} -+ -+#define snewn(ctx, n, type) ((type *)snmalloc((ctx), (n), sizeof(type))) -+#define sfree dwc_free -+ -+/* -+ * Usage notes: -+ * * Do not call the DIVMOD_WORD macro with expressions such as array -+ * subscripts, as some implementations object to this (see below). -+ * * Note that none of the division methods below will cope if the -+ * quotient won't fit into BIGNUM_INT_BITS. Callers should be careful -+ * to avoid this case. -+ * If this condition occurs, in the case of the x86 DIV instruction, -+ * an overflow exception will occur, which (according to a correspondent) -+ * will manifest on Windows as something like -+ * 0xC0000095: Integer overflow -+ * The C variant won't give the right answer, either. -+ */ -+ -+#define MUL_WORD(w1, w2) ((BignumDblInt)w1 * w2) -+ -+#if defined __GNUC__ && defined __i386__ -+#define DIVMOD_WORD(q, r, hi, lo, w) \ -+ __asm__("div %2" : \ -+ "=d" (r), "=a" (q) : \ -+ "r" (w), "d" (hi), "a" (lo)) -+#else -+#define DIVMOD_WORD(q, r, hi, lo, w) do { \ -+ BignumDblInt n = (((BignumDblInt)hi) << BIGNUM_INT_BITS) | lo; \ -+ q = n / w; \ -+ r = n % w; \ -+} while (0) -+#endif -+ -+// q = n / w; -+// r = n % w; -+ -+#define BIGNUM_INT_BYTES (BIGNUM_INT_BITS / 8) -+ -+#define BIGNUM_INTERNAL -+ -+static Bignum newbn(void *mem_ctx, int length) -+{ -+ Bignum b = snewn(mem_ctx, length + 1, BignumInt); -+ //if (!b) -+ //abort(); /* FIXME */ -+ DWC_MEMSET(b, 0, (length + 1) * sizeof(*b)); -+ b[0] = length; -+ return b; -+} -+ -+void freebn(void *mem_ctx, Bignum b) -+{ -+ /* -+ * Burn the evidence, just in case. -+ */ -+ DWC_MEMSET(b, 0, sizeof(b[0]) * (b[0] + 1)); -+ sfree(mem_ctx, b); -+} -+ -+/* -+ * Compute c = a * b. -+ * Input is in the first len words of a and b. -+ * Result is returned in the first 2*len words of c. -+ */ -+static void internal_mul(BignumInt *a, BignumInt *b, -+ BignumInt *c, int len) -+{ -+ int i, j; -+ BignumDblInt t; -+ -+ for (j = 0; j < 2 * len; j++) -+ c[j] = 0; -+ -+ for (i = len - 1; i >= 0; i--) { -+ t = 0; -+ for (j = len - 1; j >= 0; j--) { -+ t += MUL_WORD(a[i], (BignumDblInt) b[j]); -+ t += (BignumDblInt) c[i + j + 1]; -+ c[i + j + 1] = (BignumInt) t; -+ t = t >> BIGNUM_INT_BITS; -+ } -+ c[i] = (BignumInt) t; -+ } -+} -+ -+static void internal_add_shifted(BignumInt *number, -+ unsigned n, int shift) -+{ -+ int word = 1 + (shift / BIGNUM_INT_BITS); -+ int bshift = shift % BIGNUM_INT_BITS; -+ BignumDblInt addend; -+ -+ addend = (BignumDblInt)n << bshift; -+ -+ while (addend) { -+ addend += number[word]; -+ number[word] = (BignumInt) addend & BIGNUM_INT_MASK; -+ addend >>= BIGNUM_INT_BITS; -+ word++; -+ } -+} -+ -+/* -+ * Compute a = a % m. -+ * Input in first alen words of a and first mlen words of m. -+ * Output in first alen words of a -+ * (of which first alen-mlen words will be zero). -+ * The MSW of m MUST have its high bit set. -+ * Quotient is accumulated in the `quotient' array, which is a Bignum -+ * rather than the internal bigendian format. Quotient parts are shifted -+ * left by `qshift' before adding into quot. -+ */ -+static void internal_mod(BignumInt *a, int alen, -+ BignumInt *m, int mlen, -+ BignumInt *quot, int qshift) -+{ -+ BignumInt m0, m1; -+ unsigned int h; -+ int i, k; -+ -+ m0 = m[0]; -+ if (mlen > 1) -+ m1 = m[1]; -+ else -+ m1 = 0; -+ -+ for (i = 0; i <= alen - mlen; i++) { -+ BignumDblInt t; -+ unsigned int q, r, c, ai1; -+ -+ if (i == 0) { -+ h = 0; -+ } else { -+ h = a[i - 1]; -+ a[i - 1] = 0; -+ } -+ -+ if (i == alen - 1) -+ ai1 = 0; -+ else -+ ai1 = a[i + 1]; -+ -+ /* Find q = h:a[i] / m0 */ -+ if (h >= m0) { -+ /* -+ * Special case. -+ * -+ * To illustrate it, suppose a BignumInt is 8 bits, and -+ * we are dividing (say) A1:23:45:67 by A1:B2:C3. Then -+ * our initial division will be 0xA123 / 0xA1, which -+ * will give a quotient of 0x100 and a divide overflow. -+ * However, the invariants in this division algorithm -+ * are not violated, since the full number A1:23:... is -+ * _less_ than the quotient prefix A1:B2:... and so the -+ * following correction loop would have sorted it out. -+ * -+ * In this situation we set q to be the largest -+ * quotient we _can_ stomach (0xFF, of course). -+ */ -+ q = BIGNUM_INT_MASK; -+ } else { -+ /* Macro doesn't want an array subscript expression passed -+ * into it (see definition), so use a temporary. */ -+ BignumInt tmplo = a[i]; -+ DIVMOD_WORD(q, r, h, tmplo, m0); -+ -+ /* Refine our estimate of q by looking at -+ h:a[i]:a[i+1] / m0:m1 */ -+ t = MUL_WORD(m1, q); -+ if (t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) { -+ q--; -+ t -= m1; -+ r = (r + m0) & BIGNUM_INT_MASK; /* overflow? */ -+ if (r >= (BignumDblInt) m0 && -+ t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) q--; -+ } -+ } -+ -+ /* Subtract q * m from a[i...] */ -+ c = 0; -+ for (k = mlen - 1; k >= 0; k--) { -+ t = MUL_WORD(q, m[k]); -+ t += c; -+ c = (unsigned)(t >> BIGNUM_INT_BITS); -+ if ((BignumInt) t > a[i + k]) -+ c++; -+ a[i + k] -= (BignumInt) t; -+ } -+ -+ /* Add back m in case of borrow */ -+ if (c != h) { -+ t = 0; -+ for (k = mlen - 1; k >= 0; k--) { -+ t += m[k]; -+ t += a[i + k]; -+ a[i + k] = (BignumInt) t; -+ t = t >> BIGNUM_INT_BITS; -+ } -+ q--; -+ } -+ if (quot) -+ internal_add_shifted(quot, q, qshift + BIGNUM_INT_BITS * (alen - mlen - i)); -+ } -+} -+ -+/* -+ * Compute p % mod. -+ * The most significant word of mod MUST be non-zero. -+ * We assume that the result array is the same size as the mod array. -+ * We optionally write out a quotient if `quotient' is non-NULL. -+ * We can avoid writing out the result if `result' is NULL. -+ */ -+void bigdivmod(void *mem_ctx, Bignum p, Bignum mod, Bignum result, Bignum quotient) -+{ -+ BignumInt *n, *m; -+ int mshift; -+ int plen, mlen, i, j; -+ -+ /* Allocate m of size mlen, copy mod to m */ -+ /* We use big endian internally */ -+ mlen = mod[0]; -+ m = snewn(mem_ctx, mlen, BignumInt); -+ //if (!m) -+ //abort(); /* FIXME */ -+ for (j = 0; j < mlen; j++) -+ m[j] = mod[mod[0] - j]; -+ -+ /* Shift m left to make msb bit set */ -+ for (mshift = 0; mshift < BIGNUM_INT_BITS-1; mshift++) -+ if ((m[0] << mshift) & BIGNUM_TOP_BIT) -+ break; -+ if (mshift) { -+ for (i = 0; i < mlen - 1; i++) -+ m[i] = (m[i] << mshift) | (m[i + 1] >> (BIGNUM_INT_BITS - mshift)); -+ m[mlen - 1] = m[mlen - 1] << mshift; -+ } -+ -+ plen = p[0]; -+ /* Ensure plen > mlen */ -+ if (plen <= mlen) -+ plen = mlen + 1; -+ -+ /* Allocate n of size plen, copy p to n */ -+ n = snewn(mem_ctx, plen, BignumInt); -+ //if (!n) -+ //abort(); /* FIXME */ -+ for (j = 0; j < plen; j++) -+ n[j] = 0; -+ for (j = 1; j <= (int)p[0]; j++) -+ n[plen - j] = p[j]; -+ -+ /* Main computation */ -+ internal_mod(n, plen, m, mlen, quotient, mshift); -+ -+ /* Fixup result in case the modulus was shifted */ -+ if (mshift) { -+ for (i = plen - mlen - 1; i < plen - 1; i++) -+ n[i] = (n[i] << mshift) | (n[i + 1] >> (BIGNUM_INT_BITS - mshift)); -+ n[plen - 1] = n[plen - 1] << mshift; -+ internal_mod(n, plen, m, mlen, quotient, 0); -+ for (i = plen - 1; i >= plen - mlen; i--) -+ n[i] = (n[i] >> mshift) | (n[i - 1] << (BIGNUM_INT_BITS - mshift)); -+ } -+ -+ /* Copy result to buffer */ -+ if (result) { -+ for (i = 1; i <= (int)result[0]; i++) { -+ int j = plen - i; -+ result[i] = j >= 0 ? n[j] : 0; -+ } -+ } -+ -+ /* Free temporary arrays */ -+ for (i = 0; i < mlen; i++) -+ m[i] = 0; -+ sfree(mem_ctx, m); -+ for (i = 0; i < plen; i++) -+ n[i] = 0; -+ sfree(mem_ctx, n); -+} -+ -+/* -+ * Simple remainder. -+ */ -+Bignum bigmod(void *mem_ctx, Bignum a, Bignum b) -+{ -+ Bignum r = newbn(mem_ctx, b[0]); -+ bigdivmod(mem_ctx, a, b, r, NULL); -+ return r; -+} -+ -+/* -+ * Compute (base ^ exp) % mod. -+ */ -+Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod) -+{ -+ BignumInt *a, *b, *n, *m; -+ int mshift; -+ int mlen, i, j; -+ Bignum base, result; -+ -+ /* -+ * The most significant word of mod needs to be non-zero. It -+ * should already be, but let's make sure. -+ */ -+ //assert(mod[mod[0]] != 0); -+ -+ /* -+ * Make sure the base is smaller than the modulus, by reducing -+ * it modulo the modulus if not. -+ */ -+ base = bigmod(mem_ctx, base_in, mod); -+ -+ /* Allocate m of size mlen, copy mod to m */ -+ /* We use big endian internally */ -+ mlen = mod[0]; -+ m = snewn(mem_ctx, mlen, BignumInt); -+ //if (!m) -+ //abort(); /* FIXME */ -+ for (j = 0; j < mlen; j++) -+ m[j] = mod[mod[0] - j]; -+ -+ /* Shift m left to make msb bit set */ -+ for (mshift = 0; mshift < BIGNUM_INT_BITS - 1; mshift++) -+ if ((m[0] << mshift) & BIGNUM_TOP_BIT) -+ break; -+ if (mshift) { -+ for (i = 0; i < mlen - 1; i++) -+ m[i] = -+ (m[i] << mshift) | (m[i + 1] >> -+ (BIGNUM_INT_BITS - mshift)); -+ m[mlen - 1] = m[mlen - 1] << mshift; -+ } -+ -+ /* Allocate n of size mlen, copy base to n */ -+ n = snewn(mem_ctx, mlen, BignumInt); -+ //if (!n) -+ //abort(); /* FIXME */ -+ i = mlen - base[0]; -+ for (j = 0; j < i; j++) -+ n[j] = 0; -+ for (j = 0; j < base[0]; j++) -+ n[i + j] = base[base[0] - j]; -+ -+ /* Allocate a and b of size 2*mlen. Set a = 1 */ -+ a = snewn(mem_ctx, 2 * mlen, BignumInt); -+ //if (!a) -+ //abort(); /* FIXME */ -+ b = snewn(mem_ctx, 2 * mlen, BignumInt); -+ //if (!b) -+ //abort(); /* FIXME */ -+ for (i = 0; i < 2 * mlen; i++) -+ a[i] = 0; -+ a[2 * mlen - 1] = 1; -+ -+ /* Skip leading zero bits of exp. */ -+ i = 0; -+ j = BIGNUM_INT_BITS - 1; -+ while (i < exp[0] && (exp[exp[0] - i] & (1 << j)) == 0) { -+ j--; -+ if (j < 0) { -+ i++; -+ j = BIGNUM_INT_BITS - 1; -+ } -+ } -+ -+ /* Main computation */ -+ while (i < exp[0]) { -+ while (j >= 0) { -+ internal_mul(a + mlen, a + mlen, b, mlen); -+ internal_mod(b, mlen * 2, m, mlen, NULL, 0); -+ if ((exp[exp[0] - i] & (1 << j)) != 0) { -+ internal_mul(b + mlen, n, a, mlen); -+ internal_mod(a, mlen * 2, m, mlen, NULL, 0); -+ } else { -+ BignumInt *t; -+ t = a; -+ a = b; -+ b = t; -+ } -+ j--; -+ } -+ i++; -+ j = BIGNUM_INT_BITS - 1; -+ } -+ -+ /* Fixup result in case the modulus was shifted */ -+ if (mshift) { -+ for (i = mlen - 1; i < 2 * mlen - 1; i++) -+ a[i] = -+ (a[i] << mshift) | (a[i + 1] >> -+ (BIGNUM_INT_BITS - mshift)); -+ a[2 * mlen - 1] = a[2 * mlen - 1] << mshift; -+ internal_mod(a, mlen * 2, m, mlen, NULL, 0); -+ for (i = 2 * mlen - 1; i >= mlen; i--) -+ a[i] = -+ (a[i] >> mshift) | (a[i - 1] << -+ (BIGNUM_INT_BITS - mshift)); -+ } -+ -+ /* Copy result to buffer */ -+ result = newbn(mem_ctx, mod[0]); -+ for (i = 0; i < mlen; i++) -+ result[result[0] - i] = a[i + mlen]; -+ while (result[0] > 1 && result[result[0]] == 0) -+ result[0]--; -+ -+ /* Free temporary arrays */ -+ for (i = 0; i < 2 * mlen; i++) -+ a[i] = 0; -+ sfree(mem_ctx, a); -+ for (i = 0; i < 2 * mlen; i++) -+ b[i] = 0; -+ sfree(mem_ctx, b); -+ for (i = 0; i < mlen; i++) -+ m[i] = 0; -+ sfree(mem_ctx, m); -+ for (i = 0; i < mlen; i++) -+ n[i] = 0; -+ sfree(mem_ctx, n); -+ -+ freebn(mem_ctx, base); -+ -+ return result; -+} -+ -+ -+#ifdef UNITTEST -+ -+static __u32 dh_p[] = { -+ 96, -+ 0xFFFFFFFF, -+ 0xFFFFFFFF, -+ 0xA93AD2CA, -+ 0x4B82D120, -+ 0xE0FD108E, -+ 0x43DB5BFC, -+ 0x74E5AB31, -+ 0x08E24FA0, -+ 0xBAD946E2, -+ 0x770988C0, -+ 0x7A615D6C, -+ 0xBBE11757, -+ 0x177B200C, -+ 0x521F2B18, -+ 0x3EC86A64, -+ 0xD8760273, -+ 0xD98A0864, -+ 0xF12FFA06, -+ 0x1AD2EE6B, -+ 0xCEE3D226, -+ 0x4A25619D, -+ 0x1E8C94E0, -+ 0xDB0933D7, -+ 0xABF5AE8C, -+ 0xA6E1E4C7, -+ 0xB3970F85, -+ 0x5D060C7D, -+ 0x8AEA7157, -+ 0x58DBEF0A, -+ 0xECFB8504, -+ 0xDF1CBA64, -+ 0xA85521AB, -+ 0x04507A33, -+ 0xAD33170D, -+ 0x8AAAC42D, -+ 0x15728E5A, -+ 0x98FA0510, -+ 0x15D22618, -+ 0xEA956AE5, -+ 0x3995497C, -+ 0x95581718, -+ 0xDE2BCBF6, -+ 0x6F4C52C9, -+ 0xB5C55DF0, -+ 0xEC07A28F, -+ 0x9B2783A2, -+ 0x180E8603, -+ 0xE39E772C, -+ 0x2E36CE3B, -+ 0x32905E46, -+ 0xCA18217C, -+ 0xF1746C08, -+ 0x4ABC9804, -+ 0x670C354E, -+ 0x7096966D, -+ 0x9ED52907, -+ 0x208552BB, -+ 0x1C62F356, -+ 0xDCA3AD96, -+ 0x83655D23, -+ 0xFD24CF5F, -+ 0x69163FA8, -+ 0x1C55D39A, -+ 0x98DA4836, -+ 0xA163BF05, -+ 0xC2007CB8, -+ 0xECE45B3D, -+ 0x49286651, -+ 0x7C4B1FE6, -+ 0xAE9F2411, -+ 0x5A899FA5, -+ 0xEE386BFB, -+ 0xF406B7ED, -+ 0x0BFF5CB6, -+ 0xA637ED6B, -+ 0xF44C42E9, -+ 0x625E7EC6, -+ 0xE485B576, -+ 0x6D51C245, -+ 0x4FE1356D, -+ 0xF25F1437, -+ 0x302B0A6D, -+ 0xCD3A431B, -+ 0xEF9519B3, -+ 0x8E3404DD, -+ 0x514A0879, -+ 0x3B139B22, -+ 0x020BBEA6, -+ 0x8A67CC74, -+ 0x29024E08, -+ 0x80DC1CD1, -+ 0xC4C6628B, -+ 0x2168C234, -+ 0xC90FDAA2, -+ 0xFFFFFFFF, -+ 0xFFFFFFFF, -+}; -+ -+static __u32 dh_a[] = { -+ 8, -+ 0xdf367516, -+ 0x86459caa, -+ 0xe2d459a4, -+ 0xd910dae0, -+ 0x8a8b5e37, -+ 0x67ab31c6, -+ 0xf0b55ea9, -+ 0x440051d6, -+}; -+ -+static __u32 dh_b[] = { -+ 8, -+ 0xded92656, -+ 0xe07a048a, -+ 0x6fa452cd, -+ 0x2df89d30, -+ 0xc75f1b0f, -+ 0x8ce3578f, -+ 0x7980a324, -+ 0x5daec786, -+}; -+ -+static __u32 dh_g[] = { -+ 1, -+ 2, -+}; -+ -+int main(void) -+{ -+ int i; -+ __u32 *k; -+ k = dwc_modpow(NULL, dh_g, dh_a, dh_p); -+ -+ printf("\n\n"); -+ for (i=0; i> 16; -+ printf("%04x %04x ", m, l); -+ if (!((i + 1)%13)) printf("\n"); -+ } -+ printf("\n\n"); -+ -+ if ((k[0] == 0x60) && (k[1] == 0x28e490e5) && (k[0x60] == 0x5a0d3d4e)) { -+ printf("PASS\n\n"); -+ } -+ else { -+ printf("FAIL\n\n"); -+ } -+ -+} -+ -+#endif /* UNITTEST */ -+ -+#endif /* CONFIG_MACH_IPMATE */ -+ -+#endif /*DWC_CRYPTOLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.h b/drivers/usb/host/dwc_common_port/dwc_modpow.h -new file mode 100644 -index 0000000000000000000000000000000000000000..64f00c276e71bf2e1d58bc9e02ff64c13489dbd4 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_modpow.h -@@ -0,0 +1,34 @@ -+/* -+ * dwc_modpow.h -+ * See dwc_modpow.c for license and changes -+ */ -+#ifndef _DWC_MODPOW_H -+#define _DWC_MODPOW_H -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#include "dwc_os.h" -+ -+/** @file -+ * -+ * This file defines the module exponentiation function which is only used -+ * internally by the DWC UWB modules for calculation of PKs during numeric -+ * association. The routine is taken from the PUTTY, an open source terminal -+ * emulator. The PUTTY License is preserved in the dwc_modpow.c file. -+ * -+ */ -+ -+typedef uint32_t BignumInt; -+typedef uint64_t BignumDblInt; -+typedef BignumInt *Bignum; -+ -+/* Compute modular exponentiaion */ -+extern Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _LINUX_BIGNUM_H */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.c b/drivers/usb/host/dwc_common_port/dwc_notifier.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8b3772afe11d1d81bdb7cabe335f0f3bc834fb7a ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_notifier.c -@@ -0,0 +1,319 @@ -+#ifdef DWC_NOTIFYLIB -+ -+#include "dwc_notifier.h" -+#include "dwc_list.h" -+ -+typedef struct dwc_observer { -+ void *observer; -+ dwc_notifier_callback_t callback; -+ void *data; -+ char *notification; -+ DWC_CIRCLEQ_ENTRY(dwc_observer) list_entry; -+} observer_t; -+ -+DWC_CIRCLEQ_HEAD(observer_queue, dwc_observer); -+ -+typedef struct dwc_notifier { -+ void *mem_ctx; -+ void *object; -+ struct observer_queue observers; -+ DWC_CIRCLEQ_ENTRY(dwc_notifier) list_entry; -+} notifier_t; -+ -+DWC_CIRCLEQ_HEAD(notifier_queue, dwc_notifier); -+ -+typedef struct manager { -+ void *mem_ctx; -+ void *wkq_ctx; -+ dwc_workq_t *wq; -+// dwc_mutex_t *mutex; -+ struct notifier_queue notifiers; -+} manager_t; -+ -+static manager_t *manager = NULL; -+ -+static int create_manager(void *mem_ctx, void *wkq_ctx) -+{ -+ manager = dwc_alloc(mem_ctx, sizeof(manager_t)); -+ if (!manager) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_CIRCLEQ_INIT(&manager->notifiers); -+ -+ manager->wq = dwc_workq_alloc(wkq_ctx, "DWC Notification WorkQ"); -+ if (!manager->wq) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ return 0; -+} -+ -+static void free_manager(void) -+{ -+ dwc_workq_free(manager->wq); -+ -+ /* All notifiers must have unregistered themselves before this module -+ * can be removed. Hitting this assertion indicates a programmer -+ * error. */ -+ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(&manager->notifiers), -+ "Notification manager being freed before all notifiers have been removed"); -+ dwc_free(manager->mem_ctx, manager); -+} -+ -+#ifdef DEBUG -+static void dump_manager(void) -+{ -+ notifier_t *n; -+ observer_t *o; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ DWC_DEBUG("List of all notifiers and observers:\n"); -+ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { -+ DWC_DEBUG("Notifier %p has observers:\n", n->object); -+ DWC_CIRCLEQ_FOREACH(o, &n->observers, list_entry) { -+ DWC_DEBUG(" %p watching %s\n", o->observer, o->notification); -+ } -+ } -+} -+#else -+#define dump_manager(...) -+#endif -+ -+static observer_t *alloc_observer(void *mem_ctx, void *observer, char *notification, -+ dwc_notifier_callback_t callback, void *data) -+{ -+ observer_t *new_observer = dwc_alloc(mem_ctx, sizeof(observer_t)); -+ -+ if (!new_observer) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INIT_ENTRY(new_observer, list_entry); -+ new_observer->observer = observer; -+ new_observer->notification = notification; -+ new_observer->callback = callback; -+ new_observer->data = data; -+ return new_observer; -+} -+ -+static void free_observer(void *mem_ctx, observer_t *observer) -+{ -+ dwc_free(mem_ctx, observer); -+} -+ -+static notifier_t *alloc_notifier(void *mem_ctx, void *object) -+{ -+ notifier_t *notifier; -+ -+ if (!object) { -+ return NULL; -+ } -+ -+ notifier = dwc_alloc(mem_ctx, sizeof(notifier_t)); -+ if (!notifier) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INIT(¬ifier->observers); -+ DWC_CIRCLEQ_INIT_ENTRY(notifier, list_entry); -+ -+ notifier->mem_ctx = mem_ctx; -+ notifier->object = object; -+ return notifier; -+} -+ -+static void free_notifier(notifier_t *notifier) -+{ -+ observer_t *observer; -+ -+ DWC_CIRCLEQ_FOREACH(observer, ¬ifier->observers, list_entry) { -+ free_observer(notifier->mem_ctx, observer); -+ } -+ -+ dwc_free(notifier->mem_ctx, notifier); -+} -+ -+static notifier_t *find_notifier(void *object) -+{ -+ notifier_t *notifier; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ if (!object) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_FOREACH(notifier, &manager->notifiers, list_entry) { -+ if (notifier->object == object) { -+ return notifier; -+ } -+ } -+ -+ return NULL; -+} -+ -+int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx) -+{ -+ return create_manager(mem_ctx, wkq_ctx); -+} -+ -+void dwc_free_notification_manager(void) -+{ -+ free_manager(); -+} -+ -+dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object) -+{ -+ notifier_t *notifier; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ notifier = find_notifier(object); -+ if (notifier) { -+ DWC_ERROR("Notifier %p is already registered\n", object); -+ return NULL; -+ } -+ -+ notifier = alloc_notifier(mem_ctx, object); -+ if (!notifier) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INSERT_TAIL(&manager->notifiers, notifier, list_entry); -+ -+ DWC_INFO("Notifier %p registered", object); -+ dump_manager(); -+ -+ return notifier; -+} -+ -+void dwc_unregister_notifier(dwc_notifier_t *notifier) -+{ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ if (!DWC_CIRCLEQ_EMPTY(¬ifier->observers)) { -+ observer_t *o; -+ -+ DWC_ERROR("Notifier %p has active observers when removing\n", notifier->object); -+ DWC_CIRCLEQ_FOREACH(o, ¬ifier->observers, list_entry) { -+ DWC_DEBUGC(" %p watching %s\n", o->observer, o->notification); -+ } -+ -+ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(¬ifier->observers), -+ "Notifier %p has active observers when removing", notifier); -+ } -+ -+ DWC_CIRCLEQ_REMOVE_INIT(&manager->notifiers, notifier, list_entry); -+ free_notifier(notifier); -+ -+ DWC_INFO("Notifier unregistered"); -+ dump_manager(); -+} -+ -+/* Add an observer to observe the notifier for a particular state, event, or notification. */ -+int dwc_add_observer(void *observer, void *object, char *notification, -+ dwc_notifier_callback_t callback, void *data) -+{ -+ notifier_t *notifier = find_notifier(object); -+ observer_t *new_observer; -+ -+ if (!notifier) { -+ DWC_ERROR("Notifier %p is not found when adding observer\n", object); -+ return -DWC_E_INVALID; -+ } -+ -+ new_observer = alloc_observer(notifier->mem_ctx, observer, notification, callback, data); -+ if (!new_observer) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_CIRCLEQ_INSERT_TAIL(¬ifier->observers, new_observer, list_entry); -+ -+ DWC_INFO("Added observer %p to notifier %p observing notification %s, callback=%p, data=%p", -+ observer, object, notification, callback, data); -+ -+ dump_manager(); -+ return 0; -+} -+ -+int dwc_remove_observer(void *observer) -+{ -+ notifier_t *n; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { -+ observer_t *o; -+ observer_t *o2; -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(o, o2, &n->observers, list_entry) { -+ if (o->observer == observer) { -+ DWC_CIRCLEQ_REMOVE_INIT(&n->observers, o, list_entry); -+ DWC_INFO("Removing observer %p from notifier %p watching notification %s:", -+ o->observer, n->object, o->notification); -+ free_observer(n->mem_ctx, o); -+ } -+ } -+ } -+ -+ dump_manager(); -+ return 0; -+} -+ -+typedef struct callback_data { -+ void *mem_ctx; -+ dwc_notifier_callback_t cb; -+ void *observer; -+ void *data; -+ void *object; -+ char *notification; -+ void *notification_data; -+} cb_data_t; -+ -+static void cb_task(void *data) -+{ -+ cb_data_t *cb = (cb_data_t *)data; -+ -+ cb->cb(cb->object, cb->notification, cb->observer, cb->notification_data, cb->data); -+ dwc_free(cb->mem_ctx, cb); -+} -+ -+void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data) -+{ -+ observer_t *o; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ DWC_CIRCLEQ_FOREACH(o, ¬ifier->observers, list_entry) { -+ int len = DWC_STRLEN(notification); -+ -+ if (DWC_STRLEN(o->notification) != len) { -+ continue; -+ } -+ -+ if (DWC_STRNCMP(o->notification, notification, len) == 0) { -+ cb_data_t *cb_data = dwc_alloc(notifier->mem_ctx, sizeof(cb_data_t)); -+ -+ if (!cb_data) { -+ DWC_ERROR("Failed to allocate callback data\n"); -+ return; -+ } -+ -+ cb_data->mem_ctx = notifier->mem_ctx; -+ cb_data->cb = o->callback; -+ cb_data->observer = o->observer; -+ cb_data->data = o->data; -+ cb_data->object = notifier->object; -+ cb_data->notification = notification; -+ cb_data->notification_data = notification_data; -+ DWC_DEBUGC("Observer found %p for notification %s\n", o->observer, notification); -+ DWC_WORKQ_SCHEDULE(manager->wq, cb_task, cb_data, -+ "Notify callback from %p for Notification %s, to observer %p", -+ cb_data->object, notification, cb_data->observer); -+ } -+ } -+} -+ -+#endif /* DWC_NOTIFYLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.h b/drivers/usb/host/dwc_common_port/dwc_notifier.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4a8cdfe565b1fcefb400706dc7bc13cf69a9d3b2 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_notifier.h -@@ -0,0 +1,122 @@ -+ -+#ifndef __DWC_NOTIFIER_H__ -+#define __DWC_NOTIFIER_H__ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#include "dwc_os.h" -+ -+/** @file -+ * -+ * A simple implementation of the Observer pattern. Any "module" can -+ * register as an observer or notifier. The notion of "module" is abstract and -+ * can mean anything used to identify either an observer or notifier. Usually -+ * it will be a pointer to a data structure which contains some state, ie an -+ * object. -+ * -+ * Before any notifiers can be added, the global notification manager must be -+ * brought up with dwc_alloc_notification_manager(). -+ * dwc_free_notification_manager() will bring it down and free all resources. -+ * These would typically be called upon module load and unload. The -+ * notification manager is a single global instance that handles all registered -+ * observable modules and observers so this should be done only once. -+ * -+ * A module can be observable by using Notifications to publicize some general -+ * information about it's state or operation. It does not care who listens, or -+ * even if anyone listens, or what they do with the information. The observable -+ * modules do not need to know any information about it's observers or their -+ * interface, or their state or data. -+ * -+ * Any module can register to emit Notifications. It should publish a list of -+ * notifications that it can emit and their behavior, such as when they will get -+ * triggered, and what information will be provided to the observer. Then it -+ * should register itself as an observable module. See dwc_register_notifier(). -+ * -+ * Any module can observe any observable, registered module, provided it has a -+ * handle to the other module and knows what notifications to observe. See -+ * dwc_add_observer(). -+ * -+ * A function of type dwc_notifier_callback_t is called whenever a notification -+ * is triggered with one or more observers observing it. This function is -+ * called in it's own process so it may sleep or block if needed. It is -+ * guaranteed to be called sometime after the notification has occurred and will -+ * be called once per each time the notification is triggered. It will NOT be -+ * called in the same process context used to trigger the notification. -+ * -+ * @section Limitiations -+ * -+ * Keep in mind that Notifications that can be triggered in rapid sucession may -+ * schedule too many processes too handle. Be aware of this limitation when -+ * designing to use notifications, and only add notifications for appropriate -+ * observable information. -+ * -+ * Also Notification callbacks are not synchronous. If you need to synchronize -+ * the behavior between module/observer you must use other means. And perhaps -+ * that will mean Notifications are not the proper solution. -+ */ -+ -+struct dwc_notifier; -+typedef struct dwc_notifier dwc_notifier_t; -+ -+/** The callback function must be of this type. -+ * -+ * @param object This is the object that is being observed. -+ * @param notification This is the notification that was triggered. -+ * @param observer This is the observer -+ * @param notification_data This is notification-specific data that the notifier -+ * has included in this notification. The value of this should be published in -+ * the documentation of the observable module with the notifications. -+ * @param user_data This is any custom data that the observer provided when -+ * adding itself as an observer to the notification. */ -+typedef void (*dwc_notifier_callback_t)(void *object, char *notification, void *observer, -+ void *notification_data, void *user_data); -+ -+/** Brings up the notification manager. */ -+extern int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx); -+/** Brings down the notification manager. */ -+extern void dwc_free_notification_manager(void); -+ -+/** This function registers an observable module. A dwc_notifier_t object is -+ * returned to the observable module. This is an opaque object that is used by -+ * the observable module to trigger notifications. This object should only be -+ * accessible to functions that are authorized to trigger notifications for this -+ * module. Observers do not need this object. */ -+extern dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object); -+ -+/** This function unregisters an observable module. All observers have to be -+ * removed prior to unregistration. */ -+extern void dwc_unregister_notifier(dwc_notifier_t *notifier); -+ -+/** Add a module as an observer to the observable module. The observable module -+ * needs to have previously registered with the notification manager. -+ * -+ * @param observer The observer module -+ * @param object The module to observe -+ * @param notification The notification to observe -+ * @param callback The callback function to call -+ * @param user_data Any additional user data to pass into the callback function */ -+extern int dwc_add_observer(void *observer, void *object, char *notification, -+ dwc_notifier_callback_t callback, void *user_data); -+ -+/** Removes the specified observer from all notifications that it is currently -+ * observing. */ -+extern int dwc_remove_observer(void *observer); -+ -+/** This function triggers a Notification. It should be called by the -+ * observable module, or any module or library which the observable module -+ * allows to trigger notification on it's behalf. Such as the dwc_cc_t. -+ * -+ * dwc_notify is a non-blocking function. Callbacks are scheduled called in -+ * their own process context for each trigger. Callbacks can be blocking. -+ * dwc_notify can be called from interrupt context if needed. -+ * -+ */ -+void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* __DWC_NOTIFIER_H__ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_os.h b/drivers/usb/host/dwc_common_port/dwc_os.h -new file mode 100644 -index 0000000000000000000000000000000000000000..9a86d299403bd1dfdcdb6532fad702b2b65138d7 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_os.h -@@ -0,0 +1,1276 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_os.h $ -+ * $Revision: #14 $ -+ * $Date: 2010/11/04 $ -+ * $Change: 1621695 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifndef _DWC_OS_H_ -+#define _DWC_OS_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** @file -+ * -+ * DWC portability library, low level os-wrapper functions -+ * -+ */ -+ -+/* These basic types need to be defined by some OS header file or custom header -+ * file for your specific target architecture. -+ * -+ * uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t -+ * -+ * Any custom or alternate header file must be added and enabled here. -+ */ -+ -+#ifdef DWC_LINUX -+# include -+# ifdef CONFIG_DEBUG_MUTEXES -+# include -+# endif -+# include -+# include -+# include -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+# include -+#endif -+ -+ -+/** @name Primitive Types and Values */ -+ -+/** We define a boolean type for consistency. Can be either YES or NO */ -+typedef uint8_t dwc_bool_t; -+#define YES 1 -+#define NO 0 -+ -+#ifdef DWC_LINUX -+ -+/** @name Error Codes */ -+#define DWC_E_INVALID EINVAL -+#define DWC_E_NO_MEMORY ENOMEM -+#define DWC_E_NO_DEVICE ENODEV -+#define DWC_E_NOT_SUPPORTED EOPNOTSUPP -+#define DWC_E_TIMEOUT ETIMEDOUT -+#define DWC_E_BUSY EBUSY -+#define DWC_E_AGAIN EAGAIN -+#define DWC_E_RESTART ERESTART -+#define DWC_E_ABORT ECONNABORTED -+#define DWC_E_SHUTDOWN ESHUTDOWN -+#define DWC_E_NO_DATA ENODATA -+#define DWC_E_DISCONNECT ECONNRESET -+#define DWC_E_UNKNOWN EINVAL -+#define DWC_E_NO_STREAM_RES ENOSR -+#define DWC_E_COMMUNICATION ECOMM -+#define DWC_E_OVERFLOW EOVERFLOW -+#define DWC_E_PROTOCOL EPROTO -+#define DWC_E_IN_PROGRESS EINPROGRESS -+#define DWC_E_PIPE EPIPE -+#define DWC_E_IO EIO -+#define DWC_E_NO_SPACE ENOSPC -+ -+#else -+ -+/** @name Error Codes */ -+#define DWC_E_INVALID 1001 -+#define DWC_E_NO_MEMORY 1002 -+#define DWC_E_NO_DEVICE 1003 -+#define DWC_E_NOT_SUPPORTED 1004 -+#define DWC_E_TIMEOUT 1005 -+#define DWC_E_BUSY 1006 -+#define DWC_E_AGAIN 1007 -+#define DWC_E_RESTART 1008 -+#define DWC_E_ABORT 1009 -+#define DWC_E_SHUTDOWN 1010 -+#define DWC_E_NO_DATA 1011 -+#define DWC_E_DISCONNECT 2000 -+#define DWC_E_UNKNOWN 3000 -+#define DWC_E_NO_STREAM_RES 4001 -+#define DWC_E_COMMUNICATION 4002 -+#define DWC_E_OVERFLOW 4003 -+#define DWC_E_PROTOCOL 4004 -+#define DWC_E_IN_PROGRESS 4005 -+#define DWC_E_PIPE 4006 -+#define DWC_E_IO 4007 -+#define DWC_E_NO_SPACE 4008 -+ -+#endif -+ -+ -+/** @name Tracing/Logging Functions -+ * -+ * These function provide the capability to add tracing, debugging, and error -+ * messages, as well exceptions as assertions. The WUDEV uses these -+ * extensively. These could be logged to the main console, the serial port, an -+ * internal buffer, etc. These functions could also be no-op if they are too -+ * expensive on your system. By default undefining the DEBUG macro already -+ * no-ops some of these functions. */ -+ -+/** Returns non-zero if in interrupt context. */ -+extern dwc_bool_t DWC_IN_IRQ(void); -+#define dwc_in_irq DWC_IN_IRQ -+ -+/** Returns "IRQ" if DWC_IN_IRQ is true. */ -+static inline char *dwc_irq(void) { -+ return DWC_IN_IRQ() ? "IRQ" : ""; -+} -+ -+/** Returns non-zero if in bottom-half context. */ -+extern dwc_bool_t DWC_IN_BH(void); -+#define dwc_in_bh DWC_IN_BH -+ -+/** Returns "BH" if DWC_IN_BH is true. */ -+static inline char *dwc_bh(void) { -+ return DWC_IN_BH() ? "BH" : ""; -+} -+ -+/** -+ * A vprintf() clone. Just call vprintf if you've got it. -+ */ -+extern void DWC_VPRINTF(char *format, va_list args); -+#define dwc_vprintf DWC_VPRINTF -+ -+/** -+ * A vsnprintf() clone. Just call vprintf if you've got it. -+ */ -+extern int DWC_VSNPRINTF(char *str, int size, char *format, va_list args); -+#define dwc_vsnprintf DWC_VSNPRINTF -+ -+/** -+ * printf() clone. Just call printf if you've go it. -+ */ -+extern void DWC_PRINTF(char *format, ...) -+/* This provides compiler level static checking of the parameters if you're -+ * using GCC. */ -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+#define dwc_printf DWC_PRINTF -+ -+/** -+ * sprintf() clone. Just call sprintf if you've got it. -+ */ -+extern int DWC_SPRINTF(char *string, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 2, 3))); -+#else -+ ; -+#endif -+#define dwc_sprintf DWC_SPRINTF -+ -+/** -+ * snprintf() clone. Just call snprintf if you've got it. -+ */ -+extern int DWC_SNPRINTF(char *string, int size, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 3, 4))); -+#else -+ ; -+#endif -+#define dwc_snprintf DWC_SNPRINTF -+ -+/** -+ * Prints a WARNING message. On systems that don't differentiate between -+ * warnings and regular log messages, just print it. Indicates that something -+ * may be wrong with the driver. Works like printf(). -+ * -+ * Use the DWC_WARN macro to call this function. -+ */ -+extern void __DWC_WARN(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+ -+/** -+ * Prints an error message. On systems that don't differentiate between errors -+ * and regular log messages, just print it. Indicates that something went wrong -+ * with the driver. Works like printf(). -+ * -+ * Use the DWC_ERROR macro to call this function. -+ */ -+extern void __DWC_ERROR(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+ -+/** -+ * Prints an exception error message and takes some user-defined action such as -+ * print out a backtrace or trigger a breakpoint. Indicates that something went -+ * abnormally wrong with the driver such as programmer error, or other -+ * exceptional condition. It should not be ignored so even on systems without -+ * printing capability, some action should be taken to notify the developer of -+ * it. Works like printf(). -+ */ -+extern void DWC_EXCEPTION(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+#define dwc_exception DWC_EXCEPTION -+ -+#ifndef DWC_OTG_DEBUG_LEV -+#define DWC_OTG_DEBUG_LEV 0 -+#endif -+ -+#ifdef DEBUG -+/** -+ * Prints out a debug message. Used for logging/trace messages. -+ * -+ * Use the DWC_DEBUG macro to call this function -+ */ -+extern void __DWC_DEBUG(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+#else -+#define __DWC_DEBUG printk -+#endif -+ -+/** -+ * Prints out a Debug message. -+ */ -+#define DWC_DEBUG(_format, _args...) __DWC_DEBUG("DEBUG:%s:%s: " _format "\n", \ -+ __func__, dwc_irq(), ## _args) -+#define dwc_debug DWC_DEBUG -+/** -+ * Prints out a Debug message if enabled at compile time. -+ */ -+#if DWC_OTG_DEBUG_LEV > 0 -+#define DWC_DEBUGC(_format, _args...) DWC_DEBUG(_format, ##_args ) -+#else -+#define DWC_DEBUGC(_format, _args...) -+#endif -+#define dwc_debugc DWC_DEBUGC -+/** -+ * Prints out an informative message. -+ */ -+#define DWC_INFO(_format, _args...) DWC_PRINTF("INFO:%s: " _format "\n", \ -+ dwc_irq(), ## _args) -+#define dwc_info DWC_INFO -+/** -+ * Prints out an informative message if enabled at compile time. -+ */ -+#if DWC_OTG_DEBUG_LEV > 1 -+#define DWC_INFOC(_format, _args...) DWC_INFO(_format, ##_args ) -+#else -+#define DWC_INFOC(_format, _args...) -+#endif -+#define dwc_infoc DWC_INFOC -+/** -+ * Prints out a warning message. -+ */ -+#define DWC_WARN(_format, _args...) __DWC_WARN("WARN:%s:%s:%d: " _format "\n", \ -+ dwc_irq(), __func__, __LINE__, ## _args) -+#define dwc_warn DWC_WARN -+/** -+ * Prints out an error message. -+ */ -+#define DWC_ERROR(_format, _args...) __DWC_ERROR("ERROR:%s:%s:%d: " _format "\n", \ -+ dwc_irq(), __func__, __LINE__, ## _args) -+#define dwc_error DWC_ERROR -+ -+#define DWC_PROTO_ERROR(_format, _args...) __DWC_WARN("ERROR:%s:%s:%d: " _format "\n", \ -+ dwc_irq(), __func__, __LINE__, ## _args) -+#define dwc_proto_error DWC_PROTO_ERROR -+ -+#ifdef DEBUG -+/** Prints out a exception error message if the _expr expression fails. Disabled -+ * if DEBUG is not enabled. */ -+#define DWC_ASSERT(_expr, _format, _args...) do { \ -+ if (!(_expr)) { DWC_EXCEPTION("%s:%s:%d: " _format "\n", dwc_irq(), \ -+ __FILE__, __LINE__, ## _args); } \ -+ } while (0) -+#else -+#define DWC_ASSERT(_x...) -+#endif -+#define dwc_assert DWC_ASSERT -+ -+ -+/** @name Byte Ordering -+ * The following functions are for conversions between processor's byte ordering -+ * and specific ordering you want. -+ */ -+ -+/** Converts 32 bit data in CPU byte ordering to little endian. */ -+extern uint32_t DWC_CPU_TO_LE32(uint32_t *p); -+#define dwc_cpu_to_le32 DWC_CPU_TO_LE32 -+ -+/** Converts 32 bit data in CPU byte orderint to big endian. */ -+extern uint32_t DWC_CPU_TO_BE32(uint32_t *p); -+#define dwc_cpu_to_be32 DWC_CPU_TO_BE32 -+ -+/** Converts 32 bit little endian data to CPU byte ordering. */ -+extern uint32_t DWC_LE32_TO_CPU(uint32_t *p); -+#define dwc_le32_to_cpu DWC_LE32_TO_CPU -+ -+/** Converts 32 bit big endian data to CPU byte ordering. */ -+extern uint32_t DWC_BE32_TO_CPU(uint32_t *p); -+#define dwc_be32_to_cpu DWC_BE32_TO_CPU -+ -+/** Converts 16 bit data in CPU byte ordering to little endian. */ -+extern uint16_t DWC_CPU_TO_LE16(uint16_t *p); -+#define dwc_cpu_to_le16 DWC_CPU_TO_LE16 -+ -+/** Converts 16 bit data in CPU byte orderint to big endian. */ -+extern uint16_t DWC_CPU_TO_BE16(uint16_t *p); -+#define dwc_cpu_to_be16 DWC_CPU_TO_BE16 -+ -+/** Converts 16 bit little endian data to CPU byte ordering. */ -+extern uint16_t DWC_LE16_TO_CPU(uint16_t *p); -+#define dwc_le16_to_cpu DWC_LE16_TO_CPU -+ -+/** Converts 16 bit bi endian data to CPU byte ordering. */ -+extern uint16_t DWC_BE16_TO_CPU(uint16_t *p); -+#define dwc_be16_to_cpu DWC_BE16_TO_CPU -+ -+ -+/** @name Register Read/Write -+ * -+ * The following six functions should be implemented to read/write registers of -+ * 32-bit and 64-bit sizes. All modules use this to read/write register values. -+ * The reg value is a pointer to the register calculated from the void *base -+ * variable passed into the driver when it is started. */ -+ -+#ifdef DWC_LINUX -+/* Linux doesn't need any extra parameters for register read/write, so we -+ * just throw away the IO context parameter. -+ */ -+/** Reads the content of a 32-bit register. */ -+extern uint32_t DWC_READ_REG32(uint32_t volatile *reg); -+#define dwc_read_reg32(_ctx_,_reg_) DWC_READ_REG32(_reg_) -+ -+/** Reads the content of a 64-bit register. */ -+extern uint64_t DWC_READ_REG64(uint64_t volatile *reg); -+#define dwc_read_reg64(_ctx_,_reg_) DWC_READ_REG64(_reg_) -+ -+/** Writes to a 32-bit register. */ -+extern void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value); -+#define dwc_write_reg32(_ctx_,_reg_,_val_) DWC_WRITE_REG32(_reg_, _val_) -+ -+/** Writes to a 64-bit register. */ -+extern void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value); -+#define dwc_write_reg64(_ctx_,_reg_,_val_) DWC_WRITE_REG64(_reg_, _val_) -+ -+/** -+ * Modify bit values in a register. Using the -+ * algorithm: (reg_contents & ~clear_mask) | set_mask. -+ */ -+extern void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); -+#define dwc_modify_reg32(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG32(_reg_,_cmsk_,_smsk_) -+extern void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); -+#define dwc_modify_reg64(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG64(_reg_,_cmsk_,_smsk_) -+ -+#endif /* DWC_LINUX */ -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+typedef struct dwc_ioctx { -+ struct device *dev; -+ bus_space_tag_t iot; -+ bus_space_handle_t ioh; -+} dwc_ioctx_t; -+ -+/** BSD needs two extra parameters for register read/write, so we pass -+ * them in using the IO context parameter. -+ */ -+/** Reads the content of a 32-bit register. */ -+extern uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg); -+#define dwc_read_reg32 DWC_READ_REG32 -+ -+/** Reads the content of a 64-bit register. */ -+extern uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg); -+#define dwc_read_reg64 DWC_READ_REG64 -+ -+/** Writes to a 32-bit register. */ -+extern void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value); -+#define dwc_write_reg32 DWC_WRITE_REG32 -+ -+/** Writes to a 64-bit register. */ -+extern void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value); -+#define dwc_write_reg64 DWC_WRITE_REG64 -+ -+/** -+ * Modify bit values in a register. Using the -+ * algorithm: (reg_contents & ~clear_mask) | set_mask. -+ */ -+extern void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); -+#define dwc_modify_reg32 DWC_MODIFY_REG32 -+extern void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); -+#define dwc_modify_reg64 DWC_MODIFY_REG64 -+ -+#endif /* DWC_FREEBSD || DWC_NETBSD */ -+ -+/** @cond */ -+ -+/** @name Some convenience MACROS used internally. Define DWC_DEBUG_REGS to log the -+ * register writes. */ -+ -+#ifdef DWC_LINUX -+ -+# ifdef DWC_DEBUG_REGS -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ -+ return DWC_READ_REG32(&container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ -+ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ -+ &(((uint32_t*)container->regs->_reg)[num]), data); \ -+ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(_container_type *container) { \ -+ return DWC_READ_REG32(&container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ -+ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ -+ DWC_WRITE_REG32(&container->regs->_reg, data); \ -+} -+ -+# else /* DWC_DEBUG_REGS */ -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ -+ return DWC_READ_REG32(&container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ -+ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(_container_type *container) { \ -+ return DWC_READ_REG32(&container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ -+ DWC_WRITE_REG32(&container->regs->_reg, data); \ -+} -+ -+# endif /* DWC_DEBUG_REGS */ -+ -+#endif /* DWC_LINUX */ -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+ -+# ifdef DWC_DEBUG_REGS -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ -+ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ -+ &(((uint32_t*)container->regs->_reg)[num]), data); \ -+ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ -+ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ -+ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ -+} -+ -+# else /* DWC_DEBUG_REGS */ -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ -+ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ -+ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ -+} -+ -+# endif /* DWC_DEBUG_REGS */ -+ -+#endif /* DWC_FREEBSD || DWC_NETBSD */ -+ -+/** @endcond */ -+ -+ -+#ifdef DWC_CRYPTOLIB -+/** @name Crypto Functions -+ * -+ * These are the low-level cryptographic functions used by the driver. */ -+ -+/** Perform AES CBC */ -+extern int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out); -+#define dwc_aes_cbc DWC_AES_CBC -+ -+/** Fill the provided buffer with random bytes. These should be cryptographic grade random numbers. */ -+extern void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length); -+#define dwc_random_bytes DWC_RANDOM_BYTES -+ -+/** Perform the SHA-256 hash function */ -+extern int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out); -+#define dwc_sha256 DWC_SHA256 -+ -+/** Calculated the HMAC-SHA256 */ -+extern int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t *out); -+#define dwc_hmac_sha256 DWC_HMAC_SHA256 -+ -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/** @name Memory Allocation -+ * -+ * These function provide access to memory allocation. There are only 2 DMA -+ * functions and 3 Regular memory functions that need to be implemented. None -+ * of the memory debugging routines need to be implemented. The allocation -+ * routines all ZERO the contents of the memory. -+ * -+ * Defining DWC_DEBUG_MEMORY turns on memory debugging and statistic gathering. -+ * This checks for memory leaks, keeping track of alloc/free pairs. It also -+ * keeps track of how much memory the driver is using at any given time. */ -+ -+#define DWC_PAGE_SIZE 4096 -+#define DWC_PAGE_OFFSET(addr) (((uint32_t)addr) & 0xfff) -+#define DWC_PAGE_ALIGNED(addr) ((((uint32_t)addr) & 0xfff) == 0) -+ -+#define DWC_INVALID_DMA_ADDR 0x0 -+ -+#ifdef DWC_LINUX -+/** Type for a DMA address */ -+typedef dma_addr_t dwc_dma_t; -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+typedef bus_addr_t dwc_dma_t; -+#endif -+ -+#ifdef DWC_FREEBSD -+typedef struct dwc_dmactx { -+ struct device *dev; -+ bus_dma_tag_t dma_tag; -+ bus_dmamap_t dma_map; -+ bus_addr_t dma_paddr; -+ void *dma_vaddr; -+} dwc_dmactx_t; -+#endif -+ -+#ifdef DWC_NETBSD -+typedef struct dwc_dmactx { -+ struct device *dev; -+ bus_dma_tag_t dma_tag; -+ bus_dmamap_t dma_map; -+ bus_dma_segment_t segs[1]; -+ int nsegs; -+ bus_addr_t dma_paddr; -+ void *dma_vaddr; -+} dwc_dmactx_t; -+#endif -+ -+/* @todo these functions will be added in the future */ -+#if 0 -+/** -+ * Creates a DMA pool from which you can allocate DMA buffers. Buffers -+ * allocated from this pool will be guaranteed to meet the size, alignment, and -+ * boundary requirements specified. -+ * -+ * @param[in] size Specifies the size of the buffers that will be allocated from -+ * this pool. -+ * @param[in] align Specifies the byte alignment requirements of the buffers -+ * allocated from this pool. Must be a power of 2. -+ * @param[in] boundary Specifies the N-byte boundary that buffers allocated from -+ * this pool must not cross. -+ * -+ * @returns A pointer to an internal opaque structure which is not to be -+ * accessed outside of these library functions. Use this handle to specify -+ * which pools to allocate/free DMA buffers from and also to destroy the pool, -+ * when you are done with it. -+ */ -+extern dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, uint32_t align, uint32_t boundary); -+ -+/** -+ * Destroy a DMA pool. All buffers allocated from that pool must be freed first. -+ */ -+extern void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool); -+ -+/** -+ * Allocate a buffer from the specified DMA pool and zeros its contents. -+ */ -+extern void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr); -+ -+/** -+ * Free a previously allocated buffer from the DMA pool. -+ */ -+extern void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr); -+#endif -+ -+/** Allocates a DMA capable buffer and zeroes its contents. */ -+extern void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); -+ -+/** Allocates a DMA capable buffer and zeroes its contents in atomic contest */ -+extern void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); -+ -+/** Frees a previously allocated buffer. */ -+extern void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr); -+ -+/** Allocates a block of memory and zeroes its contents. */ -+extern void *__DWC_ALLOC(void *mem_ctx, uint32_t size); -+ -+/** Allocates a block of memory and zeroes its contents, in an atomic manner -+ * which can be used inside interrupt context. The size should be sufficiently -+ * small, a few KB at most, such that failures are not likely to occur. Can just call -+ * __DWC_ALLOC if it is atomic. */ -+extern void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size); -+ -+/** Frees a previously allocated buffer. */ -+extern void __DWC_FREE(void *mem_ctx, void *addr); -+ -+#ifndef DWC_DEBUG_MEMORY -+ -+#define DWC_ALLOC(_size_) __DWC_ALLOC(NULL, _size_) -+#define DWC_ALLOC_ATOMIC(_size_) __DWC_ALLOC_ATOMIC(NULL, _size_) -+#define DWC_FREE(_addr_) __DWC_FREE(NULL, _addr_) -+ -+# ifdef DWC_LINUX -+#define DWC_DMA_ALLOC(_dev, _size_, _dma_) __DWC_DMA_ALLOC(_dev, _size_, _dma_) -+#define DWC_DMA_ALLOC_ATOMIC(_dev, _size_, _dma_) __DWC_DMA_ALLOC_ATOMIC(_dev, _size_, _dma_) -+#define DWC_DMA_FREE(_dev, _size_,_virt_, _dma_) __DWC_DMA_FREE(_dev, _size_, _virt_, _dma_) -+# endif -+ -+# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+#define DWC_DMA_ALLOC __DWC_DMA_ALLOC -+#define DWC_DMA_FREE __DWC_DMA_FREE -+# endif -+extern void *dwc_dma_alloc_atomic_debug(uint32_t size, dwc_dma_t *dma_addr, char const *func, int line); -+ -+#else /* DWC_DEBUG_MEMORY */ -+ -+extern void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line); -+extern void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, int line); -+extern void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line); -+extern void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, -+ char const *func, int line); -+extern void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, -+ char const *func, int line); -+extern void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, -+ dwc_dma_t dma_addr, char const *func, int line); -+ -+extern int dwc_memory_debug_start(void *mem_ctx); -+extern void dwc_memory_debug_stop(void); -+extern void dwc_memory_debug_report(void); -+ -+#define DWC_ALLOC(_size_) dwc_alloc_debug(NULL, _size_, __func__, __LINE__) -+#define DWC_ALLOC_ATOMIC(_size_) dwc_alloc_atomic_debug(NULL, _size_, \ -+ __func__, __LINE__) -+#define DWC_FREE(_addr_) dwc_free_debug(NULL, _addr_, __func__, __LINE__) -+ -+# ifdef DWC_LINUX -+#define DWC_DMA_ALLOC(_dev, _size_, _dma_) \ -+ dwc_dma_alloc_debug(_dev, _size_, _dma_, __func__, __LINE__) -+#define DWC_DMA_ALLOC_ATOMIC(_dev, _size_, _dma_) \ -+ dwc_dma_alloc_atomic_debug(_dev, _size_, _dma_, __func__, __LINE__) -+#define DWC_DMA_FREE(_dev, _size_, _virt_, _dma_) \ -+ dwc_dma_free_debug(_dev, _size_, _virt_, _dma_, __func__, __LINE__) -+# endif -+ -+# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+#define DWC_DMA_ALLOC(_ctx_,_size_,_dma_) dwc_dma_alloc_debug(_ctx_, _size_, \ -+ _dma_, __func__, __LINE__) -+#define DWC_DMA_FREE(_ctx_,_size_,_virt_,_dma_) dwc_dma_free_debug(_ctx_, _size_, \ -+ _virt_, _dma_, __func__, __LINE__) -+# endif -+ -+#endif /* DWC_DEBUG_MEMORY */ -+ -+#define dwc_alloc(_ctx_,_size_) DWC_ALLOC(_size_) -+#define dwc_alloc_atomic(_ctx_,_size_) DWC_ALLOC_ATOMIC(_size_) -+#define dwc_free(_ctx_,_addr_) DWC_FREE(_addr_) -+ -+#ifdef DWC_LINUX -+/* Linux doesn't need any extra parameters for DMA buffer allocation, so we -+ * just throw away the DMA context parameter. -+ */ -+#define dwc_dma_alloc(_ctx_,_size_,_dma_) DWC_DMA_ALLOC(_size_, _dma_) -+#define dwc_dma_alloc_atomic(_ctx_,_size_,_dma_) DWC_DMA_ALLOC_ATOMIC(_size_, _dma_) -+#define dwc_dma_free(_ctx_,_size_,_virt_,_dma_) DWC_DMA_FREE(_size_, _virt_, _dma_) -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+/** BSD needs several extra parameters for DMA buffer allocation, so we pass -+ * them in using the DMA context parameter. -+ */ -+#define dwc_dma_alloc DWC_DMA_ALLOC -+#define dwc_dma_free DWC_DMA_FREE -+#endif -+ -+ -+/** @name Memory and String Processing */ -+ -+/** memset() clone */ -+extern void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size); -+#define dwc_memset DWC_MEMSET -+ -+/** memcpy() clone */ -+extern void *DWC_MEMCPY(void *dest, void const *src, uint32_t size); -+#define dwc_memcpy DWC_MEMCPY -+ -+/** memmove() clone */ -+extern void *DWC_MEMMOVE(void *dest, void *src, uint32_t size); -+#define dwc_memmove DWC_MEMMOVE -+ -+/** memcmp() clone */ -+extern int DWC_MEMCMP(void *m1, void *m2, uint32_t size); -+#define dwc_memcmp DWC_MEMCMP -+ -+/** strcmp() clone */ -+extern int DWC_STRCMP(void *s1, void *s2); -+#define dwc_strcmp DWC_STRCMP -+ -+/** strncmp() clone */ -+extern int DWC_STRNCMP(void *s1, void *s2, uint32_t size); -+#define dwc_strncmp DWC_STRNCMP -+ -+/** strlen() clone, for NULL terminated ASCII strings */ -+extern int DWC_STRLEN(char const *str); -+#define dwc_strlen DWC_STRLEN -+ -+/** strcpy() clone, for NULL terminated ASCII strings */ -+extern char *DWC_STRCPY(char *to, const char *from); -+#define dwc_strcpy DWC_STRCPY -+ -+/** strdup() clone. If you wish to use memory allocation debugging, this -+ * implementation of strdup should use the DWC_* memory routines instead of -+ * calling a predefined strdup. Otherwise the memory allocated by this routine -+ * will not be seen by the debugging routines. */ -+extern char *DWC_STRDUP(char const *str); -+#define dwc_strdup(_ctx_,_str_) DWC_STRDUP(_str_) -+ -+/** NOT an atoi() clone. Read the description carefully. Returns an integer -+ * converted from the string str in base 10 unless the string begins with a "0x" -+ * in which case it is base 16. String must be a NULL terminated sequence of -+ * ASCII characters and may optionally begin with whitespace, a + or -, and a -+ * "0x" prefix if base 16. The remaining characters must be valid digits for -+ * the number and end with a NULL character. If any invalid characters are -+ * encountered or it returns with a negative error code and the results of the -+ * conversion are undefined. On sucess it returns 0. Overflow conditions are -+ * undefined. An example implementation using atoi() can be referenced from the -+ * Linux implementation. */ -+extern int DWC_ATOI(const char *str, int32_t *value); -+#define dwc_atoi DWC_ATOI -+ -+/** Same as above but for unsigned. */ -+extern int DWC_ATOUI(const char *str, uint32_t *value); -+#define dwc_atoui DWC_ATOUI -+ -+#ifdef DWC_UTFLIB -+/** This routine returns a UTF16LE unicode encoded string from a UTF8 string. */ -+extern int DWC_UTF8_TO_UTF16LE(uint8_t const *utf8string, uint16_t *utf16string, unsigned len); -+#define dwc_utf8_to_utf16le DWC_UTF8_TO_UTF16LE -+#endif -+ -+ -+/** @name Wait queues -+ * -+ * Wait queues provide a means of synchronizing between threads or processes. A -+ * process can block on a waitq if some condition is not true, waiting for it to -+ * become true. When the waitq is triggered all waiting process will get -+ * unblocked and the condition will be check again. Waitqs should be triggered -+ * every time a condition can potentially change.*/ -+struct dwc_waitq; -+ -+/** Type for a waitq */ -+typedef struct dwc_waitq dwc_waitq_t; -+ -+/** The type of waitq condition callback function. This is called every time -+ * condition is evaluated. */ -+typedef int (*dwc_waitq_condition_t)(void *data); -+ -+/** Allocate a waitq */ -+extern dwc_waitq_t *DWC_WAITQ_ALLOC(void); -+#define dwc_waitq_alloc(_ctx_) DWC_WAITQ_ALLOC() -+ -+/** Free a waitq */ -+extern void DWC_WAITQ_FREE(dwc_waitq_t *wq); -+#define dwc_waitq_free DWC_WAITQ_FREE -+ -+/** Check the condition and if it is false, block on the waitq. When unblocked, check the -+ * condition again. The function returns when the condition becomes true. The return value -+ * is 0 on condition true, DWC_WAITQ_ABORTED on abort or killed, or DWC_WAITQ_UNKNOWN on error. */ -+extern int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data); -+#define dwc_waitq_wait DWC_WAITQ_WAIT -+ -+/** Check the condition and if it is false, block on the waitq. When unblocked, -+ * check the condition again. The function returns when the condition become -+ * true or the timeout has passed. The return value is 0 on condition true or -+ * DWC_TIMED_OUT on timeout, or DWC_WAITQ_ABORTED, or DWC_WAITQ_UNKNOWN on -+ * error. */ -+extern int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs); -+#define dwc_waitq_wait_timeout DWC_WAITQ_WAIT_TIMEOUT -+ -+/** Trigger a waitq, unblocking all processes. This should be called whenever a condition -+ * has potentially changed. */ -+extern void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq); -+#define dwc_waitq_trigger DWC_WAITQ_TRIGGER -+ -+/** Unblock all processes waiting on the waitq with an ABORTED result. */ -+extern void DWC_WAITQ_ABORT(dwc_waitq_t *wq); -+#define dwc_waitq_abort DWC_WAITQ_ABORT -+ -+ -+/** @name Threads -+ * -+ * A thread must be explicitly stopped. It must check DWC_THREAD_SHOULD_STOP -+ * whenever it is woken up, and then return. The DWC_THREAD_STOP function -+ * returns the value from the thread. -+ */ -+ -+struct dwc_thread; -+ -+/** Type for a thread */ -+typedef struct dwc_thread dwc_thread_t; -+ -+/** The thread function */ -+typedef int (*dwc_thread_function_t)(void *data); -+ -+/** Create a thread and start it running the thread_function. Returns a handle -+ * to the thread */ -+extern dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data); -+#define dwc_thread_run(_ctx_,_func_,_name_,_data_) DWC_THREAD_RUN(_func_, _name_, _data_) -+ -+/** Stops a thread. Return the value returned by the thread. Or will return -+ * DWC_ABORT if the thread never started. */ -+extern int DWC_THREAD_STOP(dwc_thread_t *thread); -+#define dwc_thread_stop DWC_THREAD_STOP -+ -+/** Signifies to the thread that it must stop. */ -+#ifdef DWC_LINUX -+/* Linux doesn't need any parameters for kthread_should_stop() */ -+extern dwc_bool_t DWC_THREAD_SHOULD_STOP(void); -+#define dwc_thread_should_stop(_thrd_) DWC_THREAD_SHOULD_STOP() -+ -+/* No thread_exit function in Linux */ -+#define dwc_thread_exit(_thrd_) -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+/** BSD needs the thread pointer for kthread_suspend_check() */ -+extern dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread); -+#define dwc_thread_should_stop DWC_THREAD_SHOULD_STOP -+ -+/** The thread must call this to exit. */ -+extern void DWC_THREAD_EXIT(dwc_thread_t *thread); -+#define dwc_thread_exit DWC_THREAD_EXIT -+#endif -+ -+ -+/** @name Work queues -+ * -+ * Workqs are used to queue a callback function to be called at some later time, -+ * in another thread. */ -+struct dwc_workq; -+ -+/** Type for a workq */ -+typedef struct dwc_workq dwc_workq_t; -+ -+/** The type of the callback function to be called. */ -+typedef void (*dwc_work_callback_t)(void *data); -+ -+/** Allocate a workq */ -+extern dwc_workq_t *DWC_WORKQ_ALLOC(char *name); -+#define dwc_workq_alloc(_ctx_,_name_) DWC_WORKQ_ALLOC(_name_) -+ -+/** Free a workq. All work must be completed before being freed. */ -+extern void DWC_WORKQ_FREE(dwc_workq_t *workq); -+#define dwc_workq_free DWC_WORKQ_FREE -+ -+/** Schedule a callback on the workq, passing in data. The function will be -+ * scheduled at some later time. */ -+extern void DWC_WORKQ_SCHEDULE(dwc_workq_t *workq, dwc_work_callback_t cb, -+ void *data, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 4, 5))); -+#else -+ ; -+#endif -+#define dwc_workq_schedule DWC_WORKQ_SCHEDULE -+ -+/** Schedule a callback on the workq, that will be called until at least -+ * given number miliseconds have passed. */ -+extern void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *workq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 5, 6))); -+#else -+ ; -+#endif -+#define dwc_workq_schedule_delayed DWC_WORKQ_SCHEDULE_DELAYED -+ -+/** The number of processes in the workq */ -+extern int DWC_WORKQ_PENDING(dwc_workq_t *workq); -+#define dwc_workq_pending DWC_WORKQ_PENDING -+ -+/** Blocks until all the work in the workq is complete or timed out. Returns < -+ * 0 on timeout. */ -+extern int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout); -+#define dwc_workq_wait_work_done DWC_WORKQ_WAIT_WORK_DONE -+ -+ -+/** @name Tasklets -+ * -+ */ -+struct dwc_tasklet; -+ -+/** Type for a tasklet */ -+typedef struct dwc_tasklet dwc_tasklet_t; -+ -+/** The type of the callback function to be called */ -+typedef void (*dwc_tasklet_callback_t)(void *data); -+ -+/** Allocates a tasklet */ -+extern dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data); -+#define dwc_task_alloc(_ctx_,_name_,_cb_,_data_) DWC_TASK_ALLOC(_name_, _cb_, _data_) -+ -+/** Frees a tasklet */ -+extern void DWC_TASK_FREE(dwc_tasklet_t *task); -+#define dwc_task_free DWC_TASK_FREE -+ -+/** Schedules a tasklet to run */ -+extern void DWC_TASK_SCHEDULE(dwc_tasklet_t *task); -+#define dwc_task_schedule DWC_TASK_SCHEDULE -+ -+extern void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task); -+#define dwc_task_hi_schedule DWC_TASK_HI_SCHEDULE -+ -+/** @name Timer -+ * -+ * Callbacks must be small and atomic. -+ */ -+struct dwc_timer; -+ -+/** Type for a timer */ -+typedef struct dwc_timer dwc_timer_t; -+ -+/** The type of the callback function to be called */ -+typedef void (*dwc_timer_callback_t)(void *data); -+ -+/** Allocates a timer */ -+extern dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data); -+#define dwc_timer_alloc(_ctx_,_name_,_cb_,_data_) DWC_TIMER_ALLOC(_name_,_cb_,_data_) -+ -+/** Frees a timer */ -+extern void DWC_TIMER_FREE(dwc_timer_t *timer); -+#define dwc_timer_free DWC_TIMER_FREE -+ -+/** Schedules the timer to run at time ms from now. And will repeat at every -+ * repeat_interval msec therafter -+ * -+ * Modifies a timer that is still awaiting execution to a new expiration time. -+ * The mod_time is added to the old time. */ -+extern void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time); -+#define dwc_timer_schedule DWC_TIMER_SCHEDULE -+ -+/** Disables the timer from execution. */ -+extern void DWC_TIMER_CANCEL(dwc_timer_t *timer); -+#define dwc_timer_cancel DWC_TIMER_CANCEL -+ -+ -+/** @name Spinlocks -+ * -+ * These locks are used when the work between the lock/unlock is atomic and -+ * short. Interrupts are also disabled during the lock/unlock and thus they are -+ * suitable to lock between interrupt/non-interrupt context. They also lock -+ * between processes if you have multiple CPUs or Preemption. If you don't have -+ * multiple CPUS or Preemption, then the you can simply implement the -+ * DWC_SPINLOCK and DWC_SPINUNLOCK to disable and enable interrupts. Because -+ * the work between the lock/unlock is atomic, the process context will never -+ * change, and so you never have to lock between processes. */ -+ -+struct dwc_spinlock; -+ -+/** Type for a spinlock */ -+typedef struct dwc_spinlock dwc_spinlock_t; -+ -+/** Type for the 'flags' argument to spinlock funtions */ -+typedef unsigned long dwc_irqflags_t; -+ -+/** Returns an initialized lock variable. This function should allocate and -+ * initialize the OS-specific data structure used for locking. This data -+ * structure is to be used for the DWC_LOCK and DWC_UNLOCK functions and should -+ * be freed by the DWC_FREE_LOCK when it is no longer used. -+ * -+ * For Linux Spinlock Debugging make it macro because the debugging routines use -+ * the symbol name to determine recursive locking. Using a wrapper function -+ * makes it falsely think recursive locking occurs. */ -+#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK) -+#define DWC_SPINLOCK_ALLOC_LINUX_DEBUG(lock) ({ \ -+ lock = DWC_ALLOC(sizeof(spinlock_t)); \ -+ if (lock) { \ -+ spin_lock_init((spinlock_t *)lock); \ -+ } \ -+}) -+#else -+extern dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void); -+#define dwc_spinlock_alloc(_ctx_) DWC_SPINLOCK_ALLOC() -+#endif -+ -+/** Frees an initialized lock variable. */ -+extern void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock); -+#define dwc_spinlock_free(_ctx_,_lock_) DWC_SPINLOCK_FREE(_lock_) -+ -+/** Disables interrupts and blocks until it acquires the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ * @param flags Unsigned long for irq flags storage. -+ */ -+extern void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags); -+#define dwc_spinlock_irqsave DWC_SPINLOCK_IRQSAVE -+ -+/** Re-enables the interrupt and releases the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ * @param flags Unsigned long for irq flags storage. Must be the same as was -+ * passed into DWC_LOCK. -+ */ -+extern void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags); -+#define dwc_spinunlock_irqrestore DWC_SPINUNLOCK_IRQRESTORE -+ -+/** Blocks until it acquires the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ */ -+extern void DWC_SPINLOCK(dwc_spinlock_t *lock); -+#define dwc_spinlock DWC_SPINLOCK -+ -+/** Releases the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ */ -+extern void DWC_SPINUNLOCK(dwc_spinlock_t *lock); -+#define dwc_spinunlock DWC_SPINUNLOCK -+ -+ -+/** @name Mutexes -+ * -+ * Unlike spinlocks Mutexes lock only between processes and the work between the -+ * lock/unlock CAN block, therefore it CANNOT be called from interrupt context. -+ */ -+ -+struct dwc_mutex; -+ -+/** Type for a mutex */ -+typedef struct dwc_mutex dwc_mutex_t; -+ -+/* For Linux Mutex Debugging make it inline because the debugging routines use -+ * the symbol to determine recursive locking. This makes it falsely think -+ * recursive locking occurs. */ -+#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) -+#define DWC_MUTEX_ALLOC_LINUX_DEBUG(__mutexp) ({ \ -+ __mutexp = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); \ -+ mutex_init((struct mutex *)__mutexp); \ -+}) -+#endif -+ -+/** Allocate a mutex */ -+extern dwc_mutex_t *DWC_MUTEX_ALLOC(void); -+#define dwc_mutex_alloc(_ctx_) DWC_MUTEX_ALLOC() -+ -+/* For memory leak debugging when using Linux Mutex Debugging */ -+#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) -+#define DWC_MUTEX_FREE(__mutexp) do { \ -+ mutex_destroy((struct mutex *)__mutexp); \ -+ DWC_FREE(__mutexp); \ -+} while(0) -+#else -+/** Free a mutex */ -+extern void DWC_MUTEX_FREE(dwc_mutex_t *mutex); -+#define dwc_mutex_free(_ctx_,_mutex_) DWC_MUTEX_FREE(_mutex_) -+#endif -+ -+/** Lock a mutex */ -+extern void DWC_MUTEX_LOCK(dwc_mutex_t *mutex); -+#define dwc_mutex_lock DWC_MUTEX_LOCK -+ -+/** Non-blocking lock returns 1 on successful lock. */ -+extern int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex); -+#define dwc_mutex_trylock DWC_MUTEX_TRYLOCK -+ -+/** Unlock a mutex */ -+extern void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex); -+#define dwc_mutex_unlock DWC_MUTEX_UNLOCK -+ -+ -+/** @name Time */ -+ -+/** Microsecond delay. -+ * -+ * @param usecs Microseconds to delay. -+ */ -+extern void DWC_UDELAY(uint32_t usecs); -+#define dwc_udelay DWC_UDELAY -+ -+/** Millisecond delay. -+ * -+ * @param msecs Milliseconds to delay. -+ */ -+extern void DWC_MDELAY(uint32_t msecs); -+#define dwc_mdelay DWC_MDELAY -+ -+/** Non-busy waiting. -+ * Sleeps for specified number of milliseconds. -+ * -+ * @param msecs Milliseconds to sleep. -+ */ -+extern void DWC_MSLEEP(uint32_t msecs); -+#define dwc_msleep DWC_MSLEEP -+ -+/** -+ * Returns number of milliseconds since boot. -+ */ -+extern uint32_t DWC_TIME(void); -+#define dwc_time DWC_TIME -+ -+ -+ -+ -+/* @mainpage DWC Portability and Common Library -+ * -+ * This is the documentation for the DWC Portability and Common Library. -+ * -+ * @section intro Introduction -+ * -+ * The DWC Portability library consists of wrapper calls and data structures to -+ * all low-level functions which are typically provided by the OS. The WUDEV -+ * driver uses only these functions. In order to port the WUDEV driver, only -+ * the functions in this library need to be re-implemented, with the same -+ * behavior as documented here. -+ * -+ * The Common library consists of higher level functions, which rely only on -+ * calling the functions from the DWC Portability library. These common -+ * routines are shared across modules. Some of the common libraries need to be -+ * used directly by the driver programmer when porting WUDEV. Such as the -+ * parameter and notification libraries. -+ * -+ * @section low Portability Library OS Wrapper Functions -+ * -+ * Any function starting with DWC and in all CAPS is a low-level OS-wrapper that -+ * needs to be implemented when porting, for example DWC_MUTEX_ALLOC(). All of -+ * these functions are included in the dwc_os.h file. -+ * -+ * There are many functions here covering a wide array of OS services. Please -+ * see dwc_os.h for details, and implementation notes for each function. -+ * -+ * @section common Common Library Functions -+ * -+ * Any function starting with dwc and in all lowercase is a common library -+ * routine. These functions have a portable implementation and do not need to -+ * be reimplemented when porting. The common routines can be used by any -+ * driver, and some must be used by the end user to control the drivers. For -+ * example, you must use the Parameter common library in order to set the -+ * parameters in the WUDEV module. -+ * -+ * The common libraries consist of the following: -+ * -+ * - Connection Contexts - Used internally and can be used by end-user. See dwc_cc.h -+ * - Parameters - Used internally and can be used by end-user. See dwc_params.h -+ * - Notifications - Used internally and can be used by end-user. See dwc_notifier.h -+ * - Lists - Used internally and can be used by end-user. See dwc_list.h -+ * - Memory Debugging - Used internally and can be used by end-user. See dwc_os.h -+ * - Modpow - Used internally only. See dwc_modpow.h -+ * - DH - Used internally only. See dwc_dh.h -+ * - Crypto - Used internally only. See dwc_crypto.h -+ * -+ * -+ * @section prereq Prerequistes For dwc_os.h -+ * @subsection types Data Types -+ * -+ * The dwc_os.h file assumes that several low-level data types are pre defined for the -+ * compilation environment. These data types are: -+ * -+ * - uint8_t - unsigned 8-bit data type -+ * - int8_t - signed 8-bit data type -+ * - uint16_t - unsigned 16-bit data type -+ * - int16_t - signed 16-bit data type -+ * - uint32_t - unsigned 32-bit data type -+ * - int32_t - signed 32-bit data type -+ * - uint64_t - unsigned 64-bit data type -+ * - int64_t - signed 64-bit data type -+ * -+ * Ensure that these are defined before using dwc_os.h. The easiest way to do -+ * that is to modify the top of the file to include the appropriate header. -+ * This is already done for the Linux environment. If the DWC_LINUX macro is -+ * defined, the correct header will be added. A standard header is -+ * also used for environments where standard C headers are available. -+ * -+ * @subsection stdarg Variable Arguments -+ * -+ * Variable arguments are provided by a standard C header . it is -+ * available in Both the Linux and ANSI C enviornment. An equivalent must be -+ * provided in your enviornment in order to use dwc_os.h with the debug and -+ * tracing message functionality. -+ * -+ * @subsection thread Threading -+ * -+ * WUDEV Core must be run on an operating system that provides for multiple -+ * threads/processes. Threading can be implemented in many ways, even in -+ * embedded systems without an operating system. At the bare minimum, the -+ * system should be able to start any number of processes at any time to handle -+ * special work. It need not be a pre-emptive system. Process context can -+ * change upon a call to a blocking function. The hardware interrupt context -+ * that calls the module's ISR() function must be differentiable from process -+ * context, even if your processes are impemented via a hardware interrupt. -+ * Further locking mechanism between process must exist (or be implemented), and -+ * process context must have a way to disable interrupts for a period of time to -+ * lock them out. If all of this exists, the functions in dwc_os.h related to -+ * threading should be able to be implemented with the defined behavior. -+ * -+ */ -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_OS_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/usb.h b/drivers/usb/host/dwc_common_port/usb.h -new file mode 100644 -index 0000000000000000000000000000000000000000..27bda82dac2eb27923120c43aac3610974610221 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/usb.h -@@ -0,0 +1,946 @@ -+/* -+ * Copyright (c) 1998 The NetBSD Foundation, Inc. -+ * All rights reserved. -+ * -+ * This code is derived from software contributed to The NetBSD Foundation -+ * by Lennart Augustsson (lennart@augustsson.net) at -+ * Carlstedt Research & Technology. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. All advertising materials mentioning features or use of this software -+ * must display the following acknowledgement: -+ * This product includes software developed by the NetBSD -+ * Foundation, Inc. and its contributors. -+ * 4. Neither the name of The NetBSD Foundation nor the names of its -+ * contributors may be used to endorse or promote products derived -+ * from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+/* Modified by Synopsys, Inc, 12/12/2007 */ -+ -+ -+#ifndef _USB_H_ -+#define _USB_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* -+ * The USB records contain some unaligned little-endian word -+ * components. The U[SG]ETW macros take care of both the alignment -+ * and endian problem and should always be used to access non-byte -+ * values. -+ */ -+typedef u_int8_t uByte; -+typedef u_int8_t uWord[2]; -+typedef u_int8_t uDWord[4]; -+ -+#define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h)) -+#define UCONSTW(x) { (x) & 0xff, ((x) >> 8) & 0xff } -+#define UCONSTDW(x) { (x) & 0xff, ((x) >> 8) & 0xff, \ -+ ((x) >> 16) & 0xff, ((x) >> 24) & 0xff } -+ -+#if 1 -+#define UGETW(w) ((w)[0] | ((w)[1] << 8)) -+#define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8)) -+#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24)) -+#define USETDW(w,v) ((w)[0] = (u_int8_t)(v), \ -+ (w)[1] = (u_int8_t)((v) >> 8), \ -+ (w)[2] = (u_int8_t)((v) >> 16), \ -+ (w)[3] = (u_int8_t)((v) >> 24)) -+#else -+/* -+ * On little-endian machines that can handle unanliged accesses -+ * (e.g. i386) these macros can be replaced by the following. -+ */ -+#define UGETW(w) (*(u_int16_t *)(w)) -+#define USETW(w,v) (*(u_int16_t *)(w) = (v)) -+#define UGETDW(w) (*(u_int32_t *)(w)) -+#define USETDW(w,v) (*(u_int32_t *)(w) = (v)) -+#endif -+ -+/* -+ * Macros for accessing UAS IU fields, which are big-endian -+ */ -+#define IUSETW2(w,h,l) ((w)[0] = (u_int8_t)(h), (w)[1] = (u_int8_t)(l)) -+#define IUCONSTW(x) { ((x) >> 8) & 0xff, (x) & 0xff } -+#define IUCONSTDW(x) { ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ -+ ((x) >> 8) & 0xff, (x) & 0xff } -+#define IUGETW(w) (((w)[0] << 8) | (w)[1]) -+#define IUSETW(w,v) ((w)[0] = (u_int8_t)((v) >> 8), (w)[1] = (u_int8_t)(v)) -+#define IUGETDW(w) (((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) -+#define IUSETDW(w,v) ((w)[0] = (u_int8_t)((v) >> 24), \ -+ (w)[1] = (u_int8_t)((v) >> 16), \ -+ (w)[2] = (u_int8_t)((v) >> 8), \ -+ (w)[3] = (u_int8_t)(v)) -+ -+#define UPACKED __attribute__((__packed__)) -+ -+typedef struct { -+ uByte bmRequestType; -+ uByte bRequest; -+ uWord wValue; -+ uWord wIndex; -+ uWord wLength; -+} UPACKED usb_device_request_t; -+ -+#define UT_GET_DIR(a) ((a) & 0x80) -+#define UT_WRITE 0x00 -+#define UT_READ 0x80 -+ -+#define UT_GET_TYPE(a) ((a) & 0x60) -+#define UT_STANDARD 0x00 -+#define UT_CLASS 0x20 -+#define UT_VENDOR 0x40 -+ -+#define UT_GET_RECIPIENT(a) ((a) & 0x1f) -+#define UT_DEVICE 0x00 -+#define UT_INTERFACE 0x01 -+#define UT_ENDPOINT 0x02 -+#define UT_OTHER 0x03 -+ -+#define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE) -+#define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE) -+#define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT) -+#define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE) -+#define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE) -+#define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT) -+#define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE) -+#define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE) -+#define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER) -+#define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT) -+#define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE) -+#define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE) -+#define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER) -+#define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT) -+#define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) -+#define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE) -+#define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER) -+#define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT) -+#define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE) -+#define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE) -+#define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER) -+#define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT) -+ -+/* Requests */ -+#define UR_GET_STATUS 0x00 -+#define USTAT_STANDARD_STATUS 0x00 -+#define WUSTAT_WUSB_FEATURE 0x01 -+#define WUSTAT_CHANNEL_INFO 0x02 -+#define WUSTAT_RECEIVED_DATA 0x03 -+#define WUSTAT_MAS_AVAILABILITY 0x04 -+#define WUSTAT_CURRENT_TRANSMIT_POWER 0x05 -+#define UR_CLEAR_FEATURE 0x01 -+#define UR_SET_FEATURE 0x03 -+#define UR_SET_AND_TEST_FEATURE 0x0c -+#define UR_SET_ADDRESS 0x05 -+#define UR_GET_DESCRIPTOR 0x06 -+#define UDESC_DEVICE 0x01 -+#define UDESC_CONFIG 0x02 -+#define UDESC_STRING 0x03 -+#define UDESC_INTERFACE 0x04 -+#define UDESC_ENDPOINT 0x05 -+#define UDESC_SS_USB_COMPANION 0x30 -+#define UDESC_DEVICE_QUALIFIER 0x06 -+#define UDESC_OTHER_SPEED_CONFIGURATION 0x07 -+#define UDESC_INTERFACE_POWER 0x08 -+#define UDESC_OTG 0x09 -+#define WUDESC_SECURITY 0x0c -+#define WUDESC_KEY 0x0d -+#define WUD_GET_KEY_INDEX(_wValue_) ((_wValue_) & 0xf) -+#define WUD_GET_KEY_TYPE(_wValue_) (((_wValue_) & 0x30) >> 4) -+#define WUD_KEY_TYPE_ASSOC 0x01 -+#define WUD_KEY_TYPE_GTK 0x02 -+#define WUD_GET_KEY_ORIGIN(_wValue_) (((_wValue_) & 0x40) >> 6) -+#define WUD_KEY_ORIGIN_HOST 0x00 -+#define WUD_KEY_ORIGIN_DEVICE 0x01 -+#define WUDESC_ENCRYPTION_TYPE 0x0e -+#define WUDESC_BOS 0x0f -+#define WUDESC_DEVICE_CAPABILITY 0x10 -+#define WUDESC_WIRELESS_ENDPOINT_COMPANION 0x11 -+#define UDESC_BOS 0x0f -+#define UDESC_DEVICE_CAPABILITY 0x10 -+#define UDESC_CS_DEVICE 0x21 /* class specific */ -+#define UDESC_CS_CONFIG 0x22 -+#define UDESC_CS_STRING 0x23 -+#define UDESC_CS_INTERFACE 0x24 -+#define UDESC_CS_ENDPOINT 0x25 -+#define UDESC_HUB 0x29 -+#define UR_SET_DESCRIPTOR 0x07 -+#define UR_GET_CONFIG 0x08 -+#define UR_SET_CONFIG 0x09 -+#define UR_GET_INTERFACE 0x0a -+#define UR_SET_INTERFACE 0x0b -+#define UR_SYNCH_FRAME 0x0c -+#define WUR_SET_ENCRYPTION 0x0d -+#define WUR_GET_ENCRYPTION 0x0e -+#define WUR_SET_HANDSHAKE 0x0f -+#define WUR_GET_HANDSHAKE 0x10 -+#define WUR_SET_CONNECTION 0x11 -+#define WUR_SET_SECURITY_DATA 0x12 -+#define WUR_GET_SECURITY_DATA 0x13 -+#define WUR_SET_WUSB_DATA 0x14 -+#define WUDATA_DRPIE_INFO 0x01 -+#define WUDATA_TRANSMIT_DATA 0x02 -+#define WUDATA_TRANSMIT_PARAMS 0x03 -+#define WUDATA_RECEIVE_PARAMS 0x04 -+#define WUDATA_TRANSMIT_POWER 0x05 -+#define WUR_LOOPBACK_DATA_WRITE 0x15 -+#define WUR_LOOPBACK_DATA_READ 0x16 -+#define WUR_SET_INTERFACE_DS 0x17 -+ -+/* Feature numbers */ -+#define UF_ENDPOINT_HALT 0 -+#define UF_DEVICE_REMOTE_WAKEUP 1 -+#define UF_TEST_MODE 2 -+#define UF_DEVICE_B_HNP_ENABLE 3 -+#define UF_DEVICE_A_HNP_SUPPORT 4 -+#define UF_DEVICE_A_ALT_HNP_SUPPORT 5 -+#define WUF_WUSB 3 -+#define WUF_TX_DRPIE 0x0 -+#define WUF_DEV_XMIT_PACKET 0x1 -+#define WUF_COUNT_PACKETS 0x2 -+#define WUF_CAPTURE_PACKETS 0x3 -+#define UF_FUNCTION_SUSPEND 0 -+#define UF_U1_ENABLE 48 -+#define UF_U2_ENABLE 49 -+#define UF_LTM_ENABLE 50 -+ -+/* Class requests from the USB 2.0 hub spec, table 11-15 */ -+#define UCR_CLEAR_HUB_FEATURE (0x2000 | UR_CLEAR_FEATURE) -+#define UCR_CLEAR_PORT_FEATURE (0x2300 | UR_CLEAR_FEATURE) -+#define UCR_GET_HUB_DESCRIPTOR (0xa000 | UR_GET_DESCRIPTOR) -+#define UCR_GET_HUB_STATUS (0xa000 | UR_GET_STATUS) -+#define UCR_GET_PORT_STATUS (0xa300 | UR_GET_STATUS) -+#define UCR_SET_HUB_FEATURE (0x2000 | UR_SET_FEATURE) -+#define UCR_SET_PORT_FEATURE (0x2300 | UR_SET_FEATURE) -+#define UCR_SET_AND_TEST_PORT_FEATURE (0xa300 | UR_SET_AND_TEST_FEATURE) -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDescriptorSubtype; -+} UPACKED usb_descriptor_t; -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+} UPACKED usb_descriptor_header_t; -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord bcdUSB; -+#define UD_USB_2_0 0x0200 -+#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0) -+ uByte bDeviceClass; -+ uByte bDeviceSubClass; -+ uByte bDeviceProtocol; -+ uByte bMaxPacketSize; -+ /* The fields below are not part of the initial descriptor. */ -+ uWord idVendor; -+ uWord idProduct; -+ uWord bcdDevice; -+ uByte iManufacturer; -+ uByte iProduct; -+ uByte iSerialNumber; -+ uByte bNumConfigurations; -+} UPACKED usb_device_descriptor_t; -+#define USB_DEVICE_DESCRIPTOR_SIZE 18 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord wTotalLength; -+ uByte bNumInterface; -+ uByte bConfigurationValue; -+ uByte iConfiguration; -+#define UC_ATT_ONE (1 << 7) /* must be set */ -+#define UC_ATT_SELFPOWER (1 << 6) /* self powered */ -+#define UC_ATT_WAKEUP (1 << 5) /* can wakeup */ -+#define UC_ATT_BATTERY (1 << 4) /* battery powered */ -+ uByte bmAttributes; -+#define UC_BUS_POWERED 0x80 -+#define UC_SELF_POWERED 0x40 -+#define UC_REMOTE_WAKEUP 0x20 -+ uByte bMaxPower; /* max current in 2 mA units */ -+#define UC_POWER_FACTOR 2 -+} UPACKED usb_config_descriptor_t; -+#define USB_CONFIG_DESCRIPTOR_SIZE 9 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bInterfaceNumber; -+ uByte bAlternateSetting; -+ uByte bNumEndpoints; -+ uByte bInterfaceClass; -+ uByte bInterfaceSubClass; -+ uByte bInterfaceProtocol; -+ uByte iInterface; -+} UPACKED usb_interface_descriptor_t; -+#define USB_INTERFACE_DESCRIPTOR_SIZE 9 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bEndpointAddress; -+#define UE_GET_DIR(a) ((a) & 0x80) -+#define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) -+#define UE_DIR_IN 0x80 -+#define UE_DIR_OUT 0x00 -+#define UE_ADDR 0x0f -+#define UE_GET_ADDR(a) ((a) & UE_ADDR) -+ uByte bmAttributes; -+#define UE_XFERTYPE 0x03 -+#define UE_CONTROL 0x00 -+#define UE_ISOCHRONOUS 0x01 -+#define UE_BULK 0x02 -+#define UE_INTERRUPT 0x03 -+#define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE) -+#define UE_ISO_TYPE 0x0c -+#define UE_ISO_ASYNC 0x04 -+#define UE_ISO_ADAPT 0x08 -+#define UE_ISO_SYNC 0x0c -+#define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE) -+ uWord wMaxPacketSize; -+ uByte bInterval; -+} UPACKED usb_endpoint_descriptor_t; -+#define USB_ENDPOINT_DESCRIPTOR_SIZE 7 -+ -+typedef struct ss_endpoint_companion_descriptor { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bMaxBurst; -+#define USSE_GET_MAX_STREAMS(a) ((a) & 0x1f) -+#define USSE_SET_MAX_STREAMS(a, b) ((a) | ((b) & 0x1f)) -+#define USSE_GET_MAX_PACKET_NUM(a) ((a) & 0x03) -+#define USSE_SET_MAX_PACKET_NUM(a, b) ((a) | ((b) & 0x03)) -+ uByte bmAttributes; -+ uWord wBytesPerInterval; -+} UPACKED ss_endpoint_companion_descriptor_t; -+#define USB_SS_ENDPOINT_COMPANION_DESCRIPTOR_SIZE 6 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord bString[127]; -+} UPACKED usb_string_descriptor_t; -+#define USB_MAX_STRING_LEN 128 -+#define USB_LANGUAGE_TABLE 0 /* # of the string language id table */ -+ -+/* Hub specific request */ -+#define UR_GET_BUS_STATE 0x02 -+#define UR_CLEAR_TT_BUFFER 0x08 -+#define UR_RESET_TT 0x09 -+#define UR_GET_TT_STATE 0x0a -+#define UR_STOP_TT 0x0b -+ -+/* Hub features */ -+#define UHF_C_HUB_LOCAL_POWER 0 -+#define UHF_C_HUB_OVER_CURRENT 1 -+#define UHF_PORT_CONNECTION 0 -+#define UHF_PORT_ENABLE 1 -+#define UHF_PORT_SUSPEND 2 -+#define UHF_PORT_OVER_CURRENT 3 -+#define UHF_PORT_RESET 4 -+#define UHF_PORT_L1 5 -+#define UHF_PORT_POWER 8 -+#define UHF_PORT_LOW_SPEED 9 -+#define UHF_PORT_HIGH_SPEED 10 -+#define UHF_C_PORT_CONNECTION 16 -+#define UHF_C_PORT_ENABLE 17 -+#define UHF_C_PORT_SUSPEND 18 -+#define UHF_C_PORT_OVER_CURRENT 19 -+#define UHF_C_PORT_RESET 20 -+#define UHF_C_PORT_L1 23 -+#define UHF_PORT_TEST 21 -+#define UHF_PORT_INDICATOR 22 -+ -+typedef struct { -+ uByte bDescLength; -+ uByte bDescriptorType; -+ uByte bNbrPorts; -+ uWord wHubCharacteristics; -+#define UHD_PWR 0x0003 -+#define UHD_PWR_GANGED 0x0000 -+#define UHD_PWR_INDIVIDUAL 0x0001 -+#define UHD_PWR_NO_SWITCH 0x0002 -+#define UHD_COMPOUND 0x0004 -+#define UHD_OC 0x0018 -+#define UHD_OC_GLOBAL 0x0000 -+#define UHD_OC_INDIVIDUAL 0x0008 -+#define UHD_OC_NONE 0x0010 -+#define UHD_TT_THINK 0x0060 -+#define UHD_TT_THINK_8 0x0000 -+#define UHD_TT_THINK_16 0x0020 -+#define UHD_TT_THINK_24 0x0040 -+#define UHD_TT_THINK_32 0x0060 -+#define UHD_PORT_IND 0x0080 -+ uByte bPwrOn2PwrGood; /* delay in 2 ms units */ -+#define UHD_PWRON_FACTOR 2 -+ uByte bHubContrCurrent; -+ uByte DeviceRemovable[32]; /* max 255 ports */ -+#define UHD_NOT_REMOV(desc, i) \ -+ (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1) -+ /* deprecated */ uByte PortPowerCtrlMask[1]; -+} UPACKED usb_hub_descriptor_t; -+#define USB_HUB_DESCRIPTOR_SIZE 9 /* includes deprecated PortPowerCtrlMask */ -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord bcdUSB; -+ uByte bDeviceClass; -+ uByte bDeviceSubClass; -+ uByte bDeviceProtocol; -+ uByte bMaxPacketSize0; -+ uByte bNumConfigurations; -+ uByte bReserved; -+} UPACKED usb_device_qualifier_t; -+#define USB_DEVICE_QUALIFIER_SIZE 10 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bmAttributes; -+#define UOTG_SRP 0x01 -+#define UOTG_HNP 0x02 -+} UPACKED usb_otg_descriptor_t; -+ -+/* OTG feature selectors */ -+#define UOTG_B_HNP_ENABLE 3 -+#define UOTG_A_HNP_SUPPORT 4 -+#define UOTG_A_ALT_HNP_SUPPORT 5 -+ -+typedef struct { -+ uWord wStatus; -+/* Device status flags */ -+#define UDS_SELF_POWERED 0x0001 -+#define UDS_REMOTE_WAKEUP 0x0002 -+/* Endpoint status flags */ -+#define UES_HALT 0x0001 -+} UPACKED usb_status_t; -+ -+typedef struct { -+ uWord wHubStatus; -+#define UHS_LOCAL_POWER 0x0001 -+#define UHS_OVER_CURRENT 0x0002 -+ uWord wHubChange; -+} UPACKED usb_hub_status_t; -+ -+typedef struct { -+ uWord wPortStatus; -+#define UPS_CURRENT_CONNECT_STATUS 0x0001 -+#define UPS_PORT_ENABLED 0x0002 -+#define UPS_SUSPEND 0x0004 -+#define UPS_OVERCURRENT_INDICATOR 0x0008 -+#define UPS_RESET 0x0010 -+#define UPS_PORT_POWER 0x0100 -+#define UPS_LOW_SPEED 0x0200 -+#define UPS_HIGH_SPEED 0x0400 -+#define UPS_PORT_TEST 0x0800 -+#define UPS_PORT_INDICATOR 0x1000 -+ uWord wPortChange; -+#define UPS_C_CONNECT_STATUS 0x0001 -+#define UPS_C_PORT_ENABLED 0x0002 -+#define UPS_C_SUSPEND 0x0004 -+#define UPS_C_OVERCURRENT_INDICATOR 0x0008 -+#define UPS_C_PORT_RESET 0x0010 -+} UPACKED usb_port_status_t; -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+/* Device class codes */ -+#define UDCLASS_IN_INTERFACE 0x00 -+#define UDCLASS_COMM 0x02 -+#define UDCLASS_HUB 0x09 -+#define UDSUBCLASS_HUB 0x00 -+#define UDPROTO_FSHUB 0x00 -+#define UDPROTO_HSHUBSTT 0x01 -+#define UDPROTO_HSHUBMTT 0x02 -+#define UDCLASS_DIAGNOSTIC 0xdc -+#define UDCLASS_WIRELESS 0xe0 -+#define UDSUBCLASS_RF 0x01 -+#define UDPROTO_BLUETOOTH 0x01 -+#define UDCLASS_VENDOR 0xff -+ -+/* Interface class codes */ -+#define UICLASS_UNSPEC 0x00 -+ -+#define UICLASS_AUDIO 0x01 -+#define UISUBCLASS_AUDIOCONTROL 1 -+#define UISUBCLASS_AUDIOSTREAM 2 -+#define UISUBCLASS_MIDISTREAM 3 -+ -+#define UICLASS_CDC 0x02 /* communication */ -+#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1 -+#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2 -+#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3 -+#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4 -+#define UISUBCLASS_CAPI_CONTROLMODEL 5 -+#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6 -+#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7 -+#define UIPROTO_CDC_AT 1 -+ -+#define UICLASS_HID 0x03 -+#define UISUBCLASS_BOOT 1 -+#define UIPROTO_BOOT_KEYBOARD 1 -+ -+#define UICLASS_PHYSICAL 0x05 -+ -+#define UICLASS_IMAGE 0x06 -+ -+#define UICLASS_PRINTER 0x07 -+#define UISUBCLASS_PRINTER 1 -+#define UIPROTO_PRINTER_UNI 1 -+#define UIPROTO_PRINTER_BI 2 -+#define UIPROTO_PRINTER_1284 3 -+ -+#define UICLASS_MASS 0x08 -+#define UISUBCLASS_RBC 1 -+#define UISUBCLASS_SFF8020I 2 -+#define UISUBCLASS_QIC157 3 -+#define UISUBCLASS_UFI 4 -+#define UISUBCLASS_SFF8070I 5 -+#define UISUBCLASS_SCSI 6 -+#define UIPROTO_MASS_CBI_I 0 -+#define UIPROTO_MASS_CBI 1 -+#define UIPROTO_MASS_BBB_OLD 2 /* Not in the spec anymore */ -+#define UIPROTO_MASS_BBB 80 /* 'P' for the Iomega Zip drive */ -+ -+#define UICLASS_HUB 0x09 -+#define UISUBCLASS_HUB 0 -+#define UIPROTO_FSHUB 0 -+#define UIPROTO_HSHUBSTT 0 /* Yes, same as previous */ -+#define UIPROTO_HSHUBMTT 1 -+ -+#define UICLASS_CDC_DATA 0x0a -+#define UISUBCLASS_DATA 0 -+#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */ -+#define UIPROTO_DATA_HDLC 0x31 /* HDLC */ -+#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */ -+#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */ -+#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */ -+#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */ -+#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */ -+#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */ -+#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */ -+#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */ -+#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */ -+#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/ -+#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */ -+ -+#define UICLASS_SMARTCARD 0x0b -+ -+/*#define UICLASS_FIRM_UPD 0x0c*/ -+ -+#define UICLASS_SECURITY 0x0d -+ -+#define UICLASS_DIAGNOSTIC 0xdc -+ -+#define UICLASS_WIRELESS 0xe0 -+#define UISUBCLASS_RF 0x01 -+#define UIPROTO_BLUETOOTH 0x01 -+ -+#define UICLASS_APPL_SPEC 0xfe -+#define UISUBCLASS_FIRMWARE_DOWNLOAD 1 -+#define UISUBCLASS_IRDA 2 -+#define UIPROTO_IRDA 0 -+ -+#define UICLASS_VENDOR 0xff -+ -+#define USB_HUB_MAX_DEPTH 5 -+ -+/* -+ * Minimum time a device needs to be powered down to go through -+ * a power cycle. XXX Are these time in the spec? -+ */ -+#define USB_POWER_DOWN_TIME 200 /* ms */ -+#define USB_PORT_POWER_DOWN_TIME 100 /* ms */ -+ -+#if 0 -+/* These are the values from the spec. */ -+#define USB_PORT_RESET_DELAY 10 /* ms */ -+#define USB_PORT_ROOT_RESET_DELAY 50 /* ms */ -+#define USB_PORT_RESET_RECOVERY 10 /* ms */ -+#define USB_PORT_POWERUP_DELAY 100 /* ms */ -+#define USB_SET_ADDRESS_SETTLE 2 /* ms */ -+#define USB_RESUME_DELAY (20*5) /* ms */ -+#define USB_RESUME_WAIT 10 /* ms */ -+#define USB_RESUME_RECOVERY 10 /* ms */ -+#define USB_EXTRA_POWER_UP_TIME 0 /* ms */ -+#else -+/* Allow for marginal (i.e. non-conforming) devices. */ -+#define USB_PORT_RESET_DELAY 50 /* ms */ -+#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */ -+#define USB_PORT_RESET_RECOVERY 250 /* ms */ -+#define USB_PORT_POWERUP_DELAY 300 /* ms */ -+#define USB_SET_ADDRESS_SETTLE 10 /* ms */ -+#define USB_RESUME_DELAY (50*5) /* ms */ -+#define USB_RESUME_WAIT 50 /* ms */ -+#define USB_RESUME_RECOVERY 50 /* ms */ -+#define USB_EXTRA_POWER_UP_TIME 20 /* ms */ -+#endif -+ -+#define USB_MIN_POWER 100 /* mA */ -+#define USB_MAX_POWER 500 /* mA */ -+ -+#define USB_BUS_RESET_DELAY 100 /* ms XXX?*/ -+ -+#define USB_UNCONFIG_NO 0 -+#define USB_UNCONFIG_INDEX (-1) -+ -+/*** ioctl() related stuff ***/ -+ -+struct usb_ctl_request { -+ int ucr_addr; -+ usb_device_request_t ucr_request; -+ void *ucr_data; -+ int ucr_flags; -+#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ -+ int ucr_actlen; /* actual length transferred */ -+}; -+ -+struct usb_alt_interface { -+ int uai_config_index; -+ int uai_interface_index; -+ int uai_alt_no; -+}; -+ -+#define USB_CURRENT_CONFIG_INDEX (-1) -+#define USB_CURRENT_ALT_INDEX (-1) -+ -+struct usb_config_desc { -+ int ucd_config_index; -+ usb_config_descriptor_t ucd_desc; -+}; -+ -+struct usb_interface_desc { -+ int uid_config_index; -+ int uid_interface_index; -+ int uid_alt_index; -+ usb_interface_descriptor_t uid_desc; -+}; -+ -+struct usb_endpoint_desc { -+ int ued_config_index; -+ int ued_interface_index; -+ int ued_alt_index; -+ int ued_endpoint_index; -+ usb_endpoint_descriptor_t ued_desc; -+}; -+ -+struct usb_full_desc { -+ int ufd_config_index; -+ u_int ufd_size; -+ u_char *ufd_data; -+}; -+ -+struct usb_string_desc { -+ int usd_string_index; -+ int usd_language_id; -+ usb_string_descriptor_t usd_desc; -+}; -+ -+struct usb_ctl_report_desc { -+ int ucrd_size; -+ u_char ucrd_data[1024]; /* filled data size will vary */ -+}; -+ -+typedef struct { u_int32_t cookie; } usb_event_cookie_t; -+ -+#define USB_MAX_DEVNAMES 4 -+#define USB_MAX_DEVNAMELEN 16 -+struct usb_device_info { -+ u_int8_t udi_bus; -+ u_int8_t udi_addr; /* device address */ -+ usb_event_cookie_t udi_cookie; -+ char udi_product[USB_MAX_STRING_LEN]; -+ char udi_vendor[USB_MAX_STRING_LEN]; -+ char udi_release[8]; -+ u_int16_t udi_productNo; -+ u_int16_t udi_vendorNo; -+ u_int16_t udi_releaseNo; -+ u_int8_t udi_class; -+ u_int8_t udi_subclass; -+ u_int8_t udi_protocol; -+ u_int8_t udi_config; -+ u_int8_t udi_speed; -+#define USB_SPEED_UNKNOWN 0 -+#define USB_SPEED_LOW 1 -+#define USB_SPEED_FULL 2 -+#define USB_SPEED_HIGH 3 -+#define USB_SPEED_VARIABLE 4 -+#define USB_SPEED_SUPER 5 -+ int udi_power; /* power consumption in mA, 0 if selfpowered */ -+ int udi_nports; -+ char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; -+ u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */ -+#define USB_PORT_ENABLED 0xff -+#define USB_PORT_SUSPENDED 0xfe -+#define USB_PORT_POWERED 0xfd -+#define USB_PORT_DISABLED 0xfc -+}; -+ -+struct usb_ctl_report { -+ int ucr_report; -+ u_char ucr_data[1024]; /* filled data size will vary */ -+}; -+ -+struct usb_device_stats { -+ u_long uds_requests[4]; /* indexed by transfer type UE_* */ -+}; -+ -+#define WUSB_MIN_IE 0x80 -+#define WUSB_WCTA_IE 0x80 -+#define WUSB_WCONNECTACK_IE 0x81 -+#define WUSB_WHOSTINFO_IE 0x82 -+#define WUHI_GET_CA(_bmAttributes_) ((_bmAttributes_) & 0x3) -+#define WUHI_CA_RECONN 0x00 -+#define WUHI_CA_LIMITED 0x01 -+#define WUHI_CA_ALL 0x03 -+#define WUHI_GET_MLSI(_bmAttributes_) (((_bmAttributes_) & 0x38) >> 3) -+#define WUSB_WCHCHANGEANNOUNCE_IE 0x83 -+#define WUSB_WDEV_DISCONNECT_IE 0x84 -+#define WUSB_WHOST_DISCONNECT_IE 0x85 -+#define WUSB_WRELEASE_CHANNEL_IE 0x86 -+#define WUSB_WWORK_IE 0x87 -+#define WUSB_WCHANNEL_STOP_IE 0x88 -+#define WUSB_WDEV_KEEPALIVE_IE 0x89 -+#define WUSB_WISOCH_DISCARD_IE 0x8A -+#define WUSB_WRESETDEVICE_IE 0x8B -+#define WUSB_WXMIT_PACKET_ADJUST_IE 0x8C -+#define WUSB_MAX_IE 0x8C -+ -+/* Device Notification Types */ -+ -+#define WUSB_DN_MIN 0x01 -+#define WUSB_DN_CONNECT 0x01 -+# define WUSB_DA_OLDCONN 0x00 -+# define WUSB_DA_NEWCONN 0x01 -+# define WUSB_DA_SELF_BEACON 0x02 -+# define WUSB_DA_DIR_BEACON 0x04 -+# define WUSB_DA_NO_BEACON 0x06 -+#define WUSB_DN_DISCONNECT 0x02 -+#define WUSB_DN_EPRDY 0x03 -+#define WUSB_DN_MASAVAILCHANGED 0x04 -+#define WUSB_DN_REMOTEWAKEUP 0x05 -+#define WUSB_DN_SLEEP 0x06 -+#define WUSB_DN_ALIVE 0x07 -+#define WUSB_DN_MAX 0x07 -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+/* WUSB Handshake Data. Used during the SET/GET HANDSHAKE requests */ -+typedef struct wusb_hndshk_data { -+ uByte bMessageNumber; -+ uByte bStatus; -+ uByte tTKID[3]; -+ uByte bReserved; -+ uByte CDID[16]; -+ uByte Nonce[16]; -+ uByte MIC[8]; -+} UPACKED wusb_hndshk_data_t; -+#define WUSB_HANDSHAKE_LEN_FOR_MIC 38 -+ -+/* WUSB Connection Context */ -+typedef struct wusb_conn_context { -+ uByte CHID [16]; -+ uByte CDID [16]; -+ uByte CK [16]; -+} UPACKED wusb_conn_context_t; -+ -+/* WUSB Security Descriptor */ -+typedef struct wusb_security_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord wTotalLength; -+ uByte bNumEncryptionTypes; -+} UPACKED wusb_security_desc_t; -+ -+/* WUSB Encryption Type Descriptor */ -+typedef struct wusb_encrypt_type_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ -+ uByte bEncryptionType; -+#define WUETD_UNSECURE 0 -+#define WUETD_WIRED 1 -+#define WUETD_CCM_1 2 -+#define WUETD_RSA_1 3 -+ -+ uByte bEncryptionValue; -+ uByte bAuthKeyIndex; -+} UPACKED wusb_encrypt_type_desc_t; -+ -+/* WUSB Key Descriptor */ -+typedef struct wusb_key_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte tTKID[3]; -+ uByte bReserved; -+ uByte KeyData[1]; /* variable length */ -+} UPACKED wusb_key_desc_t; -+ -+/* WUSB BOS Descriptor (Binary device Object Store) */ -+typedef struct wusb_bos_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord wTotalLength; -+ uByte bNumDeviceCaps; -+} UPACKED wusb_bos_desc_t; -+ -+#define USB_DEVICE_CAPABILITY_20_EXTENSION 0x02 -+typedef struct usb_dev_cap_20_ext_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+#define USB_20_EXT_LPM 0x02 -+ uDWord bmAttributes; -+} UPACKED usb_dev_cap_20_ext_desc_t; -+ -+#define USB_DEVICE_CAPABILITY_SS_USB 0x03 -+typedef struct usb_dev_cap_ss_usb { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+#define USB_DC_SS_USB_LTM_CAPABLE 0x02 -+ uByte bmAttributes; -+#define USB_DC_SS_USB_SPEED_SUPPORT_LOW 0x01 -+#define USB_DC_SS_USB_SPEED_SUPPORT_FULL 0x02 -+#define USB_DC_SS_USB_SPEED_SUPPORT_HIGH 0x04 -+#define USB_DC_SS_USB_SPEED_SUPPORT_SS 0x08 -+ uWord wSpeedsSupported; -+ uByte bFunctionalitySupport; -+ uByte bU1DevExitLat; -+ uWord wU2DevExitLat; -+} UPACKED usb_dev_cap_ss_usb_t; -+ -+#define USB_DEVICE_CAPABILITY_CONTAINER_ID 0x04 -+typedef struct usb_dev_cap_container_id { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+ uByte bReserved; -+ uByte containerID[16]; -+} UPACKED usb_dev_cap_container_id_t; -+ -+/* Device Capability Type Codes */ -+#define WUSB_DEVICE_CAPABILITY_WIRELESS_USB 0x01 -+ -+/* Device Capability Descriptor */ -+typedef struct wusb_dev_cap_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+ uByte caps[1]; /* Variable length */ -+} UPACKED wusb_dev_cap_desc_t; -+ -+/* Device Capability Descriptor */ -+typedef struct wusb_dev_cap_uwb_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+ uByte bmAttributes; -+ uWord wPHYRates; /* Bitmap */ -+ uByte bmTFITXPowerInfo; -+ uByte bmFFITXPowerInfo; -+ uWord bmBandGroup; -+ uByte bReserved; -+} UPACKED wusb_dev_cap_uwb_desc_t; -+ -+/* Wireless USB Endpoint Companion Descriptor */ -+typedef struct wusb_endpoint_companion_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bMaxBurst; -+ uByte bMaxSequence; -+ uWord wMaxStreamDelay; -+ uWord wOverTheAirPacketSize; -+ uByte bOverTheAirInterval; -+ uByte bmCompAttributes; -+} UPACKED wusb_endpoint_companion_desc_t; -+ -+/* Wireless USB Numeric Association M1 Data Structure */ -+typedef struct wusb_m1_data { -+ uByte version; -+ uWord langId; -+ uByte deviceFriendlyNameLength; -+ uByte sha_256_m3[32]; -+ uByte deviceFriendlyName[256]; -+} UPACKED wusb_m1_data_t; -+ -+typedef struct wusb_m2_data { -+ uByte version; -+ uWord langId; -+ uByte hostFriendlyNameLength; -+ uByte pkh[384]; -+ uByte hostFriendlyName[256]; -+} UPACKED wusb_m2_data_t; -+ -+typedef struct wusb_m3_data { -+ uByte pkd[384]; -+ uByte nd; -+} UPACKED wusb_m3_data_t; -+ -+typedef struct wusb_m4_data { -+ uDWord _attributeTypeIdAndLength_1; -+ uWord associationTypeId; -+ -+ uDWord _attributeTypeIdAndLength_2; -+ uWord associationSubTypeId; -+ -+ uDWord _attributeTypeIdAndLength_3; -+ uDWord length; -+ -+ uDWord _attributeTypeIdAndLength_4; -+ uDWord associationStatus; -+ -+ uDWord _attributeTypeIdAndLength_5; -+ uByte chid[16]; -+ -+ uDWord _attributeTypeIdAndLength_6; -+ uByte cdid[16]; -+ -+ uDWord _attributeTypeIdAndLength_7; -+ uByte bandGroups[2]; -+} UPACKED wusb_m4_data_t; -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _USB_H_ */ -diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..e7bdd12015fee1727a7956ae3e3b2786e88892c1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/Makefile -@@ -0,0 +1,82 @@ -+# -+# Makefile for DWC_otg Highspeed USB controller driver -+# -+ -+ifneq ($(KERNELRELEASE),) -+ -+# Use the BUS_INTERFACE variable to compile the software for either -+# PCI(PCI_INTERFACE) or LM(LM_INTERFACE) bus. -+ifeq ($(BUS_INTERFACE),) -+# BUS_INTERFACE = -DPCI_INTERFACE -+# BUS_INTERFACE = -DLM_INTERFACE -+ BUS_INTERFACE = -DPLATFORM_INTERFACE -+endif -+ -+#ccflags-y += -DDEBUG -+#ccflags-y += -DDWC_OTG_DEBUGLEV=1 # reduce common debug msgs -+ -+# Use one of the following flags to compile the software in host-only or -+# device-only mode. -+#ccflags-y += -DDWC_HOST_ONLY -+#ccflags-y += -DDWC_DEVICE_ONLY -+ -+ccflags-y += -Dlinux -DDWC_HS_ELECT_TST -+#ccflags-y += -DDWC_EN_ISOC -+ccflags-y += -I$(obj)/../dwc_common_port -+#ccflags-y += -I$(PORTLIB) -+ccflags-y += -DDWC_LINUX -+ccflags-y += $(CFI) -+ccflags-y += $(BUS_INTERFACE) -+#ccflags-y += -DDWC_DEV_SRPCAP -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o -+ -+dwc_otg-objs := dwc_otg_driver.o dwc_otg_attr.o -+dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o -+dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o -+dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o -+dwc_otg-objs += dwc_otg_adp.o -+dwc_otg-objs += dwc_otg_fiq_fsm.o -+dwc_otg-objs += dwc_otg_fiq_stub.o -+ifneq ($(CFI),) -+dwc_otg-objs += dwc_otg_cfi.o -+endif -+ -+kernrelwd := $(subst ., ,$(KERNELRELEASE)) -+kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) -+ -+ifneq ($(kernrel3),2.6.20) -+ccflags-y += $(CPPFLAGS) -+endif -+ -+else -+ -+PWD := $(shell pwd) -+PORTLIB := $(PWD)/../dwc_common_port -+ -+# Command paths -+CTAGS := $(CTAGS) -+DOXYGEN := $(DOXYGEN) -+ -+default: portlib -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+install: default -+ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install -+ $(MAKE) -C$(KDIR) M=$(PWD) modules_install -+ -+portlib: -+ $(MAKE) -C$(KDIR) M=$(PORTLIB) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ cp $(PORTLIB)/Module.symvers $(PWD)/ -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+ -+clean: -+ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers -+ -+endif -diff --git a/drivers/usb/host/dwc_otg/doc/doxygen.cfg b/drivers/usb/host/dwc_otg/doc/doxygen.cfg -new file mode 100644 -index 0000000000000000000000000000000000000000..712b057ef7c293e8ddfa95d89e2471fb96a38006 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/doc/doxygen.cfg -@@ -0,0 +1,224 @@ -+# Doxyfile 1.3.9.1 -+ -+#--------------------------------------------------------------------------- -+# Project related configuration options -+#--------------------------------------------------------------------------- -+PROJECT_NAME = "DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver" -+PROJECT_NUMBER = v3.00a -+OUTPUT_DIRECTORY = ./doc/ -+CREATE_SUBDIRS = NO -+OUTPUT_LANGUAGE = English -+BRIEF_MEMBER_DESC = YES -+REPEAT_BRIEF = YES -+ABBREVIATE_BRIEF = "The $name class" \ -+ "The $name widget" \ -+ "The $name file" \ -+ is \ -+ provides \ -+ specifies \ -+ contains \ -+ represents \ -+ a \ -+ an \ -+ the -+ALWAYS_DETAILED_SEC = NO -+INLINE_INHERITED_MEMB = NO -+FULL_PATH_NAMES = NO -+STRIP_FROM_PATH = -+STRIP_FROM_INC_PATH = -+SHORT_NAMES = NO -+JAVADOC_AUTOBRIEF = YES -+MULTILINE_CPP_IS_BRIEF = NO -+INHERIT_DOCS = YES -+DISTRIBUTE_GROUP_DOC = NO -+TAB_SIZE = 8 -+ALIASES = -+OPTIMIZE_OUTPUT_FOR_C = YES -+OPTIMIZE_OUTPUT_JAVA = NO -+SUBGROUPING = YES -+#--------------------------------------------------------------------------- -+# Build related configuration options -+#--------------------------------------------------------------------------- -+EXTRACT_ALL = NO -+EXTRACT_PRIVATE = YES -+EXTRACT_STATIC = YES -+EXTRACT_LOCAL_CLASSES = YES -+EXTRACT_LOCAL_METHODS = NO -+HIDE_UNDOC_MEMBERS = NO -+HIDE_UNDOC_CLASSES = NO -+HIDE_FRIEND_COMPOUNDS = NO -+HIDE_IN_BODY_DOCS = NO -+INTERNAL_DOCS = NO -+CASE_SENSE_NAMES = NO -+HIDE_SCOPE_NAMES = NO -+SHOW_INCLUDE_FILES = YES -+INLINE_INFO = YES -+SORT_MEMBER_DOCS = NO -+SORT_BRIEF_DOCS = NO -+SORT_BY_SCOPE_NAME = NO -+GENERATE_TODOLIST = YES -+GENERATE_TESTLIST = YES -+GENERATE_BUGLIST = YES -+GENERATE_DEPRECATEDLIST= YES -+ENABLED_SECTIONS = -+MAX_INITIALIZER_LINES = 30 -+SHOW_USED_FILES = YES -+SHOW_DIRECTORIES = YES -+#--------------------------------------------------------------------------- -+# configuration options related to warning and progress messages -+#--------------------------------------------------------------------------- -+QUIET = YES -+WARNINGS = YES -+WARN_IF_UNDOCUMENTED = NO -+WARN_IF_DOC_ERROR = YES -+WARN_FORMAT = "$file:$line: $text" -+WARN_LOGFILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the input files -+#--------------------------------------------------------------------------- -+INPUT = . -+FILE_PATTERNS = *.c \ -+ *.h \ -+ ./linux/*.c \ -+ ./linux/*.h -+RECURSIVE = NO -+EXCLUDE = ./test/ \ -+ ./dwc_otg/.AppleDouble/ -+EXCLUDE_SYMLINKS = YES -+EXCLUDE_PATTERNS = *.mod.* -+EXAMPLE_PATH = -+EXAMPLE_PATTERNS = * -+EXAMPLE_RECURSIVE = NO -+IMAGE_PATH = -+INPUT_FILTER = -+FILTER_PATTERNS = -+FILTER_SOURCE_FILES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to source browsing -+#--------------------------------------------------------------------------- -+SOURCE_BROWSER = YES -+INLINE_SOURCES = NO -+STRIP_CODE_COMMENTS = YES -+REFERENCED_BY_RELATION = NO -+REFERENCES_RELATION = NO -+VERBATIM_HEADERS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the alphabetical class index -+#--------------------------------------------------------------------------- -+ALPHABETICAL_INDEX = NO -+COLS_IN_ALPHA_INDEX = 5 -+IGNORE_PREFIX = -+#--------------------------------------------------------------------------- -+# configuration options related to the HTML output -+#--------------------------------------------------------------------------- -+GENERATE_HTML = YES -+HTML_OUTPUT = html -+HTML_FILE_EXTENSION = .html -+HTML_HEADER = -+HTML_FOOTER = -+HTML_STYLESHEET = -+HTML_ALIGN_MEMBERS = YES -+GENERATE_HTMLHELP = NO -+CHM_FILE = -+HHC_LOCATION = -+GENERATE_CHI = NO -+BINARY_TOC = NO -+TOC_EXPAND = NO -+DISABLE_INDEX = NO -+ENUM_VALUES_PER_LINE = 4 -+GENERATE_TREEVIEW = YES -+TREEVIEW_WIDTH = 250 -+#--------------------------------------------------------------------------- -+# configuration options related to the LaTeX output -+#--------------------------------------------------------------------------- -+GENERATE_LATEX = NO -+LATEX_OUTPUT = latex -+LATEX_CMD_NAME = latex -+MAKEINDEX_CMD_NAME = makeindex -+COMPACT_LATEX = NO -+PAPER_TYPE = a4wide -+EXTRA_PACKAGES = -+LATEX_HEADER = -+PDF_HYPERLINKS = NO -+USE_PDFLATEX = NO -+LATEX_BATCHMODE = NO -+LATEX_HIDE_INDICES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the RTF output -+#--------------------------------------------------------------------------- -+GENERATE_RTF = NO -+RTF_OUTPUT = rtf -+COMPACT_RTF = NO -+RTF_HYPERLINKS = NO -+RTF_STYLESHEET_FILE = -+RTF_EXTENSIONS_FILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the man page output -+#--------------------------------------------------------------------------- -+GENERATE_MAN = NO -+MAN_OUTPUT = man -+MAN_EXTENSION = .3 -+MAN_LINKS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the XML output -+#--------------------------------------------------------------------------- -+GENERATE_XML = NO -+XML_OUTPUT = xml -+XML_SCHEMA = -+XML_DTD = -+XML_PROGRAMLISTING = YES -+#--------------------------------------------------------------------------- -+# configuration options for the AutoGen Definitions output -+#--------------------------------------------------------------------------- -+GENERATE_AUTOGEN_DEF = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the Perl module output -+#--------------------------------------------------------------------------- -+GENERATE_PERLMOD = NO -+PERLMOD_LATEX = NO -+PERLMOD_PRETTY = YES -+PERLMOD_MAKEVAR_PREFIX = -+#--------------------------------------------------------------------------- -+# Configuration options related to the preprocessor -+#--------------------------------------------------------------------------- -+ENABLE_PREPROCESSING = YES -+MACRO_EXPANSION = YES -+EXPAND_ONLY_PREDEF = YES -+SEARCH_INCLUDES = YES -+INCLUDE_PATH = -+INCLUDE_FILE_PATTERNS = -+PREDEFINED = DEVICE_ATTR DWC_EN_ISOC -+EXPAND_AS_DEFINED = DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW DWC_OTG_DEVICE_ATTR_BITFIELD_STORE DWC_OTG_DEVICE_ATTR_BITFIELD_RW DWC_OTG_DEVICE_ATTR_BITFIELD_RO DWC_OTG_DEVICE_ATTR_REG_SHOW DWC_OTG_DEVICE_ATTR_REG_STORE DWC_OTG_DEVICE_ATTR_REG32_RW DWC_OTG_DEVICE_ATTR_REG32_RO DWC_EN_ISOC -+SKIP_FUNCTION_MACROS = NO -+#--------------------------------------------------------------------------- -+# Configuration::additions related to external references -+#--------------------------------------------------------------------------- -+TAGFILES = -+GENERATE_TAGFILE = -+ALLEXTERNALS = NO -+EXTERNAL_GROUPS = YES -+PERL_PATH = /usr/bin/perl -+#--------------------------------------------------------------------------- -+# Configuration options related to the dot tool -+#--------------------------------------------------------------------------- -+CLASS_DIAGRAMS = YES -+HIDE_UNDOC_RELATIONS = YES -+HAVE_DOT = NO -+CLASS_GRAPH = YES -+COLLABORATION_GRAPH = YES -+UML_LOOK = NO -+TEMPLATE_RELATIONS = NO -+INCLUDE_GRAPH = YES -+INCLUDED_BY_GRAPH = YES -+CALL_GRAPH = NO -+GRAPHICAL_HIERARCHY = YES -+DOT_IMAGE_FORMAT = png -+DOT_PATH = -+DOTFILE_DIRS = -+MAX_DOT_GRAPH_DEPTH = 1000 -+GENERATE_LEGEND = YES -+DOT_CLEANUP = YES -+#--------------------------------------------------------------------------- -+# Configuration::additions related to the search engine -+#--------------------------------------------------------------------------- -+SEARCHENGINE = NO -diff --git a/drivers/usb/host/dwc_otg/dummy_audio.c b/drivers/usb/host/dwc_otg/dummy_audio.c -new file mode 100644 -index 0000000000000000000000000000000000000000..f827102fa64414d0f6e6ad47948a87fa4ab97e69 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dummy_audio.c -@@ -0,0 +1,1574 @@ -+/* -+ * zero.c -- Gadget Zero, for USB development -+ * -+ * Copyright (C) 2003-2004 David Brownell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") as published by the Free Software -+ * Foundation, either version 2 of that License or (at your option) any -+ * later version. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+ -+/* -+ * Gadget Zero only needs two bulk endpoints, and is an example of how you -+ * can write a hardware-agnostic gadget driver running inside a USB device. -+ * -+ * Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't -+ * affect most of the driver. -+ * -+ * Use it with the Linux host/master side "usbtest" driver to get a basic -+ * functional test of your device-side usb stack, or with "usb-skeleton". -+ * -+ * It supports two similar configurations. One sinks whatever the usb host -+ * writes, and in return sources zeroes. The other loops whatever the host -+ * writes back, so the host can read it. Module options include: -+ * -+ * buflen=N default N=4096, buffer size used -+ * qlen=N default N=32, how many buffers in the loopback queue -+ * loopdefault default false, list loopback config first -+ * -+ * Many drivers will only have one configuration, letting them be much -+ * simpler if they also don't support high speed operation (like this -+ * driver does). -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -+# include -+#else -+# include -+#endif -+ -+#include -+ -+ -+/*-------------------------------------------------------------------------*/ -+/*-------------------------------------------------------------------------*/ -+ -+ -+static int utf8_to_utf16le(const char *s, u16 *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+ -+ -+/** -+ * usb_gadget_get_string - fill out a string descriptor -+ * @table: of c strings encoded using UTF-8 -+ * @id: string id, from low byte of wValue in get string descriptor -+ * @buf: at least 256 bytes -+ * -+ * Finds the UTF-8 string matching the ID, and converts it into a -+ * string descriptor in utf16-le. -+ * Returns length of descriptor (always even) or negative errno -+ * -+ * If your driver needs stings in multiple languages, you'll probably -+ * "switch (wIndex) { ... }" in your ep0 string descriptor logic, -+ * using this routine after choosing which set of UTF-8 strings to use. -+ * Note that US-ASCII is a strict subset of UTF-8; any string bytes with -+ * the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1 -+ * characters (which are also widely used in C strings). -+ */ -+int -+usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) -+{ -+ struct usb_string *s; -+ int len; -+ -+ /* descriptor 0 has the language id */ -+ if (id == 0) { -+ buf [0] = 4; -+ buf [1] = USB_DT_STRING; -+ buf [2] = (u8) table->language; -+ buf [3] = (u8) (table->language >> 8); -+ return 4; -+ } -+ for (s = table->strings; s && s->s; s++) -+ if (s->id == id) -+ break; -+ -+ /* unrecognized: stall. */ -+ if (!s || !s->s) -+ return -EINVAL; -+ -+ /* string descriptors have length, tag, then UTF16-LE text */ -+ len = min ((size_t) 126, strlen (s->s)); -+ memset (buf + 2, 0, 2 * len); /* zero all the bytes */ -+ len = utf8_to_utf16le(s->s, (u16 *)&buf[2], len); -+ if (len < 0) -+ return -EINVAL; -+ buf [0] = (len + 1) * 2; -+ buf [1] = USB_DT_STRING; -+ return buf [0]; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+/*-------------------------------------------------------------------------*/ -+ -+ -+/** -+ * usb_descriptor_fillbuf - fill buffer with descriptors -+ * @buf: Buffer to be filled -+ * @buflen: Size of buf -+ * @src: Array of descriptor pointers, terminated by null pointer. -+ * -+ * Copies descriptors into the buffer, returning the length or a -+ * negative error code if they can't all be copied. Useful when -+ * assembling descriptors for an associated set of interfaces used -+ * as part of configuring a composite device; or in other cases where -+ * sets of descriptors need to be marshaled. -+ */ -+int -+usb_descriptor_fillbuf(void *buf, unsigned buflen, -+ const struct usb_descriptor_header **src) -+{ -+ u8 *dest = buf; -+ -+ if (!src) -+ return -EINVAL; -+ -+ /* fill buffer from src[] until null descriptor ptr */ -+ for (; 0 != *src; src++) { -+ unsigned len = (*src)->bLength; -+ -+ if (len > buflen) -+ return -EINVAL; -+ memcpy(dest, *src, len); -+ buflen -= len; -+ dest += len; -+ } -+ return dest - (u8 *)buf; -+} -+ -+ -+/** -+ * usb_gadget_config_buf - builts a complete configuration descriptor -+ * @config: Header for the descriptor, including characteristics such -+ * as power requirements and number of interfaces. -+ * @desc: Null-terminated vector of pointers to the descriptors (interface, -+ * endpoint, etc) defining all functions in this device configuration. -+ * @buf: Buffer for the resulting configuration descriptor. -+ * @length: Length of buffer. If this is not big enough to hold the -+ * entire configuration descriptor, an error code will be returned. -+ * -+ * This copies descriptors into the response buffer, building a descriptor -+ * for that configuration. It returns the buffer length or a negative -+ * status code. The config.wTotalLength field is set to match the length -+ * of the result, but other descriptor fields (including power usage and -+ * interface count) must be set by the caller. -+ * -+ * Gadget drivers could use this when constructing a config descriptor -+ * in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the -+ * resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. -+ */ -+int usb_gadget_config_buf( -+ const struct usb_config_descriptor *config, -+ void *buf, -+ unsigned length, -+ const struct usb_descriptor_header **desc -+) -+{ -+ struct usb_config_descriptor *cp = buf; -+ int len; -+ -+ /* config descriptor first */ -+ if (length < USB_DT_CONFIG_SIZE || !desc) -+ return -EINVAL; -+ *cp = *config; -+ -+ /* then interface/endpoint/class/vendor/... */ -+ len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf, -+ length - USB_DT_CONFIG_SIZE, desc); -+ if (len < 0) -+ return len; -+ len += USB_DT_CONFIG_SIZE; -+ if (len > 0xffff) -+ return -EINVAL; -+ -+ /* patch up the config descriptor */ -+ cp->bLength = USB_DT_CONFIG_SIZE; -+ cp->bDescriptorType = USB_DT_CONFIG; -+ cp->wTotalLength = cpu_to_le16(len); -+ cp->bmAttributes |= USB_CONFIG_ATT_ONE; -+ return len; -+} -+ -+/*-------------------------------------------------------------------------*/ -+/*-------------------------------------------------------------------------*/ -+ -+ -+#define RBUF_LEN (1024*1024) -+static int rbuf_start; -+static int rbuf_len; -+static __u8 rbuf[RBUF_LEN]; -+ -+/*-------------------------------------------------------------------------*/ -+ -+#define DRIVER_VERSION "St Patrick's Day 2004" -+ -+static const char shortname [] = "zero"; -+static const char longname [] = "YAMAHA YST-MS35D USB Speaker "; -+ -+static const char source_sink [] = "source and sink data"; -+static const char loopback [] = "loop input to output"; -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* -+ * driver assumes self-powered hardware, and -+ * has no way for users to trigger remote wakeup. -+ * -+ * this version autoconfigures as much as possible, -+ * which is reasonable for most "bulk-only" drivers. -+ */ -+static const char *EP_IN_NAME; /* source */ -+static const char *EP_OUT_NAME; /* sink */ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* big enough to hold our biggest descriptor */ -+#define USB_BUFSIZ 512 -+ -+struct zero_dev { -+ spinlock_t lock; -+ struct usb_gadget *gadget; -+ struct usb_request *req; /* for control responses */ -+ -+ /* when configured, we have one of two configs: -+ * - source data (in to host) and sink it (out from host) -+ * - or loop it back (out from host back in to host) -+ */ -+ u8 config; -+ struct usb_ep *in_ep, *out_ep; -+ -+ /* autoresume timer */ -+ struct timer_list resume; -+}; -+ -+#define xprintk(d,level,fmt,args...) \ -+ dev_printk(level , &(d)->gadget->dev , fmt , ## args) -+ -+#ifdef DEBUG -+#define DBG(dev,fmt,args...) \ -+ xprintk(dev , KERN_DEBUG , fmt , ## args) -+#else -+#define DBG(dev,fmt,args...) \ -+ do { } while (0) -+#endif /* DEBUG */ -+ -+#ifdef VERBOSE -+#define VDBG DBG -+#else -+#define VDBG(dev,fmt,args...) \ -+ do { } while (0) -+#endif /* VERBOSE */ -+ -+#define ERROR(dev,fmt,args...) \ -+ xprintk(dev , KERN_ERR , fmt , ## args) -+#define WARN(dev,fmt,args...) \ -+ xprintk(dev , KERN_WARNING , fmt , ## args) -+#define INFO(dev,fmt,args...) \ -+ xprintk(dev , KERN_INFO , fmt , ## args) -+ -+/*-------------------------------------------------------------------------*/ -+ -+static unsigned buflen = 4096; -+static unsigned qlen = 32; -+static unsigned pattern = 0; -+ -+module_param (buflen, uint, S_IRUGO|S_IWUSR); -+module_param (qlen, uint, S_IRUGO|S_IWUSR); -+module_param (pattern, uint, S_IRUGO|S_IWUSR); -+ -+/* -+ * if it's nonzero, autoresume says how many seconds to wait -+ * before trying to wake up the host after suspend. -+ */ -+static unsigned autoresume = 0; -+module_param (autoresume, uint, 0); -+ -+/* -+ * Normally the "loopback" configuration is second (index 1) so -+ * it's not the default. Here's where to change that order, to -+ * work better with hosts where config changes are problematic. -+ * Or controllers (like superh) that only support one config. -+ */ -+static int loopdefault = 0; -+ -+module_param (loopdefault, bool, S_IRUGO|S_IWUSR); -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Thanks to NetChip Technologies for donating this product ID. -+ * -+ * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! -+ * Instead: allocate your own, using normal USB-IF procedures. -+ */ -+#ifndef CONFIG_USB_ZERO_HNPTEST -+#define DRIVER_VENDOR_NUM 0x0525 /* NetChip */ -+#define DRIVER_PRODUCT_NUM 0xa4a0 /* Linux-USB "Gadget Zero" */ -+#else -+#define DRIVER_VENDOR_NUM 0x1a0a /* OTG test device IDs */ -+#define DRIVER_PRODUCT_NUM 0xbadd -+#endif -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* -+ * DESCRIPTORS ... most are static, but strings and (full) -+ * configuration descriptors are built on demand. -+ */ -+ -+/* -+#define STRING_MANUFACTURER 25 -+#define STRING_PRODUCT 42 -+#define STRING_SERIAL 101 -+*/ -+#define STRING_MANUFACTURER 1 -+#define STRING_PRODUCT 2 -+#define STRING_SERIAL 3 -+ -+#define STRING_SOURCE_SINK 250 -+#define STRING_LOOPBACK 251 -+ -+/* -+ * This device advertises two configurations; these numbers work -+ * on a pxa250 as well as more flexible hardware. -+ */ -+#define CONFIG_SOURCE_SINK 3 -+#define CONFIG_LOOPBACK 2 -+ -+/* -+static struct usb_device_descriptor -+device_desc = { -+ .bLength = sizeof device_desc, -+ .bDescriptorType = USB_DT_DEVICE, -+ -+ .bcdUSB = __constant_cpu_to_le16 (0x0200), -+ .bDeviceClass = USB_CLASS_VENDOR_SPEC, -+ -+ .idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM), -+ .idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM), -+ .iManufacturer = STRING_MANUFACTURER, -+ .iProduct = STRING_PRODUCT, -+ .iSerialNumber = STRING_SERIAL, -+ .bNumConfigurations = 2, -+}; -+*/ -+static struct usb_device_descriptor -+device_desc = { -+ .bLength = sizeof device_desc, -+ .bDescriptorType = USB_DT_DEVICE, -+ .bcdUSB = __constant_cpu_to_le16 (0x0100), -+ .bDeviceClass = USB_CLASS_PER_INTERFACE, -+ .bDeviceSubClass = 0, -+ .bDeviceProtocol = 0, -+ .bMaxPacketSize0 = 64, -+ .bcdDevice = __constant_cpu_to_le16 (0x0100), -+ .idVendor = __constant_cpu_to_le16 (0x0499), -+ .idProduct = __constant_cpu_to_le16 (0x3002), -+ .iManufacturer = STRING_MANUFACTURER, -+ .iProduct = STRING_PRODUCT, -+ .iSerialNumber = STRING_SERIAL, -+ .bNumConfigurations = 1, -+}; -+ -+static struct usb_config_descriptor -+z_config = { -+ .bLength = sizeof z_config, -+ .bDescriptorType = USB_DT_CONFIG, -+ -+ /* compute wTotalLength on the fly */ -+ .bNumInterfaces = 2, -+ .bConfigurationValue = 1, -+ .iConfiguration = 0, -+ .bmAttributes = 0x40, -+ .bMaxPower = 0, /* self-powered */ -+}; -+ -+ -+static struct usb_otg_descriptor -+otg_descriptor = { -+ .bLength = sizeof otg_descriptor, -+ .bDescriptorType = USB_DT_OTG, -+ -+ .bmAttributes = USB_OTG_SRP, -+}; -+ -+/* one interface in each configuration */ -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ -+/* -+ * usb 2.0 devices need to expose both high speed and full speed -+ * descriptors, unless they only run at full speed. -+ * -+ * that means alternate endpoint descriptors (bigger packets) -+ * and a "device qualifier" ... plus more construction options -+ * for the config descriptor. -+ */ -+ -+static struct usb_qualifier_descriptor -+dev_qualifier = { -+ .bLength = sizeof dev_qualifier, -+ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, -+ -+ .bcdUSB = __constant_cpu_to_le16 (0x0200), -+ .bDeviceClass = USB_CLASS_VENDOR_SPEC, -+ -+ .bNumConfigurations = 2, -+}; -+ -+ -+struct usb_cs_as_general_descriptor { -+ __u8 bLength; -+ __u8 bDescriptorType; -+ -+ __u8 bDescriptorSubType; -+ __u8 bTerminalLink; -+ __u8 bDelay; -+ __u16 wFormatTag; -+} __attribute__ ((packed)); -+ -+struct usb_cs_as_format_descriptor { -+ __u8 bLength; -+ __u8 bDescriptorType; -+ -+ __u8 bDescriptorSubType; -+ __u8 bFormatType; -+ __u8 bNrChannels; -+ __u8 bSubframeSize; -+ __u8 bBitResolution; -+ __u8 bSamfreqType; -+ __u8 tLowerSamFreq[3]; -+ __u8 tUpperSamFreq[3]; -+} __attribute__ ((packed)); -+ -+static const struct usb_interface_descriptor -+z_audio_control_if_desc = { -+ .bLength = sizeof z_audio_control_if_desc, -+ .bDescriptorType = USB_DT_INTERFACE, -+ .bInterfaceNumber = 0, -+ .bAlternateSetting = 0, -+ .bNumEndpoints = 0, -+ .bInterfaceClass = USB_CLASS_AUDIO, -+ .bInterfaceSubClass = 0x1, -+ .bInterfaceProtocol = 0, -+ .iInterface = 0, -+}; -+ -+static const struct usb_interface_descriptor -+z_audio_if_desc = { -+ .bLength = sizeof z_audio_if_desc, -+ .bDescriptorType = USB_DT_INTERFACE, -+ .bInterfaceNumber = 1, -+ .bAlternateSetting = 0, -+ .bNumEndpoints = 0, -+ .bInterfaceClass = USB_CLASS_AUDIO, -+ .bInterfaceSubClass = 0x2, -+ .bInterfaceProtocol = 0, -+ .iInterface = 0, -+}; -+ -+static const struct usb_interface_descriptor -+z_audio_if_desc2 = { -+ .bLength = sizeof z_audio_if_desc, -+ .bDescriptorType = USB_DT_INTERFACE, -+ .bInterfaceNumber = 1, -+ .bAlternateSetting = 1, -+ .bNumEndpoints = 1, -+ .bInterfaceClass = USB_CLASS_AUDIO, -+ .bInterfaceSubClass = 0x2, -+ .bInterfaceProtocol = 0, -+ .iInterface = 0, -+}; -+ -+static const struct usb_cs_as_general_descriptor -+z_audio_cs_as_if_desc = { -+ .bLength = 7, -+ .bDescriptorType = 0x24, -+ -+ .bDescriptorSubType = 0x01, -+ .bTerminalLink = 0x01, -+ .bDelay = 0x0, -+ .wFormatTag = __constant_cpu_to_le16 (0x0001) -+}; -+ -+ -+static const struct usb_cs_as_format_descriptor -+z_audio_cs_as_format_desc = { -+ .bLength = 0xe, -+ .bDescriptorType = 0x24, -+ -+ .bDescriptorSubType = 2, -+ .bFormatType = 1, -+ .bNrChannels = 1, -+ .bSubframeSize = 1, -+ .bBitResolution = 8, -+ .bSamfreqType = 0, -+ .tLowerSamFreq = {0x7e, 0x13, 0x00}, -+ .tUpperSamFreq = {0xe2, 0xd6, 0x00}, -+}; -+ -+static const struct usb_endpoint_descriptor -+z_iso_ep = { -+ .bLength = 0x09, -+ .bDescriptorType = 0x05, -+ .bEndpointAddress = 0x04, -+ .bmAttributes = 0x09, -+ .wMaxPacketSize = 0x0038, -+ .bInterval = 0x01, -+ .bRefresh = 0x00, -+ .bSynchAddress = 0x00, -+}; -+ -+static char z_iso_ep2[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+// 9 bytes -+static char z_ac_interface_header_desc[] = -+{ 0x09, 0x24, 0x01, 0x00, 0x01, 0x2b, 0x00, 0x01, 0x01 }; -+ -+// 12 bytes -+static char z_0[] = {0x0c, 0x24, 0x02, 0x01, 0x01, 0x01, 0x00, 0x02, -+ 0x03, 0x00, 0x00, 0x00}; -+// 13 bytes -+static char z_1[] = {0x0d, 0x24, 0x06, 0x02, 0x01, 0x02, 0x15, 0x00, -+ 0x02, 0x00, 0x02, 0x00, 0x00}; -+// 9 bytes -+static char z_2[] = {0x09, 0x24, 0x03, 0x03, 0x01, 0x03, 0x00, 0x02, -+ 0x00}; -+ -+static char za_0[] = {0x09, 0x04, 0x01, 0x02, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_1[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_2[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x01, 0x08, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_3[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_4[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_5[] = {0x09, 0x04, 0x01, 0x03, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_6[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_7[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x02, 0x10, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_8[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_9[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_10[] = {0x09, 0x04, 0x01, 0x04, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_11[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_12[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x00, -+ 0x73, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_13[] = {0x09, 0x05, 0x04, 0x09, 0xe0, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_14[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_15[] = {0x09, 0x04, 0x01, 0x05, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_16[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_17[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x03, 0x14, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_18[] = {0x09, 0x05, 0x04, 0x09, 0xa8, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_19[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_20[] = {0x09, 0x04, 0x01, 0x06, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_21[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_22[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x03, 0x14, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_23[] = {0x09, 0x05, 0x04, 0x09, 0x50, 0x01, 0x01, 0x00, -+ 0x00}; -+ -+static char za_24[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+ -+ -+static const struct usb_descriptor_header *z_function [] = { -+ (struct usb_descriptor_header *) &z_audio_control_if_desc, -+ (struct usb_descriptor_header *) &z_ac_interface_header_desc, -+ (struct usb_descriptor_header *) &z_0, -+ (struct usb_descriptor_header *) &z_1, -+ (struct usb_descriptor_header *) &z_2, -+ (struct usb_descriptor_header *) &z_audio_if_desc, -+ (struct usb_descriptor_header *) &z_audio_if_desc2, -+ (struct usb_descriptor_header *) &z_audio_cs_as_if_desc, -+ (struct usb_descriptor_header *) &z_audio_cs_as_format_desc, -+ (struct usb_descriptor_header *) &z_iso_ep, -+ (struct usb_descriptor_header *) &z_iso_ep2, -+ (struct usb_descriptor_header *) &za_0, -+ (struct usb_descriptor_header *) &za_1, -+ (struct usb_descriptor_header *) &za_2, -+ (struct usb_descriptor_header *) &za_3, -+ (struct usb_descriptor_header *) &za_4, -+ (struct usb_descriptor_header *) &za_5, -+ (struct usb_descriptor_header *) &za_6, -+ (struct usb_descriptor_header *) &za_7, -+ (struct usb_descriptor_header *) &za_8, -+ (struct usb_descriptor_header *) &za_9, -+ (struct usb_descriptor_header *) &za_10, -+ (struct usb_descriptor_header *) &za_11, -+ (struct usb_descriptor_header *) &za_12, -+ (struct usb_descriptor_header *) &za_13, -+ (struct usb_descriptor_header *) &za_14, -+ (struct usb_descriptor_header *) &za_15, -+ (struct usb_descriptor_header *) &za_16, -+ (struct usb_descriptor_header *) &za_17, -+ (struct usb_descriptor_header *) &za_18, -+ (struct usb_descriptor_header *) &za_19, -+ (struct usb_descriptor_header *) &za_20, -+ (struct usb_descriptor_header *) &za_21, -+ (struct usb_descriptor_header *) &za_22, -+ (struct usb_descriptor_header *) &za_23, -+ (struct usb_descriptor_header *) &za_24, -+ NULL, -+}; -+ -+/* maxpacket and other transfer characteristics vary by speed. */ -+#define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs)) -+ -+#else -+ -+/* if there's no high speed support, maxpacket doesn't change. */ -+#define ep_desc(g,hs,fs) fs -+ -+#endif /* !CONFIG_USB_GADGET_DUALSPEED */ -+ -+static char manufacturer [40]; -+//static char serial [40]; -+static char serial [] = "Ser 00 em"; -+ -+/* static strings, in UTF-8 */ -+static struct usb_string strings [] = { -+ { STRING_MANUFACTURER, manufacturer, }, -+ { STRING_PRODUCT, longname, }, -+ { STRING_SERIAL, serial, }, -+ { STRING_LOOPBACK, loopback, }, -+ { STRING_SOURCE_SINK, source_sink, }, -+ { } /* end of list */ -+}; -+ -+static struct usb_gadget_strings stringtab = { -+ .language = 0x0409, /* en-us */ -+ .strings = strings, -+}; -+ -+/* -+ * config descriptors are also handcrafted. these must agree with code -+ * that sets configurations, and with code managing interfaces and their -+ * altsettings. other complexity may come from: -+ * -+ * - high speed support, including "other speed config" rules -+ * - multiple configurations -+ * - interfaces with alternate settings -+ * - embedded class or vendor-specific descriptors -+ * -+ * this handles high speed, and has a second config that could as easily -+ * have been an alternate interface setting (on most hardware). -+ * -+ * NOTE: to demonstrate (and test) more USB capabilities, this driver -+ * should include an altsetting to test interrupt transfers, including -+ * high bandwidth modes at high speed. (Maybe work like Intel's test -+ * device?) -+ */ -+static int -+config_buf (struct usb_gadget *gadget, u8 *buf, u8 type, unsigned index) -+{ -+ int len; -+ const struct usb_descriptor_header **function; -+ -+ function = z_function; -+ len = usb_gadget_config_buf (&z_config, buf, USB_BUFSIZ, function); -+ if (len < 0) -+ return len; -+ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; -+ return len; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static struct usb_request * -+alloc_ep_req (struct usb_ep *ep, unsigned length) -+{ -+ struct usb_request *req; -+ -+ req = usb_ep_alloc_request (ep, GFP_ATOMIC); -+ if (req) { -+ req->length = length; -+ req->buf = usb_ep_alloc_buffer (ep, length, -+ &req->dma, GFP_ATOMIC); -+ if (!req->buf) { -+ usb_ep_free_request (ep, req); -+ req = NULL; -+ } -+ } -+ return req; -+} -+ -+static void free_ep_req (struct usb_ep *ep, struct usb_request *req) -+{ -+ if (req->buf) -+ usb_ep_free_buffer (ep, req->buf, req->dma, req->length); -+ usb_ep_free_request (ep, req); -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* optionally require specific source/sink data patterns */ -+ -+static int -+check_read_data ( -+ struct zero_dev *dev, -+ struct usb_ep *ep, -+ struct usb_request *req -+) -+{ -+ unsigned i; -+ u8 *buf = req->buf; -+ -+ for (i = 0; i < req->actual; i++, buf++) { -+ switch (pattern) { -+ /* all-zeroes has no synchronization issues */ -+ case 0: -+ if (*buf == 0) -+ continue; -+ break; -+ /* mod63 stays in sync with short-terminated transfers, -+ * or otherwise when host and gadget agree on how large -+ * each usb transfer request should be. resync is done -+ * with set_interface or set_config. -+ */ -+ case 1: -+ if (*buf == (u8)(i % 63)) -+ continue; -+ break; -+ } -+ ERROR (dev, "bad OUT byte, buf [%d] = %d\n", i, *buf); -+ usb_ep_set_halt (ep); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void zero_reset_config (struct zero_dev *dev) -+{ -+ if (dev->config == 0) -+ return; -+ -+ DBG (dev, "reset config\n"); -+ -+ /* just disable endpoints, forcing completion of pending i/o. -+ * all our completion handlers free their requests in this case. -+ */ -+ if (dev->in_ep) { -+ usb_ep_disable (dev->in_ep); -+ dev->in_ep = NULL; -+ } -+ if (dev->out_ep) { -+ usb_ep_disable (dev->out_ep); -+ dev->out_ep = NULL; -+ } -+ dev->config = 0; -+ del_timer (&dev->resume); -+} -+ -+#define _write(f, buf, sz) (f->f_op->write(f, buf, sz, &f->f_pos)) -+ -+static void -+zero_isoc_complete (struct usb_ep *ep, struct usb_request *req) -+{ -+ struct zero_dev *dev = ep->driver_data; -+ int status = req->status; -+ int i, j; -+ -+ switch (status) { -+ -+ case 0: /* normal completion? */ -+ //printk ("\nzero ---------------> isoc normal completion %d bytes\n", req->actual); -+ for (i=0, j=rbuf_start; iactual; i++) { -+ //printk ("%02x ", ((__u8*)req->buf)[i]); -+ rbuf[j] = ((__u8*)req->buf)[i]; -+ j++; -+ if (j >= RBUF_LEN) j=0; -+ } -+ rbuf_start = j; -+ //printk ("\n\n"); -+ -+ if (rbuf_len < RBUF_LEN) { -+ rbuf_len += req->actual; -+ if (rbuf_len > RBUF_LEN) { -+ rbuf_len = RBUF_LEN; -+ } -+ } -+ -+ break; -+ -+ /* this endpoint is normally active while we're configured */ -+ case -ECONNABORTED: /* hardware forced ep reset */ -+ case -ECONNRESET: /* request dequeued */ -+ case -ESHUTDOWN: /* disconnect from host */ -+ VDBG (dev, "%s gone (%d), %d/%d\n", ep->name, status, -+ req->actual, req->length); -+ if (ep == dev->out_ep) -+ check_read_data (dev, ep, req); -+ free_ep_req (ep, req); -+ return; -+ -+ case -EOVERFLOW: /* buffer overrun on read means that -+ * we didn't provide a big enough -+ * buffer. -+ */ -+ default: -+#if 1 -+ DBG (dev, "%s complete --> %d, %d/%d\n", ep->name, -+ status, req->actual, req->length); -+#endif -+ case -EREMOTEIO: /* short read */ -+ break; -+ } -+ -+ status = usb_ep_queue (ep, req, GFP_ATOMIC); -+ if (status) { -+ ERROR (dev, "kill %s: resubmit %d bytes --> %d\n", -+ ep->name, req->length, status); -+ usb_ep_set_halt (ep); -+ /* FIXME recover later ... somehow */ -+ } -+} -+ -+static struct usb_request * -+zero_start_isoc_ep (struct usb_ep *ep, int gfp_flags) -+{ -+ struct usb_request *req; -+ int status; -+ -+ req = alloc_ep_req (ep, 512); -+ if (!req) -+ return NULL; -+ -+ req->complete = zero_isoc_complete; -+ -+ status = usb_ep_queue (ep, req, gfp_flags); -+ if (status) { -+ struct zero_dev *dev = ep->driver_data; -+ -+ ERROR (dev, "start %s --> %d\n", ep->name, status); -+ free_ep_req (ep, req); -+ req = NULL; -+ } -+ -+ return req; -+} -+ -+/* change our operational config. this code must agree with the code -+ * that returns config descriptors, and altsetting code. -+ * -+ * it's also responsible for power management interactions. some -+ * configurations might not work with our current power sources. -+ * -+ * note that some device controller hardware will constrain what this -+ * code can do, perhaps by disallowing more than one configuration or -+ * by limiting configuration choices (like the pxa2xx). -+ */ -+static int -+zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) -+{ -+ int result = 0; -+ struct usb_gadget *gadget = dev->gadget; -+ const struct usb_endpoint_descriptor *d; -+ struct usb_ep *ep; -+ -+ if (number == dev->config) -+ return 0; -+ -+ zero_reset_config (dev); -+ -+ gadget_for_each_ep (ep, gadget) { -+ -+ if (strcmp (ep->name, "ep4") == 0) { -+ -+ d = (struct usb_endpoint_descripter *)&za_23; // isoc ep desc for audio i/f alt setting 6 -+ result = usb_ep_enable (ep, d); -+ -+ if (result == 0) { -+ ep->driver_data = dev; -+ dev->in_ep = ep; -+ -+ if (zero_start_isoc_ep (ep, gfp_flags) != 0) { -+ -+ dev->in_ep = ep; -+ continue; -+ } -+ -+ usb_ep_disable (ep); -+ result = -EIO; -+ } -+ } -+ -+ } -+ -+ dev->config = number; -+ return result; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void zero_setup_complete (struct usb_ep *ep, struct usb_request *req) -+{ -+ if (req->status || req->actual != req->length) -+ DBG ((struct zero_dev *) ep->driver_data, -+ "setup complete --> %d, %d/%d\n", -+ req->status, req->actual, req->length); -+} -+ -+/* -+ * The setup() callback implements all the ep0 functionality that's -+ * not handled lower down, in hardware or the hardware driver (like -+ * device and endpoint feature flags, and their status). It's all -+ * housekeeping for the gadget function we're implementing. Most of -+ * the work is in config-specific setup. -+ */ -+static int -+zero_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ struct usb_request *req = dev->req; -+ int value = -EOPNOTSUPP; -+ -+ /* usually this stores reply data in the pre-allocated ep0 buffer, -+ * but config change events will reconfigure hardware. -+ */ -+ req->zero = 0; -+ switch (ctrl->bRequest) { -+ -+ case USB_REQ_GET_DESCRIPTOR: -+ -+ switch (ctrl->wValue >> 8) { -+ -+ case USB_DT_DEVICE: -+ value = min (ctrl->wLength, (u16) sizeof device_desc); -+ memcpy (req->buf, &device_desc, value); -+ break; -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ case USB_DT_DEVICE_QUALIFIER: -+ if (!gadget->is_dualspeed) -+ break; -+ value = min (ctrl->wLength, (u16) sizeof dev_qualifier); -+ memcpy (req->buf, &dev_qualifier, value); -+ break; -+ -+ case USB_DT_OTHER_SPEED_CONFIG: -+ if (!gadget->is_dualspeed) -+ break; -+ // FALLTHROUGH -+#endif /* CONFIG_USB_GADGET_DUALSPEED */ -+ case USB_DT_CONFIG: -+ value = config_buf (gadget, req->buf, -+ ctrl->wValue >> 8, -+ ctrl->wValue & 0xff); -+ if (value >= 0) -+ value = min (ctrl->wLength, (u16) value); -+ break; -+ -+ case USB_DT_STRING: -+ /* wIndex == language code. -+ * this driver only handles one language, you can -+ * add string tables for other languages, using -+ * any UTF-8 characters -+ */ -+ value = usb_gadget_get_string (&stringtab, -+ ctrl->wValue & 0xff, req->buf); -+ if (value >= 0) { -+ value = min (ctrl->wLength, (u16) value); -+ } -+ break; -+ } -+ break; -+ -+ /* currently two configs, two speeds */ -+ case USB_REQ_SET_CONFIGURATION: -+ if (ctrl->bRequestType != 0) -+ goto unknown; -+ -+ spin_lock (&dev->lock); -+ value = zero_set_config (dev, ctrl->wValue, GFP_ATOMIC); -+ spin_unlock (&dev->lock); -+ break; -+ case USB_REQ_GET_CONFIGURATION: -+ if (ctrl->bRequestType != USB_DIR_IN) -+ goto unknown; -+ *(u8 *)req->buf = dev->config; -+ value = min (ctrl->wLength, (u16) 1); -+ break; -+ -+ /* until we add altsetting support, or other interfaces, -+ * only 0/0 are possible. pxa2xx only supports 0/0 (poorly) -+ * and already killed pending endpoint I/O. -+ */ -+ case USB_REQ_SET_INTERFACE: -+ -+ if (ctrl->bRequestType != USB_RECIP_INTERFACE) -+ goto unknown; -+ spin_lock (&dev->lock); -+ if (dev->config) { -+ u8 config = dev->config; -+ -+ /* resets interface configuration, forgets about -+ * previous transaction state (queued bufs, etc) -+ * and re-inits endpoint state (toggle etc) -+ * no response queued, just zero status == success. -+ * if we had more than one interface we couldn't -+ * use this "reset the config" shortcut. -+ */ -+ zero_reset_config (dev); -+ zero_set_config (dev, config, GFP_ATOMIC); -+ value = 0; -+ } -+ spin_unlock (&dev->lock); -+ break; -+ case USB_REQ_GET_INTERFACE: -+ if ((ctrl->bRequestType == 0x21) && (ctrl->wIndex == 0x02)) { -+ value = ctrl->wLength; -+ break; -+ } -+ else { -+ if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)) -+ goto unknown; -+ if (!dev->config) -+ break; -+ if (ctrl->wIndex != 0) { -+ value = -EDOM; -+ break; -+ } -+ *(u8 *)req->buf = 0; -+ value = min (ctrl->wLength, (u16) 1); -+ } -+ break; -+ -+ /* -+ * These are the same vendor-specific requests supported by -+ * Intel's USB 2.0 compliance test devices. We exceed that -+ * device spec by allowing multiple-packet requests. -+ */ -+ case 0x5b: /* control WRITE test -- fill the buffer */ -+ if (ctrl->bRequestType != (USB_DIR_OUT|USB_TYPE_VENDOR)) -+ goto unknown; -+ if (ctrl->wValue || ctrl->wIndex) -+ break; -+ /* just read that many bytes into the buffer */ -+ if (ctrl->wLength > USB_BUFSIZ) -+ break; -+ value = ctrl->wLength; -+ break; -+ case 0x5c: /* control READ test -- return the buffer */ -+ if (ctrl->bRequestType != (USB_DIR_IN|USB_TYPE_VENDOR)) -+ goto unknown; -+ if (ctrl->wValue || ctrl->wIndex) -+ break; -+ /* expect those bytes are still in the buffer; send back */ -+ if (ctrl->wLength > USB_BUFSIZ -+ || ctrl->wLength != req->length) -+ break; -+ value = ctrl->wLength; -+ break; -+ -+ case 0x01: // SET_CUR -+ case 0x02: -+ case 0x03: -+ case 0x04: -+ case 0x05: -+ value = ctrl->wLength; -+ break; -+ case 0x81: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0xe3; -+ break; -+ case 0x0300: -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x00; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x81; -+ //((u8*)req->buf)[1] = 0x81; -+ value = ctrl->wLength; -+ break; -+ case 0x82: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0xc3; -+ break; -+ case 0x0300: -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x00; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x82; -+ //((u8*)req->buf)[1] = 0x82; -+ value = ctrl->wLength; -+ break; -+ case 0x83: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0x00; -+ break; -+ case 0x0300: -+ ((u8*)req->buf)[0] = 0x60; -+ break; -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x18; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x83; -+ //((u8*)req->buf)[1] = 0x83; -+ value = ctrl->wLength; -+ break; -+ case 0x84: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0x01; -+ break; -+ case 0x0300: -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x08; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x84; -+ //((u8*)req->buf)[1] = 0x84; -+ value = ctrl->wLength; -+ break; -+ case 0x85: -+ ((u8*)req->buf)[0] = 0x85; -+ ((u8*)req->buf)[1] = 0x85; -+ value = ctrl->wLength; -+ break; -+ -+ -+ default: -+unknown: -+ printk("unknown control req%02x.%02x v%04x i%04x l%d\n", -+ ctrl->bRequestType, ctrl->bRequest, -+ ctrl->wValue, ctrl->wIndex, ctrl->wLength); -+ } -+ -+ /* respond with data transfer before status phase? */ -+ if (value >= 0) { -+ req->length = value; -+ req->zero = value < ctrl->wLength -+ && (value % gadget->ep0->maxpacket) == 0; -+ value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); -+ if (value < 0) { -+ DBG (dev, "ep_queue < 0 --> %d\n", value); -+ req->status = 0; -+ zero_setup_complete (gadget->ep0, req); -+ } -+ } -+ -+ /* device either stalls (value < 0) or reports success */ -+ return value; -+} -+ -+static void -+zero_disconnect (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ unsigned long flags; -+ -+ spin_lock_irqsave (&dev->lock, flags); -+ zero_reset_config (dev); -+ -+ /* a more significant application might have some non-usb -+ * activities to quiesce here, saving resources like power -+ * or pushing the notification up a network stack. -+ */ -+ spin_unlock_irqrestore (&dev->lock, flags); -+ -+ /* next we may get setup() calls to enumerate new connections; -+ * or an unbind() during shutdown (including removing module). -+ */ -+} -+ -+static void -+zero_autoresume (unsigned long _dev) -+{ -+ struct zero_dev *dev = (struct zero_dev *) _dev; -+ int status; -+ -+ /* normally the host would be woken up for something -+ * more significant than just a timer firing... -+ */ -+ if (dev->gadget->speed != USB_SPEED_UNKNOWN) { -+ status = usb_gadget_wakeup (dev->gadget); -+ DBG (dev, "wakeup --> %d\n", status); -+ } -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void -+zero_unbind (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ -+ DBG (dev, "unbind\n"); -+ -+ /* we've already been disconnected ... no i/o is active */ -+ if (dev->req) -+ free_ep_req (gadget->ep0, dev->req); -+ del_timer_sync (&dev->resume); -+ kfree (dev); -+ set_gadget_data (gadget, NULL); -+} -+ -+static int -+zero_bind (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev; -+ //struct usb_ep *ep; -+ -+ printk("binding\n"); -+ /* -+ * DRIVER POLICY CHOICE: you may want to do this differently. -+ * One thing to avoid is reusing a bcdDevice revision code -+ * with different host-visible configurations or behavior -+ * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc -+ */ -+ //device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201); -+ -+ -+ /* ok, we made sense of the hardware ... */ -+ dev = kzalloc (sizeof *dev, SLAB_KERNEL); -+ if (!dev) -+ return -ENOMEM; -+ spin_lock_init (&dev->lock); -+ dev->gadget = gadget; -+ set_gadget_data (gadget, dev); -+ -+ /* preallocate control response and buffer */ -+ dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL); -+ if (!dev->req) -+ goto enomem; -+ dev->req->buf = usb_ep_alloc_buffer (gadget->ep0, USB_BUFSIZ, -+ &dev->req->dma, GFP_KERNEL); -+ if (!dev->req->buf) -+ goto enomem; -+ -+ dev->req->complete = zero_setup_complete; -+ -+ device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; -+ -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ /* assume ep0 uses the same value for both speeds ... */ -+ dev_qualifier.bMaxPacketSize0 = device_desc.bMaxPacketSize0; -+ -+ /* and that all endpoints are dual-speed */ -+ //hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress; -+ //hs_sink_desc.bEndpointAddress = fs_sink_desc.bEndpointAddress; -+#endif -+ -+ usb_gadget_set_selfpowered (gadget); -+ -+ init_timer (&dev->resume); -+ dev->resume.function = zero_autoresume; -+ dev->resume.data = (unsigned long) dev; -+ -+ gadget->ep0->driver_data = dev; -+ -+ INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname); -+ INFO (dev, "using %s, OUT %s IN %s\n", gadget->name, -+ EP_OUT_NAME, EP_IN_NAME); -+ -+ snprintf (manufacturer, sizeof manufacturer, -+ UTS_SYSNAME " " UTS_RELEASE " with %s", -+ gadget->name); -+ -+ return 0; -+ -+enomem: -+ zero_unbind (gadget); -+ return -ENOMEM; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void -+zero_suspend (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ -+ if (gadget->speed == USB_SPEED_UNKNOWN) -+ return; -+ -+ if (autoresume) { -+ mod_timer (&dev->resume, jiffies + (HZ * autoresume)); -+ DBG (dev, "suspend, wakeup in %d seconds\n", autoresume); -+ } else -+ DBG (dev, "suspend\n"); -+} -+ -+static void -+zero_resume (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ -+ DBG (dev, "resume\n"); -+ del_timer (&dev->resume); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static struct usb_gadget_driver zero_driver = { -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ .speed = USB_SPEED_HIGH, -+#else -+ .speed = USB_SPEED_FULL, -+#endif -+ .function = (char *) longname, -+ .bind = zero_bind, -+ .unbind = zero_unbind, -+ -+ .setup = zero_setup, -+ .disconnect = zero_disconnect, -+ -+ .suspend = zero_suspend, -+ .resume = zero_resume, -+ -+ .driver = { -+ .name = (char *) shortname, -+ // .shutdown = ... -+ // .suspend = ... -+ // .resume = ... -+ }, -+}; -+ -+MODULE_AUTHOR ("David Brownell"); -+MODULE_LICENSE ("Dual BSD/GPL"); -+ -+static struct proc_dir_entry *pdir, *pfile; -+ -+static int isoc_read_data (char *page, char **start, -+ off_t off, int count, -+ int *eof, void *data) -+{ -+ int i; -+ static int c = 0; -+ static int done = 0; -+ static int s = 0; -+ -+/* -+ printk ("\ncount: %d\n", count); -+ printk ("rbuf_start: %d\n", rbuf_start); -+ printk ("rbuf_len: %d\n", rbuf_len); -+ printk ("off: %d\n", off); -+ printk ("start: %p\n\n", *start); -+*/ -+ if (done) { -+ c = 0; -+ done = 0; -+ *eof = 1; -+ return 0; -+ } -+ -+ if (c == 0) { -+ if (rbuf_len == RBUF_LEN) -+ s = rbuf_start; -+ else s = 0; -+ } -+ -+ for (i=0; i= rbuf_len) { -+ *eof = 1; -+ done = 1; -+ } -+ -+ -+ return i; -+} -+ -+static int __init init (void) -+{ -+ -+ int retval = 0; -+ -+ pdir = proc_mkdir("isoc_test", NULL); -+ if(pdir == NULL) { -+ retval = -ENOMEM; -+ printk("Error creating dir\n"); -+ goto done; -+ } -+ pdir->owner = THIS_MODULE; -+ -+ pfile = create_proc_read_entry("isoc_data", -+ 0444, pdir, -+ isoc_read_data, -+ NULL); -+ if (pfile == NULL) { -+ retval = -ENOMEM; -+ printk("Error creating file\n"); -+ goto no_file; -+ } -+ pfile->owner = THIS_MODULE; -+ -+ return usb_gadget_register_driver (&zero_driver); -+ -+ no_file: -+ remove_proc_entry("isoc_data", NULL); -+ done: -+ return retval; -+} -+module_init (init); -+ -+static void __exit cleanup (void) -+{ -+ -+ usb_gadget_unregister_driver (&zero_driver); -+ -+ remove_proc_entry("isoc_data", pdir); -+ remove_proc_entry("isoc_test", NULL); -+} -+module_exit (cleanup); -diff --git a/drivers/usb/host/dwc_otg/dwc_cfi_common.h b/drivers/usb/host/dwc_otg/dwc_cfi_common.h -new file mode 100644 -index 0000000000000000000000000000000000000000..7770e201ad3bd877f1bb613284091301d084ade9 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_cfi_common.h -@@ -0,0 +1,142 @@ -+/* ========================================================================== -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_CFI_COMMON_H__) -+#define __DWC_CFI_COMMON_H__ -+ -+//#include -+ -+/** -+ * @file -+ * -+ * This file contains the CFI specific common constants, interfaces -+ * (functions and macros) and structures for Linux. No PCD specific -+ * data structure or definition is to be included in this file. -+ * -+ */ -+ -+/** This is a request for all Core Features */ -+#define VEN_CORE_GET_FEATURES 0xB1 -+ -+/** This is a request to get the value of a specific Core Feature */ -+#define VEN_CORE_GET_FEATURE 0xB2 -+ -+/** This command allows the host to set the value of a specific Core Feature */ -+#define VEN_CORE_SET_FEATURE 0xB3 -+ -+/** This command allows the host to set the default values of -+ * either all or any specific Core Feature -+ */ -+#define VEN_CORE_RESET_FEATURES 0xB4 -+ -+/** This command forces the PCD to write the deferred values of a Core Features */ -+#define VEN_CORE_ACTIVATE_FEATURES 0xB5 -+ -+/** This request reads a DWORD value from a register at the specified offset */ -+#define VEN_CORE_READ_REGISTER 0xB6 -+ -+/** This request writes a DWORD value into a register at the specified offset */ -+#define VEN_CORE_WRITE_REGISTER 0xB7 -+ -+/** This structure is the header of the Core Features dataset returned to -+ * the Host -+ */ -+struct cfi_all_features_header { -+/** The features header structure length is */ -+#define CFI_ALL_FEATURES_HDR_LEN 8 -+ /** -+ * The total length of the features dataset returned to the Host -+ */ -+ uint16_t wTotalLen; -+ -+ /** -+ * CFI version number inBinary-Coded Decimal (i.e., 1.00 is 100H). -+ * This field identifies the version of the CFI Specification with which -+ * the device is compliant. -+ */ -+ uint16_t wVersion; -+ -+ /** The ID of the Core */ -+ uint16_t wCoreID; -+#define CFI_CORE_ID_UDC 1 -+#define CFI_CORE_ID_OTG 2 -+#define CFI_CORE_ID_WUDEV 3 -+ -+ /** Number of features returned by VEN_CORE_GET_FEATURES request */ -+ uint16_t wNumFeatures; -+} UPACKED; -+ -+typedef struct cfi_all_features_header cfi_all_features_header_t; -+ -+/** This structure is a header of the Core Feature descriptor dataset returned to -+ * the Host after the VEN_CORE_GET_FEATURES request -+ */ -+struct cfi_feature_desc_header { -+#define CFI_FEATURE_DESC_HDR_LEN 8 -+ -+ /** The feature ID */ -+ uint16_t wFeatureID; -+ -+ /** Length of this feature descriptor in bytes - including the -+ * length of the feature name string -+ */ -+ uint16_t wLength; -+ -+ /** The data length of this feature in bytes */ -+ uint16_t wDataLength; -+ -+ /** -+ * Attributes of this features -+ * D0: Access rights -+ * 0 - Read/Write -+ * 1 - Read only -+ */ -+ uint8_t bmAttributes; -+#define CFI_FEATURE_ATTR_RO 1 -+#define CFI_FEATURE_ATTR_RW 0 -+ -+ /** Length of the feature name in bytes */ -+ uint8_t bNameLen; -+ -+ /** The feature name buffer */ -+ //uint8_t *name; -+} UPACKED; -+ -+typedef struct cfi_feature_desc_header cfi_feature_desc_header_t; -+ -+/** -+ * This structure describes a NULL terminated string referenced by its id field. -+ * It is very similar to usb_string structure but has the id field type set to 16-bit. -+ */ -+struct cfi_string { -+ uint16_t id; -+ const uint8_t *s; -+}; -+typedef struct cfi_string cfi_string_t; -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.c b/drivers/usb/host/dwc_otg/dwc_otg_adp.c -new file mode 100644 -index 0000000000000000000000000000000000000000..ce0618dd3f4a6b2b2e7e65ba75f1214faca7c6f0 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.c -@@ -0,0 +1,854 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.c $ -+ * $Revision: #12 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#include "dwc_os.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_adp.h" -+ -+/** @file -+ * -+ * This file contains the most of the Attach Detect Protocol implementation for -+ * the driver to support OTG Rev2.0. -+ * -+ */ -+ -+void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value) -+{ -+ adpctl_data_t adpctl; -+ -+ adpctl.d32 = value; -+ adpctl.b.ar = 0x2; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); -+ -+ while (adpctl.b.ar) { -+ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); -+ } -+ -+} -+ -+/** -+ * Function is called to read ADP registers -+ */ -+uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ adpctl.d32 = 0; -+ adpctl.b.ar = 0x1; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); -+ -+ while (adpctl.b.ar) { -+ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); -+ } -+ -+ return adpctl.d32; -+} -+ -+/** -+ * Function is called to read ADPCTL register and filter Write-clear bits -+ */ -+uint32_t dwc_otg_adp_read_reg_filter(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_tmout_int = 0; -+ adpctl.b.adp_prb_int = 0; -+ adpctl.b.adp_tmout_int = 0; -+ -+ return adpctl.d32; -+} -+ -+/** -+ * Function is called to write ADP registers -+ */ -+void dwc_otg_adp_modify_reg(dwc_otg_core_if_t * core_if, uint32_t clr, -+ uint32_t set) -+{ -+ dwc_otg_adp_write_reg(core_if, -+ (dwc_otg_adp_read_reg(core_if) & (~clr)) | set); -+} -+ -+static void adp_sense_timeout(void *ptr) -+{ -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ core_if->adp.sense_timer_started = 0; -+ DWC_PRINTF("ADP SENSE TIMEOUT\n"); -+ if (core_if->adp_enable) { -+ dwc_otg_adp_sense_stop(core_if); -+ dwc_otg_adp_probe_start(core_if); -+ } -+} -+ -+/** -+ * This function is called when the ADP vbus timer expires. Timeout is 1.1s. -+ */ -+static void adp_vbuson_timeout(void *ptr) -+{ -+ gpwrdn_data_t gpwrdn; -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ DWC_PRINTF("%s: 1.1 seconds expire after turning on VBUS\n",__FUNCTION__); -+ if (core_if) { -+ core_if->adp.vbuson_timer_started = 0; -+ /* Turn off vbus */ -+ hprt0.b.prtpwr = 1; -+ DWC_MODIFY_REG32(core_if->host_if->hprt0, hprt0.d32, 0); -+ gpwrdn.d32 = 0; -+ -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ /* Enable Wakeup Logic */ -+// gpwrdn.b.wkupactiv = 1; -+ gpwrdn.b.pmuactv = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ -+ /* Suspend the Phy Clock */ -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ /* Switch on VDD */ -+// gpwrdn.b.wkupactiv = 1; -+ gpwrdn.b.pmuactv = 1; -+ gpwrdn.b.pwrdnrstn = 1; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ } else { -+ /* Enable Power Down Logic */ -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ } -+ -+ /* Unmask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ -+ dwc_otg_adp_probe_start(core_if); -+ dwc_otg_dump_global_registers(core_if); -+ dwc_otg_dump_host_registers(core_if); -+ } -+ -+} -+ -+/** -+ * Start the ADP Initial Probe timer to detect if Port Connected interrupt is -+ * not asserted within 1.1 seconds. -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+void dwc_otg_adp_vbuson_timer_start(dwc_otg_core_if_t * core_if) -+{ -+ core_if->adp.vbuson_timer_started = 1; -+ if (core_if->adp.vbuson_timer) -+ { -+ DWC_PRINTF("SCHEDULING VBUSON TIMER\n"); -+ /* 1.1 secs + 60ms necessary for cil_hcd_start*/ -+ DWC_TIMER_SCHEDULE(core_if->adp.vbuson_timer, 1160); -+ } else { -+ DWC_WARN("VBUSON_TIMER = %p\n",core_if->adp.vbuson_timer); -+ } -+} -+ -+#if 0 -+/** -+ * Masks all DWC OTG core interrupts -+ * -+ */ -+static void mask_all_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ -+ /* Mask Host Interrupts */ -+ -+ /* Clear and disable HCINTs */ -+ for (i = 0; i < core_if->core_params->host_channels; i++) { -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, 0); -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcint, 0xFFFFFFFF); -+ -+ } -+ -+ /* Clear and disable HAINT */ -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, 0x0000); -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haint, 0xFFFFFFFF); -+ -+ /* Mask Device Interrupts */ -+ if (!core_if->multiproc_int_enable) { -+ /* Clear and disable IN Endpoint interrupts */ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, 0); -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> -+ diepint, 0xFFFFFFFF); -+ } -+ -+ /* Clear and disable OUT Endpoint interrupts */ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, 0); -+ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> -+ doepint, 0xFFFFFFFF); -+ } -+ -+ /* Clear and disable DAINT */ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daint, -+ 0xFFFFFFFF); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, 0); -+ } else { -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ diepeachintmsk[i], 0); -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> -+ diepint, 0xFFFFFFFF); -+ } -+ -+ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[i], 0); -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> -+ doepint, 0xFFFFFFFF); -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, -+ 0); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachint, -+ 0xFFFFFFFF); -+ -+ } -+ -+ /* Disable interrupts */ -+ ahbcfg.b.glblintrmsk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); -+ -+ /* Disable all interrupts. */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); -+ -+ /* Clear any pending interrupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Clear any pending OTG Interrupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, 0xFFFFFFFF); -+} -+ -+/** -+ * Unmask Port Connection Detected interrupt -+ * -+ */ -+static void unmask_conn_det_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintmsk_data_t gintmsk = {.d32 = 0,.b.portintr = 1 }; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); -+} -+#endif -+ -+/** -+ * Starts the ADP Probing -+ * -+ * @param core_if the pointer to core_if structure. -+ */ -+uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if) -+{ -+ -+ adpctl_data_t adpctl = {.d32 = 0}; -+ gpwrdn_data_t gpwrdn; -+#if 0 -+ adpctl_data_t adpctl_int = {.d32 = 0, .b.adp_prb_int = 1, -+ .b.adp_sns_int = 1, b.adp_tmout_int}; -+#endif -+ dwc_otg_disable_global_interrupts(core_if); -+ DWC_PRINTF("ADP Probe Start\n"); -+ core_if->adp.probe_enabled = 1; -+ -+ adpctl.b.adpres = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ while (adpctl.b.adpres) { -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ } -+ -+ adpctl.d32 = 0; -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ /* In Host mode unmask SRP detected interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.sts_chngint_msk = 1; -+ if (!gpwrdn.b.idsts) { -+ gpwrdn.b.srp_det_msk = 1; -+ } -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ -+ adpctl.b.adp_tmout_int_msk = 1; -+ adpctl.b.adp_prb_int_msk = 1; -+ adpctl.b.prb_dschg = 1; -+ adpctl.b.prb_delta = 1; -+ adpctl.b.prb_per = 1; -+ adpctl.b.adpen = 1; -+ adpctl.b.enaprb = 1; -+ -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ DWC_PRINTF("ADP Probe Finish\n"); -+ return 0; -+} -+ -+/** -+ * Starts the ADP Sense timer to detect if ADP Sense interrupt is not asserted -+ * within 3 seconds. -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+void dwc_otg_adp_sense_timer_start(dwc_otg_core_if_t * core_if) -+{ -+ core_if->adp.sense_timer_started = 1; -+ DWC_TIMER_SCHEDULE(core_if->adp.sense_timer, 3000 /* 3 secs */ ); -+} -+ -+/** -+ * Starts the ADP Sense -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ DWC_PRINTF("ADP Sense Start\n"); -+ -+ /* Unmask ADP sense interrupt and mask all other from the core */ -+ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); -+ adpctl.b.adp_sns_int_msk = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ dwc_otg_disable_global_interrupts(core_if); // vahrama -+ -+ /* Set ADP reset bit*/ -+ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); -+ adpctl.b.adpres = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ while (adpctl.b.adpres) { -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ } -+ -+ adpctl.b.adpres = 0; -+ adpctl.b.adpen = 1; -+ adpctl.b.enasns = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ dwc_otg_adp_sense_timer_start(core_if); -+ -+ return 0; -+} -+ -+/** -+ * Stops the ADP Probing -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if) -+{ -+ -+ adpctl_data_t adpctl; -+ DWC_PRINTF("Stop ADP probe\n"); -+ core_if->adp.probe_enabled = 0; -+ core_if->adp.probe_counter = 0; -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ -+ adpctl.b.adpen = 0; -+ adpctl.b.adp_prb_int = 1; -+ adpctl.b.adp_tmout_int = 1; -+ adpctl.b.adp_sns_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * Stops the ADP Sensing -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ core_if->adp.sense_enabled = 0; -+ -+ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); -+ adpctl.b.enasns = 0; -+ adpctl.b.adp_sns_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * Called to turn on the VBUS after initial ADP probe in host mode. -+ * If port power was already enabled in cil_hcd_start function then -+ * only schedule a timer. -+ * -+ * @param core_if the pointer to core_if structure. -+ */ -+void dwc_otg_adp_turnon_vbus(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ DWC_PRINTF("Turn on VBUS for 1.1s, port power is %d\n", hprt0.b.prtpwr); -+ -+ if (hprt0.b.prtpwr == 0) { -+ hprt0.b.prtpwr = 1; -+ //DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ -+ dwc_otg_adp_vbuson_timer_start(core_if); -+} -+ -+/** -+ * Called right after driver is loaded -+ * to perform initial actions for ADP -+ * -+ * @param core_if the pointer to core_if structure. -+ * @param is_host - flag for current mode of operation either from GINTSTS or GPWRDN -+ */ -+void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host) -+{ -+ gpwrdn_data_t gpwrdn; -+ -+ DWC_PRINTF("ADP Initial Start\n"); -+ core_if->adp.adp_started = 1; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ dwc_otg_disable_global_interrupts(core_if); -+ if (is_host) { -+ DWC_PRINTF("HOST MODE\n"); -+ /* Enable Power Down Logic Interrupt*/ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ /* Initialize first ADP probe to obtain Ramp Time value */ -+ core_if->adp.initial_probe = 1; -+ dwc_otg_adp_probe_start(core_if); -+ } else { -+ gotgctl_data_t gotgctl; -+ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ DWC_PRINTF("DEVICE MODE\n"); -+ if (gotgctl.b.bsesvld == 0) { -+ /* Enable Power Down Logic Interrupt*/ -+ gpwrdn.d32 = 0; -+ DWC_PRINTF("VBUS is not valid - start ADP probe\n"); -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ core_if->adp.initial_probe = 1; -+ dwc_otg_adp_probe_start(core_if); -+ } else { -+ DWC_PRINTF("VBUS is valid - initialize core as a Device\n"); -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ dwc_otg_dump_global_registers(core_if); -+ dwc_otg_dump_dev_registers(core_if); -+ } -+ } -+} -+ -+void dwc_otg_adp_init(dwc_otg_core_if_t * core_if) -+{ -+ core_if->adp.adp_started = 0; -+ core_if->adp.initial_probe = 0; -+ core_if->adp.probe_timer_values[0] = -1; -+ core_if->adp.probe_timer_values[1] = -1; -+ core_if->adp.probe_enabled = 0; -+ core_if->adp.sense_enabled = 0; -+ core_if->adp.sense_timer_started = 0; -+ core_if->adp.vbuson_timer_started = 0; -+ core_if->adp.probe_counter = 0; -+ core_if->adp.gpwrdn = 0; -+ core_if->adp.attached = DWC_OTG_ADP_UNKOWN; -+ /* Initialize timers */ -+ core_if->adp.sense_timer = -+ DWC_TIMER_ALLOC("ADP SENSE TIMER", adp_sense_timeout, core_if); -+ core_if->adp.vbuson_timer = -+ DWC_TIMER_ALLOC("ADP VBUS ON TIMER", adp_vbuson_timeout, core_if); -+ if (!core_if->adp.sense_timer || !core_if->adp.vbuson_timer) -+ { -+ DWC_ERROR("Could not allocate memory for ADP timers\n"); -+ } -+} -+ -+void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = { .d32 = 0 }; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ if (core_if->adp.probe_enabled) -+ dwc_otg_adp_probe_stop(core_if); -+ if (core_if->adp.sense_enabled) -+ dwc_otg_adp_sense_stop(core_if); -+ if (core_if->adp.sense_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.sense_timer); -+ if (core_if->adp.vbuson_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); -+ DWC_TIMER_FREE(core_if->adp.sense_timer); -+ DWC_TIMER_FREE(core_if->adp.vbuson_timer); -+} -+ -+///////////////////////////////////////////////////////////////////// -+////////////// ADP Interrupt Handlers /////////////////////////////// -+///////////////////////////////////////////////////////////////////// -+/** -+ * This function sets Ramp Timer values -+ */ -+static uint32_t set_timer_value(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ if (core_if->adp.probe_timer_values[0] == -1) { -+ core_if->adp.probe_timer_values[0] = val; -+ core_if->adp.probe_timer_values[1] = -1; -+ return 1; -+ } else { -+ core_if->adp.probe_timer_values[1] = -+ core_if->adp.probe_timer_values[0]; -+ core_if->adp.probe_timer_values[0] = val; -+ return 0; -+ } -+} -+ -+/** -+ * This function compares Ramp Timer values -+ */ -+static uint32_t compare_timer_values(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t diff; -+ if (core_if->adp.probe_timer_values[0]>=core_if->adp.probe_timer_values[1]) -+ diff = core_if->adp.probe_timer_values[0]-core_if->adp.probe_timer_values[1]; -+ else -+ diff = core_if->adp.probe_timer_values[1]-core_if->adp.probe_timer_values[0]; -+ if(diff < 2) { -+ return 0; -+ } else { -+ return 1; -+ } -+} -+ -+/** -+ * This function handles ADP Probe Interrupts -+ */ -+static int32_t dwc_otg_adp_handle_prb_intr(dwc_otg_core_if_t * core_if, -+ uint32_t val) -+{ -+ adpctl_data_t adpctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn, temp; -+ adpctl.d32 = val; -+ -+ temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ core_if->adp.probe_counter++; -+ core_if->adp.gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (adpctl.b.rtim == 0 && !temp.b.idsts){ -+ DWC_PRINTF("RTIM value is 0\n"); -+ goto exit; -+ } -+ if (set_timer_value(core_if, adpctl.b.rtim) && -+ core_if->adp.initial_probe) { -+ core_if->adp.initial_probe = 0; -+ dwc_otg_adp_probe_stop(core_if); -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* check which value is for device mode and which for Host mode */ -+ if (!temp.b.idsts) { /* considered host mode value is 0 */ -+ /* -+ * Turn on VBUS after initial ADP probe. -+ */ -+ core_if->op_state = A_HOST; -+ dwc_otg_enable_global_interrupts(core_if); -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_start(core_if); -+ dwc_otg_adp_turnon_vbus(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ } else { -+ /* -+ * Initiate SRP after initial ADP probe. -+ */ -+ dwc_otg_enable_global_interrupts(core_if); -+ dwc_otg_initiate_srp(core_if); -+ } -+ } else if (core_if->adp.probe_counter > 2){ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (compare_timer_values(core_if)) { -+ DWC_PRINTF("Difference in timer values !!! \n"); -+// core_if->adp.attached = DWC_OTG_ADP_ATTACHED; -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Power on the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ /* check which value is for device mode and which for Host mode */ -+ if (!temp.b.idsts) { /* considered host mode value is 0 */ -+ /* Disable Interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Host mode. -+ */ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } else { -+ gotgctl_data_t gotgctl; -+ /* Mask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ -+ /* Disable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Device mode. -+ */ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ -+ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ if (!gotgctl.b.bsesvld) { -+ dwc_otg_initiate_srp(core_if); -+ } -+ } -+ } -+ if (core_if->power_down == 2) { -+ if (gpwrdn.b.bsessvld) { -+ /* Mask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Disable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Device mode. -+ */ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } -+ } -+ } -+exit: -+ /* Clear interrupt */ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_prb_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * This function hadles ADP Sense Interrupt -+ */ -+static int32_t dwc_otg_adp_handle_sns_intr(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ /* Stop ADP Sense timer */ -+ DWC_TIMER_CANCEL(core_if->adp.sense_timer); -+ -+ /* Restart ADP Sense timer */ -+ dwc_otg_adp_sense_timer_start(core_if); -+ -+ /* Clear interrupt */ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_sns_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * This function handles ADP Probe Interrupts -+ */ -+static int32_t dwc_otg_adp_handle_prb_tmout_intr(dwc_otg_core_if_t * core_if, -+ uint32_t val) -+{ -+ adpctl_data_t adpctl = {.d32 = 0 }; -+ adpctl.d32 = val; -+ set_timer_value(core_if, adpctl.b.rtim); -+ -+ /* Clear interrupt */ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_tmout_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * ADP Interrupt handler. -+ * -+ */ -+int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if) -+{ -+ int retval = 0; -+ adpctl_data_t adpctl = {.d32 = 0}; -+ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ DWC_PRINTF("ADPCTL = %08x\n",adpctl.d32); -+ -+ if (adpctl.b.adp_sns_int & adpctl.b.adp_sns_int_msk) { -+ DWC_PRINTF("ADP Sense interrupt\n"); -+ retval |= dwc_otg_adp_handle_sns_intr(core_if); -+ } -+ if (adpctl.b.adp_tmout_int & adpctl.b.adp_tmout_int_msk) { -+ DWC_PRINTF("ADP timeout interrupt\n"); -+ retval |= dwc_otg_adp_handle_prb_tmout_intr(core_if, adpctl.d32); -+ } -+ if (adpctl.b.adp_prb_int & adpctl.b.adp_prb_int_msk) { -+ DWC_PRINTF("ADP Probe interrupt\n"); -+ adpctl.b.adp_prb_int = 1; -+ retval |= dwc_otg_adp_handle_prb_intr(core_if, adpctl.d32); -+ } -+ -+// dwc_otg_adp_modify_reg(core_if, adpctl.d32, 0); -+ //dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ DWC_PRINTF("RETURN FROM ADP ISR\n"); -+ -+ return retval; -+} -+ -+/** -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if) -+{ -+ -+#ifndef DWC_HOST_ONLY -+ hprt0_data_t hprt0; -+ gpwrdn_data_t gpwrdn; -+ DWC_DEBUGPL(DBG_ANY, "++ Power Down Logic Session Request Interrupt++\n"); -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ /* check which value is for device mode and which for Host mode */ -+ if (!gpwrdn.b.idsts) { /* considered host mode value is 0 */ -+ DWC_PRINTF("SRP: Host mode\n"); -+ -+ if (core_if->adp_enable) { -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Power on the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+ -+ /* Turn on the port power bit. */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Start the Connection timer. So a message can be displayed -+ * if connect does not occur within 10 seconds. */ -+ cil_hcd_session_start(core_if); -+ } else { -+ DWC_PRINTF("SRP: Device mode %s\n", __FUNCTION__); -+ if (core_if->adp_enable) { -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Power on the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 0; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } -+ } -+#endif -+ return 1; -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.h b/drivers/usb/host/dwc_otg/dwc_otg_adp.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4110b25d2002ed64a760cf41bbf81c903b5bc572 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.h -@@ -0,0 +1,80 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.h $ -+ * $Revision: #7 $ -+ * $Date: 2011/10/24 $ -+ * $Change: 1871159 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_ADP_H__ -+#define __DWC_OTG_ADP_H__ -+ -+/** -+ * @file -+ * -+ * This file contains the Attach Detect Protocol interfaces and defines -+ * (functions) and structures for Linux. -+ * -+ */ -+ -+#define DWC_OTG_ADP_UNATTACHED 0 -+#define DWC_OTG_ADP_ATTACHED 1 -+#define DWC_OTG_ADP_UNKOWN 2 -+ -+typedef struct dwc_otg_adp { -+ uint32_t adp_started; -+ uint32_t initial_probe; -+ int32_t probe_timer_values[2]; -+ uint32_t probe_enabled; -+ uint32_t sense_enabled; -+ dwc_timer_t *sense_timer; -+ uint32_t sense_timer_started; -+ dwc_timer_t *vbuson_timer; -+ uint32_t vbuson_timer_started; -+ uint32_t attached; -+ uint32_t probe_counter; -+ uint32_t gpwrdn; -+} dwc_otg_adp_t; -+ -+/** -+ * Attach Detect Protocol functions -+ */ -+ -+extern void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value); -+extern uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); -+extern void dwc_otg_adp_init(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if); -+extern int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if); -+extern int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if); -+ -+#endif //__DWC_OTG_ADP_H__ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.c b/drivers/usb/host/dwc_otg/dwc_otg_attr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9da0c92aaeca2fc393016442cc6578cb4a52c978 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.c -@@ -0,0 +1,1210 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ -+ * $Revision: #44 $ -+ * $Date: 2010/11/29 $ -+ * $Change: 1636033 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * The diagnostic interface will provide access to the controller for -+ * bringing up the hardware and testing. The Linux driver attributes -+ * feature will be used to provide the Linux Diagnostic -+ * Interface. These attributes are accessed through sysfs. -+ */ -+ -+/** @page "Linux Module Attributes" -+ * -+ * The Linux module attributes feature is used to provide the Linux -+ * Diagnostic Interface. These attributes are accessed through sysfs. -+ * The diagnostic interface will provide access to the controller for -+ * bringing up the hardware and testing. -+ -+ The following table shows the attributes. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
Name Description Access
mode Returns the current mode: 0 for device mode, 1 for host mode Read
hnpcapable Gets or sets the "HNP-capable" bit in the Core USB Configuraton Register. -+ Read returns the current value. Read/Write
srpcapable Gets or sets the "SRP-capable" bit in the Core USB Configuraton Register. -+ Read returns the current value. Read/Write
hsic_connect Gets or sets the "HSIC-Connect" bit in the GLPMCFG Register. -+ Read returns the current value. Read/Write
inv_sel_hsic Gets or sets the "Invert Select HSIC" bit in the GLPMFG Register. -+ Read returns the current value. Read/Write
hnp Initiates the Host Negotiation Protocol. Read returns the status. Read/Write
srp Initiates the Session Request Protocol. Read returns the status. Read/Write
buspower Gets or sets the Power State of the bus (0 - Off or 1 - On) Read/Write
bussuspend Suspends the USB bus. Read/Write
busconnected Gets the connection status of the bus Read
gotgctl Gets or sets the Core Control Status Register. Read/Write
gusbcfg Gets or sets the Core USB Configuration Register Read/Write
grxfsiz Gets or sets the Receive FIFO Size Register Read/Write
gnptxfsiz Gets or sets the non-periodic Transmit Size Register Read/Write
gpvndctl Gets or sets the PHY Vendor Control Register Read/Write
ggpio Gets the value in the lower 16-bits of the General Purpose IO Register -+ or sets the upper 16 bits. Read/Write
guid Gets or sets the value of the User ID Register Read/Write
gsnpsid Gets the value of the Synopsys ID Regester Read
devspeed Gets or sets the device speed setting in the DCFG register Read/Write
enumspeed Gets the device enumeration Speed. Read
hptxfsiz Gets the value of the Host Periodic Transmit FIFO Read
hprt0 Gets or sets the value in the Host Port Control and Status Register Read/Write
regoffset Sets the register offset for the next Register Access Read/Write
regvalue Gets or sets the value of the register at the offset in the regoffset attribute. Read/Write
remote_wakeup On read, shows the status of Remote Wakeup. On write, initiates a remote -+ wakeup of the host. When bit 0 is 1 and Remote Wakeup is enabled, the Remote -+ Wakeup signalling bit in the Device Control Register is set for 1 -+ milli-second. Read/Write
rem_wakeup_pwrdn On read, shows the status core - hibernated or not. On write, initiates -+ a remote wakeup of the device from Hibernation. Read/Write
mode_ch_tim_en This bit is used to enable or disable the host core to wait for 200 PHY -+ clock cycles at the end of Resume to change the opmode signal to the PHY to 00 -+ after Suspend or LPM. Read/Write
fr_interval On read, shows the value of HFIR Frame Interval. On write, dynamically -+ reload HFIR register during runtime. The application can write a value to this -+ register only after the Port Enable bit of the Host Port Control and Status -+ register (HPRT.PrtEnaPort) has been set Read/Write
disconnect_us On read, shows the status of disconnect_device_us. On write, sets disconnect_us -+ which causes soft disconnect for 100us. Applicable only for device mode of operation. Read/Write
regdump Dumps the contents of core registers. Read
spramdump Dumps the contents of core registers. Read
hcddump Dumps the current HCD state. Read
hcd_frrem Shows the average value of the Frame Remaining -+ field in the Host Frame Number/Frame Remaining register when an SOF interrupt -+ occurs. This can be used to determine the average interrupt latency. Also -+ shows the average Frame Remaining value for start_transfer and the "a" and -+ "b" sample points. The "a" and "b" sample points may be used during debugging -+ bto determine how long it takes to execute a section of the HCD code. Read
rd_reg_test Displays the time required to read the GNPTXFSIZ register many times -+ (the output shows the number of times the register is read). -+ Read
wr_reg_test Displays the time required to write the GNPTXFSIZ register many times -+ (the output shows the number of times the register is written). -+ Read
lpm_response Gets or sets lpm_response mode. Applicable only in device mode. -+ Write
sleep_status Shows sleep status of device. -+ Read
-+ -+ Example usage: -+ To get the current mode: -+ cat /sys/devices/lm0/mode -+ -+ To power down the USB: -+ echo 0 > /sys/devices/lm0/buspower -+ */ -+ -+#include "dwc_otg_os_dep.h" -+#include "dwc_os.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_attr.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_hcd_if.h" -+ -+/* -+ * MACROs for defining sysfs attribute -+ */ -+#ifdef LM_INTERFACE -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t set = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ -+ return count; \ -+} -+ -+#elif defined(PCI_INTERFACE) -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t set = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ -+ return count; \ -+} -+ -+#elif defined(PLATFORM_INTERFACE) -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct platform_device *platform_dev = \ -+ container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t val; \ -+ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ -+ __func__, _dev, platform_dev, otg_dev); \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t set = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ -+ return count; \ -+} -+#endif -+ -+/* -+ * MACROs for defining sysfs attribute for 32-bit registers -+ */ -+#ifdef LM_INTERFACE -+#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t val = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ -+ return count; \ -+} -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t val = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ -+ return count; \ -+} -+ -+#elif defined(PLATFORM_INTERFACE) -+#include "dwc_otg_dbg.h" -+#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t val; \ -+ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ -+ __func__, _dev, platform_dev, otg_dev); \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t val = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ -+ return count; \ -+} -+ -+#endif -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_RW(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_RO(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); -+ -+#define DWC_OTG_DEVICE_ATTR_REG32_RW(_otg_attr_name_,_addr_,_string_) \ -+DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); -+ -+#define DWC_OTG_DEVICE_ATTR_REG32_RO(_otg_attr_name_,_addr_,_string_) \ -+DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); -+ -+/** @name Functions for Show/Store of Attributes */ -+/**@{*/ -+ -+/** -+ * Helper function returning the otg_device structure of the given device -+ */ -+static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) -+{ -+ dwc_otg_device_t *otg_dev; -+ DWC_OTG_GETDRVDEV(otg_dev, _dev); -+ return otg_dev; -+} -+ -+/** -+ * Show the register offset of the Register Access. -+ */ -+static ssize_t regoffset_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return snprintf(buf, sizeof("0xFFFFFFFF\n") + 1, "0x%08x\n", -+ otg_dev->os_dep.reg_offset); -+} -+ -+/** -+ * Set the register offset for the next Register Access Read/Write -+ */ -+static ssize_t regoffset_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t offset = simple_strtoul(buf, NULL, 16); -+#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) -+ if (offset < SZ_256K) { -+#elif defined(PCI_INTERFACE) -+ if (offset < 0x00040000) { -+#endif -+ otg_dev->os_dep.reg_offset = offset; -+ } else { -+ dev_err(_dev, "invalid offset\n"); -+ } -+ -+ return count; -+} -+ -+DEVICE_ATTR(regoffset, S_IRUGO | S_IWUSR, regoffset_show, regoffset_store); -+ -+/** -+ * Show the value of the register at the offset in the reg_offset -+ * attribute. -+ */ -+static ssize_t regvalue_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val; -+ volatile uint32_t *addr; -+ -+ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { -+ /* Calculate the address */ -+ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + -+ (uint8_t *) otg_dev->os_dep.base); -+ val = DWC_READ_REG32(addr); -+ return snprintf(buf, -+ sizeof("Reg@0xFFFFFFFF = 0xFFFFFFFF\n") + 1, -+ "Reg@0x%06x = 0x%08x\n", otg_dev->os_dep.reg_offset, -+ val); -+ } else { -+ dev_err(_dev, "Invalid offset (0x%0x)\n", otg_dev->os_dep.reg_offset); -+ return sprintf(buf, "invalid offset\n"); -+ } -+} -+ -+/** -+ * Store the value in the register at the offset in the reg_offset -+ * attribute. -+ * -+ */ -+static ssize_t regvalue_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ volatile uint32_t *addr; -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ //dev_dbg(_dev, "Offset=0x%08x Val=0x%08x\n", otg_dev->reg_offset, val); -+ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { -+ /* Calculate the address */ -+ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + -+ (uint8_t *) otg_dev->os_dep.base); -+ DWC_WRITE_REG32(addr, val); -+ } else { -+ dev_err(_dev, "Invalid Register Offset (0x%08x)\n", -+ otg_dev->os_dep.reg_offset); -+ } -+ return count; -+} -+ -+DEVICE_ATTR(regvalue, S_IRUGO | S_IWUSR, regvalue_show, regvalue_store); -+ -+/* -+ * Attributes -+ */ -+DWC_OTG_DEVICE_ATTR_BITFIELD_RO(mode, "Mode"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hnpcapable, "HNPCapable"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(srpcapable, "SRPCapable"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hsic_connect, "HSIC Connect"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(inv_sel_hsic, "Invert Select HSIC"); -+ -+//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(buspower,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); -+//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(bussuspend,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RO(busconnected, "Bus Connected"); -+ -+DWC_OTG_DEVICE_ATTR_REG32_RW(gotgctl, 0, "GOTGCTL"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(gusbcfg, -+ &(otg_dev->core_if->core_global_regs->gusbcfg), -+ "GUSBCFG"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(grxfsiz, -+ &(otg_dev->core_if->core_global_regs->grxfsiz), -+ "GRXFSIZ"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(gnptxfsiz, -+ &(otg_dev->core_if->core_global_regs->gnptxfsiz), -+ "GNPTXFSIZ"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(gpvndctl, -+ &(otg_dev->core_if->core_global_regs->gpvndctl), -+ "GPVNDCTL"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(ggpio, -+ &(otg_dev->core_if->core_global_regs->ggpio), -+ "GGPIO"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(guid, &(otg_dev->core_if->core_global_regs->guid), -+ "GUID"); -+DWC_OTG_DEVICE_ATTR_REG32_RO(gsnpsid, -+ &(otg_dev->core_if->core_global_regs->gsnpsid), -+ "GSNPSID"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(devspeed, "Device Speed"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RO(enumspeed, "Device Enumeration Speed"); -+ -+DWC_OTG_DEVICE_ATTR_REG32_RO(hptxfsiz, -+ &(otg_dev->core_if->core_global_regs->hptxfsiz), -+ "HPTXFSIZ"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(hprt0, otg_dev->core_if->host_if->hprt0, "HPRT0"); -+ -+/** -+ * @todo Add code to initiate the HNP. -+ */ -+/** -+ * Show the HNP status bit -+ */ -+static ssize_t hnp_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "HstNegScs = 0x%x\n", -+ dwc_otg_get_hnpstatus(otg_dev->core_if)); -+} -+ -+/** -+ * Set the HNP Request bit -+ */ -+static ssize_t hnp_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_hnpreq(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(hnp, 0644, hnp_show, hnp_store); -+ -+/** -+ * @todo Add code to initiate the SRP. -+ */ -+/** -+ * Show the SRP status bit -+ */ -+static ssize_t srp_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "SesReqScs = 0x%x\n", -+ dwc_otg_get_srpstatus(otg_dev->core_if)); -+#else -+ return sprintf(buf, "Host Only Mode!\n"); -+#endif -+} -+ -+/** -+ * Set the SRP Request bit -+ */ -+static ssize_t srp_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_pcd_initiate_srp(otg_dev->pcd); -+#endif -+ return count; -+} -+ -+DEVICE_ATTR(srp, 0644, srp_show, srp_store); -+ -+/** -+ * @todo Need to do more for power on/off? -+ */ -+/** -+ * Show the Bus Power status -+ */ -+static ssize_t buspower_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Bus Power = 0x%x\n", -+ dwc_otg_get_prtpower(otg_dev->core_if)); -+} -+ -+/** -+ * Set the Bus Power status -+ */ -+static ssize_t buspower_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t on = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_prtpower(otg_dev->core_if, on); -+ return count; -+} -+ -+DEVICE_ATTR(buspower, 0644, buspower_show, buspower_store); -+ -+/** -+ * @todo Need to do more for suspend? -+ */ -+/** -+ * Show the Bus Suspend status -+ */ -+static ssize_t bussuspend_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Bus Suspend = 0x%x\n", -+ dwc_otg_get_prtsuspend(otg_dev->core_if)); -+} -+ -+/** -+ * Set the Bus Suspend status -+ */ -+static ssize_t bussuspend_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_prtsuspend(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(bussuspend, 0644, bussuspend_show, bussuspend_store); -+ -+/** -+ * Show the Mode Change Ready Timer status -+ */ -+static ssize_t mode_ch_tim_en_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Mode Change Ready Timer Enable = 0x%x\n", -+ dwc_otg_get_mode_ch_tim(otg_dev->core_if)); -+} -+ -+/** -+ * Set the Mode Change Ready Timer status -+ */ -+static ssize_t mode_ch_tim_en_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_mode_ch_tim(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(mode_ch_tim_en, 0644, mode_ch_tim_en_show, mode_ch_tim_en_store); -+ -+/** -+ * Show the value of HFIR Frame Interval bitfield -+ */ -+static ssize_t fr_interval_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Frame Interval = 0x%x\n", -+ dwc_otg_get_fr_interval(otg_dev->core_if)); -+} -+ -+/** -+ * Set the HFIR Frame Interval value -+ */ -+static ssize_t fr_interval_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 10); -+ dwc_otg_set_fr_interval(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(fr_interval, 0644, fr_interval_show, fr_interval_store); -+ -+/** -+ * Show the status of Remote Wakeup. -+ */ -+static ssize_t remote_wakeup_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ return sprintf(buf, -+ "Remote Wakeup Sig = %d Enabled = %d LPM Remote Wakeup = %d\n", -+ dwc_otg_get_remotewakesig(otg_dev->core_if), -+ dwc_otg_pcd_get_rmwkup_enable(otg_dev->pcd), -+ dwc_otg_get_lpm_remotewakeenabled(otg_dev->core_if)); -+#else -+ return sprintf(buf, "Host Only Mode!\n"); -+#endif /* DWC_HOST_ONLY */ -+} -+ -+/** -+ * Initiate a remote wakeup of the host. The Device control register -+ * Remote Wakeup Signal bit is written if the PCD Remote wakeup enable -+ * flag is set. -+ * -+ */ -+static ssize_t remote_wakeup_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ -+ if (val & 1) { -+ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 1); -+ } else { -+ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 0); -+ } -+#endif /* DWC_HOST_ONLY */ -+ return count; -+} -+ -+DEVICE_ATTR(remote_wakeup, S_IRUGO | S_IWUSR, remote_wakeup_show, -+ remote_wakeup_store); -+ -+/** -+ * Show the whether core is hibernated or not. -+ */ -+static ssize_t rem_wakeup_pwrdn_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ if (dwc_otg_get_core_state(otg_dev->core_if)) { -+ DWC_PRINTF("Core is in hibernation\n"); -+ } else { -+ DWC_PRINTF("Core is not in hibernation\n"); -+ } -+#endif /* DWC_HOST_ONLY */ -+ return 0; -+} -+ -+extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset); -+ -+/** -+ * Initiate a remote wakeup of the device to exit from hibernation. -+ */ -+static ssize_t rem_wakeup_pwrdn_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_device_hibernation_restore(otg_dev->core_if, 1, 0); -+#endif -+ return count; -+} -+ -+DEVICE_ATTR(rem_wakeup_pwrdn, S_IRUGO | S_IWUSR, rem_wakeup_pwrdn_show, -+ rem_wakeup_pwrdn_store); -+ -+static ssize_t disconnect_us(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ DWC_PRINTF("The Passed value is %04x\n", val); -+ -+ dwc_otg_pcd_disconnect_us(otg_dev->pcd, 50); -+ -+#endif /* DWC_HOST_ONLY */ -+ return count; -+} -+ -+DEVICE_ATTR(disconnect_us, S_IWUSR, 0, disconnect_us); -+ -+/** -+ * Dump global registers and either host or device registers (depending on the -+ * current mode of the core). -+ */ -+static ssize_t regdump_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ dwc_otg_dump_global_registers(otg_dev->core_if); -+ if (dwc_otg_is_host_mode(otg_dev->core_if)) { -+ dwc_otg_dump_host_registers(otg_dev->core_if); -+ } else { -+ dwc_otg_dump_dev_registers(otg_dev->core_if); -+ -+ } -+ return sprintf(buf, "Register Dump\n"); -+} -+ -+DEVICE_ATTR(regdump, S_IRUGO, regdump_show, 0); -+ -+/** -+ * Dump global registers and either host or device registers (depending on the -+ * current mode of the core). -+ */ -+static ssize_t spramdump_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ //dwc_otg_dump_spram(otg_dev->core_if); -+ -+ return sprintf(buf, "SPRAM Dump\n"); -+} -+ -+DEVICE_ATTR(spramdump, S_IRUGO, spramdump_show, 0); -+ -+/** -+ * Dump the current hcd state. -+ */ -+static ssize_t hcddump_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_DEVICE_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_hcd_dump_state(otg_dev->hcd); -+#endif /* DWC_DEVICE_ONLY */ -+ return sprintf(buf, "HCD Dump\n"); -+} -+ -+DEVICE_ATTR(hcddump, S_IRUGO, hcddump_show, 0); -+ -+/** -+ * Dump the average frame remaining at SOF. This can be used to -+ * determine average interrupt latency. Frame remaining is also shown for -+ * start transfer and two additional sample points. -+ */ -+static ssize_t hcd_frrem_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_DEVICE_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ dwc_otg_hcd_dump_frrem(otg_dev->hcd); -+#endif /* DWC_DEVICE_ONLY */ -+ return sprintf(buf, "HCD Dump Frame Remaining\n"); -+} -+ -+DEVICE_ATTR(hcd_frrem, S_IRUGO, hcd_frrem_show, 0); -+ -+/** -+ * Displays the time required to read the GNPTXFSIZ register many times (the -+ * output shows the number of times the register is read). -+ */ -+#define RW_REG_COUNT 10000000 -+#define MSEC_PER_JIFFIE 1000/HZ -+static ssize_t rd_reg_test_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ int i; -+ int time; -+ int start_jiffies; -+ -+ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", -+ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); -+ start_jiffies = jiffies; -+ for (i = 0; i < RW_REG_COUNT; i++) { -+ dwc_otg_get_gnptxfsiz(otg_dev->core_if); -+ } -+ time = jiffies - start_jiffies; -+ return sprintf(buf, -+ "Time to read GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", -+ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); -+} -+ -+DEVICE_ATTR(rd_reg_test, S_IRUGO, rd_reg_test_show, 0); -+ -+/** -+ * Displays the time required to write the GNPTXFSIZ register many times (the -+ * output shows the number of times the register is written). -+ */ -+static ssize_t wr_reg_test_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t reg_val; -+ int i; -+ int time; -+ int start_jiffies; -+ -+ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", -+ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); -+ reg_val = dwc_otg_get_gnptxfsiz(otg_dev->core_if); -+ start_jiffies = jiffies; -+ for (i = 0; i < RW_REG_COUNT; i++) { -+ dwc_otg_set_gnptxfsiz(otg_dev->core_if, reg_val); -+ } -+ time = jiffies - start_jiffies; -+ return sprintf(buf, -+ "Time to write GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", -+ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); -+} -+ -+DEVICE_ATTR(wr_reg_test, S_IRUGO, wr_reg_test_show, 0); -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ -+/** -+* Show the lpm_response attribute. -+*/ -+static ssize_t lpmresp_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) -+ return sprintf(buf, "** LPM is DISABLED **\n"); -+ -+ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { -+ return sprintf(buf, "** Current mode is not device mode\n"); -+ } -+ return sprintf(buf, "lpm_response = %d\n", -+ dwc_otg_get_lpmresponse(otg_dev->core_if)); -+} -+ -+/** -+* Store the lpm_response attribute. -+*/ -+static ssize_t lpmresp_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ -+ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) { -+ return 0; -+ } -+ -+ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { -+ return 0; -+ } -+ -+ dwc_otg_set_lpmresponse(otg_dev->core_if, val); -+ return count; -+} -+ -+DEVICE_ATTR(lpm_response, S_IRUGO | S_IWUSR, lpmresp_show, lpmresp_store); -+ -+/** -+* Show the sleep_status attribute. -+*/ -+static ssize_t sleepstatus_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Sleep Status = %d\n", -+ dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)); -+} -+ -+/** -+ * Store the sleep_status attribure. -+ */ -+static ssize_t sleepstatus_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ -+ if (dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)) { -+ if (dwc_otg_is_host_mode(core_if)) { -+ -+ DWC_PRINTF("Host initiated resume\n"); -+ dwc_otg_set_prtresume(otg_dev->core_if, 1); -+ } -+ } -+ -+ return count; -+} -+ -+DEVICE_ATTR(sleep_status, S_IRUGO | S_IWUSR, sleepstatus_show, -+ sleepstatus_store); -+ -+#endif /* CONFIG_USB_DWC_OTG_LPM_ENABLE */ -+ -+/**@}*/ -+ -+/** -+ * Create the device files -+ */ -+void dwc_otg_attr_create( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ) -+{ -+ int error; -+ -+ error = device_create_file(&dev->dev, &dev_attr_regoffset); -+ error = device_create_file(&dev->dev, &dev_attr_regvalue); -+ error = device_create_file(&dev->dev, &dev_attr_mode); -+ error = device_create_file(&dev->dev, &dev_attr_hnpcapable); -+ error = device_create_file(&dev->dev, &dev_attr_srpcapable); -+ error = device_create_file(&dev->dev, &dev_attr_hsic_connect); -+ error = device_create_file(&dev->dev, &dev_attr_inv_sel_hsic); -+ error = device_create_file(&dev->dev, &dev_attr_hnp); -+ error = device_create_file(&dev->dev, &dev_attr_srp); -+ error = device_create_file(&dev->dev, &dev_attr_buspower); -+ error = device_create_file(&dev->dev, &dev_attr_bussuspend); -+ error = device_create_file(&dev->dev, &dev_attr_mode_ch_tim_en); -+ error = device_create_file(&dev->dev, &dev_attr_fr_interval); -+ error = device_create_file(&dev->dev, &dev_attr_busconnected); -+ error = device_create_file(&dev->dev, &dev_attr_gotgctl); -+ error = device_create_file(&dev->dev, &dev_attr_gusbcfg); -+ error = device_create_file(&dev->dev, &dev_attr_grxfsiz); -+ error = device_create_file(&dev->dev, &dev_attr_gnptxfsiz); -+ error = device_create_file(&dev->dev, &dev_attr_gpvndctl); -+ error = device_create_file(&dev->dev, &dev_attr_ggpio); -+ error = device_create_file(&dev->dev, &dev_attr_guid); -+ error = device_create_file(&dev->dev, &dev_attr_gsnpsid); -+ error = device_create_file(&dev->dev, &dev_attr_devspeed); -+ error = device_create_file(&dev->dev, &dev_attr_enumspeed); -+ error = device_create_file(&dev->dev, &dev_attr_hptxfsiz); -+ error = device_create_file(&dev->dev, &dev_attr_hprt0); -+ error = device_create_file(&dev->dev, &dev_attr_remote_wakeup); -+ error = device_create_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); -+ error = device_create_file(&dev->dev, &dev_attr_disconnect_us); -+ error = device_create_file(&dev->dev, &dev_attr_regdump); -+ error = device_create_file(&dev->dev, &dev_attr_spramdump); -+ error = device_create_file(&dev->dev, &dev_attr_hcddump); -+ error = device_create_file(&dev->dev, &dev_attr_hcd_frrem); -+ error = device_create_file(&dev->dev, &dev_attr_rd_reg_test); -+ error = device_create_file(&dev->dev, &dev_attr_wr_reg_test); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ error = device_create_file(&dev->dev, &dev_attr_lpm_response); -+ error = device_create_file(&dev->dev, &dev_attr_sleep_status); -+#endif -+} -+ -+/** -+ * Remove the device files -+ */ -+void dwc_otg_attr_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ) -+{ -+ device_remove_file(&dev->dev, &dev_attr_regoffset); -+ device_remove_file(&dev->dev, &dev_attr_regvalue); -+ device_remove_file(&dev->dev, &dev_attr_mode); -+ device_remove_file(&dev->dev, &dev_attr_hnpcapable); -+ device_remove_file(&dev->dev, &dev_attr_srpcapable); -+ device_remove_file(&dev->dev, &dev_attr_hsic_connect); -+ device_remove_file(&dev->dev, &dev_attr_inv_sel_hsic); -+ device_remove_file(&dev->dev, &dev_attr_hnp); -+ device_remove_file(&dev->dev, &dev_attr_srp); -+ device_remove_file(&dev->dev, &dev_attr_buspower); -+ device_remove_file(&dev->dev, &dev_attr_bussuspend); -+ device_remove_file(&dev->dev, &dev_attr_mode_ch_tim_en); -+ device_remove_file(&dev->dev, &dev_attr_fr_interval); -+ device_remove_file(&dev->dev, &dev_attr_busconnected); -+ device_remove_file(&dev->dev, &dev_attr_gotgctl); -+ device_remove_file(&dev->dev, &dev_attr_gusbcfg); -+ device_remove_file(&dev->dev, &dev_attr_grxfsiz); -+ device_remove_file(&dev->dev, &dev_attr_gnptxfsiz); -+ device_remove_file(&dev->dev, &dev_attr_gpvndctl); -+ device_remove_file(&dev->dev, &dev_attr_ggpio); -+ device_remove_file(&dev->dev, &dev_attr_guid); -+ device_remove_file(&dev->dev, &dev_attr_gsnpsid); -+ device_remove_file(&dev->dev, &dev_attr_devspeed); -+ device_remove_file(&dev->dev, &dev_attr_enumspeed); -+ device_remove_file(&dev->dev, &dev_attr_hptxfsiz); -+ device_remove_file(&dev->dev, &dev_attr_hprt0); -+ device_remove_file(&dev->dev, &dev_attr_remote_wakeup); -+ device_remove_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); -+ device_remove_file(&dev->dev, &dev_attr_disconnect_us); -+ device_remove_file(&dev->dev, &dev_attr_regdump); -+ device_remove_file(&dev->dev, &dev_attr_spramdump); -+ device_remove_file(&dev->dev, &dev_attr_hcddump); -+ device_remove_file(&dev->dev, &dev_attr_hcd_frrem); -+ device_remove_file(&dev->dev, &dev_attr_rd_reg_test); -+ device_remove_file(&dev->dev, &dev_attr_wr_reg_test); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ device_remove_file(&dev->dev, &dev_attr_lpm_response); -+ device_remove_file(&dev->dev, &dev_attr_sleep_status); -+#endif -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.h b/drivers/usb/host/dwc_otg/dwc_otg_attr.h -new file mode 100644 -index 0000000000000000000000000000000000000000..e10b67f97c522094b553b7675741ba1b3cae293d ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.h -@@ -0,0 +1,89 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ -+ * $Revision: #13 $ -+ * $Date: 2010/06/21 $ -+ * $Change: 1532021 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_OTG_ATTR_H__) -+#define __DWC_OTG_ATTR_H__ -+ -+/** @file -+ * This file contains the interface to the Linux device attributes. -+ */ -+extern struct device_attribute dev_attr_regoffset; -+extern struct device_attribute dev_attr_regvalue; -+ -+extern struct device_attribute dev_attr_mode; -+extern struct device_attribute dev_attr_hnpcapable; -+extern struct device_attribute dev_attr_srpcapable; -+extern struct device_attribute dev_attr_hnp; -+extern struct device_attribute dev_attr_srp; -+extern struct device_attribute dev_attr_buspower; -+extern struct device_attribute dev_attr_bussuspend; -+extern struct device_attribute dev_attr_mode_ch_tim_en; -+extern struct device_attribute dev_attr_fr_interval; -+extern struct device_attribute dev_attr_busconnected; -+extern struct device_attribute dev_attr_gotgctl; -+extern struct device_attribute dev_attr_gusbcfg; -+extern struct device_attribute dev_attr_grxfsiz; -+extern struct device_attribute dev_attr_gnptxfsiz; -+extern struct device_attribute dev_attr_gpvndctl; -+extern struct device_attribute dev_attr_ggpio; -+extern struct device_attribute dev_attr_guid; -+extern struct device_attribute dev_attr_gsnpsid; -+extern struct device_attribute dev_attr_devspeed; -+extern struct device_attribute dev_attr_enumspeed; -+extern struct device_attribute dev_attr_hptxfsiz; -+extern struct device_attribute dev_attr_hprt0; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+extern struct device_attribute dev_attr_lpm_response; -+extern struct device_attribute devi_attr_sleep_status; -+#endif -+ -+void dwc_otg_attr_create( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+ -+void dwc_otg_attr_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.c b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..bbb3d32093d029e93f903bd76f45a3f715e55afd ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c -@@ -0,0 +1,1876 @@ -+/* ========================================================================== -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * This file contains the most of the CFI(Core Feature Interface) -+ * implementation for the OTG. -+ */ -+ -+#ifdef DWC_UTE_CFI -+ -+#include "dwc_otg_pcd.h" -+#include "dwc_otg_cfi.h" -+ -+/** This definition should actually migrate to the Portability Library */ -+#define DWC_CONSTANT_CPU_TO_LE16(x) (x) -+ -+extern dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex); -+ -+static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen); -+static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, -+ struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *ctrl_req); -+static int cfi_set_feature_value(struct dwc_otg_pcd *pcd); -+static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep); -+ -+static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if); -+static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue); -+static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue); -+ -+static uint8_t resize_fifos(dwc_otg_core_if_t * core_if); -+ -+/** This is the header of the all features descriptor */ -+static cfi_all_features_header_t all_props_desc_header = { -+ .wVersion = DWC_CONSTANT_CPU_TO_LE16(0x100), -+ .wCoreID = DWC_CONSTANT_CPU_TO_LE16(CFI_CORE_ID_OTG), -+ .wNumFeatures = DWC_CONSTANT_CPU_TO_LE16(9), -+}; -+ -+/** This is an array of statically allocated feature descriptors */ -+static cfi_feature_desc_header_t prop_descs[] = { -+ -+ /* FT_ID_DMA_MODE */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_MODE), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(1), -+ }, -+ -+ /* FT_ID_DMA_BUFFER_SETUP */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFFER_SETUP), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_DMA_BUFF_ALIGN */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFF_ALIGN), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ }, -+ -+ /* FT_ID_DMA_CONCAT_SETUP */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CONCAT_SETUP), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ //.wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_DMA_CIRCULAR */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CIRCULAR), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_THRESHOLD_SETUP */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_THRESHOLD_SETUP), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_DFIFO_DEPTH */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DFIFO_DEPTH), -+ .bmAttributes = CFI_FEATURE_ATTR_RO, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ }, -+ -+ /* FT_ID_TX_FIFO_DEPTH */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_TX_FIFO_DEPTH), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ }, -+ -+ /* FT_ID_RX_FIFO_DEPTH */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_RX_FIFO_DEPTH), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ } -+}; -+ -+/** The table of feature names */ -+cfi_string_t prop_name_table[] = { -+ {FT_ID_DMA_MODE, "dma_mode"}, -+ {FT_ID_DMA_BUFFER_SETUP, "buffer_setup"}, -+ {FT_ID_DMA_BUFF_ALIGN, "buffer_align"}, -+ {FT_ID_DMA_CONCAT_SETUP, "concat_setup"}, -+ {FT_ID_DMA_CIRCULAR, "buffer_circular"}, -+ {FT_ID_THRESHOLD_SETUP, "threshold_setup"}, -+ {FT_ID_DFIFO_DEPTH, "dfifo_depth"}, -+ {FT_ID_TX_FIFO_DEPTH, "txfifo_depth"}, -+ {FT_ID_RX_FIFO_DEPTH, "rxfifo_depth"}, -+ {} -+}; -+ -+/************************************************************************/ -+ -+/** -+ * Returns the name of the feature by its ID -+ * or NULL if no featute ID matches. -+ * -+ */ -+const uint8_t *get_prop_name(uint16_t prop_id, int *len) -+{ -+ cfi_string_t *pstr; -+ *len = 0; -+ -+ for (pstr = prop_name_table; pstr && pstr->s; pstr++) { -+ if (pstr->id == prop_id) { -+ *len = DWC_STRLEN(pstr->s); -+ return pstr->s; -+ } -+ } -+ return NULL; -+} -+ -+/** -+ * This function handles all CFI specific control requests. -+ * -+ * Return a negative value to stall the DCE. -+ */ -+int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl) -+{ -+ int retval = 0; -+ dwc_otg_pcd_ep_t *ep = NULL; -+ cfiobject_t *cfi = pcd->cfi; -+ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); -+ uint16_t wLen = DWC_LE16_TO_CPU(&ctrl->wLength); -+ uint16_t wValue = DWC_LE16_TO_CPU(&ctrl->wValue); -+ uint16_t wIndex = DWC_LE16_TO_CPU(&ctrl->wIndex); -+ uint32_t regaddr = 0; -+ uint32_t regval = 0; -+ -+ /* Save this Control Request in the CFI object. -+ * The data field will be assigned in the data stage completion CB function. -+ */ -+ cfi->ctrl_req = *ctrl; -+ cfi->ctrl_req.data = NULL; -+ -+ cfi->need_gadget_att = 0; -+ cfi->need_status_in_complete = 0; -+ -+ switch (ctrl->bRequest) { -+ case VEN_CORE_GET_FEATURES: -+ retval = cfi_core_features_buf(cfi->buf_in.buf, CFI_IN_BUF_LEN); -+ if (retval >= 0) { -+ //dump_msg(cfi->buf_in.buf, retval); -+ ep = &pcd->ep0; -+ -+ retval = min((uint16_t) retval, wLen); -+ /* Transfer this buffer to the host through the EP0-IN EP */ -+ ep->dwc_ep.dma_addr = cfi->buf_in.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_len = retval; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ } -+ retval = 0; -+ break; -+ -+ case VEN_CORE_GET_FEATURE: -+ CFI_INFO("VEN_CORE_GET_FEATURE\n"); -+ retval = cfi_get_feature_value(cfi->buf_in.buf, CFI_IN_BUF_LEN, -+ pcd, ctrl); -+ if (retval >= 0) { -+ ep = &pcd->ep0; -+ -+ retval = min((uint16_t) retval, wLen); -+ /* Transfer this buffer to the host through the EP0-IN EP */ -+ ep->dwc_ep.dma_addr = cfi->buf_in.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_len = retval; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ } -+ CFI_INFO("VEN_CORE_GET_FEATURE=%d\n", retval); -+ dump_msg(cfi->buf_in.buf, retval); -+ break; -+ -+ case VEN_CORE_SET_FEATURE: -+ CFI_INFO("VEN_CORE_SET_FEATURE\n"); -+ /* Set up an XFER to get the data stage of the control request, -+ * which is the new value of the feature to be modified. -+ */ -+ ep = &pcd->ep0; -+ ep->dwc_ep.is_in = 0; -+ ep->dwc_ep.dma_addr = cfi->buf_out.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_len = wLen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ /* Read the control write's data stage */ -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ retval = 0; -+ break; -+ -+ case VEN_CORE_RESET_FEATURES: -+ CFI_INFO("VEN_CORE_RESET_FEATURES\n"); -+ cfi->need_gadget_att = 1; -+ cfi->need_status_in_complete = 1; -+ retval = cfi_preproc_reset(pcd, ctrl); -+ CFI_INFO("VEN_CORE_RESET_FEATURES = (%d)\n", retval); -+ break; -+ -+ case VEN_CORE_ACTIVATE_FEATURES: -+ CFI_INFO("VEN_CORE_ACTIVATE_FEATURES\n"); -+ break; -+ -+ case VEN_CORE_READ_REGISTER: -+ CFI_INFO("VEN_CORE_READ_REGISTER\n"); -+ /* wValue optionally contains the HI WORD of the register offset and -+ * wIndex contains the LOW WORD of the register offset -+ */ -+ if (wValue == 0) { -+ /* @TODO - MAS - fix the access to the base field */ -+ regaddr = 0; -+ //regaddr = (uint32_t) pcd->otg_dev->os_dep.base; -+ //GET_CORE_IF(pcd)->co -+ regaddr |= wIndex; -+ } else { -+ regaddr = (wValue << 16) | wIndex; -+ } -+ -+ /* Read a 32-bit value of the memory at the regaddr */ -+ regval = DWC_READ_REG32((uint32_t *) regaddr); -+ -+ ep = &pcd->ep0; -+ dwc_memcpy(cfi->buf_in.buf, ®val, sizeof(uint32_t)); -+ ep->dwc_ep.is_in = 1; -+ ep->dwc_ep.dma_addr = cfi->buf_in.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_len = wLen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ cfi->need_gadget_att = 0; -+ retval = 0; -+ break; -+ -+ case VEN_CORE_WRITE_REGISTER: -+ CFI_INFO("VEN_CORE_WRITE_REGISTER\n"); -+ /* Set up an XFER to get the data stage of the control request, -+ * which is the new value of the register to be modified. -+ */ -+ ep = &pcd->ep0; -+ ep->dwc_ep.is_in = 0; -+ ep->dwc_ep.dma_addr = cfi->buf_out.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_len = wLen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ /* Read the control write's data stage */ -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ retval = 0; -+ break; -+ -+ default: -+ retval = -DWC_E_NOT_SUPPORTED; -+ break; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function prepares the core features descriptors and copies its -+ * raw representation into the buffer . -+ * -+ * The buffer structure is as follows: -+ * all_features_header (8 bytes) -+ * features_#1 (8 bytes + feature name string length) -+ * features_#2 (8 bytes + feature name string length) -+ * ..... -+ * features_#n - where n=the total count of feature descriptors -+ */ -+static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen) -+{ -+ cfi_feature_desc_header_t *prop_hdr = prop_descs; -+ cfi_feature_desc_header_t *prop; -+ cfi_all_features_header_t *all_props_hdr = &all_props_desc_header; -+ cfi_all_features_header_t *tmp; -+ uint8_t *tmpbuf = buf; -+ const uint8_t *pname = NULL; -+ int i, j, namelen = 0, totlen; -+ -+ /* Prepare and copy the core features into the buffer */ -+ CFI_INFO("%s:\n", __func__); -+ -+ tmp = (cfi_all_features_header_t *) tmpbuf; -+ *tmp = *all_props_hdr; -+ tmpbuf += CFI_ALL_FEATURES_HDR_LEN; -+ -+ j = sizeof(prop_descs) / sizeof(cfi_all_features_header_t); -+ for (i = 0; i < j; i++, prop_hdr++) { -+ pname = get_prop_name(prop_hdr->wFeatureID, &namelen); -+ prop = (cfi_feature_desc_header_t *) tmpbuf; -+ *prop = *prop_hdr; -+ -+ prop->bNameLen = namelen; -+ prop->wLength = -+ DWC_CONSTANT_CPU_TO_LE16(CFI_FEATURE_DESC_HDR_LEN + -+ namelen); -+ -+ tmpbuf += CFI_FEATURE_DESC_HDR_LEN; -+ dwc_memcpy(tmpbuf, pname, namelen); -+ tmpbuf += namelen; -+ } -+ -+ totlen = tmpbuf - buf; -+ -+ if (totlen > 0) { -+ tmp = (cfi_all_features_header_t *) buf; -+ tmp->wTotalLen = DWC_CONSTANT_CPU_TO_LE16(totlen); -+ } -+ -+ return totlen; -+} -+ -+/** -+ * This function releases all the dynamic memory in the CFI object. -+ */ -+static void cfi_release(cfiobject_t * cfiobj) -+{ -+ cfi_ep_t *cfiep; -+ dwc_list_link_t *tmp; -+ -+ CFI_INFO("%s\n", __func__); -+ -+ if (cfiobj->buf_in.buf) { -+ DWC_DMA_FREE(CFI_IN_BUF_LEN, cfiobj->buf_in.buf, -+ cfiobj->buf_in.addr); -+ cfiobj->buf_in.buf = NULL; -+ } -+ -+ if (cfiobj->buf_out.buf) { -+ DWC_DMA_FREE(CFI_OUT_BUF_LEN, cfiobj->buf_out.buf, -+ cfiobj->buf_out.addr); -+ cfiobj->buf_out.buf = NULL; -+ } -+ -+ /* Free the Buffer Setup values for each EP */ -+ //list_for_each_entry(cfiep, &cfiobj->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfiobj->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ cfi_free_ep_bs_dyn_data(cfiep); -+ } -+} -+ -+/** -+ * This function frees the dynamically allocated EP buffer setup data. -+ */ -+static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep) -+{ -+ if (cfiep->bm_sg) { -+ DWC_FREE(cfiep->bm_sg); -+ cfiep->bm_sg = NULL; -+ } -+ -+ if (cfiep->bm_align) { -+ DWC_FREE(cfiep->bm_align); -+ cfiep->bm_align = NULL; -+ } -+ -+ if (cfiep->bm_concat) { -+ if (NULL != cfiep->bm_concat->wTxBytes) { -+ DWC_FREE(cfiep->bm_concat->wTxBytes); -+ cfiep->bm_concat->wTxBytes = NULL; -+ } -+ DWC_FREE(cfiep->bm_concat); -+ cfiep->bm_concat = NULL; -+ } -+} -+ -+/** -+ * This function initializes the default values of the features -+ * for a specific endpoint and should be called only once when -+ * the EP is enabled first time. -+ */ -+static int cfi_ep_init_defaults(struct dwc_otg_pcd *pcd, cfi_ep_t * cfiep) -+{ -+ int retval = 0; -+ -+ cfiep->bm_sg = DWC_ALLOC(sizeof(ddma_sg_buffer_setup_t)); -+ if (NULL == cfiep->bm_sg) { -+ CFI_INFO("Failed to allocate memory for SG feature value\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); -+ -+ /* For the Concatenation feature's default value we do not allocate -+ * memory for the wTxBytes field - it will be done in the set_feature_value -+ * request handler. -+ */ -+ cfiep->bm_concat = DWC_ALLOC(sizeof(ddma_concat_buffer_setup_t)); -+ if (NULL == cfiep->bm_concat) { -+ CFI_INFO -+ ("Failed to allocate memory for CONCATENATION feature value\n"); -+ DWC_FREE(cfiep->bm_sg); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); -+ -+ cfiep->bm_align = DWC_ALLOC(sizeof(ddma_align_buffer_setup_t)); -+ if (NULL == cfiep->bm_align) { -+ CFI_INFO -+ ("Failed to allocate memory for Alignment feature value\n"); -+ DWC_FREE(cfiep->bm_sg); -+ DWC_FREE(cfiep->bm_concat); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep->bm_align, 0, sizeof(ddma_align_buffer_setup_t)); -+ -+ return retval; -+} -+ -+/** -+ * The callback function that notifies the CFI on the activation of -+ * an endpoint in the PCD. The following steps are done in this function: -+ * -+ * Create a dynamically allocated cfi_ep_t object (a CFI wrapper to the PCD's -+ * active endpoint) -+ * Create MAX_DMA_DESCS_PER_EP count DMA Descriptors for the EP -+ * Set the Buffer Mode to standard -+ * Initialize the default values for all EP modes (SG, Circular, Concat, Align) -+ * Add the cfi_ep_t object to the list of active endpoints in the CFI object -+ */ -+static int cfi_ep_enable(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, -+ struct dwc_otg_pcd_ep *ep) -+{ -+ cfi_ep_t *cfiep; -+ int retval = -DWC_E_NOT_SUPPORTED; -+ -+ CFI_INFO("%s: epname=%s; epnum=0x%02x\n", __func__, -+ "EP_" /*ep->ep.name */ , ep->desc->bEndpointAddress); -+ /* MAS - Check whether this endpoint already is in the list */ -+ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); -+ -+ if (NULL == cfiep) { -+ /* Allocate a cfi_ep_t object */ -+ cfiep = DWC_ALLOC(sizeof(cfi_ep_t)); -+ if (NULL == cfiep) { -+ CFI_INFO -+ ("Unable to allocate memory for in function %s\n", -+ __func__); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep, 0, sizeof(cfi_ep_t)); -+ -+ /* Save the dwc_otg_pcd_ep pointer in the cfiep object */ -+ cfiep->ep = ep; -+ -+ /* Allocate the DMA Descriptors chain of MAX_DMA_DESCS_PER_EP count */ -+ ep->dwc_ep.descs = -+ DWC_DMA_ALLOC(MAX_DMA_DESCS_PER_EP * -+ sizeof(dwc_otg_dma_desc_t), -+ &ep->dwc_ep.descs_dma_addr); -+ -+ if (NULL == ep->dwc_ep.descs) { -+ DWC_FREE(cfiep); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_LIST_INIT(&cfiep->lh); -+ -+ /* Set the buffer mode to BM_STANDARD. It will be modified -+ * when building descriptors for a specific buffer mode */ -+ ep->dwc_ep.buff_mode = BM_STANDARD; -+ -+ /* Create and initialize the default values for this EP's Buffer modes */ -+ if ((retval = cfi_ep_init_defaults(pcd, cfiep)) < 0) -+ return retval; -+ -+ /* Add the cfi_ep_t object to the CFI object's list of active endpoints */ -+ DWC_LIST_INSERT_TAIL(&cfi->active_eps, &cfiep->lh); -+ retval = 0; -+ } else { /* The sought EP already is in the list */ -+ CFI_INFO("%s: The sought EP already is in the list\n", -+ __func__); -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function is called when the data stage of a 3-stage Control Write request -+ * is complete. -+ * -+ */ -+static int cfi_ctrl_write_complete(struct cfiobject *cfi, -+ struct dwc_otg_pcd *pcd) -+{ -+ uint32_t addr, reg_value; -+ uint16_t wIndex, wValue; -+ uint8_t bRequest; -+ uint8_t *buf = cfi->buf_out.buf; -+ //struct usb_ctrlrequest *ctrl_req = &cfi->ctrl_req_saved; -+ struct cfi_usb_ctrlrequest *ctrl_req = &cfi->ctrl_req; -+ int retval = -DWC_E_NOT_SUPPORTED; -+ -+ CFI_INFO("%s\n", __func__); -+ -+ bRequest = ctrl_req->bRequest; -+ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); -+ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); -+ -+ /* -+ * Save the pointer to the data stage in the ctrl_req's field. -+ * The request should be already saved in the command stage by now. -+ */ -+ ctrl_req->data = cfi->buf_out.buf; -+ cfi->need_status_in_complete = 0; -+ cfi->need_gadget_att = 0; -+ -+ switch (bRequest) { -+ case VEN_CORE_WRITE_REGISTER: -+ /* The buffer contains raw data of the new value for the register */ -+ reg_value = *((uint32_t *) buf); -+ if (wValue == 0) { -+ addr = 0; -+ //addr = (uint32_t) pcd->otg_dev->os_dep.base; -+ addr += wIndex; -+ } else { -+ addr = (wValue << 16) | wIndex; -+ } -+ -+ //writel(reg_value, addr); -+ -+ retval = 0; -+ cfi->need_status_in_complete = 1; -+ break; -+ -+ case VEN_CORE_SET_FEATURE: -+ /* The buffer contains raw data of the new value of the feature */ -+ retval = cfi_set_feature_value(pcd); -+ if (retval < 0) -+ return retval; -+ -+ cfi->need_status_in_complete = 1; -+ break; -+ -+ default: -+ break; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function builds the DMA descriptors for the SG buffer mode. -+ */ -+static void cfi_build_sg_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ struct dwc_otg_pcd_ep *ep = cfiep->ep; -+ ddma_sg_buffer_setup_t *sgval = cfiep->bm_sg; -+ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; -+ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; -+ dma_addr_t buff_addr = req->dma; -+ int i; -+ uint32_t txsize, off; -+ -+ txsize = sgval->wSize; -+ off = sgval->bOffset; -+ -+// CFI_INFO("%s: %s TXSIZE=0x%08x; OFFSET=0x%08x\n", -+// __func__, cfiep->ep->ep.name, txsize, off); -+ -+ for (i = 0; i < sgval->bCount; i++) { -+ desc->status.b.bs = BS_HOST_BUSY; -+ desc->buf = buff_addr; -+ desc->status.b.l = 0; -+ desc->status.b.ioc = 0; -+ desc->status.b.sp = 0; -+ desc->status.b.bytes = txsize; -+ desc->status.b.bs = BS_HOST_READY; -+ -+ /* Set the next address of the buffer */ -+ buff_addr += txsize + off; -+ desc_last = desc; -+ desc++; -+ } -+ -+ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ -+ desc_last->status.b.l = 1; -+ desc_last->status.b.ioc = 1; -+ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; -+ /* Save the last DMA descriptor pointer */ -+ cfiep->dma_desc_last = desc_last; -+ cfiep->desc_count = sgval->bCount; -+} -+ -+/** -+ * This function builds the DMA descriptors for the Concatenation buffer mode. -+ */ -+static void cfi_build_concat_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ struct dwc_otg_pcd_ep *ep = cfiep->ep; -+ ddma_concat_buffer_setup_t *concatval = cfiep->bm_concat; -+ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; -+ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; -+ dma_addr_t buff_addr = req->dma; -+ int i; -+ uint16_t *txsize; -+ -+ txsize = concatval->wTxBytes; -+ -+ for (i = 0; i < concatval->hdr.bDescCount; i++) { -+ desc->buf = buff_addr; -+ desc->status.b.bs = BS_HOST_BUSY; -+ desc->status.b.l = 0; -+ desc->status.b.ioc = 0; -+ desc->status.b.sp = 0; -+ desc->status.b.bytes = *txsize; -+ desc->status.b.bs = BS_HOST_READY; -+ -+ txsize++; -+ /* Set the next address of the buffer */ -+ buff_addr += UGETW(ep->desc->wMaxPacketSize); -+ desc_last = desc; -+ desc++; -+ } -+ -+ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ -+ desc_last->status.b.l = 1; -+ desc_last->status.b.ioc = 1; -+ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; -+ cfiep->dma_desc_last = desc_last; -+ cfiep->desc_count = concatval->hdr.bDescCount; -+} -+ -+/** -+ * This function builds the DMA descriptors for the Circular buffer mode -+ */ -+static void cfi_build_circ_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ /* @todo: MAS - add implementation when this feature needs to be tested */ -+} -+ -+/** -+ * This function builds the DMA descriptors for the Alignment buffer mode -+ */ -+static void cfi_build_align_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ struct dwc_otg_pcd_ep *ep = cfiep->ep; -+ ddma_align_buffer_setup_t *alignval = cfiep->bm_align; -+ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; -+ dma_addr_t buff_addr = req->dma; -+ -+ desc->status.b.bs = BS_HOST_BUSY; -+ desc->status.b.l = 1; -+ desc->status.b.ioc = 1; -+ desc->status.b.sp = ep->dwc_ep.sent_zlp; -+ desc->status.b.bytes = req->length; -+ /* Adjust the buffer alignment */ -+ desc->buf = (buff_addr + alignval->bAlign); -+ desc->status.b.bs = BS_HOST_READY; -+ cfiep->dma_desc_last = desc; -+ cfiep->desc_count = 1; -+} -+ -+/** -+ * This function builds the DMA descriptors chain for different modes of the -+ * buffer setup of an endpoint. -+ */ -+static void cfi_build_descriptors(struct cfiobject *cfi, -+ struct dwc_otg_pcd *pcd, -+ struct dwc_otg_pcd_ep *ep, -+ dwc_otg_pcd_request_t * req) -+{ -+ cfi_ep_t *cfiep; -+ -+ /* Get the cfiep by the dwc_otg_pcd_ep */ -+ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Unable to find a matching active endpoint\n", -+ __func__); -+ return; -+ } -+ -+ cfiep->xfer_len = req->length; -+ -+ /* Iterate through all the DMA descriptors */ -+ switch (cfiep->ep->dwc_ep.buff_mode) { -+ case BM_SG: -+ cfi_build_sg_descs(cfi, cfiep, req); -+ break; -+ -+ case BM_CONCAT: -+ cfi_build_concat_descs(cfi, cfiep, req); -+ break; -+ -+ case BM_CIRCULAR: -+ cfi_build_circ_descs(cfi, cfiep, req); -+ break; -+ -+ case BM_ALIGN: -+ cfi_build_align_descs(cfi, cfiep, req); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+/** -+ * Allocate DMA buffer for different Buffer modes. -+ */ -+static void *cfi_ep_alloc_buf(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, -+ struct dwc_otg_pcd_ep *ep, dma_addr_t * dma, -+ unsigned size, gfp_t flags) -+{ -+ return DWC_DMA_ALLOC(size, dma); -+} -+ -+/** -+ * This function initializes the CFI object. -+ */ -+int init_cfi(cfiobject_t * cfiobj) -+{ -+ CFI_INFO("%s\n", __func__); -+ -+ /* Allocate a buffer for IN XFERs */ -+ cfiobj->buf_in.buf = -+ DWC_DMA_ALLOC(CFI_IN_BUF_LEN, &cfiobj->buf_in.addr); -+ if (NULL == cfiobj->buf_in.buf) { -+ CFI_INFO("Unable to allocate buffer for INs\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Allocate a buffer for OUT XFERs */ -+ cfiobj->buf_out.buf = -+ DWC_DMA_ALLOC(CFI_OUT_BUF_LEN, &cfiobj->buf_out.addr); -+ if (NULL == cfiobj->buf_out.buf) { -+ CFI_INFO("Unable to allocate buffer for OUT\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Initialize the callback function pointers */ -+ cfiobj->ops.release = cfi_release; -+ cfiobj->ops.ep_enable = cfi_ep_enable; -+ cfiobj->ops.ctrl_write_complete = cfi_ctrl_write_complete; -+ cfiobj->ops.build_descriptors = cfi_build_descriptors; -+ cfiobj->ops.ep_alloc_buf = cfi_ep_alloc_buf; -+ -+ /* Initialize the list of active endpoints in the CFI object */ -+ DWC_LIST_INIT(&cfiobj->active_eps); -+ -+ return 0; -+} -+ -+/** -+ * This function reads the required feature's current value into the buffer -+ * -+ * @retval: Returns negative as error, or the data length of the feature -+ */ -+static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, -+ struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *ctrl_req) -+{ -+ int retval = -DWC_E_NOT_SUPPORTED; -+ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); -+ uint16_t dfifo, rxfifo, txfifo; -+ -+ switch (ctrl_req->wIndex) { -+ /* Whether the DDMA is enabled or not */ -+ case FT_ID_DMA_MODE: -+ *buf = (coreif->dma_enable && coreif->dma_desc_enable) ? 1 : 0; -+ retval = 1; -+ break; -+ -+ case FT_ID_DMA_BUFFER_SETUP: -+ retval = cfi_ep_get_sg_val(buf, pcd, ctrl_req); -+ break; -+ -+ case FT_ID_DMA_BUFF_ALIGN: -+ retval = cfi_ep_get_align_val(buf, pcd, ctrl_req); -+ break; -+ -+ case FT_ID_DMA_CONCAT_SETUP: -+ retval = cfi_ep_get_concat_val(buf, pcd, ctrl_req); -+ break; -+ -+ case FT_ID_DMA_CIRCULAR: -+ CFI_INFO("GetFeature value (FT_ID_DMA_CIRCULAR)\n"); -+ break; -+ -+ case FT_ID_THRESHOLD_SETUP: -+ CFI_INFO("GetFeature value (FT_ID_THRESHOLD_SETUP)\n"); -+ break; -+ -+ case FT_ID_DFIFO_DEPTH: -+ dfifo = get_dfifo_size(coreif); -+ *((uint16_t *) buf) = dfifo; -+ retval = sizeof(uint16_t); -+ break; -+ -+ case FT_ID_TX_FIFO_DEPTH: -+ retval = get_txfifo_size(pcd, ctrl_req->wValue); -+ if (retval >= 0) { -+ txfifo = retval; -+ *((uint16_t *) buf) = txfifo; -+ retval = sizeof(uint16_t); -+ } -+ break; -+ -+ case FT_ID_RX_FIFO_DEPTH: -+ retval = get_rxfifo_size(coreif, ctrl_req->wValue); -+ if (retval >= 0) { -+ rxfifo = retval; -+ *((uint16_t *) buf) = rxfifo; -+ retval = sizeof(uint16_t); -+ } -+ break; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function resets the SG for the specified EP to its default value -+ */ -+static int cfi_reset_sg_val(cfi_ep_t * cfiep) -+{ -+ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); -+ return 0; -+} -+ -+/** -+ * This function resets the Alignment for the specified EP to its default value -+ */ -+static int cfi_reset_align_val(cfi_ep_t * cfiep) -+{ -+ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); -+ return 0; -+} -+ -+/** -+ * This function resets the Concatenation for the specified EP to its default value -+ * This function will also set the value of the wTxBytes field to NULL after -+ * freeing the memory previously allocated for this field. -+ */ -+static int cfi_reset_concat_val(cfi_ep_t * cfiep) -+{ -+ /* First we need to free the wTxBytes field */ -+ if (cfiep->bm_concat->wTxBytes) { -+ DWC_FREE(cfiep->bm_concat->wTxBytes); -+ cfiep->bm_concat->wTxBytes = NULL; -+ } -+ -+ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); -+ return 0; -+} -+ -+/** -+ * This function resets all the buffer setups of the specified endpoint -+ */ -+static int cfi_ep_reset_all_setup_vals(cfi_ep_t * cfiep) -+{ -+ cfi_reset_sg_val(cfiep); -+ cfi_reset_align_val(cfiep); -+ cfi_reset_concat_val(cfiep); -+ return 0; -+} -+ -+static int cfi_handle_reset_fifo_val(struct dwc_otg_pcd *pcd, uint8_t ep_addr, -+ uint8_t rx_rst, uint8_t tx_rst) -+{ -+ int retval = -DWC_E_INVALID; -+ uint16_t tx_siz[15]; -+ uint16_t rx_siz = 0; -+ dwc_otg_pcd_ep_t *ep = NULL; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; -+ -+ if (rx_rst) { -+ rx_siz = params->dev_rx_fifo_size; -+ params->dev_rx_fifo_size = GET_CORE_IF(pcd)->init_rxfsiz; -+ } -+ -+ if (tx_rst) { -+ if (ep_addr == 0) { -+ int i; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ tx_siz[i] = -+ core_if->core_params->dev_tx_fifo_size[i]; -+ core_if->core_params->dev_tx_fifo_size[i] = -+ core_if->init_txfsiz[i]; -+ } -+ } else { -+ -+ ep = get_ep_by_addr(pcd, ep_addr); -+ -+ if (NULL == ep) { -+ CFI_INFO -+ ("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, ep_addr); -+ return -DWC_E_INVALID; -+ } -+ -+ tx_siz[0] = -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - -+ 1]; -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = -+ GET_CORE_IF(pcd)->init_txfsiz[ep-> -+ dwc_ep.tx_fifo_num - -+ 1]; -+ } -+ } -+ -+ if (resize_fifos(GET_CORE_IF(pcd))) { -+ retval = 0; -+ } else { -+ CFI_INFO -+ ("%s: Error resetting the feature Reset All(FIFO size)\n", -+ __func__); -+ if (rx_rst) { -+ params->dev_rx_fifo_size = rx_siz; -+ } -+ -+ if (tx_rst) { -+ if (ep_addr == 0) { -+ int i; -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; -+ i++) { -+ core_if-> -+ core_params->dev_tx_fifo_size[i] = -+ tx_siz[i]; -+ } -+ } else { -+ params->dev_tx_fifo_size[ep-> -+ dwc_ep.tx_fifo_num - -+ 1] = tx_siz[0]; -+ } -+ } -+ retval = -DWC_E_INVALID; -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_all(struct dwc_otg_pcd *pcd, uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ retval = cfi_handle_reset_fifo_val(pcd, addr, 1, 1); -+ if (retval < 0) { -+ return retval; -+ } -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_ep_reset_all_setup_vals(cfiep); -+ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_ep_reset_all_setup_vals(cfiep); -+ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Reset All\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_dma_buff_setup(struct dwc_otg_pcd *pcd, -+ uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_reset_sg_val(cfiep); -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_reset_sg_val(cfiep); -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Buffer Setup\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_concat_val(struct dwc_otg_pcd *pcd, uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_reset_concat_val(cfiep); -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_reset_concat_val(cfiep); -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Concatenation Value\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_align_val(struct dwc_otg_pcd *pcd, uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_reset_align_val(cfiep); -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_reset_align_val(cfiep); -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Aliignment Value\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+ -+} -+ -+static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = 0; -+ -+ switch (req->wIndex) { -+ case 0: -+ /* Reset all features */ -+ retval = cfi_handle_reset_all(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_DMA_BUFFER_SETUP: -+ /* Reset the SG buffer setup */ -+ retval = -+ cfi_handle_reset_dma_buff_setup(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_DMA_CONCAT_SETUP: -+ /* Reset the Concatenation buffer setup */ -+ retval = cfi_handle_reset_concat_val(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_DMA_BUFF_ALIGN: -+ /* Reset the Alignment buffer setup */ -+ retval = cfi_handle_reset_align_val(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_TX_FIFO_DEPTH: -+ retval = -+ cfi_handle_reset_fifo_val(pcd, req->wValue & 0xff, 0, 1); -+ pcd->cfi->need_gadget_att = 0; -+ break; -+ -+ case FT_ID_RX_FIFO_DEPTH: -+ retval = cfi_handle_reset_fifo_val(pcd, 0, 1, 0); -+ pcd->cfi->need_gadget_att = 0; -+ break; -+ default: -+ break; -+ } -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the SG buffer setup. -+ */ -+static int cfi_ep_set_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd) -+{ -+ uint8_t inaddr, outaddr; -+ cfi_ep_t *epin, *epout; -+ ddma_sg_buffer_setup_t *psgval; -+ uint32_t desccount, size; -+ -+ CFI_INFO("%s\n", __func__); -+ -+ psgval = (ddma_sg_buffer_setup_t *) buf; -+ desccount = (uint32_t) psgval->bCount; -+ size = (uint32_t) psgval->wSize; -+ -+ /* Check the DMA descriptor count */ -+ if ((desccount > MAX_DMA_DESCS_PER_EP) || (desccount == 0)) { -+ CFI_INFO -+ ("%s: The count of DMA Descriptors should be between 1 and %d\n", -+ __func__, MAX_DMA_DESCS_PER_EP); -+ return -DWC_E_INVALID; -+ } -+ -+ /* Check the DMA descriptor count */ -+ -+ if (size == 0) { -+ -+ CFI_INFO("%s: The transfer size should be at least 1 byte\n", -+ __func__); -+ -+ return -DWC_E_INVALID; -+ -+ } -+ -+ inaddr = psgval->bInEndpointAddress; -+ outaddr = psgval->bOutEndpointAddress; -+ -+ epin = get_cfi_ep_by_addr(pcd->cfi, inaddr); -+ epout = get_cfi_ep_by_addr(pcd->cfi, outaddr); -+ -+ if (NULL == epin || NULL == epout) { -+ CFI_INFO -+ ("%s: Unable to get the endpoints inaddr=0x%02x outaddr=0x%02x\n", -+ __func__, inaddr, outaddr); -+ return -DWC_E_INVALID; -+ } -+ -+ epin->ep->dwc_ep.buff_mode = BM_SG; -+ dwc_memcpy(epin->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); -+ -+ epout->ep->dwc_ep.buff_mode = BM_SG; -+ dwc_memcpy(epout->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); -+ -+ return 0; -+} -+ -+/** -+ * This function sets a new value for the buffer Alignment setup. -+ */ -+static int cfi_ep_set_alignment_val(uint8_t * buf, struct dwc_otg_pcd *pcd) -+{ -+ cfi_ep_t *ep; -+ uint8_t addr; -+ ddma_align_buffer_setup_t *palignval; -+ -+ palignval = (ddma_align_buffer_setup_t *) buf; -+ addr = palignval->bEndpointAddress; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ -+ ep->ep->dwc_ep.buff_mode = BM_ALIGN; -+ dwc_memcpy(ep->bm_align, palignval, sizeof(ddma_align_buffer_setup_t)); -+ -+ return 0; -+} -+ -+/** -+ * This function sets a new value for the Concatenation buffer setup. -+ */ -+static int cfi_ep_set_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd) -+{ -+ uint8_t addr; -+ cfi_ep_t *ep; -+ struct _ddma_concat_buffer_setup_hdr *pConcatValHdr; -+ uint16_t *pVals; -+ uint32_t desccount; -+ int i; -+ uint16_t mps; -+ -+ pConcatValHdr = (struct _ddma_concat_buffer_setup_hdr *)buf; -+ desccount = (uint32_t) pConcatValHdr->bDescCount; -+ pVals = (uint16_t *) (buf + BS_CONCAT_VAL_HDR_LEN); -+ -+ /* Check the DMA descriptor count */ -+ if (desccount > MAX_DMA_DESCS_PER_EP) { -+ CFI_INFO("%s: Maximum DMA Descriptor count should be %d\n", -+ __func__, MAX_DMA_DESCS_PER_EP); -+ return -DWC_E_INVALID; -+ } -+ -+ addr = pConcatValHdr->bEndpointAddress; -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ -+ mps = UGETW(ep->ep->desc->wMaxPacketSize); -+ -+#if 0 -+ for (i = 0; i < desccount; i++) { -+ CFI_INFO("%s: wTxSize[%d]=0x%04x\n", __func__, i, pVals[i]); -+ } -+ CFI_INFO("%s: epname=%s; mps=%d\n", __func__, ep->ep->ep.name, mps); -+#endif -+ -+ /* Check the wTxSizes to be less than or equal to the mps */ -+ for (i = 0; i < desccount; i++) { -+ if (pVals[i] > mps) { -+ CFI_INFO -+ ("%s: ERROR - the wTxSize[%d] should be <= MPS (wTxSize=%d)\n", -+ __func__, i, pVals[i]); -+ return -DWC_E_INVALID; -+ } -+ } -+ -+ ep->ep->dwc_ep.buff_mode = BM_CONCAT; -+ dwc_memcpy(ep->bm_concat, pConcatValHdr, BS_CONCAT_VAL_HDR_LEN); -+ -+ /* Free the previously allocated storage for the wTxBytes */ -+ if (ep->bm_concat->wTxBytes) { -+ DWC_FREE(ep->bm_concat->wTxBytes); -+ } -+ -+ /* Allocate a new storage for the wTxBytes field */ -+ ep->bm_concat->wTxBytes = -+ DWC_ALLOC(sizeof(uint16_t) * pConcatValHdr->bDescCount); -+ if (NULL == ep->bm_concat->wTxBytes) { -+ CFI_INFO("%s: Unable to allocate memory\n", __func__); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Copy the new values into the wTxBytes filed */ -+ dwc_memcpy(ep->bm_concat->wTxBytes, buf + BS_CONCAT_VAL_HDR_LEN, -+ sizeof(uint16_t) * pConcatValHdr->bDescCount); -+ -+ return 0; -+} -+ -+/** -+ * This function calculates the total of all FIFO sizes -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return The total of data FIFO sizes. -+ * -+ */ -+static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_params_t *params = core_if->core_params; -+ uint16_t dfifo_total = 0; -+ int i; -+ -+ /* The shared RxFIFO size */ -+ dfifo_total = -+ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; -+ -+ /* Add up each TxFIFO size to the total */ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ dfifo_total += params->dev_tx_fifo_size[i]; -+ } -+ -+ return dfifo_total; -+} -+ -+/** -+ * This function returns Rx FIFO size -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return The total of data FIFO sizes. -+ * -+ */ -+static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue) -+{ -+ switch (wValue >> 8) { -+ case 0: -+ return (core_if->pwron_rxfsiz < -+ 32768) ? core_if->pwron_rxfsiz : 32768; -+ break; -+ case 1: -+ return core_if->core_params->dev_rx_fifo_size; -+ break; -+ default: -+ return -DWC_E_INVALID; -+ break; -+ } -+} -+ -+/** -+ * This function returns Tx FIFO size for IN EP -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return The total of data FIFO sizes. -+ * -+ */ -+static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ -+ ep = get_ep_by_addr(pcd, wValue & 0xff); -+ -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, wValue & 0xff); -+ return -DWC_E_INVALID; -+ } -+ -+ if (!ep->dwc_ep.is_in) { -+ CFI_INFO -+ ("%s: No Tx FIFO assingned to the Out endpoint addr=0x%02x\n", -+ __func__, wValue & 0xff); -+ return -DWC_E_INVALID; -+ } -+ -+ switch (wValue >> 8) { -+ case 0: -+ return (GET_CORE_IF(pcd)->pwron_txfsiz -+ [ep->dwc_ep.tx_fifo_num - 1] < -+ 768) ? GET_CORE_IF(pcd)->pwron_txfsiz[ep-> -+ dwc_ep.tx_fifo_num -+ - 1] : 32768; -+ break; -+ case 1: -+ return GET_CORE_IF(pcd)->core_params-> -+ dev_tx_fifo_size[ep->dwc_ep.num - 1]; -+ break; -+ default: -+ return -DWC_E_INVALID; -+ break; -+ } -+} -+ -+/** -+ * This function checks if the submitted combination of -+ * device mode FIFO sizes is possible or not. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return 1 if possible, 0 otherwise. -+ * -+ */ -+static uint8_t check_fifo_sizes(dwc_otg_core_if_t * core_if) -+{ -+ uint16_t dfifo_actual = 0; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ uint16_t start_addr = 0; -+ int i; -+ -+ dfifo_actual = -+ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ dfifo_actual += params->dev_tx_fifo_size[i]; -+ } -+ -+ if (dfifo_actual > core_if->total_fifo_size) { -+ return 0; -+ } -+ -+ if (params->dev_rx_fifo_size > 32768 || params->dev_rx_fifo_size < 16) -+ return 0; -+ -+ if (params->dev_nperio_tx_fifo_size > 32768 -+ || params->dev_nperio_tx_fifo_size < 16) -+ return 0; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ -+ if (params->dev_tx_fifo_size[i] > 768 -+ || params->dev_tx_fifo_size[i] < 4) -+ return 0; -+ } -+ -+ if (params->dev_rx_fifo_size > core_if->pwron_rxfsiz) -+ return 0; -+ start_addr = params->dev_rx_fifo_size; -+ -+ if (params->dev_nperio_tx_fifo_size > core_if->pwron_gnptxfsiz) -+ return 0; -+ start_addr += params->dev_nperio_tx_fifo_size; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ -+ if (params->dev_tx_fifo_size[i] > core_if->pwron_txfsiz[i]) -+ return 0; -+ start_addr += params->dev_tx_fifo_size[i]; -+ } -+ -+ return 1; -+} -+ -+/** -+ * This function resizes Device mode FIFOs -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return 1 if successful, 0 otherwise -+ * -+ */ -+static uint8_t resize_fifos(dwc_otg_core_if_t * core_if) -+{ -+ int i = 0; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ uint32_t rx_fifo_size; -+ fifosize_data_t nptxfifosize; -+ fifosize_data_t txfifosize[15]; -+ -+ uint32_t rx_fsz_bak; -+ uint32_t nptxfsz_bak; -+ uint32_t txfsz_bak[15]; -+ -+ uint16_t start_address; -+ uint8_t retval = 1; -+ -+ if (!check_fifo_sizes(core_if)) { -+ return 0; -+ } -+ -+ /* Configure data FIFO sizes */ -+ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { -+ rx_fsz_bak = DWC_READ_REG32(&global_regs->grxfsiz); -+ rx_fifo_size = params->dev_rx_fifo_size; -+ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); -+ -+ /* -+ * Tx FIFOs These FIFOs are numbered from 1 to 15. -+ * Indexes of the FIFO size module parameters in the -+ * dev_tx_fifo_size array and the FIFO size registers in -+ * the dtxfsiz array run from 0 to 14. -+ */ -+ -+ /* Non-periodic Tx FIFO */ -+ nptxfsz_bak = DWC_READ_REG32(&global_regs->gnptxfsiz); -+ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; -+ start_address = params->dev_rx_fifo_size; -+ nptxfifosize.b.startaddr = start_address; -+ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); -+ -+ start_address += nptxfifosize.b.depth; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ txfsz_bak[i] = DWC_READ_REG32(&global_regs->dtxfsiz[i]); -+ -+ txfifosize[i].b.depth = params->dev_tx_fifo_size[i]; -+ txfifosize[i].b.startaddr = start_address; -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ txfifosize[i].d32); -+ -+ start_address += txfifosize[i].b.depth; -+ } -+ -+ /** Check if register values are set correctly */ -+ if (rx_fifo_size != DWC_READ_REG32(&global_regs->grxfsiz)) { -+ retval = 0; -+ } -+ -+ if (nptxfifosize.d32 != DWC_READ_REG32(&global_regs->gnptxfsiz)) { -+ retval = 0; -+ } -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ if (txfifosize[i].d32 != -+ DWC_READ_REG32(&global_regs->dtxfsiz[i])) { -+ retval = 0; -+ } -+ } -+ -+ /** If register values are not set correctly, reset old values */ -+ if (retval == 0) { -+ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fsz_bak); -+ -+ /* Non-periodic Tx FIFO */ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfsz_bak); -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ txfsz_bak[i]); -+ } -+ } -+ } else { -+ return 0; -+ } -+ -+ /* Flush the FIFOs */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ -+ dwc_otg_flush_rx_fifo(core_if); -+ -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the buffer Alignment setup. -+ */ -+static int cfi_ep_set_tx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) -+{ -+ int retval; -+ uint32_t fsiz; -+ uint16_t size; -+ uint16_t ep_addr; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; -+ tx_fifo_size_setup_t *ptxfifoval; -+ -+ ptxfifoval = (tx_fifo_size_setup_t *) buf; -+ ep_addr = ptxfifoval->bEndpointAddress; -+ size = ptxfifoval->wDepth; -+ -+ ep = get_ep_by_addr(pcd, ep_addr); -+ -+ CFI_INFO -+ ("%s: Set Tx FIFO size: endpoint addr=0x%02x, depth=%d, FIFO Num=%d\n", -+ __func__, ep_addr, size, ep->dwc_ep.tx_fifo_num); -+ -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, ep_addr); -+ return -DWC_E_INVALID; -+ } -+ -+ fsiz = params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1]; -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = size; -+ -+ if (resize_fifos(GET_CORE_IF(pcd))) { -+ retval = 0; -+ } else { -+ CFI_INFO -+ ("%s: Error setting the feature Tx FIFO Size for EP%d\n", -+ __func__, ep_addr); -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = fsiz; -+ retval = -DWC_E_INVALID; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the buffer Alignment setup. -+ */ -+static int cfi_set_rx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) -+{ -+ int retval; -+ uint32_t fsiz; -+ uint16_t size; -+ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; -+ rx_fifo_size_setup_t *prxfifoval; -+ -+ prxfifoval = (rx_fifo_size_setup_t *) buf; -+ size = prxfifoval->wDepth; -+ -+ fsiz = params->dev_rx_fifo_size; -+ params->dev_rx_fifo_size = size; -+ -+ if (resize_fifos(GET_CORE_IF(pcd))) { -+ retval = 0; -+ } else { -+ CFI_INFO("%s: Error setting the feature Rx FIFO Size\n", -+ __func__); -+ params->dev_rx_fifo_size = fsiz; -+ retval = -DWC_E_INVALID; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function reads the SG of an EP's buffer setup into the buffer buf -+ */ -+static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = -DWC_E_INVALID; -+ uint8_t addr; -+ cfi_ep_t *ep; -+ -+ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ -+ addr = req->wValue & 0xFF; -+ if (addr == 0) /* The address should be non-zero */ -+ return retval; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", -+ __func__, addr); -+ return retval; -+ } -+ -+ dwc_memcpy(buf, ep->bm_sg, BS_SG_VAL_DESC_LEN); -+ retval = BS_SG_VAL_DESC_LEN; -+ return retval; -+} -+ -+/** -+ * This function reads the Concatenation value of an EP's buffer mode into -+ * the buffer buf -+ */ -+static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = -DWC_E_INVALID; -+ uint8_t addr; -+ cfi_ep_t *ep; -+ uint8_t desc_count; -+ -+ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ -+ addr = req->wValue & 0xFF; -+ if (addr == 0) /* The address should be non-zero */ -+ return retval; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", -+ __func__, addr); -+ return retval; -+ } -+ -+ /* Copy the header to the buffer */ -+ dwc_memcpy(buf, ep->bm_concat, BS_CONCAT_VAL_HDR_LEN); -+ /* Advance the buffer pointer by the header size */ -+ buf += BS_CONCAT_VAL_HDR_LEN; -+ -+ desc_count = ep->bm_concat->hdr.bDescCount; -+ /* Copy alll the wTxBytes to the buffer */ -+ dwc_memcpy(buf, ep->bm_concat->wTxBytes, sizeof(uid16_t) * desc_count); -+ -+ retval = BS_CONCAT_VAL_HDR_LEN + sizeof(uid16_t) * desc_count; -+ return retval; -+} -+ -+/** -+ * This function reads the buffer Alignment value of an EP's buffer mode into -+ * the buffer buf -+ * -+ * @return The total number of bytes copied to the buffer or negative error code. -+ */ -+static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = -DWC_E_INVALID; -+ uint8_t addr; -+ cfi_ep_t *ep; -+ -+ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ -+ addr = req->wValue & 0xFF; -+ if (addr == 0) /* The address should be non-zero */ -+ return retval; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", -+ __func__, addr); -+ return retval; -+ } -+ -+ dwc_memcpy(buf, ep->bm_align, BS_ALIGN_VAL_HDR_LEN); -+ retval = BS_ALIGN_VAL_HDR_LEN; -+ -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the specified feature -+ * -+ * @param pcd A pointer to the PCD object -+ * -+ * @return 0 if successful, negative error code otherwise to stall the DCE. -+ */ -+static int cfi_set_feature_value(struct dwc_otg_pcd *pcd) -+{ -+ int retval = -DWC_E_NOT_SUPPORTED; -+ uint16_t wIndex, wValue; -+ uint8_t bRequest; -+ struct dwc_otg_core_if *coreif; -+ cfiobject_t *cfi = pcd->cfi; -+ struct cfi_usb_ctrlrequest *ctrl_req; -+ uint8_t *buf; -+ ctrl_req = &cfi->ctrl_req; -+ -+ buf = pcd->cfi->ctrl_req.data; -+ -+ coreif = GET_CORE_IF(pcd); -+ bRequest = ctrl_req->bRequest; -+ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); -+ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); -+ -+ /* See which feature is to be modified */ -+ switch (wIndex) { -+ case FT_ID_DMA_BUFFER_SETUP: -+ /* Modify the feature */ -+ if ((retval = cfi_ep_set_sg_val(buf, pcd)) < 0) -+ return retval; -+ -+ /* And send this request to the gadget */ -+ cfi->need_gadget_att = 1; -+ break; -+ -+ case FT_ID_DMA_BUFF_ALIGN: -+ if ((retval = cfi_ep_set_alignment_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 1; -+ break; -+ -+ case FT_ID_DMA_CONCAT_SETUP: -+ /* Modify the feature */ -+ if ((retval = cfi_ep_set_concat_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 1; -+ break; -+ -+ case FT_ID_DMA_CIRCULAR: -+ CFI_INFO("FT_ID_DMA_CIRCULAR\n"); -+ break; -+ -+ case FT_ID_THRESHOLD_SETUP: -+ CFI_INFO("FT_ID_THRESHOLD_SETUP\n"); -+ break; -+ -+ case FT_ID_DFIFO_DEPTH: -+ CFI_INFO("FT_ID_DFIFO_DEPTH\n"); -+ break; -+ -+ case FT_ID_TX_FIFO_DEPTH: -+ CFI_INFO("FT_ID_TX_FIFO_DEPTH\n"); -+ if ((retval = cfi_ep_set_tx_fifo_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 0; -+ break; -+ -+ case FT_ID_RX_FIFO_DEPTH: -+ CFI_INFO("FT_ID_RX_FIFO_DEPTH\n"); -+ if ((retval = cfi_set_rx_fifo_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 0; -+ break; -+ } -+ -+ return retval; -+} -+ -+#endif //DWC_UTE_CFI -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h -new file mode 100644 -index 0000000000000000000000000000000000000000..55fd337a283c39512eb1409dfc1183c56dfd7680 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h -@@ -0,0 +1,320 @@ -+/* ========================================================================== -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_OTG_CFI_H__) -+#define __DWC_OTG_CFI_H__ -+ -+#include "dwc_otg_pcd.h" -+#include "dwc_cfi_common.h" -+ -+/** -+ * @file -+ * This file contains the CFI related OTG PCD specific common constants, -+ * interfaces(functions and macros) and data structures.The CFI Protocol is an -+ * optional interface for internal testing purposes that a DUT may implement to -+ * support testing of configurable features. -+ * -+ */ -+ -+struct dwc_otg_pcd; -+struct dwc_otg_pcd_ep; -+ -+/** OTG CFI Features (properties) ID constants */ -+/** This is a request for all Core Features */ -+#define FT_ID_DMA_MODE 0x0001 -+#define FT_ID_DMA_BUFFER_SETUP 0x0002 -+#define FT_ID_DMA_BUFF_ALIGN 0x0003 -+#define FT_ID_DMA_CONCAT_SETUP 0x0004 -+#define FT_ID_DMA_CIRCULAR 0x0005 -+#define FT_ID_THRESHOLD_SETUP 0x0006 -+#define FT_ID_DFIFO_DEPTH 0x0007 -+#define FT_ID_TX_FIFO_DEPTH 0x0008 -+#define FT_ID_RX_FIFO_DEPTH 0x0009 -+ -+/**********************************************************/ -+#define CFI_INFO_DEF -+ -+#ifdef CFI_INFO_DEF -+#define CFI_INFO(fmt...) DWC_PRINTF("CFI: " fmt); -+#else -+#define CFI_INFO(fmt...) -+#endif -+ -+#define min(x,y) ({ \ -+ x < y ? x : y; }) -+ -+#define max(x,y) ({ \ -+ x > y ? x : y; }) -+ -+/** -+ * Descriptor DMA SG Buffer setup structure (SG buffer). This structure is -+ * also used for setting up a buffer for Circular DDMA. -+ */ -+struct _ddma_sg_buffer_setup { -+#define BS_SG_VAL_DESC_LEN 6 -+ /* The OUT EP address */ -+ uint8_t bOutEndpointAddress; -+ /* The IN EP address */ -+ uint8_t bInEndpointAddress; -+ /* Number of bytes to put between transfer segments (must be DWORD boundaries) */ -+ uint8_t bOffset; -+ /* The number of transfer segments (a DMA descriptors per each segment) */ -+ uint8_t bCount; -+ /* Size (in byte) of each transfer segment */ -+ uint16_t wSize; -+} __attribute__ ((packed)); -+typedef struct _ddma_sg_buffer_setup ddma_sg_buffer_setup_t; -+ -+/** Descriptor DMA Concatenation Buffer setup structure */ -+struct _ddma_concat_buffer_setup_hdr { -+#define BS_CONCAT_VAL_HDR_LEN 4 -+ /* The endpoint for which the buffer is to be set up */ -+ uint8_t bEndpointAddress; -+ /* The count of descriptors to be used */ -+ uint8_t bDescCount; -+ /* The total size of the transfer */ -+ uint16_t wSize; -+} __attribute__ ((packed)); -+typedef struct _ddma_concat_buffer_setup_hdr ddma_concat_buffer_setup_hdr_t; -+ -+/** Descriptor DMA Concatenation Buffer setup structure */ -+struct _ddma_concat_buffer_setup { -+ /* The SG header */ -+ ddma_concat_buffer_setup_hdr_t hdr; -+ -+ /* The XFER sizes pointer (allocated dynamically) */ -+ uint16_t *wTxBytes; -+} __attribute__ ((packed)); -+typedef struct _ddma_concat_buffer_setup ddma_concat_buffer_setup_t; -+ -+/** Descriptor DMA Alignment Buffer setup structure */ -+struct _ddma_align_buffer_setup { -+#define BS_ALIGN_VAL_HDR_LEN 2 -+ uint8_t bEndpointAddress; -+ uint8_t bAlign; -+} __attribute__ ((packed)); -+typedef struct _ddma_align_buffer_setup ddma_align_buffer_setup_t; -+ -+/** Transmit FIFO Size setup structure */ -+struct _tx_fifo_size_setup { -+ uint8_t bEndpointAddress; -+ uint16_t wDepth; -+} __attribute__ ((packed)); -+typedef struct _tx_fifo_size_setup tx_fifo_size_setup_t; -+ -+/** Transmit FIFO Size setup structure */ -+struct _rx_fifo_size_setup { -+ uint16_t wDepth; -+} __attribute__ ((packed)); -+typedef struct _rx_fifo_size_setup rx_fifo_size_setup_t; -+ -+/** -+ * struct cfi_usb_ctrlrequest - the CFI implementation of the struct usb_ctrlrequest -+ * This structure encapsulates the standard usb_ctrlrequest and adds a pointer -+ * to the data returned in the data stage of a 3-stage Control Write requests. -+ */ -+struct cfi_usb_ctrlrequest { -+ uint8_t bRequestType; -+ uint8_t bRequest; -+ uint16_t wValue; -+ uint16_t wIndex; -+ uint16_t wLength; -+ uint8_t *data; -+} UPACKED; -+ -+/*---------------------------------------------------------------------------*/ -+ -+/** -+ * The CFI wrapper of the enabled and activated dwc_otg_pcd_ep structures. -+ * This structure is used to store the buffer setup data for any -+ * enabled endpoint in the PCD. -+ */ -+struct cfi_ep { -+ /* Entry for the list container */ -+ dwc_list_link_t lh; -+ /* Pointer to the active PCD endpoint structure */ -+ struct dwc_otg_pcd_ep *ep; -+ /* The last descriptor in the chain of DMA descriptors of the endpoint */ -+ struct dwc_otg_dma_desc *dma_desc_last; -+ /* The SG feature value */ -+ ddma_sg_buffer_setup_t *bm_sg; -+ /* The Circular feature value */ -+ ddma_sg_buffer_setup_t *bm_circ; -+ /* The Concatenation feature value */ -+ ddma_concat_buffer_setup_t *bm_concat; -+ /* The Alignment feature value */ -+ ddma_align_buffer_setup_t *bm_align; -+ /* XFER length */ -+ uint32_t xfer_len; -+ /* -+ * Count of DMA descriptors currently used. -+ * The total should not exceed the MAX_DMA_DESCS_PER_EP value -+ * defined in the dwc_otg_cil.h -+ */ -+ uint32_t desc_count; -+}; -+typedef struct cfi_ep cfi_ep_t; -+ -+typedef struct cfi_dma_buff { -+#define CFI_IN_BUF_LEN 1024 -+#define CFI_OUT_BUF_LEN 1024 -+ dma_addr_t addr; -+ uint8_t *buf; -+} cfi_dma_buff_t; -+ -+struct cfiobject; -+ -+/** -+ * This is the interface for the CFI operations. -+ * -+ * @param ep_enable Called when any endpoint is enabled and activated. -+ * @param release Called when the CFI object is released and it needs to correctly -+ * deallocate the dynamic memory -+ * @param ctrl_write_complete Called when the data stage of the request is complete -+ */ -+typedef struct cfi_ops { -+ int (*ep_enable) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, -+ struct dwc_otg_pcd_ep * ep); -+ void *(*ep_alloc_buf) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, -+ struct dwc_otg_pcd_ep * ep, dma_addr_t * dma, -+ unsigned size, gfp_t flags); -+ void (*release) (struct cfiobject * cfi); -+ int (*ctrl_write_complete) (struct cfiobject * cfi, -+ struct dwc_otg_pcd * pcd); -+ void (*build_descriptors) (struct cfiobject * cfi, -+ struct dwc_otg_pcd * pcd, -+ struct dwc_otg_pcd_ep * ep, -+ dwc_otg_pcd_request_t * req); -+} cfi_ops_t; -+ -+struct cfiobject { -+ cfi_ops_t ops; -+ struct dwc_otg_pcd *pcd; -+ struct usb_gadget *gadget; -+ -+ /* Buffers used to send/receive CFI-related request data */ -+ cfi_dma_buff_t buf_in; -+ cfi_dma_buff_t buf_out; -+ -+ /* CFI specific Control request wrapper */ -+ struct cfi_usb_ctrlrequest ctrl_req; -+ -+ /* The list of active EP's in the PCD of type cfi_ep_t */ -+ dwc_list_link_t active_eps; -+ -+ /* This flag shall control the propagation of a specific request -+ * to the gadget's processing routines. -+ * 0 - no gadget handling -+ * 1 - the gadget needs to know about this request (w/o completing a status -+ * phase - just return a 0 to the _setup callback) -+ */ -+ uint8_t need_gadget_att; -+ -+ /* Flag indicating whether the status IN phase needs to be -+ * completed by the PCD -+ */ -+ uint8_t need_status_in_complete; -+}; -+typedef struct cfiobject cfiobject_t; -+ -+#define DUMP_MSG -+ -+#if defined(DUMP_MSG) -+static inline void dump_msg(const u8 * buf, unsigned int length) -+{ -+ unsigned int start, num, i; -+ char line[52], *p; -+ -+ if (length >= 512) -+ return; -+ -+ start = 0; -+ while (length > 0) { -+ num = min(length, 16u); -+ p = line; -+ for (i = 0; i < num; ++i) { -+ if (i == 8) -+ *p++ = ' '; -+ DWC_SPRINTF(p, " %02x", buf[i]); -+ p += 3; -+ } -+ *p = 0; -+ DWC_DEBUG("%6x: %s\n", start, line); -+ buf += num; -+ start += num; -+ length -= num; -+ } -+} -+#else -+static inline void dump_msg(const u8 * buf, unsigned int length) -+{ -+} -+#endif -+ -+/** -+ * This function returns a pointer to cfi_ep_t object with the addr address. -+ */ -+static inline struct cfi_ep *get_cfi_ep_by_addr(struct cfiobject *cfi, -+ uint8_t addr) -+{ -+ struct cfi_ep *pcfiep; -+ dwc_list_link_t *tmp; -+ -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ -+ if (pcfiep->ep->desc->bEndpointAddress == addr) { -+ return pcfiep; -+ } -+ } -+ -+ return NULL; -+} -+ -+/** -+ * This function returns a pointer to cfi_ep_t object that matches -+ * the dwc_otg_pcd_ep object. -+ */ -+static inline struct cfi_ep *get_cfi_ep_by_pcd_ep(struct cfiobject *cfi, -+ struct dwc_otg_pcd_ep *ep) -+{ -+ struct cfi_ep *pcfiep = NULL; -+ dwc_list_link_t *tmp; -+ -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ if (pcfiep->ep == ep) { -+ return pcfiep; -+ } -+ } -+ return NULL; -+} -+ -+int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl); -+ -+#endif /* (__DWC_OTG_CFI_H__) */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c -new file mode 100644 -index 0000000000000000000000000000000000000000..38abd0b1f0341b50a2d7ad7493e2d09b6b8a55a9 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c -@@ -0,0 +1,7141 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ -+ * $Revision: #191 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * The Core Interface Layer provides basic services for accessing and -+ * managing the DWC_otg hardware. These services are used by both the -+ * Host Controller Driver and the Peripheral Controller Driver. -+ * -+ * The CIL manages the memory map for the core so that the HCD and PCD -+ * don't have to do this separately. It also handles basic tasks like -+ * reading/writing the registers and data FIFOs in the controller. -+ * Some of the data access functions provide encapsulation of several -+ * operations required to perform a task, such as writing multiple -+ * registers to start a transfer. Finally, the CIL performs basic -+ * services that are not specific to either the host or device modes -+ * of operation. These services include management of the OTG Host -+ * Negotiation Protocol (HNP) and Session Request Protocol (SRP). A -+ * Diagnostic API is also provided to allow testing of the controller -+ * hardware. -+ * -+ * The Core Interface Layer has the following requirements: -+ * - Provides basic controller operations. -+ * - Minimal use of OS services. -+ * - The OS services used will be abstracted by using inline functions -+ * or macros. -+ * -+ */ -+ -+#include "dwc_os.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+ -+static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if); -+ -+/** -+ * This function is called to initialize the DWC_otg CSR data -+ * structures. The register addresses in the device and host -+ * structures are initialized from the base address supplied by the -+ * caller. The calling function must make the OS calls to get the -+ * base address of the DWC_otg controller registers. The core_params -+ * argument holds the parameters that specify how the core should be -+ * configured. -+ * -+ * @param reg_base_addr Base address of DWC_otg core registers -+ * -+ */ -+dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * reg_base_addr) -+{ -+ dwc_otg_core_if_t *core_if = 0; -+ dwc_otg_dev_if_t *dev_if = 0; -+ dwc_otg_host_if_t *host_if = 0; -+ uint8_t *reg_base = (uint8_t *) reg_base_addr; -+ int i = 0; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, reg_base_addr); -+ -+ core_if = DWC_ALLOC(sizeof(dwc_otg_core_if_t)); -+ -+ if (core_if == NULL) { -+ DWC_DEBUGPL(DBG_CIL, -+ "Allocation of dwc_otg_core_if_t failed\n"); -+ return 0; -+ } -+ core_if->core_global_regs = (dwc_otg_core_global_regs_t *) reg_base; -+ -+ /* -+ * Allocate the Device Mode structures. -+ */ -+ dev_if = DWC_ALLOC(sizeof(dwc_otg_dev_if_t)); -+ -+ if (dev_if == NULL) { -+ DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_dev_if_t failed\n"); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ dev_if->dev_global_regs = -+ (dwc_otg_device_global_regs_t *) (reg_base + -+ DWC_DEV_GLOBAL_REG_OFFSET); -+ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ dev_if->in_ep_regs[i] = (dwc_otg_dev_in_ep_regs_t *) -+ (reg_base + DWC_DEV_IN_EP_REG_OFFSET + -+ (i * DWC_EP_REG_OFFSET)); -+ -+ dev_if->out_ep_regs[i] = (dwc_otg_dev_out_ep_regs_t *) -+ (reg_base + DWC_DEV_OUT_EP_REG_OFFSET + -+ (i * DWC_EP_REG_OFFSET)); -+ DWC_DEBUGPL(DBG_CILV, "in_ep_regs[%d]->diepctl=%p\n", -+ i, &dev_if->in_ep_regs[i]->diepctl); -+ DWC_DEBUGPL(DBG_CILV, "out_ep_regs[%d]->doepctl=%p\n", -+ i, &dev_if->out_ep_regs[i]->doepctl); -+ } -+ -+ dev_if->speed = 0; // unknown -+ -+ core_if->dev_if = dev_if; -+ -+ /* -+ * Allocate the Host Mode structures. -+ */ -+ host_if = DWC_ALLOC(sizeof(dwc_otg_host_if_t)); -+ -+ if (host_if == NULL) { -+ DWC_DEBUGPL(DBG_CIL, -+ "Allocation of dwc_otg_host_if_t failed\n"); -+ DWC_FREE(dev_if); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ host_if->host_global_regs = (dwc_otg_host_global_regs_t *) -+ (reg_base + DWC_OTG_HOST_GLOBAL_REG_OFFSET); -+ -+ host_if->hprt0 = -+ (uint32_t *) (reg_base + DWC_OTG_HOST_PORT_REGS_OFFSET); -+ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ host_if->hc_regs[i] = (dwc_otg_hc_regs_t *) -+ (reg_base + DWC_OTG_HOST_CHAN_REGS_OFFSET + -+ (i * DWC_OTG_CHAN_REGS_OFFSET)); -+ DWC_DEBUGPL(DBG_CILV, "hc_reg[%d]->hcchar=%p\n", -+ i, &host_if->hc_regs[i]->hcchar); -+ } -+ -+ host_if->num_host_channels = MAX_EPS_CHANNELS; -+ core_if->host_if = host_if; -+ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ core_if->data_fifo[i] = -+ (uint32_t *) (reg_base + DWC_OTG_DATA_FIFO_OFFSET + -+ (i * DWC_OTG_DATA_FIFO_SIZE)); -+ DWC_DEBUGPL(DBG_CILV, "data_fifo[%d]=0x%08lx\n", -+ i, (unsigned long)core_if->data_fifo[i]); -+ } -+ -+ core_if->pcgcctl = (uint32_t *) (reg_base + DWC_OTG_PCGCCTL_OFFSET); -+ -+ /* Initiate lx_state to L3 disconnected state */ -+ core_if->lx_state = DWC_OTG_L3; -+ /* -+ * Store the contents of the hardware configuration registers here for -+ * easy access later. -+ */ -+ core_if->hwcfg1.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg1); -+ core_if->hwcfg2.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); -+ core_if->hwcfg3.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg3); -+ core_if->hwcfg4.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); -+ -+ /* Force host mode to get HPTXFSIZ exact power on value */ -+ { -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ gusbcfg.b.force_host_mode = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); -+ dwc_mdelay(100); -+ core_if->hptxfsiz.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); -+ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ gusbcfg.b.force_host_mode = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); -+ dwc_mdelay(100); -+ } -+ -+ DWC_DEBUGPL(DBG_CILV, "hwcfg1=%08x\n", core_if->hwcfg1.d32); -+ DWC_DEBUGPL(DBG_CILV, "hwcfg2=%08x\n", core_if->hwcfg2.d32); -+ DWC_DEBUGPL(DBG_CILV, "hwcfg3=%08x\n", core_if->hwcfg3.d32); -+ DWC_DEBUGPL(DBG_CILV, "hwcfg4=%08x\n", core_if->hwcfg4.d32); -+ -+ core_if->hcfg.d32 = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ core_if->dcfg.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ -+ DWC_DEBUGPL(DBG_CILV, "hcfg=%08x\n", core_if->hcfg.d32); -+ DWC_DEBUGPL(DBG_CILV, "dcfg=%08x\n", core_if->dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_CILV, "op_mode=%0x\n", core_if->hwcfg2.b.op_mode); -+ DWC_DEBUGPL(DBG_CILV, "arch=%0x\n", core_if->hwcfg2.b.architecture); -+ DWC_DEBUGPL(DBG_CILV, "num_dev_ep=%d\n", core_if->hwcfg2.b.num_dev_ep); -+ DWC_DEBUGPL(DBG_CILV, "num_host_chan=%d\n", -+ core_if->hwcfg2.b.num_host_chan); -+ DWC_DEBUGPL(DBG_CILV, "nonperio_tx_q_depth=0x%0x\n", -+ core_if->hwcfg2.b.nonperio_tx_q_depth); -+ DWC_DEBUGPL(DBG_CILV, "host_perio_tx_q_depth=0x%0x\n", -+ core_if->hwcfg2.b.host_perio_tx_q_depth); -+ DWC_DEBUGPL(DBG_CILV, "dev_token_q_depth=0x%0x\n", -+ core_if->hwcfg2.b.dev_token_q_depth); -+ -+ DWC_DEBUGPL(DBG_CILV, "Total FIFO SZ=%d\n", -+ core_if->hwcfg3.b.dfifo_depth); -+ DWC_DEBUGPL(DBG_CILV, "xfer_size_cntr_width=%0x\n", -+ core_if->hwcfg3.b.xfer_size_cntr_width); -+ -+ /* -+ * Set the SRP sucess bit for FS-I2c -+ */ -+ core_if->srp_success = 0; -+ core_if->srp_timer_started = 0; -+ -+ /* -+ * Create new workqueue and init works -+ */ -+ core_if->wq_otg = DWC_WORKQ_ALLOC("dwc_otg"); -+ if (core_if->wq_otg == 0) { -+ DWC_WARN("DWC_WORKQ_ALLOC failed\n"); -+ DWC_FREE(host_if); -+ DWC_FREE(dev_if); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ core_if->snpsid = DWC_READ_REG32(&core_if->core_global_regs->gsnpsid); -+ -+ DWC_PRINTF("Core Release: %x.%x%x%x\n", -+ (core_if->snpsid >> 12 & 0xF), -+ (core_if->snpsid >> 8 & 0xF), -+ (core_if->snpsid >> 4 & 0xF), (core_if->snpsid & 0xF)); -+ -+ core_if->wkp_timer = DWC_TIMER_ALLOC("Wake Up Timer", -+ w_wakeup_detected, core_if); -+ if (core_if->wkp_timer == 0) { -+ DWC_WARN("DWC_TIMER_ALLOC failed\n"); -+ DWC_FREE(host_if); -+ DWC_FREE(dev_if); -+ DWC_WORKQ_FREE(core_if->wq_otg); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ if (dwc_otg_setup_params(core_if)) { -+ DWC_WARN("Error while setting core params\n"); -+ } -+ -+ core_if->hibernation_suspend = 0; -+ -+ /** ADP initialization */ -+ dwc_otg_adp_init(core_if); -+ -+ return core_if; -+} -+ -+/** -+ * This function frees the structures allocated by dwc_otg_cil_init(). -+ * -+ * @param core_if The core interface pointer returned from -+ * dwc_otg_cil_init(). -+ * -+ */ -+void dwc_otg_cil_remove(dwc_otg_core_if_t * core_if) -+{ -+ dctl_data_t dctl = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); -+ -+ /* Disable all interrupts */ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 1, 0); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); -+ -+ dctl.b.sftdiscon = 1; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, -+ dctl.d32); -+ } -+ -+ if (core_if->wq_otg) { -+ DWC_WORKQ_WAIT_WORK_DONE(core_if->wq_otg, 500); -+ DWC_WORKQ_FREE(core_if->wq_otg); -+ } -+ if (core_if->dev_if) { -+ DWC_FREE(core_if->dev_if); -+ } -+ if (core_if->host_if) { -+ DWC_FREE(core_if->host_if); -+ } -+ -+ /** Remove ADP Stuff */ -+ dwc_otg_adp_remove(core_if); -+ if (core_if->core_params) { -+ DWC_FREE(core_if->core_params); -+ } -+ if (core_if->wkp_timer) { -+ DWC_TIMER_FREE(core_if->wkp_timer); -+ } -+ if (core_if->srp_timer) { -+ DWC_TIMER_FREE(core_if->srp_timer); -+ } -+ DWC_FREE(core_if); -+} -+ -+/** -+ * This function enables the controller's Global Interrupt in the AHB Config -+ * register. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 0, ahbcfg.d32); -+} -+ -+/** -+ * This function disables the controller's Global Interrupt in the AHB Config -+ * register. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ ahbcfg.b.glblintrmsk = 1; /* Disable interrupts */ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); -+} -+ -+/** -+ * This function initializes the commmon interrupts, used in both -+ * device and host modes. -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ * -+ */ -+static void dwc_otg_enable_common_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ /* Clear any pending OTG Interrupts */ -+ DWC_WRITE_REG32(&global_regs->gotgint, 0xFFFFFFFF); -+ -+ /* Clear any pending interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* -+ * Enable the interrupts in the GINTMSK. -+ */ -+ intr_mask.b.modemismatch = 1; -+ intr_mask.b.otgintr = 1; -+ -+ if (!core_if->dma_enable) { -+ intr_mask.b.rxstsqlvl = 1; -+ } -+ -+ intr_mask.b.conidstschng = 1; -+ intr_mask.b.wkupintr = 1; -+ intr_mask.b.disconnect = 0; -+ intr_mask.b.usbsuspend = 1; -+ intr_mask.b.sessreqintr = 1; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (core_if->core_params->lpm_enable) { -+ intr_mask.b.lpmtranrcvd = 1; -+ } -+#endif -+ DWC_WRITE_REG32(&global_regs->gintmsk, intr_mask.d32); -+} -+ -+/* -+ * The restore operation is modified to support Synopsys Emulated Powerdown and -+ * Hibernation. This function is for exiting from Device mode hibernation by -+ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. -+ * @param core_if Programming view of DWC_otg controller. -+ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. -+ * @param reset - indicates whether resume is initiated by Reset. -+ */ -+int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ -+ int timeout = 2000; -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "%s called\n", __FUNCTION__); -+ /* Switch-on voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Assert Restore signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ if (rem_wakeup) { -+ dwc_udelay(70); -+ } -+ -+ /* Deassert Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Mask interrupts from gpwrdn */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.connect_det_msk = 1; -+ gpwrdn.b.srp_det_msk = 1; -+ gpwrdn.b.disconn_det_msk = 1; -+ gpwrdn.b.rst_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Indicates that we are going out from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* -+ * Set Restore Essential Regs bit in PCGCCTL register, restore_mode = 1 -+ * indicates restore from remote_wakeup -+ */ -+ restore_essential_regs(core_if, rem_wakeup, 0); -+ -+ /* -+ * Wait a little for seeing new value of variable hibernation_suspend if -+ * Restore done interrupt received before polling -+ */ -+ dwc_udelay(10); -+ -+ if (core_if->hibernation_suspend == 0) { -+ /* -+ * Wait For Restore_done Interrupt. This mechanism of polling the -+ * interrupt is introduced to avoid any possible race conditions -+ */ -+ do { -+ gintsts_data_t gintsts; -+ gintsts.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (gintsts.b.restoredone) { -+ gintsts.d32 = 0; -+ gintsts.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, gintsts.d32); -+ DWC_PRINTF("Restore Done Interrupt seen\n"); -+ break; -+ } -+ dwc_udelay(10); -+ } while (--timeout); -+ if (!timeout) { -+ DWC_PRINTF("Restore Done interrupt wasn't generated here\n"); -+ } -+ } -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* De-assert Restore */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ if (!rem_wakeup) { -+ pcgcctl.d32 = 0; -+ pcgcctl.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ } -+ -+ /* Restore GUSBCFG and DCFG */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, -+ core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, -+ core_if->dr_backup->dcfg); -+ -+ /* De-assert Wakeup Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ if (!rem_wakeup) { -+ /* Set Device programming done bit */ -+ dctl.b.pwronprgdone = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } else { -+ /* Start Remote Wakeup Signaling */ -+ dctl.d32 = core_if->dr_backup->dctl; -+ dctl.b.rmtwkupsig = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+ } -+ -+ dwc_mdelay(2); -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Restore global registers */ -+ dwc_otg_restore_global_regs(core_if); -+ /* Restore device global registers */ -+ dwc_otg_restore_dev_regs(core_if, rem_wakeup); -+ -+ if (rem_wakeup) { -+ dwc_mdelay(7); -+ dctl.d32 = 0; -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); -+ } -+ -+ core_if->hibernation_suspend = 0; -+ /* The core will be in ON STATE */ -+ core_if->lx_state = DWC_OTG_L0; -+ DWC_PRINTF("Hibernation recovery completes here\n"); -+ -+ return 1; -+} -+ -+/* -+ * The restore operation is modified to support Synopsys Emulated Powerdown and -+ * Hibernation. This function is for exiting from Host mode hibernation by -+ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. -+ * @param core_if Programming view of DWC_otg controller. -+ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. -+ * @param reset - indicates whether resume is initiated by Reset. -+ */ -+int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ -+ int timeout = 2000; -+ -+ DWC_DEBUGPL(DBG_HCD, "%s called\n", __FUNCTION__); -+ /* Switch-on voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Assert Restore signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ if (!rem_wakeup) { -+ dwc_udelay(50); -+ } -+ -+ /* Deassert Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.connect_det_msk = 1; -+ gpwrdn.b.srp_det_msk = 1; -+ gpwrdn.b.disconn_det_msk = 1; -+ gpwrdn.b.rst_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Indicates that we are going out from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Set Restore Essential Regs bit in PCGCCTL register */ -+ restore_essential_regs(core_if, rem_wakeup, 1); -+ -+ /* Wait a little for seeing new value of variable hibernation_suspend if -+ * Restore done interrupt received before polling */ -+ dwc_udelay(10); -+ -+ if (core_if->hibernation_suspend == 0) { -+ /* Wait For Restore_done Interrupt. This mechanism of polling the -+ * interrupt is introduced to avoid any possible race conditions -+ */ -+ do { -+ gintsts_data_t gintsts; -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (gintsts.b.restoredone) { -+ gintsts.d32 = 0; -+ gintsts.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ DWC_DEBUGPL(DBG_HCD,"Restore Done Interrupt seen\n"); -+ break; -+ } -+ dwc_udelay(10); -+ } while (--timeout); -+ if (!timeout) { -+ DWC_WARN("Restore Done interrupt wasn't generated\n"); -+ } -+ } -+ -+ /* Set the flag's value to 0 again after receiving restore done interrupt */ -+ core_if->hibernation_suspend = 0; -+ -+ /* This step is not described in functional spec but if not wait for this -+ * delay, mismatch interrupts occurred because just after restore core is -+ * in Device mode(gintsts.curmode == 0) */ -+ dwc_mdelay(100); -+ -+ /* Clear all pending interrupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* De-assert Restore */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Restore GUSBCFG and HCFG */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, -+ core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, -+ core_if->hr_backup->hcfg_local); -+ -+ /* De-assert Wakeup Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Start the Resume operation by programming HPRT0 */ -+ hprt0.d32 = core_if->hr_backup->hprt0_local; -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtena = 0; -+ hprt0.b.prtsusp = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ DWC_PRINTF("Resume Starts Now\n"); -+ if (!reset) { // Indicates it is Resume Operation -+ hprt0.d32 = core_if->hr_backup->hprt0_local; -+ hprt0.b.prtres = 1; -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtena = 0; -+ hprt0.b.prtsusp = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ if (!rem_wakeup) -+ hprt0.b.prtres = 0; -+ /* Wait for Resume time and then program HPRT again */ -+ dwc_mdelay(100); -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ } else { // Indicates it is Reset Operation -+ hprt0.d32 = core_if->hr_backup->hprt0_local; -+ hprt0.b.prtrst = 1; -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtena = 0; -+ hprt0.b.prtsusp = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ /* Wait for Reset time and then program HPRT again */ -+ dwc_mdelay(60); -+ hprt0.b.prtrst = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ /* Clear all interrupt status */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtconndet = 1; -+ hprt0.b.prtenchng = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Restore global registers */ -+ dwc_otg_restore_global_regs(core_if); -+ /* Restore host global registers */ -+ dwc_otg_restore_host_regs(core_if, reset); -+ -+ /* The core will be in ON STATE */ -+ core_if->lx_state = DWC_OTG_L0; -+ DWC_PRINTF("Hibernation recovery is complete here\n"); -+ return 0; -+} -+ -+/** Saves some register values into system memory. */ -+int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ int i; -+ -+ gr = core_if->gr_backup; -+ if (!gr) { -+ gr = DWC_ALLOC(sizeof(*gr)); -+ if (!gr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->gr_backup = gr; -+ } -+ -+ gr->gotgctl_local = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ gr->gahbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); -+ gr->gusbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ gr->grxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ gr->gnptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); -+ gr->hptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ gr->glpmcfg_local = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+#endif -+ gr->gi2cctl_local = DWC_READ_REG32(&core_if->core_global_regs->gi2cctl); -+ gr->pcgcctl_local = DWC_READ_REG32(core_if->pcgcctl); -+ gr->gdfifocfg_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gdfifocfg); -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ gr->dtxfsiz_local[i] = -+ DWC_READ_REG32(&(core_if->core_global_regs->dtxfsiz[i])); -+ } -+ -+ DWC_DEBUGPL(DBG_ANY, "===========Backing Global registers==========\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gotgctl = %08x\n", gr->gotgctl_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gahbcfg = %08x\n", gr->gahbcfg_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gusbcfg = %08x\n", gr->gusbcfg_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up grxfsiz = %08x\n", gr->grxfsiz_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gnptxfsiz = %08x\n", -+ gr->gnptxfsiz_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up hptxfsiz = %08x\n", -+ gr->hptxfsiz_local); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ DWC_DEBUGPL(DBG_ANY, "Backed up glpmcfg = %08x\n", gr->glpmcfg_local); -+#endif -+ DWC_DEBUGPL(DBG_ANY, "Backed up gi2cctl = %08x\n", gr->gi2cctl_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up pcgcctl = %08x\n", gr->pcgcctl_local); -+ DWC_DEBUGPL(DBG_ANY,"Backed up gdfifocfg = %08x\n",gr->gdfifocfg_local); -+ -+ return 0; -+} -+ -+/** Saves GINTMSK register before setting the msk bits. */ -+int dwc_otg_save_gintmsk_reg(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ -+ gr = core_if->gr_backup; -+ if (!gr) { -+ gr = DWC_ALLOC(sizeof(*gr)); -+ if (!gr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->gr_backup = gr; -+ } -+ -+ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ -+ DWC_DEBUGPL(DBG_ANY,"=============Backing GINTMSK registers============\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); -+ -+ return 0; -+} -+ -+int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_dev_regs_backup *dr; -+ int i; -+ -+ dr = core_if->dr_backup; -+ if (!dr) { -+ dr = DWC_ALLOC(sizeof(*dr)); -+ if (!dr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->dr_backup = dr; -+ } -+ -+ dr->dcfg = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dr->dctl = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ dr->daintmsk = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); -+ dr->diepmsk = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->diepmsk); -+ dr->doepmsk = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->doepmsk); -+ -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ dr->diepctl[i] = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); -+ dr->dieptsiz[i] = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz); -+ dr->diepdma[i] = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma); -+ } -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "=============Backing Host registers==============\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up dcfg = %08x\n", dr->dcfg); -+ DWC_DEBUGPL(DBG_ANY, "Backed up dctl = %08x\n", dr->dctl); -+ DWC_DEBUGPL(DBG_ANY, "Backed up daintmsk = %08x\n", -+ dr->daintmsk); -+ DWC_DEBUGPL(DBG_ANY, "Backed up diepmsk = %08x\n", dr->diepmsk); -+ DWC_DEBUGPL(DBG_ANY, "Backed up doepmsk = %08x\n", dr->doepmsk); -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_DEBUGPL(DBG_ANY, "Backed up diepctl[%d] = %08x\n", i, -+ dr->diepctl[i]); -+ DWC_DEBUGPL(DBG_ANY, "Backed up dieptsiz[%d] = %08x\n", -+ i, dr->dieptsiz[i]); -+ DWC_DEBUGPL(DBG_ANY, "Backed up diepdma[%d] = %08x\n", i, -+ dr->diepdma[i]); -+ } -+ -+ return 0; -+} -+ -+int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_host_regs_backup *hr; -+ int i; -+ -+ hr = core_if->hr_backup; -+ if (!hr) { -+ hr = DWC_ALLOC(sizeof(*hr)); -+ if (!hr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->hr_backup = hr; -+ } -+ -+ hr->hcfg_local = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ hr->haintmsk_local = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); -+ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { -+ hr->hcintmsk_local[i] = -+ DWC_READ_REG32(&core_if->host_if->hc_regs[i]->hcintmsk); -+ } -+ hr->hprt0_local = DWC_READ_REG32(core_if->host_if->hprt0); -+ hr->hfir_local = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "=============Backing Host registers===============\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up hcfg = %08x\n", -+ hr->hcfg_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up haintmsk = %08x\n", hr->haintmsk_local); -+ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { -+ DWC_DEBUGPL(DBG_ANY, "Backed up hcintmsk[%02d]=%08x\n", i, -+ hr->hcintmsk_local[i]); -+ } -+ DWC_DEBUGPL(DBG_ANY, "Backed up hprt0 = %08x\n", -+ hr->hprt0_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up hfir = %08x\n", -+ hr->hfir_local); -+ -+ return 0; -+} -+ -+int dwc_otg_restore_global_regs(dwc_otg_core_if_t *core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ int i; -+ -+ gr = core_if->gr_backup; -+ if (!gr) { -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, gr->gotgctl_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gr->gintmsk_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gr->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gr->gahbcfg_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, gr->grxfsiz_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, -+ gr->gnptxfsiz_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->hptxfsiz, -+ gr->hptxfsiz_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gdfifocfg, -+ gr->gdfifocfg_local); -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ DWC_WRITE_REG32(&core_if->core_global_regs->dtxfsiz[i], -+ gr->dtxfsiz_local[i]); -+ } -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ DWC_WRITE_REG32(core_if->host_if->hprt0, 0x0000100A); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, -+ (gr->gahbcfg_local)); -+ return 0; -+} -+ -+int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, int rem_wakeup) -+{ -+ struct dwc_otg_dev_regs_backup *dr; -+ int i; -+ -+ dr = core_if->dr_backup; -+ -+ if (!dr) { -+ return -DWC_E_INVALID; -+ } -+ -+ if (!rem_wakeup) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ dr->dctl); -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, dr->daintmsk); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, dr->diepmsk); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, dr->doepmsk); -+ -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz, dr->dieptsiz[i]); -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma, dr->diepdma[i]); -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl, dr->diepctl[i]); -+ } -+ -+ return 0; -+} -+ -+int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset) -+{ -+ struct dwc_otg_host_regs_backup *hr; -+ int i; -+ hr = core_if->hr_backup; -+ -+ if (!hr) { -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hr->hcfg_local); -+ //if (!reset) -+ //{ -+ // DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hr->hfir_local); -+ //} -+ -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, -+ hr->haintmsk_local); -+ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, -+ hr->hcintmsk_local[i]); -+ } -+ -+ return 0; -+} -+ -+int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ -+ gr = core_if->gr_backup; -+ -+ /* Restore values for LPM and I2C */ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, gr->glpmcfg_local); -+#endif -+ DWC_WRITE_REG32(&core_if->core_global_regs->gi2cctl, gr->gi2cctl_local); -+ -+ return 0; -+} -+ -+int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, int is_host) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gahbcfg_data_t gahbcfg = {.d32 = 0 }; -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ /* Restore LPM and I2C registers */ -+ restore_lpm_i2c_regs(core_if); -+ -+ /* Set PCGCCTL to 0 */ -+ DWC_WRITE_REG32(core_if->pcgcctl, 0x00000000); -+ -+ gr = core_if->gr_backup; -+ /* Load restore values for [31:14] bits */ -+ DWC_WRITE_REG32(core_if->pcgcctl, -+ ((gr->pcgcctl_local & 0xffffc000) | 0x00020000)); -+ -+ /* Umnask global Interrupt in GAHBCFG and restore it */ -+ gahbcfg.d32 = gr->gahbcfg_local; -+ gahbcfg.b.glblintrmsk = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); -+ -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Unmask restore done interrupt */ -+ gintmsk.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); -+ -+ /* Restore GUSBCFG and HCFG/DCFG */ -+ gusbcfg.d32 = core_if->gr_backup->gusbcfg_local; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); -+ -+ if (is_host) { -+ hcfg_data_t hcfg = {.d32 = 0 }; -+ hcfg.d32 = core_if->hr_backup->hcfg_local; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, -+ hcfg.d32); -+ -+ /* Load restore values for [31:14] bits */ -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; -+ -+ if (rmode) -+ pcgcctl.b.restoremode = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ /* Load restore values for [31:14] bits and set EssRegRestored bit */ -+ pcgcctl.d32 = gr->pcgcctl_local | 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.b.ess_reg_restored = 1; -+ if (rmode) -+ pcgcctl.b.restoremode = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ } else { -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ dcfg.d32 = core_if->dr_backup->dcfg; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ /* Load restore values for [31:14] bits */ -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; -+ if (!rmode) { -+ pcgcctl.d32 |= 0x208; -+ } -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ /* Load restore values for [31:14] bits */ -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; -+ pcgcctl.b.ess_reg_restored = 1; -+ if (!rmode) -+ pcgcctl.d32 |= 0x208; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ } -+ -+ return 0; -+} -+ -+/** -+ * Initializes the FSLSPClkSel field of the HCFG register depending on the PHY -+ * type. -+ */ -+static void init_fslspclksel(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t val; -+ hcfg_data_t hcfg; -+ -+ if (((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls)) || -+ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { -+ /* Full speed PHY */ -+ val = DWC_HCFG_48_MHZ; -+ } else { -+ /* High speed PHY running at full speed or high speed */ -+ val = DWC_HCFG_30_60_MHZ; -+ } -+ -+ DWC_DEBUGPL(DBG_CIL, "Initializing HCFG.FSLSPClkSel to 0x%1x\n", val); -+ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ hcfg.b.fslspclksel = val; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+} -+ -+/** -+ * Initializes the DevSpd field of the DCFG register depending on the PHY type -+ * and the enumeration speed of the device. -+ */ -+static void init_devspd(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t val; -+ dcfg_data_t dcfg; -+ -+ if (((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls)) || -+ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { -+ /* Full speed PHY */ -+ val = 0x3; -+ } else if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { -+ /* High speed PHY running at full speed */ -+ val = 0x1; -+ } else { -+ /* High speed PHY running at high speed */ -+ val = 0x0; -+ } -+ -+ DWC_DEBUGPL(DBG_CIL, "Initializing DCFG.DevSpd to 0x%1x\n", val); -+ -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.b.devspd = val; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); -+} -+ -+/** -+ * This function calculates the number of IN EPS -+ * using GHWCFG1 and GHWCFG2 registers values -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ */ -+static uint32_t calc_num_in_eps(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t num_in_eps = 0; -+ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; -+ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; -+ uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; -+ int i; -+ -+ for (i = 0; i < num_eps; ++i) { -+ if (!(hwcfg1 & 0x1)) -+ num_in_eps++; -+ -+ hwcfg1 >>= 2; -+ } -+ -+ if (core_if->hwcfg4.b.ded_fifo_en) { -+ num_in_eps = -+ (num_in_eps > num_tx_fifos) ? num_tx_fifos : num_in_eps; -+ } -+ -+ return num_in_eps; -+} -+ -+/** -+ * This function calculates the number of OUT EPS -+ * using GHWCFG1 and GHWCFG2 registers values -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ */ -+static uint32_t calc_num_out_eps(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t num_out_eps = 0; -+ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; -+ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 2; -+ int i; -+ -+ for (i = 0; i < num_eps; ++i) { -+ if (!(hwcfg1 & 0x1)) -+ num_out_eps++; -+ -+ hwcfg1 >>= 2; -+ } -+ return num_out_eps; -+} -+ -+/** -+ * This function initializes the DWC_otg controller registers and -+ * prepares the core for device mode or host mode operation. -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ * -+ */ -+void dwc_otg_core_init(dwc_otg_core_if_t * core_if) -+{ -+ int i = 0; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ gusbcfg_data_t usbcfg = {.d32 = 0 }; -+ gi2cctl_data_t i2cctl = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CILV, "dwc_otg_core_init(%p) regs at %p\n", -+ core_if, global_regs); -+ -+ /* Common Initialization */ -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ -+ /* Program the ULPI External VBUS bit if needed */ -+ usbcfg.b.ulpi_ext_vbus_drv = -+ (core_if->core_params->phy_ulpi_ext_vbus == -+ DWC_PHY_ULPI_EXTERNAL_VBUS) ? 1 : 0; -+ -+ /* Set external TS Dline pulsing */ -+ usbcfg.b.term_sel_dl_pulse = -+ (core_if->core_params->ts_dline == 1) ? 1 : 0; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+ /* Reset the Controller */ -+ dwc_otg_core_reset(core_if); -+ -+ core_if->adp_enable = core_if->core_params->adp_supp_enable; -+ core_if->power_down = core_if->core_params->power_down; -+ core_if->otg_sts = 0; -+ -+ /* Initialize parameters from Hardware configuration registers. */ -+ dev_if->num_in_eps = calc_num_in_eps(core_if); -+ dev_if->num_out_eps = calc_num_out_eps(core_if); -+ -+ DWC_DEBUGPL(DBG_CIL, "num_dev_perio_in_ep=%d\n", -+ core_if->hwcfg4.b.num_dev_perio_in_ep); -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { -+ dev_if->perio_tx_fifo_size[i] = -+ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; -+ DWC_DEBUGPL(DBG_CIL, "Periodic Tx FIFO SZ #%d=0x%0x\n", -+ i, dev_if->perio_tx_fifo_size[i]); -+ } -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ dev_if->tx_fifo_size[i] = -+ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; -+ DWC_DEBUGPL(DBG_CIL, "Tx FIFO SZ #%d=0x%0x\n", -+ i, dev_if->tx_fifo_size[i]); -+ } -+ -+ core_if->total_fifo_size = core_if->hwcfg3.b.dfifo_depth; -+ core_if->rx_fifo_size = DWC_READ_REG32(&global_regs->grxfsiz); -+ core_if->nperio_tx_fifo_size = -+ DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16; -+ -+ DWC_DEBUGPL(DBG_CIL, "Total FIFO SZ=%d\n", core_if->total_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "Rx FIFO SZ=%d\n", core_if->rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO SZ=%d\n", -+ core_if->nperio_tx_fifo_size); -+ -+ /* This programming sequence needs to happen in FS mode before any other -+ * programming occurs */ -+ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) && -+ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { -+ /* If FS mode with FS PHY */ -+ -+ /* core_init() is now called on every switch so only call the -+ * following for the first time through. */ -+ if (!core_if->phy_init_done) { -+ core_if->phy_init_done = 1; -+ DWC_DEBUGPL(DBG_CIL, "FS_PHY detected\n"); -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.physel = 1; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+ /* Reset after a PHY select */ -+ dwc_otg_core_reset(core_if); -+ } -+ -+ /* Program DCFG.DevSpd or HCFG.FSLSPclkSel to 48Mhz in FS. Also -+ * do this on HNP Dev/Host mode switches (done in dev_init and -+ * host_init). */ -+ if (dwc_otg_is_host_mode(core_if)) { -+ init_fslspclksel(core_if); -+ } else { -+ init_devspd(core_if); -+ } -+ -+ if (core_if->core_params->i2c_enable) { -+ DWC_DEBUGPL(DBG_CIL, "FS_PHY Enabling I2c\n"); -+ /* Program GUSBCFG.OtgUtmifsSel to I2C */ -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.otgutmifssel = 1; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+ /* Program GI2CCTL.I2CEn */ -+ i2cctl.d32 = DWC_READ_REG32(&global_regs->gi2cctl); -+ i2cctl.b.i2cdevaddr = 1; -+ i2cctl.b.i2cen = 0; -+ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); -+ i2cctl.b.i2cen = 1; -+ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); -+ } -+ -+ } /* endif speed == DWC_SPEED_PARAM_FULL */ -+ else { -+ /* High speed PHY. */ -+ if (!core_if->phy_init_done) { -+ core_if->phy_init_done = 1; -+ /* HS PHY parameters. These parameters are preserved -+ * during soft reset so only program the first time. Do -+ * a soft reset immediately after setting phyif. */ -+ -+ if (core_if->core_params->phy_type == 2) { -+ /* ULPI interface */ -+ usbcfg.b.ulpi_utmi_sel = 1; -+ usbcfg.b.phyif = 0; -+ usbcfg.b.ddrsel = -+ core_if->core_params->phy_ulpi_ddr; -+ } else if (core_if->core_params->phy_type == 1) { -+ /* UTMI+ interface */ -+ usbcfg.b.ulpi_utmi_sel = 0; -+ if (core_if->core_params->phy_utmi_width == 16) { -+ usbcfg.b.phyif = 1; -+ -+ } else { -+ usbcfg.b.phyif = 0; -+ } -+ } else { -+ DWC_ERROR("FS PHY TYPE\n"); -+ } -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ /* Reset after setting the PHY parameters */ -+ dwc_otg_core_reset(core_if); -+ } -+ } -+ -+ if ((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls)) { -+ DWC_DEBUGPL(DBG_CIL, "Setting ULPI FSLS\n"); -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.ulpi_fsls = 1; -+ usbcfg.b.ulpi_clk_sus_m = 1; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ } else { -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.ulpi_fsls = 0; -+ usbcfg.b.ulpi_clk_sus_m = 0; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ } -+ -+ /* Program the GAHBCFG Register. */ -+ switch (core_if->hwcfg2.b.architecture) { -+ -+ case DWC_SLAVE_ONLY_ARCH: -+ DWC_DEBUGPL(DBG_CIL, "Slave Only Mode\n"); -+ ahbcfg.b.nptxfemplvl_txfemplvl = -+ DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; -+ ahbcfg.b.ptxfemplvl = DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; -+ core_if->dma_enable = 0; -+ core_if->dma_desc_enable = 0; -+ break; -+ -+ case DWC_EXT_DMA_ARCH: -+ DWC_DEBUGPL(DBG_CIL, "External DMA Mode\n"); -+ { -+ uint8_t brst_sz = core_if->core_params->dma_burst_size; -+ ahbcfg.b.hburstlen = 0; -+ while (brst_sz > 1) { -+ ahbcfg.b.hburstlen++; -+ brst_sz >>= 1; -+ } -+ } -+ core_if->dma_enable = (core_if->core_params->dma_enable != 0); -+ core_if->dma_desc_enable = -+ (core_if->core_params->dma_desc_enable != 0); -+ break; -+ -+ case DWC_INT_DMA_ARCH: -+ DWC_DEBUGPL(DBG_CIL, "Internal DMA Mode\n"); -+ /* Old value was DWC_GAHBCFG_INT_DMA_BURST_INCR - done for -+ Host mode ISOC in issue fix - vahrama */ -+ /* Broadcom had altered to (1<<3)|(0<<0) - WRESP=1, max 4 beats */ -+ ahbcfg.b.hburstlen = (1<<3)|(0<<0);//DWC_GAHBCFG_INT_DMA_BURST_INCR4; -+ core_if->dma_enable = (core_if->core_params->dma_enable != 0); -+ core_if->dma_desc_enable = -+ (core_if->core_params->dma_desc_enable != 0); -+ break; -+ -+ } -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ DWC_PRINTF("Using Descriptor DMA mode\n"); -+ } else { -+ DWC_PRINTF("Using Buffer DMA mode\n"); -+ -+ } -+ } else { -+ DWC_PRINTF("Using Slave mode\n"); -+ core_if->dma_desc_enable = 0; -+ } -+ -+ if (core_if->core_params->ahb_single) { -+ ahbcfg.b.ahbsingle = 1; -+ } -+ -+ ahbcfg.b.dmaenable = core_if->dma_enable; -+ DWC_WRITE_REG32(&global_regs->gahbcfg, ahbcfg.d32); -+ -+ core_if->en_multiple_tx_fifo = core_if->hwcfg4.b.ded_fifo_en; -+ -+ core_if->pti_enh_enable = core_if->core_params->pti_enable != 0; -+ core_if->multiproc_int_enable = core_if->core_params->mpi_enable; -+ DWC_PRINTF("Periodic Transfer Interrupt Enhancement - %s\n", -+ ((core_if->pti_enh_enable) ? "enabled" : "disabled")); -+ DWC_PRINTF("Multiprocessor Interrupt Enhancement - %s\n", -+ ((core_if->multiproc_int_enable) ? "enabled" : "disabled")); -+ -+ /* -+ * Program the GUSBCFG register. -+ */ -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ -+ switch (core_if->hwcfg2.b.op_mode) { -+ case DWC_MODE_HNP_SRP_CAPABLE: -+ usbcfg.b.hnpcap = (core_if->core_params->otg_cap == -+ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_SRP_ONLY_CAPABLE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_NO_HNP_SRP_CAPABLE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = 0; -+ break; -+ -+ case DWC_MODE_SRP_CAPABLE_DEVICE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_NO_SRP_CAPABLE_DEVICE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = 0; -+ break; -+ -+ case DWC_MODE_SRP_CAPABLE_HOST: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_NO_SRP_CAPABLE_HOST: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = 0; -+ break; -+ } -+ -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (core_if->core_params->lpm_enable) { -+ glpmcfg_data_t lpmcfg = {.d32 = 0 }; -+ -+ /* To enable LPM support set lpm_cap_en bit */ -+ lpmcfg.b.lpm_cap_en = 1; -+ -+ /* Make AppL1Res ACK */ -+ lpmcfg.b.appl_resp = 1; -+ -+ /* Retry 3 times */ -+ lpmcfg.b.retry_count = 3; -+ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->glpmcfg, -+ 0, lpmcfg.d32); -+ -+ } -+#endif -+ if (core_if->core_params->ic_usb_cap) { -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ gusbcfg.b.ic_usb_cap = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gusbcfg, -+ 0, gusbcfg.d32); -+ } -+ { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gotgctl.b.otgver = core_if->core_params->otg_ver; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, 0, -+ gotgctl.d32); -+ /* Set OTG version supported */ -+ core_if->otg_ver = core_if->core_params->otg_ver; -+ DWC_PRINTF("OTG VER PARAM: %d, OTG VER FLAG: %d\n", -+ core_if->core_params->otg_ver, core_if->otg_ver); -+ } -+ -+ -+ /* Enable common interrupts */ -+ dwc_otg_enable_common_interrupts(core_if); -+ -+ /* Do device or host intialization based on mode during PCD -+ * and HCD initialization */ -+ if (dwc_otg_is_host_mode(core_if)) { -+ DWC_DEBUGPL(DBG_ANY, "Host Mode\n"); -+ core_if->op_state = A_HOST; -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "Device Mode\n"); -+ core_if->op_state = B_PERIPHERAL; -+#ifdef DWC_DEVICE_ONLY -+ dwc_otg_core_dev_init(core_if); -+#endif -+ } -+} -+ -+/** -+ * This function enables the Device mode interrupts. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ -+ DWC_DEBUGPL(DBG_CIL, "%s()\n", __func__); -+ -+ /* Disable all interrupts. */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* Clear any pending interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Enable the common interrupts */ -+ dwc_otg_enable_common_interrupts(core_if); -+ -+ /* Enable interrupts */ -+ intr_mask.b.usbreset = 1; -+ intr_mask.b.enumdone = 1; -+ /* Disable Disconnect interrupt in Device mode */ -+ intr_mask.b.disconnect = 0; -+ -+ if (!core_if->multiproc_int_enable) { -+ intr_mask.b.inepintr = 1; -+ intr_mask.b.outepintr = 1; -+ } -+ -+ intr_mask.b.erlysuspend = 1; -+ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.epmismatch = 1; -+ } -+ -+ //intr_mask.b.incomplisoout = 1; -+ intr_mask.b.incomplisoin = 1; -+ -+/* Enable the ignore frame number for ISOC xfers - MAS */ -+/* Disable to support high bandwith ISOC transfers - manukz */ -+#if 0 -+#ifdef DWC_UTE_PER_IO -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ dctl_data_t dctl1 = {.d32 = 0 }; -+ dctl1.b.ifrmnum = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, 0, dctl1.d32); -+ DWC_DEBUG("----Enabled Ignore frame number (0x%08x)", -+ DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dctl)); -+ } -+ } -+#endif -+#endif -+#ifdef DWC_EN_ISOC -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ if (core_if->pti_enh_enable) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.ifrmnum = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dctl, -+ 0, dctl.d32); -+ } else { -+ intr_mask.b.incomplisoin = 1; -+ intr_mask.b.incomplisoout = 1; -+ } -+ } -+ } else { -+ intr_mask.b.incomplisoin = 1; -+ intr_mask.b.incomplisoout = 1; -+ } -+#endif /* DWC_EN_ISOC */ -+ -+ /** @todo NGS: Should this be a module parameter? */ -+#ifdef USE_PERIODIC_EP -+ intr_mask.b.isooutdrop = 1; -+ intr_mask.b.eopframe = 1; -+ intr_mask.b.incomplisoin = 1; -+ intr_mask.b.incomplisoout = 1; -+#endif -+ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, "%s() gintmsk=%0x\n", __func__, -+ DWC_READ_REG32(&global_regs->gintmsk)); -+} -+ -+/** -+ * This function initializes the DWC_otg controller registers for -+ * device mode. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ */ -+void dwc_otg_core_dev_init(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ depctl_data_t diepctl = {.d32 = 0 }; -+ grstctl_t resetctl = {.d32 = 0 }; -+ uint32_t rx_fifo_size; -+ fifosize_data_t nptxfifosize; -+ fifosize_data_t txfifosize; -+ dthrctl_data_t dthrctl; -+ fifosize_data_t ptxfifosize; -+ uint16_t rxfsiz, nptxfsiz; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ hwcfg3_data_t hwcfg3 = {.d32 = 0 }; -+ -+ /* Restart the Phy Clock */ -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ -+ /* Device configuration register */ -+ init_devspd(core_if); -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.descdma = (core_if->dma_desc_enable) ? 1 : 0; -+ dcfg.b.perfrint = DWC_DCFG_FRAME_INTERVAL_80; -+ /* Enable Device OUT NAK in case of DDMA mode*/ -+ if (core_if->core_params->dev_out_nak) { -+ dcfg.b.endevoutnak = 1; -+ } -+ -+ if (core_if->core_params->cont_on_bna) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.encontonbna = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } -+ -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ /* Configure data FIFO sizes */ -+ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { -+ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", -+ core_if->total_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", -+ params->dev_rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", -+ params->dev_nperio_tx_fifo_size); -+ -+ /* Rx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ -+#ifdef DWC_UTE_CFI -+ core_if->pwron_rxfsiz = DWC_READ_REG32(&global_regs->grxfsiz); -+ core_if->init_rxfsiz = params->dev_rx_fifo_size; -+#endif -+ rx_fifo_size = params->dev_rx_fifo_size; -+ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); -+ -+ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ -+ /** Set Periodic Tx FIFO Mask all bits 0 */ -+ core_if->p_tx_msk = 0; -+ -+ /** Set Tx FIFO Mask all bits 0 */ -+ core_if->tx_msk = 0; -+ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ /* Non-periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; -+ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; -+ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, -+ nptxfifosize.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ /**@todo NGS: Fix Periodic FIFO Sizing! */ -+ /* -+ * Periodic Tx FIFOs These FIFOs are numbered from 1 to 15. -+ * Indexes of the FIFO size module parameters in the -+ * dev_perio_tx_fifo_size array and the FIFO size registers in -+ * the dptxfsiz array run from 0 to 14. -+ */ -+ /** @todo Finish debug of this */ -+ ptxfifosize.b.startaddr = -+ nptxfifosize.b.startaddr + nptxfifosize.b.depth; -+ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { -+ ptxfifosize.b.depth = -+ params->dev_perio_tx_fifo_size[i]; -+ DWC_DEBUGPL(DBG_CIL, -+ "initial dtxfsiz[%d]=%08x\n", i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ ptxfifosize.d32); -+ DWC_DEBUGPL(DBG_CIL, "new dtxfsiz[%d]=%08x\n", -+ i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ ptxfifosize.b.startaddr += ptxfifosize.b.depth; -+ } -+ } else { -+ /* -+ * Tx FIFOs These FIFOs are numbered from 1 to 15. -+ * Indexes of the FIFO size module parameters in the -+ * dev_tx_fifo_size array and the FIFO size registers in -+ * the dtxfsiz array run from 0 to 14. -+ */ -+ -+ /* Non-periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+#ifdef DWC_UTE_CFI -+ core_if->pwron_gnptxfsiz = -+ (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); -+ core_if->init_gnptxfsiz = -+ params->dev_nperio_tx_fifo_size; -+#endif -+ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; -+ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; -+ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, -+ nptxfifosize.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ txfifosize.b.startaddr = -+ nptxfifosize.b.startaddr + nptxfifosize.b.depth; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ -+ txfifosize.b.depth = -+ params->dev_tx_fifo_size[i]; -+ -+ DWC_DEBUGPL(DBG_CIL, -+ "initial dtxfsiz[%d]=%08x\n", -+ i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ -+#ifdef DWC_UTE_CFI -+ core_if->pwron_txfsiz[i] = -+ (DWC_READ_REG32 -+ (&global_regs->dtxfsiz[i]) >> 16); -+ core_if->init_txfsiz[i] = -+ params->dev_tx_fifo_size[i]; -+#endif -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ txfifosize.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, -+ "new dtxfsiz[%d]=%08x\n", -+ i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ -+ txfifosize.b.startaddr += txfifosize.b.depth; -+ } -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ /* Calculating DFIFOCFG for Device mode to include RxFIFO and NPTXFIFO */ -+ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); -+ hwcfg3.d32 = DWC_READ_REG32(&global_regs->ghwcfg3); -+ gdfifocfg.b.gdfifocfg = (DWC_READ_REG32(&global_regs->ghwcfg3) >> 16); -+ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); -+ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); -+ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); -+ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz; -+ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); -+ } -+ } -+ -+ /* Flush the FIFOs */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ -+ dwc_otg_flush_rx_fifo(core_if); -+ -+ /* Flush the Learning Queue. */ -+ resetctl.b.intknqflsh = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { -+ core_if->start_predict = 0; -+ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { -+ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active -+ } -+ core_if->nextep_seq[0] = 0; -+ core_if->first_in_nextep_seq = 0; -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); -+ diepctl.b.nextep = 0; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); -+ -+ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt = 2; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_CILV,"%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_CILV, "%2d ", core_if->nextep_seq[i]); -+ } -+ DWC_DEBUGPL(DBG_CILV,"\n"); -+ } -+ -+ /* Clear all pending Device Interrupts */ -+ /** @todo - if the condition needed to be checked -+ * or in any case all pending interrutps should be cleared? -+ */ -+ if (core_if->multiproc_int_enable) { -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_WRITE_REG32(&dev_if-> -+ dev_global_regs->diepeachintmsk[i], 0); -+ } -+ } -+ -+ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { -+ DWC_WRITE_REG32(&dev_if-> -+ dev_global_regs->doepeachintmsk[i], 0); -+ } -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachint, 0xFFFFFFFF); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, 0); -+ } else { -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, 0); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, 0); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->daint, 0xFFFFFFFF); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, 0); -+ } -+ -+ for (i = 0; i <= dev_if->num_in_eps; i++) { -+ depctl_data_t depctl; -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (depctl.b.epena) { -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ } else { -+ depctl.d32 = 0; -+ } -+ -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); -+ -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, 0); -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, 0); -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepint, 0xFF); -+ } -+ -+ for (i = 0; i <= dev_if->num_out_eps; i++) { -+ depctl_data_t depctl; -+ depctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); -+ if (depctl.b.epena) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ gintmsk_data_t gintsts = {.d32 = 0 }; -+ doepint_data_t doepint = {.d32 = 0 }; -+ dctl.b.sgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ do { -+ dwc_udelay(10); -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ } while (!gintsts.b.goutnakeff); -+ gintsts.d32 = 0; -+ gintsts.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepctl, depctl.d32); -+ do { -+ dwc_udelay(10); -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[i]->doepint); -+ } while (!doepint.b.epdisabled); -+ -+ doepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepint, doepint.d32); -+ -+ dctl.d32 = 0; -+ dctl.b.cgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } else { -+ depctl.d32 = 0; -+ } -+ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, depctl.d32); -+ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doeptsiz, 0); -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepdma, 0); -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepint, 0xFF); -+ } -+ -+ if (core_if->en_multiple_tx_fifo && core_if->dma_enable) { -+ dev_if->non_iso_tx_thr_en = params->thr_ctl & 0x1; -+ dev_if->iso_tx_thr_en = (params->thr_ctl >> 1) & 0x1; -+ dev_if->rx_thr_en = (params->thr_ctl >> 2) & 0x1; -+ -+ dev_if->rx_thr_length = params->rx_thr_length; -+ dev_if->tx_thr_length = params->tx_thr_length; -+ -+ dev_if->setup_desc_index = 0; -+ -+ dthrctl.d32 = 0; -+ dthrctl.b.non_iso_thr_en = dev_if->non_iso_tx_thr_en; -+ dthrctl.b.iso_thr_en = dev_if->iso_tx_thr_en; -+ dthrctl.b.tx_thr_len = dev_if->tx_thr_length; -+ dthrctl.b.rx_thr_en = dev_if->rx_thr_en; -+ dthrctl.b.rx_thr_len = dev_if->rx_thr_length; -+ dthrctl.b.ahb_thr_ratio = params->ahb_thr_ratio; -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dtknqr3_dthrctl, -+ dthrctl.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, -+ "Non ISO Tx Thr - %d\nISO Tx Thr - %d\nRx Thr - %d\nTx Thr Len - %d\nRx Thr Len - %d\n", -+ dthrctl.b.non_iso_thr_en, dthrctl.b.iso_thr_en, -+ dthrctl.b.rx_thr_en, dthrctl.b.tx_thr_len, -+ dthrctl.b.rx_thr_len); -+ -+ } -+ -+ dwc_otg_enable_device_interrupts(core_if); -+ -+ { -+ diepmsk_data_t msk = {.d32 = 0 }; -+ msk.b.txfifoundrn = 1; -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs-> -+ diepeachintmsk[0], msk.d32, msk.d32); -+ } else { -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, -+ msk.d32, msk.d32); -+ } -+ } -+ -+ if (core_if->multiproc_int_enable) { -+ /* Set NAK on Babble */ -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.nakonbble = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } -+ -+ if (core_if->snpsid >= OTG_CORE_REV_2_94a) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dctl); -+ dctl.b.sftdiscon = 0; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, dctl.d32); -+ } -+} -+ -+/** -+ * This function enables the Host mode interrupts. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CIL, "%s(%p)\n", __func__, core_if); -+ -+ /* Disable all interrupts. */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* Clear any pending interrupts. */ -+ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Enable the common interrupts */ -+ dwc_otg_enable_common_interrupts(core_if); -+ -+ /* -+ * Enable host mode interrupts without disturbing common -+ * interrupts. -+ */ -+ -+ intr_mask.b.disconnect = 1; -+ intr_mask.b.portintr = 1; -+ intr_mask.b.hcintr = 1; -+ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+} -+ -+/** -+ * This function disables the Host Mode interrupts. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s()\n", __func__); -+ -+ /* -+ * Disable host mode interrupts without disturbing common -+ * interrupts. -+ */ -+ intr_mask.b.sofintr = 1; -+ intr_mask.b.portintr = 1; -+ intr_mask.b.hcintr = 1; -+ intr_mask.b.ptxfempty = 1; -+ intr_mask.b.nptxfempty = 1; -+ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, 0); -+} -+ -+/** -+ * This function initializes the DWC_otg controller registers for -+ * host mode. -+ * -+ * This function flushes the Tx and Rx FIFOs and it flushes any entries in the -+ * request queues. Host channels are reset to ensure that they are ready for -+ * performing transfers. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ */ -+void dwc_otg_core_host_init(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_host_if_t *host_if = core_if->host_if; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ fifosize_data_t nptxfifosize; -+ fifosize_data_t ptxfifosize; -+ uint16_t rxfsiz, nptxfsiz, hptxfsiz; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ int i; -+ hcchar_data_t hcchar; -+ hcfg_data_t hcfg; -+ hfir_data_t hfir; -+ dwc_otg_hc_regs_t *hc_regs; -+ int num_channels; -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); -+ -+ /* Restart the Phy Clock */ -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ -+ /* Initialize Host Configuration Register */ -+ init_fslspclksel(core_if); -+ if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { -+ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); -+ hcfg.b.fslssupp = 1; -+ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); -+ -+ } -+ -+ /* This bit allows dynamic reloading of the HFIR register -+ * during runtime. This bit needs to be programmed during -+ * initial configuration and its value must not be changed -+ * during runtime.*/ -+ if (core_if->core_params->reload_ctl == 1) { -+ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); -+ hfir.b.hfirrldctrl = 1; -+ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); -+ } -+ -+ if (core_if->core_params->dma_desc_enable) { -+ uint8_t op_mode = core_if->hwcfg2.b.op_mode; -+ if (! -+ (core_if->hwcfg4.b.desc_dma -+ && (core_if->snpsid >= OTG_CORE_REV_2_90a) -+ && ((op_mode == DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) -+ || (op_mode == -+ DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG) -+ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST) -+ || (op_mode == -+ DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST)))) { -+ -+ DWC_ERROR("Host can't operate in Descriptor DMA mode.\n" -+ "Either core version is below 2.90a or " -+ "GHWCFG2, GHWCFG4 registers' values do not allow Descriptor DMA in host mode.\n" -+ "To run the driver in Buffer DMA host mode set dma_desc_enable " -+ "module parameter to 0.\n"); -+ return; -+ } -+ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); -+ hcfg.b.descdma = 1; -+ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); -+ } -+ -+ /* Configure data FIFO sizes */ -+ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { -+ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", -+ core_if->total_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", -+ params->host_rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", -+ params->host_nperio_tx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "P Tx FIFO Size=%d\n", -+ params->host_perio_tx_fifo_size); -+ -+ /* Rx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ DWC_WRITE_REG32(&global_regs->grxfsiz, -+ params->host_rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ -+ /* Non-periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ nptxfifosize.b.depth = params->host_nperio_tx_fifo_size; -+ nptxfifosize.b.startaddr = params->host_rx_fifo_size; -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); -+ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ /* Periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial hptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->hptxfsiz)); -+ ptxfifosize.b.depth = params->host_perio_tx_fifo_size; -+ ptxfifosize.b.startaddr = -+ nptxfifosize.b.startaddr + nptxfifosize.b.depth; -+ DWC_WRITE_REG32(&global_regs->hptxfsiz, ptxfifosize.d32); -+ DWC_DEBUGPL(DBG_CIL, "new hptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->hptxfsiz)); -+ -+ if (core_if->en_multiple_tx_fifo -+ && core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ /* Global DFIFOCFG calculation for Host mode - include RxFIFO, NPTXFIFO and HPTXFIFO */ -+ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); -+ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); -+ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); -+ hptxfsiz = (DWC_READ_REG32(&global_regs->hptxfsiz) >> 16); -+ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz + hptxfsiz; -+ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); -+ } -+ } -+ -+ /* TODO - check this */ -+ /* Clear Host Set HNP Enable in the OTG Control Register */ -+ gotgctl.b.hstsethnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ /* Make sure the FIFOs are flushed. */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10 /* all TX FIFOs */ ); -+ dwc_otg_flush_rx_fifo(core_if); -+ -+ /* Clear Host Set HNP Enable in the OTG Control Register */ -+ gotgctl.b.hstsethnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ -+ if (!core_if->core_params->dma_desc_enable) { -+ /* Flush out any leftover queued requests. */ -+ num_channels = core_if->core_params->host_channels; -+ -+ for (i = 0; i < num_channels; i++) { -+ hc_regs = core_if->host_if->hc_regs[i]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.chen = 0; -+ hcchar.b.chdis = 1; -+ hcchar.b.epdir = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ } -+ -+ /* Halt all channels to put them into a known state. */ -+ for (i = 0; i < num_channels; i++) { -+ int count = 0; -+ hc_regs = core_if->host_if->hc_regs[i]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 1; -+ hcchar.b.epdir = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ DWC_DEBUGPL(DBG_HCDV, "%s: Halt channel %d regs %p\n", __func__, i, hc_regs); -+ do { -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (++count > 1000) { -+ DWC_ERROR -+ ("%s: Unable to clear halt on channel %d (timeout HCCHAR 0x%X @%p)\n", -+ __func__, i, hcchar.d32, &hc_regs->hcchar); -+ break; -+ } -+ dwc_udelay(1); -+ } while (hcchar.b.chen); -+ } -+ } -+ -+ /* Turn on the vbus power. */ -+ DWC_PRINTF("Init: Port Power? op_state=%d\n", core_if->op_state); -+ if (core_if->op_state == A_HOST) { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ DWC_PRINTF("Init: Power Port (%d)\n", hprt0.b.prtpwr); -+ if (hprt0.b.prtpwr == 0) { -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(host_if->hprt0, hprt0.d32); -+ } -+ } -+ -+ dwc_otg_enable_host_interrupts(core_if); -+} -+ -+/** -+ * Prepares a host channel for transferring packets to/from a specific -+ * endpoint. The HCCHARn register is set up with the characteristics specified -+ * in _hc. Host channel interrupts that may need to be serviced while this -+ * transfer is in progress are enabled. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * @param hc Information needed to initialize the host channel -+ */ -+void dwc_otg_hc_init(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ hcintmsk_data_t hc_intr_mask; -+ hcchar_data_t hcchar; -+ hcsplt_data_t hcsplt; -+ -+ uint8_t hc_num = hc->hc_num; -+ dwc_otg_host_if_t *host_if = core_if->host_if; -+ dwc_otg_hc_regs_t *hc_regs = host_if->hc_regs[hc_num]; -+ -+ /* Clear old interrupt conditions for this host channel. */ -+ hc_intr_mask.d32 = 0xFFFFFFFF; -+ hc_intr_mask.b.reserved14_31 = 0; -+ DWC_WRITE_REG32(&hc_regs->hcint, hc_intr_mask.d32); -+ -+ /* Enable channel interrupts required for this transfer. */ -+ hc_intr_mask.d32 = 0; -+ hc_intr_mask.b.chhltd = 1; -+ if (core_if->dma_enable) { -+ /* For Descriptor DMA mode core halts the channel on AHB error. Interrupt is not required */ -+ if (!core_if->dma_desc_enable) -+ hc_intr_mask.b.ahberr = 1; -+ else { -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ hc_intr_mask.b.xfercompl = 1; -+ } -+ -+ if (hc->error_state && !hc->do_split && -+ hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { -+ hc_intr_mask.b.ack = 1; -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.datatglerr = 1; -+ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { -+ hc_intr_mask.b.nak = 1; -+ } -+ } -+ } -+ } else { -+ switch (hc->ep_type) { -+ case DWC_OTG_EP_TYPE_CONTROL: -+ case DWC_OTG_EP_TYPE_BULK: -+ hc_intr_mask.b.xfercompl = 1; -+ hc_intr_mask.b.stall = 1; -+ hc_intr_mask.b.xacterr = 1; -+ hc_intr_mask.b.datatglerr = 1; -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.bblerr = 1; -+ } else { -+ hc_intr_mask.b.nak = 1; -+ hc_intr_mask.b.nyet = 1; -+ if (hc->do_ping) { -+ hc_intr_mask.b.ack = 1; -+ } -+ } -+ -+ if (hc->do_split) { -+ hc_intr_mask.b.nak = 1; -+ if (hc->complete_split) { -+ hc_intr_mask.b.nyet = 1; -+ } else { -+ hc_intr_mask.b.ack = 1; -+ } -+ } -+ -+ if (hc->error_state) { -+ hc_intr_mask.b.ack = 1; -+ } -+ break; -+ case DWC_OTG_EP_TYPE_INTR: -+ hc_intr_mask.b.xfercompl = 1; -+ hc_intr_mask.b.nak = 1; -+ hc_intr_mask.b.stall = 1; -+ hc_intr_mask.b.xacterr = 1; -+ hc_intr_mask.b.datatglerr = 1; -+ hc_intr_mask.b.frmovrun = 1; -+ -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.bblerr = 1; -+ } -+ if (hc->error_state) { -+ hc_intr_mask.b.ack = 1; -+ } -+ if (hc->do_split) { -+ if (hc->complete_split) { -+ hc_intr_mask.b.nyet = 1; -+ } else { -+ hc_intr_mask.b.ack = 1; -+ } -+ } -+ break; -+ case DWC_OTG_EP_TYPE_ISOC: -+ hc_intr_mask.b.xfercompl = 1; -+ hc_intr_mask.b.frmovrun = 1; -+ hc_intr_mask.b.ack = 1; -+ -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.xacterr = 1; -+ hc_intr_mask.b.bblerr = 1; -+ } -+ break; -+ } -+ } -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, hc_intr_mask.d32); -+ -+ /* -+ * Program the HCCHARn register with the endpoint characteristics for -+ * the current transfer. -+ */ -+ hcchar.d32 = 0; -+ hcchar.b.devaddr = hc->dev_addr; -+ hcchar.b.epnum = hc->ep_num; -+ hcchar.b.epdir = hc->ep_is_in; -+ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); -+ hcchar.b.eptype = hc->ep_type; -+ hcchar.b.mps = hc->max_packet; -+ -+ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcchar, hcchar.d32); -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d, Dev Addr %d, EP #%d\n", -+ __func__, hc->hc_num, hcchar.b.devaddr, hcchar.b.epnum); -+ DWC_DEBUGPL(DBG_HCDV, " Is In %d, Is Low Speed %d, EP Type %d, " -+ "Max Pkt %d, Multi Cnt %d\n", -+ hcchar.b.epdir, hcchar.b.lspddev, hcchar.b.eptype, -+ hcchar.b.mps, hcchar.b.multicnt); -+ -+ /* -+ * Program the HCSPLIT register for SPLITs -+ */ -+ hcsplt.d32 = 0; -+ if (hc->do_split) { -+ DWC_DEBUGPL(DBG_HCDV, "Programming HC %d with split --> %s\n", -+ hc->hc_num, -+ hc->complete_split ? "CSPLIT" : "SSPLIT"); -+ hcsplt.b.compsplt = hc->complete_split; -+ hcsplt.b.xactpos = hc->xact_pos; -+ hcsplt.b.hubaddr = hc->hub_addr; -+ hcsplt.b.prtaddr = hc->port_addr; -+ DWC_DEBUGPL(DBG_HCDV, "\t comp split %d\n", hc->complete_split); -+ DWC_DEBUGPL(DBG_HCDV, "\t xact pos %d\n", hc->xact_pos); -+ DWC_DEBUGPL(DBG_HCDV, "\t hub addr %d\n", hc->hub_addr); -+ DWC_DEBUGPL(DBG_HCDV, "\t port addr %d\n", hc->port_addr); -+ DWC_DEBUGPL(DBG_HCDV, "\t is_in %d\n", hc->ep_is_in); -+ DWC_DEBUGPL(DBG_HCDV, "\t Max Pkt: %d\n", hcchar.b.mps); -+ DWC_DEBUGPL(DBG_HCDV, "\t xferlen: %d\n", hc->xfer_len); -+ } -+ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcsplt, hcsplt.d32); -+ -+} -+ -+/** -+ * Attempts to halt a host channel. This function should only be called in -+ * Slave mode or to abort a transfer in either Slave mode or DMA mode. Under -+ * normal circumstances in DMA mode, the controller halts the channel when the -+ * transfer is complete or a condition occurs that requires application -+ * intervention. -+ * -+ * In slave mode, checks for a free request queue entry, then sets the Channel -+ * Enable and Channel Disable bits of the Host Channel Characteristics -+ * register of the specified channel to intiate the halt. If there is no free -+ * request queue entry, sets only the Channel Disable bit of the HCCHARn -+ * register to flush requests for this channel. In the latter case, sets a -+ * flag to indicate that the host channel needs to be halted when a request -+ * queue slot is open. -+ * -+ * In DMA mode, always sets the Channel Enable and Channel Disable bits of the -+ * HCCHARn register. The controller ensures there is space in the request -+ * queue before submitting the halt request. -+ * -+ * Some time may elapse before the core flushes any posted requests for this -+ * host channel and halts. The Channel Halted interrupt handler completes the -+ * deactivation of the host channel. -+ * -+ * @param core_if Controller register interface. -+ * @param hc Host channel to halt. -+ * @param halt_status Reason for halting the channel. -+ */ -+void dwc_otg_hc_halt(dwc_otg_core_if_t * core_if, -+ dwc_hc_t * hc, dwc_otg_halt_status_e halt_status) -+{ -+ gnptxsts_data_t nptxsts; -+ hptxsts_data_t hptxsts; -+ hcchar_data_t hcchar; -+ dwc_otg_hc_regs_t *hc_regs; -+ dwc_otg_core_global_regs_t *global_regs; -+ dwc_otg_host_global_regs_t *host_global_regs; -+ -+ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ global_regs = core_if->core_global_regs; -+ host_global_regs = core_if->host_if->host_global_regs; -+ -+ DWC_ASSERT(!(halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS), -+ "halt_status = %d\n", halt_status); -+ -+ if (halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || -+ halt_status == DWC_OTG_HC_XFER_AHB_ERR) { -+ /* -+ * Disable all channel interrupts except Ch Halted. The QTD -+ * and QH state associated with this transfer has been cleared -+ * (in the case of URB_DEQUEUE), so the channel needs to be -+ * shut down carefully to prevent crashes. -+ */ -+ hcintmsk_data_t hcintmsk; -+ hcintmsk.d32 = 0; -+ hcintmsk.b.chhltd = 1; -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, hcintmsk.d32); -+ -+ /* -+ * Make sure no other interrupts besides halt are currently -+ * pending. Handling another interrupt could cause a crash due -+ * to the QTD and QH state. -+ */ -+ DWC_WRITE_REG32(&hc_regs->hcint, ~hcintmsk.d32); -+ -+ /* -+ * Make sure the halt status is set to URB_DEQUEUE or AHB_ERR -+ * even if the channel was already halted for some other -+ * reason. -+ */ -+ hc->halt_status = halt_status; -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen == 0) { -+ /* -+ * The channel is either already halted or it hasn't -+ * started yet. In DMA mode, the transfer may halt if -+ * it finishes normally or a condition occurs that -+ * requires driver intervention. Don't want to halt -+ * the channel again. In either Slave or DMA mode, -+ * it's possible that the transfer has been assigned -+ * to a channel, but not started yet when an URB is -+ * dequeued. Don't want to halt a channel that hasn't -+ * started yet. -+ */ -+ return; -+ } -+ } -+ if (hc->halt_pending) { -+ /* -+ * A halt has already been issued for this channel. This might -+ * happen when a transfer is aborted by a higher level in -+ * the stack. -+ */ -+#ifdef DEBUG -+ DWC_PRINTF -+ ("*** %s: Channel %d, _hc->halt_pending already set ***\n", -+ __func__, hc->hc_num); -+ -+#endif -+ return; -+ } -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* No need to set the bit in DDMA for disabling the channel */ -+ //TODO check it everywhere channel is disabled -+ if (!core_if->core_params->dma_desc_enable) -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 1; -+ -+ if (!core_if->dma_enable) { -+ /* Check for space in the request queue to issue the halt. */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || -+ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { -+ nptxsts.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ if (nptxsts.b.nptxqspcavail == 0) { -+ hcchar.b.chen = 0; -+ } -+ } else { -+ hptxsts.d32 = -+ DWC_READ_REG32(&host_global_regs->hptxsts); -+ if ((hptxsts.b.ptxqspcavail == 0) -+ || (core_if->queuing_high_bandwidth)) { -+ hcchar.b.chen = 0; -+ } -+ } -+ } -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ hc->halt_status = halt_status; -+ -+ if (hcchar.b.chen) { -+ hc->halt_pending = 1; -+ hc->halt_on_queue = 0; -+ } else { -+ hc->halt_on_queue = 1; -+ } -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " hcchar: 0x%08x\n", hcchar.d32); -+ DWC_DEBUGPL(DBG_HCDV, " halt_pending: %d\n", hc->halt_pending); -+ DWC_DEBUGPL(DBG_HCDV, " halt_on_queue: %d\n", hc->halt_on_queue); -+ DWC_DEBUGPL(DBG_HCDV, " halt_status: %d\n", hc->halt_status); -+ -+ return; -+} -+ -+/** -+ * Clears the transfer state for a host channel. This function is normally -+ * called after a transfer is done and the host channel is being released. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Identifies the host channel to clean up. -+ */ -+void dwc_otg_hc_cleanup(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ dwc_otg_hc_regs_t *hc_regs; -+ -+ hc->xfer_started = 0; -+ -+ /* -+ * Clear channel interrupt enables and any unhandled channel interrupt -+ * conditions. -+ */ -+ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0); -+ DWC_WRITE_REG32(&hc_regs->hcint, 0xFFFFFFFF); -+#ifdef DEBUG -+ DWC_TIMER_CANCEL(core_if->hc_xfer_timer[hc->hc_num]); -+#endif -+} -+ -+/** -+ * Sets the channel property that indicates in which frame a periodic transfer -+ * should occur. This is always set to the _next_ frame. This function has no -+ * effect on non-periodic transfers. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Identifies the host channel to set up and its properties. -+ * @param hcchar Current value of the HCCHAR register for the specified host -+ * channel. -+ */ -+static inline void hc_set_even_odd_frame(dwc_otg_core_if_t * core_if, -+ dwc_hc_t * hc, hcchar_data_t * hcchar) -+{ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ hfnum_data_t hfnum; -+ hfnum.d32 = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfnum); -+ -+ /* 1 if _next_ frame is odd, 0 if it's even */ -+ hcchar->b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; -+#ifdef DEBUG -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR && hc->do_split -+ && !hc->complete_split) { -+ switch (hfnum.b.frnum & 0x7) { -+ case 7: -+ core_if->hfnum_7_samples++; -+ core_if->hfnum_7_frrem_accum += hfnum.b.frrem; -+ break; -+ case 0: -+ core_if->hfnum_0_samples++; -+ core_if->hfnum_0_frrem_accum += hfnum.b.frrem; -+ break; -+ default: -+ core_if->hfnum_other_samples++; -+ core_if->hfnum_other_frrem_accum += -+ hfnum.b.frrem; -+ break; -+ } -+ } -+#endif -+ } -+} -+ -+#ifdef DEBUG -+void hc_xfer_timeout(void *ptr) -+{ -+ hc_xfer_info_t *xfer_info = NULL; -+ int hc_num = 0; -+ -+ if (ptr) -+ xfer_info = (hc_xfer_info_t *) ptr; -+ -+ if (!xfer_info->hc) { -+ DWC_ERROR("xfer_info->hc = %p\n", xfer_info->hc); -+ return; -+ } -+ -+ hc_num = xfer_info->hc->hc_num; -+ DWC_WARN("%s: timeout on channel %d\n", __func__, hc_num); -+ DWC_WARN(" start_hcchar_val 0x%08x\n", -+ xfer_info->core_if->start_hcchar_val[hc_num]); -+} -+#endif -+ -+void ep_xfer_timeout(void *ptr) -+{ -+ ep_xfer_info_t *xfer_info = NULL; -+ int ep_num = 0; -+ dctl_data_t dctl = {.d32 = 0 }; -+ gintsts_data_t gintsts = {.d32 = 0 }; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ if (ptr) -+ xfer_info = (ep_xfer_info_t *) ptr; -+ -+ if (!xfer_info->ep) { -+ DWC_ERROR("xfer_info->ep = %p\n", xfer_info->ep); -+ return; -+ } -+ -+ ep_num = xfer_info->ep->num; -+ DWC_WARN("%s: timeout on endpoit %d\n", __func__, ep_num); -+ /* Put the sate to 2 as it was time outed */ -+ xfer_info->state = 2; -+ -+ dctl.d32 = -+ DWC_READ_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl); -+ gintsts.d32 = -+ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintsts); -+ gintmsk.d32 = -+ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintmsk); -+ -+ if (!gintmsk.b.goutnakeff) { -+ /* Unmask it */ -+ gintmsk.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&xfer_info->core_if->core_global_regs->gintmsk, -+ gintmsk.d32); -+ -+ } -+ -+ if (!gintsts.b.goutnakeff) { -+ dctl.b.sgoutnak = 1; -+ } -+ DWC_WRITE_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ -+} -+ -+void set_pid_isoc(dwc_hc_t * hc) -+{ -+ /* Set up the initial PID for the transfer. */ -+ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) { -+ if (hc->ep_is_in) { -+ if (hc->multi_count == 1) { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; -+ } else if (hc->multi_count == 2) { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; -+ } else { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA2; -+ } -+ } else { -+ if (hc->multi_count == 1) { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; -+ } else { -+ hc->data_pid_start = DWC_OTG_HC_PID_MDATA; -+ } -+ } -+ } else { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; -+ } -+} -+ -+/** -+ * This function does the setup for a data transfer for a host channel and -+ * starts the transfer. May be called in either Slave mode or DMA mode. In -+ * Slave mode, the caller must ensure that there is sufficient space in the -+ * request queue and Tx Data FIFO. -+ * -+ * For an OUT transfer in Slave mode, it loads a data packet into the -+ * appropriate FIFO. If necessary, additional data packets will be loaded in -+ * the Host ISR. -+ * -+ * For an IN transfer in Slave mode, a data packet is requested. The data -+ * packets are unloaded from the Rx FIFO in the Host ISR. If necessary, -+ * additional data packets are requested in the Host ISR. -+ * -+ * For a PING transfer in Slave mode, the Do Ping bit is set in the HCTSIZ -+ * register along with a packet count of 1 and the channel is enabled. This -+ * causes a single PING transaction to occur. Other fields in HCTSIZ are -+ * simply set to 0 since no data transfer occurs in this case. -+ * -+ * For a PING transfer in DMA mode, the HCTSIZ register is initialized with -+ * all the information required to perform the subsequent data transfer. In -+ * addition, the Do Ping bit is set in the HCTSIZ register. In this case, the -+ * controller performs the entire PING protocol, then starts the data -+ * transfer. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Information needed to initialize the host channel. The xfer_len -+ * value may be reduced to accommodate the max widths of the XferSize and -+ * PktCnt fields in the HCTSIZn register. The multi_count value may be changed -+ * to reflect the final xfer_len value. -+ */ -+void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ uint16_t num_packets; -+ uint32_t max_hc_xfer_size = core_if->core_params->max_transfer_size; -+ uint16_t max_hc_pkt_count = core_if->core_params->max_packet_count; -+ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ -+ hctsiz.d32 = 0; -+ -+ if (hc->do_ping) { -+ if (!core_if->dma_enable) { -+ dwc_otg_hc_do_ping(core_if, hc); -+ hc->xfer_started = 1; -+ return; -+ } else { -+ hctsiz.b.dopng = 1; -+ } -+ } -+ -+ if (hc->do_split) { -+ num_packets = 1; -+ -+ if (hc->complete_split && !hc->ep_is_in) { -+ /* For CSPLIT OUT Transfer, set the size to 0 so the -+ * core doesn't expect any data written to the FIFO */ -+ hc->xfer_len = 0; -+ } else if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { -+ hc->xfer_len = hc->max_packet; -+ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { -+ hc->xfer_len = 188; -+ } -+ -+ hctsiz.b.xfersize = hc->xfer_len; -+ } else { -+ /* -+ * Ensure that the transfer length and packet count will fit -+ * in the widths allocated for them in the HCTSIZn register. -+ */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * Make sure the transfer size is no larger than one -+ * (micro)frame's worth of data. (A check was done -+ * when the periodic transfer was accepted to ensure -+ * that a (micro)frame's worth of data can be -+ * programmed into a channel.) -+ */ -+ uint32_t max_periodic_len = -+ hc->multi_count * hc->max_packet; -+ if (hc->xfer_len > max_periodic_len) { -+ hc->xfer_len = max_periodic_len; -+ } else { -+ } -+ } else if (hc->xfer_len > max_hc_xfer_size) { -+ /* Make sure that xfer_len is a multiple of max packet size. */ -+ hc->xfer_len = max_hc_xfer_size - hc->max_packet + 1; -+ } -+ -+ if (hc->xfer_len > 0) { -+ num_packets = -+ (hc->xfer_len + hc->max_packet - -+ 1) / hc->max_packet; -+ if (num_packets > max_hc_pkt_count) { -+ num_packets = max_hc_pkt_count; -+ hc->xfer_len = num_packets * hc->max_packet; -+ } -+ } else { -+ /* Need 1 packet for transfer length of 0. */ -+ num_packets = 1; -+ } -+ -+ if (hc->ep_is_in) { -+ /* Always program an integral # of max packets for IN transfers. */ -+ hc->xfer_len = num_packets * hc->max_packet; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * Make sure that the multi_count field matches the -+ * actual transfer length. -+ */ -+ hc->multi_count = num_packets; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ set_pid_isoc(hc); -+ -+ hctsiz.b.xfersize = hc->xfer_len; -+ } -+ -+ hc->start_pkt_count = num_packets; -+ hctsiz.b.pktcnt = num_packets; -+ hctsiz.b.pid = hc->data_pid_start; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " Xfer Size: %d\n", hctsiz.b.xfersize); -+ DWC_DEBUGPL(DBG_HCDV, " Num Pkts: %d\n", hctsiz.b.pktcnt); -+ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); -+ -+ if (core_if->dma_enable) { -+ dwc_dma_t dma_addr; -+ if (hc->align_buff) { -+ dma_addr = hc->align_buff; -+ } else { -+ dma_addr = ((unsigned long)hc->xfer_buff & 0xffffffff); -+ } -+ DWC_WRITE_REG32(&hc_regs->hcdma, dma_addr); -+ } -+ -+ /* Start the split */ -+ if (hc->do_split) { -+ hcsplt_data_t hcsplt; -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ hcsplt.b.spltena = 1; -+ DWC_WRITE_REG32(&hc_regs->hcsplt, hcsplt.d32); -+ } -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.multicnt = hc->multi_count; -+ hc_set_even_odd_frame(core_if, hc, &hcchar); -+#ifdef DEBUG -+ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; -+ if (hcchar.b.chdis) { -+ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", -+ __func__, hc->hc_num, hcchar.d32); -+ } -+#endif -+ -+ /* Set host channel enable after all other setup is complete. */ -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ hc->xfer_started = 1; -+ hc->requests++; -+ -+ if (!core_if->dma_enable && !hc->ep_is_in && hc->xfer_len > 0) { -+ /* Load OUT packet into the appropriate Tx FIFO. */ -+ dwc_otg_hc_write_packet(core_if, hc); -+ } -+#ifdef DEBUG -+ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { -+ DWC_DEBUGPL(DBG_HCDV, "transfer %d from core_if %p\n", -+ hc->hc_num, core_if);//GRAYG -+ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; -+ core_if->hc_xfer_info[hc->hc_num].hc = hc; -+ -+ /* Start a timer for this transfer. */ -+ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); -+ } -+#endif -+} -+ -+/** -+ * This function does the setup for a data transfer for a host channel -+ * and starts the transfer in Descriptor DMA mode. -+ * -+ * Initializes HCTSIZ register. For a PING transfer the Do Ping bit is set. -+ * Sets PID and NTD values. For periodic transfers -+ * initializes SCHED_INFO field with micro-frame bitmap. -+ * -+ * Initializes HCDMA register with descriptor list address and CTD value -+ * then starts the transfer via enabling the channel. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Information needed to initialize the host channel. -+ */ -+void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ hcdma_data_t hcdma; -+ -+ hctsiz.d32 = 0; -+ -+ if (hc->do_ping) -+ hctsiz.b_ddma.dopng = 1; -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ set_pid_isoc(hc); -+ -+ /* Packet Count and Xfer Size are not used in Descriptor DMA mode */ -+ hctsiz.b_ddma.pid = hc->data_pid_start; -+ hctsiz.b_ddma.ntd = hc->ntd - 1; /* 0 - 1 descriptor, 1 - 2 descriptors, etc. */ -+ hctsiz.b_ddma.schinfo = hc->schinfo; /* Non-zero only for high-speed interrupt endpoints */ -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); -+ DWC_DEBUGPL(DBG_HCDV, " NTD: %d\n", hctsiz.b_ddma.ntd); -+ -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ hcdma.d32 = 0; -+ hcdma.b.dma_addr = ((uint32_t) hc->desc_list_addr) >> 11; -+ -+ /* Always start from first descriptor. */ -+ hcdma.b.ctd = 0; -+ DWC_WRITE_REG32(&hc_regs->hcdma, hcdma.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.multicnt = hc->multi_count; -+ -+#ifdef DEBUG -+ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; -+ if (hcchar.b.chdis) { -+ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", -+ __func__, hc->hc_num, hcchar.d32); -+ } -+#endif -+ -+ /* Set host channel enable after all other setup is complete. */ -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ hc->xfer_started = 1; -+ hc->requests++; -+ -+#ifdef DEBUG -+ if ((hc->ep_type != DWC_OTG_EP_TYPE_INTR) -+ && (hc->ep_type != DWC_OTG_EP_TYPE_ISOC)) { -+ DWC_DEBUGPL(DBG_HCDV, "DMA transfer %d from core_if %p\n", -+ hc->hc_num, core_if);//GRAYG -+ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; -+ core_if->hc_xfer_info[hc->hc_num].hc = hc; -+ /* Start a timer for this transfer. */ -+ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); -+ } -+#endif -+ -+} -+ -+/** -+ * This function continues a data transfer that was started by previous call -+ * to dwc_otg_hc_start_transfer. The caller must ensure there is -+ * sufficient space in the request queue and Tx Data FIFO. This function -+ * should only be called in Slave mode. In DMA mode, the controller acts -+ * autonomously to complete transfers programmed to a host channel. -+ * -+ * For an OUT transfer, a new data packet is loaded into the appropriate FIFO -+ * if there is any data remaining to be queued. For an IN transfer, another -+ * data packet is always requested. For the SETUP phase of a control transfer, -+ * this function does nothing. -+ * -+ * @return 1 if a new request is queued, 0 if no more requests are required -+ * for this transfer. -+ */ -+int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ -+ if (hc->do_split) { -+ /* SPLITs always queue just once per channel */ -+ return 0; -+ } else if (hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { -+ /* SETUPs are queued only once since they can't be NAKed. */ -+ return 0; -+ } else if (hc->ep_is_in) { -+ /* -+ * Always queue another request for other IN transfers. If -+ * back-to-back INs are issued and NAKs are received for both, -+ * the driver may still be processing the first NAK when the -+ * second NAK is received. When the interrupt handler clears -+ * the NAK interrupt for the first NAK, the second NAK will -+ * not be seen. So we can't depend on the NAK interrupt -+ * handler to requeue a NAKed request. Instead, IN requests -+ * are issued each time this function is called. When the -+ * transfer completes, the extra requests for the channel will -+ * be flushed. -+ */ -+ hcchar_data_t hcchar; -+ dwc_otg_hc_regs_t *hc_regs = -+ core_if->host_if->hc_regs[hc->hc_num]; -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hc_set_even_odd_frame(core_if, hc, &hcchar); -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ DWC_DEBUGPL(DBG_HCDV, " IN xfer: hcchar = 0x%08x\n", -+ hcchar.d32); -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ hc->requests++; -+ return 1; -+ } else { -+ /* OUT transfers. */ -+ if (hc->xfer_count < hc->xfer_len) { -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ hcchar_data_t hcchar; -+ dwc_otg_hc_regs_t *hc_regs; -+ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hc_set_even_odd_frame(core_if, hc, &hcchar); -+ } -+ -+ /* Load OUT packet into the appropriate Tx FIFO. */ -+ dwc_otg_hc_write_packet(core_if, hc); -+ hc->requests++; -+ return 1; -+ } else { -+ return 0; -+ } -+ } -+} -+ -+/** -+ * Starts a PING transfer. This function should only be called in Slave mode. -+ * The Do Ping bit is set in the HCTSIZ register, then the channel is enabled. -+ */ -+void dwc_otg_hc_do_ping(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ -+ hctsiz.d32 = 0; -+ hctsiz.b.dopng = 1; -+ hctsiz.b.pktcnt = 1; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+} -+ -+/* -+ * This function writes a packet into the Tx FIFO associated with the Host -+ * Channel. For a channel associated with a non-periodic EP, the non-periodic -+ * Tx FIFO is written. For a channel associated with a periodic EP, the -+ * periodic Tx FIFO is written. This function should only be called in Slave -+ * mode. -+ * -+ * Upon return the xfer_buff and xfer_count fields in _hc are incremented by -+ * then number of bytes written to the Tx FIFO. -+ */ -+void dwc_otg_hc_write_packet(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ uint32_t i; -+ uint32_t remaining_count; -+ uint32_t byte_count; -+ uint32_t dword_count; -+ -+ uint32_t *data_buff = (uint32_t *) (hc->xfer_buff); -+ uint32_t *data_fifo = core_if->data_fifo[hc->hc_num]; -+ -+ remaining_count = hc->xfer_len - hc->xfer_count; -+ if (remaining_count > hc->max_packet) { -+ byte_count = hc->max_packet; -+ } else { -+ byte_count = remaining_count; -+ } -+ -+ dword_count = (byte_count + 3) / 4; -+ -+ if ((((unsigned long)data_buff) & 0x3) == 0) { -+ /* xfer_buff is DWORD aligned. */ -+ for (i = 0; i < dword_count; i++, data_buff++) { -+ DWC_WRITE_REG32(data_fifo, *data_buff); -+ } -+ } else { -+ /* xfer_buff is not DWORD aligned. */ -+ for (i = 0; i < dword_count; i++, data_buff++) { -+ uint32_t data; -+ data = -+ (data_buff[0] | data_buff[1] << 8 | data_buff[2] << -+ 16 | data_buff[3] << 24); -+ DWC_WRITE_REG32(data_fifo, data); -+ } -+ } -+ -+ hc->xfer_count += byte_count; -+ hc->xfer_buff += byte_count; -+} -+ -+/** -+ * Gets the current USB frame number. This is the frame number from the last -+ * SOF packet. -+ */ -+uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ /* read current frame/microframe number from DSTS register */ -+ return dsts.b.soffn; -+} -+ -+/** -+ * Calculates and gets the frame Interval value of HFIR register according PHY -+ * type and speed.The application can modify a value of HFIR register only after -+ * the Port Enable bit of the Host Port Control and Status register -+ * (HPRT.PrtEnaPort) has been set. -+*/ -+ -+uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if) -+{ -+ gusbcfg_data_t usbcfg; -+ hwcfg2_data_t hwcfg2; -+ hprt0_data_t hprt0; -+ int clock = 60; // default value -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ hwcfg2.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ if (!usbcfg.b.physel && usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) -+ clock = 60; -+ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 3) -+ clock = 48; -+ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && -+ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) -+ clock = 30; -+ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && -+ !usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) -+ clock = 60; -+ if (usbcfg.b.phylpwrclksel && !usbcfg.b.physel && -+ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) -+ clock = 48; -+ if (usbcfg.b.physel && !usbcfg.b.phyif && hwcfg2.b.fs_phy_type == 2) -+ clock = 48; -+ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 1) -+ clock = 48; -+ if (hprt0.b.prtspd == 0) -+ /* High speed case */ -+ return 125 * clock - 1; -+ else -+ /* FS/LS case */ -+ return 1000 * clock - 1; -+} -+ -+/** -+ * This function reads a setup packet from the Rx FIFO into the destination -+ * buffer. This function is called from the Rx Status Queue Level (RxStsQLvl) -+ * Interrupt routine when a SETUP packet has been received in Slave mode. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dest Destination buffer for packet data. -+ */ -+void dwc_otg_read_setup_packet(dwc_otg_core_if_t * core_if, uint32_t * dest) -+{ -+ device_grxsts_data_t status; -+ /* Get the 8 bytes of a setup transaction data */ -+ -+ /* Pop 2 DWORDS off the receive data FIFO into memory */ -+ dest[0] = DWC_READ_REG32(core_if->data_fifo[0]); -+ dest[1] = DWC_READ_REG32(core_if->data_fifo[0]); -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ status.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->grxstsp); -+ DWC_DEBUGPL(DBG_ANY, -+ "EP:%d BCnt:%d " "pktsts:%x Frame:%d(0x%0x)\n", -+ status.b.epnum, status.b.bcnt, status.b.pktsts, -+ status.b.fn, status.b.fn); -+ } -+} -+ -+/** -+ * This function enables EP0 OUT to receive SETUP packets and configures EP0 -+ * IN for transmitting packets. It is normally called when the -+ * "Enumeration Done" interrupt occurs. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP0 data. -+ */ -+void dwc_otg_ep0_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dsts_data_t dsts; -+ depctl_data_t diepctl; -+ depctl_data_t doepctl; -+ dctl_data_t dctl = {.d32 = 0 }; -+ -+ ep->stp_rollover = 0; -+ /* Read the Device Status and Endpoint 0 Control registers */ -+ dsts.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dsts); -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); -+ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); -+ -+ /* Set the MPS of the IN EP based on the enumeration speed */ -+ switch (dsts.b.enumspd) { -+ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: -+ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: -+ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: -+ diepctl.b.mps = DWC_DEP0CTL_MPS_64; -+ break; -+ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: -+ diepctl.b.mps = DWC_DEP0CTL_MPS_8; -+ break; -+ } -+ -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); -+ -+ /* Enable OUT EP for receive */ -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ doepctl.b.epena = 1; -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); -+ } -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); -+ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); -+#endif -+ dctl.b.cgnpinnak = 1; -+ -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ DWC_DEBUGPL(DBG_PCDV, "dctl=%0x\n", -+ DWC_READ_REG32(&dev_if->dev_global_regs->dctl)); -+ -+} -+ -+/** -+ * This function activates an EP. The Device EP control register for -+ * the EP is configured as defined in the ep structure. Note: This -+ * function is not used for EP0. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to activate. -+ */ -+void dwc_otg_ep_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ depctl_data_t depctl; -+ volatile uint32_t *addr; -+ daint_data_t daintmsk = {.d32 = 0 }; -+ dcfg_data_t dcfg; -+ uint8_t i; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s() EP%d-%s\n", __func__, ep->num, -+ (ep->is_in ? "IN" : "OUT")); -+ -+#ifdef DWC_UTE_PER_IO -+ ep->xiso_frame_num = 0xFFFFFFFF; -+ ep->xiso_active_xfers = 0; -+ ep->xiso_queued_xfers = 0; -+#endif -+ /* Read DEPCTLn register */ -+ if (ep->is_in == 1) { -+ addr = &dev_if->in_ep_regs[ep->num]->diepctl; -+ daintmsk.ep.in = 1 << ep->num; -+ } else { -+ addr = &dev_if->out_ep_regs[ep->num]->doepctl; -+ daintmsk.ep.out = 1 << ep->num; -+ } -+ -+ /* If the EP is already active don't change the EP Control -+ * register. */ -+ depctl.d32 = DWC_READ_REG32(addr); -+ if (!depctl.b.usbactep) { -+ depctl.b.mps = ep->maxpacket; -+ depctl.b.eptype = ep->type; -+ depctl.b.txfnum = ep->tx_fifo_num; -+ -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ depctl.b.setd0pid = 1; // ??? -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ depctl.b.usbactep = 1; -+ -+ /* Update nextep_seq array and EPMSCNT in DCFG*/ -+ if (!(depctl.b.eptype & 1) && (ep->is_in == 1)) { // NP IN EP -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ if (core_if->nextep_seq[i] == core_if->first_in_nextep_seq) -+ break; -+ } -+ core_if->nextep_seq[i] = ep->num; -+ core_if->nextep_seq[ep->num] = core_if->first_in_nextep_seq; -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt++; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV, "%2d\n", -+ core_if->nextep_seq[i]); -+ } -+ -+ } -+ -+ -+ DWC_WRITE_REG32(addr, depctl.d32); -+ DWC_DEBUGPL(DBG_PCDV, "DEPCTL=%08x\n", DWC_READ_REG32(addr)); -+ } -+ -+ /* Enable the Interrupt for this EP */ -+ if (core_if->multiproc_int_enable) { -+ if (ep->is_in == 1) { -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.xfercompl = 1; -+ diepmsk.b.timeout = 1; -+ diepmsk.b.epdisabled = 1; -+ diepmsk.b.ahberr = 1; -+ diepmsk.b.intknepmis = 1; -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) -+ diepmsk.b.intknepmis = 0; -+ diepmsk.b.txfifoundrn = 1; //????? -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ diepmsk.b.nak = 1; -+ } -+ -+ -+ -+/* -+ if (core_if->dma_desc_enable) { -+ diepmsk.b.bna = 1; -+ } -+*/ -+/* -+ if (core_if->dma_enable) { -+ doepmsk.b.nak = 1; -+ } -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs-> -+ diepeachintmsk[ep->num], diepmsk.d32); -+ -+ } else { -+ doepmsk_data_t doepmsk = {.d32 = 0 }; -+ doepmsk.b.xfercompl = 1; -+ doepmsk.b.ahberr = 1; -+ doepmsk.b.epdisabled = 1; -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) -+ doepmsk.b.outtknepdis = 1; -+ -+/* -+ -+ if (core_if->dma_desc_enable) { -+ doepmsk.b.bna = 1; -+ } -+*/ -+/* -+ doepmsk.b.babble = 1; -+ doepmsk.b.nyet = 1; -+ doepmsk.b.nak = 1; -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs-> -+ doepeachintmsk[ep->num], doepmsk.d32); -+ } -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->deachintmsk, -+ 0, daintmsk.d32); -+ } else { -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (ep->is_in) { -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.nak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, 0, diepmsk.d32); -+ } else { -+ doepmsk_data_t doepmsk = {.d32 = 0 }; -+ doepmsk.b.outtknepdis = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->doepmsk, 0, doepmsk.d32); -+ } -+ } -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->daintmsk, -+ 0, daintmsk.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "DAINTMSK=%0x\n", -+ DWC_READ_REG32(&dev_if->dev_global_regs->daintmsk)); -+ -+ ep->stall_clear_flag = 0; -+ -+ return; -+} -+ -+/** -+ * This function deactivates an EP. This is done by clearing the USB Active -+ * EP bit in the Device EP control register. Note: This function is not used -+ * for EP0. EP0 cannot be deactivated. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to deactivate. -+ */ -+void dwc_otg_ep_deactivate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ daint_data_t daintmsk = {.d32 = 0 }; -+ dcfg_data_t dcfg; -+ uint8_t i = 0; -+ -+#ifdef DWC_UTE_PER_IO -+ ep->xiso_frame_num = 0xFFFFFFFF; -+ ep->xiso_active_xfers = 0; -+ ep->xiso_queued_xfers = 0; -+#endif -+ -+ /* Read DEPCTLn register */ -+ if (ep->is_in == 1) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ daintmsk.ep.in = 1 << ep->num; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ daintmsk.ep.out = 1 << ep->num; -+ } -+ -+ depctl.d32 = DWC_READ_REG32(addr); -+ -+ depctl.b.usbactep = 0; -+ -+ /* Update nextep_seq array and EPMSCNT in DCFG*/ -+ if (!(depctl.b.eptype & 1) && ep->is_in == 1) { // NP EP IN -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ if (core_if->nextep_seq[i] == ep->num) -+ break; -+ } -+ core_if->nextep_seq[i] = core_if->nextep_seq[ep->num]; -+ if (core_if->first_in_nextep_seq == ep->num) -+ core_if->first_in_nextep_seq = i; -+ core_if->nextep_seq[ep->num] = 0xff; -+ depctl.b.nextep = 0; -+ dcfg.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt--; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, -+ dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); -+ } -+ } -+ -+ if (ep->is_in == 1) -+ depctl.b.txfnum = 0; -+ -+ if (core_if->dma_desc_enable) -+ depctl.b.epdis = 1; -+ -+ DWC_WRITE_REG32(addr, depctl.d32); -+ depctl.d32 = DWC_READ_REG32(addr); -+ if (core_if->dma_enable && ep->type == DWC_OTG_EP_TYPE_ISOC -+ && depctl.b.epena) { -+ depctl_data_t depctl = {.d32 = 0}; -+ if (ep->is_in) { -+ diepint_data_t diepint = {.d32 = 0}; -+ -+ depctl.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepctl, depctl.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->in_ep_regs[ep->num]-> -+ diepint); -+ } while (!diepint.b.inepnakeff); -+ diepint.b.inepnakeff = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepint, diepint.d32); -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepctl, depctl.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->in_ep_regs[ep->num]-> -+ diepint); -+ } while (!diepint.b.epdisabled); -+ diepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepint, diepint.d32); -+ } else { -+ dctl_data_t dctl = {.d32 = 0}; -+ gintmsk_data_t gintsts = {.d32 = 0}; -+ doepint_data_t doepint = {.d32 = 0}; -+ dctl.b.sgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, 0, dctl.d32); -+ do { -+ dwc_udelay(10); -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ } while (!gintsts.b.goutnakeff); -+ gintsts.d32 = 0; -+ gintsts.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepctl, depctl.d32); -+ do -+ { -+ dwc_udelay(10); -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->num]->doepint); -+ } while (!doepint.b.epdisabled); -+ -+ doepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepint, doepint.d32); -+ -+ dctl.d32 = 0; -+ dctl.b.cgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } -+ } -+ -+ /* Disable the Interrupt for this EP */ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, -+ daintmsk.d32, 0); -+ -+ if (ep->is_in == 1) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ diepeachintmsk[ep->num], 0); -+ } else { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[ep->num], 0); -+ } -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->daintmsk, -+ daintmsk.d32, 0); -+ } -+ -+} -+ -+/** -+ * This function initializes dma descriptor chain. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+static void init_dma_desc_chain(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ uint32_t offset; -+ uint32_t xfer_est; -+ int i; -+ unsigned maxxfer_local, total_len; -+ -+ if (!ep->is_in && ep->type == DWC_OTG_EP_TYPE_INTR && -+ (ep->maxpacket%4)) { -+ maxxfer_local = ep->maxpacket; -+ total_len = ep->xfer_len; -+ } else { -+ maxxfer_local = ep->maxxfer; -+ total_len = ep->total_len; -+ } -+ -+ ep->desc_cnt = (total_len / maxxfer_local) + -+ ((total_len % maxxfer_local) ? 1 : 0); -+ -+ if (!ep->desc_cnt) -+ ep->desc_cnt = 1; -+ -+ if (ep->desc_cnt > MAX_DMA_DESC_CNT) -+ ep->desc_cnt = MAX_DMA_DESC_CNT; -+ -+ dma_desc = ep->desc_addr; -+ if (maxxfer_local == ep->maxpacket) { -+ if ((total_len % maxxfer_local) && -+ (total_len/maxxfer_local < MAX_DMA_DESC_CNT)) { -+ xfer_est = (ep->desc_cnt - 1) * maxxfer_local + -+ (total_len % maxxfer_local); -+ } else -+ xfer_est = ep->desc_cnt * maxxfer_local; -+ } else -+ xfer_est = total_len; -+ offset = 0; -+ for (i = 0; i < ep->desc_cnt; ++i) { -+ /** DMA Descriptor Setup */ -+ if (xfer_est > maxxfer_local) { -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 0; -+ dma_desc->status.b.ioc = 0; -+ dma_desc->status.b.sp = 0; -+ dma_desc->status.b.bytes = maxxfer_local; -+ dma_desc->buf = ep->dma_addr + offset; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ xfer_est -= maxxfer_local; -+ offset += maxxfer_local; -+ } else { -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ if (ep->is_in) { -+ dma_desc->status.b.sp = -+ (xfer_est % -+ ep->maxpacket) ? 1 : ((ep-> -+ sent_zlp) ? 1 : 0); -+ dma_desc->status.b.bytes = xfer_est; -+ } else { -+ if (maxxfer_local == ep->maxpacket) -+ dma_desc->status.b.bytes = xfer_est; -+ else -+ dma_desc->status.b.bytes = -+ xfer_est + ((4 - (xfer_est & 0x3)) & 0x3); -+ } -+ -+ dma_desc->buf = ep->dma_addr + offset; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ } -+ dma_desc++; -+ } -+} -+/** -+ * This function is called when to write ISOC data into appropriate dedicated -+ * periodic FIFO. -+ */ -+static int32_t write_isoc_tx_fifo(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ dtxfsts_data_t txstatus = {.d32 = 0 }; -+ uint32_t len = 0; -+ int epnum = dwc_ep->num; -+ int dwords; -+ -+ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); -+ -+ ep_regs = core_if->dev_if->in_ep_regs[epnum]; -+ -+ len = dwc_ep->xfer_len - dwc_ep->xfer_count; -+ -+ if (len > dwc_ep->maxpacket) { -+ len = dwc_ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); -+ -+ while (txstatus.b.txfspcavail > dwords && -+ dwc_ep->xfer_count < dwc_ep->xfer_len && dwc_ep->xfer_len != 0) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, dwc_ep, 0); -+ -+ len = dwc_ep->xfer_len - dwc_ep->xfer_count; -+ if (len > dwc_ep->maxpacket) { -+ len = dwc_ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, -+ txstatus.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); -+ -+ return 1; -+} -+/** -+ * This function does the setup for a data transfer for an EP and -+ * starts the transfer. For an IN transfer, the packets will be -+ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, -+ * the packets are unloaded from the Rx FIFO in the ISR. the ISR. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+ -+void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ deptsiz_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); -+ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " -+ "xfer_buff=%p start_xfer_buff=%p, total_len = %d\n", -+ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, -+ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff, -+ ep->total_len); -+ /* IN endpoint */ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[ep->num]; -+ -+ gnptxsts_data_t gtxstatus; -+ -+ gtxstatus.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); -+ -+ if (core_if->en_multiple_tx_fifo == 0 -+ && gtxstatus.b.nptxqspcavail == 0 && !core_if->dma_enable) { -+#ifdef DEBUG -+ DWC_PRINTF("TX Queue Full (0x%0x)\n", gtxstatus.d32); -+#endif -+ return; -+ } -+ -+ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); -+ -+ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) -+ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? -+ ep->maxxfer : (ep->total_len - ep->xfer_len); -+ else -+ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len - ep->xfer_len)) ? -+ MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); -+ -+ -+ /* Zero Length Packet? */ -+ if ((ep->xfer_len - ep->xfer_count) == 0) { -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 1; -+ } else { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - ep->xfer_count - 1 + -+ ep->maxpacket) / ep->maxpacket; -+ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { -+ deptsiz.b.pktcnt = MAX_PKT_CNT; -+ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; -+ } -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) -+ deptsiz.b.mc = deptsiz.b.pktcnt; -+ } -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ if (ep->type != DWC_OTG_EP_TYPE_ISOC) -+ deptsiz.b.mc = 1; -+ DWC_WRITE_REG32(&in_regs->dieptsiz, -+ deptsiz.d32); -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+#ifdef DWC_UTE_CFI -+ /* The descriptor chain should be already initialized by now */ -+ if (ep->buff_mode != BM_STANDARD) { -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ ep->descs_dma_addr); -+ } else { -+#endif -+ init_dma_desc_chain(core_if, ep); -+ /** DIEPDMAn Register write */ -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ ep->dma_desc_addr); -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ } -+ } else { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ if (ep->type != DWC_OTG_EP_TYPE_ISOC) { -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, -+ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, -+ * the data will be written into the fifo by the ISR. -+ */ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32 -+ (&core_if->core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk = 1 << ep->num; -+ DWC_MODIFY_REG32 -+ (&core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ -+ } -+ } -+ } else { -+ write_isoc_tx_fifo(core_if, ep); -+ } -+ } -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ dsts_data_t dsts = {.d32 = 0}; -+ if (ep->bInterval == 1) { -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dsts); -+ ep->frame_num = dsts.b.soffn + ep->bInterval; -+ if (ep->frame_num > 0x3FFF) { -+ ep->frm_overrun = 1; -+ ep->frame_num &= 0x3FFF; -+ } else -+ ep->frm_overrun = 0; -+ if (ep->frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } -+ } -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ } else { -+ /* OUT endpoint */ -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[ep->num]; -+ -+ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); -+ -+ if (!core_if->dma_desc_enable) { -+ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) -+ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? -+ ep->maxxfer : (ep->total_len - ep->xfer_len); -+ else -+ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len -+ - ep->xfer_len)) ? MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); -+ } -+ -+ /* Program the transfer size and packet count as follows: -+ * -+ * pktcnt = N -+ * xfersize = N * maxpacket -+ */ -+ if ((ep->xfer_len - ep->xfer_count) == 0) { -+ /* Zero Length Packet */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ } else { -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - ep->xfer_count + -+ (ep->maxpacket - 1)) / ep->maxpacket; -+ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { -+ deptsiz.b.pktcnt = MAX_PKT_CNT; -+ } -+ if (!core_if->dma_desc_enable) { -+ ep->xfer_len = -+ deptsiz.b.pktcnt * ep->maxpacket + ep->xfer_count; -+ } -+ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "ep%d xfersize=%d pktcnt=%d\n", -+ ep->num, deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+#ifdef DWC_UTE_CFI -+ /* The descriptor chain should be already initialized by now */ -+ if (ep->buff_mode != BM_STANDARD) { -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ ep->descs_dma_addr); -+ } else { -+#endif -+ /** This is used for interrupt out transfers*/ -+ if (!ep->xfer_len) -+ ep->xfer_len = ep->total_len; -+ init_dma_desc_chain(core_if, ep); -+ -+ if (core_if->core_params->dev_out_nak) { -+ if (ep->type == DWC_OTG_EP_TYPE_BULK) { -+ deptsiz.b.pktcnt = (ep->total_len + -+ (ep->maxpacket - 1)) / ep->maxpacket; -+ deptsiz.b.xfersize = ep->total_len; -+ /* Remember initial value of doeptsiz */ -+ core_if->start_doeptsiz_val[ep->num] = deptsiz.d32; -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ } -+ } -+ /** DOEPDMAn Register write */ -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ ep->dma_desc_addr); -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ } -+ } else { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } -+ -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ dsts_data_t dsts = {.d32 = 0}; -+ if (ep->bInterval == 1) { -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dsts); -+ ep->frame_num = dsts.b.soffn + ep->bInterval; -+ if (ep->frame_num > 0x3FFF) { -+ ep->frm_overrun = 1; -+ ep->frame_num &= 0x3FFF; -+ } else -+ ep->frm_overrun = 0; -+ -+ if (ep->frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } -+ } -+ -+ /* EP enable */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ -+ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); -+ -+ DWC_DEBUGPL(DBG_PCD, "DOEPCTL=%08x DOEPTSIZ=%08x\n", -+ DWC_READ_REG32(&out_regs->doepctl), -+ DWC_READ_REG32(&out_regs->doeptsiz)); -+ DWC_DEBUGPL(DBG_PCD, "DAINTMSK=%08x GINTMSK=%08x\n", -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> -+ daintmsk), -+ DWC_READ_REG32(&core_if->core_global_regs-> -+ gintmsk)); -+ -+ /* Timer is scheduling only for out bulk transfers for -+ * "Device DDMA OUT NAK Enhancement" feature to inform user -+ * about received data payload in case of timeout -+ */ -+ if (core_if->core_params->dev_out_nak) { -+ if (ep->type == DWC_OTG_EP_TYPE_BULK) { -+ core_if->ep_xfer_info[ep->num].core_if = core_if; -+ core_if->ep_xfer_info[ep->num].ep = ep; -+ core_if->ep_xfer_info[ep->num].state = 1; -+ -+ /* Start a timer for this transfer. */ -+ DWC_TIMER_SCHEDULE(core_if->ep_xfer_timer[ep->num], 10000); -+ } -+ } -+ } -+} -+ -+/** -+ * This function setup a zero length transfer in Buffer DMA and -+ * Slave modes for usb requests with zero field set -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ -+ depctl_data_t depctl; -+ deptsiz_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); -+ DWC_PRINTF("zero length transfer is called\n"); -+ -+ /* IN endpoint */ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[ep->num]; -+ -+ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); -+ -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 1; -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.b.mc = 1; -+ DWC_WRITE_REG32(&in_regs->dieptsiz, -+ deptsiz.d32); -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, -+ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, -+ * the data will be written into the fifo by the ISR. -+ */ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk = 1 << ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ } -+ } -+ } -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ } else { -+ /* OUT endpoint */ -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[ep->num]; -+ -+ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); -+ -+ /* Zero Length Packet */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } -+ -+ /* EP enable */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ -+ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); -+ -+ } -+} -+ -+/** -+ * This function does the setup for a data transfer for EP0 and starts -+ * the transfer. For an IN transfer, the packets will be loaded into -+ * the appropriate Tx FIFO in the ISR. For OUT transfers, the packets are -+ * unloaded from the Rx FIFO in the ISR. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP0 data. -+ */ -+void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ deptsiz0_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ -+ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " -+ "xfer_buff=%p start_xfer_buff=%p \n", -+ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, -+ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff); -+ -+ ep->total_len = ep->xfer_len; -+ -+ /* IN endpoint */ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[0]; -+ -+ gnptxsts_data_t gtxstatus; -+ -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); -+ if (depctl.b.epena) -+ return; -+ } -+ -+ gtxstatus.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); -+ -+ /* If dedicated FIFO every time flush fifo before enable ep*/ -+ if (core_if->en_multiple_tx_fifo && core_if->snpsid >= OTG_CORE_REV_3_00a) -+ dwc_otg_flush_tx_fifo(core_if, ep->tx_fifo_num); -+ -+ if (core_if->en_multiple_tx_fifo == 0 -+ && gtxstatus.b.nptxqspcavail == 0 -+ && !core_if->dma_enable) { -+#ifdef DEBUG -+ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); -+ DWC_DEBUGPL(DBG_PCD, "DIEPCTL0=%0x\n", -+ DWC_READ_REG32(&in_regs->diepctl)); -+ DWC_DEBUGPL(DBG_PCD, "DIEPTSIZ0=%0x (sz=%d, pcnt=%d)\n", -+ deptsiz.d32, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ DWC_PRINTF("TX Queue or FIFO Full (0x%0x)\n", -+ gtxstatus.d32); -+#endif -+ return; -+ } -+ -+ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); -+ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); -+ -+ /* Zero Length Packet? */ -+ if (ep->xfer_len == 0) { -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 1; -+ } else { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ if (ep->xfer_len > ep->maxpacket) { -+ ep->xfer_len = ep->maxpacket; -+ deptsiz.b.xfersize = ep->maxpacket; -+ } else { -+ deptsiz.b.xfersize = ep->xfer_len; -+ } -+ deptsiz.b.pktcnt = 1; -+ -+ } -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+ dma_desc = core_if->dev_if->in_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.sp = -+ (ep->xfer_len == ep->maxpacket) ? 0 : 1; -+ dma_desc->status.b.bytes = ep->xfer_len; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DIEPDMA0 Register write */ -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ core_if-> -+ dev_if->dma_in_desc_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ } -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, the -+ * data will be written into the fifo by the ISR. -+ */ -+ if (!core_if->dma_enable) { -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk |= 1 << ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ } -+ } -+ } -+ } else { -+ /* OUT endpoint */ -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[0]; -+ -+ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); -+ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); -+ -+ /* Program the transfer size and packet count as follows: -+ * xfersize = N * (maxpacket + 4 - (maxpacket % 4)) -+ * pktcnt = N */ -+ /* Zero Length Packet */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) -+ deptsiz.b.supcnt = 3; -+ -+ DWC_DEBUGPL(DBG_PCDV, "len=%d xfersize=%d pktcnt=%d\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+ dma_desc = core_if->dev_if->out_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ dma_desc->status.b.mtrf = 0; -+ dma_desc->status.b.sr = 0; -+ } -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.bytes = ep->maxpacket; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DOEPDMA0 Register write */ -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ core_if->dev_if-> -+ dma_out_desc_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } -+ -+ /* EP enable */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&(out_regs->doepctl), depctl.d32); -+ } -+} -+ -+/** -+ * This function continues control IN transfers started by -+ * dwc_otg_ep0_start_transfer, when the transfer does not fit in a -+ * single packet. NOTE: The DIEPCTL0/DOEPCTL0 registers only have one -+ * bit for the packet count. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP0 data. -+ */ -+void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ deptsiz0_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[0]; -+ gnptxsts_data_t tx_status = {.d32 = 0 }; -+ -+ tx_status.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); -+ /** @todo Should there be check for room in the Tx -+ * Status Queue. If not remove the code above this comment. */ -+ -+ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); -+ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); -+ -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.b.xfersize = -+ (ep->total_len - ep->xfer_count) > -+ ep->maxpacket ? ep->maxpacket : (ep->total_len - -+ ep->xfer_count); -+ deptsiz.b.pktcnt = 1; -+ if (core_if->dma_enable == 0) { -+ ep->xfer_len += deptsiz.b.xfersize; -+ } else { -+ ep->xfer_len = deptsiz.b.xfersize; -+ } -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ } else { -+ ep->xfer_len = -+ (ep->total_len - ep->xfer_count) > -+ ep->maxpacket ? ep->maxpacket : (ep->total_len - -+ ep->xfer_count); -+ -+ dma_desc = core_if->dev_if->in_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.sp = -+ (ep->xfer_len == ep->maxpacket) ? 0 : 1; -+ dma_desc->status.b.bytes = ep->xfer_len; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DIEPDMA0 Register write */ -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ core_if->dev_if->dma_in_desc_addr); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { -+ if (core_if->dma_desc_enable == 0) -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, the -+ * data will be written into the fifo by the ISR. -+ */ -+ if (!core_if->dma_enable) { -+ if (core_if->en_multiple_tx_fifo == 0) { -+ /* First clear it from GINTSTS */ -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk |= 1 << ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ } -+ } -+ } -+ } else { -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[0]; -+ -+ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); -+ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); -+ -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ -+ if (core_if->dma_desc_enable == 0) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } else { -+ dma_desc = core_if->dev_if->out_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.bytes = ep->maxpacket; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DOEPDMA0 Register write */ -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ core_if->dev_if->dma_out_desc_addr); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { -+ if (core_if->dma_desc_enable == 0) -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ -+ } -+ -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); -+ -+ } -+} -+ -+#ifdef DEBUG -+void dump_msg(const u8 * buf, unsigned int length) -+{ -+ unsigned int start, num, i; -+ char line[52], *p; -+ -+ if (length >= 512) -+ return; -+ start = 0; -+ while (length > 0) { -+ num = length < 16u ? length : 16u; -+ p = line; -+ for (i = 0; i < num; ++i) { -+ if (i == 8) -+ *p++ = ' '; -+ DWC_SPRINTF(p, " %02x", buf[i]); -+ p += 3; -+ } -+ *p = 0; -+ DWC_PRINTF("%6x: %s\n", start, line); -+ buf += num; -+ start += num; -+ length -= num; -+ } -+} -+#else -+static inline void dump_msg(const u8 * buf, unsigned int length) -+{ -+} -+#endif -+ -+/** -+ * This function writes a packet into the Tx FIFO associated with the -+ * EP. For non-periodic EPs the non-periodic Tx FIFO is written. For -+ * periodic EPs the periodic Tx FIFO associated with the EP is written -+ * with all packets for the next micro-frame. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to write packet for. -+ * @param dma Indicates if DMA is being used. -+ */ -+void dwc_otg_ep_write_packet(dwc_otg_core_if_t * core_if, dwc_ep_t * ep, -+ int dma) -+{ -+ /** -+ * The buffer is padded to DWORD on a per packet basis in -+ * slave/dma mode if the MPS is not DWORD aligned. The last -+ * packet, if short, is also padded to a multiple of DWORD. -+ * -+ * ep->xfer_buff always starts DWORD aligned in memory and is a -+ * multiple of DWORD in length -+ * -+ * ep->xfer_len can be any number of bytes -+ * -+ * ep->xfer_count is a multiple of ep->maxpacket until the last -+ * packet -+ * -+ * FIFO access is DWORD */ -+ -+ uint32_t i; -+ uint32_t byte_count; -+ uint32_t dword_count; -+ uint32_t *fifo; -+ uint32_t *data_buff = (uint32_t *) ep->xfer_buff; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p)\n", __func__, core_if, -+ ep); -+ if (ep->xfer_count >= ep->xfer_len) { -+ DWC_WARN("%s() No data for EP%d!!!\n", __func__, ep->num); -+ return; -+ } -+ -+ /* Find the byte length of the packet either short packet or MPS */ -+ if ((ep->xfer_len - ep->xfer_count) < ep->maxpacket) { -+ byte_count = ep->xfer_len - ep->xfer_count; -+ } else { -+ byte_count = ep->maxpacket; -+ } -+ -+ /* Find the DWORD length, padded by extra bytes as neccessary if MPS -+ * is not a multiple of DWORD */ -+ dword_count = (byte_count + 3) / 4; -+ -+#ifdef VERBOSE -+ dump_msg(ep->xfer_buff, byte_count); -+#endif -+ -+ /**@todo NGS Where are the Periodic Tx FIFO addresses -+ * intialized? What should this be? */ -+ -+ fifo = core_if->data_fifo[ep->num]; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "fifo=%p buff=%p *p=%08x bc=%d\n", -+ fifo, data_buff, *data_buff, byte_count); -+ -+ if (!dma) { -+ for (i = 0; i < dword_count; i++, data_buff++) { -+ DWC_WRITE_REG32(fifo, *data_buff); -+ } -+ } -+ -+ ep->xfer_count += byte_count; -+ ep->xfer_buff += byte_count; -+ ep->dma_addr += byte_count; -+} -+ -+/** -+ * Set the EP STALL. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to set the stall on. -+ */ -+void dwc_otg_ep_set_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ volatile uint32_t *depctl_addr; -+ -+ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, -+ (ep->is_in ? "IN" : "OUT")); -+ -+ if (ep->is_in == 1) { -+ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); -+ depctl.d32 = DWC_READ_REG32(depctl_addr); -+ -+ /* set the disable and stall bits */ -+ if (depctl.b.epena) { -+ depctl.b.epdis = 1; -+ } -+ depctl.b.stall = 1; -+ DWC_WRITE_REG32(depctl_addr, depctl.d32); -+ } else { -+ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); -+ depctl.d32 = DWC_READ_REG32(depctl_addr); -+ -+ /* set the stall bit */ -+ depctl.b.stall = 1; -+ DWC_WRITE_REG32(depctl_addr, depctl.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); -+ -+ return; -+} -+ -+/** -+ * Clear the EP STALL. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to clear stall from. -+ */ -+void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ volatile uint32_t *depctl_addr; -+ -+ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, -+ (ep->is_in ? "IN" : "OUT")); -+ -+ if (ep->is_in == 1) { -+ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); -+ } else { -+ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); -+ } -+ -+ depctl.d32 = DWC_READ_REG32(depctl_addr); -+ -+ /* clear the stall bits */ -+ depctl.b.stall = 0; -+ -+ /* -+ * USB Spec 9.4.5: For endpoints using data toggle, regardless -+ * of whether an endpoint has the Halt feature set, a -+ * ClearFeature(ENDPOINT_HALT) request always results in the -+ * data toggle being reinitialized to DATA0. -+ */ -+ if (ep->type == DWC_OTG_EP_TYPE_INTR || -+ ep->type == DWC_OTG_EP_TYPE_BULK) { -+ depctl.b.setd0pid = 1; /* DATA0 */ -+ } -+ -+ DWC_WRITE_REG32(depctl_addr, depctl.d32); -+ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); -+ return; -+} -+ -+/** -+ * This function reads a packet from the Rx FIFO into the destination -+ * buffer. To read SETUP data use dwc_otg_read_setup_packet. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dest Destination buffer for the packet. -+ * @param bytes Number of bytes to copy to the destination. -+ */ -+void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, -+ uint8_t * dest, uint16_t bytes) -+{ -+ int i; -+ int word_count = (bytes + 3) / 4; -+ -+ volatile uint32_t *fifo = core_if->data_fifo[0]; -+ uint32_t *data_buff = (uint32_t *) dest; -+ -+ /** -+ * @todo Account for the case where _dest is not dword aligned. This -+ * requires reading data from the FIFO into a uint32_t temp buffer, -+ * then moving it into the data buffer. -+ */ -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p,%d)\n", __func__, -+ core_if, dest, bytes); -+ -+ for (i = 0; i < word_count; i++, data_buff++) { -+ *data_buff = DWC_READ_REG32(fifo); -+ } -+ -+ return; -+} -+ -+/** -+ * This functions reads the device registers and prints them -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ volatile uint32_t *addr; -+ -+ DWC_PRINTF("Device Global Registers\n"); -+ addr = &core_if->dev_if->dev_global_regs->dcfg; -+ DWC_PRINTF("DCFG @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->dctl; -+ DWC_PRINTF("DCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->dsts; -+ DWC_PRINTF("DSTS @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->diepmsk; -+ DWC_PRINTF("DIEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->doepmsk; -+ DWC_PRINTF("DOEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->daint; -+ DWC_PRINTF("DAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->daintmsk; -+ DWC_PRINTF("DAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->dtknqr1; -+ DWC_PRINTF("DTKNQR1 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ if (core_if->hwcfg2.b.dev_token_q_depth > 6) { -+ addr = &core_if->dev_if->dev_global_regs->dtknqr2; -+ DWC_PRINTF("DTKNQR2 @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ addr = &core_if->dev_if->dev_global_regs->dvbusdis; -+ DWC_PRINTF("DVBUSID @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ addr = &core_if->dev_if->dev_global_regs->dvbuspulse; -+ DWC_PRINTF("DVBUSPULSE @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ -+ addr = &core_if->dev_if->dev_global_regs->dtknqr3_dthrctl; -+ DWC_PRINTF("DTKNQR3_DTHRCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ -+ if (core_if->hwcfg2.b.dev_token_q_depth > 22) { -+ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; -+ DWC_PRINTF("DTKNQR4 @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; -+ DWC_PRINTF("FIFOEMPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ if (core_if->hwcfg2.b.multi_proc_int) { -+ -+ addr = &core_if->dev_if->dev_global_regs->deachint; -+ DWC_PRINTF("DEACHINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->deachintmsk; -+ DWC_PRINTF("DEACHINTMSK @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ addr = -+ &core_if->dev_if-> -+ dev_global_regs->diepeachintmsk[i]; -+ DWC_PRINTF("DIEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", -+ i, (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ } -+ -+ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { -+ addr = -+ &core_if->dev_if-> -+ dev_global_regs->doepeachintmsk[i]; -+ DWC_PRINTF("DOEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", -+ i, (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ } -+ } -+ -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_PRINTF("Device IN EP %d Registers\n", i); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepctl; -+ DWC_PRINTF("DIEPCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepint; -+ DWC_PRINTF("DIEPINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->dieptsiz; -+ DWC_PRINTF("DIETSIZ @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepdma; -+ DWC_PRINTF("DIEPDMA @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->dtxfsts; -+ DWC_PRINTF("DTXFSTS @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepdmab; -+ DWC_PRINTF("DIEPDMAB @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, 0 /*DWC_READ_REG32(addr) */ ); -+ } -+ -+ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { -+ DWC_PRINTF("Device OUT EP %d Registers\n", i); -+ addr = &core_if->dev_if->out_ep_regs[i]->doepctl; -+ DWC_PRINTF("DOEPCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->out_ep_regs[i]->doepint; -+ DWC_PRINTF("DOEPINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->out_ep_regs[i]->doeptsiz; -+ DWC_PRINTF("DOETSIZ @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->out_ep_regs[i]->doepdma; -+ DWC_PRINTF("DOEPDMA @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ if (core_if->dma_enable) { /* Don't access this register in SLAVE mode */ -+ addr = &core_if->dev_if->out_ep_regs[i]->doepdmab; -+ DWC_PRINTF("DOEPDMAB @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ } -+} -+ -+/** -+ * This functions reads the SPRAM and prints its content -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_spram(dwc_otg_core_if_t * core_if) -+{ -+ volatile uint8_t *addr, *start_addr, *end_addr; -+ -+ DWC_PRINTF("SPRAM Data:\n"); -+ start_addr = (void *)core_if->core_global_regs; -+ DWC_PRINTF("Base Address: 0x%8lX\n", (unsigned long)start_addr); -+ start_addr += 0x00028000; -+ end_addr = (void *)core_if->core_global_regs; -+ end_addr += 0x000280e0; -+ -+ for (addr = start_addr; addr < end_addr; addr += 16) { -+ DWC_PRINTF -+ ("0x%8lX:\t%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X\n", -+ (unsigned long)addr, addr[0], addr[1], addr[2], addr[3], -+ addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], -+ addr[10], addr[11], addr[12], addr[13], addr[14], addr[15] -+ ); -+ } -+ -+ return; -+} -+ -+/** -+ * This function reads the host registers and prints them -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ volatile uint32_t *addr; -+ -+ DWC_PRINTF("Host Global Registers\n"); -+ addr = &core_if->host_if->host_global_regs->hcfg; -+ DWC_PRINTF("HCFG @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->hfir; -+ DWC_PRINTF("HFIR @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->hfnum; -+ DWC_PRINTF("HFNUM @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->hptxsts; -+ DWC_PRINTF("HPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->haint; -+ DWC_PRINTF("HAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->haintmsk; -+ DWC_PRINTF("HAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ if (core_if->dma_desc_enable) { -+ addr = &core_if->host_if->host_global_regs->hflbaddr; -+ DWC_PRINTF("HFLBADDR @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ addr = core_if->host_if->hprt0; -+ DWC_PRINTF("HPRT0 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ for (i = 0; i < core_if->core_params->host_channels; i++) { -+ DWC_PRINTF("Host Channel %d Specific Registers\n", i); -+ addr = &core_if->host_if->hc_regs[i]->hcchar; -+ DWC_PRINTF("HCCHAR @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcsplt; -+ DWC_PRINTF("HCSPLT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcint; -+ DWC_PRINTF("HCINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcintmsk; -+ DWC_PRINTF("HCINTMSK @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hctsiz; -+ DWC_PRINTF("HCTSIZ @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcdma; -+ DWC_PRINTF("HCDMA @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ if (core_if->dma_desc_enable) { -+ addr = &core_if->host_if->hc_regs[i]->hcdmab; -+ DWC_PRINTF("HCDMAB @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ } -+ return; -+} -+ -+/** -+ * This function reads the core global registers and prints them -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_global_registers(dwc_otg_core_if_t * core_if) -+{ -+ int i, ep_num; -+ volatile uint32_t *addr; -+ char *txfsiz; -+ -+ DWC_PRINTF("Core Global Registers\n"); -+ addr = &core_if->core_global_regs->gotgctl; -+ DWC_PRINTF("GOTGCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gotgint; -+ DWC_PRINTF("GOTGINT @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gahbcfg; -+ DWC_PRINTF("GAHBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gusbcfg; -+ DWC_PRINTF("GUSBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->grstctl; -+ DWC_PRINTF("GRSTCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gintsts; -+ DWC_PRINTF("GINTSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gintmsk; -+ DWC_PRINTF("GINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->grxstsr; -+ DWC_PRINTF("GRXSTSR @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->grxfsiz; -+ DWC_PRINTF("GRXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gnptxfsiz; -+ DWC_PRINTF("GNPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gnptxsts; -+ DWC_PRINTF("GNPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gi2cctl; -+ DWC_PRINTF("GI2CCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gpvndctl; -+ DWC_PRINTF("GPVNDCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ggpio; -+ DWC_PRINTF("GGPIO @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->guid; -+ DWC_PRINTF("GUID @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gsnpsid; -+ DWC_PRINTF("GSNPSID @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg1; -+ DWC_PRINTF("GHWCFG1 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg2; -+ DWC_PRINTF("GHWCFG2 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg3; -+ DWC_PRINTF("GHWCFG3 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg4; -+ DWC_PRINTF("GHWCFG4 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->glpmcfg; -+ DWC_PRINTF("GLPMCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gpwrdn; -+ DWC_PRINTF("GPWRDN @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gdfifocfg; -+ DWC_PRINTF("GDFIFOCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->adpctl; -+ DWC_PRINTF("ADPCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ dwc_otg_adp_read_reg(core_if)); -+ addr = &core_if->core_global_regs->hptxfsiz; -+ DWC_PRINTF("HPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ ep_num = core_if->hwcfg4.b.num_dev_perio_in_ep; -+ txfsiz = "DPTXFSIZ"; -+ } else { -+ ep_num = core_if->hwcfg4.b.num_in_eps; -+ txfsiz = "DIENPTXF"; -+ } -+ for (i = 0; i < ep_num; i++) { -+ addr = &core_if->core_global_regs->dtxfsiz[i]; -+ DWC_PRINTF("%s[%d] @0x%08lX : 0x%08X\n", txfsiz, i + 1, -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ addr = core_if->pcgcctl; -+ DWC_PRINTF("PCGCCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+} -+ -+/** -+ * Flush a Tx FIFO. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param num Tx FIFO to flush. -+ */ -+void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * core_if, const int num) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ volatile grstctl_t greset = {.d32 = 0 }; -+ int count = 0; -+ -+ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "Flush Tx FIFO %d\n", num); -+ -+ greset.b.txfflsh = 1; -+ greset.b.txfnum = num; -+ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); -+ -+ do { -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 10000) { -+ DWC_WARN("%s() HANG! GRSTCTL=%0x GNPTXSTS=0x%08x\n", -+ __func__, greset.d32, -+ DWC_READ_REG32(&global_regs->gnptxsts)); -+ break; -+ } -+ dwc_udelay(1); -+ } while (greset.b.txfflsh == 1); -+ -+ /* Wait for 3 PHY Clocks */ -+ dwc_udelay(1); -+} -+ -+/** -+ * Flush Rx FIFO. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ volatile grstctl_t greset = {.d32 = 0 }; -+ int count = 0; -+ -+ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "%s\n", __func__); -+ /* -+ * -+ */ -+ greset.b.rxfflsh = 1; -+ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); -+ -+ do { -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 10000) { -+ DWC_WARN("%s() HANG! GRSTCTL=%0x\n", __func__, -+ greset.d32); -+ break; -+ } -+ dwc_udelay(1); -+ } while (greset.b.rxfflsh == 1); -+ -+ /* Wait for 3 PHY Clocks */ -+ dwc_udelay(1); -+} -+ -+/** -+ * Do core a soft reset of the core. Be careful with this because it -+ * resets all the internal state machines of the core. -+ */ -+void dwc_otg_core_reset(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ volatile grstctl_t greset = {.d32 = 0 }; -+ int count = 0; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s\n", __func__); -+ /* Wait for AHB master IDLE state. */ -+ do { -+ dwc_udelay(10); -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 100000) { -+ DWC_WARN("%s() HANG! AHB Idle GRSTCTL=%0x\n", __func__, -+ greset.d32); -+ return; -+ } -+ } -+ while (greset.b.ahbidle == 0); -+ -+ /* Core Soft Reset */ -+ count = 0; -+ greset.b.csftrst = 1; -+ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); -+ do { -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 10000) { -+ DWC_WARN("%s() HANG! Soft Reset GRSTCTL=%0x\n", -+ __func__, greset.d32); -+ break; -+ } -+ dwc_udelay(1); -+ } -+ while (greset.b.csftrst == 1); -+ -+ /* Wait for 3 PHY Clocks */ -+ dwc_mdelay(100); -+} -+ -+uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if) -+{ -+ return (dwc_otg_mode(_core_if) != DWC_HOST_MODE); -+} -+ -+uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if) -+{ -+ return (dwc_otg_mode(_core_if) == DWC_HOST_MODE); -+} -+ -+/** -+ * Register HCD callbacks. The callbacks are used to start and stop -+ * the HCD for interrupt processing. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param cb the HCD callback structure. -+ * @param p pointer to be passed to callback function (usb_hcd*). -+ */ -+void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * core_if, -+ dwc_otg_cil_callbacks_t * cb, void *p) -+{ -+ core_if->hcd_cb = cb; -+ cb->p = p; -+} -+ -+/** -+ * Register PCD callbacks. The callbacks are used to start and stop -+ * the PCD for interrupt processing. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param cb the PCD callback structure. -+ * @param p pointer to be passed to callback function (pcd*). -+ */ -+void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * core_if, -+ dwc_otg_cil_callbacks_t * cb, void *p) -+{ -+ core_if->pcd_cb = cb; -+ cb->p = p; -+} -+ -+#ifdef DWC_EN_ISOC -+ -+/** -+ * This function writes isoc data per 1 (micro)frame into tx fifo -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void write_isoc_frame_data(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ dtxfsts_data_t txstatus = {.d32 = 0 }; -+ uint32_t len = 0; -+ uint32_t dwords; -+ -+ ep->xfer_len = ep->data_per_frame; -+ ep->xfer_count = 0; -+ -+ ep_regs = core_if->dev_if->in_ep_regs[ep->num]; -+ -+ len = ep->xfer_len - ep->xfer_count; -+ -+ if (len > ep->maxpacket) { -+ len = ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", ep->num, txstatus.d32); -+ -+ while (txstatus.b.txfspcavail > dwords && -+ ep->xfer_count < ep->xfer_len && ep->xfer_len != 0) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, ep, 0); -+ -+ len = ep->xfer_len - ep->xfer_count; -+ if (len > ep->maxpacket) { -+ len = ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", ep->num, -+ txstatus.d32); -+ } -+} -+ -+/** -+ * This function initializes a descriptor chain for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dsts_data_t dsts = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ -+ if (ep->is_in) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ } -+ -+ ep->xfer_len = ep->data_per_frame; -+ ep->xfer_count = 0; -+ ep->xfer_buff = ep->cur_pkt_addr; -+ ep->dma_addr = ep->cur_pkt_dma_addr; -+ -+ if (ep->is_in) { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.xfersize = ep->xfer_len; -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; -+ deptsiz.b.mc = deptsiz.b.pktcnt; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dieptsiz, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ DWC_WRITE_REG32(& -+ (core_if->dev_if->in_ep_regs[ep->num]-> -+ diepdma), (uint32_t) ep->dma_addr); -+ } -+ } else { -+ deptsiz.b.pktcnt = -+ (ep->xfer_len + (ep->maxpacket - 1)) / ep->maxpacket; -+ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; -+ -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->num]->doeptsiz, deptsiz.d32); -+ -+ if (core_if->dma_enable) { -+ DWC_WRITE_REG32(& -+ (core_if->dev_if-> -+ out_ep_regs[ep->num]->doepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ } -+ -+ /** Enable endpoint, clear nak */ -+ -+ depctl.d32 = 0; -+ if (ep->bInterval == 1) { -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ ep->next_frame = dsts.b.soffn + ep->bInterval; -+ -+ if (ep->next_frame & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } else { -+ ep->next_frame += ep->bInterval; -+ -+ if (ep->next_frame & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(addr, 0, depctl.d32); -+ depctl.d32 = DWC_READ_REG32(addr); -+ -+ if (ep->is_in && core_if->dma_enable == 0) { -+ write_isoc_frame_data(core_if, ep); -+ } -+ -+} -+#endif /* DWC_EN_ISOC */ -+ -+static void dwc_otg_set_uninitialized(int32_t * p, int size) -+{ -+ int i; -+ for (i = 0; i < size; i++) { -+ p[i] = -1; -+ } -+} -+ -+static int dwc_otg_param_initialized(int32_t val) -+{ -+ return val != -1; -+} -+ -+static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ core_if->core_params = DWC_ALLOC(sizeof(*core_if->core_params)); -+ if (!core_if->core_params) { -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_otg_set_uninitialized((int32_t *) core_if->core_params, -+ sizeof(*core_if->core_params) / -+ sizeof(int32_t)); -+ DWC_PRINTF("Setting default values for core params\n"); -+ dwc_otg_set_param_otg_cap(core_if, dwc_param_otg_cap_default); -+ dwc_otg_set_param_dma_enable(core_if, dwc_param_dma_enable_default); -+ dwc_otg_set_param_dma_desc_enable(core_if, -+ dwc_param_dma_desc_enable_default); -+ dwc_otg_set_param_opt(core_if, dwc_param_opt_default); -+ dwc_otg_set_param_dma_burst_size(core_if, -+ dwc_param_dma_burst_size_default); -+ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, -+ dwc_param_host_support_fs_ls_low_power_default); -+ dwc_otg_set_param_enable_dynamic_fifo(core_if, -+ dwc_param_enable_dynamic_fifo_default); -+ dwc_otg_set_param_data_fifo_size(core_if, -+ dwc_param_data_fifo_size_default); -+ dwc_otg_set_param_dev_rx_fifo_size(core_if, -+ dwc_param_dev_rx_fifo_size_default); -+ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, -+ dwc_param_dev_nperio_tx_fifo_size_default); -+ dwc_otg_set_param_host_rx_fifo_size(core_if, -+ dwc_param_host_rx_fifo_size_default); -+ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, -+ dwc_param_host_nperio_tx_fifo_size_default); -+ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, -+ dwc_param_host_perio_tx_fifo_size_default); -+ dwc_otg_set_param_max_transfer_size(core_if, -+ dwc_param_max_transfer_size_default); -+ dwc_otg_set_param_max_packet_count(core_if, -+ dwc_param_max_packet_count_default); -+ dwc_otg_set_param_host_channels(core_if, -+ dwc_param_host_channels_default); -+ dwc_otg_set_param_dev_endpoints(core_if, -+ dwc_param_dev_endpoints_default); -+ dwc_otg_set_param_phy_type(core_if, dwc_param_phy_type_default); -+ dwc_otg_set_param_speed(core_if, dwc_param_speed_default); -+ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, -+ dwc_param_host_ls_low_power_phy_clk_default); -+ dwc_otg_set_param_phy_ulpi_ddr(core_if, dwc_param_phy_ulpi_ddr_default); -+ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, -+ dwc_param_phy_ulpi_ext_vbus_default); -+ dwc_otg_set_param_phy_utmi_width(core_if, -+ dwc_param_phy_utmi_width_default); -+ dwc_otg_set_param_ts_dline(core_if, dwc_param_ts_dline_default); -+ dwc_otg_set_param_i2c_enable(core_if, dwc_param_i2c_enable_default); -+ dwc_otg_set_param_ulpi_fs_ls(core_if, dwc_param_ulpi_fs_ls_default); -+ dwc_otg_set_param_en_multiple_tx_fifo(core_if, -+ dwc_param_en_multiple_tx_fifo_default); -+ for (i = 0; i < 15; i++) { -+ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, -+ dwc_param_dev_perio_tx_fifo_size_default, -+ i); -+ } -+ -+ for (i = 0; i < 15; i++) { -+ dwc_otg_set_param_dev_tx_fifo_size(core_if, -+ dwc_param_dev_tx_fifo_size_default, -+ i); -+ } -+ dwc_otg_set_param_thr_ctl(core_if, dwc_param_thr_ctl_default); -+ dwc_otg_set_param_mpi_enable(core_if, dwc_param_mpi_enable_default); -+ dwc_otg_set_param_pti_enable(core_if, dwc_param_pti_enable_default); -+ dwc_otg_set_param_lpm_enable(core_if, dwc_param_lpm_enable_default); -+ dwc_otg_set_param_ic_usb_cap(core_if, dwc_param_ic_usb_cap_default); -+ dwc_otg_set_param_tx_thr_length(core_if, -+ dwc_param_tx_thr_length_default); -+ dwc_otg_set_param_rx_thr_length(core_if, -+ dwc_param_rx_thr_length_default); -+ dwc_otg_set_param_ahb_thr_ratio(core_if, -+ dwc_param_ahb_thr_ratio_default); -+ dwc_otg_set_param_power_down(core_if, dwc_param_power_down_default); -+ dwc_otg_set_param_reload_ctl(core_if, dwc_param_reload_ctl_default); -+ dwc_otg_set_param_dev_out_nak(core_if, dwc_param_dev_out_nak_default); -+ dwc_otg_set_param_cont_on_bna(core_if, dwc_param_cont_on_bna_default); -+ dwc_otg_set_param_ahb_single(core_if, dwc_param_ahb_single_default); -+ dwc_otg_set_param_otg_ver(core_if, dwc_param_otg_ver_default); -+ dwc_otg_set_param_adp_enable(core_if, dwc_param_adp_enable_default); -+ DWC_PRINTF("Finished setting default values for core params\n"); -+ -+ return 0; -+} -+ -+uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->dma_enable; -+} -+ -+/* Checks if the parameter is outside of its valid range of values */ -+#define DWC_OTG_PARAM_TEST(_param_, _low_, _high_) \ -+ (((_param_) < (_low_)) || \ -+ ((_param_) > (_high_))) -+ -+/* Parameter access functions */ -+int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int valid; -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { -+ DWC_WARN("Wrong value for otg_cap parameter\n"); -+ DWC_WARN("otg_cap parameter must be 0,1 or 2\n"); -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ valid = 1; -+ switch (val) { -+ case DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE: -+ if (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ valid = 0; -+ break; -+ case DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE: -+ if ((core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ && (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) -+ && (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) -+ && (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) { -+ valid = 0; -+ } -+ break; -+ case DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE: -+ /* always valid */ -+ break; -+ } -+ if (!valid) { -+ if (dwc_otg_param_initialized(core_if->core_params->otg_cap)) { -+ DWC_ERROR -+ ("%d invalid for otg_cap paremter. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (((core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ || (core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) -+ || (core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) -+ || (core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) ? -+ DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE : -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->otg_cap = val; -+out: -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->otg_cap; -+} -+ -+int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for opt parameter\n"); -+ return -DWC_E_INVALID; -+ } -+ core_if->core_params->opt = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->opt; -+} -+ -+int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for dma enable\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->hwcfg2.b.architecture == 0)) { -+ if (dwc_otg_param_initialized(core_if->core_params->dma_enable)) { -+ DWC_ERROR -+ ("%d invalid for dma_enable paremter. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dma_enable = val; -+ if (val == 0) { -+ dwc_otg_set_param_dma_desc_enable(core_if, 0); -+ } -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dma_enable; -+} -+ -+int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for dma_enable\n"); -+ DWC_WARN("dma_desc_enable must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) -+ && ((dwc_otg_get_param_dma_enable(core_if) == 0) -+ || (core_if->hwcfg4.b.desc_dma == 0))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dma_desc_enable)) { -+ DWC_ERROR -+ ("%d invalid for dma_desc_enable paremter. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ core_if->core_params->dma_desc_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dma_desc_enable; -+} -+ -+int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for host_support_fs_low_power\n"); -+ DWC_WARN("host_support_fs_low_power must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ core_if->core_params->host_support_fs_ls_low_power = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * -+ core_if) -+{ -+ return core_if->core_params->host_support_fs_ls_low_power; -+} -+ -+int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for enable_dynamic_fifo\n"); -+ DWC_WARN("enable_dynamic_fifo must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->hwcfg2.b.dynamic_fifo == 0)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->enable_dynamic_fifo)) { -+ DWC_ERROR -+ ("%d invalid for enable_dynamic_fifo paremter. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ core_if->core_params->enable_dynamic_fifo = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->enable_dynamic_fifo; -+} -+ -+int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 32, 32768)) { -+ DWC_WARN("Wrong value for data_fifo_size\n"); -+ DWC_WARN("data_fifo_size must be 32-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > core_if->hwcfg3.b.dfifo_depth) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->data_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for data_fifo_size parameter. Check HW configuration.\n", -+ val); -+ } -+ val = core_if->hwcfg3.b.dfifo_depth; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->data_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->data_fifo_size; -+} -+ -+int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for dev_rx_fifo_size\n"); -+ DWC_WARN("dev_rx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { -+ if (dwc_otg_param_initialized(core_if->core_params->dev_rx_fifo_size)) { -+ DWC_WARN("%d invalid for dev_rx_fifo_size parameter\n", val); -+ } -+ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_rx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_rx_fifo_size; -+} -+ -+int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for dev_nperio_tx_fifo\n"); -+ DWC_WARN("dev_nperio_tx_fifo must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_nperio_tx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for dev_nperio_tx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> -+ 16); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_nperio_tx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_nperio_tx_fifo_size; -+} -+ -+int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for host_rx_fifo_size\n"); -+ DWC_WARN("host_rx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_rx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for host_rx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_rx_fifo_size = val; -+ return retval; -+ -+} -+ -+int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_rx_fifo_size; -+} -+ -+int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for host_nperio_tx_fifo_size\n"); -+ DWC_WARN("host_nperio_tx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_nperio_tx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for host_nperio_tx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> -+ 16); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_nperio_tx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_nperio_tx_fifo_size; -+} -+ -+int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for host_perio_tx_fifo_size\n"); -+ DWC_WARN("host_perio_tx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > ((core_if->hptxfsiz.d32) >> 16)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_perio_tx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for host_perio_tx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = (core_if->hptxfsiz.d32) >> 16; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_perio_tx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_perio_tx_fifo_size; -+} -+ -+int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 2047, 524288)) { -+ DWC_WARN("Wrong value for max_transfer_size\n"); -+ DWC_WARN("max_transfer_size must be 2047-524288\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val >= (1 << (core_if->hwcfg3.b.xfer_size_cntr_width + 11))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->max_transfer_size)) { -+ DWC_ERROR -+ ("%d invalid for max_transfer_size. Check HW configuration.\n", -+ val); -+ } -+ val = -+ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 11)) - -+ 1); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->max_transfer_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->max_transfer_size; -+} -+ -+int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 15, 511)) { -+ DWC_WARN("Wrong value for max_packet_count\n"); -+ DWC_WARN("max_packet_count must be 15-511\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->max_packet_count)) { -+ DWC_ERROR -+ ("%d invalid for max_packet_count. Check HW configuration.\n", -+ val); -+ } -+ val = -+ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4)) - 1); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->max_packet_count = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->max_packet_count; -+} -+ -+int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 1, 16)) { -+ DWC_WARN("Wrong value for host_channels\n"); -+ DWC_WARN("host_channels must be 1-16\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (core_if->hwcfg2.b.num_host_chan + 1)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_channels)) { -+ DWC_ERROR -+ ("%d invalid for host_channels. Check HW configurations.\n", -+ val); -+ } -+ val = (core_if->hwcfg2.b.num_host_chan + 1); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_channels = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_channels; -+} -+ -+int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 1, 15)) { -+ DWC_WARN("Wrong value for dev_endpoints\n"); -+ DWC_WARN("dev_endpoints must be 1-15\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (core_if->hwcfg2.b.num_dev_ep)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_endpoints)) { -+ DWC_ERROR -+ ("%d invalid for dev_endpoints. Check HW configurations.\n", -+ val); -+ } -+ val = core_if->hwcfg2.b.num_dev_ep; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_endpoints = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_endpoints; -+} -+ -+int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { -+ DWC_WARN("Wrong value for phy_type\n"); -+ DWC_WARN("phy_type must be 0,1 or 2\n"); -+ return -DWC_E_INVALID; -+ } -+#ifndef NO_FS_PHY_HW_CHECKS -+ if ((val == DWC_PHY_TYPE_PARAM_UTMI) && -+ ((core_if->hwcfg2.b.hs_phy_type == 1) || -+ (core_if->hwcfg2.b.hs_phy_type == 3))) { -+ valid = 1; -+ } else if ((val == DWC_PHY_TYPE_PARAM_ULPI) && -+ ((core_if->hwcfg2.b.hs_phy_type == 2) || -+ (core_if->hwcfg2.b.hs_phy_type == 3))) { -+ valid = 1; -+ } else if ((val == DWC_PHY_TYPE_PARAM_FS) && -+ (core_if->hwcfg2.b.fs_phy_type == 1)) { -+ valid = 1; -+ } -+ if (!valid) { -+ if (dwc_otg_param_initialized(core_if->core_params->phy_type)) { -+ DWC_ERROR -+ ("%d invalid for phy_type. Check HW configurations.\n", -+ val); -+ } -+ if (core_if->hwcfg2.b.hs_phy_type) { -+ if ((core_if->hwcfg2.b.hs_phy_type == 3) || -+ (core_if->hwcfg2.b.hs_phy_type == 1)) { -+ val = DWC_PHY_TYPE_PARAM_UTMI; -+ } else { -+ val = DWC_PHY_TYPE_PARAM_ULPI; -+ } -+ } -+ retval = -DWC_E_INVALID; -+ } -+#endif -+ core_if->core_params->phy_type = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_type; -+} -+ -+int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for speed parameter\n"); -+ DWC_WARN("max_speed parameter must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ if ((val == 0) -+ && dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS) { -+ if (dwc_otg_param_initialized(core_if->core_params->speed)) { -+ DWC_ERROR -+ ("%d invalid for speed paremter. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (dwc_otg_get_param_phy_type(core_if) == -+ DWC_PHY_TYPE_PARAM_FS ? 1 : 0); -+ retval = -DWC_E_INVALID; -+ } -+ core_if->core_params->speed = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->speed; -+} -+ -+int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN -+ ("Wrong value for host_ls_low_power_phy_clk parameter\n"); -+ DWC_WARN("host_ls_low_power_phy_clk must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ) -+ && (dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_ls_low_power_phy_clk)) { -+ DWC_ERROR -+ ("%d invalid for host_ls_low_power_phy_clk. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (dwc_otg_get_param_phy_type(core_if) == -+ DWC_PHY_TYPE_PARAM_FS) ? -+ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ : -+ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_ls_low_power_phy_clk = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_ls_low_power_phy_clk; -+} -+ -+int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for phy_ulpi_ddr\n"); -+ DWC_WARN("phy_upli_ddr must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->phy_ulpi_ddr = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_ulpi_ddr; -+} -+ -+int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for phy_ulpi_ext_vbus\n"); -+ DWC_WARN("phy_ulpi_ext_vbus must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->phy_ulpi_ext_vbus = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_ulpi_ext_vbus; -+} -+ -+int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 8, 8) && DWC_OTG_PARAM_TEST(val, 16, 16)) { -+ DWC_WARN("Wrong valaue for phy_utmi_width\n"); -+ DWC_WARN("phy_utmi_width must be 8 or 16\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->phy_utmi_width = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_utmi_width; -+} -+ -+int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for ulpi_fs_ls\n"); -+ DWC_WARN("ulpi_fs_ls must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->ulpi_fs_ls = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ulpi_fs_ls; -+} -+ -+int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for ts_dline\n"); -+ DWC_WARN("ts_dline must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->ts_dline = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ts_dline; -+} -+ -+int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for i2c_enable\n"); -+ DWC_WARN("i2c_enable must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+#ifndef NO_FS_PHY_HW_CHECK -+ if (val == 1 && core_if->hwcfg3.b.i2c == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->i2c_enable)) { -+ DWC_ERROR -+ ("%d invalid for i2c_enable. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+#endif -+ -+ core_if->core_params->i2c_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->i2c_enable; -+} -+ -+int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val, int fifo_num) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { -+ DWC_WARN("Wrong value for dev_perio_tx_fifo_size\n"); -+ DWC_WARN("dev_perio_tx_fifo_size must be 4-768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > -+ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_perio_tx_fifo_size[fifo_num])) { -+ DWC_ERROR -+ ("`%d' invalid for parameter `dev_perio_fifo_size_%d'. Check HW configuration.\n", -+ val, fifo_num); -+ } -+ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_perio_tx_fifo_size[fifo_num] = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num) -+{ -+ return core_if->core_params->dev_perio_tx_fifo_size[fifo_num]; -+} -+ -+int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for en_multiple_tx_fifo,\n"); -+ DWC_WARN("en_multiple_tx_fifo must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val == 1 && core_if->hwcfg4.b.ded_fifo_en == 0) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->en_multiple_tx_fifo)) { -+ DWC_ERROR -+ ("%d invalid for parameter en_multiple_tx_fifo. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->en_multiple_tx_fifo = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->en_multiple_tx_fifo; -+} -+ -+int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val, -+ int fifo_num) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { -+ DWC_WARN("Wrong value for dev_tx_fifo_size\n"); -+ DWC_WARN("dev_tx_fifo_size must be 4-768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > -+ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_tx_fifo_size[fifo_num])) { -+ DWC_ERROR -+ ("`%d' invalid for parameter `dev_tx_fifo_size_%d'. Check HW configuration.\n", -+ val, fifo_num); -+ } -+ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_tx_fifo_size[fifo_num] = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num) -+{ -+ return core_if->core_params->dev_tx_fifo_size[fifo_num]; -+} -+ -+int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 7)) { -+ DWC_WARN("Wrong value for thr_ctl\n"); -+ DWC_WARN("thr_ctl must be 0-7\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val != 0) && -+ (!dwc_otg_get_param_dma_enable(core_if) || -+ !core_if->hwcfg4.b.ded_fifo_en)) { -+ if (dwc_otg_param_initialized(core_if->core_params->thr_ctl)) { -+ DWC_ERROR -+ ("%d invalid for parameter thr_ctl. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->thr_ctl = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_thr_ctl(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->thr_ctl; -+} -+ -+int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for lpm_enable\n"); -+ DWC_WARN("lpm_enable must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val && !core_if->hwcfg3.b.otg_lpm_en) { -+ if (dwc_otg_param_initialized(core_if->core_params->lpm_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter lpm_enable. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->lpm_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->lpm_enable; -+} -+ -+int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { -+ DWC_WARN("Wrong valaue for tx_thr_length\n"); -+ DWC_WARN("tx_thr_length must be 8 - 128\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->tx_thr_length = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_tx_thr_length(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->tx_thr_length; -+} -+ -+int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { -+ DWC_WARN("Wrong valaue for rx_thr_length\n"); -+ DWC_WARN("rx_thr_length must be 8 - 128\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->rx_thr_length = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_rx_thr_length(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->rx_thr_length; -+} -+ -+int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 1, 1) && -+ DWC_OTG_PARAM_TEST(val, 4, 4) && -+ DWC_OTG_PARAM_TEST(val, 8, 8) && -+ DWC_OTG_PARAM_TEST(val, 16, 16) && -+ DWC_OTG_PARAM_TEST(val, 32, 32) && -+ DWC_OTG_PARAM_TEST(val, 64, 64) && -+ DWC_OTG_PARAM_TEST(val, 128, 128) && -+ DWC_OTG_PARAM_TEST(val, 256, 256)) { -+ DWC_WARN("`%d' invalid for parameter `dma_burst_size'\n", val); -+ return -DWC_E_INVALID; -+ } -+ core_if->core_params->dma_burst_size = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dma_burst_size; -+} -+ -+int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `pti_enable'\n", val); -+ return -DWC_E_INVALID; -+ } -+ if (val && (core_if->snpsid < OTG_CORE_REV_2_72a)) { -+ if (dwc_otg_param_initialized(core_if->core_params->pti_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter pti_enable. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->pti_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->pti_enable; -+} -+ -+int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `mpi_enable'\n", val); -+ return -DWC_E_INVALID; -+ } -+ if (val && (core_if->hwcfg2.b.multi_proc_int == 0)) { -+ if (dwc_otg_param_initialized(core_if->core_params->mpi_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter mpi_enable. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->mpi_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->mpi_enable; -+} -+ -+int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `adp_enable'\n", val); -+ return -DWC_E_INVALID; -+ } -+ if (val && (core_if->hwcfg3.b.adp_supp == 0)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->adp_supp_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter adp_enable. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->adp_supp_enable = val; -+ /*Set OTG version 2.0 in case of enabling ADP*/ -+ if (val) -+ dwc_otg_set_param_otg_ver(core_if, 1); -+ -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->adp_supp_enable; -+} -+ -+int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `ic_usb_cap'\n", val); -+ DWC_WARN("ic_usb_cap must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val && (core_if->hwcfg2.b.otg_enable_ic_usb == 0)) { -+ if (dwc_otg_param_initialized(core_if->core_params->ic_usb_cap)) { -+ DWC_ERROR -+ ("%d invalid for parameter ic_usb_cap. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->ic_usb_cap = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ic_usb_cap; -+} -+ -+int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { -+ DWC_WARN("`%d' invalid for parameter `ahb_thr_ratio'\n", val); -+ DWC_WARN("ahb_thr_ratio must be 0 - 3\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val -+ && (core_if->snpsid < OTG_CORE_REV_2_81a -+ || !dwc_otg_get_param_thr_ctl(core_if))) { -+ valid = 0; -+ } else if (val -+ && ((dwc_otg_get_param_tx_thr_length(core_if) / (1 << val)) < -+ 4)) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->ahb_thr_ratio)) { -+ DWC_ERROR -+ ("%d invalid for parameter ahb_thr_ratio. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ -+ core_if->core_params->ahb_thr_ratio = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ahb_thr_ratio; -+} -+ -+int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ hwcfg4_data_t hwcfg4 = {.d32 = 0 }; -+ hwcfg4.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { -+ DWC_WARN("`%d' invalid for parameter `power_down'\n", val); -+ DWC_WARN("power_down must be 0 - 2\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 2) && (core_if->snpsid < OTG_CORE_REV_2_91a)) { -+ valid = 0; -+ } -+ if ((val == 3) -+ && ((core_if->snpsid < OTG_CORE_REV_3_00a) -+ || (hwcfg4.b.xhiber == 0))) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->power_down)) { -+ DWC_ERROR -+ ("%d invalid for parameter power_down. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->power_down = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->power_down; -+} -+ -+int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `reload_ctl'\n", val); -+ DWC_WARN("reload_ctl must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_92a)) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->reload_ctl)) { -+ DWC_ERROR("%d invalid for parameter reload_ctl." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->reload_ctl = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->reload_ctl; -+} -+ -+int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `dev_out_nak'\n", val); -+ DWC_WARN("dev_out_nak must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_93a) || -+ !(core_if->core_params->dma_desc_enable))) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->dev_out_nak)) { -+ DWC_ERROR("%d invalid for parameter dev_out_nak." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->dev_out_nak = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_out_nak; -+} -+ -+int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `cont_on_bna'\n", val); -+ DWC_WARN("cont_on_bna must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_94a) || -+ !(core_if->core_params->dma_desc_enable))) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->cont_on_bna)) { -+ DWC_ERROR("%d invalid for parameter cont_on_bna." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->cont_on_bna = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->cont_on_bna; -+} -+ -+int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `ahb_single'\n", val); -+ DWC_WARN("ahb_single must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_94a)) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->ahb_single)) { -+ DWC_ERROR("%d invalid for parameter ahb_single." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->ahb_single = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ahb_single; -+} -+ -+int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `otg_ver'\n", val); -+ DWC_WARN -+ ("otg_ver must be 0(for OTG 1.3 support) or 1(for OTG 2.0 support)\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->otg_ver = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->otg_ver; -+} -+ -+uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if) -+{ -+ gotgctl_data_t otgctl; -+ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ return otgctl.b.hstnegscs; -+} -+ -+uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if) -+{ -+ gotgctl_data_t otgctl; -+ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ return otgctl.b.sesreqscs; -+} -+ -+void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ if(core_if->otg_ver == 0) { -+ gotgctl_data_t otgctl; -+ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ otgctl.b.hnpreq = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, otgctl.d32); -+ } else { -+ core_if->otg_sts = val; -+ } -+} -+ -+uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->snpsid; -+} -+ -+uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ return gintsts.b.curmode; -+} -+ -+uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ return usbcfg.b.hnpcap; -+} -+ -+void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ usbcfg.b.hnpcap = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); -+} -+ -+uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ return usbcfg.b.srpcap; -+} -+ -+void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ usbcfg.b.srpcap = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); -+} -+ -+uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if) -+{ -+ dcfg_data_t dcfg; -+ /* originally: dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); */ -+ -+ dcfg.d32 = -1; //GRAYG -+ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)\n", __func__, core_if); -+ if (NULL == core_if) -+ DWC_ERROR("reg request with NULL core_if\n"); -+ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)\n", __func__, -+ core_if, core_if->dev_if); -+ if (NULL == core_if->dev_if) -+ DWC_ERROR("reg request with NULL dev_if\n"); -+ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)->" -+ "dev_global_regs(%p)\n", __func__, -+ core_if, core_if->dev_if, -+ core_if->dev_if->dev_global_regs); -+ if (NULL == core_if->dev_if->dev_global_regs) -+ DWC_ERROR("reg request with NULL dev_global_regs\n"); -+ else { -+ DWC_DEBUGPL(DBG_CILV, "%s - &core_if(%p)->dev_if(%p)->" -+ "dev_global_regs(%p)->dcfg = %p\n", __func__, -+ core_if, core_if->dev_if, -+ core_if->dev_if->dev_global_regs, -+ &core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ } -+ return dcfg.b.devspd; -+} -+ -+void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ dcfg_data_t dcfg; -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.b.devspd = val; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); -+} -+ -+uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ return hprt0.b.prtconnsts; -+} -+ -+uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ return dsts.b.enumspd; -+} -+ -+uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ return hprt0.b.prtpwr; -+ -+} -+ -+uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->hibernation_suspend; -+} -+ -+void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = val; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+} -+ -+uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ return hprt0.b.prtsusp; -+ -+} -+ -+void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = val; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+} -+ -+uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if) -+{ -+ hfir_data_t hfir; -+ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); -+ return hfir.b.frint; -+ -+} -+ -+void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hfir_data_t hfir; -+ uint32_t fram_int; -+ fram_int = calc_frame_interval(core_if); -+ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); -+ if (!core_if->core_params->reload_ctl) { -+ DWC_WARN("\nCannot reload HFIR register.HFIR.HFIRRldCtrl bit is" -+ "not set to 1.\nShould load driver with reload_ctl=1" -+ " module parameter\n"); -+ return; -+ } -+ switch (fram_int) { -+ case 3750: -+ if ((val < 3350) || (val > 4150)) { -+ DWC_WARN("HFIR interval for HS core and 30 MHz" -+ "clock freq should be from 3350 to 4150\n"); -+ return; -+ } -+ break; -+ case 30000: -+ if ((val < 26820) || (val > 33180)) { -+ DWC_WARN("HFIR interval for FS/LS core and 30 MHz" -+ "clock freq should be from 26820 to 33180\n"); -+ return; -+ } -+ break; -+ case 6000: -+ if ((val < 5360) || (val > 6640)) { -+ DWC_WARN("HFIR interval for HS core and 48 MHz" -+ "clock freq should be from 5360 to 6640\n"); -+ return; -+ } -+ break; -+ case 48000: -+ if ((val < 42912) || (val > 53088)) { -+ DWC_WARN("HFIR interval for FS/LS core and 48 MHz" -+ "clock freq should be from 42912 to 53088\n"); -+ return; -+ } -+ break; -+ case 7500: -+ if ((val < 6700) || (val > 8300)) { -+ DWC_WARN("HFIR interval for HS core and 60 MHz" -+ "clock freq should be from 6700 to 8300\n"); -+ return; -+ } -+ break; -+ case 60000: -+ if ((val < 53640) || (val > 65536)) { -+ DWC_WARN("HFIR interval for FS/LS core and 60 MHz" -+ "clock freq should be from 53640 to 65536\n"); -+ return; -+ } -+ break; -+ default: -+ DWC_WARN("Unknown frame interval\n"); -+ return; -+ break; -+ -+ } -+ hfir.b.frint = val; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hfir.d32); -+} -+ -+uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if) -+{ -+ hcfg_data_t hcfg; -+ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ return hcfg.b.modechtimen; -+ -+} -+ -+void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hcfg_data_t hcfg; -+ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ hcfg.b.modechtimen = val; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+} -+ -+void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtres = val; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+} -+ -+uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if) -+{ -+ dctl_data_t dctl; -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ return dctl.b.rmtwkupsig; -+} -+ -+uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ -+ DWC_ASSERT(! -+ ((core_if->lx_state == DWC_OTG_L1) ^ lpmcfg.b.prt_sleep_sts), -+ "lx_state = %d, lmpcfg.prt_sleep_sts = %d\n", -+ core_if->lx_state, lpmcfg.b.prt_sleep_sts); -+ -+ return lpmcfg.b.prt_sleep_sts; -+} -+ -+uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.rem_wkup_en; -+} -+ -+uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.appl_resp; -+} -+ -+void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.appl_resp = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+} -+ -+uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.hsic_connect; -+} -+ -+void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.hsic_connect = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+} -+ -+uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.inv_sel_hsic; -+ -+} -+ -+void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.inv_sel_hsic = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+} -+ -+uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+} -+ -+void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, val); -+} -+ -+uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+} -+ -+void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, val); -+} -+ -+uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+} -+ -+void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, val); -+} -+ -+uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); -+} -+ -+void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, val); -+} -+ -+uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gpvndctl); -+} -+ -+void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gpvndctl, val); -+} -+ -+uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->ggpio); -+} -+ -+void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, val); -+} -+ -+uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(core_if->host_if->hprt0); -+ -+} -+ -+void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(core_if->host_if->hprt0, val); -+} -+ -+uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->guid); -+} -+ -+void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->guid, val); -+} -+ -+uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); -+} -+ -+uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if) -+{ -+ return ((core_if->otg_ver == 1) ? (uint16_t)0x0200 : (uint16_t)0x0103); -+} -+ -+/** -+ * Start the SRP timer to detect when the SRP does not complete within -+ * 6 seconds. -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+void dwc_otg_pcd_start_srp_timer(dwc_otg_core_if_t * core_if) -+{ -+ core_if->srp_timer_started = 1; -+ DWC_TIMER_SCHEDULE(core_if->srp_timer, 6000 /* 6 secs */ ); -+} -+ -+void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t *addr = (uint32_t *) & (core_if->core_global_regs->gotgctl); -+ gotgctl_data_t mem; -+ gotgctl_data_t val; -+ -+ val.d32 = DWC_READ_REG32(addr); -+ if (val.b.sesreq) { -+ DWC_ERROR("Session Request Already active!\n"); -+ return; -+ } -+ -+ DWC_INFO("Session Request Initated\n"); //NOTICE -+ mem.d32 = DWC_READ_REG32(addr); -+ mem.b.sesreq = 1; -+ DWC_WRITE_REG32(addr, mem.d32); -+ -+ /* Start the SRP timer */ -+ dwc_otg_pcd_start_srp_timer(core_if); -+ return; -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.h b/drivers/usb/host/dwc_otg/dwc_otg_cil.h -new file mode 100644 -index 0000000000000000000000000000000000000000..79dbf8374f023e262e3bfb755ff0f67604a456cb ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.h -@@ -0,0 +1,1464 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $ -+ * $Revision: #123 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_CIL_H__) -+#define __DWC_CIL_H__ -+ -+#include "dwc_list.h" -+#include "dwc_otg_dbg.h" -+#include "dwc_otg_regs.h" -+ -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_adp.h" -+ -+/** -+ * @file -+ * This file contains the interface to the Core Interface Layer. -+ */ -+ -+#ifdef DWC_UTE_CFI -+ -+#define MAX_DMA_DESCS_PER_EP 256 -+ -+/** -+ * Enumeration for the data buffer mode -+ */ -+typedef enum _data_buffer_mode { -+ BM_STANDARD = 0, /* data buffer is in normal mode */ -+ BM_SG = 1, /* data buffer uses the scatter/gather mode */ -+ BM_CONCAT = 2, /* data buffer uses the concatenation mode */ -+ BM_CIRCULAR = 3, /* data buffer uses the circular DMA mode */ -+ BM_ALIGN = 4 /* data buffer is in buffer alignment mode */ -+} data_buffer_mode_e; -+#endif //DWC_UTE_CFI -+ -+/** Macros defined for DWC OTG HW Release version */ -+ -+#define OTG_CORE_REV_2_60a 0x4F54260A -+#define OTG_CORE_REV_2_71a 0x4F54271A -+#define OTG_CORE_REV_2_72a 0x4F54272A -+#define OTG_CORE_REV_2_80a 0x4F54280A -+#define OTG_CORE_REV_2_81a 0x4F54281A -+#define OTG_CORE_REV_2_90a 0x4F54290A -+#define OTG_CORE_REV_2_91a 0x4F54291A -+#define OTG_CORE_REV_2_92a 0x4F54292A -+#define OTG_CORE_REV_2_93a 0x4F54293A -+#define OTG_CORE_REV_2_94a 0x4F54294A -+#define OTG_CORE_REV_3_00a 0x4F54300A -+ -+/** -+ * Information for each ISOC packet. -+ */ -+typedef struct iso_pkt_info { -+ uint32_t offset; -+ uint32_t length; -+ int32_t status; -+} iso_pkt_info_t; -+ -+/** -+ * The dwc_ep structure represents the state of a single -+ * endpoint when acting in device mode. It contains the data items -+ * needed for an endpoint to be activated and transfer packets. -+ */ -+typedef struct dwc_ep { -+ /** EP number used for register address lookup */ -+ uint8_t num; -+ /** EP direction 0 = OUT */ -+ unsigned is_in:1; -+ /** EP active. */ -+ unsigned active:1; -+ -+ /** -+ * Periodic Tx FIFO # for IN EPs For INTR EP set to 0 to use non-periodic -+ * Tx FIFO. If dedicated Tx FIFOs are enabled Tx FIFO # FOR IN EPs*/ -+ unsigned tx_fifo_num:4; -+ /** EP type: 0 - Control, 1 - ISOC, 2 - BULK, 3 - INTR */ -+ unsigned type:2; -+#define DWC_OTG_EP_TYPE_CONTROL 0 -+#define DWC_OTG_EP_TYPE_ISOC 1 -+#define DWC_OTG_EP_TYPE_BULK 2 -+#define DWC_OTG_EP_TYPE_INTR 3 -+ -+ /** DATA start PID for INTR and BULK EP */ -+ unsigned data_pid_start:1; -+ /** Frame (even/odd) for ISOC EP */ -+ unsigned even_odd_frame:1; -+ /** Max Packet bytes */ -+ unsigned maxpacket:11; -+ -+ /** Max Transfer size */ -+ uint32_t maxxfer; -+ -+ /** @name Transfer state */ -+ /** @{ */ -+ -+ /** -+ * Pointer to the beginning of the transfer buffer -- do not modify -+ * during transfer. -+ */ -+ -+ dwc_dma_t dma_addr; -+ -+ dwc_dma_t dma_desc_addr; -+ dwc_otg_dev_dma_desc_t *desc_addr; -+ -+ uint8_t *start_xfer_buff; -+ /** pointer to the transfer buffer */ -+ uint8_t *xfer_buff; -+ /** Number of bytes to transfer */ -+ unsigned xfer_len:19; -+ /** Number of bytes transferred. */ -+ unsigned xfer_count:19; -+ /** Sent ZLP */ -+ unsigned sent_zlp:1; -+ /** Total len for control transfer */ -+ unsigned total_len:19; -+ -+ /** stall clear flag */ -+ unsigned stall_clear_flag:1; -+ -+ /** SETUP pkt cnt rollover flag for EP0 out*/ -+ unsigned stp_rollover; -+ -+#ifdef DWC_UTE_CFI -+ /* The buffer mode */ -+ data_buffer_mode_e buff_mode; -+ -+ /* The chain of DMA descriptors. -+ * MAX_DMA_DESCS_PER_EP will be allocated for each active EP. -+ */ -+ dwc_otg_dma_desc_t *descs; -+ -+ /* The DMA address of the descriptors chain start */ -+ dma_addr_t descs_dma_addr; -+ /** This variable stores the length of the last enqueued request */ -+ uint32_t cfi_req_len; -+#endif //DWC_UTE_CFI -+ -+/** Max DMA Descriptor count for any EP */ -+#define MAX_DMA_DESC_CNT 256 -+ /** Allocated DMA Desc count */ -+ uint32_t desc_cnt; -+ -+ /** bInterval */ -+ uint32_t bInterval; -+ /** Next frame num to setup next ISOC transfer */ -+ uint32_t frame_num; -+ /** Indicates SOF number overrun in DSTS */ -+ uint8_t frm_overrun; -+ -+#ifdef DWC_UTE_PER_IO -+ /** Next frame num for which will be setup DMA Desc */ -+ uint32_t xiso_frame_num; -+ /** bInterval */ -+ uint32_t xiso_bInterval; -+ /** Count of currently active transfers - shall be either 0 or 1 */ -+ int xiso_active_xfers; -+ int xiso_queued_xfers; -+#endif -+#ifdef DWC_EN_ISOC -+ /** -+ * Variables specific for ISOC EPs -+ * -+ */ -+ /** DMA addresses of ISOC buffers */ -+ dwc_dma_t dma_addr0; -+ dwc_dma_t dma_addr1; -+ -+ dwc_dma_t iso_dma_desc_addr; -+ dwc_otg_dev_dma_desc_t *iso_desc_addr; -+ -+ /** pointer to the transfer buffers */ -+ uint8_t *xfer_buff0; -+ uint8_t *xfer_buff1; -+ -+ /** number of ISOC Buffer is processing */ -+ uint32_t proc_buf_num; -+ /** Interval of ISOC Buffer processing */ -+ uint32_t buf_proc_intrvl; -+ /** Data size for regular frame */ -+ uint32_t data_per_frame; -+ -+ /* todo - pattern data support is to be implemented in the future */ -+ /** Data size for pattern frame */ -+ uint32_t data_pattern_frame; -+ /** Frame number of pattern data */ -+ uint32_t sync_frame; -+ -+ /** bInterval */ -+ uint32_t bInterval; -+ /** ISO Packet number per frame */ -+ uint32_t pkt_per_frm; -+ /** Next frame num for which will be setup DMA Desc */ -+ uint32_t next_frame; -+ /** Number of packets per buffer processing */ -+ uint32_t pkt_cnt; -+ /** Info for all isoc packets */ -+ iso_pkt_info_t *pkt_info; -+ /** current pkt number */ -+ uint32_t cur_pkt; -+ /** current pkt number */ -+ uint8_t *cur_pkt_addr; -+ /** current pkt number */ -+ uint32_t cur_pkt_dma_addr; -+#endif /* DWC_EN_ISOC */ -+ -+/** @} */ -+} dwc_ep_t; -+ -+/* -+ * Reasons for halting a host channel. -+ */ -+typedef enum dwc_otg_halt_status { -+ DWC_OTG_HC_XFER_NO_HALT_STATUS, -+ DWC_OTG_HC_XFER_COMPLETE, -+ DWC_OTG_HC_XFER_URB_COMPLETE, -+ DWC_OTG_HC_XFER_ACK, -+ DWC_OTG_HC_XFER_NAK, -+ DWC_OTG_HC_XFER_NYET, -+ DWC_OTG_HC_XFER_STALL, -+ DWC_OTG_HC_XFER_XACT_ERR, -+ DWC_OTG_HC_XFER_FRAME_OVERRUN, -+ DWC_OTG_HC_XFER_BABBLE_ERR, -+ DWC_OTG_HC_XFER_DATA_TOGGLE_ERR, -+ DWC_OTG_HC_XFER_AHB_ERR, -+ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE, -+ DWC_OTG_HC_XFER_URB_DEQUEUE -+} dwc_otg_halt_status_e; -+ -+/** -+ * Host channel descriptor. This structure represents the state of a single -+ * host channel when acting in host mode. It contains the data items needed to -+ * transfer packets to an endpoint via a host channel. -+ */ -+typedef struct dwc_hc { -+ /** Host channel number used for register address lookup */ -+ uint8_t hc_num; -+ -+ /** Device to access */ -+ unsigned dev_addr:7; -+ -+ /** EP to access */ -+ unsigned ep_num:4; -+ -+ /** EP direction. 0: OUT, 1: IN */ -+ unsigned ep_is_in:1; -+ -+ /** -+ * EP speed. -+ * One of the following values: -+ * - DWC_OTG_EP_SPEED_LOW -+ * - DWC_OTG_EP_SPEED_FULL -+ * - DWC_OTG_EP_SPEED_HIGH -+ */ -+ unsigned speed:2; -+#define DWC_OTG_EP_SPEED_LOW 0 -+#define DWC_OTG_EP_SPEED_FULL 1 -+#define DWC_OTG_EP_SPEED_HIGH 2 -+ -+ /** -+ * Endpoint type. -+ * One of the following values: -+ * - DWC_OTG_EP_TYPE_CONTROL: 0 -+ * - DWC_OTG_EP_TYPE_ISOC: 1 -+ * - DWC_OTG_EP_TYPE_BULK: 2 -+ * - DWC_OTG_EP_TYPE_INTR: 3 -+ */ -+ unsigned ep_type:2; -+ -+ /** Max packet size in bytes */ -+ unsigned max_packet:11; -+ -+ /** -+ * PID for initial transaction. -+ * 0: DATA0,
-+ * 1: DATA2,
-+ * 2: DATA1,
-+ * 3: MDATA (non-Control EP), -+ * SETUP (Control EP) -+ */ -+ unsigned data_pid_start:2; -+#define DWC_OTG_HC_PID_DATA0 0 -+#define DWC_OTG_HC_PID_DATA2 1 -+#define DWC_OTG_HC_PID_DATA1 2 -+#define DWC_OTG_HC_PID_MDATA 3 -+#define DWC_OTG_HC_PID_SETUP 3 -+ -+ /** Number of periodic transactions per (micro)frame */ -+ unsigned multi_count:2; -+ -+ /** @name Transfer State */ -+ /** @{ */ -+ -+ /** Pointer to the current transfer buffer position. */ -+ uint8_t *xfer_buff; -+ /** -+ * In Buffer DMA mode this buffer will be used -+ * if xfer_buff is not DWORD aligned. -+ */ -+ dwc_dma_t align_buff; -+ /** Total number of bytes to transfer. */ -+ uint32_t xfer_len; -+ /** Number of bytes transferred so far. */ -+ uint32_t xfer_count; -+ /** Packet count at start of transfer.*/ -+ uint16_t start_pkt_count; -+ -+ /** -+ * Flag to indicate whether the transfer has been started. Set to 1 if -+ * it has been started, 0 otherwise. -+ */ -+ uint8_t xfer_started; -+ -+ /** -+ * Set to 1 to indicate that a PING request should be issued on this -+ * channel. If 0, process normally. -+ */ -+ uint8_t do_ping; -+ -+ /** -+ * Set to 1 to indicate that the error count for this transaction is -+ * non-zero. Set to 0 if the error count is 0. -+ */ -+ uint8_t error_state; -+ -+ /** -+ * Set to 1 to indicate that this channel should be halted the next -+ * time a request is queued for the channel. This is necessary in -+ * slave mode if no request queue space is available when an attempt -+ * is made to halt the channel. -+ */ -+ uint8_t halt_on_queue; -+ -+ /** -+ * Set to 1 if the host channel has been halted, but the core is not -+ * finished flushing queued requests. Otherwise 0. -+ */ -+ uint8_t halt_pending; -+ -+ /** -+ * Reason for halting the host channel. -+ */ -+ dwc_otg_halt_status_e halt_status; -+ -+ /* -+ * Split settings for the host channel -+ */ -+ uint8_t do_split; /**< Enable split for the channel */ -+ uint8_t complete_split; /**< Enable complete split */ -+ uint8_t hub_addr; /**< Address of high speed hub */ -+ -+ uint8_t port_addr; /**< Port of the low/full speed device */ -+ /** Split transaction position -+ * One of the following values: -+ * - DWC_HCSPLIT_XACTPOS_MID -+ * - DWC_HCSPLIT_XACTPOS_BEGIN -+ * - DWC_HCSPLIT_XACTPOS_END -+ * - DWC_HCSPLIT_XACTPOS_ALL */ -+ uint8_t xact_pos; -+ -+ /** Set when the host channel does a short read. */ -+ uint8_t short_read; -+ -+ /** -+ * Number of requests issued for this channel since it was assigned to -+ * the current transfer (not counting PINGs). -+ */ -+ uint8_t requests; -+ -+ /** -+ * Queue Head for the transfer being processed by this channel. -+ */ -+ struct dwc_otg_qh *qh; -+ -+ /** @} */ -+ -+ /** Entry in list of host channels. */ -+ DWC_CIRCLEQ_ENTRY(dwc_hc) hc_list_entry; -+ -+ /** @name Descriptor DMA support */ -+ /** @{ */ -+ -+ /** Number of Transfer Descriptors */ -+ uint16_t ntd; -+ -+ /** Descriptor List DMA address */ -+ dwc_dma_t desc_list_addr; -+ -+ /** Scheduling micro-frame bitmap. */ -+ uint8_t schinfo; -+ -+ /** @} */ -+} dwc_hc_t; -+ -+/** -+ * The following parameters may be specified when starting the module. These -+ * parameters define how the DWC_otg controller should be configured. -+ */ -+typedef struct dwc_otg_core_params { -+ int32_t opt; -+ -+ /** -+ * Specifies the OTG capabilities. The driver will automatically -+ * detect the value for this parameter if none is specified. -+ * 0 - HNP and SRP capable (default) -+ * 1 - SRP Only capable -+ * 2 - No HNP/SRP capable -+ */ -+ int32_t otg_cap; -+ -+ /** -+ * Specifies whether to use slave or DMA mode for accessing the data -+ * FIFOs. The driver will automatically detect the value for this -+ * parameter if none is specified. -+ * 0 - Slave -+ * 1 - DMA (default, if available) -+ */ -+ int32_t dma_enable; -+ -+ /** -+ * When DMA mode is enabled specifies whether to use address DMA or DMA -+ * Descriptor mode for accessing the data FIFOs in device mode. The driver -+ * will automatically detect the value for this if none is specified. -+ * 0 - address DMA -+ * 1 - DMA Descriptor(default, if available) -+ */ -+ int32_t dma_desc_enable; -+ /** The DMA Burst size (applicable only for External DMA -+ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) -+ */ -+ int32_t dma_burst_size; /* Translate this to GAHBCFG values */ -+ -+ /** -+ * Specifies the maximum speed of operation in host and device mode. -+ * The actual speed depends on the speed of the attached device and -+ * the value of phy_type. The actual speed depends on the speed of the -+ * attached device. -+ * 0 - High Speed (default) -+ * 1 - Full Speed -+ */ -+ int32_t speed; -+ /** Specifies whether low power mode is supported when attached -+ * to a Full Speed or Low Speed device in host mode. -+ * 0 - Don't support low power mode (default) -+ * 1 - Support low power mode -+ */ -+ int32_t host_support_fs_ls_low_power; -+ -+ /** Specifies the PHY clock rate in low power mode when connected to a -+ * Low Speed device in host mode. This parameter is applicable only if -+ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS -+ * then defaults to 6 MHZ otherwise 48 MHZ. -+ * -+ * 0 - 48 MHz -+ * 1 - 6 MHz -+ */ -+ int32_t host_ls_low_power_phy_clk; -+ -+ /** -+ * 0 - Use cC FIFO size parameters -+ * 1 - Allow dynamic FIFO sizing (default) -+ */ -+ int32_t enable_dynamic_fifo; -+ -+ /** Total number of 4-byte words in the data FIFO memory. This -+ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic -+ * Tx FIFOs. -+ * 32 to 32768 (default 8192) -+ * Note: The total FIFO memory depth in the FPGA configuration is 8192. -+ */ -+ int32_t data_fifo_size; -+ -+ /** Number of 4-byte words in the Rx FIFO in device mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1064) -+ */ -+ int32_t dev_rx_fifo_size; -+ -+ /** Number of 4-byte words in the non-periodic Tx FIFO in device mode -+ * when dynamic FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t dev_nperio_tx_fifo_size; -+ -+ /** Number of 4-byte words in each of the periodic Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; -+ -+ /** Number of 4-byte words in the Rx FIFO in host mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t host_rx_fifo_size; -+ -+ /** Number of 4-byte words in the non-periodic Tx FIFO in host mode -+ * when Dynamic FIFO sizing is enabled in the core. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t host_nperio_tx_fifo_size; -+ -+ /** Number of 4-byte words in the host periodic Tx FIFO when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t host_perio_tx_fifo_size; -+ -+ /** The maximum transfer size supported in bytes. -+ * 2047 to 65,535 (default 65,535) -+ */ -+ int32_t max_transfer_size; -+ -+ /** The maximum number of packets in a transfer. -+ * 15 to 511 (default 511) -+ */ -+ int32_t max_packet_count; -+ -+ /** The number of host channel registers to use. -+ * 1 to 16 (default 12) -+ * Note: The FPGA configuration supports a maximum of 12 host channels. -+ */ -+ int32_t host_channels; -+ -+ /** The number of endpoints in addition to EP0 available for device -+ * mode operations. -+ * 1 to 15 (default 6 IN and OUT) -+ * Note: The FPGA configuration supports a maximum of 6 IN and OUT -+ * endpoints in addition to EP0. -+ */ -+ int32_t dev_endpoints; -+ -+ /** -+ * Specifies the type of PHY interface to use. By default, the driver -+ * will automatically detect the phy_type. -+ * -+ * 0 - Full Speed PHY -+ * 1 - UTMI+ (default) -+ * 2 - ULPI -+ */ -+ int32_t phy_type; -+ -+ /** -+ * Specifies the UTMI+ Data Width. This parameter is -+ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI -+ * PHY_TYPE, this parameter indicates the data width between -+ * the MAC and the ULPI Wrapper.) Also, this parameter is -+ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set -+ * to "8 and 16 bits", meaning that the core has been -+ * configured to work at either data path width. -+ * -+ * 8 or 16 bits (default 16) -+ */ -+ int32_t phy_utmi_width; -+ -+ /** -+ * Specifies whether the ULPI operates at double or single -+ * data rate. This parameter is only applicable if PHY_TYPE is -+ * ULPI. -+ * -+ * 0 - single data rate ULPI interface with 8 bit wide data -+ * bus (default) -+ * 1 - double data rate ULPI interface with 4 bit wide data -+ * bus -+ */ -+ int32_t phy_ulpi_ddr; -+ -+ /** -+ * Specifies whether to use the internal or external supply to -+ * drive the vbus with a ULPI phy. -+ */ -+ int32_t phy_ulpi_ext_vbus; -+ -+ /** -+ * Specifies whether to use the I2Cinterface for full speed PHY. This -+ * parameter is only applicable if PHY_TYPE is FS. -+ * 0 - No (default) -+ * 1 - Yes -+ */ -+ int32_t i2c_enable; -+ -+ int32_t ulpi_fs_ls; -+ -+ int32_t ts_dline; -+ -+ /** -+ * Specifies whether dedicated transmit FIFOs are -+ * enabled for non periodic IN endpoints in device mode -+ * 0 - No -+ * 1 - Yes -+ */ -+ int32_t en_multiple_tx_fifo; -+ -+ /** Number of 4-byte words in each of the Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; -+ -+ /** Thresholding enable flag- -+ * bit 0 - enable non-ISO Tx thresholding -+ * bit 1 - enable ISO Tx thresholding -+ * bit 2 - enable Rx thresholding -+ */ -+ uint32_t thr_ctl; -+ -+ /** Thresholding length for Tx -+ * FIFOs in 32 bit DWORDs -+ */ -+ uint32_t tx_thr_length; -+ -+ /** Thresholding length for Rx -+ * FIFOs in 32 bit DWORDs -+ */ -+ uint32_t rx_thr_length; -+ -+ /** -+ * Specifies whether LPM (Link Power Management) support is enabled -+ */ -+ int32_t lpm_enable; -+ -+ /** Per Transfer Interrupt -+ * mode enable flag -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t pti_enable; -+ -+ /** Multi Processor Interrupt -+ * mode enable flag -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t mpi_enable; -+ -+ /** IS_USB Capability -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t ic_usb_cap; -+ -+ /** AHB Threshold Ratio -+ * 2'b00 AHB Threshold = MAC Threshold -+ * 2'b01 AHB Threshold = 1/2 MAC Threshold -+ * 2'b10 AHB Threshold = 1/4 MAC Threshold -+ * 2'b11 AHB Threshold = 1/8 MAC Threshold -+ */ -+ int32_t ahb_thr_ratio; -+ -+ /** ADP Support -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t adp_supp_enable; -+ -+ /** HFIR Reload Control -+ * 0 - The HFIR cannot be reloaded dynamically. -+ * 1 - Allow dynamic reloading of the HFIR register during runtime. -+ */ -+ int32_t reload_ctl; -+ -+ /** DCFG: Enable device Out NAK -+ * 0 - The core does not set NAK after Bulk Out transfer complete. -+ * 1 - The core sets NAK after Bulk OUT transfer complete. -+ */ -+ int32_t dev_out_nak; -+ -+ /** DCFG: Enable Continue on BNA -+ * After receiving BNA interrupt the core disables the endpoint,when the -+ * endpoint is re-enabled by the application the core starts processing -+ * 0 - from the DOEPDMA descriptor -+ * 1 - from the descriptor which received the BNA. -+ */ -+ int32_t cont_on_bna; -+ -+ /** GAHBCFG: AHB Single Support -+ * This bit when programmed supports SINGLE transfers for remainder -+ * data in a transfer for DMA mode of operation. -+ * 0 - in this case the remainder data will be sent using INCR burst size. -+ * 1 - in this case the remainder data will be sent using SINGLE burst size. -+ */ -+ int32_t ahb_single; -+ -+ /** Core Power down mode -+ * 0 - No Power Down is enabled -+ * 1 - Reserved -+ * 2 - Complete Power Down (Hibernation) -+ */ -+ int32_t power_down; -+ -+ /** OTG revision supported -+ * 0 - OTG 1.3 revision -+ * 1 - OTG 2.0 revision -+ */ -+ int32_t otg_ver; -+ -+} dwc_otg_core_params_t; -+ -+#ifdef DEBUG -+struct dwc_otg_core_if; -+typedef struct hc_xfer_info { -+ struct dwc_otg_core_if *core_if; -+ dwc_hc_t *hc; -+} hc_xfer_info_t; -+#endif -+ -+typedef struct ep_xfer_info { -+ struct dwc_otg_core_if *core_if; -+ dwc_ep_t *ep; -+ uint8_t state; -+} ep_xfer_info_t; -+/* -+ * Device States -+ */ -+typedef enum dwc_otg_lx_state { -+ /** On state */ -+ DWC_OTG_L0, -+ /** LPM sleep state*/ -+ DWC_OTG_L1, -+ /** USB suspend state*/ -+ DWC_OTG_L2, -+ /** Off state*/ -+ DWC_OTG_L3 -+} dwc_otg_lx_state_e; -+ -+struct dwc_otg_global_regs_backup { -+ uint32_t gotgctl_local; -+ uint32_t gintmsk_local; -+ uint32_t gahbcfg_local; -+ uint32_t gusbcfg_local; -+ uint32_t grxfsiz_local; -+ uint32_t gnptxfsiz_local; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ uint32_t glpmcfg_local; -+#endif -+ uint32_t gi2cctl_local; -+ uint32_t hptxfsiz_local; -+ uint32_t pcgcctl_local; -+ uint32_t gdfifocfg_local; -+ uint32_t dtxfsiz_local[MAX_EPS_CHANNELS]; -+ uint32_t gpwrdn_local; -+ uint32_t xhib_pcgcctl; -+ uint32_t xhib_gpwrdn; -+}; -+ -+struct dwc_otg_host_regs_backup { -+ uint32_t hcfg_local; -+ uint32_t haintmsk_local; -+ uint32_t hcintmsk_local[MAX_EPS_CHANNELS]; -+ uint32_t hprt0_local; -+ uint32_t hfir_local; -+}; -+ -+struct dwc_otg_dev_regs_backup { -+ uint32_t dcfg; -+ uint32_t dctl; -+ uint32_t daintmsk; -+ uint32_t diepmsk; -+ uint32_t doepmsk; -+ uint32_t diepctl[MAX_EPS_CHANNELS]; -+ uint32_t dieptsiz[MAX_EPS_CHANNELS]; -+ uint32_t diepdma[MAX_EPS_CHANNELS]; -+}; -+/** -+ * The dwc_otg_core_if structure contains information needed to manage -+ * the DWC_otg controller acting in either host or device mode. It -+ * represents the programming view of the controller as a whole. -+ */ -+struct dwc_otg_core_if { -+ /** Parameters that define how the core should be configured.*/ -+ dwc_otg_core_params_t *core_params; -+ -+ /** Core Global registers starting at offset 000h. */ -+ dwc_otg_core_global_regs_t *core_global_regs; -+ -+ /** Device-specific information */ -+ dwc_otg_dev_if_t *dev_if; -+ /** Host-specific information */ -+ dwc_otg_host_if_t *host_if; -+ -+ /** Value from SNPSID register */ -+ uint32_t snpsid; -+ -+ /* -+ * Set to 1 if the core PHY interface bits in USBCFG have been -+ * initialized. -+ */ -+ uint8_t phy_init_done; -+ -+ /* -+ * SRP Success flag, set by srp success interrupt in FS I2C mode -+ */ -+ uint8_t srp_success; -+ uint8_t srp_timer_started; -+ /** Timer for SRP. If it expires before SRP is successful -+ * clear the SRP. */ -+ dwc_timer_t *srp_timer; -+ -+#ifdef DWC_DEV_SRPCAP -+ /* This timer is needed to power on the hibernated host core if SRP is not -+ * initiated on connected SRP capable device for limited period of time -+ */ -+ uint8_t pwron_timer_started; -+ dwc_timer_t *pwron_timer; -+#endif -+ /* Common configuration information */ -+ /** Power and Clock Gating Control Register */ -+ volatile uint32_t *pcgcctl; -+#define DWC_OTG_PCGCCTL_OFFSET 0xE00 -+ -+ /** Push/pop addresses for endpoints or host channels.*/ -+ uint32_t *data_fifo[MAX_EPS_CHANNELS]; -+#define DWC_OTG_DATA_FIFO_OFFSET 0x1000 -+#define DWC_OTG_DATA_FIFO_SIZE 0x1000 -+ -+ /** Total RAM for FIFOs (Bytes) */ -+ uint16_t total_fifo_size; -+ /** Size of Rx FIFO (Bytes) */ -+ uint16_t rx_fifo_size; -+ /** Size of Non-periodic Tx FIFO (Bytes) */ -+ uint16_t nperio_tx_fifo_size; -+ -+ /** 1 if DMA is enabled, 0 otherwise. */ -+ uint8_t dma_enable; -+ -+ /** 1 if DMA descriptor is enabled, 0 otherwise. */ -+ uint8_t dma_desc_enable; -+ -+ /** 1 if PTI Enhancement mode is enabled, 0 otherwise. */ -+ uint8_t pti_enh_enable; -+ -+ /** 1 if MPI Enhancement mode is enabled, 0 otherwise. */ -+ uint8_t multiproc_int_enable; -+ -+ /** 1 if dedicated Tx FIFOs are enabled, 0 otherwise. */ -+ uint8_t en_multiple_tx_fifo; -+ -+ /** Set to 1 if multiple packets of a high-bandwidth transfer is in -+ * process of being queued */ -+ uint8_t queuing_high_bandwidth; -+ -+ /** Hardware Configuration -- stored here for convenience.*/ -+ hwcfg1_data_t hwcfg1; -+ hwcfg2_data_t hwcfg2; -+ hwcfg3_data_t hwcfg3; -+ hwcfg4_data_t hwcfg4; -+ fifosize_data_t hptxfsiz; -+ -+ /** Host and Device Configuration -- stored here for convenience.*/ -+ hcfg_data_t hcfg; -+ dcfg_data_t dcfg; -+ -+ /** The operational State, during transations -+ * (a_host>>a_peripherial and b_device=>b_host) this may not -+ * match the core but allows the software to determine -+ * transitions. -+ */ -+ uint8_t op_state; -+ -+ /** -+ * Set to 1 if the HCD needs to be restarted on a session request -+ * interrupt. This is required if no connector ID status change has -+ * occurred since the HCD was last disconnected. -+ */ -+ uint8_t restart_hcd_on_session_req; -+ -+ /** HCD callbacks */ -+ /** A-Device is a_host */ -+#define A_HOST (1) -+ /** A-Device is a_suspend */ -+#define A_SUSPEND (2) -+ /** A-Device is a_peripherial */ -+#define A_PERIPHERAL (3) -+ /** B-Device is operating as a Peripheral. */ -+#define B_PERIPHERAL (4) -+ /** B-Device is operating as a Host. */ -+#define B_HOST (5) -+ -+ /** HCD callbacks */ -+ struct dwc_otg_cil_callbacks *hcd_cb; -+ /** PCD callbacks */ -+ struct dwc_otg_cil_callbacks *pcd_cb; -+ -+ /** Device mode Periodic Tx FIFO Mask */ -+ uint32_t p_tx_msk; -+ /** Device mode Periodic Tx FIFO Mask */ -+ uint32_t tx_msk; -+ -+ /** Workqueue object used for handling several interrupts */ -+ dwc_workq_t *wq_otg; -+ -+ /** Timer object used for handling "Wakeup Detected" Interrupt */ -+ dwc_timer_t *wkp_timer; -+ /** This arrays used for debug purposes for DEV OUT NAK enhancement */ -+ uint32_t start_doeptsiz_val[MAX_EPS_CHANNELS]; -+ ep_xfer_info_t ep_xfer_info[MAX_EPS_CHANNELS]; -+ dwc_timer_t *ep_xfer_timer[MAX_EPS_CHANNELS]; -+#ifdef DEBUG -+ uint32_t start_hcchar_val[MAX_EPS_CHANNELS]; -+ -+ hc_xfer_info_t hc_xfer_info[MAX_EPS_CHANNELS]; -+ dwc_timer_t *hc_xfer_timer[MAX_EPS_CHANNELS]; -+ -+ uint32_t hfnum_7_samples; -+ uint64_t hfnum_7_frrem_accum; -+ uint32_t hfnum_0_samples; -+ uint64_t hfnum_0_frrem_accum; -+ uint32_t hfnum_other_samples; -+ uint64_t hfnum_other_frrem_accum; -+#endif -+ -+#ifdef DWC_UTE_CFI -+ uint16_t pwron_rxfsiz; -+ uint16_t pwron_gnptxfsiz; -+ uint16_t pwron_txfsiz[15]; -+ -+ uint16_t init_rxfsiz; -+ uint16_t init_gnptxfsiz; -+ uint16_t init_txfsiz[15]; -+#endif -+ -+ /** Lx state of device */ -+ dwc_otg_lx_state_e lx_state; -+ -+ /** Saved Core Global registers */ -+ struct dwc_otg_global_regs_backup *gr_backup; -+ /** Saved Host registers */ -+ struct dwc_otg_host_regs_backup *hr_backup; -+ /** Saved Device registers */ -+ struct dwc_otg_dev_regs_backup *dr_backup; -+ -+ /** Power Down Enable */ -+ uint32_t power_down; -+ -+ /** ADP support Enable */ -+ uint32_t adp_enable; -+ -+ /** ADP structure object */ -+ dwc_otg_adp_t adp; -+ -+ /** hibernation/suspend flag */ -+ int hibernation_suspend; -+ -+ /** Device mode extended hibernation flag */ -+ int xhib; -+ -+ /** OTG revision supported */ -+ uint32_t otg_ver; -+ -+ /** OTG status flag used for HNP polling */ -+ uint8_t otg_sts; -+ -+ /** Pointer to either hcd->lock or pcd->lock */ -+ dwc_spinlock_t *lock; -+ -+ /** Start predict NextEP based on Learning Queue if equal 1, -+ * also used as counter of disabled NP IN EP's */ -+ uint8_t start_predict; -+ -+ /** NextEp sequence, including EP0: nextep_seq[] = EP if non-periodic and -+ * active, 0xff otherwise */ -+ uint8_t nextep_seq[MAX_EPS_CHANNELS]; -+ -+ /** Index of fisrt EP in nextep_seq array which should be re-enabled **/ -+ uint8_t first_in_nextep_seq; -+ -+ /** Frame number while entering to ISR - needed for ISOCs **/ -+ uint32_t frame_num; -+ -+}; -+ -+#ifdef DEBUG -+/* -+ * This function is called when transfer is timed out. -+ */ -+extern void hc_xfer_timeout(void *ptr); -+#endif -+ -+/* -+ * This function is called when transfer is timed out on endpoint. -+ */ -+extern void ep_xfer_timeout(void *ptr); -+ -+/* -+ * The following functions are functions for works -+ * using during handling some interrupts -+ */ -+extern void w_conn_id_status_change(void *p); -+ -+extern void w_wakeup_detected(void *p); -+ -+/** Saves global register values into system memory. */ -+extern int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if); -+/** Saves device register values into system memory. */ -+extern int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if); -+/** Saves host register values into system memory. */ -+extern int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if); -+/** Restore global register values. */ -+extern int dwc_otg_restore_global_regs(dwc_otg_core_if_t * core_if); -+/** Restore host register values. */ -+extern int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset); -+/** Restore device register values. */ -+extern int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, -+ int rem_wakeup); -+extern int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if); -+extern int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, -+ int is_host); -+ -+extern int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int restore_mode, int reset); -+extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset); -+ -+/* -+ * The following functions support initialization of the CIL driver component -+ * and the DWC_otg controller. -+ */ -+extern void dwc_otg_core_host_init(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_core_dev_init(dwc_otg_core_if_t * _core_if); -+ -+/** @name Device CIL Functions -+ * The following functions support managing the DWC_otg controller in device -+ * mode. -+ */ -+/**@{*/ -+extern void dwc_otg_wakeup(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_read_setup_packet(dwc_otg_core_if_t * _core_if, -+ uint32_t * _dest); -+extern uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_ep0_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_deactivate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep_write_packet(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep, int _dma); -+extern void dwc_otg_ep_set_stall(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * _core_if); -+ -+#ifdef DWC_EN_ISOC -+extern void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep); -+extern void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep); -+#endif /* DWC_EN_ISOC */ -+/**@}*/ -+ -+/** @name Host CIL Functions -+ * The following functions support managing the DWC_otg controller in host -+ * mode. -+ */ -+/**@{*/ -+extern void dwc_otg_hc_init(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); -+extern void dwc_otg_hc_halt(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc, dwc_otg_halt_status_e _halt_status); -+extern void dwc_otg_hc_cleanup(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); -+extern void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc); -+extern int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc); -+extern void dwc_otg_hc_do_ping(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); -+extern void dwc_otg_hc_write_packet(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc); -+extern void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * _core_if); -+ -+extern void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, -+ dwc_hc_t * hc); -+ -+extern uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if); -+ -+/* Macro used to clear one channel interrupt */ -+#define clear_hc_int(_hc_regs_, _intr_) \ -+do { \ -+ hcint_data_t hcint_clear = {.d32 = 0}; \ -+ hcint_clear.b._intr_ = 1; \ -+ DWC_WRITE_REG32(&(_hc_regs_)->hcint, hcint_clear.d32); \ -+} while (0) -+ -+/* -+ * Macro used to disable one channel interrupt. Channel interrupts are -+ * disabled when the channel is halted or released by the interrupt handler. -+ * There is no need to handle further interrupts of that type until the -+ * channel is re-assigned. In fact, subsequent handling may cause crashes -+ * because the channel structures are cleaned up when the channel is released. -+ */ -+#define disable_hc_int(_hc_regs_, _intr_) \ -+do { \ -+ hcintmsk_data_t hcintmsk = {.d32 = 0}; \ -+ hcintmsk.b._intr_ = 1; \ -+ DWC_MODIFY_REG32(&(_hc_regs_)->hcintmsk, hcintmsk.d32, 0); \ -+} while (0) -+ -+/** -+ * This function Reads HPRT0 in preparation to modify. It keeps the -+ * WC bits 0 so that if they are read as 1, they won't clear when you -+ * write it back -+ */ -+static inline uint32_t dwc_otg_read_hprt0(dwc_otg_core_if_t * _core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(_core_if->host_if->hprt0); -+ hprt0.b.prtena = 0; -+ hprt0.b.prtconndet = 0; -+ hprt0.b.prtenchng = 0; -+ hprt0.b.prtovrcurrchng = 0; -+ return hprt0.d32; -+} -+ -+/**@}*/ -+ -+/** @name Common CIL Functions -+ * The following functions support managing the DWC_otg controller in either -+ * device or host mode. -+ */ -+/**@{*/ -+ -+extern void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, -+ uint8_t * dest, uint16_t bytes); -+ -+extern void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * _core_if, const int _num); -+extern void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_core_reset(dwc_otg_core_if_t * _core_if); -+ -+/** -+ * This function returns the Core Interrupt register. -+ */ -+static inline uint32_t dwc_otg_read_core_intr(dwc_otg_core_if_t * core_if) -+{ -+ return (DWC_READ_REG32(&core_if->core_global_regs->gintsts) & -+ DWC_READ_REG32(&core_if->core_global_regs->gintmsk)); -+} -+ -+/** -+ * This function returns the OTG Interrupt register. -+ */ -+static inline uint32_t dwc_otg_read_otg_intr(dwc_otg_core_if_t * core_if) -+{ -+ return (DWC_READ_REG32(&core_if->core_global_regs->gotgint)); -+} -+ -+/** -+ * This function reads the Device All Endpoints Interrupt register and -+ * returns the IN endpoint interrupt bits. -+ */ -+static inline uint32_t dwc_otg_read_dev_all_in_ep_intr(dwc_otg_core_if_t * -+ core_if) -+{ -+ -+ uint32_t v; -+ -+ if (core_if->multiproc_int_enable) { -+ v = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->deachint) & -+ DWC_READ_REG32(&core_if-> -+ dev_if->dev_global_regs->deachintmsk); -+ } else { -+ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); -+ } -+ return (v & 0xffff); -+} -+ -+/** -+ * This function reads the Device All Endpoints Interrupt register and -+ * returns the OUT endpoint interrupt bits. -+ */ -+static inline uint32_t dwc_otg_read_dev_all_out_ep_intr(dwc_otg_core_if_t * -+ core_if) -+{ -+ uint32_t v; -+ -+ if (core_if->multiproc_int_enable) { -+ v = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->deachint) & -+ DWC_READ_REG32(&core_if-> -+ dev_if->dev_global_regs->deachintmsk); -+ } else { -+ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); -+ } -+ -+ return ((v & 0xffff0000) >> 16); -+} -+ -+/** -+ * This function returns the Device IN EP Interrupt register -+ */ -+static inline uint32_t dwc_otg_read_dev_in_ep_intr(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ uint32_t v, msk, emp; -+ -+ if (core_if->multiproc_int_enable) { -+ msk = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->diepeachintmsk[ep->num]); -+ emp = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->dtknqr4_fifoemptymsk); -+ msk |= ((emp >> ep->num) & 0x1) << 7; -+ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; -+ } else { -+ msk = DWC_READ_REG32(&dev_if->dev_global_regs->diepmsk); -+ emp = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->dtknqr4_fifoemptymsk); -+ msk |= ((emp >> ep->num) & 0x1) << 7; -+ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; -+ } -+ -+ return v; -+} -+ -+/** -+ * This function returns the Device OUT EP Interrupt register -+ */ -+static inline uint32_t dwc_otg_read_dev_out_ep_intr(dwc_otg_core_if_t * -+ _core_if, dwc_ep_t * _ep) -+{ -+ dwc_otg_dev_if_t *dev_if = _core_if->dev_if; -+ uint32_t v; -+ doepmsk_data_t msk = {.d32 = 0 }; -+ -+ if (_core_if->multiproc_int_enable) { -+ msk.d32 = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->doepeachintmsk[_ep->num]); -+ if (_core_if->pti_enh_enable) { -+ msk.b.pktdrpsts = 1; -+ } -+ v = DWC_READ_REG32(&dev_if-> -+ out_ep_regs[_ep->num]->doepint) & msk.d32; -+ } else { -+ msk.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->doepmsk); -+ if (_core_if->pti_enh_enable) { -+ msk.b.pktdrpsts = 1; -+ } -+ v = DWC_READ_REG32(&dev_if-> -+ out_ep_regs[_ep->num]->doepint) & msk.d32; -+ } -+ return v; -+} -+ -+/** -+ * This function returns the Host All Channel Interrupt register -+ */ -+static inline uint32_t dwc_otg_read_host_all_channels_intr(dwc_otg_core_if_t * -+ _core_if) -+{ -+ return (DWC_READ_REG32(&_core_if->host_if->host_global_regs->haint)); -+} -+ -+static inline uint32_t dwc_otg_read_host_channel_intr(dwc_otg_core_if_t * -+ _core_if, dwc_hc_t * _hc) -+{ -+ return (DWC_READ_REG32 -+ (&_core_if->host_if->hc_regs[_hc->hc_num]->hcint)); -+} -+ -+/** -+ * This function returns the mode of the operation, host or device. -+ * -+ * @return 0 - Device Mode, 1 - Host Mode -+ */ -+static inline uint32_t dwc_otg_mode(dwc_otg_core_if_t * _core_if) -+{ -+ return (DWC_READ_REG32(&_core_if->core_global_regs->gintsts) & 0x1); -+} -+ -+/**@}*/ -+ -+/** -+ * DWC_otg CIL callback structure. This structure allows the HCD and -+ * PCD to register functions used for starting and stopping the PCD -+ * and HCD for role change on for a DRD. -+ */ -+typedef struct dwc_otg_cil_callbacks { -+ /** Start function for role change */ -+ int (*start) (void *_p); -+ /** Stop Function for role change */ -+ int (*stop) (void *_p); -+ /** Disconnect Function for role change */ -+ int (*disconnect) (void *_p); -+ /** Resume/Remote wakeup Function */ -+ int (*resume_wakeup) (void *_p); -+ /** Suspend function */ -+ int (*suspend) (void *_p); -+ /** Session Start (SRP) */ -+ int (*session_start) (void *_p); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ /** Sleep (switch to L0 state) */ -+ int (*sleep) (void *_p); -+#endif -+ /** Pointer passed to start() and stop() */ -+ void *p; -+} dwc_otg_cil_callbacks_t; -+ -+extern void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * _core_if, -+ dwc_otg_cil_callbacks_t * _cb, -+ void *_p); -+extern void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * _core_if, -+ dwc_otg_cil_callbacks_t * _cb, -+ void *_p); -+ -+void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if); -+ -+////////////////////////////////////////////////////////////////////// -+/** Start the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_start(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->start) { -+ core_if->hcd_cb->start(core_if->hcd_cb->p); -+ } -+} -+ -+/** Stop the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_stop(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->stop) { -+ core_if->hcd_cb->stop(core_if->hcd_cb->p); -+ } -+} -+ -+/** Disconnect the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_disconnect(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->disconnect) { -+ core_if->hcd_cb->disconnect(core_if->hcd_cb->p); -+ } -+} -+ -+/** Inform the HCD the a New Session has begun. Helper function for -+ * using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_session_start(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->session_start) { -+ core_if->hcd_cb->session_start(core_if->hcd_cb->p); -+ } -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * Inform the HCD about LPM sleep. -+ * Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_sleep(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->sleep) { -+ core_if->hcd_cb->sleep(core_if->hcd_cb->p); -+ } -+} -+#endif -+ -+/** Resume the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_resume(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->resume_wakeup) { -+ core_if->hcd_cb->resume_wakeup(core_if->hcd_cb->p); -+ } -+} -+ -+/** Start the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_start(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->start) { -+ core_if->pcd_cb->start(core_if->pcd_cb->p); -+ } -+} -+ -+/** Stop the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_stop(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->stop) { -+ core_if->pcd_cb->stop(core_if->pcd_cb->p); -+ } -+} -+ -+/** Suspend the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_suspend(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->suspend) { -+ core_if->pcd_cb->suspend(core_if->pcd_cb->p); -+ } -+} -+ -+/** Resume the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_resume(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+} -+ -+////////////////////////////////////////////////////////////////////// -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..96c76e38cd372b8ca8c375ae8d8653f32a3faf80 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -@@ -0,0 +1,1594 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $ -+ * $Revision: #32 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * The Core Interface Layer provides basic services for accessing and -+ * managing the DWC_otg hardware. These services are used by both the -+ * Host Controller Driver and the Peripheral Controller Driver. -+ * -+ * This file contains the Common Interrupt handlers. -+ */ -+#include "dwc_os.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_pcd.h" -+#include "dwc_otg_hcd.h" -+ -+#ifdef DEBUG -+inline const char *op_state_str(dwc_otg_core_if_t * core_if) -+{ -+ return (core_if->op_state == A_HOST ? "a_host" : -+ (core_if->op_state == A_SUSPEND ? "a_suspend" : -+ (core_if->op_state == A_PERIPHERAL ? "a_peripheral" : -+ (core_if->op_state == B_PERIPHERAL ? "b_peripheral" : -+ (core_if->op_state == B_HOST ? "b_host" : "unknown"))))); -+} -+#endif -+ -+/** This function will log a debug message -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_mode_mismatch_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ DWC_WARN("Mode Mismatch Interrupt: currently in %s mode\n", -+ dwc_otg_mode(core_if) ? "Host" : "Device"); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.modemismatch = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This function handles the OTG Interrupts. It reads the OTG -+ * Interrupt Register (GOTGINT) to determine what interrupt has -+ * occurred. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_otg_intr(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gotgint_data_t gotgint; -+ gotgctl_data_t gotgctl; -+ gintmsk_data_t gintmsk; -+ gpwrdn_data_t gpwrdn; -+ -+ gotgint.d32 = DWC_READ_REG32(&global_regs->gotgint); -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ DWC_DEBUGPL(DBG_CIL, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint.d32, -+ op_state_str(core_if)); -+ -+ if (gotgint.b.sesenddet) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "Session End Detected++ (%s)\n", -+ op_state_str(core_if)); -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ -+ if (core_if->op_state == B_HOST) { -+ cil_pcd_start(core_if); -+ core_if->op_state = B_PERIPHERAL; -+ } else { -+ /* If not B_HOST and Device HNP still set. HNP -+ * Did not succeed!*/ -+ if (gotgctl.b.devhnpen) { -+ DWC_DEBUGPL(DBG_ANY, "Session End Detected\n"); -+ __DWC_ERROR("Device Not Connected/Responding!\n"); -+ } -+ -+ /* If Session End Detected the B-Cable has -+ * been disconnected. */ -+ /* Reset PCD and Gadget driver to a -+ * clean state. */ -+ core_if->lx_state = DWC_OTG_L0; -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ -+ if (core_if->adp_enable) { -+ if (core_if->power_down == 2) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ } -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ dwc_otg_adp_sense_start(core_if); -+ } -+ } -+ -+ gotgctl.d32 = 0; -+ gotgctl.b.devhnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ } -+ if (gotgint.b.sesreqsucstschng) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "Session Reqeust Success Status Change++\n"); -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ if (gotgctl.b.sesreqscs) { -+ -+ if ((core_if->core_params->phy_type == -+ DWC_PHY_TYPE_PARAM_FS) && (core_if->core_params->i2c_enable)) { -+ core_if->srp_success = 1; -+ } else { -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_resume(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ /* Clear Session Request */ -+ gotgctl.d32 = 0; -+ gotgctl.b.sesreq = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, -+ gotgctl.d32, 0); -+ } -+ } -+ } -+ if (gotgint.b.hstnegsucstschng) { -+ /* Print statements during the HNP interrupt handling -+ * can cause it to fail.*/ -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ /* WA for 3.00a- HW is not setting cur_mode, even sometimes -+ * this does not help*/ -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) -+ dwc_udelay(100); -+ if (gotgctl.b.hstnegscs) { -+ if (dwc_otg_is_host_mode(core_if)) { -+ core_if->op_state = B_HOST; -+ /* -+ * Need to disable SOF interrupt immediately. -+ * When switching from device to host, the PCD -+ * interrupt handler won't handle the -+ * interrupt if host mode is already set. The -+ * HCD interrupt handler won't get called if -+ * the HCD state is HALT. This means that the -+ * interrupt does not get handled and Linux -+ * complains loudly. -+ */ -+ gintmsk.d32 = 0; -+ gintmsk.b.sofintr = 1; -+ DWC_MODIFY_REG32(&global_regs->gintmsk, -+ gintmsk.d32, 0); -+ /* Call callback function with spin lock released */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ /* -+ * Initialize the Core for Host mode. -+ */ -+ cil_hcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = B_HOST; -+ } -+ } else { -+ gotgctl.d32 = 0; -+ gotgctl.b.hnpreq = 1; -+ gotgctl.b.devhnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ DWC_DEBUGPL(DBG_ANY, "HNP Failed\n"); -+ __DWC_ERROR("Device Not Connected/Responding\n"); -+ } -+ } -+ if (gotgint.b.hstnegdet) { -+ /* The disconnect interrupt is set at the same time as -+ * Host Negotiation Detected. During the mode -+ * switch all interrupts are cleared so the disconnect -+ * interrupt handler will not get executed. -+ */ -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "Host Negotiation Detected++ (%s)\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : -+ "Device")); -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_DEBUGPL(DBG_ANY, "a_suspend->a_peripheral (%d)\n", -+ core_if->op_state); -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_disconnect(core_if); -+ cil_pcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = A_PERIPHERAL; -+ } else { -+ /* -+ * Need to disable SOF interrupt immediately. When -+ * switching from device to host, the PCD interrupt -+ * handler won't handle the interrupt if host mode is -+ * already set. The HCD interrupt handler won't get -+ * called if the HCD state is HALT. This means that -+ * the interrupt does not get handled and Linux -+ * complains loudly. -+ */ -+ gintmsk.d32 = 0; -+ gintmsk.b.sofintr = 1; -+ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmsk.d32, 0); -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ cil_hcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = A_HOST; -+ } -+ } -+ if (gotgint.b.adevtoutchng) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "A-Device Timeout Change++\n"); -+ } -+ if (gotgint.b.debdone) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " "Debounce Done++\n"); -+ } -+ -+ /* Clear GOTGINT */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, gotgint.d32); -+ -+ return 1; -+} -+ -+void w_conn_id_status_change(void *p) -+{ -+ dwc_otg_core_if_t *core_if = p; -+ uint32_t count = 0; -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ -+ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ DWC_DEBUGPL(DBG_CIL, "gotgctl=%0x\n", gotgctl.d32); -+ DWC_DEBUGPL(DBG_CIL, "gotgctl.b.conidsts=%d\n", gotgctl.b.conidsts); -+ -+ /* B-Device connector (Device Mode) */ -+ if (gotgctl.b.conidsts) { -+ /* Wait for switch to device mode. */ -+ while (!dwc_otg_is_device_mode(core_if)) { -+ DWC_PRINTF("Waiting for Peripheral Mode, Mode=%s\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : -+ "Peripheral")); -+ dwc_mdelay(100); -+ if (++count > 10000) -+ break; -+ } -+ DWC_ASSERT(++count < 10000, -+ "Connection id status change timed out"); -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } else { -+ /* A-Device connector (Host Mode) */ -+ while (!dwc_otg_is_host_mode(core_if)) { -+ DWC_PRINTF("Waiting for Host Mode, Mode=%s\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : -+ "Peripheral")); -+ dwc_mdelay(100); -+ if (++count > 10000) -+ break; -+ } -+ DWC_ASSERT(++count < 10000, -+ "Connection id status change timed out"); -+ core_if->op_state = A_HOST; -+ /* -+ * Initialize the Core for Host mode. -+ */ -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+} -+ -+/** -+ * This function handles the Connector ID Status Change Interrupt. It -+ * reads the OTG Interrupt Register (GOTCTL) to determine whether this -+ * is a Device to Host Mode transition or a Host Mode to Device -+ * Transition. -+ * -+ * This only occurs when the cable is connected/removed from the PHY -+ * connector. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_conn_id_status_change_intr(dwc_otg_core_if_t * core_if) -+{ -+ -+ /* -+ * Need to disable SOF interrupt immediately. If switching from device -+ * to host, the PCD interrupt handler won't handle the interrupt if -+ * host mode is already set. The HCD interrupt handler won't get -+ * called if the HCD state is HALT. This means that the interrupt does -+ * not get handled and Linux complains loudly. -+ */ -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ gintsts_data_t gintsts = {.d32 = 0 }; -+ -+ gintmsk.b.sofintr = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ -+ DWC_DEBUGPL(DBG_CIL, -+ " ++Connector ID Status Change Interrupt++ (%s)\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device")); -+ -+ DWC_SPINUNLOCK(core_if->lock); -+ -+ /* -+ * Need to schedule a work, as there are possible DELAY function calls -+ * Release lock before scheduling workq as it holds spinlock during scheduling -+ */ -+ -+ DWC_WORKQ_SCHEDULE(core_if->wq_otg, w_conn_id_status_change, -+ core_if, "connection id status change"); -+ DWC_SPINLOCK(core_if->lock); -+ -+ /* Set flag and clear interrupt */ -+ gintsts.b.conidstschng = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that a device is initiating the Session -+ * Request Protocol to request the host to turn on bus power so a new -+ * session can begin. The handler responds by turning on bus power. If -+ * the DWC_otg controller is in low power mode, the handler brings the -+ * controller out of low power mode before turning on bus power. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_session_req_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ -+#ifndef DWC_HOST_ONLY -+ DWC_DEBUGPL(DBG_ANY, "++Session Request Interrupt++\n"); -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_PRINTF("SRP: Device mode\n"); -+ } else { -+ hprt0_data_t hprt0; -+ DWC_PRINTF("SRP: Host mode\n"); -+ -+ /* Turn on the port power bit. */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Start the Connection timer. So a message can be displayed -+ * if connect does not occur within 10 seconds. */ -+ cil_hcd_session_start(core_if); -+ } -+#endif -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.sessreqintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+void w_wakeup_detected(void *p) -+{ -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) p; -+ /* -+ * Clear the Resume after 70ms. (Need 20 ms minimum. Use 70 ms -+ * so that OPT tests pass with all PHYs). -+ */ -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+#if 0 -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ /* Restart the Phy Clock */ -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ dwc_udelay(10); -+#endif //0 -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ DWC_DEBUGPL(DBG_ANY, "Resume: HPRT0=%0x\n", hprt0.d32); -+// dwc_mdelay(70); -+ hprt0.b.prtres = 0; /* Resume */ -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ DWC_DEBUGPL(DBG_ANY, "Clear Resume: HPRT0=%0x\n", -+ DWC_READ_REG32(core_if->host_if->hprt0)); -+ -+ cil_hcd_resume(core_if); -+ -+ /** Change to L0 state*/ -+ core_if->lx_state = DWC_OTG_L0; -+} -+ -+/** -+ * This interrupt indicates that the DWC_otg controller has detected a -+ * resume or remote wakeup sequence. If the DWC_otg controller is in -+ * low power mode, the handler must brings the controller out of low -+ * power mode. The controller automatically begins resume -+ * signaling. The handler schedules a time to stop resume signaling. -+ */ -+int32_t dwc_otg_handle_wakeup_detected_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "++Resume and Remote Wakeup Detected Interrupt++\n"); -+ -+ DWC_PRINTF("%s lxstate = %d\n", __func__, core_if->lx_state); -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> -+ dsts)); -+ if (core_if->lx_state == DWC_OTG_L2) { -+#ifdef PARTIAL_POWER_DOWN -+ if (core_if->hwcfg4.b.power_optimiz) { -+ pcgcctl_data_t power = {.d32 = 0 }; -+ -+ power.d32 = DWC_READ_REG32(core_if->pcgcctl); -+ DWC_DEBUGPL(DBG_CIL, "PCGCCTL=%0x\n", -+ power.d32); -+ -+ power.b.stoppclk = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ -+ power.b.pwrclmp = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ -+ power.b.rstpdwnmodule = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ } -+#endif -+ /* Clear the Remote Wakeup Signaling */ -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, dctl.d32, 0); -+ -+ DWC_SPINUNLOCK(core_if->lock); -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+ DWC_SPINLOCK(core_if->lock); -+ } else { -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ } -+ /** Change to L0 state*/ -+ core_if->lx_state = DWC_OTG_L0; -+ } else { -+ if (core_if->lx_state != DWC_OTG_L1) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ -+ /* Restart the Phy Clock */ -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ DWC_TIMER_SCHEDULE(core_if->wkp_timer, 71); -+ } else { -+ /** Change to L0 state*/ -+ core_if->lx_state = DWC_OTG_L0; -+ } -+ } -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.wkupintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * Device disconnect. -+ */ -+static int32_t dwc_otg_handle_pwrdn_disconnect_intr(dwc_otg_core_if_t *core_if) -+{ -+ gpwrdn_data_t gpwrdn = { .d32 = 0 }; -+ gpwrdn_data_t gpwrdn_temp = { .d32 = 0 }; -+ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps*/ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ if (gpwrdn_temp.b.idsts) { -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } else { -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * remote wakeup sequence. -+ */ -+static int32_t dwc_otg_handle_pwrdn_wakeup_detected_intr(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_ANY, -+ "++Powerdown Remote Wakeup Detected Interrupt++\n"); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (gpwrdn.b.idsts) { // Device Mode -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ dwc_otg_device_hibernation_restore(core_if, 0, 0); -+ } -+ } else { -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ dwc_otg_host_hibernation_restore(core_if, 1, 0); -+ } -+ } -+ return 1; -+} -+ -+static int32_t dwc_otg_handle_pwrdn_idsts_change(dwc_otg_device_t *otg_dev) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ -+ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); -+ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (core_if->power_down == 2) { -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ DWC_DEBUGPL(DBG_ANY, "Exit from hibernation on ID sts change\n"); -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /*Indicates that we are exiting from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ gpwrdn.d32 = core_if->gr_backup->gpwrdn_local; -+ if (gpwrdn.b.dis_vbus == 1) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ } -+ -+ if (gpwrdn_temp.b.idsts) { -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } else { -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+ } -+ -+ if (core_if->adp_enable) { -+ uint8_t is_host = 0; -+ DWC_SPINUNLOCK(core_if->lock); -+ /* Change the core_if's lock to hcd/pcd lock depend on mode? */ -+#ifndef DWC_HOST_ONLY -+ if (gpwrdn_temp.b.idsts) -+ core_if->lock = otg_dev->pcd->lock; -+#endif -+#ifndef DWC_DEVICE_ONLY -+ if (!gpwrdn_temp.b.idsts) { -+ core_if->lock = otg_dev->hcd->lock; -+ is_host = 1; -+ } -+#endif -+ DWC_PRINTF("RESTART ADP\n"); -+ if (core_if->adp.probe_enabled) -+ dwc_otg_adp_probe_stop(core_if); -+ if (core_if->adp.sense_enabled) -+ dwc_otg_adp_sense_stop(core_if); -+ if (core_if->adp.sense_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.sense_timer); -+ if (core_if->adp.vbuson_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); -+ core_if->adp.probe_timer_values[0] = -1; -+ core_if->adp.probe_timer_values[1] = -1; -+ core_if->adp.sense_timer_started = 0; -+ core_if->adp.vbuson_timer_started = 0; -+ core_if->adp.probe_counter = 0; -+ core_if->adp.gpwrdn = 0; -+ -+ /* Disable PMU and restart ADP */ -+ gpwrdn_temp.d32 = 0; -+ gpwrdn_temp.b.pmuactv = 1; -+ gpwrdn_temp.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ DWC_PRINTF("Check point 1\n"); -+ dwc_mdelay(110); -+ dwc_otg_adp_start(core_if, is_host); -+ DWC_SPINLOCK(core_if->lock); -+ } -+ -+ -+ return 1; -+} -+ -+static int32_t dwc_otg_handle_pwrdn_session_change(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ int32_t otg_cap_param = core_if->core_params->otg_cap; -+ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (core_if->power_down == 2) { -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ if ((otg_cap_param != DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || -+ otg_cap_param != DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) && -+ gpwrdn.b.bsessvld == 0) { -+ /* Save gpwrdn register for further usage if stschng interrupt */ -+ core_if->gr_backup->gpwrdn_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ /*Exit from ISR and wait for stschng interrupt with bsessvld = 1 */ -+ return 1; -+ } -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /*Indicates that we are exiting from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || -+ otg_cap_param == DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) { -+ /* -+ * Initiate SRP after initial ADP probe. -+ */ -+ dwc_otg_initiate_srp(core_if); -+ } -+ } -+ -+ return 1; -+} -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * status change either on IDDIG or BSessVld. -+ */ -+static uint32_t dwc_otg_handle_pwrdn_stschng_intr(dwc_otg_device_t *otg_dev) -+{ -+ int retval; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (core_if->power_down == 2) { -+ if (core_if->hibernation_suspend <= 0) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } else -+ gpwrdn_temp.d32 = core_if->gr_backup->gpwrdn_local; -+ -+ } else { -+ gpwrdn_temp.d32 = core_if->adp.gpwrdn; -+ } -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ if (gpwrdn.b.idsts ^ gpwrdn_temp.b.idsts) { -+ retval = dwc_otg_handle_pwrdn_idsts_change(otg_dev); -+ } else if (gpwrdn.b.bsessvld ^ gpwrdn_temp.b.bsessvld) { -+ retval = dwc_otg_handle_pwrdn_session_change(core_if); -+ } -+ -+ return retval; -+} -+ -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * SRP. -+ */ -+static int32_t dwc_otg_handle_pwrdn_srp_intr(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+#ifdef DWC_DEV_SRPCAP -+ if (core_if->pwron_timer_started) { -+ core_if->pwron_timer_started = 0; -+ DWC_TIMER_CANCEL(core_if->pwron_timer); -+ } -+#endif -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Indicates that we are exiting from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Programm Disable VBUS to 0 */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /*Initialize the core as Host */ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ -+ return 1; -+} -+ -+/** This interrupt indicates that restore command after Hibernation -+ * was completed by the core. */ -+int32_t dwc_otg_handle_restore_done_intr(dwc_otg_core_if_t * core_if) -+{ -+ pcgcctl_data_t pcgcctl; -+ DWC_DEBUGPL(DBG_ANY, "++Restore Done Interrupt++\n"); -+ -+ //TODO De-assert restore signal. 8.a -+ pcgcctl.d32 = DWC_READ_REG32(core_if->pcgcctl); -+ if (pcgcctl.b.restoremode == 1) { -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ /* -+ * If restore mode is Remote Wakeup, -+ * unmask Remote Wakeup interrupt. -+ */ -+ gintmsk.b.wkupintr = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ 0, gintmsk.d32); -+ } -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that a device has been disconnected from -+ * the root port. -+ */ -+int32_t dwc_otg_handle_disconnect_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ -+ DWC_DEBUGPL(DBG_ANY, "++Disconnect Detected Interrupt++ (%s) %s\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device"), -+ op_state_str(core_if)); -+ -+/** @todo Consolidate this if statement. */ -+#ifndef DWC_HOST_ONLY -+ if (core_if->op_state == B_HOST) { -+ /* If in device mode Disconnect and stop the HCD, then -+ * start the PCD. */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_disconnect(core_if); -+ cil_pcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = B_PERIPHERAL; -+ } else if (dwc_otg_is_device_mode(core_if)) { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gotgctl.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ if (gotgctl.b.hstsethnpen == 1) { -+ /* Do nothing, if HNP in process the OTG -+ * interrupt "Host Negotiation Detected" -+ * interrupt will do the mode switch. -+ */ -+ } else if (gotgctl.b.devhnpen == 0) { -+ /* If in device mode Disconnect and stop the HCD, then -+ * start the PCD. */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_disconnect(core_if); -+ cil_pcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = B_PERIPHERAL; -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "!a_peripheral && !devhnpen\n"); -+ } -+ } else { -+ if (core_if->op_state == A_HOST) { -+ /* A-Cable still connected but device disconnected. */ -+ cil_hcd_disconnect(core_if); -+ if (core_if->adp_enable) { -+ gpwrdn_data_t gpwrdn = { .d32 = 0 }; -+ cil_hcd_stop(core_if); -+ /* Enable Power Down Logic */ -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_otg_adp_probe_start(core_if); -+ -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32 -+ (&core_if->core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ } -+ } -+ } -+ } -+#endif -+ /* Change to L3(OFF) state */ -+ core_if->lx_state = DWC_OTG_L3; -+ -+ gintsts.d32 = 0; -+ gintsts.b.disconnect = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that SUSPEND state has been detected on -+ * the USB. -+ * -+ * For HNP the USB Suspend interrupt signals the change from -+ * "a_peripheral" to "a_host". -+ * -+ * When power management is enabled the core will be put in low power -+ * mode. -+ */ -+int32_t dwc_otg_handle_usb_suspend_intr(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ gintsts_data_t gintsts; -+ dcfg_data_t dcfg; -+ -+ DWC_DEBUGPL(DBG_ANY, "USB SUSPEND\n"); -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ /* Check the Device status register to determine if the Suspend -+ * state is active. */ -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", dsts.d32); -+ DWC_DEBUGPL(DBG_PCD, "DSTS.Suspend Status=%d " -+ "HWCFG4.power Optimize=%d\n", -+ dsts.b.suspsts, core_if->hwcfg4.b.power_optimiz); -+ -+#ifdef PARTIAL_POWER_DOWN -+/** @todo Add a module parameter for power management. */ -+ -+ if (dsts.b.suspsts && core_if->hwcfg4.b.power_optimiz) { -+ pcgcctl_data_t power = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_CIL, "suspend\n"); -+ -+ power.b.pwrclmp = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ -+ power.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); -+ -+ power.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); -+ -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "disconnect?\n"); -+ } -+#endif -+ /* PCD callback for suspend. Release the lock inside of callback function */ -+ cil_pcd_suspend(core_if); -+ if (core_if->power_down == 2) -+ { -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ DWC_DEBUGPL(DBG_ANY,"lx_state = %08x\n",core_if->lx_state); -+ DWC_DEBUGPL(DBG_ANY," device address = %08d\n",dcfg.b.devaddr); -+ -+ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ -+ /* Change to L2(suspend) state */ -+ core_if->lx_state = DWC_OTG_L2; -+ -+ /* Clear interrupt in gintsts */ -+ gintsts.d32 = 0; -+ gintsts.b.usbsuspend = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, gintsts.d32); -+ DWC_PRINTF("Start of hibernation completed\n"); -+ dwc_otg_save_global_regs(core_if); -+ dwc_otg_save_dev_regs(core_if); -+ -+ gusbcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs-> -+ gusbcfg); -+ if (gusbcfg.b.ulpi_utmi_sel == 1) { -+ /* ULPI interface */ -+ /* Suspend the Phy Clock */ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } else { -+ /* UTMI+ Interface */ -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ } -+ -+ /* Set flag to indicate that we are in hibernation */ -+ core_if->hibernation_suspend = 1; -+ /* Enable interrupts from wake up logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Unmask device mode interrupts in GPWRDN */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.rst_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ gpwrdn.b.sts_chngint_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Enable Power Down Clamp */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Switch off VDD */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ /* Save gpwrdn register for further usage if stschng interrupt */ -+ core_if->gr_backup->gpwrdn_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ DWC_PRINTF("Hibernation completed\n"); -+ -+ return 1; -+ } -+ } else if (core_if->power_down == 3) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ DWC_DEBUGPL(DBG_ANY, "lx_state = %08x\n",core_if->lx_state); -+ DWC_DEBUGPL(DBG_ANY, " device address = %08d\n",dcfg.b.devaddr); -+ -+ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { -+ DWC_DEBUGPL(DBG_ANY, "Start entering to extended hibernation\n"); -+ core_if->xhib = 1; -+ -+ /* Clear interrupt in gintsts */ -+ gintsts.d32 = 0; -+ gintsts.b.usbsuspend = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, gintsts.d32); -+ -+ dwc_otg_save_global_regs(core_if); -+ dwc_otg_save_dev_regs(core_if); -+ -+ /* Wait for 10 PHY clocks */ -+ dwc_udelay(10); -+ -+ /* Program GPIO register while entering to xHib */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x1); -+ -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.extnd_hiber_pwrclmp = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.extnd_hiber_switch = 1; -+ core_if->gr_backup->xhib_gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ core_if->gr_backup->xhib_pcgcctl = DWC_READ_REG32(core_if->pcgcctl) | pcgcctl.d32; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ DWC_DEBUGPL(DBG_ANY, "Finished entering to extended hibernation\n"); -+ -+ return 1; -+ } -+ } -+ } else { -+ if (core_if->op_state == A_PERIPHERAL) { -+ DWC_DEBUGPL(DBG_ANY, "a_peripheral->a_host\n"); -+ /* Clear the a_peripheral flag, back to a_host. */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ cil_hcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = A_HOST; -+ } -+ } -+ -+ /* Change to L2(suspend) state */ -+ core_if->lx_state = DWC_OTG_L2; -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.usbsuspend = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+static int32_t dwc_otg_handle_xhib_exit_intr(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gahbcfg_data_t gahbcfg = {.d32 = 0 }; -+ -+ dwc_udelay(10); -+ -+ /* Program GPIO register while entering to xHib */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x0); -+ -+ pcgcctl.d32 = core_if->gr_backup->xhib_pcgcctl; -+ pcgcctl.b.extnd_hiber_pwrclmp = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ gpwrdn.d32 = core_if->gr_backup->xhib_gpwrdn; -+ gpwrdn.b.restore = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ restore_lpm_i2c_regs(core_if); -+ -+ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); -+ pcgcctl.b.max_xcvrselect = 1; -+ pcgcctl.b.ess_reg_restored = 0; -+ pcgcctl.b.extnd_hiber_switch = 0; -+ pcgcctl.b.extnd_hiber_pwrclmp = 0; -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ -+ gahbcfg.d32 = core_if->gr_backup->gahbcfg_local; -+ gahbcfg.b.glblintrmsk = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0x1 << 16); -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, -+ core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, -+ core_if->dr_backup->dcfg); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); -+ pcgcctl.b.max_xcvrselect = 1; -+ pcgcctl.d32 |= 0x608; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); -+ pcgcctl.b.max_xcvrselect = 1; -+ pcgcctl.b.ess_reg_restored = 1; -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ pcgcctl.b.rstpdwnmodule = 1; -+ pcgcctl.b.restoremode = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ -+ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); -+ -+ return 1; -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * This function hadles LPM transaction received interrupt. -+ */ -+static int32_t dwc_otg_handle_lpm_intr(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ gintsts_data_t gintsts; -+ -+ if (!core_if->core_params->lpm_enable) { -+ DWC_PRINTF("Unexpected LPM interrupt\n"); -+ } -+ -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ DWC_PRINTF("LPM config register = 0x%08x\n", lpmcfg.d32); -+ -+ if (dwc_otg_is_host_mode(core_if)) { -+ cil_hcd_sleep(core_if); -+ } else { -+ lpmcfg.b.hird_thres |= (1 << 4); -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ } -+ -+ /* Examine prt_sleep_sts after TL1TokenTetry period max (10 us) */ -+ dwc_udelay(10); -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.prt_sleep_sts) { -+ /* Save the current state */ -+ core_if->lx_state = DWC_OTG_L1; -+ } -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.lpmtranrcvd = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ return 1; -+} -+#endif /* CONFIG_USB_DWC_OTG_LPM */ -+ -+/** -+ * This function returns the Core Interrupt register. -+ */ -+static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gintmsk_data_t *reenable_gintmsk, dwc_otg_hcd_t *hcd) -+{ -+ gahbcfg_data_t gahbcfg = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk; -+ gintmsk_data_t gintmsk_common = {.d32 = 0 }; -+ gintmsk_common.b.wkupintr = 1; -+ gintmsk_common.b.sessreqintr = 1; -+ gintmsk_common.b.conidstschng = 1; -+ gintmsk_common.b.otgintr = 1; -+ gintmsk_common.b.modemismatch = 1; -+ gintmsk_common.b.disconnect = 1; -+ gintmsk_common.b.usbsuspend = 1; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ gintmsk_common.b.lpmtranrcvd = 1; -+#endif -+ gintmsk_common.b.restoredone = 1; -+ if(dwc_otg_is_device_mode(core_if)) -+ { -+ /** @todo: The port interrupt occurs while in device -+ * mode. Added code to CIL to clear the interrupt for now! -+ */ -+ gintmsk_common.b.portintr = 1; -+ } -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ if(fiq_enable) { -+ local_fiq_disable(); -+ /* Pull in the interrupts that the FIQ has masked */ -+ gintmsk.d32 |= ~(hcd->fiq_state->gintmsk_saved.d32); -+ gintmsk.d32 |= gintmsk_common.d32; -+ /* for the upstairs function to reenable - have to read it here in case FIQ triggers again */ -+ reenable_gintmsk->d32 = gintmsk.d32; -+ local_fiq_enable(); -+ } -+ -+ gahbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); -+ -+#ifdef DEBUG -+ /* if any common interrupts set */ -+ if (gintsts.d32 & gintmsk_common.d32) { -+ DWC_DEBUGPL(DBG_ANY, "common_intr: gintsts=%08x gintmsk=%08x\n", -+ gintsts.d32, gintmsk.d32); -+ } -+#endif -+ if (!fiq_enable){ -+ if (gahbcfg.b.glblintrmsk) -+ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); -+ else -+ return 0; -+ } else { -+ /* Our IRQ kicker is no longer the USB hardware, it's the MPHI interface. -+ * Can't trust the global interrupt mask bit in this case. -+ */ -+ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); -+ } -+ -+} -+ -+/* MACRO for clearing interupt bits in GPWRDN register */ -+#define CLEAR_GPWRDN_INTR(__core_if,__intr) \ -+do { \ -+ gpwrdn_data_t gpwrdn = {.d32=0}; \ -+ gpwrdn.b.__intr = 1; \ -+ DWC_MODIFY_REG32(&__core_if->core_global_regs->gpwrdn, \ -+ 0, gpwrdn.d32); \ -+} while (0) -+ -+/** -+ * Common interrupt handler. -+ * -+ * The common interrupts are those that occur in both Host and Device mode. -+ * This handler handles the following interrupts: -+ * - Mode Mismatch Interrupt -+ * - Disconnect Interrupt -+ * - OTG Interrupt -+ * - Connector ID Status Change Interrupt -+ * - Session Request Interrupt. -+ * - Resume / Remote Wakeup Detected Interrupt. -+ * - LPM Transaction Received Interrupt -+ * - ADP Transaction Received Interrupt -+ * -+ */ -+int32_t dwc_otg_handle_common_intr(void *dev) -+{ -+ int retval = 0; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk_reenable = { .d32 = 0 }; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ dwc_otg_device_t *otg_dev = dev; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (dwc_otg_is_device_mode(core_if)) -+ core_if->frame_num = dwc_otg_get_frame_number(core_if); -+ -+ if (core_if->lock) -+ DWC_SPINLOCK(core_if->lock); -+ -+ if (core_if->power_down == 3 && core_if->xhib == 1) { -+ DWC_DEBUGPL(DBG_ANY, "Exiting from xHIB state\n"); -+ retval |= dwc_otg_handle_xhib_exit_intr(core_if); -+ core_if->xhib = 2; -+ if (core_if->lock) -+ DWC_SPINUNLOCK(core_if->lock); -+ -+ return retval; -+ } -+ -+ if (core_if->hibernation_suspend <= 0) { -+ /* read_common will have to poke the FIQ's saved mask. We must then clear this mask at the end -+ * of this handler - god only knows why it's done like this -+ */ -+ gintsts.d32 = dwc_otg_read_common_intr(core_if, &gintmsk_reenable, otg_dev->hcd); -+ -+ if (gintsts.b.modemismatch) { -+ retval |= dwc_otg_handle_mode_mismatch_intr(core_if); -+ } -+ if (gintsts.b.otgintr) { -+ retval |= dwc_otg_handle_otg_intr(core_if); -+ } -+ if (gintsts.b.conidstschng) { -+ retval |= -+ dwc_otg_handle_conn_id_status_change_intr(core_if); -+ } -+ if (gintsts.b.disconnect) { -+ retval |= dwc_otg_handle_disconnect_intr(core_if); -+ } -+ if (gintsts.b.sessreqintr) { -+ retval |= dwc_otg_handle_session_req_intr(core_if); -+ } -+ if (gintsts.b.wkupintr) { -+ retval |= dwc_otg_handle_wakeup_detected_intr(core_if); -+ } -+ if (gintsts.b.usbsuspend) { -+ retval |= dwc_otg_handle_usb_suspend_intr(core_if); -+ } -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (gintsts.b.lpmtranrcvd) { -+ retval |= dwc_otg_handle_lpm_intr(core_if); -+ } -+#endif -+ if (gintsts.b.restoredone) { -+ gintsts.d32 = 0; -+ if (core_if->power_down == 2) -+ core_if->hibernation_suspend = -1; -+ else if (core_if->power_down == 3 && core_if->xhib == 2) { -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, 0xFFFFFFFF); -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "RESTORE DONE generated\n"); -+ -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ pcgcctl.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, core_if->dr_backup->dcfg); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, core_if->dr_backup->dctl); -+ dwc_udelay(50); -+ -+ dctl.b.pwronprgdone = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ dwc_udelay(10); -+ -+ dwc_otg_restore_global_regs(core_if); -+ dwc_otg_restore_dev_regs(core_if, 0); -+ -+ dctl.d32 = 0; -+ dctl.b.pwronprgdone = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); -+ dwc_udelay(10); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ -+ /* The core will be in ON STATE */ -+ core_if->lx_state = DWC_OTG_L0; -+ core_if->xhib = 0; -+ -+ DWC_SPINUNLOCK(core_if->lock); -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+ DWC_SPINLOCK(core_if->lock); -+ -+ } -+ -+ gintsts.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); -+ DWC_PRINTF(" --Restore done interrupt received-- \n"); -+ retval |= 1; -+ } -+ if (gintsts.b.portintr && dwc_otg_is_device_mode(core_if)) { -+ /* The port interrupt occurs while in device mode with HPRT0 -+ * Port Enable/Disable. -+ */ -+ gintsts.d32 = 0; -+ gintsts.b.portintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); -+ retval |= 1; -+ gintmsk_reenable.b.portintr = 1; -+ -+ } -+ /* Did we actually handle anything? if so, unmask the interrupt */ -+// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "CILOUT %1d", retval); -+// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintsts.d32); -+// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintmsk_reenable.d32); -+ if (retval && fiq_enable) { -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_reenable.d32); -+ } -+ -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "gpwrdn=%08x\n", gpwrdn.d32); -+ -+ if (gpwrdn.b.disconn_det && gpwrdn.b.disconn_det_msk) { -+ CLEAR_GPWRDN_INTR(core_if, disconn_det); -+ if (gpwrdn.b.linestate == 0) { -+ dwc_otg_handle_pwrdn_disconnect_intr(core_if); -+ } else { -+ DWC_PRINTF("Disconnect detected while linestate is not 0\n"); -+ } -+ -+ retval |= 1; -+ } -+ if (gpwrdn.b.lnstschng && gpwrdn.b.lnstchng_msk) { -+ CLEAR_GPWRDN_INTR(core_if, lnstschng); -+ /* remote wakeup from hibernation */ -+ if (gpwrdn.b.linestate == 2 || gpwrdn.b.linestate == 1) { -+ dwc_otg_handle_pwrdn_wakeup_detected_intr(core_if); -+ } else { -+ DWC_PRINTF("gpwrdn.linestate = %d\n", gpwrdn.b.linestate); -+ } -+ retval |= 1; -+ } -+ if (gpwrdn.b.rst_det && gpwrdn.b.rst_det_msk) { -+ CLEAR_GPWRDN_INTR(core_if, rst_det); -+ if (gpwrdn.b.linestate == 0) { -+ DWC_PRINTF("Reset detected\n"); -+ retval |= dwc_otg_device_hibernation_restore(core_if, 0, 1); -+ } -+ } -+ if (gpwrdn.b.srp_det && gpwrdn.b.srp_det_msk) { -+ CLEAR_GPWRDN_INTR(core_if, srp_det); -+ dwc_otg_handle_pwrdn_srp_intr(core_if); -+ retval |= 1; -+ } -+ } -+ /* Handle ADP interrupt here */ -+ if (gpwrdn.b.adp_int) { -+ DWC_PRINTF("ADP interrupt\n"); -+ CLEAR_GPWRDN_INTR(core_if, adp_int); -+ dwc_otg_adp_handle_intr(core_if); -+ retval |= 1; -+ } -+ if (gpwrdn.b.sts_chngint && gpwrdn.b.sts_chngint_msk) { -+ DWC_PRINTF("STS CHNG interrupt asserted\n"); -+ CLEAR_GPWRDN_INTR(core_if, sts_chngint); -+ dwc_otg_handle_pwrdn_stschng_intr(otg_dev); -+ -+ retval |= 1; -+ } -+ if (core_if->lock) -+ DWC_SPINUNLOCK(core_if->lock); -+ return retval; -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4138fd173337dd566d402d5b924d4dc121e32428 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h -@@ -0,0 +1,705 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $ -+ * $Revision: #13 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#if !defined(__DWC_CORE_IF_H__) -+#define __DWC_CORE_IF_H__ -+ -+#include "dwc_os.h" -+ -+/** @file -+ * This file defines DWC_OTG Core API -+ */ -+ -+struct dwc_otg_core_if; -+typedef struct dwc_otg_core_if dwc_otg_core_if_t; -+ -+/** Maximum number of Periodic FIFOs */ -+#define MAX_PERIO_FIFOS 15 -+/** Maximum number of Periodic FIFOs */ -+#define MAX_TX_FIFOS 15 -+ -+/** Maximum number of Endpoints/HostChannels */ -+#define MAX_EPS_CHANNELS 16 -+ -+extern dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * _reg_base_addr); -+extern void dwc_otg_core_init(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_cil_remove(dwc_otg_core_if_t * _core_if); -+ -+extern void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * _core_if); -+ -+extern uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if); -+extern uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if); -+ -+extern uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if); -+ -+/** This function should be called on every hardware interrupt. */ -+extern int32_t dwc_otg_handle_common_intr(void *otg_dev); -+ -+/** @name OTG Core Parameters */ -+/** @{ */ -+ -+/** -+ * Specifies the OTG capabilities. The driver will automatically -+ * detect the value for this parameter if none is specified. -+ * 0 - HNP and SRP capable (default) -+ * 1 - SRP Only capable -+ * 2 - No HNP/SRP capable -+ */ -+extern int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if); -+#define DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE 0 -+#define DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE 1 -+#define DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE 2 -+#define dwc_param_otg_cap_default DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE -+ -+extern int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if); -+#define dwc_param_opt_default 1 -+ -+/** -+ * Specifies whether to use slave or DMA mode for accessing the data -+ * FIFOs. The driver will automatically detect the value for this -+ * parameter if none is specified. -+ * 0 - Slave -+ * 1 - DMA (default, if available) -+ */ -+extern int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_dma_enable_default 1 -+ -+/** -+ * When DMA mode is enabled specifies whether to use -+ * address DMA or DMA Descritor mode for accessing the data -+ * FIFOs in device mode. The driver will automatically detect -+ * the value for this parameter if none is specified. -+ * 0 - address DMA -+ * 1 - DMA Descriptor(default, if available) -+ */ -+extern int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if); -+//#define dwc_param_dma_desc_enable_default 1 -+#define dwc_param_dma_desc_enable_default 0 // Broadcom BCM2708 -+ -+/** The DMA Burst size (applicable only for External DMA -+ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) -+ */ -+extern int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if); -+#define dwc_param_dma_burst_size_default 32 -+ -+/** -+ * Specifies the maximum speed of operation in host and device mode. -+ * The actual speed depends on the speed of the attached device and -+ * the value of phy_type. The actual speed depends on the speed of the -+ * attached device. -+ * 0 - High Speed (default) -+ * 1 - Full Speed -+ */ -+extern int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if); -+#define dwc_param_speed_default 0 -+#define DWC_SPEED_PARAM_HIGH 0 -+#define DWC_SPEED_PARAM_FULL 1 -+ -+/** Specifies whether low power mode is supported when attached -+ * to a Full Speed or Low Speed device in host mode. -+ * 0 - Don't support low power mode (default) -+ * 1 - Support low power mode -+ */ -+extern int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t -+ * core_if); -+#define dwc_param_host_support_fs_ls_low_power_default 0 -+ -+/** Specifies the PHY clock rate in low power mode when connected to a -+ * Low Speed device in host mode. This parameter is applicable only if -+ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS -+ * then defaults to 6 MHZ otherwise 48 MHZ. -+ * -+ * 0 - 48 MHz -+ * 1 - 6 MHz -+ */ -+extern int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_host_ls_low_power_phy_clk_default 0 -+#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ 0 -+#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ 1 -+ -+/** -+ * 0 - Use cC FIFO size parameters -+ * 1 - Allow dynamic FIFO sizing (default) -+ */ -+extern int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_enable_dynamic_fifo_default 1 -+ -+/** Total number of 4-byte words in the data FIFO memory. This -+ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic -+ * Tx FIFOs. -+ * 32 to 32768 (default 8192) -+ * Note: The total FIFO memory depth in the FPGA configuration is 8192. -+ */ -+extern int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if); -+//#define dwc_param_data_fifo_size_default 8192 -+#define dwc_param_data_fifo_size_default 0xFF0 // Broadcom BCM2708 -+ -+/** Number of 4-byte words in the Rx FIFO in device mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1064) -+ */ -+extern int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if); -+#define dwc_param_dev_rx_fifo_size_default 1064 -+ -+/** Number of 4-byte words in the non-periodic Tx FIFO in device mode -+ * when dynamic FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_dev_nperio_tx_fifo_size_default 1024 -+ -+/** Number of 4-byte words in each of the periodic Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+extern int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val, int fifo_num); -+extern int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int fifo_num); -+#define dwc_param_dev_perio_tx_fifo_size_default 256 -+ -+/** Number of 4-byte words in the Rx FIFO in host mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if); -+//#define dwc_param_host_rx_fifo_size_default 1024 -+#define dwc_param_host_rx_fifo_size_default 774 // Broadcom BCM2708 -+ -+/** Number of 4-byte words in the non-periodic Tx FIFO in host mode -+ * when Dynamic FIFO sizing is enabled in the core. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if); -+//#define dwc_param_host_nperio_tx_fifo_size_default 1024 -+#define dwc_param_host_nperio_tx_fifo_size_default 0x100 // Broadcom BCM2708 -+ -+/** Number of 4-byte words in the host periodic Tx FIFO when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if); -+//#define dwc_param_host_perio_tx_fifo_size_default 1024 -+#define dwc_param_host_perio_tx_fifo_size_default 0x200 // Broadcom BCM2708 -+ -+/** The maximum transfer size supported in bytes. -+ * 2047 to 65,535 (default 65,535) -+ */ -+extern int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if); -+#define dwc_param_max_transfer_size_default 65535 -+ -+/** The maximum number of packets in a transfer. -+ * 15 to 511 (default 511) -+ */ -+extern int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if); -+#define dwc_param_max_packet_count_default 511 -+ -+/** The number of host channel registers to use. -+ * 1 to 16 (default 12) -+ * Note: The FPGA configuration supports a maximum of 12 host channels. -+ */ -+extern int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if); -+//#define dwc_param_host_channels_default 12 -+#define dwc_param_host_channels_default 8 // Broadcom BCM2708 -+ -+/** The number of endpoints in addition to EP0 available for device -+ * mode operations. -+ * 1 to 15 (default 6 IN and OUT) -+ * Note: The FPGA configuration supports a maximum of 6 IN and OUT -+ * endpoints in addition to EP0. -+ */ -+extern int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if); -+#define dwc_param_dev_endpoints_default 6 -+ -+/** -+ * Specifies the type of PHY interface to use. By default, the driver -+ * will automatically detect the phy_type. -+ * -+ * 0 - Full Speed PHY -+ * 1 - UTMI+ (default) -+ * 2 - ULPI -+ */ -+extern int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if); -+#define DWC_PHY_TYPE_PARAM_FS 0 -+#define DWC_PHY_TYPE_PARAM_UTMI 1 -+#define DWC_PHY_TYPE_PARAM_ULPI 2 -+#define dwc_param_phy_type_default DWC_PHY_TYPE_PARAM_UTMI -+ -+/** -+ * Specifies the UTMI+ Data Width. This parameter is -+ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI -+ * PHY_TYPE, this parameter indicates the data width between -+ * the MAC and the ULPI Wrapper.) Also, this parameter is -+ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set -+ * to "8 and 16 bits", meaning that the core has been -+ * configured to work at either data path width. -+ * -+ * 8 or 16 bits (default 16) -+ */ -+extern int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if); -+//#define dwc_param_phy_utmi_width_default 16 -+#define dwc_param_phy_utmi_width_default 8 // Broadcom BCM2708 -+ -+/** -+ * Specifies whether the ULPI operates at double or single -+ * data rate. This parameter is only applicable if PHY_TYPE is -+ * ULPI. -+ * -+ * 0 - single data rate ULPI interface with 8 bit wide data -+ * bus (default) -+ * 1 - double data rate ULPI interface with 4 bit wide data -+ * bus -+ */ -+extern int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if); -+#define dwc_param_phy_ulpi_ddr_default 0 -+ -+/** -+ * Specifies whether to use the internal or external supply to -+ * drive the vbus with a ULPI phy. -+ */ -+extern int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if); -+#define DWC_PHY_ULPI_INTERNAL_VBUS 0 -+#define DWC_PHY_ULPI_EXTERNAL_VBUS 1 -+#define dwc_param_phy_ulpi_ext_vbus_default DWC_PHY_ULPI_INTERNAL_VBUS -+ -+/** -+ * Specifies whether to use the I2Cinterface for full speed PHY. This -+ * parameter is only applicable if PHY_TYPE is FS. -+ * 0 - No (default) -+ * 1 - Yes -+ */ -+extern int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_i2c_enable_default 0 -+ -+extern int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if); -+#define dwc_param_ulpi_fs_ls_default 0 -+ -+extern int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if); -+#define dwc_param_ts_dline_default 0 -+ -+/** -+ * Specifies whether dedicated transmit FIFOs are -+ * enabled for non periodic IN endpoints in device mode -+ * 0 - No -+ * 1 - Yes -+ */ -+extern int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_en_multiple_tx_fifo_default 1 -+ -+/** Number of 4-byte words in each of the Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+extern int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num, int32_t val); -+extern int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num); -+#define dwc_param_dev_tx_fifo_size_default 768 -+ -+/** Thresholding enable flag- -+ * bit 0 - enable non-ISO Tx thresholding -+ * bit 1 - enable ISO Tx thresholding -+ * bit 2 - enable Rx thresholding -+ */ -+extern int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_thr_ctl(dwc_otg_core_if_t * core_if, int fifo_num); -+#define dwc_param_thr_ctl_default 0 -+ -+/** Thresholding length for Tx -+ * FIFOs in 32 bit DWORDs -+ */ -+extern int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_tx_thr_length(dwc_otg_core_if_t * core_if); -+#define dwc_param_tx_thr_length_default 64 -+ -+/** Thresholding length for Rx -+ * FIFOs in 32 bit DWORDs -+ */ -+extern int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_rx_thr_length(dwc_otg_core_if_t * core_if); -+#define dwc_param_rx_thr_length_default 64 -+ -+/** -+ * Specifies whether LPM (Link Power Management) support is enabled -+ */ -+extern int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_lpm_enable_default 1 -+ -+/** -+ * Specifies whether PTI enhancement is enabled -+ */ -+extern int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_pti_enable_default 0 -+ -+/** -+ * Specifies whether MPI enhancement is enabled -+ */ -+extern int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_mpi_enable_default 0 -+ -+/** -+ * Specifies whether ADP capability is enabled -+ */ -+extern int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_adp_enable_default 0 -+ -+/** -+ * Specifies whether IC_USB capability is enabled -+ */ -+ -+extern int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if); -+#define dwc_param_ic_usb_cap_default 0 -+ -+extern int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if); -+#define dwc_param_ahb_thr_ratio_default 0 -+ -+extern int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if); -+#define dwc_param_power_down_default 0 -+ -+extern int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if); -+#define dwc_param_reload_ctl_default 0 -+ -+extern int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if); -+#define dwc_param_dev_out_nak_default 0 -+ -+extern int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if); -+#define dwc_param_cont_on_bna_default 0 -+ -+extern int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if); -+#define dwc_param_ahb_single_default 0 -+ -+extern int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if); -+#define dwc_param_otg_ver_default 0 -+ -+/** @} */ -+ -+/** @name Access to registers and bit-fields */ -+ -+/** -+ * Dump core registers and SPRAM -+ */ -+extern void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_dump_spram(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_dump_host_registers(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_dump_global_registers(dwc_otg_core_if_t * _core_if); -+ -+/** -+ * Get host negotiation status. -+ */ -+extern uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get srp status -+ */ -+extern uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Set hnpreq bit in the GOTGCTL register. -+ */ -+extern void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get Content of SNPSID register. -+ */ -+extern uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get current mode. -+ * Returns 0 if in device mode, and 1 if in host mode. -+ */ -+extern uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of hnpcapable field in the GUSBCFG register -+ */ -+extern uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of hnpcapable field in the GUSBCFG register -+ */ -+extern void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of srpcapable field in the GUSBCFG register -+ */ -+extern uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of srpcapable field in the GUSBCFG register -+ */ -+extern void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of devspeed field in the DCFG register -+ */ -+extern uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of devspeed field in the DCFG register -+ */ -+extern void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get the value of busconnected field from the HPRT0 register -+ */ -+extern uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Gets the device enumeration Speed. -+ */ -+extern uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of prtpwr field from the HPRT0 register -+ */ -+extern uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of flag indicating core state - hibernated or not -+ */ -+extern uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Set value of prtpwr field from the HPRT0 register -+ */ -+extern void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of prtsusp field from the HPRT0 regsiter -+ */ -+extern uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of prtpwr field from the HPRT0 register -+ */ -+extern void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of ModeChTimEn field from the HCFG regsiter -+ */ -+extern uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of ModeChTimEn field from the HCFG regsiter -+ */ -+extern void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of Fram Interval field from the HFIR regsiter -+ */ -+extern uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of Frame Interval field from the HFIR regsiter -+ */ -+extern void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Set value of prtres field from the HPRT0 register -+ *FIXME Remove? -+ */ -+extern void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of rmtwkupsig bit in DCTL register -+ */ -+extern uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of prt_sleep_sts field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of rem_wkup_en field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of appl_resp field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of appl_resp field from the GLPMCFG register -+ */ -+extern void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of hsic_connect field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of hsic_connect field from the GLPMCFG register -+ */ -+extern void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of inv_sel_hsic field from the GLPMCFG register. -+ */ -+extern uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of inv_sel_hsic field from the GLPMFG register. -+ */ -+extern void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/* -+ * Some functions for accessing registers -+ */ -+ -+/** -+ * GOTGCTL register -+ */ -+extern uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GUSBCFG register -+ */ -+extern uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GRXFSIZ register -+ */ -+extern uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GNPTXFSIZ register -+ */ -+extern uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+extern uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GGPIO register -+ */ -+extern uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GUID register -+ */ -+extern uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * HPRT0 register -+ */ -+extern uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GHPTXFSIZE -+ */ -+extern uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if); -+ -+/** @} */ -+ -+#endif /* __DWC_CORE_IF_H__ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_dbg.h b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h -new file mode 100644 -index 0000000000000000000000000000000000000000..ccc24e010e449cbda488050d901e9a3995236e33 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h -@@ -0,0 +1,117 @@ -+/* ========================================================================== -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_DBG_H__ -+#define __DWC_OTG_DBG_H__ -+ -+/** @file -+ * This file defines debug levels. -+ * Debugging support vanishes in non-debug builds. -+ */ -+ -+/** -+ * The Debug Level bit-mask variable. -+ */ -+extern uint32_t g_dbg_lvl; -+/** -+ * Set the Debug Level variable. -+ */ -+static inline uint32_t SET_DEBUG_LEVEL(const uint32_t new) -+{ -+ uint32_t old = g_dbg_lvl; -+ g_dbg_lvl = new; -+ return old; -+} -+ -+#define DBG_USER (0x1) -+/** When debug level has the DBG_CIL bit set, display CIL Debug messages. */ -+#define DBG_CIL (0x2) -+/** When debug level has the DBG_CILV bit set, display CIL Verbose debug -+ * messages */ -+#define DBG_CILV (0x20) -+/** When debug level has the DBG_PCD bit set, display PCD (Device) debug -+ * messages */ -+#define DBG_PCD (0x4) -+/** When debug level has the DBG_PCDV set, display PCD (Device) Verbose debug -+ * messages */ -+#define DBG_PCDV (0x40) -+/** When debug level has the DBG_HCD bit set, display Host debug messages */ -+#define DBG_HCD (0x8) -+/** When debug level has the DBG_HCDV bit set, display Verbose Host debug -+ * messages */ -+#define DBG_HCDV (0x80) -+/** When debug level has the DBG_HCD_URB bit set, display enqueued URBs in host -+ * mode. */ -+#define DBG_HCD_URB (0x800) -+/** When debug level has the DBG_HCDI bit set, display host interrupt -+ * messages. */ -+#define DBG_HCDI (0x1000) -+ -+/** When debug level has any bit set, display debug messages */ -+#define DBG_ANY (0xFF) -+ -+/** All debug messages off */ -+#define DBG_OFF 0 -+ -+/** Prefix string for DWC_DEBUG print macros. */ -+#define USB_DWC "DWC_otg: " -+ -+/** -+ * Print a debug message when the Global debug level variable contains -+ * the bit defined in lvl. -+ * -+ * @param[in] lvl - Debug level, use one of the DBG_ constants above. -+ * @param[in] x - like printf -+ * -+ * Example:

-+ * -+ * DWC_DEBUGPL( DBG_ANY, "%s(%p)\n", __func__, _reg_base_addr); -+ * -+ *
-+ * results in:
-+ * -+ * usb-DWC_otg: dwc_otg_cil_init(ca867000) -+ * -+ */ -+#ifdef DEBUG -+ -+# define DWC_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)__DWC_DEBUG(USB_DWC x ); }while(0) -+# define DWC_DEBUGP(x...) DWC_DEBUGPL(DBG_ANY, x ) -+ -+# define CHK_DEBUG_LEVEL(level) ((level) & g_dbg_lvl) -+ -+#else -+ -+# define DWC_DEBUGPL(lvl, x...) do{}while(0) -+# define DWC_DEBUGP(x...) -+ -+# define CHK_DEBUG_LEVEL(level) (0) -+ -+#endif /*DEBUG*/ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -new file mode 100644 -index 0000000000000000000000000000000000000000..cb060a7179a3eec791506ed2779b553cad9841b0 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -@@ -0,0 +1,1757 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ -+ * $Revision: #92 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * The dwc_otg_driver module provides the initialization and cleanup entry -+ * points for the DWC_otg driver. This module will be dynamically installed -+ * after Linux is booted using the insmod command. When the module is -+ * installed, the dwc_otg_driver_init function is called. When the module is -+ * removed (using rmmod), the dwc_otg_driver_cleanup function is called. -+ * -+ * This module also defines a data structure for the dwc_otg_driver, which is -+ * used in conjunction with the standard ARM lm_device structure. These -+ * structures allow the OTG driver to comply with the standard Linux driver -+ * model in which devices and drivers are registered with a bus driver. This -+ * has the benefit that Linux can expose attributes of the driver and device -+ * in its special sysfs file system. Users can then read or write files in -+ * this file system to perform diagnostics on the driver components or the -+ * device. -+ */ -+ -+#include "dwc_otg_os_dep.h" -+#include "dwc_os.h" -+#include "dwc_otg_dbg.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_attr.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_fiq_fsm.h" -+ -+#define DWC_DRIVER_VERSION "3.00a 10-AUG-2012" -+#define DWC_DRIVER_DESC "HS OTG USB Controller driver" -+ -+bool microframe_schedule=true; -+ -+static const char dwc_driver_name[] = "dwc_otg"; -+ -+ -+extern int pcd_init( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+extern int hcd_init( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+ -+extern int pcd_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *_dev -+#endif -+ ); -+ -+extern void hcd_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *_dev -+#endif -+ ); -+ -+extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); -+ -+/*-------------------------------------------------------------------------*/ -+/* Encapsulate the module parameter settings */ -+ -+struct dwc_otg_driver_module_params { -+ int32_t opt; -+ int32_t otg_cap; -+ int32_t dma_enable; -+ int32_t dma_desc_enable; -+ int32_t dma_burst_size; -+ int32_t speed; -+ int32_t host_support_fs_ls_low_power; -+ int32_t host_ls_low_power_phy_clk; -+ int32_t enable_dynamic_fifo; -+ int32_t data_fifo_size; -+ int32_t dev_rx_fifo_size; -+ int32_t dev_nperio_tx_fifo_size; -+ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; -+ int32_t host_rx_fifo_size; -+ int32_t host_nperio_tx_fifo_size; -+ int32_t host_perio_tx_fifo_size; -+ int32_t max_transfer_size; -+ int32_t max_packet_count; -+ int32_t host_channels; -+ int32_t dev_endpoints; -+ int32_t phy_type; -+ int32_t phy_utmi_width; -+ int32_t phy_ulpi_ddr; -+ int32_t phy_ulpi_ext_vbus; -+ int32_t i2c_enable; -+ int32_t ulpi_fs_ls; -+ int32_t ts_dline; -+ int32_t en_multiple_tx_fifo; -+ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; -+ uint32_t thr_ctl; -+ uint32_t tx_thr_length; -+ uint32_t rx_thr_length; -+ int32_t pti_enable; -+ int32_t mpi_enable; -+ int32_t lpm_enable; -+ int32_t ic_usb_cap; -+ int32_t ahb_thr_ratio; -+ int32_t power_down; -+ int32_t reload_ctl; -+ int32_t dev_out_nak; -+ int32_t cont_on_bna; -+ int32_t ahb_single; -+ int32_t otg_ver; -+ int32_t adp_enable; -+}; -+ -+static struct dwc_otg_driver_module_params dwc_otg_module_params = { -+ .opt = -1, -+ .otg_cap = -1, -+ .dma_enable = -1, -+ .dma_desc_enable = -1, -+ .dma_burst_size = -1, -+ .speed = -1, -+ .host_support_fs_ls_low_power = -1, -+ .host_ls_low_power_phy_clk = -1, -+ .enable_dynamic_fifo = -1, -+ .data_fifo_size = -1, -+ .dev_rx_fifo_size = -1, -+ .dev_nperio_tx_fifo_size = -1, -+ .dev_perio_tx_fifo_size = { -+ /* dev_perio_tx_fifo_size_1 */ -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1 -+ /* 15 */ -+ }, -+ .host_rx_fifo_size = -1, -+ .host_nperio_tx_fifo_size = -1, -+ .host_perio_tx_fifo_size = -1, -+ .max_transfer_size = -1, -+ .max_packet_count = -1, -+ .host_channels = -1, -+ .dev_endpoints = -1, -+ .phy_type = -1, -+ .phy_utmi_width = -1, -+ .phy_ulpi_ddr = -1, -+ .phy_ulpi_ext_vbus = -1, -+ .i2c_enable = -1, -+ .ulpi_fs_ls = -1, -+ .ts_dline = -1, -+ .en_multiple_tx_fifo = -1, -+ .dev_tx_fifo_size = { -+ /* dev_tx_fifo_size */ -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1 -+ /* 15 */ -+ }, -+ .thr_ctl = -1, -+ .tx_thr_length = -1, -+ .rx_thr_length = -1, -+ .pti_enable = -1, -+ .mpi_enable = -1, -+ .lpm_enable = 0, -+ .ic_usb_cap = -1, -+ .ahb_thr_ratio = -1, -+ .power_down = -1, -+ .reload_ctl = -1, -+ .dev_out_nak = -1, -+ .cont_on_bna = -1, -+ .ahb_single = -1, -+ .otg_ver = -1, -+ .adp_enable = -1, -+}; -+ -+//Global variable to switch the fiq fix on or off -+bool fiq_enable = 1; -+// Global variable to enable the split transaction fix -+bool fiq_fsm_enable = true; -+//Bulk split-transaction NAK holdoff in microframes -+uint16_t nak_holdoff = 8; -+ -+unsigned short fiq_fsm_mask = 0x0F; -+ -+/** -+ * This function shows the Driver Version. -+ */ -+static ssize_t version_show(struct device_driver *dev, char *buf) -+{ -+ return snprintf(buf, sizeof(DWC_DRIVER_VERSION) + 2, "%s\n", -+ DWC_DRIVER_VERSION); -+} -+ -+static DRIVER_ATTR(version, S_IRUGO, version_show, NULL); -+ -+/** -+ * Global Debug Level Mask. -+ */ -+uint32_t g_dbg_lvl = 0; /* OFF */ -+ -+/** -+ * This function shows the driver Debug Level. -+ */ -+static ssize_t dbg_level_show(struct device_driver *drv, char *buf) -+{ -+ return sprintf(buf, "0x%0x\n", g_dbg_lvl); -+} -+ -+/** -+ * This function stores the driver Debug Level. -+ */ -+static ssize_t dbg_level_store(struct device_driver *drv, const char *buf, -+ size_t count) -+{ -+ g_dbg_lvl = simple_strtoul(buf, NULL, 16); -+ return count; -+} -+ -+static DRIVER_ATTR(debuglevel, S_IRUGO | S_IWUSR, dbg_level_show, -+ dbg_level_store); -+ -+/** -+ * This function is called during module intialization -+ * to pass module parameters to the DWC_OTG CORE. -+ */ -+static int set_parameters(dwc_otg_core_if_t * core_if) -+{ -+ int retval = 0; -+ int i; -+ -+ if (dwc_otg_module_params.otg_cap != -1) { -+ retval += -+ dwc_otg_set_param_otg_cap(core_if, -+ dwc_otg_module_params.otg_cap); -+ } -+ if (dwc_otg_module_params.dma_enable != -1) { -+ retval += -+ dwc_otg_set_param_dma_enable(core_if, -+ dwc_otg_module_params. -+ dma_enable); -+ } -+ if (dwc_otg_module_params.dma_desc_enable != -1) { -+ retval += -+ dwc_otg_set_param_dma_desc_enable(core_if, -+ dwc_otg_module_params. -+ dma_desc_enable); -+ } -+ if (dwc_otg_module_params.opt != -1) { -+ retval += -+ dwc_otg_set_param_opt(core_if, dwc_otg_module_params.opt); -+ } -+ if (dwc_otg_module_params.dma_burst_size != -1) { -+ retval += -+ dwc_otg_set_param_dma_burst_size(core_if, -+ dwc_otg_module_params. -+ dma_burst_size); -+ } -+ if (dwc_otg_module_params.host_support_fs_ls_low_power != -1) { -+ retval += -+ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, -+ dwc_otg_module_params. -+ host_support_fs_ls_low_power); -+ } -+ if (dwc_otg_module_params.enable_dynamic_fifo != -1) { -+ retval += -+ dwc_otg_set_param_enable_dynamic_fifo(core_if, -+ dwc_otg_module_params. -+ enable_dynamic_fifo); -+ } -+ if (dwc_otg_module_params.data_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_data_fifo_size(core_if, -+ dwc_otg_module_params. -+ data_fifo_size); -+ } -+ if (dwc_otg_module_params.dev_rx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_dev_rx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_rx_fifo_size); -+ } -+ if (dwc_otg_module_params.dev_nperio_tx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_nperio_tx_fifo_size); -+ } -+ if (dwc_otg_module_params.host_rx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_host_rx_fifo_size(core_if, -+ dwc_otg_module_params.host_rx_fifo_size); -+ } -+ if (dwc_otg_module_params.host_nperio_tx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ host_nperio_tx_fifo_size); -+ } -+ if (dwc_otg_module_params.host_perio_tx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ host_perio_tx_fifo_size); -+ } -+ if (dwc_otg_module_params.max_transfer_size != -1) { -+ retval += -+ dwc_otg_set_param_max_transfer_size(core_if, -+ dwc_otg_module_params. -+ max_transfer_size); -+ } -+ if (dwc_otg_module_params.max_packet_count != -1) { -+ retval += -+ dwc_otg_set_param_max_packet_count(core_if, -+ dwc_otg_module_params. -+ max_packet_count); -+ } -+ if (dwc_otg_module_params.host_channels != -1) { -+ retval += -+ dwc_otg_set_param_host_channels(core_if, -+ dwc_otg_module_params. -+ host_channels); -+ } -+ if (dwc_otg_module_params.dev_endpoints != -1) { -+ retval += -+ dwc_otg_set_param_dev_endpoints(core_if, -+ dwc_otg_module_params. -+ dev_endpoints); -+ } -+ if (dwc_otg_module_params.phy_type != -1) { -+ retval += -+ dwc_otg_set_param_phy_type(core_if, -+ dwc_otg_module_params.phy_type); -+ } -+ if (dwc_otg_module_params.speed != -1) { -+ retval += -+ dwc_otg_set_param_speed(core_if, -+ dwc_otg_module_params.speed); -+ } -+ if (dwc_otg_module_params.host_ls_low_power_phy_clk != -1) { -+ retval += -+ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, -+ dwc_otg_module_params. -+ host_ls_low_power_phy_clk); -+ } -+ if (dwc_otg_module_params.phy_ulpi_ddr != -1) { -+ retval += -+ dwc_otg_set_param_phy_ulpi_ddr(core_if, -+ dwc_otg_module_params. -+ phy_ulpi_ddr); -+ } -+ if (dwc_otg_module_params.phy_ulpi_ext_vbus != -1) { -+ retval += -+ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, -+ dwc_otg_module_params. -+ phy_ulpi_ext_vbus); -+ } -+ if (dwc_otg_module_params.phy_utmi_width != -1) { -+ retval += -+ dwc_otg_set_param_phy_utmi_width(core_if, -+ dwc_otg_module_params. -+ phy_utmi_width); -+ } -+ if (dwc_otg_module_params.ulpi_fs_ls != -1) { -+ retval += -+ dwc_otg_set_param_ulpi_fs_ls(core_if, -+ dwc_otg_module_params.ulpi_fs_ls); -+ } -+ if (dwc_otg_module_params.ts_dline != -1) { -+ retval += -+ dwc_otg_set_param_ts_dline(core_if, -+ dwc_otg_module_params.ts_dline); -+ } -+ if (dwc_otg_module_params.i2c_enable != -1) { -+ retval += -+ dwc_otg_set_param_i2c_enable(core_if, -+ dwc_otg_module_params. -+ i2c_enable); -+ } -+ if (dwc_otg_module_params.en_multiple_tx_fifo != -1) { -+ retval += -+ dwc_otg_set_param_en_multiple_tx_fifo(core_if, -+ dwc_otg_module_params. -+ en_multiple_tx_fifo); -+ } -+ for (i = 0; i < 15; i++) { -+ if (dwc_otg_module_params.dev_perio_tx_fifo_size[i] != -1) { -+ retval += -+ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_perio_tx_fifo_size -+ [i], i); -+ } -+ } -+ -+ for (i = 0; i < 15; i++) { -+ if (dwc_otg_module_params.dev_tx_fifo_size[i] != -1) { -+ retval += dwc_otg_set_param_dev_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_tx_fifo_size -+ [i], i); -+ } -+ } -+ if (dwc_otg_module_params.thr_ctl != -1) { -+ retval += -+ dwc_otg_set_param_thr_ctl(core_if, -+ dwc_otg_module_params.thr_ctl); -+ } -+ if (dwc_otg_module_params.mpi_enable != -1) { -+ retval += -+ dwc_otg_set_param_mpi_enable(core_if, -+ dwc_otg_module_params. -+ mpi_enable); -+ } -+ if (dwc_otg_module_params.pti_enable != -1) { -+ retval += -+ dwc_otg_set_param_pti_enable(core_if, -+ dwc_otg_module_params. -+ pti_enable); -+ } -+ if (dwc_otg_module_params.lpm_enable != -1) { -+ retval += -+ dwc_otg_set_param_lpm_enable(core_if, -+ dwc_otg_module_params. -+ lpm_enable); -+ } -+ if (dwc_otg_module_params.ic_usb_cap != -1) { -+ retval += -+ dwc_otg_set_param_ic_usb_cap(core_if, -+ dwc_otg_module_params. -+ ic_usb_cap); -+ } -+ if (dwc_otg_module_params.tx_thr_length != -1) { -+ retval += -+ dwc_otg_set_param_tx_thr_length(core_if, -+ dwc_otg_module_params.tx_thr_length); -+ } -+ if (dwc_otg_module_params.rx_thr_length != -1) { -+ retval += -+ dwc_otg_set_param_rx_thr_length(core_if, -+ dwc_otg_module_params. -+ rx_thr_length); -+ } -+ if (dwc_otg_module_params.ahb_thr_ratio != -1) { -+ retval += -+ dwc_otg_set_param_ahb_thr_ratio(core_if, -+ dwc_otg_module_params.ahb_thr_ratio); -+ } -+ if (dwc_otg_module_params.power_down != -1) { -+ retval += -+ dwc_otg_set_param_power_down(core_if, -+ dwc_otg_module_params.power_down); -+ } -+ if (dwc_otg_module_params.reload_ctl != -1) { -+ retval += -+ dwc_otg_set_param_reload_ctl(core_if, -+ dwc_otg_module_params.reload_ctl); -+ } -+ -+ if (dwc_otg_module_params.dev_out_nak != -1) { -+ retval += -+ dwc_otg_set_param_dev_out_nak(core_if, -+ dwc_otg_module_params.dev_out_nak); -+ } -+ -+ if (dwc_otg_module_params.cont_on_bna != -1) { -+ retval += -+ dwc_otg_set_param_cont_on_bna(core_if, -+ dwc_otg_module_params.cont_on_bna); -+ } -+ -+ if (dwc_otg_module_params.ahb_single != -1) { -+ retval += -+ dwc_otg_set_param_ahb_single(core_if, -+ dwc_otg_module_params.ahb_single); -+ } -+ -+ if (dwc_otg_module_params.otg_ver != -1) { -+ retval += -+ dwc_otg_set_param_otg_ver(core_if, -+ dwc_otg_module_params.otg_ver); -+ } -+ if (dwc_otg_module_params.adp_enable != -1) { -+ retval += -+ dwc_otg_set_param_adp_enable(core_if, -+ dwc_otg_module_params. -+ adp_enable); -+ } -+ return retval; -+} -+ -+/** -+ * This function is the top level interrupt handler for the Common -+ * (Device and host modes) interrupts. -+ */ -+static irqreturn_t dwc_otg_common_irq(int irq, void *dev) -+{ -+ int32_t retval = IRQ_NONE; -+ -+ retval = dwc_otg_handle_common_intr(dev); -+ if (retval != 0) { -+ S3C2410X_CLEAR_EINTPEND(); -+ } -+ return IRQ_RETVAL(retval); -+} -+ -+/** -+ * This function is called when a lm_device is unregistered with the -+ * dwc_otg_driver. This happens, for example, when the rmmod command is -+ * executed. The device may or may not be electrically present. If it is -+ * present, the driver stops device processing. Any resources used on behalf -+ * of this device are freed. -+ * -+ * @param _dev -+ */ -+#ifdef LM_INTERFACE -+#define REM_RETVAL(n) -+static void dwc_otg_driver_remove( struct lm_device *_dev ) -+{ dwc_otg_device_t *otg_dev = lm_get_drvdata(_dev); -+#elif defined(PCI_INTERFACE) -+#define REM_RETVAL(n) -+static void dwc_otg_driver_remove( struct pci_dev *_dev ) -+{ dwc_otg_device_t *otg_dev = pci_get_drvdata(_dev); -+#elif defined(PLATFORM_INTERFACE) -+#define REM_RETVAL(n) n -+static int dwc_otg_driver_remove( struct platform_device *_dev ) -+{ dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); -+#endif -+ -+ DWC_DEBUGPL(DBG_ANY, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); -+ -+ if (!otg_dev) { -+ /* Memory allocation for the dwc_otg_device failed. */ -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); -+ return REM_RETVAL(-ENOMEM); -+ } -+#ifndef DWC_DEVICE_ONLY -+ if (otg_dev->hcd) { -+ hcd_remove(_dev); -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); -+ return REM_RETVAL(-EINVAL); -+ } -+#endif -+ -+#ifndef DWC_HOST_ONLY -+ if (otg_dev->pcd) { -+ pcd_remove(_dev); -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->pcd NULL!\n", __func__); -+ return REM_RETVAL(-EINVAL); -+ } -+#endif -+ /* -+ * Free the IRQ -+ */ -+ if (otg_dev->common_irq_installed) { -+#ifdef PLATFORM_INTERFACE -+ free_irq(platform_get_irq(_dev, 0), otg_dev); -+#else -+ free_irq(_dev->irq, otg_dev); -+#endif -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: There is no installed irq!\n", __func__); -+ return REM_RETVAL(-ENXIO); -+ } -+ -+ if (otg_dev->core_if) { -+ dwc_otg_cil_remove(otg_dev->core_if); -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->core_if NULL!\n", __func__); -+ return REM_RETVAL(-ENXIO); -+ } -+ -+ /* -+ * Remove the device attributes -+ */ -+ dwc_otg_attr_remove(_dev); -+ -+ /* -+ * Return the memory. -+ */ -+ if (otg_dev->os_dep.base) { -+ iounmap(otg_dev->os_dep.base); -+ } -+ DWC_FREE(otg_dev); -+ -+ /* -+ * Clear the drvdata pointer. -+ */ -+#ifdef LM_INTERFACE -+ lm_set_drvdata(_dev, 0); -+#elif defined(PCI_INTERFACE) -+ release_mem_region(otg_dev->os_dep.rsrc_start, -+ otg_dev->os_dep.rsrc_len); -+ pci_set_drvdata(_dev, 0); -+#elif defined(PLATFORM_INTERFACE) -+ platform_set_drvdata(_dev, 0); -+#endif -+ return REM_RETVAL(0); -+} -+ -+/** -+ * This function is called when an lm_device is bound to a -+ * dwc_otg_driver. It creates the driver components required to -+ * control the device (CIL, HCD, and PCD) and it initializes the -+ * device. The driver components are stored in a dwc_otg_device -+ * structure. A reference to the dwc_otg_device is saved in the -+ * lm_device. This allows the driver to access the dwc_otg_device -+ * structure on subsequent calls to driver methods for this device. -+ * -+ * @param _dev Bus device -+ */ -+static int dwc_otg_driver_probe( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev, -+ const struct pci_device_id *id -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *_dev -+#endif -+ ) -+{ -+ int retval = 0; -+ dwc_otg_device_t *dwc_otg_device; -+ int devirq; -+ -+ dev_dbg(&_dev->dev, "dwc_otg_driver_probe(%p)\n", _dev); -+#ifdef LM_INTERFACE -+ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)_dev->resource.start); -+#elif defined(PCI_INTERFACE) -+ if (!id) { -+ DWC_ERROR("Invalid pci_device_id %p", id); -+ return -EINVAL; -+ } -+ -+ if (!_dev || (pci_enable_device(_dev) < 0)) { -+ DWC_ERROR("Invalid pci_device %p", _dev); -+ return -ENODEV; -+ } -+ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)pci_resource_start(_dev,0)); -+ /* other stuff needed as well? */ -+ -+#elif defined(PLATFORM_INTERFACE) -+ dev_dbg(&_dev->dev, "start=0x%08x (len 0x%x)\n", -+ (unsigned)_dev->resource->start, -+ (unsigned)(_dev->resource->end - _dev->resource->start)); -+#endif -+ -+ dwc_otg_device = DWC_ALLOC(sizeof(dwc_otg_device_t)); -+ -+ if (!dwc_otg_device) { -+ dev_err(&_dev->dev, "kmalloc of dwc_otg_device failed\n"); -+ return -ENOMEM; -+ } -+ -+ memset(dwc_otg_device, 0, sizeof(*dwc_otg_device)); -+ dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF; -+ dwc_otg_device->os_dep.platformdev = _dev; -+ -+ /* -+ * Map the DWC_otg Core memory into virtual address space. -+ */ -+#ifdef LM_INTERFACE -+ dwc_otg_device->os_dep.base = ioremap(_dev->resource.start, SZ_256K); -+ -+ if (!dwc_otg_device->os_dep.base) { -+ dev_err(&_dev->dev, "ioremap() failed\n"); -+ DWC_FREE(dwc_otg_device); -+ return -ENOMEM; -+ } -+ dev_dbg(&_dev->dev, "base=0x%08x\n", -+ (unsigned)dwc_otg_device->os_dep.base); -+#elif defined(PCI_INTERFACE) -+ _dev->current_state = PCI_D0; -+ _dev->dev.power.power_state = PMSG_ON; -+ -+ if (!_dev->irq) { -+ DWC_ERROR("Found HC with no IRQ. Check BIOS/PCI %s setup!", -+ pci_name(_dev)); -+ iounmap(dwc_otg_device->os_dep.base); -+ DWC_FREE(dwc_otg_device); -+ return -ENODEV; -+ } -+ -+ dwc_otg_device->os_dep.rsrc_start = pci_resource_start(_dev, 0); -+ dwc_otg_device->os_dep.rsrc_len = pci_resource_len(_dev, 0); -+ DWC_DEBUGPL(DBG_ANY, "PCI resource: start=%08x, len=%08x\n", -+ (unsigned)dwc_otg_device->os_dep.rsrc_start, -+ (unsigned)dwc_otg_device->os_dep.rsrc_len); -+ if (!request_mem_region -+ (dwc_otg_device->os_dep.rsrc_start, dwc_otg_device->os_dep.rsrc_len, -+ "dwc_otg")) { -+ dev_dbg(&_dev->dev, "error requesting memory\n"); -+ iounmap(dwc_otg_device->os_dep.base); -+ DWC_FREE(dwc_otg_device); -+ return -EFAULT; -+ } -+ -+ dwc_otg_device->os_dep.base = -+ ioremap_nocache(dwc_otg_device->os_dep.rsrc_start, -+ dwc_otg_device->os_dep.rsrc_len); -+ if (dwc_otg_device->os_dep.base == NULL) { -+ dev_dbg(&_dev->dev, "error mapping memory\n"); -+ release_mem_region(dwc_otg_device->os_dep.rsrc_start, -+ dwc_otg_device->os_dep.rsrc_len); -+ iounmap(dwc_otg_device->os_dep.base); -+ DWC_FREE(dwc_otg_device); -+ return -EFAULT; -+ } -+ dev_dbg(&_dev->dev, "base=0x%p (before adjust) \n", -+ dwc_otg_device->os_dep.base); -+ dwc_otg_device->os_dep.base = (char *)dwc_otg_device->os_dep.base; -+ dev_dbg(&_dev->dev, "base=0x%p (after adjust) \n", -+ dwc_otg_device->os_dep.base); -+ dev_dbg(&_dev->dev, "%s: mapped PA 0x%x to VA 0x%p\n", __func__, -+ (unsigned)dwc_otg_device->os_dep.rsrc_start, -+ dwc_otg_device->os_dep.base); -+ -+ pci_set_master(_dev); -+ pci_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PLATFORM_INTERFACE) -+ DWC_DEBUGPL(DBG_ANY,"Platform resource: start=%08x, len=%08x\n", -+ _dev->resource->start, -+ _dev->resource->end - _dev->resource->start + 1); -+#if 1 -+ if (!request_mem_region(_dev->resource[0].start, -+ _dev->resource[0].end - _dev->resource[0].start + 1, -+ "dwc_otg")) { -+ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); -+ retval = -EFAULT; -+ goto fail; -+ } -+ -+ dwc_otg_device->os_dep.base = ioremap_nocache(_dev->resource[0].start, -+ _dev->resource[0].end - -+ _dev->resource[0].start+1); -+ if (fiq_enable) -+ { -+ if (!request_mem_region(_dev->resource[1].start, -+ _dev->resource[1].end - _dev->resource[1].start + 1, -+ "dwc_otg")) { -+ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); -+ retval = -EFAULT; -+ goto fail; -+ } -+ -+ dwc_otg_device->os_dep.mphi_base = ioremap_nocache(_dev->resource[1].start, -+ _dev->resource[1].end - -+ _dev->resource[1].start + 1); -+ } -+ -+#else -+ { -+ struct map_desc desc = { -+ .virtual = IO_ADDRESS((unsigned)_dev->resource->start), -+ .pfn = __phys_to_pfn((unsigned)_dev->resource->start), -+ .length = SZ_128K, -+ .type = MT_DEVICE -+ }; -+ iotable_init(&desc, 1); -+ dwc_otg_device->os_dep.base = (void *)desc.virtual; -+ } -+#endif -+ if (!dwc_otg_device->os_dep.base) { -+ dev_err(&_dev->dev, "ioremap() failed\n"); -+ retval = -ENOMEM; -+ goto fail; -+ } -+ dev_dbg(&_dev->dev, "base=0x%08x\n", -+ (unsigned)dwc_otg_device->os_dep.base); -+#endif -+ -+ /* -+ * Initialize driver data to point to the global DWC_otg -+ * Device structure. -+ */ -+#ifdef LM_INTERFACE -+ lm_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PLATFORM_INTERFACE) -+ platform_set_drvdata(_dev, dwc_otg_device); -+#endif -+ dev_dbg(&_dev->dev, "dwc_otg_device=0x%p\n", dwc_otg_device); -+ -+ dwc_otg_device->core_if = dwc_otg_cil_init(dwc_otg_device->os_dep.base); -+ DWC_DEBUGPL(DBG_HCDV, "probe of device %p given core_if %p\n", -+ dwc_otg_device, dwc_otg_device->core_if);//GRAYG -+ -+ if (!dwc_otg_device->core_if) { -+ dev_err(&_dev->dev, "CIL initialization failed!\n"); -+ retval = -ENOMEM; -+ goto fail; -+ } -+ -+ dev_dbg(&_dev->dev, "Calling get_gsnpsid\n"); -+ /* -+ * Attempt to ensure this device is really a DWC_otg Controller. -+ * Read and verify the SNPSID register contents. The value should be -+ * 0x45F42XXX or 0x45F42XXX, which corresponds to either "OT2" or "OTG3", -+ * as in "OTG version 2.XX" or "OTG version 3.XX". -+ */ -+ -+ if (((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F542000) && -+ ((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F543000)) { -+ dev_err(&_dev->dev, "Bad value for SNPSID: 0x%08x\n", -+ dwc_otg_get_gsnpsid(dwc_otg_device->core_if)); -+ retval = -EINVAL; -+ goto fail; -+ } -+ -+ /* -+ * Validate parameter values. -+ */ -+ dev_dbg(&_dev->dev, "Calling set_parameters\n"); -+ if (set_parameters(dwc_otg_device->core_if)) { -+ retval = -EINVAL; -+ goto fail; -+ } -+ -+ /* -+ * Create Device Attributes in sysfs -+ */ -+ dev_dbg(&_dev->dev, "Calling attr_create\n"); -+ dwc_otg_attr_create(_dev); -+ -+ /* -+ * Disable the global interrupt until all the interrupt -+ * handlers are installed. -+ */ -+ dev_dbg(&_dev->dev, "Calling disable_global_interrupts\n"); -+ dwc_otg_disable_global_interrupts(dwc_otg_device->core_if); -+ -+ /* -+ * Install the interrupt handler for the common interrupts before -+ * enabling common interrupts in core_init below. -+ */ -+ -+#if defined(PLATFORM_INTERFACE) -+ devirq = platform_get_irq(_dev, fiq_enable ? 0 : 1); -+#else -+ devirq = _dev->irq; -+#endif -+ DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n", -+ devirq); -+ dev_dbg(&_dev->dev, "Calling request_irq(%d)\n", devirq); -+ retval = request_irq(devirq, dwc_otg_common_irq, -+ IRQF_SHARED, -+ "dwc_otg", dwc_otg_device); -+ if (retval) { -+ DWC_ERROR("request of irq%d failed\n", devirq); -+ retval = -EBUSY; -+ goto fail; -+ } else { -+ dwc_otg_device->common_irq_installed = 1; -+ } -+ -+#ifndef IRQF_TRIGGER_LOW -+#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) -+ dev_dbg(&_dev->dev, "Calling set_irq_type\n"); -+ set_irq_type(devirq, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -+ IRQT_LOW -+#else -+ IRQ_TYPE_LEVEL_LOW -+#endif -+ ); -+#endif -+#endif /*IRQF_TRIGGER_LOW*/ -+ -+ /* -+ * Initialize the DWC_otg core. -+ */ -+ dev_dbg(&_dev->dev, "Calling dwc_otg_core_init\n"); -+ dwc_otg_core_init(dwc_otg_device->core_if); -+ -+#ifndef DWC_HOST_ONLY -+ /* -+ * Initialize the PCD -+ */ -+ dev_dbg(&_dev->dev, "Calling pcd_init\n"); -+ retval = pcd_init(_dev); -+ if (retval != 0) { -+ DWC_ERROR("pcd_init failed\n"); -+ dwc_otg_device->pcd = NULL; -+ goto fail; -+ } -+#endif -+#ifndef DWC_DEVICE_ONLY -+ /* -+ * Initialize the HCD -+ */ -+ dev_dbg(&_dev->dev, "Calling hcd_init\n"); -+ retval = hcd_init(_dev); -+ if (retval != 0) { -+ DWC_ERROR("hcd_init failed\n"); -+ dwc_otg_device->hcd = NULL; -+ goto fail; -+ } -+#endif -+ /* Recover from drvdata having been overwritten by hcd_init() */ -+#ifdef LM_INTERFACE -+ lm_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PLATFORM_INTERFACE) -+ platform_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PCI_INTERFACE) -+ pci_set_drvdata(_dev, dwc_otg_device); -+ dwc_otg_device->os_dep.pcidev = _dev; -+#endif -+ -+ /* -+ * Enable the global interrupt after all the interrupt -+ * handlers are installed if there is no ADP support else -+ * perform initial actions required for Internal ADP logic. -+ */ -+ if (!dwc_otg_get_param_adp_enable(dwc_otg_device->core_if)) { -+ dev_dbg(&_dev->dev, "Calling enable_global_interrupts\n"); -+ dwc_otg_enable_global_interrupts(dwc_otg_device->core_if); -+ dev_dbg(&_dev->dev, "Done\n"); -+ } else -+ dwc_otg_adp_start(dwc_otg_device->core_if, -+ dwc_otg_is_host_mode(dwc_otg_device->core_if)); -+ -+ return 0; -+ -+fail: -+ dwc_otg_driver_remove(_dev); -+ return retval; -+} -+ -+/** -+ * This structure defines the methods to be called by a bus driver -+ * during the lifecycle of a device on that bus. Both drivers and -+ * devices are registered with a bus driver. The bus driver matches -+ * devices to drivers based on information in the device and driver -+ * structures. -+ * -+ * The probe function is called when the bus driver matches a device -+ * to this driver. The remove function is called when a device is -+ * unregistered with the bus driver. -+ */ -+#ifdef LM_INTERFACE -+static struct lm_driver dwc_otg_driver = { -+ .drv = {.name = (char *)dwc_driver_name,}, -+ .probe = dwc_otg_driver_probe, -+ .remove = dwc_otg_driver_remove, -+ // 'suspend' and 'resume' absent -+}; -+#elif defined(PCI_INTERFACE) -+static const struct pci_device_id pci_ids[] = { { -+ PCI_DEVICE(0x16c3, 0xabcd), -+ .driver_data = -+ (unsigned long)0xdeadbeef, -+ }, { /* end: all zeroes */ } -+}; -+ -+MODULE_DEVICE_TABLE(pci, pci_ids); -+ -+/* pci driver glue; this is a "new style" PCI driver module */ -+static struct pci_driver dwc_otg_driver = { -+ .name = "dwc_otg", -+ .id_table = pci_ids, -+ -+ .probe = dwc_otg_driver_probe, -+ .remove = dwc_otg_driver_remove, -+ -+ .driver = { -+ .name = (char *)dwc_driver_name, -+ }, -+}; -+#elif defined(PLATFORM_INTERFACE) -+static struct platform_device_id platform_ids[] = { -+ { -+ .name = "bcm2708_usb", -+ .driver_data = (kernel_ulong_t) 0xdeadbeef, -+ }, -+ { /* end: all zeroes */ } -+}; -+MODULE_DEVICE_TABLE(platform, platform_ids); -+ -+static const struct of_device_id dwc_otg_of_match_table[] = { -+ { .compatible = "brcm,bcm2708-usb", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, dwc_otg_of_match_table); -+ -+static struct platform_driver dwc_otg_driver = { -+ .driver = { -+ .name = (char *)dwc_driver_name, -+ .of_match_table = dwc_otg_of_match_table, -+ }, -+ .id_table = platform_ids, -+ -+ .probe = dwc_otg_driver_probe, -+ .remove = dwc_otg_driver_remove, -+ // no 'shutdown', 'suspend', 'resume', 'suspend_late' or 'resume_early' -+}; -+#endif -+ -+/** -+ * This function is called when the dwc_otg_driver is installed with the -+ * insmod command. It registers the dwc_otg_driver structure with the -+ * appropriate bus driver. This will cause the dwc_otg_driver_probe function -+ * to be called. In addition, the bus driver will automatically expose -+ * attributes defined for the device and driver in the special sysfs file -+ * system. -+ * -+ * @return -+ */ -+static int __init dwc_otg_driver_init(void) -+{ -+ int retval = 0; -+ int error; -+ struct device_driver *drv; -+ -+ if(fiq_fsm_enable && !fiq_enable) { -+ printk(KERN_WARNING "dwc_otg: fiq_fsm_enable was set without fiq_enable! Correcting.\n"); -+ fiq_enable = 1; -+ } -+ -+ printk(KERN_INFO "%s: version %s (%s bus)\n", dwc_driver_name, -+ DWC_DRIVER_VERSION, -+#ifdef LM_INTERFACE -+ "logicmodule"); -+ retval = lm_driver_register(&dwc_otg_driver); -+ drv = &dwc_otg_driver.drv; -+#elif defined(PCI_INTERFACE) -+ "pci"); -+ retval = pci_register_driver(&dwc_otg_driver); -+ drv = &dwc_otg_driver.driver; -+#elif defined(PLATFORM_INTERFACE) -+ "platform"); -+ retval = platform_driver_register(&dwc_otg_driver); -+ drv = &dwc_otg_driver.driver; -+#endif -+ if (retval < 0) { -+ printk(KERN_ERR "%s retval=%d\n", __func__, retval); -+ return retval; -+ } -+ printk(KERN_DEBUG "dwc_otg: FIQ %s\n", fiq_enable ? "enabled":"disabled"); -+ printk(KERN_DEBUG "dwc_otg: NAK holdoff %s\n", nak_holdoff ? "enabled":"disabled"); -+ printk(KERN_DEBUG "dwc_otg: FIQ split-transaction FSM %s\n", fiq_fsm_enable ? "enabled":"disabled"); -+ -+ error = driver_create_file(drv, &driver_attr_version); -+#ifdef DEBUG -+ error = driver_create_file(drv, &driver_attr_debuglevel); -+#endif -+ return retval; -+} -+ -+module_init(dwc_otg_driver_init); -+ -+/** -+ * This function is called when the driver is removed from the kernel -+ * with the rmmod command. The driver unregisters itself with its bus -+ * driver. -+ * -+ */ -+static void __exit dwc_otg_driver_cleanup(void) -+{ -+ printk(KERN_DEBUG "dwc_otg_driver_cleanup()\n"); -+ -+#ifdef LM_INTERFACE -+ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_debuglevel); -+ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_version); -+ lm_driver_unregister(&dwc_otg_driver); -+#elif defined(PCI_INTERFACE) -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); -+ pci_unregister_driver(&dwc_otg_driver); -+#elif defined(PLATFORM_INTERFACE) -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); -+ platform_driver_unregister(&dwc_otg_driver); -+#endif -+ -+ printk(KERN_INFO "%s module removed\n", dwc_driver_name); -+} -+ -+module_exit(dwc_otg_driver_cleanup); -+ -+MODULE_DESCRIPTION(DWC_DRIVER_DESC); -+MODULE_AUTHOR("Synopsys Inc."); -+MODULE_LICENSE("GPL"); -+ -+module_param_named(otg_cap, dwc_otg_module_params.otg_cap, int, 0444); -+MODULE_PARM_DESC(otg_cap, "OTG Capabilities 0=HNP&SRP 1=SRP Only 2=None"); -+module_param_named(opt, dwc_otg_module_params.opt, int, 0444); -+MODULE_PARM_DESC(opt, "OPT Mode"); -+module_param_named(dma_enable, dwc_otg_module_params.dma_enable, int, 0444); -+MODULE_PARM_DESC(dma_enable, "DMA Mode 0=Slave 1=DMA enabled"); -+ -+module_param_named(dma_desc_enable, dwc_otg_module_params.dma_desc_enable, int, -+ 0444); -+MODULE_PARM_DESC(dma_desc_enable, -+ "DMA Desc Mode 0=Address DMA 1=DMA Descriptor enabled"); -+ -+module_param_named(dma_burst_size, dwc_otg_module_params.dma_burst_size, int, -+ 0444); -+MODULE_PARM_DESC(dma_burst_size, -+ "DMA Burst Size 1, 4, 8, 16, 32, 64, 128, 256"); -+module_param_named(speed, dwc_otg_module_params.speed, int, 0444); -+MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); -+module_param_named(host_support_fs_ls_low_power, -+ dwc_otg_module_params.host_support_fs_ls_low_power, int, -+ 0444); -+MODULE_PARM_DESC(host_support_fs_ls_low_power, -+ "Support Low Power w/FS or LS 0=Support 1=Don't Support"); -+module_param_named(host_ls_low_power_phy_clk, -+ dwc_otg_module_params.host_ls_low_power_phy_clk, int, 0444); -+MODULE_PARM_DESC(host_ls_low_power_phy_clk, -+ "Low Speed Low Power Clock 0=48Mhz 1=6Mhz"); -+module_param_named(enable_dynamic_fifo, -+ dwc_otg_module_params.enable_dynamic_fifo, int, 0444); -+MODULE_PARM_DESC(enable_dynamic_fifo, "0=cC Setting 1=Allow Dynamic Sizing"); -+module_param_named(data_fifo_size, dwc_otg_module_params.data_fifo_size, int, -+ 0444); -+MODULE_PARM_DESC(data_fifo_size, -+ "Total number of words in the data FIFO memory 32-32768"); -+module_param_named(dev_rx_fifo_size, dwc_otg_module_params.dev_rx_fifo_size, -+ int, 0444); -+MODULE_PARM_DESC(dev_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); -+module_param_named(dev_nperio_tx_fifo_size, -+ dwc_otg_module_params.dev_nperio_tx_fifo_size, int, 0444); -+MODULE_PARM_DESC(dev_nperio_tx_fifo_size, -+ "Number of words in the non-periodic Tx FIFO 16-32768"); -+module_param_named(dev_perio_tx_fifo_size_1, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[0], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_1, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_2, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[1], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_2, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_3, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[2], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_3, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_4, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[3], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_4, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_5, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[4], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_5, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_6, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[5], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_6, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_7, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[6], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_7, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_8, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[7], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_8, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_9, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[8], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_9, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_10, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[9], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_10, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_11, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[10], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_11, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_12, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[11], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_12, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_13, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[12], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_13, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_14, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[13], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_14, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_15, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[14], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_15, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(host_rx_fifo_size, dwc_otg_module_params.host_rx_fifo_size, -+ int, 0444); -+MODULE_PARM_DESC(host_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); -+module_param_named(host_nperio_tx_fifo_size, -+ dwc_otg_module_params.host_nperio_tx_fifo_size, int, 0444); -+MODULE_PARM_DESC(host_nperio_tx_fifo_size, -+ "Number of words in the non-periodic Tx FIFO 16-32768"); -+module_param_named(host_perio_tx_fifo_size, -+ dwc_otg_module_params.host_perio_tx_fifo_size, int, 0444); -+MODULE_PARM_DESC(host_perio_tx_fifo_size, -+ "Number of words in the host periodic Tx FIFO 16-32768"); -+module_param_named(max_transfer_size, dwc_otg_module_params.max_transfer_size, -+ int, 0444); -+/** @todo Set the max to 512K, modify checks */ -+MODULE_PARM_DESC(max_transfer_size, -+ "The maximum transfer size supported in bytes 2047-65535"); -+module_param_named(max_packet_count, dwc_otg_module_params.max_packet_count, -+ int, 0444); -+MODULE_PARM_DESC(max_packet_count, -+ "The maximum number of packets in a transfer 15-511"); -+module_param_named(host_channels, dwc_otg_module_params.host_channels, int, -+ 0444); -+MODULE_PARM_DESC(host_channels, -+ "The number of host channel registers to use 1-16"); -+module_param_named(dev_endpoints, dwc_otg_module_params.dev_endpoints, int, -+ 0444); -+MODULE_PARM_DESC(dev_endpoints, -+ "The number of endpoints in addition to EP0 available for device mode 1-15"); -+module_param_named(phy_type, dwc_otg_module_params.phy_type, int, 0444); -+MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI"); -+module_param_named(phy_utmi_width, dwc_otg_module_params.phy_utmi_width, int, -+ 0444); -+MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); -+module_param_named(phy_ulpi_ddr, dwc_otg_module_params.phy_ulpi_ddr, int, 0444); -+MODULE_PARM_DESC(phy_ulpi_ddr, -+ "ULPI at double or single data rate 0=Single 1=Double"); -+module_param_named(phy_ulpi_ext_vbus, dwc_otg_module_params.phy_ulpi_ext_vbus, -+ int, 0444); -+MODULE_PARM_DESC(phy_ulpi_ext_vbus, -+ "ULPI PHY using internal or external vbus 0=Internal"); -+module_param_named(i2c_enable, dwc_otg_module_params.i2c_enable, int, 0444); -+MODULE_PARM_DESC(i2c_enable, "FS PHY Interface"); -+module_param_named(ulpi_fs_ls, dwc_otg_module_params.ulpi_fs_ls, int, 0444); -+MODULE_PARM_DESC(ulpi_fs_ls, "ULPI PHY FS/LS mode only"); -+module_param_named(ts_dline, dwc_otg_module_params.ts_dline, int, 0444); -+MODULE_PARM_DESC(ts_dline, "Term select Dline pulsing for all PHYs"); -+module_param_named(debug, g_dbg_lvl, int, 0444); -+MODULE_PARM_DESC(debug, ""); -+ -+module_param_named(en_multiple_tx_fifo, -+ dwc_otg_module_params.en_multiple_tx_fifo, int, 0444); -+MODULE_PARM_DESC(en_multiple_tx_fifo, -+ "Dedicated Non Periodic Tx FIFOs 0=disabled 1=enabled"); -+module_param_named(dev_tx_fifo_size_1, -+ dwc_otg_module_params.dev_tx_fifo_size[0], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_1, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_2, -+ dwc_otg_module_params.dev_tx_fifo_size[1], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_2, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_3, -+ dwc_otg_module_params.dev_tx_fifo_size[2], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_3, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_4, -+ dwc_otg_module_params.dev_tx_fifo_size[3], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_4, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_5, -+ dwc_otg_module_params.dev_tx_fifo_size[4], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_5, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_6, -+ dwc_otg_module_params.dev_tx_fifo_size[5], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_6, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_7, -+ dwc_otg_module_params.dev_tx_fifo_size[6], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_7, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_8, -+ dwc_otg_module_params.dev_tx_fifo_size[7], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_8, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_9, -+ dwc_otg_module_params.dev_tx_fifo_size[8], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_9, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_10, -+ dwc_otg_module_params.dev_tx_fifo_size[9], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_10, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_11, -+ dwc_otg_module_params.dev_tx_fifo_size[10], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_11, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_12, -+ dwc_otg_module_params.dev_tx_fifo_size[11], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_12, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_13, -+ dwc_otg_module_params.dev_tx_fifo_size[12], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_13, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_14, -+ dwc_otg_module_params.dev_tx_fifo_size[13], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_14, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_15, -+ dwc_otg_module_params.dev_tx_fifo_size[14], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_15, "Number of words in the Tx FIFO 4-768"); -+ -+module_param_named(thr_ctl, dwc_otg_module_params.thr_ctl, int, 0444); -+MODULE_PARM_DESC(thr_ctl, -+ "Thresholding enable flag bit 0 - non ISO Tx thr., 1 - ISO Tx thr., 2 - Rx thr.- bit 0=disabled 1=enabled"); -+module_param_named(tx_thr_length, dwc_otg_module_params.tx_thr_length, int, -+ 0444); -+MODULE_PARM_DESC(tx_thr_length, "Tx Threshold length in 32 bit DWORDs"); -+module_param_named(rx_thr_length, dwc_otg_module_params.rx_thr_length, int, -+ 0444); -+MODULE_PARM_DESC(rx_thr_length, "Rx Threshold length in 32 bit DWORDs"); -+ -+module_param_named(pti_enable, dwc_otg_module_params.pti_enable, int, 0444); -+module_param_named(mpi_enable, dwc_otg_module_params.mpi_enable, int, 0444); -+module_param_named(lpm_enable, dwc_otg_module_params.lpm_enable, int, 0444); -+MODULE_PARM_DESC(lpm_enable, "LPM Enable 0=LPM Disabled 1=LPM Enabled"); -+module_param_named(ic_usb_cap, dwc_otg_module_params.ic_usb_cap, int, 0444); -+MODULE_PARM_DESC(ic_usb_cap, -+ "IC_USB Capability 0=IC_USB Disabled 1=IC_USB Enabled"); -+module_param_named(ahb_thr_ratio, dwc_otg_module_params.ahb_thr_ratio, int, -+ 0444); -+MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio"); -+module_param_named(power_down, dwc_otg_module_params.power_down, int, 0444); -+MODULE_PARM_DESC(power_down, "Power Down Mode"); -+module_param_named(reload_ctl, dwc_otg_module_params.reload_ctl, int, 0444); -+MODULE_PARM_DESC(reload_ctl, "HFIR Reload Control"); -+module_param_named(dev_out_nak, dwc_otg_module_params.dev_out_nak, int, 0444); -+MODULE_PARM_DESC(dev_out_nak, "Enable Device OUT NAK"); -+module_param_named(cont_on_bna, dwc_otg_module_params.cont_on_bna, int, 0444); -+MODULE_PARM_DESC(cont_on_bna, "Enable Enable Continue on BNA"); -+module_param_named(ahb_single, dwc_otg_module_params.ahb_single, int, 0444); -+MODULE_PARM_DESC(ahb_single, "Enable AHB Single Support"); -+module_param_named(adp_enable, dwc_otg_module_params.adp_enable, int, 0444); -+MODULE_PARM_DESC(adp_enable, "ADP Enable 0=ADP Disabled 1=ADP Enabled"); -+module_param_named(otg_ver, dwc_otg_module_params.otg_ver, int, 0444); -+MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0"); -+module_param(microframe_schedule, bool, 0444); -+MODULE_PARM_DESC(microframe_schedule, "Enable the microframe scheduler"); -+ -+module_param(fiq_enable, bool, 0444); -+MODULE_PARM_DESC(fiq_enable, "Enable the FIQ"); -+module_param(nak_holdoff, ushort, 0644); -+MODULE_PARM_DESC(nak_holdoff, "Throttle duration for bulk split-transaction endpoints on a NAK. Default 8"); -+module_param(fiq_fsm_enable, bool, 0444); -+MODULE_PARM_DESC(fiq_fsm_enable, "Enable the FIQ to perform split transactions as defined by fiq_fsm_mask"); -+module_param(fiq_fsm_mask, ushort, 0444); -+MODULE_PARM_DESC(fiq_fsm_mask, "Bitmask of transactions to perform in the FIQ.\n" -+ "Bit 0 : Non-periodic split transactions\n" -+ "Bit 1 : Periodic split transactions\n" -+ "Bit 2 : High-speed multi-transfer isochronous\n" -+ "All other bits should be set 0."); -+ -+ -+/** @page "Module Parameters" -+ * -+ * The following parameters may be specified when starting the module. -+ * These parameters define how the DWC_otg controller should be -+ * configured. Parameter values are passed to the CIL initialization -+ * function dwc_otg_cil_init -+ * -+ * Example: modprobe dwc_otg speed=1 otg_cap=1 -+ * -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+*/ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.h b/drivers/usb/host/dwc_otg/dwc_otg_driver.h -new file mode 100644 -index 0000000000000000000000000000000000000000..6a8be63a0ab20f4e1c56251b85648aa2a1d66383 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.h -@@ -0,0 +1,86 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $ -+ * $Revision: #19 $ -+ * $Date: 2010/11/15 $ -+ * $Change: 1627671 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_DRIVER_H__ -+#define __DWC_OTG_DRIVER_H__ -+ -+/** @file -+ * This file contains the interface to the Linux driver. -+ */ -+#include "dwc_otg_os_dep.h" -+#include "dwc_otg_core_if.h" -+ -+/* Type declarations */ -+struct dwc_otg_pcd; -+struct dwc_otg_hcd; -+ -+/** -+ * This structure is a wrapper that encapsulates the driver components used to -+ * manage a single DWC_otg controller. -+ */ -+typedef struct dwc_otg_device { -+ /** Structure containing OS-dependent stuff. KEEP THIS STRUCT AT THE -+ * VERY BEGINNING OF THE DEVICE STRUCT. OSes such as FreeBSD and NetBSD -+ * require this. */ -+ struct os_dependent os_dep; -+ -+ /** Pointer to the core interface structure. */ -+ dwc_otg_core_if_t *core_if; -+ -+ /** Pointer to the PCD structure. */ -+ struct dwc_otg_pcd *pcd; -+ -+ /** Pointer to the HCD structure. */ -+ struct dwc_otg_hcd *hcd; -+ -+ /** Flag to indicate whether the common IRQ handler is installed. */ -+ uint8_t common_irq_installed; -+ -+} dwc_otg_device_t; -+ -+/*We must clear S3C24XX_EINTPEND external interrupt register -+ * because after clearing in this register trigerred IRQ from -+ * H/W core in kernel interrupt can be occured again before OTG -+ * handlers clear all IRQ sources of Core registers because of -+ * timing latencies and Low Level IRQ Type. -+ */ -+#ifdef CONFIG_MACH_IPMATE -+#define S3C2410X_CLEAR_EINTPEND() \ -+do { \ -+ __raw_writel(1UL << 11,S3C24XX_EINTPEND); \ -+} while (0) -+#else -+#define S3C2410X_CLEAR_EINTPEND() do { } while (0) -+#endif -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -new file mode 100644 -index 0000000000000000000000000000000000000000..13047c08fb71cc6e44c66096720d4654d3f9e4e1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -@@ -0,0 +1,1355 @@ -+/* -+ * dwc_otg_fiq_fsm.c - The finite state machine FIQ -+ * -+ * Copyright (c) 2013 Raspberry Pi Foundation -+ * -+ * Author: Jonathan Bell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of Raspberry Pi nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * This FIQ implements functionality that performs split transactions on -+ * the dwc_otg hardware without any outside intervention. A split transaction -+ * is "queued" by nominating a specific host channel to perform the entirety -+ * of a split transaction. This FIQ will then perform the microframe-precise -+ * scheduling required in each phase of the transaction until completion. -+ * -+ * The FIQ functionality is glued into the Synopsys driver via the entry point -+ * in the FSM enqueue function, and at the exit point in handling a HC interrupt -+ * for a FSM-enabled channel. -+ * -+ * NB: Large parts of this implementation have architecture-specific code. -+ * For porting this functionality to other ARM machines, the minimum is required: -+ * - An interrupt controller allowing the top-level dwc USB interrupt to be routed -+ * to the FIQ -+ * - A method of forcing a software generated interrupt from FIQ mode that then -+ * triggers an IRQ entry (with the dwc USB handler called by this IRQ number) -+ * - Guaranteed interrupt routing such that both the FIQ and SGI occur on the same -+ * processor core - there is no locking between the FIQ and IRQ (aside from -+ * local_fiq_disable) -+ * -+ */ -+ -+#include "dwc_otg_fiq_fsm.h" -+ -+ -+char buffer[1000*16]; -+int wptr; -+void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...) -+{ -+ enum fiq_debug_level dbg_lvl_req = FIQDBG_ERR; -+ va_list args; -+ char text[17]; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + 0x408) }; -+ -+ if((dbg_lvl & dbg_lvl_req) || dbg_lvl == FIQDBG_ERR) -+ { -+ snprintf(text, 9, " %4d:%1u ", hfnum.b.frnum/8, hfnum.b.frnum & 7); -+ va_start(args, fmt); -+ vsnprintf(text+8, 9, fmt, args); -+ va_end(args); -+ -+ memcpy(buffer + wptr, text, 16); -+ wptr = (wptr + 16) % sizeof(buffer); -+ } -+} -+ -+/** -+ * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock -+ * Must be called with local interrupts and FIQ disabled. -+ */ -+#if defined(CONFIG_ARCH_BCM2835) && defined(CONFIG_SMP) -+inline void fiq_fsm_spin_lock(fiq_lock_t *lock) -+{ -+ unsigned long tmp; -+ uint32_t newval; -+ fiq_lock_t lockval; -+ smp_mb__before_spinlock(); -+ /* Nested locking, yay. If we are on the same CPU as the fiq, then the disable -+ * will be sufficient. If we are on a different CPU, then the lock protects us. */ -+ prefetchw(&lock->slock); -+ asm volatile ( -+ "1: ldrex %0, [%3]\n" -+ " add %1, %0, %4\n" -+ " strex %2, %1, [%3]\n" -+ " teq %2, #0\n" -+ " bne 1b" -+ : "=&r" (lockval), "=&r" (newval), "=&r" (tmp) -+ : "r" (&lock->slock), "I" (1 << 16) -+ : "cc"); -+ -+ while (lockval.tickets.next != lockval.tickets.owner) { -+ wfe(); -+ lockval.tickets.owner = ACCESS_ONCE(lock->tickets.owner); -+ } -+ smp_mb(); -+} -+#else -+inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { } -+#endif -+ -+/** -+ * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock -+ */ -+#if defined(CONFIG_ARCH_BCM2835) && defined(CONFIG_SMP) -+inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) -+{ -+ smp_mb(); -+ lock->tickets.owner++; -+ dsb_sev(); -+} -+#else -+inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) { } -+#endif -+ -+/** -+ * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction -+ * @channel: channel to re-enable -+ */ -+static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force) -+{ -+ hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) }; -+ -+ hcchar.b.chen = 0; -+ if (st->channel[n].hcchar_copy.b.eptype & 0x1) { -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; -+ /* Hardware bug workaround: update the ssplit index */ -+ if (st->channel[n].hcsplt_copy.b.spltena) -+ st->channel[n].expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; -+ -+ hcchar.b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; -+ } -+ -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); -+ hcchar.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ hcchar.b.chen = 1; -+ -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); -+ fiq_print(FIQDBG_INT, st, "HCGO %01d %01d", n, force); -+} -+ -+/** -+ * fiq_fsm_setup_csplit() - Prepare a host channel for a CSplit transaction stage -+ * @st: Pointer to the channel's state -+ * @n : channel number -+ * -+ * Change host channel registers to perform a complete-split transaction. Being mindful of the -+ * endpoint direction, set control regs up correctly. -+ */ -+static void notrace fiq_fsm_setup_csplit(struct fiq_state *st, int n) -+{ -+ hcsplt_data_t hcsplt = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT) }; -+ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; -+ -+ hcsplt.b.compsplt = 1; -+ if (st->channel[n].hcchar_copy.b.epdir == 1) { -+ // If IN, the CSPLIT result contains the data or a hub handshake. hctsiz = maxpacket. -+ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; -+ } else { -+ // If OUT, the CSPLIT result contains handshake only. -+ hctsiz.b.xfersize = 0; -+ } -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); -+ mb(); -+} -+ -+static inline int notrace fiq_get_xfer_len(struct fiq_state *st, int n) -+{ -+ /* The xfersize register is a bit wonky. For IN transfers, it decrements by the packet size. */ -+ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; -+ -+ if (st->channel[n].hcchar_copy.b.epdir == 0) { -+ return st->channel[n].hctsiz_copy.b.xfersize; -+ } else { -+ return st->channel[n].hctsiz_copy.b.xfersize - hctsiz.b.xfersize; -+ } -+ -+} -+ -+ -+/** -+ * fiq_increment_dma_buf() - update DMA address for bounce buffers after a CSPLIT -+ * -+ * Of use only for IN periodic transfers. -+ */ -+static int notrace fiq_increment_dma_buf(struct fiq_state *st, int num_channels, int n) -+{ -+ hcdma_data_t hcdma; -+ int i = st->channel[n].dma_info.index; -+ int len; -+ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; -+ -+ len = fiq_get_xfer_len(st, n); -+ fiq_print(FIQDBG_INT, st, "LEN: %03d", len); -+ st->channel[n].dma_info.slot_len[i] = len; -+ i++; -+ if (i > 6) -+ BUG(); -+ -+ hcdma.d32 = (dma_addr_t) &blob->channel[n].index[i].buf[0]; -+ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); -+ st->channel[n].dma_info.index = i; -+ return 0; -+} -+ -+/** -+ * fiq_reload_hctsiz() - for IN transactions, reset HCTSIZ -+ */ -+static void notrace fiq_fsm_reload_hctsiz(struct fiq_state *st, int n) -+{ -+ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; -+ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; -+ hctsiz.b.pktcnt = 1; -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); -+} -+ -+/** -+ * fiq_iso_out_advance() - update DMA address and split position bits -+ * for isochronous OUT transactions. -+ * -+ * Returns 1 if this is the last packet queued, 0 otherwise. Split-ALL and -+ * Split-BEGIN states are not handled - this is done when the transaction was queued. -+ * -+ * This function must only be called from the FIQ_ISO_OUT_ACTIVE state. -+ */ -+static int notrace fiq_iso_out_advance(struct fiq_state *st, int num_channels, int n) -+{ -+ hcsplt_data_t hcsplt; -+ hctsiz_data_t hctsiz; -+ hcdma_data_t hcdma; -+ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; -+ int last = 0; -+ int i = st->channel[n].dma_info.index; -+ -+ fiq_print(FIQDBG_INT, st, "ADV %01d %01d ", n, i); -+ i++; -+ if (i == 4) -+ last = 1; -+ if (st->channel[n].dma_info.slot_len[i+1] == 255) -+ last = 1; -+ -+ /* New DMA address - address of bounce buffer referred to in index */ -+ hcdma.d32 = (uint32_t) &blob->channel[n].index[i].buf[0]; -+ //hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n)); -+ //hcdma.d32 += st->channel[n].dma_info.slot_len[i]; -+ fiq_print(FIQDBG_INT, st, "LAST: %01d ", last); -+ fiq_print(FIQDBG_INT, st, "LEN: %03d", st->channel[n].dma_info.slot_len[i]); -+ hcsplt.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT); -+ hctsiz.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ); -+ hcsplt.b.xactpos = (last) ? ISOC_XACTPOS_END : ISOC_XACTPOS_MID; -+ /* Set up new packet length */ -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.xfersize = st->channel[n].dma_info.slot_len[i]; -+ fiq_print(FIQDBG_INT, st, "%08x", hctsiz.d32); -+ -+ st->channel[n].dma_info.index++; -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); -+ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); -+ return last; -+} -+ -+/** -+ * fiq_fsm_tt_next_isoc() - queue next pending isochronous out start-split on a TT -+ * -+ * Despite the limitations of the DWC core, we can force a microframe pipeline of -+ * isochronous OUT start-split transactions while waiting for a corresponding other-type -+ * of endpoint to finish its CSPLITs. TTs have big periodic buffers therefore it -+ * is very unlikely that filling the start-split FIFO will cause data loss. -+ * This allows much better interleaving of transactions in an order-independent way- -+ * there is no requirement to prioritise isochronous, just a state-space search has -+ * to be performed on each periodic start-split complete interrupt. -+ */ -+static int notrace fiq_fsm_tt_next_isoc(struct fiq_state *st, int num_channels, int n) -+{ -+ int hub_addr = st->channel[n].hub_addr; -+ int port_addr = st->channel[n].port_addr; -+ int i, poked = 0; -+ for (i = 0; i < num_channels; i++) { -+ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) -+ continue; -+ if (st->channel[i].hub_addr == hub_addr && -+ st->channel[i].port_addr == port_addr) { -+ switch (st->channel[i].fsm) { -+ case FIQ_PER_ISO_OUT_PENDING: -+ if (st->channel[i].nrpackets == 1) { -+ st->channel[i].fsm = FIQ_PER_ISO_OUT_LAST; -+ } else { -+ st->channel[i].fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ } -+ fiq_fsm_restart_channel(st, i, 0); -+ poked = 1; -+ break; -+ -+ default: -+ break; -+ } -+ } -+ if (poked) -+ break; -+ } -+ return poked; -+} -+ -+/** -+ * fiq_fsm_tt_in_use() - search for host channels using this TT -+ * @n: Channel to use as reference -+ * -+ */ -+int notrace noinline fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n) -+{ -+ int hub_addr = st->channel[n].hub_addr; -+ int port_addr = st->channel[n].port_addr; -+ int i, in_use = 0; -+ for (i = 0; i < num_channels; i++) { -+ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) -+ continue; -+ switch (st->channel[i].fsm) { -+ /* TT is reserved for channels that are in the middle of a periodic -+ * split transaction. -+ */ -+ case FIQ_PER_SSPLIT_STARTED: -+ case FIQ_PER_CSPLIT_WAIT: -+ case FIQ_PER_CSPLIT_NYET1: -+ //case FIQ_PER_CSPLIT_POLL: -+ case FIQ_PER_ISO_OUT_ACTIVE: -+ case FIQ_PER_ISO_OUT_LAST: -+ if (st->channel[i].hub_addr == hub_addr && -+ st->channel[i].port_addr == port_addr) { -+ in_use = 1; -+ } -+ break; -+ default: -+ break; -+ } -+ if (in_use) -+ break; -+ } -+ return in_use; -+} -+ -+/** -+ * fiq_fsm_more_csplits() - determine whether additional CSPLITs need -+ * to be issued for this IN transaction. -+ * -+ * We cannot tell the inbound PID of a data packet due to hardware limitations. -+ * we need to make an educated guess as to whether we need to queue another CSPLIT -+ * or not. A no-brainer is when we have received enough data to fill the endpoint -+ * size, but for endpoints that give variable-length data then we have to resort -+ * to heuristics. -+ * -+ * We also return whether this is the last CSPLIT to be queued, again based on -+ * heuristics. This is to allow a 1-uframe overlap of periodic split transactions. -+ * Note: requires at least 1 CSPLIT to have been performed prior to being called. -+ */ -+ -+/* -+ * We need some way of guaranteeing if a returned periodic packet of size X -+ * has a DATA0 PID. -+ * The heuristic value of 144 bytes assumes that the received data has maximal -+ * bit-stuffing and the clock frequency of the transmitting device is at the lowest -+ * permissible limit. If the transfer length results in a final packet size -+ * 144 < p <= 188, then an erroneous CSPLIT will be issued. -+ * Also used to ensure that an endpoint will nominally only return a single -+ * complete-split worth of data. -+ */ -+#define DATA0_PID_HEURISTIC 144 -+ -+static int notrace noinline fiq_fsm_more_csplits(struct fiq_state *state, int n, int *probably_last) -+{ -+ -+ int i; -+ int total_len = 0; -+ int more_needed = 1; -+ struct fiq_channel_state *st = &state->channel[n]; -+ -+ for (i = 0; i < st->dma_info.index; i++) { -+ total_len += st->dma_info.slot_len[i]; -+ } -+ -+ *probably_last = 0; -+ -+ if (st->hcchar_copy.b.eptype == 0x3) { -+ /* -+ * An interrupt endpoint will take max 2 CSPLITs. if we are receiving data -+ * then this is definitely the last CSPLIT. -+ */ -+ *probably_last = 1; -+ } else { -+ /* Isoc IN. This is a bit risky if we are the first transaction: -+ * we may have been held off slightly. */ -+ if (i > 1 && st->dma_info.slot_len[st->dma_info.index-1] <= DATA0_PID_HEURISTIC) { -+ more_needed = 0; -+ } -+ /* If in the next uframe we will receive enough data to fill the endpoint, -+ * then only issue 1 more csplit. -+ */ -+ if (st->hctsiz_copy.b.xfersize - total_len <= DATA0_PID_HEURISTIC) -+ *probably_last = 1; -+ } -+ -+ if (total_len >= st->hctsiz_copy.b.xfersize || -+ i == 6 || total_len == 0) -+ /* Note: due to bit stuffing it is possible to have > 6 CSPLITs for -+ * a single endpoint. Accepting more would completely break our scheduling mechanism though -+ * - in these extreme cases we will pass through a truncated packet. -+ */ -+ more_needed = 0; -+ -+ return more_needed; -+} -+ -+/** -+ * fiq_fsm_too_late() - Test transaction for lateness -+ * -+ * If a SSPLIT for a large IN transaction is issued too late in a frame, -+ * the hub will disable the port to the device and respond with ERR handshakes. -+ * The hub status endpoint will not reflect this change. -+ * Returns 1 if we will issue a SSPLIT that will result in a device babble. -+ */ -+int notrace fiq_fsm_too_late(struct fiq_state *st, int n) -+{ -+ int uframe; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; -+ uframe = hfnum.b.frnum & 0x7; -+ if ((uframe < 6) && (st->channel[n].nrpackets + 1 + uframe > 7)) { -+ return 1; -+ } else { -+ return 0; -+ } -+} -+ -+ -+/** -+ * fiq_fsm_start_next_periodic() - A half-arsed attempt at a microframe pipeline -+ * -+ * Search pending transactions in the start-split pending state and queue them. -+ * Don't queue packets in uframe .5 (comes out in .6) (USB2.0 11.18.4). -+ * Note: we specifically don't do isochronous OUT transactions first because better -+ * use of the TT's start-split fifo can be achieved by pipelining an IN before an OUT. -+ */ -+static void notrace noinline fiq_fsm_start_next_periodic(struct fiq_state *st, int num_channels) -+{ -+ int n; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; -+ if ((hfnum.b.frnum & 0x7) == 5) -+ return; -+ for (n = 0; n < num_channels; n++) { -+ if (st->channel[n].fsm == FIQ_PER_SSPLIT_QUEUED) { -+ /* Check to see if any other transactions are using this TT */ -+ if(!fiq_fsm_tt_in_use(st, num_channels, n)) { -+ if (!fiq_fsm_too_late(st, n)) { -+ st->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; -+ fiq_print(FIQDBG_INT, st, "NEXTPER "); -+ fiq_fsm_restart_channel(st, n, 0); -+ } else { -+ st->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; -+ } -+ break; -+ } -+ } -+ } -+ for (n = 0; n < num_channels; n++) { -+ if (st->channel[n].fsm == FIQ_PER_ISO_OUT_PENDING) { -+ if (!fiq_fsm_tt_in_use(st, num_channels, n)) { -+ fiq_print(FIQDBG_INT, st, "NEXTISO "); -+ st->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ fiq_fsm_restart_channel(st, n, 0); -+ break; -+ } -+ } -+ } -+} -+ -+/** -+ * fiq_fsm_update_hs_isoc() - update isochronous frame and transfer data -+ * @state: Pointer to fiq_state -+ * @n: Channel transaction is active on -+ * @hcint: Copy of host channel interrupt register -+ * -+ * Returns 0 if there are no more transactions for this HC to do, 1 -+ * otherwise. -+ */ -+static int notrace noinline fiq_fsm_update_hs_isoc(struct fiq_state *state, int n, hcint_data_t hcint) -+{ -+ struct fiq_channel_state *st = &state->channel[n]; -+ int xfer_len = 0, nrpackets = 0; -+ hcdma_data_t hcdma; -+ fiq_print(FIQDBG_INT, state, "HSISO %02d", n); -+ -+ xfer_len = fiq_get_xfer_len(state, n); -+ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].actual_length = xfer_len; -+ -+ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].status = hcint.d32; -+ -+ st->hs_isoc_info.index++; -+ if (st->hs_isoc_info.index == st->hs_isoc_info.nrframes) { -+ return 0; -+ } -+ -+ /* grab the next DMA address offset from the array */ -+ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].offset; -+ FIQ_WRITE(state->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); -+ -+ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as -+ * the core needs to be told to send the correct number. Caution: for IN transfers, -+ * this is always set to the maximum size of the endpoint. */ -+ xfer_len = st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].length; -+ /* Integer divide in a FIQ: fun. FIXME: make this not suck */ -+ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; -+ if (nrpackets == 0) -+ nrpackets = 1; -+ st->hcchar_copy.b.multicnt = nrpackets; -+ st->hctsiz_copy.b.pktcnt = nrpackets; -+ -+ /* Initial PID also needs to be set */ -+ if (st->hcchar_copy.b.epdir == 0) { -+ st->hctsiz_copy.b.xfersize = xfer_len; -+ switch (st->hcchar_copy.b.multicnt) { -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_MDATA; -+ break; -+ } -+ -+ } else { -+ switch (st->hcchar_copy.b.multicnt) { -+ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA1; -+ break; -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA2; -+ break; -+ } -+ } -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, st->hctsiz_copy.d32); -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, st->hcchar_copy.d32); -+ /* Channel is enabled on hcint handler exit */ -+ fiq_print(FIQDBG_INT, state, "HSISOOUT"); -+ return 1; -+} -+ -+ -+/** -+ * fiq_fsm_do_sof() - FSM start-of-frame interrupt handler -+ * @state: Pointer to the state struct passed from banked FIQ mode registers. -+ * @num_channels: set according to the DWC hardware configuration -+ * -+ * The SOF handler in FSM mode has two functions -+ * 1. Hold off SOF from causing schedule advancement in IRQ context if there's -+ * nothing to do -+ * 2. Advance certain FSM states that require either a microframe delay, or a microframe -+ * of holdoff. -+ * -+ * The second part is architecture-specific to mach-bcm2835 - -+ * a sane interrupt controller would have a mask register for ARM interrupt sources -+ * to be promoted to the nFIQ line, but it doesn't. Instead a single interrupt -+ * number (USB) can be enabled. This means that certain parts of the USB specification -+ * that require "wait a little while, then issue another packet" cannot be fulfilled with -+ * the timing granularity required to achieve optimal throughout. The workaround is to use -+ * the SOF "timer" (125uS) to perform this task. -+ */ -+static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_channels) -+{ -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + HFNUM) }; -+ int n; -+ int kick_irq = 0; -+ -+ if ((hfnum.b.frnum & 0x7) == 1) { -+ /* We cannot issue csplits for transactions in the last frame past (n+1).1 -+ * Check to see if there are any transactions that are stale. -+ * Boot them out. -+ */ -+ for (n = 0; n < num_channels; n++) { -+ switch (state->channel[n].fsm) { -+ case FIQ_PER_CSPLIT_WAIT: -+ case FIQ_PER_CSPLIT_NYET1: -+ case FIQ_PER_CSPLIT_POLL: -+ case FIQ_PER_CSPLIT_LAST: -+ /* Check if we are no longer in the same full-speed frame. */ -+ if (((state->channel[n].expected_uframe & 0x3FFF) & ~0x7) < -+ (hfnum.b.frnum & ~0x7)) -+ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; -+ break; -+ default: -+ break; -+ } -+ } -+ } -+ -+ for (n = 0; n < num_channels; n++) { -+ switch (state->channel[n].fsm) { -+ -+ case FIQ_NP_SSPLIT_RETRY: -+ case FIQ_NP_IN_CSPLIT_RETRY: -+ case FIQ_NP_OUT_CSPLIT_RETRY: -+ fiq_fsm_restart_channel(state, n, 0); -+ break; -+ -+ case FIQ_HS_ISOC_SLEEPING: -+ /* Is it time to wake this channel yet? */ -+ if (--state->channel[n].uframe_sleeps == 0) { -+ state->channel[n].fsm = FIQ_HS_ISOC_TURBO; -+ fiq_fsm_restart_channel(state, n, 0); -+ } -+ break; -+ -+ case FIQ_PER_SSPLIT_QUEUED: -+ if ((hfnum.b.frnum & 0x7) == 5) -+ break; -+ if(!fiq_fsm_tt_in_use(state, num_channels, n)) { -+ if (!fiq_fsm_too_late(state, n)) { -+ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n); -+ fiq_fsm_restart_channel(state, n, 0); -+ state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; -+ } else { -+ /* Transaction cannot be started without risking a device babble error */ -+ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; -+ state->haintmsk_saved.b2.chint &= ~(1 << n); -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); -+ kick_irq |= 1; -+ } -+ } -+ break; -+ -+ case FIQ_PER_ISO_OUT_PENDING: -+ /* Ordinarily, this should be poked after the SSPLIT -+ * complete interrupt for a competing transfer on the same -+ * TT. Doesn't happen for aborted transactions though. -+ */ -+ if ((hfnum.b.frnum & 0x7) >= 5) -+ break; -+ if (!fiq_fsm_tt_in_use(state, num_channels, n)) { -+ /* Hardware bug. SOF can sometimes occur after the channel halt interrupt -+ * that caused this. -+ */ -+ fiq_fsm_restart_channel(state, n, 0); -+ fiq_print(FIQDBG_INT, state, "SOF ISOC"); -+ if (state->channel[n].nrpackets == 1) { -+ state->channel[n].fsm = FIQ_PER_ISO_OUT_LAST; -+ } else { -+ state->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ } -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_WAIT: -+ /* we are guaranteed to be in this state if and only if the SSPLIT interrupt -+ * occurred when the bus transaction occurred. The SOF interrupt reversal bug -+ * will utterly bugger this up though. -+ */ -+ if (hfnum.b.frnum != state->channel[n].expected_uframe) { -+ fiq_print(FIQDBG_INT, state, "SOFCS %d ", n); -+ state->channel[n].fsm = FIQ_PER_CSPLIT_POLL; -+ fiq_fsm_restart_channel(state, n, 0); -+ fiq_fsm_start_next_periodic(state, num_channels); -+ -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_TIMEOUT: -+ case FIQ_DEQUEUE_ISSUED: -+ /* Ugly: we have to force a HCD interrupt. -+ * Poke the mask for the channel in question. -+ * We will take a fake SOF because of this, but -+ * that's OK. -+ */ -+ state->haintmsk_saved.b2.chint &= ~(1 << n); -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); -+ kick_irq |= 1; -+ break; -+ -+ default: -+ break; -+ } -+ } -+ -+ if (state->kick_np_queues || -+ dwc_frame_num_le(state->next_sched_frame, hfnum.b.frnum)) -+ kick_irq |= 1; -+ -+ return !kick_irq; -+} -+ -+ -+/** -+ * fiq_fsm_do_hcintr() - FSM host channel interrupt handler -+ * @state: Pointer to the FIQ state struct -+ * @num_channels: Number of channels as per hardware config -+ * @n: channel for which HAINT(i) was raised -+ * -+ * An important property is that only the CHHLT interrupt is unmasked. Unfortunately, AHBerr is as well. -+ */ -+static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_channels, int n) -+{ -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ hcint_data_t hcint_probe; -+ hcchar_data_t hcchar; -+ int handled = 0; -+ int restart = 0; -+ int last_csplit = 0; -+ int start_next_periodic = 0; -+ struct fiq_channel_state *st = &state->channel[n]; -+ hfnum_data_t hfnum; -+ -+ hcint.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT); -+ hcintmsk.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK); -+ hcint_probe.d32 = hcint.d32 & hcintmsk.d32; -+ -+ if (st->fsm != FIQ_PASSTHROUGH) { -+ fiq_print(FIQDBG_INT, state, "HC%01d ST%02d", n, st->fsm); -+ fiq_print(FIQDBG_INT, state, "%08x", hcint.d32); -+ } -+ -+ switch (st->fsm) { -+ -+ case FIQ_PASSTHROUGH: -+ case FIQ_DEQUEUE_ISSUED: -+ /* doesn't belong to us, kick it upstairs */ -+ break; -+ -+ case FIQ_PASSTHROUGH_ERRORSTATE: -+ /* We are here to emulate the error recovery mechanism of the dwc HCD. -+ * Several interrupts are unmasked if a previous transaction failed - it's -+ * death for the FIQ to attempt to handle them as the channel isn't halted. -+ * Emulate what the HCD does in this situation: mask and continue. -+ * The FSM has no other state setup so this has to be handled out-of-band. -+ */ -+ fiq_print(FIQDBG_ERR, state, "ERRST %02d", n); -+ if (hcint_probe.b.nak || hcint_probe.b.ack || hcint_probe.b.datatglerr) { -+ fiq_print(FIQDBG_ERR, state, "RESET %02d", n); -+ /* In some random cases we can get a NAK interrupt coincident with a Xacterr -+ * interrupt, after the device has disappeared. -+ */ -+ if (!hcint.b.xacterr) -+ st->nr_errors = 0; -+ hcintmsk.b.nak = 0; -+ hcintmsk.b.ack = 0; -+ hcintmsk.b.datatglerr = 0; -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, hcintmsk.d32); -+ return 1; -+ } -+ if (hcint_probe.b.chhltd) { -+ fiq_print(FIQDBG_ERR, state, "CHHLT %02d", n); -+ fiq_print(FIQDBG_ERR, state, "%08x", hcint.d32); -+ return 0; -+ } -+ break; -+ -+ /* Non-periodic state groups */ -+ case FIQ_NP_SSPLIT_STARTED: -+ case FIQ_NP_SSPLIT_RETRY: -+ /* Got a HCINT for a NP SSPLIT. Expected ACK / NAK / fail */ -+ if (hcint.b.ack) { -+ /* SSPLIT complete. For OUT, the data has been sent. For IN, the LS transaction -+ * will start shortly. SOF needs to kick the transaction to prevent a NYET flood. -+ */ -+ if(st->hcchar_copy.b.epdir == 1) -+ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; -+ else -+ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; -+ st->nr_errors = 0; -+ handled = 1; -+ fiq_fsm_setup_csplit(state, n); -+ } else if (hcint.b.nak) { -+ // No buffer space in TT. Retry on a uframe boundary. -+ st->fsm = FIQ_NP_SSPLIT_RETRY; -+ handled = 1; -+ } else if (hcint.b.xacterr) { -+ // The only other one we care about is xacterr. This implies HS bus error - retry. -+ st->nr_errors++; -+ st->fsm = FIQ_NP_SSPLIT_RETRY; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ restart = 1; -+ } -+ } else { -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ handled = 0; -+ restart = 0; -+ } -+ break; -+ -+ case FIQ_NP_IN_CSPLIT_RETRY: -+ /* Received a CSPLIT done interrupt. -+ * Expected Data/NAK/STALL/NYET for IN. -+ */ -+ if (hcint.b.xfercomp) { -+ /* For IN, data is present. */ -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nak) { -+ /* no endpoint data. Punt it upstairs */ -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nyet) { -+ /* CSPLIT NYET - retry on a uframe boundary. */ -+ handled = 1; -+ st->nr_errors = 0; -+ } else if (hcint.b.datatglerr) { -+ /* data toggle errors do not set the xfercomp bit. */ -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ } else if (hcint.b.xacterr) { -+ /* HS error. Retry immediate */ -+ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ restart = 1; -+ } -+ } else if (hcint.b.stall || hcint.b.bblerr) { -+ /* A STALL implies either a LS bus error or a genuine STALL. */ -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ } else { -+ /* Hardware bug. It's possible in some cases to -+ * get a channel halt with nothing else set when -+ * the response was a NYET. Treat as local 3-strikes retry. -+ */ -+ hcint_data_t hcint_test = hcint; -+ hcint_test.b.chhltd = 0; -+ if (!hcint_test.d32) { -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ } -+ } else { -+ /* Bail out if something unexpected happened */ -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } -+ } -+ break; -+ -+ case FIQ_NP_OUT_CSPLIT_RETRY: -+ /* Received a CSPLIT done interrupt. -+ * Expected ACK/NAK/STALL/NYET/XFERCOMP for OUT.*/ -+ if (hcint.b.xfercomp) { -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nak) { -+ // The HCD will implement the holdoff on frame boundaries. -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nyet) { -+ // Hub still processing. -+ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; -+ handled = 1; -+ st->nr_errors = 0; -+ //restart = 1; -+ } else if (hcint.b.xacterr) { -+ /* HS error. retry immediate */ -+ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ restart = 1; -+ } -+ } else if (hcint.b.stall) { -+ /* LS bus error or genuine stall */ -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ } else { -+ /* -+ * Hardware bug. It's possible in some cases to get a -+ * channel halt with nothing else set when the response was a NYET. -+ * Treat as local 3-strikes retry. -+ */ -+ hcint_data_t hcint_test = hcint; -+ hcint_test.b.chhltd = 0; -+ if (!hcint_test.d32) { -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ } -+ } else { -+ // Something unexpected happened. AHBerror or babble perhaps. Let the IRQ deal with it. -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } -+ } -+ break; -+ -+ /* Periodic split states (except isoc out) */ -+ case FIQ_PER_SSPLIT_STARTED: -+ /* Expect an ACK or failure for SSPLIT */ -+ if (hcint.b.ack) { -+ /* -+ * SSPLIT transfer complete interrupt - the generation of this interrupt is fraught with bugs. -+ * For a packet queued in microframe n-3 to appear in n-2, if the channel is enabled near the EOF1 -+ * point for microframe n-3, the packet will not appear on the bus until microframe n. -+ * Additionally, the generation of the actual interrupt is dodgy. For a packet appearing on the bus -+ * in microframe n, sometimes the interrupt is generated immediately. Sometimes, it appears in n+1 -+ * coincident with SOF for n+1. -+ * SOF is also buggy. It can sometimes be raised AFTER the first bus transaction has taken place. -+ * These appear to be caused by timing/clock crossing bugs within the core itself. -+ * State machine workaround. -+ */ -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ fiq_fsm_setup_csplit(state, n); -+ /* Poke the oddfrm bit. If we are equivalent, we received the interrupt at the correct -+ * time. If not, then we're in the next SOF. -+ */ -+ if ((hfnum.b.frnum & 0x1) == hcchar.b.oddfrm) { -+ fiq_print(FIQDBG_INT, state, "CSWAIT %01d", n); -+ st->expected_uframe = hfnum.b.frnum; -+ st->fsm = FIQ_PER_CSPLIT_WAIT; -+ } else { -+ fiq_print(FIQDBG_INT, state, "CSPOL %01d", n); -+ /* For isochronous IN endpoints, -+ * we need to hold off if we are expecting a lot of data */ -+ if (st->hcchar_copy.b.mps < DATA0_PID_HEURISTIC) { -+ start_next_periodic = 1; -+ } -+ /* Danger will robinson: we are in a broken state. If our first interrupt after -+ * this is a NYET, it will be delayed by 1 uframe and result in an unrecoverable -+ * lag. Unmask the NYET interrupt. -+ */ -+ st->expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; -+ st->fsm = FIQ_PER_CSPLIT_BROKEN_NYET1; -+ restart = 1; -+ } -+ handled = 1; -+ } else if (hcint.b.xacterr) { -+ /* 3-strikes retry is enabled, we have hit our max nr_errors */ -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ start_next_periodic = 1; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ start_next_periodic = 1; -+ } -+ /* We can now queue the next isochronous OUT transaction, if one is pending. */ -+ if(fiq_fsm_tt_next_isoc(state, num_channels, n)) { -+ fiq_print(FIQDBG_INT, state, "NEXTISO "); -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_NYET1: -+ /* First CSPLIT attempt was a NYET. If we get a subsequent NYET, -+ * we are too late and the TT has dropped its CSPLIT fifo. -+ */ -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ start_next_periodic = 1; -+ if (hcint.b.nak) { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } else if (hcint.b.xfercomp) { -+ fiq_increment_dma_buf(state, num_channels, n); -+ st->fsm = FIQ_PER_CSPLIT_POLL; -+ st->nr_errors = 0; -+ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { -+ handled = 1; -+ restart = 1; -+ if (!last_csplit) -+ start_next_periodic = 0; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } else if (hcint.b.nyet) { -+ /* Doh. Data lost. */ -+ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; -+ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { -+ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_BROKEN_NYET1: -+ /* -+ * we got here because our host channel is in the delayed-interrupt -+ * state and we cannot take a NYET interrupt any later than when it -+ * occurred. Disable then re-enable the channel if this happens to force -+ * CSPLITs to occur at the right time. -+ */ -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ fiq_print(FIQDBG_INT, state, "BROK: %01d ", n); -+ if (hcint.b.nak) { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ start_next_periodic = 1; -+ } else if (hcint.b.xfercomp) { -+ fiq_increment_dma_buf(state, num_channels, n); -+ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { -+ st->fsm = FIQ_PER_CSPLIT_POLL; -+ handled = 1; -+ restart = 1; -+ start_next_periodic = 1; -+ /* Reload HCTSIZ for the next transfer */ -+ fiq_fsm_reload_hctsiz(state, n); -+ if (!last_csplit) -+ start_next_periodic = 0; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } else if (hcint.b.nyet) { -+ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; -+ start_next_periodic = 1; -+ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { -+ /* Local 3-strikes retry is handled by the core. This is a ERR response.*/ -+ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_POLL: -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ start_next_periodic = 1; -+ if (hcint.b.nak) { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } else if (hcint.b.xfercomp) { -+ fiq_increment_dma_buf(state, num_channels, n); -+ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { -+ handled = 1; -+ restart = 1; -+ /* Reload HCTSIZ for the next transfer */ -+ fiq_fsm_reload_hctsiz(state, n); -+ if (!last_csplit) -+ start_next_periodic = 0; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } else if (hcint.b.nyet) { -+ /* Are we a NYET after the first data packet? */ -+ if (st->nrpackets == 0) { -+ st->fsm = FIQ_PER_CSPLIT_NYET1; -+ handled = 1; -+ restart = 1; -+ } else { -+ /* We got a NYET when polling CSPLITs. Can happen -+ * if our heuristic fails, or if someone disables us -+ * for any significant length of time. -+ */ -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } -+ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { -+ /* For xacterr, Local 3-strikes retry is handled by the core. This is a ERR response.*/ -+ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ } -+ break; -+ -+ case FIQ_HS_ISOC_TURBO: -+ if (fiq_fsm_update_hs_isoc(state, n, hcint)) { -+ /* more transactions to come */ -+ handled = 1; -+ fiq_print(FIQDBG_INT, state, "HSISO M "); -+ /* For strided transfers, put ourselves to sleep */ -+ if (st->hs_isoc_info.stride > 1) { -+ st->uframe_sleeps = st->hs_isoc_info.stride - 1; -+ st->fsm = FIQ_HS_ISOC_SLEEPING; -+ } else { -+ restart = 1; -+ } -+ } else { -+ st->fsm = FIQ_HS_ISOC_DONE; -+ fiq_print(FIQDBG_INT, state, "HSISO F "); -+ } -+ break; -+ -+ case FIQ_HS_ISOC_ABORTED: -+ /* This abort is called by the driver rewriting the state mid-transaction -+ * which allows the dequeue mechanism to work more effectively. -+ */ -+ break; -+ -+ case FIQ_PER_ISO_OUT_ACTIVE: -+ if (hcint.b.ack) { -+ if(fiq_iso_out_advance(state, num_channels, n)) { -+ /* last OUT transfer */ -+ st->fsm = FIQ_PER_ISO_OUT_LAST; -+ /* -+ * Assuming the periodic FIFO in the dwc core -+ * actually does its job properly, we can queue -+ * the next ssplit now and in theory, the wire -+ * transactions will be in-order. -+ */ -+ // No it doesn't. It appears to process requests in host channel order. -+ //start_next_periodic = 1; -+ } -+ handled = 1; -+ restart = 1; -+ } else { -+ /* -+ * Isochronous transactions carry on regardless. Log the error -+ * and continue. -+ */ -+ //explode += 1; -+ st->nr_errors++; -+ if(fiq_iso_out_advance(state, num_channels, n)) { -+ st->fsm = FIQ_PER_ISO_OUT_LAST; -+ //start_next_periodic = 1; -+ } -+ handled = 1; -+ restart = 1; -+ } -+ break; -+ -+ case FIQ_PER_ISO_OUT_LAST: -+ if (hcint.b.ack) { -+ /* All done here */ -+ st->fsm = FIQ_PER_ISO_OUT_DONE; -+ } else { -+ st->fsm = FIQ_PER_ISO_OUT_DONE; -+ st->nr_errors++; -+ } -+ start_next_periodic = 1; -+ break; -+ -+ case FIQ_PER_SPLIT_TIMEOUT: -+ /* SOF kicked us because we overran. */ -+ start_next_periodic = 1; -+ break; -+ -+ default: -+ break; -+ } -+ -+ if (handled) { -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT, hcint.d32); -+ } else { -+ /* Copy the regs into the state so the IRQ knows what to do */ -+ st->hcint_copy.d32 = hcint.d32; -+ } -+ -+ if (restart) { -+ /* Restart always implies handled. */ -+ if (restart == 2) { -+ /* For complete-split INs, the show must go on. -+ * Force a channel restart */ -+ fiq_fsm_restart_channel(state, n, 1); -+ } else { -+ fiq_fsm_restart_channel(state, n, 0); -+ } -+ } -+ if (start_next_periodic) { -+ fiq_fsm_start_next_periodic(state, num_channels); -+ } -+ if (st->fsm != FIQ_PASSTHROUGH) -+ fiq_print(FIQDBG_INT, state, "FSMOUT%02d", st->fsm); -+ -+ return handled; -+} -+ -+ -+/** -+ * dwc_otg_fiq_fsm() - Flying State Machine (monster) FIQ -+ * @state: pointer to state struct passed from the banked FIQ mode registers. -+ * @num_channels: set according to the DWC hardware configuration -+ * @dma: pointer to DMA bounce buffers for split transaction slots -+ * -+ * The FSM FIQ performs the low-level tasks that normally would be performed by the microcode -+ * inside an EHCI or similar host controller regarding split transactions. The DWC core -+ * interrupts each and every time a split transaction packet is received or sent successfully. -+ * This results in either an interrupt storm when everything is working "properly", or -+ * the interrupt latency of the system in general breaks time-sensitive periodic split -+ * transactions. Pushing the low-level, but relatively easy state machine work into the FIQ -+ * solves these problems. -+ * -+ * Return: void -+ */ -+void notrace dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels) -+{ -+ gintsts_data_t gintsts, gintsts_handled; -+ gintmsk_data_t gintmsk; -+ //hfnum_data_t hfnum; -+ haint_data_t haint, haint_handled; -+ haintmsk_data_t haintmsk; -+ int kick_irq = 0; -+ -+ gintsts_handled.d32 = 0; -+ haint_handled.d32 = 0; -+ -+ fiq_fsm_spin_lock(&state->lock); -+ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); -+ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); -+ gintsts.d32 &= gintmsk.d32; -+ -+ if (gintsts.b.sofintr) { -+ /* For FSM mode, SOF is required to keep the state machine advance for -+ * certain stages of the periodic pipeline. It's death to mask this -+ * interrupt in that case. -+ */ -+ -+ if (!fiq_fsm_do_sof(state, num_channels)) { -+ /* Kick IRQ once. Queue advancement means that all pending transactions -+ * will get serviced when the IRQ finally executes. -+ */ -+ if (state->gintmsk_saved.b.sofintr == 1) -+ kick_irq |= 1; -+ state->gintmsk_saved.b.sofintr = 0; -+ } -+ gintsts_handled.b.sofintr = 1; -+ } -+ -+ if (gintsts.b.hcintr) { -+ int i; -+ haint.d32 = FIQ_READ(state->dwc_regs_base + HAINT); -+ haintmsk.d32 = FIQ_READ(state->dwc_regs_base + HAINTMSK); -+ haint.d32 &= haintmsk.d32; -+ haint_handled.d32 = 0; -+ for (i=0; ihaintmsk_saved.b2.chint &= ~(1 << i); -+ } else { -+ /* do_hcintr cleaned up after itself, but clear haint */ -+ haint_handled.b2.chint |= (1 << i); -+ } -+ } -+ } -+ -+ if (haint_handled.b2.chint) { -+ FIQ_WRITE(state->dwc_regs_base + HAINT, haint_handled.d32); -+ } -+ -+ if (haintmsk.d32 != (haintmsk.d32 & state->haintmsk_saved.d32)) { -+ /* -+ * This is necessary to avoid multiple retriggers of the MPHI in the case -+ * where interrupts are held off and HCINTs start to pile up. -+ * Only wake up the IRQ if a new interrupt came in, was not handled and was -+ * masked. -+ */ -+ haintmsk.d32 &= state->haintmsk_saved.d32; -+ FIQ_WRITE(state->dwc_regs_base + HAINTMSK, haintmsk.d32); -+ kick_irq |= 1; -+ } -+ /* Top-Level interrupt - always handled because it's level-sensitive */ -+ gintsts_handled.b.hcintr = 1; -+ } -+ -+ -+ /* Clear the bits in the saved register that were not handled but were triggered. */ -+ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); -+ -+ /* FIQ didn't handle something - mask has changed - write new mask */ -+ if (gintmsk.d32 != (gintmsk.d32 & state->gintmsk_saved.d32)) { -+ gintmsk.d32 &= state->gintmsk_saved.d32; -+ gintmsk.b.sofintr = 1; -+ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); -+// fiq_print(FIQDBG_INT, state, "KICKGINT"); -+// fiq_print(FIQDBG_INT, state, "%08x", gintmsk.d32); -+// fiq_print(FIQDBG_INT, state, "%08x", state->gintmsk_saved.d32); -+ kick_irq |= 1; -+ } -+ -+ if (gintsts_handled.d32) { -+ /* Only applies to edge-sensitive bits in GINTSTS */ -+ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); -+ } -+ -+ /* We got an interrupt, didn't handle it. */ -+ if (kick_irq) { -+ state->mphi_int_count++; -+ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); -+ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); -+ -+ } -+ state->fiq_done++; -+ mb(); -+ fiq_fsm_spin_unlock(&state->lock); -+} -+ -+ -+/** -+ * dwc_otg_fiq_nop() - FIQ "lite" -+ * @state: pointer to state struct passed from the banked FIQ mode registers. -+ * -+ * The "nop" handler does not intervene on any interrupts other than SOF. -+ * It is limited in scope to deciding at each SOF if the IRQ SOF handler (which deals -+ * with non-periodic/periodic queues) needs to be kicked. -+ * -+ * This is done to hold off the SOF interrupt, which occurs at a rate of 8000 per second. -+ * -+ * Return: void -+ */ -+void notrace dwc_otg_fiq_nop(struct fiq_state *state) -+{ -+ gintsts_data_t gintsts, gintsts_handled; -+ gintmsk_data_t gintmsk; -+ hfnum_data_t hfnum; -+ -+ fiq_fsm_spin_lock(&state->lock); -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); -+ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); -+ gintsts.d32 &= gintmsk.d32; -+ gintsts_handled.d32 = 0; -+ -+ if (gintsts.b.sofintr) { -+ if (!state->kick_np_queues && -+ dwc_frame_num_gt(state->next_sched_frame, hfnum.b.frnum)) { -+ /* SOF handled, no work to do, just ACK interrupt */ -+ gintsts_handled.b.sofintr = 1; -+ } else { -+ /* Kick IRQ */ -+ state->gintmsk_saved.b.sofintr = 0; -+ } -+ } -+ -+ /* Reset handled interrupts */ -+ if(gintsts_handled.d32) { -+ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); -+ } -+ -+ /* Clear the bits in the saved register that were not handled but were triggered. */ -+ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); -+ -+ /* We got an interrupt, didn't handle it and want to mask it */ -+ if (~(state->gintmsk_saved.d32)) { -+ state->mphi_int_count++; -+ gintmsk.d32 &= state->gintmsk_saved.d32; -+ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); -+ /* Force a clear before another dummy send */ -+ FIQ_WRITE(state->mphi_regs.intstat, (1<<29)); -+ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); -+ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); -+ -+ } -+ state->fiq_done++; -+ mb(); -+ fiq_fsm_spin_unlock(&state->lock); -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f9fddfbcffb37f32c808fd78f222b676378398b1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -@@ -0,0 +1,370 @@ -+/* -+ * dwc_otg_fiq_fsm.h - Finite state machine FIQ header definitions -+ * -+ * Copyright (c) 2013 Raspberry Pi Foundation -+ * -+ * Author: Jonathan Bell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of Raspberry Pi nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * This FIQ implements functionality that performs split transactions on -+ * the dwc_otg hardware without any outside intervention. A split transaction -+ * is "queued" by nominating a specific host channel to perform the entirety -+ * of a split transaction. This FIQ will then perform the microframe-precise -+ * scheduling required in each phase of the transaction until completion. -+ * -+ * The FIQ functionality has been surgically implanted into the Synopsys -+ * vendor-provided driver. -+ * -+ */ -+ -+#ifndef DWC_OTG_FIQ_FSM_H_ -+#define DWC_OTG_FIQ_FSM_H_ -+ -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_hcd.h" -+#include -+#include -+#include -+#include -+ -+#if 0 -+#define FLAME_ON(x) \ -+do { \ -+ int gpioreg; \ -+ \ -+ gpioreg = readl(__io_address(0x20200000+0x8)); \ -+ gpioreg &= ~(7 << (x-20)*3); \ -+ gpioreg |= 0x1 << (x-20)*3; \ -+ writel(gpioreg, __io_address(0x20200000+0x8)); \ -+ \ -+ writel(1< 1, SOF wakes up the isochronous FSM */ -+ FIQ_HS_ISOC_SLEEPING = 24, -+ FIQ_HS_ISOC_DONE = 25, -+ FIQ_HS_ISOC_ABORTED = 26, -+ FIQ_DEQUEUE_ISSUED = 30, -+ FIQ_TEST = 32, -+}; -+ -+struct fiq_stack { -+ int magic1; -+ uint8_t stack[2048]; -+ int magic2; -+}; -+ -+ -+/** -+ * struct fiq_dma_info - DMA bounce buffer utilisation information (per-channel) -+ * @index: Number of slots reported used for IN transactions / number of slots -+ * transmitted for an OUT transaction -+ * @slot_len[6]: Number of actual transfer bytes in each slot (255 if unused) -+ * -+ * Split transaction transfers can have variable length depending on other bus -+ * traffic. The OTG core DMA engine requires 4-byte aligned addresses therefore -+ * each transaction needs a guaranteed aligned address. A maximum of 6 split transfers -+ * can happen per-frame. -+ */ -+struct fiq_dma_info { -+ u8 index; -+ u8 slot_len[6]; -+}; -+ -+struct __attribute__((packed)) fiq_split_dma_slot { -+ u8 buf[188]; -+}; -+ -+struct fiq_dma_channel { -+ struct __attribute__((packed)) fiq_split_dma_slot index[6]; -+}; -+ -+struct fiq_dma_blob { -+ struct __attribute__((packed)) fiq_dma_channel channel[0]; -+}; -+ -+/** -+ * struct fiq_hs_isoc_info - USB2.0 isochronous data -+ * @iso_frame: Pointer to the array of OTG URB iso_frame_descs. -+ * @nrframes: Total length of iso_frame_desc array -+ * @index: Current index (FIQ-maintained) -+ * @stride: Interval in uframes between HS isoc transactions -+ */ -+struct fiq_hs_isoc_info { -+ struct dwc_otg_hcd_iso_packet_desc *iso_desc; -+ unsigned int nrframes; -+ unsigned int index; -+ unsigned int stride; -+}; -+ -+/** -+ * struct fiq_channel_state - FIQ state machine storage -+ * @fsm: Current state of the channel as understood by the FIQ -+ * @nr_errors: Number of transaction errors on this split-transaction -+ * @hub_addr: SSPLIT/CSPLIT destination hub -+ * @port_addr: SSPLIT/CSPLIT destination port - always 1 if single TT hub -+ * @nrpackets: For isoc OUT, the number of split-OUT packets to transmit. For -+ * split-IN, number of CSPLIT data packets that were received. -+ * @hcchar_copy: -+ * @hcsplt_copy: -+ * @hcintmsk_copy: -+ * @hctsiz_copy: Copies of the host channel registers. -+ * For use as scratch, or for returning state. -+ * -+ * The fiq_channel_state is state storage between interrupts for a host channel. The -+ * FSM state is stored here. Members of this structure must only be set up by the -+ * driver prior to enabling the FIQ for this host channel, and not touched until the FIQ -+ * has updated the state to either a COMPLETE state group or ABORT state group. -+ */ -+ -+struct fiq_channel_state { -+ enum fiq_fsm_state fsm; -+ unsigned int nr_errors; -+ unsigned int hub_addr; -+ unsigned int port_addr; -+ /* Hardware bug workaround: sometimes channel halt interrupts are -+ * delayed until the next SOF. Keep track of when we expected to get interrupted. */ -+ unsigned int expected_uframe; -+ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */ -+ unsigned int uframe_sleeps; -+ /* in/out for communicating number of dma buffers used, or number of ISOC to do */ -+ unsigned int nrpackets; -+ struct fiq_dma_info dma_info; -+ struct fiq_hs_isoc_info hs_isoc_info; -+ /* Copies of HC registers - in/out communication from/to IRQ handler -+ * and for ease of channel setup. A bit of mungeing is performed - for -+ * example the hctsiz.b.maxp is _always_ the max packet size of the endpoint. -+ */ -+ hcchar_data_t hcchar_copy; -+ hcsplt_data_t hcsplt_copy; -+ hcint_data_t hcint_copy; -+ hcintmsk_data_t hcintmsk_copy; -+ hctsiz_data_t hctsiz_copy; -+ hcdma_data_t hcdma_copy; -+}; -+ -+/** -+ * struct fiq_state - top-level FIQ state machine storage -+ * @mphi_regs: virtual address of the MPHI peripheral register file -+ * @dwc_regs_base: virtual address of the base of the DWC core register file -+ * @dma_base: physical address for the base of the DMA bounce buffers -+ * @dummy_send: Scratch area for sending a fake message to the MPHI peripheral -+ * @gintmsk_saved: Top-level mask of interrupts that the FIQ has not handled. -+ * Used for determining which interrupts fired to set off the IRQ handler. -+ * @haintmsk_saved: Mask of interrupts from host channels that the FIQ did not handle internally. -+ * @np_count: Non-periodic transactions in the active queue -+ * @np_sent: Count of non-periodic transactions that have completed -+ * @next_sched_frame: For periodic transactions handled by the driver's SOF-driven queuing mechanism, -+ * this is the next frame on which a SOF interrupt is required. Used to hold off -+ * passing SOF through to the driver until necessary. -+ * @channel[n]: Per-channel FIQ state. Allocated during init depending on the number of host -+ * channels configured into the core logic. -+ * -+ * This is passed as the first argument to the dwc_otg_fiq_fsm top-level FIQ handler from the asm stub. -+ * It contains top-level state information. -+ */ -+struct fiq_state { -+ fiq_lock_t lock; -+ mphi_regs_t mphi_regs; -+ void *dwc_regs_base; -+ dma_addr_t dma_base; -+ struct fiq_dma_blob *fiq_dmab; -+ void *dummy_send; -+ gintmsk_data_t gintmsk_saved; -+ haintmsk_data_t haintmsk_saved; -+ int mphi_int_count; -+ unsigned int fiq_done; -+ unsigned int kick_np_queues; -+ unsigned int next_sched_frame; -+#ifdef FIQ_DEBUG -+ char * buffer; -+ unsigned int bufsiz; -+#endif -+ struct fiq_channel_state channel[0]; -+}; -+ -+extern void fiq_fsm_spin_lock(fiq_lock_t *lock); -+ -+extern void fiq_fsm_spin_unlock(fiq_lock_t *lock); -+ -+extern int fiq_fsm_too_late(struct fiq_state *st, int n); -+ -+extern int fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n); -+ -+extern void dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels); -+ -+extern void dwc_otg_fiq_nop(struct fiq_state *state); -+ -+#endif /* DWC_OTG_FIQ_FSM_H_ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S -new file mode 100644 -index 0000000000000000000000000000000000000000..ffa8d21bc61e893fee86ba04955587e7661d3ff2 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S -@@ -0,0 +1,80 @@ -+/* -+ * dwc_otg_fiq_fsm.S - assembly stub for the FSM FIQ -+ * -+ * Copyright (c) 2013 Raspberry Pi Foundation -+ * -+ * Author: Jonathan Bell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of Raspberry Pi nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+ -+#include -+#include -+ -+ -+.text -+ -+.global _dwc_otg_fiq_stub_end; -+ -+/** -+ * _dwc_otg_fiq_stub() - entry copied to the FIQ vector page to allow -+ * a C-style function call with arguments from the FIQ banked registers. -+ * r0 = &hcd->fiq_state -+ * r1 = &hcd->num_channels -+ * r2 = &hcd->dma_buffers -+ * Tramples: r0, r1, r2, r4, fp, ip -+ */ -+ -+ENTRY(_dwc_otg_fiq_stub) -+ /* Stash unbanked regs - SP will have been set up for us */ -+ mov ip, sp; -+ stmdb sp!, {r0-r12, lr}; -+#ifdef FIQ_DEBUG -+ // Cycle profiling - read cycle counter at start -+ mrc p15, 0, r5, c15, c12, 1; -+#endif -+ /* r11 = fp, don't trample it */ -+ mov r4, fp; -+ /* set EABI frame size */ -+ sub fp, ip, #512; -+ -+ /* for fiq NOP mode - just need state */ -+ mov r0, r8; -+ /* r9 = num_channels */ -+ mov r1, r9; -+ /* r10 = struct *dma_bufs */ -+// mov r2, r10; -+ -+ /* r4 = &fiq_c_function */ -+ blx r4; -+#ifdef FIQ_DEBUG -+ mrc p15, 0, r4, c15, c12, 1; -+ subs r5, r5, r4; -+ // r5 is now the cycle count time for executing the FIQ. Store it somewhere? -+#endif -+ ldmia sp!, {r0-r12, lr}; -+ subs pc, lr, #4; -+_dwc_otg_fiq_stub_end: -+END(_dwc_otg_fiq_stub) -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..027414bb2bf9fc3f3652407724187f3c6dc5ff68 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -0,0 +1,4260 @@ -+ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ -+ * $Revision: #104 $ -+ * $Date: 2011/10/24 $ -+ * $Change: 1871159 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** @file -+ * This file implements HCD Core. All code in this file is portable and doesn't -+ * use any OS specific functions. -+ * Interface provided by HCD Core is defined in -+ * header file. -+ */ -+ -+#include -+#include -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_fiq_fsm.h" -+ -+extern bool microframe_schedule; -+extern uint16_t fiq_fsm_mask, nak_holdoff; -+ -+//#define DEBUG_HOST_CHANNELS -+#ifdef DEBUG_HOST_CHANNELS -+static int last_sel_trans_num_per_scheduled = 0; -+static int last_sel_trans_num_nonper_scheduled = 0; -+static int last_sel_trans_num_avail_hc_at_start = 0; -+static int last_sel_trans_num_avail_hc_at_end = 0; -+#endif /* DEBUG_HOST_CHANNELS */ -+ -+ -+dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void) -+{ -+ return DWC_ALLOC(sizeof(dwc_otg_hcd_t)); -+} -+ -+/** -+ * Connection timeout function. An OTG host is required to display a -+ * message if the device does not connect within 10 seconds. -+ */ -+void dwc_otg_hcd_connect_timeout(void *ptr) -+{ -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, ptr); -+ DWC_PRINTF("Connect Timeout\n"); -+ __DWC_ERROR("Device Not Connected/Responding\n"); -+} -+ -+#if defined(DEBUG) -+static void dump_channel_info(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ if (qh->channel != NULL) { -+ dwc_hc_t *hc = qh->channel; -+ dwc_list_link_t *item; -+ dwc_otg_qh_t *qh_item; -+ int num_channels = hcd->core_if->core_params->host_channels; -+ int i; -+ -+ dwc_otg_hc_regs_t *hc_regs; -+ hcchar_data_t hcchar; -+ hcsplt_data_t hcsplt; -+ hctsiz_data_t hctsiz; -+ uint32_t hcdma; -+ -+ hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ hcdma = DWC_READ_REG32(&hc_regs->hcdma); -+ -+ DWC_PRINTF(" Assigned to channel %p:\n", hc); -+ DWC_PRINTF(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, -+ hcsplt.d32); -+ DWC_PRINTF(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, -+ hcdma); -+ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", -+ hc->dev_addr, hc->ep_num, hc->ep_is_in); -+ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); -+ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); -+ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); -+ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); -+ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); -+ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); -+ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); -+ DWC_PRINTF(" qh: %p\n", hc->qh); -+ DWC_PRINTF(" NP inactive sched:\n"); -+ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_inactive) { -+ qh_item = -+ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); -+ DWC_PRINTF(" %p\n", qh_item); -+ } -+ DWC_PRINTF(" NP active sched:\n"); -+ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_active) { -+ qh_item = -+ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); -+ DWC_PRINTF(" %p\n", qh_item); -+ } -+ DWC_PRINTF(" Channels: \n"); -+ for (i = 0; i < num_channels; i++) { -+ dwc_hc_t *hc = hcd->hc_ptr_array[i]; -+ DWC_PRINTF(" %2d: %p\n", i, hc); -+ } -+ } -+} -+#else -+#define dump_channel_info(hcd, qh) -+#endif /* DEBUG */ -+ -+/** -+ * Work queue function for starting the HCD when A-Cable is connected. -+ * The hcd_start() must be called in a process context. -+ */ -+static void hcd_start_func(void *_vp) -+{ -+ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) _vp; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s() %p\n", __func__, hcd); -+ if (hcd) { -+ hcd->fops->start(hcd); -+ } -+} -+ -+static void del_xfer_timers(dwc_otg_hcd_t * hcd) -+{ -+#ifdef DEBUG -+ int i; -+ int num_channels = hcd->core_if->core_params->host_channels; -+ for (i = 0; i < num_channels; i++) { -+ DWC_TIMER_CANCEL(hcd->core_if->hc_xfer_timer[i]); -+ } -+#endif -+} -+ -+static void del_timers(dwc_otg_hcd_t * hcd) -+{ -+ del_xfer_timers(hcd); -+ DWC_TIMER_CANCEL(hcd->conn_timer); -+} -+ -+/** -+ * Processes all the URBs in a single list of QHs. Completes them with -+ * -ESHUTDOWN and frees the QTD. -+ */ -+static void kill_urbs_in_qh_list(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) -+{ -+ dwc_list_link_t *qh_item, *qh_tmp; -+ dwc_otg_qh_t *qh; -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ -+ DWC_LIST_FOREACH_SAFE(qh_item, qh_tmp, qh_list) { -+ qh = DWC_LIST_ENTRY(qh_item, dwc_otg_qh_t, qh_list_entry); -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, -+ &qh->qtd_list, qtd_list_entry) { -+ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ if (qtd->urb != NULL) { -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_SHUTDOWN); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ } -+ -+ } -+ if(qh->channel) { -+ /* Using hcchar.chen == 1 is not a reliable test. -+ * It is possible that the channel has already halted -+ * but not yet been through the IRQ handler. -+ */ -+ dwc_otg_hc_halt(hcd->core_if, qh->channel, -+ DWC_OTG_HC_XFER_URB_DEQUEUE); -+ if(microframe_schedule) -+ hcd->available_host_channels++; -+ qh->channel = NULL; -+ } -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } -+} -+ -+/** -+ * Responds with an error status of ESHUTDOWN to all URBs in the non-periodic -+ * and periodic schedules. The QTD associated with each URB is removed from -+ * the schedule and freed. This function may be called when a disconnect is -+ * detected or when the HCD is being stopped. -+ */ -+static void kill_all_urbs(dwc_otg_hcd_t * hcd) -+{ -+ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_inactive); -+ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_active); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_inactive); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_ready); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_assigned); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_queued); -+} -+ -+/** -+ * Start the connection timer. An OTG host is required to display a -+ * message if the device does not connect within 10 seconds. The -+ * timer is deleted if a port connect interrupt occurs before the -+ * timer expires. -+ */ -+static void dwc_otg_hcd_start_connect_timer(dwc_otg_hcd_t * hcd) -+{ -+ DWC_TIMER_SCHEDULE(hcd->conn_timer, 10000 /* 10 secs */ ); -+} -+ -+/** -+ * HCD Callback function for disconnect of the HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_session_start_cb(void *p) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd; -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); -+ dwc_otg_hcd = p; -+ dwc_otg_hcd_start_connect_timer(dwc_otg_hcd); -+ return 1; -+} -+ -+/** -+ * HCD Callback function for starting the HCD when A-Cable is -+ * connected. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_start_cb(void *p) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = p; -+ dwc_otg_core_if_t *core_if; -+ hprt0_data_t hprt0; -+ -+ core_if = dwc_otg_hcd->core_if; -+ -+ if (core_if->op_state == B_HOST) { -+ /* -+ * Reset the port. During a HNP mode switch the reset -+ * needs to occur within 1ms and have a duration of at -+ * least 50ms. -+ */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtrst = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ DWC_WORKQ_SCHEDULE_DELAYED(core_if->wq_otg, -+ hcd_start_func, dwc_otg_hcd, 50, -+ "start hcd"); -+ -+ return 1; -+} -+ -+/** -+ * HCD Callback function for disconnect of the HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_disconnect_cb(void *p) -+{ -+ gintsts_data_t intr; -+ dwc_otg_hcd_t *dwc_otg_hcd = p; -+ -+ /* -+ * Set status flags for the hub driver. -+ */ -+ dwc_otg_hcd->flags.b.port_connect_status_change = 1; -+ dwc_otg_hcd->flags.b.port_connect_status = 0; -+ if(fiq_enable) -+ local_fiq_disable(); -+ /* -+ * Shutdown any transfers in process by clearing the Tx FIFO Empty -+ * interrupt mask and status bits and disabling subsequent host -+ * channel interrupts. -+ */ -+ intr.d32 = 0; -+ intr.b.nptxfempty = 1; -+ intr.b.ptxfempty = 1; -+ intr.b.hcintr = 1; -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, -+ intr.d32, 0); -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintsts, -+ intr.d32, 0); -+ -+ del_timers(dwc_otg_hcd); -+ -+ /* -+ * Turn off the vbus power only if the core has transitioned to device -+ * mode. If still in host mode, need to keep power on to detect a -+ * reconnection. -+ */ -+ if (dwc_otg_is_device_mode(dwc_otg_hcd->core_if)) { -+ if (dwc_otg_hcd->core_if->op_state != A_SUSPEND) { -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ DWC_PRINTF("Disconnect: PortPower off\n"); -+ hprt0.b.prtpwr = 0; -+ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, -+ hprt0.d32); -+ } -+ -+ dwc_otg_disable_host_interrupts(dwc_otg_hcd->core_if); -+ } -+ -+ /* Respond with an error status to all URBs in the schedule. */ -+ kill_all_urbs(dwc_otg_hcd); -+ -+ if (dwc_otg_is_host_mode(dwc_otg_hcd->core_if)) { -+ /* Clean up any host channels that were in use. */ -+ int num_channels; -+ int i; -+ dwc_hc_t *channel; -+ dwc_otg_hc_regs_t *hc_regs; -+ hcchar_data_t hcchar; -+ -+ num_channels = dwc_otg_hcd->core_if->core_params->host_channels; -+ -+ if (!dwc_otg_hcd->core_if->dma_enable) { -+ /* Flush out any channel requests in slave mode. */ -+ for (i = 0; i < num_channels; i++) { -+ channel = dwc_otg_hcd->hc_ptr_array[i]; -+ if (DWC_CIRCLEQ_EMPTY_ENTRY -+ (channel, hc_list_entry)) { -+ hc_regs = -+ dwc_otg_hcd->core_if-> -+ host_if->hc_regs[i]; -+ hcchar.d32 = -+ DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chen = 0; -+ hcchar.b.chdis = 1; -+ hcchar.b.epdir = 0; -+ DWC_WRITE_REG32 -+ (&hc_regs->hcchar, -+ hcchar.d32); -+ } -+ } -+ } -+ } -+ -+ for (i = 0; i < num_channels; i++) { -+ channel = dwc_otg_hcd->hc_ptr_array[i]; -+ if (DWC_CIRCLEQ_EMPTY_ENTRY(channel, hc_list_entry)) { -+ hc_regs = -+ dwc_otg_hcd->core_if->host_if->hc_regs[i]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ /* Halt the channel. */ -+ hcchar.b.chdis = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, -+ hcchar.d32); -+ } -+ -+ dwc_otg_hc_cleanup(dwc_otg_hcd->core_if, -+ channel); -+ DWC_CIRCLEQ_INSERT_TAIL -+ (&dwc_otg_hcd->free_hc_list, channel, -+ hc_list_entry); -+ /* -+ * Added for Descriptor DMA to prevent channel double cleanup -+ * in release_channel_ddma(). Which called from ep_disable -+ * when device disconnect. -+ */ -+ channel->qh = NULL; -+ } -+ } -+ if(fiq_fsm_enable) { -+ for(i=0; i < 128; i++) { -+ dwc_otg_hcd->hub_port[i] = 0; -+ } -+ } -+ -+ } -+ -+ if(fiq_enable) -+ local_fiq_enable(); -+ -+ if (dwc_otg_hcd->fops->disconnect) { -+ dwc_otg_hcd->fops->disconnect(dwc_otg_hcd); -+ } -+ -+ return 1; -+} -+ -+/** -+ * HCD Callback function for stopping the HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_stop_cb(void *p) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = p; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); -+ dwc_otg_hcd_stop(dwc_otg_hcd); -+ return 1; -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * HCD Callback function for sleep of HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int dwc_otg_hcd_sleep_cb(void *p) -+{ -+ dwc_otg_hcd_t *hcd = p; -+ -+ dwc_otg_hcd_free_hc_from_lpm(hcd); -+ -+ return 0; -+} -+#endif -+ -+ -+/** -+ * HCD Callback function for Remote Wakeup. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int dwc_otg_hcd_rem_wakeup_cb(void *p) -+{ -+ dwc_otg_hcd_t *hcd = p; -+ -+ if (hcd->core_if->lx_state == DWC_OTG_L2) { -+ hcd->flags.b.port_suspend_change = 1; -+ } -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ else { -+ hcd->flags.b.port_l1_change = 1; -+ } -+#endif -+ return 0; -+} -+ -+/** -+ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are -+ * stopped. -+ */ -+void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd) -+{ -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD STOP\n"); -+ -+ /* -+ * The root hub should be disconnected before this function is called. -+ * The disconnect will clear the QTD lists (via ..._hcd_urb_dequeue) -+ * and the QH lists (via ..._hcd_endpoint_disable). -+ */ -+ -+ /* Turn off all host-specific interrupts. */ -+ dwc_otg_disable_host_interrupts(hcd->core_if); -+ -+ /* Turn off the vbus power */ -+ DWC_PRINTF("PortPower off\n"); -+ hprt0.b.prtpwr = 0; -+ DWC_WRITE_REG32(hcd->core_if->host_if->hprt0, hprt0.d32); -+ dwc_mdelay(1); -+} -+ -+int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, void **ep_handle, -+ int atomic_alloc) -+{ -+ int retval = 0; -+ uint8_t needs_scheduling = 0; -+ dwc_otg_transaction_type_e tr_type; -+ dwc_otg_qtd_t *qtd; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ hprt0_data_t hprt0 = { .d32 = 0 }; -+ -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ if (NULL == hcd->core_if) { -+ DWC_ERROR("**** DWC OTG HCD URB Enqueue - HCD has NULL core_if\n"); -+ /* No longer connected. */ -+ return -DWC_E_INVALID; -+ } -+#endif -+ if (!hcd->flags.b.port_connect_status) { -+ /* No longer connected. */ -+ DWC_ERROR("Not connected\n"); -+ return -DWC_E_NO_DEVICE; -+ } -+ -+ /* Some core configurations cannot support LS traffic on a FS root port */ -+ if ((hcd->fops->speed(hcd, dwc_otg_urb->priv) == USB_SPEED_LOW) && -+ (hcd->core_if->hwcfg2.b.fs_phy_type == 1) && -+ (hcd->core_if->hwcfg2.b.hs_phy_type == 1)) { -+ hprt0.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_FULL_SPEED) { -+ return -DWC_E_NO_DEVICE; -+ } -+ } -+ -+ qtd = dwc_otg_hcd_qtd_create(dwc_otg_urb, atomic_alloc); -+ if (qtd == NULL) { -+ DWC_ERROR("DWC OTG HCD URB Enqueue failed creating QTD\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ if (qtd->urb == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD with no URBs\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ if (qtd->urb->priv == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD URB with no URB handle\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+#endif -+ intr_mask.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->gintmsk); -+ if(!intr_mask.b.sofintr || fiq_enable) needs_scheduling = 1; -+ if((((dwc_otg_qh_t *)ep_handle)->ep_type == UE_BULK) && !(qtd->urb->flags & URB_GIVEBACK_ASAP)) -+ /* Do not schedule SG transactions until qtd has URB_GIVEBACK_ASAP set */ -+ needs_scheduling = 0; -+ -+ retval = dwc_otg_hcd_qtd_add(qtd, hcd, (dwc_otg_qh_t **) ep_handle, atomic_alloc); -+ // creates a new queue in ep_handle if it doesn't exist already -+ if (retval < 0) { -+ DWC_ERROR("DWC OTG HCD URB Enqueue failed adding QTD. " -+ "Error status %d\n", retval); -+ dwc_otg_hcd_qtd_free(qtd); -+ return retval; -+ } -+ -+ if(needs_scheduling) { -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE) { -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ } -+ } -+ return retval; -+} -+ -+int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ dwc_otg_qh_t *qh; -+ dwc_otg_qtd_t *urb_qtd; -+ BUG_ON(!hcd); -+ BUG_ON(!dwc_otg_urb); -+ -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ -+ if (hcd == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL HCD\n"); -+ return -DWC_E_INVALID; -+ } -+ if (dwc_otg_urb == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL URB\n"); -+ return -DWC_E_INVALID; -+ } -+ if (dwc_otg_urb->qtd == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue with NULL QTD\n"); -+ return -DWC_E_INVALID; -+ } -+ urb_qtd = dwc_otg_urb->qtd; -+ BUG_ON(!urb_qtd); -+ if (urb_qtd->qh == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue with QTD with NULL Q handler\n"); -+ return -DWC_E_INVALID; -+ } -+#else -+ urb_qtd = dwc_otg_urb->qtd; -+ BUG_ON(!urb_qtd); -+#endif -+ qh = urb_qtd->qh; -+ BUG_ON(!qh); -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ if (urb_qtd->in_process) { -+ dump_channel_info(hcd, qh); -+ } -+ } -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ if (hcd->core_if == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue HCD has NULL core_if\n"); -+ return -DWC_E_INVALID; -+ } -+#endif -+ if (urb_qtd->in_process && qh->channel) { -+ /* The QTD is in process (it has been assigned to a channel). */ -+ if (hcd->flags.b.port_connect_status) { -+ int n = qh->channel->hc_num; -+ /* -+ * If still connected (i.e. in host mode), halt the -+ * channel so it can be used for other transfers. If -+ * no longer connected, the host registers can't be -+ * written to halt the channel since the core is in -+ * device mode. -+ */ -+ /* In FIQ FSM mode, we need to shut down carefully. -+ * The FIQ may attempt to restart a disabled channel */ -+ if (fiq_fsm_enable && (hcd->fiq_state->channel[n].fsm != FIQ_PASSTHROUGH)) { -+ qh->channel->halt_status = DWC_OTG_HC_XFER_URB_DEQUEUE; -+ qh->channel->halt_pending = 1; -+ hcd->fiq_state->channel[n].fsm = FIQ_DEQUEUE_ISSUED; -+ } else { -+ dwc_otg_hc_halt(hcd->core_if, qh->channel, -+ DWC_OTG_HC_XFER_URB_DEQUEUE); -+ } -+ } -+ } -+ -+ /* -+ * Free the QTD and clean up the associated QH. Leave the QH in the -+ * schedule if it has any remaining QTDs. -+ */ -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue - " -+ "delete %sQueue handler\n", -+ hcd->core_if->dma_desc_enable?"DMA ":""); -+ if (!hcd->core_if->dma_desc_enable) { -+ uint8_t b = urb_qtd->in_process; -+ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); -+ if (b) { -+ dwc_otg_hcd_qh_deactivate(hcd, qh, 0); -+ qh->channel = NULL; -+ } else if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } -+ } else { -+ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); -+ } -+ return 0; -+} -+ -+int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, -+ int retry) -+{ -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ int retval = 0; -+ dwc_irqflags_t flags; -+ -+ if (retry < 0) { -+ retval = -DWC_E_INVALID; -+ goto done; -+ } -+ -+ if (!qh) { -+ retval = -DWC_E_INVALID; -+ goto done; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ -+ while (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list) && retry) { -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ retry--; -+ dwc_msleep(5); -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ } -+ -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ /* -+ * Split dwc_otg_hcd_qh_remove_and_free() into qh_remove -+ * and qh_free to prevent stack dump on DWC_DMA_FREE() with -+ * irq_disabled (spinlock_irqsave) in dwc_otg_hcd_desc_list_free() -+ * and dwc_otg_hcd_frame_list_alloc(). -+ */ -+ dwc_otg_hcd_qh_free(hcd, qh); -+ -+done: -+ return retval; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ int retval = 0; -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ if (!qh) -+ return -DWC_E_INVALID; -+ -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ return retval; -+} -+#endif -+ -+/** -+ * HCD Callback structure for handling mode switching. -+ */ -+static dwc_otg_cil_callbacks_t hcd_cil_callbacks = { -+ .start = dwc_otg_hcd_start_cb, -+ .stop = dwc_otg_hcd_stop_cb, -+ .disconnect = dwc_otg_hcd_disconnect_cb, -+ .session_start = dwc_otg_hcd_session_start_cb, -+ .resume_wakeup = dwc_otg_hcd_rem_wakeup_cb, -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ .sleep = dwc_otg_hcd_sleep_cb, -+#endif -+ .p = 0, -+}; -+ -+/** -+ * Reset tasklet function -+ */ -+static void reset_tasklet_func(void *data) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = (dwc_otg_hcd_t *) data; -+ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; -+ hprt0_data_t hprt0; -+ -+ DWC_DEBUGPL(DBG_HCDV, "USB RESET tasklet called\n"); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtrst = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ dwc_mdelay(60); -+ -+ hprt0.b.prtrst = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ dwc_otg_hcd->flags.b.port_reset_change = 1; -+} -+ -+static void completion_tasklet_func(void *ptr) -+{ -+ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) ptr; -+ struct urb *urb; -+ urb_tq_entry_t *item; -+ dwc_irqflags_t flags; -+ -+ /* This could just be spin_lock_irq */ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ while (!DWC_TAILQ_EMPTY(&hcd->completed_urb_list)) { -+ item = DWC_TAILQ_FIRST(&hcd->completed_urb_list); -+ urb = item->urb; -+ DWC_TAILQ_REMOVE(&hcd->completed_urb_list, item, -+ urb_tq_entries); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ DWC_FREE(item); -+ -+ usb_hcd_giveback_urb(hcd->priv, urb, urb->status); -+ -+ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ return; -+} -+ -+static void qh_list_free(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) -+{ -+ dwc_list_link_t *item; -+ dwc_otg_qh_t *qh; -+ dwc_irqflags_t flags; -+ -+ if (!qh_list->next) { -+ /* The list hasn't been initialized yet. */ -+ return; -+ } -+ /* -+ * Hold spinlock here. Not needed in that case if bellow -+ * function is being called from ISR -+ */ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ /* Ensure there are no QTDs or URBs left. */ -+ kill_urbs_in_qh_list(hcd, qh_list); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ -+ DWC_LIST_FOREACH(item, qh_list) { -+ qh = DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); -+ dwc_otg_hcd_qh_remove_and_free(hcd, qh); -+ } -+} -+ -+/** -+ * Exit from Hibernation if Host did not detect SRP from connected SRP capable -+ * Device during SRP time by host power up. -+ */ -+void dwc_otg_hcd_power_up(void *ptr) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return; -+ } -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Enable VBUS */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+} -+ -+void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num) -+{ -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; -+ struct fiq_dma_blob *blob = hcd->fiq_dmab; -+ int i; -+ -+ st->fsm = FIQ_PASSTHROUGH; -+ st->hcchar_copy.d32 = 0; -+ st->hcsplt_copy.d32 = 0; -+ st->hcint_copy.d32 = 0; -+ st->hcintmsk_copy.d32 = 0; -+ st->hctsiz_copy.d32 = 0; -+ st->hcdma_copy.d32 = 0; -+ st->nr_errors = 0; -+ st->hub_addr = 0; -+ st->port_addr = 0; -+ st->expected_uframe = 0; -+ st->nrpackets = 0; -+ st->dma_info.index = 0; -+ for (i = 0; i < 6; i++) -+ st->dma_info.slot_len[i] = 255; -+ st->hs_isoc_info.index = 0; -+ st->hs_isoc_info.iso_desc = NULL; -+ st->hs_isoc_info.nrframes = 0; -+ -+ DWC_MEMSET(&blob->channel[num].index[0], 0x6b, 1128); -+} -+ -+/** -+ * Frees secondary storage associated with the dwc_otg_hcd structure contained -+ * in the struct usb_hcd field. -+ */ -+static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(dwc_otg_hcd); -+ int i; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD FREE\n"); -+ -+ del_timers(dwc_otg_hcd); -+ -+ /* Free memory for QH/QTD lists */ -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_inactive); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_active); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_inactive); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_ready); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_assigned); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_queued); -+ -+ /* Free memory for the host channels. */ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ dwc_hc_t *hc = dwc_otg_hcd->hc_ptr_array[i]; -+ -+#ifdef DEBUG -+ if (dwc_otg_hcd->core_if->hc_xfer_timer[i]) { -+ DWC_TIMER_FREE(dwc_otg_hcd->core_if->hc_xfer_timer[i]); -+ } -+#endif -+ if (hc != NULL) { -+ DWC_DEBUGPL(DBG_HCDV, "HCD Free channel #%i, hc=%p\n", -+ i, hc); -+ DWC_FREE(hc); -+ } -+ } -+ -+ if (dwc_otg_hcd->core_if->dma_enable) { -+ if (dwc_otg_hcd->status_buf_dma) { -+ DWC_DMA_FREE(dev, DWC_OTG_HCD_STATUS_BUF_SIZE, -+ dwc_otg_hcd->status_buf, -+ dwc_otg_hcd->status_buf_dma); -+ } -+ } else if (dwc_otg_hcd->status_buf != NULL) { -+ DWC_FREE(dwc_otg_hcd->status_buf); -+ } -+ DWC_SPINLOCK_FREE(dwc_otg_hcd->channel_lock); -+ DWC_SPINLOCK_FREE(dwc_otg_hcd->lock); -+ /* Set core_if's lock pointer to NULL */ -+ dwc_otg_hcd->core_if->lock = NULL; -+ -+ DWC_TIMER_FREE(dwc_otg_hcd->conn_timer); -+ DWC_TASK_FREE(dwc_otg_hcd->reset_tasklet); -+ DWC_TASK_FREE(dwc_otg_hcd->completion_tasklet); -+ DWC_FREE(dwc_otg_hcd->fiq_state); -+ -+#ifdef DWC_DEV_SRPCAP -+ if (dwc_otg_hcd->core_if->power_down == 2 && -+ dwc_otg_hcd->core_if->pwron_timer) { -+ DWC_TIMER_FREE(dwc_otg_hcd->core_if->pwron_timer); -+ } -+#endif -+ DWC_FREE(dwc_otg_hcd); -+} -+ -+int init_hcd_usecs(dwc_otg_hcd_t *_hcd); -+ -+int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ int retval = 0; -+ int num_channels; -+ int i; -+ dwc_hc_t *channel; -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->lock); -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->channel_lock); -+#else -+ hcd->lock = DWC_SPINLOCK_ALLOC(); -+ hcd->channel_lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ DWC_DEBUGPL(DBG_HCDV, "init of HCD %p given core_if %p\n", -+ hcd, core_if); -+ if (!hcd->lock) { -+ DWC_ERROR("Could not allocate lock for pcd"); -+ DWC_FREE(hcd); -+ retval = -DWC_E_NO_MEMORY; -+ goto out; -+ } -+ hcd->core_if = core_if; -+ -+ /* Register the HCD CIL Callbacks */ -+ dwc_otg_cil_register_hcd_callbacks(hcd->core_if, -+ &hcd_cil_callbacks, hcd); -+ -+ /* Initialize the non-periodic schedule. */ -+ DWC_LIST_INIT(&hcd->non_periodic_sched_inactive); -+ DWC_LIST_INIT(&hcd->non_periodic_sched_active); -+ -+ /* Initialize the periodic schedule. */ -+ DWC_LIST_INIT(&hcd->periodic_sched_inactive); -+ DWC_LIST_INIT(&hcd->periodic_sched_ready); -+ DWC_LIST_INIT(&hcd->periodic_sched_assigned); -+ DWC_LIST_INIT(&hcd->periodic_sched_queued); -+ DWC_TAILQ_INIT(&hcd->completed_urb_list); -+ /* -+ * Create a host channel descriptor for each host channel implemented -+ * in the controller. Initialize the channel descriptor array. -+ */ -+ DWC_CIRCLEQ_INIT(&hcd->free_hc_list); -+ num_channels = hcd->core_if->core_params->host_channels; -+ DWC_MEMSET(hcd->hc_ptr_array, 0, sizeof(hcd->hc_ptr_array)); -+ for (i = 0; i < num_channels; i++) { -+ channel = DWC_ALLOC(sizeof(dwc_hc_t)); -+ if (channel == NULL) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: host channel allocation failed\n", -+ __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ channel->hc_num = i; -+ hcd->hc_ptr_array[i] = channel; -+#ifdef DEBUG -+ hcd->core_if->hc_xfer_timer[i] = -+ DWC_TIMER_ALLOC("hc timer", hc_xfer_timeout, -+ &hcd->core_if->hc_xfer_info[i]); -+#endif -+ DWC_DEBUGPL(DBG_HCDV, "HCD Added channel #%d, hc=%p\n", i, -+ channel); -+ } -+ -+ if (fiq_enable) { -+ hcd->fiq_state = DWC_ALLOC(sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels)); -+ if (!hcd->fiq_state) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: cannot allocate fiq_state structure\n", __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ DWC_MEMSET(hcd->fiq_state, 0, (sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels))); -+ -+ for (i = 0; i < num_channels; i++) { -+ hcd->fiq_state->channel[i].fsm = FIQ_PASSTHROUGH; -+ } -+ hcd->fiq_state->dummy_send = DWC_ALLOC_ATOMIC(16); -+ -+ hcd->fiq_stack = DWC_ALLOC(sizeof(struct fiq_stack)); -+ if (!hcd->fiq_stack) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: cannot allocate fiq_stack structure\n", __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ hcd->fiq_stack->magic1 = 0xDEADBEEF; -+ hcd->fiq_stack->magic2 = 0xD00DFEED; -+ hcd->fiq_state->gintmsk_saved.d32 = ~0; -+ hcd->fiq_state->haintmsk_saved.b2.chint = ~0; -+ -+ /* This bit is terrible and uses no API, but necessary. The FIQ has no concept of DMA pools -+ * (and if it did, would be a lot slower). This allocates a chunk of memory (~9kiB for 8 host channels) -+ * for use as transaction bounce buffers in a 2-D array. Our access into this chunk is done by some -+ * moderately readable array casts. -+ */ -+ hcd->fiq_dmab = DWC_DMA_ALLOC(dev, (sizeof(struct fiq_dma_channel) * num_channels), &hcd->fiq_state->dma_base); -+ DWC_WARN("FIQ DMA bounce buffers: virt = 0x%08x dma = 0x%08x len=%d", -+ (unsigned int)hcd->fiq_dmab, (unsigned int)hcd->fiq_state->dma_base, -+ sizeof(struct fiq_dma_channel) * num_channels); -+ -+ DWC_MEMSET(hcd->fiq_dmab, 0x6b, 9024); -+ -+ /* pointer for debug in fiq_print */ -+ hcd->fiq_state->fiq_dmab = hcd->fiq_dmab; -+ if (fiq_fsm_enable) { -+ int i; -+ for (i=0; i < hcd->core_if->core_params->host_channels; i++) { -+ dwc_otg_cleanup_fiq_channel(hcd, i); -+ } -+ DWC_PRINTF("FIQ FSM acceleration enabled for :\n%s%s%s%s", -+ (fiq_fsm_mask & 0x1) ? "Non-periodic Split Transactions\n" : "", -+ (fiq_fsm_mask & 0x2) ? "Periodic Split Transactions\n" : "", -+ (fiq_fsm_mask & 0x4) ? "High-Speed Isochronous Endpoints\n" : "", -+ (fiq_fsm_mask & 0x8) ? "Interrupt/Control Split Transaction hack enabled\n" : ""); -+ } -+ } -+ -+ /* Initialize the Connection timeout timer. */ -+ hcd->conn_timer = DWC_TIMER_ALLOC("Connection timer", -+ dwc_otg_hcd_connect_timeout, 0); -+ -+ printk(KERN_DEBUG "dwc_otg: Microframe scheduler %s\n", microframe_schedule ? "enabled":"disabled"); -+ if (microframe_schedule) -+ init_hcd_usecs(hcd); -+ -+ /* Initialize reset tasklet. */ -+ hcd->reset_tasklet = DWC_TASK_ALLOC("reset_tasklet", reset_tasklet_func, hcd); -+ -+ hcd->completion_tasklet = DWC_TASK_ALLOC("completion_tasklet", -+ completion_tasklet_func, hcd); -+#ifdef DWC_DEV_SRPCAP -+ if (hcd->core_if->power_down == 2) { -+ /* Initialize Power on timer for Host power up in case hibernation */ -+ hcd->core_if->pwron_timer = DWC_TIMER_ALLOC("PWRON TIMER", -+ dwc_otg_hcd_power_up, core_if); -+ } -+#endif -+ -+ /* -+ * Allocate space for storing data on status transactions. Normally no -+ * data is sent, but this space acts as a bit bucket. This must be -+ * done after usb_add_hcd since that function allocates the DMA buffer -+ * pool. -+ */ -+ if (hcd->core_if->dma_enable) { -+ hcd->status_buf = -+ DWC_DMA_ALLOC(dev, DWC_OTG_HCD_STATUS_BUF_SIZE, -+ &hcd->status_buf_dma); -+ } else { -+ hcd->status_buf = DWC_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE); -+ } -+ if (!hcd->status_buf) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: status_buf allocation failed\n", __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ -+ hcd->otg_port = 1; -+ hcd->frame_list = NULL; -+ hcd->frame_list_dma = 0; -+ hcd->periodic_qh_count = 0; -+ -+ DWC_MEMSET(hcd->hub_port, 0, sizeof(hcd->hub_port)); -+#ifdef FIQ_DEBUG -+ DWC_MEMSET(hcd->hub_port_alloc, -1, sizeof(hcd->hub_port_alloc)); -+#endif -+ -+out: -+ return retval; -+} -+ -+void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd) -+{ -+ /* Turn off all host-specific interrupts. */ -+ dwc_otg_disable_host_interrupts(hcd->core_if); -+ -+ dwc_otg_hcd_free(hcd); -+} -+ -+/** -+ * Initializes dynamic portions of the DWC_otg HCD state. -+ */ -+static void dwc_otg_hcd_reinit(dwc_otg_hcd_t * hcd) -+{ -+ int num_channels; -+ int i; -+ dwc_hc_t *channel; -+ dwc_hc_t *channel_tmp; -+ -+ hcd->flags.d32 = 0; -+ -+ hcd->non_periodic_qh_ptr = &hcd->non_periodic_sched_active; -+ if (!microframe_schedule) { -+ hcd->non_periodic_channels = 0; -+ hcd->periodic_channels = 0; -+ } else { -+ hcd->available_host_channels = hcd->core_if->core_params->host_channels; -+ } -+ /* -+ * Put all channels in the free channel list and clean up channel -+ * states. -+ */ -+ DWC_CIRCLEQ_FOREACH_SAFE(channel, channel_tmp, -+ &hcd->free_hc_list, hc_list_entry) { -+ DWC_CIRCLEQ_REMOVE(&hcd->free_hc_list, channel, hc_list_entry); -+ } -+ -+ num_channels = hcd->core_if->core_params->host_channels; -+ for (i = 0; i < num_channels; i++) { -+ channel = hcd->hc_ptr_array[i]; -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, channel, -+ hc_list_entry); -+ dwc_otg_hc_cleanup(hcd->core_if, channel); -+ } -+ -+ /* Initialize the DWC core for host mode operation. */ -+ dwc_otg_core_host_init(hcd->core_if); -+ -+ /* Set core_if's lock pointer to the hcd->lock */ -+ hcd->core_if->lock = hcd->lock; -+} -+ -+/** -+ * Assigns transactions from a QTD to a free host channel and initializes the -+ * host channel to perform the transactions. The host channel is removed from -+ * the free list. -+ * -+ * @param hcd The HCD state structure. -+ * @param qh Transactions from the first QTD for this QH are selected and -+ * assigned to a free host channel. -+ */ -+static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ dwc_hc_t *hc; -+ dwc_otg_qtd_t *qtd; -+ dwc_otg_hcd_urb_t *urb; -+ void* ptr = NULL; -+ uint32_t intr_enable; -+ unsigned long flags; -+ gintmsk_data_t gintmsk = { .d32 = 0, }; -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ -+ urb = qtd->urb; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p,%p) - urb %x, actual_length %d\n", __func__, hcd, qh, (unsigned int)urb, urb->actual_length); -+ -+ if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info)) -+ urb->actual_length = urb->length; -+ -+ -+ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); -+ -+ /* Remove the host channel from the free list. */ -+ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); -+ -+ qh->channel = hc; -+ -+ qtd->in_process = 1; -+ -+ /* -+ * Use usb_pipedevice to determine device address. This address is -+ * 0 before the SET_ADDRESS command and the correct address afterward. -+ */ -+ hc->dev_addr = dwc_otg_hcd_get_dev_addr(&urb->pipe_info); -+ hc->ep_num = dwc_otg_hcd_get_ep_num(&urb->pipe_info); -+ hc->speed = qh->dev_speed; -+ hc->max_packet = dwc_max_packet(qh->maxp); -+ -+ hc->xfer_started = 0; -+ hc->halt_status = DWC_OTG_HC_XFER_NO_HALT_STATUS; -+ hc->error_state = (qtd->error_count > 0); -+ hc->halt_on_queue = 0; -+ hc->halt_pending = 0; -+ hc->requests = 0; -+ -+ /* -+ * The following values may be modified in the transfer type section -+ * below. The xfer_len value may be reduced when the transfer is -+ * started to accommodate the max widths of the XferSize and PktCnt -+ * fields in the HCTSIZn register. -+ */ -+ -+ hc->ep_is_in = (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) != 0); -+ if (hc->ep_is_in) { -+ hc->do_ping = 0; -+ } else { -+ hc->do_ping = qh->ping_state; -+ } -+ -+ hc->data_pid_start = qh->data_toggle; -+ hc->multi_count = 1; -+ -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) urb->dma + urb->actual_length; -+ -+ /* For non-dword aligned case */ -+ if (((unsigned long)hc->xfer_buff & 0x3) -+ && !hcd->core_if->dma_desc_enable) { -+ ptr = (uint8_t *) urb->buf + urb->actual_length; -+ } -+ } else { -+ hc->xfer_buff = (uint8_t *) urb->buf + urb->actual_length; -+ } -+ hc->xfer_len = urb->length - urb->actual_length; -+ hc->xfer_count = 0; -+ -+ /* -+ * Set the split attributes -+ */ -+ hc->do_split = 0; -+ if (qh->do_split) { -+ uint32_t hub_addr, port_addr; -+ hc->do_split = 1; -+ hc->xact_pos = qtd->isoc_split_pos; -+ /* We don't need to do complete splits anymore */ -+// if(fiq_fsm_enable) -+ if (0) -+ hc->complete_split = qtd->complete_split = 0; -+ else -+ hc->complete_split = qtd->complete_split; -+ -+ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &port_addr); -+ hc->hub_addr = (uint8_t) hub_addr; -+ hc->port_addr = (uint8_t) port_addr; -+ } -+ -+ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { -+ case UE_CONTROL: -+ hc->ep_type = DWC_OTG_EP_TYPE_CONTROL; -+ switch (qtd->control_phase) { -+ case DWC_OTG_CONTROL_SETUP: -+ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction\n"); -+ hc->do_ping = 0; -+ hc->ep_is_in = 0; -+ hc->data_pid_start = DWC_OTG_HC_PID_SETUP; -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) urb->setup_dma; -+ } else { -+ hc->xfer_buff = (uint8_t *) urb->setup_packet; -+ } -+ hc->xfer_len = 8; -+ ptr = NULL; -+ break; -+ case DWC_OTG_CONTROL_DATA: -+ DWC_DEBUGPL(DBG_HCDV, " Control data transaction\n"); -+ hc->data_pid_start = qtd->data_toggle; -+ break; -+ case DWC_OTG_CONTROL_STATUS: -+ /* -+ * Direction is opposite of data direction or IN if no -+ * data. -+ */ -+ DWC_DEBUGPL(DBG_HCDV, " Control status transaction\n"); -+ if (urb->length == 0) { -+ hc->ep_is_in = 1; -+ } else { -+ hc->ep_is_in = -+ dwc_otg_hcd_is_pipe_out(&urb->pipe_info); -+ } -+ if (hc->ep_is_in) { -+ hc->do_ping = 0; -+ } -+ -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; -+ -+ hc->xfer_len = 0; -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) hcd->status_buf_dma; -+ } else { -+ hc->xfer_buff = (uint8_t *) hcd->status_buf; -+ } -+ ptr = NULL; -+ break; -+ } -+ break; -+ case UE_BULK: -+ hc->ep_type = DWC_OTG_EP_TYPE_BULK; -+ break; -+ case UE_INTERRUPT: -+ hc->ep_type = DWC_OTG_EP_TYPE_INTR; -+ break; -+ case UE_ISOCHRONOUS: -+ { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ -+ hc->ep_type = DWC_OTG_EP_TYPE_ISOC; -+ -+ if (hcd->core_if->dma_desc_enable) -+ break; -+ -+ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; -+ -+ frame_desc->status = 0; -+ -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) urb->dma; -+ } else { -+ hc->xfer_buff = (uint8_t *) urb->buf; -+ } -+ hc->xfer_buff += -+ frame_desc->offset + qtd->isoc_split_offset; -+ hc->xfer_len = -+ frame_desc->length - qtd->isoc_split_offset; -+ -+ /* For non-dword aligned buffers */ -+ if (((unsigned long)hc->xfer_buff & 0x3) -+ && hcd->core_if->dma_enable) { -+ ptr = -+ (uint8_t *) urb->buf + frame_desc->offset + -+ qtd->isoc_split_offset; -+ } else -+ ptr = NULL; -+ -+ if (hc->xact_pos == DWC_HCSPLIT_XACTPOS_ALL) { -+ if (hc->xfer_len <= 188) { -+ hc->xact_pos = DWC_HCSPLIT_XACTPOS_ALL; -+ } else { -+ hc->xact_pos = -+ DWC_HCSPLIT_XACTPOS_BEGIN; -+ } -+ } -+ } -+ break; -+ } -+ /* non DWORD-aligned buffer case */ -+ if (ptr) { -+ uint32_t buf_size; -+ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { -+ buf_size = hcd->core_if->core_params->max_transfer_size; -+ } else { -+ buf_size = 4096; -+ } -+ if (!qh->dw_align_buf) { -+ qh->dw_align_buf = DWC_DMA_ALLOC_ATOMIC(dev, buf_size, -+ &qh->dw_align_buf_dma); -+ if (!qh->dw_align_buf) { -+ DWC_ERROR -+ ("%s: Failed to allocate memory to handle " -+ "non-dword aligned buffer case\n", -+ __func__); -+ return; -+ } -+ } -+ if (!hc->ep_is_in) { -+ dwc_memcpy(qh->dw_align_buf, ptr, hc->xfer_len); -+ } -+ hc->align_buff = qh->dw_align_buf_dma; -+ } else { -+ hc->align_buff = 0; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * This value may be modified when the transfer is started to -+ * reflect the actual transfer length. -+ */ -+ hc->multi_count = dwc_hb_mult(qh->maxp); -+ } -+ -+ if (hcd->core_if->dma_desc_enable) -+ hc->desc_list_addr = qh->desc_list_dma; -+ -+ dwc_otg_hc_init(hcd->core_if, hc); -+ -+ local_irq_save(flags); -+ -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ } -+ -+ /* Enable the top level host channel interrupt. */ -+ intr_enable = (1 << hc->hc_num); -+ DWC_MODIFY_REG32(&hcd->core_if->host_if->host_global_regs->haintmsk, 0, intr_enable); -+ -+ /* Make sure host channel interrupts are enabled. */ -+ gintmsk.b.hcintr = 1; -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); -+ -+ if (fiq_enable) { -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } -+ -+ local_irq_restore(flags); -+ hc->qh = qh; -+} -+ -+ -+/** -+ * fiq_fsm_transaction_suitable() - Test a QH for compatibility with the FIQ -+ * @qh: pointer to the endpoint's queue head -+ * -+ * Transaction start/end control flow is grafted onto the existing dwc_otg -+ * mechanisms, to avoid spaghettifying the functions more than they already are. -+ * This function's eligibility check is altered by debug parameter. -+ * -+ * Returns: 0 for unsuitable, 1 implies the FIQ can be enabled for this transaction. -+ */ -+ -+int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh) -+{ -+ if (qh->do_split) { -+ switch (qh->ep_type) { -+ case UE_CONTROL: -+ case UE_BULK: -+ if (fiq_fsm_mask & (1 << 0)) -+ return 1; -+ break; -+ case UE_INTERRUPT: -+ case UE_ISOCHRONOUS: -+ if (fiq_fsm_mask & (1 << 1)) -+ return 1; -+ break; -+ default: -+ break; -+ } -+ } else if (qh->ep_type == UE_ISOCHRONOUS) { -+ if (fiq_fsm_mask & (1 << 2)) { -+ /* HS ISOCH support. We test for compatibility: -+ * - DWORD aligned buffers -+ * - Must be at least 2 transfers (otherwise pointless to use the FIQ) -+ * If yes, then the fsm enqueue function will handle the state machine setup. -+ */ -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ struct dwc_otg_hcd_iso_packet_desc (*iso_descs)[0] = &urb->iso_descs; -+ int nr_iso_frames = urb->packet_count; -+ int i; -+ uint32_t ptr; -+ -+ if (nr_iso_frames < 2) -+ return 0; -+ for (i = 0; i < nr_iso_frames; i++) { -+ ptr = urb->dma + iso_descs[i]->offset; -+ if (ptr & 0x3) { -+ printk_ratelimited("%s: Non-Dword aligned isochronous frame offset." -+ " Cannot queue FIQ-accelerated transfer to device %d endpoint %d\n", -+ __FUNCTION__, qh->channel->dev_addr, qh->channel->ep_num); -+ return 0; -+ } -+ } -+ return 1; -+ } -+ } -+ return 0; -+} -+ -+/** -+ * fiq_fsm_setup_periodic_dma() - Set up DMA bounce buffers -+ * @hcd: Pointer to the dwc_otg_hcd struct -+ * @qh: Pointer to the endpoint's queue head -+ * -+ * Periodic split transactions are transmitted modulo 188 bytes. -+ * This necessitates slicing data up into buckets for isochronous out -+ * and fixing up the DMA address for all IN transfers. -+ * -+ * Returns 1 if the DMA bounce buffers have been used, 0 if the default -+ * HC buffer has been used. -+ */ -+int fiq_fsm_setup_periodic_dma(dwc_otg_hcd_t *hcd, struct fiq_channel_state *st, dwc_otg_qh_t *qh) -+ { -+ int frame_length, i = 0; -+ uint8_t *ptr = NULL; -+ dwc_hc_t *hc = qh->channel; -+ struct fiq_dma_blob *blob; -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ -+ for (i = 0; i < 6; i++) { -+ st->dma_info.slot_len[i] = 255; -+ } -+ st->dma_info.index = 0; -+ i = 0; -+ if (hc->ep_is_in) { -+ /* -+ * Set dma_regs to bounce buffer. FIQ will update the -+ * state depending on transaction progress. -+ */ -+ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; -+ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; -+ /* Calculate the max number of CSPLITS such that the FIQ can time out -+ * a transaction if it fails. -+ */ -+ frame_length = st->hcchar_copy.b.mps; -+ do { -+ i++; -+ frame_length -= 188; -+ } while (frame_length >= 0); -+ st->nrpackets = i; -+ return 1; -+ } else { -+ if (qh->ep_type == UE_ISOCHRONOUS) { -+ -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ frame_length = frame_desc->length; -+ -+ /* Virtual address for bounce buffers */ -+ blob = hcd->fiq_dmab; -+ -+ ptr = qtd->urb->buf + frame_desc->offset; -+ if (frame_length == 0) { -+ /* -+ * for isochronous transactions, we must still transmit a packet -+ * even if the length is zero. -+ */ -+ st->dma_info.slot_len[0] = 0; -+ st->nrpackets = 1; -+ } else { -+ do { -+ if (frame_length <= 188) { -+ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, frame_length); -+ st->dma_info.slot_len[i] = frame_length; -+ ptr += frame_length; -+ } else { -+ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, 188); -+ st->dma_info.slot_len[i] = 188; -+ ptr += 188; -+ } -+ i++; -+ frame_length -= 188; -+ } while (frame_length > 0); -+ st->nrpackets = i; -+ } -+ ptr = qtd->urb->buf + frame_desc->offset; -+ /* Point the HC at the DMA address of the bounce buffers */ -+ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; -+ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; -+ -+ /* fixup xfersize to the actual packet size */ -+ st->hctsiz_copy.b.pid = 0; -+ st->hctsiz_copy.b.xfersize = st->dma_info.slot_len[0]; -+ return 1; -+ } else { -+ /* For interrupt, single OUT packet required, goes in the SSPLIT from hc_buff. */ -+ return 0; -+ } -+ } -+} -+ -+/* -+ * Pushing a periodic request into the queue near the EOF1 point -+ * in a microframe causes erroneous behaviour (frmovrun) interrupt. -+ * Usually, the request goes out on the bus causing a transfer but -+ * the core does not transfer the data to memory. -+ * This guard interval (in number of 60MHz clocks) is required which -+ * must cater for CPU latency between reading the value and enabling -+ * the channel. -+ */ -+#define PERIODIC_FRREM_BACKOFF 1000 -+ -+int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) -+{ -+ dwc_hc_t *hc = qh->channel; -+ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ int frame; -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; -+ int xfer_len, nrpackets; -+ hcdma_data_t hcdma; -+ hfnum_data_t hfnum; -+ -+ if (st->fsm != FIQ_PASSTHROUGH) -+ return 0; -+ -+ st->nr_errors = 0; -+ -+ st->hcchar_copy.d32 = 0; -+ st->hcchar_copy.b.mps = hc->max_packet; -+ st->hcchar_copy.b.epdir = hc->ep_is_in; -+ st->hcchar_copy.b.devaddr = hc->dev_addr; -+ st->hcchar_copy.b.epnum = hc->ep_num; -+ st->hcchar_copy.b.eptype = hc->ep_type; -+ -+ st->hcintmsk_copy.b.chhltd = 1; -+ -+ frame = dwc_otg_hcd_get_frame_number(hcd); -+ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; -+ -+ st->hcchar_copy.b.lspddev = 0; -+ /* Enable the channel later as a final register write. */ -+ -+ st->hcsplt_copy.d32 = 0; -+ -+ st->hs_isoc_info.iso_desc = (struct dwc_otg_hcd_iso_packet_desc *) &qtd->urb->iso_descs; -+ st->hs_isoc_info.nrframes = qtd->urb->packet_count; -+ /* grab the next DMA address offset from the array */ -+ st->hcdma_copy.d32 = qtd->urb->dma; -+ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[0].offset; -+ -+ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as -+ * the core needs to be told to send the correct number. Caution: for IN transfers, -+ * this is always set to the maximum size of the endpoint. */ -+ xfer_len = st->hs_isoc_info.iso_desc[0].length; -+ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; -+ if (nrpackets == 0) -+ nrpackets = 1; -+ st->hcchar_copy.b.multicnt = nrpackets; -+ st->hctsiz_copy.b.pktcnt = nrpackets; -+ -+ /* Initial PID also needs to be set */ -+ if (st->hcchar_copy.b.epdir == 0) { -+ st->hctsiz_copy.b.xfersize = xfer_len; -+ switch (st->hcchar_copy.b.multicnt) { -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_MDATA; -+ break; -+ } -+ -+ } else { -+ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; -+ switch (st->hcchar_copy.b.multicnt) { -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA1; -+ break; -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA2; -+ break; -+ } -+ } -+ -+ st->hs_isoc_info.stride = qh->interval; -+ st->uframe_sleeps = 0; -+ -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); -+ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); -+ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { -+ /* Prevent queueing near EOF1. Bad things happen if a periodic -+ * split transaction is queued very close to EOF. SOF interrupt handler -+ * will wake this channel at the next interrupt. -+ */ -+ st->fsm = FIQ_HS_ISOC_SLEEPING; -+ st->uframe_sleeps = 1; -+ } else { -+ st->fsm = FIQ_HS_ISOC_TURBO; -+ st->hcchar_copy.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ } -+ mb(); -+ st->hcchar_copy.b.chen = 0; -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ return 0; -+} -+ -+ -+/** -+ * fiq_fsm_queue_split_transaction() - Set up a host channel and FIQ state -+ * @hcd: Pointer to the dwc_otg_hcd struct -+ * @qh: Pointer to the endpoint's queue head -+ * -+ * This overrides the dwc_otg driver's normal method of queueing a transaction. -+ * Called from dwc_otg_hcd_queue_transactions(), this performs specific setup -+ * for the nominated host channel. -+ * -+ * For periodic transfers, it also peeks at the FIQ state to see if an immediate -+ * start is possible. If not, then the FIQ is left to start the transfer. -+ */ -+int fiq_fsm_queue_split_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) -+{ -+ int start_immediate = 1, i; -+ hfnum_data_t hfnum; -+ dwc_hc_t *hc = qh->channel; -+ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; -+ /* Program HC registers, setup FIQ_state, examine FIQ if periodic, start transfer (not if uframe 5) */ -+ int hub_addr, port_addr, frame, uframe; -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; -+ -+ if (st->fsm != FIQ_PASSTHROUGH) -+ return 0; -+ st->nr_errors = 0; -+ -+ st->hcchar_copy.d32 = 0; -+ st->hcchar_copy.b.mps = hc->max_packet; -+ st->hcchar_copy.b.epdir = hc->ep_is_in; -+ st->hcchar_copy.b.devaddr = hc->dev_addr; -+ st->hcchar_copy.b.epnum = hc->ep_num; -+ st->hcchar_copy.b.eptype = hc->ep_type; -+ if (hc->ep_type & 0x1) { -+ if (hc->ep_is_in) -+ st->hcchar_copy.b.multicnt = 3; -+ else -+ /* Docs say set this to 1, but driver sets to 0! */ -+ st->hcchar_copy.b.multicnt = 0; -+ } else { -+ st->hcchar_copy.b.multicnt = 1; -+ st->hcchar_copy.b.oddfrm = 0; -+ } -+ st->hcchar_copy.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW) ? 1 : 0; -+ /* Enable the channel later as a final register write. */ -+ -+ st->hcsplt_copy.d32 = 0; -+ if(qh->do_split) { -+ hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr); -+ st->hcsplt_copy.b.compsplt = 0; -+ st->hcsplt_copy.b.spltena = 1; -+ // XACTPOS is for isoc-out only but needs initialising anyway. -+ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_ALL; -+ if((qh->ep_type == DWC_OTG_EP_TYPE_ISOC) && (!qh->ep_is_in)) { -+ /* For packetsize 0 < L < 188, ISOC_XACTPOS_ALL. -+ * for longer than this, ISOC_XACTPOS_BEGIN and the FIQ -+ * will update as necessary. -+ */ -+ if (hc->xfer_len > 188) { -+ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_BEGIN; -+ } -+ } -+ st->hcsplt_copy.b.hubaddr = (uint8_t) hub_addr; -+ st->hcsplt_copy.b.prtaddr = (uint8_t) port_addr; -+ st->hub_addr = hub_addr; -+ st->port_addr = port_addr; -+ } -+ -+ st->hctsiz_copy.d32 = 0; -+ st->hctsiz_copy.b.dopng = 0; -+ st->hctsiz_copy.b.pid = hc->data_pid_start; -+ -+ if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { -+ hc->xfer_len = hc->max_packet; -+ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { -+ hc->xfer_len = 188; -+ } -+ st->hctsiz_copy.b.xfersize = hc->xfer_len; -+ -+ st->hctsiz_copy.b.pktcnt = 1; -+ -+ if (hc->ep_type & 0x1) { -+ /* -+ * For potentially multi-packet transfers, must use the DMA bounce buffers. For IN transfers, -+ * the DMA address is the address of the first 188byte slot buffer in the bounce buffer array. -+ * For multi-packet OUT transfers, we need to copy the data into the bounce buffer array so the FIQ can punt -+ * the right address out as necessary. hc->xfer_buff and hc->xfer_len have already been set -+ * in assign_and_init_hc(), but this is for the eventual transaction completion only. The FIQ -+ * must not touch internal driver state. -+ */ -+ if(!fiq_fsm_setup_periodic_dma(hcd, st, qh)) { -+ if (hc->align_buff) { -+ st->hcdma_copy.d32 = hc->align_buff; -+ } else { -+ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); -+ } -+ } -+ } else { -+ if (hc->align_buff) { -+ st->hcdma_copy.d32 = hc->align_buff; -+ } else { -+ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); -+ } -+ } -+ /* The FIQ depends upon no other interrupts being enabled except channel halt. -+ * Fixup channel interrupt mask. */ -+ st->hcintmsk_copy.d32 = 0; -+ st->hcintmsk_copy.b.chhltd = 1; -+ st->hcintmsk_copy.b.ahberr = 1; -+ -+ /* Hack courtesy of FreeBSD: apparently forcing Interrupt Split transactions -+ * as Control puts the transfer into the non-periodic request queue and the -+ * non-periodic handler in the hub. Makes things lots easier. -+ */ -+ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) { -+ st->hcchar_copy.b.multicnt = 0; -+ st->hcchar_copy.b.oddfrm = 0; -+ st->hcchar_copy.b.eptype = UE_CONTROL; -+ if (hc->align_buff) { -+ st->hcdma_copy.d32 = hc->align_buff; -+ } else { -+ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); -+ } -+ } -+ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); -+ -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ -+ if (hc->ep_type & 0x1) { -+ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); -+ frame = (hfnum.b.frnum & ~0x7) >> 3; -+ uframe = hfnum.b.frnum & 0x7; -+ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { -+ /* Prevent queueing near EOF1. Bad things happen if a periodic -+ * split transaction is queued very close to EOF. -+ */ -+ start_immediate = 0; -+ } else if (uframe == 5) { -+ start_immediate = 0; -+ } else if (hc->ep_type == UE_ISOCHRONOUS && !hc->ep_is_in) { -+ start_immediate = 0; -+ } else if (hc->ep_is_in && fiq_fsm_too_late(hcd->fiq_state, hc->hc_num)) { -+ start_immediate = 0; -+ } else { -+ /* Search through all host channels to determine if a transaction -+ * is currently in progress */ -+ for (i = 0; i < hcd->core_if->core_params->host_channels; i++) { -+ if (i == hc->hc_num || hcd->fiq_state->channel[i].fsm == FIQ_PASSTHROUGH) -+ continue; -+ switch (hcd->fiq_state->channel[i].fsm) { -+ /* TT is reserved for channels that are in the middle of a periodic -+ * split transaction. -+ */ -+ case FIQ_PER_SSPLIT_STARTED: -+ case FIQ_PER_CSPLIT_WAIT: -+ case FIQ_PER_CSPLIT_NYET1: -+ case FIQ_PER_CSPLIT_POLL: -+ case FIQ_PER_ISO_OUT_ACTIVE: -+ case FIQ_PER_ISO_OUT_LAST: -+ if (hcd->fiq_state->channel[i].hub_addr == hub_addr && -+ hcd->fiq_state->channel[i].port_addr == port_addr) { -+ start_immediate = 0; -+ } -+ break; -+ default: -+ break; -+ } -+ if (!start_immediate) -+ break; -+ } -+ } -+ } -+ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) -+ start_immediate = 1; -+ -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d %01d", hc->hc_num, start_immediate); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08d", hfnum.b.frrem); -+ //fiq_print(FIQDBG_INT, hcd->fiq_state, "H:%02dP:%02d", hub_addr, port_addr); -+ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); -+ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); -+ switch (hc->ep_type) { -+ case UE_CONTROL: -+ case UE_BULK: -+ st->fsm = FIQ_NP_SSPLIT_STARTED; -+ break; -+ case UE_ISOCHRONOUS: -+ if (hc->ep_is_in) { -+ if (start_immediate) { -+ st->fsm = FIQ_PER_SSPLIT_STARTED; -+ } else { -+ st->fsm = FIQ_PER_SSPLIT_QUEUED; -+ } -+ } else { -+ if (start_immediate) { -+ /* Single-isoc OUT packets don't require FIQ involvement */ -+ if (st->nrpackets == 1) { -+ st->fsm = FIQ_PER_ISO_OUT_LAST; -+ } else { -+ st->fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ } -+ } else { -+ st->fsm = FIQ_PER_ISO_OUT_PENDING; -+ } -+ } -+ break; -+ case UE_INTERRUPT: -+ if (fiq_fsm_mask & 0x8) { -+ st->fsm = FIQ_NP_SSPLIT_STARTED; -+ } else if (start_immediate) { -+ st->fsm = FIQ_PER_SSPLIT_STARTED; -+ } else { -+ st->fsm = FIQ_PER_SSPLIT_QUEUED; -+ } -+ default: -+ break; -+ } -+ if (start_immediate) { -+ /* Set the oddfrm bit as close as possible to actual queueing */ -+ frame = dwc_otg_hcd_get_frame_number(hcd); -+ st->expected_uframe = (frame + 1) & 0x3FFF; -+ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; -+ st->hcchar_copy.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ } -+ mb(); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ return 0; -+} -+ -+ -+/** -+ * This function selects transactions from the HCD transfer schedule and -+ * assigns them to available host channels. It is called from HCD interrupt -+ * handler functions. -+ * -+ * @param hcd The HCD state structure. -+ * -+ * @return The types of new transactions that were assigned to host channels. -+ */ -+dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) -+{ -+ dwc_list_link_t *qh_ptr; -+ dwc_otg_qh_t *qh; -+ int num_channels; -+ dwc_irqflags_t flags; -+ dwc_spinlock_t *channel_lock = hcd->channel_lock; -+ dwc_otg_transaction_type_e ret_val = DWC_OTG_TRANSACTION_NONE; -+ -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_per_scheduled = 0; -+ last_sel_trans_num_nonper_scheduled = 0; -+ last_sel_trans_num_avail_hc_at_start = hcd->available_host_channels; -+#endif /* DEBUG_HOST_CHANNELS */ -+ -+ /* Process entries in the periodic ready list. */ -+ qh_ptr = DWC_LIST_FIRST(&hcd->periodic_sched_ready); -+ -+ while (qh_ptr != &hcd->periodic_sched_ready && -+ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -+ -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ -+ if (microframe_schedule) { -+ // Make sure we leave one channel for non periodic transactions. -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ if (hcd->available_host_channels <= 1) { -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ break; -+ } -+ hcd->available_host_channels--; -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_per_scheduled++; -+#endif /* DEBUG_HOST_CHANNELS */ -+ } -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ assign_and_init_hc(hcd, qh); -+ -+ /* -+ * Move the QH from the periodic ready schedule to the -+ * periodic assigned schedule. -+ */ -+ qh_ptr = DWC_LIST_NEXT(qh_ptr); -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, -+ &qh->qh_list_entry); -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ } -+ -+ /* -+ * Process entries in the inactive portion of the non-periodic -+ * schedule. Some free host channels may not be used if they are -+ * reserved for periodic transfers. -+ */ -+ qh_ptr = hcd->non_periodic_sched_inactive.next; -+ num_channels = hcd->core_if->core_params->host_channels; -+ while (qh_ptr != &hcd->non_periodic_sched_inactive && -+ (microframe_schedule || hcd->non_periodic_channels < -+ num_channels - hcd->periodic_channels) && -+ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -+ -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ /* -+ * Check to see if this is a NAK'd retransmit, in which case ignore for retransmission -+ * we hold off on bulk retransmissions to reduce NAK interrupt overhead for full-speed -+ * cheeky devices that just hold off using NAKs -+ */ -+ if (fiq_enable && nak_holdoff && qh->do_split) { -+ if (qh->nak_frame != 0xffff) { -+ uint16_t next_frame = dwc_frame_num_inc(qh->nak_frame, (qh->ep_type == UE_BULK) ? nak_holdoff : 8); -+ uint16_t frame = dwc_otg_hcd_get_frame_number(hcd); -+ if (dwc_frame_num_le(frame, next_frame)) { -+ if(dwc_frame_num_le(next_frame, hcd->fiq_state->next_sched_frame)) { -+ hcd->fiq_state->next_sched_frame = next_frame; -+ } -+ qh_ptr = DWC_LIST_NEXT(qh_ptr); -+ continue; -+ } else { -+ qh->nak_frame = 0xFFFF; -+ } -+ } -+ } -+ -+ if (microframe_schedule) { -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ if (hcd->available_host_channels < 1) { -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ break; -+ } -+ hcd->available_host_channels--; -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_nonper_scheduled++; -+#endif /* DEBUG_HOST_CHANNELS */ -+ } -+ -+ assign_and_init_hc(hcd, qh); -+ -+ /* -+ * Move the QH from the non-periodic inactive schedule to the -+ * non-periodic active schedule. -+ */ -+ qh_ptr = DWC_LIST_NEXT(qh_ptr); -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ DWC_LIST_MOVE_HEAD(&hcd->non_periodic_sched_active, -+ &qh->qh_list_entry); -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ -+ -+ if (!microframe_schedule) -+ hcd->non_periodic_channels++; -+ } -+ /* we moved a non-periodic QH to the active schedule. If the inactive queue is empty, -+ * stop the FIQ from kicking us. We could potentially still have elements here if we -+ * ran out of host channels. -+ */ -+ if (fiq_enable) { -+ if (DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) { -+ hcd->fiq_state->kick_np_queues = 0; -+ } else { -+ /* For each entry remaining in the NP inactive queue, -+ * if this a NAK'd retransmit then don't set the kick flag. -+ */ -+ if(nak_holdoff) { -+ DWC_LIST_FOREACH(qh_ptr, &hcd->non_periodic_sched_inactive) { -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ if (qh->nak_frame == 0xFFFF) { -+ hcd->fiq_state->kick_np_queues = 1; -+ } -+ } -+ } -+ } -+ } -+ if(!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) -+ ret_val |= DWC_OTG_TRANSACTION_PERIODIC; -+ -+ if(!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) -+ ret_val |= DWC_OTG_TRANSACTION_NON_PERIODIC; -+ -+ -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_avail_hc_at_end = hcd->available_host_channels; -+#endif /* DEBUG_HOST_CHANNELS */ -+ return ret_val; -+} -+ -+/** -+ * Attempts to queue a single transaction request for a host channel -+ * associated with either a periodic or non-periodic transfer. This function -+ * assumes that there is space available in the appropriate request queue. For -+ * an OUT transfer or SETUP transaction in Slave mode, it checks whether space -+ * is available in the appropriate Tx FIFO. -+ * -+ * @param hcd The HCD state structure. -+ * @param hc Host channel descriptor associated with either a periodic or -+ * non-periodic transfer. -+ * @param fifo_dwords_avail Number of DWORDs available in the periodic Tx -+ * FIFO for periodic transfers or the non-periodic Tx FIFO for non-periodic -+ * transfers. -+ * -+ * @return 1 if a request is queued and more requests may be needed to -+ * complete the transfer, 0 if no more requests are required for this -+ * transfer, -1 if there is insufficient space in the Tx FIFO. -+ */ -+static int queue_transaction(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, uint16_t fifo_dwords_avail) -+{ -+ int retval; -+ -+ if (hcd->core_if->dma_enable) { -+ if (hcd->core_if->dma_desc_enable) { -+ if (!hc->xfer_started -+ || (hc->ep_type == DWC_OTG_EP_TYPE_ISOC)) { -+ dwc_otg_hcd_start_xfer_ddma(hcd, hc->qh); -+ hc->qh->ping_state = 0; -+ } -+ } else if (!hc->xfer_started) { -+ if (fiq_fsm_enable && hc->error_state) { -+ hcd->fiq_state->channel[hc->hc_num].nr_errors = -+ DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list)->error_count; -+ hcd->fiq_state->channel[hc->hc_num].fsm = -+ FIQ_PASSTHROUGH_ERRORSTATE; -+ } -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ hc->qh->ping_state = 0; -+ } -+ retval = 0; -+ } else if (hc->halt_pending) { -+ /* Don't queue a request if the channel has been halted. */ -+ retval = 0; -+ } else if (hc->halt_on_queue) { -+ dwc_otg_hc_halt(hcd->core_if, hc, hc->halt_status); -+ retval = 0; -+ } else if (hc->do_ping) { -+ if (!hc->xfer_started) { -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ } -+ retval = 0; -+ } else if (!hc->ep_is_in || hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { -+ if ((fifo_dwords_avail * 4) >= hc->max_packet) { -+ if (!hc->xfer_started) { -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ retval = 1; -+ } else { -+ retval = -+ dwc_otg_hc_continue_transfer(hcd->core_if, -+ hc); -+ } -+ } else { -+ retval = -1; -+ } -+ } else { -+ if (!hc->xfer_started) { -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ retval = 1; -+ } else { -+ retval = dwc_otg_hc_continue_transfer(hcd->core_if, hc); -+ } -+ } -+ -+ return retval; -+} -+ -+/** -+ * Processes periodic channels for the next frame and queues transactions for -+ * these channels to the DWC_otg controller. After queueing transactions, the -+ * Periodic Tx FIFO Empty interrupt is enabled if there are more transactions -+ * to queue as Periodic Tx FIFO or request queue space becomes available. -+ * Otherwise, the Periodic Tx FIFO Empty interrupt is disabled. -+ */ -+static void process_periodic_channels(dwc_otg_hcd_t * hcd) -+{ -+ hptxsts_data_t tx_status; -+ dwc_list_link_t *qh_ptr; -+ dwc_otg_qh_t *qh; -+ int status = 0; -+ int no_queue_space = 0; -+ int no_fifo_space = 0; -+ -+ dwc_otg_host_global_regs_t *host_regs; -+ host_regs = hcd->core_if->host_if->host_global_regs; -+ -+ DWC_DEBUGPL(DBG_HCDV, "Queue periodic transactions\n"); -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " P Tx Req Queue Space Avail (before queue): %d\n", -+ tx_status.b.ptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, " P Tx FIFO Space Avail (before queue): %d\n", -+ tx_status.b.ptxfspcavail); -+#endif -+ -+ qh_ptr = hcd->periodic_sched_assigned.next; -+ while (qh_ptr != &hcd->periodic_sched_assigned) { -+ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); -+ if (tx_status.b.ptxqspcavail == 0) { -+ no_queue_space = 1; -+ break; -+ } -+ -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ -+ // Do not send a split start transaction any later than frame .6 -+ // Note, we have to schedule a periodic in .5 to make it go in .6 -+ if(fiq_fsm_enable && qh->do_split && ((dwc_otg_hcd_get_frame_number(hcd) + 1) & 7) > 6) -+ { -+ qh_ptr = qh_ptr->next; -+ hcd->fiq_state->next_sched_frame = dwc_otg_hcd_get_frame_number(hcd) | 7; -+ continue; -+ } -+ -+ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { -+ if (qh->do_split) -+ fiq_fsm_queue_split_transaction(hcd, qh); -+ else -+ fiq_fsm_queue_isoc_transaction(hcd, qh); -+ } else { -+ -+ /* -+ * Set a flag if we're queueing high-bandwidth in slave mode. -+ * The flag prevents any halts to get into the request queue in -+ * the middle of multiple high-bandwidth packets getting queued. -+ */ -+ if (!hcd->core_if->dma_enable && qh->channel->multi_count > 1) { -+ hcd->core_if->queuing_high_bandwidth = 1; -+ } -+ status = queue_transaction(hcd, qh->channel, -+ tx_status.b.ptxfspcavail); -+ if (status < 0) { -+ no_fifo_space = 1; -+ break; -+ } -+ } -+ -+ /* -+ * In Slave mode, stay on the current transfer until there is -+ * nothing more to do or the high-bandwidth request count is -+ * reached. In DMA mode, only need to queue one request. The -+ * controller automatically handles multiple packets for -+ * high-bandwidth transfers. -+ */ -+ if (hcd->core_if->dma_enable || status == 0 || -+ qh->channel->requests == qh->channel->multi_count) { -+ qh_ptr = qh_ptr->next; -+ /* -+ * Move the QH from the periodic assigned schedule to -+ * the periodic queued schedule. -+ */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_queued, -+ &qh->qh_list_entry); -+ -+ /* done queuing high bandwidth */ -+ hcd->core_if->queuing_high_bandwidth = 0; -+ } -+ } -+ -+ if (!hcd->core_if->dma_enable) { -+ dwc_otg_core_global_regs_t *global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ global_regs = hcd->core_if->core_global_regs; -+ intr_mask.b.ptxfempty = 1; -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " P Tx Req Queue Space Avail (after queue): %d\n", -+ tx_status.b.ptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, -+ " P Tx FIFO Space Avail (after queue): %d\n", -+ tx_status.b.ptxfspcavail); -+#endif -+ if (!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned) || -+ no_queue_space || no_fifo_space) { -+ /* -+ * May need to queue more transactions as the request -+ * queue or Tx FIFO empties. Enable the periodic Tx -+ * FIFO empty interrupt. (Always use the half-empty -+ * level to ensure that new requests are loaded as -+ * soon as possible.) -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, -+ intr_mask.d32); -+ } else { -+ /* -+ * Disable the Tx FIFO empty interrupt since there are -+ * no more transactions that need to be queued right -+ * now. This function is called from interrupt -+ * handlers to queue more transactions as transfer -+ * states change. -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, -+ 0); -+ } -+ } -+} -+ -+/** -+ * Processes active non-periodic channels and queues transactions for these -+ * channels to the DWC_otg controller. After queueing transactions, the NP Tx -+ * FIFO Empty interrupt is enabled if there are more transactions to queue as -+ * NP Tx FIFO or request queue space becomes available. Otherwise, the NP Tx -+ * FIFO Empty interrupt is disabled. -+ */ -+static void process_non_periodic_channels(dwc_otg_hcd_t * hcd) -+{ -+ gnptxsts_data_t tx_status; -+ dwc_list_link_t *orig_qh_ptr; -+ dwc_otg_qh_t *qh; -+ int status; -+ int no_queue_space = 0; -+ int no_fifo_space = 0; -+ int more_to_do = 0; -+ -+ dwc_otg_core_global_regs_t *global_regs = -+ hcd->core_if->core_global_regs; -+ -+ DWC_DEBUGPL(DBG_HCDV, "Queue non-periodic transactions\n"); -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " NP Tx Req Queue Space Avail (before queue): %d\n", -+ tx_status.b.nptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, " NP Tx FIFO Space Avail (before queue): %d\n", -+ tx_status.b.nptxfspcavail); -+#endif -+ /* -+ * Keep track of the starting point. Skip over the start-of-list -+ * entry. -+ */ -+ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { -+ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; -+ } -+ orig_qh_ptr = hcd->non_periodic_qh_ptr; -+ -+ /* -+ * Process once through the active list or until no more space is -+ * available in the request queue or the Tx FIFO. -+ */ -+ do { -+ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ if (!hcd->core_if->dma_enable && tx_status.b.nptxqspcavail == 0) { -+ no_queue_space = 1; -+ break; -+ } -+ -+ qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, -+ qh_list_entry); -+ -+ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { -+ fiq_fsm_queue_split_transaction(hcd, qh); -+ } else { -+ status = queue_transaction(hcd, qh->channel, -+ tx_status.b.nptxfspcavail); -+ -+ if (status > 0) { -+ more_to_do = 1; -+ } else if (status < 0) { -+ no_fifo_space = 1; -+ break; -+ } -+ } -+ /* Advance to next QH, skipping start-of-list entry. */ -+ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; -+ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { -+ hcd->non_periodic_qh_ptr = -+ hcd->non_periodic_qh_ptr->next; -+ } -+ -+ } while (hcd->non_periodic_qh_ptr != orig_qh_ptr); -+ -+ if (!hcd->core_if->dma_enable) { -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ intr_mask.b.nptxfempty = 1; -+ -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " NP Tx Req Queue Space Avail (after queue): %d\n", -+ tx_status.b.nptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, -+ " NP Tx FIFO Space Avail (after queue): %d\n", -+ tx_status.b.nptxfspcavail); -+#endif -+ if (more_to_do || no_queue_space || no_fifo_space) { -+ /* -+ * May need to queue more transactions as the request -+ * queue or Tx FIFO empties. Enable the non-periodic -+ * Tx FIFO empty interrupt. (Always use the half-empty -+ * level to ensure that new requests are loaded as -+ * soon as possible.) -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, -+ intr_mask.d32); -+ } else { -+ /* -+ * Disable the Tx FIFO empty interrupt since there are -+ * no more transactions that need to be queued right -+ * now. This function is called from interrupt -+ * handlers to queue more transactions as transfer -+ * states change. -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, -+ 0); -+ } -+ } -+} -+ -+/** -+ * This function processes the currently active host channels and queues -+ * transactions for these channels to the DWC_otg controller. It is called -+ * from HCD interrupt handler functions. -+ * -+ * @param hcd The HCD state structure. -+ * @param tr_type The type(s) of transactions to queue (non-periodic, -+ * periodic, or both). -+ */ -+void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, -+ dwc_otg_transaction_type_e tr_type) -+{ -+#ifdef DEBUG_SOF -+ DWC_DEBUGPL(DBG_HCD, "Queue Transactions\n"); -+#endif -+ /* Process host channels associated with periodic transfers. */ -+ if ((tr_type == DWC_OTG_TRANSACTION_PERIODIC || -+ tr_type == DWC_OTG_TRANSACTION_ALL) && -+ !DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) { -+ -+ process_periodic_channels(hcd); -+ } -+ -+ /* Process host channels associated with non-periodic transfers. */ -+ if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC || -+ tr_type == DWC_OTG_TRANSACTION_ALL) { -+ if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) { -+ process_non_periodic_channels(hcd); -+ } else { -+ /* -+ * Ensure NP Tx FIFO empty interrupt is disabled when -+ * there are no non-periodic transfers to process. -+ */ -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ gintmsk.b.nptxfempty = 1; -+ -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ } -+ } -+ } -+} -+ -+#ifdef DWC_HS_ELECT_TST -+/* -+ * Quick and dirty hack to implement the HS Electrical Test -+ * SINGLE_STEP_GET_DEVICE_DESCRIPTOR feature. -+ * -+ * This code was copied from our userspace app "hset". It sends a -+ * Get Device Descriptor control sequence in two parts, first the -+ * Setup packet by itself, followed some time later by the In and -+ * Ack packets. Rather than trying to figure out how to add this -+ * functionality to the normal driver code, we just hijack the -+ * hardware, using these two function to drive the hardware -+ * directly. -+ */ -+ -+static dwc_otg_core_global_regs_t *global_regs; -+static dwc_otg_host_global_regs_t *hc_global_regs; -+static dwc_otg_hc_regs_t *hc_regs; -+static uint32_t *data_fifo; -+ -+static void do_setup(void) -+{ -+ gintsts_data_t gintsts; -+ hctsiz_data_t hctsiz; -+ hcchar_data_t hcchar; -+ haint_data_t haint; -+ hcint_data_t hcint; -+ -+ /* Enable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); -+ -+ /* Enable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* -+ * Send Setup packet (Get Device Descriptor) -+ */ -+ -+ /* Make sure channel is disabled */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chdis = 1; -+// hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ //sleep(1); -+ dwc_mdelay(1000); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ } -+ -+ /* Set HCTSIZ */ -+ hctsiz.d32 = 0; -+ hctsiz.b.xfersize = 8; -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.pid = DWC_OTG_HC_PID_SETUP; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ /* Set HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.epdir = 0; -+ hcchar.b.epnum = 0; -+ hcchar.b.mps = 8; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ /* Fill FIFO with Setup data for Get Device Descriptor */ -+ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); -+ DWC_WRITE_REG32(data_fifo++, 0x01000680); -+ DWC_WRITE_REG32(data_fifo++, 0x00080000); -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for host channel interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.hcintr == 0); -+ -+ /* Disable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); -+ -+ /* Disable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+} -+ -+static void do_in_ack(void) -+{ -+ gintsts_data_t gintsts; -+ hctsiz_data_t hctsiz; -+ hcchar_data_t hcchar; -+ haint_data_t haint; -+ hcint_data_t hcint; -+ host_grxsts_data_t grxsts; -+ -+ /* Enable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); -+ -+ /* Enable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* -+ * Receive Control In packet -+ */ -+ -+ /* Make sure channel is disabled */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chdis = 1; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ //sleep(1); -+ dwc_mdelay(1000); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ } -+ -+ /* Set HCTSIZ */ -+ hctsiz.d32 = 0; -+ hctsiz.b.xfersize = 8; -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ /* Set HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.epdir = 1; -+ hcchar.b.epnum = 0; -+ hcchar.b.mps = 8; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for receive status queue interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.rxstsqlvl == 0); -+ -+ /* Read RXSTS */ -+ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); -+ -+ /* Clear RXSTSQLVL in GINTSTS */ -+ gintsts.d32 = 0; -+ gintsts.b.rxstsqlvl = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ switch (grxsts.b.pktsts) { -+ case DWC_GRXSTS_PKTSTS_IN: -+ /* Read the data into the host buffer */ -+ if (grxsts.b.bcnt > 0) { -+ int i; -+ int word_count = (grxsts.b.bcnt + 3) / 4; -+ -+ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); -+ -+ for (i = 0; i < word_count; i++) { -+ (void)DWC_READ_REG32(data_fifo++); -+ } -+ } -+ break; -+ -+ default: -+ break; -+ } -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for receive status queue interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.rxstsqlvl == 0); -+ -+ /* Read RXSTS */ -+ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); -+ -+ /* Clear RXSTSQLVL in GINTSTS */ -+ gintsts.d32 = 0; -+ gintsts.b.rxstsqlvl = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ switch (grxsts.b.pktsts) { -+ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: -+ break; -+ -+ default: -+ break; -+ } -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for host channel interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.hcintr == 0); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+// usleep(100000); -+// mdelay(100); -+ dwc_mdelay(1); -+ -+ /* -+ * Send handshake packet -+ */ -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Make sure channel is disabled */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chdis = 1; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ //sleep(1); -+ dwc_mdelay(1000); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ } -+ -+ /* Set HCTSIZ */ -+ hctsiz.d32 = 0; -+ hctsiz.b.xfersize = 0; -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ /* Set HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.epdir = 0; -+ hcchar.b.epnum = 0; -+ hcchar.b.mps = 8; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for host channel interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.hcintr == 0); -+ -+ /* Disable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); -+ -+ /* Disable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+} -+#endif -+ -+/** Handles hub class-specific requests. */ -+int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint16_t typeReq, -+ uint16_t wValue, -+ uint16_t wIndex, uint8_t * buf, uint16_t wLength) -+{ -+ int retval = 0; -+ -+ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; -+ usb_hub_descriptor_t *hub_desc; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ -+ uint32_t port_status; -+ -+ switch (typeReq) { -+ case UCR_CLEAR_HUB_FEATURE: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearHubFeature 0x%x\n", wValue); -+ switch (wValue) { -+ case UHF_C_HUB_LOCAL_POWER: -+ case UHF_C_HUB_OVER_CURRENT: -+ /* Nothing required here */ -+ break; -+ default: -+ retval = -DWC_E_INVALID; -+ DWC_ERROR("DWC OTG HCD - " -+ "ClearHubFeature request %xh unknown\n", -+ wValue); -+ } -+ break; -+ case UCR_CLEAR_PORT_FEATURE: -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (wValue != UHF_PORT_L1) -+#endif -+ if (!wIndex || wIndex > 1) -+ goto error; -+ -+ switch (wValue) { -+ case UHF_PORT_ENABLE: -+ DWC_DEBUGPL(DBG_ANY, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_ENABLE\n"); -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtena = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ break; -+ case UHF_PORT_SUSPEND: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); -+ -+ if (core_if->power_down == 2) { -+ dwc_otg_host_hibernation_restore(core_if, 0, 0); -+ } else { -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ dwc_mdelay(5); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtres = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ hprt0.b.prtsusp = 0; -+ /* Clear Resume bit */ -+ dwc_mdelay(100); -+ hprt0.b.prtres = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ break; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ case UHF_PORT_L1: -+ { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ glpmcfg_data_t lpmcfg = {.d32 = 0 }; -+ -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if-> -+ core_global_regs->glpmcfg); -+ lpmcfg.b.en_utmi_sleep = 0; -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ lpmcfg.b.prt_sleep_sts = 1; -+ DWC_WRITE_REG32(&core_if-> -+ core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ -+ /* Clear Enbl_L1Gating bit. */ -+ pcgcctl.b.enbl_sleep_gating = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, -+ 0); -+ -+ dwc_mdelay(5); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtres = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+ /* This bit will be cleared in wakeup interrupt handle */ -+ break; -+ } -+#endif -+ case UHF_PORT_POWER: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_POWER\n"); -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ break; -+ case UHF_PORT_INDICATOR: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_INDICATOR\n"); -+ /* Port inidicator not supported */ -+ break; -+ case UHF_C_PORT_CONNECTION: -+ /* Clears drivers internal connect status change -+ * flag */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_CONNECTION\n"); -+ dwc_otg_hcd->flags.b.port_connect_status_change = 0; -+ break; -+ case UHF_C_PORT_RESET: -+ /* Clears the driver's internal Port Reset Change -+ * flag */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_RESET\n"); -+ dwc_otg_hcd->flags.b.port_reset_change = 0; -+ break; -+ case UHF_C_PORT_ENABLE: -+ /* Clears the driver's internal Port -+ * Enable/Disable Change flag */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_ENABLE\n"); -+ dwc_otg_hcd->flags.b.port_enable_change = 0; -+ break; -+ case UHF_C_PORT_SUSPEND: -+ /* Clears the driver's internal Port Suspend -+ * Change flag, which is set when resume signaling on -+ * the host port is complete */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_SUSPEND\n"); -+ dwc_otg_hcd->flags.b.port_suspend_change = 0; -+ break; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ case UHF_C_PORT_L1: -+ dwc_otg_hcd->flags.b.port_l1_change = 0; -+ break; -+#endif -+ case UHF_C_PORT_OVER_CURRENT: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_OVER_CURRENT\n"); -+ dwc_otg_hcd->flags.b.port_over_current_change = 0; -+ break; -+ default: -+ retval = -DWC_E_INVALID; -+ DWC_ERROR("DWC OTG HCD - " -+ "ClearPortFeature request %xh " -+ "unknown or unsupported\n", wValue); -+ } -+ break; -+ case UCR_GET_HUB_DESCRIPTOR: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "GetHubDescriptor\n"); -+ hub_desc = (usb_hub_descriptor_t *) buf; -+ hub_desc->bDescLength = 9; -+ hub_desc->bDescriptorType = 0x29; -+ hub_desc->bNbrPorts = 1; -+ USETW(hub_desc->wHubCharacteristics, 0x08); -+ hub_desc->bPwrOn2PwrGood = 1; -+ hub_desc->bHubContrCurrent = 0; -+ hub_desc->DeviceRemovable[0] = 0; -+ hub_desc->DeviceRemovable[1] = 0xff; -+ break; -+ case UCR_GET_HUB_STATUS: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "GetHubStatus\n"); -+ DWC_MEMSET(buf, 0, 4); -+ break; -+ case UCR_GET_PORT_STATUS: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "GetPortStatus wIndex = 0x%04x FLAGS=0x%08x\n", -+ wIndex, dwc_otg_hcd->flags.d32); -+ if (!wIndex || wIndex > 1) -+ goto error; -+ -+ port_status = 0; -+ -+ if (dwc_otg_hcd->flags.b.port_connect_status_change) -+ port_status |= (1 << UHF_C_PORT_CONNECTION); -+ -+ if (dwc_otg_hcd->flags.b.port_enable_change) -+ port_status |= (1 << UHF_C_PORT_ENABLE); -+ -+ if (dwc_otg_hcd->flags.b.port_suspend_change) -+ port_status |= (1 << UHF_C_PORT_SUSPEND); -+ -+ if (dwc_otg_hcd->flags.b.port_l1_change) -+ port_status |= (1 << UHF_C_PORT_L1); -+ -+ if (dwc_otg_hcd->flags.b.port_reset_change) { -+ port_status |= (1 << UHF_C_PORT_RESET); -+ } -+ -+ if (dwc_otg_hcd->flags.b.port_over_current_change) { -+ DWC_WARN("Overcurrent change detected\n"); -+ port_status |= (1 << UHF_C_PORT_OVER_CURRENT); -+ } -+ -+ if (!dwc_otg_hcd->flags.b.port_connect_status) { -+ /* -+ * The port is disconnected, which means the core is -+ * either in device mode or it soon will be. Just -+ * return 0's for the remainder of the port status -+ * since the port register can't be read if the core -+ * is in device mode. -+ */ -+ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); -+ break; -+ } -+ -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ DWC_DEBUGPL(DBG_HCDV, " HPRT0: 0x%08x\n", hprt0.d32); -+ -+ if (hprt0.b.prtconnsts) -+ port_status |= (1 << UHF_PORT_CONNECTION); -+ -+ if (hprt0.b.prtena) -+ port_status |= (1 << UHF_PORT_ENABLE); -+ -+ if (hprt0.b.prtsusp) -+ port_status |= (1 << UHF_PORT_SUSPEND); -+ -+ if (hprt0.b.prtovrcurract) -+ port_status |= (1 << UHF_PORT_OVER_CURRENT); -+ -+ if (hprt0.b.prtrst) -+ port_status |= (1 << UHF_PORT_RESET); -+ -+ if (hprt0.b.prtpwr) -+ port_status |= (1 << UHF_PORT_POWER); -+ -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) -+ port_status |= (1 << UHF_PORT_HIGH_SPEED); -+ else if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED) -+ port_status |= (1 << UHF_PORT_LOW_SPEED); -+ -+ if (hprt0.b.prttstctl) -+ port_status |= (1 << UHF_PORT_TEST); -+ if (dwc_otg_get_lpm_portsleepstatus(dwc_otg_hcd->core_if)) { -+ port_status |= (1 << UHF_PORT_L1); -+ } -+ /* -+ For Synopsys HW emulation of Power down wkup_control asserts the -+ hreset_n and prst_n on suspned. This causes the HPRT0 to be zero. -+ We intentionally tell the software that port is in L2Suspend state. -+ Only for STE. -+ */ -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ port_status |= (1 << UHF_PORT_SUSPEND); -+ } -+ /* USB_PORT_FEAT_INDICATOR unsupported always 0 */ -+ -+ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); -+ -+ break; -+ case UCR_SET_HUB_FEATURE: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetHubFeature\n"); -+ /* No HUB features supported */ -+ break; -+ case UCR_SET_PORT_FEATURE: -+ if (wValue != UHF_PORT_TEST && (!wIndex || wIndex > 1)) -+ goto error; -+ -+ if (!dwc_otg_hcd->flags.b.port_connect_status) { -+ /* -+ * The port is disconnected, which means the core is -+ * either in device mode or it soon will be. Just -+ * return without doing anything since the port -+ * register can't be written if the core is in device -+ * mode. -+ */ -+ break; -+ } -+ -+ switch (wValue) { -+ case UHF_PORT_SUSPEND: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); -+ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) != wIndex) { -+ goto error; -+ } -+ if (core_if->power_down == 2) { -+ int timeout = 300; -+ dwc_irqflags_t flags; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+#ifdef DWC_DEV_SRPCAP -+ int32_t otg_cap_param = core_if->core_params->otg_cap; -+#endif -+ DWC_PRINTF("Preparing for complete power-off\n"); -+ -+ /* Save registers before hibernation */ -+ dwc_otg_save_global_regs(core_if); -+ dwc_otg_save_host_regs(core_if); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 1; -+ hprt0.b.prtena = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ /* Spin hprt0.b.prtsusp to became 1 */ -+ do { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ if (hprt0.b.prtsusp) { -+ break; -+ } -+ dwc_mdelay(1); -+ } while (--timeout); -+ if (!timeout) { -+ DWC_WARN("Suspend wasn't genereted\n"); -+ } -+ dwc_udelay(10); -+ -+ /* -+ * We need to disable interrupts to prevent servicing of any IRQ -+ * during going to hibernation -+ */ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ core_if->lx_state = DWC_OTG_L2; -+#ifdef DWC_DEV_SRPCAP -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 0; -+ hprt0.b.prtena = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+#endif -+ gusbcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs-> -+ gusbcfg); -+ if (gusbcfg.b.ulpi_utmi_sel == 1) { -+ /* ULPI interface */ -+ /* Suspend the Phy Clock */ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } else { -+ /* UTMI+ Interface */ -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ dwc_udelay(10); -+ } -+#ifdef DWC_DEV_SRPCAP -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+#endif -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ gpwrdn.d32 = 0; -+#ifdef DWC_DEV_SRPCAP -+ gpwrdn.b.srp_det_msk = 1; -+#endif -+ gpwrdn.b.disconn_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ gpwrdn.b.sts_chngint_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Enable Power Down Clamp and all interrupts in GPWRDN */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Switch off VDD */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+#ifdef DWC_DEV_SRPCAP -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) -+ { -+ core_if->pwron_timer_started = 1; -+ DWC_TIMER_SCHEDULE(core_if->pwron_timer, 6000 /* 6 secs */ ); -+ } -+#endif -+ /* Save gpwrdn register for further usage if stschng interrupt */ -+ core_if->gr_backup->gpwrdn_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ /* Set flag to indicate that we are in hibernation */ -+ core_if->hibernation_suspend = 1; -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock,flags); -+ -+ DWC_PRINTF("Host hibernation completed\n"); -+ // Exit from case statement -+ break; -+ -+ } -+ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) == wIndex && -+ dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gotgctl.b.hstsethnpen = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gotgctl, 0, gotgctl.d32); -+ core_if->op_state = A_SUSPEND; -+ } -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ { -+ dwc_irqflags_t flags; -+ /* Update lx_state */ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ core_if->lx_state = DWC_OTG_L2; -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+ } -+ /* Suspend the Phy Clock */ -+ { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ } -+ -+ /* For HNP the bus must be suspended for at least 200ms. */ -+ if (dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ dwc_mdelay(200); -+ } -+ -+ /** @todo - check how sw can wait for 1 sec to check asesvld??? */ -+#if 0 //vahrama !!!!!!!!!!!!!!!!!! -+ if (core_if->adp_enable) { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn; -+ -+ while (gotgctl.b.asesvld == 1) { -+ gotgctl.d32 = -+ DWC_READ_REG32(&core_if-> -+ core_global_regs-> -+ gotgctl); -+ dwc_mdelay(100); -+ } -+ -+ /* Enable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ /* Unmask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ dwc_otg_adp_probe_start(core_if); -+ } -+#endif -+ break; -+ case UHF_PORT_POWER: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_POWER\n"); -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ break; -+ case UHF_PORT_RESET: -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ /* If we are going to exit from Hibernated -+ * state via USB RESET. -+ */ -+ dwc_otg_host_hibernation_restore(core_if, 0, 1); -+ } else { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ -+ DWC_DEBUGPL(DBG_HCD, -+ "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_RESET\n"); -+ { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ pcgcctl.b.enbl_sleep_gating = 1; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ } -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ { -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.prt_sleep_sts) { -+ lpmcfg.b.en_utmi_sleep = 0; -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ DWC_WRITE_REG32 -+ (&core_if->core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ dwc_mdelay(1); -+ } -+ } -+#endif -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ /* Clear suspend bit if resetting from suspended state. */ -+ hprt0.b.prtsusp = 0; -+ /* When B-Host the Port reset bit is set in -+ * the Start HCD Callback function, so that -+ * the reset is started within 1ms of the HNP -+ * success interrupt. */ -+ if (!dwc_otg_hcd_is_b_host(dwc_otg_hcd)) { -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtrst = 1; -+ DWC_PRINTF("Indeed it is in host mode hprt0 = %08x\n",hprt0.d32); -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+ } -+ /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */ -+ dwc_mdelay(60); -+ hprt0.b.prtrst = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ core_if->lx_state = DWC_OTG_L0; /* Now back to the on state */ -+ } -+ break; -+#ifdef DWC_HS_ELECT_TST -+ case UHF_PORT_TEST: -+ { -+ uint32_t t; -+ gintmsk_data_t gintmsk; -+ -+ t = (wIndex >> 8); /* MSB wIndex USB */ -+ DWC_DEBUGPL(DBG_HCD, -+ "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_TEST %d\n", -+ t); -+ DWC_WARN("USB_PORT_FEAT_TEST %d\n", t); -+ if (t < 6) { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prttstctl = t; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+ } else { -+ /* Setup global vars with reg addresses (quick and -+ * dirty hack, should be cleaned up) -+ */ -+ global_regs = core_if->core_global_regs; -+ hc_global_regs = -+ core_if->host_if->host_global_regs; -+ hc_regs = -+ (dwc_otg_hc_regs_t *) ((char *) -+ global_regs + -+ 0x500); -+ data_fifo = -+ (uint32_t *) ((char *)global_regs + -+ 0x1000); -+ -+ if (t == 6) { /* HS_HOST_PORT_SUSPEND_RESUME */ -+ /* Save current interrupt mask */ -+ gintmsk.d32 = -+ DWC_READ_REG32 -+ (&global_regs->gintmsk); -+ -+ /* Disable all interrupts while we muck with -+ * the hardware directly -+ */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* 15 second delay per the test spec */ -+ dwc_mdelay(15000); -+ -+ /* Drive suspend on the root port */ -+ hprt0.d32 = -+ dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 1; -+ hprt0.b.prtres = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* 15 second delay per the test spec */ -+ dwc_mdelay(15000); -+ -+ /* Drive resume on the root port */ -+ hprt0.d32 = -+ dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 0; -+ hprt0.b.prtres = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ dwc_mdelay(100); -+ -+ /* Clear the resume bit */ -+ hprt0.b.prtres = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Restore interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); -+ } else if (t == 7) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ -+ /* Save current interrupt mask */ -+ gintmsk.d32 = -+ DWC_READ_REG32 -+ (&global_regs->gintmsk); -+ -+ /* Disable all interrupts while we muck with -+ * the hardware directly -+ */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* 15 second delay per the test spec */ -+ dwc_mdelay(15000); -+ -+ /* Send the Setup packet */ -+ do_setup(); -+ -+ /* 15 second delay so nothing else happens for awhile */ -+ dwc_mdelay(15000); -+ -+ /* Restore interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); -+ } else if (t == 8) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ -+ /* Save current interrupt mask */ -+ gintmsk.d32 = -+ DWC_READ_REG32 -+ (&global_regs->gintmsk); -+ -+ /* Disable all interrupts while we muck with -+ * the hardware directly -+ */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* Send the Setup packet */ -+ do_setup(); -+ -+ /* 15 second delay so nothing else happens for awhile */ -+ dwc_mdelay(15000); -+ -+ /* Send the In and Ack packets */ -+ do_in_ack(); -+ -+ /* 15 second delay so nothing else happens for awhile */ -+ dwc_mdelay(15000); -+ -+ /* Restore interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); -+ } -+ } -+ break; -+ } -+#endif /* DWC_HS_ELECT_TST */ -+ -+ case UHF_PORT_INDICATOR: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_INDICATOR\n"); -+ /* Not supported */ -+ break; -+ default: -+ retval = -DWC_E_INVALID; -+ DWC_ERROR("DWC OTG HCD - " -+ "SetPortFeature request %xh " -+ "unknown or unsupported\n", wValue); -+ break; -+ } -+ break; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ case UCR_SET_AND_TEST_PORT_FEATURE: -+ if (wValue != UHF_PORT_L1) { -+ goto error; -+ } -+ { -+ int portnum, hird, devaddr, remwake; -+ glpmcfg_data_t lpmcfg; -+ uint32_t time_usecs; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk; -+ -+ if (!dwc_otg_get_param_lpm_enable(core_if)) { -+ goto error; -+ } -+ if (wValue != UHF_PORT_L1 || wLength != 1) { -+ goto error; -+ } -+ /* Check if the port currently is in SLEEP state */ -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.prt_sleep_sts) { -+ DWC_INFO("Port is already in sleep mode\n"); -+ buf[0] = 0; /* Return success */ -+ break; -+ } -+ -+ portnum = wIndex & 0xf; -+ hird = (wIndex >> 4) & 0xf; -+ devaddr = (wIndex >> 8) & 0x7f; -+ remwake = (wIndex >> 15); -+ -+ if (portnum != 1) { -+ retval = -DWC_E_INVALID; -+ DWC_WARN -+ ("Wrong port number(%d) in SetandTestPortFeature request\n", -+ portnum); -+ break; -+ } -+ -+ DWC_PRINTF -+ ("SetandTestPortFeature request: portnum = %d, hird = %d, devaddr = %d, rewake = %d\n", -+ portnum, hird, devaddr, remwake); -+ /* Disable LPM interrupt */ -+ gintmsk.d32 = 0; -+ gintmsk.b.lpmtranrcvd = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ gintmsk.d32, 0); -+ -+ if (dwc_otg_hcd_send_lpm -+ (dwc_otg_hcd, devaddr, hird, remwake)) { -+ retval = -DWC_E_INVALID; -+ break; -+ } -+ -+ time_usecs = 10 * (lpmcfg.b.retry_count + 1); -+ /* We will consider timeout if time_usecs microseconds pass, -+ * and we don't receive LPM transaction status. -+ * After receiving non-error responce(ACK/NYET/STALL) from device, -+ * core will set lpmtranrcvd bit. -+ */ -+ do { -+ gintsts.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (gintsts.b.lpmtranrcvd) { -+ break; -+ } -+ dwc_udelay(1); -+ } while (--time_usecs); -+ /* lpm_int bit will be cleared in LPM interrupt handler */ -+ -+ /* Now fill status -+ * 0x00 - Success -+ * 0x10 - NYET -+ * 0x11 - Timeout -+ */ -+ if (!gintsts.b.lpmtranrcvd) { -+ buf[0] = 0x3; /* Completion code is Timeout */ -+ dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd); -+ } else { -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.lpm_resp == 0x3) { -+ /* ACK responce from the device */ -+ buf[0] = 0x00; /* Success */ -+ } else if (lpmcfg.b.lpm_resp == 0x2) { -+ /* NYET responce from the device */ -+ buf[0] = 0x2; -+ } else { -+ /* Otherwise responce with Timeout */ -+ buf[0] = 0x3; -+ } -+ } -+ DWC_PRINTF("Device responce to LPM trans is %x\n", -+ lpmcfg.b.lpm_resp); -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, -+ gintmsk.d32); -+ -+ break; -+ } -+#endif /* CONFIG_USB_DWC_OTG_LPM */ -+ default: -+error: -+ retval = -DWC_E_INVALID; -+ DWC_WARN("DWC OTG HCD - " -+ "Unknown hub control request type or invalid typeReq: %xh wIndex: %xh wValue: %xh\n", -+ typeReq, wIndex, wValue); -+ break; -+ } -+ -+ return retval; -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** Returns index of host channel to perform LPM transaction. */ -+int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, uint8_t devaddr) -+{ -+ dwc_otg_core_if_t *core_if = hcd->core_if; -+ dwc_hc_t *hc; -+ hcchar_data_t hcchar; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ if (DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -+ DWC_PRINTF("No free channel to select for LPM transaction\n"); -+ return -1; -+ } -+ -+ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); -+ -+ /* Mask host channel interrupts. */ -+ gintmsk.b.hcintr = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ -+ /* Fill fields that core needs for LPM transaction */ -+ hcchar.b.devaddr = devaddr; -+ hcchar.b.epnum = 0; -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.mps = 64; -+ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); -+ hcchar.b.epdir = 0; /* OUT */ -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[hc->hc_num]->hcchar, -+ hcchar.d32); -+ -+ /* Remove the host channel from the free list. */ -+ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); -+ -+ DWC_PRINTF("hcnum = %d devaddr = %d\n", hc->hc_num, devaddr); -+ -+ return hc->hc_num; -+} -+ -+/** Release hc after performing LPM transaction */ -+void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd) -+{ -+ dwc_hc_t *hc; -+ glpmcfg_data_t lpmcfg; -+ uint8_t hc_num; -+ -+ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); -+ hc_num = lpmcfg.b.lpm_chan_index; -+ -+ hc = hcd->hc_ptr_array[hc_num]; -+ -+ DWC_PRINTF("Freeing channel %d after LPM\n", hc_num); -+ /* Return host channel to free list */ -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); -+} -+ -+int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, uint8_t hird, -+ uint8_t bRemoteWake) -+{ -+ glpmcfg_data_t lpmcfg; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ int channel; -+ -+ channel = dwc_otg_hcd_get_hc_for_lpm_tran(hcd, devaddr); -+ if (channel < 0) { -+ return channel; -+ } -+ -+ pcgcctl.b.enbl_sleep_gating = 1; -+ DWC_MODIFY_REG32(hcd->core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ /* Read LPM config register */ -+ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); -+ -+ /* Program LPM transaction fields */ -+ lpmcfg.b.rem_wkup_en = bRemoteWake; -+ lpmcfg.b.hird = hird; -+ lpmcfg.b.hird_thres = 0x1c; -+ lpmcfg.b.lpm_chan_index = channel; -+ lpmcfg.b.en_utmi_sleep = 1; -+ /* Program LPM config register */ -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+ -+ /* Send LPM transaction */ -+ lpmcfg.b.send_lpm = 1; -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+ -+ return 0; -+} -+ -+#endif /* CONFIG_USB_DWC_OTG_LPM */ -+ -+int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port) -+{ -+ int retval; -+ -+ if (port != 1) { -+ return -DWC_E_INVALID; -+ } -+ -+ retval = (hcd->flags.b.port_connect_status_change || -+ hcd->flags.b.port_reset_change || -+ hcd->flags.b.port_enable_change || -+ hcd->flags.b.port_suspend_change || -+ hcd->flags.b.port_over_current_change); -+#ifdef DEBUG -+ if (retval) { -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB STATUS DATA:" -+ " Root port status changed\n"); -+ DWC_DEBUGPL(DBG_HCDV, " port_connect_status_change: %d\n", -+ hcd->flags.b.port_connect_status_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_reset_change: %d\n", -+ hcd->flags.b.port_reset_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_enable_change: %d\n", -+ hcd->flags.b.port_enable_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_suspend_change: %d\n", -+ hcd->flags.b.port_suspend_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_over_current_change: %d\n", -+ hcd->flags.b.port_over_current_change); -+ } -+#endif -+ return retval; -+} -+ -+int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ hfnum_data_t hfnum; -+ hfnum.d32 = -+ DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs-> -+ hfnum); -+ -+#ifdef DEBUG_SOF -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD GET FRAME NUMBER %d\n", -+ hfnum.b.frnum); -+#endif -+ return hfnum.b.frnum; -+} -+ -+int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, -+ struct dwc_otg_hcd_function_ops *fops) -+{ -+ int retval = 0; -+ -+ hcd->fops = fops; -+ if (!dwc_otg_is_device_mode(hcd->core_if) && -+ (!hcd->core_if->adp_enable || hcd->core_if->adp.adp_started)) { -+ dwc_otg_hcd_reinit(hcd); -+ } else { -+ retval = -DWC_E_NO_DEVICE; -+ } -+ -+ return retval; -+} -+ -+void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd) -+{ -+ return hcd->priv; -+} -+ -+void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data) -+{ -+ hcd->priv = priv_data; -+} -+ -+uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd) -+{ -+ return hcd->otg_port; -+} -+ -+uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd) -+{ -+ uint32_t is_b_host; -+ if (hcd->core_if->op_state == B_HOST) { -+ is_b_host = 1; -+ } else { -+ is_b_host = 0; -+ } -+ -+ return is_b_host; -+} -+ -+dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, -+ int iso_desc_count, int atomic_alloc) -+{ -+ dwc_otg_hcd_urb_t *dwc_otg_urb; -+ uint32_t size; -+ -+ size = -+ sizeof(*dwc_otg_urb) + -+ iso_desc_count * sizeof(struct dwc_otg_hcd_iso_packet_desc); -+ if (atomic_alloc) -+ dwc_otg_urb = DWC_ALLOC_ATOMIC(size); -+ else -+ dwc_otg_urb = DWC_ALLOC(size); -+ -+ if (dwc_otg_urb) -+ dwc_otg_urb->packet_count = iso_desc_count; -+ else { -+ DWC_ERROR("**** DWC OTG HCD URB alloc - " -+ "%salloc of %db failed\n", -+ atomic_alloc?"atomic ":"", size); -+ } -+ return dwc_otg_urb; -+} -+ -+void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ uint8_t dev_addr, uint8_t ep_num, -+ uint8_t ep_type, uint8_t ep_dir, uint16_t mps) -+{ -+ dwc_otg_hcd_fill_pipe(&dwc_otg_urb->pipe_info, dev_addr, ep_num, -+ ep_type, ep_dir, mps); -+#if 0 -+ DWC_PRINTF -+ ("addr = %d, ep_num = %d, ep_dir = 0x%x, ep_type = 0x%x, mps = %d\n", -+ dev_addr, ep_num, ep_dir, ep_type, mps); -+#endif -+} -+ -+void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ void *urb_handle, void *buf, dwc_dma_t dma, -+ uint32_t buflen, void *setup_packet, -+ dwc_dma_t setup_dma, uint32_t flags, -+ uint16_t interval) -+{ -+ dwc_otg_urb->priv = urb_handle; -+ dwc_otg_urb->buf = buf; -+ dwc_otg_urb->dma = dma; -+ dwc_otg_urb->length = buflen; -+ dwc_otg_urb->setup_packet = setup_packet; -+ dwc_otg_urb->setup_dma = setup_dma; -+ dwc_otg_urb->flags = flags; -+ dwc_otg_urb->interval = interval; -+ dwc_otg_urb->status = -DWC_E_IN_PROGRESS; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ return dwc_otg_urb->status; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ return dwc_otg_urb->actual_length; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ return dwc_otg_urb->error_count; -+} -+ -+void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int desc_num, uint32_t offset, -+ uint32_t length) -+{ -+ dwc_otg_urb->iso_descs[desc_num].offset = offset; -+ dwc_otg_urb->iso_descs[desc_num].length = length; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int desc_num) -+{ -+ return dwc_otg_urb->iso_descs[desc_num].status; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * -+ dwc_otg_urb, int desc_num) -+{ -+ return dwc_otg_urb->iso_descs[desc_num].actual_length; -+} -+ -+int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ int allocated = 0; -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ -+ if (qh) { -+ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ allocated = 1; -+ } -+ } -+ return allocated; -+} -+ -+int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ int freed = 0; -+ DWC_ASSERT(qh, "qh is not allocated\n"); -+ -+ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ freed = 1; -+ } -+ -+ return freed; -+} -+ -+uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ DWC_ASSERT(qh, "qh is not allocated\n"); -+ return qh->usecs; -+} -+ -+void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd) -+{ -+#ifdef DEBUG -+ int num_channels; -+ int i; -+ gnptxsts_data_t np_tx_status; -+ hptxsts_data_t p_tx_status; -+ -+ num_channels = hcd->core_if->core_params->host_channels; -+ DWC_PRINTF("\n"); -+ DWC_PRINTF -+ ("************************************************************\n"); -+ DWC_PRINTF("HCD State:\n"); -+ DWC_PRINTF(" Num channels: %d\n", num_channels); -+ for (i = 0; i < num_channels; i++) { -+ dwc_hc_t *hc = hcd->hc_ptr_array[i]; -+ DWC_PRINTF(" Channel %d:\n", i); -+ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", -+ hc->dev_addr, hc->ep_num, hc->ep_is_in); -+ DWC_PRINTF(" speed: %d\n", hc->speed); -+ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); -+ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); -+ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); -+ DWC_PRINTF(" multi_count: %d\n", hc->multi_count); -+ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); -+ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); -+ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); -+ DWC_PRINTF(" xfer_count: %d\n", hc->xfer_count); -+ DWC_PRINTF(" halt_on_queue: %d\n", hc->halt_on_queue); -+ DWC_PRINTF(" halt_pending: %d\n", hc->halt_pending); -+ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); -+ DWC_PRINTF(" do_split: %d\n", hc->do_split); -+ DWC_PRINTF(" complete_split: %d\n", hc->complete_split); -+ DWC_PRINTF(" hub_addr: %d\n", hc->hub_addr); -+ DWC_PRINTF(" port_addr: %d\n", hc->port_addr); -+ DWC_PRINTF(" xact_pos: %d\n", hc->xact_pos); -+ DWC_PRINTF(" requests: %d\n", hc->requests); -+ DWC_PRINTF(" qh: %p\n", hc->qh); -+ if (hc->xfer_started) { -+ hfnum_data_t hfnum; -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ hfnum.d32 = -+ DWC_READ_REG32(&hcd->core_if-> -+ host_if->host_global_regs->hfnum); -+ hcchar.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hcchar); -+ hctsiz.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hctsiz); -+ hcint.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hcint); -+ hcintmsk.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hcintmsk); -+ DWC_PRINTF(" hfnum: 0x%08x\n", hfnum.d32); -+ DWC_PRINTF(" hcchar: 0x%08x\n", hcchar.d32); -+ DWC_PRINTF(" hctsiz: 0x%08x\n", hctsiz.d32); -+ DWC_PRINTF(" hcint: 0x%08x\n", hcint.d32); -+ DWC_PRINTF(" hcintmsk: 0x%08x\n", hcintmsk.d32); -+ } -+ if (hc->xfer_started && hc->qh) { -+ dwc_otg_qtd_t *qtd; -+ dwc_otg_hcd_urb_t *urb; -+ -+ DWC_CIRCLEQ_FOREACH(qtd, &hc->qh->qtd_list, qtd_list_entry) { -+ if (!qtd->in_process) -+ break; -+ -+ urb = qtd->urb; -+ DWC_PRINTF(" URB Info:\n"); -+ DWC_PRINTF(" qtd: %p, urb: %p\n", qtd, urb); -+ if (urb) { -+ DWC_PRINTF(" Dev: %d, EP: %d %s\n", -+ dwc_otg_hcd_get_dev_addr(&urb-> -+ pipe_info), -+ dwc_otg_hcd_get_ep_num(&urb-> -+ pipe_info), -+ dwc_otg_hcd_is_pipe_in(&urb-> -+ pipe_info) ? -+ "IN" : "OUT"); -+ DWC_PRINTF(" Max packet size: %d\n", -+ dwc_otg_hcd_get_mps(&urb-> -+ pipe_info)); -+ DWC_PRINTF(" transfer_buffer: %p\n", -+ urb->buf); -+ DWC_PRINTF(" transfer_dma: %p\n", -+ (void *)urb->dma); -+ DWC_PRINTF(" transfer_buffer_length: %d\n", -+ urb->length); -+ DWC_PRINTF(" actual_length: %d\n", -+ urb->actual_length); -+ } -+ } -+ } -+ } -+ DWC_PRINTF(" non_periodic_channels: %d\n", hcd->non_periodic_channels); -+ DWC_PRINTF(" periodic_channels: %d\n", hcd->periodic_channels); -+ DWC_PRINTF(" periodic_usecs: %d\n", hcd->periodic_usecs); -+ np_tx_status.d32 = -+ DWC_READ_REG32(&hcd->core_if->core_global_regs->gnptxsts); -+ DWC_PRINTF(" NP Tx Req Queue Space Avail: %d\n", -+ np_tx_status.b.nptxqspcavail); -+ DWC_PRINTF(" NP Tx FIFO Space Avail: %d\n", -+ np_tx_status.b.nptxfspcavail); -+ p_tx_status.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hptxsts); -+ DWC_PRINTF(" P Tx Req Queue Space Avail: %d\n", -+ p_tx_status.b.ptxqspcavail); -+ DWC_PRINTF(" P Tx FIFO Space Avail: %d\n", p_tx_status.b.ptxfspcavail); -+ dwc_otg_hcd_dump_frrem(hcd); -+ dwc_otg_dump_global_registers(hcd->core_if); -+ dwc_otg_dump_host_registers(hcd->core_if); -+ DWC_PRINTF -+ ("************************************************************\n"); -+ DWC_PRINTF("\n"); -+#endif -+} -+ -+#ifdef DEBUG -+void dwc_print_setup_data(uint8_t * setup) -+{ -+ int i; -+ if (CHK_DEBUG_LEVEL(DBG_HCD)) { -+ DWC_PRINTF("Setup Data = MSB "); -+ for (i = 7; i >= 0; i--) -+ DWC_PRINTF("%02x ", setup[i]); -+ DWC_PRINTF("\n"); -+ DWC_PRINTF(" bmRequestType Tranfer = %s\n", -+ (setup[0] & 0x80) ? "Device-to-Host" : -+ "Host-to-Device"); -+ DWC_PRINTF(" bmRequestType Type = "); -+ switch ((setup[0] & 0x60) >> 5) { -+ case 0: -+ DWC_PRINTF("Standard\n"); -+ break; -+ case 1: -+ DWC_PRINTF("Class\n"); -+ break; -+ case 2: -+ DWC_PRINTF("Vendor\n"); -+ break; -+ case 3: -+ DWC_PRINTF("Reserved\n"); -+ break; -+ } -+ DWC_PRINTF(" bmRequestType Recipient = "); -+ switch (setup[0] & 0x1f) { -+ case 0: -+ DWC_PRINTF("Device\n"); -+ break; -+ case 1: -+ DWC_PRINTF("Interface\n"); -+ break; -+ case 2: -+ DWC_PRINTF("Endpoint\n"); -+ break; -+ case 3: -+ DWC_PRINTF("Other\n"); -+ break; -+ default: -+ DWC_PRINTF("Reserved\n"); -+ break; -+ } -+ DWC_PRINTF(" bRequest = 0x%0x\n", setup[1]); -+ DWC_PRINTF(" wValue = 0x%0x\n", *((uint16_t *) & setup[2])); -+ DWC_PRINTF(" wIndex = 0x%0x\n", *((uint16_t *) & setup[4])); -+ DWC_PRINTF(" wLength = 0x%0x\n\n", *((uint16_t *) & setup[6])); -+ } -+} -+#endif -+ -+void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd) -+{ -+#if 0 -+ DWC_PRINTF("Frame remaining at SOF:\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->frrem_samples, hcd->frrem_accum, -+ (hcd->frrem_samples > 0) ? -+ hcd->frrem_accum / hcd->frrem_samples : 0); -+ -+ DWC_PRINTF("\n"); -+ DWC_PRINTF("Frame remaining at start_transfer (uframe 7):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->core_if->hfnum_7_samples, -+ hcd->core_if->hfnum_7_frrem_accum, -+ (hcd->core_if->hfnum_7_samples > -+ 0) ? hcd->core_if->hfnum_7_frrem_accum / -+ hcd->core_if->hfnum_7_samples : 0); -+ DWC_PRINTF("Frame remaining at start_transfer (uframe 0):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->core_if->hfnum_0_samples, -+ hcd->core_if->hfnum_0_frrem_accum, -+ (hcd->core_if->hfnum_0_samples > -+ 0) ? hcd->core_if->hfnum_0_frrem_accum / -+ hcd->core_if->hfnum_0_samples : 0); -+ DWC_PRINTF("Frame remaining at start_transfer (uframe 1-6):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->core_if->hfnum_other_samples, -+ hcd->core_if->hfnum_other_frrem_accum, -+ (hcd->core_if->hfnum_other_samples > -+ 0) ? hcd->core_if->hfnum_other_frrem_accum / -+ hcd->core_if->hfnum_other_samples : 0); -+ -+ DWC_PRINTF("\n"); -+ DWC_PRINTF("Frame remaining at sample point A (uframe 7):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_7_samples_a, hcd->hfnum_7_frrem_accum_a, -+ (hcd->hfnum_7_samples_a > 0) ? -+ hcd->hfnum_7_frrem_accum_a / hcd->hfnum_7_samples_a : 0); -+ DWC_PRINTF("Frame remaining at sample point A (uframe 0):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_0_samples_a, hcd->hfnum_0_frrem_accum_a, -+ (hcd->hfnum_0_samples_a > 0) ? -+ hcd->hfnum_0_frrem_accum_a / hcd->hfnum_0_samples_a : 0); -+ DWC_PRINTF("Frame remaining at sample point A (uframe 1-6):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_other_samples_a, hcd->hfnum_other_frrem_accum_a, -+ (hcd->hfnum_other_samples_a > 0) ? -+ hcd->hfnum_other_frrem_accum_a / -+ hcd->hfnum_other_samples_a : 0); -+ -+ DWC_PRINTF("\n"); -+ DWC_PRINTF("Frame remaining at sample point B (uframe 7):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_7_samples_b, hcd->hfnum_7_frrem_accum_b, -+ (hcd->hfnum_7_samples_b > 0) ? -+ hcd->hfnum_7_frrem_accum_b / hcd->hfnum_7_samples_b : 0); -+ DWC_PRINTF("Frame remaining at sample point B (uframe 0):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_0_samples_b, hcd->hfnum_0_frrem_accum_b, -+ (hcd->hfnum_0_samples_b > 0) ? -+ hcd->hfnum_0_frrem_accum_b / hcd->hfnum_0_samples_b : 0); -+ DWC_PRINTF("Frame remaining at sample point B (uframe 1-6):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_other_samples_b, hcd->hfnum_other_frrem_accum_b, -+ (hcd->hfnum_other_samples_b > 0) ? -+ hcd->hfnum_other_frrem_accum_b / -+ hcd->hfnum_other_samples_b : 0); -+#endif -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4539cd7b802d3e49ac9a6cb3f1d88b475a1ace16 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -@@ -0,0 +1,868 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ -+ * $Revision: #58 $ -+ * $Date: 2011/09/15 $ -+ * $Change: 1846647 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+#ifndef __DWC_HCD_H__ -+#define __DWC_HCD_H__ -+ -+#include "dwc_otg_os_dep.h" -+#include "usb.h" -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_list.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_fiq_fsm.h" -+#include "dwc_otg_driver.h" -+ -+ -+/** -+ * @file -+ * -+ * This file contains the structures, constants, and interfaces for -+ * the Host Contoller Driver (HCD). -+ * -+ * The Host Controller Driver (HCD) is responsible for translating requests -+ * from the USB Driver into the appropriate actions on the DWC_otg controller. -+ * It isolates the USBD from the specifics of the controller by providing an -+ * API to the USBD. -+ */ -+ -+struct dwc_otg_hcd_pipe_info { -+ uint8_t dev_addr; -+ uint8_t ep_num; -+ uint8_t pipe_type; -+ uint8_t pipe_dir; -+ uint16_t mps; -+}; -+ -+struct dwc_otg_hcd_iso_packet_desc { -+ uint32_t offset; -+ uint32_t length; -+ uint32_t actual_length; -+ uint32_t status; -+}; -+ -+struct dwc_otg_qtd; -+ -+struct dwc_otg_hcd_urb { -+ void *priv; -+ struct dwc_otg_qtd *qtd; -+ void *buf; -+ dwc_dma_t dma; -+ void *setup_packet; -+ dwc_dma_t setup_dma; -+ uint32_t length; -+ uint32_t actual_length; -+ uint32_t status; -+ uint32_t error_count; -+ uint32_t packet_count; -+ uint32_t flags; -+ uint16_t interval; -+ struct dwc_otg_hcd_pipe_info pipe_info; -+ struct dwc_otg_hcd_iso_packet_desc iso_descs[0]; -+}; -+ -+static inline uint8_t dwc_otg_hcd_get_ep_num(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return pipe->ep_num; -+} -+ -+static inline uint8_t dwc_otg_hcd_get_pipe_type(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return pipe->pipe_type; -+} -+ -+static inline uint16_t dwc_otg_hcd_get_mps(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return pipe->mps; -+} -+ -+static inline uint8_t dwc_otg_hcd_get_dev_addr(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return pipe->dev_addr; -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_isoc(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_ISOCHRONOUS); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_int(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_INTERRUPT); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_bulk(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_BULK); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_control(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_CONTROL); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_in(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return (pipe->pipe_dir == UE_DIR_IN); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_out(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (!dwc_otg_hcd_is_pipe_in(pipe)); -+} -+ -+static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, -+ uint8_t devaddr, uint8_t ep_num, -+ uint8_t pipe_type, uint8_t pipe_dir, -+ uint16_t mps) -+{ -+ pipe->dev_addr = devaddr; -+ pipe->ep_num = ep_num; -+ pipe->pipe_type = pipe_type; -+ pipe->pipe_dir = pipe_dir; -+ pipe->mps = mps; -+} -+ -+/** -+ * Phases for control transfers. -+ */ -+typedef enum dwc_otg_control_phase { -+ DWC_OTG_CONTROL_SETUP, -+ DWC_OTG_CONTROL_DATA, -+ DWC_OTG_CONTROL_STATUS -+} dwc_otg_control_phase_e; -+ -+/** Transaction types. */ -+typedef enum dwc_otg_transaction_type { -+ DWC_OTG_TRANSACTION_NONE = 0, -+ DWC_OTG_TRANSACTION_PERIODIC = 1, -+ DWC_OTG_TRANSACTION_NON_PERIODIC = 2, -+ DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC -+} dwc_otg_transaction_type_e; -+ -+struct dwc_otg_qh; -+ -+/** -+ * A Queue Transfer Descriptor (QTD) holds the state of a bulk, control, -+ * interrupt, or isochronous transfer. A single QTD is created for each URB -+ * (of one of these types) submitted to the HCD. The transfer associated with -+ * a QTD may require one or multiple transactions. -+ * -+ * A QTD is linked to a Queue Head, which is entered in either the -+ * non-periodic or periodic schedule for execution. When a QTD is chosen for -+ * execution, some or all of its transactions may be executed. After -+ * execution, the state of the QTD is updated. The QTD may be retired if all -+ * its transactions are complete or if an error occurred. Otherwise, it -+ * remains in the schedule so more transactions can be executed later. -+ */ -+typedef struct dwc_otg_qtd { -+ /** -+ * Determines the PID of the next data packet for the data phase of -+ * control transfers. Ignored for other transfer types.
-+ * One of the following values: -+ * - DWC_OTG_HC_PID_DATA0 -+ * - DWC_OTG_HC_PID_DATA1 -+ */ -+ uint8_t data_toggle; -+ -+ /** Current phase for control transfers (Setup, Data, or Status). */ -+ dwc_otg_control_phase_e control_phase; -+ -+ /** Keep track of the current split type -+ * for FS/LS endpoints on a HS Hub */ -+ uint8_t complete_split; -+ -+ /** How many bytes transferred during SSPLIT OUT */ -+ uint32_t ssplit_out_xfer_count; -+ -+ /** -+ * Holds the number of bus errors that have occurred for a transaction -+ * within this transfer. -+ */ -+ uint8_t error_count; -+ -+ /** -+ * Index of the next frame descriptor for an isochronous transfer. A -+ * frame descriptor describes the buffer position and length of the -+ * data to be transferred in the next scheduled (micro)frame of an -+ * isochronous transfer. It also holds status for that transaction. -+ * The frame index starts at 0. -+ */ -+ uint16_t isoc_frame_index; -+ -+ /** Position of the ISOC split on full/low speed */ -+ uint8_t isoc_split_pos; -+ -+ /** Position of the ISOC split in the buffer for the current frame */ -+ uint16_t isoc_split_offset; -+ -+ /** URB for this transfer */ -+ struct dwc_otg_hcd_urb *urb; -+ -+ struct dwc_otg_qh *qh; -+ -+ /** This list of QTDs */ -+ DWC_CIRCLEQ_ENTRY(dwc_otg_qtd) qtd_list_entry; -+ -+ /** Indicates if this QTD is currently processed by HW. */ -+ uint8_t in_process; -+ -+ /** Number of DMA descriptors for this QTD */ -+ uint8_t n_desc; -+ -+ /** -+ * Last activated frame(packet) index. -+ * Used in Descriptor DMA mode only. -+ */ -+ uint16_t isoc_frame_index_last; -+ -+} dwc_otg_qtd_t; -+ -+DWC_CIRCLEQ_HEAD(dwc_otg_qtd_list, dwc_otg_qtd); -+ -+/** -+ * A Queue Head (QH) holds the static characteristics of an endpoint and -+ * maintains a list of transfers (QTDs) for that endpoint. A QH structure may -+ * be entered in either the non-periodic or periodic schedule. -+ */ -+typedef struct dwc_otg_qh { -+ /** -+ * Endpoint type. -+ * One of the following values: -+ * - UE_CONTROL -+ * - UE_BULK -+ * - UE_INTERRUPT -+ * - UE_ISOCHRONOUS -+ */ -+ uint8_t ep_type; -+ uint8_t ep_is_in; -+ -+ /** wMaxPacketSize Field of Endpoint Descriptor. */ -+ uint16_t maxp; -+ -+ /** -+ * Device speed. -+ * One of the following values: -+ * - DWC_OTG_EP_SPEED_LOW -+ * - DWC_OTG_EP_SPEED_FULL -+ * - DWC_OTG_EP_SPEED_HIGH -+ */ -+ uint8_t dev_speed; -+ -+ /** -+ * Determines the PID of the next data packet for non-control -+ * transfers. Ignored for control transfers.
-+ * One of the following values: -+ * - DWC_OTG_HC_PID_DATA0 -+ * - DWC_OTG_HC_PID_DATA1 -+ */ -+ uint8_t data_toggle; -+ -+ /** Ping state if 1. */ -+ uint8_t ping_state; -+ -+ /** -+ * List of QTDs for this QH. -+ */ -+ struct dwc_otg_qtd_list qtd_list; -+ -+ /** Host channel currently processing transfers for this QH. */ -+ struct dwc_hc *channel; -+ -+ /** Full/low speed endpoint on high-speed hub requires split. */ -+ uint8_t do_split; -+ -+ /** @name Periodic schedule information */ -+ /** @{ */ -+ -+ /** Bandwidth in microseconds per (micro)frame. */ -+ uint16_t usecs; -+ -+ /** Interval between transfers in (micro)frames. */ -+ uint16_t interval; -+ -+ /** -+ * (micro)frame to initialize a periodic transfer. The transfer -+ * executes in the following (micro)frame. -+ */ -+ uint16_t sched_frame; -+ -+ /* -+ ** Frame a NAK was received on this queue head, used to minimise NAK retransmission -+ */ -+ uint16_t nak_frame; -+ -+ /** (micro)frame at which last start split was initialized. */ -+ uint16_t start_split_frame; -+ -+ /** @} */ -+ -+ /** -+ * Used instead of original buffer if -+ * it(physical address) is not dword-aligned. -+ */ -+ uint8_t *dw_align_buf; -+ dwc_dma_t dw_align_buf_dma; -+ -+ /** Entry for QH in either the periodic or non-periodic schedule. */ -+ dwc_list_link_t qh_list_entry; -+ -+ /** @name Descriptor DMA support */ -+ /** @{ */ -+ -+ /** Descriptor List. */ -+ dwc_otg_host_dma_desc_t *desc_list; -+ -+ /** Descriptor List physical address. */ -+ dwc_dma_t desc_list_dma; -+ -+ /** -+ * Xfer Bytes array. -+ * Each element corresponds to a descriptor and indicates -+ * original XferSize size value for the descriptor. -+ */ -+ uint32_t *n_bytes; -+ -+ /** Actual number of transfer descriptors in a list. */ -+ uint16_t ntd; -+ -+ /** First activated isochronous transfer descriptor index. */ -+ uint8_t td_first; -+ /** Last activated isochronous transfer descriptor index. */ -+ uint8_t td_last; -+ -+ /** @} */ -+ -+ -+ uint16_t speed; -+ uint16_t frame_usecs[8]; -+ -+ uint32_t skip_count; -+} dwc_otg_qh_t; -+ -+DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); -+ -+typedef struct urb_tq_entry { -+ struct urb *urb; -+ DWC_TAILQ_ENTRY(urb_tq_entry) urb_tq_entries; -+} urb_tq_entry_t; -+ -+DWC_TAILQ_HEAD(urb_list, urb_tq_entry); -+ -+/** -+ * This structure holds the state of the HCD, including the non-periodic and -+ * periodic schedules. -+ */ -+struct dwc_otg_hcd { -+ /** The DWC otg device pointer */ -+ struct dwc_otg_device *otg_dev; -+ /** DWC OTG Core Interface Layer */ -+ dwc_otg_core_if_t *core_if; -+ -+ /** Function HCD driver callbacks */ -+ struct dwc_otg_hcd_function_ops *fops; -+ -+ /** Internal DWC HCD Flags */ -+ volatile union dwc_otg_hcd_internal_flags { -+ uint32_t d32; -+ struct { -+ unsigned port_connect_status_change:1; -+ unsigned port_connect_status:1; -+ unsigned port_reset_change:1; -+ unsigned port_enable_change:1; -+ unsigned port_suspend_change:1; -+ unsigned port_over_current_change:1; -+ unsigned port_l1_change:1; -+ unsigned reserved:26; -+ } b; -+ } flags; -+ -+ /** -+ * Inactive items in the non-periodic schedule. This is a list of -+ * Queue Heads. Transfers associated with these Queue Heads are not -+ * currently assigned to a host channel. -+ */ -+ dwc_list_link_t non_periodic_sched_inactive; -+ -+ /** -+ * Active items in the non-periodic schedule. This is a list of -+ * Queue Heads. Transfers associated with these Queue Heads are -+ * currently assigned to a host channel. -+ */ -+ dwc_list_link_t non_periodic_sched_active; -+ -+ /** -+ * Pointer to the next Queue Head to process in the active -+ * non-periodic schedule. -+ */ -+ dwc_list_link_t *non_periodic_qh_ptr; -+ -+ /** -+ * Inactive items in the periodic schedule. This is a list of QHs for -+ * periodic transfers that are _not_ scheduled for the next frame. -+ * Each QH in the list has an interval counter that determines when it -+ * needs to be scheduled for execution. This scheduling mechanism -+ * allows only a simple calculation for periodic bandwidth used (i.e. -+ * must assume that all periodic transfers may need to execute in the -+ * same frame). However, it greatly simplifies scheduling and should -+ * be sufficient for the vast majority of OTG hosts, which need to -+ * connect to a small number of peripherals at one time. -+ * -+ * Items move from this list to periodic_sched_ready when the QH -+ * interval counter is 0 at SOF. -+ */ -+ dwc_list_link_t periodic_sched_inactive; -+ -+ /** -+ * List of periodic QHs that are ready for execution in the next -+ * frame, but have not yet been assigned to host channels. -+ * -+ * Items move from this list to periodic_sched_assigned as host -+ * channels become available during the current frame. -+ */ -+ dwc_list_link_t periodic_sched_ready; -+ -+ /** -+ * List of periodic QHs to be executed in the next frame that are -+ * assigned to host channels. -+ * -+ * Items move from this list to periodic_sched_queued as the -+ * transactions for the QH are queued to the DWC_otg controller. -+ */ -+ dwc_list_link_t periodic_sched_assigned; -+ -+ /** -+ * List of periodic QHs that have been queued for execution. -+ * -+ * Items move from this list to either periodic_sched_inactive or -+ * periodic_sched_ready when the channel associated with the transfer -+ * is released. If the interval for the QH is 1, the item moves to -+ * periodic_sched_ready because it must be rescheduled for the next -+ * frame. Otherwise, the item moves to periodic_sched_inactive. -+ */ -+ dwc_list_link_t periodic_sched_queued; -+ -+ /** -+ * Total bandwidth claimed so far for periodic transfers. This value -+ * is in microseconds per (micro)frame. The assumption is that all -+ * periodic transfers may occur in the same (micro)frame. -+ */ -+ uint16_t periodic_usecs; -+ -+ /** -+ * Total bandwidth claimed so far for all periodic transfers -+ * in a frame. -+ * This will include a mixture of HS and FS transfers. -+ * Units are microseconds per (micro)frame. -+ * We have a budget per frame and have to schedule -+ * transactions accordingly. -+ * Watch out for the fact that things are actually scheduled for the -+ * "next frame". -+ */ -+ uint16_t frame_usecs[8]; -+ -+ -+ /** -+ * Frame number read from the core at SOF. The value ranges from 0 to -+ * DWC_HFNUM_MAX_FRNUM. -+ */ -+ uint16_t frame_number; -+ -+ /** -+ * Count of periodic QHs, if using several eps. For SOF enable/disable. -+ */ -+ uint16_t periodic_qh_count; -+ -+ /** -+ * Free host channels in the controller. This is a list of -+ * dwc_hc_t items. -+ */ -+ struct hc_list free_hc_list; -+ /** -+ * Number of host channels assigned to periodic transfers. Currently -+ * assuming that there is a dedicated host channel for each periodic -+ * transaction and at least one host channel available for -+ * non-periodic transactions. -+ */ -+ int periodic_channels; /* microframe_schedule==0 */ -+ -+ /** -+ * Number of host channels assigned to non-periodic transfers. -+ */ -+ int non_periodic_channels; /* microframe_schedule==0 */ -+ -+ /** -+ * Number of host channels assigned to non-periodic transfers. -+ */ -+ int available_host_channels; -+ -+ /** -+ * Array of pointers to the host channel descriptors. Allows accessing -+ * a host channel descriptor given the host channel number. This is -+ * useful in interrupt handlers. -+ */ -+ struct dwc_hc *hc_ptr_array[MAX_EPS_CHANNELS]; -+ -+ /** -+ * Buffer to use for any data received during the status phase of a -+ * control transfer. Normally no data is transferred during the status -+ * phase. This buffer is used as a bit bucket. -+ */ -+ uint8_t *status_buf; -+ -+ /** -+ * DMA address for status_buf. -+ */ -+ dma_addr_t status_buf_dma; -+#define DWC_OTG_HCD_STATUS_BUF_SIZE 64 -+ -+ /** -+ * Connection timer. An OTG host must display a message if the device -+ * does not connect. Started when the VBus power is turned on via -+ * sysfs attribute "buspower". -+ */ -+ dwc_timer_t *conn_timer; -+ -+ /* Tasket to do a reset */ -+ dwc_tasklet_t *reset_tasklet; -+ -+ dwc_tasklet_t *completion_tasklet; -+ struct urb_list completed_urb_list; -+ -+ /* */ -+ dwc_spinlock_t *lock; -+ dwc_spinlock_t *channel_lock; -+ /** -+ * Private data that could be used by OS wrapper. -+ */ -+ void *priv; -+ -+ uint8_t otg_port; -+ -+ /** Frame List */ -+ uint32_t *frame_list; -+ -+ /** Hub - Port assignment */ -+ int hub_port[128]; -+#ifdef FIQ_DEBUG -+ int hub_port_alloc[2048]; -+#endif -+ -+ /** Frame List DMA address */ -+ dma_addr_t frame_list_dma; -+ -+ struct fiq_stack *fiq_stack; -+ struct fiq_state *fiq_state; -+ -+ /** Virtual address for split transaction DMA bounce buffers */ -+ struct fiq_dma_blob *fiq_dmab; -+ -+#ifdef DEBUG -+ uint32_t frrem_samples; -+ uint64_t frrem_accum; -+ -+ uint32_t hfnum_7_samples_a; -+ uint64_t hfnum_7_frrem_accum_a; -+ uint32_t hfnum_0_samples_a; -+ uint64_t hfnum_0_frrem_accum_a; -+ uint32_t hfnum_other_samples_a; -+ uint64_t hfnum_other_frrem_accum_a; -+ -+ uint32_t hfnum_7_samples_b; -+ uint64_t hfnum_7_frrem_accum_b; -+ uint32_t hfnum_0_samples_b; -+ uint64_t hfnum_0_frrem_accum_b; -+ uint32_t hfnum_other_samples_b; -+ uint64_t hfnum_other_frrem_accum_b; -+#endif -+}; -+ -+static inline struct device *dwc_otg_hcd_to_dev(struct dwc_otg_hcd *hcd) -+{ -+ return &hcd->otg_dev->os_dep.platformdev->dev; -+} -+ -+/** @name Transaction Execution Functions */ -+/** @{ */ -+extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t -+ * hcd); -+extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, -+ dwc_otg_transaction_type_e tr_type); -+ -+int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh); -+void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); -+ -+extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); -+extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh); -+extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num); -+ -+/** @} */ -+ -+/** @name Interrupt Handler Functions */ -+/** @{ */ -+extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_incomplete_periodic_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_conn_id_status_change_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_disconnect_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint32_t num); -+extern int32_t dwc_otg_hcd_handle_session_req_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_wakeup_detected_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+/** @} */ -+ -+/** @name Schedule Queue Functions */ -+/** @{ */ -+ -+/* Implemented in dwc_otg_hcd_queue.c */ -+extern dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * urb, int atomic_alloc); -+extern void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ int sched_csplit); -+ -+/** Remove and free a QH */ -+static inline void dwc_otg_hcd_qh_remove_and_free(dwc_otg_hcd_t * hcd, -+ dwc_otg_qh_t * qh) -+{ -+ dwc_irqflags_t flags; -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ dwc_otg_hcd_qh_free(hcd, qh); -+} -+ -+/** Allocates memory for a QH structure. -+ * @return Returns the memory allocate or NULL on error. */ -+static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(int atomic_alloc) -+{ -+ if (atomic_alloc) -+ return (dwc_otg_qh_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qh_t)); -+ else -+ return (dwc_otg_qh_t *) DWC_ALLOC(sizeof(dwc_otg_qh_t)); -+} -+ -+extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, -+ int atomic_alloc); -+extern void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb); -+extern int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_qh_t ** qh, int atomic_alloc); -+ -+/** Allocates memory for a QTD structure. -+ * @return Returns the memory allocate or NULL on error. */ -+static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(int atomic_alloc) -+{ -+ if (atomic_alloc) -+ return (dwc_otg_qtd_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qtd_t)); -+ else -+ return (dwc_otg_qtd_t *) DWC_ALLOC(sizeof(dwc_otg_qtd_t)); -+} -+ -+/** Frees the memory for a QTD structure. QTD should already be removed from -+ * list. -+ * @param qtd QTD to free.*/ -+static inline void dwc_otg_hcd_qtd_free(dwc_otg_qtd_t * qtd) -+{ -+ DWC_FREE(qtd); -+} -+ -+/** Removes a QTD from list. -+ * @param hcd HCD instance. -+ * @param qtd QTD to remove from list. -+ * @param qh QTD belongs to. -+ */ -+static inline void dwc_otg_hcd_qtd_remove(dwc_otg_hcd_t * hcd, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_qh_t * qh) -+{ -+ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); -+} -+ -+/** Remove and free a QTD -+ * Need to disable IRQ and hold hcd lock while calling this function out of -+ * interrupt servicing chain */ -+static inline void dwc_otg_hcd_qtd_remove_and_free(dwc_otg_hcd_t * hcd, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_qh_t * qh) -+{ -+ dwc_otg_hcd_qtd_remove(hcd, qtd, qh); -+ dwc_otg_hcd_qtd_free(qtd); -+} -+ -+/** @} */ -+ -+/** @name Descriptor DMA Supporting Functions */ -+/** @{ */ -+ -+extern void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status); -+ -+extern int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+ -+/** @} */ -+ -+/** @name Internal Functions */ -+/** @{ */ -+dwc_otg_qh_t *dwc_urb_to_qh(dwc_otg_hcd_urb_t * urb); -+/** @} */ -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+extern int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, -+ uint8_t devaddr); -+extern void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd); -+#endif -+ -+/** Gets the QH that contains the list_head */ -+#define dwc_list_to_qh(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qh_t, qh_list_entry) -+ -+/** Gets the QTD that contains the list_head */ -+#define dwc_list_to_qtd(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qtd_t, qtd_list_entry) -+ -+/** Check if QH is non-periodic */ -+#define dwc_qh_is_non_per(_qh_ptr_) ((_qh_ptr_->ep_type == UE_BULK) || \ -+ (_qh_ptr_->ep_type == UE_CONTROL)) -+ -+/** High bandwidth multiplier as encoded in highspeed endpoint descriptors */ -+#define dwc_hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) -+ -+/** Packet size for any kind of endpoint descriptor */ -+#define dwc_max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) -+ -+/** -+ * Returns true if _frame1 is less than or equal to _frame2. The comparison is -+ * done modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the -+ * frame number when the max frame number is reached. -+ */ -+static inline int dwc_frame_num_le(uint16_t frame1, uint16_t frame2) -+{ -+ return ((frame2 - frame1) & DWC_HFNUM_MAX_FRNUM) <= -+ (DWC_HFNUM_MAX_FRNUM >> 1); -+} -+ -+/** -+ * Returns true if _frame1 is greater than _frame2. The comparison is done -+ * modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the frame -+ * number when the max frame number is reached. -+ */ -+static inline int dwc_frame_num_gt(uint16_t frame1, uint16_t frame2) -+{ -+ return (frame1 != frame2) && -+ (((frame1 - frame2) & DWC_HFNUM_MAX_FRNUM) < -+ (DWC_HFNUM_MAX_FRNUM >> 1)); -+} -+ -+/** -+ * Increments _frame by the amount specified by _inc. The addition is done -+ * modulo DWC_HFNUM_MAX_FRNUM. Returns the incremented value. -+ */ -+static inline uint16_t dwc_frame_num_inc(uint16_t frame, uint16_t inc) -+{ -+ return (frame + inc) & DWC_HFNUM_MAX_FRNUM; -+} -+ -+static inline uint16_t dwc_full_frame_num(uint16_t frame) -+{ -+ return (frame & DWC_HFNUM_MAX_FRNUM) >> 3; -+} -+ -+static inline uint16_t dwc_micro_frame_num(uint16_t frame) -+{ -+ return frame & 0x7; -+} -+ -+void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd); -+ -+#ifdef DEBUG -+/** -+ * Macro to sample the remaining PHY clocks left in the current frame. This -+ * may be used during debugging to determine the average time it takes to -+ * execute sections of code. There are two possible sample points, "a" and -+ * "b", so the _letter argument must be one of these values. -+ * -+ * To dump the average sample times, read the "hcd_frrem" sysfs attribute. For -+ * example, "cat /sys/devices/lm0/hcd_frrem". -+ */ -+#define dwc_sample_frrem(_hcd, _qh, _letter) \ -+{ \ -+ hfnum_data_t hfnum; \ -+ dwc_otg_qtd_t *qtd; \ -+ qtd = list_entry(_qh->qtd_list.next, dwc_otg_qtd_t, qtd_list_entry); \ -+ if (usb_pipeint(qtd->urb->pipe) && _qh->start_split_frame != 0 && !qtd->complete_split) { \ -+ hfnum.d32 = DWC_READ_REG32(&_hcd->core_if->host_if->host_global_regs->hfnum); \ -+ switch (hfnum.b.frnum & 0x7) { \ -+ case 7: \ -+ _hcd->hfnum_7_samples_##_letter++; \ -+ _hcd->hfnum_7_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ case 0: \ -+ _hcd->hfnum_0_samples_##_letter++; \ -+ _hcd->hfnum_0_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ default: \ -+ _hcd->hfnum_other_samples_##_letter++; \ -+ _hcd->hfnum_other_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ } \ -+ } \ -+} -+#else -+#define dwc_sample_frrem(_hcd, _qh, _letter) -+#endif -+#endif -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c -new file mode 100644 -index 0000000000000000000000000000000000000000..126e99ab2fc43f11d89a08ff0476181ead84029f ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c -@@ -0,0 +1,1139 @@ -+/*========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $ -+ * $Revision: #10 $ -+ * $Date: 2011/10/20 $ -+ * $Change: 1869464 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** @file -+ * This file contains Descriptor DMA support implementation for host mode. -+ */ -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+ -+extern bool microframe_schedule; -+ -+static inline uint8_t frame_list_idx(uint16_t frame) -+{ -+ return (frame & (MAX_FRLIST_EN_NUM - 1)); -+} -+ -+static inline uint16_t desclist_idx_inc(uint16_t idx, uint16_t inc, uint8_t speed) -+{ -+ return (idx + inc) & -+ (((speed == -+ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : -+ MAX_DMA_DESC_NUM_GENERIC) - 1); -+} -+ -+static inline uint16_t desclist_idx_dec(uint16_t idx, uint16_t inc, uint8_t speed) -+{ -+ return (idx - inc) & -+ (((speed == -+ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : -+ MAX_DMA_DESC_NUM_GENERIC) - 1); -+} -+ -+static inline uint16_t max_desc_num(dwc_otg_qh_t * qh) -+{ -+ return (((qh->ep_type == UE_ISOCHRONOUS) -+ && (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH)) -+ ? MAX_DMA_DESC_NUM_HS_ISOC : MAX_DMA_DESC_NUM_GENERIC); -+} -+static inline uint16_t frame_incr_val(dwc_otg_qh_t * qh) -+{ -+ return ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) -+ ? ((qh->interval + 8 - 1) / 8) -+ : qh->interval); -+} -+ -+static int desc_list_alloc(struct device *dev, dwc_otg_qh_t * qh) -+{ -+ int retval = 0; -+ -+ qh->desc_list = (dwc_otg_host_dma_desc_t *) -+ DWC_DMA_ALLOC(dev, sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh), -+ &qh->desc_list_dma); -+ -+ if (!qh->desc_list) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: DMA descriptor list allocation failed\n", __func__); -+ -+ } -+ -+ dwc_memset(qh->desc_list, 0x00, -+ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); -+ -+ qh->n_bytes = -+ (uint32_t *) DWC_ALLOC(sizeof(uint32_t) * max_desc_num(qh)); -+ -+ if (!qh->n_bytes) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR -+ ("%s: Failed to allocate array for descriptors' size actual values\n", -+ __func__); -+ -+ } -+ return retval; -+ -+} -+ -+static void desc_list_free(struct device *dev, dwc_otg_qh_t * qh) -+{ -+ if (qh->desc_list) { -+ DWC_DMA_FREE(dev, max_desc_num(qh), qh->desc_list, -+ qh->desc_list_dma); -+ qh->desc_list = NULL; -+ } -+ -+ if (qh->n_bytes) { -+ DWC_FREE(qh->n_bytes); -+ qh->n_bytes = NULL; -+ } -+} -+ -+static int frame_list_alloc(dwc_otg_hcd_t * hcd) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ int retval = 0; -+ -+ if (hcd->frame_list) -+ return 0; -+ -+ hcd->frame_list = DWC_DMA_ALLOC(dev, 4 * MAX_FRLIST_EN_NUM, -+ &hcd->frame_list_dma); -+ if (!hcd->frame_list) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: Frame List allocation failed\n", __func__); -+ } -+ -+ dwc_memset(hcd->frame_list, 0x00, 4 * MAX_FRLIST_EN_NUM); -+ -+ return retval; -+} -+ -+static void frame_list_free(dwc_otg_hcd_t * hcd) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ if (!hcd->frame_list) -+ return; -+ -+ DWC_DMA_FREE(dev, 4 * MAX_FRLIST_EN_NUM, hcd->frame_list, hcd->frame_list_dma); -+ hcd->frame_list = NULL; -+} -+ -+static void per_sched_enable(dwc_otg_hcd_t * hcd, uint16_t fr_list_en) -+{ -+ -+ hcfg_data_t hcfg; -+ -+ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); -+ -+ if (hcfg.b.perschedena) { -+ /* already enabled */ -+ return; -+ } -+ -+ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hflbaddr, -+ hcd->frame_list_dma); -+ -+ switch (fr_list_en) { -+ case 64: -+ hcfg.b.frlisten = 3; -+ break; -+ case 32: -+ hcfg.b.frlisten = 2; -+ break; -+ case 16: -+ hcfg.b.frlisten = 1; -+ break; -+ case 8: -+ hcfg.b.frlisten = 0; -+ break; -+ default: -+ break; -+ } -+ -+ hcfg.b.perschedena = 1; -+ -+ DWC_DEBUGPL(DBG_HCD, "Enabling Periodic schedule\n"); -+ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+ -+} -+ -+static void per_sched_disable(dwc_otg_hcd_t * hcd) -+{ -+ hcfg_data_t hcfg; -+ -+ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); -+ -+ if (!hcfg.b.perschedena) { -+ /* already disabled */ -+ return; -+ } -+ hcfg.b.perschedena = 0; -+ -+ DWC_DEBUGPL(DBG_HCD, "Disabling Periodic schedule\n"); -+ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+} -+ -+/* -+ * Activates/Deactivates FrameList entries for the channel -+ * based on endpoint servicing period. -+ */ -+void update_frame_list(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, uint8_t enable) -+{ -+ uint16_t i, j, inc; -+ dwc_hc_t *hc = NULL; -+ -+ if (!qh->channel) { -+ DWC_ERROR("qh->channel = %p", qh->channel); -+ return; -+ } -+ -+ if (!hcd) { -+ DWC_ERROR("------hcd = %p", hcd); -+ return; -+ } -+ -+ if (!hcd->frame_list) { -+ DWC_ERROR("-------hcd->frame_list = %p", hcd->frame_list); -+ return; -+ } -+ -+ hc = qh->channel; -+ inc = frame_incr_val(qh); -+ if (qh->ep_type == UE_ISOCHRONOUS) -+ i = frame_list_idx(qh->sched_frame); -+ else -+ i = 0; -+ -+ j = i; -+ do { -+ if (enable) -+ hcd->frame_list[j] |= (1 << hc->hc_num); -+ else -+ hcd->frame_list[j] &= ~(1 << hc->hc_num); -+ j = (j + inc) & (MAX_FRLIST_EN_NUM - 1); -+ } -+ while (j != i); -+ if (!enable) -+ return; -+ hc->schinfo = 0; -+ if (qh->channel->speed == DWC_OTG_EP_SPEED_HIGH) { -+ j = 1; -+ /* TODO - check this */ -+ inc = (8 + qh->interval - 1) / qh->interval; -+ for (i = 0; i < inc; i++) { -+ hc->schinfo |= j; -+ j = j << qh->interval; -+ } -+ } else { -+ hc->schinfo = 0xff; -+ } -+} -+ -+#if 1 -+void dump_frame_list(dwc_otg_hcd_t * hcd) -+{ -+ int i = 0; -+ DWC_PRINTF("--FRAME LIST (hex) --\n"); -+ for (i = 0; i < MAX_FRLIST_EN_NUM; i++) { -+ DWC_PRINTF("%x\t", hcd->frame_list[i]); -+ if (!(i % 8) && i) -+ DWC_PRINTF("\n"); -+ } -+ DWC_PRINTF("\n----\n"); -+ -+} -+#endif -+ -+static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ dwc_irqflags_t flags; -+ dwc_spinlock_t *channel_lock = hcd->channel_lock; -+ -+ dwc_hc_t *hc = qh->channel; -+ if (dwc_qh_is_non_per(qh)) { -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ if (!microframe_schedule) -+ hcd->non_periodic_channels--; -+ else -+ hcd->available_host_channels++; -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ } else -+ update_frame_list(hcd, qh, 0); -+ -+ /* -+ * The condition is added to prevent double cleanup try in case of device -+ * disconnect. See channel cleanup in dwc_otg_hcd_disconnect_cb(). -+ */ -+ if (hc->qh) { -+ dwc_otg_hc_cleanup(hcd->core_if, hc); -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); -+ hc->qh = NULL; -+ } -+ -+ qh->channel = NULL; -+ qh->ntd = 0; -+ -+ if (qh->desc_list) { -+ dwc_memset(qh->desc_list, 0x00, -+ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); -+ } -+} -+ -+/** -+ * Initializes a QH structure's Descriptor DMA related members. -+ * Allocates memory for descriptor list. -+ * On first periodic QH, allocates memory for FrameList -+ * and enables periodic scheduling. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ int retval = 0; -+ -+ if (qh->do_split) { -+ DWC_ERROR("SPLIT Transfers are not supported in Descriptor DMA.\n"); -+ return -1; -+ } -+ -+ retval = desc_list_alloc(dev, qh); -+ -+ if ((retval == 0) -+ && (qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT)) { -+ if (!hcd->frame_list) { -+ retval = frame_list_alloc(hcd); -+ /* Enable periodic schedule on first periodic QH */ -+ if (retval == 0) -+ per_sched_enable(hcd, MAX_FRLIST_EN_NUM); -+ } -+ } -+ -+ qh->ntd = 0; -+ -+ return retval; -+} -+ -+/** -+ * Frees descriptor list memory associated with the QH. -+ * If QH is periodic and the last, frees FrameList memory -+ * and disables periodic scheduling. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ */ -+void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ desc_list_free(dev, qh); -+ -+ /* -+ * Channel still assigned due to some reasons. -+ * Seen on Isoc URB dequeue. Channel halted but no subsequent -+ * ChHalted interrupt to release the channel. Afterwards -+ * when it comes here from endpoint disable routine -+ * channel remains assigned. -+ */ -+ if (qh->channel) -+ release_channel_ddma(hcd, qh); -+ -+ if ((qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT) -+ && (microframe_schedule || !hcd->periodic_channels) && hcd->frame_list) { -+ -+ per_sched_disable(hcd); -+ frame_list_free(hcd); -+ } -+} -+ -+static uint8_t frame_to_desc_idx(dwc_otg_qh_t * qh, uint16_t frame_idx) -+{ -+ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { -+ /* -+ * Descriptor set(8 descriptors) index -+ * which is 8-aligned. -+ */ -+ return (frame_idx & ((MAX_DMA_DESC_NUM_HS_ISOC / 8) - 1)) * 8; -+ } else { -+ return (frame_idx & (MAX_DMA_DESC_NUM_GENERIC - 1)); -+ } -+} -+ -+/* -+ * Determine starting frame for Isochronous transfer. -+ * Few frames skipped to prevent race condition with HC. -+ */ -+static uint8_t calc_starting_frame(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ uint8_t * skip_frames) -+{ -+ uint16_t frame = 0; -+ hcd->frame_number = dwc_otg_hcd_get_frame_number(hcd); -+ -+ /* sched_frame is always frame number(not uFrame) both in FS and HS !! */ -+ -+ /* -+ * skip_frames is used to limit activated descriptors number -+ * to avoid the situation when HC services the last activated -+ * descriptor firstly. -+ * Example for FS: -+ * Current frame is 1, scheduled frame is 3. Since HC always fetches the descriptor -+ * corresponding to curr_frame+1, the descriptor corresponding to frame 2 -+ * will be fetched. If the number of descriptors is max=64 (or greather) the -+ * list will be fully programmed with Active descriptors and it is possible -+ * case(rare) that the latest descriptor(considering rollback) corresponding -+ * to frame 2 will be serviced first. HS case is more probable because, in fact, -+ * up to 11 uframes(16 in the code) may be skipped. -+ */ -+ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { -+ /* -+ * Consider uframe counter also, to start xfer asap. -+ * If half of the frame elapsed skip 2 frames otherwise -+ * just 1 frame. -+ * Starting descriptor index must be 8-aligned, so -+ * if the current frame is near to complete the next one -+ * is skipped as well. -+ */ -+ -+ if (dwc_micro_frame_num(hcd->frame_number) >= 5) { -+ *skip_frames = 2 * 8; -+ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); -+ } else { -+ *skip_frames = 1 * 8; -+ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); -+ } -+ -+ frame = dwc_full_frame_num(frame); -+ } else { -+ /* -+ * Two frames are skipped for FS - the current and the next. -+ * But for descriptor programming, 1 frame(descriptor) is enough, -+ * see example above. -+ */ -+ *skip_frames = 1; -+ frame = dwc_frame_num_inc(hcd->frame_number, 2); -+ } -+ -+ return frame; -+} -+ -+/* -+ * Calculate initial descriptor index for isochronous transfer -+ * based on scheduled frame. -+ */ -+static uint8_t recalc_initial_desc_idx(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ uint16_t frame = 0, fr_idx, fr_idx_tmp; -+ uint8_t skip_frames = 0; -+ /* -+ * With current ISOC processing algorithm the channel is being -+ * released when no more QTDs in the list(qh->ntd == 0). -+ * Thus this function is called only when qh->ntd == 0 and qh->channel == 0. -+ * -+ * So qh->channel != NULL branch is not used and just not removed from the -+ * source file. It is required for another possible approach which is, -+ * do not disable and release the channel when ISOC session completed, -+ * just move QH to inactive schedule until new QTD arrives. -+ * On new QTD, the QH moved back to 'ready' schedule, -+ * starting frame and therefore starting desc_index are recalculated. -+ * In this case channel is released only on ep_disable. -+ */ -+ -+ /* Calculate starting descriptor index. For INTERRUPT endpoint it is always 0. */ -+ if (qh->channel) { -+ frame = calc_starting_frame(hcd, qh, &skip_frames); -+ /* -+ * Calculate initial descriptor index based on FrameList current bitmap -+ * and servicing period. -+ */ -+ fr_idx_tmp = frame_list_idx(frame); -+ fr_idx = -+ (MAX_FRLIST_EN_NUM + frame_list_idx(qh->sched_frame) - -+ fr_idx_tmp) -+ % frame_incr_val(qh); -+ fr_idx = (fr_idx + fr_idx_tmp) % MAX_FRLIST_EN_NUM; -+ } else { -+ qh->sched_frame = calc_starting_frame(hcd, qh, &skip_frames); -+ fr_idx = frame_list_idx(qh->sched_frame); -+ } -+ -+ qh->td_first = qh->td_last = frame_to_desc_idx(qh, fr_idx); -+ -+ return skip_frames; -+} -+ -+#define ISOC_URB_GIVEBACK_ASAP -+ -+#define MAX_ISOC_XFER_SIZE_FS 1023 -+#define MAX_ISOC_XFER_SIZE_HS 3072 -+#define DESCNUM_THRESHOLD 4 -+ -+static void init_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ uint8_t skip_frames) -+{ -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ dwc_otg_qtd_t *qtd; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ uint16_t idx, inc, n_desc, ntd_max, max_xfer_size; -+ -+ idx = qh->td_last; -+ inc = qh->interval; -+ n_desc = 0; -+ -+ ntd_max = (max_desc_num(qh) + qh->interval - 1) / qh->interval; -+ if (skip_frames && !qh->channel) -+ ntd_max = ntd_max - skip_frames / qh->interval; -+ -+ max_xfer_size = -+ (qh->dev_speed == -+ DWC_OTG_EP_SPEED_HIGH) ? MAX_ISOC_XFER_SIZE_HS : -+ MAX_ISOC_XFER_SIZE_FS; -+ -+ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { -+ while ((qh->ntd < ntd_max) -+ && (qtd->isoc_frame_index_last < -+ qtd->urb->packet_count)) { -+ -+ dma_desc = &qh->desc_list[idx]; -+ dwc_memset(dma_desc, 0x00, sizeof(dwc_otg_host_dma_desc_t)); -+ -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index_last]; -+ -+ if (frame_desc->length > max_xfer_size) -+ qh->n_bytes[idx] = max_xfer_size; -+ else -+ qh->n_bytes[idx] = frame_desc->length; -+ dma_desc->status.b_isoc.n_bytes = qh->n_bytes[idx]; -+ dma_desc->status.b_isoc.a = 1; -+ dma_desc->status.b_isoc.sts = 0; -+ -+ dma_desc->buf = qtd->urb->dma + frame_desc->offset; -+ -+ qh->ntd++; -+ -+ qtd->isoc_frame_index_last++; -+ -+#ifdef ISOC_URB_GIVEBACK_ASAP -+ /* -+ * Set IOC for each descriptor corresponding to the -+ * last frame of the URB. -+ */ -+ if (qtd->isoc_frame_index_last == -+ qtd->urb->packet_count) -+ dma_desc->status.b_isoc.ioc = 1; -+ -+#endif -+ idx = desclist_idx_inc(idx, inc, qh->dev_speed); -+ n_desc++; -+ -+ } -+ qtd->in_process = 1; -+ } -+ -+ qh->td_last = idx; -+ -+#ifdef ISOC_URB_GIVEBACK_ASAP -+ /* Set IOC for the last descriptor if descriptor list is full */ -+ if (qh->ntd == ntd_max) { -+ idx = desclist_idx_dec(qh->td_last, inc, qh->dev_speed); -+ qh->desc_list[idx].status.b_isoc.ioc = 1; -+ } -+#else -+ /* -+ * Set IOC bit only for one descriptor. -+ * Always try to be ahead of HW processing, -+ * i.e. on IOC generation driver activates next descriptors but -+ * core continues to process descriptors followed the one with IOC set. -+ */ -+ -+ if (n_desc > DESCNUM_THRESHOLD) { -+ /* -+ * Move IOC "up". Required even if there is only one QTD -+ * in the list, cause QTDs migth continue to be queued, -+ * but during the activation it was only one queued. -+ * Actually more than one QTD might be in the list if this function called -+ * from XferCompletion - QTDs was queued during HW processing of the previous -+ * descriptor chunk. -+ */ -+ idx = dwc_desclist_idx_dec(idx, inc * ((qh->ntd + 1) / 2), qh->dev_speed); -+ } else { -+ /* -+ * Set the IOC for the latest descriptor -+ * if either number of descriptor is not greather than threshold -+ * or no more new descriptors activated. -+ */ -+ idx = dwc_desclist_idx_dec(qh->td_last, inc, qh->dev_speed); -+ } -+ -+ qh->desc_list[idx].status.b_isoc.ioc = 1; -+#endif -+} -+ -+static void init_non_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ -+ dwc_hc_t *hc; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ dwc_otg_qtd_t *qtd; -+ int num_packets, len, n_desc = 0; -+ -+ hc = qh->channel; -+ -+ /* -+ * Start with hc->xfer_buff initialized in -+ * assign_and_init_hc(), then if SG transfer consists of multiple URBs, -+ * this pointer re-assigned to the buffer of the currently processed QTD. -+ * For non-SG request there is always one QTD active. -+ */ -+ -+ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { -+ -+ if (n_desc) { -+ /* SG request - more than 1 QTDs */ -+ hc->xfer_buff = (uint8_t *)qtd->urb->dma + qtd->urb->actual_length; -+ hc->xfer_len = qtd->urb->length - qtd->urb->actual_length; -+ } -+ -+ qtd->n_desc = 0; -+ -+ do { -+ dma_desc = &qh->desc_list[n_desc]; -+ len = hc->xfer_len; -+ -+ if (len > MAX_DMA_DESC_SIZE) -+ len = MAX_DMA_DESC_SIZE - hc->max_packet + 1; -+ -+ if (hc->ep_is_in) { -+ if (len > 0) { -+ num_packets = (len + hc->max_packet - 1) / hc->max_packet; -+ } else { -+ /* Need 1 packet for transfer length of 0. */ -+ num_packets = 1; -+ } -+ /* Always program an integral # of max packets for IN transfers. */ -+ len = num_packets * hc->max_packet; -+ } -+ -+ dma_desc->status.b.n_bytes = len; -+ -+ qh->n_bytes[n_desc] = len; -+ -+ if ((qh->ep_type == UE_CONTROL) -+ && (qtd->control_phase == DWC_OTG_CONTROL_SETUP)) -+ dma_desc->status.b.sup = 1; /* Setup Packet */ -+ -+ dma_desc->status.b.a = 1; /* Active descriptor */ -+ dma_desc->status.b.sts = 0; -+ -+ dma_desc->buf = -+ ((unsigned long)hc->xfer_buff & 0xffffffff); -+ -+ /* -+ * Last descriptor(or single) of IN transfer -+ * with actual size less than MaxPacket. -+ */ -+ if (len > hc->xfer_len) { -+ hc->xfer_len = 0; -+ } else { -+ hc->xfer_buff += len; -+ hc->xfer_len -= len; -+ } -+ -+ qtd->n_desc++; -+ n_desc++; -+ } -+ while ((hc->xfer_len > 0) && (n_desc != MAX_DMA_DESC_NUM_GENERIC)); -+ -+ -+ qtd->in_process = 1; -+ -+ if (qh->ep_type == UE_CONTROL) -+ break; -+ -+ if (n_desc == MAX_DMA_DESC_NUM_GENERIC) -+ break; -+ } -+ -+ if (n_desc) { -+ /* Request Transfer Complete interrupt for the last descriptor */ -+ qh->desc_list[n_desc - 1].status.b.ioc = 1; -+ /* End of List indicator */ -+ qh->desc_list[n_desc - 1].status.b.eol = 1; -+ -+ hc->ntd = n_desc; -+ } -+} -+ -+/** -+ * For Control and Bulk endpoints initializes descriptor list -+ * and starts the transfer. -+ * -+ * For Interrupt and Isochronous endpoints initializes descriptor list -+ * then updates FrameList, marking appropriate entries as active. -+ * In case of Isochronous, the starting descriptor index is calculated based -+ * on the scheduled frame, but only on the first transfer descriptor within a session. -+ * Then starts the transfer via enabling the channel. -+ * For Isochronous endpoint the channel is not halted on XferComplete -+ * interrupt so remains assigned to the endpoint(QH) until session is done. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ /* Channel is already assigned */ -+ dwc_hc_t *hc = qh->channel; -+ uint8_t skip_frames = 0; -+ -+ switch (hc->ep_type) { -+ case DWC_OTG_EP_TYPE_CONTROL: -+ case DWC_OTG_EP_TYPE_BULK: -+ init_non_isoc_dma_desc(hcd, qh); -+ -+ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); -+ break; -+ case DWC_OTG_EP_TYPE_INTR: -+ init_non_isoc_dma_desc(hcd, qh); -+ -+ update_frame_list(hcd, qh, 1); -+ -+ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); -+ break; -+ case DWC_OTG_EP_TYPE_ISOC: -+ -+ if (!qh->ntd) -+ skip_frames = recalc_initial_desc_idx(hcd, qh); -+ -+ init_isoc_dma_desc(hcd, qh, skip_frames); -+ -+ if (!hc->xfer_started) { -+ -+ update_frame_list(hcd, qh, 1); -+ -+ /* -+ * Always set to max, instead of actual size. -+ * Otherwise ntd will be changed with -+ * channel being enabled. Not recommended. -+ * -+ */ -+ hc->ntd = max_desc_num(qh); -+ /* Enable channel only once for ISOC */ -+ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); -+ } -+ -+ break; -+ default: -+ -+ break; -+ } -+} -+ -+static void complete_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status) -+{ -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ dwc_otg_qh_t *qh; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ uint16_t idx, remain; -+ uint8_t urb_compl; -+ -+ qh = hc->qh; -+ idx = qh->td_first; -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) -+ qtd->in_process = 0; -+ return; -+ } else if ((halt_status == DWC_OTG_HC_XFER_AHB_ERR) || -+ (halt_status == DWC_OTG_HC_XFER_BABBLE_ERR)) { -+ /* -+ * Channel is halted in these error cases. -+ * Considered as serious issues. -+ * Complete all URBs marking all frames as failed, -+ * irrespective whether some of the descriptors(frames) succeeded or no. -+ * Pass error code to completion routine as well, to -+ * update urb->status, some of class drivers might use it to stop -+ * queing transfer requests. -+ */ -+ int err = (halt_status == DWC_OTG_HC_XFER_AHB_ERR) -+ ? (-DWC_E_IO) -+ : (-DWC_E_OVERFLOW); -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { -+ for (idx = 0; idx < qtd->urb->packet_count; idx++) { -+ frame_desc = &qtd->urb->iso_descs[idx]; -+ frame_desc->status = err; -+ } -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, err); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ } -+ return; -+ } -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { -+ -+ if (!qtd->in_process) -+ break; -+ -+ urb_compl = 0; -+ -+ do { -+ -+ dma_desc = &qh->desc_list[idx]; -+ -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ remain = hc->ep_is_in ? dma_desc->status.b_isoc.n_bytes : 0; -+ -+ if (dma_desc->status.b_isoc.sts == DMA_DESC_STS_PKTERR) { -+ /* -+ * XactError or, unable to complete all the transactions -+ * in the scheduled micro-frame/frame, -+ * both indicated by DMA_DESC_STS_PKTERR. -+ */ -+ qtd->urb->error_count++; -+ frame_desc->actual_length = qh->n_bytes[idx] - remain; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ } else { -+ /* Success */ -+ -+ frame_desc->actual_length = qh->n_bytes[idx] - remain; -+ frame_desc->status = 0; -+ } -+ -+ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { -+ /* -+ * urb->status is not used for isoc transfers here. -+ * The individual frame_desc status are used instead. -+ */ -+ -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ -+ /* -+ * This check is necessary because urb_dequeue can be called -+ * from urb complete callback(sound driver example). -+ * All pending URBs are dequeued there, so no need for -+ * further processing. -+ */ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ return; -+ } -+ -+ urb_compl = 1; -+ -+ } -+ -+ qh->ntd--; -+ -+ /* Stop if IOC requested descriptor reached */ -+ if (dma_desc->status.b_isoc.ioc) { -+ idx = desclist_idx_inc(idx, qh->interval, hc->speed); -+ goto stop_scan; -+ } -+ -+ idx = desclist_idx_inc(idx, qh->interval, hc->speed); -+ -+ if (urb_compl) -+ break; -+ } -+ while (idx != qh->td_first); -+ } -+stop_scan: -+ qh->td_first = idx; -+} -+ -+uint8_t update_non_isoc_urb_state_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_host_dma_desc_t * dma_desc, -+ dwc_otg_halt_status_e halt_status, -+ uint32_t n_bytes, uint8_t * xfer_done) -+{ -+ -+ uint16_t remain = hc->ep_is_in ? dma_desc->status.b.n_bytes : 0; -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ -+ if (halt_status == DWC_OTG_HC_XFER_AHB_ERR) { -+ urb->status = -DWC_E_IO; -+ return 1; -+ } -+ if (dma_desc->status.b.sts == DMA_DESC_STS_PKTERR) { -+ switch (halt_status) { -+ case DWC_OTG_HC_XFER_STALL: -+ urb->status = -DWC_E_PIPE; -+ break; -+ case DWC_OTG_HC_XFER_BABBLE_ERR: -+ urb->status = -DWC_E_OVERFLOW; -+ break; -+ case DWC_OTG_HC_XFER_XACT_ERR: -+ urb->status = -DWC_E_PROTOCOL; -+ break; -+ default: -+ DWC_ERROR("%s: Unhandled descriptor error status (%d)\n", __func__, -+ halt_status); -+ break; -+ } -+ return 1; -+ } -+ -+ if (dma_desc->status.b.a == 1) { -+ DWC_DEBUGPL(DBG_HCDV, -+ "Active descriptor encountered on channel %d\n", -+ hc->hc_num); -+ return 0; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL) { -+ if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { -+ urb->actual_length += n_bytes - remain; -+ if (remain || urb->actual_length == urb->length) { -+ /* -+ * For Control Data stage do not set urb->status=0 to prevent -+ * URB callback. Set it when Status phase done. See below. -+ */ -+ *xfer_done = 1; -+ } -+ -+ } else if (qtd->control_phase == DWC_OTG_CONTROL_STATUS) { -+ urb->status = 0; -+ *xfer_done = 1; -+ } -+ /* No handling for SETUP stage */ -+ } else { -+ /* BULK and INTR */ -+ urb->actual_length += n_bytes - remain; -+ if (remain || urb->actual_length == urb->length) { -+ urb->status = 0; -+ *xfer_done = 1; -+ } -+ } -+ -+ return 0; -+} -+ -+static void complete_non_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status) -+{ -+ dwc_otg_hcd_urb_t *urb = NULL; -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ dwc_otg_qh_t *qh; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ uint32_t n_bytes, n_desc, i; -+ uint8_t failed = 0, xfer_done; -+ -+ n_desc = 0; -+ -+ qh = hc->qh; -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { -+ qtd->in_process = 0; -+ } -+ return; -+ } -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { -+ -+ urb = qtd->urb; -+ -+ n_bytes = 0; -+ xfer_done = 0; -+ -+ for (i = 0; i < qtd->n_desc; i++) { -+ dma_desc = &qh->desc_list[n_desc]; -+ -+ n_bytes = qh->n_bytes[n_desc]; -+ -+ failed = -+ update_non_isoc_urb_state_ddma(hcd, hc, qtd, -+ dma_desc, -+ halt_status, n_bytes, -+ &xfer_done); -+ -+ if (failed -+ || (xfer_done -+ && (urb->status != -DWC_E_IN_PROGRESS))) { -+ -+ hcd->fops->complete(hcd, urb->priv, urb, -+ urb->status); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ -+ if (failed) -+ goto stop_scan; -+ } else if (qh->ep_type == UE_CONTROL) { -+ if (qtd->control_phase == DWC_OTG_CONTROL_SETUP) { -+ if (urb->length > 0) { -+ qtd->control_phase = DWC_OTG_CONTROL_DATA; -+ } else { -+ qtd->control_phase = DWC_OTG_CONTROL_STATUS; -+ } -+ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction done\n"); -+ } else if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { -+ if (xfer_done) { -+ qtd->control_phase = DWC_OTG_CONTROL_STATUS; -+ DWC_DEBUGPL(DBG_HCDV, " Control data transfer done\n"); -+ } else if (i + 1 == qtd->n_desc) { -+ /* -+ * Last descriptor for Control data stage which is -+ * not completed yet. -+ */ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ } -+ } -+ } -+ -+ n_desc++; -+ } -+ -+ } -+ -+stop_scan: -+ -+ if (qh->ep_type != UE_CONTROL) { -+ /* -+ * Resetting the data toggle for bulk -+ * and interrupt endpoints in case of stall. See handle_hc_stall_intr() -+ */ -+ if (halt_status == DWC_OTG_HC_XFER_STALL) -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ else -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ } -+ -+ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { -+ hcint_data_t hcint; -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ if (hcint.b.nyet) { -+ /* -+ * Got a NYET on the last transaction of the transfer. It -+ * means that the endpoint should be in the PING state at the -+ * beginning of the next transfer. -+ */ -+ qh->ping_state = 1; -+ clear_hc_int(hc_regs, nyet); -+ } -+ -+ } -+ -+} -+ -+/** -+ * This function is called from interrupt handlers. -+ * Scans the descriptor list, updates URB's status and -+ * calls completion routine for the URB if it's done. -+ * Releases the channel to be used by other transfers. -+ * In case of Isochronous endpoint the channel is not halted until -+ * the end of the session, i.e. QTD list is empty. -+ * If periodic channel released the FrameList is updated accordingly. -+ * -+ * Calls transaction selection routines to activate pending transfers. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param hc Host channel, the transfer is completed on. -+ * @param hc_regs Host channel registers. -+ * @param halt_status Reason the channel is being halted, -+ * or just XferComplete for isochronous transfer -+ */ -+void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status) -+{ -+ uint8_t continue_isoc_xfer = 0; -+ dwc_otg_transaction_type_e tr_type; -+ dwc_otg_qh_t *qh = hc->qh; -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ -+ complete_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); -+ -+ /* Release the channel if halted or session completed */ -+ if (halt_status != DWC_OTG_HC_XFER_COMPLETE || -+ DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ -+ /* Halt the channel if session completed */ -+ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { -+ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); -+ } -+ -+ release_channel_ddma(hcd, qh); -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } else { -+ /* Keep in assigned schedule to continue transfer */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, -+ &qh->qh_list_entry); -+ continue_isoc_xfer = 1; -+ -+ } -+ /** @todo Consider the case when period exceeds FrameList size. -+ * Frame Rollover interrupt should be used. -+ */ -+ } else { -+ /* Scan descriptor list to complete the URB(s), then release the channel */ -+ complete_non_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); -+ -+ release_channel_ddma(hcd, qh); -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ -+ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ /* Add back to inactive non-periodic schedule on normal completion */ -+ dwc_otg_hcd_qh_add(hcd, qh); -+ } -+ -+ } -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE || continue_isoc_xfer) { -+ if (continue_isoc_xfer) { -+ if (tr_type == DWC_OTG_TRANSACTION_NONE) { -+ tr_type = DWC_OTG_TRANSACTION_PERIODIC; -+ } else if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC) { -+ tr_type = DWC_OTG_TRANSACTION_ALL; -+ } -+ } -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ } -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h -new file mode 100644 -index 0000000000000000000000000000000000000000..fb57db09378f4ab95d57cb58aa570a915ccb61c3 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h -@@ -0,0 +1,417 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $ -+ * $Revision: #12 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+#ifndef __DWC_HCD_IF_H__ -+#define __DWC_HCD_IF_H__ -+ -+#include "dwc_otg_core_if.h" -+ -+/** @file -+ * This file defines DWC_OTG HCD Core API. -+ */ -+ -+struct dwc_otg_hcd; -+typedef struct dwc_otg_hcd dwc_otg_hcd_t; -+ -+struct dwc_otg_hcd_urb; -+typedef struct dwc_otg_hcd_urb dwc_otg_hcd_urb_t; -+ -+/** @name HCD Function Driver Callbacks */ -+/** @{ */ -+ -+/** This function is called whenever core switches to host mode. */ -+typedef int (*dwc_otg_hcd_start_cb_t) (dwc_otg_hcd_t * hcd); -+ -+/** This function is called when device has been disconnected */ -+typedef int (*dwc_otg_hcd_disconnect_cb_t) (dwc_otg_hcd_t * hcd); -+ -+/** Wrapper provides this function to HCD to core, so it can get hub information to which device is connected */ -+typedef int (*dwc_otg_hcd_hub_info_from_urb_cb_t) (dwc_otg_hcd_t * hcd, -+ void *urb_handle, -+ uint32_t * hub_addr, -+ uint32_t * port_addr); -+/** Via this function HCD core gets device speed */ -+typedef int (*dwc_otg_hcd_speed_from_urb_cb_t) (dwc_otg_hcd_t * hcd, -+ void *urb_handle); -+ -+/** This function is called when urb is completed */ -+typedef int (*dwc_otg_hcd_complete_urb_cb_t) (dwc_otg_hcd_t * hcd, -+ void *urb_handle, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int32_t status); -+ -+/** Via this function HCD core gets b_hnp_enable parameter */ -+typedef int (*dwc_otg_hcd_get_b_hnp_enable) (dwc_otg_hcd_t * hcd); -+ -+struct dwc_otg_hcd_function_ops { -+ dwc_otg_hcd_start_cb_t start; -+ dwc_otg_hcd_disconnect_cb_t disconnect; -+ dwc_otg_hcd_hub_info_from_urb_cb_t hub_info; -+ dwc_otg_hcd_speed_from_urb_cb_t speed; -+ dwc_otg_hcd_complete_urb_cb_t complete; -+ dwc_otg_hcd_get_b_hnp_enable get_b_hnp_enable; -+}; -+/** @} */ -+ -+/** @name HCD Core API */ -+/** @{ */ -+/** This function allocates dwc_otg_hcd structure and returns pointer on it. */ -+extern dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void); -+ -+/** This function should be called to initiate HCD Core. -+ * -+ * @param hcd The HCD -+ * @param core_if The DWC_OTG Core -+ * -+ * Returns -DWC_E_NO_MEMORY if no enough memory. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if); -+ -+/** Frees HCD -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd); -+ -+/** This function should be called on every hardware interrupt. -+ * -+ * @param dwc_otg_hcd The HCD -+ * -+ * Returns non zero if interrupt is handled -+ * Return 0 if interrupt is not handled -+ */ -+extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+ -+/** This function is used to handle the fast interrupt -+ * -+ */ -+extern void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void); -+ -+/** -+ * Returns private data set by -+ * dwc_otg_hcd_set_priv_data function. -+ * -+ * @param hcd The HCD -+ */ -+extern void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Set private data. -+ * -+ * @param hcd The HCD -+ * @param priv_data pointer to be stored in private data -+ */ -+extern void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data); -+ -+/** -+ * This function initializes the HCD Core. -+ * -+ * @param hcd The HCD -+ * @param fops The Function Driver Operations data structure containing pointers to all callbacks. -+ * -+ * Returns -DWC_E_NO_DEVICE if Core is currently is in device mode. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, -+ struct dwc_otg_hcd_function_ops *fops); -+ -+/** -+ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are -+ * stopped. -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Handles hub class-specific requests. -+ * -+ * @param dwc_otg_hcd The HCD -+ * @param typeReq Request Type -+ * @param wValue wValue from control request -+ * @param wIndex wIndex from control request -+ * @param buf data buffer -+ * @param wLength data buffer length -+ * -+ * Returns -DWC_E_INVALID if invalid argument is passed -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint16_t typeReq, uint16_t wValue, -+ uint16_t wIndex, uint8_t * buf, -+ uint16_t wLength); -+ -+/** -+ * Returns otg port number. -+ * -+ * @param hcd The HCD -+ */ -+extern uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Returns OTG version - either 1.3 or 2.0. -+ * -+ * @param core_if The core_if structure pointer -+ */ -+extern uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Returns 1 if currently core is acting as B host, and 0 otherwise. -+ * -+ * @param hcd The HCD -+ */ -+extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Returns current frame number. -+ * -+ * @param hcd The HCD -+ */ -+extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Dumps hcd state. -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Dump the average frame remaining at SOF. This can be used to -+ * determine average interrupt latency. Frame remaining is also shown for -+ * start transfer and two additional sample points. -+ * Currently this function is not implemented. -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Sends LPM transaction to the local device. -+ * -+ * @param hcd The HCD -+ * @param devaddr Device Address -+ * @param hird Host initiated resume duration -+ * @param bRemoteWake Value of bRemoteWake field in LPM transaction -+ * -+ * Returns negative value if sending LPM transaction was not succeeded. -+ * Returns 0 on success. -+ */ -+extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, -+ uint8_t hird, uint8_t bRemoteWake); -+ -+/* URB interface */ -+ -+/** -+ * Allocates memory for dwc_otg_hcd_urb structure. -+ * Allocated memory should be freed by call of DWC_FREE. -+ * -+ * @param hcd The HCD -+ * @param iso_desc_count Count of ISOC descriptors -+ * @param atomic_alloc Specefies whether to perform atomic allocation. -+ */ -+extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, -+ int iso_desc_count, -+ int atomic_alloc); -+ -+/** -+ * Set pipe information in URB. -+ * -+ * @param hcd_urb DWC_OTG URB -+ * @param devaddr Device Address -+ * @param ep_num Endpoint Number -+ * @param ep_type Endpoint Type -+ * @param ep_dir Endpoint Direction -+ * @param mps Max Packet Size -+ */ -+extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb, -+ uint8_t devaddr, uint8_t ep_num, -+ uint8_t ep_type, uint8_t ep_dir, -+ uint16_t mps); -+ -+/* Transfer flags */ -+#define URB_GIVEBACK_ASAP 0x1 -+#define URB_SEND_ZERO_PACKET 0x2 -+ -+/** -+ * Sets dwc_otg_hcd_urb parameters. -+ * -+ * @param urb DWC_OTG URB allocated by dwc_otg_hcd_urb_alloc function. -+ * @param urb_handle Unique handle for request, this will be passed back -+ * to function driver in completion callback. -+ * @param buf The buffer for the data -+ * @param dma The DMA buffer for the data -+ * @param buflen Transfer length -+ * @param sp Buffer for setup data -+ * @param sp_dma DMA address of setup data buffer -+ * @param flags Transfer flags -+ * @param interval Polling interval for interrupt or isochronous transfers. -+ */ -+extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb, -+ void *urb_handle, void *buf, -+ dwc_dma_t dma, uint32_t buflen, void *sp, -+ dwc_dma_t sp_dma, uint32_t flags, -+ uint16_t interval); -+ -+/** Gets status from dwc_otg_hcd_urb -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb); -+ -+/** Gets actual length from dwc_otg_hcd_urb -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * -+ dwc_otg_urb); -+ -+/** Gets error count from dwc_otg_hcd_urb. Only for ISOC URBs -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * -+ dwc_otg_urb); -+ -+/** Set ISOC descriptor offset and length -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param desc_num ISOC descriptor number -+ * @param offset Offset from beginig of buffer. -+ * @param length Transaction length -+ */ -+extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int desc_num, uint32_t offset, -+ uint32_t length); -+ -+/** Get status of ISOC descriptor, specified by desc_num -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param desc_num ISOC descriptor number -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * -+ dwc_otg_urb, int desc_num); -+ -+/** Get actual length of ISOC descriptor, specified by desc_num -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param desc_num ISOC descriptor number -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * -+ dwc_otg_urb, -+ int desc_num); -+ -+/** Queue URB. After transfer is completes, the complete callback will be called with the URB status -+ * -+ * @param dwc_otg_hcd The HCD -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param ep_handle Out parameter for returning endpoint handle -+ * @param atomic_alloc Flag to do atomic allocation if needed -+ * -+ * Returns -DWC_E_NO_DEVICE if no device is connected. -+ * Returns -DWC_E_NO_MEMORY if there is no enough memory. -+ * Returns 0 on success. -+ */ -+extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, -+ void **ep_handle, int atomic_alloc); -+ -+/** De-queue the specified URB -+ * -+ * @param dwc_otg_hcd The HCD -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb); -+ -+/** Frees resources in the DWC_otg controller related to a given endpoint. -+ * Any URBs for the endpoint must already be dequeued. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function -+ * @param retry Number of retries if there are queued transfers. -+ * -+ * Returns -DWC_E_INVALID if invalid arguments are passed. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, -+ int retry); -+ -+/* Resets the data toggle in qh structure. This function can be called from -+ * usb_clear_halt routine. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function -+ * -+ * Returns -DWC_E_INVALID if invalid arguments are passed. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle); -+ -+/** Returns 1 if status of specified port is changed and 0 otherwise. -+ * -+ * @param hcd The HCD -+ * @param port Port number -+ */ -+extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port); -+ -+/** Call this function to check if bandwidth was allocated for specified endpoint. -+ * Only for ISOC and INTERRUPT endpoints. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle -+ */ -+extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, -+ void *ep_handle); -+ -+/** Call this function to check if bandwidth was freed for specified endpoint. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle -+ */ -+extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle); -+ -+/** Returns bandwidth allocated for specified endpoint in microseconds. -+ * Only for ISOC and INTERRUPT endpoints. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle -+ */ -+extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, -+ void *ep_handle); -+ -+/** @} */ -+ -+#endif /* __DWC_HCD_IF_H__ */ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e6b38ac330b72152204c2a6879c20f0ce02ac2e5 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -0,0 +1,2727 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ -+ * $Revision: #89 $ -+ * $Date: 2011/10/20 $ -+ * $Change: 1869487 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+ -+#include -+#include -+ -+ -+extern bool microframe_schedule; -+ -+/** @file -+ * This file contains the implementation of the HCD Interrupt handlers. -+ */ -+ -+int fiq_done, int_done; -+ -+#ifdef FIQ_DEBUG -+char buffer[1000*16]; -+int wptr; -+void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) -+{ -+ FIQDBG_T dbg_lvl_req = FIQDBG_PORTHUB; -+ va_list args; -+ char text[17]; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(dwc_regs_base + 0x408) }; -+ -+ if(dbg_lvl & dbg_lvl_req || dbg_lvl == FIQDBG_ERR) -+ { -+ local_fiq_disable(); -+ snprintf(text, 9, "%4d%d:%d ", hfnum.b.frnum/8, hfnum.b.frnum%8, 8 - hfnum.b.frrem/937); -+ va_start(args, fmt); -+ vsnprintf(text+8, 9, fmt, args); -+ va_end(args); -+ -+ memcpy(buffer + wptr, text, 16); -+ wptr = (wptr + 16) % sizeof(buffer); -+ local_fiq_enable(); -+ } -+} -+#endif -+ -+/** This function handles interrupts for the HCD. */ -+int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ int retval = 0; -+ static int last_time; -+ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk; -+ hfnum_data_t hfnum; -+ haintmsk_data_t haintmsk; -+ -+#ifdef DEBUG -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ -+#endif -+ -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ -+ /* Exit from ISR if core is hibernated */ -+ if (core_if->hibernation_suspend == 1) { -+ goto exit_handler_routine; -+ } -+ DWC_SPINLOCK(dwc_otg_hcd->lock); -+ /* Check if HOST Mode */ -+ if (dwc_otg_is_host_mode(core_if)) { -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ /* Pull in from the FIQ's disabled mask */ -+ gintmsk.d32 = gintmsk.d32 | ~(dwc_otg_hcd->fiq_state->gintmsk_saved.d32); -+ dwc_otg_hcd->fiq_state->gintmsk_saved.d32 = ~0; -+ } -+ -+ if (fiq_fsm_enable && ( 0x0000FFFF & ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint))) { -+ gintsts.b.hcintr = 1; -+ } -+ -+ /* Danger will robinson: fake a SOF if necessary */ -+ if (fiq_fsm_enable && (dwc_otg_hcd->fiq_state->gintmsk_saved.b.sofintr == 1)) { -+ gintsts.b.sofintr = 1; -+ } -+ gintsts.d32 &= gintmsk.d32; -+ -+ if (fiq_enable) { -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } -+ -+ if (!gintsts.d32) { -+ goto exit_handler_routine; -+ } -+ -+#ifdef DEBUG -+ // We should be OK doing this because the common interrupts should already have been serviced -+ /* Don't print debug message in the interrupt handler on SOF */ -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ DWC_DEBUGPL(DBG_HCDI, "\n"); -+#endif -+ -+#ifdef DEBUG -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ DWC_DEBUGPL(DBG_HCDI, -+ "DWC OTG HCD Interrupt Detected gintsts&gintmsk=0x%08x core_if=%p\n", -+ gintsts.d32, core_if); -+#endif -+ hfnum.d32 = DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs->hfnum); -+ if (gintsts.b.sofintr) { -+ retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd); -+ } -+ -+ if (gintsts.b.rxstsqlvl) { -+ retval |= -+ dwc_otg_hcd_handle_rx_status_q_level_intr -+ (dwc_otg_hcd); -+ } -+ if (gintsts.b.nptxfempty) { -+ retval |= -+ dwc_otg_hcd_handle_np_tx_fifo_empty_intr -+ (dwc_otg_hcd); -+ } -+ if (gintsts.b.i2cintr) { -+ /** @todo Implement i2cintr handler. */ -+ } -+ if (gintsts.b.portintr) { -+ -+ gintmsk_data_t gintmsk = { .b.portintr = 1}; -+ retval |= dwc_otg_hcd_handle_port_intr(dwc_otg_hcd); -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); -+ } -+ } -+ if (gintsts.b.hcintr) { -+ retval |= dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd); -+ } -+ if (gintsts.b.ptxfempty) { -+ retval |= -+ dwc_otg_hcd_handle_perio_tx_fifo_empty_intr -+ (dwc_otg_hcd); -+ } -+#ifdef DEBUG -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ { -+ DWC_DEBUGPL(DBG_HCDI, -+ "DWC OTG HCD Finished Servicing Interrupts\n"); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintsts=0x%08x\n", -+ DWC_READ_REG32(&global_regs->gintsts)); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintmsk=0x%08x\n", -+ DWC_READ_REG32(&global_regs->gintmsk)); -+ } -+#endif -+ -+#ifdef DEBUG -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ DWC_DEBUGPL(DBG_HCDI, "\n"); -+#endif -+ -+ } -+ -+exit_handler_routine: -+ if (fiq_enable) { -+ gintmsk_data_t gintmsk_new; -+ haintmsk_data_t haintmsk_new; -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ gintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->gintmsk_saved.d32; -+ if(fiq_fsm_enable) -+ haintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->haintmsk_saved.d32; -+ else -+ haintmsk_new.d32 = 0x0000FFFF; -+ -+ /* The FIQ could have sneaked another interrupt in. If so, don't clear MPHI */ -+ if ((gintmsk_new.d32 == ~0) && (haintmsk_new.d32 == 0x0000FFFF)) { -+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.intstat, (1<<16)); -+ if (dwc_otg_hcd->fiq_state->mphi_int_count >= 50) { -+ fiq_print(FIQDBG_INT, dwc_otg_hcd->fiq_state, "MPHI CLR"); -+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, ((1<<31) + (1<<16))); -+ while (!(DWC_READ_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & (1 << 17))) -+ ; -+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, (1<<31)); -+ dwc_otg_hcd->fiq_state->mphi_int_count = 0; -+ } -+ int_done++; -+ } -+ haintmsk.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); -+ /* Re-enable interrupts that the FIQ masked (first time round) */ -+ FIQ_WRITE(dwc_otg_hcd->fiq_state->dwc_regs_base + GINTMSK, gintmsk.d32); -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ -+ if ((jiffies / HZ) > last_time) { -+ //dwc_otg_qh_t *qh; -+ //dwc_list_link_t *cur; -+ /* Once a second output the fiq and irq numbers, useful for debug */ -+ last_time = jiffies / HZ; -+ // DWC_WARN("np_kick=%d AHC=%d sched_frame=%d cur_frame=%d int_done=%d fiq_done=%d", -+ // dwc_otg_hcd->fiq_state->kick_np_queues, dwc_otg_hcd->available_host_channels, -+ // dwc_otg_hcd->fiq_state->next_sched_frame, hfnum.b.frnum, int_done, dwc_otg_hcd->fiq_state->fiq_done); -+ //printk(KERN_WARNING "Periodic queues:\n"); -+ } -+ } -+ -+ DWC_SPINUNLOCK(dwc_otg_hcd->lock); -+ return retval; -+} -+ -+#ifdef DWC_TRACK_MISSED_SOFS -+ -+#warning Compiling code to track missed SOFs -+#define FRAME_NUM_ARRAY_SIZE 1000 -+/** -+ * This function is for debug only. -+ */ -+static inline void track_missed_sofs(uint16_t curr_frame_number) -+{ -+ static uint16_t frame_num_array[FRAME_NUM_ARRAY_SIZE]; -+ static uint16_t last_frame_num_array[FRAME_NUM_ARRAY_SIZE]; -+ static int frame_num_idx = 0; -+ static uint16_t last_frame_num = DWC_HFNUM_MAX_FRNUM; -+ static int dumped_frame_num_array = 0; -+ -+ if (frame_num_idx < FRAME_NUM_ARRAY_SIZE) { -+ if (((last_frame_num + 1) & DWC_HFNUM_MAX_FRNUM) != -+ curr_frame_number) { -+ frame_num_array[frame_num_idx] = curr_frame_number; -+ last_frame_num_array[frame_num_idx++] = last_frame_num; -+ } -+ } else if (!dumped_frame_num_array) { -+ int i; -+ DWC_PRINTF("Frame Last Frame\n"); -+ DWC_PRINTF("----- ----------\n"); -+ for (i = 0; i < FRAME_NUM_ARRAY_SIZE; i++) { -+ DWC_PRINTF("0x%04x 0x%04x\n", -+ frame_num_array[i], last_frame_num_array[i]); -+ } -+ dumped_frame_num_array = 1; -+ } -+ last_frame_num = curr_frame_number; -+} -+#endif -+ -+/** -+ * Handles the start-of-frame interrupt in host mode. Non-periodic -+ * transactions may be queued to the DWC_otg controller for the current -+ * (micro)frame. Periodic transactions may be queued to the controller for the -+ * next (micro)frame. -+ */ -+int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) -+{ -+ hfnum_data_t hfnum; -+ gintsts_data_t gintsts = { .d32 = 0 }; -+ dwc_list_link_t *qh_entry; -+ dwc_otg_qh_t *qh; -+ dwc_otg_transaction_type_e tr_type; -+ int did_something = 0; -+ int32_t next_sched_frame = -1; -+ -+ hfnum.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); -+ -+#ifdef DEBUG_SOF -+ DWC_DEBUGPL(DBG_HCD, "--Start of Frame Interrupt--\n"); -+#endif -+ hcd->frame_number = hfnum.b.frnum; -+ -+#ifdef DEBUG -+ hcd->frrem_accum += hfnum.b.frrem; -+ hcd->frrem_samples++; -+#endif -+ -+#ifdef DWC_TRACK_MISSED_SOFS -+ track_missed_sofs(hcd->frame_number); -+#endif -+ /* Determine whether any periodic QHs should be executed. */ -+ qh_entry = DWC_LIST_FIRST(&hcd->periodic_sched_inactive); -+ while (qh_entry != &hcd->periodic_sched_inactive) { -+ qh = DWC_LIST_ENTRY(qh_entry, dwc_otg_qh_t, qh_list_entry); -+ qh_entry = qh_entry->next; -+ if (dwc_frame_num_le(qh->sched_frame, hcd->frame_number)) { -+ -+ /* -+ * Move QH to the ready list to be executed next -+ * (micro)frame. -+ */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, -+ &qh->qh_list_entry); -+ -+ did_something = 1; -+ } -+ else -+ { -+ if(next_sched_frame < 0 || dwc_frame_num_le(qh->sched_frame, next_sched_frame)) -+ { -+ next_sched_frame = qh->sched_frame; -+ } -+ } -+ } -+ if (fiq_enable) -+ hcd->fiq_state->next_sched_frame = next_sched_frame; -+ -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE) { -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ did_something = 1; -+ } -+ -+ /* Clear interrupt - but do not trample on the FIQ sof */ -+ if (!fiq_fsm_enable) { -+ gintsts.b.sofintr = 1; -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->gintsts, gintsts.d32); -+ } -+ return 1; -+} -+ -+/** Handles the Rx Status Queue Level Interrupt, which indicates that there is at -+ * least one packet in the Rx FIFO. The packets are moved from the FIFO to -+ * memory if the DWC_otg controller is operating in Slave mode. */ -+int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ host_grxsts_data_t grxsts; -+ dwc_hc_t *hc = NULL; -+ -+ DWC_DEBUGPL(DBG_HCD, "--RxStsQ Level Interrupt--\n"); -+ -+ grxsts.d32 = -+ DWC_READ_REG32(&dwc_otg_hcd->core_if->core_global_regs->grxstsp); -+ -+ hc = dwc_otg_hcd->hc_ptr_array[grxsts.b.chnum]; -+ if (!hc) { -+ DWC_ERROR("Unable to get corresponding channel\n"); -+ return 0; -+ } -+ -+ /* Packet Status */ -+ DWC_DEBUGPL(DBG_HCDV, " Ch num = %d\n", grxsts.b.chnum); -+ DWC_DEBUGPL(DBG_HCDV, " Count = %d\n", grxsts.b.bcnt); -+ DWC_DEBUGPL(DBG_HCDV, " DPID = %d, hc.dpid = %d\n", grxsts.b.dpid, -+ hc->data_pid_start); -+ DWC_DEBUGPL(DBG_HCDV, " PStatus = %d\n", grxsts.b.pktsts); -+ -+ switch (grxsts.b.pktsts) { -+ case DWC_GRXSTS_PKTSTS_IN: -+ /* Read the data into the host buffer. */ -+ if (grxsts.b.bcnt > 0) { -+ dwc_otg_read_packet(dwc_otg_hcd->core_if, -+ hc->xfer_buff, grxsts.b.bcnt); -+ -+ /* Update the HC fields for the next packet received. */ -+ hc->xfer_count += grxsts.b.bcnt; -+ hc->xfer_buff += grxsts.b.bcnt; -+ } -+ -+ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: -+ case DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR: -+ case DWC_GRXSTS_PKTSTS_CH_HALTED: -+ /* Handled in interrupt, just ignore data */ -+ break; -+ default: -+ DWC_ERROR("RX_STS_Q Interrupt: Unknown status %d\n", -+ grxsts.b.pktsts); -+ break; -+ } -+ -+ return 1; -+} -+ -+/** This interrupt occurs when the non-periodic Tx FIFO is half-empty. More -+ * data packets may be written to the FIFO for OUT transfers. More requests -+ * may be written to the non-periodic request queue for IN transfers. This -+ * interrupt is enabled only in Slave mode. */ -+int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ DWC_DEBUGPL(DBG_HCD, "--Non-Periodic TxFIFO Empty Interrupt--\n"); -+ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, -+ DWC_OTG_TRANSACTION_NON_PERIODIC); -+ return 1; -+} -+ -+/** This interrupt occurs when the periodic Tx FIFO is half-empty. More data -+ * packets may be written to the FIFO for OUT transfers. More requests may be -+ * written to the periodic request queue for IN transfers. This interrupt is -+ * enabled only in Slave mode. */ -+int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ DWC_DEBUGPL(DBG_HCD, "--Periodic TxFIFO Empty Interrupt--\n"); -+ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, -+ DWC_OTG_TRANSACTION_PERIODIC); -+ return 1; -+} -+ -+/** There are multiple conditions that can cause a port interrupt. This function -+ * determines which interrupt conditions have occurred and handles them -+ * appropriately. */ -+int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ int retval = 0; -+ hprt0_data_t hprt0; -+ hprt0_data_t hprt0_modify; -+ -+ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ hprt0_modify.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ -+ /* Clear appropriate bits in HPRT0 to clear the interrupt bit in -+ * GINTSTS */ -+ -+ hprt0_modify.b.prtena = 0; -+ hprt0_modify.b.prtconndet = 0; -+ hprt0_modify.b.prtenchng = 0; -+ hprt0_modify.b.prtovrcurrchng = 0; -+ -+ /* Port Connect Detected -+ * Set flag and clear if detected */ -+ if (dwc_otg_hcd->core_if->hibernation_suspend == 1) { -+ // Dont modify port status if we are in hibernation state -+ hprt0_modify.b.prtconndet = 1; -+ hprt0_modify.b.prtenchng = 1; -+ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); -+ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ return retval; -+ } -+ -+ if (hprt0.b.prtconndet) { -+ /** @todo - check if steps performed in 'else' block should be perfromed regardles adp */ -+ if (dwc_otg_hcd->core_if->adp_enable && -+ dwc_otg_hcd->core_if->adp.vbuson_timer_started == 1) { -+ DWC_PRINTF("PORT CONNECT DETECTED ----------------\n"); -+ DWC_TIMER_CANCEL(dwc_otg_hcd->core_if->adp.vbuson_timer); -+ dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; -+ /* TODO - check if this is required, as -+ * host initialization was already performed -+ * after initial ADP probing -+ */ -+ /*dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; -+ dwc_otg_core_init(dwc_otg_hcd->core_if); -+ dwc_otg_enable_global_interrupts(dwc_otg_hcd->core_if); -+ cil_hcd_start(dwc_otg_hcd->core_if);*/ -+ } else { -+ -+ DWC_DEBUGPL(DBG_HCD, "--Port Interrupt HPRT0=0x%08x " -+ "Port Connect Detected--\n", hprt0.d32); -+ dwc_otg_hcd->flags.b.port_connect_status_change = 1; -+ dwc_otg_hcd->flags.b.port_connect_status = 1; -+ hprt0_modify.b.prtconndet = 1; -+ -+ /* B-Device has connected, Delete the connection timer. */ -+ DWC_TIMER_CANCEL(dwc_otg_hcd->conn_timer); -+ } -+ /* The Hub driver asserts a reset when it sees port connect -+ * status change flag */ -+ retval |= 1; -+ } -+ -+ /* Port Enable Changed -+ * Clear if detected - Set internal flag if disabled */ -+ if (hprt0.b.prtenchng) { -+ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " -+ "Port Enable Changed--\n", hprt0.d32); -+ hprt0_modify.b.prtenchng = 1; -+ if (hprt0.b.prtena == 1) { -+ hfir_data_t hfir; -+ int do_reset = 0; -+ dwc_otg_core_params_t *params = -+ dwc_otg_hcd->core_if->core_params; -+ dwc_otg_core_global_regs_t *global_regs = -+ dwc_otg_hcd->core_if->core_global_regs; -+ dwc_otg_host_if_t *host_if = -+ dwc_otg_hcd->core_if->host_if; -+ -+ /* Every time when port enables calculate -+ * HFIR.FrInterval -+ */ -+ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); -+ hfir.b.frint = calc_frame_interval(dwc_otg_hcd->core_if); -+ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); -+ -+ /* Check if we need to adjust the PHY clock speed for -+ * low power and adjust it */ -+ if (params->host_support_fs_ls_low_power) { -+ gusbcfg_data_t usbcfg; -+ -+ usbcfg.d32 = -+ DWC_READ_REG32(&global_regs->gusbcfg); -+ -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED -+ || hprt0.b.prtspd == -+ DWC_HPRT0_PRTSPD_FULL_SPEED) { -+ /* -+ * Low power -+ */ -+ hcfg_data_t hcfg; -+ if (usbcfg.b.phylpwrclksel == 0) { -+ /* Set PHY low power clock select for FS/LS devices */ -+ usbcfg.b.phylpwrclksel = 1; -+ DWC_WRITE_REG32 -+ (&global_regs->gusbcfg, -+ usbcfg.d32); -+ do_reset = 1; -+ } -+ -+ hcfg.d32 = -+ DWC_READ_REG32 -+ (&host_if->host_global_regs->hcfg); -+ -+ if (hprt0.b.prtspd == -+ DWC_HPRT0_PRTSPD_LOW_SPEED -+ && params->host_ls_low_power_phy_clk -+ == -+ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ) -+ { -+ /* 6 MHZ */ -+ DWC_DEBUGPL(DBG_CIL, -+ "FS_PHY programming HCFG to 6 MHz (Low Power)\n"); -+ if (hcfg.b.fslspclksel != -+ DWC_HCFG_6_MHZ) { -+ hcfg.b.fslspclksel = -+ DWC_HCFG_6_MHZ; -+ DWC_WRITE_REG32 -+ (&host_if->host_global_regs->hcfg, -+ hcfg.d32); -+ do_reset = 1; -+ } -+ } else { -+ /* 48 MHZ */ -+ DWC_DEBUGPL(DBG_CIL, -+ "FS_PHY programming HCFG to 48 MHz ()\n"); -+ if (hcfg.b.fslspclksel != -+ DWC_HCFG_48_MHZ) { -+ hcfg.b.fslspclksel = -+ DWC_HCFG_48_MHZ; -+ DWC_WRITE_REG32 -+ (&host_if->host_global_regs->hcfg, -+ hcfg.d32); -+ do_reset = 1; -+ } -+ } -+ } else { -+ /* -+ * Not low power -+ */ -+ if (usbcfg.b.phylpwrclksel == 1) { -+ usbcfg.b.phylpwrclksel = 0; -+ DWC_WRITE_REG32 -+ (&global_regs->gusbcfg, -+ usbcfg.d32); -+ do_reset = 1; -+ } -+ } -+ -+ if (do_reset) { -+ DWC_TASK_SCHEDULE(dwc_otg_hcd->reset_tasklet); -+ } -+ } -+ -+ if (!do_reset) { -+ /* Port has been enabled set the reset change flag */ -+ dwc_otg_hcd->flags.b.port_reset_change = 1; -+ } -+ } else { -+ dwc_otg_hcd->flags.b.port_enable_change = 1; -+ } -+ retval |= 1; -+ } -+ -+ /** Overcurrent Change Interrupt */ -+ if (hprt0.b.prtovrcurrchng) { -+ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " -+ "Port Overcurrent Changed--\n", hprt0.d32); -+ dwc_otg_hcd->flags.b.port_over_current_change = 1; -+ hprt0_modify.b.prtovrcurrchng = 1; -+ retval |= 1; -+ } -+ -+ /* Clear Port Interrupts */ -+ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); -+ -+ return retval; -+} -+ -+/** This interrupt indicates that one or more host channels has a pending -+ * interrupt. There are multiple conditions that can cause each host channel -+ * interrupt. This function determines which conditions have occurred for each -+ * host channel interrupt and handles them appropriately. */ -+int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ int i; -+ int retval = 0; -+ haint_data_t haint = { .d32 = 0 } ; -+ -+ /* Clear appropriate bits in HCINTn to clear the interrupt bit in -+ * GINTSTS */ -+ -+ if (!fiq_fsm_enable) -+ haint.d32 = dwc_otg_read_host_all_channels_intr(dwc_otg_hcd->core_if); -+ -+ // Overwrite with saved interrupts from fiq handler -+ if(fiq_fsm_enable) -+ { -+ /* check the mask? */ -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ haint.b2.chint |= ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint); -+ dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint = ~0; -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } -+ -+ for (i = 0; i < dwc_otg_hcd->core_if->core_params->host_channels; i++) { -+ if (haint.b2.chint & (1 << i)) { -+ retval |= dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd, i); -+ } -+ } -+ -+ return retval; -+} -+ -+/** -+ * Gets the actual length of a transfer after the transfer halts. _halt_status -+ * holds the reason for the halt. -+ * -+ * For IN transfers where halt_status is DWC_OTG_HC_XFER_COMPLETE, -+ * *short_read is set to 1 upon return if less than the requested -+ * number of bytes were transferred. Otherwise, *short_read is set to 0 upon -+ * return. short_read may also be NULL on entry, in which case it remains -+ * unchanged. -+ */ -+static uint32_t get_actual_xfer_length(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status, -+ int *short_read) -+{ -+ hctsiz_data_t hctsiz; -+ uint32_t length; -+ -+ if (short_read != NULL) { -+ *short_read = 0; -+ } -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ -+ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { -+ if (hc->ep_is_in) { -+ length = hc->xfer_len - hctsiz.b.xfersize; -+ if (short_read != NULL) { -+ *short_read = (hctsiz.b.xfersize != 0); -+ } -+ } else if (hc->qh->do_split) { -+ //length = split_out_xfersize[hc->hc_num]; -+ length = qtd->ssplit_out_xfer_count; -+ } else { -+ length = hc->xfer_len; -+ } -+ } else { -+ /* -+ * Must use the hctsiz.pktcnt field to determine how much data -+ * has been transferred. This field reflects the number of -+ * packets that have been transferred via the USB. This is -+ * always an integral number of packets if the transfer was -+ * halted before its normal completion. (Can't use the -+ * hctsiz.xfersize field because that reflects the number of -+ * bytes transferred via the AHB, not the USB). -+ */ -+ length = -+ (hc->start_pkt_count - hctsiz.b.pktcnt) * hc->max_packet; -+ } -+ -+ return length; -+} -+ -+/** -+ * Updates the state of the URB after a Transfer Complete interrupt on the -+ * host channel. Updates the actual_length field of the URB based on the -+ * number of bytes transferred via the host channel. Sets the URB status -+ * if the data transfer is finished. -+ * -+ * @return 1 if the data transfer specified by the URB is completely finished, -+ * 0 otherwise. -+ */ -+static int update_urb_state_xfer_comp(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_hcd_urb_t * urb, -+ dwc_otg_qtd_t * qtd) -+{ -+ int xfer_done = 0; -+ int short_read = 0; -+ -+ int xfer_length; -+ -+ xfer_length = get_actual_xfer_length(hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_COMPLETE, -+ &short_read); -+ -+ if (urb->actual_length + xfer_length > urb->length) { -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); -+ xfer_length = urb->length - urb->actual_length; -+ } -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && xfer_length && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -+ xfer_length); -+ } -+ -+ urb->actual_length += xfer_length; -+ -+ if (xfer_length && (hc->ep_type == DWC_OTG_EP_TYPE_BULK) && -+ (urb->flags & URB_SEND_ZERO_PACKET) -+ && (urb->actual_length == urb->length) -+ && !(urb->length % hc->max_packet)) { -+ xfer_done = 0; -+ } else if (short_read || urb->actual_length >= urb->length) { -+ xfer_done = 1; -+ urb->status = 0; -+ } -+ -+#ifdef DEBUG -+ { -+ hctsiz_data_t hctsiz; -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", -+ __func__, (hc->ep_is_in ? "IN" : "OUT"), -+ hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " hc->xfer_len %d\n", hc->xfer_len); -+ DWC_DEBUGPL(DBG_HCDV, " hctsiz.xfersize %d\n", -+ hctsiz.b.xfersize); -+ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", -+ urb->length); -+ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", -+ urb->actual_length); -+ DWC_DEBUGPL(DBG_HCDV, " short_read %d, xfer_done %d\n", -+ short_read, xfer_done); -+ } -+#endif -+ -+ return xfer_done; -+} -+ -+/* -+ * Save the starting data toggle for the next transfer. The data toggle is -+ * saved in the QH for non-control transfers and it's saved in the QTD for -+ * control transfers. -+ */ -+void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, dwc_otg_qtd_t * qtd) -+{ -+ hctsiz_data_t hctsiz; -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ -+ if (hc->ep_type != DWC_OTG_EP_TYPE_CONTROL) { -+ dwc_otg_qh_t *qh = hc->qh; -+ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ } else { -+ qh->data_toggle = DWC_OTG_HC_PID_DATA1; -+ } -+ } else { -+ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { -+ qtd->data_toggle = DWC_OTG_HC_PID_DATA0; -+ } else { -+ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; -+ } -+ } -+} -+ -+/** -+ * Updates the state of an Isochronous URB when the transfer is stopped for -+ * any reason. The fields of the current entry in the frame descriptor array -+ * are set based on the transfer state and the input _halt_status. Completes -+ * the Isochronous URB if all the URB frames have been completed. -+ * -+ * @return DWC_OTG_HC_XFER_COMPLETE if there are more frames remaining to be -+ * transferred in the URB. Otherwise return DWC_OTG_HC_XFER_URB_COMPLETE. -+ */ -+static dwc_otg_halt_status_e -+update_isoc_urb_state(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) -+{ -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ dwc_otg_halt_status_e ret_val = halt_status; -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ -+ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; -+ switch (halt_status) { -+ case DWC_OTG_HC_XFER_COMPLETE: -+ frame_desc->status = 0; -+ frame_desc->actual_length = -+ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, -+ hc->qh->dw_align_buf, frame_desc->actual_length); -+ } -+ -+ break; -+ case DWC_OTG_HC_XFER_FRAME_OVERRUN: -+ urb->error_count++; -+ if (hc->ep_is_in) { -+ frame_desc->status = -DWC_E_NO_STREAM_RES; -+ } else { -+ frame_desc->status = -DWC_E_COMMUNICATION; -+ } -+ frame_desc->actual_length = 0; -+ break; -+ case DWC_OTG_HC_XFER_BABBLE_ERR: -+ urb->error_count++; -+ frame_desc->status = -DWC_E_OVERFLOW; -+ /* Don't need to update actual_length in this case. */ -+ break; -+ case DWC_OTG_HC_XFER_XACT_ERR: -+ urb->error_count++; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ frame_desc->actual_length = -+ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, -+ hc->qh->dw_align_buf, frame_desc->actual_length); -+ } -+ /* Skip whole frame */ -+ if (hc->qh->do_split && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && -+ hc->ep_is_in && hcd->core_if->dma_enable) { -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ } -+ -+ break; -+ default: -+ DWC_ASSERT(1, "Unhandled _halt_status (%d)\n", halt_status); -+ break; -+ } -+ if (++qtd->isoc_frame_index == urb->packet_count) { -+ /* -+ * urb->status is not used for isoc transfers. -+ * The individual frame_desc statuses are used instead. -+ */ -+ hcd->fops->complete(hcd, urb->priv, urb, 0); -+ ret_val = DWC_OTG_HC_XFER_URB_COMPLETE; -+ } else { -+ ret_val = DWC_OTG_HC_XFER_COMPLETE; -+ } -+ return ret_val; -+} -+ -+/** -+ * Frees the first QTD in the QH's list if free_qtd is 1. For non-periodic -+ * QHs, removes the QH from the active non-periodic schedule. If any QTDs are -+ * still linked to the QH, the QH is added to the end of the inactive -+ * non-periodic schedule. For periodic QHs, removes the QH from the periodic -+ * schedule if no more QTDs are linked to the QH. -+ */ -+static void deactivate_qh(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, int free_qtd) -+{ -+ int continue_split = 0; -+ dwc_otg_qtd_t *qtd; -+ -+ DWC_DEBUGPL(DBG_HCDV, " %s(%p,%p,%d)\n", __func__, hcd, qh, free_qtd); -+ -+ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ -+ if (qtd->complete_split) { -+ continue_split = 1; -+ } else if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_MID || -+ qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_END) { -+ continue_split = 1; -+ } -+ -+ if (free_qtd) { -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ continue_split = 0; -+ } -+ -+ qh->channel = NULL; -+ dwc_otg_hcd_qh_deactivate(hcd, qh, continue_split); -+} -+ -+/** -+ * Releases a host channel for use by other transfers. Attempts to select and -+ * queue more transactions since at least one host channel is available. -+ * -+ * @param hcd The HCD state structure. -+ * @param hc The host channel to release. -+ * @param qtd The QTD associated with the host channel. This QTD may be freed -+ * if the transfer is complete or an error has occurred. -+ * @param halt_status Reason the channel is being released. This status -+ * determines the actions taken by this function. -+ */ -+static void release_channel(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ dwc_otg_transaction_type_e tr_type; -+ int free_qtd; -+ dwc_irqflags_t flags; -+ dwc_spinlock_t *channel_lock = hcd->channel_lock; -+ -+ int hog_port = 0; -+ -+ DWC_DEBUGPL(DBG_HCDV, " %s: channel %d, halt_status %d, xfer_len %d\n", -+ __func__, hc->hc_num, halt_status, hc->xfer_len); -+ -+ if(fiq_fsm_enable && hc->do_split) { -+ if(!hc->ep_is_in && hc->ep_type == UE_ISOCHRONOUS) { -+ if(hc->xact_pos == DWC_HCSPLIT_XACTPOS_MID || -+ hc->xact_pos == DWC_HCSPLIT_XACTPOS_BEGIN) { -+ hog_port = 0; -+ } -+ } -+ } -+ -+ switch (halt_status) { -+ case DWC_OTG_HC_XFER_URB_COMPLETE: -+ free_qtd = 1; -+ break; -+ case DWC_OTG_HC_XFER_AHB_ERR: -+ case DWC_OTG_HC_XFER_STALL: -+ case DWC_OTG_HC_XFER_BABBLE_ERR: -+ free_qtd = 1; -+ break; -+ case DWC_OTG_HC_XFER_XACT_ERR: -+ if (qtd->error_count >= 3) { -+ DWC_DEBUGPL(DBG_HCDV, -+ " Complete URB with transaction error\n"); -+ free_qtd = 1; -+ qtd->urb->status = -DWC_E_PROTOCOL; -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_PROTOCOL); -+ } else { -+ free_qtd = 0; -+ } -+ break; -+ case DWC_OTG_HC_XFER_URB_DEQUEUE: -+ /* -+ * The QTD has already been removed and the QH has been -+ * deactivated. Don't want to do anything except release the -+ * host channel and try to queue more transfers. -+ */ -+ goto cleanup; -+ case DWC_OTG_HC_XFER_NO_HALT_STATUS: -+ free_qtd = 0; -+ break; -+ case DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE: -+ DWC_DEBUGPL(DBG_HCDV, -+ " Complete URB with I/O error\n"); -+ free_qtd = 1; -+ qtd->urb->status = -DWC_E_IO; -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_IO); -+ break; -+ default: -+ free_qtd = 0; -+ break; -+ } -+ -+ deactivate_qh(hcd, hc->qh, free_qtd); -+ -+cleanup: -+ /* -+ * Release the host channel for use by other transfers. The cleanup -+ * function clears the channel interrupt enables and conditions, so -+ * there's no need to clear the Channel Halted interrupt separately. -+ */ -+ if (fiq_fsm_enable && hcd->fiq_state->channel[hc->hc_num].fsm != FIQ_PASSTHROUGH) -+ dwc_otg_cleanup_fiq_channel(hcd, hc->hc_num); -+ dwc_otg_hc_cleanup(hcd->core_if, hc); -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); -+ -+ if (!microframe_schedule) { -+ switch (hc->ep_type) { -+ case DWC_OTG_EP_TYPE_CONTROL: -+ case DWC_OTG_EP_TYPE_BULK: -+ hcd->non_periodic_channels--; -+ break; -+ -+ default: -+ /* -+ * Don't release reservations for periodic channels here. -+ * That's done when a periodic transfer is descheduled (i.e. -+ * when the QH is removed from the periodic schedule). -+ */ -+ break; -+ } -+ } else { -+ -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ hcd->available_host_channels++; -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "AHC = %d ", hcd->available_host_channels); -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ } -+ -+ /* Try to queue more transfers now that there's a free channel. */ -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE) { -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ } -+} -+ -+/** -+ * Halts a host channel. If the channel cannot be halted immediately because -+ * the request queue is full, this function ensures that the FIFO empty -+ * interrupt for the appropriate queue is enabled so that the halt request can -+ * be queued when there is space in the request queue. -+ * -+ * This function may also be called in DMA mode. In that case, the channel is -+ * simply released since the core always halts the channel automatically in -+ * DMA mode. -+ */ -+static void halt_channel(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) -+{ -+ if (hcd->core_if->dma_enable) { -+ release_channel(hcd, hc, qtd, halt_status); -+ return; -+ } -+ -+ /* Slave mode processing... */ -+ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); -+ -+ if (hc->halt_on_queue) { -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ dwc_otg_core_global_regs_t *global_regs; -+ global_regs = hcd->core_if->core_global_regs; -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || -+ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { -+ /* -+ * Make sure the Non-periodic Tx FIFO empty interrupt -+ * is enabled so that the non-periodic schedule will -+ * be processed. -+ */ -+ gintmsk.b.nptxfempty = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ } -+ } else { -+ /* -+ * Move the QH from the periodic queued schedule to -+ * the periodic assigned schedule. This allows the -+ * halt to be queued when the periodic schedule is -+ * processed. -+ */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, -+ &hc->qh->qh_list_entry); -+ -+ /* -+ * Make sure the Periodic Tx FIFO Empty interrupt is -+ * enabled so that the periodic schedule will be -+ * processed. -+ */ -+ gintmsk.b.ptxfempty = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ } -+ } -+ } -+} -+ -+/** -+ * Performs common cleanup for non-periodic transfers after a Transfer -+ * Complete interrupt. This function should be called after any endpoint type -+ * specific handling is finished to release the host channel. -+ */ -+static void complete_non_periodic_xfer(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ hcint_data_t hcint; -+ -+ qtd->error_count = 0; -+ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ if (hcint.b.nyet) { -+ /* -+ * Got a NYET on the last transaction of the transfer. This -+ * means that the endpoint should be in the PING state at the -+ * beginning of the next transfer. -+ */ -+ hc->qh->ping_state = 1; -+ clear_hc_int(hc_regs, nyet); -+ } -+ -+ /* -+ * Always halt and release the host channel to make it available for -+ * more transfers. There may still be more phases for a control -+ * transfer or more data packets for a bulk transfer at this point, -+ * but the host channel is still halted. A channel will be reassigned -+ * to the transfer when the non-periodic schedule is processed after -+ * the channel is released. This allows transactions to be queued -+ * properly via dwc_otg_hcd_queue_transactions, which also enables the -+ * Tx FIFO Empty interrupt if necessary. -+ */ -+ if (hc->ep_is_in) { -+ /* -+ * IN transfers in Slave mode require an explicit disable to -+ * halt the channel. (In DMA mode, this call simply releases -+ * the channel.) -+ */ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } else { -+ /* -+ * The channel is automatically disabled by the core for OUT -+ * transfers in Slave mode. -+ */ -+ release_channel(hcd, hc, qtd, halt_status); -+ } -+} -+ -+/** -+ * Performs common cleanup for periodic transfers after a Transfer Complete -+ * interrupt. This function should be called after any endpoint type specific -+ * handling is finished to release the host channel. -+ */ -+static void complete_periodic_xfer(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ hctsiz_data_t hctsiz; -+ qtd->error_count = 0; -+ -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ if (!hc->ep_is_in || hctsiz.b.pktcnt == 0) { -+ /* Core halts channel in these cases. */ -+ release_channel(hcd, hc, qtd, halt_status); -+ } else { -+ /* Flush any outstanding requests from the Tx queue. */ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+} -+ -+static int32_t handle_xfercomp_isoc_split_in(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ uint32_t len; -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ -+ len = get_actual_xfer_length(hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_COMPLETE, NULL); -+ -+ if (!len) { -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ return 0; -+ } -+ frame_desc->actual_length += len; -+ -+ if (hc->align_buff && len) -+ dwc_memcpy(qtd->urb->buf + frame_desc->offset + -+ qtd->isoc_split_offset, hc->qh->dw_align_buf, len); -+ qtd->isoc_split_offset += len; -+ -+ if (frame_desc->length == frame_desc->actual_length) { -+ frame_desc->status = 0; -+ qtd->isoc_frame_index++; -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ } -+ -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ -+ return 1; /* Indicates that channel released */ -+} -+ -+/** -+ * Handles a host channel Transfer Complete interrupt. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_xfercomp_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ int urb_xfer_done; -+ dwc_otg_halt_status_e halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); -+ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Transfer Complete--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, halt_status); -+ if (pipe_type == UE_ISOCHRONOUS) { -+ /* Do not disable the interrupt, just clear it */ -+ clear_hc_int(hc_regs, xfercomp); -+ return 1; -+ } -+ goto handle_xfercomp_done; -+ } -+ -+ /* -+ * Handle xfer complete on CSPLIT. -+ */ -+ -+ if (hc->qh->do_split) { -+ if ((hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && hc->ep_is_in -+ && hcd->core_if->dma_enable) { -+ if (qtd->complete_split -+ && handle_xfercomp_isoc_split_in(hcd, hc, hc_regs, -+ qtd)) -+ goto handle_xfercomp_done; -+ } else { -+ qtd->complete_split = 0; -+ } -+ } -+ -+ /* Update the QTD and URB states. */ -+ switch (pipe_type) { -+ case UE_CONTROL: -+ switch (qtd->control_phase) { -+ case DWC_OTG_CONTROL_SETUP: -+ if (urb->length > 0) { -+ qtd->control_phase = DWC_OTG_CONTROL_DATA; -+ } else { -+ qtd->control_phase = DWC_OTG_CONTROL_STATUS; -+ } -+ DWC_DEBUGPL(DBG_HCDV, -+ " Control setup transaction done\n"); -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ break; -+ case DWC_OTG_CONTROL_DATA:{ -+ urb_xfer_done = -+ update_urb_state_xfer_comp(hc, hc_regs, urb, -+ qtd); -+ if (urb_xfer_done) { -+ qtd->control_phase = -+ DWC_OTG_CONTROL_STATUS; -+ DWC_DEBUGPL(DBG_HCDV, -+ " Control data transfer done\n"); -+ } else { -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ } -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ break; -+ } -+ case DWC_OTG_CONTROL_STATUS: -+ DWC_DEBUGPL(DBG_HCDV, " Control transfer complete\n"); -+ if (urb->status == -DWC_E_IN_PROGRESS) { -+ urb->status = 0; -+ } -+ hcd->fops->complete(hcd, urb->priv, urb, urb->status); -+ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; -+ break; -+ } -+ -+ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ case UE_BULK: -+ DWC_DEBUGPL(DBG_HCDV, " Bulk transfer complete\n"); -+ urb_xfer_done = -+ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); -+ if (urb_xfer_done) { -+ hcd->fops->complete(hcd, urb->priv, urb, urb->status); -+ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; -+ } else { -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ } -+ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ case UE_INTERRUPT: -+ DWC_DEBUGPL(DBG_HCDV, " Interrupt transfer complete\n"); -+ urb_xfer_done = -+ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); -+ -+ /* -+ * Interrupt URB is done on the first transfer complete -+ * interrupt. -+ */ -+ if (urb_xfer_done) { -+ hcd->fops->complete(hcd, urb->priv, urb, urb->status); -+ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; -+ } else { -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ } -+ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ case UE_ISOCHRONOUS: -+ DWC_DEBUGPL(DBG_HCDV, " Isochronous transfer complete\n"); -+ if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_ALL) { -+ halt_status = -+ update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_COMPLETE); -+ } -+ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ } -+ -+handle_xfercomp_done: -+ disable_hc_int(hc_regs, xfercompl); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel STALL interrupt. This handler may be called in -+ * either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_stall_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); -+ -+ DWC_DEBUGPL(DBG_HCD, "--Host Channel %d Interrupt: " -+ "STALL Received--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, DWC_OTG_HC_XFER_STALL); -+ goto handle_stall_done; -+ } -+ -+ if (pipe_type == UE_CONTROL) { -+ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); -+ } -+ -+ if (pipe_type == UE_BULK || pipe_type == UE_INTERRUPT) { -+ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); -+ /* -+ * USB protocol requires resetting the data toggle for bulk -+ * and interrupt endpoints when a CLEAR_FEATURE(ENDPOINT_HALT) -+ * setup command is issued to the endpoint. Anticipate the -+ * CLEAR_FEATURE command since a STALL has occurred and reset -+ * the data toggle now. -+ */ -+ hc->qh->data_toggle = 0; -+ } -+ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_STALL); -+ -+handle_stall_done: -+ disable_hc_int(hc_regs, stall); -+ -+ return 1; -+} -+ -+/* -+ * Updates the state of the URB when a transfer has been stopped due to an -+ * abnormal condition before the transfer completes. Modifies the -+ * actual_length field of the URB to reflect the number of bytes that have -+ * actually been transferred via the host channel. -+ */ -+static void update_urb_state_xfer_intr(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_hcd_urb_t * urb, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, -+ halt_status, NULL); -+ -+ if (urb->actual_length + bytes_transferred > urb->length) { -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); -+ bytes_transferred = urb->length - urb->actual_length; -+ } -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && bytes_transferred && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -+ bytes_transferred); -+ } -+ -+ urb->actual_length += bytes_transferred; -+ -+#ifdef DEBUG -+ { -+ hctsiz_data_t hctsiz; -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", -+ __func__, (hc->ep_is_in ? "IN" : "OUT"), -+ hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " hc->start_pkt_count %d\n", -+ hc->start_pkt_count); -+ DWC_DEBUGPL(DBG_HCDV, " hctsiz.pktcnt %d\n", hctsiz.b.pktcnt); -+ DWC_DEBUGPL(DBG_HCDV, " hc->max_packet %d\n", hc->max_packet); -+ DWC_DEBUGPL(DBG_HCDV, " bytes_transferred %d\n", -+ bytes_transferred); -+ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", -+ urb->actual_length); -+ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", -+ urb->length); -+ } -+#endif -+} -+ -+/** -+ * Handles a host channel NAK interrupt. This handler may be called in either -+ * DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_nak_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "NAK Received--\n", hc->hc_num); -+ -+ /* -+ * When we get bulk NAKs then remember this so we holdoff on this qh until -+ * the beginning of the next frame -+ */ -+ switch(dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_BULK: -+ case UE_CONTROL: -+ if (nak_holdoff && qtd->qh->do_split) -+ hc->qh->nak_frame = dwc_otg_hcd_get_frame_number(hcd); -+ } -+ -+ /* -+ * Handle NAK for IN/OUT SSPLIT/CSPLIT transfers, bulk, control, and -+ * interrupt. Re-start the SSPLIT transfer. -+ */ -+ if (hc->do_split) { -+ if (hc->complete_split) { -+ qtd->error_count = 0; -+ } -+ qtd->complete_split = 0; -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); -+ goto handle_nak_done; -+ } -+ -+ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_CONTROL: -+ case UE_BULK: -+ if (hcd->core_if->dma_enable && hc->ep_is_in) { -+ /* -+ * NAK interrupts are enabled on bulk/control IN -+ * transfers in DMA mode for the sole purpose of -+ * resetting the error count after a transaction error -+ * occurs. The core will continue transferring data. -+ * Disable other interrupts unmasked for the same -+ * reason. -+ */ -+ disable_hc_int(hc_regs, datatglerr); -+ disable_hc_int(hc_regs, ack); -+ qtd->error_count = 0; -+ goto handle_nak_done; -+ } -+ -+ /* -+ * NAK interrupts normally occur during OUT transfers in DMA -+ * or Slave mode. For IN transfers, more requests will be -+ * queued as request queue space is available. -+ */ -+ qtd->error_count = 0; -+ -+ if (!hc->qh->ping_state) { -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, -+ DWC_OTG_HC_XFER_NAK); -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ -+ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) -+ hc->qh->ping_state = 1; -+ } -+ -+ /* -+ * Halt the channel so the transfer can be re-started from -+ * the appropriate point or the PING protocol will -+ * start/continue. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); -+ break; -+ case UE_INTERRUPT: -+ qtd->error_count = 0; -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); -+ break; -+ case UE_ISOCHRONOUS: -+ /* Should never get called for isochronous transfers. */ -+ DWC_ASSERT(1, "NACK interrupt for ISOC transfer\n"); -+ break; -+ } -+ -+handle_nak_done: -+ disable_hc_int(hc_regs, nak); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel ACK interrupt. This interrupt is enabled when -+ * performing the PING protocol in Slave mode, when errors occur during -+ * either Slave mode or DMA mode, and during Start Split transactions. -+ */ -+static int32_t handle_hc_ack_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "ACK Received--\n", hc->hc_num); -+ -+ if (hc->do_split) { -+ /* -+ * Handle ACK on SSPLIT. -+ * ACK should not occur in CSPLIT. -+ */ -+ if (!hc->ep_is_in && hc->data_pid_start != DWC_OTG_HC_PID_SETUP) { -+ qtd->ssplit_out_xfer_count = hc->xfer_len; -+ } -+ if (!(hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in)) { -+ /* Don't need complete for isochronous out transfers. */ -+ qtd->complete_split = 1; -+ } -+ -+ /* ISOC OUT */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { -+ switch (hc->xact_pos) { -+ case DWC_HCSPLIT_XACTPOS_ALL: -+ break; -+ case DWC_HCSPLIT_XACTPOS_END: -+ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; -+ qtd->isoc_split_offset = 0; -+ break; -+ case DWC_HCSPLIT_XACTPOS_BEGIN: -+ case DWC_HCSPLIT_XACTPOS_MID: -+ /* -+ * For BEGIN or MID, calculate the length for -+ * the next microframe to determine the correct -+ * SSPLIT token, either MID or END. -+ */ -+ { -+ struct dwc_otg_hcd_iso_packet_desc -+ *frame_desc; -+ -+ frame_desc = -+ &qtd->urb-> -+ iso_descs[qtd->isoc_frame_index]; -+ qtd->isoc_split_offset += 188; -+ -+ if ((frame_desc->length - -+ qtd->isoc_split_offset) <= 188) { -+ qtd->isoc_split_pos = -+ DWC_HCSPLIT_XACTPOS_END; -+ } else { -+ qtd->isoc_split_pos = -+ DWC_HCSPLIT_XACTPOS_MID; -+ } -+ -+ } -+ break; -+ } -+ } else { -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); -+ } -+ } else { -+ /* -+ * An unmasked ACK on a non-split DMA transaction is -+ * for the sole purpose of resetting error counts. Disable other -+ * interrupts unmasked for the same reason. -+ */ -+ if(hcd->core_if->dma_enable) { -+ disable_hc_int(hc_regs, datatglerr); -+ disable_hc_int(hc_regs, nak); -+ } -+ qtd->error_count = 0; -+ -+ if (hc->qh->ping_state) { -+ hc->qh->ping_state = 0; -+ /* -+ * Halt the channel so the transfer can be re-started -+ * from the appropriate point. This only happens in -+ * Slave mode. In DMA mode, the ping_state is cleared -+ * when the transfer is started because the core -+ * automatically executes the PING, then the transfer. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); -+ } -+ } -+ -+ /* -+ * If the ACK occurred when _not_ in the PING state, let the channel -+ * continue transferring data after clearing the error count. -+ */ -+ -+ disable_hc_int(hc_regs, ack); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel NYET interrupt. This interrupt should only occur on -+ * Bulk and Control OUT endpoints and for complete split transactions. If a -+ * NYET occurs at the same time as a Transfer Complete interrupt, it is -+ * handled in the xfercomp interrupt handler, not here. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "NYET Received--\n", hc->hc_num); -+ -+ /* -+ * NYET on CSPLIT -+ * re-do the CSPLIT immediately on non-periodic -+ */ -+ if (hc->do_split && hc->complete_split) { -+ if (hc->ep_is_in && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ && hcd->core_if->dma_enable) { -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } -+ else -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ goto handle_nyet_done; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ int frnum = dwc_otg_hcd_get_frame_number(hcd); -+ -+ // With the FIQ running we only ever see the failed NYET -+ if (dwc_full_frame_num(frnum) != -+ dwc_full_frame_num(hc->qh->sched_frame) || -+ fiq_fsm_enable) { -+ /* -+ * No longer in the same full speed frame. -+ * Treat this as a transaction error. -+ */ -+#if 0 -+ /** @todo Fix system performance so this can -+ * be treated as an error. Right now complete -+ * splits cannot be scheduled precisely enough -+ * due to other system activity, so this error -+ * occurs regularly in Slave mode. -+ */ -+ qtd->error_count++; -+#endif -+ qtd->complete_split = 0; -+ halt_channel(hcd, hc, qtd, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ /** @todo add support for isoc release */ -+ goto handle_nyet_done; -+ } -+ } -+ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); -+ goto handle_nyet_done; -+ } -+ -+ hc->qh->ping_state = 1; -+ qtd->error_count = 0; -+ -+ update_urb_state_xfer_intr(hc, hc_regs, qtd->urb, qtd, -+ DWC_OTG_HC_XFER_NYET); -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ -+ /* -+ * Halt the channel and re-start the transfer so the PING -+ * protocol will start. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); -+ -+handle_nyet_done: -+ disable_hc_int(hc_regs, nyet); -+ return 1; -+} -+ -+/** -+ * Handles a host channel babble interrupt. This handler may be called in -+ * either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_babble_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Babble Error--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ DWC_OTG_HC_XFER_BABBLE_ERR); -+ goto handle_babble_done; -+ } -+ -+ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_OVERFLOW); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_BABBLE_ERR); -+ } else { -+ dwc_otg_halt_status_e halt_status; -+ halt_status = update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_BABBLE_ERR); -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+ -+handle_babble_done: -+ disable_hc_int(hc_regs, bblerr); -+ return 1; -+} -+ -+/** -+ * Handles a host channel AHB error interrupt. This handler is only called in -+ * DMA mode. -+ */ -+static int32_t handle_hc_ahberr_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ hcchar_data_t hcchar; -+ hcsplt_data_t hcsplt; -+ hctsiz_data_t hctsiz; -+ uint32_t hcdma; -+ char *pipetype, *speed; -+ -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "AHB Error--\n", hc->hc_num); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ hcdma = DWC_READ_REG32(&hc_regs->hcdma); -+ -+ DWC_ERROR("AHB ERROR, Channel %d\n", hc->hc_num); -+ DWC_ERROR(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, hcsplt.d32); -+ DWC_ERROR(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, hcdma); -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Enqueue\n"); -+ DWC_ERROR(" Device address: %d\n", -+ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); -+ DWC_ERROR(" Endpoint: %d, %s\n", -+ dwc_otg_hcd_get_ep_num(&urb->pipe_info), -+ (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT")); -+ -+ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { -+ case UE_CONTROL: -+ pipetype = "CONTROL"; -+ break; -+ case UE_BULK: -+ pipetype = "BULK"; -+ break; -+ case UE_INTERRUPT: -+ pipetype = "INTERRUPT"; -+ break; -+ case UE_ISOCHRONOUS: -+ pipetype = "ISOCHRONOUS"; -+ break; -+ default: -+ pipetype = "UNKNOWN"; -+ break; -+ } -+ -+ DWC_ERROR(" Endpoint type: %s\n", pipetype); -+ -+ switch (hc->speed) { -+ case DWC_OTG_EP_SPEED_HIGH: -+ speed = "HIGH"; -+ break; -+ case DWC_OTG_EP_SPEED_FULL: -+ speed = "FULL"; -+ break; -+ case DWC_OTG_EP_SPEED_LOW: -+ speed = "LOW"; -+ break; -+ default: -+ speed = "UNKNOWN"; -+ break; -+ }; -+ -+ DWC_ERROR(" Speed: %s\n", speed); -+ -+ DWC_ERROR(" Max packet size: %d\n", -+ dwc_otg_hcd_get_mps(&urb->pipe_info)); -+ DWC_ERROR(" Data buffer length: %d\n", urb->length); -+ DWC_ERROR(" Transfer buffer: %p, Transfer DMA: %p\n", -+ urb->buf, (void *)urb->dma); -+ DWC_ERROR(" Setup buffer: %p, Setup DMA: %p\n", -+ urb->setup_packet, (void *)urb->setup_dma); -+ DWC_ERROR(" Interval: %d\n", urb->interval); -+ -+ /* Core haltes the channel for Descriptor DMA mode */ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ DWC_OTG_HC_XFER_AHB_ERR); -+ goto handle_ahberr_done; -+ } -+ -+ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_IO); -+ -+ /* -+ * Force a channel halt. Don't call halt_channel because that won't -+ * write to the HCCHARn register in DMA mode to force the halt. -+ */ -+ dwc_otg_hc_halt(hcd->core_if, hc, DWC_OTG_HC_XFER_AHB_ERR); -+handle_ahberr_done: -+ disable_hc_int(hc_regs, ahberr); -+ return 1; -+} -+ -+/** -+ * Handles a host channel transaction error interrupt. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_xacterr_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Transaction Error--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ goto handle_xacterr_done; -+ } -+ -+ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_CONTROL: -+ case UE_BULK: -+ qtd->error_count++; -+ if (!hc->qh->ping_state) { -+ -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ if (!hc->ep_is_in && hc->speed == DWC_OTG_EP_SPEED_HIGH) { -+ hc->qh->ping_state = 1; -+ } -+ } -+ -+ /* -+ * Halt the channel so the transfer can be re-started from -+ * the appropriate point or the PING protocol will start. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ break; -+ case UE_INTERRUPT: -+ qtd->error_count++; -+ if (hc->do_split && hc->complete_split) { -+ qtd->complete_split = 0; -+ } -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ break; -+ case UE_ISOCHRONOUS: -+ { -+ dwc_otg_halt_status_e halt_status; -+ halt_status = -+ update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+ break; -+ } -+handle_xacterr_done: -+ disable_hc_int(hc_regs, xacterr); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel frame overrun interrupt. This handler may be called -+ * in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_frmovrun_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Frame Overrun--\n", hc->hc_num); -+ -+ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_CONTROL: -+ case UE_BULK: -+ break; -+ case UE_INTERRUPT: -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_FRAME_OVERRUN); -+ break; -+ case UE_ISOCHRONOUS: -+ { -+ dwc_otg_halt_status_e halt_status; -+ halt_status = -+ update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_FRAME_OVERRUN); -+ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+ break; -+ } -+ -+ disable_hc_int(hc_regs, frmovrun); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel data toggle error interrupt. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_datatglerr_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Data Toggle Error on %s transfer--\n", -+ hc->hc_num, (hc->ep_is_in ? "IN" : "OUT")); -+ -+ /* Data toggles on split transactions cause the hc to halt. -+ * restart transfer */ -+ if(hc->qh->do_split) -+ { -+ qtd->error_count++; -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ } else if (hc->ep_is_in) { -+ /* An unmasked data toggle error on a non-split DMA transaction is -+ * for the sole purpose of resetting error counts. Disable other -+ * interrupts unmasked for the same reason. -+ */ -+ if(hcd->core_if->dma_enable) { -+ disable_hc_int(hc_regs, ack); -+ disable_hc_int(hc_regs, nak); -+ } -+ qtd->error_count = 0; -+ } -+ -+ disable_hc_int(hc_regs, datatglerr); -+ -+ return 1; -+} -+ -+#ifdef DEBUG -+/** -+ * This function is for debug only. It checks that a valid halt status is set -+ * and that HCCHARn.chdis is clear. If there's a problem, corrective action is -+ * taken and a warning is issued. -+ * @return 1 if halt status is ok, 0 otherwise. -+ */ -+static inline int halt_status_ok(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ hcsplt_data_t hcsplt; -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS) { -+ /* -+ * This code is here only as a check. This condition should -+ * never happen. Ignore the halt if it does occur. -+ */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ DWC_WARN -+ ("%s: hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS, " -+ "channel %d, hcchar 0x%08x, hctsiz 0x%08x, " -+ "hcint 0x%08x, hcintmsk 0x%08x, " -+ "hcsplt 0x%08x, qtd->complete_split %d\n", __func__, -+ hc->hc_num, hcchar.d32, hctsiz.d32, hcint.d32, -+ hcintmsk.d32, hcsplt.d32, qtd->complete_split); -+ -+ DWC_WARN("%s: no halt status, channel %d, ignoring interrupt\n", -+ __func__, hc->hc_num); -+ DWC_WARN("\n"); -+ clear_hc_int(hc_regs, chhltd); -+ return 0; -+ } -+ -+ /* -+ * This code is here only as a check. hcchar.chdis should -+ * never be set when the halt interrupt occurs. Halt the -+ * channel again if it does occur. -+ */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chdis) { -+ DWC_WARN("%s: hcchar.chdis set unexpectedly, " -+ "hcchar 0x%08x, trying to halt again\n", -+ __func__, hcchar.d32); -+ clear_hc_int(hc_regs, chhltd); -+ hc->halt_pending = 0; -+ halt_channel(hcd, hc, qtd, hc->halt_status); -+ return 0; -+ } -+ -+ return 1; -+} -+#endif -+ -+/** -+ * Handles a host Channel Halted interrupt in DMA mode. This handler -+ * determines the reason the channel halted and proceeds accordingly. -+ */ -+static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ int out_nak_enh = 0; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ /* For core with OUT NAK enhancement, the flow for high- -+ * speed CONTROL/BULK OUT is handled a little differently. -+ */ -+ if (hcd->core_if->snpsid >= OTG_CORE_REV_2_71a) { -+ if (hc->speed == DWC_OTG_EP_SPEED_HIGH && !hc->ep_is_in && -+ (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || -+ hc->ep_type == DWC_OTG_EP_TYPE_BULK)) { -+ out_nak_enh = 1; -+ } -+ } -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || -+ (hc->halt_status == DWC_OTG_HC_XFER_AHB_ERR -+ && !hcd->core_if->dma_desc_enable)) { -+ /* -+ * Just release the channel. A dequeue can happen on a -+ * transfer timeout. In the case of an AHB Error, the channel -+ * was forced to halt because there's no way to gracefully -+ * recover. -+ */ -+ if (hcd->core_if->dma_desc_enable) -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ hc->halt_status); -+ else -+ release_channel(hcd, hc, qtd, hc->halt_status); -+ return; -+ } -+ -+ /* Read the HCINTn register to determine the cause for the halt. */ -+ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -+ -+ if (hcint.b.xfercomp) { -+ /** @todo This is here because of a possible hardware bug. Spec -+ * says that on SPLIT-ISOC OUT transfers in DMA mode that a HALT -+ * interrupt w/ACK bit set should occur, but I only see the -+ * XFERCOMP bit, even with it masked out. This is a workaround -+ * for that behavior. Should fix this when hardware is fixed. -+ */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { -+ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); -+ } -+ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.stall) { -+ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.xacterr && !hcd->core_if->dma_desc_enable) { -+ if (out_nak_enh) { -+ if (hcint.b.nyet || hcint.b.nak || hcint.b.ack) { -+ DWC_DEBUGPL(DBG_HCD, "XactErr with NYET/NAK/ACK\n"); -+ qtd->error_count = 0; -+ } else { -+ DWC_DEBUGPL(DBG_HCD, "XactErr without NYET/NAK/ACK\n"); -+ } -+ } -+ -+ /* -+ * Must handle xacterr before nak or ack. Could get a xacterr -+ * at the same time as either of these on a BULK/CONTROL OUT -+ * that started with a PING. The xacterr takes precedence. -+ */ -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.xcs_xact && hcd->core_if->dma_desc_enable) { -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ahberr && hcd->core_if->dma_desc_enable) { -+ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.bblerr) { -+ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.frmovrun) { -+ handle_hc_frmovrun_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.datatglerr) { -+ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); -+ } else if (!out_nak_enh) { -+ if (hcint.b.nyet) { -+ /* -+ * Must handle nyet before nak or ack. Could get a nyet at the -+ * same time as either of those on a BULK/CONTROL OUT that -+ * started with a PING. The nyet takes precedence. -+ */ -+ handle_hc_nyet_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.nak && !hcintmsk.b.nak) { -+ /* -+ * If nak is not masked, it's because a non-split IN transfer -+ * is in an error state. In that case, the nak is handled by -+ * the nak interrupt handler, not here. Handle nak here for -+ * BULK/CONTROL OUT transfers, which halt on a NAK to allow -+ * rewinding the buffer pointer. -+ */ -+ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ack && !hcintmsk.b.ack) { -+ /* -+ * If ack is not masked, it's because a non-split IN transfer -+ * is in an error state. In that case, the ack is handled by -+ * the ack interrupt handler, not here. Handle ack here for -+ * split transfers. Start splits halt on ACK. -+ */ -+ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * A periodic transfer halted with no other channel -+ * interrupts set. Assume it was halted by the core -+ * because it could not be completed in its scheduled -+ * (micro)frame. -+ */ -+#ifdef DEBUG -+ DWC_PRINTF -+ ("%s: Halt channel %d (assume incomplete periodic transfer)\n", -+ __func__, hc->hc_num); -+#endif -+ halt_channel(hcd, hc, qtd, -+ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE); -+ } else { -+ DWC_ERROR -+ ("%s: Channel %d, DMA Mode -- ChHltd set, but reason " -+ "for halting is unknown, hcint 0x%08x, intsts 0x%08x\n", -+ __func__, hc->hc_num, hcint.d32, -+ DWC_READ_REG32(&hcd-> -+ core_if->core_global_regs-> -+ gintsts)); -+ /* Failthrough: use 3-strikes rule */ -+ qtd->error_count++; -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ } -+ -+ } -+ } else { -+ DWC_PRINTF("NYET/NAK/ACK/other in non-error case, 0x%08x\n", -+ hcint.d32); -+ /* Failthrough: use 3-strikes rule */ -+ qtd->error_count++; -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ } -+} -+ -+/** -+ * Handles a host channel Channel Halted interrupt. -+ * -+ * In slave mode, this handler is called only when the driver specifically -+ * requests a halt. This occurs during handling other host channel interrupts -+ * (e.g. nak, xacterr, stall, nyet, etc.). -+ * -+ * In DMA mode, this is the interrupt that occurs when the core has finished -+ * processing a transfer on a channel. Other host channel interrupts (except -+ * ahberr) are disabled in DMA mode. -+ */ -+static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Channel Halted--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_enable) { -+ handle_hc_chhltd_intr_dma(hcd, hc, hc_regs, qtd); -+ } else { -+#ifdef DEBUG -+ if (!halt_status_ok(hcd, hc, hc_regs, qtd)) { -+ return 1; -+ } -+#endif -+ release_channel(hcd, hc, qtd, hc->halt_status); -+ } -+ -+ return 1; -+} -+ -+ -+/** -+ * dwc_otg_fiq_unmangle_isoc() - Update the iso_frame_desc structure on -+ * FIQ transfer completion -+ * @hcd: Pointer to dwc_otg_hcd struct -+ * @num: Host channel number -+ * -+ * 1. Un-mangle the status as recorded in each iso_frame_desc status -+ * 2. Copy it from the dwc_otg_urb into the real URB -+ */ -+void dwc_otg_fiq_unmangle_isoc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) -+{ -+ struct dwc_otg_hcd_urb *dwc_urb = qtd->urb; -+ int nr_frames = dwc_urb->packet_count; -+ int i; -+ hcint_data_t frame_hcint; -+ -+ for (i = 0; i < nr_frames; i++) { -+ frame_hcint.d32 = dwc_urb->iso_descs[i].status; -+ if (frame_hcint.b.xfercomp) { -+ dwc_urb->iso_descs[i].status = 0; -+ dwc_urb->actual_length += dwc_urb->iso_descs[i].actual_length; -+ } else if (frame_hcint.b.frmovrun) { -+ if (qh->ep_is_in) -+ dwc_urb->iso_descs[i].status = -DWC_E_NO_STREAM_RES; -+ else -+ dwc_urb->iso_descs[i].status = -DWC_E_COMMUNICATION; -+ dwc_urb->error_count++; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ } else if (frame_hcint.b.xacterr) { -+ dwc_urb->iso_descs[i].status = -DWC_E_PROTOCOL; -+ dwc_urb->error_count++; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ } else if (frame_hcint.b.bblerr) { -+ dwc_urb->iso_descs[i].status = -DWC_E_OVERFLOW; -+ dwc_urb->error_count++; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ } else { -+ /* Something went wrong */ -+ dwc_urb->iso_descs[i].status = -1; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ dwc_urb->error_count++; -+ } -+ } -+ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1)); -+ -+ //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n", -+ // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count); -+} -+ -+/** -+ * dwc_otg_fiq_unsetup_per_dma() - Remove data from bounce buffers for split transactions -+ * @hcd: Pointer to dwc_otg_hcd struct -+ * @num: Host channel number -+ * -+ * Copies data from the FIQ bounce buffers into the URB's transfer buffer. Does not modify URB state. -+ * Returns total length of data or -1 if the buffers were not used. -+ * -+ */ -+int dwc_otg_fiq_unsetup_per_dma(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) -+{ -+ dwc_hc_t *hc = qh->channel; -+ struct fiq_dma_blob *blob = hcd->fiq_dmab; -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; -+ uint8_t *ptr = NULL; -+ int index = 0, len = 0; -+ int i = 0; -+ if (hc->ep_is_in) { -+ /* Copy data out of the DMA bounce buffers to the URB's buffer. -+ * The align_buf is ignored as this is ignored on FSM enqueue. */ -+ ptr = qtd->urb->buf; -+ if (qh->ep_type == UE_ISOCHRONOUS) { -+ /* Isoc IN transactions - grab the offset of the iso_frame_desc into the URB transfer buffer */ -+ index = qtd->isoc_frame_index; -+ ptr += qtd->urb->iso_descs[index].offset; -+ } else { -+ /* Need to increment by actual_length for interrupt IN */ -+ ptr += qtd->urb->actual_length; -+ } -+ -+ for (i = 0; i < st->dma_info.index; i++) { -+ len += st->dma_info.slot_len[i]; -+ dwc_memcpy(ptr, &blob->channel[num].index[i].buf[0], st->dma_info.slot_len[i]); -+ ptr += st->dma_info.slot_len[i]; -+ } -+ return len; -+ } else { -+ /* OUT endpoints - nothing to do. */ -+ return -1; -+ } -+ -+} -+/** -+ * dwc_otg_hcd_handle_hc_fsm() - handle an unmasked channel interrupt -+ * from a channel handled in the FIQ -+ * @hcd: Pointer to dwc_otg_hcd struct -+ * @num: Host channel number -+ * -+ * If a host channel interrupt was received by the IRQ and this was a channel -+ * used by the FIQ, the execution flow for transfer completion is substantially -+ * different from the normal (messy) path. This function and its friends handles -+ * channel cleanup and transaction completion from a FIQ transaction. -+ */ -+void dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num) -+{ -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; -+ dwc_hc_t *hc = hcd->hc_ptr_array[num]; -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); -+ dwc_otg_qh_t *qh = hc->qh; -+ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[num]; -+ hcint_data_t hcint = hcd->fiq_state->channel[num].hcint_copy; -+ int hostchannels = 0; -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "OUT %01d %01d ", num , st->fsm); -+ -+ hostchannels = hcd->available_host_channels; -+ switch (st->fsm) { -+ case FIQ_TEST: -+ break; -+ -+ case FIQ_DEQUEUE_ISSUED: -+ /* hc_halt was called. QTD no longer exists. */ -+ /* TODO: for a nonperiodic split transaction, need to issue a -+ * CLEAR_TT_BUFFER hub command if we were in the start-split phase. -+ */ -+ release_channel(hcd, hc, NULL, hc->halt_status); -+ break; -+ -+ case FIQ_NP_SPLIT_DONE: -+ /* Nonperiodic transaction complete. */ -+ if (!hc->ep_is_in) { -+ qtd->ssplit_out_xfer_count = hc->xfer_len; -+ } -+ if (hcint.b.xfercomp) { -+ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.nak) { -+ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); -+ } -+ break; -+ -+ case FIQ_NP_SPLIT_HS_ABORTED: -+ /* A HS abort is a 3-strikes on the HS bus at any point in the transaction. -+ * Normally a CLEAR_TT_BUFFER hub command would be required: we can't do that -+ * because there's no guarantee which order a non-periodic split happened in. -+ * We could end up clearing a perfectly good transaction out of the buffer. -+ */ -+ if (hcint.b.xacterr) { -+ qtd->error_count += st->nr_errors; -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ahberr) { -+ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ local_fiq_disable(); -+ BUG(); -+ } -+ break; -+ -+ case FIQ_NP_SPLIT_LS_ABORTED: -+ /* A few cases can cause this - either an unknown state on a SSPLIT or -+ * STALL/data toggle error response on a CSPLIT */ -+ if (hcint.b.stall) { -+ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.datatglerr) { -+ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.bblerr) { -+ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ahberr) { -+ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ local_fiq_disable(); -+ BUG(); -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_DONE: -+ /* Isoc IN or Interrupt IN/OUT */ -+ -+ /* Flow control here is different from the normal execution by the driver. -+ * We need to completely ignore most of the driver's method of handling -+ * split transactions and do it ourselves. -+ */ -+ if (hc->ep_type == UE_INTERRUPT) { -+ if (hcint.b.nak) { -+ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); -+ } else if (hc->ep_is_in) { -+ int len; -+ len = dwc_otg_fiq_unsetup_per_dma(hcd, hc->qh, qtd, num); -+ //printk(KERN_NOTICE "FIQ Transaction: hc=%d len=%d urb_len = %d\n", num, len, qtd->urb->length); -+ qtd->urb->actual_length += len; -+ if (qtd->urb->actual_length >= qtd->urb->length) { -+ qtd->urb->status = 0; -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ /* Interrupt transfer not complete yet - is it a short read? */ -+ if (len < hc->max_packet) { -+ /* Interrupt transaction complete */ -+ qtd->urb->status = 0; -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ /* Further transactions required */ -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ } else { -+ /* Interrupt OUT complete. */ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ qtd->urb->actual_length += hc->xfer_len; -+ if (qtd->urb->actual_length >= qtd->urb->length) { -+ qtd->urb->status = 0; -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ } else { -+ /* ISOC IN complete. */ -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ int len = 0; -+ /* Record errors, update qtd. */ -+ if (st->nr_errors) { -+ frame_desc->actual_length = 0; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ } else { -+ frame_desc->status = 0; -+ /* Unswizzle dma */ -+ len = dwc_otg_fiq_unsetup_per_dma(hcd, qh, qtd, num); -+ frame_desc->actual_length = len; -+ } -+ qtd->isoc_frame_index++; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ break; -+ -+ case FIQ_PER_ISO_OUT_DONE: { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ /* Record errors, update qtd. */ -+ if (st->nr_errors) { -+ frame_desc->actual_length = 0; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ } else { -+ frame_desc->status = 0; -+ frame_desc->actual_length = frame_desc->length; -+ } -+ qtd->isoc_frame_index++; -+ qtd->isoc_split_offset = 0; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_NYET_ABORTED: -+ /* Doh. lost the data. */ -+ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " -+ "- FIQ reported NYET. Data may have been lost.\n", -+ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); -+ if (hc->ep_type == UE_ISOCHRONOUS) { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ /* Record errors, update qtd. */ -+ frame_desc->actual_length = 0; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ qtd->isoc_frame_index++; -+ qtd->isoc_split_offset = 0; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ break; -+ -+ case FIQ_HS_ISOC_DONE: -+ /* The FIQ has performed a whole pile of isochronous transactions. -+ * The status is recorded as the interrupt state should the transaction -+ * fail. -+ */ -+ dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num); -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ break; -+ -+ case FIQ_PER_SPLIT_LS_ABORTED: -+ if (hcint.b.xacterr) { -+ /* Hub has responded with an ERR packet. Device -+ * has been unplugged or the port has been disabled. -+ * TODO: need to issue a reset to the hub port. */ -+ qtd->error_count += 3; -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.stall) { -+ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.bblerr) { -+ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x failed " -+ "- FIQ reported FSM=%d. Data may have been lost.\n", -+ st->fsm, hc->dev_addr, hc->ep_num); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_HS_ABORTED: -+ /* Either the SSPLIT phase suffered transaction errors or something -+ * unexpected happened. -+ */ -+ qtd->error_count += 3; -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ break; -+ -+ case FIQ_PER_SPLIT_TIMEOUT: -+ /* Couldn't complete in the nominated frame */ -+ printk(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " -+ "- FIQ timed out. Data may have been lost.\n", -+ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); -+ if (hc->ep_type == UE_ISOCHRONOUS) { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ /* Record errors, update qtd. */ -+ frame_desc->actual_length = 0; -+ if (hc->ep_is_in) { -+ frame_desc->status = -DWC_E_NO_STREAM_RES; -+ } else { -+ frame_desc->status = -DWC_E_COMMUNICATION; -+ } -+ qtd->isoc_frame_index++; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ break; -+ -+ default: -+ DWC_WARN("Unexpected state received on hc=%d fsm=%d on transfer to device %d ep 0x%x", -+ hc->hc_num, st->fsm, hc->dev_addr, hc->ep_num); -+ qtd->error_count++; -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ return; -+} -+ -+/** Handles interrupt for a specific Host Channel */ -+int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) -+{ -+ int retval = 0; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ dwc_hc_t *hc; -+ dwc_otg_hc_regs_t *hc_regs; -+ dwc_otg_qtd_t *qtd; -+ -+ DWC_DEBUGPL(DBG_HCDV, "--Host Channel Interrupt--, Channel %d\n", num); -+ -+ hc = dwc_otg_hcd->hc_ptr_array[num]; -+ hc_regs = dwc_otg_hcd->core_if->host_if->hc_regs[num]; -+ if(hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ /* We are responding to a channel disable. Driver -+ * state is cleared - our qtd has gone away. -+ */ -+ release_channel(dwc_otg_hcd, hc, NULL, hc->halt_status); -+ return 1; -+ } -+ qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); -+ -+ /* -+ * FSM mode: Check to see if this is a HC interrupt from a channel handled by the FIQ. -+ * Execution path is fundamentally different for the channels after a FIQ has completed -+ * a split transaction. -+ */ -+ if (fiq_fsm_enable) { -+ switch (dwc_otg_hcd->fiq_state->channel[num].fsm) { -+ case FIQ_PASSTHROUGH: -+ break; -+ case FIQ_PASSTHROUGH_ERRORSTATE: -+ /* Hook into the error count */ -+ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "HCDERR%02d", num); -+ if (!dwc_otg_hcd->fiq_state->channel[num].nr_errors) { -+ qtd->error_count = 0; -+ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "RESET "); -+ } -+ break; -+ default: -+ dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd, num); -+ return 1; -+ } -+ } -+ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -+ hcint.d32 = hcint.d32 & hcintmsk.d32; -+ if (!dwc_otg_hcd->core_if->dma_enable) { -+ if (hcint.b.chhltd && hcint.d32 != 0x2) { -+ hcint.b.chhltd = 0; -+ } -+ } -+ -+ if (hcint.b.xfercomp) { -+ retval |= -+ handle_hc_xfercomp_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ /* -+ * If NYET occurred at same time as Xfer Complete, the NYET is -+ * handled by the Xfer Complete interrupt handler. Don't want -+ * to call the NYET interrupt handler in this case. -+ */ -+ hcint.b.nyet = 0; -+ } -+ if (hcint.b.chhltd) { -+ retval |= handle_hc_chhltd_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.ahberr) { -+ retval |= handle_hc_ahberr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.stall) { -+ retval |= handle_hc_stall_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.nak) { -+ retval |= handle_hc_nak_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.ack) { -+ if(!hcint.b.chhltd) -+ retval |= handle_hc_ack_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.nyet) { -+ retval |= handle_hc_nyet_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.xacterr) { -+ retval |= handle_hc_xacterr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.bblerr) { -+ retval |= handle_hc_babble_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.frmovrun) { -+ retval |= -+ handle_hc_frmovrun_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.datatglerr) { -+ retval |= -+ handle_hc_datatglerr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ -+ return retval; -+} -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -new file mode 100644 -index 0000000000000000000000000000000000000000..74cd5fa54aed5241b61371477ef67d706477fd30 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -0,0 +1,1005 @@ -+ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ -+ * $Revision: #20 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1872981 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** -+ * @file -+ * -+ * This file contains the implementation of the HCD. In Linux, the HCD -+ * implements the hc_driver API. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) -+#include <../drivers/usb/core/hcd.h> -+#else -+#include -+#endif -+#include -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) -+#define USB_URB_EP_LINKING 1 -+#else -+#define USB_URB_EP_LINKING 0 -+#endif -+ -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_dbg.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_hcd.h" -+ -+extern unsigned char _dwc_otg_fiq_stub, _dwc_otg_fiq_stub_end; -+ -+/** -+ * Gets the endpoint number from a _bEndpointAddress argument. The endpoint is -+ * qualified with its direction (possible 32 endpoints per device). -+ */ -+#define dwc_ep_addr_to_endpoint(_bEndpointAddress_) ((_bEndpointAddress_ & USB_ENDPOINT_NUMBER_MASK) | \ -+ ((_bEndpointAddress_ & USB_DIR_IN) != 0) << 4) -+ -+static const char dwc_otg_hcd_name[] = "dwc_otg_hcd"; -+ -+extern bool fiq_enable; -+ -+/** @name Linux HC Driver API Functions */ -+/** @{ */ -+/* manage i/o requests, device state */ -+static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep, -+#endif -+ struct urb *urb, gfp_t mem_flags); -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb); -+#endif -+#else /* kernels at or post 2.6.30 */ -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, -+ struct urb *urb, int status); -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ -+ -+static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); -+#endif -+static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd); -+extern int hcd_start(struct usb_hcd *hcd); -+extern void hcd_stop(struct usb_hcd *hcd); -+static int get_frame_number(struct usb_hcd *hcd); -+extern int hub_status_data(struct usb_hcd *hcd, char *buf); -+extern int hub_control(struct usb_hcd *hcd, -+ u16 typeReq, -+ u16 wValue, u16 wIndex, char *buf, u16 wLength); -+ -+struct wrapper_priv_data { -+ dwc_otg_hcd_t *dwc_otg_hcd; -+}; -+ -+/** @} */ -+ -+static struct hc_driver dwc_otg_hc_driver = { -+ -+ .description = dwc_otg_hcd_name, -+ .product_desc = "DWC OTG Controller", -+ .hcd_priv_size = sizeof(struct wrapper_priv_data), -+ -+ .irq = dwc_otg_hcd_irq, -+ -+ .flags = HCD_MEMORY | HCD_USB2, -+ -+ //.reset = -+ .start = hcd_start, -+ //.suspend = -+ //.resume = -+ .stop = hcd_stop, -+ -+ .urb_enqueue = dwc_otg_urb_enqueue, -+ .urb_dequeue = dwc_otg_urb_dequeue, -+ .endpoint_disable = endpoint_disable, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+ .endpoint_reset = endpoint_reset, -+#endif -+ .get_frame_number = get_frame_number, -+ -+ .hub_status_data = hub_status_data, -+ .hub_control = hub_control, -+ //.bus_suspend = -+ //.bus_resume = -+}; -+ -+/** Gets the dwc_otg_hcd from a struct usb_hcd */ -+static inline dwc_otg_hcd_t *hcd_to_dwc_otg_hcd(struct usb_hcd *hcd) -+{ -+ struct wrapper_priv_data *p; -+ p = (struct wrapper_priv_data *)(hcd->hcd_priv); -+ return p->dwc_otg_hcd; -+} -+ -+/** Gets the struct usb_hcd that contains a dwc_otg_hcd_t. */ -+static inline struct usb_hcd *dwc_otg_hcd_to_hcd(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ return dwc_otg_hcd_get_priv_data(dwc_otg_hcd); -+} -+ -+/** Gets the usb_host_endpoint associated with an URB. */ -+inline struct usb_host_endpoint *dwc_urb_to_endpoint(struct urb *urb) -+{ -+ struct usb_device *dev = urb->dev; -+ int ep_num = usb_pipeendpoint(urb->pipe); -+ -+ if (usb_pipein(urb->pipe)) -+ return dev->ep_in[ep_num]; -+ else -+ return dev->ep_out[ep_num]; -+} -+ -+static int _disconnect(dwc_otg_hcd_t * hcd) -+{ -+ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); -+ -+ usb_hcd->self.is_b_host = 0; -+ return 0; -+} -+ -+static int _start(dwc_otg_hcd_t * hcd) -+{ -+ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); -+ -+ usb_hcd->self.is_b_host = dwc_otg_hcd_is_b_host(hcd); -+ hcd_start(usb_hcd); -+ -+ return 0; -+} -+ -+static int _hub_info(dwc_otg_hcd_t * hcd, void *urb_handle, uint32_t * hub_addr, -+ uint32_t * port_addr) -+{ -+ struct urb *urb = (struct urb *)urb_handle; -+ struct usb_bus *bus; -+#if 1 //GRAYG - temporary -+ if (NULL == urb_handle) -+ DWC_ERROR("**** %s - NULL URB handle\n", __func__);//GRAYG -+ if (NULL == urb->dev) -+ DWC_ERROR("**** %s - URB has no device\n", __func__);//GRAYG -+ if (NULL == port_addr) -+ DWC_ERROR("**** %s - NULL port_address\n", __func__);//GRAYG -+#endif -+ if (urb->dev->tt) { -+ if (NULL == urb->dev->tt->hub) { -+ DWC_ERROR("**** %s - (URB's transactor has no TT - giving no hub)\n", -+ __func__); //GRAYG -+ //*hub_addr = (u8)usb_pipedevice(urb->pipe); //GRAYG -+ *hub_addr = 0; //GRAYG -+ // we probably shouldn't have a transaction translator if -+ // there's no associated hub? -+ } else { -+ bus = hcd_to_bus(dwc_otg_hcd_to_hcd(hcd)); -+ if (urb->dev->tt->hub == bus->root_hub) -+ *hub_addr = 0; -+ else -+ *hub_addr = urb->dev->tt->hub->devnum; -+ } -+ *port_addr = urb->dev->tt->multi ? urb->dev->ttport : 1; -+ } else { -+ *hub_addr = 0; -+ *port_addr = urb->dev->ttport; -+ } -+ return 0; -+} -+ -+static int _speed(dwc_otg_hcd_t * hcd, void *urb_handle) -+{ -+ struct urb *urb = (struct urb *)urb_handle; -+ return urb->dev->speed; -+} -+ -+static int _get_b_hnp_enable(dwc_otg_hcd_t * hcd) -+{ -+ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); -+ return usb_hcd->self.b_hnp_enable; -+} -+ -+static void allocate_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, -+ struct urb *urb) -+{ -+ hcd_to_bus(hcd)->bandwidth_allocated += bw / urb->interval; -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ hcd_to_bus(hcd)->bandwidth_isoc_reqs++; -+ } else { -+ hcd_to_bus(hcd)->bandwidth_int_reqs++; -+ } -+} -+ -+static void free_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, -+ struct urb *urb) -+{ -+ hcd_to_bus(hcd)->bandwidth_allocated -= bw / urb->interval; -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ hcd_to_bus(hcd)->bandwidth_isoc_reqs--; -+ } else { -+ hcd_to_bus(hcd)->bandwidth_int_reqs--; -+ } -+} -+ -+/** -+ * Sets the final status of an URB and returns it to the device driver. Any -+ * required cleanup of the URB is performed. The HCD lock should be held on -+ * entry. -+ */ -+static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, int32_t status) -+{ -+ struct urb *urb = (struct urb *)urb_handle; -+ urb_tq_entry_t *new_entry; -+ int rc = 0; -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ DWC_PRINTF("%s: urb %p, device %d, ep %d %s, status=%d\n", -+ __func__, urb, usb_pipedevice(urb->pipe), -+ usb_pipeendpoint(urb->pipe), -+ usb_pipein(urb->pipe) ? "IN" : "OUT", status); -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ int i; -+ for (i = 0; i < urb->number_of_packets; i++) { -+ DWC_PRINTF(" ISO Desc %d status: %d\n", -+ i, urb->iso_frame_desc[i].status); -+ } -+ } -+ } -+ new_entry = DWC_ALLOC_ATOMIC(sizeof(urb_tq_entry_t)); -+ urb->actual_length = dwc_otg_hcd_urb_get_actual_length(dwc_otg_urb); -+ /* Convert status value. */ -+ switch (status) { -+ case -DWC_E_PROTOCOL: -+ status = -EPROTO; -+ break; -+ case -DWC_E_IN_PROGRESS: -+ status = -EINPROGRESS; -+ break; -+ case -DWC_E_PIPE: -+ status = -EPIPE; -+ break; -+ case -DWC_E_IO: -+ status = -EIO; -+ break; -+ case -DWC_E_TIMEOUT: -+ status = -ETIMEDOUT; -+ break; -+ case -DWC_E_OVERFLOW: -+ status = -EOVERFLOW; -+ break; -+ case -DWC_E_SHUTDOWN: -+ status = -ESHUTDOWN; -+ break; -+ default: -+ if (status) { -+ DWC_PRINTF("Uknown urb status %d\n", status); -+ -+ } -+ } -+ -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ int i; -+ -+ urb->error_count = dwc_otg_hcd_urb_get_error_count(dwc_otg_urb); -+ for (i = 0; i < urb->number_of_packets; ++i) { -+ urb->iso_frame_desc[i].actual_length = -+ dwc_otg_hcd_urb_get_iso_desc_actual_length -+ (dwc_otg_urb, i); -+ urb->iso_frame_desc[i].status = -+ dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i); -+ } -+ } -+ -+ urb->status = status; -+ urb->hcpriv = NULL; -+ if (!status) { -+ if ((urb->transfer_flags & URB_SHORT_NOT_OK) && -+ (urb->actual_length < urb->transfer_buffer_length)) { -+ urb->status = -EREMOTEIO; -+ } -+ } -+ -+ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) || -+ (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { -+ struct usb_host_endpoint *ep = dwc_urb_to_endpoint(urb); -+ if (ep) { -+ free_bus_bandwidth(dwc_otg_hcd_to_hcd(hcd), -+ dwc_otg_hcd_get_ep_bandwidth(hcd, -+ ep->hcpriv), -+ urb); -+ } -+ } -+ DWC_FREE(dwc_otg_urb); -+ if (!new_entry) { -+ DWC_ERROR("dwc_otg_hcd: complete: cannot allocate URB TQ entry\n"); -+ urb->status = -EPROTO; -+ /* don't schedule the tasklet - -+ * directly return the packet here with error. */ -+#if USB_URB_EP_LINKING -+ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb); -+#else -+ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); -+#endif -+ } else { -+ new_entry->urb = urb; -+#if USB_URB_EP_LINKING -+ rc = usb_hcd_check_unlink_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); -+ if(0 == rc) { -+ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); -+ } -+#endif -+ if(0 == rc) { -+ DWC_TAILQ_INSERT_TAIL(&hcd->completed_urb_list, new_entry, -+ urb_tq_entries); -+ DWC_TASK_HI_SCHEDULE(hcd->completion_tasklet); -+ } -+ } -+ return 0; -+} -+ -+static struct dwc_otg_hcd_function_ops hcd_fops = { -+ .start = _start, -+ .disconnect = _disconnect, -+ .hub_info = _hub_info, -+ .speed = _speed, -+ .complete = _complete, -+ .get_b_hnp_enable = _get_b_hnp_enable, -+}; -+ -+static struct fiq_handler fh = { -+ .name = "usb_fiq", -+}; -+ -+static void hcd_init_fiq(void *cookie) -+{ -+ dwc_otg_device_t *otg_dev = cookie; -+ dwc_otg_hcd_t *dwc_otg_hcd = otg_dev->hcd; -+ struct pt_regs regs; -+ int irq; -+ -+ if (claim_fiq(&fh)) { -+ DWC_ERROR("Can't claim FIQ"); -+ BUG(); -+ } -+ DWC_WARN("FIQ on core %d at 0x%08x", -+ smp_processor_id(), -+ (fiq_fsm_enable ? (int)&dwc_otg_fiq_fsm : (int)&dwc_otg_fiq_nop)); -+ DWC_WARN("FIQ ASM at 0x%08x length %d", (int)&_dwc_otg_fiq_stub, (int)(&_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub)); -+ set_fiq_handler((void *) &_dwc_otg_fiq_stub, &_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub); -+ memset(®s,0,sizeof(regs)); -+ -+ regs.ARM_r8 = (long) dwc_otg_hcd->fiq_state; -+ if (fiq_fsm_enable) { -+ regs.ARM_r9 = dwc_otg_hcd->core_if->core_params->host_channels; -+ //regs.ARM_r10 = dwc_otg_hcd->dma; -+ regs.ARM_fp = (long) dwc_otg_fiq_fsm; -+ } else { -+ regs.ARM_fp = (long) dwc_otg_fiq_nop; -+ } -+ -+ regs.ARM_sp = (long) dwc_otg_hcd->fiq_stack + (sizeof(struct fiq_stack) - 4); -+ -+// __show_regs(®s); -+ set_fiq_regs(®s); -+ -+ //Set the mphi periph to the required registers -+ dwc_otg_hcd->fiq_state->mphi_regs.base = otg_dev->os_dep.mphi_base; -+ dwc_otg_hcd->fiq_state->mphi_regs.ctrl = otg_dev->os_dep.mphi_base + 0x4c; -+ dwc_otg_hcd->fiq_state->mphi_regs.outdda = otg_dev->os_dep.mphi_base + 0x28; -+ dwc_otg_hcd->fiq_state->mphi_regs.outddb = otg_dev->os_dep.mphi_base + 0x2c; -+ dwc_otg_hcd->fiq_state->mphi_regs.intstat = otg_dev->os_dep.mphi_base + 0x50; -+ dwc_otg_hcd->fiq_state->dwc_regs_base = otg_dev->os_dep.base; -+ DWC_WARN("MPHI regs_base at 0x%08x", (int)dwc_otg_hcd->fiq_state->mphi_regs.base); -+ //Enable mphi peripheral -+ writel((1<<31),dwc_otg_hcd->fiq_state->mphi_regs.ctrl); -+#ifdef DEBUG -+ if (readl(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & 0x80000000) -+ DWC_WARN("MPHI periph has been enabled"); -+ else -+ DWC_WARN("MPHI periph has NOT been enabled"); -+#endif -+ // Enable FIQ interrupt from USB peripheral -+#ifdef CONFIG_MULTI_IRQ_HANDLER -+ irq = platform_get_irq(otg_dev->os_dep.platformdev, 1); -+#else -+ irq = INTERRUPT_VC_USB; -+#endif -+ if (irq < 0) { -+ DWC_ERROR("Can't get FIQ irq"); -+ return; -+ } -+ enable_fiq(irq); -+ local_fiq_enable(); -+} -+ -+/** -+ * Initializes the HCD. This function allocates memory for and initializes the -+ * static parts of the usb_hcd and dwc_otg_hcd structures. It also registers the -+ * USB bus with the core and calls the hc_driver->start() function. It returns -+ * a negative error on failure. -+ */ -+int hcd_init(dwc_bus_dev_t *_dev) -+{ -+ struct usb_hcd *hcd = NULL; -+ dwc_otg_hcd_t *dwc_otg_hcd = NULL; -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ int retval = 0; -+ u64 dmamask; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT otg_dev=%p\n", otg_dev); -+ -+ /* Set device flags indicating whether the HCD supports DMA. */ -+ if (dwc_otg_is_dma_enable(otg_dev->core_if)) -+ dmamask = DMA_BIT_MASK(32); -+ else -+ dmamask = 0; -+ -+#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) -+ dma_set_mask(&_dev->dev, dmamask); -+ dma_set_coherent_mask(&_dev->dev, dmamask); -+#elif defined(PCI_INTERFACE) -+ pci_set_dma_mask(_dev, dmamask); -+ pci_set_consistent_dma_mask(_dev, dmamask); -+#endif -+ -+ /* -+ * Allocate memory for the base HCD plus the DWC OTG HCD. -+ * Initialize the base HCD. -+ */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, _dev->dev.bus_id); -+#else -+ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, dev_name(&_dev->dev)); -+ hcd->has_tt = 1; -+// hcd->uses_new_polling = 1; -+// hcd->poll_rh = 0; -+#endif -+ if (!hcd) { -+ retval = -ENOMEM; -+ goto error1; -+ } -+ -+ hcd->regs = otg_dev->os_dep.base; -+ -+ -+ /* Initialize the DWC OTG HCD. */ -+ dwc_otg_hcd = dwc_otg_hcd_alloc_hcd(); -+ if (!dwc_otg_hcd) { -+ goto error2; -+ } -+ ((struct wrapper_priv_data *)(hcd->hcd_priv))->dwc_otg_hcd = -+ dwc_otg_hcd; -+ otg_dev->hcd = dwc_otg_hcd; -+ otg_dev->hcd->otg_dev = otg_dev; -+ -+ if (dwc_otg_hcd_init(dwc_otg_hcd, otg_dev->core_if)) { -+ goto error2; -+ } -+ -+ if (fiq_enable) { -+ if (num_online_cpus() > 1) { -+ /* bcm2709: can run the FIQ on a separate core to IRQs */ -+ smp_call_function_single(1, hcd_init_fiq, otg_dev, 1); -+ } else { -+ smp_call_function_single(0, hcd_init_fiq, otg_dev, 1); -+ } -+ } -+ -+ hcd->self.otg_port = dwc_otg_hcd_otg_port(dwc_otg_hcd); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) //don't support for LM(with 2.6.20.1 kernel) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) //version field absent later -+ hcd->self.otg_version = dwc_otg_get_otg_version(otg_dev->core_if); -+#endif -+ /* Don't support SG list at this point */ -+ hcd->self.sg_tablesize = 0; -+#endif -+ /* -+ * Finish generic HCD initialization and start the HCD. This function -+ * allocates the DMA buffer pool, registers the USB bus, requests the -+ * IRQ line, and calls hcd_start method. -+ */ -+#ifdef PLATFORM_INTERFACE -+ retval = usb_add_hcd(hcd, platform_get_irq(_dev, fiq_enable ? 0 : 1), IRQF_SHARED); -+#else -+ retval = usb_add_hcd(hcd, _dev->irq, IRQF_SHARED); -+#endif -+ if (retval < 0) { -+ goto error2; -+ } -+ -+ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, hcd); -+ return 0; -+ -+error2: -+ usb_put_hcd(hcd); -+error1: -+ return retval; -+} -+ -+/** -+ * Removes the HCD. -+ * Frees memory and resources associated with the HCD and deregisters the bus. -+ */ -+void hcd_remove(dwc_bus_dev_t *_dev) -+{ -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ dwc_otg_hcd_t *dwc_otg_hcd; -+ struct usb_hcd *hcd; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD REMOVE otg_dev=%p\n", otg_dev); -+ -+ if (!otg_dev) { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); -+ return; -+ } -+ -+ dwc_otg_hcd = otg_dev->hcd; -+ -+ if (!dwc_otg_hcd) { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); -+ return; -+ } -+ -+ hcd = dwc_otg_hcd_to_hcd(dwc_otg_hcd); -+ -+ if (!hcd) { -+ DWC_DEBUGPL(DBG_ANY, -+ "%s: dwc_otg_hcd_to_hcd(dwc_otg_hcd) NULL!\n", -+ __func__); -+ return; -+ } -+ usb_remove_hcd(hcd); -+ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, NULL); -+ dwc_otg_hcd_remove(dwc_otg_hcd); -+ usb_put_hcd(hcd); -+} -+ -+/* ========================================================================= -+ * Linux HC Driver Functions -+ * ========================================================================= */ -+ -+/** Initializes the DWC_otg controller and its root hub and prepares it for host -+ * mode operation. Activates the root port. Returns 0 on success and a negative -+ * error code on failure. */ -+int hcd_start(struct usb_hcd *hcd) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ struct usb_bus *bus; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD START\n"); -+ bus = hcd_to_bus(hcd); -+ -+ hcd->state = HC_STATE_RUNNING; -+ if (dwc_otg_hcd_start(dwc_otg_hcd, &hcd_fops)) { -+ return 0; -+ } -+ -+ /* Initialize and connect root hub if one is not already attached */ -+ if (bus->root_hub) { -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD Has Root Hub\n"); -+ /* Inform the HUB driver to resume. */ -+ usb_hcd_resume_root_hub(hcd); -+ } -+ -+ return 0; -+} -+ -+/** -+ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are -+ * stopped. -+ */ -+void hcd_stop(struct usb_hcd *hcd) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+ dwc_otg_hcd_stop(dwc_otg_hcd); -+} -+ -+/** Returns the current frame number. */ -+static int get_frame_number(struct usb_hcd *hcd) -+{ -+ hprt0_data_t hprt0; -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) -+ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd) >> 3; -+ else -+ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd); -+} -+ -+#ifdef DEBUG -+static void dump_urb_info(struct urb *urb, char *fn_name) -+{ -+ DWC_PRINTF("%s, urb %p\n", fn_name, urb); -+ DWC_PRINTF(" Device address: %d\n", usb_pipedevice(urb->pipe)); -+ DWC_PRINTF(" Endpoint: %d, %s\n", usb_pipeendpoint(urb->pipe), -+ (usb_pipein(urb->pipe) ? "IN" : "OUT")); -+ DWC_PRINTF(" Endpoint type: %s\n", ( { -+ char *pipetype; -+ switch (usb_pipetype(urb->pipe)) { -+case PIPE_CONTROL: -+pipetype = "CONTROL"; break; case PIPE_BULK: -+pipetype = "BULK"; break; case PIPE_INTERRUPT: -+pipetype = "INTERRUPT"; break; case PIPE_ISOCHRONOUS: -+pipetype = "ISOCHRONOUS"; break; default: -+ pipetype = "UNKNOWN"; break;}; -+ pipetype;} -+ )) ; -+ DWC_PRINTF(" Speed: %s\n", ( { -+ char *speed; switch (urb->dev->speed) { -+case USB_SPEED_HIGH: -+speed = "HIGH"; break; case USB_SPEED_FULL: -+speed = "FULL"; break; case USB_SPEED_LOW: -+speed = "LOW"; break; default: -+ speed = "UNKNOWN"; break;}; -+ speed;} -+ )) ; -+ DWC_PRINTF(" Max packet size: %d\n", -+ usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe))); -+ DWC_PRINTF(" Data buffer length: %d\n", urb->transfer_buffer_length); -+ DWC_PRINTF(" Transfer buffer: %p, Transfer DMA: %p\n", -+ urb->transfer_buffer, (void *)urb->transfer_dma); -+ DWC_PRINTF(" Setup buffer: %p, Setup DMA: %p\n", -+ urb->setup_packet, (void *)urb->setup_dma); -+ DWC_PRINTF(" Interval: %d\n", urb->interval); -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ int i; -+ for (i = 0; i < urb->number_of_packets; i++) { -+ DWC_PRINTF(" ISO Desc %d:\n", i); -+ DWC_PRINTF(" offset: %d, length %d\n", -+ urb->iso_frame_desc[i].offset, -+ urb->iso_frame_desc[i].length); -+ } -+ } -+} -+#endif -+ -+/** Starts processing a USB transfer request specified by a USB Request Block -+ * (URB). mem_flags indicates the type of memory allocation to use while -+ * processing this URB. */ -+static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep, -+#endif -+ struct urb *urb, gfp_t mem_flags) -+{ -+ int retval = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep = urb->ep; -+#endif -+ dwc_irqflags_t irqflags; -+ void **ref_ep_hcpriv = &ep->hcpriv; -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ dwc_otg_hcd_urb_t *dwc_otg_urb; -+ int i; -+ int alloc_bandwidth = 0; -+ uint8_t ep_type = 0; -+ uint32_t flags = 0; -+ void *buf; -+ -+#ifdef DEBUG -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ dump_urb_info(urb, "dwc_otg_urb_enqueue"); -+ } -+#endif -+ -+ if (!urb->transfer_buffer && urb->transfer_buffer_length) -+ return -EINVAL; -+ -+ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) -+ || (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { -+ if (!dwc_otg_hcd_is_bandwidth_allocated -+ (dwc_otg_hcd, ref_ep_hcpriv)) { -+ alloc_bandwidth = 1; -+ } -+ } -+ -+ switch (usb_pipetype(urb->pipe)) { -+ case PIPE_CONTROL: -+ ep_type = USB_ENDPOINT_XFER_CONTROL; -+ break; -+ case PIPE_ISOCHRONOUS: -+ ep_type = USB_ENDPOINT_XFER_ISOC; -+ break; -+ case PIPE_BULK: -+ ep_type = USB_ENDPOINT_XFER_BULK; -+ break; -+ case PIPE_INTERRUPT: -+ ep_type = USB_ENDPOINT_XFER_INT; -+ break; -+ default: -+ DWC_WARN("Wrong EP type - %d\n", usb_pipetype(urb->pipe)); -+ } -+ -+ /* # of packets is often 0 - do we really need to call this then? */ -+ dwc_otg_urb = dwc_otg_hcd_urb_alloc(dwc_otg_hcd, -+ urb->number_of_packets, -+ mem_flags == GFP_ATOMIC ? 1 : 0); -+ -+ if(dwc_otg_urb == NULL) -+ return -ENOMEM; -+ -+ if (!dwc_otg_urb && urb->number_of_packets) -+ return -ENOMEM; -+ -+ dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe), -+ usb_pipeendpoint(urb->pipe), ep_type, -+ usb_pipein(urb->pipe), -+ usb_maxpacket(urb->dev, urb->pipe, -+ !(usb_pipein(urb->pipe)))); -+ -+ buf = urb->transfer_buffer; -+ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) { -+ /* -+ * Calculate virtual address from physical address, -+ * because some class driver may not fill transfer_buffer. -+ * In Buffer DMA mode virual address is used, -+ * when handling non DWORD aligned buffers. -+ */ -+ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma); -+ dev_warn_once(&urb->dev->dev, -+ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n", -+ &urb->transfer_dma, buf); -+ } -+ -+ if (!(urb->transfer_flags & URB_NO_INTERRUPT)) -+ flags |= URB_GIVEBACK_ASAP; -+ if (urb->transfer_flags & URB_ZERO_PACKET) -+ flags |= URB_SEND_ZERO_PACKET; -+ -+ dwc_otg_hcd_urb_set_params(dwc_otg_urb, urb, buf, -+ urb->transfer_dma, -+ urb->transfer_buffer_length, -+ urb->setup_packet, -+ urb->setup_dma, flags, urb->interval); -+ -+ for (i = 0; i < urb->number_of_packets; ++i) { -+ dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_urb, i, -+ urb-> -+ iso_frame_desc[i].offset, -+ urb-> -+ iso_frame_desc[i].length); -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); -+ urb->hcpriv = dwc_otg_urb; -+#if USB_URB_EP_LINKING -+ retval = usb_hcd_link_urb_to_ep(hcd, urb); -+ if (0 == retval) -+#endif -+ { -+ retval = dwc_otg_hcd_urb_enqueue(dwc_otg_hcd, dwc_otg_urb, -+ /*(dwc_otg_qh_t **)*/ -+ ref_ep_hcpriv, 1); -+ if (0 == retval) { -+ if (alloc_bandwidth) { -+ allocate_bus_bandwidth(hcd, -+ dwc_otg_hcd_get_ep_bandwidth( -+ dwc_otg_hcd, *ref_ep_hcpriv), -+ urb); -+ } -+ } else { -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); -+#if USB_URB_EP_LINKING -+ usb_hcd_unlink_urb_from_ep(hcd, urb); -+#endif -+ DWC_FREE(dwc_otg_urb); -+ urb->hcpriv = NULL; -+ if (retval == -DWC_E_NO_DEVICE) -+ retval = -ENODEV; -+ } -+ } -+#if USB_URB_EP_LINKING -+ else -+ { -+ DWC_FREE(dwc_otg_urb); -+ urb->hcpriv = NULL; -+ } -+#endif -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); -+ return retval; -+} -+ -+/** Aborts/cancels a USB transfer request. Always returns 0 to indicate -+ * success. */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) -+#else -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) -+#endif -+{ -+ dwc_irqflags_t flags; -+ dwc_otg_hcd_t *dwc_otg_hcd; -+ int rc; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue\n"); -+ -+ dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+#ifdef DEBUG -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ dump_urb_info(urb, "dwc_otg_urb_dequeue"); -+ } -+#endif -+ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ rc = usb_hcd_check_unlink_urb(hcd, urb, status); -+ if (0 == rc) { -+ if(urb->hcpriv != NULL) { -+ dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, -+ (dwc_otg_hcd_urb_t *)urb->hcpriv); -+ -+ DWC_FREE(urb->hcpriv); -+ urb->hcpriv = NULL; -+ } -+ } -+ -+ if (0 == rc) { -+ /* Higher layer software sets URB status. */ -+#if USB_URB_EP_LINKING -+ usb_hcd_unlink_urb_from_ep(hcd, urb); -+#endif -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+ -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ usb_hcd_giveback_urb(hcd, urb); -+#else -+ usb_hcd_giveback_urb(hcd, urb, status); -+#endif -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ DWC_PRINTF("Called usb_hcd_giveback_urb() \n"); -+ DWC_PRINTF(" 1urb->status = %d\n", urb->status); -+ } -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue OK\n"); -+ } else { -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue failed - rc %d\n", -+ rc); -+ } -+ -+ return rc; -+} -+ -+/* Frees resources in the DWC_otg controller related to a given endpoint. Also -+ * clears state in the HCD related to the endpoint. Any URBs for the endpoint -+ * must already be dequeued. */ -+static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+ DWC_DEBUGPL(DBG_HCD, -+ "DWC OTG HCD EP DISABLE: _bEndpointAddress=0x%02x, " -+ "endpoint=%d\n", ep->desc.bEndpointAddress, -+ dwc_ep_addr_to_endpoint(ep->desc.bEndpointAddress)); -+ dwc_otg_hcd_endpoint_disable(dwc_otg_hcd, ep->hcpriv, 250); -+ ep->hcpriv = NULL; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+/* Resets endpoint specific parameter values, in current version used to reset -+ * the data toggle(as a WA). This function can be called from usb_clear_halt routine */ -+static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) -+{ -+ dwc_irqflags_t flags; -+ struct usb_device *udev = NULL; -+ int epnum = usb_endpoint_num(&ep->desc); -+ int is_out = usb_endpoint_dir_out(&ep->desc); -+ int is_control = usb_endpoint_xfer_control(&ep->desc); -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ struct device *dev = DWC_OTG_OS_GETDEV(dwc_otg_hcd->otg_dev->os_dep); -+ -+ if (dev) -+ udev = to_usb_device(dev); -+ else -+ return; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD EP RESET: Endpoint Num=0x%02d\n", epnum); -+ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ usb_settoggle(udev, epnum, is_out, 0); -+ if (is_control) -+ usb_settoggle(udev, epnum, !is_out, 0); -+ -+ if (ep->hcpriv) { -+ dwc_otg_hcd_endpoint_reset(dwc_otg_hcd, ep->hcpriv); -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+} -+#endif -+ -+/** Handles host mode interrupts for the DWC_otg controller. Returns IRQ_NONE if -+ * there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid -+ * interrupt. -+ * -+ * This function is called by the USB core when an interrupt occurs */ -+static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ int32_t retval = dwc_otg_hcd_handle_intr(dwc_otg_hcd); -+ if (retval != 0) { -+ S3C2410X_CLEAR_EINTPEND(); -+ } -+ return IRQ_RETVAL(retval); -+} -+ -+/** Creates Status Change bitmap for the root hub and root port. The bitmap is -+ * returned in buf. Bit 0 is the status change indicator for the root hub. Bit 1 -+ * is the status change indicator for the single root port. Returns 1 if either -+ * change indicator is 1, otherwise returns 0. */ -+int hub_status_data(struct usb_hcd *hcd, char *buf) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+ buf[0] = 0; -+ buf[0] |= (dwc_otg_hcd_is_status_changed(dwc_otg_hcd, 1)) << 1; -+ -+ return (buf[0] != 0); -+} -+ -+/** Handles hub class-specific requests. */ -+int hub_control(struct usb_hcd *hcd, -+ u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength) -+{ -+ int retval; -+ -+ retval = dwc_otg_hcd_hub_control(hcd_to_dwc_otg_hcd(hcd), -+ typeReq, wValue, wIndex, buf, wLength); -+ -+ switch (retval) { -+ case -DWC_E_INVALID: -+ retval = -EINVAL; -+ break; -+ } -+ -+ return retval; -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c2dff94e8e6edd22e4427aaa1eac7aad972cb6bd ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -0,0 +1,963 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ -+ * $Revision: #44 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** -+ * @file -+ * -+ * This file contains the functions to manage Queue Heads and Queue -+ * Transfer Descriptors. -+ */ -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+ -+extern bool microframe_schedule; -+ -+/** -+ * Free each QTD in the QH's QTD-list then free the QH. QH should already be -+ * removed from a list. QTD list should already be empty if called from URB -+ * Dequeue. -+ * -+ * @param hcd HCD instance. -+ * @param qh The QH to free. -+ */ -+void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ dwc_irqflags_t flags; -+ uint32_t buf_size = 0; -+ uint8_t *align_buf_virt = NULL; -+ dwc_dma_t align_buf_dma; -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ /* Free each QTD in the QTD list */ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { -+ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); -+ dwc_otg_hcd_qtd_free(qtd); -+ } -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_qh_free_ddma(hcd, qh); -+ } else if (qh->dw_align_buf) { -+ if (qh->ep_type == UE_ISOCHRONOUS) { -+ buf_size = 4096; -+ } else { -+ buf_size = hcd->core_if->core_params->max_transfer_size; -+ } -+ align_buf_virt = qh->dw_align_buf; -+ align_buf_dma = qh->dw_align_buf_dma; -+ } -+ -+ DWC_FREE(qh); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ if (align_buf_virt) -+ DWC_DMA_FREE(dev, buf_size, align_buf_virt, align_buf_dma); -+ return; -+} -+ -+#define BitStuffTime(bytecount) ((8 * 7* bytecount) / 6) -+#define HS_HOST_DELAY 5 /* nanoseconds */ -+#define FS_LS_HOST_DELAY 1000 /* nanoseconds */ -+#define HUB_LS_SETUP 333 /* nanoseconds */ -+#define NS_TO_US(ns) ((ns + 500) / 1000) -+ /* convert & round nanoseconds to microseconds */ -+ -+static uint32_t calc_bus_time(int speed, int is_in, int is_isoc, int bytecount) -+{ -+ unsigned long retval; -+ -+ switch (speed) { -+ case USB_SPEED_HIGH: -+ if (is_isoc) { -+ retval = -+ ((38 * 8 * 2083) + -+ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + -+ HS_HOST_DELAY; -+ } else { -+ retval = -+ ((55 * 8 * 2083) + -+ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + -+ HS_HOST_DELAY; -+ } -+ break; -+ case USB_SPEED_FULL: -+ if (is_isoc) { -+ retval = -+ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; -+ if (is_in) { -+ retval = 7268 + FS_LS_HOST_DELAY + retval; -+ } else { -+ retval = 6265 + FS_LS_HOST_DELAY + retval; -+ } -+ } else { -+ retval = -+ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; -+ retval = 9107 + FS_LS_HOST_DELAY + retval; -+ } -+ break; -+ case USB_SPEED_LOW: -+ if (is_in) { -+ retval = -+ (67667 * (31 + 10 * BitStuffTime(bytecount))) / -+ 1000; -+ retval = -+ 64060 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + -+ retval; -+ } else { -+ retval = -+ (66700 * (31 + 10 * BitStuffTime(bytecount))) / -+ 1000; -+ retval = -+ 64107 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + -+ retval; -+ } -+ break; -+ default: -+ DWC_WARN("Unknown device speed\n"); -+ retval = -1; -+ } -+ -+ return NS_TO_US(retval); -+} -+ -+/** -+ * Initializes a QH structure. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ * @param urb Holds the information about the device/endpoint that we need -+ * to initialize the QH. -+ */ -+#define SCHEDULE_SLOP 10 -+void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb) -+{ -+ char *speed, *type; -+ int dev_speed; -+ uint32_t hub_addr, hub_port; -+ -+ dwc_memset(qh, 0, sizeof(dwc_otg_qh_t)); -+ -+ /* Initialize QH */ -+ qh->ep_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); -+ qh->ep_is_in = dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? 1 : 0; -+ -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ qh->maxp = dwc_otg_hcd_get_mps(&urb->pipe_info); -+ DWC_CIRCLEQ_INIT(&qh->qtd_list); -+ DWC_LIST_INIT(&qh->qh_list_entry); -+ qh->channel = NULL; -+ -+ /* FS/LS Enpoint on HS Hub -+ * NOT virtual root hub */ -+ dev_speed = hcd->fops->speed(hcd, urb->priv); -+ -+ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &hub_port); -+ qh->do_split = 0; -+ if (microframe_schedule) -+ qh->speed = dev_speed; -+ -+ qh->nak_frame = 0xffff; -+ -+ if (((dev_speed == USB_SPEED_LOW) || -+ (dev_speed == USB_SPEED_FULL)) && -+ (hub_addr != 0 && hub_addr != 1)) { -+ DWC_DEBUGPL(DBG_HCD, -+ "QH init: EP %d: TT found at hub addr %d, for port %d\n", -+ dwc_otg_hcd_get_ep_num(&urb->pipe_info), hub_addr, -+ hub_port); -+ qh->do_split = 1; -+ qh->skip_count = 0; -+ } -+ -+ if (qh->ep_type == UE_INTERRUPT || qh->ep_type == UE_ISOCHRONOUS) { -+ /* Compute scheduling parameters once and save them. */ -+ hprt0_data_t hprt; -+ -+ /** @todo Account for split transfers in the bus time. */ -+ int bytecount = -+ dwc_hb_mult(qh->maxp) * dwc_max_packet(qh->maxp); -+ -+ qh->usecs = -+ calc_bus_time((qh->do_split ? USB_SPEED_HIGH : dev_speed), -+ qh->ep_is_in, (qh->ep_type == UE_ISOCHRONOUS), -+ bytecount); -+ /* Start in a slightly future (micro)frame. */ -+ qh->sched_frame = dwc_frame_num_inc(hcd->frame_number, -+ SCHEDULE_SLOP); -+ qh->interval = urb->interval; -+ -+#if 0 -+ /* Increase interrupt polling rate for debugging. */ -+ if (qh->ep_type == UE_INTERRUPT) { -+ qh->interval = 8; -+ } -+#endif -+ hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); -+ if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) && -+ ((dev_speed == USB_SPEED_LOW) || -+ (dev_speed == USB_SPEED_FULL))) { -+ qh->interval *= 8; -+ qh->sched_frame |= 0x7; -+ qh->start_split_frame = qh->sched_frame; -+ } -+ -+ } -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - qh = %p\n", qh); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Device Address = %d\n", -+ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Endpoint %d, %s\n", -+ dwc_otg_hcd_get_ep_num(&urb->pipe_info), -+ dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT"); -+ switch (dev_speed) { -+ case USB_SPEED_LOW: -+ qh->dev_speed = DWC_OTG_EP_SPEED_LOW; -+ speed = "low"; -+ break; -+ case USB_SPEED_FULL: -+ qh->dev_speed = DWC_OTG_EP_SPEED_FULL; -+ speed = "full"; -+ break; -+ case USB_SPEED_HIGH: -+ qh->dev_speed = DWC_OTG_EP_SPEED_HIGH; -+ speed = "high"; -+ break; -+ default: -+ speed = "?"; -+ break; -+ } -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Speed = %s\n", speed); -+ -+ switch (qh->ep_type) { -+ case UE_ISOCHRONOUS: -+ type = "isochronous"; -+ break; -+ case UE_INTERRUPT: -+ type = "interrupt"; -+ break; -+ case UE_CONTROL: -+ type = "control"; -+ break; -+ case UE_BULK: -+ type = "bulk"; -+ break; -+ default: -+ type = "?"; -+ break; -+ } -+ -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Type = %s\n", type); -+ -+#ifdef DEBUG -+ if (qh->ep_type == UE_INTERRUPT) { -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - usecs = %d\n", -+ qh->usecs); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - interval = %d\n", -+ qh->interval); -+ } -+#endif -+ -+} -+ -+/** -+ * This function allocates and initializes a QH. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param urb Holds the information about the device/endpoint that we need -+ * to initialize the QH. -+ * @param atomic_alloc Flag to do atomic allocation if needed -+ * -+ * @return Returns pointer to the newly allocated QH, or NULL on error. */ -+dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * urb, int atomic_alloc) -+{ -+ dwc_otg_qh_t *qh; -+ -+ /* Allocate memory */ -+ /** @todo add memflags argument */ -+ qh = dwc_otg_hcd_qh_alloc(atomic_alloc); -+ if (qh == NULL) { -+ DWC_ERROR("qh allocation failed"); -+ return NULL; -+ } -+ -+ qh_init(hcd, qh, urb); -+ -+ if (hcd->core_if->dma_desc_enable -+ && (dwc_otg_hcd_qh_init_ddma(hcd, qh) < 0)) { -+ dwc_otg_hcd_qh_free(hcd, qh); -+ return NULL; -+ } -+ -+ return qh; -+} -+ -+/* microframe_schedule=0 start */ -+ -+/** -+ * Checks that a channel is available for a periodic transfer. -+ * -+ * @return 0 if successful, negative error code otherise. -+ */ -+static int periodic_channel_available(dwc_otg_hcd_t * hcd) -+{ -+ /* -+ * Currently assuming that there is a dedicated host channnel for each -+ * periodic transaction plus at least one host channel for -+ * non-periodic transactions. -+ */ -+ int status; -+ int num_channels; -+ -+ num_channels = hcd->core_if->core_params->host_channels; -+ if ((hcd->periodic_channels + hcd->non_periodic_channels < num_channels) -+ && (hcd->periodic_channels < num_channels - 1)) { -+ status = 0; -+ } else { -+ DWC_INFO("%s: Total channels: %d, Periodic: %d, Non-periodic: %d\n", -+ __func__, num_channels, hcd->periodic_channels, hcd->non_periodic_channels); //NOTICE -+ status = -DWC_E_NO_SPACE; -+ } -+ -+ return status; -+} -+ -+/** -+ * Checks that there is sufficient bandwidth for the specified QH in the -+ * periodic schedule. For simplicity, this calculation assumes that all the -+ * transfers in the periodic schedule may occur in the same (micro)frame. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH containing periodic bandwidth required. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+static int check_periodic_bandwidth(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status; -+ int16_t max_claimed_usecs; -+ -+ status = 0; -+ -+ if ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) || qh->do_split) { -+ /* -+ * High speed mode. -+ * Max periodic usecs is 80% x 125 usec = 100 usec. -+ */ -+ -+ max_claimed_usecs = 100 - qh->usecs; -+ } else { -+ /* -+ * Full speed mode. -+ * Max periodic usecs is 90% x 1000 usec = 900 usec. -+ */ -+ max_claimed_usecs = 900 - qh->usecs; -+ } -+ -+ if (hcd->periodic_usecs > max_claimed_usecs) { -+ DWC_INFO("%s: already claimed usecs %d, required usecs %d\n", __func__, hcd->periodic_usecs, qh->usecs); //NOTICE -+ status = -DWC_E_NO_SPACE; -+ } -+ -+ return status; -+} -+ -+/* microframe_schedule=0 end */ -+ -+/** -+ * Microframe scheduler -+ * track the total use in hcd->frame_usecs -+ * keep each qh use in qh->frame_usecs -+ * when surrendering the qh then donate the time back -+ */ -+const unsigned short max_uframe_usecs[]={ 100, 100, 100, 100, 100, 100, 30, 0 }; -+ -+/* -+ * called from dwc_otg_hcd.c:dwc_otg_hcd_init -+ */ -+int init_hcd_usecs(dwc_otg_hcd_t *_hcd) -+{ -+ int i; -+ for (i=0; i<8; i++) { -+ _hcd->frame_usecs[i] = max_uframe_usecs[i]; -+ } -+ return 0; -+} -+ -+static int find_single_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -+{ -+ int i; -+ unsigned short utime; -+ int t_left; -+ int ret; -+ int done; -+ -+ ret = -1; -+ utime = _qh->usecs; -+ t_left = utime; -+ i = 0; -+ done = 0; -+ while (done == 0) { -+ /* At the start _hcd->frame_usecs[i] = max_uframe_usecs[i]; */ -+ if (utime <= _hcd->frame_usecs[i]) { -+ _hcd->frame_usecs[i] -= utime; -+ _qh->frame_usecs[i] += utime; -+ t_left -= utime; -+ ret = i; -+ done = 1; -+ return ret; -+ } else { -+ i++; -+ if (i == 8) { -+ done = 1; -+ ret = -1; -+ } -+ } -+ } -+ return ret; -+ } -+ -+/* -+ * use this for FS apps that can span multiple uframes -+ */ -+static int find_multi_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -+{ -+ int i; -+ int j; -+ unsigned short utime; -+ int t_left; -+ int ret; -+ int done; -+ unsigned short xtime; -+ -+ ret = -1; -+ utime = _qh->usecs; -+ t_left = utime; -+ i = 0; -+ done = 0; -+loop: -+ while (done == 0) { -+ if(_hcd->frame_usecs[i] <= 0) { -+ i++; -+ if (i == 8) { -+ done = 1; -+ ret = -1; -+ } -+ goto loop; -+ } -+ -+ /* -+ * we need n consecutive slots -+ * so use j as a start slot j plus j+1 must be enough time (for now) -+ */ -+ xtime= _hcd->frame_usecs[i]; -+ for (j = i+1 ; j < 8 ; j++ ) { -+ /* -+ * if we add this frame remaining time to xtime we may -+ * be OK, if not we need to test j for a complete frame -+ */ -+ if ((xtime+_hcd->frame_usecs[j]) < utime) { -+ if (_hcd->frame_usecs[j] < max_uframe_usecs[j]) { -+ j = 8; -+ ret = -1; -+ continue; -+ } -+ } -+ if (xtime >= utime) { -+ ret = i; -+ j = 8; /* stop loop with a good value ret */ -+ continue; -+ } -+ /* add the frame time to x time */ -+ xtime += _hcd->frame_usecs[j]; -+ /* we must have a fully available next frame or break */ -+ if ((xtime < utime) -+ && (_hcd->frame_usecs[j] == max_uframe_usecs[j])) { -+ ret = -1; -+ j = 8; /* stop loop with a bad value ret */ -+ continue; -+ } -+ } -+ if (ret >= 0) { -+ t_left = utime; -+ for (j = i; (t_left>0) && (j < 8); j++ ) { -+ t_left -= _hcd->frame_usecs[j]; -+ if ( t_left <= 0 ) { -+ _qh->frame_usecs[j] += _hcd->frame_usecs[j] + t_left; -+ _hcd->frame_usecs[j]= -t_left; -+ ret = i; -+ done = 1; -+ } else { -+ _qh->frame_usecs[j] += _hcd->frame_usecs[j]; -+ _hcd->frame_usecs[j] = 0; -+ } -+ } -+ } else { -+ i++; -+ if (i == 8) { -+ done = 1; -+ ret = -1; -+ } -+ } -+ } -+ return ret; -+} -+ -+static int find_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -+{ -+ int ret; -+ ret = -1; -+ -+ if (_qh->speed == USB_SPEED_HIGH) { -+ /* if this is a hs transaction we need a full frame */ -+ ret = find_single_uframe(_hcd, _qh); -+ } else { -+ /* if this is a fs transaction we may need a sequence of frames */ -+ ret = find_multi_uframe(_hcd, _qh); -+ } -+ return ret; -+} -+ -+/** -+ * Checks that the max transfer size allowed in a host channel is large enough -+ * to handle the maximum data transfer in a single (micro)frame for a periodic -+ * transfer. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH for a periodic endpoint. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+static int check_max_xfer_size(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status; -+ uint32_t max_xfer_size; -+ uint32_t max_channel_xfer_size; -+ -+ status = 0; -+ -+ max_xfer_size = dwc_max_packet(qh->maxp) * dwc_hb_mult(qh->maxp); -+ max_channel_xfer_size = hcd->core_if->core_params->max_transfer_size; -+ -+ if (max_xfer_size > max_channel_xfer_size) { -+ DWC_INFO("%s: Periodic xfer length %d > " "max xfer length for channel %d\n", -+ __func__, max_xfer_size, max_channel_xfer_size); //NOTICE -+ status = -DWC_E_NO_SPACE; -+ } -+ -+ return status; -+} -+ -+ -+ -+/** -+ * Schedules an interrupt or isochronous transfer in the periodic schedule. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH for the periodic transfer. The QH should already contain the -+ * scheduling information. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status = 0; -+ -+ if (microframe_schedule) { -+ int frame; -+ status = find_uframe(hcd, qh); -+ frame = -1; -+ if (status == 0) { -+ frame = 7; -+ } else { -+ if (status > 0 ) -+ frame = status-1; -+ } -+ -+ /* Set the new frame up */ -+ if (frame > -1) { -+ qh->sched_frame &= ~0x7; -+ qh->sched_frame |= (frame & 7); -+ } -+ -+ if (status != -1) -+ status = 0; -+ } else { -+ status = periodic_channel_available(hcd); -+ if (status) { -+ DWC_INFO("%s: No host channel available for periodic " "transfer.\n", __func__); //NOTICE -+ return status; -+ } -+ -+ status = check_periodic_bandwidth(hcd, qh); -+ } -+ if (status) { -+ DWC_INFO("%s: Insufficient periodic bandwidth for " -+ "periodic transfer.\n", __func__); -+ return status; -+ } -+ status = check_max_xfer_size(hcd, qh); -+ if (status) { -+ DWC_INFO("%s: Channel max transfer size too small " -+ "for periodic transfer.\n", __func__); -+ return status; -+ } -+ -+ if (hcd->core_if->dma_desc_enable) { -+ /* Don't rely on SOF and start in ready schedule */ -+ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_ready, &qh->qh_list_entry); -+ } -+ else { -+ if(fiq_enable && (DWC_LIST_EMPTY(&hcd->periodic_sched_inactive) || dwc_frame_num_le(qh->sched_frame, hcd->fiq_state->next_sched_frame))) -+ { -+ hcd->fiq_state->next_sched_frame = qh->sched_frame; -+ -+ } -+ /* Always start in the inactive schedule. */ -+ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_inactive, &qh->qh_list_entry); -+ } -+ -+ if (!microframe_schedule) { -+ /* Reserve the periodic channel. */ -+ hcd->periodic_channels++; -+ } -+ -+ /* Update claimed usecs per (micro)frame. */ -+ hcd->periodic_usecs += qh->usecs; -+ -+ return status; -+} -+ -+ -+/** -+ * This function adds a QH to either the non periodic or periodic schedule if -+ * it is not already in the schedule. If the QH is already in the schedule, no -+ * action is taken. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status = 0; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ /* QH already in a schedule. */ -+ return status; -+ } -+ -+ /* Add the new QH to the appropriate schedule */ -+ if (dwc_qh_is_non_per(qh)) { -+ /* Always start in the inactive schedule. */ -+ DWC_LIST_INSERT_TAIL(&hcd->non_periodic_sched_inactive, -+ &qh->qh_list_entry); -+ //hcd->fiq_state->kick_np_queues = 1; -+ } else { -+ status = schedule_periodic(hcd, qh); -+ if ( !hcd->periodic_qh_count ) { -+ intr_mask.b.sofintr = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+ } -+ } -+ hcd->periodic_qh_count++; -+ } -+ -+ return status; -+} -+ -+/** -+ * Removes an interrupt or isochronous transfer from the periodic schedule. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH for the periodic transfer. -+ */ -+static void deschedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int i; -+ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); -+ -+ /* Update claimed usecs per (micro)frame. */ -+ hcd->periodic_usecs -= qh->usecs; -+ -+ if (!microframe_schedule) { -+ /* Release the periodic channel reservation. */ -+ hcd->periodic_channels--; -+ } else { -+ for (i = 0; i < 8; i++) { -+ hcd->frame_usecs[i] += qh->frame_usecs[i]; -+ qh->frame_usecs[i] = 0; -+ } -+ } -+} -+ -+/** -+ * Removes a QH from either the non-periodic or periodic schedule. Memory is -+ * not freed. -+ * -+ * @param hcd The HCD state structure. -+ * @param qh QH to remove from schedule. */ -+void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ /* QH is not in a schedule. */ -+ return; -+ } -+ -+ if (dwc_qh_is_non_per(qh)) { -+ if (hcd->non_periodic_qh_ptr == &qh->qh_list_entry) { -+ hcd->non_periodic_qh_ptr = -+ hcd->non_periodic_qh_ptr->next; -+ } -+ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); -+ //if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) -+ // hcd->fiq_state->kick_np_queues = 1; -+ } else { -+ deschedule_periodic(hcd, qh); -+ hcd->periodic_qh_count--; -+ if( !hcd->periodic_qh_count && !fiq_fsm_enable ) { -+ intr_mask.b.sofintr = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); -+ } -+ } -+ } -+} -+ -+/** -+ * Deactivates a QH. For non-periodic QHs, removes the QH from the active -+ * non-periodic schedule. The QH is added to the inactive non-periodic -+ * schedule if any QTDs are still attached to the QH. -+ * -+ * For periodic QHs, the QH is removed from the periodic queued schedule. If -+ * there are any QTDs still attached to the QH, the QH is added to either the -+ * periodic inactive schedule or the periodic ready schedule and its next -+ * scheduled frame is calculated. The QH is placed in the ready schedule if -+ * the scheduled frame has been reached already. Otherwise it's placed in the -+ * inactive schedule. If there are no QTDs attached to the QH, the QH is -+ * completely removed from the periodic schedule. -+ */ -+void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ int sched_next_periodic_split) -+{ -+ if (dwc_qh_is_non_per(qh)) { -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ /* Add back to inactive non-periodic schedule. */ -+ dwc_otg_hcd_qh_add(hcd, qh); -+ //hcd->fiq_state->kick_np_queues = 1; -+ } -+ } else { -+ uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd); -+ -+ if (qh->do_split) { -+ /* Schedule the next continuing periodic split transfer */ -+ if (sched_next_periodic_split) { -+ -+ qh->sched_frame = frame_number; -+ -+ if (dwc_frame_num_le(frame_number, -+ dwc_frame_num_inc -+ (qh->start_split_frame, -+ 1))) { -+ /* -+ * Allow one frame to elapse after start -+ * split microframe before scheduling -+ * complete split, but DONT if we are -+ * doing the next start split in the -+ * same frame for an ISOC out. -+ */ -+ if ((qh->ep_type != UE_ISOCHRONOUS) || -+ (qh->ep_is_in != 0)) { -+ qh->sched_frame = -+ dwc_frame_num_inc(qh->sched_frame, 1); -+ } -+ } -+ } else { -+ qh->sched_frame = -+ dwc_frame_num_inc(qh->start_split_frame, -+ qh->interval); -+ if (dwc_frame_num_le -+ (qh->sched_frame, frame_number)) { -+ qh->sched_frame = frame_number; -+ } -+ qh->sched_frame |= 0x7; -+ qh->start_split_frame = qh->sched_frame; -+ } -+ } else { -+ qh->sched_frame = -+ dwc_frame_num_inc(qh->sched_frame, qh->interval); -+ if (dwc_frame_num_le(qh->sched_frame, frame_number)) { -+ qh->sched_frame = frame_number; -+ } -+ } -+ -+ if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } else { -+ /* -+ * Remove from periodic_sched_queued and move to -+ * appropriate queue. -+ */ -+ if ((microframe_schedule && dwc_frame_num_le(qh->sched_frame, frame_number)) || -+ (!microframe_schedule && qh->sched_frame == frame_number)) { -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, -+ &qh->qh_list_entry); -+ } else { -+ if(fiq_enable && !dwc_frame_num_le(hcd->fiq_state->next_sched_frame, qh->sched_frame)) -+ { -+ hcd->fiq_state->next_sched_frame = qh->sched_frame; -+ } -+ -+ DWC_LIST_MOVE_HEAD -+ (&hcd->periodic_sched_inactive, -+ &qh->qh_list_entry); -+ } -+ } -+ } -+} -+ -+/** -+ * This function allocates and initializes a QTD. -+ * -+ * @param urb The URB to create a QTD from. Each URB-QTD pair will end up -+ * pointing to each other so each pair should have a unique correlation. -+ * @param atomic_alloc Flag to do atomic alloc if needed -+ * -+ * @return Returns pointer to the newly allocated QTD, or NULL on error. */ -+dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, int atomic_alloc) -+{ -+ dwc_otg_qtd_t *qtd; -+ -+ qtd = dwc_otg_hcd_qtd_alloc(atomic_alloc); -+ if (qtd == NULL) { -+ return NULL; -+ } -+ -+ dwc_otg_hcd_qtd_init(qtd, urb); -+ return qtd; -+} -+ -+/** -+ * Initializes a QTD structure. -+ * -+ * @param qtd The QTD to initialize. -+ * @param urb The URB to use for initialization. */ -+void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb) -+{ -+ dwc_memset(qtd, 0, sizeof(dwc_otg_qtd_t)); -+ qtd->urb = urb; -+ if (dwc_otg_hcd_get_pipe_type(&urb->pipe_info) == UE_CONTROL) { -+ /* -+ * The only time the QTD data toggle is used is on the data -+ * phase of control transfers. This phase always starts with -+ * DATA1. -+ */ -+ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; -+ qtd->control_phase = DWC_OTG_CONTROL_SETUP; -+ } -+ -+ /* start split */ -+ qtd->complete_split = 0; -+ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; -+ qtd->isoc_split_offset = 0; -+ qtd->in_process = 0; -+ -+ /* Store the qtd ptr in the urb to reference what QTD. */ -+ urb->qtd = qtd; -+ return; -+} -+ -+/** -+ * This function adds a QTD to the QTD-list of a QH. It will find the correct -+ * QH to place the QTD into. If it does not find a QH, then it will create a -+ * new QH. If the QH to which the QTD is added is not currently scheduled, it -+ * is placed into the proper schedule based on its EP type. -+ * HCD lock must be held and interrupts must be disabled on entry -+ * -+ * @param[in] qtd The QTD to add -+ * @param[in] hcd The DWC HCD structure -+ * @param[out] qh out parameter to return queue head -+ * @param atomic_alloc Flag to do atomic alloc if needed -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, -+ dwc_otg_hcd_t * hcd, dwc_otg_qh_t ** qh, int atomic_alloc) -+{ -+ int retval = 0; -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ -+ /* -+ * Get the QH which holds the QTD-list to insert to. Create QH if it -+ * doesn't exist. -+ */ -+ if (*qh == NULL) { -+ *qh = dwc_otg_hcd_qh_create(hcd, urb, atomic_alloc); -+ if (*qh == NULL) { -+ retval = -DWC_E_NO_MEMORY; -+ goto done; -+ } else { -+ if (fiq_enable) -+ hcd->fiq_state->kick_np_queues = 1; -+ } -+ } -+ retval = dwc_otg_hcd_qh_add(hcd, *qh); -+ if (retval == 0) { -+ DWC_CIRCLEQ_INSERT_TAIL(&((*qh)->qtd_list), qtd, -+ qtd_list_entry); -+ qtd->qh = *qh; -+ } -+done: -+ -+ return retval; -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h -new file mode 100644 -index 0000000000000000000000000000000000000000..6b2c7d0c93f36a63863ff4b0ecc1f3eab77e058b ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h -@@ -0,0 +1,188 @@ -+#ifndef _DWC_OS_DEP_H_ -+#define _DWC_OS_DEP_H_ -+ -+/** -+ * @file -+ * -+ * This file contains OS dependent structures. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+# include -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -+# include -+#else -+# include -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -+# include -+#else -+# include -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+# include -+#endif -+ -+#ifdef PCI_INTERFACE -+# include -+#endif -+ -+#ifdef LM_INTERFACE -+# include -+# include -+# include -+# include -+# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -+# include -+# include -+# include -+# include -+# else -+/* in 2.6.31, at least, we seem to have lost the generic LM infrastructure - -+ here we assume that the machine architecture provides definitions -+ in its own header -+*/ -+# include -+# include -+# endif -+#endif -+ -+#ifdef PLATFORM_INTERFACE -+#include -+#include -+#endif -+ -+/** The OS page size */ -+#define DWC_OS_PAGE_SIZE PAGE_SIZE -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) -+typedef int gfp_t; -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+# define IRQF_SHARED SA_SHIRQ -+#endif -+ -+typedef struct os_dependent { -+ /** Base address returned from ioremap() */ -+ void *base; -+ -+ /** Register offset for Diagnostic API */ -+ uint32_t reg_offset; -+ -+ /** Base address for MPHI peripheral */ -+ void *mphi_base; -+ -+#ifdef LM_INTERFACE -+ struct lm_device *lmdev; -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *pcidev; -+ -+ /** Start address of a PCI region */ -+ resource_size_t rsrc_start; -+ -+ /** Length address of a PCI region */ -+ resource_size_t rsrc_len; -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *platformdev; -+#endif -+ -+} os_dependent_t; -+ -+#ifdef __cplusplus -+} -+#endif -+ -+ -+ -+/* Type for the our device on the chosen bus */ -+#if defined(LM_INTERFACE) -+typedef struct lm_device dwc_bus_dev_t; -+#elif defined(PCI_INTERFACE) -+typedef struct pci_dev dwc_bus_dev_t; -+#elif defined(PLATFORM_INTERFACE) -+typedef struct platform_device dwc_bus_dev_t; -+#endif -+ -+/* Helper macro to retrieve drvdata from the device on the chosen bus */ -+#if defined(LM_INTERFACE) -+#define DWC_OTG_BUSDRVDATA(_dev) lm_get_drvdata(_dev) -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_BUSDRVDATA(_dev) pci_get_drvdata(_dev) -+#elif defined(PLATFORM_INTERFACE) -+#define DWC_OTG_BUSDRVDATA(_dev) platform_get_drvdata(_dev) -+#endif -+ -+/** -+ * Helper macro returning the otg_device structure of a given struct device -+ * -+ * c.f. static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) -+ */ -+#ifdef LM_INTERFACE -+#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ -+ struct lm_device *lm_dev = \ -+ container_of(_dev, struct lm_device, dev); \ -+ _var = lm_get_drvdata(lm_dev); \ -+ } while (0) -+ -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ -+ _var = dev_get_drvdata(_dev); \ -+ } while (0) -+ -+#elif defined(PLATFORM_INTERFACE) -+#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ -+ struct platform_device *platform_dev = \ -+ container_of(_dev, struct platform_device, dev); \ -+ _var = platform_get_drvdata(platform_dev); \ -+ } while (0) -+#endif -+ -+ -+/** -+ * Helper macro returning the struct dev of the given struct os_dependent -+ * -+ * c.f. static struct device *dwc_otg_getdev(struct os_dependent *osdep) -+ */ -+#ifdef LM_INTERFACE -+#define DWC_OTG_OS_GETDEV(_osdep) \ -+ ((_osdep).lmdev == NULL? NULL: &(_osdep).lmdev->dev) -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_OS_GETDEV(_osdep) \ -+ ((_osdep).pci_dev == NULL? NULL: &(_osdep).pci_dev->dev) -+#elif defined(PLATFORM_INTERFACE) -+#define DWC_OTG_OS_GETDEV(_osdep) \ -+ ((_osdep).platformdev == NULL? NULL: &(_osdep).platformdev->dev) -+#endif -+ -+ -+ -+ -+#endif /* _DWC_OS_DEP_H_ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9dabbe5c9791c5296d1cc7b663afa6ec462173cb ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c -@@ -0,0 +1,2725 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $ -+ * $Revision: #101 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+/** @file -+ * This file implements PCD Core. All code in this file is portable and doesn't -+ * use any OS specific functions. -+ * PCD Core provides Interface, defined in -+ * header file, which can be used to implement OS specific PCD interface. -+ * -+ * An important function of the PCD is managing interrupts generated -+ * by the DWC_otg controller. The implementation of the DWC_otg device -+ * mode interrupt service routines is in dwc_otg_pcd_intr.c. -+ * -+ * @todo Add Device Mode test modes (Test J mode, Test K mode, etc). -+ * @todo Does it work when the request size is greater than DEPTSIZ -+ * transfer size -+ * -+ */ -+ -+#include "dwc_otg_pcd.h" -+ -+#ifdef DWC_UTE_CFI -+#include "dwc_otg_cfi.h" -+ -+extern int init_cfi(cfiobject_t * cfiobj); -+#endif -+ -+/** -+ * Choose endpoint from ep arrays using usb_ep structure. -+ */ -+static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) -+{ -+ int i; -+ if (pcd->ep0.priv == handle) { -+ return &pcd->ep0; -+ } -+ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { -+ if (pcd->in_ep[i].priv == handle) -+ return &pcd->in_ep[i]; -+ if (pcd->out_ep[i].priv == handle) -+ return &pcd->out_ep[i]; -+ } -+ -+ return NULL; -+} -+ -+/** -+ * This function completes a request. It call's the request call back. -+ */ -+void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req, -+ int32_t status) -+{ -+ unsigned stopped = ep->stopped; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(ep %p req %p)\n", __func__, ep, req); -+ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); -+ -+ /* don't modify queue heads during completion callback */ -+ ep->stopped = 1; -+ /* spin_unlock/spin_lock now done in fops->complete() */ -+ ep->pcd->fops->complete(ep->pcd, ep->priv, req->priv, status, -+ req->actual); -+ -+ if (ep->pcd->request_pending > 0) { -+ --ep->pcd->request_pending; -+ } -+ -+ ep->stopped = stopped; -+ DWC_FREE(req); -+} -+ -+/** -+ * This function terminates all the requsts in the EP request queue. -+ */ -+void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_pcd_request_t *req; -+ -+ ep->stopped = 1; -+ -+ /* called with irqs blocked?? */ -+ while (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ dwc_otg_request_done(ep, req, -DWC_E_SHUTDOWN); -+ } -+} -+ -+void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, -+ const struct dwc_otg_pcd_function_ops *fops) -+{ -+ pcd->fops = fops; -+} -+ -+/** -+ * PCD Callback function for initializing the PCD when switching to -+ * device mode. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_start_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ /* -+ * Initialized the Core for Device mode. -+ */ -+ if (dwc_otg_is_device_mode(core_if)) { -+ dwc_otg_core_dev_init(core_if); -+ /* Set core_if's lock pointer to the pcd->lock */ -+ core_if->lock = pcd->lock; -+ } -+ return 1; -+} -+ -+/** CFI-specific buffer allocation function for EP */ -+#ifdef DWC_UTE_CFI -+uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, -+ size_t buflen, int flags) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ ep = get_ep_from_handle(pcd, pep); -+ if (!ep) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ return pcd->cfi->ops.ep_alloc_buf(pcd->cfi, pcd, ep, addr, buflen, -+ flags); -+} -+#else -+uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, -+ size_t buflen, int flags); -+#endif -+ -+/** -+ * PCD Callback function for notifying the PCD when resuming from -+ * suspend. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_resume_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ -+ if (pcd->fops->resume) { -+ pcd->fops->resume(pcd); -+ } -+ -+ /* Stop the SRP timeout timer. */ -+ if ((GET_CORE_IF(pcd)->core_params->phy_type != DWC_PHY_TYPE_PARAM_FS) -+ || (!GET_CORE_IF(pcd)->core_params->i2c_enable)) { -+ if (GET_CORE_IF(pcd)->srp_timer_started) { -+ GET_CORE_IF(pcd)->srp_timer_started = 0; -+ DWC_TIMER_CANCEL(GET_CORE_IF(pcd)->srp_timer); -+ } -+ } -+ return 1; -+} -+ -+/** -+ * PCD Callback function for notifying the PCD device is suspended. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_suspend_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ -+ if (pcd->fops->suspend) { -+ DWC_SPINUNLOCK(pcd->lock); -+ pcd->fops->suspend(pcd); -+ DWC_SPINLOCK(pcd->lock); -+ } -+ -+ return 1; -+} -+ -+/** -+ * PCD Callback function for stopping the PCD when switching to Host -+ * mode. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_stop_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ extern void dwc_otg_pcd_stop(dwc_otg_pcd_t * _pcd); -+ -+ dwc_otg_pcd_stop(pcd); -+ return 1; -+} -+ -+/** -+ * PCD Callback structure for handling mode switching. -+ */ -+static dwc_otg_cil_callbacks_t pcd_callbacks = { -+ .start = dwc_otg_pcd_start_cb, -+ .stop = dwc_otg_pcd_stop_cb, -+ .suspend = dwc_otg_pcd_suspend_cb, -+ .resume_wakeup = dwc_otg_pcd_resume_cb, -+ .p = 0, /* Set at registration */ -+}; -+ -+/** -+ * This function allocates a DMA Descriptor chain for the Endpoint -+ * buffer to be used for a transfer to/from the specified endpoint. -+ */ -+dwc_otg_dev_dma_desc_t *dwc_otg_ep_alloc_desc_chain(struct device *dev, -+ dwc_dma_t * dma_desc_addr, -+ uint32_t count) -+{ -+ return DWC_DMA_ALLOC_ATOMIC(dev, count * sizeof(dwc_otg_dev_dma_desc_t), -+ dma_desc_addr); -+} -+ -+/** -+ * This function frees a DMA Descriptor chain that was allocated by ep_alloc_desc. -+ */ -+void dwc_otg_ep_free_desc_chain(struct device *dev, -+ dwc_otg_dev_dma_desc_t * desc_addr, -+ uint32_t dma_desc_addr, uint32_t count) -+{ -+ DWC_DMA_FREE(dev, count * sizeof(dwc_otg_dev_dma_desc_t), desc_addr, -+ dma_desc_addr); -+} -+ -+#ifdef DWC_EN_ISOC -+ -+/** -+ * This function initializes a descriptor chain for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_iso_ep_start_ddma_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * dwc_ep) -+{ -+ -+ dsts_data_t dsts = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ int i, j; -+ uint32_t len; -+ -+ if (dwc_ep->is_in) -+ dwc_ep->desc_cnt = dwc_ep->buf_proc_intrvl / dwc_ep->bInterval; -+ else -+ dwc_ep->desc_cnt = -+ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / -+ dwc_ep->bInterval; -+ -+ /** Allocate descriptors for double buffering */ -+ dwc_ep->iso_desc_addr = -+ dwc_otg_ep_alloc_desc_chain(&dwc_ep->iso_dma_desc_addr, -+ dwc_ep->desc_cnt * 2); -+ if (dwc_ep->desc_addr) { -+ DWC_WARN("%s, can't allocate DMA descriptor chain\n", __func__); -+ return; -+ } -+ -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ /** ISO OUT EP */ -+ if (dwc_ep->is_in == 0) { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; -+ dma_addr_t dma_ad; -+ uint32_t data_per_desc; -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[dwc_ep->num]; -+ int offset; -+ -+ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; -+ dma_ad = (dma_addr_t) DWC_READ_REG32(&(out_regs->doepdma)); -+ -+ /** Buffer 0 descriptors setup */ -+ dma_ad = dwc_ep->dma_addr0; -+ -+ sts.b_iso_out.bs = BS_HOST_READY; -+ sts.b_iso_out.rxsts = 0; -+ sts.b_iso_out.l = 0; -+ sts.b_iso_out.sp = 0; -+ sts.b_iso_out.ioc = 0; -+ sts.b_iso_out.pid = 0; -+ sts.b_iso_out.framenum = 0; -+ -+ offset = 0; -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ uint32_t len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ } -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ uint32_t len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ -+ sts.b_iso_out.ioc = 1; -+ len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ dma_desc++; -+ -+ /** Buffer 1 descriptors setup */ -+ sts.b_iso_out.ioc = 0; -+ dma_ad = dwc_ep->dma_addr1; -+ -+ offset = 0; -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ uint32_t len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ -+ data_per_desc = -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ } -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ -+ sts.b_iso_out.ioc = 1; -+ sts.b_iso_out.l = 1; -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dwc_ep->next_frame = 0; -+ -+ /** Write dma_ad into DOEPDMA register */ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) dwc_ep->iso_dma_desc_addr); -+ -+ } -+ /** ISO IN EP */ -+ else { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; -+ dma_addr_t dma_ad; -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[dwc_ep->num]; -+ unsigned int frmnumber; -+ fifosize_data_t txfifosize, rxfifosize; -+ -+ txfifosize.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[dwc_ep->num]-> -+ dtxfsts); -+ rxfifosize.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ -+ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ -+ dma_ad = dwc_ep->dma_addr0; -+ -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ sts.b_iso_in.bs = BS_HOST_READY; -+ sts.b_iso_in.txsts = 0; -+ sts.b_iso_in.sp = -+ (dwc_ep->data_per_frame % dwc_ep->maxpacket) ? 1 : 0; -+ sts.b_iso_in.ioc = 0; -+ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; -+ -+ frmnumber = dwc_ep->next_frame; -+ -+ sts.b_iso_in.framenum = frmnumber; -+ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; -+ sts.b_iso_in.l = 0; -+ -+ /** Buffer 0 descriptors setup */ -+ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ dma_desc++; -+ -+ dma_ad += dwc_ep->data_per_frame; -+ sts.b_iso_in.framenum += dwc_ep->bInterval; -+ } -+ -+ sts.b_iso_in.ioc = 1; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ ++dma_desc; -+ -+ /** Buffer 1 descriptors setup */ -+ sts.b_iso_in.ioc = 0; -+ dma_ad = dwc_ep->dma_addr1; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ dma_desc++; -+ -+ dma_ad += dwc_ep->data_per_frame; -+ sts.b_iso_in.framenum += dwc_ep->bInterval; -+ -+ sts.b_iso_in.ioc = 0; -+ } -+ sts.b_iso_in.ioc = 1; -+ sts.b_iso_in.l = 1; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dwc_ep->next_frame = sts.b_iso_in.framenum + dwc_ep->bInterval; -+ -+ /** Write dma_ad into diepdma register */ -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) dwc_ep->iso_dma_desc_addr); -+ } -+ /** Enable endpoint, clear nak */ -+ depctl.d32 = 0; -+ depctl.b.epena = 1; -+ depctl.b.usbactep = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); -+ depctl.d32 = DWC_READ_REG32(addr); -+} -+ -+/** -+ * This function initializes a descriptor chain for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ -+ if (ep->is_in) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ } -+ -+ if (core_if->dma_enable == 0 || core_if->dma_desc_enable != 0) { -+ return; -+ } else { -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ -+ ep->xfer_len = -+ ep->data_per_frame * ep->buf_proc_intrvl / ep->bInterval; -+ ep->pkt_cnt = -+ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; -+ ep->xfer_count = 0; -+ ep->xfer_buff = -+ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; -+ ep->dma_addr = -+ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; -+ -+ if (ep->is_in) { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.mc = ep->pkt_per_frm; -+ deptsiz.b.xfersize = ep->xfer_len; -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ dieptsiz, deptsiz.d32); -+ -+ /* Write the DMA register */ -+ DWC_WRITE_REG32(& -+ (core_if->dev_if->in_ep_regs[ep->num]-> -+ diepdma), (uint32_t) ep->dma_addr); -+ -+ } else { -+ deptsiz.b.pktcnt = -+ (ep->xfer_len + (ep->maxpacket - 1)) / -+ ep->maxpacket; -+ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; -+ -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> -+ doeptsiz, deptsiz.d32); -+ -+ /* Write the DMA register */ -+ DWC_WRITE_REG32(& -+ (core_if->dev_if->out_ep_regs[ep->num]-> -+ doepdma), (uint32_t) ep->dma_addr); -+ -+ } -+ /** Enable endpoint, clear nak */ -+ depctl.d32 = 0; -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); -+ } -+} -+ -+/** -+ * This function does the setup for a data transfer for an EP and -+ * starts the transfer. For an IN transfer, the packets will be -+ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, -+ * the packets are unloaded from the Rx FIFO in the ISR. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+ -+static void dwc_otg_iso_ep_start_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ if (ep->is_in) { -+ ep->desc_cnt = ep->pkt_cnt / ep->pkt_per_frm; -+ } else { -+ ep->desc_cnt = ep->pkt_cnt; -+ } -+ dwc_otg_iso_ep_start_ddma_transfer(core_if, ep); -+ } else { -+ if (core_if->pti_enh_enable) { -+ dwc_otg_iso_ep_start_buf_transfer(core_if, ep); -+ } else { -+ ep->cur_pkt_addr = -+ (ep->proc_buf_num) ? ep->xfer_buff1 : ep-> -+ xfer_buff0; -+ ep->cur_pkt_dma_addr = -+ (ep->proc_buf_num) ? ep->dma_addr1 : ep-> -+ dma_addr0; -+ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); -+ } -+ } -+ } else { -+ ep->cur_pkt_addr = -+ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; -+ ep->cur_pkt_dma_addr = -+ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; -+ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); -+ } -+} -+ -+/** -+ * This function stops transfer for an EP and -+ * resets the ep's variables. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+ -+void dwc_otg_iso_ep_stop_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ -+ if (ep->is_in == 1) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ } -+ -+ /* disable the ep */ -+ depctl.d32 = DWC_READ_REG32(addr); -+ -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ -+ DWC_WRITE_REG32(addr, depctl.d32); -+ -+ if (core_if->dma_desc_enable && -+ ep->iso_desc_addr && ep->iso_dma_desc_addr) { -+ dwc_otg_ep_free_desc_chain(ep->iso_desc_addr, -+ ep->iso_dma_desc_addr, -+ ep->desc_cnt * 2); -+ } -+ -+ /* reset varibales */ -+ ep->dma_addr0 = 0; -+ ep->dma_addr1 = 0; -+ ep->xfer_buff0 = 0; -+ ep->xfer_buff1 = 0; -+ ep->data_per_frame = 0; -+ ep->data_pattern_frame = 0; -+ ep->sync_frame = 0; -+ ep->buf_proc_intrvl = 0; -+ ep->bInterval = 0; -+ ep->proc_buf_num = 0; -+ ep->pkt_per_frm = 0; -+ ep->pkt_per_frm = 0; -+ ep->desc_cnt = 0; -+ ep->iso_desc_addr = 0; -+ ep->iso_dma_desc_addr = 0; -+} -+ -+int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf0, uint8_t * buf1, dwc_dma_t dma0, -+ dwc_dma_t dma1, int sync_frame, int dp_frame, -+ int data_per_frame, int start_frame, -+ int buf_proc_intrvl, void *req_handle, -+ int atomic_alloc) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags = 0; -+ dwc_ep_t *dwc_ep; -+ int32_t frm_data; -+ dsts_data_t dsts; -+ dwc_otg_core_if_t *core_if; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ core_if = GET_CORE_IF(pcd); -+ dwc_ep = &ep->dwc_ep; -+ -+ if (ep->iso_req_handle) { -+ DWC_WARN("ISO request in progress\n"); -+ } -+ -+ dwc_ep->dma_addr0 = dma0; -+ dwc_ep->dma_addr1 = dma1; -+ -+ dwc_ep->xfer_buff0 = buf0; -+ dwc_ep->xfer_buff1 = buf1; -+ -+ dwc_ep->data_per_frame = data_per_frame; -+ -+ /** @todo - pattern data support is to be implemented in the future */ -+ dwc_ep->data_pattern_frame = dp_frame; -+ dwc_ep->sync_frame = sync_frame; -+ -+ dwc_ep->buf_proc_intrvl = buf_proc_intrvl; -+ -+ dwc_ep->bInterval = 1 << (ep->desc->bInterval - 1); -+ -+ dwc_ep->proc_buf_num = 0; -+ -+ dwc_ep->pkt_per_frm = 0; -+ frm_data = ep->dwc_ep.data_per_frame; -+ while (frm_data > 0) { -+ dwc_ep->pkt_per_frm++; -+ frm_data -= ep->dwc_ep.maxpacket; -+ } -+ -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ if (start_frame == -1) { -+ dwc_ep->next_frame = dsts.b.soffn + 1; -+ if (dwc_ep->bInterval != 1) { -+ dwc_ep->next_frame = -+ dwc_ep->next_frame + (dwc_ep->bInterval - 1 - -+ dwc_ep->next_frame % -+ dwc_ep->bInterval); -+ } -+ } else { -+ dwc_ep->next_frame = start_frame; -+ } -+ -+ if (!core_if->pti_enh_enable) { -+ dwc_ep->pkt_cnt = -+ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / -+ dwc_ep->bInterval; -+ } else { -+ dwc_ep->pkt_cnt = -+ (dwc_ep->data_per_frame * -+ (dwc_ep->buf_proc_intrvl / dwc_ep->bInterval) -+ - 1 + dwc_ep->maxpacket) / dwc_ep->maxpacket; -+ } -+ -+ if (core_if->dma_desc_enable) { -+ dwc_ep->desc_cnt = -+ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / -+ dwc_ep->bInterval; -+ } -+ -+ if (atomic_alloc) { -+ dwc_ep->pkt_info = -+ DWC_ALLOC_ATOMIC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); -+ } else { -+ dwc_ep->pkt_info = -+ DWC_ALLOC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); -+ } -+ if (!dwc_ep->pkt_info) { -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_NO_MEMORY; -+ } -+ if (core_if->pti_enh_enable) { -+ dwc_memset(dwc_ep->pkt_info, 0, -+ sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); -+ } -+ -+ dwc_ep->cur_pkt = 0; -+ ep->iso_req_handle = req_handle; -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ dwc_otg_iso_ep_start_transfer(core_if, dwc_ep); -+ return 0; -+} -+ -+int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle) -+{ -+ dwc_irqflags_t flags = 0; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ dwc_ep = &ep->dwc_ep; -+ -+ dwc_otg_iso_ep_stop_transfer(GET_CORE_IF(pcd), dwc_ep); -+ -+ DWC_FREE(dwc_ep->pkt_info); -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ if (ep->iso_req_handle != req_handle) { -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ ep->iso_req_handle = 0; -+ return 0; -+} -+ -+/** -+ * This function is used for perodical data exchnage between PCD and gadget drivers. -+ * for Isochronous EPs -+ * -+ * - Every time a sync period completes this function is called to -+ * perform data exchange between PCD and gadget -+ */ -+void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, -+ void *req_handle) -+{ -+ int i; -+ dwc_ep_t *dwc_ep; -+ -+ dwc_ep = &ep->dwc_ep; -+ -+ DWC_SPINUNLOCK(ep->pcd->lock); -+ pcd->fops->isoc_complete(pcd, ep->priv, ep->iso_req_handle, -+ dwc_ep->proc_buf_num ^ 0x1); -+ DWC_SPINLOCK(ep->pcd->lock); -+ -+ for (i = 0; i < dwc_ep->pkt_cnt; ++i) { -+ dwc_ep->pkt_info[i].status = 0; -+ dwc_ep->pkt_info[i].offset = 0; -+ dwc_ep->pkt_info[i].length = 0; -+ } -+} -+ -+int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *iso_req_handle) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep->desc || ep->dwc_ep.num == 0) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ dwc_ep = &ep->dwc_ep; -+ -+ return dwc_ep->pkt_cnt; -+} -+ -+void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *iso_req_handle, int packet, -+ int *status, int *actual, int *offset) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep) -+ DWC_WARN("bad ep\n"); -+ -+ dwc_ep = &ep->dwc_ep; -+ -+ *status = dwc_ep->pkt_info[packet].status; -+ *actual = dwc_ep->pkt_info[packet].length; -+ *offset = dwc_ep->pkt_info[packet].offset; -+} -+ -+#endif /* DWC_EN_ISOC */ -+ -+static void dwc_otg_pcd_init_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * pcd_ep, -+ uint32_t is_in, uint32_t ep_num) -+{ -+ /* Init EP structure */ -+ pcd_ep->desc = 0; -+ pcd_ep->pcd = pcd; -+ pcd_ep->stopped = 1; -+ pcd_ep->queue_sof = 0; -+ -+ /* Init DWC ep structure */ -+ pcd_ep->dwc_ep.is_in = is_in; -+ pcd_ep->dwc_ep.num = ep_num; -+ pcd_ep->dwc_ep.active = 0; -+ pcd_ep->dwc_ep.tx_fifo_num = 0; -+ /* Control until ep is actvated */ -+ pcd_ep->dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; -+ pcd_ep->dwc_ep.maxpacket = MAX_PACKET_SIZE; -+ pcd_ep->dwc_ep.dma_addr = 0; -+ pcd_ep->dwc_ep.start_xfer_buff = 0; -+ pcd_ep->dwc_ep.xfer_buff = 0; -+ pcd_ep->dwc_ep.xfer_len = 0; -+ pcd_ep->dwc_ep.xfer_count = 0; -+ pcd_ep->dwc_ep.sent_zlp = 0; -+ pcd_ep->dwc_ep.total_len = 0; -+ pcd_ep->dwc_ep.desc_addr = 0; -+ pcd_ep->dwc_ep.dma_desc_addr = 0; -+ DWC_CIRCLEQ_INIT(&pcd_ep->queue); -+} -+ -+/** -+ * Initialize ep's -+ */ -+static void dwc_otg_pcd_reinit(dwc_otg_pcd_t * pcd) -+{ -+ int i; -+ uint32_t hwcfg1; -+ dwc_otg_pcd_ep_t *ep; -+ int in_ep_cntr, out_ep_cntr; -+ uint32_t num_in_eps = (GET_CORE_IF(pcd))->dev_if->num_in_eps; -+ uint32_t num_out_eps = (GET_CORE_IF(pcd))->dev_if->num_out_eps; -+ -+ /** -+ * Initialize the EP0 structure. -+ */ -+ ep = &pcd->ep0; -+ dwc_otg_pcd_init_ep(pcd, ep, 0, 0); -+ -+ in_ep_cntr = 0; -+ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 3; -+ for (i = 1; in_ep_cntr < num_in_eps; i++) { -+ if ((hwcfg1 & 0x1) == 0) { -+ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[in_ep_cntr]; -+ in_ep_cntr++; -+ /** -+ * @todo NGS: Add direction to EP, based on contents -+ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? -+ * sprintf(";r -+ */ -+ dwc_otg_pcd_init_ep(pcd, ep, 1 /* IN */ , i); -+ -+ DWC_CIRCLEQ_INIT(&ep->queue); -+ } -+ hwcfg1 >>= 2; -+ } -+ -+ out_ep_cntr = 0; -+ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 2; -+ for (i = 1; out_ep_cntr < num_out_eps; i++) { -+ if ((hwcfg1 & 0x1) == 0) { -+ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[out_ep_cntr]; -+ out_ep_cntr++; -+ /** -+ * @todo NGS: Add direction to EP, based on contents -+ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? -+ * sprintf(";r -+ */ -+ dwc_otg_pcd_init_ep(pcd, ep, 0 /* OUT */ , i); -+ DWC_CIRCLEQ_INIT(&ep->queue); -+ } -+ hwcfg1 >>= 2; -+ } -+ -+ pcd->ep0state = EP0_DISCONNECT; -+ pcd->ep0.dwc_ep.maxpacket = MAX_EP0_SIZE; -+ pcd->ep0.dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; -+} -+ -+/** -+ * This function is called when the SRP timer expires. The SRP should -+ * complete within 6 seconds. -+ */ -+static void srp_timeout(void *ptr) -+{ -+ gotgctl_data_t gotgctl; -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ volatile uint32_t *addr = &core_if->core_global_regs->gotgctl; -+ -+ gotgctl.d32 = DWC_READ_REG32(addr); -+ -+ core_if->srp_timer_started = 0; -+ -+ if (core_if->adp_enable) { -+ if (gotgctl.b.bsesvld == 0) { -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ DWC_PRINTF("SRP Timeout BSESSVLD = 0\n"); -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ } -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ dwc_otg_adp_probe_start(core_if); -+ } else { -+ DWC_PRINTF("SRP Timeout BSESSVLD = 1\n"); -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } -+ } -+ -+ if ((core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS) && -+ (core_if->core_params->i2c_enable)) { -+ DWC_PRINTF("SRP Timeout\n"); -+ -+ if ((core_if->srp_success) && (gotgctl.b.bsesvld)) { -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+ -+ /* Clear Session Request */ -+ gotgctl.d32 = 0; -+ gotgctl.b.sesreq = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, -+ gotgctl.d32, 0); -+ -+ core_if->srp_success = 0; -+ } else { -+ __DWC_ERROR("Device not connected/responding\n"); -+ gotgctl.b.sesreq = 0; -+ DWC_WRITE_REG32(addr, gotgctl.d32); -+ } -+ } else if (gotgctl.b.sesreq) { -+ DWC_PRINTF("SRP Timeout\n"); -+ -+ __DWC_ERROR("Device not connected/responding\n"); -+ gotgctl.b.sesreq = 0; -+ DWC_WRITE_REG32(addr, gotgctl.d32); -+ } else { -+ DWC_PRINTF(" SRP GOTGCTL=%0x\n", gotgctl.d32); -+ } -+} -+ -+/** -+ * Tasklet -+ * -+ */ -+extern void start_next_request(dwc_otg_pcd_ep_t * ep); -+ -+static void start_xfer_tasklet_func(void *data) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ int i; -+ depctl_data_t diepctl; -+ -+ DWC_DEBUGPL(DBG_PCDV, "Start xfer tasklet\n"); -+ -+ diepctl.d32 = DWC_READ_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl); -+ -+ if (pcd->ep0.queue_sof) { -+ pcd->ep0.queue_sof = 0; -+ start_next_request(&pcd->ep0); -+ // break; -+ } -+ -+ for (i = 0; i < core_if->dev_if->num_in_eps; i++) { -+ depctl_data_t diepctl; -+ diepctl.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); -+ -+ if (pcd->in_ep[i].queue_sof) { -+ pcd->in_ep[i].queue_sof = 0; -+ start_next_request(&pcd->in_ep[i]); -+ // break; -+ } -+ } -+ -+ return; -+} -+ -+/** -+ * This function initialized the PCD portion of the driver. -+ * -+ */ -+dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_device_t *otg_dev) -+{ -+ struct device *dev = &otg_dev->os_dep.platformdev->dev; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ dwc_otg_pcd_t *pcd = NULL; -+ dwc_otg_dev_if_t *dev_if; -+ int i; -+ -+ /* -+ * Allocate PCD structure -+ */ -+ pcd = DWC_ALLOC(sizeof(dwc_otg_pcd_t)); -+ -+ if (pcd == NULL) { -+ return NULL; -+ } -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(pcd->lock); -+#else -+ pcd->lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ DWC_DEBUGPL(DBG_HCDV, "Init of PCD %p given core_if %p\n", -+ pcd, core_if);//GRAYG -+ if (!pcd->lock) { -+ DWC_ERROR("Could not allocate lock for pcd"); -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ /* Set core_if's lock pointer to hcd->lock */ -+ core_if->lock = pcd->lock; -+ pcd->core_if = core_if; -+ -+ dev_if = core_if->dev_if; -+ dev_if->isoc_ep = NULL; -+ -+ if (core_if->hwcfg4.b.ded_fifo_en) { -+ DWC_PRINTF("Dedicated Tx FIFOs mode\n"); -+ } else { -+ DWC_PRINTF("Shared Tx FIFO mode\n"); -+ } -+ -+ /* -+ * Initialized the Core for Device mode here if there is nod ADP support. -+ * Otherwise it will be done later in dwc_otg_adp_start routine. -+ */ -+ if (dwc_otg_is_device_mode(core_if) /*&& !core_if->adp_enable*/) { -+ dwc_otg_core_dev_init(core_if); -+ } -+ -+ /* -+ * Register the PCD Callbacks. -+ */ -+ dwc_otg_cil_register_pcd_callbacks(core_if, &pcd_callbacks, pcd); -+ -+ /* -+ * Initialize the DMA buffer for SETUP packets -+ */ -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ pcd->setup_pkt = -+ DWC_DMA_ALLOC(dev, sizeof(*pcd->setup_pkt) * 5, -+ &pcd->setup_pkt_dma_handle); -+ if (pcd->setup_pkt == NULL) { -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ -+ pcd->status_buf = -+ DWC_DMA_ALLOC(dev, sizeof(uint16_t), -+ &pcd->status_buf_dma_handle); -+ if (pcd->status_buf == NULL) { -+ DWC_DMA_FREE(dev, sizeof(*pcd->setup_pkt) * 5, -+ pcd->setup_pkt, pcd->setup_pkt_dma_handle); -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ dev_if->setup_desc_addr[0] = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_setup_desc_addr[0], 1); -+ dev_if->setup_desc_addr[1] = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_setup_desc_addr[1], 1); -+ dev_if->in_desc_addr = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_in_desc_addr, 1); -+ dev_if->out_desc_addr = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_out_desc_addr, 1); -+ pcd->data_terminated = 0; -+ -+ if (dev_if->setup_desc_addr[0] == 0 -+ || dev_if->setup_desc_addr[1] == 0 -+ || dev_if->in_desc_addr == 0 -+ || dev_if->out_desc_addr == 0) { -+ -+ if (dev_if->out_desc_addr) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->out_desc_addr, -+ dev_if->dma_out_desc_addr, 1); -+ if (dev_if->in_desc_addr) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->in_desc_addr, -+ dev_if->dma_in_desc_addr, 1); -+ if (dev_if->setup_desc_addr[1]) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[1], -+ dev_if->dma_setup_desc_addr[1], 1); -+ if (dev_if->setup_desc_addr[0]) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[0], -+ dev_if->dma_setup_desc_addr[0], 1); -+ -+ DWC_DMA_FREE(dev, sizeof(*pcd->setup_pkt) * 5, -+ pcd->setup_pkt, -+ pcd->setup_pkt_dma_handle); -+ DWC_DMA_FREE(dev, sizeof(*pcd->status_buf), -+ pcd->status_buf, -+ pcd->status_buf_dma_handle); -+ -+ DWC_FREE(pcd); -+ -+ return NULL; -+ } -+ } -+ } else { -+ pcd->setup_pkt = DWC_ALLOC(sizeof(*pcd->setup_pkt) * 5); -+ if (pcd->setup_pkt == NULL) { -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ -+ pcd->status_buf = DWC_ALLOC(sizeof(uint16_t)); -+ if (pcd->status_buf == NULL) { -+ DWC_FREE(pcd->setup_pkt); -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ } -+ -+ dwc_otg_pcd_reinit(pcd); -+ -+ /* Allocate the cfi object for the PCD */ -+#ifdef DWC_UTE_CFI -+ pcd->cfi = DWC_ALLOC(sizeof(cfiobject_t)); -+ if (NULL == pcd->cfi) -+ goto fail; -+ if (init_cfi(pcd->cfi)) { -+ CFI_INFO("%s: Failed to init the CFI object\n", __func__); -+ goto fail; -+ } -+#endif -+ -+ /* Initialize tasklets */ -+ pcd->start_xfer_tasklet = DWC_TASK_ALLOC("xfer_tasklet", -+ start_xfer_tasklet_func, pcd); -+ pcd->test_mode_tasklet = DWC_TASK_ALLOC("test_mode_tasklet", -+ do_test_mode, pcd); -+ -+ /* Initialize SRP timer */ -+ core_if->srp_timer = DWC_TIMER_ALLOC("SRP TIMER", srp_timeout, core_if); -+ -+ if (core_if->core_params->dev_out_nak) { -+ /** -+ * Initialize xfer timeout timer. Implemented for -+ * 2.93a feature "Device DDMA OUT NAK Enhancement" -+ */ -+ for(i = 0; i < MAX_EPS_CHANNELS; i++) { -+ pcd->core_if->ep_xfer_timer[i] = -+ DWC_TIMER_ALLOC("ep timer", ep_xfer_timeout, -+ &pcd->core_if->ep_xfer_info[i]); -+ } -+ } -+ -+ return pcd; -+#ifdef DWC_UTE_CFI -+fail: -+#endif -+ if (pcd->setup_pkt) -+ DWC_FREE(pcd->setup_pkt); -+ if (pcd->status_buf) -+ DWC_FREE(pcd->status_buf); -+#ifdef DWC_UTE_CFI -+ if (pcd->cfi) -+ DWC_FREE(pcd->cfi); -+#endif -+ if (pcd) -+ DWC_FREE(pcd); -+ return NULL; -+ -+} -+ -+/** -+ * Remove PCD specific data -+ */ -+void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ int i; -+ -+ if (pcd->core_if->core_params->dev_out_nak) { -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[i]); -+ pcd->core_if->ep_xfer_info[i].state = 0; -+ } -+ } -+ -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ DWC_DMA_FREE(dev, sizeof(*pcd->setup_pkt) * 5, pcd->setup_pkt, -+ pcd->setup_pkt_dma_handle); -+ DWC_DMA_FREE(dev, sizeof(uint16_t), pcd->status_buf, -+ pcd->status_buf_dma_handle); -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[0], -+ dev_if->dma_setup_desc_addr -+ [0], 1); -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[1], -+ dev_if->dma_setup_desc_addr -+ [1], 1); -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->in_desc_addr, -+ dev_if->dma_in_desc_addr, 1); -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->out_desc_addr, -+ dev_if->dma_out_desc_addr, -+ 1); -+ } -+ } else { -+ DWC_FREE(pcd->setup_pkt); -+ DWC_FREE(pcd->status_buf); -+ } -+ DWC_SPINLOCK_FREE(pcd->lock); -+ /* Set core_if's lock pointer to NULL */ -+ pcd->core_if->lock = NULL; -+ -+ DWC_TASK_FREE(pcd->start_xfer_tasklet); -+ DWC_TASK_FREE(pcd->test_mode_tasklet); -+ if (pcd->core_if->core_params->dev_out_nak) { -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ if (pcd->core_if->ep_xfer_timer[i]) { -+ DWC_TIMER_FREE(pcd->core_if->ep_xfer_timer[i]); -+ } -+ } -+ } -+ -+/* Release the CFI object's dynamic memory */ -+#ifdef DWC_UTE_CFI -+ if (pcd->cfi->ops.release) { -+ pcd->cfi->ops.release(pcd->cfi); -+ } -+#endif -+ -+ DWC_FREE(pcd); -+} -+ -+/** -+ * Returns whether registered pcd is dual speed or not -+ */ -+uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) || -+ ((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls))) { -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/** -+ * Returns whether registered pcd is OTG capable or not -+ */ -+uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ gusbcfg_data_t usbcfg = {.d32 = 0 }; -+ -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ if (!usbcfg.b.srpcap || !usbcfg.b.hnpcap) { -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/** -+ * This function assigns periodic Tx FIFO to an periodic EP -+ * in shared Tx FIFO mode -+ */ -+static uint32_t assign_tx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t TxMsk = 1; -+ int i; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; ++i) { -+ if ((TxMsk & core_if->tx_msk) == 0) { -+ core_if->tx_msk |= TxMsk; -+ return i + 1; -+ } -+ TxMsk <<= 1; -+ } -+ return 0; -+} -+ -+/** -+ * This function assigns periodic Tx FIFO to an periodic EP -+ * in shared Tx FIFO mode -+ */ -+static uint32_t assign_perio_tx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t PerTxMsk = 1; -+ int i; -+ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; ++i) { -+ if ((PerTxMsk & core_if->p_tx_msk) == 0) { -+ core_if->p_tx_msk |= PerTxMsk; -+ return i + 1; -+ } -+ PerTxMsk <<= 1; -+ } -+ return 0; -+} -+ -+/** -+ * This function releases periodic Tx FIFO -+ * in shared Tx FIFO mode -+ */ -+static void release_perio_tx_fifo(dwc_otg_core_if_t * core_if, -+ uint32_t fifo_num) -+{ -+ core_if->p_tx_msk = -+ (core_if->p_tx_msk & (1 << (fifo_num - 1))) ^ core_if->p_tx_msk; -+} -+ -+/** -+ * This function releases periodic Tx FIFO -+ * in shared Tx FIFO mode -+ */ -+static void release_tx_fifo(dwc_otg_core_if_t * core_if, uint32_t fifo_num) -+{ -+ core_if->tx_msk = -+ (core_if->tx_msk & (1 << (fifo_num - 1))) ^ core_if->tx_msk; -+} -+ -+/** -+ * This function is being called from gadget -+ * to enable PCD endpoint. -+ */ -+int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, -+ const uint8_t * ep_desc, void *usb_ep) -+{ -+ int num, dir; -+ dwc_otg_pcd_ep_t *ep = NULL; -+ const usb_endpoint_descriptor_t *desc; -+ dwc_irqflags_t flags; -+ fifosize_data_t dptxfsiz = {.d32 = 0 }; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; -+ int retval = 0; -+ int i, epcount; -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ -+ desc = (const usb_endpoint_descriptor_t *)ep_desc; -+ -+ if (!desc) { -+ pcd->ep0.priv = usb_ep; -+ ep = &pcd->ep0; -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ num = UE_GET_ADDR(desc->bEndpointAddress); -+ dir = UE_GET_DIR(desc->bEndpointAddress); -+ -+ if (!desc->wMaxPacketSize) { -+ DWC_WARN("bad maxpacketsize\n"); -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ if (dir == UE_DIR_IN) { -+ epcount = pcd->core_if->dev_if->num_in_eps; -+ for (i = 0; i < epcount; i++) { -+ if (num == pcd->in_ep[i].dwc_ep.num) { -+ ep = &pcd->in_ep[i]; -+ break; -+ } -+ } -+ } else { -+ epcount = pcd->core_if->dev_if->num_out_eps; -+ for (i = 0; i < epcount; i++) { -+ if (num == pcd->out_ep[i].dwc_ep.num) { -+ ep = &pcd->out_ep[i]; -+ break; -+ } -+ } -+ } -+ -+ if (!ep) { -+ DWC_WARN("bad address\n"); -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ ep->desc = desc; -+ ep->priv = usb_ep; -+ -+ /* -+ * Activate the EP -+ */ -+ ep->stopped = 0; -+ -+ ep->dwc_ep.is_in = (dir == UE_DIR_IN); -+ ep->dwc_ep.maxpacket = UGETW(desc->wMaxPacketSize); -+ -+ ep->dwc_ep.type = desc->bmAttributes & UE_XFERTYPE; -+ -+ if (ep->dwc_ep.is_in) { -+ if (!GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ ep->dwc_ep.tx_fifo_num = 0; -+ -+ if (ep->dwc_ep.type == UE_ISOCHRONOUS) { -+ /* -+ * if ISOC EP then assign a Periodic Tx FIFO. -+ */ -+ ep->dwc_ep.tx_fifo_num = -+ assign_perio_tx_fifo(GET_CORE_IF(pcd)); -+ } -+ } else { -+ /* -+ * if Dedicated FIFOs mode is on then assign a Tx FIFO. -+ */ -+ ep->dwc_ep.tx_fifo_num = -+ assign_tx_fifo(GET_CORE_IF(pcd)); -+ } -+ -+ /* Calculating EP info controller base address */ -+ if (ep->dwc_ep.tx_fifo_num -+ && GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ gdfifocfg.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)-> -+ core_global_regs->gdfifocfg); -+ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; -+ dptxfsiz.d32 = -+ (DWC_READ_REG32 -+ (&GET_CORE_IF(pcd)->core_global_regs-> -+ dtxfsiz[ep->dwc_ep.tx_fifo_num - 1]) >> 16); -+ gdfifocfg.b.epinfobase = -+ gdfifocfgbase.d32 + dptxfsiz.d32; -+ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> -+ core_global_regs->gdfifocfg, -+ gdfifocfg.d32); -+ } -+ } -+ } -+ /* Set initial data PID. */ -+ if (ep->dwc_ep.type == UE_BULK) { -+ ep->dwc_ep.data_pid_start = 0; -+ } -+ -+ /* Alloc DMA Descriptors */ -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+#ifndef DWC_UTE_PER_IO -+ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { -+#endif -+ ep->dwc_ep.desc_addr = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &ep->dwc_ep.dma_desc_addr, -+ MAX_DMA_DESC_CNT); -+ if (!ep->dwc_ep.desc_addr) { -+ DWC_WARN("%s, can't allocate DMA descriptor\n", -+ __func__); -+ retval = -DWC_E_SHUTDOWN; -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ goto out; -+ } -+#ifndef DWC_UTE_PER_IO -+ } -+#endif -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "Activate %s: type=%d, mps=%d desc=%p\n", -+ (ep->dwc_ep.is_in ? "IN" : "OUT"), -+ ep->dwc_ep.type, ep->dwc_ep.maxpacket, ep->desc); -+#ifdef DWC_UTE_PER_IO -+ ep->dwc_ep.xiso_bInterval = 1 << (ep->desc->bInterval - 1); -+#endif -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ ep->dwc_ep.bInterval = 1 << (ep->desc->bInterval - 1); -+ ep->dwc_ep.frame_num = 0xFFFFFFFF; -+ } -+ -+ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); -+ -+#ifdef DWC_UTE_CFI -+ if (pcd->cfi->ops.ep_enable) { -+ pcd->cfi->ops.ep_enable(pcd->cfi, pcd, ep); -+ } -+#endif -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+out: -+ return retval; -+} -+ -+/** -+ * This function is being called from gadget -+ * to disable PCD endpoint. -+ */ -+int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ dwc_otg_dev_dma_desc_t *desc_addr; -+ dwc_dma_t dma_desc_addr; -+ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ fifosize_data_t dptxfsiz = {.d32 = 0 }; -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if (!ep || !ep->desc) { -+ DWC_DEBUGPL(DBG_PCD, "bad ep address\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ dwc_otg_request_nuke(ep); -+ -+ dwc_otg_ep_deactivate(GET_CORE_IF(pcd), &ep->dwc_ep); -+ if (pcd->core_if->core_params->dev_out_nak) { -+ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[ep->dwc_ep.num]); -+ pcd->core_if->ep_xfer_info[ep->dwc_ep.num].state = 0; -+ } -+ ep->desc = NULL; -+ ep->stopped = 1; -+ -+ gdfifocfg.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg); -+ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; -+ -+ if (ep->dwc_ep.is_in) { -+ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ /* Flush the Tx FIFO */ -+ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), -+ ep->dwc_ep.tx_fifo_num); -+ } -+ release_perio_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); -+ release_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); -+ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ /* Decreasing EPinfo Base Addr */ -+ dptxfsiz.d32 = -+ (DWC_READ_REG32 -+ (&GET_CORE_IF(pcd)-> -+ core_global_regs->dtxfsiz[ep->dwc_ep.tx_fifo_num-1]) >> 16); -+ gdfifocfg.b.epinfobase = gdfifocfgbase.d32 - dptxfsiz.d32; -+ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg, -+ gdfifocfg.d32); -+ } -+ } -+ } -+ -+ /* Free DMA Descriptors */ -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { -+ desc_addr = ep->dwc_ep.desc_addr; -+ dma_desc_addr = ep->dwc_ep.dma_desc_addr; -+ -+ /* Cannot call dma_free_coherent() with IRQs disabled */ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ dwc_otg_ep_free_desc_chain(dev, desc_addr, dma_desc_addr, -+ MAX_DMA_DESC_CNT); -+ -+ goto out_unlocked; -+ } -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+out_unlocked: -+ DWC_DEBUGPL(DBG_PCD, "%d %s disabled\n", ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT"); -+ return 0; -+ -+} -+ -+/******************************************************************************/ -+#ifdef DWC_UTE_PER_IO -+ -+/** -+ * Free the request and its extended parts -+ * -+ */ -+void dwc_pcd_xiso_ereq_free(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req) -+{ -+ DWC_FREE(req->ext_req.per_io_frame_descs); -+ DWC_FREE(req); -+} -+ -+/** -+ * Start the next request in the endpoint's queue. -+ * -+ */ -+int dwc_otg_pcd_xiso_start_next_request(dwc_otg_pcd_t * pcd, -+ dwc_otg_pcd_ep_t * ep) -+{ -+ int i; -+ dwc_otg_pcd_request_t *req = NULL; -+ dwc_ep_t *dwcep = NULL; -+ struct dwc_iso_xreq_port *ereq = NULL; -+ struct dwc_iso_pkt_desc_port *ddesc_iso; -+ uint16_t nat; -+ depctl_data_t diepctl; -+ -+ dwcep = &ep->dwc_ep; -+ -+ if (dwcep->xiso_active_xfers > 0) { -+#if 0 //Disable this to decrease s/w overhead that is crucial for Isoc transfers -+ DWC_WARN("There are currently active transfers for EP%d \ -+ (active=%d; queued=%d)", dwcep->num, dwcep->xiso_active_xfers, -+ dwcep->xiso_queued_xfers); -+#endif -+ return 0; -+ } -+ -+ nat = UGETW(ep->desc->wMaxPacketSize); -+ nat = (nat >> 11) & 0x03; -+ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ ereq = &req->ext_req; -+ ep->stopped = 0; -+ -+ /* Get the frame number */ -+ dwcep->xiso_frame_num = -+ dwc_otg_get_frame_number(GET_CORE_IF(pcd)); -+ DWC_DEBUG("FRM_NUM=%d", dwcep->xiso_frame_num); -+ -+ ddesc_iso = ereq->per_io_frame_descs; -+ -+ if (dwcep->is_in) { -+ /* Setup DMA Descriptor chain for IN Isoc request */ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ //if ((i % (nat + 1)) == 0) -+ if ( i > 0 ) -+ dwcep->xiso_frame_num = -+ (dwcep->xiso_bInterval + -+ dwcep->xiso_frame_num) & 0x3FFF; -+ dwcep->desc_addr[i].buf = -+ req->dma + ddesc_iso[i].offset; -+ dwcep->desc_addr[i].status.b_iso_in.txbytes = -+ ddesc_iso[i].length; -+ dwcep->desc_addr[i].status.b_iso_in.framenum = -+ dwcep->xiso_frame_num; -+ dwcep->desc_addr[i].status.b_iso_in.bs = -+ BS_HOST_READY; -+ dwcep->desc_addr[i].status.b_iso_in.txsts = 0; -+ dwcep->desc_addr[i].status.b_iso_in.sp = -+ (ddesc_iso[i].length % -+ dwcep->maxpacket) ? 1 : 0; -+ dwcep->desc_addr[i].status.b_iso_in.ioc = 0; -+ dwcep->desc_addr[i].status.b_iso_in.pid = nat + 1; -+ dwcep->desc_addr[i].status.b_iso_in.l = 0; -+ -+ /* Process the last descriptor */ -+ if (i == ereq->pio_pkt_count - 1) { -+ dwcep->desc_addr[i].status.b_iso_in.ioc = 1; -+ dwcep->desc_addr[i].status.b_iso_in.l = 1; -+ } -+ } -+ -+ /* Setup and start the transfer for this endpoint */ -+ dwcep->xiso_active_xfers++; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ in_ep_regs[dwcep->num]->diepdma, -+ dwcep->dma_desc_addr); -+ diepctl.d32 = 0; -+ diepctl.b.epena = 1; -+ diepctl.b.cnak = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ in_ep_regs[dwcep->num]->diepctl, 0, -+ diepctl.d32); -+ } else { -+ /* Setup DMA Descriptor chain for OUT Isoc request */ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ //if ((i % (nat + 1)) == 0) -+ dwcep->xiso_frame_num = (dwcep->xiso_bInterval + -+ dwcep->xiso_frame_num) & 0x3FFF; -+ dwcep->desc_addr[i].buf = -+ req->dma + ddesc_iso[i].offset; -+ dwcep->desc_addr[i].status.b_iso_out.rxbytes = -+ ddesc_iso[i].length; -+ dwcep->desc_addr[i].status.b_iso_out.framenum = -+ dwcep->xiso_frame_num; -+ dwcep->desc_addr[i].status.b_iso_out.bs = -+ BS_HOST_READY; -+ dwcep->desc_addr[i].status.b_iso_out.rxsts = 0; -+ dwcep->desc_addr[i].status.b_iso_out.sp = -+ (ddesc_iso[i].length % -+ dwcep->maxpacket) ? 1 : 0; -+ dwcep->desc_addr[i].status.b_iso_out.ioc = 0; -+ dwcep->desc_addr[i].status.b_iso_out.pid = nat + 1; -+ dwcep->desc_addr[i].status.b_iso_out.l = 0; -+ -+ /* Process the last descriptor */ -+ if (i == ereq->pio_pkt_count - 1) { -+ dwcep->desc_addr[i].status.b_iso_out.ioc = 1; -+ dwcep->desc_addr[i].status.b_iso_out.l = 1; -+ } -+ } -+ -+ /* Setup and start the transfer for this endpoint */ -+ dwcep->xiso_active_xfers++; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->out_ep_regs[dwcep->num]-> -+ doepdma, dwcep->dma_desc_addr); -+ diepctl.d32 = 0; -+ diepctl.b.epena = 1; -+ diepctl.b.cnak = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->out_ep_regs[dwcep->num]-> -+ doepctl, 0, diepctl.d32); -+ } -+ -+ } else { -+ ep->stopped = 1; -+ } -+ -+ return 0; -+} -+ -+/** -+ * - Remove the request from the queue -+ */ -+void complete_xiso_ep(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_pcd_request_t *req = NULL; -+ struct dwc_iso_xreq_port *ereq = NULL; -+ struct dwc_iso_pkt_desc_port *ddesc_iso = NULL; -+ dwc_ep_t *dwcep = NULL; -+ int i; -+ -+ //DWC_DEBUG(); -+ dwcep = &ep->dwc_ep; -+ -+ /* Get the first pending request from the queue */ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (!req) { -+ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); -+ return; -+ } -+ dwcep->xiso_active_xfers--; -+ dwcep->xiso_queued_xfers--; -+ /* Remove this request from the queue */ -+ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); -+ } else { -+ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); -+ return; -+ } -+ -+ ep->stopped = 1; -+ ereq = &req->ext_req; -+ ddesc_iso = ereq->per_io_frame_descs; -+ -+ if (dwcep->xiso_active_xfers < 0) { -+ DWC_WARN("EP#%d (xiso_active_xfers=%d)", dwcep->num, -+ dwcep->xiso_active_xfers); -+ } -+ -+ /* Fill the Isoc descs of portable extended req from dma descriptors */ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ if (dwcep->is_in) { /* IN endpoints */ -+ ddesc_iso[i].actual_length = ddesc_iso[i].length - -+ dwcep->desc_addr[i].status.b_iso_in.txbytes; -+ ddesc_iso[i].status = -+ dwcep->desc_addr[i].status.b_iso_in.txsts; -+ } else { /* OUT endpoints */ -+ ddesc_iso[i].actual_length = ddesc_iso[i].length - -+ dwcep->desc_addr[i].status.b_iso_out.rxbytes; -+ ddesc_iso[i].status = -+ dwcep->desc_addr[i].status.b_iso_out.rxsts; -+ } -+ } -+ -+ DWC_SPINUNLOCK(ep->pcd->lock); -+ -+ /* Call the completion function in the non-portable logic */ -+ ep->pcd->fops->xisoc_complete(ep->pcd, ep->priv, req->priv, 0, -+ &req->ext_req); -+ -+ DWC_SPINLOCK(ep->pcd->lock); -+ -+ /* Free the request - specific freeing needed for extended request object */ -+ dwc_pcd_xiso_ereq_free(ep, req); -+ -+ /* Start the next request */ -+ dwc_otg_pcd_xiso_start_next_request(ep->pcd, ep); -+ -+ return; -+} -+ -+/** -+ * Create and initialize the Isoc pkt descriptors of the extended request. -+ * -+ */ -+static int dwc_otg_pcd_xiso_create_pkt_descs(dwc_otg_pcd_request_t * req, -+ void *ereq_nonport, -+ int atomic_alloc) -+{ -+ struct dwc_iso_xreq_port *ereq = NULL; -+ struct dwc_iso_xreq_port *req_mapped = NULL; -+ struct dwc_iso_pkt_desc_port *ipds = NULL; /* To be created in this function */ -+ uint32_t pkt_count; -+ int i; -+ -+ ereq = &req->ext_req; -+ req_mapped = (struct dwc_iso_xreq_port *)ereq_nonport; -+ pkt_count = req_mapped->pio_pkt_count; -+ -+ /* Create the isoc descs */ -+ if (atomic_alloc) { -+ ipds = DWC_ALLOC_ATOMIC(sizeof(*ipds) * pkt_count); -+ } else { -+ ipds = DWC_ALLOC(sizeof(*ipds) * pkt_count); -+ } -+ -+ if (!ipds) { -+ DWC_ERROR("Failed to allocate isoc descriptors"); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Initialize the extended request fields */ -+ ereq->per_io_frame_descs = ipds; -+ ereq->error_count = 0; -+ ereq->pio_alloc_pkt_count = pkt_count; -+ ereq->pio_pkt_count = pkt_count; -+ ereq->tr_sub_flags = req_mapped->tr_sub_flags; -+ -+ /* Init the Isoc descriptors */ -+ for (i = 0; i < pkt_count; i++) { -+ ipds[i].length = req_mapped->per_io_frame_descs[i].length; -+ ipds[i].offset = req_mapped->per_io_frame_descs[i].offset; -+ ipds[i].status = req_mapped->per_io_frame_descs[i].status; /* 0 */ -+ ipds[i].actual_length = -+ req_mapped->per_io_frame_descs[i].actual_length; -+ } -+ -+ return 0; -+} -+ -+static void prn_ext_request(struct dwc_iso_xreq_port *ereq) -+{ -+ struct dwc_iso_pkt_desc_port *xfd = NULL; -+ int i; -+ -+ DWC_DEBUG("per_io_frame_descs=%p", ereq->per_io_frame_descs); -+ DWC_DEBUG("tr_sub_flags=%d", ereq->tr_sub_flags); -+ DWC_DEBUG("error_count=%d", ereq->error_count); -+ DWC_DEBUG("pio_alloc_pkt_count=%d", ereq->pio_alloc_pkt_count); -+ DWC_DEBUG("pio_pkt_count=%d", ereq->pio_pkt_count); -+ DWC_DEBUG("res=%d", ereq->res); -+ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ xfd = &ereq->per_io_frame_descs[0]; -+ DWC_DEBUG("FD #%d", i); -+ -+ DWC_DEBUG("xfd->actual_length=%d", xfd->actual_length); -+ DWC_DEBUG("xfd->length=%d", xfd->length); -+ DWC_DEBUG("xfd->offset=%d", xfd->offset); -+ DWC_DEBUG("xfd->status=%d", xfd->status); -+ } -+} -+ -+/** -+ * -+ */ -+int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, -+ int zero, void *req_handle, int atomic_alloc, -+ void *ereq_nonport) -+{ -+ dwc_otg_pcd_request_t *req = NULL; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ int res; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ /* We support this extension only for DDMA mode */ -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) -+ if (!GET_CORE_IF(pcd)->dma_desc_enable) -+ return -DWC_E_INVALID; -+ -+ /* Create a dwc_otg_pcd_request_t object */ -+ if (atomic_alloc) { -+ req = DWC_ALLOC_ATOMIC(sizeof(*req)); -+ } else { -+ req = DWC_ALLOC(sizeof(*req)); -+ } -+ -+ if (!req) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Create the Isoc descs for this request which shall be the exact match -+ * of the structure sent to us from the non-portable logic */ -+ res = -+ dwc_otg_pcd_xiso_create_pkt_descs(req, ereq_nonport, atomic_alloc); -+ if (res) { -+ DWC_WARN("Failed to init the Isoc descriptors"); -+ DWC_FREE(req); -+ return res; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); -+ req->buf = buf; -+ req->dma = dma_buf; -+ req->length = buflen; -+ req->sent_zlp = zero; -+ req->priv = req_handle; -+ -+ //DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ ep->dwc_ep.dma_addr = dma_buf; -+ ep->dwc_ep.start_xfer_buff = buf; -+ ep->dwc_ep.xfer_buff = buf; -+ ep->dwc_ep.xfer_len = 0; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = buflen; -+ -+ /* Add this request to the tail */ -+ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); -+ ep->dwc_ep.xiso_queued_xfers++; -+ -+//DWC_DEBUG("CP_0"); -+//DWC_DEBUG("req->ext_req.tr_sub_flags=%d", req->ext_req.tr_sub_flags); -+//prn_ext_request((struct dwc_iso_xreq_port *) ereq_nonport); -+//prn_ext_request(&req->ext_req); -+ -+ //DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ /* If the req->status == ASAP then check if there is any active transfer -+ * for this endpoint. If no active transfers, then get the first entry -+ * from the queue and start that transfer -+ */ -+ if (req->ext_req.tr_sub_flags == DWC_EREQ_TF_ASAP) { -+ res = dwc_otg_pcd_xiso_start_next_request(pcd, ep); -+ if (res) { -+ DWC_WARN("Failed to start the next Isoc transfer"); -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ DWC_FREE(req); -+ return res; -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return 0; -+} -+ -+#endif -+/* END ifdef DWC_UTE_PER_IO ***************************************************/ -+int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, -+ int zero, void *req_handle, int atomic_alloc) -+{ -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ dwc_irqflags_t flags; -+ dwc_otg_pcd_request_t *req; -+ dwc_otg_pcd_ep_t *ep; -+ uint32_t max_transfer; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (atomic_alloc) { -+ req = DWC_ALLOC_ATOMIC(sizeof(*req)); -+ } else { -+ req = DWC_ALLOC(sizeof(*req)); -+ } -+ -+ if (!req) { -+ return -DWC_E_NO_MEMORY; -+ } -+ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); -+ if (!GET_CORE_IF(pcd)->core_params->opt) { -+ if (ep->dwc_ep.num != 0) { -+ DWC_ERROR("queue req %p, len %d buf %p\n", -+ req_handle, buflen, buf); -+ } -+ } -+ -+ req->buf = buf; -+ req->dma = dma_buf; -+ req->length = buflen; -+ req->sent_zlp = zero; -+ req->priv = req_handle; -+ req->dw_align_buf = NULL; -+ if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable -+ && !GET_CORE_IF(pcd)->dma_desc_enable) -+ req->dw_align_buf = DWC_DMA_ALLOC(dev, buflen, -+ &req->dw_align_buf_dma); -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ /* -+ * After adding request to the queue for IN ISOC wait for In Token Received -+ * when TX FIFO is empty interrupt and for OUT ISOC wait for OUT Token -+ * Received when EP is disabled interrupt to obtain starting microframe -+ * (odd/even) start transfer -+ */ -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ if (req != 0) { -+ depctl_data_t depctl = {.d32 = -+ DWC_READ_REG32(&pcd->core_if->dev_if-> -+ in_ep_regs[ep->dwc_ep.num]-> -+ diepctl) }; -+ ++pcd->request_pending; -+ -+ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); -+ if (ep->dwc_ep.is_in) { -+ depctl.b.cnak = 1; -+ DWC_WRITE_REG32(&pcd->core_if->dev_if-> -+ in_ep_regs[ep->dwc_ep.num]-> -+ diepctl, depctl.d32); -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ } -+ return 0; -+ } -+ -+ /* -+ * For EP0 IN without premature status, zlp is required? -+ */ -+ if (ep->dwc_ep.num == 0 && ep->dwc_ep.is_in) { -+ DWC_DEBUGPL(DBG_PCDV, "%d-OUT ZLP\n", ep->dwc_ep.num); -+ //_req->zero = 1; -+ } -+ -+ /* Start the transfer */ -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue) && !ep->stopped) { -+ /* EP0 Transfer? */ -+ if (ep->dwc_ep.num == 0) { -+ switch (pcd->ep0state) { -+ case EP0_IN_DATA_PHASE: -+ DWC_DEBUGPL(DBG_PCD, -+ "%s ep0: EP0_IN_DATA_PHASE\n", -+ __func__); -+ break; -+ -+ case EP0_OUT_DATA_PHASE: -+ DWC_DEBUGPL(DBG_PCD, -+ "%s ep0: EP0_OUT_DATA_PHASE\n", -+ __func__); -+ if (pcd->request_config) { -+ /* Complete STATUS PHASE */ -+ ep->dwc_ep.is_in = 1; -+ pcd->ep0state = EP0_IN_STATUS_PHASE; -+ } -+ break; -+ -+ case EP0_IN_STATUS_PHASE: -+ DWC_DEBUGPL(DBG_PCD, -+ "%s ep0: EP0_IN_STATUS_PHASE\n", -+ __func__); -+ break; -+ -+ default: -+ DWC_DEBUGPL(DBG_ANY, "ep0: odd state %d\n", -+ pcd->ep0state); -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_SHUTDOWN; -+ } -+ -+ ep->dwc_ep.dma_addr = dma_buf; -+ ep->dwc_ep.start_xfer_buff = buf; -+ ep->dwc_ep.xfer_buff = buf; -+ ep->dwc_ep.xfer_len = buflen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ if (zero) { -+ if ((ep->dwc_ep.xfer_len % -+ ep->dwc_ep.maxpacket == 0) -+ && (ep->dwc_ep.xfer_len != 0)) { -+ ep->dwc_ep.sent_zlp = 1; -+ } -+ -+ } -+ -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } // non-ep0 endpoints -+ else { -+#ifdef DWC_UTE_CFI -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ /* store the request length */ -+ ep->dwc_ep.cfi_req_len = buflen; -+ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, -+ ep, req); -+ } else { -+#endif -+ max_transfer = -+ GET_CORE_IF(ep->pcd)->core_params-> -+ max_transfer_size; -+ -+ /* Setup and start the Transfer */ -+ if (req->dw_align_buf){ -+ if (ep->dwc_ep.is_in) -+ dwc_memcpy(req->dw_align_buf, -+ buf, buflen); -+ ep->dwc_ep.dma_addr = -+ req->dw_align_buf_dma; -+ ep->dwc_ep.start_xfer_buff = -+ req->dw_align_buf; -+ ep->dwc_ep.xfer_buff = -+ req->dw_align_buf; -+ } else { -+ ep->dwc_ep.dma_addr = dma_buf; -+ ep->dwc_ep.start_xfer_buff = buf; -+ ep->dwc_ep.xfer_buff = buf; -+ } -+ ep->dwc_ep.xfer_len = 0; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = buflen; -+ -+ ep->dwc_ep.maxxfer = max_transfer; -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ uint32_t out_max_xfer = -+ DDMA_MAX_TRANSFER_SIZE - -+ (DDMA_MAX_TRANSFER_SIZE % 4); -+ if (ep->dwc_ep.is_in) { -+ if (ep->dwc_ep.maxxfer > -+ DDMA_MAX_TRANSFER_SIZE) { -+ ep->dwc_ep.maxxfer = -+ DDMA_MAX_TRANSFER_SIZE; -+ } -+ } else { -+ if (ep->dwc_ep.maxxfer > -+ out_max_xfer) { -+ ep->dwc_ep.maxxfer = -+ out_max_xfer; -+ } -+ } -+ } -+ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { -+ ep->dwc_ep.maxxfer -= -+ (ep->dwc_ep.maxxfer % -+ ep->dwc_ep.maxpacket); -+ } -+ -+ if (zero) { -+ if ((ep->dwc_ep.total_len % -+ ep->dwc_ep.maxpacket == 0) -+ && (ep->dwc_ep.total_len != 0)) { -+ ep->dwc_ep.sent_zlp = 1; -+ } -+ } -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ dwc_otg_ep_start_transfer(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } -+ } -+ -+ if (req != 0) { -+ ++pcd->request_pending; -+ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); -+ if (ep->dwc_ep.is_in && ep->stopped -+ && !(GET_CORE_IF(pcd)->dma_enable)) { -+ /** @todo NGS Create a function for this. */ -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.intktxfemp = 1; -+ if (GET_CORE_IF(pcd)->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->dev_global_regs->diepeachintmsk -+ [ep->dwc_ep.num], 0, -+ diepmsk.d32); -+ } else { -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->dev_global_regs-> -+ diepmsk, 0, diepmsk.d32); -+ } -+ -+ } -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return 0; -+} -+ -+int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle) -+{ -+ dwc_irqflags_t flags; -+ dwc_otg_pcd_request_t *req; -+ dwc_otg_pcd_ep_t *ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { -+ DWC_WARN("bad argument\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ /* make sure it's actually queued on this endpoint */ -+ DWC_CIRCLEQ_FOREACH(req, &ep->queue, queue_entry) { -+ if (req->priv == (void *)req_handle) { -+ break; -+ } -+ } -+ -+ if (req->priv != (void *)req_handle) { -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_INVALID; -+ } -+ -+ if (!DWC_CIRCLEQ_EMPTY_ENTRY(req, queue_entry)) { -+ dwc_otg_request_done(ep, req, -DWC_E_RESTART); -+ } else { -+ req = NULL; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return req ? 0 : -DWC_E_SHUTDOWN; -+ -+} -+ -+/** -+ * dwc_otg_pcd_ep_wedge - sets the halt feature and ignores clear requests -+ * -+ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) -+ * requests. If the gadget driver clears the halt status, it will -+ * automatically unwedge the endpoint. -+ * -+ * Returns zero on success, else negative DWC error code. -+ */ -+int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ int retval = 0; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if ((!ep->desc && ep != &pcd->ep0) || -+ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { -+ DWC_WARN("%s, bad ep\n", __func__); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT"); -+ retval = -DWC_E_AGAIN; -+ } else { -+ /* This code needs to be reviewed */ -+ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { -+ dtxfsts_data_t txstatus; -+ fifosize_data_t txfifosize; -+ -+ txfifosize.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)-> -+ core_global_regs->dtxfsiz[ep->dwc_ep. -+ tx_fifo_num]); -+ txstatus.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->in_ep_regs[ep->dwc_ep.num]-> -+ dtxfsts); -+ -+ if (txstatus.b.txfspcavail < txfifosize.b.depth) { -+ DWC_WARN("%s() Data In Tx Fifo\n", __func__); -+ retval = -DWC_E_AGAIN; -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return retval; -+} -+ -+int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ int retval = 0; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if (!ep || (!ep->desc && ep != &pcd->ep0) || -+ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { -+ DWC_WARN("%s, bad ep\n", __func__); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT"); -+ retval = -DWC_E_AGAIN; -+ } else if (value == 0) { -+ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ } else if (value == 1) { -+ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { -+ dtxfsts_data_t txstatus; -+ fifosize_data_t txfifosize; -+ -+ txfifosize.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs-> -+ dtxfsiz[ep->dwc_ep.tx_fifo_num]); -+ txstatus.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ in_ep_regs[ep->dwc_ep.num]->dtxfsts); -+ -+ if (txstatus.b.txfspcavail < txfifosize.b.depth) { -+ DWC_WARN("%s() Data In Tx Fifo\n", __func__); -+ retval = -DWC_E_AGAIN; -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ } -+ } else if (value == 2) { -+ ep->dwc_ep.stall_clear_flag = 0; -+ } else if (value == 3) { -+ ep->dwc_ep.stall_clear_flag = 1; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return retval; -+} -+ -+/** -+ * This function initiates remote wakeup of the host from suspend state. -+ */ -+void dwc_otg_pcd_rem_wkup_from_suspend(dwc_otg_pcd_t * pcd, int set) -+{ -+ dctl_data_t dctl = { 0 }; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dsts_data_t dsts; -+ -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ if (!dsts.b.suspsts) { -+ DWC_WARN("Remote wakeup while is not in suspend state\n"); -+ } -+ /* Check if DEVICE_REMOTE_WAKEUP feature enabled */ -+ if (pcd->remote_wakeup_enable) { -+ if (set) { -+ -+ if (core_if->adp_enable) { -+ gpwrdn_data_t gpwrdn; -+ -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Mask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ -+ /* Disable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Device mode. -+ */ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ -+ dwc_otg_initiate_srp(core_if); -+ } -+ -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, 0, dctl.d32); -+ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); -+ -+ dwc_mdelay(2); -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, dctl.d32, 0); -+ DWC_DEBUGPL(DBG_PCD, "Clear Remote Wakeup\n"); -+ } -+ } else { -+ DWC_DEBUGPL(DBG_PCD, "Remote Wakeup is disabled\n"); -+ } -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * This function initiates remote wakeup of the host from L1 sleep state. -+ */ -+void dwc_otg_pcd_rem_wkup_from_sleep(dwc_otg_pcd_t * pcd, int set) -+{ -+ glpmcfg_data_t lpmcfg; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ -+ /* Check if we are in L1 state */ -+ if (!lpmcfg.b.prt_sleep_sts) { -+ DWC_DEBUGPL(DBG_PCD, "Device is not in sleep state\n"); -+ return; -+ } -+ -+ /* Check if host allows remote wakeup */ -+ if (!lpmcfg.b.rem_wkup_en) { -+ DWC_DEBUGPL(DBG_PCD, "Host does not allow remote wakeup\n"); -+ return; -+ } -+ -+ /* Check if Resume OK */ -+ if (!lpmcfg.b.sleep_state_resumeok) { -+ DWC_DEBUGPL(DBG_PCD, "Sleep state resume is not OK\n"); -+ return; -+ } -+ -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.en_utmi_sleep = 0; -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+ -+ if (set) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.rmtwkupsig = 1; -+ /* Set RmtWkUpSig bit to start remote wakup signaling. -+ * Hardware will automatically clear this bit. -+ */ -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ 0, dctl.d32); -+ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); -+ } -+ -+} -+#endif -+ -+/** -+ * Performs remote wakeup. -+ */ -+void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_irqflags_t flags; -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (core_if->lx_state == DWC_OTG_L1) { -+ dwc_otg_pcd_rem_wkup_from_sleep(pcd, set); -+ } else { -+#endif -+ dwc_otg_pcd_rem_wkup_from_suspend(pcd, set); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ } -+#endif -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ } -+ return; -+} -+ -+void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dctl_data_t dctl = { 0 }; -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ dctl.b.sftdiscon = 1; -+ DWC_PRINTF("Soft disconnect for %d useconds\n",no_of_usecs); -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ dwc_udelay(no_of_usecs); -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32,0); -+ -+ } else{ -+ DWC_PRINTF("NOT SUPPORTED IN HOST MODE\n"); -+ } -+ return; -+ -+} -+ -+int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd) -+{ -+ dsts_data_t dsts; -+ gotgctl_data_t gotgctl; -+ -+ /* -+ * This function starts the Protocol if no session is in progress. If -+ * a session is already in progress, but the device is suspended, -+ * remote wakeup signaling is started. -+ */ -+ -+ /* Check if valid session */ -+ gotgctl.d32 = -+ DWC_READ_REG32(&(GET_CORE_IF(pcd)->core_global_regs->gotgctl)); -+ if (gotgctl.b.bsesvld) { -+ /* Check if suspend state */ -+ dsts.d32 = -+ DWC_READ_REG32(& -+ (GET_CORE_IF(pcd)->dev_if-> -+ dev_global_regs->dsts)); -+ if (dsts.b.suspsts) { -+ dwc_otg_pcd_remote_wakeup(pcd, 1); -+ } -+ } else { -+ dwc_otg_pcd_initiate_srp(pcd); -+ } -+ -+ return 0; -+ -+} -+ -+/** -+ * Start the SRP timer to detect when the SRP does not complete within -+ * 6 seconds. -+ * -+ * @param pcd the pcd structure. -+ */ -+void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd) -+{ -+ dwc_irqflags_t flags; -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ dwc_otg_initiate_srp(GET_CORE_IF(pcd)); -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+} -+ -+int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd) -+{ -+ return dwc_otg_get_frame_number(GET_CORE_IF(pcd)); -+} -+ -+int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd) -+{ -+ return GET_CORE_IF(pcd)->core_params->lpm_enable; -+} -+ -+uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->b_hnp_enable; -+} -+ -+uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->a_hnp_support; -+} -+ -+uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->a_alt_hnp_support; -+} -+ -+int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->remote_wakeup_enable; -+} -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h -new file mode 100644 -index 0000000000000000000000000000000000000000..a70ebd049d2cca3bf988a1f809832eebede14f96 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h -@@ -0,0 +1,273 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $ -+ * $Revision: #48 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+#if !defined(__DWC_PCD_H__) -+#define __DWC_PCD_H__ -+ -+#include "dwc_otg_os_dep.h" -+#include "usb.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_driver.h" -+ -+struct cfiobject; -+ -+/** -+ * @file -+ * -+ * This file contains the structures, constants, and interfaces for -+ * the Perpherial Contoller Driver (PCD). -+ * -+ * The Peripheral Controller Driver (PCD) for Linux will implement the -+ * Gadget API, so that the existing Gadget drivers can be used. For -+ * the Mass Storage Function driver the File-backed USB Storage Gadget -+ * (FBS) driver will be used. The FBS driver supports the -+ * Control-Bulk (CB), Control-Bulk-Interrupt (CBI), and Bulk-Only -+ * transports. -+ * -+ */ -+ -+/** Invalid DMA Address */ -+#define DWC_DMA_ADDR_INVALID (~(dwc_dma_t)0) -+ -+/** Max Transfer size for any EP */ -+#define DDMA_MAX_TRANSFER_SIZE 65535 -+ -+/** -+ * Get the pointer to the core_if from the pcd pointer. -+ */ -+#define GET_CORE_IF( _pcd ) (_pcd->core_if) -+ -+/** -+ * States of EP0. -+ */ -+typedef enum ep0_state { -+ EP0_DISCONNECT, /* no host */ -+ EP0_IDLE, -+ EP0_IN_DATA_PHASE, -+ EP0_OUT_DATA_PHASE, -+ EP0_IN_STATUS_PHASE, -+ EP0_OUT_STATUS_PHASE, -+ EP0_STALL, -+} ep0state_e; -+ -+/** Fordward declaration.*/ -+struct dwc_otg_pcd; -+ -+/** DWC_otg iso request structure. -+ * -+ */ -+typedef struct usb_iso_request dwc_otg_pcd_iso_request_t; -+ -+#ifdef DWC_UTE_PER_IO -+ -+/** -+ * This shall be the exact analogy of the same type structure defined in the -+ * usb_gadget.h. Each descriptor contains -+ */ -+struct dwc_iso_pkt_desc_port { -+ uint32_t offset; -+ uint32_t length; /* expected length */ -+ uint32_t actual_length; -+ uint32_t status; -+}; -+ -+struct dwc_iso_xreq_port { -+ /** transfer/submission flag */ -+ uint32_t tr_sub_flags; -+ /** Start the request ASAP */ -+#define DWC_EREQ_TF_ASAP 0x00000002 -+ /** Just enqueue the request w/o initiating a transfer */ -+#define DWC_EREQ_TF_ENQUEUE 0x00000004 -+ -+ /** -+ * count of ISO packets attached to this request - shall -+ * not exceed the pio_alloc_pkt_count -+ */ -+ uint32_t pio_pkt_count; -+ /** count of ISO packets allocated for this request */ -+ uint32_t pio_alloc_pkt_count; -+ /** number of ISO packet errors */ -+ uint32_t error_count; -+ /** reserved for future extension */ -+ uint32_t res; -+ /** Will be allocated and freed in the UTE gadget and based on the CFC value */ -+ struct dwc_iso_pkt_desc_port *per_io_frame_descs; -+}; -+#endif -+/** DWC_otg request structure. -+ * This structure is a list of requests. -+ */ -+typedef struct dwc_otg_pcd_request { -+ void *priv; -+ void *buf; -+ dwc_dma_t dma; -+ uint32_t length; -+ uint32_t actual; -+ unsigned sent_zlp:1; -+ /** -+ * Used instead of original buffer if -+ * it(physical address) is not dword-aligned. -+ **/ -+ uint8_t *dw_align_buf; -+ dwc_dma_t dw_align_buf_dma; -+ -+ DWC_CIRCLEQ_ENTRY(dwc_otg_pcd_request) queue_entry; -+#ifdef DWC_UTE_PER_IO -+ struct dwc_iso_xreq_port ext_req; -+ //void *priv_ereq_nport; /* */ -+#endif -+} dwc_otg_pcd_request_t; -+ -+DWC_CIRCLEQ_HEAD(req_list, dwc_otg_pcd_request); -+ -+/** PCD EP structure. -+ * This structure describes an EP, there is an array of EPs in the PCD -+ * structure. -+ */ -+typedef struct dwc_otg_pcd_ep { -+ /** USB EP Descriptor */ -+ const usb_endpoint_descriptor_t *desc; -+ -+ /** queue of dwc_otg_pcd_requests. */ -+ struct req_list queue; -+ unsigned stopped:1; -+ unsigned disabling:1; -+ unsigned dma:1; -+ unsigned queue_sof:1; -+ -+#ifdef DWC_EN_ISOC -+ /** ISOC req handle passed */ -+ void *iso_req_handle; -+#endif //_EN_ISOC_ -+ -+ /** DWC_otg ep data. */ -+ dwc_ep_t dwc_ep; -+ -+ /** Pointer to PCD */ -+ struct dwc_otg_pcd *pcd; -+ -+ void *priv; -+} dwc_otg_pcd_ep_t; -+ -+/** DWC_otg PCD Structure. -+ * This structure encapsulates the data for the dwc_otg PCD. -+ */ -+struct dwc_otg_pcd { -+ const struct dwc_otg_pcd_function_ops *fops; -+ /** The DWC otg device pointer */ -+ struct dwc_otg_device *otg_dev; -+ /** Core Interface */ -+ dwc_otg_core_if_t *core_if; -+ /** State of EP0 */ -+ ep0state_e ep0state; -+ /** EP0 Request is pending */ -+ unsigned ep0_pending:1; -+ /** Indicates when SET CONFIGURATION Request is in process */ -+ unsigned request_config:1; -+ /** The state of the Remote Wakeup Enable. */ -+ unsigned remote_wakeup_enable:1; -+ /** The state of the B-Device HNP Enable. */ -+ unsigned b_hnp_enable:1; -+ /** The state of A-Device HNP Support. */ -+ unsigned a_hnp_support:1; -+ /** The state of the A-Device Alt HNP support. */ -+ unsigned a_alt_hnp_support:1; -+ /** Count of pending Requests */ -+ unsigned request_pending; -+ -+ /** SETUP packet for EP0 -+ * This structure is allocated as a DMA buffer on PCD initialization -+ * with enough space for up to 3 setup packets. -+ */ -+ union { -+ usb_device_request_t req; -+ uint32_t d32[2]; -+ } *setup_pkt; -+ -+ dwc_dma_t setup_pkt_dma_handle; -+ -+ /* Additional buffer and flag for CTRL_WR premature case */ -+ uint8_t *backup_buf; -+ unsigned data_terminated; -+ -+ /** 2-byte dma buffer used to return status from GET_STATUS */ -+ uint16_t *status_buf; -+ dwc_dma_t status_buf_dma_handle; -+ -+ /** EP0 */ -+ dwc_otg_pcd_ep_t ep0; -+ -+ /** Array of IN EPs. */ -+ dwc_otg_pcd_ep_t in_ep[MAX_EPS_CHANNELS - 1]; -+ /** Array of OUT EPs. */ -+ dwc_otg_pcd_ep_t out_ep[MAX_EPS_CHANNELS - 1]; -+ /** number of valid EPs in the above array. */ -+// unsigned num_eps : 4; -+ dwc_spinlock_t *lock; -+ -+ /** Tasklet to defer starting of TEST mode transmissions until -+ * Status Phase has been completed. -+ */ -+ dwc_tasklet_t *test_mode_tasklet; -+ -+ /** Tasklet to delay starting of xfer in DMA mode */ -+ dwc_tasklet_t *start_xfer_tasklet; -+ -+ /** The test mode to enter when the tasklet is executed. */ -+ unsigned test_mode; -+ /** The cfi_api structure that implements most of the CFI API -+ * and OTG specific core configuration functionality -+ */ -+#ifdef DWC_UTE_CFI -+ struct cfiobject *cfi; -+#endif -+ -+}; -+ -+static inline struct device *dwc_otg_pcd_to_dev(struct dwc_otg_pcd *pcd) -+{ -+ return &pcd->otg_dev->os_dep.platformdev->dev; -+} -+ -+//FIXME this functions should be static, and this prototypes should be removed -+extern void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep); -+extern void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, -+ dwc_otg_pcd_request_t * req, int32_t status); -+ -+void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, -+ void *req_handle); -+ -+extern void do_test_mode(void *data); -+#endif -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4c1d591fbc098b2f4a745669e4f243e068735b20 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h -@@ -0,0 +1,361 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $ -+ * $Revision: #11 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+#if !defined(__DWC_PCD_IF_H__) -+#define __DWC_PCD_IF_H__ -+ -+//#include "dwc_os.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_driver.h" -+ -+/** @file -+ * This file defines DWC_OTG PCD Core API. -+ */ -+ -+struct dwc_otg_pcd; -+typedef struct dwc_otg_pcd dwc_otg_pcd_t; -+ -+/** Maxpacket size for EP0 */ -+#define MAX_EP0_SIZE 64 -+/** Maxpacket size for any EP */ -+#define MAX_PACKET_SIZE 1024 -+ -+/** @name Function Driver Callbacks */ -+/** @{ */ -+ -+/** This function will be called whenever a previously queued request has -+ * completed. The status value will be set to -DWC_E_SHUTDOWN to indicated a -+ * failed or aborted transfer, or -DWC_E_RESTART to indicate the device was reset, -+ * or -DWC_E_TIMEOUT to indicate it timed out, or -DWC_E_INVALID to indicate invalid -+ * parameters. */ -+typedef int (*dwc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, -+ uint32_t actual); -+/** -+ * This function will be called whenever a previousle queued ISOC request has -+ * completed. Count of ISOC packets could be read using dwc_otg_pcd_get_iso_packet_count -+ * function. -+ * The status of each ISOC packet could be read using dwc_otg_pcd_get_iso_packet_* -+ * functions. -+ */ -+typedef int (*dwc_isoc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int proc_buf_num); -+/** This function should handle any SETUP request that cannot be handled by the -+ * PCD Core. This includes most GET_DESCRIPTORs, SET_CONFIGS, Any -+ * class-specific requests, etc. The function must non-blocking. -+ * -+ * Returns 0 on success. -+ * Returns -DWC_E_NOT_SUPPORTED if the request is not supported. -+ * Returns -DWC_E_INVALID if the setup request had invalid parameters or bytes. -+ * Returns -DWC_E_SHUTDOWN on any other error. */ -+typedef int (*dwc_setup_cb_t) (dwc_otg_pcd_t * pcd, uint8_t * bytes); -+/** This is called whenever the device has been disconnected. The function -+ * driver should take appropriate action to clean up all pending requests in the -+ * PCD Core, remove all endpoints (except ep0), and initialize back to reset -+ * state. */ -+typedef int (*dwc_disconnect_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called when device has been connected. */ -+typedef int (*dwc_connect_cb_t) (dwc_otg_pcd_t * pcd, int speed); -+/** This function is called when device has been suspended */ -+typedef int (*dwc_suspend_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called when device has received LPM tokens, i.e. -+ * device has been sent to sleep state. */ -+typedef int (*dwc_sleep_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called when device has been resumed -+ * from suspend(L2) or L1 sleep state. */ -+typedef int (*dwc_resume_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called whenever hnp params has been changed. -+ * User can call get_b_hnp_enable, get_a_hnp_support, get_a_alt_hnp_support functions -+ * to get hnp parameters. */ -+typedef int (*dwc_hnp_params_changed_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called whenever USB RESET is detected. */ -+typedef int (*dwc_reset_cb_t) (dwc_otg_pcd_t * pcd); -+ -+typedef int (*cfi_setup_cb_t) (dwc_otg_pcd_t * pcd, void *ctrl_req_bytes); -+ -+/** -+ * -+ * @param ep_handle Void pointer to the usb_ep structure -+ * @param ereq_port Pointer to the extended request structure created in the -+ * portable part. -+ */ -+typedef int (*xiso_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, -+ void *ereq_port); -+/** Function Driver Ops Data Structure */ -+struct dwc_otg_pcd_function_ops { -+ dwc_connect_cb_t connect; -+ dwc_disconnect_cb_t disconnect; -+ dwc_setup_cb_t setup; -+ dwc_completion_cb_t complete; -+ dwc_isoc_completion_cb_t isoc_complete; -+ dwc_suspend_cb_t suspend; -+ dwc_sleep_cb_t sleep; -+ dwc_resume_cb_t resume; -+ dwc_reset_cb_t reset; -+ dwc_hnp_params_changed_cb_t hnp_changed; -+ cfi_setup_cb_t cfi_setup; -+#ifdef DWC_UTE_PER_IO -+ xiso_completion_cb_t xisoc_complete; -+#endif -+}; -+/** @} */ -+ -+/** @name Function Driver Functions */ -+/** @{ */ -+ -+/** Call this function to get pointer on dwc_otg_pcd_t, -+ * this pointer will be used for all PCD API functions. -+ * -+ * @param core_if The DWC_OTG Core -+ */ -+extern dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_device_t *otg_dev); -+ -+/** Frees PCD allocated by dwc_otg_pcd_init -+ * -+ * @param pcd The PCD -+ */ -+extern void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd); -+ -+/** Call this to bind the function driver to the PCD Core. -+ * -+ * @param pcd Pointer on dwc_otg_pcd_t returned by dwc_otg_pcd_init function. -+ * @param fops The Function Driver Ops data structure containing pointers to all callbacks. -+ */ -+extern void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, -+ const struct dwc_otg_pcd_function_ops *fops); -+ -+/** Enables an endpoint for use. This function enables an endpoint in -+ * the PCD. The endpoint is described by the ep_desc which has the -+ * same format as a USB ep descriptor. The ep_handle parameter is used to refer -+ * to the endpoint from other API functions and in callbacks. Normally this -+ * should be called after a SET_CONFIGURATION/SET_INTERFACE to configure the -+ * core for that interface. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns 0 on success. -+ * -+ * @param pcd The PCD -+ * @param ep_desc Endpoint descriptor -+ * @param usb_ep Handle on endpoint, that will be used to identify endpoint. -+ */ -+extern int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, -+ const uint8_t * ep_desc, void *usb_ep); -+ -+/** Disable the endpoint referenced by ep_handle. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error occurred. -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle); -+ -+/** Queue a data transfer request on the endpoint referenced by ep_handle. -+ * After the transfer is completes, the complete callback will be called with -+ * the request status. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param buf The buffer for the data -+ * @param dma_buf The DMA buffer for the data -+ * @param buflen The length of the data transfer -+ * @param zero Specifies whether to send zero length last packet. -+ * @param req_handle Set this handle to any value to use to reference this -+ * request in the ep_dequeue function or from the complete callback -+ * @param atomic_alloc If driver need to perform atomic allocations -+ * for internal data structures. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, -+ uint32_t buflen, int zero, void *req_handle, -+ int atomic_alloc); -+#ifdef DWC_UTE_PER_IO -+/** -+ * -+ * @param ereq_nonport Pointer to the extended request part of the -+ * usb_request structure defined in usb_gadget.h file. -+ */ -+extern int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, -+ uint32_t buflen, int zero, -+ void *req_handle, int atomic_alloc, -+ void *ereq_nonport); -+ -+#endif -+ -+/** De-queue the specified data transfer that has not yet completed. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle); -+ -+/** Halt (STALL) an endpoint or clear it. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns -DWC_E_AGAIN if the STALL cannot be sent and must be tried again later -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value); -+ -+/** This function */ -+extern int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle); -+ -+/** This function should be called on every hardware interrupt */ -+extern int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd); -+ -+/** This function returns current frame number */ -+extern int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd); -+ -+/** -+ * Start isochronous transfers on the endpoint referenced by ep_handle. -+ * For isochronous transfers duble buffering is used. -+ * After processing each of buffers comlete callback will be called with -+ * status for each transaction. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param buf0 The virtual address of first data buffer -+ * @param buf1 The virtual address of second data buffer -+ * @param dma0 The DMA address of first data buffer -+ * @param dma1 The DMA address of second data buffer -+ * @param sync_frame Data pattern frame number -+ * @param dp_frame Data size for pattern frame -+ * @param data_per_frame Data size for regular frame -+ * @param start_frame Frame number to start transfers, if -1 then start transfers ASAP. -+ * @param buf_proc_intrvl Interval of ISOC Buffer processing -+ * @param req_handle Handle of ISOC request -+ * @param atomic_alloc Specefies whether to perform atomic allocation for -+ * internal data structures. -+ * -+ * Returns -DWC_E_NO_MEMORY if there is no enough memory. -+ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function. -+ * Returns -DW_E_SHUTDOWN for any other error. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf0, uint8_t * buf1, -+ dwc_dma_t dma0, dwc_dma_t dma1, -+ int sync_frame, int dp_frame, -+ int data_per_frame, int start_frame, -+ int buf_proc_intrvl, void *req_handle, -+ int atomic_alloc); -+ -+/** Stop ISOC transfers on endpoint referenced by ep_handle. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param req_handle Handle of ISOC request -+ * -+ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function -+ * Returns 0 on success -+ */ -+int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle); -+ -+/** Get ISOC packet status. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param iso_req_handle Isochronoush request handle -+ * @param packet Number of packet -+ * @param status Out parameter for returning status -+ * @param actual Out parameter for returning actual length -+ * @param offset Out parameter for returning offset -+ * -+ */ -+extern void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, -+ void *ep_handle, -+ void *iso_req_handle, int packet, -+ int *status, int *actual, -+ int *offset); -+ -+/** Get ISOC packet count. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param iso_req_handle -+ */ -+extern int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, -+ void *ep_handle, -+ void *iso_req_handle); -+ -+/** This function starts the SRP Protocol if no session is in progress. If -+ * a session is already in progress, but the device is suspended, -+ * remote wakeup signaling is started. -+ */ -+extern int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd); -+ -+/** This function returns 1 if LPM support is enabled, and 0 otherwise. */ -+extern int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd); -+ -+/** This function returns 1 if remote wakeup is allowed and 0, otherwise. */ -+extern int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd); -+ -+/** Initiate SRP */ -+extern void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd); -+ -+/** Starts remote wakeup signaling. */ -+extern void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set); -+ -+/** Starts micorsecond soft disconnect. */ -+extern void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs); -+/** This function returns whether device is dualspeed.*/ -+extern uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd); -+ -+/** This function returns whether device is otg. */ -+extern uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd); -+ -+/** These functions allow to get hnp parameters */ -+extern uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd); -+extern uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd); -+extern uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd); -+ -+/** CFI specific Interface functions */ -+/** Allocate a cfi buffer */ -+extern uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, -+ dwc_dma_t * addr, size_t buflen, -+ int flags); -+ -+/******************************************************************************/ -+ -+/** @} */ -+ -+#endif /* __DWC_PCD_IF_H__ */ -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e55ea9c74be46167a41dc14a2d88a1228878b1bb ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -@@ -0,0 +1,5148 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $ -+ * $Revision: #116 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+#include "dwc_otg_pcd.h" -+ -+#ifdef DWC_UTE_CFI -+#include "dwc_otg_cfi.h" -+#endif -+ -+#ifdef DWC_UTE_PER_IO -+extern void complete_xiso_ep(dwc_otg_pcd_ep_t * ep); -+#endif -+//#define PRINT_CFI_DMA_DESCS -+ -+#define DEBUG_EP0 -+ -+/** -+ * This function updates OTG. -+ */ -+static void dwc_otg_pcd_update_otg(dwc_otg_pcd_t * pcd, const unsigned reset) -+{ -+ -+ if (reset) { -+ pcd->b_hnp_enable = 0; -+ pcd->a_hnp_support = 0; -+ pcd->a_alt_hnp_support = 0; -+ } -+ -+ if (pcd->fops->hnp_changed) { -+ pcd->fops->hnp_changed(pcd); -+ } -+} -+ -+/** @file -+ * This file contains the implementation of the PCD Interrupt handlers. -+ * -+ * The PCD handles the device interrupts. Many conditions can cause a -+ * device interrupt. When an interrupt occurs, the device interrupt -+ * service routine determines the cause of the interrupt and -+ * dispatches handling to the appropriate function. These interrupt -+ * handling functions are described below. -+ * All interrupt registers are processed from LSB to MSB. -+ */ -+ -+/** -+ * This function prints the ep0 state for debug purposes. -+ */ -+static inline void print_ep0_state(dwc_otg_pcd_t * pcd) -+{ -+#ifdef DEBUG -+ char str[40]; -+ -+ switch (pcd->ep0state) { -+ case EP0_DISCONNECT: -+ dwc_strcpy(str, "EP0_DISCONNECT"); -+ break; -+ case EP0_IDLE: -+ dwc_strcpy(str, "EP0_IDLE"); -+ break; -+ case EP0_IN_DATA_PHASE: -+ dwc_strcpy(str, "EP0_IN_DATA_PHASE"); -+ break; -+ case EP0_OUT_DATA_PHASE: -+ dwc_strcpy(str, "EP0_OUT_DATA_PHASE"); -+ break; -+ case EP0_IN_STATUS_PHASE: -+ dwc_strcpy(str, "EP0_IN_STATUS_PHASE"); -+ break; -+ case EP0_OUT_STATUS_PHASE: -+ dwc_strcpy(str, "EP0_OUT_STATUS_PHASE"); -+ break; -+ case EP0_STALL: -+ dwc_strcpy(str, "EP0_STALL"); -+ break; -+ default: -+ dwc_strcpy(str, "EP0_INVALID"); -+ } -+ -+ DWC_DEBUGPL(DBG_ANY, "%s(%d)\n", str, pcd->ep0state); -+#endif -+} -+ -+/** -+ * This function calculate the size of the payload in the memory -+ * for out endpoints and prints size for debug purposes(used in -+ * 2.93a DevOutNak feature). -+ */ -+static inline void print_memory_payload(dwc_otg_pcd_t * pcd, dwc_ep_t * ep) -+{ -+#ifdef DEBUG -+ deptsiz_data_t deptsiz_init = {.d32 = 0 }; -+ deptsiz_data_t deptsiz_updt = {.d32 = 0 }; -+ int pack_num; -+ unsigned payload; -+ -+ deptsiz_init.d32 = pcd->core_if->start_doeptsiz_val[ep->num]; -+ deptsiz_updt.d32 = -+ DWC_READ_REG32(&pcd->core_if->dev_if-> -+ out_ep_regs[ep->num]->doeptsiz); -+ /* Payload will be */ -+ payload = deptsiz_init.b.xfersize - deptsiz_updt.b.xfersize; -+ /* Packet count is decremented every time a packet -+ * is written to the RxFIFO not in to the external memory -+ * So, if payload == 0, then it means no packet was sent to ext memory*/ -+ pack_num = (!payload) ? 0 : (deptsiz_init.b.pktcnt - deptsiz_updt.b.pktcnt); -+ DWC_DEBUGPL(DBG_PCDV, -+ "Payload for EP%d-%s\n", -+ ep->num, (ep->is_in ? "IN" : "OUT")); -+ DWC_DEBUGPL(DBG_PCDV, -+ "Number of transfered bytes = 0x%08x\n", payload); -+ DWC_DEBUGPL(DBG_PCDV, -+ "Number of transfered packets = %d\n", pack_num); -+#endif -+} -+ -+ -+#ifdef DWC_UTE_CFI -+static inline void print_desc(struct dwc_otg_dma_desc *ddesc, -+ const uint8_t * epname, int descnum) -+{ -+ CFI_INFO -+ ("%s DMA_DESC(%d) buf=0x%08x bytes=0x%04x; sp=0x%x; l=0x%x; sts=0x%02x; bs=0x%02x\n", -+ epname, descnum, ddesc->buf, ddesc->status.b.bytes, -+ ddesc->status.b.sp, ddesc->status.b.l, ddesc->status.b.sts, -+ ddesc->status.b.bs); -+} -+#endif -+ -+/** -+ * This function returns pointer to in ep struct with number ep_num -+ */ -+static inline dwc_otg_pcd_ep_t *get_in_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) -+{ -+ int i; -+ int num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; -+ if (ep_num == 0) { -+ return &pcd->ep0; -+ } else { -+ for (i = 0; i < num_in_eps; ++i) { -+ if (pcd->in_ep[i].dwc_ep.num == ep_num) -+ return &pcd->in_ep[i]; -+ } -+ return 0; -+ } -+} -+ -+/** -+ * This function returns pointer to out ep struct with number ep_num -+ */ -+static inline dwc_otg_pcd_ep_t *get_out_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) -+{ -+ int i; -+ int num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; -+ if (ep_num == 0) { -+ return &pcd->ep0; -+ } else { -+ for (i = 0; i < num_out_eps; ++i) { -+ if (pcd->out_ep[i].dwc_ep.num == ep_num) -+ return &pcd->out_ep[i]; -+ } -+ return 0; -+ } -+} -+ -+/** -+ * This functions gets a pointer to an EP from the wIndex address -+ * value of the control request. -+ */ -+dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ uint32_t ep_num = UE_GET_ADDR(wIndex); -+ -+ if (ep_num == 0) { -+ ep = &pcd->ep0; -+ } else if (UE_GET_DIR(wIndex) == UE_DIR_IN) { /* in ep */ -+ ep = &pcd->in_ep[ep_num - 1]; -+ } else { -+ ep = &pcd->out_ep[ep_num - 1]; -+ } -+ -+ return ep; -+} -+ -+/** -+ * This function checks the EP request queue, if the queue is not -+ * empty the next request is started. -+ */ -+void start_next_request(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_pcd_request_t *req = 0; -+ uint32_t max_transfer = -+ GET_CORE_IF(ep->pcd)->core_params->max_transfer_size; -+ -+#ifdef DWC_UTE_CFI -+ struct dwc_otg_pcd *pcd; -+ pcd = ep->pcd; -+#endif -+ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ -+#ifdef DWC_UTE_CFI -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ ep->dwc_ep.cfi_req_len = req->length; -+ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, ep, req); -+ } else { -+#endif -+ /* Setup and start the Transfer */ -+ if (req->dw_align_buf) { -+ ep->dwc_ep.dma_addr = req->dw_align_buf_dma; -+ ep->dwc_ep.start_xfer_buff = req->dw_align_buf; -+ ep->dwc_ep.xfer_buff = req->dw_align_buf; -+ } else { -+ ep->dwc_ep.dma_addr = req->dma; -+ ep->dwc_ep.start_xfer_buff = req->buf; -+ ep->dwc_ep.xfer_buff = req->buf; -+ } -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = req->length; -+ ep->dwc_ep.xfer_len = 0; -+ ep->dwc_ep.xfer_count = 0; -+ -+ ep->dwc_ep.maxxfer = max_transfer; -+ if (GET_CORE_IF(ep->pcd)->dma_desc_enable) { -+ uint32_t out_max_xfer = DDMA_MAX_TRANSFER_SIZE -+ - (DDMA_MAX_TRANSFER_SIZE % 4); -+ if (ep->dwc_ep.is_in) { -+ if (ep->dwc_ep.maxxfer > -+ DDMA_MAX_TRANSFER_SIZE) { -+ ep->dwc_ep.maxxfer = -+ DDMA_MAX_TRANSFER_SIZE; -+ } -+ } else { -+ if (ep->dwc_ep.maxxfer > out_max_xfer) { -+ ep->dwc_ep.maxxfer = -+ out_max_xfer; -+ } -+ } -+ } -+ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { -+ ep->dwc_ep.maxxfer -= -+ (ep->dwc_ep.maxxfer % ep->dwc_ep.maxpacket); -+ } -+ if (req->sent_zlp) { -+ if ((ep->dwc_ep.total_len % -+ ep->dwc_ep.maxpacket == 0) -+ && (ep->dwc_ep.total_len != 0)) { -+ ep->dwc_ep.sent_zlp = 1; -+ } -+ -+ } -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ dwc_otg_ep_start_transfer(GET_CORE_IF(ep->pcd), &ep->dwc_ep); -+ } else if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ DWC_PRINTF("There are no more ISOC requests \n"); -+ ep->dwc_ep.frame_num = 0xFFFFFFFF; -+ } -+} -+ -+/** -+ * This function handles the SOF Interrupts. At this time the SOF -+ * Interrupt is disabled. -+ */ -+int32_t dwc_otg_pcd_handle_sof_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ gintsts_data_t gintsts; -+ -+ DWC_DEBUGPL(DBG_PCD, "SOF\n"); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.sofintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This function handles the Rx Status Queue Level Interrupt, which -+ * indicates that there is a least one packet in the Rx FIFO. The -+ * packets are moved from the FIFO to memory, where they will be -+ * processed when the Endpoint Interrupt Register indicates Transfer -+ * Complete or SETUP Phase Done. -+ * -+ * Repeat the following until the Rx Status Queue is empty: -+ * -# Read the Receive Status Pop Register (GRXSTSP) to get Packet -+ * info -+ * -# If Receive FIFO is empty then skip to step Clear the interrupt -+ * and exit -+ * -# If SETUP Packet call dwc_otg_read_setup_packet to copy the -+ * SETUP data to the buffer -+ * -# If OUT Data Packet call dwc_otg_read_packet to copy the data -+ * to the destination buffer -+ */ -+int32_t dwc_otg_pcd_handle_rx_status_q_level_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t gintmask = {.d32 = 0 }; -+ device_grxsts_data_t status; -+ dwc_otg_pcd_ep_t *ep; -+ gintsts_data_t gintsts; -+#ifdef DEBUG -+ static char *dpid_str[] = { "D0", "D2", "D1", "MDATA" }; -+#endif -+ -+ //DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _pcd); -+ /* Disable the Rx Status Queue Level interrupt */ -+ gintmask.b.rxstsqlvl = 1; -+ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmask.d32, 0); -+ -+ /* Get the Status from the top of the FIFO */ -+ status.d32 = DWC_READ_REG32(&global_regs->grxstsp); -+ -+ DWC_DEBUGPL(DBG_PCD, "EP:%d BCnt:%d DPID:%s " -+ "pktsts:%x Frame:%d(0x%0x)\n", -+ status.b.epnum, status.b.bcnt, -+ dpid_str[status.b.dpid], -+ status.b.pktsts, status.b.fn, status.b.fn); -+ /* Get pointer to EP structure */ -+ ep = get_out_ep(pcd, status.b.epnum); -+ -+ switch (status.b.pktsts) { -+ case DWC_DSTS_GOUT_NAK: -+ DWC_DEBUGPL(DBG_PCDV, "Global OUT NAK\n"); -+ break; -+ case DWC_STS_DATA_UPDT: -+ DWC_DEBUGPL(DBG_PCDV, "OUT Data Packet\n"); -+ if (status.b.bcnt && ep->dwc_ep.xfer_buff) { -+ /** @todo NGS Check for buffer overflow? */ -+ dwc_otg_read_packet(core_if, -+ ep->dwc_ep.xfer_buff, -+ status.b.bcnt); -+ ep->dwc_ep.xfer_count += status.b.bcnt; -+ ep->dwc_ep.xfer_buff += status.b.bcnt; -+ } -+ break; -+ case DWC_STS_XFER_COMP: -+ DWC_DEBUGPL(DBG_PCDV, "OUT Complete\n"); -+ break; -+ case DWC_DSTS_SETUP_COMP: -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Setup Complete\n"); -+#endif -+ break; -+ case DWC_DSTS_SETUP_UPDT: -+ dwc_otg_read_setup_packet(core_if, pcd->setup_pkt->d32); -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, -+ "SETUP PKT: %02x.%02x v%04x i%04x l%04x\n", -+ pcd->setup_pkt->req.bmRequestType, -+ pcd->setup_pkt->req.bRequest, -+ UGETW(pcd->setup_pkt->req.wValue), -+ UGETW(pcd->setup_pkt->req.wIndex), -+ UGETW(pcd->setup_pkt->req.wLength)); -+#endif -+ ep->dwc_ep.xfer_count += status.b.bcnt; -+ break; -+ default: -+ DWC_DEBUGPL(DBG_PCDV, "Invalid Packet Status (0x%0x)\n", -+ status.b.pktsts); -+ break; -+ } -+ -+ /* Enable the Rx Status Queue Level interrupt */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmask.d32); -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.rxstsqlvl = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ //DWC_DEBUGPL(DBG_PCDV, "EXIT: %s\n", __func__); -+ return 1; -+} -+ -+/** -+ * This function examines the Device IN Token Learning Queue to -+ * determine the EP number of the last IN token received. This -+ * implementation is for the Mass Storage device where there are only -+ * 2 IN EPs (Control-IN and BULK-IN). -+ * -+ * The EP numbers for the first six IN Tokens are in DTKNQR1 and there -+ * are 8 EP Numbers in each of the other possible DTKNQ Registers. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * -+ */ -+static inline int get_ep_of_last_in_token(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_device_global_regs_t *dev_global_regs = -+ core_if->dev_if->dev_global_regs; -+ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; -+ /* Number of Token Queue Registers */ -+ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; -+ dtknq1_data_t dtknqr1; -+ uint32_t in_tkn_epnums[4]; -+ int ndx = 0; -+ int i = 0; -+ volatile uint32_t *addr = &dev_global_regs->dtknqr1; -+ int epnum = 0; -+ -+ //DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); -+ -+ /* Read the DTKNQ Registers */ -+ for (i = 0; i < DTKNQ_REG_CNT; i++) { -+ in_tkn_epnums[i] = DWC_READ_REG32(addr); -+ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, -+ in_tkn_epnums[i]); -+ if (addr == &dev_global_regs->dvbusdis) { -+ addr = &dev_global_regs->dtknqr3_dthrctl; -+ } else { -+ ++addr; -+ } -+ -+ } -+ -+ /* Copy the DTKNQR1 data to the bit field. */ -+ dtknqr1.d32 = in_tkn_epnums[0]; -+ /* Get the EP numbers */ -+ in_tkn_epnums[0] = dtknqr1.b.epnums0_5; -+ ndx = dtknqr1.b.intknwptr - 1; -+ -+ //DWC_DEBUGPL(DBG_PCDV,"ndx=%d\n",ndx); -+ if (ndx == -1) { -+ /** @todo Find a simpler way to calculate the max -+ * queue position.*/ -+ int cnt = TOKEN_Q_DEPTH; -+ if (TOKEN_Q_DEPTH <= 6) { -+ cnt = TOKEN_Q_DEPTH - 1; -+ } else if (TOKEN_Q_DEPTH <= 14) { -+ cnt = TOKEN_Q_DEPTH - 7; -+ } else if (TOKEN_Q_DEPTH <= 22) { -+ cnt = TOKEN_Q_DEPTH - 15; -+ } else { -+ cnt = TOKEN_Q_DEPTH - 23; -+ } -+ epnum = (in_tkn_epnums[DTKNQ_REG_CNT - 1] >> (cnt * 4)) & 0xF; -+ } else { -+ if (ndx <= 5) { -+ epnum = (in_tkn_epnums[0] >> (ndx * 4)) & 0xF; -+ } else if (ndx <= 13) { -+ ndx -= 6; -+ epnum = (in_tkn_epnums[1] >> (ndx * 4)) & 0xF; -+ } else if (ndx <= 21) { -+ ndx -= 14; -+ epnum = (in_tkn_epnums[2] >> (ndx * 4)) & 0xF; -+ } else if (ndx <= 29) { -+ ndx -= 22; -+ epnum = (in_tkn_epnums[3] >> (ndx * 4)) & 0xF; -+ } -+ } -+ //DWC_DEBUGPL(DBG_PCD,"epnum=%d\n",epnum); -+ return epnum; -+} -+ -+/** -+ * This interrupt occurs when the non-periodic Tx FIFO is half-empty. -+ * The active request is checked for the next packet to be loaded into -+ * the non-periodic Tx FIFO. -+ */ -+int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ gnptxsts_data_t txstatus = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ -+ int epnum = 0; -+ dwc_otg_pcd_ep_t *ep = 0; -+ uint32_t len = 0; -+ int dwords; -+ -+ /* Get the epnum from the IN Token Learning Queue. */ -+ epnum = get_ep_of_last_in_token(core_if); -+ ep = get_in_ep(pcd, epnum); -+ -+ DWC_DEBUGPL(DBG_PCD, "NP TxFifo Empty: %d \n", epnum); -+ -+ ep_regs = core_if->dev_if->in_ep_regs[epnum]; -+ -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 GNPTXSTS=0x%08x\n", txstatus.d32); -+ -+ while (txstatus.b.nptxqspcavail > 0 && -+ txstatus.b.nptxfspcavail > dwords && -+ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", txstatus.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxsts)); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.nptxfempty = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This function is called when dedicated Tx FIFO Empty interrupt occurs. -+ * The active request is checked for the next packet to be loaded into -+ * apropriate Tx FIFO. -+ */ -+static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ dtxfsts_data_t txstatus = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep = 0; -+ uint32_t len = 0; -+ int dwords; -+ -+ ep = get_in_ep(pcd, epnum); -+ -+ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); -+ -+ ep_regs = core_if->dev_if->in_ep_regs[epnum]; -+ -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); -+ -+ while (txstatus.b.txfspcavail > dwords && -+ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len && -+ ep->dwc_ep.xfer_len != 0) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); -+ -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, -+ txstatus.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); -+ -+ return 1; -+} -+ -+/** -+ * This function is called when the Device is disconnected. It stops -+ * any active requests and informs the Gadget driver of the -+ * disconnect. -+ */ -+void dwc_otg_pcd_stop(dwc_otg_pcd_t * pcd) -+{ -+ int i, num_in_eps, num_out_eps; -+ dwc_otg_pcd_ep_t *ep; -+ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_SPINLOCK(pcd->lock); -+ -+ num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; -+ num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s() \n", __func__); -+ /* don't disconnect drivers more than once */ -+ if (pcd->ep0state == EP0_DISCONNECT) { -+ DWC_DEBUGPL(DBG_ANY, "%s() Already Disconnected\n", __func__); -+ DWC_SPINUNLOCK(pcd->lock); -+ return; -+ } -+ pcd->ep0state = EP0_DISCONNECT; -+ -+ /* Reset the OTG state. */ -+ dwc_otg_pcd_update_otg(pcd, 1); -+ -+ /* Disable the NP Tx Fifo Empty Interrupt. */ -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Flush the FIFOs */ -+ /**@todo NGS Flush Periodic FIFOs */ -+ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), 0x10); -+ dwc_otg_flush_rx_fifo(GET_CORE_IF(pcd)); -+ -+ /* prevent new request submissions, kill any outstanding requests */ -+ ep = &pcd->ep0; -+ dwc_otg_request_nuke(ep); -+ /* prevent new request submissions, kill any outstanding requests */ -+ for (i = 0; i < num_in_eps; i++) { -+ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[i]; -+ dwc_otg_request_nuke(ep); -+ } -+ /* prevent new request submissions, kill any outstanding requests */ -+ for (i = 0; i < num_out_eps; i++) { -+ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[i]; -+ dwc_otg_request_nuke(ep); -+ } -+ -+ /* report disconnect; the driver is already quiesced */ -+ if (pcd->fops->disconnect) { -+ DWC_SPINUNLOCK(pcd->lock); -+ pcd->fops->disconnect(pcd); -+ DWC_SPINLOCK(pcd->lock); -+ } -+ DWC_SPINUNLOCK(pcd->lock); -+} -+ -+/** -+ * This interrupt indicates that ... -+ */ -+int32_t dwc_otg_pcd_handle_i2c_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "i2cintr"); -+ intr_mask.b.i2cintr = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.i2cintr = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that ... -+ */ -+int32_t dwc_otg_pcd_handle_early_suspend_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+#if defined(VERBOSE) -+ DWC_PRINTF("Early Suspend Detected\n"); -+#endif -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.erlysuspend = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This function configures EPO to receive SETUP packets. -+ * -+ * @todo NGS: Update the comments from the HW FS. -+ * -+ * -# Program the following fields in the endpoint specific registers -+ * for Control OUT EP 0, in order to receive a setup packet -+ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back -+ * setup packets) -+ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back -+ * to back setup packets) -+ * - In DMA mode, DOEPDMA0 Register with a memory address to -+ * store any setup packets received -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param pcd Programming view of the PCD. -+ */ -+static inline void ep0_out_start(dwc_otg_core_if_t * core_if, -+ dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ depctl_data_t doepctl = {.d32 = 0 }; -+ -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "%s() doepctl0=%0x\n", __func__, -+ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); -+#endif -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); -+ if (doepctl.b.epena) { -+ return; -+ } -+ } -+ -+ doeptsize0.b.supcnt = 3; -+ doeptsize0.b.pktcnt = 1; -+ doeptsize0.b.xfersize = 8 * 3; -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ /** put here as for Hermes mode deptisz register should not be written */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, -+ doeptsize0.d32); -+ -+ /** @todo dma needs to handle multiple setup packets (up to 3) */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, -+ pcd->setup_pkt_dma_handle); -+ } else { -+ dev_if->setup_desc_index = -+ (dev_if->setup_desc_index + 1) & 1; -+ dma_desc = -+ dev_if->setup_desc_addr[dev_if->setup_desc_index]; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ dma_desc->status.b.sr = 0; -+ dma_desc->status.b.mtrf = 0; -+ } -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.bytes = pcd->ep0.dwc_ep.maxpacket; -+ dma_desc->buf = pcd->setup_pkt_dma_handle; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DOEPDMA0 Register write */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, -+ dev_if->dma_setup_desc_addr -+ [dev_if->setup_desc_index]); -+ } -+ -+ } else { -+ /** put here as for Hermes mode deptisz register should not be written */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, -+ doeptsize0.d32); -+ } -+ -+ /** DOEPCTL0 Register write cnak will be set after setup interrupt */ -+ doepctl.d32 = 0; -+ doepctl.b.epena = 1; -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ doepctl.b.cnak = 1; -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); -+ } else { -+ DWC_MODIFY_REG32(&dev_if->out_ep_regs[0]->doepctl, 0, doepctl.d32); -+ } -+ -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); -+ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); -+#endif -+} -+ -+/** -+ * This interrupt occurs when a USB Reset is detected. When the USB -+ * Reset Interrupt occurs the device state is set to DEFAULT and the -+ * EP0 state is set to IDLE. -+ * -# Set the NAK bit for all OUT endpoints (DOEPCTLn.SNAK = 1) -+ * -# Unmask the following interrupt bits -+ * - DAINTMSK.INEP0 = 1 (Control 0 IN endpoint) -+ * - DAINTMSK.OUTEP0 = 1 (Control 0 OUT endpoint) -+ * - DOEPMSK.SETUP = 1 -+ * - DOEPMSK.XferCompl = 1 -+ * - DIEPMSK.XferCompl = 1 -+ * - DIEPMSK.TimeOut = 1 -+ * -# Program the following fields in the endpoint specific registers -+ * for Control OUT EP 0, in order to receive a setup packet -+ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back -+ * setup packets) -+ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back -+ * to back setup packets) -+ * - In DMA mode, DOEPDMA0 Register with a memory address to -+ * store any setup packets received -+ * At this point, all the required initialization, except for enabling -+ * the control 0 OUT endpoint is done, for receiving SETUP packets. -+ */ -+int32_t dwc_otg_pcd_handle_usb_reset_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ depctl_data_t doepctl = {.d32 = 0 }; -+ depctl_data_t diepctl = {.d32 = 0 }; -+ daint_data_t daintmsk = {.d32 = 0 }; -+ doepmsk_data_t doepmsk = {.d32 = 0 }; -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ grstctl_t resetctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ int i = 0; -+ gintsts_data_t gintsts; -+ pcgcctl_data_t power = {.d32 = 0 }; -+ -+ power.d32 = DWC_READ_REG32(core_if->pcgcctl); -+ if (power.b.stoppclk) { -+ power.d32 = 0; -+ power.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); -+ -+ power.b.pwrclmp = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); -+ -+ power.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); -+ } -+ -+ core_if->lx_state = DWC_OTG_L0; -+ -+ DWC_PRINTF("USB RESET\n"); -+#ifdef DWC_EN_ISOC -+ for (i = 1; i < 16; ++i) { -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ ep = get_in_ep(pcd, i); -+ if (ep != 0) { -+ dwc_ep = &ep->dwc_ep; -+ dwc_ep->next_frame = 0xffffffff; -+ } -+ } -+#endif /* DWC_EN_ISOC */ -+ -+ /* reset the HNP settings */ -+ dwc_otg_pcd_update_otg(pcd, 1); -+ -+ /* Clear the Remote Wakeup Signalling */ -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); -+ -+ /* Set NAK for all OUT EPs */ -+ doepctl.b.snak = 1; -+ for (i = 0; i <= dev_if->num_out_eps; i++) { -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); -+ } -+ -+ /* Flush the NP Tx FIFO */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10); -+ /* Flush the Learning Queue */ -+ resetctl.b.intknqflsh = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { -+ core_if->start_predict = 0; -+ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { -+ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active -+ } -+ core_if->nextep_seq[0] = 0; -+ core_if->first_in_nextep_seq = 0; -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); -+ diepctl.b.nextep = 0; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); -+ -+ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt = 2; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); -+ } -+ } -+ -+ if (core_if->multiproc_int_enable) { -+ daintmsk.b.inep0 = 1; -+ daintmsk.b.outep0 = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, -+ daintmsk.d32); -+ -+ doepmsk.b.setup = 1; -+ doepmsk.b.xfercompl = 1; -+ doepmsk.b.ahberr = 1; -+ doepmsk.b.epdisabled = 1; -+ -+ if ((core_if->dma_desc_enable) || -+ (core_if->dma_enable -+ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { -+ doepmsk.b.stsphsercvd = 1; -+ } -+ if (core_if->dma_desc_enable) -+ doepmsk.b.bna = 1; -+/* -+ doepmsk.b.babble = 1; -+ doepmsk.b.nyet = 1; -+ -+ if (core_if->dma_enable) { -+ doepmsk.b.nak = 1; -+ } -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepeachintmsk[0], -+ doepmsk.d32); -+ -+ diepmsk.b.xfercompl = 1; -+ diepmsk.b.timeout = 1; -+ diepmsk.b.epdisabled = 1; -+ diepmsk.b.ahberr = 1; -+ diepmsk.b.intknepmis = 1; -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) -+ diepmsk.b.intknepmis = 0; -+ -+/* if (core_if->dma_desc_enable) { -+ diepmsk.b.bna = 1; -+ } -+*/ -+/* -+ if (core_if->dma_enable) { -+ diepmsk.b.nak = 1; -+ } -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepeachintmsk[0], -+ diepmsk.d32); -+ } else { -+ daintmsk.b.inep0 = 1; -+ daintmsk.b.outep0 = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, -+ daintmsk.d32); -+ -+ doepmsk.b.setup = 1; -+ doepmsk.b.xfercompl = 1; -+ doepmsk.b.ahberr = 1; -+ doepmsk.b.epdisabled = 1; -+ -+ if ((core_if->dma_desc_enable) || -+ (core_if->dma_enable -+ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { -+ doepmsk.b.stsphsercvd = 1; -+ } -+ if (core_if->dma_desc_enable) -+ doepmsk.b.bna = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, doepmsk.d32); -+ -+ diepmsk.b.xfercompl = 1; -+ diepmsk.b.timeout = 1; -+ diepmsk.b.epdisabled = 1; -+ diepmsk.b.ahberr = 1; -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) -+ diepmsk.b.intknepmis = 0; -+/* -+ if (core_if->dma_desc_enable) { -+ diepmsk.b.bna = 1; -+ } -+*/ -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, diepmsk.d32); -+ } -+ -+ /* Reset Device Address */ -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.devaddr = 0; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ /* setup EP0 to receive SETUP packets */ -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) -+ ep0_out_start(core_if, pcd); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.usbreset = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * Get the device speed from the device status register and convert it -+ * to USB speed constant. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static int get_device_speed(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ int speed = 0; -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ switch (dsts.b.enumspd) { -+ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: -+ speed = USB_SPEED_HIGH; -+ break; -+ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: -+ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: -+ speed = USB_SPEED_FULL; -+ break; -+ -+ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: -+ speed = USB_SPEED_LOW; -+ break; -+ } -+ -+ return speed; -+} -+ -+/** -+ * Read the device status register and set the device speed in the -+ * data structure. -+ * Set up EP0 to receive SETUP packets by calling dwc_ep0_activate. -+ */ -+int32_t dwc_otg_pcd_handle_enum_done_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ gintsts_data_t gintsts; -+ gusbcfg_data_t gusbcfg; -+ dwc_otg_core_global_regs_t *global_regs = -+ GET_CORE_IF(pcd)->core_global_regs; -+ uint8_t utmi16b, utmi8b; -+ int speed; -+ DWC_DEBUGPL(DBG_PCD, "SPEED ENUM\n"); -+ -+ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_2_60a) { -+ utmi16b = 6; //vahrama old value was 6; -+ utmi8b = 9; -+ } else { -+ utmi16b = 4; -+ utmi8b = 8; -+ } -+ dwc_otg_ep0_activate(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) { -+ ep0_out_start(GET_CORE_IF(pcd), pcd); -+ } -+ -+#ifdef DEBUG_EP0 -+ print_ep0_state(pcd); -+#endif -+ -+ if (pcd->ep0state == EP0_DISCONNECT) { -+ pcd->ep0state = EP0_IDLE; -+ } else if (pcd->ep0state == EP0_STALL) { -+ pcd->ep0state = EP0_IDLE; -+ } -+ -+ pcd->ep0state = EP0_IDLE; -+ -+ ep0->stopped = 0; -+ -+ speed = get_device_speed(GET_CORE_IF(pcd)); -+ pcd->fops->connect(pcd, speed); -+ -+ /* Set USB turnaround time based on device speed and PHY interface. */ -+ gusbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ if (speed == USB_SPEED_HIGH) { -+ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == -+ DWC_HWCFG2_HS_PHY_TYPE_ULPI) { -+ /* ULPI interface */ -+ gusbcfg.b.usbtrdtim = 9; -+ } -+ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == -+ DWC_HWCFG2_HS_PHY_TYPE_UTMI) { -+ /* UTMI+ interface */ -+ if (GET_CORE_IF(pcd)->hwcfg4.b.utmi_phy_data_width == 0) { -+ gusbcfg.b.usbtrdtim = utmi8b; -+ } else if (GET_CORE_IF(pcd)->hwcfg4. -+ b.utmi_phy_data_width == 1) { -+ gusbcfg.b.usbtrdtim = utmi16b; -+ } else if (GET_CORE_IF(pcd)-> -+ core_params->phy_utmi_width == 8) { -+ gusbcfg.b.usbtrdtim = utmi8b; -+ } else { -+ gusbcfg.b.usbtrdtim = utmi16b; -+ } -+ } -+ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == -+ DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI) { -+ /* UTMI+ OR ULPI interface */ -+ if (gusbcfg.b.ulpi_utmi_sel == 1) { -+ /* ULPI interface */ -+ gusbcfg.b.usbtrdtim = 9; -+ } else { -+ /* UTMI+ interface */ -+ if (GET_CORE_IF(pcd)-> -+ core_params->phy_utmi_width == 16) { -+ gusbcfg.b.usbtrdtim = utmi16b; -+ } else { -+ gusbcfg.b.usbtrdtim = utmi8b; -+ } -+ } -+ } -+ } else { -+ /* Full or low speed */ -+ gusbcfg.b.usbtrdtim = 9; -+ } -+ DWC_WRITE_REG32(&global_regs->gusbcfg, gusbcfg.d32); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.enumdone = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that the ISO OUT Packet was dropped due to -+ * Rx FIFO full or Rx Status Queue Full. If this interrupt occurs -+ * read all the data from the Rx FIFO. -+ */ -+int32_t dwc_otg_pcd_handle_isoc_out_packet_dropped_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ -+ DWC_WARN("INTERRUPT Handler not implemented for %s\n", -+ "ISOC Out Dropped"); -+ -+ intr_mask.b.isooutdrop = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.isooutdrop = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates the end of the portion of the micro-frame -+ * for periodic transactions. If there is a periodic transaction for -+ * the next frame, load the packets into the EP periodic Tx FIFO. -+ */ -+int32_t dwc_otg_pcd_handle_end_periodic_frame_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "EOP"); -+ -+ intr_mask.b.eopframe = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.eopframe = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that EP of the packet on the top of the -+ * non-periodic Tx FIFO does not match EP of the IN Token received. -+ * -+ * The "Device IN Token Queue" Registers are read to determine the -+ * order the IN Tokens have been received. The non-periodic Tx FIFO -+ * is flushed, so it can be reloaded in the order seen in the IN Token -+ * Queue. -+ */ -+int32_t dwc_otg_pcd_handle_ep_mismatch_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dctl_data_t dctl; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) { -+ core_if->start_predict = 1; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); -+ -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (!gintsts.b.ginnakeff) { -+ /* Disable EP Mismatch interrupt */ -+ intr_mask.d32 = 0; -+ intr_mask.b.epmismatch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32, 0); -+ /* Enable the Global IN NAK Effective Interrupt */ -+ intr_mask.d32 = 0; -+ intr_mask.b.ginnakeff = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); -+ /* Set the global non-periodic IN NAK handshake */ -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ dctl.b.sgnpinnak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+ } else { -+ DWC_PRINTF("gintsts.b.ginnakeff = 1! dctl.b.sgnpinnak not set\n"); -+ } -+ /* Disabling of all EP's will be done in dwc_otg_pcd_handle_in_nak_effective() -+ * handler after Global IN NAK Effective interrupt will be asserted */ -+ } -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.epmismatch = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt is valid only in DMA mode. This interrupt indicates that the -+ * core has stopped fetching data for IN endpoints due to the unavailability of -+ * TxFIFO space or Request Queue space. This interrupt is used by the -+ * application for an endpoint mismatch algorithm. -+ * -+ * @param pcd The PCD -+ */ -+int32_t dwc_otg_pcd_handle_ep_fetsusp_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk_data; -+ dctl_data_t dctl; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); -+ -+ /* Clear the global non-periodic IN NAK handshake */ -+ dctl.d32 = 0; -+ dctl.b.cgnpinnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ -+ /* Mask GINTSTS.FETSUSP interrupt */ -+ gintmsk_data.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ gintmsk_data.b.fetsusp = 0; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_data.d32); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.fetsusp = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+/** -+ * This funcion stalls EP0. -+ */ -+static inline void ep0_do_stall(dwc_otg_pcd_t * pcd, const int err_val) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ usb_device_request_t *ctrl = &pcd->setup_pkt->req; -+ DWC_WARN("req %02x.%02x protocol STALL; err %d\n", -+ ctrl->bmRequestType, ctrl->bRequest, err_val); -+ -+ ep0->dwc_ep.is_in = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ pcd->ep0.stopped = 1; -+ pcd->ep0state = EP0_IDLE; -+ ep0_out_start(GET_CORE_IF(pcd), pcd); -+} -+ -+/** -+ * This functions delegates the setup command to the gadget driver. -+ */ -+static inline void do_gadget_setup(dwc_otg_pcd_t * pcd, -+ usb_device_request_t * ctrl) -+{ -+ int ret = 0; -+ DWC_SPINUNLOCK(pcd->lock); -+ ret = pcd->fops->setup(pcd, (uint8_t *) ctrl); -+ DWC_SPINLOCK(pcd->lock); -+ if (ret < 0) { -+ ep0_do_stall(pcd, ret); -+ } -+ -+ /** @todo This is a g_file_storage gadget driver specific -+ * workaround: a DELAYED_STATUS result from the fsg_setup -+ * routine will result in the gadget queueing a EP0 IN status -+ * phase for a two-stage control transfer. Exactly the same as -+ * a SET_CONFIGURATION/SET_INTERFACE except that this is a class -+ * specific request. Need a generic way to know when the gadget -+ * driver will queue the status phase. Can we assume when we -+ * call the gadget driver setup() function that it will always -+ * queue and require the following flag? Need to look into -+ * this. -+ */ -+ -+ if (ret == 256 + 999) { -+ pcd->request_config = 1; -+ } -+} -+ -+#ifdef DWC_UTE_CFI -+/** -+ * This functions delegates the CFI setup commands to the gadget driver. -+ * This function will return a negative value to indicate a failure. -+ */ -+static inline int cfi_gadget_setup(dwc_otg_pcd_t * pcd, -+ struct cfi_usb_ctrlrequest *ctrl_req) -+{ -+ int ret = 0; -+ -+ if (pcd->fops && pcd->fops->cfi_setup) { -+ DWC_SPINUNLOCK(pcd->lock); -+ ret = pcd->fops->cfi_setup(pcd, ctrl_req); -+ DWC_SPINLOCK(pcd->lock); -+ if (ret < 0) { -+ ep0_do_stall(pcd, ret); -+ return ret; -+ } -+ } -+ -+ return ret; -+} -+#endif -+ -+/** -+ * This function starts the Zero-Length Packet for the IN status phase -+ * of a 2 stage control transfer. -+ */ -+static inline void do_setup_in_status_phase(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ if (pcd->ep0state == EP0_STALL) { -+ return; -+ } -+ -+ pcd->ep0state = EP0_IN_STATUS_PHASE; -+ -+ /* Prepare for more SETUP Packets */ -+ DWC_DEBUGPL(DBG_PCD, "EP0 IN ZLP\n"); -+ if ((GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) -+ && (pcd->core_if->dma_desc_enable) -+ && (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len)) { -+ DWC_DEBUGPL(DBG_PCDV, -+ "Data terminated wait next packet in out_desc_addr\n"); -+ pcd->backup_buf = phys_to_virt(ep0->dwc_ep.dma_addr); -+ pcd->data_terminated = 1; -+ } -+ ep0->dwc_ep.xfer_len = 0; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.is_in = 1; -+ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ -+ /* Prepare for more SETUP Packets */ -+ //ep0_out_start(GET_CORE_IF(pcd), pcd); -+} -+ -+/** -+ * This function starts the Zero-Length Packet for the OUT status phase -+ * of a 2 stage control transfer. -+ */ -+static inline void do_setup_out_status_phase(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ if (pcd->ep0state == EP0_STALL) { -+ DWC_DEBUGPL(DBG_PCD, "EP0 STALLED\n"); -+ return; -+ } -+ pcd->ep0state = EP0_OUT_STATUS_PHASE; -+ -+ DWC_DEBUGPL(DBG_PCD, "EP0 OUT ZLP\n"); -+ ep0->dwc_ep.xfer_len = 0; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.is_in = 0; -+ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ -+ /* Prepare for more SETUP Packets */ -+ if (GET_CORE_IF(pcd)->dma_enable == 0) { -+ ep0_out_start(GET_CORE_IF(pcd), pcd); -+ } -+} -+ -+/** -+ * Clear the EP halt (STALL) and if pending requests start the -+ * transfer. -+ */ -+static inline void pcd_clear_halt(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) -+{ -+ if (ep->dwc_ep.stall_clear_flag == 0) -+ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ -+ /* Reactive the EP */ -+ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); -+ if (ep->stopped) { -+ ep->stopped = 0; -+ /* If there is a request in the EP queue start it */ -+ -+ /** @todo FIXME: this causes an EP mismatch in DMA mode. -+ * epmismatch not yet implemented. */ -+ -+ /* -+ * Above fixme is solved by implmenting a tasklet to call the -+ * start_next_request(), outside of interrupt context at some -+ * time after the current time, after a clear-halt setup packet. -+ * Still need to implement ep mismatch in the future if a gadget -+ * ever uses more than one endpoint at once -+ */ -+ ep->queue_sof = 1; -+ DWC_TASK_SCHEDULE(pcd->start_xfer_tasklet); -+ } -+ /* Start Control Status Phase */ -+ do_setup_in_status_phase(pcd); -+} -+ -+/** -+ * This function is called when the SET_FEATURE TEST_MODE Setup packet -+ * is sent from the host. The Device Control register is written with -+ * the Test Mode bits set to the specified Test Mode. This is done as -+ * a tasklet so that the "Status" phase of the control transfer -+ * completes before transmitting the TEST packets. -+ * -+ * @todo This has not been tested since the tasklet struct was put -+ * into the PCD struct! -+ * -+ */ -+void do_test_mode(void *data) -+{ -+ dctl_data_t dctl; -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ int test_mode = pcd->test_mode; -+ -+// DWC_WARN("%s() has not been tested since being rewritten!\n", __func__); -+ -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ switch (test_mode) { -+ case 1: // TEST_J -+ dctl.b.tstctl = 1; -+ break; -+ -+ case 2: // TEST_K -+ dctl.b.tstctl = 2; -+ break; -+ -+ case 3: // TEST_SE0_NAK -+ dctl.b.tstctl = 3; -+ break; -+ -+ case 4: // TEST_PACKET -+ dctl.b.tstctl = 4; -+ break; -+ -+ case 5: // TEST_FORCE_ENABLE -+ dctl.b.tstctl = 5; -+ break; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+} -+ -+/** -+ * This function process the GET_STATUS Setup Commands. -+ */ -+static inline void do_get_status(dwc_otg_pcd_t * pcd) -+{ -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ uint16_t *status = pcd->status_buf; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, -+ "GET_STATUS %02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+#endif -+ -+ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { -+ case UT_DEVICE: -+ if(UGETW(ctrl.wIndex) == 0xF000) { /* OTG Status selector */ -+ DWC_PRINTF("wIndex - %d\n", UGETW(ctrl.wIndex)); -+ DWC_PRINTF("OTG VERSION - %d\n", core_if->otg_ver); -+ DWC_PRINTF("OTG CAP - %d, %d\n", -+ core_if->core_params->otg_cap, -+ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); -+ if (core_if->otg_ver == 1 -+ && core_if->core_params->otg_cap == -+ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ uint8_t *otgsts = (uint8_t*)pcd->status_buf; -+ *otgsts = (core_if->otg_sts & 0x1); -+ pcd->ep0_pending = 1; -+ ep0->dwc_ep.start_xfer_buff = -+ (uint8_t *) otgsts; -+ ep0->dwc_ep.xfer_buff = (uint8_t *) otgsts; -+ ep0->dwc_ep.dma_addr = -+ pcd->status_buf_dma_handle; -+ ep0->dwc_ep.xfer_len = 1; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ return; -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ } else { -+ *status = 0x1; /* Self powered */ -+ *status |= pcd->remote_wakeup_enable << 1; -+ break; -+ } -+ case UT_INTERFACE: -+ *status = 0; -+ break; -+ -+ case UT_ENDPOINT: -+ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); -+ if (ep == 0 || UGETW(ctrl.wLength) > 2) { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ /** @todo check for EP stall */ -+ *status = ep->stopped; -+ break; -+ } -+ pcd->ep0_pending = 1; -+ ep0->dwc_ep.start_xfer_buff = (uint8_t *) status; -+ ep0->dwc_ep.xfer_buff = (uint8_t *) status; -+ ep0->dwc_ep.dma_addr = pcd->status_buf_dma_handle; -+ ep0->dwc_ep.xfer_len = 2; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); -+} -+ -+/** -+ * This function process the SET_FEATURE Setup Commands. -+ */ -+static inline void do_set_feature(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep = 0; -+ int32_t otg_cap_param = core_if->core_params->otg_cap; -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_PCD, "SET_FEATURE:%02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+ DWC_DEBUGPL(DBG_PCD, "otg_cap=%d\n", otg_cap_param); -+ -+ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { -+ case UT_DEVICE: -+ switch (UGETW(ctrl.wValue)) { -+ case UF_DEVICE_REMOTE_WAKEUP: -+ pcd->remote_wakeup_enable = 1; -+ break; -+ -+ case UF_TEST_MODE: -+ /* Setup the Test Mode tasklet to do the Test -+ * Packet generation after the SETUP Status -+ * phase has completed. */ -+ -+ /** @todo This has not been tested since the -+ * tasklet struct was put into the PCD -+ * struct! */ -+ pcd->test_mode = UGETW(ctrl.wIndex) >> 8; -+ DWC_TASK_SCHEDULE(pcd->test_mode_tasklet); -+ break; -+ -+ case UF_DEVICE_B_HNP_ENABLE: -+ DWC_DEBUGPL(DBG_PCDV, -+ "SET_FEATURE: USB_DEVICE_B_HNP_ENABLE\n"); -+ -+ /* dev may initiate HNP */ -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ pcd->b_hnp_enable = 1; -+ dwc_otg_pcd_update_otg(pcd, 0); -+ DWC_DEBUGPL(DBG_PCD, "Request B HNP\n"); -+ /**@todo Is the gotgctl.devhnpen cleared -+ * by a USB Reset? */ -+ gotgctl.b.devhnpen = 1; -+ gotgctl.b.hnpreq = 1; -+ DWC_WRITE_REG32(&global_regs->gotgctl, -+ gotgctl.d32); -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ -+ case UF_DEVICE_A_HNP_SUPPORT: -+ /* RH port supports HNP */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "SET_FEATURE: USB_DEVICE_A_HNP_SUPPORT\n"); -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ pcd->a_hnp_support = 1; -+ dwc_otg_pcd_update_otg(pcd, 0); -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ -+ case UF_DEVICE_A_ALT_HNP_SUPPORT: -+ /* other RH port does */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "SET_FEATURE: USB_DEVICE_A_ALT_HNP_SUPPORT\n"); -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ pcd->a_alt_hnp_support = 1; -+ dwc_otg_pcd_update_otg(pcd, 0); -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ -+ default: -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ -+ } -+ do_setup_in_status_phase(pcd); -+ break; -+ -+ case UT_INTERFACE: -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ -+ case UT_ENDPOINT: -+ if (UGETW(ctrl.wValue) == UF_ENDPOINT_HALT) { -+ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); -+ if (ep == 0) { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(core_if, &ep->dwc_ep); -+ } -+ do_setup_in_status_phase(pcd); -+ break; -+ } -+} -+ -+/** -+ * This function process the CLEAR_FEATURE Setup Commands. -+ */ -+static inline void do_clear_feature(dwc_otg_pcd_t * pcd) -+{ -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep = 0; -+ -+ DWC_DEBUGPL(DBG_PCD, -+ "CLEAR_FEATURE:%02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+ -+ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { -+ case UT_DEVICE: -+ switch (UGETW(ctrl.wValue)) { -+ case UF_DEVICE_REMOTE_WAKEUP: -+ pcd->remote_wakeup_enable = 0; -+ break; -+ -+ case UF_TEST_MODE: -+ /** @todo Add CLEAR_FEATURE for TEST modes. */ -+ break; -+ -+ default: -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ do_setup_in_status_phase(pcd); -+ break; -+ -+ case UT_ENDPOINT: -+ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); -+ if (ep == 0) { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ -+ pcd_clear_halt(pcd, ep); -+ -+ break; -+ } -+} -+ -+/** -+ * This function process the SET_ADDRESS Setup Commands. -+ */ -+static inline void do_set_address(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ -+ if (ctrl.bmRequestType == UT_DEVICE) { -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ -+#ifdef DEBUG_EP0 -+// DWC_DEBUGPL(DBG_PCDV, "SET_ADDRESS:%d\n", ctrl.wValue); -+#endif -+ dcfg.b.devaddr = UGETW(ctrl.wValue); -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dcfg, 0, dcfg.d32); -+ do_setup_in_status_phase(pcd); -+ } -+} -+ -+/** -+ * This function processes SETUP commands. In Linux, the USB Command -+ * processing is done in two places - the first being the PCD and the -+ * second in the Gadget Driver (for example, the File-Backed Storage -+ * Gadget Driver). -+ * -+ *
Parameter NameMeaning
otg_capSpecifies the OTG capabilities. The driver will automatically detect the -+ value for this parameter if none is specified. -+ - 0: HNP and SRP capable (default, if available) -+ - 1: SRP Only capable -+ - 2: No HNP/SRP capable -+
dma_enableSpecifies whether to use slave or DMA mode for accessing the data FIFOs. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Slave -+ - 1: DMA (default, if available) -+
dma_burst_sizeThe DMA Burst size (applicable only for External DMA Mode). -+ - Values: 1, 4, 8 16, 32, 64, 128, 256 (default 32) -+
speedSpecifies the maximum speed of operation in host and device mode. The -+ actual speed depends on the speed of the attached device and the value of -+ phy_type. -+ - 0: High Speed (default) -+ - 1: Full Speed -+
host_support_fs_ls_low_powerSpecifies whether low power mode is supported when attached to a Full -+ Speed or Low Speed device in host mode. -+ - 0: Don't support low power mode (default) -+ - 1: Support low power mode -+
host_ls_low_power_phy_clkSpecifies the PHY clock rate in low power mode when connected to a Low -+ Speed device in host mode. This parameter is applicable only if -+ HOST_SUPPORT_FS_LS_LOW_POWER is enabled. -+ - 0: 48 MHz (default) -+ - 1: 6 MHz -+
enable_dynamic_fifo Specifies whether FIFOs may be resized by the driver software. -+ - 0: Use cC FIFO size parameters -+ - 1: Allow dynamic FIFO sizing (default) -+
data_fifo_sizeTotal number of 4-byte words in the data FIFO memory. This memory -+ includes the Rx FIFO, non-periodic Tx FIFO, and periodic Tx FIFOs. -+ - Values: 32 to 32768 (default 8192) -+ -+ Note: The total FIFO memory depth in the FPGA configuration is 8192. -+
dev_rx_fifo_sizeNumber of 4-byte words in the Rx FIFO in device mode when dynamic -+ FIFO sizing is enabled. -+ - Values: 16 to 32768 (default 1064) -+
dev_nperio_tx_fifo_sizeNumber of 4-byte words in the non-periodic Tx FIFO in device mode when -+ dynamic FIFO sizing is enabled. -+ - Values: 16 to 32768 (default 1024) -+
dev_perio_tx_fifo_size_n (n = 1 to 15)Number of 4-byte words in each of the periodic Tx FIFOs in device mode -+ when dynamic FIFO sizing is enabled. -+ - Values: 4 to 768 (default 256) -+
host_rx_fifo_sizeNumber of 4-byte words in the Rx FIFO in host mode when dynamic FIFO -+ sizing is enabled. -+ - Values: 16 to 32768 (default 1024) -+
host_nperio_tx_fifo_sizeNumber of 4-byte words in the non-periodic Tx FIFO in host mode when -+ dynamic FIFO sizing is enabled in the core. -+ - Values: 16 to 32768 (default 1024) -+
host_perio_tx_fifo_sizeNumber of 4-byte words in the host periodic Tx FIFO when dynamic FIFO -+ sizing is enabled. -+ - Values: 16 to 32768 (default 1024) -+
max_transfer_sizeThe maximum transfer size supported in bytes. -+ - Values: 2047 to 65,535 (default 65,535) -+
max_packet_countThe maximum number of packets in a transfer. -+ - Values: 15 to 511 (default 511) -+
host_channelsThe number of host channel registers to use. -+ - Values: 1 to 16 (default 12) -+ -+ Note: The FPGA configuration supports a maximum of 12 host channels. -+
dev_endpointsThe number of endpoints in addition to EP0 available for device mode -+ operations. -+ - Values: 1 to 15 (default 6 IN and OUT) -+ -+ Note: The FPGA configuration supports a maximum of 6 IN and OUT endpoints in -+ addition to EP0. -+
phy_typeSpecifies the type of PHY interface to use. By default, the driver will -+ automatically detect the phy_type. -+ - 0: Full Speed -+ - 1: UTMI+ (default, if available) -+ - 2: ULPI -+
phy_utmi_widthSpecifies the UTMI+ Data Width. This parameter is applicable for a -+ phy_type of UTMI+. Also, this parameter is applicable only if the -+ OTG_HSPHY_WIDTH cC parameter was set to "8 and 16 bits", meaning that the -+ core has been configured to work at either data path width. -+ - Values: 8 or 16 bits (default 16) -+
phy_ulpi_ddrSpecifies whether the ULPI operates at double or single data rate. This -+ parameter is only applicable if phy_type is ULPI. -+ - 0: single data rate ULPI interface with 8 bit wide data bus (default) -+ - 1: double data rate ULPI interface with 4 bit wide data bus -+
i2c_enableSpecifies whether to use the I2C interface for full speed PHY. This -+ parameter is only applicable if PHY_TYPE is FS. -+ - 0: Disabled (default) -+ - 1: Enabled -+
ulpi_fs_lsSpecifies whether to use ULPI FS/LS mode only. -+ - 0: Disabled (default) -+ - 1: Enabled -+
ts_dlineSpecifies whether term select D-Line pulsing for all PHYs is enabled. -+ - 0: Disabled (default) -+ - 1: Enabled -+
en_multiple_tx_fifoSpecifies whether dedicatedto tx fifos are enabled for non periodic IN EPs. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Disabled -+ - 1: Enabled (default, if available) -+
dev_tx_fifo_size_n (n = 1 to 15)Number of 4-byte words in each of the Tx FIFOs in device mode -+ when dynamic FIFO sizing is enabled. -+ - Values: 4 to 768 (default 256) -+
tx_thr_lengthTransmit Threshold length in 32 bit double words -+ - Values: 8 to 128 (default 64) -+
rx_thr_lengthReceive Threshold length in 32 bit double words -+ - Values: 8 to 128 (default 64) -+
thr_ctlSpecifies whether to enable Thresholding for Device mode. Bits 0, 1, 2 of -+ this parmater specifies if thresholding is enabled for non-Iso Tx, Iso Tx and -+ Rx transfers accordingly. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - Values: 0 to 7 (default 0) -+ Bit values indicate: -+ - 0: Thresholding disabled -+ - 1: Thresholding enabled -+
dma_desc_enableSpecifies whether to enable Descriptor DMA mode. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Descriptor DMA disabled -+ - 1: Descriptor DMA (default, if available) -+
mpi_enableSpecifies whether to enable MPI enhancement mode. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: MPI disabled (default) -+ - 1: MPI enable -+
pti_enableSpecifies whether to enable PTI enhancement support. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: PTI disabled (default) -+ - 1: PTI enable -+
lpm_enableSpecifies whether to enable LPM support. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: LPM disabled -+ - 1: LPM enable (default, if available) -+
ic_usb_capSpecifies whether to enable IC_USB capability. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: IC_USB disabled (default, if available) -+ - 1: IC_USB enable -+
ahb_thr_ratioSpecifies AHB Threshold ratio. -+ - Values: 0 to 3 (default 0) -+
power_downSpecifies Power Down(Hibernation) Mode. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Power Down disabled (default) -+ - 2: Power Down enabled -+
reload_ctlSpecifies whether dynamic reloading of the HFIR register is allowed during -+ run time. The driver will automatically detect the value for this parameter if -+ none is specified. In case the HFIR value is reloaded when HFIR.RldCtrl == 1'b0 -+ the core might misbehave. -+ - 0: Reload Control disabled (default) -+ - 1: Reload Control enabled -+
dev_out_nakSpecifies whether Device OUT NAK enhancement enabled or no. -+ The driver will automatically detect the value for this parameter if -+ none is specified. This parameter is valid only when OTG_EN_DESC_DMA == 1b1. -+ - 0: The core does not set NAK after Bulk OUT transfer complete (default) -+ - 1: The core sets NAK after Bulk OUT transfer complete -+
cont_on_bnaSpecifies whether Enable Continue on BNA enabled or no. -+ After receiving BNA interrupt the core disables the endpoint,when the -+ endpoint is re-enabled by the application the -+ - 0: Core starts processing from the DOEPDMA descriptor (default) -+ - 1: Core starts processing from the descriptor which received the BNA. -+ This parameter is valid only when OTG_EN_DESC_DMA == 1b1. -+
ahb_singleThis bit when programmed supports SINGLE transfers for remainder data -+ in a transfer for DMA mode of operation. -+ - 0: The remainder data will be sent using INCR burst size (default) -+ - 1: The remainder data will be sent using SINGLE burst size. -+
adp_enableSpecifies whether ADP feature is enabled. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: ADP feature disabled (default) -+ - 1: ADP feature enabled -+
otg_verSpecifies whether OTG is performing as USB OTG Revision 2.0 or Revision 1.3 -+ USB OTG device. -+ - 0: OTG 2.0 support disabled (default) -+ - 1: OTG 2.0 support enabled -+
-+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ *
Command Driver Description
GET_STATUS PCD Command is processed as -+ * defined in chapter 9 of the USB 2.0 Specification chapter 9 -+ *
CLEAR_FEATURE PCD The Device and Endpoint -+ * requests are the ENDPOINT_HALT feature is procesed, all others the -+ * interface requests are ignored.
SET_FEATURE PCD The Device and Endpoint -+ * requests are processed by the PCD. Interface requests are passed -+ * to the Gadget Driver.
SET_ADDRESS PCD Program the DCFG reg, -+ * with device address received
GET_DESCRIPTOR Gadget Driver Return the -+ * requested descriptor
SET_DESCRIPTOR Gadget Driver Optional - -+ * not implemented by any of the existing Gadget Drivers.
SET_CONFIGURATION Gadget Driver Disable -+ * all EPs and enable EPs for new configuration.
GET_CONFIGURATION Gadget Driver Return -+ * the current configuration
SET_INTERFACE Gadget Driver Disable all -+ * EPs and enable EPs for new configuration.
GET_INTERFACE Gadget Driver Return the -+ * current interface.
SYNC_FRAME PCD Display debug -+ * message.
-+ * -+ * When the SETUP Phase Done interrupt occurs, the PCD SETUP commands are -+ * processed by pcd_setup. Calling the Function Driver's setup function from -+ * pcd_setup processes the gadget SETUP commands. -+ */ -+static inline void pcd_setup(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ -+ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; -+ -+#ifdef DWC_UTE_CFI -+ int retval = 0; -+ struct cfi_usb_ctrlrequest cfi_req; -+#endif -+ -+ doeptsize0.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doeptsiz); -+ -+ /** In BDMA more then 1 setup packet is not supported till 3.00a */ -+ if (core_if->dma_enable && core_if->dma_desc_enable == 0 -+ && (doeptsize0.b.supcnt < 2) -+ && (core_if->snpsid < OTG_CORE_REV_2_94a)) { -+ DWC_ERROR -+ ("\n\n----------- CANNOT handle > 1 setup packet in DMA mode\n\n"); -+ } -+ if ((core_if->snpsid >= OTG_CORE_REV_3_00a) -+ && (core_if->dma_enable == 1) && (core_if->dma_desc_enable == 0)) { -+ ctrl = -+ (pcd->setup_pkt + -+ (3 - doeptsize0.b.supcnt - 1 + -+ ep0->dwc_ep.stp_rollover))->req; -+ } -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "SETUP %02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+#endif -+ -+ /* Clean up the request queue */ -+ dwc_otg_request_nuke(ep0); -+ ep0->stopped = 0; -+ -+ if (ctrl.bmRequestType & UE_DIR_IN) { -+ ep0->dwc_ep.is_in = 1; -+ pcd->ep0state = EP0_IN_DATA_PHASE; -+ } else { -+ ep0->dwc_ep.is_in = 0; -+ pcd->ep0state = EP0_OUT_DATA_PHASE; -+ } -+ -+ if (UGETW(ctrl.wLength) == 0) { -+ ep0->dwc_ep.is_in = 1; -+ pcd->ep0state = EP0_IN_STATUS_PHASE; -+ } -+ -+ if (UT_GET_TYPE(ctrl.bmRequestType) != UT_STANDARD) { -+ -+#ifdef DWC_UTE_CFI -+ DWC_MEMCPY(&cfi_req, &ctrl, sizeof(usb_device_request_t)); -+ -+ //printk(KERN_ALERT "CFI: req_type=0x%02x; req=0x%02x\n", -+ ctrl.bRequestType, ctrl.bRequest); -+ if (UT_GET_TYPE(cfi_req.bRequestType) == UT_VENDOR) { -+ if (cfi_req.bRequest > 0xB0 && cfi_req.bRequest < 0xBF) { -+ retval = cfi_setup(pcd, &cfi_req); -+ if (retval < 0) { -+ ep0_do_stall(pcd, retval); -+ pcd->ep0_pending = 0; -+ return; -+ } -+ -+ /* if need gadget setup then call it and check the retval */ -+ if (pcd->cfi->need_gadget_att) { -+ retval = -+ cfi_gadget_setup(pcd, -+ &pcd-> -+ cfi->ctrl_req); -+ if (retval < 0) { -+ pcd->ep0_pending = 0; -+ return; -+ } -+ } -+ -+ if (pcd->cfi->need_status_in_complete) { -+ do_setup_in_status_phase(pcd); -+ } -+ return; -+ } -+ } -+#endif -+ -+ /* handle non-standard (class/vendor) requests in the gadget driver */ -+ do_gadget_setup(pcd, &ctrl); -+ return; -+ } -+ -+ /** @todo NGS: Handle bad setup packet? */ -+ -+/////////////////////////////////////////// -+//// --- Standard Request handling --- //// -+ -+ switch (ctrl.bRequest) { -+ case UR_GET_STATUS: -+ do_get_status(pcd); -+ break; -+ -+ case UR_CLEAR_FEATURE: -+ do_clear_feature(pcd); -+ break; -+ -+ case UR_SET_FEATURE: -+ do_set_feature(pcd); -+ break; -+ -+ case UR_SET_ADDRESS: -+ do_set_address(pcd); -+ break; -+ -+ case UR_SET_INTERFACE: -+ case UR_SET_CONFIG: -+// _pcd->request_config = 1; /* Configuration changed */ -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ -+ case UR_SYNCH_FRAME: -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ -+ default: -+ /* Call the Gadget Driver's setup functions */ -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ } -+} -+ -+/** -+ * This function completes the ep0 control transfer. -+ */ -+static int32_t ep0_complete_request(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *in_ep_regs = -+ dev_if->in_ep_regs[ep->dwc_ep.num]; -+#ifdef DEBUG_EP0 -+ dwc_otg_dev_out_ep_regs_t *out_ep_regs = -+ dev_if->out_ep_regs[ep->dwc_ep.num]; -+#endif -+ deptsiz0_data_t deptsiz; -+ dev_dma_desc_sts_t desc_sts; -+ dwc_otg_pcd_request_t *req; -+ int is_last = 0; -+ dwc_otg_pcd_t *pcd = ep->pcd; -+ -+#ifdef DWC_UTE_CFI -+ struct cfi_usb_ctrlrequest *ctrlreq; -+ int retval = -DWC_E_NOT_SUPPORTED; -+#endif -+ -+ desc_sts.b.bytes = 0; -+ -+ if (pcd->ep0_pending && DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ if (ep->dwc_ep.is_in) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Do setup OUT status phase\n"); -+#endif -+ do_setup_out_status_phase(pcd); -+ } else { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Do setup IN status phase\n"); -+#endif -+ -+#ifdef DWC_UTE_CFI -+ ctrlreq = &pcd->cfi->ctrl_req; -+ -+ if (UT_GET_TYPE(ctrlreq->bRequestType) == UT_VENDOR) { -+ if (ctrlreq->bRequest > 0xB0 -+ && ctrlreq->bRequest < 0xBF) { -+ -+ /* Return if the PCD failed to handle the request */ -+ if ((retval = -+ pcd->cfi->ops. -+ ctrl_write_complete(pcd->cfi, -+ pcd)) < 0) { -+ CFI_INFO -+ ("ERROR setting a new value in the PCD(%d)\n", -+ retval); -+ ep0_do_stall(pcd, retval); -+ pcd->ep0_pending = 0; -+ return 0; -+ } -+ -+ /* If the gadget needs to be notified on the request */ -+ if (pcd->cfi->need_gadget_att == 1) { -+ //retval = do_gadget_setup(pcd, &pcd->cfi->ctrl_req); -+ retval = -+ cfi_gadget_setup(pcd, -+ &pcd->cfi-> -+ ctrl_req); -+ -+ /* Return from the function if the gadget failed to process -+ * the request properly - this should never happen !!! -+ */ -+ if (retval < 0) { -+ CFI_INFO -+ ("ERROR setting a new value in the gadget(%d)\n", -+ retval); -+ pcd->ep0_pending = 0; -+ return 0; -+ } -+ } -+ -+ CFI_INFO("%s: RETVAL=%d\n", __func__, -+ retval); -+ /* If we hit here then the PCD and the gadget has properly -+ * handled the request - so send the ZLP IN to the host. -+ */ -+ /* @todo: MAS - decide whether we need to start the setup -+ * stage based on the need_setup value of the cfi object -+ */ -+ do_setup_in_status_phase(pcd); -+ pcd->ep0_pending = 0; -+ return 1; -+ } -+ } -+#endif -+ -+ do_setup_in_status_phase(pcd); -+ } -+ pcd->ep0_pending = 0; -+ return 1; -+ } -+ -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ return 0; -+ } -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ -+ if (pcd->ep0state == EP0_OUT_STATUS_PHASE -+ || pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ is_last = 1; -+ } else if (ep->dwc_ep.is_in) { -+ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); -+ if (core_if->dma_desc_enable != 0) -+ desc_sts = dev_if->in_desc_addr->status; -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xfersize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+#endif -+ -+ if (((core_if->dma_desc_enable == 0) -+ && (deptsiz.b.xfersize == 0)) -+ || ((core_if->dma_desc_enable != 0) -+ && (desc_sts.b.bytes == 0))) { -+ req->actual = ep->dwc_ep.xfer_count; -+ /* Is a Zero Len Packet needed? */ -+ if (req->sent_zlp) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "Setup Rx ZLP\n"); -+#endif -+ req->sent_zlp = 0; -+ } -+ do_setup_out_status_phase(pcd); -+ } -+ } else { -+ /* ep0-OUT */ -+#ifdef DEBUG_EP0 -+ deptsiz.d32 = DWC_READ_REG32(&out_ep_regs->doeptsiz); -+ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xsize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+#endif -+ req->actual = ep->dwc_ep.xfer_count; -+ -+ /* Is a Zero Len Packet needed? */ -+ if (req->sent_zlp) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Setup Tx ZLP\n"); -+#endif -+ req->sent_zlp = 0; -+ } -+ /* For older cores do setup in status phase in Slave/BDMA modes, -+ * starting from 3.00 do that only in slave, and for DMA modes -+ * just re-enable ep 0 OUT here*/ -+ if (core_if->dma_enable == 0 -+ || (core_if->dma_desc_enable == 0 -+ && core_if->snpsid <= OTG_CORE_REV_2_94a)) { -+ do_setup_in_status_phase(pcd); -+ } else if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ DWC_DEBUGPL(DBG_PCDV, -+ "Enable out ep before in status phase\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ -+ /* Complete the request */ -+ if (is_last) { -+ dwc_otg_request_done(ep, req, 0); -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ return 1; -+ } -+ return 0; -+} -+ -+#ifdef DWC_UTE_CFI -+/** -+ * This function calculates traverses all the CFI DMA descriptors and -+ * and accumulates the bytes that are left to be transfered. -+ * -+ * @return The total bytes left to transfered, or a negative value as failure -+ */ -+static inline int cfi_calc_desc_residue(dwc_otg_pcd_ep_t * ep) -+{ -+ int32_t ret = 0; -+ int i; -+ struct dwc_otg_dma_desc *ddesc = NULL; -+ struct cfi_ep *cfiep; -+ -+ /* See if the pcd_ep has its respective cfi_ep mapped */ -+ cfiep = get_cfi_ep_by_pcd_ep(ep->pcd->cfi, ep); -+ if (!cfiep) { -+ CFI_INFO("%s: Failed to find ep\n", __func__); -+ return -1; -+ } -+ -+ ddesc = ep->dwc_ep.descs; -+ -+ for (i = 0; (i < cfiep->desc_count) && (i < MAX_DMA_DESCS_PER_EP); i++) { -+ -+#if defined(PRINT_CFI_DMA_DESCS) -+ print_desc(ddesc, ep->ep.name, i); -+#endif -+ ret += ddesc->status.b.bytes; -+ ddesc++; -+ } -+ -+ if (ret) -+ CFI_INFO("!!!!!!!!!! WARNING (%s) - residue=%d\n", __func__, -+ ret); -+ -+ return ret; -+} -+#endif -+ -+/** -+ * This function completes the request for the EP. If there are -+ * additional requests for the EP in the queue they will be started. -+ */ -+static void complete_ep(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); -+ struct device *dev = dwc_otg_pcd_to_dev(ep->pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *in_ep_regs = -+ dev_if->in_ep_regs[ep->dwc_ep.num]; -+ deptsiz_data_t deptsiz; -+ dev_dma_desc_sts_t desc_sts; -+ dwc_otg_pcd_request_t *req = 0; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ uint32_t byte_count = 0; -+ int is_last = 0; -+ int i; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s() %d-%s\n", __func__, ep->dwc_ep.num, -+ (ep->dwc_ep.is_in ? "IN" : "OUT")); -+ -+ /* Get any pending requests */ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (!req) { -+ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); -+ return; -+ } -+ } else { -+ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); -+ return; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "Requests %d\n", ep->pcd->request_pending); -+ -+ if (ep->dwc_ep.is_in) { -+ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); -+ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ if (deptsiz.b.xfersize == 0 -+ && deptsiz.b.pktcnt == 0) { -+ byte_count = -+ ep->dwc_ep.xfer_len - -+ ep->dwc_ep.xfer_count; -+ -+ ep->dwc_ep.xfer_buff += byte_count; -+ ep->dwc_ep.dma_addr += byte_count; -+ ep->dwc_ep.xfer_count += byte_count; -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%d-%s len=%d xfersize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, -+ (ep->dwc_ep. -+ is_in ? "IN" : "OUT"), -+ ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, -+ deptsiz.b.pktcnt); -+ -+ if (ep->dwc_ep.xfer_len < -+ ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer -+ (core_if, &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length transfer in case if it is queued -+ * a transfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Descriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 length. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer -+ (core_if, &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } else { -+ if (ep->dwc_ep.type == -+ DWC_OTG_EP_TYPE_ISOC) { -+ req->actual = 0; -+ dwc_otg_request_done(ep, req, 0); -+ -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ -+ /* If there is a request in the queue start it. */ -+ start_next_request(ep); -+ } else -+ DWC_WARN -+ ("Incomplete transfer (%d - %s [siz=%d pkt=%d])\n", -+ ep->dwc_ep.num, -+ (ep->dwc_ep.is_in ? "IN" : "OUT"), -+ deptsiz.b.xfersize, -+ deptsiz.b.pktcnt); -+ } -+ } else { -+ dma_desc = ep->dwc_ep.desc_addr; -+ byte_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ -+#ifdef DWC_UTE_CFI -+ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, -+ ep->dwc_ep.buff_mode); -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ int residue; -+ -+ residue = cfi_calc_desc_residue(ep); -+ if (residue < 0) -+ return; -+ -+ byte_count = residue; -+ } else { -+#endif -+ for (i = 0; i < ep->dwc_ep.desc_cnt; -+ ++i) { -+ desc_sts = dma_desc->status; -+ byte_count += desc_sts.b.bytes; -+ dma_desc++; -+ } -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ if (byte_count == 0) { -+ ep->dwc_ep.xfer_count = -+ ep->dwc_ep.total_len; -+ is_last = 1; -+ } else { -+ DWC_WARN("Incomplete transfer\n"); -+ } -+ } -+ } else { -+ if (deptsiz.b.xfersize == 0 && deptsiz.b.pktcnt == 0) { -+ DWC_DEBUGPL(DBG_PCDV, -+ "%d-%s len=%d xfersize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT", -+ ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, -+ deptsiz.b.pktcnt); -+ -+ /* Check if the whole transfer was completed, -+ * if no, setup transfer for next portion of data -+ */ -+ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer(core_if, -+ &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length trasfer in case if it is queued -+ * a trasfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Desriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 legth. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer(core_if, -+ &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } else { -+ DWC_WARN -+ ("Incomplete transfer (%d-%s [siz=%d pkt=%d])\n", -+ ep->dwc_ep.num, -+ (ep->dwc_ep.is_in ? "IN" : "OUT"), -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ } -+ } -+ } else { -+ dwc_otg_dev_out_ep_regs_t *out_ep_regs = -+ dev_if->out_ep_regs[ep->dwc_ep.num]; -+ desc_sts.d32 = 0; -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ dma_desc = ep->dwc_ep.desc_addr; -+ byte_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ -+#ifdef DWC_UTE_CFI -+ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, -+ ep->dwc_ep.buff_mode); -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ int residue; -+ residue = cfi_calc_desc_residue(ep); -+ if (residue < 0) -+ return; -+ byte_count = residue; -+ } else { -+#endif -+ -+ for (i = 0; i < ep->dwc_ep.desc_cnt; -+ ++i) { -+ desc_sts = dma_desc->status; -+ byte_count += desc_sts.b.bytes; -+ dma_desc++; -+ } -+ -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ /* Checking for interrupt Out transfers with not -+ * dword aligned mps sizes -+ */ -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_INTR && -+ (ep->dwc_ep.maxpacket%4)) { -+ ep->dwc_ep.xfer_count = -+ ep->dwc_ep.total_len - byte_count; -+ if ((ep->dwc_ep.xfer_len % -+ ep->dwc_ep.maxpacket) -+ && (ep->dwc_ep.xfer_len / -+ ep->dwc_ep.maxpacket < -+ MAX_DMA_DESC_CNT)) -+ ep->dwc_ep.xfer_len -= -+ (ep->dwc_ep.desc_cnt - -+ 1) * ep->dwc_ep.maxpacket + -+ ep->dwc_ep.xfer_len % -+ ep->dwc_ep.maxpacket; -+ else -+ ep->dwc_ep.xfer_len -= -+ ep->dwc_ep.desc_cnt * -+ ep->dwc_ep.maxpacket; -+ if (ep->dwc_ep.xfer_len > 0) { -+ dwc_otg_ep_start_transfer -+ (core_if, &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } else { -+ ep->dwc_ep.xfer_count = -+ ep->dwc_ep.total_len - byte_count + -+ ((4 - -+ (ep->dwc_ep. -+ total_len & 0x3)) & 0x3); -+ is_last = 1; -+ } -+ } else { -+ deptsiz.d32 = 0; -+ deptsiz.d32 = -+ DWC_READ_REG32(&out_ep_regs->doeptsiz); -+ -+ byte_count = (ep->dwc_ep.xfer_len - -+ ep->dwc_ep.xfer_count - -+ deptsiz.b.xfersize); -+ ep->dwc_ep.xfer_buff += byte_count; -+ ep->dwc_ep.dma_addr += byte_count; -+ ep->dwc_ep.xfer_count += byte_count; -+ -+ /* Check if the whole transfer was completed, -+ * if no, setup transfer for next portion of data -+ */ -+ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer(core_if, -+ &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length trasfer in case if it is queued -+ * a trasfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Desriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 legth. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer(core_if, -+ &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } -+ } else { -+ /* Check if the whole transfer was completed, -+ * if no, setup transfer for next portion of data -+ */ -+ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length transfer in case if it is queued -+ * a transfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Descriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 length. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer(core_if, -+ &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "addr %p, %d-%s len=%d cnt=%d xsize=%d pktcnt=%d\n", -+ &out_ep_regs->doeptsiz, ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT", -+ ep->dwc_ep.xfer_len, ep->dwc_ep.xfer_count, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ } -+ -+ /* Complete the request */ -+ if (is_last) { -+#ifdef DWC_UTE_CFI -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ req->actual = ep->dwc_ep.cfi_req_len - byte_count; -+ } else { -+#endif -+ req->actual = ep->dwc_ep.xfer_count; -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ if (req->dw_align_buf) { -+ if (!ep->dwc_ep.is_in) { -+ dwc_memcpy(req->buf, req->dw_align_buf, req->length); -+ } -+ DWC_DMA_FREE(dev, req->length, req->dw_align_buf, -+ req->dw_align_buf_dma); -+ } -+ -+ dwc_otg_request_done(ep, req, 0); -+ -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ -+ /* If there is a request in the queue start it. */ -+ start_next_request(ep); -+ } -+} -+ -+#ifdef DWC_EN_ISOC -+ -+/** -+ * This function BNA interrupt for Isochronous EPs -+ * -+ */ -+static void dwc_otg_pcd_handle_iso_bna(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_ep_t *dwc_ep = &ep->dwc_ep; -+ volatile uint32_t *addr; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dwc_otg_pcd_t *pcd = ep->pcd; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ int i; -+ -+ dma_desc = -+ dwc_ep->iso_desc_addr + dwc_ep->desc_cnt * (dwc_ep->proc_buf_num); -+ -+ if (dwc_ep->is_in) { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { -+ sts.d32 = dma_desc->status.d32; -+ sts.b_iso_in.bs = BS_HOST_READY; -+ dma_desc->status.d32 = sts.d32; -+ } -+ } else { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { -+ sts.d32 = dma_desc->status.d32; -+ sts.b_iso_out.bs = BS_HOST_READY; -+ dma_desc->status.d32 = sts.d32; -+ } -+ } -+ -+ if (dwc_ep->is_in == 0) { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep-> -+ num]->doepctl; -+ } else { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ } -+ depctl.b.epena = 1; -+ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); -+} -+ -+/** -+ * This function sets latest iso packet information(non-PTI mode) -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void set_current_pkt_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ dma_addr_t dma_addr; -+ uint32_t offset; -+ -+ if (ep->proc_buf_num) -+ dma_addr = ep->dma_addr1; -+ else -+ dma_addr = ep->dma_addr0; -+ -+ if (ep->is_in) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[ep->num]->dieptsiz); -+ offset = ep->data_per_frame; -+ } else { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->num]->doeptsiz); -+ offset = -+ ep->data_per_frame + -+ (0x4 & (0x4 - (ep->data_per_frame & 0x3))); -+ } -+ -+ if (!deptsiz.b.xfersize) { -+ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; -+ ep->pkt_info[ep->cur_pkt].offset = -+ ep->cur_pkt_dma_addr - dma_addr; -+ ep->pkt_info[ep->cur_pkt].status = 0; -+ } else { -+ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; -+ ep->pkt_info[ep->cur_pkt].offset = -+ ep->cur_pkt_dma_addr - dma_addr; -+ ep->pkt_info[ep->cur_pkt].status = -DWC_E_NO_DATA; -+ } -+ ep->cur_pkt_addr += offset; -+ ep->cur_pkt_dma_addr += offset; -+ ep->cur_pkt++; -+} -+ -+/** -+ * This function sets latest iso packet information(DDMA mode) -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP to start the transfer on. -+ * -+ */ -+static void set_ddma_iso_pkts_info(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * dwc_ep) -+{ -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ iso_pkt_info_t *iso_packet; -+ uint32_t data_per_desc; -+ uint32_t offset; -+ int i, j; -+ -+ iso_packet = dwc_ep->pkt_info; -+ -+ /** Reinit closed DMA Descriptors*/ -+ /** ISO OUT EP */ -+ if (dwc_ep->is_in == 0) { -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ offset = 0; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep-> -+ data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - -+ data_per_desc % -+ 4) : 0; -+ -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso_packet_decsriptor */ -+ iso_packet->status = -+ sts.b_iso_out.rxsts + -+ (sts.b_iso_out.bs ^ BS_DMA_DONE); -+ if (iso_packet->status) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ -+ /* Received data length */ -+ if (!sts.b_iso_out.rxbytes) { -+ iso_packet->length = -+ data_per_desc - -+ sts.b_iso_out.rxbytes; -+ } else { -+ iso_packet->length = -+ data_per_desc - -+ sts.b_iso_out.rxbytes + (4 - -+ dwc_ep->data_per_frame -+ % 4); -+ } -+ -+ iso_packet->offset = offset; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ iso_packet++; -+ } -+ } -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso_packet_decsriptor */ -+ iso_packet->status = -+ sts.b_iso_out.rxsts + -+ (sts.b_iso_out.bs ^ BS_DMA_DONE); -+ if (iso_packet->status) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ -+ /* Received data length */ -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; -+ -+ iso_packet->offset = offset; -+ -+ offset += data_per_desc; -+ iso_packet++; -+ dma_desc++; -+ } -+ -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso_packet_decsriptor */ -+ iso_packet->status = -+ sts.b_iso_out.rxsts + (sts.b_iso_out.bs ^ BS_DMA_DONE); -+ if (iso_packet->status) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ /* Received data length */ -+ if (!sts.b_iso_out.rxbytes) { -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; -+ } else { -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes + -+ (4 - dwc_ep->data_per_frame % 4); -+ } -+ -+ iso_packet->offset = offset; -+ } else { -+/** ISO IN EP */ -+ -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso packet descriptor */ -+ iso_packet->status = -+ sts.b_iso_in.txsts + -+ (sts.b_iso_in.bs ^ BS_DMA_DONE); -+ if (iso_packet->status != 0) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ -+ } -+ /* Bytes has been transfered */ -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; -+ -+ dma_desc++; -+ iso_packet++; -+ } -+ -+ sts.d32 = dma_desc->status.d32; -+ while (sts.b_iso_in.bs == BS_DMA_BUSY) { -+ sts.d32 = dma_desc->status.d32; -+ } -+ -+ /* Write status in iso packet descriptor ??? do be done with ERROR codes */ -+ iso_packet->status = -+ sts.b_iso_in.txsts + (sts.b_iso_in.bs ^ BS_DMA_DONE); -+ if (iso_packet->status != 0) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ -+ /* Bytes has been transfered */ -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; -+ } -+} -+ -+/** -+ * This function reinitialize DMA Descriptors for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP to start the transfer on. -+ * -+ */ -+static void reinit_ddma_iso_xfer(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) -+{ -+ int i, j; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ dma_addr_t dma_ad; -+ volatile uint32_t *addr; -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ uint32_t data_per_desc; -+ -+ if (dwc_ep->is_in == 0) { -+ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; -+ } else { -+ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ } -+ -+ if (dwc_ep->proc_buf_num == 0) { -+ /** Buffer 0 descriptors setup */ -+ dma_ad = dwc_ep->dma_addr0; -+ } else { -+ /** Buffer 1 descriptors setup */ -+ dma_ad = dwc_ep->dma_addr1; -+ } -+ -+ /** Reinit closed DMA Descriptors*/ -+ /** ISO OUT EP */ -+ if (dwc_ep->is_in == 0) { -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ -+ sts.b_iso_out.bs = BS_HOST_READY; -+ sts.b_iso_out.rxsts = 0; -+ sts.b_iso_out.l = 0; -+ sts.b_iso_out.sp = 0; -+ sts.b_iso_out.ioc = 0; -+ sts.b_iso_out.pid = 0; -+ sts.b_iso_out.framenum = 0; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep-> -+ data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - -+ data_per_desc % -+ 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dma_ad += data_per_desc; -+ dma_desc++; -+ } -+ } -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ -+ sts.b_iso_out.ioc = 1; -+ sts.b_iso_out.l = dwc_ep->proc_buf_num; -+ -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ } else { -+/** ISO IN EP */ -+ -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ -+ sts.b_iso_in.bs = BS_HOST_READY; -+ sts.b_iso_in.txsts = 0; -+ sts.b_iso_in.sp = 0; -+ sts.b_iso_in.ioc = 0; -+ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; -+ sts.b_iso_in.framenum = dwc_ep->next_frame; -+ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; -+ sts.b_iso_in.l = 0; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ sts.b_iso_in.framenum += dwc_ep->bInterval; -+ dma_ad += dwc_ep->data_per_frame; -+ dma_desc++; -+ } -+ -+ sts.b_iso_in.ioc = 1; -+ sts.b_iso_in.l = dwc_ep->proc_buf_num; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dwc_ep->next_frame = -+ sts.b_iso_in.framenum + dwc_ep->bInterval * 1; -+ } -+ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; -+} -+ -+/** -+ * This function is to handle Iso EP transfer complete interrupt -+ * in case Iso out packet was dropped -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP for wihich transfer complete was asserted -+ * -+ */ -+static uint32_t handle_iso_out_pkt_dropped(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * dwc_ep) -+{ -+ uint32_t dma_addr; -+ uint32_t drp_pkt; -+ uint32_t drp_pkt_cnt; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ int i; -+ -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[dwc_ep->num]->doeptsiz); -+ -+ drp_pkt = dwc_ep->pkt_cnt - deptsiz.b.pktcnt; -+ drp_pkt_cnt = dwc_ep->pkt_per_frm - (drp_pkt % dwc_ep->pkt_per_frm); -+ -+ /* Setting dropped packets status */ -+ for (i = 0; i < drp_pkt_cnt; ++i) { -+ dwc_ep->pkt_info[drp_pkt].status = -DWC_E_NO_DATA; -+ drp_pkt++; -+ deptsiz.b.pktcnt--; -+ } -+ -+ if (deptsiz.b.pktcnt > 0) { -+ deptsiz.b.xfersize = -+ dwc_ep->xfer_len - (dwc_ep->pkt_cnt - -+ deptsiz.b.pktcnt) * dwc_ep->maxpacket; -+ } else { -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 0; -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz, -+ deptsiz.d32); -+ -+ if (deptsiz.b.pktcnt > 0) { -+ if (dwc_ep->proc_buf_num) { -+ dma_addr = -+ dwc_ep->dma_addr1 + dwc_ep->xfer_len - -+ deptsiz.b.xfersize; -+ } else { -+ dma_addr = -+ dwc_ep->dma_addr0 + dwc_ep->xfer_len - -+ deptsiz.b.xfersize;; -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ out_ep_regs[dwc_ep->num]->doepdma, dma_addr); -+ -+ /** Re-enable endpoint, clear nak */ -+ depctl.d32 = 0; -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(&core_if->dev_if-> -+ out_ep_regs[dwc_ep->num]->doepctl, depctl.d32, -+ depctl.d32); -+ return 0; -+ } else { -+ return 1; -+ } -+} -+ -+/** -+ * This function sets iso packets information(PTI mode) -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+static uint32_t set_iso_pkts_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ int i, j; -+ dma_addr_t dma_ad; -+ iso_pkt_info_t *packet_info = ep->pkt_info; -+ uint32_t offset; -+ uint32_t frame_data; -+ deptsiz_data_t deptsiz; -+ -+ if (ep->proc_buf_num == 0) { -+ /** Buffer 0 descriptors setup */ -+ dma_ad = ep->dma_addr0; -+ } else { -+ /** Buffer 1 descriptors setup */ -+ dma_ad = ep->dma_addr1; -+ } -+ -+ if (ep->is_in) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ dieptsiz); -+ } else { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> -+ doeptsiz); -+ } -+ -+ if (!deptsiz.b.xfersize) { -+ offset = 0; -+ for (i = 0; i < ep->pkt_cnt; i += ep->pkt_per_frm) { -+ frame_data = ep->data_per_frame; -+ for (j = 0; j < ep->pkt_per_frm; ++j) { -+ -+ /* Packet status - is not set as initially -+ * it is set to 0 and if packet was sent -+ successfully, status field will remain 0*/ -+ -+ /* Bytes has been transfered */ -+ packet_info->length = -+ (ep->maxpacket < -+ frame_data) ? ep->maxpacket : frame_data; -+ -+ /* Received packet offset */ -+ packet_info->offset = offset; -+ offset += packet_info->length; -+ frame_data -= packet_info->length; -+ -+ packet_info++; -+ } -+ } -+ return 1; -+ } else { -+ /* This is a workaround for in case of Transfer Complete with -+ * PktDrpSts interrupts merging - in this case Transfer complete -+ * interrupt for Isoc Out Endpoint is asserted without PktDrpSts -+ * set and with DOEPTSIZ register non zero. Investigations showed, -+ * that this happens when Out packet is dropped, but because of -+ * interrupts merging during first interrupt handling PktDrpSts -+ * bit is cleared and for next merged interrupts it is not reset. -+ * In this case SW hadles the interrupt as if PktDrpSts bit is set. -+ */ -+ if (ep->is_in) { -+ return 1; -+ } else { -+ return handle_iso_out_pkt_dropped(core_if, ep); -+ } -+ } -+} -+ -+/** -+ * This function is to handle Iso EP transfer complete interrupt -+ * -+ * @param pcd The PCD -+ * @param ep The EP for which transfer complete was asserted -+ * -+ */ -+static void complete_iso_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); -+ dwc_ep_t *dwc_ep = &ep->dwc_ep; -+ uint8_t is_last = 0; -+ -+ if (ep->dwc_ep.next_frame == 0xffffffff) { -+ DWC_WARN("Next frame is not set!\n"); -+ return; -+ } -+ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ set_ddma_iso_pkts_info(core_if, dwc_ep); -+ reinit_ddma_iso_xfer(core_if, dwc_ep); -+ is_last = 1; -+ } else { -+ if (core_if->pti_enh_enable) { -+ if (set_iso_pkts_info(core_if, dwc_ep)) { -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ dwc_otg_iso_ep_start_buf_transfer -+ (core_if, dwc_ep); -+ is_last = 1; -+ } -+ } else { -+ set_current_pkt_info(core_if, dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ is_last = 1; -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr0; -+ } -+ -+ } -+ dwc_otg_iso_ep_start_frm_transfer(core_if, -+ dwc_ep); -+ } -+ } -+ } else { -+ set_current_pkt_info(core_if, dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ is_last = 1; -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr0; -+ } -+ -+ } -+ dwc_otg_iso_ep_start_frm_transfer(core_if, dwc_ep); -+ } -+ if (is_last) -+ dwc_otg_iso_buffer_done(pcd, ep, ep->iso_req_handle); -+} -+#endif /* DWC_EN_ISOC */ -+ -+/** -+ * This function handle BNA interrupt for Non Isochronous EPs -+ * -+ */ -+static void dwc_otg_pcd_handle_noniso_bna(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_ep_t *dwc_ep = &ep->dwc_ep; -+ volatile uint32_t *addr; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dwc_otg_pcd_t *pcd = ep->pcd; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = ep->pcd->core_if; -+ int i, start; -+ -+ if (!dwc_ep->desc_cnt) -+ DWC_WARN("Ep%d %s Descriptor count = %d \n", dwc_ep->num, -+ (dwc_ep->is_in ? "IN" : "OUT"), dwc_ep->desc_cnt); -+ -+ if (core_if->core_params->cont_on_bna && !dwc_ep->is_in -+ && dwc_ep->type != DWC_OTG_EP_TYPE_CONTROL) { -+ uint32_t doepdma; -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[dwc_ep->num]; -+ doepdma = DWC_READ_REG32(&(out_regs->doepdma)); -+ start = (doepdma - dwc_ep->dma_desc_addr)/sizeof(dwc_otg_dev_dma_desc_t); -+ dma_desc = &(dwc_ep->desc_addr[start]); -+ } else { -+ start = 0; -+ dma_desc = dwc_ep->desc_addr; -+ } -+ -+ -+ for (i = start; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { -+ sts.d32 = dma_desc->status.d32; -+ sts.b.bs = BS_HOST_READY; -+ dma_desc->status.d32 = sts.d32; -+ } -+ -+ if (dwc_ep->is_in == 0) { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep->num]-> -+ doepctl; -+ } else { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ } -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ DWC_MODIFY_REG32(addr, 0, depctl.d32); -+} -+ -+/** -+ * This function handles EP0 Control transfers. -+ * -+ * The state of the control transfers are tracked in -+ * ep0state. -+ */ -+static void handle_ep0(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ dev_dma_desc_sts_t desc_sts; -+ deptsiz0_data_t deptsiz; -+ uint32_t byte_count; -+ -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); -+ print_ep0_state(pcd); -+#endif -+ -+// DWC_PRINTF("HANDLE EP0\n"); -+ -+ switch (pcd->ep0state) { -+ case EP0_DISCONNECT: -+ break; -+ -+ case EP0_IDLE: -+ pcd->request_config = 0; -+ -+ pcd_setup(pcd); -+ break; -+ -+ case EP0_IN_DATA_PHASE: -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "DATA_IN EP%d-%s: type=%d, mps=%d\n", -+ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), -+ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); -+#endif -+ -+ if (core_if->dma_enable != 0) { -+ /* -+ * For EP0 we can only program 1 packet at a time so we -+ * need to do the make calculations after each complete. -+ * Call write_packet to make the calculations, as in -+ * slave mode, and use those values to determine if we -+ * can complete. -+ */ -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->in_ep_regs[0]-> -+ dieptsiz); -+ byte_count = -+ ep0->dwc_ep.xfer_len - deptsiz.b.xfersize; -+ } else { -+ desc_sts = -+ core_if->dev_if->in_desc_addr->status; -+ byte_count = -+ ep0->dwc_ep.xfer_len - desc_sts.b.bytes; -+ } -+ ep0->dwc_ep.xfer_count += byte_count; -+ ep0->dwc_ep.xfer_buff += byte_count; -+ ep0->dwc_ep.dma_addr += byte_count; -+ } -+ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); -+ } else if (ep0->dwc_ep.sent_zlp) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ ep0->dwc_ep.sent_zlp = 0; -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); -+ } else { -+ ep0_complete_request(ep0); -+ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); -+ } -+ break; -+ case EP0_OUT_DATA_PHASE: -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "DATA_OUT EP%d-%s: type=%d, mps=%d\n", -+ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), -+ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); -+#endif -+ if (core_if->dma_enable != 0) { -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->out_ep_regs[0]-> -+ doeptsiz); -+ byte_count = -+ ep0->dwc_ep.maxpacket - deptsiz.b.xfersize; -+ } else { -+ desc_sts = -+ core_if->dev_if->out_desc_addr->status; -+ byte_count = -+ ep0->dwc_ep.maxpacket - desc_sts.b.bytes; -+ } -+ ep0->dwc_ep.xfer_count += byte_count; -+ ep0->dwc_ep.xfer_buff += byte_count; -+ ep0->dwc_ep.dma_addr += byte_count; -+ } -+ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); -+ } else if (ep0->dwc_ep.sent_zlp) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ ep0->dwc_ep.sent_zlp = 0; -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); -+ } else { -+ ep0_complete_request(ep0); -+ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); -+ } -+ break; -+ -+ case EP0_IN_STATUS_PHASE: -+ case EP0_OUT_STATUS_PHASE: -+ DWC_DEBUGPL(DBG_PCD, "CASE: EP0_STATUS\n"); -+ ep0_complete_request(ep0); -+ pcd->ep0state = EP0_IDLE; -+ ep0->stopped = 1; -+ ep0->dwc_ep.is_in = 0; /* OUT for next SETUP */ -+ -+ /* Prepare for more SETUP Packets */ -+ if (core_if->dma_enable) { -+ ep0_out_start(core_if, pcd); -+ } -+ break; -+ -+ case EP0_STALL: -+ DWC_ERROR("EP0 STALLed, should not get here pcd_setup()\n"); -+ break; -+ } -+#ifdef DEBUG_EP0 -+ print_ep0_state(pcd); -+#endif -+} -+ -+/** -+ * Restart transfer -+ */ -+static void restart_transfer(dwc_otg_pcd_t * pcd, const uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if; -+ dwc_otg_dev_if_t *dev_if; -+ deptsiz_data_t dieptsiz = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep; -+ -+ ep = get_in_ep(pcd, epnum); -+ -+#ifdef DWC_EN_ISOC -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ return; -+ } -+#endif /* DWC_EN_ISOC */ -+ -+ core_if = GET_CORE_IF(pcd); -+ dev_if = core_if->dev_if; -+ -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); -+ -+ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x xfer_len=%0x" -+ " stopped=%d\n", ep->dwc_ep.xfer_buff, -+ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, ep->stopped); -+ /* -+ * If xfersize is 0 and pktcnt in not 0, resend the last packet. -+ */ -+ if (dieptsiz.b.pktcnt && dieptsiz.b.xfersize == 0 && -+ ep->dwc_ep.start_xfer_buff != 0) { -+ if (ep->dwc_ep.total_len <= ep->dwc_ep.maxpacket) { -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.xfer_buff = ep->dwc_ep.start_xfer_buff; -+ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; -+ } else { -+ ep->dwc_ep.xfer_count -= ep->dwc_ep.maxpacket; -+ /* convert packet size to dwords. */ -+ ep->dwc_ep.xfer_buff -= ep->dwc_ep.maxpacket; -+ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; -+ } -+ ep->stopped = 0; -+ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x " -+ "xfer_len=%0x stopped=%d\n", -+ ep->dwc_ep.xfer_buff, -+ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, -+ ep->stopped); -+ if (epnum == 0) { -+ dwc_otg_ep0_start_transfer(core_if, &ep->dwc_ep); -+ } else { -+ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); -+ } -+ } -+} -+ -+/* -+ * This function create new nextep sequnce based on Learn Queue. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void predict_nextep_seq( dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_device_global_regs_t *dev_global_regs = -+ core_if->dev_if->dev_global_regs; -+ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; -+ /* Number of Token Queue Registers */ -+ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; -+ dtknq1_data_t dtknqr1; -+ uint32_t in_tkn_epnums[4]; -+ uint8_t seqnum[MAX_EPS_CHANNELS]; -+ uint8_t intkn_seq[TOKEN_Q_DEPTH]; -+ grstctl_t resetctl = {.d32 = 0 }; -+ uint8_t temp; -+ int ndx = 0; -+ int start = 0; -+ int end = 0; -+ int sort_done = 0; -+ int i = 0; -+ volatile uint32_t *addr = &dev_global_regs->dtknqr1; -+ -+ -+ DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); -+ -+ /* Read the DTKNQ Registers */ -+ for (i = 0; i < DTKNQ_REG_CNT; i++) { -+ in_tkn_epnums[i] = DWC_READ_REG32(addr); -+ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, -+ in_tkn_epnums[i]); -+ if (addr == &dev_global_regs->dvbusdis) { -+ addr = &dev_global_regs->dtknqr3_dthrctl; -+ } else { -+ ++addr; -+ } -+ -+ } -+ -+ /* Copy the DTKNQR1 data to the bit field. */ -+ dtknqr1.d32 = in_tkn_epnums[0]; -+ if (dtknqr1.b.wrap_bit) { -+ ndx = dtknqr1.b.intknwptr; -+ end = ndx -1; -+ if (end < 0) -+ end = TOKEN_Q_DEPTH -1; -+ } else { -+ ndx = 0; -+ end = dtknqr1.b.intknwptr -1; -+ if (end < 0) -+ end = 0; -+ } -+ start = ndx; -+ -+ /* Fill seqnum[] by initial values: EP number + 31 */ -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ seqnum[i] = i +31; -+ } -+ -+ /* Fill intkn_seq[] from in_tkn_epnums[0] */ -+ for (i=0; i < 6; i++) -+ intkn_seq[i] = (in_tkn_epnums[0] >> ((7-i) * 4)) & 0xf; -+ -+ if (TOKEN_Q_DEPTH > 6) { -+ /* Fill intkn_seq[] from in_tkn_epnums[1] */ -+ for (i=6; i < 14; i++) -+ intkn_seq[i] = -+ (in_tkn_epnums[1] >> ((7 - (i - 6)) * 4)) & 0xf; -+ } -+ -+ if (TOKEN_Q_DEPTH > 14) { -+ /* Fill intkn_seq[] from in_tkn_epnums[1] */ -+ for (i=14; i < 22; i++) -+ intkn_seq[i] = -+ (in_tkn_epnums[2] >> ((7 - (i - 14)) * 4)) & 0xf; -+ } -+ -+ if (TOKEN_Q_DEPTH > 22) { -+ /* Fill intkn_seq[] from in_tkn_epnums[1] */ -+ for (i=22; i < 30; i++) -+ intkn_seq[i] = -+ (in_tkn_epnums[3] >> ((7 - (i - 22)) * 4)) & 0xf; -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s start=%d end=%d intkn_seq[]:\n", __func__, -+ start, end); -+ for (i=0; idev_if->num_in_eps; i++) { -+ if (core_if->nextep_seq[i] == 0xff ) -+ seqnum[i] = 0xff; -+ } -+ -+ /* Sort seqnum[] */ -+ sort_done = 0; -+ while (!sort_done) { -+ sort_done = 1; -+ for (i=0; idev_if->num_in_eps; i++) { -+ if (seqnum[i] > seqnum[i+1]) { -+ temp = seqnum[i]; -+ seqnum[i] = seqnum[i+1]; -+ seqnum[i+1] = temp; -+ sort_done = 0; -+ } -+ } -+ } -+ -+ ndx = start + seqnum[0]; -+ if (ndx >= TOKEN_Q_DEPTH) -+ ndx = ndx % TOKEN_Q_DEPTH; -+ core_if->first_in_nextep_seq = intkn_seq[ndx]; -+ -+ /* Update seqnum[] by EP numbers */ -+ for (i=0; i<=core_if->dev_if->num_in_eps; i++) { -+ ndx = start + i; -+ if (seqnum[i] < 31) { -+ ndx = start + seqnum[i]; -+ if (ndx >= TOKEN_Q_DEPTH) -+ ndx = ndx % TOKEN_Q_DEPTH; -+ seqnum[i] = intkn_seq[ndx]; -+ } else { -+ if (seqnum[i] < 0xff) { -+ seqnum[i] = seqnum[i] - 31; -+ } else { -+ break; -+ } -+ } -+ } -+ -+ /* Update nextep_seq[] based on seqnum[] */ -+ for (i=0; idev_if->num_in_eps; i++) { -+ if (seqnum[i] != 0xff) { -+ if (seqnum[i+1] != 0xff) { -+ core_if->nextep_seq[seqnum[i]] = seqnum[i+1]; -+ } else { -+ core_if->nextep_seq[seqnum[i]] = core_if->first_in_nextep_seq; -+ break; -+ } -+ } else { -+ break; -+ } -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV,"%2d\n", core_if->nextep_seq[i]); -+ } -+ -+ /* Flush the Learning Queue */ -+ resetctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->grstctl); -+ resetctl.b.intknqflsh = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); -+ -+ -+} -+ -+/** -+ * handle the IN EP disable interrupt. -+ */ -+static inline void handle_in_ep_disable_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ deptsiz_data_t dieptsiz = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ gintmsk_data_t gintmsk_data; -+ depctl_data_t depctl; -+ uint32_t diepdma; -+ uint32_t remain_to_transfer = 0; -+ uint8_t i; -+ uint32_t xfer_size; -+ -+ ep = get_in_ep(pcd, epnum); -+ dwc_ep = &ep->dwc_ep; -+ -+ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); -+ complete_ep(ep); -+ return; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "diepctl%d=%0x\n", epnum, -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl)); -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); -+ -+ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", -+ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); -+ -+ if ((core_if->start_predict == 0) || (depctl.b.eptype & 1)) { -+ if (ep->stopped) { -+ if (core_if->en_multiple_tx_fifo) -+ /* Flush the Tx FIFO */ -+ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); -+ /* Clear the Global IN NP NAK */ -+ dctl.d32 = 0; -+ dctl.b.cgnpinnak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ /* Restart the transaction */ -+ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { -+ restart_transfer(pcd, epnum); -+ } -+ } else { -+ /* Restart the transaction */ -+ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { -+ restart_transfer(pcd, epnum); -+ } -+ DWC_DEBUGPL(DBG_ANY, "STOPPED!!!\n"); -+ } -+ return; -+ } -+ -+ if (core_if->start_predict > 2) { // NP IN EP -+ core_if->start_predict--; -+ return; -+ } -+ -+ core_if->start_predict--; -+ -+ if (core_if->start_predict == 1) { // All NP IN Ep's disabled now -+ -+ predict_nextep_seq(core_if); -+ -+ /* Update all active IN EP's NextEP field based of nextep_seq[] */ -+ for ( i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (core_if->nextep_seq[i] != 0xff) { // Active NP IN EP -+ depctl.b.nextep = core_if->nextep_seq[i]; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); -+ } -+ } -+ /* Flush Shared NP TxFIFO */ -+ dwc_otg_flush_tx_fifo(core_if, 0); -+ /* Rewind buffers */ -+ if (!core_if->dma_desc_enable) { -+ i = core_if->first_in_nextep_seq; -+ do { -+ ep = get_in_ep(pcd, i); -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); -+ xfer_size = ep->dwc_ep.total_len - ep->dwc_ep.xfer_count; -+ if (xfer_size > ep->dwc_ep.maxxfer) -+ xfer_size = ep->dwc_ep.maxxfer; -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (dieptsiz.b.pktcnt != 0) { -+ if (xfer_size == 0) { -+ remain_to_transfer = 0; -+ } else { -+ if ((xfer_size % ep->dwc_ep.maxpacket) == 0) { -+ remain_to_transfer = -+ dieptsiz.b.pktcnt * ep->dwc_ep.maxpacket; -+ } else { -+ remain_to_transfer = ((dieptsiz.b.pktcnt -1) * ep->dwc_ep.maxpacket) -+ + (xfer_size % ep->dwc_ep.maxpacket); -+ } -+ } -+ diepdma = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepdma); -+ dieptsiz.b.xfersize = remain_to_transfer; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, dieptsiz.d32); -+ diepdma = ep->dwc_ep.dma_addr + (xfer_size - remain_to_transfer); -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, diepdma); -+ } -+ i = core_if->nextep_seq[i]; -+ } while (i != core_if->first_in_nextep_seq); -+ } else { // dma_desc_enable -+ DWC_PRINTF("%s Learning Queue not supported in DDMA\n", __func__); -+ } -+ -+ /* Restart transfers in predicted sequences */ -+ i = core_if->first_in_nextep_seq; -+ do { -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (dieptsiz.b.pktcnt != 0) { -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); -+ } -+ i = core_if->nextep_seq[i]; -+ } while (i != core_if->first_in_nextep_seq); -+ -+ /* Clear the global non-periodic IN NAK handshake */ -+ dctl.d32 = 0; -+ dctl.b.cgnpinnak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ -+ /* Unmask EP Mismatch interrupt */ -+ gintmsk_data.d32 = 0; -+ gintmsk_data.b.epmismatch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, gintmsk_data.d32); -+ -+ core_if->start_predict = 0; -+ -+ } -+} -+ -+/** -+ * Handler for the IN EP timeout handshake interrupt. -+ */ -+static inline void handle_in_ep_timeout_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ -+#ifdef DEBUG -+ deptsiz_data_t dieptsiz = {.d32 = 0 }; -+ uint32_t num = 0; -+#endif -+ dctl_data_t dctl = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep; -+ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ ep = get_in_ep(pcd, epnum); -+ -+ /* Disable the NP Tx Fifo Empty Interrrupt */ -+ if (!core_if->dma_enable) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ } -+ /** @todo NGS Check EP type. -+ * Implement for Periodic EPs */ -+ /* -+ * Non-periodic EP -+ */ -+ /* Enable the Global IN NAK Effective Interrupt */ -+ intr_mask.b.ginnakeff = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); -+ -+ /* Set Global IN NAK */ -+ dctl.b.sgnpinnak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ -+ ep->stopped = 1; -+ -+#ifdef DEBUG -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[num]->dieptsiz); -+ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", -+ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); -+#endif -+ -+#ifdef DISABLE_PERIODIC_EP -+ /* -+ * Set the NAK bit for this EP to -+ * start the disable process. -+ */ -+ diepctl.d32 = 0; -+ diepctl.b.snak = 1; -+ DWC_MODIFY_REG32(&dev_if->in_ep_regs[num]->diepctl, diepctl.d32, -+ diepctl.d32); -+ ep->disabling = 1; -+ ep->stopped = 1; -+#endif -+} -+ -+/** -+ * Handler for the IN EP NAK interrupt. -+ */ -+static inline int32_t handle_in_ep_nak_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ diepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "IN EP NAK"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.nak = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ diepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->diepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * Handler for the OUT EP Babble interrupt. -+ */ -+static inline int32_t handle_out_ep_babble_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ doepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", -+ "OUT EP Babble"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.babble = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * Handler for the OUT EP NAK interrupt. -+ */ -+static inline int32_t handle_out_ep_nak_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ doepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_ANY, "INTERRUPT Handler not implemented for %s\n", "OUT EP NAK"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.nak = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * Handler for the OUT EP NYET interrupt. -+ */ -+static inline int32_t handle_out_ep_nyet_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ doepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "OUT EP NYET"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.nyet = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that an IN EP has a pending Interrupt. -+ * The sequence for handling the IN EP interrupt is shown below: -+ * -# Read the Device All Endpoint Interrupt register -+ * -# Repeat the following for each IN EP interrupt bit set (from -+ * LSB to MSB). -+ * -# Read the Device Endpoint Interrupt (DIEPINTn) register -+ * -# If "Transfer Complete" call the request complete function -+ * -# If "Endpoint Disabled" complete the EP disable procedure. -+ * -# If "AHB Error Interrupt" log error -+ * -# If "Time-out Handshake" log error -+ * -# If "IN Token Received when TxFIFO Empty" write packet to Tx -+ * FIFO. -+ * -# If "IN Token EP Mismatch" (disable, this is handled by EP -+ * Mismatch Interrupt) -+ */ -+static int32_t dwc_otg_pcd_handle_in_ep_intr(dwc_otg_pcd_t * pcd) -+{ -+#define CLEAR_IN_EP_INTR(__core_if,__epnum,__intr) \ -+do { \ -+ diepint_data_t diepint = {.d32=0}; \ -+ diepint.b.__intr = 1; \ -+ DWC_WRITE_REG32(&__core_if->dev_if->in_ep_regs[__epnum]->diepint, \ -+ diepint.d32); \ -+} while (0) -+ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ diepint_data_t diepint = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ uint32_t ep_intr; -+ uint32_t epnum = 0; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, pcd); -+ -+ /* Read in the device interrupt bits */ -+ ep_intr = dwc_otg_read_dev_all_in_ep_intr(core_if); -+ -+ /* Service the Device IN interrupts for each endpoint */ -+ while (ep_intr) { -+ if (ep_intr & 0x1) { -+ uint32_t empty_msk; -+ /* Get EP pointer */ -+ ep = get_in_ep(pcd, epnum); -+ dwc_ep = &ep->dwc_ep; -+ -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); -+ empty_msk = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->dtknqr4_fifoemptymsk); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN EP INTERRUPT - %d\nepmty_msk - %8x diepctl - %8x\n", -+ epnum, empty_msk, depctl.d32); -+ -+ DWC_DEBUGPL(DBG_PCD, -+ "EP%d-%s: type=%d, mps=%d\n", -+ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), -+ dwc_ep->type, dwc_ep->maxpacket); -+ -+ diepint.d32 = -+ dwc_otg_read_dev_in_ep_intr(core_if, dwc_ep); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP %d Interrupt Register - 0x%x\n", epnum, -+ diepint.d32); -+ /* Transfer complete */ -+ if (diepint.b.xfercompl) { -+ /* Disable the NP Tx FIFO Empty -+ * Interrupt */ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32 -+ (&core_if->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ } else { -+ /* Disable the Tx FIFO Empty Interrupt for this EP */ -+ uint32_t fifoemptymsk = -+ 0x1 << dwc_ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ fifoemptymsk, 0); -+ } -+ /* Clear the bit in DIEPINTn for this interrupt */ -+ CLEAR_IN_EP_INTR(core_if, epnum, xfercompl); -+ -+ /* Complete the transfer */ -+ if (epnum == 0) { -+ handle_ep0(pcd); -+ } -+#ifdef DWC_EN_ISOC -+ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (!ep->stopped) -+ complete_iso_ep(pcd, ep); -+ } -+#endif /* DWC_EN_ISOC */ -+#ifdef DWC_UTE_PER_IO -+ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (!ep->stopped) -+ complete_xiso_ep(ep); -+ } -+#endif /* DWC_UTE_PER_IO */ -+ else { -+ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC && -+ dwc_ep->bInterval > 1) { -+ dwc_ep->frame_num += dwc_ep->bInterval; -+ if (dwc_ep->frame_num > 0x3FFF) -+ { -+ dwc_ep->frm_overrun = 1; -+ dwc_ep->frame_num &= 0x3FFF; -+ } else -+ dwc_ep->frm_overrun = 0; -+ } -+ complete_ep(ep); -+ if(diepint.b.nak) -+ CLEAR_IN_EP_INTR(core_if, epnum, nak); -+ } -+ } -+ /* Endpoint disable */ -+ if (diepint.b.epdisabled) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d IN disabled\n", -+ epnum); -+ handle_in_ep_disable_intr(pcd, epnum); -+ -+ /* Clear the bit in DIEPINTn for this interrupt */ -+ CLEAR_IN_EP_INTR(core_if, epnum, epdisabled); -+ } -+ /* AHB Error */ -+ if (diepint.b.ahberr) { -+ DWC_ERROR("EP%d IN AHB Error\n", epnum); -+ /* Clear the bit in DIEPINTn for this interrupt */ -+ CLEAR_IN_EP_INTR(core_if, epnum, ahberr); -+ } -+ /* TimeOUT Handshake (non-ISOC IN EPs) */ -+ if (diepint.b.timeout) { -+ DWC_ERROR("EP%d IN Time-out\n", epnum); -+ handle_in_ep_timeout_intr(pcd, epnum); -+ -+ CLEAR_IN_EP_INTR(core_if, epnum, timeout); -+ } -+ /** IN Token received with TxF Empty */ -+ if (diepint.b.intktxfemp) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d IN TKN TxFifo Empty\n", -+ epnum); -+ if (!ep->stopped && epnum != 0) { -+ -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.intktxfemp = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32 -+ (&dev_if->dev_global_regs->diepeachintmsk -+ [epnum], diepmsk.d32, 0); -+ } else { -+ DWC_MODIFY_REG32 -+ (&dev_if->dev_global_regs->diepmsk, -+ diepmsk.d32, 0); -+ } -+ } else if (core_if->dma_desc_enable -+ && epnum == 0 -+ && pcd->ep0state == -+ EP0_OUT_STATUS_PHASE) { -+ // EP0 IN set STALL -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs -+ [epnum]->diepctl); -+ -+ /* set the disable and stall bits */ -+ if (depctl.b.epena) { -+ depctl.b.epdis = 1; -+ } -+ depctl.b.stall = 1; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs -+ [epnum]->diepctl, -+ depctl.d32); -+ } -+ CLEAR_IN_EP_INTR(core_if, epnum, intktxfemp); -+ } -+ /** IN Token Received with EP mismatch */ -+ if (diepint.b.intknepmis) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d IN TKN EP Mismatch\n", epnum); -+ CLEAR_IN_EP_INTR(core_if, epnum, intknepmis); -+ } -+ /** IN Endpoint NAK Effective */ -+ if (diepint.b.inepnakeff) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d IN EP NAK Effective\n", -+ epnum); -+ /* Periodic EP */ -+ if (ep->disabling) { -+ depctl.d32 = 0; -+ depctl.b.snak = 1; -+ depctl.b.epdis = 1; -+ DWC_MODIFY_REG32(&dev_if->in_ep_regs -+ [epnum]->diepctl, -+ depctl.d32, -+ depctl.d32); -+ } -+ CLEAR_IN_EP_INTR(core_if, epnum, inepnakeff); -+ -+ } -+ -+ /** IN EP Tx FIFO Empty Intr */ -+ if (diepint.b.emptyintr) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d Tx FIFO Empty Intr \n", -+ epnum); -+ write_empty_tx_fifo(pcd, epnum); -+ -+ CLEAR_IN_EP_INTR(core_if, epnum, emptyintr); -+ -+ } -+ -+ /** IN EP BNA Intr */ -+ if (diepint.b.bna) { -+ CLEAR_IN_EP_INTR(core_if, epnum, bna); -+ if (core_if->dma_desc_enable) { -+#ifdef DWC_EN_ISOC -+ if (dwc_ep->type == -+ DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * This checking is performed to prevent first "false" BNA -+ * handling occuring right after reconnect -+ */ -+ if (dwc_ep->next_frame != -+ 0xffffffff) -+ dwc_otg_pcd_handle_iso_bna(ep); -+ } else -+#endif /* DWC_EN_ISOC */ -+ { -+ dwc_otg_pcd_handle_noniso_bna(ep); -+ } -+ } -+ } -+ /* NAK Interrutp */ -+ if (diepint.b.nak) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d IN NAK Interrupt\n", -+ epnum); -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ depctl_data_t depctl; -+ if (ep->dwc_ep.frame_num == 0xFFFFFFFF) { -+ ep->dwc_ep.frame_num = core_if->frame_num; -+ if (ep->dwc_ep.bInterval > 1) { -+ depctl.d32 = 0; -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); -+ if (ep->dwc_ep.frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ depctl.b.setd0pid = 0; -+ } else { -+ depctl.b.setd0pid = 1; -+ depctl.b.setd1pid = 0; -+ } -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[epnum]->diepctl, depctl.d32); -+ } -+ start_next_request(ep); -+ } -+ ep->dwc_ep.frame_num += ep->dwc_ep.bInterval; -+ if (dwc_ep->frame_num > 0x3FFF) { -+ dwc_ep->frm_overrun = 1; -+ dwc_ep->frame_num &= 0x3FFF; -+ } else -+ dwc_ep->frm_overrun = 0; -+ } -+ -+ CLEAR_IN_EP_INTR(core_if, epnum, nak); -+ } -+ } -+ epnum++; -+ ep_intr >>= 1; -+ } -+ -+ return 1; -+#undef CLEAR_IN_EP_INTR -+} -+ -+/** -+ * This interrupt indicates that an OUT EP has a pending Interrupt. -+ * The sequence for handling the OUT EP interrupt is shown below: -+ * -# Read the Device All Endpoint Interrupt register -+ * -# Repeat the following for each OUT EP interrupt bit set (from -+ * LSB to MSB). -+ * -# Read the Device Endpoint Interrupt (DOEPINTn) register -+ * -# If "Transfer Complete" call the request complete function -+ * -# If "Endpoint Disabled" complete the EP disable procedure. -+ * -# If "AHB Error Interrupt" log error -+ * -# If "Setup Phase Done" process Setup Packet (See Standard USB -+ * Command Processing) -+ */ -+static int32_t dwc_otg_pcd_handle_out_ep_intr(dwc_otg_pcd_t * pcd) -+{ -+#define CLEAR_OUT_EP_INTR(__core_if,__epnum,__intr) \ -+do { \ -+ doepint_data_t doepint = {.d32=0}; \ -+ doepint.b.__intr = 1; \ -+ DWC_WRITE_REG32(&__core_if->dev_if->out_ep_regs[__epnum]->doepint, \ -+ doepint.d32); \ -+} while (0) -+ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ uint32_t ep_intr; -+ doepint_data_t doepint = {.d32 = 0 }; -+ uint32_t epnum = 0; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ dctl_data_t dctl = {.d32 = 0 }; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); -+ -+ /* Read in the device interrupt bits */ -+ ep_intr = dwc_otg_read_dev_all_out_ep_intr(core_if); -+ -+ while (ep_intr) { -+ if (ep_intr & 0x1) { -+ /* Get EP pointer */ -+ ep = get_out_ep(pcd, epnum); -+ dwc_ep = &ep->dwc_ep; -+ -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP%d-%s: type=%d, mps=%d\n", -+ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), -+ dwc_ep->type, dwc_ep->maxpacket); -+#endif -+ doepint.d32 = -+ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep); -+ /* Moved this interrupt upper due to core deffect of asserting -+ * OUT EP 0 xfercompl along with stsphsrcvd in BDMA */ -+ if (doepint.b.stsphsercvd) { -+ deptsiz0_data_t deptsiz; -+ CLEAR_OUT_EP_INTR(core_if, epnum, stsphsercvd); -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doeptsiz); -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a -+ && core_if->dma_enable -+ && core_if->dma_desc_enable == 0 -+ && doepint.b.xfercompl -+ && deptsiz.b.xfersize == 24) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, -+ xfercompl); -+ doepint.b.xfercompl = 0; -+ ep0_out_start(core_if, pcd); -+ } -+ if ((core_if->dma_desc_enable) || -+ (core_if->dma_enable -+ && core_if->snpsid >= -+ OTG_CORE_REV_3_00a)) { -+ do_setup_in_status_phase(pcd); -+ } -+ } -+ /* Transfer complete */ -+ if (doepint.b.xfercompl) { -+ -+ if (epnum == 0) { -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepint), -+ doepint.d32); -+ DWC_DEBUGPL(DBG_PCDV, "DOEPCTL=%x \n", -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepctl)); -+ -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a -+ && core_if->dma_enable == 0) { -+ doepint_data_t doepint; -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doepint); -+ if (pcd->ep0state == EP0_IDLE && doepint.b.sr) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, sr); -+ goto exit_xfercompl; -+ } -+ } -+ /* In case of DDMA look at SR bit to go to the Data Stage */ -+ if (core_if->dma_desc_enable) { -+ dev_dma_desc_sts_t status = {.d32 = 0}; -+ if (pcd->ep0state == EP0_IDLE) { -+ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> -+ dev_if->setup_desc_index]->status.d32; -+ if(pcd->data_terminated) { -+ pcd->data_terminated = 0; -+ status.d32 = core_if->dev_if->out_desc_addr->status.d32; -+ dwc_memcpy(&pcd->setup_pkt->req, pcd->backup_buf, 8); -+ } -+ if (status.b.sr) { -+ if (doepint.b.setup) { -+ DWC_DEBUGPL(DBG_PCDV, "DMA DESC EP0_IDLE SR=1 setup=1\n"); -+ /* Already started data stage, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ /* Prepare for more setup packets */ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE || -+ pcd->ep0state == EP0_IN_DATA_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP0_IDLE SR=1 setup=0 new setup comes\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ } else { -+ dwc_otg_pcd_request_t *req; -+ dev_dma_desc_sts_t status = {.d32 = 0}; -+ diepint_data_t diepint0; -+ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ -+ if (pcd->ep0state == EP0_STALL || pcd->ep0state == EP0_DISCONNECT) { -+ DWC_ERROR("EP0 is stalled/disconnected\n"); -+ } -+ -+ /* Clear IN xfercompl if set */ -+ if (diepint0.b.xfercompl && (pcd->ep0state == EP0_IN_STATUS_PHASE -+ || pcd->ep0state == EP0_IN_DATA_PHASE)) { -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint, diepint0.d32); -+ } -+ -+ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> -+ dev_if->setup_desc_index]->status.d32; -+ -+ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len -+ && (pcd->ep0state == EP0_OUT_DATA_PHASE)) -+ status.d32 = core_if->dev_if->out_desc_addr->status.d32; -+ if (pcd->ep0state == EP0_OUT_STATUS_PHASE) -+ status.d32 = core_if->dev_if-> -+ out_desc_addr->status.d32; -+ -+ if (status.b.sr) { -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); -+ } else { -+ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && -+ pcd->ep0state == EP0_OUT_DATA_PHASE) { -+ /* Read arrived setup packet from req->buf */ -+ dwc_memcpy(&pcd->setup_pkt->req, -+ req->buf + ep->dwc_ep.xfer_count, 8); -+ } -+ req->actual = ep->dwc_ep.xfer_count; -+ dwc_otg_request_done(ep, req, -ECONNRESET); -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ } -+ pcd->ep0state = EP0_IDLE; -+ if (doepint.b.setup) { -+ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); -+ /* Data stage started, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ /* Prepare for setup packets if ep0in was enabled*/ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ } -+ } -+ if (core_if->snpsid >= OTG_CORE_REV_2_94a && core_if->dma_enable -+ && core_if->dma_desc_enable == 0) { -+ doepint_data_t doepint_temp = {.d32 = 0}; -+ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; -+ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->dwc_ep.num]->doepint); -+ doeptsize0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->dwc_ep.num]->doeptsiz); -+ if (pcd->ep0state == EP0_IDLE) { -+ if (doepint_temp.b.sr) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, sr); -+ } -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doepint); -+ if (doeptsize0.b.supcnt == 3) { -+ DWC_DEBUGPL(DBG_ANY, "Rolling over!!!!!!!\n"); -+ ep->dwc_ep.stp_rollover = 1; -+ } -+ if (doepint.b.setup) { -+retry: -+ /* Already started data stage, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ ep->dwc_ep.stp_rollover = 0; -+ /* Prepare for more setup packets */ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE || -+ pcd->ep0state == EP0_IN_DATA_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_ANY, -+ "EP0_IDLE SR=1 setup=0 new setup comes\n"); -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doepint); -+ if(doepint.b.setup) -+ goto retry; -+ ep0_out_start(core_if, pcd); -+ } -+ } else { -+ dwc_otg_pcd_request_t *req; -+ diepint_data_t diepint0 = {.d32 = 0}; -+ doepint_data_t doepint_temp = {.d32 = 0}; -+ depctl_data_t diepctl0; -+ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ diepctl0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepctl); -+ -+ if (pcd->ep0state == EP0_IN_DATA_PHASE -+ || pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ if (diepint0.b.xfercompl) { -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint, diepint0.d32); -+ } -+ if (diepctl0.b.epena) { -+ diepint_data_t diepint = {.d32 = 0}; -+ diepctl0.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepctl, diepctl0.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ } while (!diepint.b.inepnakeff); -+ diepint.b.inepnakeff = 1; -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint, diepint.d32); -+ diepctl0.d32 = 0; -+ diepctl0.b.epdis = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl, -+ diepctl0.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ } while (!diepint.b.epdisabled); -+ diepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepint, -+ diepint.d32); -+ } -+ } -+ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->dwc_ep.num]->doepint); -+ if (doepint_temp.b.sr) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, sr); -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); -+ } else { -+ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && -+ pcd->ep0state == EP0_OUT_DATA_PHASE) { -+ /* Read arrived setup packet from req->buf */ -+ dwc_memcpy(&pcd->setup_pkt->req, -+ req->buf + ep->dwc_ep.xfer_count, 8); -+ } -+ req->actual = ep->dwc_ep.xfer_count; -+ dwc_otg_request_done(ep, req, -ECONNRESET); -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ } -+ pcd->ep0state = EP0_IDLE; -+ if (doepint.b.setup) { -+ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); -+ /* Data stage started, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ /* Prepare for setup packets if ep0in was enabled*/ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ } -+ } -+ if (core_if->dma_enable == 0 || pcd->ep0state != EP0_IDLE) -+ handle_ep0(pcd); -+exit_xfercompl: -+ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", -+ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep), doepint.d32); -+ } else { -+ if (core_if->dma_desc_enable == 0 -+ || pcd->ep0state != EP0_IDLE) -+ handle_ep0(pcd); -+ } -+#ifdef DWC_EN_ISOC -+ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (doepint.b.pktdrpsts == 0) { -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, -+ epnum, -+ xfercompl); -+ complete_iso_ep(pcd, ep); -+ } else { -+ -+ doepint_data_t doepint = {.d32 = 0 }; -+ doepint.b.xfercompl = 1; -+ doepint.b.pktdrpsts = 1; -+ DWC_WRITE_REG32 -+ (&core_if->dev_if->out_ep_regs -+ [epnum]->doepint, -+ doepint.d32); -+ if (handle_iso_out_pkt_dropped -+ (core_if, dwc_ep)) { -+ complete_iso_ep(pcd, -+ ep); -+ } -+ } -+#endif /* DWC_EN_ISOC */ -+#ifdef DWC_UTE_PER_IO -+ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); -+ if (!ep->stopped) -+ complete_xiso_ep(ep); -+#endif /* DWC_UTE_PER_IO */ -+ } else { -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, -+ xfercompl); -+ -+ if (core_if->core_params->dev_out_nak) { -+ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[epnum]); -+ pcd->core_if->ep_xfer_info[epnum].state = 0; -+#ifdef DEBUG -+ print_memory_payload(pcd, dwc_ep); -+#endif -+ } -+ complete_ep(ep); -+ } -+ -+ } -+ -+ /* Endpoint disable */ -+ if (doepint.b.epdisabled) { -+ -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, epdisabled); -+ if (core_if->core_params->dev_out_nak) { -+#ifdef DEBUG -+ print_memory_payload(pcd, dwc_ep); -+#endif -+ /* In case of timeout condition */ -+ if (core_if->ep_xfer_info[epnum].state == 2) { -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dctl); -+ dctl.b.cgoutnak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ /* Unmask goutnakeff interrupt which was masked -+ * during handle nak out interrupt */ -+ gintmsk.b.goutnakeff = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ 0, gintmsk.d32); -+ -+ complete_ep(ep); -+ } -+ } -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) -+ { -+ dctl_data_t dctl; -+ gintmsk_data_t intr_mask = {.d32 = 0}; -+ dwc_otg_pcd_request_t *req = 0; -+ -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dctl); -+ dctl.b.cgoutnak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ -+ intr_mask.d32 = 0; -+ intr_mask.b.incomplisoout = 1; -+ -+ /* Get any pending requests */ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (!req) { -+ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); -+ } else { -+ dwc_otg_request_done(ep, req, 0); -+ start_next_request(ep); -+ } -+ } else { -+ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); -+ } -+ } -+ } -+ /* AHB Error */ -+ if (doepint.b.ahberr) { -+ DWC_ERROR("EP%d OUT AHB Error\n", epnum); -+ DWC_ERROR("EP%d DEPDMA=0x%08x \n", -+ epnum, core_if->dev_if->out_ep_regs[epnum]->doepdma); -+ CLEAR_OUT_EP_INTR(core_if, epnum, ahberr); -+ } -+ /* Setup Phase Done (contorl EPs) */ -+ if (doepint.b.setup) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "EP%d SETUP Done\n", epnum); -+#endif -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ -+ handle_ep0(pcd); -+ } -+ -+ /** OUT EP BNA Intr */ -+ if (doepint.b.bna) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, bna); -+ if (core_if->dma_desc_enable) { -+#ifdef DWC_EN_ISOC -+ if (dwc_ep->type == -+ DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * This checking is performed to prevent first "false" BNA -+ * handling occuring right after reconnect -+ */ -+ if (dwc_ep->next_frame != -+ 0xffffffff) -+ dwc_otg_pcd_handle_iso_bna(ep); -+ } else -+#endif /* DWC_EN_ISOC */ -+ { -+ dwc_otg_pcd_handle_noniso_bna(ep); -+ } -+ } -+ } -+ /* Babble Interrupt */ -+ if (doepint.b.babble) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Babble\n", -+ epnum); -+ handle_out_ep_babble_intr(pcd, epnum); -+ -+ CLEAR_OUT_EP_INTR(core_if, epnum, babble); -+ } -+ if (doepint.b.outtknepdis) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Token received when EP is \ -+ disabled\n",epnum); -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ doepmsk_data_t doepmsk = {.d32 = 0}; -+ ep->dwc_ep.frame_num = core_if->frame_num; -+ if (ep->dwc_ep.bInterval > 1) { -+ depctl_data_t depctl; -+ depctl.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[epnum]->doepctl); -+ if (ep->dwc_ep.frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ depctl.b.setd0pid = 0; -+ } else { -+ depctl.b.setd0pid = 1; -+ depctl.b.setd1pid = 0; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ out_ep_regs[epnum]->doepctl, depctl.d32); -+ } -+ start_next_request(ep); -+ doepmsk.b.outtknepdis = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ doepmsk.d32, 0); -+ } -+ CLEAR_OUT_EP_INTR(core_if, epnum, outtknepdis); -+ } -+ -+ /* NAK Interrutp */ -+ if (doepint.b.nak) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NAK\n", epnum); -+ handle_out_ep_nak_intr(pcd, epnum); -+ -+ CLEAR_OUT_EP_INTR(core_if, epnum, nak); -+ } -+ /* NYET Interrutp */ -+ if (doepint.b.nyet) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NYET\n", epnum); -+ handle_out_ep_nyet_intr(pcd, epnum); -+ -+ CLEAR_OUT_EP_INTR(core_if, epnum, nyet); -+ } -+ } -+ -+ epnum++; -+ ep_intr >>= 1; -+ } -+ -+ return 1; -+ -+#undef CLEAR_OUT_EP_INTR -+} -+static int drop_transfer(uint32_t trgt_fr, uint32_t curr_fr, uint8_t frm_overrun) -+{ -+ int retval = 0; -+ if(!frm_overrun && curr_fr >= trgt_fr) -+ retval = 1; -+ else if (frm_overrun -+ && (curr_fr >= trgt_fr && ((curr_fr - trgt_fr) < 0x3FFF / 2))) -+ retval = 1; -+ return retval; -+} -+/** -+ * Incomplete ISO IN Transfer Interrupt. -+ * This interrupt indicates one of the following conditions occurred -+ * while transmitting an ISOC transaction. -+ * - Corrupted IN Token for ISOC EP. -+ * - Packet not complete in FIFO. -+ * The follow actions will be taken: -+ * -# Determine the EP -+ * -# Set incomplete flag in dwc_ep structure -+ * -# Disable EP; when "Endpoint Disabled" interrupt is received -+ * Flush FIFO -+ */ -+int32_t dwc_otg_pcd_handle_incomplete_isoc_in_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+ -+#ifdef DWC_EN_ISOC -+ dwc_otg_dev_if_t *dev_if; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dsts_data_t dsts = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep; -+ int i; -+ -+ dev_if = GET_CORE_IF(pcd)->dev_if; -+ -+ for (i = 1; i <= dev_if->num_in_eps; ++i) { -+ dwc_ep = &pcd->in_ep[i].dwc_ep; -+ if (dwc_ep->active && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ -+ if (depctl.b.epdis && deptsiz.d32) { -+ set_current_pkt_info(GET_CORE_IF(pcd), dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr0; -+ } -+ -+ } -+ -+ dsts.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ dev_global_regs->dsts); -+ dwc_ep->next_frame = dsts.b.soffn; -+ -+ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF -+ (pcd), -+ dwc_ep); -+ } -+ } -+ } -+ -+#else -+ depctl_data_t depctl = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep; -+ dwc_otg_dev_if_t *dev_if; -+ int i; -+ dev_if = GET_CORE_IF(pcd)->dev_if; -+ -+ DWC_DEBUGPL(DBG_PCD,"Incomplete ISO IN \n"); -+ -+ for (i = 1; i <= dev_if->num_in_eps; ++i) { -+ dwc_ep = &pcd->in_ep[i-1].dwc_ep; -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (depctl.b.epena && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (drop_transfer(dwc_ep->frame_num, GET_CORE_IF(pcd)->frame_num, -+ dwc_ep->frm_overrun)) -+ { -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ depctl.b.snak = 1; -+ depctl.b.epdis = 1; -+ DWC_MODIFY_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32, depctl.d32); -+ } -+ } -+ } -+ -+ /*intr_mask.b.incomplisoin = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); */ -+#endif //DWC_EN_ISOC -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.incomplisoin = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * Incomplete ISO OUT Transfer Interrupt. -+ * -+ * This interrupt indicates that the core has dropped an ISO OUT -+ * packet. The following conditions can be the cause: -+ * - FIFO Full, the entire packet would not fit in the FIFO. -+ * - CRC Error -+ * - Corrupted Token -+ * The follow actions will be taken: -+ * -# Determine the EP -+ * -# Set incomplete flag in dwc_ep structure -+ * -# Read any data from the FIFO -+ * -# Disable EP. When "Endpoint Disabled" interrupt is received -+ * re-enable EP. -+ */ -+int32_t dwc_otg_pcd_handle_incomplete_isoc_out_intr(dwc_otg_pcd_t * pcd) -+{ -+ -+ gintsts_data_t gintsts; -+ -+#ifdef DWC_EN_ISOC -+ dwc_otg_dev_if_t *dev_if; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dsts_data_t dsts = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep; -+ int i; -+ -+ dev_if = GET_CORE_IF(pcd)->dev_if; -+ -+ for (i = 1; i <= dev_if->num_out_eps; ++i) { -+ dwc_ep = &pcd->in_ep[i].dwc_ep; -+ if (pcd->out_ep[i].dwc_ep.active && -+ pcd->out_ep[i].dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doeptsiz); -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); -+ -+ if (depctl.b.epdis && deptsiz.d32) { -+ set_current_pkt_info(GET_CORE_IF(pcd), -+ &pcd->out_ep[i].dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr0; -+ } -+ -+ } -+ -+ dsts.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ dev_global_regs->dsts); -+ dwc_ep->next_frame = dsts.b.soffn; -+ -+ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF -+ (pcd), -+ dwc_ep); -+ } -+ } -+ } -+#else -+ /** @todo implement ISR */ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep = NULL; -+ int i; -+ core_if = GET_CORE_IF(pcd); -+ -+ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { -+ dwc_ep = &pcd->out_ep[i].dwc_ep; -+ depctl.d32 = -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); -+ if (depctl.b.epena && depctl.b.dpid == (core_if->frame_num & 0x1)) { -+ core_if->dev_if->isoc_ep = dwc_ep; -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz); -+ break; -+ } -+ } -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ intr_mask.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ -+ if (!intr_mask.b.goutnakeff) { -+ /* Unmask it */ -+ intr_mask.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32); -+ } -+ if (!gintsts.b.goutnakeff) { -+ dctl.b.sgoutnak = 1; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+ -+ depctl.d32 = DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); -+ if (depctl.b.epena) { -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl, depctl.d32); -+ -+ intr_mask.d32 = 0; -+ intr_mask.b.incomplisoout = 1; -+ -+#endif /* DWC_EN_ISOC */ -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.incomplisoout = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This function handles the Global IN NAK Effective interrupt. -+ * -+ */ -+int32_t dwc_otg_pcd_handle_in_nak_effective(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ depctl_data_t diepctl = {.d32 = 0 }; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ int i; -+ -+ DWC_DEBUGPL(DBG_PCD, "Global IN NAK Effective\n"); -+ -+ /* Disable all active IN EPs */ -+ for (i = 0; i <= dev_if->num_in_eps; i++) { -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (!(diepctl.b.eptype & 1) && diepctl.b.epena) { -+ if (core_if->start_predict > 0) -+ core_if->start_predict++; -+ diepctl.b.epdis = 1; -+ diepctl.b.snak = 1; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, diepctl.d32); -+ } -+ } -+ -+ -+ /* Disable the Global IN NAK Effective Interrupt */ -+ intr_mask.b.ginnakeff = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.ginnakeff = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * OUT NAK Effective. -+ * -+ */ -+int32_t dwc_otg_pcd_handle_out_nak_effective(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ depctl_data_t doepctl; -+ int i; -+ -+ /* Disable the Global OUT NAK Effective Interrupt */ -+ intr_mask.b.goutnakeff = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* If DEV OUT NAK enabled*/ -+ if (pcd->core_if->core_params->dev_out_nak) { -+ /* Run over all out endpoints to determine the ep number on -+ * which the timeout has happened -+ */ -+ for (i = 0; i <= dev_if->num_out_eps; i++) { -+ if ( pcd->core_if->ep_xfer_info[i].state == 2 ) -+ break; -+ } -+ if (i > dev_if->num_out_eps) { -+ dctl_data_t dctl; -+ dctl.d32 = -+ DWC_READ_REG32(&dev_if->dev_global_regs->dctl); -+ dctl.b.cgoutnak = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ goto out; -+ } -+ -+ /* Disable the endpoint */ -+ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); -+ if (doepctl.b.epena) { -+ doepctl.b.epdis = 1; -+ doepctl.b.snak = 1; -+ } -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); -+ return 1; -+ } -+ /* We come here from Incomplete ISO OUT handler */ -+ if (dev_if->isoc_ep) { -+ dwc_ep_t *dwc_ep = (dwc_ep_t *)dev_if->isoc_ep; -+ uint32_t epnum = dwc_ep->num; -+ doepint_data_t doepint; -+ doepint.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[dwc_ep->num]->doepint); -+ dev_if->isoc_ep = NULL; -+ doepctl.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[epnum]->doepctl); -+ DWC_PRINTF("Before disable DOEPCTL = %08x\n", doepctl.d32); -+ if (doepctl.b.epena) { -+ doepctl.b.epdis = 1; -+ doepctl.b.snak = 1; -+ } -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[epnum]->doepctl, -+ doepctl.d32); -+ return 1; -+ } else -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", -+ "Global OUT NAK Effective\n"); -+ -+out: -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * PCD interrupt handler. -+ * -+ * The PCD handles the device interrupts. Many conditions can cause a -+ * device interrupt. When an interrupt occurs, the device interrupt -+ * service routine determines the cause of the interrupt and -+ * dispatches handling to the appropriate function. These interrupt -+ * handling functions are described below. -+ * -+ * All interrupt registers are processed from LSB to MSB. -+ * -+ */ -+int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+#ifdef VERBOSE -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+#endif -+ gintsts_data_t gintr_status; -+ int32_t retval = 0; -+ -+ /* Exit from ISR if core is hibernated */ -+ if (core_if->hibernation_suspend == 1) { -+ return retval; -+ } -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_ANY, "%s() gintsts=%08x gintmsk=%08x\n", -+ __func__, -+ DWC_READ_REG32(&global_regs->gintsts), -+ DWC_READ_REG32(&global_regs->gintmsk)); -+#endif -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_SPINLOCK(pcd->lock); -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%08x gintmsk=%08x\n", -+ __func__, -+ DWC_READ_REG32(&global_regs->gintsts), -+ DWC_READ_REG32(&global_regs->gintmsk)); -+#endif -+ -+ gintr_status.d32 = dwc_otg_read_core_intr(core_if); -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s: gintsts&gintmsk=%08x\n", -+ __func__, gintr_status.d32); -+ -+ if (gintr_status.b.sofintr) { -+ retval |= dwc_otg_pcd_handle_sof_intr(pcd); -+ } -+ if (gintr_status.b.rxstsqlvl) { -+ retval |= -+ dwc_otg_pcd_handle_rx_status_q_level_intr(pcd); -+ } -+ if (gintr_status.b.nptxfempty) { -+ retval |= dwc_otg_pcd_handle_np_tx_fifo_empty_intr(pcd); -+ } -+ if (gintr_status.b.goutnakeff) { -+ retval |= dwc_otg_pcd_handle_out_nak_effective(pcd); -+ } -+ if (gintr_status.b.i2cintr) { -+ retval |= dwc_otg_pcd_handle_i2c_intr(pcd); -+ } -+ if (gintr_status.b.erlysuspend) { -+ retval |= dwc_otg_pcd_handle_early_suspend_intr(pcd); -+ } -+ if (gintr_status.b.usbreset) { -+ retval |= dwc_otg_pcd_handle_usb_reset_intr(pcd); -+ } -+ if (gintr_status.b.enumdone) { -+ retval |= dwc_otg_pcd_handle_enum_done_intr(pcd); -+ } -+ if (gintr_status.b.isooutdrop) { -+ retval |= -+ dwc_otg_pcd_handle_isoc_out_packet_dropped_intr -+ (pcd); -+ } -+ if (gintr_status.b.eopframe) { -+ retval |= -+ dwc_otg_pcd_handle_end_periodic_frame_intr(pcd); -+ } -+ if (gintr_status.b.inepint) { -+ if (!core_if->multiproc_int_enable) { -+ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); -+ } -+ } -+ if (gintr_status.b.outepintr) { -+ if (!core_if->multiproc_int_enable) { -+ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); -+ } -+ } -+ if (gintr_status.b.epmismatch) { -+ retval |= dwc_otg_pcd_handle_ep_mismatch_intr(pcd); -+ } -+ if (gintr_status.b.fetsusp) { -+ retval |= dwc_otg_pcd_handle_ep_fetsusp_intr(pcd); -+ } -+ if (gintr_status.b.ginnakeff) { -+ retval |= dwc_otg_pcd_handle_in_nak_effective(pcd); -+ } -+ if (gintr_status.b.incomplisoin) { -+ retval |= -+ dwc_otg_pcd_handle_incomplete_isoc_in_intr(pcd); -+ } -+ if (gintr_status.b.incomplisoout) { -+ retval |= -+ dwc_otg_pcd_handle_incomplete_isoc_out_intr(pcd); -+ } -+ -+ /* In MPI mode Device Endpoints interrupts are asserted -+ * without setting outepintr and inepint bits set, so these -+ * Interrupt handlers are called without checking these bit-fields -+ */ -+ if (core_if->multiproc_int_enable) { -+ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); -+ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); -+ } -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%0x\n", __func__, -+ DWC_READ_REG32(&global_regs->gintsts)); -+#endif -+ DWC_SPINUNLOCK(pcd->lock); -+ } -+ return retval; -+} -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e799f15f294706ad7ac328dcb9ce68fbd0e71d38 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c -@@ -0,0 +1,1280 @@ -+ /* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ -+ * $Revision: #21 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+/** @file -+ * This file implements the Peripheral Controller Driver. -+ * -+ * The Peripheral Controller Driver (PCD) is responsible for -+ * translating requests from the Function Driver into the appropriate -+ * actions on the DWC_otg controller. It isolates the Function Driver -+ * from the specifics of the controller by providing an API to the -+ * Function Driver. -+ * -+ * The Peripheral Controller Driver for Linux will implement the -+ * Gadget API, so that the existing Gadget drivers can be used. -+ * (Gadget Driver is the Linux terminology for a Function Driver.) -+ * -+ * The Linux Gadget API is defined in the header file -+ * . The USB EP operations API is -+ * defined in the structure usb_ep_ops and the USB -+ * Controller API is defined in the structure -+ * usb_gadget_ops. -+ * -+ */ -+ -+#include "dwc_otg_os_dep.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_pcd.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_dbg.h" -+ -+extern bool fiq_enable; -+ -+static struct gadget_wrapper { -+ dwc_otg_pcd_t *pcd; -+ -+ struct usb_gadget gadget; -+ struct usb_gadget_driver *driver; -+ -+ struct usb_ep ep0; -+ struct usb_ep in_ep[16]; -+ struct usb_ep out_ep[16]; -+ -+} *gadget_wrapper; -+ -+/* Display the contents of the buffer */ -+extern void dump_msg(const u8 * buf, unsigned int length); -+/** -+ * Get the dwc_otg_pcd_ep_t* from usb_ep* pointer - NULL in case -+ * if the endpoint is not found -+ */ -+static struct dwc_otg_pcd_ep *ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) -+{ -+ int i; -+ if (pcd->ep0.priv == handle) { -+ return &pcd->ep0; -+ } -+ -+ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { -+ if (pcd->in_ep[i].priv == handle) -+ return &pcd->in_ep[i]; -+ if (pcd->out_ep[i].priv == handle) -+ return &pcd->out_ep[i]; -+ } -+ -+ return NULL; -+} -+ -+/* USB Endpoint Operations */ -+/* -+ * The following sections briefly describe the behavior of the Gadget -+ * API endpoint operations implemented in the DWC_otg driver -+ * software. Detailed descriptions of the generic behavior of each of -+ * these functions can be found in the Linux header file -+ * include/linux/usb_gadget.h. -+ * -+ * The Gadget API provides wrapper functions for each of the function -+ * pointers defined in usb_ep_ops. The Gadget Driver calls the wrapper -+ * function, which then calls the underlying PCD function. The -+ * following sections are named according to the wrapper -+ * functions. Within each section, the corresponding DWC_otg PCD -+ * function name is specified. -+ * -+ */ -+ -+/** -+ * This function is called by the Gadget Driver for each EP to be -+ * configured for the current configuration (SET_CONFIGURATION). -+ * -+ * This function initializes the dwc_otg_ep_t data structure, and then -+ * calls dwc_otg_ep_activate. -+ */ -+static int ep_enable(struct usb_ep *usb_ep, -+ const struct usb_endpoint_descriptor *ep_desc) -+{ -+ int retval; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, ep_desc); -+ -+ if (!usb_ep || !ep_desc || ep_desc->bDescriptorType != USB_DT_ENDPOINT) { -+ DWC_WARN("%s, bad ep or descriptor\n", __func__); -+ return -EINVAL; -+ } -+ if (usb_ep == &gadget_wrapper->ep0) { -+ DWC_WARN("%s, bad ep(0)\n", __func__); -+ return -EINVAL; -+ } -+ -+ /* Check FIFO size? */ -+ if (!ep_desc->wMaxPacketSize) { -+ DWC_WARN("%s, bad %s maxpacket\n", __func__, usb_ep->name); -+ return -ERANGE; -+ } -+ -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_WARN("%s, bogus device state\n", __func__); -+ return -ESHUTDOWN; -+ } -+ -+ /* Delete after check - MAS */ -+#if 0 -+ nat = (uint32_t) ep_desc->wMaxPacketSize; -+ printk(KERN_ALERT "%s: nat (before) =%d\n", __func__, nat); -+ nat = (nat >> 11) & 0x03; -+ printk(KERN_ALERT "%s: nat (after) =%d\n", __func__, nat); -+#endif -+ retval = dwc_otg_pcd_ep_enable(gadget_wrapper->pcd, -+ (const uint8_t *)ep_desc, -+ (void *)usb_ep); -+ if (retval) { -+ DWC_WARN("dwc_otg_pcd_ep_enable failed\n"); -+ return -EINVAL; -+ } -+ -+ usb_ep->maxpacket = le16_to_cpu(ep_desc->wMaxPacketSize); -+ -+ return 0; -+} -+ -+/** -+ * This function is called when an EP is disabled due to disconnect or -+ * change in configuration. Any pending requests will terminate with a -+ * status of -ESHUTDOWN. -+ * -+ * This function modifies the dwc_otg_ep_t data structure for this EP, -+ * and then calls dwc_otg_ep_deactivate. -+ */ -+static int ep_disable(struct usb_ep *usb_ep) -+{ -+ int retval; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, usb_ep); -+ if (!usb_ep) { -+ DWC_DEBUGPL(DBG_PCD, "%s, %s not enabled\n", __func__, -+ usb_ep ? usb_ep->name : NULL); -+ return -EINVAL; -+ } -+ -+ retval = dwc_otg_pcd_ep_disable(gadget_wrapper->pcd, usb_ep); -+ if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function allocates a request object to use with the specified -+ * endpoint. -+ * -+ * @param ep The endpoint to be used with with the request -+ * @param gfp_flags the GFP_* flags to use. -+ */ -+static struct usb_request *dwc_otg_pcd_alloc_request(struct usb_ep *ep, -+ gfp_t gfp_flags) -+{ -+ struct usb_request *usb_req; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d)\n", __func__, ep, gfp_flags); -+ if (0 == ep) { -+ DWC_WARN("%s() %s\n", __func__, "Invalid EP!\n"); -+ return 0; -+ } -+ usb_req = kzalloc(sizeof(*usb_req), gfp_flags); -+ if (0 == usb_req) { -+ DWC_WARN("%s() %s\n", __func__, "request allocation failed!\n"); -+ return 0; -+ } -+ usb_req->dma = DWC_DMA_ADDR_INVALID; -+ -+ return usb_req; -+} -+ -+/** -+ * This function frees a request object. -+ * -+ * @param ep The endpoint associated with the request -+ * @param req The request being freed -+ */ -+static void dwc_otg_pcd_free_request(struct usb_ep *ep, struct usb_request *req) -+{ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, ep, req); -+ -+ if (0 == ep || 0 == req) { -+ DWC_WARN("%s() %s\n", __func__, -+ "Invalid ep or req argument!\n"); -+ return; -+ } -+ -+ kfree(req); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+/** -+ * This function allocates an I/O buffer to be used for a transfer -+ * to/from the specified endpoint. -+ * -+ * @param usb_ep The endpoint to be used with with the request -+ * @param bytes The desired number of bytes for the buffer -+ * @param dma Pointer to the buffer's DMA address; must be valid -+ * @param gfp_flags the GFP_* flags to use. -+ * @return address of a new buffer or null is buffer could not be allocated. -+ */ -+static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *usb_ep, unsigned bytes, -+ dma_addr_t * dma, gfp_t gfp_flags) -+{ -+ void *buf; -+ dwc_otg_pcd_t *pcd = 0; -+ -+ pcd = gadget_wrapper->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d,%p,%0x)\n", __func__, usb_ep, bytes, -+ dma, gfp_flags); -+ -+ /* Check dword alignment */ -+ if ((bytes & 0x3UL) != 0) { -+ DWC_WARN("%s() Buffer size is not a multiple of" -+ "DWORD size (%d)", __func__, bytes); -+ } -+ -+ buf = dma_alloc_coherent(NULL, bytes, dma, gfp_flags); -+ WARN_ON(!buf); -+ -+ /* Check dword alignment */ -+ if (((int)buf & 0x3UL) != 0) { -+ DWC_WARN("%s() Buffer is not DWORD aligned (%p)", -+ __func__, buf); -+ } -+ -+ return buf; -+} -+ -+/** -+ * This function frees an I/O buffer that was allocated by alloc_buffer. -+ * -+ * @param usb_ep the endpoint associated with the buffer -+ * @param buf address of the buffer -+ * @param dma The buffer's DMA address -+ * @param bytes The number of bytes of the buffer -+ */ -+static void dwc_otg_pcd_free_buffer(struct usb_ep *usb_ep, void *buf, -+ dma_addr_t dma, unsigned bytes) -+{ -+ dwc_otg_pcd_t *pcd = 0; -+ -+ pcd = gadget_wrapper->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%0x,%d)\n", __func__, buf, dma, bytes); -+ -+ dma_free_coherent(NULL, bytes, buf, dma); -+} -+#endif -+ -+/** -+ * This function is used to submit an I/O Request to an EP. -+ * -+ * - When the request completes the request's completion callback -+ * is called to return the request to the driver. -+ * - An EP, except control EPs, may have multiple requests -+ * pending. -+ * - Once submitted the request cannot be examined or modified. -+ * - Each request is turned into one or more packets. -+ * - A BULK EP can queue any amount of data; the transfer is -+ * packetized. -+ * - Zero length Packets are specified with the request 'zero' -+ * flag. -+ */ -+static int ep_queue(struct usb_ep *usb_ep, struct usb_request *usb_req, -+ gfp_t gfp_flags) -+{ -+ dwc_otg_pcd_t *pcd; -+ struct dwc_otg_pcd_ep *ep = NULL; -+ int retval = 0, is_isoc_ep = 0; -+ dma_addr_t dma_addr = DWC_DMA_ADDR_INVALID; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p,%d)\n", -+ __func__, usb_ep, usb_req, gfp_flags); -+ -+ if (!usb_req || !usb_req->complete || !usb_req->buf) { -+ DWC_WARN("bad params\n"); -+ return -EINVAL; -+ } -+ -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ return -EINVAL; -+ } -+ -+ pcd = gadget_wrapper->pcd; -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", -+ gadget_wrapper->gadget.speed); -+ DWC_WARN("bogus device state\n"); -+ return -ESHUTDOWN; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "%s queue req %p, len %d buf %p\n", -+ usb_ep->name, usb_req, usb_req->length, usb_req->buf); -+ -+ usb_req->status = -EINPROGRESS; -+ usb_req->actual = 0; -+ -+ ep = ep_from_handle(pcd, usb_ep); -+ if (ep == NULL) -+ is_isoc_ep = 0; -+ else -+ is_isoc_ep = (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ? 1 : 0; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ dma_addr = usb_req->dma; -+#else -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; -+ struct device *dev = NULL; -+ -+ if (otg_dev != NULL) -+ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); -+ -+ if (usb_req->length != 0 && -+ usb_req->dma == DWC_DMA_ADDR_INVALID) { -+ dma_addr = dma_map_single(dev, usb_req->buf, -+ usb_req->length, -+ ep->dwc_ep.is_in ? -+ DMA_TO_DEVICE: -+ DMA_FROM_DEVICE); -+ } -+ } -+#endif -+ -+#ifdef DWC_UTE_PER_IO -+ if (is_isoc_ep == 1) { -+ retval = dwc_otg_pcd_xiso_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, -+ usb_req->length, usb_req->zero, usb_req, -+ gfp_flags == GFP_ATOMIC ? 1 : 0, &usb_req->ext_req); -+ if (retval) -+ return -EINVAL; -+ -+ return 0; -+ } -+#endif -+ retval = dwc_otg_pcd_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, -+ usb_req->length, usb_req->zero, usb_req, -+ gfp_flags == GFP_ATOMIC ? 1 : 0); -+ if (retval) { -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/** -+ * This function cancels an I/O request from an EP. -+ */ -+static int ep_dequeue(struct usb_ep *usb_ep, struct usb_request *usb_req) -+{ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, usb_req); -+ -+ if (!usb_ep || !usb_req) { -+ DWC_WARN("bad argument\n"); -+ return -EINVAL; -+ } -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_WARN("bogus device state\n"); -+ return -ESHUTDOWN; -+ } -+ if (dwc_otg_pcd_ep_dequeue(gadget_wrapper->pcd, usb_ep, usb_req)) { -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/** -+ * usb_ep_set_halt stalls an endpoint. -+ * -+ * usb_ep_clear_halt clears an endpoint halt and resets its data -+ * toggle. -+ * -+ * Both of these functions are implemented with the same underlying -+ * function. The behavior depends on the value argument. -+ * -+ * @param[in] usb_ep the Endpoint to halt or clear halt. -+ * @param[in] value -+ * - 0 means clear_halt. -+ * - 1 means set_halt, -+ * - 2 means clear stall lock flag. -+ * - 3 means set stall lock flag. -+ */ -+static int ep_halt(struct usb_ep *usb_ep, int value) -+{ -+ int retval = 0; -+ -+ DWC_DEBUGPL(DBG_PCD, "HALT %s %d\n", usb_ep->name, value); -+ -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ return -EINVAL; -+ } -+ -+ retval = dwc_otg_pcd_ep_halt(gadget_wrapper->pcd, usb_ep, value); -+ if (retval == -DWC_E_AGAIN) { -+ return -EAGAIN; -+ } else if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+ -+//#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) -+#if 0 -+/** -+ * ep_wedge: sets the halt feature and ignores clear requests -+ * -+ * @usb_ep: the endpoint being wedged -+ * -+ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) -+ * requests. If the gadget driver clears the halt status, it will -+ * automatically unwedge the endpoint. -+ * -+ * Returns zero on success, else negative errno. * -+ * Check usb_ep_set_wedge() at "usb_gadget.h" for details -+ */ -+static int ep_wedge(struct usb_ep *usb_ep) -+{ -+ int retval = 0; -+ -+ DWC_DEBUGPL(DBG_PCD, "WEDGE %s\n", usb_ep->name); -+ -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ return -EINVAL; -+ } -+ -+ retval = dwc_otg_pcd_ep_wedge(gadget_wrapper->pcd, usb_ep); -+ if (retval == -DWC_E_AGAIN) { -+ retval = -EAGAIN; -+ } else if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+#endif -+ -+#ifdef DWC_EN_ISOC -+/** -+ * This function is used to submit an ISOC Transfer Request to an EP. -+ * -+ * - Every time a sync period completes the request's completion callback -+ * is called to provide data to the gadget driver. -+ * - Once submitted the request cannot be modified. -+ * - Each request is turned into periodic data packets untill ISO -+ * Transfer is stopped.. -+ */ -+static int iso_ep_start(struct usb_ep *usb_ep, struct usb_iso_request *req, -+ gfp_t gfp_flags) -+{ -+ int retval = 0; -+ -+ if (!req || !req->process_buffer || !req->buf0 || !req->buf1) { -+ DWC_WARN("bad params\n"); -+ return -EINVAL; -+ } -+ -+ if (!usb_ep) { -+ DWC_PRINTF("bad params\n"); -+ return -EINVAL; -+ } -+ -+ req->status = -EINPROGRESS; -+ -+ retval = -+ dwc_otg_pcd_iso_ep_start(gadget_wrapper->pcd, usb_ep, req->buf0, -+ req->buf1, req->dma0, req->dma1, -+ req->sync_frame, req->data_pattern_frame, -+ req->data_per_frame, -+ req-> -+ flags & USB_REQ_ISO_ASAP ? -1 : -+ req->start_frame, req->buf_proc_intrvl, -+ req, gfp_flags == GFP_ATOMIC ? 1 : 0); -+ -+ if (retval) { -+ return -EINVAL; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function stops ISO EP Periodic Data Transfer. -+ */ -+static int iso_ep_stop(struct usb_ep *usb_ep, struct usb_iso_request *req) -+{ -+ int retval = 0; -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ } -+ -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", -+ gadget_wrapper->gadget.speed); -+ DWC_WARN("bogus device state\n"); -+ } -+ -+ dwc_otg_pcd_iso_ep_stop(gadget_wrapper->pcd, usb_ep, req); -+ if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+ -+static struct usb_iso_request *alloc_iso_request(struct usb_ep *ep, -+ int packets, gfp_t gfp_flags) -+{ -+ struct usb_iso_request *pReq = NULL; -+ uint32_t req_size; -+ -+ req_size = sizeof(struct usb_iso_request); -+ req_size += -+ (2 * packets * (sizeof(struct usb_gadget_iso_packet_descriptor))); -+ -+ pReq = kmalloc(req_size, gfp_flags); -+ if (!pReq) { -+ DWC_WARN("Can't allocate Iso Request\n"); -+ return 0; -+ } -+ pReq->iso_packet_desc0 = (void *)(pReq + 1); -+ -+ pReq->iso_packet_desc1 = pReq->iso_packet_desc0 + packets; -+ -+ return pReq; -+} -+ -+static void free_iso_request(struct usb_ep *ep, struct usb_iso_request *req) -+{ -+ kfree(req); -+} -+ -+static struct usb_isoc_ep_ops dwc_otg_pcd_ep_ops = { -+ .ep_ops = { -+ .enable = ep_enable, -+ .disable = ep_disable, -+ -+ .alloc_request = dwc_otg_pcd_alloc_request, -+ .free_request = dwc_otg_pcd_free_request, -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ .alloc_buffer = dwc_otg_pcd_alloc_buffer, -+ .free_buffer = dwc_otg_pcd_free_buffer, -+#endif -+ -+ .queue = ep_queue, -+ .dequeue = ep_dequeue, -+ -+ .set_halt = ep_halt, -+ .fifo_status = 0, -+ .fifo_flush = 0, -+ }, -+ .iso_ep_start = iso_ep_start, -+ .iso_ep_stop = iso_ep_stop, -+ .alloc_iso_request = alloc_iso_request, -+ .free_iso_request = free_iso_request, -+}; -+ -+#else -+ -+ int (*enable) (struct usb_ep *ep, -+ const struct usb_endpoint_descriptor *desc); -+ int (*disable) (struct usb_ep *ep); -+ -+ struct usb_request *(*alloc_request) (struct usb_ep *ep, -+ gfp_t gfp_flags); -+ void (*free_request) (struct usb_ep *ep, struct usb_request *req); -+ -+ int (*queue) (struct usb_ep *ep, struct usb_request *req, -+ gfp_t gfp_flags); -+ int (*dequeue) (struct usb_ep *ep, struct usb_request *req); -+ -+ int (*set_halt) (struct usb_ep *ep, int value); -+ int (*set_wedge) (struct usb_ep *ep); -+ -+ int (*fifo_status) (struct usb_ep *ep); -+ void (*fifo_flush) (struct usb_ep *ep); -+static struct usb_ep_ops dwc_otg_pcd_ep_ops = { -+ .enable = ep_enable, -+ .disable = ep_disable, -+ -+ .alloc_request = dwc_otg_pcd_alloc_request, -+ .free_request = dwc_otg_pcd_free_request, -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ .alloc_buffer = dwc_otg_pcd_alloc_buffer, -+ .free_buffer = dwc_otg_pcd_free_buffer, -+#else -+ /* .set_wedge = ep_wedge, */ -+ .set_wedge = NULL, /* uses set_halt instead */ -+#endif -+ -+ .queue = ep_queue, -+ .dequeue = ep_dequeue, -+ -+ .set_halt = ep_halt, -+ .fifo_status = 0, -+ .fifo_flush = 0, -+ -+}; -+ -+#endif /* _EN_ISOC_ */ -+/* Gadget Operations */ -+/** -+ * The following gadget operations will be implemented in the DWC_otg -+ * PCD. Functions in the API that are not described below are not -+ * implemented. -+ * -+ * The Gadget API provides wrapper functions for each of the function -+ * pointers defined in usb_gadget_ops. The Gadget Driver calls the -+ * wrapper function, which then calls the underlying PCD function. The -+ * following sections are named according to the wrapper functions -+ * (except for ioctl, which doesn't have a wrapper function). Within -+ * each section, the corresponding DWC_otg PCD function name is -+ * specified. -+ * -+ */ -+ -+/** -+ *Gets the USB Frame number of the last SOF. -+ */ -+static int get_frame_number(struct usb_gadget *gadget) -+{ -+ struct gadget_wrapper *d; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); -+ -+ if (gadget == 0) { -+ return -ENODEV; -+ } -+ -+ d = container_of(gadget, struct gadget_wrapper, gadget); -+ return dwc_otg_pcd_get_frame_number(d->pcd); -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+static int test_lpm_enabled(struct usb_gadget *gadget) -+{ -+ struct gadget_wrapper *d; -+ -+ d = container_of(gadget, struct gadget_wrapper, gadget); -+ -+ return dwc_otg_pcd_is_lpm_enabled(d->pcd); -+} -+#endif -+ -+/** -+ * Initiates Session Request Protocol (SRP) to wakeup the host if no -+ * session is in progress. If a session is already in progress, but -+ * the device is suspended, remote wakeup signaling is started. -+ * -+ */ -+static int wakeup(struct usb_gadget *gadget) -+{ -+ struct gadget_wrapper *d; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); -+ -+ if (gadget == 0) { -+ return -ENODEV; -+ } else { -+ d = container_of(gadget, struct gadget_wrapper, gadget); -+ } -+ dwc_otg_pcd_wakeup(d->pcd); -+ return 0; -+} -+ -+static const struct usb_gadget_ops dwc_otg_pcd_ops = { -+ .get_frame = get_frame_number, -+ .wakeup = wakeup, -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ .lpm_support = test_lpm_enabled, -+#endif -+ // current versions must always be self-powered -+}; -+ -+static int _setup(dwc_otg_pcd_t * pcd, uint8_t * bytes) -+{ -+ int retval = -DWC_E_NOT_SUPPORTED; -+ if (gadget_wrapper->driver && gadget_wrapper->driver->setup) { -+ retval = gadget_wrapper->driver->setup(&gadget_wrapper->gadget, -+ (struct usb_ctrlrequest -+ *)bytes); -+ } -+ -+ if (retval == -ENOTSUPP) { -+ retval = -DWC_E_NOT_SUPPORTED; -+ } else if (retval < 0) { -+ retval = -DWC_E_INVALID; -+ } -+ -+ return retval; -+} -+ -+#ifdef DWC_EN_ISOC -+static int _isoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int proc_buf_num) -+{ -+ int i, packet_count; -+ struct usb_gadget_iso_packet_descriptor *iso_packet = 0; -+ struct usb_iso_request *iso_req = req_handle; -+ -+ if (proc_buf_num) { -+ iso_packet = iso_req->iso_packet_desc1; -+ } else { -+ iso_packet = iso_req->iso_packet_desc0; -+ } -+ packet_count = -+ dwc_otg_pcd_get_iso_packet_count(pcd, ep_handle, req_handle); -+ for (i = 0; i < packet_count; ++i) { -+ int status; -+ int actual; -+ int offset; -+ dwc_otg_pcd_get_iso_packet_params(pcd, ep_handle, req_handle, -+ i, &status, &actual, &offset); -+ switch (status) { -+ case -DWC_E_NO_DATA: -+ status = -ENODATA; -+ break; -+ default: -+ if (status) { -+ DWC_PRINTF("unknown status in isoc packet\n"); -+ } -+ -+ } -+ iso_packet[i].status = status; -+ iso_packet[i].offset = offset; -+ iso_packet[i].actual_length = actual; -+ } -+ -+ iso_req->status = 0; -+ iso_req->process_buffer(ep_handle, iso_req); -+ -+ return 0; -+} -+#endif /* DWC_EN_ISOC */ -+ -+#ifdef DWC_UTE_PER_IO -+/** -+ * Copy the contents of the extended request to the Linux usb_request's -+ * extended part and call the gadget's completion. -+ * -+ * @param pcd Pointer to the pcd structure -+ * @param ep_handle Void pointer to the usb_ep structure -+ * @param req_handle Void pointer to the usb_request structure -+ * @param status Request status returned from the portable logic -+ * @param ereq_port Void pointer to the extended request structure -+ * created in the the portable part that contains the -+ * results of the processed iso packets. -+ */ -+static int _xisoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, void *ereq_port) -+{ -+ struct dwc_ute_iso_req_ext *ereqorg = NULL; -+ struct dwc_iso_xreq_port *ereqport = NULL; -+ struct dwc_ute_iso_packet_descriptor *desc_org = NULL; -+ int i; -+ struct usb_request *req; -+ //struct dwc_ute_iso_packet_descriptor * -+ //int status = 0; -+ -+ req = (struct usb_request *)req_handle; -+ ereqorg = &req->ext_req; -+ ereqport = (struct dwc_iso_xreq_port *)ereq_port; -+ desc_org = ereqorg->per_io_frame_descs; -+ -+ if (req && req->complete) { -+ /* Copy the request data from the portable logic to our request */ -+ for (i = 0; i < ereqport->pio_pkt_count; i++) { -+ desc_org[i].actual_length = -+ ereqport->per_io_frame_descs[i].actual_length; -+ desc_org[i].status = -+ ereqport->per_io_frame_descs[i].status; -+ } -+ -+ switch (status) { -+ case -DWC_E_SHUTDOWN: -+ req->status = -ESHUTDOWN; -+ break; -+ case -DWC_E_RESTART: -+ req->status = -ECONNRESET; -+ break; -+ case -DWC_E_INVALID: -+ req->status = -EINVAL; -+ break; -+ case -DWC_E_TIMEOUT: -+ req->status = -ETIMEDOUT; -+ break; -+ default: -+ req->status = status; -+ } -+ -+ /* And call the gadget's completion */ -+ req->complete(ep_handle, req); -+ } -+ -+ return 0; -+} -+#endif /* DWC_UTE_PER_IO */ -+ -+static int _complete(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, uint32_t actual) -+{ -+ struct usb_request *req = (struct usb_request *)req_handle; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) -+ struct dwc_otg_pcd_ep *ep = NULL; -+#endif -+ -+ if (req && req->complete) { -+ switch (status) { -+ case -DWC_E_SHUTDOWN: -+ req->status = -ESHUTDOWN; -+ break; -+ case -DWC_E_RESTART: -+ req->status = -ECONNRESET; -+ break; -+ case -DWC_E_INVALID: -+ req->status = -EINVAL; -+ break; -+ case -DWC_E_TIMEOUT: -+ req->status = -ETIMEDOUT; -+ break; -+ default: -+ req->status = status; -+ -+ } -+ -+ req->actual = actual; -+ DWC_SPINUNLOCK(pcd->lock); -+ req->complete(ep_handle, req); -+ DWC_SPINLOCK(pcd->lock); -+ } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) -+ ep = ep_from_handle(pcd, ep_handle); -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ if (req->length != 0) { -+ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; -+ struct device *dev = NULL; -+ -+ if (otg_dev != NULL) -+ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); -+ -+ dma_unmap_single(dev, req->dma, req->length, -+ ep->dwc_ep.is_in ? -+ DMA_TO_DEVICE: DMA_FROM_DEVICE); -+ } -+ } -+#endif -+ -+ return 0; -+} -+ -+static int _connect(dwc_otg_pcd_t * pcd, int speed) -+{ -+ gadget_wrapper->gadget.speed = speed; -+ return 0; -+} -+ -+static int _disconnect(dwc_otg_pcd_t * pcd) -+{ -+ if (gadget_wrapper->driver && gadget_wrapper->driver->disconnect) { -+ gadget_wrapper->driver->disconnect(&gadget_wrapper->gadget); -+ } -+ return 0; -+} -+ -+static int _resume(dwc_otg_pcd_t * pcd) -+{ -+ if (gadget_wrapper->driver && gadget_wrapper->driver->resume) { -+ gadget_wrapper->driver->resume(&gadget_wrapper->gadget); -+ } -+ -+ return 0; -+} -+ -+static int _suspend(dwc_otg_pcd_t * pcd) -+{ -+ if (gadget_wrapper->driver && gadget_wrapper->driver->suspend) { -+ gadget_wrapper->driver->suspend(&gadget_wrapper->gadget); -+ } -+ return 0; -+} -+ -+/** -+ * This function updates the otg values in the gadget structure. -+ */ -+static int _hnp_changed(dwc_otg_pcd_t * pcd) -+{ -+ -+ if (!gadget_wrapper->gadget.is_otg) -+ return 0; -+ -+ gadget_wrapper->gadget.b_hnp_enable = get_b_hnp_enable(pcd); -+ gadget_wrapper->gadget.a_hnp_support = get_a_hnp_support(pcd); -+ gadget_wrapper->gadget.a_alt_hnp_support = get_a_alt_hnp_support(pcd); -+ return 0; -+} -+ -+static int _reset(dwc_otg_pcd_t * pcd) -+{ -+ return 0; -+} -+ -+#ifdef DWC_UTE_CFI -+static int _cfi_setup(dwc_otg_pcd_t * pcd, void *cfi_req) -+{ -+ int retval = -DWC_E_INVALID; -+ if (gadget_wrapper->driver->cfi_feature_setup) { -+ retval = -+ gadget_wrapper->driver-> -+ cfi_feature_setup(&gadget_wrapper->gadget, -+ (struct cfi_usb_ctrlrequest *)cfi_req); -+ } -+ -+ return retval; -+} -+#endif -+ -+static const struct dwc_otg_pcd_function_ops fops = { -+ .complete = _complete, -+#ifdef DWC_EN_ISOC -+ .isoc_complete = _isoc_complete, -+#endif -+ .setup = _setup, -+ .disconnect = _disconnect, -+ .connect = _connect, -+ .resume = _resume, -+ .suspend = _suspend, -+ .hnp_changed = _hnp_changed, -+ .reset = _reset, -+#ifdef DWC_UTE_CFI -+ .cfi_setup = _cfi_setup, -+#endif -+#ifdef DWC_UTE_PER_IO -+ .xisoc_complete = _xisoc_complete, -+#endif -+}; -+ -+/** -+ * This function is the top level PCD interrupt handler. -+ */ -+static irqreturn_t dwc_otg_pcd_irq(int irq, void *dev) -+{ -+ dwc_otg_pcd_t *pcd = dev; -+ int32_t retval = IRQ_NONE; -+ -+ retval = dwc_otg_pcd_handle_intr(pcd); -+ if (retval != 0) { -+ S3C2410X_CLEAR_EINTPEND(); -+ } -+ return IRQ_RETVAL(retval); -+} -+ -+/** -+ * This function initialized the usb_ep structures to there default -+ * state. -+ * -+ * @param d Pointer on gadget_wrapper. -+ */ -+void gadget_add_eps(struct gadget_wrapper *d) -+{ -+ static const char *names[] = { -+ -+ "ep0", -+ "ep1in", -+ "ep2in", -+ "ep3in", -+ "ep4in", -+ "ep5in", -+ "ep6in", -+ "ep7in", -+ "ep8in", -+ "ep9in", -+ "ep10in", -+ "ep11in", -+ "ep12in", -+ "ep13in", -+ "ep14in", -+ "ep15in", -+ "ep1out", -+ "ep2out", -+ "ep3out", -+ "ep4out", -+ "ep5out", -+ "ep6out", -+ "ep7out", -+ "ep8out", -+ "ep9out", -+ "ep10out", -+ "ep11out", -+ "ep12out", -+ "ep13out", -+ "ep14out", -+ "ep15out" -+ }; -+ -+ int i; -+ struct usb_ep *ep; -+ int8_t dev_endpoints; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s\n", __func__); -+ -+ INIT_LIST_HEAD(&d->gadget.ep_list); -+ d->gadget.ep0 = &d->ep0; -+ d->gadget.speed = USB_SPEED_UNKNOWN; -+ -+ INIT_LIST_HEAD(&d->gadget.ep0->ep_list); -+ -+ /** -+ * Initialize the EP0 structure. -+ */ -+ ep = &d->ep0; -+ -+ /* Init the usb_ep structure. */ -+ ep->name = names[0]; -+ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; -+ -+ /** -+ * @todo NGS: What should the max packet size be set to -+ * here? Before EP type is set? -+ */ -+ ep->maxpacket = MAX_PACKET_SIZE; -+ dwc_otg_pcd_ep_enable(d->pcd, NULL, ep); -+ -+ list_add_tail(&ep->ep_list, &d->gadget.ep_list); -+ -+ /** -+ * Initialize the EP structures. -+ */ -+ dev_endpoints = d->pcd->core_if->dev_if->num_in_eps; -+ -+ for (i = 0; i < dev_endpoints; i++) { -+ ep = &d->in_ep[i]; -+ -+ /* Init the usb_ep structure. */ -+ ep->name = names[d->pcd->in_ep[i].dwc_ep.num]; -+ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; -+ -+ /** -+ * @todo NGS: What should the max packet size be set to -+ * here? Before EP type is set? -+ */ -+ ep->maxpacket = MAX_PACKET_SIZE; -+ list_add_tail(&ep->ep_list, &d->gadget.ep_list); -+ } -+ -+ dev_endpoints = d->pcd->core_if->dev_if->num_out_eps; -+ -+ for (i = 0; i < dev_endpoints; i++) { -+ ep = &d->out_ep[i]; -+ -+ /* Init the usb_ep structure. */ -+ ep->name = names[15 + d->pcd->out_ep[i].dwc_ep.num]; -+ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; -+ -+ /** -+ * @todo NGS: What should the max packet size be set to -+ * here? Before EP type is set? -+ */ -+ ep->maxpacket = MAX_PACKET_SIZE; -+ -+ list_add_tail(&ep->ep_list, &d->gadget.ep_list); -+ } -+ -+ /* remove ep0 from the list. There is a ep0 pointer. */ -+ list_del_init(&d->ep0.ep_list); -+ -+ d->ep0.maxpacket = MAX_EP0_SIZE; -+} -+ -+/** -+ * This function releases the Gadget device. -+ * required by device_unregister(). -+ * -+ * @todo Should this do something? Should it free the PCD? -+ */ -+static void dwc_otg_pcd_gadget_release(struct device *dev) -+{ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, dev); -+} -+ -+static struct gadget_wrapper *alloc_wrapper(dwc_bus_dev_t *_dev) -+{ -+ static char pcd_name[] = "dwc_otg_pcd"; -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ struct gadget_wrapper *d; -+ int retval; -+ -+ d = DWC_ALLOC(sizeof(*d)); -+ if (d == NULL) { -+ return NULL; -+ } -+ -+ memset(d, 0, sizeof(*d)); -+ -+ d->gadget.name = pcd_name; -+ d->pcd = otg_dev->pcd; -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+ strcpy(d->gadget.dev.bus_id, "gadget"); -+#else -+ dev_set_name(&d->gadget.dev, "%s", "gadget"); -+#endif -+ -+ d->gadget.dev.parent = &_dev->dev; -+ d->gadget.dev.release = dwc_otg_pcd_gadget_release; -+ d->gadget.ops = &dwc_otg_pcd_ops; -+ d->gadget.max_speed = dwc_otg_pcd_is_dualspeed(otg_dev->pcd) ? USB_SPEED_HIGH:USB_SPEED_FULL; -+ d->gadget.is_otg = dwc_otg_pcd_is_otg(otg_dev->pcd); -+ -+ d->driver = 0; -+ /* Register the gadget device */ -+ retval = device_register(&d->gadget.dev); -+ if (retval != 0) { -+ DWC_ERROR("device_register failed\n"); -+ DWC_FREE(d); -+ return NULL; -+ } -+ -+ return d; -+} -+ -+static void free_wrapper(struct gadget_wrapper *d) -+{ -+ if (d->driver) { -+ /* should have been done already by driver model core */ -+ DWC_WARN("driver '%s' is still registered\n", -+ d->driver->driver.name); -+#ifdef CONFIG_USB_GADGET -+ usb_gadget_unregister_driver(d->driver); -+#endif -+ } -+ -+ device_unregister(&d->gadget.dev); -+ DWC_FREE(d); -+} -+ -+/** -+ * This function initialized the PCD portion of the driver. -+ * -+ */ -+int pcd_init(dwc_bus_dev_t *_dev) -+{ -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ int retval = 0; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev=%p\n", __func__, _dev, otg_dev); -+ -+ otg_dev->pcd = dwc_otg_pcd_init(otg_dev); -+ -+ if (!otg_dev->pcd) { -+ DWC_ERROR("dwc_otg_pcd_init failed\n"); -+ return -ENOMEM; -+ } -+ -+ otg_dev->pcd->otg_dev = otg_dev; -+ gadget_wrapper = alloc_wrapper(_dev); -+ -+ /* -+ * Initialize EP structures -+ */ -+ gadget_add_eps(gadget_wrapper); -+ /* -+ * Setup interupt handler -+ */ -+#ifdef PLATFORM_INTERFACE -+ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", -+ platform_get_irq(_dev, fiq_enable ? 0 : 1)); -+ retval = request_irq(platform_get_irq(_dev, fiq_enable ? 0 : 1), dwc_otg_pcd_irq, -+ IRQF_SHARED, gadget_wrapper->gadget.name, -+ otg_dev->pcd); -+ if (retval != 0) { -+ DWC_ERROR("request of irq%d failed\n", -+ platform_get_irq(_dev, fiq_enable ? 0 : 1)); -+ free_wrapper(gadget_wrapper); -+ return -EBUSY; -+ } -+#else -+ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", -+ _dev->irq); -+ retval = request_irq(_dev->irq, dwc_otg_pcd_irq, -+ IRQF_SHARED | IRQF_DISABLED, -+ gadget_wrapper->gadget.name, otg_dev->pcd); -+ if (retval != 0) { -+ DWC_ERROR("request of irq%d failed\n", _dev->irq); -+ free_wrapper(gadget_wrapper); -+ return -EBUSY; -+ } -+#endif -+ -+ dwc_otg_pcd_start(gadget_wrapper->pcd, &fops); -+ -+ return retval; -+} -+ -+/** -+ * Cleanup the PCD. -+ */ -+void pcd_remove(dwc_bus_dev_t *_dev) -+{ -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ dwc_otg_pcd_t *pcd = otg_dev->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); -+ -+ /* -+ * Free the IRQ -+ */ -+#ifdef PLATFORM_INTERFACE -+ free_irq(platform_get_irq(_dev, 0), pcd); -+#else -+ free_irq(_dev->irq, pcd); -+#endif -+ dwc_otg_pcd_remove(otg_dev->pcd); -+ free_wrapper(gadget_wrapper); -+ otg_dev->pcd = 0; -+} -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_regs.h b/drivers/usb/host/dwc_otg/dwc_otg_regs.h -new file mode 100644 -index 0000000000000000000000000000000000000000..8e0e7b569f1ac00fdbf3cdd2e22102cf195c74b7 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_regs.h -@@ -0,0 +1,2550 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $ -+ * $Revision: #98 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_REGS_H__ -+#define __DWC_OTG_REGS_H__ -+ -+#include "dwc_otg_core_if.h" -+ -+/** -+ * @file -+ * -+ * This file contains the data structures for accessing the DWC_otg core registers. -+ * -+ * The application interfaces with the HS OTG core by reading from and -+ * writing to the Control and Status Register (CSR) space through the -+ * AHB Slave interface. These registers are 32 bits wide, and the -+ * addresses are 32-bit-block aligned. -+ * CSRs are classified as follows: -+ * - Core Global Registers -+ * - Device Mode Registers -+ * - Device Global Registers -+ * - Device Endpoint Specific Registers -+ * - Host Mode Registers -+ * - Host Global Registers -+ * - Host Port CSRs -+ * - Host Channel Specific Registers -+ * -+ * Only the Core Global registers can be accessed in both Device and -+ * Host modes. When the HS OTG core is operating in one mode, either -+ * Device or Host, the application must not access registers from the -+ * other mode. When the core switches from one mode to another, the -+ * registers in the new mode of operation must be reprogrammed as they -+ * would be after a power-on reset. -+ */ -+ -+/****************************************************************************/ -+/** DWC_otg Core registers . -+ * The dwc_otg_core_global_regs structure defines the size -+ * and relative field offsets for the Core Global registers. -+ */ -+typedef struct dwc_otg_core_global_regs { -+ /** OTG Control and Status Register. Offset: 000h */ -+ volatile uint32_t gotgctl; -+ /** OTG Interrupt Register. Offset: 004h */ -+ volatile uint32_t gotgint; -+ /**Core AHB Configuration Register. Offset: 008h */ -+ volatile uint32_t gahbcfg; -+ -+#define DWC_GLBINTRMASK 0x0001 -+#define DWC_DMAENABLE 0x0020 -+#define DWC_NPTXEMPTYLVL_EMPTY 0x0080 -+#define DWC_NPTXEMPTYLVL_HALFEMPTY 0x0000 -+#define DWC_PTXEMPTYLVL_EMPTY 0x0100 -+#define DWC_PTXEMPTYLVL_HALFEMPTY 0x0000 -+ -+ /**Core USB Configuration Register. Offset: 00Ch */ -+ volatile uint32_t gusbcfg; -+ /**Core Reset Register. Offset: 010h */ -+ volatile uint32_t grstctl; -+ /**Core Interrupt Register. Offset: 014h */ -+ volatile uint32_t gintsts; -+ /**Core Interrupt Mask Register. Offset: 018h */ -+ volatile uint32_t gintmsk; -+ /**Receive Status Queue Read Register (Read Only). Offset: 01Ch */ -+ volatile uint32_t grxstsr; -+ /**Receive Status Queue Read & POP Register (Read Only). Offset: 020h*/ -+ volatile uint32_t grxstsp; -+ /**Receive FIFO Size Register. Offset: 024h */ -+ volatile uint32_t grxfsiz; -+ /**Non Periodic Transmit FIFO Size Register. Offset: 028h */ -+ volatile uint32_t gnptxfsiz; -+ /**Non Periodic Transmit FIFO/Queue Status Register (Read -+ * Only). Offset: 02Ch */ -+ volatile uint32_t gnptxsts; -+ /**I2C Access Register. Offset: 030h */ -+ volatile uint32_t gi2cctl; -+ /**PHY Vendor Control Register. Offset: 034h */ -+ volatile uint32_t gpvndctl; -+ /**General Purpose Input/Output Register. Offset: 038h */ -+ volatile uint32_t ggpio; -+ /**User ID Register. Offset: 03Ch */ -+ volatile uint32_t guid; -+ /**Synopsys ID Register (Read Only). Offset: 040h */ -+ volatile uint32_t gsnpsid; -+ /**User HW Config1 Register (Read Only). Offset: 044h */ -+ volatile uint32_t ghwcfg1; -+ /**User HW Config2 Register (Read Only). Offset: 048h */ -+ volatile uint32_t ghwcfg2; -+#define DWC_SLAVE_ONLY_ARCH 0 -+#define DWC_EXT_DMA_ARCH 1 -+#define DWC_INT_DMA_ARCH 2 -+ -+#define DWC_MODE_HNP_SRP_CAPABLE 0 -+#define DWC_MODE_SRP_ONLY_CAPABLE 1 -+#define DWC_MODE_NO_HNP_SRP_CAPABLE 2 -+#define DWC_MODE_SRP_CAPABLE_DEVICE 3 -+#define DWC_MODE_NO_SRP_CAPABLE_DEVICE 4 -+#define DWC_MODE_SRP_CAPABLE_HOST 5 -+#define DWC_MODE_NO_SRP_CAPABLE_HOST 6 -+ -+ /**User HW Config3 Register (Read Only). Offset: 04Ch */ -+ volatile uint32_t ghwcfg3; -+ /**User HW Config4 Register (Read Only). Offset: 050h*/ -+ volatile uint32_t ghwcfg4; -+ /** Core LPM Configuration register Offset: 054h*/ -+ volatile uint32_t glpmcfg; -+ /** Global PowerDn Register Offset: 058h */ -+ volatile uint32_t gpwrdn; -+ /** Global DFIFO SW Config Register Offset: 05Ch */ -+ volatile uint32_t gdfifocfg; -+ /** ADP Control Register Offset: 060h */ -+ volatile uint32_t adpctl; -+ /** Reserved Offset: 064h-0FFh */ -+ volatile uint32_t reserved39[39]; -+ /** Host Periodic Transmit FIFO Size Register. Offset: 100h */ -+ volatile uint32_t hptxfsiz; -+ /** Device Periodic Transmit FIFO#n Register if dedicated fifos are disabled, -+ otherwise Device Transmit FIFO#n Register. -+ * Offset: 104h + (FIFO_Number-1)*04h, 1 <= FIFO Number <= 15 (1<=n<=15). */ -+ volatile uint32_t dtxfsiz[15]; -+} dwc_otg_core_global_regs_t; -+ -+/** -+ * This union represents the bit fields of the Core OTG Control -+ * and Status Register (GOTGCTL). Set the bits using the bit -+ * fields then write the d32 value to the register. -+ */ -+typedef union gotgctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned sesreqscs:1; -+ unsigned sesreq:1; -+ unsigned vbvalidoven:1; -+ unsigned vbvalidovval:1; -+ unsigned avalidoven:1; -+ unsigned avalidovval:1; -+ unsigned bvalidoven:1; -+ unsigned bvalidovval:1; -+ unsigned hstnegscs:1; -+ unsigned hnpreq:1; -+ unsigned hstsethnpen:1; -+ unsigned devhnpen:1; -+ unsigned reserved12_15:4; -+ unsigned conidsts:1; -+ unsigned dbnctime:1; -+ unsigned asesvld:1; -+ unsigned bsesvld:1; -+ unsigned otgver:1; -+ unsigned reserved1:1; -+ unsigned multvalidbc:5; -+ unsigned chirpen:1; -+ unsigned reserved28_31:4; -+ } b; -+} gotgctl_data_t; -+ -+/** -+ * This union represents the bit fields of the Core OTG Interrupt Register -+ * (GOTGINT). Set/clear the bits using the bit fields then write the d32 -+ * value to the register. -+ */ -+typedef union gotgint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Current Mode */ -+ unsigned reserved0_1:2; -+ -+ /** Session End Detected */ -+ unsigned sesenddet:1; -+ -+ unsigned reserved3_7:5; -+ -+ /** Session Request Success Status Change */ -+ unsigned sesreqsucstschng:1; -+ /** Host Negotiation Success Status Change */ -+ unsigned hstnegsucstschng:1; -+ -+ unsigned reserved10_16:7; -+ -+ /** Host Negotiation Detected */ -+ unsigned hstnegdet:1; -+ /** A-Device Timeout Change */ -+ unsigned adevtoutchng:1; -+ /** Debounce Done */ -+ unsigned debdone:1; -+ /** Multi-Valued input changed */ -+ unsigned mvic:1; -+ -+ unsigned reserved31_21:11; -+ -+ } b; -+} gotgint_data_t; -+ -+/** -+ * This union represents the bit fields of the Core AHB Configuration -+ * Register (GAHBCFG). Set/clear the bits using the bit fields then -+ * write the d32 value to the register. -+ */ -+typedef union gahbcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned glblintrmsk:1; -+#define DWC_GAHBCFG_GLBINT_ENABLE 1 -+ -+ unsigned hburstlen:4; -+#define DWC_GAHBCFG_INT_DMA_BURST_SINGLE 0 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR 1 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR4 3 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR8 5 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR16 7 -+ -+ unsigned dmaenable:1; -+#define DWC_GAHBCFG_DMAENABLE 1 -+ unsigned reserved:1; -+ unsigned nptxfemplvl_txfemplvl:1; -+ unsigned ptxfemplvl:1; -+#define DWC_GAHBCFG_TXFEMPTYLVL_EMPTY 1 -+#define DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0 -+ unsigned reserved9_20:12; -+ unsigned remmemsupp:1; -+ unsigned notialldmawrit:1; -+ unsigned ahbsingle:1; -+ unsigned reserved24_31:8; -+ } b; -+} gahbcfg_data_t; -+ -+/** -+ * This union represents the bit fields of the Core USB Configuration -+ * Register (GUSBCFG). Set the bits using the bit fields then write -+ * the d32 value to the register. -+ */ -+typedef union gusbcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned toutcal:3; -+ unsigned phyif:1; -+ unsigned ulpi_utmi_sel:1; -+ unsigned fsintf:1; -+ unsigned physel:1; -+ unsigned ddrsel:1; -+ unsigned srpcap:1; -+ unsigned hnpcap:1; -+ unsigned usbtrdtim:4; -+ unsigned reserved1:1; -+ unsigned phylpwrclksel:1; -+ unsigned otgutmifssel:1; -+ unsigned ulpi_fsls:1; -+ unsigned ulpi_auto_res:1; -+ unsigned ulpi_clk_sus_m:1; -+ unsigned ulpi_ext_vbus_drv:1; -+ unsigned ulpi_int_vbus_indicator:1; -+ unsigned term_sel_dl_pulse:1; -+ unsigned indicator_complement:1; -+ unsigned indicator_pass_through:1; -+ unsigned ulpi_int_prot_dis:1; -+ unsigned ic_usb_cap:1; -+ unsigned ic_traffic_pull_remove:1; -+ unsigned tx_end_delay:1; -+ unsigned force_host_mode:1; -+ unsigned force_dev_mode:1; -+ unsigned reserved31:1; -+ } b; -+} gusbcfg_data_t; -+ -+/** -+ * This union represents the bit fields of the Core Reset Register -+ * (GRSTCTL). Set/clear the bits using the bit fields then write the -+ * d32 value to the register. -+ */ -+typedef union grstctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Core Soft Reset (CSftRst) (Device and Host) -+ * -+ * The application can flush the control logic in the -+ * entire core using this bit. This bit resets the -+ * pipelines in the AHB Clock domain as well as the -+ * PHY Clock domain. -+ * -+ * The state machines are reset to an IDLE state, the -+ * control bits in the CSRs are cleared, all the -+ * transmit FIFOs and the receive FIFO are flushed. -+ * -+ * The status mask bits that control the generation of -+ * the interrupt, are cleared, to clear the -+ * interrupt. The interrupt status bits are not -+ * cleared, so the application can get the status of -+ * any events that occurred in the core after it has -+ * set this bit. -+ * -+ * Any transactions on the AHB are terminated as soon -+ * as possible following the protocol. Any -+ * transactions on the USB are terminated immediately. -+ * -+ * The configuration settings in the CSRs are -+ * unchanged, so the software doesn't have to -+ * reprogram these registers (Device -+ * Configuration/Host Configuration/Core System -+ * Configuration/Core PHY Configuration). -+ * -+ * The application can write to this bit, any time it -+ * wants to reset the core. This is a self clearing -+ * bit and the core clears this bit after all the -+ * necessary logic is reset in the core, which may -+ * take several clocks, depending on the current state -+ * of the core. -+ */ -+ unsigned csftrst:1; -+ /** Hclk Soft Reset -+ * -+ * The application uses this bit to reset the control logic in -+ * the AHB clock domain. Only AHB clock domain pipelines are -+ * reset. -+ */ -+ unsigned hsftrst:1; -+ /** Host Frame Counter Reset (Host Only)
-+ * -+ * The application can reset the (micro)frame number -+ * counter inside the core, using this bit. When the -+ * (micro)frame counter is reset, the subsequent SOF -+ * sent out by the core, will have a (micro)frame -+ * number of 0. -+ */ -+ unsigned hstfrm:1; -+ /** In Token Sequence Learning Queue Flush -+ * (INTknQFlsh) (Device Only) -+ */ -+ unsigned intknqflsh:1; -+ /** RxFIFO Flush (RxFFlsh) (Device and Host) -+ * -+ * The application can flush the entire Receive FIFO -+ * using this bit. The application must first -+ * ensure that the core is not in the middle of a -+ * transaction. The application should write into -+ * this bit, only after making sure that neither the -+ * DMA engine is reading from the RxFIFO nor the MAC -+ * is writing the data in to the FIFO. The -+ * application should wait until the bit is cleared -+ * before performing any other operations. This bit -+ * will takes 8 clocks (slowest of PHY or AHB clock) -+ * to clear. -+ */ -+ unsigned rxfflsh:1; -+ /** TxFIFO Flush (TxFFlsh) (Device and Host). -+ * -+ * This bit is used to selectively flush a single or -+ * all transmit FIFOs. The application must first -+ * ensure that the core is not in the middle of a -+ * transaction. The application should write into -+ * this bit, only after making sure that neither the -+ * DMA engine is writing into the TxFIFO nor the MAC -+ * is reading the data out of the FIFO. The -+ * application should wait until the core clears this -+ * bit, before performing any operations. This bit -+ * will takes 8 clocks (slowest of PHY or AHB clock) -+ * to clear. -+ */ -+ unsigned txfflsh:1; -+ -+ /** TxFIFO Number (TxFNum) (Device and Host). -+ * -+ * This is the FIFO number which needs to be flushed, -+ * using the TxFIFO Flush bit. This field should not -+ * be changed until the TxFIFO Flush bit is cleared by -+ * the core. -+ * - 0x0 : Non Periodic TxFIFO Flush -+ * - 0x1 : Periodic TxFIFO #1 Flush in device mode -+ * or Periodic TxFIFO in host mode -+ * - 0x2 : Periodic TxFIFO #2 Flush in device mode. -+ * - ... -+ * - 0xF : Periodic TxFIFO #15 Flush in device mode -+ * - 0x10: Flush all the Transmit NonPeriodic and -+ * Transmit Periodic FIFOs in the core -+ */ -+ unsigned txfnum:5; -+ /** Reserved */ -+ unsigned reserved11_29:19; -+ /** DMA Request Signal. Indicated DMA request is in -+ * probress. Used for debug purpose. */ -+ unsigned dmareq:1; -+ /** AHB Master Idle. Indicates the AHB Master State -+ * Machine is in IDLE condition. */ -+ unsigned ahbidle:1; -+ } b; -+} grstctl_t; -+ -+/** -+ * This union represents the bit fields of the Core Interrupt Mask -+ * Register (GINTMSK). Set/clear the bits using the bit fields then -+ * write the d32 value to the register. -+ */ -+typedef union gintmsk_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned reserved0:1; -+ unsigned modemismatch:1; -+ unsigned otgintr:1; -+ unsigned sofintr:1; -+ unsigned rxstsqlvl:1; -+ unsigned nptxfempty:1; -+ unsigned ginnakeff:1; -+ unsigned goutnakeff:1; -+ unsigned ulpickint:1; -+ unsigned i2cintr:1; -+ unsigned erlysuspend:1; -+ unsigned usbsuspend:1; -+ unsigned usbreset:1; -+ unsigned enumdone:1; -+ unsigned isooutdrop:1; -+ unsigned eopframe:1; -+ unsigned restoredone:1; -+ unsigned epmismatch:1; -+ unsigned inepintr:1; -+ unsigned outepintr:1; -+ unsigned incomplisoin:1; -+ unsigned incomplisoout:1; -+ unsigned fetsusp:1; -+ unsigned resetdet:1; -+ unsigned portintr:1; -+ unsigned hcintr:1; -+ unsigned ptxfempty:1; -+ unsigned lpmtranrcvd:1; -+ unsigned conidstschng:1; -+ unsigned disconnect:1; -+ unsigned sessreqintr:1; -+ unsigned wkupintr:1; -+ } b; -+} gintmsk_data_t; -+/** -+ * This union represents the bit fields of the Core Interrupt Register -+ * (GINTSTS). Set/clear the bits using the bit fields then write the -+ * d32 value to the register. -+ */ -+typedef union gintsts_data { -+ /** raw register data */ -+ uint32_t d32; -+#define DWC_SOF_INTR_MASK 0x0008 -+ /** register bits */ -+ struct { -+#define DWC_HOST_MODE 1 -+ unsigned curmode:1; -+ unsigned modemismatch:1; -+ unsigned otgintr:1; -+ unsigned sofintr:1; -+ unsigned rxstsqlvl:1; -+ unsigned nptxfempty:1; -+ unsigned ginnakeff:1; -+ unsigned goutnakeff:1; -+ unsigned ulpickint:1; -+ unsigned i2cintr:1; -+ unsigned erlysuspend:1; -+ unsigned usbsuspend:1; -+ unsigned usbreset:1; -+ unsigned enumdone:1; -+ unsigned isooutdrop:1; -+ unsigned eopframe:1; -+ unsigned restoredone:1; -+ unsigned epmismatch:1; -+ unsigned inepint:1; -+ unsigned outepintr:1; -+ unsigned incomplisoin:1; -+ unsigned incomplisoout:1; -+ unsigned fetsusp:1; -+ unsigned resetdet:1; -+ unsigned portintr:1; -+ unsigned hcintr:1; -+ unsigned ptxfempty:1; -+ unsigned lpmtranrcvd:1; -+ unsigned conidstschng:1; -+ unsigned disconnect:1; -+ unsigned sessreqintr:1; -+ unsigned wkupintr:1; -+ } b; -+} gintsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Device Receive Status Read and -+ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the d32 -+ * element then read out the bits using the bit elements. -+ */ -+typedef union device_grxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned epnum:4; -+ unsigned bcnt:11; -+ unsigned dpid:2; -+ -+#define DWC_STS_DATA_UPDT 0x2 // OUT Data Packet -+#define DWC_STS_XFER_COMP 0x3 // OUT Data Transfer Complete -+ -+#define DWC_DSTS_GOUT_NAK 0x1 // Global OUT NAK -+#define DWC_DSTS_SETUP_COMP 0x4 // Setup Phase Complete -+#define DWC_DSTS_SETUP_UPDT 0x6 // SETUP Packet -+ unsigned pktsts:4; -+ unsigned fn:4; -+ unsigned reserved25_31:7; -+ } b; -+} device_grxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Receive Status Read and -+ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the d32 -+ * element then read out the bits using the bit elements. -+ */ -+typedef union host_grxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned chnum:4; -+ unsigned bcnt:11; -+ unsigned dpid:2; -+ -+ unsigned pktsts:4; -+#define DWC_GRXSTS_PKTSTS_IN 0x2 -+#define DWC_GRXSTS_PKTSTS_IN_XFER_COMP 0x3 -+#define DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR 0x5 -+#define DWC_GRXSTS_PKTSTS_CH_HALTED 0x7 -+ -+ unsigned reserved21_31:11; -+ } b; -+} host_grxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the FIFO Size Registers (HPTXFSIZ, -+ * GNPTXFSIZ, DPTXFSIZn, DIEPTXFn). Read the register into the d32 element -+ * then read out the bits using the bit elements. -+ */ -+typedef union fifosize_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned startaddr:16; -+ unsigned depth:16; -+ } b; -+} fifosize_data_t; -+ -+/** -+ * This union represents the bit fields in the Non-Periodic Transmit -+ * FIFO/Queue Status Register (GNPTXSTS). Read the register into the -+ * d32 element then read out the bits using the bit -+ * elements. -+ */ -+typedef union gnptxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned nptxfspcavail:16; -+ unsigned nptxqspcavail:8; -+ /** Top of the Non-Periodic Transmit Request Queue -+ * - bit 24 - Terminate (Last entry for the selected -+ * channel/EP) -+ * - bits 26:25 - Token Type -+ * - 2'b00 - IN/OUT -+ * - 2'b01 - Zero Length OUT -+ * - 2'b10 - PING/Complete Split -+ * - 2'b11 - Channel Halt -+ * - bits 30:27 - Channel/EP Number -+ */ -+ unsigned nptxqtop_terminate:1; -+ unsigned nptxqtop_token:2; -+ unsigned nptxqtop_chnep:4; -+ unsigned reserved:1; -+ } b; -+} gnptxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Transmit -+ * FIFO Status Register (DTXFSTS). Read the register into the -+ * d32 element then read out the bits using the bit -+ * elements. -+ */ -+typedef union dtxfsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned txfspcavail:16; -+ unsigned reserved:16; -+ } b; -+} dtxfsts_data_t; -+ -+/** -+ * This union represents the bit fields in the I2C Control Register -+ * (I2CCTL). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union gi2cctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned rwdata:8; -+ unsigned regaddr:8; -+ unsigned addr:7; -+ unsigned i2cen:1; -+ unsigned ack:1; -+ unsigned i2csuspctl:1; -+ unsigned i2cdevaddr:2; -+ unsigned i2cdatse0:1; -+ unsigned reserved:1; -+ unsigned rw:1; -+ unsigned bsydne:1; -+ } b; -+} gi2cctl_data_t; -+ -+/** -+ * This union represents the bit fields in the PHY Vendor Control Register -+ * (GPVNDCTL). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union gpvndctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned regdata:8; -+ unsigned vctrl:8; -+ unsigned regaddr16_21:6; -+ unsigned regwr:1; -+ unsigned reserved23_24:2; -+ unsigned newregreq:1; -+ unsigned vstsbsy:1; -+ unsigned vstsdone:1; -+ unsigned reserved28_30:3; -+ unsigned disulpidrvr:1; -+ } b; -+} gpvndctl_data_t; -+ -+/** -+ * This union represents the bit fields in the General Purpose -+ * Input/Output Register (GGPIO). -+ * Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union ggpio_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned gpi:16; -+ unsigned gpo:16; -+ } b; -+} ggpio_data_t; -+ -+/** -+ * This union represents the bit fields in the User ID Register -+ * (GUID). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union guid_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned rwdata:32; -+ } b; -+} guid_data_t; -+ -+/** -+ * This union represents the bit fields in the Synopsys ID Register -+ * (GSNPSID). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union gsnpsid_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned rwdata:32; -+ } b; -+} gsnpsid_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config1 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg1_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned ep_dir0:2; -+ unsigned ep_dir1:2; -+ unsigned ep_dir2:2; -+ unsigned ep_dir3:2; -+ unsigned ep_dir4:2; -+ unsigned ep_dir5:2; -+ unsigned ep_dir6:2; -+ unsigned ep_dir7:2; -+ unsigned ep_dir8:2; -+ unsigned ep_dir9:2; -+ unsigned ep_dir10:2; -+ unsigned ep_dir11:2; -+ unsigned ep_dir12:2; -+ unsigned ep_dir13:2; -+ unsigned ep_dir14:2; -+ unsigned ep_dir15:2; -+ } b; -+} hwcfg1_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config2 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg2_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /* GHWCFG2 */ -+ unsigned op_mode:3; -+#define DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG 0 -+#define DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG 1 -+#define DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG 2 -+#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE 3 -+#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE 4 -+#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST 5 -+#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST 6 -+ -+ unsigned architecture:2; -+ unsigned point2point:1; -+ unsigned hs_phy_type:2; -+#define DWC_HWCFG2_HS_PHY_TYPE_NOT_SUPPORTED 0 -+#define DWC_HWCFG2_HS_PHY_TYPE_UTMI 1 -+#define DWC_HWCFG2_HS_PHY_TYPE_ULPI 2 -+#define DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI 3 -+ -+ unsigned fs_phy_type:2; -+ unsigned num_dev_ep:4; -+ unsigned num_host_chan:4; -+ unsigned perio_ep_supported:1; -+ unsigned dynamic_fifo:1; -+ unsigned multi_proc_int:1; -+ unsigned reserved21:1; -+ unsigned nonperio_tx_q_depth:2; -+ unsigned host_perio_tx_q_depth:2; -+ unsigned dev_token_q_depth:5; -+ unsigned otg_enable_ic_usb:1; -+ } b; -+} hwcfg2_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config3 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg3_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /* GHWCFG3 */ -+ unsigned xfer_size_cntr_width:4; -+ unsigned packet_size_cntr_width:3; -+ unsigned otg_func:1; -+ unsigned i2c:1; -+ unsigned vendor_ctrl_if:1; -+ unsigned optional_features:1; -+ unsigned synch_reset_type:1; -+ unsigned adp_supp:1; -+ unsigned otg_enable_hsic:1; -+ unsigned bc_support:1; -+ unsigned otg_lpm_en:1; -+ unsigned dfifo_depth:16; -+ } b; -+} hwcfg3_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config4 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg4_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned num_dev_perio_in_ep:4; -+ unsigned power_optimiz:1; -+ unsigned min_ahb_freq:1; -+ unsigned hiber:1; -+ unsigned xhiber:1; -+ unsigned reserved:6; -+ unsigned utmi_phy_data_width:2; -+ unsigned num_dev_mode_ctrl_ep:4; -+ unsigned iddig_filt_en:1; -+ unsigned vbus_valid_filt_en:1; -+ unsigned a_valid_filt_en:1; -+ unsigned b_valid_filt_en:1; -+ unsigned session_end_filt_en:1; -+ unsigned ded_fifo_en:1; -+ unsigned num_in_eps:4; -+ unsigned desc_dma:1; -+ unsigned desc_dma_dyn:1; -+ } b; -+} hwcfg4_data_t; -+ -+/** -+ * This union represents the bit fields of the Core LPM Configuration -+ * Register (GLPMCFG). Set the bits using bit fields then write -+ * the d32 value to the register. -+ */ -+typedef union glpmctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** LPM-Capable (LPMCap) (Device and Host) -+ * The application uses this bit to control -+ * the DWC_otg core LPM capabilities. -+ */ -+ unsigned lpm_cap_en:1; -+ /** LPM response programmed by application (AppL1Res) (Device) -+ * Handshake response to LPM token pre-programmed -+ * by device application software. -+ */ -+ unsigned appl_resp:1; -+ /** Host Initiated Resume Duration (HIRD) (Device and Host) -+ * In Host mode this field indicates the value of HIRD -+ * to be sent in an LPM transaction. -+ * In Device mode this field is updated with the -+ * Received LPM Token HIRD bmAttribute -+ * when an ACK/NYET/STALL response is sent -+ * to an LPM transaction. -+ */ -+ unsigned hird:4; -+ /** RemoteWakeEnable (bRemoteWake) (Device and Host) -+ * In Host mode this bit indicates the value of remote -+ * wake up to be sent in wIndex field of LPM transaction. -+ * In Device mode this field is updated with the -+ * Received LPM Token bRemoteWake bmAttribute -+ * when an ACK/NYET/STALL response is sent -+ * to an LPM transaction. -+ */ -+ unsigned rem_wkup_en:1; -+ /** Enable utmi_sleep_n (EnblSlpM) (Device and Host) -+ * The application uses this bit to control -+ * the utmi_sleep_n assertion to the PHY when in L1 state. -+ */ -+ unsigned en_utmi_sleep:1; -+ /** HIRD Threshold (HIRD_Thres) (Device and Host) -+ */ -+ unsigned hird_thres:5; -+ /** LPM Response (CoreL1Res) (Device and Host) -+ * In Host mode this bit contains handsake response to -+ * LPM transaction. -+ * In Device mode the response of the core to -+ * LPM transaction received is reflected in these two bits. -+ - 0x0 : ERROR (No handshake response) -+ - 0x1 : STALL -+ - 0x2 : NYET -+ - 0x3 : ACK -+ */ -+ unsigned lpm_resp:2; -+ /** Port Sleep Status (SlpSts) (Device and Host) -+ * This bit is set as long as a Sleep condition -+ * is present on the USB bus. -+ */ -+ unsigned prt_sleep_sts:1; -+ /** Sleep State Resume OK (L1ResumeOK) (Device and Host) -+ * Indicates that the application or host -+ * can start resume from Sleep state. -+ */ -+ unsigned sleep_state_resumeok:1; -+ /** LPM channel Index (LPM_Chnl_Indx) (Host) -+ * The channel number on which the LPM transaction -+ * has to be applied while sending -+ * an LPM transaction to the local device. -+ */ -+ unsigned lpm_chan_index:4; -+ /** LPM Retry Count (LPM_Retry_Cnt) (Host) -+ * Number host retries that would be performed -+ * if the device response was not valid response. -+ */ -+ unsigned retry_count:3; -+ /** Send LPM Transaction (SndLPM) (Host) -+ * When set by application software, -+ * an LPM transaction containing two tokens -+ * is sent. -+ */ -+ unsigned send_lpm:1; -+ /** LPM Retry status (LPM_RetryCnt_Sts) (Host) -+ * Number of LPM Host Retries still remaining -+ * to be transmitted for the current LPM sequence -+ */ -+ unsigned retry_count_sts:3; -+ unsigned reserved28_29:2; -+ /** In host mode once this bit is set, the host -+ * configures to drive the HSIC Idle state on the bus. -+ * It then waits for the device to initiate the Connect sequence. -+ * In device mode once this bit is set, the device waits for -+ * the HSIC Idle line state on the bus. Upon receving the Idle -+ * line state, it initiates the HSIC Connect sequence. -+ */ -+ unsigned hsic_connect:1; -+ /** This bit overrides and functionally inverts -+ * the if_select_hsic input port signal. -+ */ -+ unsigned inv_sel_hsic:1; -+ } b; -+} glpmcfg_data_t; -+ -+/** -+ * This union represents the bit fields of the Core ADP Timer, Control and -+ * Status Register (ADPTIMCTLSTS). Set the bits using bit fields then write -+ * the d32 value to the register. -+ */ -+typedef union adpctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Probe Discharge (PRB_DSCHG) -+ * These bits set the times for TADP_DSCHG. -+ * These bits are defined as follows: -+ * 2'b00 - 4 msec -+ * 2'b01 - 8 msec -+ * 2'b10 - 16 msec -+ * 2'b11 - 32 msec -+ */ -+ unsigned prb_dschg:2; -+ /** Probe Delta (PRB_DELTA) -+ * These bits set the resolution for RTIM value. -+ * The bits are defined in units of 32 kHz clock cycles as follows: -+ * 2'b00 - 1 cycles -+ * 2'b01 - 2 cycles -+ * 2'b10 - 3 cycles -+ * 2'b11 - 4 cycles -+ * For example if this value is chosen to 2'b01, it means that RTIM -+ * increments for every 3(three) 32Khz clock cycles. -+ */ -+ unsigned prb_delta:2; -+ /** Probe Period (PRB_PER) -+ * These bits sets the TADP_PRD as shown in Figure 4 as follows: -+ * 2'b00 - 0.625 to 0.925 sec (typical 0.775 sec) -+ * 2'b01 - 1.25 to 1.85 sec (typical 1.55 sec) -+ * 2'b10 - 1.9 to 2.6 sec (typical 2.275 sec) -+ * 2'b11 - Reserved -+ */ -+ unsigned prb_per:2; -+ /** These bits capture the latest time it took for VBUS to ramp from -+ * VADP_SINK to VADP_PRB. -+ * 0x000 - 1 cycles -+ * 0x001 - 2 cycles -+ * 0x002 - 3 cycles -+ * etc -+ * 0x7FF - 2048 cycles -+ * A time of 1024 cycles at 32 kHz corresponds to a time of 32 msec. -+ */ -+ unsigned rtim:11; -+ /** Enable Probe (EnaPrb) -+ * When programmed to 1'b1, the core performs a probe operation. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned enaprb:1; -+ /** Enable Sense (EnaSns) -+ * When programmed to 1'b1, the core performs a Sense operation. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned enasns:1; -+ /** ADP Reset (ADPRes) -+ * When set, ADP controller is reset. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adpres:1; -+ /** ADP Enable (ADPEn) -+ * When set, the core performs either ADP probing or sensing -+ * based on EnaPrb or EnaSns. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adpen:1; -+ /** ADP Probe Interrupt (ADP_PRB_INT) -+ * When this bit is set, it means that the VBUS -+ * voltage is greater than VADP_PRB or VADP_PRB is reached. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_prb_int:1; -+ /** -+ * ADP Sense Interrupt (ADP_SNS_INT) -+ * When this bit is set, it means that the VBUS voltage is greater than -+ * VADP_SNS value or VADP_SNS is reached. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_sns_int:1; -+ /** ADP Tomeout Interrupt (ADP_TMOUT_INT) -+ * This bit is relevant only for an ADP probe. -+ * When this bit is set, it means that the ramp time has -+ * completed ie ADPCTL.RTIM has reached its terminal value -+ * of 0x7FF. This is a debug feature that allows software -+ * to read the ramp time after each cycle. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_tmout_int:1; -+ /** ADP Probe Interrupt Mask (ADP_PRB_INT_MSK) -+ * When this bit is set, it unmasks the interrupt due to ADP_PRB_INT. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_prb_int_msk:1; -+ /** ADP Sense Interrupt Mask (ADP_SNS_INT_MSK) -+ * When this bit is set, it unmasks the interrupt due to ADP_SNS_INT. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_sns_int_msk:1; -+ /** ADP Timoeout Interrupt Mask (ADP_TMOUT_MSK) -+ * When this bit is set, it unmasks the interrupt due to ADP_TMOUT_INT. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_tmout_int_msk:1; -+ /** Access Request -+ * 2'b00 - Read/Write Valid (updated by the core) -+ * 2'b01 - Read -+ * 2'b00 - Write -+ * 2'b00 - Reserved -+ */ -+ unsigned ar:2; -+ /** Reserved */ -+ unsigned reserved29_31:3; -+ } b; -+} adpctl_data_t; -+ -+//////////////////////////////////////////// -+// Device Registers -+/** -+ * Device Global Registers. Offsets 800h-BFFh -+ * -+ * The following structures define the size and relative field offsets -+ * for the Device Mode Registers. -+ * -+ * These registers are visible only in Device mode and must not be -+ * accessed in Host mode, as the results are unknown. -+ */ -+typedef struct dwc_otg_dev_global_regs { -+ /** Device Configuration Register. Offset 800h */ -+ volatile uint32_t dcfg; -+ /** Device Control Register. Offset: 804h */ -+ volatile uint32_t dctl; -+ /** Device Status Register (Read Only). Offset: 808h */ -+ volatile uint32_t dsts; -+ /** Reserved. Offset: 80Ch */ -+ uint32_t unused; -+ /** Device IN Endpoint Common Interrupt Mask -+ * Register. Offset: 810h */ -+ volatile uint32_t diepmsk; -+ /** Device OUT Endpoint Common Interrupt Mask -+ * Register. Offset: 814h */ -+ volatile uint32_t doepmsk; -+ /** Device All Endpoints Interrupt Register. Offset: 818h */ -+ volatile uint32_t daint; -+ /** Device All Endpoints Interrupt Mask Register. Offset: -+ * 81Ch */ -+ volatile uint32_t daintmsk; -+ /** Device IN Token Queue Read Register-1 (Read Only). -+ * Offset: 820h */ -+ volatile uint32_t dtknqr1; -+ /** Device IN Token Queue Read Register-2 (Read Only). -+ * Offset: 824h */ -+ volatile uint32_t dtknqr2; -+ /** Device VBUS discharge Register. Offset: 828h */ -+ volatile uint32_t dvbusdis; -+ /** Device VBUS Pulse Register. Offset: 82Ch */ -+ volatile uint32_t dvbuspulse; -+ /** Device IN Token Queue Read Register-3 (Read Only). / -+ * Device Thresholding control register (Read/Write) -+ * Offset: 830h */ -+ volatile uint32_t dtknqr3_dthrctl; -+ /** Device IN Token Queue Read Register-4 (Read Only). / -+ * Device IN EPs empty Inr. Mask Register (Read/Write) -+ * Offset: 834h */ -+ volatile uint32_t dtknqr4_fifoemptymsk; -+ /** Device Each Endpoint Interrupt Register (Read Only). / -+ * Offset: 838h */ -+ volatile uint32_t deachint; -+ /** Device Each Endpoint Interrupt mask Register (Read/Write). / -+ * Offset: 83Ch */ -+ volatile uint32_t deachintmsk; -+ /** Device Each In Endpoint Interrupt mask Register (Read/Write). / -+ * Offset: 840h */ -+ volatile uint32_t diepeachintmsk[MAX_EPS_CHANNELS]; -+ /** Device Each Out Endpoint Interrupt mask Register (Read/Write). / -+ * Offset: 880h */ -+ volatile uint32_t doepeachintmsk[MAX_EPS_CHANNELS]; -+} dwc_otg_device_global_regs_t; -+ -+/** -+ * This union represents the bit fields in the Device Configuration -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. Write the -+ * d32 member to the dcfg register. -+ */ -+typedef union dcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Device Speed */ -+ unsigned devspd:2; -+ /** Non Zero Length Status OUT Handshake */ -+ unsigned nzstsouthshk:1; -+#define DWC_DCFG_SEND_STALL 1 -+ -+ unsigned ena32khzs:1; -+ /** Device Addresses */ -+ unsigned devaddr:7; -+ /** Periodic Frame Interval */ -+ unsigned perfrint:2; -+#define DWC_DCFG_FRAME_INTERVAL_80 0 -+#define DWC_DCFG_FRAME_INTERVAL_85 1 -+#define DWC_DCFG_FRAME_INTERVAL_90 2 -+#define DWC_DCFG_FRAME_INTERVAL_95 3 -+ -+ /** Enable Device OUT NAK for bulk in DDMA mode */ -+ unsigned endevoutnak:1; -+ -+ unsigned reserved14_17:4; -+ /** In Endpoint Mis-match count */ -+ unsigned epmscnt:5; -+ /** Enable Descriptor DMA in Device mode */ -+ unsigned descdma:1; -+ unsigned perschintvl:2; -+ unsigned resvalid:6; -+ } b; -+} dcfg_data_t; -+ -+/** -+ * This union represents the bit fields in the Device Control -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union dctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Remote Wakeup */ -+ unsigned rmtwkupsig:1; -+ /** Soft Disconnect */ -+ unsigned sftdiscon:1; -+ /** Global Non-Periodic IN NAK Status */ -+ unsigned gnpinnaksts:1; -+ /** Global OUT NAK Status */ -+ unsigned goutnaksts:1; -+ /** Test Control */ -+ unsigned tstctl:3; -+ /** Set Global Non-Periodic IN NAK */ -+ unsigned sgnpinnak:1; -+ /** Clear Global Non-Periodic IN NAK */ -+ unsigned cgnpinnak:1; -+ /** Set Global OUT NAK */ -+ unsigned sgoutnak:1; -+ /** Clear Global OUT NAK */ -+ unsigned cgoutnak:1; -+ /** Power-On Programming Done */ -+ unsigned pwronprgdone:1; -+ /** Reserved */ -+ unsigned reserved:1; -+ /** Global Multi Count */ -+ unsigned gmc:2; -+ /** Ignore Frame Number for ISOC EPs */ -+ unsigned ifrmnum:1; -+ /** NAK on Babble */ -+ unsigned nakonbble:1; -+ /** Enable Continue on BNA */ -+ unsigned encontonbna:1; -+ -+ unsigned reserved18_31:14; -+ } b; -+} dctl_data_t; -+ -+/** -+ * This union represents the bit fields in the Device Status -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union dsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Suspend Status */ -+ unsigned suspsts:1; -+ /** Enumerated Speed */ -+ unsigned enumspd:2; -+#define DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0 -+#define DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1 -+#define DWC_DSTS_ENUMSPD_LS_PHY_6MHZ 2 -+#define DWC_DSTS_ENUMSPD_FS_PHY_48MHZ 3 -+ /** Erratic Error */ -+ unsigned errticerr:1; -+ unsigned reserved4_7:4; -+ /** Frame or Microframe Number of the received SOF */ -+ unsigned soffn:14; -+ unsigned reserved22_31:10; -+ } b; -+} dsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Device IN EP Interrupt -+ * Register and the Device IN EP Common Mask Register. -+ * -+ * - Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union diepint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer complete mask */ -+ unsigned xfercompl:1; -+ /** Endpoint disable mask */ -+ unsigned epdisabled:1; -+ /** AHB Error mask */ -+ unsigned ahberr:1; -+ /** TimeOUT Handshake mask (non-ISOC EPs) */ -+ unsigned timeout:1; -+ /** IN Token received with TxF Empty mask */ -+ unsigned intktxfemp:1; -+ /** IN Token Received with EP mismatch mask */ -+ unsigned intknepmis:1; -+ /** IN Endpoint NAK Effective mask */ -+ unsigned inepnakeff:1; -+ /** Reserved */ -+ unsigned emptyintr:1; -+ -+ unsigned txfifoundrn:1; -+ -+ /** BNA Interrupt mask */ -+ unsigned bna:1; -+ -+ unsigned reserved10_12:3; -+ /** BNA Interrupt mask */ -+ unsigned nak:1; -+ -+ unsigned reserved14_31:18; -+ } b; -+} diepint_data_t; -+ -+/** -+ * This union represents the bit fields in the Device IN EP -+ * Common/Dedicated Interrupt Mask Register. -+ */ -+typedef union diepint_data diepmsk_data_t; -+ -+/** -+ * This union represents the bit fields in the Device OUT EP Interrupt -+ * Registerand Device OUT EP Common Interrupt Mask Register. -+ * -+ * - Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union doepint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer complete */ -+ unsigned xfercompl:1; -+ /** Endpoint disable */ -+ unsigned epdisabled:1; -+ /** AHB Error */ -+ unsigned ahberr:1; -+ /** Setup Phase Done (contorl EPs) */ -+ unsigned setup:1; -+ /** OUT Token Received when Endpoint Disabled */ -+ unsigned outtknepdis:1; -+ -+ unsigned stsphsercvd:1; -+ /** Back-to-Back SETUP Packets Received */ -+ unsigned back2backsetup:1; -+ -+ unsigned reserved7:1; -+ /** OUT packet Error */ -+ unsigned outpkterr:1; -+ /** BNA Interrupt */ -+ unsigned bna:1; -+ -+ unsigned reserved10:1; -+ /** Packet Drop Status */ -+ unsigned pktdrpsts:1; -+ /** Babble Interrupt */ -+ unsigned babble:1; -+ /** NAK Interrupt */ -+ unsigned nak:1; -+ /** NYET Interrupt */ -+ unsigned nyet:1; -+ /** Bit indicating setup packet received */ -+ unsigned sr:1; -+ -+ unsigned reserved16_31:16; -+ } b; -+} doepint_data_t; -+ -+/** -+ * This union represents the bit fields in the Device OUT EP -+ * Common/Dedicated Interrupt Mask Register. -+ */ -+typedef union doepint_data doepmsk_data_t; -+ -+/** -+ * This union represents the bit fields in the Device All EP Interrupt -+ * and Mask Registers. -+ * - Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union daint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** IN Endpoint bits */ -+ unsigned in:16; -+ /** OUT Endpoint bits */ -+ unsigned out:16; -+ } ep; -+ struct { -+ /** IN Endpoint bits */ -+ unsigned inep0:1; -+ unsigned inep1:1; -+ unsigned inep2:1; -+ unsigned inep3:1; -+ unsigned inep4:1; -+ unsigned inep5:1; -+ unsigned inep6:1; -+ unsigned inep7:1; -+ unsigned inep8:1; -+ unsigned inep9:1; -+ unsigned inep10:1; -+ unsigned inep11:1; -+ unsigned inep12:1; -+ unsigned inep13:1; -+ unsigned inep14:1; -+ unsigned inep15:1; -+ /** OUT Endpoint bits */ -+ unsigned outep0:1; -+ unsigned outep1:1; -+ unsigned outep2:1; -+ unsigned outep3:1; -+ unsigned outep4:1; -+ unsigned outep5:1; -+ unsigned outep6:1; -+ unsigned outep7:1; -+ unsigned outep8:1; -+ unsigned outep9:1; -+ unsigned outep10:1; -+ unsigned outep11:1; -+ unsigned outep12:1; -+ unsigned outep13:1; -+ unsigned outep14:1; -+ unsigned outep15:1; -+ } b; -+} daint_data_t; -+ -+/** -+ * This union represents the bit fields in the Device IN Token Queue -+ * Read Registers. -+ * - Read the register into the d32 member. -+ * - READ-ONLY Register -+ */ -+typedef union dtknq1_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** In Token Queue Write Pointer */ -+ unsigned intknwptr:5; -+ /** Reserved */ -+ unsigned reserved05_06:2; -+ /** write pointer has wrapped. */ -+ unsigned wrap_bit:1; -+ /** EP Numbers of IN Tokens 0 ... 4 */ -+ unsigned epnums0_5:24; -+ } b; -+} dtknq1_data_t; -+ -+/** -+ * This union represents Threshold control Register -+ * - Read and write the register into the d32 member. -+ * - READ-WRITABLE Register -+ */ -+typedef union dthrctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** non ISO Tx Thr. Enable */ -+ unsigned non_iso_thr_en:1; -+ /** ISO Tx Thr. Enable */ -+ unsigned iso_thr_en:1; -+ /** Tx Thr. Length */ -+ unsigned tx_thr_len:9; -+ /** AHB Threshold ratio */ -+ unsigned ahb_thr_ratio:2; -+ /** Reserved */ -+ unsigned reserved13_15:3; -+ /** Rx Thr. Enable */ -+ unsigned rx_thr_en:1; -+ /** Rx Thr. Length */ -+ unsigned rx_thr_len:9; -+ unsigned reserved26:1; -+ /** Arbiter Parking Enable*/ -+ unsigned arbprken:1; -+ /** Reserved */ -+ unsigned reserved28_31:4; -+ } b; -+} dthrctl_data_t; -+ -+/** -+ * Device Logical IN Endpoint-Specific Registers. Offsets -+ * 900h-AFCh -+ * -+ * There will be one set of endpoint registers per logical endpoint -+ * implemented. -+ * -+ * These registers are visible only in Device mode and must not be -+ * accessed in Host mode, as the results are unknown. -+ */ -+typedef struct dwc_otg_dev_in_ep_regs { -+ /** Device IN Endpoint Control Register. Offset:900h + -+ * (ep_num * 20h) + 00h */ -+ volatile uint32_t diepctl; -+ /** Reserved. Offset:900h + (ep_num * 20h) + 04h */ -+ uint32_t reserved04; -+ /** Device IN Endpoint Interrupt Register. Offset:900h + -+ * (ep_num * 20h) + 08h */ -+ volatile uint32_t diepint; -+ /** Reserved. Offset:900h + (ep_num * 20h) + 0Ch */ -+ uint32_t reserved0C; -+ /** Device IN Endpoint Transfer Size -+ * Register. Offset:900h + (ep_num * 20h) + 10h */ -+ volatile uint32_t dieptsiz; -+ /** Device IN Endpoint DMA Address Register. Offset:900h + -+ * (ep_num * 20h) + 14h */ -+ volatile uint32_t diepdma; -+ /** Device IN Endpoint Transmit FIFO Status Register. Offset:900h + -+ * (ep_num * 20h) + 18h */ -+ volatile uint32_t dtxfsts; -+ /** Device IN Endpoint DMA Buffer Register. Offset:900h + -+ * (ep_num * 20h) + 1Ch */ -+ volatile uint32_t diepdmab; -+} dwc_otg_dev_in_ep_regs_t; -+ -+/** -+ * Device Logical OUT Endpoint-Specific Registers. Offsets: -+ * B00h-CFCh -+ * -+ * There will be one set of endpoint registers per logical endpoint -+ * implemented. -+ * -+ * These registers are visible only in Device mode and must not be -+ * accessed in Host mode, as the results are unknown. -+ */ -+typedef struct dwc_otg_dev_out_ep_regs { -+ /** Device OUT Endpoint Control Register. Offset:B00h + -+ * (ep_num * 20h) + 00h */ -+ volatile uint32_t doepctl; -+ /** Reserved. Offset:B00h + (ep_num * 20h) + 04h */ -+ uint32_t reserved04; -+ /** Device OUT Endpoint Interrupt Register. Offset:B00h + -+ * (ep_num * 20h) + 08h */ -+ volatile uint32_t doepint; -+ /** Reserved. Offset:B00h + (ep_num * 20h) + 0Ch */ -+ uint32_t reserved0C; -+ /** Device OUT Endpoint Transfer Size Register. Offset: -+ * B00h + (ep_num * 20h) + 10h */ -+ volatile uint32_t doeptsiz; -+ /** Device OUT Endpoint DMA Address Register. Offset:B00h -+ * + (ep_num * 20h) + 14h */ -+ volatile uint32_t doepdma; -+ /** Reserved. Offset:B00h + * (ep_num * 20h) + 18h */ -+ uint32_t unused; -+ /** Device OUT Endpoint DMA Buffer Register. Offset:B00h -+ * + (ep_num * 20h) + 1Ch */ -+ uint32_t doepdmab; -+} dwc_otg_dev_out_ep_regs_t; -+ -+/** -+ * This union represents the bit fields in the Device EP Control -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union depctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Maximum Packet Size -+ * IN/OUT EPn -+ * IN/OUT EP0 - 2 bits -+ * 2'b00: 64 Bytes -+ * 2'b01: 32 -+ * 2'b10: 16 -+ * 2'b11: 8 */ -+ unsigned mps:11; -+#define DWC_DEP0CTL_MPS_64 0 -+#define DWC_DEP0CTL_MPS_32 1 -+#define DWC_DEP0CTL_MPS_16 2 -+#define DWC_DEP0CTL_MPS_8 3 -+ -+ /** Next Endpoint -+ * IN EPn/IN EP0 -+ * OUT EPn/OUT EP0 - reserved */ -+ unsigned nextep:4; -+ -+ /** USB Active Endpoint */ -+ unsigned usbactep:1; -+ -+ /** Endpoint DPID (INTR/Bulk IN and OUT endpoints) -+ * This field contains the PID of the packet going to -+ * be received or transmitted on this endpoint. The -+ * application should program the PID of the first -+ * packet going to be received or transmitted on this -+ * endpoint , after the endpoint is -+ * activated. Application use the SetD1PID and -+ * SetD0PID fields of this register to program either -+ * D0 or D1 PID. -+ * -+ * The encoding for this field is -+ * - 0: D0 -+ * - 1: D1 -+ */ -+ unsigned dpid:1; -+ -+ /** NAK Status */ -+ unsigned naksts:1; -+ -+ /** Endpoint Type -+ * 2'b00: Control -+ * 2'b01: Isochronous -+ * 2'b10: Bulk -+ * 2'b11: Interrupt */ -+ unsigned eptype:2; -+ -+ /** Snoop Mode -+ * OUT EPn/OUT EP0 -+ * IN EPn/IN EP0 - reserved */ -+ unsigned snp:1; -+ -+ /** Stall Handshake */ -+ unsigned stall:1; -+ -+ /** Tx Fifo Number -+ * IN EPn/IN EP0 -+ * OUT EPn/OUT EP0 - reserved */ -+ unsigned txfnum:4; -+ -+ /** Clear NAK */ -+ unsigned cnak:1; -+ /** Set NAK */ -+ unsigned snak:1; -+ /** Set DATA0 PID (INTR/Bulk IN and OUT endpoints) -+ * Writing to this field sets the Endpoint DPID (DPID) -+ * field in this register to DATA0. Set Even -+ * (micro)frame (SetEvenFr) (ISO IN and OUT Endpoints) -+ * Writing to this field sets the Even/Odd -+ * (micro)frame (EO_FrNum) field to even (micro) -+ * frame. -+ */ -+ unsigned setd0pid:1; -+ /** Set DATA1 PID (INTR/Bulk IN and OUT endpoints) -+ * Writing to this field sets the Endpoint DPID (DPID) -+ * field in this register to DATA1 Set Odd -+ * (micro)frame (SetOddFr) (ISO IN and OUT Endpoints) -+ * Writing to this field sets the Even/Odd -+ * (micro)frame (EO_FrNum) field to odd (micro) frame. -+ */ -+ unsigned setd1pid:1; -+ -+ /** Endpoint Disable */ -+ unsigned epdis:1; -+ /** Endpoint Enable */ -+ unsigned epena:1; -+ } b; -+} depctl_data_t; -+ -+/** -+ * This union represents the bit fields in the Device EP Transfer -+ * Size Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union deptsiz_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer size */ -+ unsigned xfersize:19; -+/** Max packet count for EP (pow(2,10)-1) */ -+#define MAX_PKT_CNT 1023 -+ /** Packet Count */ -+ unsigned pktcnt:10; -+ /** Multi Count - Periodic IN endpoints */ -+ unsigned mc:2; -+ unsigned reserved:1; -+ } b; -+} deptsiz_data_t; -+ -+/** -+ * This union represents the bit fields in the Device EP 0 Transfer -+ * Size Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union deptsiz0_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer size */ -+ unsigned xfersize:7; -+ /** Reserved */ -+ unsigned reserved7_18:12; -+ /** Packet Count */ -+ unsigned pktcnt:2; -+ /** Reserved */ -+ unsigned reserved21_28:8; -+ /**Setup Packet Count (DOEPTSIZ0 Only) */ -+ unsigned supcnt:2; -+ unsigned reserved31; -+ } b; -+} deptsiz0_data_t; -+ -+///////////////////////////////////////////////// -+// DMA Descriptor Specific Structures -+// -+ -+/** Buffer status definitions */ -+ -+#define BS_HOST_READY 0x0 -+#define BS_DMA_BUSY 0x1 -+#define BS_DMA_DONE 0x2 -+#define BS_HOST_BUSY 0x3 -+ -+/** Receive/Transmit status definitions */ -+ -+#define RTS_SUCCESS 0x0 -+#define RTS_BUFFLUSH 0x1 -+#define RTS_RESERVED 0x2 -+#define RTS_BUFERR 0x3 -+ -+/** -+ * This union represents the bit fields in the DMA Descriptor -+ * status quadlet. Read the quadlet into the d32 member then -+ * set/clear the bits using the bit, b_iso_out and -+ * b_iso_in elements. -+ */ -+typedef union dev_dma_desc_sts { -+ /** raw register data */ -+ uint32_t d32; -+ /** quadlet bits */ -+ struct { -+ /** Received number of bytes */ -+ unsigned bytes:16; -+ /** NAK bit - only for OUT EPs */ -+ unsigned nak:1; -+ unsigned reserved17_22:6; -+ /** Multiple Transfer - only for OUT EPs */ -+ unsigned mtrf:1; -+ /** Setup Packet received - only for OUT EPs */ -+ unsigned sr:1; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** Short Packet */ -+ unsigned sp:1; -+ /** Last */ -+ unsigned l:1; -+ /** Receive Status */ -+ unsigned sts:2; -+ /** Buffer Status */ -+ unsigned bs:2; -+ } b; -+ -+//#ifdef DWC_EN_ISOC -+ /** iso out quadlet bits */ -+ struct { -+ /** Received number of bytes */ -+ unsigned rxbytes:11; -+ -+ unsigned reserved11:1; -+ /** Frame Number */ -+ unsigned framenum:11; -+ /** Received ISO Data PID */ -+ unsigned pid:2; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** Short Packet */ -+ unsigned sp:1; -+ /** Last */ -+ unsigned l:1; -+ /** Receive Status */ -+ unsigned rxsts:2; -+ /** Buffer Status */ -+ unsigned bs:2; -+ } b_iso_out; -+ -+ /** iso in quadlet bits */ -+ struct { -+ /** Transmited number of bytes */ -+ unsigned txbytes:12; -+ /** Frame Number */ -+ unsigned framenum:11; -+ /** Transmited ISO Data PID */ -+ unsigned pid:2; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** Short Packet */ -+ unsigned sp:1; -+ /** Last */ -+ unsigned l:1; -+ /** Transmit Status */ -+ unsigned txsts:2; -+ /** Buffer Status */ -+ unsigned bs:2; -+ } b_iso_in; -+//#endif /* DWC_EN_ISOC */ -+} dev_dma_desc_sts_t; -+ -+/** -+ * DMA Descriptor structure -+ * -+ * DMA Descriptor structure contains two quadlets: -+ * Status quadlet and Data buffer pointer. -+ */ -+typedef struct dwc_otg_dev_dma_desc { -+ /** DMA Descriptor status quadlet */ -+ dev_dma_desc_sts_t status; -+ /** DMA Descriptor data buffer pointer */ -+ uint32_t buf; -+} dwc_otg_dev_dma_desc_t; -+ -+/** -+ * The dwc_otg_dev_if structure contains information needed to manage -+ * the DWC_otg controller acting in device mode. It represents the -+ * programming view of the device-specific aspects of the controller. -+ */ -+typedef struct dwc_otg_dev_if { -+ /** Pointer to device Global registers. -+ * Device Global Registers starting at offset 800h -+ */ -+ dwc_otg_device_global_regs_t *dev_global_regs; -+#define DWC_DEV_GLOBAL_REG_OFFSET 0x800 -+ -+ /** -+ * Device Logical IN Endpoint-Specific Registers 900h-AFCh -+ */ -+ dwc_otg_dev_in_ep_regs_t *in_ep_regs[MAX_EPS_CHANNELS]; -+#define DWC_DEV_IN_EP_REG_OFFSET 0x900 -+#define DWC_EP_REG_OFFSET 0x20 -+ -+ /** Device Logical OUT Endpoint-Specific Registers B00h-CFCh */ -+ dwc_otg_dev_out_ep_regs_t *out_ep_regs[MAX_EPS_CHANNELS]; -+#define DWC_DEV_OUT_EP_REG_OFFSET 0xB00 -+ -+ /* Device configuration information */ -+ uint8_t speed; /**< Device Speed 0: Unknown, 1: LS, 2:FS, 3: HS */ -+ uint8_t num_in_eps; /**< Number # of Tx EP range: 0-15 exept ep0 */ -+ uint8_t num_out_eps; /**< Number # of Rx EP range: 0-15 exept ep 0*/ -+ -+ /** Size of periodic FIFOs (Bytes) */ -+ uint16_t perio_tx_fifo_size[MAX_PERIO_FIFOS]; -+ -+ /** Size of Tx FIFOs (Bytes) */ -+ uint16_t tx_fifo_size[MAX_TX_FIFOS]; -+ -+ /** Thresholding enable flags and length varaiables **/ -+ uint16_t rx_thr_en; -+ uint16_t iso_tx_thr_en; -+ uint16_t non_iso_tx_thr_en; -+ -+ uint16_t rx_thr_length; -+ uint16_t tx_thr_length; -+ -+ /** -+ * Pointers to the DMA Descriptors for EP0 Control -+ * transfers (virtual and physical) -+ */ -+ -+ /** 2 descriptors for SETUP packets */ -+ dwc_dma_t dma_setup_desc_addr[2]; -+ dwc_otg_dev_dma_desc_t *setup_desc_addr[2]; -+ -+ /** Pointer to Descriptor with latest SETUP packet */ -+ dwc_otg_dev_dma_desc_t *psetup; -+ -+ /** Index of current SETUP handler descriptor */ -+ uint32_t setup_desc_index; -+ -+ /** Descriptor for Data In or Status In phases */ -+ dwc_dma_t dma_in_desc_addr; -+ dwc_otg_dev_dma_desc_t *in_desc_addr; -+ -+ /** Descriptor for Data Out or Status Out phases */ -+ dwc_dma_t dma_out_desc_addr; -+ dwc_otg_dev_dma_desc_t *out_desc_addr; -+ -+ /** Setup Packet Detected - if set clear NAK when queueing */ -+ uint32_t spd; -+ /** Isoc ep pointer on which incomplete happens */ -+ void *isoc_ep; -+ -+} dwc_otg_dev_if_t; -+ -+///////////////////////////////////////////////// -+// Host Mode Register Structures -+// -+/** -+ * The Host Global Registers structure defines the size and relative -+ * field offsets for the Host Mode Global Registers. Host Global -+ * Registers offsets 400h-7FFh. -+*/ -+typedef struct dwc_otg_host_global_regs { -+ /** Host Configuration Register. Offset: 400h */ -+ volatile uint32_t hcfg; -+ /** Host Frame Interval Register. Offset: 404h */ -+ volatile uint32_t hfir; -+ /** Host Frame Number / Frame Remaining Register. Offset: 408h */ -+ volatile uint32_t hfnum; -+ /** Reserved. Offset: 40Ch */ -+ uint32_t reserved40C; -+ /** Host Periodic Transmit FIFO/ Queue Status Register. Offset: 410h */ -+ volatile uint32_t hptxsts; -+ /** Host All Channels Interrupt Register. Offset: 414h */ -+ volatile uint32_t haint; -+ /** Host All Channels Interrupt Mask Register. Offset: 418h */ -+ volatile uint32_t haintmsk; -+ /** Host Frame List Base Address Register . Offset: 41Ch */ -+ volatile uint32_t hflbaddr; -+} dwc_otg_host_global_regs_t; -+ -+/** -+ * This union represents the bit fields in the Host Configuration Register. -+ * Read the register into the d32 member then set/clear the bits using -+ * the bit elements. Write the d32 member to the hcfg register. -+ */ -+typedef union hcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** FS/LS Phy Clock Select */ -+ unsigned fslspclksel:2; -+#define DWC_HCFG_30_60_MHZ 0 -+#define DWC_HCFG_48_MHZ 1 -+#define DWC_HCFG_6_MHZ 2 -+ -+ /** FS/LS Only Support */ -+ unsigned fslssupp:1; -+ unsigned reserved3_6:4; -+ /** Enable 32-KHz Suspend Mode */ -+ unsigned ena32khzs:1; -+ /** Resume Validation Periiod */ -+ unsigned resvalid:8; -+ unsigned reserved16_22:7; -+ /** Enable Scatter/gather DMA in Host mode */ -+ unsigned descdma:1; -+ /** Frame List Entries */ -+ unsigned frlisten:2; -+ /** Enable Periodic Scheduling */ -+ unsigned perschedena:1; -+ unsigned reserved27_30:4; -+ unsigned modechtimen:1; -+ } b; -+} hcfg_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Frame Remaing/Number -+ * Register. -+ */ -+typedef union hfir_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned frint:16; -+ unsigned hfirrldctrl:1; -+ unsigned reserved:15; -+ } b; -+} hfir_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Frame Remaing/Number -+ * Register. -+ */ -+typedef union hfnum_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned frnum:16; -+#define DWC_HFNUM_MAX_FRNUM 0x3FFF -+ unsigned frrem:16; -+ } b; -+} hfnum_data_t; -+ -+typedef union hptxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned ptxfspcavail:16; -+ unsigned ptxqspcavail:8; -+ /** Top of the Periodic Transmit Request Queue -+ * - bit 24 - Terminate (last entry for the selected channel) -+ * - bits 26:25 - Token Type -+ * - 2'b00 - Zero length -+ * - 2'b01 - Ping -+ * - 2'b10 - Disable -+ * - bits 30:27 - Channel Number -+ * - bit 31 - Odd/even microframe -+ */ -+ unsigned ptxqtop_terminate:1; -+ unsigned ptxqtop_token:2; -+ unsigned ptxqtop_chnum:4; -+ unsigned ptxqtop_odd:1; -+ } b; -+} hptxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Port Control and Status -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hprt0 register. -+ */ -+typedef union hprt0_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned prtconnsts:1; -+ unsigned prtconndet:1; -+ unsigned prtena:1; -+ unsigned prtenchng:1; -+ unsigned prtovrcurract:1; -+ unsigned prtovrcurrchng:1; -+ unsigned prtres:1; -+ unsigned prtsusp:1; -+ unsigned prtrst:1; -+ unsigned reserved9:1; -+ unsigned prtlnsts:2; -+ unsigned prtpwr:1; -+ unsigned prttstctl:4; -+ unsigned prtspd:2; -+#define DWC_HPRT0_PRTSPD_HIGH_SPEED 0 -+#define DWC_HPRT0_PRTSPD_FULL_SPEED 1 -+#define DWC_HPRT0_PRTSPD_LOW_SPEED 2 -+ unsigned reserved19_31:13; -+ } b; -+} hprt0_data_t; -+ -+/** -+ * This union represents the bit fields in the Host All Interrupt -+ * Register. -+ */ -+typedef union haint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned ch0:1; -+ unsigned ch1:1; -+ unsigned ch2:1; -+ unsigned ch3:1; -+ unsigned ch4:1; -+ unsigned ch5:1; -+ unsigned ch6:1; -+ unsigned ch7:1; -+ unsigned ch8:1; -+ unsigned ch9:1; -+ unsigned ch10:1; -+ unsigned ch11:1; -+ unsigned ch12:1; -+ unsigned ch13:1; -+ unsigned ch14:1; -+ unsigned ch15:1; -+ unsigned reserved:16; -+ } b; -+ -+ struct { -+ unsigned chint:16; -+ unsigned reserved:16; -+ } b2; -+} haint_data_t; -+ -+/** -+ * This union represents the bit fields in the Host All Interrupt -+ * Register. -+ */ -+typedef union haintmsk_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned ch0:1; -+ unsigned ch1:1; -+ unsigned ch2:1; -+ unsigned ch3:1; -+ unsigned ch4:1; -+ unsigned ch5:1; -+ unsigned ch6:1; -+ unsigned ch7:1; -+ unsigned ch8:1; -+ unsigned ch9:1; -+ unsigned ch10:1; -+ unsigned ch11:1; -+ unsigned ch12:1; -+ unsigned ch13:1; -+ unsigned ch14:1; -+ unsigned ch15:1; -+ unsigned reserved:16; -+ } b; -+ -+ struct { -+ unsigned chint:16; -+ unsigned reserved:16; -+ } b2; -+} haintmsk_data_t; -+ -+/** -+ * Host Channel Specific Registers. 500h-5FCh -+ */ -+typedef struct dwc_otg_hc_regs { -+ /** Host Channel 0 Characteristic Register. Offset: 500h + (chan_num * 20h) + 00h */ -+ volatile uint32_t hcchar; -+ /** Host Channel 0 Split Control Register. Offset: 500h + (chan_num * 20h) + 04h */ -+ volatile uint32_t hcsplt; -+ /** Host Channel 0 Interrupt Register. Offset: 500h + (chan_num * 20h) + 08h */ -+ volatile uint32_t hcint; -+ /** Host Channel 0 Interrupt Mask Register. Offset: 500h + (chan_num * 20h) + 0Ch */ -+ volatile uint32_t hcintmsk; -+ /** Host Channel 0 Transfer Size Register. Offset: 500h + (chan_num * 20h) + 10h */ -+ volatile uint32_t hctsiz; -+ /** Host Channel 0 DMA Address Register. Offset: 500h + (chan_num * 20h) + 14h */ -+ volatile uint32_t hcdma; -+ volatile uint32_t reserved; -+ /** Host Channel 0 DMA Buffer Address Register. Offset: 500h + (chan_num * 20h) + 1Ch */ -+ volatile uint32_t hcdmab; -+} dwc_otg_hc_regs_t; -+ -+/** -+ * This union represents the bit fields in the Host Channel Characteristics -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hcchar register. -+ */ -+typedef union hcchar_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Maximum packet size in bytes */ -+ unsigned mps:11; -+ -+ /** Endpoint number */ -+ unsigned epnum:4; -+ -+ /** 0: OUT, 1: IN */ -+ unsigned epdir:1; -+ -+ unsigned reserved:1; -+ -+ /** 0: Full/high speed device, 1: Low speed device */ -+ unsigned lspddev:1; -+ -+ /** 0: Control, 1: Isoc, 2: Bulk, 3: Intr */ -+ unsigned eptype:2; -+ -+ /** Packets per frame for periodic transfers. 0 is reserved. */ -+ unsigned multicnt:2; -+ -+ /** Device address */ -+ unsigned devaddr:7; -+ -+ /** -+ * Frame to transmit periodic transaction. -+ * 0: even, 1: odd -+ */ -+ unsigned oddfrm:1; -+ -+ /** Channel disable */ -+ unsigned chdis:1; -+ -+ /** Channel enable */ -+ unsigned chen:1; -+ } b; -+} hcchar_data_t; -+ -+typedef union hcsplt_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Port Address */ -+ unsigned prtaddr:7; -+ -+ /** Hub Address */ -+ unsigned hubaddr:7; -+ -+ /** Transaction Position */ -+ unsigned xactpos:2; -+#define DWC_HCSPLIT_XACTPOS_MID 0 -+#define DWC_HCSPLIT_XACTPOS_END 1 -+#define DWC_HCSPLIT_XACTPOS_BEGIN 2 -+#define DWC_HCSPLIT_XACTPOS_ALL 3 -+ -+ /** Do Complete Split */ -+ unsigned compsplt:1; -+ -+ /** Reserved */ -+ unsigned reserved:14; -+ -+ /** Split Enble */ -+ unsigned spltena:1; -+ } b; -+} hcsplt_data_t; -+ -+/** -+ * This union represents the bit fields in the Host All Interrupt -+ * Register. -+ */ -+typedef union hcint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer Complete */ -+ unsigned xfercomp:1; -+ /** Channel Halted */ -+ unsigned chhltd:1; -+ /** AHB Error */ -+ unsigned ahberr:1; -+ /** STALL Response Received */ -+ unsigned stall:1; -+ /** NAK Response Received */ -+ unsigned nak:1; -+ /** ACK Response Received */ -+ unsigned ack:1; -+ /** NYET Response Received */ -+ unsigned nyet:1; -+ /** Transaction Err */ -+ unsigned xacterr:1; -+ /** Babble Error */ -+ unsigned bblerr:1; -+ /** Frame Overrun */ -+ unsigned frmovrun:1; -+ /** Data Toggle Error */ -+ unsigned datatglerr:1; -+ /** Buffer Not Available (only for DDMA mode) */ -+ unsigned bna:1; -+ /** Exessive transaction error (only for DDMA mode) */ -+ unsigned xcs_xact:1; -+ /** Frame List Rollover interrupt */ -+ unsigned frm_list_roll:1; -+ /** Reserved */ -+ unsigned reserved14_31:18; -+ } b; -+} hcint_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Channel Interrupt Mask -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hcintmsk register. -+ */ -+typedef union hcintmsk_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned xfercompl:1; -+ unsigned chhltd:1; -+ unsigned ahberr:1; -+ unsigned stall:1; -+ unsigned nak:1; -+ unsigned ack:1; -+ unsigned nyet:1; -+ unsigned xacterr:1; -+ unsigned bblerr:1; -+ unsigned frmovrun:1; -+ unsigned datatglerr:1; -+ unsigned bna:1; -+ unsigned xcs_xact:1; -+ unsigned frm_list_roll:1; -+ unsigned reserved14_31:18; -+ } b; -+} hcintmsk_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Channel Transfer Size -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hcchar register. -+ */ -+ -+typedef union hctsiz_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Total transfer size in bytes */ -+ unsigned xfersize:19; -+ -+ /** Data packets to transfer */ -+ unsigned pktcnt:10; -+ -+ /** -+ * Packet ID for next data packet -+ * 0: DATA0 -+ * 1: DATA2 -+ * 2: DATA1 -+ * 3: MDATA (non-Control), SETUP (Control) -+ */ -+ unsigned pid:2; -+#define DWC_HCTSIZ_DATA0 0 -+#define DWC_HCTSIZ_DATA1 2 -+#define DWC_HCTSIZ_DATA2 1 -+#define DWC_HCTSIZ_MDATA 3 -+#define DWC_HCTSIZ_SETUP 3 -+ -+ /** Do PING protocol when 1 */ -+ unsigned dopng:1; -+ } b; -+ -+ /** register bits */ -+ struct { -+ /** Scheduling information */ -+ unsigned schinfo:8; -+ -+ /** Number of transfer descriptors. -+ * Max value: -+ * 64 in general, -+ * 256 only for HS isochronous endpoint. -+ */ -+ unsigned ntd:8; -+ -+ /** Data packets to transfer */ -+ unsigned reserved16_28:13; -+ -+ /** -+ * Packet ID for next data packet -+ * 0: DATA0 -+ * 1: DATA2 -+ * 2: DATA1 -+ * 3: MDATA (non-Control) -+ */ -+ unsigned pid:2; -+ -+ /** Do PING protocol when 1 */ -+ unsigned dopng:1; -+ } b_ddma; -+} hctsiz_data_t; -+ -+/** -+ * This union represents the bit fields in the Host DMA Address -+ * Register used in Descriptor DMA mode. -+ */ -+typedef union hcdma_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned reserved0_2:3; -+ /** Current Transfer Descriptor. Not used for ISOC */ -+ unsigned ctd:8; -+ /** Start Address of Descriptor List */ -+ unsigned dma_addr:21; -+ } b; -+} hcdma_data_t; -+ -+/** -+ * This union represents the bit fields in the DMA Descriptor -+ * status quadlet for host mode. Read the quadlet into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union host_dma_desc_sts { -+ /** raw register data */ -+ uint32_t d32; -+ /** quadlet bits */ -+ -+ /* for non-isochronous */ -+ struct { -+ /** Number of bytes */ -+ unsigned n_bytes:17; -+ /** QTD offset to jump when Short Packet received - only for IN EPs */ -+ unsigned qtd_offset:6; -+ /** -+ * Set to request the core to jump to alternate QTD if -+ * Short Packet received - only for IN EPs -+ */ -+ unsigned a_qtd:1; -+ /** -+ * Setup Packet bit. When set indicates that buffer contains -+ * setup packet. -+ */ -+ unsigned sup:1; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** End of List */ -+ unsigned eol:1; -+ unsigned reserved27:1; -+ /** Rx/Tx Status */ -+ unsigned sts:2; -+#define DMA_DESC_STS_PKTERR 1 -+ unsigned reserved30:1; -+ /** Active Bit */ -+ unsigned a:1; -+ } b; -+ /* for isochronous */ -+ struct { -+ /** Number of bytes */ -+ unsigned n_bytes:12; -+ unsigned reserved12_24:13; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ unsigned reserved26_27:2; -+ /** Rx/Tx Status */ -+ unsigned sts:2; -+ unsigned reserved30:1; -+ /** Active Bit */ -+ unsigned a:1; -+ } b_isoc; -+} host_dma_desc_sts_t; -+ -+#define MAX_DMA_DESC_SIZE 131071 -+#define MAX_DMA_DESC_NUM_GENERIC 64 -+#define MAX_DMA_DESC_NUM_HS_ISOC 256 -+#define MAX_FRLIST_EN_NUM 64 -+/** -+ * Host-mode DMA Descriptor structure -+ * -+ * DMA Descriptor structure contains two quadlets: -+ * Status quadlet and Data buffer pointer. -+ */ -+typedef struct dwc_otg_host_dma_desc { -+ /** DMA Descriptor status quadlet */ -+ host_dma_desc_sts_t status; -+ /** DMA Descriptor data buffer pointer */ -+ uint32_t buf; -+} dwc_otg_host_dma_desc_t; -+ -+/** OTG Host Interface Structure. -+ * -+ * The OTG Host Interface Structure structure contains information -+ * needed to manage the DWC_otg controller acting in host mode. It -+ * represents the programming view of the host-specific aspects of the -+ * controller. -+ */ -+typedef struct dwc_otg_host_if { -+ /** Host Global Registers starting at offset 400h.*/ -+ dwc_otg_host_global_regs_t *host_global_regs; -+#define DWC_OTG_HOST_GLOBAL_REG_OFFSET 0x400 -+ -+ /** Host Port 0 Control and Status Register */ -+ volatile uint32_t *hprt0; -+#define DWC_OTG_HOST_PORT_REGS_OFFSET 0x440 -+ -+ /** Host Channel Specific Registers at offsets 500h-5FCh. */ -+ dwc_otg_hc_regs_t *hc_regs[MAX_EPS_CHANNELS]; -+#define DWC_OTG_HOST_CHAN_REGS_OFFSET 0x500 -+#define DWC_OTG_CHAN_REGS_OFFSET 0x20 -+ -+ /* Host configuration information */ -+ /** Number of Host Channels (range: 1-16) */ -+ uint8_t num_host_channels; -+ /** Periodic EPs supported (0: no, 1: yes) */ -+ uint8_t perio_eps_supported; -+ /** Periodic Tx FIFO Size (Only 1 host periodic Tx FIFO) */ -+ uint16_t perio_tx_fifo_size; -+ -+} dwc_otg_host_if_t; -+ -+/** -+ * This union represents the bit fields in the Power and Clock Gating Control -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union pcgcctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Stop Pclk */ -+ unsigned stoppclk:1; -+ /** Gate Hclk */ -+ unsigned gatehclk:1; -+ /** Power Clamp */ -+ unsigned pwrclmp:1; -+ /** Reset Power Down Modules */ -+ unsigned rstpdwnmodule:1; -+ /** Reserved */ -+ unsigned reserved:1; -+ /** Enable Sleep Clock Gating (Enbl_L1Gating) */ -+ unsigned enbl_sleep_gating:1; -+ /** PHY In Sleep (PhySleep) */ -+ unsigned phy_in_sleep:1; -+ /** Deep Sleep*/ -+ unsigned deep_sleep:1; -+ unsigned resetaftsusp:1; -+ unsigned restoremode:1; -+ unsigned enbl_extnd_hiber:1; -+ unsigned extnd_hiber_pwrclmp:1; -+ unsigned extnd_hiber_switch:1; -+ unsigned ess_reg_restored:1; -+ unsigned prt_clk_sel:2; -+ unsigned port_power:1; -+ unsigned max_xcvrselect:2; -+ unsigned max_termsel:1; -+ unsigned mac_dev_addr:7; -+ unsigned p2hd_dev_enum_spd:2; -+ unsigned p2hd_prt_spd:2; -+ unsigned if_dev_mode:1; -+ } b; -+} pcgcctl_data_t; -+ -+/** -+ * This union represents the bit fields in the Global Data FIFO Software -+ * Configuration Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union gdfifocfg_data { -+ /* raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** OTG Data FIFO depth */ -+ unsigned gdfifocfg:16; -+ /** Start address of EP info controller */ -+ unsigned epinfobase:16; -+ } b; -+} gdfifocfg_data_t; -+ -+/** -+ * This union represents the bit fields in the Global Power Down Register -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union gpwrdn_data { -+ /* raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** PMU Interrupt Select */ -+ unsigned pmuintsel:1; -+ /** PMU Active */ -+ unsigned pmuactv:1; -+ /** Restore */ -+ unsigned restore:1; -+ /** Power Down Clamp */ -+ unsigned pwrdnclmp:1; -+ /** Power Down Reset */ -+ unsigned pwrdnrstn:1; -+ /** Power Down Switch */ -+ unsigned pwrdnswtch:1; -+ /** Disable VBUS */ -+ unsigned dis_vbus:1; -+ /** Line State Change */ -+ unsigned lnstschng:1; -+ /** Line state change mask */ -+ unsigned lnstchng_msk:1; -+ /** Reset Detected */ -+ unsigned rst_det:1; -+ /** Reset Detect mask */ -+ unsigned rst_det_msk:1; -+ /** Disconnect Detected */ -+ unsigned disconn_det:1; -+ /** Disconnect Detect mask */ -+ unsigned disconn_det_msk:1; -+ /** Connect Detected*/ -+ unsigned connect_det:1; -+ /** Connect Detected Mask*/ -+ unsigned connect_det_msk:1; -+ /** SRP Detected */ -+ unsigned srp_det:1; -+ /** SRP Detect mask */ -+ unsigned srp_det_msk:1; -+ /** Status Change Interrupt */ -+ unsigned sts_chngint:1; -+ /** Status Change Interrupt Mask */ -+ unsigned sts_chngint_msk:1; -+ /** Line State */ -+ unsigned linestate:2; -+ /** Indicates current mode(status of IDDIG signal) */ -+ unsigned idsts:1; -+ /** B Session Valid signal status*/ -+ unsigned bsessvld:1; -+ /** ADP Event Detected */ -+ unsigned adp_int:1; -+ /** Multi Valued ID pin */ -+ unsigned mult_val_id_bc:5; -+ /** Reserved 24_31 */ -+ unsigned reserved29_31:3; -+ } b; -+} gpwrdn_data_t; -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/test/Makefile b/drivers/usb/host/dwc_otg/test/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..fc453759dea3e88b8f79a1a151bbcaab7e242899 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/Makefile -@@ -0,0 +1,16 @@ -+ -+PERL=/usr/bin/perl -+PL_TESTS=test_sysfs.pl test_mod_param.pl -+ -+.PHONY : test -+test : perl_tests -+ -+perl_tests : -+ @echo -+ @echo Running perl tests -+ @for test in $(PL_TESTS); do \ -+ if $(PERL) ./$$test ; then \ -+ echo "=======> $$test, PASSED" ; \ -+ else echo "=======> $$test, FAILED" ; \ -+ fi \ -+ done -diff --git a/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm -new file mode 100644 -index 0000000000000000000000000000000000000000..85e55fd6ddbc78051d65a11125d4265aea6c24e3 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm -@@ -0,0 +1,337 @@ -+package dwc_otg_test; -+ -+use strict; -+use Exporter (); -+ -+use vars qw(@ISA @EXPORT -+$sysfsdir $paramdir $errors $params -+); -+ -+@ISA = qw(Exporter); -+ -+# -+# Globals -+# -+$sysfsdir = "/sys/devices/lm0"; -+$paramdir = "/sys/module/dwc_otg"; -+$errors = 0; -+ -+$params = [ -+ { -+ NAME => "otg_cap", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 2 -+ }, -+ { -+ NAME => "dma_enable", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "dma_burst_size", -+ DEFAULT => 32, -+ ENUM => [1, 4, 8, 16, 32, 64, 128, 256], -+ LOW => 1, -+ HIGH => 256 -+ }, -+ { -+ NAME => "host_speed", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "host_support_fs_ls_low_power", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "host_ls_low_power_phy_clk", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "dev_speed", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "enable_dynamic_fifo", -+ DEFAULT => 1, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "data_fifo_size", -+ DEFAULT => 8192, -+ ENUM => [], -+ LOW => 32, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "dev_rx_fifo_size", -+ DEFAULT => 1064, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "dev_nperio_tx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_1", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_2", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_3", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_4", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_5", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_6", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_7", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_8", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_9", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_10", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_11", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_12", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_13", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_14", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_15", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "host_rx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "host_nperio_tx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "host_perio_tx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "max_transfer_size", -+ DEFAULT => 65535, -+ ENUM => [], -+ LOW => 2047, -+ HIGH => 65535 -+ }, -+ { -+ NAME => "max_packet_count", -+ DEFAULT => 511, -+ ENUM => [], -+ LOW => 15, -+ HIGH => 511 -+ }, -+ { -+ NAME => "host_channels", -+ DEFAULT => 12, -+ ENUM => [], -+ LOW => 1, -+ HIGH => 16 -+ }, -+ { -+ NAME => "dev_endpoints", -+ DEFAULT => 6, -+ ENUM => [], -+ LOW => 1, -+ HIGH => 15 -+ }, -+ { -+ NAME => "phy_type", -+ DEFAULT => 1, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 2 -+ }, -+ { -+ NAME => "phy_utmi_width", -+ DEFAULT => 16, -+ ENUM => [8, 16], -+ LOW => 8, -+ HIGH => 16 -+ }, -+ { -+ NAME => "phy_ulpi_ddr", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ ]; -+ -+ -+# -+# -+sub check_arch { -+ $_ = `uname -m`; -+ chomp; -+ unless (m/armv4tl/) { -+ warn "# \n# Can't execute on $_. Run on integrator platform.\n# \n"; -+ return 0; -+ } -+ return 1; -+} -+ -+# -+# -+sub load_module { -+ my $params = shift; -+ print "\nRemoving Module\n"; -+ system "rmmod dwc_otg"; -+ print "Loading Module\n"; -+ if ($params ne "") { -+ print "Module Parameters: $params\n"; -+ } -+ if (system("modprobe dwc_otg $params")) { -+ warn "Unable to load module\n"; -+ return 0; -+ } -+ return 1; -+} -+ -+# -+# -+sub test_status { -+ my $arg = shift; -+ -+ print "\n"; -+ -+ if (defined $arg) { -+ warn "WARNING: $arg\n"; -+ } -+ -+ if ($errors > 0) { -+ warn "TEST FAILED with $errors errors\n"; -+ return 0; -+ } else { -+ print "TEST PASSED\n"; -+ return 0 if (defined $arg); -+ } -+ return 1; -+} -+ -+# -+# -+@EXPORT = qw( -+$sysfsdir -+$paramdir -+$params -+$errors -+check_arch -+load_module -+test_status -+); -+ -+1; -diff --git a/drivers/usb/host/dwc_otg/test/test_mod_param.pl b/drivers/usb/host/dwc_otg/test/test_mod_param.pl -new file mode 100644 -index 0000000000000000000000000000000000000000..dc3820df577bae2c51bc2b1cef57ac9c4fdfc6e5 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/test_mod_param.pl -@@ -0,0 +1,133 @@ -+#!/usr/bin/perl -w -+# -+# Run this program on the integrator. -+# -+# - Tests module parameter default values. -+# - Tests setting of valid module parameter values via modprobe. -+# - Tests invalid module parameter values. -+# ----------------------------------------------------------------------------- -+use strict; -+use dwc_otg_test; -+ -+check_arch() or die; -+ -+# -+# -+sub test { -+ my ($param,$expected) = @_; -+ my $value = get($param); -+ -+ if ($value == $expected) { -+ print "$param = $value, okay\n"; -+ } -+ -+ else { -+ warn "ERROR: value of $param != $expected, $value\n"; -+ $errors ++; -+ } -+} -+ -+# -+# -+sub get { -+ my $param = shift; -+ my $tmp = `cat $paramdir/$param`; -+ chomp $tmp; -+ return $tmp; -+} -+ -+# -+# -+sub test_main { -+ -+ print "\nTesting Module Parameters\n"; -+ -+ load_module("") or die; -+ -+ # Test initial values -+ print "\nTesting Default Values\n"; -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ -+ # Test low value -+ print "\nTesting Low Value\n"; -+ my $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . "$_->{NAME}=$_->{LOW} "; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{LOW}); -+ } -+ -+ # Test high value -+ print "\nTesting High Value\n"; -+ $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . "$_->{NAME}=$_->{HIGH} "; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{HIGH}); -+ } -+ -+ # Test Enum -+ print "\nTesting Enumerated\n"; -+ foreach (@{$params}) { -+ if (defined $_->{ENUM}) { -+ my $value; -+ foreach $value (@{$_->{ENUM}}) { -+ $cmd_params = "$_->{NAME}=$value"; -+ load_module($cmd_params) or die; -+ test ($_->{NAME}, $value); -+ } -+ } -+ } -+ -+ # Test Invalid Values -+ print "\nTesting Invalid Values\n"; -+ $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{LOW}-1; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ -+ $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{HIGH}+1; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ -+ print "\nTesting Enumerated\n"; -+ foreach (@{$params}) { -+ if (defined $_->{ENUM}) { -+ my $value; -+ foreach $value (@{$_->{ENUM}}) { -+ $value = $value + 1; -+ $cmd_params = "$_->{NAME}=$value"; -+ load_module($cmd_params) or die; -+ test ($_->{NAME}, $_->{DEFAULT}); -+ $value = $value - 2; -+ $cmd_params = "$_->{NAME}=$value"; -+ load_module($cmd_params) or die; -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ } -+ } -+ -+ test_status() or die; -+} -+ -+test_main(); -+0; -diff --git a/drivers/usb/host/dwc_otg/test/test_sysfs.pl b/drivers/usb/host/dwc_otg/test/test_sysfs.pl -new file mode 100644 -index 0000000000000000000000000000000000000000..cdc9963176e5a4a0d5250613b61e26c578d7130a ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/test_sysfs.pl -@@ -0,0 +1,193 @@ -+#!/usr/bin/perl -w -+# -+# Run this program on the integrator -+# - Tests select sysfs attributes. -+# - Todo ... test more attributes, hnp/srp, buspower/bussuspend, etc. -+# ----------------------------------------------------------------------------- -+use strict; -+use dwc_otg_test; -+ -+check_arch() or die; -+ -+# -+# -+sub test { -+ my ($attr,$expected) = @_; -+ my $string = get($attr); -+ -+ if ($string eq $expected) { -+ printf("$attr = $string, okay\n"); -+ } -+ else { -+ warn "ERROR: value of $attr != $expected, $string\n"; -+ $errors ++; -+ } -+} -+ -+# -+# -+sub set { -+ my ($reg, $value) = @_; -+ system "echo $value > $sysfsdir/$reg"; -+} -+ -+# -+# -+sub get { -+ my $attr = shift; -+ my $string = `cat $sysfsdir/$attr`; -+ chomp $string; -+ if ($string =~ m/\s\=\s/) { -+ my $tmp; -+ ($tmp, $string) = split /\s=\s/, $string; -+ } -+ return $string; -+} -+ -+# -+# -+sub test_main { -+ print("\nTesting Sysfs Attributes\n"); -+ -+ load_module("") or die; -+ -+ # Test initial values of regoffset/regvalue/guid/gsnpsid -+ print("\nTesting Default Values\n"); -+ -+ test("regoffset", "0xffffffff"); -+ test("regvalue", "invalid offset"); -+ test("guid", "0x12345678"); # this will fail if it has been changed -+ test("gsnpsid", "0x4f54200a"); -+ -+ # Test operation of regoffset/regvalue -+ print("\nTesting regoffset\n"); -+ set('regoffset', '5a5a5a5a'); -+ test("regoffset", "0xffffffff"); -+ -+ set('regoffset', '0'); -+ test("regoffset", "0x00000000"); -+ -+ set('regoffset', '40000'); -+ test("regoffset", "0x00000000"); -+ -+ set('regoffset', '3ffff'); -+ test("regoffset", "0x0003ffff"); -+ -+ set('regoffset', '1'); -+ test("regoffset", "0x00000001"); -+ -+ print("\nTesting regvalue\n"); -+ set('regoffset', '3c'); -+ test("regvalue", "0x12345678"); -+ set('regvalue', '5a5a5a5a'); -+ test("regvalue", "0x5a5a5a5a"); -+ set('regvalue','a5a5a5a5'); -+ test("regvalue", "0xa5a5a5a5"); -+ set('guid','12345678'); -+ -+ # Test HNP Capable -+ print("\nTesting HNP Capable bit\n"); -+ set('hnpcapable', '1'); -+ test("hnpcapable", "0x1"); -+ set('hnpcapable','0'); -+ test("hnpcapable", "0x0"); -+ -+ set('regoffset','0c'); -+ -+ my $old = get('gusbcfg'); -+ print("setting hnpcapable\n"); -+ set('hnpcapable', '1'); -+ test("hnpcapable", "0x1"); -+ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<9))); -+ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<9))); -+ -+ $old = get('gusbcfg'); -+ print("clearing hnpcapable\n"); -+ set('hnpcapable', '0'); -+ test("hnpcapable", "0x0"); -+ test ('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<9))); -+ test ('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<9))); -+ -+ # Test SRP Capable -+ print("\nTesting SRP Capable bit\n"); -+ set('srpcapable', '1'); -+ test("srpcapable", "0x1"); -+ set('srpcapable','0'); -+ test("srpcapable", "0x0"); -+ -+ set('regoffset','0c'); -+ -+ $old = get('gusbcfg'); -+ print("setting srpcapable\n"); -+ set('srpcapable', '1'); -+ test("srpcapable", "0x1"); -+ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<8))); -+ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<8))); -+ -+ $old = get('gusbcfg'); -+ print("clearing srpcapable\n"); -+ set('srpcapable', '0'); -+ test("srpcapable", "0x0"); -+ test('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<8))); -+ test('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<8))); -+ -+ # Test GGPIO -+ print("\nTesting GGPIO\n"); -+ set('ggpio','5a5a5a5a'); -+ test('ggpio','0x5a5a0000'); -+ set('ggpio','a5a5a5a5'); -+ test('ggpio','0xa5a50000'); -+ set('ggpio','11110000'); -+ test('ggpio','0x11110000'); -+ set('ggpio','00001111'); -+ test('ggpio','0x00000000'); -+ -+ # Test DEVSPEED -+ print("\nTesting DEVSPEED\n"); -+ set('regoffset','800'); -+ $old = get('regvalue'); -+ set('devspeed','0'); -+ test('devspeed','0x0'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); -+ set('devspeed','1'); -+ test('devspeed','0x1'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); -+ set('devspeed','2'); -+ test('devspeed','0x2'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 2)); -+ set('devspeed','3'); -+ test('devspeed','0x3'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 3)); -+ set('devspeed','4'); -+ test('devspeed','0x0'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); -+ set('devspeed','5'); -+ test('devspeed','0x1'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); -+ -+ -+ # mode Returns the current mode:0 for device mode1 for host mode Read -+ # hnp Initiate the Host Negotiation Protocol. Read returns the status. Read/Write -+ # srp Initiate the Session Request Protocol. Read returns the status. Read/Write -+ # buspower Get or Set the Power State of the bus (0 - Off or 1 - On) Read/Write -+ # bussuspend Suspend the USB bus. Read/Write -+ # busconnected Get the connection status of the bus Read -+ -+ # gotgctl Get or set the Core Control Status Register. Read/Write -+ ## gusbcfg Get or set the Core USB Configuration Register Read/Write -+ # grxfsiz Get or set the Receive FIFO Size Register Read/Write -+ # gnptxfsiz Get or set the non-periodic Transmit Size Register Read/Write -+ # gpvndctl Get or set the PHY Vendor Control Register Read/Write -+ ## ggpio Get the value in the lower 16-bits of the General Purpose IO Register or Set the upper 16 bits. Read/Write -+ ## guid Get or set the value of the User ID Register Read/Write -+ ## gsnpsid Get the value of the Synopsys ID Regester Read -+ ## devspeed Get or set the device speed setting in the DCFG register Read/Write -+ # enumspeed Gets the device enumeration Speed. Read -+ # hptxfsiz Get the value of the Host Periodic Transmit FIFO Read -+ # hprt0 Get or Set the value in the Host Port Control and Status Register Read/Write -+ -+ test_status("TEST NYI") or die; -+} -+ -+test_main(); -+0; - -From 990bd0f738984c3582e6dbba14a1826ea28f9fb6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 032/122] bcm2708 framebuffer driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -bcm2708_fb : Implement blanking support using the mailbox property interface - -bcm2708_fb: Add pan and vsync controls - -bcm2708_fb: DMA acceleration for fb_copyarea - -Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425 -Also used Simon's dmaer_master module as a reference for tweaking DMA -settings for better performance. - -For now busylooping only. IRQ support might be added later. -With non-overclocked Raspberry Pi, the performance is ~360 MB/s -for simple copy or ~260 MB/s for two-pass copy (used when dragging -windows to the right). - -In the case of using DMA channel 0, the performance improves -to ~440 MB/s. - -For comparison, VFP optimized CPU copy can only do ~114 MB/s in -the same conditions (hindered by reading uncached source buffer). - -Signed-off-by: Siarhei Siamashka - -bcm2708_fb: report number of dma copies - -Add a counter (exported via debugfs) reporting the -number of dma copies that the framebuffer driver -has done, in order to help evaluate different -optimization strategies. - -Signed-off-by: Luke Diamand - -bcm2708_fb: use IRQ for DMA copies - -The copyarea ioctl() uses DMA to speed things along. This -was busy-waiting for completion. This change supports using -an interrupt instead for larger transfers. For small -transfers, busy-waiting is still likely to be faster. - -Signed-off-by: Luke Diamand - -bcm2708: Make ioctl logging quieter - -video: fbdev: bcm2708_fb: Don't panic on error - -No need to panic the kernel if the video driver fails. -Just print a message and return an error. - -Signed-off-by: Noralf Trønnes - -fbdev: bcm2708_fb: Add ARCH_BCM2835 support - -Add Device Tree support. -Pass the device to dma_alloc_coherent() in order to get the -correct bus address on ARCH_BCM2835. -Use the new DMA legacy API header file. -Including is not necessary. - -Signed-off-by: Noralf Trønnes - -BCM270x_DT: Add bcm2708-fb device - -Add bcm2708-fb to Device Tree and don't add the -platform device when booting in DT mode. - -Signed-off-by: Noralf Trønnes ---- - drivers/video/fbdev/Kconfig | 14 + - drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/bcm2708_fb.c | 844 ++++++++++ - drivers/video/logo/logo_linux_clut224.ppm | 2483 ++++++++++------------------- - 4 files changed, 1740 insertions(+), 1602 deletions(-) - create mode 100644 drivers/video/fbdev/bcm2708_fb.c - -diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index 5d3b0db5ce0af34997a3aa748292b6bd8d48c191..0ff4f80531e013f028ca4d05559c5464f8cfa5ef 100644 ---- a/drivers/video/fbdev/Kconfig -+++ b/drivers/video/fbdev/Kconfig -@@ -228,6 +228,20 @@ config FB_TILEBLITTING - comment "Frame buffer hardware drivers" - depends on FB - -+config FB_BCM2708 -+ tristate "BCM2708 framebuffer support" -+ depends on FB && RASPBERRYPI_FIRMWARE -+ select FB_CFB_FILLRECT -+ select FB_CFB_COPYAREA -+ select FB_CFB_IMAGEBLIT -+ help -+ This framebuffer device driver is for the BCM2708 framebuffer. -+ -+ If you want to compile this as a module (=code which can be -+ inserted into and removed from the running kernel), say M -+ here and read . The module -+ will be called bcm2708_fb. -+ - config FB_GRVGA - tristate "Aeroflex Gaisler framebuffer support" - depends on FB && SPARC -diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index ee8c81405a7f9af1f190c98ddcfa53666ad97b0f..8cd1193b98690b9c4f49098ab14389504d65af3a 100644 ---- a/drivers/video/fbdev/Makefile -+++ b/drivers/video/fbdev/Makefile -@@ -10,6 +10,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o - obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o - - # Hardware specific drivers go first -+obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o - obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o - obj-$(CONFIG_FB_ARC) += arcfb.o - obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o -diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c -new file mode 100644 -index 0000000000000000000000000000000000000000..37f60813fe1dd95d9f5f725c07ec2e75c09857bf ---- /dev/null -+++ b/drivers/video/fbdev/bcm2708_fb.c -@@ -0,0 +1,844 @@ -+/* -+ * linux/drivers/video/bcm2708_fb.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Broadcom simple framebuffer driver -+ * -+ * This file is derived from cirrusfb.c -+ * Copyright 1999-2001 Jeff Garzik -+ * -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+//#define BCM2708_FB_DEBUG -+#define MODULE_NAME "bcm2708_fb" -+ -+#ifdef BCM2708_FB_DEBUG -+#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) -+#else -+#define print_debug(fmt,...) -+#endif -+ -+/* This is limited to 16 characters when displayed by X startup */ -+static const char *bcm2708_name = "BCM2708 FB"; -+ -+#define DRIVER_NAME "bcm2708_fb" -+ -+static int fbwidth = 800; /* module parameter */ -+static int fbheight = 480; /* module parameter */ -+static int fbdepth = 32; /* module parameter */ -+static int fbswap = 0; /* module parameter */ -+ -+static u32 dma_busy_wait_threshold = 1<<15; -+module_param(dma_busy_wait_threshold, int, 0644); -+MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area"); -+ -+struct fb_alloc_tags { -+ struct rpi_firmware_property_tag_header tag1; -+ u32 xres, yres; -+ struct rpi_firmware_property_tag_header tag2; -+ u32 xres_virtual, yres_virtual; -+ struct rpi_firmware_property_tag_header tag3; -+ u32 bpp; -+ struct rpi_firmware_property_tag_header tag4; -+ u32 xoffset, yoffset; -+ struct rpi_firmware_property_tag_header tag5; -+ u32 base, screen_size; -+ struct rpi_firmware_property_tag_header tag6; -+ u32 pitch; -+}; -+ -+struct bcm2708_fb_stats { -+ struct debugfs_regset32 regset; -+ u32 dma_copies; -+ u32 dma_irqs; -+}; -+ -+struct bcm2708_fb { -+ struct fb_info fb; -+ struct platform_device *dev; -+ struct rpi_firmware *fw; -+ u32 cmap[16]; -+ u32 gpu_cmap[256]; -+ int dma_chan; -+ int dma_irq; -+ void __iomem *dma_chan_base; -+ void *cb_base; /* DMA control blocks */ -+ dma_addr_t cb_handle; -+ struct dentry *debugfs_dir; -+ wait_queue_head_t dma_waitq; -+ struct bcm2708_fb_stats stats; -+ unsigned long fb_bus_address; -+}; -+ -+#define to_bcm2708(info) container_of(info, struct bcm2708_fb, fb) -+ -+static void bcm2708_fb_debugfs_deinit(struct bcm2708_fb *fb) -+{ -+ debugfs_remove_recursive(fb->debugfs_dir); -+ fb->debugfs_dir = NULL; -+} -+ -+static int bcm2708_fb_debugfs_init(struct bcm2708_fb *fb) -+{ -+ static struct debugfs_reg32 stats_registers[] = { -+ { -+ "dma_copies", -+ offsetof(struct bcm2708_fb_stats, dma_copies) -+ }, -+ { -+ "dma_irqs", -+ offsetof(struct bcm2708_fb_stats, dma_irqs) -+ }, -+ }; -+ -+ fb->debugfs_dir = debugfs_create_dir(DRIVER_NAME, NULL); -+ if (!fb->debugfs_dir) { -+ pr_warn("%s: could not create debugfs entry\n", -+ __func__); -+ return -EFAULT; -+ } -+ -+ fb->stats.regset.regs = stats_registers; -+ fb->stats.regset.nregs = ARRAY_SIZE(stats_registers); -+ fb->stats.regset.base = &fb->stats; -+ -+ if (!debugfs_create_regset32( -+ "stats", 0444, fb->debugfs_dir, &fb->stats.regset)) { -+ pr_warn("%s: could not create statistics registers\n", -+ __func__); -+ goto fail; -+ } -+ return 0; -+ -+fail: -+ bcm2708_fb_debugfs_deinit(fb); -+ return -EFAULT; -+} -+ -+static int bcm2708_fb_set_bitfields(struct fb_var_screeninfo *var) -+{ -+ int ret = 0; -+ -+ memset(&var->transp, 0, sizeof(var->transp)); -+ -+ var->red.msb_right = 0; -+ var->green.msb_right = 0; -+ var->blue.msb_right = 0; -+ -+ switch (var->bits_per_pixel) { -+ case 1: -+ case 2: -+ case 4: -+ case 8: -+ var->red.length = var->bits_per_pixel; -+ var->red.offset = 0; -+ var->green.length = var->bits_per_pixel; -+ var->green.offset = 0; -+ var->blue.length = var->bits_per_pixel; -+ var->blue.offset = 0; -+ break; -+ case 16: -+ var->red.length = 5; -+ var->blue.length = 5; -+ /* -+ * Green length can be 5 or 6 depending whether -+ * we're operating in RGB555 or RGB565 mode. -+ */ -+ if (var->green.length != 5 && var->green.length != 6) -+ var->green.length = 6; -+ break; -+ case 24: -+ var->red.length = 8; -+ var->blue.length = 8; -+ var->green.length = 8; -+ break; -+ case 32: -+ var->red.length = 8; -+ var->green.length = 8; -+ var->blue.length = 8; -+ var->transp.length = 8; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ -+ /* -+ * >= 16bpp displays have separate colour component bitfields -+ * encoded in the pixel data. Calculate their position from -+ * the bitfield length defined above. -+ */ -+ if (ret == 0 && var->bits_per_pixel >= 24 && fbswap) { -+ var->blue.offset = 0; -+ var->green.offset = var->blue.offset + var->blue.length; -+ var->red.offset = var->green.offset + var->green.length; -+ var->transp.offset = var->red.offset + var->red.length; -+ } else if (ret == 0 && var->bits_per_pixel >= 24) { -+ var->red.offset = 0; -+ var->green.offset = var->red.offset + var->red.length; -+ var->blue.offset = var->green.offset + var->green.length; -+ var->transp.offset = var->blue.offset + var->blue.length; -+ } else if (ret == 0 && var->bits_per_pixel >= 16) { -+ var->blue.offset = 0; -+ var->green.offset = var->blue.offset + var->blue.length; -+ var->red.offset = var->green.offset + var->green.length; -+ var->transp.offset = var->red.offset + var->red.length; -+ } -+ -+ return ret; -+} -+ -+static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, -+ struct fb_info *info) -+{ -+ /* info input, var output */ -+ print_debug("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, -+ info->var.xres, info->var.yres, info->var.xres_virtual, -+ info->var.yres_virtual, (int)info->screen_size, -+ info->var.bits_per_pixel); -+ print_debug("bcm2708_fb_check_var var(%p) %dx%d (%dx%d), %d\n", var, -+ var->xres, var->yres, var->xres_virtual, var->yres_virtual, -+ var->bits_per_pixel); -+ -+ if (!var->bits_per_pixel) -+ var->bits_per_pixel = 16; -+ -+ if (bcm2708_fb_set_bitfields(var) != 0) { -+ pr_err("bcm2708_fb_check_var: invalid bits_per_pixel %d\n", -+ var->bits_per_pixel); -+ return -EINVAL; -+ } -+ -+ -+ if (var->xres_virtual < var->xres) -+ var->xres_virtual = var->xres; -+ /* use highest possible virtual resolution */ -+ if (var->yres_virtual == -1) { -+ var->yres_virtual = 480; -+ -+ pr_err -+ ("bcm2708_fb_check_var: virtual resolution set to maximum of %dx%d\n", -+ var->xres_virtual, var->yres_virtual); -+ } -+ if (var->yres_virtual < var->yres) -+ var->yres_virtual = var->yres; -+ -+ if (var->xoffset < 0) -+ var->xoffset = 0; -+ if (var->yoffset < 0) -+ var->yoffset = 0; -+ -+ /* truncate xoffset and yoffset to maximum if too high */ -+ if (var->xoffset > var->xres_virtual - var->xres) -+ var->xoffset = var->xres_virtual - var->xres - 1; -+ if (var->yoffset > var->yres_virtual - var->yres) -+ var->yoffset = var->yres_virtual - var->yres - 1; -+ -+ return 0; -+} -+ -+static int bcm2708_fb_set_par(struct fb_info *info) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ struct fb_alloc_tags fbinfo = { -+ .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT, -+ 8, 0, }, -+ .xres = info->var.xres, -+ .yres = info->var.yres, -+ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT, -+ 8, 0, }, -+ .xres_virtual = info->var.xres_virtual, -+ .yres_virtual = info->var.yres_virtual, -+ .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH, 4, 0 }, -+ .bpp = info->var.bits_per_pixel, -+ .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET, 8, 0 }, -+ .xoffset = info->var.xoffset, -+ .yoffset = info->var.yoffset, -+ .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE, 8, 0 }, -+ .base = 0, -+ .screen_size = 0, -+ .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH, 4, 0 }, -+ .pitch = 0, -+ }; -+ int ret; -+ -+ print_debug("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, -+ info->var.xres, info->var.yres, info->var.xres_virtual, -+ info->var.yres_virtual, (int)info->screen_size, -+ info->var.bits_per_pixel); -+ -+ ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo)); -+ if (ret) { -+ dev_err(info->device, -+ "Failed to allocate GPU framebuffer (%d)\n", ret); -+ return ret; -+ } -+ -+ if (info->var.bits_per_pixel <= 8) -+ fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; -+ else -+ fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; -+ -+ fb->fb.fix.line_length = fbinfo.pitch; -+ fbinfo.base |= 0x40000000; -+ fb->fb_bus_address = fbinfo.base; -+ fbinfo.base &= ~0xc0000000; -+ fb->fb.fix.smem_start = fbinfo.base; -+ fb->fb.fix.smem_len = fbinfo.pitch * fbinfo.yres_virtual; -+ fb->fb.screen_size = fbinfo.screen_size; -+ if (fb->fb.screen_base) -+ iounmap(fb->fb.screen_base); -+ fb->fb.screen_base = ioremap_wc(fbinfo.base, fb->fb.screen_size); -+ if (!fb->fb.screen_base) { -+ /* the console may currently be locked */ -+ console_trylock(); -+ console_unlock(); -+ dev_err(info->device, "Failed to set screen_base\n"); -+ return -ENOMEM; -+ } -+ -+ print_debug -+ ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n", -+ (void *)fb->fb.screen_base, (void *)fb->fb_bus_address, -+ fbinfo.xres, fbinfo.yres, fbinfo.bpp, -+ fbinfo.pitch, (int)fb->fb.screen_size); -+ -+ return 0; -+} -+ -+static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) -+{ -+ unsigned int mask = (1 << bf->length) - 1; -+ -+ return (val >> (16 - bf->length) & mask) << bf->offset; -+} -+ -+ -+static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, -+ unsigned int green, unsigned int blue, -+ unsigned int transp, struct fb_info *info) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ -+ /*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ -+ if (fb->fb.var.bits_per_pixel <= 8) { -+ if (regno < 256) { -+ /* blue [23:16], green [15:8], red [7:0] */ -+ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 | -+ ((green >> 8) & 0xff) << 8 | -+ ((blue >> 8) & 0xff) << 16; -+ } -+ /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ -+ /* So just call it for what looks like the last colour in a list for now. */ -+ if (regno == 15 || regno == 255) { -+ struct packet { -+ u32 offset; -+ u32 length; -+ u32 cmap[256]; -+ } *packet; -+ int ret; -+ -+ packet = kmalloc(sizeof(*packet), GFP_KERNEL); -+ if (!packet) -+ return -ENOMEM; -+ packet->offset = 0; -+ packet->length = regno + 1; -+ memcpy(packet->cmap, fb->gpu_cmap, sizeof(packet->cmap)); -+ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE, -+ packet, (2 + packet->length) * sizeof(u32)); -+ if (ret || packet->offset) -+ dev_err(info->device, "Failed to set palette (%d,%u)\n", -+ ret, packet->offset); -+ kfree(packet); -+ } -+ } else if (regno < 16) { -+ fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | -+ convert_bitfield(blue, &fb->fb.var.blue) | -+ convert_bitfield(green, &fb->fb.var.green) | -+ convert_bitfield(red, &fb->fb.var.red); -+ } -+ return regno > 255; -+} -+ -+static int bcm2708_fb_blank(int blank_mode, struct fb_info *info) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ u32 value; -+ int ret; -+ -+ switch (blank_mode) { -+ case FB_BLANK_UNBLANK: -+ value = 0; -+ break; -+ case FB_BLANK_NORMAL: -+ case FB_BLANK_VSYNC_SUSPEND: -+ case FB_BLANK_HSYNC_SUSPEND: -+ case FB_BLANK_POWERDOWN: -+ value = 1; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_BLANK, -+ &value, sizeof(value)); -+ if (ret) -+ dev_err(info->device, "bcm2708_fb_blank(%d) failed: %d\n", -+ blank_mode, ret); -+ -+ return ret; -+} -+ -+static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) -+{ -+ s32 result; -+ info->var.xoffset = var->xoffset; -+ info->var.yoffset = var->yoffset; -+ result = bcm2708_fb_set_par(info); -+ if (result != 0) -+ pr_err("bcm2708_fb_pan_display(%d,%d) returns=%d\n", var->xoffset, var->yoffset, result); -+ return result; -+} -+ -+static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ u32 dummy = 0; -+ int ret; -+ -+ switch (cmd) { -+ case FBIO_WAITFORVSYNC: -+ ret = rpi_firmware_property(fb->fw, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, -+ &dummy, sizeof(dummy)); -+ break; -+ default: -+ dev_dbg(info->device, "Unknown ioctl 0x%x\n", cmd); -+ return -ENOTTY; -+ } -+ -+ if (ret) -+ dev_err(info->device, "ioctl 0x%x failed (%d)\n", cmd, ret); -+ -+ return ret; -+} -+static void bcm2708_fb_fillrect(struct fb_info *info, -+ const struct fb_fillrect *rect) -+{ -+ /* (is called) print_debug("bcm2708_fb_fillrect\n"); */ -+ cfb_fillrect(info, rect); -+} -+ -+/* A helper function for configuring dma control block */ -+static void set_dma_cb(struct bcm2708_dma_cb *cb, -+ int burst_size, -+ dma_addr_t dst, -+ int dst_stride, -+ dma_addr_t src, -+ int src_stride, -+ int w, -+ int h) -+{ -+ cb->info = BCM2708_DMA_BURST(burst_size) | BCM2708_DMA_S_WIDTH | -+ BCM2708_DMA_S_INC | BCM2708_DMA_D_WIDTH | -+ BCM2708_DMA_D_INC | BCM2708_DMA_TDMODE; -+ cb->dst = dst; -+ cb->src = src; -+ /* -+ * This is not really obvious from the DMA documentation, -+ * but the top 16 bits must be programmmed to "height -1" -+ * and not "height" in 2D mode. -+ */ -+ cb->length = ((h - 1) << 16) | w; -+ cb->stride = ((dst_stride - w) << 16) | (u16)(src_stride - w); -+ cb->pad[0] = 0; -+ cb->pad[1] = 0; -+} -+ -+static void bcm2708_fb_copyarea(struct fb_info *info, -+ const struct fb_copyarea *region) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ struct bcm2708_dma_cb *cb = fb->cb_base; -+ int bytes_per_pixel = (info->var.bits_per_pixel + 7) >> 3; -+ /* Channel 0 supports larger bursts and is a bit faster */ -+ int burst_size = (fb->dma_chan == 0) ? 8 : 2; -+ int pixels = region->width * region->height; -+ -+ /* Fallback to cfb_copyarea() if we don't like something */ -+ if (in_atomic() || -+ bytes_per_pixel > 4 || -+ info->var.xres * info->var.yres > 1920 * 1200 || -+ region->width <= 0 || region->width > info->var.xres || -+ region->height <= 0 || region->height > info->var.yres || -+ region->sx < 0 || region->sx >= info->var.xres || -+ region->sy < 0 || region->sy >= info->var.yres || -+ region->dx < 0 || region->dx >= info->var.xres || -+ region->dy < 0 || region->dy >= info->var.yres || -+ region->sx + region->width > info->var.xres || -+ region->dx + region->width > info->var.xres || -+ region->sy + region->height > info->var.yres || -+ region->dy + region->height > info->var.yres) { -+ cfb_copyarea(info, region); -+ return; -+ } -+ -+ if (region->dy == region->sy && region->dx > region->sx) { -+ /* -+ * A difficult case of overlapped copy. Because DMA can't -+ * copy individual scanlines in backwards direction, we need -+ * two-pass processing. We do it by programming a chain of dma -+ * control blocks in the first 16K part of the buffer and use -+ * the remaining 48K as the intermediate temporary scratch -+ * buffer. The buffer size is sufficient to handle up to -+ * 1920x1200 resolution at 32bpp pixel depth. -+ */ -+ int y; -+ dma_addr_t control_block_pa = fb->cb_handle; -+ dma_addr_t scratchbuf = fb->cb_handle + 16 * 1024; -+ int scanline_size = bytes_per_pixel * region->width; -+ int scanlines_per_cb = (64 * 1024 - 16 * 1024) / scanline_size; -+ -+ for (y = 0; y < region->height; y += scanlines_per_cb) { -+ dma_addr_t src = -+ fb->fb_bus_address + -+ bytes_per_pixel * region->sx + -+ (region->sy + y) * fb->fb.fix.line_length; -+ dma_addr_t dst = -+ fb->fb_bus_address + -+ bytes_per_pixel * region->dx + -+ (region->dy + y) * fb->fb.fix.line_length; -+ -+ if (region->height - y < scanlines_per_cb) -+ scanlines_per_cb = region->height - y; -+ -+ set_dma_cb(cb, burst_size, scratchbuf, scanline_size, -+ src, fb->fb.fix.line_length, -+ scanline_size, scanlines_per_cb); -+ control_block_pa += sizeof(struct bcm2708_dma_cb); -+ cb->next = control_block_pa; -+ cb++; -+ -+ set_dma_cb(cb, burst_size, dst, fb->fb.fix.line_length, -+ scratchbuf, scanline_size, -+ scanline_size, scanlines_per_cb); -+ control_block_pa += sizeof(struct bcm2708_dma_cb); -+ cb->next = control_block_pa; -+ cb++; -+ } -+ /* move the pointer back to the last dma control block */ -+ cb--; -+ } else { -+ /* A single dma control block is enough. */ -+ int sy, dy, stride; -+ if (region->dy <= region->sy) { -+ /* processing from top to bottom */ -+ dy = region->dy; -+ sy = region->sy; -+ stride = fb->fb.fix.line_length; -+ } else { -+ /* processing from bottom to top */ -+ dy = region->dy + region->height - 1; -+ sy = region->sy + region->height - 1; -+ stride = -fb->fb.fix.line_length; -+ } -+ set_dma_cb(cb, burst_size, -+ fb->fb_bus_address + dy * fb->fb.fix.line_length + -+ bytes_per_pixel * region->dx, -+ stride, -+ fb->fb_bus_address + sy * fb->fb.fix.line_length + -+ bytes_per_pixel * region->sx, -+ stride, -+ region->width * bytes_per_pixel, -+ region->height); -+ } -+ -+ /* end of dma control blocks chain */ -+ cb->next = 0; -+ -+ -+ if (pixels < dma_busy_wait_threshold) { -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ bcm_dma_wait_idle(fb->dma_chan_base); -+ } else { -+ void __iomem *dma_chan = fb->dma_chan_base; -+ cb->info |= BCM2708_DMA_INT_EN; -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ while (bcm_dma_is_busy(dma_chan)) { -+ wait_event_interruptible( -+ fb->dma_waitq, -+ !bcm_dma_is_busy(dma_chan)); -+ } -+ fb->stats.dma_irqs++; -+ } -+ fb->stats.dma_copies++; -+} -+ -+static void bcm2708_fb_imageblit(struct fb_info *info, -+ const struct fb_image *image) -+{ -+ /* (is called) print_debug("bcm2708_fb_imageblit\n"); */ -+ cfb_imageblit(info, image); -+} -+ -+static irqreturn_t bcm2708_fb_dma_irq(int irq, void *cxt) -+{ -+ struct bcm2708_fb *fb = cxt; -+ -+ /* FIXME: should read status register to check if this is -+ * actually interrupting us or not, in case this interrupt -+ * ever becomes shared amongst several DMA channels -+ * -+ * readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_IRQ; -+ */ -+ -+ /* acknowledge the interrupt */ -+ writel(BCM2708_DMA_INT, fb->dma_chan_base + BCM2708_DMA_CS); -+ -+ wake_up(&fb->dma_waitq); -+ return IRQ_HANDLED; -+} -+ -+static struct fb_ops bcm2708_fb_ops = { -+ .owner = THIS_MODULE, -+ .fb_check_var = bcm2708_fb_check_var, -+ .fb_set_par = bcm2708_fb_set_par, -+ .fb_setcolreg = bcm2708_fb_setcolreg, -+ .fb_blank = bcm2708_fb_blank, -+ .fb_fillrect = bcm2708_fb_fillrect, -+ .fb_copyarea = bcm2708_fb_copyarea, -+ .fb_imageblit = bcm2708_fb_imageblit, -+ .fb_pan_display = bcm2708_fb_pan_display, -+ .fb_ioctl = bcm2708_ioctl, -+}; -+ -+static int bcm2708_fb_register(struct bcm2708_fb *fb) -+{ -+ int ret; -+ -+ fb->fb.fbops = &bcm2708_fb_ops; -+ fb->fb.flags = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA; -+ fb->fb.pseudo_palette = fb->cmap; -+ -+ strncpy(fb->fb.fix.id, bcm2708_name, sizeof(fb->fb.fix.id)); -+ fb->fb.fix.type = FB_TYPE_PACKED_PIXELS; -+ fb->fb.fix.type_aux = 0; -+ fb->fb.fix.xpanstep = 1; -+ fb->fb.fix.ypanstep = 1; -+ fb->fb.fix.ywrapstep = 0; -+ fb->fb.fix.accel = FB_ACCEL_NONE; -+ -+ fb->fb.var.xres = fbwidth; -+ fb->fb.var.yres = fbheight; -+ fb->fb.var.xres_virtual = fbwidth; -+ fb->fb.var.yres_virtual = fbheight; -+ fb->fb.var.bits_per_pixel = fbdepth; -+ fb->fb.var.vmode = FB_VMODE_NONINTERLACED; -+ fb->fb.var.activate = FB_ACTIVATE_NOW; -+ fb->fb.var.nonstd = 0; -+ fb->fb.var.height = -1; /* height of picture in mm */ -+ fb->fb.var.width = -1; /* width of picture in mm */ -+ fb->fb.var.accel_flags = 0; -+ -+ fb->fb.monspecs.hfmin = 0; -+ fb->fb.monspecs.hfmax = 100000; -+ fb->fb.monspecs.vfmin = 0; -+ fb->fb.monspecs.vfmax = 400; -+ fb->fb.monspecs.dclkmin = 1000000; -+ fb->fb.monspecs.dclkmax = 100000000; -+ -+ bcm2708_fb_set_bitfields(&fb->fb.var); -+ init_waitqueue_head(&fb->dma_waitq); -+ -+ /* -+ * Allocate colourmap. -+ */ -+ -+ fb_set_var(&fb->fb, &fb->fb.var); -+ ret = bcm2708_fb_set_par(&fb->fb); -+ if (ret) -+ return ret; -+ -+ print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n", fbwidth, -+ fbheight, fbdepth, fbswap); -+ -+ ret = register_framebuffer(&fb->fb); -+ print_debug("BCM2708FB: register framebuffer (%d)\n", ret); -+ if (ret == 0) -+ goto out; -+ -+ print_debug("BCM2708FB: cannot register framebuffer (%d)\n", ret); -+out: -+ return ret; -+} -+ -+static int bcm2708_fb_probe(struct platform_device *dev) -+{ -+ struct device_node *fw_np; -+ struct rpi_firmware *fw; -+ struct bcm2708_fb *fb; -+ int ret; -+ -+ fw_np = of_parse_phandle(dev->dev.of_node, "firmware", 0); -+/* Remove comment when booting without Device Tree is no longer supported -+ if (!fw_np) { -+ dev_err(&dev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+*/ -+ fw = rpi_firmware_get(fw_np); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL); -+ if (!fb) { -+ dev_err(&dev->dev, -+ "could not allocate new bcm2708_fb struct\n"); -+ ret = -ENOMEM; -+ goto free_region; -+ } -+ -+ fb->fw = fw; -+ bcm2708_fb_debugfs_init(fb); -+ -+ fb->cb_base = dma_alloc_writecombine(&dev->dev, SZ_64K, -+ &fb->cb_handle, GFP_KERNEL); -+ if (!fb->cb_base) { -+ dev_err(&dev->dev, "cannot allocate DMA CBs\n"); -+ ret = -ENOMEM; -+ goto free_fb; -+ } -+ -+ pr_info("BCM2708FB: allocated DMA memory %08x\n", -+ fb->cb_handle); -+ -+ ret = bcm_dma_chan_alloc(BCM_DMA_FEATURE_BULK, -+ &fb->dma_chan_base, &fb->dma_irq); -+ if (ret < 0) { -+ dev_err(&dev->dev, "couldn't allocate a DMA channel\n"); -+ goto free_cb; -+ } -+ fb->dma_chan = ret; -+ -+ ret = request_irq(fb->dma_irq, bcm2708_fb_dma_irq, -+ 0, "bcm2708_fb dma", fb); -+ if (ret) { -+ pr_err("%s: failed to request DMA irq\n", __func__); -+ goto free_dma_chan; -+ } -+ -+ -+ pr_info("BCM2708FB: allocated DMA channel %d @ %p\n", -+ fb->dma_chan, fb->dma_chan_base); -+ -+ fb->dev = dev; -+ fb->fb.device = &dev->dev; -+ -+ ret = bcm2708_fb_register(fb); -+ if (ret == 0) { -+ platform_set_drvdata(dev, fb); -+ goto out; -+ } -+ -+free_dma_chan: -+ bcm_dma_chan_free(fb->dma_chan); -+free_cb: -+ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); -+free_fb: -+ kfree(fb); -+free_region: -+ dev_err(&dev->dev, "probe failed, err %d\n", ret); -+out: -+ return ret; -+} -+ -+static int bcm2708_fb_remove(struct platform_device *dev) -+{ -+ struct bcm2708_fb *fb = platform_get_drvdata(dev); -+ -+ platform_set_drvdata(dev, NULL); -+ -+ if (fb->fb.screen_base) -+ iounmap(fb->fb.screen_base); -+ unregister_framebuffer(&fb->fb); -+ -+ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); -+ bcm_dma_chan_free(fb->dma_chan); -+ -+ bcm2708_fb_debugfs_deinit(fb); -+ -+ free_irq(fb->dma_irq, fb); -+ -+ kfree(fb); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm2708_fb_of_match_table[] = { -+ { .compatible = "brcm,bcm2708-fb", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2708_fb_of_match_table); -+ -+static struct platform_driver bcm2708_fb_driver = { -+ .probe = bcm2708_fb_probe, -+ .remove = bcm2708_fb_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2708_fb_of_match_table, -+ }, -+}; -+ -+static int __init bcm2708_fb_init(void) -+{ -+ return platform_driver_register(&bcm2708_fb_driver); -+} -+ -+module_init(bcm2708_fb_init); -+ -+static void __exit bcm2708_fb_exit(void) -+{ -+ platform_driver_unregister(&bcm2708_fb_driver); -+} -+ -+module_exit(bcm2708_fb_exit); -+ -+module_param(fbwidth, int, 0644); -+module_param(fbheight, int, 0644); -+module_param(fbdepth, int, 0644); -+module_param(fbswap, int, 0644); -+ -+MODULE_DESCRIPTION("BCM2708 framebuffer driver"); -+MODULE_LICENSE("GPL"); -+ -+MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer"); -+MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer"); -+MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); -+MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); -diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43b82fefe1d32f591d1b2f61d2cd28d0fa8..7626beb6a5bb8df601ddf0f6e6909d1f66ae85d0 100644 ---- a/drivers/video/logo/logo_linux_clut224.ppm -+++ b/drivers/video/logo/logo_linux_clut224.ppm -@@ -1,1604 +1,883 @@ - P3 --# Standard 224-color Linux logo --80 80 -+63 80 - 255 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 6 6 6 10 10 10 10 10 10 -- 10 10 10 6 6 6 6 6 6 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 10 10 10 14 14 14 -- 22 22 22 26 26 26 30 30 30 34 34 34 -- 30 30 30 30 30 30 26 26 26 18 18 18 -- 14 14 14 10 10 10 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 26 26 26 42 42 42 -- 54 54 54 66 66 66 78 78 78 78 78 78 -- 78 78 78 74 74 74 66 66 66 54 54 54 -- 42 42 42 26 26 26 18 18 18 10 10 10 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 22 22 22 42 42 42 66 66 66 86 86 86 -- 66 66 66 38 38 38 38 38 38 22 22 22 -- 26 26 26 34 34 34 54 54 54 66 66 66 -- 86 86 86 70 70 70 46 46 46 26 26 26 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 26 26 26 -- 50 50 50 82 82 82 58 58 58 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 54 54 54 86 86 86 66 66 66 -- 38 38 38 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 22 22 22 50 50 50 -- 78 78 78 34 34 34 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 6 6 6 70 70 70 -- 78 78 78 46 46 46 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 42 42 42 82 82 82 -- 26 26 26 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 14 14 14 -- 46 46 46 34 34 34 6 6 6 2 2 6 -- 42 42 42 78 78 78 42 42 42 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 10 10 10 30 30 30 66 66 66 58 58 58 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 26 26 26 -- 86 86 86 101 101 101 46 46 46 10 10 10 -- 2 2 6 58 58 58 70 70 70 34 34 34 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 14 14 14 42 42 42 86 86 86 10 10 10 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 30 30 30 -- 94 94 94 94 94 94 58 58 58 26 26 26 -- 2 2 6 6 6 6 78 78 78 54 54 54 -- 22 22 22 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 22 22 22 62 62 62 62 62 62 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 26 26 26 -- 54 54 54 38 38 38 18 18 18 10 10 10 -- 2 2 6 2 2 6 34 34 34 82 82 82 -- 38 38 38 14 14 14 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 30 30 30 78 78 78 30 30 30 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 10 10 10 -- 10 10 10 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 78 78 78 -- 50 50 50 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 86 86 86 14 14 14 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 54 54 54 -- 66 66 66 26 26 26 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 82 82 82 2 2 6 2 2 6 -- 2 2 6 6 6 6 10 10 10 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 6 6 6 -- 14 14 14 10 10 10 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 18 18 18 -- 82 82 82 34 34 34 10 10 10 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 2 2 6 -- 6 6 6 6 6 6 22 22 22 34 34 34 -- 6 6 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 18 18 18 34 34 34 -- 10 10 10 50 50 50 22 22 22 2 2 6 -- 2 2 6 2 2 6 2 2 6 10 10 10 -- 86 86 86 42 42 42 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 2 2 6 -- 38 38 38 116 116 116 94 94 94 22 22 22 -- 22 22 22 2 2 6 2 2 6 2 2 6 -- 14 14 14 86 86 86 138 138 138 162 162 162 --154 154 154 38 38 38 26 26 26 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 86 86 86 46 46 46 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 14 14 14 --134 134 134 198 198 198 195 195 195 116 116 116 -- 10 10 10 2 2 6 2 2 6 6 6 6 --101 98 89 187 187 187 210 210 210 218 218 218 --214 214 214 134 134 134 14 14 14 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 86 86 86 50 50 50 18 18 18 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 54 54 54 --218 218 218 195 195 195 226 226 226 246 246 246 -- 58 58 58 2 2 6 2 2 6 30 30 30 --210 210 210 253 253 253 174 174 174 123 123 123 --221 221 221 234 234 234 74 74 74 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 70 70 70 58 58 58 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 82 82 82 2 2 6 106 106 106 --170 170 170 26 26 26 86 86 86 226 226 226 --123 123 123 10 10 10 14 14 14 46 46 46 --231 231 231 190 190 190 6 6 6 70 70 70 -- 90 90 90 238 238 238 158 158 158 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 70 70 70 58 58 58 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 86 86 86 6 6 6 116 116 116 --106 106 106 6 6 6 70 70 70 149 149 149 --128 128 128 18 18 18 38 38 38 54 54 54 --221 221 221 106 106 106 2 2 6 14 14 14 -- 46 46 46 190 190 190 198 198 198 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 74 74 74 62 62 62 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 0 -- 0 0 1 0 0 0 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 94 94 94 14 14 14 101 101 101 --128 128 128 2 2 6 18 18 18 116 116 116 --118 98 46 121 92 8 121 92 8 98 78 10 --162 162 162 106 106 106 2 2 6 2 2 6 -- 2 2 6 195 195 195 195 195 195 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 74 74 74 62 62 62 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 1 -- 0 0 1 0 0 0 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 90 90 90 14 14 14 58 58 58 --210 210 210 26 26 26 54 38 6 154 114 10 --226 170 11 236 186 11 225 175 15 184 144 12 --215 174 15 175 146 61 37 26 9 2 2 6 -- 70 70 70 246 246 246 138 138 138 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 70 70 70 66 66 66 26 26 26 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 86 86 86 14 14 14 10 10 10 --195 195 195 188 164 115 192 133 9 225 175 15 --239 182 13 234 190 10 232 195 16 232 200 30 --245 207 45 241 208 19 232 195 16 184 144 12 --218 194 134 211 206 186 42 42 42 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 50 50 50 74 74 74 30 30 30 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 34 34 34 86 86 86 14 14 14 2 2 6 --121 87 25 192 133 9 219 162 10 239 182 13 --236 186 11 232 195 16 241 208 19 244 214 54 --246 218 60 246 218 38 246 215 20 241 208 19 --241 208 19 226 184 13 121 87 25 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 50 50 50 82 82 82 34 34 34 10 10 10 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 34 34 34 82 82 82 30 30 30 61 42 6 --180 123 7 206 145 10 230 174 11 239 182 13 --234 190 10 238 202 15 241 208 19 246 218 74 --246 218 38 246 215 20 246 215 20 246 215 20 --226 184 13 215 174 15 184 144 12 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 26 26 26 94 94 94 42 42 42 14 14 14 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 50 50 50 104 69 6 --192 133 9 216 158 10 236 178 12 236 186 11 --232 195 16 241 208 19 244 214 54 245 215 43 --246 215 20 246 215 20 241 208 19 198 155 10 --200 144 11 216 158 10 156 118 10 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 90 90 90 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 46 46 46 22 22 22 --137 92 6 210 162 10 239 182 13 238 190 10 --238 202 15 241 208 19 246 215 20 246 215 20 --241 208 19 203 166 17 185 133 11 210 150 10 --216 158 10 210 150 10 102 78 10 2 2 6 -- 6 6 6 54 54 54 14 14 14 2 2 6 -- 2 2 6 62 62 62 74 74 74 30 30 30 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 34 34 34 78 78 78 50 50 50 6 6 6 -- 94 70 30 139 102 15 190 146 13 226 184 13 --232 200 30 232 195 16 215 174 15 190 146 13 --168 122 10 192 133 9 210 150 10 213 154 11 --202 150 34 182 157 106 101 98 89 2 2 6 -- 2 2 6 78 78 78 116 116 116 58 58 58 -- 2 2 6 22 22 22 90 90 90 46 46 46 -- 18 18 18 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 86 86 86 50 50 50 6 6 6 --128 128 128 174 154 114 156 107 11 168 122 10 --198 155 10 184 144 12 197 138 11 200 144 11 --206 145 10 206 145 10 197 138 11 188 164 115 --195 195 195 198 198 198 174 174 174 14 14 14 -- 2 2 6 22 22 22 116 116 116 116 116 116 -- 22 22 22 2 2 6 74 74 74 70 70 70 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 101 101 101 26 26 26 10 10 10 --138 138 138 190 190 190 174 154 114 156 107 11 --197 138 11 200 144 11 197 138 11 192 133 9 --180 123 7 190 142 34 190 178 144 187 187 187 --202 202 202 221 221 221 214 214 214 66 66 66 -- 2 2 6 2 2 6 50 50 50 62 62 62 -- 6 6 6 2 2 6 10 10 10 90 90 90 -- 50 50 50 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 34 34 34 -- 74 74 74 74 74 74 2 2 6 6 6 6 --144 144 144 198 198 198 190 190 190 178 166 146 --154 121 60 156 107 11 156 107 11 168 124 44 --174 154 114 187 187 187 190 190 190 210 210 210 --246 246 246 253 253 253 253 253 253 182 182 182 -- 6 6 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 62 62 62 -- 74 74 74 34 34 34 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 10 10 10 22 22 22 54 54 54 -- 94 94 94 18 18 18 2 2 6 46 46 46 --234 234 234 221 221 221 190 190 190 190 190 190 --190 190 190 187 187 187 187 187 187 190 190 190 --190 190 190 195 195 195 214 214 214 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 -- 82 82 82 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 14 14 14 -- 86 86 86 54 54 54 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 46 46 46 90 90 90 -- 46 46 46 18 18 18 6 6 6 182 182 182 --253 253 253 246 246 246 206 206 206 190 190 190 --190 190 190 190 190 190 190 190 190 190 190 190 --206 206 206 231 231 231 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --202 202 202 14 14 14 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 42 42 42 86 86 86 42 42 42 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 14 14 14 38 38 38 74 74 74 66 66 66 -- 2 2 6 6 6 6 90 90 90 250 250 250 --253 253 253 253 253 253 238 238 238 198 198 198 --190 190 190 190 190 190 195 195 195 221 221 221 --246 246 246 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 82 82 82 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 78 78 78 70 70 70 34 34 34 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 34 34 34 66 66 66 78 78 78 6 6 6 -- 2 2 6 18 18 18 218 218 218 253 253 253 --253 253 253 253 253 253 253 253 253 246 246 246 --226 226 226 231 231 231 246 246 246 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 178 178 178 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 18 18 18 90 90 90 62 62 62 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 26 26 26 -- 58 58 58 90 90 90 18 18 18 2 2 6 -- 2 2 6 110 110 110 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 231 231 231 18 18 18 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 18 18 18 94 94 94 -- 54 54 54 26 26 26 10 10 10 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 22 22 22 50 50 50 -- 90 90 90 26 26 26 2 2 6 2 2 6 -- 14 14 14 195 195 195 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 242 242 242 54 54 54 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 38 38 38 -- 86 86 86 50 50 50 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 38 38 38 82 82 82 -- 34 34 34 2 2 6 2 2 6 2 2 6 -- 42 42 42 195 195 195 246 246 246 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --242 242 242 242 242 242 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 250 250 250 246 246 246 238 238 238 --226 226 226 231 231 231 101 101 101 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 38 38 38 82 82 82 42 42 42 14 14 14 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 10 10 10 26 26 26 62 62 62 66 66 66 -- 2 2 6 2 2 6 2 2 6 6 6 6 -- 70 70 70 170 170 170 206 206 206 234 234 234 --246 246 246 250 250 250 250 250 250 238 238 238 --226 226 226 231 231 231 238 238 238 250 250 250 --250 250 250 250 250 250 246 246 246 231 231 231 --214 214 214 206 206 206 202 202 202 202 202 202 --198 198 198 202 202 202 182 182 182 18 18 18 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 62 62 62 66 66 66 30 30 30 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 14 14 14 42 42 42 82 82 82 18 18 18 -- 2 2 6 2 2 6 2 2 6 10 10 10 -- 94 94 94 182 182 182 218 218 218 242 242 242 --250 250 250 253 253 253 253 253 253 250 250 250 --234 234 234 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 246 246 246 --238 238 238 226 226 226 210 210 210 202 202 202 --195 195 195 195 195 195 210 210 210 158 158 158 -- 6 6 6 14 14 14 50 50 50 14 14 14 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 86 86 86 46 46 46 -- 18 18 18 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 22 22 22 54 54 54 70 70 70 2 2 6 -- 2 2 6 10 10 10 2 2 6 22 22 22 --166 166 166 231 231 231 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --242 242 242 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 246 246 246 --231 231 231 206 206 206 198 198 198 226 226 226 -- 94 94 94 2 2 6 6 6 6 38 38 38 -- 30 30 30 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 62 62 62 66 66 66 -- 26 26 26 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 74 74 74 50 50 50 2 2 6 -- 26 26 26 26 26 26 2 2 6 106 106 106 --238 238 238 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 246 246 246 218 218 218 202 202 202 --210 210 210 14 14 14 2 2 6 2 2 6 -- 30 30 30 22 22 22 2 2 6 2 2 6 -- 2 2 6 2 2 6 18 18 18 86 86 86 -- 42 42 42 14 14 14 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 90 90 90 22 22 22 2 2 6 -- 42 42 42 2 2 6 18 18 18 218 218 218 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 250 250 250 221 221 221 --218 218 218 101 101 101 2 2 6 14 14 14 -- 18 18 18 38 38 38 10 10 10 2 2 6 -- 2 2 6 2 2 6 2 2 6 78 78 78 -- 58 58 58 22 22 22 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 54 54 54 82 82 82 2 2 6 26 26 26 -- 22 22 22 2 2 6 123 123 123 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --238 238 238 198 198 198 6 6 6 38 38 38 -- 58 58 58 26 26 26 38 38 38 2 2 6 -- 2 2 6 2 2 6 2 2 6 46 46 46 -- 78 78 78 30 30 30 10 10 10 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 30 30 30 -- 74 74 74 58 58 58 2 2 6 42 42 42 -- 2 2 6 22 22 22 231 231 231 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 246 246 246 46 46 46 38 38 38 -- 42 42 42 14 14 14 38 38 38 14 14 14 -- 2 2 6 2 2 6 2 2 6 6 6 6 -- 86 86 86 46 46 46 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 14 14 14 42 42 42 -- 90 90 90 18 18 18 18 18 18 26 26 26 -- 2 2 6 116 116 116 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 250 250 250 238 238 238 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 94 94 94 6 6 6 -- 2 2 6 2 2 6 10 10 10 34 34 34 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 74 74 74 58 58 58 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 10 10 10 26 26 26 66 66 66 -- 82 82 82 2 2 6 38 38 38 6 6 6 -- 14 14 14 210 210 210 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 246 246 246 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 144 144 144 2 2 6 -- 2 2 6 2 2 6 2 2 6 46 46 46 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 42 42 42 74 74 74 30 30 30 10 10 10 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 42 42 42 90 90 90 -- 26 26 26 6 6 6 42 42 42 2 2 6 -- 74 74 74 250 250 250 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 242 242 242 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 182 182 182 2 2 6 -- 2 2 6 2 2 6 2 2 6 46 46 46 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 10 10 10 86 86 86 38 38 38 10 10 10 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 10 10 10 26 26 26 66 66 66 82 82 82 -- 2 2 6 22 22 22 18 18 18 2 2 6 --149 149 149 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 206 206 206 2 2 6 -- 2 2 6 2 2 6 2 2 6 38 38 38 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 86 86 86 46 46 46 14 14 14 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 18 18 18 46 46 46 86 86 86 18 18 18 -- 2 2 6 34 34 34 10 10 10 6 6 6 --210 210 210 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 221 221 221 6 6 6 -- 2 2 6 2 2 6 6 6 6 30 30 30 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 82 82 82 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 26 26 26 66 66 66 62 62 62 2 2 6 -- 2 2 6 38 38 38 10 10 10 26 26 26 --238 238 238 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 238 238 238 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 6 6 6 -- 2 2 6 2 2 6 10 10 10 30 30 30 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 58 58 58 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 78 78 78 6 6 6 2 2 6 -- 2 2 6 46 46 46 14 14 14 42 42 42 --246 246 246 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 10 10 10 -- 2 2 6 2 2 6 22 22 22 14 14 14 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 62 62 62 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 74 74 74 2 2 6 2 2 6 -- 14 14 14 70 70 70 34 34 34 62 62 62 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 14 14 14 -- 2 2 6 2 2 6 30 30 30 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 62 62 62 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 54 54 54 62 62 62 2 2 6 2 2 6 -- 2 2 6 30 30 30 46 46 46 70 70 70 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 226 226 226 10 10 10 -- 2 2 6 6 6 6 30 30 30 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 58 58 58 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 22 22 22 -- 58 58 58 62 62 62 2 2 6 2 2 6 -- 2 2 6 2 2 6 30 30 30 78 78 78 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 206 206 206 2 2 6 -- 22 22 22 34 34 34 18 14 6 22 22 22 -- 26 26 26 18 18 18 6 6 6 2 2 6 -- 2 2 6 82 82 82 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 26 26 26 -- 62 62 62 106 106 106 74 54 14 185 133 11 --210 162 10 121 92 8 6 6 6 62 62 62 --238 238 238 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 158 158 158 18 18 18 -- 14 14 14 2 2 6 2 2 6 2 2 6 -- 6 6 6 18 18 18 66 66 66 38 38 38 -- 6 6 6 94 94 94 50 50 50 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 10 10 10 10 10 10 18 18 18 38 38 38 -- 78 78 78 142 134 106 216 158 10 242 186 14 --246 190 14 246 190 14 156 118 10 10 10 10 -- 90 90 90 238 238 238 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 250 250 250 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 246 230 190 --238 204 91 238 204 91 181 142 44 37 26 9 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 38 38 38 46 46 46 -- 26 26 26 106 106 106 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 14 14 14 22 22 22 -- 30 30 30 38 38 38 50 50 50 70 70 70 --106 106 106 190 142 34 226 170 11 242 186 14 --246 190 14 246 190 14 246 190 14 154 114 10 -- 6 6 6 74 74 74 226 226 226 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 250 250 250 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 228 184 62 --241 196 14 241 208 19 232 195 16 38 30 10 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 30 30 30 26 26 26 --203 166 17 154 142 90 66 66 66 26 26 26 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 38 38 38 58 58 58 -- 78 78 78 86 86 86 101 101 101 123 123 123 --175 146 61 210 150 10 234 174 13 246 186 14 --246 190 14 246 190 14 246 190 14 238 190 10 --102 78 10 2 2 6 46 46 46 198 198 198 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 224 178 62 --242 186 14 241 196 14 210 166 10 22 18 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 6 6 6 121 92 8 --238 202 15 232 195 16 82 82 82 34 34 34 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 14 14 14 38 38 38 70 70 70 154 122 46 --190 142 34 200 144 11 197 138 11 197 138 11 --213 154 11 226 170 11 242 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --225 175 15 46 32 6 2 2 6 22 22 22 --158 158 158 250 250 250 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 250 250 250 242 242 242 224 178 62 --239 182 13 236 186 11 213 154 11 46 32 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 61 42 6 225 175 15 --238 190 10 236 186 11 112 100 78 42 42 42 -- 14 14 14 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 22 22 22 54 54 54 154 122 46 213 154 11 --226 170 11 230 174 11 226 170 11 226 170 11 --236 178 12 242 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --241 196 14 184 144 12 10 10 10 2 2 6 -- 6 6 6 116 116 116 242 242 242 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 231 231 231 198 198 198 214 170 54 --236 178 12 236 178 12 210 150 10 137 92 6 -- 18 14 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 70 47 6 200 144 11 236 178 12 --239 182 13 239 182 13 124 112 88 58 58 58 -- 22 22 22 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 70 70 70 180 133 36 226 170 11 --239 182 13 242 186 14 242 186 14 246 186 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 232 195 16 98 70 6 2 2 6 -- 2 2 6 2 2 6 66 66 66 221 221 221 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 206 206 206 198 198 198 214 166 58 --230 174 11 230 174 11 216 158 10 192 133 9 --163 110 8 116 81 8 102 78 10 116 81 8 --167 114 7 197 138 11 226 170 11 239 182 13 --242 186 14 242 186 14 162 146 94 78 78 78 -- 34 34 34 14 14 14 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 30 30 30 78 78 78 190 142 34 226 170 11 --239 182 13 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 241 196 14 203 166 17 22 18 6 -- 2 2 6 2 2 6 2 2 6 38 38 38 --218 218 218 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 206 206 206 198 198 198 202 162 69 --226 170 11 236 178 12 224 166 10 210 150 10 --200 144 11 197 138 11 192 133 9 197 138 11 --210 150 10 226 170 11 242 186 14 246 190 14 --246 190 14 246 186 14 225 175 15 124 112 88 -- 62 62 62 30 30 30 14 14 14 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 174 135 50 224 166 10 --239 182 13 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 241 196 14 139 102 15 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 78 78 78 250 250 250 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 214 214 214 198 198 198 190 150 46 --219 162 10 236 178 12 234 174 13 224 166 10 --216 158 10 213 154 11 213 154 11 216 158 10 --226 170 11 239 182 13 246 190 14 246 190 14 --246 190 14 246 190 14 242 186 14 206 162 42 --101 101 101 58 58 58 30 30 30 14 14 14 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 74 74 74 174 135 50 216 158 10 --236 178 12 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 241 196 14 226 184 13 -- 61 42 6 2 2 6 2 2 6 2 2 6 -- 22 22 22 238 238 238 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 226 226 226 187 187 187 180 133 36 --216 158 10 236 178 12 239 182 13 236 178 12 --230 174 11 226 170 11 226 170 11 230 174 11 --236 178 12 242 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 186 14 239 182 13 --206 162 42 106 106 106 66 66 66 34 34 34 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 26 26 26 70 70 70 163 133 67 213 154 11 --236 178 12 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 241 196 14 --190 146 13 18 14 6 2 2 6 2 2 6 -- 46 46 46 246 246 246 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 221 221 221 86 86 86 156 107 11 --216 158 10 236 178 12 242 186 14 246 186 14 --242 186 14 239 182 13 239 182 13 242 186 14 --242 186 14 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --242 186 14 225 175 15 142 122 72 66 66 66 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 26 26 26 70 70 70 163 133 67 210 150 10 --236 178 12 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --232 195 16 121 92 8 34 34 34 106 106 106 --221 221 221 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --242 242 242 82 82 82 18 14 6 163 110 8 --216 158 10 236 178 12 242 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 242 186 14 163 133 67 -- 46 46 46 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 163 133 67 210 150 10 --236 178 12 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --241 196 14 215 174 15 190 178 144 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 218 218 218 -- 58 58 58 2 2 6 22 18 6 167 114 7 --216 158 10 236 178 12 246 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 186 14 242 186 14 190 150 46 -- 54 54 54 22 22 22 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 38 38 38 86 86 86 180 133 36 213 154 11 --236 178 12 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 232 195 16 190 146 13 214 214 214 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 250 250 250 170 170 170 26 26 26 -- 2 2 6 2 2 6 37 26 9 163 110 8 --219 162 10 239 182 13 246 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 186 14 236 178 12 224 166 10 142 122 72 -- 46 46 46 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 109 106 95 192 133 9 224 166 10 --242 186 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --242 186 14 226 184 13 210 162 10 142 110 46 --226 226 226 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --198 198 198 66 66 66 2 2 6 2 2 6 -- 2 2 6 2 2 6 50 34 6 156 107 11 --219 162 10 239 182 13 246 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 242 186 14 --234 174 13 213 154 11 154 122 46 66 66 66 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 22 22 22 -- 58 58 58 154 121 60 206 145 10 234 174 13 --242 186 14 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 186 14 236 178 12 210 162 10 163 110 8 -- 61 42 6 138 138 138 218 218 218 250 250 250 --253 253 253 253 253 253 253 253 253 250 250 250 --242 242 242 210 210 210 144 144 144 66 66 66 -- 6 6 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 61 42 6 163 110 8 --216 158 10 236 178 12 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 239 182 13 230 174 11 216 158 10 --190 142 34 124 112 88 70 70 70 38 38 38 -- 18 18 18 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 22 22 22 -- 62 62 62 168 124 44 206 145 10 224 166 10 --236 178 12 239 182 13 242 186 14 242 186 14 --246 186 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 236 178 12 216 158 10 175 118 6 -- 80 54 7 2 2 6 6 6 6 30 30 30 -- 54 54 54 62 62 62 50 50 50 38 38 38 -- 14 14 14 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 80 54 7 167 114 7 --213 154 11 236 178 12 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 242 186 14 239 182 13 239 182 13 --230 174 11 210 150 10 174 135 50 124 112 88 -- 82 82 82 54 54 54 34 34 34 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 158 118 36 192 133 9 200 144 11 --216 158 10 219 162 10 224 166 10 226 170 11 --230 174 11 236 178 12 239 182 13 239 182 13 --242 186 14 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 186 14 230 174 11 210 150 10 163 110 8 --104 69 6 10 10 10 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 91 60 6 167 114 7 --206 145 10 230 174 11 242 186 14 246 190 14 --246 190 14 246 190 14 246 186 14 242 186 14 --239 182 13 230 174 11 224 166 10 213 154 11 --180 133 36 124 112 88 86 86 86 58 58 58 -- 38 38 38 22 22 22 10 10 10 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 34 34 34 70 70 70 138 110 50 158 118 36 --167 114 7 180 123 7 192 133 9 197 138 11 --200 144 11 206 145 10 213 154 11 219 162 10 --224 166 10 230 174 11 239 182 13 242 186 14 --246 186 14 246 186 14 246 186 14 246 186 14 --239 182 13 216 158 10 185 133 11 152 99 6 --104 69 6 18 14 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 80 54 7 152 99 6 --192 133 9 219 162 10 236 178 12 239 182 13 --246 186 14 242 186 14 239 182 13 236 178 12 --224 166 10 206 145 10 192 133 9 154 121 60 -- 94 94 94 62 62 62 42 42 42 22 22 22 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 18 18 18 34 34 34 58 58 58 78 78 78 --101 98 89 124 112 88 142 110 46 156 107 11 --163 110 8 167 114 7 175 118 6 180 123 7 --185 133 11 197 138 11 210 150 10 219 162 10 --226 170 11 236 178 12 236 178 12 234 174 13 --219 162 10 197 138 11 163 110 8 130 83 6 -- 91 60 6 10 10 10 2 2 6 2 2 6 -- 18 18 18 38 38 38 38 38 38 38 38 38 -- 38 38 38 38 38 38 38 38 38 38 38 38 -- 38 38 38 38 38 38 26 26 26 2 2 6 -- 2 2 6 6 6 6 70 47 6 137 92 6 --175 118 6 200 144 11 219 162 10 230 174 11 --234 174 13 230 174 11 219 162 10 210 150 10 --192 133 9 163 110 8 124 112 88 82 82 82 -- 50 50 50 30 30 30 14 14 14 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 22 22 22 34 34 34 -- 42 42 42 58 58 58 74 74 74 86 86 86 --101 98 89 122 102 70 130 98 46 121 87 25 --137 92 6 152 99 6 163 110 8 180 123 7 --185 133 11 197 138 11 206 145 10 200 144 11 --180 123 7 156 107 11 130 83 6 104 69 6 -- 50 34 6 54 54 54 110 110 110 101 98 89 -- 86 86 86 82 82 82 78 78 78 78 78 78 -- 78 78 78 78 78 78 78 78 78 78 78 78 -- 78 78 78 82 82 82 86 86 86 94 94 94 --106 106 106 101 101 101 86 66 34 124 80 6 --156 107 11 180 123 7 192 133 9 200 144 11 --206 145 10 200 144 11 192 133 9 175 118 6 --139 102 15 109 106 95 70 70 70 42 42 42 -- 22 22 22 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 10 10 10 -- 14 14 14 22 22 22 30 30 30 38 38 38 -- 50 50 50 62 62 62 74 74 74 90 90 90 --101 98 89 112 100 78 121 87 25 124 80 6 --137 92 6 152 99 6 152 99 6 152 99 6 --138 86 6 124 80 6 98 70 6 86 66 30 --101 98 89 82 82 82 58 58 58 46 46 46 -- 38 38 38 34 34 34 34 34 34 34 34 34 -- 34 34 34 34 34 34 34 34 34 34 34 34 -- 34 34 34 34 34 34 38 38 38 42 42 42 -- 54 54 54 82 82 82 94 86 76 91 60 6 --134 86 6 156 107 11 167 114 7 175 118 6 --175 118 6 167 114 7 152 99 6 121 87 25 --101 98 89 62 62 62 34 34 34 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 6 6 6 10 10 10 -- 18 18 18 22 22 22 30 30 30 42 42 42 -- 50 50 50 66 66 66 86 86 86 101 98 89 --106 86 58 98 70 6 104 69 6 104 69 6 --104 69 6 91 60 6 82 62 34 90 90 90 -- 62 62 62 38 38 38 22 22 22 14 14 14 -- 10 10 10 10 10 10 10 10 10 10 10 10 -- 10 10 10 10 10 10 6 6 6 10 10 10 -- 10 10 10 10 10 10 10 10 10 14 14 14 -- 22 22 22 42 42 42 70 70 70 89 81 66 -- 80 54 7 104 69 6 124 80 6 137 92 6 --134 86 6 116 81 8 100 82 52 86 86 86 -- 58 58 58 30 30 30 14 14 14 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 10 10 10 14 14 14 -- 18 18 18 26 26 26 38 38 38 54 54 54 -- 70 70 70 86 86 86 94 86 76 89 81 66 -- 89 81 66 86 86 86 74 74 74 50 50 50 -- 30 30 30 14 14 14 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 34 34 34 58 58 58 -- 82 82 82 89 81 66 89 81 66 89 81 66 -- 94 86 66 94 86 76 74 74 74 50 50 50 -- 26 26 26 14 14 14 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 6 6 6 14 14 14 18 18 18 -- 30 30 30 38 38 38 46 46 46 54 54 54 -- 50 50 50 42 42 42 30 30 30 18 18 18 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 14 14 14 26 26 26 -- 38 38 38 50 50 50 58 58 58 58 58 58 -- 54 54 54 42 42 42 30 30 30 18 18 18 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 6 6 6 10 10 10 14 14 14 18 18 18 -- 18 18 18 14 14 14 10 10 10 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 14 14 14 18 18 18 22 22 22 22 22 22 -- 18 18 18 14 14 14 10 10 10 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 -+0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 -+0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -+10 15 3 2 3 1 12 18 4 42 61 14 19 27 6 11 16 4 -+38 55 13 10 15 3 3 4 1 10 15 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 1 -+12 18 4 1 1 0 23 34 8 31 45 11 10 15 3 32 47 11 -+34 49 12 3 4 1 3 4 1 3 4 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 10 15 3 29 42 10 26 37 9 12 18 4 -+55 80 19 81 118 28 55 80 19 92 132 31 106 153 36 69 100 23 -+100 144 34 80 116 27 42 61 14 81 118 28 23 34 8 27 40 9 -+15 21 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 1 1 0 29 42 10 15 21 5 50 72 17 -+74 107 25 45 64 15 102 148 35 80 116 27 84 121 28 111 160 38 -+69 100 23 65 94 22 81 118 28 29 42 10 17 25 6 29 42 10 -+23 34 8 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 -+15 21 5 15 21 5 34 49 12 101 146 34 111 161 38 97 141 33 -+97 141 33 119 172 41 117 170 40 116 167 40 118 170 40 118 171 40 -+117 169 40 118 170 40 111 160 38 118 170 40 96 138 32 89 128 30 -+81 118 28 11 16 4 10 15 3 1 1 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+3 4 1 3 4 1 34 49 12 101 146 34 79 115 27 111 160 38 -+114 165 39 113 163 39 118 170 40 117 169 40 118 171 40 117 169 40 -+116 167 40 119 172 41 113 163 39 92 132 31 105 151 36 113 163 39 -+75 109 26 19 27 6 16 23 5 11 16 4 0 1 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 -+80 116 27 106 153 36 105 151 36 114 165 39 118 170 40 118 171 40 -+118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 170 40 117 169 40 118 170 40 118 170 40 -+117 170 40 75 109 26 75 109 26 34 49 12 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 -+64 92 22 65 94 22 100 144 34 118 171 40 118 170 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 171 41 118 170 40 117 169 40 -+109 158 37 105 151 36 104 150 35 47 69 16 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+42 61 14 115 167 39 118 170 40 117 169 40 117 169 40 117 169 40 -+117 170 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 118 170 40 96 138 32 17 25 6 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 69 16 -+114 165 39 117 168 40 117 170 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 118 170 40 117 169 40 117 169 40 117 169 40 -+117 170 40 119 172 41 96 138 32 12 18 4 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 -+32 47 11 105 151 36 118 170 40 117 169 40 117 169 40 116 168 40 -+109 157 37 111 160 38 117 169 40 118 171 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 171 40 69 100 23 2 3 1 -+0 0 0 0 0 0 0 0 0 0 0 0 19 27 6 101 146 34 -+118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 170 40 -+118 171 40 115 166 39 107 154 36 111 161 38 117 169 40 117 169 40 -+117 169 40 118 171 40 75 109 26 19 27 6 2 3 1 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 -+89 128 30 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+111 160 38 92 132 31 79 115 27 96 138 32 115 166 39 119 171 41 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 170 40 109 157 37 26 37 9 -+0 0 0 0 0 0 0 0 0 0 0 0 64 92 22 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 170 40 118 171 40 109 157 37 -+89 128 30 81 118 28 100 144 34 115 166 39 117 169 40 117 169 40 -+117 169 40 117 170 40 113 163 39 60 86 20 1 1 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+27 40 9 96 138 32 118 170 40 117 169 40 117 169 40 117 169 40 -+117 170 40 117 169 40 101 146 34 67 96 23 55 80 19 84 121 28 -+113 163 39 119 171 41 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 65 94 22 -+0 0 0 0 0 0 0 0 0 15 21 5 101 146 34 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 118 170 40 118 171 40 104 150 35 69 100 23 53 76 18 -+81 118 28 111 160 38 118 170 40 117 169 40 117 169 40 117 169 40 -+117 169 40 114 165 39 69 100 23 10 15 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -+31 45 11 77 111 26 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 118 170 40 116 168 40 92 132 31 47 69 16 -+38 55 13 81 118 28 113 163 39 119 171 41 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 171 41 92 132 31 -+10 15 3 0 0 0 0 0 0 36 52 12 115 166 39 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 -+118 171 40 102 148 35 64 92 22 34 49 12 65 94 22 106 153 36 -+118 171 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 -+118 170 40 107 154 36 55 80 19 15 21 5 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+29 42 10 101 146 34 118 171 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 113 163 39 -+75 109 26 27 40 9 36 52 12 89 128 30 116 167 40 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 104 150 35 -+16 23 5 0 0 0 0 0 0 53 76 18 118 171 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 109 157 37 -+67 96 23 23 34 8 42 61 14 96 138 32 118 170 40 118 170 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 74 107 25 10 15 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 31 45 11 101 146 34 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+119 171 41 102 148 35 47 69 16 14 20 5 50 72 17 102 148 35 -+118 171 40 117 169 40 117 169 40 117 169 40 118 170 40 102 148 35 -+15 21 5 0 0 0 0 0 0 50 72 17 118 170 40 117 169 40 -+117 169 40 117 169 40 118 170 40 116 167 40 84 121 28 27 40 9 -+19 27 6 74 107 25 114 165 39 118 171 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 75 109 26 10 15 4 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 38 55 13 102 148 35 118 171 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 118 170 40 115 167 39 77 111 26 17 25 6 19 27 6 -+77 111 26 115 166 39 118 170 40 117 169 40 119 172 41 81 118 28 -+3 4 1 0 0 0 0 0 0 27 40 9 111 160 38 118 170 40 -+117 169 40 118 171 40 105 151 36 50 72 17 10 15 3 38 55 13 -+100 144 34 118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 79 115 27 15 21 5 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 10 15 3 64 92 22 111 160 38 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 171 40 96 138 32 32 47 11 -+3 4 1 50 72 17 107 154 36 120 173 41 105 151 36 31 45 11 -+0 0 0 0 0 0 0 0 0 3 4 1 65 94 22 117 169 40 -+118 170 40 89 128 30 26 37 9 3 4 1 60 86 20 111 161 38 -+118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+97 141 33 36 52 12 1 1 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 14 20 5 75 109 26 117 168 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 107 154 36 -+45 64 15 2 3 1 31 45 11 75 109 26 32 47 11 0 1 0 -+0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 55 80 19 -+65 94 22 11 16 4 11 16 4 75 109 26 116 168 40 118 170 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 107 154 36 -+47 69 16 3 4 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 12 18 4 69 100 23 111 161 38 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 -+111 160 38 50 72 17 2 3 1 2 3 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -+1 1 0 12 18 4 81 118 28 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 170 40 118 171 40 101 146 34 -+42 61 14 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 3 4 1 36 52 12 89 128 30 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+118 171 41 101 146 34 14 20 5 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 47 69 16 118 170 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 170 40 111 160 38 69 100 23 19 27 6 -+0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 11 16 4 69 100 23 -+115 167 39 119 172 41 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+119 172 41 75 109 26 3 4 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 23 34 8 106 153 36 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 118 170 40 119 172 41 105 151 36 42 61 14 2 3 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 15 21 5 -+45 64 15 80 116 27 114 165 39 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 119 172 41 -+97 141 33 20 30 7 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 1 1 0 53 76 18 114 165 39 118 171 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+118 171 40 104 150 35 64 92 22 31 45 11 10 15 3 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 36 52 12 97 141 33 109 158 37 113 163 39 116 168 40 -+117 169 40 117 170 40 118 170 40 119 172 41 115 167 39 84 121 28 -+23 34 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 3 4 1 50 72 17 102 148 35 118 171 40 -+119 171 41 118 170 40 117 169 40 117 169 40 115 166 39 111 161 38 -+109 157 37 79 115 27 12 18 4 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 3 4 1 15 21 5 23 34 8 45 64 15 106 153 36 -+116 167 40 111 160 38 101 146 34 79 115 27 42 61 14 10 15 3 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 1 1 0 20 30 7 60 86 20 -+89 128 30 106 153 36 113 163 39 117 169 40 84 121 28 29 42 10 -+19 27 6 10 15 3 2 3 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 38 55 13 -+36 52 12 26 37 9 12 18 4 2 3 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 1 0 0 19 2 7 52 5 18 -+78 7 27 88 8 31 81 7 29 56 5 19 25 2 9 3 0 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+3 4 1 19 27 6 31 45 11 38 55 13 32 47 11 3 4 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 -+9 0 3 12 1 4 9 0 3 4 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 28 3 10 99 9 35 156 14 55 182 16 64 -+189 17 66 190 17 67 189 17 66 184 17 65 166 15 58 118 13 41 -+45 4 16 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 11 1 4 52 5 18 101 9 35 134 12 47 -+151 14 53 154 14 54 151 14 53 113 10 40 11 1 4 0 0 0 -+3 0 1 67 6 24 159 14 56 190 17 67 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 191 17 67 -+174 16 61 101 9 35 14 1 5 0 0 0 35 3 12 108 10 38 -+122 11 43 122 11 43 112 10 39 87 8 30 50 5 17 13 1 5 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+3 0 1 56 5 19 141 13 49 182 16 64 191 17 67 191 17 67 -+190 17 67 190 17 67 191 17 67 113 10 40 3 0 1 1 0 0 -+79 7 28 180 16 63 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+189 17 66 188 17 66 122 11 43 11 1 4 41 4 14 176 16 62 -+191 17 67 191 17 67 191 17 67 190 17 67 181 16 63 146 13 51 -+75 7 26 10 1 4 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 1 2 -+90 8 32 178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 41 4 14 -+173 16 61 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 88 8 31 1 0 0 89 8 31 -+185 17 65 189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 -+186 17 65 124 11 43 25 2 9 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 89 8 31 -+184 17 65 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 151 14 53 34 3 12 0 0 0 0 0 0 79 7 28 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 191 17 67 146 13 51 9 1 3 7 1 2 -+108 10 38 187 17 66 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 176 16 62 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+151 14 53 38 3 13 0 0 0 0 0 0 0 0 0 50 5 17 -+180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 191 17 67 141 13 49 7 1 3 0 0 0 -+11 1 4 112 10 39 187 17 66 189 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 113 10 40 5 0 2 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 7 1 3 132 12 46 191 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 -+35 3 12 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 -+101 9 35 185 17 65 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 190 17 67 180 16 63 67 6 24 0 0 0 0 0 0 -+0 0 0 11 1 4 108 10 38 186 17 65 189 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 44 4 15 177 16 62 189 17 66 -+188 17 66 188 17 66 189 17 66 189 17 66 134 12 47 28 3 10 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+8 1 3 79 7 28 159 14 56 188 17 66 191 17 67 190 17 67 -+189 17 66 189 17 66 189 17 66 189 17 66 190 17 67 191 17 67 -+188 17 66 158 14 55 72 7 25 4 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 8 1 3 95 9 33 182 16 64 189 17 67 -+188 17 66 188 17 66 188 17 66 191 17 67 122 11 43 3 0 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 88 8 31 190 17 67 188 17 66 -+188 17 66 189 17 66 185 17 65 113 10 40 18 2 6 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 1 0 0 24 2 8 77 7 27 124 11 43 154 14 54 -+168 15 59 173 16 61 173 16 61 168 15 59 154 14 54 124 11 43 -+77 7 27 22 2 8 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 5 0 2 77 7 27 173 16 61 -+190 17 67 188 17 66 188 17 66 190 17 67 164 15 57 23 2 8 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 1 0 0 118 13 41 191 17 67 188 17 66 -+190 17 67 174 16 61 87 8 30 8 1 3 0 0 0 0 0 0 -+0 0 0 0 0 0 10 1 4 29 3 10 40 4 14 36 3 13 -+18 2 6 2 0 1 0 0 0 0 0 0 3 0 1 14 1 5 -+26 2 9 33 3 11 32 3 11 25 2 9 13 1 5 3 0 1 -+0 0 0 14 1 5 56 5 19 95 9 33 109 10 38 101 9 35 -+77 7 27 35 3 12 5 0 2 0 0 0 1 0 0 56 5 19 -+156 14 55 190 17 67 188 17 66 188 17 66 182 16 64 50 5 17 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 189 17 66 -+151 14 53 52 5 18 2 0 1 0 0 0 0 0 0 1 0 0 -+28 3 10 90 8 32 146 13 51 170 15 60 178 16 62 174 16 61 -+158 14 55 112 10 39 40 4 14 1 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 -+56 5 19 146 13 51 183 17 64 191 17 67 191 17 67 191 17 67 -+188 17 66 173 16 61 122 11 43 41 4 14 1 0 0 0 0 0 -+30 3 10 124 11 43 185 17 65 190 17 67 187 17 66 67 6 24 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 6 1 2 134 12 47 168 15 59 99 9 35 -+21 2 7 0 0 0 0 0 0 0 0 0 6 1 2 77 7 27 -+162 15 57 190 17 67 191 17 67 189 17 66 189 17 66 189 17 66 -+190 17 67 191 17 67 169 15 59 75 7 26 3 0 1 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 79 7 28 -+178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 191 17 67 170 15 60 79 7 28 5 0 2 -+0 0 0 10 1 3 78 7 27 159 14 56 188 17 66 75 7 26 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 1 0 0 35 3 12 29 3 10 2 0 1 -+0 0 0 0 0 0 0 0 0 9 1 3 101 9 35 183 17 64 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 178 16 63 67 6 23 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 174 16 61 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 182 16 64 89 8 31 -+4 0 1 0 0 0 0 0 0 25 2 9 73 7 26 31 3 11 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 4 0 1 98 9 34 187 17 66 189 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 25 2 9 -+0 0 0 0 0 0 0 0 0 8 1 3 134 12 47 191 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 -+68 6 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 6 1 2 19 2 7 3 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 65 6 23 180 16 63 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 83 8 29 -+0 0 0 0 0 0 0 0 0 41 4 14 177 16 62 189 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+159 14 56 28 3 10 0 0 0 0 0 0 0 0 0 23 2 8 -+41 4 14 5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+23 2 8 113 10 40 159 14 56 65 6 23 0 0 0 0 0 0 -+0 0 0 16 1 6 146 13 51 191 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 132 12 46 -+5 0 2 0 0 0 0 0 0 77 7 27 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 98 9 34 0 0 0 0 0 0 12 1 4 134 12 47 -+178 16 63 108 10 38 16 1 6 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 3 10 -+141 13 49 190 17 67 191 17 67 134 12 47 6 1 2 0 0 0 -+0 0 0 68 6 24 186 17 65 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 156 14 55 -+14 1 5 0 0 0 0 0 0 98 9 34 191 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 156 14 55 19 2 7 0 0 0 47 4 16 181 16 63 -+190 17 67 189 17 66 126 14 44 17 2 6 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 16 1 6 134 12 47 -+191 17 67 188 17 66 190 17 67 162 15 57 19 2 7 0 0 0 -+3 0 1 123 11 43 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 163 15 57 -+20 2 7 0 0 0 0 0 0 101 9 35 191 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 182 16 64 52 5 18 0 0 0 73 7 26 188 17 66 -+188 17 66 188 17 66 189 17 66 109 10 38 5 0 2 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 95 9 33 189 17 66 -+188 17 66 188 17 66 189 17 66 171 15 60 29 3 10 0 0 0 -+16 1 6 156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 -+17 2 6 0 0 0 0 0 0 85 8 30 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 81 7 29 0 0 0 85 8 30 190 17 67 -+188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 25 2 9 162 15 57 190 17 67 -+188 17 66 188 17 66 189 17 66 173 16 61 31 3 11 0 0 0 -+30 3 10 171 15 60 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 141 13 49 -+7 1 2 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 191 17 67 98 9 34 0 0 0 88 8 31 190 17 67 -+188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 5 0 2 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 68 6 24 187 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 170 15 60 28 3 10 0 0 0 -+34 3 12 174 16 61 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 101 9 35 -+0 0 0 0 0 0 0 0 0 21 2 7 159 14 56 190 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 191 17 67 98 9 34 0 0 0 81 7 29 189 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 168 15 59 28 3 10 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 109 10 38 191 17 67 188 17 66 -+188 17 66 188 17 66 190 17 67 163 15 57 21 2 7 0 0 0 -+26 2 9 168 15 59 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 47 4 16 -+0 0 0 0 0 0 0 0 0 0 0 0 108 10 38 190 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 78 7 27 0 0 0 68 6 24 187 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 183 17 64 56 5 19 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 3 0 1 131 12 46 191 17 67 188 17 66 -+188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 0 0 0 -+11 1 4 146 13 51 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 191 17 67 126 14 44 7 1 2 -+0 0 0 0 0 0 0 0 0 0 0 0 32 3 11 164 15 58 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+189 17 66 178 16 62 44 4 15 0 0 0 50 5 17 182 16 64 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 188 17 66 -+188 17 66 188 17 66 191 17 67 131 12 46 3 0 1 0 0 0 -+0 0 0 101 9 35 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 170 15 60 44 4 15 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 77 7 27 -+183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+191 17 67 134 12 47 9 1 3 0 0 0 31 3 11 171 15 60 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 2 0 1 124 11 43 191 17 67 188 17 66 -+188 17 66 188 17 66 191 17 67 101 9 35 0 0 0 0 0 0 -+0 0 0 35 3 12 168 15 59 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 182 16 64 77 7 27 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 1 2 -+99 9 35 185 17 65 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 -+177 16 62 56 5 19 0 0 0 0 0 0 13 1 5 151 14 53 -+190 17 67 188 17 66 188 17 66 188 17 66 185 17 65 56 5 19 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 99 9 35 191 17 67 188 17 66 -+188 17 66 188 17 66 186 17 65 65 6 23 0 0 0 0 0 0 -+0 0 0 0 0 0 79 7 28 182 16 64 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+191 17 67 177 16 62 83 8 29 4 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+8 1 3 89 8 31 175 16 62 191 17 67 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 181 16 63 -+85 8 30 3 0 1 0 0 0 0 0 0 1 0 0 118 13 41 -+191 17 67 188 17 66 188 17 66 189 17 66 173 16 61 34 3 12 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 -+188 17 66 189 17 66 169 15 59 30 3 10 0 0 0 0 0 0 -+0 0 0 0 0 0 5 0 2 83 8 29 173 16 61 191 17 67 -+190 17 67 189 17 66 189 17 66 190 17 67 191 17 67 187 17 66 -+151 14 53 56 5 19 3 0 1 0 0 0 16 1 6 50 5 17 -+79 7 28 95 9 33 95 9 33 75 7 26 41 4 14 10 1 4 -+0 0 0 2 0 1 50 5 17 132 12 46 178 16 62 190 17 67 -+191 17 67 191 17 67 191 17 67 186 17 65 154 14 54 68 6 24 -+4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 -+187 17 66 188 17 66 188 17 66 191 17 67 141 13 49 9 1 3 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 14 1 5 151 14 53 190 17 67 -+188 17 66 191 17 67 131 12 46 5 0 2 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 2 0 1 44 4 15 113 10 40 -+156 14 55 173 16 61 174 16 61 164 15 58 134 12 47 77 7 27 -+18 2 6 0 0 0 16 1 6 85 8 30 151 14 53 182 16 64 -+189 17 66 191 17 67 190 17 67 188 17 66 177 16 62 141 13 49 -+68 6 24 8 1 3 0 0 0 8 1 3 44 4 15 88 8 31 -+113 10 40 122 11 43 108 10 38 67 6 24 20 2 7 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 3 10 -+166 15 58 190 17 67 188 17 66 187 17 66 79 7 28 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 73 7 26 185 17 65 -+189 17 66 184 17 65 65 6 23 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 -+17 2 6 32 3 11 34 3 12 22 2 8 6 1 2 0 0 0 -+0 0 0 38 3 13 141 13 49 188 17 66 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 191 17 67 -+184 17 65 122 11 43 21 2 7 0 0 0 0 0 0 0 0 0 -+0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -+108 10 38 191 17 67 191 17 67 141 13 49 16 1 6 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 8 1 3 112 10 39 -+186 17 65 124 11 43 10 1 4 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+36 3 13 156 14 55 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+189 17 66 190 17 67 134 12 47 18 2 6 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 7 1 2 41 4 14 75 7 26 66 5 23 19 2 7 -+26 2 9 144 13 50 154 14 54 40 4 14 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 -+56 5 19 19 2 7 0 0 0 7 1 2 29 3 10 35 3 12 -+19 2 7 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 -+134 12 47 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 67 108 10 38 3 0 1 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -+40 4 14 124 11 43 177 16 62 188 17 66 187 17 66 144 13 50 -+24 2 8 17 2 6 22 2 8 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 19 2 7 122 11 43 171 15 60 175 16 62 -+159 14 56 112 10 39 40 4 14 2 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 -+186 17 65 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 174 16 61 41 4 14 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 72 7 25 -+168 15 59 191 17 67 189 17 66 188 17 66 188 17 66 190 17 67 -+95 9 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 95 9 33 191 17 67 189 17 66 189 17 66 -+190 17 67 191 17 67 171 15 60 90 8 32 12 1 4 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 132 12 46 -+191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 98 9 34 0 0 0 -+0 0 0 0 0 0 0 0 0 5 0 2 88 8 31 180 16 63 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 -+146 13 51 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 9 1 3 144 13 50 191 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 187 17 66 123 11 43 20 2 7 -+0 0 0 0 0 0 0 0 0 0 0 0 21 2 7 163 15 57 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 191 17 67 134 12 47 5 0 2 -+0 0 0 0 0 0 3 0 1 88 8 31 182 16 64 189 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 -+171 15 60 31 3 11 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 20 2 7 162 15 57 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 132 12 46 -+20 2 7 0 0 0 0 0 0 0 0 0 32 3 11 173 16 61 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 -+0 0 0 0 0 0 72 7 25 180 16 63 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+181 16 63 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 21 2 7 163 15 57 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+122 11 43 9 1 3 0 0 0 0 0 0 30 3 10 171 15 60 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 10 1 4 -+0 0 0 38 3 13 166 15 58 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+183 17 64 52 5 18 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 13 1 5 154 14 54 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+186 17 65 79 7 28 0 0 0 0 0 0 14 1 5 156 14 54 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 2 0 1 -+5 0 2 122 11 43 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+182 16 64 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 3 0 1 126 14 44 191 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 158 14 55 23 2 8 0 0 0 1 0 0 113 10 40 -+191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 78 7 27 0 0 0 -+47 4 16 177 16 62 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 -+173 16 61 34 3 12 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 85 8 30 189 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 79 7 28 0 0 0 0 0 0 47 4 16 -+175 16 62 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 156 14 55 22 2 8 0 0 0 -+109 10 38 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+151 14 53 13 1 5 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 35 3 12 173 16 61 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 191 17 67 134 12 47 7 1 2 0 0 0 3 0 1 -+99 9 35 188 17 66 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 181 16 63 68 6 24 0 0 0 18 2 6 -+156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+101 9 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 3 0 1 118 13 41 191 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 168 15 59 28 3 10 0 0 0 0 0 0 -+12 1 4 113 10 40 187 17 66 189 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 180 16 63 88 8 31 4 0 1 0 0 0 47 4 16 -+180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 168 15 59 -+36 3 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 38 3 13 164 15 58 190 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 -+0 0 0 11 1 4 90 8 32 169 15 59 190 17 67 190 17 67 -+189 17 66 189 17 66 189 17 66 189 17 66 191 17 67 189 17 66 -+158 14 55 68 6 24 4 0 1 0 0 0 0 0 0 73 7 26 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 185 17 65 83 8 29 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 65 6 23 174 16 61 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 185 17 65 56 5 19 0 0 0 0 0 0 -+0 0 0 0 0 0 2 0 1 35 3 12 99 9 35 146 13 51 -+170 15 60 177 16 62 177 16 62 166 15 58 141 13 49 85 8 30 -+24 2 8 0 0 0 0 0 0 0 0 0 0 0 0 85 8 30 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 112 10 39 8 1 3 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 68 6 24 -+170 15 60 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 11 1 4 -+28 3 10 40 4 14 38 3 13 25 2 9 8 1 3 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78 7 27 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 187 17 66 113 10 40 14 1 5 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -+47 4 16 141 13 49 186 17 65 191 17 67 190 17 67 189 17 66 -+189 17 66 191 17 67 156 14 55 20 2 7 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 4 15 -+178 16 62 190 17 67 188 17 66 188 17 66 188 17 66 190 17 67 -+191 17 67 173 16 61 90 8 32 10 1 4 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 14 1 5 68 6 24 131 12 46 162 15 57 174 16 61 -+171 15 60 146 13 51 56 5 19 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 3 0 1 14 1 5 29 3 10 -+41 4 14 47 4 16 50 5 17 45 4 16 34 3 12 18 2 6 -+5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 -+90 8 32 169 15 59 185 17 65 187 17 66 182 16 64 163 15 57 -+113 10 40 41 4 14 2 0 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 5 0 2 21 2 7 34 3 12 -+29 3 10 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 -+3 0 1 32 3 11 79 7 28 124 11 43 154 14 54 171 15 60 -+180 16 63 182 16 64 182 16 64 180 16 63 174 16 61 159 14 56 -+132 12 46 88 8 31 34 3 12 3 0 1 0 0 0 0 0 0 -+3 0 1 29 3 10 56 5 19 65 6 23 50 5 17 23 2 8 -+3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 2 9 -+109 10 38 169 15 59 189 17 66 191 17 67 190 17 67 189 17 66 -+189 17 66 188 17 66 188 17 66 188 17 66 189 17 66 190 17 67 -+191 17 67 190 17 67 171 15 60 98 9 34 10 1 3 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 14 1 5 141 13 49 -+191 17 67 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 67 186 17 65 65 6 23 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 23 2 8 166 15 58 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 176 16 62 45 4 16 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 83 8 29 -+183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 185 17 65 95 9 33 3 0 1 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 -+85 8 30 176 16 62 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+191 17 67 180 16 63 95 9 33 7 1 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+2 0 1 52 5 18 141 13 49 185 17 65 191 17 67 189 17 67 -+189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 187 17 66 -+146 13 51 56 5 19 4 0 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 14 1 5 68 6 24 131 12 46 166 15 58 -+180 16 63 183 17 64 180 16 63 168 15 59 134 12 47 75 7 26 -+17 2 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 24 2 8 -+44 4 15 52 5 18 45 4 16 26 2 9 6 1 2 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 - -From baa447618d238275c592e7caa6455b8e4b1d3d77 Mon Sep 17 00:00:00 2001 -From: Florian Meier -Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 033/122] dmaengine: Add support for BCM2708 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add support for DMA controller of BCM2708 as used in the Raspberry Pi. -Currently it only supports cyclic DMA. - -Signed-off-by: Florian Meier - -dmaengine: expand functionality by supporting scatter/gather transfers sdhci-bcm2708 and dma.c: fix for LITE channels - -DMA: fix cyclic LITE length overflow bug - -dmaengine: bcm2708: Remove chancnt affectations - -Mirror bcm2835-dma.c commit 9eba5536a7434c69d8c185d4bd1c70734d92287d: -chancnt is already filled by dma_async_device_register, which uses the channel -list to know how much channels there is. - -Since it's already filled, we can safely remove it from the drivers' probe -function. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: overwrite dreq only if it is not set - -dreq is set when the DMA channel is fetched from Device Tree. -slave_id is set using dmaengine_slave_config(). -Only overwrite dreq with slave_id if it is not set. - -dreq/slave_id in the cyclic DMA case is not touched, because I don't -have hardware to test with. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: do device registration in the board file - -Don't register the device in the driver. Do it in the board file. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: don't restrict DT support to ARCH_BCM2835 - -Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. -Add Device Tree support to the non ARCH_BCM2835 case. -Use the same driver name regardless of architecture. - -Signed-off-by: Noralf Trønnes - -BCM270x_DT: add bcm2835-dma entry - -Add Device Tree entry for bcm2835-dma. -The entry doesn't contain any resources since they are handled -by the arch/arm/mach-bcm270x/dma.c driver. -In non-DT mode, don't add the device in the board file. - -Signed-off-by: Noralf Trønnes - -bcm2708-dmaengine: Add debug options - -BCM270x: Add memory and irq resources to dmaengine device and DT - -Prepare for merging of the legacy DMA API arch driver dma.c -with bcm2708-dmaengine by adding memory and irq resources both -to platform file device and Device Tree node. -Don't use BCM_DMAMAN_DRIVER_NAME so we don't have to include mach/dma.h - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c - -Merge the legacy DMA API driver with bcm2708-dmaengine. -This is done so we can use bcm2708_fb on ARCH_BCM2835 (mailbox -driver is also needed). - -Changes to the dma.c code: -- Use BIT() macro. -- Cutdown some comments to one line. -- Add mutex to vc_dmaman and use this, since the dev lock is locked - during probing of the engine part. -- Add global g_dmaman variable since drvdata is used by the engine part. -- Restructure for readability: - vc_dmaman_chan_alloc() - vc_dmaman_chan_free() - bcm_dma_chan_free() -- Restructure bcm_dma_chan_alloc() to simplify error handling. -- Use device irq resources instead of hardcoded bcm_dma_irqs table. -- Remove dev_dmaman_register() and code it directly. -- Remove dev_dmaman_deregister() and code it directly. -- Simplify bcm_dmaman_probe() using devm_* functions. -- Get dmachans from DT if available. -- Keep 'dma.dmachans' module argument name for backwards compatibility. - -Make it available on ARCH_BCM2835 as well. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: set residue_granularity field - -bcm2708-dmaengine supports residue reporting at burst level -but didn't report this via the residue_granularity field. - -Without this field set properly we get playback issues with I2S cards. - -dmaengine: bcm2708-dmaengine: Fix memory leak when stopping a running transfer - -bcm2708-dmaengine: Use more DMA channels (but not 12) - -1) Only the bcm2708_fb drivers uses the legacy DMA API, and -it requires a BULK-capable channel, so all other types -(FAST, NORMAL and LITE) can be made available to the regular -DMA API. - -2) DMA channels 11-14 share an interrupt. The driver can't -handle this, so don't use channels 12-14 (12 was used, probably -because it appears to have an interrupt, but in reality that -interrupt is for activity on ANY channel). This may explain -a lockup encountered when running out of DMA channels. - -The combined effect of this patch is to leave 7 DMA channels -available + channel 0 for bcm2708_fb via the legacy API. - -See: https://github.com/raspberrypi/linux/issues/1110 - https://github.com/raspberrypi/linux/issues/1108 - -dmaengine: bcm2708: Make legacy API available for bcm2835-dma - -bcm2708_fb uses the legacy DMA API, so in order to start using -bcm2835-dma, bcm2835-dma has to support the legacy API. Make this -possible by exporting bcm_dmaman_probe() and bcm_dmaman_remove(). - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: Change DT compatible string - -Both bcm2835-dma and bcm2708-dmaengine have the same compatible string. -So change compatible to "brcm,bcm2708-dma". - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: Remove driver but keep legacy API - -Dropping non-DT support means we don't need this driver, -but we still need the legacy DMA API. - -Signed-off-by: Noralf Trønnes - -bcm2708-dmaengine - Fix arm64 portability/build issues ---- - drivers/dma/Kconfig | 6 +- - drivers/dma/Makefile | 1 + - drivers/dma/bcm2708-dmaengine.c | 281 ++++++++++++++++++++++++++++++ - include/linux/platform_data/dma-bcm2708.h | 143 +++++++++++++++ - 4 files changed, 430 insertions(+), 1 deletion(-) - create mode 100644 drivers/dma/bcm2708-dmaengine.c - create mode 100644 include/linux/platform_data/dma-bcm2708.h - -diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 9c931d36c6a499a02f4f215f8cd77d3f2254a3b9..9ccee1058e4c5c208a196d6d89e700d09754f977 100644 ---- a/drivers/dma/Kconfig -+++ b/drivers/dma/Kconfig -@@ -108,7 +108,7 @@ config COH901318 - - config DMA_BCM2835 - tristate "BCM2835 DMA engine support" -- depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 -+ depends on ARCH_BCM2835 - select DMA_ENGINE - select DMA_VIRTUAL_CHANNELS - -@@ -499,6 +499,10 @@ config TIMB_DMA - help - Enable support for the Timberdale FPGA DMA engine. - -+config DMA_BCM2708 -+ tristate "BCM2708 DMA legacy API support" -+ depends on DMA_BCM2835 -+ - config TI_CPPI41 - tristate "AM33xx CPPI41 DMA support" - depends on ARCH_OMAP -diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile -index e4dc9cac7ee8427184f821896364c232634a444f..58cc24730ed6ab4fd35a9cb182c4862f8f2d546f 100644 ---- a/drivers/dma/Makefile -+++ b/drivers/dma/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o - obj-$(CONFIG_AT_XDMAC) += at_xdmac.o - obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o - obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o -+obj-$(CONFIG_DMA_BCM2708) += bcm2708-dmaengine.o - obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o - obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o - obj-$(CONFIG_DMA_JZ4780) += dma-jz4780.o -diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c -new file mode 100644 -index 0000000000000000000000000000000000000000..0f4a26983e401c60647655dcb35afd58f37515a8 ---- /dev/null -+++ b/drivers/dma/bcm2708-dmaengine.c -@@ -0,0 +1,281 @@ -+/* -+ * BCM2708 legacy DMA API -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "virt-dma.h" -+ -+#define CACHE_LINE_MASK 31 -+#define DEFAULT_DMACHAN_BITMAP 0x10 /* channel 4 only */ -+ -+/* valid only for channels 0 - 14, 15 has its own base address */ -+#define BCM2708_DMA_CHAN(n) ((n) << 8) /* base address */ -+#define BCM2708_DMA_CHANIO(dma_base, n) \ -+ ((void __iomem *)((char *)(dma_base) + BCM2708_DMA_CHAN(n))) -+ -+struct vc_dmaman { -+ void __iomem *dma_base; -+ u32 chan_available; /* bitmap of available channels */ -+ u32 has_feature[BCM_DMA_FEATURE_COUNT]; /* bitmap of feature presence */ -+ struct mutex lock; -+}; -+ -+static struct device *dmaman_dev; /* we assume there's only one! */ -+static struct vc_dmaman *g_dmaman; /* DMA manager */ -+ -+/* DMA Auxiliary Functions */ -+ -+/* A DMA buffer on an arbitrary boundary may separate a cache line into a -+ section inside the DMA buffer and another section outside it. -+ Even if we flush DMA buffers from the cache there is always the chance that -+ during a DMA someone will access the part of a cache line that is outside -+ the DMA buffer - which will then bring in unwelcome data. -+ Without being able to dictate our own buffer pools we must insist that -+ DMA buffers consist of a whole number of cache lines. -+*/ -+extern int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len) -+{ -+ int i; -+ -+ for (i = 0; i < sg_len; i++) { -+ if (sg_ptr[i].offset & CACHE_LINE_MASK || -+ sg_ptr[i].length & CACHE_LINE_MASK) -+ return 0; -+ } -+ -+ return 1; -+} -+EXPORT_SYMBOL_GPL(bcm_sg_suitable_for_dma); -+ -+extern void bcm_dma_start(void __iomem *dma_chan_base, -+ dma_addr_t control_block) -+{ -+ dsb(sy); /* ARM data synchronization (push) operation */ -+ -+ writel(control_block, dma_chan_base + BCM2708_DMA_ADDR); -+ writel(BCM2708_DMA_ACTIVE, dma_chan_base + BCM2708_DMA_CS); -+} -+EXPORT_SYMBOL_GPL(bcm_dma_start); -+ -+extern void bcm_dma_wait_idle(void __iomem *dma_chan_base) -+{ -+ dsb(sy); -+ -+ /* ugly busy wait only option for now */ -+ while (readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE) -+ cpu_relax(); -+} -+EXPORT_SYMBOL_GPL(bcm_dma_wait_idle); -+ -+extern bool bcm_dma_is_busy(void __iomem *dma_chan_base) -+{ -+ dsb(sy); -+ -+ return readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_is_busy); -+ -+/* Complete an ongoing DMA (assuming its results are to be ignored) -+ Does nothing if there is no DMA in progress. -+ This routine waits for the current AXI transfer to complete before -+ terminating the current DMA. If the current transfer is hung on a DREQ used -+ by an uncooperative peripheral the AXI transfer may never complete. In this -+ case the routine times out and return a non-zero error code. -+ Use of this routine doesn't guarantee that the ongoing or aborted DMA -+ does not produce an interrupt. -+*/ -+extern int bcm_dma_abort(void __iomem *dma_chan_base) -+{ -+ unsigned long int cs; -+ int rc = 0; -+ -+ cs = readl(dma_chan_base + BCM2708_DMA_CS); -+ -+ if (BCM2708_DMA_ACTIVE & cs) { -+ long int timeout = 10000; -+ -+ /* write 0 to the active bit - pause the DMA */ -+ writel(0, dma_chan_base + BCM2708_DMA_CS); -+ -+ /* wait for any current AXI transfer to complete */ -+ while (0 != (cs & BCM2708_DMA_ISPAUSED) && --timeout >= 0) -+ cs = readl(dma_chan_base + BCM2708_DMA_CS); -+ -+ if (0 != (cs & BCM2708_DMA_ISPAUSED)) { -+ /* we'll un-pause when we set of our next DMA */ -+ rc = -ETIMEDOUT; -+ -+ } else if (BCM2708_DMA_ACTIVE & cs) { -+ /* terminate the control block chain */ -+ writel(0, dma_chan_base + BCM2708_DMA_NEXTCB); -+ -+ /* abort the whole DMA */ -+ writel(BCM2708_DMA_ABORT | BCM2708_DMA_ACTIVE, -+ dma_chan_base + BCM2708_DMA_CS); -+ } -+ } -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_abort); -+ -+ /* DMA Manager Device Methods */ -+ -+static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base, -+ u32 chans_available) -+{ -+ dmaman->dma_base = dma_base; -+ dmaman->chan_available = chans_available; -+ dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* 2 & 3 */ -+ dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* 0 */ -+ dmaman->has_feature[BCM_DMA_FEATURE_NORMAL_ORD] = 0xfe; /* 1 to 7 */ -+ dmaman->has_feature[BCM_DMA_FEATURE_LITE_ORD] = 0x7f00; /* 8 to 14 */ -+} -+ -+static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman, -+ unsigned required_feature_set) -+{ -+ u32 chans; -+ int chan = 0; -+ int feature; -+ -+ chans = dmaman->chan_available; -+ for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++) -+ /* select the subset of available channels with the desired -+ features */ -+ if (required_feature_set & (1 << feature)) -+ chans &= dmaman->has_feature[feature]; -+ -+ if (!chans) -+ return -ENOENT; -+ -+ /* return the ordinal of the first channel in the bitmap */ -+ while (chans != 0 && (chans & 1) == 0) { -+ chans >>= 1; -+ chan++; -+ } -+ /* claim the channel */ -+ dmaman->chan_available &= ~(1 << chan); -+ -+ return chan; -+} -+ -+static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan) -+{ -+ if (chan < 0) -+ return -EINVAL; -+ -+ if ((1 << chan) & dmaman->chan_available) -+ return -EIDRM; -+ -+ dmaman->chan_available |= (1 << chan); -+ -+ return 0; -+} -+ -+/* DMA Manager Monitor */ -+ -+extern int bcm_dma_chan_alloc(unsigned required_feature_set, -+ void __iomem **out_dma_base, int *out_dma_irq) -+{ -+ struct vc_dmaman *dmaman = g_dmaman; -+ struct platform_device *pdev = to_platform_device(dmaman_dev); -+ struct resource *r; -+ int chan; -+ -+ if (!dmaman_dev) -+ return -ENODEV; -+ -+ mutex_lock(&dmaman->lock); -+ chan = vc_dmaman_chan_alloc(dmaman, required_feature_set); -+ if (chan < 0) -+ goto out; -+ -+ r = platform_get_resource(pdev, IORESOURCE_IRQ, (unsigned int)chan); -+ if (!r) { -+ dev_err(dmaman_dev, "failed to get irq for DMA channel %d\n", -+ chan); -+ vc_dmaman_chan_free(dmaman, chan); -+ chan = -ENOENT; -+ goto out; -+ } -+ -+ *out_dma_base = BCM2708_DMA_CHANIO(dmaman->dma_base, chan); -+ *out_dma_irq = r->start; -+ dev_dbg(dmaman_dev, -+ "Legacy API allocated channel=%d, base=%p, irq=%i\n", -+ chan, *out_dma_base, *out_dma_irq); -+ -+out: -+ mutex_unlock(&dmaman->lock); -+ -+ return chan; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_chan_alloc); -+ -+extern int bcm_dma_chan_free(int channel) -+{ -+ struct vc_dmaman *dmaman = g_dmaman; -+ int rc; -+ -+ if (!dmaman_dev) -+ return -ENODEV; -+ -+ mutex_lock(&dmaman->lock); -+ rc = vc_dmaman_chan_free(dmaman, channel); -+ mutex_unlock(&dmaman->lock); -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_chan_free); -+ -+int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, -+ u32 chans_available) -+{ -+ struct device *dev = &pdev->dev; -+ struct vc_dmaman *dmaman; -+ -+ dmaman = devm_kzalloc(dev, sizeof(*dmaman), GFP_KERNEL); -+ if (!dmaman) -+ return -ENOMEM; -+ -+ mutex_init(&dmaman->lock); -+ vc_dmaman_init(dmaman, base, chans_available); -+ g_dmaman = dmaman; -+ dmaman_dev = dev; -+ -+ dev_info(dev, "DMA legacy API manager at %p, dmachans=0x%x\n", -+ base, chans_available); -+ -+ return 0; -+} -+EXPORT_SYMBOL(bcm_dmaman_probe); -+ -+int bcm_dmaman_remove(struct platform_device *pdev) -+{ -+ dmaman_dev = NULL; -+ -+ return 0; -+} -+EXPORT_SYMBOL(bcm_dmaman_remove); -+ -+MODULE_LICENSE("GPL"); -diff --git a/include/linux/platform_data/dma-bcm2708.h b/include/linux/platform_data/dma-bcm2708.h -new file mode 100644 -index 0000000000000000000000000000000000000000..c5bfff2765be4606077e6c8af73040ec13ee8974 ---- /dev/null -+++ b/include/linux/platform_data/dma-bcm2708.h -@@ -0,0 +1,143 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#ifndef _PLAT_BCM2708_DMA_H -+#define _PLAT_BCM2708_DMA_H -+ -+/* DMA CS Control and Status bits */ -+#define BCM2708_DMA_ACTIVE BIT(0) -+#define BCM2708_DMA_INT BIT(2) -+#define BCM2708_DMA_ISPAUSED BIT(4) /* Pause requested or not active */ -+#define BCM2708_DMA_ISHELD BIT(5) /* Is held by DREQ flow control */ -+#define BCM2708_DMA_ERR BIT(8) -+#define BCM2708_DMA_ABORT BIT(30) /* stop current CB, go to next, WO */ -+#define BCM2708_DMA_RESET BIT(31) /* WO, self clearing */ -+ -+/* DMA control block "info" field bits */ -+#define BCM2708_DMA_INT_EN BIT(0) -+#define BCM2708_DMA_TDMODE BIT(1) -+#define BCM2708_DMA_WAIT_RESP BIT(3) -+#define BCM2708_DMA_D_INC BIT(4) -+#define BCM2708_DMA_D_WIDTH BIT(5) -+#define BCM2708_DMA_D_DREQ BIT(6) -+#define BCM2708_DMA_S_INC BIT(8) -+#define BCM2708_DMA_S_WIDTH BIT(9) -+#define BCM2708_DMA_S_DREQ BIT(10) -+ -+#define BCM2708_DMA_BURST(x) (((x) & 0xf) << 12) -+#define BCM2708_DMA_PER_MAP(x) ((x) << 16) -+#define BCM2708_DMA_WAITS(x) (((x) & 0x1f) << 21) -+ -+#define BCM2708_DMA_DREQ_EMMC 11 -+#define BCM2708_DMA_DREQ_SDHOST 13 -+ -+#define BCM2708_DMA_CS 0x00 /* Control and Status */ -+#define BCM2708_DMA_ADDR 0x04 -+/* the current control block appears in the following registers - read only */ -+#define BCM2708_DMA_INFO 0x08 -+#define BCM2708_DMA_SOURCE_AD 0x0c -+#define BCM2708_DMA_DEST_AD 0x10 -+#define BCM2708_DMA_NEXTCB 0x1C -+#define BCM2708_DMA_DEBUG 0x20 -+ -+#define BCM2708_DMA4_CS (BCM2708_DMA_CHAN(4) + BCM2708_DMA_CS) -+#define BCM2708_DMA4_ADDR (BCM2708_DMA_CHAN(4) + BCM2708_DMA_ADDR) -+ -+#define BCM2708_DMA_TDMODE_LEN(w, h) ((h) << 16 | (w)) -+ -+/* When listing features we can ask for when allocating DMA channels give -+ those with higher priority smaller ordinal numbers */ -+#define BCM_DMA_FEATURE_FAST_ORD 0 -+#define BCM_DMA_FEATURE_BULK_ORD 1 -+#define BCM_DMA_FEATURE_NORMAL_ORD 2 -+#define BCM_DMA_FEATURE_LITE_ORD 3 -+#define BCM_DMA_FEATURE_FAST BIT(BCM_DMA_FEATURE_FAST_ORD) -+#define BCM_DMA_FEATURE_BULK BIT(BCM_DMA_FEATURE_BULK_ORD) -+#define BCM_DMA_FEATURE_NORMAL BIT(BCM_DMA_FEATURE_NORMAL_ORD) -+#define BCM_DMA_FEATURE_LITE BIT(BCM_DMA_FEATURE_LITE_ORD) -+#define BCM_DMA_FEATURE_COUNT 4 -+ -+struct bcm2708_dma_cb { -+ u32 info; -+ u32 src; -+ u32 dst; -+ u32 length; -+ u32 stride; -+ u32 next; -+ u32 pad[2]; -+}; -+ -+struct scatterlist; -+struct platform_device; -+ -+#ifdef CONFIG_DMA_BCM2708 -+ -+int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len); -+void bcm_dma_start(void __iomem *dma_chan_base, dma_addr_t control_block); -+void bcm_dma_wait_idle(void __iomem *dma_chan_base); -+bool bcm_dma_is_busy(void __iomem *dma_chan_base); -+int bcm_dma_abort(void __iomem *dma_chan_base); -+ -+/* return channel no or -ve error */ -+int bcm_dma_chan_alloc(unsigned preferred_feature_set, -+ void __iomem **out_dma_base, int *out_dma_irq); -+int bcm_dma_chan_free(int channel); -+ -+int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, -+ u32 chans_available); -+int bcm_dmaman_remove(struct platform_device *pdev); -+ -+#else /* CONFIG_DMA_BCM2708 */ -+ -+static inline int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, -+ int sg_len) -+{ -+ return 0; -+} -+ -+static inline void bcm_dma_start(void __iomem *dma_chan_base, -+ dma_addr_t control_block) { } -+ -+static inline void bcm_dma_wait_idle(void __iomem *dma_chan_base) { } -+ -+static inline bool bcm_dma_is_busy(void __iomem *dma_chan_base) -+{ -+ return false; -+} -+ -+static inline int bcm_dma_abort(void __iomem *dma_chan_base) -+{ -+ return -EINVAL; -+} -+ -+static inline int bcm_dma_chan_alloc(unsigned preferred_feature_set, -+ void __iomem **out_dma_base, -+ int *out_dma_irq) -+{ -+ return -EINVAL; -+} -+ -+static inline int bcm_dma_chan_free(int channel) -+{ -+ return -EINVAL; -+} -+ -+static inline int bcm_dmaman_probe(struct platform_device *pdev, -+ void __iomem *base, u32 chans_available) -+{ -+ return 0; -+} -+ -+static inline int bcm_dmaman_remove(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+#endif /* CONFIG_DMA_BCM2708 */ -+ -+#endif /* _PLAT_BCM2708_DMA_H */ - -From b7d8765eb1e1bb854be09a08acabaf92cd1c45ab Mon Sep 17 00:00:00 2001 -From: gellert -Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 034/122] MMC: added alternative MMC driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -mmc: Disable CMD23 transfers on all cards - -Pending wire-level investigation of these types of transfers -and associated errors on bcm2835-mmc, disable for now. Fallback of -CMD18/CMD25 transfers will be used automatically by the MMC layer. - -Reported/Tested-by: Gellert Weisz - -mmc: bcm2835-mmc: enable DT support for all architectures - -Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. -Enable Device Tree support for all architectures. - -Signed-off-by: Noralf Trønnes - -mmc: bcm2835-mmc: fix probe error handling - -Probe error handling is broken in several places. -Simplify error handling by using device managed functions. -Replace pr_{err,info} with dev_{err,info}. - -Signed-off-by: Noralf Trønnes - -bcm2835-mmc: Add locks when accessing sdhost registers - -bcm2835-mmc: Add range of debug options for slowing things down - -bcm2835-mmc: Add option to disable some delays - -bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 - -bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 - -bcm2835-mmc: Adding overclocking option - -Allow a different clock speed to be substitued for a requested 50MHz. -This option is exposed using the "overclock_50" DT parameter. -Note that the mmc interface is restricted to EVEN integer divisions of -250MHz, and the highest sensible option is 63 (250/4 = 62.5), the -next being 125 (250/2) which is much too high. - -Use at your own risk. - -bcm2835-mmc: Round up the overclock, so 62 works for 62.5Mhz - -Also only warn once for each overclock setting. - -mmc: bcm2835-mmc: Make available on ARCH_BCM2835 - -Make the bcm2835-mmc driver available for use on ARCH_BCM2835. - -Signed-off-by: Noralf Trønnes - -BCM270x_DT: add bcm2835-mmc entry - -Add Device Tree entry for bcm2835-mmc. -In non-DT mode, don't add the device in the board file. - -Signed-off-by: Noralf Trønnes - -bcm2835-mmc: Don't overwrite MMC capabilities from DT - -bcm2835-mmc: Don't override bus width capabilities from devicetree - -Take out the force setting of the MMC_CAP_4_BIT_DATA host capability -so that the result read from devicetree via mmc_of_parse() is -preserved. - -bcm2835-mmc: Only claim one DMA channel - -With both MMC controllers enabled there are few DMA channels left. The -bcm2835-mmc driver only uses DMA in one direction at a time, so it -doesn't need to claim two channels. - -See: https://github.com/raspberrypi/linux/issues/1327 - -Signed-off-by: Phil Elwell ---- - drivers/mmc/core/quirks.c | 10 + - drivers/mmc/host/Kconfig | 29 + - drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-mmc.c | 1574 ++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 1614 insertions(+) - create mode 100644 drivers/mmc/host/bcm2835-mmc.c - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index ca9cade317c7eccee354bb1a075b091f59a62de1..5e9e3518e0eb6be78f6e2847846a90ddd0febb77 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -53,6 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -+#ifdef CONFIG_MMC_BCM2835 -+ extern unsigned mmc_debug; -+#endif - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -79,5 +82,12 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - f->vendor_fixup(card, f->data); - } - } -+ /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. -+ * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). -+ */ -+#ifdef CONFIG_MMC_BCM2835 -+ if (mmc_debug & (1<<13)) -+ card->quirks |= MMC_QUIRK_BLK_NO_CMD23; -+#endif - } - EXPORT_SYMBOL(mmc_fixup_device); -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 5274f503a39ad9c034e23b634ff0ec6634cbbd78..405d62909dd6ac5351684c002414cc02135d98ba 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -4,6 +4,35 @@ - - comment "MMC/SD/SDIO Host Controller Drivers" - -+config MMC_BCM2835 -+ tristate "MMC support on BCM2835" -+ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 -+ help -+ This selects the MMC Interface on BCM2835. -+ -+ If you have a controller with this interface, say Y or M here. -+ -+ If unsure, say N. -+ -+config MMC_BCM2835_DMA -+ bool "DMA support on BCM2835 Arasan controller" -+ depends on MMC_BCM2835 -+ help -+ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 -+ based chips. -+ -+ If unsure, say N. -+ -+config MMC_BCM2835_PIO_DMA_BARRIER -+ int "Block count limit for PIO transfers" -+ depends on MMC_BCM2835 && MMC_BCM2835_DMA -+ range 0 256 -+ default 2 -+ help -+ The inclusive limit in bytes under which PIO will be used instead of DMA -+ -+ If unsure, say 2 here. -+ - config MMC_ARMMMCI - tristate "ARM AMBA Multimedia Card Interface support" - depends on ARM_AMBA -diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index e2bdaaf431841535b936600af56b8e38f52f9845..5133b680970c93fbb9695f83296f0f70b4977240 100644 ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o - obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o - obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o - obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o -+obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o - obj-$(CONFIG_MMC_WBSD) += wbsd.o - obj-$(CONFIG_MMC_AU1X) += au1xmmc.o - obj-$(CONFIG_MMC_MTK) += mtk-sd.o -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a ---- /dev/null -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -0,0 +1,1574 @@ -+/* -+ * BCM2835 MMC host driver. -+ * -+ * Author: Gellert Weisz -+ * Copyright 2014 -+ * -+ * Based on -+ * sdhci-bcm2708.c by Broadcom -+ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko -+ * sdhci.c and sdhci-pci.c by Pierre Ossman -+ * -+ * 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 "sdhci.h" -+ -+ -+#define DRIVER_NAME "mmc-bcm2835" -+ -+#define DBG(f, x...) \ -+pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) -+ -+#ifndef CONFIG_MMC_BCM2835_DMA -+ #define FORCE_PIO -+#endif -+ -+ -+/* the inclusive limit in bytes under which PIO will be used instead of DMA */ -+#ifdef CONFIG_MMC_BCM2835_PIO_DMA_BARRIER -+#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_PIO_DMA_BARRIER -+#else -+#define PIO_DMA_BARRIER 00 -+#endif -+ -+#define MIN_FREQ 400000 -+#define TIMEOUT_VAL 0xE -+#define BCM2835_SDHCI_WRITE_DELAY(f) (((2 * 1000000) / f) + 1) -+ -+ -+unsigned mmc_debug; -+unsigned mmc_debug2; -+ -+struct bcm2835_host { -+ spinlock_t lock; -+ -+ void __iomem *ioaddr; -+ u32 bus_addr; -+ -+ struct mmc_host *mmc; -+ -+ u32 timeout; -+ -+ int clock; /* Current clock speed */ -+ u8 pwr; /* Current voltage */ -+ -+ unsigned int max_clk; /* Max possible freq */ -+ unsigned int timeout_clk; /* Timeout freq (KHz) */ -+ unsigned int clk_mul; /* Clock Muliplier value */ -+ -+ struct tasklet_struct finish_tasklet; /* Tasklet structures */ -+ -+ struct timer_list timer; /* Timer for timeouts */ -+ -+ struct sg_mapping_iter sg_miter; /* SG state for PIO */ -+ unsigned int blocks; /* remaining PIO blocks */ -+ -+ int irq; /* Device IRQ */ -+ -+ -+ u32 ier; /* cached registers */ -+ -+ struct mmc_request *mrq; /* Current request */ -+ struct mmc_command *cmd; /* Current command */ -+ struct mmc_data *data; /* Current data request */ -+ unsigned int data_early:1; /* Data finished before cmd */ -+ -+ wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ -+ -+ u32 thread_isr; -+ -+ u32 shadow; -+ -+ /*DMA part*/ -+ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ -+ struct dma_slave_config dma_cfg_rx; -+ struct dma_slave_config dma_cfg_tx; -+ struct dma_async_tx_descriptor *tx_desc; /* descriptor */ -+ -+ bool have_dma; -+ bool use_dma; -+ /*end of DMA part*/ -+ -+ int max_delay; /* maximum length of time spent waiting */ -+ -+ int flags; /* Host attributes */ -+#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */ -+#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */ -+#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ -+#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ -+#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ -+ -+ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ -+ u32 max_overclock; /* Highest reported */ -+}; -+ -+ -+static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) -+{ -+ unsigned delay; -+ lockdep_assert_held_once(&host->lock); -+ writel(val, host->ioaddr + reg); -+ udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); -+ -+ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -+ if (delay && !((1<lock); -+ writel(val, host->ioaddr + reg); -+ -+ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -+ if (delay) -+ udelay(delay); -+} -+ -+static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) -+{ -+ lockdep_assert_held_once(&host->lock); -+ return readl(host->ioaddr + reg); -+} -+ -+static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) -+{ -+ u32 oldval = (reg == SDHCI_COMMAND) ? host->shadow : -+ bcm2835_mmc_readl(host, reg & ~3); -+ u32 word_num = (reg >> 1) & 1; -+ u32 word_shift = word_num * 16; -+ u32 mask = 0xffff << word_shift; -+ u32 newval = (oldval & ~mask) | (val << word_shift); -+ -+ if (reg == SDHCI_TRANSFER_MODE) -+ host->shadow = newval; -+ else -+ bcm2835_mmc_writel(host, newval, reg & ~3, 0); -+ -+} -+ -+static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) -+{ -+ u32 oldval = bcm2835_mmc_readl(host, reg & ~3); -+ u32 byte_num = reg & 3; -+ u32 byte_shift = byte_num * 8; -+ u32 mask = 0xff << byte_shift; -+ u32 newval = (oldval & ~mask) | (val << byte_shift); -+ -+ bcm2835_mmc_writel(host, newval, reg & ~3, 1); -+} -+ -+ -+static inline u16 bcm2835_mmc_readw(struct bcm2835_host *host, int reg) -+{ -+ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); -+ u32 word_num = (reg >> 1) & 1; -+ u32 word_shift = word_num * 16; -+ u32 word = (val >> word_shift) & 0xffff; -+ -+ return word; -+} -+ -+static inline u8 bcm2835_mmc_readb(struct bcm2835_host *host, int reg) -+{ -+ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); -+ u32 byte_num = reg & 3; -+ u32 byte_shift = byte_num * 8; -+ u32 byte = (val >> byte_shift) & 0xff; -+ -+ return byte; -+} -+ -+static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) -+{ -+ u32 ier; -+ -+ ier = bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE); -+ ier &= ~clear; -+ /* change which requests generate IRQs - makes no difference to -+ the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ -+ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); -+} -+ -+ -+static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) -+{ -+ pr_debug(DRIVER_NAME ": =========== REGISTER DUMP (%s)===========\n", -+ mmc_hostname(host->mmc)); -+ -+ pr_debug(DRIVER_NAME ": Sys addr: 0x%08x | Version: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_DMA_ADDRESS), -+ bcm2835_mmc_readw(host, SDHCI_HOST_VERSION)); -+ pr_debug(DRIVER_NAME ": Blk size: 0x%08x | Blk cnt: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_BLOCK_SIZE), -+ bcm2835_mmc_readw(host, SDHCI_BLOCK_COUNT)); -+ pr_debug(DRIVER_NAME ": Argument: 0x%08x | Trn mode: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_ARGUMENT), -+ bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE)); -+ pr_debug(DRIVER_NAME ": Present: 0x%08x | Host ctl: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE), -+ bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL)); -+ pr_debug(DRIVER_NAME ": Power: 0x%08x | Blk gap: 0x%08x\n", -+ bcm2835_mmc_readb(host, SDHCI_POWER_CONTROL), -+ bcm2835_mmc_readb(host, SDHCI_BLOCK_GAP_CONTROL)); -+ pr_debug(DRIVER_NAME ": Wake-up: 0x%08x | Clock: 0x%08x\n", -+ bcm2835_mmc_readb(host, SDHCI_WAKE_UP_CONTROL), -+ bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)); -+ pr_debug(DRIVER_NAME ": Timeout: 0x%08x | Int stat: 0x%08x\n", -+ bcm2835_mmc_readb(host, SDHCI_TIMEOUT_CONTROL), -+ bcm2835_mmc_readl(host, SDHCI_INT_STATUS)); -+ pr_debug(DRIVER_NAME ": Int enab: 0x%08x | Sig enab: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_INT_ENABLE), -+ bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE)); -+ pr_debug(DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_ACMD12_ERR), -+ bcm2835_mmc_readw(host, SDHCI_SLOT_INT_STATUS)); -+ pr_debug(DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES), -+ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES_1)); -+ pr_debug(DRIVER_NAME ": Cmd: 0x%08x | Max curr: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_COMMAND), -+ bcm2835_mmc_readl(host, SDHCI_MAX_CURRENT)); -+ pr_debug(DRIVER_NAME ": Host ctl2: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2)); -+ -+ pr_debug(DRIVER_NAME ": ===========================================\n"); -+} -+ -+ -+static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) -+{ -+ unsigned long timeout; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); -+ -+ if (mask & SDHCI_RESET_ALL) -+ host->clock = 0; -+ -+ /* Wait max 100 ms */ -+ timeout = 100; -+ -+ /* hw clears the bit when it's done */ -+ while (bcm2835_mmc_readb(host, SDHCI_SOFTWARE_RESET) & mask) { -+ if (timeout == 0) { -+ pr_err("%s: Reset 0x%x never completed.\n", -+ mmc_hostname(host->mmc), (int)mask); -+ bcm2835_mmc_dumpregs(host); -+ return; -+ } -+ timeout--; -+ spin_unlock_irqrestore(&host->lock, flags); -+ mdelay(1); -+ spin_lock_irqsave(&host->lock, flags); -+ } -+ -+ if (100-timeout > 10 && 100-timeout > host->max_delay) { -+ host->max_delay = 100-timeout; -+ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); -+ } -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -+ -+static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) -+{ -+ unsigned long flags; -+ if (soft) -+ bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); -+ else -+ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -+ -+ host->ier = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | -+ SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | -+ SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC | -+ SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | -+ SDHCI_INT_RESPONSE; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (soft) { -+ /* force clock reconfiguration */ -+ host->clock = 0; -+ bcm2835_mmc_set_ios(host->mmc, &host->mmc->ios); -+ } -+} -+ -+ -+ -+static void bcm2835_mmc_finish_data(struct bcm2835_host *host); -+ -+static void bcm2835_mmc_dma_complete(void *param) -+{ -+ struct bcm2835_host *host = param; -+ struct dma_chan *dma_chan; -+ unsigned long flags; -+ u32 dir_data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { -+ /* otherwise handled in SDHCI IRQ */ -+ dma_chan = host->dma_chan_rxtx; -+ dir_data = DMA_FROM_DEVICE; -+ -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); -+ -+ bcm2835_mmc_finish_data(host); -+ } -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_bcm2835_mmc_read_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len, chunk; -+ -+ u32 uninitialized_var(scratch); -+ u8 *buf; -+ -+ blksize = host->data->blksz; -+ chunk = 0; -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); -+ -+ len = min(host->sg_miter.length, blksize); -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = host->sg_miter.addr; -+ -+ while (len) { -+ if (chunk == 0) { -+ scratch = bcm2835_mmc_readl(host, SDHCI_BUFFER); -+ chunk = 4; -+ } -+ -+ *buf = scratch & 0xFF; -+ -+ buf++; -+ scratch >>= 8; -+ chunk--; -+ len--; -+ } -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+static void bcm2835_bcm2835_mmc_write_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len, chunk; -+ u32 scratch; -+ u8 *buf; -+ -+ blksize = host->data->blksz; -+ chunk = 0; -+ chunk = 0; -+ scratch = 0; -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); -+ -+ len = min(host->sg_miter.length, blksize); -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = host->sg_miter.addr; -+ -+ while (len) { -+ scratch |= (u32)*buf << (chunk * 8); -+ -+ buf++; -+ chunk++; -+ len--; -+ -+ if ((chunk == 4) || ((len == 0) && (blksize == 0))) { -+ mmc_raw_writel(host, scratch, SDHCI_BUFFER); -+ chunk = 0; -+ scratch = 0; -+ } -+ } -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+ -+static void bcm2835_mmc_transfer_pio(struct bcm2835_host *host) -+{ -+ u32 mask; -+ -+ BUG_ON(!host->data); -+ -+ if (host->blocks == 0) -+ return; -+ -+ if (host->data->flags & MMC_DATA_READ) -+ mask = SDHCI_DATA_AVAILABLE; -+ else -+ mask = SDHCI_SPACE_AVAILABLE; -+ -+ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { -+ -+ if (host->data->flags & MMC_DATA_READ) -+ bcm2835_bcm2835_mmc_read_block_pio(host); -+ else -+ bcm2835_bcm2835_mmc_write_block_pio(host); -+ -+ host->blocks--; -+ -+ /* QUIRK used in sdhci.c removes the 'if' */ -+ /* but it seems this is unnecessary */ -+ if (host->blocks == 0) -+ break; -+ -+ -+ } -+} -+ -+ -+static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) -+{ -+ u32 len, dir_data, dir_slave; -+ struct dma_async_tx_descriptor *desc = NULL; -+ struct dma_chan *dma_chan; -+ -+ -+ WARN_ON(!host->data); -+ -+ if (!host->data) -+ return; -+ -+ if (host->blocks == 0) -+ return; -+ -+ dma_chan = host->dma_chan_rxtx; -+ if (host->data->flags & MMC_DATA_READ) { -+ dir_data = DMA_FROM_DEVICE; -+ dir_slave = DMA_DEV_TO_MEM; -+ } else { -+ dir_data = DMA_TO_DEVICE; -+ dir_slave = DMA_MEM_TO_DEV; -+ } -+ -+ /* The parameters have already been validated, so this will not fail */ -+ (void)dmaengine_slave_config(dma_chan, -+ (dir_data == DMA_FROM_DEVICE) ? -+ &host->dma_cfg_rx : -+ &host->dma_cfg_tx); -+ -+ BUG_ON(!dma_chan->device); -+ BUG_ON(!dma_chan->device->dev); -+ BUG_ON(!host->data->sg); -+ -+ len = dma_map_sg(dma_chan->device->dev, host->data->sg, -+ host->data->sg_len, dir_data); -+ if (len > 0) { -+ desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, -+ len, dir_slave, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ } else { -+ dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); -+ } -+ if (desc) { -+ unsigned long flags; -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | -+ SDHCI_INT_SPACE_AVAIL); -+ host->tx_desc = desc; -+ desc->callback = bcm2835_mmc_dma_complete; -+ desc->callback_param = host; -+ spin_unlock_irqrestore(&host->lock, flags); -+ dmaengine_submit(desc); -+ dma_async_issue_pending(dma_chan); -+ } -+ -+} -+ -+ -+ -+static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) -+{ -+ u32 pio_irqs = SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; -+ u32 dma_irqs = SDHCI_INT_DMA_END | SDHCI_INT_ADMA_ERROR; -+ -+ if (host->use_dma) -+ host->ier = (host->ier & ~pio_irqs) | dma_irqs; -+ else -+ host->ier = (host->ier & ~dma_irqs) | pio_irqs; -+ -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); -+} -+ -+ -+static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) -+{ -+ u8 count; -+ struct mmc_data *data = cmd->data; -+ -+ WARN_ON(host->data); -+ -+ if (data || (cmd->flags & MMC_RSP_BUSY)) { -+ count = TIMEOUT_VAL; -+ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); -+ } -+ -+ if (!data) -+ return; -+ -+ /* Sanity checks */ -+ BUG_ON(data->blksz * data->blocks > 524288); -+ BUG_ON(data->blksz > host->mmc->max_blk_size); -+ BUG_ON(data->blocks > 65535); -+ -+ host->data = data; -+ host->data_early = 0; -+ host->data->bytes_xfered = 0; -+ -+ -+ if (!(host->flags & SDHCI_REQ_USE_DMA)) { -+ int flags; -+ -+ flags = SG_MITER_ATOMIC; -+ if (host->data->flags & MMC_DATA_READ) -+ flags |= SG_MITER_TO_SG; -+ else -+ flags |= SG_MITER_FROM_SG; -+ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); -+ host->blocks = data->blocks; -+ } -+ -+ host->use_dma = host->have_dma && data->blocks > PIO_DMA_BARRIER; -+ -+ bcm2835_mmc_set_transfer_irqs(host); -+ -+ /* Set the DMA boundary value and block size */ -+ bcm2835_mmc_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, -+ data->blksz), SDHCI_BLOCK_SIZE); -+ bcm2835_mmc_writew(host, data->blocks, SDHCI_BLOCK_COUNT); -+ -+ BUG_ON(!host->data); -+} -+ -+static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, -+ struct mmc_command *cmd) -+{ -+ u16 mode; -+ struct mmc_data *data = cmd->data; -+ -+ if (data == NULL) { -+ /* clear Auto CMD settings for no data CMDs */ -+ mode = bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE); -+ bcm2835_mmc_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 | -+ SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE); -+ return; -+ } -+ -+ WARN_ON(!host->data); -+ -+ mode = SDHCI_TRNS_BLK_CNT_EN; -+ -+ if ((mmc_op_multi(cmd->opcode) || data->blocks > 1)) { -+ mode |= SDHCI_TRNS_MULTI; -+ -+ /* -+ * If we are sending CMD23, CMD12 never gets sent -+ * on successful completion (so no Auto-CMD12). -+ */ -+ if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) -+ mode |= SDHCI_TRNS_AUTO_CMD12; -+ else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { -+ mode |= SDHCI_TRNS_AUTO_CMD23; -+ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); -+ } -+ } -+ -+ if (data->flags & MMC_DATA_READ) -+ mode |= SDHCI_TRNS_READ; -+ if (host->flags & SDHCI_REQ_USE_DMA) -+ mode |= SDHCI_TRNS_DMA; -+ -+ bcm2835_mmc_writew(host, mode, SDHCI_TRANSFER_MODE); -+} -+ -+void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd) -+{ -+ int flags; -+ u32 mask; -+ unsigned long timeout; -+ -+ WARN_ON(host->cmd); -+ -+ /* Wait max 10 ms */ -+ timeout = 1000; -+ -+ mask = SDHCI_CMD_INHIBIT; -+ if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) -+ mask |= SDHCI_DATA_INHIBIT; -+ -+ /* We shouldn't wait for data inihibit for stop commands, even -+ though they might use busy signaling */ -+ if (host->mrq->data && (cmd == host->mrq->data->stop)) -+ mask &= ~SDHCI_DATA_INHIBIT; -+ -+ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { -+ if (timeout == 0) { -+ pr_err("%s: Controller never released inhibit bit(s).\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_mmc_dumpregs(host); -+ cmd->error = -EIO; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ timeout--; -+ udelay(10); -+ } -+ -+ if ((1000-timeout)/100 > 1 && (1000-timeout)/100 > host->max_delay) { -+ host->max_delay = (1000-timeout)/100; -+ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); -+ } -+ -+ timeout = jiffies; -+ if (!cmd->data && cmd->busy_timeout > 9000) -+ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; -+ else -+ timeout += 10 * HZ; -+ mod_timer(&host->timer, timeout); -+ -+ host->cmd = cmd; -+ -+ bcm2835_mmc_prepare_data(host, cmd); -+ -+ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); -+ -+ bcm2835_mmc_set_transfer_mode(host, cmd); -+ -+ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { -+ pr_err("%s: Unsupported response type!\n", -+ mmc_hostname(host->mmc)); -+ cmd->error = -EINVAL; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ -+ if (!(cmd->flags & MMC_RSP_PRESENT)) -+ flags = SDHCI_CMD_RESP_NONE; -+ else if (cmd->flags & MMC_RSP_136) -+ flags = SDHCI_CMD_RESP_LONG; -+ else if (cmd->flags & MMC_RSP_BUSY) -+ flags = SDHCI_CMD_RESP_SHORT_BUSY; -+ else -+ flags = SDHCI_CMD_RESP_SHORT; -+ -+ if (cmd->flags & MMC_RSP_CRC) -+ flags |= SDHCI_CMD_CRC; -+ if (cmd->flags & MMC_RSP_OPCODE) -+ flags |= SDHCI_CMD_INDEX; -+ -+ if (cmd->data) -+ flags |= SDHCI_CMD_DATA; -+ -+ bcm2835_mmc_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); -+} -+ -+ -+static void bcm2835_mmc_finish_data(struct bcm2835_host *host) -+{ -+ struct mmc_data *data; -+ -+ BUG_ON(!host->data); -+ -+ data = host->data; -+ host->data = NULL; -+ -+ if (data->error) -+ data->bytes_xfered = 0; -+ else -+ data->bytes_xfered = data->blksz * data->blocks; -+ -+ /* -+ * Need to send CMD12 if - -+ * a) open-ended multiblock transfer (no CMD23) -+ * b) error in multiblock transfer -+ */ -+ if (data->stop && -+ (data->error || -+ !host->mrq->sbc)) { -+ -+ /* -+ * The controller needs a reset of internal state machines -+ * upon error conditions. -+ */ -+ if (data->error) { -+ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); -+ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -+ } -+ -+ bcm2835_mmc_send_command(host, data->stop); -+ } else -+ tasklet_schedule(&host->finish_tasklet); -+} -+ -+static void bcm2835_mmc_finish_command(struct bcm2835_host *host) -+{ -+ int i; -+ -+ BUG_ON(host->cmd == NULL); -+ -+ if (host->cmd->flags & MMC_RSP_PRESENT) { -+ if (host->cmd->flags & MMC_RSP_136) { -+ /* CRC is stripped so we need to do some shifting. */ -+ for (i = 0; i < 4; i++) { -+ host->cmd->resp[i] = bcm2835_mmc_readl(host, -+ SDHCI_RESPONSE + (3-i)*4) << 8; -+ if (i != 3) -+ host->cmd->resp[i] |= -+ bcm2835_mmc_readb(host, -+ SDHCI_RESPONSE + (3-i)*4-1); -+ } -+ } else { -+ host->cmd->resp[0] = bcm2835_mmc_readl(host, SDHCI_RESPONSE); -+ } -+ } -+ -+ host->cmd->error = 0; -+ -+ /* Finished CMD23, now send actual command. */ -+ if (host->cmd == host->mrq->sbc) { -+ host->cmd = NULL; -+ bcm2835_mmc_send_command(host, host->mrq->cmd); -+ -+ if (host->mrq->cmd->data && host->use_dma) { -+ /* DMA transfer starts now, PIO starts after interrupt */ -+ bcm2835_mmc_transfer_dma(host); -+ } -+ } else { -+ -+ /* Processed actual command. */ -+ if (host->data && host->data_early) -+ bcm2835_mmc_finish_data(host); -+ -+ if (!host->cmd->data) -+ tasklet_schedule(&host->finish_tasklet); -+ -+ host->cmd = NULL; -+ } -+} -+ -+ -+static void bcm2835_mmc_timeout_timer(unsigned long data) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = (struct bcm2835_host *)data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (host->mrq) { -+ pr_err("%s: Timeout waiting for hardware interrupt.\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_mmc_dumpregs(host); -+ -+ if (host->data) { -+ host->data->error = -ETIMEDOUT; -+ bcm2835_mmc_finish_data(host); -+ } else { -+ if (host->cmd) -+ host->cmd->error = -ETIMEDOUT; -+ else -+ host->mrq->cmd->error = -ETIMEDOUT; -+ -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ } -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+ -+static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) -+{ -+ if (!(host->flags & SDHCI_DEVICE_DEAD)) { -+ if (enable) -+ host->ier |= SDHCI_INT_CARD_INT; -+ else -+ host->ier &= ~SDHCI_INT_CARD_INT; -+ -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); -+ mmiowb(); -+ } -+} -+ -+static void bcm2835_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) -+{ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ if (enable) -+ host->flags |= SDHCI_SDIO_IRQ_ENABLED; -+ else -+ host->flags &= ~SDHCI_SDIO_IRQ_ENABLED; -+ -+ bcm2835_mmc_enable_sdio_irq_nolock(host, enable); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_mmc_cmd_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ -+ BUG_ON(intmask == 0); -+ -+ if (!host->cmd) { -+ pr_err("%s: Got command interrupt 0x%08x even " -+ "though no command operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_mmc_dumpregs(host); -+ return; -+ } -+ -+ if (intmask & SDHCI_INT_TIMEOUT) -+ host->cmd->error = -ETIMEDOUT; -+ else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT | -+ SDHCI_INT_INDEX)) { -+ host->cmd->error = -EILSEQ; -+ } -+ -+ if (host->cmd->error) { -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ -+ if (intmask & SDHCI_INT_RESPONSE) -+ bcm2835_mmc_finish_command(host); -+ -+} -+ -+static void bcm2835_mmc_data_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ struct dma_chan *dma_chan; -+ u32 dir_data; -+ -+ BUG_ON(intmask == 0); -+ -+ if (!host->data) { -+ /* -+ * The "data complete" interrupt is also used to -+ * indicate that a busy state has ended. See comment -+ * above in sdhci_cmd_irq(). -+ */ -+ if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) { -+ if (intmask & SDHCI_INT_DATA_END) { -+ bcm2835_mmc_finish_command(host); -+ return; -+ } -+ } -+ -+ pr_debug("%s: Got data interrupt 0x%08x even " -+ "though no data operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_mmc_dumpregs(host); -+ -+ return; -+ } -+ -+ if (intmask & SDHCI_INT_DATA_TIMEOUT) -+ host->data->error = -ETIMEDOUT; -+ else if (intmask & SDHCI_INT_DATA_END_BIT) -+ host->data->error = -EILSEQ; -+ else if ((intmask & SDHCI_INT_DATA_CRC) && -+ SDHCI_GET_CMD(bcm2835_mmc_readw(host, SDHCI_COMMAND)) -+ != MMC_BUS_TEST_R) -+ host->data->error = -EILSEQ; -+ -+ if (host->use_dma) { -+ if (host->data->flags & MMC_DATA_WRITE) { -+ /* IRQ handled here */ -+ -+ dma_chan = host->dma_chan_rxtx; -+ dir_data = DMA_TO_DEVICE; -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); -+ -+ bcm2835_mmc_finish_data(host); -+ } -+ -+ } else { -+ if (host->data->error) -+ bcm2835_mmc_finish_data(host); -+ else { -+ if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) -+ bcm2835_mmc_transfer_pio(host); -+ -+ if (intmask & SDHCI_INT_DATA_END) { -+ if (host->cmd) { -+ /* -+ * Data managed to finish before the -+ * command completed. Make sure we do -+ * things in the proper order. -+ */ -+ host->data_early = 1; -+ } else { -+ bcm2835_mmc_finish_data(host); -+ } -+ } -+ } -+ } -+} -+ -+ -+static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) -+{ -+ irqreturn_t result = IRQ_NONE; -+ struct bcm2835_host *host = dev_id; -+ u32 intmask, mask, unexpected = 0; -+ int max_loops = 16; -+ -+ spin_lock(&host->lock); -+ -+ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); -+ -+ if (!intmask || intmask == 0xffffffff) { -+ result = IRQ_NONE; -+ goto out; -+ } -+ -+ do { -+ /* Clear selected interrupts. */ -+ mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | -+ SDHCI_INT_BUS_POWER); -+ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); -+ -+ -+ if (intmask & SDHCI_INT_CMD_MASK) -+ bcm2835_mmc_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); -+ -+ if (intmask & SDHCI_INT_DATA_MASK) -+ bcm2835_mmc_data_irq(host, intmask & SDHCI_INT_DATA_MASK); -+ -+ if (intmask & SDHCI_INT_BUS_POWER) -+ pr_err("%s: Card is consuming too much power!\n", -+ mmc_hostname(host->mmc)); -+ -+ if (intmask & SDHCI_INT_CARD_INT) { -+ bcm2835_mmc_enable_sdio_irq_nolock(host, false); -+ host->thread_isr |= SDHCI_INT_CARD_INT; -+ result = IRQ_WAKE_THREAD; -+ } -+ -+ intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE | -+ SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | -+ SDHCI_INT_ERROR | SDHCI_INT_BUS_POWER | -+ SDHCI_INT_CARD_INT); -+ -+ if (intmask) { -+ unexpected |= intmask; -+ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); -+ } -+ -+ if (result == IRQ_NONE) -+ result = IRQ_HANDLED; -+ -+ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); -+ } while (intmask && --max_loops); -+out: -+ spin_unlock(&host->lock); -+ -+ if (unexpected) { -+ pr_err("%s: Unexpected interrupt 0x%08x.\n", -+ mmc_hostname(host->mmc), unexpected); -+ bcm2835_mmc_dumpregs(host); -+ } -+ -+ return result; -+} -+ -+static irqreturn_t bcm2835_mmc_thread_irq(int irq, void *dev_id) -+{ -+ struct bcm2835_host *host = dev_id; -+ unsigned long flags; -+ u32 isr; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ isr = host->thread_isr; -+ host->thread_isr = 0; -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (isr & SDHCI_INT_CARD_INT) { -+ sdio_run_irqs(host->mmc); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ if (host->flags & SDHCI_SDIO_IRQ_ENABLED) -+ bcm2835_mmc_enable_sdio_irq_nolock(host, true); -+ spin_unlock_irqrestore(&host->lock, flags); -+ } -+ -+ return isr ? IRQ_HANDLED : IRQ_NONE; -+} -+ -+ -+ -+void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) -+{ -+ int div = 0; /* Initialized for compiler warning */ -+ int real_div = div, clk_mul = 1; -+ u16 clk = 0; -+ unsigned long timeout; -+ unsigned int input_clock = clock; -+ -+ if (host->overclock_50 && (clock == 50000000)) -+ clock = host->overclock_50 * 1000000 + 999999; -+ -+ host->mmc->actual_clock = 0; -+ -+ bcm2835_mmc_writew(host, 0, SDHCI_CLOCK_CONTROL); -+ -+ if (clock == 0) -+ return; -+ -+ /* Version 3.00 divisors must be a multiple of 2. */ -+ if (host->max_clk <= clock) -+ div = 1; -+ else { -+ for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; -+ div += 2) { -+ if ((host->max_clk / div) <= clock) -+ break; -+ } -+ } -+ -+ real_div = div; -+ div >>= 1; -+ -+ if (real_div) -+ clock = (host->max_clk * clk_mul) / real_div; -+ host->mmc->actual_clock = clock; -+ -+ if ((clock > input_clock) && (clock > host->max_overclock)) { -+ pr_warn("%s: Overclocking to %dHz\n", -+ mmc_hostname(host->mmc), clock); -+ host->max_overclock = clock; -+ } -+ -+ clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; -+ clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) -+ << SDHCI_DIVIDER_HI_SHIFT; -+ clk |= SDHCI_CLOCK_INT_EN; -+ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); -+ -+ /* Wait max 20 ms */ -+ timeout = 20; -+ while (!((clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)) -+ & SDHCI_CLOCK_INT_STABLE)) { -+ if (timeout == 0) { -+ pr_err("%s: Internal clock never " -+ "stabilised.\n", mmc_hostname(host->mmc)); -+ bcm2835_mmc_dumpregs(host); -+ return; -+ } -+ timeout--; -+ mdelay(1); -+ } -+ -+ if (20-timeout > 10 && 20-timeout > host->max_delay) { -+ host->max_delay = 20-timeout; -+ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); -+ } -+ -+ clk |= SDHCI_CLOCK_CARD_EN; -+ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); -+} -+ -+static void bcm2835_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = mmc_priv(mmc); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ WARN_ON(host->mrq != NULL); -+ -+ host->mrq = mrq; -+ -+ if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) -+ bcm2835_mmc_send_command(host, mrq->sbc); -+ else -+ bcm2835_mmc_send_command(host, mrq->cmd); -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (!(mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) && mrq->cmd->data && host->use_dma) { -+ /* DMA transfer starts now, PIO starts after interrupt */ -+ bcm2835_mmc_transfer_dma(host); -+ } -+} -+ -+ -+static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) -+{ -+ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ u8 ctrl; -+ u16 clk, ctrl_2; -+ -+ pr_debug("bcm2835_mmc_set_ios: clock %d, pwr %d, bus_width %d, timing %d, vdd %d, drv_type %d\n", -+ ios->clock, ios->power_mode, ios->bus_width, -+ ios->timing, ios->signal_voltage, ios->drv_type); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (!ios->clock || ios->clock != host->clock) { -+ bcm2835_mmc_set_clock(host, ios->clock); -+ host->clock = ios->clock; -+ } -+ -+ if (host->pwr != SDHCI_POWER_330) { -+ host->pwr = SDHCI_POWER_330; -+ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); -+ } -+ -+ ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); -+ -+ /* set bus width */ -+ ctrl &= ~SDHCI_CTRL_8BITBUS; -+ if (ios->bus_width == MMC_BUS_WIDTH_4) -+ ctrl |= SDHCI_CTRL_4BITBUS; -+ else -+ ctrl &= ~SDHCI_CTRL_4BITBUS; -+ -+ ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ -+ -+ -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ /* -+ * We only need to set Driver Strength if the -+ * preset value enable is not set. -+ */ -+ ctrl_2 = bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2); -+ ctrl_2 &= ~SDHCI_CTRL_DRV_TYPE_MASK; -+ if (ios->drv_type == MMC_SET_DRIVER_TYPE_A) -+ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_A; -+ else if (ios->drv_type == MMC_SET_DRIVER_TYPE_C) -+ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_C; -+ -+ bcm2835_mmc_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); -+ -+ /* Reset SD Clock Enable */ -+ clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL); -+ clk &= ~SDHCI_CLOCK_CARD_EN; -+ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); -+ -+ /* Re-enable SD Clock */ -+ bcm2835_mmc_set_clock(host, host->clock); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ -+ mmiowb(); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+ -+static struct mmc_host_ops bcm2835_ops = { -+ .request = bcm2835_mmc_request, -+ .set_ios = bcm2835_mmc_set_ios, -+ .enable_sdio_irq = bcm2835_mmc_enable_sdio_irq, -+}; -+ -+ -+static void bcm2835_mmc_tasklet_finish(unsigned long param) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ struct mmc_request *mrq; -+ -+ host = (struct bcm2835_host *)param; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. -+ */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ del_timer(&host->timer); -+ -+ mrq = host->mrq; -+ -+ /* -+ * The controller needs a reset of internal state machines -+ * upon error conditions. -+ */ -+ if (!(host->flags & SDHCI_DEVICE_DEAD) && -+ ((mrq->cmd && mrq->cmd->error) || -+ (mrq->data && (mrq->data->error || -+ (mrq->data->stop && mrq->data->stop->error))))) { -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); -+ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -+ spin_lock_irqsave(&host->lock, flags); -+ } -+ -+ host->mrq = NULL; -+ host->cmd = NULL; -+ host->data = NULL; -+ -+ mmiowb(); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ mmc_request_done(host->mmc, mrq); -+} -+ -+ -+ -+static int bcm2835_mmc_add_host(struct bcm2835_host *host) -+{ -+ struct mmc_host *mmc = host->mmc; -+ struct device *dev = mmc->parent; -+#ifndef FORCE_PIO -+ struct dma_slave_config cfg; -+#endif -+ int ret; -+ -+ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -+ -+ host->clk_mul = 0; -+ -+ mmc->f_max = host->max_clk; -+ mmc->f_max = host->max_clk; -+ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; -+ -+ /* SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK */ -+ host->timeout_clk = mmc->f_max / 1000; -+ mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; -+ -+ /* host controller capabilities */ -+ mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | -+ MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | -+ MMC_CAP_MMC_HIGHSPEED; -+ -+ mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; -+ -+ host->flags = SDHCI_AUTO_CMD23; -+ -+ dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); -+#ifdef FORCE_PIO -+ dev_info(dev, "Forcing PIO mode\n"); -+ host->have_dma = false; -+#else -+ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { -+ dev_err(dev, "%s: Unable to initialise DMA channel. Falling back to PIO\n", -+ DRIVER_NAME); -+ host->have_dma = false; -+ } else { -+ dev_info(dev, "DMA channel allocated"); -+ -+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.slave_id = 11; /* DREQ channel */ -+ -+ /* Validate the slave configurations */ -+ -+ cfg.direction = DMA_MEM_TO_DEV; -+ cfg.src_addr = 0; -+ cfg.dst_addr = host->bus_addr + SDHCI_BUFFER; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ -+ if (ret == 0) { -+ host->dma_cfg_tx = cfg; -+ -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; -+ cfg.dst_addr = 0; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ } -+ -+ if (ret == 0) { -+ host->dma_cfg_rx = cfg; -+ -+ host->use_dma = true; -+ } else { -+ pr_err("%s: unable to configure DMA channel. " -+ "Faling back to PIO\n", -+ mmc_hostname(mmc)); -+ dma_release_channel(host->dma_chan_rxtx); -+ host->dma_chan_rxtx = NULL; -+ host->use_dma = false; -+ } -+ } -+#endif -+ mmc->max_segs = 128; -+ mmc->max_req_size = 524288; -+ mmc->max_seg_size = mmc->max_req_size; -+ mmc->max_blk_size = 512; -+ mmc->max_blk_count = 65535; -+ -+ /* report supported voltage ranges */ -+ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; -+ -+ tasklet_init(&host->finish_tasklet, -+ bcm2835_mmc_tasklet_finish, (unsigned long)host); -+ -+ setup_timer(&host->timer, bcm2835_mmc_timeout_timer, (unsigned long)host); -+ init_waitqueue_head(&host->buf_ready_int); -+ -+ bcm2835_mmc_init(host, 0); -+ ret = devm_request_threaded_irq(dev, host->irq, bcm2835_mmc_irq, -+ bcm2835_mmc_thread_irq, IRQF_SHARED, -+ mmc_hostname(mmc), host); -+ if (ret) { -+ dev_err(dev, "Failed to request IRQ %d: %d\n", host->irq, ret); -+ goto untasklet; -+ } -+ -+ mmiowb(); -+ mmc_add_host(mmc); -+ -+ return 0; -+ -+untasklet: -+ tasklet_kill(&host->finish_tasklet); -+ -+ return ret; -+} -+ -+static int bcm2835_mmc_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node; -+ struct clk *clk; -+ struct resource *iomem; -+ struct bcm2835_host *host; -+ struct mmc_host *mmc; -+ const __be32 *addr; -+ int ret; -+ -+ mmc = mmc_alloc_host(sizeof(*host), dev); -+ if (!mmc) -+ return -ENOMEM; -+ -+ mmc->ops = &bcm2835_ops; -+ host = mmc_priv(mmc); -+ host->mmc = mmc; -+ host->timeout = msecs_to_jiffies(1000); -+ spin_lock_init(&host->lock); -+ -+ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ host->ioaddr = devm_ioremap_resource(dev, iomem); -+ if (IS_ERR(host->ioaddr)) { -+ ret = PTR_ERR(host->ioaddr); -+ goto err; -+ } -+ -+ addr = of_get_address(node, 0, NULL, NULL); -+ if (!addr) { -+ dev_err(dev, "could not get DMA-register address\n"); -+ return -ENODEV; -+ } -+ host->bus_addr = be32_to_cpup(addr); -+ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", -+ (unsigned long)host->ioaddr, -+ (unsigned long)iomem->start, -+ (unsigned long)host->bus_addr); -+ -+#ifndef FORCE_PIO -+ if (node) { -+ host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "rx"); -+ } else { -+ dma_cap_mask_t mask; -+ -+ dma_cap_zero(mask); -+ /* we don't care about the channel, any would work */ -+ dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_rxtx = dma_request_channel(mask, NULL, NULL); -+ } -+#endif -+ clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(clk)) { -+ ret = PTR_ERR(clk); -+ if (ret == -EPROBE_DEFER) -+ dev_info(dev, "could not get clk, deferring probe\n"); -+ else -+ dev_err(dev, "could not get clk\n"); -+ goto err; -+ } -+ -+ host->max_clk = clk_get_rate(clk); -+ -+ host->irq = platform_get_irq(pdev, 0); -+ if (host->irq <= 0) { -+ dev_err(dev, "get IRQ failed\n"); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ if (node) { -+ mmc_of_parse(mmc); -+ -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,overclock-50", -+ &host->overclock_50); -+ } else { -+ mmc->caps |= MMC_CAP_4_BIT_DATA; -+ } -+ -+ ret = bcm2835_mmc_add_host(host); -+ if (ret) -+ goto err; -+ -+ platform_set_drvdata(pdev, host); -+ -+ return 0; -+err: -+ mmc_free_host(mmc); -+ -+ return ret; -+} -+ -+static int bcm2835_mmc_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_host *host = platform_get_drvdata(pdev); -+ unsigned long flags; -+ int dead; -+ u32 scratch; -+ -+ dead = 0; -+ scratch = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); -+ if (scratch == (u32)-1) -+ dead = 1; -+ -+ -+ if (dead) { -+ spin_lock_irqsave(&host->lock, flags); -+ -+ host->flags |= SDHCI_DEVICE_DEAD; -+ -+ if (host->mrq) { -+ pr_err("%s: Controller removed during " -+ " transfer!\n", mmc_hostname(host->mmc)); -+ -+ host->mrq->cmd->error = -ENOMEDIUM; -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ } -+ -+ mmc_remove_host(host->mmc); -+ -+ if (!dead) -+ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -+ -+ free_irq(host->irq, host); -+ -+ del_timer_sync(&host->timer); -+ -+ tasklet_kill(&host->finish_tasklet); -+ -+ mmc_free_host(host->mmc); -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+ -+ -+static const struct of_device_id bcm2835_mmc_match[] = { -+ { .compatible = "brcm,bcm2835-mmc" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_mmc_match); -+ -+ -+ -+static struct platform_driver bcm2835_mmc_driver = { -+ .probe = bcm2835_mmc_probe, -+ .remove = bcm2835_mmc_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_mmc_match, -+ }, -+}; -+module_platform_driver(bcm2835_mmc_driver); -+ -+module_param(mmc_debug, uint, 0644); -+module_param(mmc_debug2, uint, 0644); -+MODULE_ALIAS("platform:mmc-bcm2835"); -+MODULE_DESCRIPTION("BCM2835 SDHCI driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Gellert Weisz"); - -From a56eb108067d0211a3ba3b987ec15986ac5577a6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 035/122] Adding bcm2835-sdhost driver, and an overlay to - enable it - -BCM2835 has two SD card interfaces. This driver uses the other one. - -bcm2835-sdhost: Error handling fix, and code clarification - -bcm2835-sdhost: Adding overclocking option - -Allow a different clock speed to be substitued for a requested 50MHz. -This option is exposed using the "overclock_50" DT parameter. -Note that the sdhost interface is restricted to integer divisions of -core_freq, and the highest sensible option for a core_freq of 250MHz -is 84 (250/3 = 83.3MHz), the next being 125 (250/2) which is much too -high. - -Use at your own risk. - -bcm2835-sdhost: Round up the overclock, so 62 works for 62.5Mhz - -Also only warn once for each overclock setting. - -bcm2835-sdhost: Improve error handling and recovery - -1) Expose the hw_reset method to the MMC framework, removing many - internal calls by the driver. - -2) Reduce overclock setting on error. - -3) Increase timeout to cope with high capacity cards. - -4) Add properties and parameters to control pio_limit and debug. - -5) Reduce messages at probe time. - -bcm2835-sdhost: Further improve overclock back-off - -bcm2835-sdhost: Clear HBLC for PIO mode - -Also update pio_limit default in overlay README. - -bcm2835-sdhost: Add the ERASE capability - -See: https://github.com/raspberrypi/linux/issues/1076 - -bcm2835-sdhost: Ignore CRC7 for MMC CMD1 - -It seems that the sdhost interface returns CRC7 errors for CMD1, -which is the MMC-specific SEND_OP_COND. Returning these errors to -the MMC layer causes a downward spiral, but ignoring them seems -to be harmless. - -bcm2835-mmc/sdhost: Remove ARCH_BCM2835 differences - -The bcm2835-mmc driver (and -sdhost driver that copied from it) -contains code to handle SDIO interrupts in a threaded interrupt -handler rather than waking the MMC framework thread. The change -follows a patch from Russell King that adds the facility as the -preferred way of working. - -However, the new code path is only present in ARCH_BCM2835 -builds, which I have taken to be a way of testing the waters -rather than making the change across the board; I can't see -any technical reason why it wouldn't be enabled for MACH_BCM270X -builds. So this patch standardises on the ARCH_BCM2835 code, -removing the old code paths. - -bcm2835-sdhost: Don't log timeout errors unless debug=1 - -The MMC card-discovery process generates timeouts. This is -expected behaviour, so reporting it to the user serves no purpose. -Suppress the reporting of timeout errors unless the debug flag -is on. - -bcm2835-sdhost: Add workaround for odd behaviour on some cards - -For reasons not understood, the sdhost driver fails when reading -sectors very near the end of some SD cards. The problem could -be related to the similar issue that reading the final sector -of any card as part of a multiple read never completes, and the -workaround is an extension of the mechanism introduced to solve -that problem which ensures those sectors are always read singly. - -bcm2835-sdhost: Major revision - -This is a significant revision of the bcm2835-sdhost driver. It -improves on the original in a number of ways: - -1) Through the use of CMD23 for reads it appears to avoid problems - reading some sectors on certain high speed cards. -2) Better atomicity to prevent crashes. -3) Higher performance. -4) Activity logging included, for easier diagnosis in the event - of a problem. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping - -Allocation problems have been seen in a wireless driver, and -this is the only change which might have been responsible. - -SQUASH: bcm2835-sdhost: Only claim one DMA channel - -With both MMC controllers enabled there are few DMA channels left. The -bcm2835-sdhost driver only uses DMA in one direction at a time, so it -doesn't need to claim two channels. - -See: https://github.com/raspberrypi/linux/issues/1327 - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Workaround for "slow" sectors - -Some cards have been seen to cause timeouts after certain sectors are -read. This workaround enforces a minimum delay between the stop after -reading one of those sectors and a subsequent data command. - -Using CMD23 (SET_BLOCK_COUNT) avoids this problem, so good cards will -not be penalised by this workaround. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Firmware manages the clock divisor - -The bcm2835-sdhost driver hands control of the CDIV clock divisor -register to matching firmware, allowing it to adjust to a changing -core clock. This removes the need to use the performance governor or -to enable io_is_busy on the on-demand governor in order to get the -best SD performance. - -N.B. As SD clocks must be an integer divisor of the core clock, it is -possible that the SD clock for "turbo" mode can be different (even -lower) than "normal" mode. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Reset the clock in task context - -Since reprogramming the clock can now involve a round-trip to the -firmware it must not be done at atomic context, and a tasklet -is not a task. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Don't exit cmd wait loop on error - -The FAIL flag can be set in the CMD register before command processing -is complete, leading to spurious "failed to complete" errors. This has -the effect of promoting harmless CRC7 errors during CMD1 processing -into errors that can delay and even prevent booting. - -Also: -1) Convert the last KERN_ERROR message in the register dumping to - KERN_INFO. -2) Remove an unnecessary reset call from bcm2835_sdhost_add_host. - -See: https://github.com/raspberrypi/linux/pull/1492 - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/Kconfig | 12 +- - drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-sdhost.c | 2189 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 2201 insertions(+), 1 deletion(-) - create mode 100644 drivers/mmc/host/bcm2835-sdhost.c - -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 405d62909dd6ac5351684c002414cc02135d98ba..87d251e93913b216359383812cae196e91bf6cfb 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -6,7 +6,7 @@ comment "MMC/SD/SDIO Host Controller Drivers" - - config MMC_BCM2835 - tristate "MMC support on BCM2835" -- depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 -+ depends on ARCH_BCM2835 - help - This selects the MMC Interface on BCM2835. - -@@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER - - If unsure, say 2 here. - -+config MMC_BCM2835_SDHOST -+ tristate "Support for the SDHost controller on BCM2708/9" -+ depends on ARCH_BCM2835 -+ help -+ This selects the SDHost controller on BCM2835/6. -+ -+ If you have a controller with this interface, say Y or M here. -+ -+ If unsure, say N. -+ - config MMC_ARMMMCI - tristate "ARM AMBA Multimedia Card Interface support" - depends on ARM_AMBA -diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 5133b680970c93fbb9695f83296f0f70b4977240..adbc4586fec94aa8bd70f5ca3e2c90d123849a34 100644 ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o - obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o - obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o - obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o -+obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o - obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o - obj-$(CONFIG_MMC_WBSD) += wbsd.o - obj-$(CONFIG_MMC_AU1X) += au1xmmc.o -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -new file mode 100644 -index 0000000000000000000000000000000000000000..a9bc79bfdbb71807819dfe2d8f1651445997f92a ---- /dev/null -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -0,0 +1,2189 @@ -+/* -+ * BCM2835 SD host driver. -+ * -+ * Author: Phil Elwell -+ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. -+ * -+ * Based on -+ * mmc-bcm2835.c by Gellert Weisz -+ * which is, in turn, based on -+ * sdhci-bcm2708.c by Broadcom -+ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko -+ * sdhci.c and sdhci-pci.c by Pierre Ossman -+ * -+ * 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 . -+ */ -+ -+#define FIFO_READ_THRESHOLD 4 -+#define FIFO_WRITE_THRESHOLD 4 -+#define ALLOW_CMD23_READ 1 -+#define ALLOW_CMD23_WRITE 0 -+#define ENABLE_LOG 1 -+#define SDDATA_FIFO_PIO_BURST 8 -+#define CMD_DALLY_US 1 -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "sdhost-bcm2835" -+ -+#define SDCMD 0x00 /* Command to SD card - 16 R/W */ -+#define SDARG 0x04 /* Argument to SD card - 32 R/W */ -+#define SDTOUT 0x08 /* Start value for timeout counter - 32 R/W */ -+#define SDCDIV 0x0c /* Start value for clock divider - 11 R/W */ -+#define SDRSP0 0x10 /* SD card response (31:0) - 32 R */ -+#define SDRSP1 0x14 /* SD card response (63:32) - 32 R */ -+#define SDRSP2 0x18 /* SD card response (95:64) - 32 R */ -+#define SDRSP3 0x1c /* SD card response (127:96) - 32 R */ -+#define SDHSTS 0x20 /* SD host status - 11 R */ -+#define SDVDD 0x30 /* SD card power control - 1 R/W */ -+#define SDEDM 0x34 /* Emergency Debug Mode - 13 R/W */ -+#define SDHCFG 0x38 /* Host configuration - 2 R/W */ -+#define SDHBCT 0x3c /* Host byte count (debug) - 32 R/W */ -+#define SDDATA 0x40 /* Data to/from SD card - 32 R/W */ -+#define SDHBLC 0x50 /* Host block count (SDIO/SDHC) - 9 R/W */ -+ -+#define SDCMD_NEW_FLAG 0x8000 -+#define SDCMD_FAIL_FLAG 0x4000 -+#define SDCMD_BUSYWAIT 0x800 -+#define SDCMD_NO_RESPONSE 0x400 -+#define SDCMD_LONG_RESPONSE 0x200 -+#define SDCMD_WRITE_CMD 0x80 -+#define SDCMD_READ_CMD 0x40 -+#define SDCMD_CMD_MASK 0x3f -+ -+#define SDCDIV_MAX_CDIV 0x7ff -+ -+#define SDHSTS_BUSY_IRPT 0x400 -+#define SDHSTS_BLOCK_IRPT 0x200 -+#define SDHSTS_SDIO_IRPT 0x100 -+#define SDHSTS_REW_TIME_OUT 0x80 -+#define SDHSTS_CMD_TIME_OUT 0x40 -+#define SDHSTS_CRC16_ERROR 0x20 -+#define SDHSTS_CRC7_ERROR 0x10 -+#define SDHSTS_FIFO_ERROR 0x08 -+/* Reserved */ -+/* Reserved */ -+#define SDHSTS_DATA_FLAG 0x01 -+ -+#define SDHSTS_TRANSFER_ERROR_MASK (SDHSTS_CRC7_ERROR|SDHSTS_CRC16_ERROR|SDHSTS_REW_TIME_OUT|SDHSTS_FIFO_ERROR) -+#define SDHSTS_ERROR_MASK (SDHSTS_CMD_TIME_OUT|SDHSTS_TRANSFER_ERROR_MASK) -+ -+#define SDHCFG_BUSY_IRPT_EN (1<<10) -+#define SDHCFG_BLOCK_IRPT_EN (1<<8) -+#define SDHCFG_SDIO_IRPT_EN (1<<5) -+#define SDHCFG_DATA_IRPT_EN (1<<4) -+#define SDHCFG_SLOW_CARD (1<<3) -+#define SDHCFG_WIDE_EXT_BUS (1<<2) -+#define SDHCFG_WIDE_INT_BUS (1<<1) -+#define SDHCFG_REL_CMD_LINE (1<<0) -+ -+#define SDEDM_FORCE_DATA_MODE (1<<19) -+#define SDEDM_CLOCK_PULSE (1<<20) -+#define SDEDM_BYPASS (1<<21) -+ -+#define SDEDM_WRITE_THRESHOLD_SHIFT 9 -+#define SDEDM_READ_THRESHOLD_SHIFT 14 -+#define SDEDM_THRESHOLD_MASK 0x1f -+ -+#define SDEDM_FSM_MASK 0xf -+#define SDEDM_FSM_IDENTMODE 0x0 -+#define SDEDM_FSM_DATAMODE 0x1 -+#define SDEDM_FSM_READDATA 0x2 -+#define SDEDM_FSM_WRITEDATA 0x3 -+#define SDEDM_FSM_READWAIT 0x4 -+#define SDEDM_FSM_READCRC 0x5 -+#define SDEDM_FSM_WRITECRC 0x6 -+#define SDEDM_FSM_WRITEWAIT1 0x7 -+#define SDEDM_FSM_POWERDOWN 0x8 -+#define SDEDM_FSM_POWERUP 0x9 -+#define SDEDM_FSM_WRITESTART1 0xa -+#define SDEDM_FSM_WRITESTART2 0xb -+#define SDEDM_FSM_GENPULSES 0xc -+#define SDEDM_FSM_WRITEWAIT2 0xd -+#define SDEDM_FSM_STARTPOWDOWN 0xf -+ -+#define SDDATA_FIFO_WORDS 16 -+ -+#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ -+ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) -+ -+#define MHZ 1000000 -+ -+ -+struct bcm2835_host { -+ spinlock_t lock; -+ -+ void __iomem *ioaddr; -+ u32 bus_addr; -+ -+ struct mmc_host *mmc; -+ -+ u32 pio_timeout; /* In jiffies */ -+ -+ int clock; /* Current clock speed */ -+ -+ bool slow_card; /* Force 11-bit divisor */ -+ -+ unsigned int max_clk; /* Max possible freq */ -+ -+ struct tasklet_struct finish_tasklet; /* Tasklet structures */ -+ -+ struct work_struct cmd_wait_wq; /* Workqueue function */ -+ -+ struct timer_list timer; /* Timer for timeouts */ -+ -+ struct sg_mapping_iter sg_miter; /* SG state for PIO */ -+ unsigned int blocks; /* remaining PIO blocks */ -+ -+ int irq; /* Device IRQ */ -+ -+ u32 cmd_quick_poll_retries; -+ u32 ns_per_fifo_word; -+ -+ /* cached registers */ -+ u32 hcfg; -+ u32 cdiv; -+ -+ struct mmc_request *mrq; /* Current request */ -+ struct mmc_command *cmd; /* Current command */ -+ struct mmc_data *data; /* Current data request */ -+ unsigned int data_complete:1; /* Data finished before cmd */ -+ -+ unsigned int flush_fifo:1; /* Drain the fifo when finishing */ -+ -+ unsigned int use_busy:1; /* Wait for busy interrupt */ -+ -+ unsigned int use_sbc:1; /* Send CMD23 */ -+ -+ unsigned int debug:1; /* Enable debug output */ -+ unsigned int firmware_sets_cdiv:1; /* Let the firmware manage the clock */ -+ unsigned int reset_clock:1; /* Reset the clock fore the next request */ -+ -+ /*DMA part*/ -+ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ -+ struct dma_chan *dma_chan; /* Channel in use */ -+ struct dma_slave_config dma_cfg_rx; -+ struct dma_slave_config dma_cfg_tx; -+ struct dma_async_tx_descriptor *dma_desc; -+ u32 dma_dir; -+ u32 drain_words; -+ struct page *drain_page; -+ u32 drain_offset; -+ -+ bool allow_dma; -+ bool use_dma; -+ /*end of DMA part*/ -+ -+ int max_delay; /* maximum length of time spent waiting */ -+ struct timeval stop_time; /* when the last stop was issued */ -+ u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ -+ u32 delay_after_this_stop; /* minimum time between this stop and subsequent data transfer */ -+ u32 user_overclock_50; /* User's preferred frequency to use when 50MHz is requested (in MHz) */ -+ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ -+ u32 overclock; /* Current frequency if overclocked, else zero */ -+ u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ -+ -+ u32 sectors; /* Cached card size in sectors */ -+}; -+ -+#if ENABLE_LOG -+ -+struct log_entry_struct { -+ char event[4]; -+ u32 timestamp; -+ u32 param1; -+ u32 param2; -+}; -+ -+typedef struct log_entry_struct LOG_ENTRY_T; -+ -+LOG_ENTRY_T *sdhost_log_buf; -+dma_addr_t sdhost_log_addr; -+static u32 sdhost_log_idx; -+static spinlock_t log_lock; -+static void __iomem *timer_base; -+ -+#define LOG_ENTRIES (256*1) -+#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) -+ -+static void log_init(struct device *dev, u32 bus_to_phys) -+{ -+ spin_lock_init(&log_lock); -+ sdhost_log_buf = dma_zalloc_coherent(dev, LOG_SIZE, &sdhost_log_addr, -+ GFP_KERNEL); -+ if (sdhost_log_buf) { -+ pr_info("sdhost: log_buf @ %p (%x)\n", -+ sdhost_log_buf, sdhost_log_addr); -+ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); -+ if (!timer_base) -+ pr_err("sdhost: failed to remap timer\n"); -+ } -+ else -+ pr_err("sdhost: failed to allocate log buf\n"); -+} -+ -+static void log_event_impl(const char *event, u32 param1, u32 param2) -+{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&log_lock, flags); -+ -+ entry = sdhost_log_buf + sdhost_log_idx; -+ memcpy(entry->event, event, 4); -+ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + -+ (smp_processor_id()<<30); -+ entry->param1 = param1; -+ entry->param2 = param2; -+ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; -+ -+ spin_unlock_irqrestore(&log_lock, flags); -+ } -+} -+ -+static void log_dump(void) -+{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; -+ int idx; -+ -+ spin_lock_irqsave(&log_lock, flags); -+ -+ idx = sdhost_log_idx; -+ do { -+ entry = sdhost_log_buf + idx; -+ if (entry->event[0] != '\0') -+ pr_info("[%08x] %.4s %x %x\n", -+ entry->timestamp, -+ entry->event, -+ entry->param1, -+ entry->param2); -+ idx = (idx + 1) % LOG_ENTRIES; -+ } while (idx != sdhost_log_idx); -+ -+ spin_unlock_irqrestore(&log_lock, flags); -+ } -+} -+ -+#define log_event(event, param1, param2) log_event_impl(event, param1, param2) -+ -+#else -+ -+#define log_init(x) (void)0 -+#define log_event(event, param1, param2) (void)0 -+#define log_dump() (void)0 -+ -+#endif -+ -+static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) -+{ -+ writel(val, host->ioaddr + reg); -+} -+ -+static inline u32 bcm2835_sdhost_read(struct bcm2835_host *host, int reg) -+{ -+ return readl(host->ioaddr + reg); -+} -+ -+static inline u32 bcm2835_sdhost_read_relaxed(struct bcm2835_host *host, int reg) -+{ -+ return readl_relaxed(host->ioaddr + reg); -+} -+ -+static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, -+ struct mmc_command *cmd, -+ const char *label) -+{ -+ if (cmd) -+ pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", -+ mmc_hostname(host->mmc), -+ (cmd == host->cmd) ? '>' : ' ', -+ label, cmd->opcode, cmd->arg, cmd->flags, -+ cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], -+ cmd->error); -+} -+ -+static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) -+{ -+ if (host->mrq) -+ { -+ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -+ if (host->mrq->data) -+ pr_info("%s: data blocks %x blksz %x - err %d\n", -+ mmc_hostname(host->mmc), -+ host->mrq->data->blocks, -+ host->mrq->data->blksz, -+ host->mrq->data->error); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); -+ } -+ -+ pr_info("%s: =========== REGISTER DUMP ===========\n", -+ mmc_hostname(host->mmc)); -+ -+ pr_info("%s: SDCMD 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCMD)); -+ pr_info("%s: SDARG 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDARG)); -+ pr_info("%s: SDTOUT 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDTOUT)); -+ pr_info("%s: SDCDIV 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCDIV)); -+ pr_info("%s: SDRSP0 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP0)); -+ pr_info("%s: SDRSP1 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP1)); -+ pr_info("%s: SDRSP2 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP2)); -+ pr_info("%s: SDRSP3 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP3)); -+ pr_info("%s: SDHSTS 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHSTS)); -+ pr_info("%s: SDVDD 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDVDD)); -+ pr_info("%s: SDEDM 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDEDM)); -+ pr_info("%s: SDHCFG 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHCFG)); -+ pr_info("%s: SDHBCT 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHBCT)); -+ pr_info("%s: SDHBLC 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHBLC)); -+ -+ pr_info("%s: ===========================================\n", -+ mmc_hostname(host->mmc)); -+} -+ -+static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) -+{ -+ bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); -+} -+ -+static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) -+{ -+ u32 temp; -+ -+ if (host->debug) -+ pr_info("%s: reset\n", mmc_hostname(host->mmc)); -+ -+ bcm2835_sdhost_set_power(host, false); -+ -+ bcm2835_sdhost_write(host, 0, SDCMD); -+ bcm2835_sdhost_write(host, 0, SDARG); -+ bcm2835_sdhost_write(host, 0xf00000, SDTOUT); -+ bcm2835_sdhost_write(host, 0, SDCDIV); -+ bcm2835_sdhost_write(host, 0x7f8, SDHSTS); /* Write 1s to clear */ -+ bcm2835_sdhost_write(host, 0, SDHCFG); -+ bcm2835_sdhost_write(host, 0, SDHBCT); -+ bcm2835_sdhost_write(host, 0, SDHBLC); -+ -+ /* Limit fifo usage due to silicon bug */ -+ temp = bcm2835_sdhost_read(host, SDEDM); -+ temp &= ~((SDEDM_THRESHOLD_MASK<clock = 0; -+ host->sectors = 0; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_write(host, SDCDIV_MAX_CDIV, SDCDIV); -+ mmiowb(); -+} -+ -+static void bcm2835_sdhost_reset(struct mmc_host *mmc) -+{ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ spin_lock_irqsave(&host->lock, flags); -+ log_event("RST<", 0, 0); -+ -+ bcm2835_sdhost_reset_internal(host); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -+ -+static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) -+{ -+ pr_debug("bcm2835_sdhost_init(%d)\n", soft); -+ -+ /* Set interrupt enables */ -+ host->hcfg = SDHCFG_BUSY_IRPT_EN; -+ -+ bcm2835_sdhost_reset_internal(host); -+ -+ if (soft) { -+ /* force clock reconfiguration */ -+ host->clock = 0; -+ bcm2835_sdhost_set_ios(host->mmc, &host->mmc->ios); -+ } -+} -+ -+static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) -+{ -+ int timediff; -+ u32 alternate_idle; -+ u32 edm; -+ -+ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? -+ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; -+ -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ -+ log_event("WTC<", edm, 0); -+ -+ timediff = 0; -+ -+ while (1) { -+ u32 fsm = edm & SDEDM_FSM_MASK; -+ if ((fsm == SDEDM_FSM_IDENTMODE) || -+ (fsm == SDEDM_FSM_DATAMODE)) -+ break; -+ if (fsm == alternate_idle) { -+ bcm2835_sdhost_write(host, -+ edm | SDEDM_FORCE_DATA_MODE, -+ SDEDM); -+ break; -+ } -+ -+ timediff++; -+ if (timediff == 100000) { -+ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", -+ mmc_hostname(host->mmc), -+ timediff); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ host->mrq->data->error = -ETIMEDOUT; -+ log_event("WTC!", edm, 0); -+ return; -+ } -+ cpu_relax(); -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ } -+ log_event("WTC>", edm, 0); -+} -+ -+static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); -+ -+static void bcm2835_sdhost_dma_complete(void *param) -+{ -+ struct bcm2835_host *host = param; -+ struct mmc_data *data = host->data; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); -+ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), -+ bcm2835_sdhost_read(host, SDEDM)); -+ -+ if (host->dma_chan) { -+ dma_unmap_sg(host->dma_chan->device->dev, -+ data->sg, data->sg_len, -+ host->dma_dir); -+ -+ host->dma_chan = NULL; -+ } -+ -+ if (host->drain_words) { -+ void *page; -+ u32 *buf; -+ -+ page = kmap_atomic(host->drain_page); -+ buf = page + host->drain_offset; -+ -+ while (host->drain_words) { -+ u32 edm = bcm2835_sdhost_read(host, SDEDM); -+ if ((edm >> 4) & 0x1f) -+ *(buf++) = bcm2835_sdhost_read(host, -+ SDDATA); -+ host->drain_words--; -+ } -+ -+ kunmap_atomic(page); -+ } -+ -+ bcm2835_sdhost_finish_data(host); -+ -+ log_event("DMA>", (u32)host->data, 0); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len; -+ u32 *buf; -+ unsigned long wait_max; -+ -+ blksize = host->data->blksz; -+ -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ int copy_words; -+ u32 hsts = 0; -+ -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ len = min(host->sg_miter.length, blksize); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = (u32 *)host->sg_miter.addr; -+ -+ copy_words = len/4; -+ -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; -+ -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = ((edm >> 4) & 0x1f); -+ -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_READDATA) && -+ (fsm_state != SDEDM_FSM_READWAIT) && -+ (fsm_state != SDEDM_FSM_READCRC)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_info("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO read timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } -+ -+ copy_words -= words; -+ -+ while (words) { -+ *(buf++) = bcm2835_sdhost_read(host, SDDATA); -+ words--; -+ } -+ } -+ -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len; -+ u32 *buf; -+ unsigned long wait_max; -+ -+ blksize = host->data->blksz; -+ -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ int copy_words; -+ u32 hsts = 0; -+ -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ len = min(host->sg_miter.length, blksize); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = (u32 *)host->sg_miter.addr; -+ -+ copy_words = len/4; -+ -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; -+ -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); -+ -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_WRITEDATA) && -+ (fsm_state != SDEDM_FSM_WRITESTART1) && -+ (fsm_state != SDEDM_FSM_WRITESTART2)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_info("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO write timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } -+ -+ copy_words -= words; -+ -+ while (words) { -+ bcm2835_sdhost_write(host, *(buf++), SDDATA); -+ words--; -+ } -+ } -+ -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) -+{ -+ u32 sdhsts; -+ bool is_read; -+ BUG_ON(!host->data); -+ log_event("XFP<", (u32)host->data, host->blocks); -+ -+ is_read = (host->data->flags & MMC_DATA_READ) != 0; -+ if (is_read) -+ bcm2835_sdhost_read_block_pio(host); -+ else -+ bcm2835_sdhost_write_block_pio(host); -+ -+ sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ if (sdhsts & (SDHSTS_CRC16_ERROR | -+ SDHSTS_CRC7_ERROR | -+ SDHSTS_FIFO_ERROR)) { -+ pr_err("%s: %s transfer error - HSTS %x\n", -+ mmc_hostname(host->mmc), -+ is_read ? "read" : "write", -+ sdhsts); -+ host->data->error = -EILSEQ; -+ } else if ((sdhsts & (SDHSTS_CMD_TIME_OUT | -+ SDHSTS_REW_TIME_OUT))) { -+ pr_err("%s: %s timeout error - HSTS %x\n", -+ mmc_hostname(host->mmc), -+ is_read ? "read" : "write", -+ sdhsts); -+ host->data->error = -ETIMEDOUT; -+ } -+ log_event("XFP>", (u32)host->data, host->blocks); -+} -+ -+static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, -+ struct mmc_data *data) -+{ -+ int len, dir_data, dir_slave; -+ struct dma_async_tx_descriptor *desc = NULL; -+ struct dma_chan *dma_chan; -+ -+ log_event("PRD<", (u32)data, 0); -+ pr_debug("bcm2835_sdhost_prepare_dma()\n"); -+ -+ dma_chan = host->dma_chan_rxtx; -+ if (data->flags & MMC_DATA_READ) { -+ dir_data = DMA_FROM_DEVICE; -+ dir_slave = DMA_DEV_TO_MEM; -+ } else { -+ dir_data = DMA_TO_DEVICE; -+ dir_slave = DMA_MEM_TO_DEV; -+ } -+ log_event("PRD1", (u32)dma_chan, 0); -+ -+ BUG_ON(!dma_chan->device); -+ BUG_ON(!dma_chan->device->dev); -+ BUG_ON(!data->sg); -+ -+ /* The block doesn't manage the FIFO DREQs properly for multi-block -+ transfers, so don't attempt to DMA the final few words. -+ Unfortunately this requires the final sg entry to be trimmed. -+ N.B. This code demands that the overspill is contained in -+ a single sg entry. -+ */ -+ -+ host->drain_words = 0; -+ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { -+ struct scatterlist *sg; -+ u32 len; -+ int i; -+ -+ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, -+ (u32)data->blocks * data->blksz); -+ -+ for_each_sg(data->sg, sg, data->sg_len, i) { -+ if (sg_is_last(sg)) { -+ BUG_ON(sg->length < len); -+ sg->length -= len; -+ host->drain_page = sg_page(sg); -+ host->drain_offset = sg->offset + sg->length; -+ } -+ } -+ host->drain_words = len/4; -+ } -+ -+ /* The parameters have already been validated, so this will not fail */ -+ (void)dmaengine_slave_config(dma_chan, -+ (dir_data == DMA_FROM_DEVICE) ? -+ &host->dma_cfg_rx : -+ &host->dma_cfg_tx); -+ -+ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, -+ dir_data); -+ -+ log_event("PRD2", len, 0); -+ if (len > 0) -+ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, -+ len, dir_slave, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ log_event("PRD3", (u32)desc, 0); -+ -+ if (desc) { -+ desc->callback = bcm2835_sdhost_dma_complete; -+ desc->callback_param = host; -+ host->dma_desc = desc; -+ host->dma_chan = dma_chan; -+ host->dma_dir = dir_data; -+ } -+ log_event("PDM>", (u32)data, 0); -+} -+ -+static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) -+{ -+ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); -+ dmaengine_submit(host->dma_desc); -+ dma_async_issue_pending(host->dma_chan); -+} -+ -+static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) -+{ -+ u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | -+ SDHCFG_BUSY_IRPT_EN; -+ if (host->dma_desc) -+ host->hcfg = (host->hcfg & ~all_irqs) | -+ SDHCFG_BUSY_IRPT_EN; -+ else -+ host->hcfg = (host->hcfg & ~all_irqs) | -+ SDHCFG_DATA_IRPT_EN | -+ SDHCFG_BUSY_IRPT_EN; -+ -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+} -+ -+static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) -+{ -+ struct mmc_data *data = cmd->data; -+ -+ WARN_ON(host->data); -+ -+ host->data = data; -+ if (!data) -+ return; -+ -+ /* Sanity checks */ -+ BUG_ON(data->blksz * data->blocks > 524288); -+ BUG_ON(data->blksz > host->mmc->max_blk_size); -+ BUG_ON(data->blocks > 65535); -+ -+ host->data_complete = 0; -+ host->flush_fifo = 0; -+ host->data->bytes_xfered = 0; -+ -+ if (!host->sectors && host->mmc->card) { -+ struct mmc_card *card = host->mmc->card; -+ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -+ /* -+ * The EXT_CSD sector count is in number of 512 byte -+ * sectors. -+ */ -+ host->sectors = card->ext_csd.sectors; -+ } else { -+ /* -+ * The CSD capacity field is in units of read_blkbits. -+ * set_capacity takes units of 512 bytes. -+ */ -+ host->sectors = card->csd.capacity << -+ (card->csd.read_blkbits - 9); -+ } -+ } -+ -+ if (!host->dma_desc) { -+ /* Use PIO */ -+ int flags = SG_MITER_ATOMIC; -+ -+ if (data->flags & MMC_DATA_READ) -+ flags |= SG_MITER_TO_SG; -+ else -+ flags |= SG_MITER_FROM_SG; -+ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); -+ host->blocks = data->blocks; -+ } -+ -+ bcm2835_sdhost_set_transfer_irqs(host); -+ -+ bcm2835_sdhost_write(host, data->blksz, SDHBCT); -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); -+ -+ BUG_ON(!host->data); -+} -+ -+bool bcm2835_sdhost_send_command(struct bcm2835_host *host, -+ struct mmc_command *cmd) -+{ -+ u32 sdcmd, sdhsts; -+ unsigned long timeout; -+ int delay; -+ -+ WARN_ON(host->cmd); -+ log_event("CMD<", cmd->opcode, cmd->arg); -+ -+ if (cmd->data) -+ pr_debug("%s: send_command %d 0x%x " -+ "(flags 0x%x) - %s %d*%d\n", -+ mmc_hostname(host->mmc), -+ cmd->opcode, cmd->arg, cmd->flags, -+ (cmd->data->flags & MMC_DATA_READ) ? -+ "read" : "write", cmd->data->blocks, -+ cmd->data->blksz); -+ else -+ pr_debug("%s: send_command %d 0x%x (flags 0x%x)\n", -+ mmc_hostname(host->mmc), -+ cmd->opcode, cmd->arg, cmd->flags); -+ -+ /* Wait max 100 ms */ -+ timeout = 10000; -+ -+ while (bcm2835_sdhost_read(host, SDCMD) & SDCMD_NEW_FLAG) { -+ if (timeout == 0) { -+ pr_warn("%s: previous command never completed.\n", -+ mmc_hostname(host->mmc)); -+ if (host->debug) -+ bcm2835_sdhost_dumpregs(host); -+ cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ return false; -+ } -+ timeout--; -+ udelay(10); -+ } -+ -+ delay = (10000 - timeout)/100; -+ if (delay > host->max_delay) { -+ host->max_delay = delay; -+ pr_warning("%s: controller hung for %d ms\n", -+ mmc_hostname(host->mmc), -+ host->max_delay); -+ } -+ -+ timeout = jiffies; -+ if (!cmd->data && cmd->busy_timeout > 9000) -+ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; -+ else -+ timeout += 10 * HZ; -+ mod_timer(&host->timer, timeout); -+ -+ host->cmd = cmd; -+ -+ /* Clear any error flags */ -+ sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ if (sdhsts & SDHSTS_ERROR_MASK) -+ bcm2835_sdhost_write(host, sdhsts, SDHSTS); -+ -+ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { -+ pr_err("%s: unsupported response type!\n", -+ mmc_hostname(host->mmc)); -+ cmd->error = -EINVAL; -+ tasklet_schedule(&host->finish_tasklet); -+ return false; -+ } -+ -+ bcm2835_sdhost_prepare_data(host, cmd); -+ -+ bcm2835_sdhost_write(host, cmd->arg, SDARG); -+ -+ sdcmd = cmd->opcode & SDCMD_CMD_MASK; -+ -+ host->use_busy = 0; -+ if (!(cmd->flags & MMC_RSP_PRESENT)) { -+ sdcmd |= SDCMD_NO_RESPONSE; -+ } else { -+ if (cmd->flags & MMC_RSP_136) -+ sdcmd |= SDCMD_LONG_RESPONSE; -+ if (cmd->flags & MMC_RSP_BUSY) { -+ sdcmd |= SDCMD_BUSYWAIT; -+ host->use_busy = 1; -+ } -+ } -+ -+ if (cmd->data) { -+ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); -+ if (host->delay_after_this_stop) { -+ struct timeval now; -+ int time_since_stop; -+ do_gettimeofday(&now); -+ time_since_stop = (now.tv_sec - host->stop_time.tv_sec); -+ if (time_since_stop < 2) { -+ /* Possibly less than one second */ -+ time_since_stop = time_since_stop * 1000000 + -+ (now.tv_usec - host->stop_time.tv_usec); -+ if (time_since_stop < -+ host->delay_after_this_stop) -+ udelay(host->delay_after_this_stop - -+ time_since_stop); -+ } -+ } -+ -+ host->delay_after_this_stop = host->delay_after_stop; -+ if ((cmd->data->flags & MMC_DATA_READ) && !host->use_sbc) { -+ /* See if read crosses one of the hazardous sectors */ -+ u32 first_blk, last_blk; -+ -+ /* Intentionally include the following sector because -+ without CMD23/SBC the read may run on. */ -+ first_blk = host->mrq->cmd->arg; -+ last_blk = first_blk + cmd->data->blocks; -+ -+ if (((last_blk >= (host->sectors - 64)) && -+ (first_blk <= (host->sectors - 64))) || -+ ((last_blk >= (host->sectors - 32)) && -+ (first_blk <= (host->sectors - 32)))) { -+ host->delay_after_this_stop = -+ max(250u, host->delay_after_stop); -+ } -+ } -+ -+ if (cmd->data->flags & MMC_DATA_WRITE) -+ sdcmd |= SDCMD_WRITE_CMD; -+ if (cmd->data->flags & MMC_DATA_READ) -+ sdcmd |= SDCMD_READ_CMD; -+ } -+ -+ bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); -+ -+ return true; -+} -+ -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags); -+static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); -+ -+static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) -+{ -+ struct mmc_data *data; -+ -+ data = host->data; -+ BUG_ON(!data); -+ -+ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); -+ pr_debug("finish_data(error %d, stop %d, sbc %d)\n", -+ data->error, data->stop ? 1 : 0, -+ host->mrq->sbc ? 1 : 0); -+ -+ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ -+ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); -+ -+ host->data_complete = 1; -+ -+ if (host->cmd) { -+ /* -+ * Data managed to finish before the -+ * command completed. Make sure we do -+ * things in the proper order. -+ */ -+ pr_debug("Finished early - HSTS %x\n", -+ bcm2835_sdhost_read(host, SDHSTS)); -+ } -+ else -+ bcm2835_sdhost_transfer_complete(host); -+ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); -+} -+ -+static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) -+{ -+ struct mmc_data *data; -+ -+ BUG_ON(host->cmd); -+ BUG_ON(!host->data); -+ BUG_ON(!host->data_complete); -+ -+ data = host->data; -+ host->data = NULL; -+ -+ log_event("TCM<", (u32)data, data->error); -+ pr_debug("transfer_complete(error %d, stop %d)\n", -+ data->error, data->stop ? 1 : 0); -+ -+ /* -+ * Need to send CMD12 if - -+ * a) open-ended multiblock transfer (no CMD23) -+ * b) error in multiblock transfer -+ */ -+ if (host->mrq->stop && (data->error || !host->use_sbc)) { -+ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { -+ /* No busy, so poll for completion */ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); -+ -+ if (host->delay_after_this_stop) -+ do_gettimeofday(&host->stop_time); -+ } -+ } else { -+ bcm2835_sdhost_wait_transfer_complete(host); -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ log_event("TCM>", (u32)data, 0); -+} -+ -+/* If irq_flags is valid, the caller is in a thread context and is allowed -+ to sleep */ -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags) -+{ -+ u32 sdcmd; -+ u32 retries; -+#ifdef DEBUG -+ struct timeval before, after; -+ int timediff = 0; -+#endif -+ -+ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); -+ pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); -+ -+ BUG_ON(!host->cmd || !host->mrq); -+ -+ /* Poll quickly at first */ -+ -+ retries = host->cmd_quick_poll_retries; -+ if (!retries) { -+ /* Work out how many polls take 1us by timing 10us */ -+ struct timeval start, now; -+ int us_diff; -+ -+ retries = 1; -+ do { -+ int i; -+ -+ retries *= 2; -+ -+ do_gettimeofday(&start); -+ -+ for (i = 0; i < retries; i++) { -+ cpu_relax(); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ } -+ -+ do_gettimeofday(&now); -+ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + -+ (now.tv_usec - start.tv_usec); -+ } while (us_diff < 10); -+ -+ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; -+ retries = 1; // We've already waited long enough this time -+ } -+ -+ for (sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ (sdcmd & SDCMD_NEW_FLAG) && retries; -+ retries--) { -+ cpu_relax(); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ } -+ -+ if (!retries) { -+ unsigned long wait_max; -+ -+ if (!irq_flags) { -+ /* Schedule the work */ -+ log_event("CWWQ", 0, 0); -+ schedule_work(&host->cmd_wait_wq); -+ return; -+ } -+ -+ /* Wait max 100 ms */ -+ wait_max = jiffies + msecs_to_jiffies(100); -+ while (time_before(jiffies, wait_max)) { -+ spin_unlock_irqrestore(&host->lock, *irq_flags); -+ usleep_range(1, 10); -+ spin_lock_irqsave(&host->lock, *irq_flags); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ if (!(sdcmd & SDCMD_NEW_FLAG)) -+ break; -+ } -+ } -+ -+ /* Check for errors */ -+ if (sdcmd & SDCMD_NEW_FLAG) { -+ if (host->debug) { -+ pr_err("%s: command %d never completed.\n", -+ mmc_hostname(host->mmc), host->cmd->opcode); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ host->cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } else if (sdcmd & SDCMD_FAIL_FLAG) { -+ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ -+ /* Clear the errors */ -+ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); -+ -+ if (host->debug) -+ pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", -+ mmc_hostname(host->mmc), sdcmd, sdhsts, -+ bcm2835_sdhost_read(host, SDEDM)); -+ -+ if ((sdhsts & SDHSTS_CRC7_ERROR) && -+ (host->cmd->opcode == 1)) { -+ if (host->debug) -+ pr_info("%s: ignoring CRC7 error for CMD1\n", -+ mmc_hostname(host->mmc)); -+ } else { -+ if (sdhsts & SDHSTS_CMD_TIME_OUT) { -+ if (host->debug) -+ pr_warn("%s: command %d timeout\n", -+ mmc_hostname(host->mmc), -+ host->cmd->opcode); -+ host->cmd->error = -ETIMEDOUT; -+ } else { -+ pr_warn("%s: unexpected command %d error\n", -+ mmc_hostname(host->mmc), -+ host->cmd->opcode); -+ host->cmd->error = -EILSEQ; -+ } -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ } -+ -+ if (host->cmd->flags & MMC_RSP_PRESENT) { -+ if (host->cmd->flags & MMC_RSP_136) { -+ int i; -+ for (i = 0; i < 4; i++) -+ host->cmd->resp[3 - i] = bcm2835_sdhost_read(host, SDRSP0 + i*4); -+ pr_debug("%s: finish_command %08x %08x %08x %08x\n", -+ mmc_hostname(host->mmc), -+ host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); -+ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); -+ } else { -+ host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); -+ pr_debug("%s: finish_command %08x\n", -+ mmc_hostname(host->mmc), -+ host->cmd->resp[0]); -+ log_event("RSP ", host->cmd->resp[0], 0); -+ } -+ } -+ -+ if (host->cmd == host->mrq->sbc) { -+ /* Finished CMD23, now send actual command. */ -+ host->cmd = NULL; -+ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); -+ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); -+ } -+ } else if (host->cmd == host->mrq->stop) { -+ /* Finished CMD12 */ -+ tasklet_schedule(&host->finish_tasklet); -+ } else { -+ /* Processed actual command. */ -+ host->cmd = NULL; -+ if (!host->data) -+ tasklet_schedule(&host->finish_tasklet); -+ else if (host->data_complete) -+ bcm2835_sdhost_transfer_complete(host); -+ } -+ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); -+} -+ -+static void bcm2835_sdhost_timeout(unsigned long data) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = (struct bcm2835_host *)data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ log_event("TIM<", 0, 0); -+ -+ if (host->mrq) { -+ pr_err("%s: timeout waiting for hardware interrupt.\n", -+ mmc_hostname(host->mmc)); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ -+ if (host->data) { -+ host->data->error = -ETIMEDOUT; -+ bcm2835_sdhost_finish_data(host); -+ } else { -+ if (host->cmd) -+ host->cmd->error = -ETIMEDOUT; -+ else -+ host->mrq->cmd->error = -ETIMEDOUT; -+ -+ pr_debug("timeout_timer tasklet_schedule\n"); -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ } -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ log_event("IRQB", (u32)host->cmd, intmask); -+ if (!host->cmd) { -+ pr_err("%s: got command busy interrupt 0x%08x even " -+ "though no command operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_sdhost_dumpregs(host); -+ return; -+ } -+ -+ if (!host->use_busy) { -+ pr_err("%s: got command busy interrupt 0x%08x even " -+ "though not expecting one.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_sdhost_dumpregs(host); -+ return; -+ } -+ host->use_busy = 0; -+ -+ if (intmask & SDHSTS_ERROR_MASK) -+ { -+ pr_err("sdhost_busy_irq: intmask %x, data %p\n", intmask, host->mrq->data); -+ if (intmask & SDHSTS_CRC7_ERROR) -+ host->cmd->error = -EILSEQ; -+ else if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR)) { -+ if (host->mrq->data) -+ host->mrq->data->error = -EILSEQ; -+ else -+ host->cmd->error = -EILSEQ; -+ } else if (intmask & SDHSTS_REW_TIME_OUT) { -+ if (host->mrq->data) -+ host->mrq->data->error = -ETIMEDOUT; -+ else -+ host->cmd->error = -ETIMEDOUT; -+ } else if (intmask & SDHSTS_CMD_TIME_OUT) -+ host->cmd->error = -ETIMEDOUT; -+ -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ } -+ else -+ bcm2835_sdhost_finish_command(host, NULL); -+} -+ -+static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ /* There are no dedicated data/space available interrupt -+ status bits, so it is necessary to use the single shared -+ data/space available FIFO status bits. It is therefore not -+ an error to get here when there is no data transfer in -+ progress. */ -+ log_event("IRQD", (u32)host->data, intmask); -+ if (!host->data) -+ return; -+ -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR | -+ SDHSTS_REW_TIME_OUT)) { -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR)) -+ host->data->error = -EILSEQ; -+ else -+ host->data->error = -ETIMEDOUT; -+ -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ } -+ -+ if (host->data->error) { -+ bcm2835_sdhost_finish_data(host); -+ } else if (host->data->flags & MMC_DATA_WRITE) { -+ /* Use the block interrupt for writes after the first block */ -+ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); -+ host->hcfg |= SDHCFG_BLOCK_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_transfer_pio(host); -+ } else { -+ bcm2835_sdhost_transfer_pio(host); -+ host->blocks--; -+ if ((host->blocks == 0) || host->data->error) -+ bcm2835_sdhost_finish_data(host); -+ } -+} -+ -+static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ log_event("IRQK", (u32)host->data, intmask); -+ if (!host->data) { -+ pr_err("%s: got block interrupt 0x%08x even " -+ "though no data operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_sdhost_dumpregs(host); -+ return; -+ } -+ -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR | -+ SDHSTS_REW_TIME_OUT)) { -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR)) -+ host->data->error = -EILSEQ; -+ else -+ host->data->error = -ETIMEDOUT; -+ -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ } -+ -+ if (!host->dma_desc) { -+ BUG_ON(!host->blocks); -+ if (host->data->error || (--host->blocks == 0)) { -+ bcm2835_sdhost_finish_data(host); -+ } else { -+ bcm2835_sdhost_transfer_pio(host); -+ } -+ } else if (host->data->flags & MMC_DATA_WRITE) { -+ bcm2835_sdhost_finish_data(host); -+ } -+} -+ -+static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) -+{ -+ irqreturn_t result = IRQ_NONE; -+ struct bcm2835_host *host = dev_id; -+ u32 intmask; -+ -+ spin_lock(&host->lock); -+ -+ intmask = bcm2835_sdhost_read(host, SDHSTS); -+ log_event("IRQ<", intmask, 0); -+ -+ bcm2835_sdhost_write(host, -+ SDHSTS_BUSY_IRPT | -+ SDHSTS_BLOCK_IRPT | -+ SDHSTS_SDIO_IRPT | -+ SDHSTS_DATA_FLAG, -+ SDHSTS); -+ -+ if (intmask & SDHSTS_BLOCK_IRPT) { -+ bcm2835_sdhost_block_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } -+ -+ if (intmask & SDHSTS_BUSY_IRPT) { -+ bcm2835_sdhost_busy_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } -+ -+ /* There is no true data interrupt status bit, so it is -+ necessary to qualify the data flag with the interrupt -+ enable bit */ -+ if ((intmask & SDHSTS_DATA_FLAG) && -+ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { -+ bcm2835_sdhost_data_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } -+ -+ mmiowb(); -+ -+ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); -+ spin_unlock(&host->lock); -+ -+ return result; -+} -+ -+void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) -+{ -+ int div = 0; /* Initialized for compiler warning */ -+ unsigned int input_clock = clock; -+ unsigned long flags; -+ -+ if (host->debug) -+ pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); -+ -+ if ((host->overclock_50 > 50) && -+ (clock == 50*MHZ)) -+ clock = host->overclock_50 * MHZ + (MHZ - 1); -+ -+ /* The SDCDIV register has 11 bits, and holds (div - 2). -+ But in data mode the max is 50MHz wihout a minimum, and only the -+ bottom 3 bits are used. Since the switch over is automatic (unless -+ we have marked the card as slow...), chosen values have to make -+ sense in both modes. -+ Ident mode must be 100-400KHz, so can range check the requested -+ clock. CMD15 must be used to return to data mode, so this can be -+ monitored. -+ -+ clock 250MHz -> 0->125MHz, 1->83.3MHz, 2->62.5MHz, 3->50.0MHz -+ 4->41.7MHz, 5->35.7MHz, 6->31.3MHz, 7->27.8MHz -+ -+ 623->400KHz/27.8MHz -+ reset value (507)->491159/50MHz -+ -+ BUT, the 3-bit clock divisor in data mode is too small if the -+ core clock is higher than 250MHz, so instead use the SLOW_CARD -+ configuration bit to force the use of the ident clock divisor -+ at all times. -+ */ -+ -+ host->mmc->actual_clock = 0; -+ -+ if (host->firmware_sets_cdiv) { -+ u32 msg[3] = { clock, 0, 0 }; -+ -+ rpi_firmware_property(rpi_firmware_get(NULL), -+ RPI_FIRMWARE_SET_SDHOST_CLOCK, -+ &msg, sizeof(msg)); -+ -+ clock = max(msg[1], msg[2]); -+ spin_lock_irqsave(&host->lock, flags); -+ } else { -+ spin_lock_irqsave(&host->lock, flags); -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as -+ * possible to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ div = host->max_clk / clock; -+ if (div < 2) -+ div = 2; -+ if ((host->max_clk / div) > clock) -+ div++; -+ div -= 2; -+ -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; -+ -+ clock = host->max_clk / (div + 2); -+ -+ host->cdiv = div; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ -+ if (host->debug) -+ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x " -+ "(actual clock %d)\n", -+ mmc_hostname(host->mmc), input_clock, -+ host->max_clk, host->cdiv, -+ clock); -+ } -+ -+ /* Calibrate some delays */ -+ -+ host->ns_per_fifo_word = (1000000000/clock) * -+ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); -+ -+ if (input_clock == 50 * MHZ) { -+ if (clock > input_clock) { -+ /* Save the closest value, to make it easier -+ to reduce in the event of error */ -+ host->overclock_50 = (clock/MHZ); -+ -+ if (clock != host->overclock) { -+ pr_info("%s: overclocking to %dHz\n", -+ mmc_hostname(host->mmc), clock); -+ host->overclock = clock; -+ } -+ } else if (host->overclock) { -+ host->overclock = 0; -+ if (clock == 50 * MHZ) -+ pr_warn("%s: cancelling overclock\n", -+ mmc_hostname(host->mmc)); -+ } -+ } else if (input_clock == 0) { -+ /* Reset the preferred overclock when the clock is stopped. -+ * This always happens during initialisation. */ -+ host->overclock_50 = host->user_overclock_50; -+ host->overclock = 0; -+ } -+ -+ /* Set the timeout to 500ms */ -+ bcm2835_sdhost_write(host, clock/2, SDTOUT); -+ -+ host->mmc->actual_clock = clock; -+ host->clock = input_clock; -+ host->reset_clock = 0; -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ u32 edm, fsm; -+ -+ host = mmc_priv(mmc); -+ -+ if (host->debug) { -+ struct mmc_command *cmd = mrq->cmd; -+ BUG_ON(!cmd); -+ if (cmd->data) -+ pr_info("%s: cmd %d 0x%x (flags 0x%x) - %s %d*%d\n", -+ mmc_hostname(mmc), -+ cmd->opcode, cmd->arg, cmd->flags, -+ (cmd->data->flags & MMC_DATA_READ) ? -+ "read" : "write", cmd->data->blocks, -+ cmd->data->blksz); -+ else -+ pr_info("%s: cmd %d 0x%x (flags 0x%x)\n", -+ mmc_hostname(mmc), -+ cmd->opcode, cmd->arg, cmd->flags); -+ } -+ -+ /* Reset the error statuses in case this is a retry */ -+ if (mrq->sbc) -+ mrq->sbc->error = 0; -+ if (mrq->cmd) -+ mrq->cmd->error = 0; -+ if (mrq->data) -+ mrq->data->error = 0; -+ if (mrq->stop) -+ mrq->stop->error = 0; -+ -+ if (mrq->data && !is_power_of_2(mrq->data->blksz)) { -+ pr_err("%s: unsupported block size (%d bytes)\n", -+ mmc_hostname(mmc), mrq->data->blksz); -+ mrq->cmd->error = -EINVAL; -+ mmc_request_done(mmc, mrq); -+ return; -+ } -+ -+ if (host->use_dma && mrq->data && -+ (mrq->data->blocks > host->pio_limit)) -+ bcm2835_sdhost_prepare_dma(host, mrq->data); -+ -+ if (host->reset_clock) -+ bcm2835_sdhost_set_clock(host, host->clock); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ WARN_ON(host->mrq != NULL); -+ host->mrq = mrq; -+ -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ fsm = edm & SDEDM_FSM_MASK; -+ -+ log_event("REQ<", (u32)mrq, edm); -+ if ((fsm != SDEDM_FSM_IDENTMODE) && -+ (fsm != SDEDM_FSM_DATAMODE)) { -+ log_event("REQ!", (u32)mrq, edm); -+ if (host->debug) { -+ pr_warn("%s: previous command (%d) not complete (EDM %x)\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, -+ edm); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ mrq->cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ host->use_sbc = !!mrq->sbc && -+ (host->mrq->data->flags & USE_CMD23_FLAGS); -+ if (host->use_sbc) { -+ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } -+ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); -+ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } -+ -+ log_event("CMD ", (u32)mrq->cmd->opcode, -+ mrq->data ? (u32)mrq->data->blksz : 0); -+ mmiowb(); -+ -+ log_event("REQ>", (u32)mrq, 0); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) -+{ -+ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ -+ if (host->debug) -+ pr_info("%s: ios clock %d, pwr %d, bus_width %d, " -+ "timing %d, vdd %d, drv_type %d\n", -+ mmc_hostname(mmc), -+ ios->clock, ios->power_mode, ios->bus_width, -+ ios->timing, ios->signal_voltage, ios->drv_type); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ log_event("IOS<", ios->clock, 0); -+ -+ /* set bus width */ -+ host->hcfg &= ~SDHCFG_WIDE_EXT_BUS; -+ if (ios->bus_width == MMC_BUS_WIDTH_4) -+ host->hcfg |= SDHCFG_WIDE_EXT_BUS; -+ -+ host->hcfg |= SDHCFG_WIDE_INT_BUS; -+ -+ /* Disable clever clock switching, to cope with fast core clocks */ -+ host->hcfg |= SDHCFG_SLOW_CARD; -+ -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ -+ mmiowb(); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (!ios->clock || ios->clock != host->clock) -+ bcm2835_sdhost_set_clock(host, ios->clock); -+} -+ -+static struct mmc_host_ops bcm2835_sdhost_ops = { -+ .request = bcm2835_sdhost_request, -+ .set_ios = bcm2835_sdhost_set_ios, -+ .hw_reset = bcm2835_sdhost_reset, -+}; -+ -+static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = container_of(work, struct bcm2835_host, cmd_wait_wq); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); -+ -+ /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. -+ */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ bcm2835_sdhost_finish_command(host, &flags); -+ -+ mmiowb(); -+ -+ log_event("CWK>", (u32)host->cmd, 0); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_tasklet_finish(unsigned long param) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ struct mmc_request *mrq; -+ struct dma_chan *terminate_chan = NULL; -+ -+ host = (struct bcm2835_host *)param; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ log_event("TSK<", (u32)host->mrq, 0); -+ /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. -+ */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ del_timer(&host->timer); -+ -+ mrq = host->mrq; -+ -+ /* Drop the overclock after any data corruption, or after any -+ * error while overclocked. Ignore errors for status commands, -+ * as they are likely when a card is ejected. */ -+ if (host->overclock) { -+ if ((mrq->cmd && mrq->cmd->error && -+ (mrq->cmd->opcode != MMC_SEND_STATUS)) || -+ (mrq->data && mrq->data->error) || -+ (mrq->stop && mrq->stop->error) || -+ (mrq->sbc && mrq->sbc->error)) { -+ host->overclock_50--; -+ pr_warn("%s: reducing overclock due to errors\n", -+ mmc_hostname(host->mmc)); -+ host->reset_clock = 1; -+ mrq->cmd->error = -ETIMEDOUT; -+ mrq->cmd->retries = 1; -+ } -+ } -+ -+ host->mrq = NULL; -+ host->cmd = NULL; -+ host->data = NULL; -+ -+ mmiowb(); -+ -+ host->dma_desc = NULL; -+ terminate_chan = host->dma_chan; -+ host->dma_chan = NULL; -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (terminate_chan) -+ { -+ int err = dmaengine_terminate_all(terminate_chan); -+ if (err) -+ pr_err("%s: failed to terminate DMA (%d)\n", -+ mmc_hostname(host->mmc), err); -+ } -+ -+ /* The SDHOST block doesn't report any errors for a disconnected -+ interface. All cards and SDIO devices should report some supported -+ voltage range, so a zero response to SEND_OP_COND, IO_SEND_OP_COND -+ or APP_SEND_OP_COND can be treated as an error. */ -+ if (((mrq->cmd->opcode == MMC_SEND_OP_COND) || -+ (mrq->cmd->opcode == SD_IO_SEND_OP_COND) || -+ (mrq->cmd->opcode == SD_APP_OP_COND)) && -+ (mrq->cmd->error == 0) && -+ (mrq->cmd->resp[0] == 0)) { -+ mrq->cmd->error = -ETIMEDOUT; -+ if (host->debug) -+ pr_info("%s: faking timeout due to zero OCR\n", -+ mmc_hostname(host->mmc)); -+ } -+ -+ mmc_request_done(host->mmc, mrq); -+ log_event("TSK>", (u32)mrq, 0); -+} -+ -+int bcm2835_sdhost_add_host(struct bcm2835_host *host) -+{ -+ struct mmc_host *mmc; -+ struct dma_slave_config cfg; -+ char pio_limit_string[20]; -+ int ret; -+ -+ mmc = host->mmc; -+ -+ mmc->f_max = host->max_clk; -+ mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; -+ -+ mmc->max_busy_timeout = (~(unsigned int)0)/(mmc->f_max/1000); -+ -+ pr_debug("f_max %d, f_min %d, max_busy_timeout %d\n", -+ mmc->f_max, mmc->f_min, mmc->max_busy_timeout); -+ -+ /* host controller capabilities */ -+ mmc->caps |= -+ MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | -+ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | -+ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); -+ -+ spin_lock_init(&host->lock); -+ -+ if (host->allow_dma) { -+ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { -+ pr_err("%s: unable to initialise DMA channel. " -+ "Falling back to PIO\n", -+ mmc_hostname(mmc)); -+ host->use_dma = false; -+ } else { -+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.slave_id = 13; /* DREQ channel */ -+ -+ /* Validate the slave configurations */ -+ -+ cfg.direction = DMA_MEM_TO_DEV; -+ cfg.src_addr = 0; -+ cfg.dst_addr = host->bus_addr + SDDATA; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ -+ if (ret == 0) { -+ host->dma_cfg_tx = cfg; -+ -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDDATA; -+ cfg.dst_addr = 0; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ } -+ -+ if (ret == 0) { -+ host->dma_cfg_rx = cfg; -+ -+ host->use_dma = true; -+ } else { -+ pr_err("%s: unable to configure DMA channel. " -+ "Falling back to PIO\n", -+ mmc_hostname(mmc)); -+ dma_release_channel(host->dma_chan_rxtx); -+ host->dma_chan_rxtx = NULL; -+ host->use_dma = false; -+ } -+ } -+ } else { -+ host->use_dma = false; -+ } -+ -+ mmc->max_segs = 128; -+ mmc->max_req_size = 524288; -+ mmc->max_seg_size = mmc->max_req_size; -+ mmc->max_blk_size = 512; -+ mmc->max_blk_count = 65535; -+ -+ /* report supported voltage ranges */ -+ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; -+ -+ tasklet_init(&host->finish_tasklet, -+ bcm2835_sdhost_tasklet_finish, (unsigned long)host); -+ -+ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); -+ -+ setup_timer(&host->timer, bcm2835_sdhost_timeout, -+ (unsigned long)host); -+ -+ bcm2835_sdhost_init(host, 0); -+ -+ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, -+ mmc_hostname(mmc), host); -+ if (ret) { -+ pr_err("%s: failed to request IRQ %d: %d\n", -+ mmc_hostname(mmc), host->irq, ret); -+ goto untasklet; -+ } -+ -+ mmiowb(); -+ mmc_add_host(mmc); -+ -+ pio_limit_string[0] = '\0'; -+ if (host->use_dma && (host->pio_limit > 0)) -+ sprintf(pio_limit_string, " (>%d)", host->pio_limit); -+ pr_info("%s: %s loaded - DMA %s%s\n", -+ mmc_hostname(mmc), DRIVER_NAME, -+ host->use_dma ? "enabled" : "disabled", -+ pio_limit_string); -+ -+ return 0; -+ -+untasklet: -+ tasklet_kill(&host->finish_tasklet); -+ -+ return ret; -+} -+ -+static int bcm2835_sdhost_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node; -+ struct clk *clk; -+ struct resource *iomem; -+ struct bcm2835_host *host; -+ struct mmc_host *mmc; -+ const __be32 *addr; -+ u32 msg[3]; -+ int ret; -+ -+ pr_debug("bcm2835_sdhost_probe\n"); -+ mmc = mmc_alloc_host(sizeof(*host), dev); -+ if (!mmc) -+ return -ENOMEM; -+ -+ mmc->ops = &bcm2835_sdhost_ops; -+ host = mmc_priv(mmc); -+ host->mmc = mmc; -+ host->pio_timeout = msecs_to_jiffies(500); -+ host->pio_limit = 1; -+ host->max_delay = 1; /* Warn if over 1ms */ -+ host->allow_dma = 1; -+ spin_lock_init(&host->lock); -+ -+ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ host->ioaddr = devm_ioremap_resource(dev, iomem); -+ if (IS_ERR(host->ioaddr)) { -+ ret = PTR_ERR(host->ioaddr); -+ goto err; -+ } -+ -+ addr = of_get_address(node, 0, NULL, NULL); -+ if (!addr) { -+ dev_err(dev, "could not get DMA-register address\n"); -+ return -ENODEV; -+ } -+ host->bus_addr = be32_to_cpup(addr); -+ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", -+ (unsigned long)host->ioaddr, -+ (unsigned long)iomem->start, -+ (unsigned long)host->bus_addr); -+ -+ if (node) { -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,delay-after-stop", -+ &host->delay_after_stop); -+ of_property_read_u32(node, -+ "brcm,overclock-50", -+ &host->user_overclock_50); -+ of_property_read_u32(node, -+ "brcm,pio-limit", -+ &host->pio_limit); -+ host->allow_dma = -+ !of_property_read_bool(node, "brcm,force-pio"); -+ host->debug = of_property_read_bool(node, "brcm,debug"); -+ } -+ -+ host->dma_chan = NULL; -+ host->dma_desc = NULL; -+ -+ /* Formally recognise the other way of disabling DMA */ -+ if (host->pio_limit == 0x7fffffff) -+ host->allow_dma = false; -+ -+ if (host->allow_dma) { -+ if (node) { -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "rx-tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "rx"); -+ } else { -+ dma_cap_mask_t mask; -+ -+ dma_cap_zero(mask); -+ /* we don't care about the channel, any would work */ -+ dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_rxtx = -+ dma_request_channel(mask, NULL, NULL); -+ } -+ } -+ -+ clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(clk)) { -+ ret = PTR_ERR(clk); -+ if (ret == -EPROBE_DEFER) -+ dev_info(dev, "could not get clk, deferring probe\n"); -+ else -+ dev_err(dev, "could not get clk\n"); -+ goto err; -+ } -+ -+ host->max_clk = clk_get_rate(clk); -+ -+ host->irq = platform_get_irq(pdev, 0); -+ if (host->irq <= 0) { -+ dev_err(dev, "get IRQ failed\n"); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ pr_debug(" - max_clk %lx, irq %d\n", -+ (unsigned long)host->max_clk, -+ (int)host->irq); -+ -+ log_init(dev, iomem->start - host->bus_addr); -+ -+ if (node) -+ mmc_of_parse(mmc); -+ else -+ mmc->caps |= MMC_CAP_4_BIT_DATA; -+ -+ msg[0] = 0; -+ msg[1] = ~0; -+ msg[2] = ~0; -+ -+ rpi_firmware_property(rpi_firmware_get(NULL), -+ RPI_FIRMWARE_SET_SDHOST_CLOCK, -+ &msg, sizeof(msg)); -+ -+ host->firmware_sets_cdiv = (msg[1] != ~0); -+ -+ ret = bcm2835_sdhost_add_host(host); -+ if (ret) -+ goto err; -+ -+ platform_set_drvdata(pdev, host); -+ -+ pr_debug("bcm2835_sdhost_probe -> OK\n"); -+ -+ return 0; -+ -+err: -+ pr_debug("bcm2835_sdhost_probe -> err %d\n", ret); -+ mmc_free_host(mmc); -+ -+ return ret; -+} -+ -+static int bcm2835_sdhost_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_host *host = platform_get_drvdata(pdev); -+ -+ pr_debug("bcm2835_sdhost_remove\n"); -+ -+ mmc_remove_host(host->mmc); -+ -+ bcm2835_sdhost_set_power(host, false); -+ -+ free_irq(host->irq, host); -+ -+ del_timer_sync(&host->timer); -+ -+ tasklet_kill(&host->finish_tasklet); -+ -+ mmc_free_host(host->mmc); -+ platform_set_drvdata(pdev, NULL); -+ -+ pr_debug("bcm2835_sdhost_remove - OK\n"); -+ return 0; -+} -+ -+static const struct of_device_id bcm2835_sdhost_match[] = { -+ { .compatible = "brcm,bcm2835-sdhost" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); -+ -+static struct platform_driver bcm2835_sdhost_driver = { -+ .probe = bcm2835_sdhost_probe, -+ .remove = bcm2835_sdhost_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_sdhost_match, -+ }, -+}; -+module_platform_driver(bcm2835_sdhost_driver); -+ -+MODULE_ALIAS("platform:sdhost-bcm2835"); -+MODULE_DESCRIPTION("BCM2835 SDHost driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Phil Elwell"); - -From 0eda1e885a24ef523c6f88b4f62dc928c47f00c6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 11 May 2016 12:50:33 +0100 -Subject: [PATCH 036/122] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards - -Some SD cards have been found that corrupt data when small blocks -are erased. Add a quirk to indicate that ERASE should not be used, -and set it for cards of that type. - -Signed-off-by: Phil Elwell - -mmc: Apply QUIRK_BROKEN_ERASE to other capacities - -Signed-off-by: Phil Elwell - -mmc: Add card_quirks module parameter, log quirks - -Use mmc_block.card_quirks to override the quirks for all SD or MMC -cards. The value is a bitfield using the bit positions defined in -include/linux/mmc/card.h. If the module parameter is placed in the -kernel command line (or bootargs) stored on the card then, assuming the -device only has one SD card interface, the override effectively becomes -card-specific. - -Signed-off-by: Phil Elwell ---- - drivers/mmc/card/block.c | 39 ++++++++++++++++++++++++++++++++++++--- - drivers/mmc/core/core.c | 3 ++- - include/linux/mmc/card.h | 3 +++ - 3 files changed, 41 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 709a872ed484a9da1ce620238c3222190c612f86..894c105be9ce7f83147a62c433c787b90a5e7c17 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -135,6 +135,13 @@ enum { - module_param(perdev_minors, int, 0444); - MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); - -+/* -+ * Allow quirks to be overridden for the current card -+ */ -+static char *card_quirks; -+module_param(card_quirks, charp, 0644); -+MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); -+ - static inline int mmc_blk_part_switch(struct mmc_card *card, - struct mmc_blk_data *md); - static int get_card_status(struct mmc_card *card, u32 *status, int retries); -@@ -2573,6 +2580,17 @@ static const struct mmc_fixup blk_fixups[] = - MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, - MMC_QUIRK_TRIM_BROKEN), - -+ /* -+ * On some Kingston SD cards, multiple erases of less than 64 -+ * sectors can cause corruption. -+ */ -+ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ - END_FIXUP - }; - -@@ -2580,6 +2598,7 @@ static int mmc_blk_probe(struct mmc_card *card) - { - struct mmc_blk_data *md, *part_md; - char cap_str[10]; -+ char quirk_str[24]; - - /* - * Check that the card supports the command class(es) we need. -@@ -2587,7 +2606,16 @@ static int mmc_blk_probe(struct mmc_card *card) - if (!(card->csd.cmdclass & CCC_BLOCK_READ)) - return -ENODEV; - -- mmc_fixup_device(card, blk_fixups); -+ if (card_quirks) { -+ unsigned long quirks; -+ if (kstrtoul(card_quirks, 0, &quirks) == 0) -+ card->quirks = (unsigned int)quirks; -+ else -+ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", -+ card_quirks); -+ } -+ else -+ mmc_fixup_device(card, blk_fixups); - - md = mmc_blk_alloc(card); - if (IS_ERR(md)) -@@ -2595,9 +2623,14 @@ static int mmc_blk_probe(struct mmc_card *card) - - string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, - cap_str, sizeof(cap_str)); -- pr_info("%s: %s %s %s %s\n", -+ if (card->quirks) -+ snprintf(quirk_str, sizeof(quirk_str), -+ " (quirks 0x%08x)", card->quirks); -+ else -+ quirk_str[0] = '\0'; -+ pr_info("%s: %s %s %s%s%s\n", - md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), -- cap_str, md->read_only ? "(ro)" : ""); -+ cap_str, md->read_only ? " (ro)" : "", quirk_str); - - if (mmc_blk_alloc_parts(card, md)) - goto out; -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index 2553d903a82b9eaa8577c1269bc9f63e18b00085..59a4044ea4c2e1283b1cad8afc7e67efaf8653fb 100644 ---- a/drivers/mmc/core/core.c -+++ b/drivers/mmc/core/core.c -@@ -2409,7 +2409,8 @@ EXPORT_SYMBOL(mmc_erase); - int mmc_can_erase(struct mmc_card *card) - { - if ((card->host->caps & MMC_CAP_ERASE) && -- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) -+ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && -+ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) - return 1; - return 0; - } -diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h -index 73fad83acbcb6a157587180516f9ffe7c61eb7d7..e7c9d3098ac06e3c6554fa3373a311f937cd6f96 100644 ---- a/include/linux/mmc/card.h -+++ b/include/linux/mmc/card.h -@@ -283,6 +283,9 @@ struct mmc_card { - #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ - - -+#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ -+ -+ - unsigned int erase_size; /* erase size in sectors */ - unsigned int erase_shift; /* if erase unit is power 2 */ - unsigned int pref_erase; /* in sectors */ - -From ebd7f1f66e66573d57edc087910e4f34f71a52d9 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 037/122] cma: Add vc_cma driver to enable use of CMA -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -vc_cma: Make the vc_cma area the default contiguous DMA area - -vc_cma: Provide empty functions when module is not built - -Providing empty functions saves the users from guarding the -function call with an #if clause. -Move __init markings from prototypes to functions. - -Signed-off-by: Noralf Trønnes ---- - drivers/char/Kconfig | 2 + - drivers/char/Makefile | 1 + - drivers/char/broadcom/Kconfig | 15 + - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vc_cma/Makefile | 7 + - drivers/char/broadcom/vc_cma/vc_cma.c | 1193 +++++++++++++++++++++++++++++++++ - include/linux/broadcom/vc_cma.h | 36 + - 7 files changed, 1255 insertions(+) - create mode 100644 drivers/char/broadcom/Kconfig - create mode 100644 drivers/char/broadcom/Makefile - create mode 100644 drivers/char/broadcom/vc_cma/Makefile - create mode 100644 drivers/char/broadcom/vc_cma/vc_cma.c - create mode 100644 include/linux/broadcom/vc_cma.h - -diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index dcc09739a54ef860343ac2fca5acf59724ca60e2..6d518c7635ae128f4554945dd3ffd351f9d325bf 100644 ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -4,6 +4,8 @@ - - menu "Character devices" - -+source "drivers/char/broadcom/Kconfig" -+ - source "drivers/tty/Kconfig" - - config DEVMEM -diff --git a/drivers/char/Makefile b/drivers/char/Makefile -index 6e6c244a66a02c4efd57229b0f31d331377bbc55..67c40b8f2ff25f423cb74b64de9afa6f32479aed 100644 ---- a/drivers/char/Makefile -+++ b/drivers/char/Makefile -@@ -60,3 +60,4 @@ js-rtc-y = rtc.o - obj-$(CONFIG_TILE_SROM) += tile-srom.o - obj-$(CONFIG_XILLYBUS) += xillybus/ - obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o -+obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/ -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..2d8bd6e5016aab7340636c1f5dc4dd0cbacae6c0 ---- /dev/null -+++ b/drivers/char/broadcom/Kconfig -@@ -0,0 +1,15 @@ -+# -+# Broadcom char driver config -+# -+ -+menuconfig BRCM_CHAR_DRIVERS -+ bool "Broadcom Char Drivers" -+ help -+ Broadcom's char drivers -+ -+config BCM_VC_CMA -+ bool "Videocore CMA" -+ depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ -+ default n -+ help -+ Helper for videocore CMA access. -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..13c5bca291ccc0df090c4e61169ace8f18ba60fe ---- /dev/null -+++ b/drivers/char/broadcom/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ -diff --git a/drivers/char/broadcom/vc_cma/Makefile b/drivers/char/broadcom/vc_cma/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..d222313e28995bb54e9448192f5c99a352dde2e8 ---- /dev/null -+++ b/drivers/char/broadcom/vc_cma/Makefile -@@ -0,0 +1,7 @@ -+ccflags-$(CONFIG_BCM_VC_CMA) += -Wall -Wstrict-prototypes -Wno-trigraphs -Werror -+ccflags-$(CONFIG_BCM_VC_CMA) += -Iinclude/linux/broadcom -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vchi -Idrivers/staging/vc04_services/interface/vchiq_arm -+ccflags-$(CONFIG_BCM_VC_CMA) += -D__KERNEL__ -D__linux__ -+ -+obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o -+ -+vc-cma-objs := vc_cma.o -diff --git a/drivers/char/broadcom/vc_cma/vc_cma.c b/drivers/char/broadcom/vc_cma/vc_cma.c -new file mode 100644 -index 0000000000000000000000000000000000000000..85f6e9da9e5baa0abfba618a171881c078f38496 ---- /dev/null -+++ b/drivers/char/broadcom/vc_cma/vc_cma.c -@@ -0,0 +1,1193 @@ -+/** -+ * Copyright (c) 2010-2012 Broadcom. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "vc_cma.h" -+ -+#include "vchiq_util.h" -+#include "vchiq_connected.h" -+//#include "debug_sym.h" -+//#include "vc_mem.h" -+ -+#define DRIVER_NAME "vc-cma" -+ -+#define LOG_DBG(fmt, ...) \ -+ if (vc_cma_debug) \ -+ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) -+#define LOG_INFO(fmt, ...) \ -+ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) -+#define LOG_ERR(fmt, ...) \ -+ printk(KERN_ERR fmt "\n", ##__VA_ARGS__) -+ -+#define VC_CMA_FOURCC VCHIQ_MAKE_FOURCC('C', 'M', 'A', ' ') -+#define VC_CMA_VERSION 2 -+ -+#define VC_CMA_CHUNK_ORDER 6 /* 256K */ -+#define VC_CMA_CHUNK_SIZE (4096 << VC_CMA_CHUNK_ORDER) -+#define VC_CMA_MAX_PARAMS_PER_MSG \ -+ ((VCHIQ_MAX_MSG_SIZE - sizeof(unsigned short))/sizeof(unsigned short)) -+#define VC_CMA_RESERVE_COUNT_MAX 16 -+ -+#define PAGES_PER_CHUNK (VC_CMA_CHUNK_SIZE / PAGE_SIZE) -+ -+#define VCADDR_TO_PHYSADDR(vcaddr) (mm_vc_mem_phys_addr + vcaddr) -+ -+#define loud_error(...) \ -+ LOG_ERR("===== " __VA_ARGS__) -+ -+enum { -+ VC_CMA_MSG_QUIT, -+ VC_CMA_MSG_OPEN, -+ VC_CMA_MSG_TICK, -+ VC_CMA_MSG_ALLOC, /* chunk count */ -+ VC_CMA_MSG_FREE, /* chunk, chunk, ... */ -+ VC_CMA_MSG_ALLOCATED, /* chunk, chunk, ... */ -+ VC_CMA_MSG_REQUEST_ALLOC, /* chunk count */ -+ VC_CMA_MSG_REQUEST_FREE, /* chunk count */ -+ VC_CMA_MSG_RESERVE, /* bytes lo, bytes hi */ -+ VC_CMA_MSG_UPDATE_RESERVE, -+ VC_CMA_MSG_MAX -+}; -+ -+struct cma_msg { -+ unsigned short type; -+ unsigned short params[VC_CMA_MAX_PARAMS_PER_MSG]; -+}; -+ -+struct vc_cma_reserve_user { -+ unsigned int pid; -+ unsigned int reserve; -+}; -+ -+/* Device (/dev) related variables */ -+static dev_t vc_cma_devnum; -+static struct class *vc_cma_class; -+static struct cdev vc_cma_cdev; -+static int vc_cma_inited; -+static int vc_cma_debug; -+ -+/* Proc entry */ -+static struct proc_dir_entry *vc_cma_proc_entry; -+ -+phys_addr_t vc_cma_base; -+struct page *vc_cma_base_page; -+unsigned int vc_cma_size; -+EXPORT_SYMBOL(vc_cma_size); -+unsigned int vc_cma_initial; -+unsigned int vc_cma_chunks; -+unsigned int vc_cma_chunks_used; -+unsigned int vc_cma_chunks_reserved; -+ -+ -+void *vc_cma_dma_alloc; -+unsigned int vc_cma_dma_size; -+ -+static int in_loud_error; -+ -+unsigned int vc_cma_reserve_total; -+unsigned int vc_cma_reserve_count; -+struct vc_cma_reserve_user vc_cma_reserve_users[VC_CMA_RESERVE_COUNT_MAX]; -+static DEFINE_SEMAPHORE(vc_cma_reserve_mutex); -+static DEFINE_SEMAPHORE(vc_cma_worker_queue_push_mutex); -+ -+static u64 vc_cma_dma_mask = DMA_BIT_MASK(32); -+static struct platform_device vc_cma_device = { -+ .name = "vc-cma", -+ .id = 0, -+ .dev = { -+ .dma_mask = &vc_cma_dma_mask, -+ .coherent_dma_mask = DMA_BIT_MASK(32), -+ }, -+}; -+ -+static VCHIQ_INSTANCE_T cma_instance; -+static VCHIQ_SERVICE_HANDLE_T cma_service; -+static VCHIU_QUEUE_T cma_msg_queue; -+static struct task_struct *cma_worker; -+ -+static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid); -+static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply); -+static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, -+ VCHIQ_HEADER_T * header, -+ VCHIQ_SERVICE_HANDLE_T service, -+ void *bulk_userdata); -+static void send_vc_msg(unsigned short type, -+ unsigned short param1, unsigned short param2); -+static bool send_worker_msg(VCHIQ_HEADER_T * msg); -+ -+static int early_vc_cma_mem(char *p) -+{ -+ unsigned int new_size; -+ printk(KERN_NOTICE "early_vc_cma_mem(%s)", p); -+ vc_cma_size = memparse(p, &p); -+ vc_cma_initial = vc_cma_size; -+ if (*p == '/') -+ vc_cma_size = memparse(p + 1, &p); -+ if (*p == '@') -+ vc_cma_base = memparse(p + 1, &p); -+ -+ new_size = (vc_cma_size - ((-vc_cma_base) & (VC_CMA_CHUNK_SIZE - 1))) -+ & ~(VC_CMA_CHUNK_SIZE - 1); -+ if (new_size > vc_cma_size) -+ vc_cma_size = 0; -+ vc_cma_initial = (vc_cma_initial + VC_CMA_CHUNK_SIZE - 1) -+ & ~(VC_CMA_CHUNK_SIZE - 1); -+ if (vc_cma_initial > vc_cma_size) -+ vc_cma_initial = vc_cma_size; -+ vc_cma_base = (vc_cma_base + VC_CMA_CHUNK_SIZE - 1) -+ & ~(VC_CMA_CHUNK_SIZE - 1); -+ -+ printk(KERN_NOTICE " -> initial %x, size %x, base %x", vc_cma_initial, -+ vc_cma_size, (unsigned int)vc_cma_base); -+ -+ return 0; -+} -+ -+early_param("vc-cma-mem", early_vc_cma_mem); -+ -+void __init vc_cma_early_init(void) -+{ -+ LOG_DBG("vc_cma_early_init - vc_cma_chunks = %d", vc_cma_chunks); -+ if (vc_cma_size) { -+ int rc = platform_device_register(&vc_cma_device); -+ LOG_DBG("platform_device_register -> %d", rc); -+ } -+} -+ -+void __init vc_cma_reserve(void) -+{ -+ /* if vc_cma_size is set, then declare vc CMA area of the same -+ * size from the end of memory -+ */ -+ if (vc_cma_size) { -+ if (dma_declare_contiguous(&vc_cma_device.dev, vc_cma_size, -+ vc_cma_base, 0) == 0) { -+ if (!dev_get_cma_area(NULL)) { -+ /* There is no default CMA area - make this -+ the default */ -+ struct cma *vc_cma_area = dev_get_cma_area( -+ &vc_cma_device.dev); -+ dma_contiguous_set_default(vc_cma_area); -+ LOG_INFO("vc_cma_reserve - using vc_cma as " -+ "the default contiguous DMA area"); -+ } -+ } else { -+ LOG_ERR("vc_cma: dma_declare_contiguous(%x,%x) failed", -+ vc_cma_size, (unsigned int)vc_cma_base); -+ vc_cma_size = 0; -+ } -+ } -+ vc_cma_chunks = vc_cma_size / VC_CMA_CHUNK_SIZE; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_open -+* -+***************************************************************************/ -+ -+static int vc_cma_open(struct inode *inode, struct file *file) -+{ -+ (void)inode; -+ (void)file; -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_release -+* -+***************************************************************************/ -+ -+static int vc_cma_release(struct inode *inode, struct file *file) -+{ -+ (void)inode; -+ (void)file; -+ -+ vc_cma_set_reserve(0, current->tgid); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_ioctl -+* -+***************************************************************************/ -+ -+static long vc_cma_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int rc = 0; -+ -+ (void)cmd; -+ (void)arg; -+ -+ switch (cmd) { -+ case VC_CMA_IOC_RESERVE: -+ rc = vc_cma_set_reserve((unsigned int)arg, current->tgid); -+ if (rc >= 0) -+ rc = 0; -+ break; -+ default: -+ LOG_ERR("vc-cma: Unknown ioctl %x", cmd); -+ return -ENOTTY; -+ } -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for the driver. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_cma_fops = { -+ .owner = THIS_MODULE, -+ .open = vc_cma_open, -+ .release = vc_cma_release, -+ .unlocked_ioctl = vc_cma_ioctl, -+}; -+ -+/**************************************************************************** -+* -+* vc_cma_proc_open -+* -+***************************************************************************/ -+ -+static int vc_cma_show_info(struct seq_file *m, void *v) -+{ -+ int i; -+ -+ seq_printf(m, "Videocore CMA:\n"); -+ seq_printf(m, " Base : %08x\n", (unsigned int)vc_cma_base); -+ seq_printf(m, " Length : %08x\n", vc_cma_size); -+ seq_printf(m, " Initial : %08x\n", vc_cma_initial); -+ seq_printf(m, " Chunk size : %08x\n", VC_CMA_CHUNK_SIZE); -+ seq_printf(m, " Chunks : %4d (%d bytes)\n", -+ (int)vc_cma_chunks, -+ (int)(vc_cma_chunks * VC_CMA_CHUNK_SIZE)); -+ seq_printf(m, " Used : %4d (%d bytes)\n", -+ (int)vc_cma_chunks_used, -+ (int)(vc_cma_chunks_used * VC_CMA_CHUNK_SIZE)); -+ seq_printf(m, " Reserved : %4d (%d bytes)\n", -+ (unsigned int)vc_cma_chunks_reserved, -+ (int)(vc_cma_chunks_reserved * VC_CMA_CHUNK_SIZE)); -+ -+ for (i = 0; i < vc_cma_reserve_count; i++) { -+ struct vc_cma_reserve_user *user = &vc_cma_reserve_users[i]; -+ seq_printf(m, " PID %5d: %d bytes\n", user->pid, -+ user->reserve); -+ } -+ seq_printf(m, " dma_alloc : %p (%d pages)\n", -+ vc_cma_dma_alloc ? page_address(vc_cma_dma_alloc) : 0, -+ vc_cma_dma_size); -+ -+ seq_printf(m, "\n"); -+ -+ return 0; -+} -+ -+static int vc_cma_proc_open(struct inode *inode, struct file *file) -+{ -+ return single_open(file, vc_cma_show_info, NULL); -+} -+ -+/**************************************************************************** -+* -+* vc_cma_proc_write -+* -+***************************************************************************/ -+ -+static int vc_cma_proc_write(struct file *file, -+ const char __user *buffer, -+ size_t size, loff_t *ppos) -+{ -+ int rc = -EFAULT; -+ char input_str[20]; -+ -+ memset(input_str, 0, sizeof(input_str)); -+ -+ if (size > sizeof(input_str)) { -+ LOG_ERR("%s: input string length too long", __func__); -+ goto out; -+ } -+ -+ if (copy_from_user(input_str, buffer, size - 1)) { -+ LOG_ERR("%s: failed to get input string", __func__); -+ goto out; -+ } -+#define ALLOC_STR "alloc" -+#define FREE_STR "free" -+#define DEBUG_STR "debug" -+#define RESERVE_STR "reserve" -+#define DMA_ALLOC_STR "dma_alloc" -+#define DMA_FREE_STR "dma_free" -+ if (strncmp(input_str, ALLOC_STR, strlen(ALLOC_STR)) == 0) { -+ int alloc_size; -+ char *p = input_str + strlen(ALLOC_STR); -+ -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ LOG_INFO("/proc/vc-cma: alloc %d", alloc_size); -+ if (alloc_size) -+ send_vc_msg(VC_CMA_MSG_REQUEST_FREE, -+ alloc_size / VC_CMA_CHUNK_SIZE, 0); -+ else -+ LOG_ERR("invalid size '%s'", p); -+ rc = size; -+ } else if (strncmp(input_str, FREE_STR, strlen(FREE_STR)) == 0) { -+ int alloc_size; -+ char *p = input_str + strlen(FREE_STR); -+ -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ LOG_INFO("/proc/vc-cma: free %d", alloc_size); -+ if (alloc_size) -+ send_vc_msg(VC_CMA_MSG_REQUEST_ALLOC, -+ alloc_size / VC_CMA_CHUNK_SIZE, 0); -+ else -+ LOG_ERR("invalid size '%s'", p); -+ rc = size; -+ } else if (strncmp(input_str, DEBUG_STR, strlen(DEBUG_STR)) == 0) { -+ char *p = input_str + strlen(DEBUG_STR); -+ while (*p == ' ') -+ p++; -+ if ((strcmp(p, "on") == 0) || (strcmp(p, "1") == 0)) -+ vc_cma_debug = 1; -+ else if ((strcmp(p, "off") == 0) || (strcmp(p, "0") == 0)) -+ vc_cma_debug = 0; -+ LOG_INFO("/proc/vc-cma: debug %s", vc_cma_debug ? "on" : "off"); -+ rc = size; -+ } else if (strncmp(input_str, RESERVE_STR, strlen(RESERVE_STR)) == 0) { -+ int alloc_size; -+ int reserved; -+ char *p = input_str + strlen(RESERVE_STR); -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ -+ reserved = vc_cma_set_reserve(alloc_size, current->tgid); -+ rc = (reserved >= 0) ? size : reserved; -+ } else if (strncmp(input_str, DMA_ALLOC_STR, strlen(DMA_ALLOC_STR)) == 0) { -+ int alloc_size; -+ char *p = input_str + strlen(DMA_ALLOC_STR); -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ -+ if (vc_cma_dma_alloc) { -+ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, -+ vc_cma_dma_size); -+ vc_cma_dma_alloc = NULL; -+ vc_cma_dma_size = 0; -+ } -+ vc_cma_dma_alloc = dma_alloc_from_contiguous(NULL, alloc_size, 0); -+ vc_cma_dma_size = (vc_cma_dma_alloc ? alloc_size : 0); -+ if (vc_cma_dma_alloc) -+ LOG_INFO("dma_alloc(%d pages) -> %p", alloc_size, page_address(vc_cma_dma_alloc)); -+ else -+ LOG_ERR("dma_alloc(%d pages) failed", alloc_size); -+ rc = size; -+ } else if (strncmp(input_str, DMA_FREE_STR, strlen(DMA_FREE_STR)) == 0) { -+ if (vc_cma_dma_alloc) { -+ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, -+ vc_cma_dma_size); -+ vc_cma_dma_alloc = NULL; -+ vc_cma_dma_size = 0; -+ } -+ rc = size; -+ } -+ -+out: -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for /proc interface. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_cma_proc_fops = { -+ .open = vc_cma_proc_open, -+ .read = seq_read, -+ .write = vc_cma_proc_write, -+ .llseek = seq_lseek, -+ .release = single_release -+}; -+ -+static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid) -+{ -+ struct vc_cma_reserve_user *user = NULL; -+ int delta = 0; -+ int i; -+ -+ if (down_interruptible(&vc_cma_reserve_mutex)) -+ return -ERESTARTSYS; -+ -+ for (i = 0; i < vc_cma_reserve_count; i++) { -+ if (pid == vc_cma_reserve_users[i].pid) { -+ user = &vc_cma_reserve_users[i]; -+ delta = reserve - user->reserve; -+ if (reserve) -+ user->reserve = reserve; -+ else { -+ /* Remove this entry by copying downwards */ -+ while ((i + 1) < vc_cma_reserve_count) { -+ user[0].pid = user[1].pid; -+ user[0].reserve = user[1].reserve; -+ user++; -+ i++; -+ } -+ vc_cma_reserve_count--; -+ user = NULL; -+ } -+ break; -+ } -+ } -+ -+ if (reserve && !user) { -+ if (vc_cma_reserve_count == VC_CMA_RESERVE_COUNT_MAX) { -+ LOG_ERR("vc-cma: Too many reservations - " -+ "increase CMA_RESERVE_COUNT_MAX"); -+ up(&vc_cma_reserve_mutex); -+ return -EBUSY; -+ } -+ user = &vc_cma_reserve_users[vc_cma_reserve_count]; -+ user->pid = pid; -+ user->reserve = reserve; -+ delta = reserve; -+ vc_cma_reserve_count++; -+ } -+ -+ vc_cma_reserve_total += delta; -+ -+ send_vc_msg(VC_CMA_MSG_RESERVE, -+ vc_cma_reserve_total & 0xffff, vc_cma_reserve_total >> 16); -+ -+ send_worker_msg((VCHIQ_HEADER_T *) VC_CMA_MSG_UPDATE_RESERVE); -+ -+ LOG_DBG("/proc/vc-cma: reserve %d (PID %d) - total %u", -+ reserve, pid, vc_cma_reserve_total); -+ -+ up(&vc_cma_reserve_mutex); -+ -+ return vc_cma_reserve_total; -+} -+ -+static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, -+ VCHIQ_HEADER_T * header, -+ VCHIQ_SERVICE_HANDLE_T service, -+ void *bulk_userdata) -+{ -+ switch (reason) { -+ case VCHIQ_MESSAGE_AVAILABLE: -+ if (!send_worker_msg(header)) -+ return VCHIQ_RETRY; -+ break; -+ case VCHIQ_SERVICE_CLOSED: -+ LOG_DBG("CMA service closed"); -+ break; -+ default: -+ LOG_ERR("Unexpected CMA callback reason %d", reason); -+ break; -+ } -+ return VCHIQ_SUCCESS; -+} -+ -+static void send_vc_msg(unsigned short type, -+ unsigned short param1, unsigned short param2) -+{ -+ unsigned short msg[] = { type, param1, param2 }; -+ VCHIQ_ELEMENT_T elem = { &msg, sizeof(msg) }; -+ VCHIQ_STATUS_T ret; -+ vchiq_use_service(cma_service); -+ ret = vchiq_queue_message(cma_service, &elem, 1); -+ vchiq_release_service(cma_service); -+ if (ret != VCHIQ_SUCCESS) -+ LOG_ERR("vchiq_queue_message returned %x", ret); -+} -+ -+static bool send_worker_msg(VCHIQ_HEADER_T * msg) -+{ -+ if (down_interruptible(&vc_cma_worker_queue_push_mutex)) -+ return false; -+ vchiu_queue_push(&cma_msg_queue, msg); -+ up(&vc_cma_worker_queue_push_mutex); -+ return true; -+} -+ -+static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply) -+{ -+ int i; -+ for (i = 0; i < num_chunks; i++) { -+ struct page *chunk; -+ unsigned int chunk_num; -+ uint8_t *chunk_addr; -+ size_t chunk_size = PAGES_PER_CHUNK << PAGE_SHIFT; -+ -+ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, -+ PAGES_PER_CHUNK, -+ VC_CMA_CHUNK_ORDER); -+ if (!chunk) -+ break; -+ -+ chunk_addr = page_address(chunk); -+ dmac_flush_range(chunk_addr, chunk_addr + chunk_size); -+ outer_inv_range(__pa(chunk_addr), __pa(chunk_addr) + -+ chunk_size); -+ -+ chunk_num = -+ (page_to_phys(chunk) - vc_cma_base) / VC_CMA_CHUNK_SIZE; -+ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % -+ VC_CMA_CHUNK_SIZE) != 0); -+ if (chunk_num >= vc_cma_chunks) { -+ phys_addr_t _pa = vc_cma_base + vc_cma_size - 1; -+ LOG_ERR("%s: ===============================", -+ __func__); -+ LOG_ERR("%s: chunk phys %x, vc_cma %pa-%pa - " -+ "bad SPARSEMEM configuration?", -+ __func__, (unsigned int)page_to_phys(chunk), -+ &vc_cma_base, &_pa); -+ LOG_ERR("%s: dev->cma_area = %p", __func__, -+ (void*)0/*vc_cma_device.dev.cma_area*/); -+ LOG_ERR("%s: ===============================", -+ __func__); -+ break; -+ } -+ reply->params[i] = chunk_num; -+ vc_cma_chunks_used++; -+ } -+ -+ if (i < num_chunks) { -+ LOG_ERR("%s: dma_alloc_from_contiguous failed " -+ "for %x bytes (alloc %d of %d, %d free)", -+ __func__, VC_CMA_CHUNK_SIZE, i, -+ num_chunks, vc_cma_chunks - vc_cma_chunks_used); -+ num_chunks = i; -+ } -+ -+ LOG_DBG("CMA allocated %d chunks -> %d used", -+ num_chunks, vc_cma_chunks_used); -+ reply->type = VC_CMA_MSG_ALLOCATED; -+ -+ { -+ VCHIQ_ELEMENT_T elem = { -+ reply, -+ offsetof(struct cma_msg, params[0]) + -+ num_chunks * sizeof(reply->params[0]) -+ }; -+ VCHIQ_STATUS_T ret; -+ vchiq_use_service(cma_service); -+ ret = vchiq_queue_message(cma_service, &elem, 1); -+ vchiq_release_service(cma_service); -+ if (ret != VCHIQ_SUCCESS) -+ LOG_ERR("vchiq_queue_message return " "%x", ret); -+ } -+ -+ return num_chunks; -+} -+ -+static int cma_worker_proc(void *param) -+{ -+ static struct cma_msg reply; -+ (void)param; -+ -+ while (1) { -+ VCHIQ_HEADER_T *msg; -+ static struct cma_msg msg_copy; -+ struct cma_msg *cma_msg = &msg_copy; -+ int type, msg_size; -+ -+ msg = vchiu_queue_pop(&cma_msg_queue); -+ if ((unsigned int)msg >= VC_CMA_MSG_MAX) { -+ msg_size = msg->size; -+ memcpy(&msg_copy, msg->data, msg_size); -+ type = cma_msg->type; -+ vchiq_release_message(cma_service, msg); -+ } else { -+ msg_size = 0; -+ type = (int)msg; -+ if (type == VC_CMA_MSG_QUIT) -+ break; -+ else if (type == VC_CMA_MSG_UPDATE_RESERVE) { -+ msg = NULL; -+ cma_msg = NULL; -+ } else { -+ BUG(); -+ continue; -+ } -+ } -+ -+ switch (type) { -+ case VC_CMA_MSG_ALLOC:{ -+ int num_chunks, free_chunks; -+ num_chunks = cma_msg->params[0]; -+ free_chunks = -+ vc_cma_chunks - vc_cma_chunks_used; -+ LOG_DBG("CMA_MSG_ALLOC(%d chunks)", num_chunks); -+ if (num_chunks > VC_CMA_MAX_PARAMS_PER_MSG) { -+ LOG_ERR -+ ("CMA_MSG_ALLOC - chunk count (%d) " -+ "exceeds VC_CMA_MAX_PARAMS_PER_MSG (%d)", -+ num_chunks, -+ VC_CMA_MAX_PARAMS_PER_MSG); -+ num_chunks = VC_CMA_MAX_PARAMS_PER_MSG; -+ } -+ -+ if (num_chunks > free_chunks) { -+ LOG_ERR -+ ("CMA_MSG_ALLOC - chunk count (%d) " -+ "exceeds free chunks (%d)", -+ num_chunks, free_chunks); -+ num_chunks = free_chunks; -+ } -+ -+ vc_cma_alloc_chunks(num_chunks, &reply); -+ } -+ break; -+ -+ case VC_CMA_MSG_FREE:{ -+ int chunk_count = -+ (msg_size - -+ offsetof(struct cma_msg, -+ params)) / -+ sizeof(cma_msg->params[0]); -+ int i; -+ BUG_ON(chunk_count <= 0); -+ -+ LOG_DBG("CMA_MSG_FREE(%d chunks - %x, ...)", -+ chunk_count, cma_msg->params[0]); -+ for (i = 0; i < chunk_count; i++) { -+ int chunk_num = cma_msg->params[i]; -+ struct page *page = vc_cma_base_page + -+ chunk_num * PAGES_PER_CHUNK; -+ if (chunk_num >= vc_cma_chunks) { -+ LOG_ERR -+ ("CMA_MSG_FREE - chunk %d of %d" -+ " (value %x) exceeds maximum " -+ "(%x)", i, chunk_count, -+ chunk_num, -+ vc_cma_chunks - 1); -+ break; -+ } -+ -+ if (!dma_release_from_contiguous -+ (&vc_cma_device.dev, page, -+ PAGES_PER_CHUNK)) { -+ phys_addr_t _pa = page_to_phys(page); -+ LOG_ERR -+ ("CMA_MSG_FREE - failed to " -+ "release chunk %d (phys %pa, " -+ "page %x)", chunk_num, -+ &_pa, -+ (unsigned int)page); -+ } -+ vc_cma_chunks_used--; -+ } -+ LOG_DBG("CMA released %d chunks -> %d used", -+ i, vc_cma_chunks_used); -+ } -+ break; -+ -+ case VC_CMA_MSG_UPDATE_RESERVE:{ -+ int chunks_needed = -+ ((vc_cma_reserve_total + VC_CMA_CHUNK_SIZE - -+ 1) -+ / VC_CMA_CHUNK_SIZE) - -+ vc_cma_chunks_reserved; -+ -+ LOG_DBG -+ ("CMA_MSG_UPDATE_RESERVE(%d chunks needed)", -+ chunks_needed); -+ -+ /* Cap the reservations to what is available */ -+ if (chunks_needed > 0) { -+ if (chunks_needed > -+ (vc_cma_chunks - -+ vc_cma_chunks_used)) -+ chunks_needed = -+ (vc_cma_chunks - -+ vc_cma_chunks_used); -+ -+ chunks_needed = -+ vc_cma_alloc_chunks(chunks_needed, -+ &reply); -+ } -+ -+ LOG_DBG -+ ("CMA_MSG_UPDATE_RESERVE(%d chunks allocated)", -+ chunks_needed); -+ vc_cma_chunks_reserved += chunks_needed; -+ } -+ break; -+ -+ default: -+ LOG_ERR("unexpected msg type %d", type); -+ break; -+ } -+ } -+ -+ LOG_DBG("quitting..."); -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_connected_init -+* -+* This function is called once the videocore has been connected. -+* -+***************************************************************************/ -+ -+static void vc_cma_connected_init(void) -+{ -+ VCHIQ_SERVICE_PARAMS_T service_params; -+ -+ LOG_DBG("vc_cma_connected_init"); -+ -+ if (!vchiu_queue_init(&cma_msg_queue, 16)) { -+ LOG_ERR("could not create CMA msg queue"); -+ goto fail_queue; -+ } -+ -+ if (vchiq_initialise(&cma_instance) != VCHIQ_SUCCESS) -+ goto fail_vchiq_init; -+ -+ vchiq_connect(cma_instance); -+ -+ service_params.fourcc = VC_CMA_FOURCC; -+ service_params.callback = cma_service_callback; -+ service_params.userdata = NULL; -+ service_params.version = VC_CMA_VERSION; -+ service_params.version_min = VC_CMA_VERSION; -+ -+ if (vchiq_open_service(cma_instance, &service_params, -+ &cma_service) != VCHIQ_SUCCESS) { -+ LOG_ERR("failed to open service - already in use?"); -+ goto fail_vchiq_open; -+ } -+ -+ vchiq_release_service(cma_service); -+ -+ cma_worker = kthread_create(cma_worker_proc, NULL, "cma_worker"); -+ if (!cma_worker) { -+ LOG_ERR("could not create CMA worker thread"); -+ goto fail_worker; -+ } -+ set_user_nice(cma_worker, -20); -+ wake_up_process(cma_worker); -+ -+ return; -+ -+fail_worker: -+ vchiq_close_service(cma_service); -+fail_vchiq_open: -+ vchiq_shutdown(cma_instance); -+fail_vchiq_init: -+ vchiu_queue_delete(&cma_msg_queue); -+fail_queue: -+ return; -+} -+ -+void -+loud_error_header(void) -+{ -+ if (in_loud_error) -+ return; -+ -+ LOG_ERR("============================================================" -+ "================"); -+ LOG_ERR("============================================================" -+ "================"); -+ LOG_ERR("====="); -+ -+ in_loud_error = 1; -+} -+ -+void -+loud_error_footer(void) -+{ -+ if (!in_loud_error) -+ return; -+ -+ LOG_ERR("====="); -+ LOG_ERR("============================================================" -+ "================"); -+ LOG_ERR("============================================================" -+ "================"); -+ -+ in_loud_error = 0; -+} -+ -+#if 1 -+static int check_cma_config(void) { return 1; } -+#else -+static int -+read_vc_debug_var(VC_MEM_ACCESS_HANDLE_T handle, -+ const char *symbol, -+ void *buf, size_t bufsize) -+{ -+ VC_MEM_ADDR_T vcMemAddr; -+ size_t vcMemSize; -+ uint8_t *mapAddr; -+ off_t vcMapAddr; -+ -+ if (!LookupVideoCoreSymbol(handle, symbol, -+ &vcMemAddr, -+ &vcMemSize)) { -+ loud_error_header(); -+ loud_error( -+ "failed to find VC symbol \"%s\".", -+ symbol); -+ loud_error_footer(); -+ return 0; -+ } -+ -+ if (vcMemSize != bufsize) { -+ loud_error_header(); -+ loud_error( -+ "VC symbol \"%s\" is the wrong size.", -+ symbol); -+ loud_error_footer(); -+ return 0; -+ } -+ -+ vcMapAddr = (off_t)vcMemAddr & VC_MEM_TO_ARM_ADDR_MASK; -+ vcMapAddr += mm_vc_mem_phys_addr; -+ mapAddr = ioremap_nocache(vcMapAddr, vcMemSize); -+ if (mapAddr == 0) { -+ loud_error_header(); -+ loud_error( -+ "failed to ioremap \"%s\" @ 0x%x " -+ "(phys: 0x%x, size: %u).", -+ symbol, -+ (unsigned int)vcMapAddr, -+ (unsigned int)vcMemAddr, -+ (unsigned int)vcMemSize); -+ loud_error_footer(); -+ return 0; -+ } -+ -+ memcpy(buf, mapAddr, bufsize); -+ iounmap(mapAddr); -+ -+ return 1; -+} -+ -+ -+static int -+check_cma_config(void) -+{ -+ VC_MEM_ACCESS_HANDLE_T mem_hndl; -+ VC_MEM_ADDR_T mempool_start; -+ VC_MEM_ADDR_T mempool_end; -+ VC_MEM_ADDR_T mempool_offline_start; -+ VC_MEM_ADDR_T mempool_offline_end; -+ VC_MEM_ADDR_T cam_alloc_base; -+ VC_MEM_ADDR_T cam_alloc_size; -+ VC_MEM_ADDR_T cam_alloc_end; -+ int success = 0; -+ -+ if (OpenVideoCoreMemory(&mem_hndl) != 0) -+ goto out; -+ -+ /* Read the relevant VideoCore variables */ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_START", -+ &mempool_start, -+ sizeof(mempool_start))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_END", -+ &mempool_end, -+ sizeof(mempool_end))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_START", -+ &mempool_offline_start, -+ sizeof(mempool_offline_start))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_END", -+ &mempool_offline_end, -+ sizeof(mempool_offline_end))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "cam_alloc_base", -+ &cam_alloc_base, -+ sizeof(cam_alloc_base))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "cam_alloc_size", -+ &cam_alloc_size, -+ sizeof(cam_alloc_size))) -+ goto close; -+ -+ cam_alloc_end = cam_alloc_base + cam_alloc_size; -+ -+ success = 1; -+ -+ /* Now the sanity checks */ -+ if (!mempool_offline_start) -+ mempool_offline_start = mempool_start; -+ if (!mempool_offline_end) -+ mempool_offline_end = mempool_end; -+ -+ if (VCADDR_TO_PHYSADDR(mempool_offline_start) != vc_cma_base) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_START(%x -> %lx) doesn't match " -+ "vc_cma_base(%x)", -+ mempool_offline_start, -+ VCADDR_TO_PHYSADDR(mempool_offline_start), -+ vc_cma_base); -+ success = 0; -+ } -+ -+ if (VCADDR_TO_PHYSADDR(mempool_offline_end) != -+ (vc_cma_base + vc_cma_size)) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_END(%x -> %lx) doesn't match " -+ "vc_cma_base(%x) + vc_cma_size(%x) = %x", -+ mempool_offline_start, -+ VCADDR_TO_PHYSADDR(mempool_offline_end), -+ vc_cma_base, vc_cma_size, vc_cma_base + vc_cma_size); -+ success = 0; -+ } -+ -+ if (mempool_end < mempool_start) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_END(%x) must not be before " -+ "__MEMPOOL_START(%x)", -+ mempool_end, -+ mempool_start); -+ success = 0; -+ } -+ -+ if (mempool_offline_end < mempool_offline_start) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_END(%x) must not be before " -+ "__MEMPOOL_OFFLINE_START(%x)", -+ mempool_offline_end, -+ mempool_offline_start); -+ success = 0; -+ } -+ -+ if (mempool_offline_start < mempool_start) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_START(%x) must not be before " -+ "__MEMPOOL_START(%x)", -+ mempool_offline_start, -+ mempool_start); -+ success = 0; -+ } -+ -+ if (mempool_offline_end > mempool_end) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_END(%x) must not be after " -+ "__MEMPOOL_END(%x)", -+ mempool_offline_end, -+ mempool_end); -+ success = 0; -+ } -+ -+ if ((cam_alloc_base < mempool_end) && -+ (cam_alloc_end > mempool_start)) { -+ loud_error_header(); -+ loud_error( -+ "cam_alloc pool(%x-%x) overlaps " -+ "mempool(%x-%x)", -+ cam_alloc_base, cam_alloc_end, -+ mempool_start, mempool_end); -+ success = 0; -+ } -+ -+ loud_error_footer(); -+ -+close: -+ CloseVideoCoreMemory(mem_hndl); -+ -+out: -+ return success; -+} -+#endif -+ -+static int vc_cma_init(void) -+{ -+ int rc = -EFAULT; -+ struct device *dev; -+ -+ if (!check_cma_config()) -+ goto out_release; -+ -+ LOG_INFO("vc-cma: Videocore CMA driver"); -+ LOG_INFO("vc-cma: vc_cma_base = %pa", &vc_cma_base); -+ LOG_INFO("vc-cma: vc_cma_size = 0x%08x (%u MiB)", -+ vc_cma_size, vc_cma_size / (1024 * 1024)); -+ LOG_INFO("vc-cma: vc_cma_initial = 0x%08x (%u MiB)", -+ vc_cma_initial, vc_cma_initial / (1024 * 1024)); -+ -+ vc_cma_base_page = phys_to_page(vc_cma_base); -+ -+ if (vc_cma_chunks) { -+ int chunks_needed = vc_cma_initial / VC_CMA_CHUNK_SIZE; -+ -+ for (vc_cma_chunks_used = 0; -+ vc_cma_chunks_used < chunks_needed; vc_cma_chunks_used++) { -+ struct page *chunk; -+ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, -+ PAGES_PER_CHUNK, -+ VC_CMA_CHUNK_ORDER); -+ if (!chunk) -+ break; -+ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % -+ VC_CMA_CHUNK_SIZE) != 0); -+ } -+ if (vc_cma_chunks_used != chunks_needed) { -+ LOG_ERR("%s: dma_alloc_from_contiguous failed (%d " -+ "bytes, allocation %d of %d)", -+ __func__, VC_CMA_CHUNK_SIZE, -+ vc_cma_chunks_used, chunks_needed); -+ goto out_release; -+ } -+ -+ vchiq_add_connected_callback(vc_cma_connected_init); -+ } -+ -+ rc = alloc_chrdev_region(&vc_cma_devnum, 0, 1, DRIVER_NAME); -+ if (rc < 0) { -+ LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); -+ goto out_release; -+ } -+ -+ cdev_init(&vc_cma_cdev, &vc_cma_fops); -+ rc = cdev_add(&vc_cma_cdev, vc_cma_devnum, 1); -+ if (rc != 0) { -+ LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); -+ goto out_unregister; -+ } -+ -+ vc_cma_class = class_create(THIS_MODULE, DRIVER_NAME); -+ if (IS_ERR(vc_cma_class)) { -+ rc = PTR_ERR(vc_cma_class); -+ LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); -+ goto out_cdev_del; -+ } -+ -+ dev = device_create(vc_cma_class, NULL, vc_cma_devnum, NULL, -+ DRIVER_NAME); -+ if (IS_ERR(dev)) { -+ rc = PTR_ERR(dev); -+ LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); -+ goto out_class_destroy; -+ } -+ -+ vc_cma_proc_entry = proc_create(DRIVER_NAME, 0444, NULL, &vc_cma_proc_fops); -+ if (vc_cma_proc_entry == NULL) { -+ rc = -EFAULT; -+ LOG_ERR("%s: proc_create failed", __func__); -+ goto out_device_destroy; -+ } -+ -+ vc_cma_inited = 1; -+ return 0; -+ -+out_device_destroy: -+ device_destroy(vc_cma_class, vc_cma_devnum); -+ -+out_class_destroy: -+ class_destroy(vc_cma_class); -+ vc_cma_class = NULL; -+ -+out_cdev_del: -+ cdev_del(&vc_cma_cdev); -+ -+out_unregister: -+ unregister_chrdev_region(vc_cma_devnum, 1); -+ -+out_release: -+ /* It is tempting to try to clean up by calling -+ dma_release_from_contiguous for all allocated chunks, but it isn't -+ a very safe thing to do. If vc_cma_initial is non-zero it is because -+ VideoCore is already using that memory, so giving it back to Linux -+ is likely to be fatal. -+ */ -+ return -1; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_exit -+* -+***************************************************************************/ -+ -+static void __exit vc_cma_exit(void) -+{ -+ LOG_DBG("%s: called", __func__); -+ -+ if (vc_cma_inited) { -+ remove_proc_entry(DRIVER_NAME, NULL); -+ device_destroy(vc_cma_class, vc_cma_devnum); -+ class_destroy(vc_cma_class); -+ cdev_del(&vc_cma_cdev); -+ unregister_chrdev_region(vc_cma_devnum, 1); -+ } -+} -+ -+module_init(vc_cma_init); -+module_exit(vc_cma_exit); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Broadcom Corporation"); -diff --git a/include/linux/broadcom/vc_cma.h b/include/linux/broadcom/vc_cma.h -new file mode 100644 -index 0000000000000000000000000000000000000000..be2819d5d41f9d5ed65daf8eedb94c9e9a4c2f1a ---- /dev/null -+++ b/include/linux/broadcom/vc_cma.h -@@ -0,0 +1,36 @@ -+/***************************************************************************** -+* Copyright 2012 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#if !defined( VC_CMA_H ) -+#define VC_CMA_H -+ -+#include -+ -+#define VC_CMA_IOC_MAGIC 0xc5 -+ -+#define VC_CMA_IOC_RESERVE _IO(VC_CMA_IOC_MAGIC, 0) -+ -+#ifdef __KERNEL__ -+ -+#ifdef CONFIG_BCM_VC_CMA -+void vc_cma_early_init(void); -+void vc_cma_reserve(void); -+#else -+static inline void vc_cma_early_init(void) { } -+static inline void vc_cma_reserve(void) { } -+#endif -+ -+#endif -+ -+#endif /* VC_CMA_H */ - -From 20fda0a0bcd46a01ba801a968f81c55398ff925e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 038/122] bcm2708: alsa sound driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -alsa: add mmap support and some cleanups to bcm2835 ALSA driver - -snd-bcm2835: Add support for spdif/hdmi passthrough - -This adds a dedicated subdevice which can be used for passthrough of non-audio -formats (ie encoded a52) through the hdmi audio link. In addition to this -driver extension an appropriate card config is required to make alsa-lib -support the AES parameters for this device. - -snd-bcm2708: Add mutex, improve logging - -Fix for ALSA driver crash - -Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written - -alsa: reduce severity of expected warning message - -snd-bcm2708: Fix dmesg spam for non-error case - -alsa: Ensure mutexes are released through error paths - -alsa: Make interrupted close paths quieter - -BCM270x: Add onboard sound device to Device Tree - -Add Device Tree support to alsa driver. -Add device to Device Tree. -Don't add platform devices when booting in DT mode. - -Signed-off-by: Noralf Trønnes - -bcm2835: access controls under the audio mutex - -I don't think the ALSA framework provides any kind of automatic -synchronization within the control callbacks. We most likely need -to ensure this manually, so add locking around all access to shared -mutable data. In particular, bcm2835_audio_set_ctls() should -probably always be called under our own audio lock. - -snd-bcm2835: Don't allow responses from VC to be interrupted by user signals - -There should always be a response, and retry after a signal interruption is not handled, so don't report -we are interruptible. - -See: https://github.com/raspberrypi/linux/issues/1560 - -snd-bcm2835: Use bcm2835_hw params in preallocate ---- - sound/arm/Kconfig | 7 + - sound/arm/Makefile | 5 + - sound/arm/bcm2835-ctl.c | 350 +++++++++++++++ - sound/arm/bcm2835-pcm.c | 563 +++++++++++++++++++++++ - sound/arm/bcm2835-vchiq.c | 889 +++++++++++++++++++++++++++++++++++++ - sound/arm/bcm2835.c | 511 +++++++++++++++++++++ - sound/arm/bcm2835.h | 167 +++++++ - sound/arm/vc_vchi_audioserv_defs.h | 116 +++++ - 8 files changed, 2608 insertions(+) - create mode 100755 sound/arm/bcm2835-ctl.c - create mode 100755 sound/arm/bcm2835-pcm.c - create mode 100755 sound/arm/bcm2835-vchiq.c - create mode 100644 sound/arm/bcm2835.c - create mode 100755 sound/arm/bcm2835.h - create mode 100644 sound/arm/vc_vchi_audioserv_defs.h - -diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig -index 65171f6657a2984ccc14ce907a4c7c87d77d196b..02b6d263035ca18c9ce53229369dfb00915c260b 100644 ---- a/sound/arm/Kconfig -+++ b/sound/arm/Kconfig -@@ -32,6 +32,13 @@ config SND_PXA2XX_AC97 - Say Y or M if you want to support any AC97 codec attached to - the PXA2xx AC97 interface. - -+config SND_BCM2835 -+ tristate "BCM2835 ALSA driver" -+ depends on ARCH_BCM2835 && BCM2708_VCHIQ && SND -+ select SND_PCM -+ help -+ Say Y or M if you want to support BCM2835 Alsa pcm card driver -+ - endif # SND_ARM - - config SND_PXA2XX_LIB -diff --git a/sound/arm/Makefile b/sound/arm/Makefile -index 8c0c851d464109819beb296c2624bbec7af131e9..26aabea79a0b5f141f7644a96684470d9b72f681 100644 ---- a/sound/arm/Makefile -+++ b/sound/arm/Makefile -@@ -14,3 +14,8 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o - - obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o - snd-pxa2xx-ac97-objs := pxa2xx-ac97.o -+ -+obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o -+snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o -+ -+ccflags-y += -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -new file mode 100755 -index 0000000000000000000000000000000000000000..75dc3224be7ce8353378e9676ad2c6847dd0750b ---- /dev/null -+++ b/sound/arm/bcm2835-ctl.c -@@ -0,0 +1,350 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* volume maximum and minimum in terms of 0.01dB */ -+#define CTRL_VOL_MAX 400 -+#define CTRL_VOL_MIN -10239 /* originally -10240 */ -+ -+ -+static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ audio_info(" ... IN\n"); -+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = 1; -+ uinfo->value.integer.min = CTRL_VOL_MIN; -+ uinfo->value.integer.max = CTRL_VOL_MAX; /* 2303 */ -+ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = 1; -+ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = AUDIO_DEST_MAX-1; -+ } -+ audio_info(" ... OUT\n"); -+ return 0; -+} -+ -+/* toggles mute on or off depending on the value of nmute, and returns -+ * 1 if the mute value was changed, otherwise 0 -+ */ -+static int toggle_mute(struct bcm2835_chip *chip, int nmute) -+{ -+ /* if settings are ok, just return 0 */ -+ if(chip->mute == nmute) -+ return 0; -+ -+ /* if the sound is muted then we need to unmute */ -+ if(chip->mute == CTRL_VOL_MUTE) -+ { -+ chip->volume = chip->old_volume; /* copy the old volume back */ -+ audio_info("Unmuting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); -+ } -+ else /* otherwise we mute */ -+ { -+ chip->old_volume = chip->volume; -+ chip->volume = 26214; /* set volume to minimum level AKA mute */ -+ audio_info("Muting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); -+ } -+ -+ chip->mute = nmute; -+ return 1; -+} -+ -+static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); -+ -+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) -+ ucontrol->value.integer.value[0] = chip2alsa(chip->volume); -+ else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) -+ ucontrol->value.integer.value[0] = chip->mute; -+ else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) -+ ucontrol->value.integer.value[0] = chip->dest; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return 0; -+} -+ -+static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ int changed = 0; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { -+ audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); -+ if (chip->mute == CTRL_VOL_MUTE) { -+ /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ -+ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ -+ goto unlock; -+ } -+ if (changed -+ || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { -+ -+ chip->volume = alsa2chip(ucontrol->value.integer.value[0]); -+ changed = 1; -+ } -+ -+ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { -+ /* Now implemented */ -+ audio_info(" Mute attempted\n"); -+ changed = toggle_mute(chip, ucontrol->value.integer.value[0]); -+ -+ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { -+ if (ucontrol->value.integer.value[0] != chip->dest) { -+ chip->dest = ucontrol->value.integer.value[0]; -+ changed = 1; -+ } -+ } -+ -+ if (changed) { -+ if (bcm2835_audio_set_ctls(chip)) -+ printk(KERN_ERR "Failed to set ALSA controls..\n"); -+ } -+ -+unlock: -+ mutex_unlock(&chip->audio_mutex); -+ return changed; -+} -+ -+static DECLARE_TLV_DB_SCALE(snd_bcm2835_db_scale, CTRL_VOL_MIN, 1, 1); -+ -+static struct snd_kcontrol_new snd_bcm2835_ctl[] = { -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Volume", -+ .index = 0, -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, -+ .private_value = PCM_PLAYBACK_VOLUME, -+ .info = snd_bcm2835_ctl_info, -+ .get = snd_bcm2835_ctl_get, -+ .put = snd_bcm2835_ctl_put, -+ .count = 1, -+ .tlv = {.p = snd_bcm2835_db_scale} -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Switch", -+ .index = 0, -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, -+ .private_value = PCM_PLAYBACK_MUTE, -+ .info = snd_bcm2835_ctl_info, -+ .get = snd_bcm2835_ctl_get, -+ .put = snd_bcm2835_ctl_put, -+ .count = 1, -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Route", -+ .index = 0, -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, -+ .private_value = PCM_PLAYBACK_DEVICE, -+ .info = snd_bcm2835_ctl_info, -+ .get = snd_bcm2835_ctl_get, -+ .put = snd_bcm2835_ctl_put, -+ .count = 1, -+ }, -+}; -+ -+static int snd_bcm2835_spdif_default_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ int i; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ ucontrol->value.iec958.status[i] = -+ (chip->spdif_status >> (i * 8)) && 0xff; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ unsigned int val = 0; -+ int i, change; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); -+ -+ change = val != chip->spdif_status; -+ chip->spdif_status = val; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return change; -+} -+ -+static int snd_bcm2835_spdif_mask_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ /* bcm2835 supports only consumer mode and sets all other format flags -+ * automatically. So the only thing left is signalling non-audio -+ * content */ -+ ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_stream_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ int i; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ ucontrol->value.iec958.status[i] = -+ (chip->spdif_status >> (i * 8)) & 0xff; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ unsigned int val = 0; -+ int i, change; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); -+ change = val != chip->spdif_status; -+ chip->spdif_status = val; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return change; -+} -+ -+static struct snd_kcontrol_new snd_bcm2835_spdif[] = { -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), -+ .info = snd_bcm2835_spdif_default_info, -+ .get = snd_bcm2835_spdif_default_get, -+ .put = snd_bcm2835_spdif_default_put -+ }, -+ { -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), -+ .info = snd_bcm2835_spdif_mask_info, -+ .get = snd_bcm2835_spdif_mask_get, -+ }, -+ { -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | -+ SNDRV_CTL_ELEM_ACCESS_INACTIVE, -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), -+ .info = snd_bcm2835_spdif_stream_info, -+ .get = snd_bcm2835_spdif_stream_get, -+ .put = snd_bcm2835_spdif_stream_put, -+ }, -+}; -+ -+int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) -+{ -+ int err; -+ unsigned int idx; -+ -+ strcpy(chip->card->mixername, "Broadcom Mixer"); -+ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_ctl); idx++) { -+ err = -+ snd_ctl_add(chip->card, -+ snd_ctl_new1(&snd_bcm2835_ctl[idx], chip)); -+ if (err < 0) -+ return err; -+ } -+ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { -+ err = snd_ctl_add(chip->card, -+ snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); -+ if (err < 0) -+ return err; -+ } -+ return 0; -+} -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -new file mode 100755 -index 0000000000000000000000000000000000000000..71b128924affac2b7a01d1169e43d437bb1d0c1a ---- /dev/null -+++ b/sound/arm/bcm2835-pcm.c -@@ -0,0 +1,563 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+ -+#include -+ -+#include "bcm2835.h" -+ -+/* hardware definition */ -+static struct snd_pcm_hardware snd_bcm2835_playback_hw = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -+ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), -+ .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, -+ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, -+ .rate_min = 8000, -+ .rate_max = 48000, -+ .channels_min = 1, -+ .channels_max = 2, -+ .buffer_bytes_max = 128 * 1024, -+ .period_bytes_min = 1 * 1024, -+ .period_bytes_max = 128 * 1024, -+ .periods_min = 1, -+ .periods_max = 128, -+}; -+ -+static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -+ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), -+ .formats = SNDRV_PCM_FMTBIT_S16_LE, -+ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | -+ SNDRV_PCM_RATE_48000, -+ .rate_min = 44100, -+ .rate_max = 48000, -+ .channels_min = 2, -+ .channels_max = 2, -+ .buffer_bytes_max = 128 * 1024, -+ .period_bytes_min = 1 * 1024, -+ .period_bytes_max = 128 * 1024, -+ .periods_min = 1, -+ .periods_max = 128, -+}; -+ -+static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime) -+{ -+ audio_info("Freeing up alsa stream here ..\n"); -+ if (runtime->private_data) -+ kfree(runtime->private_data); -+ runtime->private_data = NULL; -+} -+ -+static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) -+{ -+ bcm2835_alsa_stream_t *alsa_stream = (bcm2835_alsa_stream_t *) dev_id; -+ uint32_t consumed = 0; -+ int new_period = 0; -+ -+ audio_info(" .. IN\n"); -+ -+ audio_info("alsa_stream=%p substream=%p\n", alsa_stream, -+ alsa_stream ? alsa_stream->substream : 0); -+ -+ if (alsa_stream->open) -+ consumed = bcm2835_audio_retrieve_buffers(alsa_stream); -+ -+ /* We get called only if playback was triggered, So, the number of buffers we retrieve in -+ * each iteration are the buffers that have been played out already -+ */ -+ -+ if (alsa_stream->period_size) { -+ if ((alsa_stream->pos / alsa_stream->period_size) != -+ ((alsa_stream->pos + consumed) / alsa_stream->period_size)) -+ new_period = 1; -+ } -+ audio_debug("updating pos cur: %d + %d max:%d period_bytes:%d, hw_ptr: %d new_period:%d\n", -+ alsa_stream->pos, -+ consumed, -+ alsa_stream->buffer_size, -+ (int)(alsa_stream->period_size*alsa_stream->substream->runtime->periods), -+ frames_to_bytes(alsa_stream->substream->runtime, alsa_stream->substream->runtime->status->hw_ptr), -+ new_period); -+ if (alsa_stream->buffer_size) { -+ alsa_stream->pos += consumed &~ (1<<30); -+ alsa_stream->pos %= alsa_stream->buffer_size; -+ } -+ -+ if (alsa_stream->substream) { -+ if (new_period) -+ snd_pcm_period_elapsed(alsa_stream->substream); -+ } else { -+ audio_warning(" unexpected NULL substream\n"); -+ } -+ audio_info(" .. OUT\n"); -+ -+ return IRQ_HANDLED; -+} -+ -+/* open callback */ -+static int snd_bcm2835_playback_open_generic( -+ struct snd_pcm_substream *substream, int spdif) -+{ -+ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream; -+ int idx; -+ int err; -+ -+ audio_info(" .. IN (%d)\n", substream->number); -+ -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ audio_info("Alsa open (%d)\n", substream->number); -+ idx = substream->number; -+ -+ if (spdif && chip->opened != 0) { -+ err = -EBUSY; -+ goto out; -+ } -+ else if (!spdif && (chip->opened & (1 << idx))) { -+ err = -EBUSY; -+ goto out; -+ } -+ if (idx > MAX_SUBSTREAMS) { -+ audio_error -+ ("substream(%d) device doesn't exist max(%d) substreams allowed\n", -+ idx, MAX_SUBSTREAMS); -+ err = -ENODEV; -+ goto out; -+ } -+ -+ /* Check if we are ready */ -+ if (!(chip->avail_substreams & (1 << idx))) { -+ /* We are not ready yet */ -+ audio_error("substream(%d) device is not ready yet\n", idx); -+ err = -EAGAIN; -+ goto out; -+ } -+ -+ alsa_stream = kzalloc(sizeof(bcm2835_alsa_stream_t), GFP_KERNEL); -+ if (alsa_stream == NULL) { -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ /* Initialise alsa_stream */ -+ alsa_stream->chip = chip; -+ alsa_stream->substream = substream; -+ alsa_stream->idx = idx; -+ -+ sema_init(&alsa_stream->buffers_update_sem, 0); -+ sema_init(&alsa_stream->control_sem, 0); -+ spin_lock_init(&alsa_stream->lock); -+ -+ /* Enabled in start trigger, called on each "fifo irq" after that */ -+ alsa_stream->enable_fifo_irq = 0; -+ alsa_stream->fifo_irq_handler = bcm2835_playback_fifo_irq; -+ -+ err = bcm2835_audio_open(alsa_stream); -+ if (err != 0) { -+ kfree(alsa_stream); -+ goto out; -+ } -+ runtime->private_data = alsa_stream; -+ runtime->private_free = snd_bcm2835_playback_free; -+ if (spdif) { -+ runtime->hw = snd_bcm2835_playback_spdif_hw; -+ } else { -+ /* clear spdif status, as we are not in spdif mode */ -+ chip->spdif_status = 0; -+ runtime->hw = snd_bcm2835_playback_hw; -+ } -+ /* minimum 16 bytes alignment (for vchiq bulk transfers) */ -+ snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -+ 16); -+ -+ chip->alsa_stream[idx] = alsa_stream; -+ -+ chip->opened |= (1 << idx); -+ alsa_stream->open = 1; -+ alsa_stream->draining = 1; -+ -+out: -+ mutex_unlock(&chip->audio_mutex); -+ -+ audio_info(" .. OUT =%d\n", err); -+ -+ return err; -+} -+ -+static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream) -+{ -+ return snd_bcm2835_playback_open_generic(substream, 0); -+} -+ -+static int snd_bcm2835_playback_spdif_open(struct snd_pcm_substream *substream) -+{ -+ return snd_bcm2835_playback_open_generic(substream, 1); -+} -+ -+/* close callback */ -+static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) -+{ -+ /* the hardware-specific codes will be here */ -+ -+ bcm2835_chip_t *chip; -+ struct snd_pcm_runtime *runtime; -+ bcm2835_alsa_stream_t *alsa_stream; -+ -+ audio_info(" .. IN\n"); -+ -+ chip = snd_pcm_substream_chip(substream); -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ runtime = substream->runtime; -+ alsa_stream = runtime->private_data; -+ -+ audio_info("Alsa close\n"); -+ -+ /* -+ * Call stop if it's still running. This happens when app -+ * is force killed and we don't get a stop trigger. -+ */ -+ if (alsa_stream->running) { -+ int err; -+ err = bcm2835_audio_stop(alsa_stream); -+ alsa_stream->running = 0; -+ if (err != 0) -+ audio_error(" Failed to STOP alsa device\n"); -+ } -+ -+ alsa_stream->period_size = 0; -+ alsa_stream->buffer_size = 0; -+ -+ if (alsa_stream->open) { -+ alsa_stream->open = 0; -+ bcm2835_audio_close(alsa_stream); -+ } -+ if (alsa_stream->chip) -+ alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL; -+ /* -+ * Do not free up alsa_stream here, it will be freed up by -+ * runtime->private_free callback we registered in *_open above -+ */ -+ -+ chip->opened &= ~(1 << substream->number); -+ -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ -+ return 0; -+} -+ -+/* hw_params callback */ -+static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ -+ err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); -+ if (err < 0) { -+ audio_error -+ (" pcm_lib_malloc failed to allocated pages for buffers\n"); -+ return err; -+ } -+ -+ alsa_stream->channels = params_channels(params); -+ alsa_stream->params_rate = params_rate(params); -+ alsa_stream->pcm_format_width = snd_pcm_format_width(params_format (params)); -+ audio_info(" .. OUT\n"); -+ -+ return err; -+} -+ -+/* hw_free callback */ -+static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) -+{ -+ audio_info(" .. IN\n"); -+ return snd_pcm_lib_free_pages(substream); -+} -+ -+/* prepare callback */ -+static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) -+{ -+ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ int channels; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ /* notify the vchiq that it should enter spdif passthrough mode by -+ * setting channels=0 (see -+ * https://github.com/raspberrypi/linux/issues/528) */ -+ if (chip->spdif_status & IEC958_AES0_NONAUDIO) -+ channels = 0; -+ else -+ channels = alsa_stream->channels; -+ -+ err = bcm2835_audio_set_params(alsa_stream, channels, -+ alsa_stream->params_rate, -+ alsa_stream->pcm_format_width); -+ if (err < 0) { -+ audio_error(" error setting hw params\n"); -+ } -+ -+ bcm2835_audio_setup(alsa_stream); -+ -+ /* in preparation of the stream, set the controls (volume level) of the stream */ -+ bcm2835_audio_set_ctls(alsa_stream->chip); -+ -+ -+ memset(&alsa_stream->pcm_indirect, 0, sizeof(alsa_stream->pcm_indirect)); -+ -+ alsa_stream->pcm_indirect.hw_buffer_size = -+ alsa_stream->pcm_indirect.sw_buffer_size = -+ snd_pcm_lib_buffer_bytes(substream); -+ -+ alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); -+ alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); -+ alsa_stream->pos = 0; -+ -+ audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", -+ alsa_stream->buffer_size, alsa_stream->period_size, -+ alsa_stream->pos, runtime->frame_bits); -+ -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ return 0; -+} -+ -+static void snd_bcm2835_pcm_transfer(struct snd_pcm_substream *substream, -+ struct snd_pcm_indirect *rec, size_t bytes) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ void *src = (void *)(substream->runtime->dma_area + rec->sw_data); -+ int err; -+ -+ err = bcm2835_audio_write(alsa_stream, bytes, src); -+ if (err) -+ audio_error(" Failed to transfer to alsa device (%d)\n", err); -+ -+} -+ -+static int snd_bcm2835_pcm_ack(struct snd_pcm_substream *substream) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ struct snd_pcm_indirect *pcm_indirect = &alsa_stream->pcm_indirect; -+ -+ pcm_indirect->hw_queue_size = runtime->hw.buffer_bytes_max; -+ snd_pcm_indirect_playback_transfer(substream, pcm_indirect, -+ snd_bcm2835_pcm_transfer); -+ return 0; -+} -+ -+/* trigger callback */ -+static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ int err = 0; -+ -+ audio_info(" .. IN\n"); -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ audio_debug("bcm2835_AUDIO_TRIGGER_START running=%d\n", -+ alsa_stream->running); -+ if (!alsa_stream->running) { -+ err = bcm2835_audio_start(alsa_stream); -+ if (err == 0) { -+ alsa_stream->pcm_indirect.hw_io = -+ alsa_stream->pcm_indirect.hw_data = -+ bytes_to_frames(runtime, -+ alsa_stream->pos); -+ substream->ops->ack(substream); -+ alsa_stream->running = 1; -+ alsa_stream->draining = 1; -+ } else { -+ audio_error(" Failed to START alsa device (%d)\n", err); -+ } -+ } -+ break; -+ case SNDRV_PCM_TRIGGER_STOP: -+ audio_debug -+ ("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n", -+ alsa_stream->running, runtime->status->state == SNDRV_PCM_STATE_DRAINING); -+ if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { -+ audio_info("DRAINING\n"); -+ alsa_stream->draining = 1; -+ } else { -+ audio_info("DROPPING\n"); -+ alsa_stream->draining = 0; -+ } -+ if (alsa_stream->running) { -+ err = bcm2835_audio_stop(alsa_stream); -+ if (err != 0) -+ audio_error(" Failed to STOP alsa device (%d)\n", err); -+ alsa_stream->running = 0; -+ } -+ break; -+ default: -+ err = -EINVAL; -+ } -+ -+ audio_info(" .. OUT\n"); -+ return err; -+} -+ -+/* pointer callback */ -+static snd_pcm_uframes_t -+snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ -+ audio_info(" .. IN\n"); -+ -+ audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0, -+ frames_to_bytes(runtime, runtime->status->hw_ptr), -+ frames_to_bytes(runtime, runtime->control->appl_ptr), -+ alsa_stream->pos); -+ -+ audio_info(" .. OUT\n"); -+ return snd_pcm_indirect_playback_pointer(substream, -+ &alsa_stream->pcm_indirect, -+ alsa_stream->pos); -+} -+ -+static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream, -+ unsigned int cmd, void *arg) -+{ -+ int ret = snd_pcm_lib_ioctl(substream, cmd, arg); -+ audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream, -+ cmd, arg, arg ? *(unsigned *)arg : 0, ret); -+ return ret; -+} -+ -+/* operators */ -+static struct snd_pcm_ops snd_bcm2835_playback_ops = { -+ .open = snd_bcm2835_playback_open, -+ .close = snd_bcm2835_playback_close, -+ .ioctl = snd_bcm2835_pcm_lib_ioctl, -+ .hw_params = snd_bcm2835_pcm_hw_params, -+ .hw_free = snd_bcm2835_pcm_hw_free, -+ .prepare = snd_bcm2835_pcm_prepare, -+ .trigger = snd_bcm2835_pcm_trigger, -+ .pointer = snd_bcm2835_pcm_pointer, -+ .ack = snd_bcm2835_pcm_ack, -+}; -+ -+static struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = { -+ .open = snd_bcm2835_playback_spdif_open, -+ .close = snd_bcm2835_playback_close, -+ .ioctl = snd_bcm2835_pcm_lib_ioctl, -+ .hw_params = snd_bcm2835_pcm_hw_params, -+ .hw_free = snd_bcm2835_pcm_hw_free, -+ .prepare = snd_bcm2835_pcm_prepare, -+ .trigger = snd_bcm2835_pcm_trigger, -+ .pointer = snd_bcm2835_pcm_pointer, -+ .ack = snd_bcm2835_pcm_ack, -+}; -+ -+/* create a pcm device */ -+int snd_bcm2835_new_pcm(bcm2835_chip_t * chip) -+{ -+ struct snd_pcm *pcm; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ mutex_init(&chip->audio_mutex); -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ err = -+ snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm); -+ if (err < 0) -+ goto out; -+ pcm->private_data = chip; -+ strcpy(pcm->name, "bcm2835 ALSA"); -+ chip->pcm = pcm; -+ chip->dest = AUDIO_DEST_AUTO; -+ chip->volume = alsa2chip(0); -+ chip->mute = CTRL_VOL_UNMUTE; /*disable mute on startup */ -+ /* set operators */ -+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, -+ &snd_bcm2835_playback_ops); -+ -+ /* pre-allocation of buffers */ -+ /* NOTE: this may fail */ -+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, -+ snd_dma_continuous_data (GFP_KERNEL), -+ snd_bcm2835_playback_hw.buffer_bytes_max, snd_bcm2835_playback_hw.buffer_bytes_max); -+ -+ -+out: -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ -+ return 0; -+} -+ -+int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip) -+{ -+ struct snd_pcm *pcm; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm); -+ if (err < 0) -+ goto out; -+ -+ pcm->private_data = chip; -+ strcpy(pcm->name, "bcm2835 IEC958/HDMI"); -+ chip->pcm_spdif = pcm; -+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, -+ &snd_bcm2835_playback_spdif_ops); -+ -+ /* pre-allocation of buffers */ -+ /* NOTE: this may fail */ -+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, -+ snd_dma_continuous_data (GFP_KERNEL), -+ snd_bcm2835_playback_spdif_hw.buffer_bytes_max, snd_bcm2835_playback_spdif_hw.buffer_bytes_max); -+out: -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ -+ return 0; -+} -diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c -new file mode 100755 -index 0000000000000000000000000000000000000000..7ee436ca9fa2903d41d1bdd8f8f0774025d22ae0 ---- /dev/null -+++ b/sound/arm/bcm2835-vchiq.c -@@ -0,0 +1,889 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* ---- Include Files -------------------------------------------------------- */ -+ -+#include "interface/vchi/vchi.h" -+#include "vc_vchi_audioserv_defs.h" -+ -+/* ---- Private Constants and Types ------------------------------------------ */ -+ -+#define BCM2835_AUDIO_STOP 0 -+#define BCM2835_AUDIO_START 1 -+#define BCM2835_AUDIO_WRITE 2 -+ -+/* Logging macros (for remapping to other logging mechanisms, i.e., printf) */ -+#ifdef AUDIO_DEBUG_ENABLE -+ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_WARN( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_INFO( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_DBG( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) -+#else -+ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_WARN( fmt, arg... ) -+ #define LOG_INFO( fmt, arg... ) -+ #define LOG_DBG( fmt, arg... ) -+#endif -+ -+typedef struct opaque_AUDIO_INSTANCE_T { -+ uint32_t num_connections; -+ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; -+ struct completion msg_avail_comp; -+ struct mutex vchi_mutex; -+ bcm2835_alsa_stream_t *alsa_stream; -+ int32_t result; -+ short peer_version; -+} AUDIO_INSTANCE_T; -+ -+bool force_bulk = false; -+ -+/* ---- Private Variables ---------------------------------------------------- */ -+ -+/* ---- Private Function Prototypes ------------------------------------------ */ -+ -+/* ---- Private Functions ---------------------------------------------------- */ -+ -+static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream); -+static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream); -+static int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, -+ uint32_t count, void *src); -+ -+typedef struct { -+ struct work_struct my_work; -+ bcm2835_alsa_stream_t *alsa_stream; -+ int cmd; -+ void *src; -+ uint32_t count; -+} my_work_t; -+ -+static void my_wq_function(struct work_struct *work) -+{ -+ my_work_t *w = (my_work_t *) work; -+ int ret = -9; -+ LOG_DBG(" .. IN %p:%d\n", w->alsa_stream, w->cmd); -+ switch (w->cmd) { -+ case BCM2835_AUDIO_START: -+ ret = bcm2835_audio_start_worker(w->alsa_stream); -+ break; -+ case BCM2835_AUDIO_STOP: -+ ret = bcm2835_audio_stop_worker(w->alsa_stream); -+ break; -+ case BCM2835_AUDIO_WRITE: -+ ret = bcm2835_audio_write_worker(w->alsa_stream, w->count, -+ w->src); -+ break; -+ default: -+ LOG_ERR(" Unexpected work: %p:%d\n", w->alsa_stream, w->cmd); -+ break; -+ } -+ kfree((void *)work); -+ LOG_DBG(" .. OUT %d\n", ret); -+} -+ -+int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ int ret = -1; -+ LOG_DBG(" .. IN\n"); -+ if (alsa_stream->my_wq) { -+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); -+ /*--- Queue some work (item 1) ---*/ -+ if (work) { -+ INIT_WORK((struct work_struct *)work, my_wq_function); -+ work->alsa_stream = alsa_stream; -+ work->cmd = BCM2835_AUDIO_START; -+ if (queue_work -+ (alsa_stream->my_wq, (struct work_struct *)work)) -+ ret = 0; -+ } else -+ LOG_ERR(" .. Error: NULL work kmalloc\n"); -+ } -+ LOG_DBG(" .. OUT %d\n", ret); -+ return ret; -+} -+ -+int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ int ret = -1; -+ LOG_DBG(" .. IN\n"); -+ if (alsa_stream->my_wq) { -+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); -+ /*--- Queue some work (item 1) ---*/ -+ if (work) { -+ INIT_WORK((struct work_struct *)work, my_wq_function); -+ work->alsa_stream = alsa_stream; -+ work->cmd = BCM2835_AUDIO_STOP; -+ if (queue_work -+ (alsa_stream->my_wq, (struct work_struct *)work)) -+ ret = 0; -+ } else -+ LOG_ERR(" .. Error: NULL work kmalloc\n"); -+ } -+ LOG_DBG(" .. OUT %d\n", ret); -+ return ret; -+} -+ -+int bcm2835_audio_write(bcm2835_alsa_stream_t *alsa_stream, -+ uint32_t count, void *src) -+{ -+ int ret = -1; -+ LOG_DBG(" .. IN\n"); -+ if (alsa_stream->my_wq) { -+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); -+ /*--- Queue some work (item 1) ---*/ -+ if (work) { -+ INIT_WORK((struct work_struct *)work, my_wq_function); -+ work->alsa_stream = alsa_stream; -+ work->cmd = BCM2835_AUDIO_WRITE; -+ work->src = src; -+ work->count = count; -+ if (queue_work -+ (alsa_stream->my_wq, (struct work_struct *)work)) -+ ret = 0; -+ } else -+ LOG_ERR(" .. Error: NULL work kmalloc\n"); -+ } -+ LOG_DBG(" .. OUT %d\n", ret); -+ return ret; -+} -+ -+void my_workqueue_init(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ alsa_stream->my_wq = alloc_workqueue("my_queue", WQ_HIGHPRI, 1); -+ return; -+} -+ -+void my_workqueue_quit(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ if (alsa_stream->my_wq) { -+ flush_workqueue(alsa_stream->my_wq); -+ destroy_workqueue(alsa_stream->my_wq); -+ alsa_stream->my_wq = NULL; -+ } -+ return; -+} -+ -+static void audio_vchi_callback(void *param, -+ const VCHI_CALLBACK_REASON_T reason, -+ void *msg_handle) -+{ -+ AUDIO_INSTANCE_T *instance = (AUDIO_INSTANCE_T *) param; -+ int32_t status; -+ int32_t msg_len; -+ VC_AUDIO_MSG_T m; -+ LOG_DBG(" .. IN instance=%p, handle=%p, alsa=%p, reason=%d, handle=%p\n", -+ instance, instance ? instance->vchi_handle[0] : NULL, instance ? instance->alsa_stream : NULL, reason, msg_handle); -+ -+ if (reason != VCHI_CALLBACK_MSG_AVAILABLE) { -+ return; -+ } -+ if (!instance) { -+ LOG_ERR(" .. instance is null\n"); -+ BUG(); -+ return; -+ } -+ if (!instance->vchi_handle[0]) { -+ LOG_ERR(" .. instance->vchi_handle[0] is null\n"); -+ BUG(); -+ return; -+ } -+ status = vchi_msg_dequeue(instance->vchi_handle[0], -+ &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); -+ if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { -+ LOG_DBG -+ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_RESULT, success=%d\n", -+ instance, m.u.result.success); -+ instance->result = m.u.result.success; -+ complete(&instance->msg_avail_comp); -+ } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { -+ bcm2835_alsa_stream_t *alsa_stream = instance->alsa_stream; -+ irq_handler_t callback = (irq_handler_t) m.u.complete.callback; -+ LOG_DBG -+ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n", -+ instance, m.u.complete.count); -+ if (alsa_stream && callback) { -+ atomic_add(m.u.complete.count, &alsa_stream->retrieved); -+ callback(0, alsa_stream); -+ } else { -+ LOG_ERR(" .. unexpected alsa_stream=%p, callback=%p\n", -+ alsa_stream, callback); -+ } -+ } else { -+ LOG_ERR(" .. unexpected m.type=%d\n", m.type); -+ } -+ LOG_DBG(" .. OUT\n"); -+} -+ -+static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, -+ VCHI_CONNECTION_T ** -+ vchi_connections, -+ uint32_t num_connections) -+{ -+ uint32_t i; -+ AUDIO_INSTANCE_T *instance; -+ int status; -+ -+ LOG_DBG("%s: start", __func__); -+ -+ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { -+ LOG_ERR("%s: unsupported number of connections %u (max=%u)\n", -+ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); -+ -+ return NULL; -+ } -+ /* Allocate memory for this instance */ -+ instance = kmalloc(sizeof(*instance), GFP_KERNEL); -+ if (!instance) -+ return NULL; -+ -+ memset(instance, 0, sizeof(*instance)); -+ instance->num_connections = num_connections; -+ -+ /* Create a lock for exclusive, serialized VCHI connection access */ -+ mutex_init(&instance->vchi_mutex); -+ /* Open the VCHI service connections */ -+ for (i = 0; i < num_connections; i++) { -+ SERVICE_CREATION_T params = { -+ VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER), -+ VC_AUDIO_SERVER_NAME, // 4cc service code -+ vchi_connections[i], // passed in fn pointers -+ 0, // rx fifo size (unused) -+ 0, // tx fifo size (unused) -+ audio_vchi_callback, // service callback -+ instance, // service callback parameter -+ 1, //TODO: remove VCOS_FALSE, // unaligned bulk recieves -+ 1, //TODO: remove VCOS_FALSE, // unaligned bulk transmits -+ 0 // want crc check on bulk transfers -+ }; -+ -+ LOG_DBG("%s: about to open %i\n", __func__, i); -+ status = vchi_service_open(vchi_instance, ¶ms, -+ &instance->vchi_handle[i]); -+ LOG_DBG("%s: opened %i: %p=%d\n", __func__, i, instance->vchi_handle[i], status); -+ if (status) { -+ LOG_ERR -+ ("%s: failed to open VCHI service connection (status=%d)\n", -+ __func__, status); -+ -+ goto err_close_services; -+ } -+ /* Finished with the service for now */ -+ vchi_service_release(instance->vchi_handle[i]); -+ } -+ -+ LOG_DBG("%s: okay\n", __func__); -+ return instance; -+ -+err_close_services: -+ for (i = 0; i < instance->num_connections; i++) { -+ LOG_ERR("%s: closing %i: %p\n", __func__, i, instance->vchi_handle[i]); -+ if (instance->vchi_handle[i]) -+ vchi_service_close(instance->vchi_handle[i]); -+ } -+ -+ kfree(instance); -+ LOG_ERR("%s: error\n", __func__); -+ -+ return NULL; -+} -+ -+static int32_t vc_vchi_audio_deinit(AUDIO_INSTANCE_T * instance) -+{ -+ uint32_t i; -+ -+ LOG_DBG(" .. IN\n"); -+ -+ if (instance == NULL) { -+ LOG_ERR("%s: invalid handle %p\n", __func__, instance); -+ -+ return -1; -+ } -+ -+ LOG_DBG(" .. about to lock (%d)\n", instance->num_connections); -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ -+ /* Close all VCHI service connections */ -+ for (i = 0; i < instance->num_connections; i++) { -+ int32_t success; -+ LOG_DBG(" .. %i:closing %p\n", i, instance->vchi_handle[i]); -+ vchi_service_use(instance->vchi_handle[i]); -+ -+ success = vchi_service_close(instance->vchi_handle[i]); -+ if (success != 0) { -+ LOG_DBG -+ ("%s: failed to close VCHI service connection (status=%d)\n", -+ __func__, success); -+ } -+ } -+ -+ mutex_unlock(&instance->vchi_mutex); -+ -+ kfree(instance); -+ -+ LOG_DBG(" .. OUT\n"); -+ -+ return 0; -+} -+ -+static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ static VCHI_INSTANCE_T vchi_instance; -+ static VCHI_CONNECTION_T *vchi_connection; -+ static int initted; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO("%s: start\n", __func__); -+ BUG_ON(instance); -+ if (instance) { -+ LOG_ERR("%s: VCHI instance already open (%p)\n", -+ __func__, instance); -+ instance->alsa_stream = alsa_stream; -+ alsa_stream->instance = instance; -+ ret = 0; // xxx todo -1; -+ goto err_free_mem; -+ } -+ -+ /* Initialize and create a VCHI connection */ -+ if (!initted) { -+ ret = vchi_initialise(&vchi_instance); -+ if (ret != 0) { -+ LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ ret = vchi_connect(NULL, 0, vchi_instance); -+ if (ret != 0) { -+ LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ initted = 1; -+ } -+ -+ /* Initialize an instance of the audio service */ -+ instance = vc_vchi_audio_init(vchi_instance, &vchi_connection, 1); -+ -+ if (instance == NULL) { -+ LOG_ERR("%s: failed to initialize audio service\n", __func__); -+ -+ ret = -EPERM; -+ goto err_free_mem; -+ } -+ -+ instance->alsa_stream = alsa_stream; -+ alsa_stream->instance = instance; -+ -+ LOG_DBG(" success !\n"); -+err_free_mem: -+ LOG_DBG(" .. OUT\n"); -+ -+ return ret; -+} -+ -+int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ AUDIO_INSTANCE_T *instance; -+ VC_AUDIO_MSG_T m; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ my_workqueue_init(alsa_stream); -+ -+ ret = bcm2835_audio_open_connection(alsa_stream); -+ if (ret != 0) { -+ ret = -1; -+ goto exit; -+ } -+ instance = alsa_stream->instance; -+ LOG_DBG(" instance (%p)\n", instance); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_OPEN; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+exit: -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+static int bcm2835_audio_set_ctls_chan(bcm2835_alsa_stream_t * alsa_stream, -+ bcm2835_chip_t * chip) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO -+ (" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ instance->result = -1; -+ -+ m.type = VC_AUDIO_MSG_TYPE_CONTROL; -+ m.u.control.dest = chip->dest; -+ m.u.control.volume = chip->volume; -+ -+ /* Create the message available completion */ -+ init_completion(&instance->msg_avail_comp); -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ /* We are expecting a reply from the videocore */ -+ wait_for_completion(&instance->msg_avail_comp); -+ -+ if (instance->result != 0) { -+ LOG_ERR("%s: result=%d\n", __func__, instance->result); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_set_ctls(bcm2835_chip_t * chip) -+{ -+ int i; -+ int ret = 0; -+ LOG_DBG(" .. IN\n"); -+ LOG_DBG(" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); -+ -+ /* change ctls for all substreams */ -+ for (i = 0; i < MAX_SUBSTREAMS; i++) { -+ if (chip->avail_substreams & (1 << i)) { -+ if (!chip->alsa_stream[i]) -+ { -+ LOG_DBG(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams); -+ ret = 0; -+ } -+ else if (bcm2835_audio_set_ctls_chan /* returns 0 on success */ -+ (chip->alsa_stream[i], chip) != 0) -+ { -+ LOG_ERR("Couldn't set the controls for stream %d\n", i); -+ ret = -1; -+ } -+ else LOG_DBG(" Controls set for stream %d\n", i); -+ } -+ } -+ LOG_DBG(" .. OUT ret=%d\n", ret); -+ return ret; -+} -+ -+int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, -+ uint32_t channels, uint32_t samplerate, -+ uint32_t bps) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO -+ (" Setting ALSA channels(%d), samplerate(%d), bits-per-sample(%d)\n", -+ channels, samplerate, bps); -+ -+ /* resend ctls - alsa_stream may not have been open when first send */ -+ ret = bcm2835_audio_set_ctls_chan(alsa_stream, alsa_stream->chip); -+ if (ret != 0) { -+ LOG_ERR(" Alsa controls not supported\n"); -+ return -EINVAL; -+ } -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ instance->result = -1; -+ -+ m.type = VC_AUDIO_MSG_TYPE_CONFIG; -+ m.u.config.channels = channels; -+ m.u.config.samplerate = samplerate; -+ m.u.config.bps = bps; -+ -+ /* Create the message available completion */ -+ init_completion(&instance->msg_avail_comp); -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ /* We are expecting a reply from the videocore */ -+ wait_for_completion(&instance->msg_avail_comp); -+ -+ if (instance->result != 0) { -+ LOG_ERR("%s: result=%d", __func__, instance->result); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_DBG(" .. OUT\n"); -+ -+ return 0; -+} -+ -+static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_START; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_STOP; -+ m.u.stop.draining = alsa_stream->draining; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ my_workqueue_quit(alsa_stream); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_CLOSE; -+ -+ /* Create the message available completion */ -+ init_completion(&instance->msg_avail_comp); -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ ret = -1; -+ goto unlock; -+ } -+ -+ /* We are expecting a reply from the videocore */ -+ wait_for_completion(&instance->msg_avail_comp); -+ -+ if (instance->result != 0) { -+ LOG_ERR("%s: failed result (result=%d)\n", -+ __func__, instance->result); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ -+ /* Stop the audio service */ -+ if (instance) { -+ vc_vchi_audio_deinit(instance); -+ alsa_stream->instance = NULL; -+ } -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, -+ uint32_t count, void *src) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO(" Writing %d bytes from %p\n", count, src); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ if ( instance->peer_version==0 && vchi_get_peer_version(instance->vchi_handle[0], &instance->peer_version) == 0 ) { -+ LOG_DBG("%s: client version %d connected\n", __func__, instance->peer_version); -+ } -+ m.type = VC_AUDIO_MSG_TYPE_WRITE; -+ m.u.write.count = count; -+ // old version uses bulk, new version uses control -+ m.u.write.max_packet = instance->peer_version < 2 || force_bulk ? 0:4000; -+ m.u.write.callback = alsa_stream->fifo_irq_handler; -+ m.u.write.cookie = alsa_stream; -+ m.u.write.silence = src == NULL; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ if (!m.u.write.silence) { -+ if (m.u.write.max_packet == 0) { -+ /* Send the message to the videocore */ -+ success = vchi_bulk_queue_transmit(instance->vchi_handle[0], -+ src, count, -+ 0 * -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED -+ + -+ 1 * -+ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, -+ NULL); -+ } else { -+ while (count > 0) { -+ int bytes = min((int)m.u.write.max_packet, (int)count); -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ src, bytes, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ src = (char *)src + bytes; -+ count -= bytes; -+ } -+ } -+ if (success != 0) { -+ LOG_ERR -+ ("%s: failed on vchi_bulk_queue_transmit (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ } -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+/** -+ * Returns all buffers from arm->vc -+ */ -+void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ LOG_DBG(" .. IN\n"); -+ LOG_DBG(" .. OUT\n"); -+ return; -+} -+ -+/** -+ * Forces VC to flush(drop) its filled playback buffers and -+ * return them the us. (VC->ARM) -+ */ -+void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ LOG_DBG(" .. IN\n"); -+ LOG_DBG(" .. OUT\n"); -+} -+ -+uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ uint32_t count = atomic_read(&alsa_stream->retrieved); -+ atomic_sub(count, &alsa_stream->retrieved); -+ return count; -+} -+ -+module_param(force_bulk, bool, 0444); -+MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); -diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c -new file mode 100644 -index 0000000000000000000000000000000000000000..7a2ed78ba19912aad37d46430c7ab36899880581 ---- /dev/null -+++ b/sound/arm/bcm2835.c -@@ -0,0 +1,511 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* module parameters (see "Module Parameters") */ -+/* SNDRV_CARDS: maximum number of cards supported by this module */ -+static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 }; -+static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL }; -+static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 }; -+ -+/* HACKY global pointers needed for successive probes to work : ssp -+ * But compared against the changes we will have to do in VC audio_ipc code -+ * to export 8 audio_ipc devices as a single IPC device and then monitor all -+ * four devices in a thread, this gets things done quickly and should be easier -+ * to debug if we run into issues -+ */ -+ -+static struct snd_card *g_card = NULL; -+static bcm2835_chip_t *g_chip = NULL; -+ -+static int snd_bcm2835_free(bcm2835_chip_t * chip) -+{ -+ kfree(chip); -+ return 0; -+} -+ -+/* component-destructor -+ * (see "Management of Cards and Components") -+ */ -+static int snd_bcm2835_dev_free(struct snd_device *device) -+{ -+ return snd_bcm2835_free(device->device_data); -+} -+ -+/* chip-specific constructor -+ * (see "Management of Cards and Components") -+ */ -+static int snd_bcm2835_create(struct snd_card *card, -+ struct platform_device *pdev, -+ bcm2835_chip_t ** rchip) -+{ -+ bcm2835_chip_t *chip; -+ int err; -+ static struct snd_device_ops ops = { -+ .dev_free = snd_bcm2835_dev_free, -+ }; -+ -+ *rchip = NULL; -+ -+ chip = kzalloc(sizeof(*chip), GFP_KERNEL); -+ if (chip == NULL) -+ return -ENOMEM; -+ -+ chip->card = card; -+ -+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); -+ if (err < 0) { -+ snd_bcm2835_free(chip); -+ return err; -+ } -+ -+ *rchip = chip; -+ return 0; -+} -+ -+static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ bcm2835_chip_t *chip; -+ struct snd_card *card; -+ u32 numchans; -+ int err, i; -+ -+ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", -+ &numchans); -+ if (err) { -+ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); -+ return err; -+ } -+ -+ if (numchans == 0 || numchans > MAX_SUBSTREAMS) { -+ numchans = MAX_SUBSTREAMS; -+ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n", -+ numchans); -+ } -+ -+ err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); -+ if (err) { -+ dev_err(dev, "Failed to create soundcard structure\n"); -+ return err; -+ } -+ -+ snd_card_set_dev(card, dev); -+ strcpy(card->driver, "bcm2835"); -+ strcpy(card->shortname, "bcm2835 ALSA"); -+ sprintf(card->longname, "%s", card->shortname); -+ -+ err = snd_bcm2835_create(card, pdev, &chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create bcm2835 chip\n"); -+ goto err_free; -+ } -+ -+ err = snd_bcm2835_new_pcm(chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create new bcm2835 pcm device\n"); -+ goto err_free; -+ } -+ -+ err = snd_bcm2835_new_spdif_pcm(chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n"); -+ goto err_free; -+ } -+ -+ err = snd_bcm2835_new_ctl(chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create new bcm2835 ctl\n"); -+ goto err_free; -+ } -+ -+ for (i = 0; i < numchans; i++) { -+ chip->avail_substreams |= (1 << i); -+ chip->pdev[i] = pdev; -+ } -+ -+ err = snd_card_register(card); -+ if (err) { -+ dev_err(dev, "Failed to register bcm2835 ALSA card \n"); -+ goto err_free; -+ } -+ -+ g_card = card; -+ g_chip = chip; -+ platform_set_drvdata(pdev, card); -+ audio_info("bcm2835 ALSA card created with %u channels\n", numchans); -+ -+ return 0; -+ -+err_free: -+ snd_card_free(card); -+ -+ return err; -+} -+ -+static int snd_bcm2835_alsa_probe(struct platform_device *pdev) -+{ -+ static int dev; -+ bcm2835_chip_t *chip; -+ struct snd_card *card; -+ int err; -+ -+ if (pdev->dev.of_node) -+ return snd_bcm2835_alsa_probe_dt(pdev); -+ -+ if (dev >= MAX_SUBSTREAMS) -+ return -ENODEV; -+ -+ if (!enable[dev]) { -+ dev++; -+ return -ENOENT; -+ } -+ -+ if (dev > 0) -+ goto add_register_map; -+ -+ err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, 0, &g_card); -+ if (err < 0) -+ goto out; -+ -+ snd_card_set_dev(g_card, &pdev->dev); -+ strcpy(g_card->driver, "bcm2835"); -+ strcpy(g_card->shortname, "bcm2835 ALSA"); -+ sprintf(g_card->longname, "%s", g_card->shortname); -+ -+ err = snd_bcm2835_create(g_card, pdev, &chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create bcm2835 chip\n"); -+ goto out_bcm2835_create; -+ } -+ -+ g_chip = chip; -+ err = snd_bcm2835_new_pcm(chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create new BCM2835 pcm device\n"); -+ goto out_bcm2835_new_pcm; -+ } -+ -+ err = snd_bcm2835_new_spdif_pcm(chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create new BCM2835 spdif pcm device\n"); -+ goto out_bcm2835_new_spdif; -+ } -+ -+ err = snd_bcm2835_new_ctl(chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create new BCM2835 ctl\n"); -+ goto out_bcm2835_new_ctl; -+ } -+ -+add_register_map: -+ card = g_card; -+ chip = g_chip; -+ -+ BUG_ON(!(card && chip)); -+ -+ chip->avail_substreams |= (1 << dev); -+ chip->pdev[dev] = pdev; -+ -+ if (dev == 0) { -+ err = snd_card_register(card); -+ if (err < 0) { -+ dev_err(&pdev->dev, -+ "Failed to register bcm2835 ALSA card \n"); -+ goto out_card_register; -+ } -+ platform_set_drvdata(pdev, card); -+ audio_info("bcm2835 ALSA card created!\n"); -+ } else { -+ audio_info("bcm2835 ALSA chip created!\n"); -+ platform_set_drvdata(pdev, (void *)dev); -+ } -+ -+ dev++; -+ -+ return 0; -+ -+out_card_register: -+out_bcm2835_new_ctl: -+out_bcm2835_new_spdif: -+out_bcm2835_new_pcm: -+out_bcm2835_create: -+ BUG_ON(!g_card); -+ if (snd_card_free(g_card)) -+ dev_err(&pdev->dev, "Failed to free Registered alsa card\n"); -+ g_card = NULL; -+out: -+ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */ -+ dev_err(&pdev->dev, "BCM2835 ALSA Probe failed !!\n"); -+ return err; -+} -+ -+static int snd_bcm2835_alsa_remove(struct platform_device *pdev) -+{ -+ uint32_t idx; -+ void *drv_data; -+ -+ drv_data = platform_get_drvdata(pdev); -+ -+ if (drv_data == (void *)g_card) { -+ /* This is the card device */ -+ snd_card_free((struct snd_card *)drv_data); -+ g_card = NULL; -+ g_chip = NULL; -+ } else { -+ idx = (uint32_t) drv_data; -+ if (g_card != NULL) { -+ BUG_ON(!g_chip); -+ /* We pass chip device numbers in audio ipc devices -+ * other than the one we registered our card with -+ */ -+ idx = (uint32_t) drv_data; -+ BUG_ON(!idx || idx > MAX_SUBSTREAMS); -+ g_chip->avail_substreams &= ~(1 << idx); -+ /* There should be atleast one substream registered -+ * after we are done here, as it wil be removed when -+ * the *remove* is called for the card device -+ */ -+ BUG_ON(!g_chip->avail_substreams); -+ } -+ } -+ -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_PM -+static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, -+ pm_message_t state) -+{ -+ return 0; -+} -+ -+static int snd_bcm2835_alsa_resume(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+#endif -+ -+static const struct of_device_id snd_bcm2835_of_match_table[] = { -+ { .compatible = "brcm,bcm2835-audio", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); -+ -+static struct platform_driver bcm2835_alsa0_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD0", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_bcm2835_of_match_table, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa1_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD1", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa2_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD2", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa3_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD3", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa4_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD4", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa5_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD5", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa6_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD6", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa7_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD7", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int bcm2835_alsa_device_init(void) -+{ -+ int err; -+ err = platform_driver_register(&bcm2835_alsa0_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto out; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa1_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_0; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa2_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_1; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa3_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_2; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa4_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_3; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa5_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_4; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa6_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_5; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa7_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_6; -+ } -+ -+ return 0; -+ -+unregister_6: -+ platform_driver_unregister(&bcm2835_alsa6_driver); -+unregister_5: -+ platform_driver_unregister(&bcm2835_alsa5_driver); -+unregister_4: -+ platform_driver_unregister(&bcm2835_alsa4_driver); -+unregister_3: -+ platform_driver_unregister(&bcm2835_alsa3_driver); -+unregister_2: -+ platform_driver_unregister(&bcm2835_alsa2_driver); -+unregister_1: -+ platform_driver_unregister(&bcm2835_alsa1_driver); -+unregister_0: -+ platform_driver_unregister(&bcm2835_alsa0_driver); -+out: -+ return err; -+} -+ -+static void bcm2835_alsa_device_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_alsa0_driver); -+ platform_driver_unregister(&bcm2835_alsa1_driver); -+ platform_driver_unregister(&bcm2835_alsa2_driver); -+ platform_driver_unregister(&bcm2835_alsa3_driver); -+ platform_driver_unregister(&bcm2835_alsa4_driver); -+ platform_driver_unregister(&bcm2835_alsa5_driver); -+ platform_driver_unregister(&bcm2835_alsa6_driver); -+ platform_driver_unregister(&bcm2835_alsa7_driver); -+} -+ -+late_initcall(bcm2835_alsa_device_init); -+module_exit(bcm2835_alsa_device_exit); -+ -+MODULE_AUTHOR("Dom Cobley"); -+MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:bcm2835_alsa"); -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -new file mode 100755 -index 0000000000000000000000000000000000000000..0f71c5def314a63252fa4fe18ae2ba5a339f2cfb ---- /dev/null -+++ b/sound/arm/bcm2835.h -@@ -0,0 +1,167 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __SOUND_ARM_BCM2835_H -+#define __SOUND_ARM_BCM2835_H -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* -+#define AUDIO_DEBUG_ENABLE -+#define AUDIO_VERBOSE_DEBUG_ENABLE -+*/ -+ -+/* Debug macros */ -+ -+#ifdef AUDIO_DEBUG_ENABLE -+#ifdef AUDIO_VERBOSE_DEBUG_ENABLE -+ -+#define audio_debug(fmt, arg...) \ -+ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_info(fmt, arg...) \ -+ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#else -+ -+#define audio_debug(fmt, arg...) -+ -+#define audio_info(fmt, arg...) -+ -+#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */ -+ -+#else -+ -+#define audio_debug(fmt, arg...) -+ -+#define audio_info(fmt, arg...) -+ -+#endif /* AUDIO_DEBUG_ENABLE */ -+ -+#define audio_error(fmt, arg...) \ -+ printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_warning(fmt, arg...) \ -+ printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_alert(fmt, arg...) \ -+ printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define MAX_SUBSTREAMS (8) -+#define AVAIL_SUBSTREAMS_MASK (0xff) -+enum { -+ CTRL_VOL_MUTE, -+ CTRL_VOL_UNMUTE -+}; -+ -+/* macros for alsa2chip and chip2alsa, instead of functions */ -+ -+#define alsa2chip(vol) (uint)(-((vol << 8) / 100)) /* convert alsa to chip volume (defined as macro rather than function call) */ -+#define chip2alsa(vol) -((vol * 100) >> 8) /* convert chip to alsa volume */ -+ -+/* Some constants for values .. */ -+typedef enum { -+ AUDIO_DEST_AUTO = 0, -+ AUDIO_DEST_HEADPHONES = 1, -+ AUDIO_DEST_HDMI = 2, -+ AUDIO_DEST_MAX, -+} SND_BCM2835_ROUTE_T; -+ -+typedef enum { -+ PCM_PLAYBACK_VOLUME, -+ PCM_PLAYBACK_MUTE, -+ PCM_PLAYBACK_DEVICE, -+} SND_BCM2835_CTRL_T; -+ -+/* definition of the chip-specific record */ -+typedef struct bcm2835_chip { -+ struct snd_card *card; -+ struct snd_pcm *pcm; -+ struct snd_pcm *pcm_spdif; -+ /* Bitmat for valid reg_base and irq numbers */ -+ uint32_t avail_substreams; -+ struct platform_device *pdev[MAX_SUBSTREAMS]; -+ struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS]; -+ -+ int volume; -+ int old_volume; /* stores the volume value whist muted */ -+ int dest; -+ int mute; -+ -+ unsigned int opened; -+ unsigned int spdif_status; -+ struct mutex audio_mutex; -+} bcm2835_chip_t; -+ -+typedef struct bcm2835_alsa_stream { -+ bcm2835_chip_t *chip; -+ struct snd_pcm_substream *substream; -+ struct snd_pcm_indirect pcm_indirect; -+ -+ struct semaphore buffers_update_sem; -+ struct semaphore control_sem; -+ spinlock_t lock; -+ volatile uint32_t control; -+ volatile uint32_t status; -+ -+ int open; -+ int running; -+ int draining; -+ -+ int channels; -+ int params_rate; -+ int pcm_format_width; -+ -+ unsigned int pos; -+ unsigned int buffer_size; -+ unsigned int period_size; -+ -+ uint32_t enable_fifo_irq; -+ irq_handler_t fifo_irq_handler; -+ -+ atomic_t retrieved; -+ struct opaque_AUDIO_INSTANCE_T *instance; -+ struct workqueue_struct *my_wq; -+ int idx; -+} bcm2835_alsa_stream_t; -+ -+int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); -+int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); -+int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); -+ -+int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, -+ uint32_t channels, uint32_t samplerate, -+ uint32_t bps); -+int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_set_ctls(bcm2835_chip_t * chip); -+int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count, -+ void *src); -+uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream); -+ -+#endif /* __SOUND_ARM_BCM2835_H */ -diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h -new file mode 100644 -index 0000000000000000000000000000000000000000..af3e6eb690113fc32ce9e06bd2f0f294da7a7f00 ---- /dev/null -+++ b/sound/arm/vc_vchi_audioserv_defs.h -@@ -0,0 +1,116 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef _VC_AUDIO_DEFS_H_ -+#define _VC_AUDIO_DEFS_H_ -+ -+#define VC_AUDIOSERV_MIN_VER 1 -+#define VC_AUDIOSERV_VER 2 -+ -+// FourCC code used for VCHI connection -+#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -+ -+// Maximum message length -+#define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T )) -+ -+// List of screens that are currently supported -+// All message types supported for HOST->VC direction -+typedef enum { -+ VC_AUDIO_MSG_TYPE_RESULT, // Generic result -+ VC_AUDIO_MSG_TYPE_COMPLETE, // Generic result -+ VC_AUDIO_MSG_TYPE_CONFIG, // Configure audio -+ VC_AUDIO_MSG_TYPE_CONTROL, // Configure audio -+ VC_AUDIO_MSG_TYPE_OPEN, // Configure audio -+ VC_AUDIO_MSG_TYPE_CLOSE, // Configure audio -+ VC_AUDIO_MSG_TYPE_START, // Configure audio -+ VC_AUDIO_MSG_TYPE_STOP, // Configure audio -+ VC_AUDIO_MSG_TYPE_WRITE, // Configure audio -+ VC_AUDIO_MSG_TYPE_MAX -+} VC_AUDIO_MSG_TYPE; -+ -+// configure the audio -+typedef struct { -+ uint32_t channels; -+ uint32_t samplerate; -+ uint32_t bps; -+ -+} VC_AUDIO_CONFIG_T; -+ -+typedef struct { -+ uint32_t volume; -+ uint32_t dest; -+ -+} VC_AUDIO_CONTROL_T; -+ -+// audio -+typedef struct { -+ uint32_t dummy; -+ -+} VC_AUDIO_OPEN_T; -+ -+// audio -+typedef struct { -+ uint32_t dummy; -+ -+} VC_AUDIO_CLOSE_T; -+// audio -+typedef struct { -+ uint32_t dummy; -+ -+} VC_AUDIO_START_T; -+// audio -+typedef struct { -+ uint32_t draining; -+ -+} VC_AUDIO_STOP_T; -+ -+// configure the write audio samples -+typedef struct { -+ uint32_t count; // in bytes -+ void *callback; -+ void *cookie; -+ uint16_t silence; -+ uint16_t max_packet; -+} VC_AUDIO_WRITE_T; -+ -+// Generic result for a request (VC->HOST) -+typedef struct { -+ int32_t success; // Success value -+ -+} VC_AUDIO_RESULT_T; -+ -+// Generic result for a request (VC->HOST) -+typedef struct { -+ int32_t count; // Success value -+ void *callback; -+ void *cookie; -+} VC_AUDIO_COMPLETE_T; -+ -+// Message header for all messages in HOST->VC direction -+typedef struct { -+ int32_t type; // Message type (VC_AUDIO_MSG_TYPE) -+ union { -+ VC_AUDIO_CONFIG_T config; -+ VC_AUDIO_CONTROL_T control; -+ VC_AUDIO_OPEN_T open; -+ VC_AUDIO_CLOSE_T close; -+ VC_AUDIO_START_T start; -+ VC_AUDIO_STOP_T stop; -+ VC_AUDIO_WRITE_T write; -+ VC_AUDIO_RESULT_T result; -+ VC_AUDIO_COMPLETE_T complete; -+ } u; -+} VC_AUDIO_MSG_T; -+ -+#endif // _VC_AUDIO_DEFS_H_ - -From f173c4ba6bb591fd104486fec7229cff3648f715 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 28 Oct 2016 15:36:43 +0100 -Subject: [PATCH 039/122] vc_mem: Add vc_mem driver for querying firmware - memory addresses -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -BCM270x: Move vc_mem - -Make the vc_mem module available for ARCH_BCM2835 by moving it. - -Signed-off-by: Noralf Trønnes ---- - drivers/char/broadcom/Kconfig | 12 +- - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vc_mem.c | 422 ++++++++++++++++++++++++++++++++++++++++ - include/linux/broadcom/vc_mem.h | 35 ++++ - 4 files changed, 469 insertions(+), 1 deletion(-) - create mode 100644 drivers/char/broadcom/vc_mem.c - create mode 100644 include/linux/broadcom/vc_mem.h - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index 2d8bd6e5016aab7340636c1f5dc4dd0cbacae6c0..70379287f6261fd833202ac47de1bcca8b84959a 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -7,9 +7,19 @@ menuconfig BRCM_CHAR_DRIVERS - help - Broadcom's char drivers - -+if BRCM_CHAR_DRIVERS -+ - config BCM_VC_CMA - bool "Videocore CMA" -- depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ -+ depends on CMA && BCM2708_VCHIQ - default n - help - Helper for videocore CMA access. -+ -+config BCM2708_VCMEM -+ bool "Videocore Memory" -+ default y -+ help -+ Helper for videocore memory access and total size allocation. -+ -+endif -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index 13c5bca291ccc0df090c4e61169ace8f18ba60fe..fce918c369f7a9430136fea3ab098350339f1b01 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1 +1,2 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ -+obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c -new file mode 100644 -index 0000000000000000000000000000000000000000..be64f238ee0cc1e57f9401b0ee16c23e9fa238cc ---- /dev/null -+++ b/drivers/char/broadcom/vc_mem.c -@@ -0,0 +1,422 @@ -+/***************************************************************************** -+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "vc-mem" -+ -+// Device (/dev) related variables -+static dev_t vc_mem_devnum = 0; -+static struct class *vc_mem_class = NULL; -+static struct cdev vc_mem_cdev; -+static int vc_mem_inited = 0; -+ -+#ifdef CONFIG_DEBUG_FS -+static struct dentry *vc_mem_debugfs_entry; -+#endif -+ -+/* -+ * Videocore memory addresses and size -+ * -+ * Drivers that wish to know the videocore memory addresses and sizes should -+ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in -+ * headers. This allows the other drivers to not be tied down to a a certain -+ * address/size at compile time. -+ * -+ * In the future, the goal is to have the videocore memory virtual address and -+ * size be calculated at boot time rather than at compile time. The decision of -+ * where the videocore memory resides and its size would be in the hands of the -+ * bootloader (and/or kernel). When that happens, the values of these variables -+ * would be calculated and assigned in the init function. -+ */ -+// in the 2835 VC in mapped above ARM, but ARM has full access to VC space -+unsigned long mm_vc_mem_phys_addr = 0x00000000; -+unsigned int mm_vc_mem_size = 0; -+unsigned int mm_vc_mem_base = 0; -+ -+EXPORT_SYMBOL(mm_vc_mem_phys_addr); -+EXPORT_SYMBOL(mm_vc_mem_size); -+EXPORT_SYMBOL(mm_vc_mem_base); -+ -+static uint phys_addr = 0; -+static uint mem_size = 0; -+static uint mem_base = 0; -+ -+ -+/**************************************************************************** -+* -+* vc_mem_open -+* -+***************************************************************************/ -+ -+static int -+vc_mem_open(struct inode *inode, struct file *file) -+{ -+ (void) inode; -+ (void) file; -+ -+ pr_debug("%s: called file = 0x%p\n", __func__, file); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_release -+* -+***************************************************************************/ -+ -+static int -+vc_mem_release(struct inode *inode, struct file *file) -+{ -+ (void) inode; -+ (void) file; -+ -+ pr_debug("%s: called file = 0x%p\n", __func__, file); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_size -+* -+***************************************************************************/ -+ -+static void -+vc_mem_get_size(void) -+{ -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_base -+* -+***************************************************************************/ -+ -+static void -+vc_mem_get_base(void) -+{ -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_current_size -+* -+***************************************************************************/ -+ -+int -+vc_mem_get_current_size(void) -+{ -+ return mm_vc_mem_size; -+} -+ -+EXPORT_SYMBOL_GPL(vc_mem_get_current_size); -+ -+/**************************************************************************** -+* -+* vc_mem_ioctl -+* -+***************************************************************************/ -+ -+static long -+vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int rc = 0; -+ -+ (void) cmd; -+ (void) arg; -+ -+ pr_debug("%s: called file = 0x%p\n", __func__, file); -+ -+ switch (cmd) { -+ case VC_MEM_IOC_MEM_PHYS_ADDR: -+ { -+ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", -+ __func__, (void *) mm_vc_mem_phys_addr); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, -+ sizeof (mm_vc_mem_phys_addr)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_SIZE: -+ { -+ // Get the videocore memory size first -+ vc_mem_get_size(); -+ -+ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, -+ mm_vc_mem_size); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_size, -+ sizeof (mm_vc_mem_size)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_BASE: -+ { -+ // Get the videocore memory base -+ vc_mem_get_base(); -+ -+ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, -+ mm_vc_mem_base); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_base, -+ sizeof (mm_vc_mem_base)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_LOAD: -+ { -+ // Get the videocore memory base -+ vc_mem_get_base(); -+ -+ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, -+ mm_vc_mem_base); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_base, -+ sizeof (mm_vc_mem_base)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ default: -+ { -+ return -ENOTTY; -+ } -+ } -+ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_mmap -+* -+***************************************************************************/ -+ -+static int -+vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ int rc = 0; -+ unsigned long length = vma->vm_end - vma->vm_start; -+ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; -+ -+ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", -+ __func__, (long) vma->vm_start, (long) vma->vm_end, -+ (long) vma->vm_pgoff); -+ -+ if (offset + length > mm_vc_mem_size) { -+ pr_err("%s: length %ld is too big\n", __func__, length); -+ return -EINVAL; -+ } -+ // Do not cache the memory map -+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -+ -+ rc = remap_pfn_range(vma, vma->vm_start, -+ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + -+ vma->vm_pgoff, length, vma->vm_page_prot); -+ if (rc != 0) { -+ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); -+ } -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for the driver. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_mem_fops = { -+ .owner = THIS_MODULE, -+ .open = vc_mem_open, -+ .release = vc_mem_release, -+ .unlocked_ioctl = vc_mem_ioctl, -+ .mmap = vc_mem_mmap, -+}; -+ -+#ifdef CONFIG_DEBUG_FS -+static void vc_mem_debugfs_deinit(void) -+{ -+ debugfs_remove_recursive(vc_mem_debugfs_entry); -+ vc_mem_debugfs_entry = NULL; -+} -+ -+ -+static int vc_mem_debugfs_init( -+ struct device *dev) -+{ -+ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); -+ if (!vc_mem_debugfs_entry) { -+ dev_warn(dev, "could not create debugfs entry\n"); -+ return -EFAULT; -+ } -+ -+ if (!debugfs_create_x32("vc_mem_phys_addr", -+ 0444, -+ vc_mem_debugfs_entry, -+ (u32 *)&mm_vc_mem_phys_addr)) { -+ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", -+ __func__); -+ goto fail; -+ } -+ -+ if (!debugfs_create_x32("vc_mem_size", -+ 0444, -+ vc_mem_debugfs_entry, -+ (u32 *)&mm_vc_mem_size)) { -+ dev_warn(dev, "%s:could not create vc_mem_size entry\n", -+ __func__); -+ goto fail; -+ } -+ -+ if (!debugfs_create_x32("vc_mem_base", -+ 0444, -+ vc_mem_debugfs_entry, -+ (u32 *)&mm_vc_mem_base)) { -+ dev_warn(dev, "%s:could not create vc_mem_base entry\n", -+ __func__); -+ goto fail; -+ } -+ -+ return 0; -+ -+fail: -+ vc_mem_debugfs_deinit(); -+ return -EFAULT; -+} -+ -+#endif /* CONFIG_DEBUG_FS */ -+ -+ -+/**************************************************************************** -+* -+* vc_mem_init -+* -+***************************************************************************/ -+ -+static int __init -+vc_mem_init(void) -+{ -+ int rc = -EFAULT; -+ struct device *dev; -+ -+ pr_debug("%s: called\n", __func__); -+ -+ mm_vc_mem_phys_addr = phys_addr; -+ mm_vc_mem_size = mem_size; -+ mm_vc_mem_base = mem_base; -+ -+ vc_mem_get_size(); -+ -+ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", -+ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); -+ -+ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { -+ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", -+ __func__, rc); -+ goto out_err; -+ } -+ -+ cdev_init(&vc_mem_cdev, &vc_mem_fops); -+ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { -+ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); -+ goto out_unregister; -+ } -+ -+ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); -+ if (IS_ERR(vc_mem_class)) { -+ rc = PTR_ERR(vc_mem_class); -+ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); -+ goto out_cdev_del; -+ } -+ -+ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, -+ DRIVER_NAME); -+ if (IS_ERR(dev)) { -+ rc = PTR_ERR(dev); -+ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); -+ goto out_class_destroy; -+ } -+ -+#ifdef CONFIG_DEBUG_FS -+ /* don't fail if the debug entries cannot be created */ -+ vc_mem_debugfs_init(dev); -+#endif -+ -+ vc_mem_inited = 1; -+ return 0; -+ -+ device_destroy(vc_mem_class, vc_mem_devnum); -+ -+ out_class_destroy: -+ class_destroy(vc_mem_class); -+ vc_mem_class = NULL; -+ -+ out_cdev_del: -+ cdev_del(&vc_mem_cdev); -+ -+ out_unregister: -+ unregister_chrdev_region(vc_mem_devnum, 1); -+ -+ out_err: -+ return -1; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_exit -+* -+***************************************************************************/ -+ -+static void __exit -+vc_mem_exit(void) -+{ -+ pr_debug("%s: called\n", __func__); -+ -+ if (vc_mem_inited) { -+#if CONFIG_DEBUG_FS -+ vc_mem_debugfs_deinit(); -+#endif -+ device_destroy(vc_mem_class, vc_mem_devnum); -+ class_destroy(vc_mem_class); -+ cdev_del(&vc_mem_cdev); -+ unregister_chrdev_region(vc_mem_devnum, 1); -+ } -+} -+ -+module_init(vc_mem_init); -+module_exit(vc_mem_exit); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Broadcom Corporation"); -+ -+module_param(phys_addr, uint, 0644); -+module_param(mem_size, uint, 0644); -+module_param(mem_base, uint, 0644); -diff --git a/include/linux/broadcom/vc_mem.h b/include/linux/broadcom/vc_mem.h -new file mode 100644 -index 0000000000000000000000000000000000000000..20a475377eb3078ea1ecaef2b24efc35a58411b4 ---- /dev/null -+++ b/include/linux/broadcom/vc_mem.h -@@ -0,0 +1,35 @@ -+/***************************************************************************** -+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef _VC_MEM_H -+#define _VC_MEM_H -+ -+#include -+ -+#define VC_MEM_IOC_MAGIC 'v' -+ -+#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) -+#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) -+#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) -+#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) -+ -+#if defined( __KERNEL__ ) -+#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF -+ -+extern unsigned long mm_vc_mem_phys_addr; -+extern unsigned int mm_vc_mem_size; -+extern int vc_mem_get_current_size( void ); -+#endif -+ -+#endif /* _VC_MEM_H */ - -From 826895d0d097fa010aca39acf19d85a1e065876d Mon Sep 17 00:00:00 2001 -From: Tim Gover -Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 040/122] vcsm: VideoCore shared memory service for BCM2835 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add experimental support for the VideoCore shared memory service. -This allows user processes to allocate memory from VideoCore's -GPU relocatable heap and mmap the buffers. Additionally, the memory -handles can passed to other VideoCore services such as MMAL, OpenMax -and DispmanX - -TODO -* This driver was originally released for BCM28155 which has a different - cache architecture to BCM2835. Consequently, in this release only - uncached mappings are supported. However, there's no fundamental - reason which cached mappings cannot be support or BCM2835 -* More refactoring is required to remove the typedefs. -* Re-enable the some of the commented out debug-fs statistics which were - disabled when migrating code from proc-fs. -* There's a lot of code to support sharing of VCSM in order to support - Android. This could probably done more cleanly or perhaps just - removed. - -Signed-off-by: Tim Gover - -config: Disable VC_SM for now to fix hang with cutdown kernel - -vcsm: Use boolean as it cannot be built as module - -On building the bcm_vc_sm as a module we get the following error: - -v7_dma_flush_range and do_munmap are undefined in vc-sm.ko. - -Fix by making it not an option to build as module - -vcsm: Add ioctl for custom cache flushing - -vc-sm: Move headers out of arch directory - -Signed-off-by: Noralf Trønnes ---- - drivers/char/broadcom/Kconfig | 9 + - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vc_sm/Makefile | 9 + - drivers/char/broadcom/vc_sm/vc_sm_defs.h | 181 ++ - drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + - drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 492 +++++ - drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + - drivers/char/broadcom/vc_sm/vmcs_sm.c | 3213 ++++++++++++++++++++++++++++++ - include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ - 9 files changed, 4290 insertions(+) - create mode 100644 drivers/char/broadcom/vc_sm/Makefile - create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h - create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h - create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.c - create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.h - create mode 100644 drivers/char/broadcom/vc_sm/vmcs_sm.c - create mode 100644 include/linux/broadcom/vmcs_sm_ioctl.h - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index 70379287f6261fd833202ac47de1bcca8b84959a..75fa1cba764084160f7cb77e56058f25b5e9f0ce 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -23,3 +23,12 @@ config BCM2708_VCMEM - Helper for videocore memory access and total size allocation. - - endif -+ -+config BCM_VC_SM -+ bool "VMCS Shared Memory" -+ depends on BCM2708_VCHIQ -+ select BCM2708_VCMEM -+ default n -+ help -+ Support for the VC shared memory on the Broadcom reference -+ design. Uses the VCHIQ stack. -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index fce918c369f7a9430136fea3ab098350339f1b01..de8feb98c63ff1e6437d80a6db85a8d30f433705 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1,2 +1,3 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ - obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -+obj-$(CONFIG_BCM_VC_SM) += vc_sm/ -diff --git a/drivers/char/broadcom/vc_sm/Makefile b/drivers/char/broadcom/vc_sm/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..19ce263bc273dcdb24ea2b4431e4cafcf4ca4a2b ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/Makefile -@@ -0,0 +1,9 @@ -+ccflags-$(CONFIG_BCM_VC_SM) += -Werror -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -+ccflags-$(CONFIG_BCM_VC_SM) += -I"drivers/staging/vc04_services" -I"drivers/staging/vc04_services/interface/vchi" -I"drivers/staging/vc04_services/interface/vchiq_arm" -I"$(srctree)/fs/" -+ccflags-$(CONFIG_BCM_VC_SM) += -DOS_ASSERT_FAILURE -D__STDC_VERSION=199901L -D__STDC_VERSION__=199901L -D__VCCOREVER__=0 -D__KERNEL__ -D__linux__ -+ -+obj-$(CONFIG_BCM_VC_SM) := vc-sm.o -+ -+vc-sm-objs := \ -+ vmcs_sm.o \ -+ vc_vchi_sm.o -diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h -new file mode 100644 -index 0000000000000000000000000000000000000000..c4d5ff718a5ba9071ef87fa4c6cf632486c4d36f ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h -@@ -0,0 +1,181 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __VC_SM_DEFS_H__INCLUDED__ -+#define __VC_SM_DEFS_H__INCLUDED__ -+ -+/* FourCC code used for VCHI connection */ -+#define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") -+ -+/* Maximum message length */ -+#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ -+ sizeof(VC_SM_MSG_HDR_T)) -+#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) -+ -+/* Resource name maximum size */ -+#define VC_SM_RESOURCE_NAME 32 -+ -+/* All message types supported for HOST->VC direction */ -+typedef enum { -+ /* Allocate shared memory block */ -+ VC_SM_MSG_TYPE_ALLOC, -+ /* Lock allocated shared memory block */ -+ VC_SM_MSG_TYPE_LOCK, -+ /* Unlock allocated shared memory block */ -+ VC_SM_MSG_TYPE_UNLOCK, -+ /* Unlock allocated shared memory block, do not answer command */ -+ VC_SM_MSG_TYPE_UNLOCK_NOANS, -+ /* Free shared memory block */ -+ VC_SM_MSG_TYPE_FREE, -+ /* Resize a shared memory block */ -+ VC_SM_MSG_TYPE_RESIZE, -+ /* Walk the allocated shared memory block(s) */ -+ VC_SM_MSG_TYPE_WALK_ALLOC, -+ -+ /* A previously applied action will need to be reverted */ -+ VC_SM_MSG_TYPE_ACTION_CLEAN, -+ VC_SM_MSG_TYPE_MAX -+} VC_SM_MSG_TYPE; -+ -+/* Type of memory to be allocated */ -+typedef enum { -+ VC_SM_ALLOC_CACHED, -+ VC_SM_ALLOC_NON_CACHED, -+ -+} VC_SM_ALLOC_TYPE_T; -+ -+/* Message header for all messages in HOST->VC direction */ -+typedef struct { -+ int32_t type; -+ uint32_t trans_id; -+ uint8_t body[0]; -+ -+} VC_SM_MSG_HDR_T; -+ -+/* Request to allocate memory (HOST->VC) */ -+typedef struct { -+ /* type of memory to allocate */ -+ VC_SM_ALLOC_TYPE_T type; -+ /* byte amount of data to allocate per unit */ -+ uint32_t base_unit; -+ /* number of unit to allocate */ -+ uint32_t num_unit; -+ /* alignement to be applied on allocation */ -+ uint32_t alignement; -+ /* identity of who allocated this block */ -+ uint32_t allocator; -+ /* resource name (for easier tracking on vc side) */ -+ char name[VC_SM_RESOURCE_NAME]; -+ -+} VC_SM_ALLOC_T; -+ -+/* Result of a requested memory allocation (VC->HOST) */ -+typedef struct { -+ /* Transaction identifier */ -+ uint32_t trans_id; -+ -+ /* Resource handle */ -+ uint32_t res_handle; -+ /* Pointer to resource buffer */ -+ void *res_mem; -+ /* Resource base size (bytes) */ -+ uint32_t res_base_size; -+ /* Resource number */ -+ uint32_t res_num; -+ -+} VC_SM_ALLOC_RESULT_T; -+ -+/* Request to free a previously allocated memory (HOST->VC) */ -+typedef struct { -+ /* Resource handle (returned from alloc) */ -+ uint32_t res_handle; -+ /* Resource buffer (returned from alloc) */ -+ void *res_mem; -+ -+} VC_SM_FREE_T; -+ -+/* Request to lock a previously allocated memory (HOST->VC) */ -+typedef struct { -+ /* Resource handle (returned from alloc) */ -+ uint32_t res_handle; -+ /* Resource buffer (returned from alloc) */ -+ void *res_mem; -+ -+} VC_SM_LOCK_UNLOCK_T; -+ -+/* Request to resize a previously allocated memory (HOST->VC) */ -+typedef struct { -+ /* Resource handle (returned from alloc) */ -+ uint32_t res_handle; -+ /* Resource buffer (returned from alloc) */ -+ void *res_mem; -+ /* Resource *new* size requested (bytes) */ -+ uint32_t res_new_size; -+ -+} VC_SM_RESIZE_T; -+ -+/* Result of a requested memory lock (VC->HOST) */ -+typedef struct { -+ /* Transaction identifier */ -+ uint32_t trans_id; -+ -+ /* Resource handle */ -+ uint32_t res_handle; -+ /* Pointer to resource buffer */ -+ void *res_mem; -+ /* Pointer to former resource buffer if the memory -+ * was reallocated */ -+ void *res_old_mem; -+ -+} VC_SM_LOCK_RESULT_T; -+ -+/* Generic result for a request (VC->HOST) */ -+typedef struct { -+ /* Transaction identifier */ -+ uint32_t trans_id; -+ -+ int32_t success; -+ -+} VC_SM_RESULT_T; -+ -+/* Request to revert a previously applied action (HOST->VC) */ -+typedef struct { -+ /* Action of interest */ -+ VC_SM_MSG_TYPE res_action; -+ /* Transaction identifier for the action of interest */ -+ uint32_t action_trans_id; -+ -+} VC_SM_ACTION_CLEAN_T; -+ -+/* Request to remove all data associated with a given allocator (HOST->VC) */ -+typedef struct { -+ /* Allocator identifier */ -+ uint32_t allocator; -+ -+} VC_SM_FREE_ALL_T; -+ -+/* Union of ALL messages */ -+typedef union { -+ VC_SM_ALLOC_T alloc; -+ VC_SM_ALLOC_RESULT_T alloc_result; -+ VC_SM_FREE_T free; -+ VC_SM_ACTION_CLEAN_T action_clean; -+ VC_SM_RESIZE_T resize; -+ VC_SM_LOCK_RESULT_T lock_result; -+ VC_SM_RESULT_T result; -+ VC_SM_FREE_ALL_T free_all; -+ -+} VC_SM_MSG_UNION_T; -+ -+#endif /* __VC_SM_DEFS_H__INCLUDED__ */ -diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h -new file mode 100644 -index 0000000000000000000000000000000000000000..965f9a209a025202fea8065d3947c36f4fa43d0a ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h -@@ -0,0 +1,55 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __VC_SM_KNL_H__INCLUDED__ -+#define __VC_SM_KNL_H__INCLUDED__ -+ -+#if !defined(__KERNEL__) -+#error "This interface is for kernel use only..." -+#endif -+ -+/* Type of memory to be locked (ie mapped) */ -+typedef enum { -+ VC_SM_LOCK_CACHED, -+ VC_SM_LOCK_NON_CACHED, -+ -+} VC_SM_LOCK_CACHE_MODE_T; -+ -+/* Allocate a shared memory handle and block. -+*/ -+int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); -+ -+/* Free a previously allocated shared memory handle and block. -+*/ -+int vc_sm_free(int handle); -+ -+/* Lock a memory handle for use by kernel. -+*/ -+int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data); -+ -+/* Unlock a memory handle in use by kernel. -+*/ -+int vc_sm_unlock(int handle, int flush, int no_vc_unlock); -+ -+/* Get an internal resource handle mapped from the external one. -+*/ -+int vc_sm_int_handle(int handle); -+ -+/* Map a shared memory region for use by kernel. -+*/ -+int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data); -+ -+#endif /* __VC_SM_KNL_H__INCLUDED__ */ -diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c -new file mode 100644 -index 0000000000000000000000000000000000000000..7c6ba1a244a8aff8132e0177e02b2b2a6cd364e0 ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c -@@ -0,0 +1,492 @@ -+/***************************************************************************** -+* Copyright 2011-2012 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+/* ---- Include Files ----------------------------------------------------- */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "vc_vchi_sm.h" -+ -+#define VC_SM_VER 1 -+#define VC_SM_MIN_VER 0 -+ -+/* ---- Private Constants and Types -------------------------------------- */ -+ -+/* Command blocks come from a pool */ -+#define SM_MAX_NUM_CMD_RSP_BLKS 32 -+ -+struct sm_cmd_rsp_blk { -+ struct list_head head; /* To create lists */ -+ struct semaphore sema; /* To be signaled when the response is there */ -+ -+ uint16_t id; -+ uint16_t length; -+ -+ uint8_t msg[VC_SM_MAX_MSG_LEN]; -+ -+ uint32_t wait:1; -+ uint32_t sent:1; -+ uint32_t alloc:1; -+ -+}; -+ -+struct sm_instance { -+ uint32_t num_connections; -+ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; -+ struct task_struct *io_thread; -+ struct semaphore io_sema; -+ -+ uint32_t trans_id; -+ -+ struct mutex lock; -+ struct list_head cmd_list; -+ struct list_head rsp_list; -+ struct list_head dead_list; -+ -+ struct sm_cmd_rsp_blk free_blk[SM_MAX_NUM_CMD_RSP_BLKS]; -+ struct list_head free_list; -+ struct mutex free_lock; -+ struct semaphore free_sema; -+ -+}; -+ -+/* ---- Private Variables ------------------------------------------------ */ -+ -+/* ---- Private Function Prototypes -------------------------------------- */ -+ -+/* ---- Private Functions ------------------------------------------------ */ -+static struct -+sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, -+ VC_SM_MSG_TYPE id, void *msg, -+ uint32_t size, int wait) -+{ -+ struct sm_cmd_rsp_blk *blk; -+ VC_SM_MSG_HDR_T *hdr; -+ -+ if (down_interruptible(&instance->free_sema)) { -+ blk = kmalloc(sizeof(*blk), GFP_KERNEL); -+ if (!blk) -+ return NULL; -+ -+ blk->alloc = 1; -+ sema_init(&blk->sema, 0); -+ } else { -+ mutex_lock(&instance->free_lock); -+ blk = -+ list_first_entry(&instance->free_list, -+ struct sm_cmd_rsp_blk, head); -+ list_del(&blk->head); -+ mutex_unlock(&instance->free_lock); -+ } -+ -+ blk->sent = 0; -+ blk->wait = wait; -+ blk->length = sizeof(*hdr) + size; -+ -+ hdr = (VC_SM_MSG_HDR_T *) blk->msg; -+ hdr->type = id; -+ mutex_lock(&instance->lock); -+ hdr->trans_id = blk->id = ++instance->trans_id; -+ mutex_unlock(&instance->lock); -+ -+ if (size) -+ memcpy(hdr->body, msg, size); -+ -+ return blk; -+} -+ -+static void -+vc_vchi_cmd_delete(struct sm_instance *instance, struct sm_cmd_rsp_blk *blk) -+{ -+ if (blk->alloc) { -+ kfree(blk); -+ return; -+ } -+ -+ mutex_lock(&instance->free_lock); -+ list_add(&blk->head, &instance->free_list); -+ mutex_unlock(&instance->free_lock); -+ up(&instance->free_sema); -+} -+ -+static int vc_vchi_sm_videocore_io(void *arg) -+{ -+ struct sm_instance *instance = arg; -+ struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; -+ VC_SM_RESULT_T *reply; -+ uint32_t reply_len; -+ int32_t status; -+ int svc_use = 1; -+ -+ while (1) { -+ if (svc_use) -+ vchi_service_release(instance->vchi_handle[0]); -+ svc_use = 0; -+ if (!down_interruptible(&instance->io_sema)) { -+ vchi_service_use(instance->vchi_handle[0]); -+ svc_use = 1; -+ -+ do { -+ unsigned int flags; -+ /* -+ * Get new command and move it to response list -+ */ -+ mutex_lock(&instance->lock); -+ if (list_empty(&instance->cmd_list)) { -+ /* no more commands to process */ -+ mutex_unlock(&instance->lock); -+ break; -+ } -+ cmd = -+ list_first_entry(&instance->cmd_list, -+ struct sm_cmd_rsp_blk, -+ head); -+ list_move(&cmd->head, &instance->rsp_list); -+ cmd->sent = 1; -+ mutex_unlock(&instance->lock); -+ -+ /* Send the command */ -+ flags = VCHI_FLAGS_BLOCK_UNTIL_QUEUED; -+ status = vchi_msg_queue( -+ instance->vchi_handle[0], -+ cmd->msg, cmd->length, -+ flags, NULL); -+ if (status) { -+ pr_err("%s: failed to queue message (%d)", -+ __func__, status); -+ } -+ -+ /* If no reply is needed then we're done */ -+ if (!cmd->wait) { -+ mutex_lock(&instance->lock); -+ list_del(&cmd->head); -+ mutex_unlock(&instance->lock); -+ vc_vchi_cmd_delete(instance, cmd); -+ continue; -+ } -+ -+ if (status) { -+ up(&cmd->sema); -+ continue; -+ } -+ -+ } while (1); -+ -+ while (!vchi_msg_peek -+ (instance->vchi_handle[0], (void **)&reply, -+ &reply_len, VCHI_FLAGS_NONE)) { -+ mutex_lock(&instance->lock); -+ list_for_each_entry(cmd, &instance->rsp_list, -+ head) { -+ if (cmd->id == reply->trans_id) -+ break; -+ } -+ mutex_unlock(&instance->lock); -+ -+ if (&cmd->head == &instance->rsp_list) { -+ pr_debug("%s: received response %u, throw away...", -+ __func__, reply->trans_id); -+ } else if (reply_len > sizeof(cmd->msg)) { -+ pr_err("%s: reply too big (%u) %u, throw away...", -+ __func__, reply_len, -+ reply->trans_id); -+ } else { -+ memcpy(cmd->msg, reply, reply_len); -+ up(&cmd->sema); -+ } -+ -+ vchi_msg_remove(instance->vchi_handle[0]); -+ } -+ -+ /* Go through the dead list and free them */ -+ mutex_lock(&instance->lock); -+ list_for_each_entry_safe(cmd, cmd_tmp, -+ &instance->dead_list, head) { -+ list_del(&cmd->head); -+ vc_vchi_cmd_delete(instance, cmd); -+ } -+ mutex_unlock(&instance->lock); -+ } -+ } -+ -+ return 0; -+} -+ -+static void vc_sm_vchi_callback(void *param, -+ const VCHI_CALLBACK_REASON_T reason, -+ void *msg_handle) -+{ -+ struct sm_instance *instance = param; -+ -+ (void)msg_handle; -+ -+ switch (reason) { -+ case VCHI_CALLBACK_MSG_AVAILABLE: -+ up(&instance->io_sema); -+ break; -+ -+ case VCHI_CALLBACK_SERVICE_CLOSED: -+ pr_info("%s: service CLOSED!!", __func__); -+ default: -+ break; -+ } -+} -+ -+VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, -+ VCHI_CONNECTION_T **vchi_connections, -+ uint32_t num_connections) -+{ -+ uint32_t i; -+ struct sm_instance *instance; -+ int status; -+ -+ pr_debug("%s: start", __func__); -+ -+ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { -+ pr_err("%s: unsupported number of connections %u (max=%u)", -+ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); -+ -+ goto err_null; -+ } -+ /* Allocate memory for this instance */ -+ instance = kzalloc(sizeof(*instance), GFP_KERNEL); -+ -+ /* Misc initialisations */ -+ mutex_init(&instance->lock); -+ sema_init(&instance->io_sema, 0); -+ INIT_LIST_HEAD(&instance->cmd_list); -+ INIT_LIST_HEAD(&instance->rsp_list); -+ INIT_LIST_HEAD(&instance->dead_list); -+ INIT_LIST_HEAD(&instance->free_list); -+ sema_init(&instance->free_sema, SM_MAX_NUM_CMD_RSP_BLKS); -+ mutex_init(&instance->free_lock); -+ for (i = 0; i < SM_MAX_NUM_CMD_RSP_BLKS; i++) { -+ sema_init(&instance->free_blk[i].sema, 0); -+ list_add(&instance->free_blk[i].head, &instance->free_list); -+ } -+ -+ /* Open the VCHI service connections */ -+ instance->num_connections = num_connections; -+ for (i = 0; i < num_connections; i++) { -+ SERVICE_CREATION_T params = { -+ VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), -+ VC_SM_SERVER_NAME, -+ vchi_connections[i], -+ 0, -+ 0, -+ vc_sm_vchi_callback, -+ instance, -+ 0, -+ 0, -+ 0, -+ }; -+ -+ status = vchi_service_open(vchi_instance, -+ ¶ms, &instance->vchi_handle[i]); -+ if (status) { -+ pr_err("%s: failed to open VCHI service (%d)", -+ __func__, status); -+ -+ goto err_close_services; -+ } -+ } -+ -+ /* Create the thread which takes care of all io to/from videoocore. */ -+ instance->io_thread = kthread_create(&vc_vchi_sm_videocore_io, -+ (void *)instance, "SMIO"); -+ if (instance->io_thread == NULL) { -+ pr_err("%s: failed to create SMIO thread", __func__); -+ -+ goto err_close_services; -+ } -+ set_user_nice(instance->io_thread, -10); -+ wake_up_process(instance->io_thread); -+ -+ pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); -+ return instance; -+ -+err_close_services: -+ for (i = 0; i < instance->num_connections; i++) { -+ if (instance->vchi_handle[i] != NULL) -+ vchi_service_close(instance->vchi_handle[i]); -+ } -+ kfree(instance); -+err_null: -+ pr_debug("%s: FAILED", __func__); -+ return NULL; -+} -+ -+int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) -+{ -+ struct sm_instance *instance; -+ uint32_t i; -+ -+ if (handle == NULL) { -+ pr_err("%s: invalid pointer to handle %p", __func__, handle); -+ goto lock; -+ } -+ -+ if (*handle == NULL) { -+ pr_err("%s: invalid handle %p", __func__, *handle); -+ goto lock; -+ } -+ -+ instance = *handle; -+ -+ /* Close all VCHI service connections */ -+ for (i = 0; i < instance->num_connections; i++) { -+ int32_t success; -+ vchi_service_use(instance->vchi_handle[i]); -+ -+ success = vchi_service_close(instance->vchi_handle[i]); -+ } -+ -+ kfree(instance); -+ -+ *handle = NULL; -+ return 0; -+ -+lock: -+ return -EINVAL; -+} -+ -+int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_MSG_TYPE msg_id, -+ void *msg, uint32_t msg_size, -+ void *result, uint32_t result_size, -+ uint32_t *cur_trans_id, uint8_t wait_reply) -+{ -+ int status = 0; -+ struct sm_instance *instance = handle; -+ struct sm_cmd_rsp_blk *cmd_blk; -+ -+ if (handle == NULL) { -+ pr_err("%s: invalid handle", __func__); -+ return -EINVAL; -+ } -+ if (msg == NULL) { -+ pr_err("%s: invalid msg pointer", __func__); -+ return -EINVAL; -+ } -+ -+ cmd_blk = -+ vc_vchi_cmd_create(instance, msg_id, msg, msg_size, wait_reply); -+ if (cmd_blk == NULL) { -+ pr_err("[%s]: failed to allocate global tracking resource", -+ __func__); -+ return -ENOMEM; -+ } -+ -+ if (cur_trans_id != NULL) -+ *cur_trans_id = cmd_blk->id; -+ -+ mutex_lock(&instance->lock); -+ list_add_tail(&cmd_blk->head, &instance->cmd_list); -+ mutex_unlock(&instance->lock); -+ up(&instance->io_sema); -+ -+ if (!wait_reply) -+ /* We're done */ -+ return 0; -+ -+ /* Wait for the response */ -+ if (down_interruptible(&cmd_blk->sema)) { -+ mutex_lock(&instance->lock); -+ if (!cmd_blk->sent) { -+ list_del(&cmd_blk->head); -+ mutex_unlock(&instance->lock); -+ vc_vchi_cmd_delete(instance, cmd_blk); -+ return -ENXIO; -+ } -+ mutex_unlock(&instance->lock); -+ -+ mutex_lock(&instance->lock); -+ list_move(&cmd_blk->head, &instance->dead_list); -+ mutex_unlock(&instance->lock); -+ up(&instance->io_sema); -+ return -EINTR; /* We're done */ -+ } -+ -+ if (result && result_size) { -+ memcpy(result, cmd_blk->msg, result_size); -+ } else { -+ VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; -+ status = (res->success == 0) ? 0 : -ENXIO; -+ } -+ -+ mutex_lock(&instance->lock); -+ list_del(&cmd_blk->head); -+ mutex_unlock(&instance->lock); -+ vc_vchi_cmd_delete(instance, cmd_blk); -+ return status; -+} -+ -+int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, -+ VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, -+ msg, sizeof(*msg), result, sizeof(*result), -+ cur_trans_id, 1); -+} -+ -+int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_FREE_T *msg, uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, -+ msg, sizeof(*msg), 0, 0, cur_trans_id, 0); -+} -+ -+int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *msg, -+ VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, -+ msg, sizeof(*msg), result, sizeof(*result), -+ cur_trans_id, 1); -+} -+ -+int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *msg, -+ uint32_t *cur_trans_id, uint8_t wait_reply) -+{ -+ return vc_vchi_sm_send_msg(handle, wait_reply ? -+ VC_SM_MSG_TYPE_UNLOCK : -+ VC_SM_MSG_TYPE_UNLOCK_NOANS, msg, -+ sizeof(*msg), 0, 0, cur_trans_id, -+ wait_reply); -+} -+ -+int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, -+ uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, -+ msg, sizeof(*msg), 0, 0, cur_trans_id, 1); -+} -+ -+int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, -+ 0, 0, 0, 0, 0, 0); -+} -+ -+int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, -+ msg, sizeof(*msg), 0, 0, 0, 0); -+} -diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h -new file mode 100644 -index 0000000000000000000000000000000000000000..5e279f5a95fac7227cea15941bf0570ddc2b0886 ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h -@@ -0,0 +1,82 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __VC_VCHI_SM_H__INCLUDED__ -+#define __VC_VCHI_SM_H__INCLUDED__ -+ -+#include "interface/vchi/vchi.h" -+ -+#include "vc_sm_defs.h" -+ -+/* Forward declare. -+*/ -+typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; -+ -+/* Initialize the shared memory service, opens up vchi connection to talk to it. -+*/ -+VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, -+ VCHI_CONNECTION_T **vchi_connections, -+ uint32_t num_connections); -+ -+/* Terminates the shared memory service. -+*/ -+int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); -+ -+/* Ask the shared memory service to allocate some memory on videocre and -+** return the result of this allocation (which upon success will be a pointer -+** to some memory in videocore space). -+*/ -+int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_ALLOC_T *alloc, -+ VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); -+ -+/* Ask the shared memory service to free up some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_FREE_T *free, uint32_t *trans_id); -+ -+/* Ask the shared memory service to lock up some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *lock_unlock, -+ VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); -+ -+/* Ask the shared memory service to unlock some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *lock_unlock, -+ uint32_t *trans_id, uint8_t wait_reply); -+ -+/* Ask the shared memory service to resize some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_RESIZE_T *resize, uint32_t *trans_id); -+ -+/* Walk the allocated resources on the videocore side, the allocation will -+** show up in the log. This is purely for debug/information and takes no -+** specific actions. -+*/ -+int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); -+ -+/* Clean up following a previously interrupted action which left the system -+** in a bad state of some sort. -+*/ -+int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_ACTION_CLEAN_T *action_clean); -+ -+#endif /* __VC_VCHI_SM_H__INCLUDED__ */ -diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c -new file mode 100644 -index 0000000000000000000000000000000000000000..1db6716c2c0c8b2013203391501f92d09db258af ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c -@@ -0,0 +1,3213 @@ -+/***************************************************************************** -+* Copyright 2011-2012 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+/* ---- Include Files ----------------------------------------------------- */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "vchiq_connected.h" -+#include "vc_vchi_sm.h" -+ -+#include -+#include "vc_sm_knl.h" -+ -+/* ---- Private Constants and Types --------------------------------------- */ -+ -+#define DEVICE_NAME "vcsm" -+#define DEVICE_MINOR 0 -+ -+#define VC_SM_DIR_ROOT_NAME "vc-smem" -+#define VC_SM_DIR_ALLOC_NAME "alloc" -+#define VC_SM_STATE "state" -+#define VC_SM_STATS "statistics" -+#define VC_SM_RESOURCES "resources" -+#define VC_SM_DEBUG "debug" -+#define VC_SM_WRITE_BUF_SIZE 128 -+ -+/* Statistics tracked per resource and globally. -+*/ -+enum SM_STATS_T { -+ /* Attempt. */ -+ ALLOC, -+ FREE, -+ LOCK, -+ UNLOCK, -+ MAP, -+ FLUSH, -+ INVALID, -+ -+ END_ATTEMPT, -+ -+ /* Failure. */ -+ ALLOC_FAIL, -+ FREE_FAIL, -+ LOCK_FAIL, -+ UNLOCK_FAIL, -+ MAP_FAIL, -+ FLUSH_FAIL, -+ INVALID_FAIL, -+ -+ END_ALL, -+ -+}; -+ -+static const char *const sm_stats_human_read[] = { -+ "Alloc", -+ "Free", -+ "Lock", -+ "Unlock", -+ "Map", -+ "Cache Flush", -+ "Cache Invalidate", -+}; -+ -+typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); -+struct SM_PDE_T { -+ VC_SM_SHOW show; /* Debug fs function hookup. */ -+ struct dentry *dir_entry; /* Debug fs directory entry. */ -+ void *priv_data; /* Private data */ -+ -+}; -+ -+/* Single resource allocation tracked for all devices. -+*/ -+struct sm_mmap { -+ struct list_head map_list; /* Linked list of maps. */ -+ -+ struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ -+ -+ pid_t res_pid; /* PID owning that resource. */ -+ unsigned int res_vc_hdl; /* Resource handle (videocore). */ -+ unsigned int res_usr_hdl; /* Resource handle (user). */ -+ -+ long unsigned int res_addr; /* Mapped virtual address. */ -+ struct vm_area_struct *vma; /* VM area for this mapping. */ -+ unsigned int ref_count; /* Reference count to this vma. */ -+ -+ /* Used to link maps associated with a resource. */ -+ struct list_head resource_map_list; -+}; -+ -+/* Single resource allocation tracked for each opened device. -+*/ -+struct SM_RESOURCE_T { -+ struct list_head resource_list; /* List of resources. */ -+ struct list_head global_resource_list; /* Global list of resources. */ -+ -+ pid_t pid; /* PID owning that resource. */ -+ uint32_t res_guid; /* Unique identifier. */ -+ uint32_t lock_count; /* Lock count for this resource. */ -+ uint32_t ref_count; /* Ref count for this resource. */ -+ -+ uint32_t res_handle; /* Resource allocation handle. */ -+ void *res_base_mem; /* Resource base memory address. */ -+ uint32_t res_size; /* Resource size allocated. */ -+ enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ -+ struct SM_RESOURCE_T *res_shared; /* Shared resource */ -+ -+ enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ -+ -+ uint8_t map_count; /* Counter of mappings for this resource. */ -+ struct list_head map_list; /* Maps associated with a resource. */ -+ -+ struct SM_PRIV_DATA_T *private; -+}; -+ -+/* Private file data associated with each opened device. -+*/ -+struct SM_PRIV_DATA_T { -+ struct list_head resource_list; /* List of resources. */ -+ -+ pid_t pid; /* PID of creator. */ -+ -+ struct dentry *dir_pid; /* Debug fs entries root. */ -+ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ -+ struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ -+ -+ int restart_sys; /* Tracks restart on interrupt. */ -+ VC_SM_MSG_TYPE int_action; /* Interrupted action. */ -+ uint32_t int_trans_id; /* Interrupted transaction. */ -+ -+}; -+ -+/* Global state information. -+*/ -+struct SM_STATE_T { -+ VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ -+ struct dentry *dir_root; /* Debug fs entries root. */ -+ struct dentry *dir_alloc; /* Debug fs entries allocations. */ -+ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ -+ struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ -+ struct dentry *debug; /* Debug fs entries debug. */ -+ -+ struct mutex map_lock; /* Global map lock. */ -+ struct list_head map_list; /* List of maps. */ -+ struct list_head resource_list; /* List of resources. */ -+ -+ enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ -+ enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ -+ uint32_t res_deceased_cnt; /* Natural termination counter. */ -+ uint32_t res_terminated_cnt; /* Forced termination counter. */ -+ -+ struct cdev sm_cdev; /* Device. */ -+ dev_t sm_devid; /* Device identifier. */ -+ struct class *sm_class; /* Class. */ -+ struct device *sm_dev; /* Device. */ -+ -+ struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ -+ -+ struct mutex lock; /* Global lock. */ -+ uint32_t guid; /* GUID (next) tracker. */ -+ -+}; -+ -+/* ---- Private Variables ----------------------------------------------- */ -+ -+static struct SM_STATE_T *sm_state; -+static int sm_inited; -+ -+#if 0 -+static const char *const sm_cache_map_vector[] = { -+ "(null)", -+ "host", -+ "videocore", -+ "host+videocore", -+}; -+#endif -+ -+/* ---- Private Function Prototypes -------------------------------------- */ -+ -+/* ---- Private Functions ------------------------------------------------ */ -+ -+static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) -+{ -+ unsigned long pfn = vc_addr & 0x3FFFFFFF; -+ pfn += mm_vc_mem_phys_addr; -+ pfn >>= PAGE_SHIFT; -+ return pfn; -+} -+ -+/* Carries over to the state statistics the statistics once owned by a deceased -+** resource. -+*/ -+static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) -+{ -+ if (sm_state != NULL) { -+ if (p_res != NULL) { -+ int ix; -+ -+ if (terminated) -+ sm_state->res_terminated_cnt++; -+ else -+ sm_state->res_deceased_cnt++; -+ -+ for (ix = 0; ix < END_ALL; ix++) { -+ if (terminated) -+ sm_state->terminated[ix] += -+ p_res->res_stats[ix]; -+ else -+ sm_state->deceased[ix] += -+ p_res->res_stats[ix]; -+ } -+ } -+ } -+} -+ -+/* Fetch a videocore handle corresponding to a mapping of the pid+address -+** returns 0 (ie NULL) if no such handle exists in the global map. -+*/ -+static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, -+ unsigned int addr) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int handle = 0; -+ -+ if (!sm_state || addr == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_addr != addr) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> vc-hdl %x (usr-hdl %x)\n", -+ __func__, map, map->res_pid, map->res_addr, -+ map->res_vc_hdl, map->res_usr_hdl); -+ -+ handle = map->res_vc_hdl; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ ** for something that is not mapped, we do not want a kernel log each -+ ** time around. -+ ** -+ ** There are other error log that would pop up accordingly if someone -+ ** subsequently tries to use something invalid after being told not to -+ ** use it... -+ */ -+ if (handle == 0) { -+ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", -+ __func__, pid, addr); -+ } -+ -+ return handle; -+} -+ -+/* Fetch a user handle corresponding to a mapping of the pid+address -+** returns 0 (ie NULL) if no such handle exists in the global map. -+*/ -+static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, -+ unsigned int addr) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int handle = 0; -+ -+ if (!sm_state || addr == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_addr != addr) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> usr-hdl %x (vc-hdl %x)\n", -+ __func__, map, map->res_pid, map->res_addr, -+ map->res_usr_hdl, map->res_vc_hdl); -+ -+ handle = map->res_usr_hdl; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ * for something that is not mapped yet. -+ * -+ * There are other error log that would pop up accordingly if someone -+ * subsequently tries to use something invalid after being told not to -+ * use it... -+ */ -+ if (handle == 0) -+ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", -+ __func__, pid, addr); -+ -+ return handle; -+} -+ -+#if defined(DO_NOT_USE) -+/* Fetch an address corresponding to a mapping of the pid+handle -+** returns 0 (ie NULL) if no such address exists in the global map. -+*/ -+static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, -+ unsigned int hdl) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int addr = 0; -+ -+ if (sm_state == NULL || hdl == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_vc_hdl != hdl) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+ -+ addr = map->res_addr; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ ** for something that is not mapped, we do not want a kernel log each -+ ** time around. -+ ** -+ ** There are other error log that would pop up accordingly if someone -+ ** subsequently tries to use something invalid after being told not to -+ ** use it... -+ */ -+ if (addr == 0) -+ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", -+ __func__, pid, hdl); -+ -+ return addr; -+} -+#endif -+ -+/* Fetch an address corresponding to a mapping of the pid+handle -+** returns 0 (ie NULL) if no such address exists in the global map. -+*/ -+static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int -+ pid, -+ unsigned int -+ hdl) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int addr = 0; -+ -+ if (sm_state == NULL || hdl == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_usr_hdl != hdl) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+ -+ addr = map->res_addr; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ * for something that is not mapped, we do not want a kernel log each -+ * time around. -+ * -+ * There are other error log that would pop up accordingly if someone -+ * subsequently tries to use something invalid after being told not to -+ * use it... -+ */ -+ if (addr == 0) -+ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", __func__, -+ pid, hdl); -+ -+ return addr; -+} -+ -+/* Adds a resource mapping to the global data list. -+*/ -+static void vmcs_sm_add_map(struct SM_STATE_T *state, -+ struct SM_RESOURCE_T *resource, struct sm_mmap *map) -+{ -+ mutex_lock(&(state->map_lock)); -+ -+ /* Add to the global list of mappings -+ */ -+ list_add(&map->map_list, &state->map_list); -+ -+ /* Add to the list of mappings for this resource -+ */ -+ list_add(&map->resource_map_list, &resource->map_list); -+ resource->map_count++; -+ -+ mutex_unlock(&(state->map_lock)); -+ -+ pr_debug("[%s]: added map %p (pid %u, vc-hdl %x, usr-hdl %x, addr %lx)\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+} -+ -+/* Removes a resource mapping from the global data list. -+*/ -+static void vmcs_sm_remove_map(struct SM_STATE_T *state, -+ struct SM_RESOURCE_T *resource, -+ struct sm_mmap *map) -+{ -+ mutex_lock(&(state->map_lock)); -+ -+ /* Remove from the global list of mappings -+ */ -+ list_del(&map->map_list); -+ -+ /* Remove from the list of mapping for this resource -+ */ -+ list_del(&map->resource_map_list); -+ if (resource->map_count > 0) -+ resource->map_count--; -+ -+ mutex_unlock(&(state->map_lock)); -+ -+ pr_debug("[%s]: removed map %p (pid %d, vc-hdl %x, usr-hdl %x, addr %lx)\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, map->res_usr_hdl, -+ map->res_addr); -+ -+ kfree(map); -+} -+ -+/* Read callback for the global state proc entry. -+*/ -+static int vc_sm_global_state_show(struct seq_file *s, void *v) -+{ -+ struct sm_mmap *map = NULL; -+ int map_count = 0; -+ -+ if (sm_state == NULL) -+ return 0; -+ -+ seq_printf(s, "\nVC-ServiceHandle 0x%x\n", -+ (unsigned int)sm_state->sm_handle); -+ -+ /* Log all applicable mapping(s). -+ */ -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ map_count++; -+ -+ seq_printf(s, "\nMapping 0x%x\n", -+ (unsigned int)map); -+ seq_printf(s, " TGID %u\n", -+ map->res_pid); -+ seq_printf(s, " VC-HDL 0x%x\n", -+ map->res_vc_hdl); -+ seq_printf(s, " USR-HDL 0x%x\n", -+ map->res_usr_hdl); -+ seq_printf(s, " USR-ADDR 0x%lx\n", -+ map->res_addr); -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ seq_printf(s, "\n\nTotal map count: %d\n\n", map_count); -+ -+ return 0; -+} -+ -+static int vc_sm_global_statistics_show(struct seq_file *s, void *v) -+{ -+ int ix; -+ -+ /* Global state tracked statistics. -+ */ -+ if (sm_state != NULL) { -+ seq_puts(s, "\nDeceased Resources Statistics\n"); -+ -+ seq_printf(s, "\nNatural Cause (%u occurences)\n", -+ sm_state->res_deceased_cnt); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->deceased[ix] > 0) { -+ seq_printf(s, " %u\t%s\n", -+ sm_state->deceased[ix], -+ sm_stats_human_read[ix]); -+ } -+ } -+ seq_puts(s, "\n"); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->deceased[ix + END_ATTEMPT] > 0) { -+ seq_printf(s, " %u\tFAILED %s\n", -+ sm_state->deceased[ix + END_ATTEMPT], -+ sm_stats_human_read[ix]); -+ } -+ } -+ -+ seq_printf(s, "\nForcefull (%u occurences)\n", -+ sm_state->res_terminated_cnt); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->terminated[ix] > 0) { -+ seq_printf(s, " %u\t%s\n", -+ sm_state->terminated[ix], -+ sm_stats_human_read[ix]); -+ } -+ } -+ seq_puts(s, "\n"); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->terminated[ix + END_ATTEMPT] > 0) { -+ seq_printf(s, " %u\tFAILED %s\n", -+ sm_state->terminated[ix + -+ END_ATTEMPT], -+ sm_stats_human_read[ix]); -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+#if 0 -+/* Read callback for the statistics proc entry. -+*/ -+static int vc_sm_statistics_show(struct seq_file *s, void *v) -+{ -+ int ix; -+ struct SM_PRIV_DATA_T *file_data; -+ struct SM_RESOURCE_T *resource; -+ int res_count = 0; -+ struct SM_PDE_T *p_pde; -+ -+ p_pde = (struct SM_PDE_T *)(s->private); -+ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); -+ -+ if (file_data == NULL) -+ return 0; -+ -+ /* Per process statistics. -+ */ -+ -+ seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&file_data->resource_list)) { -+ list_for_each_entry(resource, &file_data->resource_list, -+ resource_list) { -+ res_count++; -+ -+ seq_printf(s, "\nGUID: 0x%x\n\n", -+ resource->res_guid); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (resource->res_stats[ix] > 0) { -+ seq_printf(s, -+ " %u\t%s\n", -+ resource->res_stats[ix], -+ sm_stats_human_read[ix]); -+ } -+ } -+ seq_puts(s, "\n"); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (resource->res_stats[ix + END_ATTEMPT] > 0) { -+ seq_printf(s, -+ " %u\tFAILED %s\n", -+ resource->res_stats[ -+ ix + END_ATTEMPT], -+ sm_stats_human_read[ix]); -+ } -+ } -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ seq_printf(s, "\nResources Count %d\n", res_count); -+ -+ return 0; -+} -+#endif -+ -+#if 0 -+/* Read callback for the allocation proc entry. */ -+static int vc_sm_alloc_show(struct seq_file *s, void *v) -+{ -+ struct SM_PRIV_DATA_T *file_data; -+ struct SM_RESOURCE_T *resource; -+ int alloc_count = 0; -+ struct SM_PDE_T *p_pde; -+ -+ p_pde = (struct SM_PDE_T *)(s->private); -+ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); -+ -+ if (!file_data) -+ return 0; -+ -+ /* Per process statistics. */ -+ seq_printf(s, "\nAllocation for TGID %d\n", file_data->pid); -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&file_data->resource_list)) { -+ list_for_each_entry(resource, &file_data->resource_list, -+ resource_list) { -+ alloc_count++; -+ -+ seq_printf(s, "\nGUID: 0x%x\n", -+ resource->res_guid); -+ seq_printf(s, "Lock Count: %u\n", -+ resource->lock_count); -+ seq_printf(s, "Mapped: %s\n", -+ (resource->map_count ? "yes" : "no")); -+ seq_printf(s, "VC-handle: 0x%x\n", -+ resource->res_handle); -+ seq_printf(s, "VC-address: 0x%p\n", -+ resource->res_base_mem); -+ seq_printf(s, "VC-size (bytes): %u\n", -+ resource->res_size); -+ seq_printf(s, "Cache: %s\n", -+ sm_cache_map_vector[resource->res_cached]); -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ seq_printf(s, "\n\nTotal allocation count: %d\n\n", alloc_count); -+ -+ return 0; -+} -+#endif -+ -+static int vc_sm_seq_file_show(struct seq_file *s, void *v) -+{ -+ struct SM_PDE_T *sm_pde; -+ -+ sm_pde = (struct SM_PDE_T *)(s->private); -+ -+ if (sm_pde && sm_pde->show) -+ sm_pde->show(s, v); -+ -+ return 0; -+} -+ -+static int vc_sm_single_open(struct inode *inode, struct file *file) -+{ -+ return single_open(file, vc_sm_seq_file_show, inode->i_private); -+} -+ -+static const struct file_operations vc_sm_debug_fs_fops = { -+ .open = vc_sm_single_open, -+ .read = seq_read, -+ .llseek = seq_lseek, -+ .release = single_release, -+}; -+ -+/* Adds a resource to the private data list which tracks all the allocated -+** data. -+*/ -+static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, -+ struct SM_RESOURCE_T *resource) -+{ -+ mutex_lock(&(sm_state->map_lock)); -+ list_add(&resource->resource_list, &privdata->resource_list); -+ list_add(&resource->global_resource_list, &sm_state->resource_list); -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ pr_debug("[%s]: added resource %p (base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_base_mem, -+ resource->res_handle, resource->res_size, resource->res_cached); -+} -+ -+/* Locates a resource and acquire a reference on it. -+** The resource won't be deleted while there is a reference on it. -+*/ -+static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T -+ *private, -+ unsigned int res_guid) -+{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ list_for_each_entry(resource, &private->resource_list, resource_list) { -+ if (resource->res_guid != res_guid) -+ continue; -+ -+ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_guid, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, resource->res_cached); -+ resource->ref_count++; -+ ret = resource; -+ break; -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return ret; -+} -+ -+/* Locates a resource and acquire a reference on it. -+** The resource won't be deleted while there is a reference on it. -+*/ -+static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( -+ struct SM_PRIV_DATA_T *private) -+{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ list_for_each_entry(resource, &private->resource_list, resource_list) { -+ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_guid, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, resource->res_cached); -+ resource->ref_count++; -+ ret = resource; -+ break; -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return ret; -+} -+ -+/* Locates a resource and acquire a reference on it. -+** The resource won't be deleted while there is a reference on it. -+*/ -+static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int -+ res_guid) -+{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ list_for_each_entry(resource, &sm_state->resource_list, -+ global_resource_list) { -+ if (resource->res_guid != res_guid) -+ continue; -+ -+ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_guid, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, resource->res_cached); -+ resource->ref_count++; -+ ret = resource; -+ break; -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return ret; -+} -+ -+/* Release a previously acquired resource. -+** The resource will be deleted when its refcount reaches 0. -+*/ -+static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) -+{ -+ struct SM_PRIV_DATA_T *private = resource->private; -+ struct sm_mmap *map, *map_tmp; -+ struct SM_RESOURCE_T *res_tmp; -+ int ret; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (--resource->ref_count) { -+ if (force) -+ pr_err("[%s]: resource %p in use\n", __func__, resource); -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ return; -+ } -+ -+ /* Time to free the resource. Start by removing it from the list */ -+ list_del(&resource->resource_list); -+ list_del(&resource->global_resource_list); -+ -+ /* Walk the global resource list, find out if the resource is used -+ * somewhere else. In which case we don't want to delete it. -+ */ -+ list_for_each_entry(res_tmp, &sm_state->resource_list, -+ global_resource_list) { -+ if (res_tmp->res_handle == resource->res_handle) { -+ resource->res_handle = 0; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ pr_debug("[%s]: freeing data - guid %x, hdl %x, base address %p\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem); -+ resource->res_stats[FREE]++; -+ -+ /* Make sure the resource we're removing is unmapped first */ -+ if (resource->map_count && !list_empty(&resource->map_list)) { -+ down_write(¤t->mm->mmap_sem); -+ list_for_each_entry_safe(map, map_tmp, &resource->map_list, -+ resource_map_list) { -+ ret = -+ do_munmap(current->mm, map->res_addr, -+ resource->res_size); -+ if (ret) { -+ pr_err("[%s]: could not unmap resource %p\n", -+ __func__, resource); -+ } -+ } -+ up_write(¤t->mm->mmap_sem); -+ } -+ -+ /* Free up the videocore allocated resource. -+ */ -+ if (resource->res_handle) { -+ VC_SM_FREE_T free = { -+ resource->res_handle, resource->res_base_mem -+ }; -+ int status = vc_vchi_sm_free(sm_state->sm_handle, &free, -+ &private->int_trans_id); -+ if (status != 0 && status != -EINTR) { -+ pr_err("[%s]: failed to free memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ resource->res_stats[FREE_FAIL]++; -+ ret = -EPERM; -+ } -+ } -+ -+ /* Free up the shared resource. -+ */ -+ if (resource->res_shared) -+ vmcs_sm_release_resource(resource->res_shared, 0); -+ -+ /* Free up the local resource tracking this allocation. -+ */ -+ vc_sm_resource_deceased(resource, force); -+ kfree(resource); -+} -+ -+/* Dump the map table for the driver. If process is -1, dumps the whole table, -+** if process is a valid pid (non -1) dump only the entries associated with the -+** pid of interest. -+*/ -+static void vmcs_sm_host_walk_map_per_pid(int pid) -+{ -+ struct sm_mmap *map = NULL; -+ -+ /* Make sure the device was started properly. -+ */ -+ if (sm_state == NULL) { -+ pr_err("[%s]: invalid device\n", __func__); -+ return; -+ } -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Log all applicable mapping(s). -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (pid == -1 || map->res_pid == pid) { -+ pr_info("[%s]: tgid: %u - vc-hdl: %x, usr-hdl: %x, usr-addr: %lx\n", -+ __func__, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+ } -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return; -+} -+ -+/* Dump the allocation table from host side point of view. This only dumps the -+** data allocated for this process/device referenced by the file_data. -+*/ -+static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) -+{ -+ struct SM_RESOURCE_T *resource = NULL; -+ -+ /* Make sure the device was started properly. -+ */ -+ if ((sm_state == NULL) || (file_data == NULL)) { -+ pr_err("[%s]: invalid device\n", __func__); -+ return; -+ } -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&file_data->resource_list)) { -+ list_for_each_entry(resource, &file_data->resource_list, -+ resource_list) { -+ pr_info("[%s]: guid: %x - hdl: %x, vc-mem: %p, size: %u, cache: %u\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem, resource->res_size, -+ resource->res_cached); -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return; -+} -+ -+/* Create support for private data tracking. -+*/ -+static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) -+{ -+ char alloc_name[32]; -+ struct SM_PRIV_DATA_T *file_data = NULL; -+ -+ /* Allocate private structure. */ -+ file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); -+ -+ if (!file_data) { -+ pr_err("[%s]: cannot allocate file data\n", __func__); -+ goto out; -+ } -+ -+ snprintf(alloc_name, sizeof(alloc_name), "%d", id); -+ -+ INIT_LIST_HEAD(&file_data->resource_list); -+ file_data->pid = id; -+ file_data->dir_pid = debugfs_create_dir(alloc_name, -+ sm_state->dir_alloc); -+#if 0 -+ /* TODO: fix this to support querying statistics per pid */ -+ -+ if (IS_ERR_OR_NULL(file_data->dir_pid)) { -+ file_data->dir_pid = NULL; -+ } else { -+ struct dentry *dir_entry; -+ -+ dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, -+ file_data->dir_pid, file_data, -+ vc_sm_debug_fs_fops); -+ -+ file_data->dir_res.dir_entry = dir_entry; -+ file_data->dir_res.priv_data = file_data; -+ file_data->dir_res.show = &vc_sm_alloc_show; -+ -+ dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, -+ file_data->dir_pid, file_data, -+ vc_sm_debug_fs_fops); -+ -+ file_data->dir_res.dir_entry = dir_entry; -+ file_data->dir_res.priv_data = file_data; -+ file_data->dir_res.show = &vc_sm_statistics_show; -+ } -+ pr_debug("[%s]: private data allocated %p\n", __func__, file_data); -+ -+#endif -+out: -+ return file_data; -+} -+ -+/* Open the device. Creates a private state to help track all allocation -+** associated with this device. -+*/ -+static int vc_sm_open(struct inode *inode, struct file *file) -+{ -+ int ret = 0; -+ -+ /* Make sure the device was started properly. -+ */ -+ if (!sm_state) { -+ pr_err("[%s]: invalid device\n", __func__); -+ ret = -EPERM; -+ goto out; -+ } -+ -+ file->private_data = vc_sm_create_priv_data(current->tgid); -+ if (file->private_data == NULL) { -+ pr_err("[%s]: failed to create data tracker\n", __func__); -+ -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+out: -+ return ret; -+} -+ -+/* Close the device. Free up all resources still associated with this device -+** at the time. -+*/ -+static int vc_sm_release(struct inode *inode, struct file *file) -+{ -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ -+ /* Make sure the device was started properly. -+ */ -+ if (sm_state == NULL || file_data == NULL) { -+ pr_err("[%s]: invalid device\n", __func__); -+ ret = -EPERM; -+ goto out; -+ } -+ -+ pr_debug("[%s]: using private data %p\n", __func__, file_data); -+ -+ if (file_data->restart_sys == -EINTR) { -+ VC_SM_ACTION_CLEAN_T action_clean; -+ -+ pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", -+ __func__, file_data->int_action, -+ file_data->int_trans_id); -+ -+ action_clean.res_action = file_data->int_action; -+ action_clean.action_trans_id = file_data->int_trans_id; -+ -+ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); -+ } -+ -+ while ((resource = vmcs_sm_acquire_first_resource(file_data)) != NULL) { -+ vmcs_sm_release_resource(resource, 0); -+ vmcs_sm_release_resource(resource, 1); -+ } -+ -+ /* Remove the corresponding proc entry. */ -+ debugfs_remove_recursive(file_data->dir_pid); -+ -+ /* Terminate the private data. -+ */ -+ kfree(file_data); -+ -+out: -+ return ret; -+} -+ -+static void vcsm_vma_open(struct vm_area_struct *vma) -+{ -+ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; -+ -+ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", -+ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, -+ (int)vma->vm_pgoff); -+ -+ map->ref_count++; -+} -+ -+static void vcsm_vma_close(struct vm_area_struct *vma) -+{ -+ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; -+ -+ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", -+ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, -+ (int)vma->vm_pgoff); -+ -+ map->ref_count--; -+ -+ /* Remove from the map table. -+ */ -+ if (map->ref_count == 0) -+ vmcs_sm_remove_map(sm_state, map->resource, map); -+} -+ -+static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+{ -+ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; -+ struct SM_RESOURCE_T *resource = map->resource; -+ pgoff_t page_offset; -+ unsigned long pfn; -+ int ret = 0; -+ -+ /* Lock the resource if necessary. -+ */ -+ if (!resource->lock_count) { -+ VC_SM_LOCK_UNLOCK_T lock_unlock; -+ VC_SM_LOCK_RESULT_T lock_result; -+ int status; -+ -+ lock_unlock.res_handle = resource->res_handle; -+ lock_unlock.res_mem = resource->res_base_mem; -+ -+ pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", -+ __func__, lock_unlock.res_handle, lock_unlock.res_mem); -+ -+ /* Lock the videocore allocated resource. -+ */ -+ status = vc_vchi_sm_lock(sm_state->sm_handle, -+ &lock_unlock, &lock_result, 0); -+ if ((status != 0) || -+ ((status == 0) && (lock_result.res_mem == NULL))) { -+ pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", -+ __func__, status); -+ resource->res_stats[LOCK_FAIL]++; -+ return VM_FAULT_SIGBUS; -+ } -+ -+ pfn = vcaddr_to_pfn((unsigned long)resource->res_base_mem); -+ outer_inv_range(__pfn_to_phys(pfn), -+ __pfn_to_phys(pfn) + resource->res_size); -+ -+ resource->res_stats[LOCK]++; -+ resource->lock_count++; -+ -+ /* Keep track of the new base memory. -+ */ -+ if ((lock_result.res_mem != NULL) && -+ (lock_result.res_old_mem != NULL) && -+ (lock_result.res_mem != lock_result.res_old_mem)) { -+ resource->res_base_mem = lock_result.res_mem; -+ } -+ } -+ -+ /* We don't use vmf->pgoff since that has the fake offset */ -+ page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start); -+ pfn = (uint32_t)resource->res_base_mem & 0x3FFFFFFF; -+ pfn += mm_vc_mem_phys_addr; -+ pfn += page_offset; -+ pfn >>= PAGE_SHIFT; -+ -+ /* Finally, remap it */ -+ ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn); -+ -+ switch (ret) { -+ case 0: -+ case -ERESTARTSYS: -+ return VM_FAULT_NOPAGE; -+ case -ENOMEM: -+ case -EAGAIN: -+ return VM_FAULT_OOM; -+ default: -+ return VM_FAULT_SIGBUS; -+ } -+} -+ -+static struct vm_operations_struct vcsm_vm_ops = { -+ .open = vcsm_vma_open, -+ .close = vcsm_vma_close, -+ .fault = vcsm_vma_fault, -+}; -+ -+/* Walks a VMA and clean each valid page from the cache */ -+static void vcsm_vma_cache_clean_page_range(unsigned long addr, -+ unsigned long end) -+{ -+ pgd_t *pgd; -+ pud_t *pud; -+ pmd_t *pmd; -+ pte_t *pte; -+ unsigned long pgd_next, pud_next, pmd_next; -+ -+ if (addr >= end) -+ return; -+ -+ /* Walk PGD */ -+ pgd = pgd_offset(current->mm, addr); -+ do { -+ pgd_next = pgd_addr_end(addr, end); -+ -+ if (pgd_none(*pgd) || pgd_bad(*pgd)) -+ continue; -+ -+ /* Walk PUD */ -+ pud = pud_offset(pgd, addr); -+ do { -+ pud_next = pud_addr_end(addr, pgd_next); -+ if (pud_none(*pud) || pud_bad(*pud)) -+ continue; -+ -+ /* Walk PMD */ -+ pmd = pmd_offset(pud, addr); -+ do { -+ pmd_next = pmd_addr_end(addr, pud_next); -+ if (pmd_none(*pmd) || pmd_bad(*pmd)) -+ continue; -+ -+ /* Walk PTE */ -+ pte = pte_offset_map(pmd, addr); -+ do { -+ if (pte_none(*pte) -+ || !pte_present(*pte)) -+ continue; -+ -+ /* Clean + invalidate */ -+ dmac_flush_range((const void *) addr, -+ (const void *) -+ (addr + PAGE_SIZE)); -+ -+ } while (pte++, addr += -+ PAGE_SIZE, addr != pmd_next); -+ pte_unmap(pte); -+ -+ } while (pmd++, addr = pmd_next, addr != pud_next); -+ -+ } while (pud++, addr = pud_next, addr != pgd_next); -+ } while (pgd++, addr = pgd_next, addr != end); -+} -+ -+/* Map an allocated data into something that the user space. -+*/ -+static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ int ret = 0; -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource = NULL; -+ struct sm_mmap *map = NULL; -+ -+ /* Make sure the device was started properly. -+ */ -+ if ((sm_state == NULL) || (file_data == NULL)) { -+ pr_err("[%s]: invalid device\n", __func__); -+ return -EPERM; -+ } -+ -+ pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, -+ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); -+ -+ /* We lookup to make sure that the data we are being asked to mmap is -+ ** something that we allocated. -+ ** -+ ** We use the offset information as the key to tell us which resource -+ ** we are mapping. -+ */ -+ resource = vmcs_sm_acquire_resource(file_data, -+ ((unsigned int)vma->vm_pgoff << -+ PAGE_SHIFT)); -+ if (resource == NULL) { -+ pr_err("[%s]: failed to locate resource for guid %x\n", __func__, -+ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); -+ return -ENOMEM; -+ } -+ -+ pr_debug("[%s]: guid %x, tgid %u, %u, %u\n", -+ __func__, resource->res_guid, current->tgid, resource->pid, -+ file_data->pid); -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", -+ __func__, current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ /* Verify that what we are asked to mmap is proper. -+ */ -+ if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { -+ pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", -+ __func__, -+ resource->res_size, -+ (unsigned int)(vma->vm_end - vma->vm_start)); -+ -+ ret = -EINVAL; -+ goto error; -+ } -+ -+ /* Keep track of the tuple in the global resource list such that one -+ * can do a mapping lookup for address/memory handle. -+ */ -+ map = kzalloc(sizeof(*map), GFP_KERNEL); -+ if (map == NULL) { -+ pr_err("[%s]: failed to allocate global tracking resource\n", -+ __func__); -+ ret = -ENOMEM; -+ goto error; -+ } -+ -+ map->res_pid = current->tgid; -+ map->res_vc_hdl = resource->res_handle; -+ map->res_usr_hdl = resource->res_guid; -+ map->res_addr = (long unsigned int)vma->vm_start; -+ map->resource = resource; -+ map->vma = vma; -+ vmcs_sm_add_map(sm_state, resource, map); -+ -+ /* We are not actually mapping the pages, we just provide a fault -+ ** handler to allow pages to be mapped when accessed -+ */ -+ vma->vm_flags |= -+ VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; -+ vma->vm_ops = &vcsm_vm_ops; -+ vma->vm_private_data = map; -+ -+ /* vm_pgoff is the first PFN of the mapped memory */ -+ vma->vm_pgoff = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; -+ vma->vm_pgoff += mm_vc_mem_phys_addr; -+ vma->vm_pgoff >>= PAGE_SHIFT; -+ -+ if ((resource->res_cached == VMCS_SM_CACHE_NONE) || -+ (resource->res_cached == VMCS_SM_CACHE_VC)) { -+ /* Allocated non host cached memory, honour it. -+ */ -+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -+ } -+ -+ pr_debug("[%s]: resource %p (guid %x) - cnt %u, base address %p, handle %x, size %u (%u), cache %u\n", -+ __func__, -+ resource, resource->res_guid, resource->lock_count, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, (unsigned int)(vma->vm_end - vma->vm_start), -+ resource->res_cached); -+ -+ pr_debug("[%s]: resource %p (base address %p, handle %x) - map-count %d, usr-addr %x\n", -+ __func__, resource, resource->res_base_mem, -+ resource->res_handle, resource->map_count, -+ (unsigned int)vma->vm_start); -+ -+ vcsm_vma_open(vma); -+ resource->res_stats[MAP]++; -+ vmcs_sm_release_resource(resource, 0); -+ return 0; -+ -+error: -+ resource->res_stats[MAP_FAIL]++; -+ vmcs_sm_release_resource(resource, 0); -+ return ret; -+} -+ -+/* Allocate a shared memory handle and block. -+*/ -+int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_alloc *ioparam) -+{ -+ int ret = 0; -+ int status; -+ struct SM_RESOURCE_T *resource; -+ VC_SM_ALLOC_T alloc = { 0 }; -+ VC_SM_ALLOC_RESULT_T result = { 0 }; -+ -+ /* Setup our allocation parameters */ -+ alloc.type = ((ioparam->cached == VMCS_SM_CACHE_VC) -+ || (ioparam->cached == -+ VMCS_SM_CACHE_BOTH)) ? VC_SM_ALLOC_CACHED : -+ VC_SM_ALLOC_NON_CACHED; -+ alloc.base_unit = ioparam->size; -+ alloc.num_unit = ioparam->num; -+ alloc.allocator = current->tgid; -+ /* Align to kernel page size */ -+ alloc.alignement = 4096; -+ /* Align the size to the kernel page size */ -+ alloc.base_unit = -+ (alloc.base_unit + alloc.alignement - 1) & ~(alloc.alignement - 1); -+ if (*ioparam->name) { -+ memcpy(alloc.name, ioparam->name, sizeof(alloc.name) - 1); -+ } else { -+ memcpy(alloc.name, VMCS_SM_RESOURCE_NAME_DEFAULT, -+ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); -+ } -+ -+ pr_debug("[%s]: attempt to allocate \"%s\" data - type %u, base %u (%u), num %u, alignement %u\n", -+ __func__, alloc.name, alloc.type, ioparam->size, -+ alloc.base_unit, alloc.num_unit, alloc.alignement); -+ -+ /* Allocate local resource to track this allocation. -+ */ -+ resource = kzalloc(sizeof(*resource), GFP_KERNEL); -+ if (!resource) { -+ ret = -ENOMEM; -+ goto error; -+ } -+ INIT_LIST_HEAD(&resource->map_list); -+ resource->ref_count++; -+ resource->pid = current->tgid; -+ -+ /* Allocate the videocore resource. -+ */ -+ status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, -+ &private->int_trans_id); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting allocate memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ ret = -ERESTARTSYS; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_ALLOC; -+ goto error; -+ } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { -+ pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ ret = -ENOMEM; -+ resource->res_stats[ALLOC_FAIL]++; -+ goto error; -+ } -+ -+ /* Keep track of the resource we created. -+ */ -+ resource->private = private; -+ resource->res_handle = result.res_handle; -+ resource->res_base_mem = result.res_mem; -+ resource->res_size = alloc.base_unit * alloc.num_unit; -+ resource->res_cached = ioparam->cached; -+ -+ /* Kernel/user GUID. This global identifier is used for mmap'ing the -+ * allocated region from user space, it is passed as the mmap'ing -+ * offset, we use it to 'hide' the videocore handle/address. -+ */ -+ mutex_lock(&sm_state->lock); -+ resource->res_guid = ++sm_state->guid; -+ mutex_unlock(&sm_state->lock); -+ resource->res_guid <<= PAGE_SHIFT; -+ -+ vmcs_sm_add_resource(private, resource); -+ -+ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem, resource->res_size, -+ resource->res_cached); -+ -+ /* We're done */ -+ resource->res_stats[ALLOC]++; -+ ioparam->handle = resource->res_guid; -+ return 0; -+ -+error: -+ pr_err("[%s]: failed to allocate \"%s\" data (%i) - type %u, base %u (%u), num %u, alignment %u\n", -+ __func__, alloc.name, ret, alloc.type, ioparam->size, -+ alloc.base_unit, alloc.num_unit, alloc.alignement); -+ if (resource != NULL) { -+ vc_sm_resource_deceased(resource, 1); -+ kfree(resource); -+ } -+ return ret; -+} -+ -+/* Share an allocate memory handle and block. -+*/ -+int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_alloc_share *ioparam) -+{ -+ struct SM_RESOURCE_T *resource, *shared_resource; -+ int ret = 0; -+ -+ pr_debug("[%s]: attempt to share resource %u\n", __func__, -+ ioparam->handle); -+ -+ shared_resource = vmcs_sm_acquire_global_resource(ioparam->handle); -+ if (shared_resource == NULL) { -+ ret = -ENOMEM; -+ goto error; -+ } -+ -+ /* Allocate local resource to track this allocation. -+ */ -+ resource = kzalloc(sizeof(*resource), GFP_KERNEL); -+ if (resource == NULL) { -+ pr_err("[%s]: failed to allocate local tracking resource\n", -+ __func__); -+ ret = -ENOMEM; -+ goto error; -+ } -+ INIT_LIST_HEAD(&resource->map_list); -+ resource->ref_count++; -+ resource->pid = current->tgid; -+ -+ /* Keep track of the resource we created. -+ */ -+ resource->private = private; -+ resource->res_handle = shared_resource->res_handle; -+ resource->res_base_mem = shared_resource->res_base_mem; -+ resource->res_size = shared_resource->res_size; -+ resource->res_cached = shared_resource->res_cached; -+ resource->res_shared = shared_resource; -+ -+ mutex_lock(&sm_state->lock); -+ resource->res_guid = ++sm_state->guid; -+ mutex_unlock(&sm_state->lock); -+ resource->res_guid <<= PAGE_SHIFT; -+ -+ vmcs_sm_add_resource(private, resource); -+ -+ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem, resource->res_size, -+ resource->res_cached); -+ -+ /* We're done */ -+ resource->res_stats[ALLOC]++; -+ ioparam->handle = resource->res_guid; -+ ioparam->size = resource->res_size; -+ return 0; -+ -+error: -+ pr_err("[%s]: failed to share %u\n", __func__, ioparam->handle); -+ if (shared_resource != NULL) -+ vmcs_sm_release_resource(shared_resource, 0); -+ -+ return ret; -+} -+ -+/* Free a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_free *ioparam) -+{ -+ struct SM_RESOURCE_T *resource = -+ vmcs_sm_acquire_resource(private, ioparam->handle); -+ -+ if (resource == NULL) { -+ pr_err("[%s]: resource for guid %u does not exist\n", __func__, -+ ioparam->handle); -+ return -EINVAL; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", -+ __func__, current->tgid, resource->pid); -+ vmcs_sm_release_resource(resource, 0); -+ return -EPERM; -+ } -+ -+ vmcs_sm_release_resource(resource, 0); -+ vmcs_sm_release_resource(resource, 0); -+ return 0; -+} -+ -+/* Resize a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_resize *ioparam) -+{ -+ int ret = 0; -+ int status; -+ VC_SM_RESIZE_T resize; -+ struct SM_RESOURCE_T *resource; -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(private, ioparam->handle); -+ if (!resource) { -+ pr_err("[%s]: failed resource - guid %x\n", -+ __func__, ioparam->handle); -+ ret = -EFAULT; -+ goto error; -+ } -+ -+ /* If the resource is locked, its reference count will be not NULL, -+ ** in which case we will not be allowed to resize it anyways, so -+ ** reject the attempt here. -+ */ -+ if (resource->lock_count != 0) { -+ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", -+ __func__, ioparam->handle, resource->lock_count); -+ ret = -EFAULT; -+ goto error; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", __func__, -+ current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ if (resource->map_count != 0) { -+ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", -+ __func__, ioparam->handle, resource->map_count); -+ ret = -EFAULT; -+ goto error; -+ } -+ -+ resize.res_handle = resource->res_handle; -+ resize.res_mem = resource->res_base_mem; -+ resize.res_new_size = ioparam->new_size; -+ -+ pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", -+ __func__, ioparam->handle, resize.res_handle, resize.res_mem); -+ -+ /* Resize the videocore allocated resource. -+ */ -+ status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, -+ &private->int_trans_id); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting resize memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ ret = -ERESTARTSYS; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_RESIZE; -+ goto error; -+ } else if (status != 0) { -+ pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ pr_debug("[%s]: success to resize data - hdl %x, size %d -> %d\n", -+ __func__, resize.res_handle, resource->res_size, -+ resize.res_new_size); -+ -+ /* Successfully resized, save the information and inform the user. -+ */ -+ ioparam->old_size = resource->res_size; -+ resource->res_size = resize.res_new_size; -+ -+error: -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ return ret; -+} -+ -+/* Lock a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_lock_unlock *ioparam, -+ int change_cache, enum vmcs_sm_cache_e cache_type, -+ unsigned int vc_addr) -+{ -+ int status; -+ VC_SM_LOCK_UNLOCK_T lock; -+ VC_SM_LOCK_RESULT_T result; -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ struct sm_mmap *map, *map_tmp; -+ long unsigned int phys_addr; -+ -+ map = NULL; -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(private, ioparam->handle); -+ if (resource == NULL) { -+ ret = -EINVAL; -+ goto error; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", __func__, -+ current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ lock.res_handle = resource->res_handle; -+ lock.res_mem = resource->res_base_mem; -+ -+ /* Take the lock and get the address to be mapped. -+ */ -+ if (vc_addr == 0) { -+ pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", -+ __func__, ioparam->handle, lock.res_handle, -+ lock.res_mem); -+ -+ /* Lock the videocore allocated resource. -+ */ -+ status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, -+ &private->int_trans_id); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting lock memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ ret = -ERESTARTSYS; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_LOCK; -+ goto error; -+ } else if (status != 0 || -+ (status == 0 && result.res_mem == NULL)) { -+ pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ ret = -EPERM; -+ resource->res_stats[LOCK_FAIL]++; -+ goto error; -+ } -+ -+ pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", -+ __func__, lock.res_handle, result.res_mem, -+ lock.res_mem, resource->lock_count); -+ } -+ /* Lock assumed taken already, address to be mapped is known. -+ */ -+ else -+ resource->res_base_mem = (void *)vc_addr; -+ -+ resource->res_stats[LOCK]++; -+ resource->lock_count++; -+ -+ /* Keep track of the new base memory allocation if it has changed. -+ */ -+ if ((vc_addr == 0) && -+ (result.res_mem != NULL) && -+ (result.res_old_mem != NULL) && -+ (result.res_mem != result.res_old_mem)) { -+ resource->res_base_mem = result.res_mem; -+ -+ /* Kernel allocated resources. -+ */ -+ if (resource->pid == 0) { -+ if (!list_empty(&resource->map_list)) { -+ list_for_each_entry_safe(map, map_tmp, -+ &resource->map_list, -+ resource_map_list) { -+ if (map->res_addr) { -+ iounmap((void *)map->res_addr); -+ map->res_addr = 0; -+ -+ vmcs_sm_remove_map(sm_state, -+ map->resource, -+ map); -+ break; -+ } -+ } -+ } -+ } -+ } -+ -+ if (change_cache) -+ resource->res_cached = cache_type; -+ -+ if (resource->map_count) { -+ ioparam->addr = -+ vmcs_sm_usr_address_from_pid_and_usr_handle( -+ current->tgid, ioparam->handle); -+ -+ pr_debug("[%s] map_count %d private->pid %d current->tgid %d hnd %x addr %u\n", -+ __func__, resource->map_count, private->pid, -+ current->tgid, ioparam->handle, ioparam->addr); -+ } else { -+ /* Kernel allocated resources. -+ */ -+ if (resource->pid == 0) { -+ pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", -+ __func__, ioparam->handle, lock.res_handle); -+ -+ ioparam->addr = 0; -+ -+ map = kzalloc(sizeof(*map), GFP_KERNEL); -+ if (map == NULL) { -+ pr_err("[%s]: failed allocating tracker\n", -+ __func__); -+ ret = -ENOMEM; -+ goto error; -+ } else { -+ phys_addr = (uint32_t)resource->res_base_mem & -+ 0x3FFFFFFF; -+ phys_addr += mm_vc_mem_phys_addr; -+ if (resource->res_cached -+ == VMCS_SM_CACHE_HOST) { -+ ioparam->addr = (long unsigned int) -+ /* TODO - make cached work */ -+ ioremap_nocache(phys_addr, -+ resource->res_size); -+ -+ pr_debug("[%s]: mapping kernel - guid %x, hdl %x - cached mapping %u\n", -+ __func__, ioparam->handle, -+ lock.res_handle, ioparam->addr); -+ } else { -+ ioparam->addr = (long unsigned int) -+ ioremap_nocache(phys_addr, -+ resource->res_size); -+ -+ pr_debug("[%s]: mapping kernel- guid %x, hdl %x - non cached mapping %u\n", -+ __func__, ioparam->handle, -+ lock.res_handle, ioparam->addr); -+ } -+ -+ map->res_pid = 0; -+ map->res_vc_hdl = resource->res_handle; -+ map->res_usr_hdl = resource->res_guid; -+ map->res_addr = ioparam->addr; -+ map->resource = resource; -+ map->vma = NULL; -+ -+ vmcs_sm_add_map(sm_state, resource, map); -+ } -+ } else -+ ioparam->addr = 0; -+ } -+ -+error: -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ return ret; -+} -+ -+/* Unlock a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_lock_unlock *ioparam, -+ int flush, int wait_reply, int no_vc_unlock) -+{ -+ int status; -+ VC_SM_LOCK_UNLOCK_T unlock; -+ struct sm_mmap *map, *map_tmp; -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ -+ map = NULL; -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(private, ioparam->handle); -+ if (resource == NULL) { -+ ret = -EINVAL; -+ goto error; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", -+ __func__, current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ unlock.res_handle = resource->res_handle; -+ unlock.res_mem = resource->res_base_mem; -+ -+ pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", -+ __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); -+ -+ /* User space allocated resources. -+ */ -+ if (resource->pid) { -+ /* Flush if requested */ -+ if (resource->res_cached && flush) { -+ dma_addr_t phys_addr = 0; -+ resource->res_stats[FLUSH]++; -+ -+ phys_addr = -+ (dma_addr_t)((uint32_t)resource->res_base_mem & -+ 0x3FFFFFFF); -+ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; -+ -+ /* L1 cache flush */ -+ down_read(¤t->mm->mmap_sem); -+ list_for_each_entry(map, &resource->map_list, -+ resource_map_list) { -+ if (map->vma) { -+ unsigned long start; -+ unsigned long end; -+ start = map->vma->vm_start; -+ end = map->vma->vm_end; -+ -+ vcsm_vma_cache_clean_page_range( -+ start, end); -+ } -+ } -+ up_read(¤t->mm->mmap_sem); -+ -+ /* L2 cache flush */ -+ outer_clean_range(phys_addr, -+ phys_addr + -+ (size_t) resource->res_size); -+ } -+ -+ /* We need to zap all the vmas associated with this resource */ -+ if (resource->lock_count == 1) { -+ down_read(¤t->mm->mmap_sem); -+ list_for_each_entry(map, &resource->map_list, -+ resource_map_list) { -+ if (map->vma) { -+ zap_vma_ptes(map->vma, -+ map->vma->vm_start, -+ map->vma->vm_end - -+ map->vma->vm_start); -+ } -+ } -+ up_read(¤t->mm->mmap_sem); -+ } -+ } -+ /* Kernel allocated resources. */ -+ else { -+ /* Global + Taken in this context */ -+ if (resource->ref_count == 2) { -+ if (!list_empty(&resource->map_list)) { -+ list_for_each_entry_safe(map, map_tmp, -+ &resource->map_list, -+ resource_map_list) { -+ if (map->res_addr) { -+ if (flush && -+ (resource->res_cached == -+ VMCS_SM_CACHE_HOST)) { -+ long unsigned int -+ phys_addr; -+ phys_addr = (uint32_t) -+ resource->res_base_mem & 0x3FFFFFFF; -+ phys_addr += -+ mm_vc_mem_phys_addr; -+ -+ /* L1 cache flush */ -+ dmac_flush_range((const -+ void -+ *) -+ map->res_addr, (const void *) -+ (map->res_addr + resource->res_size)); -+ -+ /* L2 cache flush */ -+ outer_clean_range -+ (phys_addr, -+ phys_addr + -+ (size_t) -+ resource->res_size); -+ } -+ -+ iounmap((void *)map->res_addr); -+ map->res_addr = 0; -+ -+ vmcs_sm_remove_map(sm_state, -+ map->resource, -+ map); -+ break; -+ } -+ } -+ } -+ } -+ } -+ -+ if (resource->lock_count) { -+ /* Bypass the videocore unlock. -+ */ -+ if (no_vc_unlock) -+ status = 0; -+ /* Unlock the videocore allocated resource. -+ */ -+ else { -+ status = -+ vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, -+ &private->int_trans_id, -+ wait_reply); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting unlock memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ -+ ret = -ERESTARTSYS; -+ resource->res_stats[UNLOCK]--; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_UNLOCK; -+ goto error; -+ } else if (status != 0) { -+ pr_err("[%s]: failed to unlock vc mem (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ -+ ret = -EPERM; -+ resource->res_stats[UNLOCK_FAIL]++; -+ goto error; -+ } -+ } -+ -+ resource->res_stats[UNLOCK]++; -+ resource->lock_count--; -+ } -+ -+ pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", -+ __func__, unlock.res_handle, unlock.res_mem, -+ resource->lock_count); -+ -+error: -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ return ret; -+} -+ -+/* Handle control from host. */ -+static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int ret = 0; -+ unsigned int cmdnr = _IOC_NR(cmd); -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource = NULL; -+ -+ /* Validate we can work with this device. */ -+ if ((sm_state == NULL) || (file_data == NULL)) { -+ pr_err("[%s]: invalid device\n", __func__); -+ ret = -EPERM; -+ goto out; -+ } -+ -+ pr_debug("[%s]: cmd %x tgid %u, owner %u\n", __func__, cmdnr, -+ current->tgid, file_data->pid); -+ -+ /* Action is a re-post of a previously interrupted action? */ -+ if (file_data->restart_sys == -EINTR) { -+ VC_SM_ACTION_CLEAN_T action_clean; -+ -+ pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", -+ __func__, file_data->int_action, -+ file_data->int_trans_id); -+ -+ action_clean.res_action = file_data->int_action; -+ action_clean.action_trans_id = file_data->int_trans_id; -+ -+ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); -+ -+ file_data->restart_sys = 0; -+ } -+ -+ /* Now process the command. -+ */ -+ switch (cmdnr) { -+ /* New memory allocation. -+ */ -+ case VMCS_SM_CMD_ALLOC: -+ { -+ struct vmcs_sm_ioctl_alloc ioparam; -+ -+ /* Get the parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_alloc(file_data, &ioparam); -+ if (!ret && -+ (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0)) { -+ struct vmcs_sm_ioctl_free freeparam = { -+ ioparam.handle -+ }; -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ vc_sm_ioctl_free(file_data, &freeparam); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Share existing memory allocation. -+ */ -+ case VMCS_SM_CMD_ALLOC_SHARE: -+ { -+ struct vmcs_sm_ioctl_alloc_share ioparam; -+ -+ /* Get the parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); -+ -+ /* Copy result back to user. -+ */ -+ if (!ret -+ && copy_to_user((void *)arg, &ioparam, -+ sizeof(ioparam)) != 0) { -+ struct vmcs_sm_ioctl_free freeparam = { -+ ioparam.handle -+ }; -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ vc_sm_ioctl_free(file_data, &freeparam); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Lock (attempt to) *and* register a cache behavior change. -+ */ -+ case VMCS_SM_CMD_LOCK_CACHE: -+ { -+ struct vmcs_sm_ioctl_lock_cache ioparam; -+ struct vmcs_sm_ioctl_lock_unlock lock; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ lock.handle = ioparam.handle; -+ ret = -+ vc_sm_ioctl_lock(file_data, &lock, 1, -+ ioparam.cached, 0); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Lock (attempt to) existing memory allocation. -+ */ -+ case VMCS_SM_CMD_LOCK: -+ { -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); -+ -+ /* Copy result back to user. -+ */ -+ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) -+ != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Unlock (attempt to) existing memory allocation. -+ */ -+ case VMCS_SM_CMD_UNLOCK: -+ { -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Resize (attempt to) existing memory allocation. -+ */ -+ case VMCS_SM_CMD_RESIZE: -+ { -+ struct vmcs_sm_ioctl_resize ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_resize(file_data, &ioparam); -+ -+ /* Copy result back to user. -+ */ -+ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) -+ != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Terminate existing memory allocation. -+ */ -+ case VMCS_SM_CMD_FREE: -+ { -+ struct vmcs_sm_ioctl_free ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_free(file_data, &ioparam); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Walk allocation on videocore, information shows up in the -+ ** videocore log. -+ */ -+ case VMCS_SM_CMD_VC_WALK_ALLOC: -+ { -+ pr_debug("[%s]: invoking walk alloc\n", __func__); -+ -+ if (vc_vchi_sm_walk_alloc(sm_state->sm_handle) != 0) -+ pr_err("[%s]: failed to walk-alloc on videocore\n", -+ __func__); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+/* Walk mapping table on host, information shows up in the -+ ** kernel log. -+ */ -+ case VMCS_SM_CMD_HOST_WALK_MAP: -+ { -+ /* Use pid of -1 to tell to walk the whole map. */ -+ vmcs_sm_host_walk_map_per_pid(-1); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Walk mapping table per process on host. */ -+ case VMCS_SM_CMD_HOST_WALK_PID_ALLOC: -+ { -+ struct vmcs_sm_ioctl_walk ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ vmcs_sm_host_walk_alloc(file_data); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Walk allocation per process on host. */ -+ case VMCS_SM_CMD_HOST_WALK_PID_MAP: -+ { -+ struct vmcs_sm_ioctl_walk ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ vmcs_sm_host_walk_map_per_pid(ioparam.pid); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Gets the size of the memory associated with a user handle. */ -+ case VMCS_SM_CMD_SIZE_USR_HANDLE: -+ { -+ struct vmcs_sm_ioctl_size ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource != NULL) { -+ ioparam.size = resource->res_size; -+ vmcs_sm_release_resource(resource, 0); -+ } else { -+ ioparam.size = 0; -+ } -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Verify we are dealing with a valid resource. */ -+ case VMCS_SM_CMD_CHK_USR_HANDLE: -+ { -+ struct vmcs_sm_ioctl_chk ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource == NULL) -+ ret = -EINVAL; -+ /* If the resource is cacheable, return additional -+ * information that may be needed to flush the cache. -+ */ -+ else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || -+ (resource->res_cached == VMCS_SM_CACHE_BOTH)) { -+ ioparam.addr = -+ vmcs_sm_usr_address_from_pid_and_usr_handle -+ (current->tgid, ioparam.handle); -+ ioparam.size = resource->res_size; -+ ioparam.cache = resource->res_cached; -+ } else { -+ ioparam.addr = 0; -+ ioparam.size = 0; -+ ioparam.cache = resource->res_cached; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* -+ * Maps a user handle given the process and the virtual address. -+ */ -+ case VMCS_SM_CMD_MAPPED_USR_HANDLE: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ioparam.handle = -+ vmcs_sm_usr_handle_from_pid_and_address( -+ ioparam.pid, ioparam.addr); -+ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if ((resource != NULL) -+ && ((resource->res_cached == VMCS_SM_CACHE_HOST) -+ || (resource->res_cached == -+ VMCS_SM_CACHE_BOTH))) { -+ ioparam.size = resource->res_size; -+ } else { -+ ioparam.size = 0; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* -+ * Maps a videocore handle given process and virtual address. -+ */ -+ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ioparam.handle = vmcs_sm_vc_handle_from_pid_and_address( -+ ioparam.pid, ioparam.addr); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Maps a videocore handle given process and user handle. */ -+ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource != NULL) { -+ ioparam.handle = resource->res_handle; -+ vmcs_sm_release_resource(resource, 0); -+ } else { -+ ioparam.handle = 0; -+ } -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* -+ * Maps a videocore address given process and videocore handle. -+ */ -+ case VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource != NULL) { -+ ioparam.addr = -+ (unsigned int)resource->res_base_mem; -+ vmcs_sm_release_resource(resource, 0); -+ } else { -+ ioparam.addr = 0; -+ } -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Maps a user address given process and vc handle. -+ */ -+ case VMCS_SM_CMD_MAPPED_USR_ADDRESS: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* -+ * Return the address information from the mapping, -+ * 0 (ie NULL) if it cannot locate the actual mapping. -+ */ -+ ioparam.addr = -+ vmcs_sm_usr_address_from_pid_and_usr_handle -+ (ioparam.pid, ioparam.handle); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Flush the cache for a given mapping. */ -+ case VMCS_SM_CMD_FLUSH: -+ { -+ struct vmcs_sm_ioctl_cache ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ -+ if ((resource != NULL) && resource->res_cached) { -+ dma_addr_t phys_addr = 0; -+ -+ resource->res_stats[FLUSH]++; -+ -+ phys_addr = -+ (dma_addr_t)((uint32_t) -+ resource->res_base_mem & -+ 0x3FFFFFFF); -+ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; -+ -+ /* L1 cache flush */ -+ down_read(¤t->mm->mmap_sem); -+ vcsm_vma_cache_clean_page_range((unsigned long) -+ ioparam.addr, -+ (unsigned long) -+ ioparam.addr + -+ ioparam.size); -+ up_read(¤t->mm->mmap_sem); -+ -+ /* L2 cache flush */ -+ outer_clean_range(phys_addr, -+ phys_addr + -+ (size_t) ioparam.size); -+ } else if (resource == NULL) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Invalidate the cache for a given mapping. */ -+ case VMCS_SM_CMD_INVALID: -+ { -+ struct vmcs_sm_ioctl_cache ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. -+ */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ -+ if ((resource != NULL) && resource->res_cached) { -+ dma_addr_t phys_addr = 0; -+ -+ resource->res_stats[INVALID]++; -+ -+ phys_addr = -+ (dma_addr_t)((uint32_t) -+ resource->res_base_mem & -+ 0x3FFFFFFF); -+ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; -+ -+ /* L2 cache invalidate */ -+ outer_inv_range(phys_addr, -+ phys_addr + -+ (size_t) ioparam.size); -+ -+ /* L1 cache invalidate */ -+ down_read(¤t->mm->mmap_sem); -+ vcsm_vma_cache_clean_page_range((unsigned long) -+ ioparam.addr, -+ (unsigned long) -+ ioparam.addr + -+ ioparam.size); -+ up_read(¤t->mm->mmap_sem); -+ } else if (resource == NULL) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Flush/Invalidate the cache for a given mapping. */ -+ case VMCS_SM_CMD_CLEAN_INVALID: -+ { -+ int i; -+ struct vmcs_sm_ioctl_clean_invalid ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ for (i=0; ires_cached) { -+ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); -+ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); -+ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; -+ -+ /* L1/L2 cache flush */ -+ down_read(¤t->mm->mmap_sem); -+ vcsm_vma_cache_clean_page_range(base, end); -+ up_read(¤t->mm->mmap_sem); -+ } else if (resource == NULL) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ } -+ break; -+ } -+ } -+ } -+ break; -+ -+ default: -+ { -+ ret = -EINVAL; -+ goto out; -+ } -+ break; -+ } -+ -+out: -+ return ret; -+} -+ -+/* Device operations that we managed in this driver. -+*/ -+static const struct file_operations vmcs_sm_ops = { -+ .owner = THIS_MODULE, -+ .unlocked_ioctl = vc_sm_ioctl, -+ .open = vc_sm_open, -+ .release = vc_sm_release, -+ .mmap = vc_sm_mmap, -+}; -+ -+/* Creation of device. -+*/ -+static int vc_sm_create_sharedmemory(void) -+{ -+ int ret; -+ -+ if (sm_state == NULL) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ /* Create a device class for creating dev nodes. -+ */ -+ sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); -+ if (IS_ERR(sm_state->sm_class)) { -+ pr_err("[%s]: unable to create device class\n", __func__); -+ ret = PTR_ERR(sm_state->sm_class); -+ goto out; -+ } -+ -+ /* Create a character driver. -+ */ -+ ret = alloc_chrdev_region(&sm_state->sm_devid, -+ DEVICE_MINOR, 1, DEVICE_NAME); -+ if (ret != 0) { -+ pr_err("[%s]: unable to allocate device number\n", __func__); -+ goto out_dev_class_destroy; -+ } -+ -+ cdev_init(&sm_state->sm_cdev, &vmcs_sm_ops); -+ ret = cdev_add(&sm_state->sm_cdev, sm_state->sm_devid, 1); -+ if (ret != 0) { -+ pr_err("[%s]: unable to register device\n", __func__); -+ goto out_chrdev_unreg; -+ } -+ -+ /* Create a device node. -+ */ -+ sm_state->sm_dev = device_create(sm_state->sm_class, -+ NULL, -+ MKDEV(MAJOR(sm_state->sm_devid), -+ DEVICE_MINOR), NULL, -+ DEVICE_NAME); -+ if (IS_ERR(sm_state->sm_dev)) { -+ pr_err("[%s]: unable to create device node\n", __func__); -+ ret = PTR_ERR(sm_state->sm_dev); -+ goto out_chrdev_del; -+ } -+ -+ goto out; -+ -+out_chrdev_del: -+ cdev_del(&sm_state->sm_cdev); -+out_chrdev_unreg: -+ unregister_chrdev_region(sm_state->sm_devid, 1); -+out_dev_class_destroy: -+ class_destroy(sm_state->sm_class); -+ sm_state->sm_class = NULL; -+out: -+ return ret; -+} -+ -+/* Termination of the device. -+*/ -+static int vc_sm_remove_sharedmemory(void) -+{ -+ int ret; -+ -+ if (sm_state == NULL) { -+ /* Nothing to do. -+ */ -+ ret = 0; -+ goto out; -+ } -+ -+ /* Remove the sharedmemory character driver. -+ */ -+ cdev_del(&sm_state->sm_cdev); -+ -+ /* Unregister region. -+ */ -+ unregister_chrdev_region(sm_state->sm_devid, 1); -+ -+ ret = 0; -+ goto out; -+ -+out: -+ return ret; -+} -+ -+/* Videocore connected. */ -+static void vc_sm_connected_init(void) -+{ -+ int ret; -+ VCHI_INSTANCE_T vchi_instance; -+ VCHI_CONNECTION_T *vchi_connection = NULL; -+ -+ pr_info("[%s]: start\n", __func__); -+ -+ /* Allocate memory for the state structure. -+ */ -+ sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); -+ if (sm_state == NULL) { -+ pr_err("[%s]: failed to allocate memory\n", __func__); -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ mutex_init(&sm_state->lock); -+ mutex_init(&sm_state->map_lock); -+ -+ /* Initialize and create a VCHI connection for the shared memory service -+ ** running on videocore. -+ */ -+ ret = vchi_initialise(&vchi_instance); -+ if (ret != 0) { -+ pr_err("[%s]: failed to initialise VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ -+ ret = vchi_connect(NULL, 0, vchi_instance); -+ if (ret != 0) { -+ pr_err("[%s]: failed to connect VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ -+ /* Initialize an instance of the shared memory service. */ -+ sm_state->sm_handle = -+ vc_vchi_sm_init(vchi_instance, &vchi_connection, 1); -+ if (sm_state->sm_handle == NULL) { -+ pr_err("[%s]: failed to initialize shared memory service\n", -+ __func__); -+ -+ ret = -EPERM; -+ goto err_free_mem; -+ } -+ -+ /* Create a debug fs directory entry (root). */ -+ sm_state->dir_root = debugfs_create_dir(VC_SM_DIR_ROOT_NAME, NULL); -+ if (!sm_state->dir_root) { -+ pr_err("[%s]: failed to create \'%s\' directory entry\n", -+ __func__, VC_SM_DIR_ROOT_NAME); -+ -+ ret = -EPERM; -+ goto err_stop_sm_service; -+ } -+ -+ sm_state->dir_state.show = &vc_sm_global_state_show; -+ sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, -+ S_IRUGO, sm_state->dir_root, &sm_state->dir_state, -+ &vc_sm_debug_fs_fops); -+ -+ sm_state->dir_stats.show = &vc_sm_global_statistics_show; -+ sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, -+ S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, -+ &vc_sm_debug_fs_fops); -+ -+ /* Create the proc entry children. */ -+ sm_state->dir_alloc = debugfs_create_dir(VC_SM_DIR_ALLOC_NAME, -+ sm_state->dir_root); -+ -+ /* Create a shared memory device. */ -+ ret = vc_sm_create_sharedmemory(); -+ if (ret != 0) { -+ pr_err("[%s]: failed to create shared memory device\n", -+ __func__); -+ goto err_remove_debugfs; -+ } -+ -+ INIT_LIST_HEAD(&sm_state->map_list); -+ INIT_LIST_HEAD(&sm_state->resource_list); -+ -+ sm_state->data_knl = vc_sm_create_priv_data(0); -+ if (sm_state->data_knl == NULL) { -+ pr_err("[%s]: failed to create kernel private data tracker\n", -+ __func__); -+ goto err_remove_shared_memory; -+ } -+ -+ /* Done! -+ */ -+ sm_inited = 1; -+ goto out; -+ -+err_remove_shared_memory: -+ vc_sm_remove_sharedmemory(); -+err_remove_debugfs: -+ debugfs_remove_recursive(sm_state->dir_root); -+err_stop_sm_service: -+ vc_vchi_sm_stop(&sm_state->sm_handle); -+err_free_mem: -+ kfree(sm_state); -+out: -+ pr_info("[%s]: end - returning %d\n", __func__, ret); -+} -+ -+/* Driver loading. */ -+static int __init vc_sm_init(void) -+{ -+ pr_info("vc-sm: Videocore shared memory driver\n"); -+ vchiq_add_connected_callback(vc_sm_connected_init); -+ return 0; -+} -+ -+/* Driver unloading. */ -+static void __exit vc_sm_exit(void) -+{ -+ pr_debug("[%s]: start\n", __func__); -+ if (sm_inited) { -+ /* Remove shared memory device. -+ */ -+ vc_sm_remove_sharedmemory(); -+ -+ /* Remove all proc entries. -+ */ -+ debugfs_remove_recursive(sm_state->dir_root); -+ -+ /* Stop the videocore shared memory service. -+ */ -+ vc_vchi_sm_stop(&sm_state->sm_handle); -+ -+ /* Free the memory for the state structure. -+ */ -+ mutex_destroy(&(sm_state->map_lock)); -+ kfree(sm_state); -+ } -+ -+ pr_debug("[%s]: end\n", __func__); -+} -+ -+#if defined(__KERNEL__) -+/* Allocate a shared memory handle and block. */ -+int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) -+{ -+ struct vmcs_sm_ioctl_alloc ioparam = { 0 }; -+ int ret; -+ struct SM_RESOURCE_T *resource; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || alloc == NULL || handle == NULL) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ ioparam.size = alloc->base_unit; -+ ioparam.num = alloc->num_unit; -+ ioparam.cached = -+ alloc->type == VC_SM_ALLOC_CACHED ? VMCS_SM_CACHE_VC : 0; -+ -+ ret = vc_sm_ioctl_alloc(sm_state->data_knl, &ioparam); -+ -+ if (ret == 0) { -+ resource = -+ vmcs_sm_acquire_resource(sm_state->data_knl, -+ ioparam.handle); -+ if (resource) { -+ resource->pid = 0; -+ vmcs_sm_release_resource(resource, 0); -+ -+ /* Assign valid handle at this time. -+ */ -+ *handle = ioparam.handle; -+ } else { -+ ret = -ENOMEM; -+ } -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_alloc); -+ -+/* Get an internal resource handle mapped from the external one. -+*/ -+int vc_sm_int_handle(int handle) -+{ -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return 0; -+ } -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); -+ if (resource) { -+ ret = resource->res_handle; -+ vmcs_sm_release_resource(resource, 0); -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_int_handle); -+ -+/* Free a previously allocated shared memory handle and block. -+*/ -+int vc_sm_free(int handle) -+{ -+ struct vmcs_sm_ioctl_free ioparam = { handle }; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ return vc_sm_ioctl_free(sm_state->data_knl, &ioparam); -+} -+EXPORT_SYMBOL_GPL(vc_sm_free); -+ -+/* Lock a memory handle for use by kernel. -+*/ -+int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data) -+{ -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ int ret; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0 || data == NULL) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ *data = 0; -+ -+ ioparam.handle = handle; -+ ret = vc_sm_ioctl_lock(sm_state->data_knl, -+ &ioparam, -+ 1, -+ ((mode == -+ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : -+ VMCS_SM_CACHE_NONE), 0); -+ -+ *data = ioparam.addr; -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_lock); -+ -+/* Unlock a memory handle in use by kernel. -+*/ -+int vc_sm_unlock(int handle, int flush, int no_vc_unlock) -+{ -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ ioparam.handle = handle; -+ return vc_sm_ioctl_unlock(sm_state->data_knl, -+ &ioparam, flush, 0, no_vc_unlock); -+} -+EXPORT_SYMBOL_GPL(vc_sm_unlock); -+ -+/* Map a shared memory region for use by kernel. -+*/ -+int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data) -+{ -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ int ret; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ *data = 0; -+ -+ ioparam.handle = handle; -+ ret = vc_sm_ioctl_lock(sm_state->data_knl, -+ &ioparam, -+ 1, -+ ((mode == -+ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : -+ VMCS_SM_CACHE_NONE), sm_addr); -+ -+ *data = ioparam.addr; -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_map); -+#endif -+ -+late_initcall(vc_sm_init); -+module_exit(vc_sm_exit); -+ -+MODULE_AUTHOR("Broadcom"); -+MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); -+MODULE_LICENSE("GPL v2"); -diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h -new file mode 100644 -index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f38cf76564 ---- /dev/null -+++ b/include/linux/broadcom/vmcs_sm_ioctl.h -@@ -0,0 +1,248 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+* -+*****************************************************************************/ -+ -+#if !defined(__VMCS_SM_IOCTL_H__INCLUDED__) -+#define __VMCS_SM_IOCTL_H__INCLUDED__ -+ -+/* ---- Include Files ---------------------------------------------------- */ -+ -+#if defined(__KERNEL__) -+#include /* Needed for standard types */ -+#else -+#include -+#endif -+ -+#include -+ -+/* ---- Constants and Types ---------------------------------------------- */ -+ -+#define VMCS_SM_RESOURCE_NAME 32 -+#define VMCS_SM_RESOURCE_NAME_DEFAULT "sm-host-resource" -+ -+/* Type define used to create unique IOCTL number */ -+#define VMCS_SM_MAGIC_TYPE 'I' -+ -+/* IOCTL commands */ -+enum vmcs_sm_cmd_e { -+ VMCS_SM_CMD_ALLOC = 0x5A, /* Start at 0x5A arbitrarily */ -+ VMCS_SM_CMD_ALLOC_SHARE, -+ VMCS_SM_CMD_LOCK, -+ VMCS_SM_CMD_LOCK_CACHE, -+ VMCS_SM_CMD_UNLOCK, -+ VMCS_SM_CMD_RESIZE, -+ VMCS_SM_CMD_UNMAP, -+ VMCS_SM_CMD_FREE, -+ VMCS_SM_CMD_FLUSH, -+ VMCS_SM_CMD_INVALID, -+ -+ VMCS_SM_CMD_SIZE_USR_HANDLE, -+ VMCS_SM_CMD_CHK_USR_HANDLE, -+ -+ VMCS_SM_CMD_MAPPED_USR_HANDLE, -+ VMCS_SM_CMD_MAPPED_USR_ADDRESS, -+ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR, -+ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL, -+ VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL, -+ -+ VMCS_SM_CMD_VC_WALK_ALLOC, -+ VMCS_SM_CMD_HOST_WALK_MAP, -+ VMCS_SM_CMD_HOST_WALK_PID_ALLOC, -+ VMCS_SM_CMD_HOST_WALK_PID_MAP, -+ -+ VMCS_SM_CMD_CLEAN_INVALID, -+ -+ VMCS_SM_CMD_LAST /* Do no delete */ -+}; -+ -+/* Cache type supported, conveniently matches the user space definition in -+** user-vcsm.h. -+*/ -+enum vmcs_sm_cache_e { -+ VMCS_SM_CACHE_NONE, -+ VMCS_SM_CACHE_HOST, -+ VMCS_SM_CACHE_VC, -+ VMCS_SM_CACHE_BOTH, -+}; -+ -+/* IOCTL Data structures */ -+struct vmcs_sm_ioctl_alloc { -+ /* user -> kernel */ -+ unsigned int size; -+ unsigned int num; -+ enum vmcs_sm_cache_e cached; -+ char name[VMCS_SM_RESOURCE_NAME]; -+ -+ /* kernel -> user */ -+ unsigned int handle; -+ /* unsigned int base_addr; */ -+}; -+ -+struct vmcs_sm_ioctl_alloc_share { -+ /* user -> kernel */ -+ unsigned int handle; -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_free { -+ /* user -> kernel */ -+ unsigned int handle; -+ /* unsigned int base_addr; */ -+}; -+ -+struct vmcs_sm_ioctl_lock_unlock { -+ /* user -> kernel */ -+ unsigned int handle; -+ -+ /* kernel -> user */ -+ unsigned int addr; -+}; -+ -+struct vmcs_sm_ioctl_lock_cache { -+ /* user -> kernel */ -+ unsigned int handle; -+ enum vmcs_sm_cache_e cached; -+}; -+ -+struct vmcs_sm_ioctl_resize { -+ /* user -> kernel */ -+ unsigned int handle; -+ unsigned int new_size; -+ -+ /* kernel -> user */ -+ unsigned int old_size; -+}; -+ -+struct vmcs_sm_ioctl_map { -+ /* user -> kernel */ -+ /* and kernel -> user */ -+ unsigned int pid; -+ unsigned int handle; -+ unsigned int addr; -+ -+ /* kernel -> user */ -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_walk { -+ /* user -> kernel */ -+ unsigned int pid; -+}; -+ -+struct vmcs_sm_ioctl_chk { -+ /* user -> kernel */ -+ unsigned int handle; -+ -+ /* kernel -> user */ -+ unsigned int addr; -+ unsigned int size; -+ enum vmcs_sm_cache_e cache; -+}; -+ -+struct vmcs_sm_ioctl_size { -+ /* user -> kernel */ -+ unsigned int handle; -+ -+ /* kernel -> user */ -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_cache { -+ /* user -> kernel */ -+ unsigned int handle; -+ unsigned int addr; -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_clean_invalid { -+ /* user -> kernel */ -+ struct { -+ unsigned int cmd; -+ unsigned int handle; -+ unsigned int addr; -+ unsigned int size; -+ } s[8]; -+}; -+ -+/* IOCTL numbers */ -+#define VMCS_SM_IOCTL_MEM_ALLOC\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ -+ struct vmcs_sm_ioctl_alloc) -+#define VMCS_SM_IOCTL_MEM_ALLOC_SHARE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC_SHARE,\ -+ struct vmcs_sm_ioctl_alloc_share) -+#define VMCS_SM_IOCTL_MEM_LOCK\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK,\ -+ struct vmcs_sm_ioctl_lock_unlock) -+#define VMCS_SM_IOCTL_MEM_LOCK_CACHE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK_CACHE,\ -+ struct vmcs_sm_ioctl_lock_cache) -+#define VMCS_SM_IOCTL_MEM_UNLOCK\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_UNLOCK,\ -+ struct vmcs_sm_ioctl_lock_unlock) -+#define VMCS_SM_IOCTL_MEM_RESIZE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_RESIZE,\ -+ struct vmcs_sm_ioctl_resize) -+#define VMCS_SM_IOCTL_MEM_FREE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FREE,\ -+ struct vmcs_sm_ioctl_free) -+#define VMCS_SM_IOCTL_MEM_FLUSH\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FLUSH,\ -+ struct vmcs_sm_ioctl_cache) -+#define VMCS_SM_IOCTL_MEM_INVALID\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_INVALID,\ -+ struct vmcs_sm_ioctl_cache) -+#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ -+ struct vmcs_sm_ioctl_clean_invalid) -+ -+#define VMCS_SM_IOCTL_SIZE_USR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ -+ struct vmcs_sm_ioctl_size) -+#define VMCS_SM_IOCTL_CHK_USR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CHK_USR_HANDLE,\ -+ struct vmcs_sm_ioctl_chk) -+ -+#define VMCS_SM_IOCTL_MAP_USR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_HANDLE,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_USR_ADDRESS\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_ADDRESS,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_ADDR\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_VC_ADDR_FR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL,\ -+ struct vmcs_sm_ioctl_map) -+ -+#define VMCS_SM_IOCTL_VC_WALK_ALLOC\ -+ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_VC_WALK_ALLOC) -+#define VMCS_SM_IOCTL_HOST_WALK_MAP\ -+ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_MAP) -+#define VMCS_SM_IOCTL_HOST_WALK_PID_ALLOC\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_ALLOC,\ -+ struct vmcs_sm_ioctl_walk) -+#define VMCS_SM_IOCTL_HOST_WALK_PID_MAP\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ -+ struct vmcs_sm_ioctl_walk) -+ -+/* ---- Variable Externs ------------------------------------------------- */ -+ -+/* ---- Function Prototypes ---------------------------------------------- */ -+ -+#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ - -From 3d892851d6e52bec4c02b06146967ecc52b50af0 Mon Sep 17 00:00:00 2001 -From: Luke Wren -Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 041/122] Add /dev/gpiomem device for rootless user GPIO access - -Signed-off-by: Luke Wren - -bcm2835-gpiomem: Fix for ARCH_BCM2835 builds - -Build on ARCH_BCM2835, and fail to probe if no IO resource. - -See: https://github.com/raspberrypi/linux/issues/1154 ---- - drivers/char/broadcom/Kconfig | 9 ++ - drivers/char/broadcom/Makefile | 3 + - drivers/char/broadcom/bcm2835-gpiomem.c | 260 ++++++++++++++++++++++++++++++++ - 3 files changed, 272 insertions(+) - create mode 100644 drivers/char/broadcom/bcm2835-gpiomem.c - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index 75fa1cba764084160f7cb77e56058f25b5e9f0ce..b75c9b2639fb0e63dd2623ddc1dcaac5759c132b 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -32,3 +32,12 @@ config BCM_VC_SM - help - Support for the VC shared memory on the Broadcom reference - design. Uses the VCHIQ stack. -+ -+config BCM2835_DEVGPIOMEM -+ tristate "/dev/gpiomem rootless GPIO access via mmap() on the BCM2835" -+ default m -+ help -+ Provides users with root-free access to the GPIO registers -+ on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO -+ register page to the user's pointer. -+ -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index de8feb98c63ff1e6437d80a6db85a8d30f433705..1eb06e9788663c3e75d201a559db55556cecfe2b 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1,3 +1,6 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ - obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o - obj-$(CONFIG_BCM_VC_SM) += vc_sm/ -+ -+obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o -+ -diff --git a/drivers/char/broadcom/bcm2835-gpiomem.c b/drivers/char/broadcom/bcm2835-gpiomem.c -new file mode 100644 -index 0000000000000000000000000000000000000000..911f5b7393ed48ceed8751f06967ae6463453f9c ---- /dev/null -+++ b/drivers/char/broadcom/bcm2835-gpiomem.c -@@ -0,0 +1,260 @@ -+/** -+ * GPIO memory device driver -+ * -+ * Creates a chardev /dev/gpiomem which will provide user access to -+ * the BCM2835's GPIO registers when it is mmap()'d. -+ * No longer need root for user GPIO access, but without relaxing permissions -+ * on /dev/mem. -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DEVICE_NAME "bcm2835-gpiomem" -+#define DRIVER_NAME "gpiomem-bcm2835" -+#define DEVICE_MINOR 0 -+ -+struct bcm2835_gpiomem_instance { -+ unsigned long gpio_regs_phys; -+ struct device *dev; -+}; -+ -+static struct cdev bcm2835_gpiomem_cdev; -+static dev_t bcm2835_gpiomem_devid; -+static struct class *bcm2835_gpiomem_class; -+static struct device *bcm2835_gpiomem_dev; -+static struct bcm2835_gpiomem_instance *inst; -+ -+ -+/**************************************************************************** -+* -+* GPIO mem chardev file ops -+* -+***************************************************************************/ -+ -+static int bcm2835_gpiomem_open(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ int ret = 0; -+ -+ dev_info(inst->dev, "gpiomem device opened."); -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, "Unknown minor device: %d", dev); -+ ret = -ENXIO; -+ } -+ return ret; -+} -+ -+static int bcm2835_gpiomem_release(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ int ret = 0; -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, "Unknown minor device %d", dev); -+ ret = -ENXIO; -+ } -+ return ret; -+} -+ -+static const struct vm_operations_struct bcm2835_gpiomem_vm_ops = { -+#ifdef CONFIG_HAVE_IOREMAP_PROT -+ .access = generic_access_phys -+#endif -+}; -+ -+static int bcm2835_gpiomem_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ /* Ignore what the user says - they're getting the GPIO regs -+ whether they like it or not! */ -+ unsigned long gpio_page = inst->gpio_regs_phys >> PAGE_SHIFT; -+ -+ vma->vm_page_prot = phys_mem_access_prot(file, gpio_page, -+ PAGE_SIZE, -+ vma->vm_page_prot); -+ vma->vm_ops = &bcm2835_gpiomem_vm_ops; -+ if (remap_pfn_range(vma, vma->vm_start, -+ gpio_page, -+ PAGE_SIZE, -+ vma->vm_page_prot)) { -+ return -EAGAIN; -+ } -+ return 0; -+} -+ -+static const struct file_operations -+bcm2835_gpiomem_fops = { -+ .owner = THIS_MODULE, -+ .open = bcm2835_gpiomem_open, -+ .release = bcm2835_gpiomem_release, -+ .mmap = bcm2835_gpiomem_mmap, -+}; -+ -+ -+ /**************************************************************************** -+* -+* Probe and remove functions -+* -+***************************************************************************/ -+ -+ -+static int bcm2835_gpiomem_probe(struct platform_device *pdev) -+{ -+ int err; -+ void *ptr_err; -+ struct device *dev = &pdev->dev; -+ struct resource *ioresource; -+ -+ /* Allocate buffers and instance data */ -+ -+ inst = kzalloc(sizeof(struct bcm2835_gpiomem_instance), GFP_KERNEL); -+ -+ if (!inst) { -+ err = -ENOMEM; -+ goto failed_inst_alloc; -+ } -+ -+ inst->dev = dev; -+ -+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (ioresource) { -+ inst->gpio_regs_phys = ioresource->start; -+ } else { -+ dev_err(inst->dev, "failed to get IO resource"); -+ err = -ENOENT; -+ goto failed_get_resource; -+ } -+ -+ /* Create character device entries */ -+ -+ err = alloc_chrdev_region(&bcm2835_gpiomem_devid, -+ DEVICE_MINOR, 1, DEVICE_NAME); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to allocate device number"); -+ goto failed_alloc_chrdev; -+ } -+ cdev_init(&bcm2835_gpiomem_cdev, &bcm2835_gpiomem_fops); -+ bcm2835_gpiomem_cdev.owner = THIS_MODULE; -+ err = cdev_add(&bcm2835_gpiomem_cdev, bcm2835_gpiomem_devid, 1); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to register device"); -+ goto failed_cdev_add; -+ } -+ -+ /* Create sysfs entries */ -+ -+ bcm2835_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME); -+ ptr_err = bcm2835_gpiomem_class; -+ if (IS_ERR(ptr_err)) -+ goto failed_class_create; -+ -+ bcm2835_gpiomem_dev = device_create(bcm2835_gpiomem_class, NULL, -+ bcm2835_gpiomem_devid, NULL, -+ "gpiomem"); -+ ptr_err = bcm2835_gpiomem_dev; -+ if (IS_ERR(ptr_err)) -+ goto failed_device_create; -+ -+ dev_info(inst->dev, "Initialised: Registers at 0x%08lx", -+ inst->gpio_regs_phys); -+ -+ return 0; -+ -+failed_device_create: -+ class_destroy(bcm2835_gpiomem_class); -+failed_class_create: -+ cdev_del(&bcm2835_gpiomem_cdev); -+ err = PTR_ERR(ptr_err); -+failed_cdev_add: -+ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); -+failed_alloc_chrdev: -+failed_get_resource: -+ kfree(inst); -+failed_inst_alloc: -+ dev_err(inst->dev, "could not load bcm2835_gpiomem"); -+ return err; -+} -+ -+static int bcm2835_gpiomem_remove(struct platform_device *pdev) -+{ -+ struct device *dev = inst->dev; -+ -+ kfree(inst); -+ device_destroy(bcm2835_gpiomem_class, bcm2835_gpiomem_devid); -+ class_destroy(bcm2835_gpiomem_class); -+ cdev_del(&bcm2835_gpiomem_cdev); -+ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); -+ -+ dev_info(dev, "GPIO mem driver removed - OK"); -+ return 0; -+} -+ -+ /**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_gpiomem_of_match[] = { -+ {.compatible = "brcm,bcm2835-gpiomem",}, -+ { /* sentinel */ }, -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_gpiomem_of_match); -+ -+static struct platform_driver bcm2835_gpiomem_driver = { -+ .probe = bcm2835_gpiomem_probe, -+ .remove = bcm2835_gpiomem_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_gpiomem_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_gpiomem_driver); -+ -+MODULE_ALIAS("platform:gpiomem-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); -+MODULE_AUTHOR("Luke Wren "); - -From fbaa743648d031cbb8afeb81e37f546b4fd7b6b5 Mon Sep 17 00:00:00 2001 -From: Luke Wren -Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 042/122] Add SMI driver - -Signed-off-by: Luke Wren ---- - .../bindings/misc/brcm,bcm2835-smi-dev.txt | 17 + - .../devicetree/bindings/misc/brcm,bcm2835-smi.txt | 48 + - drivers/char/broadcom/Kconfig | 8 + - drivers/char/broadcom/Makefile | 2 +- - drivers/char/broadcom/bcm2835_smi_dev.c | 402 +++++++++ - drivers/misc/Kconfig | 8 + - drivers/misc/Makefile | 1 + - drivers/misc/bcm2835_smi.c | 985 +++++++++++++++++++++ - include/linux/broadcom/bcm2835_smi.h | 391 ++++++++ - 9 files changed, 1861 insertions(+), 1 deletion(-) - create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt - create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt - create mode 100644 drivers/char/broadcom/bcm2835_smi_dev.c - create mode 100644 drivers/misc/bcm2835_smi.c - create mode 100644 include/linux/broadcom/bcm2835_smi.h - -diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..68cc8ebc3392d45cbccac0dc0354514076d43398 ---- /dev/null -+++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt -@@ -0,0 +1,17 @@ -+* Broadcom BCM2835 SMI character device driver. -+ -+SMI or secondary memory interface is a peripheral specific to certain Broadcom -+SOCs, and is helpful for talking to things like parallel-interface displays -+and NAND flashes (in fact, most things with a parallel register interface). -+ -+This driver adds a character device which provides a user-space interface to -+an instance of the SMI driver. -+ -+Required properties: -+- compatible: "brcm,bcm2835-smi-dev" -+- smi_handle: a phandle to the smi node. -+ -+Optional properties: -+- None. -+ -+ -diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..b76dc694f1ac0b8044000ae54d312c803b1ef6f7 ---- /dev/null -+++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt -@@ -0,0 +1,48 @@ -+* Broadcom BCM2835 SMI driver. -+ -+SMI or secondary memory interface is a peripheral specific to certain Broadcom -+SOCs, and is helpful for talking to things like parallel-interface displays -+and NAND flashes (in fact, most things with a parallel register interface). -+ -+Required properties: -+- compatible: "brcm,bcm2835-smi" -+- reg: Should contain location and length of SMI registers and SMI clkman regs -+- interrupts: *the* SMI interrupt. -+- pinctrl-names: should be "default". -+- pinctrl-0: the phandle of the gpio pin node. -+- brcm,smi-clock-source: the clock source for clkman -+- brcm,smi-clock-divisor: the integer clock divisor for clkman -+- dmas: the dma controller phandle and the DREQ number (4 on a 2835) -+- dma-names: the name used by the driver to request its channel. -+ Should be "rx-tx". -+ -+Optional properties: -+- None. -+ -+Examples: -+ -+8 data pin configuration: -+ -+smi: smi@7e600000 { -+ compatible = "brcm,bcm2835-smi"; -+ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; -+ interrupts = <2 16>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; -+ brcm,smi-clock-source = <6>; -+ brcm,smi-clock-divisor = <4>; -+ dmas = <&dma 4>; -+ dma-names = "rx-tx"; -+ -+ status = "okay"; -+}; -+ -+smi_pins: smi_pins { -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15>; -+ /* Alt 1: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0>; -+}; -+ -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index b75c9b2639fb0e63dd2623ddc1dcaac5759c132b..f7885466f5bf9c0cf45f2057d07a0d24151f10c3 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -41,3 +41,11 @@ config BCM2835_DEVGPIOMEM - on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO - register page to the user's pointer. - -+config BCM2835_SMI_DEV -+ tristate "Character device driver for BCM2835 Secondary Memory Interface" -+ depends on BCM2835_SMI -+ default m -+ help -+ This driver provides a character device interface (ioctl + read/write) to -+ Broadcom's Secondary Memory interface. The low-level functionality is provided -+ by the SMI driver itself. -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index 1eb06e9788663c3e75d201a559db55556cecfe2b..667d33ef38f3512b52818537c11d369798b6f1c0 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -3,4 +3,4 @@ obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o - obj-$(CONFIG_BCM_VC_SM) += vc_sm/ - - obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o -- -+obj-$(CONFIG_BCM2835_SMI_DEV) += bcm2835_smi_dev.o -diff --git a/drivers/char/broadcom/bcm2835_smi_dev.c b/drivers/char/broadcom/bcm2835_smi_dev.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d6efd92fdfe46df5cfe219d2123e0dff23dc5ab7 ---- /dev/null -+++ b/drivers/char/broadcom/bcm2835_smi_dev.c -@@ -0,0 +1,402 @@ -+/** -+ * Character device driver for Broadcom Secondary Memory Interface -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define DEVICE_NAME "bcm2835-smi-dev" -+#define DRIVER_NAME "smi-dev-bcm2835" -+#define DEVICE_MINOR 0 -+ -+static struct cdev bcm2835_smi_cdev; -+static dev_t bcm2835_smi_devid; -+static struct class *bcm2835_smi_class; -+static struct device *bcm2835_smi_dev; -+ -+struct bcm2835_smi_dev_instance { -+ struct device *dev; -+}; -+ -+static struct bcm2835_smi_instance *smi_inst; -+static struct bcm2835_smi_dev_instance *inst; -+ -+static const char *const ioctl_names[] = { -+ "READ_SETTINGS", -+ "WRITE_SETTINGS", -+ "ADDRESS" -+}; -+ -+/**************************************************************************** -+* -+* SMI chardev file ops -+* -+***************************************************************************/ -+static long -+bcm2835_smi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ long ret = 0; -+ -+ dev_info(inst->dev, "serving ioctl..."); -+ -+ switch (cmd) { -+ case BCM2835_SMI_IOC_GET_SETTINGS:{ -+ struct smi_settings *settings; -+ -+ dev_info(inst->dev, "Reading SMI settings to user."); -+ settings = bcm2835_smi_get_settings_from_regs(smi_inst); -+ if (copy_to_user((void *)arg, settings, -+ sizeof(struct smi_settings))) -+ dev_err(inst->dev, "settings copy failed."); -+ break; -+ } -+ case BCM2835_SMI_IOC_WRITE_SETTINGS:{ -+ struct smi_settings *settings; -+ -+ dev_info(inst->dev, "Setting user's SMI settings."); -+ settings = bcm2835_smi_get_settings_from_regs(smi_inst); -+ if (copy_from_user(settings, (void *)arg, -+ sizeof(struct smi_settings))) -+ dev_err(inst->dev, "settings copy failed."); -+ else -+ bcm2835_smi_set_regs_from_settings(smi_inst); -+ break; -+ } -+ case BCM2835_SMI_IOC_ADDRESS: -+ dev_info(inst->dev, "SMI address set: 0x%02x", (int)arg); -+ bcm2835_smi_set_address(smi_inst, arg); -+ break; -+ default: -+ dev_err(inst->dev, "invalid ioctl cmd: %d", cmd); -+ ret = -ENOTTY; -+ break; -+ } -+ -+ return ret; -+} -+ -+static int bcm2835_smi_open(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ -+ dev_dbg(inst->dev, "SMI device opened."); -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, -+ "bcm2835_smi_release: Unknown minor device: %d", -+ dev); -+ return -ENXIO; -+ } -+ -+ return 0; -+} -+ -+static int bcm2835_smi_release(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, -+ "bcm2835_smi_release: Unknown minor device %d", dev); -+ return -ENXIO; -+ } -+ -+ return 0; -+} -+ -+static ssize_t dma_bounce_user( -+ enum dma_transfer_direction dma_dir, -+ char __user *user_ptr, -+ size_t count, -+ struct bcm2835_smi_bounce_info *bounce) -+{ -+ int chunk_size; -+ int chunk_no = 0; -+ int count_left = count; -+ -+ while (count_left) { -+ int rv; -+ void *buf; -+ -+ /* Wait for current chunk to complete: */ -+ if (down_timeout(&bounce->callback_sem, -+ msecs_to_jiffies(1000))) { -+ dev_err(inst->dev, "DMA bounce timed out"); -+ count -= (count_left); -+ break; -+ } -+ -+ if (bounce->callback_sem.count >= DMA_BOUNCE_BUFFER_COUNT - 1) -+ dev_err(inst->dev, "WARNING: Ring buffer overflow"); -+ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? -+ DMA_BOUNCE_BUFFER_SIZE : count_left; -+ buf = bounce->buffer[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; -+ if (dma_dir == DMA_DEV_TO_MEM) -+ rv = copy_to_user(user_ptr, buf, chunk_size); -+ else -+ rv = copy_from_user(buf, user_ptr, chunk_size); -+ if (rv) -+ dev_err(inst->dev, "copy_*_user() failed!: %d", rv); -+ user_ptr += chunk_size; -+ count_left -= chunk_size; -+ chunk_no++; -+ } -+ return count; -+} -+ -+static ssize_t -+bcm2835_read_file(struct file *f, char __user *user_ptr, -+ size_t count, loff_t *offs) -+{ -+ int odd_bytes; -+ -+ dev_dbg(inst->dev, "User reading %d bytes from SMI.", count); -+ /* We don't want to DMA a number of bytes % 4 != 0 (32 bit FIFO) */ -+ if (count > DMA_THRESHOLD_BYTES) -+ odd_bytes = count & 0x3; -+ else -+ odd_bytes = count; -+ count -= odd_bytes; -+ if (count) { -+ struct bcm2835_smi_bounce_info *bounce; -+ -+ count = bcm2835_smi_user_dma(smi_inst, -+ DMA_DEV_TO_MEM, user_ptr, count, -+ &bounce); -+ if (count) -+ count = dma_bounce_user(DMA_DEV_TO_MEM, user_ptr, -+ count, bounce); -+ } -+ if (odd_bytes) { -+ /* Read from FIFO directly if not using DMA */ -+ uint8_t buf[DMA_THRESHOLD_BYTES]; -+ -+ bcm2835_smi_read_buf(smi_inst, buf, odd_bytes); -+ if (copy_to_user(user_ptr, buf, odd_bytes)) -+ dev_err(inst->dev, "copy_to_user() failed."); -+ count += odd_bytes; -+ -+ } -+ return count; -+} -+ -+static ssize_t -+bcm2835_write_file(struct file *f, const char __user *user_ptr, -+ size_t count, loff_t *offs) -+{ -+ int odd_bytes; -+ -+ dev_dbg(inst->dev, "User writing %d bytes to SMI.", count); -+ if (count > DMA_THRESHOLD_BYTES) -+ odd_bytes = count & 0x3; -+ else -+ odd_bytes = count; -+ count -= odd_bytes; -+ if (count) { -+ struct bcm2835_smi_bounce_info *bounce; -+ -+ count = bcm2835_smi_user_dma(smi_inst, -+ DMA_MEM_TO_DEV, (char __user *)user_ptr, count, -+ &bounce); -+ if (count) -+ count = dma_bounce_user(DMA_MEM_TO_DEV, -+ (char __user *)user_ptr, -+ count, bounce); -+ } -+ if (odd_bytes) { -+ uint8_t buf[DMA_THRESHOLD_BYTES]; -+ -+ if (copy_from_user(buf, user_ptr, odd_bytes)) -+ dev_err(inst->dev, "copy_from_user() failed."); -+ else -+ bcm2835_smi_write_buf(smi_inst, buf, odd_bytes); -+ count += odd_bytes; -+ } -+ return count; -+} -+ -+static const struct file_operations -+bcm2835_smi_fops = { -+ .owner = THIS_MODULE, -+ .unlocked_ioctl = bcm2835_smi_ioctl, -+ .open = bcm2835_smi_open, -+ .release = bcm2835_smi_release, -+ .read = bcm2835_read_file, -+ .write = bcm2835_write_file, -+}; -+ -+ -+/**************************************************************************** -+* -+* bcm2835_smi_probe - called when the driver is loaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_dev_probe(struct platform_device *pdev) -+{ -+ int err; -+ void *ptr_err; -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node, *smi_node; -+ -+ if (!node) { -+ dev_err(dev, "No device tree node supplied!"); -+ return -EINVAL; -+ } -+ -+ smi_node = of_parse_phandle(node, "smi_handle", 0); -+ -+ if (!smi_node) { -+ dev_err(dev, "No such property: smi_handle"); -+ return -ENXIO; -+ } -+ -+ smi_inst = bcm2835_smi_get(smi_node); -+ -+ if (!smi_inst) -+ return -EPROBE_DEFER; -+ -+ /* Allocate buffers and instance data */ -+ -+ inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); -+ -+ if (!inst) -+ return -ENOMEM; -+ -+ inst->dev = dev; -+ -+ /* Create character device entries */ -+ -+ err = alloc_chrdev_region(&bcm2835_smi_devid, -+ DEVICE_MINOR, 1, DEVICE_NAME); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to allocate device number"); -+ return -ENOMEM; -+ } -+ cdev_init(&bcm2835_smi_cdev, &bcm2835_smi_fops); -+ bcm2835_smi_cdev.owner = THIS_MODULE; -+ err = cdev_add(&bcm2835_smi_cdev, bcm2835_smi_devid, 1); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to register device"); -+ err = -ENOMEM; -+ goto failed_cdev_add; -+ } -+ -+ /* Create sysfs entries */ -+ -+ bcm2835_smi_class = class_create(THIS_MODULE, DEVICE_NAME); -+ ptr_err = bcm2835_smi_class; -+ if (IS_ERR(ptr_err)) -+ goto failed_class_create; -+ -+ bcm2835_smi_dev = device_create(bcm2835_smi_class, NULL, -+ bcm2835_smi_devid, NULL, -+ "smi"); -+ ptr_err = bcm2835_smi_dev; -+ if (IS_ERR(ptr_err)) -+ goto failed_device_create; -+ -+ dev_info(inst->dev, "initialised"); -+ -+ return 0; -+ -+failed_device_create: -+ class_destroy(bcm2835_smi_class); -+failed_class_create: -+ cdev_del(&bcm2835_smi_cdev); -+ err = PTR_ERR(ptr_err); -+failed_cdev_add: -+ unregister_chrdev_region(bcm2835_smi_devid, 1); -+ dev_err(dev, "could not load bcm2835_smi_dev"); -+ return err; -+} -+ -+/**************************************************************************** -+* -+* bcm2835_smi_remove - called when the driver is unloaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_dev_remove(struct platform_device *pdev) -+{ -+ device_destroy(bcm2835_smi_class, bcm2835_smi_devid); -+ class_destroy(bcm2835_smi_class); -+ cdev_del(&bcm2835_smi_cdev); -+ unregister_chrdev_region(bcm2835_smi_devid, 1); -+ -+ dev_info(inst->dev, "SMI character dev removed - OK"); -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_smi_dev_of_match[] = { -+ {.compatible = "brcm,bcm2835-smi-dev",}, -+ { /* sentinel */ }, -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_smi_dev_of_match); -+ -+static struct platform_driver bcm2835_smi_dev_driver = { -+ .probe = bcm2835_smi_dev_probe, -+ .remove = bcm2835_smi_dev_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_smi_dev_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_smi_dev_driver); -+ -+MODULE_ALIAS("platform:smi-dev-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION( -+ "Character device driver for BCM2835's secondary memory interface"); -+MODULE_AUTHOR("Luke Wren "); -diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 64971baf11faebaff879c58067d23fd9bf29895a..779f7d61a1779decd4dcbba3bc0e6b330e47f335 100644 ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -10,6 +10,14 @@ config SENSORS_LIS3LV02D - select INPUT_POLLDEV - default n - -+config BCM2835_SMI -+ tristate "Broadcom 283x Secondary Memory Interface driver" -+ depends on ARCH_BCM2835 -+ default m -+ help -+ Driver for enabling and using Broadcom's Secondary/Slow Memory Interface. -+ Appears as /dev/bcm2835_smi. For ioctl interface see drivers/misc/bcm2835_smi.h -+ - config AD525X_DPOT - tristate "Analog Devices Digital Potentiometers" - depends on (I2C || SPI) && SYSFS -diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index 31983366090a781441a3235cac5883d6fbb27fa4..6c400f0fb92f5af49e04911b7f103ce1a60af093 100644 ---- a/drivers/misc/Makefile -+++ b/drivers/misc/Makefile -@@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o - obj-$(CONFIG_INTEL_MID_PTI) += pti.o - obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o - obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o -+obj-$(CONFIG_BCM2835_SMI) += bcm2835_smi.o - obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o - obj-$(CONFIG_ICS932S401) += ics932s401.o - obj-$(CONFIG_LKDTM) += lkdtm.o -diff --git a/drivers/misc/bcm2835_smi.c b/drivers/misc/bcm2835_smi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..63a4ea08b9930a3a31a985f0a1d969b488ed49ec ---- /dev/null -+++ b/drivers/misc/bcm2835_smi.c -@@ -0,0 +1,985 @@ -+/** -+ * Broadcom Secondary Memory Interface driver -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BCM2835_SMI_IMPLEMENTATION -+#include -+ -+#define DRIVER_NAME "smi-bcm2835" -+ -+#define N_PAGES_FROM_BYTES(n) ((n + PAGE_SIZE-1) / PAGE_SIZE) -+ -+#define DMA_WRITE_TO_MEM true -+#define DMA_READ_FROM_MEM false -+ -+struct bcm2835_smi_instance { -+ struct device *dev; -+ struct smi_settings settings; -+ __iomem void *smi_regs_ptr, *cm_smi_regs_ptr; -+ dma_addr_t smi_regs_busaddr; -+ -+ struct dma_chan *dma_chan; -+ struct dma_slave_config dma_config; -+ -+ struct bcm2835_smi_bounce_info bounce; -+ -+ struct scatterlist buffer_sgl; -+ -+ int clock_source; -+ int clock_divisor; -+ -+ /* Sometimes we are called into in an atomic context (e.g. by -+ JFFS2 + MTD) so we can't use a mutex */ -+ spinlock_t transaction_lock; -+}; -+ -+/**************************************************************************** -+* -+* SMI clock manager setup -+* -+***************************************************************************/ -+ -+static inline void write_smi_cm_reg(struct bcm2835_smi_instance *inst, -+ u32 val, unsigned reg) -+{ -+ writel(CM_PWD | val, inst->cm_smi_regs_ptr + reg); -+} -+ -+static inline u32 read_smi_cm_reg(struct bcm2835_smi_instance *inst, -+ unsigned reg) -+{ -+ return readl(inst->cm_smi_regs_ptr + reg); -+} -+ -+static void smi_setup_clock(struct bcm2835_smi_instance *inst) -+{ -+ dev_dbg(inst->dev, "Setting up clock..."); -+ /* Disable SMI clock and wait for it to stop. */ -+ write_smi_cm_reg(inst, 0, CM_SMI_CTL); -+ while (read_smi_cm_reg(inst, CM_SMI_CTL) & CM_SMI_CTL_BUSY) -+ ; -+ -+ write_smi_cm_reg(inst, (inst->clock_divisor << CM_SMI_DIV_DIVI_OFFS), -+ CM_SMI_DIV); -+ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS), -+ CM_SMI_CTL); -+ -+ /* Enable the clock */ -+ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS) | -+ CM_SMI_CTL_ENAB, CM_SMI_CTL); -+} -+ -+/**************************************************************************** -+* -+* SMI peripheral setup -+* -+***************************************************************************/ -+ -+static inline void write_smi_reg(struct bcm2835_smi_instance *inst, -+ u32 val, unsigned reg) -+{ -+ writel(val, inst->smi_regs_ptr + reg); -+} -+ -+static inline u32 read_smi_reg(struct bcm2835_smi_instance *inst, unsigned reg) -+{ -+ return readl(inst->smi_regs_ptr + reg); -+} -+ -+/* Token-paste macro for e.g SMIDSR_RSTROBE -> value of SMIDSR_RSTROBE_MASK */ -+#define _CONCAT(x, y) x##y -+#define CONCAT(x, y) _CONCAT(x, y) -+ -+#define SET_BIT_FIELD(dest, field, bits) ((dest) = \ -+ ((dest) & ~CONCAT(field, _MASK)) | (((bits) << CONCAT(field, _OFFS))& \ -+ CONCAT(field, _MASK))) -+#define GET_BIT_FIELD(src, field) (((src) & \ -+ CONCAT(field, _MASK)) >> CONCAT(field, _OFFS)) -+ -+static void smi_dump_context_labelled(struct bcm2835_smi_instance *inst, -+ const char *label) -+{ -+ dev_err(inst->dev, "SMI context dump: %s", label); -+ dev_err(inst->dev, "SMICS: 0x%08x", read_smi_reg(inst, SMICS)); -+ dev_err(inst->dev, "SMIL: 0x%08x", read_smi_reg(inst, SMIL)); -+ dev_err(inst->dev, "SMIDSR: 0x%08x", read_smi_reg(inst, SMIDSR0)); -+ dev_err(inst->dev, "SMIDSW: 0x%08x", read_smi_reg(inst, SMIDSW0)); -+ dev_err(inst->dev, "SMIDC: 0x%08x", read_smi_reg(inst, SMIDC)); -+ dev_err(inst->dev, "SMIFD: 0x%08x", read_smi_reg(inst, SMIFD)); -+ dev_err(inst->dev, " "); -+} -+ -+static inline void smi_dump_context(struct bcm2835_smi_instance *inst) -+{ -+ smi_dump_context_labelled(inst, ""); -+} -+ -+static void smi_get_default_settings(struct bcm2835_smi_instance *inst) -+{ -+ struct smi_settings *settings = &inst->settings; -+ -+ settings->data_width = SMI_WIDTH_16BIT; -+ settings->pack_data = true; -+ -+ settings->read_setup_time = 1; -+ settings->read_hold_time = 1; -+ settings->read_pace_time = 1; -+ settings->read_strobe_time = 3; -+ -+ settings->write_setup_time = settings->read_setup_time; -+ settings->write_hold_time = settings->read_hold_time; -+ settings->write_pace_time = settings->read_pace_time; -+ settings->write_strobe_time = settings->read_strobe_time; -+ -+ settings->dma_enable = true; -+ settings->dma_passthrough_enable = false; -+ settings->dma_read_thresh = 0x01; -+ settings->dma_write_thresh = 0x3f; -+ settings->dma_panic_read_thresh = 0x20; -+ settings->dma_panic_write_thresh = 0x20; -+} -+ -+void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *inst) -+{ -+ struct smi_settings *settings = &inst->settings; -+ int smidsr_temp = 0, smidsw_temp = 0, smics_temp, -+ smidcs_temp, smidc_temp = 0; -+ -+ spin_lock(&inst->transaction_lock); -+ -+ /* temporarily disable the peripheral: */ -+ smics_temp = read_smi_reg(inst, SMICS); -+ write_smi_reg(inst, 0, SMICS); -+ smidcs_temp = read_smi_reg(inst, SMIDCS); -+ write_smi_reg(inst, 0, SMIDCS); -+ -+ if (settings->pack_data) -+ smics_temp |= SMICS_PXLDAT; -+ else -+ smics_temp &= ~SMICS_PXLDAT; -+ -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RWIDTH, settings->data_width); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSETUP, settings->read_setup_time); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RHOLD, settings->read_hold_time); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RPACE, settings->read_pace_time); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSTROBE, settings->read_strobe_time); -+ write_smi_reg(inst, smidsr_temp, SMIDSR0); -+ -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WWIDTH, settings->data_width); -+ if (settings->data_width == SMI_WIDTH_8BIT) -+ smidsw_temp |= SMIDSW_WSWAP; -+ else -+ smidsw_temp &= ~SMIDSW_WSWAP; -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSETUP, settings->write_setup_time); -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WHOLD, settings->write_hold_time); -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WPACE, settings->write_pace_time); -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSTROBE, -+ settings->write_strobe_time); -+ write_smi_reg(inst, smidsw_temp, SMIDSW0); -+ -+ SET_BIT_FIELD(smidc_temp, SMIDC_REQR, settings->dma_read_thresh); -+ SET_BIT_FIELD(smidc_temp, SMIDC_REQW, settings->dma_write_thresh); -+ SET_BIT_FIELD(smidc_temp, SMIDC_PANICR, -+ settings->dma_panic_read_thresh); -+ SET_BIT_FIELD(smidc_temp, SMIDC_PANICW, -+ settings->dma_panic_write_thresh); -+ if (settings->dma_passthrough_enable) { -+ smidc_temp |= SMIDC_DMAP; -+ smidsr_temp |= SMIDSR_RDREQ; -+ write_smi_reg(inst, smidsr_temp, SMIDSR0); -+ smidsw_temp |= SMIDSW_WDREQ; -+ write_smi_reg(inst, smidsw_temp, SMIDSW0); -+ } else -+ smidc_temp &= ~SMIDC_DMAP; -+ if (settings->dma_enable) -+ smidc_temp |= SMIDC_DMAEN; -+ else -+ smidc_temp &= ~SMIDC_DMAEN; -+ -+ write_smi_reg(inst, smidc_temp, SMIDC); -+ -+ /* re-enable (if was previously enabled) */ -+ write_smi_reg(inst, smics_temp, SMICS); -+ write_smi_reg(inst, smidcs_temp, SMIDCS); -+ -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_set_regs_from_settings); -+ -+struct smi_settings *bcm2835_smi_get_settings_from_regs -+ (struct bcm2835_smi_instance *inst) -+{ -+ struct smi_settings *settings = &inst->settings; -+ int smidsr, smidsw, smidc; -+ -+ spin_lock(&inst->transaction_lock); -+ -+ smidsr = read_smi_reg(inst, SMIDSR0); -+ smidsw = read_smi_reg(inst, SMIDSW0); -+ smidc = read_smi_reg(inst, SMIDC); -+ -+ settings->pack_data = (read_smi_reg(inst, SMICS) & SMICS_PXLDAT) ? -+ true : false; -+ -+ settings->data_width = GET_BIT_FIELD(smidsr, SMIDSR_RWIDTH); -+ settings->read_setup_time = GET_BIT_FIELD(smidsr, SMIDSR_RSETUP); -+ settings->read_hold_time = GET_BIT_FIELD(smidsr, SMIDSR_RHOLD); -+ settings->read_pace_time = GET_BIT_FIELD(smidsr, SMIDSR_RPACE); -+ settings->read_strobe_time = GET_BIT_FIELD(smidsr, SMIDSR_RSTROBE); -+ -+ settings->write_setup_time = GET_BIT_FIELD(smidsw, SMIDSW_WSETUP); -+ settings->write_hold_time = GET_BIT_FIELD(smidsw, SMIDSW_WHOLD); -+ settings->write_pace_time = GET_BIT_FIELD(smidsw, SMIDSW_WPACE); -+ settings->write_strobe_time = GET_BIT_FIELD(smidsw, SMIDSW_WSTROBE); -+ -+ settings->dma_read_thresh = GET_BIT_FIELD(smidc, SMIDC_REQR); -+ settings->dma_write_thresh = GET_BIT_FIELD(smidc, SMIDC_REQW); -+ settings->dma_panic_read_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICR); -+ settings->dma_panic_write_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICW); -+ settings->dma_passthrough_enable = (smidc & SMIDC_DMAP) ? true : false; -+ settings->dma_enable = (smidc & SMIDC_DMAEN) ? true : false; -+ -+ spin_unlock(&inst->transaction_lock); -+ -+ return settings; -+} -+EXPORT_SYMBOL(bcm2835_smi_get_settings_from_regs); -+ -+static inline void smi_set_address(struct bcm2835_smi_instance *inst, -+ unsigned int address) -+{ -+ int smia_temp = 0, smida_temp = 0; -+ -+ SET_BIT_FIELD(smia_temp, SMIA_ADDR, address); -+ SET_BIT_FIELD(smida_temp, SMIDA_ADDR, address); -+ -+ /* Write to both address registers - user doesn't care whether we're -+ doing programmed or direct transfers. */ -+ write_smi_reg(inst, smia_temp, SMIA); -+ write_smi_reg(inst, smida_temp, SMIDA); -+} -+ -+static void smi_setup_regs(struct bcm2835_smi_instance *inst) -+{ -+ -+ dev_dbg(inst->dev, "Initialising SMI registers..."); -+ /* Disable the peripheral if already enabled */ -+ write_smi_reg(inst, 0, SMICS); -+ write_smi_reg(inst, 0, SMIDCS); -+ -+ smi_get_default_settings(inst); -+ bcm2835_smi_set_regs_from_settings(inst); -+ smi_set_address(inst, 0); -+ -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ENABLE, SMICS); -+ write_smi_reg(inst, read_smi_reg(inst, SMIDCS) | SMIDCS_ENABLE, -+ SMIDCS); -+} -+ -+/**************************************************************************** -+* -+* Low-level SMI access functions -+* Other modules should use the exported higher-level functions e.g. -+* bcm2835_smi_write_buf() unless they have a good reason to use these -+* -+***************************************************************************/ -+ -+static inline uint32_t smi_read_single_word(struct bcm2835_smi_instance *inst) -+{ -+ int timeout = 0; -+ -+ write_smi_reg(inst, SMIDCS_ENABLE, SMIDCS); -+ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_START, SMIDCS); -+ /* Make sure things happen in the right order...*/ -+ mb(); -+ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && -+ ++timeout < 10000) -+ ; -+ if (timeout < 10000) -+ return read_smi_reg(inst, SMIDD); -+ -+ dev_err(inst->dev, -+ "SMI direct read timed out (is the clock set up correctly?)"); -+ return 0; -+} -+ -+static inline void smi_write_single_word(struct bcm2835_smi_instance *inst, -+ uint32_t data) -+{ -+ int timeout = 0; -+ -+ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE, SMIDCS); -+ write_smi_reg(inst, data, SMIDD); -+ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE | SMIDCS_START, -+ SMIDCS); -+ -+ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && -+ ++timeout < 10000) -+ ; -+ if (timeout >= 10000) -+ dev_err(inst->dev, -+ "SMI direct write timed out (is the clock set up correctly?)"); -+} -+ -+/* Initiates a programmed read into the read FIFO. It is up to the caller to -+ * read data from the FIFO - either via paced DMA transfer, -+ * or polling SMICS_RXD to check whether data is available. -+ * SMICS_ACTIVE will go low upon completion. */ -+static void smi_init_programmed_read(struct bcm2835_smi_instance *inst, -+ int num_transfers) -+{ -+ int smics_temp; -+ -+ /* Disable the peripheral: */ -+ smics_temp = read_smi_reg(inst, SMICS) & ~(SMICS_ENABLE | SMICS_WRITE); -+ write_smi_reg(inst, smics_temp, SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) -+ ; -+ -+ /* Program the transfer count: */ -+ write_smi_reg(inst, num_transfers, SMIL); -+ -+ /* re-enable and start: */ -+ smics_temp |= SMICS_ENABLE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ smics_temp |= SMICS_CLEAR; -+ /* Just to be certain: */ -+ mb(); -+ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) -+ ; -+ write_smi_reg(inst, smics_temp, SMICS); -+ smics_temp |= SMICS_START; -+ write_smi_reg(inst, smics_temp, SMICS); -+} -+ -+/* Initiates a programmed write sequence, using data from the write FIFO. -+ * It is up to the caller to initiate a DMA transfer before calling, -+ * or use another method to keep the write FIFO topped up. -+ * SMICS_ACTIVE will go low upon completion. -+ */ -+static void smi_init_programmed_write(struct bcm2835_smi_instance *inst, -+ int num_transfers) -+{ -+ int smics_temp; -+ -+ /* Disable the peripheral: */ -+ smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) -+ ; -+ -+ /* Program the transfer count: */ -+ write_smi_reg(inst, num_transfers, SMIL); -+ -+ /* setup, re-enable and start: */ -+ smics_temp |= SMICS_WRITE | SMICS_ENABLE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ smics_temp |= SMICS_START; -+ write_smi_reg(inst, smics_temp, SMICS); -+} -+ -+/* Initiate a read and then poll FIFO for data, reading out as it appears. */ -+static void smi_read_fifo(struct bcm2835_smi_instance *inst, -+ uint32_t *dest, int n_bytes) -+{ -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { -+ smi_dump_context_labelled(inst, -+ "WARNING: read FIFO not empty at start of read call."); -+ while (read_smi_reg(inst, SMICS)) -+ ; -+ } -+ -+ /* Dispatch the read: */ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_read(inst, n_bytes); -+ else if (inst->settings.data_width == SMI_WIDTH_16BIT) -+ smi_init_programmed_read(inst, n_bytes / 2); -+ else { -+ dev_err(inst->dev, "Unsupported data width for read."); -+ return; -+ } -+ -+ /* Poll FIFO to keep it empty */ -+ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) -+ *dest++ = read_smi_reg(inst, SMID); -+ -+ /* Ensure that the FIFO is emptied */ -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { -+ int fifo_count; -+ -+ fifo_count = GET_BIT_FIELD(read_smi_reg(inst, SMIFD), -+ SMIFD_FCNT); -+ while (fifo_count--) -+ *dest++ = read_smi_reg(inst, SMID); -+ } -+ -+ if (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) -+ smi_dump_context_labelled(inst, -+ "WARNING: transaction finished but done bit not set."); -+ -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) -+ smi_dump_context_labelled(inst, -+ "WARNING: read FIFO not empty at end of read call."); -+ -+} -+ -+/* Initiate a write, and then keep the FIFO topped up. */ -+static void smi_write_fifo(struct bcm2835_smi_instance *inst, -+ uint32_t *src, int n_bytes) -+{ -+ int i, timeout = 0; -+ -+ /* Empty FIFOs if not already so */ -+ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) { -+ smi_dump_context_labelled(inst, -+ "WARNING: write fifo not empty at start of write call."); -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_CLEAR, -+ SMICS); -+ } -+ -+ /* Initiate the transfer */ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_write(inst, n_bytes); -+ else if (inst->settings.data_width == SMI_WIDTH_16BIT) -+ smi_init_programmed_write(inst, n_bytes / 2); -+ else { -+ dev_err(inst->dev, "Unsupported data width for write."); -+ return; -+ } -+ /* Fill the FIFO: */ -+ for (i = 0; i < (n_bytes - 1) / 4 + 1; ++i) { -+ while (!(read_smi_reg(inst, SMICS) & SMICS_TXD)) -+ ; -+ write_smi_reg(inst, *src++, SMID); -+ } -+ /* Busy wait... */ -+ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE) && ++timeout < -+ 1000000) -+ ; -+ if (timeout >= 1000000) -+ smi_dump_context_labelled(inst, -+ "Timed out on write operation!"); -+ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) -+ smi_dump_context_labelled(inst, -+ "WARNING: FIFO not empty at end of write operation."); -+} -+ -+/**************************************************************************** -+* -+* SMI DMA operations -+* -+***************************************************************************/ -+ -+/* Disable SMI and put it into the correct direction before doing DMA setup. -+ Stops spurious DREQs during setup. Peripheral is re-enabled by init_*() */ -+static void smi_disable(struct bcm2835_smi_instance *inst, -+ enum dma_transfer_direction direction) -+{ -+ int smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; -+ -+ if (direction == DMA_DEV_TO_MEM) -+ smics_temp &= ~SMICS_WRITE; -+ else -+ smics_temp |= SMICS_WRITE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) -+ ; -+} -+ -+static struct scatterlist *smi_scatterlist_from_buffer( -+ struct bcm2835_smi_instance *inst, -+ dma_addr_t buf, -+ size_t len, -+ struct scatterlist *sg) -+{ -+ sg_init_table(sg, 1); -+ sg_dma_address(sg) = buf; -+ sg_dma_len(sg) = len; -+ return sg; -+} -+ -+static void smi_dma_callback_user_copy(void *param) -+{ -+ /* Notify the bottom half that a chunk is ready for user copy */ -+ struct bcm2835_smi_instance *inst = -+ (struct bcm2835_smi_instance *)param; -+ -+ up(&inst->bounce.callback_sem); -+} -+ -+/* Creates a descriptor, assigns the given callback, and submits the -+ descriptor to dmaengine. Does not block - can queue up multiple -+ descriptors and then wait for them all to complete. -+ sg_len is the number of control blocks, NOT the number of bytes. -+ dir can be DMA_MEM_TO_DEV or DMA_DEV_TO_MEM. -+ callback can be NULL - in this case it is not called. */ -+static inline struct dma_async_tx_descriptor *smi_dma_submit_sgl( -+ struct bcm2835_smi_instance *inst, -+ struct scatterlist *sgl, -+ size_t sg_len, -+ enum dma_transfer_direction dir, -+ dma_async_tx_callback callback) -+{ -+ struct dma_async_tx_descriptor *desc; -+ -+ desc = dmaengine_prep_slave_sg(inst->dma_chan, -+ sgl, -+ sg_len, -+ dir, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | -+ DMA_PREP_FENCE); -+ if (!desc) { -+ dev_err(inst->dev, "read_sgl: dma slave preparation failed!"); -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) & ~SMICS_ACTIVE, -+ SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) -+ cpu_relax(); -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ACTIVE, -+ SMICS); -+ return NULL; -+ } -+ desc->callback = callback; -+ desc->callback_param = inst; -+ if (dmaengine_submit(desc) < 0) -+ return NULL; -+ return desc; -+} -+ -+/* NB this function blocks until the transfer is complete */ -+static void -+smi_dma_read_sgl(struct bcm2835_smi_instance *inst, -+ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) -+{ -+ struct dma_async_tx_descriptor *desc; -+ -+ /* Disable SMI and set to read before dispatching DMA - if SMI is in -+ * write mode and TX fifo is empty, it will generate a DREQ which may -+ * cause the read DMA to complete before the SMI read command is even -+ * dispatched! We want to dispatch DMA before SMI read so that reading -+ * is gapless, for logic analyser. -+ */ -+ -+ smi_disable(inst, DMA_DEV_TO_MEM); -+ -+ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_DEV_TO_MEM, NULL); -+ dma_async_issue_pending(inst->dma_chan); -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_read(inst, n_bytes); -+ else -+ smi_init_programmed_read(inst, n_bytes / 2); -+ -+ if (dma_wait_for_async_tx(desc) == DMA_ERROR) -+ smi_dump_context_labelled(inst, "DMA timeout!"); -+} -+ -+static void -+smi_dma_write_sgl(struct bcm2835_smi_instance *inst, -+ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) -+{ -+ struct dma_async_tx_descriptor *desc; -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_write(inst, n_bytes); -+ else -+ smi_init_programmed_write(inst, n_bytes / 2); -+ -+ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_MEM_TO_DEV, NULL); -+ dma_async_issue_pending(inst->dma_chan); -+ -+ if (dma_wait_for_async_tx(desc) == DMA_ERROR) -+ smi_dump_context_labelled(inst, "DMA timeout!"); -+ else -+ /* Wait for SMI to finish our writes */ -+ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) -+ cpu_relax(); -+} -+ -+ssize_t bcm2835_smi_user_dma( -+ struct bcm2835_smi_instance *inst, -+ enum dma_transfer_direction dma_dir, -+ char __user *user_ptr, size_t count, -+ struct bcm2835_smi_bounce_info **bounce) -+{ -+ int chunk_no = 0, chunk_size, count_left = count; -+ struct scatterlist *sgl; -+ void (*init_trans_func)(struct bcm2835_smi_instance *, int); -+ -+ spin_lock(&inst->transaction_lock); -+ -+ if (dma_dir == DMA_DEV_TO_MEM) -+ init_trans_func = smi_init_programmed_read; -+ else -+ init_trans_func = smi_init_programmed_write; -+ -+ smi_disable(inst, dma_dir); -+ -+ sema_init(&inst->bounce.callback_sem, 0); -+ if (bounce) -+ *bounce = &inst->bounce; -+ while (count_left) { -+ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? -+ DMA_BOUNCE_BUFFER_SIZE : count_left; -+ if (chunk_size == DMA_BOUNCE_BUFFER_SIZE) { -+ sgl = -+ &inst->bounce.sgl[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; -+ } else { -+ sgl = smi_scatterlist_from_buffer( -+ inst, -+ inst->bounce.phys[ -+ chunk_no % DMA_BOUNCE_BUFFER_COUNT], -+ chunk_size, -+ &inst->buffer_sgl); -+ } -+ -+ if (!smi_dma_submit_sgl(inst, sgl, 1, dma_dir, -+ smi_dma_callback_user_copy -+ )) { -+ dev_err(inst->dev, "sgl submit failed"); -+ count = 0; -+ goto out; -+ } -+ count_left -= chunk_size; -+ chunk_no++; -+ } -+ dma_async_issue_pending(inst->dma_chan); -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ init_trans_func(inst, count); -+ else if (inst->settings.data_width == SMI_WIDTH_16BIT) -+ init_trans_func(inst, count / 2); -+out: -+ spin_unlock(&inst->transaction_lock); -+ return count; -+} -+EXPORT_SYMBOL(bcm2835_smi_user_dma); -+ -+ -+/**************************************************************************** -+* -+* High level buffer transfer functions - for use by other drivers -+* -+***************************************************************************/ -+ -+/* Buffer must be physically contiguous - i.e. kmalloc, not vmalloc! */ -+void bcm2835_smi_write_buf( -+ struct bcm2835_smi_instance *inst, -+ const void *buf, size_t n_bytes) -+{ -+ int odd_bytes = n_bytes & 0x3; -+ -+ n_bytes -= odd_bytes; -+ -+ spin_lock(&inst->transaction_lock); -+ -+ if (n_bytes > DMA_THRESHOLD_BYTES) { -+ dma_addr_t phy_addr = dma_map_single( -+ inst->dev, -+ (void *)buf, -+ n_bytes, -+ DMA_MEM_TO_DEV); -+ struct scatterlist *sgl = -+ smi_scatterlist_from_buffer(inst, phy_addr, n_bytes, -+ &inst->buffer_sgl); -+ -+ if (!sgl) { -+ smi_dump_context_labelled(inst, -+ "Error: could not create scatterlist for write!"); -+ goto out; -+ } -+ smi_dma_write_sgl(inst, sgl, 1, n_bytes); -+ -+ dma_unmap_single -+ (inst->dev, phy_addr, n_bytes, DMA_MEM_TO_DEV); -+ } else if (n_bytes) { -+ smi_write_fifo(inst, (uint32_t *) buf, n_bytes); -+ } -+ buf += n_bytes; -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) { -+ while (odd_bytes--) -+ smi_write_single_word(inst, *(uint8_t *) (buf++)); -+ } else { -+ while (odd_bytes >= 2) { -+ smi_write_single_word(inst, *(uint16_t *)buf); -+ buf += 2; -+ odd_bytes -= 2; -+ } -+ if (odd_bytes) { -+ /* Reading an odd number of bytes on a 16 bit bus is -+ a user bug. It's kinder to fail early and tell them -+ than to e.g. transparently give them the bottom byte -+ of a 16 bit transfer. */ -+ dev_err(inst->dev, -+ "WARNING: odd number of bytes specified for wide transfer."); -+ dev_err(inst->dev, -+ "At least one byte dropped as a result."); -+ dump_stack(); -+ } -+ } -+out: -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_write_buf); -+ -+void bcm2835_smi_read_buf(struct bcm2835_smi_instance *inst, -+ void *buf, size_t n_bytes) -+{ -+ -+ /* SMI is inherently 32-bit, which causes surprising amounts of mess -+ for bytes % 4 != 0. Easiest to avoid this mess altogether -+ by handling remainder separately. */ -+ int odd_bytes = n_bytes & 0x3; -+ -+ spin_lock(&inst->transaction_lock); -+ n_bytes -= odd_bytes; -+ if (n_bytes > DMA_THRESHOLD_BYTES) { -+ dma_addr_t phy_addr = dma_map_single(inst->dev, -+ buf, n_bytes, -+ DMA_DEV_TO_MEM); -+ struct scatterlist *sgl = smi_scatterlist_from_buffer( -+ inst, phy_addr, n_bytes, -+ &inst->buffer_sgl); -+ if (!sgl) { -+ smi_dump_context_labelled(inst, -+ "Error: could not create scatterlist for read!"); -+ goto out; -+ } -+ smi_dma_read_sgl(inst, sgl, 1, n_bytes); -+ dma_unmap_single(inst->dev, phy_addr, n_bytes, DMA_DEV_TO_MEM); -+ } else if (n_bytes) { -+ smi_read_fifo(inst, (uint32_t *)buf, n_bytes); -+ } -+ buf += n_bytes; -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) { -+ while (odd_bytes--) -+ *((uint8_t *) (buf++)) = smi_read_single_word(inst); -+ } else { -+ while (odd_bytes >= 2) { -+ *(uint16_t *) buf = smi_read_single_word(inst); -+ buf += 2; -+ odd_bytes -= 2; -+ } -+ if (odd_bytes) { -+ dev_err(inst->dev, -+ "WARNING: odd number of bytes specified for wide transfer."); -+ dev_err(inst->dev, -+ "At least one byte dropped as a result."); -+ dump_stack(); -+ } -+ } -+out: -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_read_buf); -+ -+void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, -+ unsigned int address) -+{ -+ spin_lock(&inst->transaction_lock); -+ smi_set_address(inst, address); -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_set_address); -+ -+struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node) -+{ -+ struct platform_device *pdev; -+ -+ if (!node) -+ return NULL; -+ -+ pdev = of_find_device_by_node(node); -+ if (!pdev) -+ return NULL; -+ -+ return platform_get_drvdata(pdev); -+} -+EXPORT_SYMBOL(bcm2835_smi_get); -+ -+/**************************************************************************** -+* -+* bcm2835_smi_probe - called when the driver is loaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_dma_setup(struct bcm2835_smi_instance *inst) -+{ -+ int i, rv = 0; -+ -+ inst->dma_chan = dma_request_slave_channel(inst->dev, "rx-tx"); -+ -+ inst->dma_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ inst->dma_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ inst->dma_config.src_addr = inst->smi_regs_busaddr + SMID; -+ inst->dma_config.dst_addr = inst->dma_config.src_addr; -+ /* Direction unimportant - always overridden by prep_slave_sg */ -+ inst->dma_config.direction = DMA_DEV_TO_MEM; -+ dmaengine_slave_config(inst->dma_chan, &inst->dma_config); -+ /* Alloc and map bounce buffers */ -+ for (i = 0; i < DMA_BOUNCE_BUFFER_COUNT; ++i) { -+ inst->bounce.buffer[i] = -+ dmam_alloc_coherent(inst->dev, DMA_BOUNCE_BUFFER_SIZE, -+ &inst->bounce.phys[i], -+ GFP_KERNEL); -+ if (!inst->bounce.buffer[i]) { -+ dev_err(inst->dev, "Could not allocate buffer!"); -+ rv = -ENOMEM; -+ break; -+ } -+ smi_scatterlist_from_buffer( -+ inst, -+ inst->bounce.phys[i], -+ DMA_BOUNCE_BUFFER_SIZE, -+ &inst->bounce.sgl[i] -+ ); -+ } -+ -+ return rv; -+} -+ -+static int bcm2835_smi_probe(struct platform_device *pdev) -+{ -+ int err; -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node; -+ struct resource *ioresource; -+ struct bcm2835_smi_instance *inst; -+ -+ /* Allocate buffers and instance data */ -+ -+ inst = devm_kzalloc(dev, sizeof(struct bcm2835_smi_instance), -+ GFP_KERNEL); -+ -+ if (!inst) -+ return -ENOMEM; -+ -+ inst->dev = dev; -+ spin_lock_init(&inst->transaction_lock); -+ -+ /* We require device tree support */ -+ if (!node) -+ return -EINVAL; -+ -+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ inst->cm_smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -+ inst->smi_regs_busaddr = be32_to_cpu( -+ *of_get_address(node, 0, NULL, NULL)); -+ of_property_read_u32(node, -+ "brcm,smi-clock-source", -+ &inst->clock_source); -+ of_property_read_u32(node, -+ "brcm,smi-clock-divisor", -+ &inst->clock_divisor); -+ -+ err = bcm2835_smi_dma_setup(inst); -+ if (err) -+ return err; -+ -+ /* Finally, do peripheral setup */ -+ -+ smi_setup_clock(inst); -+ smi_setup_regs(inst); -+ -+ platform_set_drvdata(pdev, inst); -+ -+ dev_info(inst->dev, "initialised"); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* bcm2835_smi_remove - called when the driver is unloaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_smi_instance *inst = platform_get_drvdata(pdev); -+ struct device *dev = inst->dev; -+ -+ dev_info(dev, "SMI device removed - OK"); -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_smi_of_match[] = { -+ {.compatible = "brcm,bcm2835-smi",}, -+ { /* sentinel */ }, -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_smi_of_match); -+ -+static struct platform_driver bcm2835_smi_driver = { -+ .probe = bcm2835_smi_probe, -+ .remove = bcm2835_smi_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_smi_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_smi_driver); -+ -+MODULE_ALIAS("platform:smi-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("Device driver for BCM2835's secondary memory interface"); -+MODULE_AUTHOR("Luke Wren "); -diff --git a/include/linux/broadcom/bcm2835_smi.h b/include/linux/broadcom/bcm2835_smi.h -new file mode 100644 -index 0000000000000000000000000000000000000000..ee3a75edfc033eeb0d90a687ffb68b10fd8543a3 ---- /dev/null -+++ b/include/linux/broadcom/bcm2835_smi.h -@@ -0,0 +1,391 @@ -+/** -+ * Declarations and definitions for Broadcom's Secondary Memory Interface -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * Copyright (c) 2010-2012 Broadcom. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#ifndef BCM2835_SMI_H -+#define BCM2835_SMI_H -+ -+#include -+ -+#ifndef __KERNEL__ -+#include -+#include -+#endif -+ -+#define BCM2835_SMI_IOC_MAGIC 0x1 -+#define BCM2835_SMI_INVALID_HANDLE (~0) -+ -+/* IOCTLs 0x100...0x1ff are not device-specific - we can use them */ -+#define BCM2835_SMI_IOC_GET_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 0) -+#define BCM2835_SMI_IOC_WRITE_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 1) -+#define BCM2835_SMI_IOC_ADDRESS _IO(BCM2835_SMI_IOC_MAGIC, 2) -+#define BCM2835_SMI_IOC_MAX 2 -+ -+#define SMI_WIDTH_8BIT 0 -+#define SMI_WIDTH_16BIT 1 -+#define SMI_WIDTH_9BIT 2 -+#define SMI_WIDTH_18BIT 3 -+ -+/* max number of bytes where DMA will not be used */ -+#define DMA_THRESHOLD_BYTES 128 -+#define DMA_BOUNCE_BUFFER_SIZE (1024 * 1024 / 2) -+#define DMA_BOUNCE_BUFFER_COUNT 3 -+ -+ -+struct smi_settings { -+ int data_width; -+ /* Whether or not to pack multiple SMI transfers into a -+ single 32 bit FIFO word */ -+ bool pack_data; -+ -+ /* Timing for reads (writes the same but for WE) -+ * -+ * OE ----------+ +-------------------- -+ * | | -+ * +----------+ -+ * SD -<==============================>----------- -+ * SA -<=========================================>- -+ * <-setup-> <-strobe -> <-hold -> <- pace -> -+ */ -+ -+ int read_setup_time; -+ int read_hold_time; -+ int read_pace_time; -+ int read_strobe_time; -+ -+ int write_setup_time; -+ int write_hold_time; -+ int write_pace_time; -+ int write_strobe_time; -+ -+ bool dma_enable; /* DREQs */ -+ bool dma_passthrough_enable; /* External DREQs */ -+ int dma_read_thresh; -+ int dma_write_thresh; -+ int dma_panic_read_thresh; -+ int dma_panic_write_thresh; -+}; -+ -+/**************************************************************************** -+* -+* Declare exported SMI functions -+* -+***************************************************************************/ -+ -+#ifdef __KERNEL__ -+ -+#include /* for enum dma_transfer_direction */ -+#include -+#include -+ -+struct bcm2835_smi_instance; -+ -+struct bcm2835_smi_bounce_info { -+ struct semaphore callback_sem; -+ void *buffer[DMA_BOUNCE_BUFFER_COUNT]; -+ dma_addr_t phys[DMA_BOUNCE_BUFFER_COUNT]; -+ struct scatterlist sgl[DMA_BOUNCE_BUFFER_COUNT]; -+}; -+ -+ -+void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *); -+ -+struct smi_settings *bcm2835_smi_get_settings_from_regs( -+ struct bcm2835_smi_instance *inst); -+ -+void bcm2835_smi_write_buf( -+ struct bcm2835_smi_instance *inst, -+ const void *buf, -+ size_t n_bytes); -+ -+void bcm2835_smi_read_buf( -+ struct bcm2835_smi_instance *inst, -+ void *buf, -+ size_t n_bytes); -+ -+void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, -+ unsigned int address); -+ -+ssize_t bcm2835_smi_user_dma( -+ struct bcm2835_smi_instance *inst, -+ enum dma_transfer_direction dma_dir, -+ char __user *user_ptr, -+ size_t count, -+ struct bcm2835_smi_bounce_info **bounce); -+ -+struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node); -+ -+#endif /* __KERNEL__ */ -+ -+/**************************************************************** -+* -+* Implementation-only declarations -+* -+****************************************************************/ -+ -+#ifdef BCM2835_SMI_IMPLEMENTATION -+ -+/* Clock manager registers for SMI clock: */ -+#define CM_SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x1010b0) -+/* Clock manager "password" to protect registers from spurious writes */ -+#define CM_PWD (0x5a << 24) -+ -+#define CM_SMI_CTL 0x00 -+#define CM_SMI_DIV 0x04 -+ -+#define CM_SMI_CTL_FLIP (1 << 8) -+#define CM_SMI_CTL_BUSY (1 << 7) -+#define CM_SMI_CTL_KILL (1 << 5) -+#define CM_SMI_CTL_ENAB (1 << 4) -+#define CM_SMI_CTL_SRC_MASK (0xf) -+#define CM_SMI_CTL_SRC_OFFS (0) -+ -+#define CM_SMI_DIV_DIVI_MASK (0xf << 12) -+#define CM_SMI_DIV_DIVI_OFFS (12) -+#define CM_SMI_DIV_DIVF_MASK (0xff << 4) -+#define CM_SMI_DIV_DIVF_OFFS (4) -+ -+/* SMI register mapping:*/ -+#define SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x600000) -+ -+#define SMICS 0x00 /* control + status register */ -+#define SMIL 0x04 /* length/count (n external txfers) */ -+#define SMIA 0x08 /* address register */ -+#define SMID 0x0c /* data register */ -+#define SMIDSR0 0x10 /* device 0 read settings */ -+#define SMIDSW0 0x14 /* device 0 write settings */ -+#define SMIDSR1 0x18 /* device 1 read settings */ -+#define SMIDSW1 0x1c /* device 1 write settings */ -+#define SMIDSR2 0x20 /* device 2 read settings */ -+#define SMIDSW2 0x24 /* device 2 write settings */ -+#define SMIDSR3 0x28 /* device 3 read settings */ -+#define SMIDSW3 0x2c /* device 3 write settings */ -+#define SMIDC 0x30 /* DMA control registers */ -+#define SMIDCS 0x34 /* direct control/status register */ -+#define SMIDA 0x38 /* direct address register */ -+#define SMIDD 0x3c /* direct data registers */ -+#define SMIFD 0x40 /* FIFO debug register */ -+ -+ -+ -+/* Control and Status register bits: -+ * SMICS_RXF : RX fifo full: 1 when RX fifo is full -+ * SMICS_TXE : TX fifo empty: 1 when empty. -+ * SMICS_RXD : RX fifo contains data: 1 when there is data. -+ * SMICS_TXD : TX fifo can accept data: 1 when true. -+ * SMICS_RXR : RX fifo needs reading: 1 when fifo more than 3/4 full, or -+ * when "DONE" and fifo not emptied. -+ * SMICS_TXW : TX fifo needs writing: 1 when less than 1/4 full. -+ * SMICS_AFERR : AXI FIFO error: 1 when fifo read when empty or written -+ * when full. Write 1 to clear. -+ * SMICS_EDREQ : 1 when external DREQ received. -+ * SMICS_PXLDAT : Pixel data: write 1 to enable pixel transfer modes. -+ * SMICS_SETERR : 1 if there was an error writing to setup regs (e.g. -+ * tx was in progress). Write 1 to clear. -+ * SMICS_PVMODE : Set to 1 to enable pixel valve mode. -+ * SMICS_INTR : Set to 1 to enable interrupt on RX. -+ * SMICS_INTT : Set to 1 to enable interrupt on TX. -+ * SMICS_INTD : Set to 1 to enable interrupt on DONE condition. -+ * SMICS_TEEN : Tear effect mode enabled: Programmed transfers will wait -+ * for a TE trigger before writing. -+ * SMICS_PAD1 : Padding settings for external transfers. For writes: the -+ * number of bytes initially written to the TX fifo that -+ * SMICS_PAD0 : should be ignored. For reads: the number of bytes that will -+ * be read before the data, and should be dropped. -+ * SMICS_WRITE : Transfer direction: 1 = write to external device, 0 = read -+ * SMICS_CLEAR : Write 1 to clear the FIFOs. -+ * SMICS_START : Write 1 to start the programmed transfer. -+ * SMICS_ACTIVE : Reads as 1 when a programmed transfer is underway. -+ * SMICS_DONE : Reads as 1 when transfer finished. For RX, not set until -+ * FIFO emptied. -+ * SMICS_ENABLE : Set to 1 to enable the SMI peripheral, 0 to disable. -+ */ -+ -+#define SMICS_RXF (1 << 31) -+#define SMICS_TXE (1 << 30) -+#define SMICS_RXD (1 << 29) -+#define SMICS_TXD (1 << 28) -+#define SMICS_RXR (1 << 27) -+#define SMICS_TXW (1 << 26) -+#define SMICS_AFERR (1 << 25) -+#define SMICS_EDREQ (1 << 15) -+#define SMICS_PXLDAT (1 << 14) -+#define SMICS_SETERR (1 << 13) -+#define SMICS_PVMODE (1 << 12) -+#define SMICS_INTR (1 << 11) -+#define SMICS_INTT (1 << 10) -+#define SMICS_INTD (1 << 9) -+#define SMICS_TEEN (1 << 8) -+#define SMICS_PAD1 (1 << 7) -+#define SMICS_PAD0 (1 << 6) -+#define SMICS_WRITE (1 << 5) -+#define SMICS_CLEAR (1 << 4) -+#define SMICS_START (1 << 3) -+#define SMICS_ACTIVE (1 << 2) -+#define SMICS_DONE (1 << 1) -+#define SMICS_ENABLE (1 << 0) -+ -+/* Address register bits: */ -+ -+#define SMIA_DEVICE_MASK ((1 << 9) | (1 << 8)) -+#define SMIA_DEVICE_OFFS (8) -+#define SMIA_ADDR_MASK (0x3f) /* bits 5 -> 0 */ -+#define SMIA_ADDR_OFFS (0) -+ -+/* DMA control register bits: -+ * SMIDC_DMAEN : DMA enable: set 1: DMA requests will be issued. -+ * SMIDC_DMAP : DMA passthrough: when set to 0, top two data pins are used by -+ * SMI as usual. When set to 1, the top two pins are used for -+ * external DREQs: pin 16 read request, 17 write. -+ * SMIDC_PANIC* : Threshold at which DMA will panic during read/write. -+ * SMIDC_REQ* : Threshold at which DMA will generate a DREQ. -+ */ -+ -+#define SMIDC_DMAEN (1 << 28) -+#define SMIDC_DMAP (1 << 24) -+#define SMIDC_PANICR_MASK (0x3f << 18) -+#define SMIDC_PANICR_OFFS (18) -+#define SMIDC_PANICW_MASK (0x3f << 12) -+#define SMIDC_PANICW_OFFS (12) -+#define SMIDC_REQR_MASK (0x3f << 6) -+#define SMIDC_REQR_OFFS (6) -+#define SMIDC_REQW_MASK (0x3f) -+#define SMIDC_REQW_OFFS (0) -+ -+/* Device settings register bits: same for all 4 (or 3?) device register sets. -+ * Device read settings: -+ * SMIDSR_RWIDTH : Read transfer width. 00 = 8bit, 01 = 16bit, -+ * 10 = 18bit, 11 = 9bit. -+ * SMIDSR_RSETUP : Read setup time: number of core cycles between chip -+ * select/address and read strobe. Min 1, max 64. -+ * SMIDSR_MODE68 : 1 for System 68 mode (i.e. enable + direction pins, -+ * rather than OE + WE pin) -+ * SMIDSR_FSETUP : If set to 1, setup time only applies to first -+ * transfer after address change. -+ * SMIDSR_RHOLD : Number of core cycles between read strobe going -+ * inactive and CS/address going inactive. Min 1, max 64 -+ * SMIDSR_RPACEALL : When set to 1, this device's RPACE value will always -+ * be used for the next transaction, even if it is not -+ * to this device. -+ * SMIDSR_RPACE : Number of core cycles spent waiting between CS -+ * deassert and start of next transfer. Min 1, max 128 -+ * SMIDSR_RDREQ : 1 = use external DMA request on SD16 to pace reads -+ * from device. Must also set DMAP in SMICS. -+ * SMIDSR_RSTROBE : Number of cycles to assert the read strobe. -+ * min 1, max 128. -+ */ -+#define SMIDSR_RWIDTH_MASK ((1<<31)|(1<<30)) -+#define SMIDSR_RWIDTH_OFFS (30) -+#define SMIDSR_RSETUP_MASK (0x3f << 24) -+#define SMIDSR_RSETUP_OFFS (24) -+#define SMIDSR_MODE68 (1 << 23) -+#define SMIDSR_FSETUP (1 << 22) -+#define SMIDSR_RHOLD_MASK (0x3f << 16) -+#define SMIDSR_RHOLD_OFFS (16) -+#define SMIDSR_RPACEALL (1 << 15) -+#define SMIDSR_RPACE_MASK (0x7f << 8) -+#define SMIDSR_RPACE_OFFS (8) -+#define SMIDSR_RDREQ (1 << 7) -+#define SMIDSR_RSTROBE_MASK (0x7f) -+#define SMIDSR_RSTROBE_OFFS (0) -+ -+/* Device write settings: -+ * SMIDSW_WWIDTH : Write transfer width. 00 = 8bit, 01 = 16bit, -+ * 10= 18bit, 11 = 9bit. -+ * SMIDSW_WSETUP : Number of cycles between CS assert and write strobe. -+ * Min 1, max 64. -+ * SMIDSW_WFORMAT : Pixel format of input. 0 = 16bit RGB 565, -+ * 1 = 32bit RGBA 8888 -+ * SMIDSW_WSWAP : 1 = swap pixel data bits. (Use with SMICS_PXLDAT) -+ * SMIDSW_WHOLD : Time between WE deassert and CS deassert. 1 to 64 -+ * SMIDSW_WPACEALL : 1: this device's WPACE will be used for the next -+ * transfer, regardless of that transfer's device. -+ * SMIDSW_WPACE : Cycles between CS deassert and next CS assert. -+ * Min 1, max 128 -+ * SMIDSW_WDREQ : Use external DREQ on pin 17 to pace writes. DMAP must -+ * be set in SMICS. -+ * SMIDSW_WSTROBE : Number of cycles to assert the write strobe. -+ * Min 1, max 128 -+ */ -+#define SMIDSW_WWIDTH_MASK ((1<<31)|(1<<30)) -+#define SMIDSW_WWIDTH_OFFS (30) -+#define SMIDSW_WSETUP_MASK (0x3f << 24) -+#define SMIDSW_WSETUP_OFFS (24) -+#define SMIDSW_WFORMAT (1 << 23) -+#define SMIDSW_WSWAP (1 << 22) -+#define SMIDSW_WHOLD_MASK (0x3f << 16) -+#define SMIDSW_WHOLD_OFFS (16) -+#define SMIDSW_WPACEALL (1 << 15) -+#define SMIDSW_WPACE_MASK (0x7f << 8) -+#define SMIDSW_WPACE_OFFS (8) -+#define SMIDSW_WDREQ (1 << 7) -+#define SMIDSW_WSTROBE_MASK (0x7f) -+#define SMIDSW_WSTROBE_OFFS (0) -+ -+/* Direct transfer control + status register -+ * SMIDCS_WRITE : Direction of transfer: 1 -> write, 0 -> read -+ * SMIDCS_DONE : 1 when a transfer has finished. Write 1 to clear. -+ * SMIDCS_START : Write 1 to start a transfer, if one is not already underway. -+ * SMIDCE_ENABLE: Write 1 to enable SMI in direct mode. -+ */ -+ -+#define SMIDCS_WRITE (1 << 3) -+#define SMIDCS_DONE (1 << 2) -+#define SMIDCS_START (1 << 1) -+#define SMIDCS_ENABLE (1 << 0) -+ -+/* Direct transfer address register -+ * SMIDA_DEVICE : Indicates which of the device settings banks should be used. -+ * SMIDA_ADDR : The value to be asserted on the address pins. -+ */ -+ -+#define SMIDA_DEVICE_MASK ((1<<9)|(1<<8)) -+#define SMIDA_DEVICE_OFFS (8) -+#define SMIDA_ADDR_MASK (0x3f) -+#define SMIDA_ADDR_OFFS (0) -+ -+/* FIFO debug register -+ * SMIFD_FLVL : The high-tide mark of FIFO count during the most recent txfer -+ * SMIFD_FCNT : The current FIFO count. -+ */ -+#define SMIFD_FLVL_MASK (0x3f << 8) -+#define SMIFD_FLVL_OFFS (8) -+#define SMIFD_FCNT_MASK (0x3f) -+#define SMIFD_FCNT_OFFS (0) -+ -+#endif /* BCM2835_SMI_IMPLEMENTATION */ -+ -+#endif /* BCM2835_SMI_H */ - -From 7df434185cb69481bdb857fb30c153685feb7c4e Mon Sep 17 00:00:00 2001 -From: Martin Sperl -Date: Tue, 26 Apr 2016 14:59:21 +0000 -Subject: [PATCH 043/122] MISC: bcm2835: smi: use clock manager and fix reload - issues - -Use clock manager instead of self-made clockmanager. - -Also fix some error paths that showd up during development -(especially missing release of dma resources on rmmod) - -Signed-off-by: Martin Sperl ---- - drivers/misc/bcm2835_smi.c | 86 +++++++++++++++------------------------------- - 1 file changed, 28 insertions(+), 58 deletions(-) - -diff --git a/drivers/misc/bcm2835_smi.c b/drivers/misc/bcm2835_smi.c -index 63a4ea08b9930a3a31a985f0a1d969b488ed49ec..1261540703127d1d63b9f3c87042c6e50d3fbec2 100644 ---- a/drivers/misc/bcm2835_smi.c -+++ b/drivers/misc/bcm2835_smi.c -@@ -34,6 +34,7 @@ - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -+#include - #include - #include - #include -@@ -62,7 +63,7 @@ - struct bcm2835_smi_instance { - struct device *dev; - struct smi_settings settings; -- __iomem void *smi_regs_ptr, *cm_smi_regs_ptr; -+ __iomem void *smi_regs_ptr; - dma_addr_t smi_regs_busaddr; - - struct dma_chan *dma_chan; -@@ -72,8 +73,7 @@ struct bcm2835_smi_instance { - - struct scatterlist buffer_sgl; - -- int clock_source; -- int clock_divisor; -+ struct clk *clk; - - /* Sometimes we are called into in an atomic context (e.g. by - JFFS2 + MTD) so we can't use a mutex */ -@@ -82,42 +82,6 @@ struct bcm2835_smi_instance { - - /**************************************************************************** - * --* SMI clock manager setup --* --***************************************************************************/ -- --static inline void write_smi_cm_reg(struct bcm2835_smi_instance *inst, -- u32 val, unsigned reg) --{ -- writel(CM_PWD | val, inst->cm_smi_regs_ptr + reg); --} -- --static inline u32 read_smi_cm_reg(struct bcm2835_smi_instance *inst, -- unsigned reg) --{ -- return readl(inst->cm_smi_regs_ptr + reg); --} -- --static void smi_setup_clock(struct bcm2835_smi_instance *inst) --{ -- dev_dbg(inst->dev, "Setting up clock..."); -- /* Disable SMI clock and wait for it to stop. */ -- write_smi_cm_reg(inst, 0, CM_SMI_CTL); -- while (read_smi_cm_reg(inst, CM_SMI_CTL) & CM_SMI_CTL_BUSY) -- ; -- -- write_smi_cm_reg(inst, (inst->clock_divisor << CM_SMI_DIV_DIVI_OFFS), -- CM_SMI_DIV); -- write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS), -- CM_SMI_CTL); -- -- /* Enable the clock */ -- write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS) | -- CM_SMI_CTL_ENAB, CM_SMI_CTL); --} -- --/**************************************************************************** --* - * SMI peripheral setup - * - ***************************************************************************/ -@@ -894,42 +858,40 @@ static int bcm2835_smi_probe(struct platform_device *pdev) - struct device_node *node = dev->of_node; - struct resource *ioresource; - struct bcm2835_smi_instance *inst; -+ const __be32 *addr; - -+ /* We require device tree support */ -+ if (!node) -+ return -EINVAL; - /* Allocate buffers and instance data */ -- - inst = devm_kzalloc(dev, sizeof(struct bcm2835_smi_instance), - GFP_KERNEL); -- - if (!inst) - return -ENOMEM; - - inst->dev = dev; - spin_lock_init(&inst->transaction_lock); - -- /* We require device tree support */ -- if (!node) -- return -EINVAL; -- - ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); - inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -- ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 1); -- inst->cm_smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -- inst->smi_regs_busaddr = be32_to_cpu( -- *of_get_address(node, 0, NULL, NULL)); -- of_property_read_u32(node, -- "brcm,smi-clock-source", -- &inst->clock_source); -- of_property_read_u32(node, -- "brcm,smi-clock-divisor", -- &inst->clock_divisor); -+ if (IS_ERR(inst->smi_regs_ptr)) { -+ err = PTR_ERR(inst->smi_regs_ptr); -+ goto err; -+ } -+ addr = of_get_address(node, 0, NULL, NULL); -+ inst->smi_regs_busaddr = be32_to_cpu(addr); - - err = bcm2835_smi_dma_setup(inst); - if (err) -- return err; -+ goto err; - -- /* Finally, do peripheral setup */ -+ /* request clock */ -+ inst->clk = devm_clk_get(dev, NULL); -+ if (!inst->clk) -+ goto err; -+ clk_prepare_enable(inst->clk); - -- smi_setup_clock(inst); -+ /* Finally, do peripheral setup */ - smi_setup_regs(inst); - - platform_set_drvdata(pdev, inst); -@@ -937,6 +899,9 @@ static int bcm2835_smi_probe(struct platform_device *pdev) - dev_info(inst->dev, "initialised"); - - return 0; -+err: -+ kfree(inst); -+ return err; - } - - /**************************************************************************** -@@ -950,6 +915,11 @@ static int bcm2835_smi_remove(struct platform_device *pdev) - struct bcm2835_smi_instance *inst = platform_get_drvdata(pdev); - struct device *dev = inst->dev; - -+ dmaengine_terminate_all(inst->dma_chan); -+ dma_release_channel(inst->dma_chan); -+ -+ clk_disable_unprepare(inst->clk); -+ - dev_info(dev, "SMI device removed - OK"); - return 0; - } - -From e80a053c8ec7283b7c93f468b437c1e53ffdd5dc Mon Sep 17 00:00:00 2001 -From: Luke Wren -Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 044/122] Add SMI NAND driver - -Signed-off-by: Luke Wren ---- - .../bindings/mtd/brcm,bcm2835-smi-nand.txt | 42 ++++ - drivers/mtd/nand/Kconfig | 7 + - drivers/mtd/nand/Makefile | 1 + - drivers/mtd/nand/bcm2835_smi_nand.c | 267 +++++++++++++++++++++ - 4 files changed, 317 insertions(+) - create mode 100644 Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt - create mode 100644 drivers/mtd/nand/bcm2835_smi_nand.c - -diff --git a/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..159544d6579070d376d146bd24a86653e7245707 ---- /dev/null -+++ b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt -@@ -0,0 +1,42 @@ -+* BCM2835 SMI NAND flash -+ -+This driver is a shim between the BCM2835 SMI driver (SMI is a peripheral for -+talking to parallel register interfaces) and Linux's MTD layer. -+ -+Required properties: -+- compatible: "brcm,bcm2835-smi-nand" -+- status: "okay" -+ -+Optional properties: -+- partition@n, where n is an integer from a consecutive sequence starting at 0 -+ - Difficult to store partition table on NAND device - normally put it -+ in the source code, kernel bootparams, or device tree (the best way!) -+ - Sub-properties: -+ - label: the partition name, as shown by mtdinfo /dev/mtd* -+ - reg: the size and offset of this partition. -+ - (optional) read-only: an empty property flagging as read only -+ -+Example: -+ -+nand: flash@0 { -+ compatible = "brcm,bcm2835-smi-nand"; -+ status = "okay"; -+ -+ partition@0 { -+ label = "stage2"; -+ // 128k -+ reg = <0 0x20000>; -+ read-only; -+ }; -+ partition@1 { -+ label = "firmware"; -+ // 16M -+ reg = <0x20000 0x1000000>; -+ read-only; -+ }; -+ partition@2 { -+ label = "root"; -+ // 2G -+ reg = <0x1020000 0x80000000>; -+ }; -+}; -\ No newline at end of file -diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig -index 7b7a887b4709f0122f32b60833d8c2e36bc4dead..2db503816a8d5d763bef1b08e3f458d1a2e87751 100644 ---- a/drivers/mtd/nand/Kconfig -+++ b/drivers/mtd/nand/Kconfig -@@ -41,6 +41,13 @@ config MTD_SM_COMMON - tristate - default n - -+config MTD_NAND_BCM2835_SMI -+ tristate "Use Broadcom's Secondary Memory Interface as a NAND controller (BCM283x)" -+ depends on BCM2835_SMI -+ default m -+ help -+ Uses the BCM2835's SMI peripheral as a NAND controller. -+ - config MTD_NAND_DENALI - tristate - -diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile -index cafde6f3d95761263d4c5af1395b11bfc000ca9b..d399ab9c92350596ac0970fb1a2a70fa3ac0094b 100644 ---- a/drivers/mtd/nand/Makefile -+++ b/drivers/mtd/nand/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o - obj-$(CONFIG_MTD_NAND_DENALI_PCI) += denali_pci.o - obj-$(CONFIG_MTD_NAND_DENALI_DT) += denali_dt.o - obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o -+obj-$(CONFIG_MTD_NAND_BCM2835_SMI) += bcm2835_smi_nand.o - obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o - obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o - obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o -diff --git a/drivers/mtd/nand/bcm2835_smi_nand.c b/drivers/mtd/nand/bcm2835_smi_nand.c -new file mode 100644 -index 0000000000000000000000000000000000000000..02adda6da18bd0ba9ab19a104975b79de58bfdce ---- /dev/null -+++ b/drivers/mtd/nand/bcm2835_smi_nand.c -@@ -0,0 +1,267 @@ -+/** -+ * NAND flash driver for Broadcom Secondary Memory Interface -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define DEVICE_NAME "bcm2835-smi-nand" -+#define DRIVER_NAME "smi-nand-bcm2835" -+ -+struct bcm2835_smi_nand_host { -+ struct bcm2835_smi_instance *smi_inst; -+ struct nand_chip nand_chip; -+ struct mtd_info mtd; -+ struct device *dev; -+}; -+ -+/**************************************************************************** -+* -+* NAND functionality implementation -+* -+****************************************************************************/ -+ -+#define SMI_NAND_CLE_PIN 0x01 -+#define SMI_NAND_ALE_PIN 0x02 -+ -+static inline void bcm2835_smi_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, -+ unsigned int ctrl) -+{ -+ uint32_t cmd32 = cmd; -+ uint32_t addr = ~(SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ if (ctrl & NAND_CLE) -+ addr |= SMI_NAND_CLE_PIN; -+ if (ctrl & NAND_ALE) -+ addr |= SMI_NAND_ALE_PIN; -+ /* Lower ALL the CS pins! */ -+ if (ctrl & NAND_NCE) -+ addr &= (SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); -+ -+ bcm2835_smi_set_address(inst, addr); -+ -+ if (cmd != NAND_CMD_NONE) -+ bcm2835_smi_write_buf(inst, &cmd32, 1); -+} -+ -+static inline uint8_t bcm2835_smi_nand_read_byte(struct mtd_info *mtd) -+{ -+ uint8_t byte; -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_read_buf(inst, &byte, 1); -+ return byte; -+} -+ -+static inline void bcm2835_smi_nand_write_byte(struct mtd_info *mtd, -+ uint8_t byte) -+{ -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_write_buf(inst, &byte, 1); -+} -+ -+static inline void bcm2835_smi_nand_write_buf(struct mtd_info *mtd, -+ const uint8_t *buf, int len) -+{ -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_write_buf(inst, buf, len); -+} -+ -+static inline void bcm2835_smi_nand_read_buf(struct mtd_info *mtd, -+ uint8_t *buf, int len) -+{ -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_read_buf(inst, buf, len); -+} -+ -+/**************************************************************************** -+* -+* Probe and remove functions -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_nand_probe(struct platform_device *pdev) -+{ -+ struct bcm2835_smi_nand_host *host; -+ struct nand_chip *this; -+ struct mtd_info *mtd; -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node, *smi_node; -+ struct mtd_part_parser_data ppdata; -+ struct smi_settings *smi_settings; -+ struct bcm2835_smi_instance *smi_inst; -+ int ret = -ENXIO; -+ -+ if (!node) { -+ dev_err(dev, "No device tree node supplied!"); -+ return -EINVAL; -+ } -+ -+ smi_node = of_parse_phandle(node, "smi_handle", 0); -+ -+ /* Request use of SMI peripheral: */ -+ smi_inst = bcm2835_smi_get(smi_node); -+ -+ if (!smi_inst) { -+ dev_err(dev, "Could not register with SMI."); -+ return -EPROBE_DEFER; -+ } -+ -+ /* Set SMI timing and bus width */ -+ -+ smi_settings = bcm2835_smi_get_settings_from_regs(smi_inst); -+ -+ smi_settings->data_width = SMI_WIDTH_8BIT; -+ smi_settings->read_setup_time = 2; -+ smi_settings->read_hold_time = 1; -+ smi_settings->read_pace_time = 1; -+ smi_settings->read_strobe_time = 3; -+ -+ smi_settings->write_setup_time = 2; -+ smi_settings->write_hold_time = 1; -+ smi_settings->write_pace_time = 1; -+ smi_settings->write_strobe_time = 3; -+ -+ bcm2835_smi_set_regs_from_settings(smi_inst); -+ -+ host = devm_kzalloc(dev, sizeof(struct bcm2835_smi_nand_host), -+ GFP_KERNEL); -+ if (!host) -+ return -ENOMEM; -+ -+ host->dev = dev; -+ host->smi_inst = smi_inst; -+ -+ platform_set_drvdata(pdev, host); -+ -+ /* Link the structures together */ -+ -+ this = &host->nand_chip; -+ mtd = &host->mtd; -+ mtd->priv = this; -+ mtd->owner = THIS_MODULE; -+ mtd->dev.parent = dev; -+ mtd->name = DRIVER_NAME; -+ -+ /* 20 us command delay time... */ -+ this->chip_delay = 20; -+ -+ this->priv = host; -+ this->cmd_ctrl = bcm2835_smi_nand_cmd_ctrl; -+ this->read_byte = bcm2835_smi_nand_read_byte; -+ this->write_byte = bcm2835_smi_nand_write_byte; -+ this->write_buf = bcm2835_smi_nand_write_buf; -+ this->read_buf = bcm2835_smi_nand_read_buf; -+ -+ this->ecc.mode = NAND_ECC_SOFT; -+ -+ /* Should never be accessed directly: */ -+ -+ this->IO_ADDR_R = (void *)0xdeadbeef; -+ this->IO_ADDR_W = (void *)0xdeadbeef; -+ -+ /* First scan to find the device and get the page size */ -+ -+ if (nand_scan_ident(mtd, 1, NULL)) -+ return -ENXIO; -+ -+ /* Second phase scan */ -+ -+ if (nand_scan_tail(mtd)) -+ return -ENXIO; -+ -+ ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ if (!ret) -+ return 0; -+ -+ nand_release(mtd); -+ return -EINVAL; -+} -+ -+static int bcm2835_smi_nand_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_smi_nand_host *host = platform_get_drvdata(pdev); -+ -+ nand_release(&host->mtd); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_smi_nand_of_match[] = { -+ {.compatible = "brcm,bcm2835-smi-nand",}, -+ { /* sentinel */ } -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_smi_nand_of_match); -+ -+static struct platform_driver bcm2835_smi_nand_driver = { -+ .probe = bcm2835_smi_nand_probe, -+ .remove = bcm2835_smi_nand_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_smi_nand_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_smi_nand_driver); -+ -+MODULE_ALIAS("platform:smi-nand-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION -+ ("Driver for NAND chips using Broadcom Secondary Memory Interface"); -+MODULE_AUTHOR("Luke Wren "); - -From d5fe3a35c384918e40ad67ae26c5997ca941c98e Mon Sep 17 00:00:00 2001 -From: Aron Szabo -Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 045/122] lirc: added support for RaspberryPi GPIO - -lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others -See: https://github.com/raspberrypi/linux/issues/525 - -lirc: Remove restriction on gpio pins that can be used with lirc - -Compute Module, for example could use different pins - -lirc_rpi: Add parameter to specify input pin pull - -Depending on the connected IR circuitry it might be desirable to change the -gpios internal pull from it pull-down default behaviour. Add a module -parameter to allow the user to set it explicitly. - -Signed-off-by: Julian Scheel - -lirc-rpi: Use the higher-level irq control functions - -This module used to access the irq_chip methods of the -gpio controller directly, rather than going through the -standard enable_irq/irq_set_irq_type functions. This -caused problems on pinctrl-bcm2835 which only implements -the irq_enable/disable methods and not irq_unmask/mask. - -lirc-rpi: Correct the interrupt usage - -1) Correct the use of enable_irq (i.e. don't call it so often) -2) Correct the shutdown sequence. -3) Avoid a bcm2708_gpio driver quirk by setting the irq flags earlier - -lirc-rpi: use getnstimeofday instead of read_current_timer - -read_current_timer isn't guaranteed to return values in -microseconds, and indeed it doesn't on a Pi2. - -Issue: linux#827 - -lirc-rpi: Add device tree support, and a suitable overlay - -The overlay supports DT parameters that match the old module -parameters, except that gpio_in_pull should be set using the -strings "up", "down" or "off". - -lirc-rpi: Also support pinctrl-bcm2835 in non-DT mode - -fix auto-sense in lirc_rpi driver - -On a Raspberry Pi 2, the lirc_rpi driver might receive spurious -interrupts and change it's low-active / high-active setting. -When this happens, the IR remote control stops working. - -This patch disables this auto-detection if the 'sense' parameter -was set in the device tree, making the driver robust to such -spurious interrupts. ---- - drivers/staging/media/lirc/Kconfig | 6 + - drivers/staging/media/lirc/Makefile | 1 + - drivers/staging/media/lirc/lirc_rpi.c | 734 ++++++++++++++++++++++++++++++++++ - include/linux/platform_data/bcm2708.h | 23 ++ - 4 files changed, 764 insertions(+) - create mode 100644 drivers/staging/media/lirc/lirc_rpi.c - create mode 100644 include/linux/platform_data/bcm2708.h - -diff --git a/drivers/staging/media/lirc/Kconfig b/drivers/staging/media/lirc/Kconfig -index 6879c4651b46c8b48460626cb346b8ee23fa6587..77c69f2d4158be625a5956095b988cd3774dbfae 100644 ---- a/drivers/staging/media/lirc/Kconfig -+++ b/drivers/staging/media/lirc/Kconfig -@@ -32,6 +32,12 @@ config LIRC_PARALLEL - help - Driver for Homebrew Parallel Port Receivers - -+config LIRC_RPI -+ tristate "Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi" -+ depends on LIRC -+ help -+ Driver for Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi -+ - config LIRC_SASEM - tristate "Sasem USB IR Remote" - depends on LIRC && USB -diff --git a/drivers/staging/media/lirc/Makefile b/drivers/staging/media/lirc/Makefile -index 5430adf0475ded5abe2ef4b4cf4e7f2c08297894..9e53cd0caf58ba28a939b780c876d4017a23ac2b 100644 ---- a/drivers/staging/media/lirc/Makefile -+++ b/drivers/staging/media/lirc/Makefile -@@ -6,6 +6,7 @@ - obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o - obj-$(CONFIG_LIRC_IMON) += lirc_imon.o - obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o -+obj-$(CONFIG_LIRC_RPI) += lirc_rpi.o - obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o - obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o - obj-$(CONFIG_LIRC_SIR) += lirc_sir.o -diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..61328968d21540b04814cbd5155eaa30b715c8f4 ---- /dev/null -+++ b/drivers/staging/media/lirc/lirc_rpi.c -@@ -0,0 +1,734 @@ -+/* -+ * lirc_rpi.c -+ * -+ * lirc_rpi - Device driver that records pulse- and pause-lengths -+ * (space-lengths) (just like the lirc_serial driver does) -+ * between GPIO interrupt events on the Raspberry Pi. -+ * Lots of code has been taken from the lirc_serial module, -+ * so I would like say thanks to the authors. -+ * -+ * Copyright (C) 2012 Aron Robert Szabo , -+ * Michael Bishop -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define LIRC_DRIVER_NAME "lirc_rpi" -+#define RBUF_LEN 256 -+#define LIRC_TRANSMITTER_LATENCY 50 -+ -+#ifndef MAX_UDELAY_MS -+#define MAX_UDELAY_US 5000 -+#else -+#define MAX_UDELAY_US (MAX_UDELAY_MS*1000) -+#endif -+ -+#define dprintk(fmt, args...) \ -+ do { \ -+ if (debug) \ -+ printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \ -+ fmt, ## args); \ -+ } while (0) -+ -+/* module parameters */ -+ -+/* set the default GPIO input pin */ -+static int gpio_in_pin = 18; -+/* set the default pull behaviour for input pin */ -+static int gpio_in_pull = BCM2708_PULL_DOWN; -+/* set the default GPIO output pin */ -+static int gpio_out_pin = 17; -+/* enable debugging messages */ -+static bool debug; -+/* -1 = auto, 0 = active high, 1 = active low */ -+static int sense = -1; -+/* use softcarrier by default */ -+static bool softcarrier = 1; -+/* 0 = do not invert output, 1 = invert output */ -+static bool invert = 0; -+ -+struct gpio_chip *gpiochip; -+static int irq_num; -+static int auto_sense = 1; -+ -+/* forward declarations */ -+static long send_pulse(unsigned long length); -+static void send_space(long length); -+static void lirc_rpi_exit(void); -+ -+static struct platform_device *lirc_rpi_dev; -+static struct timeval lasttv = { 0, 0 }; -+static struct lirc_buffer rbuf; -+static spinlock_t lock; -+ -+/* initialized/set in init_timing_params() */ -+static unsigned int freq = 38000; -+static unsigned int duty_cycle = 50; -+static unsigned long period; -+static unsigned long pulse_width; -+static unsigned long space_width; -+ -+static void safe_udelay(unsigned long usecs) -+{ -+ while (usecs > MAX_UDELAY_US) { -+ udelay(MAX_UDELAY_US); -+ usecs -= MAX_UDELAY_US; -+ } -+ udelay(usecs); -+} -+ -+static unsigned long read_current_us(void) -+{ -+ struct timespec now; -+ getnstimeofday(&now); -+ return (now.tv_sec * 1000000) + (now.tv_nsec/1000); -+} -+ -+static int init_timing_params(unsigned int new_duty_cycle, -+ unsigned int new_freq) -+{ -+ if (1000 * 1000000L / new_freq * new_duty_cycle / 100 <= -+ LIRC_TRANSMITTER_LATENCY) -+ return -EINVAL; -+ if (1000 * 1000000L / new_freq * (100 - new_duty_cycle) / 100 <= -+ LIRC_TRANSMITTER_LATENCY) -+ return -EINVAL; -+ duty_cycle = new_duty_cycle; -+ freq = new_freq; -+ period = 1000 * 1000000L / freq; -+ pulse_width = period * duty_cycle / 100; -+ space_width = period - pulse_width; -+ dprintk("in init_timing_params, freq=%d pulse=%ld, " -+ "space=%ld\n", freq, pulse_width, space_width); -+ return 0; -+} -+ -+static long send_pulse_softcarrier(unsigned long length) -+{ -+ int flag; -+ unsigned long actual, target; -+ unsigned long actual_us, initial_us, target_us; -+ -+ length *= 1000; -+ -+ actual = 0; target = 0; flag = 0; -+ actual_us = read_current_us(); -+ -+ while (actual < length) { -+ if (flag) { -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ target += space_width; -+ } else { -+ gpiochip->set(gpiochip, gpio_out_pin, !invert); -+ target += pulse_width; -+ } -+ initial_us = actual_us; -+ target_us = actual_us + (target - actual) / 1000; -+ /* -+ * Note - we've checked in ioctl that the pulse/space -+ * widths are big enough so that d is > 0 -+ */ -+ if ((int)(target_us - actual_us) > 0) -+ udelay(target_us - actual_us); -+ actual_us = read_current_us(); -+ actual += (actual_us - initial_us) * 1000; -+ flag = !flag; -+ } -+ return (actual-length) / 1000; -+} -+ -+static long send_pulse(unsigned long length) -+{ -+ if (length <= 0) -+ return 0; -+ -+ if (softcarrier) { -+ return send_pulse_softcarrier(length); -+ } else { -+ gpiochip->set(gpiochip, gpio_out_pin, !invert); -+ safe_udelay(length); -+ return 0; -+ } -+} -+ -+static void send_space(long length) -+{ -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ if (length <= 0) -+ return; -+ safe_udelay(length); -+} -+ -+static void rbwrite(int l) -+{ -+ if (lirc_buffer_full(&rbuf)) { -+ /* no new signals will be accepted */ -+ dprintk("Buffer overrun\n"); -+ return; -+ } -+ lirc_buffer_write(&rbuf, (void *)&l); -+} -+ -+static void frbwrite(int l) -+{ -+ /* simple noise filter */ -+ static int pulse, space; -+ static unsigned int ptr; -+ -+ if (ptr > 0 && (l & PULSE_BIT)) { -+ pulse += l & PULSE_MASK; -+ if (pulse > 250) { -+ rbwrite(space); -+ rbwrite(pulse | PULSE_BIT); -+ ptr = 0; -+ pulse = 0; -+ } -+ return; -+ } -+ if (!(l & PULSE_BIT)) { -+ if (ptr == 0) { -+ if (l > 20000) { -+ space = l; -+ ptr++; -+ return; -+ } -+ } else { -+ if (l > 20000) { -+ space += pulse; -+ if (space > PULSE_MASK) -+ space = PULSE_MASK; -+ space += l; -+ if (space > PULSE_MASK) -+ space = PULSE_MASK; -+ pulse = 0; -+ return; -+ } -+ rbwrite(space); -+ rbwrite(pulse | PULSE_BIT); -+ ptr = 0; -+ pulse = 0; -+ } -+ } -+ rbwrite(l); -+} -+ -+static irqreturn_t irq_handler(int i, void *blah, struct pt_regs *regs) -+{ -+ struct timeval tv; -+ long deltv; -+ int data; -+ int signal; -+ -+ /* use the GPIO signal level */ -+ signal = gpiochip->get(gpiochip, gpio_in_pin); -+ -+ if (sense != -1) { -+ /* get current time */ -+ do_gettimeofday(&tv); -+ -+ /* calc time since last interrupt in microseconds */ -+ deltv = tv.tv_sec-lasttv.tv_sec; -+ if (tv.tv_sec < lasttv.tv_sec || -+ (tv.tv_sec == lasttv.tv_sec && -+ tv.tv_usec < lasttv.tv_usec)) { -+ printk(KERN_WARNING LIRC_DRIVER_NAME -+ ": AIEEEE: your clock just jumped backwards\n"); -+ printk(KERN_WARNING LIRC_DRIVER_NAME -+ ": %d %d %lx %lx %lx %lx\n", signal, sense, -+ tv.tv_sec, lasttv.tv_sec, -+ tv.tv_usec, lasttv.tv_usec); -+ data = PULSE_MASK; -+ } else if (deltv > 15) { -+ data = PULSE_MASK; /* really long time */ -+ if (!(signal^sense)) { -+ /* sanity check */ -+ printk(KERN_DEBUG LIRC_DRIVER_NAME -+ ": AIEEEE: %d %d %lx %lx %lx %lx\n", -+ signal, sense, tv.tv_sec, lasttv.tv_sec, -+ tv.tv_usec, lasttv.tv_usec); -+ /* -+ * detecting pulse while this -+ * MUST be a space! -+ */ -+ if (auto_sense) { -+ sense = sense ? 0 : 1; -+ } -+ } -+ } else { -+ data = (int) (deltv*1000000 + -+ (tv.tv_usec - lasttv.tv_usec)); -+ } -+ frbwrite(signal^sense ? data : (data|PULSE_BIT)); -+ lasttv = tv; -+ wake_up_interruptible(&rbuf.wait_poll); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static int is_right_chip(struct gpio_chip *chip, void *data) -+{ -+ dprintk("is_right_chip %s %d\n", chip->label, strcmp(data, chip->label)); -+ -+ if (strcmp(data, chip->label) == 0) -+ return 1; -+ return 0; -+} -+ -+static inline int read_bool_property(const struct device_node *np, -+ const char *propname, -+ bool *out_value) -+{ -+ u32 value = 0; -+ int err = of_property_read_u32(np, propname, &value); -+ if (err == 0) -+ *out_value = (value != 0); -+ return err; -+} -+ -+static void read_pin_settings(struct device_node *node) -+{ -+ u32 pin; -+ int index; -+ -+ for (index = 0; -+ of_property_read_u32_index( -+ node, -+ "brcm,pins", -+ index, -+ &pin) == 0; -+ index++) { -+ u32 function; -+ int err; -+ err = of_property_read_u32_index( -+ node, -+ "brcm,function", -+ index, -+ &function); -+ if (err == 0) { -+ if (function == 1) /* Output */ -+ gpio_out_pin = pin; -+ else if (function == 0) /* Input */ -+ gpio_in_pin = pin; -+ } -+ } -+} -+ -+static int init_port(void) -+{ -+ int i, nlow, nhigh; -+ struct device_node *node; -+ -+ node = lirc_rpi_dev->dev.of_node; -+ -+ gpiochip = gpiochip_find("bcm2708_gpio", is_right_chip); -+ -+ /* -+ * Because of the lack of a setpull function, only support -+ * pinctrl-bcm2835 if using device tree. -+ */ -+ if (!gpiochip && node) -+ gpiochip = gpiochip_find("pinctrl-bcm2835", is_right_chip); -+ -+ if (!gpiochip) { -+ pr_err(LIRC_DRIVER_NAME ": gpio chip not found!\n"); -+ return -ENODEV; -+ } -+ -+ if (node) { -+ struct device_node *pins_node; -+ -+ pins_node = of_parse_phandle(node, "pinctrl-0", 0); -+ if (!pins_node) { -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": pinctrl settings not found!\n"); -+ return -EINVAL; -+ } -+ -+ read_pin_settings(pins_node); -+ -+ of_property_read_u32(node, "rpi,sense", &sense); -+ -+ read_bool_property(node, "rpi,softcarrier", &softcarrier); -+ -+ read_bool_property(node, "rpi,invert", &invert); -+ -+ read_bool_property(node, "rpi,debug", &debug); -+ -+ } else { -+ return -EINVAL; -+ } -+ -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ -+ irq_num = gpiochip->to_irq(gpiochip, gpio_in_pin); -+ dprintk("to_irq %d\n", irq_num); -+ -+ /* if pin is high, then this must be an active low receiver. */ -+ if (sense == -1) { -+ /* wait 1/2 sec for the power supply */ -+ msleep(500); -+ -+ /* -+ * probe 9 times every 0.04s, collect "votes" for -+ * active high/low -+ */ -+ nlow = 0; -+ nhigh = 0; -+ for (i = 0; i < 9; i++) { -+ if (gpiochip->get(gpiochip, gpio_in_pin)) -+ nlow++; -+ else -+ nhigh++; -+ msleep(40); -+ } -+ sense = (nlow >= nhigh ? 1 : 0); -+ printk(KERN_INFO LIRC_DRIVER_NAME -+ ": auto-detected active %s receiver on GPIO pin %d\n", -+ sense ? "low" : "high", gpio_in_pin); -+ } else { -+ printk(KERN_INFO LIRC_DRIVER_NAME -+ ": manually using active %s receiver on GPIO pin %d\n", -+ sense ? "low" : "high", gpio_in_pin); -+ auto_sense = 0; -+ } -+ -+ return 0; -+} -+ -+// called when the character device is opened -+static int set_use_inc(void *data) -+{ -+ int result; -+ -+ /* initialize timestamp */ -+ do_gettimeofday(&lasttv); -+ -+ result = request_irq(irq_num, -+ (irq_handler_t) irq_handler, -+ IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, -+ LIRC_DRIVER_NAME, (void*) 0); -+ -+ switch (result) { -+ case -EBUSY: -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": IRQ %d is busy\n", -+ irq_num); -+ return -EBUSY; -+ case -EINVAL: -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": Bad irq number or handler\n"); -+ return -EINVAL; -+ default: -+ dprintk("Interrupt %d obtained\n", -+ irq_num); -+ break; -+ }; -+ -+ /* initialize pulse/space widths */ -+ init_timing_params(duty_cycle, freq); -+ -+ return 0; -+} -+ -+static void set_use_dec(void *data) -+{ -+ /* GPIO Pin Falling/Rising Edge Detect Disable */ -+ irq_set_irq_type(irq_num, 0); -+ disable_irq(irq_num); -+ -+ free_irq(irq_num, (void *) 0); -+ -+ dprintk(KERN_INFO LIRC_DRIVER_NAME -+ ": freed IRQ %d\n", irq_num); -+} -+ -+static ssize_t lirc_write(struct file *file, const char *buf, -+ size_t n, loff_t *ppos) -+{ -+ int i, count; -+ unsigned long flags; -+ long delta = 0; -+ int *wbuf; -+ -+ count = n / sizeof(int); -+ if (n % sizeof(int) || count % 2 == 0) -+ return -EINVAL; -+ wbuf = memdup_user(buf, n); -+ if (IS_ERR(wbuf)) -+ return PTR_ERR(wbuf); -+ spin_lock_irqsave(&lock, flags); -+ -+ for (i = 0; i < count; i++) { -+ if (i%2) -+ send_space(wbuf[i] - delta); -+ else -+ delta = send_pulse(wbuf[i]); -+ } -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ -+ spin_unlock_irqrestore(&lock, flags); -+ kfree(wbuf); -+ return n; -+} -+ -+static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) -+{ -+ int result; -+ __u32 value; -+ -+ switch (cmd) { -+ case LIRC_GET_SEND_MODE: -+ return -ENOIOCTLCMD; -+ break; -+ -+ case LIRC_SET_SEND_MODE: -+ result = get_user(value, (__u32 *) arg); -+ if (result) -+ return result; -+ /* only LIRC_MODE_PULSE supported */ -+ if (value != LIRC_MODE_PULSE) -+ return -ENOSYS; -+ break; -+ -+ case LIRC_GET_LENGTH: -+ return -ENOSYS; -+ break; -+ -+ case LIRC_SET_SEND_DUTY_CYCLE: -+ dprintk("SET_SEND_DUTY_CYCLE\n"); -+ result = get_user(value, (__u32 *) arg); -+ if (result) -+ return result; -+ if (value <= 0 || value > 100) -+ return -EINVAL; -+ return init_timing_params(value, freq); -+ break; -+ -+ case LIRC_SET_SEND_CARRIER: -+ dprintk("SET_SEND_CARRIER\n"); -+ result = get_user(value, (__u32 *) arg); -+ if (result) -+ return result; -+ if (value > 500000 || value < 20000) -+ return -EINVAL; -+ return init_timing_params(duty_cycle, value); -+ break; -+ -+ default: -+ return lirc_dev_fop_ioctl(filep, cmd, arg); -+ } -+ return 0; -+} -+ -+static const struct file_operations lirc_fops = { -+ .owner = THIS_MODULE, -+ .write = lirc_write, -+ .unlocked_ioctl = lirc_ioctl, -+ .read = lirc_dev_fop_read, -+ .poll = lirc_dev_fop_poll, -+ .open = lirc_dev_fop_open, -+ .release = lirc_dev_fop_close, -+ .llseek = no_llseek, -+}; -+ -+static struct lirc_driver driver = { -+ .name = LIRC_DRIVER_NAME, -+ .minor = -1, -+ .code_length = 1, -+ .sample_rate = 0, -+ .data = NULL, -+ .add_to_buf = NULL, -+ .rbuf = &rbuf, -+ .set_use_inc = set_use_inc, -+ .set_use_dec = set_use_dec, -+ .fops = &lirc_fops, -+ .dev = NULL, -+ .owner = THIS_MODULE, -+}; -+ -+static const struct of_device_id lirc_rpi_of_match[] = { -+ { .compatible = "rpi,lirc-rpi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, lirc_rpi_of_match); -+ -+static struct platform_driver lirc_rpi_driver = { -+ .driver = { -+ .name = LIRC_DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(lirc_rpi_of_match), -+ }, -+}; -+ -+static int __init lirc_rpi_init(void) -+{ -+ struct device_node *node; -+ int result; -+ -+ /* Init read buffer. */ -+ result = lirc_buffer_init(&rbuf, sizeof(int), RBUF_LEN); -+ if (result < 0) -+ return -ENOMEM; -+ -+ result = platform_driver_register(&lirc_rpi_driver); -+ if (result) { -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": lirc register returned %d\n", result); -+ goto exit_buffer_free; -+ } -+ -+ node = of_find_compatible_node(NULL, NULL, -+ lirc_rpi_of_match[0].compatible); -+ -+ if (node) { -+ /* DT-enabled */ -+ lirc_rpi_dev = of_find_device_by_node(node); -+ WARN_ON(lirc_rpi_dev->dev.of_node != node); -+ of_node_put(node); -+ } -+ else { -+ lirc_rpi_dev = platform_device_alloc(LIRC_DRIVER_NAME, 0); -+ if (!lirc_rpi_dev) { -+ result = -ENOMEM; -+ goto exit_driver_unregister; -+ } -+ -+ result = platform_device_add(lirc_rpi_dev); -+ if (result) -+ goto exit_device_put; -+ } -+ -+ return 0; -+ -+ exit_device_put: -+ platform_device_put(lirc_rpi_dev); -+ -+ exit_driver_unregister: -+ platform_driver_unregister(&lirc_rpi_driver); -+ -+ exit_buffer_free: -+ lirc_buffer_free(&rbuf); -+ -+ return result; -+} -+ -+static void lirc_rpi_exit(void) -+{ -+ if (!lirc_rpi_dev->dev.of_node) -+ platform_device_unregister(lirc_rpi_dev); -+ platform_driver_unregister(&lirc_rpi_driver); -+ lirc_buffer_free(&rbuf); -+} -+ -+static int __init lirc_rpi_init_module(void) -+{ -+ int result; -+ -+ result = lirc_rpi_init(); -+ if (result) -+ return result; -+ -+ result = init_port(); -+ if (result < 0) -+ goto exit_rpi; -+ -+ driver.features = LIRC_CAN_SET_SEND_DUTY_CYCLE | -+ LIRC_CAN_SET_SEND_CARRIER | -+ LIRC_CAN_SEND_PULSE | -+ LIRC_CAN_REC_MODE2; -+ -+ driver.dev = &lirc_rpi_dev->dev; -+ driver.minor = lirc_register_driver(&driver); -+ -+ if (driver.minor < 0) { -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": device registration failed with %d\n", result); -+ result = -EIO; -+ goto exit_rpi; -+ } -+ -+ printk(KERN_INFO LIRC_DRIVER_NAME ": driver registered!\n"); -+ -+ return 0; -+ -+ exit_rpi: -+ lirc_rpi_exit(); -+ -+ return result; -+} -+ -+static void __exit lirc_rpi_exit_module(void) -+{ -+ lirc_unregister_driver(driver.minor); -+ -+ gpio_free(gpio_out_pin); -+ gpio_free(gpio_in_pin); -+ -+ lirc_rpi_exit(); -+ -+ printk(KERN_INFO LIRC_DRIVER_NAME ": cleaned up module\n"); -+} -+ -+module_init(lirc_rpi_init_module); -+module_exit(lirc_rpi_exit_module); -+ -+MODULE_DESCRIPTION("Infra-red receiver and blaster driver for Raspberry Pi GPIO."); -+MODULE_AUTHOR("Aron Robert Szabo "); -+MODULE_AUTHOR("Michael Bishop "); -+MODULE_LICENSE("GPL"); -+ -+module_param(gpio_out_pin, int, S_IRUGO); -+MODULE_PARM_DESC(gpio_out_pin, "GPIO output/transmitter pin number of the BCM" -+ " processor. (default 17"); -+ -+module_param(gpio_in_pin, int, S_IRUGO); -+MODULE_PARM_DESC(gpio_in_pin, "GPIO input pin number of the BCM processor." -+ " (default 18"); -+ -+module_param(gpio_in_pull, int, S_IRUGO); -+MODULE_PARM_DESC(gpio_in_pull, "GPIO input pin pull configuration." -+ " (0 = off, 1 = up, 2 = down, default down)"); -+ -+module_param(sense, int, S_IRUGO); -+MODULE_PARM_DESC(sense, "Override autodetection of IR receiver circuit" -+ " (0 = active high, 1 = active low )"); -+ -+module_param(softcarrier, bool, S_IRUGO); -+MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)"); -+ -+module_param(invert, bool, S_IRUGO); -+MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off"); -+ -+module_param(debug, bool, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(debug, "Enable debugging messages"); -diff --git a/include/linux/platform_data/bcm2708.h b/include/linux/platform_data/bcm2708.h -new file mode 100644 -index 0000000000000000000000000000000000000000..fb69624ccef00ddbdccf8256d6baf1b172de57ec ---- /dev/null -+++ b/include/linux/platform_data/bcm2708.h -@@ -0,0 +1,23 @@ -+/* -+ * include/linux/platform_data/bcm2708.h -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * (C) 2014 Julian Scheel -+ * -+ */ -+#ifndef __BCM2708_H_ -+#define __BCM2708_H_ -+ -+typedef enum { -+ BCM2708_PULL_OFF, -+ BCM2708_PULL_UP, -+ BCM2708_PULL_DOWN -+} bcm2708_gpio_pull_t; -+ -+extern int bcm2708_gpio_setpull(struct gpio_chip *gc, unsigned offset, -+ bcm2708_gpio_pull_t value); -+ -+#endif - -From f66f635379d5b4ebc82d4d18c9bd77d2fbcbdfa6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 046/122] Add cpufreq driver - -Signed-off-by: popcornmix ---- - drivers/cpufreq/Kconfig.arm | 9 ++ - drivers/cpufreq/Makefile | 1 + - drivers/cpufreq/bcm2835-cpufreq.c | 218 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 228 insertions(+) - create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c - -diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm -index d89b8afe23b6956b6c48e19c87cecc081e7725a1..465c727bb3ba70249409728d8f643a0002c6779c 100644 ---- a/drivers/cpufreq/Kconfig.arm -+++ b/drivers/cpufreq/Kconfig.arm -@@ -220,6 +220,15 @@ config ARM_STI_CPUFREQ - this config option if you wish to add CPUFreq support for STi based - SoCs. - -+config ARM_BCM2835_CPUFREQ -+ depends on RASPBERRYPI_FIRMWARE -+ bool "BCM2835 Driver" -+ default y -+ help -+ This adds the CPUFreq driver for BCM2835 -+ -+ If in doubt, say N. -+ - config ARM_TEGRA20_CPUFREQ - bool "Tegra20 CPUFreq support" - depends on ARCH_TEGRA -diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile -index 0a9b6a093646bd1dd60ee092e362b24527f0ef1e..92a628a670c12c39c2be73fc91f65da5fdafd397 100644 ---- a/drivers/cpufreq/Makefile -+++ b/drivers/cpufreq/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o - obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o - obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o - obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o -+obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o - obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o - obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o - obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o -diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c -new file mode 100644 -index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a ---- /dev/null -+++ b/drivers/cpufreq/bcm2835-cpufreq.c -@@ -0,0 +1,218 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+/***************************************************************************** -+* FILENAME: bcm2835-cpufreq.h -+* DESCRIPTION: This driver dynamically manages the CPU Frequency of the ARM -+* processor. Messages are sent to Videocore either setting or requesting the -+* frequency of the ARM in order to match an appropiate frequency to the current -+* usage of the processor. The policy which selects the frequency to use is -+* defined in the kernel .config file, but can be changed during runtime. -+*****************************************************************************/ -+ -+/* ---------- INCLUDES ---------- */ -+#include -+#include -+#include -+#include -+#include -+ -+/* ---------- DEFINES ---------- */ -+/*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ -+#define MODULE_NAME "bcm2835-cpufreq" -+ -+#define VCMSG_ID_ARM_CLOCK 0x000000003 /* Clock/Voltage ID's */ -+ -+/* debug printk macros */ -+#ifdef CPUFREQ_DEBUG_ENABLE -+#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) -+#else -+#define print_debug(fmt,...) -+#endif -+#define print_err(fmt,...) pr_err("%s:%s:%d: "fmt, MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) -+#define print_info(fmt,...) pr_info("%s: "fmt, MODULE_NAME, ##__VA_ARGS__) -+ -+/* ---------- GLOBALS ---------- */ -+static struct cpufreq_driver bcm2835_cpufreq_driver; /* the cpufreq driver global */ -+static unsigned int min_frequency, max_frequency; -+static struct cpufreq_frequency_table bcm2835_freq_table[3]; -+ -+/* -+ =============================================== -+ clk_rate either gets or sets the clock rates. -+ =============================================== -+*/ -+ -+static int bcm2835_cpufreq_clock_property(u32 tag, u32 id, u32 *val) -+{ -+ struct rpi_firmware *fw = rpi_firmware_get(NULL); -+ struct { -+ u32 id; -+ u32 val; -+ } packet; -+ int ret; -+ -+ packet.id = id; -+ packet.val = *val; -+ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); -+ if (ret) -+ return ret; -+ -+ *val = packet.val; -+ -+ return 0; -+} -+ -+static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) -+{ -+ u32 rate = arm_rate * 1000; -+ int ret; -+ -+ ret = bcm2835_cpufreq_clock_property(RPI_FIRMWARE_SET_CLOCK_RATE, VCMSG_ID_ARM_CLOCK, &rate); -+ if (ret) { -+ print_err("Failed to set clock: %d (%d)\n", arm_rate, ret); -+ return 0; -+ } -+ -+ rate /= 1000; -+ print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, rate); -+ -+ return rate; -+} -+ -+static uint32_t bcm2835_cpufreq_get_clock(int tag) -+{ -+ u32 rate; -+ int ret; -+ -+ ret = bcm2835_cpufreq_clock_property(tag, VCMSG_ID_ARM_CLOCK, &rate); -+ if (ret) { -+ print_err("Failed to get clock (%d)\n", ret); -+ return 0; -+ } -+ -+ rate /= 1000; -+ print_debug("%s frequency = %u\n", -+ tag == RPI_FIRMWARE_GET_CLOCK_RATE ? "Current": -+ tag == RPI_FIRMWARE_GET_MIN_CLOCK_RATE ? "Min": -+ tag == RPI_FIRMWARE_GET_MAX_CLOCK_RATE ? "Max": -+ "Unexpected", rate); -+ -+ return rate; -+} -+ -+/* -+ ==================================================== -+ Module Initialisation registers the cpufreq driver -+ ==================================================== -+*/ -+static int __init bcm2835_cpufreq_module_init(void) -+{ -+ print_debug("IN\n"); -+ return cpufreq_register_driver(&bcm2835_cpufreq_driver); -+} -+ -+/* -+ ============= -+ Module exit -+ ============= -+*/ -+static void __exit bcm2835_cpufreq_module_exit(void) -+{ -+ print_debug("IN\n"); -+ cpufreq_unregister_driver(&bcm2835_cpufreq_driver); -+ return; -+} -+ -+/* -+ ============================================================== -+ Initialisation function sets up the CPU policy for first use -+ ============================================================== -+*/ -+static int bcm2835_cpufreq_driver_init(struct cpufreq_policy *policy) -+{ -+ /* measured value of how long it takes to change frequency */ -+ const unsigned int transition_latency = 355000; /* ns */ -+ -+ if (!rpi_firmware_get(NULL)) { -+ print_err("Firmware is not available\n"); -+ return -ENODEV; -+ } -+ -+ /* now find out what the maximum and minimum frequencies are */ -+ min_frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MIN_CLOCK_RATE); -+ max_frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MAX_CLOCK_RATE); -+ -+ if (min_frequency == max_frequency) { -+ bcm2835_freq_table[0].frequency = min_frequency; -+ bcm2835_freq_table[1].frequency = CPUFREQ_TABLE_END; -+ } else { -+ bcm2835_freq_table[0].frequency = min_frequency; -+ bcm2835_freq_table[1].frequency = max_frequency; -+ bcm2835_freq_table[2].frequency = CPUFREQ_TABLE_END; -+ } -+ -+ print_info("min=%d max=%d\n", min_frequency, max_frequency); -+ return cpufreq_generic_init(policy, bcm2835_freq_table, transition_latency); -+} -+ -+/* -+ ===================================================================== -+ Target index function chooses the requested frequency from the table -+ ===================================================================== -+*/ -+ -+static int bcm2835_cpufreq_driver_target_index(struct cpufreq_policy *policy, unsigned int state) -+{ -+ unsigned int target_freq = state == 0 ? min_frequency : max_frequency; -+ unsigned int cur = bcm2835_cpufreq_set_clock(policy->cur, target_freq); -+ -+ if (!cur) -+ { -+ print_err("Error occurred setting a new frequency (%d)\n", target_freq); -+ return -EINVAL; -+ } -+ print_debug("%s: %i: freq %d->%d\n", policy->governor->name, state, policy->cur, cur); -+ return 0; -+} -+ -+/* -+ ====================================================== -+ Get function returns the current frequency from table -+ ====================================================== -+*/ -+ -+static unsigned int bcm2835_cpufreq_driver_get(unsigned int cpu) -+{ -+ unsigned int actual_rate = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_CLOCK_RATE); -+ print_debug("cpu%d: freq=%d\n", cpu, actual_rate); -+ return actual_rate <= min_frequency ? min_frequency : max_frequency; -+} -+ -+/* the CPUFreq driver */ -+static struct cpufreq_driver bcm2835_cpufreq_driver = { -+ .name = "BCM2835 CPUFreq", -+ .init = bcm2835_cpufreq_driver_init, -+ .verify = cpufreq_generic_frequency_table_verify, -+ .target_index = bcm2835_cpufreq_driver_target_index, -+ .get = bcm2835_cpufreq_driver_get, -+ .attr = cpufreq_generic_attr, -+}; -+ -+MODULE_AUTHOR("Dorian Peake and Dom Cobley"); -+MODULE_DESCRIPTION("CPU frequency driver for BCM2835 chip"); -+MODULE_LICENSE("GPL"); -+ -+module_init(bcm2835_cpufreq_module_init); -+module_exit(bcm2835_cpufreq_module_exit); - -From 478277f128dbdcbea6394c4744ada90fce9ab66e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 047/122] Added hwmon/thermal driver for reporting core - temperature. Thanks Dorian -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM270x: Move thermal sensor to Device Tree - -Add Device Tree support to bcm2835-thermal driver. -Add thermal sensor device to Device Tree. -Don't add platform device when booting in DT mode. - -Signed-off-by: Noralf Trønnes ---- - drivers/thermal/Kconfig | 7 +++ - drivers/thermal/Makefile | 1 + - drivers/thermal/bcm2835-thermal.c | 109 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 117 insertions(+) - create mode 100644 drivers/thermal/bcm2835-thermal.c - -diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig -index a13541bdc726899807dd8723c92c21312fbc6439..de45ea51555e5f47498c18a969751ea6dc52d6b9 100644 ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -302,6 +302,13 @@ config INTEL_POWERCLAMP - enforce idle time which results in more package C-state residency. The - user interface is exposed via generic thermal framework. - -+config THERMAL_BCM2835 -+ depends on RASPBERRYPI_FIRMWARE -+ tristate "BCM2835 Thermal Driver" -+ help -+ This will enable temperature monitoring for the Broadcom BCM2835 -+ chip. If built as a module, it will be called 'bcm2835-thermal'. -+ - config X86_PKG_TEMP_THERMAL - tristate "X86 package temperature thermal driver" - depends on X86_THERMAL_VECTOR -diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile -index c92eb22a41ff89f3f1c61c61977de7eb9ba516ae..bcf9e7503c940821ca260774ba9e1cebf185cd3e 100644 ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -41,6 +41,7 @@ obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o - obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o - obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o - obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o -+obj-$(CONFIG_THERMAL_BCM2835) += bcm2835-thermal.o - obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o - obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o - obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o -diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c63fb9f9d143e19612a18fe530c7b2b3518a22a4 ---- /dev/null -+++ b/drivers/thermal/bcm2835-thermal.c -@@ -0,0 +1,109 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+ -+static int bcm2835_thermal_get_property(struct thermal_zone_device *tz, -+ int *temp, u32 tag) -+{ -+ struct rpi_firmware *fw = tz->devdata; -+ struct { -+ u32 id; -+ u32 val; -+ } packet; -+ int ret; -+ -+ *temp = 0; -+ packet.id = 0; -+ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); -+ if (ret) { -+ dev_err(&tz->device, "Failed to get temperature\n"); -+ return ret; -+ } -+ -+ *temp = packet.val; -+ dev_dbg(&tz->device, "%stemp=%d\n", -+ tag == RPI_FIRMWARE_GET_MAX_TEMPERATURE ? "max" : "", *temp); -+ -+ return 0; -+} -+ -+static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, -+ int *temp) -+{ -+ return bcm2835_thermal_get_property(tz, temp, -+ RPI_FIRMWARE_GET_TEMPERATURE); -+} -+ -+static struct thermal_zone_device_ops ops = { -+ .get_temp = bcm2835_thermal_get_temp, -+}; -+ -+static int bcm2835_thermal_probe(struct platform_device *pdev) -+{ -+ struct device_node *fw_np; -+ struct rpi_firmware *fw; -+ struct thermal_zone_device *tz; -+ -+ fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_np) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ fw = rpi_firmware_get(fw_np); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ tz = thermal_zone_device_register("bcm2835_thermal", 0, 0, fw, &ops, -+ NULL, 0, 0); -+ if (IS_ERR(tz)) { -+ dev_err(&pdev->dev, "Failed to register the thermal device\n"); -+ return PTR_ERR(tz); -+ } -+ -+ platform_set_drvdata(pdev, tz); -+ -+ return 0; -+} -+ -+static int bcm2835_thermal_remove(struct platform_device *pdev) -+{ -+ thermal_zone_device_unregister(platform_get_drvdata(pdev)); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm2835_thermal_of_match_table[] = { -+ { .compatible = "brcm,bcm2835-thermal", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); -+ -+static struct platform_driver bcm2835_thermal_driver = { -+ .probe = bcm2835_thermal_probe, -+ .remove = bcm2835_thermal_remove, -+ .driver = { -+ .name = "bcm2835_thermal", -+ .of_match_table = bcm2835_thermal_of_match_table, -+ }, -+}; -+module_platform_driver(bcm2835_thermal_driver); -+ -+MODULE_AUTHOR("Dorian Peake"); -+MODULE_AUTHOR("Noralf Trønnes"); -+MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); -+MODULE_LICENSE("GPL"); - -From aaac339b97bfcc6a67fd3f51400d87fc2ff00198 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 048/122] Add Chris Boot's i2c driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -i2c-bcm2708: fixed baudrate - -Fixed issue where the wrong CDIV value was set for baudrates below 3815 Hz (for 250MHz bus clock). -In that case the computed CDIV value was more than 0xffff. However the CDIV register width is only 16 bits. -This resulted in incorrect setting of CDIV and higher baudrate than intended. -Example: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0x1704 -> 42430Hz -After correction: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0xffff -> 3815Hz -The correct baudrate is shown in the log after the cdiv > 0xffff correction. - -Perform I2C combined transactions when possible - -Perform I2C combined transactions whenever possible, within the -restrictions of the Broadcomm Serial Controller. - -Disable DONE interrupt during TA poll - -Prevent interrupt from being triggered if poll is missed and transfer -starts and finishes. - -i2c: Make combined transactions optional and disabled by default - -i2c: bcm2708: add device tree support - -Add DT support to driver and add to .dtsi file. -Setup pins in .dts file. -i2c is disabled by default. - -Signed-off-by: Noralf Tronnes - -bcm2708: don't register i2c controllers when using DT - -The devices for the i2c controllers are in the Device Tree. -Only register devices when not using DT. - -Signed-off-by: Noralf Tronnes - -I2C: Only register the I2C device for the current board revision - -i2c_bcm2708: Fix clock reference counting - -Fix grabbing lock from atomic context in i2c driver - -2 main changes: -- check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: - /* poll for transfer start bit (should only take 1-20 polls) */ - This implies that the setup function can now fail so account for this everywhere it's called -- Removed the clk_get_rate call from inside the setup function as it locks a mutex and that's not ok since we call it from under a spin lock. - -i2c-bcm2708: When using DT, leave the GPIO setup to pinctrl - -i2c-bcm2708: Increase timeouts to allow larger transfers - -Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting -for completion. The default timeout is 1 second. - -See: https://github.com/raspberrypi/linux/issues/260 - -i2c-bcm2708/BCM270X_DT: Add support for I2C2 - -The third I2C bus (I2C2) is normally reserved for HDMI use. Careless -use of this bus can break an attached display - use with caution. - -It is recommended to disable accesses by VideoCore by setting -hdmi_ignore_edid=1 or hdmi_edid_file=1 in config.txt. - -The interface is disabled by default - enable using the -i2c2_iknowwhatimdoing DT parameter. - -bcm2708-spi: Don't use static pin configuration with DT - -Also remove superfluous error checking - the SPI framework ensures the -validity of the chip_select value. - -i2c-bcm2708: Remove non-DT support - -Signed-off-by: Noralf Trønnes - -Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs. - -Fixes i2c_bcm2708: Write to FIFO correctly - v2 (#1574) - -* i2c: fix i2c_bcm2708: Clear FIFO before sending data - -Make sure FIFO gets cleared before trying to send -data in case of a repeated start (COMBINED=Y). - -* i2c: fix i2c_bcm2708: Only write to FIFO when not full - -Check if FIFO can accept data before writing. -To avoid a peripheral read on the last iteration of a loop, -both bcm2708_bsc_fifo_fill and ~drain are changed as well. ---- - drivers/i2c/busses/Kconfig | 19 ++ - drivers/i2c/busses/Makefile | 2 + - drivers/i2c/busses/i2c-bcm2708.c | 512 +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 533 insertions(+) - create mode 100644 drivers/i2c/busses/i2c-bcm2708.c - -diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index d252276feadf6b0b05cbe370330ed7cef5a16857..b81d8133639a34dcec85df50f064d8e9a9ba22fa 100644 ---- a/drivers/i2c/busses/Kconfig -+++ b/drivers/i2c/busses/Kconfig -@@ -8,6 +8,25 @@ menu "I2C Hardware Bus support" - comment "PC SMBus host controller drivers" - depends on PCI - -+config I2C_BCM2708 -+ tristate "BCM2708 BSC" -+ depends on ARCH_BCM2835 -+ help -+ Enabling this option will add BSC (Broadcom Serial Controller) -+ support for the BCM2708. BSC is a Broadcom proprietary bus compatible -+ with I2C/TWI/SMBus. -+ -+config I2C_BCM2708_BAUDRATE -+ prompt "BCM2708 I2C baudrate" -+ depends on I2C_BCM2708 -+ int -+ default 100000 -+ help -+ Set the I2C baudrate. This will alter the default value. A -+ different baudrate can be set by using a module parameter as well. If -+ no parameter is provided when loading, this is the value that will be -+ used. -+ - config I2C_ALI1535 - tristate "ALI 1535" - depends on PCI -diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile -index 29764cc20a440752841272ddfed3993048ecd105..26ae016a15e72cbb2e742aa89238636e3b846b8e 100644 ---- a/drivers/i2c/busses/Makefile -+++ b/drivers/i2c/busses/Makefile -@@ -2,6 +2,8 @@ - # Makefile for the i2c bus drivers. - # - -+obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o -+ - # ACPI drivers - obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o - -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -new file mode 100644 -index 0000000000000000000000000000000000000000..962f2e5c7455d91bf32925d785f5f16b83b049f8 ---- /dev/null -+++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -0,0 +1,512 @@ -+/* -+ * Driver for Broadcom BCM2708 BSC Controllers -+ * -+ * Copyright (C) 2012 Chris Boot & Frank Buss -+ * -+ * This driver is inspired by: -+ * i2c-ocores.c, by Peter Korsgaard -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* BSC register offsets */ -+#define BSC_C 0x00 -+#define BSC_S 0x04 -+#define BSC_DLEN 0x08 -+#define BSC_A 0x0c -+#define BSC_FIFO 0x10 -+#define BSC_DIV 0x14 -+#define BSC_DEL 0x18 -+#define BSC_CLKT 0x1c -+ -+/* Bitfields in BSC_C */ -+#define BSC_C_I2CEN 0x00008000 -+#define BSC_C_INTR 0x00000400 -+#define BSC_C_INTT 0x00000200 -+#define BSC_C_INTD 0x00000100 -+#define BSC_C_ST 0x00000080 -+#define BSC_C_CLEAR_1 0x00000020 -+#define BSC_C_CLEAR_2 0x00000010 -+#define BSC_C_READ 0x00000001 -+ -+/* Bitfields in BSC_S */ -+#define BSC_S_CLKT 0x00000200 -+#define BSC_S_ERR 0x00000100 -+#define BSC_S_RXF 0x00000080 -+#define BSC_S_TXE 0x00000040 -+#define BSC_S_RXD 0x00000020 -+#define BSC_S_TXD 0x00000010 -+#define BSC_S_RXR 0x00000008 -+#define BSC_S_TXW 0x00000004 -+#define BSC_S_DONE 0x00000002 -+#define BSC_S_TA 0x00000001 -+ -+#define I2C_WAIT_LOOP_COUNT 200 -+ -+#define DRV_NAME "bcm2708_i2c" -+ -+static unsigned int baudrate; -+module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(baudrate, "The I2C baudrate"); -+ -+static bool combined = false; -+module_param(combined, bool, 0644); -+MODULE_PARM_DESC(combined, "Use combined transactions"); -+ -+struct bcm2708_i2c { -+ struct i2c_adapter adapter; -+ -+ spinlock_t lock; -+ void __iomem *base; -+ int irq; -+ struct clk *clk; -+ u32 cdiv; -+ u32 clk_tout; -+ -+ struct completion done; -+ -+ struct i2c_msg *msg; -+ int pos; -+ int nmsgs; -+ bool error; -+}; -+ -+static inline u32 bcm2708_rd(struct bcm2708_i2c *bi, unsigned reg) -+{ -+ return readl(bi->base + reg); -+} -+ -+static inline void bcm2708_wr(struct bcm2708_i2c *bi, unsigned reg, u32 val) -+{ -+ writel(val, bi->base + reg); -+} -+ -+static inline void bcm2708_bsc_reset(struct bcm2708_i2c *bi) -+{ -+ bcm2708_wr(bi, BSC_C, 0); -+ bcm2708_wr(bi, BSC_S, BSC_S_CLKT | BSC_S_ERR | BSC_S_DONE); -+} -+ -+static inline void bcm2708_bsc_fifo_drain(struct bcm2708_i2c *bi) -+{ -+ while ((bi->pos < bi->msg->len) && (bcm2708_rd(bi, BSC_S) & BSC_S_RXD)) -+ bi->msg->buf[bi->pos++] = bcm2708_rd(bi, BSC_FIFO); -+} -+ -+static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) -+{ -+ while ((bi->pos < bi->msg->len) && (bcm2708_rd(bi, BSC_S) & BSC_S_TXD)) -+ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); -+} -+ -+static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) -+{ -+ u32 cdiv, s, clk_tout; -+ u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; -+ int wait_loops = I2C_WAIT_LOOP_COUNT; -+ -+ /* Can't call clk_get_rate as it locks a mutex and here we are spinlocked. -+ * Use the value that we cached in the probe. -+ */ -+ cdiv = bi->cdiv; -+ clk_tout = bi->clk_tout; -+ -+ if (bi->msg->flags & I2C_M_RD) -+ c |= BSC_C_INTR | BSC_C_READ; -+ else -+ c |= BSC_C_INTT; -+ -+ bcm2708_wr(bi, BSC_CLKT, clk_tout); -+ bcm2708_wr(bi, BSC_DIV, cdiv); -+ bcm2708_wr(bi, BSC_A, bi->msg->addr); -+ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); -+ if (combined) -+ { -+ /* Do the next two messages meet combined transaction criteria? -+ - Current message is a write, next message is a read -+ - Both messages to same slave address -+ - Write message can fit inside FIFO (16 bytes or less) */ -+ if ( (bi->nmsgs > 1) && -+ !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) && -+ (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) { -+ -+ /* Clear FIFO */ -+ bcm2708_wr(bi, BSC_C, BSC_C_CLEAR_1); -+ -+ /* Fill FIFO with entire write message (16 byte FIFO) */ -+ while (bi->pos < bi->msg->len) { -+ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); -+ } -+ /* Start write transfer (no interrupts, don't clear FIFO) */ -+ bcm2708_wr(bi, BSC_C, BSC_C_I2CEN | BSC_C_ST); -+ -+ /* poll for transfer start bit (should only take 1-20 polls) */ -+ do { -+ s = bcm2708_rd(bi, BSC_S); -+ } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)) && --wait_loops >= 0); -+ -+ /* did we time out or some error occured? */ -+ if (wait_loops < 0 || (s & (BSC_S_ERR | BSC_S_CLKT))) { -+ return -1; -+ } -+ -+ /* Send next read message before the write transfer finishes. */ -+ bi->nmsgs--; -+ bi->msg++; -+ bi->pos = 0; -+ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); -+ c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_INTR | BSC_C_ST | BSC_C_READ; -+ } -+ } -+ bcm2708_wr(bi, BSC_C, c); -+ -+ return 0; -+} -+ -+static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) -+{ -+ struct bcm2708_i2c *bi = dev_id; -+ bool handled = true; -+ u32 s; -+ int ret; -+ -+ spin_lock(&bi->lock); -+ -+ /* we may see camera interrupts on the "other" I2C channel -+ Just return if we've not sent anything */ -+ if (!bi->nmsgs || !bi->msg) { -+ goto early_exit; -+ } -+ -+ s = bcm2708_rd(bi, BSC_S); -+ -+ if (s & (BSC_S_CLKT | BSC_S_ERR)) { -+ bcm2708_bsc_reset(bi); -+ bi->error = true; -+ -+ bi->msg = 0; /* to inform the that all work is done */ -+ bi->nmsgs = 0; -+ /* wake up our bh */ -+ complete(&bi->done); -+ } else if (s & BSC_S_DONE) { -+ bi->nmsgs--; -+ -+ if (bi->msg->flags & I2C_M_RD) { -+ bcm2708_bsc_fifo_drain(bi); -+ } -+ -+ bcm2708_bsc_reset(bi); -+ -+ if (bi->nmsgs) { -+ /* advance to next message */ -+ bi->msg++; -+ bi->pos = 0; -+ ret = bcm2708_bsc_setup(bi); -+ if (ret < 0) { -+ bcm2708_bsc_reset(bi); -+ bi->error = true; -+ bi->msg = 0; /* to inform the that all work is done */ -+ bi->nmsgs = 0; -+ /* wake up our bh */ -+ complete(&bi->done); -+ goto early_exit; -+ } -+ } else { -+ bi->msg = 0; /* to inform the that all work is done */ -+ bi->nmsgs = 0; -+ /* wake up our bh */ -+ complete(&bi->done); -+ } -+ } else if (s & BSC_S_TXW) { -+ bcm2708_bsc_fifo_fill(bi); -+ } else if (s & BSC_S_RXR) { -+ bcm2708_bsc_fifo_drain(bi); -+ } else { -+ handled = false; -+ } -+ -+early_exit: -+ spin_unlock(&bi->lock); -+ -+ return handled ? IRQ_HANDLED : IRQ_NONE; -+} -+ -+static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap, -+ struct i2c_msg *msgs, int num) -+{ -+ struct bcm2708_i2c *bi = adap->algo_data; -+ unsigned long flags; -+ int ret; -+ -+ spin_lock_irqsave(&bi->lock, flags); -+ -+ reinit_completion(&bi->done); -+ bi->msg = msgs; -+ bi->pos = 0; -+ bi->nmsgs = num; -+ bi->error = false; -+ -+ ret = bcm2708_bsc_setup(bi); -+ -+ spin_unlock_irqrestore(&bi->lock, flags); -+ -+ /* check the result of the setup */ -+ if (ret < 0) -+ { -+ dev_err(&adap->dev, "transfer setup timed out\n"); -+ goto error_timeout; -+ } -+ -+ ret = wait_for_completion_timeout(&bi->done, adap->timeout); -+ if (ret == 0) { -+ dev_err(&adap->dev, "transfer timed out\n"); -+ goto error_timeout; -+ } -+ -+ ret = bi->error ? -EIO : num; -+ return ret; -+ -+error_timeout: -+ spin_lock_irqsave(&bi->lock, flags); -+ bcm2708_bsc_reset(bi); -+ bi->msg = 0; /* to inform the interrupt handler that there's nothing else to be done */ -+ bi->nmsgs = 0; -+ spin_unlock_irqrestore(&bi->lock, flags); -+ return -ETIMEDOUT; -+} -+ -+static u32 bcm2708_i2c_functionality(struct i2c_adapter *adap) -+{ -+ return I2C_FUNC_I2C | /*I2C_FUNC_10BIT_ADDR |*/ I2C_FUNC_SMBUS_EMUL; -+} -+ -+static struct i2c_algorithm bcm2708_i2c_algorithm = { -+ .master_xfer = bcm2708_i2c_master_xfer, -+ .functionality = bcm2708_i2c_functionality, -+}; -+ -+static int bcm2708_i2c_probe(struct platform_device *pdev) -+{ -+ struct resource *regs; -+ int irq, err = -ENOMEM; -+ struct clk *clk; -+ struct bcm2708_i2c *bi; -+ struct i2c_adapter *adap; -+ unsigned long bus_hz; -+ u32 cdiv, clk_tout; -+ u32 baud; -+ -+ baud = CONFIG_I2C_BCM2708_BAUDRATE; -+ -+ if (pdev->dev.of_node) { -+ u32 bus_clk_rate; -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -+ if (pdev->id < 0) { -+ dev_err(&pdev->dev, "alias is missing\n"); -+ return -EINVAL; -+ } -+ if (!of_property_read_u32(pdev->dev.of_node, -+ "clock-frequency", &bus_clk_rate)) -+ baud = bus_clk_rate; -+ else -+ dev_warn(&pdev->dev, -+ "Could not read clock-frequency property\n"); -+ } -+ -+ if (baudrate) -+ baud = baudrate; -+ -+ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!regs) { -+ dev_err(&pdev->dev, "could not get IO memory\n"); -+ return -ENXIO; -+ } -+ -+ irq = platform_get_irq(pdev, 0); -+ if (irq < 0) { -+ dev_err(&pdev->dev, "could not get IRQ\n"); -+ return irq; -+ } -+ -+ clk = clk_get(&pdev->dev, NULL); -+ if (IS_ERR(clk)) { -+ dev_err(&pdev->dev, "could not find clk: %ld\n", PTR_ERR(clk)); -+ return PTR_ERR(clk); -+ } -+ -+ err = clk_prepare_enable(clk); -+ if (err) { -+ dev_err(&pdev->dev, "could not enable clk: %d\n", err); -+ goto out_clk_put; -+ } -+ -+ bi = kzalloc(sizeof(*bi), GFP_KERNEL); -+ if (!bi) -+ goto out_clk_disable; -+ -+ platform_set_drvdata(pdev, bi); -+ -+ adap = &bi->adapter; -+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DDC; -+ adap->algo = &bcm2708_i2c_algorithm; -+ adap->algo_data = bi; -+ adap->dev.parent = &pdev->dev; -+ adap->nr = pdev->id; -+ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); -+ adap->dev.of_node = pdev->dev.of_node; -+ -+ switch (pdev->id) { -+ case 0: -+ adap->class = I2C_CLASS_HWMON; -+ break; -+ case 1: -+ adap->class = I2C_CLASS_DDC; -+ break; -+ case 2: -+ adap->class = I2C_CLASS_DDC; -+ break; -+ default: -+ dev_err(&pdev->dev, "can only bind to BSC 0, 1 or 2\n"); -+ err = -ENXIO; -+ goto out_free_bi; -+ } -+ -+ spin_lock_init(&bi->lock); -+ init_completion(&bi->done); -+ -+ bi->base = ioremap(regs->start, resource_size(regs)); -+ if (!bi->base) { -+ dev_err(&pdev->dev, "could not remap memory\n"); -+ goto out_free_bi; -+ } -+ -+ bi->irq = irq; -+ bi->clk = clk; -+ -+ err = request_irq(irq, bcm2708_i2c_interrupt, IRQF_SHARED, -+ dev_name(&pdev->dev), bi); -+ if (err) { -+ dev_err(&pdev->dev, "could not request IRQ: %d\n", err); -+ goto out_iounmap; -+ } -+ -+ bcm2708_bsc_reset(bi); -+ -+ err = i2c_add_numbered_adapter(adap); -+ if (err < 0) { -+ dev_err(&pdev->dev, "could not add I2C adapter: %d\n", err); -+ goto out_free_irq; -+ } -+ -+ bus_hz = clk_get_rate(bi->clk); -+ cdiv = bus_hz / baud; -+ if (cdiv > 0xffff) { -+ cdiv = 0xffff; -+ baud = bus_hz / cdiv; -+ } -+ -+ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. -+ if (clk_tout > 0xffff) -+ clk_tout = 0xffff; -+ -+ bi->cdiv = cdiv; -+ bi->clk_tout = clk_tout; -+ -+ dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", -+ pdev->id, (unsigned long)regs->start, irq, baud); -+ -+ return 0; -+ -+out_free_irq: -+ free_irq(bi->irq, bi); -+out_iounmap: -+ iounmap(bi->base); -+out_free_bi: -+ kfree(bi); -+out_clk_disable: -+ clk_disable_unprepare(clk); -+out_clk_put: -+ clk_put(clk); -+ return err; -+} -+ -+static int bcm2708_i2c_remove(struct platform_device *pdev) -+{ -+ struct bcm2708_i2c *bi = platform_get_drvdata(pdev); -+ -+ platform_set_drvdata(pdev, NULL); -+ -+ i2c_del_adapter(&bi->adapter); -+ free_irq(bi->irq, bi); -+ iounmap(bi->base); -+ clk_disable_unprepare(bi->clk); -+ clk_put(bi->clk); -+ kfree(bi); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm2708_i2c_of_match[] = { -+ { .compatible = "brcm,bcm2708-i2c" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2708_i2c_of_match); -+ -+static struct platform_driver bcm2708_i2c_driver = { -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2708_i2c_of_match, -+ }, -+ .probe = bcm2708_i2c_probe, -+ .remove = bcm2708_i2c_remove, -+}; -+ -+// module_platform_driver(bcm2708_i2c_driver); -+ -+ -+static int __init bcm2708_i2c_init(void) -+{ -+ return platform_driver_register(&bcm2708_i2c_driver); -+} -+ -+static void __exit bcm2708_i2c_exit(void) -+{ -+ platform_driver_unregister(&bcm2708_i2c_driver); -+} -+ -+module_init(bcm2708_i2c_init); -+module_exit(bcm2708_i2c_exit); -+ -+ -+ -+MODULE_DESCRIPTION("BSC controller driver for Broadcom BCM2708"); -+MODULE_AUTHOR("Chris Boot "); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:" DRV_NAME); - -From fa468e89c790f2e432205e3b16d26e5365d98ec7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 049/122] char: broadcom: Add vcio module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add module for accessing the mailbox property channel through -/dev/vcio. Was previously in bcm2708-vcio. - -Signed-off-by: Noralf Trønnes ---- - drivers/char/broadcom/Kconfig | 6 ++ - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 182 insertions(+) - create mode 100644 drivers/char/broadcom/vcio.c - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index f7885466f5bf9c0cf45f2057d07a0d24151f10c3..032164919350db25c586c36f0e05d3e4891fb835 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -22,6 +22,12 @@ config BCM2708_VCMEM - help - Helper for videocore memory access and total size allocation. - -+config BCM_VCIO -+ tristate "Mailbox userspace access" -+ depends on BCM2835_MBOX -+ help -+ Gives access to the mailbox property channel from userspace. -+ - endif - - config BCM_VC_SM -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index 667d33ef38f3512b52818537c11d369798b6f1c0..14775c9b20b4b6a58f681f3687614676b5e2a871 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1,5 +1,6 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ - obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -+obj-$(CONFIG_BCM_VCIO) += vcio.o - obj-$(CONFIG_BCM_VC_SM) += vc_sm/ - - obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o -diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c19bc2075c77879563ef5e59038b5a140fe5aba0 ---- /dev/null -+++ b/drivers/char/broadcom/vcio.c -@@ -0,0 +1,175 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * Copyright (C) 2015 Noralf Trønnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define MBOX_CHAN_PROPERTY 8 -+ -+#define VCIO_IOC_MAGIC 100 -+#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) -+ -+static struct { -+ dev_t devt; -+ struct cdev cdev; -+ struct class *class; -+ struct rpi_firmware *fw; -+} vcio; -+ -+static int vcio_user_property_list(void *user) -+{ -+ u32 *buf, size; -+ int ret; -+ -+ /* The first 32-bit is the size of the buffer */ -+ if (copy_from_user(&size, user, sizeof(size))) -+ return -EFAULT; -+ -+ buf = kmalloc(size, GFP_KERNEL); -+ if (!buf) -+ return -ENOMEM; -+ -+ if (copy_from_user(buf, user, size)) { -+ kfree(buf); -+ return -EFAULT; -+ } -+ -+ /* Strip off protocol encapsulation */ -+ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); -+ if (ret) { -+ kfree(buf); -+ return ret; -+ } -+ -+ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; -+ if (copy_to_user(user, buf, size)) -+ ret = -EFAULT; -+ -+ kfree(buf); -+ -+ return ret; -+} -+ -+static int vcio_device_open(struct inode *inode, struct file *file) -+{ -+ try_module_get(THIS_MODULE); -+ -+ return 0; -+} -+ -+static int vcio_device_release(struct inode *inode, struct file *file) -+{ -+ module_put(THIS_MODULE); -+ -+ return 0; -+} -+ -+static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, -+ unsigned long ioctl_param) -+{ -+ switch (ioctl_num) { -+ case IOCTL_MBOX_PROPERTY: -+ return vcio_user_property_list((void *)ioctl_param); -+ default: -+ pr_err("unknown ioctl: %d\n", ioctl_num); -+ return -EINVAL; -+ } -+} -+ -+const struct file_operations vcio_fops = { -+ .unlocked_ioctl = vcio_device_ioctl, -+ .open = vcio_device_open, -+ .release = vcio_device_release, -+}; -+ -+static int __init vcio_init(void) -+{ -+ struct device_node *np; -+ static struct device *dev; -+ int ret; -+ -+ np = of_find_compatible_node(NULL, NULL, -+ "raspberrypi,bcm2835-firmware"); -+/* Uncomment this when we only boot with Device Tree -+ if (!of_device_is_available(np)) -+ return -ENODEV; -+*/ -+ vcio.fw = rpi_firmware_get(np); -+ if (!vcio.fw) -+ return -ENODEV; -+ -+ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); -+ if (ret) { -+ pr_err("failed to allocate device number\n"); -+ return ret; -+ } -+ -+ cdev_init(&vcio.cdev, &vcio_fops); -+ vcio.cdev.owner = THIS_MODULE; -+ ret = cdev_add(&vcio.cdev, vcio.devt, 1); -+ if (ret) { -+ pr_err("failed to register device\n"); -+ goto err_unregister_chardev; -+ } -+ -+ /* -+ * Create sysfs entries -+ * 'bcm2708_vcio' is used for backwards compatibility so we don't break -+ * userspace. Raspian has a udev rule that changes the permissions. -+ */ -+ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); -+ if (IS_ERR(vcio.class)) { -+ ret = PTR_ERR(vcio.class); -+ pr_err("failed to create class\n"); -+ goto err_cdev_del; -+ } -+ -+ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); -+ if (IS_ERR(dev)) { -+ ret = PTR_ERR(dev); -+ pr_err("failed to create device\n"); -+ goto err_class_destroy; -+ } -+ -+ return 0; -+ -+err_class_destroy: -+ class_destroy(vcio.class); -+err_cdev_del: -+ cdev_del(&vcio.cdev); -+err_unregister_chardev: -+ unregister_chrdev_region(vcio.devt, 1); -+ -+ return ret; -+} -+module_init(vcio_init); -+ -+static void __exit vcio_exit(void) -+{ -+ device_destroy(vcio.class, vcio.devt); -+ class_destroy(vcio.class); -+ cdev_del(&vcio.cdev); -+ unregister_chrdev_region(vcio.devt, 1); -+} -+module_exit(vcio_exit); -+ -+MODULE_AUTHOR("Gray Girling"); -+MODULE_AUTHOR("Noralf Trønnes"); -+MODULE_DESCRIPTION("Mailbox userspace access"); -+MODULE_LICENSE("GPL"); - -From 83532363df9ebe5f7e8cea458bcfd9b67a0e815a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 050/122] firmware: bcm2835: Support ARCH_BCM270x -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Support booting without Device Tree. -Turn on USB power. -Load driver early because of lacking support for deferred probing -in many drivers. - -Signed-off-by: Noralf Trønnes - -firmware: bcm2835: Don't turn on USB power - -The raspberrypi-power driver is now used to turn on USB power. - -This partly reverts commit: -firmware: bcm2835: Support ARCH_BCM270x - -Signed-off-by: Noralf Trønnes ---- - drivers/firmware/raspberrypi.c | 19 +++++++++++++++++-- - 1 file changed, 17 insertions(+), 2 deletions(-) - -diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c -index dd506cd3a5b874f9e1acd07efb8cd151bb6145d1..3f070bd38a91511c986e3fb114b15bd4ac32634c 100644 ---- a/drivers/firmware/raspberrypi.c -+++ b/drivers/firmware/raspberrypi.c -@@ -28,6 +28,8 @@ struct rpi_firmware { - u32 enabled; - }; - -+static struct platform_device *g_pdev; -+ - static DEFINE_MUTEX(transaction_lock); - - static void response_callback(struct mbox_client *cl, void *msg) -@@ -207,6 +209,7 @@ static int rpi_firmware_probe(struct platform_device *pdev) - init_completion(&fw->c); - - platform_set_drvdata(pdev, fw); -+ g_pdev = pdev; - - rpi_firmware_print_firmware_revision(fw); - -@@ -218,6 +221,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) - struct rpi_firmware *fw = platform_get_drvdata(pdev); - - mbox_free_channel(fw->chan); -+ g_pdev = NULL; - - return 0; - } -@@ -230,7 +234,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) - */ - struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) - { -- struct platform_device *pdev = of_find_device_by_node(firmware_node); -+ struct platform_device *pdev = g_pdev; - - if (!pdev) - return NULL; -@@ -253,7 +257,18 @@ static struct platform_driver rpi_firmware_driver = { - .probe = rpi_firmware_probe, - .remove = rpi_firmware_remove, - }; --module_platform_driver(rpi_firmware_driver); -+ -+static int __init rpi_firmware_init(void) -+{ -+ return platform_driver_register(&rpi_firmware_driver); -+} -+subsys_initcall(rpi_firmware_init); -+ -+static void __init rpi_firmware_exit(void) -+{ -+ platform_driver_unregister(&rpi_firmware_driver); -+} -+module_exit(rpi_firmware_exit); - - MODULE_AUTHOR("Eric Anholt "); - MODULE_DESCRIPTION("Raspberry Pi firmware driver"); - -From c1316c3428ecf0ef0ad3c39a6ff7e367b3483c4f Mon Sep 17 00:00:00 2001 -From: Vincent Sanders -Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 051/122] bcm2835: add v4l2 camera device - -- Supports raw YUV capture, preview, JPEG and H264. -- Uses videobuf2 for data transfer, using dma_buf. -- Uses 3.6.10 timestamping -- Camera power based on use -- Uses immutable input mode on video encoder - -Signed-off-by: Daniel Stone -Signed-off-by: Luke Diamand - -V4L2: Fixes from 6by9 - -V4L2: Fix EV values. Add manual shutter speed control - -V4L2 EV values should be in units of 1/1000. Corrected. -Add support for V4L2_CID_EXPOSURE_ABSOLUTE which should -give manual shutter control. Requires manual exposure mode -to be selected first. - -Signed-off-by: Dave Stevenson - -V4L2: Correct JPEG Q-factor range - -Should be 1-100, not 0-100 - -Signed-off-by: Dave Stevenson - -V4L2: Fix issue of driver jamming if STREAMON failed. - -Fix issue where the driver was left in a partially enabled -state if STREAMON failed, and would then reject many IOCTLs -as it thought it was streaming. - -Signed-off-by: Dave Stevenson - -V4L2: Fix ISO controls. - -Driver was passing the index to the GPU, and not the desired -ISO value. - -Signed-off-by: Dave Stevenson - -V4L2: Add flicker avoidance controls - -Add support for V4L2_CID_POWER_LINE_FREQUENCY to set flicker -avoidance frequencies. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for frame rate control. - -Add support for frame rate (or time per frame as V4L2 -inverts it) control via s_parm. - -Signed-off-by: Dave Stevenson - -V4L2: Improve G_FBUF handling so we pass conformance - -Return some sane numbers for get framebuffer so that -we pass conformance. - -Signed-off-by: Dave Stevenson - -V4L2: Fix information advertised through g_vidfmt - -Width and height were being stored based on incorrect -values. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for inline H264 headers - -Add support for V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER -to control H264 inline headers. -Requires firmware fix to work correctly, otherwise format -has to be set to H264 before this parameter is set. - -Signed-off-by: Dave Stevenson - -V4L2: Fix JPEG timestamp issue - -JPEG images were coming through from the GPU with timestamp -of 0. Detect this and give current system time instead -of some invalid value. - -Signed-off-by: Dave Stevenson - -V4L2: Fix issue when switching down JPEG resolution. - -JPEG buffer size calculation is based on input resolution. -Input resolution was being configured after output port -format. Caused failures if switching from one JPEG resolution -to a smaller one. - -Signed-off-by: Dave Stevenson - -V4L2: Enable MJPEG encoding - -Requires GPU firmware update to support MJPEG encoder. - -Signed-off-by: Dave Stevenson - -V4L2: Correct flag settings for compressed formats - -Set flags field correctly on enum_fmt_vid_cap for compressed -image formats. - -Signed-off-by: Dave Stevenson - -V4L2: H264 profile & level ctrls, FPS control and auto exp pri - -Several control handling updates. -H264 profile and level controls. -Timeperframe/FPS reworked to add V4L2_CID_EXPOSURE_AUTO_PRIORITY to -select whether AE is allowed to override the framerate specified. - -Signed-off-by: Dave Stevenson - -V4L2: Correct BGR24 to RGB24 in format table - -Signed-off-by: Dave Stevenson - -V4L2: Add additional pixel formats. Correct colourspace - -Adds the other flavours of YUYV, and NV12. -Corrects the overlay advertised colourspace. - -Signed-off-by: Dave Stevenson - -V4L2: Drop logging msg from info to debug - -Signed-off-by: Dave Stevenson - -V4L2: Initial pass at scene modes. - -Only supports exposure mode and metering modes. - -Signed-off-by: Dave Stevenson - -V4L2: Add manual white balance control. - -Adds support for V4L2_CID_RED_BALANCE and -V4L2_CID_BLUE_BALANCE. Only has an effect if -V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE has -V4L2_WHITE_BALANCE_MANUAL selected. - -Signed-off-by: Dave Stevenson - -config: Enable V4L / MMAL driver - -V4L2: Increase the MMAL timeout to 3sec - -MJPEG codec flush is now taking longer and results -in a kernel panic if the driver has stopped waiting for -the result when it finally completes. -Increase the timeout value from 1 to 3secs. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for setting H264_I_PERIOD - -Adds support for the parameter V4L2_CID_MPEG_VIDEO_H264_I_PERIOD -to set the frequency with which I frames are produced. - -Signed-off-by: Dave Stevenson - -V4L2: Enable GPU function for removing padding from images. - -GPU can now support arbitrary strides, although may require -additional processing to achieve it. Enable this feature -so that the images delivered are the size requested. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for V4L2_PIX_FMT_BGR32 - -Signed-off-by: Dave Stevenson - -V4L2: Set the colourspace to avoid odd YUV-RGB conversions - -Removes the amiguity from the conversion routines and stops -them dropping back to the SD vs HD choice of coeffs. - -Signed-off-by: Dave Stevenson - -V4L2: Make video/still threshold a run-time param - -Move the define for at what resolution the driver -switches from a video mode capture to a stills mode -capture to module parameters. - -Signed-off-by: Dave Stevenson - -V4L2: Fix incorrect pool sizing - -Signed-off-by: Dave Stevenson - -V4L2: Add option to disable enum_framesizes. - -Gstreamer's handling of a driver that advertises -V4L2_FRMSIZE_TYPE_STEPWISE to define the supported -resolutions is broken. See bug -https://bugzilla.gnome.org/show_bug.cgi?id=726521 - -Optional parameter of gst_v4l2src_is_broken added. -If non-zero, the driver claims not to support that -ioctl, and gstreamer should be happy again (it -guesses a set of defaults for itself). - -Signed-off-by: Dave Stevenson - -V4L2: Add support for more image formats - -Adds YVU420 (YV12), YVU420SP (NV21), and BGR888. - -Signed-off-by: Dave Stevenson - -V4L2: Extend range for V4L2_CID_MPEG_VIDEO_H264_I_PERIOD - -Request to extend the range from the fairly arbitrary -1000 frames (33 seconds at 30fps). Extend out to the -max range supported (int32 value). -Also allow 0, which is handled by the codec as only -send an I-frame on the first frame and never again. -There may be an exception if it detects a significant -scene change, but there's no easy way around that. - -Signed-off-by: Dave Stevenson - -bcm2835-camera: stop_streaming now has a void return - -BCM2835-V4L2: Fix compliance test failures - -VIDIOC_TRY_FMT and VIDIOC_S_FMT tests were faling due -to reporting V4L2_COLORSPACE_JPEG when the colour -format wasn't V4L2_PIX_FMT_JPEG. -Now reports V4L2_COLORSPACE_SMPTE170M for YUV formats. - -bcm2835 camera planar/packed stride length - -Added a field to the mmal_fmt struct used to compute the bytes per line -when using a particular format. This results in the correct stride being -calculated even when the format is planar. - -Signed-off-by: Garrett Wilson - -bcm2835: camera: check for scene not being found - -static analysis by cppcheck detected some potential NULL pointer -dereference issues: - -[drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null - pointer dereference: scene - (and lines 858, 859 too) - -it is possible that scene is not found because of an invalue ctrl->val -and is therefore NULL and hence causing a null pointer dereference. - -Signed-off-by: Colin Ian King - -bcm2835: memcpy port data to m rather than rmsg - -static analysis by cppcheck detected a memcpy to rmsg which is -not actually initialized at that point. The memcpy should be copying -to variable m instead. - -Signed-off-by: Colin Ian King - -BCM2835-V4L2: Return buffers to videobuf2 on shutdown - -https://github.com/raspberrypi/linux/issues/817 -Fixes the kernel warning from videobuf2 as buffers -are now returned as they are being flushed on -stop_streaming. - -squash: Fixup bcm2835-camera for changes in kernel 4.4 api - -v4l2: Fix up driver to upstream timestamp changes - -bcm2835-camera: fix a bug in computation of frame timestamp - -Fixes #1318 - -V4L2 driver updates (#1393) - -* BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO - -https://github.com/raspberrypi/linux/issues/1251 - -V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should. -V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking -V4L2_CID_ISO_SENSITIVITY as 0 for auto mode. -Still accepts 0 for auto, but also abides by the new parameter. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Add a video_nr parameter. - -Adds a kernel parameter "video_nr" to specify the preferred -/dev/videoX device node. -https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545 - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Add support for multiple cameras - -Ask GPU on load how many cameras have been detected, and -enumerate that number of devices. -Only applicable on the Compute Module as no other device -exposes multiple CSI2 interfaces. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Add control of the overlay location and alpha. - -Actually do something useful in vidioc_s_fmt_vid_overlay and -vidioc_try_fmt_vid_overlay, rather than effectively having -read-only fields. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: V4L2-Compliance failure fix - -VIDIOC_TRY_FMT was failing due to bytesperline not -being set correctly by default. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Make all module parameters static - -Clean up to correct variable scope - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -V4L2: Request maximum resolution from GPU - -Get resolution information about the sensors from the GPU -and advertise it correctly. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -BCM2835-V4L2: Increase minimum resolution to 32x32 - -https://github.com/raspberrypi/linux/issues/1498 showed -up that 16x16 is failing to work on the GPU for some reason. - -GPU bug being tracked on -https://github.com/raspberrypi/firmware/issues/607 -Workaround here by increasing minimum resolution via V4L2 -to 32x32. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -[media]: bcm2835-camera: fix compilation error - -There is an error when compiling rpi-4.6.y branch: - CC [M] drivers/media/platform/bcm2835/bcm2835-camera.o -drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] - .queue_setup = queue_setup, - ^ -drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup') - -The const void *parg in setup_queue callback is not needed since commit: -df9ecb0cad14b952a2865f8b3af86b2bbadfab45. -This commit removes it. - -Signed-off-by: Slawomir Stepien - -bcm2835-camera: Fix max/min error when looping over cameras/resolutions - -See: https://github.com/raspberrypi/linux/issues/1447#issuecomment-221303506 - -BCM2835-V4L2: Correct handling for BGR24 vs RGB24. - -There was a bug in the GPU firmware that had reversed these -two formats. -Detect the old firmware, and reverse the formats if necessary. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -BCM2835-v4l2: Fix a conformance test failure - -Format ioctls: - test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK - warn: v4l2-test-formats.cpp(1195): S_PARM is supported but - doesn't report V4L2_CAP_TIMEPERFRAME. - fail: v4l2-test-formats.cpp(1118): node->has_frmintervals - && !cap->capability ---- - Documentation/video4linux/bcm2835-v4l2.txt | 60 + - drivers/media/platform/Kconfig | 2 + - drivers/media/platform/Makefile | 2 + - drivers/media/platform/bcm2835/Kconfig | 25 + - drivers/media/platform/bcm2835/Makefile | 5 + - drivers/media/platform/bcm2835/bcm2835-camera.c | 2016 ++++++++++++++++++++++ - drivers/media/platform/bcm2835/bcm2835-camera.h | 145 ++ - drivers/media/platform/bcm2835/controls.c | 1345 +++++++++++++++ - drivers/media/platform/bcm2835/mmal-common.h | 53 + - drivers/media/platform/bcm2835/mmal-encodings.h | 127 ++ - drivers/media/platform/bcm2835/mmal-msg-common.h | 50 + - drivers/media/platform/bcm2835/mmal-msg-format.h | 81 + - drivers/media/platform/bcm2835/mmal-msg-port.h | 107 ++ - drivers/media/platform/bcm2835/mmal-msg.h | 404 +++++ - drivers/media/platform/bcm2835/mmal-parameters.h | 689 ++++++++ - drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 ++++++++++++++++++++ - drivers/media/platform/bcm2835/mmal-vchiq.h | 178 ++ - 17 files changed, 7205 insertions(+) - create mode 100644 Documentation/video4linux/bcm2835-v4l2.txt - create mode 100644 drivers/media/platform/bcm2835/Kconfig - create mode 100644 drivers/media/platform/bcm2835/Makefile - create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.c - create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.h - create mode 100644 drivers/media/platform/bcm2835/controls.c - create mode 100644 drivers/media/platform/bcm2835/mmal-common.h - create mode 100644 drivers/media/platform/bcm2835/mmal-encodings.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg-common.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg-format.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg-port.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg.h - create mode 100644 drivers/media/platform/bcm2835/mmal-parameters.h - create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.c - create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.h - -diff --git a/Documentation/video4linux/bcm2835-v4l2.txt b/Documentation/video4linux/bcm2835-v4l2.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..c585a8fadf91c5a04453e442fc29ed893c65bf99 ---- /dev/null -+++ b/Documentation/video4linux/bcm2835-v4l2.txt -@@ -0,0 +1,60 @@ -+ -+BCM2835 (aka Raspberry Pi) V4L2 driver -+====================================== -+ -+1. Copyright -+============ -+ -+Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ -+2. License -+========== -+ -+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. -+ -+This program 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. -+ -+You should have received a copy of the GNU General Public License -+along with this program; if not, write to the Free Software -+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ -+3. Quick Start -+============== -+ -+You need a version 1.0 or later of v4l2-ctl, available from: -+ git://git.linuxtv.org/v4l-utils.git -+ -+$ sudo modprobe bcm2835-v4l2 -+ -+Turn on the overlay: -+ -+$ v4l2-ctl --overlay=1 -+ -+Turn off the overlay: -+ -+$ v4l2-ctl --overlay=0 -+ -+Set the capture format for video: -+ -+$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4 -+ -+(Note: 1088 not 1080). -+ -+Capture: -+ -+$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264 -+ -+Stills capture: -+ -+$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3 -+$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg -+ -+List of available formats: -+ -+$ v4l2-ctl --list-formats -diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig -index ce4a96fccc433c69269a14455ba94e053b515d91..0ea7ea95d824bf95747678e83ee7a61dea6f55cd 100644 ---- a/drivers/media/platform/Kconfig -+++ b/drivers/media/platform/Kconfig -@@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS - - if V4L_PLATFORM_DRIVERS - -+source "drivers/media/platform/bcm2835/Kconfig" -+ - source "drivers/media/platform/marvell-ccic/Kconfig" - - config VIDEO_VIA_CAMERA -diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile -index 40b18d12726ec52d0acfd15894337366eb420e89..b9f01f61c500a9b502d976b4c595be5013610aec 100644 ---- a/drivers/media/platform/Makefile -+++ b/drivers/media/platform/Makefile -@@ -2,6 +2,8 @@ - # Makefile for the video capture/playback device drivers. - # - -+obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/ -+ - obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o - - obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o -diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..58d5f9600d726cb20e6d04c54c58c53ac3a586d2 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/Kconfig -@@ -0,0 +1,25 @@ -+# Broadcom VideoCore IV v4l2 camera support -+ -+config VIDEO_BCM2835 -+ bool "Broadcom BCM2835 camera interface driver" -+ depends on VIDEO_V4L2 && ARCH_BCM2835 -+ ---help--- -+ Say Y here to enable camera host interface devices for -+ Broadcom BCM2835 SoC. This operates over the VCHIQ interface -+ to a service running on VideoCore. -+ -+ -+if VIDEO_BCM2835 -+ -+config VIDEO_BCM2835_MMAL -+ tristate "Broadcom BM2835 MMAL camera interface driver" -+ depends on BCM2708_VCHIQ -+ select VIDEOBUF2_VMALLOC -+ ---help--- -+ This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface -+ -+ To compile this driver as a module, choose M here: the -+ module will be called bcm2835-v4l2.o -+ -+ -+endif # VIDEO_BM2835 -diff --git a/drivers/media/platform/bcm2835/Makefile b/drivers/media/platform/bcm2835/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..b14ea91ac79c60f83bc63156436ef8cbcc893e9b ---- /dev/null -+++ b/drivers/media/platform/bcm2835/Makefile -@@ -0,0 +1,5 @@ -+bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o -+ -+obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o -+ -+ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 -diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4f03949aecf3afbf2e04df38289447195a8847a6 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/bcm2835-camera.c -@@ -0,0 +1,2016 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mmal-common.h" -+#include "mmal-encodings.h" -+#include "mmal-vchiq.h" -+#include "mmal-msg.h" -+#include "mmal-parameters.h" -+#include "bcm2835-camera.h" -+ -+#define BM2835_MMAL_VERSION "0.0.2" -+#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" -+#define MIN_WIDTH 32 -+#define MIN_HEIGHT 32 -+#define MIN_BUFFER_SIZE (80*1024) -+ -+#define MAX_VIDEO_MODE_WIDTH 1280 -+#define MAX_VIDEO_MODE_HEIGHT 720 -+ -+#define MAX_BCM2835_CAMERAS 2 -+ -+MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); -+MODULE_AUTHOR("Vincent Sanders"); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION(BM2835_MMAL_VERSION); -+ -+int bcm2835_v4l2_debug; -+module_param_named(debug, bcm2835_v4l2_debug, int, 0644); -+MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); -+ -+#define UNSET (-1) -+static int video_nr[] = {[0 ... (MAX_BCM2835_CAMERAS - 1)] = UNSET }; -+module_param_array(video_nr, int, NULL, 0644); -+MODULE_PARM_DESC(video_nr, "videoX start numbers, -1 is autodetect"); -+ -+static int max_video_width = MAX_VIDEO_MODE_WIDTH; -+static int max_video_height = MAX_VIDEO_MODE_HEIGHT; -+module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -+MODULE_PARM_DESC(max_video_width, "Threshold for video mode"); -+module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -+MODULE_PARM_DESC(max_video_height, "Threshold for video mode"); -+ -+/* Gstreamer bug https://bugzilla.gnome.org/show_bug.cgi?id=726521 -+ * v4l2src does bad (and actually wrong) things when the vidioc_enum_framesizes -+ * function says type V4L2_FRMSIZE_TYPE_STEPWISE, which we do by default. -+ * It's happier if we just don't say anything at all, when it then -+ * sets up a load of defaults that it thinks might work. -+ * If gst_v4l2src_is_broken is non-zero, then we remove the function from -+ * our function table list (actually switch to an alternate set, but same -+ * result). -+ */ -+static int gst_v4l2src_is_broken; -+module_param(gst_v4l2src_is_broken, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -+MODULE_PARM_DESC(gst_v4l2src_is_broken, "If non-zero, enable workaround for Gstreamer"); -+ -+/* global device data array */ -+static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; -+ -+#define FPS_MIN 1 -+#define FPS_MAX 90 -+ -+/* timeperframe: min/max and default */ -+static const struct v4l2_fract -+ tpf_min = {.numerator = 1, .denominator = FPS_MAX}, -+ tpf_max = {.numerator = 1, .denominator = FPS_MIN}, -+ tpf_default = {.numerator = 1000, .denominator = 30000}; -+ -+/* video formats */ -+static struct mmal_fmt formats[] = { -+ { -+ .name = "4:2:0, planar, YUV", -+ .fourcc = V4L2_PIX_FMT_YUV420, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_I420, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "4:2:2, packed, YUYV", -+ .fourcc = V4L2_PIX_FMT_YUYV, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_YUYV, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "RGB24 (LE)", -+ .fourcc = V4L2_PIX_FMT_RGB24, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_RGB24, -+ .depth = 24, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 3, -+ }, -+ { -+ .name = "JPEG", -+ .fourcc = V4L2_PIX_FMT_JPEG, -+ .flags = V4L2_FMT_FLAG_COMPRESSED, -+ .mmal = MMAL_ENCODING_JPEG, -+ .depth = 8, -+ .mmal_component = MMAL_COMPONENT_IMAGE_ENCODE, -+ .ybbp = 0, -+ }, -+ { -+ .name = "H264", -+ .fourcc = V4L2_PIX_FMT_H264, -+ .flags = V4L2_FMT_FLAG_COMPRESSED, -+ .mmal = MMAL_ENCODING_H264, -+ .depth = 8, -+ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, -+ .ybbp = 0, -+ }, -+ { -+ .name = "MJPEG", -+ .fourcc = V4L2_PIX_FMT_MJPEG, -+ .flags = V4L2_FMT_FLAG_COMPRESSED, -+ .mmal = MMAL_ENCODING_MJPEG, -+ .depth = 8, -+ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, -+ .ybbp = 0, -+ }, -+ { -+ .name = "4:2:2, packed, YVYU", -+ .fourcc = V4L2_PIX_FMT_YVYU, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_YVYU, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "4:2:2, packed, VYUY", -+ .fourcc = V4L2_PIX_FMT_VYUY, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_VYUY, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "4:2:2, packed, UYVY", -+ .fourcc = V4L2_PIX_FMT_UYVY, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_UYVY, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "4:2:0, planar, NV12", -+ .fourcc = V4L2_PIX_FMT_NV12, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_NV12, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "RGB24 (BE)", -+ .fourcc = V4L2_PIX_FMT_BGR24, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_BGR24, -+ .depth = 24, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 3, -+ }, -+ { -+ .name = "4:2:0, planar, YVU", -+ .fourcc = V4L2_PIX_FMT_YVU420, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_YV12, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "4:2:0, planar, NV21", -+ .fourcc = V4L2_PIX_FMT_NV21, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_NV21, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "RGB32 (BE)", -+ .fourcc = V4L2_PIX_FMT_BGR32, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_BGRA, -+ .depth = 32, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 4, -+ }, -+}; -+ -+static struct mmal_fmt *get_format(struct v4l2_format *f) -+{ -+ struct mmal_fmt *fmt; -+ unsigned int k; -+ -+ for (k = 0; k < ARRAY_SIZE(formats); k++) { -+ fmt = &formats[k]; -+ if (fmt->fourcc == f->fmt.pix.pixelformat) -+ break; -+ } -+ -+ if (k == ARRAY_SIZE(formats)) -+ return NULL; -+ -+ return &formats[k]; -+} -+ -+/* ------------------------------------------------------------------ -+ Videobuf queue operations -+ ------------------------------------------------------------------*/ -+ -+static int queue_setup(struct vb2_queue *vq, -+ unsigned int *nbuffers, unsigned int *nplanes, -+ unsigned int sizes[], struct device *alloc_ctxs[]) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ unsigned long size; -+ -+ /* refuse queue setup if port is not configured */ -+ if (dev->capture.port == NULL) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: capture port not configured\n", __func__); -+ return -EINVAL; -+ } -+ -+ size = dev->capture.port->current_buffer.size; -+ if (size == 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: capture port buffer size is zero\n", __func__); -+ return -EINVAL; -+ } -+ -+ if (*nbuffers < (dev->capture.port->current_buffer.num + 2)) -+ *nbuffers = (dev->capture.port->current_buffer.num + 2); -+ -+ *nplanes = 1; -+ -+ sizes[0] = size; -+ -+ /* -+ * videobuf2-vmalloc allocator is context-less so no need to set -+ * alloc_ctxs array. -+ */ -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ return 0; -+} -+ -+static int buffer_prepare(struct vb2_buffer *vb) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); -+ unsigned long size; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ BUG_ON(dev->capture.port == NULL); -+ BUG_ON(dev->capture.fmt == NULL); -+ -+ size = dev->capture.stride * dev->capture.height; -+ if (vb2_plane_size(vb, 0) < size) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s data will not fit into plane (%lu < %lu)\n", -+ __func__, vb2_plane_size(vb, 0), size); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static inline bool is_capturing(struct bm2835_mmal_dev *dev) -+{ -+ return dev->capture.camera_port == -+ &dev-> -+ component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; -+} -+ -+static void buffer_cb(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ int status, -+ struct mmal_buffer *buf, -+ unsigned long length, u32 mmal_flags, s64 dts, s64 pts) -+{ -+ struct bm2835_mmal_dev *dev = port->cb_ctx; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", -+ __func__, status, buf, length, mmal_flags, pts); -+ -+ if (status != 0) { -+ /* error in transfer */ -+ if (buf != NULL) { -+ /* there was a buffer with the error so return it */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -+ } -+ return; -+ } else if (length == 0) { -+ /* stream ended */ -+ if (buf != NULL) { -+ /* this should only ever happen if the port is -+ * disabled and there are buffers still queued -+ */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -+ pr_debug("Empty buffer"); -+ } else if (dev->capture.frame_count) { -+ /* grab another frame */ -+ if (is_capturing(dev)) { -+ pr_debug("Grab another frame"); -+ vchiq_mmal_port_parameter_set( -+ instance, -+ dev->capture. -+ camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture. -+ frame_count, -+ sizeof(dev->capture.frame_count)); -+ } -+ } else { -+ /* signal frame completion */ -+ complete(&dev->capture.frame_cmplt); -+ } -+ } else { -+ if (dev->capture.frame_count) { -+ if (dev->capture.vc_start_timestamp != -1 && -+ pts != 0) { -+ struct timeval timestamp; -+ s64 runtime_us = pts - -+ dev->capture.vc_start_timestamp; -+ u32 div = 0; -+ u32 rem = 0; -+ -+ div = -+ div_u64_rem(runtime_us, USEC_PER_SEC, &rem); -+ timestamp.tv_sec = -+ dev->capture.kernel_start_ts.tv_sec + div; -+ timestamp.tv_usec = -+ dev->capture.kernel_start_ts.tv_usec + rem; -+ -+ if (timestamp.tv_usec >= -+ USEC_PER_SEC) { -+ timestamp.tv_sec++; -+ timestamp.tv_usec -= -+ USEC_PER_SEC; -+ } -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Convert start time %d.%06d and %llu " -+ "with offset %llu to %d.%06d\n", -+ (int)dev->capture.kernel_start_ts. -+ tv_sec, -+ (int)dev->capture.kernel_start_ts. -+ tv_usec, -+ dev->capture.vc_start_timestamp, pts, -+ (int)timestamp.tv_sec, -+ (int)timestamp.tv_usec); -+ buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + -+ timestamp.tv_usec * 1000ULL; -+ } else { -+ buf->vb.vb2_buf.timestamp = ktime_get_ns(); -+ } -+ -+ vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); -+ -+ if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && -+ is_capturing(dev)) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Grab another frame as buffer has EOS"); -+ vchiq_mmal_port_parameter_set( -+ instance, -+ dev->capture. -+ camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture. -+ frame_count, -+ sizeof(dev->capture.frame_count)); -+ } -+ } else { -+ /* signal frame completion */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -+ complete(&dev->capture.frame_cmplt); -+ } -+ } -+} -+ -+static int enable_camera(struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ if (!dev->camera_use_count) { -+ ret = vchiq_mmal_port_parameter_set( -+ dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]->control, -+ MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, -+ sizeof(dev->camera_num)); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed setting camera num, ret %d\n", ret); -+ return -EINVAL; -+ } -+ -+ ret = vchiq_mmal_component_enable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed enabling camera, ret %d\n", ret); -+ return -EINVAL; -+ } -+ } -+ dev->camera_use_count++; -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, "enabled camera (refcount %d)\n", -+ dev->camera_use_count); -+ return 0; -+} -+ -+static int disable_camera(struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ if (!dev->camera_use_count) { -+ v4l2_err(&dev->v4l2_dev, -+ "Disabled the camera when already disabled\n"); -+ return -EINVAL; -+ } -+ dev->camera_use_count--; -+ if (!dev->camera_use_count) { -+ unsigned int i = 0xFFFFFFFF; -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Disabling camera\n"); -+ ret = -+ vchiq_mmal_component_disable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed disabling camera, ret %d\n", ret); -+ return -EINVAL; -+ } -+ vchiq_mmal_port_parameter_set( -+ dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]->control, -+ MMAL_PARAMETER_CAMERA_NUM, &i, -+ sizeof(i)); -+ } -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Camera refcount now %d\n", dev->camera_use_count); -+ return 0; -+} -+ -+static void buffer_queue(struct vb2_buffer *vb) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); -+ struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); -+ struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); -+ int ret; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: dev:%p buf:%p\n", __func__, dev, buf); -+ -+ buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); -+ buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); -+ -+ ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, buf); -+ if (ret < 0) -+ v4l2_err(&dev->v4l2_dev, "%s: error submitting buffer\n", -+ __func__); -+} -+ -+static int start_streaming(struct vb2_queue *vq, unsigned int count) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ int ret; -+ int parameter_size; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ /* ensure a format has actually been set */ -+ if (dev->capture.port == NULL) -+ return -EINVAL; -+ -+ if (enable_camera(dev) < 0) { -+ v4l2_err(&dev->v4l2_dev, "Failed to enable camera\n"); -+ return -EINVAL; -+ } -+ -+ /*init_completion(&dev->capture.frame_cmplt); */ -+ -+ /* enable frame capture */ -+ dev->capture.frame_count = 1; -+ -+ /* if the preview is not already running, wait for a few frames for AGC -+ * to settle down. -+ */ -+ if (!dev->component[MMAL_COMPONENT_PREVIEW]->enabled) -+ msleep(300); -+ -+ /* enable the connection from camera to encoder (if applicable) */ -+ if (dev->capture.camera_port != dev->capture.port -+ && dev->capture.camera_port) { -+ ret = vchiq_mmal_port_enable(dev->instance, -+ dev->capture.camera_port, NULL); -+ if (ret) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to enable encode tunnel - error %d\n", -+ ret); -+ return -1; -+ } -+ } -+ -+ /* Get VC timestamp at this point in time */ -+ parameter_size = sizeof(dev->capture.vc_start_timestamp); -+ if (vchiq_mmal_port_parameter_get(dev->instance, -+ dev->capture.camera_port, -+ MMAL_PARAMETER_SYSTEM_TIME, -+ &dev->capture.vc_start_timestamp, -+ ¶meter_size)) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to get VC start time - update your VC f/w\n"); -+ -+ /* Flag to indicate just to rely on kernel timestamps */ -+ dev->capture.vc_start_timestamp = -1; -+ } else -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Start time %lld size %d\n", -+ dev->capture.vc_start_timestamp, parameter_size); -+ -+ v4l2_get_timestamp(&dev->capture.kernel_start_ts); -+ -+ /* enable the camera port */ -+ dev->capture.port->cb_ctx = dev; -+ ret = -+ vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb); -+ if (ret) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to enable capture port - error %d. " -+ "Disabling camera port again\n", ret); -+ -+ vchiq_mmal_port_disable(dev->instance, -+ dev->capture.camera_port); -+ if (disable_camera(dev) < 0) { -+ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); -+ return -EINVAL; -+ } -+ return -1; -+ } -+ -+ /* capture the first frame */ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ dev->capture.camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture.frame_count, -+ sizeof(dev->capture.frame_count)); -+ return 0; -+} -+ -+/* abort streaming and wait for last buffer */ -+static void stop_streaming(struct vb2_queue *vq) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ init_completion(&dev->capture.frame_cmplt); -+ dev->capture.frame_count = 0; -+ -+ /* ensure a format has actually been set */ -+ if (dev->capture.port == NULL) { -+ v4l2_err(&dev->v4l2_dev, -+ "no capture port - stream not started?\n"); -+ return; -+ } -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "stopping capturing\n"); -+ -+ /* stop capturing frames */ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ dev->capture.camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture.frame_count, -+ sizeof(dev->capture.frame_count)); -+ -+ /* wait for last frame to complete */ -+ ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); -+ if (ret <= 0) -+ v4l2_err(&dev->v4l2_dev, -+ "error %d waiting for frame completion\n", ret); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "disabling connection\n"); -+ -+ /* disable the connection from camera to encoder */ -+ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.camera_port); -+ if (!ret && dev->capture.camera_port != dev->capture.port) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "disabling port\n"); -+ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.port); -+ } else if (dev->capture.camera_port != dev->capture.port) { -+ v4l2_err(&dev->v4l2_dev, "port_disable failed, error %d\n", -+ ret); -+ } -+ -+ if (disable_camera(dev) < 0) -+ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); -+} -+ -+static void bm2835_mmal_lock(struct vb2_queue *vq) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ mutex_lock(&dev->mutex); -+} -+ -+static void bm2835_mmal_unlock(struct vb2_queue *vq) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ mutex_unlock(&dev->mutex); -+} -+ -+static struct vb2_ops bm2835_mmal_video_qops = { -+ .queue_setup = queue_setup, -+ .buf_prepare = buffer_prepare, -+ .buf_queue = buffer_queue, -+ .start_streaming = start_streaming, -+ .stop_streaming = stop_streaming, -+ .wait_prepare = bm2835_mmal_unlock, -+ .wait_finish = bm2835_mmal_lock, -+}; -+ -+/* ------------------------------------------------------------------ -+ IOCTL operations -+ ------------------------------------------------------------------*/ -+ -+static int set_overlay_params(struct bm2835_mmal_dev *dev, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_parameter_displayregion prev_config = { -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | -+ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, -+ .layer = PREVIEW_LAYER, -+ .alpha = dev->overlay.global_alpha, -+ .fullscreen = 0, -+ .dest_rect = { -+ .x = dev->overlay.w.left, -+ .y = dev->overlay.w.top, -+ .width = dev->overlay.w.width, -+ .height = dev->overlay.w.height, -+ }, -+ }; -+ ret = vchiq_mmal_port_parameter_set(dev->instance, port, -+ MMAL_PARAMETER_DISPLAYREGION, -+ &prev_config, sizeof(prev_config)); -+ -+ return ret; -+} -+ -+/* overlay ioctl */ -+static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_fmtdesc *f) -+{ -+ struct mmal_fmt *fmt; -+ -+ if (f->index >= ARRAY_SIZE(formats)) -+ return -EINVAL; -+ -+ fmt = &formats[f->index]; -+ -+ strlcpy(f->description, fmt->name, sizeof(f->description)); -+ f->pixelformat = fmt->fourcc; -+ f->flags = fmt->flags; -+ -+ return 0; -+} -+ -+static int vidioc_g_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ f->fmt.win = dev->overlay; -+ -+ return 0; -+} -+ -+static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ f->fmt.win.field = V4L2_FIELD_NONE; -+ f->fmt.win.chromakey = 0; -+ f->fmt.win.clips = NULL; -+ f->fmt.win.clipcount = 0; -+ f->fmt.win.bitmap = NULL; -+ -+ v4l_bound_align_image(&f->fmt.win.w.width, MIN_WIDTH, dev->max_width, 1, -+ &f->fmt.win.w.height, MIN_HEIGHT, dev->max_height, -+ 1, 0); -+ v4l_bound_align_image(&f->fmt.win.w.left, MIN_WIDTH, dev->max_width, 1, -+ &f->fmt.win.w.top, MIN_HEIGHT, dev->max_height, -+ 1, 0); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Overlay: Now w/h %dx%d l/t %dx%d\n", -+ f->fmt.win.w.width, f->fmt.win.w.height, -+ f->fmt.win.w.left, f->fmt.win.w.top); -+ -+ v4l2_dump_win_format(1, -+ bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ &f->fmt.win, -+ __func__); -+ return 0; -+} -+ -+static int vidioc_s_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ vidioc_try_fmt_vid_overlay(file, priv, f); -+ -+ dev->overlay = f->fmt.win; -+ if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) { -+ set_overlay_params(dev, -+ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); -+ } -+ -+ return 0; -+} -+ -+static int vidioc_overlay(struct file *file, void *f, unsigned int on) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct vchiq_mmal_port *src; -+ struct vchiq_mmal_port *dst; -+ if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) || -+ (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled)) -+ return 0; /* already in requested state */ -+ -+ src = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW]; -+ -+ if (!on) { -+ /* disconnect preview ports and disable component */ -+ ret = vchiq_mmal_port_disable(dev->instance, src); -+ if (!ret) -+ ret = -+ vchiq_mmal_port_connect_tunnel(dev->instance, src, -+ NULL); -+ if (ret >= 0) -+ ret = vchiq_mmal_component_disable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ -+ disable_camera(dev); -+ return ret; -+ } -+ -+ /* set preview port format and connect it to output */ -+ dst = &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]; -+ -+ ret = vchiq_mmal_port_set_format(dev->instance, src); -+ if (ret < 0) -+ goto error; -+ -+ ret = set_overlay_params(dev, dst); -+ if (ret < 0) -+ goto error; -+ -+ if (enable_camera(dev) < 0) -+ goto error; -+ -+ ret = vchiq_mmal_component_enable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ if (ret < 0) -+ goto error; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "connecting %p to %p\n", -+ src, dst); -+ ret = vchiq_mmal_port_connect_tunnel(dev->instance, src, dst); -+ if (!ret) -+ ret = vchiq_mmal_port_enable(dev->instance, src, NULL); -+error: -+ return ret; -+} -+ -+static int vidioc_g_fbuf(struct file *file, void *fh, -+ struct v4l2_framebuffer *a) -+{ -+ /* The video overlay must stay within the framebuffer and can't be -+ positioned independently. */ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct vchiq_mmal_port *preview_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW]; -+ -+ a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | -+ V4L2_FBUF_CAP_GLOBAL_ALPHA; -+ a->flags = V4L2_FBUF_FLAG_OVERLAY; -+ a->fmt.width = preview_port->es.video.width; -+ a->fmt.height = preview_port->es.video.height; -+ a->fmt.pixelformat = V4L2_PIX_FMT_YUV420; -+ a->fmt.bytesperline = preview_port->es.video.width; -+ a->fmt.sizeimage = (preview_port->es.video.width * -+ preview_port->es.video.height * 3)>>1; -+ a->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M; -+ -+ return 0; -+} -+ -+/* input ioctls */ -+static int vidioc_enum_input(struct file *file, void *priv, -+ struct v4l2_input *inp) -+{ -+ /* only a single camera input */ -+ if (inp->index != 0) -+ return -EINVAL; -+ -+ inp->type = V4L2_INPUT_TYPE_CAMERA; -+ sprintf(inp->name, "Camera %u", inp->index); -+ return 0; -+} -+ -+static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) -+{ -+ *i = 0; -+ return 0; -+} -+ -+static int vidioc_s_input(struct file *file, void *priv, unsigned int i) -+{ -+ if (i != 0) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+/* capture ioctls */ -+static int vidioc_querycap(struct file *file, void *priv, -+ struct v4l2_capability *cap) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ u32 major; -+ u32 minor; -+ -+ vchiq_mmal_version(dev->instance, &major, &minor); -+ -+ strcpy(cap->driver, "bm2835 mmal"); -+ snprintf(cap->card, sizeof(cap->card), "mmal service %d.%d", -+ major, minor); -+ -+ snprintf(cap->bus_info, sizeof(cap->bus_info), -+ "platform:%s", dev->v4l2_dev.name); -+ cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | -+ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; -+ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; -+ -+ return 0; -+} -+ -+static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_fmtdesc *f) -+{ -+ struct mmal_fmt *fmt; -+ -+ if (f->index >= ARRAY_SIZE(formats)) -+ return -EINVAL; -+ -+ fmt = &formats[f->index]; -+ -+ strlcpy(f->description, fmt->name, sizeof(f->description)); -+ f->pixelformat = fmt->fourcc; -+ f->flags = fmt->flags; -+ -+ return 0; -+} -+ -+static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ f->fmt.pix.width = dev->capture.width; -+ f->fmt.pix.height = dev->capture.height; -+ f->fmt.pix.field = V4L2_FIELD_NONE; -+ f->fmt.pix.pixelformat = dev->capture.fmt->fourcc; -+ f->fmt.pix.bytesperline = dev->capture.stride; -+ f->fmt.pix.sizeimage = dev->capture.buffersize; -+ -+ if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_RGB24) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; -+ else if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_JPEG) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; -+ else -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; -+ f->fmt.pix.priv = 0; -+ -+ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, -+ __func__); -+ return 0; -+} -+ -+static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct mmal_fmt *mfmt; -+ -+ mfmt = get_format(f); -+ if (!mfmt) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Fourcc format (0x%08x) unknown.\n", -+ f->fmt.pix.pixelformat); -+ f->fmt.pix.pixelformat = formats[0].fourcc; -+ mfmt = get_format(f); -+ } -+ -+ f->fmt.pix.field = V4L2_FIELD_NONE; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Clipping/aligning %dx%d format %08X\n", -+ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); -+ -+ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, dev->max_width, 1, -+ &f->fmt.pix.height, MIN_HEIGHT, dev->max_height, -+ 1, 0); -+ f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp; -+ -+ /* Image buffer has to be padded to allow for alignment, even though -+ * we then remove that padding before delivering the buffer. -+ */ -+ f->fmt.pix.sizeimage = ((f->fmt.pix.height+15)&~15) * -+ (((f->fmt.pix.width+31)&~31) * mfmt->depth) >> 3; -+ -+ if ((mfmt->flags & V4L2_FMT_FLAG_COMPRESSED) && -+ f->fmt.pix.sizeimage < MIN_BUFFER_SIZE) -+ f->fmt.pix.sizeimage = MIN_BUFFER_SIZE; -+ -+ if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB24) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; -+ else if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; -+ else -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; -+ f->fmt.pix.priv = 0; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Now %dx%d format %08X\n", -+ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); -+ -+ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, -+ __func__); -+ return 0; -+} -+ -+static int mmal_setup_components(struct bm2835_mmal_dev *dev, -+ struct v4l2_format *f) -+{ -+ int ret; -+ struct vchiq_mmal_port *port = NULL, *camera_port = NULL; -+ struct vchiq_mmal_component *encode_component = NULL; -+ struct mmal_fmt *mfmt = get_format(f); -+ -+ BUG_ON(!mfmt); -+ -+ if (dev->capture.encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "vid_cap - disconnect previous tunnel\n"); -+ -+ /* Disconnect any previous connection */ -+ vchiq_mmal_port_connect_tunnel(dev->instance, -+ dev->capture.camera_port, NULL); -+ dev->capture.camera_port = NULL; -+ ret = vchiq_mmal_component_disable(dev->instance, -+ dev->capture. -+ encode_component); -+ if (ret) -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to disable encode component %d\n", -+ ret); -+ -+ dev->capture.encode_component = NULL; -+ } -+ /* format dependant port setup */ -+ switch (mfmt->mmal_component) { -+ case MMAL_COMPONENT_CAMERA: -+ /* Make a further decision on port based on resolution */ -+ if (f->fmt.pix.width <= max_video_width -+ && f->fmt.pix.height <= max_video_height) -+ camera_port = port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO]; -+ else -+ camera_port = port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_CAPTURE]; -+ break; -+ case MMAL_COMPONENT_IMAGE_ENCODE: -+ encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE]; -+ port = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; -+ camera_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_CAPTURE]; -+ break; -+ case MMAL_COMPONENT_VIDEO_ENCODE: -+ encode_component = dev->component[MMAL_COMPONENT_VIDEO_ENCODE]; -+ port = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ camera_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO]; -+ break; -+ default: -+ break; -+ } -+ -+ if (!port) -+ return -EINVAL; -+ -+ if (encode_component) -+ camera_port->format.encoding = MMAL_ENCODING_OPAQUE; -+ else -+ camera_port->format.encoding = mfmt->mmal; -+ -+ if (dev->rgb_bgr_swapped) { -+ if (camera_port->format.encoding == MMAL_ENCODING_RGB24) -+ camera_port->format.encoding = MMAL_ENCODING_BGR24; -+ else if (camera_port->format.encoding == MMAL_ENCODING_BGR24) -+ camera_port->format.encoding = MMAL_ENCODING_RGB24; -+ } -+ -+ camera_port->format.encoding_variant = 0; -+ camera_port->es.video.width = f->fmt.pix.width; -+ camera_port->es.video.height = f->fmt.pix.height; -+ camera_port->es.video.crop.x = 0; -+ camera_port->es.video.crop.y = 0; -+ camera_port->es.video.crop.width = f->fmt.pix.width; -+ camera_port->es.video.crop.height = f->fmt.pix.height; -+ camera_port->es.video.frame_rate.num = 0; -+ camera_port->es.video.frame_rate.den = 1; -+ camera_port->es.video.color_space = MMAL_COLOR_SPACE_JPEG_JFIF; -+ -+ ret = vchiq_mmal_port_set_format(dev->instance, camera_port); -+ -+ if (!ret -+ && camera_port == -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO]) { -+ bool overlay_enabled = -+ !!dev->component[MMAL_COMPONENT_PREVIEW]->enabled; -+ struct vchiq_mmal_port *preview_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW]; -+ /* Preview and encode ports need to match on resolution */ -+ if (overlay_enabled) { -+ /* Need to disable the overlay before we can update -+ * the resolution -+ */ -+ ret = -+ vchiq_mmal_port_disable(dev->instance, -+ preview_port); -+ if (!ret) -+ ret = -+ vchiq_mmal_port_connect_tunnel( -+ dev->instance, -+ preview_port, -+ NULL); -+ } -+ preview_port->es.video.width = f->fmt.pix.width; -+ preview_port->es.video.height = f->fmt.pix.height; -+ preview_port->es.video.crop.x = 0; -+ preview_port->es.video.crop.y = 0; -+ preview_port->es.video.crop.width = f->fmt.pix.width; -+ preview_port->es.video.crop.height = f->fmt.pix.height; -+ preview_port->es.video.frame_rate.num = -+ dev->capture.timeperframe.denominator; -+ preview_port->es.video.frame_rate.den = -+ dev->capture.timeperframe.numerator; -+ ret = vchiq_mmal_port_set_format(dev->instance, preview_port); -+ if (overlay_enabled) { -+ ret = vchiq_mmal_port_connect_tunnel( -+ dev->instance, -+ preview_port, -+ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); -+ if (!ret) -+ ret = vchiq_mmal_port_enable(dev->instance, -+ preview_port, -+ NULL); -+ } -+ } -+ -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s failed to set format %dx%d %08X\n", __func__, -+ f->fmt.pix.width, f->fmt.pix.height, -+ f->fmt.pix.pixelformat); -+ /* ensure capture is not going to be tried */ -+ dev->capture.port = NULL; -+ } else { -+ if (encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "vid_cap - set up encode comp\n"); -+ -+ /* configure buffering */ -+ camera_port->current_buffer.size = -+ camera_port->recommended_buffer.size; -+ camera_port->current_buffer.num = -+ camera_port->recommended_buffer.num; -+ -+ ret = -+ vchiq_mmal_port_connect_tunnel( -+ dev->instance, -+ camera_port, -+ &encode_component->input[0]); -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "%s failed to create connection\n", -+ __func__); -+ /* ensure capture is not going to be tried */ -+ dev->capture.port = NULL; -+ } else { -+ port->es.video.width = f->fmt.pix.width; -+ port->es.video.height = f->fmt.pix.height; -+ port->es.video.crop.x = 0; -+ port->es.video.crop.y = 0; -+ port->es.video.crop.width = f->fmt.pix.width; -+ port->es.video.crop.height = f->fmt.pix.height; -+ port->es.video.frame_rate.num = -+ dev->capture.timeperframe.denominator; -+ port->es.video.frame_rate.den = -+ dev->capture.timeperframe.numerator; -+ -+ port->format.encoding = mfmt->mmal; -+ port->format.encoding_variant = 0; -+ /* Set any encoding specific parameters */ -+ switch (mfmt->mmal_component) { -+ case MMAL_COMPONENT_VIDEO_ENCODE: -+ port->format.bitrate = -+ dev->capture.encode_bitrate; -+ break; -+ case MMAL_COMPONENT_IMAGE_ENCODE: -+ /* Could set EXIF parameters here */ -+ break; -+ default: -+ break; -+ } -+ ret = vchiq_mmal_port_set_format(dev->instance, -+ port); -+ if (ret) -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "%s failed to set format %dx%d fmt %08X\n", -+ __func__, -+ f->fmt.pix.width, -+ f->fmt.pix.height, -+ f->fmt.pix.pixelformat -+ ); -+ } -+ -+ if (!ret) { -+ ret = vchiq_mmal_component_enable( -+ dev->instance, -+ encode_component); -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "%s Failed to enable encode components\n", -+ __func__); -+ } -+ } -+ if (!ret) { -+ /* configure buffering */ -+ port->current_buffer.num = 1; -+ port->current_buffer.size = -+ f->fmt.pix.sizeimage; -+ if (port->format.encoding == -+ MMAL_ENCODING_JPEG) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "JPG - buf size now %d was %d\n", -+ f->fmt.pix.sizeimage, -+ port->current_buffer.size); -+ port->current_buffer.size = -+ (f->fmt.pix.sizeimage < -+ (100 << 10)) -+ ? (100 << 10) : f->fmt.pix. -+ sizeimage; -+ } -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "vid_cap - cur_buf.size set to %d\n", -+ f->fmt.pix.sizeimage); -+ port->current_buffer.alignment = 0; -+ } -+ } else { -+ /* configure buffering */ -+ camera_port->current_buffer.num = 1; -+ camera_port->current_buffer.size = f->fmt.pix.sizeimage; -+ camera_port->current_buffer.alignment = 0; -+ } -+ -+ if (!ret) { -+ dev->capture.fmt = mfmt; -+ dev->capture.stride = f->fmt.pix.bytesperline; -+ dev->capture.width = camera_port->es.video.crop.width; -+ dev->capture.height = camera_port->es.video.crop.height; -+ dev->capture.buffersize = port->current_buffer.size; -+ -+ /* select port for capture */ -+ dev->capture.port = port; -+ dev->capture.camera_port = camera_port; -+ dev->capture.encode_component = encode_component; -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "Set dev->capture.fmt %08X, %dx%d, stride %d, size %d", -+ port->format.encoding, -+ dev->capture.width, dev->capture.height, -+ dev->capture.stride, dev->capture.buffersize); -+ } -+ } -+ -+ /* todo: Need to convert the vchiq/mmal error into a v4l2 error. */ -+ return ret; -+} -+ -+static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct mmal_fmt *mfmt; -+ -+ /* try the format to set valid parameters */ -+ ret = vidioc_try_fmt_vid_cap(file, priv, f); -+ if (ret) { -+ v4l2_err(&dev->v4l2_dev, -+ "vid_cap - vidioc_try_fmt_vid_cap failed\n"); -+ return ret; -+ } -+ -+ /* if a capture is running refuse to set format */ -+ if (vb2_is_busy(&dev->capture.vb_vidq)) { -+ v4l2_info(&dev->v4l2_dev, "%s device busy\n", __func__); -+ return -EBUSY; -+ } -+ -+ /* If the format is unsupported v4l2 says we should switch to -+ * a supported one and not return an error. */ -+ mfmt = get_format(f); -+ if (!mfmt) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Fourcc format (0x%08x) unknown.\n", -+ f->fmt.pix.pixelformat); -+ f->fmt.pix.pixelformat = formats[0].fourcc; -+ mfmt = get_format(f); -+ } -+ -+ ret = mmal_setup_components(dev, f); -+ if (ret != 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: failed to setup mmal components: %d\n", -+ __func__, ret); -+ ret = -EINVAL; -+ } -+ -+ return ret; -+} -+ -+int vidioc_enum_framesizes(struct file *file, void *fh, -+ struct v4l2_frmsizeenum *fsize) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ static const struct v4l2_frmsize_stepwise sizes = { -+ MIN_WIDTH, 0, 2, -+ MIN_HEIGHT, 0, 2 -+ }; -+ int i; -+ -+ if (fsize->index) -+ return -EINVAL; -+ for (i = 0; i < ARRAY_SIZE(formats); i++) -+ if (formats[i].fourcc == fsize->pixel_format) -+ break; -+ if (i == ARRAY_SIZE(formats)) -+ return -EINVAL; -+ fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; -+ fsize->stepwise = sizes; -+ fsize->stepwise.max_width = dev->max_width; -+ fsize->stepwise.max_height = dev->max_height; -+ return 0; -+} -+ -+/* timeperframe is arbitrary and continous */ -+static int vidioc_enum_frameintervals(struct file *file, void *priv, -+ struct v4l2_frmivalenum *fival) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ int i; -+ -+ if (fival->index) -+ return -EINVAL; -+ -+ for (i = 0; i < ARRAY_SIZE(formats); i++) -+ if (formats[i].fourcc == fival->pixel_format) -+ break; -+ if (i == ARRAY_SIZE(formats)) -+ return -EINVAL; -+ -+ /* regarding width & height - we support any within range */ -+ if (fival->width < MIN_WIDTH || fival->width > dev->max_width || -+ fival->height < MIN_HEIGHT || fival->height > dev->max_height) -+ return -EINVAL; -+ -+ fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; -+ -+ /* fill in stepwise (step=1.0 is requred by V4L2 spec) */ -+ fival->stepwise.min = tpf_min; -+ fival->stepwise.max = tpf_max; -+ fival->stepwise.step = (struct v4l2_fract) {1, 1}; -+ -+ return 0; -+} -+ -+static int vidioc_g_parm(struct file *file, void *priv, -+ struct v4l2_streamparm *parm) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; -+ parm->parm.capture.timeperframe = dev->capture.timeperframe; -+ parm->parm.capture.readbuffers = 1; -+ return 0; -+} -+ -+#define FRACT_CMP(a, OP, b) \ -+ ((u64)(a).numerator * (b).denominator OP \ -+ (u64)(b).numerator * (a).denominator) -+ -+static int vidioc_s_parm(struct file *file, void *priv, -+ struct v4l2_streamparm *parm) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct v4l2_fract tpf; -+ struct mmal_parameter_rational fps_param; -+ -+ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ tpf = parm->parm.capture.timeperframe; -+ -+ /* tpf: {*, 0} resets timing; clip to [min, max]*/ -+ tpf = tpf.denominator ? tpf : tpf_default; -+ tpf = FRACT_CMP(tpf, <, tpf_min) ? tpf_min : tpf; -+ tpf = FRACT_CMP(tpf, >, tpf_max) ? tpf_max : tpf; -+ -+ dev->capture.timeperframe = tpf; -+ parm->parm.capture.timeperframe = tpf; -+ parm->parm.capture.readbuffers = 1; -+ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; -+ -+ fps_param.num = 0; /* Select variable fps, and then use -+ * FPS_RANGE to select the actual limits. -+ */ -+ fps_param.den = 1; -+ set_framerate_params(dev); -+ -+ return 0; -+} -+ -+static const struct v4l2_ioctl_ops camera0_ioctl_ops = { -+ /* overlay */ -+ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, -+ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, -+ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, -+ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, -+ .vidioc_overlay = vidioc_overlay, -+ .vidioc_g_fbuf = vidioc_g_fbuf, -+ -+ /* inputs */ -+ .vidioc_enum_input = vidioc_enum_input, -+ .vidioc_g_input = vidioc_g_input, -+ .vidioc_s_input = vidioc_s_input, -+ -+ /* capture */ -+ .vidioc_querycap = vidioc_querycap, -+ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, -+ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, -+ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, -+ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, -+ -+ /* buffer management */ -+ .vidioc_reqbufs = vb2_ioctl_reqbufs, -+ .vidioc_create_bufs = vb2_ioctl_create_bufs, -+ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, -+ .vidioc_querybuf = vb2_ioctl_querybuf, -+ .vidioc_qbuf = vb2_ioctl_qbuf, -+ .vidioc_dqbuf = vb2_ioctl_dqbuf, -+ .vidioc_enum_framesizes = vidioc_enum_framesizes, -+ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, -+ .vidioc_g_parm = vidioc_g_parm, -+ .vidioc_s_parm = vidioc_s_parm, -+ .vidioc_streamon = vb2_ioctl_streamon, -+ .vidioc_streamoff = vb2_ioctl_streamoff, -+ -+ .vidioc_log_status = v4l2_ctrl_log_status, -+ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, -+ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -+}; -+ -+static const struct v4l2_ioctl_ops camera0_ioctl_ops_gstreamer = { -+ /* overlay */ -+ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, -+ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, -+ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, -+ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, -+ .vidioc_overlay = vidioc_overlay, -+ .vidioc_g_fbuf = vidioc_g_fbuf, -+ -+ /* inputs */ -+ .vidioc_enum_input = vidioc_enum_input, -+ .vidioc_g_input = vidioc_g_input, -+ .vidioc_s_input = vidioc_s_input, -+ -+ /* capture */ -+ .vidioc_querycap = vidioc_querycap, -+ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, -+ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, -+ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, -+ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, -+ -+ /* buffer management */ -+ .vidioc_reqbufs = vb2_ioctl_reqbufs, -+ .vidioc_create_bufs = vb2_ioctl_create_bufs, -+ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, -+ .vidioc_querybuf = vb2_ioctl_querybuf, -+ .vidioc_qbuf = vb2_ioctl_qbuf, -+ .vidioc_dqbuf = vb2_ioctl_dqbuf, -+ /* Remove this function ptr to fix gstreamer bug -+ .vidioc_enum_framesizes = vidioc_enum_framesizes, */ -+ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, -+ .vidioc_g_parm = vidioc_g_parm, -+ .vidioc_s_parm = vidioc_s_parm, -+ .vidioc_streamon = vb2_ioctl_streamon, -+ .vidioc_streamoff = vb2_ioctl_streamoff, -+ -+ .vidioc_log_status = v4l2_ctrl_log_status, -+ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, -+ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -+}; -+ -+/* ------------------------------------------------------------------ -+ Driver init/finalise -+ ------------------------------------------------------------------*/ -+ -+static const struct v4l2_file_operations camera0_fops = { -+ .owner = THIS_MODULE, -+ .open = v4l2_fh_open, -+ .release = vb2_fop_release, -+ .read = vb2_fop_read, -+ .poll = vb2_fop_poll, -+ .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ -+ .mmap = vb2_fop_mmap, -+}; -+ -+static struct video_device vdev_template = { -+ .name = "camera0", -+ .fops = &camera0_fops, -+ .ioctl_ops = &camera0_ioctl_ops, -+ .release = video_device_release_empty, -+}; -+ -+/* Returns the number of cameras, and also the max resolution supported -+ * by those cameras. -+ */ -+static int get_num_cameras(struct vchiq_mmal_instance *instance, -+ unsigned int resolutions[][2], int num_resolutions) -+{ -+ int ret; -+ struct vchiq_mmal_component *cam_info_component; -+ struct mmal_parameter_camera_info_t cam_info = {0}; -+ int param_size = sizeof(cam_info); -+ int i; -+ -+ /* create a camera_info component */ -+ ret = vchiq_mmal_component_init(instance, "camera_info", -+ &cam_info_component); -+ if (ret < 0) -+ /* Unusual failure - let's guess one camera. */ -+ return 1; -+ -+ if (vchiq_mmal_port_parameter_get(instance, -+ &cam_info_component->control, -+ MMAL_PARAMETER_CAMERA_INFO, -+ &cam_info, -+ ¶m_size)) { -+ pr_info("Failed to get camera info\n"); -+ } -+ for (i = 0; -+ i < (cam_info.num_cameras > num_resolutions ? -+ num_resolutions : -+ cam_info.num_cameras); -+ i++) { -+ resolutions[i][0] = cam_info.cameras[i].max_width; -+ resolutions[i][1] = cam_info.cameras[i].max_height; -+ } -+ -+ vchiq_mmal_component_finalise(instance, -+ cam_info_component); -+ -+ return cam_info.num_cameras; -+} -+ -+static int set_camera_parameters(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *camera, -+ struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ struct mmal_parameter_camera_config cam_config = { -+ .max_stills_w = dev->max_width, -+ .max_stills_h = dev->max_height, -+ .stills_yuv422 = 1, -+ .one_shot_stills = 1, -+ .max_preview_video_w = (max_video_width > 1920) ? -+ max_video_width : 1920, -+ .max_preview_video_h = (max_video_height > 1088) ? -+ max_video_height : 1088, -+ .num_preview_video_frames = 3, -+ .stills_capture_circular_buffer_height = 0, -+ .fast_preview_resume = 0, -+ .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC -+ }; -+ -+ ret = vchiq_mmal_port_parameter_set(instance, &camera->control, -+ MMAL_PARAMETER_CAMERA_CONFIG, -+ &cam_config, sizeof(cam_config)); -+ return ret; -+} -+ -+#define MAX_SUPPORTED_ENCODINGS 20 -+ -+/* MMAL instance and component init */ -+static int __init mmal_init(struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ struct mmal_es_format *format; -+ u32 bool_true = 1; -+ u32 supported_encodings[MAX_SUPPORTED_ENCODINGS]; -+ int param_size; -+ struct vchiq_mmal_component *camera; -+ -+ ret = vchiq_mmal_init(&dev->instance); -+ if (ret < 0) -+ return ret; -+ -+ /* get the camera component ready */ -+ ret = vchiq_mmal_component_init(dev->instance, "ril.camera", -+ &dev->component[MMAL_COMPONENT_CAMERA]); -+ if (ret < 0) -+ goto unreg_mmal; -+ -+ camera = dev->component[MMAL_COMPONENT_CAMERA]; -+ if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { -+ ret = -EINVAL; -+ goto unreg_camera; -+ } -+ -+ ret = set_camera_parameters(dev->instance, -+ camera, -+ dev); -+ if (ret < 0) -+ goto unreg_camera; -+ -+ /* There was an error in the firmware that meant the camera component -+ * produced BGR instead of RGB. -+ * This is now fixed, but in order to support the old firmwares, we -+ * have to check. -+ */ -+ dev->rgb_bgr_swapped = true; -+ param_size = sizeof(supported_encodings); -+ ret = vchiq_mmal_port_parameter_get(dev->instance, -+ &camera->output[MMAL_CAMERA_PORT_CAPTURE], -+ MMAL_PARAMETER_SUPPORTED_ENCODINGS, -+ &supported_encodings, -+ ¶m_size); -+ if (ret == 0) { -+ int i; -+ -+ for (i = 0; i < param_size/sizeof(u32); i++) { -+ if (supported_encodings[i] == MMAL_ENCODING_BGR24) { -+ /* Found BGR24 first - old firmware. */ -+ break; -+ } -+ if (supported_encodings[i] == MMAL_ENCODING_RGB24) { -+ /* Found RGB24 first -+ * new firmware, so use RGB24. -+ */ -+ dev->rgb_bgr_swapped = false; -+ break; -+ } -+ } -+ } -+ format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format; -+ -+ format->encoding = MMAL_ENCODING_OPAQUE; -+ format->encoding_variant = MMAL_ENCODING_I420; -+ -+ format->es->video.width = 1024; -+ format->es->video.height = 768; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = 1024; -+ format->es->video.crop.height = 768; -+ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ -+ format->es->video.frame_rate.den = 1; -+ -+ format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format; -+ -+ format->encoding = MMAL_ENCODING_OPAQUE; -+ format->encoding_variant = MMAL_ENCODING_I420; -+ -+ format->es->video.width = 1024; -+ format->es->video.height = 768; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = 1024; -+ format->es->video.crop.height = 768; -+ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ -+ format->es->video.frame_rate.den = 1; -+ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ &camera->output[MMAL_CAMERA_PORT_VIDEO], -+ MMAL_PARAMETER_NO_IMAGE_PADDING, -+ &bool_true, sizeof(bool_true)); -+ -+ format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format; -+ -+ format->encoding = MMAL_ENCODING_OPAQUE; -+ -+ format->es->video.width = 2592; -+ format->es->video.height = 1944; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = 2592; -+ format->es->video.crop.height = 1944; -+ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ -+ format->es->video.frame_rate.den = 1; -+ -+ dev->capture.width = format->es->video.width; -+ dev->capture.height = format->es->video.height; -+ dev->capture.fmt = &formats[0]; -+ dev->capture.encode_component = NULL; -+ dev->capture.timeperframe = tpf_default; -+ dev->capture.enc_profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH; -+ dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; -+ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ &camera->output[MMAL_CAMERA_PORT_CAPTURE], -+ MMAL_PARAMETER_NO_IMAGE_PADDING, -+ &bool_true, sizeof(bool_true)); -+ -+ /* get the preview component ready */ -+ ret = vchiq_mmal_component_init( -+ dev->instance, "ril.video_render", -+ &dev->component[MMAL_COMPONENT_PREVIEW]); -+ if (ret < 0) -+ goto unreg_camera; -+ -+ if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) { -+ ret = -EINVAL; -+ pr_debug("too few input ports %d needed %d\n", -+ dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1); -+ goto unreg_preview; -+ } -+ -+ /* get the image encoder component ready */ -+ ret = vchiq_mmal_component_init( -+ dev->instance, "ril.image_encode", -+ &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ if (ret < 0) -+ goto unreg_preview; -+ -+ if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) { -+ ret = -EINVAL; -+ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", -+ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs, -+ 1); -+ goto unreg_image_encoder; -+ } -+ -+ /* get the video encoder component ready */ -+ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", -+ &dev-> -+ component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ if (ret < 0) -+ goto unreg_image_encoder; -+ -+ if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) { -+ ret = -EINVAL; -+ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", -+ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs, -+ 1); -+ goto unreg_vid_encoder; -+ } -+ -+ { -+ struct vchiq_mmal_port *encoder_port = -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ encoder_port->format.encoding = MMAL_ENCODING_H264; -+ ret = vchiq_mmal_port_set_format(dev->instance, -+ encoder_port); -+ } -+ -+ { -+ unsigned int enable = 1; -+ vchiq_mmal_port_parameter_set( -+ dev->instance, -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, -+ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, -+ &enable, sizeof(enable)); -+ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, -+ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, -+ &enable, -+ sizeof(enable)); -+ } -+ ret = bm2835_mmal_set_all_camera_controls(dev); -+ if (ret < 0) -+ goto unreg_vid_encoder; -+ -+ return 0; -+ -+unreg_vid_encoder: -+ pr_err("Cleanup: Destroy video encoder\n"); -+ vchiq_mmal_component_finalise( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ -+unreg_image_encoder: -+ pr_err("Cleanup: Destroy image encoder\n"); -+ vchiq_mmal_component_finalise( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ -+unreg_preview: -+ pr_err("Cleanup: Destroy video render\n"); -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ -+unreg_camera: -+ pr_err("Cleanup: Destroy camera\n"); -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ -+unreg_mmal: -+ vchiq_mmal_finalise(dev->instance); -+ return ret; -+} -+ -+static int __init bm2835_mmal_init_device(struct bm2835_mmal_dev *dev, -+ struct video_device *vfd) -+{ -+ int ret; -+ -+ *vfd = vdev_template; -+ if (gst_v4l2src_is_broken) { -+ v4l2_info(&dev->v4l2_dev, -+ "Work-around for gstreamer issue is active.\n"); -+ vfd->ioctl_ops = &camera0_ioctl_ops_gstreamer; -+ } -+ -+ vfd->v4l2_dev = &dev->v4l2_dev; -+ -+ vfd->lock = &dev->mutex; -+ -+ vfd->queue = &dev->capture.vb_vidq; -+ -+ /* video device needs to be able to access instance data */ -+ video_set_drvdata(vfd, dev); -+ -+ ret = video_register_device(vfd, -+ VFL_TYPE_GRABBER, -+ video_nr[dev->camera_num]); -+ if (ret < 0) -+ return ret; -+ -+ v4l2_info(vfd->v4l2_dev, -+ "V4L2 device registered as %s - stills mode > %dx%d\n", -+ video_device_node_name(vfd), max_video_width, max_video_height); -+ -+ return 0; -+} -+ -+void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) -+{ -+ if (!dev) -+ return; -+ -+ v4l2_info(&dev->v4l2_dev, "unregistering %s\n", -+ video_device_node_name(&dev->vdev)); -+ -+ video_unregister_device(&dev->vdev); -+ -+ if (dev->capture.encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "mmal_exit - disconnect tunnel\n"); -+ vchiq_mmal_port_connect_tunnel(dev->instance, -+ dev->capture.camera_port, NULL); -+ vchiq_mmal_component_disable(dev->instance, -+ dev->capture.encode_component); -+ } -+ vchiq_mmal_component_disable(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev-> -+ component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev-> -+ component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ -+ v4l2_ctrl_handler_free(&dev->ctrl_handler); -+ -+ v4l2_device_unregister(&dev->v4l2_dev); -+ -+ kfree(dev); -+} -+ -+static struct v4l2_format default_v4l2_format = { -+ .fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG, -+ .fmt.pix.width = 1024, -+ .fmt.pix.bytesperline = 0, -+ .fmt.pix.height = 768, -+ .fmt.pix.sizeimage = 1024*768, -+}; -+ -+static int __init bm2835_mmal_init(void) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev; -+ struct vb2_queue *q; -+ int camera; -+ unsigned int num_cameras; -+ struct vchiq_mmal_instance *instance; -+ unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; -+ -+ ret = vchiq_mmal_init(&instance); -+ if (ret < 0) -+ return ret; -+ -+ num_cameras = get_num_cameras(instance, -+ resolutions, -+ MAX_BCM2835_CAMERAS); -+ if (num_cameras > MAX_BCM2835_CAMERAS) -+ num_cameras = MAX_BCM2835_CAMERAS; -+ -+ for (camera = 0; camera < num_cameras; camera++) { -+ dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); -+ if (!dev) -+ return -ENOMEM; -+ -+ dev->camera_num = camera; -+ dev->max_width = resolutions[camera][0]; -+ dev->max_height = resolutions[camera][1]; -+ -+ /* setup device defaults */ -+ dev->overlay.w.left = 150; -+ dev->overlay.w.top = 50; -+ dev->overlay.w.width = 1024; -+ dev->overlay.w.height = 768; -+ dev->overlay.clipcount = 0; -+ dev->overlay.field = V4L2_FIELD_NONE; -+ dev->overlay.global_alpha = 255; -+ -+ dev->capture.fmt = &formats[3]; /* JPEG */ -+ -+ /* v4l device registration */ -+ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), -+ "%s", BM2835_MMAL_MODULE_NAME); -+ ret = v4l2_device_register(NULL, &dev->v4l2_dev); -+ if (ret) -+ goto free_dev; -+ -+ /* setup v4l controls */ -+ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); -+ if (ret < 0) -+ goto unreg_dev; -+ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; -+ -+ /* mmal init */ -+ dev->instance = instance; -+ ret = mmal_init(dev); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* initialize queue */ -+ q = &dev->capture.vb_vidq; -+ memset(q, 0, sizeof(*q)); -+ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; -+ q->drv_priv = dev; -+ q->buf_struct_size = sizeof(struct mmal_buffer); -+ q->ops = &bm2835_mmal_video_qops; -+ q->mem_ops = &vb2_vmalloc_memops; -+ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; -+ ret = vb2_queue_init(q); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ -+ mutex_init(&dev->mutex); -+ -+ /* initialise video devices */ -+ ret = bm2835_mmal_init_device(dev, &dev->vdev); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* Really want to call vidioc_s_fmt_vid_cap with the default -+ * format, but currently the APIs don't join up. -+ */ -+ ret = mmal_setup_components(dev, &default_v4l2_format); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: could not setup components\n", __func__); -+ goto unreg_dev; -+ } -+ -+ v4l2_info(&dev->v4l2_dev, -+ "Broadcom 2835 MMAL video capture ver %s loaded.\n", -+ BM2835_MMAL_VERSION); -+ -+ gdev[camera] = dev; -+ } -+ return 0; -+ -+unreg_dev: -+ v4l2_ctrl_handler_free(&dev->ctrl_handler); -+ v4l2_device_unregister(&dev->v4l2_dev); -+ -+free_dev: -+ kfree(dev); -+ -+ for ( ; camera > 0; camera--) { -+ bcm2835_cleanup_instance(gdev[camera]); -+ gdev[camera] = NULL; -+ } -+ pr_info("%s: error %d while loading driver\n", -+ BM2835_MMAL_MODULE_NAME, ret); -+ -+ return ret; -+} -+ -+static void __exit bm2835_mmal_exit(void) -+{ -+ int camera; -+ struct vchiq_mmal_instance *instance = gdev[0]->instance; -+ -+ for (camera = 0; camera < MAX_BCM2835_CAMERAS; camera++) { -+ bcm2835_cleanup_instance(gdev[camera]); -+ gdev[camera] = NULL; -+ } -+ vchiq_mmal_finalise(instance); -+} -+ -+module_init(bm2835_mmal_init); -+module_exit(bm2835_mmal_exit); -diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h -new file mode 100644 -index 0000000000000000000000000000000000000000..e6aeb7e7e381de65d6c6586205069a4c5cd33274 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/bcm2835-camera.h -@@ -0,0 +1,145 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * core driver device -+ */ -+ -+#define V4L2_CTRL_COUNT 29 /* number of v4l controls */ -+ -+enum { -+ MMAL_COMPONENT_CAMERA = 0, -+ MMAL_COMPONENT_PREVIEW, -+ MMAL_COMPONENT_IMAGE_ENCODE, -+ MMAL_COMPONENT_VIDEO_ENCODE, -+ MMAL_COMPONENT_COUNT -+}; -+ -+enum { -+ MMAL_CAMERA_PORT_PREVIEW = 0, -+ MMAL_CAMERA_PORT_VIDEO, -+ MMAL_CAMERA_PORT_CAPTURE, -+ MMAL_CAMERA_PORT_COUNT -+}; -+ -+#define PREVIEW_LAYER 2 -+ -+extern int bcm2835_v4l2_debug; -+ -+struct bm2835_mmal_dev { -+ /* v4l2 devices */ -+ struct v4l2_device v4l2_dev; -+ struct video_device vdev; -+ struct mutex mutex; -+ -+ /* controls */ -+ struct v4l2_ctrl_handler ctrl_handler; -+ struct v4l2_ctrl *ctrls[V4L2_CTRL_COUNT]; -+ enum v4l2_scene_mode scene_mode; -+ struct mmal_colourfx colourfx; -+ int hflip; -+ int vflip; -+ int red_gain; -+ int blue_gain; -+ enum mmal_parameter_exposuremode exposure_mode_user; -+ enum v4l2_exposure_auto_type exposure_mode_v4l2_user; -+ /* active exposure mode may differ if selected via a scene mode */ -+ enum mmal_parameter_exposuremode exposure_mode_active; -+ enum mmal_parameter_exposuremeteringmode metering_mode; -+ unsigned int manual_shutter_speed; -+ bool exp_auto_priority; -+ bool manual_iso_enabled; -+ uint32_t iso; -+ -+ /* allocated mmal instance and components */ -+ struct vchiq_mmal_instance *instance; -+ struct vchiq_mmal_component *component[MMAL_COMPONENT_COUNT]; -+ int camera_use_count; -+ -+ struct v4l2_window overlay; -+ -+ struct { -+ unsigned int width; /* width */ -+ unsigned int height; /* height */ -+ unsigned int stride; /* stride */ -+ unsigned int buffersize; /* buffer size with padding */ -+ struct mmal_fmt *fmt; -+ struct v4l2_fract timeperframe; -+ -+ /* H264 encode bitrate */ -+ int encode_bitrate; -+ /* H264 bitrate mode. CBR/VBR */ -+ int encode_bitrate_mode; -+ /* H264 profile */ -+ enum v4l2_mpeg_video_h264_profile enc_profile; -+ /* H264 level */ -+ enum v4l2_mpeg_video_h264_level enc_level; -+ /* JPEG Q-factor */ -+ int q_factor; -+ -+ struct vb2_queue vb_vidq; -+ -+ /* VC start timestamp for streaming */ -+ s64 vc_start_timestamp; -+ /* Kernel start timestamp for streaming */ -+ struct timeval kernel_start_ts; -+ -+ struct vchiq_mmal_port *port; /* port being used for capture */ -+ /* camera port being used for capture */ -+ struct vchiq_mmal_port *camera_port; -+ /* component being used for encode */ -+ struct vchiq_mmal_component *encode_component; -+ /* number of frames remaining which driver should capture */ -+ unsigned int frame_count; -+ /* last frame completion */ -+ struct completion frame_cmplt; -+ -+ } capture; -+ -+ unsigned int camera_num; -+ unsigned int max_width; -+ unsigned int max_height; -+ unsigned int rgb_bgr_swapped; -+}; -+ -+int bm2835_mmal_init_controls( -+ struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl_handler *hdl); -+ -+int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev); -+int set_framerate_params(struct bm2835_mmal_dev *dev); -+ -+/* Debug helpers */ -+ -+#define v4l2_dump_pix_format(level, debug, dev, pix_fmt, desc) \ -+{ \ -+ v4l2_dbg(level, debug, dev, \ -+"%s: w %u h %u field %u pfmt 0x%x bpl %u sz_img %u colorspace 0x%x priv %u\n", \ -+ desc == NULL ? "" : desc, \ -+ (pix_fmt)->width, (pix_fmt)->height, (pix_fmt)->field, \ -+ (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \ -+ (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \ -+} -+#define v4l2_dump_win_format(level, debug, dev, win_fmt, desc) \ -+{ \ -+ v4l2_dbg(level, debug, dev, \ -+"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \ -+"clipcount %u bitmap %p\n", \ -+ desc == NULL ? "" : desc, \ -+ (win_fmt)->w.width, (win_fmt)->w.height, \ -+ (win_fmt)->w.left, (win_fmt)->w.top, \ -+ (win_fmt)->field, \ -+ (win_fmt)->chromakey, \ -+ (win_fmt)->clips, (win_fmt)->clipcount, \ -+ (win_fmt)->bitmap); \ -+} -diff --git a/drivers/media/platform/bcm2835/controls.c b/drivers/media/platform/bcm2835/controls.c -new file mode 100644 -index 0000000000000000000000000000000000000000..fe61330ba2a64f850ff3e4930ff813f648889804 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/controls.c -@@ -0,0 +1,1345 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mmal-common.h" -+#include "mmal-vchiq.h" -+#include "mmal-parameters.h" -+#include "bcm2835-camera.h" -+ -+/* The supported V4L2_CID_AUTO_EXPOSURE_BIAS values are from -4.0 to +4.0. -+ * MMAL values are in 1/6th increments so the MMAL range is -24 to +24. -+ * V4L2 docs say value "is expressed in terms of EV, drivers should interpret -+ * the values as 0.001 EV units, where the value 1000 stands for +1 EV." -+ * V4L2 is limited to a max of 32 values in a menu, so count in 1/3rds from -+ * -4 to +4 -+ */ -+static const s64 ev_bias_qmenu[] = { -+ -4000, -3667, -3333, -+ -3000, -2667, -2333, -+ -2000, -1667, -1333, -+ -1000, -667, -333, -+ 0, 333, 667, -+ 1000, 1333, 1667, -+ 2000, 2333, 2667, -+ 3000, 3333, 3667, -+ 4000 -+}; -+ -+/* Supported ISO values (*1000) -+ * ISOO = auto ISO -+ */ -+static const s64 iso_qmenu[] = { -+ 0, 100000, 200000, 400000, 800000, -+}; -+static const uint32_t iso_values[] = { -+ 0, 100, 200, 400, 800, -+}; -+ -+static const s64 mains_freq_qmenu[] = { -+ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED, -+ V4L2_CID_POWER_LINE_FREQUENCY_50HZ, -+ V4L2_CID_POWER_LINE_FREQUENCY_60HZ, -+ V4L2_CID_POWER_LINE_FREQUENCY_AUTO -+}; -+ -+/* Supported video encode modes */ -+static const s64 bitrate_mode_qmenu[] = { -+ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, -+ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, -+}; -+ -+enum bm2835_mmal_ctrl_type { -+ MMAL_CONTROL_TYPE_STD, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ MMAL_CONTROL_TYPE_INT_MENU, -+ MMAL_CONTROL_TYPE_CLUSTER, /* special cluster entry */ -+}; -+ -+struct bm2835_mmal_v4l2_ctrl; -+ -+typedef int(bm2835_mmal_v4l2_ctrl_cb)( -+ struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl); -+ -+struct bm2835_mmal_v4l2_ctrl { -+ u32 id; /* v4l2 control identifier */ -+ enum bm2835_mmal_ctrl_type type; -+ /* control minimum value or -+ * mask for MMAL_CONTROL_TYPE_STD_MENU */ -+ s32 min; -+ s32 max; /* maximum value of control */ -+ s32 def; /* default value of control */ -+ s32 step; /* step size of the control */ -+ const s64 *imenu; /* integer menu array */ -+ u32 mmal_id; /* mmal parameter id */ -+ bm2835_mmal_v4l2_ctrl_cb *setter; -+ bool ignore_errors; -+}; -+ -+struct v4l2_to_mmal_effects_setting { -+ u32 v4l2_effect; -+ u32 mmal_effect; -+ s32 col_fx_enable; -+ s32 col_fx_fixed_cbcr; -+ u32 u; -+ u32 v; -+ u32 num_effect_params; -+ u32 effect_params[MMAL_MAX_IMAGEFX_PARAMETERS]; -+}; -+ -+static const struct v4l2_to_mmal_effects_setting -+ v4l2_to_mmal_effects_values[] = { -+ { V4L2_COLORFX_NONE, MMAL_PARAM_IMAGEFX_NONE, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_BW, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 0, 128, 128, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SEPIA, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 0, 87, 151, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_NEGATIVE, MMAL_PARAM_IMAGEFX_NEGATIVE, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_EMBOSS, MMAL_PARAM_IMAGEFX_EMBOSS, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SKETCH, MMAL_PARAM_IMAGEFX_SKETCH, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SKY_BLUE, MMAL_PARAM_IMAGEFX_PASTEL, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_GRASS_GREEN, MMAL_PARAM_IMAGEFX_WATERCOLOUR, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SKIN_WHITEN, MMAL_PARAM_IMAGEFX_WASHEDOUT, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_VIVID, MMAL_PARAM_IMAGEFX_SATURATION, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_AQUA, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 0, 171, 121, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_ART_FREEZE, MMAL_PARAM_IMAGEFX_HATCH, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SILHOUETTE, MMAL_PARAM_IMAGEFX_FILM, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SOLARIZATION, MMAL_PARAM_IMAGEFX_SOLARIZE, -+ 0, 0, 0, 0, 5, {1, 128, 160, 160, 48} }, -+ { V4L2_COLORFX_ANTIQUE, MMAL_PARAM_IMAGEFX_COLOURBALANCE, -+ 0, 0, 0, 0, 3, {108, 274, 238, 0, 0} }, -+ { V4L2_COLORFX_SET_CBCR, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 1, 0, 0, 0, {0, 0, 0, 0, 0} } -+}; -+ -+struct v4l2_mmal_scene_config { -+ enum v4l2_scene_mode v4l2_scene; -+ enum mmal_parameter_exposuremode exposure_mode; -+ enum mmal_parameter_exposuremeteringmode metering_mode; -+}; -+ -+static const struct v4l2_mmal_scene_config scene_configs[] = { -+ /* V4L2_SCENE_MODE_NONE automatically added */ -+ { -+ V4L2_SCENE_MODE_NIGHT, -+ MMAL_PARAM_EXPOSUREMODE_NIGHT, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE -+ }, -+ { -+ V4L2_SCENE_MODE_SPORTS, -+ MMAL_PARAM_EXPOSUREMODE_SPORTS, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE -+ }, -+}; -+ -+/* control handlers*/ -+ -+static int ctrl_set_rational(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ struct mmal_parameter_rational rational_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ rational_value.num = ctrl->val; -+ rational_value.den = 100; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &rational_value, -+ sizeof(rational_value)); -+} -+ -+static int ctrl_set_value(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ u32_value = ctrl->val; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_iso(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ if (ctrl->val > mmal_ctrl->max || ctrl->val < mmal_ctrl->min) -+ return 1; -+ -+ if (ctrl->id == V4L2_CID_ISO_SENSITIVITY) -+ dev->iso = iso_values[ctrl->val]; -+ else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO) -+ dev->manual_iso_enabled = -+ (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ? -+ true : -+ false); -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (dev->manual_iso_enabled) -+ u32_value = dev->iso; -+ else -+ u32_value = 0; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_ISO, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_value_ev(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ s32 s32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ s32_value = (ctrl->val-12)*2; /* Convert from index to 1/6ths */ -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &s32_value, sizeof(s32_value)); -+} -+ -+static int ctrl_set_rotate(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret; -+ u32 u32_value; -+ struct vchiq_mmal_component *camera; -+ -+ camera = dev->component[MMAL_COMPONENT_CAMERA]; -+ -+ u32_value = ((ctrl->val % 360) / 90) * 90; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ -+ return ret; -+} -+ -+static int ctrl_set_flip(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret; -+ u32 u32_value; -+ struct vchiq_mmal_component *camera; -+ -+ if (ctrl->id == V4L2_CID_HFLIP) -+ dev->hflip = ctrl->val; -+ else -+ dev->vflip = ctrl->val; -+ -+ camera = dev->component[MMAL_COMPONENT_CAMERA]; -+ -+ if (dev->hflip && dev->vflip) -+ u32_value = MMAL_PARAM_MIRROR_BOTH; -+ else if (dev->hflip) -+ u32_value = MMAL_PARAM_MIRROR_HORIZONTAL; -+ else if (dev->vflip) -+ u32_value = MMAL_PARAM_MIRROR_VERTICAL; -+ else -+ u32_value = MMAL_PARAM_MIRROR_NONE; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ -+ return ret; -+ -+} -+ -+static int ctrl_set_exposure(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ enum mmal_parameter_exposuremode exp_mode = dev->exposure_mode_user; -+ u32 shutter_speed = 0; -+ struct vchiq_mmal_port *control; -+ int ret = 0; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (mmal_ctrl->mmal_id == MMAL_PARAMETER_SHUTTER_SPEED) { -+ /* V4L2 is in 100usec increments. -+ * MMAL is 1usec. -+ */ -+ dev->manual_shutter_speed = ctrl->val * 100; -+ } else if (mmal_ctrl->mmal_id == MMAL_PARAMETER_EXPOSURE_MODE) { -+ switch (ctrl->val) { -+ case V4L2_EXPOSURE_AUTO: -+ exp_mode = MMAL_PARAM_EXPOSUREMODE_AUTO; -+ break; -+ -+ case V4L2_EXPOSURE_MANUAL: -+ exp_mode = MMAL_PARAM_EXPOSUREMODE_OFF; -+ break; -+ } -+ dev->exposure_mode_user = exp_mode; -+ dev->exposure_mode_v4l2_user = ctrl->val; -+ } else if (mmal_ctrl->id == V4L2_CID_EXPOSURE_AUTO_PRIORITY) { -+ dev->exp_auto_priority = ctrl->val; -+ } -+ -+ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { -+ if (exp_mode == MMAL_PARAM_EXPOSUREMODE_OFF) -+ shutter_speed = dev->manual_shutter_speed; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &shutter_speed, -+ sizeof(shutter_speed)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &exp_mode, -+ sizeof(u32)); -+ dev->exposure_mode_active = exp_mode; -+ } -+ /* exposure_dynamic_framerate (V4L2_CID_EXPOSURE_AUTO_PRIORITY) should -+ * always apply irrespective of scene mode. -+ */ -+ ret += set_framerate_params(dev); -+ -+ return ret; -+} -+ -+static int ctrl_set_metering_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ switch (ctrl->val) { -+ case V4L2_EXPOSURE_METERING_AVERAGE: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE; -+ break; -+ -+ case V4L2_EXPOSURE_METERING_CENTER_WEIGHTED: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT; -+ break; -+ -+ case V4L2_EXPOSURE_METERING_SPOT: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT; -+ break; -+ -+ /* todo matrix weighting not added to Linux API till 3.9 -+ case V4L2_EXPOSURE_METERING_MATRIX: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX; -+ break; -+ */ -+ -+ } -+ -+ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { -+ struct vchiq_mmal_port *control; -+ u32 u32_value = dev->metering_mode; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ } else -+ return 0; -+} -+ -+static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ switch (ctrl->val) { -+ case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED: -+ u32_value = MMAL_PARAM_FLICKERAVOID_OFF; -+ break; -+ case V4L2_CID_POWER_LINE_FREQUENCY_50HZ: -+ u32_value = MMAL_PARAM_FLICKERAVOID_50HZ; -+ break; -+ case V4L2_CID_POWER_LINE_FREQUENCY_60HZ: -+ u32_value = MMAL_PARAM_FLICKERAVOID_60HZ; -+ break; -+ case V4L2_CID_POWER_LINE_FREQUENCY_AUTO: -+ u32_value = MMAL_PARAM_FLICKERAVOID_AUTO; -+ break; -+ } -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_awb_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ switch (ctrl->val) { -+ case V4L2_WHITE_BALANCE_MANUAL: -+ u32_value = MMAL_PARAM_AWBMODE_OFF; -+ break; -+ -+ case V4L2_WHITE_BALANCE_AUTO: -+ u32_value = MMAL_PARAM_AWBMODE_AUTO; -+ break; -+ -+ case V4L2_WHITE_BALANCE_INCANDESCENT: -+ u32_value = MMAL_PARAM_AWBMODE_INCANDESCENT; -+ break; -+ -+ case V4L2_WHITE_BALANCE_FLUORESCENT: -+ u32_value = MMAL_PARAM_AWBMODE_FLUORESCENT; -+ break; -+ -+ case V4L2_WHITE_BALANCE_FLUORESCENT_H: -+ u32_value = MMAL_PARAM_AWBMODE_TUNGSTEN; -+ break; -+ -+ case V4L2_WHITE_BALANCE_HORIZON: -+ u32_value = MMAL_PARAM_AWBMODE_HORIZON; -+ break; -+ -+ case V4L2_WHITE_BALANCE_DAYLIGHT: -+ u32_value = MMAL_PARAM_AWBMODE_SUNLIGHT; -+ break; -+ -+ case V4L2_WHITE_BALANCE_FLASH: -+ u32_value = MMAL_PARAM_AWBMODE_FLASH; -+ break; -+ -+ case V4L2_WHITE_BALANCE_CLOUDY: -+ u32_value = MMAL_PARAM_AWBMODE_CLOUDY; -+ break; -+ -+ case V4L2_WHITE_BALANCE_SHADE: -+ u32_value = MMAL_PARAM_AWBMODE_SHADE; -+ break; -+ -+ } -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_awb_gains(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ struct vchiq_mmal_port *control; -+ struct mmal_parameter_awbgains gains; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (ctrl->id == V4L2_CID_RED_BALANCE) -+ dev->red_gain = ctrl->val; -+ else if (ctrl->id == V4L2_CID_BLUE_BALANCE) -+ dev->blue_gain = ctrl->val; -+ -+ gains.r_gain.num = dev->red_gain; -+ gains.b_gain.num = dev->blue_gain; -+ gains.r_gain.den = gains.b_gain.den = 1000; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &gains, sizeof(gains)); -+} -+ -+static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret = -EINVAL; -+ int i, j; -+ struct vchiq_mmal_port *control; -+ struct mmal_parameter_imagefx_parameters imagefx; -+ -+ for (i = 0; i < ARRAY_SIZE(v4l2_to_mmal_effects_values); i++) { -+ if (ctrl->val == v4l2_to_mmal_effects_values[i].v4l2_effect) { -+ -+ imagefx.effect = -+ v4l2_to_mmal_effects_values[i].mmal_effect; -+ imagefx.num_effect_params = -+ v4l2_to_mmal_effects_values[i].num_effect_params; -+ -+ if (imagefx.num_effect_params > MMAL_MAX_IMAGEFX_PARAMETERS) -+ imagefx.num_effect_params = MMAL_MAX_IMAGEFX_PARAMETERS; -+ -+ for (j = 0; j < imagefx.num_effect_params; j++) -+ imagefx.effect_parameter[j] = -+ v4l2_to_mmal_effects_values[i].effect_params[j]; -+ -+ dev->colourfx.enable = -+ v4l2_to_mmal_effects_values[i].col_fx_enable; -+ if (!v4l2_to_mmal_effects_values[i].col_fx_fixed_cbcr) { -+ dev->colourfx.u = -+ v4l2_to_mmal_effects_values[i].u; -+ dev->colourfx.v = -+ v4l2_to_mmal_effects_values[i].v; -+ } -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ ret = vchiq_mmal_port_parameter_set( -+ dev->instance, control, -+ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, -+ &imagefx, sizeof(imagefx)); -+ if (ret) -+ goto exit; -+ -+ ret = vchiq_mmal_port_parameter_set( -+ dev->instance, control, -+ MMAL_PARAMETER_COLOUR_EFFECT, -+ &dev->colourfx, sizeof(dev->colourfx)); -+ } -+ } -+ -+exit: -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "mmal_ctrl:%p ctrl id:0x%x ctrl val:%d imagefx:0x%x color_effect:%s u:%d v:%d ret %d(%d)\n", -+ mmal_ctrl, ctrl->id, ctrl->val, imagefx.effect, -+ dev->colourfx.enable ? "true" : "false", -+ dev->colourfx.u, dev->colourfx.v, -+ ret, (ret == 0 ? 0 : -EINVAL)); -+ return (ret == 0 ? 0 : EINVAL); -+} -+ -+static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret = -EINVAL; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ dev->colourfx.enable = (ctrl->val & 0xff00) >> 8; -+ dev->colourfx.enable = ctrl->val & 0xff; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_COLOUR_EFFECT, -+ &dev->colourfx, sizeof(dev->colourfx)); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", -+ __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, -+ (ret == 0 ? 0 : -EINVAL)); -+ return (ret == 0 ? 0 : EINVAL); -+} -+ -+static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret; -+ struct vchiq_mmal_port *encoder_out; -+ -+ dev->capture.encode_bitrate = ctrl->val; -+ -+ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out, -+ mmal_ctrl->mmal_id, -+ &ctrl->val, sizeof(ctrl->val)); -+ ret = 0; -+ return ret; -+} -+ -+static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 bitrate_mode; -+ struct vchiq_mmal_port *encoder_out; -+ -+ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ -+ dev->capture.encode_bitrate_mode = ctrl->val; -+ switch (ctrl->val) { -+ default: -+ case V4L2_MPEG_VIDEO_BITRATE_MODE_VBR: -+ bitrate_mode = MMAL_VIDEO_RATECONTROL_VARIABLE; -+ break; -+ case V4L2_MPEG_VIDEO_BITRATE_MODE_CBR: -+ bitrate_mode = MMAL_VIDEO_RATECONTROL_CONSTANT; -+ break; -+ } -+ -+ vchiq_mmal_port_parameter_set(dev->instance, encoder_out, -+ mmal_ctrl->mmal_id, -+ &bitrate_mode, -+ sizeof(bitrate_mode)); -+ return 0; -+} -+ -+static int ctrl_set_image_encode_output(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *jpeg_out; -+ -+ jpeg_out = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; -+ -+ u32_value = ctrl->val; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, jpeg_out, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_video_encode_param_output(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *vid_enc_ctl; -+ -+ vid_enc_ctl = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ -+ u32_value = ctrl->val; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, vid_enc_ctl, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_video_encode_profile_level(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ struct mmal_parameter_video_profile param; -+ int ret = 0; -+ -+ if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_PROFILE) { -+ switch (ctrl->val) { -+ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: -+ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: -+ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: -+ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: -+ dev->capture.enc_profile = ctrl->val; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_LEVEL) { -+ switch (ctrl->val) { -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: -+ dev->capture.enc_level = ctrl->val; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ } -+ -+ if (!ret) { -+ switch (dev->capture.enc_profile) { -+ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: -+ param.profile = MMAL_VIDEO_PROFILE_H264_BASELINE; -+ break; -+ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: -+ param.profile = -+ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE; -+ break; -+ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: -+ param.profile = MMAL_VIDEO_PROFILE_H264_MAIN; -+ break; -+ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: -+ param.profile = MMAL_VIDEO_PROFILE_H264_HIGH; -+ break; -+ default: -+ /* Should never get here */ -+ break; -+ } -+ -+ switch (dev->capture.enc_level) { -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_1; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: -+ param.level = MMAL_VIDEO_LEVEL_H264_1b; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: -+ param.level = MMAL_VIDEO_LEVEL_H264_11; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: -+ param.level = MMAL_VIDEO_LEVEL_H264_12; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: -+ param.level = MMAL_VIDEO_LEVEL_H264_13; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_2; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: -+ param.level = MMAL_VIDEO_LEVEL_H264_21; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: -+ param.level = MMAL_VIDEO_LEVEL_H264_22; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_3; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: -+ param.level = MMAL_VIDEO_LEVEL_H264_31; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: -+ param.level = MMAL_VIDEO_LEVEL_H264_32; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_4; -+ break; -+ default: -+ /* Should never get here */ -+ break; -+ } -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0], -+ mmal_ctrl->mmal_id, -+ ¶m, sizeof(param)); -+ } -+ return ret; -+} -+ -+static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret = 0; -+ int shutter_speed; -+ struct vchiq_mmal_port *control; -+ -+ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "scene mode selected %d, was %d\n", ctrl->val, -+ dev->scene_mode); -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (ctrl->val == dev->scene_mode) -+ return 0; -+ -+ if (ctrl->val == V4L2_SCENE_MODE_NONE) { -+ /* Restore all user selections */ -+ dev->scene_mode = V4L2_SCENE_MODE_NONE; -+ -+ if (dev->exposure_mode_user == MMAL_PARAM_EXPOSUREMODE_OFF) -+ shutter_speed = dev->manual_shutter_speed; -+ else -+ shutter_speed = 0; -+ -+ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", -+ __func__, shutter_speed, dev->exposure_mode_user, -+ dev->metering_mode); -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &shutter_speed, -+ sizeof(shutter_speed)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &dev->exposure_mode_user, -+ sizeof(u32)); -+ dev->exposure_mode_active = dev->exposure_mode_user; -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXP_METERING_MODE, -+ &dev->metering_mode, -+ sizeof(u32)); -+ ret += set_framerate_params(dev); -+ } else { -+ /* Set up scene mode */ -+ int i; -+ const struct v4l2_mmal_scene_config *scene = NULL; -+ int shutter_speed; -+ enum mmal_parameter_exposuremode exposure_mode; -+ enum mmal_parameter_exposuremeteringmode metering_mode; -+ -+ for (i = 0; i < ARRAY_SIZE(scene_configs); i++) { -+ if (scene_configs[i].v4l2_scene == -+ ctrl->val) { -+ scene = &scene_configs[i]; -+ break; -+ } -+ } -+ if (!scene) -+ return -EINVAL; -+ if (i >= ARRAY_SIZE(scene_configs)) -+ return -EINVAL; -+ -+ /* Set all the values */ -+ dev->scene_mode = ctrl->val; -+ -+ if (scene->exposure_mode == MMAL_PARAM_EXPOSUREMODE_OFF) -+ shutter_speed = dev->manual_shutter_speed; -+ else -+ shutter_speed = 0; -+ exposure_mode = scene->exposure_mode; -+ metering_mode = scene->metering_mode; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", -+ __func__, shutter_speed, exposure_mode, metering_mode); -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &shutter_speed, -+ sizeof(shutter_speed)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &exposure_mode, -+ sizeof(u32)); -+ dev->exposure_mode_active = exposure_mode; -+ ret += vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &exposure_mode, -+ sizeof(u32)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_EXP_METERING_MODE, -+ &metering_mode, -+ sizeof(u32)); -+ ret += set_framerate_params(dev); -+ } -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: Setting scene to %d, ret=%d\n", -+ __func__, ctrl->val, ret); -+ ret = -EINVAL; -+ } -+ return 0; -+} -+ -+static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl) -+{ -+ struct bm2835_mmal_dev *dev = -+ container_of(ctrl->handler, struct bm2835_mmal_dev, -+ ctrl_handler); -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv; -+ int ret; -+ -+ if ((mmal_ctrl == NULL) || -+ (mmal_ctrl->id != ctrl->id) || -+ (mmal_ctrl->setter == NULL)) { -+ pr_warn("mmal_ctrl:%p ctrl id:%d\n", mmal_ctrl, ctrl->id); -+ return -EINVAL; -+ } -+ -+ ret = mmal_ctrl->setter(dev, ctrl, mmal_ctrl); -+ if (ret) -+ pr_warn("ctrl id:%d/MMAL param %08X- returned ret %d\n", -+ ctrl->id, mmal_ctrl->mmal_id, ret); -+ if (mmal_ctrl->ignore_errors) -+ ret = 0; -+ return ret; -+} -+ -+static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = { -+ .s_ctrl = bm2835_mmal_s_ctrl, -+}; -+ -+ -+ -+static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { -+ { -+ V4L2_CID_SATURATION, MMAL_CONTROL_TYPE_STD, -+ -100, 100, 0, 1, NULL, -+ MMAL_PARAMETER_SATURATION, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_SHARPNESS, MMAL_CONTROL_TYPE_STD, -+ -100, 100, 0, 1, NULL, -+ MMAL_PARAMETER_SHARPNESS, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_CONTRAST, MMAL_CONTROL_TYPE_STD, -+ -100, 100, 0, 1, NULL, -+ MMAL_PARAMETER_CONTRAST, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_BRIGHTNESS, MMAL_CONTROL_TYPE_STD, -+ 0, 100, 50, 1, NULL, -+ MMAL_PARAMETER_BRIGHTNESS, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, -+ 0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, -+ MMAL_PARAMETER_ISO, -+ &ctrl_set_iso, -+ false -+ }, -+ { -+ V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, -+ MMAL_PARAMETER_ISO, -+ &ctrl_set_iso, -+ false -+ }, -+ { -+ V4L2_CID_IMAGE_STABILIZATION, MMAL_CONTROL_TYPE_STD, -+ 0, 1, 0, 1, NULL, -+ MMAL_PARAMETER_VIDEO_STABILISATION, -+ &ctrl_set_value, -+ false -+ }, -+/* { -+ 0, MMAL_CONTROL_TYPE_CLUSTER, 3, 1, 0, NULL, 0, NULL -+ }, */ -+ { -+ V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU, -+ ~0x03, 3, V4L2_EXPOSURE_AUTO, 0, NULL, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &ctrl_set_exposure, -+ false -+ }, -+/* todo this needs mixing in with set exposure -+ { -+ V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, -+ }, -+ */ -+ { -+ V4L2_CID_EXPOSURE_ABSOLUTE, MMAL_CONTROL_TYPE_STD, -+ /* Units of 100usecs */ -+ 1, 1*1000*10, 100*10, 1, NULL, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &ctrl_set_exposure, -+ false -+ }, -+ { -+ V4L2_CID_AUTO_EXPOSURE_BIAS, MMAL_CONTROL_TYPE_INT_MENU, -+ 0, ARRAY_SIZE(ev_bias_qmenu) - 1, -+ (ARRAY_SIZE(ev_bias_qmenu)+1)/2 - 1, 0, ev_bias_qmenu, -+ MMAL_PARAMETER_EXPOSURE_COMP, -+ &ctrl_set_value_ev, -+ false -+ }, -+ { -+ V4L2_CID_EXPOSURE_AUTO_PRIORITY, MMAL_CONTROL_TYPE_STD, -+ 0, 1, -+ 0, 1, NULL, -+ 0, /* Dummy MMAL ID as it gets mapped into FPS range*/ -+ &ctrl_set_exposure, -+ false -+ }, -+ { -+ V4L2_CID_EXPOSURE_METERING, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ ~0x7, 2, V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, -+ MMAL_PARAMETER_EXP_METERING_MODE, -+ &ctrl_set_metering_mode, -+ false -+ }, -+ { -+ V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ ~0x3ff, 9, V4L2_WHITE_BALANCE_AUTO, 0, NULL, -+ MMAL_PARAMETER_AWB_MODE, -+ &ctrl_set_awb_mode, -+ false -+ }, -+ { -+ V4L2_CID_RED_BALANCE, MMAL_CONTROL_TYPE_STD, -+ 1, 7999, 1000, 1, NULL, -+ MMAL_PARAMETER_CUSTOM_AWB_GAINS, -+ &ctrl_set_awb_gains, -+ false -+ }, -+ { -+ V4L2_CID_BLUE_BALANCE, MMAL_CONTROL_TYPE_STD, -+ 1, 7999, 1000, 1, NULL, -+ MMAL_PARAMETER_CUSTOM_AWB_GAINS, -+ &ctrl_set_awb_gains, -+ false -+ }, -+ { -+ V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, 15, V4L2_COLORFX_NONE, 0, NULL, -+ MMAL_PARAMETER_IMAGE_EFFECT, -+ &ctrl_set_image_effect, -+ false -+ }, -+ { -+ V4L2_CID_COLORFX_CBCR, MMAL_CONTROL_TYPE_STD, -+ 0, 0xffff, 0x8080, 1, NULL, -+ MMAL_PARAMETER_COLOUR_EFFECT, -+ &ctrl_set_colfx, -+ false -+ }, -+ { -+ V4L2_CID_ROTATE, MMAL_CONTROL_TYPE_STD, -+ 0, 360, 0, 90, NULL, -+ MMAL_PARAMETER_ROTATION, -+ &ctrl_set_rotate, -+ false -+ }, -+ { -+ V4L2_CID_HFLIP, MMAL_CONTROL_TYPE_STD, -+ 0, 1, 0, 1, NULL, -+ MMAL_PARAMETER_MIRROR, -+ &ctrl_set_flip, -+ false -+ }, -+ { -+ V4L2_CID_VFLIP, MMAL_CONTROL_TYPE_STD, -+ 0, 1, 0, 1, NULL, -+ MMAL_PARAMETER_MIRROR, -+ &ctrl_set_flip, -+ false -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, ARRAY_SIZE(bitrate_mode_qmenu) - 1, -+ 0, 0, bitrate_mode_qmenu, -+ MMAL_PARAMETER_RATECONTROL, -+ &ctrl_set_bitrate_mode, -+ false -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_BITRATE, MMAL_CONTROL_TYPE_STD, -+ 25*1000, 25*1000*1000, 10*1000*1000, 25*1000, NULL, -+ MMAL_PARAMETER_VIDEO_BIT_RATE, -+ &ctrl_set_bitrate, -+ false -+ }, -+ { -+ V4L2_CID_JPEG_COMPRESSION_QUALITY, MMAL_CONTROL_TYPE_STD, -+ 1, 100, -+ 30, 1, NULL, -+ MMAL_PARAMETER_JPEG_Q_FACTOR, -+ &ctrl_set_image_encode_output, -+ false -+ }, -+ { -+ V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, ARRAY_SIZE(mains_freq_qmenu) - 1, -+ 1, 1, NULL, -+ MMAL_PARAMETER_FLICKER_AVOID, -+ &ctrl_set_flicker_avoidance, -+ false -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER, MMAL_CONTROL_TYPE_STD, -+ 0, 1, -+ 0, 1, NULL, -+ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER, -+ &ctrl_set_video_encode_param_output, -+ true /* Errors ignored as requires latest firmware to work */ -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_H264_PROFILE, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ ~((1<ctrls[c]) && (v4l2_ctrls[c].setter)) { -+ ret = v4l2_ctrls[c].setter(dev, dev->ctrls[c], -+ &v4l2_ctrls[c]); -+ if (!v4l2_ctrls[c].ignore_errors && ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Failed when setting default values for ctrl %d\n", -+ c); -+ break; -+ } -+ } -+ } -+ return ret; -+} -+ -+int set_framerate_params(struct bm2835_mmal_dev *dev) -+{ -+ struct mmal_parameter_fps_range fps_range; -+ int ret; -+ -+ if ((dev->exposure_mode_active != MMAL_PARAM_EXPOSUREMODE_OFF) && -+ (dev->exp_auto_priority)) { -+ /* Variable FPS. Define min FPS as 1fps. -+ * Max as max defined FPS. -+ */ -+ fps_range.fps_low.num = 1; -+ fps_range.fps_low.den = 1; -+ fps_range.fps_high.num = dev->capture.timeperframe.denominator; -+ fps_range.fps_high.den = dev->capture.timeperframe.numerator; -+ } else { -+ /* Fixed FPS - set min and max to be the same */ -+ fps_range.fps_low.num = fps_range.fps_high.num = -+ dev->capture.timeperframe.denominator; -+ fps_range.fps_low.den = fps_range.fps_high.den = -+ dev->capture.timeperframe.numerator; -+ } -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Set fps range to %d/%d to %d/%d\n", -+ fps_range.fps_low.num, -+ fps_range.fps_low.den, -+ fps_range.fps_high.num, -+ fps_range.fps_high.den -+ ); -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW], -+ MMAL_PARAMETER_FPS_RANGE, -+ &fps_range, sizeof(fps_range)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO], -+ MMAL_PARAMETER_FPS_RANGE, -+ &fps_range, sizeof(fps_range)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_CAPTURE], -+ MMAL_PARAMETER_FPS_RANGE, -+ &fps_range, sizeof(fps_range)); -+ if (ret) -+ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Failed to set fps ret %d\n", -+ ret); -+ -+ return ret; -+ -+} -+ -+int bm2835_mmal_init_controls(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl_handler *hdl) -+{ -+ int c; -+ const struct bm2835_mmal_v4l2_ctrl *ctrl; -+ -+ v4l2_ctrl_handler_init(hdl, V4L2_CTRL_COUNT); -+ -+ for (c = 0; c < V4L2_CTRL_COUNT; c++) { -+ ctrl = &v4l2_ctrls[c]; -+ -+ switch (ctrl->type) { -+ case MMAL_CONTROL_TYPE_STD: -+ dev->ctrls[c] = v4l2_ctrl_new_std(hdl, -+ &bm2835_mmal_ctrl_ops, ctrl->id, -+ ctrl->min, ctrl->max, ctrl->step, ctrl->def); -+ break; -+ -+ case MMAL_CONTROL_TYPE_STD_MENU: -+ { -+ int mask = ctrl->min; -+ -+ if (ctrl->id == V4L2_CID_SCENE_MODE) { -+ /* Special handling to work out the mask -+ * value based on the scene_configs array -+ * at runtime. Reduces the chance of -+ * mismatches. -+ */ -+ int i; -+ mask = 1<ctrls[c] = v4l2_ctrl_new_std_menu(hdl, -+ &bm2835_mmal_ctrl_ops, ctrl->id, -+ ctrl->max, mask, ctrl->def); -+ break; -+ } -+ -+ case MMAL_CONTROL_TYPE_INT_MENU: -+ dev->ctrls[c] = v4l2_ctrl_new_int_menu(hdl, -+ &bm2835_mmal_ctrl_ops, ctrl->id, -+ ctrl->max, ctrl->def, ctrl->imenu); -+ break; -+ -+ case MMAL_CONTROL_TYPE_CLUSTER: -+ /* skip this entry when constructing controls */ -+ continue; -+ } -+ -+ if (hdl->error) -+ break; -+ -+ dev->ctrls[c]->priv = (void *)ctrl; -+ } -+ -+ if (hdl->error) { -+ pr_err("error adding control %d/%d id 0x%x\n", c, -+ V4L2_CTRL_COUNT, ctrl->id); -+ return hdl->error; -+ } -+ -+ for (c = 0; c < V4L2_CTRL_COUNT; c++) { -+ ctrl = &v4l2_ctrls[c]; -+ -+ switch (ctrl->type) { -+ case MMAL_CONTROL_TYPE_CLUSTER: -+ v4l2_ctrl_auto_cluster(ctrl->min, -+ &dev->ctrls[c+1], -+ ctrl->max, -+ ctrl->def); -+ break; -+ -+ case MMAL_CONTROL_TYPE_STD: -+ case MMAL_CONTROL_TYPE_STD_MENU: -+ case MMAL_CONTROL_TYPE_INT_MENU: -+ break; -+ } -+ -+ } -+ -+ return 0; -+} -diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h -new file mode 100644 -index 0000000000000000000000000000000000000000..840fd139e03315b5d9ac2d5742ab589bc6b17ade ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-common.h -@@ -0,0 +1,53 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * MMAL structures -+ * -+ */ -+ -+#define MMAL_FOURCC(a, b, c, d) ((a) | (b << 8) | (c << 16) | (d << 24)) -+#define MMAL_MAGIC MMAL_FOURCC('m', 'm', 'a', 'l') -+ -+/** Special value signalling that time is not known */ -+#define MMAL_TIME_UNKNOWN (1LL<<63) -+ -+/* mapping between v4l and mmal video modes */ -+struct mmal_fmt { -+ char *name; -+ u32 fourcc; /* v4l2 format id */ -+ int flags; /* v4l2 flags field */ -+ u32 mmal; -+ int depth; -+ u32 mmal_component; /* MMAL component index to be used to encode */ -+ u32 ybbp; /* depth of first Y plane for planar formats */ -+}; -+ -+/* buffer for one video frame */ -+struct mmal_buffer { -+ /* v4l buffer data -- must be first */ -+ struct vb2_v4l2_buffer vb; -+ -+ /* list of buffers available */ -+ struct list_head list; -+ -+ void *buffer; /* buffer pointer */ -+ unsigned long buffer_size; /* size of allocated buffer */ -+}; -+ -+/* */ -+struct mmal_colourfx { -+ s32 enable; -+ u32 u; -+ u32 v; -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-encodings.h b/drivers/media/platform/bcm2835/mmal-encodings.h -new file mode 100644 -index 0000000000000000000000000000000000000000..024d620dc1dfda006a9d36dffeeec691faf24ac5 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-encodings.h -@@ -0,0 +1,127 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+#ifndef MMAL_ENCODINGS_H -+#define MMAL_ENCODINGS_H -+ -+#define MMAL_ENCODING_H264 MMAL_FOURCC('H', '2', '6', '4') -+#define MMAL_ENCODING_H263 MMAL_FOURCC('H', '2', '6', '3') -+#define MMAL_ENCODING_MP4V MMAL_FOURCC('M', 'P', '4', 'V') -+#define MMAL_ENCODING_MP2V MMAL_FOURCC('M', 'P', '2', 'V') -+#define MMAL_ENCODING_MP1V MMAL_FOURCC('M', 'P', '1', 'V') -+#define MMAL_ENCODING_WMV3 MMAL_FOURCC('W', 'M', 'V', '3') -+#define MMAL_ENCODING_WMV2 MMAL_FOURCC('W', 'M', 'V', '2') -+#define MMAL_ENCODING_WMV1 MMAL_FOURCC('W', 'M', 'V', '1') -+#define MMAL_ENCODING_WVC1 MMAL_FOURCC('W', 'V', 'C', '1') -+#define MMAL_ENCODING_VP8 MMAL_FOURCC('V', 'P', '8', ' ') -+#define MMAL_ENCODING_VP7 MMAL_FOURCC('V', 'P', '7', ' ') -+#define MMAL_ENCODING_VP6 MMAL_FOURCC('V', 'P', '6', ' ') -+#define MMAL_ENCODING_THEORA MMAL_FOURCC('T', 'H', 'E', 'O') -+#define MMAL_ENCODING_SPARK MMAL_FOURCC('S', 'P', 'R', 'K') -+#define MMAL_ENCODING_MJPEG MMAL_FOURCC('M', 'J', 'P', 'G') -+ -+#define MMAL_ENCODING_JPEG MMAL_FOURCC('J', 'P', 'E', 'G') -+#define MMAL_ENCODING_GIF MMAL_FOURCC('G', 'I', 'F', ' ') -+#define MMAL_ENCODING_PNG MMAL_FOURCC('P', 'N', 'G', ' ') -+#define MMAL_ENCODING_PPM MMAL_FOURCC('P', 'P', 'M', ' ') -+#define MMAL_ENCODING_TGA MMAL_FOURCC('T', 'G', 'A', ' ') -+#define MMAL_ENCODING_BMP MMAL_FOURCC('B', 'M', 'P', ' ') -+ -+#define MMAL_ENCODING_I420 MMAL_FOURCC('I', '4', '2', '0') -+#define MMAL_ENCODING_I420_SLICE MMAL_FOURCC('S', '4', '2', '0') -+#define MMAL_ENCODING_YV12 MMAL_FOURCC('Y', 'V', '1', '2') -+#define MMAL_ENCODING_I422 MMAL_FOURCC('I', '4', '2', '2') -+#define MMAL_ENCODING_I422_SLICE MMAL_FOURCC('S', '4', '2', '2') -+#define MMAL_ENCODING_YUYV MMAL_FOURCC('Y', 'U', 'Y', 'V') -+#define MMAL_ENCODING_YVYU MMAL_FOURCC('Y', 'V', 'Y', 'U') -+#define MMAL_ENCODING_UYVY MMAL_FOURCC('U', 'Y', 'V', 'Y') -+#define MMAL_ENCODING_VYUY MMAL_FOURCC('V', 'Y', 'U', 'Y') -+#define MMAL_ENCODING_NV12 MMAL_FOURCC('N', 'V', '1', '2') -+#define MMAL_ENCODING_NV21 MMAL_FOURCC('N', 'V', '2', '1') -+#define MMAL_ENCODING_ARGB MMAL_FOURCC('A', 'R', 'G', 'B') -+#define MMAL_ENCODING_RGBA MMAL_FOURCC('R', 'G', 'B', 'A') -+#define MMAL_ENCODING_ABGR MMAL_FOURCC('A', 'B', 'G', 'R') -+#define MMAL_ENCODING_BGRA MMAL_FOURCC('B', 'G', 'R', 'A') -+#define MMAL_ENCODING_RGB16 MMAL_FOURCC('R', 'G', 'B', '2') -+#define MMAL_ENCODING_RGB24 MMAL_FOURCC('R', 'G', 'B', '3') -+#define MMAL_ENCODING_RGB32 MMAL_FOURCC('R', 'G', 'B', '4') -+#define MMAL_ENCODING_BGR16 MMAL_FOURCC('B', 'G', 'R', '2') -+#define MMAL_ENCODING_BGR24 MMAL_FOURCC('B', 'G', 'R', '3') -+#define MMAL_ENCODING_BGR32 MMAL_FOURCC('B', 'G', 'R', '4') -+ -+/** SAND Video (YUVUV128) format, native format understood by VideoCore. -+ * This format is *not* opaque - if requested you will receive full frames -+ * of YUV_UV video. -+ */ -+#define MMAL_ENCODING_YUVUV128 MMAL_FOURCC('S', 'A', 'N', 'D') -+ -+/** VideoCore opaque image format, image handles are returned to -+ * the host but not the actual image data. -+ */ -+#define MMAL_ENCODING_OPAQUE MMAL_FOURCC('O', 'P', 'Q', 'V') -+ -+/** An EGL image handle -+ */ -+#define MMAL_ENCODING_EGL_IMAGE MMAL_FOURCC('E', 'G', 'L', 'I') -+ -+/* }@ */ -+ -+/** \name Pre-defined audio encodings */ -+/* @{ */ -+#define MMAL_ENCODING_PCM_UNSIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'U') -+#define MMAL_ENCODING_PCM_UNSIGNED_LE MMAL_FOURCC('p', 'c', 'm', 'u') -+#define MMAL_ENCODING_PCM_SIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'S') -+#define MMAL_ENCODING_PCM_SIGNED_LE MMAL_FOURCC('p', 'c', 'm', 's') -+#define MMAL_ENCODING_PCM_FLOAT_BE MMAL_FOURCC('P', 'C', 'M', 'F') -+#define MMAL_ENCODING_PCM_FLOAT_LE MMAL_FOURCC('p', 'c', 'm', 'f') -+ -+/* Pre-defined H264 encoding variants */ -+ -+/** ISO 14496-10 Annex B byte stream format */ -+#define MMAL_ENCODING_VARIANT_H264_DEFAULT 0 -+/** ISO 14496-15 AVC stream format */ -+#define MMAL_ENCODING_VARIANT_H264_AVC1 MMAL_FOURCC('A', 'V', 'C', '1') -+/** Implicitly delineated NAL units without emulation prevention */ -+#define MMAL_ENCODING_VARIANT_H264_RAW MMAL_FOURCC('R', 'A', 'W', ' ') -+ -+ -+/** \defgroup MmalColorSpace List of pre-defined video color spaces -+ * This defines a list of common color spaces. This list isn't exhaustive and -+ * is only provided as a convenience to avoid clients having to use FourCC -+ * codes directly. However components are allowed to define and use their own -+ * FourCC codes. -+ */ -+/* @{ */ -+ -+/** Unknown color space */ -+#define MMAL_COLOR_SPACE_UNKNOWN 0 -+/** ITU-R BT.601-5 [SDTV] */ -+#define MMAL_COLOR_SPACE_ITUR_BT601 MMAL_FOURCC('Y', '6', '0', '1') -+/** ITU-R BT.709-3 [HDTV] */ -+#define MMAL_COLOR_SPACE_ITUR_BT709 MMAL_FOURCC('Y', '7', '0', '9') -+/** JPEG JFIF */ -+#define MMAL_COLOR_SPACE_JPEG_JFIF MMAL_FOURCC('Y', 'J', 'F', 'I') -+/** Title 47 Code of Federal Regulations (2003) 73.682 (a) (20) */ -+#define MMAL_COLOR_SPACE_FCC MMAL_FOURCC('Y', 'F', 'C', 'C') -+/** Society of Motion Picture and Television Engineers 240M (1999) */ -+#define MMAL_COLOR_SPACE_SMPTE240M MMAL_FOURCC('Y', '2', '4', '0') -+/** ITU-R BT.470-2 System M */ -+#define MMAL_COLOR_SPACE_BT470_2_M MMAL_FOURCC('Y', '_', '_', 'M') -+/** ITU-R BT.470-2 System BG */ -+#define MMAL_COLOR_SPACE_BT470_2_BG MMAL_FOURCC('Y', '_', 'B', 'G') -+/** JPEG JFIF, but with 16..255 luma */ -+#define MMAL_COLOR_SPACE_JFIF_Y16_255 MMAL_FOURCC('Y', 'Y', '1', '6') -+/* @} MmalColorSpace List */ -+ -+#endif /* MMAL_ENCODINGS_H */ -diff --git a/drivers/media/platform/bcm2835/mmal-msg-common.h b/drivers/media/platform/bcm2835/mmal-msg-common.h -new file mode 100644 -index 0000000000000000000000000000000000000000..66e8a6edf628565aeb487662b0b503c0c562ac8a ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg-common.h -@@ -0,0 +1,50 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#ifndef MMAL_MSG_COMMON_H -+#define MMAL_MSG_COMMON_H -+ -+enum mmal_msg_status { -+ MMAL_MSG_STATUS_SUCCESS = 0, /**< Success */ -+ MMAL_MSG_STATUS_ENOMEM, /**< Out of memory */ -+ MMAL_MSG_STATUS_ENOSPC, /**< Out of resources other than memory */ -+ MMAL_MSG_STATUS_EINVAL, /**< Argument is invalid */ -+ MMAL_MSG_STATUS_ENOSYS, /**< Function not implemented */ -+ MMAL_MSG_STATUS_ENOENT, /**< No such file or directory */ -+ MMAL_MSG_STATUS_ENXIO, /**< No such device or address */ -+ MMAL_MSG_STATUS_EIO, /**< I/O error */ -+ MMAL_MSG_STATUS_ESPIPE, /**< Illegal seek */ -+ MMAL_MSG_STATUS_ECORRUPT, /**< Data is corrupt \attention */ -+ MMAL_MSG_STATUS_ENOTREADY, /**< Component is not ready */ -+ MMAL_MSG_STATUS_ECONFIG, /**< Component is not configured */ -+ MMAL_MSG_STATUS_EISCONN, /**< Port is already connected */ -+ MMAL_MSG_STATUS_ENOTCONN, /**< Port is disconnected */ -+ MMAL_MSG_STATUS_EAGAIN, /**< Resource temporarily unavailable. */ -+ MMAL_MSG_STATUS_EFAULT, /**< Bad address */ -+}; -+ -+struct mmal_rect { -+ s32 x; /**< x coordinate (from left) */ -+ s32 y; /**< y coordinate (from top) */ -+ s32 width; /**< width */ -+ s32 height; /**< height */ -+}; -+ -+struct mmal_rational { -+ s32 num; /**< Numerator */ -+ s32 den; /**< Denominator */ -+}; -+ -+#endif /* MMAL_MSG_COMMON_H */ -diff --git a/drivers/media/platform/bcm2835/mmal-msg-format.h b/drivers/media/platform/bcm2835/mmal-msg-format.h -new file mode 100644 -index 0000000000000000000000000000000000000000..123d86ef582b0d059d1d5d14ba9add56b7365419 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg-format.h -@@ -0,0 +1,81 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#ifndef MMAL_MSG_FORMAT_H -+#define MMAL_MSG_FORMAT_H -+ -+#include "mmal-msg-common.h" -+ -+/* MMAL_ES_FORMAT_T */ -+ -+ -+struct mmal_audio_format { -+ u32 channels; /**< Number of audio channels */ -+ u32 sample_rate; /**< Sample rate */ -+ -+ u32 bits_per_sample; /**< Bits per sample */ -+ u32 block_align; /**< Size of a block of data */ -+}; -+ -+struct mmal_video_format { -+ u32 width; /**< Width of frame in pixels */ -+ u32 height; /**< Height of frame in rows of pixels */ -+ struct mmal_rect crop; /**< Visible region of the frame */ -+ struct mmal_rational frame_rate; /**< Frame rate */ -+ struct mmal_rational par; /**< Pixel aspect ratio */ -+ -+ /* FourCC specifying the color space of the video stream. See the -+ * \ref MmalColorSpace "pre-defined color spaces" for some examples. -+ */ -+ u32 color_space; -+}; -+ -+struct mmal_subpicture_format { -+ u32 x_offset; -+ u32 y_offset; -+}; -+ -+union mmal_es_specific_format { -+ struct mmal_audio_format audio; -+ struct mmal_video_format video; -+ struct mmal_subpicture_format subpicture; -+}; -+ -+/** Definition of an elementary stream format (MMAL_ES_FORMAT_T) */ -+struct mmal_es_format { -+ u32 type; /* enum mmal_es_type */ -+ -+ u32 encoding; /* FourCC specifying encoding of the elementary stream.*/ -+ u32 encoding_variant; /* FourCC specifying the specific -+ * encoding variant of the elementary -+ * stream. -+ */ -+ -+ union mmal_es_specific_format *es; /* TODO: pointers in -+ * message serialisation?!? -+ */ -+ /* Type specific -+ * information for the -+ * elementary stream -+ */ -+ -+ u32 bitrate; /**< Bitrate in bits per second */ -+ u32 flags; /**< Flags describing properties of the elementary stream. */ -+ -+ u32 extradata_size; /**< Size of the codec specific data */ -+ u8 *extradata; /**< Codec specific data */ -+}; -+ -+#endif /* MMAL_MSG_FORMAT_H */ -diff --git a/drivers/media/platform/bcm2835/mmal-msg-port.h b/drivers/media/platform/bcm2835/mmal-msg-port.h -new file mode 100644 -index 0000000000000000000000000000000000000000..a55c1ea2eceb190689910a6a84370f126b1e9cbb ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg-port.h -@@ -0,0 +1,107 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+/* MMAL_PORT_TYPE_T */ -+enum mmal_port_type { -+ MMAL_PORT_TYPE_UNKNOWN = 0, /**< Unknown port type */ -+ MMAL_PORT_TYPE_CONTROL, /**< Control port */ -+ MMAL_PORT_TYPE_INPUT, /**< Input port */ -+ MMAL_PORT_TYPE_OUTPUT, /**< Output port */ -+ MMAL_PORT_TYPE_CLOCK, /**< Clock port */ -+}; -+ -+/** The port is pass-through and doesn't need buffer headers allocated */ -+#define MMAL_PORT_CAPABILITY_PASSTHROUGH 0x01 -+/** The port wants to allocate the buffer payloads. -+ * This signals a preference that payload allocation should be done -+ * on this port for efficiency reasons. */ -+#define MMAL_PORT_CAPABILITY_ALLOCATION 0x02 -+/** The port supports format change events. -+ * This applies to input ports and is used to let the client know -+ * whether the port supports being reconfigured via a format -+ * change event (i.e. without having to disable the port). */ -+#define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE 0x04 -+ -+/* mmal port structure (MMAL_PORT_T) -+ * -+ * most elements are informational only, the pointer values for -+ * interogation messages are generally provided as additional -+ * strucures within the message. When used to set values only teh -+ * buffer_num, buffer_size and userdata parameters are writable. -+ */ -+struct mmal_port { -+ void *priv; /* Private member used by the framework */ -+ const char *name; /* Port name. Used for debugging purposes (RO) */ -+ -+ u32 type; /* Type of the port (RO) enum mmal_port_type */ -+ u16 index; /* Index of the port in its type list (RO) */ -+ u16 index_all; /* Index of the port in the list of all ports (RO) */ -+ -+ u32 is_enabled; /* Indicates whether the port is enabled or not (RO) */ -+ struct mmal_es_format *format; /* Format of the elementary stream */ -+ -+ u32 buffer_num_min; /* Minimum number of buffers the port -+ * requires (RO). This is set by the -+ * component. -+ */ -+ -+ u32 buffer_size_min; /* Minimum size of buffers the port -+ * requires (RO). This is set by the -+ * component. -+ */ -+ -+ u32 buffer_alignment_min; /* Minimum alignment requirement for -+ * the buffers (RO). A value of -+ * zero means no special alignment -+ * requirements. This is set by the -+ * component. -+ */ -+ -+ u32 buffer_num_recommended; /* Number of buffers the port -+ * recommends for optimal -+ * performance (RO). A value of -+ * zero means no special -+ * recommendation. This is set -+ * by the component. -+ */ -+ -+ u32 buffer_size_recommended; /* Size of buffers the port -+ * recommends for optimal -+ * performance (RO). A value of -+ * zero means no special -+ * recommendation. This is set -+ * by the component. -+ */ -+ -+ u32 buffer_num; /* Actual number of buffers the port will use. -+ * This is set by the client. -+ */ -+ -+ u32 buffer_size; /* Actual maximum size of the buffers that -+ * will be sent to the port. This is set by -+ * the client. -+ */ -+ -+ void *component; /* Component this port belongs to (Read Only) */ -+ -+ void *userdata; /* Field reserved for use by the client */ -+ -+ u32 capabilities; /* Flags describing the capabilities of a -+ * port (RO). Bitwise combination of \ref -+ * portcapabilities "Port capabilities" -+ * values. -+ */ -+ -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-msg.h b/drivers/media/platform/bcm2835/mmal-msg.h -new file mode 100644 -index 0000000000000000000000000000000000000000..67b1076015a54646eb0a3b956afdc97e75d2a39c ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg.h -@@ -0,0 +1,404 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+/* all the data structures which serialise the MMAL protocol. note -+ * these are directly mapped onto the recived message data. -+ * -+ * BEWARE: They seem to *assume* pointers are u32 and that there is no -+ * structure padding! -+ * -+ * NOTE: this implementation uses kernel types to ensure sizes. Rather -+ * than assigning values to enums to force their size the -+ * implementation uses fixed size types and not the enums (though the -+ * comments have the actual enum type -+ */ -+ -+#define VC_MMAL_VER 15 -+#define VC_MMAL_MIN_VER 10 -+#define VC_MMAL_SERVER_NAME MAKE_FOURCC("mmal") -+ -+/* max total message size is 512 bytes */ -+#define MMAL_MSG_MAX_SIZE 512 -+/* with six 32bit header elements max payload is therefore 488 bytes */ -+#define MMAL_MSG_MAX_PAYLOAD 488 -+ -+#include "mmal-msg-common.h" -+#include "mmal-msg-format.h" -+#include "mmal-msg-port.h" -+ -+enum mmal_msg_type { -+ MMAL_MSG_TYPE_QUIT = 1, -+ MMAL_MSG_TYPE_SERVICE_CLOSED, -+ MMAL_MSG_TYPE_GET_VERSION, -+ MMAL_MSG_TYPE_COMPONENT_CREATE, -+ MMAL_MSG_TYPE_COMPONENT_DESTROY, /* 5 */ -+ MMAL_MSG_TYPE_COMPONENT_ENABLE, -+ MMAL_MSG_TYPE_COMPONENT_DISABLE, -+ MMAL_MSG_TYPE_PORT_INFO_GET, -+ MMAL_MSG_TYPE_PORT_INFO_SET, -+ MMAL_MSG_TYPE_PORT_ACTION, /* 10 */ -+ MMAL_MSG_TYPE_BUFFER_FROM_HOST, -+ MMAL_MSG_TYPE_BUFFER_TO_HOST, -+ MMAL_MSG_TYPE_GET_STATS, -+ MMAL_MSG_TYPE_PORT_PARAMETER_SET, -+ MMAL_MSG_TYPE_PORT_PARAMETER_GET, /* 15 */ -+ MMAL_MSG_TYPE_EVENT_TO_HOST, -+ MMAL_MSG_TYPE_GET_CORE_STATS_FOR_PORT, -+ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR, -+ MMAL_MSG_TYPE_CONSUME_MEM, -+ MMAL_MSG_TYPE_LMK, /* 20 */ -+ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR_DESC, -+ MMAL_MSG_TYPE_DRM_GET_LHS32, -+ MMAL_MSG_TYPE_DRM_GET_TIME, -+ MMAL_MSG_TYPE_BUFFER_FROM_HOST_ZEROLEN, -+ MMAL_MSG_TYPE_PORT_FLUSH, /* 25 */ -+ MMAL_MSG_TYPE_HOST_LOG, -+ MMAL_MSG_TYPE_MSG_LAST -+}; -+ -+/* port action request messages differ depending on the action type */ -+enum mmal_msg_port_action_type { -+ MMAL_MSG_PORT_ACTION_TYPE_UNKNOWN = 0, /* Unkown action */ -+ MMAL_MSG_PORT_ACTION_TYPE_ENABLE, /* Enable a port */ -+ MMAL_MSG_PORT_ACTION_TYPE_DISABLE, /* Disable a port */ -+ MMAL_MSG_PORT_ACTION_TYPE_FLUSH, /* Flush a port */ -+ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, /* Connect ports */ -+ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, /* Disconnect ports */ -+ MMAL_MSG_PORT_ACTION_TYPE_SET_REQUIREMENTS, /* Set buffer requirements*/ -+}; -+ -+struct mmal_msg_header { -+ u32 magic; -+ u32 type; /** enum mmal_msg_type */ -+ -+ /* Opaque handle to the control service */ -+ struct mmal_control_service *control_service; -+ -+ struct mmal_msg_context *context; /** a u32 per message context */ -+ u32 status; /** The status of the vchiq operation */ -+ u32 padding; -+}; -+ -+/* Send from VC to host to report version */ -+struct mmal_msg_version { -+ u32 flags; -+ u32 major; -+ u32 minor; -+ u32 minimum; -+}; -+ -+/* request to VC to create component */ -+struct mmal_msg_component_create { -+ void *client_component; /* component context */ -+ char name[128]; -+ u32 pid; /* For debug */ -+}; -+ -+/* reply from VC to component creation request */ -+struct mmal_msg_component_create_reply { -+ u32 status; /** enum mmal_msg_status - how does this differ to -+ * the one in the header? -+ */ -+ u32 component_handle; /* VideoCore handle for component */ -+ u32 input_num; /* Number of input ports */ -+ u32 output_num; /* Number of output ports */ -+ u32 clock_num; /* Number of clock ports */ -+}; -+ -+/* request to VC to destroy a component */ -+struct mmal_msg_component_destroy { -+ u32 component_handle; -+}; -+ -+struct mmal_msg_component_destroy_reply { -+ u32 status; /** The component destruction status */ -+}; -+ -+ -+/* request and reply to VC to enable a component */ -+struct mmal_msg_component_enable { -+ u32 component_handle; -+}; -+ -+struct mmal_msg_component_enable_reply { -+ u32 status; /** The component enable status */ -+}; -+ -+ -+/* request and reply to VC to disable a component */ -+struct mmal_msg_component_disable { -+ u32 component_handle; -+}; -+ -+struct mmal_msg_component_disable_reply { -+ u32 status; /** The component disable status */ -+}; -+ -+/* request to VC to get port information */ -+struct mmal_msg_port_info_get { -+ u32 component_handle; /* component handle port is associated with */ -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 index; /* port index to query */ -+}; -+ -+/* reply from VC to get port info request */ -+struct mmal_msg_port_info_get_reply { -+ u32 status; /** enum mmal_msg_status */ -+ u32 component_handle; /* component handle port is associated with */ -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 port_index; /* port indexed in query */ -+ s32 found; /* unused */ -+ u32 port_handle; /**< Handle to use for this port */ -+ struct mmal_port port; -+ struct mmal_es_format format; /* elementry stream format */ -+ union mmal_es_specific_format es; /* es type specific data */ -+ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; /* es extra data */ -+}; -+ -+/* request to VC to set port information */ -+struct mmal_msg_port_info_set { -+ u32 component_handle; -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 port_index; /* port indexed in query */ -+ struct mmal_port port; -+ struct mmal_es_format format; -+ union mmal_es_specific_format es; -+ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; -+}; -+ -+/* reply from VC to port info set request */ -+struct mmal_msg_port_info_set_reply { -+ u32 status; -+ u32 component_handle; /* component handle port is associated with */ -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 index; /* port indexed in query */ -+ s32 found; /* unused */ -+ u32 port_handle; /**< Handle to use for this port */ -+ struct mmal_port port; -+ struct mmal_es_format format; -+ union mmal_es_specific_format es; -+ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; -+}; -+ -+ -+/* port action requests that take a mmal_port as a parameter */ -+struct mmal_msg_port_action_port { -+ u32 component_handle; -+ u32 port_handle; -+ u32 action; /* enum mmal_msg_port_action_type */ -+ struct mmal_port port; -+}; -+ -+/* port action requests that take handles as a parameter */ -+struct mmal_msg_port_action_handle { -+ u32 component_handle; -+ u32 port_handle; -+ u32 action; /* enum mmal_msg_port_action_type */ -+ u32 connect_component_handle; -+ u32 connect_port_handle; -+}; -+ -+struct mmal_msg_port_action_reply { -+ u32 status; /** The port action operation status */ -+}; -+ -+ -+ -+ -+/* MMAL buffer transfer */ -+ -+/** Size of space reserved in a buffer message for short messages. */ -+#define MMAL_VC_SHORT_DATA 128 -+ -+/** Signals that the current payload is the end of the stream of data */ -+#define MMAL_BUFFER_HEADER_FLAG_EOS (1<<0) -+/** Signals that the start of the current payload starts a frame */ -+#define MMAL_BUFFER_HEADER_FLAG_FRAME_START (1<<1) -+/** Signals that the end of the current payload ends a frame */ -+#define MMAL_BUFFER_HEADER_FLAG_FRAME_END (1<<2) -+/** Signals that the current payload contains only complete frames (>1) */ -+#define MMAL_BUFFER_HEADER_FLAG_FRAME \ -+ (MMAL_BUFFER_HEADER_FLAG_FRAME_START|MMAL_BUFFER_HEADER_FLAG_FRAME_END) -+/** Signals that the current payload is a keyframe (i.e. self decodable) */ -+#define MMAL_BUFFER_HEADER_FLAG_KEYFRAME (1<<3) -+/** Signals a discontinuity in the stream of data (e.g. after a seek). -+ * Can be used for instance by a decoder to reset its state */ -+#define MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY (1<<4) -+/** Signals a buffer containing some kind of config data for the component -+ * (e.g. codec config data) */ -+#define MMAL_BUFFER_HEADER_FLAG_CONFIG (1<<5) -+/** Signals an encrypted payload */ -+#define MMAL_BUFFER_HEADER_FLAG_ENCRYPTED (1<<6) -+/** Signals a buffer containing side information */ -+#define MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO (1<<7) -+/** Signals a buffer which is the snapshot/postview image from a stills -+ * capture -+ */ -+#define MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT (1<<8) -+/** Signals a buffer which contains data known to be corrupted */ -+#define MMAL_BUFFER_HEADER_FLAG_CORRUPTED (1<<9) -+/** Signals that a buffer failed to be transmitted */ -+#define MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED (1<<10) -+ -+struct mmal_driver_buffer { -+ u32 magic; -+ u32 component_handle; -+ u32 port_handle; -+ void *client_context; -+}; -+ -+/* buffer header */ -+struct mmal_buffer_header { -+ struct mmal_buffer_header *next; /* next header */ -+ void *priv; /* framework private data */ -+ u32 cmd; -+ void *data; -+ u32 alloc_size; -+ u32 length; -+ u32 offset; -+ u32 flags; -+ s64 pts; -+ s64 dts; -+ void *type; -+ void *user_data; -+}; -+ -+struct mmal_buffer_header_type_specific { -+ union { -+ struct { -+ u32 planes; -+ u32 offset[4]; -+ u32 pitch[4]; -+ u32 flags; -+ } video; -+ } u; -+}; -+ -+struct mmal_msg_buffer_from_host { -+ /* The front 32 bytes of the buffer header are copied -+ * back to us in the reply to allow for context. This -+ * area is used to store two mmal_driver_buffer structures to -+ * allow for multiple concurrent service users. -+ */ -+ /* control data */ -+ struct mmal_driver_buffer drvbuf; -+ -+ /* referenced control data for passthrough buffer management */ -+ struct mmal_driver_buffer drvbuf_ref; -+ struct mmal_buffer_header buffer_header; /* buffer header itself */ -+ struct mmal_buffer_header_type_specific buffer_header_type_specific; -+ s32 is_zero_copy; -+ s32 has_reference; -+ -+ /** allows short data to be xfered in control message */ -+ u32 payload_in_message; -+ u8 short_data[MMAL_VC_SHORT_DATA]; -+}; -+ -+ -+/* port parameter setting */ -+ -+#define MMAL_WORKER_PORT_PARAMETER_SPACE 96 -+ -+struct mmal_msg_port_parameter_set { -+ u32 component_handle; /* component */ -+ u32 port_handle; /* port */ -+ u32 id; /* Parameter ID */ -+ u32 size; /* Parameter size */ -+ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; -+}; -+ -+struct mmal_msg_port_parameter_set_reply { -+ u32 status; /** enum mmal_msg_status todo: how does this -+ * differ to the one in the header? -+ */ -+}; -+ -+/* port parameter getting */ -+ -+struct mmal_msg_port_parameter_get { -+ u32 component_handle; /* component */ -+ u32 port_handle; /* port */ -+ u32 id; /* Parameter ID */ -+ u32 size; /* Parameter size */ -+}; -+ -+struct mmal_msg_port_parameter_get_reply { -+ u32 status; /* Status of mmal_port_parameter_get call */ -+ u32 id; /* Parameter ID */ -+ u32 size; /* Parameter size */ -+ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; -+}; -+ -+/* event messages */ -+#define MMAL_WORKER_EVENT_SPACE 256 -+ -+struct mmal_msg_event_to_host { -+ void *client_component; /* component context */ -+ -+ u32 port_type; -+ u32 port_num; -+ -+ u32 cmd; -+ u32 length; -+ u8 data[MMAL_WORKER_EVENT_SPACE]; -+ struct mmal_buffer_header *delayed_buffer; -+}; -+ -+/* all mmal messages are serialised through this structure */ -+struct mmal_msg { -+ /* header */ -+ struct mmal_msg_header h; -+ /* payload */ -+ union { -+ struct mmal_msg_version version; -+ -+ struct mmal_msg_component_create component_create; -+ struct mmal_msg_component_create_reply component_create_reply; -+ -+ struct mmal_msg_component_destroy component_destroy; -+ struct mmal_msg_component_destroy_reply component_destroy_reply; -+ -+ struct mmal_msg_component_enable component_enable; -+ struct mmal_msg_component_enable_reply component_enable_reply; -+ -+ struct mmal_msg_component_disable component_disable; -+ struct mmal_msg_component_disable_reply component_disable_reply; -+ -+ struct mmal_msg_port_info_get port_info_get; -+ struct mmal_msg_port_info_get_reply port_info_get_reply; -+ -+ struct mmal_msg_port_info_set port_info_set; -+ struct mmal_msg_port_info_set_reply port_info_set_reply; -+ -+ struct mmal_msg_port_action_port port_action_port; -+ struct mmal_msg_port_action_handle port_action_handle; -+ struct mmal_msg_port_action_reply port_action_reply; -+ -+ struct mmal_msg_buffer_from_host buffer_from_host; -+ -+ struct mmal_msg_port_parameter_set port_parameter_set; -+ struct mmal_msg_port_parameter_set_reply -+ port_parameter_set_reply; -+ struct mmal_msg_port_parameter_get -+ port_parameter_get; -+ struct mmal_msg_port_parameter_get_reply -+ port_parameter_get_reply; -+ -+ struct mmal_msg_event_to_host event_to_host; -+ -+ u8 payload[MMAL_MSG_MAX_PAYLOAD]; -+ } u; -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-parameters.h b/drivers/media/platform/bcm2835/mmal-parameters.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f6abb5cfa49d58277fddfb40b7ad329518bd397f ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-parameters.h -@@ -0,0 +1,689 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+/* common parameters */ -+ -+/** @name Parameter groups -+ * Parameters are divided into groups, and then allocated sequentially within -+ * a group using an enum. -+ * @{ -+ */ -+ -+/** Common parameter ID group, used with many types of component. */ -+#define MMAL_PARAMETER_GROUP_COMMON (0<<16) -+/** Camera-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_CAMERA (1<<16) -+/** Video-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_VIDEO (2<<16) -+/** Audio-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_AUDIO (3<<16) -+/** Clock-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_CLOCK (4<<16) -+/** Miracast-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_MIRACAST (5<<16) -+ -+/* Common parameters */ -+enum mmal_parameter_common_type { -+ MMAL_PARAMETER_UNUSED /**< Never a valid parameter ID */ -+ = MMAL_PARAMETER_GROUP_COMMON, -+ MMAL_PARAMETER_SUPPORTED_ENCODINGS, /**< MMAL_PARAMETER_ENCODING_T */ -+ MMAL_PARAMETER_URI, /**< MMAL_PARAMETER_URI_T */ -+ -+ /** MMAL_PARAMETER_CHANGE_EVENT_REQUEST_T */ -+ MMAL_PARAMETER_CHANGE_EVENT_REQUEST, -+ -+ /** MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_ZERO_COPY, -+ -+ /**< MMAL_PARAMETER_BUFFER_REQUIREMENTS_T */ -+ MMAL_PARAMETER_BUFFER_REQUIREMENTS, -+ -+ MMAL_PARAMETER_STATISTICS, /**< MMAL_PARAMETER_STATISTICS_T */ -+ MMAL_PARAMETER_CORE_STATISTICS, /**< MMAL_PARAMETER_CORE_STATISTICS_T */ -+ MMAL_PARAMETER_MEM_USAGE, /**< MMAL_PARAMETER_MEM_USAGE_T */ -+ MMAL_PARAMETER_BUFFER_FLAG_FILTER, /**< MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_SEEK, /**< MMAL_PARAMETER_SEEK_T */ -+ MMAL_PARAMETER_POWERMON_ENABLE, /**< MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_LOGGING, /**< MMAL_PARAMETER_LOGGING_T */ -+ MMAL_PARAMETER_SYSTEM_TIME, /**< MMAL_PARAMETER_UINT64_T */ -+ MMAL_PARAMETER_NO_IMAGE_PADDING /**< MMAL_PARAMETER_BOOLEAN_T */ -+}; -+ -+/* camera parameters */ -+ -+enum mmal_parameter_camera_type { -+ /* 0 */ -+ /** @ref MMAL_PARAMETER_THUMBNAIL_CONFIG_T */ -+ MMAL_PARAMETER_THUMBNAIL_CONFIGURATION -+ = MMAL_PARAMETER_GROUP_CAMERA, -+ MMAL_PARAMETER_CAPTURE_QUALITY, /**< Unused? */ -+ MMAL_PARAMETER_ROTATION, /**< @ref MMAL_PARAMETER_INT32_T */ -+ MMAL_PARAMETER_EXIF_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_EXIF, /**< @ref MMAL_PARAMETER_EXIF_T */ -+ MMAL_PARAMETER_AWB_MODE, /**< @ref MMAL_PARAM_AWBMODE_T */ -+ MMAL_PARAMETER_IMAGE_EFFECT, /**< @ref MMAL_PARAMETER_IMAGEFX_T */ -+ MMAL_PARAMETER_COLOUR_EFFECT, /**< @ref MMAL_PARAMETER_COLOURFX_T */ -+ MMAL_PARAMETER_FLICKER_AVOID, /**< @ref MMAL_PARAMETER_FLICKERAVOID_T */ -+ MMAL_PARAMETER_FLASH, /**< @ref MMAL_PARAMETER_FLASH_T */ -+ MMAL_PARAMETER_REDEYE, /**< @ref MMAL_PARAMETER_REDEYE_T */ -+ MMAL_PARAMETER_FOCUS, /**< @ref MMAL_PARAMETER_FOCUS_T */ -+ MMAL_PARAMETER_FOCAL_LENGTHS, /**< Unused? */ -+ MMAL_PARAMETER_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ -+ MMAL_PARAMETER_ZOOM, /**< @ref MMAL_PARAMETER_SCALEFACTOR_T */ -+ MMAL_PARAMETER_MIRROR, /**< @ref MMAL_PARAMETER_MIRROR_T */ -+ -+ /* 0x10 */ -+ MMAL_PARAMETER_CAMERA_NUM, /**< @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_EXPOSURE_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMODE_T */ -+ MMAL_PARAMETER_EXP_METERING_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMETERINGMODE_T */ -+ MMAL_PARAMETER_FOCUS_STATUS, /**< @ref MMAL_PARAMETER_FOCUS_STATUS_T */ -+ MMAL_PARAMETER_CAMERA_CONFIG, /**< @ref MMAL_PARAMETER_CAMERA_CONFIG_T */ -+ MMAL_PARAMETER_CAPTURE_STATUS, /**< @ref MMAL_PARAMETER_CAPTURE_STATUS_T */ -+ MMAL_PARAMETER_FACE_TRACK, /**< @ref MMAL_PARAMETER_FACE_TRACK_T */ -+ MMAL_PARAMETER_DRAW_BOX_FACES_AND_FOCUS, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_JPEG_Q_FACTOR, /**< @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_FRAME_RATE, /**< @ref MMAL_PARAMETER_FRAME_RATE_T */ -+ MMAL_PARAMETER_USE_STC, /**< @ref MMAL_PARAMETER_CAMERA_STC_MODE_T */ -+ MMAL_PARAMETER_CAMERA_INFO, /**< @ref MMAL_PARAMETER_CAMERA_INFO_T */ -+ MMAL_PARAMETER_VIDEO_STABILISATION, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_FACE_TRACK_RESULTS, /**< @ref MMAL_PARAMETER_FACE_TRACK_RESULTS_T */ -+ MMAL_PARAMETER_ENABLE_RAW_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ -+ /* 0x20 */ -+ MMAL_PARAMETER_DPF_FILE, /**< @ref MMAL_PARAMETER_URI_T */ -+ MMAL_PARAMETER_ENABLE_DPF_FILE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_DPF_FAIL_IS_FATAL, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_CAPTURE_MODE, /**< @ref MMAL_PARAMETER_CAPTUREMODE_T */ -+ MMAL_PARAMETER_FOCUS_REGIONS, /**< @ref MMAL_PARAMETER_FOCUS_REGIONS_T */ -+ MMAL_PARAMETER_INPUT_CROP, /**< @ref MMAL_PARAMETER_INPUT_CROP_T */ -+ MMAL_PARAMETER_SENSOR_INFORMATION, /**< @ref MMAL_PARAMETER_SENSOR_INFORMATION_T */ -+ MMAL_PARAMETER_FLASH_SELECT, /**< @ref MMAL_PARAMETER_FLASH_SELECT_T */ -+ MMAL_PARAMETER_FIELD_OF_VIEW, /**< @ref MMAL_PARAMETER_FIELD_OF_VIEW_T */ -+ MMAL_PARAMETER_HIGH_DYNAMIC_RANGE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_DYNAMIC_RANGE_COMPRESSION, /**< @ref MMAL_PARAMETER_DRC_T */ -+ MMAL_PARAMETER_ALGORITHM_CONTROL, /**< @ref MMAL_PARAMETER_ALGORITHM_CONTROL_T */ -+ MMAL_PARAMETER_SHARPNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ MMAL_PARAMETER_CONTRAST, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ MMAL_PARAMETER_BRIGHTNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ MMAL_PARAMETER_SATURATION, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ -+ /* 0x30 */ -+ MMAL_PARAMETER_ISO, /**< @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_ANTISHAKE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ -+ /** @ref MMAL_PARAMETER_IMAGEFX_PARAMETERS_T */ -+ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_CAMERA_BURST_CAPTURE, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CAMERA_MIN_ISO, -+ -+ /** @ref MMAL_PARAMETER_CAMERA_USE_CASE_T */ -+ MMAL_PARAMETER_CAMERA_USE_CASE, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_CAPTURE_STATS_PASS, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CAMERA_CUSTOM_SENSOR_CONFIG, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_ENABLE_REGISTER_FILE, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_REGISTER_FAIL_IS_FATAL, -+ -+ /** @ref MMAL_PARAMETER_CONFIGFILE_T */ -+ MMAL_PARAMETER_CONFIGFILE_REGISTERS, -+ -+ /** @ref MMAL_PARAMETER_CONFIGFILE_CHUNK_T */ -+ MMAL_PARAMETER_CONFIGFILE_CHUNK_REGISTERS, -+ MMAL_PARAMETER_JPEG_ATTACH_LOG, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_ZERO_SHUTTER_LAG, /**< @ref MMAL_PARAMETER_ZEROSHUTTERLAG_T */ -+ MMAL_PARAMETER_FPS_RANGE, /**< @ref MMAL_PARAMETER_FPS_RANGE_T */ -+ MMAL_PARAMETER_CAPTURE_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ -+ -+ /* 0x40 */ -+ MMAL_PARAMETER_SW_SHARPEN_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_FLASH_REQUIRED, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_SW_SATURATION_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_SHUTTER_SPEED, /**< Takes a @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CUSTOM_AWB_GAINS, /**< Takes a @ref MMAL_PARAMETER_AWB_GAINS_T */ -+}; -+ -+struct mmal_parameter_rational { -+ s32 num; /**< Numerator */ -+ s32 den; /**< Denominator */ -+}; -+ -+enum mmal_parameter_camera_config_timestamp_mode { -+ MMAL_PARAM_TIMESTAMP_MODE_ZERO = 0, /* Always timestamp frames as 0 */ -+ MMAL_PARAM_TIMESTAMP_MODE_RAW_STC, /* Use the raw STC value -+ * for the frame timestamp -+ */ -+ MMAL_PARAM_TIMESTAMP_MODE_RESET_STC, /* Use the STC timestamp -+ * but subtract the -+ * timestamp of the first -+ * frame sent to give a -+ * zero based timestamp. -+ */ -+}; -+ -+struct mmal_parameter_fps_range { -+ /**< Low end of the permitted framerate range */ -+ struct mmal_parameter_rational fps_low; -+ /**< High end of the permitted framerate range */ -+ struct mmal_parameter_rational fps_high; -+}; -+ -+ -+/* camera configuration parameter */ -+struct mmal_parameter_camera_config { -+ /* Parameters for setting up the image pools */ -+ u32 max_stills_w; /* Max size of stills capture */ -+ u32 max_stills_h; -+ u32 stills_yuv422; /* Allow YUV422 stills capture */ -+ u32 one_shot_stills; /* Continuous or one shot stills captures. */ -+ -+ u32 max_preview_video_w; /* Max size of the preview or video -+ * capture frames -+ */ -+ u32 max_preview_video_h; -+ u32 num_preview_video_frames; -+ -+ /** Sets the height of the circular buffer for stills capture. */ -+ u32 stills_capture_circular_buffer_height; -+ -+ /** Allows preview/encode to resume as fast as possible after the stills -+ * input frame has been received, and then processes the still frame in -+ * the background whilst preview/encode has resumed. -+ * Actual mode is controlled by MMAL_PARAMETER_CAPTURE_MODE. -+ */ -+ u32 fast_preview_resume; -+ -+ /** Selects algorithm for timestamping frames if -+ * there is no clock component connected. -+ * enum mmal_parameter_camera_config_timestamp_mode -+ */ -+ s32 use_stc_timestamp; -+}; -+ -+ -+enum mmal_parameter_exposuremode { -+ MMAL_PARAM_EXPOSUREMODE_OFF, -+ MMAL_PARAM_EXPOSUREMODE_AUTO, -+ MMAL_PARAM_EXPOSUREMODE_NIGHT, -+ MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW, -+ MMAL_PARAM_EXPOSUREMODE_BACKLIGHT, -+ MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT, -+ MMAL_PARAM_EXPOSUREMODE_SPORTS, -+ MMAL_PARAM_EXPOSUREMODE_SNOW, -+ MMAL_PARAM_EXPOSUREMODE_BEACH, -+ MMAL_PARAM_EXPOSUREMODE_VERYLONG, -+ MMAL_PARAM_EXPOSUREMODE_FIXEDFPS, -+ MMAL_PARAM_EXPOSUREMODE_ANTISHAKE, -+ MMAL_PARAM_EXPOSUREMODE_FIREWORKS, -+}; -+ -+enum mmal_parameter_exposuremeteringmode { -+ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX, -+}; -+ -+enum mmal_parameter_awbmode { -+ MMAL_PARAM_AWBMODE_OFF, -+ MMAL_PARAM_AWBMODE_AUTO, -+ MMAL_PARAM_AWBMODE_SUNLIGHT, -+ MMAL_PARAM_AWBMODE_CLOUDY, -+ MMAL_PARAM_AWBMODE_SHADE, -+ MMAL_PARAM_AWBMODE_TUNGSTEN, -+ MMAL_PARAM_AWBMODE_FLUORESCENT, -+ MMAL_PARAM_AWBMODE_INCANDESCENT, -+ MMAL_PARAM_AWBMODE_FLASH, -+ MMAL_PARAM_AWBMODE_HORIZON, -+}; -+ -+enum mmal_parameter_imagefx { -+ MMAL_PARAM_IMAGEFX_NONE, -+ MMAL_PARAM_IMAGEFX_NEGATIVE, -+ MMAL_PARAM_IMAGEFX_SOLARIZE, -+ MMAL_PARAM_IMAGEFX_POSTERIZE, -+ MMAL_PARAM_IMAGEFX_WHITEBOARD, -+ MMAL_PARAM_IMAGEFX_BLACKBOARD, -+ MMAL_PARAM_IMAGEFX_SKETCH, -+ MMAL_PARAM_IMAGEFX_DENOISE, -+ MMAL_PARAM_IMAGEFX_EMBOSS, -+ MMAL_PARAM_IMAGEFX_OILPAINT, -+ MMAL_PARAM_IMAGEFX_HATCH, -+ MMAL_PARAM_IMAGEFX_GPEN, -+ MMAL_PARAM_IMAGEFX_PASTEL, -+ MMAL_PARAM_IMAGEFX_WATERCOLOUR, -+ MMAL_PARAM_IMAGEFX_FILM, -+ MMAL_PARAM_IMAGEFX_BLUR, -+ MMAL_PARAM_IMAGEFX_SATURATION, -+ MMAL_PARAM_IMAGEFX_COLOURSWAP, -+ MMAL_PARAM_IMAGEFX_WASHEDOUT, -+ MMAL_PARAM_IMAGEFX_POSTERISE, -+ MMAL_PARAM_IMAGEFX_COLOURPOINT, -+ MMAL_PARAM_IMAGEFX_COLOURBALANCE, -+ MMAL_PARAM_IMAGEFX_CARTOON, -+}; -+ -+enum MMAL_PARAM_FLICKERAVOID_T { -+ MMAL_PARAM_FLICKERAVOID_OFF, -+ MMAL_PARAM_FLICKERAVOID_AUTO, -+ MMAL_PARAM_FLICKERAVOID_50HZ, -+ MMAL_PARAM_FLICKERAVOID_60HZ, -+ MMAL_PARAM_FLICKERAVOID_MAX = 0x7FFFFFFF -+}; -+ -+struct mmal_parameter_awbgains { -+ struct mmal_parameter_rational r_gain; /**< Red gain */ -+ struct mmal_parameter_rational b_gain; /**< Blue gain */ -+}; -+ -+/** Manner of video rate control */ -+enum mmal_parameter_rate_control_mode { -+ MMAL_VIDEO_RATECONTROL_DEFAULT, -+ MMAL_VIDEO_RATECONTROL_VARIABLE, -+ MMAL_VIDEO_RATECONTROL_CONSTANT, -+ MMAL_VIDEO_RATECONTROL_VARIABLE_SKIP_FRAMES, -+ MMAL_VIDEO_RATECONTROL_CONSTANT_SKIP_FRAMES -+}; -+ -+enum mmal_video_profile { -+ MMAL_VIDEO_PROFILE_H263_BASELINE, -+ MMAL_VIDEO_PROFILE_H263_H320CODING, -+ MMAL_VIDEO_PROFILE_H263_BACKWARDCOMPATIBLE, -+ MMAL_VIDEO_PROFILE_H263_ISWV2, -+ MMAL_VIDEO_PROFILE_H263_ISWV3, -+ MMAL_VIDEO_PROFILE_H263_HIGHCOMPRESSION, -+ MMAL_VIDEO_PROFILE_H263_INTERNET, -+ MMAL_VIDEO_PROFILE_H263_INTERLACE, -+ MMAL_VIDEO_PROFILE_H263_HIGHLATENCY, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLE, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLESCALABLE, -+ MMAL_VIDEO_PROFILE_MP4V_CORE, -+ MMAL_VIDEO_PROFILE_MP4V_MAIN, -+ MMAL_VIDEO_PROFILE_MP4V_NBIT, -+ MMAL_VIDEO_PROFILE_MP4V_SCALABLETEXTURE, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFACE, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFBA, -+ MMAL_VIDEO_PROFILE_MP4V_BASICANIMATED, -+ MMAL_VIDEO_PROFILE_MP4V_HYBRID, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDREALTIME, -+ MMAL_VIDEO_PROFILE_MP4V_CORESCALABLE, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCODING, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCORE, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSCALABLE, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSIMPLE, -+ MMAL_VIDEO_PROFILE_H264_BASELINE, -+ MMAL_VIDEO_PROFILE_H264_MAIN, -+ MMAL_VIDEO_PROFILE_H264_EXTENDED, -+ MMAL_VIDEO_PROFILE_H264_HIGH, -+ MMAL_VIDEO_PROFILE_H264_HIGH10, -+ MMAL_VIDEO_PROFILE_H264_HIGH422, -+ MMAL_VIDEO_PROFILE_H264_HIGH444, -+ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE, -+ MMAL_VIDEO_PROFILE_DUMMY = 0x7FFFFFFF -+}; -+ -+enum mmal_video_level { -+ MMAL_VIDEO_LEVEL_H263_10, -+ MMAL_VIDEO_LEVEL_H263_20, -+ MMAL_VIDEO_LEVEL_H263_30, -+ MMAL_VIDEO_LEVEL_H263_40, -+ MMAL_VIDEO_LEVEL_H263_45, -+ MMAL_VIDEO_LEVEL_H263_50, -+ MMAL_VIDEO_LEVEL_H263_60, -+ MMAL_VIDEO_LEVEL_H263_70, -+ MMAL_VIDEO_LEVEL_MP4V_0, -+ MMAL_VIDEO_LEVEL_MP4V_0b, -+ MMAL_VIDEO_LEVEL_MP4V_1, -+ MMAL_VIDEO_LEVEL_MP4V_2, -+ MMAL_VIDEO_LEVEL_MP4V_3, -+ MMAL_VIDEO_LEVEL_MP4V_4, -+ MMAL_VIDEO_LEVEL_MP4V_4a, -+ MMAL_VIDEO_LEVEL_MP4V_5, -+ MMAL_VIDEO_LEVEL_MP4V_6, -+ MMAL_VIDEO_LEVEL_H264_1, -+ MMAL_VIDEO_LEVEL_H264_1b, -+ MMAL_VIDEO_LEVEL_H264_11, -+ MMAL_VIDEO_LEVEL_H264_12, -+ MMAL_VIDEO_LEVEL_H264_13, -+ MMAL_VIDEO_LEVEL_H264_2, -+ MMAL_VIDEO_LEVEL_H264_21, -+ MMAL_VIDEO_LEVEL_H264_22, -+ MMAL_VIDEO_LEVEL_H264_3, -+ MMAL_VIDEO_LEVEL_H264_31, -+ MMAL_VIDEO_LEVEL_H264_32, -+ MMAL_VIDEO_LEVEL_H264_4, -+ MMAL_VIDEO_LEVEL_H264_41, -+ MMAL_VIDEO_LEVEL_H264_42, -+ MMAL_VIDEO_LEVEL_H264_5, -+ MMAL_VIDEO_LEVEL_H264_51, -+ MMAL_VIDEO_LEVEL_DUMMY = 0x7FFFFFFF -+}; -+ -+struct mmal_parameter_video_profile { -+ enum mmal_video_profile profile; -+ enum mmal_video_level level; -+}; -+ -+/* video parameters */ -+ -+enum mmal_parameter_video_type { -+ /** @ref MMAL_DISPLAYREGION_T */ -+ MMAL_PARAMETER_DISPLAYREGION = MMAL_PARAMETER_GROUP_VIDEO, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ -+ MMAL_PARAMETER_SUPPORTED_PROFILES, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ -+ MMAL_PARAMETER_PROFILE, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_INTRAPERIOD, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_RATECONTROL_T */ -+ MMAL_PARAMETER_RATECONTROL, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_NALUNITFORMAT_T */ -+ MMAL_PARAMETER_NALUNITFORMAT, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. -+ * Setting the value to zero resets to the default (one slice per frame). -+ */ -+ MMAL_PARAMETER_MB_ROWS_PER_SLICE, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION_T */ -+ MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_EEDE_ENABLE_T */ -+ MMAL_PARAMETER_VIDEO_EEDE_ENABLE, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE_T */ -+ MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. Request an I-frame. */ -+ MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME, -+ /** @ref MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T */ -+ MMAL_PARAMETER_VIDEO_INTRA_REFRESH, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. Run-time bit rate control */ -+ MMAL_PARAMETER_VIDEO_BIT_RATE, -+ -+ /** @ref MMAL_PARAMETER_FRAME_RATE_T */ -+ MMAL_PARAMETER_VIDEO_FRAME_RATE, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_MIN_QUANT, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_MAX_QUANT, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL, -+ -+ MMAL_PARAMETER_EXTRA_BUFFERS, /**< @ref MMAL_PARAMETER_UINT32_T. */ -+ /** @ref MMAL_PARAMETER_UINT32_T. -+ * Changing this parameter from the default can reduce frame rate -+ * because image buffers need to be re-pitched. -+ */ -+ MMAL_PARAMETER_VIDEO_ALIGN_HORIZ, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. -+ * Changing this parameter from the default can reduce frame rate -+ * because image buffers need to be re-pitched. -+ */ -+ MMAL_PARAMETER_VIDEO_ALIGN_VERT, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_DROPPABLE_PFRAMES, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_INITIAL_QUANT, -+ -+ /**< @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_QP_P, -+ -+ /**< @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_RC_SLICE_DQUANT, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_FRAME_LIMIT_BITS, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_PEAK_RATE, -+ -+ /* H264 specific parameters */ -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_DISABLE_CABAC, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_LATENCY, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_AU_DELIMITERS, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_DEBLOCK_IDC, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_ENCODER_H264_MB_INTRA_MODES_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_MB_INTRA_MODE, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_HEADER_ON_OPEN, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_PRECODE_FOR_QP, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_DRM_INIT_INFO_T. */ -+ MMAL_PARAMETER_VIDEO_DRM_INIT_INFO, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_TIMESTAMP_FIFO, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER_T. */ -+ MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER, -+ -+ /** @ref MMAL_PARAMETER_BYTES_T */ -+ MMAL_PARAMETER_VIDEO_DECODE_CONFIG_VD3, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_VCL_HRD_PARAMETERS, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_DELAY_HRD_FLAG, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER -+}; -+ -+/** Valid mirror modes */ -+enum mmal_parameter_mirror { -+ MMAL_PARAM_MIRROR_NONE, -+ MMAL_PARAM_MIRROR_VERTICAL, -+ MMAL_PARAM_MIRROR_HORIZONTAL, -+ MMAL_PARAM_MIRROR_BOTH, -+}; -+ -+enum mmal_parameter_displaytransform { -+ MMAL_DISPLAY_ROT0 = 0, -+ MMAL_DISPLAY_MIRROR_ROT0 = 1, -+ MMAL_DISPLAY_MIRROR_ROT180 = 2, -+ MMAL_DISPLAY_ROT180 = 3, -+ MMAL_DISPLAY_MIRROR_ROT90 = 4, -+ MMAL_DISPLAY_ROT270 = 5, -+ MMAL_DISPLAY_ROT90 = 6, -+ MMAL_DISPLAY_MIRROR_ROT270 = 7, -+}; -+ -+enum mmal_parameter_displaymode { -+ MMAL_DISPLAY_MODE_FILL = 0, -+ MMAL_DISPLAY_MODE_LETTERBOX = 1, -+}; -+ -+enum mmal_parameter_displayset { -+ MMAL_DISPLAY_SET_NONE = 0, -+ MMAL_DISPLAY_SET_NUM = 1, -+ MMAL_DISPLAY_SET_FULLSCREEN = 2, -+ MMAL_DISPLAY_SET_TRANSFORM = 4, -+ MMAL_DISPLAY_SET_DEST_RECT = 8, -+ MMAL_DISPLAY_SET_SRC_RECT = 0x10, -+ MMAL_DISPLAY_SET_MODE = 0x20, -+ MMAL_DISPLAY_SET_PIXEL = 0x40, -+ MMAL_DISPLAY_SET_NOASPECT = 0x80, -+ MMAL_DISPLAY_SET_LAYER = 0x100, -+ MMAL_DISPLAY_SET_COPYPROTECT = 0x200, -+ MMAL_DISPLAY_SET_ALPHA = 0x400, -+}; -+ -+struct mmal_parameter_displayregion { -+ /** Bitfield that indicates which fields are set and should be -+ * used. All other fields will maintain their current value. -+ * \ref MMAL_DISPLAYSET_T defines the bits that can be -+ * combined. -+ */ -+ u32 set; -+ -+ /** Describes the display output device, with 0 typically -+ * being a directly connected LCD display. The actual values -+ * will depend on the hardware. Code using hard-wired numbers -+ * (e.g. 2) is certain to fail. -+ */ -+ -+ u32 display_num; -+ /** Indicates that we are using the full device screen area, -+ * rather than a window of the display. If zero, then -+ * dest_rect is used to specify a region of the display to -+ * use. -+ */ -+ -+ s32 fullscreen; -+ /** Indicates any rotation or flipping used to map frames onto -+ * the natural display orientation. -+ */ -+ u32 transform; /* enum mmal_parameter_displaytransform */ -+ -+ /** Where to display the frame within the screen, if -+ * fullscreen is zero. -+ */ -+ struct vchiq_mmal_rect dest_rect; -+ -+ /** Indicates which area of the frame to display. If all -+ * values are zero, the whole frame will be used. -+ */ -+ struct vchiq_mmal_rect src_rect; -+ -+ /** If set to non-zero, indicates that any display scaling -+ * should disregard the aspect ratio of the frame region being -+ * displayed. -+ */ -+ s32 noaspect; -+ -+ /** Indicates how the image should be scaled to fit the -+ * display. \code MMAL_DISPLAY_MODE_FILL \endcode indicates -+ * that the image should fill the screen by potentially -+ * cropping the frames. Setting \code mode \endcode to \code -+ * MMAL_DISPLAY_MODE_LETTERBOX \endcode indicates that all the -+ * source region should be displayed and black bars added if -+ * necessary. -+ */ -+ u32 mode; /* enum mmal_parameter_displaymode */ -+ -+ /** If non-zero, defines the width of a source pixel relative -+ * to \code pixel_y \endcode. If zero, then pixels default to -+ * being square. -+ */ -+ u32 pixel_x; -+ -+ /** If non-zero, defines the height of a source pixel relative -+ * to \code pixel_x \endcode. If zero, then pixels default to -+ * being square. -+ */ -+ u32 pixel_y; -+ -+ /** Sets the relative depth of the images, with greater values -+ * being in front of smaller values. -+ */ -+ u32 layer; -+ -+ /** Set to non-zero to ensure copy protection is used on -+ * output. -+ */ -+ s32 copyprotect_required; -+ -+ /** Level of opacity of the layer, where zero is fully -+ * transparent and 255 is fully opaque. -+ */ -+ u32 alpha; -+}; -+ -+#define MMAL_MAX_IMAGEFX_PARAMETERS 5 -+ -+struct mmal_parameter_imagefx_parameters { -+ enum mmal_parameter_imagefx effect; -+ u32 num_effect_params; -+ u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS]; -+}; -+ -+#define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4 -+#define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 -+#define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 -+ -+struct mmal_parameter_camera_info_camera_t { -+ u32 port_id; -+ u32 max_width; -+ u32 max_height; -+ u32 lens_present; -+ u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; -+}; -+ -+enum mmal_parameter_camera_info_flash_type_t { -+ /* Make values explicit to ensure they match values in config ini */ -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2, -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF -+}; -+ -+struct mmal_parameter_camera_info_flash_t { -+ enum mmal_parameter_camera_info_flash_type_t flash_type; -+}; -+ -+struct mmal_parameter_camera_info_t { -+ u32 num_cameras; -+ u32 num_flashes; -+ struct mmal_parameter_camera_info_camera_t -+ cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; -+ struct mmal_parameter_camera_info_flash_t -+ flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c -new file mode 100644 -index 0000000000000000000000000000000000000000..781322542d5a8295f3d7d5a3eaaf0cac29930c30 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-vchiq.c -@@ -0,0 +1,1916 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * V4L2 driver MMAL vchiq interface code -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mmal-common.h" -+#include "mmal-vchiq.h" -+#include "mmal-msg.h" -+ -+#define USE_VCHIQ_ARM -+#include "interface/vchi/vchi.h" -+ -+/* maximum number of components supported */ -+#define VCHIQ_MMAL_MAX_COMPONENTS 4 -+ -+/*#define FULL_MSG_DUMP 1*/ -+ -+#ifdef DEBUG -+static const char *const msg_type_names[] = { -+ "UNKNOWN", -+ "QUIT", -+ "SERVICE_CLOSED", -+ "GET_VERSION", -+ "COMPONENT_CREATE", -+ "COMPONENT_DESTROY", -+ "COMPONENT_ENABLE", -+ "COMPONENT_DISABLE", -+ "PORT_INFO_GET", -+ "PORT_INFO_SET", -+ "PORT_ACTION", -+ "BUFFER_FROM_HOST", -+ "BUFFER_TO_HOST", -+ "GET_STATS", -+ "PORT_PARAMETER_SET", -+ "PORT_PARAMETER_GET", -+ "EVENT_TO_HOST", -+ "GET_CORE_STATS_FOR_PORT", -+ "OPAQUE_ALLOCATOR", -+ "CONSUME_MEM", -+ "LMK", -+ "OPAQUE_ALLOCATOR_DESC", -+ "DRM_GET_LHS32", -+ "DRM_GET_TIME", -+ "BUFFER_FROM_HOST_ZEROLEN", -+ "PORT_FLUSH", -+ "HOST_LOG", -+}; -+#endif -+ -+static const char *const port_action_type_names[] = { -+ "UNKNOWN", -+ "ENABLE", -+ "DISABLE", -+ "FLUSH", -+ "CONNECT", -+ "DISCONNECT", -+ "SET_REQUIREMENTS", -+}; -+ -+#if defined(DEBUG) -+#if defined(FULL_MSG_DUMP) -+#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ -+ do { \ -+ pr_debug(TITLE" type:%s(%d) length:%d\n", \ -+ msg_type_names[(MSG)->h.type], \ -+ (MSG)->h.type, (MSG_LEN)); \ -+ print_hex_dump(KERN_DEBUG, "<h.type], \ -+ (MSG)->h.type, (MSG_LEN)); \ -+ } -+#endif -+#else -+#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) -+#endif -+ -+/* normal message context */ -+struct mmal_msg_context { -+ union { -+ struct { -+ /* work struct for defered callback - must come first */ -+ struct work_struct work; -+ /* mmal instance */ -+ struct vchiq_mmal_instance *instance; -+ /* mmal port */ -+ struct vchiq_mmal_port *port; -+ /* actual buffer used to store bulk reply */ -+ struct mmal_buffer *buffer; -+ /* amount of buffer used */ -+ unsigned long buffer_used; -+ /* MMAL buffer flags */ -+ u32 mmal_flags; -+ /* Presentation and Decode timestamps */ -+ s64 pts; -+ s64 dts; -+ -+ int status; /* context status */ -+ -+ } bulk; /* bulk data */ -+ -+ struct { -+ /* message handle to release */ -+ VCHI_HELD_MSG_T msg_handle; -+ /* pointer to received message */ -+ struct mmal_msg *msg; -+ /* received message length */ -+ u32 msg_len; -+ /* completion upon reply */ -+ struct completion cmplt; -+ } sync; /* synchronous response */ -+ } u; -+ -+}; -+ -+struct vchiq_mmal_instance { -+ VCHI_SERVICE_HANDLE_T handle; -+ -+ /* ensure serialised access to service */ -+ struct mutex vchiq_mutex; -+ -+ /* ensure serialised access to bulk operations */ -+ struct mutex bulk_mutex; -+ -+ /* vmalloc page to receive scratch bulk xfers into */ -+ void *bulk_scratch; -+ -+ /* component to use next */ -+ int component_idx; -+ struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; -+}; -+ -+static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_instance -+ *instance) -+{ -+ struct mmal_msg_context *msg_context; -+ -+ /* todo: should this be allocated from a pool to avoid kmalloc */ -+ msg_context = kmalloc(sizeof(*msg_context), GFP_KERNEL); -+ memset(msg_context, 0, sizeof(*msg_context)); -+ -+ return msg_context; -+} -+ -+static void release_msg_context(struct mmal_msg_context *msg_context) -+{ -+ kfree(msg_context); -+} -+ -+/* deals with receipt of event to host message */ -+static void event_to_host_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, u32 msg_len) -+{ -+ pr_debug("unhandled event\n"); -+ pr_debug("component:%p port type:%d num:%d cmd:0x%x length:%d\n", -+ msg->u.event_to_host.client_component, -+ msg->u.event_to_host.port_type, -+ msg->u.event_to_host.port_num, -+ msg->u.event_to_host.cmd, msg->u.event_to_host.length); -+} -+ -+/* workqueue scheduled callback -+ * -+ * we do this because it is important we do not call any other vchiq -+ * sync calls from witin the message delivery thread -+ */ -+static void buffer_work_cb(struct work_struct *work) -+{ -+ struct mmal_msg_context *msg_context = (struct mmal_msg_context *)work; -+ -+ msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, -+ msg_context->u.bulk.port, -+ msg_context->u.bulk.status, -+ msg_context->u.bulk.buffer, -+ msg_context->u.bulk.buffer_used, -+ msg_context->u.bulk.mmal_flags, -+ msg_context->u.bulk.dts, -+ msg_context->u.bulk.pts); -+ -+ /* release message context */ -+ release_msg_context(msg_context); -+} -+ -+/* enqueue a bulk receive for a given message context */ -+static int bulk_receive(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, -+ struct mmal_msg_context *msg_context) -+{ -+ unsigned long rd_len; -+ unsigned long flags = 0; -+ int ret; -+ -+ /* bulk mutex stops other bulk operations while we have a -+ * receive in progress - released in callback -+ */ -+ ret = mutex_lock_interruptible(&instance->bulk_mutex); -+ if (ret != 0) -+ return ret; -+ -+ rd_len = msg->u.buffer_from_host.buffer_header.length; -+ -+ /* take buffer from queue */ -+ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); -+ if (list_empty(&msg_context->u.bulk.port->buffers)) { -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ pr_err("buffer list empty trying to submit bulk receive\n"); -+ -+ /* todo: this is a serious error, we should never have -+ * commited a buffer_to_host operation to the mmal -+ * port without the buffer to back it up (underflow -+ * handling) and there is no obvious way to deal with -+ * this - how is the mmal servie going to react when -+ * we fail to do the xfer and reschedule a buffer when -+ * it arrives? perhaps a starved flag to indicate a -+ * waiting bulk receive? -+ */ -+ -+ mutex_unlock(&instance->bulk_mutex); -+ -+ return -EINVAL; -+ } -+ -+ msg_context->u.bulk.buffer = -+ list_entry(msg_context->u.bulk.port->buffers.next, -+ struct mmal_buffer, list); -+ list_del(&msg_context->u.bulk.buffer->list); -+ -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ -+ /* ensure we do not overrun the available buffer */ -+ if (rd_len > msg_context->u.bulk.buffer->buffer_size) { -+ rd_len = msg_context->u.bulk.buffer->buffer_size; -+ pr_warn("short read as not enough receive buffer space\n"); -+ /* todo: is this the correct response, what happens to -+ * the rest of the message data? -+ */ -+ } -+ -+ /* store length */ -+ msg_context->u.bulk.buffer_used = rd_len; -+ msg_context->u.bulk.mmal_flags = -+ msg->u.buffer_from_host.buffer_header.flags; -+ msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; -+ msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; -+ -+ // only need to flush L1 cache here, as VCHIQ takes care of the L2 -+ // cache. -+ __cpuc_flush_dcache_area(msg_context->u.bulk.buffer->buffer, rd_len); -+ -+ /* queue the bulk submission */ -+ vchi_service_use(instance->handle); -+ ret = vchi_bulk_queue_receive(instance->handle, -+ msg_context->u.bulk.buffer->buffer, -+ /* Actual receive needs to be a multiple -+ * of 4 bytes -+ */ -+ (rd_len + 3) & ~3, -+ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, -+ msg_context); -+ -+ vchi_service_release(instance->handle); -+ -+ if (ret != 0) { -+ /* callback will not be clearing the mutex */ -+ mutex_unlock(&instance->bulk_mutex); -+ } -+ -+ return ret; -+} -+ -+/* enque a dummy bulk receive for a given message context */ -+static int dummy_bulk_receive(struct vchiq_mmal_instance *instance, -+ struct mmal_msg_context *msg_context) -+{ -+ int ret; -+ -+ /* bulk mutex stops other bulk operations while we have a -+ * receive in progress - released in callback -+ */ -+ ret = mutex_lock_interruptible(&instance->bulk_mutex); -+ if (ret != 0) -+ return ret; -+ -+ /* zero length indicates this was a dummy transfer */ -+ msg_context->u.bulk.buffer_used = 0; -+ -+ /* queue the bulk submission */ -+ vchi_service_use(instance->handle); -+ -+ ret = vchi_bulk_queue_receive(instance->handle, -+ instance->bulk_scratch, -+ 8, -+ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, -+ msg_context); -+ -+ vchi_service_release(instance->handle); -+ -+ if (ret != 0) { -+ /* callback will not be clearing the mutex */ -+ mutex_unlock(&instance->bulk_mutex); -+ } -+ -+ return ret; -+} -+ -+/* data in message, memcpy from packet into output buffer */ -+static int inline_receive(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, -+ struct mmal_msg_context *msg_context) -+{ -+ unsigned long flags = 0; -+ -+ /* take buffer from queue */ -+ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); -+ if (list_empty(&msg_context->u.bulk.port->buffers)) { -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ pr_err("buffer list empty trying to receive inline\n"); -+ -+ /* todo: this is a serious error, we should never have -+ * commited a buffer_to_host operation to the mmal -+ * port without the buffer to back it up (with -+ * underflow handling) and there is no obvious way to -+ * deal with this. Less bad than the bulk case as we -+ * can just drop this on the floor but...unhelpful -+ */ -+ return -EINVAL; -+ } -+ -+ msg_context->u.bulk.buffer = -+ list_entry(msg_context->u.bulk.port->buffers.next, -+ struct mmal_buffer, list); -+ list_del(&msg_context->u.bulk.buffer->list); -+ -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ -+ memcpy(msg_context->u.bulk.buffer->buffer, -+ msg->u.buffer_from_host.short_data, -+ msg->u.buffer_from_host.payload_in_message); -+ -+ msg_context->u.bulk.buffer_used = -+ msg->u.buffer_from_host.payload_in_message; -+ -+ return 0; -+} -+ -+/* queue the buffer availability with MMAL_MSG_TYPE_BUFFER_FROM_HOST */ -+static int -+buffer_from_host(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, struct mmal_buffer *buf) -+{ -+ struct mmal_msg_context *msg_context; -+ struct mmal_msg m; -+ int ret; -+ -+ pr_debug("instance:%p buffer:%p\n", instance->handle, buf); -+ -+ /* bulk mutex stops other bulk operations while we -+ * have a receive in progress -+ */ -+ if (mutex_lock_interruptible(&instance->bulk_mutex)) -+ return -EINTR; -+ -+ /* get context */ -+ msg_context = get_msg_context(instance); -+ if (msg_context == NULL) -+ return -ENOMEM; -+ -+ /* store bulk message context for when data arrives */ -+ msg_context->u.bulk.instance = instance; -+ msg_context->u.bulk.port = port; -+ msg_context->u.bulk.buffer = NULL; /* not valid until bulk xfer */ -+ msg_context->u.bulk.buffer_used = 0; -+ -+ /* initialise work structure ready to schedule callback */ -+ INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); -+ -+ /* prep the buffer from host message */ -+ memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ -+ -+ m.h.type = MMAL_MSG_TYPE_BUFFER_FROM_HOST; -+ m.h.magic = MMAL_MAGIC; -+ m.h.context = msg_context; -+ m.h.status = 0; -+ -+ /* drvbuf is our private data passed back */ -+ m.u.buffer_from_host.drvbuf.magic = MMAL_MAGIC; -+ m.u.buffer_from_host.drvbuf.component_handle = port->component->handle; -+ m.u.buffer_from_host.drvbuf.port_handle = port->handle; -+ m.u.buffer_from_host.drvbuf.client_context = msg_context; -+ -+ /* buffer header */ -+ m.u.buffer_from_host.buffer_header.cmd = 0; -+ m.u.buffer_from_host.buffer_header.data = buf->buffer; -+ m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; -+ m.u.buffer_from_host.buffer_header.length = 0; /* nothing used yet */ -+ m.u.buffer_from_host.buffer_header.offset = 0; /* no offset */ -+ m.u.buffer_from_host.buffer_header.flags = 0; /* no flags */ -+ m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN; -+ m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN; -+ -+ /* clear buffer type sepecific data */ -+ memset(&m.u.buffer_from_host.buffer_header_type_specific, 0, -+ sizeof(m.u.buffer_from_host.buffer_header_type_specific)); -+ -+ /* no payload in message */ -+ m.u.buffer_from_host.payload_in_message = 0; -+ -+ vchi_service_use(instance->handle); -+ -+ ret = vchi_msg_queue(instance->handle, &m, -+ sizeof(struct mmal_msg_header) + -+ sizeof(m.u.buffer_from_host), -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (ret != 0) { -+ release_msg_context(msg_context); -+ /* todo: is this correct error value? */ -+ } -+ -+ vchi_service_release(instance->handle); -+ -+ mutex_unlock(&instance->bulk_mutex); -+ -+ return ret; -+} -+ -+/* submit a buffer to the mmal sevice -+ * -+ * the buffer_from_host uses size data from the ports next available -+ * mmal_buffer and deals with there being no buffer available by -+ * incrementing the underflow for later -+ */ -+static int port_buffer_from_host(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_buffer *buf; -+ unsigned long flags = 0; -+ -+ if (!port->enabled) -+ return -EINVAL; -+ -+ /* peek buffer from queue */ -+ spin_lock_irqsave(&port->slock, flags); -+ if (list_empty(&port->buffers)) { -+ port->buffer_underflow++; -+ spin_unlock_irqrestore(&port->slock, flags); -+ return -ENOSPC; -+ } -+ -+ buf = list_entry(port->buffers.next, struct mmal_buffer, list); -+ -+ spin_unlock_irqrestore(&port->slock, flags); -+ -+ /* issue buffer to mmal service */ -+ ret = buffer_from_host(instance, port, buf); -+ if (ret) { -+ pr_err("adding buffer header failed\n"); -+ /* todo: how should this be dealt with */ -+ } -+ -+ return ret; -+} -+ -+/* deals with receipt of buffer to host message */ -+static void buffer_to_host_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, u32 msg_len) -+{ -+ struct mmal_msg_context *msg_context; -+ -+ pr_debug("buffer_to_host_cb: instance:%p msg:%p msg_len:%d\n", -+ instance, msg, msg_len); -+ -+ if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) { -+ msg_context = msg->u.buffer_from_host.drvbuf.client_context; -+ } else { -+ pr_err("MMAL_MSG_TYPE_BUFFER_TO_HOST with bad magic\n"); -+ return; -+ } -+ -+ if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) { -+ /* message reception had an error */ -+ pr_warn("error %d in reply\n", msg->h.status); -+ -+ msg_context->u.bulk.status = msg->h.status; -+ -+ } else if (msg->u.buffer_from_host.buffer_header.length == 0) { -+ /* empty buffer */ -+ if (msg->u.buffer_from_host.buffer_header.flags & -+ MMAL_BUFFER_HEADER_FLAG_EOS) { -+ msg_context->u.bulk.status = -+ dummy_bulk_receive(instance, msg_context); -+ if (msg_context->u.bulk.status == 0) -+ return; /* successful bulk submission, bulk -+ * completion will trigger callback -+ */ -+ } else { -+ /* do callback with empty buffer - not EOS though */ -+ msg_context->u.bulk.status = 0; -+ msg_context->u.bulk.buffer_used = 0; -+ } -+ } else if (msg->u.buffer_from_host.payload_in_message == 0) { -+ /* data is not in message, queue a bulk receive */ -+ msg_context->u.bulk.status = -+ bulk_receive(instance, msg, msg_context); -+ if (msg_context->u.bulk.status == 0) -+ return; /* successful bulk submission, bulk -+ * completion will trigger callback -+ */ -+ -+ /* failed to submit buffer, this will end badly */ -+ pr_err("error %d on bulk submission\n", -+ msg_context->u.bulk.status); -+ -+ } else if (msg->u.buffer_from_host.payload_in_message <= -+ MMAL_VC_SHORT_DATA) { -+ /* data payload within message */ -+ msg_context->u.bulk.status = inline_receive(instance, msg, -+ msg_context); -+ } else { -+ pr_err("message with invalid short payload\n"); -+ -+ /* signal error */ -+ msg_context->u.bulk.status = -EINVAL; -+ msg_context->u.bulk.buffer_used = -+ msg->u.buffer_from_host.payload_in_message; -+ } -+ -+ /* replace the buffer header */ -+ port_buffer_from_host(instance, msg_context->u.bulk.port); -+ -+ /* schedule the port callback */ -+ schedule_work(&msg_context->u.bulk.work); -+} -+ -+static void bulk_receive_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg_context *msg_context) -+{ -+ /* bulk receive operation complete */ -+ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); -+ -+ /* replace the buffer header */ -+ port_buffer_from_host(msg_context->u.bulk.instance, -+ msg_context->u.bulk.port); -+ -+ msg_context->u.bulk.status = 0; -+ -+ /* schedule the port callback */ -+ schedule_work(&msg_context->u.bulk.work); -+} -+ -+static void bulk_abort_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg_context *msg_context) -+{ -+ pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context); -+ -+ /* bulk receive operation complete */ -+ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); -+ -+ /* replace the buffer header */ -+ port_buffer_from_host(msg_context->u.bulk.instance, -+ msg_context->u.bulk.port); -+ -+ msg_context->u.bulk.status = -EINTR; -+ -+ schedule_work(&msg_context->u.bulk.work); -+} -+ -+/* incoming event service callback */ -+static void service_callback(void *param, -+ const VCHI_CALLBACK_REASON_T reason, -+ void *bulk_ctx) -+{ -+ struct vchiq_mmal_instance *instance = param; -+ int status; -+ u32 msg_len; -+ struct mmal_msg *msg; -+ VCHI_HELD_MSG_T msg_handle; -+ -+ if (!instance) { -+ pr_err("Message callback passed NULL instance\n"); -+ return; -+ } -+ -+ switch (reason) { -+ case VCHI_CALLBACK_MSG_AVAILABLE: -+ status = vchi_msg_hold(instance->handle, (void **)&msg, -+ &msg_len, VCHI_FLAGS_NONE, &msg_handle); -+ if (status) { -+ pr_err("Unable to dequeue a message (%d)\n", status); -+ break; -+ } -+ -+ DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); -+ -+ /* handling is different for buffer messages */ -+ switch (msg->h.type) { -+ -+ case MMAL_MSG_TYPE_BUFFER_FROM_HOST: -+ vchi_held_msg_release(&msg_handle); -+ break; -+ -+ case MMAL_MSG_TYPE_EVENT_TO_HOST: -+ event_to_host_cb(instance, msg, msg_len); -+ vchi_held_msg_release(&msg_handle); -+ -+ break; -+ -+ case MMAL_MSG_TYPE_BUFFER_TO_HOST: -+ buffer_to_host_cb(instance, msg, msg_len); -+ vchi_held_msg_release(&msg_handle); -+ break; -+ -+ default: -+ /* messages dependant on header context to complete */ -+ -+ /* todo: the msg.context really ought to be sanity -+ * checked before we just use it, afaict it comes back -+ * and is used raw from the videocore. Perhaps it -+ * should be verified the address lies in the kernel -+ * address space. -+ */ -+ if (msg->h.context == NULL) { -+ pr_err("received message context was null!\n"); -+ vchi_held_msg_release(&msg_handle); -+ break; -+ } -+ -+ /* fill in context values */ -+ msg->h.context->u.sync.msg_handle = msg_handle; -+ msg->h.context->u.sync.msg = msg; -+ msg->h.context->u.sync.msg_len = msg_len; -+ -+ /* todo: should this check (completion_done() -+ * == 1) for no one waiting? or do we need a -+ * flag to tell us the completion has been -+ * interrupted so we can free the message and -+ * its context. This probably also solves the -+ * message arriving after interruption todo -+ * below -+ */ -+ -+ /* complete message so caller knows it happened */ -+ complete(&msg->h.context->u.sync.cmplt); -+ break; -+ } -+ -+ break; -+ -+ case VCHI_CALLBACK_BULK_RECEIVED: -+ bulk_receive_cb(instance, bulk_ctx); -+ break; -+ -+ case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: -+ bulk_abort_cb(instance, bulk_ctx); -+ break; -+ -+ case VCHI_CALLBACK_SERVICE_CLOSED: -+ /* TODO: consider if this requires action if received when -+ * driver is not explicitly closing the service -+ */ -+ break; -+ -+ default: -+ pr_err("Received unhandled message reason %d\n", reason); -+ break; -+ } -+} -+ -+static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, -+ unsigned int payload_len, -+ struct mmal_msg **msg_out, -+ VCHI_HELD_MSG_T *msg_handle_out) -+{ -+ struct mmal_msg_context msg_context; -+ int ret; -+ -+ /* payload size must not cause message to exceed max size */ -+ if (payload_len > -+ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) { -+ pr_err("payload length %d exceeds max:%d\n", payload_len, -+ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))); -+ return -EINVAL; -+ } -+ -+ init_completion(&msg_context.u.sync.cmplt); -+ -+ msg->h.magic = MMAL_MAGIC; -+ msg->h.context = &msg_context; -+ msg->h.status = 0; -+ -+ DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), -+ ">>> sync message"); -+ -+ vchi_service_use(instance->handle); -+ -+ ret = vchi_msg_queue(instance->handle, -+ msg, -+ sizeof(struct mmal_msg_header) + payload_len, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ vchi_service_release(instance->handle); -+ -+ if (ret) { -+ pr_err("error %d queuing message\n", ret); -+ return ret; -+ } -+ -+ ret = wait_for_completion_timeout(&msg_context.u.sync.cmplt, 3*HZ); -+ if (ret <= 0) { -+ pr_err("error %d waiting for sync completion\n", ret); -+ if (ret == 0) -+ ret = -ETIME; -+ /* todo: what happens if the message arrives after aborting */ -+ return ret; -+ } -+ -+ *msg_out = msg_context.u.sync.msg; -+ *msg_handle_out = msg_context.u.sync.msg_handle; -+ -+ return 0; -+} -+ -+static void dump_port_info(struct vchiq_mmal_port *port) -+{ -+ pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled); -+ -+ pr_debug("buffer minimum num:%d size:%d align:%d\n", -+ port->minimum_buffer.num, -+ port->minimum_buffer.size, port->minimum_buffer.alignment); -+ -+ pr_debug("buffer recommended num:%d size:%d align:%d\n", -+ port->recommended_buffer.num, -+ port->recommended_buffer.size, -+ port->recommended_buffer.alignment); -+ -+ pr_debug("buffer current values num:%d size:%d align:%d\n", -+ port->current_buffer.num, -+ port->current_buffer.size, port->current_buffer.alignment); -+ -+ pr_debug("elementry stream: type:%d encoding:0x%x varient:0x%x\n", -+ port->format.type, -+ port->format.encoding, port->format.encoding_variant); -+ -+ pr_debug(" bitrate:%d flags:0x%x\n", -+ port->format.bitrate, port->format.flags); -+ -+ if (port->format.type == MMAL_ES_TYPE_VIDEO) { -+ pr_debug -+ ("es video format: width:%d height:%d colourspace:0x%x\n", -+ port->es.video.width, port->es.video.height, -+ port->es.video.color_space); -+ -+ pr_debug(" : crop xywh %d,%d,%d,%d\n", -+ port->es.video.crop.x, -+ port->es.video.crop.y, -+ port->es.video.crop.width, port->es.video.crop.height); -+ pr_debug(" : framerate %d/%d aspect %d/%d\n", -+ port->es.video.frame_rate.num, -+ port->es.video.frame_rate.den, -+ port->es.video.par.num, port->es.video.par.den); -+ } -+} -+ -+static void port_to_mmal_msg(struct vchiq_mmal_port *port, struct mmal_port *p) -+{ -+ -+ /* todo do readonly fields need setting at all? */ -+ p->type = port->type; -+ p->index = port->index; -+ p->index_all = 0; -+ p->is_enabled = port->enabled; -+ p->buffer_num_min = port->minimum_buffer.num; -+ p->buffer_size_min = port->minimum_buffer.size; -+ p->buffer_alignment_min = port->minimum_buffer.alignment; -+ p->buffer_num_recommended = port->recommended_buffer.num; -+ p->buffer_size_recommended = port->recommended_buffer.size; -+ -+ /* only three writable fields in a port */ -+ p->buffer_num = port->current_buffer.num; -+ p->buffer_size = port->current_buffer.size; -+ p->userdata = port; -+} -+ -+static int port_info_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ pr_debug("setting port info port %p\n", port); -+ if (!port) -+ return -1; -+ dump_port_info(port); -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_INFO_SET; -+ -+ m.u.port_info_set.component_handle = port->component->handle; -+ m.u.port_info_set.port_type = port->type; -+ m.u.port_info_set.port_index = port->index; -+ -+ port_to_mmal_msg(port, &m.u.port_info_set.port); -+ -+ /* elementry stream format setup */ -+ m.u.port_info_set.format.type = port->format.type; -+ m.u.port_info_set.format.encoding = port->format.encoding; -+ m.u.port_info_set.format.encoding_variant = -+ port->format.encoding_variant; -+ m.u.port_info_set.format.bitrate = port->format.bitrate; -+ m.u.port_info_set.format.flags = port->format.flags; -+ -+ memcpy(&m.u.port_info_set.es, &port->es, -+ sizeof(union mmal_es_specific_format)); -+ -+ m.u.port_info_set.format.extradata_size = port->format.extradata_size; -+ memcpy(&m.u.port_info_set.extradata, port->format.extradata, -+ port->format.extradata_size); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_info_set), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_SET) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ /* return operation status */ -+ ret = -rmsg->u.port_info_get_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, -+ port->component->handle, port->handle); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+ -+} -+ -+/* use port info get message to retrive port information */ -+static int port_info_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ /* port info time */ -+ m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; -+ m.u.port_info_get.component_handle = port->component->handle; -+ m.u.port_info_get.port_type = port->type; -+ m.u.port_info_get.index = port->index; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_info_get), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_GET) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ /* return operation status */ -+ ret = -rmsg->u.port_info_get_reply.status; -+ if (ret != MMAL_MSG_STATUS_SUCCESS) -+ goto release_msg; -+ -+ if (rmsg->u.port_info_get_reply.port.is_enabled == 0) -+ port->enabled = false; -+ else -+ port->enabled = true; -+ -+ /* copy the values out of the message */ -+ port->handle = rmsg->u.port_info_get_reply.port_handle; -+ -+ /* port type and index cached to use on port info set becuase -+ * it does not use a port handle -+ */ -+ port->type = rmsg->u.port_info_get_reply.port_type; -+ port->index = rmsg->u.port_info_get_reply.port_index; -+ -+ port->minimum_buffer.num = -+ rmsg->u.port_info_get_reply.port.buffer_num_min; -+ port->minimum_buffer.size = -+ rmsg->u.port_info_get_reply.port.buffer_size_min; -+ port->minimum_buffer.alignment = -+ rmsg->u.port_info_get_reply.port.buffer_alignment_min; -+ -+ port->recommended_buffer.alignment = -+ rmsg->u.port_info_get_reply.port.buffer_alignment_min; -+ port->recommended_buffer.num = -+ rmsg->u.port_info_get_reply.port.buffer_num_recommended; -+ -+ port->current_buffer.num = rmsg->u.port_info_get_reply.port.buffer_num; -+ port->current_buffer.size = -+ rmsg->u.port_info_get_reply.port.buffer_size; -+ -+ /* stream format */ -+ port->format.type = rmsg->u.port_info_get_reply.format.type; -+ port->format.encoding = rmsg->u.port_info_get_reply.format.encoding; -+ port->format.encoding_variant = -+ rmsg->u.port_info_get_reply.format.encoding_variant; -+ port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate; -+ port->format.flags = rmsg->u.port_info_get_reply.format.flags; -+ -+ /* elementry stream format */ -+ memcpy(&port->es, -+ &rmsg->u.port_info_get_reply.es, -+ sizeof(union mmal_es_specific_format)); -+ port->format.es = &port->es; -+ -+ port->format.extradata_size = -+ rmsg->u.port_info_get_reply.format.extradata_size; -+ memcpy(port->format.extradata, -+ rmsg->u.port_info_get_reply.extradata, -+ port->format.extradata_size); -+ -+ pr_debug("received port info\n"); -+ dump_port_info(port); -+ -+release_msg: -+ -+ pr_debug("%s:result:%d component:0x%x port:%d\n", -+ __func__, ret, port->component->handle, port->handle); -+ -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* create comonent on vc */ -+static int create_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component, -+ const char *name) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ /* build component create message */ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; -+ m.u.component_create.client_component = component; -+ strncpy(m.u.component_create.name, name, -+ sizeof(m.u.component_create.name)); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_create), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_create_reply.status; -+ if (ret != MMAL_MSG_STATUS_SUCCESS) -+ goto release_msg; -+ -+ /* a valid component response received */ -+ component->handle = rmsg->u.component_create_reply.component_handle; -+ component->inputs = rmsg->u.component_create_reply.input_num; -+ component->outputs = rmsg->u.component_create_reply.output_num; -+ component->clocks = rmsg->u.component_create_reply.clock_num; -+ -+ pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n", -+ component->handle, -+ component->inputs, component->outputs, component->clocks); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* destroys a component on vc */ -+static int destroy_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; -+ m.u.component_destroy.component_handle = component->handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_destroy), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_destroy_reply.status; -+ -+release_msg: -+ -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* enable a component on vc */ -+static int enable_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; -+ m.u.component_enable.component_handle = component->handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_enable), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_enable_reply.status; -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* disable a component on vc */ -+static int disable_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; -+ m.u.component_disable.component_handle = component->handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_disable), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_disable_reply.status; -+ -+release_msg: -+ -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* get version of mmal implementation */ -+static int get_version(struct vchiq_mmal_instance *instance, -+ u32 *major_out, u32 *minor_out) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_GET_VERSION; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.version), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ *major_out = rmsg->u.version.major; -+ *minor_out = rmsg->u.version.minor; -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* do a port action with a port as a parameter */ -+static int port_action_port(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ enum mmal_msg_port_action_type action_type) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; -+ m.u.port_action_port.component_handle = port->component->handle; -+ m.u.port_action_port.port_handle = port->handle; -+ m.u.port_action_port.action = action_type; -+ -+ port_to_mmal_msg(port, &m.u.port_action_port.port); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_action_port), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_action_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n", -+ __func__, -+ ret, port->component->handle, port->handle, -+ port_action_type_names[action_type], action_type); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* do a port action with handles as parameters */ -+static int port_action_handle(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ enum mmal_msg_port_action_type action_type, -+ u32 connect_component_handle, -+ u32 connect_port_handle) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; -+ -+ m.u.port_action_handle.component_handle = port->component->handle; -+ m.u.port_action_handle.port_handle = port->handle; -+ m.u.port_action_handle.action = action_type; -+ -+ m.u.port_action_handle.connect_component_handle = -+ connect_component_handle; -+ m.u.port_action_handle.connect_port_handle = connect_port_handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_action_handle), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_action_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)" \ -+ " connect component:0x%x connect port:%d\n", -+ __func__, -+ ret, port->component->handle, port->handle, -+ port_action_type_names[action_type], -+ action_type, connect_component_handle, connect_port_handle); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+static int port_parameter_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter_id, void *value, u32 value_size) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; -+ -+ m.u.port_parameter_set.component_handle = port->component->handle; -+ m.u.port_parameter_set.port_handle = port->handle; -+ m.u.port_parameter_set.id = parameter_id; -+ m.u.port_parameter_set.size = (2 * sizeof(u32)) + value_size; -+ memcpy(&m.u.port_parameter_set.value, value, value_size); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ (4 * sizeof(u32)) + value_size, -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_SET) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_parameter_set_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", -+ __func__, -+ ret, port->component->handle, port->handle, parameter_id); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+static int port_parameter_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter_id, void *value, u32 *value_size) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; -+ -+ m.u.port_parameter_get.component_handle = port->component->handle; -+ m.u.port_parameter_get.port_handle = port->handle; -+ m.u.port_parameter_get.id = parameter_id; -+ m.u.port_parameter_get.size = (2 * sizeof(u32)) + *value_size; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(struct -+ mmal_msg_port_parameter_get), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_GET) { -+ /* got an unexpected message type in reply */ -+ pr_err("Incorrect reply type %d\n", rmsg->h.type); -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_parameter_get_reply.status; -+ if (ret) { -+ /* Copy only as much as we have space for -+ * but report true size of parameter -+ */ -+ memcpy(value, &rmsg->u.port_parameter_get_reply.value, -+ *value_size); -+ *value_size = rmsg->u.port_parameter_get_reply.size; -+ } else -+ memcpy(value, &rmsg->u.port_parameter_get_reply.value, -+ rmsg->u.port_parameter_get_reply.size); -+ -+ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, -+ ret, port->component->handle, port->handle, parameter_id); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* disables a port and drains buffers from it */ -+static int port_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct list_head *q, *buf_head; -+ unsigned long flags = 0; -+ -+ if (!port->enabled) -+ return 0; -+ -+ port->enabled = false; -+ -+ ret = port_action_port(instance, port, -+ MMAL_MSG_PORT_ACTION_TYPE_DISABLE); -+ if (ret == 0) { -+ -+ /* drain all queued buffers on port */ -+ spin_lock_irqsave(&port->slock, flags); -+ -+ list_for_each_safe(buf_head, q, &port->buffers) { -+ struct mmal_buffer *mmalbuf; -+ mmalbuf = list_entry(buf_head, struct mmal_buffer, -+ list); -+ list_del(buf_head); -+ if (port->buffer_cb) -+ port->buffer_cb(instance, -+ port, 0, mmalbuf, 0, 0, -+ MMAL_TIME_UNKNOWN, -+ MMAL_TIME_UNKNOWN); -+ } -+ -+ spin_unlock_irqrestore(&port->slock, flags); -+ -+ ret = port_info_get(instance, port); -+ } -+ -+ return ret; -+} -+ -+/* enable a port */ -+static int port_enable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ unsigned int hdr_count; -+ struct list_head *buf_head; -+ int ret; -+ -+ if (port->enabled) -+ return 0; -+ -+ /* ensure there are enough buffers queued to cover the buffer headers */ -+ if (port->buffer_cb != NULL) { -+ hdr_count = 0; -+ list_for_each(buf_head, &port->buffers) { -+ hdr_count++; -+ } -+ if (hdr_count < port->current_buffer.num) -+ return -ENOSPC; -+ } -+ -+ ret = port_action_port(instance, port, -+ MMAL_MSG_PORT_ACTION_TYPE_ENABLE); -+ if (ret) -+ goto done; -+ -+ port->enabled = true; -+ -+ if (port->buffer_cb) { -+ /* send buffer headers to videocore */ -+ hdr_count = 1; -+ list_for_each(buf_head, &port->buffers) { -+ struct mmal_buffer *mmalbuf; -+ mmalbuf = list_entry(buf_head, struct mmal_buffer, -+ list); -+ ret = buffer_from_host(instance, port, mmalbuf); -+ if (ret) -+ goto done; -+ -+ hdr_count++; -+ if (hdr_count > port->current_buffer.num) -+ break; -+ } -+ } -+ -+ ret = port_info_get(instance, port); -+ -+done: -+ return ret; -+} -+ -+/* ------------------------------------------------------------------ -+ * Exported API -+ *------------------------------------------------------------------*/ -+ -+int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = port_info_set(instance, port); -+ if (ret) -+ goto release_unlock; -+ -+ /* read what has actually been set */ -+ ret = port_info_get(instance, port); -+ -+release_unlock: -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+ -+} -+ -+int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, void *value, u32 value_size) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = port_parameter_set(instance, port, parameter, value, value_size); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, void *value, u32 *value_size) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = port_parameter_get(instance, port, parameter, value, value_size); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* enable a port -+ * -+ * enables a port and queues buffers for satisfying callbacks if we -+ * provide a callback handler -+ */ -+int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ vchiq_mmal_buffer_cb buffer_cb) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ /* already enabled - noop */ -+ if (port->enabled) { -+ ret = 0; -+ goto unlock; -+ } -+ -+ port->buffer_cb = buffer_cb; -+ -+ ret = port_enable(instance, port); -+ -+unlock: -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (!port->enabled) { -+ mutex_unlock(&instance->vchiq_mutex); -+ return 0; -+ } -+ -+ ret = port_disable(instance, port); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* ports will be connected in a tunneled manner so data buffers -+ * are not handled by client. -+ */ -+int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *src, -+ struct vchiq_mmal_port *dst) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ /* disconnect ports if connected */ -+ if (src->connected != NULL) { -+ ret = port_disable(instance, src); -+ if (ret) { -+ pr_err("failed disabling src port(%d)\n", ret); -+ goto release_unlock; -+ } -+ -+ /* do not need to disable the destination port as they -+ * are connected and it is done automatically -+ */ -+ -+ ret = port_action_handle(instance, src, -+ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, -+ src->connected->component->handle, -+ src->connected->handle); -+ if (ret < 0) { -+ pr_err("failed disconnecting src port\n"); -+ goto release_unlock; -+ } -+ src->connected->enabled = false; -+ src->connected = NULL; -+ } -+ -+ if (dst == NULL) { -+ /* do not make new connection */ -+ ret = 0; -+ pr_debug("not making new connection\n"); -+ goto release_unlock; -+ } -+ -+ /* copy src port format to dst */ -+ dst->format.encoding = src->format.encoding; -+ dst->es.video.width = src->es.video.width; -+ dst->es.video.height = src->es.video.height; -+ dst->es.video.crop.x = src->es.video.crop.x; -+ dst->es.video.crop.y = src->es.video.crop.y; -+ dst->es.video.crop.width = src->es.video.crop.width; -+ dst->es.video.crop.height = src->es.video.crop.height; -+ dst->es.video.frame_rate.num = src->es.video.frame_rate.num; -+ dst->es.video.frame_rate.den = src->es.video.frame_rate.den; -+ -+ /* set new format */ -+ ret = port_info_set(instance, dst); -+ if (ret) { -+ pr_debug("setting port info failed\n"); -+ goto release_unlock; -+ } -+ -+ /* read what has actually been set */ -+ ret = port_info_get(instance, dst); -+ if (ret) { -+ pr_debug("read back port info failed\n"); -+ goto release_unlock; -+ } -+ -+ /* connect two ports together */ -+ ret = port_action_handle(instance, src, -+ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, -+ dst->component->handle, dst->handle); -+ if (ret < 0) { -+ pr_debug("connecting port %d:%d to %d:%d failed\n", -+ src->component->handle, src->handle, -+ dst->component->handle, dst->handle); -+ goto release_unlock; -+ } -+ src->connected = dst; -+ -+release_unlock: -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ struct mmal_buffer *buffer) -+{ -+ unsigned long flags = 0; -+ -+ spin_lock_irqsave(&port->slock, flags); -+ list_add_tail(&buffer->list, &port->buffers); -+ spin_unlock_irqrestore(&port->slock, flags); -+ -+ /* the port previously underflowed because it was missing a -+ * mmal_buffer which has just been added, submit that buffer -+ * to the mmal service. -+ */ -+ if (port->buffer_underflow) { -+ port_buffer_from_host(instance, port); -+ port->buffer_underflow--; -+ } -+ -+ return 0; -+} -+ -+/* Initialise a mmal component and its ports -+ * -+ */ -+int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, -+ const char *name, -+ struct vchiq_mmal_component **component_out) -+{ -+ int ret; -+ int idx; /* port index */ -+ struct vchiq_mmal_component *component; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { -+ ret = -EINVAL; /* todo is this correct error? */ -+ goto unlock; -+ } -+ -+ component = &instance->component[instance->component_idx]; -+ -+ ret = create_component(instance, component, name); -+ if (ret < 0) -+ goto unlock; -+ -+ /* ports info needs gathering */ -+ component->control.type = MMAL_PORT_TYPE_CONTROL; -+ component->control.index = 0; -+ component->control.component = component; -+ spin_lock_init(&component->control.slock); -+ INIT_LIST_HEAD(&component->control.buffers); -+ ret = port_info_get(instance, &component->control); -+ if (ret < 0) -+ goto release_component; -+ -+ for (idx = 0; idx < component->inputs; idx++) { -+ component->input[idx].type = MMAL_PORT_TYPE_INPUT; -+ component->input[idx].index = idx; -+ component->input[idx].component = component; -+ spin_lock_init(&component->input[idx].slock); -+ INIT_LIST_HEAD(&component->input[idx].buffers); -+ ret = port_info_get(instance, &component->input[idx]); -+ if (ret < 0) -+ goto release_component; -+ } -+ -+ for (idx = 0; idx < component->outputs; idx++) { -+ component->output[idx].type = MMAL_PORT_TYPE_OUTPUT; -+ component->output[idx].index = idx; -+ component->output[idx].component = component; -+ spin_lock_init(&component->output[idx].slock); -+ INIT_LIST_HEAD(&component->output[idx].buffers); -+ ret = port_info_get(instance, &component->output[idx]); -+ if (ret < 0) -+ goto release_component; -+ } -+ -+ for (idx = 0; idx < component->clocks; idx++) { -+ component->clock[idx].type = MMAL_PORT_TYPE_CLOCK; -+ component->clock[idx].index = idx; -+ component->clock[idx].component = component; -+ spin_lock_init(&component->clock[idx].slock); -+ INIT_LIST_HEAD(&component->clock[idx].buffers); -+ ret = port_info_get(instance, &component->clock[idx]); -+ if (ret < 0) -+ goto release_component; -+ } -+ -+ instance->component_idx++; -+ -+ *component_out = component; -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return 0; -+ -+release_component: -+ destroy_component(instance, component); -+unlock: -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* -+ * cause a mmal component to be destroyed -+ */ -+int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (component->enabled) -+ ret = disable_component(instance, component); -+ -+ ret = destroy_component(instance, component); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* -+ * cause a mmal component to be enabled -+ */ -+int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (component->enabled) { -+ mutex_unlock(&instance->vchiq_mutex); -+ return 0; -+ } -+ -+ ret = enable_component(instance, component); -+ if (ret == 0) -+ component->enabled = true; -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* -+ * cause a mmal component to be enabled -+ */ -+int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (!component->enabled) { -+ mutex_unlock(&instance->vchiq_mutex); -+ return 0; -+ } -+ -+ ret = disable_component(instance, component); -+ if (ret == 0) -+ component->enabled = false; -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_version(struct vchiq_mmal_instance *instance, -+ u32 *major_out, u32 *minor_out) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = get_version(instance, major_out, minor_out); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) -+{ -+ int status = 0; -+ -+ if (instance == NULL) -+ return -EINVAL; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ vchi_service_use(instance->handle); -+ -+ status = vchi_service_close(instance->handle); -+ if (status != 0) -+ pr_err("mmal-vchiq: VCHIQ close failed"); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ vfree(instance->bulk_scratch); -+ -+ kfree(instance); -+ -+ return status; -+} -+ -+int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) -+{ -+ int status; -+ struct vchiq_mmal_instance *instance; -+ static VCHI_CONNECTION_T *vchi_connection; -+ static VCHI_INSTANCE_T vchi_instance; -+ SERVICE_CREATION_T params = { -+ VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), -+ VC_MMAL_SERVER_NAME, -+ vchi_connection, -+ 0, /* rx fifo size (unused) */ -+ 0, /* tx fifo size (unused) */ -+ service_callback, -+ NULL, /* service callback parameter */ -+ 1, /* unaligned bulk receives */ -+ 1, /* unaligned bulk transmits */ -+ 0 /* want crc check on bulk transfers */ -+ }; -+ -+ /* compile time checks to ensure structure size as they are -+ * directly (de)serialised from memory. -+ */ -+ -+ /* ensure the header structure has packed to the correct size */ -+ BUILD_BUG_ON(sizeof(struct mmal_msg_header) != 24); -+ -+ /* ensure message structure does not exceed maximum length */ -+ BUILD_BUG_ON(sizeof(struct mmal_msg) > MMAL_MSG_MAX_SIZE); -+ -+ /* mmal port struct is correct size */ -+ BUILD_BUG_ON(sizeof(struct mmal_port) != 64); -+ -+ /* create a vchi instance */ -+ status = vchi_initialise(&vchi_instance); -+ if (status) { -+ pr_err("Failed to initialise VCHI instance (status=%d)\n", -+ status); -+ return -EIO; -+ } -+ -+ status = vchi_connect(NULL, 0, vchi_instance); -+ if (status) { -+ pr_err("Failed to connect VCHI instance (status=%d)\n", status); -+ return -EIO; -+ } -+ -+ instance = kmalloc(sizeof(*instance), GFP_KERNEL); -+ memset(instance, 0, sizeof(*instance)); -+ -+ mutex_init(&instance->vchiq_mutex); -+ mutex_init(&instance->bulk_mutex); -+ -+ instance->bulk_scratch = vmalloc(PAGE_SIZE); -+ -+ params.callback_param = instance; -+ -+ status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); -+ if (status) { -+ pr_err("Failed to open VCHI service connection (status=%d)\n", -+ status); -+ goto err_close_services; -+ } -+ -+ vchi_service_release(instance->handle); -+ -+ *out_instance = instance; -+ -+ return 0; -+ -+err_close_services: -+ -+ vchi_service_close(instance->handle); -+ vfree(instance->bulk_scratch); -+ kfree(instance); -+ return -ENODEV; -+} -diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.h b/drivers/media/platform/bcm2835/mmal-vchiq.h -new file mode 100644 -index 0000000000000000000000000000000000000000..9d1d11e4a53e510c04a416d92d195a7df15012d5 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-vchiq.h -@@ -0,0 +1,178 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * MMAL interface to VCHIQ message passing -+ */ -+ -+#ifndef MMAL_VCHIQ_H -+#define MMAL_VCHIQ_H -+ -+#include "mmal-msg-format.h" -+ -+#define MAX_PORT_COUNT 4 -+ -+/* Maximum size of the format extradata. */ -+#define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128 -+ -+struct vchiq_mmal_instance; -+ -+enum vchiq_mmal_es_type { -+ MMAL_ES_TYPE_UNKNOWN, /**< Unknown elementary stream type */ -+ MMAL_ES_TYPE_CONTROL, /**< Elementary stream of control commands */ -+ MMAL_ES_TYPE_AUDIO, /**< Audio elementary stream */ -+ MMAL_ES_TYPE_VIDEO, /**< Video elementary stream */ -+ MMAL_ES_TYPE_SUBPICTURE /**< Sub-picture elementary stream */ -+}; -+ -+/* rectangle, used lots so it gets its own struct */ -+struct vchiq_mmal_rect { -+ s32 x; -+ s32 y; -+ s32 width; -+ s32 height; -+}; -+ -+struct vchiq_mmal_port_buffer { -+ unsigned int num; /* number of buffers */ -+ u32 size; /* size of buffers */ -+ u32 alignment; /* alignment of buffers */ -+}; -+ -+struct vchiq_mmal_port; -+ -+typedef void (*vchiq_mmal_buffer_cb)( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ int status, struct mmal_buffer *buffer, -+ unsigned long length, u32 mmal_flags, s64 dts, s64 pts); -+ -+struct vchiq_mmal_port { -+ bool enabled; -+ u32 handle; -+ u32 type; /* port type, cached to use on port info set */ -+ u32 index; /* port index, cached to use on port info set */ -+ -+ /* component port belongs to, allows simple deref */ -+ struct vchiq_mmal_component *component; -+ -+ struct vchiq_mmal_port *connected; /* port conencted to */ -+ -+ /* buffer info */ -+ struct vchiq_mmal_port_buffer minimum_buffer; -+ struct vchiq_mmal_port_buffer recommended_buffer; -+ struct vchiq_mmal_port_buffer current_buffer; -+ -+ /* stream format */ -+ struct mmal_es_format format; -+ /* elementry stream format */ -+ union mmal_es_specific_format es; -+ -+ /* data buffers to fill */ -+ struct list_head buffers; -+ /* lock to serialise adding and removing buffers from list */ -+ spinlock_t slock; -+ /* count of how many buffer header refils have failed because -+ * there was no buffer to satisfy them -+ */ -+ int buffer_underflow; -+ /* callback on buffer completion */ -+ vchiq_mmal_buffer_cb buffer_cb; -+ /* callback context */ -+ void *cb_ctx; -+}; -+ -+struct vchiq_mmal_component { -+ bool enabled; -+ u32 handle; /* VideoCore handle for component */ -+ u32 inputs; /* Number of input ports */ -+ u32 outputs; /* Number of output ports */ -+ u32 clocks; /* Number of clock ports */ -+ struct vchiq_mmal_port control; /* control port */ -+ struct vchiq_mmal_port input[MAX_PORT_COUNT]; /* input ports */ -+ struct vchiq_mmal_port output[MAX_PORT_COUNT]; /* output ports */ -+ struct vchiq_mmal_port clock[MAX_PORT_COUNT]; /* clock ports */ -+}; -+ -+ -+int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance); -+int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance); -+ -+/* Initialise a mmal component and its ports -+* -+*/ -+int vchiq_mmal_component_init( -+ struct vchiq_mmal_instance *instance, -+ const char *name, -+ struct vchiq_mmal_component **component_out); -+ -+int vchiq_mmal_component_finalise( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component); -+ -+int vchiq_mmal_component_enable( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component); -+ -+int vchiq_mmal_component_disable( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component); -+ -+ -+ -+/* enable a mmal port -+ * -+ * enables a port and if a buffer callback provided enque buffer -+ * headers as apropriate for the port. -+ */ -+int vchiq_mmal_port_enable( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ vchiq_mmal_buffer_cb buffer_cb); -+ -+/* disable a port -+ * -+ * disable a port will dequeue any pending buffers -+ */ -+int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port); -+ -+ -+int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, -+ void *value, -+ u32 value_size); -+ -+int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, -+ void *value, -+ u32 *value_size); -+ -+int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port); -+ -+int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *src, -+ struct vchiq_mmal_port *dst); -+ -+int vchiq_mmal_version(struct vchiq_mmal_instance *instance, -+ u32 *major_out, -+ u32 *minor_out); -+ -+int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ struct mmal_buffer *buf); -+ -+#endif /* MMAL_VCHIQ_H */ - -From 6b480eb543d3fb86623e58d6d0f884f67f5ba804 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 052/122] scripts: Add mkknlimg and knlinfo scripts from tools - repo - -The Raspberry Pi firmware looks for a trailer on the kernel image to -determine whether it was compiled with Device Tree support enabled. -If the firmware finds a kernel without this trailer, or which has a -trailer indicating that it isn't DT-capable, it disables DT support -and reverts to using ATAGs. - -The mkknlimg utility adds that trailer, having first analysed the -image to look for signs of DT support and the kernel version string. - -knlinfo displays the contents of the trailer in the given kernel image. - -scripts/mkknlimg: Add support for ARCH_BCM2835 - -Add a new trailer field indicating whether this is an ARCH_BCM2835 -build, as opposed to MACH_BCM2708/9. If the loader finds this flag -is set it changes the default base dtb file name from bcm270x... -to bcm283y... - -Also update knlinfo to show the status of the field. - -scripts/mkknlimg: Improve ARCH_BCM2835 detection - -The board support code contains sufficient strings to be able to -distinguish 2708 vs. 2835 builds, so remove the check for -bcm2835-pm-wdt which could exist in either. - -Also, since the canned configuration is no longer built in (it's -a module), remove the config string checking. - -See: https://github.com/raspberrypi/linux/issues/1157 - -scripts: Multi-platform support for mkknlimg and knlinfo - -The firmware uses tags in the kernel trailer to choose which dtb file -to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, -otherwise it loads bcm270*.dtb. This scheme breaks if an image supports -multiple platforms. - -This patch adds '270X' and '283X' tags to indicate support for RPi and -upstream platforms, respectively. '283x' (note lower case 'x') is left -for old firmware, and is only set if the image only supports upstream -builds. - -scripts/mkknlimg: Append a trailer for all input - -Now that the firmware assumes an unsigned kernel is DT-capable, it is -helpful to be able to mark a kernel as being non-DT-capable. - -Signed-off-by: Phil Elwell - -scripts/knlinfo: Decode DDTK atom - -Show the DDTK atom as being a boolean. - -Signed-off-by: Phil Elwell - -mkknlimg: Retain downstream-kernel detection - -With the death of ARCH_BCM2708 and ARCH_BCM2709, a new way is needed to -determine if this is a "downstream" build that wants the firmware to -load a bcm27xx .dtb. The vc_cma driver is used downstream but not -upstream, making vc_cma_init a suitable predicate symbol. ---- - scripts/knlinfo | 171 +++++++++++++++++++++++++++++++++++ - scripts/mkknlimg | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 435 insertions(+) - create mode 100755 scripts/knlinfo - create mode 100755 scripts/mkknlimg - -diff --git a/scripts/knlinfo b/scripts/knlinfo -new file mode 100755 -index 0000000000000000000000000000000000000000..263ec937eaa70b4fd00bff18599db7f22671753c ---- /dev/null -+++ b/scripts/knlinfo -@@ -0,0 +1,171 @@ -+#!/usr/bin/env perl -+# ---------------------------------------------------------------------- -+# knlinfo by Phil Elwell for Raspberry Pi -+# -+# (c) 2014,2015 Raspberry Pi (Trading) Limited -+# -+# Licensed under the terms of the GNU General Public License. -+# ---------------------------------------------------------------------- -+ -+use strict; -+use integer; -+ -+use Fcntl ":seek"; -+ -+my $trailer_magic = 'RPTL'; -+ -+my %atom_formats = -+( -+ 'DDTK' => \&format_bool, -+ 'DTOK' => \&format_bool, -+ 'KVer' => \&format_string, -+ '270X' => \&format_bool, -+ '283X' => \&format_bool, -+ '283x' => \&format_bool, -+); -+ -+if (@ARGV != 1) -+{ -+ print ("Usage: knlinfo \n"); -+ exit(1); -+} -+ -+my $kernel_file = $ARGV[0]; -+ -+ -+my ($atoms, $pos) = read_trailer($kernel_file); -+ -+exit(1) if (!$atoms); -+ -+printf("Kernel trailer found at %d/0x%x:\n", $pos, $pos); -+ -+foreach my $atom (@$atoms) -+{ -+ printf(" %s: %s\n", $atom->[0], format_atom($atom)); -+} -+ -+exit(0); -+ -+sub read_trailer -+{ -+ my ($kernel_file) = @_; -+ my $fh; -+ -+ if (!open($fh, '<', $kernel_file)) -+ { -+ print ("* Failed to open '$kernel_file'\n"); -+ return undef; -+ } -+ -+ if (!seek($fh, -12, SEEK_END)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ -+ my $last_bytes; -+ sysread($fh, $last_bytes, 12); -+ -+ my ($trailer_len, $data_len, $magic) = unpack('VVa4', $last_bytes); -+ -+ if (($magic ne $trailer_magic) || ($data_len != 4)) -+ { -+ print ("* no trailer\n"); -+ return undef; -+ } -+ if (!seek($fh, -12, SEEK_END)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ -+ $trailer_len -= 12; -+ -+ while ($trailer_len > 0) -+ { -+ if ($trailer_len < 8) -+ { -+ print ("* truncated atom header in trailer\n"); -+ return undef; -+ } -+ if (!seek($fh, -8, SEEK_CUR)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ $trailer_len -= 8; -+ -+ my $atom_hdr; -+ sysread($fh, $atom_hdr, 8); -+ my ($atom_len, $atom_type) = unpack('Va4', $atom_hdr); -+ -+ if ($trailer_len < $atom_len) -+ { -+ print ("* truncated atom data in trailer\n"); -+ return undef; -+ } -+ -+ my $rounded_len = (($atom_len + 3) & ~3); -+ if (!seek($fh, -(8 + $rounded_len), SEEK_CUR)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ $trailer_len -= $rounded_len; -+ -+ my $atom_data; -+ sysread($fh, $atom_data, $atom_len); -+ -+ if (!seek($fh, -$atom_len, SEEK_CUR)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ -+ push @$atoms, [ $atom_type, $atom_data ]; -+ } -+ -+ if (($$atoms[-1][0] eq "\x00\x00\x00\x00") && -+ ($$atoms[-1][1] eq "")) -+ { -+ pop @$atoms; -+ } -+ else -+ { -+ print ("* end marker missing from trailer\n"); -+ } -+ -+ return ($atoms, tell($fh)); -+} -+ -+sub format_atom -+{ -+ my ($atom) = @_; -+ -+ my $format_func = $atom_formats{$atom->[0]} || \&format_hex; -+ return $format_func->($atom->[1]); -+} -+ -+sub format_bool -+{ -+ my ($data) = @_; -+ return unpack('V', $data) ? 'y' : 'n'; -+} -+ -+sub format_int -+{ -+ my ($data) = @_; -+ return unpack('V', $data); -+} -+ -+sub format_string -+{ -+ my ($data) = @_; -+ return '"'.$data.'"'; -+} -+ -+sub format_hex -+{ -+ my ($data) = @_; -+ return unpack('H*', $data); -+} -diff --git a/scripts/mkknlimg b/scripts/mkknlimg -new file mode 100755 -index 0000000000000000000000000000000000000000..60206de7fa9a49bd027c635306674a29a568652f ---- /dev/null -+++ b/scripts/mkknlimg -@@ -0,0 +1,264 @@ -+#!/usr/bin/env perl -+# ---------------------------------------------------------------------- -+# mkknlimg by Phil Elwell for Raspberry Pi -+# based on extract-ikconfig by Dick Streefland -+# -+# (c) 2009,2010 Dick Streefland -+# (c) 2014,2015 Raspberry Pi (Trading) Limited -+# -+# Licensed under the terms of the GNU General Public License. -+# ---------------------------------------------------------------------- -+ -+use strict; -+use warnings; -+use integer; -+ -+use constant FLAG_PI => 0x01; -+use constant FLAG_DTOK => 0x02; -+use constant FLAG_DDTK => 0x04; -+use constant FLAG_270X => 0x08; -+use constant FLAG_283X => 0x10; -+ -+my $trailer_magic = 'RPTL'; -+ -+my $tmpfile1 = "/tmp/mkknlimg_$$.1"; -+my $tmpfile2 = "/tmp/mkknlimg_$$.2"; -+ -+my $dtok = 0; -+my $ddtk = 0; -+my $is_270x = 0; -+my $is_283x = 0; -+ -+while (@ARGV && ($ARGV[0] =~ /^-/)) -+{ -+ my $arg = shift(@ARGV); -+ if ($arg eq '--dtok') -+ { -+ $dtok = 1; -+ } -+ elsif ($arg eq '--ddtk') -+ { -+ $ddtk = 1; -+ } -+ elsif ($arg eq '--270x') -+ { -+ $is_270x = 1; -+ } -+ elsif ($arg eq '--283x') -+ { -+ $is_283x = 1; -+ } -+ else -+ { -+ print ("* Unknown option '$arg'\n"); -+ usage(); -+ } -+} -+ -+usage() if (@ARGV != 2); -+ -+my $kernel_file = $ARGV[0]; -+my $out_file = $ARGV[1]; -+ -+if (! -r $kernel_file) -+{ -+ print ("* File '$kernel_file' not found\n"); -+ usage(); -+} -+ -+my $wanted_strings = -+{ -+ 'bcm2708_fb' => FLAG_PI, -+ 'brcm,bcm2835-mmc' => FLAG_PI, -+ 'brcm,bcm2835-sdhost' => FLAG_PI, -+ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'of_cfs_init' => FLAG_DTOK | FLAG_DDTK, -+ 'vc_cma_init' => FLAG_PI | FLAG_270X, -+}; -+ -+my $res = try_extract($kernel_file, $tmpfile1); -+$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -+ $kernel_file, $tmpfile1, $tmpfile2); -+ -+my $append_trailer; -+my $trailer; -+my $kver = '?'; -+ -+$append_trailer = 1; -+ -+if ($res) -+{ -+ $kver = $res->{'kver'} || '?'; -+ my $flags = $res->{'flags'}; -+ print("Version: $kver\n"); -+ -+ if ($flags & FLAG_PI) -+ { -+ $dtok ||= ($flags & FLAG_DTOK) != 0; -+ $is_270x ||= ($flags & FLAG_270X) != 0; -+ $is_283x ||= ($flags & FLAG_283X) != 0; -+ $ddtk ||= ($flags & FLAG_DDTK) != 0; -+ } -+ else -+ { -+ print ("* This doesn't look like a Raspberry Pi kernel.\n"); -+ } -+} -+elsif (!$dtok) -+{ -+ print ("* Is this a valid kernel?\n"); -+} -+ -+if ($append_trailer) -+{ -+ printf("DT: %s\n", $dtok ? "y" : "n"); -+ printf("DDT: %s\n", $ddtk ? "y" : "n"); -+ printf("270x: %s\n", $is_270x ? "y" : "n"); -+ printf("283x: %s\n", $is_283x ? "y" : "n"); -+ -+ my @atoms; -+ -+ push @atoms, [ $trailer_magic, pack('V', 0) ]; -+ push @atoms, [ 'KVer', $kver ]; -+ push @atoms, [ 'DTOK', pack('V', $dtok) ]; -+ push @atoms, [ 'DDTK', pack('V', $ddtk) ]; -+ push @atoms, [ '270X', pack('V', $is_270x) ]; -+ push @atoms, [ '283X', pack('V', $is_283x) ]; -+ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; -+ -+ $trailer = pack_trailer(\@atoms); -+ $atoms[0]->[1] = pack('V', length($trailer)); -+ -+ $trailer = pack_trailer(\@atoms); -+} -+ -+my $ofh; -+my $total_len = 0; -+ -+if ($out_file eq $kernel_file) -+{ -+ die "* Failed to open '$out_file' for append\n" -+ if (!open($ofh, '>>', $out_file)); -+ $total_len = tell($ofh); -+} -+else -+{ -+ die "* Failed to open '$kernel_file'\n" -+ if (!open(my $ifh, '<', $kernel_file)); -+ die "* Failed to create '$out_file'\n" -+ if (!open($ofh, '>', $out_file)); -+ -+ my $copybuf; -+ while (1) -+ { -+ my $bytes = sysread($ifh, $copybuf, 64*1024); -+ last if (!$bytes); -+ syswrite($ofh, $copybuf, $bytes); -+ $total_len += $bytes; -+ } -+ close($ifh); -+} -+ -+if ($trailer) -+{ -+ # Pad to word-alignment -+ syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); -+ syswrite($ofh, $trailer); -+} -+ -+close($ofh); -+ -+exit($trailer ? 0 : 1); -+ -+END { -+ unlink($tmpfile1) if ($tmpfile1); -+ unlink($tmpfile2) if ($tmpfile2); -+} -+ -+ -+sub usage -+{ -+ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] \n"); -+ exit(1); -+} -+ -+sub try_extract -+{ -+ my ($knl, $tmp) = @_; -+ -+ my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; -+ -+ return undef if (!$ver); -+ -+ chomp($ver); -+ -+ my $res = { 'kver'=>$ver }; -+ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); -+ -+ return $res; -+} -+ -+ -+sub try_decompress -+{ -+ my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; -+ -+ my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; -+ if ($pos) -+ { -+ chomp($pos); -+ $pos = (split(/[\r\n]+/, $pos))[$idx]; -+ return undef if (!defined($pos)); -+ $pos =~ s/:.*[\r\n]*$//s; -+ my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; -+ my $err = (system($cmd) >> 8); -+ return undef if (($err != 0) && ($err != 2)); -+ -+ return try_extract($tmp2, $tmp1); -+ } -+ -+ return undef; -+} -+ -+sub strings_to_flags -+{ -+ my ($knl, $strings) = @_; -+ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; -+ my $flags = 0; -+ -+ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -+ foreach my $match (@matches) -+ { -+ chomp($match); -+ $flags |= $strings->{$match}; -+ } -+ -+ return $flags; -+} -+ -+sub pack_trailer -+{ -+ my ($atoms) = @_; -+ my $trailer = pack('VV', 0, 0); -+ for (my $i = $#$atoms; $i>=0; $i--) -+ { -+ my $atom = $atoms->[$i]; -+ $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); -+ } -+ return $trailer; -+} - -From 94cbd8ee19d8f0e25c4af4598b07b0c22c5083ae Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 10 Aug 2015 09:49:15 +0100 -Subject: [PATCH 053/122] scripts/dtc: Update to upstream version 1.4.1 - -Includes the new localfixups format. - -Signed-off-by: Phil Elwell - -scripts/dtc: Fix UMR causing corrupt dtbo overlay files - -struct fixup_entry is allocated from the heap but it's member -local_fixup_generated was never initialized. This lead to -corrupted dtbo files. - -Fix this by initializing local_fixup_generated to false. - -Signed-off-by: Matthias Reichl - -scripts/dtc: Only emit local fixups for overlays - -Signed-off-by: Phil Elwell ---- - scripts/dtc/checks.c | 106 +++++- - scripts/dtc/dtc-lexer.l | 5 + - scripts/dtc/dtc-lexer.lex.c_shipped | 537 +++++++++++++------------- - scripts/dtc/dtc-parser.tab.c_shipped | 714 ++++++++++++++++++----------------- - scripts/dtc/dtc-parser.tab.h_shipped | 46 +-- - scripts/dtc/dtc-parser.y | 22 +- - scripts/dtc/dtc.c | 9 +- - scripts/dtc/dtc.h | 40 ++ - scripts/dtc/flattree.c | 202 ++++++++++ - scripts/dtc/version_gen.h | 2 +- - 10 files changed, 1029 insertions(+), 654 deletions(-) - -diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c -index 386f9563313f713f896236814de35811d145d121..2164d8fe5f98f123bbf74aa25e69891b31bd8c64 100644 ---- a/scripts/dtc/checks.c -+++ b/scripts/dtc/checks.c -@@ -482,6 +482,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - struct node *node, struct property *prop) - { - struct marker *m = prop->val.markers; -+ struct fixup *f, **fp; -+ struct fixup_entry *fe, **fep; - struct node *refnode; - cell_t phandle; - -@@ -490,11 +492,70 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - - refnode = get_node_by_ref(dt, m->ref); - if (! refnode) { -- FAIL(c, "Reference to non-existent node or label \"%s\"\n", -- m->ref); -+ if (!dt->is_plugin) { -+ FAIL(c, "Reference to non-existent node or label \"%s\"\n", -+ m->ref); -+ continue; -+ } -+ -+ /* allocate fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ -+ /* search for an already existing fixup */ -+ for_each_fixup(dt, f) -+ if (strcmp(f->ref, m->ref) == 0) -+ break; -+ -+ /* no fixup found, add new */ -+ if (f == NULL) { -+ f = xmalloc(sizeof(*f)); -+ f->ref = m->ref; -+ f->entries = NULL; -+ f->next = NULL; -+ -+ /* add it to the tree */ -+ fp = &dt->fixups; -+ while (*fp) -+ fp = &(*fp)->next; -+ *fp = f; -+ } -+ -+ /* and now append fixup entry */ -+ fep = &f->entries; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ -+ /* mark the entry as unresolved */ -+ *((cell_t *)(prop->val.val + m->offset)) = -+ cpu_to_fdt32(0xdeadbeef); - continue; - } - -+ /* if it's a local reference, we need to record it */ -+ if (symbol_fixup_support && dt->is_plugin) { -+ -+ /* allocate a new local fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ fe->local_fixup_generated = false; -+ -+ /* append it to the local fixups */ -+ fep = &dt->local_fixups; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ } -+ - phandle = get_node_phandle(dt, refnode); - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); - } -@@ -676,6 +737,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, - } - TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); - -+static void check_auto_label_phandles(struct check *c, struct node *dt, -+ struct node *node) -+{ -+ struct label *l; -+ struct symbol *s, **sp; -+ int has_label; -+ -+ if (!symbol_fixup_support) -+ return; -+ -+ has_label = 0; -+ for_each_label(node->labels, l) { -+ has_label = 1; -+ break; -+ } -+ -+ if (!has_label) -+ return; -+ -+ /* force allocation of a phandle for this node */ -+ (void)get_node_phandle(dt, node); -+ -+ /* add the symbol */ -+ for_each_label(node->labels, l) { -+ -+ s = xmalloc(sizeof(*s)); -+ s->label = l; -+ s->node = node; -+ s->next = NULL; -+ -+ /* add it to the symbols list */ -+ sp = &dt->symbols; -+ while (*sp) -+ sp = &((*sp)->next); -+ *sp = s; -+ } -+} -+NODE_WARNING(auto_label_phandles, NULL); -+ - static struct check *check_table[] = { - &duplicate_node_names, &duplicate_property_names, - &node_name_chars, &node_name_format, &property_name_chars, -@@ -696,6 +796,8 @@ static struct check *check_table[] = { - &avoid_default_addr_size, - &obsolete_chosen_interrupt_controller, - -+ &auto_label_phandles, -+ - &always_fail, - }; - -diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 790fbf6cf2d75349780a5c849cdb9cdb697f5019..40bbc87d0f1dcaafd7275670cc678b970397f232 100644 ---- a/scripts/dtc/dtc-lexer.l -+++ b/scripts/dtc/dtc-lexer.l -@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); - return DT_V1; - } - -+<*>"/plugin/" { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ - <*>"/memreserve/" { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); -diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped -index ba525c2f9fc28f596452999eaa2a66116446dc58..15185255fafdbebf805ad2bb2c63f0fdef4c8776 100644 ---- a/scripts/dtc/dtc-lexer.lex.c_shipped -+++ b/scripts/dtc/dtc-lexer.lex.c_shipped -@@ -9,7 +9,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 39 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; - typedef struct yy_buffer_state *YY_BUFFER_STATE; - #endif - --#ifndef YY_TYPEDEF_YY_SIZE_T --#define YY_TYPEDEF_YY_SIZE_T --typedef size_t yy_size_t; --#endif -- --extern yy_size_t yyleng; -+extern int yyleng; - - extern FILE *yyin, *yyout; - -@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; - #define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) -- #define YY_LINENO_REWIND_TO(ptr) - - /* Return all but the first "n" matched characters back to the input stream. */ - #define yyless(n) \ -@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - -+#ifndef YY_TYPEDEF_YY_SIZE_T -+#define YY_TYPEDEF_YY_SIZE_T -+typedef size_t yy_size_t; -+#endif -+ - #ifndef YY_STRUCT_YY_BUFFER_STATE - #define YY_STRUCT_YY_BUFFER_STATE - struct yy_buffer_state -@@ -211,7 +210,7 @@ struct yy_buffer_state - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ -- yy_size_t yy_n_chars; -+ int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to -@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - - /* yy_hold_char holds the character lost when yytext is formed. */ - static char yy_hold_char; --static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ --yy_size_t yyleng; -+static int yy_n_chars; /* number of characters read into yy_ch_buf */ -+int yyleng; - - /* Points to current character in buffer. */ - static char *yy_c_buf_p = (char *) 0; -@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - - YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); - YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); --YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); -+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - - void *yyalloc (yy_size_t ); - void *yyrealloc (void *,yy_size_t ); -@@ -342,7 +341,7 @@ void yyfree (void * ); - - /* Begin user sect3 */ - --#define yywrap() 1 -+#define yywrap(n) 1 - #define YY_SKIP_YYWRAP - - typedef unsigned char YY_CHAR; -@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - --#define YY_NUM_RULES 30 --#define YY_END_OF_BUFFER 31 -+#define YY_NUM_RULES 31 -+#define YY_END_OF_BUFFER 32 - /* This struct is not used in this scanner, - but its presence is necessary. */ - struct yy_trans_info -@@ -382,25 +381,26 @@ struct yy_trans_info - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; --static yyconst flex_int16_t yy_accept[159] = -+static yyconst flex_int16_t yy_accept[166] = - { 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, -- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, -- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, -- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, -- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, -- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, -- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, -- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, -- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, -- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, -- -- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, -- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, -- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -- 5, 8, 0, 0, 0, 0, 7, 0 -+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, -+ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, -+ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, -+ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, -+ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, -+ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, -+ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, -+ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, -+ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, -+ -+ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, -+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, -+ 0, 0, 0, 8, 0 - } ; - - static yyconst flex_int32_t yy_ec[256] = -@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = - 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, - 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, - -- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, -- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, -- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, -+ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, -+ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, -+ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = - 1, 1, 1, 1, 1 - } ; - --static yyconst flex_int32_t yy_meta[47] = -+static yyconst flex_int32_t yy_meta[48] = - { 0, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, - 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, - 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, -- 8, 8, 8, 3, 1, 4 -+ 8, 8, 8, 8, 3, 1, 4 - } ; - --static yyconst flex_int16_t yy_base[173] = -+static yyconst flex_int16_t yy_base[180] = - { 0, -- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, -- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, -- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, -- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, -- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, -- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, -- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, -- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, -- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, -- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, -- -- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, -- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, -- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, -- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, -- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, -- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, -- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, -- 318, 326 -+ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, -+ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, -+ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, -+ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, -+ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, -+ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, -+ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, -+ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, -+ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, -+ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, -+ -+ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, -+ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, -+ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, -+ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, -+ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, -+ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, -+ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, -+ 281, 288, 292, 300, 308, 312, 318, 326, 334 - } ; - --static yyconst flex_int16_t yy_def[173] = -+static yyconst flex_int16_t yy_def[180] = - { 0, -- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, -- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, -- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, -- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, -- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, -- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, -- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, -- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, -- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158 -+ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, -+ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, -+ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, -+ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, -+ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, -+ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, -+ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, -+ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, -+ -+ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, -+ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_nxt[438] = -+static yyconst flex_int16_t yy_nxt[449] = - { 0, - 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, - 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, - 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, -- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, -- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, -- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, -- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, -- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, -- -- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, -- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, -- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, -- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, -- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, -- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, -- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, -- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, -- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, -- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, -- -- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, -- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, -- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, -- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, -- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, -- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, -- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, -- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, -- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, -- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, -- -- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, -- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, -- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, -- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, -- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, -- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, -- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, -- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, -- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, -- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, -+ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, -+ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, -+ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, -+ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, -+ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, -+ -+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -+ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, -+ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, -+ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, -+ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, -+ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, -+ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, -+ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, -+ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, -+ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, -+ -+ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, -+ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, -+ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, -+ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, -+ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, -+ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, -+ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, -+ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, -+ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, -+ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, -+ -+ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, -+ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, -+ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, -+ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, -+ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, -+ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, -+ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, -+ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, -+ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, -+ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, -+ -+ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_chk[438] = -+static yyconst flex_int16_t yy_chk[449] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, -- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, -- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, -+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, -+ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, -+ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, -- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, -- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, -- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, -- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, -- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, -- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, -- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, -- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, -- -- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, -- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, -- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, -- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, -- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, -- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, -- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, -- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, -- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, -- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, -- -- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, -- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, -- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, -- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, -- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, -- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, -- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, -- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, -+ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, -+ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, -+ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, -+ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, -+ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, -+ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, -+ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, -+ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, -+ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, -+ -+ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, -+ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, -+ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, -+ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, -+ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, -+ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, -+ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, -+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, -+ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, -+ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, -+ -+ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, -+ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, -+ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, -+ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, -+ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, -+ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, -+ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, -+ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, -+ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, - 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - - static yy_state_type yy_last_accepting_state; -@@ -662,7 +664,7 @@ static int dts_version = 1; - static void push_input_file(const char *filename); - static bool pop_input_file(void); - static void lexical_error(const char *fmt, ...); --#line 666 "dtc-lexer.lex.c" -+#line 668 "dtc-lexer.lex.c" - - #define INITIAL 0 - #define BYTESTRING 1 -@@ -704,7 +706,7 @@ FILE *yyget_out (void ); - - void yyset_out (FILE * out_str ); - --yy_size_t yyget_leng (void ); -+int yyget_leng (void ); - - char *yyget_text (void ); - -@@ -853,6 +855,10 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - -+#line 68 "dtc-lexer.l" -+ -+#line 861 "dtc-lexer.lex.c" -+ - if ( !(yy_init) ) - { - (yy_init) = 1; -@@ -879,11 +885,6 @@ YY_DECL - yy_load_buffer_state( ); - } - -- { --#line 68 "dtc-lexer.l" -- --#line 886 "dtc-lexer.lex.c" -- - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); -@@ -901,7 +902,7 @@ YY_DECL - yy_match: - do - { -- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; -+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; -@@ -910,13 +911,13 @@ yy_match: - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } -- while ( yy_current_state != 158 ); -+ while ( yy_current_state != 165 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - -@@ -951,39 +952,31 @@ case 2: - YY_RULE_SETUP - #line 75 "dtc-lexer.l" - { -- char *line, *fnstart, *fnend; -- struct data fn; -+ char *line, *tmp, *fn; - /* skip text before line # */ - line = yytext; - while (!isdigit((unsigned char)*line)) - line++; -- -- /* regexp ensures that first and list " -- * in the whole yytext are those at -- * beginning and end of the filename string */ -- fnstart = memchr(yytext, '"', yyleng); -- for (fnend = yytext + yyleng - 1; -- *fnend != '"'; fnend--) -- ; -- assert(fnstart && fnend && (fnend > fnstart)); -- -- fn = data_copy_escape_string(fnstart + 1, -- fnend - fnstart - 1); -- -- /* Don't allow nuls in filenames */ -- if (memchr(fn.val, '\0', fn.len - 1)) -- lexical_error("nul in line number directive"); -- -+ /* skip digits in line # */ -+ tmp = line; -+ while (!isspace((unsigned char)*tmp)) -+ tmp++; -+ /* "NULL"-terminate line # */ -+ *tmp = '\0'; -+ /* start of filename */ -+ fn = strchr(tmp + 1, '"') + 1; -+ /* strip trailing " from filename */ -+ tmp = strchr(fn, '"'); -+ *tmp = 0; - /* -1 since #line is the number of the next line */ -- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); -- data_free(fn); -+ srcpos_set_line(xstrdup(fn), atoi(line) - 1); - } - YY_BREAK - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(BYTESTRING): - case YY_STATE_EOF(PROPNODENAME): - case YY_STATE_EOF(V1): --#line 104 "dtc-lexer.l" -+#line 96 "dtc-lexer.l" - { - if (!pop_input_file()) { - yyterminate(); -@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): - case 3: - /* rule 3 can match eol */ - YY_RULE_SETUP --#line 110 "dtc-lexer.l" -+#line 102 "dtc-lexer.l" - { - DPRINT("String: %s\n", yytext); - yylval.data = data_copy_escape_string(yytext+1, -@@ -1003,7 +996,7 @@ YY_RULE_SETUP - YY_BREAK - case 4: - YY_RULE_SETUP --#line 117 "dtc-lexer.l" -+#line 109 "dtc-lexer.l" - { - DPRINT("Keyword: /dts-v1/\n"); - dts_version = 1; -@@ -1013,25 +1006,33 @@ YY_RULE_SETUP - YY_BREAK - case 5: - YY_RULE_SETUP --#line 124 "dtc-lexer.l" -+#line 116 "dtc-lexer.l" -+{ -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ YY_BREAK -+case 6: -+YY_RULE_SETUP -+#line 121 "dtc-lexer.l" - { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); - return DT_MEMRESERVE; - } - YY_BREAK --case 6: -+case 7: - YY_RULE_SETUP --#line 130 "dtc-lexer.l" -+#line 127 "dtc-lexer.l" - { - DPRINT("Keyword: /bits/\n"); - BEGIN_DEFAULT(); - return DT_BITS; - } - YY_BREAK --case 7: -+case 8: - YY_RULE_SETUP --#line 136 "dtc-lexer.l" -+#line 133 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-property/\n"); - DPRINT("\n"); -@@ -1039,9 +1040,9 @@ YY_RULE_SETUP - return DT_DEL_PROP; - } - YY_BREAK --case 8: -+case 9: - YY_RULE_SETUP --#line 143 "dtc-lexer.l" -+#line 140 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-node/\n"); - DPRINT("\n"); -@@ -1049,9 +1050,9 @@ YY_RULE_SETUP - return DT_DEL_NODE; - } - YY_BREAK --case 9: -+case 10: - YY_RULE_SETUP --#line 150 "dtc-lexer.l" -+#line 147 "dtc-lexer.l" - { - DPRINT("Label: %s\n", yytext); - yylval.labelref = xstrdup(yytext); -@@ -1059,9 +1060,9 @@ YY_RULE_SETUP - return DT_LABEL; - } - YY_BREAK --case 10: -+case 11: - YY_RULE_SETUP --#line 157 "dtc-lexer.l" -+#line 154 "dtc-lexer.l" - { - char *e; - DPRINT("Integer Literal: '%s'\n", yytext); -@@ -1069,10 +1070,7 @@ YY_RULE_SETUP - errno = 0; - yylval.integer = strtoull(yytext, &e, 0); - -- if (*e && e[strspn(e, "UL")]) { -- lexical_error("Bad integer literal '%s'", -- yytext); -- } -+ assert(!(*e) || !e[strspn(e, "UL")]); - - if (errno == ERANGE) - lexical_error("Integer literal '%s' out of range", -@@ -1084,10 +1082,10 @@ YY_RULE_SETUP - return DT_LITERAL; - } - YY_BREAK --case 11: --/* rule 11 can match eol */ -+case 12: -+/* rule 12 can match eol */ - YY_RULE_SETUP --#line 179 "dtc-lexer.l" -+#line 173 "dtc-lexer.l" - { - struct data d; - DPRINT("Character literal: %s\n", yytext); -@@ -1109,18 +1107,18 @@ YY_RULE_SETUP - return DT_CHAR_LITERAL; - } - YY_BREAK --case 12: -+case 13: - YY_RULE_SETUP --#line 200 "dtc-lexer.l" -+#line 194 "dtc-lexer.l" - { /* label reference */ - DPRINT("Ref: %s\n", yytext+1); - yylval.labelref = xstrdup(yytext+1); - return DT_REF; - } - YY_BREAK --case 13: -+case 14: - YY_RULE_SETUP --#line 206 "dtc-lexer.l" -+#line 200 "dtc-lexer.l" - { /* new-style path reference */ - yytext[yyleng-1] = '\0'; - DPRINT("Ref: %s\n", yytext+2); -@@ -1128,27 +1126,27 @@ YY_RULE_SETUP - return DT_REF; - } - YY_BREAK --case 14: -+case 15: - YY_RULE_SETUP --#line 213 "dtc-lexer.l" -+#line 207 "dtc-lexer.l" - { - yylval.byte = strtol(yytext, NULL, 16); - DPRINT("Byte: %02x\n", (int)yylval.byte); - return DT_BYTE; - } - YY_BREAK --case 15: -+case 16: - YY_RULE_SETUP --#line 219 "dtc-lexer.l" -+#line 213 "dtc-lexer.l" - { - DPRINT("/BYTESTRING\n"); - BEGIN_DEFAULT(); - return ']'; - } - YY_BREAK --case 16: -+case 17: - YY_RULE_SETUP --#line 225 "dtc-lexer.l" -+#line 219 "dtc-lexer.l" - { - DPRINT("PropNodeName: %s\n", yytext); - yylval.propnodename = xstrdup((yytext[0] == '\\') ? -@@ -1157,75 +1155,75 @@ YY_RULE_SETUP - return DT_PROPNODENAME; - } - YY_BREAK --case 17: -+case 18: - YY_RULE_SETUP --#line 233 "dtc-lexer.l" -+#line 227 "dtc-lexer.l" - { - DPRINT("Binary Include\n"); - return DT_INCBIN; - } - YY_BREAK --case 18: --/* rule 18 can match eol */ --YY_RULE_SETUP --#line 238 "dtc-lexer.l" --/* eat whitespace */ -- YY_BREAK - case 19: - /* rule 19 can match eol */ - YY_RULE_SETUP --#line 239 "dtc-lexer.l" --/* eat C-style comments */ -+#line 232 "dtc-lexer.l" -+/* eat whitespace */ - YY_BREAK - case 20: - /* rule 20 can match eol */ - YY_RULE_SETUP --#line 240 "dtc-lexer.l" --/* eat C++-style comments */ -+#line 233 "dtc-lexer.l" -+/* eat C-style comments */ - YY_BREAK - case 21: -+/* rule 21 can match eol */ - YY_RULE_SETUP --#line 242 "dtc-lexer.l" --{ return DT_LSHIFT; }; -+#line 234 "dtc-lexer.l" -+/* eat C++-style comments */ - YY_BREAK - case 22: - YY_RULE_SETUP --#line 243 "dtc-lexer.l" --{ return DT_RSHIFT; }; -+#line 236 "dtc-lexer.l" -+{ return DT_LSHIFT; }; - YY_BREAK - case 23: - YY_RULE_SETUP --#line 244 "dtc-lexer.l" --{ return DT_LE; }; -+#line 237 "dtc-lexer.l" -+{ return DT_RSHIFT; }; - YY_BREAK - case 24: - YY_RULE_SETUP --#line 245 "dtc-lexer.l" --{ return DT_GE; }; -+#line 238 "dtc-lexer.l" -+{ return DT_LE; }; - YY_BREAK - case 25: - YY_RULE_SETUP --#line 246 "dtc-lexer.l" --{ return DT_EQ; }; -+#line 239 "dtc-lexer.l" -+{ return DT_GE; }; - YY_BREAK - case 26: - YY_RULE_SETUP --#line 247 "dtc-lexer.l" --{ return DT_NE; }; -+#line 240 "dtc-lexer.l" -+{ return DT_EQ; }; - YY_BREAK - case 27: - YY_RULE_SETUP --#line 248 "dtc-lexer.l" --{ return DT_AND; }; -+#line 241 "dtc-lexer.l" -+{ return DT_NE; }; - YY_BREAK - case 28: - YY_RULE_SETUP --#line 249 "dtc-lexer.l" --{ return DT_OR; }; -+#line 242 "dtc-lexer.l" -+{ return DT_AND; }; - YY_BREAK - case 29: - YY_RULE_SETUP --#line 251 "dtc-lexer.l" -+#line 243 "dtc-lexer.l" -+{ return DT_OR; }; -+ YY_BREAK -+case 30: -+YY_RULE_SETUP -+#line 245 "dtc-lexer.l" - { - DPRINT("Char: %c (\\x%02x)\n", yytext[0], - (unsigned)yytext[0]); -@@ -1241,12 +1239,12 @@ YY_RULE_SETUP - return yytext[0]; - } - YY_BREAK --case 30: -+case 31: - YY_RULE_SETUP --#line 266 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - ECHO; - YY_BREAK --#line 1250 "dtc-lexer.lex.c" -+#line 1248 "dtc-lexer.lex.c" - - case YY_END_OF_BUFFER: - { -@@ -1376,7 +1374,6 @@ ECHO; - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -- } /* end of user's declarations */ - } /* end of yylex */ - - /* yy_get_next_buffer - try to read in a new buffer -@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) - - else - { -- yy_size_t num_to_read = -+ int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ -- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; -+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { -- yy_size_t new_size = b->yy_buf_size * 2; -+ int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; -@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), -- (yy_n_chars), num_to_read ); -+ (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } -@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -- yy_is_jam = (yy_current_state == 158); -+ yy_is_jam = (yy_current_state == 165); - -- return yy_is_jam ? 0 : yy_current_state; -+ return yy_is_jam ? 0 : yy_current_state; - } - - #ifndef YY_NO_INPUT -@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) - - else - { /* need more input */ -- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); -+ int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) -@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) - */ - static void yyensure_buffer_stack (void) - { -- yy_size_t num_to_alloc; -+ int num_to_alloc; - - if (!(yy_buffer_stack)) { - -@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) - * - * @return the newly allocated buffer state object. - */ --YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; -- yy_size_t i; -+ int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; -@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) - /** Get the length of the current token. - * - */ --yy_size_t yyget_leng (void) -+int yyget_leng (void) - { - return yyleng; - } -@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 265 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - - - -diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped -index 31cec50a12650a254a639a6a291ce74f07a0e2c2..844c4628962d0e3e2860edf1315bec4e21b7a810 100644 ---- a/scripts/dtc/dtc-parser.tab.c_shipped -+++ b/scripts/dtc/dtc-parser.tab.c_shipped -@@ -65,6 +65,7 @@ - #line 20 "dtc-parser.y" /* yacc.c:339 */ - - #include -+#include - - #include "dtc.h" - #include "srcpos.h" -@@ -80,7 +81,7 @@ extern void yyerror(char const *s); - extern struct boot_info *the_boot_info; - extern bool treesource_error; - --#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ -+#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ - - # ifndef YY_NULLPTR - # if defined __cplusplus && 201103L <= __cplusplus -@@ -116,26 +117,27 @@ extern int yydebug; - enum yytokentype - { - DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 - }; - #endif - -@@ -144,7 +146,7 @@ extern int yydebug; - typedef union YYSTYPE YYSTYPE; - union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:355 */ -+#line 39 "dtc-parser.y" /* yacc.c:355 */ - - char *propnodename; - char *labelref; -@@ -162,8 +164,9 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - --#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ -+#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ - }; - # define YYSTYPE_IS_TRIVIAL 1 - # define YYSTYPE_IS_DECLARED 1 -@@ -192,7 +195,7 @@ int yyparse (void); - - /* Copy the second part of user declarations. */ - --#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ -+#line 199 "dtc-parser.tab.c" /* yacc.c:358 */ - - #ifdef short - # undef short -@@ -439,18 +442,18 @@ union yyalloc - #define YYLAST 136 - - /* YYNTOKENS -- Number of terminals. */ --#define YYNTOKENS 47 -+#define YYNTOKENS 48 - /* YYNNTS -- Number of nonterminals. */ --#define YYNNTS 28 -+#define YYNNTS 29 - /* YYNRULES -- Number of rules. */ --#define YYNRULES 80 -+#define YYNRULES 82 - /* YYNSTATES -- Number of states. */ --#define YYNSTATES 144 -+#define YYNSTATES 147 - - /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ - #define YYUNDEFTOK 2 --#define YYMAXUTOK 278 -+#define YYMAXUTOK 279 - - #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -@@ -462,16 +465,16 @@ static const yytype_uint8 yytranslate[] = - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, -- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, -- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, -- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, -+ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, -+ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, -+ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, -+ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, -+ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, -+ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -@@ -486,22 +489,22 @@ static const yytype_uint8 yytranslate[] = - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -- 15, 16, 17, 18, 19, 20, 21, 22, 23 -+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - }; - - #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ - static const yytype_uint16 yyrline[] = - { -- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, -- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, -- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, -- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, -- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, -- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, -- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, -- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, -- 481 -+ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151, -+ 155, 160, 171, 181, 196, 204, 207, 214, 218, 222, -+ 226, 234, 238, 242, 246, 250, 266, 276, 284, 287, -+ 291, 298, 314, 319, 338, 352, 359, 360, 361, 368, -+ 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, -+ 397, 398, 402, 403, 404, 408, 409, 410, 411, 412, -+ 416, 417, 418, 422, 423, 424, 428, 429, 430, 431, -+ 435, 436, 437, 438, 443, 446, 450, 458, 461, 465, -+ 473, 477, 481 - }; - #endif - -@@ -510,19 +513,19 @@ static const yytype_uint16 yyrline[] = - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ - static const char *const yytname[] = - { -- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", -- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", -- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", -- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", -- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", -- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", -- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", -- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", -- "integer_expr", "integer_trinary", "integer_or", "integer_and", -- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", -- "integer_rela", "integer_shift", "integer_add", "integer_mul", -- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR -+ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", -+ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", -+ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", -+ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", -+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", -+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", -+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -+ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", -+ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", -+ "integer_prim", "integer_expr", "integer_trinary", "integer_or", -+ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", -+ "integer_eq", "integer_rela", "integer_shift", "integer_add", -+ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR - }; - #endif - -@@ -533,16 +536,16 @@ static const yytype_uint16 yytoknum[] = - { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, -- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, -- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, -- 38, 43, 45, 42, 37, 126, 33 -+ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, -+ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, -+ 94, 38, 43, 45, 42, 37, 126, 33 - }; - # endif - --#define YYPACT_NINF -81 -+#define YYPACT_NINF -84 - - #define yypact_value_is_default(Yystate) \ -- (!!((Yystate) == (-81))) -+ (!!((Yystate) == (-84))) - - #define YYTABLE_NINF -1 - -@@ -553,21 +556,21 @@ static const yytype_uint16 yytoknum[] = - STATE-NUM. */ - static const yytype_int8 yypact[] = - { -- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, -- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, -- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, -- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, -- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, -- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, -- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, -- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, -- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, -- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, -- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, -- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, -- 74, 25, 75, -81 -+ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, -+ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, -+ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, -+ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, -+ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, -+ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, -+ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, -+ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, -+ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, -+ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, -+ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, -+ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, -+ -84, 24, -84, 77, 24, 80, -84 - }; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. -@@ -575,37 +578,37 @@ static const yytype_int8 yypact[] = - means the default is an error. */ - static const yytype_uint8 yydefact[] = - { -- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, -- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, -- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, -- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, -- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, -+ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, -+ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, -+ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, -+ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, -+ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, -- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, -- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, -- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, -- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, -- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, -- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, -- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, -- 0, 0, 0, 23 -+ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, -+ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, -+ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, -+ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, -+ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, -+ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, -+ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, -+ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, -+ 23, 0, 26, 0, 0, 0, 25 - }; - - /* YYPGOTO[NTERM-NUM]. */ - static const yytype_int8 yypgoto[] = - { -- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, -- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, -- 37, 27, 34, 38, -14, -81, 22, 24 -+ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, -+ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, -+ 82, 29, 18, 25, 26, -17, -84, 20, 28 - }; - - /* YYDEFGOTO[NTERM-NUM]. */ - static const yytype_int16 yydefgoto[] = - { -- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, -- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, -- 29, 30, 31, 32, 33, 128, 94, 95 -+ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, -+ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, -+ 31, 32, 33, 34, 35, 36, 131, 97, 98 - }; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If -@@ -613,87 +616,87 @@ static const yytype_int16 yydefgoto[] = - number is the opposite. If YYTABLE_NINF, syntax error. */ - static const yytype_uint8 yytable[] = - { -- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, -- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, -- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, -- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, -- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, -- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, -- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, -- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, -- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, -- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, -- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, -- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, -- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, -- 0, 0, 75, 140, 0, 0, 142 -+ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, -+ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, -+ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, -+ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, -+ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, -+ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, -+ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, -+ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, -+ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, -+ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, -+ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, -+ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, -+ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 143, 0, 78, 145 - }; - - static const yytype_int16 yycheck[] = - { -- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, -- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, -- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, -- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, -- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, -- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, -- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, -- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, -- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, -- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, -- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, -- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, -- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, -- -1, -1, 50, 138, -1, -1, 141 -+ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, -+ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, -+ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, -+ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, -+ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, -+ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, -+ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, -+ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, -+ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, -+ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, -+ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, -+ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, -+ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, 141, -1, 53, 144 - }; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ - static const yytype_uint8 yystos[] = - { -- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, -- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, -- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, -- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, -- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, -- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, -- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, -- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, -- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, -- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, -- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, -- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, -- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, -- 58, 33, 58, 34 -+ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, -+ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, -+ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, -+ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, -+ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, -+ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, -+ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, -+ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, -+ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, -+ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, -+ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, -+ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, -+ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, -+ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, -+ 32, 34, 35, 60, 34, 60, 35 - }; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ - static const yytype_uint8 yyr1[] = - { -- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, -- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, -- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, -- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, -- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, -- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, -- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, -- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, -- 74 -+ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, -+ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, -+ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, -+ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, -+ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, -+ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, -+ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, -+ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, -+ 76, 76, 76 - }; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ - static const yytype_uint8 yyr2[] = - { -- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, -- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, -- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, -- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, -- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, -- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, -- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, -- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, -- 2 -+ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, -+ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, -+ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, -+ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, -+ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, -+ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, -+ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, -+ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, -+ 2, 3, 2 - }; - - -@@ -1463,65 +1466,82 @@ yyreduce: - switch (yyn) - { - case 2: --#line 105 "dtc-parser.y" /* yacc.c:1646 */ -+#line 109 "dtc-parser.y" /* yacc.c:1646 */ - { -+ (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin); - the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), - guess_boot_cpuid((yyvsp[0].node))); - } --#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1476 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 3: --#line 113 "dtc-parser.y" /* yacc.c:1646 */ -+#line 118 "dtc-parser.y" /* yacc.c:1646 */ - { -- (yyval.re) = NULL; -+ (yyval.is_plugin) = false; - } --#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1484 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 4: --#line 117 "dtc-parser.y" /* yacc.c:1646 */ -+#line 122 "dtc-parser.y" /* yacc.c:1646 */ - { -- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -+ (yyval.is_plugin) = true; - } --#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1492 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 5: --#line 124 "dtc-parser.y" /* yacc.c:1646 */ -+#line 129 "dtc-parser.y" /* yacc.c:1646 */ - { -- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -+ (yyval.re) = NULL; - } --#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1500 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 6: --#line 128 "dtc-parser.y" /* yacc.c:1646 */ -+#line 133 "dtc-parser.y" /* yacc.c:1646 */ -+ { -+ (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -+ } -+#line 1508 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ break; -+ -+ case 7: -+#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ { -+ (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -+ } -+#line 1516 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ break; -+ -+ case 8: -+#line 144 "dtc-parser.y" /* yacc.c:1646 */ - { - add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); - (yyval.re) = (yyvsp[0].re); - } --#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1525 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 7: --#line 136 "dtc-parser.y" /* yacc.c:1646 */ -+ case 9: -+#line 152 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = name_node((yyvsp[0].node), ""); - } --#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1533 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 8: --#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ case 10: -+#line 156 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); - } --#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1541 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 9: --#line 145 "dtc-parser.y" /* yacc.c:1646 */ -+ case 11: -+#line 161 "dtc-parser.y" /* yacc.c:1646 */ - { - struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -@@ -1532,11 +1552,11 @@ yyreduce: - ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); - (yyval.node) = (yyvsp[-3].node); - } --#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 10: --#line 156 "dtc-parser.y" /* yacc.c:1646 */ -+ case 12: -+#line 172 "dtc-parser.y" /* yacc.c:1646 */ - { - struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); - -@@ -1546,11 +1566,11 @@ yyreduce: - ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); - (yyval.node) = (yyvsp[-2].node); - } --#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1570 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 11: --#line 166 "dtc-parser.y" /* yacc.c:1646 */ -+ case 13: -+#line 182 "dtc-parser.y" /* yacc.c:1646 */ - { - struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -@@ -1562,100 +1582,100 @@ yyreduce: - - (yyval.node) = (yyvsp[-3].node); - } --#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1586 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 12: --#line 181 "dtc-parser.y" /* yacc.c:1646 */ -+ case 14: -+#line 197 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); - } --#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1594 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 13: --#line 188 "dtc-parser.y" /* yacc.c:1646 */ -+ case 15: -+#line 204 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.proplist) = NULL; - } --#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1602 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 14: --#line 192 "dtc-parser.y" /* yacc.c:1646 */ -+ case 16: -+#line 208 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); - } --#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1610 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 15: --#line 199 "dtc-parser.y" /* yacc.c:1646 */ -+ case 17: -+#line 215 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); - } --#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1618 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 16: --#line 203 "dtc-parser.y" /* yacc.c:1646 */ -+ case 18: -+#line 219 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); - } --#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1626 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 17: --#line 207 "dtc-parser.y" /* yacc.c:1646 */ -+ case 19: -+#line 223 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); - } --#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1634 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 18: --#line 211 "dtc-parser.y" /* yacc.c:1646 */ -+ case 20: -+#line 227 "dtc-parser.y" /* yacc.c:1646 */ - { - add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); - (yyval.prop) = (yyvsp[0].prop); - } --#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1643 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 19: --#line 219 "dtc-parser.y" /* yacc.c:1646 */ -+ case 21: -+#line 235 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); - } --#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1651 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 20: --#line 223 "dtc-parser.y" /* yacc.c:1646 */ -+ case 22: -+#line 239 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); - } --#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1659 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 21: --#line 227 "dtc-parser.y" /* yacc.c:1646 */ -+ case 23: -+#line 243 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); - } --#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1667 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 22: --#line 231 "dtc-parser.y" /* yacc.c:1646 */ -+ case 24: -+#line 247 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); - } --#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 23: --#line 235 "dtc-parser.y" /* yacc.c:1646 */ -+ case 25: -+#line 251 "dtc-parser.y" /* yacc.c:1646 */ - { - FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); - struct data d; -@@ -1671,11 +1691,11 @@ yyreduce: - (yyval.data) = data_merge((yyvsp[-8].data), d); - fclose(f); - } --#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 24: --#line 251 "dtc-parser.y" /* yacc.c:1646 */ -+ case 26: -+#line 267 "dtc-parser.y" /* yacc.c:1646 */ - { - FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); - struct data d = empty_data; -@@ -1685,43 +1705,43 @@ yyreduce: - (yyval.data) = data_merge((yyvsp[-4].data), d); - fclose(f); - } --#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1709 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 25: --#line 261 "dtc-parser.y" /* yacc.c:1646 */ -+ case 27: -+#line 277 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); - } --#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1717 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 26: --#line 268 "dtc-parser.y" /* yacc.c:1646 */ -+ case 28: -+#line 284 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = empty_data; - } --#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 27: --#line 272 "dtc-parser.y" /* yacc.c:1646 */ -+ case 29: -+#line 288 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = (yyvsp[-1].data); - } --#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1733 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 28: --#line 276 "dtc-parser.y" /* yacc.c:1646 */ -+ case 30: -+#line 292 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); - } --#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 29: --#line 283 "dtc-parser.y" /* yacc.c:1646 */ -+ case 31: -+#line 299 "dtc-parser.y" /* yacc.c:1646 */ - { - unsigned long long bits; - -@@ -1737,20 +1757,20 @@ yyreduce: - (yyval.array).data = empty_data; - (yyval.array).bits = bits; - } --#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1761 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 30: --#line 299 "dtc-parser.y" /* yacc.c:1646 */ -+ case 32: -+#line 315 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.array).data = empty_data; - (yyval.array).bits = 32; - } --#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1770 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 31: --#line 304 "dtc-parser.y" /* yacc.c:1646 */ -+ case 33: -+#line 320 "dtc-parser.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].array).bits < 64) { - uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; -@@ -1769,11 +1789,11 @@ yyreduce: - - (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); - } --#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1793 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 32: --#line 323 "dtc-parser.y" /* yacc.c:1646 */ -+ case 34: -+#line 339 "dtc-parser.y" /* yacc.c:1646 */ - { - uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); - -@@ -1787,247 +1807,233 @@ yyreduce: - - (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); - } --#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1811 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 33: --#line 337 "dtc-parser.y" /* yacc.c:1646 */ -+ case 35: -+#line 353 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); - } --#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 36: --#line 346 "dtc-parser.y" /* yacc.c:1646 */ -+ case 38: -+#line 362 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.integer) = (yyvsp[-1].integer); - } --#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1827 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 39: --#line 357 "dtc-parser.y" /* yacc.c:1646 */ -+ case 41: -+#line 373 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } --#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1833 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 41: --#line 362 "dtc-parser.y" /* yacc.c:1646 */ -+ case 43: -+#line 378 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } --#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 43: --#line 367 "dtc-parser.y" /* yacc.c:1646 */ -+ case 45: -+#line 383 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } --#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 45: --#line 372 "dtc-parser.y" /* yacc.c:1646 */ -+ case 47: -+#line 388 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } --#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 47: --#line 377 "dtc-parser.y" /* yacc.c:1646 */ -+ case 49: -+#line 393 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } --#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 49: --#line 382 "dtc-parser.y" /* yacc.c:1646 */ -+ case 51: -+#line 398 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } --#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 51: --#line 387 "dtc-parser.y" /* yacc.c:1646 */ -+ case 53: -+#line 403 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } --#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 52: --#line 388 "dtc-parser.y" /* yacc.c:1646 */ -+ case 54: -+#line 404 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } --#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 54: --#line 393 "dtc-parser.y" /* yacc.c:1646 */ -+ case 56: -+#line 409 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } --#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 55: --#line 394 "dtc-parser.y" /* yacc.c:1646 */ -+ case 57: -+#line 410 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } --#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 56: --#line 395 "dtc-parser.y" /* yacc.c:1646 */ -+ case 58: -+#line 411 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } --#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 57: --#line 396 "dtc-parser.y" /* yacc.c:1646 */ -+ case 59: -+#line 412 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } --#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 58: --#line 400 "dtc-parser.y" /* yacc.c:1646 */ -+ case 60: -+#line 416 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } --#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 59: --#line 401 "dtc-parser.y" /* yacc.c:1646 */ -+ case 61: -+#line 417 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } --#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 61: --#line 406 "dtc-parser.y" /* yacc.c:1646 */ -+ case 63: -+#line 422 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } --#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 62: --#line 407 "dtc-parser.y" /* yacc.c:1646 */ -+ case 64: -+#line 423 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } --#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 64: --#line 412 "dtc-parser.y" /* yacc.c:1646 */ -+ case 66: -+#line 428 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } --#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 65: --#line 414 "dtc-parser.y" /* yacc.c:1646 */ -- { -- if ((yyvsp[0].integer) != 0) { -- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); -- } else { -- ERROR(&(yyloc), "Division by zero"); -- (yyval.integer) = 0; -- } -- } --#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 67: -+#line 429 "dtc-parser.y" /* yacc.c:1646 */ -+ { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } -+#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 66: --#line 423 "dtc-parser.y" /* yacc.c:1646 */ -- { -- if ((yyvsp[0].integer) != 0) { -- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); -- } else { -- ERROR(&(yyloc), "Division by zero"); -- (yyval.integer) = 0; -- } -- } --#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 68: -+#line 430 "dtc-parser.y" /* yacc.c:1646 */ -+ { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } -+#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 69: -+ case 71: - #line 436 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = -(yyvsp[0].integer); } --#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 70: -+ case 72: - #line 437 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = ~(yyvsp[0].integer); } --#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 71: -+ case 73: - #line 438 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = !(yyvsp[0].integer); } --#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 72: -+ case 74: - #line 443 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = empty_data; - } --#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 73: -+ case 75: - #line 447 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); - } --#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1975 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 74: -+ case 76: - #line 451 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); - } --#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1983 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 75: -+ case 77: - #line 458 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.nodelist) = NULL; - } --#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 76: -+ case 78: - #line 462 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); - } --#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1999 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 77: -+ case 79: - #line 466 "dtc-parser.y" /* yacc.c:1646 */ - { - ERROR(&(yylsp[0]), "Properties must precede subnodes"); - YYERROR; - } --#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2008 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 78: -+ case 80: - #line 474 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); - } --#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2016 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 79: -+ case 81: - #line 478 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); - } --#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2024 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 80: -+ case 82: - #line 482 "dtc-parser.y" /* yacc.c:1646 */ - { - add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); - (yyval.node) = (yyvsp[0].node); - } --#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2033 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - --#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2037 "dtc-parser.tab.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires -diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped -index 30867c688300e38333877360e3b05475d5b4a2a3..276d0788f8581bf1970ec8ef9c29b1981b4fe252 100644 ---- a/scripts/dtc/dtc-parser.tab.h_shipped -+++ b/scripts/dtc/dtc-parser.tab.h_shipped -@@ -46,26 +46,27 @@ extern int yydebug; - enum yytokentype - { - DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 - }; - #endif - -@@ -74,7 +75,7 @@ extern int yydebug; - typedef union YYSTYPE YYSTYPE; - union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:1909 */ -+#line 39 "dtc-parser.y" /* yacc.c:1909 */ - - char *propnodename; - char *labelref; -@@ -92,8 +93,9 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - --#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ -+#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ - }; - # define YYSTYPE_IS_TRIVIAL 1 - # define YYSTYPE_IS_DECLARED 1 -diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y -index 000873f070fdcf3e4a11618cbfefdccb0d8e6cf9..bd67bacd543db130cc547ce7b6238ee168a62f19 100644 ---- a/scripts/dtc/dtc-parser.y -+++ b/scripts/dtc/dtc-parser.y -@@ -19,6 +19,7 @@ - */ - %{ - #include -+#include - - #include "dtc.h" - #include "srcpos.h" -@@ -52,9 +53,11 @@ extern bool treesource_error; - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - } - - %token DT_V1 -+%token DT_PLUGIN - %token DT_MEMRESERVE - %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR - %token DT_BITS -@@ -71,6 +74,7 @@ extern bool treesource_error; - - %type propdata - %type propdataprefix -+%type plugindecl - %type memreserve - %type memreserves - %type arrayprefix -@@ -101,10 +105,22 @@ extern bool treesource_error; - %% - - sourcefile: -- DT_V1 ';' memreserves devicetree -+ DT_V1 ';' plugindecl memreserves devicetree - { -- the_boot_info = build_boot_info($3, $4, -- guess_boot_cpuid($4)); -+ $5->is_plugin = $3; -+ the_boot_info = build_boot_info($4, $5, -+ guess_boot_cpuid($5)); -+ } -+ ; -+ -+plugindecl: -+ /* empty */ -+ { -+ $$ = false; -+ } -+ | DT_PLUGIN ';' -+ { -+ $$ = true; - } - ; - -diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c -index 5fa23c406266e1ec58b9184cc81d381233f8f967..1f8c2852bf14ddad4b1312d7a81eceac947acdfe 100644 ---- a/scripts/dtc/dtc.c -+++ b/scripts/dtc/dtc.c -@@ -31,6 +31,7 @@ int reservenum; /* Number of memory reservation slots */ - int minsize; /* Minimum blob size */ - int padsize; /* Additional padding to blob */ - int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ -+int symbol_fixup_support = 0; - - static void fill_fullpaths(struct node *tree, const char *prefix) - { -@@ -53,7 +54,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) - #define FDT_VERSION(version) _FDT_VERSION(version) - #define _FDT_VERSION(version) #version - static const char usage_synopsis[] = "dtc [options] "; --static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; -+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv"; - static struct option const usage_long_opts[] = { - {"quiet", no_argument, NULL, 'q'}, - {"in-format", a_argument, NULL, 'I'}, -@@ -71,6 +72,7 @@ static struct option const usage_long_opts[] = { - {"phandle", a_argument, NULL, 'H'}, - {"warning", a_argument, NULL, 'W'}, - {"error", a_argument, NULL, 'E'}, -+ {"symbols", no_argument, NULL, '@'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'v'}, - {NULL, no_argument, NULL, 0x0}, -@@ -101,6 +103,7 @@ static const char * const usage_opts_help[] = { - "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", - "\n\tEnable/disable warnings (prefix with \"no-\")", - "\n\tEnable/disable errors (prefix with \"no-\")", -+ "\n\tEnable symbols/fixup support", - "\n\tPrint this help and exit", - "\n\tPrint version and exit", - NULL, -@@ -233,7 +236,9 @@ int main(int argc, char *argv[]) - case 'E': - parse_checks_option(false, true, optarg); - break; -- -+ case '@': -+ symbol_fixup_support = 1; -+ break; - case 'h': - usage(NULL); - default: -diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h -index 56212c8df660396b1d9bf6752e1121990e0789ab..f163b22b14b806b637c9fe996efd02762d182e1d 100644 ---- a/scripts/dtc/dtc.h -+++ b/scripts/dtc/dtc.h -@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ - extern int minsize; /* Minimum blob size */ - extern int padsize; /* Additional padding to blob */ - extern int phandle_format; /* Use linux,phandle or phandle properties */ -+extern int symbol_fixup_support;/* enable symbols & fixup support */ - - #define PHANDLE_LEGACY 0x1 - #define PHANDLE_EPAPR 0x2 -@@ -132,6 +133,26 @@ struct label { - struct label *next; - }; - -+struct fixup_entry { -+ int offset; -+ struct node *node; -+ struct property *prop; -+ struct fixup_entry *next; -+ bool local_fixup_generated; -+}; -+ -+struct fixup { -+ char *ref; -+ struct fixup_entry *entries; -+ struct fixup *next; -+}; -+ -+struct symbol { -+ struct label *label; -+ struct node *node; -+ struct symbol *next; -+}; -+ - struct property { - bool deleted; - char *name; -@@ -158,6 +179,13 @@ struct node { - int addr_cells, size_cells; - - struct label *labels; -+ -+ struct symbol *symbols; -+ struct fixup_entry *local_fixups; -+ bool emit_local_fixup_node; -+ -+ bool is_plugin; -+ struct fixup *fixups; - }; - - #define for_each_label_withdel(l0, l) \ -@@ -181,6 +209,18 @@ struct node { - for_each_child_withdel(n, c) \ - if (!(c)->deleted) - -+#define for_each_fixup(n, f) \ -+ for ((f) = (n)->fixups; (f); (f) = (f)->next) -+ -+#define for_each_fixup_entry(f, fe) \ -+ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) -+ -+#define for_each_symbol(n, s) \ -+ for ((s) = (n)->symbols; (s); (s) = (s)->next) -+ -+#define for_each_local_fixup_entry(n, fe) \ -+ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) -+ - void add_label(struct label **labels, char *label); - void delete_labels(struct label **labels); - -diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c -index ec14954f5810de3ad7262d5ee60e21b23565c155..f8f1e34b781f8c85d36a3d03f84ea5fe39f2e4b2 100644 ---- a/scripts/dtc/flattree.c -+++ b/scripts/dtc/flattree.c -@@ -255,6 +255,204 @@ static int stringtable_insert(struct data *d, const char *str) - return i; - } - -+static void emit_local_fixups(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, struct version_info *vi, -+ struct node *node) -+{ -+ struct fixup_entry *fe, *fen; -+ struct node *child; -+ int nameoff, count; -+ cell_t *buf; -+ struct data d; -+ -+ if (node->emit_local_fixup_node) { -+ -+ /* emit the external fixups (do not emit /) */ -+ if (node != tree) { -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, node->name, 0); -+ emit->align(etarget, sizeof(cell_t)); -+ } -+ -+ for_each_local_fixup_entry(tree, fe) { -+ if (fe->node != node || fe->local_fixup_generated) -+ continue; -+ -+ /* count the number of fixup entries */ -+ count = 0; -+ for_each_local_fixup_entry(tree, fen) { -+ if (fen->prop != fe->prop) -+ continue; -+ fen->local_fixup_generated = true; -+ count++; -+ } -+ -+ /* allocate buffer */ -+ buf = xmalloc(count * sizeof(cell_t)); -+ -+ /* collect all the offsets in buffer */ -+ count = 0; -+ for_each_local_fixup_entry(tree, fen) { -+ if (fen->prop != fe->prop) -+ continue; -+ fen->local_fixup_generated = true; -+ buf[count++] = cpu_to_fdt32(fen->offset); -+ } -+ d = empty_data; -+ d.len = count * sizeof(cell_t); -+ d.val = (char *)buf; -+ -+ nameoff = stringtable_insert(strbuf, fe->prop->name); -+ emit->property(etarget, fe->prop->labels); -+ emit->cell(etarget, count * sizeof(cell_t)); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && -+ (count * sizeof(cell_t)) >= 8) -+ emit->align(etarget, 8); -+ -+ emit->data(etarget, d); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(buf); -+ } -+ } -+ -+ for_each_child(node, child) -+ emit_local_fixups(tree, emit, etarget, strbuf, vi, child); -+ -+ if (node->emit_local_fixup_node && node != tree) -+ emit->endnode(etarget, tree->labels); -+} -+ -+static void emit_symbols_node(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, -+ struct version_info *vi) -+{ -+ struct symbol *sym; -+ int nameoff, vallen; -+ -+ /* do nothing if no symbols */ -+ if (!tree->symbols) -+ return; -+ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__symbols__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_symbol(tree, sym) { -+ -+ vallen = strlen(sym->node->fullpath); -+ -+ nameoff = stringtable_insert(strbuf, sym->label->label); -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, sym->node->fullpath, -+ strlen(sym->node->fullpath)); -+ emit->align(etarget, sizeof(cell_t)); -+ } -+ -+ emit->endnode(etarget, NULL); -+} -+ -+static void emit_local_fixups_node(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, -+ struct version_info *vi) -+{ -+ struct fixup_entry *fe; -+ struct node *node; -+ -+ /* do nothing if no local fixups */ -+ if (!tree->local_fixups) -+ return; -+ -+ /* mark all nodes that need a local fixup generated (and parents) */ -+ for_each_local_fixup_entry(tree, fe) { -+ node = fe->node; -+ while (node != NULL && !node->emit_local_fixup_node) { -+ node->emit_local_fixup_node = true; -+ node = node->parent; -+ } -+ } -+ -+ /* emit the local fixups node now */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__local_fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree); -+ -+ emit->endnode(etarget, tree->labels); -+} -+ -+static void emit_fixups_node(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, -+ struct version_info *vi) -+{ -+ struct fixup *f; -+ struct fixup_entry *fe; -+ char *name, *s; -+ const char *fullpath; -+ int namesz, nameoff, vallen; -+ -+ /* do nothing if no fixups */ -+ if (!tree->fixups) -+ return; -+ -+ /* emit the external fixups */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_fixup(tree, f) { -+ -+ namesz = 0; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ namesz += strlen(fullpath) + 1; -+ namesz += strlen(fe->prop->name) + 1; -+ namesz += 32; /* space for : + '\0' */ -+ } -+ -+ name = xmalloc(namesz); -+ -+ s = name; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath, -+ fe->prop->name, fe->offset); -+ s += strlen(s) + 1; -+ } -+ -+ nameoff = stringtable_insert(strbuf, f->ref); -+ vallen = s - name - 1; -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, name, vallen); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(name); -+ } -+ -+ emit->endnode(etarget, tree->labels); -+} -+ - static void flatten_tree(struct node *tree, struct emitter *emit, - void *etarget, struct data *strbuf, - struct version_info *vi) -@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - flatten_tree(child, emit, etarget, strbuf, vi); - } - -+ emit_symbols_node(tree, emit, etarget, strbuf, vi); -+ emit_local_fixups_node(tree, emit, etarget, strbuf, vi); -+ emit_fixups_node(tree, emit, etarget, strbuf, vi); -+ - emit->endnode(etarget, tree->labels); - } - -diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h -index ad9b05ae698b0495ecbda42ffcf4743555313a27..2595dfda020fd9e03f0beff5006f229d5e393151 100644 ---- a/scripts/dtc/version_gen.h -+++ b/scripts/dtc/version_gen.h -@@ -1 +1 @@ --#define DTC_VERSION "DTC 1.4.1-g53bf130b" -+#define DTC_VERSION "DTC 1.4.1-g25efc119" - -From ef3f51080fa0d993456fa3635e442b845051b70a Mon Sep 17 00:00:00 2001 -From: notro -Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 054/122] BCM2708: Add core Device Tree support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add the bare minimum needed to boot BCM2708 from a Device Tree. - -Signed-off-by: Noralf Tronnes - -BCM2708: DT: change 'axi' nodename to 'soc' - -Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. -The VC4 bootloader fills in certain properties in the 'axi' subtree, -but since this is part of an upstreaming effort, the name is changed. - -Signed-off-by: Noralf Tronnes notro@tronnes.org - -BCM2708_DT: Correct length of the peripheral space - -Use dts-dirs feature for overlays. - -The kernel makefiles have a dts-dirs target that is for vendor subdirectories. - -Using this fixes the install_dtbs target, which previously did not install the overlays. - -BCM270X_DT: configure I2S DMA channels - -Signed-off-by: Matthias Reichl - -BCM270X_DT: switch to bcm2835-i2s - -I2S soundcard drivers with proper devicetree support (i.e. not linking -to the cpu_dai/platform via name but to cpu/platform via of_node) -will work out of the box without any modifications. - -When the kernel is compiled without devicetree support the platform -code will instantiate the bcm2708-i2s driver and I2S soundcard drivers -will link to it via name, as before. - -Signed-off-by: Matthias Reichl - -SDIO-overlay: add poll_once-boolean parameter - -Add paramter to toggle sdio-device-polling -done every second or once at boot-time. - -Signed-off-by: Patrick Boettcher - -BCM270X_DT: Make mmc overlay compatible with current firmware - -The original DT overlay logic followed a merge-then-patch procedure, -i.e. parameters are applied to the loaded overlay before the overlay -is merged into the base DTB. This sequence has been changed to -patch-then-merge, in order to support parameterised node names, and -to protect against bad overlays. As a result, overrides (parameters) -must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. - -mmc-overlay.dts (that switches back to the original mmc sdcard -driver) is the only overlay violating that rule, and this patch -fixes it. - -bcm270x_dt: Use the sdhost MMC controller by default - -The "mmc" overlay reverts to using the other controller. - -squash: Add cprman to dt - -BCM270X_DT: Use clk_core for I2C interfaces - -BCM270X_DT: Use bcm283x.dtsi, bcm2835.dtsi and bcm2836.dtsi - -The mainline Device Tree files are quite close to downstream now. -Let's use bcm283x.dtsi, bcm2835.dtsi and bcm2836.dtsi as base files -for our dts files. - -Mainline dts files are based on these files: - - bcm2835-rpi.dtsi - bcm2835.dtsi bcm2836.dtsi - bcm283x.dtsi - -Current downstream are based on these: - - bcm2708.dtsi bcm2709.dtsi bcm2710.dtsi - bcm2708_common.dtsi - -This patch introduces this dependency: - - bcm2708.dtsi bcm2709.dtsi - bcm2708-rpi.dtsi - bcm270x.dtsi - bcm2835.dtsi bcm2836.dtsi - bcm283x.dtsi - -And: - bcm2710.dtsi - bcm2708-rpi.dtsi - bcm270x.dtsi - bcm283x.dtsi - -bcm270x.dtsi contains the downstream bcm283x.dtsi diff. -bcm2708-rpi.dtsi is the downstream version of bcm2835-rpi.dtsi. - -Other changes: -- The led node has moved from /soc/leds to /leds. This is not a problem - since the label is used to reference it. -- The clk_osc reg property changes from 6 to 3. -- The gpu nodes has their interrupt property set in the base file. -- the clocks label does not point to the /clocks node anymore, but - points to the cprman node. This is not a problem since the overlays - that use the clock node refer to it directly: target-path = "/clocks"; -- some nodes now have 2 labels since mainline and downstream differs in - this respect: cprman/clocks, spi0/spi, gpu/vc4. -- some nodes doesn't have an explicit status = "okay" since they're not - disabled in the base file: watchdog and random. -- gpiomem doesn't need an explicit status = "okay". -- bcm2708-rpi-cm.dts got the hpd-gpios property from bcm2708_common.dtsi, - it's now set directly in that file. -- bcm2709-rpi-2-b.dts has the timer node moved from /soc/timer to /timer. -- Removed clock-frequency property on the bcm{2709,2710}.dtsi timer nodes. - -Signed-off-by: Noralf Trønnes - -BCM270X_DT: Use raspberrypi-power to turn on USB power - -Use the raspberrypi-power driver to turn on USB power. - -Signed-off-by: Noralf Trønnes - -BCM270X_DT: Add a .dtbo target, use for overlays - -Change the filenames and extensions to keep the pre-DDT style of -overlay (-overlay.dtb) distinct from new ones that use a -different style of local fixups (.dtbo), and to match other -platforms. - -The RPi firmware uses the DDTK trailer atom to choose which type of -overlay to use for each kernel. - -Signed-off-by: Phil Elwell - -BCM270X_DT: Don't generate "linux,phandle" props - -The EPAPR standard says to use "phandle" properties to store phandles, -rather than the deprecated "linux,phandle" version. By default, dtc -generates both, but adding "-H epapr" causes it to only generate -"phandle"s, saving some space and clutter. - -Signed-off-by: Phil Elwell - -BCM270X_DT: Add overlay for enc28j60 on SPI2 - -Works on SPI2 for compute module - -BCM270X_DT: Add midi-uart0 overlay - -MIDI requires 31.25kbaud, a baudrate unsupported by Linux. The -midi-uart0 overlay configures uart0 (ttyAMA0) to use a fake clock -so that requesting 38.4kbaud actually gets 31.25kbaud. - -Signed-off-by: Phil Elwell - -BCM270X_DT: Add i2c-sensor overlay - -The i2c-sensor overlay is a container for various pressure and -temperature sensors, currently bmp085 and bmp280. The standalone -bmp085_i2c-sensor overlay is now deprecated. - -Signed-off-by: Phil Elwell - -BCM270X_DT: overlays/*-overlay.dtb -> overlays/*.dtbo (#1752) - -We now create overlays as .dtbo files. - -build: support for .dtbo files for dtb overlays - -Kernel 4.4.6+ on RaspberryPi support .dtbo files for overlays, instead of .dtb. -Patch the kernel, which has faulty rules to generate .dtbo the way yocto does - -Signed-off-by: Herve Jourdain -Signed-off-by: Khem Raj ---- - arch/arm/Makefile | 2 + - arch/arm/boot/.gitignore | 2 +- - arch/arm/boot/dts/Makefile | 19 + - arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 156 +++ - arch/arm/boot/dts/bcm2708-rpi-b.dts | 146 +++ - arch/arm/boot/dts/bcm2708-rpi-cm.dts | 105 ++ - arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 50 + - arch/arm/boot/dts/bcm2708-rpi.dtsi | 109 ++ - arch/arm/boot/dts/bcm2708.dtsi | 16 + - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 156 +++ - arch/arm/boot/dts/bcm2709.dtsi | 22 + - arch/arm/boot/dts/bcm270x.dtsi | 141 ++ - arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 203 +++ - arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 155 +++ - arch/arm/boot/dts/bcm2710.dtsi | 155 +++ - arch/arm/boot/dts/overlays/Makefile | 105 ++ - arch/arm/boot/dts/overlays/README | 1368 ++++++++++++++++++++ - .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 53 + - arch/arm/boot/dts/overlays/ads1015-overlay.dts | 98 ++ - arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ - .../dts/overlays/akkordion-iqdacplus-overlay.dts | 46 + - .../allo-piano-dac-pcm512x-audio-overlay.dts | 54 + - arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + - .../audioinjector-wm8731-audio-overlay.dts | 39 + - arch/arm/boot/dts/overlays/audremap-overlay.dts | 19 + - .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + - arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 + - .../boot/dts/overlays/dionaudio-loco-overlay.dts | 39 + - arch/arm/boot/dts/overlays/dpi18-overlay.dts | 31 + - arch/arm/boot/dts/overlays/dpi24-overlay.dts | 31 + - arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 + - arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 + - arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + - .../boot/dts/overlays/enc28j60-spi2-overlay.dts | 47 + - arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 44 + - .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + - .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + - .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + - .../dts/overlays/hifiberry-dacplus-overlay.dts | 56 + - .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 + - .../dts/overlays/hifiberry-digi-pro-overlay.dts | 41 + - arch/arm/boot/dts/overlays/hy28a-overlay.dts | 93 ++ - arch/arm/boot/dts/overlays/hy28b-overlay.dts | 148 +++ - arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts | 13 + - arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 43 + - arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 ++ - .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + - arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 83 ++ - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 34 + - .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + - .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + - .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + - arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 43 + - .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 46 + - .../overlays/iqaudio-digi-wm8804-audio-overlay.dts | 47 + - .../arm/boot/dts/overlays/justboom-dac-overlay.dts | 43 + - .../boot/dts/overlays/justboom-digi-overlay.dts | 39 + - arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + - arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + - arch/arm/boot/dts/overlays/mcp23s17-overlay.dts | 732 +++++++++++ - .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 ++ - .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 ++ - arch/arm/boot/dts/overlays/midi-uart0-overlay.dts | 36 + - arch/arm/boot/dts/overlays/mmc-overlay.dts | 38 + - arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ - arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + - .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + - .../boot/dts/overlays/pi3-miniuart-bt-overlay.dts | 64 + - arch/arm/boot/dts/overlays/piscreen-overlay.dts | 102 ++ - arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 106 ++ - arch/arm/boot/dts/overlays/pisound-overlay.dts | 114 ++ - arch/arm/boot/dts/overlays/pitft22-overlay.dts | 69 + - .../dts/overlays/pitft28-capacitive-overlay.dts | 91 ++ - .../dts/overlays/pitft28-resistive-overlay.dts | 121 ++ - .../dts/overlays/pitft35-resistive-overlay.dts | 121 ++ - arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 35 + - arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 47 + - arch/arm/boot/dts/overlays/pwm-overlay.dts | 43 + - arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + - arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 + - .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + - arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + - arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 89 ++ - arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + - arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 + - arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 + - .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 81 ++ - .../boot/dts/overlays/sc16is750-i2c-overlay.dts | 37 + - .../boot/dts/overlays/sc16is752-spi1-overlay.dts | 61 + - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 32 + - arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts | 36 + - arch/arm/boot/dts/overlays/sdio-overlay.dts | 36 + - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 23 + - arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + - arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 + - arch/arm/boot/dts/overlays/smi-overlay.dts | 37 + - .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + - arch/arm/boot/dts/overlays/spi-rtc-overlay.dts | 33 + - arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts | 26 + - arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + - arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 + - arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ - arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + - arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 + - arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ - arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 ++++ - arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + - .../arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts | 89 ++ - arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 136 ++ - arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + - arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 + - .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 + - arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + - scripts/Makefile.dtbinst | 10 +- - scripts/Makefile.lib | 11 + - 115 files changed, 8979 insertions(+), 4 deletions(-) - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708-rpi.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708.dtsi - create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts - create mode 100644 arch/arm/boot/dts/bcm2709.dtsi - create mode 100644 arch/arm/boot/dts/bcm270x.dtsi - create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts - create mode 100644 arch/arm/boot/dts/bcm2710-rpi-cm3.dts - create mode 100644 arch/arm/boot/dts/bcm2710.dtsi - create mode 100644 arch/arm/boot/dts/overlays/Makefile - create mode 100644 arch/arm/boot/dts/overlays/README - create mode 100644 arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/ads1015-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/audremap-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dpi18-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dpi24-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/justboom-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/justboom-digi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp23s17-overlay.dts - create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/midi-uart0-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pisound-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft22-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi-rtc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts - -diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 6be9ee148b78b964004392045199ec8d1540134e..b1c49e2a0c5f5ef2939102625171b26cd5372016 100644 ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -334,6 +334,8 @@ $(INSTALL_TARGETS): - - %.dtb: | scripts - $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ -+%.dtbo: | scripts -+ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ - - PHONY += dtbs dtbs_install - -diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore -index 3c79f85975aaa26c7c2e353fefc54d71d89bc5bf..eaaeb17e5986e5f7178b2851169444ac7e45be8d 100644 ---- a/arch/arm/boot/.gitignore -+++ b/arch/arm/boot/.gitignore -@@ -3,4 +3,4 @@ zImage - xipImage - bootpImage - uImage --*.dtb -+*.dtb* -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index c558ba75cbccf909063e0f4f131f7efdfd28867b..ec218dcb67019acacd4a6c73c74d12ef4f4204d8 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -1,5 +1,13 @@ - ifeq ($(CONFIG_OF),y) - -+dtb-$(CONFIG_ARCH_BCM2835) += \ -+ bcm2708-rpi-b.dtb \ -+ bcm2708-rpi-b-plus.dtb \ -+ bcm2708-rpi-cm.dtb \ -+ bcm2709-rpi-2-b.dtb \ -+ bcm2710-rpi-3-b.dtb \ -+ bcm2710-rpi-cm3.dtb -+ - dtb-$(CONFIG_ARCH_ALPINE) += \ - alpine-db.dtb - dtb-$(CONFIG_MACH_ARTPEC6) += \ -@@ -954,10 +962,21 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ - dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb - dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \ - aspeed-ast2500-evb.dtb -+ -+targets += dtbs dtbs_install -+targets += $(dtb-y) -+ - endif - - dtstree := $(srctree)/$(src) - dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) - - always := $(dtb-y) -+subdir-y := overlays - clean-files := *.dtb -+ -+# Enable fixups to support overlays on BCM2835 platforms -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+ DTC_FLAGS ?= -@ -H epapr -+ dts-dirs += overlays -+endif -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..360da5c928dc5599b0d2a9055728087604c6b189 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -@@ -0,0 +1,156 @@ -+/dts-v1/; -+ -+#include "bcm2708.dtsi" -+ -+/ { -+ model = "Raspberry Pi Model B+"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 45>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+ -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9c49659ab246bce0656f3514f3b924bc4826b421 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts -@@ -0,0 +1,146 @@ -+/dts-v1/; -+ -+#include "bcm2708.dtsi" -+ -+/ { -+ model = "Raspberry Pi Model B"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 45>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 16 1>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..eb8662f0d222b4c0a9a2bcb8bccb13e86a0006b3 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -@@ -0,0 +1,105 @@ -+/dts-v1/; -+ -+#include "bcm2708-rpi-cm.dtsi" -+ -+/ { -+ model = "Raspberry Pi Compute Module"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins; -+ brcm,function; -+ }; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..d33d462b4090e4a4f967a37212918b9cf500bf76 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -@@ -0,0 +1,50 @@ -+#include "bcm2708.dtsi" -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; -+ -+&gpio { -+ mmc_pins: mmc_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <7>; /* alt3 */ -+ }; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+}; -+ -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+ brcm,overclock-50 = <0>; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+/ { -+ __overrides__ { -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&mmc>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..46cf8602c3b96e477b05b57dbfe5e349930c9d9a ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi -@@ -0,0 +1,109 @@ -+/* Downstream version of bcm2835-rpi.dtsi */ -+ -+#include -+ -+/ { -+ memory { -+ device_type = "memory"; -+ reg = <0x0 0x0>; -+ }; -+ -+ aliases { -+ audio = &audio; -+ aux = &aux; -+ sound = &sound; -+ soc = &soc; -+ dma = &dma; -+ intc = &intc; -+ watchdog = &watchdog; -+ random = &random; -+ mailbox = &mailbox; -+ gpio = &gpio; -+ uart0 = &uart0; -+ sdhost = &sdhost; -+ i2s = &i2s; -+ spi0 = &spi0; -+ i2c0 = &i2c0; -+ uart1 = &uart1; -+ spi1 = &spi1; -+ spi2 = &spi2; -+ mmc = &mmc; -+ i2c1 = &i2c1; -+ i2c2 = &i2c2; -+ usb = &usb; -+ leds = &leds; -+ fb = &fb; -+ vchiq = &vchiq; -+ thermal = &thermal; -+ }; -+ -+ leds: leds { -+ compatible = "gpio-leds"; -+ }; -+ -+ soc { -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ }; -+ -+ firmware: firmware { -+ compatible = "raspberrypi,bcm2835-firmware"; -+ mboxes = <&mailbox>; -+ }; -+ -+ power: power { -+ compatible = "raspberrypi,bcm2835-power"; -+ firmware = <&firmware>; -+ #power-domain-cells = <1>; -+ }; -+ -+ fb: fb { -+ compatible = "brcm,bcm2708-fb"; -+ firmware = <&firmware>; -+ status = "disabled"; -+ }; -+ -+ vchiq: vchiq { -+ compatible = "brcm,bcm2835-vchiq"; -+ reg = <0x7e00b840 0xf>; -+ interrupts = <0 2>; -+ cache-line-size = <32>; -+ firmware = <&firmware>; -+ }; -+ -+ thermal: thermal { -+ compatible = "brcm,bcm2835-thermal"; -+ firmware = <&firmware>; -+ }; -+ -+ /* Onboard audio */ -+ audio: audio { -+ compatible = "brcm,bcm2835-audio"; -+ brcm,pwm-channels = <8>; -+ status = "disabled"; -+ }; -+ -+ /* External sound card */ -+ sound: sound { -+ status = "disabled"; -+ }; -+ -+ }; -+ -+ __overrides__ { -+ cache_line_size = <&vchiq>, "cache-line-size:0"; -+ }; -+}; -+ -+&dma { -+ brcm,dma-channel-mask = <0x7f34>; -+}; -+ -+&hdmi { -+ power-domains = <&power RPI_POWER_DOMAIN_HDMI>; -+}; -+ -+&usb { -+ power-domains = <&power RPI_POWER_DOMAIN_USB>; -+}; -diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..0f72bd90c591a2e8752d7437fa7e8c6308bd8c3f ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708.dtsi -@@ -0,0 +1,16 @@ -+#include "bcm2835.dtsi" -+#include "bcm270x.dtsi" -+#include "bcm2708-rpi.dtsi" -+ -+/ { -+ soc { -+ timer@7e003000 { -+ compatible = "brcm,bcm2835-system-timer"; -+ reg = <0x7e003000 0x1000>; -+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; -+ clock-frequency = <1000000>; -+ }; -+ }; -+ -+ /delete-node/ cpus; -+}; -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..19c83823420fc3cc20a01d07091100cb8720ff4d ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -0,0 +1,156 @@ -+/dts-v1/; -+ -+#include "bcm2709.dtsi" -+ -+/ { -+ model = "Raspberry Pi 2 Model B"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 45>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+ -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..343437db94820bb75a9b81e8bc6ecf6f31d9f04c ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2709.dtsi -@@ -0,0 +1,22 @@ -+#include "bcm2836.dtsi" -+#include "bcm270x.dtsi" -+#include "bcm2708-rpi.dtsi" -+ -+/ { -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; -+ -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; -+ }; -+ -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm270x.dtsi b/arch/arm/boot/dts/bcm270x.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..a46cb4a8b1419edd95e0e07c18b0f373222dc2bf ---- /dev/null -+++ b/arch/arm/boot/dts/bcm270x.dtsi -@@ -0,0 +1,141 @@ -+/* Downstream bcm283x.dtsi diff */ -+#include "dt-bindings/power/raspberrypi-power.h" -+ -+/ { -+ chosen { -+ bootargs = ""; -+ }; -+ -+ soc: soc { -+ -+ /delete-node/ timer@7e003000; -+ -+ watchdog: watchdog@7e100000 { -+ /* Add alias */ -+ }; -+ -+ cprman: cprman@7e101000 { -+ /* Add alias */ -+ }; -+ -+ random: rng@7e104000 { -+ /* Add alias */ -+ }; -+ -+ gpio@7e200000 { /* gpio */ -+ interrupts = <2 17>, <2 18>; -+ }; -+ -+ sdhost: sdhost@7e202000 { -+ compatible = "brcm,bcm2835-sdhost"; -+ reg = <0x7e202000 0x100>; -+ interrupts = <2 24>; -+ clocks = <&clocks BCM2835_CLOCK_VPU>; -+ dmas = <&dma 13>; -+ dma-names = "rx-tx"; -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ status = "disabled"; -+ }; -+ -+ i2s@7e203000 { /* i2s */ -+ #sound-dai-cells = <0>; -+ reg = <0x7e203000 0x24>; -+ clocks = <&clocks BCM2835_CLOCK_PCM>; -+ }; -+ -+ spi0: spi@7e204000 { -+ /* Add alias */ -+ dmas = <&dma 6>, <&dma 7>; -+ dma-names = "tx", "rx"; -+ }; -+ -+ pixelvalve0: pixelvalve@7e206000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ pixelvalve1: pixelvalve@7e207000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ dpi: dpi@7e208000 { -+ compatible = "brcm,bcm2835-dpi"; -+ reg = <0x7e208000 0x8c>; -+ clocks = <&clocks BCM2835_CLOCK_VPU>, -+ <&clocks BCM2835_CLOCK_DPI>; -+ clock-names = "core", "pixel"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; -+ -+ /delete-node/ sdhci@7e300000; -+ -+ mmc: mmc@7e300000 { -+ compatible = "brcm,bcm2835-mmc"; -+ reg = <0x7e300000 0x100>; -+ interrupts = <2 30>; -+ clocks = <&clocks BCM2835_CLOCK_EMMC>; -+ dmas = <&dma 11>; -+ dma-names = "rx-tx"; -+ brcm,overclock-50 = <0>; -+ status = "disabled"; -+ }; -+ -+ hvs: hvs@7e400000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ firmwarekms: firmwarekms@7e600000 { -+ compatible = "raspberrypi,rpi-firmware-kms"; -+ /* SMI interrupt reg */ -+ reg = <0x7e600000 0x100>; -+ interrupts = <2 16>; -+ brcm,firmware = <&firmware>; -+ status = "disabled"; -+ }; -+ -+ smi: smi@7e600000 { -+ compatible = "brcm,bcm2835-smi"; -+ reg = <0x7e600000 0x100>; -+ interrupts = <2 16>; -+ clocks = <&clocks BCM2835_CLOCK_SMI>; -+ assigned-clocks = <&cprman BCM2835_CLOCK_SMI>; -+ assigned-clock-rates = <125000000>; -+ dmas = <&dma 4>; -+ dma-names = "rx-tx"; -+ status = "disabled"; -+ }; -+ -+ pixelvalve2: pixelvalve@7e807000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ hdmi@7e902000 { /* hdmi */ -+ status = "disabled"; -+ }; -+ -+ usb@7e980000 { /* usb */ -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ }; -+ -+ v3d@7ec00000 { /* vd3 */ -+ compatible = "brcm,vc4-v3d"; -+ power-domains = <&power RPI_POWER_DOMAIN_V3D>; -+ status = "disabled"; -+ }; -+ -+ gpu: gpu { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..12764a3495b2372ffaf47e32ea0d21326ca83686 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -@@ -0,0 +1,203 @@ -+/dts-v1/; -+ -+#ifdef RPI364 -+/memreserve/ 0x00000000 0x00001000; -+#endif -+ -+#include "bcm2710.dtsi" -+ -+/ { -+ model = "Raspberry Pi 3 Model B"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ sdio_pins: sdio_pins { -+ brcm,pins = <34 35 36 37 38 39>; -+ brcm,function = <7>; // alt3 = SD1 -+ brcm,pull = <0 2 2 2 2 2>; -+ }; -+ -+ bt_pins: bt_pins { -+ brcm,pins = <43>; -+ brcm,function = <4>; /* alt0:GPCLK2 */ -+ brcm,pull = <0>; -+ }; -+ -+ uart0_pins: uart0_pins { -+ brcm,pins = <32 33>; -+ brcm,function = <7>; /* alt3=UART0 */ -+ brcm,pull = <0 2>; -+ }; -+ -+ uart1_pins: uart1_pins { -+ brcm,pins; -+ brcm,function; -+ brcm,pull; -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 41>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&mmc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+ brcm,overclock-50 = <0>; -+}; -+ -+&soc { -+ virtgpio: virtgpio { -+ compatible = "brcm,bcm2835-virtgpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins &bt_pins>; -+ status = "okay"; -+}; -+ -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&virtgpio 0 0>; -+ }; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ chosen { -+ bootargs = "8250.nr_uarts=1"; -+ }; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..41874c25a84226c0e4af92ec4059e0a571fe6123 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts -@@ -0,0 +1,155 @@ -+/dts-v1/; -+ -+#include "bcm2710.dtsi" -+ -+/ { -+ model = "Raspberry Pi Compute Module 3"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ brcm,pull = <0 2 2 2 2 2>; -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins; -+ brcm,function; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+ brcm,overclock-50 = <0>; -+}; -+ -+&soc { -+ virtgpio: virtgpio { -+ compatible = "brcm,bcm2835-virtgpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&virtgpio 0 0>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..f6def5d7e5d622cf09e8f87332c7374fe28da08b ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710.dtsi -@@ -0,0 +1,155 @@ -+#include "bcm283x.dtsi" -+#include "bcm270x.dtsi" -+#include "bcm2708-rpi.dtsi" -+ -+/ { -+ compatible = "brcm,bcm2837", "brcm,bcm2836"; -+ model = "BCM2837"; -+ -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; -+ dma-ranges = <0xc0000000 0x00000000 0x3f000000>; -+ -+ local_intc: local_intc { -+ compatible = "brcm,bcm2836-l1-intc"; -+ reg = <0x40000000 0x100>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ interrupt-parent = <&local_intc>; -+ }; -+ -+ arm-pmu { -+#ifdef RPI364 -+ compatible = "arm,armv8-pmuv3", "arm,cortex-a7-pmu"; -+#else -+ compatible = "arm,cortex-a7-pmu"; -+#endif -+ interrupt-parent = <&local_intc>; -+ interrupts = <9>; -+ }; -+ -+ timer { -+#ifdef RPI364 -+ compatible = "arm,armv8-timer", "arm,armv7-timer"; -+#else -+ compatible = "arm,armv7-timer"; -+#endif -+ interrupt-parent = <&local_intc>; -+ interrupts = <0>, // PHYS_SECURE_PPI -+ <1>, // PHYS_NONSECURE_PPI -+ <3>, // VIRT_PPI -+ <2>; // HYP_PPI -+ always-on; -+ }; -+ -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; -+ }; -+ -+#ifdef RPI364 -+ cpus: cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ v8_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x0>; -+ clock-frequency = <1200000000>; -+ }; -+ -+ v8_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x1>; -+ clock-frequency = <1200000000>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0x000000e0>; -+ }; -+ -+ v8_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x2>; -+ clock-frequency = <1200000000>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0x000000e8>; -+ }; -+ -+ v8_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x3>; -+ clock-frequency = <1200000000>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0x000000f0>; -+ }; -+ }; -+ -+ __overrides__ { -+ arm_freq = <&v8_cpu0>, "clock-frequency:0", -+ <&v8_cpu1>, "clock-frequency:0", -+ <&v8_cpu2>, "clock-frequency:0", -+ <&v8_cpu3>, "clock-frequency:0"; -+ }; -+ -+#else -+ cpus: cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ v7_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x000>; -+ clock-frequency = <800000000>; -+ }; -+ -+ v7_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x001>; -+ clock-frequency = <800000000>; -+ }; -+ -+ v7_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x002>; -+ clock-frequency = <800000000>; -+ }; -+ -+ v7_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x003>; -+ clock-frequency = <800000000>; -+ }; -+ }; -+ -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; -+ }; -+#endif -+}; -+ -+&intc { -+ compatible = "brcm,bcm2836-armctrl-ic"; -+ reg = <0x7e00b200 0x200>; -+ interrupt-parent = <&local_intc>; -+ interrupts = <8>; -+}; -+ -+#ifdef RPI364 -+&usb { -+ compatible = "brcm,bcm2835-usb"; -+ reg = <0x7e980000 0x10000>; -+ interrupts = <1 9>; -+}; -+#endif -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..11dba31712840a9e4b91acd4565c2d6266315273 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -0,0 +1,105 @@ -+# Overlays for the Raspberry Pi platform -+ -+dtbo-$(CONFIG_ARCH_BCM2835) += \ -+ adau1977-adc.dtbo \ -+ ads1015.dtbo \ -+ ads7846.dtbo \ -+ akkordion-iqdacplus.dtbo \ -+ allo-piano-dac-pcm512x-audio.dtbo \ -+ at86rf233.dtbo \ -+ audioinjector-wm8731-audio.dtbo \ -+ audremap.dtbo \ -+ bmp085_i2c-sensor.dtbo \ -+ dht11.dtbo \ -+ dionaudio-loco.dtbo \ -+ dpi18.dtbo \ -+ dpi24.dtbo \ -+ dwc-otg.dtbo \ -+ dwc2.dtbo \ -+ enc28j60.dtbo \ -+ enc28j60-spi2.dtbo \ -+ gpio-ir.dtbo \ -+ gpio-poweroff.dtbo \ -+ hifiberry-amp.dtbo \ -+ hifiberry-dac.dtbo \ -+ hifiberry-dacplus.dtbo \ -+ hifiberry-digi.dtbo \ -+ hifiberry-digi-pro.dtbo \ -+ hy28a.dtbo \ -+ hy28b.dtbo \ -+ i2c-bcm2708.dtbo \ -+ i2c-gpio.dtbo \ -+ i2c-mux.dtbo \ -+ i2c-pwm-pca9685a.dtbo \ -+ i2c-rtc.dtbo \ -+ i2c-sensor.dtbo \ -+ i2c0-bcm2708.dtbo \ -+ i2c1-bcm2708.dtbo \ -+ i2s-gpio28-31.dtbo \ -+ iqaudio-dac.dtbo \ -+ iqaudio-dacplus.dtbo \ -+ iqaudio-digi-wm8804-audio.dtbo \ -+ justboom-dac.dtbo \ -+ justboom-digi.dtbo \ -+ lirc-rpi.dtbo \ -+ mcp23017.dtbo \ -+ mcp23s17.dtbo \ -+ mcp2515-can0.dtbo \ -+ mcp2515-can1.dtbo \ -+ midi-uart0.dtbo \ -+ mmc.dtbo \ -+ mz61581.dtbo \ -+ pi3-act-led.dtbo \ -+ pi3-disable-bt.dtbo \ -+ pi3-miniuart-bt.dtbo \ -+ piscreen.dtbo \ -+ piscreen2r.dtbo \ -+ pisound.dtbo \ -+ pitft22.dtbo \ -+ pitft28-capacitive.dtbo \ -+ pitft28-resistive.dtbo \ -+ pitft35-resistive.dtbo \ -+ pps-gpio.dtbo \ -+ pwm.dtbo \ -+ pwm-2chan.dtbo \ -+ qca7000.dtbo \ -+ raspidac3.dtbo \ -+ rpi-backlight.dtbo \ -+ rpi-dac.dtbo \ -+ rpi-display.dtbo \ -+ rpi-ft5406.dtbo \ -+ rpi-proto.dtbo \ -+ rpi-sense.dtbo \ -+ rra-digidac1-wm8741-audio.dtbo \ -+ sc16is750-i2c.dtbo \ -+ sc16is752-spi1.dtbo \ -+ sdhost.dtbo \ -+ sdio.dtbo \ -+ sdio-1bit.dtbo \ -+ sdtweak.dtbo \ -+ smi.dtbo \ -+ smi-dev.dtbo \ -+ smi-nand.dtbo \ -+ spi-gpio35-39.dtbo \ -+ spi-rtc.dtbo \ -+ spi0-hw-cs.dtbo \ -+ spi1-1cs.dtbo \ -+ spi1-2cs.dtbo \ -+ spi1-3cs.dtbo \ -+ spi2-1cs.dtbo \ -+ spi2-2cs.dtbo \ -+ spi2-3cs.dtbo \ -+ tinylcd35.dtbo \ -+ uart1.dtbo \ -+ vc4-fkms-v3d.dtbo \ -+ vc4-kms-v3d.dtbo \ -+ vga666.dtbo \ -+ w1-gpio.dtbo \ -+ w1-gpio-pullup.dtbo \ -+ wittypi.dtbo -+ -+targets += dtbs dtbs_install -+targets += $(dtbo-y) -+ -+always := $(dtbo-y) -+clean-files := *.dtbo -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -new file mode 100644 -index 0000000000000000000000000000000000000000..81d991803be335e5a1bc3bb0a8c7a2c9f5c392bd ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/README -@@ -0,0 +1,1368 @@ -+Introduction -+============ -+ -+This directory contains Device Tree overlays. Device Tree makes it possible -+to support many hardware configurations with a single kernel and without the -+need to explicitly load or blacklist kernel modules. Note that this isn't a -+"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices -+are still configured by the board support code, but the intention is to -+eventually reach that goal. -+ -+On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By -+default, the Raspberry Pi kernel boots with device tree enabled. You can -+completely disable DT usage (for now) by adding: -+ -+ device_tree= -+ -+to your config.txt, which should cause your Pi to revert to the old way of -+doing things after a reboot. -+ -+In /boot you will find a .dtb for each base platform. This describes the -+hardware that is part of the Raspberry Pi board. The loader (start.elf and its -+siblings) selects the .dtb file appropriate for the platform by name, and reads -+it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) -+are disabled, but they can be enabled using Device Tree parameters: -+ -+ dtparam=i2c=on,i2s=on,spi=on -+ -+However, this shouldn't be necessary in many use cases because loading an -+overlay that requires one of those interfaces will cause it to be enabled -+automatically, and it is advisable to only enable interfaces if they are -+needed. -+ -+Configuring additional, optional hardware is done using Device Tree overlays -+(see below). -+ -+raspi-config -+============ -+ -+The Advanced Options section of the raspi-config utility can enable and disable -+Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it -+is possible to both enable an interface and blacklist the driver, if for some -+reason you should want to defer the loading. -+ -+Modules -+======= -+ -+As well as describing the hardware, Device Tree also gives enough information -+to allow suitable driver modules to be located and loaded, with the corollary -+that unneeded modules are not loaded. As a result it should be possible to -+remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can -+have its contents deleted (or commented out). -+ -+Using Overlays -+============== -+ -+Overlays are loaded using the "dtoverlay" directive. As an example, consider -+the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the -+pre-DT world this would be loaded from /etc/modules, with an explicit -+"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, -+this becomes a line in config.txt: -+ -+ dtoverlay=lirc-rpi -+ -+This causes the file /boot/overlays/lirc-rpi.dtbo to be loaded. By -+default it will use GPIOs 17 (out) and 18 (in), but this can be modified using -+DT parameters: -+ -+ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 -+ -+Parameters always have default values, although in some cases (e.g. "w1-gpio") -+it is necessary to provided multiple overlays in order to get the desired -+behaviour. See the list of overlays below for a description of the parameters -+and their defaults. -+ -+The Overlay and Parameter Reference -+=================================== -+ -+N.B. When editing this file, please preserve the indentation levels to make it -+simple to parse programmatically. NO HARD TABS. -+ -+ -+Name: -+Info: Configures the base Raspberry Pi hardware -+Load: -+Params: -+ audio Set to "on" to enable the onboard ALSA audio -+ interface (default "off") -+ -+ i2c_arm Set to "on" to enable the ARM's i2c interface -+ (default "off") -+ -+ i2c_vc Set to "on" to enable the i2c interface -+ usually reserved for the VideoCore processor -+ (default "off") -+ -+ i2c An alias for i2c_arm -+ -+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -+ (default "100000") -+ -+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -+ (default "100000") -+ -+ i2c_baudrate An alias for i2c_arm_baudrate -+ -+ i2s Set to "on" to enable the i2s interface -+ (default "off") -+ -+ spi Set to "on" to enable the spi interfaces -+ (default "off") -+ -+ random Set to "on" to enable the hardware random -+ number generator (default "on") -+ -+ sd_overclock Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sd_force_pio Disable DMA support for SD driver (default off) -+ -+ sd_pio_limit Number of blocks above which to use DMA for -+ SD card (default 1) -+ -+ sd_debug Enable debug output from SD driver (default off) -+ -+ uart0 Set to "off" to disable uart0 (default "on") -+ -+ uart1 Set to "on" or "off" to enable or disable uart1 -+ (default varies) -+ -+ watchdog Set to "on" to enable the hardware watchdog -+ (default "off") -+ -+ act_led_trigger Choose which activity the LED tracks. -+ Use "heartbeat" for a nice load indicator. -+ (default "mmc") -+ -+ act_led_activelow Set to "on" to invert the sense of the LED -+ (default "off") -+ N.B. For Pi3 see pi3-act-led overlay. -+ -+ act_led_gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ (default "16" on a non-Plus board, "47" on a -+ Plus or Pi 2) -+ N.B. For Pi3 see pi3-act-led overlay. -+ -+ pwr_led_trigger -+ pwr_led_activelow -+ pwr_led_gpio -+ As for act_led_*, but using the PWR LED. -+ Not available on Model A/B boards. -+ -+ N.B. It is recommended to only enable those interfaces that are needed. -+ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc -+ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) -+ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical -+ interfaces i2c0 and i2c1. Use of the numeric variants is still possible -+ but deprecated because the ARM/VC assignments differ between board -+ revisions. The same board-specific mapping applies to i2c_baudrate, -+ and the other i2c baudrate parameters. -+ -+ -+Name: adau1977-adc -+Info: Overlay for activation of ADAU1977 ADC codec over I2C for control -+ and I2S for data. -+Load: dtoverlay=adau1977-adc -+Params: -+ -+ -+Name: ads1015 -+Info: Overlay for activation of Texas Instruments ADS1015 ADC over I2C -+Load: dtoverlay=ads1015,= -+Params: addr I2C bus address of device. Set based on how the -+ addr pin is wired. (default=0x48 assumes addr -+ is pulled to GND) -+ cha_enable Enable virtual channel a. (default=true) -+ cha_cfg Set the configuration for virtual channel a. -+ (default=4 configures this channel for the -+ voltage at A0 with respect to GND) -+ cha_datarate Set the datarate (samples/sec) for this channel. -+ (default=4 sets 1600 sps) -+ cha_gain Set the gain of the Programmable Gain -+ Amplifier for this channel. (default=2 sets the -+ full scale of the channel to 2.048 Volts) -+ -+ Channel (ch) parameters can be set for each enabled channel. -+ A maximum of 4 channels can be enabled (letters a thru d). -+ For more information refer to the device datasheet at: -+ http://www.ti.com/lit/ds/symlink/ads1015.pdf -+ -+ -+Name: ads7846 -+Info: ADS7846 Touch controller -+Load: dtoverlay=ads7846,= -+Params: cs SPI bus Chip Select (default 1) -+ speed SPI bus speed (default 2MHz, max 3.25MHz) -+ penirq GPIO used for PENIRQ. REQUIRED -+ penirq_pull Set GPIO pull (default 0=none, 2=pullup) -+ swapxy Swap x and y axis -+ xmin Minimum value on the X axis (default 0) -+ ymin Minimum value on the Y axis (default 0) -+ xmax Maximum value on the X axis (default 4095) -+ ymax Maximum value on the Y axis (default 4095) -+ pmin Minimum reported pressure value (default 0) -+ pmax Maximum reported pressure value (default 65535) -+ xohms Touchpanel sensitivity (X-plate resistance) -+ (default 400) -+ -+ penirq is required and usually xohms (60-100) has to be set as well. -+ Apart from that, pmax (255) and swapxy are also common. -+ The rest of the calibration can be done with xinput-calibrator. -+ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian -+ Device Tree binding document: -+ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt -+ -+ -+Name: akkordion-iqdacplus -+Info: Configures the Digital Dreamtime Akkordion Music Player (based on the -+ OEM IQAudIO DAC+ or DAC Zero module). -+Load: dtoverlay=akkordion-iqdacplus,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ dtoverlay=akkordion-iqdacplus,24db_digital_gain -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: allo-piano-dac-pcm512x-audio -+Info: Configures the Allo Piano DAC (2.0/2.1) audio cards. -+ (NB. This initial support is for 2.0 channel audio ONLY! ie. stereo. -+ The subwoofer outputs on the Piano 2.1 are not currently supported!) -+Load: dtoverlay=allo-piano-dac-pcm512x-audio, -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: at86rf233 -+Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, -+ connected to spi0.0 -+Load: dtoverlay=at86rf233,= -+Params: interrupt GPIO used for INT (default 23) -+ reset GPIO used for Reset (default 24) -+ sleep GPIO used for Sleep (default 25) -+ speed SPI bus speed in Hz (default 3000000) -+ trim Fine tuning of the internal capacitance -+ arrays (0=+0pF, 15=+4.5pF, default 15) -+ -+ -+Name: audioinjector-wm8731-audio -+Info: Configures the audioinjector.net audio add on soundcard -+Load: dtoverlay=audioinjector-wm8731-audio -+Params: -+ -+ -+Name: audremap -+Info: Switches PWM sound output to pins 12 (Right) & 13 (Left) -+Load: dtoverlay=audremap,= -+Params: swap_lr Reverse the channel allocation, which will also -+ swap the audio jack outputs (default off) -+ enable_jack Don't switch off the audio jack output -+ (default off) -+ -+ -+Name: bmp085_i2c-sensor -+Info: This overlay is now deprecated - see i2c-sensor -+Load: dtoverlay=bmp085_i2c-sensor -+Params: -+ -+ -+Name: dht11 -+Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors -+ Also sometimes found with the part number(s) AM230x. -+Load: dtoverlay=dht11,= -+Params: gpiopin GPIO connected to the sensor's DATA output. -+ (default 4) -+ -+ -+Name: dionaudio-loco -+Info: Configures the Dion Audio LOCO DAC-AMP -+Load: dtoverlay=dionaudio-loco -+Params: -+ -+ -+Name: dpi18 -+Info: Overlay for a generic 18-bit DPI display -+ This uses GPIOs 0-21 (so no I2C, uart etc.), and activates the output -+ 2-3 seconds after the kernel has started. -+Load: dtoverlay=dpi18 -+Params: -+ -+ -+Name: dpi24 -+Info: Overlay for a generic 24-bit DPI display -+ This uses GPIOs 0-27 (so no I2C, uart etc.), and activates the output -+ 2-3 seconds after the kernel has started. -+Load: dtoverlay=dpi24 -+Params: -+ -+ -+Name: dwc-otg -+Info: Selects the dwc_otg USB controller driver which has fiq support. This -+ is the default on all except the Pi Zero which defaults to dwc2. -+Load: dtoverlay=dwc-otg -+Params: -+ -+ -+Name: dwc2 -+Info: Selects the dwc2 USB controller driver -+Load: dtoverlay=dwc2,= -+Params: dr_mode Dual role mode: "host", "peripheral" or "otg" -+ -+ g-rx-fifo-size Size of rx fifo size in gadget mode -+ -+ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -+ mode -+ -+ g-tx-fifo-size Size of periodic tx fifo per endpoint -+ (except ep0) in gadget mode -+ -+ -+[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+Name: enc28j60 -+Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI0 -+Load: dtoverlay=enc28j60,= -+Params: int_pin GPIO used for INT (default 25) -+ -+ speed SPI bus speed (default 12000000) -+ -+ -+Name: enc28j60-spi2 -+Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI2 -+Load: dtoverlay=enc28j60-spi2,= -+Params: int_pin GPIO used for INT (default 39) -+ -+ speed SPI bus speed (default 12000000) -+ -+ -+Name: gpio-ir -+Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- -+ based gpio_ir_recv driver maps received keys directly to a -+ /dev/input/event* device, all decoding is done by the kernel - LIRC is -+ not required! The key mapping and other decoding parameters can be -+ configured by "ir-keytable" tool. -+Load: dtoverlay=gpio-ir,= -+Params: gpio_pin Input pin number. Default is 18. -+ -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "down". -+ -+ rc-map-name Default rc keymap (can also be changed by -+ ir-keytable), defaults to "rc-rc6-mce" -+ -+ -+Name: gpio-poweroff -+Info: Drives a GPIO high or low on poweroff (including halt) -+Load: dtoverlay=gpio-poweroff,= -+Params: gpiopin GPIO for signalling (default 26) -+ -+ active_low Set if the power control device requires a -+ high->low transition to trigger a power-down. -+ Note that this will require the support of a -+ custom dt-blob.bin to prevent a power-down -+ during the boot process, and that a reboot -+ will also cause the pin to go low. -+ -+ -+Name: hifiberry-amp -+Info: Configures the HifiBerry Amp and Amp+ audio cards -+Load: dtoverlay=hifiberry-amp -+Params: -+ -+ -+Name: hifiberry-dac -+Info: Configures the HifiBerry DAC audio card -+Load: dtoverlay=hifiberry-dac -+Params: -+ -+ -+Name: hifiberry-dacplus -+Info: Configures the HifiBerry DAC+ audio card -+Load: dtoverlay=hifiberry-dacplus,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=hifiberry-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24dB_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ slave Force DAC+ Pro into slave mode, using Pi as -+ master for bit clock and frame clock. -+ -+ -+Name: hifiberry-digi -+Info: Configures the HifiBerry Digi and Digi+ audio card -+Load: dtoverlay=hifiberry-digi -+Params: -+ -+ -+Name: hifiberry-digi-pro -+Info: Configures the HifiBerry Digi+ Pro audio card -+Load: dtoverlay=hifiberry-digi-pro -+Params: -+ -+ -+Name: hy28a -+Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28a,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ resetgpio GPIO used to reset controller -+ -+ ledgpio GPIO used to control backlight -+ -+ -+Name: hy28b -+Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28b,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ resetgpio GPIO used to reset controller -+ -+ ledgpio GPIO used to control backlight -+ -+ -+Name: i2c-bcm2708 -+Info: Fall back to the i2c_bcm2708 driver for the i2c_arm bus. -+Load: dtoverlay=i2c-bcm2708 -+Params: -+ -+ -+Name: i2c-gpio -+Info: Adds support for software i2c controller on gpio pins -+Load: dtoverlay=i2c-gpio,= -+Params: i2c_gpio_sda GPIO used for I2C data (default "23") -+ -+ i2c_gpio_scl GPIO used for I2C clock (default "24") -+ -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) -+ -+ -+Name: i2c-mux -+Info: Adds support for a number of I2C bus multiplexers on i2c_arm -+Load: dtoverlay=i2c-mux,= -+Params: pca9542 Select the NXP PCA9542 device -+ -+ pca9545 Select the NXP PCA9545 device -+ -+ pca9548 Select the NXP PCA9548 device -+ -+ addr Change I2C address of the device (default 0x70) -+ -+ -+[ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ] -+ -+ -+Name: i2c-pwm-pca9685a -+Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm -+Load: dtoverlay=i2c-pwm-pca9685a,= -+Params: addr I2C address of PCA9685A (default 0x40) -+ -+ -+Name: i2c-rtc -+Info: Adds support for a number of I2C Real Time Clock devices -+Load: dtoverlay=i2c-rtc,= -+Params: abx80x Select one of the ABx80x family: -+ AB0801, AB0803, AB0804, AB0805, -+ AB1801, AB1803, AB1804, AB1805 -+ -+ ds1307 Select the DS1307 device -+ -+ ds1339 Select the DS1339 device -+ -+ ds3231 Select the DS3231 device -+ -+ mcp7940x Select the MCP7940x device -+ -+ mcp7941x Select the MCP7941x device -+ -+ pcf2127 Select the PCF2127 device -+ -+ pcf8523 Select the PCF8523 device -+ -+ pcf8563 Select the PCF8563 device -+ -+ trickle-diode-type Diode type for trickle charge - "standard" or -+ "schottky" (ABx80x only) -+ -+ trickle-resistor-ohms Resistor value for trickle charge (DS1339, -+ ABx80x) -+ -+ wakeup-source Specify that the RTC can be used as a wakeup -+ source -+ -+ -+Name: i2c-sensor -+Info: Adds support for a number of I2C barometric pressure and temperature -+ sensors on i2c_arm -+Load: dtoverlay=i2c-sensor,= -+Params: bmp085 Select the Bosch sensortronic BMP085 -+ -+ bmp280 Select the Bosch sensortronic BMP280 -+ -+ -+Name: i2c0-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations -+ are usable on all platforms. -+Load: dtoverlay=i2c0-bcm2708,= -+Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*) -+ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*) -+ pins_0_1 Use pins 0 and 1 (default) -+ pins_28_29 Use pins 28 and 29 -+ pins_44_45 Use pins 44 and 45 -+ pins_46_47 Use pins 46 and 47 -+ -+ -+Name: i2c1-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c1 bus -+Load: dtoverlay=i2c1-bcm2708,= -+Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) -+ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) -+ pin_func Alternative pin function (4 (alt0), 6 (alt2) - -+ default 4) -+ -+ -+Name: i2s-gpio28-31 -+Info: move I2S function block to GPIO 28 to 31 -+Load: dtoverlay=i2s-gpio28-31 -+Params: -+ -+ -+Name: iqaudio-dac -+Info: Configures the IQaudio DAC audio card -+Load: dtoverlay=iqaudio-dac, -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=iqaudio-dac,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: iqaudio-dacplus -+Info: Configures the IQaudio DAC+ audio card -+Load: dtoverlay=iqaudio-dacplus,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=iqaudio-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ auto_mute_amp If specified, unmute/mute the IQaudIO amp when -+ starting/stopping audio playback. -+ unmute_amp If specified, unmute the IQaudIO amp once when -+ the DAC driver module loads. -+ -+ -+Name: iqaudio-digi-wm8804-audio -+Info: Configures the IQAudIO Digi WM8804 audio card -+Load: dtoverlay=iqaudio-digi-wm8804-audio,= -+Params: card_name Override the default, "IQAudIODigi", card name. -+ dai_name Override the default, "IQAudIO Digi", dai name. -+ dai_stream_name Override the default, "IQAudIO Digi HiFi", -+ dai stream name. -+ -+ -+Name: justboom-dac -+Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio -+ cards -+Load: dtoverlay=justboom-dac,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=justboom-dac,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24dB_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: justboom-digi -+Info: Configures the JustBoom Digi HAT and Digi Zero audio cards -+Load: dtoverlay=justboom-digi -+Params: -+ -+ -+Name: lirc-rpi -+Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) -+ Consult the module documentation for more details. -+Load: dtoverlay=lirc-rpi,= -+Params: gpio_out_pin GPIO for output (default "17") -+ -+ gpio_in_pin GPIO for input (default "18") -+ -+ gpio_in_pull Pull up/down/off on the input pin -+ (default "down") -+ -+ sense Override the IR receive auto-detection logic: -+ "0" = force active-high -+ "1" = force active-low -+ "-1" = use auto-detection -+ (default "-1") -+ -+ softcarrier Turn the software carrier "on" or "off" -+ (default "on") -+ -+ invert "on" = invert the output pin (default "off") -+ -+ debug "on" = enable additional debug messages -+ (default "off") -+ -+ -+Name: mcp23017 -+Info: Configures the MCP23017 I2C GPIO expander -+Load: dtoverlay=mcp23017,= -+Params: gpiopin Gpio pin connected to the INTA output of the -+ MCP23017 (default: 4) -+ -+ addr I2C address of the MCP23017 (default: 0x20) -+ -+ -+Name: mcp23s17 -+Info: Configures the MCP23S08/17 SPI GPIO expanders. -+ If devices are present on SPI1 or SPI2, those interfaces must be enabled -+ with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays. -+ If interrupts are enabled for a device on a given CS# on a SPI bus, that -+ device must be the only one present on that SPI bus/CS#. -+Load: dtoverlay=mcp23s17,= -+Params: s08-spi--present 4-bit integer, bitmap indicating MCP23S08 -+ devices present on SPI, CS# -+ -+ s17-spi--present 8-bit integer, bitmap indicating MCP23S17 -+ devices present on SPI, CS# -+ -+ s08-spi--int-gpio integer, enables interrupts on a single -+ MCP23S08 device on SPI, CS#, specifies -+ the GPIO pin to which INT output of MCP23S08 -+ is connected. -+ -+ s17-spi--int-gpio integer, enables mirrored interrupts on a -+ single MCP23S17 device on SPI, CS#, -+ specifies the GPIO pin to which either INTA -+ or INTB output of MCP23S17 is connected. -+ -+ -+Name: mcp2515-can0 -+Info: Configures the MCP2515 CAN controller on spi0.0 -+Load: dtoverlay=mcp2515-can0,= -+Params: oscillator Clock frequency for the CAN controller (Hz) -+ -+ spimaxfrequency Maximum SPI frequence (Hz) -+ -+ interrupt GPIO for interrupt signal -+ -+ -+Name: mcp2515-can1 -+Info: Configures the MCP2515 CAN controller on spi0.1 -+Load: dtoverlay=mcp2515-can1,= -+Params: oscillator Clock frequency for the CAN controller (Hz) -+ -+ spimaxfrequency Maximum SPI frequence (Hz) -+ -+ interrupt GPIO for interrupt signal -+ -+ -+Name: midi-uart0 -+Info: Configures UART0 (ttyAMA0) so that a requested 38.4kbaud actually gets -+ 31.25kbaud, the frequency required for MIDI -+Load: dtoverlay=midi-uart0 -+Params: -+ -+ -+Name: mmc -+Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock -+Load: dtoverlay=mmc,= -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ -+Name: mz61581 -+Info: MZ61581 display by Tontec -+Load: dtoverlay=mz61581,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ txbuflen Transmit buffer length (default 32768) -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ -+[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+Name: pi3-act-led -+Info: Pi3 uses a GPIO expander to drive the LEDs which can only be accessed -+ from the VPU. There is a special driver for this with a separate DT -+ node, which has the unfortunate consequence of breaking the -+ act_led_gpio and act_led_activelow dtparams. -+ This overlay changes the GPIO controller back to the standard one and -+ restores the dtparams. -+Load: dtoverlay=pi3-act-led,= -+Params: activelow Set to "on" to invert the sense of the LED -+ (default "off") -+ -+ gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ REQUIRED -+ -+ -+Name: pi3-disable-bt -+Info: Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15 -+ N.B. To disable the systemd service that initialises the modem so it -+ doesn't use the UART, use 'sudo systemctl disable hciuart'. -+Load: dtoverlay=pi3-disable-bt -+Params: -+ -+ -+Name: pi3-miniuart-bt -+Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore -+ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum -+ usable baudrate. -+ N.B. It is also necessary to edit /lib/systemd/system/hciuart.service -+ and replace ttyAMA0 with ttyS0, unless you have a system with udev rules -+ that create /dev/serial0 and /dev/serial1, in which case use -+ /dev/serial1 instead because it will always be correct. Furthermore, -+ you must also set core_freq=250 in config.txt or the miniuart will not -+ work. -+Load: dtoverlay=pi3-miniuart-bt -+Params: -+ -+ -+Name: piscreen -+Info: PiScreen display by OzzMaker.com -+Load: dtoverlay=piscreen,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ -+Name: piscreen2r -+Info: PiScreen 2 with resistive TP display by OzzMaker.com -+Load: dtoverlay=piscreen2r,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ -+Name: pisound -+Info: Configures the Blokas Labs pisound card -+Load: dtoverlay=pisound -+Params: -+ -+ -+Name: pitft22 -+Info: Adafruit PiTFT 2.2" screen -+Load: dtoverlay=pitft22,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ -+Name: pitft28-capacitive -+Info: Adafruit PiTFT 2.8" capacitive touch screen -+Load: dtoverlay=pitft28-capacitive,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ touch-sizex Touchscreen size x (default 240) -+ -+ touch-sizey Touchscreen size y (default 320) -+ -+ touch-invx Touchscreen inverted x axis -+ -+ touch-invy Touchscreen inverted y axis -+ -+ touch-swapxy Touchscreen swapped x y axis -+ -+ -+Name: pitft28-resistive -+Info: Adafruit PiTFT 2.8" resistive touch screen -+Load: dtoverlay=pitft28-resistive,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ -+Name: pitft35-resistive -+Info: Adafruit PiTFT 3.5" resistive touch screen -+Load: dtoverlay=pitft35-resistive,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ -+Name: pps-gpio -+Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). -+Load: dtoverlay=pps-gpio,= -+Params: gpiopin Input GPIO (default "18") -+ assert_falling_edge When present, assert is indicated by a falling -+ edge, rather than by a rising edge -+ -+ -+Name: pwm -+Info: Configures a single PWM channel -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm,= -+Params: pin Output pin (default 18) - see table -+ func Pin function (default 2 = Alt5) - see above -+ clock PWM clock frequency (informational) -+ -+ -+Name: pwm-2chan -+Info: Configures both PWM channels -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm-2chan,= -+Params: pin Output pin (default 18) - see table -+ pin2 Output pin for other channel (default 19) -+ func Pin function (default 2 = Alt5) - see above -+ func2 Function for pin2 (default 2 = Alt5) -+ clock PWM clock frequency (informational) -+ -+ -+Name: qca7000 -+Info: I2SE's Evaluation Board for PLC Stamp micro -+Load: dtoverlay=qca7000,= -+Params: int_pin GPIO pin for interrupt signal (default 23) -+ -+ speed SPI bus speed (default 12 MHz) -+ -+ -+Name: raspidac3 -+Info: Configures the RaspiDAV Rev.3x audio card -+Load: dtoverlay=raspidac3 -+Params: -+ -+ -+Name: rpi-backlight -+Info: Raspberry Pi official display backlight driver -+Load: dtoverlay=rpi-backlight -+Params: -+ -+ -+Name: rpi-dac -+Info: Configures the RPi DAC audio card -+Load: dtoverlay=rpi-dac -+Params: -+ -+ -+Name: rpi-display -+Info: RPi-Display - 2.8" Touch Display by Watterott -+Load: dtoverlay=rpi-display,= -+Params: speed Display SPI bus speed -+ rotate Display rotation {0,90,180,270} -+ fps Delay between frame updates -+ debug Debug output level {0-7} -+ xohms Touchpanel sensitivity (X-plate resistance) -+ swapxy Swap x and y axis -+ -+ -+Name: rpi-ft5406 -+Info: Official Raspberry Pi display touchscreen -+Load: dtoverlay=rpi-ft5406 -+Params: -+ -+ -+Name: rpi-proto -+Info: Configures the RPi Proto audio card -+Load: dtoverlay=rpi-proto -+Params: -+ -+ -+Name: rpi-sense -+Info: Raspberry Pi Sense HAT -+Load: dtoverlay=rpi-sense -+Params: -+ -+ -+Name: rra-digidac1-wm8741-audio -+Info: Configures the Red Rocks Audio DigiDAC1 soundcard -+Load: dtoverlay=rra-digidac1-wm8741-audio -+Params: -+ -+ -+Name: sc16is750-i2c -+Info: Overlay for the NXP SC16IS750 UART with I2C Interface -+ Enables the chip on I2C1 at 0x48. To select another address, -+ please refer to table 10 in reference manual. -+ -+Load: dtoverlay=sc16is750-i2c,= -+Params: int_pin GPIO used for IRQ (default 24) -+ addr Address (default 0x48) -+ -+ -+Name: sc16is752-spi1 -+Info: Overlay for the NXP SC16IS752 Dual UART with SPI Interface -+ Enables the chip on SPI1. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+ -+Load: dtoverlay=sc16is752-spi1,= -+Params: int_pin GPIO used for IRQ (default 24) -+ -+ -+Name: sdhost -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock. -+ N.B. This overlay is designed for situations where the mmc driver is -+ the default, so it disables the other (mmc) interface - this will kill -+ WiFi on a Pi3. If this isn't what you want, either use the sdtweak -+ overlay or the new sd_* dtparams of the base DTBs. -+Load: dtoverlay=sdhost,= -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ -+Name: sdio -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, -+ and enables SDIO via GPIOs 22-27. -+Load: dtoverlay=sdio,= -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) -+ -+ bus_width Set the SDIO host bus width (default 4 bits) -+ -+ -+Name: sdio-1bit -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, -+ and enables 1-bit SDIO via GPIOs 22-25. -+Load: dtoverlay=sdio-1bit,= -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) -+ -+ -+Name: sdtweak -+Info: Tunes the bcm2835-sdhost SD/MMC driver -+ N.B. This functionality is now available via the sd_* dtparams in the -+ base DTB. -+Load: dtoverlay=sdtweak,= -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ -+Name: smi -+Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! -+Load: dtoverlay=smi -+Params: -+ -+ -+Name: smi-dev -+Info: Enables the userspace interface for the SMI driver -+Load: dtoverlay=smi-dev -+Params: -+ -+ -+Name: smi-nand -+Info: Enables access to NAND flash via the SMI interface -+Load: dtoverlay=smi-nand -+Params: -+ -+ -+Name: spi-gpio35-39 -+Info: move SPI function block to GPIO 35 to 39 -+Load: dtoverlay=spi-gpio35-39 -+Params: -+ -+ -+Name: spi-rtc -+Info: Adds support for a number of SPI Real Time Clock devices -+Load: dtoverlay=spi-rtc,= -+Params: pcf2123 Select the PCF2123 device -+ -+ -+Name: spi0-hw-cs -+Info: Re-enables hardware CS/CE (chip selects) for SPI0 -+Load: dtoverlay=spi0-hw-cs -+Params: -+ -+ -+Name: spi1-1cs -+Info: Enables spi1 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-1cs,= -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-2cs -+Info: Enables spi1 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-2cs,= -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-3cs -+Info: Enables spi1 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-3cs,= -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.2 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-1cs -+Info: Enables spi2 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-1cs,= -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-2cs -+Info: Enables spi2 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-2cs,= -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-3cs -+Info: Enables spi2 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-3cs,= -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.2 (default -+ is 'okay' or enabled). -+ -+ -+Name: tinylcd35 -+Info: 3.5" Color TFT Display by www.tinylcd.com -+ Options: Touch, RTC, keypad -+Load: dtoverlay=tinylcd35,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ touch Enable touch panel -+ -+ touchgpio Touch controller IRQ GPIO -+ -+ xohms Touchpanel: Resistance of X-plate in ohms -+ -+ rtc-pcf PCF8563 Real Time Clock -+ -+ rtc-ds DS1307 Real Time Clock -+ -+ keypad Enable keypad -+ -+ Examples: -+ Display with touchpanel, PCF8563 RTC and keypad: -+ dtoverlay=tinylcd35,touch,rtc-pcf,keypad -+ Old touch display: -+ dtoverlay=tinylcd35,touch,touchgpio=3 -+ -+ -+Name: uart1 -+Info: Enable uart1 in place of uart0 -+Load: dtoverlay=uart1,= -+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) -+ -+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) -+ -+ -+Name: vc4-fkms-v3d -+Info: Enable Eric Anholt's DRM VC4 V3D driver on top of the dispmanx -+ display stack. -+Load: dtoverlay=vc4-fkms-v3d, -+Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) -+ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) -+ cma-128 CMA is 128MB, 128MB-aligned -+ cma-96 CMA is 96MB, 128MB-aligned -+ cma-64 CMA is 64MB, 64MB-aligned -+ -+ -+Name: vc4-kms-v3d -+Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or -+ booting to GUI while this overlay is in use will cause interesting -+ lockups. -+Load: dtoverlay=vc4-kms-v3d, -+Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) -+ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) -+ cma-128 CMA is 128MB, 128MB-aligned -+ cma-96 CMA is 96MB, 128MB-aligned -+ cma-64 CMA is 64MB, 64MB-aligned -+ -+ -+Name: vga666 -+Info: Overlay for the Fen Logic VGA666 board -+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -+ after the kernel has started. -+Load: dtoverlay=vga666 -+Params: -+ -+ -+Name: w1-gpio -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *don't* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio,= -+Params: gpiopin GPIO for I/O (default "4") -+ -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature -+ -+ -+Name: w1-gpio-pullup -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *do* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio-pullup,= -+Params: gpiopin GPIO for I/O (default "4") -+ -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature -+ -+ extpullup GPIO for external pullup (default "5") -+ -+ -+Name: wittypi -+Info: Configures the wittypi RTC module. -+Load: dtoverlay=wittypi,= -+Params: led_gpio GPIO for LED (default "17") -+ led_trigger Choose which activity the LED tracks (default -+ "default-on") -+ -+ -+Troubleshooting -+=============== -+ -+If you are experiencing problems that you think are DT-related, enable DT -+diagnostic output by adding this to /boot/config.txt: -+ -+ dtdebug=on -+ -+and rebooting. Then run: -+ -+ sudo vcdbg log msg -+ -+and look for relevant messages. -+ -+Further reading -+=============== -+ -+This is only meant to be a quick introduction to the subject of Device Tree on -+Raspberry Pi. There is a more complete explanation here: -+ -+http://www.raspberrypi.org/documentation/configuration/device-tree.md -diff --git a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..24fcd58fd1dc61d97a77def3d5d1f7c65130dde6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts -@@ -0,0 +1,53 @@ -+// Definitions for ADAU1977 ADC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&soc>; -+ -+ __overlay__ { -+ codec_supply: fixedregulator@0 { -+ compatible = "regulator-fixed"; -+ regulator-name = "AVDD"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c>; -+ -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ adau1977: codec@11 { -+ compatible = "adi,adau1977"; -+ reg = <0x11>; -+ reset-gpios = <&gpio 5 0>; -+ AVDD-supply = <&codec_supply>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "adi,adau1977-adc"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/ads1015-overlay.dts b/arch/arm/boot/dts/overlays/ads1015-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..02b9de46299bae8f22e1a665a482c0cb99cd30c9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/ads1015-overlay.dts -@@ -0,0 +1,98 @@ -+/* -+ * 2016 - Erik Sejr -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ /* ----------- ADS1015 ------------ */ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ ads1015: ads1015 { -+ compatible = "ti,ads1015"; -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0x48>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "i2c_arm/ads1015"; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_a: channel_a { -+ reg = <4>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "i2c_arm/ads1015"; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_b: channel_b { -+ reg = <5>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "i2c_arm/ads1015"; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_c: channel_c { -+ reg = <6>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "i2c_arm/ads1015"; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_d: channel_d { -+ reg = <7>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ addr = <&ads1015>,"reg:0"; -+ cha_enable = <0>,"=1"; -+ cha_cfg = <&channel_a>,"reg:0"; -+ cha_gain = <&channel_a>,"ti,gain:0"; -+ cha_datarate = <&channel_a>,"ti,datarate:0"; -+ chb_enable = <0>,"=2"; -+ chb_cfg = <&channel_b>,"reg:0"; -+ chb_gain = <&channel_b>,"ti,gain:0"; -+ chb_datarate = <&channel_b>,"ti,datarate:0"; -+ chc_enable = <0>,"=3"; -+ chc_cfg = <&channel_c>,"reg:0"; -+ chc_gain = <&channel_c>,"ti,gain:0"; -+ chc_datarate = <&channel_c>,"ti,datarate:0"; -+ chd_enable = <0>,"=4"; -+ chd_cfg = <&channel_d>,"reg:0"; -+ chd_gain = <&channel_d>,"ti,gain:0"; -+ chd_datarate = <&channel_d>,"ti,datarate:0"; -+ }; -+ -+}; -diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..edf2dc9d5d5f6830508edabf2d04c42d27ba9b41 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -@@ -0,0 +1,89 @@ -+/* -+ * Generic Device Tree overlay for the ADS7846 touch controller -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ ads7846_pins: ads7846_pins { -+ brcm,pins = <255>; /* illegal default value */ -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ads7846: ads7846@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&ads7846_pins>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <255 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 255 0>; -+ -+ /* driver defaults */ -+ ti,x-min = /bits/ 16 <0>; -+ ti,y-min = /bits/ 16 <0>; -+ ti,x-max = /bits/ 16 <0x0FFF>; -+ ti,y-max = /bits/ 16 <0x0FFF>; -+ ti,pressure-min = /bits/ 16 <0>; -+ ti,pressure-max = /bits/ 16 <0xFFFF>; -+ ti,x-plate-ohms = /bits/ 16 <400>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ cs = <&ads7846>,"reg:0"; -+ speed = <&ads7846>,"spi-max-frequency:0"; -+ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ -+ <&ads7846>,"interrupts:0", -+ <&ads7846>,"pendown-gpio:4"; -+ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; -+ swapxy = <&ads7846>,"ti,swap-xy?"; -+ xmin = <&ads7846>,"ti,x-min;0"; -+ ymin = <&ads7846>,"ti,y-min;0"; -+ xmax = <&ads7846>,"ti,x-max;0"; -+ ymax = <&ads7846>,"ti,y-max;0"; -+ pmin = <&ads7846>,"ti,pressure-min;0"; -+ pmax = <&ads7846>,"ti,pressure-max;0"; -+ xohms = <&ads7846>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..208849d5c39274ed0aa557f63a19430a451a95f5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts -@@ -0,0 +1,46 @@ -+// Definitions for Digital Dreamtime Akkordion using IQaudIO DAC+ or DACZero -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ frag2: __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ card_name = "Akkordion"; -+ dai_name = "IQaudIO DAC"; -+ dai_stream_name = "IQaudIO DAC HiFi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts b/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..a5468d850a911cd509365cf25f8ffa6ad071b90a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts -@@ -0,0 +1,54 @@ -+/* -+ * Definitions for Allo Piano DAC (2.0/2.1) boards -+ * -+ * NB. The Piano DAC 2.1 board contains 2x TI PCM5142 DAC's. One DAC is stereo -+ * (left/right) and the other provides a subwoofer output, using DSP on the -+ * chip for digital high/low pass crossover. -+ * The initial support for this hardware, that doesn't require any codec driver -+ * modifications, uses only one DAC chip for stereo (left/right) output, the -+ * chip with 0x4c slave address. The other chip at 0x4d is currently ignored! -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5142@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5142"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ piano_dac: __overlay__ { -+ compatible = "allo,piano-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = -+ <&piano_dac>,"allo,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..880c7539d496fb10672ee573f7c51b8a213cecf7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ lowpan0: at86rf233@0 { -+ compatible = "atmel,at86rf233"; -+ reg = <0>; -+ interrupt-parent = <&gpio>; -+ interrupts = <23 4>; /* active high */ -+ reset-gpio = <&gpio 24 1>; -+ sleep-gpio = <&gpio 25 1>; -+ spi-max-frequency = <3000000>; -+ xtal-trim = /bits/ 8 <0xf>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ lowpan0_pins: lowpan0_pins { -+ brcm,pins = <23 24 25>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ interrupt = <&lowpan0>, "interrupts:0", -+ <&lowpan0_pins>, "brcm,pins:0"; -+ reset = <&lowpan0>, "reset-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:4"; -+ sleep = <&lowpan0>, "sleep-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:8"; -+ speed = <&lowpan0>, "spi-max-frequency:0"; -+ trim = <&lowpan0>, "xtal-trim.0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..4ed66577fa1d59e7b167ffdfd5a3f0de066cded2 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for audioinjector.net audio add on soundcard -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8731@1a { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8731"; -+ reg = <0x1a>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "ai,audioinjector-pi-soundcard"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/audremap-overlay.dts b/arch/arm/boot/dts/overlays/audremap-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9582d6ab31218b4ed7b1d42a9190ca6efe9bd531 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/audremap-overlay.dts -@@ -0,0 +1,19 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&audio_pins>; -+ frag0: __overlay__ { -+ brcm,pins = < 12 13 >; -+ brcm,function = < 4 >; /* alt0 alt0 */ -+ }; -+ }; -+ -+ __overrides__ { -+ swap_lr = <&frag0>, "swap_lr?"; -+ enable_jack = <&frag0>, "enable_jack?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..782b1715467e943c18fe936cc76448f3db960fbc ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -@@ -0,0 +1,23 @@ -+// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9bf67fd57bada3c3e06c09744fb184767bab5d14 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts -@@ -0,0 +1,39 @@ -+/* -+ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ -+ dht11: dht11@0 { -+ compatible = "dht11"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dht11_pins>; -+ gpios = <&gpio 4 0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dht11_pins: dht11_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&dht11_pins>,"brcm,pins:0", -+ <&dht11>,"gpios:4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts b/arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..3930f412bca4454c6673fb19859e607b360bc6c3 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for Dion Audio LOCO DAC-AMP -+ -+/* -+ * PCM5242 DAC (in hardware mode) and TPA3118 AMP. -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "dionaudio,loco-pcm5242-tpa3118"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dpi18-overlay.dts b/arch/arm/boot/dts/overlays/dpi18-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8098d5e28a71ffbc717db5c6b88305d2ba6e3175 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dpi18-overlay.dts -@@ -0,0 +1,31 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ // There is no DPI driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dpi18_pins>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dpi18_pins: dpi18_pins { -+ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 -+ 12 13 14 15 16 17 18 19 20 -+ 21>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dpi24-overlay.dts b/arch/arm/boot/dts/overlays/dpi24-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e4dbe40218a008ef4028c1214740c3d6bc574724 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dpi24-overlay.dts -@@ -0,0 +1,31 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ // There is no DPI driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dpi24_pins>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dpi24_pins: dpi24_pins { -+ brcm,pins = <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>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..fc48bd1eac605115c3b89fddfe39f5ea6181459f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -@@ -0,0 +1,20 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ __overlay__ { -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..527abc9f0ddf71f4dc7d58336d87684c931cc2f3 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -@@ -0,0 +1,29 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ dwc2_usb: __overlay__ { -+ compatible = "brcm,bcm2835-usb"; -+ reg = <0x7e980000 0x10000>; -+ interrupts = <1 9>; -+ dr_mode = "otg"; -+ g-np-tx-fifo-size = <32>; -+ g-rx-fifo-size = <256>; -+ g-tx-fifo-size = <256 128 128 64 64 64 32>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ dr_mode = <&dwc2_usb>, "dr_mode"; -+ g-np-tx-fifo-size = <&dwc2_usb>,"g-np-tx-fifo-size:0"; -+ g-rx-fifo-size = <&dwc2_usb>,"g-rx-fifo-size:0"; -+ g-tx-fifo-size = <&dwc2_usb>,"g-tx-fifo-size:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..db8a8feed94c010e368065fdd88b028622303b6f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -@@ -0,0 +1,53 @@ -+// Overlay for the Microchip ENC28J60 Ethernet Controller -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ eth1: enc28j60@0{ -+ compatible = "microchip,enc28j60"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; /* falling edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <ð1>, "interrupts:0", -+ <ð1_pins>, "brcm,pins:0"; -+ speed = <ð1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..946c9d2107a83335b11f094e75945a509595ab7c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts -@@ -0,0 +1,47 @@ -+// Overlay for the Microchip ENC28J60 Ethernet Controller - SPI2 Compute Module -+// Interrupt pin: 39 -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spi2>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ eth1: enc28j60@0{ -+ compatible = "microchip,enc28j60"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <39 0x2>; /* falling edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <39>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <ð1>, "interrupts:0", -+ <ð1_pins>, "brcm,pins:0"; -+ speed = <ð1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..af5baf7ddc92be7a59ad3d5f9a9fefba915bed05 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -@@ -0,0 +1,44 @@ -+// Definitions for ir-gpio module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ gpio_ir: ir-receiver { -+ compatible = "gpio-ir-receiver"; -+ -+ // pin number, high or low -+ gpios = <&gpio 18 1>; -+ -+ // parameter for keymap name -+ linux,rc-map-name = "rc-rc6-mce"; -+ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ gpio_ir_pins: gpio_ir_pins { -+ brcm,pins = <18>; // pin 18 -+ brcm,function = <0>; // in -+ brcm,pull = <1>; // down -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ // parameters -+ gpio_pin = <&gpio_ir>,"gpios:4", -+ <&gpio_ir_pins>,"brcm,pins:0"; // pin number -+ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state -+ -+ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ff8cb36d94d4940d5151ace24afc4ad1a9aa9fb6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for gpio-poweroff module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ power_ctrl: power_ctrl { -+ compatible = "gpio-poweroff"; -+ gpios = <&gpio 26 0>; -+ force; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ power_ctrl_pins: power_ctrl_pins { -+ brcm,pins = <26>; -+ brcm,function = <1>; // out -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&power_ctrl>,"gpios:4", -+ <&power_ctrl_pins>,"brcm,pins:0"; -+ active_low = <&power_ctrl>,"gpios:8"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..5f5785534fd3d9a97309796f842c8881e2d6979a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Amp/Amp+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ tas5713@1b { -+ #sound-dai-cells = <0>; -+ compatible = "ti,tas5713"; -+ reg = <0x1b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-amp"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..0b74fdc6e0f640967a5681b28360e33b8d4b7cfa ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for HiFiBerry DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2f078d4747ccfdc5172e24b18ce65454f1219b9d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -0,0 +1,56 @@ -+// Definitions for HiFiBerry DAC+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ dacpro_osc: dacpro_osc { -+ compatible = "hifiberry,dacpro-clk"; -+ #clock-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4d { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4d>; -+ clocks = <&dacpro_osc>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&sound>; -+ hifiberry_dacplus: __overlay__ { -+ compatible = "hifiberry,hifiberry-dacplus"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = -+ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; -+ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..f5e41f48ba4fed92194ff5a63d13c70bb2d1c091 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Digi -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2a26d9cfffb0f3d7958eb3756ca7c4ba28400e1c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts -@@ -0,0 +1,41 @@ -+// Definitions for HiFiBerry Digi Pro -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ clock44-gpio = <&gpio 5 0>; -+ clock48-gpio = <&gpio 6 0>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ac0f3c28ea855a620dc6a3385d9d15009f26358d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -@@ -0,0 +1,93 @@ -+/* -+ * Device Tree overlay for HY28A display -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28a_pins: hy28a_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hy28a: hy28a@0{ -+ compatible = "ilitek,ili9320"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28a_pins>; -+ -+ spi-max-frequency = <32000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ hy28a_ts: hy28a-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28a>,"spi-max-frequency:0"; -+ rotate = <&hy28a>,"rotate:0"; -+ fps = <&hy28a>,"fps:0"; -+ debug = <&hy28a>,"debug:0"; -+ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28a>,"reset-gpios:4", -+ <&hy28a_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28a>,"led-gpios:4", -+ <&hy28a_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8018aebde8e557f45ffd63eb86f6c7a1048fe3cb ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -@@ -0,0 +1,148 @@ -+/* -+ * Device Tree overlay for HY28b display shield by Texy -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28b_pins: hy28b_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hy28b: hy28b@0{ -+ compatible = "ilitek,ili9325"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28b_pins>; -+ -+ spi-max-frequency = <48000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ -+ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; -+ -+ init = <0x10000e7 0x0010 -+ 0x1000000 0x0001 -+ 0x1000001 0x0100 -+ 0x1000002 0x0700 -+ 0x1000003 0x1030 -+ 0x1000004 0x0000 -+ 0x1000008 0x0207 -+ 0x1000009 0x0000 -+ 0x100000a 0x0000 -+ 0x100000c 0x0001 -+ 0x100000d 0x0000 -+ 0x100000f 0x0000 -+ 0x1000010 0x0000 -+ 0x1000011 0x0007 -+ 0x1000012 0x0000 -+ 0x1000013 0x0000 -+ 0x2000032 -+ 0x1000010 0x1590 -+ 0x1000011 0x0227 -+ 0x2000032 -+ 0x1000012 0x009c -+ 0x2000032 -+ 0x1000013 0x1900 -+ 0x1000029 0x0023 -+ 0x100002b 0x000e -+ 0x2000032 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000032 -+ 0x1000050 0x0000 -+ 0x1000051 0x00ef -+ 0x1000052 0x0000 -+ 0x1000053 0x013f -+ 0x1000060 0xa700 -+ 0x1000061 0x0001 -+ 0x100006a 0x0000 -+ 0x1000080 0x0000 -+ 0x1000081 0x0000 -+ 0x1000082 0x0000 -+ 0x1000083 0x0000 -+ 0x1000084 0x0000 -+ 0x1000085 0x0000 -+ 0x1000090 0x0010 -+ 0x1000092 0x0000 -+ 0x1000093 0x0003 -+ 0x1000095 0x0110 -+ 0x1000097 0x0000 -+ 0x1000098 0x0000 -+ 0x1000007 0x0133 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000064>; -+ debug = <0>; -+ }; -+ -+ hy28b_ts: hy28b-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28b>,"spi-max-frequency:0"; -+ rotate = <&hy28b>,"rotate:0"; -+ fps = <&hy28b>,"fps:0"; -+ debug = <&hy28b>,"debug:0"; -+ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28b>,"reset-gpios:4", -+ <&hy28b_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28b>,"led-gpios:4", -+ <&hy28b_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..0afc6b405414c97428278dd3e8836759092aedb5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts -@@ -0,0 +1,13 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ compatible = "brcm,bcm2708-i2c"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..b72b32e936774d901bc253b06e025c2dd48bdb1b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts -@@ -0,0 +1,43 @@ -+// Overlay for i2c_gpio bitbanging host bus. -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ i2c_gpio: i2c@0 { -+ compatible = "i2c-gpio"; -+ gpios = <&gpio 23 0 /* sda */ -+ &gpio 24 0 /* scl */ -+ >; -+ i2c-gpio,delay-us = <2>; /* ~100 kHz */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/aliases"; -+ __overlay__ { -+ i2c_gpio = "/i2c@0"; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/__symbols__"; -+ __overlay__ { -+ i2c_gpio = "/i2c@0"; -+ }; -+ }; -+ -+ __overrides__ { -+ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; -+ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; -+ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..976d38e781539093e91fe641497d8a6701dd6035 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts -@@ -0,0 +1,139 @@ -+// Umbrella I2C Mux overlay -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca9542: mux@70 { -+ compatible = "nxp,pca9542"; -+ reg = <0x70>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ i2c@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0>; -+ }; -+ i2c@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca9545: mux@70 { -+ compatible = "nxp,pca9545"; -+ reg = <0x70>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ i2c@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0>; -+ }; -+ i2c@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ }; -+ i2c@2 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <2>; -+ }; -+ i2c@3 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <3>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca9548: mux@70 { -+ compatible = "nxp,pca9548"; -+ reg = <0x70>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ i2c@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0>; -+ }; -+ i2c@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ }; -+ i2c@2 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <2>; -+ }; -+ i2c@3 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <3>; -+ }; -+ i2c@4 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <4>; -+ }; -+ i2c@5 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <5>; -+ }; -+ i2c@6 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <6>; -+ }; -+ i2c@7 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <7>; -+ }; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ pca9542 = <0>, "+0"; -+ pca9545 = <0>, "+1"; -+ pca9548 = <0>, "+2"; -+ -+ addr = <&pca9542>,"reg:0", -+ <&pca9545>,"reg:0", -+ <&pca9548>,"reg:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d1ffd2326669e46ad68939f94713cc992dee57e0 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts -@@ -0,0 +1,26 @@ -+// Definitions for NXP PCA9685A I2C PWM controller on ARM I2C bus. -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca: pca@40 { -+ compatible = "nxp,pca9685"; -+ #pwm-cells = <2>; -+ reg = <0x40>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ __overrides__ { -+ addr = <&pca>,"reg:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..1efcf0b712c9c5c19210545002ac1f0931db58f5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -@@ -0,0 +1,83 @@ -+// Definitions for several I2C based Real Time Clocks -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ abx80x: abx80x@69 { -+ compatible = "abracon,abx80x"; -+ reg = <0x69>; -+ abracon,tc-diode = "standard"; -+ abracon,tc-resistor = <0>; -+ status = "disable"; -+ }; -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ ds1339: ds1339@68 { -+ compatible = "dallas,ds1339"; -+ trickle-resistor-ohms = <0>; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ mcp7940x: mcp7940x@6f { -+ compatible = "microchip,mcp7940x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ mcp7941x: mcp7941x@6f { -+ compatible = "microchip,mcp7941x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf2127: pcf2127@51 { -+ compatible = "nxp,pcf2127"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ pcf8523: pcf8523@68 { -+ compatible = "nxp,pcf8523"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ }; -+ }; -+ __overrides__ { -+ abx80x = <&abx80x>,"status"; -+ ds1307 = <&ds1307>,"status"; -+ ds1339 = <&ds1339>,"status"; -+ ds3231 = <&ds3231>,"status"; -+ mcp7940x = <&mcp7940x>,"status"; -+ mcp7941x = <&mcp7941x>,"status"; -+ pcf2127 = <&pcf2127>,"status"; -+ pcf8523 = <&pcf8523>,"status"; -+ pcf8563 = <&pcf8563>,"status"; -+ trickle-diode-type = <&abx80x>,"abracon,tc-diode"; -+ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0", -+ <&abx80x>,"abracon,tc-resistor"; -+ wakeup-source = <&ds1339>,"wakeup-source?", -+ <&ds3231>,"wakeup-source?", -+ <&mcp7940x>,"wakeup-source?", -+ <&mcp7941x>,"wakeup-source?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..f6d134c095af2398fc55ae7d2b0e86456c30627c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for a few digital barometric pressure and temperature sensors -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ bmp085: bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "disable"; -+ }; -+ -+ bmp280: bmp280@76 { -+ compatible = "bosch,bmp280"; -+ reg = <0x76>; -+ status = "disable"; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ bmp085 = <&bmp085>,"status"; -+ bmp280 = <&bmp280>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..1f4fc7b570604a50ff6d3f6d676c3c4642d66b17 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts -@@ -0,0 +1,61 @@ -+/* -+ * Device tree overlay for i2c_bcm2708, i2c0 bus -+ * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c0_pins>; -+ frag1: __overlay__ { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c0_pins>; -+ __dormant__ { -+ brcm,pins = <28 29>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c0_pins>; -+ __dormant__ { -+ brcm,pins = <44 45>; -+ brcm,function = <5>; /* alt1 */ -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c0_pins>; -+ __dormant__ { -+ brcm,pins = <46 47>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ -+ __overrides__ { -+ sda0_pin = <&frag1>,"brcm,pins:0"; -+ scl0_pin = <&frag1>,"brcm,pins:4"; -+ pins_0_1 = <0>,"+1-2-3-4"; -+ pins_28_29 = <0>,"-1+2-3-4"; -+ pins_44_45 = <0>,"-1-2+3-4"; -+ pins_46_47 = <0>,"-1-2-3+4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e303b9c61c82a28eab7b48f6b085661574d5a849 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -@@ -0,0 +1,37 @@ -+/* -+ * Device tree overlay for i2c_bcm2708, i2c1 bus -+ * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; -+ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; -+ pin_func = <&i2c1_pins>,"brcm,function:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..30c356d6070cc3b1dfd1d5a07dc1021339bf5bd2 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts -@@ -0,0 +1,18 @@ -+/* -+ * Device tree overlay to move i2s to gpio 28 to 31 on CM -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2s_pins>; -+ __overlay__ { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..0d35c85382bb5766b3eeb9de1bd4a94621229e4b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -@@ -0,0 +1,43 @@ -+// Definitions for IQaudIO DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ frag2: __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d4bad8742a985e2f15eed19ca52ef283a74fefb9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -@@ -0,0 +1,46 @@ -+// Definitions for IQaudIO DAC+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ iqaudio_dac: __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ mute-gpios = <&gpio 22 0>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&iqaudio_dac>,"iqaudio,24db_digital_gain?"; -+ auto_mute_amp = <&iqaudio_dac>,"iqaudio-dac,auto-mute-amp?"; -+ unmute_amp = <&iqaudio_dac>,"iqaudio-dac,unmute-amp?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..da4fbfdfdbbbcf2505b9eb4789ddb779ec72cea8 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts -@@ -0,0 +1,47 @@ -+// Definitions for IQAudIO Digi WM8804 audio board -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ // DVDD-supply = <®_3v3>; -+ // PVDD-supply = <®_3v3>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ wm8804_digi: __overlay__ { -+ compatible = "iqaudio,wm8804-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ card_name = <&wm8804_digi>,"wm8804-digi,card-name"; -+ dai_name = <&wm8804_digi>,"wm8804-digi,dai-name"; -+ dai_stream_name = <&wm8804_digi>,"wm8804-digi,dai-stream-name"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..312632ad376d5b8c8ff1dbf31fa03d0d18181d94 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts -@@ -0,0 +1,43 @@ -+// Definitions for JustBoom DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4d { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4d>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ frag2: __overlay__ { -+ compatible = "justboom,justboom-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..cbbede9a541166ba257122918081982016e0b7eb ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for JustBoom Digi -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "justboom,justboom-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7d5d82bdf4c41cfbafada51a6d23cbd57822828f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -@@ -0,0 +1,57 @@ -+// Definitions for lirc-rpi module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ lirc_rpi: lirc_rpi { -+ compatible = "rpi,lirc-rpi"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lirc_pins>; -+ status = "okay"; -+ -+ // Override autodetection of IR receiver circuit -+ // (0 = active high, 1 = active low, -1 = no override ) -+ rpi,sense = <0xffffffff>; -+ -+ // Software carrier -+ // (0 = off, 1 = on) -+ rpi,softcarrier = <1>; -+ -+ // Invert output -+ // (0 = off, 1 = on) -+ rpi,invert = <0>; -+ -+ // Enable debugging messages -+ // (0 = off, 1 = on) -+ rpi,debug = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ lirc_pins: lirc_pins { -+ brcm,pins = <17 18>; -+ brcm,function = <1 0>; // out in -+ brcm,pull = <0 1>; // off down -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; -+ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; -+ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; -+ -+ sense = <&lirc_rpi>,"rpi,sense:0"; -+ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; -+ invert = <&lirc_rpi>,"rpi,invert:0"; -+ debug = <&lirc_rpi>,"rpi,debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..412f966a3cc0a312771b7182310a7045fb923224 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts -@@ -0,0 +1,54 @@ -+// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ mcp23017_pins: mcp23017_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ mcp23017: mcp@20 { -+ compatible = "microchip,mcp23017"; -+ reg = <0x20>; -+ gpio-controller; -+ #gpio-cells = <2>; -+ #interrupt-cells=<2>; -+ interrupt-parent = <&gpio>; -+ interrupts = <4 2>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&mcp23017_pins>,"brcm,pins:0", -+ <&mcp23017>,"interrupts:0"; -+ addr = <&mcp23017>,"reg:0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/mcp23s17-overlay.dts b/arch/arm/boot/dts/overlays/mcp23s17-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7dcbacb3cd007eb15b2b0f165fd8adc7a7b7c580 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp23s17-overlay.dts -@@ -0,0 +1,732 @@ -+// Overlay for MCP23S08/17 GPIO Extenders from Microchip Semiconductor -+ -+// dtparams: -+// s08-spi--present - 4-bit integer, bitmap indicating MCP23S08 devices present on SPI, CS#. -+// s17-spi--present - 8-bit integer, bitmap indicating MCP23S17 devices present on SPI, CS#. -+// s08-spi--int-gpio - integer, enables interrupts on a single MCP23S08 device on SPI, CS#, specifies the GPIO pin to which INT output is connected. -+// s17-spi--int-gpio - integer, enables mirrored interrupts on a single MCP23S17 device on SPI, CS#, specifies the GPIO pin to which either INTA or INTB output is connected. -+// -+// If devices are present on SPI1 or SPI2, those interfaces must be enabled with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays. -+// If interrupts are enabled for a device on a given CS# on a SPI bus, that device must be the only one present on that SPI bus/CS#. -+// -+// Example 1: A single MCP23S17 device on SPI0, CS#0 with its SPI addr set to 0 and INTA output connected to GPIO25: -+// dtoverlay=mcp23s17:s17-spi0-0-present=1,s17-spi0-0-int-gpio=25 -+// -+// Example 2: Two MCP23S08 devices on SPI1, CS#0 with their addrs set to 2 and 3. Three MCP23S17 devices on SPI1, CS#1 with their addrs set to 0, 1 and 7: -+// dtoverlay=spi1-2cs -+// dtoverlay=mcp23s17:s08-spi1-0-present=12,s17-spi1-1-present=131 -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ // disable spi-dev on spi0.0 -+ fragment@0 { -+ target = <&spidev0>; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi0.1 -+ fragment@1 { -+ target = <&spidev1>; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi1.0 -+ fragment@2 { -+ target-path = "spi1/spidev@0"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi1.1 -+ fragment@3 { -+ target-path = "spi1/spidev@1"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi1.2 -+ fragment@4 { -+ target-path = "spi1/spidev@2"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi2.0 -+ fragment@5 { -+ target-path = "spi2/spidev@0"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi2.1 -+ fragment@6 { -+ target-path = "spi2/spidev@1"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi2.2 -+ fragment@7 { -+ target-path = "spi2/spidev@2"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi0.0 -+ fragment@8 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_00: mcp23s08@0 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi0-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi0-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi0.1 -+ fragment@9 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_01: mcp23s08@1 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi0-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi0-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi1.0 -+ fragment@10 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_10: mcp23s08@0 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi1-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi1-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi1.1 -+ fragment@11 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_11: mcp23s08@1 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi1-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi1-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi1.2 -+ fragment@12 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_12: mcp23s08@2 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi1-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi1-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi2.0 -+ fragment@13 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_20: mcp23s08@0 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi2-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi2-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi2.1 -+ fragment@14 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_21: mcp23s08@1 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi2-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi2-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi2.2 -+ fragment@15 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_22: mcp23s08@2 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi2-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi2-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi0.0 -+ fragment@16 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_00: mcp23s17@0 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi0-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi0-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi0.1 -+ fragment@17 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_01: mcp23s17@1 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi0-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi0-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi1.0 -+ fragment@18 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_10: mcp23s17@0 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi1-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi1-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi1.1 -+ fragment@19 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_11: mcp23s17@1 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi1-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi1-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi1.2 -+ fragment@20 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_12: mcp23s17@2 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi1-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi1-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi2.0 -+ fragment@21 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_20: mcp23s17@0 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi2-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi2-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi2.1 -+ fragment@22 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_21: mcp23s17@1 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi2-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi2-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi2.2 -+ fragment@23 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_22: mcp23s17@2 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi2-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi2-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi0.0 as a input with no pull-up/down -+ fragment@24 { -+ target = <&gpio>; -+ __dormant__ { -+ spi0_0_int_pins: spi0_0_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi0-0-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi0.1 as a input with no pull-up/down -+ fragment@25 { -+ target = <&gpio>; -+ __dormant__ { -+ spi0_1_int_pins: spi0_1_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi0-1-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi1.0 as a input with no pull-up/down -+ fragment@26 { -+ target = <&gpio>; -+ __dormant__ { -+ spi1_0_int_pins: spi1_0_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi1-0-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi1.1 as a input with no pull-up/down -+ fragment@27 { -+ target = <&gpio>; -+ __dormant__ { -+ spi1_1_int_pins: spi1_1_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi1-1-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi1.2 as a input with no pull-up/down -+ fragment@28 { -+ target = <&gpio>; -+ __dormant__ { -+ spi1_2_int_pins: spi1_2_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi1-2-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi2.0 as a input with no pull-up/down -+ fragment@29 { -+ target = <&gpio>; -+ __dormant__ { -+ spi2_0_int_pins: spi2_0_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi2-0-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi2.1 as a input with no pull-up/down -+ fragment@30 { -+ target = <&gpio>; -+ __dormant__ { -+ spi2_1_int_pins: spi2_1_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi2-1-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi2.2 as a input with no pull-up/down -+ fragment@31 { -+ target = <&gpio>; -+ __dormant__ { -+ spi2_2_int_pins: spi2_2_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi2-2-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi0.0. -+ // Use default active low interrupt signalling. -+ fragment@32 { -+ target = <&mcp23s08_00>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi0.1. -+ // Use default active low interrupt signalling. -+ fragment@33 { -+ target = <&mcp23s08_01>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi1.0. -+ // Use default active low interrupt signalling. -+ fragment@34 { -+ target = <&mcp23s08_10>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi1.1. -+ // Use default active low interrupt signalling. -+ fragment@35 { -+ target = <&mcp23s08_11>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi1.2. -+ // Use default active low interrupt signalling. -+ fragment@36 { -+ target = <&mcp23s08_12>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi2.0. -+ // Use default active low interrupt signalling. -+ fragment@37 { -+ target = <&mcp23s08_20>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi2.1. -+ // Use default active low interrupt signalling. -+ fragment@38 { -+ target = <&mcp23s08_21>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi2.2. -+ // Use default active low interrupt signalling. -+ fragment@39 { -+ target = <&mcp23s08_22>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi0.0. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Use default active low interrupt signalling. -+ fragment@40 { -+ target = <&mcp23s17_00>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi0.1. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@41 { -+ target = <&mcp23s17_01>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi1.0. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@42 { -+ target = <&mcp23s17_10>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi1.1. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@43 { -+ target = <&mcp23s17_11>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi1.2. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@44 { -+ target = <&mcp23s17_12>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi2.0. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@45 { -+ target = <&mcp23s17_20>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi2.1. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@46 { -+ target = <&mcp23s17_21>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi2.2. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@47 { -+ target = <&mcp23s17_22>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ __overrides__ { -+ s08-spi0-0-present = <0>,"+0+8", <&mcp23s08_00>,"microchip,spi-present-mask:0"; -+ s08-spi0-1-present = <0>,"+1+9", <&mcp23s08_01>,"microchip,spi-present-mask:0"; -+ s08-spi1-0-present = <0>,"+2+10", <&mcp23s08_10>,"microchip,spi-present-mask:0"; -+ s08-spi1-1-present = <0>,"+3+11", <&mcp23s08_11>,"microchip,spi-present-mask:0"; -+ s08-spi1-2-present = <0>,"+4+12", <&mcp23s08_12>,"microchip,spi-present-mask:0"; -+ s08-spi2-0-present = <0>,"+5+13", <&mcp23s08_20>,"microchip,spi-present-mask:0"; -+ s08-spi2-1-present = <0>,"+6+14", <&mcp23s08_21>,"microchip,spi-present-mask:0"; -+ s08-spi2-2-present = <0>,"+7+15", <&mcp23s08_22>,"microchip,spi-present-mask:0"; -+ s17-spi0-0-present = <0>,"+0+16", <&mcp23s17_00>,"microchip,spi-present-mask:0"; -+ s17-spi0-1-present = <0>,"+1+17", <&mcp23s17_01>,"microchip,spi-present-mask:0"; -+ s17-spi1-0-present = <0>,"+2+18", <&mcp23s17_10>,"microchip,spi-present-mask:0"; -+ s17-spi1-1-present = <0>,"+3+19", <&mcp23s17_11>,"microchip,spi-present-mask:0"; -+ s17-spi1-2-present = <0>,"+4+20", <&mcp23s17_12>,"microchip,spi-present-mask:0"; -+ s17-spi2-0-present = <0>,"+5+21", <&mcp23s17_20>,"microchip,spi-present-mask:0"; -+ s17-spi2-1-present = <0>,"+6+22", <&mcp23s17_21>,"microchip,spi-present-mask:0"; -+ s17-spi2-2-present = <0>,"+7+23", <&mcp23s17_22>,"microchip,spi-present-mask:0"; -+ s08-spi0-0-int-gpio = <0>,"+24+32", <&spi0_0_int_pins>,"brcm,pins:0", <&mcp23s08_00>,"interrupts:0"; -+ s08-spi0-1-int-gpio = <0>,"+25+33", <&spi0_1_int_pins>,"brcm,pins:0", <&mcp23s08_01>,"interrupts:0"; -+ s08-spi1-0-int-gpio = <0>,"+26+34", <&spi1_0_int_pins>,"brcm,pins:0", <&mcp23s08_10>,"interrupts:0"; -+ s08-spi1-1-int-gpio = <0>,"+27+35", <&spi1_1_int_pins>,"brcm,pins:0", <&mcp23s08_11>,"interrupts:0"; -+ s08-spi1-2-int-gpio = <0>,"+28+36", <&spi1_2_int_pins>,"brcm,pins:0", <&mcp23s08_12>,"interrupts:0"; -+ s08-spi2-0-int-gpio = <0>,"+29+37", <&spi2_0_int_pins>,"brcm,pins:0", <&mcp23s08_20>,"interrupts:0"; -+ s08-spi2-1-int-gpio = <0>,"+30+38", <&spi2_1_int_pins>,"brcm,pins:0", <&mcp23s08_21>,"interrupts:0"; -+ s08-spi2-2-int-gpio = <0>,"+31+39", <&spi2_2_int_pins>,"brcm,pins:0", <&mcp23s08_22>,"interrupts:0"; -+ s17-spi0-0-int-gpio = <0>,"+24+40", <&spi0_0_int_pins>,"brcm,pins:0", <&mcp23s17_00>,"interrupts:0"; -+ s17-spi0-1-int-gpio = <0>,"+25+41", <&spi0_1_int_pins>,"brcm,pins:0", <&mcp23s17_01>,"interrupts:0"; -+ s17-spi1-0-int-gpio = <0>,"+26+42", <&spi1_0_int_pins>,"brcm,pins:0", <&mcp23s17_10>,"interrupts:0"; -+ s17-spi1-1-int-gpio = <0>,"+27+43", <&spi1_1_int_pins>,"brcm,pins:0", <&mcp23s17_11>,"interrupts:0"; -+ s17-spi1-2-int-gpio = <0>,"+28+44", <&spi1_2_int_pins>,"brcm,pins:0", <&mcp23s17_12>,"interrupts:0"; -+ s17-spi2-0-int-gpio = <0>,"+29+45", <&spi2_0_int_pins>,"brcm,pins:0", <&mcp23s17_20>,"interrupts:0"; -+ s17-spi2-1-int-gpio = <0>,"+30+46", <&spi2_1_int_pins>,"brcm,pins:0", <&mcp23s17_21>,"interrupts:0"; -+ s17-spi2-2-int-gpio = <0>,"+31+47", <&spi2_2_int_pins>,"brcm,pins:0", <&mcp23s17_22>,"interrupts:0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -new file mode 100755 -index 0000000000000000000000000000000000000000..c96cdae27fb15055c4a6ec55d1ee45644768c392 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -@@ -0,0 +1,73 @@ -+/* -+ * Device tree overlay for mcp251x/can0 on spi0.0 -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.0 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ /* the interrupt pin of the can-controller */ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ can0_pins: can0_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; -+ -+ /* the clock/oscillator of the can-controller */ -+ fragment@3 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on SPI0.0 */ -+ can0_osc: can0_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; -+ -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can0: mcp2515@0 { -+ reg = <0>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can0_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can0_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can0_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can0>,"spi-max-frequency:0"; -+ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..67bd0d9bdaa2ff767d284010a69ecfe3f2aa1fd1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -@@ -0,0 +1,73 @@ -+/* -+ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.1 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ /* the interrupt pin of the can-controller */ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ can1_pins: can1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; -+ -+ /* the clock/oscillator of the can-controller */ -+ fragment@3 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on spi0.1 */ -+ can1_osc: can1_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; -+ -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can1: mcp2515@1 { -+ reg = <1>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can1_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can1_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can1_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can1>,"spi-max-frequency:0"; -+ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/midi-uart0-overlay.dts b/arch/arm/boot/dts/overlays/midi-uart0-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..565af7cf79d761877be3bd06191f31aabf9e1e9b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/midi-uart0-overlay.dts -@@ -0,0 +1,36 @@ -+/dts-v1/; -+/plugin/; -+ -+#include -+ -+/* -+ * Fake a higher clock rate to get a larger divisor, and thereby a lower -+ * baudrate. The real clock is 48MHz, which we scale so that requesting -+ * 38.4kHz results in an actual 31.25kHz. -+ * -+ * 48000000*38400/31250 = 58982400 -+ */ -+ -+/{ -+ compatible = "brcm,bcm2835"; -+ -+ fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ midi_clk: midi_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-output-names = "uart0_pclk"; -+ clock-frequency = <58982400>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart0>; -+ __overlay__ { -+ clocks = <&midi_clk>, -+ <&clocks BCM2835_CLOCK_VPU>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d32b02ca01ced5ab3de00d66d5412c8fda4bc510 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts -@@ -0,0 +1,38 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&mmc>; -+ frag0: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc_pins>; -+ bus-width = <4>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ mmc_pins: mmc_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <7>; /* alt3 */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sdhost>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2c29aaed44c5959d7f0df2a3baf2af052b24b6b4 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts -@@ -0,0 +1,117 @@ -+/* -+ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ mz61581_pins: mz61581_pins { -+ brcm,pins = <4 15 18 25>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ mz61581: mz61581@0{ -+ compatible = "samsung,s6d02a1"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mz61581_pins>; -+ -+ spi-max-frequency = <128000000>; -+ spi-cpol; -+ spi-cpha; -+ -+ width = <320>; -+ height = <480>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ txbuflen = <32768>; -+ -+ reset-gpios = <&gpio 15 0>; -+ dc-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 0>; -+ -+ init = <0x10000b0 00 -+ 0x1000011 -+ 0x20000ff -+ 0x10000b3 0x02 0x00 0x00 0x00 -+ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 -+ 0x10000c1 0x08 0x16 0x08 0x08 -+ 0x10000c4 0x11 0x07 0x03 0x03 -+ 0x10000c6 0x00 -+ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 -+ 0x1000035 0x00 -+ 0x1000036 0xa0 -+ 0x100003a 0x55 -+ 0x1000044 0x00 0x01 -+ 0x10000d0 0x07 0x07 0x1d 0x03 -+ 0x10000d1 0x03 0x30 0x10 -+ 0x10000d2 0x03 0x14 0x04 -+ 0x1000029 -+ 0x100002c>; -+ -+ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ -+ debug = <3>; -+ }; -+ -+ mz61581_ts: mz61581_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <4 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 4 0>; -+ -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&mz61581>, "spi-max-frequency:0"; -+ rotate = <&mz61581>, "rotate:0"; -+ fps = <&mz61581>, "fps:0"; -+ txbuflen = <&mz61581>, "txbuflen:0"; -+ debug = <&mz61581>, "debug:0"; -+ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..14a59dcf13ca64eb0bdbd34d70690a11abe83cfa ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts -@@ -0,0 +1,27 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed -+ from the VPU. There is a special driver for this with a separate DT node, -+ which has the unfortunate consequence of breaking the act_led_gpio and -+ act_led_activelow dtparams. -+ -+ This overlay changes the GPIO controller back to the standard one and -+ restores the dtparams. -+*/ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&act_led>; -+ frag0: __overlay__ { -+ gpios = <&gpio 0 0>; -+ }; -+ }; -+ -+ __overrides__ { -+ gpio = <&frag0>,"gpios:4"; -+ activelow = <&frag0>,"gpios:8"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..87cf345f9641e62c5ed496c238333716cc5b27e6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts -@@ -0,0 +1,46 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. -+ To disable the systemd service that initialises the modem so it doesn't use -+ the UART: -+ -+ sudo systemctl disable hciuart -+*/ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&uart1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart0>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&uart0_pins>; -+ __overlay__ { -+ brcm,pins; -+ brcm,function; -+ brcm,pull; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/aliases"; -+ __overlay__ { -+ serial0 = "/soc/serial@7e201000"; -+ serial1 = "/soc/serial@7e215040"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..18f77453c38dbbf33f3726a5b4cce15b9f20f390 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts -@@ -0,0 +1,64 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore -+ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum -+ usable baudrate. -+ -+ It is also necessary to edit /lib/systemd/system/hciuart.service and -+ replace ttyAMA0 with ttyS0, unless you have a system with udev rules -+ that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1 -+ instead because it will always be correct. -+ -+ If cmdline.txt uses the alias serial0 to refer to the user-accessable port -+ then the firmware will replace with the appropriate port whether or not -+ this overlay is used. -+*/ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&uart0>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart1>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins &bt_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&uart0_pins>; -+ __overlay__ { -+ brcm,pins; -+ brcm,function; -+ brcm,pull; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&uart1_pins>; -+ __overlay__ { -+ brcm,pins = <32 33>; -+ brcm,function = <2>; /* alt5=UART1 */ -+ brcm,pull = <0 2>; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/aliases"; -+ __overlay__ { -+ serial0 = "/soc/serial@7e201000"; -+ serial1 = "/soc/serial@7e215040"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..40a1f295346e39130a9d5a97844163c434b19e82 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts -@@ -0,0 +1,102 @@ -+/* -+ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen_pins: piscreen_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen: piscreen@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen_pins>; -+ -+ spi-max-frequency = <24000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c2 0x44 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 -+ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x1000011 -+ 0x1000029>; -+ }; -+ -+ piscreen_ts: piscreen-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen>,"spi-max-frequency:0"; -+ rotate = <&piscreen>,"rotate:0"; -+ fps = <&piscreen>,"fps:0"; -+ debug = <&piscreen>,"debug:0"; -+ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9c0bed893057b9129c8f16b0b695b85b1f634597 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -@@ -0,0 +1,106 @@ -+ /* -+ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen2_pins: piscreen2_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen2: piscreen2@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen2_pins>; -+ bgr; -+ spi-max-frequency = <64000000>; -+ rotate = <90>; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ txbuflen = <32768>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c0 0x11 0x09 -+ 0x10000c1 0x41 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000b6 0x00 0x02 -+ 0x10000f7 0xa9 0x51 0x2c 0x2 -+ 0x10000be 0x00 0x04 -+ 0x10000e9 0x00 -+ 0x1000011 -+ 0x1000029>; -+ -+ }; -+ -+ piscreen2_ts: piscreen2-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen2>,"spi-max-frequency:0"; -+ rotate = <&piscreen2>,"rotate:0"; -+ fps = <&piscreen2>,"fps:0"; -+ debug = <&piscreen2>,"debug:0"; -+ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7cdfc29ba4fbffd3216376677922e7ae26019055 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts -@@ -0,0 +1,114 @@ -+/* -+ * pisound Linux kernel module. -+ * Copyright (C) 2016 Vilniaus Blokas UAB, http://blokas.io/pisound -+ * -+ * 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; version 2 of the -+ * License. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+#include -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "blokaslabs,pisound"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ -+ pinctrl-0 = <&pisound_button_pins>; -+ -+ osr-gpios = -+ <&gpio 13 GPIO_ACTIVE_HIGH>, -+ <&gpio 26 GPIO_ACTIVE_HIGH>, -+ <&gpio 16 GPIO_ACTIVE_HIGH>; -+ -+ reset-gpios = -+ <&gpio 12 GPIO_ACTIVE_HIGH>, -+ <&gpio 24 GPIO_ACTIVE_HIGH>; -+ -+ data_available-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; -+ -+ button-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pisound_button_pins>; -+ -+ pisound_button_pins: pisound_button_pins { -+ brcm,pins = <17>; -+ brcm,function = <0>; // Input -+ brcm,pull = <2>; // Pull-Up -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pisound_spi: pisound_spi@0{ -+ compatible = "blokaslabs,pisound-spi"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; -+ spi-max-frequency = <1000000>; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft22-overlay.dts b/arch/arm/boot/dts/overlays/pitft22-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..894ba2292f6be76356f3ab39376d84ebd72fa29d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts -@@ -0,0 +1,69 @@ -+/* -+ * Device Tree overlay for pitft by Adafruit -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <25>; -+ brcm,function = <1>; /* out */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..5c0752655c70692e1c63f2f662e5b541c4be3617 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -@@ -0,0 +1,91 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c1>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ft6236: ft6236@38 { -+ compatible = "focaltech,ft6236"; -+ reg = <0x38>; -+ -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; -+ touchscreen-size-x = <240>; -+ touchscreen-size-y = <320>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ touch-sizex = <&ft6236>,"touchscreen-size-x?"; -+ touch-sizey = <&ft6236>,"touchscreen-size-y?"; -+ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; -+ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; -+ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ed2afc2f7fd6528f4e6d75bb2d534307ed020720 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts -@@ -0,0 +1,121 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; -+ -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target-path = "/soc"; -+ __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..25cb5cc9576dadc3539f4ea3c9507c592ccac9d6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts -@@ -0,0 +1,121 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 3.5" resistive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "himax,hx8357d"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; -+ -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target-path = "/soc"; -+ __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..50143a4bb215807ba0a0d0562f5827fa29a04de4 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts -@@ -0,0 +1,35 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ pps: pps { -+ compatible = "pps-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pps_pins>; -+ gpios = <&gpio 18 0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pps_pins: pps_pins { -+ brcm,pins = <18>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&pps>,"gpios:4", -+ <&pps_pins>,"brcm,pins:0"; -+ assert_falling_edge = <&pps>,"assert-falling-edge?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..abdeddd0f2c873e2b1fffcf6f2b838ee0123768f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts -@@ -0,0 +1,47 @@ -+/dts-v1/; -+/plugin/; -+ -+/* -+This is the 2-channel overlay - only use it if you need both channels. -+ -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ -+ -+/ { -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18 19>; -+ brcm,function = <2 2>; /* Alt5 */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&pwm>; -+ frag1: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ assigned-clock-rates = <100000000>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ pin2 = <&pwm_pins>,"brcm,pins:4"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ func2 = <&pwm_pins>,"brcm,function:4"; -+ clock = <&frag1>,"assigned-clock-rates:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..27809e8dc74660a8e922a1aff1bb2ca7186e411c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts -@@ -0,0 +1,43 @@ -+/dts-v1/; -+/plugin/; -+ -+/* -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ -+ -+/ { -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18>; -+ brcm,function = <2>; /* Alt5 */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&pwm>; -+ frag1: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ assigned-clock-rates = <100000000>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ clock = <&frag1>,"assigned-clock-rates:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/qca7000-overlay.dts b/arch/arm/boot/dts/overlays/qca7000-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..b4e601396c4955b9e5de3a639d9afd74d051e3fd ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts -@@ -0,0 +1,52 @@ -+// Overlay for the Qualcomm Atheros QCA7000 on I2SE's PLC Stamp micro EVK -+// Visit: https://www.i2se.com/product/plc-stamp-micro-evk for details -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ spidev@0 { -+ status = "disabled"; -+ }; -+ -+ eth1: qca7000@0 { -+ compatible = "qca,qca7000"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <23 0x1>; /* rising edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <23>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <ð1>, "interrupts:0", -+ <ð1_pins>, "brcm,pins:0"; -+ speed = <ð1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2fac57ca179fcf114655ea91dbef419c16aceb79 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts -@@ -0,0 +1,45 @@ -+// Definitions for RaspiDACv3 -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ -+ tpa6130a2: tpa6130a2@60 { -+ compatible = "ti,tpa6130a2"; -+ reg = <0x60>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "jg,raspidacv3"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..c021d02bb75ff5ceb5c5066d00e4bca942554032 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -@@ -0,0 +1,21 @@ -+/* -+ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display -+ * backlight controller -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ rpi_backlight: rpi_backlight { -+ compatible = "raspberrypi,rpi-backlight"; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..a442c8f0ec01b7503f32e070683a984e895f5668 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for RPi DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ pcm1794a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm1794a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rpi,rpi-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d7e72eef594e08b309ffbaa04f43c68909c08f36 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts -@@ -0,0 +1,89 @@ -+/* -+ * Device Tree overlay for rpi-display by Watterott -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ rpi_display_pins: rpi_display_pins { -+ brcm,pins = <18 23 24 25>; -+ brcm,function = <1 1 1 0>; /* out out out in */ -+ brcm,pull = <0 0 0 2>; /* - - - up */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ rpidisplay: rpi-display@0{ -+ compatible = "ilitek,ili9341"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rpi_display_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 23 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ rpidisplay_ts: rpi-display-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <25 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 25 0>; -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&rpidisplay>,"spi-max-frequency:0"; -+ rotate = <&rpidisplay>,"rotate:0"; -+ fps = <&rpidisplay>,"fps:0"; -+ debug = <&rpidisplay>,"debug:0"; -+ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; -+ swapxy = <&rpidisplay_ts>,"ti,swap-xy?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2e53a17491706bdb6245426b548a54960a40966f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts -@@ -0,0 +1,17 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ rpi_ft5406: rpi_ft5406 { -+ compatible = "rpi,rpi-ft5406"; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8332d0159a45b29952d0ad1a8fda339d4fdbee3e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for Rpi-Proto -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8731@1a { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8731"; -+ reg = <0x1a>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rpi,rpi-proto"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..27153240e1be595ae07c7ec74db1615532904140 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts -@@ -0,0 +1,47 @@ -+// rpi-sense HAT -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ rpi-sense@46 { -+ compatible = "rpi,rpi-sense"; -+ reg = <0x46>; -+ keys-int-gpios = <&gpio 23 1>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-magn@1c { -+ compatible = "st,lsm9ds1-magn"; -+ reg = <0x1c>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-accel6a { -+ compatible = "st,lsm9ds1-accel"; -+ reg = <0x6a>; -+ status = "okay"; -+ }; -+ -+ lps25h-press@5c { -+ compatible = "st,lps25h-press"; -+ reg = <0x5c>; -+ status = "okay"; -+ }; -+ -+ hts221-humid@5f { -+ compatible = "st,hts221-humid"; -+ reg = <0x5f>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..16b1247bfa618ff85936ddf78c3aea58075eaa67 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts -@@ -0,0 +1,81 @@ -+// Definitions for RRA DigiDAC1 Audio card -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ aliases { -+ ldo0 = &ldo0; -+ ldo1 = &ldo1; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/soc"; -+ __overlay__ { -+ -+ ldo1: ldo1 { -+ compatible = "regulator-fixed"; -+ regulator-name = "DC_5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-always-on; -+ }; -+ -+ ldo0: ldo0 { -+ compatible = "regulator-fixed"; -+ regulator-name = "DC_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ PVDD-supply = <&ldo0>; -+ DVDD-supply = <&ldo0>; -+ }; -+ -+ wm8742: wm8741@1a { -+ compatible = "wlf,wm8741"; -+ reg = <0x1a>; -+ status = "okay"; -+ AVDD-supply = <&ldo1>; -+ DVDD-supply = <&ldo0>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rra,digidac1-soundcard"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..339d0d17c01ff182edd0871de9dc4ea744917ad4 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts -@@ -0,0 +1,37 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ sc16is750: sc16is750@48 { -+ compatible = "nxp,sc16is750"; -+ reg = <0x48>; /* address */ -+ clocks = <&sc16is750_clk>; -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; /* IRQ_TYPE_EDGE_FALLING */ -+ #gpio-cells = <2>; -+ -+ sc16is750_clk: sc16is750_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <14745600>; -+ }; -+ }; -+ }; -+ }; -+ -+ -+ __overrides__ { -+ int_pin = <&sc16is750>,"interrupts:0"; -+ addr = <&sc16is750>,"reg:0"; -+ }; -+ -+}; -diff --git a/arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts b/arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d0a9e82dbea143e80249064873d8b9f0b56b2eaa ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts -@@ -0,0 +1,61 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>; -+ status = "okay"; -+ -+ sc16is752: sc16is752@0 { -+ compatible = "nxp,sc16is752"; -+ reg = <0>; /* CE0 */ -+ clocks = <&sc16is752_clk>; -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; /* IRQ_TYPE_EDGE_FALLING */ -+ #gpio-controller; -+ #gpio-cells = <2>; -+ spi-max-frequency = <4000000>; -+ -+ sc16is752_clk: sc16is752_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <14745600>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <&sc16is752>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..a431177a1c9d320d5432ea448ad4d0f696c34525 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -0,0 +1,32 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&sdhost>; -+ frag0: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ brcm,debug-flags = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&mmc>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..46d453859b31f5c700a8a2e39a2c209330bc108f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts -@@ -0,0 +1,36 @@ -+/* Enable 1-bit SDIO from MMC interface via GPIOs 22-25. Includes sdhost overlay. */ -+ -+/include/ "sdhost-overlay.dts" -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@3 { -+ target = <&mmc>; -+ sdio_mmc: __overlay__ { -+ compatible = "brcm,bcm2835-mmc"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <1>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&gpio>; -+ __overlay__ { -+ sdio_pins: sdio_pins { -+ brcm,pins = <22 23 24 25>; -+ brcm,function = <7 7 7 7>; /* ALT3 = SD1 */ -+ brcm,pull = <0 2 2 2>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ poll_once = <&sdio_mmc>,"non-removable?"; -+ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..398bd812c716c9e472fbac5aba4fe882114c65d1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -0,0 +1,36 @@ -+/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ -+ -+/include/ "sdhost-overlay.dts" -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@3 { -+ target = <&mmc>; -+ sdio_mmc: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <4>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&gpio>; -+ __overlay__ { -+ sdio_pins: sdio_pins { -+ brcm,pins = <22 23 24 25 26 27>; -+ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ -+ brcm,pull = <0 2 2 2 2 2>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ poll_once = <&sdio_mmc>,"non-removable?"; -+ bus_width = <&sdio_mmc>,"bus-width:0"; -+ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e4a4677f6b20da6b51751e9675c1c276ca4d2051 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -0,0 +1,23 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&sdhost>; -+ frag0: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ }; -+ }; -+ -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..b610d828360810e80133850adf7b459c66b3ed5d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -@@ -0,0 +1,18 @@ -+// Description: Overlay to enable character device interface for SMI. -+// Author: Luke Wren -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ fragment@0 { -+ target = <&soc>; -+ __overlay__ { -+ smi_dev { -+ compatible = "brcm,bcm2835-smi-dev"; -+ smi_handle = <&smi>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..13ce0b7cfb242df1019f91ed2fc03f514927c3e7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts -@@ -0,0 +1,69 @@ -+// Description: Overlay to enable NAND flash through -+// the secondary memory interface -+// Author: Luke Wren -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&smi>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&soc>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ nand: flash@0 { -+ compatible = "brcm,bcm2835-smi-nand"; -+ smi_handle = <&smi>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ status = "okay"; -+ -+ partition@0 { -+ label = "stage2"; -+ // 128k -+ reg = <0 0x20000>; -+ read-only; -+ }; -+ partition@1 { -+ label = "firmware"; -+ // 16M -+ reg = <0x20000 0x1000000>; -+ read-only; -+ }; -+ partition@2 { -+ label = "root"; -+ // 2G (will need to use 64 bit for >=4G) -+ reg = <0x1020000 0x80000000>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ smi_pins: smi_pins { -+ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 -+ 12 13 14 15>; -+ /* Alt 1: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..095f52c355fd6382233d8a471c3590a4275d6c75 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-overlay.dts -@@ -0,0 +1,37 @@ -+// Description: Overlay to enable the secondary memory interface peripheral -+// Author: Luke Wren -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&smi>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ smi_pins: smi_pins { -+ /* Don't configure the top two address bits, as -+ these are already used as ID_SD and ID_SC */ -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 -+ 16 17 18 19 20 21 22 23 24 25>; -+ /* Alt 0: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 -+ 0 0 0 0 0 0 0>; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..49803b309f8643385a3c97f6cdd2015f863d2d34 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -@@ -0,0 +1,31 @@ -+/* -+ * Device tree overlay to move spi0 to gpio 35 to 39 on CM -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi0_cs_pins>; -+ __overlay__ { -+ brcm,pins = <36 35>; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0_pins>; -+ __overlay__ { -+ brcm,pins = <37 38 39>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi-rtc-overlay.dts b/arch/arm/boot/dts/overlays/spi-rtc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..88d1800d63c9f6727b46d4e590c8e96c671c3755 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi-rtc-overlay.dts -@@ -0,0 +1,33 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spidev0>; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi0>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ rtc-pcf2123@0 { -+ compatible = "nxp,rtc-pcf2123"; -+ spi-max-frequency = <5000000>; -+ spi-cs-high = <1>; -+ reg = <0>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ pcf2123 = <0>, "=0=1"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts b/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ef9845f7184ee1ea90e8bdc23493b1cbbdc21896 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts -@@ -0,0 +1,26 @@ -+/* -+ * Device tree overlay to re-enable hardware CS for SPI0 -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ cs-gpios = <0>, <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi0_cs_pins>; -+ __overlay__ { -+ brcm,pins = <8 7>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..71c243947004fa887998065df9c259b50edfa428 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2ae0885cf1e7fb7420f65e538310ab1addafbece ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8f79044cd8f47ea055394822cc380497c985c7e5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17 16>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ cs2_spidev = <&spidev1_2>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..6f57bc710fe123028a5a216063733f0cea9bbd54 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d090631d36821b0c89833b9f217216f0b134a8f3 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e2586728c311829462f6a4b3b348e35603f033ce ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44 45>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ cs2_spidev = <&spidev2_2>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ed2b053aef23e0b1b34d8d3cb888b2b196758f59 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts -@@ -0,0 +1,224 @@ -+/* -+ * tinylcd35-overlay.dts -+ * -+ * ------------------------------------------------- -+ * www.tinlylcd.com -+ * ------------------------------------------------- -+ * Device---Driver-----BUS GPIO's -+ * display tinylcd35 spi0.0 25 24 18 -+ * touch ads7846 spi0.1 5 -+ * rtc ds1307 i2c1-0068 -+ * rtc pcf8563 i2c1-0051 -+ * keypad gpio-keys --------- 17 22 27 23 28 -+ * -+ * -+ * TinyLCD.com 3.5 inch TFT -+ * -+ * Version 001 -+ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework -+ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ tinylcd35_pins: tinylcd35_pins { -+ brcm,pins = <25 24 18>; -+ brcm,function = <1>; /* out */ -+ }; -+ tinylcd35_ts_pins: tinylcd35_ts_pins { -+ brcm,pins = <5>; -+ brcm,function = <0>; /* in */ -+ }; -+ keypad_pins: keypad_pins { -+ brcm,pins = <4 17 22 23 27>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <1>; /* down */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ tinylcd35: tinylcd35@0{ -+ compatible = "neosec,tinylcd"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&tinylcd35_pins>, -+ <&tinylcd35_ts_pins>; -+ -+ spi-max-frequency = <48000000>; -+ rotate = <270>; -+ fps = <20>; -+ bgr; -+ buswidth = <8>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ -+ init = <0x10000B0 0x80 -+ 0x10000C0 0x0A 0x0A -+ 0x10000C1 0x01 0x01 -+ 0x10000C2 0x33 -+ 0x10000C5 0x00 0x42 0x80 -+ 0x10000B1 0xD0 0x11 -+ 0x10000B4 0x02 -+ 0x10000B6 0x00 0x22 0x3B -+ 0x10000B7 0x07 -+ 0x1000036 0x58 -+ 0x10000F0 0x36 0xA5 0xD3 -+ 0x10000E5 0x80 -+ 0x10000E5 0x01 -+ 0x10000B3 0x00 -+ 0x10000E5 0x00 -+ 0x10000F0 0x36 0xA5 0x53 -+ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 -+ 0x100003A 0x55 -+ 0x1000011 -+ 0x2000001 -+ 0x1000029>; -+ }; -+ -+ tinylcd35_ts: tinylcd35_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <5 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 5 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ -+ /* RTC */ -+ -+ fragment@5 { -+ target = <&i2c1>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&i2c1>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ /* -+ * Values for input event code is found under the -+ * 'Keys and buttons' heading in include/uapi/linux/input.h -+ */ -+ fragment@7 { -+ target-path = "/soc"; -+ __overlay__ { -+ keypad: keypad { -+ compatible = "gpio-keys"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&keypad_pins>; -+ status = "disabled"; -+ autorepeat; -+ -+ button@17 { -+ label = "GPIO KEY_UP"; -+ linux,code = <103>; -+ gpios = <&gpio 17 0>; -+ }; -+ button@22 { -+ label = "GPIO KEY_DOWN"; -+ linux,code = <108>; -+ gpios = <&gpio 22 0>; -+ }; -+ button@27 { -+ label = "GPIO KEY_LEFT"; -+ linux,code = <105>; -+ gpios = <&gpio 27 0>; -+ }; -+ button@23 { -+ label = "GPIO KEY_RIGHT"; -+ linux,code = <106>; -+ gpios = <&gpio 23 0>; -+ }; -+ button@4 { -+ label = "GPIO KEY_ENTER"; -+ linux,code = <28>; -+ gpios = <&gpio 4 0>; -+ }; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&tinylcd35>,"spi-max-frequency:0"; -+ rotate = <&tinylcd35>,"rotate:0"; -+ fps = <&tinylcd35>,"fps:0"; -+ debug = <&tinylcd35>,"debug:0"; -+ touch = <&tinylcd35_ts>,"status"; -+ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", -+ <&tinylcd35_ts>,"interrupts:0", -+ <&tinylcd35_ts>,"pendown-gpio:4"; -+ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; -+ rtc-pcf = <0>,"=5"; -+ rtc-ds = <0>,"=6"; -+ keypad = <&keypad>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..fa73e1feaeb1bf53a6755e81a998e71cd8c7eda9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts -@@ -0,0 +1,38 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&uart1>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ uart1_pins: uart1_pins { -+ brcm,pins = <14 15>; -+ brcm,function = <2>; /* alt5 */ -+ brcm,pull = <0 2>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "8250.nr_uarts=1"; -+ }; -+ }; -+ -+ __overrides__ { -+ txd1_pin = <&uart1_pins>,"brcm,pins:0"; -+ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..95a595a35cb4fbb707bf4b18161f6a46860aa4ae ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -@@ -0,0 +1,89 @@ -+/* -+ * vc4-fkms-v3d-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "cma=256M@256M"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=192M@256M"; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=128M@128M"; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=96M@128M"; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=64M@64M"; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&fb>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&firmwarekms>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@7 { -+ target = <&v3d>; -+ __overlay__ { -+ interrupts = <1 10>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@8 { -+ target = <&gpu>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@9 { -+ target-path = "/soc/dma"; -+ __overlay__ { -+ brcm,dma-channel-mask = <0x7f35>; -+ }; -+ }; -+ -+ __overrides__ { -+ cma-256 = <0>,"+0-1-2-3-4"; -+ cma-192 = <0>,"-0+1-2-3-4"; -+ cma-128 = <0>,"-0-1+2-3-4"; -+ cma-96 = <0>,"-0-1-2+3-4"; -+ cma-64 = <0>,"-0-1-2-3+4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..4f1cc20f90dc6780f74e08ebee00e5a1a6062c85 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -@@ -0,0 +1,136 @@ -+/* -+ * vc4-kms-v3d-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "cma=256M@256M"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=192M@256M"; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=128M@128M"; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=96M@128M"; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=64M@64M"; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&i2c2>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&cprman>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@7 { -+ target = <&fb>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@8 { -+ target = <&pixelvalve0>; -+ __overlay__ { -+ interrupts = <2 13>; /* pwa0 */ -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@9 { -+ target = <&pixelvalve1>; -+ __overlay__ { -+ interrupts = <2 14>; /* pwa1 */ -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@10 { -+ target = <&pixelvalve2>; -+ __overlay__ { -+ interrupts = <2 10>; /* pixelvalve */ -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@11 { -+ target = <&hvs>; -+ __overlay__ { -+ interrupts = <2 1>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@12 { -+ target = <&hdmi>; -+ __overlay__ { -+ interrupts = <2 8>, <2 9>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@13 { -+ target = <&v3d>; -+ __overlay__ { -+ interrupts = <1 10>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@14 { -+ target = <&gpu>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@15 { -+ target-path = "/soc/dma"; -+ __overlay__ { -+ brcm,dma-channel-mask = <0x7f35>; -+ }; -+ }; -+ -+ __overrides__ { -+ cma-256 = <0>,"+0-1-2-3-4"; -+ cma-192 = <0>,"-0+1-2-3-4"; -+ cma-128 = <0>,"-0-1+2-3-4"; -+ cma-96 = <0>,"-0-1-2+3-4"; -+ cma-64 = <0>,"-0-1-2-3+4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7fcab963eb4aed4b9edea94c9e60deb7650e0eb5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts -@@ -0,0 +1,30 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ // There is no VGA driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vga666_pins>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ vga666_pins: vga666_pins { -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 -+ 13 14 15 16 17 18 19 20 21>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..29a3b48d19ab36b814c09e4cc4eef6d9e2022da1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for w1-gpio module (without external pullup) -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ -+ w1: onewire@0 { -+ compatible = "w1-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>; -+ rpi,parasitic-power = <0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in (initially) -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..66a98f6c9601f51483f27803995bec772bb3350e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts -@@ -0,0 +1,41 @@ -+// Definitions for w1-gpio module (with external pullup) -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ -+ w1: onewire@0 { -+ compatible = "w1-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>, <&gpio 5 1>; -+ rpi,parasitic-power = <0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4 5>; -+ brcm,function = <0 1>; // in out -+ brcm,pull = <0 0>; // off off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ extpullup = <&w1>,"gpios:16", -+ <&w1_pins>,"brcm,pins:4"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8498134fdbb3912e9ce18282b53084d871a82370 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts -@@ -0,0 +1,44 @@ -+/* -+ * Device Tree overlay for Witty Pi extension board by UUGear -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ compatible = "gpio-leds"; -+ wittypi_led: wittypi_led { -+ label = "wittypi_led"; -+ linux,default-trigger = "default-on"; -+ gpios = <&gpio 17 0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ rtc: ds1337@68 { -+ compatible = "dallas,ds1337"; -+ reg = <0x68>; -+ wakeup-source; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ led_gpio = <&wittypi_led>,"gpios:4"; -+ led_trigger = <&wittypi_led>,"linux,default-trigger"; -+ }; -+ -+}; -diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst -index a1be75d0a5fd3fbf4742e555046896ea6fa6fe65..ad8dc1c93d04bc929b551c5a47f67d244116c7e7 100644 ---- a/scripts/Makefile.dtbinst -+++ b/scripts/Makefile.dtbinst -@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") - endif - - dtbinst-files := $(dtb-y) -+dtboinst-files := $(dtbo-y) - dtbinst-dirs := $(dts-dirs) - - # Helper targets for Installing DTBs into the boot directory -@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< - - install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) - --$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep -+$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep - - $(dtbinst-files): %.dtb: $(obj)/%.dtb - $(call cmd,dtb_install,$(install-dir)) - -+$(dtboinst-files): %.dtbo: $(obj)/%.dtbo -+ $(call cmd,dtb_install,$(install-dir)) -+ - $(dtbinst-dirs): - $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ - --PHONY += $(dtbinst-files) $(dtbinst-dirs) --__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) -+PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) -+__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) - - .PHONY: $(PHONY) -diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib -index 0a07f9014944ed92a8e2e42983ae43be60b3e471..1967878a843461c3ff1f473b9a030eb01b7c726e 100644 ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -312,6 +312,17 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ - $(obj)/%.dtb: $(src)/%.dts FORCE - $(call if_changed_dep,dtc) - -+quiet_cmd_dtco = DTCO $@ -+cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ -+ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ -+ $(DTC) -@ -H epapr -O dtb -o $@ -b 0 \ -+ -i $(dir $<) $(DTC_FLAGS) \ -+ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ -+ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) -+ -+$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE -+ $(call if_changed_dep,dtco) -+ - dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) - - # Bzip2 - -From 52e8a3802aa8428a69561607209bfe9b98cabde6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 055/122] BCM270x_DT: Add pwr_led, and the required "input" - trigger - -The "input" trigger makes the associated GPIO an input. This is to support -the Raspberry Pi PWR LED, which is driven by external hardware in normal use. - -N.B. pwr_led is not available on Model A or B boards. - -leds-gpio: Implement the brightness_get method - -The power LED uses some clever logic that means it is driven -by a voltage measuring circuit when configured as input, otherwise -it is driven by the GPIO output value. This patch wires up the -brightness_get method for leds-gpio so that user-space can monitor -the LED value via /sys/class/gpio/led1/brightness. Using the input -trigger this returns an indication of the system power health, -otherwise it is just whatever value the trigger has written most -recently. - -See: https://github.com/raspberrypi/linux/issues/1064 ---- - drivers/leds/leds-gpio.c | 18 +++++++++++- - drivers/leds/trigger/Kconfig | 7 +++++ - drivers/leds/trigger/Makefile | 1 + - drivers/leds/trigger/ledtrig-input.c | 54 ++++++++++++++++++++++++++++++++++++ - include/linux/leds.h | 3 ++ - 5 files changed, 82 insertions(+), 1 deletion(-) - create mode 100644 drivers/leds/trigger/ledtrig-input.c - -diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c -index d400dcaf4d296444967065e98812c210c48a192d..6a27a693034825de2897bb7b338b60cc10c9e59f 100644 ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -50,8 +50,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, - led_dat->platform_gpio_blink_set(led_dat->gpiod, level, - NULL, NULL); - led_dat->blinking = 0; -+ } else if (led_dat->cdev.flags & SET_GPIO_INPUT) { -+ gpiod_direction_input(led_dat->gpiod); -+ led_dat->cdev.flags &= ~SET_GPIO_INPUT; -+ } else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { -+ gpiod_direction_output(led_dat->gpiod, level); -+ led_dat->cdev.flags &= ~SET_GPIO_OUTPUT; - } else { -- if (led_dat->can_sleep) -+ if (led_dat->can_sleep || -+ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) - gpiod_set_value_cansleep(led_dat->gpiod, level); - else - gpiod_set_value(led_dat->gpiod, level); -@@ -65,6 +72,13 @@ static int gpio_led_set_blocking(struct led_classdev *led_cdev, - return 0; - } - -+static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) -+{ -+ struct gpio_led_data *led_dat = -+ container_of(led_cdev, struct gpio_led_data, cdev); -+ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; -+} -+ - static int gpio_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, unsigned long *delay_off) - { -@@ -122,6 +136,8 @@ static int create_gpio_led(const struct gpio_led *template, - led_dat->platform_gpio_blink_set = blink_set; - led_dat->cdev.blink_set = gpio_blink_set; - } -+ led_dat->cdev.brightness_set = gpio_led_set; -+ led_dat->cdev.brightness_get = gpio_led_get; - if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) { - state = gpiod_get_value_cansleep(led_dat->gpiod); - if (state < 0) -diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig -index 3f9ddb9fafa77f1f1fe5535c5e947838761e4f35..c1b6c83f3b63f993452893f136c5da54d0ada8e7 100644 ---- a/drivers/leds/trigger/Kconfig -+++ b/drivers/leds/trigger/Kconfig -@@ -116,6 +116,13 @@ config LEDS_TRIGGER_CAMERA - This enables direct flash/torch on/off by the driver, kernel space. - If unsure, say Y. - -+config LEDS_TRIGGER_INPUT -+ tristate "LED Input Trigger" -+ depends on LEDS_TRIGGERS -+ help -+ This allows the GPIOs assigned to be LEDs to be initialised to inputs. -+ If unsure, say Y. -+ - config LEDS_TRIGGER_PANIC - bool "LED Panic Trigger" - depends on LEDS_TRIGGERS -diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile -index a72c43cffebf43bc7ebfd1eb1103b9ccff73d075..51b90c46890872fd1b148ec748edce0e0ce8fee1 100644 ---- a/drivers/leds/trigger/Makefile -+++ b/drivers/leds/trigger/Makefile -@@ -9,4 +9,5 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o - obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o - obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o - obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o -+obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o - obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o -diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c -new file mode 100644 -index 0000000000000000000000000000000000000000..27f8ebea43d86fc51c98db5c953da05bae063e3b ---- /dev/null -+++ b/drivers/leds/trigger/ledtrig-input.c -@@ -0,0 +1,54 @@ -+/* -+ * Set LED GPIO to Input "Trigger" -+ * -+ * Copyright 2015 Phil Elwell -+ * -+ * Based on Nick Forbes's ledtrig-default-on.c. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include "../leds.h" -+ -+static void input_trig_activate(struct led_classdev *led_cdev) -+{ -+ led_cdev->flags |= SET_GPIO_INPUT; -+ led_set_brightness(led_cdev, 0); -+} -+ -+static void input_trig_deactivate(struct led_classdev *led_cdev) -+{ -+ led_cdev->flags |= SET_GPIO_OUTPUT; -+ led_set_brightness(led_cdev, 0); -+} -+ -+static struct led_trigger input_led_trigger = { -+ .name = "input", -+ .activate = input_trig_activate, -+ .deactivate = input_trig_deactivate, -+}; -+ -+static int __init input_trig_init(void) -+{ -+ return led_trigger_register(&input_led_trigger); -+} -+ -+static void __exit input_trig_exit(void) -+{ -+ led_trigger_unregister(&input_led_trigger); -+} -+ -+module_init(input_trig_init); -+module_exit(input_trig_exit); -+ -+MODULE_AUTHOR("Phil Elwell "); -+MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); -+MODULE_LICENSE("GPL"); -diff --git a/include/linux/leds.h b/include/linux/leds.h -index ddfcb2df3656cf0ab6aebd1fa3d624a6ec2e94e9..271563eb835f9018712e2076a88f341d2d6db7db 100644 ---- a/include/linux/leds.h -+++ b/include/linux/leds.h -@@ -52,6 +52,9 @@ struct led_classdev { - #define LED_DEV_CAP_FLASH (1 << 24) - #define LED_HW_PLUGGABLE (1 << 25) - #define LED_PANIC_INDICATOR (1 << 26) -+ /* Additions for Raspberry Pi PWR LED */ -+#define SET_GPIO_INPUT (1 << 30) -+#define SET_GPIO_OUTPUT (1 << 31) - - /* Set LED brightness level - * Must not sleep. Use brightness_set_blocking for drivers - -From e958cbc43c1add6076ea3ed0aa17365335774024 Mon Sep 17 00:00:00 2001 -From: Siarhei Siamashka -Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 056/122] fbdev: add FBIOCOPYAREA ioctl - -Based on the patch authored by Ali Gholami Rudi at - https://lkml.org/lkml/2009/7/13/153 - -Provide an ioctl for userspace applications, but only if this operation -is hardware accelerated (otherwide it does not make any sense). - -Signed-off-by: Siarhei Siamashka - -bcm2708_fb: Add ioctl for reading gpu memory through dma ---- - drivers/video/fbdev/bcm2708_fb.c | 109 +++++++++++++++++++++++++++++++++++++++ - drivers/video/fbdev/core/fbmem.c | 36 +++++++++++++ - include/uapi/linux/fb.h | 12 +++++ - 3 files changed, 157 insertions(+) - -diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c -index 37f60813fe1dd95d9f5f725c07ec2e75c09857bf..53c5a0bdadb4be9251affdabed66305842a08e72 100644 ---- a/drivers/video/fbdev/bcm2708_fb.c -+++ b/drivers/video/fbdev/bcm2708_fb.c -@@ -31,8 +31,10 @@ - #include - #include - #include -+#include - #include - #include -+#include - #include - - //#define BCM2708_FB_DEBUG -@@ -426,6 +428,110 @@ static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info - return result; - } - -+static void dma_memcpy(struct bcm2708_fb *fb, dma_addr_t dst, dma_addr_t src, int size) -+{ -+ int burst_size = (fb->dma_chan == 0) ? 8 : 2; -+ struct bcm2708_dma_cb *cb = fb->cb_base; -+ -+ cb->info = BCM2708_DMA_BURST(burst_size) | BCM2708_DMA_S_WIDTH | -+ BCM2708_DMA_S_INC | BCM2708_DMA_D_WIDTH | -+ BCM2708_DMA_D_INC; -+ cb->dst = dst; -+ cb->src = src; -+ cb->length = size; -+ cb->stride = 0; -+ cb->pad[0] = 0; -+ cb->pad[1] = 0; -+ cb->next = 0; -+ -+ if (size < dma_busy_wait_threshold) { -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ bcm_dma_wait_idle(fb->dma_chan_base); -+ } else { -+ void __iomem *dma_chan = fb->dma_chan_base; -+ cb->info |= BCM2708_DMA_INT_EN; -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ while (bcm_dma_is_busy(dma_chan)) { -+ wait_event_interruptible( -+ fb->dma_waitq, -+ !bcm_dma_is_busy(dma_chan)); -+ } -+ fb->stats.dma_irqs++; -+ } -+ fb->stats.dma_copies++; -+} -+ -+#define INTALIAS_NORMAL(x) ((x)&~0xc0000000) // address with no aliases -+#define INTALIAS_L1L2_NONALLOCATING(x) (((x)&~0xc0000000)|0x80000000) // cache coherent but non-allocating in L1 and L2 -+ -+static long vc_mem_copy(struct bcm2708_fb *fb, unsigned long arg) -+{ -+ struct fb_dmacopy ioparam; -+ size_t size = PAGE_SIZE; -+ u32 *buf = NULL; -+ dma_addr_t bus_addr; -+ long rc = 0; -+ size_t offset; -+ struct { u32 base, length; } gpu = {}; -+ -+ /* restrict this to root user */ -+ if (!uid_eq(current_euid(), GLOBAL_ROOT_UID)) -+ { -+ rc = -EFAULT; -+ goto out; -+ } -+ -+ /* Get the parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user\n", -+ __func__); -+ rc = -EFAULT; -+ goto out; -+ } -+ -+ rc = rpi_firmware_property(fb->fw, -+ RPI_FIRMWARE_GET_VC_MEMORY, -+ &gpu, sizeof(gpu)); -+ if (rc != 0 || gpu.base == 0 || gpu.length == 0) { -+ pr_err("[%s]: Unable to determine gpu memory %ld,%x,%x)\n", __func__, rc, gpu.base, gpu.length); -+ return -EFAULT; -+ } -+ -+ if (INTALIAS_NORMAL(ioparam.src) < gpu.base || INTALIAS_NORMAL(ioparam.src) >= gpu.base + gpu.length) { -+ pr_err("[%s]: Invalid memory access %x (%x-%x)", __func__, INTALIAS_NORMAL(ioparam.src), gpu.base, gpu.base + gpu.length); -+ return -EFAULT; -+ } -+ -+ buf = dma_alloc_coherent(fb->fb.device, PAGE_ALIGN(size), &bus_addr, -+ GFP_ATOMIC); -+ if (!buf) { -+ pr_err("[%s]: failed to dma_alloc_coherent(%d)\n", -+ __func__, size); -+ rc = -ENOMEM; -+ goto out; -+ } -+ -+ for (offset = 0; offset < ioparam.length; offset += size) { -+ size_t remaining = ioparam.length - offset; -+ size_t s = min(size, remaining); -+ unsigned char *p = (unsigned char *)ioparam.src + offset; -+ unsigned char *q = (unsigned char *)ioparam.dst + offset; -+ dma_memcpy(fb, bus_addr, INTALIAS_L1L2_NONALLOCATING((dma_addr_t)p), size); -+ if (copy_to_user(q, buf, s) != 0) { -+ pr_err("[%s]: failed to copy-to-user\n", -+ __func__); -+ rc = -EFAULT; -+ goto out; -+ } -+ } -+out: -+ if (buf) -+ dma_free_coherent(fb->fb.device, PAGE_ALIGN(size), buf, bus_addr); -+ return rc; -+} -+ - static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) - { - struct bcm2708_fb *fb = to_bcm2708(info); -@@ -438,6 +544,9 @@ static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long a - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, - &dummy, sizeof(dummy)); - break; -+ case FBIODMACOPY: -+ ret = vc_mem_copy(fb, arg); -+ break; - default: - dev_dbg(info->device, "Unknown ioctl 0x%x\n", cmd); - return -ENOTTY; -diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c -index 76c1ad96fb37d4f07bbde6462f54825f566acbac..7bf48e478c056fcd745026902961506d5826615d 100644 ---- a/drivers/video/fbdev/core/fbmem.c -+++ b/drivers/video/fbdev/core/fbmem.c -@@ -1084,6 +1084,31 @@ fb_blank(struct fb_info *info, int blank) - } - EXPORT_SYMBOL(fb_blank); - -+static int fb_copyarea_user(struct fb_info *info, -+ struct fb_copyarea *copy) -+{ -+ int ret = 0; -+ if (!lock_fb_info(info)) -+ return -ENODEV; -+ if (copy->dx >= info->var.xres || -+ copy->sx >= info->var.xres || -+ copy->width > info->var.xres || -+ copy->dy >= info->var.yres || -+ copy->sy >= info->var.yres || -+ copy->height > info->var.yres || -+ copy->dx + copy->width > info->var.xres || -+ copy->sx + copy->width > info->var.xres || -+ copy->dy + copy->height > info->var.yres || -+ copy->sy + copy->height > info->var.yres) { -+ ret = -EINVAL; -+ goto out; -+ } -+ info->fbops->fb_copyarea(info, copy); -+out: -+ unlock_fb_info(info); -+ return ret; -+} -+ - static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unsigned long arg) - { -@@ -1094,6 +1119,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - struct fb_cmap cmap_from; - struct fb_cmap_user cmap; - struct fb_event event; -+ struct fb_copyarea copy; - void __user *argp = (void __user *)arg; - long ret = 0; - -@@ -1211,6 +1237,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unlock_fb_info(info); - console_unlock(); - break; -+ case FBIOCOPYAREA: -+ if (info->flags & FBINFO_HWACCEL_COPYAREA) { -+ /* only provide this ioctl if it is accelerated */ -+ if (copy_from_user(©, argp, sizeof(copy))) -+ return -EFAULT; -+ ret = fb_copyarea_user(info, ©); -+ break; -+ } -+ /* fall through */ - default: - if (!lock_fb_info(info)) - return -ENODEV; -@@ -1365,6 +1400,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, - case FBIOPAN_DISPLAY: - case FBIOGET_CON2FBMAP: - case FBIOPUT_CON2FBMAP: -+ case FBIOCOPYAREA: - arg = (unsigned long) compat_ptr(arg); - case FBIOBLANK: - ret = do_fb_ioctl(info, cmd, arg); -diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h -index fb795c3b3c178ad3cd7c9e9e4547ffd492bac181..703fa8a70574323abe2fb32599254582cd5d891f 100644 ---- a/include/uapi/linux/fb.h -+++ b/include/uapi/linux/fb.h -@@ -34,6 +34,12 @@ - #define FBIOPUT_MODEINFO 0x4617 - #define FBIOGET_DISPINFO 0x4618 - #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) -+/* -+ * HACK: use 'z' in order not to clash with any other ioctl numbers which might -+ * be concurrently added to the mainline kernel -+ */ -+#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) -+#define FBIODMACOPY _IOW('z', 0x22, struct fb_dmacopy) - - #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ - #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -@@ -346,6 +352,12 @@ struct fb_copyarea { - __u32 sy; - }; - -+struct fb_dmacopy { -+ void *dst; -+ __u32 src; -+ __u32 length; -+}; -+ - struct fb_fillrect { - __u32 dx; /* screen-relative */ - __u32 dy; - -From cf7188188aabe5b8ae10cf449ea6c9b0c6c29c90 Mon Sep 17 00:00:00 2001 -From: Harm Hanemaaijer -Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 057/122] Speed up console framebuffer imageblit function - -Especially on platforms with a slower CPU but a relatively high -framebuffer fill bandwidth, like current ARM devices, the existing -console monochrome imageblit function used to draw console text is -suboptimal for common pixel depths such as 16bpp and 32bpp. The existing -code is quite general and can deal with several pixel depths. By creating -special case functions for 16bpp and 32bpp, by far the most common pixel -formats used on modern systems, a significant speed-up is attained -which can be readily felt on ARM-based devices like the Raspberry Pi -and the Allwinner platform, but should help any platform using the -fb layer. - -The special case functions allow constant folding, eliminating a number -of instructions including divide operations, and allow the use of an -unrolled loop, eliminating instructions with a variable shift size, -reducing source memory access instructions, and eliminating excessive -branching. These unrolled loops also allow much better code optimization -by the C compiler. The code that selects which optimized variant is used -is also simplified, eliminating integer divide instructions. - -The speed-up, measured by timing 'cat file.txt' in the console, varies -between 40% and 70%, when testing on the Raspberry Pi and Allwinner -ARM-based platforms, depending on font size and the pixel depth, with -the greater benefit for 32bpp. - -Signed-off-by: Harm Hanemaaijer ---- - drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- - 1 file changed, 147 insertions(+), 5 deletions(-) - -diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c -index a2bb276a8b2463eee98eb237c4647bc00cd93601..436494fba15abecb400ef28688466fafb10feb95 100644 ---- a/drivers/video/fbdev/core/cfbimgblt.c -+++ b/drivers/video/fbdev/core/cfbimgblt.c -@@ -28,6 +28,11 @@ - * - * Also need to add code to deal with cards endians that are different than - * the native cpu endians. I also need to deal with MSB position in the word. -+ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: -+ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are -+ * significantly faster than the previous implementation. -+ * - Simplify the fast/slow_imageblit selection code, avoiding integer -+ * divides. - */ - #include - #include -@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * - } - } - -+/* -+ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded -+ * into the code, main loop unrolled. -+ */ -+ -+static inline void fast_imageblit16(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; -+ -+ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; -+ -+ fgx <<= 16; -+ bgx <<= 16; -+ fgx |= fgcolor; -+ bgx |= bgcolor; -+ -+ eorx = fgx ^ bgx; -+ k = image->width / 2; -+ -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; -+ -+ j = k; -+ while (j >= 4) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 4; -+ } -+ if (j != 0) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j >= 2) { -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j == 3) { -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ } -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} -+ -+/* -+ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded -+ * into the code, main loop unrolled. -+ */ -+ -+static inline void fast_imageblit32(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; -+ -+ tab = cfb_tab32; -+ -+ eorx = fgx ^ bgx; -+ k = image->width; -+ -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; -+ -+ j = k; -+ while (j >= 8) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 6) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 5) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 3) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 1) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 8; -+ } -+ if (j != 0) { -+ u32 bits = (u32) * src; -+ while (j > 1) { -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ bits <<= 1; -+ j--; -+ } -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} -+ - void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - { - u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; -@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - bgcolor = image->bg_color; - } - -- if (32 % bpp == 0 && !start_index && !pitch_index && -- ((width & (32/bpp-1)) == 0) && -- bpp >= 8 && bpp <= 32) -- fast_imageblit(image, p, dst1, fgcolor, bgcolor); -- else -+ if (!start_index && !pitch_index) { -+ if (bpp == 32) -+ fast_imageblit32(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 16 && (width & 1) == 0) -+ fast_imageblit16(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 8 && (width & 3) == 0) -+ fast_imageblit(image, p, dst1, fgcolor, -+ bgcolor); -+ else -+ slow_imageblit(image, p, dst1, fgcolor, -+ bgcolor, -+ start_index, pitch_index); -+ } else - slow_imageblit(image, p, dst1, fgcolor, bgcolor, - start_index, pitch_index); - } else - -From 132a1f15dea64eef7dbf9cc5b98e1668cedb2eea Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 058/122] enabling the realtime clock 1-wire chip DS1307 and - 1-wire on GPIO4 (as a module) - -1-wire: Add support for configuring pin for w1-gpio kernel module -See: https://github.com/raspberrypi/linux/pull/457 - -Add bitbanging pullups, use them for w1-gpio - -Allows parasite power to work, uses module option pullup=1 - -bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter - -Signed-off-by: Alex J Lennon - -w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set - -Signed-off-by: Alex J Lennon - -w1-gpio: Sort out the pullup/parasitic power tangle ---- - drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- - drivers/w1/w1.h | 6 ++++ - drivers/w1/w1_int.c | 14 +++++++++ - drivers/w1/w1_io.c | 18 ++++++++++-- - include/linux/w1-gpio.h | 1 + - 5 files changed, 99 insertions(+), 9 deletions(-) - -diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c -index a373ae69d9f6ef8a5925dbd5004cd5e9b8fc5c05..080e5976e2a6b75965ed753ddf29648cb0b2f000 100644 ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c -@@ -23,6 +23,19 @@ - #include "../w1.h" - #include "../w1_int.h" - -+static int w1_gpio_pullup = 0; -+static int w1_gpio_pullup_orig = 0; -+module_param_named(pullup, w1_gpio_pullup, int, 0); -+MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); -+static int w1_gpio_pullup_pin = -1; -+static int w1_gpio_pullup_pin_orig = -1; -+module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); -+MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); -+static int w1_gpio_pin = -1; -+static int w1_gpio_pin_orig = -1; -+module_param_named(gpiopin, w1_gpio_pin, int, 0); -+MODULE_PARM_DESC(gpiopin, "GPIO pin number"); -+ - static u8 w1_gpio_set_pullup(void *data, int delay) - { - struct w1_gpio_platform_data *pdata = data; -@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) - return gpio_get_value(pdata->pin) ? 1 : 0; - } - -+static void w1_gpio_bitbang_pullup(void *data, u8 on) -+{ -+ struct w1_gpio_platform_data *pdata = data; -+ -+ if (on) -+ gpio_direction_output(pdata->pin, 1); -+ else -+ gpio_direction_input(pdata->pin); -+} -+ - #if defined(CONFIG_OF) - static const struct of_device_id w1_gpio_dt_ids[] = { - { .compatible = "w1-gpio" }, -@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct device_node *np = pdev->dev.of_node; - int gpio; -+ u32 value; - - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) -@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (of_get_property(np, "linux,open-drain", NULL)) - pdata->is_open_drain = 1; - -+ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) -+ pdata->parasitic_power = (value != 0); -+ - gpio = of_get_gpio(np, 0); - if (gpio < 0) { - if (gpio != -EPROBE_DEFER) -@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (gpio == -EPROBE_DEFER) - return gpio; - /* ignore other errors as the pullup gpio is optional */ -- pdata->ext_pullup_enable_pin = gpio; -+ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; - - pdev->dev.platform_data = pdata; - -@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - static int w1_gpio_probe(struct platform_device *pdev) - { - struct w1_bus_master *master; -- struct w1_gpio_platform_data *pdata; -+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; - int err; - -- if (of_have_populated_dt()) { -- err = w1_gpio_probe_dt(pdev); -- if (err < 0) -- return err; -+ if(pdata == NULL) { -+ if (of_have_populated_dt()) { -+ err = w1_gpio_probe_dt(pdev); -+ if (err < 0) -+ return err; -+ } - } - - pdata = dev_get_platdata(&pdev->dev); -@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) - return -ENOMEM; - } - -+ w1_gpio_pin_orig = pdata->pin; -+ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; -+ w1_gpio_pullup_orig = pdata->parasitic_power; -+ -+ if(gpio_is_valid(w1_gpio_pin)) { -+ pdata->pin = w1_gpio_pin; -+ pdata->ext_pullup_enable_pin = -1; -+ pdata->parasitic_power = -1; -+ } -+ pdata->parasitic_power |= w1_gpio_pullup; -+ if(gpio_is_valid(w1_gpio_pullup_pin)) { -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; -+ } -+ -+ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); -+ - err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); - if (err) { - dev_err(&pdev->dev, "gpio_request (pin) failed\n"); -@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) - master->set_pullup = w1_gpio_set_pullup; - } - -+ if (pdata->parasitic_power) { -+ if (pdata->is_open_drain) -+ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " -+ "option doesn't work with open drain GPIO\n"); -+ else -+ master->bitbang_pullup = w1_gpio_bitbang_pullup; -+ } -+ - err = w1_add_master_device(master); - if (err) { - dev_err(&pdev->dev, "w1_add_master device failed\n"); -@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) - - w1_remove_master_device(master); - -+ pdata->pin = w1_gpio_pin_orig; -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; -+ pdata->parasitic_power = w1_gpio_pullup_orig; -+ - return 0; - } - -diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h -index 129895f562b06630b464f2579dc9e5bdc105f35e..737a75b594c69716eae8d37479a40031b3045494 100644 ---- a/drivers/w1/w1.h -+++ b/drivers/w1/w1.h -@@ -173,6 +173,12 @@ struct w1_bus_master - - u8 (*set_pullup)(void *, int); - -+ /** -+ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. -+ * @return -1=Error, 0=completed -+ */ -+ void (*bitbang_pullup) (void *, u8); -+ - void (*search)(void *, struct w1_master *, - u8, w1_slave_found_callback); - }; -diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c -index 20f766afa4c7d7b8116565687541f84184fe61f4..c4fbdb1f25e961f9f7bacbac7b52a6d74cabaf12 100644 ---- a/drivers/w1/w1_int.c -+++ b/drivers/w1/w1_int.c -@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) - return(-EINVAL); - } - -+ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup -+ * and takes care of timing itself */ -+ if (!master->write_byte && !master->touch_bit && master->set_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup requires " -+ "write_byte or touch_bit, disabling\n"); -+ master->set_pullup = NULL; -+ } -+ -+ if (master->set_pullup && master->bitbang_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup should not " -+ "be set when bitbang_pullup is used, disabling\n"); -+ master->set_pullup = NULL; -+ } -+ - /* Lock until the device is added (or not) to w1_masters. */ - mutex_lock(&w1_mlock); - /* Search for the first available id (starting at 1). */ -diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c -index f4bc8c100a01b1f04a62ebca2528c51c05f40520..77527e37c7e749754cd3dc2241cdcb64f178166c 100644 ---- a/drivers/w1/w1_io.c -+++ b/drivers/w1/w1_io.c -@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) - static void w1_post_write(struct w1_master *dev) - { - if (dev->pullup_duration) { -- if (dev->enable_pullup && dev->bus_master->set_pullup) -- dev->bus_master->set_pullup(dev->bus_master->data, 0); -- else -+ if (dev->enable_pullup) { -+ if (dev->bus_master->set_pullup) { -+ dev->bus_master->set_pullup(dev-> -+ bus_master->data, -+ 0); -+ } else if (dev->bus_master->bitbang_pullup) { -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 1); -+ msleep(dev->pullup_duration); -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 0); -+ } -+ } else { - msleep(dev->pullup_duration); -+ } -+ - dev->pullup_duration = 0; - } - } -diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h -index d58594a3232492e33f1dd4babd3798b03e0f0203..feae94256256316fd9d850c3d83325af803fb2ce 100644 ---- a/include/linux/w1-gpio.h -+++ b/include/linux/w1-gpio.h -@@ -18,6 +18,7 @@ - struct w1_gpio_platform_data { - unsigned int pin; - unsigned int is_open_drain:1; -+ unsigned int parasitic_power:1; - void (*enable_external_pullup)(int enable); - unsigned int ext_pullup_enable_pin; - unsigned int pullup_duration; - -From 3a29fd5c4e71ff439e60097ca14a4d97c8c63f5f Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 059/122] config: Enable CONFIG_MEMCG, but leave it disabled - (due to memory cost). Enable with cgroup_enable=memory. - ---- - kernel/cgroup.c | 24 +++++++++++++++++++++++- - 1 file changed, 23 insertions(+), 1 deletion(-) - -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 85bc9beb046d9a6deda2e3564f4d5bd01d6fc27b..4acdbef46a8f0556469b5580a39c18ce0496c69d 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -5629,7 +5629,7 @@ int __init cgroup_init_early(void) - return 0; - } - --static u16 cgroup_disable_mask __initdata; -+static u16 cgroup_disable_mask __initdata = 1<<0; - - /** - * cgroup_init - cgroup initialization -@@ -6166,6 +6166,28 @@ static int __init cgroup_no_v1(char *str) - } - __setup("cgroup_no_v1=", cgroup_no_v1); - -+static int __init cgroup_enable(char *str) -+{ -+ struct cgroup_subsys *ss; -+ char *token; -+ int i; -+ -+ while ((token = strsep(&str, ",")) != NULL) { -+ if (!*token) -+ continue; -+ -+ for_each_subsys(ss, i) { -+ if (strcmp(token, ss->name) && -+ strcmp(token, ss->legacy_name)) -+ continue; -+ -+ cgroup_disable_mask &= ~(1 << i); -+ } -+ } -+ return 1; -+} -+__setup("cgroup_enable=", cgroup_enable); -+ - /** - * css_tryget_online_from_dir - get corresponding css from a cgroup dentry - * @dentry: directory dentry of interest - -From 7a094c94cc5e4275d62f541780238f86b7e1a944 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 060/122] hid: Reduce default mouse polling interval to 60Hz - -Reduces overhead when using X ---- - drivers/hid/usbhid/hid-core.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400dfd5834f3 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -49,7 +49,7 @@ - * Module parameters. - */ - --static unsigned int hid_mousepoll_interval; -+static unsigned int hid_mousepoll_interval = ~0; - module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); - MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); - -@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) - } - - /* Change the polling interval of mice. */ -- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) -- interval = hid_mousepoll_interval; -+ if (hid->collection->usage == HID_GD_MOUSE) { -+ if (hid_mousepoll_interval == ~0 && interval < 16) -+ interval = 16; -+ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) -+ interval = hid_mousepoll_interval; -+ } - - ret = -ENOMEM; - if (usb_endpoint_dir_in(endpoint)) { - -From 844a5a997e65b9ba913904f020f88893087ba2b2 Mon Sep 17 00:00:00 2001 -From: Gordon Hollingworth -Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 061/122] rpi-ft5406: Add touchscreen driver for pi LCD display - -Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected - -rpi-ft5406: Use firmware API - -RPI-FT5406: Enable aarch64 support through explicit iomem interface - -Signed-off-by: Gerhard de Clercq ---- - drivers/input/touchscreen/Kconfig | 7 + - drivers/input/touchscreen/Makefile | 1 + - drivers/input/touchscreen/rpi-ft5406.c | 292 +++++++++++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 4 files changed, 301 insertions(+) - create mode 100644 drivers/input/touchscreen/rpi-ft5406.c - -diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig -index efca0133e266b84439bed072f86b6d4c3e147ece..0bf78ff1ae888a1afe3825aab5316f365ef96bfe 100644 ---- a/drivers/input/touchscreen/Kconfig -+++ b/drivers/input/touchscreen/Kconfig -@@ -638,6 +638,13 @@ config TOUCHSCREEN_EDT_FT5X06 - To compile this driver as a module, choose M here: the - module will be called edt-ft5x06. - -+config TOUCHSCREEN_RPI_FT5406 -+ tristate "Raspberry Pi FT5406 driver" -+ depends on RASPBERRYPI_FIRMWARE -+ help -+ Say Y here to enable the Raspberry Pi memory based FT5406 device -+ -+ - config TOUCHSCREEN_MIGOR - tristate "Renesas MIGO-R touchscreen" - depends on (SH_MIGOR || COMPILE_TEST) && I2C -diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile -index 81b86451782d4479147fbb1a8c70cdc0f6f08eac..f720bc30ada9c2b5907228e852e3955ce9f48c12 100644 ---- a/drivers/input/touchscreen/Makefile -+++ b/drivers/input/touchscreen/Makefile -@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o - obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o - obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o - obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o -+obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o - obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o - obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o - obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o -diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9d7d05482355d168c5c0c42508cd978979ee5f14 ---- /dev/null -+++ b/drivers/input/touchscreen/rpi-ft5406.c -@@ -0,0 +1,292 @@ -+/* -+ * Driver for memory based ft5406 touchscreen -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define MAXIMUM_SUPPORTED_POINTS 10 -+struct ft5406_regs { -+ uint8_t device_mode; -+ uint8_t gesture_id; -+ uint8_t num_points; -+ struct ft5406_touch { -+ uint8_t xh; -+ uint8_t xl; -+ uint8_t yh; -+ uint8_t yl; -+ uint8_t res1; -+ uint8_t res2; -+ } point[MAXIMUM_SUPPORTED_POINTS]; -+}; -+ -+#define SCREEN_WIDTH 800 -+#define SCREEN_HEIGHT 480 -+ -+struct ft5406 { -+ struct platform_device * pdev; -+ struct input_dev * input_dev; -+ void __iomem * ts_base; -+ dma_addr_t bus_addr; -+ struct task_struct * thread; -+}; -+ -+/* Thread to poll for touchscreen events -+ * -+ * This thread polls the memory based register copy of the ft5406 registers -+ * using the number of points register to know whether the copy has been -+ * updated (we write 99 to the memory copy, the GPU will write between -+ * 0 - 10 points) -+ */ -+static int ft5406_thread(void *arg) -+{ -+ struct ft5406 *ts = (struct ft5406 *) arg; -+ struct ft5406_regs regs; -+ int known_ids = 0; -+ -+ while(!kthread_should_stop()) -+ { -+ // 60fps polling -+ msleep_interruptible(17); -+ memcpy_fromio(®s, ts->ts_base, sizeof(struct ft5406_regs)); -+ iowrite8(99, ts->ts_base + offsetof(struct ft5406_regs, num_points)); -+ // Do not output if theres no new information (num_points is 99) -+ // or we have no touch points and don't need to release any -+ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) -+ { -+ int i; -+ int modified_ids = 0, released_ids; -+ for(i = 0; i < regs.num_points; i++) -+ { -+ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; -+ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; -+ int touchid = (regs.point[i].yh >> 4) & 0xf; -+ -+ modified_ids |= 1 << touchid; -+ -+ if(!((1 << touchid) & known_ids)) -+ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); -+ -+ input_mt_slot(ts->input_dev, touchid); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); -+ -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); -+ -+ } -+ -+ released_ids = known_ids & ~modified_ids; -+ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) -+ { -+ if(released_ids & (1<pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); -+ input_mt_slot(ts->input_dev, i); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); -+ modified_ids &= ~(1 << i); -+ } -+ } -+ known_ids = modified_ids; -+ -+ input_mt_report_pointer_emulation(ts->input_dev, true); -+ input_sync(ts->input_dev); -+ } -+ -+ } -+ -+ return 0; -+} -+ -+static int ft5406_probe(struct platform_device *pdev) -+{ -+ int err = 0; -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct ft5406 * ts; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ u32 touchbuf; -+ -+ dev_info(dev, "Probing device\n"); -+ -+ fw_node = of_parse_phandle(np, "firmware", 0); -+ if (!fw_node) { -+ dev_err(dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ ts = devm_kzalloc(dev, sizeof(struct ft5406), GFP_KERNEL); -+ if (!ts) { -+ dev_err(dev, "Failed to allocate memory\n"); -+ return -ENOMEM; -+ } -+ -+ ts->input_dev = input_allocate_device(); -+ if (!ts->input_dev) { -+ dev_err(dev, "Failed to allocate input device\n"); -+ return -ENOMEM; -+ } -+ -+ ts->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->bus_addr, GFP_KERNEL); -+ if (!ts->ts_base) { -+ pr_err("[%s]: failed to dma_alloc_coherent(%ld)\n", -+ __func__, PAGE_SIZE); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ touchbuf = (u32)ts->bus_addr; -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF, -+ &touchbuf, sizeof(touchbuf)); -+ -+ if (err || touchbuf != 0) { -+ dev_warn(dev, "Failed to set touchbuf, trying to get err:%x\n", err); -+ dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr); -+ ts->ts_base = 0; -+ ts->bus_addr = 0; -+ } -+ -+ if (!ts->ts_base) { -+ dev_warn(dev, "set failed, trying get (err:%d touchbuf:%x virt:%p bus:%x)\n", err, touchbuf, ts->ts_base, ts->bus_addr); -+ -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, -+ &touchbuf, sizeof(touchbuf)); -+ if (err) { -+ dev_err(dev, "Failed to get touch buffer\n"); -+ goto out; -+ } -+ -+ if (!touchbuf) { -+ dev_err(dev, "Touchscreen not detected\n"); -+ err = -ENODEV; -+ goto out; -+ } -+ -+ dev_dbg(dev, "Got TS buffer 0x%x\n", touchbuf); -+ -+ // mmap the physical memory -+ touchbuf &= ~0xc0000000; -+ ts->ts_base = ioremap(touchbuf, sizeof(struct ft5406_regs)); -+ if (ts->ts_base == NULL) -+ { -+ dev_err(dev, "Failed to map physical address\n"); -+ err = -ENOMEM; -+ goto out; -+ } -+ } -+ platform_set_drvdata(pdev, ts); -+ ts->pdev = pdev; -+ -+ ts->input_dev->name = "FT5406 memory based driver"; -+ -+ __set_bit(EV_KEY, ts->input_dev->evbit); -+ __set_bit(EV_SYN, ts->input_dev->evbit); -+ __set_bit(EV_ABS, ts->input_dev->evbit); -+ -+ input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, -+ SCREEN_WIDTH, 0, 0); -+ input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, -+ SCREEN_HEIGHT, 0, 0); -+ -+ input_mt_init_slots(ts->input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); -+ -+ input_set_drvdata(ts->input_dev, ts); -+ -+ err = input_register_device(ts->input_dev); -+ if (err) { -+ dev_err(dev, "could not register input device, %d\n", -+ err); -+ goto out; -+ } -+ -+ // create thread to poll the touch events -+ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); -+ if(ts->thread == NULL) -+ { -+ dev_err(dev, "Failed to create kernel thread"); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ return 0; -+ -+out: -+ if (ts->bus_addr) { -+ dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr); -+ ts->bus_addr = 0; -+ ts->ts_base = NULL; -+ } else if (ts->ts_base) { -+ iounmap(ts->ts_base); -+ ts->ts_base = NULL; -+ } -+ if (ts->input_dev) { -+ input_unregister_device(ts->input_dev); -+ ts->input_dev = NULL; -+ } -+ return err; -+} -+ -+static int ft5406_remove(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); -+ -+ dev_info(dev, "Removing rpi-ft5406\n"); -+ -+ kthread_stop(ts->thread); -+ -+ if (ts->bus_addr) -+ dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr); -+ else if (ts->ts_base) -+ iounmap(ts->ts_base); -+ if (ts->input_dev) -+ input_unregister_device(ts->input_dev); -+ -+ return 0; -+} -+ -+static const struct of_device_id ft5406_match[] = { -+ { .compatible = "rpi,rpi-ft5406", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ft5406_match); -+ -+static struct platform_driver ft5406_driver = { -+ .driver = { -+ .name = "rpi-ft5406", -+ .owner = THIS_MODULE, -+ .of_match_table = ft5406_match, -+ }, -+ .probe = ft5406_probe, -+ .remove = ft5406_remove, -+}; -+ -+module_platform_driver(ft5406_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth"); -+MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 227a107214a02deadcca3db202da265eba1fdd21..b0f6e33bd30c35664ceee057f4c3ad32b914291d 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -115,6 +115,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF = 0x0004801f, - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, - RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, - - -From 3b84c6d542a8066b50fc3efdd916c8a7b88b9d1f Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 28 Nov 2016 16:50:04 +0000 -Subject: [PATCH 062/122] Improve __copy_to_user and __copy_from_user - performance - -Provide a __copy_from_user that uses memcpy. On BCM2708, use -optimised memcpy/memmove/memcmp/memset implementations. - -arch/arm: Add mmiocpy/set aliases for memcpy/set - -See: https://github.com/raspberrypi/linux/issues/1082 - -copy_from_user: CPU_SW_DOMAIN_PAN compatibility - -The downstream copy_from_user acceleration must also play nice with -CONFIG_CPU_SW_DOMAIN_PAN. - -See: https://github.com/raspberrypi/linux/issues/1381 - -Signed-off-by: Phil Elwell ---- - arch/arm/include/asm/string.h | 5 + - arch/arm/include/asm/uaccess.h | 3 + - arch/arm/lib/Makefile | 15 +- - arch/arm/lib/arm-mem.h | 159 ++++++++++++ - arch/arm/lib/copy_from_user.S | 4 +- - arch/arm/lib/exports_rpi.c | 37 +++ - arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ - arch/arm/lib/memcpy_rpi.S | 61 +++++ - arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ - arch/arm/lib/memmove_rpi.S | 61 +++++ - arch/arm/lib/memset_rpi.S | 123 +++++++++ - arch/arm/lib/uaccess_with_memcpy.c | 120 ++++++++- - arch/arm/mach-bcm/Kconfig | 7 + - 13 files changed, 1380 insertions(+), 6 deletions(-) - create mode 100644 arch/arm/lib/arm-mem.h - create mode 100644 arch/arm/lib/exports_rpi.c - create mode 100644 arch/arm/lib/memcmp_rpi.S - create mode 100644 arch/arm/lib/memcpy_rpi.S - create mode 100644 arch/arm/lib/memcpymove.h - create mode 100644 arch/arm/lib/memmove_rpi.S - create mode 100644 arch/arm/lib/memset_rpi.S - -diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h -index cf4f3aad0fc1c2154c6cf3839ff21bb1c46d6499..d69b70a6007dfc647ad164d1ee90d253c0686dee 100644 ---- a/arch/arm/include/asm/string.h -+++ b/arch/arm/include/asm/string.h -@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); - #define __HAVE_ARCH_MEMSET - extern void * memset(void *, int, __kernel_size_t); - -+#ifdef CONFIG_BCM2835_FAST_MEMCPY -+#define __HAVE_ARCH_MEMCMP -+extern int memcmp(const void *, const void *, size_t); -+#endif -+ - extern void __memzero(void *ptr, __kernel_size_t n); - - #define memset(p,v,n) \ -diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h -index 1f59ea051bab814132074b09f55d3a57c800a471..028d151b80a3dfb4253e94b87cc391bdb0b16c49 100644 ---- a/arch/arm/include/asm/uaccess.h -+++ b/arch/arm/include/asm/uaccess.h -@@ -477,6 +477,9 @@ do { \ - extern unsigned long __must_check - arm_copy_from_user(void *to, const void __user *from, unsigned long n); - -+extern unsigned long __must_check -+__copy_from_user_std(void *to, const void __user *from, unsigned long n); -+ - static inline unsigned long __must_check - __copy_from_user(void *to, const void __user *from, unsigned long n) - { -diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile -index 27f4d96258a2e66193d6a3701bb4cf9a44399aad..96b390c9301f816d5c83c6ddb76ac74ba7a3b99d 100644 ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -6,9 +6,8 @@ - - lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ -- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ -- memmove.o memset.o memzero.o setbit.o \ -- strchr.o strrchr.o \ -+ delay.o delay-loop.o findbit.o memchr.o memzero.o \ -+ setbit.o strchr.o strrchr.o \ - testchangebit.o testclearbit.o testsetbit.o \ - ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ - ucmpdi2.o lib1funcs.o div64.o \ -@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ - copy_from_user.o copy_to_user.o - -+# Choose optimised implementations for Raspberry Pi -+ifeq ($(CONFIG_BCM2835_FAST_MEMCPY),y) -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 -+ obj-$(CONFIG_MODULES) += exports_rpi.o -+ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o -+else -+ lib-y += memcpy.o memmove.o memset.o -+endif -+ - # using lib_ here won't override already available weak symbols - obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o - -diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h -new file mode 100644 -index 0000000000000000000000000000000000000000..5d4bda19ad207c65e7b7c6d6d733087faa96a8cc ---- /dev/null -+++ b/arch/arm/lib/arm-mem.h -@@ -0,0 +1,159 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+.macro myfunc fname -+ .func fname -+ .global fname -+fname: -+.endm -+ -+.macro preload_leading_step1 backwards, ptr, base -+/* If the destination is already 16-byte aligned, then we need to preload -+ * between 0 and prefetch_distance (inclusive) cache lines ahead so there -+ * are no gaps when the inner loop starts. -+ */ -+ .if backwards -+ sub ptr, base, #1 -+ bic ptr, ptr, #31 -+ .else -+ bic ptr, base, #31 -+ .endif -+ .set OFFSET, 0 -+ .rept prefetch_distance+1 -+ pld [ptr, #OFFSET] -+ .if backwards -+ .set OFFSET, OFFSET-32 -+ .else -+ .set OFFSET, OFFSET+32 -+ .endif -+ .endr -+.endm -+ -+.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp -+/* However, if the destination is not 16-byte aligned, we may need to -+ * preload one more cache line than that. The question we need to ask is: -+ * are the leading bytes more than the amount by which the source -+ * pointer will be rounded down for preloading, and if so, by how many -+ * cache lines? -+ */ -+ .if backwards -+/* Here we compare against how many bytes we are into the -+ * cache line, counting down from the highest such address. -+ * Effectively, we want to calculate -+ * leading_bytes = dst&15 -+ * cacheline_offset = 31-((src-leading_bytes-1)&31) -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0, or rearranging: -+ * leading_bytes + (src-leading_bytes-1)&31 <= 31 -+ */ -+ mov tmp, base, lsl #32-5 -+ sbc tmp, tmp, leading_bytes, lsl #32-5 -+ adds tmp, tmp, leading_bytes, lsl #32-5 -+ bcc 61f -+ pld [ptr, #-32*(prefetch_distance+1)] -+ .else -+/* Effectively, we want to calculate -+ * leading_bytes = (-dst)&15 -+ * cacheline_offset = (src+leading_bytes)&31 -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0. -+ */ -+ mov tmp, base, lsl #32-5 -+ add tmp, tmp, leading_bytes, lsl #32-5 -+ rsbs tmp, tmp, leading_bytes, lsl #32-5 -+ bls 61f -+ pld [ptr, #32*(prefetch_distance+1)] -+ .endif -+61: -+.endm -+ -+.macro preload_trailing backwards, base, remain, tmp -+ /* We need either 0, 1 or 2 extra preloads */ -+ .if backwards -+ rsb tmp, base, #0 -+ mov tmp, tmp, lsl #32-5 -+ .else -+ mov tmp, base, lsl #32-5 -+ .endif -+ adds tmp, tmp, remain, lsl #32-5 -+ adceqs tmp, tmp, #0 -+ /* The instruction above has two effects: ensures Z is only -+ * set if C was clear (so Z indicates that both shifted quantities -+ * were 0), and clears C if Z was set (so C indicates that the sum -+ * of the shifted quantities was greater and not equal to 32) */ -+ beq 82f -+ .if backwards -+ sub tmp, base, #1 -+ bic tmp, tmp, #31 -+ .else -+ bic tmp, base, #31 -+ .endif -+ bcc 81f -+ .if backwards -+ pld [tmp, #-32*(prefetch_distance+1)] -+81: -+ pld [tmp, #-32*prefetch_distance] -+ .else -+ pld [tmp, #32*(prefetch_distance+2)] -+81: -+ pld [tmp, #32*(prefetch_distance+1)] -+ .endif -+82: -+.endm -+ -+.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 -+ .if backwards -+ sub tmp0, base, #1 -+ bic tmp0, tmp0, #31 -+ pld [tmp0] -+ sub tmp1, base, remain, lsl #shift -+ .else -+ bic tmp0, base, #31 -+ pld [tmp0] -+ add tmp1, base, remain, lsl #shift -+ sub tmp1, tmp1, #1 -+ .endif -+ bic tmp1, tmp1, #31 -+ cmp tmp1, tmp0 -+ beq 92f -+ .if narrow_case -+ /* In this case, all the data fits in either 1 or 2 cache lines */ -+ pld [tmp1] -+ .else -+91: -+ .if backwards -+ sub tmp0, tmp0, #32 -+ .else -+ add tmp0, tmp0, #32 -+ .endif -+ cmp tmp0, tmp1 -+ pld [tmp0] -+ bne 91b -+ .endif -+92: -+.endm -diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S -index 7a4b060490012dd29f8a6d9fb8e24dfa58896bd1..fb40a1b3a5b7d42f93ae362e3326b7a72dc290dc 100644 ---- a/arch/arm/lib/copy_from_user.S -+++ b/arch/arm/lib/copy_from_user.S -@@ -89,11 +89,13 @@ - - .text - --ENTRY(arm_copy_from_user) -+ENTRY(__copy_from_user_std) -+WEAK(arm_copy_from_user) - - #include "copy_template.S" - - ENDPROC(arm_copy_from_user) -+ENDPROC(__copy_from_user_std) - - .pushsection .fixup,"ax" - .align 0 -diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..1f826047db754ffde0077ac291b9605e201abd07 ---- /dev/null -+++ b/arch/arm/lib/exports_rpi.c -@@ -0,0 +1,37 @@ -+/** -+ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+ -+EXPORT_SYMBOL(memcmp); -diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..bf6e4edfc9d3b9882b72edada681b79ce37850df ---- /dev/null -+++ b/arch/arm/lib/memcmp_rpi.S -@@ -0,0 +1,285 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+.macro memcmp_process_head unaligned -+ .if unaligned -+ ldr DAT0, [S_1], #4 -+ ldr DAT1, [S_1], #4 -+ ldr DAT2, [S_1], #4 -+ ldr DAT3, [S_1], #4 -+ .else -+ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} -+ .endif -+ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} -+.endm -+ -+.macro memcmp_process_tail -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ cmpeq DAT3, DAT7 -+ bne 200f -+.endm -+ -+.macro memcmp_leading_31bytes -+ movs DAT0, OFF, lsl #31 -+ ldrmib DAT0, [S_1], #1 -+ ldrcsh DAT1, [S_1], #2 -+ ldrmib DAT4, [S_2], #1 -+ ldrcsh DAT5, [S_2], #2 -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ submi N, N, #1 -+ subcs N, N, #2 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+ movs DAT0, OFF, lsl #29 -+ ldrmi DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ ldrcs DAT2, [S_1], #4 -+ ldrmi DAT4, [S_2], #4 -+ ldmcsia S_2!, {DAT5, DAT6} -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movcc DAT2, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ movcc DAT6, #0 -+ submi N, N, #4 -+ subcs N, N, #8 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ tst OFF, #16 -+ beq 105f -+ memcmp_process_head 1 -+ sub N, N, #16 -+ memcmp_process_tail -+105: -+.endm -+ -+.macro memcmp_trailing_15bytes unaligned -+ movs N, N, lsl #29 -+ .if unaligned -+ ldrcs DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ .else -+ ldmcsia S_1!, {DAT0, DAT1} -+ .endif -+ ldrmi DAT2, [S_1], #4 -+ ldmcsia S_2!, {DAT4, DAT5} -+ ldrmi DAT6, [S_2], #4 -+ movcc DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT2, #0 -+ movcc DAT4, #0 -+ movcc DAT5, #0 -+ movpl DAT6, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ movs N, N, lsl #2 -+ ldrcsh DAT0, [S_1], #2 -+ ldrmib DAT1, [S_1] -+ ldrcsh DAT4, [S_2], #2 -+ ldrmib DAT5, [S_2] -+ movcc DAT0, #0 -+ movpl DAT1, #0 -+ movcc DAT4, #0 -+ movpl DAT5, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+.endm -+ -+.macro memcmp_long_inner_loop unaligned -+110: -+ memcmp_process_head unaligned -+ pld [S_2, #prefetch_distance*32 + 16] -+ memcmp_process_tail -+ memcmp_process_head unaligned -+ pld [S_1, OFF] -+ memcmp_process_tail -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, -+ * deal with final preloads */ -+ preload_trailing 0, S_1, N, DAT0 -+ preload_trailing 0, S_2, N, DAT0 -+ add N, N, #(prefetch_distance+2)*32 - 16 -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+.macro memcmp_short_inner_loop unaligned -+ subs N, N, #16 /* simplifies inner loop termination */ -+ blo 122f -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+122: /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+/* -+ * int memcmp(const void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to buffer 1 -+ * a2 = pointer to buffer 2 -+ * a3 = number of bytes to compare (as unsigned chars) -+ * On exit: -+ * a1 = >0/=0/<0 if s1 >/=/< s2 -+ */ -+ -+.set prefetch_distance, 2 -+ -+ENTRY(memcmp) -+ S_1 .req a1 -+ S_2 .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req ip -+ OFF .req lr -+ -+ push {DAT1-DAT6, lr} -+ setend be /* lowest-addressed bytes are most significant */ -+ -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 170f -+ -+ /* Long case */ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 0, DAT0, S_1 -+ preload_leading_step1 0, DAT1, S_2 -+ tst S_2, #31 -+ beq 154f -+ rsb OFF, S_2, #0 /* no need to AND with 15 here */ -+ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 -+ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 -+ memcmp_leading_31bytes -+154: /* Second source now cacheline (32-byte) aligned; we have at -+ * least one prefetch to go. */ -+ /* Prefetch offset is best selected such that it lies in the -+ * first 8 of each 32 bytes - but it's just as easy to aim for -+ * the first one */ -+ and OFF, S_1, #31 -+ rsb OFF, OFF, #32*prefetch_distance -+ tst S_1, #3 -+ bne 140f -+ memcmp_long_inner_loop 0 -+140: memcmp_long_inner_loop 1 -+ -+170: /* Short case */ -+ teq N, #0 -+ beq 199f -+ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 -+ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 -+ tst S_2, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ ldrb DAT0, [S_1], #1 -+ ldrb DAT4, [S_2], #1 -+ cmp DAT0, DAT4 -+ bne 200f -+ tst S_2, #3 -+ bne 172b -+174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ -+ tst S_1, #3 -+ bne 140f -+ memcmp_short_inner_loop 0 -+140: memcmp_short_inner_loop 1 -+ -+200: /* Difference found: determine sign. */ -+ movhi a1, #1 -+ movlo a1, #-1 -+ setend le -+ pop {DAT1-DAT6, pc} -+ -+ .unreq S_1 -+ .unreq S_2 -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq OFF -+ENDPROC(memcmp) -diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..30f8a9089a835ff265ce5aaf98f066258608eb92 ---- /dev/null -+++ b/arch/arm/lib/memcpy_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(mmiocpy) -+ENTRY(memcpy) -+ memcpy 0 -+ENDPROC(memcpy) -+ENDPROC(mmiocpy) -diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h -new file mode 100644 -index 0000000000000000000000000000000000000000..d8be5849c8609f4ead85527ec527184614a77371 ---- /dev/null -+++ b/arch/arm/lib/memcpymove.h -@@ -0,0 +1,506 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 -+ .if words == 1 -+ .if backwards -+ mov r1, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r1, r1, r0, lsr #align*8 -+ str r1, [D, #-4]! -+ .else -+ mov r0, r1, lsr #align*8 -+ ldr r1, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ str r0, [D], #4 -+ .endif -+ .elseif words == 2 -+ .if backwards -+ ldr r1, [S, #-4]! -+ mov r2, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2} -+ .else -+ ldr r1, [S, #4]! -+ mov r0, r2, lsr #align*8 -+ ldr r2, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ stmia D!, {r0, r1} -+ .endif -+ .elseif words == 4 -+ .if backwards -+ ldmdb S!, {r2, r3} -+ mov r4, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1} -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2} -+ mov r0, r4, lsr #align*8 -+ ldmib S!, {r3, r4} -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ .endif -+ .elseif words == 8 -+ .if backwards -+ ldmdb S!, {r4, r5, r6, r7} -+ mov r8, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1, r2, r3} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r8, r8, r7, lsr #align*8 -+ mov r7, r7, lsl #32-align*8 -+ orr r7, r7, r6, lsr #align*8 -+ mov r6, r6, lsl #32-align*8 -+ orr r6, r6, r5, lsr #align*8 -+ mov r5, r5, lsl #32-align*8 -+ orr r5, r5, r4, lsr #align*8 -+ mov r4, r4, lsl #32-align*8 -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r5, r6, r7, r8} -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2, r3, r4} -+ mov r0, r8, lsr #align*8 -+ ldmib S!, {r5, r6, r7, r8} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ mov r4, r4, lsr #align*8 -+ orr r4, r4, r5, lsl #32-align*8 -+ mov r5, r5, lsr #align*8 -+ orr r5, r5, r6, lsl #32-align*8 -+ mov r6, r6, lsr #align*8 -+ orr r6, r6, r7, lsl #32-align*8 -+ mov r7, r7, lsr #align*8 -+ orr r7, r7, r8, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ stmia D!, {r4, r5, r6, r7} -+ .endif -+ .endif -+.endm -+ -+.macro memcpy_leading_15bytes backwards, align -+ movs DAT1, DAT2, lsl #31 -+ sub N, N, DAT2 -+ .if backwards -+ ldrmib DAT0, [S, #-1]! -+ ldrcsh DAT1, [S, #-2]! -+ strmib DAT0, [D, #-1]! -+ strcsh DAT1, [D, #-2]! -+ .else -+ ldrmib DAT0, [S], #1 -+ ldrcsh DAT1, [S], #2 -+ strmib DAT0, [D], #1 -+ strcsh DAT1, [D], #2 -+ .endif -+ movs DAT1, DAT2, lsl #29 -+ .if backwards -+ ldrmi DAT0, [S, #-4]! -+ .if align == 0 -+ ldmcsdb S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT2, [S, #-4]! -+ ldrcs DAT1, [S, #-4]! -+ .endif -+ strmi DAT0, [D, #-4]! -+ stmcsdb D!, {DAT1, DAT2} -+ .else -+ ldrmi DAT0, [S], #4 -+ .if align == 0 -+ ldmcsia S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT1, [S], #4 -+ ldrcs DAT2, [S], #4 -+ .endif -+ strmi DAT0, [D], #4 -+ stmcsia D!, {DAT1, DAT2} -+ .endif -+.endm -+ -+.macro memcpy_trailing_15bytes backwards, align -+ movs N, N, lsl #29 -+ .if backwards -+ .if align == 0 -+ ldmcsdb S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT1, [S, #-4]! -+ ldrcs DAT0, [S, #-4]! -+ .endif -+ ldrmi DAT2, [S, #-4]! -+ stmcsdb D!, {DAT0, DAT1} -+ strmi DAT2, [D, #-4]! -+ .else -+ .if align == 0 -+ ldmcsia S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT0, [S], #4 -+ ldrcs DAT1, [S], #4 -+ .endif -+ ldrmi DAT2, [S], #4 -+ stmcsia D!, {DAT0, DAT1} -+ strmi DAT2, [D], #4 -+ .endif -+ movs N, N, lsl #2 -+ .if backwards -+ ldrcsh DAT0, [S, #-2]! -+ ldrmib DAT1, [S, #-1] -+ strcsh DAT0, [D, #-2]! -+ strmib DAT1, [D, #-1] -+ .else -+ ldrcsh DAT0, [S], #2 -+ ldrmib DAT1, [S] -+ strcsh DAT0, [D], #2 -+ strmib DAT1, [D] -+ .endif -+.endm -+ -+.macro memcpy_long_inner_loop backwards, align -+ .if align != 0 -+ .if backwards -+ ldr DAT0, [S, #-align]! -+ .else -+ ldr LAST, [S, #-align]! -+ .endif -+ .endif -+110: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ -+ preload_trailing backwards, S, N, OFF -+ add N, N, #(prefetch_distance+2)*32 - 32 -+120: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 120b -+ tst N, #16 -+ .if align == 0 -+ .if backwards -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ .else -+ beq 130f -+ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST -+130: -+ .endif -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ .if align != 0 -+ add S, S, #align -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {DAT3, DAT4, DAT5, DAT6, DAT7} -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_medium_inner_loop backwards, align -+120: -+ .if backwards -+ .if align == 0 -+ ldmdb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr LAST, [S, #-4]! -+ ldr DAT2, [S, #-4]! -+ ldr DAT1, [S, #-4]! -+ ldr DAT0, [S, #-4]! -+ .endif -+ stmdb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr DAT0, [S], #4 -+ ldr DAT1, [S], #4 -+ ldr DAT2, [S], #4 -+ ldr LAST, [S], #4 -+ .endif -+ stmia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_short_inner_loop backwards, align -+ tst N, #16 -+ .if backwards -+ .if align == 0 -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne LAST, [S, #-4]! -+ ldrne DAT2, [S, #-4]! -+ ldrne DAT1, [S, #-4]! -+ ldrne DAT0, [S, #-4]! -+ .endif -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne DAT0, [S], #4 -+ ldrne DAT1, [S], #4 -+ ldrne DAT2, [S], #4 -+ ldrne LAST, [S], #4 -+ .endif -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy backwards -+ D .req a1 -+ S .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req sl -+ LAST .req ip -+ OFF .req lr -+ -+ .cfi_startproc -+ -+ push {D, DAT1, DAT2, lr} -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_undefined S -+ .cfi_undefined N -+ .cfi_undefined DAT0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_undefined LAST -+ .cfi_rel_offset lr, 12 -+ -+ .if backwards -+ add D, D, N -+ add S, S, N -+ .endif -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 160f -+ -+ /* Long case */ -+ push {DAT3, DAT4, DAT5, DAT6, DAT7} -+ -+ .cfi_def_cfa_offset 36 -+ .cfi_rel_offset D, 20 -+ .cfi_rel_offset DAT1, 24 -+ .cfi_rel_offset DAT2, 28 -+ .cfi_rel_offset DAT3, 0 -+ .cfi_rel_offset DAT4, 4 -+ .cfi_rel_offset DAT5, 8 -+ .cfi_rel_offset DAT6, 12 -+ .cfi_rel_offset DAT7, 16 -+ .cfi_rel_offset lr, 32 -+ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 backwards, DAT0, S -+ .if backwards -+ /* Bug in GAS: it accepts, but mis-assembles the instruction -+ * ands DAT2, D, #60, 2 -+ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) -+ */ -+ .word 0xE210513C -+ beq 154f -+ .else -+ ands DAT2, D, #15 -+ beq 154f -+ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ -+ .endif -+ preload_leading_step2 backwards, DAT0, S, DAT2, OFF -+ memcpy_leading_15bytes backwards, 1 -+154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ -+ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ -+ .if backwards -+ rsb OFF, S, #3 -+ and OFF, OFF, #28 -+ sub OFF, OFF, #32*(prefetch_distance+1) -+ .else -+ and OFF, S, #28 -+ rsb OFF, OFF, #32*prefetch_distance -+ .endif -+ movs DAT0, S, lsl #31 -+ bhi 157f -+ bcs 156f -+ bmi 155f -+ memcpy_long_inner_loop backwards, 0 -+155: memcpy_long_inner_loop backwards, 1 -+156: memcpy_long_inner_loop backwards, 2 -+157: memcpy_long_inner_loop backwards, 3 -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_same_value DAT3 -+ .cfi_same_value DAT4 -+ .cfi_same_value DAT5 -+ .cfi_same_value DAT6 -+ .cfi_same_value DAT7 -+ .cfi_rel_offset lr, 12 -+ -+160: /* Medium case */ -+ preload_all backwards, 0, 0, S, N, DAT2, OFF -+ sub N, N, #16 /* simplifies inner loop termination */ -+ .if backwards -+ ands DAT2, D, #15 -+ beq 164f -+ .else -+ ands DAT2, D, #15 -+ beq 164f -+ rsb DAT2, DAT2, #16 -+ .endif -+ memcpy_leading_15bytes backwards, align -+164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ -+ tst S, #3 -+ bne 140f -+ memcpy_medium_inner_loop backwards, 0 -+140: memcpy_medium_inner_loop backwards, 1 -+ -+170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ -+ teq N, #0 -+ beq 199f -+ preload_all backwards, 1, 0, S, N, DAT2, LAST -+ tst D, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ .if backwards -+ ldrb DAT0, [S, #-1]! -+ strb DAT0, [D, #-1]! -+ .else -+ ldrb DAT0, [S], #1 -+ strb DAT0, [D], #1 -+ .endif -+ tst D, #3 -+ bne 172b -+174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ -+ tst S, #3 -+ bne 140f -+ memcpy_short_inner_loop backwards, 0 -+140: memcpy_short_inner_loop backwards, 1 -+ -+ .cfi_endproc -+ -+ .unreq D -+ .unreq S -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq LAST -+ .unreq OFF -+.endm -diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..8b0760c0904c51ef205e56d238b5df8a5226d7cf ---- /dev/null -+++ b/arch/arm/lib/memmove_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memmove(void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(memmove) -+ cmp a2, a1 -+ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ -+ memcpy 1 -+ENDPROC(memmove) -diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..70674158d76cd38d8d70c987aa54a6b477e4fa91 ---- /dev/null -+++ b/arch/arm/lib/memset_rpi.S -@@ -0,0 +1,123 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memset(void *s, int c, size_t n); -+ * On entry: -+ * a1 = pointer to buffer to fill -+ * a2 = byte pattern to fill with (caller-narrowed) -+ * a3 = number of bytes to fill -+ * On exit: -+ * a1 preserved -+ */ -+ENTRY(mmioset) -+ENTRY(memset) -+ S .req a1 -+ DAT0 .req a2 -+ N .req a3 -+ DAT1 .req a4 -+ DAT2 .req ip -+ DAT3 .req lr -+ -+ orr DAT0, DAT0, lsl #8 -+ push {S, lr} -+ orr DAT0, DAT0, lsl #16 -+ mov DAT1, DAT0 -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ -+161: sub N, N, #16 /* simplifies inner loop termination */ -+ /* Leading words and bytes */ -+ tst S, #15 -+ beq 164f -+ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ -+ movs DAT2, DAT3, lsl #31 -+ submi N, N, #1 -+ strmib DAT0, [S], #1 -+ subcs N, N, #2 -+ strcsh DAT0, [S], #2 -+ movs DAT2, DAT3, lsl #29 -+ submi N, N, #4 -+ strmi DAT0, [S], #4 -+ subcs N, N, #8 -+ stmcsia S!, {DAT0, DAT1} -+164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ /* Now the inner loop of 16-byte stores */ -+165: stmia S!, {DAT0, DAT1, DAT2, DAT3} -+ subs N, N, #16 -+ bhs 165b -+166: /* Trailing words and bytes */ -+ movs N, N, lsl #29 -+ stmcsia S!, {DAT0, DAT1} -+ strmi DAT0, [S], #4 -+ movs N, N, lsl #2 -+ strcsh DAT0, [S], #2 -+ strmib DAT0, [S] -+199: pop {S, pc} -+ -+170: /* Short case */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ tst S, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199b -+ strb DAT0, [S], #1 -+ tst S, #3 -+ bne 172b -+174: tst N, #16 -+ stmneia S!, {DAT0, DAT1, DAT2, DAT3} -+ b 166b -+ -+ .unreq S -+ .unreq DAT0 -+ .unreq N -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ENDPROC(memset) -+ENDPROC(mmioset) -diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c -index 6bd1089b07e0960830ed6bd6a8345202b7efd8b0..cd17dd11ebe7bbe00089e70cd2ccea74e0400200 100644 ---- a/arch/arm/lib/uaccess_with_memcpy.c -+++ b/arch/arm/lib/uaccess_with_memcpy.c -@@ -22,6 +22,14 @@ - #include - #include - -+#ifndef COPY_FROM_USER_THRESHOLD -+#define COPY_FROM_USER_THRESHOLD 64 -+#endif -+ -+#ifndef COPY_TO_USER_THRESHOLD -+#define COPY_TO_USER_THRESHOLD 64 -+#endif -+ - static int - pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - { -@@ -84,7 +92,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - return 1; - } - --static unsigned long noinline -+static int -+pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) -+{ -+ unsigned long addr = (unsigned long)_addr; -+ pgd_t *pgd; -+ pmd_t *pmd; -+ pte_t *pte; -+ pud_t *pud; -+ spinlock_t *ptl; -+ -+ pgd = pgd_offset(current->mm, addr); -+ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) -+ { -+ return 0; -+ } -+ pud = pud_offset(pgd, addr); -+ if (unlikely(pud_none(*pud) || pud_bad(*pud))) -+ { -+ return 0; -+ } -+ -+ pmd = pmd_offset(pud, addr); -+ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) -+ return 0; -+ -+ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); -+ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { -+ pte_unmap_unlock(pte, ptl); -+ return 0; -+ } -+ -+ *ptep = pte; -+ *ptlp = ptl; -+ -+ return 1; -+} -+ -+unsigned long noinline - __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - { - unsigned long ua_flags; -@@ -137,6 +182,57 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - return n; - } - -+unsigned long noinline -+__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) -+{ -+ unsigned long ua_flags; -+ int atomic; -+ -+ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { -+ memcpy(to, (const void *)from, n); -+ return 0; -+ } -+ -+ /* the mmap semaphore is taken only if not in an atomic context */ -+ atomic = in_atomic(); -+ -+ if (!atomic) -+ down_read(¤t->mm->mmap_sem); -+ while (n) { -+ pte_t *pte; -+ spinlock_t *ptl; -+ int tocopy; -+ -+ while (!pin_page_for_read(from, &pte, &ptl)) { -+ char temp; -+ if (!atomic) -+ up_read(¤t->mm->mmap_sem); -+ if (__get_user(temp, (char __user *)from)) -+ goto out; -+ if (!atomic) -+ down_read(¤t->mm->mmap_sem); -+ } -+ -+ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; -+ if (tocopy > n) -+ tocopy = n; -+ -+ ua_flags = uaccess_save_and_enable(); -+ memcpy(to, (const void *)from, tocopy); -+ uaccess_restore(ua_flags); -+ to += tocopy; -+ from += tocopy; -+ n -= tocopy; -+ -+ pte_unmap_unlock(pte, ptl); -+ } -+ if (!atomic) -+ up_read(¤t->mm->mmap_sem); -+ -+out: -+ return n; -+} -+ - unsigned long - arm_copy_to_user(void __user *to, const void *from, unsigned long n) - { -@@ -147,7 +243,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - * With frame pointer disabled, tail call optimization kicks in - * as well making this test almost invisible. - */ -- if (n < 64) { -+ if (n < COPY_TO_USER_THRESHOLD) { - unsigned long ua_flags = uaccess_save_and_enable(); - n = __copy_to_user_std(to, from, n); - uaccess_restore(ua_flags); -@@ -156,6 +252,26 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - } - return n; - } -+ -+unsigned long __must_check -+arm_copy_from_user(void *to, const void __user *from, unsigned long n) -+{ -+ /* -+ * This test is stubbed out of the main function above to keep -+ * the overhead for small copies low by avoiding a large -+ * register dump on the stack just to reload them right away. -+ * With frame pointer disabled, tail call optimization kicks in -+ * as well making this test almost invisible. -+ */ -+ if (n < COPY_TO_USER_THRESHOLD) { -+ unsigned long ua_flags = uaccess_save_and_enable(); -+ n = __copy_from_user_std(to, from, n); -+ uaccess_restore(ua_flags); -+ } else { -+ n = __copy_from_user_memcpy(to, from, n); -+ } -+ return n; -+} - - static unsigned long noinline - __clear_user_memset(void __user *addr, unsigned long n) -diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 333dc3c2e5ffbb2c5ab8fcfb6115b6162643cf20..46b787a6474ffa857da9b663948863ecfb46e862 100644 ---- a/arch/arm/mach-bcm/Kconfig -+++ b/arch/arm/mach-bcm/Kconfig -@@ -174,6 +174,13 @@ config ARCH_BCM_53573 - The base chip is BCM53573 and there are some packaging modifications - like BCM47189 and BCM47452. - -+config BCM2835_FAST_MEMCPY -+ bool "Enable optimized __copy_to_user and __copy_from_user" -+ depends on ARCH_BCM2835 && ARCH_MULTI_V6 -+ default y -+ help -+ Optimized versions of __copy_to_user and __copy_from_user for Pi1. -+ - config ARCH_BCM_63XX - bool "Broadcom BCM63xx DSL SoC" - depends on ARCH_MULTI_V7 - -From d5dc9d3eb0f7177be235596e3009f8b53b4e25b5 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 063/122] gpio-poweroff: Allow it to work on Raspberry Pi - -The Raspberry Pi firmware manages the power-down and reboot -process. To do this it installs a pm_power_off handler, causing -the gpio-poweroff module to abort the probe function. - -This patch introduces a "force" DT property that overrides that -behaviour, and also adds a DT overlay to enable and control it. - -Note that running in an active-low configuration (DT parameter -"active_low") requires a custom dt-blob.bin and probably won't -allow a reboot without switching off, so an external inversion -of the trigger signal may be preferable. ---- - drivers/power/reset/gpio-poweroff.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c -index be3d81ff51cc3f510d85e4eed7a52960e51e7bc1..a030ae9fb1fca325061c093696e821869eedd320 100644 ---- a/drivers/power/reset/gpio-poweroff.c -+++ b/drivers/power/reset/gpio-poweroff.c -@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) - { - bool input = false; - enum gpiod_flags flags; -+ bool force = false; - - /* If a pm_power_off function has already been added, leave it alone */ -- if (pm_power_off != NULL) { -+ force = of_property_read_bool(pdev->dev.of_node, "force"); -+ if (!force && (pm_power_off != NULL)) { - dev_err(&pdev->dev, - "%s: pm_power_off function already registered", - __func__); - -From 78515e0aa6204095c519dce39d811d796cb9dc18 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 064/122] mfd: Add Raspberry Pi Sense HAT core driver - ---- - drivers/input/joystick/Kconfig | 8 + - drivers/input/joystick/Makefile | 1 + - drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ - drivers/mfd/Kconfig | 8 + - drivers/mfd/Makefile | 1 + - drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ - drivers/video/fbdev/Kconfig | 13 ++ - drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ - include/linux/mfd/rpisense/core.h | 47 +++++ - include/linux/mfd/rpisense/framebuffer.h | 32 ++++ - include/linux/mfd/rpisense/joystick.h | 35 ++++ - 12 files changed, 749 insertions(+) - create mode 100644 drivers/input/joystick/rpisense-js.c - create mode 100644 drivers/mfd/rpisense-core.c - create mode 100644 drivers/video/fbdev/rpisense-fb.c - create mode 100644 include/linux/mfd/rpisense/core.h - create mode 100644 include/linux/mfd/rpisense/framebuffer.h - create mode 100644 include/linux/mfd/rpisense/joystick.h - -diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig -index 4215b5382092c15d693e62de6e029626e9fa551d..4364d7c85543b4537c839df95cf5b524948a06c2 100644 ---- a/drivers/input/joystick/Kconfig -+++ b/drivers/input/joystick/Kconfig -@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE - To compile this as a module choose M here: the module will be called - maplecontrol. - -+config JOYSTICK_RPISENSE -+ tristate "Raspberry Pi Sense HAT joystick" -+ depends on GPIOLIB && INPUT -+ select MFD_RPISENSE_CORE -+ -+ help -+ This is the joystick driver for the Raspberry Pi Sense HAT -+ - endif -diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile -index 92dc0de9dfeda43171a901f96c40bebe0e7a5ae2..1758160374938dd150b8a380797b6decc00a64aa 100644 ---- a/drivers/input/joystick/Makefile -+++ b/drivers/input/joystick/Makefile -@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o - obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o - obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o - obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o -+obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o - -diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c -new file mode 100644 -index 0000000000000000000000000000000000000000..6a416769065d2198344792eb02d8e38da1d03fd4 ---- /dev/null -+++ b/drivers/input/joystick/rpisense-js.c -@@ -0,0 +1,153 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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 -+ -+static struct rpisense *rpisense; -+static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; -+ -+static void keys_work_fn(struct work_struct *work) -+{ -+ int i; -+ static s32 prev_keys; -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); -+ s32 changes = keys ^ prev_keys; -+ -+ prev_keys = keys; -+ for (i = 0; i < 5; i++) { -+ if (changes & 1) { -+ input_report_key(rpisense_js->keys_dev, -+ keymap[i], keys & 1); -+ } -+ changes >>= 1; -+ keys >>= 1; -+ } -+ input_sync(rpisense_js->keys_dev); -+} -+ -+static irqreturn_t keys_irq_handler(int irq, void *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ schedule_work(&rpisense_js->keys_work_s); -+ return IRQ_HANDLED; -+} -+ -+static int rpisense_js_probe(struct platform_device *pdev) -+{ -+ int ret; -+ int i; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_js = &rpisense->joystick; -+ -+ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); -+ -+ rpisense_js->keys_dev = input_allocate_device(); -+ if (!rpisense_js->keys_dev) { -+ dev_err(&pdev->dev, "Could not allocate input device.\n"); -+ return -ENOMEM; -+ } -+ -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); -+ for (i = 0; i < ARRAY_SIZE(keymap); i++) { -+ set_bit(keymap[i], -+ rpisense_js->keys_dev->keybit); -+ } -+ -+ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; -+ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; -+ rpisense_js->keys_dev->id.bustype = BUS_I2C; -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); -+ rpisense_js->keys_dev->keycode = keymap; -+ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); -+ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); -+ -+ ret = input_register_device(rpisense_js->keys_dev); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not register input device.\n"); -+ goto err_keys_alloc; -+ } -+ -+ ret = gpiod_direction_input(rpisense_js->keys_desc); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); -+ goto err_keys_reg; -+ } -+ -+ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); -+ if (rpisense_js->keys_irq < 0) { -+ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); -+ ret = rpisense_js->keys_irq; -+ goto err_keys_reg; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, -+ keys_irq_handler, IRQF_TRIGGER_RISING, -+ "keys", &pdev->dev); -+ if (ret) { -+ dev_err(&pdev->dev, "IRQ request failed.\n"); -+ goto err_keys_reg; -+ } -+ return 0; -+err_keys_reg: -+ input_unregister_device(rpisense_js->keys_dev); -+err_keys_alloc: -+ input_free_device(rpisense_js->keys_dev); -+ return ret; -+} -+ -+static int rpisense_js_remove(struct platform_device *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ input_unregister_device(rpisense_js->keys_dev); -+ input_free_device(rpisense_js->keys_dev); -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_js_id[] = { -+ { .compatible = "rpi,rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_js_id); -+#endif -+ -+static struct platform_device_id rpisense_js_device_id[] = { -+ { .name = "rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); -+ -+static struct platform_driver rpisense_js_driver = { -+ .probe = rpisense_js_probe, -+ .remove = rpisense_js_remove, -+ .driver = { -+ .name = "rpi-sense-js", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_js_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); -+MODULE_AUTHOR("Serge Schneider "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig -index c6df6442ba2b1b378386db03cb530fa6b6e3e723..b220064bd5feba3f9bb5ec198bcf8e5c4b930533 100644 ---- a/drivers/mfd/Kconfig -+++ b/drivers/mfd/Kconfig -@@ -10,6 +10,14 @@ config MFD_CORE - select IRQ_DOMAIN - default n - -+config MFD_RPISENSE_CORE -+ tristate "Raspberry Pi Sense HAT core functions" -+ depends on I2C -+ select MFD_CORE -+ help -+ This is the core driver for the Raspberry Pi Sense HAT. This provides -+ the necessary functions to communicate with the hardware. -+ - config MFD_CS5535 - tristate "AMD CS5535 and CS5536 southbridge core functions" - select MFD_CORE -diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile -index 9834e669d98573ce8c0b0a15b3f167dbf3485d87..1d8d58fe173c27bdf00daa646f4970e3aeb3ac08 100644 ---- a/drivers/mfd/Makefile -+++ b/drivers/mfd/Makefile -@@ -211,3 +211,4 @@ obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o - obj-$(CONFIG_MFD_MT6397) += mt6397-core.o - - obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o -+obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o -diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c -new file mode 100644 -index 0000000000000000000000000000000000000000..eea9312dc96a496ce846b0c5a83e6e4f3be5ee1e ---- /dev/null -+++ b/drivers/mfd/rpisense-core.c -@@ -0,0 +1,157 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ * This driver is based on wm8350 implementation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static struct rpisense *rpisense; -+ -+static void rpisense_client_dev_register(struct rpisense *rpisense, -+ const char *name, -+ struct platform_device **pdev) -+{ -+ int ret; -+ -+ *pdev = platform_device_alloc(name, -1); -+ if (*pdev == NULL) { -+ dev_err(rpisense->dev, "Failed to allocate %s\n", name); -+ return; -+ } -+ -+ (*pdev)->dev.parent = rpisense->dev; -+ platform_set_drvdata(*pdev, rpisense); -+ ret = platform_device_add(*pdev); -+ if (ret != 0) { -+ dev_err(rpisense->dev, "Failed to register %s: %d\n", -+ name, ret); -+ platform_device_put(*pdev); -+ *pdev = NULL; -+ } -+} -+ -+static int rpisense_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); -+ if (rpisense == NULL) -+ return -ENOMEM; -+ -+ i2c_set_clientdata(i2c, rpisense); -+ rpisense->dev = &i2c->dev; -+ rpisense->i2c_client = i2c; -+ -+ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); -+ if (ret > 0) { -+ if (ret != 's') -+ return -EINVAL; -+ } else { -+ return ret; -+ } -+ ret = rpisense_reg_read(rpisense, RPISENSE_VER); -+ if (ret < 0) -+ return ret; -+ -+ dev_info(rpisense->dev, -+ "Raspberry Pi Sense HAT firmware version %i\n", ret); -+ -+ rpisense_js = &rpisense->joystick; -+ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, -+ "keys-int", GPIOD_IN); -+ if (IS_ERR(rpisense_js->keys_desc)) { -+ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); -+ rpisense_js->keys_desc = gpio_to_desc(23); -+ if (rpisense_js->keys_desc == NULL) { -+ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); -+ return PTR_ERR(rpisense_js->keys_desc); -+ } -+ } -+ rpisense_client_dev_register(rpisense, "rpi-sense-js", -+ &(rpisense->joystick.pdev)); -+ rpisense_client_dev_register(rpisense, "rpi-sense-fb", -+ &(rpisense->framebuffer.pdev)); -+ -+ return 0; -+} -+ -+static int rpisense_remove(struct i2c_client *i2c) -+{ -+ struct rpisense *rpisense = i2c_get_clientdata(i2c); -+ -+ platform_device_unregister(rpisense->joystick.pdev); -+ return 0; -+} -+ -+struct rpisense *rpisense_get_dev(void) -+{ -+ return rpisense; -+} -+EXPORT_SYMBOL_GPL(rpisense_get_dev); -+ -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg) -+{ -+ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); -+ /* Due to the BCM270x I2C clock stretching bug, some values -+ * may have MSB set. Clear it to avoid incorrect values. -+ * */ -+ return ret & 0x7F; -+} -+EXPORT_SYMBOL_GPL(rpisense_reg_read); -+ -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) -+{ -+ int ret = i2c_master_send(rpisense->i2c_client, buf, count); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Block write failed\n"); -+ return ret; -+} -+EXPORT_SYMBOL_GPL(rpisense_block_write); -+ -+static const struct i2c_device_id rpisense_i2c_id[] = { -+ { "rpi-sense", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); -+ -+ -+static struct i2c_driver rpisense_driver = { -+ .driver = { -+ .name = "rpi-sense", -+ .owner = THIS_MODULE, -+ }, -+ .probe = rpisense_probe, -+ .remove = rpisense_remove, -+ .id_table = rpisense_i2c_id, -+}; -+ -+module_i2c_driver(rpisense_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); -+MODULE_AUTHOR("Serge Schneider "); -+MODULE_LICENSE("GPL"); -+ -diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index 0ff4f80531e013f028ca4d05559c5464f8cfa5ef..2cd45bce38120d076d6a19804443557862978d4b 100644 ---- a/drivers/video/fbdev/Kconfig -+++ b/drivers/video/fbdev/Kconfig -@@ -2504,3 +2504,16 @@ config FB_SM712 - This driver is also available as a module. The module will be - called sm712fb. If you want to compile it as a module, say M - here and read . -+ -+config FB_RPISENSE -+ tristate "Raspberry Pi Sense HAT framebuffer" -+ depends on FB -+ select MFD_RPISENSE_CORE -+ select FB_SYS_FOPS -+ select FB_SYS_FILLRECT -+ select FB_SYS_COPYAREA -+ select FB_SYS_IMAGEBLIT -+ select FB_DEFERRED_IO -+ -+ help -+ This is the framebuffer driver for the Raspberry Pi Sense HAT -diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index 8cd1193b98690b9c4f49098ab14389504d65af3a..c9f1754bf2a6796bf5555fabb9e80f8991cb83bc 100644 ---- a/drivers/video/fbdev/Makefile -+++ b/drivers/video/fbdev/Makefile -@@ -147,6 +147,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o - obj-$(CONFIG_FB_MXS) += mxsfb.o - obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o - obj-$(CONFIG_FB_SIMPLE) += simplefb.o -+obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o - - # the test framebuffer is last - obj-$(CONFIG_FB_VIRTUAL) += vfb.o -diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c -new file mode 100644 -index 0000000000000000000000000000000000000000..26432a5a0b4b4a5198768eceb1e34da99fe1efb2 ---- /dev/null -+++ b/drivers/video/fbdev/rpisense-fb.c -@@ -0,0 +1,293 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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 -+ -+static bool lowlight; -+module_param(lowlight, bool, 0); -+MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); -+ -+static struct rpisense *rpisense; -+ -+struct rpisense_fb_param { -+ char __iomem *vmem; -+ u8 *vmem_work; -+ u32 vmemsize; -+ u8 *gamma; -+}; -+ -+static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -+ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, -+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, -+ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; -+ -+static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, -+ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, -+ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; -+ -+static u8 gamma_user[32]; -+ -+static struct rpisense_fb_param rpisense_fb_param = { -+ .vmem = NULL, -+ .vmemsize = 128, -+ .gamma = gamma_default, -+}; -+ -+static struct fb_deferred_io rpisense_fb_defio; -+ -+static struct fb_fix_screeninfo rpisense_fb_fix = { -+ .id = "RPi-Sense FB", -+ .type = FB_TYPE_PACKED_PIXELS, -+ .visual = FB_VISUAL_TRUECOLOR, -+ .xpanstep = 0, -+ .ypanstep = 0, -+ .ywrapstep = 0, -+ .accel = FB_ACCEL_NONE, -+ .line_length = 16, -+}; -+ -+static struct fb_var_screeninfo rpisense_fb_var = { -+ .xres = 8, -+ .yres = 8, -+ .xres_virtual = 8, -+ .yres_virtual = 8, -+ .bits_per_pixel = 16, -+ .red = {11, 5, 0}, -+ .green = {5, 6, 0}, -+ .blue = {0, 5, 0}, -+}; -+ -+static ssize_t rpisense_fb_write(struct fb_info *info, -+ const char __user *buf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t res = fb_sys_write(info, buf, count, ppos); -+ -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return res; -+} -+ -+static void rpisense_fb_fillrect(struct fb_info *info, -+ const struct fb_fillrect *rect) -+{ -+ sys_fillrect(info, rect); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_copyarea(struct fb_info *info, -+ const struct fb_copyarea *area) -+{ -+ sys_copyarea(info, area); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_imageblit(struct fb_info *info, -+ const struct fb_image *image) -+{ -+ sys_imageblit(info, image); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_deferred_io(struct fb_info *info, -+ struct list_head *pagelist) -+{ -+ int i; -+ int j; -+ u8 *vmem_work = rpisense_fb_param.vmem_work; -+ u16 *mem = (u16 *)rpisense_fb_param.vmem; -+ u8 *gamma = rpisense_fb_param.gamma; -+ -+ vmem_work[0] = 0; -+ for (j = 0; j < 8; j++) { -+ for (i = 0; i < 8; i++) { -+ vmem_work[(j * 24) + i + 1] = -+ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; -+ vmem_work[(j * 24) + (i + 8) + 1] = -+ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; -+ vmem_work[(j * 24) + (i + 16) + 1] = -+ gamma[(mem[(j * 8) + i]) & 0x1F]; -+ } -+ } -+ rpisense_block_write(rpisense, vmem_work, 193); -+} -+ -+static struct fb_deferred_io rpisense_fb_defio = { -+ .delay = HZ/100, -+ .deferred_io = rpisense_fb_deferred_io, -+}; -+ -+static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, -+ unsigned long arg) -+{ -+ switch (cmd) { -+ case SENSEFB_FBIOGET_GAMMA: -+ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ return 0; -+ case SENSEFB_FBIOSET_GAMMA: -+ if (copy_from_user(gamma_user, (void __user *)arg, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ rpisense_fb_param.gamma = gamma_user; -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ return 0; -+ case SENSEFB_FBIORESET_GAMMA: -+ switch (arg) { -+ case 0: -+ rpisense_fb_param.gamma = gamma_default; -+ break; -+ case 1: -+ rpisense_fb_param.gamma = gamma_low; -+ break; -+ case 2: -+ rpisense_fb_param.gamma = gamma_user; -+ break; -+ default: -+ return -EINVAL; -+ } -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static struct fb_ops rpisense_fb_ops = { -+ .owner = THIS_MODULE, -+ .fb_read = fb_sys_read, -+ .fb_write = rpisense_fb_write, -+ .fb_fillrect = rpisense_fb_fillrect, -+ .fb_copyarea = rpisense_fb_copyarea, -+ .fb_imageblit = rpisense_fb_imageblit, -+ .fb_ioctl = rpisense_fb_ioctl, -+}; -+ -+static int rpisense_fb_probe(struct platform_device *pdev) -+{ -+ struct fb_info *info; -+ int ret = -ENOMEM; -+ struct rpisense_fb *rpisense_fb; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_fb = &rpisense->framebuffer; -+ -+ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); -+ if (!rpisense_fb_param.vmem) -+ return ret; -+ -+ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); -+ if (!rpisense_fb_param.vmem_work) -+ goto err_malloc; -+ -+ info = framebuffer_alloc(0, &pdev->dev); -+ if (!info) { -+ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); -+ goto err_malloc; -+ } -+ rpisense_fb->info = info; -+ -+ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; -+ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; -+ -+ info->fbops = &rpisense_fb_ops; -+ info->fix = rpisense_fb_fix; -+ info->var = rpisense_fb_var; -+ info->fbdefio = &rpisense_fb_defio; -+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; -+ info->screen_base = rpisense_fb_param.vmem; -+ info->screen_size = rpisense_fb_param.vmemsize; -+ -+ if (lowlight) -+ rpisense_fb_param.gamma = gamma_low; -+ -+ fb_deferred_io_init(info); -+ -+ ret = register_framebuffer(info); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "Could not register framebuffer.\n"); -+ goto err_fballoc; -+ } -+ -+ fb_info(info, "%s frame buffer device\n", info->fix.id); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return 0; -+err_fballoc: -+ framebuffer_release(info); -+err_malloc: -+ vfree(rpisense_fb_param.vmem); -+ return ret; -+} -+ -+static int rpisense_fb_remove(struct platform_device *pdev) -+{ -+ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; -+ struct fb_info *info = rpisense_fb->info; -+ -+ if (info) { -+ unregister_framebuffer(info); -+ fb_deferred_io_cleanup(info); -+ framebuffer_release(info); -+ vfree(rpisense_fb_param.vmem); -+ } -+ -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_fb_id[] = { -+ { .compatible = "rpi,rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_fb_id); -+#endif -+ -+static struct platform_device_id rpisense_fb_device_id[] = { -+ { .name = "rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); -+ -+static struct platform_driver rpisense_fb_driver = { -+ .probe = rpisense_fb_probe, -+ .remove = rpisense_fb_remove, -+ .driver = { -+ .name = "rpi-sense-fb", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_fb_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); -+MODULE_AUTHOR("Serge Schneider "); -+MODULE_LICENSE("GPL"); -+ -diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4856aa3c8b0661647ec1b5466d3a8743c02b1ddb ---- /dev/null -+++ b/include/linux/mfd/rpisense/core.h -@@ -0,0 +1,47 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __LINUX_MFD_RPISENSE_CORE_H_ -+#define __LINUX_MFD_RPISENSE_CORE_H_ -+ -+#include -+#include -+ -+/* -+ * Register values. -+ */ -+#define RPISENSE_FB 0x00 -+#define RPISENSE_WAI 0xF0 -+#define RPISENSE_VER 0xF1 -+#define RPISENSE_KEYS 0xF2 -+#define RPISENSE_EE_WP 0xF3 -+ -+#define RPISENSE_ID 's' -+ -+struct rpisense { -+ struct device *dev; -+ struct i2c_client *i2c_client; -+ -+ /* Client devices */ -+ struct rpisense_js joystick; -+ struct rpisense_fb framebuffer; -+}; -+ -+struct rpisense *rpisense_get_dev(void); -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg); -+int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); -+ -+#endif -diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h -new file mode 100644 -index 0000000000000000000000000000000000000000..2ba95d7eebaf9ccce910b43835286df94cb7d075 ---- /dev/null -+++ b/include/linux/mfd/rpisense/framebuffer.h -@@ -0,0 +1,32 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_FB_H_ -+#define __LINUX_RPISENSE_FB_H_ -+ -+#define SENSEFB_FBIO_IOC_MAGIC 0xF1 -+ -+#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) -+#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) -+#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) -+ -+struct rpisense; -+ -+struct rpisense_fb { -+ struct platform_device *pdev; -+ struct fb_info *info; -+}; -+ -+#endif -diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h -new file mode 100644 -index 0000000000000000000000000000000000000000..56196dc2af10e464a1e3f98b028dca1c9c9cff39 ---- /dev/null -+++ b/include/linux/mfd/rpisense/joystick.h -@@ -0,0 +1,35 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_JOYSTICK_H_ -+#define __LINUX_RPISENSE_JOYSTICK_H_ -+ -+#include -+#include -+#include -+#include -+ -+struct rpisense; -+ -+struct rpisense_js { -+ struct platform_device *pdev; -+ struct input_dev *keys_dev; -+ struct gpio_desc *keys_desc; -+ struct work_struct keys_work_s; -+ int keys_irq; -+}; -+ -+ -+#endif - -From 92261bb1ae13c929b053aab7db4cc660d4565511 Mon Sep 17 00:00:00 2001 -From: Florian Meier -Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 065/122] ASoC: Add support for HifiBerry DAC - -This adds a machine driver for the HifiBerry DAC. -It is a sound card that can -be stacked onto the Raspberry Pi. - -Signed-off-by: Florian Meier ---- - sound/soc/bcm/Kconfig | 9 ++- - sound/soc/bcm/Makefile | 4 ++ - sound/soc/bcm/hifiberry_dac.c | 124 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 136 insertions(+), 1 deletion(-) - create mode 100644 sound/soc/bcm/hifiberry_dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index d528aaceaad95bc6bae2147ebe66249629d2512e..ad4817f44072bbc0a92d8a5ebd1b6b365fb4ed82 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -15,4 +15,11 @@ config SND_SOC_CYGNUS - Say Y if you want to add support for ASoC audio on Broadcom - Cygnus chips (bcm958300, bcm958305, bcm911360) - -- If you don't know what to do here, say N. -\ No newline at end of file -+ If you don't know what to do here, say N. -+ -+config SND_BCM2708_SOC_HIFIBERRY_DAC -+ tristate "Support for HifiBerry DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM5102A -+ help -+ Say Y or M if you want to add support for HifiBerry DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index fc739d0078842680802389500dea19334da8fb7b..be80079de3cefbd52f4b78db20ee9a5d554b04c6 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -8,3 +8,7 @@ snd-soc-cygnus-objs := cygnus-pcm.o cygnus-ssp.o - - obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - -+# BCM2708 Machine Support -+snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+ -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..45f2b770ad9e67728ca599a7445d6ae9a01c0c29 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_dac.c -@@ -0,0 +1,124 @@ -+/* -+ * ASoC Driver for HifiBerry DAC -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { -+ .hw_params = snd_rpi_hifiberry_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { -+{ -+ .name = "HifiBerry DAC", -+ .stream_name = "HifiBerry DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm5102a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm5102a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dac_ops, -+ .init = snd_rpi_hifiberry_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dac = { -+ .name = "snd_rpi_hifiberry_dac", -+ .driver_name = "HifiberryDac", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), -+}; -+ -+static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); -+} -+ -+static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); -+ -+static struct platform_driver snd_rpi_hifiberry_dac_driver = { -+ .driver = { -+ .name = "snd-hifiberry-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dac_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dac_probe, -+ .remove = snd_rpi_hifiberry_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_hifiberry_dac_driver); -+ -+MODULE_AUTHOR("Florian Meier "); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); -+MODULE_LICENSE("GPL v2"); - -From b6df383dd105286109669674cf79c61b5f88bba9 Mon Sep 17 00:00:00 2001 -From: Florian Meier -Date: Mon, 25 Jan 2016 15:48:59 +0000 -Subject: [PATCH 066/122] ASoC: Add support for Rpi-DAC - ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-dac.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/Kconfig | 5 ++ - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++ - 6 files changed, 204 insertions(+) - create mode 100644 sound/soc/bcm/rpi-dac.c - create mode 100644 sound/soc/codecs/pcm1794a.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index ad4817f44072bbc0a92d8a5ebd1b6b365fb4ed82..8209fffdc0be3136a99cbab4e5152759aa95594b 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -23,3 +23,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - select SND_SOC_PCM5102A - help - Say Y or M if you want to add support for HifiBerry DAC. -+ -+config SND_BCM2708_SOC_RPI_DAC -+ tristate "Support for RPi-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM1794A -+ help -+ Say Y or M if you want to add support for RPi-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index be80079de3cefbd52f4b78db20ee9a5d554b04c6..09501910f8152b8d516e098433339b5fc2640d0f 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,5 +10,7 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..59dc89ecabc082c0a1ed8adacdc4f0f1337a1c73 ---- /dev/null -+++ b/sound/soc/bcm/rpi-dac.c -@@ -0,0 +1,119 @@ -+/* -+ * ASoC Driver for RPi-DAC. -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} -+ -+static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_rpi_dac_ops = { -+ .hw_params = snd_rpi_rpi_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { -+{ -+ .name = "RPi-DAC", -+ .stream_name = "RPi-DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm1794a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm1794a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_rpi_dac_ops, -+ .init = snd_rpi_rpi_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_rpi_dac = { -+ .name = "snd_rpi_rpi_dac", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_rpi_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), -+}; -+ -+static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_rpi_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_rpi_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_rpi_dac); -+} -+ -+static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { -+ { .compatible = "rpi,rpi-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); -+ -+static struct platform_driver snd_rpi_rpi_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_rpi_dac_of_match, -+ }, -+ .probe = snd_rpi_rpi_dac_probe, -+ .remove = snd_rpi_rpi_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_rpi_dac_driver); -+ -+MODULE_AUTHOR("Florian Meier "); -+MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index c67667bb970f1729db65b027dd8e963b9ee95b7b..74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -98,6 +98,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_PCM1681 if I2C - select SND_SOC_PCM179X_I2C if I2C - select SND_SOC_PCM179X_SPI if SPI_MASTER -+ select SND_SOC_PCM1794A if I2C - select SND_SOC_PCM3008 - select SND_SOC_PCM3168A_I2C if I2C - select SND_SOC_PCM3168A_SPI if SPI_MASTER -@@ -689,6 +690,10 @@ config SND_SOC_RT5616 - tristate "Realtek RT5616 CODEC" - depends on I2C - -+config SND_SOC_PCM1794A -+ tristate -+ depends on I2C -+ - config SND_SOC_RT5631 - tristate "Realtek ALC5631/RT5631 CODEC" - depends on I2C -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 958cd4912fbc9820f965c0d2f38692857f410d3a..77786e7f44a7fa22d9b5beed3eb687e2b7a28526 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -93,6 +93,7 @@ snd-soc-pcm1681-objs := pcm1681.o - snd-soc-pcm179x-codec-objs := pcm179x.o - snd-soc-pcm179x-i2c-objs := pcm179x-i2c.o - snd-soc-pcm179x-spi-objs := pcm179x-spi.o -+snd-soc-pcm1794a-objs := pcm1794a.o - snd-soc-pcm3008-objs := pcm3008.o - snd-soc-pcm3168a-objs := pcm3168a.o - snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o -@@ -325,6 +326,7 @@ obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o - 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_PCM1794A) += snd-soc-pcm1794a.o - obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o - obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o - obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o -diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c -new file mode 100644 -index 0000000000000000000000000000000000000000..afe1b419582aa40c4b2729d242bb13cd843e17f4 ---- /dev/null -+++ b/sound/soc/codecs/pcm1794a.c -@@ -0,0 +1,69 @@ -+/* -+ * Driver for the PCM1794A codec -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+ -+#include -+#include -+#include -+ -+#include -+ -+static struct snd_soc_dai_driver pcm1794a_dai = { -+ .name = "pcm1794a-hifi", -+ .playback = { -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE -+ }, -+}; -+ -+static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; -+ -+static int pcm1794a_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, -+ &pcm1794a_dai, 1); -+} -+ -+static int pcm1794a_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} -+ -+static const struct of_device_id pcm1794a_of_match[] = { -+ { .compatible = "ti,pcm1794a", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, pcm1794a_of_match); -+ -+static struct platform_driver pcm1794a_codec_driver = { -+ .probe = pcm1794a_probe, -+ .remove = pcm1794a_remove, -+ .driver = { -+ .name = "pcm1794a-codec", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(pcm1794a_of_match), -+ }, -+}; -+ -+module_platform_driver(pcm1794a_codec_driver); -+ -+MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); -+MODULE_AUTHOR("Florian Meier "); -+MODULE_LICENSE("GPL v2"); - -From 32447fa52c6b39d4447c53b0a7ae8a2096ee901e Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 067/122] ASoC: wm8804: Implement MCLK configuration options, - add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs - for most sample rates. At 192kHz only 128xfs is supported. The existing - driver selects 128xfs automatically for some lower samples rates. By using an - additional mclk_div divider, it is now possible to control the behaviour. - This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It - should allow lower jitter and better signal quality. The behavior has to be - controlled by the sound card driver, because some sample frequency share the - same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only - difference is the MCLK divider. - -This also added support for 32bit data. - -Signed-off-by: Daniel Matuschek ---- - sound/soc/codecs/wm8804.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c -index af95d648265b3e92e345101542b332aee35191d4..513f56ba132929662802d15cdc653af3d059a39c 100644 ---- a/sound/soc/codecs/wm8804.c -+++ b/sound/soc/codecs/wm8804.c -@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, - blen = 0x1; - break; - case 24: -+ case 32: - blen = 0x2; - break; - default: -@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { - }; - - #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ -- SNDRV_PCM_FMTBIT_S24_LE) -+ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) - - #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -@@ -543,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { - }; - - static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { -- .idle_bias_off = true, -+ .idle_bias_off = false, - - .component_driver = { - .dapm_widgets = wm8804_dapm_widgets, - -From cd919b3554a2544cf2600822593b6057d4297316 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 068/122] ASoC: BCM:Add support for HiFiBerry Digi. Driver is - based on the patched WM8804 driver. - -Signed-off-by: Daniel Matuschek - -Add a parameter to turn off SPDIF output if no audio is playing - -This patch adds the paramater auto_shutdown_output to the kernel module. -Default behaviour of the module is the same, but when auto_shutdown_output -is set to 1, the SPDIF oputput will shutdown if no stream is playing. - -bugfix for 32kHz sample rate, was missing - -HiFiBerry Digi: set SPDIF status bits for sample rate - -The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. -While this is optional, some DACs and receivers do not accept this signal. This patch -adds the sample rate bits in the SPDIF status block. - -Added HiFiBerry Digi+ Pro driver - -Signed-off-by: Daniel Matuschek ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_digi.c | 276 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 285 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8209fffdc0be3136a99cbab4e5152759aa95594b..3cd4288a1e1c535210b01cd9561128fd4ea3e87f 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -24,6 +24,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DIGI -+ tristate "Support for HifiBerry Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. -+ - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 09501910f8152b8d516e098433339b5fc2640d0f..862f00fb43bfb0b8dc75d577df47ea4e8336d00a 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,7 +10,9 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..19dc953b7227ba86123fc7a2ba654499e0c581c5 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_digi.c -@@ -0,0 +1,276 @@ -+/* -+ * ASoC Driver for HifiBerry Digi -+ * -+ * Author: Daniel Matuschek -+ * based on the HifiBerry DAC driver by Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static short int auto_shutdown_output = 0; -+module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); -+ -+#define CLK_44EN_RATE 22579200UL -+#define CLK_48EN_RATE 24576000UL -+ -+static bool snd_rpi_hifiberry_is_digipro; -+static struct gpio_desc *snd_rpi_hifiberry_clk44gpio; -+static struct gpio_desc *snd_rpi_hifiberry_clk48gpio; -+ -+static int samplerate=44100; -+ -+static uint32_t snd_rpi_hifiberry_digi_enable_clock(int sample_rate) -+{ -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk44gpio, 1); -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk48gpio, 0); -+ return CLK_44EN_RATE; -+ default: -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk48gpio, 1); -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk44gpio, 0); -+ return CLK_48EN_RATE; -+ } -+} -+ -+ -+static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Initialize Digi+ Pro hardware */ -+ if (snd_rpi_hifiberry_is_digipro) { -+ struct snd_soc_dai_link *dai = rtd->dai_link; -+ -+ dai->name = "HiFiBerry Digi+ Pro"; -+ dai->stream_name = "HiFiBerry Digi+ Pro HiFi"; -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} -+ -+static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { -+ /* turn off output */ -+ if (auto_shutdown_output) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} -+ -+ -+static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq=0; -+ int mclk_div=1; -+ int sampling_freq=1; -+ -+ int ret; -+ -+ samplerate = params_rate(params); -+ -+ if (samplerate<=96000) { -+ mclk_freq=samplerate*256; -+ mclk_div=WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq=samplerate*128; -+ mclk_div=WM8804_MCLKDIV_128FS; -+ } -+ -+ if (snd_rpi_hifiberry_is_digipro) -+ sysclk = snd_rpi_hifiberry_digi_enable_clock(samplerate); -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { -+ .hw_params = snd_rpi_hifiberry_digi_hw_params, -+ .startup = snd_rpi_hifiberry_digi_startup, -+ .shutdown = snd_rpi_hifiberry_digi_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { -+{ -+ .name = "HifiBerry Digi", -+ .stream_name = "HifiBerry Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_hifiberry_digi_ops, -+ .init = snd_rpi_hifiberry_digi_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_digi = { -+ .name = "snd_rpi_hifiberry_digi", -+ .driver_name = "HifiberryDigi", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), -+}; -+ -+static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_digi.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ snd_rpi_hifiberry_is_digipro = 1; -+ -+ snd_rpi_hifiberry_clk44gpio = -+ devm_gpiod_get(&pdev->dev, "clock44", GPIOD_OUT_LOW); -+ if (IS_ERR(snd_rpi_hifiberry_clk44gpio)) -+ snd_rpi_hifiberry_is_digipro = 0; -+ -+ snd_rpi_hifiberry_clk48gpio = -+ devm_gpiod_get(&pdev->dev, "clock48", GPIOD_OUT_LOW); -+ if (IS_ERR(snd_rpi_hifiberry_clk48gpio)) -+ snd_rpi_hifiberry_is_digipro = 0; -+ -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); -+} -+ -+static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); -+ -+static struct platform_driver snd_rpi_hifiberry_digi_driver = { -+ .driver = { -+ .name = "snd-hifiberry-digi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_digi_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_digi_probe, -+ .remove = snd_rpi_hifiberry_digi_remove, -+}; -+ -+module_platform_driver(snd_rpi_hifiberry_digi_driver); -+ -+MODULE_AUTHOR("Daniel Matuschek "); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); -+MODULE_LICENSE("GPL v2"); - -From 9c1f52bc905674a484e6b9c5e91fbef279890c68 Mon Sep 17 00:00:00 2001 -From: Gordon Garrity -Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 069/122] Add IQaudIO Sound Card support for Raspberry Pi - -Set a limit of 0dB on Digital Volume Control - -The main volume control in the PCM512x DAC has a range up to -+24dB. This is dangerously loud and can potentially cause massive -clipping in the output stages. Therefore this sets a sensible -limit of 0dB for this control. - -Allow up to 24dB digital gain to be applied when using IQAudIO DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. - -Modify IQAudIO DAC+ ASoC driver to set card/dai config from dt - -Add the ability to set the card name, dai name and dai stream name, from -dt config. - -Signed-off-by: DigitalDreamtime - -IQaudIO: auto-mute for AMP+ and DigiAMP+ - -IQAudIO amplifier mute via GPIO22. Add dt params for "one-shot" unmute -and auto mute. - -Revision 2, auto mute implementing HiassofT suggestion to mute/unmute -using set_bias_level, rather than startup/shutdown.... -"By default DAPM waits 5 seconds (pmdown_time) before shutting down -playback streams so a close/stop immediately followed by open/start -doesn't trigger an amp mute+unmute." - -Tested on both AMP+ (via DAC+) and DigiAMP+, with both options... - -dtoverlay=iqaudio-dacplus,unmute_amp - "one-shot" unmute when kernel module loads. - -dtoverlay=iqaudio-dacplus,auto_mute_amp - Unmute amp when ALSA device opened by a client. Mute, with 5 second delay - when ALSA device closed. (Re-opening the device within the 5 second close - window, will cancel mute.) - -Revision 4, using gpiod. - -Revision 5, clean-up formatting before adding mute code. - - Convert tab plus 4 space formatting to 2x tab - - Remove '// NOT USED' commented code - -Revision 6, don't attempt to "one-shot" unmute amp, unless card is -successfully registered. - -Signed-off-by: DigitalDreamtime ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/iqaudio-dac.c | 234 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 243 insertions(+) - create mode 100644 sound/soc/bcm/iqaudio-dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 3cd4288a1e1c535210b01cd9561128fd4ea3e87f..8272ba5302b1ddbd9c21ee50891d3cb0f0303c58 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -37,3 +37,10 @@ config SND_BCM2708_SOC_RPI_DAC - select SND_SOC_PCM1794A - help - Say Y or M if you want to add support for RPi-DAC. -+ -+config SND_BCM2708_SOC_IQAUDIO_DAC -+ tristate "Support for IQaudIO-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for IQaudIO-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 862f00fb43bfb0b8dc75d577df47ea4e8336d00a..fcac518ca9b46ab2074fc859b8d2f1ff850ebc19 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,7 +12,9 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4e8e6dec14bcf4a1ff286c43742d4097249d6777 ---- /dev/null -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -0,0 +1,234 @@ -+/* -+ * ASoC Driver for IQaudIO DAC -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static bool digital_gain_0db_limit = true; -+ -+static struct gpio_desc *mute_gpio; -+ -+static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+static void snd_rpi_iqaudio_gpio_mute(struct snd_soc_card *card) -+{ -+ if (mute_gpio) { -+ dev_info(card->dev, "%s: muting amp using GPIO22\n", -+ __func__); -+ gpiod_set_value_cansleep(mute_gpio, 0); -+ } -+} -+ -+static void snd_rpi_iqaudio_gpio_unmute(struct snd_soc_card *card) -+{ -+ if (mute_gpio) { -+ dev_info(card->dev, "%s: un-muting amp using GPIO22\n", -+ __func__); -+ gpiod_set_value_cansleep(mute_gpio, 1); -+ } -+} -+ -+static int snd_rpi_iqaudio_set_bias_level(struct snd_soc_card *card, -+ struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) -+{ -+ struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; -+ -+ if (dapm->dev != codec_dai->dev) -+ return 0; -+ -+ switch (level) { -+ case SND_SOC_BIAS_PREPARE: -+ if (dapm->bias_level != SND_SOC_BIAS_STANDBY) -+ break; -+ -+ /* UNMUTE AMP */ -+ snd_rpi_iqaudio_gpio_unmute(card); -+ -+ break; -+ case SND_SOC_BIAS_STANDBY: -+ if (dapm->bias_level != SND_SOC_BIAS_PREPARE) -+ break; -+ -+ /* MUTE AMP */ -+ snd_rpi_iqaudio_gpio_mute(card); -+ -+ break; -+ default: -+ break; -+ } -+ -+ return 0; -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { -+ .hw_params = snd_rpi_iqaudio_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { -+{ -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_iqaudio_dac_ops, -+ .init = snd_rpi_iqaudio_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_iqaudio_dac = { -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_iqaudio_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), -+}; -+ -+static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ bool gpio_unmute = false; -+ -+ snd_rpi_iqaudio_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_card *card = &snd_rpi_iqaudio_dac; -+ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; -+ bool auto_gpio_mute = false; -+ -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "iqaudio,24db_digital_gain"); -+ -+ if (of_property_read_string(pdev->dev.of_node, "card_name", -+ &card->name)) -+ card->name = "IQaudIODAC"; -+ -+ if (of_property_read_string(pdev->dev.of_node, "dai_name", -+ &dai->name)) -+ dai->name = "IQaudIO DAC"; -+ -+ if (of_property_read_string(pdev->dev.of_node, -+ "dai_stream_name", &dai->stream_name)) -+ dai->stream_name = "IQaudIO DAC HiFi"; -+ -+ /* gpio_unmute - one time unmute amp using GPIO */ -+ gpio_unmute = of_property_read_bool(pdev->dev.of_node, -+ "iqaudio-dac,unmute-amp"); -+ -+ /* auto_gpio_mute - mute/unmute amp using GPIO */ -+ auto_gpio_mute = of_property_read_bool(pdev->dev.of_node, -+ "iqaudio-dac,auto-mute-amp"); -+ -+ if (auto_gpio_mute || gpio_unmute) { -+ mute_gpio = devm_gpiod_get_optional(&pdev->dev, "mute", -+ GPIOD_OUT_LOW); -+ if (IS_ERR(mute_gpio)) { -+ ret = PTR_ERR(mute_gpio); -+ dev_err(&pdev->dev, -+ "Failed to get mute gpio: %d\n", ret); -+ return ret; -+ } -+ -+ if (auto_gpio_mute && mute_gpio) -+ snd_rpi_iqaudio_dac.set_bias_level = -+ snd_rpi_iqaudio_set_bias_level; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ return ret; -+ } -+ -+ if (gpio_unmute && mute_gpio) -+ snd_rpi_iqaudio_gpio_unmute(&snd_rpi_iqaudio_dac); -+ -+ return 0; -+} -+ -+static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) -+{ -+ snd_rpi_iqaudio_gpio_mute(&snd_rpi_iqaudio_dac); -+ -+ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); -+} -+ -+static const struct of_device_id iqaudio_of_match[] = { -+ { .compatible = "iqaudio,iqaudio-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, iqaudio_of_match); -+ -+static struct platform_driver snd_rpi_iqaudio_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-iqaudio-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = iqaudio_of_match, -+ }, -+ .probe = snd_rpi_iqaudio_dac_probe, -+ .remove = snd_rpi_iqaudio_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_iqaudio_dac_driver); -+ -+MODULE_AUTHOR("Florian Meier "); -+MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); -+MODULE_LICENSE("GPL v2"); - -From fef54ca8d87499607d6cb086210e44126b304f6d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 25 Jul 2016 17:06:50 +0100 -Subject: [PATCH 070/122] iqaudio-dac: Compile fix - untested - ---- - sound/soc/bcm/iqaudio-dac.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -index 4e8e6dec14bcf4a1ff286c43742d4097249d6777..aa15bc4b49ca95edec905fddd8fd0a6d839ca627 100644 ---- a/sound/soc/bcm/iqaudio-dac.c -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -76,7 +76,11 @@ static void snd_rpi_iqaudio_gpio_unmute(struct snd_soc_card *card) - static int snd_rpi_iqaudio_set_bias_level(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) - { -- struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; -+ struct snd_soc_pcm_runtime *rtd; -+ struct snd_soc_dai *codec_dai; -+ -+ rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); -+ codec_dai = rtd->codec_dai; - - if (dapm->dev != codec_dai->dev) - return 0; - -From 31bee6011867bb7a1846d35901b080a208669515 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 071/122] Added support for HiFiBerry DAC+ - -The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses -a different codec chip (PCM5122), therefore a new driver is necessary. - -Add support for the HiFiBerry DAC+ Pro. - -The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. - -An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. - -Limit PCM512x "Digital" gain to 0dB by default with HiFiBerry DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. - -Add dt param to force HiFiBerry DAC+ Pro into slave mode - -"dtoverlay=hifiberry-dacplus,slave" - -Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode, -with Pi as master for bit and frame clock. - -Signed-off-by: DigitalDreamtime ---- - drivers/clk/Makefile | 1 + - drivers/clk/clk-hifiberry-dacpro.c | 160 +++++++++++++++++ - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_dacplus.c | 359 +++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/pcm512x.c | 3 +- - 6 files changed, 531 insertions(+), 1 deletion(-) - create mode 100644 drivers/clk/clk-hifiberry-dacpro.c - create mode 100644 sound/soc/bcm/hifiberry_dacplus.c - -diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile -index 925081ec14c04935e1eb17bf2709640c7ae3ae10..2b6fcd8abf79da77aa85fdc53512aafd09f836cb 100644 ---- a/drivers/clk/Makefile -+++ b/drivers/clk/Makefile -@@ -26,6 +26,7 @@ obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o - obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o - obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o - obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o - obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o - obj-$(CONFIG_ARCH_MB86S7X) += clk-mb86s7x.o - obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o -diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c -new file mode 100644 -index 0000000000000000000000000000000000000000..99cee2b1706c43170b4fc35c0023349b9019606c ---- /dev/null -+++ b/drivers/clk/clk-hifiberry-dacpro.c -@@ -0,0 +1,160 @@ -+/* -+ * Clock Driver for HiFiBerry DAC Pro -+ * -+ * Author: Stuart MacLean -+ * Copyright 2015 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL -+ -+/** -+ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro -+ * @hw: clk_hw for the common clk framework -+ * @mode: 0 => CLK44EN, 1 => CLK48EN -+ */ -+struct clk_hifiberry_hw { -+ struct clk_hw hw; -+ uint8_t mode; -+}; -+ -+#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) -+ -+static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { -+ { .compatible = "hifiberry,dacpro-clk",}, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); -+ -+static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : -+ CLK_48EN_RATE; -+} -+ -+static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long *parent_rate) -+{ -+ long actual_rate; -+ -+ if (rate <= CLK_44EN_RATE) { -+ actual_rate = (long)CLK_44EN_RATE; -+ } else if (rate >= CLK_48EN_RATE) { -+ actual_rate = (long)CLK_48EN_RATE; -+ } else { -+ long diff44Rate = (long)(rate - CLK_44EN_RATE); -+ long diff48Rate = (long)(CLK_48EN_RATE - rate); -+ -+ if (diff44Rate < diff48Rate) -+ actual_rate = (long)CLK_44EN_RATE; -+ else -+ actual_rate = (long)CLK_48EN_RATE; -+ } -+ return actual_rate; -+} -+ -+ -+static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long parent_rate) -+{ -+ unsigned long actual_rate; -+ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); -+ -+ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, -+ &parent_rate); -+ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; -+ return 0; -+} -+ -+ -+const struct clk_ops clk_hifiberry_dacpro_rate_ops = { -+ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, -+ .round_rate = clk_hifiberry_dacpro_round_rate, -+ .set_rate = clk_hifiberry_dacpro_set_rate, -+}; -+ -+static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct clk_hifiberry_hw *proclk; -+ struct clk *clk; -+ struct device *dev; -+ struct clk_init_data init; -+ -+ dev = &pdev->dev; -+ -+ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); -+ if (!proclk) -+ return -ENOMEM; -+ -+ init.name = "clk-hifiberry-dacpro"; -+ init.ops = &clk_hifiberry_dacpro_rate_ops; -+ init.flags = CLK_IS_BASIC; -+ init.parent_names = NULL; -+ init.num_parents = 0; -+ -+ proclk->mode = 0; -+ proclk->hw.init = &init; -+ -+ clk = devm_clk_register(dev, &proclk->hw); -+ if (!IS_ERR(clk)) { -+ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, -+ clk); -+ } else { -+ dev_err(dev, "Fail to register clock driver\n"); -+ kfree(proclk); -+ ret = PTR_ERR(clk); -+ } -+ return ret; -+} -+ -+static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) -+{ -+ of_clk_del_provider(pdev->dev.of_node); -+ return 0; -+} -+ -+static struct platform_driver clk_hifiberry_dacpro_driver = { -+ .probe = clk_hifiberry_dacpro_probe, -+ .remove = clk_hifiberry_dacpro_remove, -+ .driver = { -+ .name = "clk-hifiberry-dacpro", -+ .of_match_table = clk_hifiberry_dacpro_dt_ids, -+ }, -+}; -+ -+static int __init clk_hifiberry_dacpro_init(void) -+{ -+ return platform_driver_register(&clk_hifiberry_dacpro_driver); -+} -+core_initcall(clk_hifiberry_dacpro_init); -+ -+static void __exit clk_hifiberry_dacpro_exit(void) -+{ -+ platform_driver_unregister(&clk_hifiberry_dacpro_driver); -+} -+module_exit(clk_hifiberry_dacpro_exit); -+ -+MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:clk-hifiberry-dacpro"); -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8272ba5302b1ddbd9c21ee50891d3cb0f0303c58..4473cc728097bda0ce9fe68d4a9da348ec41f8b3 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -24,6 +24,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DACPLUS -+ tristate "Support for HifiBerry DAC+" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x -+ help -+ Say Y or M if you want to add support for HifiBerry DAC+. -+ - config SND_BCM2708_SOC_HIFIBERRY_DIGI - tristate "Support for HifiBerry Digi" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index fcac518ca9b46ab2074fc859b8d2f1ff850ebc19..203afc03167acbcad15e836209956bc5ab151157 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,11 +10,13 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -new file mode 100644 -index 0000000000000000000000000000000000000000..bdc35e7e6bc12dc1cf04f5ffad8f9ab49a0b0266 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -0,0 +1,359 @@ -+/* -+ * ASoC Driver for HiFiBerry DAC+ / DAC Pro -+ * -+ * Author: Daniel Matuschek, Stuart MacLean -+ * Copyright 2014-2015 -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/pcm512x.h" -+ -+#define HIFIBERRY_DACPRO_NOCLOCK 0 -+#define HIFIBERRY_DACPRO_CLK44EN 1 -+#define HIFIBERRY_DACPRO_CLK48EN 2 -+ -+struct pcm512x_priv { -+ struct regmap *regmap; -+ struct clk *sclk; -+}; -+ -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL -+ -+static bool slave; -+static bool snd_rpi_hifiberry_is_dacpro; -+static bool digital_gain_0db_limit = true; -+ -+static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, -+ int clk_id) -+{ -+ switch (clk_id) { -+ case HIFIBERRY_DACPRO_NOCLOCK: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); -+ break; -+ case HIFIBERRY_DACPRO_CLK44EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); -+ break; -+ case HIFIBERRY_DACPRO_CLK48EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); -+ break; -+ } -+} -+ -+static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) -+{ -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); -+} -+ -+static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) -+{ -+ int sck; -+ -+ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); -+ return (!(sck & 0x40)); -+} -+ -+static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( -+ struct snd_soc_codec *codec) -+{ -+ msleep(2); -+ return snd_rpi_hifiberry_dacplus_is_sclk(codec); -+} -+ -+static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) -+{ -+ bool isClk44EN, isClk48En, isNoClk; -+ -+ snd_rpi_hifiberry_dacplus_clk_gpio(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); -+ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); -+ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); -+ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ return (isClk44EN && isClk48En && !isNoClk); -+} -+ -+static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) -+{ -+ int type; -+ -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ type = HIFIBERRY_DACPRO_CLK44EN; -+ break; -+ default: -+ type = HIFIBERRY_DACPRO_CLK48EN; -+ break; -+ } -+ return type; -+} -+ -+static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, -+ int sample_rate) -+{ -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); -+ -+ if (!IS_ERR(pcm512x->sclk)) { -+ int ctype; -+ -+ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); -+ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) -+ ? CLK_44EN_RATE : CLK_48EN_RATE); -+ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); -+ } -+} -+ -+static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *priv; -+ -+ if (slave) -+ snd_rpi_hifiberry_is_dacpro = false; -+ else -+ snd_rpi_hifiberry_is_dacpro = -+ snd_rpi_hifiberry_dacplus_is_pro_card(codec); -+ -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_dai_link *dai = rtd->dai_link; -+ -+ dai->name = "HiFiBerry DAC+ Pro"; -+ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; -+ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM; -+ -+ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); -+ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); -+ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); -+ } else { -+ priv = snd_soc_codec_get_drvdata(codec); -+ priv->sclk = ERR_PTR(-ENOENT); -+ } -+ -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); -+ -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dacplus_update_rate_den( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); -+ struct snd_ratnum *rats_no_pll; -+ unsigned int num = 0, den = 0; -+ int err; -+ -+ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); -+ if (!rats_no_pll) -+ return -ENOMEM; -+ -+ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; -+ rats_no_pll->den_min = 1; -+ rats_no_pll->den_max = 128; -+ rats_no_pll->den_step = 1; -+ -+ err = snd_interval_ratnum(hw_param_interval(params, -+ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); -+ if (err >= 0 && den) { -+ params->rate_num = num; -+ params->rate_den = den; -+ } -+ -+ devm_kfree(rtd->dev, rats_no_pll); -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( -+ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) -+{ -+ int bratio = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); -+} -+ -+static int snd_rpi_hifiberry_dacplus_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ int ret; -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_rpi_hifiberry_dacplus_set_sclk(codec, -+ params_rate(params)); -+ -+ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, -+ params); -+ if (!ret) -+ ret = snd_rpi_hifiberry_dacplus_update_rate_den( -+ substream, params); -+ } else { -+ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+ } -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_dacplus_startup( -+ struct snd_pcm_substream *substream) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); -+ return 0; -+} -+ -+static void snd_rpi_hifiberry_dacplus_shutdown( -+ struct snd_pcm_substream *substream) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { -+ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, -+ .startup = snd_rpi_hifiberry_dacplus_startup, -+ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { -+{ -+ .name = "HiFiBerry DAC+", -+ .stream_name = "HiFiBerry DAC+ HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004d", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dacplus_ops, -+ .init = snd_rpi_hifiberry_dacplus_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dacplus = { -+ .name = "snd_rpi_hifiberry_dacplus", -+ .driver_name = "HifiberryDacp", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_dacplus_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), -+}; -+ -+static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai; -+ -+ dai = &snd_rpi_hifiberry_dacplus_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "hifiberry,24db_digital_gain"); -+ slave = of_property_read_bool(pdev->dev.of_node, -+ "hifiberry-dacplus,slave"); -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); -+} -+ -+static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dacplus", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); -+ -+static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { -+ .driver = { -+ .name = "snd-rpi-hifiberry-dacplus", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dacplus_probe, -+ .remove = snd_rpi_hifiberry_dacplus_remove, -+}; -+ -+module_platform_driver(snd_rpi_hifiberry_dacplus_driver); -+ -+MODULE_AUTHOR("Daniel Matuschek "); -+MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c -index 72b19e62f6267698aea45d2410d616d91c1825cb..c6839ef6e16754ed9de2698507b8986addd822fe 100644 ---- a/sound/soc/codecs/pcm512x.c -+++ b/sound/soc/codecs/pcm512x.c -@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, - int fssp; - int gpio; - -- lrclk_div = snd_soc_params_to_frame_size(params); -+ lrclk_div = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); - if (lrclk_div == 0) { - dev_err(dev, "No LRCLK?\n"); - return -EINVAL; - -From f11ffc75b1a5ba748f160765164337eabea0b6e1 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 072/122] Added driver for HiFiBerry Amp amplifier add-on board - -The driver contains a low-level hardware driver for the TAS5713 and the -drivers for the Raspberry Pi I2S subsystem. - -TAS5713: return error if initialisation fails - -Existing TAS5713 driver logs errors during initialisation, but does not return -an error code. Therefore even if initialisation fails, the driver will still be -loaded, but won't work. This patch fixes this. I2C communication error will now -reported correctly by a non-zero return code. - -HiFiBerry Amp: fix device-tree problems - -Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. ---- - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_amp.c | 129 +++++++++++++++ - sound/soc/codecs/Kconfig | 4 + - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ - 7 files changed, 723 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_amp.c - create mode 100644 sound/soc/codecs/tas5713.c - create mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 4473cc728097bda0ce9fe68d4a9da348ec41f8b3..b1d877407dd69c9bd6b2787b0a559f4113bc21f2 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -38,6 +38,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - -+config SND_BCM2708_SOC_HIFIBERRY_AMP -+ tristate "Support for the HifiBerry Amp" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_TAS5713 -+ help -+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. -+ - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 203afc03167acbcad15e836209956bc5ab151157..a4838e2cf8e93c9285836f95f4151daea33e1bd1 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,11 +12,13 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -+snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d17c29780507dc31c50f1d567ff5cea7c8241ff5 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -0,0 +1,129 @@ -+/* -+ * ASoC Driver for HifiBerry AMP -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ // ToDo: init of the dsp-registers. -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params ) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -+ .hw_params = snd_rpi_hifiberry_amp_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -+ { -+ .name = "HifiBerry AMP", -+ .stream_name = "HifiBerry AMP HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "tas5713-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "tas5713.1-001b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_amp_ops, -+ .init = snd_rpi_hifiberry_amp_init, -+ }, -+}; -+ -+ -+static struct snd_soc_card snd_rpi_hifiberry_amp = { -+ .name = "snd_rpi_hifiberry_amp", -+ .driver_name = "HifiberryAmp", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_amp_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), -+}; -+ -+static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-amp", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); -+ -+ -+static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_amp.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); -+ -+ if (ret != 0) { -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); -+} -+ -+ -+static struct platform_driver snd_rpi_hifiberry_amp_driver = { -+ .driver = { -+ .name = "snd-hifiberry-amp", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_amp_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_amp_probe, -+ .remove = snd_rpi_hifiberry_amp_remove, -+}; -+ -+ -+module_platform_driver(snd_rpi_hifiberry_amp_driver); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b..9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -139,6 +139,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -+ select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4_I2C if I2C -@@ -821,6 +822,9 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - -+config SND_SOC_TAS5713 -+ tristate -+ - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 77786e7f44a7fa22d9b5beed3eb687e2b7a28526..5a2db0d2fe2f49920eeccfecef62c969ae2e99a1 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -144,6 +144,7 @@ snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tas5720-objs := tas5720.o - snd-soc-tfa9879-objs := tfa9879.o -+snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -366,6 +367,7 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o -+obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9b2713861dcbed751842ca29c88eb1eae5867411 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.c -@@ -0,0 +1,369 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "tas5713.h" -+ -+ -+static struct i2c_client *i2c; -+ -+struct tas5713_priv { -+ struct regmap *regmap; -+ int mclk_div; -+ struct snd_soc_codec *codec; -+}; -+ -+static struct tas5713_priv *priv_data; -+ -+ -+ -+ -+/* -+ * _ _ ___ _ ___ _ _ -+ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -+ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -+ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ -+ * -+ */ -+ -+static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); -+ -+ -+static const struct snd_kcontrol_new tas5713_snd_controls[] = { -+ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -+ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) -+}; -+ -+ -+ -+ -+/* -+ * __ __ _ _ ___ _ -+ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -+ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -+ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ u16 blen = 0x00; -+ -+ struct snd_soc_codec *codec; -+ codec = dai->codec; -+ priv_data->codec = dai->codec; -+ -+ switch (params_format(params)) { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ blen = 0x03; -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ blen = 0x1; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ blen = 0x04; -+ break; -+ case SNDRV_PCM_FORMAT_S32_LE: -+ blen = 0x05; -+ break; -+ default: -+ dev_err(dai->dev, "Unsupported word length: %u\n", -+ params_format(params)); -+ return -EINVAL; -+ } -+ -+ // set word length -+ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); -+ -+ return 0; -+} -+ -+ -+static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) -+{ -+ unsigned int val = 0; -+ -+ struct tas5713_priv *tas5713; -+ struct snd_soc_codec *codec = dai->codec; -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ if (mute) { -+ val = TAS5713_SOFT_MUTE_ALL; -+ } -+ -+ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); -+} -+ -+ -+static const struct snd_soc_dai_ops tas5713_dai_ops = { -+ .hw_params = tas5713_hw_params, -+ .mute_stream = tas5713_mute_stream, -+}; -+ -+ -+static struct snd_soc_dai_driver tas5713_dai = { -+ .name = "tas5713-hifi", -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_48000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -+ }, -+ .ops = &tas5713_dai_ops, -+}; -+ -+ -+ -+ -+/* -+ * ___ _ ___ _ -+ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -+ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -+ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_remove(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ return 0; -+} -+ -+ -+static int tas5713_probe(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ int i, ret; -+ -+ i2c = container_of(codec->dev, struct i2c_client, dev); -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Trim oscillator -+ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -+ if (ret < 0) return ret; -+ msleep(1000); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Clock mode: 44/48kHz, MCLK=64xfs -+ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -+ if (ret < 0) return ret; -+ -+ // I2S 24bit -+ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -+ if (ret < 0) return ret; -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -+ if (ret < 0) return ret; -+ -+ // Set volume to 0db -+ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -+ if (ret < 0) return ret; -+ -+ // Now start programming the default initialization sequence -+ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -+ ret = i2c_master_send(i2c, -+ tas5713_init_sequence[i].data, -+ tas5713_init_sequence[i].size); -+ if (ret < 0) { -+ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -+ } -+ } -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ -+ return 0; -+} -+ -+ -+static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -+ .probe = tas5713_probe, -+ .remove = tas5713_remove, -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+}; -+ -+ -+ -+ -+/* -+ * ___ ___ ___ ___ _ -+ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -+ * | | / / (__ | |) | '_| \ V / -_) '_| -+ * |___/___\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static const struct reg_default tas5713_reg_defaults[] = { -+ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -+ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -+ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -+ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB -+}; -+ -+ -+static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case TAS5713_DEVICE_ID: -+ case TAS5713_ERROR_STATUS: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+ -+static const struct of_device_id tas5713_of_match[] = { -+ { .compatible = "ti,tas5713", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, tas5713_of_match); -+ -+ -+static struct regmap_config tas5713_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, -+ -+ .max_register = TAS5713_MAX_REGISTER, -+ .volatile_reg = tas5713_reg_volatile, -+ -+ .cache_type = REGCACHE_RBTREE, -+ .reg_defaults = tas5713_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), -+}; -+ -+ -+static int tas5713_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ -+ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -+ if (!priv_data) -+ return -ENOMEM; -+ -+ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -+ if (IS_ERR(priv_data->regmap)) { -+ ret = PTR_ERR(priv_data->regmap); -+ return ret; -+ } -+ -+ i2c_set_clientdata(i2c, priv_data); -+ -+ ret = snd_soc_register_codec(&i2c->dev, -+ &soc_codec_dev_tas5713, &tas5713_dai, 1); -+ -+ return ret; -+} -+ -+ -+static int tas5713_i2c_remove(struct i2c_client *i2c) -+{ -+ snd_soc_unregister_codec(&i2c->dev); -+ i2c_set_clientdata(i2c, NULL); -+ -+ kfree(priv_data); -+ -+ return 0; -+} -+ -+ -+static const struct i2c_device_id tas5713_i2c_id[] = { -+ { "tas5713", 0 }, -+ { } -+}; -+ -+MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); -+ -+ -+static struct i2c_driver tas5713_i2c_driver = { -+ .driver = { -+ .name = "tas5713", -+ .owner = THIS_MODULE, -+ .of_match_table = tas5713_of_match, -+ }, -+ .probe = tas5713_i2c_probe, -+ .remove = tas5713_i2c_remove, -+ .id_table = tas5713_i2c_id -+}; -+ -+ -+static int __init tas5713_modinit(void) -+{ -+ int ret = 0; -+ -+ ret = i2c_add_driver(&tas5713_i2c_driver); -+ if (ret) { -+ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -+ ret); -+ } -+ -+ return ret; -+} -+module_init(tas5713_modinit); -+ -+ -+static void __exit tas5713_exit(void) -+{ -+ i2c_del_driver(&tas5713_i2c_driver); -+} -+module_exit(tas5713_exit); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for TAS5713"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h -new file mode 100644 -index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8f612a342 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.h -@@ -0,0 +1,210 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#ifndef _TAS5713_H -+#define _TAS5713_H -+ -+ -+// TAS5713 I2C-bus register addresses -+ -+#define TAS5713_CLOCK_CTRL 0x00 -+#define TAS5713_DEVICE_ID 0x01 -+#define TAS5713_ERROR_STATUS 0x02 -+#define TAS5713_SYSTEM_CTRL1 0x03 -+#define TAS5713_SERIAL_DATA_INTERFACE 0x04 -+#define TAS5713_SYSTEM_CTRL2 0x05 -+#define TAS5713_SOFT_MUTE 0x06 -+#define TAS5713_VOL_MASTER 0x07 -+#define TAS5713_VOL_CH1 0x08 -+#define TAS5713_VOL_CH2 0x09 -+#define TAS5713_VOL_HEADPHONE 0x0A -+#define TAS5713_VOL_CONFIG 0x0E -+#define TAS5713_MODULATION_LIMIT 0x10 -+#define TAS5713_IC_DLY_CH1 0x11 -+#define TAS5713_IC_DLY_CH2 0x12 -+#define TAS5713_IC_DLY_CH3 0x13 -+#define TAS5713_IC_DLY_CH4 0x14 -+ -+#define TAS5713_START_STOP_PERIOD 0x1A -+#define TAS5713_OSC_TRIM 0x1B -+#define TAS5713_BKND_ERR 0x1C -+ -+#define TAS5713_INPUT_MUX 0x20 -+#define TAS5713_SRC_SELECT_CH4 0x21 -+#define TAS5713_PWM_MUX 0x25 -+ -+#define TAS5713_CH1_BQ0 0x29 -+#define TAS5713_CH1_BQ1 0x2A -+#define TAS5713_CH1_BQ2 0x2B -+#define TAS5713_CH1_BQ3 0x2C -+#define TAS5713_CH1_BQ4 0x2D -+#define TAS5713_CH1_BQ5 0x2E -+#define TAS5713_CH1_BQ6 0x2F -+#define TAS5713_CH1_BQ7 0x58 -+#define TAS5713_CH1_BQ8 0x59 -+ -+#define TAS5713_CH2_BQ0 0x30 -+#define TAS5713_CH2_BQ1 0x31 -+#define TAS5713_CH2_BQ2 0x32 -+#define TAS5713_CH2_BQ3 0x33 -+#define TAS5713_CH2_BQ4 0x34 -+#define TAS5713_CH2_BQ5 0x35 -+#define TAS5713_CH2_BQ6 0x36 -+#define TAS5713_CH2_BQ7 0x5C -+#define TAS5713_CH2_BQ8 0x5D -+ -+#define TAS5713_CH4_BQ0 0x5A -+#define TAS5713_CH4_BQ1 0x5B -+#define TAS5713_CH3_BQ0 0x5E -+#define TAS5713_CH3_BQ1 0x5F -+ -+#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B -+#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C -+#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E -+#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F -+#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 -+#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 -+#define TAS5713_DRC_CTRL 0x46 -+ -+#define TAS5713_BANK_SW_CTRL 0x50 -+#define TAS5713_CH1_OUTPUT_MIXER 0x51 -+#define TAS5713_CH2_OUTPUT_MIXER 0x52 -+#define TAS5713_CH1_INPUT_MIXER 0x53 -+#define TAS5713_CH2_INPUT_MIXER 0x54 -+#define TAS5713_OUTPUT_POST_SCALE 0x56 -+#define TAS5713_OUTPUT_PRESCALE 0x57 -+ -+#define TAS5713_IDF_POST_SCALE 0x62 -+ -+#define TAS5713_CH1_INLINE_MIXER 0x70 -+#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 -+#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 -+#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 -+#define TAS5713_CH2_INLINE_MIXER 0x74 -+#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 -+#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 -+#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 -+ -+#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 -+#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 -+ -+#define TAS5713_REGISTER_COUNT 0x46 -+#define TAS5713_MAX_REGISTER 0xF9 -+ -+ -+// Bitmasks for registers -+#define TAS5713_SOFT_MUTE_ALL 0x07 -+ -+ -+ -+struct tas5713_init_command { -+ const int size; -+ const char *const data; -+}; -+ -+static const struct tas5713_init_command tas5713_init_sequence[] = { -+ -+ // Trim oscillator -+ { .size = 2, .data = "\x1B\x00" }, -+ // System control register 1 (0x03): block DC -+ { .size = 2, .data = "\x03\x80" }, -+ // Mute everything -+ { .size = 2, .data = "\x05\x40" }, -+ // Modulation limit register (0x10): 97.7% -+ { .size = 2, .data = "\x10\x02" }, -+ // Interchannel delay registers -+ // (0x11, 0x12, 0x13, and 0x14): BD mode -+ { .size = 2, .data = "\x11\xB8" }, -+ { .size = 2, .data = "\x12\x60" }, -+ { .size = 2, .data = "\x13\xA0" }, -+ { .size = 2, .data = "\x14\x48" }, -+ // PWM shutdown group register (0x19): no shutdown -+ { .size = 2, .data = "\x19\x00" }, -+ // Input multiplexer register (0x20): BD mode -+ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -+ // PWM output mux register (0x25) -+ // Channel 1 --> OUTA, channel 1 neg --> OUTB -+ // Channel 2 --> OUTC, channel 2 neg --> OUTD -+ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -+ // DRC control (0x46): DRC off -+ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -+ // BKND_ERR register (0x1C): 299ms reset period -+ { .size = 2, .data = "\x1C\x07" }, -+ // Mute channel 3 -+ { .size = 2, .data = "\x0A\xFF" }, -+ // Volume configuration register (0x0E): volume slew 512 steps -+ { .size = 2, .data = "\x0E\x90" }, -+ // Clock control register (0x00): 44/48kHz, MCLK=64xfs -+ { .size = 2, .data = "\x00\x60" }, -+ // Bank switch and eq control (0x50): no bank switching -+ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -+ // Volume registers (0x07, 0x08, 0x09, 0x0A) -+ { .size = 2, .data = "\x07\x20" }, -+ { .size = 2, .data = "\x08\x30" }, -+ { .size = 2, .data = "\x09\x30" }, -+ { .size = 2, .data = "\x0A\xFF" }, -+ // 0x72, 0x73, 0x76, 0x77 input mixer: -+ // no intermix between channels -+ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -+ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -+ // no inline DRC inmix -+ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -+ // 0x56, 0x57 Output scale -+ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -+ // 0x3B, 0x3c -+ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ // 0x51, 0x52: output mixer -+ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ // PEQ defaults -+ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+}; -+ -+ -+#endif /* _TAS5713_H */ - -From e06a867b4795e7c7e8dd9d13257a77494ea5f610 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 12 Dec 2016 16:26:54 +0000 -Subject: [PATCH 073/122] Revert "Added driver for HiFiBerry Amp amplifier - add-on board" - -This reverts commit 3e6b00833d92a50cbcc9922deb6e1bc8fcdbb587. ---- - sound/soc/bcm/Kconfig | 7 - - sound/soc/bcm/Makefile | 2 - - sound/soc/bcm/hifiberry_amp.c | 129 --------------- - sound/soc/codecs/Kconfig | 4 - - sound/soc/codecs/Makefile | 2 - - sound/soc/codecs/tas5713.c | 369 ------------------------------------------ - sound/soc/codecs/tas5713.h | 210 ------------------------ - 7 files changed, 723 deletions(-) - delete mode 100644 sound/soc/bcm/hifiberry_amp.c - delete mode 100644 sound/soc/codecs/tas5713.c - delete mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index b1d877407dd69c9bd6b2787b0a559f4113bc21f2..4473cc728097bda0ce9fe68d4a9da348ec41f8b3 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -38,13 +38,6 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - --config SND_BCM2708_SOC_HIFIBERRY_AMP -- tristate "Support for the HifiBerry Amp" -- depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -- select SND_SOC_TAS5713 -- help -- Say Y or M if you want to add support for the HifiBerry Amp amplifier board. -- - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a4838e2cf8e93c9285836f95f4151daea33e1bd1..203afc03167acbcad15e836209956bc5ab151157 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,13 +12,11 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o --snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o --obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -deleted file mode 100644 -index d17c29780507dc31c50f1d567ff5cea7c8241ff5..0000000000000000000000000000000000000000 ---- a/sound/soc/bcm/hifiberry_amp.c -+++ /dev/null -@@ -1,129 +0,0 @@ --/* -- * ASoC Driver for HifiBerry AMP -- * -- * Author: Sebastian Eickhoff -- * Copyright 2014 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * version 2 as published by the Free Software Foundation. -- * -- * This program 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. -- */ -- --#include --#include -- --#include --#include --#include --#include --#include -- --static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) --{ -- // ToDo: init of the dsp-registers. -- return 0; --} -- --static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params ) --{ -- struct snd_soc_pcm_runtime *rtd = substream->private_data; -- struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -- -- return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); --} -- --static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -- .hw_params = snd_rpi_hifiberry_amp_hw_params, --}; -- --static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -- { -- .name = "HifiBerry AMP", -- .stream_name = "HifiBerry AMP HiFi", -- .cpu_dai_name = "bcm2708-i2s.0", -- .codec_dai_name = "tas5713-hifi", -- .platform_name = "bcm2708-i2s.0", -- .codec_name = "tas5713.1-001b", -- .dai_fmt = SND_SOC_DAIFMT_I2S | -- SND_SOC_DAIFMT_NB_NF | -- SND_SOC_DAIFMT_CBS_CFS, -- .ops = &snd_rpi_hifiberry_amp_ops, -- .init = snd_rpi_hifiberry_amp_init, -- }, --}; -- -- --static struct snd_soc_card snd_rpi_hifiberry_amp = { -- .name = "snd_rpi_hifiberry_amp", -- .driver_name = "HifiberryAmp", -- .owner = THIS_MODULE, -- .dai_link = snd_rpi_hifiberry_amp_dai, -- .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), --}; -- --static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -- { .compatible = "hifiberry,hifiberry-amp", }, -- {}, --}; --MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); -- -- --static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) --{ -- int ret = 0; -- -- snd_rpi_hifiberry_amp.dev = &pdev->dev; -- -- if (pdev->dev.of_node) { -- struct device_node *i2s_node; -- struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -- i2s_node = of_parse_phandle(pdev->dev.of_node, -- "i2s-controller", 0); -- -- if (i2s_node) { -- dai->cpu_dai_name = NULL; -- dai->cpu_of_node = i2s_node; -- dai->platform_name = NULL; -- dai->platform_of_node = i2s_node; -- } -- } -- -- ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); -- -- if (ret != 0) { -- dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -- } -- -- return ret; --} -- -- --static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) --{ -- return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); --} -- -- --static struct platform_driver snd_rpi_hifiberry_amp_driver = { -- .driver = { -- .name = "snd-hifiberry-amp", -- .owner = THIS_MODULE, -- .of_match_table = snd_rpi_hifiberry_amp_of_match, -- }, -- .probe = snd_rpi_hifiberry_amp_probe, -- .remove = snd_rpi_hifiberry_amp_remove, --}; -- -- --module_platform_driver(snd_rpi_hifiberry_amp_driver); -- -- --MODULE_AUTHOR("Sebastian Eickhoff "); --MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); --MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4..74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -139,7 +139,6 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -- select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4_I2C if I2C -@@ -822,9 +821,6 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - --config SND_SOC_TAS5713 -- tristate -- - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 5a2db0d2fe2f49920eeccfecef62c969ae2e99a1..77786e7f44a7fa22d9b5beed3eb687e2b7a28526 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -144,7 +144,6 @@ snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tas5720-objs := tas5720.o - snd-soc-tfa9879-objs := tfa9879.o --snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -367,7 +366,6 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o --obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -deleted file mode 100644 -index 9b2713861dcbed751842ca29c88eb1eae5867411..0000000000000000000000000000000000000000 ---- a/sound/soc/codecs/tas5713.c -+++ /dev/null -@@ -1,369 +0,0 @@ --/* -- * ASoC Driver for TAS5713 -- * -- * Author: Sebastian Eickhoff -- * Copyright 2014 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * version 2 as published by the Free Software Foundation. -- * -- * This program 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. -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include --#include --#include --#include -- --#include "tas5713.h" -- -- --static struct i2c_client *i2c; -- --struct tas5713_priv { -- struct regmap *regmap; -- int mclk_div; -- struct snd_soc_codec *codec; --}; -- --static struct tas5713_priv *priv_data; -- -- -- -- --/* -- * _ _ ___ _ ___ _ _ -- * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -- * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -- * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ -- * -- */ -- --static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); -- -- --static const struct snd_kcontrol_new tas5713_snd_controls[] = { -- SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -- SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) --}; -- -- -- -- --/* -- * __ __ _ _ ___ _ -- * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -- * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -- * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -- * -- */ -- --static int tas5713_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params, -- struct snd_soc_dai *dai) --{ -- u16 blen = 0x00; -- -- struct snd_soc_codec *codec; -- codec = dai->codec; -- priv_data->codec = dai->codec; -- -- switch (params_format(params)) { -- case SNDRV_PCM_FORMAT_S16_LE: -- blen = 0x03; -- break; -- case SNDRV_PCM_FORMAT_S20_3LE: -- blen = 0x1; -- break; -- case SNDRV_PCM_FORMAT_S24_LE: -- blen = 0x04; -- break; -- case SNDRV_PCM_FORMAT_S32_LE: -- blen = 0x05; -- break; -- default: -- dev_err(dai->dev, "Unsupported word length: %u\n", -- params_format(params)); -- return -EINVAL; -- } -- -- // set word length -- snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); -- -- return 0; --} -- -- --static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) --{ -- unsigned int val = 0; -- -- struct tas5713_priv *tas5713; -- struct snd_soc_codec *codec = dai->codec; -- tas5713 = snd_soc_codec_get_drvdata(codec); -- -- if (mute) { -- val = TAS5713_SOFT_MUTE_ALL; -- } -- -- return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); --} -- -- --static const struct snd_soc_dai_ops tas5713_dai_ops = { -- .hw_params = tas5713_hw_params, -- .mute_stream = tas5713_mute_stream, --}; -- -- --static struct snd_soc_dai_driver tas5713_dai = { -- .name = "tas5713-hifi", -- .playback = { -- .stream_name = "Playback", -- .channels_min = 2, -- .channels_max = 2, -- .rates = SNDRV_PCM_RATE_8000_48000, -- .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -- }, -- .ops = &tas5713_dai_ops, --}; -- -- -- -- --/* -- * ___ _ ___ _ -- * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -- * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -- * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -- * -- */ -- --static int tas5713_remove(struct snd_soc_codec *codec) --{ -- struct tas5713_priv *tas5713; -- -- tas5713 = snd_soc_codec_get_drvdata(codec); -- -- return 0; --} -- -- --static int tas5713_probe(struct snd_soc_codec *codec) --{ -- struct tas5713_priv *tas5713; -- int i, ret; -- -- i2c = container_of(codec->dev, struct i2c_client, dev); -- -- tas5713 = snd_soc_codec_get_drvdata(codec); -- -- // Reset error -- ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -- if (ret < 0) return ret; -- -- // Trim oscillator -- ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -- if (ret < 0) return ret; -- msleep(1000); -- -- // Reset error -- ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -- if (ret < 0) return ret; -- -- // Clock mode: 44/48kHz, MCLK=64xfs -- ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -- if (ret < 0) return ret; -- -- // I2S 24bit -- ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -- if (ret < 0) return ret; -- -- // Unmute -- ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -- if (ret < 0) return ret; -- ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -- if (ret < 0) return ret; -- -- // Set volume to 0db -- ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -- if (ret < 0) return ret; -- -- // Now start programming the default initialization sequence -- for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -- ret = i2c_master_send(i2c, -- tas5713_init_sequence[i].data, -- tas5713_init_sequence[i].size); -- if (ret < 0) { -- printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -- } -- } -- -- // Unmute -- ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -- if (ret < 0) return ret; -- -- return 0; --} -- -- --static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -- .probe = tas5713_probe, -- .remove = tas5713_remove, -- .controls = tas5713_snd_controls, -- .num_controls = ARRAY_SIZE(tas5713_snd_controls), --}; -- -- -- -- --/* -- * ___ ___ ___ ___ _ -- * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -- * | | / / (__ | |) | '_| \ V / -_) '_| -- * |___/___\___| |___/|_| |_|\_/\___|_| -- * -- */ -- --static const struct reg_default tas5713_reg_defaults[] = { -- { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -- { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -- { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -- { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB --}; -- -- --static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) --{ -- switch (reg) { -- case TAS5713_DEVICE_ID: -- case TAS5713_ERROR_STATUS: -- return true; -- default: -- return false; -- } --} -- -- --static const struct of_device_id tas5713_of_match[] = { -- { .compatible = "ti,tas5713", }, -- { } --}; --MODULE_DEVICE_TABLE(of, tas5713_of_match); -- -- --static struct regmap_config tas5713_regmap_config = { -- .reg_bits = 8, -- .val_bits = 8, -- -- .max_register = TAS5713_MAX_REGISTER, -- .volatile_reg = tas5713_reg_volatile, -- -- .cache_type = REGCACHE_RBTREE, -- .reg_defaults = tas5713_reg_defaults, -- .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), --}; -- -- --static int tas5713_i2c_probe(struct i2c_client *i2c, -- const struct i2c_device_id *id) --{ -- int ret; -- -- priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -- if (!priv_data) -- return -ENOMEM; -- -- priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -- if (IS_ERR(priv_data->regmap)) { -- ret = PTR_ERR(priv_data->regmap); -- return ret; -- } -- -- i2c_set_clientdata(i2c, priv_data); -- -- ret = snd_soc_register_codec(&i2c->dev, -- &soc_codec_dev_tas5713, &tas5713_dai, 1); -- -- return ret; --} -- -- --static int tas5713_i2c_remove(struct i2c_client *i2c) --{ -- snd_soc_unregister_codec(&i2c->dev); -- i2c_set_clientdata(i2c, NULL); -- -- kfree(priv_data); -- -- return 0; --} -- -- --static const struct i2c_device_id tas5713_i2c_id[] = { -- { "tas5713", 0 }, -- { } --}; -- --MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); -- -- --static struct i2c_driver tas5713_i2c_driver = { -- .driver = { -- .name = "tas5713", -- .owner = THIS_MODULE, -- .of_match_table = tas5713_of_match, -- }, -- .probe = tas5713_i2c_probe, -- .remove = tas5713_i2c_remove, -- .id_table = tas5713_i2c_id --}; -- -- --static int __init tas5713_modinit(void) --{ -- int ret = 0; -- -- ret = i2c_add_driver(&tas5713_i2c_driver); -- if (ret) { -- printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -- ret); -- } -- -- return ret; --} --module_init(tas5713_modinit); -- -- --static void __exit tas5713_exit(void) --{ -- i2c_del_driver(&tas5713_i2c_driver); --} --module_exit(tas5713_exit); -- -- --MODULE_AUTHOR("Sebastian Eickhoff "); --MODULE_DESCRIPTION("ASoC driver for TAS5713"); --MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h -deleted file mode 100644 -index 8f019e04898754d2f87e9630137be9e8f612a342..0000000000000000000000000000000000000000 ---- a/sound/soc/codecs/tas5713.h -+++ /dev/null -@@ -1,210 +0,0 @@ --/* -- * ASoC Driver for TAS5713 -- * -- * Author: Sebastian Eickhoff -- * Copyright 2014 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * version 2 as published by the Free Software Foundation. -- * -- * This program 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. -- */ -- --#ifndef _TAS5713_H --#define _TAS5713_H -- -- --// TAS5713 I2C-bus register addresses -- --#define TAS5713_CLOCK_CTRL 0x00 --#define TAS5713_DEVICE_ID 0x01 --#define TAS5713_ERROR_STATUS 0x02 --#define TAS5713_SYSTEM_CTRL1 0x03 --#define TAS5713_SERIAL_DATA_INTERFACE 0x04 --#define TAS5713_SYSTEM_CTRL2 0x05 --#define TAS5713_SOFT_MUTE 0x06 --#define TAS5713_VOL_MASTER 0x07 --#define TAS5713_VOL_CH1 0x08 --#define TAS5713_VOL_CH2 0x09 --#define TAS5713_VOL_HEADPHONE 0x0A --#define TAS5713_VOL_CONFIG 0x0E --#define TAS5713_MODULATION_LIMIT 0x10 --#define TAS5713_IC_DLY_CH1 0x11 --#define TAS5713_IC_DLY_CH2 0x12 --#define TAS5713_IC_DLY_CH3 0x13 --#define TAS5713_IC_DLY_CH4 0x14 -- --#define TAS5713_START_STOP_PERIOD 0x1A --#define TAS5713_OSC_TRIM 0x1B --#define TAS5713_BKND_ERR 0x1C -- --#define TAS5713_INPUT_MUX 0x20 --#define TAS5713_SRC_SELECT_CH4 0x21 --#define TAS5713_PWM_MUX 0x25 -- --#define TAS5713_CH1_BQ0 0x29 --#define TAS5713_CH1_BQ1 0x2A --#define TAS5713_CH1_BQ2 0x2B --#define TAS5713_CH1_BQ3 0x2C --#define TAS5713_CH1_BQ4 0x2D --#define TAS5713_CH1_BQ5 0x2E --#define TAS5713_CH1_BQ6 0x2F --#define TAS5713_CH1_BQ7 0x58 --#define TAS5713_CH1_BQ8 0x59 -- --#define TAS5713_CH2_BQ0 0x30 --#define TAS5713_CH2_BQ1 0x31 --#define TAS5713_CH2_BQ2 0x32 --#define TAS5713_CH2_BQ3 0x33 --#define TAS5713_CH2_BQ4 0x34 --#define TAS5713_CH2_BQ5 0x35 --#define TAS5713_CH2_BQ6 0x36 --#define TAS5713_CH2_BQ7 0x5C --#define TAS5713_CH2_BQ8 0x5D -- --#define TAS5713_CH4_BQ0 0x5A --#define TAS5713_CH4_BQ1 0x5B --#define TAS5713_CH3_BQ0 0x5E --#define TAS5713_CH3_BQ1 0x5F -- --#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B --#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C --#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E --#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F --#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 --#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 --#define TAS5713_DRC_CTRL 0x46 -- --#define TAS5713_BANK_SW_CTRL 0x50 --#define TAS5713_CH1_OUTPUT_MIXER 0x51 --#define TAS5713_CH2_OUTPUT_MIXER 0x52 --#define TAS5713_CH1_INPUT_MIXER 0x53 --#define TAS5713_CH2_INPUT_MIXER 0x54 --#define TAS5713_OUTPUT_POST_SCALE 0x56 --#define TAS5713_OUTPUT_PRESCALE 0x57 -- --#define TAS5713_IDF_POST_SCALE 0x62 -- --#define TAS5713_CH1_INLINE_MIXER 0x70 --#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 --#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 --#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 --#define TAS5713_CH2_INLINE_MIXER 0x74 --#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 --#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 --#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 -- --#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 --#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 -- --#define TAS5713_REGISTER_COUNT 0x46 --#define TAS5713_MAX_REGISTER 0xF9 -- -- --// Bitmasks for registers --#define TAS5713_SOFT_MUTE_ALL 0x07 -- -- -- --struct tas5713_init_command { -- const int size; -- const char *const data; --}; -- --static const struct tas5713_init_command tas5713_init_sequence[] = { -- -- // Trim oscillator -- { .size = 2, .data = "\x1B\x00" }, -- // System control register 1 (0x03): block DC -- { .size = 2, .data = "\x03\x80" }, -- // Mute everything -- { .size = 2, .data = "\x05\x40" }, -- // Modulation limit register (0x10): 97.7% -- { .size = 2, .data = "\x10\x02" }, -- // Interchannel delay registers -- // (0x11, 0x12, 0x13, and 0x14): BD mode -- { .size = 2, .data = "\x11\xB8" }, -- { .size = 2, .data = "\x12\x60" }, -- { .size = 2, .data = "\x13\xA0" }, -- { .size = 2, .data = "\x14\x48" }, -- // PWM shutdown group register (0x19): no shutdown -- { .size = 2, .data = "\x19\x00" }, -- // Input multiplexer register (0x20): BD mode -- { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -- // PWM output mux register (0x25) -- // Channel 1 --> OUTA, channel 1 neg --> OUTB -- // Channel 2 --> OUTC, channel 2 neg --> OUTD -- { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -- // DRC control (0x46): DRC off -- { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -- // BKND_ERR register (0x1C): 299ms reset period -- { .size = 2, .data = "\x1C\x07" }, -- // Mute channel 3 -- { .size = 2, .data = "\x0A\xFF" }, -- // Volume configuration register (0x0E): volume slew 512 steps -- { .size = 2, .data = "\x0E\x90" }, -- // Clock control register (0x00): 44/48kHz, MCLK=64xfs -- { .size = 2, .data = "\x00\x60" }, -- // Bank switch and eq control (0x50): no bank switching -- { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -- // Volume registers (0x07, 0x08, 0x09, 0x0A) -- { .size = 2, .data = "\x07\x20" }, -- { .size = 2, .data = "\x08\x30" }, -- { .size = 2, .data = "\x09\x30" }, -- { .size = 2, .data = "\x0A\xFF" }, -- // 0x72, 0x73, 0x76, 0x77 input mixer: -- // no intermix between channels -- { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -- { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -- { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -- // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -- // no inline DRC inmix -- { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -- { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -- // 0x56, 0x57 Output scale -- { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -- // 0x3B, 0x3c -- { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -- { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -- { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- // 0x51, 0x52: output mixer -- { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -- { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -- // PEQ defaults -- { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, --}; -- -- --#endif /* _TAS5713_H */ - -From adf38c2875a20b75d2870d9e9897f711835811ea Mon Sep 17 00:00:00 2001 -From: Ryan Coe -Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 074/122] Update ds1307 driver for device-tree support - -Signed-off-by: Ryan Coe ---- - drivers/rtc/rtc-ds1307.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c -index 4e31036ee2596dec93accd26f627c5b95591ae9f..b92044cf03e750afa521a93519500e9d128486f4 100644 ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -1675,6 +1675,14 @@ static int ds1307_remove(struct i2c_client *client) - return 0; - } - -+#ifdef CONFIG_OF -+static const struct of_device_id ds1307_of_match[] = { -+ { .compatible = "maxim,ds1307" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, ds1307_of_match); -+#endif -+ - static struct i2c_driver ds1307_driver = { - .driver = { - .name = "rtc-ds1307", - -From 23122064c9a8be975b07aad67e74213cf9fdc7d8 Mon Sep 17 00:00:00 2001 -From: Waldemar Brodkorb -Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 075/122] Add driver for rpi-proto - -Forward port of 3.10.x driver from https://github.com/koalo -We are using a custom board and would like to use rpi 3.18.x -kernel. Patch works fine for our embedded system. - -URL to the audio chip: -http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ - -Playback tested with devicetree enabled. - -Signed-off-by: Waldemar Brodkorb ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-proto.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 163 insertions(+) - create mode 100644 sound/soc/bcm/rpi-proto.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 4473cc728097bda0ce9fe68d4a9da348ec41f8b3..ac0dbaf29b821c4b21855f22104a986f6e0849ec 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -45,6 +45,13 @@ config SND_BCM2708_SOC_RPI_DAC - help - Say Y or M if you want to add support for RPi-DAC. - -+config SND_BCM2708_SOC_RPI_PROTO -+ tristate "Support for Rpi-PROTO" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8731 -+ help -+ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). -+ - config SND_BCM2708_SOC_IQAUDIO_DAC - tristate "Support for IQaudIO-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 203afc03167acbcad15e836209956bc5ab151157..3badc43cbe1fcb6972829a6d5eb3143cfa812da9 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -13,10 +13,12 @@ snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9db678e885efd63d84d60a098a84ed6772b19a2d ---- /dev/null -+++ b/sound/soc/bcm/rpi-proto.c -@@ -0,0 +1,154 @@ -+/* -+ * ASoC driver for PROTO AudioCODEC (with a WM8731) -+ * connected to a Raspberry Pi -+ * -+ * Author: Florian Meier, -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8731.h" -+ -+static const unsigned int wm8731_rates_12288000[] = { -+ 8000, 32000, 48000, 96000, -+}; -+ -+static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { -+ .list = wm8731_rates_12288000, -+ .count = ARRAY_SIZE(wm8731_rates_12288000), -+}; -+ -+static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) -+{ -+ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &wm8731_constraints_12288000); -+ return 0; -+} -+ -+static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ int sysclk = 12288000; /* This is fixed on this board */ -+ -+ /* Set proto bclk */ -+ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); -+ if (ret < 0){ -+ dev_err(codec->dev, -+ "Failed to set BCLK ratio %d\n", ret); -+ return ret; -+ } -+ -+ /* Set proto sysclk */ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, -+ sysclk, SND_SOC_CLOCK_IN); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8731 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_proto_ops = { -+ .startup = snd_rpi_proto_startup, -+ .hw_params = snd_rpi_proto_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_proto_dai[] = { -+{ -+ .name = "WM8731", -+ .stream_name = "WM8731 HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8731-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8731.1-001a", -+ .dai_fmt = SND_SOC_DAIFMT_I2S -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_proto_ops, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_proto = { -+ .name = "snd_rpi_proto", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_proto_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), -+}; -+ -+static int snd_rpi_proto_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_proto.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_proto); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_proto_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_proto); -+} -+ -+static const struct of_device_id snd_rpi_proto_of_match[] = { -+ { .compatible = "rpi,rpi-proto", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); -+ -+static struct platform_driver snd_rpi_proto_driver = { -+ .driver = { -+ .name = "snd-rpi-proto", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_proto_of_match, -+ }, -+ .probe = snd_rpi_proto_probe, -+ .remove = snd_rpi_proto_remove, -+}; -+ -+module_platform_driver(snd_rpi_proto_driver); -+ -+MODULE_AUTHOR("Florian Meier"); -+MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); -+MODULE_LICENSE("GPL"); - -From 23e17d37207fc0039b141c8988644c24885ba10a Mon Sep 17 00:00:00 2001 -From: Jan Grulich -Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 076/122] RaspiDAC3 support - -Signed-off-by: Jan Grulich - -config: fix RaspiDAC Rev.3x dependencies - -Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -like the other I2S soundcard drivers. - -Signed-off-by: Matthias Reichl ---- - sound/soc/bcm/Kconfig | 8 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/raspidac3.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 196 insertions(+) - create mode 100644 sound/soc/bcm/raspidac3.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index ac0dbaf29b821c4b21855f22104a986f6e0849ec..c59c835757a51aa8ad72933d35a83b73a889477c 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -58,3 +58,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC - select SND_SOC_PCM512x_I2C - help - Say Y or M if you want to add support for IQaudIO-DAC. -+ -+config SND_BCM2708_SOC_RASPIDAC3 -+ tristate "Support for RaspiDAC Rev.3x" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ select SND_SOC_TPA6130A2 -+ help -+ Say Y or M if you want to add support for RaspiDAC Rev.3x. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 3badc43cbe1fcb6972829a6d5eb3143cfa812da9..07d2b52376b1d16e427cf6f51cbf4779d6219ce0 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -15,6 +15,7 @@ snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -+snd-soc-raspidac3-objs := raspidac3.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o -@@ -22,3 +23,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o -diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c -new file mode 100644 -index 0000000000000000000000000000000000000000..dd9eeea2af0382307f437e6db09d15468c1a470a ---- /dev/null -+++ b/sound/soc/bcm/raspidac3.c -@@ -0,0 +1,186 @@ -+/* -+ * ASoC Driver for RaspiDAC v3 -+ * -+ * Author: Jan Grulich -+ * Copyright 2015 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/pcm512x.h" -+#include "../codecs/tpa6130a2.h" -+ -+/* sound card init */ -+static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ else { -+ struct snd_kcontrol *kctl; -+ -+ ret = snd_soc_limit_volume(card, -+ "TPA6130A2 Headphone Playback Volume", -+ 54); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", -+ ret); -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Volume"); -+ if (kctl) { -+ strcpy(kctl->id.name, "Headphones Playback Volume"); -+ /* disable the volume dB scale so alsamixer works */ -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ } -+ -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Switch"); -+ if (kctl) -+ strcpy(kctl->id.name, "Headphones Playback Switch"); -+ } -+ -+ return 0; -+} -+ -+/* set hw parameters */ -+static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* startup */ -+static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} -+ -+/* shutdown */ -+static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_raspidac3_ops = { -+ .hw_params = snd_rpi_raspidac3_hw_params, -+ .startup = snd_rpi_raspidac3_startup, -+ .shutdown = snd_rpi_raspidac3_shutdown, -+}; -+ -+/* interface setup */ -+static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { -+{ -+ .name = "RaspiDAC Rev.3x", -+ .stream_name = "RaspiDAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_raspidac3_ops, -+ .init = snd_rpi_raspidac3_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_raspidac3 = { -+ .name = "RaspiDAC Rev.3x HiFi Audio Card", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_raspidac3_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), -+}; -+ -+/* sound card test */ -+static int snd_rpi_raspidac3_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_raspidac3.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_raspidac3); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+/* sound card disconnect */ -+static int snd_rpi_raspidac3_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_raspidac3); -+} -+ -+static const struct of_device_id raspidac3_of_match[] = { -+ { .compatible = "jg,raspidacv3", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, raspidac3_of_match); -+ -+/* sound card platform driver */ -+static struct platform_driver snd_rpi_raspidac3_driver = { -+ .driver = { -+ .name = "snd-rpi-raspidac3", -+ .owner = THIS_MODULE, -+ .of_match_table = raspidac3_of_match, -+ }, -+ .probe = snd_rpi_raspidac3_probe, -+ .remove = snd_rpi_raspidac3_remove, -+}; -+ -+module_platform_driver(snd_rpi_raspidac3_driver); -+ -+MODULE_AUTHOR("Jan Grulich "); -+MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); -+MODULE_LICENSE("GPL v2"); - -From 328c723f04e73cc2484ae7d5d6f317fc22fbd386 Mon Sep 17 00:00:00 2001 -From: Aaron Shaw -Date: Thu, 7 Apr 2016 21:26:21 +0100 -Subject: [PATCH 077/122] Add Support for JustBoom Audio boards - -justboom-dac: Adjust for ALSA API change - -As of 4.4, snd_soc_limit_volume now takes a struct snd_soc_card * -rather than a struct snd_soc_codec *. - -Signed-off-by: Phil Elwell ---- - sound/soc/bcm/Kconfig | 14 +++ - sound/soc/bcm/Makefile | 4 + - sound/soc/bcm/justboom-dac.c | 162 +++++++++++++++++++++++++++++++ - sound/soc/bcm/justboom-digi.c | 215 ++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 395 insertions(+) - create mode 100644 sound/soc/bcm/justboom-dac.c - create mode 100644 sound/soc/bcm/justboom-digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index c59c835757a51aa8ad72933d35a83b73a889477c..b2f6339c318cdfe3516d73952a5be1fd32bc1156 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -52,6 +52,20 @@ config SND_BCM2708_SOC_RPI_PROTO - help - Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). - -+config SND_BCM2708_SOC_JUSTBOOM_DAC -+ tristate "Support for JustBoom DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x -+ help -+ Say Y or M if you want to add support for JustBoom DAC. -+ -+config SND_BCM2708_SOC_JUSTBOOM_DIGI -+ tristate "Support for JustBoom Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for JustBoom Digi. -+ - config SND_BCM2708_SOC_IQAUDIO_DAC - tristate "Support for IQaudIO-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 07d2b52376b1d16e427cf6f51cbf4779d6219ce0..cb8ab1901b172bdee0bd9cddd2f2e7ab2f36c16a 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,6 +12,8 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -+snd-soc-justboom-dac-objs := justboom-dac.o -+snd-soc-justboom-digi-objs := justboom-digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -@@ -20,6 +22,8 @@ snd-soc-raspidac3-objs := raspidac3.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -+obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8fd50dbe681508a2cfe8fdde1c9fedbe9a507fa7 ---- /dev/null -+++ b/sound/soc/bcm/justboom-dac.c -@@ -0,0 +1,162 @@ -+/* -+ * ASoC Driver for JustBoom DAC Raspberry Pi HAT Sound Card -+ * -+ * Author: Milan Neskovic -+ * Copyright 2016 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/pcm512x.h" -+ -+static bool digital_gain_0db_limit = true; -+ -+static int snd_rpi_justboom_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_justboom_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ /*return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);*/ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+static int snd_rpi_justboom_dac_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} -+ -+static void snd_rpi_justboom_dac_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_justboom_dac_ops = { -+ .hw_params = snd_rpi_justboom_dac_hw_params, -+ .startup = snd_rpi_justboom_dac_startup, -+ .shutdown = snd_rpi_justboom_dac_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { -+{ -+ .name = "JustBoom DAC", -+ .stream_name = "JustBoom DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004d", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_justboom_dac_ops, -+ .init = snd_rpi_justboom_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_justboom_dac = { -+ .name = "snd_rpi_justboom_dac", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_justboom_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), -+}; -+ -+static int snd_rpi_justboom_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_justboom_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_justboom_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "justboom,24db_digital_gain"); -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_justboom_dac); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_justboom_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_justboom_dac); -+} -+ -+static const struct of_device_id snd_rpi_justboom_dac_of_match[] = { -+ { .compatible = "justboom,justboom-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_justboom_dac_of_match); -+ -+static struct platform_driver snd_rpi_justboom_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-justboom-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_justboom_dac_of_match, -+ }, -+ .probe = snd_rpi_justboom_dac_probe, -+ .remove = snd_rpi_justboom_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_justboom_dac_driver); -+ -+MODULE_AUTHOR("Milan Neskovic "); -+MODULE_DESCRIPTION("ASoC Driver for JustBoom PI DAC HAT Sound Card"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..91acb666380faa3c0deb2230f8a0f8bbec59417b ---- /dev/null -+++ b/sound/soc/bcm/justboom-digi.c -@@ -0,0 +1,215 @@ -+/* -+ * ASoC Driver for JustBoom Raspberry Pi Digi HAT Sound Card -+ * -+ * Author: Milan Neskovic -+ * Copyright 2016 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static int snd_rpi_justboom_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ return 0; -+} -+ -+static int snd_rpi_justboom_digi_startup(struct snd_pcm_substream *substream) { -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} -+ -+static void snd_rpi_justboom_digi_shutdown(struct snd_pcm_substream *substream) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+} -+ -+static int snd_rpi_justboom_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq=0; -+ int mclk_div=1; -+ int sampling_freq=1; -+ -+ int ret; -+ -+ int samplerate = params_rate(params); -+ -+ if (samplerate<=96000) { -+ mclk_freq=samplerate*256; -+ mclk_div=WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq=samplerate*128; -+ mclk_div=WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_justboom_digi_ops = { -+ .hw_params = snd_rpi_justboom_digi_hw_params, -+ .startup = snd_rpi_justboom_digi_startup, -+ .shutdown = snd_rpi_justboom_digi_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { -+{ -+ .name = "JustBoom Digi", -+ .stream_name = "JustBoom Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_justboom_digi_ops, -+ .init = snd_rpi_justboom_digi_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_justboom_digi = { -+ .name = "snd_rpi_justboom_digi", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_justboom_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), -+}; -+ -+static int snd_rpi_justboom_digi_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_justboom_digi.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_justboom_digi_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_justboom_digi); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_justboom_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_justboom_digi); -+} -+ -+static const struct of_device_id snd_rpi_justboom_digi_of_match[] = { -+ { .compatible = "justboom,justboom-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_justboom_digi_of_match); -+ -+static struct platform_driver snd_rpi_justboom_digi_driver = { -+ .driver = { -+ .name = "snd-rpi-justboom-digi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_justboom_digi_of_match, -+ }, -+ .probe = snd_rpi_justboom_digi_probe, -+ .remove = snd_rpi_justboom_digi_remove, -+}; -+ -+module_platform_driver(snd_rpi_justboom_digi_driver); -+ -+MODULE_AUTHOR("Milan Neskovic "); -+MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); -+MODULE_LICENSE("GPL v2"); - -From 070a41a6ef5eb0427354b758ce45fee7476e8e84 Mon Sep 17 00:00:00 2001 -From: Andrey Grodzovsky -Date: Tue, 3 May 2016 22:10:59 -0400 -Subject: [PATCH 078/122] ARM: adau1977-adc: Add basic machine driver for - adau1977 codec driver. - -This commit adds basic support for the codec usage including: Device tree overlay, -binding I2S bus and setting I2S mode, clock source and frequency setting according -to spec. - -Signed-off-by: Andrey Grodzovsky ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/adau1977-adc.c | 125 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 134 insertions(+) - create mode 100644 sound/soc/bcm/adau1977-adc.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index b2f6339c318cdfe3516d73952a5be1fd32bc1156..190a79dffa53a34c2df9b2c9b5160065c759de65 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -80,3 +80,10 @@ config SND_BCM2708_SOC_RASPIDAC3 - select SND_SOC_TPA6130A2 - help - Say Y or M if you want to add support for RaspiDAC Rev.3x. -+ -+config SND_BCM2708_SOC_ADAU1977_ADC -+ tristate "Support for ADAU1977 ADC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_ADAU1977_I2C -+ help -+ Say Y or M if you want to add support for ADAU1977 ADC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index cb8ab1901b172bdee0bd9cddd2f2e7ab2f36c16a..9dd0785532aae24f3366cc2910d4dbc558cb0e5d 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -9,6 +9,7 @@ snd-soc-cygnus-objs := cygnus-pcm.o cygnus-ssp.o - obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support -+snd-soc-adau1977-adc-objs := adau1977-adc.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -@@ -19,6 +20,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - snd-soc-raspidac3-objs := raspidac3.o - -+obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -diff --git a/sound/soc/bcm/adau1977-adc.c b/sound/soc/bcm/adau1977-adc.c -new file mode 100644 -index 0000000000000000000000000000000000000000..6e2ee027926ee63c89222f75ceb89e3d2434b0e1 ---- /dev/null -+++ b/sound/soc/bcm/adau1977-adc.c -@@ -0,0 +1,125 @@ -+/* -+ * ASoC Driver for ADAU1977 ADC -+ * -+ * Author: Andrey Grodzovsky -+ * Copyright 2016 -+ * -+ * This file is based on hifibery_dac driver by Florian Meier. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+enum adau1977_clk_id { -+ ADAU1977_SYSCLK, -+}; -+ -+enum adau1977_sysclk_src { -+ ADAU1977_SYSCLK_SRC_MCLK, -+ ADAU1977_SYSCLK_SRC_LRCLK, -+}; -+ -+static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 0, 0); -+ if (ret < 0) -+ return ret; -+ -+ return snd_soc_codec_set_sysclk(rtd->codec, ADAU1977_SYSCLK, -+ ADAU1977_SYSCLK_SRC_MCLK, 11289600, SND_SOC_CLOCK_IN); -+} -+ -+static struct snd_soc_dai_link snd_rpi_adau1977_dai[] = { -+ { -+ .name = "adau1977", -+ .stream_name = "ADAU1977", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "adau1977-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "adau1977.1-0011", -+ .init = eval_adau1977_init, -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ }, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_adau1977_adc = { -+ .name = "snd_rpi_adau1977_adc", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_adau1977_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_adau1977_dai), -+}; -+ -+static int snd_adau1977_adc_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_adau1977_adc.dev = &pdev->dev; -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_adau1977_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_adau1977_adc); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_adau1977_adc_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_adau1977_adc); -+} -+ -+static const struct of_device_id snd_adau1977_adc_of_match[] = { -+ { .compatible = "adi,adau1977-adc", }, -+ {}, -+}; -+ -+MODULE_DEVICE_TABLE(of, snd_adau1977_adc_of_match); -+ -+static struct platform_driver snd_adau1977_adc_driver = { -+ .driver = { -+ .name = "snd-adau1977-adc", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_adau1977_adc_of_match, -+ }, -+ .probe = snd_adau1977_adc_probe, -+ .remove = snd_adau1977_adc_remove, -+}; -+ -+module_platform_driver(snd_adau1977_adc_driver); -+ -+MODULE_AUTHOR("Andrey Grodzovsky "); -+MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); -+MODULE_LICENSE("GPL v2"); - -From d3f05a999f9f646a4fad423073c2bfd16ac8cdb7 Mon Sep 17 00:00:00 2001 -From: Matt Flax -Date: Mon, 16 May 2016 21:36:31 +1000 -Subject: [PATCH 079/122] New AudioInjector.net Pi soundcard with low jitter - audio in and out. - -Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. -Adds the dts overlay and updates the Makefile and README. -Updates the relevant defconfig files to enable building for the Raspberry Pi. -Thanks to Phil Elwell (pelwell) for the review, simple-card concepts and discussion. Thanks to Clive Messer for overlay naming suggestions. - -Added support for headphones, microphone and bclk_ratio settings. - -This patch adds headphone and microphone capability to the Audio Injector sound card. The patch also sets the bit clock ratio for use in the bcm2835-i2s driver. The bcm2835-i2s can't handle an 8 kHz sample rate when the bit clock is at 12 MHz because its register is only 10 bits wide which can't represent the ch2 offset of 1508. For that reason, the rate constraint is added. ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 3 + - sound/soc/bcm/audioinjector-pi-soundcard.c | 193 +++++++++++++++++++++++++++++ - 3 files changed, 203 insertions(+) - create mode 100644 sound/soc/bcm/audioinjector-pi-soundcard.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 190a79dffa53a34c2df9b2c9b5160065c759de65..eb16c3a7fb316eb5938a54dfa864f66f9b167eb0 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -87,3 +87,10 @@ config SND_BCM2708_SOC_ADAU1977_ADC - select SND_SOC_ADAU1977_I2C - help - Say Y or M if you want to add support for ADAU1977 ADC. -+ -+config SND_AUDIOINJECTOR_PI_SOUNDCARD -+ tristate "Support for audioinjector.net Pi add on soundcard" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8731 -+ help -+ Say Y or M if you want to add support for audioinjector.net Pi Hat -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 9dd0785532aae24f3366cc2910d4dbc558cb0e5d..a68469644535a38305bb5b0f3780e03e0ca4f519 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -19,6 +19,7 @@ snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - snd-soc-raspidac3-objs := raspidac3.o -+snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -30,3 +31,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o -+obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o -+ -diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c -new file mode 100644 -index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fdc998e469 ---- /dev/null -+++ b/sound/soc/bcm/audioinjector-pi-soundcard.c -@@ -0,0 +1,193 @@ -+/* -+ * ASoC Driver for AudioInjector Pi add on soundcard -+ * -+ * Created on: 13-May-2016 -+ * Author: flatmax@flatmax.org -+ * based on code by Cliff Cai for the ssm2602 machine blackfin. -+ * with help from Lars-Peter Clausen for simplifying the original code to use the dai_fmt field. -+ * i2s_node code taken from the other sound/soc/bcm machine drivers. -+ * -+ * Copyright (C) 2016 Flatmax Pty. Ltd. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8731.h" -+ -+static const unsigned int bcm2835_rates_12000000[] = { -+ 8000, 16000, 32000, 44100, 48000, 96000, 88200, -+}; -+ -+static struct snd_pcm_hw_constraint_list bcm2835_constraints_12000000 = { -+ .list = bcm2835_rates_12000000, -+ .count = ARRAY_SIZE(bcm2835_rates_12000000), -+}; -+ -+static int snd_audioinjector_pi_soundcard_startup(struct snd_pcm_substream *substream) -+{ -+ /* Setup constraints, because there is a 12 MHz XTAL on the board */ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &bcm2835_constraints_12000000); -+ return 0; -+} -+ -+static int snd_audioinjector_pi_soundcard_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ switch (params_rate(params)){ -+ case 8000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 1); -+ case 16000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 750); -+ case 32000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 375); -+ case 44100: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 272); -+ case 48000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 250); -+ case 88200: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 136); -+ case 96000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 125); -+ default: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 125); -+ } -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_audioinjector_pi_soundcard_ops = { -+ .startup = snd_audioinjector_pi_soundcard_startup, -+ .hw_params = snd_audioinjector_pi_soundcard_hw_params, -+}; -+ -+static int audioinjector_pi_soundcard_dai_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000, SND_SOC_CLOCK_IN); -+} -+ -+static struct snd_soc_dai_link audioinjector_pi_soundcard_dai[] = { -+ { -+ .name = "AudioInjector audio", -+ .stream_name = "AudioInjector audio", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8731-hifi", -+ .platform_name = "bcm2835-i2s.0", -+ .codec_name = "wm8731.1-001a", -+ .ops = &snd_audioinjector_pi_soundcard_ops, -+ .init = audioinjector_pi_soundcard_dai_init, -+ .dai_fmt = SND_SOC_DAIFMT_CBM_CFM|SND_SOC_DAIFMT_I2S|SND_SOC_DAIFMT_NB_NF, -+ }, -+}; -+ -+static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { -+ SND_SOC_DAPM_HP("Headphone Jack", NULL), -+ SND_SOC_DAPM_SPK("Ext Spk", NULL), -+ SND_SOC_DAPM_LINE("Line In Jacks", NULL), -+ SND_SOC_DAPM_MIC("Microphone", NULL), -+}; -+ -+static const struct snd_soc_dapm_route audioinjector_audio_map[] = { -+ /* headphone connected to LHPOUT, RHPOUT */ -+ {"Headphone Jack", NULL, "LHPOUT"}, -+ {"Headphone Jack", NULL, "RHPOUT"}, -+ -+ /* speaker connected to LOUT, ROUT */ -+ {"Ext Spk", NULL, "ROUT"}, -+ {"Ext Spk", NULL, "LOUT"}, -+ -+ /* line inputs */ -+ {"Line In Jacks", NULL, "Line Input"}, -+ -+ /* mic is connected to Mic Jack, with WM8731 Mic Bias */ -+ {"Microphone", NULL, "Mic Bias"}, -+}; -+ -+static struct snd_soc_card snd_soc_audioinjector = { -+ .name = "audioinjector-pi-soundcard", -+ .dai_link = audioinjector_pi_soundcard_dai, -+ .num_links = ARRAY_SIZE(audioinjector_pi_soundcard_dai), -+ -+ .dapm_widgets = wm8731_dapm_widgets, -+ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), -+ .dapm_routes = audioinjector_audio_map, -+ .num_dapm_routes = ARRAY_SIZE(audioinjector_audio_map), -+}; -+ -+static int audioinjector_pi_soundcard_probe(struct platform_device *pdev) -+{ -+ struct snd_soc_card *card = &snd_soc_audioinjector; -+ int ret; -+ -+ card->dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct snd_soc_dai_link *dai = &audioinjector_pi_soundcard_dai[0]; -+ struct device_node *i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } else -+ if (!dai->cpu_of_node) { -+ dev_err(&pdev->dev, "Property 'i2s-controller' missing or invalid\n"); -+ return -EINVAL; -+ } -+ } -+ -+ if ((ret = snd_soc_register_card(card))) { -+ dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); -+ } -+ return ret; -+} -+ -+static int audioinjector_pi_soundcard_remove(struct platform_device *pdev) -+{ -+ struct snd_soc_card *card = platform_get_drvdata(pdev); -+ return snd_soc_unregister_card(card); -+ -+} -+ -+static const struct of_device_id audioinjector_pi_soundcard_of_match[] = { -+ { .compatible = "ai,audioinjector-pi-soundcard", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); -+ -+static struct platform_driver audioinjector_pi_soundcard_driver = { -+ .driver = { -+ .name = "audioinjector-audio", -+ .owner = THIS_MODULE, -+ .of_match_table = audioinjector_pi_soundcard_of_match, -+ }, -+ .probe = audioinjector_pi_soundcard_probe, -+ .remove = audioinjector_pi_soundcard_remove, -+}; -+ -+module_platform_driver(audioinjector_pi_soundcard_driver); -+MODULE_AUTHOR("Matt Flax "); -+MODULE_DESCRIPTION("AudioInjector.net Pi Soundcard"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:audioinjector-pi-soundcard"); -+ - -From 6cdf489fe02f677a7a5312dd53f5b5dfa1632487 Mon Sep 17 00:00:00 2001 -From: DigitalDreamtime -Date: Thu, 30 Jun 2016 18:38:42 +0100 -Subject: [PATCH 080/122] Add IQAudIO Digi WM8804 board support - -Support IQAudIO Digi board with iqaudio_digi machine driver and - iqaudio-digi-wm8804-audio overlay. - -NB. Machine driver is a cut and paste of hifiberry_digi code, with format - and general cleanup to comply with kernel coding standards. - -Signed-off-by: DigitalDreamtime ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/iqaudio_digi.c | 239 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 248 insertions(+) - create mode 100644 sound/soc/bcm/iqaudio_digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index eb16c3a7fb316eb5938a54dfa864f66f9b167eb0..9cba69ab877ef73beb2dff2f4f82d1d243f7c604 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -73,6 +73,13 @@ config SND_BCM2708_SOC_IQAUDIO_DAC - help - Say Y or M if you want to add support for IQaudIO-DAC. - -+config SND_BCM2708_SOC_IQAUDIO_DIGI -+ tristate "Support for IQAudIO Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for IQAudIO Digital IO board. -+ - config SND_BCM2708_SOC_RASPIDAC3 - tristate "Support for RaspiDAC Rev.3x" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a68469644535a38305bb5b0f3780e03e0ca4f519..fa2739206b79a9f9d2e1173b2099e1156e4e08c8 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -18,6 +18,7 @@ snd-soc-justboom-digi-objs := justboom-digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -+snd-soc-iqaudio-digi-objs := iqaudio_digi.o - snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - -@@ -30,6 +31,7 @@ obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI) += snd-soc-iqaudio-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o - -diff --git a/sound/soc/bcm/iqaudio_digi.c b/sound/soc/bcm/iqaudio_digi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9b6e829bcb5b1762a853775e7816319639e39d65 ---- /dev/null -+++ b/sound/soc/bcm/iqaudio_digi.c -@@ -0,0 +1,239 @@ -+/* -+ * ASoC Driver for IQAudIO WM8804 Digi -+ * -+ * Author: Daniel Matuschek -+ * based on the HifiBerry DAC driver by Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static short int auto_shutdown_output; -+module_param(auto_shutdown_output, short, -+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); -+ -+static int snd_rpi_iqaudio_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ return 0; -+} -+ -+static int snd_rpi_iqaudio_digi_startup(struct snd_pcm_substream *substream) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* turn on digital output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ -+ return 0; -+} -+ -+static void snd_rpi_iqaudio_digi_shutdown(struct snd_pcm_substream *substream) -+{ -+ if (auto_shutdown_output) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* turn off digital output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} -+ -+ -+static int snd_rpi_iqaudio_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq = 0; -+ int mclk_div = 1; -+ int sampling_freq = 1; -+ -+ int ret; -+ -+ int samplerate = params_rate(params); -+ -+ if (samplerate <= 96000) { -+ mclk_freq = samplerate * 256; -+ mclk_div = WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq = samplerate * 128; -+ mclk_div = WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq = 0x03; -+ break; -+ case 44100: -+ sampling_freq = 0x00; -+ break; -+ case 48000: -+ sampling_freq = 0x02; -+ break; -+ case 88200: -+ sampling_freq = 0x08; -+ break; -+ case 96000: -+ sampling_freq = 0x0a; -+ break; -+ case 176400: -+ sampling_freq = 0x0c; -+ break; -+ case 192000: -+ sampling_freq = 0x0e; -+ break; -+ default: -+ dev_err(codec->dev, "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_iqaudio_digi_ops = { -+ .hw_params = snd_rpi_iqaudio_digi_hw_params, -+ .startup = snd_rpi_iqaudio_digi_startup, -+ .shutdown = snd_rpi_iqaudio_digi_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_iqaudio_digi_dai[] = { -+{ -+ .name = "IQAudIO Digi", -+ .stream_name = "IQAudIO Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_iqaudio_digi_ops, -+ .init = snd_rpi_iqaudio_digi_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_iqaudio_digi = { -+ .name = "IQAudIODigi", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_iqaudio_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_digi_dai), -+}; -+ -+static int snd_rpi_iqaudio_digi_probe(struct platform_device *pdev) -+{ -+ struct snd_soc_card *card = &snd_rpi_iqaudio_digi; -+ char *prefix = "wm8804-digi,"; -+ char prop[128]; -+ struct device_node *np; -+ int ret = 0; -+ -+ snd_rpi_iqaudio_digi.dev = &pdev->dev; -+ -+ np = pdev->dev.of_node; -+ if (np) { -+ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_digi_dai[0]; -+ struct device_node *i2s_node; -+ -+ i2s_node = of_parse_phandle(np, "i2s-controller", 0); -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ snprintf(prop, sizeof(prop), "%scard-name", prefix); -+ of_property_read_string(np, prop, &card->name); -+ -+ snprintf(prop, sizeof(prop), "%sdai-name", prefix); -+ of_property_read_string(np, prop, &dai->name); -+ -+ snprintf(prop, sizeof(prop), "%sdai-stream-name", prefix); -+ of_property_read_string(np, prop, &dai->stream_name); -+ } -+ -+ ret = snd_soc_register_card(card); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_iqaudio_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_iqaudio_digi); -+} -+ -+static const struct of_device_id snd_rpi_iqaudio_digi_of_match[] = { -+ { .compatible = "iqaudio,wm8804-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_iqaudio_digi_of_match); -+ -+static struct platform_driver snd_rpi_iqaudio_digi_driver = { -+ .driver = { -+ .name = "IQAudIODigi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_iqaudio_digi_of_match, -+ }, -+ .probe = snd_rpi_iqaudio_digi_probe, -+ .remove = snd_rpi_iqaudio_digi_remove, -+}; -+ -+module_platform_driver(snd_rpi_iqaudio_digi_driver); -+ -+MODULE_AUTHOR("Daniel Matuschek "); -+MODULE_DESCRIPTION("ASoC Driver for IQAudIO WM8804 Digi"); -+MODULE_LICENSE("GPL v2"); - -From 922b72225da0a94bdc3a2c7a52ac04431e67a6a8 Mon Sep 17 00:00:00 2001 -From: escalator2015 -Date: Tue, 24 May 2016 16:20:09 +0100 -Subject: [PATCH 081/122] New driver for RRA DigiDAC1 soundcard using WM8741 + - WM8804 - ---- - sound/soc/bcm/Kconfig | 8 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/digidac1-soundcard.c | 422 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 432 insertions(+) - create mode 100644 sound/soc/bcm/digidac1-soundcard.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 9cba69ab877ef73beb2dff2f4f82d1d243f7c604..2be5b64fb0d5dcad0d5747626015a6886c3c273b 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -101,3 +101,11 @@ config SND_AUDIOINJECTOR_PI_SOUNDCARD - select SND_SOC_WM8731 - help - Say Y or M if you want to add support for audioinjector.net Pi Hat -+ -+config SND_DIGIDAC1_SOUNDCARD -+ tristate "Support for Red Rocks Audio DigiDAC1" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ select SND_SOC_WM8741 -+ help -+ Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index fa2739206b79a9f9d2e1173b2099e1156e4e08c8..a5c30c0bdacafb2bd09b6ac2f8a3bdc6a85a8404 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -21,6 +21,7 @@ snd-soc-iqaudio-dac-objs := iqaudio-dac.o - snd-soc-iqaudio-digi-objs := iqaudio_digi.o - snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o -+snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -34,4 +35,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI) += snd-soc-iqaudio-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o -+obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o - -diff --git a/sound/soc/bcm/digidac1-soundcard.c b/sound/soc/bcm/digidac1-soundcard.c -new file mode 100644 -index 0000000000000000000000000000000000000000..446796e7e4c14a7d95b2f2a01211d9a0b151f1f3 ---- /dev/null -+++ b/sound/soc/bcm/digidac1-soundcard.c -@@ -0,0 +1,422 @@ -+/* -+ * ASoC Driver for RRA DigiDAC1 -+ * Copyright 2016 -+ * Author: José M. Tasende -+ * based on the HifiBerry DAC driver by Florian Meier -+ * and the Wolfson card driver by Nikesh Oswal, -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+#include "../codecs/wm8741.h" -+ -+#define WM8741_NUM_SUPPLIES 2 -+ -+/* codec private data */ -+struct wm8741_priv { -+ struct wm8741_platform_data pdata; -+ struct regmap *regmap; -+ struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; -+ unsigned int sysclk; -+ const struct snd_pcm_hw_constraint_list *sysclk_constraints; -+}; -+ -+static int samplerate = 44100; -+ -+/* New Alsa Controls not exposed by original wm8741 codec driver */ -+/* in actual driver the att. adjustment is wrong because */ -+/* this DAC has a coarse attenuation register with 4dB steps */ -+/* and a fine level register with 0.125dB steps */ -+/* each register has 32 steps so combining both we have 1024 steps */ -+/* of 0.125 dB. */ -+/* The original level controls from driver are removed at startup */ -+/* and replaced by the corrected ones. */ -+/* The same wm8741 driver can be used for wm8741 and wm8742 devices */ -+ -+static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, 0, 13, 0); -+static const DECLARE_TLV_DB_SCALE(dac_tlv_coarse, -12700, 400, 1); -+static const char *w8741_dither[4] = {"Off", "RPDF", "TPDF", "HPDF"}; -+static const char *w8741_filter[5] = { -+ "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"}; -+static const char *w8741_switch[2] = {"Off", "On"}; -+static const struct soc_enum w8741_enum[] = { -+SOC_ENUM_SINGLE(WM8741_MODE_CONTROL_2, 0, 4, w8741_dither),/* dithering type */ -+SOC_ENUM_SINGLE(WM8741_FILTER_CONTROL, 0, 5, w8741_filter),/* filter type */ -+SOC_ENUM_SINGLE(WM8741_FORMAT_CONTROL, 6, 2, w8741_switch),/* phase invert */ -+SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 0, 2, w8741_switch),/* volume ramp */ -+SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 3, 2, w8741_switch),/* soft mute */ -+}; -+ -+static const struct snd_kcontrol_new w8741_snd_controls_stereo[] = { -+SOC_DOUBLE_R_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, -+ WM8741_DACRLSB_ATTENUATION, 0, 31, 1, dac_tlv_fine), -+SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, -+ WM8741_DACRMSB_ATTENUATION, 0, 31, 1, dac_tlv_coarse), -+SOC_ENUM("DAC Dither", w8741_enum[0]), -+SOC_ENUM("DAC Digital Filter", w8741_enum[1]), -+SOC_ENUM("DAC Phase Invert", w8741_enum[2]), -+SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), -+SOC_ENUM("DAC Soft Mute", w8741_enum[4]), -+}; -+ -+static const struct snd_kcontrol_new w8741_snd_controls_mono_left[] = { -+SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, -+ 0, 31, 0, dac_tlv_fine), -+SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, -+ 0, 31, 1, dac_tlv_coarse), -+SOC_ENUM("DAC Dither", w8741_enum[0]), -+SOC_ENUM("DAC Digital Filter", w8741_enum[1]), -+SOC_ENUM("DAC Phase Invert", w8741_enum[2]), -+SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), -+SOC_ENUM("DAC Soft Mute", w8741_enum[4]), -+}; -+ -+static const struct snd_kcontrol_new w8741_snd_controls_mono_right[] = { -+SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACRLSB_ATTENUATION, -+ 0, 31, 0, dac_tlv_fine), -+SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACRMSB_ATTENUATION, -+ 0, 31, 1, dac_tlv_coarse), -+SOC_ENUM("DAC Dither", w8741_enum[0]), -+SOC_ENUM("DAC Digital Filter", w8741_enum[1]), -+SOC_ENUM("DAC Phase Invert", w8741_enum[2]), -+SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), -+SOC_ENUM("DAC Soft Mute", w8741_enum[4]), -+}; -+ -+static int w8741_add_controls(struct snd_soc_codec *codec) -+{ -+ struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); -+ -+ switch (wm8741->pdata.diff_mode) { -+ case WM8741_DIFF_MODE_STEREO: -+ case WM8741_DIFF_MODE_STEREO_REVERSED: -+ snd_soc_add_codec_controls(codec, -+ w8741_snd_controls_stereo, -+ ARRAY_SIZE(w8741_snd_controls_stereo)); -+ break; -+ case WM8741_DIFF_MODE_MONO_LEFT: -+ snd_soc_add_codec_controls(codec, -+ w8741_snd_controls_mono_left, -+ ARRAY_SIZE(w8741_snd_controls_mono_left)); -+ break; -+ case WM8741_DIFF_MODE_MONO_RIGHT: -+ snd_soc_add_codec_controls(codec, -+ w8741_snd_controls_mono_right, -+ ARRAY_SIZE(w8741_snd_controls_mono_right)); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int digidac1_soundcard_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_pcm_runtime *wm8741_rtd; -+ struct snd_soc_codec *wm8741_codec; -+ struct snd_card *sound_card = card->snd_card; -+ struct snd_kcontrol *kctl; -+ int ret; -+ -+ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); -+ if (!wm8741_rtd) { -+ dev_warn(card->dev, "digidac1_soundcard_init: couldn't get wm8741 rtd\n"); -+ return -EFAULT; -+ } -+ wm8741_codec = wm8741_rtd->codec; -+ ret = w8741_add_controls(wm8741_codec); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to add new wm8741 controls: %d\n", -+ ret); -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ kctl = snd_soc_card_get_kcontrol(card, -+ "Playback Volume"); -+ if (kctl) { -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ snd_ctl_remove(sound_card, kctl); -+ } -+ kctl = snd_soc_card_get_kcontrol(card, -+ "Fine Playback Volume"); -+ if (kctl) { -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ snd_ctl_remove(sound_card, kctl); -+ } -+ return 0; -+} -+ -+static int digidac1_soundcard_startup(struct snd_pcm_substream *substream) -+{ -+ /* turn on wm8804 digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_pcm_runtime *wm8741_rtd; -+ struct snd_soc_codec *wm8741_codec; -+ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); -+ if (!wm8741_rtd) { -+ dev_warn(card->dev, "digidac1_soundcard_startup: couldn't get WM8741 rtd\n"); -+ return -EFAULT; -+ } -+ wm8741_codec = wm8741_rtd->codec; -+ -+ /* latch wm8741 level */ -+ snd_soc_update_bits(wm8741_codec, WM8741_DACLLSB_ATTENUATION, -+ WM8741_UPDATELL, WM8741_UPDATELL); -+ snd_soc_update_bits(wm8741_codec, WM8741_DACLMSB_ATTENUATION, -+ WM8741_UPDATELM, WM8741_UPDATELM); -+ snd_soc_update_bits(wm8741_codec, WM8741_DACRLSB_ATTENUATION, -+ WM8741_UPDATERL, WM8741_UPDATERL); -+ snd_soc_update_bits(wm8741_codec, WM8741_DACRMSB_ATTENUATION, -+ WM8741_UPDATERM, WM8741_UPDATERM); -+ -+ return 0; -+} -+ -+static void digidac1_soundcard_shutdown(struct snd_pcm_substream *substream) -+{ -+ /* turn off wm8804 digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+} -+ -+static int digidac1_soundcard_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_pcm_runtime *wm8741_rtd; -+ struct snd_soc_codec *wm8741_codec; -+ -+ int sysclk = 27000000; -+ long mclk_freq = 0; -+ int mclk_div = 1; -+ int sampling_freq = 1; -+ int ret; -+ -+ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); -+ if (!wm8741_rtd) { -+ dev_warn(card->dev, "digidac1_soundcard_hw_params: couldn't get WM8741 rtd\n"); -+ return -EFAULT; -+ } -+ wm8741_codec = wm8741_rtd->codec; -+ samplerate = params_rate(params); -+ -+ if (samplerate <= 96000) { -+ mclk_freq = samplerate*256; -+ mclk_div = WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq = samplerate*128; -+ mclk_div = WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq = 0x03; -+ break; -+ case 44100: -+ sampling_freq = 0x00; -+ break; -+ case 48000: -+ sampling_freq = 0x02; -+ break; -+ case 88200: -+ sampling_freq = 0x08; -+ break; -+ case 96000: -+ sampling_freq = 0x0a; -+ break; -+ case 176400: -+ sampling_freq = 0x0c; -+ break; -+ case 192000: -+ sampling_freq = 0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ /* Enable wm8804 TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* wm8804 Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* wm8804 set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ /* Now update wm8741 registers for the correct oversampling */ -+ if (samplerate <= 48000) -+ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, -+ WM8741_OSR_MASK, 0x00); -+ else if (samplerate <= 96000) -+ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, -+ WM8741_OSR_MASK, 0x20); -+ else -+ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, -+ WM8741_OSR_MASK, 0x40); -+ -+ /* wm8741 bit size */ -+ switch (params_width(params)) { -+ case 16: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x00); -+ break; -+ case 20: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x01); -+ break; -+ case 24: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x02); -+ break; -+ case 32: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x03); -+ break; -+ default: -+ dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", -+ params_width(params)); -+ return -EINVAL; -+ } -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+/* machine stream operations */ -+static struct snd_soc_ops digidac1_soundcard_ops = { -+ .hw_params = digidac1_soundcard_hw_params, -+ .startup = digidac1_soundcard_startup, -+ .shutdown = digidac1_soundcard_shutdown, -+}; -+ -+static struct snd_soc_dai_link digidac1_soundcard_dai[] = { -+ { -+ .name = "RRA DigiDAC1", -+ .stream_name = "RRA DigiDAC1 HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &digidac1_soundcard_ops, -+ .init = digidac1_soundcard_init, -+ }, -+ { -+ .name = "RRA DigiDAC11", -+ .stream_name = "RRA DigiDAC11 HiFi", -+ .cpu_dai_name = "wm8804-spdif", -+ .codec_dai_name = "wm8741", -+ .codec_name = "wm8741.1-001a", -+ .dai_fmt = SND_SOC_DAIFMT_I2S -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBS_CFS, -+ }, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card digidac1_soundcard = { -+ .name = "digidac1-soundcard", -+ .owner = THIS_MODULE, -+ .dai_link = digidac1_soundcard_dai, -+ .num_links = ARRAY_SIZE(digidac1_soundcard_dai), -+}; -+ -+static int digidac1_soundcard_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ digidac1_soundcard.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &digidac1_soundcard_dai[0]; -+ -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&digidac1_soundcard); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int digidac1_soundcard_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&digidac1_soundcard); -+} -+ -+static const struct of_device_id digidac1_soundcard_of_match[] = { -+ { .compatible = "rra,digidac1-soundcard", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, digidac1_soundcard_of_match); -+ -+static struct platform_driver digidac1_soundcard_driver = { -+ .driver = { -+ .name = "digidac1-audio", -+ .owner = THIS_MODULE, -+ .of_match_table = digidac1_soundcard_of_match, -+ }, -+ .probe = digidac1_soundcard_probe, -+ .remove = digidac1_soundcard_remove, -+}; -+ -+module_platform_driver(digidac1_soundcard_driver); -+ -+MODULE_AUTHOR("José M. Tasende "); -+MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); -+MODULE_LICENSE("GPL v2"); - -From 1a76a9a2ca9445123234adc7b30e448216da6017 Mon Sep 17 00:00:00 2001 -From: DigitalDreamtime -Date: Sat, 2 Jul 2016 16:26:19 +0100 -Subject: [PATCH 082/122] Add support for Dion Audio LOCO DAC-AMP HAT - -Using dedicated machine driver and pcm5102a codec driver. - -Signed-off-by: DigitalDreamtime ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 3 +- - sound/soc/bcm/dionaudio_loco.c | 121 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 130 insertions(+), 1 deletion(-) - create mode 100644 sound/soc/bcm/dionaudio_loco.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 2be5b64fb0d5dcad0d5747626015a6886c3c273b..b8cb5eb7af9b3e6d8d100926e04bfef629641d1d 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -109,3 +109,10 @@ config SND_DIGIDAC1_SOUNDCARD - select SND_SOC_WM8741 - help - Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. -+ -+config SND_BCM2708_SOC_DIONAUDIO_LOCO -+ tristate "Support for Dion Audio LOCO DAC-AMP" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM5102a -+ help -+ Say Y or M if you want to add support for Dion Audio LOCO. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a5c30c0bdacafb2bd09b6ac2f8a3bdc6a85a8404..28cdf019dbc7aafda194c83817d260ad1a477666 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -22,6 +22,7 @@ snd-soc-iqaudio-digi-objs := iqaudio_digi.o - snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o -+snd-soc-dionaudio-loco-objs := dionaudio_loco.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -36,4 +37,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI) += snd-soc-iqaudio-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o - obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o -- -+obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO) += snd-soc-dionaudio-loco.o -diff --git a/sound/soc/bcm/dionaudio_loco.c b/sound/soc/bcm/dionaudio_loco.c -new file mode 100644 -index 0000000000000000000000000000000000000000..89e65317512bc774453ac8d0d5b0ff98aacb740a ---- /dev/null -+++ b/sound/soc/bcm/dionaudio_loco.c -@@ -0,0 +1,121 @@ -+/* -+ * ASoC Driver for Dion Audio LOCO DAC-AMP -+ * -+ * Author: Miquel Blauw -+ * Copyright 2016 -+ * -+ * Based on the software of the RPi-DAC writen by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_dionaudio_loco_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_dionaudio_loco_ops = { -+ .hw_params = snd_rpi_dionaudio_loco_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_dionaudio_loco_dai[] = { -+{ -+ .name = "DionAudio LOCO", -+ .stream_name = "DionAudio LOCO DAC-AMP", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm5102a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm5102a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_dionaudio_loco_ops, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_dionaudio_loco = { -+ .name = "snd_rpi_dionaudio_loco", -+ .dai_link = snd_rpi_dionaudio_loco_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_dionaudio_loco_dai), -+}; -+ -+static int snd_rpi_dionaudio_loco_probe(struct platform_device *pdev) -+{ -+ struct device_node *np; -+ int ret = 0; -+ -+ snd_rpi_dionaudio_loco.dev = &pdev->dev; -+ -+ np = pdev->dev.of_node; -+ if (np) { -+ struct snd_soc_dai_link *dai = &snd_rpi_dionaudio_loco_dai[0]; -+ struct device_node *i2s_np; -+ -+ i2s_np = of_parse_phandle(np, "i2s-controller", 0); -+ if (i2s_np) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_np; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_np; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_dionaudio_loco); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_dionaudio_loco_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_dionaudio_loco); -+} -+ -+static const struct of_device_id snd_rpi_dionaudio_loco_of_match[] = { -+ { .compatible = "dionaudio,loco-pcm5242-tpa3118", }, -+ { /* sentinel */ }, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_dionaudio_loco_of_match); -+ -+static struct platform_driver snd_rpi_dionaudio_loco_driver = { -+ .driver = { -+ .name = "snd-dionaudio-loco", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_dionaudio_loco_of_match, -+ }, -+ .probe = snd_rpi_dionaudio_loco_probe, -+ .remove = snd_rpi_dionaudio_loco_remove, -+}; -+ -+module_platform_driver(snd_rpi_dionaudio_loco_driver); -+ -+MODULE_AUTHOR("Miquel Blauw "); -+MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO"); -+MODULE_LICENSE("GPL v2"); - -From 38964afabad4b0ae7e3d50153daf97dd98277597 Mon Sep 17 00:00:00 2001 -From: Clive Messer -Date: Mon, 19 Sep 2016 14:01:04 +0100 -Subject: [PATCH 083/122] Allo Piano DAC boards: Initial 2 channel (stereo) - support (#1645) - -Add initial 2 channel (stereo) support for Allo Piano DAC (2.0/2.1) boards, -using allo-piano-dac-pcm512x-audio overlay and allo-piano-dac ALSA ASoC -machine driver. - -NB. The initial support is 2 channel (stereo) ONLY! -(The Piano DAC 2.1 will only support 2 channel (stereo) left/right output, - pending an update to the upstream pcm512x codec driver, which will have - to be submitted via upstream. With the initial downstream support, - provided by this patch, the Piano DAC 2.1 subwoofer outputs will - not function.) - -Signed-off-by: Baswaraj K -Signed-off-by: Clive Messer -Tested-by: Clive Messer ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/allo-piano-dac.c | 144 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 153 insertions(+) - create mode 100644 sound/soc/bcm/allo-piano-dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index b8cb5eb7af9b3e6d8d100926e04bfef629641d1d..4f0330a6c06115f077938cba3dc744d4ae10f056 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -116,3 +116,10 @@ config SND_BCM2708_SOC_DIONAUDIO_LOCO - select SND_SOC_PCM5102a - help - Say Y or M if you want to add support for Dion Audio LOCO. -+ -+config SND_BCM2708_SOC_ALLO_PIANO_DAC -+ tristate "Support for Allo Piano DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for Allo Piano DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 28cdf019dbc7aafda194c83817d260ad1a477666..4b94a42efecaee41df37f3c59fddefa5fe78521c 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -23,6 +23,7 @@ snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o - snd-soc-dionaudio-loco-objs := dionaudio_loco.o -+snd-soc-allo-piano-dac-objs := allo-piano-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -38,3 +39,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o - obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o - obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO) += snd-soc-dionaudio-loco.o -+obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o -diff --git a/sound/soc/bcm/allo-piano-dac.c b/sound/soc/bcm/allo-piano-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8e8e62e5a36a279b425ed4655cfbac99ecd7e4cf ---- /dev/null -+++ b/sound/soc/bcm/allo-piano-dac.c -@@ -0,0 +1,144 @@ -+/* -+ * ALSA ASoC Machine Driver for Allo Piano DAC -+ * -+ * Author: Baswaraj K -+ * Copyright 2016 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+static bool digital_gain_0db_limit = true; -+ -+static int snd_allo_piano_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ if (digital_gain_0db_limit) { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", -+ 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", -+ ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_allo_piano_dac_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_allo_piano_dac_ops = { -+ .hw_params = snd_allo_piano_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_allo_piano_dac_dai[] = { -+{ -+ .name = "Piano DAC", -+ .stream_name = "Piano DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_allo_piano_dac_ops, -+ .init = snd_allo_piano_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_allo_piano_dac = { -+ .name = "PianoDAC", -+ .owner = THIS_MODULE, -+ .dai_link = snd_allo_piano_dac_dai, -+ .num_links = ARRAY_SIZE(snd_allo_piano_dac_dai), -+}; -+ -+static int snd_allo_piano_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_allo_piano_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai; -+ -+ dai = &snd_allo_piano_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "allo,24db_digital_gain"); -+ } -+ -+ ret = snd_soc_register_card(&snd_allo_piano_dac); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_allo_piano_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_allo_piano_dac); -+} -+ -+static const struct of_device_id snd_allo_piano_dac_of_match[] = { -+ { .compatible = "allo,piano-dac", }, -+ { /* sentinel */ }, -+}; -+MODULE_DEVICE_TABLE(of, snd_allo_piano_dac_of_match); -+ -+static struct platform_driver snd_allo_piano_dac_driver = { -+ .driver = { -+ .name = "snd-allo-piano-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_allo_piano_dac_of_match, -+ }, -+ .probe = snd_allo_piano_dac_probe, -+ .remove = snd_allo_piano_dac_remove, -+}; -+ -+module_platform_driver(snd_allo_piano_dac_driver); -+ -+MODULE_AUTHOR("Baswaraj K "); -+MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC"); -+MODULE_LICENSE("GPL v2"); - -From 32c97c8263ee9440ac09cf4c117a00563ba86748 Mon Sep 17 00:00:00 2001 -From: gtrainavicius -Date: Sun, 23 Oct 2016 12:06:53 +0300 -Subject: [PATCH 084/122] Support for Blokas Labs pisound board - -Pisound dynamic overlay (#1760) - -Restructuring pisound-overlay.dts, so it can be loaded and unloaded dynamically using dtoverlay. - -Print a logline when the kernel module is removed. ---- - .../devicetree/bindings/vendor-prefixes.txt | 1 + - arch/arm/boot/dts/overlays/pisound-overlay.dts | 94 +- - sound/soc/bcm/Kconfig | 6 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/pisound.c | 989 +++++++++++++++++++++ - 5 files changed, 1048 insertions(+), 44 deletions(-) - create mode 100644 sound/soc/bcm/pisound.c - -diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt -index f0a48ea78659c933839554ca879babb1b621b264..779c19033acad30ed8fd71f015ee76caef1a0568 100644 ---- a/Documentation/devicetree/bindings/vendor-prefixes.txt -+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt -@@ -40,6 +40,7 @@ auvidea Auvidea GmbH - avago Avago Technologies - avic Shanghai AVIC Optoelectronics Co., Ltd. - axis Axis Communications AB -+blokaslabs Vilniaus Blokas UAB - boe BOE Technology Group Co., Ltd. - bosch Bosch Sensortec GmbH - boundary Boundary Devices Inc. -diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts -index 7cdfc29ba4fbffd3216376677922e7ae26019055..5197e656a3d741d14bd9dd6c812b4b93be1419a2 100644 ---- a/arch/arm/boot/dts/overlays/pisound-overlay.dts -+++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts -@@ -26,6 +26,54 @@ - compatible = "brcm,bcm2708"; - - fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pisound_spi: pisound_spi@0{ -+ compatible = "blokaslabs,pisound-spi"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; -+ spi-max-frequency = <1000000>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@5 { - target = <&sound>; - __overlay__ { - compatible = "blokaslabs,pisound"; -@@ -49,7 +97,7 @@ - }; - }; - -- fragment@1 { -+ fragment@6 { - target = <&gpio>; - __overlay__ { - pinctrl-names = "default"; -@@ -63,52 +111,10 @@ - }; - }; - -- fragment@2 { -+ fragment@7 { - target = <&i2s>; - __overlay__ { - status = "okay"; - }; - }; -- -- fragment@3 { -- target-path = "/"; -- __overlay__ { -- pcm5102a-codec { -- #sound-dai-cells = <0>; -- compatible = "ti,pcm5102a"; -- status = "okay"; -- }; -- }; -- }; -- -- fragment@4 { -- target = <&spi0>; -- __overlay__ { -- status = "okay"; -- -- spidev@0{ -- status = "disabled"; -- }; -- -- spidev@1{ -- status = "okay"; -- }; -- }; -- }; -- -- fragment@5 { -- target = <&spi0>; -- __overlay__ { -- #address-cells = <1>; -- #size-cells = <0>; -- -- pisound_spi: pisound_spi@0{ -- compatible = "blokaslabs,pisound-spi"; -- reg = <0>; -- pinctrl-names = "default"; -- pinctrl-0 = <&spi0_pins>; -- spi-max-frequency = <1000000>; -- }; -- }; -- }; - }; -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 4f0330a6c06115f077938cba3dc744d4ae10f056..a0ef6a028136beb27ed13a4136712a70a60f2966 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -123,3 +123,9 @@ config SND_BCM2708_SOC_ALLO_PIANO_DAC - select SND_SOC_PCM512x_I2C - help - Say Y or M if you want to add support for Allo Piano DAC. -+ -+config SND_PISOUND -+ tristate "Support for Blokas Labs pisound" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ help -+ Say Y or M if you want to add support for Blokas Labs pisound. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 4b94a42efecaee41df37f3c59fddefa5fe78521c..f720a3d3b5832844ee6d0558317c728f00c40b65 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -24,6 +24,7 @@ snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o - snd-soc-dionaudio-loco-objs := dionaudio_loco.o - snd-soc-allo-piano-dac-objs := allo-piano-dac.o -+snd-soc-pisound-objs := pisound.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -40,3 +41,4 @@ obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundca - obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o - obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO) += snd-soc-dionaudio-loco.o - obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o -+obj-$(CONFIG_SND_PISOUND) += snd-soc-pisound.o -diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4b8545487d06e4ea70073a5d063fb2310b3b94d0 ---- /dev/null -+++ b/sound/soc/bcm/pisound.c -@@ -0,0 +1,989 @@ -+/* -+ * pisound Linux kernel module. -+ * Copyright (C) 2016 Vilniaus Blokas UAB, http://blokas.io/pisound -+ * -+ * 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; version 2 of the -+ * License. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -+ * MA 02110-1301, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int pisnd_spi_init(struct device *dev); -+static void pisnd_spi_uninit(void); -+ -+static void pisnd_spi_send(uint8_t val); -+static uint8_t pisnd_spi_recv(uint8_t *buffer, uint8_t length); -+ -+typedef void (*pisnd_spi_recv_cb)(void *data); -+static void pisnd_spi_set_callback(pisnd_spi_recv_cb cb, void *data); -+ -+static const char *pisnd_spi_get_serial(void); -+static const char *pisnd_spi_get_id(void); -+static const char *pisnd_spi_get_version(void); -+ -+static int pisnd_midi_init(struct snd_card *card); -+static void pisnd_midi_uninit(void); -+ -+#define PISOUND_LOG_PREFIX "pisound: " -+ -+#ifdef DEBUG -+# define printd(...) pr_alert(PISOUND_LOG_PREFIX __VA_ARGS__) -+#else -+# define printd(...) do {} while (0) -+#endif -+ -+#define printe(...) pr_err(PISOUND_LOG_PREFIX __VA_ARGS__) -+#define printi(...) pr_info(PISOUND_LOG_PREFIX __VA_ARGS__) -+ -+static int pisnd_output_open(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static int pisnd_output_close(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static void pisnd_output_trigger( -+ struct snd_rawmidi_substream *substream, -+ int up -+ ) -+{ -+ uint8_t data; -+ -+ if (!up) -+ return; -+ -+ while (snd_rawmidi_transmit_peek(substream, &data, 1)) { -+ pisnd_spi_send(data); -+ snd_rawmidi_transmit_ack(substream, 1); -+ } -+} -+ -+static void pisnd_output_drain(struct snd_rawmidi_substream *substream) -+{ -+ uint8_t data; -+ -+ while (snd_rawmidi_transmit_peek(substream, &data, 1)) { -+ pisnd_spi_send(data); -+ -+ snd_rawmidi_transmit_ack(substream, 1); -+ } -+} -+ -+static int pisnd_input_open(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static int pisnd_input_close(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static void pisnd_midi_recv_callback(void *substream) -+{ -+ uint8_t data[128]; -+ uint8_t n = 0; -+ -+ while ((n = pisnd_spi_recv(data, sizeof(data)))) { -+ int res = snd_rawmidi_receive(substream, data, n); -+ (void)res; -+ printd("midi recv 0x%02x, res = %d\n", data, res); -+ } -+} -+ -+static void pisnd_input_trigger(struct snd_rawmidi_substream *substream, int up) -+{ -+ if (up) { -+ pisnd_spi_set_callback(pisnd_midi_recv_callback, substream); -+ pisnd_midi_recv_callback(substream); -+ } else { -+ pisnd_spi_set_callback(NULL, NULL); -+ } -+} -+ -+static struct snd_rawmidi *g_rmidi; -+ -+static struct snd_rawmidi_ops pisnd_output_ops = { -+ .open = pisnd_output_open, -+ .close = pisnd_output_close, -+ .trigger = pisnd_output_trigger, -+ .drain = pisnd_output_drain, -+}; -+ -+static struct snd_rawmidi_ops pisnd_input_ops = { -+ .open = pisnd_input_open, -+ .close = pisnd_input_close, -+ .trigger = pisnd_input_trigger, -+}; -+ -+static void pisnd_get_port_info( -+ struct snd_rawmidi *rmidi, -+ int number, -+ struct snd_seq_port_info *seq_port_info -+ ) -+{ -+ seq_port_info->type = -+ SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | -+ SNDRV_SEQ_PORT_TYPE_HARDWARE | -+ SNDRV_SEQ_PORT_TYPE_PORT; -+ seq_port_info->midi_voices = 0; -+} -+ -+static struct snd_rawmidi_global_ops pisnd_global_ops = { -+ .get_port_info = pisnd_get_port_info, -+}; -+ -+static int pisnd_midi_init(struct snd_card *card) -+{ -+ int err = snd_rawmidi_new(card, "pisound MIDI", 0, 1, 1, &g_rmidi); -+ -+ if (err < 0) { -+ printe("snd_rawmidi_new failed: %d\n", err); -+ return err; -+ } -+ -+ strcpy(g_rmidi->name, "pisound MIDI "); -+ strcat(g_rmidi->name, pisnd_spi_get_serial()); -+ -+ g_rmidi->info_flags = -+ SNDRV_RAWMIDI_INFO_OUTPUT | -+ SNDRV_RAWMIDI_INFO_INPUT | -+ SNDRV_RAWMIDI_INFO_DUPLEX; -+ -+ g_rmidi->ops = &pisnd_global_ops; -+ -+ g_rmidi->private_data = (void *)0; -+ -+ snd_rawmidi_set_ops( -+ g_rmidi, -+ SNDRV_RAWMIDI_STREAM_OUTPUT, -+ &pisnd_output_ops -+ ); -+ -+ snd_rawmidi_set_ops( -+ g_rmidi, -+ SNDRV_RAWMIDI_STREAM_INPUT, -+ &pisnd_input_ops -+ ); -+ -+ return 0; -+} -+ -+static void pisnd_midi_uninit(void) -+{ -+} -+ -+static void *g_recvData; -+static pisnd_spi_recv_cb g_recvCallback; -+ -+#define FIFO_SIZE 512 -+ -+static char g_serial_num[11]; -+static char g_id[25]; -+static char g_version[5]; -+ -+DEFINE_KFIFO(spi_fifo_in, uint8_t, FIFO_SIZE); -+DEFINE_KFIFO(spi_fifo_out, uint8_t, FIFO_SIZE); -+ -+static struct gpio_desc *data_available; -+static struct gpio_desc *spi_reset; -+ -+static struct spi_device *pisnd_spi_device; -+ -+static struct workqueue_struct *pisnd_workqueue; -+static struct work_struct pisnd_work_process; -+ -+static void pisnd_work_handler(struct work_struct *work); -+ -+static uint16_t spi_transfer16(uint16_t val); -+ -+static int pisnd_init_workqueues(void) -+{ -+ pisnd_workqueue = create_singlethread_workqueue("pisnd_workqueue"); -+ INIT_WORK(&pisnd_work_process, pisnd_work_handler); -+ -+ return 0; -+} -+ -+static void pisnd_uninit_workqueues(void) -+{ -+ flush_workqueue(pisnd_workqueue); -+ destroy_workqueue(pisnd_workqueue); -+ -+ pisnd_workqueue = NULL; -+} -+ -+static bool pisnd_spi_has_more(void) -+{ -+ return gpiod_get_value(data_available); -+} -+ -+enum task_e { -+ TASK_PROCESS = 0, -+}; -+ -+static void pisnd_schedule_process(enum task_e task) -+{ -+ if (pisnd_spi_device != NULL && -+ pisnd_workqueue != NULL && -+ !work_pending(&pisnd_work_process) -+ ) { -+ printd("schedule: has more = %d\n", pisnd_spi_has_more()); -+ if (task == TASK_PROCESS) -+ queue_work(pisnd_workqueue, &pisnd_work_process); -+ } -+} -+ -+static irqreturn_t data_available_interrupt_handler(int irq, void *dev_id) -+{ -+ if (irq == gpiod_to_irq(data_available) && pisnd_spi_has_more()) { -+ printd("schedule from irq\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static DEFINE_SPINLOCK(spilock); -+static unsigned long spilockflags; -+ -+static uint16_t spi_transfer16(uint16_t val) -+{ -+ int err; -+ struct spi_transfer transfer; -+ struct spi_message msg; -+ uint8_t txbuf[2]; -+ uint8_t rxbuf[2]; -+ -+ if (!pisnd_spi_device) { -+ printe("pisnd_spi_device null, returning\n"); -+ return 0; -+ } -+ -+ spi_message_init(&msg); -+ -+ memset(&transfer, 0, sizeof(transfer)); -+ memset(&rxbuf, 0, sizeof(rxbuf)); -+ -+ txbuf[0] = val >> 8; -+ txbuf[1] = val & 0xff; -+ -+ transfer.tx_buf = &txbuf; -+ transfer.rx_buf = &rxbuf; -+ transfer.len = sizeof(txbuf); -+ transfer.speed_hz = 125000; -+ transfer.delay_usecs = 100; -+ spi_message_add_tail(&transfer, &msg); -+ -+ spin_lock_irqsave(&spilock, spilockflags); -+ err = spi_sync(pisnd_spi_device, &msg); -+ spin_unlock_irqrestore(&spilock, spilockflags); -+ -+ if (err < 0) { -+ printe("spi_sync error %d\n", err); -+ return 0; -+ } -+ -+ printd("received: %02x%02x\n", rxbuf[0], rxbuf[1]); -+ printd("hasMore %d\n", pisnd_spi_has_more()); -+ -+ return (rxbuf[0] << 8) | rxbuf[1]; -+} -+ -+static int spi_read_bytes(char *dst, size_t length, uint8_t *bytesRead) -+{ -+ uint16_t rx; -+ uint8_t size; -+ uint8_t i; -+ -+ memset(dst, 0, length); -+ *bytesRead = 0; -+ -+ rx = spi_transfer16(0); -+ if (!(rx >> 8)) -+ return -EINVAL; -+ -+ size = rx & 0xff; -+ -+ if (size > length) -+ return -EINVAL; -+ -+ for (i = 0; i < size; ++i) { -+ rx = spi_transfer16(0); -+ if (!(rx >> 8)) -+ return -EINVAL; -+ -+ dst[i] = rx & 0xff; -+ } -+ -+ *bytesRead = i; -+ -+ return 0; -+} -+ -+static int spi_device_match(struct device *dev, void *data) -+{ -+ struct spi_device *spi = container_of(dev, struct spi_device, dev); -+ -+ printd(" %s %s %dkHz %d bits mode=0x%02X\n", -+ spi->modalias, dev_name(dev), spi->max_speed_hz/1000, -+ spi->bits_per_word, spi->mode); -+ -+ if (strcmp("pisound-spi", spi->modalias) == 0) { -+ printi("\tFound!\n"); -+ return 1; -+ } -+ -+ printe("\tNot found!\n"); -+ return 0; -+} -+ -+static struct spi_device *pisnd_spi_find_device(void) -+{ -+ struct device *dev; -+ -+ printi("Searching for spi device...\n"); -+ dev = bus_find_device(&spi_bus_type, NULL, NULL, spi_device_match); -+ if (dev != NULL) -+ return container_of(dev, struct spi_device, dev); -+ else -+ return NULL; -+} -+ -+static void pisnd_work_handler(struct work_struct *work) -+{ -+ uint16_t rx; -+ uint16_t tx; -+ uint8_t val; -+ -+ if (work == &pisnd_work_process) { -+ if (pisnd_spi_device == NULL) -+ return; -+ -+ do { -+ val = 0; -+ tx = 0; -+ -+ if (kfifo_get(&spi_fifo_out, &val)) -+ tx = 0x0f00 | val; -+ -+ rx = spi_transfer16(tx); -+ -+ if (rx & 0xff00) { -+ kfifo_put(&spi_fifo_in, rx & 0xff); -+ if (kfifo_len(&spi_fifo_in) > 16 -+ && g_recvCallback) -+ g_recvCallback(g_recvData); -+ } -+ } while (rx != 0 -+ || !kfifo_is_empty(&spi_fifo_out) -+ || pisnd_spi_has_more() -+ ); -+ -+ if (!kfifo_is_empty(&spi_fifo_in) && g_recvCallback) -+ g_recvCallback(g_recvData); -+ } -+} -+ -+static int pisnd_spi_gpio_init(struct device *dev) -+{ -+ spi_reset = gpiod_get_index(dev, "reset", 1, GPIOD_ASIS); -+ data_available = gpiod_get_index(dev, "data_available", 0, GPIOD_ASIS); -+ -+ gpiod_direction_output(spi_reset, 1); -+ gpiod_direction_input(data_available); -+ -+ /* Reset the slave. */ -+ gpiod_set_value(spi_reset, false); -+ mdelay(1); -+ gpiod_set_value(spi_reset, true); -+ -+ /* Give time for spi slave to start. */ -+ mdelay(64); -+ -+ return 0; -+} -+ -+static void pisnd_spi_gpio_uninit(void) -+{ -+ gpiod_set_value(spi_reset, false); -+ gpiod_put(spi_reset); -+ spi_reset = NULL; -+ -+ gpiod_put(data_available); -+ data_available = NULL; -+} -+ -+static int pisnd_spi_gpio_irq_init(struct device *dev) -+{ -+ return request_irq( -+ gpiod_to_irq(data_available), -+ data_available_interrupt_handler, -+ IRQF_TIMER | IRQF_TRIGGER_RISING, -+ "data_available_int", -+ NULL -+ ); -+} -+ -+static void pisnd_spi_gpio_irq_uninit(void) -+{ -+ free_irq(gpiod_to_irq(data_available), NULL); -+} -+ -+static int spi_read_info(void) -+{ -+ uint16_t tmp; -+ uint8_t count; -+ uint8_t n; -+ uint8_t i; -+ uint8_t j; -+ char buffer[257]; -+ int ret; -+ char *p; -+ -+ memset(g_serial_num, 0, sizeof(g_serial_num)); -+ memset(g_version, 0, sizeof(g_version)); -+ memset(g_id, 0, sizeof(g_id)); -+ -+ tmp = spi_transfer16(0); -+ -+ if (!(tmp >> 8)) -+ return -EINVAL; -+ -+ count = tmp & 0xff; -+ -+ for (i = 0; i < count; ++i) { -+ memset(buffer, 0, sizeof(buffer)); -+ ret = spi_read_bytes(buffer, sizeof(buffer)-1, &n); -+ -+ if (ret < 0) -+ return ret; -+ -+ switch (i) { -+ case 0: -+ if (n != 2) -+ return -EINVAL; -+ -+ snprintf( -+ g_version, -+ sizeof(g_version), -+ "%x.%02x", -+ buffer[0], -+ buffer[1] -+ ); -+ break; -+ case 1: -+ if (n >= sizeof(g_serial_num)) -+ return -EINVAL; -+ -+ memcpy(g_serial_num, buffer, sizeof(g_serial_num)); -+ break; -+ case 2: -+ { -+ if (n >= sizeof(g_id)) -+ return -EINVAL; -+ -+ p = g_id; -+ for (j = 0; j < n; ++j) -+ p += sprintf(p, "%02x", buffer[j]); -+ } -+ break; -+ default: -+ break; -+ } -+ } -+ -+ return 0; -+} -+ -+static int pisnd_spi_init(struct device *dev) -+{ -+ int ret; -+ struct spi_device *spi; -+ -+ memset(g_serial_num, 0, sizeof(g_serial_num)); -+ memset(g_id, 0, sizeof(g_id)); -+ memset(g_version, 0, sizeof(g_version)); -+ -+ spi = pisnd_spi_find_device(); -+ -+ if (spi != NULL) { -+ printd("initializing spi!\n"); -+ pisnd_spi_device = spi; -+ ret = spi_setup(pisnd_spi_device); -+ } else { -+ printe("SPI device not found, deferring!\n"); -+ return -EPROBE_DEFER; -+ } -+ -+ ret = pisnd_spi_gpio_init(dev); -+ -+ if (ret < 0) { -+ printe("SPI GPIO init failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_uninit(); -+ return ret; -+ } -+ -+ ret = spi_read_info(); -+ -+ if (ret < 0) { -+ printe("Reading card info failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_uninit(); -+ return ret; -+ } -+ -+ /* Flash the LEDs. */ -+ spi_transfer16(0xf000); -+ -+ ret = pisnd_spi_gpio_irq_init(dev); -+ if (ret < 0) { -+ printe("SPI irq request failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_irq_uninit(); -+ pisnd_spi_gpio_uninit(); -+ } -+ -+ ret = pisnd_init_workqueues(); -+ if (ret != 0) { -+ printe("Workqueue initialization failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_irq_uninit(); -+ pisnd_spi_gpio_uninit(); -+ pisnd_uninit_workqueues(); -+ return ret; -+ } -+ -+ if (pisnd_spi_has_more()) { -+ printd("data is available, scheduling from init\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+ } -+ -+ return 0; -+} -+ -+static void pisnd_spi_uninit(void) -+{ -+ pisnd_uninit_workqueues(); -+ -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ -+ pisnd_spi_gpio_irq_uninit(); -+ pisnd_spi_gpio_uninit(); -+} -+ -+static void pisnd_spi_send(uint8_t val) -+{ -+ kfifo_put(&spi_fifo_out, val); -+ printd("schedule from spi_send\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+} -+ -+static uint8_t pisnd_spi_recv(uint8_t *buffer, uint8_t length) -+{ -+ return kfifo_out(&spi_fifo_in, buffer, length); -+} -+ -+static void pisnd_spi_set_callback(pisnd_spi_recv_cb cb, void *data) -+{ -+ g_recvData = data; -+ g_recvCallback = cb; -+} -+ -+static const char *pisnd_spi_get_serial(void) -+{ -+ if (strlen(g_serial_num)) -+ return g_serial_num; -+ -+ return ""; -+} -+ -+static const char *pisnd_spi_get_id(void) -+{ -+ if (strlen(g_id)) -+ return g_id; -+ -+ return ""; -+} -+ -+static const char *pisnd_spi_get_version(void) -+{ -+ if (strlen(g_version)) -+ return g_version; -+ -+ return ""; -+} -+ -+static const struct of_device_id pisound_of_match[] = { -+ { .compatible = "blokaslabs,pisound", }, -+ { .compatible = "blokaslabs,pisound-spi", }, -+ {}, -+}; -+ -+static struct gpio_desc *osr0, *osr1, *osr2; -+static struct gpio_desc *reset; -+static struct gpio_desc *button; -+ -+static int pisnd_hw_params( -+ struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params -+ ) -+{ -+ printd("rate = %d\n", params_rate(params)); -+ printd("ch = %d\n", params_channels(params)); -+ printd("bits = %u\n", -+ snd_pcm_format_physical_width(params_format(params))); -+ printd("format = %d\n", params_format(params)); -+ -+ gpiod_set_value(reset, false); -+ -+ switch (params_rate(params)) { -+ case 48000: -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, false); -+ gpiod_set_value(osr2, false); -+ break; -+ case 96000: -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, true); -+ gpiod_set_value(osr2, false); -+ break; -+ case 192000: -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, true); -+ gpiod_set_value(osr2, true); -+ break; -+ default: -+ printe("Unsupported rate %u!\n", params_rate(params)); -+ return -EINVAL; -+ } -+ -+ gpiod_set_value(reset, true); -+ -+ return 0; -+} -+ -+static unsigned int rates[3] = { -+ 48000, 96000, 192000 -+}; -+ -+static struct snd_pcm_hw_constraint_list constraints_rates = { -+ .count = ARRAY_SIZE(rates), -+ .list = rates, -+ .mask = 0, -+}; -+ -+static unsigned int sample_bits[] = { -+ 24, 32 -+}; -+ -+static struct snd_pcm_hw_constraint_list constraints_sample_bits = { -+ .count = ARRAY_SIZE(sample_bits), -+ .list = sample_bits, -+ .mask = 0, -+}; -+ -+static int pisnd_startup(struct snd_pcm_substream *substream) -+{ -+ int err = snd_pcm_hw_constraint_list( -+ substream->runtime, -+ 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &constraints_rates -+ ); -+ -+ if (err < 0) -+ return err; -+ -+ err = snd_pcm_hw_constraint_list( -+ substream->runtime, -+ 0, -+ SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -+ &constraints_sample_bits -+ ); -+ -+ if (err < 0) -+ return err; -+ -+ return 0; -+} -+ -+static struct snd_soc_ops pisnd_ops = { -+ .startup = pisnd_startup, -+ .hw_params = pisnd_hw_params, -+}; -+ -+static struct snd_soc_dai_link pisnd_dai[] = { -+ { -+ .name = "pisound", -+ .stream_name = "pisound", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "snd-soc-dummy-dai", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "snd-soc-dummy", -+ .dai_fmt = -+ SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &pisnd_ops, -+ }, -+}; -+ -+static int pisnd_card_probe(struct snd_soc_card *card) -+{ -+ int err = pisnd_midi_init(card->snd_card); -+ -+ if (err < 0) -+ printe("pisnd_midi_init failed: %d\n", err); -+ -+ return err; -+} -+ -+static int pisnd_card_remove(struct snd_soc_card *card) -+{ -+ pisnd_midi_uninit(); -+ return 0; -+} -+ -+static struct snd_soc_card pisnd_card = { -+ .name = "pisound", -+ .owner = THIS_MODULE, -+ .dai_link = pisnd_dai, -+ .num_links = ARRAY_SIZE(pisnd_dai), -+ .probe = pisnd_card_probe, -+ .remove = pisnd_card_remove, -+}; -+ -+static int pisnd_init_gpio(struct device *dev) -+{ -+ osr0 = gpiod_get_index(dev, "osr", 0, GPIOD_ASIS); -+ osr1 = gpiod_get_index(dev, "osr", 1, GPIOD_ASIS); -+ osr2 = gpiod_get_index(dev, "osr", 2, GPIOD_ASIS); -+ -+ reset = gpiod_get_index(dev, "reset", 0, GPIOD_ASIS); -+ -+ button = gpiod_get_index(dev, "button", 0, GPIOD_ASIS); -+ -+ gpiod_direction_output(osr0, 1); -+ gpiod_direction_output(osr1, 1); -+ gpiod_direction_output(osr2, 1); -+ gpiod_direction_output(reset, 1); -+ -+ gpiod_set_value(reset, false); -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, false); -+ gpiod_set_value(osr2, false); -+ gpiod_set_value(reset, true); -+ -+ gpiod_export(button, false); -+ -+ return 0; -+} -+ -+static int pisnd_uninit_gpio(void) -+{ -+ int i; -+ -+ struct gpio_desc **gpios[] = { -+ &osr0, &osr1, &osr2, &reset, &button, -+ }; -+ -+ gpiod_unexport(button); -+ -+ for (i = 0; i < ARRAY_SIZE(gpios); ++i) { -+ if (*gpios[i] == NULL) { -+ printd("weird, GPIO[%d] is NULL already\n", i); -+ continue; -+ } -+ -+ gpiod_put(*gpios[i]); -+ *gpios[i] = NULL; -+ } -+ -+ return 0; -+} -+ -+static struct kobject *pisnd_kobj; -+ -+static ssize_t pisnd_serial_show( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ char *buf -+ ) -+{ -+ return sprintf(buf, "%s\n", pisnd_spi_get_serial()); -+} -+ -+static ssize_t pisnd_id_show( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ char *buf -+ ) -+{ -+ return sprintf(buf, "%s\n", pisnd_spi_get_id()); -+} -+ -+static ssize_t pisnd_version_show( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ char *buf -+ ) -+{ -+ return sprintf(buf, "%s\n", pisnd_spi_get_version()); -+} -+ -+static struct kobj_attribute pisnd_serial_attribute = -+ __ATTR(serial, 0644, pisnd_serial_show, NULL); -+static struct kobj_attribute pisnd_id_attribute = -+ __ATTR(id, 0644, pisnd_id_show, NULL); -+static struct kobj_attribute pisnd_version_attribute = -+ __ATTR(version, 0644, pisnd_version_show, NULL); -+ -+static struct attribute *attrs[] = { -+ &pisnd_serial_attribute.attr, -+ &pisnd_id_attribute.attr, -+ &pisnd_version_attribute.attr, -+ NULL -+}; -+ -+static struct attribute_group attr_group = { .attrs = attrs }; -+ -+static int pisnd_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ int i; -+ -+ ret = pisnd_spi_init(&pdev->dev); -+ if (ret < 0) { -+ printe("pisnd_spi_init failed: %d\n", ret); -+ return ret; -+ } -+ -+ printi("Detected pisound card:\n"); -+ printi("\tSerial: %s\n", pisnd_spi_get_serial()); -+ printi("\tVersion: %s\n", pisnd_spi_get_version()); -+ printi("\tId: %s\n", pisnd_spi_get_id()); -+ -+ pisnd_kobj = kobject_create_and_add("pisound", kernel_kobj); -+ if (!pisnd_kobj) { -+ pisnd_spi_uninit(); -+ return -ENOMEM; -+ } -+ -+ ret = sysfs_create_group(pisnd_kobj, &attr_group); -+ if (ret < 0) { -+ pisnd_spi_uninit(); -+ kobject_put(pisnd_kobj); -+ return -ENOMEM; -+ } -+ -+ pisnd_init_gpio(&pdev->dev); -+ pisnd_card.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ -+ i2s_node = of_parse_phandle( -+ pdev->dev.of_node, -+ "i2s-controller", -+ 0 -+ ); -+ -+ for (i = 0; i < pisnd_card.num_links; ++i) { -+ struct snd_soc_dai_link *dai = &pisnd_dai[i]; -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ dai->stream_name = pisnd_spi_get_serial(); -+ } -+ } -+ } -+ -+ ret = snd_soc_register_card(&pisnd_card); -+ -+ if (ret < 0) { -+ printe("snd_soc_register_card() failed: %d\n", ret); -+ pisnd_uninit_gpio(); -+ kobject_put(pisnd_kobj); -+ pisnd_spi_uninit(); -+ } -+ -+ return ret; -+} -+ -+static int pisnd_remove(struct platform_device *pdev) -+{ -+ printi("Unloading.\n"); -+ -+ if (pisnd_kobj) { -+ kobject_put(pisnd_kobj); -+ pisnd_kobj = NULL; -+ } -+ -+ pisnd_spi_uninit(); -+ -+ /* Turn off */ -+ gpiod_set_value(reset, false); -+ pisnd_uninit_gpio(); -+ -+ return snd_soc_unregister_card(&pisnd_card); -+} -+ -+MODULE_DEVICE_TABLE(of, pisound_of_match); -+ -+static struct platform_driver pisnd_driver = { -+ .driver = { -+ .name = "snd-rpi-pisound", -+ .owner = THIS_MODULE, -+ .of_match_table = pisound_of_match, -+ }, -+ .probe = pisnd_probe, -+ .remove = pisnd_remove, -+}; -+ -+module_platform_driver(pisnd_driver); -+ -+MODULE_AUTHOR("Giedrius Trainavicius "); -+MODULE_DESCRIPTION("ASoC Driver for pisound, http://blokas.io/pisound"); -+MODULE_LICENSE("GPL v2"); - -From 96f367ff7d360c52f563775dd1e9cee71aa63c6d Mon Sep 17 00:00:00 2001 -From: P33M -Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 085/122] rpi_display: add backlight driver and overlay - -Add a mailbox-driven backlight controller for the Raspberry Pi DSI -touchscreen display. Requires updated GPU firmware to recognise the -mailbox request. - -Signed-off-by: Gordon Hollingworth ---- - drivers/video/backlight/Kconfig | 6 ++ - drivers/video/backlight/Makefile | 1 + - drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++++++++++ - 3 files changed, 126 insertions(+) - create mode 100644 drivers/video/backlight/rpi_backlight.c - -diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig -index 5ffa4b4e26c0e874d3f63068456b3d72d8b4beb5..c3023ab052b477dde522a262a360ec312e94de22 100644 ---- a/drivers/video/backlight/Kconfig -+++ b/drivers/video/backlight/Kconfig -@@ -265,6 +265,12 @@ config BACKLIGHT_PWM - If you have a LCD backlight adjustable by PWM, say Y to enable - this driver. - -+config BACKLIGHT_RPI -+ tristate "Raspberry Pi display firmware driven backlight" -+ help -+ If you have the Raspberry Pi DSI touchscreen display, say Y to -+ enable the mailbox-controlled backlight driver. -+ - config BACKLIGHT_DA903X - tristate "Backlight Driver for DA9030/DA9034 using WLED" - depends on PMIC_DA903X -diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile -index 16ec534cff3044209adbae3495c19d97fee3ef73..00eff87fb3391300e78f055fa05d3b9647fa053d 100644 ---- a/drivers/video/backlight/Makefile -+++ b/drivers/video/backlight/Makefile -@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o - obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o - obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o - obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o -+obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o - obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o - obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o - obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o -diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c -new file mode 100644 -index 0000000000000000000000000000000000000000..14a0d9b037395497c1fdae2961feccd509fcbaad ---- /dev/null -+++ b/drivers/video/backlight/rpi_backlight.c -@@ -0,0 +1,119 @@ -+/* -+ * rpi_bl.c - Backlight controller through VPU -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct rpi_backlight { -+ struct device *dev; -+ struct device *fbdev; -+ struct rpi_firmware *fw; -+}; -+ -+static int rpi_backlight_update_status(struct backlight_device *bl) -+{ -+ struct rpi_backlight *gbl = bl_get_data(bl); -+ int brightness = bl->props.brightness; -+ int ret; -+ -+ if (bl->props.power != FB_BLANK_UNBLANK || -+ bl->props.fb_blank != FB_BLANK_UNBLANK || -+ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) -+ brightness = 0; -+ -+ ret = rpi_firmware_property(gbl->fw, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, -+ &brightness, sizeof(brightness)); -+ if (ret) { -+ dev_err(gbl->dev, "Failed to set brightness\n"); -+ return ret; -+ } -+ -+ if (brightness < 0) { -+ dev_err(gbl->dev, "Backlight change failed\n"); -+ return -EAGAIN; -+ } -+ -+ return 0; -+} -+ -+static const struct backlight_ops rpi_backlight_ops = { -+ .options = BL_CORE_SUSPENDRESUME, -+ .update_status = rpi_backlight_update_status, -+}; -+ -+static int rpi_backlight_probe(struct platform_device *pdev) -+{ -+ struct backlight_properties props; -+ struct backlight_device *bl; -+ struct rpi_backlight *gbl; -+ struct device_node *fw_node; -+ -+ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); -+ if (gbl == NULL) -+ return -ENOMEM; -+ -+ gbl->dev = &pdev->dev; -+ -+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_node) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ gbl->fw = rpi_firmware_get(fw_node); -+ if (!gbl->fw) -+ return -EPROBE_DEFER; -+ -+ memset(&props, 0, sizeof(props)); -+ props.type = BACKLIGHT_RAW; -+ props.max_brightness = 255; -+ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), -+ &pdev->dev, gbl, &rpi_backlight_ops, -+ &props); -+ if (IS_ERR(bl)) { -+ dev_err(&pdev->dev, "failed to register backlight\n"); -+ return PTR_ERR(bl); -+ } -+ -+ bl->props.brightness = 255; -+ backlight_update_status(bl); -+ -+ platform_set_drvdata(pdev, bl); -+ return 0; -+} -+ -+static const struct of_device_id rpi_backlight_of_match[] = { -+ { .compatible = "raspberrypi,rpi-backlight" }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); -+ -+static struct platform_driver rpi_backlight_driver = { -+ .driver = { -+ .name = "rpi-backlight", -+ .of_match_table = of_match_ptr(rpi_backlight_of_match), -+ }, -+ .probe = rpi_backlight_probe, -+}; -+ -+module_platform_driver(rpi_backlight_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth "); -+MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); -+MODULE_LICENSE("GPL"); - -From 859fe9e43315cc5f8ec150814ac4d841c9bfdcf1 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 086/122] bcm2835-virtgpio: Virtual GPIO driver - -Add a virtual GPIO driver that uses the firmware mailbox interface to -request that the VPU toggles LEDs. ---- - drivers/gpio/Kconfig | 6 + - drivers/gpio/Makefile | 1 + - drivers/gpio/gpio-bcm-virt.c | 214 +++++++++++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 4 files changed, 222 insertions(+) - create mode 100644 drivers/gpio/gpio-bcm-virt.c - -diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig -index ed37e5908b910cd51cb378ffc171fe2a9104c082..edcb49f9051b703ce35fd1687a6cef8a31bf3627 100644 ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -134,6 +134,12 @@ config GPIO_BCM_KONA - help - Turn on GPIO support for Broadcom "Kona" chips. - -+config GPIO_BCM_VIRT -+ bool "Broadcom Virt GPIO" -+ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || COMPILE_TEST) -+ help -+ Turn on virtual GPIO support for Broadcom BCM283X chips. -+ - config GPIO_BRCMSTB - tristate "BRCMSTB GPIO support" - default y if (ARCH_BRCMSTB || BMIPS_GENERIC) -diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile -index d074c2299393dc9cef3456b0068ff2d229677c27..cfb8d4bad6b0b20bed56643b0870fcff311c12c5 100644 ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -31,6 +31,7 @@ obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o - obj-$(CONFIG_GPIO_AXP209) += gpio-axp209.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o -+obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o - obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o - obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o - obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o -diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c3725546def9d4a6264fbb1f6b9814d02b50e34e ---- /dev/null -+++ b/drivers/gpio/gpio-bcm-virt.c -@@ -0,0 +1,214 @@ -+/* -+ * brcmvirt GPIO driver -+ * -+ * Copyright (C) 2012,2013 Dom Cobley -+ * Based on gpio-clps711x.c by Alexander Shiyan -+ * -+ * 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 -+ -+#define MODULE_NAME "brcmvirt-gpio" -+#define NUM_GPIO 2 -+ -+struct brcmvirt_gpio { -+ struct gpio_chip gc; -+ u32 __iomem *ts_base; -+ /* two packed 16-bit counts of enabled and disables -+ Allows host to detect a brief enable that was missed */ -+ u32 enables_disables[NUM_GPIO]; -+ dma_addr_t bus_addr; -+}; -+ -+static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) -+{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ return -EINVAL; -+} -+ -+static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ return 0; -+} -+ -+static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) -+{ -+ struct brcmvirt_gpio *gpio; -+ unsigned v; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ v = readl(gpio->ts_base + off); -+ return (v >> off) & 1; -+} -+ -+static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ u16 enables, disables; -+ s16 diff; -+ bool lit; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ enables = gpio->enables_disables[off] >> 16; -+ disables = gpio->enables_disables[off] >> 0; -+ diff = (s16)(enables - disables); -+ lit = diff > 0; -+ if ((val && lit) || (!val && !lit)) -+ return; -+ if (val) -+ enables++; -+ else -+ disables++; -+ diff = (s16)(enables - disables); -+ BUG_ON(diff != 0 && diff != 1); -+ gpio->enables_disables[off] = (enables << 16) | (disables << 0); -+ writel(gpio->enables_disables[off], gpio->ts_base + off); -+} -+ -+static int brcmvirt_gpio_probe(struct platform_device *pdev) -+{ -+ int err = 0; -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ struct brcmvirt_gpio *ucb; -+ u32 gpiovirtbuf; -+ -+ fw_node = of_parse_phandle(np, "firmware", 0); -+ if (!fw_node) { -+ dev_err(dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); -+ if (!ucb) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ ucb->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ucb->bus_addr, GFP_KERNEL); -+ if (!ucb->ts_base) { -+ pr_err("[%s]: failed to dma_alloc_coherent(%ld)\n", -+ __func__, PAGE_SIZE); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ gpiovirtbuf = (u32)ucb->bus_addr; -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_GPIOVIRTBUF, -+ &gpiovirtbuf, sizeof(gpiovirtbuf)); -+ -+ if (err || gpiovirtbuf != 0) { -+ dev_warn(dev, "Failed to set gpiovirtbuf, trying to get err:%x\n", err); -+ dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr); -+ ucb->ts_base = 0; -+ ucb->bus_addr = 0; -+ } -+ -+ if (!ucb->ts_base) { -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, -+ &gpiovirtbuf, sizeof(gpiovirtbuf)); -+ -+ if (err) { -+ dev_err(dev, "Failed to get gpiovirtbuf\n"); -+ goto out; -+ } -+ -+ if (!gpiovirtbuf) { -+ dev_err(dev, "No virtgpio buffer\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ -+ // mmap the physical memory -+ gpiovirtbuf &= ~0xc0000000; -+ ucb->ts_base = ioremap(gpiovirtbuf, 4096); -+ if (ucb->ts_base == NULL) { -+ dev_err(dev, "Failed to map physical address\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ ucb->bus_addr = 0; -+ } -+ ucb->gc.label = MODULE_NAME; -+ ucb->gc.owner = THIS_MODULE; -+ //ucb->gc.dev = dev; -+ ucb->gc.of_node = np; -+ ucb->gc.base = 100; -+ ucb->gc.ngpio = NUM_GPIO; -+ -+ ucb->gc.direction_input = brcmvirt_gpio_dir_in; -+ ucb->gc.direction_output = brcmvirt_gpio_dir_out; -+ ucb->gc.get = brcmvirt_gpio_get; -+ ucb->gc.set = brcmvirt_gpio_set; -+ ucb->gc.can_sleep = true; -+ -+ err = gpiochip_add(&ucb->gc); -+ if (err) -+ goto out; -+ -+ platform_set_drvdata(pdev, ucb); -+ -+ return 0; -+out: -+ if (ucb->bus_addr) { -+ dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr); -+ ucb->bus_addr = 0; -+ ucb->ts_base = NULL; -+ } else if (ucb->ts_base) { -+ iounmap(ucb->ts_base); -+ ucb->ts_base = NULL; -+ } -+ return err; -+} -+ -+static int brcmvirt_gpio_remove(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ int err = 0; -+ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); -+ -+ gpiochip_remove(&ucb->gc); -+ if (ucb->bus_addr) -+ dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr); -+ else if (ucb->ts_base) -+ iounmap(ucb->ts_base); -+ return err; -+} -+ -+static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { -+ { .compatible = "brcm,bcm2835-virtgpio" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); -+ -+static struct platform_driver brcmvirt_gpio_driver = { -+ .driver = { -+ .name = MODULE_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), -+ }, -+ .probe = brcmvirt_gpio_probe, -+ .remove = brcmvirt_gpio_remove, -+}; -+module_platform_driver(brcmvirt_gpio_driver); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Dom Cobley "); -+MODULE_DESCRIPTION("brcmvirt GPIO driver"); -+MODULE_ALIAS("platform:brcmvirt-gpio"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index b0f6e33bd30c35664ceee057f4c3ad32b914291d..e92278968b2b979db2a1f855f70e7aafb224fa98 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -116,6 +116,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, - RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF = 0x0004801f, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_GPIOVIRTBUF = 0x00048020, - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, - RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, - - -From 7968227bc3b1b0b1297b304fbfd4a76de6a1f40e Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 087/122] amba_pl011: Don't use DT aliases for numbering - -The pl011 driver looks for DT aliases of the form "serial", -and if found uses as the device ID. This can cause -/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the -other serial port is provided by the 8250 driver which doesn't -use the same logic. ---- - drivers/tty/serial/amba-pl011.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index e2c33b9528d82ed7a2c27d083d7b1d222da68178..5a11ff833e1fd112ba04df3a427cd94bf6793ec5 100644 ---- a/drivers/tty/serial/amba-pl011.c -+++ b/drivers/tty/serial/amba-pl011.c -@@ -2441,7 +2441,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, - if (IS_ERR(base)) - return PTR_ERR(base); - -+ /* Don't use DT serial aliases - it causes the device to -+ be renumbered to ttyAMA1 if it is the second serial port in the -+ system, even though the other one is ttyS0. The 8250 driver -+ doesn't use this logic, so always remains ttyS0. - index = pl011_probe_dt_alias(index, dev); -+ */ - - uap->old_cr = 0; - uap->port.dev = dev; - -From 0dba8271302e1c9a96f1ead8f5a7b9a0ffc7325e Mon Sep 17 00:00:00 2001 -From: Pantelis Antoniou -Date: Wed, 3 Dec 2014 13:23:28 +0200 -Subject: [PATCH 088/122] 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 ---- - Documentation/devicetree/configfs-overlays.txt | 31 +++ - drivers/of/Kconfig | 7 + - drivers/of/Makefile | 1 + - drivers/of/configfs.c | 311 +++++++++++++++++++++++++ - 4 files changed, 350 insertions(+) - create mode 100644 Documentation/devicetree/configfs-overlays.txt - create mode 100644 drivers/of/configfs.c - -diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..5fa43e0643072c7963daddc18cec7772910378ad ---- /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 ba7b034b2b91c94afb1b7135cdee7fc3d6955828..de0da10d66e6cdc6eedc4d36cf247370627f83f4 100644 ---- a/drivers/of/Kconfig -+++ b/drivers/of/Kconfig -@@ -112,4 +112,11 @@ config OF_OVERLAY - config OF_NUMA - bool - -+config OF_CONFIGFS -+ bool "Device Tree Overlay ConfigFS interface" -+ select CONFIGFS_FS -+ select OF_OVERLAY -+ help -+ Enable a simple user-space driven DT overlay interface. -+ - endif # OF -diff --git a/drivers/of/Makefile b/drivers/of/Makefile -index d7efd9d458aab4554139e93c72a1688aa0eeef6a..aa5ef9dd1fedc14d4ae2d363818fc160df51bad9 100644 ---- a/drivers/of/Makefile -+++ b/drivers/of/Makefile -@@ -1,4 +1,5 @@ - obj-y = base.o device.o platform.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 0000000000000000000000000000000000000000..0037e6868a6cda8706c88194c6a4454b6ea6cad7 ---- /dev/null -+++ b/drivers/of/configfs.c -@@ -0,0 +1,311 @@ -+/* -+ * 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 int create_overlay(struct cfs_overlay_item *overlay, void *blob) -+{ -+ int err; -+ -+ /* unflatten the tree */ -+ of_fdt_unflatten_tree(blob, NULL, &overlay->overlay); -+ if (overlay->overlay == NULL) { -+ pr_err("%s: failed to unflatten tree\n", __func__); -+ err = -EINVAL; -+ goto out_err; -+ } -+ pr_debug("%s: unflattened OK\n", __func__); -+ -+ /* mark it as detached */ -+ of_node_set_flag(overlay->overlay, OF_DETACHED); -+ -+ /* perform resolution */ -+ err = of_resolve_phandles(overlay->overlay); -+ if (err != 0) { -+ pr_err("%s: Failed to resolve tree\n", __func__); -+ goto out_err; -+ } -+ pr_debug("%s: resolved OK\n", __func__); -+ -+ err = of_overlay_create(overlay->overlay); -+ if (err < 0) { -+ pr_err("%s: Failed to create overlay (err=%d)\n", -+ __func__, err); -+ goto out_err; -+ } -+ overlay->ov_id = err; -+ -+out_err: -+ return err; -+} -+ -+static inline struct cfs_overlay_item *to_cfs_overlay_item( -+ struct config_item *item) -+{ -+ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; -+} -+ -+static ssize_t cfs_overlay_item_path_show(struct config_item *item, -+ char *page) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ return sprintf(page, "%s\n", overlay->path); -+} -+ -+static ssize_t cfs_overlay_item_path_store(struct config_item *item, -+ const char *page, size_t count) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ const char *p = page; -+ char *s; -+ int err; -+ -+ /* if it's set do not allow changes */ -+ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) -+ return -EPERM; -+ -+ /* copy to path buffer (and make sure it's always zero terminated */ -+ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); -+ overlay->path[sizeof(overlay->path) - 1] = '\0'; -+ -+ /* strip trailing newlines */ -+ s = overlay->path + strlen(overlay->path); -+ while (s > overlay->path && *--s == '\n') -+ *s = '\0'; -+ -+ pr_debug("%s: path is '%s'\n", __func__, overlay->path); -+ -+ err = request_firmware(&overlay->fw, overlay->path, NULL); -+ if (err != 0) -+ goto out_err; -+ -+ err = create_overlay(overlay, (void *)overlay->fw->data); -+ if (err != 0) -+ goto out_err; -+ -+ return count; -+ -+out_err: -+ -+ release_firmware(overlay->fw); -+ overlay->fw = NULL; -+ -+ overlay->path[0] = '\0'; -+ return err; -+} -+ -+static ssize_t cfs_overlay_item_status_show(struct config_item *item, -+ char *page) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ return sprintf(page, "%s\n", -+ overlay->ov_id >= 0 ? "applied" : "unapplied"); -+} -+ -+CONFIGFS_ATTR(cfs_overlay_item_, path); -+CONFIGFS_ATTR_RO(cfs_overlay_item_, status); -+ -+static struct configfs_attribute *cfs_overlay_attrs[] = { -+ &cfs_overlay_item_attr_path, -+ &cfs_overlay_item_attr_status, -+ NULL, -+}; -+ -+ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, -+ void *buf, size_t max_count) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ pr_debug("%s: buf=%p max_count=%zu\n", __func__, -+ buf, max_count); -+ -+ if (overlay->dtbo == NULL) -+ return 0; -+ -+ /* copy if buffer provided */ -+ if (buf != NULL) { -+ /* the buffer must be large enough */ -+ if (overlay->dtbo_size > max_count) -+ return -ENOSPC; -+ -+ memcpy(buf, overlay->dtbo, overlay->dtbo_size); -+ } -+ -+ return overlay->dtbo_size; -+} -+ -+ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, -+ const void *buf, size_t count) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ int err; -+ -+ /* if it's set do not allow changes */ -+ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) -+ return -EPERM; -+ -+ /* copy the contents */ -+ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); -+ if (overlay->dtbo == NULL) -+ return -ENOMEM; -+ -+ overlay->dtbo_size = count; -+ -+ err = create_overlay(overlay, overlay->dtbo); -+ if (err != 0) -+ goto out_err; -+ -+ return count; -+ -+out_err: -+ kfree(overlay->dtbo); -+ overlay->dtbo = NULL; -+ overlay->dtbo_size = 0; -+ -+ return err; -+} -+ -+CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); -+ -+static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { -+ &cfs_overlay_item_attr_dtbo, -+ NULL, -+}; -+ -+static void cfs_overlay_release(struct config_item *item) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ if (overlay->ov_id >= 0) -+ of_overlay_destroy(overlay->ov_id); -+ if (overlay->fw) -+ release_firmware(overlay->fw); -+ /* kfree with NULL is safe */ -+ kfree(overlay->dtbo); -+ kfree(overlay); -+} -+ -+static struct configfs_item_operations cfs_overlay_item_ops = { -+ .release = cfs_overlay_release, -+}; -+ -+static struct config_item_type cfs_overlay_type = { -+ .ct_item_ops = &cfs_overlay_item_ops, -+ .ct_attrs = cfs_overlay_attrs, -+ .ct_bin_attrs = cfs_overlay_bin_attrs, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct config_item *cfs_overlay_group_make_item( -+ struct config_group *group, const char *name) -+{ -+ struct cfs_overlay_item *overlay; -+ -+ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); -+ if (!overlay) -+ return ERR_PTR(-ENOMEM); -+ overlay->ov_id = -1; -+ -+ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); -+ return &overlay->item; -+} -+ -+static void cfs_overlay_group_drop_item(struct config_group *group, -+ struct config_item *item) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ config_item_put(&overlay->item); -+} -+ -+static struct configfs_group_operations overlays_ops = { -+ .make_item = cfs_overlay_group_make_item, -+ .drop_item = cfs_overlay_group_drop_item, -+}; -+ -+static struct config_item_type overlays_type = { -+ .ct_group_ops = &overlays_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct configfs_group_operations of_cfs_ops = { -+ /* empty - we don't allow anything to be created */ -+}; -+ -+static struct config_item_type of_cfs_type = { -+ .ct_group_ops = &of_cfs_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+struct config_group of_cfs_overlay_group; -+ -+static struct configfs_subsystem of_cfs_subsys = { -+ .su_group = { -+ .cg_item = { -+ .ci_namebuf = "device-tree", -+ .ci_type = &of_cfs_type, -+ }, -+ }, -+ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), -+}; -+ -+static int __init of_cfs_init(void) -+{ -+ int ret; -+ -+ pr_info("%s\n", __func__); -+ -+ config_group_init(&of_cfs_subsys.su_group); -+ config_group_init_type_name(&of_cfs_overlay_group, "overlays", -+ &overlays_type); -+ configfs_add_default_group(&of_cfs_overlay_group, -+ &of_cfs_subsys.su_group); -+ -+ ret = configfs_register_subsystem(&of_cfs_subsys); -+ if (ret != 0) { -+ pr_err("%s: failed to register subsys\n", __func__); -+ goto out; -+ } -+ pr_info("%s: OK\n", __func__); -+out: -+ return ret; -+} -+late_initcall(of_cfs_init); - -From 7599baf5d2f2a063d430fce4de57db739ac1d05c Mon Sep 17 00:00:00 2001 -From: Cheong2K -Date: Fri, 26 Feb 2016 18:20:10 +0800 -Subject: [PATCH 089/122] brcm: adds support for BCM43341 wifi - -brcmfmac: Disable power management - -Disable wireless power saving in the brcmfmac WLAN driver. This is a -temporary measure until the connectivity loss resulting from power -saving is resolved. - -Signed-off-by: Phil Elwell - -brcmfmac: Use original country code as a fallback - -Commit 73345fd212980d2e28a5c6d83801c903bd773680: - - brcmfmac: Configure country code using device specific settings - -prevents region codes from working on devices that lack a region code -translation table. In the event of an absent table, preserve the old -behaviour of using the provided code as-is. - -Signed-off-by: Phil Elwell - -brcmfmac: Plug memory leak in brcmf_fill_bss_param - -See: https://github.com/raspberrypi/linux/issues/1471 - -Signed-off-by: Phil Elwell - -brcmfmac: do not use internal roaming engine by default - -Some evidence of curing disconnects with this disabled, so make it a default. -Can be overridden with module parameter roamoff=0 -See: http://projectable.me/optimize-my-pi-wi-fi/ - -brcmfmac: Change stop_ap sequence - -Patch from Broadcom/Cypress to resolve a customer error - -Signed-off-by: Phil Elwell ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 31 ++++++++++++++++------ - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ - .../broadcom/brcm80211/include/brcm_hw_ids.h | 1 + - 4 files changed, 27 insertions(+), 9 deletions(-) - -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 78d9966a3957b2b934fe6b21de5cade494ec2839..3fcb1887b2d312e050c02e9fe66ea20f48f0abcb 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2756,6 +2756,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, - * preference in cfg struct to apply this to - * FW later while initializing the dongle - */ -+ pr_info("power management disabled\n"); -+ enabled = false; - cfg->pwr_save = enabled; - if (!check_vif_up(ifp->vif)) { - -@@ -4750,12 +4752,15 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); - if (err < 0) - brcmf_err("BRCMF_C_DOWN error %d\n", err); -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); -- if (err < 0) -- brcmf_err("setting AP mode failed %d\n", err); -+ - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 0); - if (err < 0) - brcmf_err("setting INFRA mode failed %d\n", err); -+ -+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); -+ if (err < 0) -+ brcmf_err("setting AP mode failed %d\n", err); -+ - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) - brcmf_fil_iovar_int_set(ifp, "mbss", 0); - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, -@@ -6737,12 +6742,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], - struct brcmfmac_pd_cc *country_codes; - struct brcmfmac_pd_cc_entry *cc; - s32 found_index; -+ char ccode[BRCMF_COUNTRY_BUF_SZ]; -+ int rev; - int i; - -+ memcpy(ccode, alpha2, sizeof(ccode)); -+ rev = -1; -+ - country_codes = drvr->settings->country_codes; - if (!country_codes) { -- brcmf_dbg(TRACE, "No country codes configured for device\n"); -- return -EINVAL; -+ brcmf_dbg(TRACE, "No country codes configured for device" -+ " - use requested value\n"); -+ goto use_input_value; - } - - if ((alpha2[0] == ccreq->country_abbrev[0]) && -@@ -6766,10 +6777,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], - brcmf_dbg(TRACE, "No country code match found\n"); - return -EINVAL; - } -- memset(ccreq, 0, sizeof(*ccreq)); -- ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); -- memcpy(ccreq->ccode, country_codes->table[found_index].cc, -+ rev = country_codes->table[found_index].rev; -+ memcpy(ccode, country_codes->table[found_index].cc, - BRCMF_COUNTRY_BUF_SZ); -+ -+use_input_value: -+ memset(ccreq, 0, sizeof(*ccreq)); -+ ccreq->rev = cpu_to_le32(rev); -+ memcpy(ccreq->ccode, ccode, sizeof(ccode)); - ccreq->country_abbrev[0] = alpha2[0]; - ccreq->country_abbrev[1] = alpha2[1]; - ccreq->country_abbrev[2] = 0; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -index 3e15d64c64813513bc22202dd9e468588699abb0..4051780f64f44a5ce522babe6c371a1beb79a824 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -69,7 +69,7 @@ static int brcmf_fcmode; - module_param_named(fcmode, brcmf_fcmode, int, 0); - MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control"); - --static int brcmf_roamoff; -+static int brcmf_roamoff = 1; - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR); - MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); - -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -index b892dac70f4b02f76e01a7ccb580c6d8aed4bfe4..db5f8b70b407879f1c006ca4b7ab78d12974609d 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -604,6 +604,7 @@ BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); - BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); -+BRCMF_FW_NVRAM_DEF(43341, "brcmfmac43341-sdio.bin", "brcmfmac43341-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); - BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); -@@ -621,6 +622,7 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), -diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -index d0407d9ad7827cd756b6311410ffe2d9a7cacc78..f1fb8a3c7a3211e8429585861f2f42e014878654 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -@@ -36,6 +36,7 @@ - #define BRCM_CC_4330_CHIP_ID 0x4330 - #define BRCM_CC_4334_CHIP_ID 0x4334 - #define BRCM_CC_43340_CHIP_ID 43340 -+#define BRCM_CC_43341_CHIP_ID 43341 - #define BRCM_CC_43362_CHIP_ID 43362 - #define BRCM_CC_4335_CHIP_ID 0x4335 - #define BRCM_CC_4339_CHIP_ID 0x4339 - -From 409e8d08947ff33556f6bcb8eb6bfdc47613ce6b Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 090/122] hci_h5: Don't send conf_req when ACTIVE - -Without this patch, a modem and kernel can continuously bombard each -other with conf_req and conf_rsp messages, in a demented game of tag. ---- - drivers/bluetooth/hci_h5.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c -index 0879d64b1caf58afb6e5d494c07d9ab7e7cdf983..5161ab30fd533d50f516bb93d5b9f402422e2974 100644 ---- a/drivers/bluetooth/hci_h5.c -+++ b/drivers/bluetooth/hci_h5.c -@@ -310,7 +310,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) - h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_req, 2) == 0) { - h5_link_control(hu, conf_rsp, 2); -- h5_link_control(hu, conf_req, 3); -+ if (h5->state != H5_ACTIVE) -+ h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_rsp, 2) == 0) { - if (H5_HDR_LEN(hdr) > 2) - h5->tx_win = (data[2] & 0x07); - -From 5fd6ff953ace9d64a39412f410b4a6eb09dd4711 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 091/122] config: Add default configs - ---- - arch/arm/configs/bcm2709_defconfig | 1297 +++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1308 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 2605 insertions(+) - create mode 100644 arch/arm/configs/bcm2709_defconfig - create mode 100644 arch/arm/configs/bcmrpi_defconfig - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..12e8155c175deaecea6fcf1f81ec3f6c1ddf5f7c ---- /dev/null -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1297 @@ -+CONFIG_LOCALVERSION="-v7" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_NMI_LOG_BUF_SHIFT=12 -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_NAMESPACES=y -+CONFIG_USER_NS=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM=y -+CONFIG_ARCH_BCM2835=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_SMP=y -+CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y -+CONFIG_VFP=y -+CONFIG_NEON=y -+CONFIG_KERNEL_MODE_NEON=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_DIAG=m -+CONFIG_IPV6=m -+CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_SUBTREES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_RPFILTER=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RPFILTER=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_CFG80211=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_OF_CONFIGFS=y -+CONFIG_ZRAM=m -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_VXLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_QCA7000=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_AT76C50X_USB=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_MT7601U=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_RTL8187=m -+CONFIG_RTL8192CU=m -+CONFIG_USB_ZD1201=m -+CONFIG_ZD1211RW=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_XPAD_LEDS=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_EKTF2127=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_8250_EXTENDED=y -+CONFIG_SERIAL_8250_SHARE_IRQ=y -+CONFIG_SERIAL_8250_BCM2835AUX=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_SC16IS7XX=m -+CONFIG_SERIAL_SC16IS7XX_SPI=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_MUX_PCA954x=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m -+CONFIG_I2C_GPIO=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_VIRT=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_GPIO_MCP23S08=m -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_BATTERY_DS2760=m -+CONFIG_HWMON=m -+CONFIG_SENSORS_LM75=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_SENSORS_INA2XX=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_LOAD_EDID_FIRMWARE=y -+CONFIG_DRM_UDL=m -+CONFIG_DRM_VC4=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -+CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -+CONFIG_SND_DIGIDAC1_SOUNDCARD=m -+CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -+CONFIG_SND_PISOUND=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_AK4554=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_BETOP_FF=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_GEMBIRD=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_LOGITECH_DJ=m -+CONFIG_LOGITECH_FF=y -+CONFIG_LOGIRUMBLEPAD2_FF=y -+CONFIG_LOGIG940_FF=y -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_LEDS_TRIGGER_PANIC=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_ABX80X=m -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1302=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_HX8357D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_RASPBERRYPI_POWER=y -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_MCP3422=m -+CONFIG_DHT11=m -+CONFIG_HTU21=m -+CONFIG_PWM_BCM2835=m -+CONFIG_PWM_PCA9685=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM_NEON=m -+CONFIG_CRYPTO_AES_ARM_BS=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..8acee9f31202ec14f2933d92dd70831cda8d7b51 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1308 @@ -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_NMI_LOG_BUF_SHIFT=12 -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_NAMESPACES=y -+CONFIG_USER_NS=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_MULTI_V6=y -+# CONFIG_ARCH_MULTI_V7 is not set -+CONFIG_ARCH_BCM=y -+CONFIG_ARCH_BCM2835=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_VFP=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_DIAG=m -+CONFIG_IPV6=m -+CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_SUBTREES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_RPFILTER=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RPFILTER=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_CFG80211=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_OF_CONFIGFS=y -+CONFIG_ZRAM=m -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_VXLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_QCA7000=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_AT76C50X_USB=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_MT7601U=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_RTL8187=m -+CONFIG_RTL8192CU=m -+CONFIG_USB_ZD1201=m -+CONFIG_ZD1211RW=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_XPAD_LEDS=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_8250_EXTENDED=y -+CONFIG_SERIAL_8250_SHARE_IRQ=y -+CONFIG_SERIAL_8250_BCM2835AUX=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_SC16IS7XX=m -+CONFIG_SERIAL_SC16IS7XX_SPI=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_MUX_PCA954x=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m -+CONFIG_I2C_GPIO=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_GPIO_MCP23S08=m -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_BATTERY_DS2760=m -+CONFIG_HWMON=m -+CONFIG_SENSORS_LM75=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_SENSORS_INA2XX=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_LOAD_EDID_FIRMWARE=y -+CONFIG_DRM_UDL=m -+CONFIG_DRM_VC4=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -+CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -+CONFIG_SND_DIGIDAC1_SOUNDCARD=m -+CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -+CONFIG_SND_PISOUND=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_AK4554=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_BETOP_FF=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_GEMBIRD=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_LOGITECH_DJ=m -+CONFIG_LOGITECH_FF=y -+CONFIG_LOGIRUMBLEPAD2_FF=y -+CONFIG_LOGIG940_FF=y -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_USB_GADGET=m -+CONFIG_USB_ZERO=m -+CONFIG_USB_AUDIO=m -+CONFIG_USB_ETH=m -+CONFIG_USB_GADGETFS=m -+CONFIG_USB_MASS_STORAGE=m -+CONFIG_USB_G_SERIAL=m -+CONFIG_USB_MIDI_GADGET=m -+CONFIG_USB_G_PRINTER=m -+CONFIG_USB_CDC_COMPOSITE=m -+CONFIG_USB_G_ACM_MS=m -+CONFIG_USB_G_MULTI=m -+CONFIG_USB_G_HID=m -+CONFIG_USB_G_WEBCAM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_LEDS_TRIGGER_PANIC=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_ABX80X=m -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1302=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_HX8357D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_RASPBERRYPI_POWER=y -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_MCP3422=m -+CONFIG_DHT11=m -+CONFIG_HTU21=m -+CONFIG_PWM_BCM2835=m -+CONFIG_PWM_PCA9685=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CRYPTD=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_SHA512=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM=m -+CONFIG_CRYPTO_AES_ARM=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y - -From 7452484b501a3dd0ca66226de11cf4fb9a576390 Mon Sep 17 00:00:00 2001 -From: Michael Zoran -Date: Wed, 24 Aug 2016 03:35:56 -0700 -Subject: [PATCH 092/122] Add arm64 configuration and device tree differences. - Disable MMC_BCM2835_SDHOST and MMC_BCM2835 since these drivers are crashing - at the moment. - -ARM64: Modify default config to get raspbian to boot (#1686) - -1. Enable emulation of deprecated instructions. -2. Enable ARM 8.1 and 8.2 features which are not detected at runtime. -3. Switch the default governer to powersave. -4. Include the watchdog timer driver in the kernel image rather then a module. - -Tested with raspbian-jessie 2016-09-23. ---- - arch/arm64/Kconfig.platforms | 22 + - arch/arm64/boot/dts/broadcom/Makefile | 1 + - arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts | 3 + - arch/arm64/configs/bcmrpi3_defconfig | 1334 ++++++++++++++++++++++ - 4 files changed, 1360 insertions(+) - create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts - create mode 100644 arch/arm64/configs/bcmrpi3_defconfig - -diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms -index 101794f5ce1008b7ff007fbfc7fa23d9e63bae67..7d213c2c904271c7a4622b83cd55a750d237bc2e 100644 ---- a/arch/arm64/Kconfig.platforms -+++ b/arch/arm64/Kconfig.platforms -@@ -1,5 +1,27 @@ - menu "Platform selection" - -+config MACH_BCM2709 -+ bool -+ -+config ARCH_BCM2709 -+ bool "Broadcom BCM2709 family" -+ select MACH_BCM2709 -+ select HAVE_SMP -+ select ARM_AMBA -+ select COMMON_CLK -+ select ARCH_HAS_CPUFREQ -+ select GENERIC_CLOCKEVENTS -+ select MULTI_IRQ_HANDLER -+ select SPARSE_IRQ -+ select MFD_SYSCON -+ select VC4 -+ select USE_OF -+ select ARCH_REQUIRE_GPIOLIB -+ select PINCTRL -+ select PINCTRL_BCM2835 -+ help -+ This enables support for Broadcom BCM2709 boards. -+ - config ARCH_SUNXI - bool "Allwinner sunxi 64-bit SoC Family" - select GENERIC_IRQ_CHIP -diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index 05faf2a8a35ca5ba9049b9038dedb9be88eeb7c5..2152448c8cf5b22c573642d7ce45e85793f5fc9a 100644 ---- a/arch/arm64/boot/dts/broadcom/Makefile -+++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -1,6 +1,7 @@ - dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb - dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb - dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb -+dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb - - always := $(dtb-y) - subdir-y := $(dts-dirs) -diff --git a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..deb33441da95220db0ed672e41639626fba682a5 ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts -@@ -0,0 +1,3 @@ -+#define RPI364 -+ -+#include "../../../../arm/boot/dts/bcm2710-rpi-3-b.dts" -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..d7406f5a4620151044b8f716b4d10bb818648e06 ---- /dev/null -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -0,0 +1,1334 @@ -+# CONFIG_ARM_PATCH_PHYS_VIRT is not set -+CONFIG_PHYS_OFFSET=0 -+CONFIG_LOCALVERSION="-v8" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_64BIT=y -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+ -+# -+# ARM errata workarounds via the alternatives framework -+# -+CONFIG_ARM64_ERRATUM_826319=n -+CONFIG_ARM64_ERRATUM_827319=n -+CONFIG_ARM64_ERRATUM_824069=n -+CONFIG_ARM64_ERRATUM_819472=n -+CONFIG_ARM64_ERRATUM_832075=n -+CONFIG_ARM64_ERRATUM_845719=n -+CONFIG_ARM64_ERRATUM_843419=n -+CONFIG_CAVIUM_ERRATUM_22375=n -+CONFIG_CAVIUM_ERRATUM_23154=n -+CONFIG_CAVIUM_ERRATUM_27456=n -+CONFIG_ARM64_4K_PAGES=y -+CONFIG_ARM64_VA_BITS_39=y -+CONFIG_ARM64_VA_BITS=39 -+CONFIG_SCHED_MC=y -+CONFIG_NR_CPUS=4 -+CONFIG_HOTPLUG_CPU=y -+CONFIG_ARMV8_DEPRECATED=y -+CONFIG_SWP_EMULATION=y -+CONFIG_CP15_BARRIER_EMULATION=y -+CONFIG_SETEND_EMULATION=y -+ -+# -+# ARMv8.1 architectural features -+# -+CONFIG_ARM64_HW_AFDBM=y -+CONFIG_ARM64_PAN=y -+CONFIG_ARM64_LSE_ATOMICS=y -+CONFIG_ARM64_VHE=y -+ -+# -+# ARMv8.2 architectural features -+# -+CONFIG_ARM64_UAO=y -+CONFIG_ARM64_MODULE_CMODEL_LARGE=n -+CONFIG_RANDOMIZE_BASE=n -+ -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_NMI_LOG_BUF_SHIFT=12 -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_NAMESPACES=y -+CONFIG_USER_NS=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_TRIM_UNUSED_KSYMS=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM2709=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_SMP=y -+CONFIG_HAVE_ARM_ARCH_TIMER=y -+CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y -+CONFIG_VFP=y -+CONFIG_NEON=y -+CONFIG_KERNEL_MODE_NEON=y -+CONFIG_BINFMT_MISC=m -+CONFIG_COMPAT=y -+CONFIG_SYSVIPC_COMPAT=y -+ -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_DIAG=m -+CONFIG_IPV6=m -+CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_SUBTREES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_RPFILTER=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RPFILTER=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_OF_CONFIGFS=y -+CONFIG_ZRAM=m -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_IPVLAN=m -+CONFIG_VXLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_QCA7000=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_AT76C50X_USB=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_MT7601U=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_RTL8187=m -+CONFIG_RTL8192CU=n -+CONFIG_USB_ZD1201=m -+CONFIG_ZD1211RW=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_XPAD_LEDS=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=n -+CONFIG_BCM_VC_CMA=n -+CONFIG_BCM_VCIO=n -+CONFIG_BCM_VC_SM=n -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_SC16IS7XX=m -+CONFIG_SERIAL_SC16IS7XX_SPI=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_MUX_PCA954x=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_GPIO=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_VIRT=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_GPIO_MCP23S08=m -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_HWMON=m -+CONFIG_SENSORS_LM75=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=n -+CONFIG_VIDEO_BCM2835_MMAL=n -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_LOAD_EDID_FIRMWARE=y -+CONFIG_DRM_UDL=m -+CONFIG_DRM_VC4=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_ARM=n -+CONFIG_SND_BCM2835=n -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -+CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -+CONFIG_SND_DIGIDAC1_SOUNDCARD=m -+CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_BETOP_FF=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_GEMBIRD=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_LOGITECH_DJ=m -+CONFIG_LOGITECH_FF=y -+CONFIG_LOGIRUMBLEPAD2_FF=y -+CONFIG_LOGIG940_FF=y -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=n -+CONFIG_USB_DWC2=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_LEDS_TRIGGER_PANIC=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1302=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_RASPBERRYPI_POWER=y -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_MCP3422=m -+CONFIG_DHT11=m -+CONFIG_PWM_BCM2835=m -+CONFIG_PWM_PCA9685=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+CONFIG_ARM64_CRYPTO=y -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y -+CONFIG_BCM2708_VCHIQ=n - -From d5f278b5d66aaae13361aa90bf4a06a9babf5746 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 7 Mar 2016 15:05:11 +0000 -Subject: [PATCH 093/122] vchiq_arm: Tweak the logging output - -Signed-off-by: Phil Elwell ---- - .../vc04_services/interface/vchiq_arm/vchiq_core.c | 31 +++++++++------------- - 1 file changed, 13 insertions(+), 18 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -index 2c98da4307dff994a00dc246574ef0aaee05d5da..160db24aeea33a8296923501009c1f02bc41e599 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -@@ -891,16 +891,14 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - error_count); - return VCHIQ_ERROR; - } -- if (i == 0) { -- if (SRVTRACE_ENABLED(service, -- VCHIQ_LOG_INFO)) -- vchiq_log_dump_mem("Sent", 0, -- header->data + pos, -- min(64u, -- elements[0].size)); -- } - } - -+ if (SRVTRACE_ENABLED(service, -+ VCHIQ_LOG_INFO)) -+ vchiq_log_dump_mem("Sent", 0, -+ header->data, -+ min(16, pos)); -+ - spin_lock("a_spinlock); - service_quota->message_use_count++; - -@@ -1039,16 +1037,13 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - error_count); - return VCHIQ_ERROR; - } -- if (i == 0) { -- if (vchiq_sync_log_level >= -- VCHIQ_LOG_TRACE) -- vchiq_log_dump_mem("Sent Sync", -- 0, header->data + pos, -- min(64u, -- elements[0].size)); -- } - } - -+ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) -+ vchiq_log_dump_mem("Sent Sync", -+ 0, header->data, -+ min(16, pos)); -+ - VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); - VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); - } else { -@@ -1720,7 +1715,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) - remoteport, localport, size); - if (size > 0) - vchiq_log_dump_mem("Rcvd", 0, header->data, -- min(64, size)); -+ min(16, size)); - } - - if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) -@@ -2187,7 +2182,7 @@ sync_func(void *v) - remoteport, localport, size); - if (size > 0) - vchiq_log_dump_mem("Rcvd", 0, header->data, -- min(64, size)); -+ min(16, size)); - } - - switch (type) { - -From b65b8cb1ff93d43d24558076bb81f19b1ab5ea50 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 23 Mar 2016 14:16:25 +0000 -Subject: [PATCH 094/122] vchiq_arm: Access the dequeue_pending flag locked - -Reading through this code looking for another problem (now found in userland) -the use of dequeue_pending outside a lock didn't seem safe. - -Signed-off-by: Phil Elwell ---- - .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 17 ++++++++++++----- - 1 file changed, 12 insertions(+), 5 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index 7b6cd4d80621e38ff6d47fcd87b45fbe9cd4259b..d8669fa7f39b077877eca1829ba9538bf2e21a82 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -279,6 +279,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, - USER_SERVICE_T *user_service; - VCHIQ_SERVICE_T *service; - VCHIQ_INSTANCE_T instance; -+ int skip_completion = 0; - DEBUG_INITIALISE(g_state.local) - - DEBUG_TRACE(SERVICE_CALLBACK_LINE); -@@ -345,9 +346,6 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, - user_service->msg_queue[user_service->msg_insert & - (MSG_QUEUE_SIZE - 1)] = header; - user_service->msg_insert++; -- spin_unlock(&msg_queue_spinlock); -- -- up(&user_service->insert_event); - - /* If there is a thread waiting in DEQUEUE_MESSAGE, or if - ** there is a MESSAGE_AVAILABLE in the completion queue then -@@ -356,13 +354,22 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, - if (((user_service->message_available_pos - - instance->completion_remove) >= 0) || - user_service->dequeue_pending) { -- DEBUG_TRACE(SERVICE_CALLBACK_LINE); - user_service->dequeue_pending = 0; -- return VCHIQ_SUCCESS; -+ skip_completion = 1; - } - -+ spin_unlock(&msg_queue_spinlock); -+ -+ up(&user_service->insert_event); -+ - header = NULL; - } -+ -+ if (skip_completion) { -+ DEBUG_TRACE(SERVICE_CALLBACK_LINE); -+ return VCHIQ_SUCCESS; -+ } -+ - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - - return add_completion(instance, reason, header, user_service, - -From 1236ef13699c7ce7cb486c13c244be0038419918 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 23 Mar 2016 20:53:47 +0000 -Subject: [PATCH 095/122] vchiq_arm: Service callbacks must not fail - -Service callbacks are not allowed to return an error. The internal callback -that delivers events and messages to user tasks does not enqueue them if -the service is closing, but this is not an error and should not be -reported as such. - -Signed-off-by: Phil Elwell ---- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index d8669fa7f39b077877eca1829ba9538bf2e21a82..54552c6ce54f413c9781ba279b936f98be4f47b0 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -224,7 +224,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - } else if (instance->closing) { - vchiq_log_info(vchiq_arm_log_level, - "service_callback closing"); -- return VCHIQ_ERROR; -+ return VCHIQ_SUCCESS; - } - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - } - -From 42c9df04946a82e2e84ce093e9fe8e0e00183e05 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 21 Apr 2016 13:49:32 +0100 -Subject: [PATCH 096/122] vchiq_arm: Add completion records under the mutex - -An issue was observed when flushing openmax components -which generate a large number of messages returning -buffers to host. - -We occasionally found a duplicate message from 16 -messages prior, resulting in a buffer returned twice. - -While only one thread adds completions, without the -mutex you don't get the protection of the automatic -memory barrier you get with synchronisation objects. - -Signed-off-by: Phil Elwell ---- - .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index 54552c6ce54f413c9781ba279b936f98be4f47b0..bde8955b7d8505d73579b77b5b3921549cb9d2fb 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -210,6 +210,8 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - VCHIQ_COMPLETION_DATA_T *completion; - DEBUG_INITIALISE(g_state.local) - -+ mutex_lock(&instance->completion_mutex); -+ - while (instance->completion_insert == - (instance->completion_remove + MAX_COMPLETIONS)) { - /* Out of space - wait for the client */ -@@ -217,11 +219,17 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - vchiq_log_trace(vchiq_arm_log_level, - "add_completion - completion queue full"); - DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); -+ -+ mutex_unlock(&instance->completion_mutex); - if (down_interruptible(&instance->remove_event) != 0) { - vchiq_log_info(vchiq_arm_log_level, - "service_callback interrupted"); - return VCHIQ_RETRY; -- } else if (instance->closing) { -+ } -+ -+ mutex_lock(&instance->completion_mutex); -+ if (instance->closing) { -+ mutex_unlock(&instance->completion_mutex); - vchiq_log_info(vchiq_arm_log_level, - "service_callback closing"); - return VCHIQ_SUCCESS; -@@ -254,8 +262,11 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - if (reason == VCHIQ_MESSAGE_AVAILABLE) - user_service->message_available_pos = - instance->completion_insert; -+ - instance->completion_insert++; - -+ mutex_unlock(&instance->completion_mutex); -+ - up(&instance->insert_event); - - return VCHIQ_SUCCESS; - -From e027b929fb8e3c2ca6ee3b9c26104cd88a6ad4b6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 20 Jun 2016 13:51:44 +0100 -Subject: [PATCH 097/122] vchiq_arm: Avoid use of mutex in add_completion - -Claiming the completion_mutex within add_completion did prevent some -messages appearing twice, but provokes a deadlock caused by vcsm using -vchiq within a page fault handler. - -Revert the use of completion_mutex, and instead fix the original -problem using more memory barriers. - -Signed-off-by: Phil Elwell ---- - .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 55 +++++++++++----------- - .../vc04_services/interface/vchiq_arm/vchiq_core.c | 14 ++++-- - 2 files changed, 37 insertions(+), 32 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index bde8955b7d8505d73579b77b5b3921549cb9d2fb..e5cdda12c7e5c35c69eb96991cfdb8326def167f 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -64,10 +64,10 @@ - #define VCHIQ_MINOR 0 - - /* Some per-instance constants */ --#define MAX_COMPLETIONS 16 -+#define MAX_COMPLETIONS 128 - #define MAX_SERVICES 64 - #define MAX_ELEMENTS 8 --#define MSG_QUEUE_SIZE 64 -+#define MSG_QUEUE_SIZE 128 - - #define KEEPALIVE_VER 1 - #define KEEPALIVE_VER_MIN KEEPALIVE_VER -@@ -208,28 +208,24 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - void *bulk_userdata) - { - VCHIQ_COMPLETION_DATA_T *completion; -+ int insert; - DEBUG_INITIALISE(g_state.local) - -- mutex_lock(&instance->completion_mutex); -- -- while (instance->completion_insert == -- (instance->completion_remove + MAX_COMPLETIONS)) { -+ insert = instance->completion_insert; -+ while ((insert - instance->completion_remove) >= MAX_COMPLETIONS) { - /* Out of space - wait for the client */ - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - vchiq_log_trace(vchiq_arm_log_level, - "add_completion - completion queue full"); - DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); - -- mutex_unlock(&instance->completion_mutex); - if (down_interruptible(&instance->remove_event) != 0) { - vchiq_log_info(vchiq_arm_log_level, - "service_callback interrupted"); - return VCHIQ_RETRY; - } - -- mutex_lock(&instance->completion_mutex); - if (instance->closing) { -- mutex_unlock(&instance->completion_mutex); - vchiq_log_info(vchiq_arm_log_level, - "service_callback closing"); - return VCHIQ_SUCCESS; -@@ -237,9 +233,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - } - -- completion = -- &instance->completions[instance->completion_insert & -- (MAX_COMPLETIONS - 1)]; -+ completion = &instance->completions[insert & (MAX_COMPLETIONS - 1)]; - - completion->header = header; - completion->reason = reason; -@@ -260,12 +254,9 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - wmb(); - - if (reason == VCHIQ_MESSAGE_AVAILABLE) -- user_service->message_available_pos = -- instance->completion_insert; -+ user_service->message_available_pos = insert; - -- instance->completion_insert++; -- -- mutex_unlock(&instance->completion_mutex); -+ instance->completion_insert = ++insert; - - up(&instance->insert_event); - -@@ -795,6 +786,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - instance->completion_insert) - && !instance->closing) { - int rc; -+ - DEBUG_TRACE(AWAIT_COMPLETION_LINE); - mutex_unlock(&instance->completion_mutex); - rc = down_interruptible(&instance->insert_event); -@@ -809,24 +801,29 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - } - DEBUG_TRACE(AWAIT_COMPLETION_LINE); - -- /* A read memory barrier is needed to stop prefetch of a stale -- ** completion record -- */ -- rmb(); -- - if (ret == 0) { - int msgbufcount = args.msgbufcount; -+ int remove; -+ -+ remove = instance->completion_remove; -+ - for (ret = 0; ret < args.count; ret++) { - VCHIQ_COMPLETION_DATA_T *completion; - VCHIQ_SERVICE_T *service; - USER_SERVICE_T *user_service; - VCHIQ_HEADER_T *header; -- if (instance->completion_remove == -- instance->completion_insert) -+ -+ if (remove == instance->completion_insert) - break; -+ - completion = &instance->completions[ -- instance->completion_remove & -- (MAX_COMPLETIONS - 1)]; -+ remove & (MAX_COMPLETIONS - 1)]; -+ -+ -+ /* A read memory barrier is needed to prevent -+ ** the prefetch of a stale completion record -+ */ -+ rmb(); - - service = completion->service_userdata; - user_service = service->base.userdata; -@@ -903,7 +900,11 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - break; - } - -- instance->completion_remove++; -+ /* Ensure that the above copy has completed -+ ** before advancing the remove pointer. */ -+ mb(); -+ -+ instance->completion_remove = ++remove; - } - - if (msgbufcount != args.msgbufcount) { -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -index 160db24aeea33a8296923501009c1f02bc41e599..71a3bedc55314f3b22dbff40c05dedf03b5e7169 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -@@ -610,15 +610,15 @@ process_free_queue(VCHIQ_STATE_T *state) - BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; - int slot_queue_available; - -- /* Use a read memory barrier to ensure that any state that may have -- ** been modified by another thread is not masked by stale prefetched -- ** values. */ -- rmb(); -- - /* Find slots which have been freed by the other side, and return them - ** to the available queue. */ - slot_queue_available = state->slot_queue_available; - -+ /* Use a memory barrier to ensure that any state that may have been -+ ** modified by another thread is not masked by stale prefetched -+ ** values. */ -+ mb(); -+ - while (slot_queue_available != local->slot_queue_recycle) { - unsigned int pos; - int slot_index = local->slot_queue[slot_queue_available++ & -@@ -626,6 +626,8 @@ process_free_queue(VCHIQ_STATE_T *state) - char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index); - int data_found = 0; - -+ rmb(); -+ - vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x", - state->id, slot_index, (unsigned int)data, - local->slot_queue_recycle, slot_queue_available); -@@ -741,6 +743,8 @@ process_free_queue(VCHIQ_STATE_T *state) - up(&state->data_quota_event); - } - -+ mb(); -+ - state->slot_queue_available = slot_queue_available; - up(&state->slot_available_event); - } - -From 36afbf3ec01bb2c073b99d9f8e09e72d3aba6b08 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 3 Oct 2016 10:14:10 -0700 -Subject: [PATCH 098/122] staging/vchi: Convert to current get_user_pages() - arguments. - -Signed-off-by: Eric Anholt ---- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- - 2 files changed, 2 insertions(+), 3 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 1091b9f1dd070e3d27c269402b43b0a09d96bcdc..8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -420,7 +420,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, - *need_release = 0; /* do not try and release vmalloc pages */ - } else { - down_read(&task->mm->mmap_sem); -- actual_pages = get_user_pages(task, task->mm, -+ actual_pages = get_user_pages( - (unsigned long)buf & ~(PAGE_SIZE - 1), - num_pages, - (type == PAGELIST_READ) ? FOLL_WRITE : 0, -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index e5cdda12c7e5c35c69eb96991cfdb8326def167f..085d37588c59198b4e5f00b9249bb8421695854f 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1492,8 +1492,7 @@ dump_phys_mem(void *virt_addr, uint32_t num_bytes) - } - - down_read(¤t->mm->mmap_sem); -- rc = get_user_pages(current, /* task */ -- current->mm, /* mm */ -+ rc = get_user_pages( - (unsigned long)virt_addr, /* start */ - num_pages, /* len */ - 0, /* gup_flags */ - -From 78c3ef34645364c0313d5322eed35c608e75ed32 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 3 Oct 2016 10:16:03 -0700 -Subject: [PATCH 099/122] staging/vchi: Update for rename of - page_cache_release() to put_page(). - -Signed-off-by: Eric Anholt ---- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 4 ++-- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0..862fabf5682c7dededc8d7ca6773d5b227b72f3c 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -438,7 +438,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, - while (actual_pages > 0) - { - actual_pages--; -- page_cache_release(pages[actual_pages]); -+ put_page(pages[actual_pages]); - } - kfree(pagelist); - if (actual_pages == 0) -@@ -577,7 +577,7 @@ free_pagelist(PAGELIST_T *pagelist, int actual) - offset = 0; - set_page_dirty(pg); - } -- page_cache_release(pg); -+ put_page(pg); - } - } - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index 085d37588c59198b4e5f00b9249bb8421695854f..5a2b8fb459ebe086ec229f37b6381bdbe6f808ca 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1530,7 +1530,7 @@ dump_phys_mem(void *virt_addr, uint32_t num_bytes) - kunmap(page); - - for (page_idx = 0; page_idx < num_pages; page_idx++) -- page_cache_release(pages[page_idx]); -+ put_page(pages[page_idx]); - - kfree(pages); - } - -From 7bc3755fca9fc00495e6ad3857bbf75756a0ad74 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 3 Oct 2016 10:21:17 -0700 -Subject: [PATCH 100/122] drivers/vchi: Remove dependency on CONFIG_BROKEN. - -The driver builds now. - -Signed-off-by: Eric Anholt ---- - drivers/staging/vc04_services/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig -index 9676fb29075a457109e4d4235f086987aec74868..db8e1beb89f9f8c48ea5964016c8285ea82497d8 100644 ---- a/drivers/staging/vc04_services/Kconfig -+++ b/drivers/staging/vc04_services/Kconfig -@@ -1,6 +1,6 @@ - config BCM2708_VCHIQ - tristate "Videocore VCHIQ" -- depends on RASPBERRYPI_FIRMWARE && BROKEN -+ depends on RASPBERRYPI_FIRMWARE - default y - help - Kernel to VideoCore communication interface for the - -From 47fc16ef621f8b834e809715c77f601e104caa3e Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 14 Sep 2016 09:16:19 +0100 -Subject: [PATCH 101/122] raspberrypi-firmware: Export the general transaction - function. - -The vc4-firmware-kms module is going to be doing the MBOX FB call. - -Signed-off-by: Eric Anholt ---- - drivers/firmware/raspberrypi.c | 3 ++- - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c -index 3f070bd38a91511c986e3fb114b15bd4ac32634c..f261b64d1657c02290904d841e1f087c34e27ded 100644 ---- a/drivers/firmware/raspberrypi.c -+++ b/drivers/firmware/raspberrypi.c -@@ -42,7 +42,7 @@ static void response_callback(struct mbox_client *cl, void *msg) - * Sends a request to the firmware through the BCM2835 mailbox driver, - * and synchronously waits for the reply. - */ --static int -+int - rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) - { - u32 message = MBOX_MSG(chan, data); -@@ -63,6 +63,7 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) - - return ret; - } -+EXPORT_SYMBOL_GPL(rpi_firmware_transaction); - - /** - * rpi_firmware_property_list - Submit firmware property list -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index e92278968b2b979db2a1f855f70e7aafb224fa98..09e3d871d110eb0762ebdb5ea329353738d58661 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -131,5 +131,6 @@ int rpi_firmware_property(struct rpi_firmware *fw, - int rpi_firmware_property_list(struct rpi_firmware *fw, - void *data, size_t tag_size); - struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); -+int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); - - #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ - -From 9ae6d3437ea35dacb0bc1353d7c6646dd2b7913d Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 14 Sep 2016 09:18:09 +0100 -Subject: [PATCH 102/122] raspberrypi-firmware: Define the MBOX channel in the - header. - -Signed-off-by: Eric Anholt ---- - include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 09e3d871d110eb0762ebdb5ea329353738d58661..2859db09e25bb945251e85edb39bc43430857168 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -12,6 +12,8 @@ - #include - #include - -+#define RPI_FIRMWARE_CHAN_FB 1 -+ - struct rpi_firmware; - - enum rpi_firmware_property_status { - -From 23c8fb1fa456520a1abe7a50484eee18e94f09bc Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 14 Sep 2016 08:39:33 +0100 -Subject: [PATCH 103/122] drm/vc4: Add a mode for using the closed firmware for - display. - -Signed-off-by: Eric Anholt ---- - drivers/gpu/drm/vc4/Makefile | 1 + - drivers/gpu/drm/vc4/vc4_crtc.c | 13 + - drivers/gpu/drm/vc4/vc4_drv.c | 1 + - drivers/gpu/drm/vc4/vc4_drv.h | 7 + - drivers/gpu/drm/vc4/vc4_firmware_kms.c | 660 +++++++++++++++++++++++++++++++++ - 5 files changed, 682 insertions(+) - create mode 100644 drivers/gpu/drm/vc4/vc4_firmware_kms.c - -diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile -index fb77db755e0a29d8589860da82186c7a1f394c72..c6dd06cca9830018c39b3b16afe4045e44d1ddf4 100644 ---- a/drivers/gpu/drm/vc4/Makefile -+++ b/drivers/gpu/drm/vc4/Makefile -@@ -8,6 +8,7 @@ vc4-y := \ - vc4_crtc.o \ - vc4_drv.o \ - vc4_dpi.o \ -+ vc4_firmware_kms.o \ - vc4_kms.o \ - vc4_gem.o \ - vc4_hdmi.o \ -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index 7f08d681a74b4e37529f6c09ae1d2c1a944dcabd..7366e76c38346f7c700534b28d1eff4eca2ec2fa 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -163,6 +163,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, - int vblank_lines; - int ret = 0; - -+ if (vc4->firmware_kms) -+ return 0; -+ - /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ - - /* Get optional system timestamp before query. */ -@@ -656,6 +659,11 @@ int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id) - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id]; - -+ if (vc4->firmware_kms) { -+ /* XXX: Can we mask the SMI interrupt? */ -+ return 0; -+ } -+ - CRTC_WRITE(PV_INTEN, PV_INT_VFP_START); - - return 0; -@@ -666,6 +674,11 @@ void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id) - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id]; - -+ if (vc4->firmware_kms) { -+ /* XXX: Can we mask the SMI interrupt? */ -+ return; -+ } -+ - CRTC_WRITE(PV_INTEN, 0); - } - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index 8703f56b794774ac4130a7b487472e293ebe7cdf..6c4a4fbc86d0a30a6977b2081bca4372e693b817 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -292,6 +292,7 @@ static struct platform_driver *const component_drivers[] = { - &vc4_dpi_driver, - &vc4_hvs_driver, - &vc4_crtc_driver, -+ &vc4_firmware_kms_driver, - &vc4_v3d_driver, - }; - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 7c1e4d97486fb57d9ce7002c30a23138519761ae..e1f6ab747f36dd412e00a1e7ea772f13c2fc32d5 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -12,6 +12,9 @@ - struct vc4_dev { - struct drm_device *dev; - -+ bool firmware_kms; -+ struct rpi_firmware *firmware; -+ - struct vc4_hdmi *hdmi; - struct vc4_hvs *hvs; - struct vc4_crtc *crtc[3]; -@@ -460,6 +463,10 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); - extern struct platform_driver vc4_dpi_driver; - int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused); - -+/* vc4_firmware_kms.c */ -+extern struct platform_driver vc4_firmware_kms_driver; -+void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file); -+ - /* vc4_gem.c */ - void vc4_gem_init(struct drm_device *dev); - void vc4_gem_destroy(struct drm_device *dev); -diff --git a/drivers/gpu/drm/vc4/vc4_firmware_kms.c b/drivers/gpu/drm/vc4/vc4_firmware_kms.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d18a1dae51a2275846c9826b5bf1ba57ae97b55c ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c -@@ -0,0 +1,660 @@ -+/* -+ * Copyright (C) 2016 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+/** -+ * DOC: VC4 firmware KMS module. -+ * -+ * As a hack to get us from the current closed source driver world -+ * toward a totally open stack, implement KMS on top of the Raspberry -+ * Pi's firmware display stack. -+ */ -+ -+#include "drm_atomic.h" -+#include "drm_atomic_helper.h" -+#include "drm_plane_helper.h" -+#include "drm_crtc_helper.h" -+#include "linux/clk.h" -+#include "linux/debugfs.h" -+#include "drm_fb_cma_helper.h" -+#include "linux/component.h" -+#include "linux/of_device.h" -+#include "vc4_drv.h" -+#include "vc4_regs.h" -+#include -+ -+/* The firmware delivers a vblank interrupt to us through the SMI -+ * hardware, which has only this one register. -+ */ -+#define SMICS 0x0 -+#define SMICS_INTERRUPTS (BIT(9) | BIT(10) | BIT(11)) -+ -+struct vc4_crtc { -+ struct drm_crtc base; -+ struct drm_encoder *encoder; -+ struct drm_connector *connector; -+ void __iomem *regs; -+ -+ struct drm_pending_vblank_event *event; -+}; -+ -+static inline struct vc4_crtc *to_vc4_crtc(struct drm_crtc *crtc) -+{ -+ return container_of(crtc, struct vc4_crtc, base); -+} -+ -+struct vc4_fkms_encoder { -+ struct drm_encoder base; -+}; -+ -+static inline struct vc4_fkms_encoder * -+to_vc4_fkms_encoder(struct drm_encoder *encoder) -+{ -+ return container_of(encoder, struct vc4_fkms_encoder, base); -+} -+ -+/* VC4 FKMS connector KMS struct */ -+struct vc4_fkms_connector { -+ struct drm_connector base; -+ -+ /* Since the connector is attached to just the one encoder, -+ * this is the reference to it so we can do the best_encoder() -+ * hook. -+ */ -+ struct drm_encoder *encoder; -+}; -+ -+static inline struct vc4_fkms_connector * -+to_vc4_fkms_connector(struct drm_connector *connector) -+{ -+ return container_of(connector, struct vc4_fkms_connector, base); -+} -+ -+/* Firmware's structure for making an FB mbox call. */ -+struct fbinfo_s { -+ u32 xres, yres, xres_virtual, yres_virtual; -+ u32 pitch, bpp; -+ u32 xoffset, yoffset; -+ u32 base; -+ u32 screen_size; -+ u16 cmap[256]; -+}; -+ -+struct vc4_fkms_plane { -+ struct drm_plane base; -+ struct fbinfo_s *fbinfo; -+ dma_addr_t fbinfo_bus_addr; -+ u32 pitch; -+}; -+ -+static inline struct vc4_fkms_plane *to_vc4_fkms_plane(struct drm_plane *plane) -+{ -+ return (struct vc4_fkms_plane *)plane; -+} -+ -+/* Turns the display on/off. */ -+static int vc4_plane_set_primary_blank(struct drm_plane *plane, bool blank) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ -+ u32 packet = blank; -+ return rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_FRAMEBUFFER_BLANK, -+ &packet, sizeof(packet)); -+} -+ -+static void vc4_primary_plane_atomic_update(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ struct vc4_fkms_plane *vc4_plane = to_vc4_fkms_plane(plane); -+ struct drm_plane_state *state = plane->state; -+ struct drm_framebuffer *fb = state->fb; -+ struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -+ volatile struct fbinfo_s *fbinfo = vc4_plane->fbinfo; -+ u32 bpp = 32; -+ int ret; -+ -+ vc4_plane_set_primary_blank(plane, false); -+ -+ fbinfo->xres = state->crtc_w; -+ fbinfo->yres = state->crtc_h; -+ fbinfo->xres_virtual = state->crtc_w; -+ fbinfo->yres_virtual = state->crtc_h; -+ fbinfo->bpp = bpp; -+ fbinfo->xoffset = state->crtc_x; -+ fbinfo->yoffset = state->crtc_y; -+ fbinfo->base = bo->paddr + fb->offsets[0]; -+ fbinfo->pitch = fb->pitches[0]; -+ /* A bug in the firmware makes it so that if the fb->base is -+ * set to nonzero, the configured pitch gets overwritten with -+ * the previous pitch. So, to get the configured pitch -+ * recomputed, we have to make it allocate itself a new buffer -+ * in VC memory, first. -+ */ -+ if (vc4_plane->pitch != fb->pitches[0]) { -+ u32 saved_base = fbinfo->base; -+ fbinfo->base = 0; -+ -+ ret = rpi_firmware_transaction(vc4->firmware, -+ RPI_FIRMWARE_CHAN_FB, -+ vc4_plane->fbinfo_bus_addr); -+ fbinfo->base = saved_base; -+ -+ vc4_plane->pitch = fbinfo->pitch; -+ WARN_ON_ONCE(vc4_plane->pitch != fb->pitches[0]); -+ } -+ -+ ret = rpi_firmware_transaction(vc4->firmware, -+ RPI_FIRMWARE_CHAN_FB, -+ vc4_plane->fbinfo_bus_addr); -+ WARN_ON_ONCE(fbinfo->pitch != fb->pitches[0]); -+ WARN_ON_ONCE(fbinfo->base != bo->paddr + fb->offsets[0]); -+} -+ -+static void vc4_primary_plane_atomic_disable(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ vc4_plane_set_primary_blank(plane, true); -+} -+ -+static void vc4_cursor_plane_atomic_update(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ struct drm_plane_state *state = plane->state; -+ struct drm_framebuffer *fb = state->fb; -+ struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -+ int ret; -+ u32 packet_state[] = { true, state->crtc_x, state->crtc_y, 0 }; -+ u32 packet_info[] = { state->crtc_w, state->crtc_h, -+ 0, /* unused */ -+ bo->paddr + fb->offsets[0], -+ 0, 0, /* hotx, hoty */}; -+ WARN_ON_ONCE(fb->pitches[0] != state->crtc_w * 4); -+ WARN_ON_ONCE(fb->bits_per_pixel != 32); -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_CURSOR_STATE, -+ &packet_state, -+ sizeof(packet_state)); -+ if (ret || packet_state[0] != 0) -+ DRM_ERROR("Failed to set cursor state: 0x%08x\n", packet_state[0]); -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_CURSOR_INFO, -+ &packet_info, -+ sizeof(packet_info)); -+ if (ret || packet_info[0] != 0) -+ DRM_ERROR("Failed to set cursor info: 0x%08x\n", packet_info[0]); -+} -+ -+static void vc4_cursor_plane_atomic_disable(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ u32 packet_state[] = { false, 0, 0, 0 }; -+ int ret; -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_CURSOR_STATE, -+ &packet_state, -+ sizeof(packet_state)); -+ if (ret || packet_state[0] != 0) -+ DRM_ERROR("Failed to set cursor state: 0x%08x\n", packet_state[0]); -+} -+ -+static int vc4_plane_atomic_check(struct drm_plane *plane, -+ struct drm_plane_state *state) -+{ -+ return 0; -+} -+ -+static void vc4_plane_destroy(struct drm_plane *plane) -+{ -+ drm_plane_helper_disable(plane); -+ drm_plane_cleanup(plane); -+} -+ -+static const struct drm_plane_funcs vc4_plane_funcs = { -+ .update_plane = drm_atomic_helper_update_plane, -+ .disable_plane = drm_atomic_helper_disable_plane, -+ .destroy = vc4_plane_destroy, -+ .set_property = NULL, -+ .reset = drm_atomic_helper_plane_reset, -+ .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, -+ .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, -+}; -+ -+static const struct drm_plane_helper_funcs vc4_primary_plane_helper_funcs = { -+ .prepare_fb = NULL, -+ .cleanup_fb = NULL, -+ .atomic_check = vc4_plane_atomic_check, -+ .atomic_update = vc4_primary_plane_atomic_update, -+ .atomic_disable = vc4_primary_plane_atomic_disable, -+}; -+ -+static const struct drm_plane_helper_funcs vc4_cursor_plane_helper_funcs = { -+ .prepare_fb = NULL, -+ .cleanup_fb = NULL, -+ .atomic_check = vc4_plane_atomic_check, -+ .atomic_update = vc4_cursor_plane_atomic_update, -+ .atomic_disable = vc4_cursor_plane_atomic_disable, -+}; -+ -+static struct drm_plane *vc4_fkms_plane_init(struct drm_device *dev, -+ enum drm_plane_type type) -+{ -+ struct drm_plane *plane = NULL; -+ struct vc4_fkms_plane *vc4_plane; -+ u32 xrgb8888 = DRM_FORMAT_XRGB8888; -+ u32 argb8888 = DRM_FORMAT_ARGB8888; -+ int ret = 0; -+ bool primary = (type == DRM_PLANE_TYPE_PRIMARY); -+ -+ vc4_plane = devm_kzalloc(dev->dev, sizeof(*vc4_plane), -+ GFP_KERNEL); -+ if (!vc4_plane) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ plane = &vc4_plane->base; -+ ret = drm_universal_plane_init(dev, plane, 0xff, -+ &vc4_plane_funcs, -+ primary ? &xrgb8888 : &argb8888, 1, -+ type, NULL); -+ -+ if (type == DRM_PLANE_TYPE_PRIMARY) { -+ vc4_plane->fbinfo = -+ dma_alloc_coherent(dev->dev, -+ sizeof(*vc4_plane->fbinfo), -+ &vc4_plane->fbinfo_bus_addr, -+ GFP_KERNEL); -+ memset(vc4_plane->fbinfo, 0, sizeof(*vc4_plane->fbinfo)); -+ -+ drm_plane_helper_add(plane, &vc4_primary_plane_helper_funcs); -+ } else { -+ drm_plane_helper_add(plane, &vc4_cursor_plane_helper_funcs); -+ } -+ -+ return plane; -+fail: -+ if (plane) -+ vc4_plane_destroy(plane); -+ -+ return ERR_PTR(ret); -+} -+ -+static void vc4_crtc_mode_set_nofb(struct drm_crtc *crtc) -+{ -+ /* Everyting is handled in the planes. */ -+} -+ -+static void vc4_crtc_disable(struct drm_crtc *crtc) -+{ -+} -+ -+static void vc4_crtc_enable(struct drm_crtc *crtc) -+{ -+} -+ -+static int vc4_crtc_atomic_check(struct drm_crtc *crtc, -+ struct drm_crtc_state *state) -+{ -+ return 0; -+} -+ -+static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, -+ struct drm_crtc_state *old_state) -+{ -+} -+ -+static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) -+{ -+ struct drm_crtc *crtc = &vc4_crtc->base; -+ struct drm_device *dev = crtc->dev; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&dev->event_lock, flags); -+ if (vc4_crtc->event) { -+ drm_crtc_send_vblank_event(crtc, vc4_crtc->event); -+ vc4_crtc->event = NULL; -+ drm_crtc_vblank_put(crtc); -+ } -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+} -+ -+static irqreturn_t vc4_crtc_irq_handler(int irq, void *data) -+{ -+ struct vc4_crtc *vc4_crtc = data; -+ u32 stat = readl(vc4_crtc->regs + SMICS); -+ irqreturn_t ret = IRQ_NONE; -+ -+ if (stat & SMICS_INTERRUPTS) { -+ writel(0, vc4_crtc->regs + SMICS); -+ drm_crtc_handle_vblank(&vc4_crtc->base); -+ vc4_crtc_handle_page_flip(vc4_crtc); -+ ret = IRQ_HANDLED; -+ } -+ -+ return ret; -+} -+ -+static int vc4_page_flip(struct drm_crtc *crtc, -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) -+{ -+ if (flags & DRM_MODE_PAGE_FLIP_ASYNC) { -+ DRM_ERROR("Async flips aren't allowed\n"); -+ return -EINVAL; -+ } -+ -+ return drm_atomic_helper_page_flip(crtc, fb, event, flags); -+} -+ -+static const struct drm_crtc_funcs vc4_crtc_funcs = { -+ .set_config = drm_atomic_helper_set_config, -+ .destroy = drm_crtc_cleanup, -+ .page_flip = vc4_page_flip, -+ .set_property = NULL, -+ .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ -+ .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ -+ .reset = drm_atomic_helper_crtc_reset, -+ .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, -+ .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, -+}; -+ -+static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { -+ .mode_set_nofb = vc4_crtc_mode_set_nofb, -+ .disable = vc4_crtc_disable, -+ .enable = vc4_crtc_enable, -+ .atomic_check = vc4_crtc_atomic_check, -+ .atomic_flush = vc4_crtc_atomic_flush, -+}; -+ -+/* Frees the page flip event when the DRM device is closed with the -+ * event still outstanding. -+ */ -+void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file) -+{ -+ struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); -+ struct drm_device *dev = crtc->dev; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&dev->event_lock, flags); -+ -+ if (vc4_crtc->event && vc4_crtc->event->base.file_priv == file) { -+ kfree(&vc4_crtc->event->base); -+ drm_crtc_vblank_put(crtc); -+ vc4_crtc->event = NULL; -+ } -+ -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+} -+ -+static const struct of_device_id vc4_firmware_kms_dt_match[] = { -+ { .compatible = "raspberrypi,rpi-firmware-kms" }, -+ {} -+}; -+ -+static enum drm_connector_status -+vc4_fkms_connector_detect(struct drm_connector *connector, bool force) -+{ -+ return connector_status_connected; -+} -+ -+static int vc4_fkms_connector_get_modes(struct drm_connector *connector) -+{ -+ struct drm_device *dev = connector->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ u32 wh[2] = {0, 0}; -+ int ret; -+ struct drm_display_mode *mode; -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT, -+ &wh, sizeof(wh)); -+ if (ret) { -+ DRM_ERROR("Failed to get screen size: %d (0x%08x 0x%08x)\n", -+ ret, wh[0], wh[1]); -+ return 0; -+ } -+ -+ mode = drm_cvt_mode(dev, wh[0], wh[1], 60 /* vrefresh */, -+ 0, 0, false); -+ drm_mode_probed_add(connector, mode); -+ -+ return 1; -+} -+ -+static struct drm_encoder * -+vc4_fkms_connector_best_encoder(struct drm_connector *connector) -+{ -+ struct vc4_fkms_connector *fkms_connector = -+ to_vc4_fkms_connector(connector); -+ return fkms_connector->encoder; -+} -+ -+static void vc4_fkms_connector_destroy(struct drm_connector *connector) -+{ -+ drm_connector_unregister(connector); -+ drm_connector_cleanup(connector); -+} -+ -+static const struct drm_connector_funcs vc4_fkms_connector_funcs = { -+ .dpms = drm_atomic_helper_connector_dpms, -+ .detect = vc4_fkms_connector_detect, -+ .fill_modes = drm_helper_probe_single_connector_modes, -+ .destroy = vc4_fkms_connector_destroy, -+ .reset = drm_atomic_helper_connector_reset, -+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, -+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -+}; -+ -+static const struct drm_connector_helper_funcs vc4_fkms_connector_helper_funcs = { -+ .get_modes = vc4_fkms_connector_get_modes, -+ .best_encoder = vc4_fkms_connector_best_encoder, -+}; -+ -+static struct drm_connector *vc4_fkms_connector_init(struct drm_device *dev, -+ struct drm_encoder *encoder) -+{ -+ struct drm_connector *connector = NULL; -+ struct vc4_fkms_connector *fkms_connector; -+ int ret = 0; -+ -+ fkms_connector = devm_kzalloc(dev->dev, sizeof(*fkms_connector), -+ GFP_KERNEL); -+ if (!fkms_connector) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ connector = &fkms_connector->base; -+ -+ fkms_connector->encoder = encoder; -+ -+ drm_connector_init(dev, connector, &vc4_fkms_connector_funcs, -+ DRM_MODE_CONNECTOR_HDMIA); -+ drm_connector_helper_add(connector, &vc4_fkms_connector_helper_funcs); -+ -+ connector->polled = (DRM_CONNECTOR_POLL_CONNECT | -+ DRM_CONNECTOR_POLL_DISCONNECT); -+ -+ connector->interlace_allowed = 0; -+ connector->doublescan_allowed = 0; -+ -+ drm_mode_connector_attach_encoder(connector, encoder); -+ -+ return connector; -+ -+ fail: -+ if (connector) -+ vc4_fkms_connector_destroy(connector); -+ -+ return ERR_PTR(ret); -+} -+ -+static void vc4_fkms_encoder_destroy(struct drm_encoder *encoder) -+{ -+ drm_encoder_cleanup(encoder); -+} -+ -+static const struct drm_encoder_funcs vc4_fkms_encoder_funcs = { -+ .destroy = vc4_fkms_encoder_destroy, -+}; -+ -+static void vc4_fkms_encoder_enable(struct drm_encoder *encoder) -+{ -+} -+ -+static void vc4_fkms_encoder_disable(struct drm_encoder *encoder) -+{ -+} -+ -+static const struct drm_encoder_helper_funcs vc4_fkms_encoder_helper_funcs = { -+ .enable = vc4_fkms_encoder_enable, -+ .disable = vc4_fkms_encoder_disable, -+}; -+ -+static int vc4_fkms_bind(struct device *dev, struct device *master, void *data) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct drm_device *drm = dev_get_drvdata(master); -+ struct vc4_dev *vc4 = to_vc4_dev(drm); -+ struct vc4_crtc *vc4_crtc; -+ struct vc4_fkms_encoder *vc4_encoder; -+ struct drm_crtc *crtc; -+ struct drm_plane *primary_plane, *cursor_plane, *destroy_plane, *temp; -+ struct device_node *firmware_node; -+ int ret; -+ -+ vc4->firmware_kms = true; -+ -+ vc4_crtc = devm_kzalloc(dev, sizeof(*vc4_crtc), GFP_KERNEL); -+ if (!vc4_crtc) -+ return -ENOMEM; -+ crtc = &vc4_crtc->base; -+ -+ firmware_node = of_parse_phandle(dev->of_node, "brcm,firmware", 0); -+ vc4->firmware = rpi_firmware_get(firmware_node); -+ if (!vc4->firmware) { -+ DRM_DEBUG("Failed to get Raspberry Pi firmware reference.\n"); -+ return -EPROBE_DEFER; -+ } -+ of_node_put(firmware_node); -+ -+ /* Map the SMI interrupt reg */ -+ vc4_crtc->regs = vc4_ioremap_regs(pdev, 0); -+ if (IS_ERR(vc4_crtc->regs)) -+ return PTR_ERR(vc4_crtc->regs); -+ -+ /* For now, we create just the primary and the legacy cursor -+ * planes. We should be able to stack more planes on easily, -+ * but to do that we would need to compute the bandwidth -+ * requirement of the plane configuration, and reject ones -+ * that will take too much. -+ */ -+ primary_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_PRIMARY); -+ if (IS_ERR(primary_plane)) { -+ dev_err(dev, "failed to construct primary plane\n"); -+ ret = PTR_ERR(primary_plane); -+ goto err; -+ } -+ -+ cursor_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_CURSOR); -+ if (IS_ERR(cursor_plane)) { -+ dev_err(dev, "failed to construct cursor plane\n"); -+ ret = PTR_ERR(cursor_plane); -+ goto err; -+ } -+ -+ drm_crtc_init_with_planes(drm, crtc, primary_plane, cursor_plane, -+ &vc4_crtc_funcs, NULL); -+ drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs); -+ primary_plane->crtc = crtc; -+ cursor_plane->crtc = crtc; -+ vc4->crtc[drm_crtc_index(crtc)] = vc4_crtc; -+ -+ vc4_encoder = devm_kzalloc(dev, sizeof(*vc4_encoder), GFP_KERNEL); -+ if (!vc4_encoder) -+ return -ENOMEM; -+ vc4_crtc->encoder = &vc4_encoder->base; -+ vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ; -+ drm_encoder_init(drm, &vc4_encoder->base, &vc4_fkms_encoder_funcs, -+ DRM_MODE_ENCODER_TMDS, NULL); -+ drm_encoder_helper_add(&vc4_encoder->base, -+ &vc4_fkms_encoder_helper_funcs); -+ -+ vc4_crtc->connector = vc4_fkms_connector_init(drm, &vc4_encoder->base); -+ if (IS_ERR(vc4_crtc->connector)) { -+ ret = PTR_ERR(vc4_crtc->connector); -+ goto err_destroy_encoder; -+ } -+ -+ writel(0, vc4_crtc->regs + SMICS); -+ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), -+ vc4_crtc_irq_handler, 0, "vc4 firmware kms", -+ vc4_crtc); -+ if (ret) -+ goto err_destroy_connector; -+ -+ platform_set_drvdata(pdev, vc4_crtc); -+ -+ return 0; -+ -+err_destroy_connector: -+ vc4_fkms_connector_destroy(vc4_crtc->connector); -+err_destroy_encoder: -+ vc4_fkms_encoder_destroy(vc4_crtc->encoder); -+ list_for_each_entry_safe(destroy_plane, temp, -+ &drm->mode_config.plane_list, head) { -+ if (destroy_plane->possible_crtcs == 1 << drm_crtc_index(crtc)) -+ destroy_plane->funcs->destroy(destroy_plane); -+ } -+err: -+ return ret; -+} -+ -+static void vc4_fkms_unbind(struct device *dev, struct device *master, -+ void *data) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct vc4_crtc *vc4_crtc = dev_get_drvdata(dev); -+ -+ vc4_fkms_connector_destroy(vc4_crtc->connector); -+ vc4_fkms_encoder_destroy(vc4_crtc->encoder); -+ drm_crtc_cleanup(&vc4_crtc->base); -+ -+ platform_set_drvdata(pdev, NULL); -+} -+ -+static const struct component_ops vc4_fkms_ops = { -+ .bind = vc4_fkms_bind, -+ .unbind = vc4_fkms_unbind, -+}; -+ -+static int vc4_fkms_probe(struct platform_device *pdev) -+{ -+ return component_add(&pdev->dev, &vc4_fkms_ops); -+} -+ -+static int vc4_fkms_remove(struct platform_device *pdev) -+{ -+ component_del(&pdev->dev, &vc4_fkms_ops); -+ return 0; -+} -+ -+struct platform_driver vc4_firmware_kms_driver = { -+ .probe = vc4_fkms_probe, -+ .remove = vc4_fkms_remove, -+ .driver = { -+ .name = "vc4_firmware_kms", -+ .of_match_table = vc4_firmware_kms_dt_match, -+ }, -+}; - -From 26a8008c3e11309384b26b46cfc4c6499c2fe676 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Sat, 17 Sep 2016 15:07:10 +0200 -Subject: [PATCH 104/122] i2c: bcm2835: Fix hang for writing messages larger - than 16 bytes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Writing messages larger than the FIFO size results in a hang, rendering -the machine unusable. This is because the RXD status flag is set on the -first interrupt which results in bcm2835_drain_rxfifo() stealing bytes -from the buffer. The controller continues to trigger interrupts waiting -for the missing bytes, but bcm2835_fill_txfifo() has none to give. -In this situation wait_for_completion_timeout() apparently is unable to -stop the madness. - -The BCM2835 ARM Peripherals datasheet has this to say about the flags: - TXD: is set when the FIFO has space for at least one byte of data. - RXD: is set when the FIFO contains at least one byte of data. - TXW: is set during a write transfer and the FIFO is less than full. - RXR: is set during a read transfer and the FIFO is or more full. - -Implementing the logic from the downstream i2c-bcm2708 driver solved -the hang problem. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt -Reviewed-by: Martin Sperl ---- - drivers/i2c/busses/i2c-bcm2835.c | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index d4f3239b56865919e1b781b20a7c5ebcd76b4eb9..f283b714aa79e2e4685ed95b04b6b289f7e9eee7 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -64,6 +64,7 @@ struct bcm2835_i2c_dev { - int irq; - struct i2c_adapter adapter; - struct completion completion; -+ struct i2c_msg *curr_msg; - u32 msg_err; - u8 *msg_buf; - size_t msg_buf_remaining; -@@ -126,14 +127,13 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - return IRQ_HANDLED; - } - -- if (val & BCM2835_I2C_S_RXD) { -- bcm2835_drain_rxfifo(i2c_dev); -- if (!(val & BCM2835_I2C_S_DONE)) -- return IRQ_HANDLED; -- } -- - if (val & BCM2835_I2C_S_DONE) { -- if (i2c_dev->msg_buf_remaining) -+ if (i2c_dev->curr_msg->flags & I2C_M_RD) { -+ bcm2835_drain_rxfifo(i2c_dev); -+ val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); -+ } -+ -+ if ((val & BCM2835_I2C_S_RXD) || i2c_dev->msg_buf_remaining) - i2c_dev->msg_err = BCM2835_I2C_S_LEN; - else - i2c_dev->msg_err = 0; -@@ -141,11 +141,16 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - return IRQ_HANDLED; - } - -- if (val & BCM2835_I2C_S_TXD) { -+ if (val & BCM2835_I2C_S_TXW) { - bcm2835_fill_txfifo(i2c_dev); - return IRQ_HANDLED; - } - -+ if (val & BCM2835_I2C_S_RXR) { -+ bcm2835_drain_rxfifo(i2c_dev); -+ return IRQ_HANDLED; -+ } -+ - return IRQ_NONE; - } - -@@ -155,6 +160,7 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - u32 c; - unsigned long time_left; - -+ i2c_dev->curr_msg = msg; - i2c_dev->msg_buf = msg->buf; - i2c_dev->msg_buf_remaining = msg->len; - reinit_completion(&i2c_dev->completion); - -From c91628e1f62406194456f78889477efa6ebe1592 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Sep 2016 18:24:38 +0200 -Subject: [PATCH 105/122] i2c: bcm2835: Protect against unexpected TXW/RXR - interrupts -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If an unexpected TXW or RXR interrupt occurs (msg_buf_remaining == 0), -the driver has no way to fill/drain the FIFO to stop the interrupts. -In this case the controller has to be disabled and the transfer -completed to avoid hang. - -(CLKT | ERR) and DONE interrupts are completed in their own paths, and -the controller is disabled in the transfer function after completion. -Unite the code paths and do disabling inside the interrupt routine. - -Clear interrupt status bits in the united completion path instead of -trying to do it on every interrupt which isn't necessary. -Only CLKT, ERR and DONE can be cleared that way. - -Add the status value to the error value in case of TXW/RXR errors to -distinguish them from the other S_LEN error. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 40 +++++++++++++++++++++++++++++++--------- - 1 file changed, 31 insertions(+), 9 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index f283b714aa79e2e4685ed95b04b6b289f7e9eee7..d2ba1a4de36af512e8e3c97251bd3537ae61591a 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -50,8 +50,6 @@ - #define BCM2835_I2C_S_CLKT BIT(9) - #define BCM2835_I2C_S_LEN BIT(10) /* Fake bit for SW error reporting */ - --#define BCM2835_I2C_BITMSK_S 0x03FF -- - #define BCM2835_I2C_CDIV_MIN 0x0002 - #define BCM2835_I2C_CDIV_MAX 0xFFFE - -@@ -111,20 +109,26 @@ static void bcm2835_drain_rxfifo(struct bcm2835_i2c_dev *i2c_dev) - } - } - -+/* -+ * Note about I2C_C_CLEAR on error: -+ * The I2C_C_CLEAR on errors will take some time to resolve -- if you were in -+ * non-idle state and I2C_C_READ, it sets an abort_rx flag and runs through -+ * the state machine to send a NACK and a STOP. Since we're setting CLEAR -+ * without I2CEN, that NACK will be hanging around queued up for next time -+ * we start the engine. -+ */ -+ - static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - { - struct bcm2835_i2c_dev *i2c_dev = data; - u32 val, err; - - val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); -- val &= BCM2835_I2C_BITMSK_S; -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S, val); - - err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR); - if (err) { - i2c_dev->msg_err = err; -- complete(&i2c_dev->completion); -- return IRQ_HANDLED; -+ goto complete; - } - - if (val & BCM2835_I2C_S_DONE) { -@@ -137,21 +141,38 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - i2c_dev->msg_err = BCM2835_I2C_S_LEN; - else - i2c_dev->msg_err = 0; -- complete(&i2c_dev->completion); -- return IRQ_HANDLED; -+ goto complete; - } - - if (val & BCM2835_I2C_S_TXW) { -+ if (!i2c_dev->msg_buf_remaining) { -+ i2c_dev->msg_err = val | BCM2835_I2C_S_LEN; -+ goto complete; -+ } -+ - bcm2835_fill_txfifo(i2c_dev); - return IRQ_HANDLED; - } - - if (val & BCM2835_I2C_S_RXR) { -+ if (!i2c_dev->msg_buf_remaining) { -+ i2c_dev->msg_err = val | BCM2835_I2C_S_LEN; -+ goto complete; -+ } -+ - bcm2835_drain_rxfifo(i2c_dev); - return IRQ_HANDLED; - } - - return IRQ_NONE; -+ -+complete: -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S, BCM2835_I2C_S_CLKT | -+ BCM2835_I2C_S_ERR | BCM2835_I2C_S_DONE); -+ complete(&i2c_dev->completion); -+ -+ return IRQ_HANDLED; - } - - static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, -@@ -181,8 +202,9 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - - time_left = wait_for_completion_timeout(&i2c_dev->completion, - BCM2835_I2C_TIMEOUT); -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); - if (!time_left) { -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, -+ BCM2835_I2C_C_CLEAR); - dev_err(i2c_dev->dev, "i2c transfer timed out\n"); - return -ETIMEDOUT; - } - -From 878f3d3cb001a41cefc17e11e5b527b576478959 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Mon, 19 Sep 2016 17:19:41 +0200 -Subject: [PATCH 106/122] i2c: bcm2835: Use dev_dbg logging on transfer errors -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Writing to an AT24C32 generates on average 2x i2c transfer errors per -32-byte page write. Which amounts to a lot for a 4k write. This is due -to the fact that the chip doesn't respond during it's internal write -cycle when the at24 driver tries and retries the next write. -Only a handful drivers use dev_err() on transfer error, so switch to -dev_dbg() instead. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index d2ba1a4de36af512e8e3c97251bd3537ae61591a..54d510abd46a117c9238fc6d7edec84019d1f60d 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -216,7 +216,7 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - (msg->flags & I2C_M_IGNORE_NAK)) - return 0; - -- dev_err(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); -+ dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - return -EREMOTEIO; - -From dd301c9f8456669afa77139328d78bac9f2fcb48 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Thu, 22 Sep 2016 22:05:50 +0200 -Subject: [PATCH 107/122] i2c: bcm2835: Can't support I2C_M_IGNORE_NAK -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The controller can't support this flag, so remove it. - -Documentation/i2c/i2c-protocol states that all of the message is sent: - -I2C_M_IGNORE_NAK: - Normally message is interrupted immediately if there is [NA] from the - client. Setting this flag treats any [NA] as [A], and all of - message is sent. - -From the BCM2835 ARM Peripherals datasheet: - - The ERR field is set when the slave fails to acknowledge either - its address or a data byte written to it. - -So when the controller doesn't receive an ack, it sets ERR and raises -an interrupt. In other words, the whole message is not sent. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index 54d510abd46a117c9238fc6d7edec84019d1f60d..565ef69ce61423544dc0558c85ef318b0ae9c324 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -212,10 +212,6 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - if (likely(!i2c_dev->msg_err)) - return 0; - -- if ((i2c_dev->msg_err & BCM2835_I2C_S_ERR) && -- (msg->flags & I2C_M_IGNORE_NAK)) -- return 0; -- - dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - -From 17019eef014c360549b56b67f8f6448e718b9496 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Sep 2016 04:54:27 +0200 -Subject: [PATCH 108/122] i2c: bcm2835: Add support for Repeated Start - Condition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Documentation/i2c/i2c-protocol states that Combined transactions should -separate messages with a Start bit and end the whole transaction with a -Stop bit. This patch adds support for issuing only a Start between -messages instead of a Stop followed by a Start. - -This implementation differs from downstream i2c-bcm2708 in 2 respects: -- it uses an interrupt to detect that the transfer is active instead - of using polling. There is no interrupt for Transfer Active, but by - not prefilling the FIFO it's possible to use the TXW interrupt. -- when resetting/disabling the controller between transfers it writes - CLEAR to the control register instead of just zero. - Using just zero gave many errors. This might be the reason why - downstream had to disable this feature and make it available with a - module parameter. - -I have run thousands of transfers to a DS1307 (rtc), MMA8451 (accel) -and AT24C32 (eeprom) in parallel without problems. - -Signed-off-by: Noralf Trønnes -Acked-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 101 ++++++++++++++++++++++++--------------- - 1 file changed, 63 insertions(+), 38 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index 565ef69ce61423544dc0558c85ef318b0ae9c324..241e08ae7c27cec23fad3c1bf3ebad3a4d2a8e6f 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -63,6 +63,7 @@ struct bcm2835_i2c_dev { - struct i2c_adapter adapter; - struct completion completion; - struct i2c_msg *curr_msg; -+ int num_msgs; - u32 msg_err; - u8 *msg_buf; - size_t msg_buf_remaining; -@@ -110,6 +111,45 @@ static void bcm2835_drain_rxfifo(struct bcm2835_i2c_dev *i2c_dev) - } - - /* -+ * Repeated Start Condition (Sr) -+ * The BCM2835 ARM Peripherals datasheet mentions a way to trigger a Sr when it -+ * talks about reading from a slave with 10 bit address. This is achieved by -+ * issuing a write, poll the I2CS.TA flag and wait for it to be set, and then -+ * issue a read. -+ * A comment in https://github.com/raspberrypi/linux/issues/254 shows how the -+ * firmware actually does it using polling and says that it's a workaround for -+ * a problem in the state machine. -+ * It turns out that it is possible to use the TXW interrupt to know when the -+ * transfer is active, provided the FIFO has not been prefilled. -+ */ -+ -+static void bcm2835_i2c_start_transfer(struct bcm2835_i2c_dev *i2c_dev) -+{ -+ u32 c = BCM2835_I2C_C_ST | BCM2835_I2C_C_I2CEN; -+ struct i2c_msg *msg = i2c_dev->curr_msg; -+ bool last_msg = (i2c_dev->num_msgs == 1); -+ -+ if (!i2c_dev->num_msgs) -+ return; -+ -+ i2c_dev->num_msgs--; -+ i2c_dev->msg_buf = msg->buf; -+ i2c_dev->msg_buf_remaining = msg->len; -+ -+ if (msg->flags & I2C_M_RD) -+ c |= BCM2835_I2C_C_READ | BCM2835_I2C_C_INTR; -+ else -+ c |= BCM2835_I2C_C_INTT; -+ -+ if (last_msg) -+ c |= BCM2835_I2C_C_INTD; -+ -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); -+} -+ -+/* - * Note about I2C_C_CLEAR on error: - * The I2C_C_CLEAR on errors will take some time to resolve -- if you were in - * non-idle state and I2C_C_READ, it sets an abort_rx flag and runs through -@@ -151,6 +191,12 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - } - - bcm2835_fill_txfifo(i2c_dev); -+ -+ if (i2c_dev->num_msgs && !i2c_dev->msg_buf_remaining) { -+ i2c_dev->curr_msg++; -+ bcm2835_i2c_start_transfer(i2c_dev); -+ } -+ - return IRQ_HANDLED; - } - -@@ -175,30 +221,25 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - return IRQ_HANDLED; - } - --static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, -- struct i2c_msg *msg) -+static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], -+ int num) - { -- u32 c; -+ struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); - unsigned long time_left; -+ int i; - -- i2c_dev->curr_msg = msg; -- i2c_dev->msg_buf = msg->buf; -- i2c_dev->msg_buf_remaining = msg->len; -- reinit_completion(&i2c_dev->completion); -- -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -+ for (i = 0; i < (num - 1); i++) -+ if (msgs[i].flags & I2C_M_RD) { -+ dev_warn_once(i2c_dev->dev, -+ "only one read message supported, has to be last\n"); -+ return -EOPNOTSUPP; -+ } - -- if (msg->flags & I2C_M_RD) { -- c = BCM2835_I2C_C_READ | BCM2835_I2C_C_INTR; -- } else { -- c = BCM2835_I2C_C_INTT; -- bcm2835_fill_txfifo(i2c_dev); -- } -- c |= BCM2835_I2C_C_ST | BCM2835_I2C_C_INTD | BCM2835_I2C_C_I2CEN; -+ i2c_dev->curr_msg = msgs; -+ i2c_dev->num_msgs = num; -+ reinit_completion(&i2c_dev->completion); - -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); -+ bcm2835_i2c_start_transfer(i2c_dev); - - time_left = wait_for_completion_timeout(&i2c_dev->completion, - BCM2835_I2C_TIMEOUT); -@@ -209,31 +250,15 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - return -ETIMEDOUT; - } - -- if (likely(!i2c_dev->msg_err)) -- return 0; -+ if (!i2c_dev->msg_err) -+ return num; - - dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - return -EREMOTEIO; -- else -- return -EIO; --} -- --static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], -- int num) --{ -- struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); -- int i; -- int ret = 0; -- -- for (i = 0; i < num; i++) { -- ret = bcm2835_i2c_xfer_msg(i2c_dev, &msgs[i]); -- if (ret) -- break; -- } - -- return ret ?: i; -+ return -EIO; - } - - static u32 bcm2835_i2c_func(struct i2c_adapter *adap) - -From 90f2d2d5fb2aa94eafd361372b6a55fa3ad1b029 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Sep 2016 04:57:17 +0200 -Subject: [PATCH 109/122] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use i2c_adapter->timeout for the completion timeout value. The core -default is 1 second. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index 241e08ae7c27cec23fad3c1bf3ebad3a4d2a8e6f..d2085dd3742eabebc537621968088261f8dc7ea8 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -53,8 +53,6 @@ - #define BCM2835_I2C_CDIV_MIN 0x0002 - #define BCM2835_I2C_CDIV_MAX 0xFFFE - --#define BCM2835_I2C_TIMEOUT (msecs_to_jiffies(1000)) -- - struct bcm2835_i2c_dev { - struct device *dev; - void __iomem *regs; -@@ -242,7 +240,7 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - bcm2835_i2c_start_transfer(i2c_dev); - - time_left = wait_for_completion_timeout(&i2c_dev->completion, -- BCM2835_I2C_TIMEOUT); -+ adap->timeout); - if (!time_left) { - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, - BCM2835_I2C_C_CLEAR); - -From d0724c34a0fc6d93228c19bede299e63afe0c036 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Tue, 27 Sep 2016 01:00:08 +0200 -Subject: [PATCH 110/122] i2c: bcm2835: Add support for dynamic clock -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Support a dynamic clock by reading the frequency and setting the -divisor in the transfer function instead of during probe. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Martin Sperl ---- - drivers/i2c/busses/i2c-bcm2835.c | 51 +++++++++++++++++++++++++--------------- - 1 file changed, 32 insertions(+), 19 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index d2085dd3742eabebc537621968088261f8dc7ea8..c3436f627028477f7e21b47e079fd5ab06ec188a 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -58,6 +58,7 @@ struct bcm2835_i2c_dev { - void __iomem *regs; - struct clk *clk; - int irq; -+ u32 bus_clk_rate; - struct i2c_adapter adapter; - struct completion completion; - struct i2c_msg *curr_msg; -@@ -78,6 +79,30 @@ static inline u32 bcm2835_i2c_readl(struct bcm2835_i2c_dev *i2c_dev, u32 reg) - return readl(i2c_dev->regs + reg); - } - -+static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev) -+{ -+ u32 divider; -+ -+ divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk), -+ i2c_dev->bus_clk_rate); -+ /* -+ * Per the datasheet, the register is always interpreted as an even -+ * number, by rounding down. In other words, the LSB is ignored. So, -+ * if the LSB is set, increment the divider to avoid any issue. -+ */ -+ if (divider & 1) -+ divider++; -+ if ((divider < BCM2835_I2C_CDIV_MIN) || -+ (divider > BCM2835_I2C_CDIV_MAX)) { -+ dev_err_ratelimited(i2c_dev->dev, "Invalid clock-frequency\n"); -+ return -EINVAL; -+ } -+ -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider); -+ -+ return 0; -+} -+ - static void bcm2835_fill_txfifo(struct bcm2835_i2c_dev *i2c_dev) - { - u32 val; -@@ -224,7 +249,7 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - { - struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); - unsigned long time_left; -- int i; -+ int i, ret; - - for (i = 0; i < (num - 1); i++) - if (msgs[i].flags & I2C_M_RD) { -@@ -233,6 +258,10 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - return -EOPNOTSUPP; - } - -+ ret = bcm2835_i2c_set_divider(i2c_dev); -+ if (ret) -+ return ret; -+ - i2c_dev->curr_msg = msgs; - i2c_dev->num_msgs = num; - reinit_completion(&i2c_dev->completion); -@@ -282,7 +311,6 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) - { - struct bcm2835_i2c_dev *i2c_dev; - struct resource *mem, *irq; -- u32 bus_clk_rate, divider; - int ret; - struct i2c_adapter *adap; - -@@ -306,27 +334,12 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) - } - - ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", -- &bus_clk_rate); -+ &i2c_dev->bus_clk_rate); - if (ret < 0) { - dev_warn(&pdev->dev, - "Could not read clock-frequency property\n"); -- bus_clk_rate = 100000; -- } -- -- divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk), bus_clk_rate); -- /* -- * Per the datasheet, the register is always interpreted as an even -- * number, by rounding down. In other words, the LSB is ignored. So, -- * if the LSB is set, increment the divider to avoid any issue. -- */ -- if (divider & 1) -- divider++; -- if ((divider < BCM2835_I2C_CDIV_MIN) || -- (divider > BCM2835_I2C_CDIV_MAX)) { -- dev_err(&pdev->dev, "Invalid clock-frequency\n"); -- return -ENODEV; -+ i2c_dev->bus_clk_rate = 100000; - } -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider); - - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq) { - -From 0cc815d16e01c81698ecb53c57222ffb003377bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Tue, 1 Nov 2016 15:15:41 +0100 -Subject: [PATCH 111/122] i2c: bcm2835: Add debug support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This adds a debug module parameter to aid in debugging transfer issues -by printing info to the kernel log. When enabled, status values are -collected in the interrupt routine and msg info in -bcm2835_i2c_start_transfer(). This is done in a way that tries to avoid -affecting timing. Having printk in the isr can mask issues. - -debug values (additive): -1: Print info on error -2: Print info on all transfers -3: Print messages before transfer is started - -The value can be changed at runtime: -/sys/module/i2c_bcm2835/parameters/debug - -Example output, debug=3: -[ 747.114448] bcm2835_i2c_xfer: msg(1/2) write addr=0x54, len=2 flags= [i2c1] -[ 747.114463] bcm2835_i2c_xfer: msg(2/2) read addr=0x54, len=32 flags= [i2c1] -[ 747.117809] start_transfer: msg(1/2) write addr=0x54, len=2 flags= [i2c1] -[ 747.117825] isr: remain=2, status=0x30000055 : TA TXW TXD TXE [i2c1] -[ 747.117839] start_transfer: msg(2/2) read addr=0x54, len=32 flags= [i2c1] -[ 747.117849] isr: remain=32, status=0xd0000039 : TA RXR TXD RXD [i2c1] -[ 747.117861] isr: remain=20, status=0xd0000039 : TA RXR TXD RXD [i2c1] -[ 747.117870] isr: remain=8, status=0x32 : DONE TXD RXD [i2c1] - -Signed-off-by: Noralf Trønnes ---- - drivers/i2c/busses/i2c-bcm2835.c | 99 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 98 insertions(+), 1 deletion(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index c3436f627028477f7e21b47e079fd5ab06ec188a..8642f580ce41803bd22c76a0fa80d083d0747be1 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -53,6 +53,18 @@ - #define BCM2835_I2C_CDIV_MIN 0x0002 - #define BCM2835_I2C_CDIV_MAX 0xFFFE - -+static unsigned int debug; -+module_param(debug, uint, 0644); -+MODULE_PARM_DESC(debug, "1=err, 2=isr, 3=xfer"); -+ -+#define BCM2835_DEBUG_MAX 512 -+struct bcm2835_debug { -+ struct i2c_msg *msg; -+ int msg_idx; -+ size_t remain; -+ u32 status; -+}; -+ - struct bcm2835_i2c_dev { - struct device *dev; - void __iomem *regs; -@@ -66,8 +78,78 @@ struct bcm2835_i2c_dev { - u32 msg_err; - u8 *msg_buf; - size_t msg_buf_remaining; -+ struct bcm2835_debug debug[BCM2835_DEBUG_MAX]; -+ unsigned int debug_num; -+ unsigned int debug_num_msgs; - }; - -+static inline void bcm2835_debug_add(struct bcm2835_i2c_dev *i2c_dev, u32 s) -+{ -+ if (!i2c_dev->debug_num_msgs || i2c_dev->debug_num >= BCM2835_DEBUG_MAX) -+ return; -+ -+ i2c_dev->debug[i2c_dev->debug_num].msg = i2c_dev->curr_msg; -+ i2c_dev->debug[i2c_dev->debug_num].msg_idx = -+ i2c_dev->debug_num_msgs - i2c_dev->num_msgs; -+ i2c_dev->debug[i2c_dev->debug_num].remain = i2c_dev->msg_buf_remaining; -+ i2c_dev->debug[i2c_dev->debug_num].status = s; -+ i2c_dev->debug_num++; -+} -+ -+static void bcm2835_debug_print_status(struct bcm2835_i2c_dev *i2c_dev, -+ struct bcm2835_debug *d) -+{ -+ u32 s = d->status; -+ -+ pr_info("isr: remain=%zu, status=0x%x : %s%s%s%s%s%s%s%s%s%s [i2c%d]\n", -+ d->remain, s, -+ s & BCM2835_I2C_S_TA ? "TA " : "", -+ s & BCM2835_I2C_S_DONE ? "DONE " : "", -+ s & BCM2835_I2C_S_TXW ? "TXW " : "", -+ s & BCM2835_I2C_S_RXR ? "RXR " : "", -+ s & BCM2835_I2C_S_TXD ? "TXD " : "", -+ s & BCM2835_I2C_S_RXD ? "RXD " : "", -+ s & BCM2835_I2C_S_TXE ? "TXE " : "", -+ s & BCM2835_I2C_S_RXF ? "RXF " : "", -+ s & BCM2835_I2C_S_ERR ? "ERR " : "", -+ s & BCM2835_I2C_S_CLKT ? "CLKT " : "", -+ i2c_dev->adapter.nr); -+} -+ -+static void bcm2835_debug_print_msg(struct bcm2835_i2c_dev *i2c_dev, -+ struct i2c_msg *msg, int i, int total, -+ const char *fname) -+{ -+ pr_info("%s: msg(%d/%d) %s addr=0x%02x, len=%u flags=%s%s%s%s%s%s%s [i2c%d]\n", -+ fname, i, total, -+ msg->flags & I2C_M_RD ? "read" : "write", msg->addr, msg->len, -+ msg->flags & I2C_M_TEN ? "TEN" : "", -+ msg->flags & I2C_M_RECV_LEN ? "RECV_LEN" : "", -+ msg->flags & I2C_M_NO_RD_ACK ? "NO_RD_ACK" : "", -+ msg->flags & I2C_M_IGNORE_NAK ? "IGNORE_NAK" : "", -+ msg->flags & I2C_M_REV_DIR_ADDR ? "REV_DIR_ADDR" : "", -+ msg->flags & I2C_M_NOSTART ? "NOSTART" : "", -+ msg->flags & I2C_M_STOP ? "STOP" : "", -+ i2c_dev->adapter.nr); -+} -+ -+static void bcm2835_debug_print(struct bcm2835_i2c_dev *i2c_dev) -+{ -+ struct bcm2835_debug *d; -+ unsigned int i; -+ -+ for (i = 0; i < i2c_dev->debug_num; i++) { -+ d = &i2c_dev->debug[i]; -+ if (d->status == ~0) -+ bcm2835_debug_print_msg(i2c_dev, d->msg, d->msg_idx, -+ i2c_dev->debug_num_msgs, "start_transfer"); -+ else -+ bcm2835_debug_print_status(i2c_dev, d); -+ } -+ if (i2c_dev->debug_num >= BCM2835_DEBUG_MAX) -+ pr_info("BCM2835_DEBUG_MAX reached\n"); -+} -+ - static inline void bcm2835_i2c_writel(struct bcm2835_i2c_dev *i2c_dev, - u32 reg, u32 val) - { -@@ -170,6 +252,7 @@ static void bcm2835_i2c_start_transfer(struct bcm2835_i2c_dev *i2c_dev) - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); -+ bcm2835_debug_add(i2c_dev, ~0); - } - - /* -@@ -187,6 +270,7 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - u32 val, err; - - val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); -+ bcm2835_debug_add(i2c_dev, val); - - err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR); - if (err) { -@@ -251,6 +335,13 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - unsigned long time_left; - int i, ret; - -+ if (debug) -+ i2c_dev->debug_num_msgs = num; -+ -+ if (debug > 2) -+ for (i = 0; i < num; i++) -+ bcm2835_debug_print_msg(i2c_dev, &msgs[i], i + 1, num, __func__); -+ - for (i = 0; i < (num - 1); i++) - if (msgs[i].flags & I2C_M_RD) { - dev_warn_once(i2c_dev->dev, -@@ -270,6 +361,10 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - - time_left = wait_for_completion_timeout(&i2c_dev->completion, - adap->timeout); -+ if (debug > 1 || (debug && (!time_left || i2c_dev->msg_err))) -+ bcm2835_debug_print(i2c_dev); -+ i2c_dev->debug_num_msgs = 0; -+ i2c_dev->debug_num = 0; - if (!time_left) { - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, - BCM2835_I2C_C_CLEAR); -@@ -280,7 +375,9 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - if (!i2c_dev->msg_err) - return num; - -- dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); -+ if (debug) -+ dev_err(i2c_dev->dev, "i2c transfer failed: %x\n", -+ i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - return -EREMOTEIO; - -From 683eb2a626bdf358dd1d447bfe3b0e7d112d8024 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 31 Dec 2016 14:15:50 +0000 -Subject: [PATCH 112/122] arm64: Add CONFIG_ARCH_BCM2835 - ---- - arch/arm64/configs/bcmrpi3_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -index d7406f5a4620151044b8f716b4d10bb818648e06..53da5c7a33e5898a66e549fb0c39fe3da555ca87 100644 ---- a/arch/arm64/configs/bcmrpi3_defconfig -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -1332,3 +1332,4 @@ CONFIG_ARM64_CRYPTO=y - CONFIG_CRC_ITU_T=y - CONFIG_LIBCRC32C=y - CONFIG_BCM2708_VCHIQ=n -+CONFIG_ARCH_BCM2835=y - -From 8ec76aa6373a8c90eac7d8c8e980fa333ff69464 Mon Sep 17 00:00:00 2001 -From: Alex Tucker -Date: Tue, 13 Dec 2016 19:50:18 +0000 -Subject: [PATCH 113/122] Add support for Silicon Labs Si7013/20/21 - humidity/temperature sensor. - ---- - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 49 +++++++++++++---------- - 1 file changed, 28 insertions(+), 21 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -index f6d134c095af2398fc55ae7d2b0e86456c30627c..31bda8da4cb6a56bfe493a81b918900995fb0589 100644 ---- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -1,34 +1,41 @@ --// Definitions for a few digital barometric pressure and temperature sensors -+// Definitions for I2C based sensors using the Industrial IO interface. - /dts-v1/; - /plugin/; - - / { -- compatible = "brcm,bcm2708"; -+ compatible = "brcm,bcm2708"; - -- fragment@0 { -- target = <&i2c_arm>; -- __overlay__ { -- #address-cells = <1>; -- #size-cells = <0>; -- status = "okay"; -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - -- bmp085: bmp085@77 { -- compatible = "bosch,bmp085"; -- reg = <0x77>; -- default-oversampling = <3>; -- status = "disable"; -- }; -+ bmp085: bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "disable"; -+ }; - -- bmp280: bmp280@76 { -- compatible = "bosch,bmp280"; -- reg = <0x76>; -- status = "disable"; -- }; -- }; -- }; -+ bmp280: bmp280@76 { -+ compatible = "bosch,bmp280"; -+ reg = <0x76>; -+ status = "disable"; -+ }; -+ -+ si7020: si7020@40 { -+ compatible = "si7020"; -+ reg = <0x40>; -+ status = "disable"; -+ }; -+ }; -+ }; - - __overrides__ { - bmp085 = <&bmp085>,"status"; - bmp280 = <&bmp280>,"status"; -+ si7020 = <&si7020>,"status"; - }; - }; - -From 3b6760e6f2f03b620e4e88d67d3b640c56ce7fd3 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 3 Jan 2017 21:27:46 +0000 -Subject: [PATCH 114/122] Document the si7020 option - ---- - arch/arm/boot/dts/overlays/README | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 81d991803be335e5a1bc3bb0a8c7a2c9f5c392bd..e8fa4ccb44c34a20485c4e6155467af99179153a 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -549,6 +549,9 @@ Params: bmp085 Select the Bosch sensortronic BMP085 - - bmp280 Select the Bosch sensortronic BMP280 - -+ si7020 Select the Silicon Labs Si7013/20/21 humidity/ -+ temperature sensor -+ - - Name: i2c0-bcm2708 - Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations - -From 4ef541bea608cd9f84bc76c8092fafaad1702e3f Mon Sep 17 00:00:00 2001 -From: Giedrius Trainavicius -Date: Thu, 5 Jan 2017 02:38:16 +0200 -Subject: [PATCH 115/122] pisound improvements: - -* Added a writable sysfs object to enable scripts / user space software -to blink MIDI activity LEDs for variable duration. -* Improved hw_param constraints setting. -* Added compatibility with S16_LE sample format. -* Exposed some simple placeholder volume controls, so the card appears -in volumealsa widget. - -Signed-off-by: Giedrius Trainavicius ---- - sound/soc/bcm/pisound.c | 175 ++++++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 154 insertions(+), 21 deletions(-) - -diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c -index 4b8545487d06e4ea70073a5d063fb2310b3b94d0..ba70734b89e61a11201657406223f0b37d54f74a 100644 ---- a/sound/soc/bcm/pisound.c -+++ b/sound/soc/bcm/pisound.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - static int pisnd_spi_init(struct device *dev); - static void pisnd_spi_uninit(void); -@@ -214,6 +215,9 @@ static char g_serial_num[11]; - static char g_id[25]; - static char g_version[5]; - -+static uint8_t g_ledFlashDuration; -+static bool g_ledFlashDurationChanged; -+ - DEFINE_KFIFO(spi_fifo_in, uint8_t, FIFO_SIZE); - DEFINE_KFIFO(spi_fifo_out, uint8_t, FIFO_SIZE); - -@@ -396,8 +400,13 @@ static void pisnd_work_handler(struct work_struct *work) - val = 0; - tx = 0; - -- if (kfifo_get(&spi_fifo_out, &val)) -+ if (g_ledFlashDurationChanged) { -+ tx = 0xf000 | g_ledFlashDuration; -+ g_ledFlashDuration = 0; -+ g_ledFlashDurationChanged = false; -+ } else if (kfifo_get(&spi_fifo_out, &val)) { - tx = 0x0f00 | val; -+ } - - rx = spi_transfer16(tx); - -@@ -410,6 +419,7 @@ static void pisnd_work_handler(struct work_struct *work) - } while (rx != 0 - || !kfifo_is_empty(&spi_fifo_out) - || pisnd_spi_has_more() -+ || g_ledFlashDurationChanged - ); - - if (!kfifo_is_empty(&spi_fifo_in) && g_recvCallback) -@@ -569,7 +579,7 @@ static int pisnd_spi_init(struct device *dev) - } - - /* Flash the LEDs. */ -- spi_transfer16(0xf000); -+ spi_transfer16(0xf008); - - ret = pisnd_spi_gpio_irq_init(dev); - if (ret < 0) { -@@ -610,6 +620,14 @@ static void pisnd_spi_uninit(void) - pisnd_spi_gpio_uninit(); - } - -+static void pisnd_spi_flash_leds(uint8_t duration) -+{ -+ g_ledFlashDuration = duration; -+ g_ledFlashDurationChanged = true; -+ printd("schedule from spi_flash_leds\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+} -+ - static void pisnd_spi_send(uint8_t val) - { - kfifo_put(&spi_fifo_out, val); -@@ -658,6 +676,83 @@ static const struct of_device_id pisound_of_match[] = { - {}, - }; - -+enum { -+ SWITCH = 0, -+ VOLUME = 1, -+}; -+ -+static int pisnd_ctl_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ if (kcontrol->private_value == SWITCH) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = 1; -+ return 0; -+ } else if (kcontrol->private_value == VOLUME) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = 100; -+ return 0; -+ } -+ return -EINVAL; -+} -+ -+static int pisnd_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ if (kcontrol->private_value == SWITCH) { -+ ucontrol->value.integer.value[0] = 1; -+ return 0; -+ } else if (kcontrol->private_value == VOLUME) { -+ ucontrol->value.integer.value[0] = 100; -+ return 0; -+ } -+ -+ return -EINVAL; -+} -+ -+static struct snd_kcontrol_new pisnd_ctl[] = { -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Switch", -+ .index = 0, -+ .private_value = SWITCH, -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .info = pisnd_ctl_info, -+ .get = pisnd_ctl_get, -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Volume", -+ .index = 0, -+ .private_value = VOLUME, -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .info = pisnd_ctl_info, -+ .get = pisnd_ctl_get, -+ }, -+}; -+ -+static int pisnd_ctl_init(struct snd_card *card) -+{ -+ int err, i; -+ -+ for (i = 0; i < ARRAY_SIZE(pisnd_ctl); ++i) { -+ err = snd_ctl_add(card, snd_ctl_new1(&pisnd_ctl[i], NULL)); -+ if (err < 0) -+ return err; -+ } -+ -+ return 0; -+} -+ -+static int pisnd_ctl_uninit(void) -+{ -+ return 0; -+} -+ - static struct gpio_desc *osr0, *osr1, *osr2; - static struct gpio_desc *reset; - static struct gpio_desc *button; -@@ -667,6 +762,14 @@ static int pisnd_hw_params( - struct snd_pcm_hw_params *params - ) - { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ /* pisound runs on fixed 32 clock counts per channel, -+ * as generated by the master ADC. -+ */ -+ snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); -+ - printd("rate = %d\n", params_rate(params)); - printd("ch = %d\n", params_channels(params)); - printd("bits = %u\n", -@@ -711,16 +814,6 @@ static struct snd_pcm_hw_constraint_list constraints_rates = { - .mask = 0, - }; - --static unsigned int sample_bits[] = { -- 24, 32 --}; -- --static struct snd_pcm_hw_constraint_list constraints_sample_bits = { -- .count = ARRAY_SIZE(sample_bits), -- .list = sample_bits, -- .mask = 0, --}; -- - static int pisnd_startup(struct snd_pcm_substream *substream) - { - int err = snd_pcm_hw_constraint_list( -@@ -733,11 +826,21 @@ static int pisnd_startup(struct snd_pcm_substream *substream) - if (err < 0) - return err; - -- err = snd_pcm_hw_constraint_list( -+ err = snd_pcm_hw_constraint_single( - substream->runtime, -- 0, -- SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -- &constraints_sample_bits -+ SNDRV_PCM_HW_PARAM_CHANNELS, -+ 2 -+ ); -+ -+ if (err < 0) -+ return err; -+ -+ err = snd_pcm_hw_constraint_mask64( -+ substream->runtime, -+ SNDRV_PCM_HW_PARAM_FORMAT, -+ SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE - ); - - if (err < 0) -@@ -771,14 +874,23 @@ static int pisnd_card_probe(struct snd_soc_card *card) - { - int err = pisnd_midi_init(card->snd_card); - -- if (err < 0) -+ if (err < 0) { - printe("pisnd_midi_init failed: %d\n", err); -+ return err; -+ } - -- return err; -+ err = pisnd_ctl_init(card->snd_card); -+ if (err < 0) { -+ printe("pisnd_ctl_init failed: %d\n", err); -+ return err; -+ } -+ -+ return 0; - } - - static int pisnd_card_remove(struct snd_soc_card *card) - { -+ pisnd_ctl_uninit(); - pisnd_midi_uninit(); - return 0; - } -@@ -870,17 +982,38 @@ static ssize_t pisnd_version_show( - return sprintf(buf, "%s\n", pisnd_spi_get_version()); - } - -+static ssize_t pisnd_led_store( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ const char *buf, -+ size_t length -+ ) -+{ -+ uint32_t timeout; -+ int err; -+ -+ err = kstrtou32(buf, 10, &timeout); -+ -+ if (err == 0 && timeout <= 255) -+ pisnd_spi_flash_leds(timeout); -+ -+ return length; -+} -+ - static struct kobj_attribute pisnd_serial_attribute = -- __ATTR(serial, 0644, pisnd_serial_show, NULL); -+ __ATTR(serial, 0444, pisnd_serial_show, NULL); - static struct kobj_attribute pisnd_id_attribute = -- __ATTR(id, 0644, pisnd_id_show, NULL); -+ __ATTR(id, 0444, pisnd_id_show, NULL); - static struct kobj_attribute pisnd_version_attribute = -- __ATTR(version, 0644, pisnd_version_show, NULL); -+ __ATTR(version, 0444, pisnd_version_show, NULL); -+static struct kobj_attribute pisnd_led_attribute = -+ __ATTR(led, 0644, NULL, pisnd_led_store); - - static struct attribute *attrs[] = { - &pisnd_serial_attribute.attr, - &pisnd_id_attribute.attr, - &pisnd_version_attribute.attr, -+ &pisnd_led_attribute.attr, - NULL - }; - - -From 425e9111b1dfad787b1f787ec5086fdf1893584e Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 9 Jan 2017 09:23:06 +0000 -Subject: [PATCH 116/122] Revert "Revert "Added driver for HiFiBerry Amp - amplifier add-on board"" - -This reverts commit bf84babd8fffcb79c60f1342c2416f8e1e4b7af9. ---- - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_amp.c | 129 +++++++++++++++ - sound/soc/codecs/Kconfig | 4 + - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ - 7 files changed, 723 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_amp.c - create mode 100644 sound/soc/codecs/tas5713.c - create mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index a0ef6a028136beb27ed13a4136712a70a60f2966..d024377e8450fb5402dcb5ea27161f774b04a8ec 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -38,6 +38,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - -+config SND_BCM2708_SOC_HIFIBERRY_AMP -+ tristate "Support for the HifiBerry Amp" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_TAS5713 -+ help -+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. -+ - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index f720a3d3b5832844ee6d0558317c728f00c40b65..bb1df438540193652ec5464e8bc51f636a1b844e 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,6 +10,7 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-adau1977-adc-objs := adau1977-adc.o -+snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -@@ -27,6 +28,7 @@ snd-soc-allo-piano-dac-objs := allo-piano-dac.o - snd-soc-pisound-objs := pisound.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d17c29780507dc31c50f1d567ff5cea7c8241ff5 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -0,0 +1,129 @@ -+/* -+ * ASoC Driver for HifiBerry AMP -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ // ToDo: init of the dsp-registers. -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params ) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -+ .hw_params = snd_rpi_hifiberry_amp_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -+ { -+ .name = "HifiBerry AMP", -+ .stream_name = "HifiBerry AMP HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "tas5713-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "tas5713.1-001b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_amp_ops, -+ .init = snd_rpi_hifiberry_amp_init, -+ }, -+}; -+ -+ -+static struct snd_soc_card snd_rpi_hifiberry_amp = { -+ .name = "snd_rpi_hifiberry_amp", -+ .driver_name = "HifiberryAmp", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_amp_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), -+}; -+ -+static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-amp", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); -+ -+ -+static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_amp.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); -+ -+ if (ret != 0) { -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); -+} -+ -+ -+static struct platform_driver snd_rpi_hifiberry_amp_driver = { -+ .driver = { -+ .name = "snd-hifiberry-amp", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_amp_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_amp_probe, -+ .remove = snd_rpi_hifiberry_amp_remove, -+}; -+ -+ -+module_platform_driver(snd_rpi_hifiberry_amp_driver); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b..9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -139,6 +139,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -+ select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4_I2C if I2C -@@ -821,6 +822,9 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - -+config SND_SOC_TAS5713 -+ tristate -+ - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 77786e7f44a7fa22d9b5beed3eb687e2b7a28526..5a2db0d2fe2f49920eeccfecef62c969ae2e99a1 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -144,6 +144,7 @@ snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tas5720-objs := tas5720.o - snd-soc-tfa9879-objs := tfa9879.o -+snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -366,6 +367,7 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o -+obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9b2713861dcbed751842ca29c88eb1eae5867411 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.c -@@ -0,0 +1,369 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "tas5713.h" -+ -+ -+static struct i2c_client *i2c; -+ -+struct tas5713_priv { -+ struct regmap *regmap; -+ int mclk_div; -+ struct snd_soc_codec *codec; -+}; -+ -+static struct tas5713_priv *priv_data; -+ -+ -+ -+ -+/* -+ * _ _ ___ _ ___ _ _ -+ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -+ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -+ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ -+ * -+ */ -+ -+static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); -+ -+ -+static const struct snd_kcontrol_new tas5713_snd_controls[] = { -+ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -+ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) -+}; -+ -+ -+ -+ -+/* -+ * __ __ _ _ ___ _ -+ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -+ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -+ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ u16 blen = 0x00; -+ -+ struct snd_soc_codec *codec; -+ codec = dai->codec; -+ priv_data->codec = dai->codec; -+ -+ switch (params_format(params)) { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ blen = 0x03; -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ blen = 0x1; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ blen = 0x04; -+ break; -+ case SNDRV_PCM_FORMAT_S32_LE: -+ blen = 0x05; -+ break; -+ default: -+ dev_err(dai->dev, "Unsupported word length: %u\n", -+ params_format(params)); -+ return -EINVAL; -+ } -+ -+ // set word length -+ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); -+ -+ return 0; -+} -+ -+ -+static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) -+{ -+ unsigned int val = 0; -+ -+ struct tas5713_priv *tas5713; -+ struct snd_soc_codec *codec = dai->codec; -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ if (mute) { -+ val = TAS5713_SOFT_MUTE_ALL; -+ } -+ -+ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); -+} -+ -+ -+static const struct snd_soc_dai_ops tas5713_dai_ops = { -+ .hw_params = tas5713_hw_params, -+ .mute_stream = tas5713_mute_stream, -+}; -+ -+ -+static struct snd_soc_dai_driver tas5713_dai = { -+ .name = "tas5713-hifi", -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_48000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -+ }, -+ .ops = &tas5713_dai_ops, -+}; -+ -+ -+ -+ -+/* -+ * ___ _ ___ _ -+ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -+ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -+ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_remove(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ return 0; -+} -+ -+ -+static int tas5713_probe(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ int i, ret; -+ -+ i2c = container_of(codec->dev, struct i2c_client, dev); -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Trim oscillator -+ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -+ if (ret < 0) return ret; -+ msleep(1000); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Clock mode: 44/48kHz, MCLK=64xfs -+ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -+ if (ret < 0) return ret; -+ -+ // I2S 24bit -+ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -+ if (ret < 0) return ret; -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -+ if (ret < 0) return ret; -+ -+ // Set volume to 0db -+ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -+ if (ret < 0) return ret; -+ -+ // Now start programming the default initialization sequence -+ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -+ ret = i2c_master_send(i2c, -+ tas5713_init_sequence[i].data, -+ tas5713_init_sequence[i].size); -+ if (ret < 0) { -+ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -+ } -+ } -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ -+ return 0; -+} -+ -+ -+static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -+ .probe = tas5713_probe, -+ .remove = tas5713_remove, -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+}; -+ -+ -+ -+ -+/* -+ * ___ ___ ___ ___ _ -+ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -+ * | | / / (__ | |) | '_| \ V / -_) '_| -+ * |___/___\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static const struct reg_default tas5713_reg_defaults[] = { -+ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -+ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -+ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -+ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB -+}; -+ -+ -+static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case TAS5713_DEVICE_ID: -+ case TAS5713_ERROR_STATUS: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+ -+static const struct of_device_id tas5713_of_match[] = { -+ { .compatible = "ti,tas5713", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, tas5713_of_match); -+ -+ -+static struct regmap_config tas5713_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, -+ -+ .max_register = TAS5713_MAX_REGISTER, -+ .volatile_reg = tas5713_reg_volatile, -+ -+ .cache_type = REGCACHE_RBTREE, -+ .reg_defaults = tas5713_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), -+}; -+ -+ -+static int tas5713_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ -+ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -+ if (!priv_data) -+ return -ENOMEM; -+ -+ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -+ if (IS_ERR(priv_data->regmap)) { -+ ret = PTR_ERR(priv_data->regmap); -+ return ret; -+ } -+ -+ i2c_set_clientdata(i2c, priv_data); -+ -+ ret = snd_soc_register_codec(&i2c->dev, -+ &soc_codec_dev_tas5713, &tas5713_dai, 1); -+ -+ return ret; -+} -+ -+ -+static int tas5713_i2c_remove(struct i2c_client *i2c) -+{ -+ snd_soc_unregister_codec(&i2c->dev); -+ i2c_set_clientdata(i2c, NULL); -+ -+ kfree(priv_data); -+ -+ return 0; -+} -+ -+ -+static const struct i2c_device_id tas5713_i2c_id[] = { -+ { "tas5713", 0 }, -+ { } -+}; -+ -+MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); -+ -+ -+static struct i2c_driver tas5713_i2c_driver = { -+ .driver = { -+ .name = "tas5713", -+ .owner = THIS_MODULE, -+ .of_match_table = tas5713_of_match, -+ }, -+ .probe = tas5713_i2c_probe, -+ .remove = tas5713_i2c_remove, -+ .id_table = tas5713_i2c_id -+}; -+ -+ -+static int __init tas5713_modinit(void) -+{ -+ int ret = 0; -+ -+ ret = i2c_add_driver(&tas5713_i2c_driver); -+ if (ret) { -+ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -+ ret); -+ } -+ -+ return ret; -+} -+module_init(tas5713_modinit); -+ -+ -+static void __exit tas5713_exit(void) -+{ -+ i2c_del_driver(&tas5713_i2c_driver); -+} -+module_exit(tas5713_exit); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for TAS5713"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h -new file mode 100644 -index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8f612a342 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.h -@@ -0,0 +1,210 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#ifndef _TAS5713_H -+#define _TAS5713_H -+ -+ -+// TAS5713 I2C-bus register addresses -+ -+#define TAS5713_CLOCK_CTRL 0x00 -+#define TAS5713_DEVICE_ID 0x01 -+#define TAS5713_ERROR_STATUS 0x02 -+#define TAS5713_SYSTEM_CTRL1 0x03 -+#define TAS5713_SERIAL_DATA_INTERFACE 0x04 -+#define TAS5713_SYSTEM_CTRL2 0x05 -+#define TAS5713_SOFT_MUTE 0x06 -+#define TAS5713_VOL_MASTER 0x07 -+#define TAS5713_VOL_CH1 0x08 -+#define TAS5713_VOL_CH2 0x09 -+#define TAS5713_VOL_HEADPHONE 0x0A -+#define TAS5713_VOL_CONFIG 0x0E -+#define TAS5713_MODULATION_LIMIT 0x10 -+#define TAS5713_IC_DLY_CH1 0x11 -+#define TAS5713_IC_DLY_CH2 0x12 -+#define TAS5713_IC_DLY_CH3 0x13 -+#define TAS5713_IC_DLY_CH4 0x14 -+ -+#define TAS5713_START_STOP_PERIOD 0x1A -+#define TAS5713_OSC_TRIM 0x1B -+#define TAS5713_BKND_ERR 0x1C -+ -+#define TAS5713_INPUT_MUX 0x20 -+#define TAS5713_SRC_SELECT_CH4 0x21 -+#define TAS5713_PWM_MUX 0x25 -+ -+#define TAS5713_CH1_BQ0 0x29 -+#define TAS5713_CH1_BQ1 0x2A -+#define TAS5713_CH1_BQ2 0x2B -+#define TAS5713_CH1_BQ3 0x2C -+#define TAS5713_CH1_BQ4 0x2D -+#define TAS5713_CH1_BQ5 0x2E -+#define TAS5713_CH1_BQ6 0x2F -+#define TAS5713_CH1_BQ7 0x58 -+#define TAS5713_CH1_BQ8 0x59 -+ -+#define TAS5713_CH2_BQ0 0x30 -+#define TAS5713_CH2_BQ1 0x31 -+#define TAS5713_CH2_BQ2 0x32 -+#define TAS5713_CH2_BQ3 0x33 -+#define TAS5713_CH2_BQ4 0x34 -+#define TAS5713_CH2_BQ5 0x35 -+#define TAS5713_CH2_BQ6 0x36 -+#define TAS5713_CH2_BQ7 0x5C -+#define TAS5713_CH2_BQ8 0x5D -+ -+#define TAS5713_CH4_BQ0 0x5A -+#define TAS5713_CH4_BQ1 0x5B -+#define TAS5713_CH3_BQ0 0x5E -+#define TAS5713_CH3_BQ1 0x5F -+ -+#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B -+#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C -+#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E -+#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F -+#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 -+#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 -+#define TAS5713_DRC_CTRL 0x46 -+ -+#define TAS5713_BANK_SW_CTRL 0x50 -+#define TAS5713_CH1_OUTPUT_MIXER 0x51 -+#define TAS5713_CH2_OUTPUT_MIXER 0x52 -+#define TAS5713_CH1_INPUT_MIXER 0x53 -+#define TAS5713_CH2_INPUT_MIXER 0x54 -+#define TAS5713_OUTPUT_POST_SCALE 0x56 -+#define TAS5713_OUTPUT_PRESCALE 0x57 -+ -+#define TAS5713_IDF_POST_SCALE 0x62 -+ -+#define TAS5713_CH1_INLINE_MIXER 0x70 -+#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 -+#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 -+#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 -+#define TAS5713_CH2_INLINE_MIXER 0x74 -+#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 -+#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 -+#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 -+ -+#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 -+#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 -+ -+#define TAS5713_REGISTER_COUNT 0x46 -+#define TAS5713_MAX_REGISTER 0xF9 -+ -+ -+// Bitmasks for registers -+#define TAS5713_SOFT_MUTE_ALL 0x07 -+ -+ -+ -+struct tas5713_init_command { -+ const int size; -+ const char *const data; -+}; -+ -+static const struct tas5713_init_command tas5713_init_sequence[] = { -+ -+ // Trim oscillator -+ { .size = 2, .data = "\x1B\x00" }, -+ // System control register 1 (0x03): block DC -+ { .size = 2, .data = "\x03\x80" }, -+ // Mute everything -+ { .size = 2, .data = "\x05\x40" }, -+ // Modulation limit register (0x10): 97.7% -+ { .size = 2, .data = "\x10\x02" }, -+ // Interchannel delay registers -+ // (0x11, 0x12, 0x13, and 0x14): BD mode -+ { .size = 2, .data = "\x11\xB8" }, -+ { .size = 2, .data = "\x12\x60" }, -+ { .size = 2, .data = "\x13\xA0" }, -+ { .size = 2, .data = "\x14\x48" }, -+ // PWM shutdown group register (0x19): no shutdown -+ { .size = 2, .data = "\x19\x00" }, -+ // Input multiplexer register (0x20): BD mode -+ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -+ // PWM output mux register (0x25) -+ // Channel 1 --> OUTA, channel 1 neg --> OUTB -+ // Channel 2 --> OUTC, channel 2 neg --> OUTD -+ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -+ // DRC control (0x46): DRC off -+ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -+ // BKND_ERR register (0x1C): 299ms reset period -+ { .size = 2, .data = "\x1C\x07" }, -+ // Mute channel 3 -+ { .size = 2, .data = "\x0A\xFF" }, -+ // Volume configuration register (0x0E): volume slew 512 steps -+ { .size = 2, .data = "\x0E\x90" }, -+ // Clock control register (0x00): 44/48kHz, MCLK=64xfs -+ { .size = 2, .data = "\x00\x60" }, -+ // Bank switch and eq control (0x50): no bank switching -+ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -+ // Volume registers (0x07, 0x08, 0x09, 0x0A) -+ { .size = 2, .data = "\x07\x20" }, -+ { .size = 2, .data = "\x08\x30" }, -+ { .size = 2, .data = "\x09\x30" }, -+ { .size = 2, .data = "\x0A\xFF" }, -+ // 0x72, 0x73, 0x76, 0x77 input mixer: -+ // no intermix between channels -+ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -+ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -+ // no inline DRC inmix -+ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -+ // 0x56, 0x57 Output scale -+ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -+ // 0x3B, 0x3c -+ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ // 0x51, 0x52: output mixer -+ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ // PEQ defaults -+ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+}; -+ -+ -+#endif /* _TAS5713_H */ - -From 15550aafac107a499180a103bcaceed80f37dacd Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 9 Jan 2017 09:42:09 +0000 -Subject: [PATCH 117/122] hifiberry-amp: Adjust for ALSA object refactoring - -See: https://github.com/raspberrypi/linux/issues/1775 ---- - sound/soc/codecs/tas5713.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -index 9b2713861dcbed751842ca29c88eb1eae5867411..560234d58a6b0a6e7fd3a63e8de73339ee002b1c 100644 ---- a/sound/soc/codecs/tas5713.c -+++ b/sound/soc/codecs/tas5713.c -@@ -232,8 +232,10 @@ static int tas5713_probe(struct snd_soc_codec *codec) - static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { - .probe = tas5713_probe, - .remove = tas5713_remove, -- .controls = tas5713_snd_controls, -- .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+ .component_driver = { -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+ }, - }; - - - -From d3a7daff54ea1d57654aa2be744d6173441b5e35 Mon Sep 17 00:00:00 2001 -From: Giedrius Trainavicius -Date: Sun, 8 Jan 2017 15:58:54 +0200 -Subject: [PATCH 118/122] bcm2835-i2s: Changes for allowing asymmetric sample - formats. - -This is achieved by making changes only to the requested -stream direction format, keeping the other stream direction -configuration intact. - -Signed-off-by: Giedrius Trainavicius ---- - sound/soc/bcm/bcm2835-i2s.c | 54 +++++++++++++++++++++++++++++++-------------- - 1 file changed, 38 insertions(+), 16 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 6ba20498202ed36906b52096893a88867a79269f..171c2401dfe192740fca3356268aff6432f284ea 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -237,7 +237,9 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - unsigned int sampling_rate = params_rate(params); - unsigned int data_length, data_delay, bclk_ratio; - unsigned int ch1pos, ch2pos, mode, format; -+ unsigned int previous_ftxp, previous_frxp; - uint32_t csreg; -+ bool packed; - - /* - * If a stream is already enabled, -@@ -320,26 +322,46 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - return -EINVAL; - } - -- /* -- * Set format for both streams. -- * We cannot set another frame length -- * (and therefore word length) anyway, -- * so the format will be the same. -- */ -- regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format); -- regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format); -+ /* Set the format for the matching stream direction. */ -+ switch (substream->stream) { -+ case SNDRV_PCM_STREAM_PLAYBACK: -+ regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format); -+ break; -+ case SNDRV_PCM_STREAM_CAPTURE: -+ regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format); -+ break; -+ default: -+ return -EINVAL; -+ } - - /* Setup the I2S mode */ -+ /* Keep existing FTXP and FRXP values. */ -+ regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode); -+ -+ previous_ftxp = mode & BCM2835_I2S_FTXP; -+ previous_frxp = mode & BCM2835_I2S_FRXP; -+ - mode = 0; - -- if (data_length <= 16) { -- /* -- * Use frame packed mode (2 channels per 32 bit word) -- * We cannot set another frame length in the second stream -- * (and therefore word length) anyway, -- * so the format will be the same. -- */ -- mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP; -+ /* -+ * Retain the frame packed mode (2 channels per 32 bit word) -+ * of the other direction stream intact. The formats of each -+ * direction can be different as long as the frame length is -+ * shared for both. -+ */ -+ packed = data_length <= 16; -+ -+ switch (substream->stream) { -+ case SNDRV_PCM_STREAM_PLAYBACK: -+ mode |= previous_frxp; -+ mode |= packed ? BCM2835_I2S_FTXP : 0; -+ break; -+ case SNDRV_PCM_STREAM_CAPTURE: -+ mode |= previous_ftxp; -+ mode |= packed ? BCM2835_I2S_FRXP : 0; -+ break; -+ default: -+ return -EINVAL; - } - - mode |= BCM2835_I2S_FLEN(bclk_ratio - 1); - -From a268f59a304d04349f3a0358db1f434e47cda8b6 Mon Sep 17 00:00:00 2001 -From: Aaron Shaw -Date: Tue, 10 Jan 2017 16:05:41 +0000 -Subject: [PATCH 119/122] Add driver_name property - -Add driver name property for use with 5.1 passthrough audio in LibreElec and other Kodi based OSs ---- - sound/soc/bcm/justboom-dac.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c -index 8fd50dbe681508a2cfe8fdde1c9fedbe9a507fa7..05a224ec712d06b8b7587ab6b8bb562d19956d47 100644 ---- a/sound/soc/bcm/justboom-dac.c -+++ b/sound/soc/bcm/justboom-dac.c -@@ -98,6 +98,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_justboom_dac = { - .name = "snd_rpi_justboom_dac", -+ .driver_name = "JustBoomDac", - .owner = THIS_MODULE, - .dai_link = snd_rpi_justboom_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), - -From ad475b3f75da457818fa6fab1c1e2f89f453dc07 Mon Sep 17 00:00:00 2001 -From: Aaron Shaw -Date: Tue, 10 Jan 2017 16:11:04 +0000 -Subject: [PATCH 120/122] Add driver_name paramater - -Add driver_name parameter for use with 5.1 passthrough audio in LibreElec and other Kodi OSs ---- - sound/soc/bcm/justboom-digi.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c -index 91acb666380faa3c0deb2230f8a0f8bbec59417b..abfdc5c4dd5811e6847bddda4921abe33fa02812 100644 ---- a/sound/soc/bcm/justboom-digi.c -+++ b/sound/soc/bcm/justboom-digi.c -@@ -154,6 +154,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_justboom_digi = { - .name = "snd_rpi_justboom_digi", -+ .driver_name = "JustBoomDigi", - .owner = THIS_MODULE, - .dai_link = snd_rpi_justboom_digi_dai, - .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), - -From 987aadab51987bac29470f3ee200fa8bfa2eae6b Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 11 Jan 2017 13:01:21 +0000 -Subject: [PATCH 121/122] BCM270X_DT: Add pi3-disable-wifi overlay - -pi3-disable-wifi is a minimal overlay to disable the onboard WiFi. - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 6 ++++++ - arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts | 13 +++++++++++++ - 3 files changed, 20 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 11dba31712840a9e4b91acd4565c2d6266315273..f1191c1ded82490be5f793ab6483bc5af5891db2 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -51,6 +51,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - mz61581.dtbo \ - pi3-act-led.dtbo \ - pi3-disable-bt.dtbo \ -+ pi3-disable-wifi.dtbo \ - pi3-miniuart-bt.dtbo \ - piscreen.dtbo \ - piscreen2r.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index e8fa4ccb44c34a20485c4e6155467af99179153a..34109c69416c1caf28910895320a2b9cd539588e 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -800,6 +800,12 @@ Load: dtoverlay=pi3-disable-bt - Params: - - -+Name: pi3-disable-wifi -+Info: Disable Pi3 onboard WiFi -+Load: dtoverlay=pi3-disable-wifi -+Params: -+ -+ - Name: pi3-miniuart-bt - Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore - UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum -diff --git a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..017199554bf2f4e381efcc7bb71e750c210343e0 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts -@@ -0,0 +1,13 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&mmc>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+}; - -From 5c94b3839b261c3c73893677ab6e2355a1177b74 Mon Sep 17 00:00:00 2001 -From: Electron752 -Date: Thu, 12 Jan 2017 07:07:08 -0800 -Subject: [PATCH 122/122] ARM64: Make it work again on 4.9 (#1790) - -* Invoke the dtc compiler with the same options used in arm mode. -* ARM64 now uses the bcm2835 platform just like ARM32. -* ARM64: Update bcmrpi3_defconfig - -Signed-off-by: Michael Zoran ---- - arch/arm64/Kconfig.platforms | 22 ------ - arch/arm64/boot/dts/broadcom/Makefile | 10 ++- - arch/arm64/boot/dts/overlays | 1 + - arch/arm64/configs/bcmrpi3_defconfig | 126 ++++++++++------------------------ - 4 files changed, 48 insertions(+), 111 deletions(-) - create mode 120000 arch/arm64/boot/dts/overlays - -diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms -index 7d213c2c904271c7a4622b83cd55a750d237bc2e..101794f5ce1008b7ff007fbfc7fa23d9e63bae67 100644 ---- a/arch/arm64/Kconfig.platforms -+++ b/arch/arm64/Kconfig.platforms -@@ -1,27 +1,5 @@ - menu "Platform selection" - --config MACH_BCM2709 -- bool -- --config ARCH_BCM2709 -- bool "Broadcom BCM2709 family" -- select MACH_BCM2709 -- select HAVE_SMP -- select ARM_AMBA -- select COMMON_CLK -- select ARCH_HAS_CPUFREQ -- select GENERIC_CLOCKEVENTS -- select MULTI_IRQ_HANDLER -- select SPARSE_IRQ -- select MFD_SYSCON -- select VC4 -- select USE_OF -- select ARCH_REQUIRE_GPIOLIB -- select PINCTRL -- select PINCTRL_BCM2835 -- help -- This enables support for Broadcom BCM2709 boards. -- - config ARCH_SUNXI - bool "Allwinner sunxi 64-bit SoC Family" - select GENERIC_IRQ_CHIP -diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index 2152448c8cf5b22c573642d7ce45e85793f5fc9a..7aa03be73fda08d555a13323f483e9b95398f234 100644 ---- a/arch/arm64/boot/dts/broadcom/Makefile -+++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -1,7 +1,15 @@ -+# Enable fixups to support overlays on BCM2835 platforms -+ -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+DTC_FLAGS ?= -@ -H epapr -+endif -+ - dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb - dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb - dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb --dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb -+dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb -+ -+dts-dirs += ../overlays - - always := $(dtb-y) - subdir-y := $(dts-dirs) -diff --git a/arch/arm64/boot/dts/overlays b/arch/arm64/boot/dts/overlays -new file mode 120000 -index 0000000000000000000000000000000000000000..ded08646b6f66cdf734f8bf9c1be3a2e3a7103d7 ---- /dev/null -+++ b/arch/arm64/boot/dts/overlays -@@ -0,0 +1 @@ -+../../../arm/boot/dts/overlays -\ No newline at end of file -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -index 53da5c7a33e5898a66e549fb0c39fe3da555ca87..c7e891d72969a388d9b135a36dbfc9c9cb609bf8 100644 ---- a/arch/arm64/configs/bcmrpi3_defconfig -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -1,52 +1,9 @@ --# CONFIG_ARM_PATCH_PHYS_VIRT is not set --CONFIG_PHYS_OFFSET=0 - CONFIG_LOCALVERSION="-v8" - # CONFIG_LOCALVERSION_AUTO is not set --CONFIG_64BIT=y - CONFIG_SYSVIPC=y - CONFIG_POSIX_MQUEUE=y - CONFIG_NO_HZ=y - CONFIG_HIGH_RES_TIMERS=y -- --# --# ARM errata workarounds via the alternatives framework --# --CONFIG_ARM64_ERRATUM_826319=n --CONFIG_ARM64_ERRATUM_827319=n --CONFIG_ARM64_ERRATUM_824069=n --CONFIG_ARM64_ERRATUM_819472=n --CONFIG_ARM64_ERRATUM_832075=n --CONFIG_ARM64_ERRATUM_845719=n --CONFIG_ARM64_ERRATUM_843419=n --CONFIG_CAVIUM_ERRATUM_22375=n --CONFIG_CAVIUM_ERRATUM_23154=n --CONFIG_CAVIUM_ERRATUM_27456=n --CONFIG_ARM64_4K_PAGES=y --CONFIG_ARM64_VA_BITS_39=y --CONFIG_ARM64_VA_BITS=39 --CONFIG_SCHED_MC=y --CONFIG_NR_CPUS=4 --CONFIG_HOTPLUG_CPU=y --CONFIG_ARMV8_DEPRECATED=y --CONFIG_SWP_EMULATION=y --CONFIG_CP15_BARRIER_EMULATION=y --CONFIG_SETEND_EMULATION=y -- --# --# ARMv8.1 architectural features --# --CONFIG_ARM64_HW_AFDBM=y --CONFIG_ARM64_PAN=y --CONFIG_ARM64_LSE_ATOMICS=y --CONFIG_ARM64_VHE=y -- --# --# ARMv8.2 architectural features --# --CONFIG_ARM64_UAO=y --CONFIG_ARM64_MODULE_CMODEL_LARGE=n --CONFIG_RANDOMIZE_BASE=n -- - CONFIG_BSD_PROCESS_ACCT=y - CONFIG_BSD_PROCESS_ACCT_V3=y - CONFIG_TASKSTATS=y -@@ -55,7 +12,6 @@ CONFIG_TASK_XACCT=y - CONFIG_TASK_IO_ACCOUNTING=y - CONFIG_IKCONFIG=m - CONFIG_IKCONFIG_PROC=y --CONFIG_NMI_LOG_BUF_SHIFT=12 - CONFIG_MEMCG=y - CONFIG_BLK_CGROUP=y - CONFIG_CGROUP_FREEZER=y -@@ -69,54 +25,49 @@ CONFIG_BLK_DEV_INITRD=y - CONFIG_EMBEDDED=y - # CONFIG_COMPAT_BRK is not set - CONFIG_PROFILING=y --CONFIG_OPROFILE=m - CONFIG_KPROBES=y - CONFIG_JUMP_LABEL=y - CONFIG_MODULES=y - CONFIG_MODULE_UNLOAD=y - CONFIG_MODVERSIONS=y - CONFIG_MODULE_SRCVERSION_ALL=y --CONFIG_TRIM_UNUSED_KSYMS=y - CONFIG_BLK_DEV_THROTTLING=y - CONFIG_PARTITION_ADVANCED=y - CONFIG_MAC_PARTITION=y - CONFIG_CFQ_GROUP_IOSCHED=y --CONFIG_ARCH_BCM2709=y --# CONFIG_CACHE_L2X0 is not set --CONFIG_SMP=y --CONFIG_HAVE_ARM_ARCH_TIMER=y --CONFIG_VMSPLIT_2G=y --CONFIG_PREEMPT_VOLUNTARY=y --CONFIG_AEABI=y --CONFIG_OABI_COMPAT=y --# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_ARCH_BCM2835=y -+# CONFIG_CAVIUM_ERRATUM_22375 is not set -+# CONFIG_CAVIUM_ERRATUM_23154 is not set -+# CONFIG_CAVIUM_ERRATUM_27456 is not set -+CONFIG_SCHED_MC=y -+CONFIG_NR_CPUS=4 -+CONFIG_PREEMPT=y -+CONFIG_HZ_1000=y - CONFIG_CLEANCACHE=y - CONFIG_FRONTSWAP=y - CONFIG_CMA=y - CONFIG_ZSMALLOC=m - CONFIG_PGTABLE_MAPPING=y --CONFIG_UACCESS_WITH_MEMCPY=y - CONFIG_SECCOMP=y --# CONFIG_ATAGS is not set --CONFIG_ZBOOT_ROM_TEXT=0x0 --CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_ARMV8_DEPRECATED=y -+CONFIG_SWP_EMULATION=y -+CONFIG_CP15_BARRIER_EMULATION=y -+CONFIG_SETEND_EMULATION=y - CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_BINFMT_MISC=y -+CONFIG_COMPAT=y -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_CPU_IDLE=y -+CONFIG_ARM_CPUIDLE=y - CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=y - CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y - CONFIG_CPU_FREQ_GOV_PERFORMANCE=y - CONFIG_CPU_FREQ_GOV_USERSPACE=y - CONFIG_CPU_FREQ_GOV_ONDEMAND=y - CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y - CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y --CONFIG_VFP=y --CONFIG_NEON=y --CONFIG_KERNEL_MODE_NEON=y --CONFIG_BINFMT_MISC=m --CONFIG_COMPAT=y --CONFIG_SYSVIPC_COMPAT=y -- --# CONFIG_SUSPEND is not set --CONFIG_PM=y - CONFIG_NET=y - CONFIG_PACKET=y - CONFIG_UNIX=y -@@ -437,6 +388,7 @@ CONFIG_BT_MRVL=m - CONFIG_BT_MRVL_SDIO=m - CONFIG_BT_ATH3K=m - CONFIG_BT_WILINK=m -+CONFIG_CFG80211=m - CONFIG_MAC80211=m - CONFIG_MAC80211_MESH=y - CONFIG_WIMAX=m -@@ -490,7 +442,6 @@ CONFIG_BONDING=m - CONFIG_DUMMY=m - CONFIG_IFB=m - CONFIG_MACVLAN=m --CONFIG_IPVLAN=m - CONFIG_VXLAN=m - CONFIG_NETCONSOLE=m - CONFIG_TUN=m -@@ -579,8 +530,6 @@ CONFIG_RT2800USB_RT3573=y - CONFIG_RT2800USB_RT53XX=y - CONFIG_RT2800USB_RT55XX=y - CONFIG_RT2800USB_UNKNOWN=y --CONFIG_RTL8187=m --CONFIG_RTL8192CU=n - CONFIG_USB_ZD1201=m - CONFIG_ZD1211RW=m - CONFIG_MAC80211_HWSIM=m -@@ -606,7 +555,7 @@ CONFIG_JOYSTICK_RPISENSE=m - CONFIG_INPUT_TOUCHSCREEN=y - CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m --CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_EKTF2127=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m - CONFIG_TOUCHSCREEN_USB_COMPOSITE=m - CONFIG_TOUCHSCREEN_STMPE=m -@@ -626,10 +575,8 @@ CONFIG_SERIO_RAW=m - CONFIG_GAMEPORT=m - CONFIG_GAMEPORT_NS558=m - CONFIG_GAMEPORT_L4=m --CONFIG_BRCM_CHAR_DRIVERS=n --CONFIG_BCM_VC_CMA=n --CONFIG_BCM_VCIO=n --CONFIG_BCM_VC_SM=n -+# CONFIG_BCM2835_DEVGPIOMEM is not set -+# CONFIG_BCM2835_SMI_DEV is not set - # CONFIG_LEGACY_PTYS is not set - # CONFIG_DEVKMEM is not set - CONFIG_SERIAL_8250=y -@@ -638,6 +585,9 @@ CONFIG_SERIAL_8250_CONSOLE=y - # CONFIG_SERIAL_8250_DMA is not set - CONFIG_SERIAL_8250_NR_UARTS=1 - CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_8250_EXTENDED=y -+CONFIG_SERIAL_8250_SHARE_IRQ=y -+CONFIG_SERIAL_8250_BCM2835AUX=y - CONFIG_SERIAL_OF_PLATFORM=y - CONFIG_SERIAL_AMBA_PL011=y - CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -@@ -650,6 +600,7 @@ CONFIG_I2C=y - CONFIG_I2C_CHARDEV=m - CONFIG_I2C_MUX_PCA954x=m - CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m - CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m -@@ -681,13 +632,13 @@ CONFIG_W1_SLAVE_DS2780=m - CONFIG_W1_SLAVE_DS2781=m - CONFIG_W1_SLAVE_DS28E04=m - CONFIG_W1_SLAVE_BQ27000=m --CONFIG_BATTERY_DS2760=m --CONFIG_POWER_RESET=y - CONFIG_POWER_RESET_GPIO=y -+CONFIG_BATTERY_DS2760=m - CONFIG_HWMON=m - CONFIG_SENSORS_LM75=m - CONFIG_SENSORS_SHT21=m - CONFIG_SENSORS_SHTC1=m -+CONFIG_SENSORS_INA2XX=m - CONFIG_THERMAL=y - CONFIG_THERMAL_BCM2835=y - CONFIG_WATCHDOG=y -@@ -835,8 +786,6 @@ CONFIG_VIDEO_EM28XX_V4L2=m - CONFIG_VIDEO_EM28XX_ALSA=m - CONFIG_VIDEO_EM28XX_DVB=m - CONFIG_V4L_PLATFORM_DRIVERS=y --CONFIG_VIDEO_BCM2835=n --CONFIG_VIDEO_BCM2835_MMAL=n - CONFIG_RADIO_SI470X=y - CONFIG_USB_SI470X=m - CONFIG_I2C_SI470X=m -@@ -892,8 +841,6 @@ CONFIG_SND_VIRMIDI=m - CONFIG_SND_MTPAV=m - CONFIG_SND_SERIAL_U16550=m - CONFIG_SND_MPU401=m --CONFIG_SND_ARM=n --CONFIG_SND_BCM2835=n - CONFIG_SND_USB_AUDIO=m - CONFIG_SND_USB_UA101=m - CONFIG_SND_USB_CAIAQ=m -@@ -916,7 +863,10 @@ CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m - CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m - CONFIG_SND_DIGIDAC1_SOUNDCARD=m - CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -+CONFIG_SND_PISOUND=m - CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_AK4554=m - CONFIG_SND_SOC_WM8804_I2C=m - CONFIG_SND_SIMPLE_CARD=m - CONFIG_SOUND_PRIME=m -@@ -979,8 +929,6 @@ CONFIG_USB_HIDDEV=y - CONFIG_USB=y - CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - CONFIG_USB_MON=m --CONFIG_USB_DWCOTG=n --CONFIG_USB_DWC2=y - CONFIG_USB_PRINTER=m - CONFIG_USB_STORAGE=y - CONFIG_USB_STORAGE_REALTEK=m -@@ -1001,6 +949,7 @@ CONFIG_USB_MICROTEK=m - CONFIG_USBIP_CORE=m - CONFIG_USBIP_VHCI_HCD=m - CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=y - CONFIG_USB_SERIAL=m - CONFIG_USB_SERIAL_GENERIC=y - CONFIG_USB_SERIAL_AIRCABLE=m -@@ -1096,6 +1045,7 @@ CONFIG_LEDS_TRIGGER_INPUT=y - CONFIG_LEDS_TRIGGER_PANIC=y - CONFIG_RTC_CLASS=y - # CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_ABX80X=m - CONFIG_RTC_DRV_DS1307=m - CONFIG_RTC_DRV_DS1374=m - CONFIG_RTC_DRV_DS1672=m -@@ -1103,7 +1053,6 @@ CONFIG_RTC_DRV_MAX6900=m - CONFIG_RTC_DRV_RS5C372=m - CONFIG_RTC_DRV_ISL1208=m - CONFIG_RTC_DRV_ISL12022=m --CONFIG_RTC_DRV_ISL12057=m - CONFIG_RTC_DRV_X1205=m - CONFIG_RTC_DRV_PCF8523=m - CONFIG_RTC_DRV_PCF8563=m -@@ -1137,7 +1086,6 @@ CONFIG_STAGING=y - CONFIG_PRISM2_USB=m - CONFIG_R8712U=m - CONFIG_R8188EU=m --CONFIG_R8723AU=m - CONFIG_VT6656=m - CONFIG_SPEAKUP=m - CONFIG_SPEAKUP_SYNTH_SOFT=m -@@ -1153,6 +1101,7 @@ CONFIG_FB_TFT_BD663474=m - CONFIG_FB_TFT_HX8340BN=m - CONFIG_FB_TFT_HX8347D=m - CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_HX8357D=m - CONFIG_FB_TFT_ILI9163=m - CONFIG_FB_TFT_ILI9320=m - CONFIG_FB_TFT_ILI9325=m -@@ -1176,6 +1125,7 @@ CONFIG_FB_TFT_UPD161704=m - CONFIG_FB_TFT_WATTEROTT=m - CONFIG_FB_FLEX=m - CONFIG_FB_TFT_FBTFT_DEVICE=m -+# CONFIG_BCM2708_VCHIQ is not set - CONFIG_MAILBOX=y - CONFIG_BCM2835_MBOX=y - # CONFIG_IOMMU_SUPPORT is not set -@@ -1189,6 +1139,7 @@ CONFIG_IIO_KFIFO_BUF=m - CONFIG_MCP320X=m - CONFIG_MCP3422=m - CONFIG_DHT11=m -+CONFIG_HTU21=m - CONFIG_PWM_BCM2835=m - CONFIG_PWM_PCA9685=m - CONFIG_RASPBERRYPI_FIRMWARE=y -@@ -1309,6 +1260,7 @@ CONFIG_BOOT_PRINTK_DELAY=y - CONFIG_DEBUG_MEMORY_INIT=y - CONFIG_DETECT_HUNG_TASK=y - CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y - CONFIG_IRQSOFF_TRACER=y - CONFIG_SCHED_TRACER=y - CONFIG_STACK_TRACER=y -@@ -1331,5 +1283,3 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m - CONFIG_ARM64_CRYPTO=y - CONFIG_CRC_ITU_T=y - CONFIG_LIBCRC32C=y --CONFIG_BCM2708_VCHIQ=n --CONFIG_ARCH_BCM2835=y diff --git a/projects/RPi/patches/plexht/plexht-0001-RasPlex.patch b/projects/RPi/patches/plexht/plexht-0001-RasPlex.patch new file mode 100644 index 0000000000..0dc581d011 --- /dev/null +++ b/projects/RPi/patches/plexht/plexht-0001-RasPlex.patch @@ -0,0 +1,60 @@ +From f1e8e10b7cfba5a9241637749e855d0024c8c6d8 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 19 Feb 2017 23:42:45 +0100 +Subject: [PATCH] RasPlex + +--- + addons/skin.plex/language/English/strings.po | 2 +- + plex/Resources/system/peripherals.xml | 12 +++++------- + 2 files changed, 6 insertions(+), 8 deletions(-) + +diff --git a/addons/skin.plex/language/English/strings.po b/addons/skin.plex/language/English/strings.po +index 4ef852d290..7aa14ea4b8 100644 +--- a/addons/skin.plex/language/English/strings.po ++++ b/addons/skin.plex/language/English/strings.po +@@ -1055,7 +1055,7 @@ msgid "Show all media flags in details view" + msgstr "" + + msgctxt "#32118" +-msgid "Hide Quit and Shut Down from Home menu" ++msgid "Hide Shut Down from Home menu" + msgstr "" + + msgctxt "#32119" +diff --git a/plex/Resources/system/peripherals.xml b/plex/Resources/system/peripherals.xml +index aad95c524d..cae19b8cb5 100644 +--- a/plex/Resources/system/peripherals.xml ++++ b/plex/Resources/system/peripherals.xml +@@ -2,11 +2,9 @@ + + + +- +- +- +- +- ++ ++ ++ + + + +@@ -17,7 +15,7 @@ + + + +- ++ + + + +@@ -28,7 +26,7 @@ + + + +- ++ + + + diff --git a/projects/RPi/plexht/advancedsettings.xml b/projects/RPi/plexht/advancedsettings.xml new file mode 100644 index 0000000000..47b2743387 --- /dev/null +++ b/projects/RPi/plexht/advancedsettings.xml @@ -0,0 +1,29 @@ + + + false + 1 + + 720 + 540 + false + + + + + 30 + + + + 30242880 + 30 + 4.0 + + + + 3 + 0 + + + diff --git a/projects/RPi2/config/config.txt b/projects/RPi2/config/config.txt new file mode 100644 index 0000000000..07acd7d2c7 --- /dev/null +++ b/projects/RPi2/config/config.txt @@ -0,0 +1,103 @@ +################################################################################ +# This file is part of LibreELEC - http://www.libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ +# Bootloader configuration - config.txt +################################################################################ + +################################################################################ +# Memory (System/GPU configuration ) +################################################################################ + +# Default GPU memory split (do not change if you do not know what you are doing) + gpu_mem=200 + +# Configure GPU memory based on SDRAM size - overrides above setting + gpu_mem_256=112 + gpu_mem_512=200 + gpu_mem_1024=256 + +################################################################################ +# For overclocking and various other settings, see: +# https://www.raspberrypi.org/documentation/configuration/config-txt.md +################################################################################ +# Set 'force_turbo=1' to disable dynamic overclocking and enable overclocking always. +force_turbo=0 + +# Make display smaller to stop text spilling off the screen +# +# Note that the overscan settings only affect the splash screen and not Kodi. +# +# If you experience overscan/underscan issues the best solution is to adjust +# your TV settings ("full pixel", "1-1 pixel" etc.). Alternatively, there is a +# calibration menu in the Kodi GUI. +# disable_overscan=1 + +# Adapt overscan values to your needs +# overscan_left=57 +# overscan_right=59 +# overscan_top=20 +# overscan_bottom=20 + +# Uncomment for DVI monitor +# hdmi_drive=1 + +# Force HDMI even if unplugged or powered off +hdmi_force_hotplug=1 + +# Doesn't sent initial active source message. +# Avoids bringing CEC (enabled TV) out of standby and channel switch when +# rebooting. +# hdmi_ignore_cec_init=1 + +################################################################################ +# License keys to enable GPU hardware decoding for various codecs +# to obtain keys visit the shop at http://www.raspberrypi.com +################################################################################ + +# decode_MPG2=0x00000000 +# decode_WVC1=0x00000000 + +################################################################################ +# +# >>>>>>>> RasPlex default settings override <<<<<<<<< +# +################################################################################ + +# Required overlay for LIRC to function + dtoverlay=lirc-rpi + +# Required for hyperion / lightberry + dtparam=spi=on + +# Uncomment to enable the sdhost driver +# dtoverlay=sdhost + +# Uncomment to enable HiFiBerry overlay +# NOTE: You must disable the lirc-rpi overlay (or change lirc GPIO pin) for HiFiBerry to work correctly +# dtoverlay=hifiberry-amp +# dtoverlay=hifiberry-dacplus +# dtoverlay=hifiberry-digi + +################################################################################ +# End of default configuration +################################################################################ + +################################################################################ +# Include distribution specific config file if it exists. +################################################################################ +[all] +include distroconfig.txt diff --git a/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service b/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 196e8c4a97..0000000000 --- a/projects/RPi2/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/console -DefaultDependencies=no -ConditionKernelCommandLine=console - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/console -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/RPi2/filesystem/usr/share/alsa/cards/HifiberryDigi.conf b/projects/RPi2/filesystem/usr/share/alsa/cards/HifiberryDigi.conf deleted file mode 100644 index a277314988..0000000000 --- a/projects/RPi2/filesystem/usr/share/alsa/cards/HifiberryDigi.conf +++ /dev/null @@ -1,24 +0,0 @@ - -HifiberryDigi.pcm.iec958.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string - } - @args.AES0 { - type integer - } - @args.AES1 { - type integer - } - @args.AES2 { - type integer - } - @args.AES3 { - type integer - } - type hooks - slave.pcm { - type hw - card $CARD - } -} diff --git a/projects/RPi2/filesystem/usr/share/alsa/cards/JustBoomDigi.conf b/projects/RPi2/filesystem/usr/share/alsa/cards/JustBoomDigi.conf deleted file mode 100644 index f598c680b2..0000000000 --- a/projects/RPi2/filesystem/usr/share/alsa/cards/JustBoomDigi.conf +++ /dev/null @@ -1,24 +0,0 @@ - -JustBoomDigi.pcm.iec958.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { - type string - } - @args.AES0 { - type integer - } - @args.AES1 { - type integer - } - @args.AES2 { - type integer - } - @args.AES3 { - type integer - } - type hooks - slave.pcm { - type hw - card $CARD - } -} diff --git a/projects/RPi2/initramfs/platform_init b/projects/RPi2/initramfs/platform_init deleted file mode 100755 index e3e2e7d50a..0000000000 --- a/projects/RPi2/initramfs/platform_init +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -# Enable io_is_busy for improved sdhost performance - essentially, equivalent of force_turbo=1 but for mmc -echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy - -# Configure frequency scaling properties - should improve performance a little (turbo, in most cases) -echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor -echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold -echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate -echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor diff --git a/projects/RPi2/kodi/advancedsettings.xml b/projects/RPi2/kodi/advancedsettings.xml deleted file mode 100644 index ad35244823..0000000000 --- a/projects/RPi2/kodi/advancedsettings.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - false - - 720 - 540 - - - 30 - - diff --git a/projects/RPi2/linux/linux.arm.conf b/projects/RPi2/linux/linux.arm.conf deleted file mode 100644 index 62373a11df..0000000000 --- a/projects/RPi2/linux/linux.arm.conf +++ /dev/null @@ -1,4276 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm 4.9.1 Kernel Configuration -# -CONFIG_ARM=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_FIQ=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_GENERIC_BUG=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_XZ is not set -# CONFIG_KERNEL_LZO is not set -# CONFIG_KERNEL_LZ4 is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_FHANDLE=y -# CONFIG_USELIB is not set -# CONFIG_AUDIT is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -CONFIG_HANDLE_DOMAIN_IRQ=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_RCU_EXPERT is not set -CONFIG_SRCU=y -# CONFIG_TASKS_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_BUILD_BIN2C=y -CONFIG_IKCONFIG=m -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -CONFIG_NMI_LOG_BUF_SHIFT=13 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -CONFIG_PAGE_COUNTER=y -CONFIG_MEMCG=y -# CONFIG_MEMCG_SWAP is not set -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -CONFIG_CGROUP_WRITEBACK=y -CONFIG_CGROUP_SCHED=y -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_RT_GROUP_SCHED is not set -# CONFIG_CGROUP_PIDS is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_CPUACCT=y -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -# CONFIG_USER_NS is not set -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SYSFS_DEPRECATED is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_LZ4 is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_BPF=y -CONFIG_EXPERT=y -# CONFIG_UID16 is not set -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SYSFS_SYSCALL is not set -CONFIG_SYSCTL_SYSCALL=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set -CONFIG_KALLSYMS_BASE_RELATIVE=y -CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -# CONFIG_BPF_SYSCALL is not set -CONFIG_SHMEM=y -# CONFIG_AIO is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_USERFAULTFD is not set -CONFIG_MEMBARRIER=y -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -# CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -# CONFIG_SLAB_FREELIST_RANDOM is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -# CONFIG_PROFILING is not set -CONFIG_HAVE_OPROFILE=y -# CONFIG_KPROBES is not set -CONFIG_JUMP_LABEL=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -# CONFIG_UPROBES is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_NMI=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_GCC_PLUGINS=y -# CONFIG_GCC_PLUGINS is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_BITS_MAX=15 -CONFIG_ARCH_MMAP_RND_BITS=8 -# CONFIG_HAVE_ARCH_HASH is not set -# CONFIG_ISA_BUS_API is not set -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OLD_SIGACTION=y -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -# CONFIG_HAVE_ARCH_VMAP_STACK is not set - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_BLOCK=y -CONFIG_LBDAF=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -# CONFIG_DEFAULT_DEADLINE is not set -# CONFIG_DEFAULT_CFQ is not set -CONFIG_DEFAULT_NOOP=y -CONFIG_DEFAULT_IOSCHED="noop" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# System Type -# -CONFIG_MMU=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_OMAP1 is not set - -# -# Multiple platform selection -# - -# -# CPU Core family selection -# -# CONFIG_ARCH_MULTI_V6 is not set -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_MULTI_V6_V7=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_ALPINE is not set -# CONFIG_ARCH_ARTPEC is not set -# CONFIG_ARCH_AT91 is not set -CONFIG_ARCH_BCM=y - -# -# IPROC architected SoCs -# -# CONFIG_ARCH_BCM_CYGNUS is not set -# CONFIG_ARCH_BCM_NSP is not set -# CONFIG_ARCH_BCM_5301X is not set - -# -# KONA architected SoCs -# -# CONFIG_ARCH_BCM_281XX is not set -# CONFIG_ARCH_BCM_21664 is not set -# CONFIG_ARCH_BCM_23550 is not set - -# -# Other Architectures -# -CONFIG_ARCH_BCM2835=y -# CONFIG_ARCH_BCM_53573 is not set -# CONFIG_ARCH_BCM_63XX is not set -# CONFIG_ARCH_BRCMSTB is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_DIGICOLOR is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_KEYSTONE is not set -# CONFIG_ARCH_MESON is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_MEDIATEK is not set - -# -# TI OMAP/AM/DM/DRA Family -# -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_PLAT_SPEAR is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_EXYNOS is not set -# CONFIG_ARCH_RENESAS is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_TANGO is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_UNIPHIER is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_ZX is not set -# CONFIG_ARCH_ZYNQ is not set - -# -# Processor Type -# -CONFIG_CPU_V7=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y - -# -# Processor Features -# -# CONFIG_ARM_LPAE is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARM_THUMB=y -# CONFIG_ARM_THUMBEE is not set -CONFIG_ARM_VIRT_EXT=y -CONFIG_SWP_EMULATE=y -# CONFIG_CPU_ICACHE_DISABLE is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_KUSER_HELPERS=y -CONFIG_VDSO=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -# CONFIG_CACHE_L2X0 is not set -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -CONFIG_DEBUG_RODATA=y -CONFIG_DEBUG_ALIGN_RODATA=y -CONFIG_MULTI_IRQ_HANDLER=y -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_643719 is not set -# CONFIG_ARM_ERRATA_720789 is not set -# CONFIG_ARM_ERRATA_754322 is not set -# CONFIG_ARM_ERRATA_754327 is not set -# CONFIG_ARM_ERRATA_764369 is not set -# CONFIG_ARM_ERRATA_775420 is not set -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_ERRATA_773022 is not set -# CONFIG_ARM_ERRATA_818325_852422 is not set -# CONFIG_ARM_ERRATA_821420 is not set -# CONFIG_ARM_ERRATA_825619 is not set -# CONFIG_ARM_ERRATA_852421 is not set -# CONFIG_ARM_ERRATA_852423 is not set - -# -# Bus support -# -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS_GENERIC is not set -# CONFIG_PCI_SYSCALL is not set -# CONFIG_PCCARD is not set - -# -# Kernel Features -# -CONFIG_HAVE_SMP=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_ARM_CPU_TOPOLOGY=y -# CONFIG_SCHED_MC is not set -# CONFIG_SCHED_SMT is not set -CONFIG_HAVE_ARM_ARCH_TIMER=y -# CONFIG_MCPM is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_VMSPLIT_3G is not set -# CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VMSPLIT_2G=y -# CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0x80000000 -CONFIG_NR_CPUS=4 -# CONFIG_HOTPLUG_CPU is not set -# CONFIG_ARM_PSCI is not set -CONFIG_ARCH_NR_GPIO=0 -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -CONFIG_HZ_FIXED=0 -# CONFIG_HZ_100 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_250 is not set -CONFIG_HZ_300=y -# CONFIG_HZ_500 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=300 -CONFIG_SCHED_HRTICK=y -# CONFIG_THUMB2_KERNEL is not set -CONFIG_ARM_PATCH_IDIV=y -CONFIG_AEABI=y -# CONFIG_OABI_COMPAT is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -CONFIG_HAVE_ARCH_PFN_VALID=y -# CONFIG_HIGHMEM is not set -# CONFIG_CPU_SW_DOMAIN_PAN is not set -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -# CONFIG_ARM_MODULE_PLTS is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -# CONFIG_PHYS_ADDR_T_64BIT is not set -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_CLEANCACHE=y -CONFIG_FRONTSWAP=y -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZSWAP is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -# CONFIG_ZSMALLOC is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_ALIGNMENT_TRAP=y -CONFIG_UACCESS_WITH_MEMCPY=y -# CONFIG_SECCOMP is not set -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -# CONFIG_PARAVIRT is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set -# CONFIG_XEN is not set - -# -# Boot options -# -CONFIG_USE_OF=y -CONFIG_ATAGS=y -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -# CONFIG_ARM_APPENDED_DTB is not set -CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init BOOT_IMAGE=/kernel.img usbcore.autosuspend=-1" -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_CMDLINE_EXTEND=y -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_CRASH_DUMP is not set -CONFIG_AUTO_ZRELADDR=y -# CONFIG_EFI is not set - -# -# CPU Power Management -# - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set - -# -# CPU frequency scaling drivers -# -# CONFIG_CPUFREQ_DT is not set -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_ARM_BCM2835_CPUFREQ=y -# CONFIG_QORIQ_CPUFREQ is not set - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y - -# -# ARM CPU Idle Drivers -# -# CONFIG_ARM_CPUIDLE is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_NEON=y -CONFIG_KERNEL_MODE_NEON=y - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_ELFCORE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_BINFMT_FLAT is not set -# CONFIG_HAVE_AOUT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y - -# -# Power management options -# -# CONFIG_SUSPEND is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -# CONFIG_APM_EMULATION is not set -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -# CONFIG_ARM_CPU_SUSPEND is not set -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_NET_UDP_TUNNEL is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NET_PTP_CLASSIFY is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=m - -# -# Core Netfilter Configuration -# -# CONFIG_NETFILTER_INGRESS is not set -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_NAT_REDIRECT is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -CONFIG_NETFILTER_XT_NAT=m -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -# CONFIG_NF_DUP_IPV4 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -CONFIG_NF_REJECT_IPV4=m -CONFIG_NF_NAT_IPV4=m -CONFIG_NF_NAT_MASQUERADE_IPV4=m -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -# CONFIG_NF_DUP_IPV6 is not set -CONFIG_NF_REJECT_IPV6=m -# CONFIG_NF_LOG_IPV6 is not set -CONFIG_NF_NAT_IPV6=m -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_RAW is not set -CONFIG_IP6_NF_NAT=m -# CONFIG_IP6_NF_TARGET_MASQUERADE is not set -# CONFIG_IP6_NF_TARGET_NPT is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_MPLS is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_NET_NCSI is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -# CONFIG_SOCK_CGROUP_DATA is not set -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_BREDR=y -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=m -CONFIG_BT_HS=y -CONFIG_BT_LE=y -# CONFIG_BT_LEDS is not set -# CONFIG_BT_SELFTEST is not set -# CONFIG_BT_DEBUGFS is not set - -# -# Bluetooth device drivers -# -CONFIG_BT_INTEL=m -CONFIG_BT_BCM=m -CONFIG_BT_RTL=m -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTUSB_BCM=y -CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_BCSP is not set -# CONFIG_BT_HCIUART_ATH3K is not set -# CONFIG_BT_HCIUART_LL is not set -CONFIG_BT_HCIUART_3WIRE=y -# CONFIG_BT_HCIUART_INTEL is not set -CONFIG_BT_HCIUART_BCM=y -# CONFIG_BT_HCIUART_QCA is not set -# CONFIG_BT_HCIUART_AG6XX is not set -# CONFIG_BT_HCIUART_MRVL is not set -CONFIG_BT_HCIBCM203X=m -# CONFIG_BT_HCIBPA10X is not set -CONFIG_BT_HCIBFUSB=m -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_MRVL is not set -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_KCM is not set -# CONFIG_STREAM_PARSER is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_INTERNAL_REGDB=y -# CONFIG_CFG80211_CRDA_SUPPORT is not set -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_MINSTREL_VHT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set -CONFIG_RFKILL=m -CONFIG_RFKILL_LEDS=y -CONFIG_RFKILL_INPUT=y -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -# CONFIG_LWTUNNEL is not set -CONFIG_DST_CACHE=y -# CONFIG_NET_DEVLINK is not set -CONFIG_MAY_USE_DEVLINK=y -CONFIG_HAVE_CBPF_JIT=y - -# -# Device Drivers -# -CONFIG_ARM_AMBA=y - -# -# Generic Driver Options -# -# CONFIG_UEVENT_HELPER is not set -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -# CONFIG_ALLOW_DEV_COREDUMP is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_FENCE_TRACE is not set -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=5 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -# CONFIG_BRCMSTB_GISB_ARB is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_CONNECTOR is not set -# CONFIG_MTD is not set -CONFIG_DTC=y -CONFIG_OF=y -# CONFIG_OF_UNITTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_DYNAMIC=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OF_RESOLVE=y -CONFIG_OF_OVERLAY=y -CONFIG_OF_CONFIGFS=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_MG_DISK is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_NVME_TARGET is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -CONFIG_BCM2835_SMI=m -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Bus Driver -# - -# -# SCIF Bus Driver -# - -# -# VOP Bus Driver -# - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# - -# -# VOP Driver -# -# CONFIG_ECHO is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -# CONFIG_ATA is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_TEAM is not set -CONFIG_MACVLAN=m -# CONFIG_MACVTAP is not set -# CONFIG_VXLAN is not set -# CONFIG_MACSEC is not set -CONFIG_NETCONSOLE=y -# CONFIG_NETCONSOLE_DYNAMIC is not set -CONFIG_NETPOLL=y -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -# CONFIG_TUN_VNET_CROSS_LE is not set -CONFIG_VETH=m -# CONFIG_NLMON is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_ETHERNET is not set -CONFIG_PHYLIB=y -CONFIG_SWPHY=y - -# -# MDIO bus device drivers -# -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MDIO_HISI_FEMAC is not set - -# -# MII PHY device drivers -# -# CONFIG_AMD_PHY is not set -# CONFIG_AQUANTIA_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -CONFIG_FIXED_PHY=y -# CONFIG_ICPLUS_PHY is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_XILINX_GMII2RGMII is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=m -CONFIG_USB_NET_DRIVERS=y -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -# CONFIG_USB_LAN78XX is not set -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=y -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=y -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -CONFIG_USB_HSO=m -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -# CONFIG_USB_NET_CH9200 is not set -CONFIG_WLAN=y -CONFIG_WLAN_VENDOR_ADMTEK=y -CONFIG_ATH_COMMON=m -CONFIG_WLAN_VENDOR_ATH=y -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_DYNACK is not set -# CONFIG_ATH9K_WOW is not set -CONFIG_ATH9K_RFKILL=y -# CONFIG_ATH9K_CHANNEL_CONTEXT is not set -CONFIG_ATH9K_PCOEM=y -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_ATH9K_HWRNG=y -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -CONFIG_CARL9170_HWRNG=y -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -CONFIG_AR5523=m -# CONFIG_ATH10K is not set -CONFIG_WCN36XX=m -# CONFIG_WCN36XX_DEBUGFS is not set -CONFIG_WLAN_VENDOR_ATMEL=y -# CONFIG_AT76C50X_USB is not set -CONFIG_WLAN_VENDOR_BROADCOM=y -CONFIG_B43=m -CONFIG_B43_BCMA=y -CONFIG_B43_SSB=y -CONFIG_B43_BUSES_BCMA_AND_SSB=y -# CONFIG_B43_BUSES_BCMA is not set -# CONFIG_B43_BUSES_SSB is not set -# CONFIG_B43_SDIO is not set -CONFIG_B43_BCMA_PIO=y -CONFIG_B43_PIO=y -CONFIG_B43_PHY_G=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_PHY_HT=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_PROTO_BCDC=y -CONFIG_BRCMFMAC_SDIO=y -CONFIG_BRCMFMAC_USB=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -CONFIG_WLAN_VENDOR_CISCO=y -CONFIG_WLAN_VENDOR_INTEL=y -CONFIG_WLAN_VENDOR_INTERSIL=y -# CONFIG_HOSTAP is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -# CONFIG_P54_SPI is not set -CONFIG_P54_LEDS=y -CONFIG_WLAN_VENDOR_MARVELL=y -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_MWIFIEX is not set -CONFIG_WLAN_VENDOR_MEDIATEK=y -CONFIG_MT7601U=m -CONFIG_WLAN_VENDOR_RALINK=y -CONFIG_RT2X00=m -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_WLAN_VENDOR_REALTEK=y -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -CONFIG_RTL_CARDS=m -# CONFIG_RTL8192CU is not set -# CONFIG_RTL8XXXU is not set -CONFIG_WLAN_VENDOR_RSI=y -# CONFIG_RSI_91X is not set -CONFIG_WLAN_VENDOR_ST=y -# CONFIG_CW1200 is not set -CONFIG_WLAN_VENDOR_TI=y -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -# CONFIG_WLCORE is not set -CONFIG_WLAN_VENDOR_ZYDAS=y -CONFIG_USB_ZD1201=m -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MAC80211_HWSIM is not set -CONFIG_USB_NET_RNDIS_WLAN=m - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_ISDN is not set -# CONFIG_NVM is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_JOYSTICK_RPISENSE is not set -# CONFIG_INPUT_TABLET is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -CONFIG_TOUCHSCREEN_ADS7846=m -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -CONFIG_TOUCHSCREEN_EGALAX=m -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -CONFIG_TOUCHSCREEN_RPI_FT5406=m -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -CONFIG_TOUCHSCREEN_USB_EGALAX=y -# CONFIG_TOUCHSCREEN_USB_PANJIT is not set -CONFIG_TOUCHSCREEN_USB_3M=y -# CONFIG_TOUCHSCREEN_USB_ITM is not set -# CONFIG_TOUCHSCREEN_USB_ETURBO is not set -# CONFIG_TOUCHSCREEN_USB_GUNZE is not set -# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set -# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set -# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set -# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set -# CONFIG_TOUCHSCREEN_USB_GOTOP is not set -# CONFIG_TOUCHSCREEN_USB_JASTEC is not set -# CONFIG_TOUCHSCREEN_USB_ELO is not set -# CONFIG_TOUCHSCREEN_USB_E2I is not set -# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set -# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set -# CONFIG_TOUCHSCREEN_USB_NEXIO is not set -# CONFIG_TOUCHSCREEN_USB_EASYTOUCH is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -CONFIG_TOUCHSCREEN_ST1232=m -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ARIZONA_HAPTICS is not set -# CONFIG_INPUT_ATMEL_CAPTOUCH is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_RMI4_CORE is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_BRCM_CHAR_DRIVERS=y -CONFIG_BCM_VC_CMA=y -CONFIG_BCM2708_VCMEM=y -CONFIG_BCM_VCIO=y -CONFIG_BCM_VC_SM=y -CONFIG_BCM2835_DEVGPIOMEM=m -CONFIG_BCM2835_SMI_DEV=m -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -# CONFIG_DEVKMEM is not set - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -# CONFIG_SERIAL_8250_FINTEK is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_DMA is not set -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_FSL=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_RT288X is not set -CONFIG_SERIAL_OF_PLATFORM=y - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_BCM63XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_STM32 is not set -# CONFIG_TTY_PRINTK is not set -# CONFIG_HVC_DCC is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -CONFIG_HW_RANDOM_BCM2835=y -# CONFIG_R3964 is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -# CONFIG_XILLYBUS is not set - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -# CONFIG_I2C_COMPAT is not set -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=m - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MUX_REG is not set -# CONFIG_I2C_DEMUX_PINCTRL is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# -CONFIG_I2C_BCM2708=y -CONFIG_I2C_BCM2708_BAUDRATE=100000 - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -CONFIG_I2C_BCM2835=m -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_EMEV2 is not set -CONFIG_I2C_GPIO=y -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AXI_SPI_ENGINE is not set -CONFIG_SPI_BCM2835=m -CONFIG_SPI_BCM2835AUX=m -# CONFIG_SPI_BCM_QSPI is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_LOOPBACK_TEST is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set - -# -# PPS support -# -# CONFIG_PPS is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -# CONFIG_PTP_1588_CLOCK is not set - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_BCM2835=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_GPIOLIB=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -CONFIG_GPIO_SYSFS=y - -# -# Memory mapped GPIO drivers -# -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ALTERA is not set -CONFIG_GPIO_BCM_VIRT=y -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_EM is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_GPIO_MPC8XXX is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GPIO_ZX is not set - -# -# I2C GPIO expanders -# -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_TPIC2810 is not set -# CONFIG_GPIO_TS4900 is not set - -# -# MFD GPIO expanders -# -CONFIG_GPIO_ARIZONA=m -# CONFIG_HTC_EGPIO is not set - -# -# SPI GPIO expanders -# -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_PISOSR is not set - -# -# SPI or I2C GPIO expanders -# -# CONFIG_GPIO_MCP23S08 is not set - -# -# USB GPIO expanders -# -CONFIG_W1=m - -# -# 1-wire Bus Masters -# -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS1WM is not set -CONFIG_W1_MASTER_GPIO=m - -# -# 1-wire Slaves -# -CONFIG_W1_SLAVE_THERM=m -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 is not set -# CONFIG_W1_SLAVE_DS2406 is not set -# CONFIG_W1_SLAVE_DS2423 is not set -# CONFIG_W1_SLAVE_DS2431 is not set -# CONFIG_W1_SLAVE_DS2433 is not set -# CONFIG_W1_SLAVE_DS2760 is not set -# CONFIG_W1_SLAVE_DS2780 is not set -# CONFIG_W1_SLAVE_DS2781 is not set -# CONFIG_W1_SLAVE_DS28E04 is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_POWER_AVS is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_BRCMKONA is not set -# CONFIG_POWER_RESET_BRCMSTB is not set -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_RESET_GPIO_RESTART=y -# CONFIG_POWER_RESET_LTC2952 is not set -CONFIG_POWER_RESET_RESTART=y -# CONFIG_POWER_RESET_VERSATILE is not set -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -# CONFIG_SYSCON_REBOOT_MODE is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_CHARGER_RT9455 is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FTSTEUTATES is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX31722 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -# CONFIG_THERMAL_WRITABLE_TRIPS is not set -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -# CONFIG_CPU_THERMAL is not set -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_QORIQ_THERMAL is not set -CONFIG_THERMAL_BCM2835=y - -# -# ACPI INT340X thermal drivers -# -CONFIG_WATCHDOG=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WATCHDOG_NOWAYOUT is not set -# CONFIG_WATCHDOG_SYSFS is not set - -# -# Watchdog Device Drivers -# -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_ZIIRAVE_WATCHDOG is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_MAX63XX_WATCHDOG is not set -CONFIG_BCM2835_WDT=y -# CONFIG_MEN_A21_WDT is not set - -# -# USB-based Watchdog Cards -# -# CONFIG_USBPCWATCHDOG is not set - -# -# Watchdog Pretimeout Governors -# -# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -CONFIG_BCMA=m -CONFIG_BCMA_BLOCKIO=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCMA_DRIVER_GMAC_CMN=y -# CONFIG_BCMA_DRIVER_GPIO is not set -# CONFIG_BCMA_DEBUG is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_RPISENSE_CORE is not set -# CONFIG_MFD_ACT8945A is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_EXYNOS_LPASS is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77620 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_RT5033 is not set -CONFIG_MFD_RTSX_USB=y -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SYSCON=y -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TPS65218 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -CONFIG_MFD_ARIZONA=y -CONFIG_MFD_ARIZONA_I2C=m -CONFIG_MFD_ARIZONA_SPI=m -# CONFIG_MFD_CS47L24 is not set -CONFIG_MFD_WM5102=y -# CONFIG_MFD_WM5110 is not set -# CONFIG_MFD_WM8997 is not set -# CONFIG_MFD_WM8998 is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_REGULATOR is not set -CONFIG_MEDIA_SUPPORT=m - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -# CONFIG_MEDIA_SDR_SUPPORT is not set -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=m -CONFIG_VIDEO_V4L2=m -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=m -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=m -CONFIG_VIDEOBUF2_MEMOPS=m -CONFIG_VIDEOBUF2_VMALLOC=m -CONFIG_DVB_CORE=m -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=m -CONFIG_RC_MAP=m -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_SHARP_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_IR_XMP_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -# CONFIG_IR_HIX5HD2 is not set -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGORPLUGUSB=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -CONFIG_VIDEO_USBTV=m - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_USBVISION is not set -CONFIG_VIDEO_STK1160_COMMON=m -# CONFIG_VIDEO_STK1160_AC97 is not set -CONFIG_VIDEO_STK1160=m -# CONFIG_VIDEO_GO7007 is not set - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_AU0828_RC=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -CONFIG_DVB_USB_DIB3000MC=m -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -# CONFIG_DVB_USB_GL861 is not set -CONFIG_DVB_USB_LME2510=m -# CONFIG_DVB_USB_MXL111SF is not set -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_DVB_USB_DVBSKY=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set -CONFIG_DVB_AS102=m - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -# CONFIG_VIDEO_EM28XX_V4L2 is not set -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -# CONFIG_V4L_PLATFORM_DRIVERS is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m -# CONFIG_RADIO_ADAPTERS is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=m - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=m -CONFIG_MEDIA_TUNER_SIMPLE=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_TEA5761=m -CONFIG_MEDIA_TUNER_TEA5767=m -CONFIG_MEDIA_TUNER_MT20XX=m -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_SI2157=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_QM1D1C0042=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m -CONFIG_DVB_SI2165=m -CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_CX24120=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m -CONFIG_DVB_SI2168=m -CONFIG_DVB_AS102_FE=m -# CONFIG_DVB_GP8PSK_FE is not set - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LGDT3306A=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# -CONFIG_DVB_TC90522=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_DRX39XYJ=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_SP2=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -# CONFIG_IMX_IPUV3_CORE is not set -# CONFIG_DRM is not set - -# -# ACP (Audio CoProcessor) Configuration -# - -# -# Frame buffer Devices -# -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_CMDLINE=y -CONFIG_FB_NOTIFY=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -CONFIG_FB_BCM2708=y -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_RPISENSE is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -CONFIG_BACKLIGHT_RPI=y -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3639 is not set -CONFIG_BACKLIGHT_GPIO=y -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_VGASTATE is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=m -CONFIG_SND_TIMER=m -CONFIG_SND_PCM=m -CONFIG_SND_DMAENGINE_PCM=m -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_JACK=y -CONFIG_SND_JACK_INPUT_DEV=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_TIMER=y -CONFIG_SND_HRTIMER=m -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -CONFIG_SND_PROC_FS=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_AC97_CODEC=m -# CONFIG_SND_DRIVERS is not set - -# -# HD-Audio -# -CONFIG_SND_HDA_PREALLOC_SIZE=2048 -CONFIG_SND_ARM=y -# CONFIG_SND_ARMAACI is not set -CONFIG_SND_BCM2835=m -CONFIG_SND_SPI=y -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_6FIRE=m -CONFIG_SND_USB_HIFACE=m -CONFIG_SND_BCD2000=m -CONFIG_SND_USB_LINE6=m -CONFIG_SND_USB_POD=m -CONFIG_SND_USB_PODHD=m -CONFIG_SND_USB_TONEPORT=m -CONFIG_SND_USB_VARIAX=m -CONFIG_SND_SOC=m -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -# CONFIG_SND_SOC_AMD_ACP is not set -# CONFIG_SND_ATMEL_SOC is not set -CONFIG_SND_BCM2835_SOC_I2S=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -CONFIG_SND_BCM2708_SOC_RPI_DAC=m -CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -CONFIG_SND_DIGIDAC1_SOUNDCARD=m -CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -CONFIG_SND_PISOUND=m -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -# CONFIG_SND_SOC_IMG is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -CONFIG_SND_SOC_I2C_AND_SPI=m - -# -# CODEC drivers -# -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -CONFIG_SND_SOC_ADAU1977=m -CONFIG_SND_SOC_ADAU1977_I2C=m -# CONFIG_SND_SOC_ADAU7002 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS35L33 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_INNO_RK3036 is not set -# CONFIG_SND_SOC_MAX98504 is not set -# CONFIG_SND_SOC_MAX9860 is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM179X_I2C is not set -# CONFIG_SND_SOC_PCM179X_SPI is not set -# CONFIG_SND_SOC_PCM3168A_I2C is not set -# CONFIG_SND_SOC_PCM3168A_SPI is not set -CONFIG_SND_SOC_PCM5102A=m -CONFIG_SND_SOC_PCM512x=m -CONFIG_SND_SOC_PCM512x_I2C=m -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_RT5616 is not set -CONFIG_SND_SOC_PCM1794A=m -# CONFIG_SND_SOC_RT5631 is not set -# CONFIG_SND_SOC_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -CONFIG_SND_SOC_STA32X=m -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TAS5720 is not set -# CONFIG_SND_SOC_TFA9879 is not set -CONFIG_SND_SOC_TAS5713=m -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TS3A227E is not set -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -CONFIG_SND_SOC_WM8731=m -# CONFIG_SND_SOC_WM8737 is not set -CONFIG_SND_SOC_WM8741=m -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -CONFIG_SND_SOC_WM8804=m -CONFIG_SND_SOC_WM8804_I2C=m -# CONFIG_SND_SOC_WM8804_SPI is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8960 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8974 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_WM8985 is not set -# CONFIG_SND_SOC_NAU8810 is not set -CONFIG_SND_SOC_TPA6130A2=m -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIMPLE_SCU_CARD is not set -# CONFIG_SOUND_PRIME is not set -CONFIG_AC97_BUS=m - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -# CONFIG_HID_BETOP_FF is not set -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CP2112 is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -# CONFIG_HID_LED is not set -CONFIG_HID_LENOVO=y -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_HID_LOGITECH_HIDPP=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -CONFIG_HID_MULTITOUCH=m -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_OUYA=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PENMOUNT=y -CONFIG_HID_PETALYNX=y -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -CONFIG_SONY_FF=y -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SPINELPLUS=y -CONFIG_HID_SUNPLUS=y -CONFIG_HID_RMI=y -# CONFIG_HID_GREENASIA is not set -CONFIG_HID_SMARTJOYPLUS=m -CONFIG_SMARTJOYPLUS_FF=y -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -CONFIG_HID_XINMO=y -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -CONFIG_USB_MON=m -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_EHCI_HCD is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -CONFIG_USB_DWCOTG=y -# CONFIG_USB_HCD_BCMA is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_UAS is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=m -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=m -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -CONFIG_USB_SERIAL_IUU=m -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=m -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set - -# -# USB Physical Layer drivers -# -# CONFIG_USB_PHY is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_PWRSEQ_EMMC=y -CONFIG_PWRSEQ_SIMPLE=y - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_BCM2835=y -CONFIG_MMC_BCM2835_DMA=y -CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2 -CONFIG_MMC_BCM2835_SDHOST=y -# CONFIG_MMC_ARMMMCI is not set -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_PLTFM=y -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_SDHCI_IPROC is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_USDHI6ROL0 is not set -CONFIG_MMC_REALTEK_USB=m -# CONFIG_MMC_MTK is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y -CONFIG_LEDS_CLASS_FLASH=y - -# -# LED drivers -# -# CONFIG_LEDS_AAT1290 is not set -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_KTD2692 is not set -# CONFIG_LEDS_IS31FL319X is not set -# CONFIG_LEDS_IS31FL32XX is not set - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set -# CONFIG_LEDS_SYSCON is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_LEDS_TRIGGER_BACKLIGHT=y -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -CONFIG_LEDS_TRIGGER_TRANSIENT=y -CONFIG_LEDS_TRIGGER_CAMERA=y -CONFIG_LEDS_TRIGGER_INPUT=y -# CONFIG_LEDS_TRIGGER_PANIC is not set -# CONFIG_ACCESSIBILITY is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_HCTOSYS is not set -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_ABB5ZES3 is not set -CONFIG_RTC_DRV_ABX80X=m -CONFIG_RTC_DRV_DS1307=m -CONFIG_RTC_DRV_DS1307_HWMON=y -# CONFIG_RTC_DRV_DS1307_CENTURY is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_X1205 is not set -CONFIG_RTC_DRV_PCF8523=m -# CONFIG_RTC_DRV_PCF85063 is not set -CONFIG_RTC_DRV_PCF8563=m -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV8803 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1302 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6916 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX6110 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_MCP795 is not set -CONFIG_RTC_I2C_AND_SPI=y - -# -# SPI and I2C RTC drivers -# -CONFIG_RTC_DRV_DS3232=m -CONFIG_RTC_DRV_PCF2127=m -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_CMOS is not set -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_ZYNQMP is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_SNVS is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DMA_OF=y -# CONFIG_AMBA_PL08X is not set -CONFIG_DMA_BCM2835=y -# CONFIG_FSL_EDMA is not set -# CONFIG_INTEL_IDMA64 is not set -# CONFIG_NBPFAXI_DMA is not set -# CONFIG_PL330_DMA is not set -CONFIG_DMA_BCM2708=y -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_HIDMA is not set -# CONFIG_DW_DMAC is not set - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set - -# -# DMABUF options -# -# CONFIG_SYNC_FILE is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_UIO is not set -# CONFIG_VIRT_DRIVERS is not set - -# -# Virtio drivers -# -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -# CONFIG_PRISM2_USB is not set -# CONFIG_COMEDI is not set -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -# CONFIG_R8188EU is not set -CONFIG_VT6656=m - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -CONFIG_STAGING_MEDIA=y -# CONFIG_MEDIA_CEC is not set -CONFIG_LIRC_STAGING=y -# CONFIG_LIRC_IMON is not set -CONFIG_LIRC_RPI=m -# CONFIG_LIRC_SASEM is not set -# CONFIG_LIRC_SERIAL is not set -# CONFIG_LIRC_SIR is not set -# CONFIG_LIRC_XBOX is not set -# CONFIG_LIRC_ZILOG is not set - -# -# Android -# -# CONFIG_STAGING_BOARD is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LNET is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_FB_TFT is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set -# CONFIG_MOST is not set -# CONFIG_KS7010 is not set -# CONFIG_GREYBUS is not set -CONFIG_BCM2708_VCHIQ=y -# CONFIG_GOLDFISH is not set -# CONFIG_CHROME_PLATFORMS is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_CDCE706 is not set -# CONFIG_COMMON_CLK_CDCE925 is not set -# CONFIG_COMMON_CLK_CS2000_CP is not set -# CONFIG_CLK_QORIQ is not set -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_PIC32 is not set - -# -# Hardware Spinlock drivers -# - -# -# Clock Source drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y -CONFIG_CLKSRC_MMIO=y -CONFIG_BCM2835_TIMER=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_TIMER_SP804=y -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -CONFIG_MAILBOX=y -# CONFIG_ARM_MHU is not set -# CONFIG_PLATFORM_MHU is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_ALTERA_MBOX is not set -CONFIG_BCM2835_MBOX=y -# CONFIG_MAILBOX_TEST is not set -# CONFIG_IOMMU_SUPPORT is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# - -# -# SOC (System On Chip) specific Drivers -# - -# -# Broadcom SoC drivers -# -CONFIG_RASPBERRYPI_POWER=y -# CONFIG_SOC_BRCMSTB is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SOC_TI is not set -# CONFIG_PM_DEVFREQ is not set -CONFIG_EXTCON=m - -# -# Extcon Device Drivers -# -CONFIG_EXTCON_ARIZONA=m -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_MAX3355 is not set -# CONFIG_EXTCON_QCOM_SPMI_MISC is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_PWM is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC_MAX_NR=1 -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_RESET_ATH79 is not set -# CONFIG_RESET_BERLIN is not set -# CONFIG_RESET_LPC18XX is not set -# CONFIG_RESET_MESON is not set -# CONFIG_RESET_PISTACHIO is not set -# CONFIG_RESET_SOCFPGA is not set -# CONFIG_RESET_STM32 is not set -# CONFIG_RESET_SUNXI is not set -# CONFIG_TI_SYSCON_RESET is not set -# CONFIG_RESET_ZYNQ is not set -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_POWERCAP is not set -# CONFIG_MCB is not set - -# -# Performance monitor support -# -# CONFIG_RAS is not set - -# -# Android -# -# CONFIG_ANDROID is not set -# CONFIG_NVMEM is not set -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set - -# -# FPGA Configuration Support -# -# CONFIG_FPGA is not set - -# -# Firmware Drivers -# -# CONFIG_ARM_SCPI_PROTOCOL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_RASPBERRYPI_FIRMWARE=y -# CONFIG_FW_CFG_SYSFS is not set -CONFIG_HAVE_ARM_SMCCC=y - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_FS_IOMAP=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -# CONFIG_EXT4_ENCRYPTION is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_REISERFS_FS_XATTR is not set -CONFIG_JFS_FS=m -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=m -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -CONFIG_F2FS_CHECK_FS=y -# CONFIG_F2FS_FAULT_INJECTION is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -CONFIG_FILE_LOCKING=y -CONFIG_MANDATORY_FILE_LOCKING=y -# CONFIG_FS_ENCRYPTION is not set -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=m - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROC_CHILDREN is not set -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=y -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZ4=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -CONFIG_NFS_V4_2=y -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_PNFS_FLEXFILE_LAYOUT=m -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -CONFIG_NFS_V4_1_MIGRATION=y -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_GRACE_PERIOD=y -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -# CONFIG_DEBUG_INFO is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_PAGE_OWNER is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -CONFIG_LOCKUP_DETECTOR=y -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHED_INFO is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_TIMER_STATS is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_STACKTRACE is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=21 -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_LATENCYTOP is not set -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACING_SUPPORT=y -# CONFIG_FTRACE is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_MEMTEST is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_UBSAN is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_LL is not set -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_UART_8250 is not set -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_CORESIGHT is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y -# CONFIG_HARDENED_USERCOPY is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=m -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_KPP2=y -# CONFIG_CRYPTO_RSA is not set -# CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_ECDH is not set -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=m -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_NULL2=y -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CRYPTO_CRYPTD=m -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set -CONFIG_CRYPTO_ABLK_HELPER=m - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -CONFIG_CRYPTO_GCM=m -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_SEQIV=m -CONFIG_CRYPTO_ECHAINIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_KEYWRAP is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRC32=y -# CONFIG_CRYPTO_CRCT10DIF is not set -CONFIG_CRYPTO_GHASH=m -# CONFIG_CRYPTO_POLY1305 is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -# CONFIG_CRYPTO_DEFLATE is not set -CONFIG_CRYPTO_LZO=m -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -# CONFIG_CRYPTO_ANSI_CPRNG is not set -CONFIG_CRYPTO_DRBG_MENU=m -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=m -CONFIG_CRYPTO_JITTERENTROPY=m -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set - -# -# Certificates for signature checking -# -CONFIG_ARM_CRYPTO=y -CONFIG_CRYPTO_SHA1_ARM=y -CONFIG_CRYPTO_SHA1_ARM_NEON=y -# CONFIG_CRYPTO_SHA1_ARM_CE is not set -# CONFIG_CRYPTO_SHA2_ARM_CE is not set -CONFIG_CRYPTO_SHA256_ARM=m -# CONFIG_CRYPTO_SHA512_ARM is not set -CONFIG_CRYPTO_AES_ARM=m -CONFIG_CRYPTO_AES_ARM_BS=m -# CONFIG_CRYPTO_AES_ARM_CE is not set -# CONFIG_CRYPTO_GHASH_ARM_CE is not set -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=m -CONFIG_BITREVERSE=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=m -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m -# CONFIG_CRC8 is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=m -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_NLATTR=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -# CONFIG_IRQ_POLL is not set -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_SG_SPLIT is not set -CONFIG_SG_POOL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_SBITMAP=y -# CONFIG_VIRTUALIZATION is not set diff --git a/projects/RPi2/options b/projects/RPi2/options index 873ccef8f5..1f7d3596d9 100644 --- a/projects/RPi2/options +++ b/projects/RPi2/options @@ -57,7 +57,7 @@ # Kernel to use. values can be: # default: default mainline kernel - LINUX="default" + LINUX="default-rpi" # NOOBS supported hex versions (legacy) NOOBS_HEX="1040,1041,2082" @@ -112,7 +112,7 @@ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-rpi" + FIRMWARE="misc-firmware wlan-firmware brcmfmac_sdio-firmware-rpi" # build and install ATV IR remote support (yes / no) ATVCLIENT_SUPPORT="no" @@ -136,4 +136,4 @@ # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS media_build" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS rpi-cirrus-config" diff --git a/projects/RPi2/patches/kodi/kodi-001-backport.patch b/projects/RPi2/patches/kodi/kodi-001-backport.patch deleted file mode 100644 index 6d4e7298ca..0000000000 --- a/projects/RPi2/patches/kodi/kodi-001-backport.patch +++ /dev/null @@ -1,52283 +0,0 @@ -From 011217b8d0ead7798bb0a7933a2c2994aab577e6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Oct 2014 00:19:40 +0000 -Subject: [PATCH 01/62] [cec] Add settings for configuring button repeats - ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/peripherals.xml | 4 +++- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ - 3 files changed, 34 insertions(+), 1 deletion(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index abfc92bd5a9f1da9e2eed758a90416ce2d369e3b..15745a792a5a28c79c19effc4d9037e842535da6 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19714,3 +19714,18 @@ msgstr "" - msgctxt "#39010" - msgid "Select sort method" - msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38050" -+msgid "Remote button press delay before repeating (ms)" -+msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38051" -+msgid "Remote button press repeat rate (ms)" -+msgstr "" -+ -+#: system/peripherals.xml -+msgctxt "#38052" -+msgid "Remote button press release time (ms)" -+msgstr "" -diff --git a/system/peripherals.xml b/system/peripherals.xml -index d5704b249c3065b2980dc92c7c81dc7b384187bc..02b1a9ed6fce1986bd864bba09a9df0621f9e041 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -31,7 +31,9 @@ - - - -- -+ -+ -+ - - - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index d032ffd707fee5eec035e90bdf618530f7215c37..30367a3fde956090afdca9930fa52e829f35046f 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -1296,6 +1296,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu - m_configuration.bActivateSource = config.bActivateSource; - bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1); - -+#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) -+ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; -+ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); -+#else -+ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; -+ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs); -+#endif -+ -+ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; -+ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); -+ -+ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; -+ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); -+ - m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby; - - m_configuration.iFirmwareVersion = config.iFirmwareVersion; -@@ -1398,6 +1412,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) - // backwards compatibility. will be removed once the next major release of libCEC is out - m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); - #endif -+ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); -+ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); - - if (GetSettingBool("pause_playback_on_deactivate")) - { - -From 59f1631775f719f712048fc123bc6c36632a166b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 02/62] [cec] Don't suspend pi on tv switch off - it can't wake - up - ---- - system/peripherals.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/system/peripherals.xml b/system/peripherals.xml -index 02b1a9ed6fce1986bd864bba09a9df0621f9e041..54f9b70cfd5c8c82ceb99932e1b3e3251211cd20 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -16,7 +16,7 @@ - - - -- -+ - - - - -From ab59b9542257461e117a238bab492e54fff7908c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 21 Apr 2016 16:49:02 +0100 -Subject: [PATCH 03/62] Revert "[settings] remove show EXIF picture information - setting" - -This reverts commit e7d90188436b6966eff23fd695e1a9d18f4af1b4. ---- - addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ - system/settings/settings.xml | 5 +++++ - xbmc/pictures/GUIWindowPictures.cpp | 2 +- - xbmc/pictures/PictureInfoLoader.cpp | 8 ++++++-- - xbmc/pictures/PictureInfoLoader.h | 1 + - xbmc/settings/Settings.cpp | 1 + - xbmc/settings/Settings.h | 1 + - 7 files changed, 25 insertions(+), 3 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 15745a792a5a28c79c19effc4d9037e842535da6..dbd80f07e305ad99a29d90211a7596b8bb5cedec 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19729,3 +19729,13 @@ msgstr "" - msgctxt "#38052" - msgid "Remote button press release time (ms)" - msgstr "" -+ -+#. Description of setting "Pictures -> Show EXIF picture information" with label #38207 -+#: system/settings/settings.xml -+msgctxt "#38207" -+msgid "Show EXIF picture information" -+msgstr "" -+ -+msgctxt "#38208" -+msgid "If EXIF information exists (date, time, camera used, etc.), it will be displayed." -+msgstr "" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index c3804da9625186f5651a8d8be0edcedd8a2b255b..63613fc13acfd66476a880f8ebe9047a53837a33 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -1172,6 +1172,11 @@ - - - -+ -+ 0 -+ true -+ -+ - - 0 - true -diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp -index 4b5ec502a49d5116cafd53441a6d823be0da6b54..072639baae58479ec7d746f96634de069ee87e34 100644 ---- a/xbmc/pictures/GUIWindowPictures.cpp -+++ b/xbmc/pictures/GUIWindowPictures.cpp -@@ -203,7 +203,7 @@ void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items) - if (StringUtils::EqualsNoCase(items[i]->GetLabel(), "folder.jpg")) - items.Remove(i); - -- if (items.GetFolderCount() == items.Size()) -+ if (items.GetFolderCount() == items.Size() || !CSettings::GetInstance().GetBool(CSettings::SETTING_PICTURES_USETAGS)) - return; - - // Start the music info loader thread -diff --git a/xbmc/pictures/PictureInfoLoader.cpp b/xbmc/pictures/PictureInfoLoader.cpp -index dd3347277c75c5e63a4a4db9af9cc46605bb5ea9..05304f9fc44285d5577f2056625cceb15347ae57 100644 ---- a/xbmc/pictures/PictureInfoLoader.cpp -+++ b/xbmc/pictures/PictureInfoLoader.cpp -@@ -43,6 +43,7 @@ void CPictureInfoLoader::OnLoaderStart() - m_mapFileItems->SetFastLookup(true); - - m_tagReads = 0; -+ m_loadTags = CSettings::GetInstance().GetBool(CSettings::SETTING_PICTURES_USETAGS); - - if (m_pProgressCallback) - m_pProgressCallback->SetProgressMax(m_pVecItems->GetFileCount()); -@@ -87,8 +88,11 @@ bool CPictureInfoLoader::LoadItemLookup(CFileItem* pItem) - if (pItem->HasPictureInfoTag()) - return false; - -- pItem->GetPictureInfoTag()->Load(pItem->GetPath()); -- m_tagReads++; -+ if (m_loadTags) -+ { // Nothing found, load tag from file -+ pItem->GetPictureInfoTag()->Load(pItem->GetPath()); -+ m_tagReads++; -+ } - - return true; - } -diff --git a/xbmc/pictures/PictureInfoLoader.h b/xbmc/pictures/PictureInfoLoader.h -index 000b54fe1bb1dd1963edd5cf208ea318a5a5499d..2a022ff0ff66d237f0ebd12092c7b5ce8244a511 100644 ---- a/xbmc/pictures/PictureInfoLoader.h -+++ b/xbmc/pictures/PictureInfoLoader.h -@@ -39,5 +39,6 @@ protected: - - CFileItemList* m_mapFileItems; - unsigned int m_tagReads; -+ bool m_loadTags; - }; - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 9940b6aac87971d7024c1c925846b4dac1ca98a0..6e13ba61b99217d95c1ad423131221869be6036b 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -296,6 +296,7 @@ const std::string CSettings::SETTING_AUDIOCDS_SETTINGS = "audiocds.settings"; - const std::string CSettings::SETTING_AUDIOCDS_EJECTONRIP = "audiocds.ejectonrip"; - const std::string CSettings::SETTING_MYMUSIC_SONGTHUMBINVIS = "mymusic.songthumbinvis"; - const std::string CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW = "mymusic.defaultlibview"; -+const std::string CSettings::SETTING_PICTURES_USETAGS = "pictures.usetags"; - const std::string CSettings::SETTING_PICTURES_GENERATETHUMBS = "pictures.generatethumbs"; - const std::string CSettings::SETTING_PICTURES_SHOWVIDEOS = "pictures.showvideos"; - const std::string CSettings::SETTING_PICTURES_DISPLAYRESOLUTION = "pictures.displayresolution"; -diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h -index 482f61db8aab70aff4013fee2f1c73a5b5a9b4a9..269a3a741340d60354037166c3b03ddfdd36cf01 100644 ---- a/xbmc/settings/Settings.h -+++ b/xbmc/settings/Settings.h -@@ -253,6 +253,7 @@ public: - static const std::string SETTING_AUDIOCDS_EJECTONRIP; - static const std::string SETTING_MYMUSIC_SONGTHUMBINVIS; - static const std::string SETTING_MYMUSIC_DEFAULTLIBVIEW; -+ static const std::string SETTING_PICTURES_USETAGS; - static const std::string SETTING_PICTURES_GENERATETHUMBS; - static const std::string SETTING_PICTURES_SHOWVIDEOS; - static const std::string SETTING_PICTURES_DISPLAYRESOLUTION; - -From 2b1ad46b2dbde48ef0c82dbd4cb28af3708dc2d6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 04/62] [rbp/omxplayer] When opening a stream don't try to - update gui so often - ---- - xbmc/dialogs/GUIDialogBusy.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp -index c8fe0706d128b3c67a4000894129ae0fa08bb223..8a5916299575661743131b921a27a76f0bb88409 100644 ---- a/xbmc/dialogs/GUIDialogBusy.cpp -+++ b/xbmc/dialogs/GUIDialogBusy.cpp -@@ -69,7 +69,11 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10 - { - dialog->Open(); - -+#ifdef TARGET_RASPBERRY_PI -+ while(!event.WaitMSec(100)) -+#else - while(!event.WaitMSec(1)) -+#endif - { - dialog->ProcessRenderLoop(false); - if (allowCancel && dialog->IsCanceled()) - -From 5980fa48550e82458fc62fb501a7bc7190569cb4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 05/62] [hifiberry] Hack: force it to be recognised as IEC958 - capable to enable passthrough options - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index d66993a09583d8f9f54f5f97c18fbba45dddee9b..3c0b691860ace57e0a25f01013df01a5ca4f62f5 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -1351,6 +1351,10 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev - if (snd_card_get_name(cardNr, &cardName) == 0) - info.m_displayName = cardName; - -+ // hack: hifiberry digi doesn't correctly report as iec958 device. Needs fixing in kernel driver -+ if (info.m_displayName == "snd_rpi_hifiberry_digi") -+ info.m_deviceType = AE_DEVTYPE_IEC958; -+ - if (info.m_deviceType == AE_DEVTYPE_HDMI && info.m_displayName.size() > 5 && - info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") - { - -From 6387bb9ea57ef7c7e203e0b043139ff26103df22 Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 06/62] Improved file buffering in CArchive - -Even though memcpy is typically inlined by the compiler into byte/word loads -and stores (at least for release builds), the frequency with which 1, 2 and 4 -byte loads/stores are encountered in cases where the size is *not* -determinable at compile time is still high enough that it's worth handling -these specially. On the ARM1176JZF-S in the Raspberry Pi, this improves the -total time to open a library (in the case where it's fetched from a CArchive) -by around 4%. - -It should be noted that this code uses 16-bit and 32-bit word loads and -stores that are not necessarily aligned to their respective widths. It is -possible that there are some architectures out there which do not support -this, although all ARMs since ARMv6 have supported it (and ARMs earlier than -that are probably not powerful enough to be good targets for XBMC). ---- - xbmc/utils/Archive.h | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/xbmc/utils/Archive.h b/xbmc/utils/Archive.h -index 23cac2759fb10d532da56fa75c5528c5589e9010..89d31d4db1afa7340ed8cd51a7a9fa7acce53b3a 100644 ---- a/xbmc/utils/Archive.h -+++ b/xbmc/utils/Archive.h -@@ -155,9 +155,17 @@ protected: - * than waiting until we attempt to put more data into an already full buffer */ - if (m_BufferRemain > size) - { -+ switch (size) -+ { -+ case 1: *m_BufferPos++ = *ptr; m_BufferRemain--; break; -+ case 2: *(uint16_t *) m_BufferPos = *(const uint16_t *) ptr; m_BufferPos += 2; m_BufferRemain -= 2; break; -+ case 4: *(uint32_t *) m_BufferPos = *(const uint32_t *) ptr; m_BufferPos += 4; m_BufferRemain -= 4; break; -+ default: - memcpy(m_BufferPos, ptr, size); - m_BufferPos += size; - m_BufferRemain -= size; -+ break; -+ } - return *this; - } - -@@ -170,9 +178,17 @@ protected: - /* Note, refilling the buffer is deferred until we know we need to read more from it */ - if (m_BufferRemain >= size) - { -+ switch (size) -+ { -+ case 1: *ptr = *m_BufferPos++; m_BufferRemain--; break; -+ case 2: *(uint16_t *) ptr = *(const uint16_t *) m_BufferPos; m_BufferPos += 2; m_BufferRemain -= 2; break; -+ case 4: *(uint32_t *) ptr = *(const uint32_t *) m_BufferPos; m_BufferPos += 4; m_BufferRemain -= 4; break; -+ default: - memcpy(ptr, m_BufferPos, size); - m_BufferPos += size; - m_BufferRemain -= size; -+ break; -+ } - return *this; - } - - -From ebdbce3d440c74755bf071fc064c96bbab9abc78 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 07/62] filesystem: Make support of browsing into archives - optional - -The ability to browse, scan and play content in archives can cause problems on low powered/low memory devices. -It's quite common to see reports of a large rar file that causes xbmc to crash with an out-of-memory error when browsing or scanning. -It also can be slow as any archive in the directory is opened and extracted. - -This causes issues for people who scan library with archives disabled, then subsequently enable it. -The library has the .rar files in which don't play without removing and re-adding. - -We'll let people who don't use archives disable it manually ---- - addons/resource.language.en_gb/resources/strings.po | 9 +++++++++ - system/settings/rbp.xml | 11 +++++++++++ - xbmc/Util.cpp | 4 ++-- - xbmc/filesystem/FileDirectoryFactory.cpp | 4 ++++ - 4 files changed, 26 insertions(+), 2 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index dbd80f07e305ad99a29d90211a7596b8bb5cedec..ecea05ac43622f75034c60cc3b2bd16859065a80 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19371,6 +19371,15 @@ msgstr "" - #: system/settings/rbp.xml - msgctxt "#38010" - msgid "GPU accelerated" -+ -+#: system/settings/settings.xml -+msgctxt "#38040" -+msgid "Support browsing into archives" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38041" -+msgid "Allow viewing and playing files in archives (e.g. zip, rar)" - msgstr "" - - #. Setting #38011 "Show All Items entry" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 62e9c8ed2199f8c57a640b06b0216ee4c8f0ca1e..e8b0d3d472b02fd161a4b51e957b9129e3cb9792 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -102,4 +102,15 @@ - - -

-+
-+ -+ -+ -+ 1 -+ true -+ -+ -+ -+ -+
-
-diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp -index c3567941192c724f2600494a8d7e355584b57b52..da1508dcedbd196789988d895e64548a08439d8f 100644 ---- a/xbmc/Util.cpp -+++ b/xbmc/Util.cpp -@@ -1899,7 +1899,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName, - URIUtils::RemoveExtension(strCandidate); - if (StringUtils::StartsWithNoCase(strCandidate, videoName)) - { -- if (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath())) -+ if (CSettings::GetInstance().GetBool("filelists.browsearchives") && (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath()))) - CUtil::ScanArchiveForAssociatedItems(pItem->GetPath(), "", item_exts, associatedFiles); - else - { -@@ -1909,7 +1909,7 @@ void CUtil::ScanPathsForAssociatedItems(const std::string& videoName, - } - else - { -- if (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath())) -+ if (CSettings::GetInstance().GetBool("filelists.browsearchives") && (URIUtils::IsRAR(pItem->GetPath()) || URIUtils::IsZIP(pItem->GetPath()))) - CUtil::ScanArchiveForAssociatedItems(pItem->GetPath(), videoName, item_exts, associatedFiles); - } - } -diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp -index a0fd0a9011e71f4af1535110c696b6ea5c4b37db..688b71a297c7c617c6764bfe6be157d727eb49d3 100644 ---- a/xbmc/filesystem/FileDirectoryFactory.cpp -+++ b/xbmc/filesystem/FileDirectoryFactory.cpp -@@ -40,6 +40,7 @@ - #include "playlists/PlayListFactory.h" - #include "Directory.h" - #include "File.h" -+#include "settings/Settings.h" - #include "FileItem.h" - #include "utils/StringUtils.h" - #include "URL.h" -@@ -116,6 +117,8 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, - return NULL; - } - #endif -+ if (CSettings::GetInstance().GetBool("filelists.browsearchives")) -+ { - if (url.IsFileType("zip")) - { - CURL zipURL = URIUtils::CreateArchivePath("zip", url); -@@ -189,6 +192,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, - } - return NULL; - } -+ } - if (url.IsFileType("xbt")) - { - CURL xbtUrl = URIUtils::CreateArchivePath("xbt", url); - -From 2f0e7984f47266b6b5fd6a4e14ee8f2a8e9f011c Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 08/62] [rbp] Make cachemembuffersize default depend on memory - size - ---- - xbmc/linux/RBP.cpp | 10 ++++++++++ - xbmc/linux/RBP.h | 1 + - xbmc/settings/AdvancedSettings.cpp | 12 +++++++++++- - 3 files changed, 22 insertions(+), 1 deletion(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 571bf9f1ae64ae6d2d80a4aaca1a164f5178bf98..5a6f780517cff0c31f1c40e5e95445d448eb2297 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -23,6 +23,7 @@ - - #include - #include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" - #include "utils/log.h" - - #include "cores/omxplayer/OMXImage.h" -@@ -58,6 +59,12 @@ CRBP::~CRBP() - delete m_DllBcmHost; - } - -+void CRBP::InitializeSettings() -+{ -+ if (m_initialized && g_advancedSettings.m_cacheMemSize == ~0U) -+ g_advancedSettings.m_cacheMemSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; -+} -+ - bool CRBP::Initialize() - { - CSingleLock lock(m_critSection); -@@ -97,6 +104,8 @@ bool CRBP::Initialize() - if (!m_gui_resolution_limit) - m_gui_resolution_limit = m_gpu_mem < 128 ? 720:1080; - -+ InitializeSettings(); -+ - g_OMXImage.Initialize(); - m_omx_image_init = true; - return true; -@@ -109,6 +118,7 @@ void CRBP::LogFirmwareVerison() - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); - CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); -+ CLog::Log(LOGNOTICE, "cache.memorysize: %dMB", g_advancedSettings.m_cacheMemSize >> 20); - m_DllBcmHost->vc_gencmd(response, sizeof response, "get_config int"); - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Config:\n%s", response); -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index a35a509a91483f13e2cf0e688fc7e9528f254290..fffa5182126159f6dfcf750b21fa0464e229e545 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -62,6 +62,7 @@ public: - ~CRBP(); - - bool Initialize(); -+ void InitializeSettings(); - void LogFirmwareVerison(); - void Deinitialize(); - int GetArmMem() { return m_arm_mem; } -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index cc37998f0c9edfb38cf609666374cfa96530bf8f..3891a7ed34acb3489a860678d56a8ec049890f6e 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -50,6 +50,9 @@ - #if defined(TARGET_DARWIN_IOS) - #include "platform/darwin/DarwinUtils.h" - #endif -+#if defined(TARGET_RASPBERRY_PI) -+#include "linux/RBP.h" -+#endif - - using namespace ADDON; - using namespace XFILE; -@@ -355,7 +358,12 @@ void CAdvancedSettings::Initialize() - m_bPVRAutoScanIconsUserSet = false; - m_iPVRNumericChannelSwitchTimeout = 1000; - -+#ifdef TARGET_RASPBERRY_PI -+ // want default to be memory dependent, but interface to gpu not available yet, so set in RBP.cpp -+ m_cacheMemSize = ~0; -+#else - m_cacheMemSize = 1024 * 1024 * 20; -+#endif - m_cacheBufferMode = CACHE_BUFFER_MODE_INTERNET; // Default (buffer all internet streams/filesystems) - // the following setting determines the readRate of a player data - // as multiply of the default data read rate -@@ -404,7 +412,9 @@ void CAdvancedSettings::Initialize() - m_extraLogLevels = 0; - - m_userAgent = g_sysinfo.GetUserAgent(); -- -+#ifdef TARGET_RASPBERRY_PI -+ g_RBP.InitializeSettings(); -+#endif - m_initialized = true; - } - - -From c84536e65bc489172be3a852a9db7496615e7ec2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 09/62] [settings] Experiment: Report DESKTOP resolution in - video settings - ---- - xbmc/settings/DisplaySettings.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp -index ef95bc286fa982790248bad26da3c3e00c1da002..da69c6960867621d4ebe9267929664d973d00beb 100644 ---- a/xbmc/settings/DisplaySettings.cpp -+++ b/xbmc/settings/DisplaySettings.cpp -@@ -704,6 +704,9 @@ void CDisplaySettings::SettingOptionsResolutionsFiller(const CSetting *setting, - std::vector resolutions = g_Windowing.ScreenResolutions(info.iScreen, info.fRefreshRate); - for (std::vector::const_iterator resolution = resolutions.begin(); resolution != resolutions.end(); ++resolution) - { -+if (resolution->ResInfo_Index == RES_DESKTOP) -+ list.push_back(std::make_pair(StringUtils::Format("DESKTOP"), resolution->ResInfo_Index)); -+else - list.push_back(std::make_pair( - StringUtils::Format("%dx%d%s", resolution->width, resolution->height, - ModeFlagsToString(resolution->flags, false).c_str()), - -From 7f0028ec330b751c0c006ab2b496c5aeb6f67ac3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 10/62] [audio] Add settings option to boost centre channel - when downmixing - -This allows a dB volume increase to be added to centre channel. -This can help improve dialgue in the presence of background music/effects. -It can go up to 30dB for testing purposes, but value of 6 is probably more reasonable. -It is recommended to ensure "Normalise levels on downmix" is enabled when boosting by large values to avoid clipping. - -Should work with Pi Sink (dvdplayer/paplayer) and omxplayer ---- - addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ - system/settings/settings.xml | 12 ++++++++++++ - .../Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp | 7 +++++++ - .../AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp | 6 ++++++ - xbmc/cores/omxplayer/OMXAudio.cpp | 6 ++++++ - 5 files changed, 46 insertions(+) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ecea05ac43622f75034c60cc3b2bd16859065a80..de5eb0dd99700c0bdc7c3409c1b63f1c01c650bb 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19591,6 +19591,21 @@ msgstr "" - - #empty strings from id 38062 to 38099 - -+#: system/settings/settings.xml -+msgctxt "#38007" -+msgid "Boost centre channel when downmixing" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38008" -+msgid "Increase this value to make the dialogue louder compared to background sounds when downmixing multichannel audio" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38009" -+msgid "%i dB" -+msgstr "" -+ - #. Description of section #14200 "Player"" - #: system/settings/settings.xml - msgctxt "#38100" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 63613fc13acfd66476a880f8ebe9047a53837a33..9ce9e725aec4d8ed000200342a2a99f3bc34a749 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2358,6 +2358,18 @@ - - - -+ -+ 2 -+ 0 -+ -+ 0 -+ 1 -+ 30 -+ -+ -+ 38009 -+ -+ - - HAS_AE_QUALITY_LEVELS - 2 -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -index af5bf93116543bd282953b01d0c5bcef93bb3a84..d7165dedd242abdfa7c0607eee332451c3187298 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -@@ -20,6 +20,7 @@ - - #include "cores/AudioEngine/Utils/AEUtil.h" - #include "ActiveAEResampleFFMPEG.h" -+#include "settings/Settings.h" - #include "utils/log.h" - - extern "C" { -@@ -104,6 +105,12 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - if (remapLayout) - { -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -index 78071493fca4756c6741d7085e35cbe2f27038e6..698a6ae1e2bc0cc9256caec42c0dcfb0893301b5 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp -@@ -164,6 +164,12 @@ bool CActiveAEResamplePi::Init(uint64_t dst_chan_layout, int dst_channels, int d - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - if (remapLayout) - { -diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp -index f16b822ed7b4aebe18b5d339b3f71ee66e97c23f..993d4b33a294e88c2c004b7943895ba55558c2d0 100644 ---- a/xbmc/cores/omxplayer/OMXAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXAudio.cpp -@@ -633,6 +633,12 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - // stereo upmix - if (upmix && m_src_channels == 2 && m_dst_channels > 2) - -From 970ba6a8671460e469240cf5113d574ea44905cc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 11/62] [rbp] Default extract thumbnails to false - -It can take 80 seconds for a single file on a Pi. It can cause crashes with out-of-memory errors. -It genereates a lot of support issues. Best to default to disabled and let users enable it if they must ---- - system/settings/rbp.xml | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index e8b0d3d472b02fd161a4b51e957b9129e3cb9792..289dc55ec41aa44848519a05f8ee1ccc72740085 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -43,6 +43,12 @@ - - false - -+ -+ false -+ -+ -+ false -+ - - - - -From 9fecb172939f96a23cacafe2e40cbd462cfa9da3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 12/62] [languageinvoker] Reduce priority of python threads - ---- - xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/interfaces/generic/LanguageInvokerThread.cpp b/xbmc/interfaces/generic/LanguageInvokerThread.cpp -index fcdd0633f30cd9595ae6cc4ed293677cdcb1f422..16f0c8916b5e0a9e90973d194cf2ebd12b5a81fd 100644 ---- a/xbmc/interfaces/generic/LanguageInvokerThread.cpp -+++ b/xbmc/interfaces/generic/LanguageInvokerThread.cpp -@@ -50,6 +50,11 @@ bool CLanguageInvokerThread::execute(const std::string &script, const std::vecto - m_args = arguments; - - Create(); -+ #ifdef TARGET_RASPBERRY_PI -+ /* low prio */ -+ SetPriority(GetPriority()-1); -+ #endif -+ - return true; - } - - -From d9dc2c7f2616bc989bd550ee5a7ac7a47b5d43ae Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 13/62] [rbp] hack: wait for splash to complete before changing - hdmi mode - ---- - xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 52 +++++++++++++++++++++++++ - 1 file changed, 52 insertions(+) - -diff --git a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -index ee297700f8583dbb15cbe53baf8c887b36bd2ea0..bbe501d40c5e101f1d0d64b8b59b1928ae12d52f 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp -@@ -32,6 +32,9 @@ - #include "guilib/StereoscopicsManager.h" - #include "rendering/RenderSystem.h" - #include -+#ifdef TARGET_POSIX -+#include "linux/XTimeUtils.h" -+#endif - - #ifndef __VIDEOCORE4__ - #define __VIDEOCORE4__ -@@ -221,12 +224,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve - } - #endif - -+#include -+ -+pid_t proc_find(const char* name) -+{ -+ DIR* dir; -+ struct dirent* ent; -+ char buf[512]; -+ -+ long pid; -+ char pname[100] = {0,}; -+ char state; -+ FILE *fp=NULL; -+ -+ if (!(dir = opendir("/proc"))) { -+ perror("can't open /proc"); -+ return -1; -+ } -+ -+ while((ent = readdir(dir)) != NULL) { -+ long lpid = atol(ent->d_name); -+ if(lpid < 0) -+ continue; -+ snprintf(buf, sizeof(buf), "/proc/%ld/stat", lpid); -+ fp = fopen(buf, "r"); -+ -+ if (fp) { -+ if ( (fscanf(fp, "%ld (%[^)]) %c", &pid, pname, &state)) != 3 ){ -+ printf("fscanf failed \n"); -+ fclose(fp); -+ closedir(dir); -+ return -1; -+ } -+ if (!strcmp(pname, name)) { -+ fclose(fp); -+ closedir(dir); -+ return (pid_t)lpid; -+ } -+ fclose(fp); -+ } -+ } -+ -+ closedir(dir); -+ return -1; -+} -+ -+ - bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res) - { - #if defined(TARGET_RASPBERRY_PI) - if(!m_DllBcmHost || !m_nativeWindow) - return false; - -+ while (proc_find("hello_video.bin") >= 0) -+ Sleep(100); -+ - DestroyDispmaxWindow(); - - RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode(); - -From 8f2d2d8618a4051fdeedfc528a21fc0657614d9e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 14/62] Fix for UI not showing both extractflags and - extractthumb - ---- - addons/resource.language.en_gb/resources/strings.po | 10 +++++++--- - system/settings/settings.xml | 4 ++-- - 2 files changed, 9 insertions(+), 5 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index de5eb0dd99700c0bdc7c3409c1b63f1c01c650bb..ae3aa10aa65beac6689f129d60056cadf8a5b5c1 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -12451,7 +12451,7 @@ msgstr "" - - #: system/settings/settings.xml - msgctxt "#20433" --msgid "Extract thumbnails and video information" -+msgid "Extract video information from files" - msgstr "" - - #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -17011,7 +17011,7 @@ msgstr "" - #. Description of setting with label #20433 "Extract thumbnails and video information" - #: system/settings/settings.xml - msgctxt "#36178" --msgid "Extract thumbnails and metadata information such as codec and aspect ratio from videos." -+msgid "Extract metadata information such as codec and aspect ratio from videos." - msgstr "" - - #. Description of setting with label #20419 "Replace file names with library titles" -@@ -17023,7 +17023,7 @@ msgstr "" - #. Description of setting with label #20433 "Extract thumbnails and video information" - #: system/settings/settings.xml - msgctxt "#36180" --msgid "Extract thumbnails and information, such as codecs and aspect ratio, to display in library mode." -+msgid "Extract thumbnails, to display in library Mode." - msgstr "" - - #: system/settings/settings.xml -@@ -19763,3 +19763,7 @@ msgstr "" - msgctxt "#38208" - msgid "If EXIF information exists (date, time, camera used, etc.), it will be displayed." - msgstr "" -+ -+msgctxt "#38190" -+msgid "Extract thumbnails from video files" -+msgstr "" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 9ce9e725aec4d8ed000200342a2a99f3bc34a749..326ffbd0f08428c3b4a95208134253feeabf1b1f 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -969,8 +969,8 @@ - true - - -- -- 4 -+ -+ 1 - true - - - -From 2d8206baa4bb9229a75e71a3de87628d60e006e5 Mon Sep 17 00:00:00 2001 -From: anaconda -Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 15/62] Disable autoscrolling while on screensaver and while - opening streams. - ---- - xbmc/Application.cpp | 10 ++++++++++ - xbmc/Application.h | 2 ++ - xbmc/guilib/GUIFadeLabelControl.cpp | 4 +++- - xbmc/guilib/GUIFont.cpp | 4 ++++ - xbmc/guilib/GUILabel.cpp | 4 +++- - xbmc/guilib/GUITextBox.cpp | 3 ++- - 6 files changed, 24 insertions(+), 3 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 620366e4bcb8593484bc205af4c33fc13dab924a..cf77c3dbb84b86c755ee792294760c5c4c38742d 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -5215,3 +5215,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const - - return false; - } -+ -+bool CApplication::ScreenSaverDisablesAutoScrolling() -+{ -+ bool onBlackDimScreenSaver = IsInScreenSaver() && m_screenSaver && -+ (m_screenSaver->ID() == "screensaver.xbmc.builtin.black" || -+ m_screenSaver->ID() == "screensaver.xbmc.builtin.dim"); -+ bool openingStreams = m_pPlayer->IsPlaying() && g_windowManager.IsWindowActive(WINDOW_DIALOG_BUSY); -+ -+ return onBlackDimScreenSaver || openingStreams; -+} -diff --git a/xbmc/Application.h b/xbmc/Application.h -index 580fdce5476312c83c82bec07f48b3eaf8fe9797..e04788e1e3574aa5ecf9b14490fe1fd967ce8ec9 100644 ---- a/xbmc/Application.h -+++ b/xbmc/Application.h -@@ -392,6 +392,8 @@ public: - */ - void UnregisterActionListener(IActionListener *listener); - -+ bool ScreenSaverDisablesAutoScrolling(); -+ - std::unique_ptr m_ServiceManager; - - /*! -diff --git a/xbmc/guilib/GUIFadeLabelControl.cpp b/xbmc/guilib/GUIFadeLabelControl.cpp -index 01826a5f7ca2ccb104f897ca0670571a9b04b83d..553a6458a71009dd592c8a843eeb3bc336864d61 100644 ---- a/xbmc/guilib/GUIFadeLabelControl.cpp -+++ b/xbmc/guilib/GUIFadeLabelControl.cpp -@@ -21,6 +21,8 @@ - #include "GUIFadeLabelControl.h" - #include "utils/Random.h" - -+#include "Application.h" -+ - CGUIFadeLabelControl::CGUIFadeLabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool scrollOut, unsigned int timeToDelayAtEnd, bool resetOnLabelChange, bool randomized) - : CGUIControl(parentID, controlID, posX, posY, width, height), m_label(labelInfo), m_scrollInfo(50, labelInfo.offsetX, labelInfo.scrollSpeed) - , m_textLayout(labelInfo.font, false) -@@ -106,7 +108,7 @@ void CGUIFadeLabelControl::Process(unsigned int currentTime, CDirtyRegionList &d - m_lastLabel = m_currentLabel; - } - -- if (m_infoLabels.size() > 1 || !m_shortText) -+ if ((m_infoLabels.size() > 1 || !m_shortText) && !g_application.ScreenSaverDisablesAutoScrolling()) - { // have scrolling text - bool moveToNextLabel = false; - if (!m_scrollOut) -diff --git a/xbmc/guilib/GUIFont.cpp b/xbmc/guilib/GUIFont.cpp -index 7f1108939a63162024c7a055403a58e395f090b6..1192b74675b79d1a862de2949a60163abb916035 100644 ---- a/xbmc/guilib/GUIFont.cpp -+++ b/xbmc/guilib/GUIFont.cpp -@@ -22,6 +22,7 @@ - #include "GUIFontTTF.h" - #include "GraphicContext.h" - -+#include "Application.h" - #include "threads/SingleLock.h" - #include "utils/TimeUtils.h" - #include "utils/MathUtils.h" -@@ -128,6 +129,9 @@ bool CGUIFont::UpdateScrollInfo(const vecText &text, CScrollInfo &scrollInfo) - // If the string is smaller than the viewport, then it may be plotted even - // more times than that. - // -+ if (g_application.ScreenSaverDisablesAutoScrolling()) -+ return false; -+ - if (scrollInfo.waitTime) - { - scrollInfo.waitTime--; -diff --git a/xbmc/guilib/GUILabel.cpp b/xbmc/guilib/GUILabel.cpp -index f15e847ec43d07b44660caec9f8faca780b0a061..ba88a7c5e45da13404d59dfbf1bbc8b93d3528c1 100644 ---- a/xbmc/guilib/GUILabel.cpp -+++ b/xbmc/guilib/GUILabel.cpp -@@ -21,6 +21,8 @@ - #include "GUILabel.h" - #include - -+#include "Application.h" -+ - CGUILabel::CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, CGUILabel::OVER_FLOW overflow) - : m_label(labelInfo) - , m_textLayout(labelInfo.font, overflow == OVER_FLOW_WRAP, height) -@@ -103,7 +105,7 @@ void CGUILabel::Render() - color_t color = GetColor(); - bool renderSolid = (m_color == COLOR_DISABLED); - bool overFlows = (m_renderRect.Width() + 0.5f < m_textLayout.GetTextWidth()); // 0.5f to deal with floating point rounding issues -- if (overFlows && m_scrolling && !renderSolid) -+ if (overFlows && m_scrolling && !renderSolid && !g_application.ScreenSaverDisablesAutoScrolling()) - m_textLayout.RenderScrolling(m_renderRect.x1, m_renderRect.y1, m_label.angle, color, m_label.shadowColor, 0, m_renderRect.Width(), m_scrollInfo); - else - { -diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp -index d7bc1c5ba6067af9a460589920367288c640a915..ac766293f1c47c7f145cb46f6b152144b303f15f 100644 ---- a/xbmc/guilib/GUITextBox.cpp -+++ b/xbmc/guilib/GUITextBox.cpp -@@ -24,6 +24,7 @@ - #include "utils/MathUtils.h" - #include "utils/StringUtils.h" - #include "guiinfo/GUIInfoLabels.h" -+#include "Application.h" - - #include - -@@ -133,7 +134,7 @@ void CGUITextBox::Process(unsigned int currentTime, CDirtyRegionList &dirtyregio - // update our auto-scrolling as necessary - if (m_autoScrollTime && m_lines.size() > m_itemsPerPage) - { -- if (!m_autoScrollCondition || m_autoScrollCondition->Get()) -+ if ((!m_autoScrollCondition || m_autoScrollCondition->Get()) && !g_application.ScreenSaverDisablesAutoScrolling()) - { - if (m_lastRenderTime) - m_autoScrollDelayTime += currentTime - m_lastRenderTime; - -From 8a1f8bb315f494840e8b5807f257463c57532fd6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 16/62] [demuxer] Avoid memcpy on every demuxer packet - -Avoids an unnecessary memcpy on every demuxer packet which for -high bitrate videos can be significant. ---- - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 17 ++++++++++++----- - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h | 3 +++ - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp | 7 ++++++- - 3 files changed, 21 insertions(+), 6 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 33d1e5ab627d8099018190699f3b532c2b1f3b08..e015e65dea43e7b682b704edb7f468b63b8c2ac5 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -921,7 +921,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - { - if(m_pkt.pkt.stream_index == (int)m_pFormatContext->programs[m_program]->stream_index[i]) - { -- pPacket = CDVDDemuxUtils::AllocateDemuxPacket(m_pkt.pkt.size); -+ pPacket = CDVDDemuxUtils::AllocateDemuxPacket(0); - break; - } - } -@@ -930,7 +930,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - bReturnEmpty = true; - } - else -- pPacket = CDVDDemuxUtils::AllocateDemuxPacket(m_pkt.pkt.size); -+ pPacket = CDVDDemuxUtils::AllocateDemuxPacket(0); - } - else - bReturnEmpty = true; -@@ -960,9 +960,13 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - // copy contents into our own packet - pPacket->iSize = m_pkt.pkt.size; - -- // maybe we can avoid a memcpy here by detecting where pkt.destruct is pointing too? - if (m_pkt.pkt.data) -- memcpy(pPacket->pData, m_pkt.pkt.data, pPacket->iSize); -+ { -+ pPacket->pData = m_pkt.pkt.data; -+ // so we can free AVPacket when DemuxPacket is freed -+ pPacket->pkt = new AVPacket(m_pkt.pkt); -+ } -+ - - pPacket->pts = ConvertTimestamp(m_pkt.pkt.pts, stream->time_base.den, stream->time_base.num); - pPacket->dts = ConvertTimestamp(m_pkt.pkt.dts, stream->time_base.den, stream->time_base.num); -@@ -1016,7 +1020,10 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - pPacket->iStreamId = m_pkt.pkt.stream_index; - } - m_pkt.result = -1; -- av_packet_unref(&m_pkt.pkt); -+ if (pPacket && pPacket->pkt) -+ memset(&m_pkt.pkt, 0, sizeof(AVPacket)); -+ else -+ av_packet_unref(&m_pkt.pkt); - } - } - } // end of lock scope -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h -index 4f471188c133deb91516311f0082e8741d9dee79..22805781c4d5a957d10fdf74ffa34387f67a25e9 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h -@@ -25,6 +25,8 @@ - #define DMX_SPECIALID_STREAMINFO -10 - #define DMX_SPECIALID_STREAMCHANGE -11 - -+struct AVPacket; -+ - typedef struct DemuxPacket - { - unsigned char* pData; // data -@@ -36,6 +38,7 @@ typedef struct DemuxPacket - double pts; // pts in DVD_TIME_BASE - double dts; // dts in DVD_TIME_BASE - double duration; // duration in DVD_TIME_BASE if available -+ AVPacket *pkt; // to allow packet to be freed - - int dispTime; - } DemuxPacket; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp -index df0f35bd49c65b302de4ccd110d859e8b881ea5f..b4b591ae4c4dd4fb0b36d4d00fedca966f86000f 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxUtils.cpp -@@ -39,7 +39,12 @@ void CDVDDemuxUtils::FreeDemuxPacket(DemuxPacket* pPacket) - if (pPacket) - { - try { -- if (pPacket->pData) _aligned_free(pPacket->pData); -+ if (pPacket->pkt) -+ { -+ av_free_packet(pPacket->pkt); -+ delete pPacket->pkt; -+ } -+ else if (pPacket->pData) _aligned_free(pPacket->pData); - delete pPacket; - } - catch(...) { - -From 83250abe1869bc07d70466de8bb6f9d6342aec7c Mon Sep 17 00:00:00 2001 -From: anaconda -Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 17/62] Load OSD dialogs on startup. - -Fixes skipped frames the first time they're loaded in memory on less powered -devices, like a Raspberry Pi, when using DVDPlayer. -See http://forum.kodi.tv/showthread.php?tid=211501&pid=1938811#pid1938811 ---- - xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp | 1 + - xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp | 1 + - xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp | 4 +++- - xbmc/video/dialogs/GUIDialogSubtitles.cpp | 2 +- - xbmc/video/dialogs/GUIDialogVideoOSD.cpp | 2 +- - xbmc/video/dialogs/GUIDialogVideoSettings.cpp | 4 +++- - 6 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -index 1beb8560a1030f6198b22f5d9c082a27dd85d8a8..ca7c90b0c4a7fc34a31fe6dcf787b8980d28df71 100644 ---- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -+++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -@@ -49,6 +49,7 @@ using namespace KODI::MESSAGING; - CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : - CGUIDialog(WINDOW_DIALOG_PVR_OSD_CHANNELS, "DialogPVRChannelsOSD.xml") - { -+ m_loadType = LOAD_ON_GUI_INIT; - m_vecItems = new CFileItemList; - } - -diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp -index 8b472435e26e455249637faf5120055b415fc49e..be1f64d552161f8a86a5c5d89c1bc23328574fb6 100644 ---- a/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp -+++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideOSD.cpp -@@ -36,6 +36,7 @@ using namespace PVR; - CGUIDialogPVRGuideOSD::CGUIDialogPVRGuideOSD() - : CGUIDialog(WINDOW_DIALOG_PVR_OSD_GUIDE, "DialogPVRGuideOSD.xml") - { -+ m_loadType = LOAD_ON_GUI_INIT; - m_vecItems = new CFileItemList; - } - -diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -index eb67552344f59b8857b16c882c29e3fa62bed75c..f31572b34d376e70a35003a8c2e175b45daf8070 100644 ---- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp -@@ -68,7 +68,9 @@ CGUIDialogAudioSubtitleSettings::CGUIDialogAudioSubtitleSettings() - : CGUIDialogSettingsManualBase(WINDOW_DIALOG_AUDIO_OSD_SETTINGS, "DialogSettings.xml"), - m_passthrough(false), - m_dspEnabled(false) --{ } -+{ -+ m_loadType = LOAD_ON_GUI_INIT; -+} - - CGUIDialogAudioSubtitleSettings::~CGUIDialogAudioSubtitleSettings() - { } -diff --git a/xbmc/video/dialogs/GUIDialogSubtitles.cpp b/xbmc/video/dialogs/GUIDialogSubtitles.cpp -index 398558e4d5d0cae30ee1c73e2b70e3b2f787e8fc..4e8a9b1e307a89d3a7b68402e2ff11b57e7dccd4 100644 ---- a/xbmc/video/dialogs/GUIDialogSubtitles.cpp -+++ b/xbmc/video/dialogs/GUIDialogSubtitles.cpp -@@ -103,7 +103,7 @@ CGUIDialogSubtitles::CGUIDialogSubtitles(void) - , m_pausedOnRun(false) - , m_updateSubsList(false) - { -- m_loadType = KEEP_IN_MEMORY; -+ m_loadType = LOAD_ON_GUI_INIT; - } - - CGUIDialogSubtitles::~CGUIDialogSubtitles(void) -diff --git a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp -index e498e1fd476d9ab5300bb00bc39946a22cfd93cb..a6648d016b07e2eb3e52f8d927697cc53a42fd7b 100644 ---- a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp -+++ b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp -@@ -30,7 +30,7 @@ using namespace PVR; - CGUIDialogVideoOSD::CGUIDialogVideoOSD(void) - : CGUIDialog(WINDOW_DIALOG_VIDEO_OSD, "VideoOSD.xml") - { -- m_loadType = KEEP_IN_MEMORY; -+ m_loadType = LOAD_ON_GUI_INIT; - } - - CGUIDialogVideoOSD::~CGUIDialogVideoOSD(void) -diff --git a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -index 0534828dd85520134f7a6890e43a873e223062c1..5a86dfc1e2a54c8fe8d82cb75b612d8e1a0fd2a7 100644 ---- a/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -+++ b/xbmc/video/dialogs/GUIDialogVideoSettings.cpp -@@ -66,7 +66,9 @@ - CGUIDialogVideoSettings::CGUIDialogVideoSettings() - : CGUIDialogSettingsManualBase(WINDOW_DIALOG_VIDEO_OSD_SETTINGS, "DialogSettings.xml"), - m_viewModeChanged(false) --{ } -+{ -+ m_loadType = LOAD_ON_GUI_INIT; -+} - - CGUIDialogVideoSettings::~CGUIDialogVideoSettings() - { } - -From c75aecfa32c369f2728247347c4edd34c3cd5e6a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 14 Apr 2015 20:51:14 +0100 -Subject: [PATCH 18/62] [gui] Also limit GUI updates when in non full-screen - video mode - ---- - xbmc/Application.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index cf77c3dbb84b86c755ee792294760c5c4c38742d..adbfef5f32d3d205f2410e1aabbd8325dd90f8e2 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2762,7 +2762,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) - #if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU) - // This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode - // it makes only sense on architectures with multiple layers -- if (g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback() && m_pPlayer->IsRenderingVideoLayer()) -+ if (m_pPlayer->IsPlayingVideo() && !m_pPlayer->IsPausedPlayback() && m_pPlayer->IsRenderingVideoLayer()) - fps = CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE); - #endif - -@@ -2775,6 +2775,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) - { - if (!m_skipGuiRender) - g_windowManager.Process(CTimeUtils::GetFrameTime()); -+ else if (!g_graphicsContext.IsFullScreenVideo()) -+ g_windowManager.FrameMove(); - } - g_windowManager.FrameMove(); - } - -From 6bbda4d7e81f32b2e046e81fc7ea3d810b117eae Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:58:06 +0100 -Subject: [PATCH 19/62] [screensaver] Leave GUI contents available for - screensaver - ---- - xbmc/guilib/GUIWindowManager.cpp | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index 5808f7ed1e94d68ead7305ba6d284edd4df12bdd..2a3b7f16531c9822e79c77efabdd30acdaa2a3c9 100644 ---- a/xbmc/guilib/GUIWindowManager.cpp -+++ b/xbmc/guilib/GUIWindowManager.cpp -@@ -795,7 +795,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector - int currentWindow = GetActiveWindow(); - CGUIWindow *pWindow = GetWindow(currentWindow); - if (pWindow) -- CloseWindowSync(pWindow, iWindowID); -+ { -+ if (iWindowID == WINDOW_SCREENSAVER) -+ { -+ pWindow->Close(true, iWindowID); -+ } -+ else -+ { -+ CloseWindowSync(pWindow, iWindowID); -+ } -+ } - g_infoManager.SetNextWindow(WINDOW_INVALID); - - // Add window to the history list (we must do this before we activate it, - -From cb881f3dae6d748dcc06616d5937a7f5c806a3a6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 6 Jun 2015 18:43:57 +0100 -Subject: [PATCH 20/62] ffmpeg: Automatic switch to software decode for GMC - with more than one warp point - ---- - ...Signal-unsupported-GMC-with-more-than-one.patch | 48 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 4 +- - tools/depends/target/ffmpeg/autobuild.sh | 2 + - .../VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 6 +++ - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h | 2 + - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 2 +- - xbmc/cores/VideoPlayer/DVDStreamInfo.cpp | 3 ++ - xbmc/cores/VideoPlayer/DVDStreamInfo.h | 1 + - xbmc/cores/omxplayer/OMXHelper.cpp | 8 +++- - 9 files changed, 73 insertions(+), 3 deletions(-) - create mode 100644 tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - -diff --git a/tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch b/tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..4cb8dd8fc466220e5d2539120de79ab123e65713 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -@@ -0,0 +1,48 @@ -+From 84e9a1784bbd3182b68cefa5e5feae8da8b9e184 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Fri, 5 Jun 2015 22:48:33 +0100 -+Subject: [PATCH] mpeg4video: Signal unsupported GMC with more than one warp -+ point -+ -+--- -+ libavcodec/avcodec.h | 1 + -+ libavcodec/mpeg4videodec.c | 4 ++++ -+ 2 files changed, 5 insertions(+) -+ -+diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -+index 8c7c420..e63dc2d 100644 -+--- a/libavcodec/avcodec.h -++++ b/libavcodec/avcodec.h -+@@ -2527,6 +2527,7 @@ typedef struct AVCodecContext { -+ #define FF_BUG_DC_CLIP 4096 -+ #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. -+ #define FF_BUG_TRUNCATED 16384 -++#define FF_BUG_GMC_UNSUPPORTED 32768 -+ -+ /** -+ * strictly follow the standard (MPEG4, ...). -+diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c -+index 9bf33dd..0b5d3b9 100644 -+--- a/libavcodec/mpeg4videodec.c -++++ b/libavcodec/mpeg4videodec.c -+@@ -2179,6 +2179,9 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) -+ -+ if (ctx->divx_version >= 0) -+ s->workaround_bugs |= FF_BUG_HPEL_CHROMA; -++ -++ if (ctx->num_sprite_warping_points > 1) -++ s->workaround_bugs |= FF_BUG_GMC_UNSUPPORTED; -+ } -+ -+ if (s->workaround_bugs & FF_BUG_STD_QPEL) { -+@@ -2203,6 +2206,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx) -+ s->workaround_bugs, ctx->lavc_build, ctx->xvid_build, -+ ctx->divx_version, ctx->divx_build, s->divx_packed ? "p" : ""); -+ -++ avctx->workaround_bugs = s->workaround_bugs; -+ if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 && -+ s->codec_id == AV_CODEC_ID_MPEG4 && -+ avctx->idct_algo == FF_IDCT_AUTO) { -+-- -+1.9.1 -+ -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index eaf9fc49319d5f0ee450ddd802bba569e291f0b5..8dd14cdfd053f142f386b6dee1fc0b21bb1f8d93 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,7 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ -+ 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -76,6 +77,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - rm -rf $(PLATFORM); mkdir -p $(PLATFORM) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure -+ cd $(PLATFORM); patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index 5c2976278eb5ec5b8b4a4f9f9c7174b164ab5201..dde29adf425e54f54e4104b3370352db0be6ef40 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -132,6 +132,8 @@ mkdir -p "ffmpeg-${VERSION}" - cd "ffmpeg-${VERSION}" || exit 2 - tar --strip-components=1 -xf $MYDIR/${ARCHIVE} - -+patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+ - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ - --extra-version="kodi-${VERSION}" \ -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index ff3729bde30c0e46de67c4df9b01ee5846c181ee..822b7bf75f2e732b5eed8687403d0eda503fa641 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -47,6 +47,10 @@ - - #include "linux/RBP.h" - -+#ifndef FF_BUG_GMC_UNSUPPORTED -+#define FF_BUG_GMC_UNSUPPORTED 0 -+#endif -+ - using namespace KODI::MESSAGING; - - #define CLASSNAME "CMMALVideoBuffer" -@@ -367,6 +371,8 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - // we always qualify even if DVDFactoryCodec does this too. - if (!CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMMAL) || hints.software) - return false; -+ if (hints.workaround_bugs & FF_BUG_GMC_UNSUPPORTED) -+ return false; - - std::list deintMethods; - deintMethods.push_back(EINTERLACEMETHOD::VS_INTERLACEMETHOD_AUTO); -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h -index 3bb003b634c83d2c1b0ecd12b53027950e58be99..24341dc23e97e86e1b20b255548573c88e02f064 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h -@@ -157,6 +157,7 @@ public: - type = STREAM_VIDEO; - iOrientation = 0; - iBitsPerPixel = 0; -+ workaround_bugs = 0; - } - - virtual ~CDemuxStreamVideo() {} -@@ -171,6 +172,7 @@ public: - int iOrientation; // orientation of the video in degress counter clockwise - int iBitsPerPixel; - std::string stereo_mode; // expected stereo mode -+ int workaround_bugs; // info for decoder - }; - - class CDemuxStreamAudio : public CDemuxStream -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index e015e65dea43e7b682b704edb7f468b63b8c2ac5..54a18c669a058b705e0276cb7e14522ae6cd04ae 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1416,7 +1416,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - if (!stereoMode.empty()) - st->stereo_mode = stereoMode; - -- -+ st->workaround_bugs = pStream->codec->workaround_bugs; - if ( m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD) ) - { - if (pStream->codec->codec_id == AV_CODEC_ID_PROBE) -diff --git a/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp b/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp -index e59c84c32ff6f108b52955523321f37bd3885986..28dbdd344473338762927f5f2d01425243187a7c 100644 ---- a/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp -+++ b/xbmc/cores/VideoPlayer/DVDStreamInfo.cpp -@@ -74,6 +74,7 @@ void CDVDStreamInfo::Clear() - channellayout = 0; - - orientation = 0; -+ workaround_bugs = 0; - } - - bool CDVDStreamInfo::Equal(const CDVDStreamInfo& right, bool withextradata) -@@ -175,6 +176,7 @@ void CDVDStreamInfo::Assign(const CDVDStreamInfo& right, bool withextradata) - vfr = right.vfr; - software = right.software; - stereo_mode = right.stereo_mode; -+ workaround_bugs = right.workaround_bugs; - - // AUDIO - channels = right.channels; -@@ -233,6 +235,7 @@ void CDVDStreamInfo::Assign(const CDemuxStream& right, bool withextradata) - orientation = stream->iOrientation; - bitsperpixel = stream->iBitsPerPixel; - stereo_mode = stream->stereo_mode; -+ workaround_bugs = stream->workaround_bugs; - } - else if( right.type == STREAM_SUBTITLE ) - { -diff --git a/xbmc/cores/VideoPlayer/DVDStreamInfo.h b/xbmc/cores/VideoPlayer/DVDStreamInfo.h -index f14170850673ebf746df0acf8f5cf5977feae684..85e402bb4e1ddd61bdb657802cc7347c95b9a302 100644 ---- a/xbmc/cores/VideoPlayer/DVDStreamInfo.h -+++ b/xbmc/cores/VideoPlayer/DVDStreamInfo.h -@@ -73,6 +73,7 @@ public: - int orientation; // orientation of the video in degress counter clockwise - int bitsperpixel; - std::string stereo_mode; // stereoscopic 3d mode -+ int workaround_bugs; // info for decoder - - // AUDIO - int channels; -diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp -index f135d423c0ca76fd70e79ae5b7d035f0cb79fc75..d9b576bc46055fdab1c134e5f2c63cd4989d015c 100644 ---- a/xbmc/cores/omxplayer/OMXHelper.cpp -+++ b/xbmc/cores/omxplayer/OMXHelper.cpp -@@ -30,6 +30,10 @@ - #include "cores/omxplayer/OMXPlayerVideo.h" - #include "threads/SystemClock.h" - -+#ifndef FF_BUG_GMC_UNSUPPORTED -+#define FF_BUG_GMC_UNSUPPORTED 0 -+#endif -+ - #define PREDICATE_RETURN(lh, rh) \ - do { \ - if((lh) != (rh)) \ -@@ -81,7 +85,9 @@ bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer - CDVDStreamInfo hint(*stream, true); - - bool supported = false; -- if ((hint.codec == AV_CODEC_ID_MPEG1VIDEO || hint.codec == AV_CODEC_ID_MPEG2VIDEO) && g_RBP.GetCodecMpg2()) -+ if (hint.workaround_bugs & FF_BUG_GMC_UNSUPPORTED) -+ ; -+ else if ((hint.codec == AV_CODEC_ID_MPEG1VIDEO || hint.codec == AV_CODEC_ID_MPEG2VIDEO) && g_RBP.GetCodecMpg2()) - supported = true; - else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) - supported = true; - -From b5b121249287c4d102d61ae0aafa05f40e79af44 Mon Sep 17 00:00:00 2001 -From: Claudio-Sjo -Date: Mon, 16 Feb 2015 14:51:26 +0100 -Subject: [PATCH 21/62] - allow reads < CDIO_CD_FRAMESIZE_RAW by using a buffer - - fixes #15794 - ---- - xbmc/filesystem/CDDAFile.cpp | 120 ++++++++++++++++++++++++++++++++----------- - xbmc/filesystem/CDDAFile.h | 3 ++ - 2 files changed, 92 insertions(+), 31 deletions(-) - -diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp -index 722e62602084923bd040803f0e5a5c336a42fa3b..b0f53e5d44e108d88d7af0e46913a7f29328cd31 100644 ---- a/xbmc/filesystem/CDDAFile.cpp -+++ b/xbmc/filesystem/CDDAFile.cpp -@@ -42,10 +42,14 @@ CFileCDDA::CFileCDDA(void) - m_lsnEnd = CDIO_INVALID_LSN; - m_cdio = CLibcdio::GetInstance(); - m_iSectorCount = 52; -+ m_TrackBuf = (uint8_t *) malloc(CDIO_CD_FRAMESIZE_RAW); -+ p_TrackBuf = 0; -+ f_TrackBuf = 0; - } - - CFileCDDA::~CFileCDDA(void) - { -+ free(m_TrackBuf); - Close(); - } - -@@ -53,6 +57,9 @@ bool CFileCDDA::Open(const CURL& url) - { - std::string strURL = url.GetWithoutFilename(); - -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url)) - return false; - -@@ -117,50 +124,98 @@ int CFileCDDA::Stat(const CURL& url, struct __stat64* buffer) - - ssize_t CFileCDDA::Read(void* lpBuf, size_t uiBufSize) - { -- if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -- return -1; - -- if (uiBufSize > SSIZE_MAX) -- uiBufSize = SSIZE_MAX; -+ ssize_t returnValue; -+ int iSectorCount; -+ void *destBuf; - -- // limit number of sectors that fits in buffer by m_iSectorCount -- int iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); - -- if (iSectorCount <= 0) -+ if (!m_pCdIo || !g_mediaManager.IsDiscInDrive()) -+ { -+ CLog::Log(LOGERROR, "file cdda: Aborted because no disc in drive or no m_pCdIo"); - return -1; -+ } - -- // Are there enough sectors left to read -- if (m_lsnCurrent + iSectorCount > m_lsnEnd) -- iSectorCount = m_lsnEnd - m_lsnCurrent; -+ uiBufSize = std::min( uiBufSize, (size_t)SSIZE_MAX ); - -- // The loop tries to solve read error problem by lowering number of sectors to read (iSectorCount). -- // When problem is solved the proper number of sectors is stored in m_iSectorCount -- int big_iSectorCount = iSectorCount; -- while (iSectorCount > 0) -+ // If we have data in the TrackBuffer, they must be used first -+ if (f_TrackBuf) - { -- int iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, lpBuf, m_lsnCurrent, iSectorCount); -+ // Get at most the remaining data in m_TrackBuf -+ uiBufSize = std::min(uiBufSize, CDIO_CD_FRAMESIZE_RAW - p_TrackBuf); -+ memcpy(lpBuf, m_TrackBuf + p_TrackBuf, uiBufSize); -+ // Update the data offset -+ p_TrackBuf += uiBufSize; -+ // Is m_TrackBuf empty? -+ f_TrackBuf = (CDIO_CD_FRAMESIZE_RAW == p_TrackBuf); -+ // All done, return read bytes -+ return uiBufSize; -+ } -+ -+ // No data left in buffer -+ -+ // Is this a short read? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // short request, buffer one full sector -+ iSectorCount = 1; -+ destBuf = m_TrackBuf; -+ } -+ else // normal request -+ { -+ // limit number of sectors that fits in buffer by m_iSectorCount -+ iSectorCount = std::min((int)uiBufSize / CDIO_CD_FRAMESIZE_RAW, m_iSectorCount); -+ destBuf = lpBuf; -+ } - -+ // Are there enough sectors left to read? -+ iSectorCount = std::min(iSectorCount, m_lsnEnd - m_lsnCurrent); -+ -+ // Have we reached EOF? -+ if (iSectorCount == 0) -+ { -+ CLog::Log(LOGNOTICE, "file cdda: Read EoF"); -+ return 0; // Success, but nothing read -+ } // Reached EoF -+ -+ // At leat one sector to read -+ int retries; -+ int iret; -+ // Try reading a decresing number of sectors, then 3 times with 1 sector -+ for (retries = 3; retries > 0; iSectorCount>1 ? iSectorCount-- : retries--) -+ { -+ iret = m_cdio->cdio_read_audio_sectors(m_pCdIo, destBuf, m_lsnCurrent, iSectorCount); - if (iret == DRIVER_OP_SUCCESS) -+ break; // Get out from the loop -+ else - { -- // If lower iSectorCount solved the problem limit it's value -- if (iSectorCount < big_iSectorCount) -- { -- m_iSectorCount = iSectorCount; -- } -- break; -- } -- -- // iSectorCount is low so it cannot solve read problem -- if (iSectorCount <= 10) -- { -- CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -- return -1; -- } -- -- iSectorCount = 10; -+ CLog::Log(LOGERROR, "file cdda: Read cdio error when reading track "); -+ } // Errors when reading file - } -+ // retries == 0 only if failed reading at least one sector -+ if (retries == 0) -+ { -+ CLog::Log(LOGERROR, "file cdda: Reading %d sectors of audio data starting at lsn %d failed with error code %i", iSectorCount, m_lsnCurrent, iret); -+ return -1; -+ } -+ -+ // Update position in file - m_lsnCurrent += iSectorCount; - -+ // Was it a short request? -+ if (uiBufSize < CDIO_CD_FRAMESIZE_RAW) -+ { -+ // We copy the amount if requested data into the destination buffer -+ memcpy(lpBuf, m_TrackBuf, uiBufSize); -+ // and keep track of the first available data -+ p_TrackBuf = uiBufSize; -+ // Finally, we set the buffer flag as TRUE -+ f_TrackBuf = true; -+ // We will return uiBufSize -+ return uiBufSize; -+ } -+ -+ // Otherwise, just return the size of read data - return iSectorCount*CDIO_CD_FRAMESIZE_RAW; - } - -@@ -194,6 +249,9 @@ int64_t CFileCDDA::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/) - - void CFileCDDA::Close() - { -+ // Flag TrackBuffer = FALSE, TrackBuffer is empty -+ f_TrackBuf = 0; -+ - if (m_pCdIo) - { - m_cdio->cdio_destroy(m_pCdIo); -diff --git a/xbmc/filesystem/CDDAFile.h b/xbmc/filesystem/CDDAFile.h -index 0427af4534bfe59a343f0518c7f4242d93299836..e99236294fa8b9b613e465a8ecaf3ad3ba8b5a6f 100644 ---- a/xbmc/filesystem/CDDAFile.h -+++ b/xbmc/filesystem/CDDAFile.h -@@ -50,6 +50,9 @@ protected: - - protected: - CdIo_t* m_pCdIo; -+ uint8_t *m_TrackBuf; -+ size_t p_TrackBuf; -+ int f_TrackBuf; - lsn_t m_lsnStart; // Start of m_iTrack in logical sector number - lsn_t m_lsnCurrent; // Position inside the track in logical sector number - lsn_t m_lsnEnd; // End of m_iTrack in logical sector number - -From 2a304750b765450dfb217e6a51ceeeb2eeb79741 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 24 Jun 2016 19:38:13 +0100 -Subject: [PATCH 22/62] codecoverlay: Include codec name in overlay - ---- - xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 4 ++++ - xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 5 ++++- - xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 4 ++++ - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 8 +++++--- - xbmc/cores/omxplayer/OMXPlayerVideo.h | 1 - - 5 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -index f822935ab7fc919128db53f70a6c4eb84d9759bc..9db3a9cc91fd5f9b194d6c1aa66aa02121164c29 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -@@ -210,6 +210,10 @@ void CVideoPlayerAudio::UpdatePlayerInfo() - std::ostringstream s; - s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel()) << "%"; - s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0; -+ s << ", ac:" << m_processInfo.GetAudioDecoderName().c_str(); -+ if (!m_info.passthrough) -+ s << ", chan:" << m_processInfo.GetAudioChannels().c_str(); -+ s << ", " << m_streaminfo.samplerate/1000 << " kHz"; - - //print the inverse of the resample ratio, since that makes more sense - //if the resample ratio is 0.5, then we're playing twice as fast -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -index 89db27cce079e3e273050f2fa71f941f21b8280b..903f0d83527d9088ff1bf0ba056f357f6abfda81 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -@@ -895,10 +895,13 @@ int CVideoPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) - - std::string CVideoPlayerVideo::GetPlayerInfo() - { -+ int width, height; -+ m_processInfo.GetVideoDimensions(width, height); - std::ostringstream s; - s << "vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; - s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0); -- s << ", fr:" << std::fixed << std::setprecision(3) << m_fFrameRate; -+ s << ", dc:" << m_processInfo.GetVideoDecoderName().c_str(); -+ s << ", " << width << "x" << height << "[" << std::setprecision(2) << m_processInfo.GetVideoDAR() << "]@" << std::fixed << std::setprecision(3) << m_processInfo.GetVideoFps() << ", deint:" << m_processInfo.GetVideoDeintMethod(); - s << ", drop:" << m_iDroppedFrames; - s << ", skip:" << m_renderManager.GetSkippedFrames(); - -diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index 1e5d2b98bbef15b47994c3e4735873a9946b58c7..d43350fa0eefb5960475a02c1327efc24d138e0f 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -659,6 +659,10 @@ std::string OMXPlayerAudio::GetPlayerInfo() - std::ostringstream s; - s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel() + MathUtils::round_int(100.0/8.0*GetCacheTime())) << "%"; - s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0; -+ s << ", ac:" << m_processInfo.GetAudioDecoderName().c_str(); -+ if (!m_passthrough) -+ s << ", chan:" << m_processInfo.GetAudioChannels().c_str(); -+ s << ", " << m_processInfo.GetAudioSampleRate()/1000 << " kHz"; - - return s.str(); - } -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index a4b663d43d5b626e351256a1dd10650a282b494c..f6fb241dfec9269f4e501248de4dc83d5fdc2d3a 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -593,12 +593,14 @@ void OMXPlayerVideo::SetSpeed(int speed) - - std::string OMXPlayerVideo::GetPlayerInfo() - { -+ int width, height; -+ m_processInfo.GetVideoDimensions(width, height); - double match = 0.0f, phase = 0.0f, pll = 0.0f; - std::ostringstream s; -- s << "fr:" << std::fixed << std::setprecision(3) << m_fFrameRate; -- s << ", vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; -- s << ", dc:" << m_codecname; -+ s << "vq:" << std::setw(2) << std::min(99,GetLevel()) << "%"; - s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0); -+ s << ", dc:" << m_processInfo.GetVideoDecoderName().c_str(); -+ s << ", " << width << "x" << height << "[" << std::setprecision(2) << m_processInfo.GetVideoDAR() << "]@" << std::fixed << std::setprecision(3) << m_processInfo.GetVideoFps() << ", deint:" << m_processInfo.GetVideoDeintMethod(); - if (m_omxVideo.GetPlayerInfo(match, phase, pll)) - { - s << ", match:" << std::fixed << std::setprecision(2) << match; -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h -index 0df7e72cc9d1947173c2bac5e72eb09976b51aa5..b5050081c360d29b1b478c27e6b88291e20ecdac 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.h -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h -@@ -55,7 +55,6 @@ protected: - bool m_stalled; - IDVDStreamPlayer::ESyncState m_syncState; - bool m_flush; -- std::string m_codecname; - std::atomic_bool m_bAbortOutput; - double m_iSubtitleDelay; - bool m_bRenderSubs; - -From 9ebfa6f23b211491275577d8022c4f83b5171ba4 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Tue, 8 Mar 2016 21:20:58 +0300 -Subject: [PATCH 23/62] [DebugInfo] Add cpu usage info. - ---- - .../VideoPlayer/VideoRenderers/DebugRenderer.cpp | 56 ++++++++-------------- - .../VideoPlayer/VideoRenderers/DebugRenderer.h | 9 ++-- - .../VideoPlayer/VideoRenderers/RenderManager.cpp | 7 ++- - 3 files changed, 30 insertions(+), 42 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp -index 539a560f9554478ad25a5631121dc74e667d9b40..08721e153e5f3232585eb776d1d1b44396f63de4 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.cpp -@@ -28,7 +28,7 @@ using namespace OVERLAY; - - CDebugRenderer::CDebugRenderer() - { -- for (int i=0; i<4; i++) -+ for (int i = 0; iRelease(); - } - } - --void CDebugRenderer::SetInfo(std::string &info1, std::string &info2, std::string &info3, std::string &info4) -+void CDebugRenderer::SetInfo(std::vector &infos) - { - m_overlayRenderer.Release(0); - -- if (info1 != m_strDebug[0]) -+ for (size_t i = 0; i < std::min(infos.size(), (size_t)DEBUG_OVERLAY_COUNT_MAX); i++) - { -- m_strDebug[0] = info1; -- if (m_overlay[0]) -- m_overlay[0]->Release(); -- m_overlay[0] = new CDVDOverlayText(); -- m_overlay[0]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[0])); -- } -- if (info2 != m_strDebug[1]) -- { -- m_strDebug[1] = info2; -- if (m_overlay[1]) -- m_overlay[1]->Release(); -- m_overlay[1] = new CDVDOverlayText(); -- m_overlay[1]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[1])); -- } -- if (info3 != m_strDebug[2]) -- { -- m_strDebug[2] = info3; -- if (m_overlay[2]) -- m_overlay[2]->Release(); -- m_overlay[2] = new CDVDOverlayText(); -- m_overlay[2]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[2])); -+ if (infos[i] != m_strDebug[i]) -+ { -+ if (infos[i].empty()) -+ continue; -+ m_strDebug[i] = infos[i]; -+ if (m_overlay[i]) -+ m_overlay[i]->Release(); -+ m_overlay[i] = new CDVDOverlayText(); -+ m_overlay[i]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[i])); -+ } -+ - } -- if (info4 != m_strDebug[3]) -+ for (size_t i = 0; i < DEBUG_OVERLAY_COUNT_MAX; i++) - { -- m_strDebug[3] = info4; -- if (m_overlay[3]) -- m_overlay[3]->Release(); -- m_overlay[3] = new CDVDOverlayText(); -- m_overlay[3]->AddElement(new CDVDOverlayText::CElementText(m_strDebug[3])); -+ if (m_overlay[i]) -+ m_overlayRenderer.AddOverlay(m_overlay[i], 0, 0); - } -- -- m_overlayRenderer.AddOverlay(m_overlay[0], 0, 0); -- m_overlayRenderer.AddOverlay(m_overlay[1], 0, 0); -- m_overlayRenderer.AddOverlay(m_overlay[2], 0, 0); -- m_overlayRenderer.AddOverlay(m_overlay[3], 0, 0); - } - - void CDebugRenderer::Render(CRect &src, CRect &dst, CRect &view) -@@ -121,7 +103,7 @@ void CDebugRenderer::CRenderer::Render(int idx) - - COverlayText *text = dynamic_cast(o); - if (text) -- text->PrepareRender("arial.ttf", 1, 16, 0, m_font, m_fontBorder); -+ text->PrepareRender("arial.ttf", 1, 12, 0, m_font, m_fontBorder); - - RESOLUTION_INFO res = g_graphicsContext.GetResInfo(g_graphicsContext.GetVideoResolution()); - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h -index 85aefaace73994730f7d2bdff9de85c79e99b2a2..8005a13bc220be0c5c596d276197c11ed938ffb0 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/DebugRenderer.h -@@ -22,6 +22,9 @@ - - #include "OverlayRenderer.h" - #include -+#include -+ -+#define DEBUG_OVERLAY_COUNT_MAX 6 - - class CDVDOverlayText; - -@@ -30,7 +33,7 @@ class CDebugRenderer - public: - CDebugRenderer(); - virtual ~CDebugRenderer(); -- void SetInfo(std::string &info1, std::string &info2, std::string &info3, std::string &info4); -+ void SetInfo(std::vector &infos); - void Render(CRect &src, CRect &dst, CRect &view); - void Flush(); - -@@ -43,7 +46,7 @@ protected: - void Render(int idx) override; - }; - -- std::string m_strDebug[4]; -- CDVDOverlayText *m_overlay[4]; -+ std::string m_strDebug[DEBUG_OVERLAY_COUNT_MAX]; -+ CDVDOverlayText *m_overlay[DEBUG_OVERLAY_COUNT_MAX]; - CRenderer m_overlayRenderer; - }; -\ No newline at end of file -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -index 17c428cb28018707d7422f344191b218903ab29b..8626a1b449ff0963089f6a7ad191a6c99512521a 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -@@ -24,6 +24,7 @@ - #include "guilib/GraphicContext.h" - #include "utils/MathUtils.h" - #include "threads/SingleLock.h" -+#include "utils/CPUInfo.h" - #include "utils/log.h" - #include "utils/StringUtils.h" - #include "windowing/WindowingFactory.h" -@@ -926,7 +927,7 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui) - - if (m_renderDebug) - { -- std::string audio, video, player, vsync; -+ std::string audio, video, player, vsync, cpu; - - m_playerPort->GetDebugInfo(audio, video, player); - -@@ -940,8 +941,10 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui) - missedvblanks, - clockspeed * 100); - } -+ cpu = g_cpuInfo.GetCoresUsageString(); - -- m_debugRenderer.SetInfo(audio, video, player, vsync); -+ std::vector infos = { audio, video, player, vsync, cpu }; -+ m_debugRenderer.SetInfo(infos); - m_debugRenderer.Render(src, dst, view); - - m_debugTimer.Set(1000); - -From 37fedb68b098941bbdc5ace022806c75c908caf6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 22 May 2015 13:56:29 +0100 -Subject: [PATCH 24/62] ffmpeg: Allow neon to be enabled in unified builds - ---- - tools/depends/target/ffmpeg/Makefile | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 8dd14cdfd053f142f386b6dee1fc0b21bb1f8d93..b5f38a458dfb341c43089e07afded153e234b9cd 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -23,7 +23,11 @@ ffmpg_config += --enable-gnutls - ffmpg_config += --enable-encoder=png --enable-encoder=mjpeg - - ifeq ($(CROSS_COMPILING), yes) -+ ifeq ($(CPU), cortex-a7) -+ ffmpg_config += --arch=arm --enable-cross-compile -+ else - ffmpg_config += --arch=$(CPU) --enable-cross-compile -+ endif - endif - ifeq ($(OS), linux) - ffmpg_config += --target-os=$(OS) --cpu=$(CPU) - -From 2bfb7a3ff98dd858389dd3d064d8a3dc52a72af8 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 27 Feb 2015 14:37:27 +0000 -Subject: [PATCH 25/62] ffmpeg: Add some upstream HEVC optimisations - ---- - tools/depends/target/ffmpeg/Makefile | 6 +- - .../added_ARM_NEON_optimized_SAO_patches.patch | 3328 ++++++++++++++++++++ - tools/depends/target/ffmpeg/autobuild.sh | 2 + - ...hevcdsp_ARM_NEON_optimized_epel_functions.patch | 409 +++ - 4 files changed, 3744 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch - create mode 100644 tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index b5f38a458dfb341c43089e07afded153e234b9cd..c46b533e47497cb7b1e7200eff2cee1a6f2a1a2f 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,7 +1,8 @@ - include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ -- 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+ 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -82,6 +83,9 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig \&\& pkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+ cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+ cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch -+ - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch b/tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..792b5fea581613a6fe9108443357f97518f4b4db ---- /dev/null -+++ b/tools/depends/target/ffmpeg/added_ARM_NEON_optimized_SAO_patches.patch -@@ -0,0 +1,3328 @@ -+From b0cb307c253d2c9f4b94a54dfc74ddb83af984cc Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Mon, 8 Dec 2014 13:24:40 +0200 -+Subject: [PATCH 1/9] added ARM NEON optimized SAO band offset -+ -+--- -+ libavcodec/arm/Makefile | 3 +- -+ libavcodec/arm/hevcdsp_init_neon.c | 47 +++++++++ -+ libavcodec/arm/hevcdsp_sao_neon.S | 204 +++++++++++++++++++++++++++++++++++++ -+ 3 files changed, 253 insertions(+), 1 deletion(-) -+ create mode 100644 libavcodec/arm/hevcdsp_sao_neon.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index 6051ec8..093a2e8 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -133,7 +133,8 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ -+ arm/hevcdsp_deblock_neon.o \ -+ arm/hevcdsp_epel_neon.o \ -+ arm/hevcdsp_idct_neon.o \ -+- arm/hevcdsp_qpel_neon.o -++ arm/hevcdsp_qpel_neon.o \ -++ arm/hevcdsp_sao_neon.o -+ NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -+ NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ -+ arm/rv40dsp_neon.o -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 733ff08..69e2b2c 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -22,6 +22,7 @@ -+ #include "libavutil/arm/cpu.h" -+ #include "libavcodec/hevcdsp.h" -+ #include "hevcdsp_arm.h" -++#include "../bit_depth_template.c" -+ -+ void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+ void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+@@ -43,6 +44,11 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, -+ void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, -+ ptrdiff_t stride); -+ -++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++ -+ #define PUT_PIXELS(name) \ -+ void name(int16_t *dst, uint8_t *src, \ -+ ptrdiff_t srcstride, int height, \ -+@@ -151,6 +157,44 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t -+ put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE); -+ } -+ -++static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, -++ int16_t *sao_offset_val, int sao_left_class, int width, int height) -++{ -++ pixel *dst = (pixel *)_dst; -++ pixel *src = (pixel *)_src; -++ int8_t offset_table[32] = { 0 }; -++ int k, y, x; -++ int shift = 3; // BIT_DEPTH - 5 -++ -++ stride_src /= sizeof(pixel); -++ stride_dst /= sizeof(pixel); -++ -++ for (k = 0; k < 4; k++) -++ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; -++ -++ switch(width){ -++ case 8: -++ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ case 16: -++ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ case 32: -++ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ case 64: -++ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ break; -++ default: -++ for (y = 0; y < height; y++) { -++ for (x = 0; x < width; x++) -++ dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); -++ dst += stride_dst; -++ src += stride_src; -++ } -++ } -++} -++ -+ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ { -+ if (bit_depth == 8) { -+@@ -170,6 +214,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->transform_add[2] = ff_hevc_transform_add_16x16_neon_8; -+ c->transform_add[3] = ff_hevc_transform_add_32x32_neon_8; -+ c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; -++ for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { -++ c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; -++ } -+ put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; -+ put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; -+ put_hevc_qpel_neon[3][0] = ff_hevc_put_qpel_v3_neon_8; -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+new file mode 100644 -+index 0000000..1f0ad64 -+--- /dev/null -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -0,0 +1,204 @@ -++/* -++ * Copyright (c) 2014 Seppo Tomperi -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++#include "neon.S" -++ -++function ff_hevc_sao_band_w8_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {d24}, [r1], r3 -++ vshr.u8 d16, d24, #3 -++ vtbl.8 d16, {q0, q1}, d16 -++ vmovl.s8 q2, d16 -++ vmovl.u8 q6, d24 -++ vadd.s16 q2, q6 -++ vqmovun.s16 d4, q2 -++ vst1.8 {d4}, [r0], r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w16_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {q12}, [r1], r3 -++ -++ vshr.u8 q8, q12, #3 -++ -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ -++ vmovl.s8 q2, d16 -++ vmovl.s8 q3, d17 -++ -++ vmovl.u8 q6, d24 -++ vmovl.u8 q7, d25 -++ -++ vadd.s16 q2, q6 -++ vadd.s16 q3, q7 -++ -++ vqmovun.s16 d4, q2 -++ vqmovun.s16 d5, q3 -++ -++ vstm.8 r0, {q2} -++ add r0, r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {q12-q13}, [r1], r3 -++ -++ vshr.u8 q8, q12, #3 -++ vshr.u8 q9, q13, #3 -++ -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ vtbl.8 d18, {q0, q1}, d18 -++ vtbl.8 d19, {q0, q1}, d19 -++ -++ vmovl.s8 q2, d16 -++ vmovl.s8 q3, d17 // q8 free -++ vmovl.s8 q4, d18 -++ vmovl.s8 q5, d19 // q9 free -++ -++ vmovl.u8 q6, d24 -++ vmovl.u8 q7, d25 // q12 free -++ vmovl.u8 q8, d26 -++ vmovl.u8 q9, d27 // q13 free -++ -++ vadd.s16 q2, q6 -++ vadd.s16 q3, q7 -++ vadd.s16 q4, q8 -++ vadd.s16 q5, q9 -++ -++ vqmovun.s16 d4, q2 -++ vqmovun.s16 d5, q3 -++ vqmovun.s16 d6, q4 // q4 free -++ vqmovun.s16 d7, q5 // q5 free -++ -++ vst1.8 {q2-q3}, [r0], r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // offset_table -++ vpush {d8-d15} -++ vld1.8 {q0, q1}, [r5] // offset table -++ -++1: subs r4, #1 -++ vld1.8 {q12-q13}, [r1]! -++ vld1.8 {q14-q15}, [r1], r3 -++ sub r1, #32 -++ -++ vshr.u8 q8, q12, #3 -++ vshr.u8 q9, q13, #3 -++ vshr.u8 q10, q14, #3 -++ vshr.u8 q11, q15, #3 -++ -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ vtbl.8 d18, {q0, q1}, d18 -++ vtbl.8 d19, {q0, q1}, d19 -++ vtbl.8 d20, {q0, q1}, d20 -++ vtbl.8 d21, {q0, q1}, d21 -++ vtbl.8 d22, {q0, q1}, d22 -++ vtbl.8 d23, {q0, q1}, d23 -++ -++ vmovl.s8 q2, d16 -++ vmovl.s8 q3, d17 // q8 free -++ vmovl.s8 q4, d18 -++ vmovl.s8 q5, d19 // q9 free -++ -++ vmovl.u8 q6, d24 -++ vmovl.u8 q7, d25 // q12 free -++ vmovl.u8 q8, d26 -++ vmovl.u8 q9, d27 // q13 free -++ -++ vadd.s16 q2, q6 -++ vadd.s16 q3, q7 -++ vadd.s16 q4, q8 -++ vadd.s16 q5, q9 -++ -++ vqmovun.s16 d4, q2 -++ vqmovun.s16 d5, q3 -++ vqmovun.s16 d6, q4 // q4 free -++ vqmovun.s16 d7, q5 // q5 free -++ -++ // free q4 -q9, q12 - q13 -++ vmovl.s8 q4, d20 -++ vmovl.s8 q5, d21 // q10 free -++ vmovl.s8 q6, d22 -++ vmovl.s8 q7, d23 // q11 free -++ -++ vmovl.u8 q8, d28 -++ vmovl.u8 q9, d29 // q14 free -++ vmovl.u8 q10, d30 -++ vmovl.u8 q11, d31 // q15 free -++ -++ vadd.s16 q4, q8 -++ vadd.s16 q5, q9 -++ vadd.s16 q6, q10 -++ vadd.s16 q7, q11 -++ -++ vqmovun.s16 d8, q4 -++ vqmovun.s16 d9, q5 -++ vqmovun.s16 d10, q6 -++ vqmovun.s16 d11, q7 -++ -++ vstm.8 r0, {q2-q5} -++ add r0, r2 -++ bne 1b -++ -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -+-- -+2.5.0 -+ -+ -+From 8429b1de64bb871d57651ecfe3b084e2dfe0af51 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Wed, 27 May 2015 18:10:20 +0100 -+Subject: [PATCH 2/9] added NEON optimized sao edge for eo1 width 64 -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 47 ++++++++++++ -+ libavcodec/arm/hevcdsp_sao_neon.S | 147 +++++++++++++++++++++++++++++++++++++ -+ 2 files changed, 194 insertions(+) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 69e2b2c..c7b5404 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -22,6 +22,7 @@ -+ #include "libavutil/arm/cpu.h" -+ #include "libavcodec/hevcdsp.h" -+ #include "hevcdsp_arm.h" -++#include "libavcodec/avcodec.h" -+ #include "../bit_depth_template.c" -+ -+ void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+@@ -48,6 +49,7 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d -+ void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ -+ #define PUT_PIXELS(name) \ -+ void name(int16_t *dst, uint8_t *src, \ -+@@ -195,6 +197,50 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ } -+ } -+ -++#define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) -++static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst, -++ int16_t *_sao_offset_val, int eo, int width, int height) -++{ -++ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; -++ static const int8_t pos[4][2][2] = { -++ { { -1, 0 }, { 1, 0 } }, // horizontal -++ { { 0, -1 }, { 0, 1 } }, // vertical -++ { { -1, -1 }, { 1, 1 } }, // 45 degree -++ { { 1, -1 }, { -1, 1 } }, // 135 degree -++ }; -++ int8_t sao_offset_val[8]; // padding of 3 for vld -++ ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); -++ pixel *dst = (pixel *)_dst; -++ pixel *src = (pixel *)_src; -++ int a_stride, b_stride; -++ int x, y; -++ -++ for (x = 0; x < 5; x++) { -++ sao_offset_val[x] = _sao_offset_val[x]; -++ } -++ -++ stride_src /= sizeof(pixel); -++ stride_dst /= sizeof(pixel); -++ -++ if (eo == 1 && width == 64) { -++ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ } else { -++ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; -++ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; -++ for (y = 0; y < height; y++) { -++ for (x = 0; x < width; x++) { -++ int diff0 = CMP(src[x], src[x + a_stride]); -++ int diff1 = CMP(src[x], src[x + b_stride]); -++ int offset_val = edge_idx[2 + diff0 + diff1]; -++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -++ } -++ src += stride_src; -++ dst += stride_dst; -++ } -++ } -++} -++#undef CMP -++ -+ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ { -+ if (bit_depth == 8) { -+@@ -216,6 +262,7 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->idct_4x4_luma = ff_hevc_transform_luma_4x4_neon_8; -+ for (x = 0; x < sizeof c->sao_band_filter / sizeof *c->sao_band_filter; x++) { -+ c->sao_band_filter[x] = ff_hevc_sao_band_neon_wrapper; -++ c->sao_edge_filter[x] = ff_hevc_sao_edge_neon_wrapper; -+ } -+ put_hevc_qpel_neon[1][0] = ff_hevc_put_qpel_v1_neon_8; -+ put_hevc_qpel_neon[2][0] = ff_hevc_put_qpel_v2_neon_8; -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 1f0ad64..5ec2de9 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -202,3 +202,150 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ bx lr -+ endfunc -+ -++function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x02 -++ vpush {d8-d15} -++1: subs r4, #1 -++ // load a -++ sub r1, r3 -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #32 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1], r3 -++ sub r1, #32 -++ -++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q5, q1 -++ vcgt.u8 q1, q1, q5 -++ vcgt.u8 q14, q6, q2 -++ vcgt.u8 q2, q2, q6 -++ vcgt.u8 q15, q7, q3 -++ vcgt.u8 q3, q3, q7 -++ -++ vsub.s8 q12, q0, q12 // diff0 -++ vsub.s8 q13, q1, q13 -++ vsub.s8 q14, q2, q14 -++ vsub.s8 q15, q3, q15 -++ -++ vcgt.u8 q0, q4, q8 // c > b -++ vcgt.u8 q8, q8, q4 // b > c -++ vcgt.u8 q1, q5, q9 -++ vcgt.u8 q9, q9, q5 -++ vcgt.u8 q2, q6, q10 -++ vcgt.u8 q10, q10, q6 -++ vcgt.u8 q3, q7, q11 -++ vcgt.u8 q11, q11, q7 -++ -++ vsub.s8 q0, q8, q0 // diff1 -++ vsub.s8 q1, q9, q1 -++ vsub.s8 q2, q10, q2 -++ vsub.s8 q3, q11, q3 -++ -++ veor.u8 q8, q8 // zero register -++ vdup.s8 q9, r6 // 2 to all elements -++ add r6, #1 -++ vdup.s8 q10, r6 // 3 to all elements -++ sub r6, #1 -++ -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q15 -++ -++ vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 -++ vcgt.s8 q5, q1, q8 -++ vcgt.s8 q6, q2, q8 -++ vcgt.s8 q7, q3, q8 -++ -++ vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 -++ vclt.s8 q12, q1, q8 -++ vclt.s8 q13, q2, q8 -++ vclt.s8 q14, q3, q8 -++ -++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -++ vand.8 q15, q8, q4 -++ vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 -++ vand.8 q8, q8, q11 -++ vadd.s8 q0, q15, q8 // offset_idx -++ -++ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -++ vand.8 q15, q8, q5 -++ vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 -++ vand.8 q8, q8, q12 -++ vadd.s8 q1, q15, q8 // offset_idx -++ -++ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 -++ vand.8 q15, q8, q6 -++ vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 -++ vand.8 q8, q8, q13 -++ vadd.s8 q2, q15, q8 // offset_idx -++ -++ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 -++ vand.8 q15, q8, q7 -++ vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 -++ vand.8 q8, q8, q14 -++ vadd.s8 q3, q15, q8 // offset_idx -++ // TODO: load only once -++ vld1.8 d16, [r5] -++ -++ vtbl.8 d0, {d16}, d0 -++ vtbl.8 d1, {d16}, d1 -++ vtbl.8 d2, {d16}, d2 -++ vtbl.8 d3, {d16}, d3 -++ vtbl.8 d4, {d16}, d4 -++ vtbl.8 d5, {d16}, d5 -++ vtbl.8 d6, {d16}, d6 -++ vtbl.8 d7, {d16}, d7 -++ -++ // TODO: load only once -++ // load c again -++ sub r1, r3 -++ sub r1, r3 -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ -++ vmovl.u8 q8, d8 -++ vmovl.u8 q9, d9 -++ vmovl.u8 q10, d10 -++ vmovl.u8 q11, d11 -++ vmovl.u8 q12, d12 -++ vmovl.u8 q13, d13 -++ vmovl.u8 q14, d14 -++ vmovl.u8 q15, d15 -++ -++ vaddw.s8 q8, d0 -++ vaddw.s8 q9, d1 -++ vaddw.s8 q10, d2 -++ vaddw.s8 q11, d3 -++ vaddw.s8 q12, d4 -++ vaddw.s8 q13, d5 -++ vaddw.s8 q14, d6 -++ vaddw.s8 q15, d7 -++ -++ vqmovun.s16 d0, q8 -++ vqmovun.s16 d1, q9 -++ vqmovun.s16 d2, q10 -++ vqmovun.s16 d3, q11 -++ vqmovun.s16 d4, q12 -++ vqmovun.s16 d5, q13 -++ vqmovun.s16 d6, q14 -++ vqmovun.s16 d7, q15 -++ -++ vstm r0, {q0-q3} -++ add r0, r2 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -+-- -+2.5.0 -+ -+ -+From 402e2bd1c5ad659c757bf9734abe6331904fb9e2 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Tue, 16 Dec 2014 16:28:25 +0200 -+Subject: [PATCH 3/9] Added SAO edge offset for ARM NEON w32 and w64 -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 46 +++- -+ libavcodec/arm/hevcdsp_sao_neon.S | 510 +++++++++++++++++++++++++++++++------ -+ 2 files changed, 474 insertions(+), 82 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index c7b5404..c32940e 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -49,7 +49,16 @@ void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_d -+ void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+ void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++ -++void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo2_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo3_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++ -++void ff_hevc_sao_edge_eo0_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ void ff_hevc_sao_edge_eo1_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo2_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -++void ff_hevc_sao_edge_eo3_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ -+ #define PUT_PIXELS(name) \ -+ void name(int16_t *dst, uint8_t *src, \ -+@@ -222,9 +231,40 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+- if (eo == 1 && width == 64) { -+- ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -+- } else { -++ switch (width) { -++ case 32: -++ switch(eo) { -++ case 0: -++ ff_hevc_sao_edge_eo0_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 1: -++ ff_hevc_sao_edge_eo1_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 2: -++ ff_hevc_sao_edge_eo2_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 3: -++ ff_hevc_sao_edge_eo3_w32_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ } -++ break; -++ case 64: -++ switch(eo) { -++ case 0: -++ ff_hevc_sao_edge_eo0_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 1: -++ ff_hevc_sao_edge_eo1_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 2: -++ ff_hevc_sao_edge_eo2_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ case 3: -++ ff_hevc_sao_edge_eo3_w64_neon_8(dst, src, stride_dst, stride_src, height, sao_offset_val); -++ break; -++ } -++ break; -++ default: -+ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; -+ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; -+ for (y = 0; y < height; y++) { -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 5ec2de9..4687012 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -202,27 +202,7 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ bx lr -+ endfunc -+ -+-function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x02 -+- vpush {d8-d15} -+-1: subs r4, #1 -+- // load a -+- sub r1, r3 -+- vld1.8 {q0-q1}, [r1]! -+- vld1.8 {q2-q3}, [r1], r3 -+- sub r1, #32 -+- // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -+- sub r1, #32 -+- // load b -+- vld1.8 {q8-q9}, [r1]! -+- vld1.8 {q10-q11}, [r1], r3 -+- sub r1, #32 -+- -++.macro edge_w64_body -+ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+ vcgt.u8 q13, q5, q1 -+@@ -251,69 +231,61 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ vsub.s8 q2, q10, q2 -+ vsub.s8 q3, q11, q3 -+ -+- veor.u8 q8, q8 // zero register -+- vdup.s8 q9, r6 // 2 to all elements -+- add r6, #1 -+- vdup.s8 q10, r6 // 3 to all elements -+- sub r6, #1 -+- -+ vadd.s8 q0, q12 //diff0 + diff1 -+ vadd.s8 q1, q13 -+ vadd.s8 q2, q14 -+ vadd.s8 q3, q15 -+ -+- vcgt.s8 q4, q0, q8 // diff0 + diff1 > 0 -+- vcgt.s8 q5, q1, q8 -+- vcgt.s8 q6, q2, q8 -+- vcgt.s8 q7, q3, q8 -+- -+- vclt.s8 q11, q0, q8 // diff0 + diff1 < 0 -+- vclt.s8 q12, q1, q8 -+- vclt.s8 q13, q2, q8 -+- vclt.s8 q14, q3, q8 -+- -+- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -+- vand.8 q15, q8, q4 -+- vadd.s8 q8, q0, q10 // diff0 + diff1 + 3 -+- vand.8 q8, q8, q11 -+- vadd.s8 q0, q15, q8 // offset_idx -+- -+- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -+- vand.8 q15, q8, q5 -+- vadd.s8 q8, q1, q10 // diff0 + diff1 + 3 -+- vand.8 q8, q8, q12 -+- vadd.s8 q1, q15, q8 // offset_idx -+- -+- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 + 2 -+- vand.8 q15, q8, q6 -+- vadd.s8 q8, q2, q10 // diff0 + diff1 + 2 + 3 -+- vand.8 q8, q8, q13 -+- vadd.s8 q2, q15, q8 // offset_idx -+- -+- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 + 2 -+- vand.8 q15, q8, q7 -+- vadd.s8 q8, q3, q10 // diff0 + diff1 + 2 + 3 -+- vand.8 q8, q8, q14 -+- vadd.s8 q3, q15, q8 // offset_idx -+- // TODO: load only once -+- vld1.8 d16, [r5] -+- -+- vtbl.8 d0, {d16}, d0 -+- vtbl.8 d1, {d16}, d1 -+- vtbl.8 d2, {d16}, d2 -+- vtbl.8 d3, {d16}, d3 -+- vtbl.8 d4, {d16}, d4 -+- vtbl.8 d5, {d16}, d5 -+- vtbl.8 d6, {d16}, d6 -+- vtbl.8 d7, {d16}, d7 -+- -+- // TODO: load only once -+- // load c again -+- sub r1, r3 -+- sub r1, r3 -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -+- sub r1, #32 -++ vdup.s8 q9, r6 // 3 to all elements -++ sub r6, #1 -++ -++ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -++ vclt.s8 q13, q1, #0 -++ vclt.s8 q14, q2, #0 -++ vclt.s8 q15, q3, #0 -++ -++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 -++ vadd.s8 q10, q1, q9 -++ vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -++ vand.8 q13, q10, q13 -++ vadd.s8 q8, q2, q9 -++ vadd.s8 q10, q3, q9 -++ vand.8 q14, q8, q14 -++ vand.8 q15, q10, q15 -++ -++ vdup.s8 q9, r6 // 2 to all elements -++ add r6, #1 -++ -++ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -++ vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vcgt.s8 q10, q1, #0 -++ vadd.s8 q0, q11, q12 // offset_idx -++ -++ vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -++ vcgt.s8 q12, q2, #0 -++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 -++ vadd.s8 q1, q11, q13 -++ -++ vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vcgt.s8 q10, q3, #0 -++ vadd.s8 q2, q11, q14 -++ -++ vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 -++ vmov.32 d18[0], r7 // load offset table from general registers -++ vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vmov.32 d18[1], r5 // load rest of offset table -++ vadd.s8 q3, q11, q15 -++ -++ vtbl.8 d0, {d18}, d0 -++ vtbl.8 d1, {d18}, d1 -++ vtbl.8 d2, {d18}, d2 -++ vtbl.8 d3, {d18}, d3 -++ vtbl.8 d4, {d18}, d4 -++ vtbl.8 d5, {d18}, d5 -++ vtbl.8 d6, {d18}, d6 -++ vtbl.8 d7, {d18}, d7 -+ -+ vmovl.u8 q8, d8 -+ vmovl.u8 q9, d9 -+@@ -344,8 +316,388 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ -+ vstm r0, {q0-q3} -+ add r0, r2 -++.endm -++ -++.macro edge_w32_body -++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q5, q1 -++ vcgt.u8 q1, q1, q5 -++ -++ vsub.s8 q12, q0, q12 // diff0 -++ vcgt.u8 q0, q4, q8 // c > b -++ vsub.s8 q13, q1, q13 // diff0 part 2 -++ -++ vcgt.u8 q6, q8, q4 // b > c -++ vcgt.u8 q1, q5, q9 -++ vcgt.u8 q7, q9, q5 -++ -++ vsub.s8 q0, q6, q0 // diff1 -++ vsub.s8 q1, q7, q1 // diff1 part 2 -++ vadd.s8 q0, q12 //diff0 + diff1 -++ -++ vdup.s8 q7, r6 // 3 to all elements -++ sub r6, #1 -++ vadd.s8 q1, q13 -++ -++ vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -++ vclt.s8 q13, q1, #0 -++ -++ vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 -++ vadd.s8 q10, q1, q7 -++ vdup.s8 q7, r6 // 2 to all elements -++ add r6, #1 -++ vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -++ vand.8 q13, q10, q13 -++ -++ -++ vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -++ vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 -++ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vcgt.s8 q10, q1, #0 -++ vadd.s8 q0, q11, q12 // offset_idx -++ -++ vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 -++ vmov.32 d14[0], r7 // load offset table from general registers -++ vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -++ vmov.32 d14[1], r5 // load rest of offset table -++ vadd.s8 q1, q11, q13 -++ -++ vtbl.8 d0, {d14}, d0 -++ vtbl.8 d1, {d14}, d1 -++ vtbl.8 d2, {d14}, d2 -++ vtbl.8 d3, {d14}, d3 -++ -++ vmovl.u8 q6, d8 -++ vmovl.u8 q7, d9 -++ vmovl.u8 q10, d10 -++ vmovl.u8 q11, d11 -++ -++ vaddw.s8 q6, d0 -++ vaddw.s8 q7, d1 -++ vaddw.s8 q10, d2 -++ vaddw.s8 q11, d3 -++ -++ vqmovun.s16 d0, q6 -++ vqmovun.s16 d1, q7 -++ vqmovun.s16 d2, q10 -++ vqmovun.s16 d3, q11 -++ -++ vstm r0, {q0-q1} -++ add r0, r2 -++.endm -++ -++function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ sub r1, #8 -++1: subs r4, #1 -++ vld1.64 {q10-q11}, [r1]! -++ vld1.64 {q12-q13}, [r1]! -++ vld1.64 {q14}, [r1], r3 -++ sub r1, #64 -++ // load a -++ vext.8 q0, q10, q11, #7 -++ vext.8 q1, q11, q12, #7 -++ vext.8 q2, q12, q13, #7 -++ vext.8 q3, q13, q14, #7 -++ // load c -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ vext.8 q6, q12, q13, #8 -++ vext.8 q7, q13, q14, #8 -++ // load b -++ vext.8 q8, q10, q11, #9 -++ vext.8 q9, q11, q12, #9 -++ vext.8 q10, q12, q13, #9 -++ vext.8 q11, q13, q14, #9 -++ edge_w64_body -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ sub r1, r3 -++ // load a -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #32 -++1: subs r4, #1 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1] -++ sub r1, #32 -++ edge_w64_body -++ // copy c to a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ vmov.64 q2, q6 -++ vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+ pop {r4-r8} -+ bx lr -+ endfunc -++ -++function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++1: sub r1, r3 -++ // load a -++ // TODO: fix unaligned load -++ // don't reload a like in eo1 -++ sub r1, #1 -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #31 -++ subs r4, #1 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ add r1, #1 -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1] -++ sub r1, #33 -++ edge_w64_body -++ // copy c to a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ vmov.64 q2, q6 -++ vmov.64 q3, q7 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++1: sub r1, r3 -++ // load a -++ // TODO: fix unaligned load -++ // don't reload a like in eo1 -++ add r1, #1 -++ vld1.8 {q0-q1}, [r1]! -++ vld1.8 {q2-q3}, [r1], r3 -++ sub r1, #33 -++ subs r4, #1 -++ // load c -++ vld1.8 {q4-q5}, [r1]! -++ vld1.8 {q6-q7}, [r1], r3 -++ sub r1, #32 -++ // load b -++ sub r1, #1 -++ vld1.8 {q8-q9}, [r1]! -++ vld1.8 {q10-q11}, [r1] -++ sub r1, #31 -++ edge_w64_body -++ // copy c to a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ vmov.64 q2, q6 -++ vmov.64 q3, q7 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ sub r1, #8 // load 8 extra bytes -++1: subs r4, #1 -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 // only first 9 bytes are used -++ sub r1, #32 -++ // a -++ vext.8 q0, q10, q11, #7 -++ vext.8 q1, q11, q12, #7 -++ // c -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ // b -++ vext.8 q8, q10, q11, #9 -++ vext.8 q9, q11, q12, #9 -++ edge_w32_body -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ // load a -++ sub r1, r3 -++ vld1.8 {q0-q1}, [r1], r3 -++ // load c -++ vld1.8 {q4-q5}, [r1], r3 -++1: subs r4, #1 -++ // load b -++ vld1.8 {q8-q9}, [r1], r3 -++ edge_w32_body -++ // inputs for next loop iteration -++ // a -++ vmov.64 q0, q4 -++ vmov.64 q1, q5 -++ // c -++ vmov.64 q4, q8 -++ vmov.64 q5, q9 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ ldr r5, [r5] -++ vpush {d8-d15} -++ // load a -++ sub r1, r3 -++ sub r1, #8 -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q0, q10, q11, #7 -++ vext.8 q1, q11, q12, #7 -++ // load c -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ vext.8 q2, q10, q11, #7 -++1: subs r4, #1 -++ // load b -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q8, q10, q11, #9 -++ vext.8 q9, q11, q12, #9 -++ vext.8 q14, q10, q11, #8 -++ vext.8 q15, q11, q12, #8 -++ vext.8 q3, q10, q11, #7 -++ edge_w32_body -++ // inputs for next loop iteration -++ // a -++ vmov.8 q0, q2 -++ vext.8 q1, q4, q5, #15 -++ // c -++ vmov.8 q4, q14 -++ vmov.8 q5, q15 -++ vmov.8 q2, q3 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -++function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -++ push {r4-r8} -++ ldr r4, [sp, #20] // height -++ ldr r5, [sp, #24] // sao_offset_val_table -++ ldr r6, =0x03 -++ ldr r7, [r5] -++ add r5, #4 -++ sub r1, r3 -++ ldr r5, [r5] -++ sub r1, #8 -++ vpush {d8-d15} -++ // load a -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q0, q10, q11, #9 -++ vext.8 q1, q11, q12, #9 -++ // load c -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q4, q10, q11, #8 -++ vext.8 q5, q11, q12, #8 -++ vext.8 q2, q12, q11, #8 -++1: subs r4, #1 -++ // load b -++ vld1.8 {q10-q11}, [r1] -++ add r1, #32 -++ vld1.8 {q12}, [r1], r3 -++ sub r1, #32 -++ vext.8 q8, q10, q11, #7 -++ vext.8 q9, q11, q12, #7 -++ vext.8 q3, q12, q10, #7 -++ edge_w32_body -++ // inputs for next loop iteration -++ // a -++ vext.8 q0, q4, q5, #1 -++ vext.8 q1, q5, q2, #1 -++ // c -++ vext.8 q4, q8, q9, #1 -++ vext.8 q5, q9, q3, #1 -++ vext.8 q2, q3, q1, #1 -++ bne 1b -++ vpop {d8-d15} -++ pop {r4-r8} -++ bx lr -++endfunc -++ -+-- -+2.5.0 -+ -+ -+From 1898d052a73370166d57e17cc7c52b7275887df3 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Fri, 19 Dec 2014 09:44:10 +0200 -+Subject: [PATCH 4/9] Improved SAO band NEON opimizations made SAO buffer 16 -+ byte aligned added alignment hints to loads and stores optimized register -+ usage in SAO band neon assembly -+ -+--- -+ libavcodec/arm/hevcdsp_sao_neon.S | 212 +++++++++++++++----------------------- -+ 1 file changed, 82 insertions(+), 130 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 4687012..ac21013 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -22,120 +22,84 @@ -+ #include "neon.S" -+ -+ function ff_hevc_sao_band_w8_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -+ -+-1: subs r4, #1 -+- vld1.8 {d24}, [r1], r3 -++1: subs r12, #1 -++ vld1.8 {d24}, [r1,:64], r3 -+ vshr.u8 d16, d24, #3 -+ vtbl.8 d16, {q0, q1}, d16 -+- vmovl.s8 q2, d16 -+ vmovl.u8 q6, d24 -+- vadd.s16 q2, q6 -++ vaddw.s8 q6, d16 -+ vqmovun.s16 d4, q2 -+- vst1.8 {d4}, [r0], r2 -++ vst1.8 {d4}, [r0,:64], r2 -+ bne 1b -+ -+- vpop {d8-d15} -+- pop {r4-r8} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_band_w16_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -+- -+-1: subs r4, #1 -+- vld1.8 {q12}, [r1], r3 -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -+ -++1: subs r12, #1 -++ vld1.8 {q12}, [r1,:128], r3 -+ vshr.u8 q8, q12, #3 -+- -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+- -+- vmovl.s8 q2, d16 -+- vmovl.s8 q3, d17 -+- -+- vmovl.u8 q6, d24 -+- vmovl.u8 q7, d25 -+- -+- vadd.s16 q2, q6 -+- vadd.s16 q3, q7 -+- -+- vqmovun.s16 d4, q2 -+- vqmovun.s16 d5, q3 -+- -+- vstm.8 r0, {q2} -+- add r0, r2 -++ vmovl.u8 q10, d24 -++ vmovl.u8 q11, d25 -++ vaddw.s8 q10, d16 -++ vaddw.s8 q11, d17 -++ vqmovun.s16 d4, q10 -++ vqmovun.s16 d5, q11 -++ vst1.8 {q2}, [r0,:128], r2 -+ bne 1b -+ -+- vpop {d8-d15} -+- pop {r4-r8} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_band_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -+- -+-1: subs r4, #1 -+- vld1.8 {q12-q13}, [r1], r3 -+- -+- vshr.u8 q8, q12, #3 -+- vshr.u8 q9, q13, #3 -+- -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vtbl.8 d18, {q0, q1}, d18 -+- vtbl.8 d19, {q0, q1}, d19 -+- -+- vmovl.s8 q2, d16 -+- vmovl.s8 q3, d17 // q8 free -+- vmovl.s8 q4, d18 -+- vmovl.s8 q5, d19 // q9 free -+- -+- vmovl.u8 q6, d24 -+- vmovl.u8 q7, d25 // q12 free -+- vmovl.u8 q8, d26 -+- vmovl.u8 q9, d27 // q13 free -+- -+- vadd.s16 q2, q6 -+- vadd.s16 q3, q7 -+- vadd.s16 q4, q8 -+- vadd.s16 q5, q9 -+- -+- vqmovun.s16 d4, q2 -+- vqmovun.s16 d5, q3 -+- vqmovun.s16 d6, q4 // q4 free -+- vqmovun.s16 d7, q5 // q5 free -+- -+- vst1.8 {q2-q3}, [r0], r2 -+- bne 1b -+- -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -++ -++1: subs r12, #1 -++ vld1.8 {q2-q3}, [r1,:128], r3 -++ vshr.u8 q8, q2, #3 -++ vshr.u8 q9, q3, #3 -++ vtbl.8 d16, {q0, q1}, d16 -++ vtbl.8 d17, {q0, q1}, d17 -++ vtbl.8 d18, {q0, q1}, d18 -++ vtbl.8 d19, {q0, q1}, d19 -++ vmovl.u8 q12, d4 -++ vmovl.u8 q13, d5 -++ vmovl.u8 q14, d6 -++ vmovl.u8 q15, d7 -++ vaddw.s8 q12, d16 -++ vaddw.s8 q13, d17 -++ vaddw.s8 q14, d18 -++ vaddw.s8 q15, d19 -++ vqmovun.s16 d4, q12 -++ vqmovun.s16 d5, q13 -++ vqmovun.s16 d6, q14 -++ vqmovun.s16 d7, q15 -++ vst1.8 {q2-q3}, [r0,:128], r2 -++ bne 1b -++ -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_band_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // offset_table -+- vpush {d8-d15} -+- vld1.8 {q0, q1}, [r5] // offset table -++ ldr r12, [sp, #4] // offset_table address -++ vld1.8 {q0, q1}, [r12] // offset table -++ ldr r12, [sp, #0] // height -+ -+-1: subs r4, #1 -+- vld1.8 {q12-q13}, [r1]! -+- vld1.8 {q14-q15}, [r1], r3 -++1: subs r12, #1 -++ vld1.8 {q12-q13}, [r1,:128]! -++ vld1.8 {q14-q15}, [r1,:128], r3 -+ sub r1, #32 -+ -+ vshr.u8 q8, q12, #3 -+@@ -152,53 +116,41 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ vtbl.8 d22, {q0, q1}, d22 -+ vtbl.8 d23, {q0, q1}, d23 -+ -+- vmovl.s8 q2, d16 -+- vmovl.s8 q3, d17 // q8 free -+- vmovl.s8 q4, d18 -+- vmovl.s8 q5, d19 // q9 free -++ vmovl.u8 q2, d24 -++ vmovl.u8 q3, d25 -++ vmovl.u8 q12, d26 -++ vmovl.u8 q13, d27 -+ -+- vmovl.u8 q6, d24 -+- vmovl.u8 q7, d25 // q12 free -+- vmovl.u8 q8, d26 -+- vmovl.u8 q9, d27 // q13 free -+- -+- vadd.s16 q2, q6 -+- vadd.s16 q3, q7 -+- vadd.s16 q4, q8 -+- vadd.s16 q5, q9 -++ vaddw.s8 q2, d16 -++ vaddw.s8 q3, d17 -++ vaddw.s8 q12, d18 -++ vaddw.s8 q13, d19 -+ -+ vqmovun.s16 d4, q2 -+ vqmovun.s16 d5, q3 -+- vqmovun.s16 d6, q4 // q4 free -+- vqmovun.s16 d7, q5 // q5 free -+- -+- // free q4 -q9, q12 - q13 -+- vmovl.s8 q4, d20 -+- vmovl.s8 q5, d21 // q10 free -+- vmovl.s8 q6, d22 -+- vmovl.s8 q7, d23 // q11 free -+- -+- vmovl.u8 q8, d28 -+- vmovl.u8 q9, d29 // q14 free -+- vmovl.u8 q10, d30 -+- vmovl.u8 q11, d31 // q15 free -+- -+- vadd.s16 q4, q8 -+- vadd.s16 q5, q9 -+- vadd.s16 q6, q10 -+- vadd.s16 q7, q11 -+- -+- vqmovun.s16 d8, q4 -+- vqmovun.s16 d9, q5 -+- vqmovun.s16 d10, q6 -+- vqmovun.s16 d11, q7 -+- -+- vstm.8 r0, {q2-q5} -+- add r0, r2 -++ vqmovun.s16 d6, q12 -++ vqmovun.s16 d7, q13 -++ -++ vmovl.u8 q12, d28 -++ vmovl.u8 q13, d29 -++ vmovl.u8 q14, d30 -++ vmovl.u8 q15, d31 -++ -++ vaddw.s8 q12, d20 -++ vaddw.s8 q13, d21 -++ vaddw.s8 q14, d22 -++ vaddw.s8 q15, d23 -++ -++ vqmovun.s16 d8, q12 -++ vqmovun.s16 d9, q13 -++ vqmovun.s16 d10, q14 -++ vqmovun.s16 d11, q15 -++ -++ vst1.8 {q2-q3}, [r0,:128]! -++ vst1.8 {q4-q5}, [r0,:128], r2 -++ sub r0, #32 -+ bne 1b -+ -+- vpop {d8-d15} -+- pop {r4-r8} -+ bx lr -+ endfunc -+ -+-- -+2.5.0 -+ -+ -+From 26bd536800db2f50ff6a021e1fda0d0394d1ea01 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Mon, 29 Dec 2014 15:00:49 +0200 -+Subject: [PATCH 5/9] better code reuse in NEON SAO band -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 16 ++-- -+ libavcodec/arm/hevcdsp_sao_neon.S | 155 +++++++++++++------------------------ -+ 2 files changed, 61 insertions(+), 110 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index c32940e..6379810 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, -+ void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, -+ ptrdiff_t stride); -+ -+-void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+-void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+-void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -+-void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t * offset_table); -++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+ -+ void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+@@ -185,16 +185,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ -+ switch(width){ -+ case 8: -+- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ case 16: -+- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ case 32: -+- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ case 64: -+- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, height, offset_table); -++ ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+ default: -+ for (y = 0; y < height; y++) { -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index ac21013..8852550 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -21,53 +21,13 @@ -+ #include "libavutil/arm/asm.S" -+ #include "neon.S" -+ -+-function ff_hevc_sao_band_w8_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -++.macro init_sao_band -++ ldr r12, [sp, #0] // offset_table address -+ vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -+- -+-1: subs r12, #1 -+- vld1.8 {d24}, [r1,:64], r3 -+- vshr.u8 d16, d24, #3 -+- vtbl.8 d16, {q0, q1}, d16 -+- vmovl.u8 q6, d24 -+- vaddw.s8 q6, d16 -+- vqmovun.s16 d4, q2 -+- vst1.8 {d4}, [r0,:64], r2 -+- bne 1b -+- -+- bx lr -+-endfunc -+- -+-function ff_hevc_sao_band_w16_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -+- -+-1: subs r12, #1 -+- vld1.8 {q12}, [r1,:128], r3 -+- vshr.u8 q8, q12, #3 -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vmovl.u8 q10, d24 -+- vmovl.u8 q11, d25 -+- vaddw.s8 q10, d16 -+- vaddw.s8 q11, d17 -+- vqmovun.s16 d4, q10 -+- vqmovun.s16 d5, q11 -+- vst1.8 {q2}, [r0,:128], r2 -+- bne 1b -+- -+- bx lr -+-endfunc -+- -+-function ff_hevc_sao_band_w32_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -++ ldr r12, [sp, #4] // height -++.endm -+ -+-1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1,:128], r3 -++.macro sao_band_32 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -+ vtbl.8 d16, {q0, q1}, d16 -+@@ -86,6 +46,43 @@ function ff_hevc_sao_band_w32_neon_8, export=1 -+ vqmovun.s16 d5, q13 -+ vqmovun.s16 d6, q14 -+ vqmovun.s16 d7, q15 -++.endm -++ -++function ff_hevc_sao_band_w8_neon_8, export=1 -++ init_sao_band -++1: subs r12, #4 -++ vld1.8 {d4}, [r1,:64], r3 -++ vld1.8 {d5}, [r1,:64], r3 -++ vld1.8 {d6}, [r1,:64], r3 -++ vld1.8 {d7}, [r1,:64], r3 -++ sao_band_32 -++ vst1.8 {d4}, [r0,:64], r2 -++ vst1.8 {d5}, [r0,:64], r2 -++ vst1.8 {d6}, [r0,:64], r2 -++ vst1.8 {d7}, [r0,:64], r2 -++ bne 1b -++ -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w16_neon_8, export=1 -++ init_sao_band -++1: subs r12, #2 -++ vld1.8 {q2}, [r1,:128], r3 -++ vld1.8 {q3}, [r1,:128], r3 -++ sao_band_32 -++ vst1.8 {q2}, [r0,:128], r2 -++ vst1.8 {q3}, [r0,:128], r2 -++ bne 1b -++ -++ bx lr -++endfunc -++ -++function ff_hevc_sao_band_w32_neon_8, export=1 -++ init_sao_band -++1: subs r12, #1 -++ vld1.8 {q2-q3}, [r1,:128], r3 -++ sao_band_32 -+ vst1.8 {q2-q3}, [r0,:128], r2 -+ bne 1b -+ -+@@ -93,63 +90,17 @@ function ff_hevc_sao_band_w32_neon_8, export=1 -+ endfunc -+ -+ function ff_hevc_sao_band_w64_neon_8, export=1 -+- ldr r12, [sp, #4] // offset_table address -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #0] // height -+- -+-1: subs r12, #1 -+- vld1.8 {q12-q13}, [r1,:128]! -+- vld1.8 {q14-q15}, [r1,:128], r3 -+- sub r1, #32 -+- -+- vshr.u8 q8, q12, #3 -+- vshr.u8 q9, q13, #3 -+- vshr.u8 q10, q14, #3 -+- vshr.u8 q11, q15, #3 -+- -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vtbl.8 d18, {q0, q1}, d18 -+- vtbl.8 d19, {q0, q1}, d19 -+- vtbl.8 d20, {q0, q1}, d20 -+- vtbl.8 d21, {q0, q1}, d21 -+- vtbl.8 d22, {q0, q1}, d22 -+- vtbl.8 d23, {q0, q1}, d23 -+- -+- vmovl.u8 q2, d24 -+- vmovl.u8 q3, d25 -+- vmovl.u8 q12, d26 -+- vmovl.u8 q13, d27 -+- -+- vaddw.s8 q2, d16 -+- vaddw.s8 q3, d17 -+- vaddw.s8 q12, d18 -+- vaddw.s8 q13, d19 -+- -+- vqmovun.s16 d4, q2 -+- vqmovun.s16 d5, q3 -+- vqmovun.s16 d6, q12 -+- vqmovun.s16 d7, q13 -+- -+- vmovl.u8 q12, d28 -+- vmovl.u8 q13, d29 -+- vmovl.u8 q14, d30 -+- vmovl.u8 q15, d31 -+- -+- vaddw.s8 q12, d20 -+- vaddw.s8 q13, d21 -+- vaddw.s8 q14, d22 -+- vaddw.s8 q15, d23 -+- -+- vqmovun.s16 d8, q12 -+- vqmovun.s16 d9, q13 -+- vqmovun.s16 d10, q14 -+- vqmovun.s16 d11, q15 -+- -+- vst1.8 {q2-q3}, [r0,:128]! -+- vst1.8 {q4-q5}, [r0,:128], r2 -+- sub r0, #32 -+- bne 1b -++ init_sao_band -++1: subs r12, #1 -++ vld1.8 {q2-q3}, [r1,:128]! -++ sao_band_32 -++ vst1.8 {q2-q3}, [r0,:128]! -++ vld1.8 {q2-q3}, [r1,:128], r3 -++ sub r1, #32 -++ sao_band_32 -++ vst1.8 {q2-q3}, [r0,:128], r2 -++ sub r0, #32 -++ bne 1b -+ -+ bx lr -+ endfunc -+-- -+2.5.0 -+ -+ -+From f93646a97bc885b81759e774d04be3781916a3e7 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Wed, 7 Jan 2015 15:27:38 +0200 -+Subject: [PATCH 6/9] More SAO NEON optimizations Now uses only 8 bit integers -+ for SAO calculations -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 7 +- -+ libavcodec/arm/hevcdsp_sao_neon.S | 664 +++++++++++++++---------------------- -+ 2 files changed, 272 insertions(+), 399 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 6379810..8d6e863 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -225,7 +225,7 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ int x, y; -+ -+ for (x = 0; x < 5; x++) { -+- sao_offset_val[x] = _sao_offset_val[x]; -++ sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; -+ } -+ -+ stride_src /= sizeof(pixel); -+@@ -271,8 +271,9 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ for (x = 0; x < width; x++) { -+ int diff0 = CMP(src[x], src[x + a_stride]); -+ int diff1 = CMP(src[x], src[x + b_stride]); -+- int offset_val = edge_idx[2 + diff0 + diff1]; -+- dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -++ int idx = diff0 + diff1; -++ if (idx) -++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[idx+2]); -+ } -+ src += stride_src; -+ dst += stride_dst; -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 8852550..5fc482b 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -1,5 +1,5 @@ -+ /* -+- * Copyright (c) 2014 Seppo Tomperi -++ * Copyright (c) 2014 - 2015 Seppo Tomperi -+ * -+ * This file is part of FFmpeg. -+ * -+@@ -23,6 +23,7 @@ -+ -+ .macro init_sao_band -+ ldr r12, [sp, #0] // offset_table address -++ pld [r1] -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #4] // height -+ .endm -+@@ -30,36 +31,31 @@ -+ .macro sao_band_32 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -++ vmov.u8 q14, #128 -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+ vtbl.8 d19, {q0, q1}, d19 -+- vmovl.u8 q12, d4 -+- vmovl.u8 q13, d5 -+- vmovl.u8 q14, d6 -+- vmovl.u8 q15, d7 -+- vaddw.s8 q12, d16 -+- vaddw.s8 q13, d17 -+- vaddw.s8 q14, d18 -+- vaddw.s8 q15, d19 -+- vqmovun.s16 d4, q12 -+- vqmovun.s16 d5, q13 -+- vqmovun.s16 d6, q14 -+- vqmovun.s16 d7, q15 -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q14 -++ vqadd.s8 q2, q8 -++ vqadd.s8 q3, q9 -++ vsub.s8 q2, q14 -++ vsub.s8 q3, q14 -+ .endm -+ -+ function ff_hevc_sao_band_w8_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #4 -+- vld1.8 {d4}, [r1,:64], r3 -+- vld1.8 {d5}, [r1,:64], r3 -+- vld1.8 {d6}, [r1,:64], r3 -+- vld1.8 {d7}, [r1,:64], r3 -++ vld1.8 {d4}, [r1, :64], r3 -++ vld1.8 {d5}, [r1, :64], r3 -++ vld1.8 {d6}, [r1, :64], r3 -++ vld1.8 {d7}, [r1, :64], r3 -+ sao_band_32 -+- vst1.8 {d4}, [r0,:64], r2 -+- vst1.8 {d5}, [r0,:64], r2 -+- vst1.8 {d6}, [r0,:64], r2 -+- vst1.8 {d7}, [r0,:64], r2 -++ vst1.8 {d4}, [r0, :64], r2 -++ vst1.8 {d5}, [r0, :64], r2 -++ vst1.8 {d6}, [r0, :64], r2 -++ vst1.8 {d7}, [r0, :64], r2 -+ bne 1b -+ -+ bx lr -+@@ -68,11 +64,11 @@ endfunc -+ function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #2 -+- vld1.8 {q2}, [r1,:128], r3 -+- vld1.8 {q3}, [r1,:128], r3 -++ vld1.8 {q2}, [r1, :128], r3 -++ vld1.8 {q3}, [r1, :128], r3 -+ sao_band_32 -+- vst1.8 {q2}, [r0,:128], r2 -+- vst1.8 {q3}, [r0,:128], r2 -++ vst1.8 {q2}, [r0, :128], r2 -++ vst1.8 {q3}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -81,9 +77,9 @@ endfunc -+ function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1,:128], r3 -++ vld1.8 {q2-q3}, [r1, :128], r3 -+ sao_band_32 -+- vst1.8 {q2-q3}, [r0,:128], r2 -++ vst1.8 {q2-q3}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -92,263 +88,153 @@ endfunc -+ function ff_hevc_sao_band_w64_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1,:128]! -++ pld [r1, r3] -++ vld1.8 {q2-q3}, [r1, :128]! -+ sao_band_32 -+- vst1.8 {q2-q3}, [r0,:128]! -+- vld1.8 {q2-q3}, [r1,:128], r3 -++ vst1.8 {q2-q3}, [r0, :128]! -++ vld1.8 {q2-q3}, [r1, :128], r3 -+ sub r1, #32 -+ sao_band_32 -+- vst1.8 {q2-q3}, [r0,:128], r2 -++ vst1.8 {q2-q3}, [r0, :128], r2 -+ sub r0, #32 -+ bne 1b -+ -+ bx lr -+ endfunc -+- -++// input -++// a in q0 - q3 -++// c in q4 - q7 -++// b in q8 - q11 -++// offset table in r7 and r5 -++// output in q0 - q3 -++// clobbers q12 - q15 -+ .macro edge_w64_body -+- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q5, q1 -+- vcgt.u8 q1, q1, q5 -+- vcgt.u8 q14, q6, q2 -+- vcgt.u8 q2, q2, q6 -+- vcgt.u8 q15, q7, q3 -+- vcgt.u8 q3, q3, q7 -+- -+- vsub.s8 q12, q0, q12 // diff0 -+- vsub.s8 q13, q1, q13 -+- vsub.s8 q14, q2, q14 -+- vsub.s8 q15, q3, q15 -+- -++ vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q5, q1 -++ vcgt.u8 q1, q1, q5 -++ vsub.s8 q12, q0, q12 // diff0 -+ vcgt.u8 q0, q4, q8 // c > b -+- vcgt.u8 q8, q8, q4 // b > c -++ vsub.s8 q13, q1, q13 -++ -++ vcgt.u8 q14, q8, q4 // b > c -+ vcgt.u8 q1, q5, q9 -+- vcgt.u8 q9, q9, q5 -+- vcgt.u8 q2, q6, q10 -+- vcgt.u8 q10, q10, q6 -+- vcgt.u8 q3, q7, q11 -+- vcgt.u8 q11, q11, q7 -++ vcgt.u8 q15, q9, q5 -++ vsub.s8 q0, q14, q0 // diff1 -+ -+- vsub.s8 q0, q8, q0 // diff1 -+- vsub.s8 q1, q9, q1 -+- vsub.s8 q2, q10, q2 -+- vsub.s8 q3, q11, q3 -++ vsub.s8 q1, q15, q1 -+ -+- vadd.s8 q0, q12 //diff0 + diff1 -+- vadd.s8 q1, q13 -+- vadd.s8 q2, q14 -+- vadd.s8 q3, q15 -+- -+- vdup.s8 q9, r6 // 3 to all elements -+- sub r6, #1 -+- -+- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -+- vclt.s8 q13, q1, #0 -+- vclt.s8 q14, q2, #0 -+- vclt.s8 q15, q3, #0 -+- -+- vadd.s8 q8, q0, q9 // diff0 + diff1 + 3 -+- vadd.s8 q10, q1, q9 -+- vand.8 q12, q8, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -+- vand.8 q13, q10, q13 -+- vadd.s8 q8, q2, q9 -+- vadd.s8 q10, q3, q9 -+- vand.8 q14, q8, q14 -+- vand.8 q15, q10, q15 -+- -+- vdup.s8 q9, r6 // 2 to all elements -+- add r6, #1 -+- -+- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -+- vadd.s8 q8, q0, q9 // diff0 + diff1 + 2 -+- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vcgt.s8 q10, q1, #0 -+- vadd.s8 q0, q11, q12 // offset_idx -+- -+- vadd.s8 q8, q1, q9 // diff0 + diff1 + 2 -+- vcgt.s8 q12, q2, #0 -+- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vadd.s8 q8, q2, q9 // diff0 + diff1 + 2 -+- vadd.s8 q1, q11, q13 -+- -+- vand.8 q11, q8, q12 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vcgt.s8 q10, q3, #0 -+- vadd.s8 q2, q11, q14 -+- -+- vadd.s8 q8, q3, q9 // diff0 + diff1 + 2 -+- vmov.32 d18[0], r7 // load offset table from general registers -+- vand.8 q11, q8, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vmov.32 d18[1], r5 // load rest of offset table -+- vadd.s8 q3, q11, q15 -+- -+- vtbl.8 d0, {d18}, d0 -+- vtbl.8 d1, {d18}, d1 -+- vtbl.8 d2, {d18}, d2 -+- vtbl.8 d3, {d18}, d3 -+- vtbl.8 d4, {d18}, d4 -+- vtbl.8 d5, {d18}, d5 -+- vtbl.8 d6, {d18}, d6 -+- vtbl.8 d7, {d18}, d7 -+- -+- vmovl.u8 q8, d8 -+- vmovl.u8 q9, d9 -+- vmovl.u8 q10, d10 -+- vmovl.u8 q11, d11 -+- vmovl.u8 q12, d12 -+- vmovl.u8 q13, d13 -+- vmovl.u8 q14, d14 -+- vmovl.u8 q15, d15 -+- -+- vaddw.s8 q8, d0 -+- vaddw.s8 q9, d1 -+- vaddw.s8 q10, d2 -+- vaddw.s8 q11, d3 -+- vaddw.s8 q12, d4 -+- vaddw.s8 q13, d5 -+- vaddw.s8 q14, d6 -+- vaddw.s8 q15, d7 -+- -+- vqmovun.s16 d0, q8 -+- vqmovun.s16 d1, q9 -+- vqmovun.s16 d2, q10 -+- vqmovun.s16 d3, q11 -+- vqmovun.s16 d4, q12 -+- vqmovun.s16 d5, q13 -+- vqmovun.s16 d6, q14 -+- vqmovun.s16 d7, q15 -+- -+- vstm r0, {q0-q3} -+- add r0, r2 -+-.endm -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -+ -+-.macro edge_w32_body -+- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q5, q1 -+- vcgt.u8 q1, q1, q5 -++ vcgt.u8 q14, q6, q2 -++ vcgt.u8 q2, q2, q6 -++ vcgt.u8 q15, q7, q3 -++ vcgt.u8 q3, q3, q7 -+ -+- vsub.s8 q12, q0, q12 // diff0 -+- vcgt.u8 q0, q4, q8 // c > b -+- vsub.s8 q13, q1, q13 // diff0 part 2 -++ vsub.s8 q14, q2, q14 -++ vcgt.u8 q2, q6, q10 -++ vsub.s8 q15, q3, q15 -+ -+- vcgt.u8 q6, q8, q4 // b > c -+- vcgt.u8 q1, q5, q9 -+- vcgt.u8 q7, q9, q5 -++ vcgt.u8 q12, q10, q6 -++ vcgt.u8 q3, q7, q11 -++ vcgt.u8 q13, q11, q7 -++ vsub.s8 q2, q12, q2 -++ vsub.s8 q3, q13, q3 -+ -+- vsub.s8 q0, q6, q0 // diff1 -+- vsub.s8 q1, q7, q1 // diff1 part 2 -+- vadd.s8 q0, q12 //diff0 + diff1 -++ vmov.s8 q13, #2 // 2 to all elements -+ -+- vdup.s8 q7, r6 // 3 to all elements -+- sub r6, #1 -+- vadd.s8 q1, q13 -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q15 -++ -++ vmov.32 d24[0], r4 // load offset table from general registers -++ vmov.32 d24[1], r5 // load rest of offset table -+ -+- vclt.s8 q12, q0, #0 // diff0 + diff1 < 0 -+- vclt.s8 q13, q1, #0 -+- -+- vadd.s8 q6, q0, q7 // diff0 + diff1 + 3 -+- vadd.s8 q10, q1, q7 -+- vdup.s8 q7, r6 // 2 to all elements -+- add r6, #1 -+- vand.8 q12, q6, q12 // if (diff0 + diff1 < 0) then (diff0 + diff1 + 3) else 0 -+- vand.8 q13, q10, q13 -+- -+- -+- vcgt.s8 q10, q0, #0 // diff0 + diff1 > 0 -+- vadd.s8 q6, q0, q7 // diff0 + diff1 + 2 -+- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vcgt.s8 q10, q1, #0 -+- vadd.s8 q0, q11, q12 // offset_idx -+- -+- vadd.s8 q6, q1, q7 // diff0 + diff1 + 2 -+- vmov.32 d14[0], r7 // load offset table from general registers -+- vand.8 q11, q6, q10 // if (diff0 + diff1 > 0) then (diff0 + diff1 + 2) else 0 -+- vmov.32 d14[1], r5 // load rest of offset table -+- vadd.s8 q1, q11, q13 -+- -+- vtbl.8 d0, {d14}, d0 -+- vtbl.8 d1, {d14}, d1 -+- vtbl.8 d2, {d14}, d2 -+- vtbl.8 d3, {d14}, d3 -+- -+- vmovl.u8 q6, d8 -+- vmovl.u8 q7, d9 -+- vmovl.u8 q10, d10 -+- vmovl.u8 q11, d11 -+- -+- vaddw.s8 q6, d0 -+- vaddw.s8 q7, d1 -+- vaddw.s8 q10, d2 -+- vaddw.s8 q11, d3 -+- -+- vqmovun.s16 d0, q6 -+- vqmovun.s16 d1, q7 -+- vqmovun.s16 d2, q10 -+- vqmovun.s16 d3, q11 -+- -+- vstm r0, {q0-q1} -+- add r0, r2 -++ vadd.s8 q0, q13 -++ vadd.s8 q1, q13 -++ vadd.s8 q2, q13 -++ vadd.s8 q3, q13 -++ -++ vmov.u8 q15, #128 // s8 #-128 -++ vtbl.8 d0, {d24}, d0 -++ vtbl.8 d1, {d24}, d1 -++ vtbl.8 d2, {d24}, d2 -++ vtbl.8 d3, {d24}, d3 -++ vtbl.8 d4, {d24}, d4 -++ vtbl.8 d5, {d24}, d5 -++ vtbl.8 d6, {d24}, d6 -++ vtbl.8 d7, {d24}, d7 -++ -++ vadd.s8 q12, q4, q15 -++ vadd.s8 q13, q5, q15 -++ vadd.s8 q14, q6, q15 -++ vadd.s8 q15, q7, q15 -++ vqadd.s8 q12, q0 -++ vqadd.s8 q15, q3 -++ vmov.u8 q3, #128 // s8 #-128 -++ vqadd.s8 q13, q1 -++ vqadd.s8 q14, q2 -++ vsub.s8 q0, q12, q3 -++ vsub.s8 q1, q13, q3 -++ vsub.s8 q2, q14, q3 -++ vsub.s8 q3, q15, q3 -++ vst1.8 {q0-q1}, [r0, :128]! -++ vst1.8 {q2-q3}, [r0, :128], r2 -++ sub r0, #32 -+ .endm -+ -+-function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -++.macro init_edge_64 -++ push {r4-r5} -++ ldr r12, [sp, #8] // height -++ ldr r5, [sp, #12] // sao_offset_val_table -++ ldr r4, [r5] -+ add r5, #4 -+ ldr r5, [r5] -++.endm -++ -++function ff_hevc_sao_edge_eo0_w64_neon_8, export=1 -++ init_edge_64 -+ vpush {d8-d15} -+ sub r1, #8 -+-1: subs r4, #1 -+- vld1.64 {q10-q11}, [r1]! -+- vld1.64 {q12-q13}, [r1]! -+- vld1.64 {q14}, [r1], r3 -+- sub r1, #64 -++1: subs r12, #1 -++ vld1.64 {d7}, [r1, :64]! -++ vld1.64 {q4-q5}, [r1, :128]! // load c -++ vld1.64 {q6-q7}, [r1, :128]! -++ vld1.64 {d24}, [r1, :64], r3 -++ sub r1, #72 -+ // load a -+- vext.8 q0, q10, q11, #7 -+- vext.8 q1, q11, q12, #7 -+- vext.8 q2, q12, q13, #7 -+- vext.8 q3, q13, q14, #7 -+- // load c -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -+- vext.8 q6, q12, q13, #8 -+- vext.8 q7, q13, q14, #8 -++ vext.8 q0, q3, q4, #15 -++ vext.8 q1, q4, q5, #15 -++ vext.8 q2, q5, q6, #15 -++ vext.8 q3, q6, q7, #15 -+ // load b -+- vext.8 q8, q10, q11, #9 -+- vext.8 q9, q11, q12, #9 -+- vext.8 q10, q12, q13, #9 -+- vext.8 q11, q13, q14, #9 -++ vext.8 q8, q4, q5, #1 -++ vext.8 q9, q5, q6, #1 -++ vext.8 q10, q6, q7, #1 -++ vext.8 q11, q7, q12, #1 -+ edge_w64_body -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -++ init_edge_64 -+ vpush {d8-d15} -+ sub r1, r3 -+ // load a -+- vld1.8 {q0-q1}, [r1]! -+- vld1.8 {q2-q3}, [r1], r3 -++ vld1.8 {q0-q1}, [r1, :128]! -++ vld1.8 {q2-q3}, [r1, :128], r3 -+ sub r1, #32 -+-1: subs r4, #1 -+ // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -++ vld1.8 {q4-q5}, [r1, :128]! -++ vld1.8 {q6-q7}, [r1, :128], r3 -+ sub r1, #32 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q8-q9}, [r1]! -+- vld1.8 {q10-q11}, [r1] -++ vld1.8 {q8-q9}, [r1, :128]! -++ vld1.8 {q10-q11}, [r1, :128], r3 -+ sub r1, #32 -+ edge_w64_body -+ // copy c to a -+@@ -356,20 +242,19 @@ function ff_hevc_sao_edge_eo1_w64_neon_8, export=1 -+ vmov.64 q1, q5 -+ vmov.64 q2, q6 -+ vmov.64 q3, q7 -++ // copy b to c -++ vmov.64 q4, q8 -++ vmov.64 q5, q9 -++ vmov.64 q6, q10 -++ vmov.64 q7, q11 -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -++ init_edge_64 -+ vpush {d8-d15} -+ 1: sub r1, r3 -+ // load a -+@@ -379,10 +264,10 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #31 -+- subs r4, #1 -++ subs r12, #1 -+ // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -++ vld1.8 {q4-q5}, [r1, :128]! -++ vld1.8 {q6-q7}, [r1, :128], r3 -+ sub r1, #32 -+ // load b -+ add r1, #1 -+@@ -390,25 +275,14 @@ function ff_hevc_sao_edge_eo2_w64_neon_8, export=1 -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #33 -+ edge_w64_body -+- // copy c to a -+- vmov.64 q0, q4 -+- vmov.64 q1, q5 -+- vmov.64 q2, q6 -+- vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -++ init_edge_64 -+ vpush {d8-d15} -+ 1: sub r1, r3 -+ // load a -+@@ -418,10 +292,10 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ vld1.8 {q0-q1}, [r1]! -+ vld1.8 {q2-q3}, [r1], r3 -+ sub r1, #33 -+- subs r4, #1 -++ subs r12, #1 -+ // load c -+- vld1.8 {q4-q5}, [r1]! -+- vld1.8 {q6-q7}, [r1], r3 -++ vld1.8 {q4-q5}, [r1, :128]! -++ vld1.8 {q6-q7}, [r1, :128], r3 -+ sub r1, #32 -+ // load b -+ sub r1, #1 -+@@ -429,178 +303,176 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ vld1.8 {q10-q11}, [r1] -+ sub r1, #31 -+ edge_w64_body -+- // copy c to a -+- vmov.64 q0, q4 -+- vmov.64 q1, q5 -+- vmov.64 q2, q6 -+- vmov.64 q3, q7 -+ bne 1b -+ vpop {d8-d15} -+- pop {r4-r8} -++ pop {r4-r5} -+ bx lr -+ endfunc -+ -++// inputs: -++// a in q0, q1 -++// c in q2, q3 -++// b in q8, q9 -++// offset table in d31 -++// clobbered registers q0, q1, q10, q11, q12, q13 -++// output q0, q1 -++.macro edge_w32_body -++ vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 -++ vcgt.u8 q13, q3, q1 -++ vcgt.u8 q1, q1, q3 -++ -++ vsub.s8 q12, q0, q12 // diff0 -++ vcgt.u8 q0, q2, q8 // c > b -++ vsub.s8 q13, q1, q13 // diff0 part 2 -++ -++ vcgt.u8 q10, q8, q2 // b > c -++ vcgt.u8 q1, q3, q9 -++ vcgt.u8 q11, q9, q3 -++ -++ vsub.s8 q0, q10, q0 // diff1 -++ -++ vmov.s8 q10, #2 // 2 to all elements -++ vsub.s8 q1, q11, q1 // diff1 part 2 -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ -++ vadd.s8 q0, q10 -++ vadd.s8 q1, q10 -++ -++ vmov.u8 q10, #128 -++ vtbl.8 d0, {d31}, d0 -++ vtbl.8 d1, {d31}, d1 -++ vtbl.8 d2, {d31}, d2 -++ vtbl.8 d3, {d31}, d3 -++ -++ vadd.s8 q11, q2, q10 -++ vadd.s8 q12, q3, q10 -++ vqadd.s8 q11, q0 -++ vqadd.s8 q12, q1 -++ vsub.s8 q0, q11, q10 -++ vsub.s8 q1, q12, q10 -++ vst1.8 {q0-q1}, [r0, :128], r2 -++.endm -++ -++.macro init_edge_32 -++ ldr r12, [sp, #4] // sao_offset_val_table -++ vld1.32 {d31}, [r12] -++ ldr r12, [sp] // height -++.endm -++ -+ function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -+- vpush {d8-d15} -+- sub r1, #8 // load 8 extra bytes -+-1: subs r4, #1 -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 // only first 9 bytes are used -+- sub r1, #32 -++ init_edge_32 -++ sub r1, #4 // load 4 extra bytes -++1: subs r12, #1 -++ vld1.32 d3[1], [r1]! -++ vld1.8 {q2-q3}, [r1, :128]! // c -++ vld1.32 d20[0], [r1], r3 -++ sub r1, #36 -+ // a -+- vext.8 q0, q10, q11, #7 -+- vext.8 q1, q11, q12, #7 -+- // c -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -++ vext.8 q0, q1, q2, #15 -++ vext.8 q1, q2, q3, #15 -+ // b -+- vext.8 q8, q10, q11, #9 -+- vext.8 q9, q11, q12, #9 -++ vext.8 q8, q2, q3, #1 -++ vext.8 q9, q3, q10, #1 -+ edge_w32_body -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ bne 1b -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -+- vpush {d8-d15} -++ init_edge_32 -+ // load a -+ sub r1, r3 -+- vld1.8 {q0-q1}, [r1], r3 -++ vld1.8 {q0-q1}, [r1, :128], r3 -+ // load c -+- vld1.8 {q4-q5}, [r1], r3 -+-1: subs r4, #1 -++ vld1.8 {q2-q3}, [r1, :128], r3 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q8-q9}, [r1], r3 -++ vld1.8 {q8-q9}, [r1, :128], r3 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+- vmov.64 q0, q4 -+- vmov.64 q1, q5 -++ vmov.64 q0, q2 -++ vmov.64 q1, q3 -+ // c -+- vmov.64 q4, q8 -+- vmov.64 q5, q9 -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ vmov.64 q2, q8 -++ vmov.64 q3, q9 -++ bne 1b -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- ldr r5, [r5] -+- vpush {d8-d15} -++ init_edge_32 -++ vpush {d8-d15} -+ // load a -+ sub r1, r3 -+- sub r1, #8 -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -++ sub r1, #8 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {d24}, [r1, :64], r3 -++ sub r1, #32 -+ vext.8 q0, q10, q11, #7 -+ vext.8 q1, q11, q12, #7 -+ // load c -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -+- vext.8 q2, q10, q11, #7 -+-1: subs r4, #1 -++ vld1.8 {d9}, [r1, :64]! -++ vld1.8 {q2-q3}, [r1, :64], r3 -++ sub r1, #8 -++ vext.8 q4, q4, q2, #15 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {q12}, [r1, :64], r3 -++ sub r1, #32 -+ vext.8 q8, q10, q11, #9 -+ vext.8 q9, q11, q12, #9 -+- vext.8 q14, q10, q11, #8 -+- vext.8 q15, q11, q12, #8 -+- vext.8 q3, q10, q11, #7 -++ vext.8 q6, q10, q11, #8 -++ vext.8 q7, q11, q12, #8 -++ vext.8 q5, q10, q11, #7 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+- vmov.8 q0, q2 -+- vext.8 q1, q4, q5, #15 -++ vmov.8 q0, q4 -++ vext.8 q1, q2, q3, #15 -+ // c -+- vmov.8 q4, q14 -+- vmov.8 q5, q15 -+- vmov.8 q2, q3 -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ vmov.8 q2, q6 -++ vmov.8 q3, q7 -++ vmov.8 q4, q5 -++ bne 1b -++ vpop {d8-d15} -++ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -+- push {r4-r8} -+- ldr r4, [sp, #20] // height -+- ldr r5, [sp, #24] // sao_offset_val_table -+- ldr r6, =0x03 -+- ldr r7, [r5] -+- add r5, #4 -+- sub r1, r3 -+- ldr r5, [r5] -+- sub r1, #8 -+- vpush {d8-d15} -++ init_edge_32 -++ sub r1, r3 -+ // load a -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -+- vext.8 q0, q10, q11, #9 -+- vext.8 q1, q11, q12, #9 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {d24}, [r1, :64], r3 -++ sub r1, #32 -++ vext.8 q0, q10, q11, #1 -++ vext.8 q1, q11, q12, #1 -+ // load c -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -+- vext.8 q4, q10, q11, #8 -+- vext.8 q5, q11, q12, #8 -+- vext.8 q2, q12, q11, #8 -+-1: subs r4, #1 -++ vld1.8 {q2-q3}, [r1, :64]! -++ vld1.8 {d30}, [r1, :64], r3 -++ sub r1, #40 -++1: subs r12, #1 -+ // load b -+- vld1.8 {q10-q11}, [r1] -+- add r1, #32 -+- vld1.8 {q12}, [r1], r3 -+- sub r1, #32 -++ vld1.8 {q10-q11}, [r1, :64]! -++ vld1.8 {q12}, [r1, :64], r3 -++ sub r1, #32 -+ vext.8 q8, q10, q11, #7 -+ vext.8 q9, q11, q12, #7 -+- vext.8 q3, q12, q10, #7 -++ vext.8 q14, q12, q10, #7 -+ edge_w32_body -+ // inputs for next loop iteration -+ // a -+- vext.8 q0, q4, q5, #1 -+- vext.8 q1, q5, q2, #1 -++ vext.8 q0, q2, q3, #1 -++ vext.8 q1, q3, q15, #1 -+ // c -+- vext.8 q4, q8, q9, #1 -+- vext.8 q5, q9, q3, #1 -+- vext.8 q2, q3, q1, #1 -+- bne 1b -+- vpop {d8-d15} -+- pop {r4-r8} -+- bx lr -++ vext.8 q2, q8, q9, #1 -++ vext.8 q3, q9, q14, #1 -++ vext.8 d30, d28, d2, #1 -++ bne 1b -++ bx lr -+ endfunc -+ -+-- -+2.5.0 -+ -+ -+From 016c39d46b86830204a4519590332d2a38f7ee51 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Thu, 8 Jan 2015 09:58:55 +0200 -+Subject: [PATCH 7/9] small optimization to SAO BAND. correct path for -+ bit_depth_template.c -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 2 +- -+ libavcodec/arm/hevcdsp_sao_neon.S | 2 +- -+ 2 files changed, 2 insertions(+), 2 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 8d6e863..385c35d 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -23,7 +23,7 @@ -+ #include "libavcodec/hevcdsp.h" -+ #include "hevcdsp_arm.h" -+ #include "libavcodec/avcodec.h" -+-#include "../bit_depth_template.c" -++#include "libavcodec/bit_depth_template.c" -+ -+ void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+ void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 5fc482b..710b32b 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -26,12 +26,12 @@ -+ pld [r1] -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #4] // height -++ vmov.u8 q14, #128 -+ .endm -+ -+ .macro sao_band_32 -+ vshr.u8 q8, q2, #3 -+ vshr.u8 q9, q3, #3 -+- vmov.u8 q14, #128 -+ vtbl.8 d16, {q0, q1}, d16 -+ vtbl.8 d17, {q0, q1}, d17 -+ vtbl.8 d18, {q0, q1}, d18 -+-- -+2.5.0 -+ -+ -+From 579f1584d688e1ac24fb7d22697e2a7b64f62e8e Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Fri, 9 Jan 2015 10:28:52 +0200 -+Subject: [PATCH 8/9] Added height check for SAO NEON optimizations. Faster SAO -+ band NEON Some reordering to use NEON pipelines more efficiently -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 12 +++- -+ libavcodec/arm/hevcdsp_sao_neon.S | 142 ++++++++++++++++++++++--------------- -+ 2 files changed, 93 insertions(+), 61 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 385c35d..6d0689c 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -176,6 +176,7 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ int8_t offset_table[32] = { 0 }; -+ int k, y, x; -+ int shift = 3; // BIT_DEPTH - 5 -++ int cwidth = 0; -+ -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+@@ -183,7 +184,10 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ for (k = 0; k < 4; k++) -+ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; -+ -+- switch(width){ -++ if (height % 8 == 0) -++ cwidth = width; -++ -++ switch(cwidth){ -+ case 8: -+ ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -+ break; -+@@ -223,15 +227,19 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ pixel *src = (pixel *)_src; -+ int a_stride, b_stride; -+ int x, y; -++ int cwidth = 0; -+ -+ for (x = 0; x < 5; x++) { -+ sao_offset_val[x] = _sao_offset_val[edge_idx[x]]; -+ } -+ -++ if (height % 8 == 0) -++ cwidth = width; -++ -+ stride_src /= sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+- switch (width) { -++ switch (cwidth) { -+ case 32: -+ switch(eo) { -+ case 0: -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 710b32b..08f50b8 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -26,36 +26,59 @@ -+ pld [r1] -+ vld1.8 {q0, q1}, [r12] // offset table -+ ldr r12, [sp, #4] // height -+- vmov.u8 q14, #128 -++ vmov.u8 q3, #128 -+ .endm -+ -+-.macro sao_band_32 -+- vshr.u8 q8, q2, #3 -+- vshr.u8 q9, q3, #3 -+- vtbl.8 d16, {q0, q1}, d16 -+- vtbl.8 d17, {q0, q1}, d17 -+- vtbl.8 d18, {q0, q1}, d18 -+- vtbl.8 d19, {q0, q1}, d19 -+- vadd.s8 q2, q14 -+- vadd.s8 q3, q14 -+- vqadd.s8 q2, q8 -+- vqadd.s8 q3, q9 -+- vsub.s8 q2, q14 -+- vsub.s8 q3, q14 -++// 128 in q3 -++// input q8 - q11 -++// 32 cycles -++.macro sao_band_64 -++ vshr.u8 q12, q8, #3 -++ vshr.u8 q13, q9, #3 -++ vshr.u8 q14, q10, #3 -++ vshr.u8 q15, q11, #3 -++ vtbl.8 d24, {d0, d1, d2, d3}, d24 -++ vadd.s8 q8, q3 -++ vtbl.8 d25, {d0, d1, d2, d3}, d25 -++ vadd.s8 q9, q3 -++ vtbl.8 d26, {d0, d1, d2, d3}, d26 -++ vadd.s8 q10, q3 -++ vtbl.8 d27, {d0, d1, d2, d3}, d27 -++ vadd.s8 q11, q3 -++ vtbl.8 d28, {d0, d1, d2, d3}, d28 -++ vqadd.s8 q8, q12 -++ vtbl.8 d29, {d0, d1, d2, d3}, d29 -++ vqadd.s8 q9, q13 -++ vtbl.8 d30, {d0, d1, d2, d3}, d30 -++ vqadd.s8 q10, q14 -++ vtbl.8 d31, {d0, d1, d2, d3}, d31 -++ vqadd.s8 q11, q15 -++ vsub.s8 q8, q3 -++ vsub.s8 q9, q3 -++ vsub.s8 q10, q3 -++ vsub.s8 q11, q3 -+ .endm -+ -+ function ff_hevc_sao_band_w8_neon_8, export=1 -+ init_sao_band -+-1: subs r12, #4 -+- vld1.8 {d4}, [r1, :64], r3 -+- vld1.8 {d5}, [r1, :64], r3 -+- vld1.8 {d6}, [r1, :64], r3 -+- vld1.8 {d7}, [r1, :64], r3 -+- sao_band_32 -+- vst1.8 {d4}, [r0, :64], r2 -+- vst1.8 {d5}, [r0, :64], r2 -+- vst1.8 {d6}, [r0, :64], r2 -+- vst1.8 {d7}, [r0, :64], r2 -++1: subs r12, #8 -++ vld1.8 {d16}, [r1, :64], r3 -++ vld1.8 {d17}, [r1, :64], r3 -++ vld1.8 {d18}, [r1, :64], r3 -++ vld1.8 {d19}, [r1, :64], r3 -++ vld1.8 {d20}, [r1, :64], r3 -++ vld1.8 {d21}, [r1, :64], r3 -++ vld1.8 {d22}, [r1, :64], r3 -++ vld1.8 {d23}, [r1, :64], r3 -++ sao_band_64 -++ vst1.8 {d16}, [r0, :64], r2 -++ vst1.8 {d17}, [r0, :64], r2 -++ vst1.8 {d18}, [r0, :64], r2 -++ vst1.8 {d19}, [r0, :64], r2 -++ vst1.8 {d20}, [r0, :64], r2 -++ vst1.8 {d21}, [r0, :64], r2 -++ vst1.8 {d22}, [r0, :64], r2 -++ vst1.8 {d23}, [r0, :64], r2 -+ bne 1b -+ -+ bx lr -+@@ -63,12 +86,16 @@ endfunc -+ -+ function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+-1: subs r12, #2 -+- vld1.8 {q2}, [r1, :128], r3 -+- vld1.8 {q3}, [r1, :128], r3 -+- sao_band_32 -+- vst1.8 {q2}, [r0, :128], r2 -+- vst1.8 {q3}, [r0, :128], r2 -++1: subs r12, #4 -++ vld1.8 {q8}, [r1, :128], r3 -++ vld1.8 {q9}, [r1, :128], r3 -++ vld1.8 {q10}, [r1, :128], r3 -++ vld1.8 {q11}, [r1, :128], r3 -++ sao_band_64 -++ vst1.8 {q8}, [r0, :128], r2 -++ vst1.8 {q9}, [r0, :128], r2 -++ vst1.8 {q10}, [r0, :128], r2 -++ vst1.8 {q11}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -76,10 +103,12 @@ endfunc -+ -+ function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+-1: subs r12, #1 -+- vld1.8 {q2-q3}, [r1, :128], r3 -+- sao_band_32 -+- vst1.8 {q2-q3}, [r0, :128], r2 -++1: subs r12, #2 -++ vld1.8 {q8-q9}, [r1, :128], r3 -++ vld1.8 {q10-q11}, [r1, :128], r3 -++ sao_band_64 -++ vst1.8 {q8-q9}, [r0, :128], r2 -++ vst1.8 {q10-q11}, [r0, :128], r2 -+ bne 1b -+ -+ bx lr -+@@ -89,13 +118,12 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #1 -+ pld [r1, r3] -+- vld1.8 {q2-q3}, [r1, :128]! -+- sao_band_32 -+- vst1.8 {q2-q3}, [r0, :128]! -+- vld1.8 {q2-q3}, [r1, :128], r3 -++ vld1.8 {q8-q9}, [r1, :128]! -++ vld1.8 {q10-q11}, [r1, :128], r3 -+ sub r1, #32 -+- sao_band_32 -+- vst1.8 {q2-q3}, [r0, :128], r2 -++ sao_band_64 -++ vst1.8 {q8-q9}, [r0, :128]! -++ vst1.8 {q10-q11}, [r0, :128], r2 -+ sub r0, #32 -+ bne 1b -+ -+@@ -121,7 +149,6 @@ endfunc -+ vcgt.u8 q1, q5, q9 -+ vcgt.u8 q15, q9, q5 -+ vsub.s8 q0, q14, q0 // diff1 -+- -+ vsub.s8 q1, q15, q1 -+ -+ vadd.s8 q0, q12 //diff0 + diff1 -+@@ -157,27 +184,25 @@ endfunc -+ -+ vmov.u8 q15, #128 // s8 #-128 -+ vtbl.8 d0, {d24}, d0 -++ vadd.s8 q13, q4, q15 -+ vtbl.8 d1, {d24}, d1 -++ vadd.s8 q14, q5, q15 -+ vtbl.8 d2, {d24}, d2 -++ vqadd.s8 q0, q13 -+ vtbl.8 d3, {d24}, d3 -++ vqadd.s8 q1, q14 -+ vtbl.8 d4, {d24}, d4 -++ vadd.s8 q13, q6, q15 -+ vtbl.8 d5, {d24}, d5 -++ vadd.s8 q14, q7, q15 -+ vtbl.8 d6, {d24}, d6 -++ vqadd.s8 q2, q13 -+ vtbl.8 d7, {d24}, d7 -+- -+- vadd.s8 q12, q4, q15 -+- vadd.s8 q13, q5, q15 -+- vadd.s8 q14, q6, q15 -+- vadd.s8 q15, q7, q15 -+- vqadd.s8 q12, q0 -+- vqadd.s8 q15, q3 -+- vmov.u8 q3, #128 // s8 #-128 -+- vqadd.s8 q13, q1 -+- vqadd.s8 q14, q2 -+- vsub.s8 q0, q12, q3 -+- vsub.s8 q1, q13, q3 -+- vsub.s8 q2, q14, q3 -+- vsub.s8 q3, q15, q3 -++ vqadd.s8 q3, q14 -++ vsub.s8 q0, q15 -++ vsub.s8 q1, q15 -++ vsub.s8 q2, q15 -++ vsub.s8 q3, q15 -+ vst1.8 {q0-q1}, [r0, :128]! -+ vst1.8 {q2-q3}, [r0, :128], r2 -+ sub r0, #32 -+@@ -342,13 +367,12 @@ endfunc -+ -+ vmov.u8 q10, #128 -+ vtbl.8 d0, {d31}, d0 -++ vadd.s8 q11, q2, q10 -+ vtbl.8 d1, {d31}, d1 -++ vadd.s8 q12, q3, q10 -+ vtbl.8 d2, {d31}, d2 -++ vqadd.s8 q11, q0 -+ vtbl.8 d3, {d31}, d3 -+- -+- vadd.s8 q11, q2, q10 -+- vadd.s8 q12, q3, q10 -+- vqadd.s8 q11, q0 -+ vqadd.s8 q12, q1 -+ vsub.s8 q0, q11, q10 -+ vsub.s8 q1, q12, q10 -+-- -+2.5.0 -+ -+ -+From 026bac1824e4936e948e6b1efec82868c520ea66 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Mon, 2 Feb 2015 16:08:27 +0200 -+Subject: [PATCH 9/9] Further SAO NEON optimisations -+ -+--- -+ libavcodec/arm/hevcdsp_init_neon.c | 16 +-- -+ libavcodec/arm/hevcdsp_sao_neon.S | 224 +++++++++++++++++++------------------ -+ 2 files changed, 124 insertions(+), 116 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 6d0689c..e5da7e9 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -45,10 +45,10 @@ void ff_hevc_transform_add_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, -+ void ff_hevc_transform_add_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, -+ ptrdiff_t stride); -+ -+-void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+-void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+-void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -+-void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int8_t * offset_table, int height); -++void ff_hevc_sao_band_w8_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -++void ff_hevc_sao_band_w16_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -++void ff_hevc_sao_band_w32_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -++void ff_hevc_sao_band_w64_neon_8(uint8_t *_dst, uint8_t *_src, int8_t * offset_table, ptrdiff_t stride_src, ptrdiff_t stride_dst, int height); -+ -+ void ff_hevc_sao_edge_eo0_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+ void ff_hevc_sao_edge_eo1_w32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int height, int8_t *sao_offset_table); -+@@ -189,16 +189,16 @@ static void ff_hevc_sao_band_neon_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_ -+ -+ switch(cwidth){ -+ case 8: -+- ff_hevc_sao_band_w8_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w8_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ case 16: -+- ff_hevc_sao_band_w16_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w16_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ case 32: -+- ff_hevc_sao_band_w32_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w32_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ case 64: -+- ff_hevc_sao_band_w64_neon_8(_dst, _src, stride_dst, stride_src, offset_table, height); -++ ff_hevc_sao_band_w64_neon_8(_dst, _src, offset_table, stride_src, stride_dst, height); -+ break; -+ default: -+ for (y = 0; y < height; y++) { -+diff --git a/libavcodec/arm/hevcdsp_sao_neon.S b/libavcodec/arm/hevcdsp_sao_neon.S -+index 08f50b8..9c7808d 100644 -+--- a/libavcodec/arm/hevcdsp_sao_neon.S -++++ b/libavcodec/arm/hevcdsp_sao_neon.S -+@@ -22,21 +22,16 @@ -+ #include "neon.S" -+ -+ .macro init_sao_band -+- ldr r12, [sp, #0] // offset_table address -+ pld [r1] -+- vld1.8 {q0, q1}, [r12] // offset table -+- ldr r12, [sp, #4] // height -++ vld1.8 {q0, q1}, [r2] // offset table -++ ldr r2, [sp, #0] // stride_dst -++ ldr r12, [sp, #4] // height -+ vmov.u8 q3, #128 -+ .endm -+ -+ // 128 in q3 -+ // input q8 - q11 -+-// 32 cycles -+ .macro sao_band_64 -+- vshr.u8 q12, q8, #3 -+- vshr.u8 q13, q9, #3 -+- vshr.u8 q14, q10, #3 -+- vshr.u8 q15, q11, #3 -+ vtbl.8 d24, {d0, d1, d2, d3}, d24 -+ vadd.s8 q8, q3 -+ vtbl.8 d25, {d0, d1, d2, d3}, d25 -+@@ -52,8 +47,8 @@ -+ vtbl.8 d30, {d0, d1, d2, d3}, d30 -+ vqadd.s8 q10, q14 -+ vtbl.8 d31, {d0, d1, d2, d3}, d31 -+- vqadd.s8 q11, q15 -+ vsub.s8 q8, q3 -++ vqadd.s8 q11, q15 -+ vsub.s8 q9, q3 -+ vsub.s8 q10, q3 -+ vsub.s8 q11, q3 -+@@ -64,12 +59,16 @@ function ff_hevc_sao_band_w8_neon_8, export=1 -+ 1: subs r12, #8 -+ vld1.8 {d16}, [r1, :64], r3 -+ vld1.8 {d17}, [r1, :64], r3 -++ vshr.u8 q12, q8, #3 -+ vld1.8 {d18}, [r1, :64], r3 -+ vld1.8 {d19}, [r1, :64], r3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {d20}, [r1, :64], r3 -+ vld1.8 {d21}, [r1, :64], r3 -++ vshr.u8 q14, q10, #3 -+ vld1.8 {d22}, [r1, :64], r3 -+ vld1.8 {d23}, [r1, :64], r3 -++ vshr.u8 q15, q11, #3 -+ sao_band_64 -+ vst1.8 {d16}, [r0, :64], r2 -+ vst1.8 {d17}, [r0, :64], r2 -+@@ -88,9 +87,13 @@ function ff_hevc_sao_band_w16_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #4 -+ vld1.8 {q8}, [r1, :128], r3 -++ vshr.u8 q12, q8, #3 -+ vld1.8 {q9}, [r1, :128], r3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {q10}, [r1, :128], r3 -++ vshr.u8 q14, q10, #3 -+ vld1.8 {q11}, [r1, :128], r3 -++ vshr.u8 q15, q11, #3 -+ sao_band_64 -+ vst1.8 {q8}, [r0, :128], r2 -+ vst1.8 {q9}, [r0, :128], r2 -+@@ -105,7 +108,11 @@ function ff_hevc_sao_band_w32_neon_8, export=1 -+ init_sao_band -+ 1: subs r12, #2 -+ vld1.8 {q8-q9}, [r1, :128], r3 -++ vshr.u8 q12, q8, #3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {q10-q11}, [r1, :128], r3 -++ vshr.u8 q14, q10, #3 -++ vshr.u8 q15, q11, #3 -+ sao_band_64 -+ vst1.8 {q8-q9}, [r0, :128], r2 -+ vst1.8 {q10-q11}, [r0, :128], r2 -+@@ -119,7 +126,11 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ 1: subs r12, #1 -+ pld [r1, r3] -+ vld1.8 {q8-q9}, [r1, :128]! -++ vshr.u8 q12, q8, #3 -++ vshr.u8 q13, q9, #3 -+ vld1.8 {q10-q11}, [r1, :128], r3 -++ vshr.u8 q14, q10, #3 -++ vshr.u8 q15, q11, #3 -+ sub r1, #32 -+ sao_band_64 -+ vst1.8 {q8-q9}, [r0, :128]! -+@@ -129,51 +140,18 @@ function ff_hevc_sao_band_w64_neon_8, export=1 -+ -+ bx lr -+ endfunc -+-// input -+-// a in q0 - q3 -+-// c in q4 - q7 -+-// b in q8 - q11 -+-// offset table in r7 and r5 -+-// output in q0 - q3 -+-// clobbers q12 - q15 -+-.macro edge_w64_body -+- vcgt.u8 q12, q4, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q4 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q5, q1 -+- vcgt.u8 q1, q1, q5 -+- vsub.s8 q12, q0, q12 // diff0 -+- vcgt.u8 q0, q4, q8 // c > b -+- vsub.s8 q13, q1, q13 -+- -+- vcgt.u8 q14, q8, q4 // b > c -+- vcgt.u8 q1, q5, q9 -+- vcgt.u8 q15, q9, q5 -+- vsub.s8 q0, q14, q0 // diff1 -+- vsub.s8 q1, q15, q1 -+ -+- vadd.s8 q0, q12 //diff0 + diff1 -+- vadd.s8 q1, q13 -+- -+- vcgt.u8 q14, q6, q2 -+- vcgt.u8 q2, q2, q6 -+- vcgt.u8 q15, q7, q3 -+- vcgt.u8 q3, q3, q7 -+- -+- vsub.s8 q14, q2, q14 -+- vcgt.u8 q2, q6, q10 -+- vsub.s8 q15, q3, q15 -+- -+- vcgt.u8 q12, q10, q6 -+- vcgt.u8 q3, q7, q11 -+- vcgt.u8 q13, q11, q7 -+- vsub.s8 q2, q12, q2 -+- vsub.s8 q3, q13, q3 -++.macro diff32 out0, out1, tmp0, tmp1, in0, in1, in2, in3 -++ vcgt.u8 \out0, \in2, \in0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 \tmp0, \in0, \in2 // a > c -> -1 , otherwise 0 -++ vcgt.u8 \out1, \in3, \in1 // c > a -> -1 , otherwise 0 part 2 -++ vcgt.u8 \tmp1, \in1, \in3 // a > c -> -1 , otherwise 0 part 2 -++ vsub.s8 \out0, \tmp0, \out0 // diff0 -++ vsub.s8 \out1, \tmp1, \out1 // diff0 part 2 -++.endm -+ -++.macro table64 -+ vmov.s8 q13, #2 // 2 to all elements -+- -+- vadd.s8 q2, q14 -+- vadd.s8 q3, q15 -+- -+ vmov.32 d24[0], r4 // load offset table from general registers -+ vmov.32 d24[1], r5 // load rest of offset table -+ -+@@ -208,6 +186,28 @@ endfunc -+ sub r0, #32 -+ .endm -+ -++// input -++// a in q0 - q3 -++// c in q4 - q7 -++// b in q8 - q11 -++// offset table in r7 and r5 -++// output in q0 - q3 -++// clobbers q12 - q15 -++.macro edge_w64_body -++ diff32 q12, q13, q0, q1, q0, q1, q4, q5 -++ diff32 q0, q1, q14, q15, q8, q9, q4, q5 -++ -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ -++ diff32 q14, q15, q2, q3, q2, q3, q6, q7 -++ diff32 q2, q3, q12, q13, q10, q11, q6, q7 -++ -++ vadd.s8 q2, q14 -++ vadd.s8 q3, q15 -++ table64 -++.endm -++ -+ .macro init_edge_64 -+ push {r4-r5} -+ ldr r12, [sp, #8] // height -+@@ -334,38 +334,23 @@ function ff_hevc_sao_edge_eo3_w64_neon_8, export=1 -+ bx lr -+ endfunc -+ -+-// inputs: -+-// a in q0, q1 -+-// c in q2, q3 -+-// b in q8, q9 -+-// offset table in d31 -+-// clobbered registers q0, q1, q10, q11, q12, q13 -+-// output q0, q1 -+-.macro edge_w32_body -+- vcgt.u8 q12, q2, q0 // c > a -> -1 , otherwise 0 -+- vcgt.u8 q0, q0, q2 // a > c -> -1 , otherwise 0 -+- vcgt.u8 q13, q3, q1 -+- vcgt.u8 q1, q1, q3 -+- -+- vsub.s8 q12, q0, q12 // diff0 -+- vcgt.u8 q0, q2, q8 // c > b -+- vsub.s8 q13, q1, q13 // diff0 part 2 -+- -+- vcgt.u8 q10, q8, q2 // b > c -+- vcgt.u8 q1, q3, q9 -+- vcgt.u8 q11, q9, q3 -+- -+- vsub.s8 q0, q10, q0 // diff1 -+- -+- vmov.s8 q10, #2 // 2 to all elements -+- vsub.s8 q1, q11, q1 // diff1 part 2 -+- vadd.s8 q0, q12 //diff0 + diff1 -+- vadd.s8 q1, q13 -++.macro init_edge_32 -++ ldr r12, [sp, #4] // sao_offset_val_table -++ vld1.32 {d31}, [r12] -++ ldr r12, [sp] // height -++.endm -+ -+- vadd.s8 q0, q10 -+- vadd.s8 q1, q10 -++.macro diff out0, tmp0, in0, in1 -++ vcgt.u8 \out0, \in1, \in0 // c > a -> -1 , otherwise 0 -++ vcgt.u8 \tmp0, \in0, \in1 // a > c -> -1 , otherwise 0 -++ vsub.s8 \out0, \tmp0, \out0 // diff0 -++.endm -+ -+- vmov.u8 q10, #128 -++.macro table32 -++ vmov.s8 q10, #2 -++ vadd.s8 q0, q10 -++ vadd.s8 q1, q10 -++ vmov.s8 q10, #128 -+ vtbl.8 d0, {d31}, d0 -+ vadd.s8 q11, q2, q10 -+ vtbl.8 d1, {d31}, d1 -+@@ -373,56 +358,68 @@ endfunc -+ vtbl.8 d2, {d31}, d2 -+ vqadd.s8 q11, q0 -+ vtbl.8 d3, {d31}, d3 -+- vqadd.s8 q12, q1 -+- vsub.s8 q0, q11, q10 -+- vsub.s8 q1, q12, q10 -++ vqadd.s8 q12, q1 -++ vsub.s8 q0, q11, q10 -++ vsub.s8 q1, q12, q10 -+ vst1.8 {q0-q1}, [r0, :128], r2 -+ .endm -+ -+-.macro init_edge_32 -+- ldr r12, [sp, #4] // sao_offset_val_table -+- vld1.32 {d31}, [r12] -+- ldr r12, [sp] // height -+-.endm -+- -+ function ff_hevc_sao_edge_eo0_w32_neon_8, export=1 -+ init_edge_32 -+- sub r1, #4 // load 4 extra bytes -++ vpush {q4-q7} -++ sub r1, #4 -+ 1: subs r12, #1 -+- vld1.32 d3[1], [r1]! -+- vld1.8 {q2-q3}, [r1, :128]! // c -+- vld1.32 d20[0], [r1], r3 -+- sub r1, #36 -++ vld1.8 {q13-q14}, [r1]! -++ vld1.32 d30, [r1], r3 -++ sub r1, #32 -+ // a -+- vext.8 q0, q1, q2, #15 -+- vext.8 q1, q2, q3, #15 -+- // b -+- vext.8 q8, q2, q3, #1 -+- vext.8 q9, q3, q10, #1 -+- edge_w32_body -++ vext.8 q0, q13, q14, #3 -++ vext.8 q1, q14, q15, #3 -++ vshr.u64 d24, d30, #24 -++ // c -++ vext.8 q2, q13, q14, #4 -++ vext.8 q3, q14, q15, #4 -++ vshr.u64 d16, d30, #32 -++ // diff0 -++ diff32 q13, q14, q4, q5, q0, q1, q2, q3 -++ diff d18, d25, d24, d16 -++ // -diff1 -++ vext.s8 q0, q13, q14, #1 -++ vext.s8 q1, q14, q9, #1 -++ -++ vsub.s8 q0, q13, q0 //diff0 + diff1 -++ vsub.s8 q1, q14, q1 -++ table32 -+ bne 1b -++ vpop {q4-q7} -++ -+ bx lr -+ endfunc -+ -+ function ff_hevc_sao_edge_eo1_w32_neon_8, export=1 -+ init_edge_32 -++ vpush {q4-q7} -+ // load a -+ sub r1, r3 -+ vld1.8 {q0-q1}, [r1, :128], r3 -+ // load c -+ vld1.8 {q2-q3}, [r1, :128], r3 -++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 // CMP ( c, a ) -+ 1: subs r12, #1 -+ // load b -+ vld1.8 {q8-q9}, [r1, :128], r3 -+- edge_w32_body -+- // inputs for next loop iteration -+- // a -+- vmov.64 q0, q2 -+- vmov.64 q1, q3 -++ diff32 q4, q5, q10, q11, q8, q9, q2, q3 // CMP ( c, b ) -++ vadd.s8 q0, q4, q12 //diff0 + diff1 -++ vadd.s8 q1, q5, q13 -++ table32 -++ // CMP ( c, a ) -++ vneg.s8 q12, q4 -++ vneg.s8 q13, q5 -+ // c -+ vmov.64 q2, q8 -+ vmov.64 q3, q9 -+ bne 1b -++ vpop {q4-q7} -+ bx lr -+ endfunc -+ -+@@ -452,7 +449,11 @@ function ff_hevc_sao_edge_eo2_w32_neon_8, export=1 -+ vext.8 q6, q10, q11, #8 -+ vext.8 q7, q11, q12, #8 -+ vext.8 q5, q10, q11, #7 -+- edge_w32_body -++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 -++ diff32 q0, q1, q10, q11, q8, q9, q2, q3 -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ table32 -+ // inputs for next loop iteration -+ // a -+ vmov.8 q0, q4 -+@@ -487,7 +488,14 @@ function ff_hevc_sao_edge_eo3_w32_neon_8, export=1 -+ vext.8 q8, q10, q11, #7 -+ vext.8 q9, q11, q12, #7 -+ vext.8 q14, q12, q10, #7 -+- edge_w32_body -++ -++ diff32 q12, q13, q0, q1, q0, q1, q2, q3 -++ diff32 q0, q1, q10, q11, q8, q9, q2, q3 -++ -++ vadd.s8 q0, q12 //diff0 + diff1 -++ vadd.s8 q1, q13 -++ table32 -++ -+ // inputs for next loop iteration -+ // a -+ vext.8 q0, q2, q3, #1 -+-- -+2.5.0 -+ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index dde29adf425e54f54e4104b3370352db0be6ef40..83369203fef720456080f4119822e7fe3631ca1a 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -133,6 +133,8 @@ cd "ffmpeg-${VERSION}" || exit 2 - tar --strip-components=1 -xf $MYDIR/${ARCHIVE} - - patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch -+patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch -+patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -diff --git a/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..5e8e07d407f045fc99554f0f061d1e818716ac62 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/hevcdsp_ARM_NEON_optimized_epel_functions.patch -@@ -0,0 +1,409 @@ -+From 29c3327a0d72a7e872ff170363cfe5ed13bca5d0 Mon Sep 17 00:00:00 2001 -+From: Seppo Tomperi -+Date: Tue, 22 Dec 2015 18:10:24 +0000 -+Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions -+ -+--- -+ libavcodec/arm/Makefile | 1 + -+ libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/hevcdsp_init_neon.c | 23 +++ -+ 3 files changed, 358 insertions(+) -+ create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index cdd35b0..6051ec8 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -131,6 +131,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ -+ arm/synth_filter_neon.o -+ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ -+ arm/hevcdsp_deblock_neon.o \ -++ arm/hevcdsp_epel_neon.o \ -+ arm/hevcdsp_idct_neon.o \ -+ arm/hevcdsp_qpel_neon.o -+ NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o -+diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -+new file mode 100644 -+index 0000000..516ae5b -+--- /dev/null -++++ b/libavcodec/arm/hevcdsp_epel_neon.S -+@@ -0,0 +1,334 @@ -++/* -++ * Copyright (c) 2014 - 2015 Seppo Tomperi -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++#include "neon.S" -++ -++#define MAX_PB_SIZE #64 -++ -++.macro vextin_d4 -++ vld1.8 {q10}, [r1], r2 -++ vmov d16, d20 -++ vext.8 d17, d20, d21, #1 -++ vext.8 d18, d20, d21, #2 -++ vext.8 d19, d20, d21, #3 -++.endm -++ -++.macro vextin_d4_8 -++ vld1.8 d16, [r1], r2 -++ vext.8 d17, d16, d16, #1 -++ vext.8 d18, d16, d16, #2 -++ vext.8 d19, d16, d16, #3 -++.endm -++ -++.macro load_coeffs_16b coeffs -++ ldr \coeffs, [\coeffs] -++ vdup.i8 d0, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d1, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d2, \coeffs -++ lsr \coeffs, #8 -++ vdup.i8 d3, \coeffs -++.endm -++ -++.macro epel_filter_16b out=q12 -++ vmull.u8 q3, d16, d0 -++ vmull.u8 q11, d19, d3 -++ vmull.u8 \out, d17, d1 -++ vmull.u8 q10, d18, d2 -++ vadd.s16 q3, q11 -++ vadd.s16 \out, q10 -++ vsub.s16 \out, q3 -++.endm -++ -++.macro load_coeffs_32b coeffs -++ ldr \coeffs, [\coeffs] -++ vmov.i64 d4, #0 -++ vmov.8 d4[0], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[2], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[4], \coeffs -++ lsr \coeffs, #8 -++ vmov.8 d4[6], \coeffs -++.endm -++ -++.macro epel_filter_32b -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q4, d25, d4[0] -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q6, d31, d4[3] -++ -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q8, d27, d4[1] -++ vmull.s16 q9, d28, d4[2] // q14 -++ vmull.s16 q10, d29, d4[2] -++ vadd.s32 q3, q5 -++ vadd.s32 q4, q6 -++ vadd.s32 q7, q9 -++ vadd.s32 q8, q10 -++ vsub.s32 q7, q3 -++ vsub.s32 q8, q4 -++ vqshrn.s32 d6, q7, #6 -++ vqshrn.s32 d7, q8, #6 -++.endm -++ -++.macro epel_filter_32b_4 -++ vmull.s16 q3, d24, d4[0] //q12 -++ vmull.s16 q5, d30, d4[3] //q15 -++ vmull.s16 q7, d26, d4[1] // q13 -++ vmull.s16 q9, d28, d4[2] // q14 -++ vadd.s32 q3, q5 -++ vadd.s32 q7, q9 -++ vsub.s32 q7, q3 -++ vqshrn.s32 d6, q7, #6 -++.endm -++ -++function ff_hevc_put_epel_h_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #16] // mx -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ sub r1, #1 -++ lsl r4, #1 -++ load_coeffs_16b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: subs r3, #1 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ cmp r5, #4 -++ bgt 8b -++4: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++2: subs r3, #1 -++ pld [r1] -++ vextin_d4_8 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_v_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ add r7, r12 -++ load_coeffs_16b r7 -++ sub r1, r2 -++ lsl r4, #1 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vld1.8 {d16}, [r1], r2 -++ pld [r1] -++ vld1.8 {d17}, [r1], r2 -++ pld [r1] -++ vld1.8 {d18}, [r1], r2 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 {q12}, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.16 d24, [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vld1.8 {d19}, [r1], r2 -++ subs r3, #1 -++ epel_filter_16b -++ vst1.32 d24[0], [r0], r4 -++ vmov d16, d17 -++ vmov d17, d18 -++ vmov d18, d19 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++function ff_hevc_put_epel_hv_neon_8, export=1 -++ push {r4-r7} -++ mov r4, MAX_PB_SIZE -++ ldr r6, [sp, #16] // mx -++ ldr r7, [sp, #20] // my -++ ldr r5, [sp, #24] // width -++ sub r7, #1 -++ lsl r7, #2 -++ vpush {d8-d15} -++ adrl r12, epel_coeffs -++ sub r6, #1 -++ lsl r6, #2 -++ add r6, r12 // mx epel coeff offset -++ add r7, r12 -++ sub r1, #1 -++ sub r1, r2 -++ lsl r4, #1 -++ load_coeffs_16b r6 -++ load_coeffs_32b r7 -++ mov r12, r3 -++ mov r6, r0 -++ mov r7, r1 -++0: pld [r1] -++ vextin_d4 -++ epel_filter_16b q12 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q13 -++ pld [r1] -++ vextin_d4 -++ epel_filter_16b q14 -++ cmp r5, #6 -++ bgt 8f -++ cmp r5, #4 -++ blt 2f -++ b 4f -++8: pld [r1] -++ vextin_d4 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b -++ vst1.16 {q3}, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 8b -++ subs r5, #8 -++ beq 99f -++ mov r3, r12 -++ add r6, #16 -++ mov r0, r6 -++ add r7, #8 -++ mov r1, r7 -++ b 0b -++4: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.16 d6, [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 4b -++ subs r5, #4 -++ beq 99f -++ mov r3, r12 -++ add r6, #8 -++ mov r0, r6 -++ add r7, #4 -++ mov r1, r7 -++ b 0b -++2: pld [r1] -++ vextin_d4_8 -++ epel_filter_16b q15 -++ subs r3, #1 -++ epel_filter_32b_4 -++ vst1.32 d6[0], [r0], r4 -++ vmov q12, q13 -++ vmov q13, q14 -++ vmov q14, q15 -++ bne 2b -++99: vpop {d8-d15} -++ pop {r4-r7} -++ bx lr -++endfunc -++ -++epel_coeffs: -++ .byte 2, 58, 10, 2 -++ .byte 4, 54, 16, 2 -++ .byte 6, 46, 28, 4 -++ .byte 4, 36, 36, 4 -++ .byte 4, 28, 46, 6 -++ .byte 2, 16, 54, 4 -++ .byte 2, 10, 58, 2 -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index 5591807..733ff08 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -58,6 +58,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8); -+ PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8); -+ #undef PUT_PIXELS -++void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -++void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src, -++ ptrdiff_t srcstride, int height, -++ intptr_t mx, intptr_t my, int width); -+ -+ static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, -+ int height, int width); -+@@ -201,7 +210,21 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper; -+ c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper; -++ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8; -++ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8; -++ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8; -+ } -++ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -++ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -++ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -++ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8; -++ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8; -++ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8; -++ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8; -++ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8; -++ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8; -++ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8; -++ -+ c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8; -+ c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8; -+ c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8; -+-- -+2.5.0 -+ - -From 56a954cfc65e5f4f2f2e7a506ef303b853eedb81 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 7 May 2015 14:04:18 +0100 -Subject: [PATCH 26/62] [ffmpeg] Add GPU acceleration to hevc - ---- - tools/depends/target/ffmpeg/Makefile | 4 +- - tools/depends/target/ffmpeg/autobuild.sh | 1 + - .../target/ffmpeg/pfcd_hevc_optimisations.patch | 38136 +++++++++++++++++++ - 3 files changed, 38140 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index c46b533e47497cb7b1e7200eff2cee1a6f2a1a2f..48f8d56988718dd53294e8291a53e532f0ff338d 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -2,7 +2,8 @@ include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ -- hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch -+ hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \ -+ pfcd_hevc_optimisations.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -85,6 +86,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch -+ cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index 83369203fef720456080f4119822e7fe3631ca1a..d6856dbd4fb4957ace700cbc08332223c01938f6 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -135,6 +135,7 @@ tar --strip-components=1 -xf $MYDIR/${ARCHIVE} - patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch -+patch -p1 < ../pfcd_hevc_optimisations.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -diff --git a/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch b/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..e172ebf157aebffe1ae50b4a2b25fd71bc708c93 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch -@@ -0,0 +1,38136 @@ -+From b9b5434c61afd492a54dad5158b4d56ecbf7f01d Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 28 Apr 2015 16:18:40 +0100 -+Subject: [PATCH 01/68] Added display output -+ -+--- -+ ffmpeg.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 159 insertions(+) -+ -+diff --git a/ffmpeg.c b/ffmpeg.c -+index 9ffd833..50c6e86 100644 -+--- a/ffmpeg.c -++++ b/ffmpeg.c -+@@ -23,6 +23,11 @@ -+ * multimedia converter based on the FFmpeg libraries -+ */ -+ -++#ifdef RPI -++#define RPI_DISPLAY -++//#define RPI_ZERO_COPY -++#endif -++ -+ #include "config.h" -+ #include -+ #include -+@@ -66,6 +71,20 @@ -+ # include "libavfilter/buffersrc.h" -+ # include "libavfilter/buffersink.h" -+ -++#ifdef RPI_DISPLAY -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#ifdef RPI_ZERO_COPY -++#include "libavcodec/rpi_qpu.h" -++#endif -++#endif -++ -+ #if HAVE_SYS_RESOURCE_H -+ #include -+ #include -+@@ -158,6 +177,134 @@ static int restore_tty; -+ static void free_input_threads(void); -+ #endif -+ -++#ifdef RPI_DISPLAY -++ -++#define NUM_BUFFERS 4 -++ -++static MMAL_COMPONENT_T* rpi_display = NULL; -++static MMAL_POOL_T *rpi_pool = NULL; -++ -++#ifdef RPI_ZERO_COPY -++static uint8_t *get_vc_handle(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ return (uint8_t *)p->vc_handle; -++} -++#endif -++ -++static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -++{ -++ MMAL_POOL_T* pool; -++ size_t i; -++ size_t size = (w*h*3)/2; -++#ifdef RPI_ZERO_COPY -++ mmal_port_parameter_set_boolean(port, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); // Does this mark that the buffer contains a vc_handle? Would have expected a vc_image? -++ pool = mmal_port_pool_create(port, NUM_BUFFERS, 0); -++ assert(pool); -++#else -++ pool = mmal_port_pool_create(port, NUM_BUFFERS, size); -++ -++ for (i = 0; i < NUM_BUFFERS; ++i) -++ { -++ MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; -++ void* bufPtr = buffer->data; -++ memset(bufPtr, i*30, w*h); -++ memset(bufPtr+w*h, 128, (w*h)/2); -++ } -++#endif -++ -++ return pool; -++} -++ -++static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -++ mmal_buffer_header_release(buffer); -++} -++ -++static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -++{ -++ MMAL_COMPONENT_T* display; -++ int w2 = (w+31)&~31; -++ int h2 = (h+15)&~15; -++ MMAL_DISPLAYREGION_T region = -++ { -++ {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, -++ .layer = 2, -++ .fullscreen = 0, -++ .dest_rect = {x, y, w, h} -++ }; -++ bcm_host_init(); // TODO is this needed? -++ mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); -++ assert(display); -++ -++ mmal_port_parameter_set(display->input[0], ®ion.hdr); -++ -++ MMAL_ES_FORMAT_T* format = display->input[0]->format; -++ format->encoding = MMAL_ENCODING_I420; -++ format->es->video.width = w2; -++ format->es->video.height = h2; -++ format->es->video.crop.x = 0; -++ format->es->video.crop.y = 0; -++ format->es->video.crop.width = w; -++ format->es->video.crop.height = h; -++ mmal_port_format_commit(display->input[0]); -++ -++ mmal_component_enable(display); -++ -++ rpi_pool = display_alloc_pool(display->input[0], w2, h2); -++ -++ mmal_port_enable(display->input[0],display_cb_input); -++ mmal_port_enable(display->control,display_cb_input); -++ -++ printf("Allocated display %d %d\n",w,h); -++ -++ return display; -++} -++ -++static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) -++{ -++ int w = fr->width; -++ int h = fr->height; -++ int w2 = (w+31)&~31; -++ int h2 = (h+15)&~15; -++ if (!display || !rpi_pool) -++ return; -++ MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); -++ if (!buf) { -++ // Running too fast so drop the frame -++ return; -++ } -++ assert(buf); -++ buf->cmd = 0; -++ buf->length = (w2 * h2 * 3)/2; -++ buf->offset = 0; // Offset to valid data -++ buf->flags = 0; -++#ifdef RPI_ZERO_COPY -++ buf->data = get_vc_handle(fr->buf[0]); -++ buf->alloc_size = (w2*h2*3)/2; -++#else -++ //mmal_buffer_header_mem_lock(buf); -++ memcpy(buf->data, fr->data[0], w2 * h); -++ memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); -++ memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); -++ //mmal_buffer_header_mem_unlock(buf); -++#endif -++ -++ mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released -++} -++ -++static void display_exit(MMAL_COMPONENT_T* display) -++{ -++ if (display) { -++ mmal_component_destroy(display); -++ } -++ if (rpi_pool) { -++ mmal_port_pool_destroy(display->input[0], rpi_pool); -++ } -++} -++ -++#endif -++ -++ -+ /* sub2video hack: -+ Convert subtitles to video with alpha to insert them in filter graphs. -+ This is a temporary solution until libavfilter gets real subtitles support. -+@@ -581,6 +728,10 @@ static void ffmpeg_cleanup(int ret) -+ } -+ term_exit(); -+ ffmpeg_exited = 1; -++ -++#ifdef RPI_DISPLAY -++ display_exit(rpi_display); -++#endif -+ } -+ -+ void remove_avoptions(AVDictionary **a, AVDictionary *b) -+@@ -940,6 +1091,14 @@ static void do_video_out(AVFormatContext *s, -+ int frame_size = 0; -+ InputStream *ist = NULL; -+ AVFilterContext *filter = ost->filter->filter; -++#ifdef RPI_DISPLAY -++ if (next_picture) -++ { -++ if (!rpi_display) -++ rpi_display = display_init(0,0,next_picture->width,next_picture->height); -++ display_frame(rpi_display,next_picture); -++ } -++#endif -+ -+ if (ost->source_index >= 0) -+ ist = input_streams[ost->source_index]; -+-- -+2.7.4 -+ -+ -+From b90a5aff7bf9112ebd2a07949c8d79a49fcafe48 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 29 Apr 2015 16:49:43 +0100 -+Subject: [PATCH 02/68] Split transform and intra prediction into commands -+ -+--- -+ libavcodec/hevc.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++- -+ libavcodec/hevc.h | 58 +++++++++++++++++++++++ -+ libavcodec/hevc_cabac.c | 15 ++++++ -+ 3 files changed, 191 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index b478065..aa45dd6 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -931,6 +931,25 @@ static int hls_cross_component_pred(HEVCContext *s, int idx) { -+ return 0; -+ } -+ -++#ifdef RPI -++static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, int c_idx) -++{ -++ if (s->enable_rpi) { -++ HEVCLocalContext *lc = s->HEVClc; -++ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ cmd->type = RPI_PRED_INTRA; -++ cmd->size = log2_trafo_size; -++ cmd->c_idx = c_idx; -++ cmd->x = x0; -++ cmd->y = y0; -++ cmd->na = (lc->na.cand_bottom_left<<4) + (lc->na.cand_left<<3) + (lc->na.cand_up_left<<2) + (lc->na.cand_up<<1) + lc->na.cand_up_right; -++ cmd->mode = c_idx ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; -++ } else { -++ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, c_idx); -++ } -++} -++#endif -++ -+ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ int xBase, int yBase, int cb_xBase, int cb_yBase, -+ int log2_cb_size, int log2_trafo_size, -+@@ -943,8 +962,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ int trafo_size = 1 << log2_trafo_size; -+ ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size); -+- -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, x0, y0, 0); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0); -++#endif -+ } -+ -+ if (cbf_luma || cbf_cb[0] || cbf_cr[0] || -+@@ -1030,7 +1052,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 1); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 1); -++#endif -+ } -+ if (cbf_cb[i]) -+ ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), -+@@ -1059,7 +1085,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (i << log2_trafo_size_c), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 2); -++#endif -+ } -+ if (cbf_cr[i]) -+ ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), -+@@ -1088,7 +1118,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 1); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 1); -++#endif -+ } -+ if (cbf_cb[i]) -+ ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), -+@@ -1098,7 +1132,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (i << log2_trafo_size), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 2); -++#endif -+ } -+ if (cbf_cr[i]) -+ ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), -+@@ -1110,26 +1148,46 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ int trafo_size_h = 1 << (log2_trafo_size_c + s->ps.sps->hshift[1]); -+ int trafo_size_v = 1 << (log2_trafo_size_c + s->ps.sps->vshift[1]); -+ ff_hevc_set_neighbour_available(s, x0, y0, trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 1); -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0, 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 1); -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 2); -++#endif -+ if (s->ps.sps->chroma_format_idc == 2) { -+ ff_hevc_set_neighbour_available(s, x0, y0 + (1 << log2_trafo_size_c), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 1); -++ rpi_intra_pred(s, log2_trafo_size_c, x0, y0 + (1 << log2_trafo_size_c), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 1); -+ s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 2); -++#endif -+ } -+ } else if (blk_idx == 3) { -+ int trafo_size_h = 1 << (log2_trafo_size + 1); -+ int trafo_size_v = 1 << (log2_trafo_size + s->ps.sps->vshift[1]); -+ ff_hevc_set_neighbour_available(s, xBase, yBase, -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 1); -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase, 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1); -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2); -++#endif -+ if (s->ps.sps->chroma_format_idc == 2) { -+ ff_hevc_set_neighbour_available(s, xBase, yBase + (1 << (log2_trafo_size)), -+ trafo_size_h, trafo_size_v); -++#ifdef RPI -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 1); -++ rpi_intra_pred(s, log2_trafo_size, xBase, yBase + (1 << (log2_trafo_size)), 2); -++#else -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 1); -+ s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 2); -++#endif -+ } -+ } -+ } -+@@ -2304,6 +2362,31 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ lc->ctb_up_left_flag = ((x_ctb > 0) && (y_ctb > 0) && (ctb_addr_in_slice-1 >= s->ps.sps->ctb_width) && (s->ps.pps->tile_id[ctb_addr_ts] == s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1 - s->ps.sps->ctb_width]])); -+ } -+ -++#ifdef RPI -++static void rpi_execute_pred_cmds(HEVCContext *s) -++{ -++ int i; -++ HEVCPredCmd *cmd = s->univ_pred_cmds; -++ HEVCLocalContext *lc = s->HEVClc; -++ -++ for(i = s->num_pred_cmds; i > 0; i--, cmd++) { -++ if (cmd->type == RPI_PRED_INTRA) { -++ lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; -++ lc->na.cand_bottom_left = (cmd->na >> 4) & 1; -++ lc->na.cand_left = (cmd->na >> 3) & 1; -++ lc->na.cand_up_left = (cmd->na >> 2) & 1; -++ lc->na.cand_up = (cmd->na >> 1) & 1; -++ lc->na.cand_up_right = (cmd->na >> 0) & 1; -++ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -++ } else { -++ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -++ } -++ } -++ s->num_pred_cmds = 0; -++ s->num_coeffs = 0; -++} -++#endif -++ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ { -+ HEVCContext *s = avctxt->priv_data; -+@@ -2313,6 +2396,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int y_ctb = 0; -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -++#ifdef RPI -++ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -++#endif -++ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+ return AVERROR_INVALIDDATA; -+@@ -2342,6 +2429,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -++#ifdef RPI -++ rpi_execute_pred_cmds(s); -++#endif -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = -1; -+ return more_data; -+@@ -2387,6 +2477,10 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int -+ s = s1->sList[self_id]; -+ lc = s->HEVClc; -+ -++#ifdef RPI -++ s->enable_rpi = 0; -++#endif -++ -+ if(ctb_row) { -+ ret = init_get_bits8(&lc->gb, s->data + s->sh.offset[ctb_row - 1], s->sh.size[ctb_row - 1]); -+ -+@@ -3075,6 +3169,13 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ -+ av_freep(&s->cabac_state); -+ -++#ifdef RPI -++ av_freep(&s->unif_mv_cmds); -++ av_freep(&s->unif_xfm_cmds); -++ av_freep(&s->univ_pred_cmds); -++ av_freep(&s->coeffs_buf); -++#endif -++ -+ for (i = 0; i < 3; i++) { -+ av_freep(&s->sao_pixel_buffer_h[i]); -+ av_freep(&s->sao_pixel_buffer_v[i]); -+@@ -3129,6 +3230,22 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->HEVClcList[0] = s->HEVClc; -+ s->sList[0] = s; -+ -++#ifdef RPI -++ s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -++ if (!s->unif_mv_cmds) -++ goto fail; -++ s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); -++ if (!s->unif_xfm_cmds) -++ goto fail; -++ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -++ if (!s->univ_pred_cmds) -++ goto fail; -++ s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); -++ if (!s->coeffs_buf) -++ goto fail; -++ s->enable_rpi = 0; -++#endif -++ -+ s->cabac_state = av_malloc(HEVC_CONTEXTS); -+ if (!s->cabac_state) -+ goto fail; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index be91010..7a1c35f 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -23,6 +23,9 @@ -+ #ifndef AVCODEC_HEVC_H -+ #define AVCODEC_HEVC_H -+ -++// define RPI to split the CABAC/prediction/transform into separate stages -++#include "config.h" -++ -+ #include "libavutil/buffer.h" -+ #include "libavutil/md5.h" -+ -+@@ -790,6 +793,49 @@ typedef struct HEVCLocalContext { -+ int boundary_flags; -+ } HEVCLocalContext; -+ -++#ifdef RPI -++ -++// RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -++#define RPI_MAX_WIDTH 2048 -++ -++// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane -++#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) -++#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -++// Each block can have an intra prediction and a transform_add command -++#define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -++ -++// Command for inter prediction -++typedef struct HEVCMvCmd { -++} HEVCMvCmd; -++ -++// Command for transform to process a block of coefficients -++typedef struct HEVCXfmCmd { -++} HEVCXfmCmd; -++ -++// Command for intra prediction and transform_add of predictions to coefficients -++#define RPI_PRED_TRANSFORM_ADD 0 -++#define RPI_PRED_INTRA 1 -++typedef struct HEVCPredCmd { -++ uint8_t size; -++ uint8_t type; -++ uint8_t na; -++ uint8_t c_idx; -++ union { -++ uint8_t *dst; // RPI_PRED_TRANSFORM_ADD -++ uint32_t x; // RPI_PRED_INTRA -++ }; -++ union { -++ int16_t *buf; // RPI_PRED_TRANSFORM_ADD -++ uint32_t y; // RPI_PRED_INTRA -++ }; -++ union { -++ enum IntraPredMode mode; // RPI_PRED_TRANSFORM_ADD -++ uint32_t stride; // RPI_PRED_INTRA -++ }; -++} HEVCPredCmd; -++ -++#endif -++ -+ typedef struct HEVCContext { -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+@@ -805,6 +851,18 @@ typedef struct HEVCContext { -+ int width; -+ int height; -+ -++#ifdef RPI -++ int enable_rpi; -++ HEVCMvCmd *unif_mv_cmds; -++ HEVCXfmCmd *unif_xfm_cmds; -++ HEVCPredCmd *univ_pred_cmds; -++ int16_t *coeffs_buf; -++ int num_mv_cmds; -++ int num_xfm_cmds; -++ int num_pred_cmds; -++ int num_coeffs; -++#endif -++ -+ uint8_t *cabac_state; -+ -+ /** 1 if the independent slice segment header was successfully parsed */ -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 05b2821..4e97f06 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1510,6 +1510,21 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -+ } -++#ifdef RPI -++ if (s->enable_rpi) { -++ int16_t *c = s->coeffs_buf + s->num_coeffs; -++ int n = trafo_size * trafo_size; -++ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy -++ s->num_coeffs += n; -++ cmd->type = RPI_PRED_TRANSFORM_ADD; -++ cmd->size = log2_trafo_size; -++ cmd->buf = c; -++ cmd->dst = dst; -++ cmd->stride = stride; -++ return; -++ } -++#endif -+ s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); -+ } -+ -+-- -+2.7.4 -+ -+ -+From f8293de11dc040d9fa2a558762a357c0c353d2c9 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 30 Apr 2015 15:23:22 +0100 -+Subject: [PATCH 03/68] Added simple VPU test code -+ -+--- -+ libavcodec/Makefile | 7 + -+ libavcodec/hevc.c | 33 +- -+ libavcodec/rpi_hevc_transform.h | 212 ++++++ -+ libavcodec/rpi_hevc_transform.s | 147 ++++ -+ libavcodec/rpi_mailbox.c | 293 ++++++++ -+ libavcodec/rpi_mailbox.h | 20 + -+ libavcodec/rpi_qpu.c | 652 ++++++++++++++++++ -+ libavcodec/rpi_qpu.h | 45 ++ -+ libavcodec/rpi_shader.c | 818 ++++++++++++++++++++++ -+ libavcodec/rpi_shader.h | 20 + -+ libavcodec/rpi_shader.qasm | 1413 +++++++++++++++++++++++++++++++++++++++ -+ libavcodec/rpi_user_vcsm.h | 425 ++++++++++++ -+ 12 files changed, 4084 insertions(+), 1 deletion(-) -+ create mode 100644 libavcodec/rpi_hevc_transform.h -+ create mode 100644 libavcodec/rpi_hevc_transform.s -+ create mode 100644 libavcodec/rpi_mailbox.c -+ create mode 100644 libavcodec/rpi_mailbox.h -+ create mode 100644 libavcodec/rpi_qpu.c -+ create mode 100644 libavcodec/rpi_qpu.h -+ create mode 100644 libavcodec/rpi_shader.c -+ create mode 100644 libavcodec/rpi_shader.h -+ create mode 100644 libavcodec/rpi_shader.qasm -+ create mode 100644 libavcodec/rpi_user_vcsm.h -+ -+diff --git a/libavcodec/Makefile b/libavcodec/Makefile -+index fd0d1f0..03065cd 100644 -+--- a/libavcodec/Makefile -++++ b/libavcodec/Makefile -+@@ -5,6 +5,10 @@ NAME = avcodec -+ HEADERS = avcodec.h \ -+ avdct.h \ -+ avfft.h \ -++ rpi_qpu.h \ -++ rpi_shader.h \ -++ rpi_mailbox.h \ -++ rpi_hevc_transform.h \ -+ d3d11va.h \ -+ dirac.h \ -+ dv_profile.h \ -+@@ -43,6 +47,9 @@ OBJS = allcodecs.o \ -+ resample.o \ -+ resample2.o \ -+ utils.o \ -++ rpi_qpu.o \ -++ rpi_shader.o \ -++ rpi_mailbox.o \ -+ vorbis_parser.o \ -+ xiph.o \ -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index aa45dd6..ab55df1 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -41,6 +41,10 @@ -+ #include "hevc.h" -+ #include "profiles.h" -+ -++#ifdef RPI -++#include "rpi_qpu.h" -++#endif -++ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -+ /** -+@@ -2430,7 +2434,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- rpi_execute_pred_cmds(s); -++ if (x_ctb + ctb_size >= s->ps.sps->width) { -++ rpi_execute_pred_cmds(s); -++ } -+ #endif -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = -1; -+@@ -3244,6 +3250,31 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ if (!s->coeffs_buf) -+ goto fail; -+ s->enable_rpi = 0; -++ -++ // A little test program -++ { -++ GPU_MEM_PTR_T p; -++ int err = gpu_malloc_cached(16, &p); -++ short *q = (short *)p.arm; -++ int i; -++ int r; -++ printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); -++ printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); -++ printf("Preparing data %p\n",q); -++ for(i=0;i<16;i++) -++ q[i] = i; -++ printf("Flush cache\n"); -++ gpu_cache_flush(&p); -++ printf("Executing code\n"); -++ r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); -++ printf("Return value %d (",r); -++ for(i=0;i<16;i++) -++ printf("%d ",q[i]); -++ printf(")\n"); -++ gpu_free(&p); -++ goto fail; // Early out -++ } -++ -+ #endif -+ -+ s->cabac_state = av_malloc(HEVC_CONTEXTS); -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+new file mode 100644 -+index 0000000..85a9102 -+--- /dev/null -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -0,0 +1,212 @@ -++unsigned char rpi_hevc_transform [] = { -++169, -++3, -++3, -++232, -++128, -++0, -++0, -++0, -++20, -++248, -++0, -++136, -++0, -++0, -++192, -++248, -++0, -++0, -++0, -++96, -++3, -++232, -++32, -++0, -++0, -++0, -++7, -++232, -++0, -++2, -++0, -++0, -++8, -++232, -++0, -++4, -++0, -++0, -++12, -++248, -++0, -++128, -++0, -++0, -++192, -++8, -++4, -++0, -++4, -++232, -++64, -++0, -++0, -++0, -++5, -++232, -++0, -++0, -++8, -++0, -++128, -++69, -++113, -++66, -++12, -++248, -++0, -++128, -++0, -++0, -++192, -++8, -++4, -++0, -++128, -++69, -++113, -++70, -++128, -++144, -++39, -++0, -++4, -++255, -++48, -++192, -++128, -++3, -++32, -++8, -++16, -++0, -++76, -++254, -++48, -++192, -++9, -++4, -++32, -++8, -++0, -++0, -++4, -++254, -++0, -++144, -++128, -++2, -++0, -++248, -++62, -++0, -++128, -++144, -++22, -++0, -++4, -++255, -++48, -++192, -++128, -++3, -++32, -++8, -++16, -++0, -++76, -++254, -++48, -++192, -++9, -++4, -++32, -++8, -++0, -++0, -++140, -++248, -++44, -++0, -++0, -++0, -++32, -++48, -++4, -++0, -++128, -++69, -++113, -++66, -++242, -++140, -++211, -++192, -++41, -++3, -++68, -++192, -++80, -++7, -++164, -++255, -++36, -++220, -++96, -++2, -++0, -++248, -++62, -++0, -++3, -++255, -++55, -++208, -++120, -++3, -++224, -++3, -++190, -++11, -++16, -++139, -++246, -++83, -++0, -++103, -++90, -++0, -++8, -++240, -++0, -++128, -++128, -++3, -++0, -++247, -++32, -++128, -++10, -++4, -++136, -++240, -++32, -++0, -++128, -++3, -++112, -++96, -++90, -++0, -++}; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+new file mode 100644 -+index 0000000..5e2728d -+--- /dev/null -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -0,0 +1,147 @@ -++# ****************************************************************************** -++# Argon Design Ltd. -++# (c) Copyright 2015 Argon Design Ltd. All rights reserved. -++# -++# Module : HEVC -++# Author : Peter de Rivaz -++# ****************************************************************************** -++ -++# HEVC VPU Transform -++# -++# Transform matrix can be thought of as -++# output row vector = input row vector * transMatrix2 -++# -++# The even rows of the matrix are symmetric -++# The odd rows of the matrix are antisymmetric -++# -++# So only need to compute the first half of the results, then can compute the remainder with a butterfly -++# -++# EXAMPLE -++# (a b c d) (1 2 2 1) -++# (3 4 -4 -3) -++# (5 6 6 5) -++# (7 8 -8 -7) -++# -++# x=(a c)(1 2) = 1a+5c 2a+6c -++# (5 6) -++# -++# y=(b d)(3 4) = 3b+7d 4b+8d -++# (7 8) -++# -++# u=x+y = 1a+5c+3b+7d 2a+4b+6c+8d -++# v=x-y = 1a+5c-3b-7d 2a+6c-4b-8d -++# -++# Final results are (u , v[::-1]) -++# -++# -++# For 32x1 input, load even rows into HX(0++,0), odd rows into HX(16++,0) -++# Apply the even matrix first and stop before rounding -++# Then apply the odd matrix in a full manner: -++# -++# First step is to compute partial products with the first input (16 cycles) -++# 1a 3b 5c 7d 16x1 input coefficients produce 16x16 output -++# 2a 4b 6c 8d -++# 2a -4b 6c -8d -++# 1a -3b 5c -7d -++# -++# Second step is to sum partial products into final position (8 cycles) -++# 1a+3b+5c+7d -++# 2a+4b+6c+8d -++# 2a-4b+6c-8d -++# 1a-3b+5c-7d -++# -++# Then can apply butterfly to combine even results and odd results + rounding to produce 16 rows of output at a time (need to save in transposed format) -++# -++# For 16x16 no butterfly is required and can store final results in original location (Could do 2 16x16s in parallel to make use of the trick - saves on the adds) -++# -++# For 8x8 we could compute two in parallel. -++# -++# -++ -++test_add: -++ vldh HX(0,0),(r0) -++ vadd HX(0,0),HX(0,0),10 -++ vsth HX(0,0),(r0) -++ mov r0,7 # return value -++ b lr -++ -++# Columns are transformed first -++# -++# Store top left half of transMatrix2 in -++# Store bottom left half of transMatrix2 in HX(32,32) -++# -++# For 16x16 -++# HX(0:15,0) contains input data before transform -++# HY(0:15,0) contains 32bit output data after transform -++# HX(32,0) contains even rows of left half of transMatrix2 -++# HX(32,32) contains odd rows of left half of transMatrix2 -++# HY(48,0) contains partial products ready for summing -++# -++ -++ -++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) -++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -++# num: number of 16x16 transforms to be done -++# -++hevc_trans_16x16: -++ push r6-r15, lr # TODO cut down number of used registers -++ -++ mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes -++ vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -++ # Now use r0 to describe which matrix we are working on. -++ # Allows us to prefetch the next block of coefficients for efficiency. -++ mov r0,0 # This describes the location where we read our coefficients from -++ mov r3,16*2 # Stride of coefficients in bytes -++ mov r7,16*16*2 # Total block size -++ mov r8,64*16 # Value used to swap from current to next VRF location -++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ mov r4,64 # Constant used for rounding first pass -++ mov r5,1<<19 # Constant used for rounding second pass -++ -++ # At start of block r0,r1 point to the current block (that has already been loaded) -++block_loop: -++ eor r0,r8 -++ add r1,r7 -++ # Prefetch the next block -++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ eor r0,r8 -++ sub r1,r7 -++ -++ # Transform the current block -++ bl col_trans_16 -++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -++ vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position -++ -++ bl col_trans_16 -++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -++ -++ # Save results - note there has been a transposition during the processing so we save columns -++ vsth VX(0,32++)+r0, (r1 += r3) REP 16 -++ -++ # Move onto next block -++ eor r0,r8 -++ add r1,r7 -++ -++ addcmpbgt r2,-1,0,block_loop -++ pop r6-r15, pc -++ -++# r1,r2,r3 r7,r8 should be preserved -++# HX(0++,0)+r0 is the block to be transformed -++# HX(32++,0) is the 16x16 matrix of transform coefficients -++# Use HY(48,0) for intermediate results -++# r0 can be used, but should be returned to its original value at the end -++col_trans_16: -++ add r4,r0,16 # Final value for this loop -++col_trans_16_loop: -++ # First compute partial products for a single column -++ vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 -++ # Then sum up the results and place back -++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -++ addcmpblt r0,1,r4,col_trans_16_loop -++ sub r0,16 # but r0 back to its original value -++ b lr -+diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -+new file mode 100644 -+index 0000000..536896f -+--- /dev/null -++++ b/libavcodec/rpi_mailbox.c -+@@ -0,0 +1,293 @@ -++/* -++Copyright (c) 2012, Broadcom Europe Ltd. -++All rights reserved. -++ -++Redistribution and use in source and binary forms, with or without -++modification, are permitted provided that the following conditions are met: -++ * Redistributions of source code must retain the above copyright -++ notice, this list of conditions and the following disclaimer. -++ * Redistributions in binary form must reproduce the above copyright -++ notice, this list of conditions and the following disclaimer in the -++ documentation and/or other materials provided with the distribution. -++ * Neither the name of the copyright holder nor the -++ names of its contributors may be used to endorse or promote products -++ derived from this software without specific prior written permission. -++ -++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -++*/ -++ -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++#include -++ -++#include -++ -++#define MAJOR_NUM 100 -++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) -++#define DEVICE_FILE_NAME "/dev/char_dev" -++ -++#include "rpi_mailbox.h" -++ -++#define PAGE_SIZE (4*1024) -++ -++// Shared memory will not be cached in ARM cache -++void *mapmem_shared(unsigned base, unsigned size) -++{ -++ int mem_fd; -++ unsigned offset = base % PAGE_SIZE; -++ base = base - offset; -++ /* open /dev/mem */ -++ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { -++ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); -++ return NULL; -++ } -++ void *mem = mmap( -++ 0, -++ size, -++ PROT_READ|PROT_WRITE, -++ MAP_SHARED/*|MAP_FIXED*/, -++ mem_fd, -++ base); -++#ifdef DEBUG -++ printf("base=0x%x, mem=%p\n", base, mem); -++#endif -++ if (mem == MAP_FAILED) { -++ printf("mmap error %d\n", (int)mem); -++ return NULL; -++ } -++ close(mem_fd); -++ return (char *)mem + offset; -++} -++ -++// Unshared memory will be faster as lives in ARM cache, but requires cache flushing -++void *mapmem_private(unsigned base, unsigned size) -++{ -++ int mem_fd; -++ unsigned offset = base % PAGE_SIZE; -++ base = base - offset; -++ /* open /dev/mem */ -++ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { -++ printf("can't open /dev/mem\nThis program should be run as root. Try prefixing command with: sudo\n"); -++ return NULL; -++ } -++ void *mem = mmap( -++ 0, -++ size, -++ PROT_READ|PROT_WRITE, -++ MAP_PRIVATE/*|MAP_FIXED*/, -++ mem_fd, -++ base); -++#ifdef DEBUG -++ printf("base=0x%x, mem=%p\n", base, mem); -++#endif -++ if (mem == MAP_FAILED) { -++ printf("mmap error %d\n", (int)mem); -++ return NULL; -++ } -++ close(mem_fd); -++ return (char *)mem + offset; -++} -++ -++void unmapmem(void *addr, unsigned size) -++{ -++ int s = munmap(addr, size); -++ if (s != 0) { -++ printf("munmap error %d\n", s); -++ exit (-1); -++ } -++} -++ -++/* -++ * use ioctl to send mbox property message -++ */ -++ -++static int mbox_property(int file_desc, void *buf) -++{ -++ int ret_val = ioctl(file_desc, IOCTL_MBOX_PROPERTY, buf); -++ -++ if (ret_val < 0) { -++ printf("ioctl_set_msg failed:%d\n", ret_val); -++ } -++ -++#ifdef DEBUG -++ unsigned *p = buf; int i; unsigned size = *(unsigned *)buf; -++ for (i=0; i -++#include -++#include -++#include -++#include -++ -++#include "config.h" -++ -++#include -++#include -++ -++#include "rpi_mailbox.h" -++#include "rpi_qpu.h" -++#include "rpi_shader.h" -++#include "rpi_hevc_transform.h" -++ -++#ifdef RPI_USE_VCSM -++#include "rpi_user_vcsm.h" -++#endif -++ -++// On Pi2 there is no way to access the VPU L2 cache -++// GPU_MEM_FLG should be 4 for uncached memory. -++// However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -++// The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -++#define GPU_MEM_FLG 0xC -++#define GPU_MEM_MAP 0x0 -++ -++#define vcos_verify(x) ((x)>=0) -++ -++typedef unsigned char uint8_t; -++typedef signed char int8_t; -++typedef unsigned short uint16_t; -++typedef unsigned int uint32_t; -++typedef int int32_t; -++ -++/*static const unsigned code[] = -++{ -++ #include "rpi_shader.hex" -++};*/ -++ -++// Size in 32bit words -++#define QPU_CODE_SIZE 2048 -++#define VPU_CODE_SIZE 2048 -++ -++struct GPU -++{ -++ unsigned int qpu_code[QPU_CODE_SIZE]; -++ unsigned int vpu_code[VPU_CODE_SIZE]; -++ int open_count; // Number of allocated video buffers -++ unsigned int vc_handle; // Handle of this memory -++ int mb; // Mailbox handle -++ int vc; // Address in GPU memory -++ int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -++}; -++ -++// Stop more than one thread trying to allocate memory or use the processing resources at once -++static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -++static volatile struct GPU* gpu = NULL; -++ -++#ifdef RPI_TIME_TOTAL_QPU -++static unsigned int Microseconds(void) { -++ struct timespec ts; -++ unsigned int x; -++ static unsigned int base = 0; -++ clock_gettime(CLOCK_REALTIME, &ts); -++ x = ts.tv_sec*1000000 + ts.tv_nsec/1000; -++ if (base==0) base=x; -++ return x-base; -++} -++#endif -++ -++// Connect to QPU, returns 0 on success. -++static int gpu_init(volatile struct GPU **gpu) { -++ int mb = mbox_open(); -++ int vc; -++ int handle; -++ volatile struct GPU* ptr; -++ if (mb < 0) -++ return -1; -++ -++ if (qpu_enable(mb, 1)) return -2; -++ -++#ifdef RPI_USE_VCSM -++ vcsm_init(); -++#endif -++ -++ handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); -++ if (!handle) -++ { -++ qpu_enable(mb, 0); -++ return -3; -++ } -++ vc = mem_lock(mb, handle); -++ ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); -++ if (ptr == NULL) -++ { mem_free(mb, handle); -++ mem_unlock(mb, handle); -++ qpu_enable(mb, 0); -++ return -4; -++ } -++ -++ ptr->mb = mb; -++ ptr->vc_handle = handle; -++ ptr->vc = vc; -++ -++ *gpu = ptr; -++ -++ // Now copy over the QPU code into GPU memory -++ { -++ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); -++ assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -++ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -++ } -++ // And the VPU code -++ { -++ int num_bytes = sizeof(rpi_hevc_transform); -++ assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -++ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -++ } -++ -++ return 0; -++} -++ -++// Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -++static void gpu_lock(void) { -++ pthread_mutex_lock(&gpu_mutex); -++ if (gpu==NULL) { -++ gpu_init(&gpu); -++ } -++} -++ -++static void gpu_unlock(void) { -++ pthread_mutex_unlock(&gpu_mutex); -++} -++ -++// Allocate memory on GPU -++// Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes -++// Returns 0 on success. -++// This allocates memory that will not be cached in ARM's data cache. -++// Therefore safe to use without data cache flushing. -++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { -++ gpu_lock(); -++ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -++ p->vcsm_handle = 0; -++ if (!p->vc_handle) -++ { -++ qpu_enable(gpu->mb, 0); -++ return -3; -++ } -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -++ p->numbytes = numbytes; -++ if (p->arm == NULL) -++ { -++ mem_free(gpu->mb, p->vc_handle); -++ mem_unlock(gpu->mb, p->vc_handle); -++ gpu_unlock(); -++ qpu_enable(gpu->mb, 0); -++ return -4; -++ } -++ gpu->open_count++; -++ gpu_unlock(); -++ return 0; -++} -++ -++void gpu_cache_flush(GPU_MEM_PTR_T *p) -++{ -++ // This only works when using RPI_USE_VCSM -++ void *tmp = vcsm_lock(p->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++} -++ -++// This allocates data that will be -++// Cached in ARM L2 -++// Uncached in VPU L2 -++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -++ gpu_lock(); -++#ifdef RPI_USE_VCSM -++ { -++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) -++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -++ p->arm = vcsm_lock(p->vcsm_handle); -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ } -++#else -++ p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -++ p->vcsm_handle = 0; -++ if (!p->handle) -++ { -++ qpu_enable(gpu->mb, 0); -++ return -3; -++ } -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ printf("This mapmem_private does not seem to work\n"); -++ exit(-1); -++ p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -++ p->numbytes = numbytes; -++ if (p->arm == NULL) -++ { -++ mem_free(gpu->mb, p->handle); -++ mem_unlock(gpu->mb, p->handle); -++ gpu_unlock(); -++ qpu_enable(gpu->mb, 0); -++ return -4; -++ } -++#endif -++ gpu->open_count++; -++ gpu_unlock(); -++ return 0; -++} -++ -++static void gpu_term(void) -++{ -++ int mb = gpu->mb; -++ unsigned handle = gpu->vc_handle; -++ if (gpu==NULL) -++ return; -++ unmapmem((void*)gpu, sizeof(struct GPU)); -++ mem_unlock(mb, handle); -++ mem_free(mb, handle); -++ qpu_enable(mb, 0); -++#ifdef RPI_USE_VCSM -++ vcsm_exit(); -++#endif -++ mbox_close(mb); -++ gpu = NULL; -++} -++ -++void gpu_free(GPU_MEM_PTR_T *p) { -++ int mb = gpu->mb; -++ unsigned handle = p->vc_handle; -++ gpu_lock(); -++#ifdef RPI_USE_VCSM -++ if (p->vcsm_handle) { -++ mem_unlock(mb,p->vc_handle); -++ vcsm_unlock_ptr(p->arm); -++ vcsm_free(p->vcsm_handle); -++ } else { -++ unmapmem((void*)p->arm, sizeof(struct GPU)); -++ mem_unlock(mb, handle); -++ mem_free(mb, handle); -++ } -++#else -++ unmapmem((void*)p->arm, sizeof(struct GPU)); -++ mem_unlock(mb, handle); -++ mem_free(mb, handle); -++#endif -++ -++ gpu->open_count--; -++ if (gpu->open_count==0) { -++ printf("Closing GPU\n"); -++ gpu_term(); -++ gpu = NULL; -++ } -++ gpu_unlock(); -++} -++ -++unsigned int vpu_get_fn(void) { -++ // Make sure that the gpu is initialized -++ if (gpu==NULL) { -++ printf("Preparing gpu\n"); -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ return gpu->vc + offsetof(struct GPU,vpu_code); -++} -++ -++unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -++{ -++ unsigned r; -++ gpu_lock(); -++ r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); -++ gpu_unlock(); -++ return r; -++} -++ -++// Run a program on a QPU with the given code and uniform stream (given in GPU addresses) -++// The first num QPUs will start at code, the next num2 QPUs will start at code2 -++void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12) -++{ -++ int i; -++#ifdef RPI_TIME_TOTAL_QPU -++ static int last_time=0; -++ static long long on_time=0; -++ static long long off_time=0; -++ int start_time; -++ int end_time; -++ static int count=0; -++#endif -++ -++ gpu_lock(); -++#ifdef RPI_TIME_TOTAL_QPU -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -++ for(i=0;imail[i*2 + 1] = code; -++ } -++ for(;imail[i*2 + 1] = code2; -++ } -++ gpu->mail[0 ] = unifs1; -++ gpu->mail[2 ] = unifs2; -++ gpu->mail[4 ] = unifs3; -++ gpu->mail[6 ] = unifs4; -++ gpu->mail[8 ] = unifs5; -++ gpu->mail[10] = unifs6; -++ gpu->mail[12] = unifs7; -++ gpu->mail[14] = unifs8; -++ gpu->mail[16] = unifs9; -++ gpu->mail[18] = unifs10; -++ gpu->mail[20] = unifs11; -++ gpu->mail[22] = unifs12; -++ execute_qpu( -++ gpu->mb, -++ 12 /* Number of QPUs */, -++ gpu->vc + offsetof(struct GPU, mail), -++ 1 /* no flush */, // Don't flush VPU L1 cache -++ 5000 /* timeout ms */); -++#ifdef RPI_TIME_TOTAL_QPU -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ if ((count&0x7f)==0) -++ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); -++#endif -++ gpu_unlock(); -++} -++ -++unsigned int qpu_get_fn(int num) { -++ // Make sure that the gpu is initialized -++ unsigned int *fn; -++ if (gpu==NULL) { -++ printf("Preparing gpu\n"); -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ switch(num) { -++ case QPU_MC_SETUP: -++ fn = mc_setup; -++ break; -++ case QPU_MC_FILTER: -++ fn = mc_filter; -++ break; -++ case QPU_MC_EXIT: -++ fn = mc_exit; -++ break; -++ case QPU_MC_INTERRUPT_EXIT: -++ fn = mc_interrupt_exit; -++ break; -++ case QPU_MC_FILTER_B: -++ fn = mc_filter_b; -++ break; -++ case QPU_MC_FILTER_HONLY: -++ fn = mc_filter_honly; -++ break; -++ case QPU_MC_SETUP_UV: -++ fn = mc_setup_uv; -++ break; -++ case QPU_MC_FILTER_UV: -++ fn = mc_filter_uv; -++ break; -++ case QPU_MC_FILTER_UV_B: -++ fn = mc_filter_uv_b; -++ break; -++ case QPU_MC_END: -++ fn = mc_end; -++ break; -++ default: -++ printf("Unknown function\n"); -++ exit(-1); -++ } -++ return gpu->vc + 4*(int)(fn-rpi_shader); -++ //return code[num] + gpu->vc; -++} -++ -++#if 0 -++ -++int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; -++//int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -++int32_t vcoeffs[] = {-2, 6, -13, 37, 115, -20, 9, -4}; -++//int32_t vcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -++ -++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0-1) & 0xff) | ((c1-1) & 0xff) << 8 | ((c2-1) & 0xff) << 16 | ((c3-1) & 0xff) << 24); -++ -++static uint8_t av_clip_uint8(int32_t a) -++{ -++ if (a&(~255)) return (-a)>>31; -++ else return a; -++} -++ -++static int32_t filter8(const uint8_t *data, int pitch) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ -++ for (y = 0; y < 8; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 8; x++) -++ hsum += hcoeffs[x]*data[x + y * pitch]; -++ -++ vsum += vcoeffs[y]*av_clip_uint8( (hsum + 64) >> 7); // Added brackets to stop compiler warning -++ } -++ -++ return av_clip_uint8( (vsum + 64) >> 7); -++} -++ -++// Note regression changes coefficients so is not thread safe -++//#define REGRESSION -++#ifdef REGRESSION -++#define CMAX 100 -++#else -++#define CMAX 2 -++#endif -++#define YMAX 16 -++ -++int rpi_test_shader(void) -++{ -++ int i, c; -++ -++ uint32_t *unifs; -++ -++ uint8_t *in_buffer; -++ uint8_t *out_buffer[2]; -++ -++ GPU_MEM_PTR_T unifs_ptr; -++ GPU_MEM_PTR_T in_buffer_ptr; -++ GPU_MEM_PTR_T out_buffer_ptr[2]; -++ -++ // Addresses in GPU memory of filter programs -++ uint32_t mc_setup = 0; -++ uint32_t mc_filter = 0; -++ uint32_t mc_exit = 0; -++ -++ int pitch = 0x500; -++ -++ if (gpu==NULL) { -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ -++ printf("This needs to change to reflect new assembler\n"); -++ // Use table to compute locations of program start points -++ mc_setup = code[0] + gpu->vc; -++ mc_filter = code[1] + gpu->vc; -++ mc_exit = code[2] + gpu->vc; -++ -++ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { -++ return -2; -++ } -++ unifs = (uint32_t*)unifs_ptr.arm; -++ -++ if (!vcos_verify(gpu_malloc_uncached(64*23,&in_buffer_ptr))) { -++ return -3; -++ } -++ in_buffer = (uint8_t*)in_buffer_ptr.arm; -++ -++ if (!vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[0])) || !vcos_verify(gpu_malloc_uncached(16*pitch,&out_buffer_ptr[1]))) { -++ return -4; -++ } -++ out_buffer[0] = (uint8_t*)out_buffer_ptr[0].arm; -++ out_buffer[1] = (uint8_t*)out_buffer_ptr[1].arm; -++ -++ for (c = 0; c < CMAX; c++) { -++ int xo[] = {rand()&31, rand()&31}; -++ -++#ifdef REGRESSION -++ for (i = 0; i < 8; i++) { -++ hcoeffs[i] = (int8_t)rand(); -++ vcoeffs[i] = (int8_t)rand(); -++ if (hcoeffs[i]==-128) -++ hcoeffs[i]++; -++ if (vcoeffs[i]==-128) -++ vcoeffs[i]++; -++ } -++#endif -++ -++ for (i = 0; i < 64*23; i++) { -++ //printf("%d %d %p\n",i,gpu->mb,&in_buffer[i]); -++ in_buffer[i] = rand(); -++ } -++ -++ // Clear output array -++ { -++ int b; -++ for(b=0;b<2;b++) { -++ for(i=0;i<16*16;i++) { -++ out_buffer[b][i] = 3; -++ } -++ } -++ } -++ -++ unifs[0] = mc_filter; -++ unifs[1] = in_buffer_ptr.vc+xo[0]+16; -++ unifs[2] = 64; // src pitch -++ unifs[3] = pitch; // dst pitch -++ unifs[4] = 0; // Padding -++ unifs[5] = 0; -++ unifs[6] = 0; -++ unifs[7 ] = mc_filter; -++ unifs[8 ] = in_buffer_ptr.vc+xo[1]+16; -++ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -++ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -++ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -++ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -++ unifs[13] = out_buffer_ptr[0].vc; -++ unifs[14] = mc_exit; -++ unifs[15] = in_buffer_ptr.vc+xo[1]+16; // dummy -++ unifs[16] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -++ unifs[17] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -++ unifs[18] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -++ unifs[19] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -++ unifs[20] = out_buffer_ptr[1].vc; -++ -++ printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); -++ -++ // flush_dcache(); TODO is this needed on ARM side? - tried to use the direct alias to avoid this problem -++ -++ //qpu_run_shader(mc_setup, unifs_ptr.vc); -++ //qpu_run_shader(gpu, gpu->vc, unifs_ptr.vc); -++ rpi_do_block(in_buffer_ptr.vc+xo[0]+16, 64, out_buffer_ptr[0].vc, pitch,out_buffer[0]); -++ rpi_do_block(in_buffer_ptr.vc+xo[1]+16, 64, out_buffer_ptr[1].vc, pitch,out_buffer[1]); -++ -++ if (1) -++ { -++ int x, y, b; -++ int bad = 0; -++ -++ for (b=0; b<2; ++b) -++ for (y=0; yvc; -++ mc_filter = code[1] + gpu->vc; -++ mc_exit = code[2] + gpu->vc; -++ -++ if (!vcos_verify(gpu_malloc_uncached(4*64,&unifs_ptr))) { -++ return; -++ } -++ //gpu_malloc_uncached(16*dst_pitch,&out_buffer_ptr); -++ //out_buffer = (uint8_t*)out_buffer_ptr.arm; -++ -++ /*for (y=0; y<16; ++y) { -++ for (x=0; x<16; ++x) { -++ out_buffer[x+y*dst_pitch] = 7; -++ } -++ }*/ -++ -++ unifs = (uint32_t*)unifs_ptr.arm; -++ -++ unifs[0] = mc_filter; -++ unifs[1] = (int)in_buffer_vc; -++ unifs[2] = src_pitch; // src pitch -++ unifs[3] = dst_pitch; // dst pitch -++ unifs[4] = 0; // Padding -++ unifs[5] = 0; -++ unifs[6] = 0; -++ unifs[7 ] = mc_exit; -++ unifs[8 ] = (int)in_buffer_vc; -++ unifs[9 ] = ENCODE_COEFFS(hcoeffs[0], hcoeffs[1], hcoeffs[2], hcoeffs[3]); -++ unifs[10] = ENCODE_COEFFS(hcoeffs[4], hcoeffs[5], hcoeffs[6], hcoeffs[7]); -++ unifs[11] = ENCODE_COEFFS(vcoeffs[0], vcoeffs[1], vcoeffs[2], vcoeffs[3]); -++ unifs[12] = ENCODE_COEFFS(vcoeffs[4], vcoeffs[5], vcoeffs[6], vcoeffs[7]); -++ unifs[13] = (int)dst_vc; -++ //unifs[13] = (int)out_buffer_ptr.vc; -++ -++ //printf("Gpu->vc=%x Code=%x dst=%x\n",gpu->vc, mc_filter,out_buffer_ptr[1].vc); -++ -++ qpu_run_shader(mc_setup, unifs_ptr.vc); -++ -++ /*for (y=0; y<16; ++y) { -++ for (x=0; x<16; ++x) { -++ dst[x+y*dst_pitch] = out_buffer[x+y*dst_pitch]; -++ } -++ }*/ -++ -++ gpu_free(&unifs_ptr); -++ //gpu_free(&out_buffer_ptr); -++} -++ -++ -++#endif -++ -++#endif // RPI -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+new file mode 100644 -+index 0000000..4e3c35c -+--- /dev/null -++++ b/libavcodec/rpi_qpu.h -+@@ -0,0 +1,45 @@ -++#ifndef RPI_QPU_H -++#define RPI_QPU_H -++ -++typedef struct gpu_mem_ptr_s { -++ unsigned char *arm; // Pointer to memory mapped on ARM side -++ int vc_handle; // Videocore handle of relocatable memory -++ int vcsm_handle; // Handle for use by VCSM -++ int vc; // Address for use in GPU code -++ int numbytes; // Size of memory block -++} GPU_MEM_PTR_T; -++ -++// General GPU functions -++extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -++extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -++extern void gpu_free(GPU_MEM_PTR_T *p); -++extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -++ -++// QPU specific functions -++extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -++ -++enum { -++ QPU_MC_SETUP, -++ QPU_MC_FILTER, -++ QPU_MC_EXIT, -++ QPU_MC_INTERRUPT_EXIT, -++ QPU_MC_FILTER_B, -++ QPU_MC_FILTER_HONLY, -++ QPU_MC_SETUP_UV, -++ QPU_MC_FILTER_UV, -++ QPU_MC_FILTER_UV_B, -++ QPU_MC_END -++ }; -++extern unsigned int qpu_get_fn(int num); -++ -++// VPU specific functions -++extern unsigned int vpu_get_fn(void); -++extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -++ -++// Simple test of shader code -++extern int rpi_test_shader(void); -++ -++extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); -++extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); -++ -++#endif -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+new file mode 100644 -+index 0000000..41cc2e1 -+--- /dev/null -++++ b/libavcodec/rpi_shader.c -+@@ -0,0 +1,818 @@ -++#include "rpi_shader.h" -++ -++#ifdef _MSC_VER -++ #include -++ /* cast through uintptr_t to avoid warnings */ -++ #define POINTER_TO_UINT(X) ((unsigned int)(uintptr_t)(X)) -++#else -++ #define POINTER_TO_UINT(X) ((unsigned int)(X)) -++#endif -++ -++#ifdef __cplusplus -++extern "C" { /* the types are probably wrong... */ -++#endif -++#ifdef __cplusplus -++} -++#endif -++ -++#ifdef _MSC_VER -++__declspec(align(8)) -++#elif defined(__GNUC__) -++__attribute__((aligned(8))) -++#endif -++unsigned int rpi_shader[] = { -++// ::mc_setup -++/* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -++/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 -++/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch -++/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 -++/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++// ::mc_filter_uv -++/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :uvloop -++/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter -++/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -++/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :loop -++/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// :fast_path -++/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :fast_loop -++/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -++/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -++/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -++/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_b -++/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :bloop -++/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -++/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_honly -++/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -++/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -++/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :loop_honly -++/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -++/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -++/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -++/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -++/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -++/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -++/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_exit -++/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_exit1 -++/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit -++/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit4 -++/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit8 -++/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_setup_uv -++/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif -++/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 -++/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++// ::mc_filter_uv_b -++/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :uvloop_b -++/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_end -++}; -++#ifdef __HIGHC__ -++#pragma Align_to(8, rpi_shader) -++#endif -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+new file mode 100644 -+index 0000000..db971f4 -+--- /dev/null -++++ b/libavcodec/rpi_shader.h -+@@ -0,0 +1,20 @@ -++#ifndef rpi_shader_H -++#define rpi_shader_H -++ -++extern unsigned int rpi_shader[]; -++ -++#define mc_setup (rpi_shader + 0) -++#define mc_filter_uv (rpi_shader + 146) -++#define mc_filter (rpi_shader + 360) -++#define mc_filter_b (rpi_shader + 670) -++#define mc_filter_honly (rpi_shader + 894) -++#define mc_exit (rpi_shader + 1048) -++#define mc_exit1 (rpi_shader + 1066) -++#define mc_interrupt_exit (rpi_shader + 1082) -++#define mc_interrupt_exit4 (rpi_shader + 1120) -++#define mc_interrupt_exit8 (rpi_shader + 1142) -++#define mc_setup_uv (rpi_shader + 1172) -++#define mc_filter_uv_b (rpi_shader + 1314) -++#define mc_end (rpi_shader + 1542) -++ -++#endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+new file mode 100644 -+index 0000000..6851e83 -+--- /dev/null -++++ b/libavcodec/rpi_shader.qasm -+@@ -0,0 +1,1413 @@ -++# register allocation -++# -++# ra0...ra7 eight horizontal filter coefficients -++# -++# rb1...rb7 seven shifted copies of the current unfiltered row -++# -++# ra8...ra15 eight filtered rows of context (rb15 == most recent) -++# -++# (ra15 isn't clamped to zero - this happens during the -++# copy to ra14, and during its use in the vertical filter) -++# -++# rb8...rb15 eight vertical filter coefficients -++# -++# ra16 clipped(row start address+elem_num)&~3 -++# ra17 per-channel shifts -++# ra19 next ra17 -++# -++# rb16 pitch -++# rb17 height + 5 -++# rb18 height + 7 -++# rb19 next ra16 -++# -++# ra20 1 -++# ra21 64 -++# ra22 256 -++# ra23 8 -++# -++# rb20 0xffffff00 -++# rb21 64 -++# rb22 255 -++# rb23 24 -++# -++# rb24 vdw_setup_1(dst_pitch) -++# rb25 frame width-1 -++# rb26 height<<23 + width<<16 + vdw_setup_0 -++# rb27 vdw_setup_0 (depends on QPU number) -++# rb28 vpm_setup (depends on QPU number) -++# rb29 vdw_setup_1(dst_pitch-width) -++# rb30 frame height-1 -++# rb31 used as temp to count loop iterations -++# -++# ra24...ra30 15, 14, 13, 12, 11, 10, 9 -++# ra24 clipped(row start address+8+elem_num)&~3 -++# ra25 per-channel shifts 2 -++# ra26 next ra24 -++# ra27 next ra25 -++# ra28 next y -++# ra29 y for next texture access -++# -++# ra31 next kernel address -++ -++.set rb_frame_width_minus_1, rb25 -++.set rb_frame_height_minus_1, rb30 -++.set rb_pitch, rb16 -++.set ra_x_base, ra16 -++.set rb_x_base_next, rb19 -++.set ra_x2_base, ra24 -++.set ra_x2_base_next, ra26 -++.set ra_xshift, ra17 -++ -++.set ra_x2shift, ra25 -++.set ra_u2v_ref_offset, ra25 -++ -++.set ra_xshift_next, ra19 -++ -++.set ra_x2shift_next, ra27 -++.set ra_u2v_dst_offset, ra27 -++ -++.set ra_y_next, ra28 -++.set ra_y, ra29 -++ -++.set rb_const_64, rb21 -++ -++# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) -++::mc_setup -++ -++# Read starting kernel -++mov ra31, unif -++ -++# Load first request location -++add ra_x_base, unif, elem_num # Store x -++mov ra_y, unif # Store y -++mov ra_x2_base, unif # Store frame base -++ -++# Read image dimensions -++sub rb25,unif,1 -++sub rb30,unif,1 -++ -++# get source pitch -++mov rb16, unif -++ -++# get destination pitch -++mov r0, unif -++mov r1, vdw_setup_1(0) -++add rb24, r1, r0 -++ -++# load constants -++ -++mov ra20, 1 -++mov ra21, 64 -++mov ra22, 256 -++mov ra23, 8 -++ -++mov rb20, 0xffffff00 -++mov rb21, 64 -++mov rb22, 255 -++mov rb23, 24 -++ -++# touch vertical context to keep simulator happy -++ -++mov ra8, 0 -++mov ra9, 0 -++mov ra10, 0 -++mov ra11, 0 -++mov ra12, 0 -++mov ra13, 0 -++mov ra14, 0 -++mov ra15, 0 -++ -++# Compute part of VPM to use for DMA output -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 -++ -++# Compute part of VPM to save data into -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) -++add rb28, r0, r1 -++ -++# Compute base address for first and second access -++#add r0, unif, elem_num # x -++mov r0, ra_x_base # Load x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, ra_y # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++add ra_y, r1, 1 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++max r1, r1, 0 # y -++min r1, r1, rb_frame_height_minus_1 -++add r0, r0, r3; mul24 r1, r1, rb_pitch -++add r2, r2, r3 -++and r0, r0, ~3 -++and r2, r2, ~3; mov ra_x_base, r0 -++# submit texture requests for first line -++add t0s, r0, r1 ; mov ra_x2_base, r2 -++add t0s, r2, r1 -++ -++# Dump padding words -++mov r0, unif -++mov r0, unif -++ -++# submit texture requests for second line -++max r1, ra_y, 0 -++min r1, r1, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 -++bra -, ra31 -++nop ; mul24 r1, r1, rb_pitch -++add t0s, r1, ra_x_base -++add t0s, r1, ra_x2_base -++ -++################################################################################ -++ -++# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_uv -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -++shl ra_xshift_next, r0, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -++add r0, r0, r3 -++and rb_x_base_next, r0, ~3 -++mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:uvloop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:uvloop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++brr.anyn -, r:uvloop -++asr r1, r1, 15 -++min r1, r1, rb22 -++max vpm, r1, 0 -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -++ -++bra -, ra31 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -++ -++# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov ra_x2shift, ra_x2shift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++add r0, r0, r3 -++add r2, r2, r3 -++and rb_x_base_next, r0, ~3 -++and ra_x2_base_next, r2, ~3 -++mov ra_y_next, r1 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++brr.anynn -, r:fast_path -++asr rb12, r0, rb23 # delay slot 1 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 # delay slot 2 -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++## sub r2, r2, r3 ; ldtmu0 -++## -++## mov r0, ra22 -++## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # apply horizontal filter -++## -++## asr r2, r2, 15 ; mul24 r3, r0, ra0 -++## min r2, r2, rb22 -++## max ra13, r2, 0 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra14, r0, 0 -++## -++## -++## -++## -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra15, r0, 0 -++ -++ -++ -++ -++mov r3, 0 -++ -++:loop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:loop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++brr.anyn -, r:loop -++asr r1, r1, 15 -++min r1, r1, rb22 -++max vpm, r1, 0 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++#################################################### -++ -++:fast_path -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## sub r2, r2, r3 ; ldtmu0 -++## -++## mov r0, ra22 -++## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # apply horizontal filter -++## -++## asr r2, r2, 15 ; mul24 r3, r0, ra0 -++## min r2, r2, rb22 -++## max ra13, r2, 0 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra14, r0, 0 -++## -++## -++## -++## -++## nop ; ldtmu0 # loop counter increment -++## shr r0, r4, ra17 ; ldtmu0 -++## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -++## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -++## add ra16, ra16, rb16 ; mov t0s, ra16 -++## -++## # generate seven shifted versions -++## # interleave with scroll of vertical context -++## -++## mov r2, rb21 ; mul24 r3, r0, ra0 -++## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++## sub r0, r2, r3 -++## -++## # apply horizontal filter -++## -++## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -++## asr r0, r0, 15 -++## min r0, r0, rb22 -++## max ra15, r0, 0 -++ -++ -++mov r3, 0 # This signifies the amount of unrolling -++ -++:fast_loop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_y, ra_y_next ; mov rb31, r3 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -++ -++max r2, ra_y, 0 -++min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++sub r0, r2, r3 ; mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++ -++brr.anyn -, r:fast_loop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++brr.anyn -, r:fast_loop -++asr r1, r1, 15 -++min r1, r1, rb22 -++max vpm, r1, 0 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -++# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_b -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov ra_x2shift, ra_x2shift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++add r0, r0, r3 -++add r2, r2, r3 -++and rb_x_base_next, r0, ~3 -++and ra_x2_base_next, r2, ~3 -++mov ra_y_next, r1 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++# r0 is currently height<<7 -++# For vr_setup we want height<<20 (so 20-7=13 additional bits) -++shl r3, r0, 13 -++shl r3, r3, 8 # Mask off top 8 bits -++shr r3, r3, 8 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++# In a B frame, so also set up VPM read -++add vr_setup, r3, rb28 -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov r3, 0 -++ -++:bloop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:bloop -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 15 ; mov -, vr_wait -++min r1, r1, rb22 -++add r0, vpm, 1 # Blend in previous VPM contents at this location -++brr.anyn -, r:bloop -++max r1, r1, 0 -++add r1, r1, r0 -++shr vpm, r1, 1 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -++# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -++# This filter only does horizontal filtering. -++# It is assumed that the region to fetch does not include extra rows above. -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_honly -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov ra_x2shift, ra_x2shift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++add r2, r0, 8 # x+8 -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++shl ra_xshift_next, r0, 3 -++max r2, r2, 0 -++min r2, r2, rb_frame_width_minus_1 -++shl ra_x2shift_next, r2, 3 -++add r0, r0, r3 -++add r2, r2, r3 -++and rb_x_base_next, r0, ~3 -++and ra_x2_base_next, r2, ~3 -++mov ra_y_next, r1 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, -2 # Pipelining means we move data across 2 iterations early -++shl r0, r0, 7 ; mov rb18,r0 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++mov r0, unif -++ -++# r2 is elem_num -++# r3 is loop counter -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -++mov r3, 0 -++ -++:loop_honly -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 ; mov r3, rb31 -++ -++sub.setf -, r3, rb18 ; mov r1, ra22 -++ -++mov -, vw_wait ; mul24 r0, r0, r1 -++brr.anyn -, r:loop_honly -++asr r0, r0, 15 # delay 1 -++min r0, r0, rb22 # delay 2 -++max vpm, r0, 0 # delay 3 -++ -++# DMA out -++bra -, ra31 -++mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -++mov vw_setup, rb29 -++mov vw_addr, unif # start the VDW -++ -++ -++################################################################################ -++ -++# mc_exit() -++ -++::mc_exit -++mov -, vw_wait # wait on the VDW -++ -++mov -,srel(0) -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++nop ; nop ; thrend -++nop ; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++::mc_exit1 -++mov -, vw_wait # wait on the VDW -++ -++#mov -,srel(1) -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++# mc_interrupt_exit() -++::mc_interrupt_exit -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++mov -,sacq(0) # 4 -++mov -,sacq(0) # 5 -++mov -,sacq(0) # 6 -++mov -,sacq(0) # 7 -++mov -,sacq(0) # 8 -++mov -,sacq(0) # 9 -++mov -,sacq(0) # 10 -++mov -,sacq(0) # 11 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++# mc_interrupt_exit4() -++::mc_interrupt_exit4 -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++# mc_interrupt_exit8() -++::mc_interrupt_exit8 -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++mov -,sacq(0) # 4 -++mov -,sacq(0) # 5 -++mov -,sacq(0) # 6 -++mov -,sacq(0) # 7 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++################################################################################ -++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -++::mc_setup_uv -++ -++# Read starting kernel -++mov ra31, unif -++ -++# Load first request location -++add ra_x_base, unif, elem_num # Store x -++mov ra_y, unif # Store y -++mov ra_x2_base, unif # Store frame u base -++nop -++sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -++ -++# Read image dimensions -++sub rb25,unif,1 -++sub rb30,unif,1 -++ -++# get source pitch -++mov rb16, unif -++ -++# get destination pitch -++mov r0, unif -++mov r1, vdw_setup_1(0) -++add rb24, r1, r0 -++ -++# load constants -++ -++mov ra20, 1 -++mov ra21, 64 -++mov ra22, 256 -++mov ra23, 8 -++ -++mov rb20, 0xffffff00 -++mov rb21, 64 -++mov rb22, 255 -++mov rb23, 24 -++ -++# touch vertical context to keep simulator happy -++ -++mov ra8, 0 -++mov ra9, 0 -++mov ra10, 0 -++mov ra11, 0 -++mov ra12, 0 -++mov ra13, 0 -++mov ra14, 0 -++mov ra15, 0 -++ -++# Compute part of VPM to use for DMA output -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 -++ -++# Compute part of VPM to save data into -++mov r2, qpu_num -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) -++add rb28, r0, r1 -++ -++# Compute base address for first and second access -++mov r0, ra_x_base # Load x -++max r0, r0, 0; mov r1, ra_y # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -++shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++add ra_y, r1, 1 -++add r0, r0, r3 -++and r0, r0, ~3 -++max r1, r1, 0 ; mov ra_x_base, r0 # y -++min r1, r1, rb_frame_height_minus_1 -++# submit texture requests for first line -++add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++add t0s, r0, r1 ; mov ra_x2_base, r2 -++add t0s, r2, r1 -++ -++# Dump padding words -++mov r0, unif -++mov r0, unif -++mov r0, unif -++ -++# submit texture requests for second line -++max r1, ra_y, 0 -++min r1, r1, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 -++bra -, ra31 -++nop ; mul24 r1, r1, rb_pitch -++add t0s, r1, ra_x_base -++add t0s, r1, ra_x2_base -++ -++ -++ -++################################################################################ -++ -++::mc_filter_uv_b -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -++shl ra_xshift_next, r0, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -++add r0, r0, r3 -++and rb_x_base_next, r0, ~3 -++mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++ -++# r0 is currently height<<7 -++# For vr_setup we want height<<20 (so 20-7=13 additional bits) -++shl r3, r0, 13 -++shl r3, r3, 8 # Mask off top 8 bits -++shr r3, r3, 8 -++ -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# In a B frame, so also set up VPM read -++add vr_setup, r3, rb28 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:uvloop_b -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r2, rb21 ; mul24 r3, r0, ra0 -++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++sub r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:uvloop_b -++max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr r0, r0, 15 ; mov r1, ra21 -++min.setf ra15, r0, rb22 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r0, ra14, rb14 -++sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++sub.ifnn r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 15 -++min r1, r1, rb22 -++add r0, vpm, 1 # Blend in previous VPM contents at this location -++brr.anyn -, r:uvloop_b -++max r1, r1, 0 -++add r1, r1, r0 -++shr vpm, r1, 1 -++ -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -++ -++bra -, ra31 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++::mc_end -+diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -+new file mode 100644 -+index 0000000..fbebbbe -+--- /dev/null -++++ b/libavcodec/rpi_user_vcsm.h -+@@ -0,0 +1,425 @@ -++/* -++Copyright (c) 2012, Broadcom Europe Ltd -++All rights reserved. -++ -++Redistribution and use in source and binary forms, with or without -++modification, are permitted provided that the following conditions are met: -++ * Redistributions of source code must retain the above copyright -++ notice, this list of conditions and the following disclaimer. -++ * Redistributions in binary form must reproduce the above copyright -++ notice, this list of conditions and the following disclaimer in the -++ documentation and/or other materials provided with the distribution. -++ * Neither the name of the copyright holder nor the -++ names of its contributors may be used to endorse or promote products -++ derived from this software without specific prior written permission. -++ -++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -++*/ -++ -++#ifndef __USER_VCSM__H__INCLUDED__ -++#define __USER_VCSM__H__INCLUDED__ -++ -++/* VideoCore Shared Memory - user interface library. -++** -++** This library provides all the necessary abstraction for any application to -++** make use of the shared memory service which is distributed accross a kernel -++** driver and a videocore service. -++** -++** It is an application design decision to choose or not to use this service. -++** -++** The logical flow of operations that a user application needs to follow when -++** using this service is: -++** -++** 1) Initialize the service. -++** 2) Allocate shared memory blocks. -++** 3) Start using the allocated blocks. -++** - In order to gain ownership on a block, lock the allocated block, -++** locking a block returns a valid address that the user application -++** can access. -++** - When finished with using the block for the current execution cycle -++** or function, and so when giving up the ownership, unlock the block. -++** 4) A block can be locked/unlocked as many times required - within or outside -++** of - a specific execution context. -++** 5) To completely release an allocated block, free it. -++** 6) If the service is no longer required, terminate it. -++** -++** -++** Some generic considerations: -++ -++** Allocating memory blocks. -++** -++** Memory blocks can be allocated in different manners depending on the cache -++** behavior desired. A given block can either be: -++ -++** - Allocated in a non cached fashion all the way through host and videocore. -++** - Allocated in a cached fashion on host OR videocore. -++** - Allocated in a cached fashion on host AND videocore. -++** -++** It is an application decision to determine how to allocate a block. Evidently -++** if the application will be doing substantial read/write accesses to a given block, -++** it is recommended to allocate the block at least in a 'host cached' fashion for -++** better results. -++** -++** -++** Locking memory blocks. -++** -++** When the memory block has been allocated in a host cached fashion, locking the -++** memory block (and so taking ownership of it) will trigger a cache invalidation. -++** -++** For the above reason and when using host cached allocation, it is important that -++** an application properly implements the lock/unlock mechanism to ensure cache will -++** stay coherent, otherwise there is no guarantee it will at all be. -++** -++** It is possible to dynamically change the host cache behavior (ie cached or non -++** cached) of a given allocation without needing to free and re-allocate the block. -++** This feature can be useful for such application which requires access to the block -++** only at certain times and not otherwise. By changing the cache behavior dynamically -++** the application can optimize performances for a given duration of use. -++** Such dynamic cache behavior remapping only applies to host cache and not videocore -++** cache. If one requires to change the videocore cache behavior, then a new block -++** must be created to replace the old one. -++** -++** On successful locking, a valid pointer is returned that the application can use -++** to access to data inside the block. There is no guarantee that the pointer will -++** stay valid following the unlock action corresponding to this lock. -++** -++** -++** Unocking memory blocks. -++** -++** When the memory block has been allocated in a host cached fashion, unlocking the -++** memory block (and so forgiving its ownership) will trigger a cache flush unless -++** explicitely asked not to flush the cache for performances reasons. -++** -++** For the above reason and when using host cached allocation, it is important that -++** an application properly implements the lock/unlock mechanism to ensure cache will -++** stay coherent, otherwise there is no guarantee it will at all be. -++** -++** -++** A complete API is defined below. -++*/ -++ -++#ifdef __cplusplus -++extern "C" -++{ -++#endif -++ -++/* Different status that can be dumped. -++*/ -++typedef enum -++{ -++ VCSM_STATUS_VC_WALK_ALLOC = 0, // Walks *all* the allocation on videocore. -++ // Result of the walk is seen in the videocore -++ // log. -++ VCSM_STATUS_HOST_WALK_MAP, // Walks the *full* mapping allocation on host -++ // driver (ie for all processes). Result of -++ // the walk is seen in the kernel log. -++ VCSM_STATUS_HOST_WALK_PID_MAP, // Walks the per process mapping allocation on host -++ // driver (for current process). Result of -++ // the walk is seen in the kernel log. -++ VCSM_STATUS_HOST_WALK_PID_ALLOC, // Walks the per process host allocation on host -++ // driver (for current process). Result of -++ // the walk is seen in the kernel log. -++ VCSM_STATUS_VC_MAP_ALL, // Equivalent to both VCSM_STATUS_VC_WALK_ALLOC and -++ // VCSM_STATUS_HOST_WALK_MAP. -++ // -++ VCSM_STATUS_NONE, // Must be last - invalid. -++ -++} VCSM_STATUS_T; -++ -++/* Different kind of cache behavior. -++*/ -++typedef enum -++{ -++ VCSM_CACHE_TYPE_NONE = 0, // No caching applies. -++ VCSM_CACHE_TYPE_HOST, // Allocation is cached on host (user space). -++ VCSM_CACHE_TYPE_VC, // Allocation is cached on videocore. -++ VCSM_CACHE_TYPE_HOST_AND_VC, // Allocation is cached on both host and videocore. -++ -++} VCSM_CACHE_TYPE_T; -++ -++/* Initialize the vcsm processing. -++** -++** Must be called once before attempting to do anything else. -++** -++** Returns 0 on success, -1 on error. -++*/ -++int vcsm_init( void ); -++ -++ -++/* Terminates the vcsm processing. -++** -++** Must be called vcsm services are no longer needed, it will -++** take care of removing any allocation under the current process -++** control if deemed necessary. -++*/ -++void vcsm_exit( void ); -++ -++ -++/* Queries the status of the the vcsm. -++** -++** Triggers dump of various kind of information, see the -++** different variants specified in VCSM_STATUS_T. -++** -++** Pid is optional. -++*/ -++void vcsm_status( VCSM_STATUS_T status, int pid ); -++ -++ -++/* Allocates a non-cached block of memory of size 'size' via the vcsm memory -++** allocator. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** On success, the user must invoke vcsm_lock with the returned opaque -++** handle to gain access to the memory associated with the opaque handle. -++** When finished using the memory, the user calls vcsm_unlock_xx (see those -++** function definition for more details on the one that can be used). -++** -++** A well behaved application should make every attempt to lock/unlock -++** only for the duration it needs to access the memory data associated with -++** the opaque handle. -++*/ -++unsigned int vcsm_malloc( unsigned int size, char *name ); -++ -++ -++/* Allocates a cached block of memory of size 'size' via the vcsm memory -++** allocator, the type of caching requested is passed as argument of the -++** function call. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** On success, the user must invoke vcsm_lock with the returned opaque -++** handle to gain access to the memory associated with the opaque handle. -++** When finished using the memory, the user calls vcsm_unlock_xx (see those -++** function definition for more details on the one that can be used). -++** -++** A well behaved application should make every attempt to lock/unlock -++** only for the duration it needs to access the memory data associated with -++** the opaque handle. -++*/ -++unsigned int vcsm_malloc_cache( unsigned int size, VCSM_CACHE_TYPE_T cache, char *name ); -++ -++ -++/* Shares an allocated block of memory via the vcsm memory allocator. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** On success, the user must invoke vcsm_lock with the returned opaque -++** handle to gain access to the memory associated with the opaque handle. -++** When finished using the memory, the user calls vcsm_unlock_xx (see those -++** function definition for more details on the one that can be used). -++** -++** A well behaved application should make every attempt to lock/unlock -++** only for the duration it needs to access the memory data associated with -++** the opaque handle. -++*/ -++unsigned int vcsm_malloc_share( unsigned int handle ); -++ -++ -++/* Resizes a block of memory allocated previously by vcsm_alloc. -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** The handle must be unlocked by user prior to attempting any -++** resize action. -++** -++** On error, the original size allocated against the handle -++** remains available the same way it would be following a -++** successful vcsm_malloc. -++*/ -++int vcsm_resize( unsigned int handle, unsigned int new_size ); -++ -++ -++/* Frees a block of memory that was successfully allocated by -++** a prior call the vcms_alloc. -++** -++** The handle should be considered invalid upon return from this -++** call. -++** -++** Whether any memory is actually freed up or not as the result of -++** this call will depends on many factors, if all goes well it will -++** be freed. If something goes wrong, the memory will likely end up -++** being freed up as part of the vcsm_exit process. In the end the -++** memory is guaranteed to be freed one way or another. -++*/ -++void vcsm_free( unsigned int handle ); -++ -++ -++/* Retrieves a videocore opaque handle from a mapped user address -++** pointer. The videocore handle will correspond to the actual -++** memory mapped in videocore. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** Note: the videocore opaque handle is distinct from the user -++** opaque handle (allocated via vcsm_malloc) and it is only -++** significant for such application which knows what to do -++** with it, for the others it is just a number with little -++** use since nothing can be done with it (in particular -++** for safety reason it cannot be used to map anything). -++*/ -++unsigned int vcsm_vc_hdl_from_ptr( void *usr_ptr ); -++ -++ -++/* Retrieves a videocore opaque handle from a opaque handle -++** pointer. The videocore handle will correspond to the actual -++** memory mapped in videocore. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++** -++** Note: the videocore opaque handle is distinct from the user -++** opaque handle (allocated via vcsm_malloc) and it is only -++** significant for such application which knows what to do -++** with it, for the others it is just a number with little -++** use since nothing can be done with it (in particular -++** for safety reason it cannot be used to map anything). -++*/ -++unsigned int vcsm_vc_hdl_from_hdl( unsigned int handle ); -++ -++ -++/* Retrieves a user opaque handle from a mapped user address -++** pointer. -++** -++** Returns: 0 on error -++** a non-zero opaque handle on success. -++*/ -++unsigned int vcsm_usr_handle( void *usr_ptr ); -++ -++ -++/* Retrieves a mapped user address from an opaque user -++** handle. -++** -++** Returns: 0 on error -++** a non-zero address on success. -++** -++** On success, the address corresponds to the pointer -++** which can access the data allocated via the vcsm_malloc -++** call. -++*/ -++void *vcsm_usr_address( unsigned int handle ); -++ -++ -++/* Locks the memory associated with this opaque handle. -++** -++** Returns: NULL on error -++** a valid pointer on success. -++** -++** A user MUST lock the handle received from vcsm_malloc -++** in order to be able to use the memory associated with it. -++** -++** On success, the pointer returned is only valid within -++** the lock content (ie until a corresponding vcsm_unlock_xx -++** is invoked). -++*/ -++void *vcsm_lock( unsigned int handle ); -++ -++ -++/* Locks the memory associated with this opaque handle. The lock -++** also gives a chance to update the *host* cache behavior of the -++** allocated buffer if so desired. The *videocore* cache behavior -++** of the allocated buffer cannot be changed by this call and such -++** attempt will be ignored. -++** -++** The system will attempt to honour the cache_update mode request, -++** the cache_result mode will provide the final answer on which cache -++** mode is really in use. Failing to change the cache mode will not -++** result in a failure to lock the buffer as it is an application -++** decision to choose what to do if (cache_result != cache_update) -++** -++** The value returned in cache_result can only be considered valid if -++** the returned pointer is non NULL. The cache_result pointer may be -++** NULL if the application does not care about the actual outcome of -++** its action with regards to the cache behavior change. -++** -++** Returns: NULL on error -++** a valid pointer on success. -++** -++** A user MUST lock the handle received from vcsm_malloc -++** in order to be able to use the memory associated with it. -++** -++** On success, the pointer returned is only valid within -++** the lock content (ie until a corresponding vcsm_unlock_xx -++** is invoked). -++*/ -++void *vcsm_lock_cache( unsigned int handle, -++ VCSM_CACHE_TYPE_T cache_update, -++ VCSM_CACHE_TYPE_T *cache_result ); -++ -++ -++/* Unlocks the memory associated with this user mapped address. -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking a mapped address, the user should no longer -++** attempt to reference it. -++*/ -++int vcsm_unlock_ptr( void *usr_ptr ); -++ -++ -++/* Unlocks the memory associated with this user mapped address. -++** Apply special processing that would override the otherwise -++** default behavior. -++** -++** If 'cache_no_flush' is specified: -++** Do not flush cache as the result of the unlock (if cache -++** flush was otherwise applicable in this case). -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking a mapped address, the user should no longer -++** attempt to reference it. -++*/ -++int vcsm_unlock_ptr_sp( void *usr_ptr, int cache_no_flush ); -++ -++ -++/* Unlocks the memory associated with this user opaque handle. -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking an opaque handle, the user should no longer -++** attempt to reference the mapped addressed once associated -++** with it. -++*/ -++int vcsm_unlock_hdl( unsigned int handle ); -++ -++ -++/* Unlocks the memory associated with this user opaque handle. -++** Apply special processing that would override the otherwise -++** default behavior. -++** -++** If 'cache_no_flush' is specified: -++** Do not flush cache as the result of the unlock (if cache -++** flush was otherwise applicable in this case). -++** -++** Returns: 0 on success -++** -errno on error. -++** -++** After unlocking an opaque handle, the user should no longer -++** attempt to reference the mapped addressed once associated -++** with it. -++*/ -++int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -++ -++#ifdef __cplusplus -++} -++#endif -++ -++#endif /* __USER_VCSM__H__INCLUDED__ */ -+-- -+2.7.4 -+ -+ -+From 6cfa5910be47865aaaf58c185587189c332765a6 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Sat, 2 May 2015 21:15:37 +0100 -+Subject: [PATCH 04/68] First working version with uncached memory -+ -+--- -+ libavcodec/hevc.c | 61 +++++- -+ libavcodec/hevc.h | 12 +- -+ libavcodec/hevc_cabac.c | 39 +++- -+ libavcodec/hevc_filter.c | 16 ++ -+ libavcodec/hevcpred_template.c | 6 + -+ libavcodec/rpi_hevc_transform.h | 422 +++++++++++++++++++++++++++++++++++++++- -+ libavcodec/rpi_hevc_transform.s | 153 +++++++++++++-- -+ libavcodec/rpi_qpu.c | 72 +++++++ -+ libavcodec/rpi_qpu.h | 1 + -+ 9 files changed, 736 insertions(+), 46 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ab55df1..94ff709 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -45,6 +45,8 @@ -+ #include "rpi_qpu.h" -+ #endif -+ -++// #define DISABLE_MC -++ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -+ /** -+@@ -1079,11 +1081,15 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -++ printf("Cross component not supported\n"); // TODO -++ exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+ -+ if (lc->tu.cross_pf) { -++ printf("Cross component not supported\n"); // TODO -++ exit(-1); -+ hls_cross_component_pred(s, 1); -+ } -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+@@ -1112,6 +1118,8 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -++ printf("Cross component not supported\n"); // TODO -++ exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+@@ -1409,6 +1417,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ int idx = ff_hevc_pel_weight[block_w]; -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ x_off += mv->x >> 2; -+ y_off += mv->y >> 2; -+ src += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); -+@@ -1479,6 +1491,10 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ uint8_t *src0 = ref0->data[0] + y_off0 * src0stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); -+ uint8_t *src1 = ref1->data[0] + y_off1 * src1stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ if (x_off0 < QPEL_EXTRA_BEFORE || y_off0 < QPEL_EXTRA_AFTER || -+ x_off0 >= pic_width - block_w - QPEL_EXTRA_AFTER || -+ y_off0 >= pic_height - block_h - QPEL_EXTRA_AFTER) { -+@@ -1564,6 +1580,10 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ intptr_t _mx = mx << (1 - hshift); -+ intptr_t _my = my << (1 - vshift); -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ x_off += mv->x >> (2 + hshift); -+ y_off += mv->y >> (2 + vshift); -+ src0 += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift)); -+@@ -1628,6 +1648,10 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF -+ int hshift = s->ps.sps->hshift[1]; -+ int vshift = s->ps.sps->vshift[1]; -+ -++#ifdef DISABLE_MC -++ return; -++#endif -++ -+ intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift); -+ intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift); -+ intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift); -+@@ -2367,6 +2391,22 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ } -+ -+ #ifdef RPI -++static void rpi_execute_transform(HEVCContext *s) -++{ -++ int i=2; -++ //int j; -++ //int16_t *coeffs = s->coeffs_buf_arm[i]; -++ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -++ // s->hevcdsp.idct[4-2](coeffs, 16); -++ //} -++ -++ //gpu_cache_flush(&s->coeffs_buf[i]); -++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -++ -++ for(i=0;i<4;i++) -++ s->num_coeffs[i] = 0; -++} -++ -+ static void rpi_execute_pred_cmds(HEVCContext *s) -+ { -+ int i; -+@@ -2387,7 +2427,6 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ } -+ } -+ s->num_pred_cmds = 0; -+- s->num_coeffs = 0; -+ } -+ #endif -+ -+@@ -2434,7 +2473,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- if (x_ctb + ctb_size >= s->ps.sps->width) { -++ if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! -++ rpi_execute_transform(s); -+ rpi_execute_pred_cmds(s); -+ } -+ #endif -+@@ -3179,7 +3219,9 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->unif_mv_cmds); -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+- av_freep(&s->coeffs_buf); -++ for(i = 0; i < 4; i++) { -++ gpu_free(&s->coeffs_buf[i]); -++ } -+ #endif -+ -+ for (i = 0; i < 3; i++) { -+@@ -3246,13 +3288,16 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+- s->coeffs_buf = av_mallocz(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16); -+- if (!s->coeffs_buf) -+- goto fail; -++ for(i = 0; i < 4; i++) { -++ gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -++ s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -++ if (!s->coeffs_buf_arm[i]) -++ goto fail; -++ } -+ s->enable_rpi = 0; -+ -+ // A little test program -+- { -++ /*{ -+ GPU_MEM_PTR_T p; -+ int err = gpu_malloc_cached(16, &p); -+ short *q = (short *)p.arm; -+@@ -3273,7 +3318,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ printf(")\n"); -+ gpu_free(&p); -+ goto fail; // Early out -+- } -++ }*/ -+ -+ #endif -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 7a1c35f..4167985 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -40,6 +40,11 @@ -+ #include "thread.h" -+ #include "videodsp.h" -+ -++// define RPI to split the CABAC/prediction/transform into separate stages -++#ifdef RPI -++#include "rpi_qpu.h" -++#endif -++ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+ #define MAX_REFS 16 -+ -+@@ -856,11 +861,12 @@ typedef struct HEVCContext { -+ HEVCMvCmd *unif_mv_cmds; -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+- int16_t *coeffs_buf; -+- int num_mv_cmds; -++ GPU_MEM_PTR_T coeffs_buf[4]; -++ int16_t *coeffs_buf_arm[4]; -++ int num_coeffs[4]; -+ int num_xfm_cmds; -++ int num_mv_cmds; -+ int num_pred_cmds; -+- int num_coeffs; -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 4e97f06..d1cba86 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1031,6 +1031,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int vshift = s->ps.sps->vshift[c_idx]; -+ uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + -+ ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; -+ int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -+ uint8_t significant_coeff_group_flag[8][8] = {{0}}; -+ int explicit_rdpcm_flag = 0; -+@@ -1044,6 +1045,18 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ uint8_t dc_scale; -+ int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : -+ lc->tu.intra_pred_mode_c; -++#ifdef RPI -++ if (s->enable_rpi) { -++ int n = trafo_size * trafo_size; -++ if (use_vpu) { -++ coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; -++ s->num_coeffs[log2_trafo_size - 2] += n; -++ } else { -++ coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; -++ s->num_coeffs[0] += n; -++ } -++ } -++#endif -+ -+ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ -+@@ -1488,6 +1501,24 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { -+ s->hevcdsp.idct_4x4_luma(coeffs); -+ } else { -++#ifdef RPI -++ if (!use_vpu) { -++ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -++ if (max_xy == 0) -++ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -++ else { -++ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; -++ if (max_xy < 4) -++ col_limit = FFMIN(4, col_limit); -++ else if (max_xy < 8) -++ col_limit = FFMIN(8, col_limit); -++ else if (max_xy < 12) -++ col_limit = FFMIN(24, col_limit); -++ -++ s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); -++ } -++ } -++#else -+ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -+ if (max_xy == 0) -+ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -+@@ -1501,6 +1532,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ col_limit = FFMIN(24, col_limit); -+ s->hevcdsp.idct[log2_trafo_size-2](coeffs, col_limit); -+ } -++#endif -+ } -+ } -+ if (lc->tu.cross_pf) { -+@@ -1512,14 +1544,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ #ifdef RPI -+ if (s->enable_rpi) { -+- int16_t *c = s->coeffs_buf + s->num_coeffs; -+- int n = trafo_size * trafo_size; -+ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+- memcpy(c, coeffs, n * sizeof(int16_t)); // TODO change pointer earlier and we can avoid this copy -+- s->num_coeffs += n; -++ //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+- cmd->buf = c; -++ cmd->buf = coeffs; -+ cmd->dst = dst; -+ cmd->stride = stride; -+ return; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 1f33b0c..e4c3da7 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -22,6 +22,10 @@ -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -++//#define DISABLE_SAO -++//#define DISABLE_DEBLOCK -++//#define DISABLE_STRENGTHS -++ -+ #include "libavutil/common.h" -+ #include "libavutil/internal.h" -+ -+@@ -273,6 +277,10 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) -+ edges[2] = x_ctb == s->ps.sps->ctb_width - 1; -+ edges[3] = y_ctb == s->ps.sps->ctb_height - 1; -+ -++#ifdef DISABLE_SAO -++ return; -++#endif -++ -+ if (restore) { -+ if (!edges[0]) { -+ left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]]; -+@@ -496,6 +504,10 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->ps.sps->pcm.loop_filter_disable_flag) || -+ s->ps.pps->transquant_bypass_enable_flag; -+ -++#ifdef DISABLE_DEBLOCK -++ return; -++#endif -++ -+ if (x0) { -+ left_tc_offset = s->deblock[ctb - 1].tc_offset; -+ left_beta_offset = s->deblock[ctb - 1].beta_offset; -+@@ -726,6 +738,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ int boundary_upper, boundary_left; -+ int i, j, bs; -+ -++#ifdef DISABLE_STRENGTHS -++ return; -++#endif -++ -+ boundary_upper = y0 > 0 && !(y0 & 7); -+ if (boundary_upper && -+ ((!s->sh.slice_loop_filter_across_slices_enabled_flag && -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 6ae87cc..71c6d52 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -20,6 +20,8 @@ -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -++//#define DISABLE_INTRA -++ -+ #include "libavutil/pixdesc.h" -+ -+ #include "bit_depth_template.c" -+@@ -114,6 +116,10 @@ do { \ -+ int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, s->ps.sps->width) - -+ (x0 + size_in_luma_h)) >> hshift; -+ -++#ifdef DISABLE_INTRA -++ return; -++#endif -++ -+ if (s->ps.pps->constrained_intra_pred_flag == 1) { -+ int size_in_luma_pu_v = PU(size_in_luma_v); -+ int size_in_luma_pu_h = PU(size_in_luma_h); -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index 85a9102..c0c279f 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -3,11 +3,11 @@ unsigned char rpi_hevc_transform [] = { -+ 3, -+ 3, -+ 232, -+-128, -++32, -+ 0, -+ 0, -+ 0, -+-20, -++12, -+ 248, -+ 0, -+ 136, -+@@ -56,9 +56,9 @@ unsigned char rpi_hevc_transform [] = { -+ 5, -+ 232, -+ 0, -+-0, -+ 8, -+ 0, -++0, -+ 128, -+ 69, -+ 113, -+@@ -108,8 +108,8 @@ unsigned char rpi_hevc_transform [] = { -+ 128, -+ 2, -+ 0, -+-248, -+-62, -++8, -++2, -+ 0, -+ 128, -+ 144, -+@@ -123,13 +123,13 @@ unsigned char rpi_hevc_transform [] = { -+ 3, -+ 32, -+ 8, -+-16, -++20, -+ 0, -+ 76, -+ 254, -+ 48, -+ 192, -+-9, -++4, -+ 4, -+ 32, -+ 8, -+@@ -155,14 +155,46 @@ unsigned char rpi_hevc_transform [] = { -+ 192, -+ 41, -+ 3, -+-68, -++70, -++192, -++80, -++7, -++164, -++255, -++36, -++204, -++96, -++2, -++0, -++248, -++62, -++0, -++3, -++255, -++55, -++208, -++120, -++3, -++224, -++3, -++190, -++11, -++16, -++139, -++246, -++91, -++0, -++103, -++90, -++0, -++70, -+ 192, -+ 80, -+ 7, -+ 164, -+ 255, -+ 36, -+-220, -++204, -+ 96, -+ 2, -+ 0, -+@@ -182,7 +214,7 @@ unsigned char rpi_hevc_transform [] = { -+ 16, -+ 139, -+ 246, -+-83, -++91, -+ 0, -+ 103, -+ 90, -+@@ -209,4 +241,374 @@ unsigned char rpi_hevc_transform [] = { -+ 96, -+ 90, -+ 0, -++169, -++3, -++3, -++232, -++32, -++0, -++0, -++0, -++12, -++248, -++0, -++136, -++0, -++0, -++192, -++248, -++0, -++0, -++64, -++232, -++0, -++2, -++0, -++0, -++12, -++248, -++0, -++168, -++0, -++0, -++192, -++248, -++0, -++0, -++3, -++232, -++128, -++0, -++0, -++0, -++7, -++232, -++0, -++2, -++0, -++0, -++4, -++232, -++64, -++0, -++0, -++0, -++5, -++232, -++0, -++8, -++0, -++0, -++57, -++239, -++224, -++247, -++255, -++255, -++72, -++192, -++95, -++207, -++88, -++122, -++88, -++124, -++137, -++64, -++26, -++64, -++161, -++64, -++152, -++64, -++128, -++144, -++31, -++0, -++72, -++232, -++32, -++0, -++0, -++0, -++65, -++232, -++32, -++0, -++0, -++0, -++128, -++144, -++23, -++0, -++145, -++64, -++168, -++64, -++128, -++144, -++19, -++0, -++72, -++232, -++32, -++0, -++0, -++0, -++65, -++232, -++32, -++0, -++0, -++0, -++128, -++144, -++11, -++0, -++74, -++232, -++0, -++8, -++0, -++0, -++242, -++140, -++229, -++192, -++57, -++239, -++32, -++8, -++0, -++0, -++41, -++3, -++12, -++248, -++0, -++128, -++0, -++0, -++192, -++8, -++4, -++0, -++12, -++248, -++0, -++132, -++64, -++0, -++192, -++8, -++4, -++0, -++0, -++96, -++255, -++159, -++131, -++255, -++0, -++232, -++0, -++4, -++0, -++0, -++255, -++159, -++142, -++255, -++4, -++255, -++48, -++204, -++16, -++3, -++224, -++251, -++62, -++0, -++5, -++255, -++51, -++204, -++128, -++3, -++224, -++251, -++16, -++0, -++77, -++254, -++51, -++204, -++9, -++4, -++224, -++251, -++0, -++0, -++128, -++64, -++6, -++232, -++64, -++0, -++0, -++0, -++140, -++248, -++47, -++0, -++0, -++0, -++224, -++99, -++0, -++0, -++4, -++254, -++0, -++144, -++128, -++2, -++0, -++8, -++2, -++0, -++32, -++247, -++240, -++207, -++16, -++3, -++32, -++247, -++176, -++207, -++17, -++3, -++32, -++247, -++112, -++207, -++18, -++3, -++32, -++247, -++48, -++207, -++19, -++3, -++32, -++247, -++240, -++206, -++20, -++3, -++32, -++247, -++176, -++206, -++21, -++3, -++32, -++247, -++112, -++206, -++22, -++3, -++32, -++247, -++48, -++206, -++23, -++3, -++32, -++247, -++240, -++205, -++24, -++3, -++32, -++247, -++176, -++205, -++25, -++3, -++32, -++247, -++112, -++205, -++26, -++3, -++32, -++247, -++48, -++205, -++27, -++3, -++32, -++247, -++240, -++204, -++28, -++3, -++32, -++247, -++176, -++204, -++29, -++3, -++32, -++247, -++112, -++204, -++30, -++3, -++32, -++247, -++48, -++204, -++31, -++3, -++5, -++255, -++51, -++204, -++128, -++3, -++224, -++251, -++16, -++0, -++77, -++254, -++51, -++204, -++9, -++4, -++224, -++251, -++0, -++0, -++0, -++237, -++0, -++4, -++0, -++0, -++140, -++248, -++47, -++0, -++0, -++0, -++224, -++99, -++0, -++0, -++90, -++0, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index 5e2728d..1e389c7 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -58,13 +58,6 @@ -+ # -+ # -+ -+-test_add: -+- vldh HX(0,0),(r0) -+- vadd HX(0,0),HX(0,0),10 -+- vsth HX(0,0),(r0) -+- mov r0,7 # return value -+- b lr -+- -+ # Columns are transformed first -+ # -+ # Store top left half of transMatrix2 in -+@@ -79,7 +72,7 @@ test_add: -+ # -+ -+ -+-# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) -++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) # TODO add size so we can branch to correct implementation (or perhaps have coeffs32 and num32 as secondary inputs!) -+ # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -+ # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+ # num: number of 16x16 transforms to be done -+@@ -87,17 +80,17 @@ test_add: -+ hevc_trans_16x16: -+ push r6-r15, lr # TODO cut down number of used registers -+ -+- mov r3, 2*32*2 # Twice Stride of transMatrix2 in bytes -+- vld HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -++ mov r3, 16*2 # Stride of transMatrix2 in bytes -++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -+ # Now use r0 to describe which matrix we are working on. -+ # Allows us to prefetch the next block of coefficients for efficiency. -+ mov r0,0 # This describes the location where we read our coefficients from -+- mov r3,16*2 # Stride of coefficients in bytes -++ mov r3,16*2 # Stride of coefficients in bytes (TODO remove) -+ mov r7,16*16*2 # Total block size -+ mov r8,64*16 # Value used to swap from current to next VRF location -+ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -+ mov r4,64 # Constant used for rounding first pass -+- mov r5,1<<19 # Constant used for rounding second pass -++ mov r5,1<<11 # Constant used for rounding second pass -+ -+ # At start of block r0,r1 point to the current block (that has already been loaded) -+ block_loop: -+@@ -113,12 +106,12 @@ block_loop: -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -+- vmov VX(0,0++), HX(0++,32) REP 16 # For simplicity transpose this back to the original position -++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # For simplicity transpose this back to the original position -+ -+ bl col_trans_16 -+- vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+- #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+- vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r5 REP 16 # Now add on rounding, shift down by 7, and saturate -++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # 4+12=16 so this ends up with the output saturated and in the top half of the word. -++ vasl HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # This should be saturating, but the instruction above does not assemble? (Probably because it ends with ls which is interpreted as a condition flag) -+ -+ # Save results - note there has been a transposition during the processing so we save columns -+ vsth VX(0,32++)+r0, (r1 += r3) REP 16 -+@@ -132,16 +125,136 @@ block_loop: -+ -+ # r1,r2,r3 r7,r8 should be preserved -+ # HX(0++,0)+r0 is the block to be transformed -+-# HX(32++,0) is the 16x16 matrix of transform coefficients -++# HX(32++,0)+r6 is the 16x16 matrix of transform coefficients -+ # Use HY(48,0) for intermediate results -+ # r0 can be used, but should be returned to its original value at the end -+ col_trans_16: -+- add r4,r0,16 # Final value for this loop -++ add r6,r0,16 # Final value for this loop -+ col_trans_16_loop: -+ # First compute partial products for a single column -+- vmul32s VY(48,0++), VX(0,0)+r0, VX(32,0++) REP 16 -++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+- addcmpblt r0,1,r4,col_trans_16_loop -++ addcmpblt r0,1,r6,col_trans_16_loop -+ sub r0,16 # but r0 back to its original value -+ b lr -++ -++col_trans_odd_16: -++ add r6,r0,16 # Final value for this loop -++col_trans_odd_16_loop: -++ # First compute partial products for a single column -++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -++ # Then sum up the results and place back -++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -++ addcmpblt r0,1,r6,col_trans_odd_16_loop -++ sub r0,16 # but r0 back to its original value -++ b lr -++ -++ -++test_add: -++ vldh HX(0,0),(r0) -++ vadd HX(0,0),HX(0,0),10 -++ vsth HX(0,0),(r0) -++ mov r0,7 # return value -++ b lr -++ -++# hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) Even followed by odd -++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -++# num: number of 16x16 transforms to be done -++# -++hevc_trans_32x32: -++ push r6-r15, lr # TODO cut down number of used registers -++ -++ # Fetch transform matrices -++ mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -++ add r0, 16*16*2 -++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -++ -++ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer -++ mov r7, 16*16*2 # Total block size -++ mov r4, 64 # Constant used for rounding first pass -++ mov r5, 1<<11 # Constant used for rounding second pass -++ sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) -++ # set r8 to 32byte aligned stack pointer -++ add r8,sp,31 -++ lsr r8,5 -++ lsl r8,5 -++ mov r9,r8 # Backup of the temporary storage -++ mov r10,r1 # Backup of the coefficient buffer -++block_loop32: -++ -++ # COLUMN TRANSFORM -++ # Transform the first 16 columns -++ mov r1,r10 # Input Coefficient buffer -++ mov r8,r9 # Output temporary storage -++ bl trans32 -++ # Transform the second 16 columns -++ add r8,32 -++ add r1,32 -++ bl trans32 -++ -++ # ROW TRANSFORM -++ mov r1,r9 # Input temporary storage -++ mov r8,r10 # Output Coefficient buffer -++ bl trans32 -++ # Transform the second 16 columns -++ add r8,32 -++ add r1,32 -++ bl trans32 -++ -++ add r10, 32*32*2 # move onto next block of coefficients -++ addcmpbgt r2,-1,0,block_loop32 -++ -++ add sp,sp,32*32*2+32 # Restore stack -++ -++ pop r6-r15, pc -++ -++trans32: -++ # We can no longer afford the VRF space to do prefetching when doing 32x32 -++ # Fetch the even rows -++ vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ # Fetch the odd rows -++ vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -++ -++ # Transform the even rows using even matrix -++ mov r0, 0 # Even rows -++ bl col_trans_16 -++ -++ # Now transform the odd rows using odd matrix -++ mov r0, 64*16 # Odd rows -++ bl col_trans_odd_16 -++ -++ # Now apply butterfly to compute the first 16 results -++ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -++ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -++ # 16bit results now in HX(48,32) -++ mov r0,r8 -++ mov r6,32*2 -++ vsth VX(48,32++),(r0+=r6) REP 16 -++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed -++ -++ # Now apply butterfly to compute the second 16 results (in reverse order) -++ vsub HY(63,0),HY(0,0),HY(16,0) -++ vsub HY(62,0),HY(0,0),HY(17,0) -++ vsub HY(61,0),HY(0,0),HY(18,0) -++ vsub HY(60,0),HY(0,0),HY(19,0) -++ vsub HY(59,0),HY(0,0),HY(20,0) -++ vsub HY(58,0),HY(0,0),HY(21,0) -++ vsub HY(57,0),HY(0,0),HY(22,0) -++ vsub HY(56,0),HY(0,0),HY(23,0) -++ vsub HY(55,0),HY(0,0),HY(24,0) -++ vsub HY(54,0),HY(0,0),HY(25,0) -++ vsub HY(53,0),HY(0,0),HY(26,0) -++ vsub HY(52,0),HY(0,0),HY(27,0) -++ vsub HY(51,0),HY(0,0),HY(28,0) -++ vsub HY(50,0),HY(0,0),HY(29,0) -++ vsub HY(49,0),HY(0,0),HY(30,0) -++ vsub HY(48,0),HY(0,0),HY(31,0) -++ vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -++ add r0,r8,16*32*2 # Move to 16th row -++ vsth VX(48,32++),(r0+=r6) REP 16 -++ b lr -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index b1f50ee..d720546 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -3,6 +3,7 @@ -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ #define RPI_USE_VCSM -+ #define RPI_TIME_TOTAL_QPU -++#define RPI_TIME_TOTAL_VPU -+ -+ #include -+ #include -+@@ -48,10 +49,47 @@ typedef int int32_t; -+ #define QPU_CODE_SIZE 2048 -+ #define VPU_CODE_SIZE 2048 -+ -++const short rpi_transMatrix2even[32][16] = { // Even rows first -++{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, -++{90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90}, -++{89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89}, -++{87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87}, -++{83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83}, -++{80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80}, -++{75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75}, -++{70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70}, -++{64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64}, -++{57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57}, -++{50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50}, -++{43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43}, -++{36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36}, -++{25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25}, -++{18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18}, -++{ 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9}, -++// Odd rows -++{90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4}, -++{90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13}, -++{88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22}, -++{85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31}, -++{82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38}, -++{78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46}, -++{73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54}, -++{67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61}, -++{61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67}, -++{54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73}, -++{46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78}, -++{38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82}, -++{31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85}, -++{22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88}, -++{13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90}, -++{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90} -++}; -++ -+ struct GPU -+ { -+ unsigned int qpu_code[QPU_CODE_SIZE]; -+ unsigned int vpu_code[VPU_CODE_SIZE]; -++ short transMatrix2even[16*16]; -+ int open_count; // Number of allocated video buffers -+ unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+@@ -123,6 +161,8 @@ static int gpu_init(volatile struct GPU **gpu) { -+ assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -++ // And the transform coefficients -++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); -+ -+ return 0; -+ } -+@@ -274,11 +314,43 @@ unsigned int vpu_get_fn(void) { -+ return gpu->vc + offsetof(struct GPU,vpu_code); -+ } -+ -++unsigned int vpu_get_constants(void) { -++ if (gpu==NULL) { -++ gpu_lock(); -++ gpu_unlock(); -++ } -++ return gpu->vc + offsetof(struct GPU,transMatrix2even); -++} -++ -+ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -+ { -+ unsigned r; -++#ifdef RPI_TIME_TOTAL_VPU -++ static int last_time=0; -++ static long long on_time=0; -++ static long long off_time=0; -++ int start_time; -++ int end_time; -++ static int count=0; -++ static long long countr2=0; -++#endif -+ gpu_lock(); -++#ifdef RPI_TIME_TOTAL_VPU -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -+ r = execute_code(gpu->mb, code, r0, r1, r2, r3, r4, r5); -++#ifdef RPI_TIME_TOTAL_VPU -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ countr2 += r2; -++ if ((count&0x7f)==0) -++ printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); -++#endif -+ gpu_unlock(); -+ return r; -+ } -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 4e3c35c..814fc3c 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -34,6 +34,7 @@ extern unsigned int qpu_get_fn(int num); -+ -+ // VPU specific functions -+ extern unsigned int vpu_get_fn(void); -++extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ -+ // Simple test of shader code -+-- -+2.7.4 -+ -+ -+From 4bb0a7ba6723650e74d63cec2123f76da4c3eb0e Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 5 May 2015 09:41:23 +0100 -+Subject: [PATCH 05/68] Fixed deblocking -+ -+--- -+ libavcodec/hevc.c | 20 +++++++++++++++++--- -+ 1 file changed, 17 insertions(+), 3 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 94ff709..391c57a 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2400,8 +2400,9 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- //gpu_cache_flush(&s->coeffs_buf[i]); -++ gpu_cache_flush(&s->coeffs_buf[i]); -+ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -++ gpu_cache_flush(&s->coeffs_buf[i]); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2440,6 +2441,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -++ int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; -+ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -+ #endif -+ -+@@ -2473,9 +2475,17 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- if (1 || x_ctb + ctb_size >= s->ps.sps->width) { // TODO watch out for deblocking! -++ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -++ int x; -++ // Transform all blocks -+ rpi_execute_transform(s); -++ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles -++ ff_hevc_hls_filters(s, x, y_ctb, ctb_size); -++ } -++ start_ctb_x = 0; -+ } -+ #endif -+ if (more_data < 0) { -+@@ -2486,6 +2496,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ ctb_addr_ts++; -+ ff_hevc_save_states(s, ctb_addr_ts); -++#ifdef RPI -++ if (s->enable_rpi) -++ continue; -++#endif -+ ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); -+ } -+ -+@@ -3289,7 +3303,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ if (!s->univ_pred_cmds) -+ goto fail; -+ for(i = 0; i < 4; i++) { -+- gpu_malloc_uncached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -++ gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -+ s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -+ if (!s->coeffs_buf_arm[i]) -+ goto fail; -+-- -+2.7.4 -+ -+ -+From 9079ef888e3d81a69f3c802ddc3c5134679e74a6 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 5 May 2015 11:32:30 +0100 -+Subject: [PATCH 06/68] Added 32x32 transform -+ -+--- -+ libavcodec/hevc.c | 8 +- -+ libavcodec/hevc_cabac.c | 4 +- -+ libavcodec/rpi_hevc_transform.h | 200 +++++++++++++++++----------------------- -+ libavcodec/rpi_hevc_transform.s | 102 ++++++++++---------- -+ libavcodec/rpi_qpu.c | 4 +- -+ 5 files changed, 148 insertions(+), 170 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 391c57a..0dde6f2 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2400,9 +2400,11 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- gpu_cache_flush(&s->coeffs_buf[i]); -+- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[i].vc, s->num_coeffs[i] >> 8, 0, 0, 0); -+- gpu_cache_flush(&s->coeffs_buf[i]); -++ gpu_cache_flush(&s->coeffs_buf[2]); -++ gpu_cache_flush(&s->coeffs_buf[3]); -++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); -++ gpu_cache_flush(&s->coeffs_buf[2]); -++ gpu_cache_flush(&s->coeffs_buf[3]); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index d1cba86..88aa959 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1031,7 +1031,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int vshift = s->ps.sps->vshift[c_idx]; -+ uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + -+ ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -+- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size==4; -++#ifdef RPI -++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; -++#endif -+ int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -+ uint8_t significant_coeff_group_flag[8][8] = {{0}}; -+ int explicit_rdpcm_flag = 0; -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index c0c279f..6d772d7 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -1,6 +1,10 @@ -+ unsigned char rpi_hevc_transform [] = { -+ 169, -+ 3, -++62, -++64, -++79, -++64, -+ 3, -+ 232, -+ 32, -+@@ -17,6 +21,22 @@ unsigned char rpi_hevc_transform [] = { -+ 248, -+ 0, -+ 0, -++64, -++232, -++0, -++2, -++0, -++0, -++12, -++248, -++0, -++168, -++0, -++0, -++192, -++248, -++0, -++0, -+ 0, -+ 96, -+ 3, -+@@ -79,7 +99,7 @@ unsigned char rpi_hevc_transform [] = { -+ 70, -+ 128, -+ 144, -+-39, -++40, -+ 0, -+ 4, -+ 255, -+@@ -113,7 +133,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 128, -+ 144, -+-22, -++23, -+ 0, -+ 4, -+ 255, -+@@ -153,6 +173,8 @@ unsigned char rpi_hevc_transform [] = { -+ 140, -+ 211, -+ 192, -++34, -++31, -+ 41, -+ 3, -+ 70, -+@@ -195,7 +217,7 @@ unsigned char rpi_hevc_transform [] = { -+ 255, -+ 36, -+ 204, -+-96, -++224, -+ 2, -+ 0, -+ 248, -+@@ -219,62 +241,10 @@ unsigned char rpi_hevc_transform [] = { -+ 103, -+ 90, -+ 0, -+-8, -+-240, -+-0, -+-128, -+-128, -+-3, -+-0, -+-247, -+-32, -+-128, -+-10, -+-4, -+-136, -+-240, -+-32, -+-0, -+-128, -+-3, -+-112, -+-96, -+-90, -+-0, -+-169, -+-3, -+-3, -+-232, -+-32, -+-0, -+-0, -+-0, -+-12, -+-248, -+-0, -+-136, -+-0, -+-0, -+-192, -+-248, -+-0, -+-0, -++225, -++64, -++242, -+ 64, -+-232, -+-0, -+-2, -+-0, -+-0, -+-12, -+-248, -+-0, -+-168, -+-0, -+-0, -+-192, -+-248, -+-0, -+-0, -+ 3, -+ 232, -+ 128, -+@@ -287,18 +257,6 @@ unsigned char rpi_hevc_transform [] = { -+ 2, -+ 0, -+ 0, -+-4, -+-232, -+-64, -+-0, -+-0, -+-0, -+-5, -+-232, -+-0, -+-8, -+-0, -+-0, -+ 57, -+ 239, -+ 224, -+@@ -317,18 +275,26 @@ unsigned char rpi_hevc_transform [] = { -+ 64, -+ 26, -+ 64, -++4, -++232, -++64, -++0, -++0, -++0, -++149, -++96, -+ 161, -+ 64, -+ 152, -+ 64, -+ 128, -+ 144, -+-31, -++35, -+ 0, -+ 72, -+ 232, -+-32, -+ 0, -++4, -+ 0, -+ 0, -+ 65, -+@@ -339,8 +305,16 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 128, -+ 144, -+-23, -++27, -++0, -++4, -++232, -++0, -++8, -+ 0, -++0, -++69, -++96, -+ 145, -+ 64, -+ 168, -+@@ -351,8 +325,8 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 72, -+ 232, -+-32, -+ 0, -++4, -+ 0, -+ 0, -+ 65, -+@@ -373,7 +347,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 242, -+ 140, -+-229, -++221, -+ 192, -+ 57, -+ 239, -+@@ -383,6 +357,8 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 41, -+ 3, -++239, -++3, -+ 12, -+ 248, -+ 0, -+@@ -390,7 +366,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 0, -+ 192, -+-8, -++248, -+ 4, -+ 0, -+ 12, -+@@ -400,14 +376,14 @@ unsigned char rpi_hevc_transform [] = { -+ 64, -+ 0, -+ 192, -+-8, -++248, -+ 4, -+ 0, -+ 0, -+ 96, -+ 255, -+ 159, -+-131, -++154, -+ 255, -+ 0, -+ 232, -+@@ -417,7 +393,7 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 255, -+ 159, -+-142, -++165, -+ 255, -+ 4, -+ 255, -+@@ -429,7 +405,7 @@ unsigned char rpi_hevc_transform [] = { -+ 251, -+ 62, -+ 0, -+-5, -++4, -+ 255, -+ 51, -+ 204, -+@@ -439,15 +415,15 @@ unsigned char rpi_hevc_transform [] = { -+ 251, -+ 16, -+ 0, -+-77, -++76, -+ 254, -+ 51, -+ 204, -+-9, -+-4, -++128, -++3, -+ 224, -+ 251, -+-0, -++20, -+ 0, -+ 128, -+ 64, -+@@ -467,16 +443,6 @@ unsigned char rpi_hevc_transform [] = { -+ 99, -+ 0, -+ 0, -+-4, -+-254, -+-0, -+-144, -+-128, -+-2, -+-0, -+-8, -+-2, -+-0, -+ 32, -+ 247, -+ 240, -+@@ -488,92 +454,92 @@ unsigned char rpi_hevc_transform [] = { -+ 176, -+ 207, -+ 17, -+-3, -++19, -+ 32, -+ 247, -+ 112, -+ 207, -+ 18, -+-3, -++35, -+ 32, -+ 247, -+ 48, -+ 207, -+ 19, -+-3, -++51, -+ 32, -+ 247, -+ 240, -+ 206, -+ 20, -+-3, -++67, -+ 32, -+ 247, -+ 176, -+ 206, -+ 21, -+-3, -++83, -+ 32, -+ 247, -+ 112, -+ 206, -+ 22, -+-3, -++99, -+ 32, -+ 247, -+ 48, -+ 206, -+ 23, -+-3, -++115, -+ 32, -+ 247, -+ 240, -+ 205, -+ 24, -+-3, -++131, -+ 32, -+ 247, -+ 176, -+ 205, -+ 25, -+-3, -++147, -+ 32, -+ 247, -+ 112, -+ 205, -+ 26, -+-3, -++163, -+ 32, -+ 247, -+ 48, -+ 205, -+ 27, -+-3, -++179, -+ 32, -+ 247, -+ 240, -+ 204, -+ 28, -+-3, -++195, -+ 32, -+ 247, -+ 176, -+ 204, -+ 29, -+-3, -++211, -+ 32, -+ 247, -+ 112, -+ 204, -+ 30, -+-3, -++227, -+ 32, -+ 247, -+ 48, -+ 204, -+ 31, -+-3, -+-5, -++243, -++4, -+ 255, -+ 51, -+ 204, -+@@ -583,20 +549,20 @@ unsigned char rpi_hevc_transform [] = { -+ 251, -+ 16, -+ 0, -+-77, -++76, -+ 254, -+ 51, -+ 204, -+-9, -+-4, -++128, -++3, -+ 224, -+ 251, -+-0, -++20, -+ 0, -+ 0, -+ 237, -++32, -+ 0, -+-4, -+ 0, -+ 0, -+ 140, -+@@ -609,6 +575,6 @@ unsigned char rpi_hevc_transform [] = { -+ 99, -+ 0, -+ 0, -+-90, -+-0, -++111, -++3, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index 1e389c7..afdb32a 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -76,12 +76,19 @@ -+ # transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -+ # coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+ # num: number of 16x16 transforms to be done -++# coeffs32 -++# num32: number of 32x32 transforms -+ # -+ hevc_trans_16x16: -+ push r6-r15, lr # TODO cut down number of used registers -+- -++ mov r14,r3 # coeffs32 -++ mov r15,r4 # num32 -+ mov r3, 16*2 # Stride of transMatrix2 in bytes -+ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -++ -++ add r0, 16*16*2 # For 32x32 transforms we also need this matrix -++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -++ -+ # Now use r0 to describe which matrix we are working on. -+ # Allows us to prefetch the next block of coefficients for efficiency. -+ mov r0,0 # This describes the location where we read our coefficients from -+@@ -121,6 +128,10 @@ block_loop: -+ add r1,r7 -+ -+ addcmpbgt r2,-1,0,block_loop -++ -++ # Now go and do any 32x32 transforms -++ b hevc_trans_32x32 -++ -+ pop r6-r15, pc -+ -+ # r1,r2,r3 r7,r8 should be preserved -+@@ -136,26 +147,18 @@ col_trans_16_loop: -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_16_loop -+- sub r0,16 # but r0 back to its original value -++ sub r0,16 # put r0 back to its original value -+ b lr -+ -+ col_trans_odd_16: -+ add r6,r0,16 # Final value for this loop -+ col_trans_odd_16_loop: -+ # First compute partial products for a single column -+- vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,32++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_odd_16_loop -+- sub r0,16 # but r0 back to its original value -+- b lr -+- -+- -+-test_add: -+- vldh HX(0,0),(r0) -+- vadd HX(0,0),HX(0,0),10 -+- vsth HX(0,0),(r0) -+- mov r0,7 # return value -++ sub r0,16 # put r0 back to its original value -+ b lr -+ -+ # hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -+@@ -164,18 +167,17 @@ test_add: -+ # num: number of 16x16 transforms to be done -+ # -+ hevc_trans_32x32: -+- push r6-r15, lr # TODO cut down number of used registers -++ mov r1,r14 # coeffs -++ mov r2,r15 # num -+ -+- # Fetch transform matrices -+- mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -+- vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -+- add r0, 16*16*2 -+- vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -++ # Fetch odd transform matrix -++ #mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -++ #vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -++ #add r0, 16*16*2 -++ #vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ -+ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer -+ mov r7, 16*16*2 # Total block size -+- mov r4, 64 # Constant used for rounding first pass -+- mov r5, 1<<11 # Constant used for rounding second pass -+ sub sp,sp,32*32*2+32 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) -+ # set r8 to 32byte aligned stack pointer -+ add r8,sp,31 -+@@ -186,21 +188,27 @@ hevc_trans_32x32: -+ block_loop32: -+ -+ # COLUMN TRANSFORM -++ mov r4, 64 # Constant used for rounding first pass -++ mov r5, 9 # left shift used for rounding first pass -++ -+ # Transform the first 16 columns -+ mov r1,r10 # Input Coefficient buffer -+ mov r8,r9 # Output temporary storage -+ bl trans32 -+ # Transform the second 16 columns -+- add r8,32 -++ add r8,32*16*2 -+ add r1,32 -+ bl trans32 -+ -+ # ROW TRANSFORM -++ mov r4, 1<<11 # Constant used for rounding second pass -++ mov r5, 4 # left shift used for rounding second pass -++ -+ mov r1,r9 # Input temporary storage -+ mov r8,r10 # Output Coefficient buffer -+ bl trans32 -+ # Transform the second 16 columns -+- add r8,32 -++ add r8,32*16*2 -+ add r1,32 -+ bl trans32 -+ -+@@ -212,11 +220,12 @@ block_loop32: -+ pop r6-r15, pc -+ -+ trans32: -++ push lr -+ # We can no longer afford the VRF space to do prefetching when doing 32x32 -+ # Fetch the even rows -+- vldh HX(0++,0)+r0,(r1 += r3) REP 16 -++ vldh HX(0++,0),(r1 += r3) REP 16 -+ # Fetch the odd rows -+- vldh HX(16++,0)+r0,64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -++ vldh HX(16++,0),64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -+ -+ # Transform the even rows using even matrix -+ mov r0, 0 # Even rows -+@@ -228,33 +237,32 @@ trans32: -+ -+ # Now apply butterfly to compute the first 16 results -+ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -+- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -+- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -+ # 16bit results now in HX(48,32) -+ mov r0,r8 -+ mov r6,32*2 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+- vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # Store transposed -+ -+ # Now apply butterfly to compute the second 16 results (in reverse order) -+- vsub HY(63,0),HY(0,0),HY(16,0) -+- vsub HY(62,0),HY(0,0),HY(17,0) -+- vsub HY(61,0),HY(0,0),HY(18,0) -+- vsub HY(60,0),HY(0,0),HY(19,0) -+- vsub HY(59,0),HY(0,0),HY(20,0) -+- vsub HY(58,0),HY(0,0),HY(21,0) -+- vsub HY(57,0),HY(0,0),HY(22,0) -+- vsub HY(56,0),HY(0,0),HY(23,0) -+- vsub HY(55,0),HY(0,0),HY(24,0) -+- vsub HY(54,0),HY(0,0),HY(25,0) -+- vsub HY(53,0),HY(0,0),HY(26,0) -+- vsub HY(52,0),HY(0,0),HY(27,0) -+- vsub HY(51,0),HY(0,0),HY(28,0) -+- vsub HY(50,0),HY(0,0),HY(29,0) -+- vsub HY(49,0),HY(0,0),HY(30,0) -+- vsub HY(48,0),HY(0,0),HY(31,0) -+- vadd HY(48++,0),HY(48++,0),r4 REP 32 # add on rounding, -+- vasl HY(48++,0),HY(48++,0),9 REP 32 # shift down by 7, and saturate -+- add r0,r8,16*32*2 # Move to 16th row -++ vsub HY(63,0),HY(0 ,0),HY(16,0) -++ vsub HY(62,0),HY(1 ,0),HY(17,0) -++ vsub HY(61,0),HY(2 ,0),HY(18,0) -++ vsub HY(60,0),HY(3 ,0),HY(19,0) -++ vsub HY(59,0),HY(4 ,0),HY(20,0) -++ vsub HY(58,0),HY(5 ,0),HY(21,0) -++ vsub HY(57,0),HY(6 ,0),HY(22,0) -++ vsub HY(56,0),HY(7 ,0),HY(23,0) -++ vsub HY(55,0),HY(8 ,0),HY(24,0) -++ vsub HY(54,0),HY(9 ,0),HY(25,0) -++ vsub HY(53,0),HY(10,0),HY(26,0) -++ vsub HY(52,0),HY(11,0),HY(27,0) -++ vsub HY(51,0),HY(12,0),HY(28,0) -++ vsub HY(50,0),HY(13,0),HY(29,0) -++ vsub HY(49,0),HY(14,0),HY(30,0) -++ vsub HY(48,0),HY(15,0),HY(31,0) -++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -++ add r0,r8,32 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+- b lr -++ pop pc -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index d720546..12ad5fb 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -89,7 +89,7 @@ struct GPU -+ { -+ unsigned int qpu_code[QPU_CODE_SIZE]; -+ unsigned int vpu_code[VPU_CODE_SIZE]; -+- short transMatrix2even[16*16]; -++ short transMatrix2even[16*16*2]; -+ int open_count; // Number of allocated video buffers -+ unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+@@ -162,7 +162,7 @@ static int gpu_init(volatile struct GPU **gpu) { -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -+ // And the transform coefficients -+- memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, 16*16*sizeof(short)); -++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); -+ -+ return 0; -+ } -+-- -+2.7.4 -+ -+ -+From 6c2ed6109c4dd5c8ab16bf16e0ae3be6ae166e50 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 5 May 2015 16:57:03 +0100 -+Subject: [PATCH 07/68] Clear coefficients in advance -+ -+--- -+ libavcodec/hevc.c | 129 ++++++++++++++++++++++++++++------------ -+ libavcodec/hevc.h | 6 +- -+ libavcodec/hevc_cabac.c | 7 ++- -+ libavcodec/rpi_hevc_transform.h | 50 ++++++++++++++++ -+ libavcodec/rpi_hevc_transform.s | 16 +++++ -+ 5 files changed, 168 insertions(+), 40 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 0dde6f2..1424007 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -43,6 +43,8 @@ -+ -+ #ifdef RPI -+ #include "rpi_qpu.h" -++// For some unknown reason, the code seems to crash if I do a late malloc -++#define EARLY_MALLOC -+ #endif -+ -+ // #define DISABLE_MC -+@@ -61,6 +63,20 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ /* free everything allocated by pic_arrays_init() */ -+ static void pic_arrays_free(HEVCContext *s) -+ { -++#ifdef RPI -++#ifdef EARLY_MALLOC -++#else -++ printf("pic_arrays_free\n"); -++ if (s->coeffs_buf_arm[0]) { -++ gpu_free(&s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = 0; -++ } -++ if (s->coeffs_buf_arm[2]) { -++ gpu_free(&s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = 0; -++ } -++#endif -++#endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+@@ -97,6 +113,28 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ int ctb_count = sps->ctb_width * sps->ctb_height; -+ int min_pu_size = sps->min_pu_width * sps->min_pu_height; -+ -++#ifdef RPI -++#ifdef EARLY_MALLOC -++#else -++ int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); -++ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -++ printf("pic_arrays_init\n"); -++ printf("Allocated %d\n",coefs_per_row); -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -++ if (!s->coeffs_buf_arm[0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -++ if (!s->coeffs_buf_arm[2]) -++ goto fail; -++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -++ printf("Done\n"); -++#endif -++#endif -++ -+ s->bs_width = (width >> 2) + 1; -+ s->bs_height = (height >> 2) + 1; -+ -+@@ -2400,11 +2438,10 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- gpu_cache_flush(&s->coeffs_buf[2]); -+- gpu_cache_flush(&s->coeffs_buf[3]); -+- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf[2].vc, s->num_coeffs[2] >> 8, s->coeffs_buf[3].vc, s->num_coeffs[3] >> 10, 0); -+- gpu_cache_flush(&s->coeffs_buf[2]); -+- gpu_cache_flush(&s->coeffs_buf[3]); -++ -++ gpu_cache_flush(&s->coeffs_buf_accelerated); -++ vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -++ //gpu_cache_flush(&s->coeffs_buf_accelerated); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2426,7 +2463,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ lc->na.cand_up_right = (cmd->na >> 0) & 1; -+ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -+ } else { -++ int trafo_size = 1 << cmd->size; -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -++ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -+ } -+ } -+ s->num_pred_cmds = 0; -+@@ -3235,10 +3274,18 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->unif_mv_cmds); -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+- for(i = 0; i < 4; i++) { -+- gpu_free(&s->coeffs_buf[i]); -++ -++#ifdef EARLY_MALLOC -++ if (s->coeffs_buf_arm[0]) { -++ gpu_free(&s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = 0; -++ } -++ if (s->coeffs_buf_arm[2]) { -++ gpu_free(&s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = 0; -+ } -+ #endif -++#endif -+ -+ for (i = 0; i < 3; i++) { -+ av_freep(&s->sao_pixel_buffer_h[i]); -+@@ -3281,6 +3328,16 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ return 0; -+ } -+ -++#ifdef RPI -++static av_cold void memclear16(int16_t *p, int n) -++{ -++ vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); -++ //int i; -++ //for(i=0;ipriv_data; -+@@ -3304,37 +3361,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+- for(i = 0; i < 4; i++) { -+- gpu_malloc_cached(sizeof(int16_t)*RPI_MAX_XFM_CMDS*16, &s->coeffs_buf[i]); // TODO slim this down and share across sizes -+- s->coeffs_buf_arm[i] = (int16_t*) s->coeffs_buf[i].arm; -+- if (!s->coeffs_buf_arm[i]) -+- goto fail; -+- } -+- s->enable_rpi = 0; -+ -+- // A little test program -+- /*{ -+- GPU_MEM_PTR_T p; -+- int err = gpu_malloc_cached(16, &p); -+- short *q = (short *)p.arm; -+- int i; -+- int r; -+- printf("Allocated memory %d ARM 0x%x, VC 0x%x, Code 0x%x\n",err,(int)p.arm,p.vc,(int)vpu_get_fn()); -+- printf("Allocated memory %d ARM 0x%x, VC 0x%x\n",err,(int)p.arm,p.vc); -+- printf("Preparing data %p\n",q); -+- for(i=0;i<16;i++) -+- q[i] = i; -+- printf("Flush cache\n"); -+- gpu_cache_flush(&p); -+- printf("Executing code\n"); -+- r = vpu_execute_code( vpu_get_fn(), p.vc, 0, 0, 0, 0, 0); -+- printf("Return value %d (",r); -+- for(i=0;i<16;i++) -+- printf("%d ",q[i]); -+- printf(")\n"); -+- gpu_free(&p); -+- goto fail; // Early out -+- }*/ -++ s->coeffs_buf_arm[0] = 0; -++ s->coeffs_buf_arm[2] = 0; -++ -++#ifdef EARLY_MALLOC -++ int coeffs_in_ctb = 64*64; -++ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -++ printf("Allocated %d\n",coefs_per_row); -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -++ if (!s->coeffs_buf_arm[0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -++ if (!s->coeffs_buf_arm[2]) -++ goto fail; -++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -++ printf("Done\n"); -++ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -++ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[2], coefs_per_row); -++ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -++#endif -++ -++ s->enable_rpi = 0; -+ -+ #endif -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 4167985..9a228f6 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -861,8 +861,12 @@ typedef struct HEVCContext { -+ HEVCMvCmd *unif_mv_cmds; -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+- GPU_MEM_PTR_T coeffs_buf[4]; -++ int buf_width; -++ GPU_MEM_PTR_T coeffs_buf_default; -++ GPU_MEM_PTR_T coeffs_buf_accelerated; -+ int16_t *coeffs_buf_arm[4]; -++ unsigned int coeffs_buf_vc[4]; -++ -+ int num_coeffs[4]; -+ int num_xfm_cmds; -+ int num_mv_cmds; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 88aa959..dbfee85 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1058,9 +1058,13 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ s->num_coeffs[0] += n; -+ } -+ } -++ // We now do the memset after transform_add while we know the data is cached. -++ //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++#else -++ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ #endif -+ -+- memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++ -+ -+ // Derive QP for dequant -+ if (!lc->cu.cu_transquant_bypass_flag) { -+@@ -1547,7 +1551,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ #ifdef RPI -+ if (s->enable_rpi) { -+ HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -+- //memcpy(coeffs2, coeffs, sizeof(int16_t) * trafo_size * trafo_size); // TODO -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+ cmd->buf = coeffs; -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index 6d772d7..4f13622 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -1,4 +1,10 @@ -+ unsigned char rpi_hevc_transform [] = { -++21, -++106, -++0, -++144, -++35, -++1, -+ 169, -+ 3, -+ 62, -+@@ -577,4 +583,48 @@ unsigned char rpi_hevc_transform [] = { -+ 0, -+ 111, -+ 3, -++4, -++254, -++0, -++128, -++0, -++4, -++0, -++248, -++0, -++0, -++2, -++232, -++32, -++0, -++0, -++0, -++140, -++248, -++32, -++0, -++0, -++0, -++224, -++35, -++0, -++0, -++64, -++232, -++0, -++2, -++0, -++0, -++193, -++232, -++0, -++1, -++0, -++0, -++1, -++106, -++116, -++30, -++90, -++0, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index afdb32a..fd159bc 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -78,8 +78,11 @@ -+ # num: number of 16x16 transforms to be done -+ # coeffs32 -+ # num32: number of 32x32 transforms -++# command 0 for transform, 1 for memclear16(int16_t *dst,num16) -+ # -+ hevc_trans_16x16: -++ cmp r5,1 -++ beq memclear16 -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+@@ -266,3 +269,16 @@ trans32: -+ add r0,r8,32 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+ pop pc -++ -++memclear16: -++ # r0 is address -++ # r1 is number of 16bits values to set to 0 (may overrun past end and clear more than specified) -++ vmov HX(0++,0),0 REP 16 -++ mov r2,32 -++loop: -++ vsth HX(0++,0),(r0+=r2) REP 16 -++ add r0,16*16*2 -++ sub r1,16*16 -++ cmp r1,0 -++ bgt loop -++ b lr -+-- -+2.7.4 -+ -+ -+From 48282c2fb55c0d9a72222f384c03c432f78a3016 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 09:56:43 +0100 -+Subject: [PATCH 08/68] Prepared inter offload -+ -+--- -+ libavcodec/hevc.c | 116 +++++++++++++++++++++++++++++++++++++++++++----- -+ libavcodec/hevc.h | 29 +++++++++++- -+ libavcodec/hevc_cabac.c | 5 ++- -+ 3 files changed, 137 insertions(+), 13 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 1424007..8215201 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -45,6 +45,8 @@ -+ #include "rpi_qpu.h" -+ // For some unknown reason, the code seems to crash if I do a late malloc -+ #define EARLY_MALLOC -++// Move Inter prediction into separate pass -++//#define RPI_INTER -+ #endif -+ -+ // #define DISABLE_MC -+@@ -1440,6 +1442,95 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) -+ * @param luma_offset additive offset applied to the luma prediction value -+ */ -+ -++#ifdef RPI_INTER -++#define RPI_REDIRECT(fn) rpi_ ## fn -++static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -++ AVFrame *ref, const Mv *mv, int x_off, int y_off, -++ int block_w, int block_h, int luma_weight, int luma_offset) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_LUMA_UNI; -++ cmd->dst = dst; -++ cmd->dststride = dststride; -++ cmd->src = ref->data[0]; -++ cmd->srcstride = ref->linesize[0]; -++ cmd->mv = *mv; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = luma_weight; -++ cmd->offset = luma_offset; -++} -++ -++static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -++ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -++ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_LUMA_BI; -++ cmd->dst = dst; -++ cmd->dststride = dststride; -++ cmd->src = ref->data[0]; -++ cmd->srcstride = ref->linesize[0]; -++ cmd->mv = *mv; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = luma_weight; -++ cmd->offset = luma_offset; -++ cmd->src1 = ref1->data[]; -++ cmd->srcstride1 = ref1->linesize[0]; -++ cmd->mv1 = *mv1; -++ cmd->ref_idx[0] = current_mv->ref_idx[0]; -++ cmd->ref_idx[1] = current_mv->ref_idx[1]; -++} -++ -++static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -++ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -++ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_CHROMA_UNI; -++ cmd->dst = dst0; -++ cmd->dststride = dststride; -++ cmd->src = src0; -++ cmd->srcstride = srcstride; -++ cmd->mv = current_mv->mv[reflist]; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = chroma_weight; -++ cmd->offset = chroma_offset; -++} -++ -++static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -++ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -++{ -++ HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -++ cmd->dst = dst0; -++ cmd->dststride = dststride; -++ cmd->src = ref0->data[cidx+1]; -++ cmd->srcstride = ref0->linesize[cidx+1]; -++ cmd->mv = current_mv->mv[reflist]; -++ cmd->x_off = x_off; -++ cmd->y_off = y_off; -++ cmd->block_w = block_w; -++ cmd->block_h = block_h; -++ cmd->weight = chroma_weight; -++ cmd->offset = chroma_offset; -++ cmd->src = ref1->data[cidx+1]; -++ cmd->srcstride1 = ref1->linesize[cidx+1]; -++ cmd->ref_idx[0] = current_mv->ref_idx[0]; -++ cmd->ref_idx[1] = current_mv->ref_idx[1]; -++} -++#else -++#define RPI_REDIRECT(fn) fn -++#endif -++ -+ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+@@ -1505,7 +1596,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ * @param mv1 motion vector1 (relative to block position) to get pixel data from -+ * @param current_mv current motion vector structure -+ */ -+- static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -++static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+ { -+@@ -1887,16 +1978,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- luma_mc_uni(s, dst0, s->frame->linesize[0], ref0->frame, -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l0[current_mv.ref_idx[0]], -+ s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -+- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -+ 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); -+- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], -+ 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1]); -+ } -+@@ -1906,17 +1997,17 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- luma_mc_uni(s, dst0, s->frame->linesize[0], ref1->frame, -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -+ ¤t_mv.mv[1], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l1[current_mv.ref_idx[1]], -+ s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -+- chroma_mc_uni(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -+ 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); -+ -+- chroma_mc_uni(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], -++ RPI_REDIRECT(chroma_mc_uni)(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], -+ 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1]); -+ } -+@@ -1926,15 +2017,15 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- luma_mc_bi(s, dst0, s->frame->linesize[0], ref0->frame, -++ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ ref1->frame, ¤t_mv.mv[1], ¤t_mv); -+ -+ if (s->ps.sps->chroma_format_idc) { -+- chroma_mc_bi(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -++ RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -+ x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); -+ -+- chroma_mc_bi(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, -++ RPI_REDIRECT(chroma_mc_bi)(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, -+ x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1); -+ } -+ } -+@@ -2465,7 +2556,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ } else { -+ int trafo_size = 1 << cmd->size; -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -++#ifdef RPI_PRECLEAR -+ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -++#endif -+ } -+ } -+ s->num_pred_cmds = 0; -+@@ -3381,6 +3474,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+ printf("Done\n"); -++#ifdef RPI_PRECLEAR -+ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+@@ -3389,6 +3483,8 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+ #endif -+ -++#endif -++ -+ s->enable_rpi = 0; -+ -+ #endif -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 9a228f6..1ac119a 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -803,14 +803,39 @@ typedef struct HEVCLocalContext { -+ // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+ #define RPI_MAX_WIDTH 2048 -+ -+-// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane -+-#define RPI_MAX_MV_CMDS (16*3*(RPI_MAX_WIDTH/4)) -++// Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -++#define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+ // Each block can have an intra prediction and a transform_add command -+ #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ -++#define RPI_CMD_LUMA_UNI 0 -++#define RPI_CMD_CHROMA_UNI 1 -++#define RPI_CMD_LUMA_BI 2 -++#define RPI_CMD_U_BI 3 -++#define RPI_CMD_V_BI 4 -++ -++// RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? -++// #define RPI_PRECLEAR -++ -+ // Command for inter prediction -+ typedef struct HEVCMvCmd { -++ int cmd; -++ uint8_t *dst; -++ ptrdiff_t dststride; -++ uint8_t *src; -++ ptrdiff_t srcstride; -++ Mv mv; -++ int x_off; -++ int y_off; -++ int block_w; -++ int block_h; -++ int weight; -++ int offset; -++ uint8_t *src1; -++ ptrdiff_t srcstride1; -++ Mv mv1; -++ int8_t ref_idx[2]; -+ } HEVCMvCmd; -+ -+ // Command for transform to process a block of coefficients -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index dbfee85..4f072be 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1059,7 +1059,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ } -+ // We now do the memset after transform_add while we know the data is cached. -+- //memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++ #ifdef RPI_PRECLEAR -++ #else -++ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -++ #endif -+ #else -+ memset(coeffs, 0, trafo_size * trafo_size * sizeof(int16_t)); -+ #endif -+-- -+2.7.4 -+ -+ -+From 25d3b4e876febe08302a01abd85d5009160ead3e Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 11:08:50 +0100 -+Subject: [PATCH 09/68] Inter prediction in separate pass -+ -+--- -+ libavcodec/hevc.c | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- -+ libavcodec/hevc.h | 2 +- -+ 2 files changed, 77 insertions(+), 18 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 8215201..b7bc6ad 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -46,7 +46,7 @@ -+ // For some unknown reason, the code seems to crash if I do a late malloc -+ #define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+-//#define RPI_INTER -++#define RPI_INTER -+ #endif -+ -+ // #define DISABLE_MC -+@@ -1448,7 +1448,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_LUMA_UNI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+@@ -1467,31 +1467,29 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_LUMA_BI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+- cmd->src = ref->data[0]; -+- cmd->srcstride = ref->linesize[0]; -+- cmd->mv = *mv; -++ cmd->src = ref0->data[0]; -++ cmd->srcstride = ref0->linesize[0]; -++ cmd->mv = *mv0; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+- cmd->weight = luma_weight; -+- cmd->offset = luma_offset; -+- cmd->src1 = ref1->data[]; -++ cmd->src1 = ref1->data[0]; -+ cmd->srcstride1 = ref1->linesize[0]; -+ cmd->mv1 = *mv1; -+ cmd->ref_idx[0] = current_mv->ref_idx[0]; -+ cmd->ref_idx[1] = current_mv->ref_idx[1]; -+ } -+ -+-static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -++static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_CHROMA_UNI; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+@@ -1506,27 +1504,27 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ cmd->offset = chroma_offset; -+ } -+ -+-static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -++static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -+ { -+- HEVCMvCmd *cmd = unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -+ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+ cmd->src = ref0->data[cidx+1]; -+ cmd->srcstride = ref0->linesize[cidx+1]; -+- cmd->mv = current_mv->mv[reflist]; -++ cmd->mv = current_mv->mv[0]; -++ cmd->mv1 = current_mv->mv[1]; -+ cmd->x_off = x_off; -+ cmd->y_off = y_off; -+ cmd->block_w = block_w; -+ cmd->block_h = block_h; -+- cmd->weight = chroma_weight; -+- cmd->offset = chroma_offset; -+- cmd->src = ref1->data[cidx+1]; -++ cmd->src1 = ref1->data[cidx+1]; -+ cmd->srcstride1 = ref1->linesize[cidx+1]; -+ cmd->ref_idx[0] = current_mv->ref_idx[0]; -+ cmd->ref_idx[1] = current_mv->ref_idx[1]; -+ } -++ -+ #else -+ #define RPI_REDIRECT(fn) fn -+ #endif -+@@ -2554,7 +2552,9 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ lc->na.cand_up_right = (cmd->na >> 0) & 1; -+ s->hpc.intra_pred[cmd->size - 2](s, cmd->x, cmd->y, cmd->c_idx); -+ } else { -++#ifdef RPI_PRECLEAR -+ int trafo_size = 1 << cmd->size; -++#endif -+ s->hevcdsp.transform_add[cmd->size-2](cmd->dst, cmd->buf, cmd->stride); -+ #ifdef RPI_PRECLEAR -+ memset(cmd->buf, 0, trafo_size * trafo_size * sizeof(int16_t)); // Clear coefficients here while they are in the cache -+@@ -2563,6 +2563,61 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ } -+ s->num_pred_cmds = 0; -+ } -++ -++static void rpi_execute_inter_cmds(HEVCContext *s) -++{ -++ HEVCMvCmd *cmd = s->unif_mv_cmds; -++ int n,cidx; -++ AVFrame myref; -++ AVFrame myref1; -++ struct MvField mymv; -++ if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { -++ printf("Overflow inter_cmds\n"); -++ exit(-1); -++ } -++ for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { -++ switch(cmd->cmd) { -++ case RPI_CMD_LUMA_UNI: -++ myref.data[0] = cmd->src; -++ myref.linesize[0] = cmd->srcstride; -++ luma_mc_uni(s, cmd->dst, cmd->dststride, &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, cmd->weight, cmd->offset); -++ break; -++ case RPI_CMD_LUMA_BI: -++ myref.data[0] = cmd->src; -++ myref.linesize[0] = cmd->srcstride; -++ myref1.data[0] = cmd->src1; -++ myref1.linesize[0] = cmd->srcstride1; -++ mymv.ref_idx[0] = cmd->ref_idx[0]; -++ mymv.ref_idx[1] = cmd->ref_idx[1]; -++ luma_mc_bi(s, cmd->dst, cmd->dststride, -++ &myref, &cmd->mv, cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, -++ &myref1, &cmd->mv1, &mymv); -++ break; -++ case RPI_CMD_CHROMA_UNI: -++ mymv.mv[0] = cmd->mv; -++ chroma_mc_uni(s, cmd->dst, -++ cmd->dststride, cmd->src, cmd->srcstride, 0, -++ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cmd->weight, cmd->offset); -++ break; -++ case RPI_CMD_CHROMA_BI: -++ case RPI_CMD_CHROMA_BI+1: -++ cidx = cmd->cmd - RPI_CMD_CHROMA_BI; -++ myref.data[cidx+1] = cmd->src; -++ myref.linesize[cidx+1] = cmd->srcstride; -++ myref1.data[cidx+1] = cmd->src1; -++ myref1.linesize[cidx+1] = cmd->srcstride1; -++ mymv.ref_idx[0] = cmd->ref_idx[0]; -++ mymv.ref_idx[1] = cmd->ref_idx[1]; -++ mymv.mv[0] = cmd->mv; -++ mymv.mv[1] = cmd->mv1; -++ chroma_mc_bi(s, cmd->dst, cmd->dststride, &myref, &myref1, -++ cmd->x_off, cmd->y_off, cmd->block_w, cmd->block_h, &mymv, cidx); -++ break; -++ } -++ } -++ s->num_mv_cmds = 0; -++} -++ -+ #endif -+ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+@@ -2611,6 +2666,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -++ // Perform inter prediction -++ rpi_execute_inter_cmds(s); -+ // Transform all blocks -+ rpi_execute_transform(s); -+ // Perform intra prediction and residual reconstruction -+@@ -3422,6 +3479,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ } -+ -+ #ifdef RPI -++#ifdef RPI_PRECLEAR -+ static av_cold void memclear16(int16_t *p, int n) -+ { -+ vpu_execute_code( vpu_get_fn(), p, n, 0, 0, 0, 1); -+@@ -3430,6 +3488,7 @@ static av_cold void memclear16(int16_t *p, int n) -+ // p[i] = 0; -+ } -+ #endif -++#endif -+ -+ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 1ac119a..a0eb71b 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -812,7 +812,7 @@ typedef struct HEVCLocalContext { -+ #define RPI_CMD_LUMA_UNI 0 -+ #define RPI_CMD_CHROMA_UNI 1 -+ #define RPI_CMD_LUMA_BI 2 -+-#define RPI_CMD_U_BI 3 -++#define RPI_CMD_CHROMA_BI 3 -+ #define RPI_CMD_V_BI 4 -+ -+ // RPI_PRECLEAR is not working yet - perhaps clearing on VPUs is flawed? -+-- -+2.7.4 -+ -+ -+From 8af0a0a036e4bb3883f144d0567bc527772dd65b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 13:03:50 +0100 -+Subject: [PATCH 10/68] Added VPU thread -+ -+--- -+ libavcodec/hevc.c | 11 +++-- -+ libavcodec/hevc.h | 1 + -+ libavcodec/rpi_qpu.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++-- -+ libavcodec/rpi_qpu.h | 2 + -+ 4 files changed, 133 insertions(+), 6 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index b7bc6ad..98dbd69 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2529,8 +2529,10 @@ static void rpi_execute_transform(HEVCContext *s) -+ -+ -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -+- vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -++ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -++ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); -++ //vpu_wait(s->vpu_id); -+ -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2666,10 +2668,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+- // Perform inter prediction -+- rpi_execute_inter_cmds(s); -+ // Transform all blocks -+ rpi_execute_transform(s); -++ // Perform inter prediction -++ rpi_execute_inter_cmds(s); -++ // Wait for transform completion -++ vpu_wait(s->vpu_id); -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+@@ -3426,6 +3430,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->univ_pred_cmds); -+ -+ #ifdef EARLY_MALLOC -++ printf("hevc_decode_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+ gpu_free(&s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = 0; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index a0eb71b..0d8dfe9 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -896,6 +896,7 @@ typedef struct HEVCContext { -+ int num_xfm_cmds; -+ int num_mv_cmds; -+ int num_pred_cmds; -++ int vpu_id; -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 12ad5fb..378dd74 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -1,9 +1,13 @@ -+ #ifdef RPI -+-// Use the vcsm device for shared memory -++// define RPI_USE_VCSM to use the vcsm device for shared memory -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ #define RPI_USE_VCSM -+-#define RPI_TIME_TOTAL_QPU -+-#define RPI_TIME_TOTAL_VPU -++// define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -++//#define RPI_TIME_TOTAL_QPU -++// define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -++//#define RPI_TIME_TOTAL_VPU -++// define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -++#define RPI_ASYNC -+ -+ #include -+ #include -+@@ -113,6 +117,19 @@ static unsigned int Microseconds(void) { -+ } -+ #endif -+ -++#ifdef RPI_ASYNC -++pthread_t vpu_thread; -++static void *vpu_start(void *arg); -++ -++#define MAXCMDS 128 -++static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; -++static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -++ -++static int vpu_cmds[MAXCMDS][8]; -++static volatile int vpu_async_tail=0; // Contains the number of posted jobs -++static volatile int vpu_async_head=0; -++#endif -++ -+ // Connect to QPU, returns 0 on success. -+ static int gpu_init(volatile struct GPU **gpu) { -+ int mb = mbox_open(); -+@@ -164,12 +181,27 @@ static int gpu_init(volatile struct GPU **gpu) { -+ // And the transform coefficients -+ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); -+ -++#ifdef RPI_ASYNC -++ { -++ int err; -++ vpu_async_tail = 0; -++ vpu_async_head = 0; -++ err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); -++ //printf("Created thread\n"); -++ if (err) { -++ printf("Failed to create vpu thread\n"); -++ return -4; -++ } -++ } -++#endif -++ -+ return 0; -+ } -+ -+ // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -+ static void gpu_lock(void) { -+ pthread_mutex_lock(&gpu_mutex); -++ -+ if (gpu==NULL) { -+ gpu_init(&gpu); -+ } -+@@ -264,6 +296,16 @@ static void gpu_term(void) -+ unsigned handle = gpu->vc_handle; -+ if (gpu==NULL) -+ return; -++ -++#ifdef RPI_ASYNC -++ { -++ void *res; -++ vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); -++ pthread_join(vpu_thread, &res); -++ } -++#endif -++ -++ -+ unmapmem((void*)gpu, sizeof(struct GPU)); -+ mem_unlock(mb, handle); -+ mem_free(mb, handle); -+@@ -322,6 +364,79 @@ unsigned int vpu_get_constants(void) { -+ return gpu->vc + offsetof(struct GPU,transMatrix2even); -+ } -+ -++#ifdef RPI_ASYNC -++ -++static void *vpu_start(void *arg) { -++ while(1) { -++ pthread_mutex_lock(&post_mutex); -++ while( vpu_async_tail - vpu_async_head <= 0) -++ { -++ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -++ pthread_cond_wait(&post_cond, &post_mutex); -++ } -++ int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -++ pthread_mutex_unlock(&post_mutex); -++ -++ if (p[6] == -1) { -++ break; // Last job -++ } -++ if (p[7]) { -++ GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -++ //gpu_cache_flush(buf); -++ } -++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ -++ pthread_mutex_lock(&post_mutex); -++ vpu_async_head++; -++ pthread_cond_broadcast(&post_cond); -++ pthread_mutex_unlock(&post_mutex); -++ } -++ -++ return NULL; -++} -++ -++// Post a command to the queue -++// Returns an id which we can use to wait for completion -++int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) -++{ -++ pthread_mutex_lock(&post_mutex); -++ { -++ int id = vpu_async_tail++; -++ int *p = vpu_cmds[id%MAXCMDS]; -++ int num = vpu_async_tail - vpu_async_head; -++ if (num>MAXCMDS) { -++ printf("Too many commands submitted\n"); -++ exit(-1); -++ } -++ p[0] = code; -++ p[1] = r0; -++ p[2] = r1; -++ p[3] = r2; -++ p[4] = r3; -++ p[5] = r4; -++ p[6] = r5; -++ p[7] = (int) buf; -++ if (num<=1) -++ pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake -++ pthread_mutex_unlock(&post_mutex); -++ return id; -++ } -++} -++ -++// Wait for completion of the given command -++void vpu_wait(int id) -++{ -++ pthread_mutex_lock(&post_mutex); -++ while( id + 1 - vpu_async_head > 0) -++ { -++ pthread_cond_wait(&post_cond, &post_mutex); -++ } -++ pthread_mutex_unlock(&post_mutex); -++} -++ -++#endif -++ -++ -+ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5) -+ { -+ unsigned r; -+@@ -334,7 +449,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, -+ static int count=0; -+ static long long countr2=0; -+ #endif -++#ifndef RPI_ASYNC -+ gpu_lock(); -++#endif -+ #ifdef RPI_TIME_TOTAL_VPU -+ start_time = Microseconds(); -+ if (last_time==0) -+@@ -351,7 +468,9 @@ unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, -+ if ((count&0x7f)==0) -+ printf("VPU %d %lld On=%dms, Off=%dms\n",count,countr2,(int)(on_time/1000),(int)(off_time/1000)); -+ #endif -++#ifndef RPI_ASYNC -+ gpu_unlock(); -++#endif -+ return r; -+ } -+ -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 814fc3c..3526fce 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -36,6 +36,8 @@ extern unsigned int qpu_get_fn(int num); -+ extern unsigned int vpu_get_fn(void); -+ extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -++extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -++extern void vpu_wait( int id); -+ -+ // Simple test of shader code -+ extern int rpi_test_shader(void); -+-- -+2.7.4 -+ -+ -+From 016d3db644e60fbe272bfcf1d7c3670c82422317 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 6 May 2015 15:03:37 +0100 -+Subject: [PATCH 11/68] Added different signal when tail moves -+ -+--- -+ libavcodec/rpi_qpu.c | 11 ++++++----- -+ 1 file changed, 6 insertions(+), 5 deletions(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 378dd74..d1c3e20 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -122,7 +122,8 @@ pthread_t vpu_thread; -+ static void *vpu_start(void *arg); -+ -+ #define MAXCMDS 128 -+-static pthread_cond_t post_cond = PTHREAD_COND_INITIALIZER; -++static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -++static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; -+ static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+ static int vpu_cmds[MAXCMDS][8]; -+@@ -372,7 +373,7 @@ static void *vpu_start(void *arg) { -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -+- pthread_cond_wait(&post_cond, &post_mutex); -++ pthread_cond_wait(&post_cond_tail, &post_mutex); -+ } -+ int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ pthread_mutex_unlock(&post_mutex); -+@@ -388,7 +389,7 @@ static void *vpu_start(void *arg) { -+ -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+- pthread_cond_broadcast(&post_cond); -++ pthread_cond_broadcast(&post_cond_head); -+ pthread_mutex_unlock(&post_mutex); -+ } -+ -+@@ -417,7 +418,7 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned -+ p[6] = r5; -+ p[7] = (int) buf; -+ if (num<=1) -+- pthread_cond_broadcast(&post_cond); // Otherwise the vpu thread must already be awake -++ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+ return id; -+ } -+@@ -429,7 +430,7 @@ void vpu_wait(int id) -+ pthread_mutex_lock(&post_mutex); -+ while( id + 1 - vpu_async_head > 0) -+ { -+- pthread_cond_wait(&post_cond, &post_mutex); -++ pthread_cond_wait(&post_cond_head, &post_mutex); -+ } -+ pthread_mutex_unlock(&post_mutex); -+ } -+-- -+2.7.4 -+ -+ -+From b04a72641253dc89fd1ec688035c3e2a946aa370 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 7 May 2015 08:57:11 +0100 -+Subject: [PATCH 12/68] Add option to test for gpu_idle -+ -+--- -+ libavcodec/hevc.c | 3 ++- -+ libavcodec/rpi_qpu.c | 18 ++++++++++++++++++ -+ 2 files changed, 20 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 98dbd69..2e269b6 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2527,7 +2527,6 @@ static void rpi_execute_transform(HEVCContext *s) -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -+ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+@@ -2669,6 +2668,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+ // Transform all blocks -++ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++ -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index d1c3e20..85f49db 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -199,6 +199,17 @@ static int gpu_init(volatile struct GPU **gpu) { -+ return 0; -+ } -+ -++// Returns 1 if the gpu is currently idle -++static int gpu_idle(void) -++{ -++ int ret = pthread_mutex_trylock(&gpu_mutex); -++ if (ret==0) { -++ pthread_mutex_unlock(&gpu_mutex); -++ return 1; -++ } -++ return 0; -++} -++ -+ // Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -+ static void gpu_lock(void) { -+ pthread_mutex_lock(&gpu_mutex); -+@@ -400,6 +411,13 @@ static void *vpu_start(void *arg) { -+ // Returns an id which we can use to wait for completion -+ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf) -+ { -++ // If the gpu is idle then just run the command immediately -++ // This works, but doesn't seem to give any benefit -++ // if (gpu_idle()) { -++ // vpu_execute_code( code, r0, r1, r2, r3, r4, r5); -++ // return -1; // TODO perhaps a wraparound bug here? -++ // } -++ -+ pthread_mutex_lock(&post_mutex); -+ { -+ int id = vpu_async_tail++; -+-- -+2.7.4 -+ -+ -+From e7b457e683d4ca92bf2677b69708fbfc3849847b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 7 May 2015 11:01:35 +0100 -+Subject: [PATCH 13/68] Added deblocking pass -+ -+--- -+ libavcodec/hevc.c | 33 +++++++++++++++++++++++++++------ -+ libavcodec/hevc.h | 7 ++++++- -+ libavcodec/hevc_filter.c | 6 +++++- -+ libavcodec/rpi_qpu.c | 2 +- -+ 4 files changed, 39 insertions(+), 9 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 2e269b6..29f8415 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2518,6 +2518,17 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ } -+ -+ #ifdef RPI -++static void rpi_execute_dblk_cmds(HEVCContext *s) -++{ -++ int n; -++ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -++ int (*p)[2] = s->dblk_cmds; -++ for(n = s->num_dblk_cmds; n>0 ;n--,p++) { -++ ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); -++ } -++ s->num_dblk_cmds = 0; -++} -++ -+ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -+@@ -2631,7 +2642,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -+- int start_ctb_x = (s->sh.slice_ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; -+ s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -+ #endif -+ -+@@ -2665,7 +2675,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ #ifdef RPI -+- if (s->enable_rpi && x_ctb + ctb_size >= s->ps.sps->width) { -++ if (s->enable_rpi) { -++ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -++ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -++ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+ int x; -+ // Transform all blocks -+ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+@@ -2678,10 +2691,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+- for(x = start_ctb_x; x <= x_ctb; x += ctb_size) { // TODO this will fail for tiles -+- ff_hevc_hls_filters(s, x, y_ctb, ctb_size); -+- } -+- start_ctb_x = 0; -++ rpi_execute_dblk_cmds(s); -++ } -+ } -+ #endif -+ if (more_data < 0) { -+@@ -2699,6 +2710,16 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size); -+ } -+ -++#ifdef RPI -++ if (s->enable_rpi && s->num_dblk_cmds) { -++ rpi_execute_transform(s); -++ rpi_execute_inter_cmds(s); -++ vpu_wait(s->vpu_id); -++ rpi_execute_pred_cmds(s); -++ rpi_execute_dblk_cmds(s); -++ } -++#endif -++ -+ if (x_ctb + ctb_size >= s->ps.sps->width && -+ y_ctb + ctb_size >= s->ps.sps->height) -+ ff_hevc_hls_filter(s, x_ctb, y_ctb, ctb_size); -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 0d8dfe9..990bd8c 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -808,6 +808,8 @@ typedef struct HEVCLocalContext { -+ #define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+ // Each block can have an intra prediction and a transform_add command -+ #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -++// Worst case is 16x16 CTUs -++#define RPI_MAX_DEBLOCK_CMDS (RPI_MAX_WIDTH*4/16) -+ -+ #define RPI_CMD_LUMA_UNI 0 -+ #define RPI_CMD_CHROMA_UNI 1 -+@@ -867,6 +869,9 @@ typedef struct HEVCPredCmd { -+ #endif -+ -+ typedef struct HEVCContext { -++#ifdef RPI -++ int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; -++#endif -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+ -+@@ -891,11 +896,11 @@ typedef struct HEVCContext { -+ GPU_MEM_PTR_T coeffs_buf_accelerated; -+ int16_t *coeffs_buf_arm[4]; -+ unsigned int coeffs_buf_vc[4]; -+- -+ int num_coeffs[4]; -+ int num_xfm_cmds; -+ int num_mv_cmds; -+ int num_pred_cmds; -++ int num_dblk_cmds; -+ int vpu_id; -+ #endif -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index e4c3da7..ea0af91 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -877,8 +877,12 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ if (s->threads_type & FF_THREAD_FRAME ) -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+- } else if (s->threads_type & FF_THREAD_FRAME && x_end) -++ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -++ int newh = y + ctb_size - 4; -++ //int currh = s->ref->tf.progress->data[0]; -++ //if (((y + ctb_size)&63)==0) -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++ } -+ } -+ -+ void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size) -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 85f49db..3b6dae7 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -105,7 +105,7 @@ struct GPU -+ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+ static volatile struct GPU* gpu = NULL; -+ -+-#ifdef RPI_TIME_TOTAL_QPU -++#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -+ static unsigned int Microseconds(void) { -+ struct timespec ts; -+ unsigned int x; -+-- -+2.7.4 -+ -+ -+From 7a443df9115f21b4428de378bd146dcdba3dd42a Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 7 May 2015 16:47:47 +0100 -+Subject: [PATCH 14/68] Added option to disable deblocking for non-ref frames -+ -+--- -+ libavcodec/hevc_filter.c | 10 ++++++++++ -+ 1 file changed, 10 insertions(+) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index ea0af91..2cdd621 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -25,6 +25,8 @@ -+ //#define DISABLE_SAO -+ //#define DISABLE_DEBLOCK -+ //#define DISABLE_STRENGTHS -++// define DISABLE_DEBLOCK_NONREF for a 6% speed boost (by skipping deblocking on unimportant frames) -++//#define DISABLE_DEBLOCK_NONREF -+ -+ #include "libavutil/common.h" -+ #include "libavutil/internal.h" -+@@ -504,6 +506,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->ps.sps->pcm.loop_filter_disable_flag) || -+ s->ps.pps->transquant_bypass_enable_flag; -+ -++#ifdef DISABLE_DEBLOCK_NONREF -++ if ( s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N ) -++ return; // Don't deblock non-reference frames -++#endif -+ #ifdef DISABLE_DEBLOCK -+ return; -+ #endif -+-- -+2.7.4 -+ -+ -+From 9606e160a582db64ccf981d971cdc258d8cc02f7 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 11 May 2015 10:00:27 +0100 -+Subject: [PATCH 15/68] Moved buffers to VPU memory -+ -+--- -+ libavcodec/hevc_filter.c | 17 +++++++++++++- -+ libavcodec/utils.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ -+ libavutil/buffer.c | 6 +++++ -+ libavutil/buffer.h | 3 +++ -+ 4 files changed, 84 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 2cdd621..e1b32d4 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -866,6 +866,13 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ #undef CB -+ #undef CR -+ -++#ifdef RPI_INTER_QPU -++static void flush_buffer(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ gpu_cache_flush(p); -++} -++#endif -++ -+ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ { -+ int x_end = x >= s->ps.sps->width - ctb_size; -+@@ -888,9 +895,17 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -+- int newh = y + ctb_size - 4; -++ //int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -++ if (!( s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N )) { -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++ } -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+ } -+diff --git a/libavcodec/utils.c b/libavcodec/utils.c -+index f7adb52..708526e 100644 -+--- a/libavcodec/utils.c -++++ b/libavcodec/utils.c -+@@ -26,6 +26,12 @@ -+ */ -+ -+ #include "config.h" -++ -++#ifdef RPI -++// Move video buffers to GPU memory -++#define RPI_GPU_BUFFERS -++#endif -++ -+ #include "libavutil/atomic.h" -+ #include "libavutil/attributes.h" -+ #include "libavutil/avassert.h" -+@@ -64,6 +70,10 @@ -+ #include "libavutil/ffversion.h" -+ const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; -+ -++#ifdef RPI_GPU_BUFFERS -++#include "rpi_qpu.h" -++#endif -++ -+ #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS -+ static int default_lockmgr_cb(void **arg, enum AVLockOp op) -+ { -+@@ -503,6 +513,47 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, -+ return ret; -+ } -+ -++#ifdef RPI_GPU_BUFFERS -++static void rpi_buffer_default_free(void *opaque, uint8_t *data) -++{ -++ GPU_MEM_PTR_T *p = opaque; -++ gpu_free(p); -++ av_free(p); -++} -++ -++static AVBufferRef *rpi_buffer_alloc(int size) -++{ -++ AVBufferRef *ret = NULL; -++ uint8_t *data = NULL; -++ GPU_MEM_PTR_T *p; -++ -++ static int total=0; -++ total+=size; -++ -++ p = av_malloc(sizeof *p); -++ if (!p) -++ return NULL; -++ -++ if (gpu_malloc_cached(size,p)<0) // Change this line to choose cached or uncached memory. The caching here refers to the ARM data cache. -++ return NULL; -++ -++ data = p->arm; -++ printf("Rpi alloc %d/%d ARM=%p VC=%x->%x\n",size,total,p->arm,p->vc,p->vc+size); -++ //memset(data, 64, size); -++ -++ if (!data) -++ return NULL; -++ -++ ret = av_buffer_create(data, size, rpi_buffer_default_free, p, 0); -++ if (!ret) { -++ gpu_free(p); -++ av_freep(&p); -++ } -++ -++ return ret; -++} -++#endif -++ -+ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) -+ { -+ FramePool *pool = avctx->internal->pool; -+@@ -550,6 +601,14 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) -+ av_buffer_pool_uninit(&pool->pools[i]); -+ pool->linesize[i] = linesize[i]; -+ if (size[i]) { -++#ifdef RPI_GPU_BUFFERS -++ if (avctx->codec_id == AV_CODEC_ID_HEVC) -++ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, -++ CONFIG_MEMORY_POISONING ? -++ NULL : -++ rpi_buffer_alloc); -++ else -++#endif -+ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, -+ CONFIG_MEMORY_POISONING ? -+ NULL : -+diff --git a/libavutil/buffer.c b/libavutil/buffer.c -+index 694e116..203ca7b 100644 -+--- a/libavutil/buffer.c -++++ b/libavutil/buffer.c -+@@ -425,3 +425,9 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) -+ -+ return ret; -+ } -++ -++// Return the opaque for the underlying frame (gives us a GPU_MEM_PTR_T) -++void *av_buffer_pool_opaque(AVBufferRef *ref) { -++ BufferPoolEntry *buf = av_buffer_get_opaque(ref); -++ return buf->opaque; -++} -+diff --git a/libavutil/buffer.h b/libavutil/buffer.h -+index 0c0ce12..82e0bc3 100644 -+--- a/libavutil/buffer.h -++++ b/libavutil/buffer.h -+@@ -283,6 +283,9 @@ void av_buffer_pool_uninit(AVBufferPool **pool); -+ */ -+ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); -+ -++// Return the opaque for the underlying frame -++void *av_buffer_pool_opaque(AVBufferRef *ref); -++ -+ /** -+ * @} -+ */ -+-- -+2.7.4 -+ -+ -+From f56515b9a720c829ba3ddf6da4232a91b13e0f03 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 11 May 2015 14:04:37 +0100 -+Subject: [PATCH 16/68] Prepared QPU execute code -+ -+--- -+ libavcodec/hevc.c | 227 ++++++++++++++++++++++++++++++++++++++++------- -+ libavcodec/hevc.h | 22 ++++- -+ libavcodec/hevc_filter.c | 7 +- -+ libavcodec/rpi_qpu.c | 55 +++++++++++- -+ libavcodec/rpi_qpu.h | 2 + -+ 5 files changed, 276 insertions(+), 37 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 29f8415..66ed37a 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -42,17 +42,45 @@ -+ #include "profiles.h" -+ -+ #ifdef RPI -+-#include "rpi_qpu.h" -+-// For some unknown reason, the code seems to crash if I do a late malloc -+-#define EARLY_MALLOC -+-// Move Inter prediction into separate pass -+-#define RPI_INTER -++ #include "rpi_qpu.h" -++ // For some unknown reason, the code seems to crash if I do a late malloc -++ #define EARLY_MALLOC -++ // Move Inter prediction into separate pass -++ #define RPI_INTER -+ #endif -+ -+ // #define DISABLE_MC -+ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -++ -++#ifdef RPI_INTER_QPU -++ -++#define RPI_CHROMA_COMMAND_WORDS 12 -++// The QPU code for UV blocks only works up to a block width of 8 -++#define RPI_CHROMA_BLOCK_WIDTH 8 -++ -++#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) -++ -++// TODO Chroma only needs 4 taps -++static uint32_t rpi_filter_coefs[8][2] = { -++ { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } -++}; -++ -++static uint32_t get_vc_address(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ return p->vc; -++} -++ -++#endif -++ -+ /** -+ * NOTE: Each function hls_foo correspond to the function foo in the -+ * specification (HLS stands for High Level Syntax). -+@@ -66,6 +94,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ static void pic_arrays_free(HEVCContext *s) -+ { -+ #ifdef RPI -++ -+ #ifdef EARLY_MALLOC -+ #else -+ printf("pic_arrays_free\n"); -+@@ -1982,6 +2011,43 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -++#ifdef RPI_INTER_QPU -++ if (s->enable_rpi) { -++ int reflist = 0; -++ int hshift = s->ps.sps->hshift[1]; -++ int vshift = s->ps.sps->vshift[1]; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -++ intptr_t _mx = mx << (1 - hshift); -++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -++ -++ int x1_c = x0_c + (mv->x >> (2 + hshift)); -++ int y1_c = y0_c + (mv->y >> (2 + hshift)); -++ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ -++ uint32_t *u = s->u_mvs[chan & 7]; -++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -++ *u++ = rpi_filter_coefs[_mx][0]; -++ *u++ = rpi_filter_coefs[_mx][1]; -++ *u++ = rpi_filter_coefs[_my][0]; -++ *u++ = rpi_filter_coefs[_my][1]; -++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ } -++ } -++ s->u_mvs[chan & 7] = u; -++ return; -++ } -++#endif -+ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], -+ 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); -+@@ -2632,6 +2698,54 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ -+ #endif -+ -++#ifdef RPI_INTER_QPU -++static void rpi_inter_clear(HEVCContext *s) -++{ -++ int i; -++ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -++ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -++ for(i=0;i<8;i++) { -++ s->u_mvs[i] = s->mvs_base[i]; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = pic_width; -++ *s->u_mvs[i]++ = pic_height; -++ *s->u_mvs[i]++ = s->frame->linesize[1]; -++ *s->u_mvs[i]++ = s->frame->linesize[2]; -++ s->u_mvs[i] += 3; // Padding words -++ } -++} -++ -++static void rpi_execute_inter_qpu(HEVCContext *s) -++{ -++ int k; -++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++ -++ if (s->sh.slice_type == I_SLICE) -++ return; -++ for(k=0;k<8;k++) { -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ } -++ -++ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ -++ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ ); -++} -++#endif -++ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ { -+ HEVCContext *s = avctxt->priv_data; -+@@ -2658,6 +2772,10 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ } -+ -++#ifdef RPI_INTER_QPU -++ rpi_inter_clear(s); -++#endif -++ -+ while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { -+ int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ -+@@ -2679,19 +2797,30 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+- int x; -++#ifdef RPI_INTER_QPU -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++#endif -+ // Transform all blocks -+ //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+- -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -++ -++ // Copy back reconstructed data -++ //memcpy(s->frame->data[0],s->dummy.arm,2048*64); -++ //memcpy(s->frame->data[1],s->dummy.arm,1024*32); -++ //memcpy(s->frame->data[2],s->dummy.arm,1024*32); -++ -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -++#ifdef RPI_INTER_QPU -++ rpi_inter_clear(s); -++#endif -+ } -+ } -+ #endif -+@@ -2712,6 +2841,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ -+ #ifdef RPI -+ if (s->enable_rpi && s->num_dblk_cmds) { -++#ifdef RPI_INTER_QPU -++ rpi_execute_inter_qpu(s); -++#endif -+ rpi_execute_transform(s); -+ rpi_execute_inter_cmds(s); -+ vpu_wait(s->vpu_id); -+@@ -3451,6 +3583,14 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+ -++#ifdef RPI_INTER_QPU -++ if (s->unif_mvs) { -++ gpu_free( &s->unif_mvs_ptr ); -++ s->unif_mvs = 0; -++ } -++#endif -++ //gpu_free(&s->dummy); -++ -+ #ifdef EARLY_MALLOC -+ printf("hevc_decode_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+@@ -3541,34 +3681,59 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ if (!s->univ_pred_cmds) -+ goto fail; -+ -+- s->coeffs_buf_arm[0] = 0; -+- s->coeffs_buf_arm[2] = 0; -++#ifdef RPI_INTER_QPU -++ // We divide the image into blocks 256 wide and 64 high -++ // We support up to 2048 widths -++ // We compute the number of chroma motion vector commands for 4:4:4 format and 4x4 chroma blocks - assuming all blocks are B predicted -++ // Also add space for the startup command for each stream. -++ -++ { -++ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -++ uint32_t *p; -++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ -++ // Set up initial locations for uniform streams -++ p = s->unif_mvs; -++ for(i = 0; i < 8; i++) { -++ s->mvs_base[i] = p; -++ p += uv_commands_per_qpu; -++ } -++ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -++ s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); -++ -++ } -++#endif -++ //gpu_malloc_uncached(2048*64,&s->dummy); -+ -+ #ifdef EARLY_MALLOC -+- int coeffs_in_ctb = 64*64; -+- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -+- printf("Allocated %d\n",coefs_per_row); -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+- if (!s->coeffs_buf_arm[0]) -+- goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+- if (!s->coeffs_buf_arm[2]) -+- goto fail; -+- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+- printf("Done\n"); -++ { -++ int coeffs_in_ctb = 64*64; -++ int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -++ s->coeffs_buf_arm[0] = 0; -++ s->coeffs_buf_arm[2] = 0; -++ printf("Allocated %d\n",coefs_per_row); -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -++ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -++ if (!s->coeffs_buf_arm[0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -++ s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -++ s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -++ if (!s->coeffs_buf_arm[2]) -++ goto fail; -++ s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -++ s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -++ printf("Done\n"); -+ #ifdef RPI_PRECLEAR -+- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[2], coefs_per_row); -+- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[3], coefs_per_row); -++ //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[0], coefs_per_row); -++ //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[2], coefs_per_row); -++ //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -++ memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+ #endif -+- -++ } -+ #endif -+ -+ s->enable_rpi = 0; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 990bd8c..da345f6 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -42,7 +42,11 @@ -+ -+ // define RPI to split the CABAC/prediction/transform into separate stages -+ #ifdef RPI -+-#include "rpi_qpu.h" -++ -++ #include "rpi_qpu.h" -++ // Use QPU for inter prediction -++ //#define RPI_INTER_QPU -++ -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -888,7 +892,7 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI -+ int enable_rpi; -+- HEVCMvCmd *unif_mv_cmds; -++ HEVCMvCmd *unif_mv_cmds; // TODO rename -+ HEVCXfmCmd *unif_xfm_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+ int buf_width; -+@@ -902,6 +906,20 @@ typedef struct HEVCContext { -+ int num_pred_cmds; -+ int num_dblk_cmds; -+ int vpu_id; -++ //GPU_MEM_PTR_T dummy; -++#ifdef RPI_INTER_QPU -++ GPU_MEM_PTR_T unif_mvs_ptr; -++ uint32_t *unif_mvs; // Base of memory for motion vector commands -++ -++ // _base pointers are to the start of the row -++ uint32_t *mvs_base[8]; -++ // these pointers are to the next free space -++ uint32_t *u_mvs[8]; -++ // Function pointers -++ uint32_t mc_filter_uv; -++ uint32_t mc_filter_uv_b; -++#endif -++ -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index e1b32d4..5b3d759 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -903,8 +903,11 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ //flush_buffer(s->frame->buf[1]); -++ //flush_buffer(s->frame->buf[2]); -++ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -++ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -++ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+ } -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 3b6dae7..e4dd58a 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -3,7 +3,7 @@ -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ #define RPI_USE_VCSM -+ // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+-//#define RPI_TIME_TOTAL_QPU -++#define RPI_TIME_TOTAL_QPU -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+ //#define RPI_TIME_TOTAL_VPU -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+@@ -30,7 +30,7 @@ -+ #endif -+ -+ // On Pi2 there is no way to access the VPU L2 cache -+-// GPU_MEM_FLG should be 4 for uncached memory. -++// GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -+ // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -+ // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -+ #define GPU_MEM_FLG 0xC -+@@ -549,6 +549,54 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un -+ gpu_unlock(); -+ } -+ -++// Run a program on 8 QPUs with the given code and uniform stream (given in GPU addresses) -++void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -++{ -++ int i; -++#ifdef RPI_TIME_TOTAL_QPU -++ static int last_time=0; -++ static long long on_time=0; -++ static long long off_time=0; -++ int start_time; -++ int end_time; -++ static int count=0; -++#endif -++ -++ gpu_lock(); -++#ifdef RPI_TIME_TOTAL_QPU -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -++ for(i=0;i<8;i++) { -++ gpu->mail[i*2 + 1] = code; -++ } -++ gpu->mail[0 ] = unifs1; -++ gpu->mail[2 ] = unifs2; -++ gpu->mail[4 ] = unifs3; -++ gpu->mail[6 ] = unifs4; -++ gpu->mail[8 ] = unifs5; -++ gpu->mail[10] = unifs6; -++ gpu->mail[12] = unifs7; -++ gpu->mail[14] = unifs8; -++ execute_qpu( -++ gpu->mb, -++ 8 /* Number of QPUs */, -++ gpu->vc + offsetof(struct GPU, mail), -++ 1 /* no flush */, // Don't flush VPU L1 cache -++ 5000 /* timeout ms */); -++#ifdef RPI_TIME_TOTAL_QPU -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ if ((count&0x7f)==0) -++ printf("On=%dms, Off=%dms\n",(int)(on_time/1000),(int)(off_time/1000)); -++#endif -++ gpu_unlock(); -++} -++ -+ unsigned int qpu_get_fn(int num) { -+ // Make sure that the gpu is initialized -+ unsigned int *fn; -+@@ -585,6 +633,9 @@ unsigned int qpu_get_fn(int num) { -+ case QPU_MC_FILTER_UV_B: -+ fn = mc_filter_uv_b; -+ break; -++ case QPU_MC_INTERRUPT_EXIT8: -++ fn = mc_interrupt_exit8; -++ break; -+ case QPU_MC_END: -+ fn = mc_end; -+ break; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 3526fce..2b22d98 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -16,6 +16,7 @@ extern void gpu_free(GPU_MEM_PTR_T *p); -+ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+ -+ // QPU specific functions -++extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -+ -+ enum { -+@@ -28,6 +29,7 @@ enum { -+ QPU_MC_SETUP_UV, -+ QPU_MC_FILTER_UV, -+ QPU_MC_FILTER_UV_B, -++ QPU_MC_INTERRUPT_EXIT8, -+ QPU_MC_END -+ }; -+ extern unsigned int qpu_get_fn(int num); -+-- -+2.7.4 -+ -+ -+From bd651e1569ebe0cdc41a6be169e139758cce069d Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 11:47:23 +0100 -+Subject: [PATCH 17/68] Drafted chroma interpolation on QPUs -+ -+--- -+ libavcodec/hevc.c | 5 ++- -+ libavcodec/hevc.h | 2 +- -+ libavcodec/hevc_filter.c | 6 ++- -+ libavcodec/rpi_qpu.c | 101 +++++++++++++++++++++++++++++++++++++++++++-- -+ libavcodec/rpi_qpu.h | 1 + -+ libavcodec/rpi_shader.c | 42 +++++++++---------- -+ libavcodec/rpi_shader.qasm | 42 +++++++++---------- -+ 7 files changed, 149 insertions(+), 50 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 66ed37a..d5ea45e 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -60,11 +60,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -+-#define ENCODE_COEFFS(c0, c1, c2, c3) (((-c0) & 0xff) | ((-c1) & 0xff) << 8 | ((-c2) & 0xff) << 16 | ((-c3) & 0xff) << 24) -++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ // TODO Chroma only needs 4 taps -+ static uint32_t rpi_filter_coefs[8][2] = { -+- { ENCODE_COEFFS( 0, 0, 0, 128), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -++ { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -+ { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -+@@ -2729,6 +2729,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index da345f6..2497c47 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -45,7 +45,7 @@ -+ -+ #include "rpi_qpu.h" -+ // Use QPU for inter prediction -+- //#define RPI_INTER_QPU -++ // #define RPI_INTER_QPU -+ -+ #endif -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 5b3d759..9b6e26d 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -903,8 +903,10 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+- //flush_buffer(s->frame->buf[1]); -+- //flush_buffer(s->frame->buf[2]); -++#ifdef RPI_INTER_QPU -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++#endif -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index e4dd58a..4d9eda8 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -33,7 +33,8 @@ -+ // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -+ // However, if using VCSM allocated buffers, need to use C at the moment because VCSM does not allocate uncached memory correctly -+ // The QPU crashes if we mix L2 cached and L2 uncached accesses due to a HW bug. -+-#define GPU_MEM_FLG 0xC -++#define GPU_MEM_FLG 0x4 -++// GPU_MEM_MAP is meaningless on the Pi2 and should be left at 0 (On Pi1 it allows ARM to access VPU L2 cache) -+ #define GPU_MEM_MAP 0x0 -+ -+ #define vcos_verify(x) ((x)>=0) -+@@ -165,6 +166,8 @@ static int gpu_init(volatile struct GPU **gpu) { -+ ptr->vc_handle = handle; -+ ptr->vc = vc; -+ -++ printf("GPU allocated at 0x%x\n",vc); -++ -+ *gpu = ptr; -+ -+ // Now copy over the QPU code into GPU memory -+@@ -304,10 +307,13 @@ int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -+ -+ static void gpu_term(void) -+ { -+- int mb = gpu->mb; -+- unsigned handle = gpu->vc_handle; -++ int mb; -++ unsigned handle; -++ -+ if (gpu==NULL) -+ return; -++ mb = gpu->mb; -++ handle = gpu->vc_handle; -+ -+ #ifdef RPI_ASYNC -+ { -+@@ -648,6 +654,95 @@ unsigned int qpu_get_fn(int num) { -+ } -+ -+ #if 0 -++typedef unsigned int uint32_t; -++ -++typedef struct mvs_s { -++ GPU_MEM_PTR_T unif_mvs_ptr; -++ uint32_t *unif_mvs; // Base of memory for motion vector commands -++ -++ // _base pointers are to the start of the row -++ uint32_t *mvs_base[8]; -++ // these pointers are to the next free space -++ uint32_t *u_mvs[8]; -++ -++} HEVCContext; -++ -++#define RPI_CHROMA_COMMAND_WORDS 12 -++ -++static void rpi_inter_clear(HEVCContext *s) -++{ -++ int i; -++ for(i=0;i<8;i++) { -++ s->u_mvs[i] = s->mvs_base[i]; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 0; -++ *s->u_mvs[i]++ = 128; // w -++ *s->u_mvs[i]++ = 128; // h -++ *s->u_mvs[i]++ = 128; // stride u -++ *s->u_mvs[i]++ = 128; // stride v -++ s->u_mvs[i] += 3; // Padding words -++ } -++} -++ -++static void rpi_execute_inter_qpu(HEVCContext *s) -++{ -++ int k; -++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++ -++ for(k=0;k<8;k++) { -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // dummy location for V -++ } -++ -++ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ -++ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ ); -++} -++ -++void rpi_test_qpu(void) -++{ -++ HEVCContext mvs; -++ HEVCContext *s = &mvs; -++ int i; -++ int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -++ uint32_t *p; -++ printf("Allocate memory\n"); -++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; -++ -++ // Set up initial locations for uniform streams -++ p = s->unif_mvs; -++ for(i = 0; i < 8; i++) { -++ s->mvs_base[i] = p; -++ p += uv_commands_per_qpu; -++ } -++ // Now run a simple program that should just quit immediately after a single texture fetch -++ rpi_inter_clear(s); -++ for(i=0;i<4;i++) { -++ printf("Launch QPUs\n"); -++ rpi_execute_inter_qpu(s); -++ printf("Done\n"); -++ } -++ printf("Free memory\n"); -++ gpu_free(&s->unif_mvs_ptr); -++ return; -++} -++#endif -++ -++#if 0 -+ -+ int32_t hcoeffs[] = {-4, 10, -21, 70, 90, -24, 11, -4}; -+ //int32_t hcoeffs[] = {1, 1, 1, 1, 1, 1, 1, 1}; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 2b22d98..f9ad333 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -18,6 +18,7 @@ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -+ // QPU specific functions -+ extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -++extern void rpi_test_qpu(void); -+ -+ enum { -+ QPU_MC_SETUP, -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 41cc2e1..d7ed297 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -152,23 +152,23 @@ unsigned int rpi_shader[] = { -+ /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+ /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+ /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000408] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00000410] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 -++/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+ /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000420] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ /* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000430] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ /* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000440] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ /* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000450] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ /* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000460] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ /* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000470] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ /* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000480] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+ /* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+ /* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+ /* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+@@ -179,20 +179,20 @@ unsigned int rpi_shader[] = { -+ /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+ /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+ /* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000004d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 -+ /* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x000004e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x000004f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x000004f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000500] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000508] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000510] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000518] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000520] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000528] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait -+ /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ /* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000540] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+ /* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+ /* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+ /* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 6851e83..02fdcb2 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -270,23 +270,23 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++mov r2, rb21 ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -++add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+@@ -302,23 +302,23 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ # apply horizontal filter -+ brr.anyn -, r:uvloop -+ max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -++asr r0, r0, 14 ; mov r1, ra21 -+ min.setf ra15, r0, rb22 -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -++nop ; mul24 r1, ra14, rb14 -++nop ; mul24 r0, ra13, rb13 -++add r1, r1, r0 ; mul24 r0, ra12, rb12 -++add r1, r1, r0 ; mul24 r0, ra11, rb11 -++add r1, r1, r0 ; mul24 r0, ra10, rb10 -++add r1, r1, r0 ; mul24 r0, ra9, rb9 -++add r1, r1, r0 ; mul24 r0, ra8, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb15 -++add.ifnn r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ brr.anyn -, r:uvloop -+-asr r1, r1, 15 -++asr r1, r1, 14 -+ min r1, r1, rb22 -+ max vpm, r1, 0 -+ -+-- -+2.7.4 -+ -+ -+From 61628063461ee5d891af6dbedfd495efcf464012 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 13:54:11 +0100 -+Subject: [PATCH 18/68] Fixed chroma inter prediction -+ -+--- -+ libavcodec/hevc.c | 8 +- -+ libavcodec/hevc.h | 2 +- -+ libavcodec/rpi_shader.c | 1170 ++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 22 +- -+ libavcodec/rpi_shader.qasm | 24 +- -+ 5 files changed, 617 insertions(+), 609 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index d5ea45e..d6d78ee 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -57,9 +57,11 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ #ifdef RPI_INTER_QPU -+ -+ #define RPI_CHROMA_COMMAND_WORDS 12 -++#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -++ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ // TODO Chroma only needs 4 taps -+@@ -2024,7 +2026,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ int chan = x0>>8; -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+@@ -2730,6 +2733,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -++ assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+@@ -3689,7 +3693,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ // Also add space for the startup command for each stream. -+ -+ { -+- int uv_commands_per_qpu = (1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS; -++ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; -+ uint32_t *p; -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -+ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 2497c47..d513579 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -45,7 +45,7 @@ -+ -+ #include "rpi_qpu.h" -+ // Use QPU for inter prediction -+- // #define RPI_INTER_QPU -++ #define RPI_INTER_QPU -+ -+ #endif -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index d7ed297..831633b 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -33,7 +33,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+ /* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+ /* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000058] */ 0x00000040, 0xe0020567, // mov ra21, 64 -++/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+ /* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+ /* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+ /* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+@@ -152,7 +152,7 @@ unsigned int rpi_shader[] = { -+ /* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+ /* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+ /* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x55015fc6, 0x100248a2, // mov r2, rb21 ; mul24 r2, r0, ra0 -++/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+ /* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ /* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+ /* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+@@ -178,9 +178,9 @@ unsigned int rpi_shader[] = { -+ /* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+ /* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+ /* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000004d8] */ 0x8f54e1f6, 0xd0024821, // asr r0, r0, 14 ; mov r1, ra21 -+-/* [0x000004e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ /* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+ /* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+ /* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+@@ -189,400 +189,400 @@ unsigned int rpi_shader[] = { -+ /* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+ /* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ /* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000528] */ 0x8c9f223f, 0x100a0867, // add.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+ /* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000538] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000540] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter -+-/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005b0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x000005b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005c0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x000005c8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005d0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x000005d8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005e0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x000005e8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x000005f0] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000600] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000610] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000618] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000620] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000708] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -+-/* [0x00000710] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000718] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000720] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000728] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -++/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :loop -+-/* [0x00000730] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000738] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000740] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000748] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000750] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000758] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000760] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000768] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000770] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000778] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000780] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000788] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000790] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000007a0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007b0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007c0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007d0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007e0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007f0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000800] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000848] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x00000850] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000858] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000860] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000868] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000870] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000878] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000880] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000888] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000890] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000898] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000008a0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x000008c0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008d0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000008d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -++/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // :fast_path -+-/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :fast_loop -+-/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000910] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+-/* [0x00000918] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+-/* [0x00000920] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000928] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -+-/* [0x00000930] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000938] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000940] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000948] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000950] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000958] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000960] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000968] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000970] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000978] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000980] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000988] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000990] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000998] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000009a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000009a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000009b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000009b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000009c8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x000009d0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000009d8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x000009e0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x000009e8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x000009f0] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x000009f8] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000a00] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000a08] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000a10] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000a18] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000a20] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000a28] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000a30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000a38] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x00000a40] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x00000a48] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a50] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a60] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -++/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -++/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -++/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -++/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_b -+-/* [0x00000a78] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000a80] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000a88] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000a90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000a98] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000aa0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000aa8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000ab0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000ab8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000ac0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000ac8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000ad0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000ad8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000ae0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000ae8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000af0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000af8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000b00] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000b08] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b10] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000b18] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000b20] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000b28] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000b30] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000b38] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000b40] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000b48] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000b50] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000b58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000b60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000b68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000b70] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00000b78] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000ba0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ba8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bb0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bb8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000bc0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bc8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bd0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bd8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000be0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000be8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bf0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bf8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000c00] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000c08] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c10] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :bloop -+-/* [0x00000c18] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000c20] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000c28] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000c30] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000c38] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000c40] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000c48] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000c50] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000c58] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000c60] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000c68] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c70] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000c78] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000c80] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000c88] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000c90] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000c98] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000ca0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000ca8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000cb0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000cb8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000cc0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000cc8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000cd0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000cd8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000ce0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000ce8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000cf0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000cf8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000d00] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000d08] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000d10] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000d18] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000d20] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000d28] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000d30] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000d38] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000d40] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000d48] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000d50] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000d58] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000d60] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000d68] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000d70] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000d78] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000d80] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000d88] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000d90] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000d98] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000da0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -+-/* [0x00000da8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000db0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x00000db8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000dc0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000dc8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00000dd0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x00000dd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000de0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000de8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000df0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -++/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -++/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_honly -+-/* [0x00000df8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000e00] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000e08] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000e10] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000e18] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000e20] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000e28] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000e30] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000e38] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000e40] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000e48] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000e50] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000e58] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000e60] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000e68] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000e70] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000e78] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e80] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e88] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e90] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000e98] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000ea0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000ea8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -+-/* [0x00000eb0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -+-/* [0x00000eb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000ec0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000ec8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000ed0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000ed8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000ef8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f00] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f08] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f10] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f20] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000f28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000f30] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -++/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -++/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -++/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -++/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -++/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -++/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -++/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -++/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -++/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :loop_honly -+-/* [0x00000f38] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f40] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000f48] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000f50] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f58] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000f60] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f68] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f70] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000f78] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000f80] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000f88] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000f90] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000f98] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fa0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000fa8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000fb0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000fb8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000fc0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000fc8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000fd0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000fd8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000fe0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000fe8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000ff0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000ff8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001000] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001008] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001010] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -+-/* [0x00001018] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -+-/* [0x00001020] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -+-/* [0x00001028] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -+-/* [0x00001030] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -+-/* [0x00001038] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -+-/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001048] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001050] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001058] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -++/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -++/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -++/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -++/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -++/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -++/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -++/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -++/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00001060] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001068] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00001070] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001078] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+ /* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001090] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001098] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000010a0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_exit1 -+-/* [0x000010a8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000010b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010b8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000010d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000010e0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit -+-/* [0x000010e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000010f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001110] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001118] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+@@ -592,225 +592,227 @@ unsigned int rpi_shader[] = { -+ /* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001168] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001170] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001178] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit4 -+-/* [0x00001180] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001188] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001190] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000011c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000011d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x000011d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000011e0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001200] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001208] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001240] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001248] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_setup_uv -+-/* [0x00001250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001258] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+-/* [0x00001260] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+-/* [0x00001268] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+-/* [0x00001270] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00001278] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+-/* [0x00001280] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00001288] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00001290] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00001298] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000012a0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x000012a8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x000012b0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x000012b8] */ 0x00000040, 0xe0020567, // mov ra21, 64 -+-/* [0x000012c0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x000012c8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x000012d0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x000012d8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x000012e0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x000012e8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x000012f0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000012f8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00001300] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00001308] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00001310] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00001318] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00001320] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00001328] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00001330] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00001338] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00001340] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00001348] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00001350] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00001358] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00001360] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00001368] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001370] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00001378] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00001380] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00001388] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00001390] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00001398] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000013a0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000013a8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x000013b0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x000013b8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x000013c0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000013c8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x000013d0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x000013d8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000013e0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000013e8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000013f0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000013f8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00001400] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00001408] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00001410] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x00001418] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001420] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x00001428] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00001430] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00001438] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001440] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif -++/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 -++/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+ /* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001450] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00001458] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001460] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00001468] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001470] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00001478] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00001480] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv_b -+-/* [0x00001488] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001490] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00001498] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000014a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000014a8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000014b0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000014b8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000014c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000014c8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000014d0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000014d8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000014e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000014e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000014f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000014f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00001500] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00001508] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001510] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001518] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001520] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001528] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00001530] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00001538] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00001540] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001548] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001550] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001558] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00001560] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00001568] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001570] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001578] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001580] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001588] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00001590] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001598] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015a0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015a8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000015b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000015d0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015d8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015e0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015e8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000015f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000015f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00001608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001610] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00001618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00001620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00001630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00001648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00001650] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00001658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001660] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00001668] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00001670] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00001678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00001680] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00001688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00001690] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00001698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000016a0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000016a8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000016b0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000016b8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000016c0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000016c8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000016d0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000016d8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000016e0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x000016e8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000016f0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000016f8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001700] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001708] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001710] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001718] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001720] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00001728] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00001730] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00001738] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00001740] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00001748] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00001750] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00001758] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00001760] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00001768] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00001770] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00001778] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00001780] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00001788] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00001790] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00001798] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000017a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000017a8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000017b0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000017b8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000017c0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000017c8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000017d0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000017d8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000017e0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000017e8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000017f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000017f8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001800] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00001808] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001810] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index db971f4..3464cdb 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,16 +5,16 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 146) -+-#define mc_filter (rpi_shader + 360) -+-#define mc_filter_b (rpi_shader + 670) -+-#define mc_filter_honly (rpi_shader + 894) -+-#define mc_exit (rpi_shader + 1048) -+-#define mc_exit1 (rpi_shader + 1066) -+-#define mc_interrupt_exit (rpi_shader + 1082) -+-#define mc_interrupt_exit4 (rpi_shader + 1120) -+-#define mc_interrupt_exit8 (rpi_shader + 1142) -+-#define mc_setup_uv (rpi_shader + 1172) -+-#define mc_filter_uv_b (rpi_shader + 1314) -+-#define mc_end (rpi_shader + 1542) -++#define mc_filter (rpi_shader + 364) -++#define mc_filter_b (rpi_shader + 674) -++#define mc_filter_honly (rpi_shader + 898) -++#define mc_exit (rpi_shader + 1052) -++#define mc_exit1 (rpi_shader + 1070) -++#define mc_interrupt_exit (rpi_shader + 1086) -++#define mc_interrupt_exit4 (rpi_shader + 1124) -++#define mc_interrupt_exit8 (rpi_shader + 1146) -++#define mc_setup_uv (rpi_shader + 1176) -++#define mc_filter_uv_b (rpi_shader + 1318) -++#define mc_end (rpi_shader + 1546) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 02fdcb2..4809e1d 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -21,7 +21,7 @@ -+ # rb19 next ra16 -+ # -+ # ra20 1 -+-# ra21 64 -++# ra21 32 -+ # ra22 256 -+ # ra23 8 -+ # -+@@ -97,7 +97,7 @@ add rb24, r1, r0 -+ # load constants -+ -+ mov ra20, 1 -+-mov ra21, 64 -++mov ra21, 32 -+ mov ra22, 256 -+ mov ra23, 8 -+ -+@@ -270,7 +270,7 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+-mov r2, rb21 ; mul24 r2, r0, ra0 -++nop ; mul24 r2, r0, ra0 -+ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+@@ -301,9 +301,9 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 14 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -++asr ra15, r0, 8 ; nop -++nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+ -+ # apply vertical filter and write to VPM -+ -+@@ -315,12 +315,14 @@ add r1, r1, r0 ; mul24 r0, ra10, rb10 -+ add r1, r1, r0 ; mul24 r0, ra9, rb9 -+ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-add.ifnn r1, r1, r0 ; mov -, vw_wait -++add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-brr.anyn -, r:uvloop -+ asr r1, r1, 14 -+-min r1, r1, rb22 -+-max vpm, r1, 0 -++add r1, r1, ra21 -++brr.anyn -, r:uvloop -++asr r1, r1, 6 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -+ -+ # DMA out for U -+ -+@@ -1161,7 +1163,7 @@ add rb24, r1, r0 -+ # load constants -+ -+ mov ra20, 1 -+-mov ra21, 64 -++mov ra21, 32 -+ mov ra22, 256 -+ mov ra23, 8 -+ -+-- -+2.7.4 -+ -+ -+From b7321192751956ed7deceeb3dabe22ccedb8e08d Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 14:37:32 +0100 -+Subject: [PATCH 19/68] Removed unused luma functions -+ -+--- -+ libavcodec/hevc.c | 4 +- -+ libavcodec/rpi_qpu.c | 32 +- -+ libavcodec/rpi_shader.c | 1097 +++++++++++++------------------------------- -+ libavcodec/rpi_shader.h | 19 +- -+ libavcodec/rpi_shader.qasm | 970 +++------------------------------------ -+ 5 files changed, 396 insertions(+), 1726 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index d6d78ee..31b8b2f 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2731,8 +2731,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ return; -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP); // Also need a dummy for V -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+ assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ } -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 4d9eda8..4e90cc1 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -172,7 +172,7 @@ static int gpu_init(volatile struct GPU **gpu) { -+ -+ // Now copy over the QPU code into GPU memory -+ { -+- int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP); -++ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); -+ assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -+ } -+@@ -612,24 +612,24 @@ unsigned int qpu_get_fn(int num) { -+ gpu_unlock(); -+ } -+ switch(num) { -+- case QPU_MC_SETUP: -+- fn = mc_setup; -+- break; -+- case QPU_MC_FILTER: -+- fn = mc_filter; -+- break; -++ //case QPU_MC_SETUP: -++ // fn = mc_setup; -++ // break; -++ //case QPU_MC_FILTER: -++ // fn = mc_filter; -++ // break; -+ case QPU_MC_EXIT: -+ fn = mc_exit; -+ break; -+- case QPU_MC_INTERRUPT_EXIT: -+- fn = mc_interrupt_exit; -+- break; -+- case QPU_MC_FILTER_B: -+- fn = mc_filter_b; -+- break; -+- case QPU_MC_FILTER_HONLY: -+- fn = mc_filter_honly; -+- break; -++ //case QPU_MC_INTERRUPT_EXIT: -++ // fn = mc_interrupt_exit; -++ // break; -++ //case QPU_MC_FILTER_B: -++ // fn = mc_filter_b; -++ // break; -++ //case QPU_MC_FILTER_HONLY: -++ // fn = mc_filter_honly; -++ // break; -+ case QPU_MC_SETUP_UV: -+ fn = mc_setup_uv; -+ break; -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 831633b..170e8ac 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -21,798 +21,331 @@ __declspec(align(8)) -+ __attribute__((aligned(8))) -+ #endif -+ unsigned int rpi_shader[] = { -+-// ::mc_setup -++// ::mc_setup_uv -+ /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+ /* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+ /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+ /* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+-/* [0x00000020] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00000028] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00000030] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00000038] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000040] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x00000048] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x00000050] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000058] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+-/* [0x00000060] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000068] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x00000070] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000078] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000d8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000e0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000000e8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000000f0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x000000f8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000100] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000108] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000110] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000118] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000120] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000128] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000130] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000138] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000140] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000148] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000150] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000158] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000160] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000168] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000170] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000178] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x00000180] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000188] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x00000190] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x00000198] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000001a0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -++/* [0x00000020] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000048] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -++/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -++/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 -++/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+ /* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001b0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x000001b8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x000001c0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+ /* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001d0] */ 0x4c9d00cf, 0x10024821, // add r0, r0, r3; mul24 r1, r1, rb_pitch -+-/* [0x000001d8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001e8] */ 0x949dc5c0, 0xd0025890, // and r2, r2, ~3; mov ra_x_base, r0 -+-/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000200] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000210] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000218] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000220] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000228] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000230] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000238] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000240] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000248] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000250] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000258] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000260] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000268] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000270] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000278] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000280] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000288] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000290] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000298] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002d0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002d8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000002e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000002f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000300] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000330] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000370] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000380] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000388] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000390] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000398] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000440] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000448] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000450] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000458] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000460] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000468] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000470] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000478] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000480] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000488] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000490] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000498] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000004a0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000004a8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004b0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004c0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004c8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004d0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004d8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000004e8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x000004f0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x000004f8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000500] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000508] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000510] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000518] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000520] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000528] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000530] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000538] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000540] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000548] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000550] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000558] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000560] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000568] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000570] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000578] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000580] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000588] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000590] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000598] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000005a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000005a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter -+-/* [0x000005b0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005b8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005c0] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x000005c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005d0] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005f0] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x000005f8] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000600] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000608] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000610] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000618] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000620] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000628] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000630] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000638] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000648] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000650] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000658] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000660] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000668] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000670] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000678] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000680] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000688] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000690] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000698] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000006a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006c0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000700] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000708] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000710] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000718] */ 0x000001d0, 0xf07809e7, // brr.anynn -, r:fast_path -+-/* [0x00000720] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000728] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000730] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000738] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :loop -+-/* [0x00000740] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000748] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000750] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000758] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000760] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000768] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000770] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000778] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000780] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000788] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000790] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000798] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x000007a0] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000007a8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000007b0] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007b8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007c0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007c8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007d0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007d8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007e0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007e8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007f0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007f8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000800] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000808] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000810] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000818] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000820] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000828] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000830] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000838] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000840] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000848] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000850] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000858] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x00000860] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000868] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000870] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000878] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000880] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000888] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000890] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000898] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x000008a0] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x000008a8] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000008b0] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008b8] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008c0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008c8] */ 0xfffffe58, 0xf06809e7, // brr.anyn -, r:loop -+-/* [0x000008d0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000008d8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008e0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000008e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000008f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000900] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// :fast_path -+-/* [0x00000908] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :fast_loop -+-/* [0x00000910] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000918] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000920] */ 0x95727d9b, 0x1004475f, // mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+-/* [0x00000928] */ 0x95690dbf, 0x10044623, // mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+-/* [0x00000930] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000938] */ 0x929de5e4, 0x100248a1, // min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 -+-/* [0x00000940] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000948] */ 0xec414c87, 0x10024e20, // add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000950] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000958] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000960] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000968] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000970] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000978] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000980] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000988] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000990] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000998] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x000009a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000009a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000009b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000009b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000009c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000009c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000009d8] */ 0xffffff18, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x000009e0] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x000009e8] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x000009f0] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x000009f8] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000a00] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000a08] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000a10] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000a18] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000a20] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000a28] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000a30] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000a38] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000a40] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000a48] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:fast_loop -+-/* [0x00000a50] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x00000a58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a68] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a70] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a78] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a80] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter_b -+-/* [0x00000a88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000a90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000a98] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000aa0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000aa8] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000ab0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000ab8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000ac0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000ac8] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000ad0] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000ad8] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000ae0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000ae8] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000af0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000af8] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000b00] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000b08] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000b10] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000b18] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b20] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000b28] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000b30] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000b38] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000b40] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000b48] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000b50] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000b58] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000b60] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000b68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000b70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000b78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000b80] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00000b88] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000b90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000b98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ba0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ba8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000bb0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bb8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bc0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bc8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000bd0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bd8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000be0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000be8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000bf0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000bf8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000c00] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000c08] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000c10] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000c18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c20] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :bloop -+-/* [0x00000c28] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000c30] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000c38] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000c40] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000c48] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000c50] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000c58] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000c60] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000c68] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000c70] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000c78] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000c80] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000c88] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000c90] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000c98] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000ca0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000ca8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000cb0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000cb8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000cc0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000cc8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000cd0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000cd8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000ce0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000ce8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000cf0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000cf8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x00000d00] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000d08] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000d10] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000d18] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000d20] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000d28] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000d30] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000d38] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000d40] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000d48] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000d50] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000d58] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000d60] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000d68] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000d70] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000d78] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000d80] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000d88] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000d90] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000d98] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000da0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000da8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000db0] */ 0x8fc8f3f6, 0xd0020867, // asr r1, r1, 15 ; mov -, vr_wait -+-/* [0x00000db8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000dc0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x00000dc8] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:bloop -+-/* [0x00000dd0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000dd8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00000de0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x00000de8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000df0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000df8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000e00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter_honly -+-/* [0x00000e08] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000e10] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000e18] */ 0x156e7d80, 0x10020667, // mov ra_x2shift, ra_x2shift_next -+-/* [0x00000e20] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000e28] */ 0x0c9c81c0, 0xd00208a7, // add r2, r0, 8 -+-/* [0x00000e30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000e38] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3,unif -+-/* [0x00000e40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000e48] */ 0x139c05c0, 0xd00208a7, // max r2, r2, 0 -+-/* [0x00000e50] */ 0x129d95c0, 0x100208a7, // min r2, r2, rb_frame_width_minus_1 -+-/* [0x00000e58] */ 0x119c35c0, 0xd00206e7, // shl ra_x2shift_next, r2, 3 -+-/* [0x00000e60] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000e68] */ 0x0c9e74c0, 0x100208a7, // add r2, r2, r3 -+-/* [0x00000e70] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000e78] */ 0x149dc5c0, 0xd00206a7, // and ra_x2_base_next, r2, ~3 -+-/* [0x00000e80] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000e88] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e90] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e98] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000ea0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000ea8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000eb0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000eb8] */ 0x0c9de1c0, 0xd0021467, // add rb17, r0, -2 -+-/* [0x00000ec0] */ 0x919c71c0, 0xd0024812, // shl r0, r0, 7 ; mov rb18,r0 -+-/* [0x00000ec8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000ed0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000ed8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000ee0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000ee8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f00] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000f08] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f10] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f18] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f20] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f30] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000f38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :loop_honly -+-/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f50] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f68] */ 0xee654987, 0x10024860, // shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 -+-/* [0x00000f70] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f78] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f80] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000f88] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000f90] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000f98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000fa0] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000fa8] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fb0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000fb8] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000fc0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000fc8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000fd0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000fd8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000fe0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000fe8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000ff0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000ff8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001000] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001008] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001010] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001018] */ 0x8d9df4ff, 0x10024823, // sub r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001020] */ 0x8d5927f6, 0x100269e1, // sub.setf -, r3, rb18 ; mov r1, ra22 -+-/* [0x00001028] */ 0x559f2fc1, 0x100049e0, // mov -, vw_wait ; mul24 r0, r0, r1 -+-/* [0x00001030] */ 0xfffffef8, 0xf06809e7, // brr.anyn -, r:loop_honly -+-/* [0x00001038] */ 0x0f9cf1c0, 0xd0020827, // asr r0, r0, 15 -+-/* [0x00001040] */ 0x129d61c0, 0x10020827, // min r0, r0, rb22 -+-/* [0x00001048] */ 0x139c01c0, 0xd0020c27, // max vpm, r0, 0 -+-/* [0x00001050] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001058] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001060] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001068] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_exit -+-/* [0x00001070] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001078] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00001080] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001088] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001090] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001098] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010a0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000010a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000010b0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_exit1 -+-/* [0x000010b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000010c0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010c8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010d0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010d8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000010e0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000010e8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000010f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit -+-/* [0x000010f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001100] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001108] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001110] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001118] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001120] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001128] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001130] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001138] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001140] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001148] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001150] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001158] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001160] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001168] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001170] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001178] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001180] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001188] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit4 -+-/* [0x00001190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001198] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011b0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000011d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000011d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000011e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit8 -+-/* [0x000011e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000011f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000011f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001200] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001208] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001210] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001218] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001220] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001228] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001230] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001238] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001240] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001248] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00001250] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00001258] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_setup_uv -+-/* [0x00001260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001268] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -+-/* [0x00001270] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+-/* [0x00001278] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -+-/* [0x00001280] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00001288] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -+-/* [0x00001290] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00001298] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x000012a0] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x000012a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000012b0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x000012b8] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x000012c0] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x000012c8] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+-/* [0x000012d0] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x000012d8] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x000012e0] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x000012e8] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x000012f0] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x000012f8] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00001300] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00001308] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00001310] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00001318] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00001320] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00001328] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00001330] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00001338] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00001340] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00001348] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00001350] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00001358] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00001360] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00001368] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00001370] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00001378] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001380] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00001388] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00001390] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00001398] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000013a0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000013a8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000013b0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000013b8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x000013c0] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x000013c8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x000013d0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000013d8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x000013e0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x000013e8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000013f0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000013f8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x00001400] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x00001408] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00001410] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00001418] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00001420] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x00001428] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001430] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x00001438] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00001440] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00001448] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001450] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001458] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001460] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00001468] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00001470] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00001478] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001480] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00001488] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00001490] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00001498] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000014a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000014a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000014b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000014b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000014c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000014c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000014d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000014d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000014e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000014e8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000014f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000014f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00001500] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001508] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00001510] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00001518] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001520] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001528] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001530] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001538] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00001540] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00001548] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00001550] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001558] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001560] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001568] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -+-/* [0x00001570] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00001578] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001580] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001588] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001590] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001598] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000015a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015a8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015b8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000015c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015d8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000015e0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015e8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015f0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000015f8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00001600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00001608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00001618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00001628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00001630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00001640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00001658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00001660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00001668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001670] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00001678] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00001680] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00001688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00001690] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00001698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000016a0] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000016a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000016b0] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000016b8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000016c0] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000016c8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000016d0] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000016d8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000016e0] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000016e8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000016f0] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -+-/* [0x000016f8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00001700] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00001708] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001710] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001718] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001720] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001728] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001730] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00001738] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00001740] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00001748] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00001750] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00001758] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00001760] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00001768] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00001770] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00001778] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00001780] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00001788] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00001790] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00001798] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-/* [0x000017a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000017a8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000017b0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000017b8] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000017c0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000017c8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000017d0] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000017d8] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000017e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000017e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000017f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000017f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00001800] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001808] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001810] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00001818] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001820] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -++/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -++/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -++/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -++/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -++/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -++/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -++/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_exit -++/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit8 -++/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 3464cdb..9de4535 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -3,18 +3,11 @@ -+ -+ extern unsigned int rpi_shader[]; -+ -+-#define mc_setup (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 146) -+-#define mc_filter (rpi_shader + 364) -+-#define mc_filter_b (rpi_shader + 674) -+-#define mc_filter_honly (rpi_shader + 898) -+-#define mc_exit (rpi_shader + 1052) -+-#define mc_exit1 (rpi_shader + 1070) -+-#define mc_interrupt_exit (rpi_shader + 1086) -+-#define mc_interrupt_exit4 (rpi_shader + 1124) -+-#define mc_interrupt_exit8 (rpi_shader + 1146) -+-#define mc_setup_uv (rpi_shader + 1176) -+-#define mc_filter_uv_b (rpi_shader + 1318) -+-#define mc_end (rpi_shader + 1546) -++#define mc_setup_uv (rpi_shader + 0) -++#define mc_filter_uv (rpi_shader + 142) -++#define mc_filter_uv_b (rpi_shader + 360) -++#define mc_exit (rpi_shader + 588) -++#define mc_interrupt_exit8 (rpi_shader + 606) -++#define mc_end (rpi_shader + 636) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 4809e1d..cd7346d 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -71,8 +71,10 @@ -+ -+ .set rb_const_64, rb21 -+ -+-# mc_setup(next_kernel, x, y, ref_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1) -+-::mc_setup -++ -++################################################################################ -++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -++::mc_setup_uv -+ -+ # Read starting kernel -+ mov ra31, unif -+@@ -80,7 +82,9 @@ mov ra31, unif -+ # Load first request location -+ add ra_x_base, unif, elem_num # Store x -+ mov ra_y, unif # Store y -+-mov ra_x2_base, unif # Store frame base -++mov ra_x2_base, unif # Store frame u base -++nop -++sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -+ -+ # Read image dimensions -+ sub rb25,unif,1 -+@@ -143,29 +147,24 @@ mov r1, vpm_setup(0, 4, h8p(0, 0)) -+ add rb28, r0, r1 -+ -+ # Compute base address for first and second access -+-#add r0, unif, elem_num # x -+ mov r0, ra_x_base # Load x -+-add r2, r0, 8 # x+8 -+ max r0, r0, 0; mov r1, ra_y # Load y -+ min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+-shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -++shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+ add ra_y, r1, 1 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -+-max r1, r1, 0 # y -+-min r1, r1, rb_frame_height_minus_1 -+-add r0, r0, r3; mul24 r1, r1, rb_pitch -+-add r2, r2, r3 -++add r0, r0, r3 -+ and r0, r0, ~3 -+-and r2, r2, ~3; mov ra_x_base, r0 -++max r1, r1, 0 ; mov ra_x_base, r0 # y -++min r1, r1, rb_frame_height_minus_1 -+ # submit texture requests for first line -++add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ add t0s, r0, r1 ; mov ra_x2_base, r2 -+ add t0s, r2, r1 -+ -+ # Dump padding words -+ mov r0, unif -+ mov r0, unif -++mov r0, unif -+ -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+@@ -176,6 +175,8 @@ nop ; mul24 r1, r1, rb_pitch -+ add t0s, r1, ra_x_base -+ add t0s, r1, ra_x2_base -+ -++ -++ -+ ################################################################################ -+ -+ # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+@@ -341,453 +342,26 @@ add vw_setup, rb26, r0 # VDW setup 0 -+ mov vw_setup, rb29 # Stride -+ mov vw_addr, unif # start the VDW -+ -+-################################################################################ -+- -+- -+-# mc_filter(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+- -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -+-::mc_filter -+-mov ra31, unif -+- -+-# per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+-mov ra_x2shift, ra_x2shift_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # x -+-add r2, r0, 8 # x+8 -+-max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+-shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -+-add r0, r0, r3 -+-add r2, r2, r3 -+-and rb_x_base_next, r0, ~3 -+-and ra_x2_base_next, r2, ~3 -+-mov ra_y_next, r1 -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+-# get filter coefficients -+- -+-mov r0, unif -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-brr.anynn -, r:fast_path -+-asr rb12, r0, rb23 # delay slot 1 -+- -+-# r2 is elem_num -+-# r3 is loop counter -+- -+-mov r5rep, -8 # delay slot 2 -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -+- -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-## sub r2, r2, r3 ; ldtmu0 -+-## -+-## mov r0, ra22 -+-## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # apply horizontal filter -+-## -+-## asr r2, r2, 15 ; mul24 r3, r0, ra0 -+-## min r2, r2, rb22 -+-## max ra13, r2, 0 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra14, r0, 0 -+-## -+-## -+-## -+-## -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra15, r0, 0 -+- -+- -+- -+- -+-mov r3, 0 -+- -+-:loop -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 8 ; mov r1, ra22 -+- -+-# apply horizontal filter -+-brr.anyn -, r:loop -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-brr.anyn -, r:loop -+-asr r1, r1, 15 -+-min r1, r1, rb22 -+-max vpm, r1, 0 -+- -+-# DMA out -+- -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -+-mov vw_addr, unif # start the VDW -+- -+-#################################################### -+- -+-:fast_path -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## sub r2, r2, r3 ; ldtmu0 -+-## -+-## mov r0, ra22 -+-## shr r0, r4, ra17 ; mul24 r2, r2, r0 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # apply horizontal filter -+-## -+-## asr r2, r2, 15 ; mul24 r3, r0, ra0 -+-## min r2, r2, rb22 -+-## max ra13, r2, 0 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra14, r0, 0 -+-## -+-## -+-## -+-## -+-## nop ; ldtmu0 # loop counter increment -+-## shr r0, r4, ra17 ; ldtmu0 -+-## shr r1, r4, ra17 ; v8subs r0, r0, rb20 -+-## add t0s, ra16, r5 ; v8subs r1, r1, rb20 -+-## add ra16, ra16, rb16 ; mov t0s, ra16 -+-## -+-## # generate seven shifted versions -+-## # interleave with scroll of vertical context -+-## -+-## mov r2, rb21 ; mul24 r3, r0, ra0 -+-## sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-## sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-## sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-## sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-## sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-## sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-## sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-## sub r0, r2, r3 -+-## -+-## # apply horizontal filter -+-## -+-## nop ; mul24 r0, r0, ra22 # last bit of context scroll, including clamp to zero -+-## asr r0, r0, 15 -+-## min r0, r0, rb22 -+-## max ra15, r0, 0 -+- -+- -+-mov r3, 0 # This signifies the amount of unrolling -+- -+-:fast_loop -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-# Due to pipelining we can only skip second pipeline instructions related to the fetched pixels -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_y, ra_y_next ; mov rb31, r3 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov r3, rb_pitch -+- -+-max r2, ra_y, 0 -+-min r2, r2, rb_frame_height_minus_1 ; mov r1, r4 # discard texture read -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r0, r0, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-sub r0, r2, r3 ; mov r3, rb31 -+- -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 8 ; mov r1, ra22 -+- -+-# apply horizontal filter -+- -+-brr.anyn -, r:fast_loop -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-brr.anyn -, r:fast_loop -+-asr r1, r1, 15 -+-min r1, r1, rb22 -+-max vpm, r1, 0 -+- -+-# DMA out -+- -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -+-mov vw_addr, unif # start the VDW -+ -+ ################################################################################ -+ -+-# mc_filter_b(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+- -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -+-::mc_filter_b -++::mc_filter_uv_b -+ mov ra31, unif -+ -+ # per-channel shifts were calculated on the *previous* invocation -+ -+ mov ra_xshift, ra_xshift_next -+-mov ra_x2shift, ra_x2shift_next -+ -+ # get base addresses and per-channel shifts for *next* invocation -+ add r0, unif, elem_num # x -+-add r2, r0, 8 # x+8 -+ max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-add r2, r2, r3 -+ and rb_x_base_next, r0, ~3 -+-and ra_x2_base_next, r2, ~3 -+ mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -+ -+ # set up VPM write -+ mov vw_setup, rb28 -+@@ -801,17 +375,22 @@ and r0, r0, rb22 # Extract height -+ add rb17, r0, 5 -+ add rb18, r0, 7 -+ shl r0, r0, 7 -++ -+ # r0 is currently height<<7 -+ # For vr_setup we want height<<20 (so 20-7=13 additional bits) -+ shl r3, r0, 13 -+ shl r3, r3, 8 # Mask off top 8 bits -+ shr r3, r3, 8 -++ -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -++ -+ # In a B frame, so also set up VPM read -+ add vr_setup, r3, rb28 -+ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -837,9 +416,13 @@ asr rb12, r0, rb23 -+ -+ mov r5rep, -8 -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -+ mov r3, 0 -+ -+-:bloop -++:uvloop_b -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+ -+@@ -847,7 +430,7 @@ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+ shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+ mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+@@ -861,6 +444,7 @@ add t0s, ra_x2_base, r2 -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ mov r2, rb21 ; mul24 r3, r0, ra0 -++nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+ sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+ sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+@@ -889,7 +473,7 @@ mov ra13, ra14 -+ sub.setf -, r3, 8 ; mov r1, ra22 -+ -+ # apply horizontal filter -+-brr.anyn -, r:bloop -++brr.anyn -, r:uvloop_b -+ max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+ asr r0, r0, 15 ; mov r1, ra21 -+ min.setf ra15, r0, rb22 -+@@ -906,213 +490,50 @@ sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+ sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+ sub.ifnn r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 15 ; mov -, vr_wait -++asr r1, r1, 15 -+ min r1, r1, rb22 -+ add r0, vpm, 1 # Blend in previous VPM contents at this location -+-brr.anyn -, r:bloop -++brr.anyn -, r:uvloop_b -+ max r1, r1, 0 -+ add r1, r1, r0 -+ shr vpm, r1, 1 -+ -+-# DMA out -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -+ -+ bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -+ mov vw_addr, unif # start the VDW -+ -+ ################################################################################ -+ -+-# mc_filter_honly(next_kernel, x, y, frame_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_dst) -+-# This filter only does horizontal filtering. -+-# It is assumed that the region to fetch does not include extra rows above. -++# mc_exit() -+ -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -+-::mc_filter_honly -+-mov ra31, unif -++::mc_exit -++mov -, vw_wait # wait on the VDW -+ -+-# per-channel shifts were calculated on the *previous* invocation -++mov -,srel(0) -+ -+-mov ra_xshift, ra_xshift_next -+-mov ra_x2shift, ra_x2shift_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # x -+-add r2, r0, 8 # x+8 -+-max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3,unif # frame_base -+-shl ra_xshift_next, r0, 3 -+-max r2, r2, 0 -+-min r2, r2, rb_frame_width_minus_1 -+-shl ra_x2shift_next, r2, 3 -+-add r0, r0, r3 -+-add r2, r2, r3 -+-and rb_x_base_next, r0, ~3 -+-and ra_x2_base_next, r2, ~3 -+-mov ra_y_next, r1 -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, -2 # Pipelining means we move data across 2 iterations early -+-shl r0, r0, 7 ; mov rb18,r0 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-# get filter coefficients -+- -+-mov r0, unif -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-mov r0, unif -+- -+-# r2 is elem_num -+-# r3 is loop counter -+-mov r5rep, -8 -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] # delay slot 3 -+-mov r3, 0 -+- -+-:loop_honly -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_x2shift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 ; mov r3, rb31 -+- -+-sub.setf -, r3, rb18 ; mov r1, ra22 -+- -+-mov -, vw_wait ; mul24 r0, r0, r1 -+-brr.anyn -, r:loop_honly -+-asr r0, r0, 15 # delay 1 -+-min r0, r0, rb22 # delay 2 -+-max vpm, r0, 0 # delay 3 -+- -+-# DMA out -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW: height rows, 16 8-bit units long -+-mov vw_setup, rb29 -+-mov vw_addr, unif # start the VDW -+- -+- -+-################################################################################ -+- -+-# mc_exit() -+- -+-::mc_exit -+-mov -, vw_wait # wait on the VDW -+- -+-mov -,srel(0) -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -+ -+ nop ; nop ; thrend -+ nop ; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -+-::mc_exit1 -+-mov -, vw_wait # wait on the VDW -+- -+-#mov -,srel(1) -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -+- -+-# mc_interrupt_exit() -+-::mc_interrupt_exit -+-mov -, vw_wait # wait on the VDW -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-mov -,sacq(0) # 1 -+-mov -,sacq(0) # 2 -+-mov -,sacq(0) # 3 -+-mov -,sacq(0) # 4 -+-mov -,sacq(0) # 5 -+-mov -,sacq(0) # 6 -+-mov -,sacq(0) # 7 -+-mov -,sacq(0) # 8 -+-mov -,sacq(0) # 9 -+-mov -,sacq(0) # 10 -+-mov -,sacq(0) # 11 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -+- -+-# mc_interrupt_exit4() -+-::mc_interrupt_exit4 -+-mov -, vw_wait # wait on the VDW -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-mov -,sacq(0) # 1 -+-mov -,sacq(0) # 2 -+-mov -,sacq(0) # 3 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -+- -+ # mc_interrupt_exit8() -+ ::mc_interrupt_exit8 -+ mov -, vw_wait # wait on the VDW -+@@ -1134,282 +555,5 @@ nop ; nop ; thrend -+ mov interrupt, 1; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -+-################################################################################ -+-# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+-::mc_setup_uv -+- -+-# Read starting kernel -+-mov ra31, unif -+- -+-# Load first request location -+-add ra_x_base, unif, elem_num # Store x -+-mov ra_y, unif # Store y -+-mov ra_x2_base, unif # Store frame u base -+-nop -+-sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -+- -+-# Read image dimensions -+-sub rb25,unif,1 -+-sub rb30,unif,1 -+- -+-# get source pitch -+-mov rb16, unif -+- -+-# get destination pitch -+-mov r0, unif -+-mov r1, vdw_setup_1(0) -+-add rb24, r1, r0 -+- -+-# load constants -+- -+-mov ra20, 1 -+-mov ra21, 32 -+-mov ra22, 256 -+-mov ra23, 8 -+- -+-mov rb20, 0xffffff00 -+-mov rb21, 64 -+-mov rb22, 255 -+-mov rb23, 24 -+- -+-# touch vertical context to keep simulator happy -+- -+-mov ra8, 0 -+-mov ra9, 0 -+-mov ra10, 0 -+-mov ra11, 0 -+-mov ra12, 0 -+-mov ra13, 0 -+-mov ra14, 0 -+-mov ra15, 0 -+- -+-# Compute part of VPM to use for DMA output -+-mov r2, qpu_num -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+-shl r0, r0, 5 -+-add rb27, r0, r1 -+- -+-# Compute part of VPM to save data into -+-mov r2, qpu_num -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-add rb28, r0, r1 -+- -+-# Compute base address for first and second access -+-mov r0, ra_x_base # Load x -+-max r0, r0, 0; mov r1, ra_y # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -+-shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-add ra_y, r1, 1 -+-add r0, r0, r3 -+-and r0, r0, ~3 -+-max r1, r1, 0 ; mov ra_x_base, r0 # y -+-min r1, r1, rb_frame_height_minus_1 -+-# submit texture requests for first line -+-add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-add t0s, r0, r1 ; mov ra_x2_base, r2 -+-add t0s, r2, r1 -+- -+-# Dump padding words -+-mov r0, unif -+-mov r0, unif -+-mov r0, unif -+- -+-# submit texture requests for second line -+-max r1, ra_y, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 -+-bra -, ra31 -+-nop ; mul24 r1, r1, rb_pitch -+-add t0s, r1, ra_x_base -+-add t0s, r1, ra_x2_base -+- -+- -+- -+-################################################################################ -+- -+-::mc_filter_uv_b -+-mov ra31, unif -+- -+-# per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # x -+-max r0, r0, 0; mov r1, unif # y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+-shl ra_xshift_next, r0, 3 -+-sub r2, unif, r3 # compute offset from frame base u to frame base v -+-add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -+-mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+- -+-# r0 is currently height<<7 -+-# For vr_setup we want height<<20 (so 20-7=13 additional bits) -+-shl r3, r0, 13 -+-shl r3, r3, 8 # Mask off top 8 bits -+-shr r3, r3, 8 -+- -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-# In a B frame, so also set up VPM read -+-add vr_setup, r3, rb28 -+- -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+-# get filter coefficients -+- -+-mov r0, unif -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+- -+-# r2 is elem_num -+-# r3 is loop counter -+- -+-mov r5rep, -8 -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-mov r3, 0 -+- -+-:uvloop_b -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -+- -+-# generate seven shifted versions -+-# interleave with scroll of vertical context -+- -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+- -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 8 ; mov r1, ra22 -+- -+-# apply horizontal filter -+-brr.anyn -, r:uvloop_b -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 15 -+-min r1, r1, rb22 -+-add r0, vpm, 1 # Blend in previous VPM contents at this location -+-brr.anyn -, r:uvloop_b -+-max r1, r1, 0 -+-add r1, r1, r0 -+-shr vpm, r1, 1 -+- -+- -+-# DMA out for U -+- -+-mov vw_setup, rb26 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -+- -+-# DMA out for V -+-# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+-# Could potentially push this write into the start of the next pipeline stage. -+-mov r0, 16 -+-mov -, vw_wait -+- -+-bra -, ra31 -+-add vw_setup, rb26, r0 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -+- -+ ::mc_end -++# Do not add code here because mc_end must appear after all other code. -+-- -+2.7.4 -+ -+ -+From d40d59de0f09fd1a6e7146532418b63d8e2711b7 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 14:54:25 +0100 -+Subject: [PATCH 20/68] Moved chroma P1 to QPUs -+ -+--- -+ libavcodec/hevc.c | 38 ++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 38 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 31b8b2f..391d139 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2070,6 +2070,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -+ -+ if (s->ps.sps->chroma_format_idc) { -++#ifdef RPI_INTER_QPU -++ if (s->enable_rpi) { -++ int reflist = 1; -++ int hshift = s->ps.sps->hshift[1]; -++ int vshift = s->ps.sps->vshift[1]; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -++ intptr_t _mx = mx << (1 - hshift); -++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -++ -++ int x1_c = x0_c + (mv->x >> (2 + hshift)); -++ int y1_c = y0_c + (mv->y >> (2 + hshift)); -++ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ int chan = x0>>8; -++ -++ uint32_t *u = s->u_mvs[chan & 7]; -++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -++ *u++ = rpi_filter_coefs[_mx][0]; -++ *u++ = rpi_filter_coefs[_mx][1]; -++ *u++ = rpi_filter_coefs[_my][0]; -++ *u++ = rpi_filter_coefs[_my][1]; -++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ } -++ } -++ s->u_mvs[chan & 7] = u; -++ return; -++ } -++#endif -+ RPI_REDIRECT(chroma_mc_uni)(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], -+ 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); -+-- -+2.7.4 -+ -+ -+From 75777ba7927086e862104b14f6446e81bc789611 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 13 May 2015 15:13:47 +0100 -+Subject: [PATCH 21/68] Added B prediction - not quite right -+ -+--- -+ libavcodec/hevc.c | 58 ++++++++++++++++++++++++ -+ libavcodec/rpi_shader.c | 108 +++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 6 +-- -+ libavcodec/rpi_shader.qasm | 48 ++++++++++---------- -+ 4 files changed, 141 insertions(+), 79 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 391d139..47ddfff 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2127,6 +2127,64 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ ref1->frame, ¤t_mv.mv[1], ¤t_mv); -+ -+ if (s->ps.sps->chroma_format_idc) { -++#ifdef RPI_INTER_QPU -++ if (s->enable_rpi) { -++ int hshift = s->ps.sps->hshift[1]; -++ int vshift = s->ps.sps->vshift[1]; -++ const Mv *mv = ¤t_mv.mv[0]; -++ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); -++ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); -++ intptr_t _mx = mx << (1 - hshift); -++ intptr_t _my = my << (1 - vshift); // Fractional part of motion vector -++ int x1_c = x0_c + (mv->x >> (2 + hshift)); -++ int y1_c = y0_c + (mv->y >> (2 + hshift)); -++ -++ const Mv *mv2 = ¤t_mv.mv[1]; -++ intptr_t mx2 = av_mod_uintp2(mv2->x, 2 + hshift); -++ intptr_t my2 = av_mod_uintp2(mv2->y, 2 + vshift); -++ intptr_t _mx2 = mx2 << (1 - hshift); -++ intptr_t _my2 = my2 << (1 - vshift); // Fractional part of motion vector -++ -++ int x2_c = x0_c + (mv2->x >> (2 + hshift)); -++ int y2_c = y0_c + (mv2->y >> (2 + hshift)); -++ -++ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -++ -++ uint32_t *u = s->u_mvs[chan & 7]; -++ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -++ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -++ *u++ = rpi_filter_coefs[_mx2][0]; -++ *u++ = rpi_filter_coefs[_mx2][1]; -++ *u++ = rpi_filter_coefs[_my2][0]; -++ *u++ = rpi_filter_coefs[_my2][1]; -++ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ } -++ } -++ s->u_mvs[chan & 7] = u; -++ return; -++ } -++#endif -+ RPI_REDIRECT(chroma_mc_bi)(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, -+ x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 170e8ac..5d00cb2 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -265,23 +265,23 @@ unsigned int rpi_shader[] = { -+ /* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+ /* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+ /* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000778] */ 0x55015fc6, 0x100248a3, // mov r2, rb21 ; mul24 r3, r0, ra0 -+-/* [0x00000780] */ 0x40038031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-/* [0x00000788] */ 0x4d07f4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+ /* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000798] */ 0x4d0be4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ /* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007a8] */ 0x4d0fd4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ /* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007b8] */ 0x4d13c4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ /* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007c8] */ 0x4d17b4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ /* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007d8] */ 0x4d1ba4f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ /* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007e8] */ 0x4d1f94f0, 0xd00248a3, // sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ /* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000007f8] */ 0x0d9e74c0, 0x10020827, // sub r0, r2, r3 -++/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+ /* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+ /* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+ /* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+@@ -291,61 +291,63 @@ unsigned int rpi_shader[] = { -+ /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+ /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+ /* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000848] */ 0x533c0dc1, 0xd00243a0, // max ra14, ra15, 0 ; mul24 r0, r0, r1 -+-/* [0x00000850] */ 0x8f54f1f6, 0xd0024821, // asr r0, r0, 15 ; mov r1, ra21 -+-/* [0x00000858] */ 0x129d61c0, 0x100223e7, // min.setf ra15, r0, rb22 -+-/* [0x00000860] */ 0x4038e037, 0x100049e0, // nop ; mul24 r0, ra14, rb14 -+-/* [0x00000868] */ 0x4d34d237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-/* [0x00000870] */ 0x4d30c237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000878] */ 0x4d2cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000880] */ 0x4d28a237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000888] */ 0x4d249237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000890] */ 0x4d208237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000898] */ 0x4d3cf237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a0] */ 0x8d9f223f, 0x100a0867, // sub.ifnn r1, r1, r0 ; mov -, vw_wait -++/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+ /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b0] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -+-/* [0x000008b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008c0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000008c8] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000008d0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000008d8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000008e0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000008e8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000900] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000908] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000910] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000918] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000920] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000928] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000930] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000938] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000940] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000948] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+ /* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000960] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000968] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000970] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000978] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000980] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000988] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000009e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000009e8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 9de4535..e36c4ae 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -6,8 +6,8 @@ extern unsigned int rpi_shader[]; -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 142) -+ #define mc_filter_uv_b (rpi_shader + 360) -+-#define mc_exit (rpi_shader + 588) -+-#define mc_interrupt_exit8 (rpi_shader + 606) -+-#define mc_end (rpi_shader + 636) -++#define mc_exit (rpi_shader + 592) -++#define mc_interrupt_exit8 (rpi_shader + 610) -++#define mc_end (rpi_shader + 640) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index cd7346d..870437d2 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -443,23 +443,23 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+-mov r2, rb21 ; mul24 r3, r0, ra0 -+-nop ; mul24.ifnz r3, ra0 << 8, r1 << 8 -+-sub r2, r2, r3 ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -+ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-sub r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-sub r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-sub r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-sub r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-sub r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-sub r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-sub r0, r2, r3 -++add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+@@ -474,23 +474,25 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b -+-max ra14, ra15, 0 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr r0, r0, 15 ; mov r1, ra21 -+-min.setf ra15, r0, rb22 -++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -++asr ra15, r0, 8 ; nop -++nop ; nop -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r0, ra14, rb14 -+-sub r1, r1, r0 ; mul24 r0, ra13, rb13 -+-sub r1, r1, r0 ; mul24 r0, ra12, rb12 -+-sub r1, r1, r0 ; mul24 r0, ra11, rb11 -+-sub r1, r1, r0 ; mul24 r0, ra10, rb10 -+-sub r1, r1, r0 ; mul24 r0, ra9, rb9 -+-sub r1, r1, r0 ; mul24 r0, ra8, rb8 -+-sub r1, r1, r0 ; mul24 r0, ra15, rb15 -+-sub.ifnn r1, r1, r0 ; mov -, vw_wait -++nop ; mul24 r1, ra14, rb14 -++nop ; mul24 r0, ra13, rb13 -++add r1, r1, r0 ; mul24 r0, ra12, rb12 -++add r1, r1, r0 ; mul24 r0, ra11, rb11 -++add r1, r1, r0 ; mul24 r0, ra10, rb10 -++add r1, r1, r0 ; mul24 r0, ra9, rb9 -++add r1, r1, r0 ; mul24 r0, ra8, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb15 -++add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 15 -++asr r1, r1, 14 -++add r1, r1, ra21 -++asr r1, r1, 6 -+ min r1, r1, rb22 -+ add r0, vpm, 1 # Blend in previous VPM contents at this location -+ brr.anyn -, r:uvloop_b -+-- -+2.7.4 -+ -+ -+From 3d4e94b8f0b08fe4c0b582fc7f1dbe9d1d9d60ed Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 08:15:55 +0100 -+Subject: [PATCH 22/68] Added flush for SAO -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ libavcodec/hevc_filter.c | 39 ++++++++++++++++++++++++++------------- -+ 2 files changed, 27 insertions(+), 14 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 47ddfff..93e1eba 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2903,7 +2903,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ rpi_execute_inter_qpu(s); -+ #endif -+ // Transform all blocks -+- //printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 9b6e26d..92a8271 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -871,6 +871,21 @@ static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+ } -++ -++static void ff_hevc_flush_chroma(HEVCContext *s) -++{ -++ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N )) { -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -++ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -++ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -++ } -++} -+ #endif -+ -+ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+@@ -886,31 +901,29 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x - ctb_size, y); -+ if (y && x_end) { -+ sao_filter_CTB(s, x, y - ctb_size); -+- if (s->threads_type & FF_THREAD_FRAME ) -++ if (s->threads_type & FF_THREAD_FRAME ) { -++#ifdef RPI_INTER_QPU -++ ff_hevc_flush_chroma(s); -++#endif -+ ff_thread_report_progress(&s->ref->tf, y, 0); -++ } -+ } -+ if (x_end && y_end) { -+ sao_filter_CTB(s, x , y); -+- if (s->threads_type & FF_THREAD_FRAME ) -++ if (s->threads_type & FF_THREAD_FRAME ) { -++#ifdef RPI_INTER_QPU -++ ff_hevc_flush_chroma(s); -++#endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -++ } -+ } -+ } else if (s->threads_type & FF_THREAD_FRAME && x_end) { -+ //int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -+- if (!( s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N )) { -+ #ifdef RPI_INTER_QPU -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ ff_hevc_flush_chroma(s); -+ #endif -+- //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+- //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+- //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+- } -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+ } -+-- -+2.7.4 -+ -+ -+From 3e337b9c4ef0c356a0259be2254ad1bc4d5bbe29 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 09:17:28 +0100 -+Subject: [PATCH 23/68] Stopped using acceleration in unsupported cases -+ -+--- -+ libavcodec/hevc.c | 14 +++++++------- -+ libavcodec/hevc_cabac.c | 4 ++-- -+ 2 files changed, 9 insertions(+), 9 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 93e1eba..bfd5a55 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -1152,15 +1152,11 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -+- printf("Cross component not supported\n"); // TODO -+- exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+ -+ if (lc->tu.cross_pf) { -+- printf("Cross component not supported\n"); // TODO -+- exit(-1); -+ hls_cross_component_pred(s, 1); -+ } -+ for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { -+@@ -1189,8 +1185,6 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < (size * size); i++) { -+ coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); -+ } -+- printf("Cross component not supported\n"); // TODO -+- exit(-1); -+ s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride); -+ } -+ } -+@@ -2857,7 +2851,13 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -+- s->enable_rpi = 1; // TODO this should depend on cross component and frame width etc. -++ s->enable_rpi = s->ps.sps->bit_depth == 8 -++ && s->ps.sps->width <= RPI_MAX_WIDTH -++ && !s->ps.pps->cross_component_prediction_enabled_flag -++ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -++ && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -++ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -++ -+ #endif -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 4f072be..38f53de 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1513,9 +1513,9 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ #ifdef RPI -+ if (!use_vpu) { -+ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); -+- if (max_xy == 0) -++ if (max_xy == 0) { -+ s->hevcdsp.idct_dc[log2_trafo_size-2](coeffs); -+- else { -++ } else { -+ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; -+ if (max_xy < 4) -+ col_limit = FFMIN(4, col_limit); -+-- -+2.7.4 -+ -+ -+From 3941d3e4c2305fa037e8aba5a14cf698ac8673db Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 09:42:16 +0100 -+Subject: [PATCH 24/68] Split B prediction into two passes -+ -+--- -+ libavcodec/hevc.c | 1 + -+ libavcodec/hevc.h | 1 + -+ libavcodec/rpi_qpu.c | 3 + -+ libavcodec/rpi_qpu.h | 1 + -+ libavcodec/rpi_shader.c | 559 +++++++++++++++++++++++++++------------------ -+ libavcodec/rpi_shader.h | 11 +- -+ libavcodec/rpi_shader.qasm | 196 ++++++++++++++-- -+ 7 files changed, 531 insertions(+), 241 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index bfd5a55..4b133d2 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3801,6 +3801,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ p += uv_commands_per_qpu; -+ } -+ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -++ s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); -+ s->mc_filter_uv_b = qpu_get_fn(QPU_MC_FILTER_UV_B); -+ -+ } -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index d513579..4a39e39 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -917,6 +917,7 @@ typedef struct HEVCContext { -+ uint32_t *u_mvs[8]; -+ // Function pointers -+ uint32_t mc_filter_uv; -++ uint32_t mc_filter_uv_b0; -+ uint32_t mc_filter_uv_b; -+ #endif -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 4e90cc1..60bf079 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -636,6 +636,9 @@ unsigned int qpu_get_fn(int num) { -+ case QPU_MC_FILTER_UV: -+ fn = mc_filter_uv; -+ break; -++ case QPU_MC_FILTER_UV_B0: -++ fn = mc_filter_uv_b0; -++ break; -+ case QPU_MC_FILTER_UV_B: -+ fn = mc_filter_uv_b; -+ break; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index f9ad333..543c84b 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -29,6 +29,7 @@ enum { -+ QPU_MC_FILTER_HONLY, -+ QPU_MC_SETUP_UV, -+ QPU_MC_FILTER_UV, -++ QPU_MC_FILTER_UV_B0, -+ QPU_MC_FILTER_UV_B, -+ QPU_MC_INTERRUPT_EXIT8, -+ QPU_MC_END -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 5d00cb2..88ad20b 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -39,18 +39,18 @@ unsigned int rpi_shader[] = { -+ /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+ /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+ /* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000088] */ 0x00000040, 0xe0021567, // mov rb21, 64 -+-/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+ /* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+ /* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+ /* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+@@ -62,176 +62,176 @@ unsigned int rpi_shader[] = { -+ /* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+ /* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+ /* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000188] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x00000190] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x00000198] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000001a0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001a8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001b0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001b8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001c0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x000001c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001d0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001d8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x000001e0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x000001e8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000001f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000001f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000200] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000208] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000210] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000218] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000220] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000228] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000230] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000238] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000240] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000248] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000250] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000258] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000260] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000268] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000270] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000278] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000280] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000288] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000290] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000298] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002c0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002c8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000002d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000002e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000002f0] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000360] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000370] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000380] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000388] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000430] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000438] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000440] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000448] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000450] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000458] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000460] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000468] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000470] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000478] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000480] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000488] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000490] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000498] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004a0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004a8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004b0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004b8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004c0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004c8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000004d8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x000004e0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x000004e8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x000004f0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x000004f8] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000500] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000508] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000510] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000518] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000520] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000528] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000530] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000538] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000540] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000548] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000550] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000558] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000560] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000568] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000570] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000578] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000580] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000588] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000590] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000598] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-// ::mc_filter_uv_b -+-/* [0x000005a0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005a8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005b0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005b8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005c0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000005c8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005d0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000005d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000005e0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000005e8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000005f0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000005f8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000600] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000608] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000610] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000618] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000620] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000628] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000630] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000638] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000640] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000648] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000650] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000658] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000660] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000668] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000670] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_uv_b0 -++/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+ /* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+ /* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+@@ -253,7 +253,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+ /* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ /* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+-// :uvloop_b -++// :uvloop_b0 -+ /* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+ /* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+ /* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+@@ -290,7 +290,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+ /* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+ /* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+ /* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+ /* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+ /* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -+@@ -306,48 +306,163 @@ unsigned int rpi_shader[] = { -+ /* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ /* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+ /* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x000008c0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000008c8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008d0] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x000008d8] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000008e0] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x000008e8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x000008f0] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x000008f8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000900] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000908] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000910] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000920] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000928] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000930] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000938] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_uv_b -++/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :uvloop_b -++/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -++/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -++/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000940] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000948] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000950] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000958] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000960] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000968] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000970] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000978] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000980] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000988] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000990] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000998] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009a0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009a8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009d8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009e0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000009e8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000009f0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000009f8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index e36c4ae..809e582 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,10 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 142) -+-#define mc_filter_uv_b (rpi_shader + 360) -+-#define mc_exit (rpi_shader + 592) -+-#define mc_interrupt_exit8 (rpi_shader + 610) -+-#define mc_end (rpi_shader + 640) -++#define mc_filter_uv (rpi_shader + 150) -++#define mc_filter_uv_b0 (rpi_shader + 368) -++#define mc_filter_uv_b (rpi_shader + 586) -++#define mc_exit (rpi_shader + 818) -++#define mc_interrupt_exit8 (rpi_shader + 836) -++#define mc_end (rpi_shader + 866) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 870437d2..635b894 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -26,7 +26,7 @@ -+ # ra23 8 -+ # -+ # rb20 0xffffff00 -+-# rb21 64 -++# rb21 vpm_setup for writing 16bit results into VPM -+ # rb22 255 -+ # rb23 24 -+ # -+@@ -34,7 +34,7 @@ -+ # rb25 frame width-1 -+ # rb26 height<<23 + width<<16 + vdw_setup_0 -+ # rb27 vdw_setup_0 (depends on QPU number) -+-# rb28 vpm_setup (depends on QPU number) -++# rb28 vpm_setup (depends on QPU number) for writing 8bit results into VPM -+ # rb29 vdw_setup_1(dst_pitch-width) -+ # rb30 frame height-1 -+ # rb31 used as temp to count loop iterations -+@@ -69,8 +69,6 @@ -+ .set ra_y_next, ra28 -+ .set ra_y, ra29 -+ -+-.set rb_const_64, rb21 -+- -+ -+ ################################################################################ -+ # mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -+@@ -106,7 +104,6 @@ mov ra22, 256 -+ mov ra23, 8 -+ -+ mov rb20, 0xffffff00 -+-mov rb21, 64 -+ mov rb22, 255 -+ mov rb23, 24 -+ -+@@ -123,6 +120,7 @@ mov ra15, 0 -+ -+ # Compute part of VPM to use for DMA output -+ mov r2, qpu_num -++shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+ and r2, r2, 15 -+ mov r1, r2 -+ asr r1, r1, 2 -+@@ -135,16 +133,21 @@ shl r0, r0, 5 -+ add rb27, r0, r1 -+ -+ # Compute part of VPM to save data into -+-mov r2, qpu_num -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) -++mov r2, qpu_num # qpu_num = abcd -++shl r2, r2, 1 -++and r2, r2, 15 # r2 = bcd0 -++mov r1, r2 # r1 = bcd0 -++asr r1, r1, 2 # r1 = bc -++shl r1, r1, 6 # r1 = bc000000 -++mov r0, r2 # r0 = bcd0 -++and r0, r0, 3 # r0 = d0 -++add r0, r0, r1 # r0 = bc0000d0 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+ add rb28, r0, r1 -++asr r0, r0, 1 # r0 = bc0000d -++# Prepare VPM command for 16bit intermediates -++mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -++add rb21, r0, r1 -+ -+ # Compute base address for first and second access -+ mov r0, ra_x_base # Load x -+@@ -345,6 +348,171 @@ mov vw_addr, unif # start the VDW -+ -+ ################################################################################ -+ -++# mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -++ -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x_base, ra_x16_base point to the current coordinates for this block -++::mc_filter_uv_b0 -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # x -++max r0, r0, 0; mov r1, unif # y -++min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -++shl ra_xshift_next, r0, 3 -++sub r2, unif, r3 # compute offset from frame base u to frame base v -++add r0, r0, r3 -++and rb_x_base_next, r0, ~3 -++mov ra_y_next, r1 -++add ra_x2_base_next, rb_x_base_next, r2 -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -++ -++# get filter coefficients -++ -++mov r0, unif -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++asr rb15, r0, rb23; mul24 r0, r0, ra22 -++asr rb14, r0, rb23; mul24 r0, r0, ra22 -++asr rb13, r0, rb23; mul24 r0, r0, ra22 -++asr rb12, r0, rb23 -++ -++# r2 is elem_num -++# r3 is loop counter -++ -++mov r5rep, -8 -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:uvloop_b0 -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -++shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_x2_base, r2 -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++add r0, r2, r3 -++ -++mov r3, rb31 -++ -++mov ra8, ra9 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++mov ra13, ra14 -++ -++sub.setf -, r3, 8 ; mov r1, ra22 -++ -++# apply horizontal filter -++brr.anyn -, r:uvloop_b0 -++mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -++asr ra15, r0, 8 ; nop -++nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r1, ra14, rb14 -++nop ; mul24 r0, ra13, rb13 -++add r1, r1, r0 ; mul24 r0, ra12, rb12 -++add r1, r1, r0 ; mul24 r0, ra11, rb11 -++add r1, r1, r0 ; mul24 r0, ra10, rb10 -++add r1, r1, r0 ; mul24 r0, ra9, rb9 -++add r1, r1, r0 ; mul24 r0, ra8, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb15 -++add r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 14 -++add r1, r1, ra21 -++brr.anyn -, r:uvloop -++asr r1, r1, 6 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -++ -++# DMA out for U -++ -++mov vw_setup, rb26 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++# DMA out for V -++# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -++# Could potentially push this write into the start of the next pipeline stage. -++mov r0, 16 -++mov -, vw_wait -++ -++bra -, ra31 -++add vw_setup, rb26, r0 # VDW setup 0 -++mov vw_setup, rb29 # Stride -++mov vw_addr, unif # start the VDW -++ -++################################################################################ -++ -+ ::mc_filter_uv_b -+ mov ra31, unif -+ -+-- -+2.7.4 -+ -+ -+From 85d0ffa2bcf6a2b94c1a0c8f84241cda9ac92ce2 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 10:04:55 +0100 -+Subject: [PATCH 25/68] Switch to using 16bit temp buffers -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ libavcodec/rpi_shader.c | 4 ++-- -+ libavcodec/rpi_shader.qasm | 10 +++++----- -+ 3 files changed, 8 insertions(+), 8 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 4b133d2..28a6660 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2147,7 +2147,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+- u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 88ad20b..ffd3a07 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -220,7 +220,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+ /* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+ /* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000618] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+ /* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+ /* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+@@ -346,7 +346,7 @@ unsigned int rpi_shader[] = { -+ /* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000009f8] */ 0x0c9dc7c0, 0x10020c67, // add vr_setup, r3, rb28 -++/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+ /* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+ /* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 635b894..9577121 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -26,7 +26,7 @@ -+ # ra23 8 -+ # -+ # rb20 0xffffff00 -+-# rb21 vpm_setup for writing 16bit results into VPM -++# rb21 vpm_setup for reading/writing 16bit results into VPM -+ # rb22 255 -+ # rb23 24 -+ # -+@@ -370,8 +370,8 @@ and rb_x_base_next, r0, ~3 -+ mov ra_y_next, r1 -+ add ra_x2_base_next, rb_x_base_next, r2 -+ -+-# set up VPM write -+-mov vw_setup, rb28 -++# set up VPM write, we need to save 16bit precision -++mov vw_setup, rb21 -+ -+ # get width,height of block -+ mov r2, 16 -+@@ -554,8 +554,8 @@ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -+ -+-# In a B frame, so also set up VPM read -+-add vr_setup, r3, rb28 -++# In a B frame, so also set up VPM read (reading back 16bit precision) -++add vr_setup, r3, rb21 -+ -+ sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+ -+-- -+2.7.4 -+ -+ -+From abc51bf61df597082fbd7cf1bba5031e4d44318b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 10:30:44 +0100 -+Subject: [PATCH 26/68] Corrected B prediction: matching md5 sum for hobbit50 -+ -+--- -+ libavcodec/rpi_shader.c | 815 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 12 +- -+ libavcodec/rpi_shader.qasm | 36 +- -+ 3 files changed, 429 insertions(+), 434 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index ffd3a07..77cca46 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -38,431 +38,428 @@ unsigned int rpi_shader[] = { -+ /* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+ /* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+ /* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x00000080] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000088] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000090] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000098] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000000a0] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000d0] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000e0] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x000000e8] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000f0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000000f8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000108] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000110] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000118] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000120] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000128] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000130] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000138] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000140] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x00000148] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000150] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000158] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000160] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000168] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000170] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000178] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000180] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000188] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000190] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x00000198] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x000001a0] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x000001a8] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000001b0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001b8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000001c0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001c8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001d8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001e0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x000001e8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001f0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001f8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00000200] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000208] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -++/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -++/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -++/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -++/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+ /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000220] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000228] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000230] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000238] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000240] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000248] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000250] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000258] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000260] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000268] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000270] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000278] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000280] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000288] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000290] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000298] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000002a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002b0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002e8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000002f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000300] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000308] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000310] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000360] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000370] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000380] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000388] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000390] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000398] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000003a0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003a8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000450] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000458] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000460] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000468] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000470] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000478] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000480] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000488] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000490] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000498] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000004a0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000004a8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000004b0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000004b8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004d0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004d8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000004f8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000500] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000508] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000510] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000518] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000520] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000528] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000530] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000538] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000540] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000548] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000550] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000558] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000560] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000568] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000570] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000578] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000580] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000588] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000590] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000598] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000005a0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000005a8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000005b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000005b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000005c0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005c8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005d0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005d8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005e0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000005e8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005f0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000005f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000600] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000608] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000610] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000618] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000620] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000628] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000630] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000638] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000640] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000648] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000650] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000658] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000660] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000668] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000670] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000678] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000680] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000688] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000690] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000698] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006a8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006c8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000006e8] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f0] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000700] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000708] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000710] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000718] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000720] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000728] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000730] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000738] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000740] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000748] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000750] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000758] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000760] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000768] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000770] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000778] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000780] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000788] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000790] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000798] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007a0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007a8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007b0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007b8] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007c0] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007c8] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007d0] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007d8] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007e0] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007e8] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000007f0] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x000007f8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000800] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000808] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000810] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000818] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000820] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000828] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000830] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000838] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000840] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000848] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000850] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000858] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000860] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000868] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000870] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000878] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000880] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000888] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000890] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000898] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000008b8] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x000008c0] */ 0xfffffad8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000008c8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000008d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000008d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000008e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000008f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000900] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000908] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000910] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000918] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000920] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop -++/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop -++/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000928] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000930] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000938] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000940] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000948] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000950] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000958] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000960] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000968] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000970] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000978] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000980] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000988] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000990] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000998] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000009a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000009a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000009b0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000009b8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000009c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000009c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000009d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000009d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x000009e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000009e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000009f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000009f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000a00] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000a08] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000a10] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a18] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a20] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a28] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000a30] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a38] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a40] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a48] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000a50] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a58] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a60] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a68] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000a70] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a78] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a80] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a88] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000a90] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000a98] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000aa0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000aa8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000ab0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000ab8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000ac0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000ac8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000ad0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000ad8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000ae0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000ae8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000af0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000af8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000b00] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000b08] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000b10] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000b18] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000b20] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000b28] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000b30] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000b38] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000b40] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000b48] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000b50] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000b58] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000b60] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000b68] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000b70] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000b78] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000b80] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000b88] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000b90] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000b98] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000ba0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000ba8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000bb0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000bb8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000bc0] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000bc8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000bd0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000bd8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000be0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000be8] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000bf0] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000bf8] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000c00] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000c08] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000c10] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000c18] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000c20] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000c28] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000c30] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000c38] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000c40] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000c48] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000c50] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000c58] */ 0x0cc01dc0, 0xd0020827, // add r0, vpm, 1 -+-/* [0x00000c60] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000c68] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000c70] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00000c78] */ 0x0e9c13c0, 0xd0020c27, // shr vpm, r1, 1 -+-/* [0x00000c80] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000c88] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000c90] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000c98] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000ca0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000ca8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000cb0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000cb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000cc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000cc8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000cd0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ce0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ce8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cf0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cf8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000d00] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000d08] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000d10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d70] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000d78] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000d80] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 809e582..6562fa9 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 150) -+-#define mc_filter_uv_b0 (rpi_shader + 368) -+-#define mc_filter_uv_b (rpi_shader + 586) -+-#define mc_exit (rpi_shader + 818) -+-#define mc_interrupt_exit8 (rpi_shader + 836) -+-#define mc_end (rpi_shader + 866) -++#define mc_filter_uv (rpi_shader + 152) -++#define mc_filter_uv_b0 (rpi_shader + 370) -++#define mc_filter_uv_b (rpi_shader + 584) -++#define mc_exit (rpi_shader + 812) -++#define mc_interrupt_exit8 (rpi_shader + 830) -++#define mc_end (rpi_shader + 860) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 9577121..562dc35 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -39,13 +39,13 @@ -+ # rb30 frame height-1 -+ # rb31 used as temp to count loop iterations -+ # -+-# ra24...ra30 15, 14, 13, 12, 11, 10, 9 -+ # ra24 clipped(row start address+8+elem_num)&~3 -+ # ra25 per-channel shifts 2 -+ # ra26 next ra24 -+ # ra27 next ra25 -+ # ra28 next y -+ # ra29 y for next texture access -++# ra30 64 -+ # -+ # ra31 next kernel address -+ -+@@ -102,6 +102,7 @@ mov ra20, 1 -+ mov ra21, 32 -+ mov ra22, 256 -+ mov ra23, 8 -++mov ra30, 64 -+ -+ mov rb20, 0xffffff00 -+ mov rb22, 255 -+@@ -472,7 +473,7 @@ sub.setf -, r3, 8 ; mov r1, ra22 -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b0 -+ mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+-asr ra15, r0, 8 ; nop -++asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? -+ nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -+ -+ # apply vertical filter and write to VPM -+@@ -487,18 +488,18 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb15 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-add r1, r1, ra21 -+-brr.anyn -, r:uvloop -+-asr r1, r1, 6 # Delay 1 -+-min r1, r1, rb22 # Delay 2 -+-max vpm, r1, 0 # Delay 3 -++#asr r1, r1, 14 -++#add r1, r1, ra21 -++brr.anyn -, r:uvloop_b0 -++asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -++nop # Delay 2 -++nop # Delay 3 -+ -+ # DMA out for U -+ -+ mov vw_setup, rb26 # VDW setup 0 -+ mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -++mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results -+ -+ # DMA out for V -+ # We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+@@ -639,12 +640,11 @@ mov ra12, ra13 -+ mov ra13, ra14 -+ -+ sub.setf -, r3, 8 ; mov r1, ra22 -+- -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b -+ mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+ asr ra15, r0, 8 ; nop -+-nop ; nop -++nop ; nop # TODO improve use of delay slots -+ -+ # apply vertical filter and write to VPM -+ -+@@ -658,15 +658,13 @@ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb15 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-add r1, r1, ra21 -+-asr r1, r1, 6 -+-min r1, r1, rb22 -+-add r0, vpm, 1 # Blend in previous VPM contents at this location -++asr r1, r1, 14 # shift2=6 -++add r1, r1, vpm # Blend in previous VPM contents at this location -++add r1, r1, ra30 -+ brr.anyn -, r:uvloop_b -+-max r1, r1, 0 -+-add r1, r1, r0 -+-shr vpm, r1, 1 -++asr r1, r1, 7 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -+ -+ -+ # DMA out for U -+-- -+2.7.4 -+ -+ -+From ea60373134f98099c4ebaf0d23cca666008b4bba Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 10:55:07 +0100 -+Subject: [PATCH 27/68] P prediction uses 4 tap filters -+ -+--- -+ libavcodec/hevc.c | 50 ++-- -+ libavcodec/rpi_shader.c | 631 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 10 +- -+ libavcodec/rpi_shader.qasm | 43 +-- -+ 4 files changed, 344 insertions(+), 390 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 28a6660..a47ebc5 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -65,15 +65,15 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ // TODO Chroma only needs 4 taps -+-static uint32_t rpi_filter_coefs[8][2] = { -+- { ENCODE_COEFFS( 0, 0, 0, 64), ENCODE_COEFFS( 0, 0, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -2, 58), ENCODE_COEFFS( 10, -2, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -4, 54), ENCODE_COEFFS( 16, -2, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -6, 46), ENCODE_COEFFS( 28, -4, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -4, 36), ENCODE_COEFFS( 36, -4, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -4, 28), ENCODE_COEFFS( 46, -6, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -2, 16), ENCODE_COEFFS( 54, -4, 0, 0 ) }, -+- { ENCODE_COEFFS( 0, 0, -2, 10), ENCODE_COEFFS( 58, -2, 0, 0 ) } -++static uint32_t rpi_filter_coefs[8][1] = { -++ { ENCODE_COEFFS( 0, 64, 0, 0) }, -++ { ENCODE_COEFFS( -2, 58, 10, -2) }, -++ { ENCODE_COEFFS( -4, 54, 16, -2) }, -++ { ENCODE_COEFFS( -6, 46, 28, -4) }, -++ { ENCODE_COEFFS( -4, 36, 36, -4) }, -++ { ENCODE_COEFFS( -4, 28, 46, -6) }, -++ { ENCODE_COEFFS( -2, 16, 54, -4) }, -++ { ENCODE_COEFFS( -2, 10, 58, -2) } -+ }; -+ -+ static uint32_t get_vc_address(AVBufferRef *bref) { -+@@ -2027,16 +2027,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- *u++ = rpi_filter_coefs[_mx][1]; -++ u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- *u++ = rpi_filter_coefs[_my][1]; -++ u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2084,16 +2084,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- *u++ = rpi_filter_coefs[_mx][1]; -++ u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- *u++ = rpi_filter_coefs[_my][1]; -++ u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2148,29 +2148,29 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 3 + start_x; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 3 + start_y; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -++ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx2][0]; -+- *u++ = rpi_filter_coefs[_mx2][1]; -++ u++; -+ *u++ = rpi_filter_coefs[_my2][0]; -+- *u++ = rpi_filter_coefs[_my2][1]; -++ u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 77cca46..c8d0728 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -116,8 +116,8 @@ unsigned int rpi_shader[] = { -+ /* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+ /* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+ /* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000002f0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+ /* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+ /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+@@ -128,338 +128,315 @@ unsigned int rpi_shader[] = { -+ /* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ /* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ /* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000348] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000368] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000370] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000378] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000380] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000388] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000390] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000398] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000003a0] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003b8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003c0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003c8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003d0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003d8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003e0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003e8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003f0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003f8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000400] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000408] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000410] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000418] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000420] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000428] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000430] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000438] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000440] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000448] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000450] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000458] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000460] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000468] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000470] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000478] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000480] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000488] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000490] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000498] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x000004a0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000004a8] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x000004b0] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x000004b8] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x000004c0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x000004c8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000004d0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000004d8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x000004e0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004e8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000004f0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000004f8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000500] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000508] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000510] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000518] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000520] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000528] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000530] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000538] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000540] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000548] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000550] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000558] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000560] */ 0xfffffe40, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000568] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000570] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000578] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000580] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000588] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000590] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000598] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000005a0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000005a8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000005b0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000005b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000005c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000005c8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000005d0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000005d8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000005e0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000005e8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000005f0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000005f8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000600] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000608] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000610] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000618] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000620] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000628] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000630] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000638] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000640] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000648] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000650] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000658] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000660] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000668] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000670] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000678] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000680] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000688] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000690] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000698] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000006b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000006d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000006f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000006f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000700] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000708] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000710] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000718] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000720] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000728] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000730] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000738] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000740] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000748] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000750] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000758] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000760] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000768] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000770] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000778] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000780] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000788] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000790] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000798] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000007a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000007a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000007b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000007b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000007c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000007c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000007d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000007d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000007e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000007e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000007f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000007f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000800] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000808] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000810] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000818] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000820] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000828] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000830] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000838] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000840] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000848] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000850] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000858] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000860] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000868] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000870] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000878] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000880] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000888] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000890] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000898] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000008a0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000008a8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000008b0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000008b8] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000008c0] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x000008c8] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x000008d0] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x000008d8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000008e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000008e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000008f0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000008f8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000900] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000908] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000910] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000918] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000920] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000928] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000930] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000938] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000940] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000948] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000950] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000958] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000960] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000968] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000970] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000978] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000980] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000988] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000990] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000998] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000009a0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000009a8] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000009b0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x000009b8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000009c0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000009c8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000009d0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x000009d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000009e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000009e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000009f0] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x000009f8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000a00] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000a08] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a10] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a18] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a20] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000a28] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a30] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a38] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a40] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000a48] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a50] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a58] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a60] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000a68] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a70] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a78] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000a80] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000a88] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000a90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000a98] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000aa0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000aa8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000ab0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000ab8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000ac0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000ac8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000ad0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000ad8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000ae0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000ae8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000af0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000af8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000b00] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000b08] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000b10] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000b18] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000b20] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000b28] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000b30] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000b38] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000b40] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000b48] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000b50] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000b58] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000b60] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000b68] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000b70] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000b78] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000b80] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000b88] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000b90] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000b98] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000ba0] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000ba8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000bb0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000bb8] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000bc0] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000bc8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000bd0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000be0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000be8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000bf0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000bf8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000c00] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000c08] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000c10] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000c18] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000c20] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000c28] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000c30] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000c38] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000c40] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000c48] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000c50] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000c58] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000c60] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000c68] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000c70] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000c78] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000c80] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000c88] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000c90] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000c98] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000ca0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000ca8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000cb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000cb8] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000cc0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cc8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cd0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000cd8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ce0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ce8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000cf0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000cf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000d00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000d20] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d28] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d30] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d38] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d40] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000d58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000d60] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000d68] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 6562fa9..1bf7a68 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 370) -+-#define mc_filter_uv_b (rpi_shader + 584) -+-#define mc_exit (rpi_shader + 812) -+-#define mc_interrupt_exit8 (rpi_shader + 830) -+-#define mc_end (rpi_shader + 860) -++#define mc_filter_uv_b0 (rpi_shader + 324) -++#define mc_filter_uv_b (rpi_shader + 538) -++#define mc_exit (rpi_shader + 766) -++#define mc_interrupt_exit8 (rpi_shader + 784) -++#define mc_end (rpi_shader + 814) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 562dc35..8e4f18f 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -16,8 +16,8 @@ -+ # ra19 next ra17 -+ # -+ # rb16 pitch -+-# rb17 height + 5 -+-# rb18 height + 7 -++# rb17 height + 1 -++# rb18 height + 3 -+ # rb19 next ra16 -+ # -+ # ra20 1 -+@@ -214,8 +214,8 @@ mov r0, unif -+ shr r1, r0, r2 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -++add rb17, r0, 1 -++add rb18, r0, 3 -+ shl r0, r0, 7 -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+@@ -230,18 +230,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -++ mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -283,26 +276,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+ mov ra12, ra13 -+ mov ra13, ra14 -+ -+-sub.setf -, r3, 8 ; mov r1, ra22 -++sub.setf -, r3, 4 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop -+@@ -312,14 +293,10 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb14 -+-nop ; mul24 r0, ra13, rb13 -+-add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb15 -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 -+-- -+2.7.4 -+ -+ -+From e4bdd110d4640519b751ab428e7976a1e9a15802 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:03:51 +0100 -+Subject: [PATCH 28/68] Optimised B0 pass -+ -+--- -+ libavcodec/rpi_shader.c | 424 +++++++++++++++++++++------------------------ -+ libavcodec/rpi_shader.h | 8 +- -+ libavcodec/rpi_shader.qasm | 43 +---- -+ 3 files changed, 212 insertions(+), 263 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index c8d0728..1f63ee0 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -204,239 +204,215 @@ unsigned int rpi_shader[] = { -+ /* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+ /* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+ /* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000598] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000005a0] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+ /* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+ /* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005c8] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005d8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005f8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000600] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000608] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000638] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000640] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000648] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000650] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000708] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000710] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000718] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000720] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000728] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000730] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000738] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000740] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000748] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000750] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000758] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000760] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000768] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000770] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000778] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000780] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000788] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000790] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000798] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000007a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000007a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000007b0] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x000007b8] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x000007c0] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x000007c8] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x000007d0] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x000007d8] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x000007e0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x000007e8] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x000007f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000007f8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000800] */ 0xfffffe50, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000808] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x00000810] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000818] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000820] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000828] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000830] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000838] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000840] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000848] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000850] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000858] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000860] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000868] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000870] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000878] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000880] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000888] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000890] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000898] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000008a0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000008a8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000008b0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000008b8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000008c0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000008c8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008d8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000008e0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000008e8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000008f0] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x000008f8] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000900] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000908] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000910] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000918] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000920] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000928] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000930] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000938] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000940] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000948] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000950] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000958] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000960] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000968] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000970] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000978] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000980] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000988] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000990] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000998] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009a0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009a8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000009b0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009b8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009c0] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000009c8] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x000009d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000009d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000009e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -++/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -++/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000009e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000009f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000009f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000a00] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000a08] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000a10] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000a18] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000a20] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000a28] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000a30] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000a38] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000a40] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000a48] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000a50] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000a58] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000a60] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000a68] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000a70] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000a78] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000a80] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00000a88] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00000a90] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00000a98] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00000aa0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00000aa8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00000ab0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00000ab8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000ac0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000ac8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000ad0] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000ad8] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000ae0] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000ae8] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000af0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000af8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000b00] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000b08] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000b10] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000b18] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000b28] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000b30] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000b38] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000b40] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000b48] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000b50] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000b58] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000b60] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000b68] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000b70] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000b78] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000b80] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000b88] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000b90] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000b98] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000ba0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000ba8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000bb0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000bb8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000bc0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000bc8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000bd0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000bd8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000be0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000be8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000bf0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -++/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -++/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -++/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -++/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -++/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -++/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -++/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -++/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -++/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -++/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000bf8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000c00] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000c08] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c28] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000c30] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000c38] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000c40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000c48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000c68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000c98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ca0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ca8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000cb0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 1bf7a68..cb74887 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+ #define mc_filter_uv_b0 (rpi_shader + 324) -+-#define mc_filter_uv_b (rpi_shader + 538) -+-#define mc_exit (rpi_shader + 766) -+-#define mc_interrupt_exit8 (rpi_shader + 784) -+-#define mc_end (rpi_shader + 814) -++#define mc_filter_uv_b (rpi_shader + 490) -++#define mc_exit (rpi_shader + 718) -++#define mc_interrupt_exit8 (rpi_shader + 736) -++#define mc_end (rpi_shader + 766) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 8e4f18f..faa5755 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -357,15 +357,13 @@ mov r0, unif -+ shr r1, r0, r2 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -++add rb17, r0, 1 -++add rb18, r0, 3 -+ shl r0, r0, 7 -+ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -+ -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -373,18 +371,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -++ mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -426,26 +417,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+ mov ra12, ra13 -+ mov ra13, ra14 -+ -+-sub.setf -, r3, 8 ; mov r1, ra22 -++sub.setf -, r3, 4 ; mov r1, ra22 -+ -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b0 -+@@ -455,18 +434,12 @@ nop ; nop # Delay slot 3 (TODO move more of the context scr -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb14 -+-nop ; mul24 r0, ra13, rb13 -+-add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb15 -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-#asr r1, r1, 14 -+-#add r1, r1, ra21 -+ brr.anyn -, r:uvloop_b0 -+ asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -+ nop # Delay 2 -+-- -+2.7.4 -+ -+ -+From 93805e78a13d36e28ed84a0e8456da2eac45be89 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:12:43 +0100 -+Subject: [PATCH 29/68] Optimised B pass -+ -+--- -+ libavcodec/rpi_shader.c | 202 ++++++++++++++++++++------------------------- -+ libavcodec/rpi_shader.h | 6 +- -+ libavcodec/rpi_shader.qasm | 41 ++------- -+ 3 files changed, 100 insertions(+), 149 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 1f63ee0..4e6c5ea 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -289,8 +289,8 @@ unsigned int rpi_shader[] = { -+ /* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+ /* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+ /* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000830] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000838] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+ /* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+ /* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+ /* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+@@ -299,120 +299,96 @@ unsigned int rpi_shader[] = { -+ /* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+ /* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000880] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000888] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000890] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000898] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008b0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b8] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c8] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000008d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000008f0] */ 0x4f5971c6, 0x100253e0, // asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008f8] */ 0x4f5971c6, 0x100253a0, // asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000900] */ 0x4f5971c6, 0x10025360, // asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000908] */ 0x0f9d71c0, 0x10021327, // asr rb12, r0, rb23 -+-/* [0x00000910] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000918] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000920] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000928] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000930] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000938] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000940] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000948] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000950] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000958] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000960] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000968] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000970] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000978] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000980] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000988] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000990] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000998] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000009a0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000009a8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000009b0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000009b8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000009c0] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x000009c8] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x000009d0] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x000009d8] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x000009e0] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x000009e8] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x000009f0] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x000009f8] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00000a00] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000a08] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000a10] */ 0x15267d80, 0x10020227, // mov ra8, ra9 -+-/* [0x00000a18] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00000a20] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00000a28] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00000a30] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000a38] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000a40] */ 0x8d5887f6, 0xd00269e1, // sub.setf -, r3, 8 ; mov r1, ra22 -+-/* [0x00000a48] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a50] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000a58] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a68] */ 0x4038e037, 0x100049e1, // nop ; mul24 r1, ra14, rb14 -+-/* [0x00000a70] */ 0x4034d037, 0x100049e0, // nop ; mul24 r0, ra13, rb13 -+-/* [0x00000a78] */ 0x4c30c237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-/* [0x00000a80] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-/* [0x00000a88] */ 0x4c28a237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-/* [0x00000a90] */ 0x4c249237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-/* [0x00000a98] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-/* [0x00000aa0] */ 0x4c3cf237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb15 -+-/* [0x00000aa8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000ab0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000ab8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000ac0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000ac8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000ad0] */ 0xfffffe38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000ad8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000ae0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000ae8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000af0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000af8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000b00] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000b08] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000b18] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000b20] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000b28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000b30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000b38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000b40] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000b48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b68] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b70] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000b78] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000b80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000b88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000b98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ba0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ba8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bb0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bb8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bc0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bc8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bd0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000bd8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000be0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000be8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000bf0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index cb74887..53da629 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -7,8 +7,8 @@ extern unsigned int rpi_shader[]; -+ #define mc_filter_uv (rpi_shader + 152) -+ #define mc_filter_uv_b0 (rpi_shader + 324) -+ #define mc_filter_uv_b (rpi_shader + 490) -+-#define mc_exit (rpi_shader + 718) -+-#define mc_interrupt_exit8 (rpi_shader + 736) -+-#define mc_end (rpi_shader + 766) -++#define mc_exit (rpi_shader + 670) -++#define mc_interrupt_exit8 (rpi_shader + 688) -++#define mc_end (rpi_shader + 718) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index faa5755..f38c926 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -491,8 +491,8 @@ mov r0, unif -+ shr r1, r0, r2 # Extract width -+ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+ and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -++add rb17, r0, 1 -++add rb18, r0, 3 -+ shl r0, r0, 7 -+ -+ # r0 is currently height<<7 -+@@ -508,8 +508,6 @@ add rb26, r0, rb27 -+ # In a B frame, so also set up VPM read (reading back 16bit precision) -+ add vr_setup, r3, rb21 -+ -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -517,18 +515,11 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -++ mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23; mov r0, unif -+-asr rb15, r0, rb23; mul24 r0, r0, ra22 -+-asr rb14, r0, rb23; mul24 r0, r0, ra22 -+-asr rb13, r0, rb23; mul24 r0, r0, ra22 -+-asr rb12, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -570,26 +561,14 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+ add r0, r2, r3 -+ -+ mov r3, rb31 -+ -+-mov ra8, ra9 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+ mov ra12, ra13 -+ mov ra13, ra14 -+ -+-sub.setf -, r3, 8 ; mov r1, ra22 -++sub.setf -, r3, 4 ; mov r1, ra22 -+ # apply horizontal filter -+ brr.anyn -, r:uvloop_b -+ mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+@@ -598,14 +577,10 @@ nop ; nop # TODO improve use of delay slots -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb14 -+-nop ; mul24 r0, ra13, rb13 -+-add r1, r1, r0 ; mul24 r0, ra12, rb12 -+-add r1, r1, r0 ; mul24 r0, ra11, rb11 -+-add r1, r1, r0 ; mul24 r0, ra10, rb10 -+-add r1, r1, r0 ; mul24 r0, ra9, rb9 -+-add r1, r1, r0 ; mul24 r0, ra8, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb15 -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 # shift2=6 -+-- -+2.7.4 -+ -+ -+From e48df43c16de74dddbc7c702d64dd01eaf8e6b39 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:17:09 +0100 -+Subject: [PATCH 30/68] Used P delay slots more efficiently -+ -+--- -+ libavcodec/rpi_shader.c | 437 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 10 +- -+ libavcodec/rpi_shader.qasm | 19 +- -+ 3 files changed, 228 insertions(+), 238 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 4e6c5ea..a1af4e3 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -156,239 +156,236 @@ unsigned int rpi_shader[] = { -+ /* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ /* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ /* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000420] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000428] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000430] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+ /* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000440] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x00000448] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000450] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000458] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000460] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000468] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000470] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000478] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000480] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000488] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000490] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000498] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004a0] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x000004a8] */ 0xfffffec0, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004b0] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000004b8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004c0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004c8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004e0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004f0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004f8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000500] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000508] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000510] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000518] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000520] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000528] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000530] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000538] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000540] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000548] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000550] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000558] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000560] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000568] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000570] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000578] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000580] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000588] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000590] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000598] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005a0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005a8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005b0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005b8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005c0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005d0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005d8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005f8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000600] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000608] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000618] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000620] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000628] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000630] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000638] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000640] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000648] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000650] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000658] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000660] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000668] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000670] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000678] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000680] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000688] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000690] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000698] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006a0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006a8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006b0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006b8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006c0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006c8] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x000006d0] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000006d8] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000006e0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006e8] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x000006f0] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006f8] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x00000700] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x00000708] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000710] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000718] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000720] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000728] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000730] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000738] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000740] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000748] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x00000750] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000758] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000760] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000768] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000770] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000778] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000780] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000790] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000798] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000007a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -++/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008b0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000008d0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008e0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008e8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008f0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000008f8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000900] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000908] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000910] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000918] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000920] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000928] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000930] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000938] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000940] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000948] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000950] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000958] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000960] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000968] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000970] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000978] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000980] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000988] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000990] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000998] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009a0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x000009a8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009b0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000009b8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000009c0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000a10] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -++/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -++/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -++/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -++/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -++/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 53da629..1fb3e37 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 324) -+-#define mc_filter_uv_b (rpi_shader + 490) -+-#define mc_exit (rpi_shader + 670) -+-#define mc_interrupt_exit8 (rpi_shader + 688) -+-#define mc_end (rpi_shader + 718) -++#define mc_filter_uv_b0 (rpi_shader + 318) -++#define mc_filter_uv_b (rpi_shader + 484) -++#define mc_exit (rpi_shader + 664) -++#define mc_interrupt_exit8 (rpi_shader + 682) -++#define mc_end (rpi_shader + 712) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index f38c926..02e95dd 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -268,6 +268,7 @@ add t0s, ra_x2_base, r2 -+ -+ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -++# apply horizontal filter -+ nop ; mul24 r2, r0, ra0 -+ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+ nop ; mul24 r3, ra1 << 1, r0 << 1 -+@@ -276,20 +277,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 4 ; mov r1, ra22 -+- -+-# apply horizontal filter -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 4 ; mov ra12, ra13 -+ brr.anyn -, r:uvloop -+-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+-asr ra15, r0, 8 ; nop -+-nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+-- -+2.7.4 -+ -+ -+From b33dfc243ff5509299685add3c532ab7f207fd73 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:22:25 +0100 -+Subject: [PATCH 31/68] Improved use of delay slots -+ -+--- -+ libavcodec/rpi_shader.c | 503 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 10 +- -+ libavcodec/rpi_shader.qasm | 41 ++-- -+ 3 files changed, 265 insertions(+), 289 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index a1af4e3..c498f28 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -122,270 +122,263 @@ unsigned int rpi_shader[] = { -+ /* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+ /* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+ /* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000318] */ 0x0d9c8e40, 0xd00229e7, // sub.setf -,8,r1 -+-/* [0x00000320] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000328] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000350] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000368] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000370] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000378] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000380] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000388] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000390] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000398] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000003f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000003f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000400] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000408] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000410] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000418] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000420] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000428] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000430] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000438] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000440] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000448] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000450] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000458] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000460] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000468] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000470] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000478] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000480] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000488] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000490] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000498] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x000004a0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004a8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004b0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004b8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004c0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004c8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004d0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004d8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004e0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000004e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000004f8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000500] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000508] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000510] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000518] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000520] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000528] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000530] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000538] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000540] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000548] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000550] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000558] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000560] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000568] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000570] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000578] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000580] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000588] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000590] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000598] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005a0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005a8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005b8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005d0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000600] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000608] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000610] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000618] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000620] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000628] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000630] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000638] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000640] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000648] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000650] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000658] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000660] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000668] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000670] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000678] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000680] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000688] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000690] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000698] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006a0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006a8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006b0] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x000006b8] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x000006c0] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x000006c8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006d0] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x000006d8] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006e0] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000006e8] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000006f0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000006f8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000700] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000708] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000710] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000718] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000720] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000728] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000730] */ 0x0f9ce3c0, 0xd0020c27, // asr vpm, r1, 14 -+-/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000748] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000750] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000758] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000760] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000768] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000770] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000778] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000780] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000788] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b -+-/* [0x00000790] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000798] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007a0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007a8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007b0] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007b8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007c0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007d0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000007d8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007e0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000007e8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007f0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000007f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000800] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000808] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000810] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000818] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000820] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000828] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000830] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000838] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000840] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000848] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000850] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000858] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000860] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000870] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000878] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000880] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000888] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000008b8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008c8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008d0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008d8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000008e0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000008e8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000008f0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000008f8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000900] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000908] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000910] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000918] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000920] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000928] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000930] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000938] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000940] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000948] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000950] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000958] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000960] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000968] */ 0x0c9e74c0, 0x10020827, // add r0, r2, r3 -+-/* [0x00000970] */ 0x159dffc0, 0x100208e7, // mov r3, rb31 -+-/* [0x00000978] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00000980] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000988] */ 0x8d5847f6, 0xd00269e1, // sub.setf -, r3, 4 ; mov r1, ra22 -+-/* [0x00000990] */ 0xffffff20, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000998] */ 0x553e7d81, 0x100243a0, // mov ra14, ra15 ; mul24 r0, r0, r1 -+-/* [0x000009a0] */ 0x0f9c81c0, 0xd00203e7, // asr ra15, r0, 8 ; nop -+-/* [0x000009a8] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x000009b0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009b8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009c0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009c8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009e8] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009f0] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x000009f8] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a00] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a08] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a10] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a18] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a20] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a28] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a30] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a40] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a48] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a50] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a58] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a60] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a68] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_interrupt_exit8 -++/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+ /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-// ::mc_interrupt_exit8 -+-/* [0x00000aa8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b10] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b18] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 1fb3e37..3fac45f 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -5,10 +5,10 @@ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 318) -+-#define mc_filter_uv_b (rpi_shader + 484) -+-#define mc_exit (rpi_shader + 664) -+-#define mc_interrupt_exit8 (rpi_shader + 682) -+-#define mc_end (rpi_shader + 712) -++#define mc_filter_uv_b0 (rpi_shader + 316) -++#define mc_filter_uv_b (rpi_shader + 476) -++#define mc_exit (rpi_shader + 650) -++#define mc_interrupt_exit8 (rpi_shader + 668) -++#define mc_end (rpi_shader + 698) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 02e95dd..10f5113 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -221,8 +221,6 @@ add r0, r0, r1 # Combine width and height of destination area -+ shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+ add rb26, r0, rb27 -+ -+-sub.setf -,8,r1 # 8-r1, so if <0 (negative) we need to use the full code -+- -+ # get filter coefficients -+ -+ mov r0, unif -+@@ -410,20 +408,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 4 ; mov r1, ra22 -+- -+-# apply horizontal filter -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 4 ; mov ra12, ra13 -+ brr.anyn -, r:uvloop_b0 -+-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll -+-asr ra15, r0, 8 ; nop # TODO isn't ra15 already in 24bit precision, may not need the sign extension here? -+-nop ; nop # Delay slot 3 (TODO move more of the context scroll into here) -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+@@ -432,9 +422,9 @@ nop ; mul24 r0, ra13, rb9 -+ add r1, r1, r0 ; mul24 r0, ra12, rb8 -+ add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++sub.setf -, r3, rb18 -+ brr.anyn -, r:uvloop_b0 -+-asr vpm, r1, 14 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision TODO may be able to avoid the mul24 and use more delay slots -++asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still in 16bit precision -+ nop # Delay 2 -+ nop # Delay 3 -+ -+@@ -554,19 +544,12 @@ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r0, r2, r3 -+- -+-mov r3, rb31 -+- -+-mov ra12, ra13 -+-mov ra13, ra14 -+- -+-sub.setf -, r3, 4 ; mov r1, ra22 -+-# apply horizontal filter -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 4 ; mov ra12, ra13 -+ brr.anyn -, r:uvloop_b -+-mov ra14, ra15 ; mul24 r0, r0, r1 # last bit of context scroll, including clamp to zero -+-asr ra15, r0, 8 ; nop -+-nop ; nop # TODO improve use of delay slots -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+-- -+2.7.4 -+ -+ -+From af59f8e00eb977e97debc5e72ba47e0077db1787 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:31:23 +0100 -+Subject: [PATCH 32/68] Avoid writeback of first B results -+ -+--- -+ libavcodec/rpi_shader.c | 229 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 8 +- -+ libavcodec/rpi_shader.qasm | 18 +--- -+ 3 files changed, 121 insertions(+), 134 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index c498f28..ba453a2 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -255,130 +255,125 @@ unsigned int rpi_shader[] = { -+ /* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+ /* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -+ /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000728] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000730] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000738] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000740] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000748] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000750] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000758] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000760] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000768] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000770] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000778] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000780] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000788] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000790] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000798] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007a0] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007a8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007b0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000007b8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007c0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000007c8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007d0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000007d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007e0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000007e8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000007f0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000007f8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000800] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000808] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000810] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000818] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000820] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000828] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000830] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000838] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000840] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+ /* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000850] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000858] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000860] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000868] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000878] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000880] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000888] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000898] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008a0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008a8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008b0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008b8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000008c0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000008c8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000008d0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000008d8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000008e0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000008e8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000008f0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000008f8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000900] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000908] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000910] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000918] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000920] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000928] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000930] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000938] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000940] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000948] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000950] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000958] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000960] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000968] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000970] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000978] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000980] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000988] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000990] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000998] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009a0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009a8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009b0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009b8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x000009c0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009c8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x000009d0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000009d8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000009e0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000009e8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009f0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000009f8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a08] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a10] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a28] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a30] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a48] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a58] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a60] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a68] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000a70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000aa8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ab0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ab8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ac0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ad8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000ae0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 3fac45f..45dbe0e 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -6,9 +6,9 @@ extern unsigned int rpi_shader[]; -+ #define mc_setup_uv (rpi_shader + 0) -+ #define mc_filter_uv (rpi_shader + 152) -+ #define mc_filter_uv_b0 (rpi_shader + 316) -+-#define mc_filter_uv_b (rpi_shader + 476) -+-#define mc_exit (rpi_shader + 650) -+-#define mc_interrupt_exit8 (rpi_shader + 668) -+-#define mc_end (rpi_shader + 698) -++#define mc_filter_uv_b (rpi_shader + 466) -++#define mc_exit (rpi_shader + 640) -++#define mc_interrupt_exit8 (rpi_shader + 658) -++#define mc_end (rpi_shader + 688) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 10f5113..e138c95 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -428,22 +428,14 @@ asr vpm, r1, 6 # Delay 1 shifts down by shift2=6, but results are still -+ nop # Delay 2 -+ nop # Delay 3 -+ -++# in pass0 we don't really need to save any results, but need to discard the uniforms -+ # DMA out for U -+ -+-mov vw_setup, rb26 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW # TODO in pass0 we don't need to save any results -+- -+-# DMA out for V -+-# We need to wait for the U to complete first, but have nothing useful to compute while we wait. -+-# Could potentially push this write into the start of the next pipeline stage. -+-mov r0, 16 -+-mov -, vw_wait -+- -+ bra -, ra31 -+-add vw_setup, rb26, r0 # VDW setup 0 -+-mov vw_setup, rb29 # Stride -+-mov vw_addr, unif # start the VDW -++mov r0, unif # Delay 1 -++mov r0, unif # Delay 2 -++nop # Delay 3 -++ -+ -+ ################################################################################ -+ -+-- -+2.7.4 -+ -+ -+From 12e57278cb19a769d2e1488e8e94003027493d09 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 14 May 2015 11:36:24 +0100 -+Subject: [PATCH 33/68] Cutdown size of chroma prediction commands -+ -+--- -+ libavcodec/hevc.c | 17 +- -+ libavcodec/rpi_shader.c | 543 ++++++++++++++++++++++----------------------- -+ libavcodec/rpi_shader.h | 12 +- -+ libavcodec/rpi_shader.qasm | 11 +- -+ 4 files changed, 281 insertions(+), 302 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index a47ebc5..32b89d5 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -56,7 +56,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ #ifdef RPI_INTER_QPU -+ -+-#define RPI_CHROMA_COMMAND_WORDS 12 -++#define RPI_CHROMA_COMMAND_WORDS 10 -+ #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+@@ -2032,11 +2032,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2091,9 +2088,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+- u++; -+ *u++ = rpi_filter_coefs[_my][0]; -+- u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2154,11 +2149,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); // TODO this will become unused once we have a dedicated pass0 filter -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ u+=2; // Intermediate results are not written back in first pass of B filtering -+ -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -+@@ -2166,11 +2158,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+ *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx2][0]; -+- u++; -+ *u++ = rpi_filter_coefs[_my2][0]; -+- u++; -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2808,7 +2797,7 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -+- s->u_mvs[i] += 3; // Padding words -++ s->u_mvs[i] += 1; // Padding words -+ } -+ } -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index ba453a2..b0b93b5 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -89,291 +89,286 @@ unsigned int rpi_shader[] = { -+ /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+ /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+ /* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000218] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000348] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000360] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000368] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000370] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000378] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000380] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000388] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000390] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000398] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000003e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000003f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000003f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000400] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000408] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000410] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000418] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000420] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000428] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000430] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000438] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000440] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000448] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000450] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000458] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000460] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000468] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000470] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000478] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000480] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000488] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000490] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000498] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004a0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004a8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004b0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004b8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004c0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004c8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004d0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004d8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000004e0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004e8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -++/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000004f0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000004f8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000500] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000508] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000510] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000518] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000520] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000528] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000530] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000538] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000540] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000548] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000550] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000558] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000560] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000568] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000570] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000578] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000580] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000588] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000590] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000598] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005a0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005b0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005b8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005d8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005e8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005f0] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000005f8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000600] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000608] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000610] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000618] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000620] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000628] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000630] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000638] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000640] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000648] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000650] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000658] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000668] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000670] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000678] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000680] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000688] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000690] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000698] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006a0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006a8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x000006b0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x000006b8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006c0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006c8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000006d0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000006d8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000006e0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000006e8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000006f0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000006f8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000700] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000708] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000710] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -++/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif -+ /* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000728] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000738] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000740] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000748] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000750] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000758] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000760] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000768] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000770] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000778] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000780] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000788] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000790] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000798] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000007a0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000007b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000007c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000007c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000007d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000007d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000007e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000007e8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000007f0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000007f8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000800] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000808] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000810] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000818] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000828] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000830] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000838] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000840] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000848] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000850] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000858] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000860] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000868] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000890] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000008d0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a18] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a58] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 45dbe0e..99927c4 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 316) -+-#define mc_filter_uv_b (rpi_shader + 466) -+-#define mc_exit (rpi_shader + 640) -+-#define mc_interrupt_exit8 (rpi_shader + 658) -+-#define mc_end (rpi_shader + 688) -++#define mc_filter_uv (rpi_shader + 148) -++#define mc_filter_uv_b0 (rpi_shader + 310) -++#define mc_filter_uv_b (rpi_shader + 458) -++#define mc_exit (rpi_shader + 630) -++#define mc_interrupt_exit8 (rpi_shader + 648) -++#define mc_end (rpi_shader + 678) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index e138c95..d9ffcda 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -167,8 +167,6 @@ add t0s, r2, r1 -+ -+ # Dump padding words -+ mov r0, unif -+-mov r0, unif -+-mov r0, unif -+ -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+@@ -228,11 +226,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+- mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -++asr rb8, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -362,11 +359,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+- mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -++asr rb8, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+@@ -490,11 +486,10 @@ asr ra3, r0, rb23; mul24 r0, r0, ra22 -+ asr ra2, r0, rb23; mul24 r0, r0, ra22 -+ asr ra1, r0, rb23; mul24 r0, r0, ra22 -+ asr ra0, r0, rb23; mov r0, unif -+- mov r0, unif -+ asr rb11, r0, rb23; mul24 r0, r0, ra22 -+ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -++asr rb8, r0, rb23 -+ -+ # r2 is elem_num -+ # r3 is loop counter -+-- -+2.7.4 -+ -+ -+From 3e8f02cf9d3e4bfcd07a5fcf321ace07c4f2e6f3 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:21:49 +0100 -+Subject: [PATCH 34/68] hevc: don't redirect when not rpi_enabled -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 32b89d5..2459e34 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -1468,7 +1468,7 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) -+ */ -+ -+ #ifdef RPI_INTER -+-#define RPI_REDIRECT(fn) rpi_ ## fn -++#define RPI_REDIRECT(fn) (s->enable_rpi ? rpi_ ## fn : fn) -+ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+-- -+2.7.4 -+ -+ -+From 6da455b382b28c3c1f4e98c1703a695cdb946ad3 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:22:02 +0100 -+Subject: [PATCH 35/68] Use /dev/vcio for mailbox access -+ -+--- -+ libavcodec/rpi_mailbox.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -+index 536896f..77a56dd 100644 -+--- a/libavcodec/rpi_mailbox.c -++++ b/libavcodec/rpi_mailbox.c -+@@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+ #define MAJOR_NUM 100 -+ #define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) -+-#define DEVICE_FILE_NAME "/dev/char_dev" -++#define DEVICE_FILE_NAME "/dev/vcio" -+ -+ #include "rpi_mailbox.h" -+ -+-- -+2.7.4 -+ -+ -+From f96ef6131f16a4c03b8e2882bdf7319c3b646a6c Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:25:25 +0100 -+Subject: [PATCH 36/68] Use vcsm for all memory allocations -+ -+--- -+ libavcodec/rpi_qpu.c | 174 +++++++++++++++++++-------------------------------- -+ 1 file changed, 64 insertions(+), 110 deletions(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 60bf079..f62051f 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -1,7 +1,5 @@ -+ #ifdef RPI -+-// define RPI_USE_VCSM to use the vcsm device for shared memory -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+-#define RPI_USE_VCSM -+ // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+ #define RPI_TIME_TOTAL_QPU -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+@@ -25,9 +23,7 @@ -+ #include "rpi_shader.h" -+ #include "rpi_hevc_transform.h" -+ -+-#ifdef RPI_USE_VCSM -+ #include "rpi_user_vcsm.h" -+-#endif -+ -+ // On Pi2 there is no way to access the VPU L2 cache -+ // GPU_MEM_FLG should be 4 for uncached memory. (Or C for alias to allocate in the VPU L2 cache) -+@@ -96,7 +92,6 @@ struct GPU -+ unsigned int vpu_code[VPU_CODE_SIZE]; -+ short transMatrix2even[16*16*2]; -+ int open_count; // Number of allocated video buffers -+- unsigned int vc_handle; // Handle of this memory -+ int mb; // Mailbox handle -+ int vc; // Address in GPU memory -+ int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -+@@ -105,6 +100,7 @@ struct GPU -+ // Stop more than one thread trying to allocate memory or use the processing resources at once -+ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+ static volatile struct GPU* gpu = NULL; -++static GPU_MEM_PTR_T gpu_mem_ptr; -+ -+ #if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -+ static unsigned int Microseconds(void) { -+@@ -132,39 +128,27 @@ static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+ static volatile int vpu_async_head=0; -+ #endif -+ -++static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb); -++static void gpu_free_internal(GPU_MEM_PTR_T *p); -++ -+ // Connect to QPU, returns 0 on success. -+ static int gpu_init(volatile struct GPU **gpu) { -+ int mb = mbox_open(); -+ int vc; -+- int handle; -+ volatile struct GPU* ptr; -+ if (mb < 0) -+ return -1; -+ -+ if (qpu_enable(mb, 1)) return -2; -+ -+-#ifdef RPI_USE_VCSM -+ vcsm_init(); -+-#endif -++ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -++ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -++ memset(ptr, 0, sizeof *ptr); -++ vc = gpu_mem_ptr.vc; -+ -+- handle = mem_alloc(mb, sizeof(struct GPU), 4096, GPU_MEM_FLG); -+- if (!handle) -+- { -+- qpu_enable(mb, 0); -+- return -3; -+- } -+- vc = mem_lock(mb, handle); -+- ptr = mapmem_shared((vc+GPU_MEM_MAP)&~0xc0000000, sizeof(struct GPU)); -+- if (ptr == NULL) -+- { mem_free(mb, handle); -+- mem_unlock(mb, handle); -+- qpu_enable(mb, 0); -+- return -4; -+- } -+- -+- ptr->mb = mb; -+- ptr->vc_handle = handle; -+- ptr->vc = vc; -++ ptr->mb = mb; -++ ptr->vc = vc; -+ -+ printf("GPU allocated at 0x%x\n",vc); -+ -+@@ -226,94 +210,74 @@ static void gpu_unlock(void) { -+ pthread_mutex_unlock(&gpu_mutex); -+ } -+ -++static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -++ assert(p->vcsm_handle); -++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -++ assert(p->vc_handle); -++ p->arm = vcsm_lock(p->vcsm_handle); -++ assert(p->arm); -++ p->vc = mem_lock(mb, p->vc_handle); -++ assert(p->vc); -++ return 0; -++} -++ -+ // Allocate memory on GPU -+ // Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes -+ // Returns 0 on success. -+ // This allocates memory that will not be cached in ARM's data cache. -+ // Therefore safe to use without data cache flushing. -+-int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) { -++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -++{ -++ int r; -+ gpu_lock(); -+- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -+- p->vcsm_handle = 0; -+- if (!p->vc_handle) -+- { -+- qpu_enable(gpu->mb, 0); -+- return -3; -+- } -+- p->vc = mem_lock(gpu->mb, p->vc_handle); -+- p->arm = mapmem_shared((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -+- p->numbytes = numbytes; -+- if (p->arm == NULL) -+- { -+- mem_free(gpu->mb, p->vc_handle); -+- mem_unlock(gpu->mb, p->vc_handle); -+- gpu_unlock(); -+- qpu_enable(gpu->mb, 0); -+- return -4; -+- } -++ r = gpu_malloc_uncached_internal(numbytes, p, gpu->mb); -+ gpu->open_count++; -+ gpu_unlock(); -+- return 0; -++ return r; -+ } -+ -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+- // This only works when using RPI_USE_VCSM -+ void *tmp = vcsm_lock(p->vcsm_handle); -+ vcsm_unlock_ptr(tmp); -+ } -+ -++static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -++ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -++ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); -++ assert(p->vcsm_handle); -++ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -++ assert(p->vc_handle); -++ p->arm = vcsm_lock(p->vcsm_handle); -++ assert(p->arm); -++ p->vc = mem_lock(gpu->mb, p->vc_handle); -++ assert(p->vc); -++ return 0; -++} -++ -+ // This allocates data that will be -+ // Cached in ARM L2 -+ // Uncached in VPU L2 -+-int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) { -++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) -++{ -++ int r; -+ gpu_lock(); -+-#ifdef RPI_USE_VCSM -+- { -+- p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); // f....... locks up for VP9 - retest this? -+- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); // 3b...... works -+- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); //fb...... locks up -+- //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); // 3b works (but corrupted due to caching) -+- p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+- p->arm = vcsm_lock(p->vcsm_handle); -+- p->vc = mem_lock(gpu->mb, p->vc_handle); -+- } -+-#else -+- p->vc_handle = mem_alloc(gpu->mb, numbytes, 4096, GPU_MEM_FLG); -+- p->vcsm_handle = 0; -+- if (!p->handle) -+- { -+- qpu_enable(gpu->mb, 0); -+- return -3; -+- } -+- p->vc = mem_lock(gpu->mb, p->vc_handle); -+- printf("This mapmem_private does not seem to work\n"); -+- exit(-1); -+- p->arm = mapmem_private((p->vc+GPU_MEM_MAP)&~0xc0000000,numbytes); -+- p->numbytes = numbytes; -+- if (p->arm == NULL) -+- { -+- mem_free(gpu->mb, p->handle); -+- mem_unlock(gpu->mb, p->handle); -+- gpu_unlock(); -+- qpu_enable(gpu->mb, 0); -+- return -4; -+- } -+-#endif -++ r = gpu_malloc_cached_internal(numbytes, p); -+ gpu->open_count++; -+ gpu_unlock(); -+- return 0; -++ return r; -+ } -+ -+ static void gpu_term(void) -+ { -+- int mb; -+- unsigned handle; -++ int mb; -+ -+ if (gpu==NULL) -+ return; -+ mb = gpu->mb; -+- handle = gpu->vc_handle; -+ -+ #ifdef RPI_ASYNC -+ { -+@@ -323,37 +287,26 @@ static void gpu_term(void) -+ } -+ #endif -+ -++ qpu_enable(mb, 0); -++ gpu_free_internal(&gpu_mem_ptr); -+ -+- unmapmem((void*)gpu, sizeof(struct GPU)); -+- mem_unlock(mb, handle); -+- mem_free(mb, handle); -+- qpu_enable(mb, 0); -+-#ifdef RPI_USE_VCSM -+ vcsm_exit(); -+-#endif -+- mbox_close(mb); -++ -++ mbox_close(mb); -+ gpu = NULL; -+ } -+ -+-void gpu_free(GPU_MEM_PTR_T *p) { -++void gpu_free_internal(GPU_MEM_PTR_T *p) { -+ int mb = gpu->mb; -+- unsigned handle = p->vc_handle; -++ mem_unlock(mb,p->vc_handle); -++ vcsm_unlock_ptr(p->arm); -++ vcsm_free(p->vcsm_handle); -++} -++ -++void gpu_free(GPU_MEM_PTR_T *p) { -+ gpu_lock(); -+-#ifdef RPI_USE_VCSM -+- if (p->vcsm_handle) { -+- mem_unlock(mb,p->vc_handle); -+- vcsm_unlock_ptr(p->arm); -+- vcsm_free(p->vcsm_handle); -+- } else { -+- unmapmem((void*)p->arm, sizeof(struct GPU)); -+- mem_unlock(mb, handle); -+- mem_free(mb, handle); -+- } -+-#else -+- unmapmem((void*)p->arm, sizeof(struct GPU)); -+- mem_unlock(mb, handle); -+- mem_free(mb, handle); -+-#endif -++ -++ gpu_free_internal(p); -+ -+ gpu->open_count--; -+ if (gpu->open_count==0) { -+@@ -386,20 +339,21 @@ unsigned int vpu_get_constants(void) { -+ -+ static void *vpu_start(void *arg) { -+ while(1) { -++ int *p; -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+ //printf("Checking number %d %d\n",vpu_async_head,vpu_async_tail); -+ pthread_cond_wait(&post_cond_tail, &post_mutex); -+ } -+- int *p = vpu_cmds[vpu_async_head%MAXCMDS]; -++ p = vpu_cmds[vpu_async_head%MAXCMDS]; -+ pthread_mutex_unlock(&post_mutex); -+ -+ if (p[6] == -1) { -+ break; // Last job -+ } -+ if (p[7]) { -+- GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -++ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+ } -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+-- -+2.7.4 -+ -+ -+From 7c94b833b48a455d27d82eb2ca1b53a162705caf Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 15:43:17 +0100 -+Subject: [PATCH 37/68] Enable EARLY_MALLOC and fix sps access bug -+ -+--- -+ libavcodec/hevc.c | 5 +++-- -+ 1 file changed, 3 insertions(+), 2 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 2459e34..4e82a15 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -44,7 +44,7 @@ -+ #ifdef RPI -+ #include "rpi_qpu.h" -+ // For some unknown reason, the code seems to crash if I do a late malloc -+- #define EARLY_MALLOC -++ //#define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -+ #endif -+@@ -149,7 +149,8 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ #ifdef RPI -+ #ifdef EARLY_MALLOC -+ #else -+- int coeffs_in_ctb = (1 << s->ps.sps->log2_ctb_size) * (1 << s->ps.sps->log2_ctb_size); -++ assert(sps); -++ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+ printf("pic_arrays_init\n"); -+ printf("Allocated %d\n",coefs_per_row); -+-- -+2.7.4 -+ -+ -+From 0a0a92817a7959d213dca9c75a242b6ad88d6b80 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 14 May 2015 16:40:51 +0100 -+Subject: [PATCH 38/68] Add copy of av_mod_uintp2 for use with stable ffmpeg -+ -+--- -+ libavcodec/hevc.c | 8 ++++++++ -+ 1 file changed, 8 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 4e82a15..80db603 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -51,6 +51,14 @@ -+ -+ // #define DISABLE_MC -+ -++#ifndef av_mod_uintp2 -++static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) -++{ -++ return a & ((1 << p) - 1); -++} -++# define av_mod_uintp2 av_mod_uintp2_c -++#endif -++ -+ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ -+ -+-- -+2.7.4 -+ -+ -+From c48d08e968b24c2e260b0cc76c7901a1b4d75bbf Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 18 May 2015 11:11:02 +0100 -+Subject: [PATCH 39/68] Added support for weighted prediction in P frames -+ -+--- -+ libavcodec/hevc.c | 52 ++++- -+ libavcodec/rpi_shader.c | 566 +++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 12 +- -+ libavcodec/rpi_shader.qasm | 39 +++- -+ 4 files changed, 384 insertions(+), 285 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 80db603..9668ef8 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -64,7 +64,7 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ #ifdef RPI_INTER_QPU -+ -+-#define RPI_CHROMA_COMMAND_WORDS 10 -++#define RPI_CHROMA_COMMAND_WORDS 12 -+ #define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+@@ -2031,6 +2031,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ int chan = x0>>8; -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+@@ -2043,6 +2045,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_csh.chroma_offset_l0[current_mv.ref_idx[0]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1] & 0xffff); -++ } else { -++ *u++ = 1; // Weight of 1 and offset of 0 -++ *u++ = 1; -++ } -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2085,6 +2094,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+ //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ int chan = x0>>8; -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+@@ -2098,6 +2109,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ // TODO chroma weight and offset... s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_my][0]; -++ if (weight_flag) { -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); -++ } else { -++ *u++ = 1; // Weight of 1 and offset of 0 -++ *u++ = 1; -++ } -+ *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2159,6 +2177,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_cmc_filter_uv_b; -+@@ -2169,6 +2188,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = ( (nPbW_cframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+@@ -2795,6 +2815,9 @@ static void rpi_inter_clear(HEVCContext *s) -+ int i; -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -++ -+ for(i=0;i<8;i++) { -+ s->u_mvs[i] = s->mvs_base[i]; -+ *s->u_mvs[i]++ = 0; -+@@ -2806,6 +2829,13 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -++ if (weight_flag) { -++ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -++ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -++ } else { -++ *s->u_mvs[i]++ = 1 << 5; -++ *s->u_mvs[i]++ = 6; -++ } -+ s->u_mvs[i] += 1; // Padding words -+ } -+ } -+@@ -2849,12 +2879,29 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+ #ifdef RPI -++#ifdef RPI_INTER_QPU -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+ && s->ps.sps->width <= RPI_MAX_WIDTH -+ && !s->ps.pps->cross_component_prediction_enabled_flag -+ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -+- && !(s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -+ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -++#else -++ s->enable_rpi = s->ps.sps->bit_depth == 8 -++ && s->ps.sps->width <= RPI_MAX_WIDTH -++ && !s->ps.pps->cross_component_prediction_enabled_flag -++ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -++#endif -++ -++ /*if (!s->enable_rpi) { -++ if (s->ps.pps->cross_component_prediction_enabled_flag) -++ printf("Cross component\n"); -++ if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -++ printf("Tiles\n"); -++ if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -++ printf("Weighted P slice\n"); -++ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -++ printf("Weighted B slice\n"); -++ }*/ -+ -+ #endif -+ -+@@ -2987,6 +3034,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int -+ -+ #ifdef RPI -+ s->enable_rpi = 0; -++ //printf("Wavefront\n"); -+ #endif -+ -+ if(ctb_row) { -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index b0b93b5..3f04d80 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -88,287 +88,307 @@ unsigned int rpi_shader[] = { -+ /* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ /* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+ /* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -++/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -+ // ::mc_filter_uv -+-/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000350] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000358] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000360] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -++/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000368] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000370] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000378] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000380] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000388] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000390] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000398] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003a8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003b0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000003b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000003d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000003d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000003e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000003e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000003f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000003f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000400] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000408] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000410] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000418] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000420] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000428] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000430] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000438] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000440] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000448] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000450] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000458] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000460] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000468] */ 0x0c567380, 0x10020867, // add r1, r1, ra21 -+-/* [0x00000470] */ 0xfffffed8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000478] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -+-/* [0x00000480] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000488] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000490] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000498] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000004a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000004b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000004b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000004c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000004c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000004d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 -++/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 -++/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 -++/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 -++/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x000004d8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000004e0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000004e8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000004f0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000004f8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000500] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000508] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000510] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000518] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000520] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000528] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000530] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000538] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000540] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000548] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000550] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000558] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000560] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000568] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000570] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000578] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000580] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000588] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000590] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000598] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000005b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000005d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000005d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000005e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000005e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x000005f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000005f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000600] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000608] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000610] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000618] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000620] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000628] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000630] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000638] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000640] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000648] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000650] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000658] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000660] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000668] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000670] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000678] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000680] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000688] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000690] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000698] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000006a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000006b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000006b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000006c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000006c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000006d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000006d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000006e0] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x000006e8] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x000006f0] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x000006f8] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000700] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000708] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000710] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000718] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000720] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000728] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000730] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000738] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000740] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000748] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000750] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000758] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000760] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000768] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000770] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000778] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000780] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000788] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000798] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000007a0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000007a8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000007b0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000007b8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000007c0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000007c8] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x000007d0] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x000007d8] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x000007e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000007e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000007f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000007f8] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000808] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000810] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000818] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000820] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000828] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000830] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000838] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000840] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000848] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000850] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000858] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -++/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -++/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000860] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000868] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000870] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000878] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000880] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000888] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000890] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000898] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000008a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000008a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000008b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000008c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000008c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000008d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000008d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000008e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000008e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000008f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000008f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000900] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000908] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000910] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000918] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000920] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000928] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000930] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000938] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000940] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000948] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000950] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x00000958] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000960] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000968] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000970] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000978] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000980] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000988] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000990] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000998] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009a0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x000009a8] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x000009b0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000009b8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000009c0] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x000009c8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x000009d0] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -++/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -++/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -++/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x000009e0] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x000009e8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009f0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x000009f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a00] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a08] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a10] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a18] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000a20] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a28] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a30] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a38] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a40] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a48] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a50] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a58] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a60] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a68] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000a80] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a88] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 99927c4..cec9901 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,11 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 148) -+-#define mc_filter_uv_b0 (rpi_shader + 310) -+-#define mc_filter_uv_b (rpi_shader + 458) -+-#define mc_exit (rpi_shader + 630) -+-#define mc_interrupt_exit8 (rpi_shader + 648) -+-#define mc_end (rpi_shader + 678) -++#define mc_filter_uv (rpi_shader + 152) -++#define mc_filter_uv_b0 (rpi_shader + 342) -++#define mc_filter_uv_b (rpi_shader + 494) -++#define mc_exit (rpi_shader + 670) -++#define mc_interrupt_exit8 (rpi_shader + 688) -++#define mc_end (rpi_shader + 718) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index d9ffcda..97c4c02 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -9,7 +9,12 @@ -+ # (ra15 isn't clamped to zero - this happens during the -+ # copy to ra14, and during its use in the vertical filter) -+ # -+-# rb8...rb15 eight vertical filter coefficients -++# rb8...rb11 eight vertical filter coefficients -++ -++# rb12 offset to add before shift -++# rb13 shift -++# rb14 weight (U on left, V on right) -++# rb15 offset (U on left, V on right) -+ # -+ # ra16 clipped(row start address+elem_num)&~3 -+ # ra17 per-channel shifts -+@@ -165,6 +170,9 @@ add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ add t0s, r0, r1 ; mov ra_x2_base, r2 -+ add t0s, r2, r1 -+ -++mov rb12,unif # offset before shift -++mov rb13,unif # offset after shift -++ -+ # Dump padding words -+ mov r0, unif -+ -+@@ -231,11 +239,21 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23 -+ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++mov r0, unif # U offset/weight -++asr rb15, r0, r2 # Compute offset from MSBs -++shl r0, r0, r2 -++asr rb14, r0, r2 # Compute weight from LSBs -++mov r0, unif # V offset/weight -++asr.ifnz rb15, r0, r2 -++shl r0, r0, r2 -++asr.ifnz rb14, r0, r2 -++ -+ # r2 is elem_num -+ # r3 is loop counter -+ -+ mov r5rep, -8 -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+@@ -279,6 +297,11 @@ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -++mov rb12,32 -++mov rb13,6 -++mov rb14,1 -++mov rb15,0 -++ -+ # apply vertical filter and write to VPM -+ -+ nop ; mul24 r1, ra14, rb10 -+@@ -288,9 +311,11 @@ add r1, r1, r0 ; mul24 r0, ra15, rb11 -+ add r1, r1, r0 ; mov -, vw_wait -+ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+ asr r1, r1, 14 -+-add r1, r1, ra21 -++nop ; mul24 r1, r1, rb14 -++add r1, r1, rb12 -++asr r1, r1, rb13 -+ brr.anyn -, r:uvloop -+-asr r1, r1, 6 # Delay 1 -++add r1, r1, rb15 # Delay 1 -+ min r1, r1, rb22 # Delay 2 -+ max vpm, r1, 0 # Delay 3 -+ -+@@ -364,6 +389,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23 -+ -++mov r0, unif # U offset/weight -++mov r0, unif # V offset/weight -++ -+ # r2 is elem_num -+ # r3 is loop counter -+ -+@@ -491,6 +519,9 @@ asr rb10, r0, rb23; mul24 r0, r0, ra22 -+ asr rb9, r0, rb23; mul24 r0, r0, ra22 -+ asr rb8, r0, rb23 -+ -++mov r0, unif # U offset/weight -++mov r0, unif # V offset/weight -++ -+ # r2 is elem_num -+ # r3 is loop counter -+ -+-- -+2.7.4 -+ -+ -+From 310d994ea39e29b41a6a013abc4d94e6b90487b2 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 19 May 2015 08:43:30 +0100 -+Subject: [PATCH 40/68] Improved ordering of tasks -+ -+--- -+ libavcodec/hevc.c | 8 ++++---- -+ 1 file changed, 4 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 9668ef8..951e2d3 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2943,15 +2943,15 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+ s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+-#ifdef RPI_INTER_QPU -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+-#endif -+ // Transform all blocks -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -++#ifdef RPI_INTER_QPU -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++#endif -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+-- -+2.7.4 -+ -+ -+From d6e1ce7898196e49e52a6223c12979b3d0014588 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 20 May 2015 19:58:19 +0100 -+Subject: [PATCH 41/68] Drafted Luma inter prediction -+ -+--- -+ libavcodec/rpi_shader.qasm | 594 ++++++++++++++++++++++++++++++++++++++++++--- -+ 1 file changed, 554 insertions(+), 40 deletions(-) -+ -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 97c4c02..9cfc0d9 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -2,7 +2,10 @@ -+ # -+ # ra0...ra7 eight horizontal filter coefficients -+ # -+-# rb1...rb7 seven shifted copies of the current unfiltered row -++# rb0 rx_shift2 -++# rb1 ra_y2_next -++# -++# rb4...rb7 -+ # -+ # ra8...ra15 eight filtered rows of context (rb15 == most recent) -+ # -+@@ -26,9 +29,9 @@ -+ # rb19 next ra16 -+ # -+ # ra20 1 -+-# ra21 32 -++# ra21 ra_21 -+ # ra22 256 -+-# ra23 8 -++# ra23 rx_shift2_next -+ # -+ # rb20 0xffffff00 -+ # rb21 vpm_setup for reading/writing 16bit results into VPM -+@@ -57,16 +60,23 @@ -+ .set rb_frame_width_minus_1, rb25 -+ .set rb_frame_height_minus_1, rb30 -+ .set rb_pitch, rb16 -+-.set ra_x_base, ra16 -+-.set rb_x_base_next, rb19 -+-.set ra_x2_base, ra24 -+-.set ra_x2_base_next, ra26 -++.set ra_x, ra16 -++.set ra_y2, ra21 -++.set ra_y2_next, rb1 -++ -++.set rb_x_next, rb19 -++.set rx_frame_base2_next, rb19 -++ -++.set ra_frame_base, ra24 -++.set ra_frame_base_next, ra26 -+ .set ra_xshift, ra17 -+ -+-.set ra_x2shift, ra25 -+ .set ra_u2v_ref_offset, ra25 -++.set ra_frame_base2, ra25 -+ -+ .set ra_xshift_next, ra19 -++.set rx_xshift2, rb0 -++.set rx_xshift2_next, ra23 -+ -+ .set ra_x2shift_next, ra27 -+ .set ra_u2v_dst_offset, ra27 -+@@ -83,11 +93,11 @@ -+ mov ra31, unif -+ -+ # Load first request location -+-add ra_x_base, unif, elem_num # Store x -++add ra_x, unif, elem_num # Store x -+ mov ra_y, unif # Store y -+-mov ra_x2_base, unif # Store frame u base -++mov ra_frame_base, unif # Store frame u base -+ nop -+-sub ra_u2v_ref_offset, unif, ra_x2_base # Store offset to add to move from u to v in reference frame -++sub ra_u2v_ref_offset, unif, ra_frame_base # Store offset to add to move from u to v in reference frame -+ -+ # Read image dimensions -+ sub rb25,unif,1 -+@@ -104,9 +114,7 @@ add rb24, r1, r0 -+ # load constants -+ -+ mov ra20, 1 -+-mov ra21, 32 -+ mov ra22, 256 -+-mov ra23, 8 -+ mov ra30, 64 -+ -+ mov rb20, 0xffffff00 -+@@ -156,18 +164,18 @@ mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which i -+ add rb21, r0, r1 -+ -+ # Compute base address for first and second access -+-mov r0, ra_x_base # Load x -++mov r0, ra_x # Load x -+ max r0, r0, 0; mov r1, ra_y # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base # Load the frame base -++min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base # Load the frame base -+ shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+ add ra_y, r1, 1 -+ add r0, r0, r3 -+ and r0, r0, ~3 -+-max r1, r1, 0 ; mov ra_x_base, r0 # y -++max r1, r1, 0 ; mov ra_x, r0 # y -+ min r1, r1, rb_frame_height_minus_1 -+ # submit texture requests for first line -+ add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-add t0s, r0, r1 ; mov ra_x2_base, r2 -++add t0s, r0, r1 ; mov ra_frame_base, r2 -+ add t0s, r2, r1 -+ -+ mov rb12,unif # offset before shift -+@@ -182,8 +190,8 @@ min r1, r1, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 -+ bra -, ra31 -+ nop ; mul24 r1, r1, rb_pitch -+-add t0s, r1, ra_x_base -+-add t0s, r1, ra_x2_base -++add t0s, r1, ra_x -++add t0s, r1, ra_frame_base -+ -+ -+ -+@@ -192,7 +200,7 @@ add t0s, r1, ra_x2_base -+ # mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+ -+ # At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -++# ra_x, ra_x16_base point to the current coordinates for this block -+ ::mc_filter_uv -+ mov ra31, unif -+ -+@@ -207,9 +215,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+ sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -++and rb_x_next, r0, ~3 -+ mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -++add ra_frame_base_next, rb_x_next, r2 -+ -+ # set up VPM write -+ mov vw_setup, rb28 -+@@ -265,16 +273,16 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -297,7 +305,7 @@ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -+-mov rb12,32 -++mov rb12,32 # TODO remove these to make P weighted prediction work properly -+ mov rb13,6 -+ mov rb14,1 -+ mov rb15,0 -+@@ -342,7 +350,7 @@ mov vw_addr, unif # start the VDW -+ # mc_filter_uv_b0(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -+ -+ # At this point we have already issued two pairs of texture requests for the current block -+-# ra_x_base, ra_x16_base point to the current coordinates for this block -++# ra_x, ra_x16_base point to the current coordinates for this block -+ ::mc_filter_uv_b0 -+ mov ra31, unif -+ -+@@ -357,9 +365,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+ sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -++and rb_x_next, r0, ~3 -+ mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -++add ra_frame_base_next, rb_x_next, r2 -+ -+ # set up VPM write, we need to save 16bit precision -+ mov vw_setup, rb21 -+@@ -408,16 +416,16 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -477,9 +485,9 @@ min r0, r0, rb_frame_width_minus_1 ; mov r3, unif # frame_base -+ shl ra_xshift_next, r0, 3 -+ sub r2, unif, r3 # compute offset from frame base u to frame base v -+ add r0, r0, r3 -+-and rb_x_base_next, r0, ~3 -++and rb_x_next, r0, ~3 -+ mov ra_y_next, r1 -+-add ra_x2_base_next, rb_x_base_next, r2 -++add ra_frame_base_next, rb_x_next, r2 -+ -+ # set up VPM write -+ mov vw_setup, rb28 -+@@ -538,16 +546,16 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_x2_base, r2 -++add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++add t0s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -642,5 +650,511 @@ nop ; nop ; thrend -+ mov interrupt, 1; nop # delay slot 1 -+ nop ; nop # delay slot 2 -+ -++ -++ -++ -++ -++# LUMA CODE -++ -++# The idea is to form B predictions by doing 8 pixels from ref0 in parallel with 8 pixels from ref1. -++# For P frames we make the second x,y coordinates offset by +8 -++ -++################################################################################ -++# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) -++::mc_setup -++ -++# Read starting kernel -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov ra31, unif -++ -++# Compute base address for first and second access -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl ra_xshift_next, r0, 3 # Compute shifts -++add ra_y, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add r2, r2, r0 # r2 is address for frame0 (not including y offset) -++max r1, r1, 0 -++min r1, r1, rb_frame_height_minus_1 -++nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++add t0s, r2, r1 ; mov ra_frame_base, r2 -++ -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl rx_xshift2_next, r0, 3 # Compute shifts -++add ra_y2, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add r2, r2, r0 # r2 is address for frame1 (not including y offset) -++max r1, r1, 0 -++min r1, r1, rb_frame_height_minus_1 -++nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++add t0s, r2, r1 ; mov ra_frame_base2, r2 -++ -++ -++# Read image dimensions -++sub rb25,unif,1 -++sub rb30,unif,1 -++ -++# get source pitch -++mov rb16, unif -++ -++# get destination pitch -++mov r0, unif -++mov r1, vdw_setup_1(0) -++add rb24, r1, r0 -++ -++# load constants -++ -++mov ra20, 1 -++mov ra22, 256 -++mov ra30, 64 -++ -++mov rb20, 0xffffff00 -++mov rb22, 255 -++mov rb23, 24 -++ -++# touch vertical context to keep simulator happy -++ -++mov ra8, 0 -++mov ra9, 0 -++mov ra10, 0 -++mov ra11, 0 -++mov ra12, 0 -++mov ra13, 0 -++mov ra14, 0 -++mov ra15, 0 -++ -++# Compute part of VPM to use for DMA output -++mov r2, qpu_num -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 -++ -++# Compute part of VPM to save data into -++mov r2, qpu_num # qpu_num = abcd -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -++add rb28, r0, r1 -++ -++mov rb12,unif # offset before shift -++mov rb13,unif # shift -++ -++# Dump padding words -++mov r0, unif -++ -++# submit texture requests for second line -++max r1, ra_y, 0 -++min r1, r1, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 -++nop ; mul24 r1, r1, rb_pitch -++add t0s, r1, ra_frame_base -++ -++max r1, ra_y2, 0 -++min r1, r1, rb_frame_height_minus_1 -++bra -, ra31 -++add ra_y2, ra_y2, 1 # Delay 1 -++nop ; mul24 r1, r1, rb_pitch # Delay 2 -++add t0s, r1, ra_frame_base2 # Delay 3 -++ -++ -++################################################################################ -++ -++# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -++# In a P block, only the first half of coefficients contain used information. -++# At this point we have already issued two pairs of texture requests for the current block -++# ra_x, ra_x16_base point to the current coordinates for this block -++::mc_filter -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov rx_xshift2, rx_xshift2_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl ra_xshift_next, r0, 3 # Compute shifts -++mov ra_y_next, r1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -++ -++add r0, unif, elem_num # Load x -++max r0, r0, 0 ; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl rx_xshift2_next, r0, 3 # Compute shifts -++add ra_y2_next, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -++ -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# get filter coefficients and discard unused B frame values -++mov r0, unif -++mov.ifnz -, unif # Alternate coefficients are unused for P frames -++asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++mov.ifnz -, unif -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++asr ra4, r0, rb23; mov r0, unif -++mov.ifnz -, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++mov.ifnz -, unif -++asr rb7, r0, rb23; mul24 r0, r0, ra22 -++asr rb6, r0, rb23; mul24 r0, r0, ra22 -++asr rb5, r0, rb23; mul24 r0, r0, ra22 -++asr rb4, r0, rb23 -++ -++mov r0, unif # Frame0 offset/weight -++mov.ifnz -, unif # Frame1 offset/weight unused -++asr rb15, r0, r2 # Compute offset from MSBs -++shl r0, r0, r2 -++asr rb14, r0, r2 # Compute weight from LSBs -++ -++# r3 is loop counter -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:yloop -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++# If we knew there was no clipping then this code would get simpler. -++# Perhaps we could add on the pitch and clip using larger values? -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, rx_xshift2 -++mov.ifz ra_y2, ra_y2_next -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y2, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# apply horizontal filter -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 8 ; mov ra12, ra13 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++brr.anyn -, r:yloop -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -++add r1, r1, r0 ; mul24 r0, ra8, rb4 -++add r1, r1, r0 ; mul24 r0, ra9, rb5 -++add r1, r1, r0 ; mul24 r0, ra10, rb6 -++add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++add r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 14 -++nop ; mul24 r1, r1, rb14 -++add r1, r1, rb12 -++asr r1, r1, rb13 -++brr.anyn -, r:yloop -++add r1, r1, rb15 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -++ -++# DMA out -++ -++bra -, ra31 -++mov vw_setup, rb26 # VDW setup 0 Delay 1 -++mov vw_setup, rb29 # Stride Delay 2 -++mov vw_addr, unif # start the VDW Delay 3 -++ -++ -++ -++################################################################################ -++ -++# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -++# In a P block, only the first half of coefficients contain used information. -++# At this point we have already issued two pairs of texture requests for the current block -++# May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) -++# Can fill in the coefficients so only -++# Can also assume default weighted prediction for B frames. -++# Perhaps can unpack coefficients in a more efficient manner by doing H/V for a and b at the same time? -++# Or possibly by taking advantage of symmetry? -++# From 19->7 32bits per command. -++::mc_filter_b -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++mov ra31, unif -++ -++# per-channel shifts were calculated on the *previous* invocation -++ -++mov ra_xshift, ra_xshift_next -++mov rx_xshift2, rx_xshift2_next -++ -++# get base addresses and per-channel shifts for *next* invocation -++add r0, unif, elem_num # Load x -++max r0, r0, 0; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl ra_xshift_next, r0, 3 # Compute shifts -++mov ra_y_next, r1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -++ -++add r0, unif, elem_num # Load x -++max r0, r0, 0 ; mov r1, unif # Load y -++min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++shl rx_xshift2_next, r0, 3 # Compute shifts -++add ra_y2_next, r1, 1 -++and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -++ -++ -++# set up VPM write -++mov vw_setup, rb28 -++ -++# get width,height of block -++mov r2, 16 -++mov r0, unif -++shr r1, r0, r2 # Extract width -++sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++and r0, r0, rb22 # Extract height -++add rb17, r0, 5 -++add rb18, r0, 7 -++shl r0, r0, 7 -++add r0, r0, r1 # Combine width and height of destination area -++shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -++add rb26, r0, rb27 -++ -++# get filter coefficients and discard unused B frame values -++mov r0, unif -++mov r1, 1 -++mov.ifnz r0, unif # Alternate coefficients are unused for P frames -++nop ; mul24 r0, r0 << 13, r1 << 13 -++asr ra3, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 14, r1 << 14 -++asr ra2, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right -++asr ra1, r0, rb23; mul24 r0, r0, ra22 -++asr ra0, r0, rb23; mov r0, unif -++mov.ifnz r0, unif -++nop ; mul24 r0, r0 << 9, r1 << 9 -++asr ra7, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 10, r1 << 10 -++asr ra6, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 11, r1 << 11 -++asr ra5, r0, rb23; mul24 r0, r0, ra22 -++nop ; mul24 r0, r0 << 12, r1 << 12 -++asr ra4, r0, rb23; mov r0, unif -++mov.ifnz r0, unif -++asr rb11, r0, rb23; mul24 r0, r0, ra22 -++asr rb10, r0, rb23; mul24 r0, r0, ra22 -++asr rb9, r0, rb23; mul24 r0, r0, ra22 -++asr rb8, r0, rb23; mov r0, unif -++mov.ifnz r0, unif -++asr rb7, r0, rb23; mul24 r0, r0, ra22 -++asr rb6, r0, rb23; mul24 r0, r0, ra22 -++asr rb5, r0, rb23; mul24 r0, r0, ra22 -++asr rb4, r0, rb23 -++ -++mov r0, unif # Frame0 offset/weight -++mov.ifnz r0, unif # Frame1 offset/weight unused -++asr rb15, r0, r2 # Compute offset from MSBs -++shl r0, r0, r2 -++asr rb14, r0, r2 # Compute weight from LSBs -++ -++# r3 is loop counter -++ -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++mov r3, 0 -++ -++:yloopb -++# retrieve texture results and pick out bytes -++# then submit two more texture requests -++ -++# If we knew there was no clipping then this code would get simpler. -++# Perhaps we could add on the pitch and clip using larger values? -++ -++sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++shr r1, r4, rx_xshift2 -++mov.ifz ra_y2, ra_y2_next -++ -++max r2, ra_y, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -++ -++max r2, ra_y2, 0 # y -++min r2, r2, rb_frame_height_minus_1 -++add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ -++ -++# generate seven shifted versions -++# interleave with scroll of vertical context -++ -++mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ -++# apply horizontal filter -++nop ; mul24 r2, r0, ra0 -++nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++nop ; mul24 r3, ra1 << 1, r0 << 1 -++nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++add r0, r2, r3 ; mov r3, rb31 -++sub.setf -, r3, 8 ; mov ra12, ra13 -++mov ra9, ra10 -++mov ra10, ra11 -++mov ra11, ra12 -++mov ra12, ra13 -++brr.anyn -, r:yloopb -++mov ra13, ra14 # Delay slot 1 -++mov ra14, ra15 # Delay slot 2 -++mov ra15, r0 # Delay slot 3 -++ -++# apply vertical filter and write to VPM -++ -++nop ; mul24 r1, ra14, rb10 -++nop ; mul24 r0, ra13, rb9 -++add r1, r1, r0 ; mul24 r0, ra12, rb8 -++add r1, r1, r0 ; mul24 r0, ra15, rb11 -++add r1, r1, r0 ; mul24 r0, ra8, rb4 -++add r1, r1, r0 ; mul24 r0, ra9, rb5 -++add r1, r1, r0 ; mul24 r0, ra10, rb6 -++add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++add r1, r1, r0 ; mov -, vw_wait -++sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++asr r1, r1, 14 -++nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves -++add r1, r1, ra30 ; mul24 r0, r1, rb14 -++add r1, r1, r0 -++brr.anyn -, r:yloopb -++asr r1, r1, 7 # Delay 1 -++min r1, r1, rb22 # Delay 2 -++max vpm, r1, 0 # Delay 3 -++ -++# DMA out -++bra -, ra31 -++mov vw_setup, rb26 # VDW setup 0 Delay 1 -++mov vw_setup, rb29 # Stride Delay 2 -++mov vw_addr, unif # start the VDW Delay 3 -++ -++################################################################################ -++ -++# mc_interrupt_exit12() -++::mc_interrupt_exit12 -++mov -, vw_wait # wait on the VDW -++ -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ldtmu0 -++ -++mov -,sacq(0) # 1 -++mov -,sacq(0) # 2 -++mov -,sacq(0) # 3 -++mov -,sacq(0) # 4 -++mov -,sacq(0) # 5 -++mov -,sacq(0) # 6 -++mov -,sacq(0) # 7 -++mov -,sacq(0) # 8 -++mov -,sacq(0) # 9 -++mov -,sacq(0) # 10 -++mov -,sacq(0) # 11 -++ -++nop ; nop ; thrend -++mov interrupt, 1; nop # delay slot 1 -++nop ; nop # delay slot 2 -++ -++ -+ ::mc_end -+ # Do not add code here because mc_end must appear after all other code. -+-- -+2.7.4 -+ -+ -+From f2ffe4186fa49cb27579953c276b51728a08a8b5 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 20 May 2015 19:58:30 +0100 -+Subject: [PATCH 42/68] Added support for fast cache flush in deblocker -+ -+--- -+ libavcodec/hevc_filter.c | 44 +- -+ libavcodec/rpi_qpu.c | 6 + -+ libavcodec/rpi_qpu.h | 2 + -+ libavcodec/rpi_shader.c | 1028 +++++++++++++++++++++++++++++--------------- -+ libavcodec/rpi_shader.h | 16 +- -+ libavcodec/rpi_user_vcsm.h | 22 + -+ 6 files changed, 768 insertions(+), 350 deletions(-) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 92a8271..186317a 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -37,6 +37,11 @@ -+ -+ #include "bit_depth_template.c" -+ -++#ifdef RPI -++#include "rpi_user_vcsm.h" -++#include "rpi_qpu.h" -++#endif -++ -+ #define LUMA 0 -+ #define CB 1 -+ #define CR 2 -+@@ -872,15 +877,46 @@ static void flush_buffer(AVBufferRef *bref) { -+ gpu_cache_flush(p); -+ } -+ -+-static void ff_hevc_flush_chroma(HEVCContext *s) -++// Return Physical address for this image -++static int ff_hevc_buf_base(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ return p->vc & 0x3fffffff; -++} -++ -++static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -++#define RPI_FAST_CACHEFLUSH -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int curr_y = f->progress->data[0]; -++ int sz,base; -++ if (curr_y < 0) curr_y = 0; -++ if (n<=curr_y) return; // Should not happen -++ sz = s->frame->linesize[1] * (n-curr_y); -++ base = s->frame->linesize[1] * curr_y; -++ iocache.s[0].cmd = 3; // Flush L1 cache -++ iocache.s[0].addr = 0; -++ iocache.s[0].size = 0; -++ -++ iocache.s[1].cmd = 2; -++ iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; -++ iocache.s[1].size = sz; -++ -++ iocache.s[2].cmd = 2; -++ iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; -++ iocache.s[2].size = sz; -++ -++ vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); -++ -++#else -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -++#endif -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+ //memcpy(s->dummy.arm,s->frame->data[2],1024*32); -+@@ -903,7 +939,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x, y - ctb_size); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s); -++ ff_hevc_flush_chroma(s,&s->ref->tf, y); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y, 0); -+ } -+@@ -912,7 +948,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x , y); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s); -++ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+@@ -922,7 +958,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s); -++ ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index f62051f..fd8a276 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -237,6 +237,12 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -+ return r; -+ } -+ -++int gpu_get_mailbox(void) -++{ -++ assert(gpu); -++ return gpu->mb; -++} -++ -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+ void *tmp = vcsm_lock(p->vcsm_handle); -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 543c84b..88965e5 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -49,4 +49,6 @@ extern int rpi_test_shader(void); -+ extern void rpi_do_block(const unsigned char *in_buffer_vc, int src_pitch, unsigned char *dst_vc, int dst_pitch, unsigned char *dst); -+ extern void rpi_do_block_arm(const unsigned char *in_buffer, int src_pitch, unsigned char *dst, int dst_pitch); -+ -++extern int gpu_get_mailbox(void); -++ -+ #endif -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 3f04d80..9c30e32 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -23,11 +23,11 @@ __attribute__((aligned(8))) -+ unsigned int rpi_shader[] = { -+ // ::mc_setup_uv -+ /* [0x00000000] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x_base, unif, elem_num -++/* [0x00000008] */ 0x0c9a0f80, 0x10020427, // add ra_x, unif, elem_num -+ /* [0x00000010] */ 0x15827d80, 0x10020767, // mov ra_y, unif -+-/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_x2_base, unif -++/* [0x00000018] */ 0x15827d80, 0x10020627, // mov ra_frame_base, unif -+ /* [0x00000020] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_x2_base -++/* [0x00000028] */ 0x0d620f80, 0x10020667, // sub ra_u2v_ref_offset, unif, ra_frame_base -+ /* [0x00000030] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+ /* [0x00000038] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+ /* [0x00000040] */ 0x15827d80, 0x10021427, // mov rb16, unif -+@@ -35,360 +35,708 @@ unsigned int rpi_shader[] = { -+ /* [0x00000050] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+ /* [0x00000058] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+ /* [0x00000060] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000068] */ 0x00000020, 0xe0020567, // mov ra21, 32 -+-/* [0x00000070] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000078] */ 0x00000008, 0xe00205e7, // mov ra23, 8 -+-/* [0x00000080] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+-/* [0x00000088] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000090] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000098] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x000000a0] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x000000a8] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x000000b0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x000000b8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x000000c0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x000000c8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x000000d0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x000000d8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000e0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000e8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x000000f0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000f8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000100] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000108] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000110] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000118] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000120] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000140] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000148] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x00000150] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000158] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000160] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000168] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000170] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000178] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000180] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000188] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000190] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000198] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x000001a0] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x000001a8] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x000001b0] */ 0x15427d80, 0x10020827, // mov r0, ra_x_base -+-/* [0x000001b8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001c0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_x2_base -+-/* [0x000001c8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001d0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001d8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001e0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001e8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x_base, r0 -+-/* [0x000001f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001f8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x00000200] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_x2_base, r2 -+-/* [0x00000208] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000210] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000218] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000220] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000228] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000230] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000238] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000240] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000248] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000250] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x_base -+-/* [0x00000258] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_x2_base -++/* [0x00000068] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000070] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000078] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000080] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000088] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000090] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000098] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x000000a0] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x000000a8] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x000000b0] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -++/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -++/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -++/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -++/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+ // ::mc_filter_uv -+-/* [0x00000260] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000268] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000270] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000278] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000280] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000288] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000290] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000298] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000002a0] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000002a8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002b0] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000002b8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002c0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002d0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002d8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002e0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002e8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002f0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002f8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000300] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000308] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000310] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000340] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000350] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000358] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000360] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000370] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000380] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000388] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000390] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+-/* [0x00000398] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000003a0] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+-/* [0x000003a8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003b0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -++/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003b8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003c0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x000003c8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x000003d0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003d8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003e0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003e8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003f0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003f8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000400] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000408] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000410] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000418] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000420] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000428] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000430] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000438] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000440] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000448] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000458] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000460] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000468] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000470] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000478] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000480] */ 0x00000020, 0xe0021327, // mov rb12,32 -+-/* [0x00000488] */ 0x00000006, 0xe0021367, // mov rb13,6 -+-/* [0x00000490] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+-/* [0x00000498] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+-/* [0x000004a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000004a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000004b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000004b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000004c0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000004c8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000004d0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004d8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000004e0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000004e8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x000004f0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004f8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x00000500] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000508] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000510] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000518] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000520] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000528] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000530] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000538] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000540] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000548] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000550] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 -++/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 -++/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 -++/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 -++/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000558] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000560] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000568] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000570] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000578] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000580] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000588] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000590] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000598] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x000005a0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000005a8] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x000005b0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x000005b8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000005c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005c8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000005d0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000005d8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000005e0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005e8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005f0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000600] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000608] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000610] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000618] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000628] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000638] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000640] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000648] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000650] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000658] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000660] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000668] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000670] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000678] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000680] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000688] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000690] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000698] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000006a0] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000006a8] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000006b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000006b8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006c0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006c8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x000006d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000700] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000708] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000710] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000718] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000720] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000728] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000730] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000738] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000740] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000748] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000750] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000758] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000760] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000768] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000770] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000778] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000780] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000788] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000798] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x000007a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007b0] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x000007b8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007c0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007c8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007d0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007d8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007e0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007e8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007f0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007f8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_base_next, r0, ~3 -+-/* [0x00000800] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000808] */ 0x0c9d3e80, 0x100206a7, // add ra_x2_base_next, rb_x_base_next, r2 -+-/* [0x00000810] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000818] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000820] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000828] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000830] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000838] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000840] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000848] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000850] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000858] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000860] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000868] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000870] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000878] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000880] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000888] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000890] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000898] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008b8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008d0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000008d8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008e8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008f0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008f8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x00000900] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000908] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x_base, rb_x_base_next ; ldtmu0 -+-/* [0x00000910] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_x2_base, ra_x2_base_next ; mov rb31, r3 -+-/* [0x00000918] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000920] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000928] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000930] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000938] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000940] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x_base, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000948] */ 0x0c627c80, 0x10020e27, // add t0s, ra_x2_base, r2 -+-/* [0x00000950] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000958] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000960] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000968] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000970] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000978] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000980] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000988] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000990] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000998] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x000009a0] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x000009a8] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009b0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009b8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000009c0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000009c8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009d0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009d8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009e0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x00000a00] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x00000a08] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000a10] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a18] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a20] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a28] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a30] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a38] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a40] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a48] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a50] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a58] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a60] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a68] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a70] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a78] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a80] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a98] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000ab0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000ac0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ae0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b10] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b18] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b20] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b28] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b30] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_setup -++/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -++/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -++/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -++/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -++/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -++/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -++// ::mc_filter -++/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :yloop -++/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_filter_b -++/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 -++/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -++/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -++/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -++/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -++/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -++/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -++/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -++/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++// :yloopb -++/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -++/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -++/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++// ::mc_interrupt_exit12 -++/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index cec9901..3fa8531 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,11 +4,15 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 152) -+-#define mc_filter_uv_b0 (rpi_shader + 342) -+-#define mc_filter_uv_b (rpi_shader + 494) -+-#define mc_exit (rpi_shader + 670) -+-#define mc_interrupt_exit8 (rpi_shader + 688) -+-#define mc_end (rpi_shader + 718) -++#define mc_filter_uv (rpi_shader + 148) -++#define mc_filter_uv_b0 (rpi_shader + 338) -++#define mc_filter_uv_b (rpi_shader + 490) -++#define mc_exit (rpi_shader + 666) -++#define mc_interrupt_exit8 (rpi_shader + 684) -++#define mc_setup (rpi_shader + 714) -++#define mc_filter (rpi_shader + 868) -++#define mc_filter_b (rpi_shader + 1108) -++#define mc_interrupt_exit12 (rpi_shader + 1364) -++#define mc_end (rpi_shader + 1402) -+ -+ #endif -+diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -+index fbebbbe..95e6de1 100644 -+--- a/libavcodec/rpi_user_vcsm.h -++++ b/libavcodec/rpi_user_vcsm.h -+@@ -418,6 +418,28 @@ int vcsm_unlock_hdl( unsigned int handle ); -+ */ -+ int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -+ -++/* Clean and/or invalidate the memory associated with this user opaque handle -++** -++** Returns: non-zero on error -++** -++** structure contains a list of flush/invalidate commands. Commands are: -++** 0: nop -++** 1: invalidate given physical range in L2 -++** 2: clean given physical range in L2 -++** 3: clean+invalidate all of L1 -++** 4: flush all of L2 and all of L1 -++*/ -++struct vcsm_user_clean_invalid_s { -++ struct { -++ unsigned int cmd; -++ unsigned int addr; -++ unsigned int size; -++ } s[8]; -++}; -++ -++int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); -++ -++ -+ #ifdef __cplusplus -+ } -+ #endif -+-- -+2.7.4 -+ -+ -+From 09685ab55aecb9400e354522894e0fbbb6381ca9 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 20 May 2015 21:12:55 +0100 -+Subject: [PATCH 43/68] Added multi mailbox - not working -+ -+--- -+ libavcodec/hevc.c | 40 ++++++++++++++++++++++++++++--- -+ libavcodec/rpi_mailbox.c | 47 +++++++++++++++++++++++++++++++++++++ -+ libavcodec/rpi_mailbox.h | 5 ++++ -+ libavcodec/rpi_qpu.c | 61 ++++++++++++++++++++++++++++++++++++++++++++---- -+ libavcodec/rpi_qpu.h | 2 ++ -+ 5 files changed, 147 insertions(+), 8 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 951e2d3..ab63efd 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -47,6 +47,11 @@ -+ //#define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -++ -++ #ifdef RPI_INTER_QPU -++ // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU -++ #define RPI_MULTI_MAILBOX -++ #endif -+ #endif -+ -+ // #define DISABLE_MC -+@@ -2843,10 +2848,14 @@ static void rpi_inter_clear(HEVCContext *s) -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+ { -+ int k; -++ int i; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -+- -+- if (s->sh.slice_type == I_SLICE) -+- return; -++ if (s->sh.slice_type == I_SLICE) { -++#ifdef RPI_MULTI_MAILBOX -++ rpi_execute_transform(s); -++ return; -++#endif -++ } -+ for(k=0;k<8;k++) { -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+@@ -2856,6 +2865,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -++#ifdef RPI_MULTI_MAILBOX -++ gpu_cache_flush(&s->coeffs_buf_accelerated); -++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -++ qpu_get_fn(QPU_MC_SETUP_UV), -++ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ ); -++ for(i=0;i<4;i++) -++ s->num_coeffs[i] = 0; -++#else -+ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+@@ -2866,6 +2891,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -++#endif -+ } -+ #endif -+ -+@@ -2945,6 +2971,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+ // Transform all blocks -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++#ifdef RPI_MULTI_MAILBOX -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++ // Perform luma inter prediction -++ rpi_execute_inter_cmds(s); -++#else -+ rpi_execute_transform(s); -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+@@ -2952,6 +2984,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ // Kick off inter prediction on QPUs -+ rpi_execute_inter_qpu(s); -+ #endif -++#endif -++ -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+diff --git a/libavcodec/rpi_mailbox.c b/libavcodec/rpi_mailbox.c -+index 77a56dd..3904efc 100644 -+--- a/libavcodec/rpi_mailbox.c -++++ b/libavcodec/rpi_mailbox.c -+@@ -276,6 +276,53 @@ unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigne -+ return p[5]; -+ } -+ -++void execute_multi(int file_desc, -++ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, -++ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, -++ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2) { -++ int i=0; -++ unsigned p[32]; -++ -++ p[i++] = 0; // size -++ p[i++] = 0x00000000; // process request -++ p[i++] = 0x30018; // (the tag id) -++ p[i++] = 88; // (size of the buffer) -++ p[i++] = 88; // (size of the data) -++ -++ p[i++] = num_qpus; -++ p[i++] = control; -++ p[i++] = noflush; -++ p[i++] = timeout; // ms -++ -++ p[i++] = num_qpus_2; -++ p[i++] = control_2; -++ p[i++] = noflush_2; -++ p[i++] = timeout_2; // ms -++ -++ p[i++] = code; -++ p[i++] = r0; -++ p[i++] = r1; -++ p[i++] = r2; -++ p[i++] = r3; -++ p[i++] = r4; -++ p[i++] = r5; -++ -++ p[i++] = code_2; -++ p[i++] = r0_2; -++ p[i++] = r1_2; -++ p[i++] = r2_2; -++ p[i++] = r3_2; -++ p[i++] = r4_2; -++ p[i++] = r5_2; -++ -++ p[i++] = 0x00000000; // end tag -++ p[0] = i*sizeof *p; // actual size -++ -++ mbox_property(file_desc, p); -++ return; -++} -++ -+ int mbox_open() { -+ int file_desc; -+ -+diff --git a/libavcodec/rpi_mailbox.h b/libavcodec/rpi_mailbox.h -+index c264d2e..5898102 100644 -+--- a/libavcodec/rpi_mailbox.h -++++ b/libavcodec/rpi_mailbox.h -+@@ -15,6 +15,11 @@ extern void unmapmem(void *addr, unsigned size); -+ -+ extern unsigned execute_code(int file_desc, unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ extern unsigned execute_qpu(int file_desc, unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout); -++extern void execute_multi(int file_desc, -++ unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout, -++ unsigned num_qpus_2, unsigned control_2, unsigned noflush_2, unsigned timeout_2, -++ unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ unsigned code_2, unsigned r0_2, unsigned r1_2, unsigned r2_2, unsigned r3_2, unsigned r4_2, unsigned r5_2); -+ extern unsigned qpu_enable(int file_desc, unsigned enable); -+ -+ #endif -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index fd8a276..feb3284 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -123,7 +123,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -+ static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; -+ static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+-static int vpu_cmds[MAXCMDS][8]; -++static int vpu_cmds[MAXCMDS][16]; -+ static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+ static volatile int vpu_async_head=0; -+ #endif -+@@ -346,6 +346,7 @@ unsigned int vpu_get_constants(void) { -+ static void *vpu_start(void *arg) { -+ while(1) { -+ int *p; -++ int qpu_code; -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+@@ -358,12 +359,25 @@ static void *vpu_start(void *arg) { -+ if (p[6] == -1) { -+ break; // Last job -+ } -+- if (p[7]) { -++ qpu_code = p[7]; -++ //if (p[7]) { -+ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+- } -+- vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ //} -++ if (!qpu_code) { -++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ } else { -++ int i; -++ for(i=0;i<8;i++) { -++ gpu->mail[i*2] = p[8+i]; -++ gpu->mail[i*2 + 1] = qpu_code; -++ } -+ -++ execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -++ 0, 0, 0, 0, -++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -++ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -++ } -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond_head); -+@@ -400,7 +414,43 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned -+ p[4] = r3; -+ p[5] = r4; -+ p[6] = r5; -+- p[7] = (int) buf; -++ p[7] = 0; -++ if (num<=1) -++ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -++ pthread_mutex_unlock(&post_mutex); -++ return id; -++ } -++} -++ -++int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -++{ -++ -++ pthread_mutex_lock(&post_mutex); -++ { -++ int id = vpu_async_tail++; -++ int *p = vpu_cmds[id%MAXCMDS]; -++ int num = vpu_async_tail - vpu_async_head; -++ if (num>MAXCMDS) { -++ printf("Too many commands submitted\n"); -++ exit(-1); -++ } -++ p[0] = vpu_code; -++ p[1] = r0; -++ p[2] = r1; -++ p[3] = r2; -++ p[4] = r3; -++ p[5] = r4; -++ p[6] = r5; -++ p[7] = qpu_code; -++ p[8 ] = unifs1; -++ p[9 ] = unifs2; -++ p[10] = unifs3; -++ p[11] = unifs4; -++ p[12] = unifs5; -++ p[13] = unifs6; -++ p[14] = unifs7; -++ p[15] = unifs8; -+ if (num<=1) -+ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+@@ -966,6 +1016,7 @@ void rpi_do_block(const uint8_t *in_buffer_vc, int src_pitch, uint8_t *dst_vc, i -+ } -+ -+ -++ -+ #endif -+ -+ #endif // RPI -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 88965e5..2f08f03 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -41,6 +41,8 @@ extern unsigned int vpu_get_fn(void); -+ extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -++int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void vpu_wait( int id); -+ -+ // Simple test of shader code -+-- -+2.7.4 -+ -+ -+From 311f2da06d13a98d9bdda2df8684d7cf55b9a08e Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 21 May 2015 16:50:02 +0100 -+Subject: [PATCH 44/68] Pass qpu number in as uniform -+ -+--- -+ libavcodec/hevc.c | 2 +- -+ libavcodec/rpi_shader.c | 1288 ++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 20 +- -+ libavcodec/rpi_shader.qasm | 10 +- -+ 4 files changed, 657 insertions(+), 663 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ab63efd..caadfaa 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -2834,6 +2834,7 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -++ *s->u_mvs[i]++ = i; -+ if (weight_flag) { -+ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -+@@ -2841,7 +2842,6 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = 1 << 5; -+ *s->u_mvs[i]++ = 6; -+ } -+- s->u_mvs[i] += 1; // Padding words -+ } -+ } -+ -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index 9c30e32..a0f0282 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -48,8 +48,8 @@ unsigned int rpi_shader[] = { -+ /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+ /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+ /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x000000d8] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif -++/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+ /* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+ /* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+ /* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+@@ -60,669 +60,669 @@ unsigned int rpi_shader[] = { -+ /* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+ /* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+ /* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000130] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000138] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-/* [0x00000140] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000148] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000150] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000158] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000160] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000168] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000170] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000178] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000180] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000188] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x00000190] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x00000198] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x000001a0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+-/* [0x000001a8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001b0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+-/* [0x000001b8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001c0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001c8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001d8] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -+-/* [0x000001e0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001e8] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001f0] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+-/* [0x000001f8] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x00000200] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000208] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000210] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000218] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000220] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000228] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000230] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000238] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000240] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+-/* [0x00000248] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -++/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -++/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -++/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x -++/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -++/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -++/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -++/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -++/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+ // ::mc_filter_uv -+-/* [0x00000250] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000258] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000260] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000268] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000270] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000278] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000280] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000288] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000290] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000298] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000002a0] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x000002a8] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002b0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002c0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002c8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002d0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002d8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002e0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002e8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002f0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002f8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000300] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000308] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000310] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000320] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000330] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000340] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000348] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000350] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000358] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000360] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000368] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000370] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000378] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000380] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+-/* [0x00000388] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000390] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+-/* [0x00000398] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000003a0] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -++/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x000003a8] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003b0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x000003b8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x000003c0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003c8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003d0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003d8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003e0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003e8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003f0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000003f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000400] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000408] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000410] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000418] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000420] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000428] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000430] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000438] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000448] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000450] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000458] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000460] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000468] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000470] */ 0x00000020, 0xe0021327, // mov rb12,32 -+-/* [0x00000478] */ 0x00000006, 0xe0021367, // mov rb13,6 -+-/* [0x00000480] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+-/* [0x00000488] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+-/* [0x00000490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000004a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000004a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000004b0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000004b8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000004c0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004c8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000004d0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000004d8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x000004e0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004e8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x000004f0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004f8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000500] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000508] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000510] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000518] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000520] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000528] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000530] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000538] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000540] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 -++/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 -++/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 -++/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 -++/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000548] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000550] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000558] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000560] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000568] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000570] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000578] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000580] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000588] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000590] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000598] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x000005a0] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x000005a8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000005b0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005b8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000005c0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000005c8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000005d0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005d8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005e0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005e8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005f0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005f8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000600] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000608] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000618] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000628] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000638] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000640] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000648] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000650] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000658] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000660] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000668] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000670] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000678] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x00000680] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000688] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000690] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000698] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000006a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000006a8] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006b0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006b8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000006c0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006c8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006d0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006d8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006e0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006e8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006f0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006f8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000700] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000708] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000710] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000718] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000720] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000728] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000730] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000738] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000740] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000748] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000750] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000758] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000760] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000768] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000770] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000778] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000780] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000788] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000790] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000798] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000007a0] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x000007a8] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007b0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007b8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007c0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007c8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007d0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007d8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007e0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007e8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x000007f0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007f8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x00000800] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000808] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000810] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000818] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000820] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000828] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000830] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000838] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000840] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000848] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000850] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000858] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000860] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000868] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000870] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000878] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000880] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000888] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000898] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x000008a8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008c0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000008c8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008d0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008d8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008e0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008e8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008f0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008f8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x00000900] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000908] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000910] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000918] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000920] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000928] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000930] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000938] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x00000940] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000948] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000950] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000958] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000960] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000968] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000970] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000978] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000980] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000988] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000990] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000998] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009a0] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x000009a8] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000009b0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000009b8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009c0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009c8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009d0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009d8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009e0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009e8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009f0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009f8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x00000a00] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000a08] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a10] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a18] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a20] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a28] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a30] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a38] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a48] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a50] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a58] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a60] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -++/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a70] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a88] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a90] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a98] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000aa0] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000aa8] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000ab0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ad0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b00] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b08] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b10] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b18] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b20] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_setup -+-/* [0x00000b28] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000b30] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000b38] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b40] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000b48] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000b50] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000b58] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00000b60] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000b68] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000b70] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000b78] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000b80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000b88] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+-/* [0x00000b90] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b98] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000ba0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000ba8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000bb0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+-/* [0x00000bb8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000bc0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000bc8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000bd0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000bd8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000be0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -+-/* [0x00000be8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00000bf0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00000bf8] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00000c00] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000c08] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x00000c10] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x00000c18] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000c20] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000c28] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+-/* [0x00000c30] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000c38] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000c40] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000c48] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00000c50] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00000c58] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00000c60] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00000c68] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00000c70] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00000c78] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00000c80] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00000c88] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000c90] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000c98] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000ca0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000ca8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000cb0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000cb8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000cc0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000cc8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000cd0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000cd8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000ce0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000ce8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000cf0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000cf8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000d00] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000d08] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000d10] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000d18] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000d20] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000d28] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000d30] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000d38] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000d40] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d48] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000d50] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d58] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+-/* [0x00000d60] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+-/* [0x00000d68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d70] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000d78] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -+-/* [0x00000d80] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d88] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -++/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -++/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -++/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -++/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -++/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -++/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif -++/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif -++/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif -++/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -++/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -++/* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -+ // ::mc_filter -+-/* [0x00000d90] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000d98] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000da0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000da8] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00000db0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000db8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000dc0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000dc8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000dd0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000dd8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000de0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x00000de8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000df0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x00000df8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000e00] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000e08] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x00000e10] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000e18] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x00000e20] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e28] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e30] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e38] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000e40] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000e48] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000e50] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000e58] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000e60] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000e68] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000e70] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000e78] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000e80] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e88] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000e90] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e98] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ea0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ea8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000eb0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000eb8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ec0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ec8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ed0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000ed8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ee0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ef8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000f00] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000f08] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f10] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f18] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f20] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00000f28] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f30] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000f38] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000f40] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000f48] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000f50] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -++/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :yloop -+-/* [0x00000f58] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f60] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00000f68] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000f70] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f78] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00000f80] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00000f88] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f90] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f98] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000fa0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000fa8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x00000fb0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000fb8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x00000fc0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000fc8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000fd0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000fd8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000fe0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fe8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000ff0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000ff8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00001000] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00001008] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001010] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001018] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001020] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001028] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001030] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001038] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001040] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001048] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001050] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001058] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001060] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001068] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001070] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001078] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001080] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001088] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001090] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001098] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000010a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000010a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000010b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000010b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000010c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000010c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000010d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000010d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000010e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000010e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000010f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000010f8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x00001100] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x00001108] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x00001110] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001118] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x00001120] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001128] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001130] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001138] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001140] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001148] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_b -+-/* [0x00001150] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001158] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001160] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00001168] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00001170] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00001178] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00001180] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00001188] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00001190] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00001198] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000011a0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x000011a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000011b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x000011b8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x000011c0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x000011c8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x000011d0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000011d8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x000011e0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000011e8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000011f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000011f8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00001200] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00001208] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001210] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001218] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001220] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001228] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001230] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001238] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001240] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001248] */ 0x00000001, 0xe0020867, // mov r1, 1 -+-/* [0x00001250] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001258] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -+-/* [0x00001260] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001268] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -+-/* [0x00001270] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001278] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -+-/* [0x00001280] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001288] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00001290] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001298] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -+-/* [0x000012a0] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012a8] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -+-/* [0x000012b0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012b8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -+-/* [0x000012c0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012c8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -+-/* [0x000012d0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000012d8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x000012e0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012e8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012f0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012f8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00001300] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001308] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001310] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001318] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001320] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00001328] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001330] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001338] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00001340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001348] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00001350] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -++/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -++/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -++/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -++/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 -++/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -++/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -++/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -++/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -++/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -++/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -++/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -++/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -++/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -++/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -++/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -++/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -++/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :yloopb -+-/* [0x00001358] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001360] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00001368] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00001370] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001378] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00001380] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00001388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000013a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x000013a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x000013b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000013b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x000013c0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x000013c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000013d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000013d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000013e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000013e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000013f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000013f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00001400] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00001408] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001410] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001418] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001420] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001428] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001430] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001438] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001440] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001448] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001450] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001458] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001460] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001468] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001470] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001478] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001480] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001488] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001490] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001498] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000014a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000014a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000014b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000014b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000014c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000014c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000014d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000014d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000014e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000014e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000014f0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000014f8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -+-/* [0x00001500] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -+-/* [0x00001508] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00001510] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001518] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00001520] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001528] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001530] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001538] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001540] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001548] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -++/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -++/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -++/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -++/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_interrupt_exit12 -+-/* [0x00001550] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+ /* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001568] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001570] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+@@ -732,11 +732,9 @@ unsigned int rpi_shader[] = { -+ /* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+ /* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015d0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000015d8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000015e0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 3fa8531..6e552d9 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,15 +4,15 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 148) -+-#define mc_filter_uv_b0 (rpi_shader + 338) -+-#define mc_filter_uv_b (rpi_shader + 490) -+-#define mc_exit (rpi_shader + 666) -+-#define mc_interrupt_exit8 (rpi_shader + 684) -+-#define mc_setup (rpi_shader + 714) -+-#define mc_filter (rpi_shader + 868) -+-#define mc_filter_b (rpi_shader + 1108) -+-#define mc_interrupt_exit12 (rpi_shader + 1364) -+-#define mc_end (rpi_shader + 1402) -++#define mc_filter_uv (rpi_shader + 144) -++#define mc_filter_uv_b0 (rpi_shader + 334) -++#define mc_filter_uv_b (rpi_shader + 486) -++#define mc_exit (rpi_shader + 662) -++#define mc_interrupt_exit8 (rpi_shader + 680) -++#define mc_setup (rpi_shader + 710) -++#define mc_filter (rpi_shader + 864) -++#define mc_filter_b (rpi_shader + 1104) -++#define mc_interrupt_exit12 (rpi_shader + 1360) -++#define mc_end (rpi_shader + 1398) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 9cfc0d9..a0b8e5a 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -133,8 +133,8 @@ mov ra14, 0 -+ mov ra15, 0 -+ -+ # Compute part of VPM to use for DMA output -+-mov r2, qpu_num -+-shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -++mov r3, unif -++shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+ and r2, r2, 15 -+ mov r1, r2 -+ asr r1, r1, 2 -+@@ -147,8 +147,7 @@ shl r0, r0, 5 -+ add rb27, r0, r1 -+ -+ # Compute part of VPM to save data into -+-mov r2, qpu_num # qpu_num = abcd -+-shl r2, r2, 1 -++shl r2, r3, 1 -+ and r2, r2, 15 # r2 = bcd0 -+ mov r1, r2 # r1 = bcd0 -+ asr r1, r1, 2 # r1 = bc -+@@ -181,9 +180,6 @@ add t0s, r2, r1 -+ mov rb12,unif # offset before shift -+ mov rb13,unif # offset after shift -+ -+-# Dump padding words -+-mov r0, unif -+- -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+ min r1, r1, rb_frame_height_minus_1 -+-- -+2.7.4 -+ -+ -+From db6fe49d50e42c444b5833acc6206c0bbfaacef4 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sat, 23 May 2015 13:20:21 +0100 -+Subject: [PATCH 45/68] Add new cache flushing routine -+ -+--- -+ libavcodec/hevc.c | 8 +++-- -+ libavcodec/hevc_filter.c | 39 ++++++++++----------- -+ libavcodec/rpi_qpu.c | 17 +++++++-- -+ libavcodec/rpi_qpu.h | 2 ++ -+ libavcodec/rpi_user_vcsm.h | 86 ++++++++++++++++++++++++++-------------------- -+ 5 files changed, 91 insertions(+), 61 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index caadfaa..9d12583 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3575,9 +3575,13 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) -+ } -+ -+ fail: -+- if (s->ref && s->threads_type == FF_THREAD_FRAME) -++ if (s->ref && s->threads_type == FF_THREAD_FRAME) { -++#ifdef RPI_INTER_QPU -++ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -++ ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); -++#endif -+ ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -+- -++ } -+ return ret; -+ } -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 186317a..ec84e8a 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -883,36 +883,35 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { -+ return p->vc & 0x3fffffff; -+ } -+ -+-static void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -++void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -++void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+ s->nal_unit_type == NAL_STSA_N || -+ s->nal_unit_type == NAL_RADL_N || -+ s->nal_unit_type == NAL_RASL_N )) { -+-#define RPI_FAST_CACHEFLUSH -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+- int curr_y = f->progress->data[0]; -++ int curr_y = ((int *)f->progress->data)[0]; -++ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -++ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+- if (curr_y < 0) curr_y = 0; -+- if (n<=curr_y) return; // Should not happen -+- sz = s->frame->linesize[1] * (n-curr_y); -+- base = s->frame->linesize[1] * curr_y; -+- iocache.s[0].cmd = 3; // Flush L1 cache -+- iocache.s[0].addr = 0; -+- iocache.s[0].size = 0; -+- -+- iocache.s[1].cmd = 2; -+- iocache.s[1].addr = ff_hevc_buf_base(s->frame->buf[1]) + base; -++ if (curr_uv < 0) curr_uv = 0; -++ if (n_uv<=curr_uv) { assert(0); return; } // Should not happen -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(s->frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = p->arm + base; -+ iocache.s[1].size = sz; -+- -+- iocache.s[2].cmd = 2; -+- iocache.s[2].addr = ff_hevc_buf_base(s->frame->buf[2]) + base; -+- iocache.s[2].size = sz; -+- -+- vcsm_clean_invalid( gpu_get_mailbox(), &iocache ); -+- -++ vcsm_clean_invalid( &iocache ); -+ #else -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index feb3284..aa65a77 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -211,6 +211,7 @@ static void gpu_unlock(void) { -+ } -+ -+ static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -++ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+ assert(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+@@ -243,13 +244,25 @@ int gpu_get_mailbox(void) -+ return gpu->mb; -+ } -+ -++// Call this to clean and invalidate a region of memory -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+- void *tmp = vcsm_lock(p->vcsm_handle); -+- vcsm_unlock_ptr(tmp); -++#define RPI_FAST_CACHEFLUSH -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm; -++ iocache.s[0].size = p->numbytes; -++ vcsm_clean_invalid( &iocache ); -++#else -++ void *tmp = vcsm_lock(p->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++#endif -+ } -+ -+ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -++ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 2f08f03..0565a60 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -1,6 +1,8 @@ -+ #ifndef RPI_QPU_H -+ #define RPI_QPU_H -+ -++#define RPI_FAST_CACHEFLUSH -++ -+ typedef struct gpu_mem_ptr_s { -+ unsigned char *arm; // Pointer to memory mapped on ARM side -+ int vc_handle; // Videocore handle of relocatable memory -+diff --git a/libavcodec/rpi_user_vcsm.h b/libavcodec/rpi_user_vcsm.h -+index 95e6de1..db41a4d 100644 -+--- a/libavcodec/rpi_user_vcsm.h -++++ b/libavcodec/rpi_user_vcsm.h -+@@ -1,29 +1,41 @@ -+-/* -+-Copyright (c) 2012, Broadcom Europe Ltd -+-All rights reserved. -+- -+-Redistribution and use in source and binary forms, with or without -+-modification, are permitted provided that the following conditions are met: -+- * Redistributions of source code must retain the above copyright -+- notice, this list of conditions and the following disclaimer. -+- * Redistributions in binary form must reproduce the above copyright -+- notice, this list of conditions and the following disclaimer in the -+- documentation and/or other materials provided with the distribution. -+- * Neither the name of the copyright holder nor the -+- names of its contributors may be used to endorse or promote products -+- derived from this software without specific prior written permission. -+- -+-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+-*/ -++/***************************************************************************** -++* Copyright 2001 - 2011 Broadcom Corporation. All rights reserved. -++* -++* This program is the proprietary software of Broadcom Corporation and/or -++* its licensors, and may only be used, duplicated, modified or distributed -++* pursuant to the terms and conditions of a separate, written license -++* agreement executed between you and Broadcom (an "Authorized License"). -++* Except as set forth in an Authorized License, Broadcom grants no license -++* (express or implied), right to use, or waiver of any kind with respect to -++* the Software, and Broadcom expressly reserves all rights in and to the -++* Software and all intellectual property rights therein. IF YOU HAVE NO -++* AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY -++* WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE ALL USE OF -++* THE SOFTWARE. -++* -++* Except as expressly set forth in the Authorized License, -++* 1. This program, including its structure, sequence and organization, -++* constitutes the valuable trade secrets of Broadcom, and you shall use -++* all reasonable efforts to protect the confidentiality thereof, and to -++* use this information only in connection with your use of Broadcom -++* integrated circuit products. -++* 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" -++* AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR -++* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH -++* RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL -++* IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS -++* FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, -++* QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. YOU -++* ASSUME THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE. -++* 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS -++* LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, -++* OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO -++* YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN -++* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS -++* OF THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER -++* IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF -++* ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. -++*****************************************************************************/ -+ -+ #ifndef __USER_VCSM__H__INCLUDED__ -+ #define __USER_VCSM__H__INCLUDED__ -+@@ -424,21 +436,21 @@ int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush ); -+ ** -+ ** structure contains a list of flush/invalidate commands. Commands are: -+ ** 0: nop -+-** 1: invalidate given physical range in L2 -+-** 2: clean given physical range in L2 -+-** 3: clean+invalidate all of L1 -+-** 4: flush all of L2 and all of L1 -++** 1: invalidate given virtual range in L1/L2 -++** 2: clean given virtual range in L1/L2 -++** 3: clean+invalidate given virtual range in L1/L2 -++** 4: flush all L1/L2 -+ */ -+ struct vcsm_user_clean_invalid_s { -+- struct { -+- unsigned int cmd; -+- unsigned int addr; -+- unsigned int size; -+- } s[8]; -++ struct { -++ unsigned int cmd; -++ unsigned int handle; -++ unsigned int addr; -++ unsigned int size; -++ } s[8]; -+ }; -+ -+-int vcsm_clean_invalid( unsigned int handle, struct vcsm_user_clean_invalid_s *s ); -+- -++int vcsm_clean_invalid( struct vcsm_user_clean_invalid_s *s ); -+ -+ #ifdef __cplusplus -+ } -+-- -+2.7.4 -+ -+ -+From 87a6cb3a4f7189e711c85de6d20077b6453b2ebe Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sat, 23 May 2015 21:10:10 +0100 -+Subject: [PATCH 46/68] Fix multi mailbox extra transform call -+ -+--- -+ libavcodec/hevc.c | 2 ++ -+ 1 file changed, 2 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 9d12583..30f5834 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3024,7 +3024,9 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI_INTER_QPU -+ rpi_execute_inter_qpu(s); -+ #endif -++#ifndef RPI_MULTI_MAILBOX -+ rpi_execute_transform(s); -++#endif -+ rpi_execute_inter_cmds(s); -+ vpu_wait(s->vpu_id); -+ rpi_execute_pred_cmds(s); -+-- -+2.7.4 -+ -+ -+From 2a3672a1bda0296453953bebe8b17d69445260b4 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 27 May 2015 16:44:29 +0100 -+Subject: [PATCH 47/68] Added support for running luma prediction on QPUs -+ -+--- -+ libavcodec/hevc.c | 237 +++++++- -+ libavcodec/hevc.h | 26 +- -+ libavcodec/hevc_filter.c | 23 +- -+ libavcodec/rpi_qpu.c | 156 ++++-- -+ libavcodec/rpi_qpu.h | 8 +- -+ libavcodec/rpi_shader.c | 1313 ++++++++++++++++++++++---------------------- -+ libavcodec/rpi_shader.h | 21 +- -+ libavcodec/rpi_shader.qasm | 883 ++++++++++++++--------------- -+ 8 files changed, 1464 insertions(+), 1203 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 30f5834..2da88ec 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -52,6 +52,11 @@ -+ // Define RPI_MULTI_MAILBOX to use the updated mailbox that can launch both QPU and VPU -+ #define RPI_MULTI_MAILBOX -+ #endif -++ -++ // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory -++ // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. -++ -++ -+ #endif -+ -+ // #define DISABLE_MC -+@@ -74,6 +79,13 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -++// Split image of 2048 into parts 64 wide -++// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -++// Each block of 64*64 -++// Smallest CTU size is 16x16, so smallest block is 8x8 -++// Corresponds to a total of 83kbytes over all 12 QPUs -++#define RPI_LUMA_COMMAND_WORDS 9 -++#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) -+ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+@@ -2015,10 +2027,46 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -++#ifdef RPI_LUMA_QPU -++ if (s->enable_rpi) { -++ int reflist = 0; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ int mx = mv->x & 3; -++ int my = mv->y & 3; -++ int my_mx = (my<<8) + mx; -++ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -++ int x1 = x0 + (mv->x >> 2); -++ int y1 = y0 + (mv->y >> 2); -++ int chan = x0>>6; // 64 wide blocks per QPU -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -++ uint32_t *y = s->y_mvs[chan % 12]; -++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -++ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = my2_mx2_my_mx; -++ if (weight_flag) { -++ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -++ } else { -++ *y++ = 1; // Weight of 1 and offset of 0 -++ } -++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -++ } -++ } -++ s->y_mvs[chan % 12] = y; -++ } else -++#endif -++ { -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l0[current_mv.ref_idx[0]], -+ s->sh.luma_offset_l0[current_mv.ref_idx[0]]); -++ } -+ -+ if (s->ps.sps->chroma_format_idc) { -+ #ifdef RPI_INTER_QPU -+@@ -2078,10 +2126,47 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -++#ifdef RPI_LUMA_QPU -++ if (s->enable_rpi) { -++ int reflist = 1; -++ const Mv *mv = ¤t_mv.mv[reflist]; -++ int mx = mv->x & 3; -++ int my = mv->y & 3; -++ int my_mx = (my<<8) + mx; -++ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -++ int x1 = x0 + (mv->x >> 2); -++ int y1 = y0 + (mv->y >> 2); -++ int chan = x0>>6; // 64 wide blocks per QPU -++ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -++ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -++ uint32_t *y = s->y_mvs[chan % 12]; -++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -++ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = my2_mx2_my_mx; -++ if (weight_flag) { -++ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -++ } else { -++ *y++ = 1; // Weight of 1 and offset of 0 -++ } -++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -++ } -++ } -++ s->y_mvs[chan % 12] = y; -++ } else -++#endif -++ -++ { -++ RPI_REDIRECT(luma_mc_uni)(s, dst0, s->frame->linesize[0], ref1->frame, -+ ¤t_mv.mv[1], x0, y0, nPbW, nPbH, -+ s->sh.luma_weight_l1[current_mv.ref_idx[1]], -+ s->sh.luma_offset_l1[current_mv.ref_idx[1]]); -++ } -+ -+ if (s->ps.sps->chroma_format_idc) { -+ #ifdef RPI_INTER_QPU -+@@ -2115,8 +2200,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_my][0]; -+ if (weight_flag) { -+- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][0] & 0xffff); -+- *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[1]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[1]][1] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][0] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][0] & 0xffff); -++ *u++ = (s->sh.chroma_offset_l0[current_mv.ref_idx[reflist]][1] << 16) + (s->sh.chroma_weight_l0[current_mv.ref_idx[reflist]][1] & 0xffff); -+ } else { -+ *u++ = 1; // Weight of 1 and offset of 0 -+ *u++ = 1; -+@@ -2143,9 +2228,44 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int nPbW_c = nPbW >> s->ps.sps->hshift[1]; -+ int nPbH_c = nPbH >> s->ps.sps->vshift[1]; -+ -+- RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -++#ifdef RPI_LUMA_QPU -++ if (s->enable_rpi) { -++ const Mv *mv = ¤t_mv.mv[0]; -++ int mx = mv->x & 3; -++ int my = mv->y & 3; -++ int my_mx = (my<<8) + mx; -++ const Mv *mv2 = ¤t_mv.mv[1]; -++ int mx2 = mv2->x & 3; -++ int my2 = mv2->y & 3; -++ int my2_mx2 = (my2<<8) + mx2; -++ int my2_mx2_my_mx = (my2_mx2 << 16) + my_mx; -++ int x1 = x0 + (mv->x >> 2); -++ int y1 = y0 + (mv->y >> 2); -++ int x2 = x0 + (mv2->x >> 2); -++ int y2 = y0 + (mv2->y >> 2); -++ int chan = x0>>6; // 64 wide blocks per QPU -++ uint32_t *y = s->y_mvs[chan % 12]; -++ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -++ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = my2_mx2_my_mx; -++ *y++ = 1; // B frame weighted prediction not supported -++ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -++ } -++ } -++ s->y_mvs[chan % 12] = y; -++ } else -++#endif -++ { -++ RPI_REDIRECT(luma_mc_bi)(s, dst0, s->frame->linesize[0], ref0->frame, -+ ¤t_mv.mv[0], x0, y0, nPbW, nPbH, -+ ref1->frame, ¤t_mv.mv[1], ¤t_mv); -++ } -+ -+ if (s->ps.sps->chroma_format_idc) { -+ #ifdef RPI_INTER_QPU -+@@ -2834,7 +2954,6 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = pic_height; -+ *s->u_mvs[i]++ = s->frame->linesize[1]; -+ *s->u_mvs[i]++ = s->frame->linesize[2]; -+- *s->u_mvs[i]++ = i; -+ if (weight_flag) { -+ *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+ *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -+@@ -2842,7 +2961,31 @@ static void rpi_inter_clear(HEVCContext *s) -+ *s->u_mvs[i]++ = 1 << 5; -+ *s->u_mvs[i]++ = 6; -+ } -++ *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -++ } -++ -++#ifdef RPI_LUMA_QPU -++ for(i=0;i<12;i++) { -++ s->y_mvs[i] = s->y_mvs_base[i]; -++ *s->y_mvs[i]++ = 0; // y_x -++ *s->y_mvs[i]++ = 0; // ref_y_base -++ *s->y_mvs[i]++ = 0; // y2_x2 -++ *s->y_mvs[i]++ = 0; // ref_y2_base -++ *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -++ *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch -++ *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch -++ if (weight_flag) { -++ int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); -++ int shift = s->sh.luma_log2_weight_denom + 6; -++ *s->y_mvs[i]++ = (offset << 16) + shift; -++ } else { -++ int offset = 1 << 5; -++ int shift = 6; -++ *s->y_mvs[i]++ = (offset << 16) + shift; -++ } -++ *s->y_mvs[i]++ = 0; // Next kernel -+ } -++#endif -+ } -+ -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+@@ -2850,6 +2993,9 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ int k; -+ int i; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++#ifdef RPI_LUMA_QPU -++ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; -++#endif -+ if (s->sh.slice_type == I_SLICE) { -+ #ifdef RPI_MULTI_MAILBOX -+ rpi_execute_transform(s); -+@@ -2865,8 +3011,23 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -++#ifdef RPI_LUMA_QPU -++ for(k=0;k<12;k++) { -++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -++ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -++ } -++ s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++#endif -++ -++ -+ #ifdef RPI_MULTI_MAILBOX -++#ifdef RPI_CACHE_UNIF_MVS -++ gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); -++#else -+ gpu_cache_flush(&s->coeffs_buf_accelerated); -++#endif -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+@@ -2876,7 +3037,27 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++#ifdef RPI_LUMA_QPU -++ qpu_get_fn(QPU_MC_SETUP), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) -++#else -++ 0, -++ 0,0,0,0, -++ 0,0,0,0, -++ 0,0,0,0 -++#endif -+ ); -+ for(i=0;i<4;i++) -+ s->num_coeffs[i] = 0; -+@@ -2892,6 +3073,8 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -+ ); -+ #endif -++ -++ -+ } -+ #endif -+ -+@@ -3579,8 +3762,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) -+ fail: -+ if (s->ref && s->threads_type == FF_THREAD_FRAME) { -+ #ifdef RPI_INTER_QPU -+- void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -+- ff_hevc_flush_chroma(s, &s->ref->tf, s->ps.sps->height); -++ ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -+ } -+@@ -3767,7 +3949,6 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ -+ #ifdef RPI -+ av_freep(&s->unif_mv_cmds); -+- av_freep(&s->unif_xfm_cmds); -+ av_freep(&s->univ_pred_cmds); -+ -+ #ifdef RPI_INTER_QPU -+@@ -3776,7 +3957,12 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ s->unif_mvs = 0; -+ } -+ #endif -+- //gpu_free(&s->dummy); -++#ifdef RPI_LUMA_QPU -++ if (s->y_unif_mvs) { -++ gpu_free( &s->y_unif_mvs_ptr ); -++ s->y_unif_mvs = 0; -++ } -++#endif -+ -+ #ifdef EARLY_MALLOC -+ printf("hevc_decode_free\n"); -+@@ -3861,9 +4047,6 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -+ if (!s->unif_mv_cmds) -+ goto fail; -+- s->unif_xfm_cmds = av_mallocz(sizeof(HEVCXfmCmd)*RPI_MAX_XFM_CMDS); -+- if (!s->unif_xfm_cmds) -+- goto fail; -+ s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+ if (!s->univ_pred_cmds) -+ goto fail; -+@@ -3877,7 +4060,11 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; -+ uint32_t *p; -++#ifdef RPI_CACHE_UNIF_MVS -++ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++#else -+ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++#endif -+ s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -+ -+ // Set up initial locations for uniform streams -+@@ -3892,6 +4079,28 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ -+ } -+ #endif -++#ifdef RPI_LUMA_QPU -++ { -++ int y_commands_per_qpu = Y_COMMANDS_PER_QPU; -++ uint32_t *p; -++#ifdef RPI_CACHE_UNIF_MVS -++ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -++#else -++ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -++#endif -++ s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ -++ // Set up initial locations for uniform streams -++ p = s->y_unif_mvs; -++ for(i = 0; i < 12; i++) { -++ s->y_mvs_base[i] = p; -++ p += y_commands_per_qpu; -++ } -++ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -++ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -++ -++ } -++#endif -+ //gpu_malloc_uncached(2048*64,&s->dummy); -+ -+ #ifdef EARLY_MALLOC -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 4a39e39..5df9dcd 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -44,9 +44,13 @@ -+ #ifdef RPI -+ -+ #include "rpi_qpu.h" -+- // Use QPU for inter prediction -++ // Define RPI_INTER_QPU to use QPU for chroma inter prediction -+ #define RPI_INTER_QPU -+ -++ #ifdef RPI_INTER_QPU -++ // Define RPI_LUMA_QPU to also use QPU for luma inter prediction -++ #define RPI_LUMA_QPU -++ #endif -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -809,7 +813,6 @@ typedef struct HEVCLocalContext { -+ -+ // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -+ #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+-#define RPI_MAX_XFM_CMDS (16*3*(RPI_MAX_WIDTH/4)) -+ // Each block can have an intra prediction and a transform_add command -+ #define RPI_MAX_PRED_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+ // Worst case is 16x16 CTUs -+@@ -844,9 +847,6 @@ typedef struct HEVCMvCmd { -+ int8_t ref_idx[2]; -+ } HEVCMvCmd; -+ -+-// Command for transform to process a block of coefficients -+-typedef struct HEVCXfmCmd { -+-} HEVCXfmCmd; -+ -+ // Command for intra prediction and transform_add of predictions to coefficients -+ #define RPI_PRED_TRANSFORM_ADD 0 -+@@ -892,8 +892,7 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI -+ int enable_rpi; -+- HEVCMvCmd *unif_mv_cmds; // TODO rename -+- HEVCXfmCmd *unif_xfm_cmds; -++ HEVCMvCmd *unif_mv_cmds; -+ HEVCPredCmd *univ_pred_cmds; -+ int buf_width; -+ GPU_MEM_PTR_T coeffs_buf_default; -+@@ -920,6 +919,15 @@ typedef struct HEVCContext { -+ uint32_t mc_filter_uv_b0; -+ uint32_t mc_filter_uv_b; -+ #endif -++#ifdef RPI_LUMA_QPU -++ GPU_MEM_PTR_T y_unif_mvs_ptr; -++ uint32_t *y_unif_mvs; // Base of memory for motion vector commands -++ uint32_t *y_mvs_base[12]; -++ uint32_t *y_mvs[12]; -++ // Function pointers -++ uint32_t mc_filter; -++ uint32_t mc_filter_b; -++#endif -+ -+ #endif -+ -+@@ -1166,6 +1174,10 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int log2_trafo_size, enum ScanType scan_idx, -+ int c_idx); -+ -++#ifdef RPI_INTER_QPU -++extern void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n); -++#endif -++ -+ void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size); -+ -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index ec84e8a..11629e4 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -883,8 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { -+ return p->vc & 0x3fffffff; -+ } -+ -+-void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n); -+-void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -++void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+ s->nal_unit_type == NAL_TSA_N || -+@@ -911,10 +910,24 @@ void ff_hevc_flush_chroma(HEVCContext *s, ThreadFrame *f, int n) -+ iocache.s[1].cmd = 3; // clean+invalidate -+ iocache.s[1].addr = p->arm + base; -+ iocache.s[1].size = sz; -++ -++#ifdef RPI_LUMA_QPU -++ p = av_buffer_pool_opaque(s->frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = p->arm + base; -++ iocache.s[2].size = sz; -++#endif -+ vcsm_clean_invalid( &iocache ); -+ #else -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -++#ifdef RPI_LUMA_QPU -++ flush_buffer(s->frame->buf[1]); -++#endif -++ -+ #endif -+ //memcpy(s->dummy.arm,s->frame->data[0],2048*64); -+ //memcpy(s->dummy.arm,s->frame->data[1],1024*32); -+@@ -938,7 +951,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x, y - ctb_size); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s,&s->ref->tf, y); -++ ff_hevc_flush_buffer(s,&s->ref->tf, y); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y, 0); -+ } -+@@ -947,7 +960,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ sao_filter_CTB(s, x , y); -+ if (s->threads_type & FF_THREAD_FRAME ) { -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size); -++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0); -+ } -+@@ -957,7 +970,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -+ #ifdef RPI_INTER_QPU -+- ff_hevc_flush_chroma(s, &s->ref->tf, y + ctb_size - 4); -++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index aa65a77..e12304b 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -1,9 +1,11 @@ -+ #ifdef RPI -+ // This works better than the mmap in that the memory can be cached, but requires a kernel modification to enable the device. -+ // define RPI_TIME_TOTAL_QPU to print out how much time is spent in the QPU code -+-#define RPI_TIME_TOTAL_QPU -++//#define RPI_TIME_TOTAL_QPU -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+ //#define RPI_TIME_TOTAL_VPU -++// define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined -++//#define RPI_TIME_TOTAL_POSTED -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -+ -+@@ -94,7 +96,8 @@ struct GPU -+ int open_count; // Number of allocated video buffers -+ int mb; // Mailbox handle -+ int vc; // Address in GPU memory -+- int mail[12]; // These are used to pass pairs of code/unifs to the QPUs -++ int mail[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the first QPU task -++ int mail2[12*2]; // These are used to pass pairs of code/unifs to the QPUs for the second QPU task -+ }; -+ -+ // Stop more than one thread trying to allocate memory or use the processing resources at once -+@@ -102,7 +105,7 @@ static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+ static volatile struct GPU* gpu = NULL; -+ static GPU_MEM_PTR_T gpu_mem_ptr; -+ -+-#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) -++#if defined(RPI_TIME_TOTAL_QPU) || defined(RPI_TIME_TOTAL_VPU) || defined(RPI_TIME_TOTAL_POSTED) -+ static unsigned int Microseconds(void) { -+ struct timespec ts; -+ unsigned int x; -+@@ -123,7 +126,7 @@ static pthread_cond_t post_cond_head = PTHREAD_COND_INITIALIZER; -+ static pthread_cond_t post_cond_tail = PTHREAD_COND_INITIALIZER; -+ static pthread_mutex_t post_mutex = PTHREAD_MUTEX_INITIALIZER; -+ -+-static int vpu_cmds[MAXCMDS][16]; -++static int vpu_cmds[MAXCMDS][32]; -+ static volatile int vpu_async_tail=0; // Contains the number of posted jobs -+ static volatile int vpu_async_head=0; -+ #endif -+@@ -247,7 +250,6 @@ int gpu_get_mailbox(void) -+ // Call this to clean and invalidate a region of memory -+ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ { -+-#define RPI_FAST_CACHEFLUSH -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ iocache.s[0].handle = p->vcsm_handle; -+@@ -261,6 +263,34 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ #endif -+ } -+ -++void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -++{ -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ iocache.s[0].handle = p0->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = (int) p0->arm; -++ iocache.s[0].size = p0->numbytes; -++ iocache.s[1].handle = p1->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = (int) p1->arm; -++ iocache.s[1].size = p1->numbytes; -++ iocache.s[2].handle = p2->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = (int) p2->arm; -++ iocache.s[2].size = p2->numbytes; -++ vcsm_clean_invalid( &iocache ); -++#else -++ void *tmp; -++ tmp = vcsm_lock(p0->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++ tmp = vcsm_lock(p1->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++ tmp = vcsm_lock(p2->vcsm_handle); -++ vcsm_unlock_ptr(tmp); -++#endif -++} -++ -+ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -+ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST, (char *)"Video Frame" ); -+@@ -357,9 +387,19 @@ unsigned int vpu_get_constants(void) { -+ #ifdef RPI_ASYNC -+ -+ static void *vpu_start(void *arg) { -++#ifdef RPI_TIME_TOTAL_POSTED -++ int last_time=0; -++ long long on_time=0; -++ long long off_time=0; -++ int start_time; -++ int end_time; -++ int count=0; -++#endif -+ while(1) { -++ int i; -+ int *p; -+ int qpu_code; -++ int qpu_codeb; -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+@@ -373,24 +413,49 @@ static void *vpu_start(void *arg) { -+ break; // Last job -+ } -+ qpu_code = p[7]; -++ qpu_codeb = p[16]; -+ //if (p[7]) { -+ //GPU_MEM_PTR_T *buf = (GPU_MEM_PTR_T *)p[7]; -+ //gpu_cache_flush(buf); -+ //} -++ -++#ifdef RPI_TIME_TOTAL_POSTED -++ start_time = Microseconds(); -++ if (last_time==0) -++ last_time = start_time; -++ off_time += start_time-last_time; -++#endif -++ -+ if (!qpu_code) { -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ } else { -+- int i; -+ for(i=0;i<8;i++) { -+ gpu->mail[i*2] = p[8+i]; -+ gpu->mail[i*2 + 1] = qpu_code; -+ } -+- -+- execute_multi(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+- 0, 0, 0, 0, -++ for(i=0;i<12;i++) { -++ gpu->mail2[i*2] = p[17+i]; -++ gpu->mail2[i*2 + 1] = qpu_codeb; -++ } -++#if (0) -++ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -++ execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); -++#else -++ execute_multi(gpu->mb, -++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -++#endif -+ } -++#ifdef RPI_TIME_TOTAL_POSTED -++ end_time = Microseconds(); -++ last_time = end_time; -++ on_time += end_time - start_time; -++ count++; -++ if ((count&0x7f)==0) -++ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++#endif -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond_head); -+@@ -436,7 +501,9 @@ int vpu_post_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned -+ } -+ -+ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8) -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, -++ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b -++ ) -+ { -+ -+ pthread_mutex_lock(&post_mutex); -+@@ -464,6 +531,21 @@ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, -+ p[13] = unifs6; -+ p[14] = unifs7; -+ p[15] = unifs8; -++ -++ p[16] = qpu_codeb; -++ p[17] = unifs1b; -++ p[18] = unifs2b; -++ p[19] = unifs3b; -++ p[20] = unifs4b; -++ p[21] = unifs5b; -++ p[22] = unifs6b; -++ p[23] = unifs7b; -++ p[24] = unifs8b; -++ p[25] = unifs9b; -++ p[26] = unifs10b; -++ p[27] = unifs11b; -++ p[28] = unifs12b; -++ -+ if (num<=1) -+ pthread_cond_broadcast(&post_cond_tail); // Otherwise the vpu thread must already be awake -+ pthread_mutex_unlock(&post_mutex); -+@@ -544,27 +626,27 @@ void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int un -+ off_time += start_time-last_time; -+ #endif -+ for(i=0;imail[i*2 + 1] = code; -++ gpu->mail2[i*2 + 1] = code; -+ } -+ for(;imail[i*2 + 1] = code2; -++ gpu->mail2[i*2 + 1] = code2; -+ } -+- gpu->mail[0 ] = unifs1; -+- gpu->mail[2 ] = unifs2; -+- gpu->mail[4 ] = unifs3; -+- gpu->mail[6 ] = unifs4; -+- gpu->mail[8 ] = unifs5; -+- gpu->mail[10] = unifs6; -+- gpu->mail[12] = unifs7; -+- gpu->mail[14] = unifs8; -+- gpu->mail[16] = unifs9; -+- gpu->mail[18] = unifs10; -+- gpu->mail[20] = unifs11; -+- gpu->mail[22] = unifs12; -++ gpu->mail2[0 ] = unifs1; -++ gpu->mail2[2 ] = unifs2; -++ gpu->mail2[4 ] = unifs3; -++ gpu->mail2[6 ] = unifs4; -++ gpu->mail2[8 ] = unifs5; -++ gpu->mail2[10] = unifs6; -++ gpu->mail2[12] = unifs7; -++ gpu->mail2[14] = unifs8; -++ gpu->mail2[16] = unifs9; -++ gpu->mail2[18] = unifs10; -++ gpu->mail2[20] = unifs11; -++ gpu->mail2[22] = unifs12; -+ execute_qpu( -+ gpu->mb, -+ 12 /* Number of QPUs */, -+- gpu->vc + offsetof(struct GPU, mail), -++ gpu->vc + offsetof(struct GPU, mail2), -+ 1 /* no flush */, // Don't flush VPU L1 cache -+ 5000 /* timeout ms */); -+ #ifdef RPI_TIME_TOTAL_QPU -+@@ -635,21 +717,21 @@ unsigned int qpu_get_fn(int num) { -+ gpu_unlock(); -+ } -+ switch(num) { -+- //case QPU_MC_SETUP: -+- // fn = mc_setup; -+- // break; -+- //case QPU_MC_FILTER: -+- // fn = mc_filter; -+- // break; -++ case QPU_MC_SETUP: -++ fn = mc_setup; -++ break; -++ case QPU_MC_FILTER: -++ fn = mc_filter; -++ break; -+ case QPU_MC_EXIT: -+ fn = mc_exit; -+ break; -+- //case QPU_MC_INTERRUPT_EXIT: -+- // fn = mc_interrupt_exit; -+- // break; -+- //case QPU_MC_FILTER_B: -+- // fn = mc_filter_b; -+- // break; -++ case QPU_MC_INTERRUPT_EXIT12: -++ fn = mc_interrupt_exit12; -++ break; -++ case QPU_MC_FILTER_B: -++ fn = mc_filter_b; -++ break; -+ //case QPU_MC_FILTER_HONLY: -+ // fn = mc_filter_honly; -+ // break; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 0565a60..81c2bb1 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -1,6 +1,7 @@ -+ #ifndef RPI_QPU_H -+ #define RPI_QPU_H -+ -++// Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code -+ #define RPI_FAST_CACHEFLUSH -+ -+ typedef struct gpu_mem_ptr_s { -+@@ -16,6 +17,7 @@ extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -+ extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -+ extern void gpu_free(GPU_MEM_PTR_T *p); -+ extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -++extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -+ // QPU specific functions -+ extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+@@ -26,7 +28,7 @@ enum { -+ QPU_MC_SETUP, -+ QPU_MC_FILTER, -+ QPU_MC_EXIT, -+- QPU_MC_INTERRUPT_EXIT, -++ QPU_MC_INTERRUPT_EXIT12, -+ QPU_MC_FILTER_B, -+ QPU_MC_FILTER_HONLY, -+ QPU_MC_SETUP_UV, -+@@ -44,7 +46,9 @@ extern unsigned int vpu_get_constants(void); -+ extern unsigned vpu_execute_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5); -+ extern int vpu_post_code( unsigned code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, GPU_MEM_PTR_T *buf); -+ int vpu_qpu_post_code(unsigned vpu_code, unsigned r0, unsigned r1, unsigned r2, unsigned r3, unsigned r4, unsigned r5, -+- int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -++ int qpu_code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, -++ int qpu_codeb, int unifs1b, int unifs2b, int unifs3b, int unifs4b, int unifs5b, int unifs6b, int unifs7b, int unifs8b, int unifs9b, int unifs10b, int unifs11b, int unifs12b -++ ); -+ extern void vpu_wait( int id); -+ -+ // Simple test of shader code -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index a0f0282..e86eb30 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -48,693 +48,674 @@ unsigned int rpi_shader[] = { -+ /* [0x000000b8] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+ /* [0x000000c0] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+ /* [0x000000c8] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x000000d0] */ 0x15827d80, 0x100208e7, // mov r3, unif -+-/* [0x000000d8] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+-/* [0x000000e0] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x000000e8] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x000000f0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x000000f8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000100] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000108] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000110] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000118] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000120] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000128] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000130] */ 0x119c17c0, 0xd00208a7, // shl r2, r3, 1 -+-/* [0x00000138] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -+-/* [0x00000140] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000148] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000150] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000158] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000160] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000168] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000170] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000178] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000180] */ 0x0f9c11c0, 0xd0020827, // asr r0, r0, 1 -+-/* [0x00000188] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -+-/* [0x00000190] */ 0x0c9e7040, 0x10021567, // add rb21, r0, r1 -+-/* [0x00000198] */ 0x15427d80, 0x10020827, // mov r0, ra_x -+-/* [0x000001a0] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -+-/* [0x000001a8] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -+-/* [0x000001b0] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -+-/* [0x000001b8] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x000001c0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000001c8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000001d0] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x000000d0] */ 0x15427d80, 0x10020827, // mov r0, ra_x -++/* [0x000000d8] */ 0x937401f6, 0xd0024821, // max r0, r0, 0; mov r1, ra_y -++/* [0x000000e0] */ 0x926191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, ra_frame_base -++/* [0x000000e8] */ 0x916431f6, 0xd00244e2, // shl ra_xshift_next, r0, 3 ; mov r2, ra_u2v_ref_offset -++/* [0x000000f0] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x000000f8] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000100] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000108] */ 0x939c03c0, 0xd0025850, // max r1, r1, 0 ; mov ra_x, r0 -++/* [0x00000110] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000118] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -++/* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -++/* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 -++/* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 -++/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 -++/* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 -++/* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif -++/* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -++/* [0x00000158] */ 0x149cf5c0, 0xd00208a7, // and r2, r2, 15 -++/* [0x00000160] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000168] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000170] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000178] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000180] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000188] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000190] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000198] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x000001a0] */ 0x0f9c11c0, 0xd00208a7, // asr r2, r0, 1 -++/* [0x000001a8] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) -++/* [0x000001b0] */ 0x0c9e7440, 0x10021567, // add rb21, r2, r1 -++/* [0x000001b8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x000001c0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x000001c8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x000001d0] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+ /* [0x000001d8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x000001e0] */ 0x4c9d040f, 0x100248a1, // add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+-/* [0x000001e8] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+-/* [0x000001f0] */ 0x0c9e7440, 0x10020e27, // add t0s, r2, r1 -+-/* [0x000001f8] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000200] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000208] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000210] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000218] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000220] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000228] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000230] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -+-/* [0x00000238] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x000001e0] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x000001e8] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000001f0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x000001f8] */ 0x0c427380, 0x10020e27, // add t0s, r1, ra_x -++/* [0x00000200] */ 0x0c627380, 0x10020f27, // add t1s, r1, ra_frame_base -+ // ::mc_filter_uv -+-/* [0x00000240] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000248] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000250] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000258] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000260] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000268] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000270] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000278] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000280] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000288] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000290] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x00000298] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000002a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000002a8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000002b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000002b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000002c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000002c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000002d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000002d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000002e0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000002e8] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000002f0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000002f8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000300] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000308] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000310] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000318] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000320] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000328] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000330] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000338] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000340] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000348] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000350] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000358] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000360] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000368] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000370] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -+-/* [0x00000378] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000380] */ 0x0f9e7080, 0x100613a7, // asr.ifnz rb14, r0, r2 -+-/* [0x00000388] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000390] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000208] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000210] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000218] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000220] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000228] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000230] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000238] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000240] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000248] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000250] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000258] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000260] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000268] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000270] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000278] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000280] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000288] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000290] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000298] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000002a0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000002a8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x000002b0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x000002b8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x000002c0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000002c8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002d0] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002d8] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002e0] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000002e8] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002f0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000002f8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000300] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000308] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000310] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000318] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -++/* [0x00000320] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000328] */ 0x0f9e7080, 0x100208e7, // asr r3, r0, r2 -++/* [0x00000330] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000338] */ 0x0f9e7080, 0x100613e7, // asr.ifnz rb15, r0, r2 -++/* [0x00000340] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000348] */ 0x0f9e7080, 0x100608e7, // asr.ifnz r3, r0, r2 -++/* [0x00000350] */ 0x119c87c0, 0xd00213a7, // shl rb14,r3,8 -++/* [0x00000358] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop -+-/* [0x00000398] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000003a0] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x000003a8] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x000003b0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x000003b8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x000003c0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x000003c8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000003d0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000003d8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000003e0] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000003e8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000003f0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000003f8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000400] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000408] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000410] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000418] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000420] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000428] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000430] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000438] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000440] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x00000448] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000450] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000458] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000460] */ 0x00000020, 0xe0021327, // mov rb12,32 -+-/* [0x00000468] */ 0x00000006, 0xe0021367, // mov rb13,6 -+-/* [0x00000470] */ 0x00000001, 0xe00213a7, // mov rb14,1 -+-/* [0x00000478] */ 0x00000000, 0xe00213e7, // mov rb15,0 -+-/* [0x00000480] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000488] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000490] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000498] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000004a0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000004a8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000004b0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000004b8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000004c0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000004c8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x000004d0] */ 0xfffffea8, 0xf06809e7, // brr.anyn -, r:uvloop -+-/* [0x000004d8] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x000004e0] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x000004e8] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x000004f0] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x000004f8] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000500] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000508] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000510] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000518] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000520] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000528] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000530] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000360] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000368] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -++/* [0x00000370] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000378] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000380] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000388] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000390] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000398] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000003a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000003a8] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -++/* [0x000003b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000003b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000003c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000003c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000003d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000003d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000003e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x000003e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x000003f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000003f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000400] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000408] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000410] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000418] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000420] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000428] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000430] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000438] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000440] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000448] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000450] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000458] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000460] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x00000468] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x00000470] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00000478] */ 0xfffffec8, 0xf06809e7, // brr.anyn -, r:uvloop -++/* [0x00000480] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00000488] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00000490] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00000498] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000004a0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004a8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000004b0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000004b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000004c0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000004c8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000004d0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000004d8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_uv_b0 -+-/* [0x00000538] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000540] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00000548] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000550] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000558] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x00000560] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000568] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x00000570] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x00000578] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x00000580] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000588] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x00000590] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -+-/* [0x00000598] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000005a0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005a8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000005b0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000005b8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x000005c0] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x000005c8] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x000005d0] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x000005d8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x000005e0] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x000005e8] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x000005f0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000005f8] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000600] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000608] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000610] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000618] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000620] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000628] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000630] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x00000638] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000640] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000648] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x00000650] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000658] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x000004e0] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x000004e8] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x000004f0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x000004f8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000500] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000508] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000510] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000518] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000520] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000528] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000530] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000538] */ 0x159d5fc0, 0x10021c67, // mov vw_setup, rb21 -++/* [0x00000540] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x00000548] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000550] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x00000558] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000560] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000568] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x00000570] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x00000578] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000580] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000588] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000590] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000598] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005a0] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005a8] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b0] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005b8] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x000005c0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005c8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x000005d8] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x000005e0] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005e8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000005f0] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x000005f8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000600] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b0 -+-/* [0x00000660] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000668] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x00000670] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000678] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000680] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000688] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000690] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000698] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x000006a0] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x000006a8] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x000006b0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000006b8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000006c0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000006c8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000006d0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000006d8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000006e0] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000006e8] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000006f0] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x000006f8] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000700] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000708] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000710] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000718] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00000720] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00000728] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00000730] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x00000738] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x00000740] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x00000748] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x00000750] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -+-/* [0x00000758] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -+-/* [0x00000760] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -+-/* [0x00000768] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000770] */ 0x009e7000, 0x100009e7, // nop -+-/* [0x00000778] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000780] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000788] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000790] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000608] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000610] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -++/* [0x00000618] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00000620] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00000628] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x00000630] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00000638] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00000640] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x00000648] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x00000650] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -++/* [0x00000658] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000660] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x00000668] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x00000670] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x00000678] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000680] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000688] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000690] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000698] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x000006a0] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x000006a8] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x000006b0] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x000006b8] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x000006c0] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000006c8] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000006d0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000006d8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000006e0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000006e8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000006f0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000006f8] */ 0x0d9d27c0, 0x100229e7, // sub.setf -, r3, rb18 -++/* [0x00000700] */ 0xfffffee8, 0xf06809e7, // brr.anyn -, r:uvloop_b0 -++/* [0x00000708] */ 0x0f9c63c0, 0xd0020c27, // asr vpm, r1, 6 -++/* [0x00000710] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000718] */ 0x009e7000, 0x100009e7, // nop -++/* [0x00000720] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000728] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000730] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000738] */ 0x009e7000, 0x100009e7, // nop -+ // ::mc_filter_uv_b -+-/* [0x00000798] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x000007a0] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x000007a8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000007b0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x000007b8] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -+-/* [0x000007c0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x000007c8] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -+-/* [0x000007d0] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -+-/* [0x000007d8] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -+-/* [0x000007e0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x000007e8] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -+-/* [0x000007f0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000007f8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000800] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000808] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000810] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000818] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000820] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -+-/* [0x00000828] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -+-/* [0x00000830] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000838] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -+-/* [0x00000840] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -+-/* [0x00000848] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -+-/* [0x00000850] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000858] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000860] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000868] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -+-/* [0x00000870] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000878] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000880] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000888] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000890] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000898] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a0] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008a8] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000008b0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -+-/* [0x000008b8] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008c0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000008c8] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -+-/* [0x000008d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000008d8] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000740] */ 0x15827d80, 0x100207e7, // mov ra31, unif -++/* [0x00000748] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -++/* [0x00000750] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -++/* [0x00000758] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -++/* [0x00000760] */ 0x928191f6, 0x10024823, // min r0, r0, rb_frame_width_minus_1 ; mov r3, unif -++/* [0x00000768] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000770] */ 0x0d827cc0, 0x100208a7, // sub r2, unif, r3 -++/* [0x00000778] */ 0x0c9e70c0, 0x10020827, // add r0, r0, r3 -++/* [0x00000780] */ 0x149dc1c0, 0xd00214e7, // and rb_x_next, r0, ~3 -++/* [0x00000788] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000790] */ 0x0c9d3e80, 0x100206a7, // add ra_frame_base_next, rb_x_next, r2 -++/* [0x00000798] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x000007a0] */ 0x00000010, 0xe00208a7, // mov r2, 16 -++/* [0x000007a8] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x000007b0] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -++/* [0x000007b8] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x000007c0] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x000007c8] */ 0x0c9c11c0, 0xd0021467, // add rb17, r0, 1 -++/* [0x000007d0] */ 0x0c9c31c0, 0xd00214a7, // add rb18, r0, 3 -++/* [0x000007d8] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x000007e0] */ 0x119cd1c0, 0xd00208e7, // shl r3, r0, 13 -++/* [0x000007e8] */ 0x119c87c0, 0xd00208e7, // shl r3, r3, 8 -++/* [0x000007f0] */ 0x0e9c87c0, 0xd00208e7, // shr r3, r3, 8 -++/* [0x000007f8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000800] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -++/* [0x00000808] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000810] */ 0x0c9d57c0, 0x10020c67, // add vr_setup, r3, rb21 -++/* [0x00000818] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000820] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000828] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000830] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000838] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -++/* [0x00000840] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000848] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000850] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000858] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000860] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000868] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000870] */ 0xfffffff8, 0xe0021967, // mov r5rep, -8 -++/* [0x00000878] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x00000880] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :uvloop_b -+-/* [0x000008e0] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x000008e8] */ 0x8e4539bf, 0xa0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -+-/* [0x000008f0] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x000008f8] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000900] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -+-/* [0x00000908] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000910] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000918] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000920] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-/* [0x00000928] */ 0x0c627c80, 0x10020e27, // add t0s, ra_frame_base, r2 -+-/* [0x00000930] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000938] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000940] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000948] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000950] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000958] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000960] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000968] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000970] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00000978] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00000980] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -+-/* [0x00000988] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x00000990] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00000998] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x000009a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x000009a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x000009b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000009b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000009c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000009c8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000009d0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000009d8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000009e0] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -+-/* [0x000009e8] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -+-/* [0x000009f0] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -+-/* [0x000009f8] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00000a00] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00000a08] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00000a10] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00000a18] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a20] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+-/* [0x00000a28] */ 0x00000010, 0xe0020827, // mov r0, 16 -+-/* [0x00000a30] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a38] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00000a40] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -+-/* [0x00000a48] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00000a50] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00000888] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00000890] */ 0x8e4539bf, 0xb0029810, // shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -++/* [0x00000898] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x000008a0] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x000008a8] */ 0xee454987, 0x10024860, // shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 -++/* [0x000008b0] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x000008b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000008c0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000008c8] */ 0xec414c8f, 0x10024e21, // add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -++/* [0x000008d0] */ 0x0c627c80, 0x10020f27, // add t1s, ra_frame_base, r2 -++/* [0x000008d8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000008e0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000008e8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000008f0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000008f8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x00000900] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00000908] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00000910] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00000918] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00000920] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00000928] */ 0x8d3447f6, 0xd00279cc, // sub.setf -, r3, 4 ; mov ra12, ra13 -++/* [0x00000930] */ 0xffffff38, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x00000938] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00000940] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00000948] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x00000950] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x00000958] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x00000960] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x00000968] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x00000970] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x00000978] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x00000980] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00000988] */ 0x0cc27380, 0x10020867, // add r1, r1, vpm -++/* [0x00000990] */ 0x0c7a7380, 0x10020867, // add r1, r1, ra30 -++/* [0x00000998] */ 0xfffffed0, 0xf06809e7, // brr.anyn -, r:uvloop_b -++/* [0x000009a0] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -++/* [0x000009a8] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x000009b0] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x000009b8] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x000009c0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009c8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x000009d0] */ 0x00000010, 0xe0020827, // mov r0, 16 -++/* [0x000009d8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000009e0] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x000009e8] */ 0x0c9dae00, 0x10021c67, // add vw_setup, rb26, r0 -++/* [0x000009f0] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x000009f8] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_exit -+-/* [0x00000a58] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000a60] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -+-/* [0x00000a68] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a70] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a78] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a80] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000a88] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000a90] */ 0x009e7000, 0x100009e7, // nop ; nop -+-/* [0x00000a98] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a00] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a08] */ 0x00000000, 0xe80009e7, // mov -,srel(0) -++/* [0x00000a10] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a18] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a20] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a28] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a30] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000a38] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a40] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_interrupt_exit8 -+-/* [0x00000aa0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00000aa8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ab0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ab8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac0] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00000ac8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ad8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000ae8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000af8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00000b00] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x00000b08] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x00000b10] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00000a48] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00000a50] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a58] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a60] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00000a68] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00000a70] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a78] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a80] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a88] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a90] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000a98] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00000aa8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00000ab0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_setup -+-/* [0x00000b18] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000b20] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00000b28] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b30] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000b38] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000b40] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000b48] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -+-/* [0x00000b50] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000b58] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000b60] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000b68] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000b70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000b78] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -+-/* [0x00000b80] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000b88] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000b90] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000b98] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000ba0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -+-/* [0x00000ba8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000bb0] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -+-/* [0x00000bb8] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -+-/* [0x00000bc0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000bc8] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000bd0] */ 0x8c9e7452, 0x10025e19, // add t0s, r2, r1 ; mov ra_frame_base2, r2 -+-/* [0x00000bd8] */ 0x0d801dc0, 0xd0021667, // sub rb25,unif,1 -+-/* [0x00000be0] */ 0x0d801dc0, 0xd00217a7, // sub rb30,unif,1 -+-/* [0x00000be8] */ 0x15827d80, 0x10021427, // mov rb16, unif -+-/* [0x00000bf0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000bf8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -+-/* [0x00000c00] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -+-/* [0x00000c08] */ 0x00000001, 0xe0020527, // mov ra20, 1 -+-/* [0x00000c10] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -+-/* [0x00000c18] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -+-/* [0x00000c20] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -+-/* [0x00000c28] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -+-/* [0x00000c30] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -+-/* [0x00000c38] */ 0x00000000, 0xe0020227, // mov ra8, 0 -+-/* [0x00000c40] */ 0x00000000, 0xe0020267, // mov ra9, 0 -+-/* [0x00000c48] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -+-/* [0x00000c50] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -+-/* [0x00000c58] */ 0x00000000, 0xe0020327, // mov ra12, 0 -+-/* [0x00000c60] */ 0x00000000, 0xe0020367, // mov ra13, 0 -+-/* [0x00000c68] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -+-/* [0x00000c70] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -+-/* [0x00000c78] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000c80] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000c88] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000c90] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000c98] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000ca0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000ca8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000cb0] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -+-/* [0x00000cb8] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -+-/* [0x00000cc0] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -+-/* [0x00000cc8] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -+-/* [0x00000cd0] */ 0x159e7480, 0x10020867, // mov r1, r2 -+-/* [0x00000cd8] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -+-/* [0x00000ce0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -+-/* [0x00000ce8] */ 0x159e7480, 0x10020827, // mov r0, r2 -+-/* [0x00000cf0] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -+-/* [0x00000cf8] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000d00] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -+-/* [0x00000d08] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -+-/* [0x00000d10] */ 0x15827d80, 0x10021327, // mov rb12,unif -+-/* [0x00000d18] */ 0x15827d80, 0x10021367, // mov rb13,unif -+-/* [0x00000d20] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000d28] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -+-/* [0x00000d30] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d38] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -+-/* [0x00000d40] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d48] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -+-/* [0x00000d50] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -+-/* [0x00000d58] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+-/* [0x00000d60] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00000ac0] */ 0x00000010, 0xe00208e7, // mov r3, 16 -++/* [0x00000ac8] */ 0x15827d80, 0x10020227, // mov ra8, unif -++/* [0x00000ad0] */ 0x15827d80, 0x10020267, // mov ra9, unif -++/* [0x00000ad8] */ 0x15827d80, 0x100202a7, // mov ra10, unif -++/* [0x00000ae0] */ 0x15827d80, 0x100202e7, // mov ra11, unif -++/* [0x00000ae8] */ 0x15827d80, 0x10020867, // mov r1, unif -++/* [0x00000af0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000af8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000b00] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000b08] */ 0x0d9c13c0, 0xd0021667, // sub rb_frame_width_minus_1,r1,1 -++/* [0x00000b10] */ 0x0d9c11c0, 0xd00217a7, // sub rb_frame_height_minus_1,r0,1 -++/* [0x00000b18] */ 0x15827d80, 0x10021427, // mov rb_pitch, unif -++/* [0x00000b20] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000b28] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) -++/* [0x00000b30] */ 0x0c9e7200, 0x10021627, // add rb24, r1, r0 -++/* [0x00000b38] */ 0x15227d80, 0x10020867, // mov r1, ra8 -++/* [0x00000b40] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000b48] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000b50] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000b58] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000b60] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000b68] */ 0x922591f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 -++/* [0x00000b70] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000b78] */ 0x0c9c13c0, 0xd0020767, // add ra_y, r1, 1 -++/* [0x00000b80] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000b88] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000b90] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000b98] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000ba0] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000ba8] */ 0x8c9e7452, 0x10025e18, // add t0s, r2, r1 ; mov ra_frame_base, r2 -++/* [0x00000bb0] */ 0x152a7d80, 0x10020867, // mov r1, ra10 -++/* [0x00000bb8] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000bc0] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000bc8] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000bd0] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000bd8] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000be0] */ 0x922d91f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 -++/* [0x00000be8] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000bf0] */ 0x0c9c13c0, 0xd0020567, // add ra_y2, r1, 1 -++/* [0x00000bf8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000c00] */ 0x0c9e7400, 0x100208a7, // add r2, r2, r0 -++/* [0x00000c08] */ 0x139c03c0, 0xd0020867, // max r1, r1, 0 -++/* [0x00000c10] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000c18] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000c20] */ 0x8c9e7452, 0x10025f19, // add t1s, r2, r1 ; mov ra_frame_base2, r2 -++/* [0x00000c28] */ 0x00000001, 0xe0020527, // mov ra20, 1 -++/* [0x00000c30] */ 0x00000100, 0xe00205a7, // mov ra22, 256 -++/* [0x00000c38] */ 0x00000040, 0xe00207a7, // mov ra30, 64 -++/* [0x00000c40] */ 0xffffff00, 0xe0021527, // mov rb20, 0xffffff00 -++/* [0x00000c48] */ 0x000000ff, 0xe00215a7, // mov rb22, 255 -++/* [0x00000c50] */ 0x00000018, 0xe00215e7, // mov rb23, 24 -++/* [0x00000c58] */ 0x00000000, 0xe0020227, // mov ra8, 0 -++/* [0x00000c60] */ 0x00000000, 0xe0020267, // mov ra9, 0 -++/* [0x00000c68] */ 0x00000000, 0xe00202a7, // mov ra10, 0 -++/* [0x00000c70] */ 0x00000000, 0xe00202e7, // mov ra11, 0 -++/* [0x00000c78] */ 0x00000000, 0xe0020327, // mov ra12, 0 -++/* [0x00000c80] */ 0x00000000, 0xe0020367, // mov ra13, 0 -++/* [0x00000c88] */ 0x00000000, 0xe00203a7, // mov ra14, 0 -++/* [0x00000c90] */ 0x00000000, 0xe00203e7, // mov ra15, 0 -++/* [0x00000c98] */ 0x00004000, 0xe00204a7, // mov ra18, 0x4000 -++/* [0x00000ca0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num -++/* [0x00000ca8] */ 0x159e7480, 0x10020867, // mov r1, r2 -++/* [0x00000cb0] */ 0x0f9c23c0, 0xd0020867, // asr r1, r1, 2 -++/* [0x00000cb8] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 -++/* [0x00000cc0] */ 0x159e7480, 0x10020827, // mov r0, r2 -++/* [0x00000cc8] */ 0x149c31c0, 0xd0020827, // and r0, r0, 3 -++/* [0x00000cd0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000cd8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) -++/* [0x00000ce0] */ 0x0c9e7040, 0x10021727, // add rb28, r0, r1 -++/* [0x00000ce8] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) -++/* [0x00000cf0] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 -++/* [0x00000cf8] */ 0x0c9e7040, 0x100216e7, // add rb27, r0, r1 -++/* [0x00000d00] */ 0x15827d80, 0x10020867, // mov r1, unif -++/* [0x00000d08] */ 0x919c82ff, 0xd0024822, // shl r0,r1,r3 ; mov r2,8 -++/* [0x00000d10] */ 0x0f9e70c0, 0x10021367, // asr rb13,r0,r3 -++/* [0x00000d18] */ 0x0f9e72c0, 0x10021327, // asr rb12,r1,r3 -++/* [0x00000d20] */ 0x0c9cde80, 0x10021367, // add rb13,rb13,r2 -++/* [0x00000d28] */ 0x119cce80, 0x10021327, // shl rb12, rb12, r2 -++/* [0x00000d30] */ 0x13740dc0, 0xd0020867, // max r1, ra_y, 0 -++/* [0x00000d38] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -++/* [0x00000d40] */ 0x0c741dc0, 0xd0020767, // add ra_y, ra_y, 1 -++/* [0x00000d48] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -++/* [0x00000d50] */ 0x0c627380, 0x10020e27, // add t0s, r1, ra_frame_base -++/* [0x00000d58] */ 0x13540dc0, 0xd0020867, // max r1, ra_y2, 0 -++/* [0x00000d60] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_frame_height_minus_1 -+ /* [0x00000d68] */ 0x0c541dc0, 0xd0020567, // add ra_y2, ra_y2, 1 -+ /* [0x00000d70] */ 0x409d000f, 0x100049e1, // nop ; mul24 r1, r1, rb_pitch -+-/* [0x00000d78] */ 0x0c667380, 0x10020e27, // add t0s, r1, ra_frame_base2 -+-// ::mc_filter -++/* [0x00000d78] */ 0x0c667380, 0x10020f27, // add t1s, r1, ra_frame_base2 -++// :per_block_setup -+ /* [0x00000d80] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ /* [0x00000d88] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+ /* [0x00000d90] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+ /* [0x00000d98] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00000da0] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000da8] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00000db0] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000db8] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00000dc0] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00000dc8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000dd0] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x00000dd8] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00000de0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x00000de8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00000df0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x00000df8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x00000e00] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00000e08] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x00000e10] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x00000e18] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x00000e20] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e28] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x00000e30] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x00000e38] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00000e40] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00000e48] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00000e50] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00000e58] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00000e60] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000e68] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00000e70] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000e78] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000e80] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e88] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e90] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000e98] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00000ea0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ea8] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000eb0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000eb8] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ec0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x00000ec8] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ed0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ed8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000ee8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x00000ef0] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000ef8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f00] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00000f08] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000da0] */ 0x00000010, 0xe00208e7, // mov r3, 16 -++/* [0x00000da8] */ 0x15827d80, 0x10020867, // mov r1, unif -++/* [0x00000db0] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000db8] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000dc0] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000dc8] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000dd0] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000dd8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000de0] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -++/* [0x00000de8] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -++/* [0x00000df0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000df8] */ 0x8c827436, 0x100246a1, // add ra_frame_base_next, r2, r0 ; mov r1, unif -++/* [0x00000e00] */ 0x119e72c0, 0x10020827, // shl r0,r1,r3 -++/* [0x00000e08] */ 0x0f9e72c0, 0x10020867, // asr r1,r1,r3 -++/* [0x00000e10] */ 0x0f9e70c0, 0x10020827, // asr r0,r0,r3 -++/* [0x00000e18] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num -++/* [0x00000e20] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 -++/* [0x00000e28] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -++/* [0x00000e30] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -++/* [0x00000e38] */ 0x159e7240, 0x10021067, // mov ra_y2_next, r1 -++/* [0x00000e40] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -++/* [0x00000e48] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -++/* [0x00000e50] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -++/* [0x00000e58] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00000e60] */ 0x0e9e70c0, 0x10020867, // shr r1, r0, r3 -++/* [0x00000e68] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -++/* [0x00000e70] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -++/* [0x00000e78] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -++/* [0x00000e80] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -++/* [0x00000e88] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -++/* [0x00000e90] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -++/* [0x00000e98] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 -++/* [0x00000ea0] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -++/* [0x00000ea8] */ 0x95801dbf, 0xd0024821, // mov r0, unif ; mov r1,1 -++/* [0x00000eb0] */ 0x4f5971c6, 0x10024260, // asr ra9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000eb8] */ 0x4f5971c6, 0x10024220, // asr ra8, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec0] */ 0x4f5971c6, 0x10044260, // asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 -++/* [0x00000ec8] */ 0x0f9d71c0, 0x10040227, // asr.ifz ra8, r0, rb23 -++/* [0x00000ed0] */ 0x0d243f80, 0xd0020267, // sub ra9,3,ra9 -++/* [0x00000ed8] */ 0x0d203f80, 0xd0020227, // sub ra8,3,ra8 -++/* [0x00000ee0] */ 0x11243dc0, 0xd0020267, // shl ra9,ra9,3 -++/* [0x00000ee8] */ 0x11203dc0, 0xd0020227, // shl ra8,ra8,3 -++/* [0x00000ef0] */ 0x00ffff00, 0xe0020867, // mov r1,0xffff00 -++/* [0x00000ef8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f00] */ 0x0f9d71c0, 0x10020027, // asr ra0, r0, rb23 -++/* [0x00000f08] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -+ /* [0x00000f10] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00000f18] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00000f20] */ 0x15827d80, 0x100009e7, // mov.ifnz -, unif -+-/* [0x00000f28] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00000f30] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00000f38] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00000f40] */ 0x00000000, 0xe00208e7, // mov r3, 0 -++/* [0x00000f18] */ 0x01040400, 0xe0020867, // mov r1,0x1040400 -++/* [0x00000f20] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f28] */ 0x0f9d71c0, 0x10020067, // asr ra1, r0, rb23 -++/* [0x00000f30] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000f38] */ 0x0f9d71c0, 0x10021167, // asr rb5, r0, rb23 -++/* [0x00000f40] */ 0xfbf5f600, 0xe0020867, // mov r1,0xfbf5f600 -++/* [0x00000f48] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f50] */ 0x0f9d71c0, 0x100200a7, // asr ra2, r0, rb23 -++/* [0x00000f58] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000f60] */ 0x0f9d71c0, 0x100211a7, // asr rb6, r0, rb23 -++/* [0x00000f68] */ 0x11283a40, 0xe0020867, // mov r1,0x11283a40 -++/* [0x00000f70] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000f78] */ 0x0f9d71c0, 0x100200e7, // asr ra3, r0, rb23 -++/* [0x00000f80] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000f88] */ 0x0f9d71c0, 0x100211e7, // asr rb7, r0, rb23 -++/* [0x00000f90] */ 0x3a281100, 0xe0020867, // mov r1,0x3a281100 -++/* [0x00000f98] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000fa0] */ 0x0f9d71c0, 0x10020127, // asr ra4, r0, rb23 -++/* [0x00000fa8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000fb0] */ 0x0f9d71c0, 0x10021227, // asr rb8, r0, rb23 -++/* [0x00000fb8] */ 0xf6f5fb00, 0xe0020867, // mov r1,0xf6f5fb00 -++/* [0x00000fc0] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000fc8] */ 0x0f9d71c0, 0x10020167, // asr ra5, r0, rb23 -++/* [0x00000fd0] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00000fd8] */ 0x0f9d71c0, 0x10021267, // asr rb9, r0, rb23 -++/* [0x00000fe0] */ 0x04040100, 0xe0020867, // mov r1,0x4040100 -++/* [0x00000fe8] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00000ff0] */ 0x0f9d71c0, 0x100201a7, // asr ra6, r0, rb23 -++/* [0x00000ff8] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00001000] */ 0x0f9d71c0, 0x100212a7, // asr rb10, r0, rb23 -++/* [0x00001008] */ 0xffff0000, 0xe0020867, // mov r1,0xffff0000 -++/* [0x00001010] */ 0x11227380, 0x10020827, // shl r0, r1, ra8 -++/* [0x00001018] */ 0x0f9d71c0, 0x100201e7, // asr ra7, r0, rb23 -++/* [0x00001020] */ 0x11267380, 0x10020827, // shl r0, r1, ra9 -++/* [0x00001028] */ 0x0f9d71c0, 0x100212e7, // asr rb11, r0, rb23 -++/* [0x00001030] */ 0x15827d80, 0x10020827, // mov r0, unif -++/* [0x00001038] */ 0x0f9e70c0, 0x100213e7, // asr rb15, r0, r3 -++/* [0x00001040] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -++/* [0x00001048] */ 0x119e70c0, 0x10020827, // shl r0, r0, r3 -++/* [0x00001050] */ 0x8f9c00ff, 0xd0024823, // asr r0, r0, r3 ; mov r3, 0 -++/* [0x00001058] */ 0x119c81c0, 0xd00213a7, // shl rb14, r0, 8 -++// ::mc_filter -+ // :yloop -+-/* [0x00000f48] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00000f50] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00000f58] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00000f60] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00000f68] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00000f70] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00000f78] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00000f80] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000f88] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00000f90] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000f98] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x00000fa0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00000fa8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x00000fb0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x00000fb8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00000fc0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x00000fc8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x00000fd0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x00000fd8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x00000fe0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x00000fe8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x00000ff0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x00000ff8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001000] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001008] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001010] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001018] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001020] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001028] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001030] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001038] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001040] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001048] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001050] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001058] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001060] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001068] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001070] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001078] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001080] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001088] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00001090] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00001098] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000010a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000010a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000010b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000010b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000010c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000010c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000010d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000010d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000010e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000010e8] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -+-/* [0x000010f0] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -+-/* [0x000010f8] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -+-/* [0x00001100] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -+-/* [0x00001108] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -+-/* [0x00001110] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001118] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001120] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001128] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001130] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001138] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001060] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001068] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++/* [0x00001070] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001078] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001080] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001088] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001090] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001098] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000010a0] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000010a8] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x000010b0] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000010b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000010c0] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000010c8] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -++/* [0x000010d0] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000010d8] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000010e0] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000010e8] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000010f0] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000010f8] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x00001100] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001108] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001110] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001118] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001120] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001128] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001130] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001138] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001140] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001148] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001150] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001158] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001160] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 -++/* [0x00001168] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001170] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001178] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001180] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001188] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001190] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001198] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x000011a0] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000011a8] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000011b0] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000011b8] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000011c0] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000011c8] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000011d0] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000011d8] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000011e0] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000011e8] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000011f0] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000011f8] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -++/* [0x00001200] */ 0x409ce00f, 0x100049e1, // nop ; mul24 r1, r1, rb14 -++/* [0x00001208] */ 0x0c9cc3c0, 0x10020867, // add r1, r1, rb12 -++/* [0x00001210] */ 0x0f9cd3c0, 0x10020867, // asr r1, r1, rb13 -++/* [0x00001218] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloop -++/* [0x00001220] */ 0x0c9cf3c0, 0x10020867, // add r1, r1, rb15 -++/* [0x00001228] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001230] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001238] */ 0xfffffb28, 0xf0f809e7, // brr -, r:per_block_setup -++/* [0x00001240] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001248] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001250] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_filter_b -+-/* [0x00001140] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x00001148] */ 0x15827d80, 0x100207e7, // mov ra31, unif -+-/* [0x00001150] */ 0x154e7d80, 0x10020467, // mov ra_xshift, ra_xshift_next -+-/* [0x00001158] */ 0x155e7d80, 0x10021027, // mov rx_xshift2, rx_xshift2_next -+-/* [0x00001160] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x00001168] */ 0x938001f6, 0xd0024821, // max r0, r0, 0; mov r1, unif -+-/* [0x00001170] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x00001178] */ 0x119c31c0, 0xd00204e7, // shl ra_xshift_next, r0, 3 -+-/* [0x00001180] */ 0x159e7240, 0x10020727, // mov ra_y_next, r1 -+-/* [0x00001188] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x00001190] */ 0x0c9e7400, 0x100206a7, // add ra_frame_base_next, r2, r0 -+-/* [0x00001198] */ 0x0c9a0f80, 0x10020827, // add r0, unif, elem_num -+-/* [0x000011a0] */ 0x938001f6, 0xd0024821, // max r0, r0, 0 ; mov r1, unif -+-/* [0x000011a8] */ 0x928191f6, 0x10024822, // min r0, r0, rb_frame_width_minus_1 ; mov r2, unif -+-/* [0x000011b0] */ 0x119c31c0, 0xd00205e7, // shl rx_xshift2_next, r0, 3 -+-/* [0x000011b8] */ 0x0c9c13c0, 0xd0021067, // add ra_y2_next, r1, 1 -+-/* [0x000011c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, ~3 -+-/* [0x000011c8] */ 0x0c9e7400, 0x100214e7, // add rx_frame_base2_next, r2, r0 -+-/* [0x000011d0] */ 0x159dcfc0, 0x10021c67, // mov vw_setup, rb28 -+-/* [0x000011d8] */ 0x00000010, 0xe00208a7, // mov r2, 16 -+-/* [0x000011e0] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x000011e8] */ 0x0e9e7080, 0x10020867, // shr r1, r0, r2 -+-/* [0x000011f0] */ 0x0d9d8e40, 0x10021767, // sub rb29, rb24, r1 -+-/* [0x000011f8] */ 0x149d61c0, 0x10020827, // and r0, r0, rb22 -+-/* [0x00001200] */ 0x0c9c51c0, 0xd0021467, // add rb17, r0, 5 -+-/* [0x00001208] */ 0x0c9c71c0, 0xd00214a7, // add rb18, r0, 7 -+-/* [0x00001210] */ 0x119c71c0, 0xd0020827, // shl r0, r0, 7 -+-/* [0x00001218] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 -+-/* [0x00001220] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001228] */ 0x0c9db1c0, 0x100216a7, // add rb26, r0, rb27 -+-/* [0x00001230] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001238] */ 0x00000001, 0xe0020867, // mov r1, 1 -+-/* [0x00001240] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001248] */ 0x409f3001, 0xd00049e0, // nop ; mul24 r0, r0 << 13, r1 << 13 -+-/* [0x00001250] */ 0x4f5971c6, 0x100240e0, // asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001258] */ 0x409f2001, 0xd00049e0, // nop ; mul24 r0, r0 << 14, r1 << 14 -+-/* [0x00001260] */ 0x4f5971c6, 0x100240a0, // asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001268] */ 0x409f1001, 0xd00049e0, // nop ; mul24 r0, r0 << 15, r1 << 15 -+-/* [0x00001270] */ 0x4f5971c6, 0x10024060, // asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001278] */ 0x8f8171f6, 0x10024020, // asr ra0, r0, rb23; mov r0, unif -+-/* [0x00001280] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001288] */ 0x409f7001, 0xd00049e0, // nop ; mul24 r0, r0 << 9, r1 << 9 -+-/* [0x00001290] */ 0x4f5971c6, 0x100241e0, // asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001298] */ 0x409f6001, 0xd00049e0, // nop ; mul24 r0, r0 << 10, r1 << 10 -+-/* [0x000012a0] */ 0x4f5971c6, 0x100241a0, // asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012a8] */ 0x409f5001, 0xd00049e0, // nop ; mul24 r0, r0 << 11, r1 << 11 -+-/* [0x000012b0] */ 0x4f5971c6, 0x10024160, // asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012b8] */ 0x409f4001, 0xd00049e0, // nop ; mul24 r0, r0 << 12, r1 << 12 -+-/* [0x000012c0] */ 0x8f8171f6, 0x10024120, // asr ra4, r0, rb23; mov r0, unif -+-/* [0x000012c8] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x000012d0] */ 0x4f5971c6, 0x100252e0, // asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012d8] */ 0x4f5971c6, 0x100252a0, // asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012e0] */ 0x4f5971c6, 0x10025260, // asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x000012e8] */ 0x8f8171f6, 0x10025220, // asr rb8, r0, rb23; mov r0, unif -+-/* [0x000012f0] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x000012f8] */ 0x4f5971c6, 0x100251e0, // asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001300] */ 0x4f5971c6, 0x100251a0, // asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001308] */ 0x4f5971c6, 0x10025160, // asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-/* [0x00001310] */ 0x0f9d71c0, 0x10021127, // asr rb4, r0, rb23 -+-/* [0x00001318] */ 0x15827d80, 0x10020827, // mov r0, unif -+-/* [0x00001320] */ 0x15827d80, 0x10060827, // mov.ifnz r0, unif -+-/* [0x00001328] */ 0x0f9e7080, 0x100213e7, // asr rb15, r0, r2 -+-/* [0x00001330] */ 0x119e7080, 0x10020827, // shl r0, r0, r2 -+-/* [0x00001338] */ 0x0f9e7080, 0x100213a7, // asr rb14, r0, r2 -+-/* [0x00001340] */ 0x00000000, 0xe00208e7, // mov r3, 0 -+ // :yloopb -+-/* [0x00001348] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-/* [0x00001350] */ 0x8e4539bf, 0xa0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-/* [0x00001358] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-/* [0x00001360] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-/* [0x00001368] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -+-/* [0x00001370] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -+-/* [0x00001378] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -+-/* [0x00001380] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x00001388] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-/* [0x00001390] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -+-/* [0x00001398] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -+-/* [0x000013a0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -+-/* [0x000013a8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-/* [0x000013b0] */ 0xec654c87, 0x10024e20, // add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -+-/* [0x000013b8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-/* [0x000013c0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -+-/* [0x000013c8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-/* [0x000013d0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -+-/* [0x000013d8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-/* [0x000013e0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-/* [0x000013e8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-/* [0x000013f0] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-/* [0x000013f8] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-/* [0x00001400] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-/* [0x00001408] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-/* [0x00001410] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-/* [0x00001418] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-/* [0x00001420] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-/* [0x00001428] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-/* [0x00001430] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-/* [0x00001438] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-/* [0x00001440] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -+-/* [0x00001448] */ 0x8d3487f6, 0xd00279cc, // sub.setf -, r3, 8 ; mov ra12, ra13 -+-/* [0x00001450] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -+-/* [0x00001458] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -+-/* [0x00001460] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -+-/* [0x00001468] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -+-/* [0x00001470] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001478] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -+-/* [0x00001480] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -+-/* [0x00001488] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -+-/* [0x00001490] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -+-/* [0x00001498] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -+-/* [0x000014a0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-/* [0x000014a8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-/* [0x000014b0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-/* [0x000014b8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-/* [0x000014c0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-/* [0x000014c8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -+-/* [0x000014d0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -+-/* [0x000014d8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-/* [0x000014e0] */ 0x0f9ce3c0, 0xd0020867, // asr r1, r1, 14 -+-/* [0x000014e8] */ 0x4053800e, 0xd00049e1, // nop ; mul24 r1, r1 << 8, ra20 << 8 -+-/* [0x000014f0] */ 0x4c78e38f, 0x10024860, // add r1, r1, ra30 ; mul24 r0, r1, rb14 -+-/* [0x000014f8] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -+-/* [0x00001500] */ 0xfffffe28, 0xf06809e7, // brr.anyn -, r:yloopb -+-/* [0x00001508] */ 0x0f9c73c0, 0xd0020867, // asr r1, r1, 7 -+-/* [0x00001510] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -+-/* [0x00001518] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -+-/* [0x00001520] */ 0x00000000, 0xf0f7e9e7, // bra -, ra31 -+-/* [0x00001528] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -+-/* [0x00001530] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -+-/* [0x00001538] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -++/* [0x00001258] */ 0xcd5117de, 0xa00269e3, // sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++/* [0x00001260] */ 0x8e4539bf, 0xb0029819, // shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++/* [0x00001268] */ 0x956a7d9b, 0x1004461f, // mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++/* [0x00001270] */ 0x95710dbf, 0x10044763, // mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++/* [0x00001278] */ 0x0e9c09c0, 0x10020867, // shr r1, r4, rx_xshift2 -++/* [0x00001280] */ 0x159c1fc0, 0x10040567, // mov.ifz ra_y2, ra_y2_next -++/* [0x00001288] */ 0x13740dc0, 0xd00208a7, // max r2, ra_y, 0 -++/* [0x00001290] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x00001298] */ 0x4c741dd3, 0xd0024762, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++/* [0x000012a0] */ 0xec614c87, 0x10024e20, // add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 -++/* [0x000012a8] */ 0x13540dc0, 0xd00208a7, // max r2, ra_y2, 0 -++/* [0x000012b0] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_frame_height_minus_1 -++/* [0x000012b8] */ 0x4c541dd3, 0xd0024562, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++/* [0x000012c0] */ 0xec654c8f, 0x10024f21, // add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -++/* [0x000012c8] */ 0x0000ff00, 0xe20229e7, // mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++/* [0x000012d0] */ 0x40027006, 0x100049e2, // nop ; mul24 r2, r0, ra0 -++/* [0x000012d8] */ 0x40038031, 0xd000c9e2, // nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++/* [0x000012e0] */ 0x4007f030, 0xd00049e3, // nop ; mul24 r3, ra1 << 1, r0 << 1 -++/* [0x000012e8] */ 0x40077031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++/* [0x000012f0] */ 0x4c0be4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++/* [0x000012f8] */ 0x400b6031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++/* [0x00001300] */ 0x4c0fd4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++/* [0x00001308] */ 0x400f5031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++/* [0x00001310] */ 0x4c13c4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++/* [0x00001318] */ 0x40134031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++/* [0x00001320] */ 0x4c17b4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++/* [0x00001328] */ 0x40173031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++/* [0x00001330] */ 0x4c1ba4f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++/* [0x00001338] */ 0x401b2031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++/* [0x00001340] */ 0x4c1f94f0, 0xd00248a3, // add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++/* [0x00001348] */ 0x401f1031, 0xd000c9e3, // nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++/* [0x00001350] */ 0x8c9df4ff, 0x10024823, // add r0, r2, r3 ; mov r3, rb31 -++/* [0x00001358] */ 0x8d2487f6, 0xd00279c8, // sub.setf -, r3, 8 ; mov ra8, ra9 -++/* [0x00001360] */ 0x152a7d80, 0x10020267, // mov ra9, ra10 -++/* [0x00001368] */ 0x152e7d80, 0x100202a7, // mov ra10, ra11 -++/* [0x00001370] */ 0x15327d80, 0x100202e7, // mov ra11, ra12 -++/* [0x00001378] */ 0x15367d80, 0x10020327, // mov ra12, ra13 -++/* [0x00001380] */ 0xfffffeb8, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001388] */ 0x153a7d80, 0x10020367, // mov ra13, ra14 -++/* [0x00001390] */ 0x153e7d80, 0x100203a7, // mov ra14, ra15 -++/* [0x00001398] */ 0x159e7000, 0x100203e7, // mov ra15, r0 -++/* [0x000013a0] */ 0x4038a037, 0x100049e1, // nop ; mul24 r1, ra14, rb10 -++/* [0x000013a8] */ 0x40349037, 0x100049e0, // nop ; mul24 r0, ra13, rb9 -++/* [0x000013b0] */ 0x4c308237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra12, rb8 -++/* [0x000013b8] */ 0x4c3cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra15, rb11 -++/* [0x000013c0] */ 0x4c204237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb4 -++/* [0x000013c8] */ 0x4c245237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra9, rb5 -++/* [0x000013d0] */ 0x4c286237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra10, rb6 -++/* [0x000013d8] */ 0x4c2c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb7 -++/* [0x000013e0] */ 0x8c9f223f, 0x10020867, // add r1, r1, r0 ; mov -, vw_wait -++/* [0x000013e8] */ 0x4d5927ce, 0x100269e1, // sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++/* [0x000013f0] */ 0x0f9ce3c0, 0xd0020827, // asr r0, r1, 14 -++/* [0x000013f8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 -++/* [0x00001400] */ 0x405b8006, 0xd00049e0, // nop ; mul24 r0, r0 << 8, ra22 << 8 -++/* [0x00001408] */ 0x0c4a7380, 0x10020867, // add r1, r1, ra18 -++/* [0x00001410] */ 0x0c9e7200, 0x10020867, // add r1, r1, r0 -++/* [0x00001418] */ 0xfffffe20, 0xf06809e7, // brr.anyn -, r:yloopb -++/* [0x00001420] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, 15 -++/* [0x00001428] */ 0x129d63c0, 0x10020867, // min r1, r1, rb22 -++/* [0x00001430] */ 0x139c03c0, 0xd0020c27, // max vpm, r1, 0 -++/* [0x00001438] */ 0xfffff928, 0xf0f809e7, // brr -, r:per_block_setup -++/* [0x00001440] */ 0x159dafc0, 0x10021c67, // mov vw_setup, rb26 -++/* [0x00001448] */ 0x159ddfc0, 0x10021c67, // mov vw_setup, rb29 -++/* [0x00001450] */ 0x15827d80, 0x10021ca7, // mov vw_addr, unif -+ // ::mc_interrupt_exit12 -+-/* [0x00001540] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -+-/* [0x00001548] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001550] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001558] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001560] */ 0x009e7000, 0xa00009e7, // ldtmu0 -+-/* [0x00001568] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001570] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001578] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001580] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001588] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001590] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x00001598] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -+-/* [0x000015c0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -+-/* [0x000015c8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -+-/* [0x000015d0] */ 0x009e7000, 0x100009e7, // nop ; nop -++/* [0x00001458] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x00001460] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001468] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001470] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001478] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001480] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001488] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001490] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x00001498] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014a0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014a8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014b0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014b8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014c0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014c8] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014d0] */ 0x00000010, 0xe80009e7, // mov -,sacq(0) -++/* [0x000014d8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x000014e0] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x000014e8] */ 0x009e7000, 0x100009e7, // nop ; nop -++// ::mc_exit1 -++/* [0x000014f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait -++/* [0x000014f8] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001500] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001508] */ 0x009e7000, 0xa00009e7, // ldtmu0 -++/* [0x00001510] */ 0x009e7000, 0xb00009e7, // ldtmu1 -++/* [0x00001518] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend -++/* [0x00001520] */ 0x00000001, 0xe00209a7, // mov interrupt, 1; nop -++/* [0x00001528] */ 0x009e7000, 0x100009e7, // nop ; nop -+ // ::mc_end -+ }; -+ #ifdef __HIGHC__ -+diff --git a/libavcodec/rpi_shader.h b/libavcodec/rpi_shader.h -+index 6e552d9..760bd17 100644 -+--- a/libavcodec/rpi_shader.h -++++ b/libavcodec/rpi_shader.h -+@@ -4,15 +4,16 @@ -+ extern unsigned int rpi_shader[]; -+ -+ #define mc_setup_uv (rpi_shader + 0) -+-#define mc_filter_uv (rpi_shader + 144) -+-#define mc_filter_uv_b0 (rpi_shader + 334) -+-#define mc_filter_uv_b (rpi_shader + 486) -+-#define mc_exit (rpi_shader + 662) -+-#define mc_interrupt_exit8 (rpi_shader + 680) -+-#define mc_setup (rpi_shader + 710) -+-#define mc_filter (rpi_shader + 864) -+-#define mc_filter_b (rpi_shader + 1104) -+-#define mc_interrupt_exit12 (rpi_shader + 1360) -+-#define mc_end (rpi_shader + 1398) -++#define mc_filter_uv (rpi_shader + 130) -++#define mc_filter_uv_b0 (rpi_shader + 312) -++#define mc_filter_uv_b (rpi_shader + 464) -++#define mc_exit (rpi_shader + 640) -++#define mc_interrupt_exit8 (rpi_shader + 658) -++#define mc_setup (rpi_shader + 688) -++#define mc_filter (rpi_shader + 1048) -++#define mc_filter_b (rpi_shader + 1174) -++#define mc_interrupt_exit12 (rpi_shader + 1302) -++#define mc_exit1 (rpi_shader + 1340) -++#define mc_end (rpi_shader + 1356) -+ -+ #endif -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index a0b8e5a..60d1ec2 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -21,6 +21,7 @@ -+ # -+ # ra16 clipped(row start address+elem_num)&~3 -+ # ra17 per-channel shifts -++# ra18 0x4000 -+ # ra19 next ra17 -+ # -+ # rb16 pitch -+@@ -86,7 +87,7 @@ -+ -+ -+ ################################################################################ -+-# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, pad0, pad1, pad2) -++# mc_setup_uv(next_kernel, x, y, ref_u_base, ref_v_base, frame_width, frame_height, pitch, dst_pitch, offset, denom, vpm_id) -+ ::mc_setup_uv -+ -+ # Read starting kernel -+@@ -132,36 +133,6 @@ mov ra13, 0 -+ mov ra14, 0 -+ mov ra15, 0 -+ -+-# Compute part of VPM to use for DMA output -+-mov r3, unif -+-shl r2, r3, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -+-and r2, r2, 15 -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+-shl r0, r0, 5 -+-add rb27, r0, r1 -+- -+-# Compute part of VPM to save data into -+-shl r2, r3, 1 -+-and r2, r2, 15 # r2 = bcd0 -+-mov r1, r2 # r1 = bcd0 -+-asr r1, r1, 2 # r1 = bc -+-shl r1, r1, 6 # r1 = bc000000 -+-mov r0, r2 # r0 = bcd0 -+-and r0, r0, 3 # r0 = d0 -+-add r0, r0, r1 # r0 = bc0000d0 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+-add rb28, r0, r1 -+-asr r0, r0, 1 # r0 = bc0000d -+-# Prepare VPM command for 16bit intermediates -+-mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -+-add rb21, r0, r1 -+- -+ # Compute base address for first and second access -+ mov r0, ra_x # Load x -+ max r0, r0, 0; mov r1, ra_y # Load y -+@@ -175,10 +146,31 @@ min r1, r1, rb_frame_height_minus_1 -+ # submit texture requests for first line -+ add r2, r2, r0 ; mul24 r1, r1, rb_pitch -+ add t0s, r0, r1 ; mov ra_frame_base, r2 -+-add t0s, r2, r1 -++add t1s, r2, r1 -++ -++mov r2,8 -++shl rb12,unif, r2 # offset before shift -++add rb13,unif,r2 # offset after shift -++ -++# Compute part of VPM to use for DMA output -++mov r2, unif -++shl r2, r2, 1 # Convert QPU numbers to be even (this means we can only use 8 QPUs, but is necessary as we need to save 16bit intermediate results) -++and r2, r2, 15 -++mov r1, r2 -++asr r1, r1, 2 -++shl r1, r1, 6 -++mov r0, r2 -++and r0, r0, 3 -++add r0, r0, r1 -+ -+-mov rb12,unif # offset before shift -+-mov rb13,unif # offset after shift -++mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -++add rb28, r0, r1 # VPM 8bit storage -++asr r2, r0, 1 # r0 = bc0000d -++mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR which is Y[5:0],H[0] for 16 bit -++add rb21, r2, r1 # VPM for 16bit intermediates -++mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++shl r0, r0, 5 -++add rb27, r0, r1 # DMA out -+ -+ # submit texture requests for second line -+ max r1, ra_y, 0 -+@@ -187,7 +179,7 @@ add ra_y, ra_y, 1 -+ bra -, ra31 -+ nop ; mul24 r1, r1, rb_pitch -+ add t0s, r1, ra_x -+-add t0s, r1, ra_frame_base -++add t1s, r1, ra_frame_base -+ -+ -+ -+@@ -248,17 +240,15 @@ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ mov r0, unif # U offset/weight -+ asr rb15, r0, r2 # Compute offset from MSBs -+ shl r0, r0, r2 -+-asr rb14, r0, r2 # Compute weight from LSBs -++asr r3, r0, r2 # Compute weight from LSBs -+ mov r0, unif # V offset/weight -+ asr.ifnz rb15, r0, r2 -+ shl r0, r0, r2 -+-asr.ifnz rb14, r0, r2 -++asr.ifnz r3, r0, r2 -++shl rb14,r3,8 # Scale up weights so we can use mul24 in signed fashion -+ -+ # r2 is elem_num -+ # r3 is loop counter -+- -+-mov r5rep, -8 -+- -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+ -+@@ -269,7 +259,7 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+@@ -278,7 +268,7 @@ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_frame_base, r2 -++add t1s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -301,11 +291,6 @@ mov ra13, ra14 # Delay slot 1 -+ mov ra14, ra15 # Delay slot 2 -+ mov ra15, r0 # Delay slot 3 -+ -+-mov rb12,32 # TODO remove these to make P weighted prediction work properly -+-mov rb13,6 -+-mov rb14,1 -+-mov rb15,0 -+- -+ # apply vertical filter and write to VPM -+ -+ nop ; mul24 r1, ra14, rb10 -+@@ -412,7 +397,7 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+@@ -421,7 +406,7 @@ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_frame_base, r2 -++add t1s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -542,7 +527,7 @@ mov r3, 0 -+ # then submit two more texture requests -+ -+ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 # loop counter increment -+-shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu0 -++shr r0, r4, ra_xshift ; mov.ifz ra_x, rb_x_next ; ldtmu1 -+ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+ shr r1, r4, ra_xshift ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+@@ -551,7 +536,7 @@ max r2, ra_y, 0 # y -+ min r2, r2, rb_frame_height_minus_1 -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_x, r2 ; v8subs r1, r1, rb20 -+-add t0s, ra_frame_base, r2 -++add t1s, ra_frame_base, r2 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+@@ -617,9 +602,9 @@ mov -, vw_wait # wait on the VDW -+ mov -,srel(0) -+ -+ ldtmu0 -++ldtmu1 -+ ldtmu0 -+-ldtmu0 -+-ldtmu0 -++ldtmu1 -+ -+ nop ; nop ; thrend -+ nop ; nop # delay slot 1 -+@@ -630,9 +615,9 @@ nop ; nop # delay slot 2 -+ mov -, vw_wait # wait on the VDW -+ -+ ldtmu0 -++ldtmu1 -+ ldtmu0 -+-ldtmu0 -+-ldtmu0 -++ldtmu1 -+ -+ mov -,sacq(0) # 1 -+ mov -,sacq(0) # 2 -+@@ -656,200 +641,249 @@ nop ; nop # delay slot 2 -+ # For P frames we make the second x,y coordinates offset by +8 -+ -+ ################################################################################ -+-# mc_setup(next_kernel, x, y, ref_y_base, x2, y2, ref_y2_base, frame_width, frame_height, pitch, dst_pitch, offset, shift, pad2) -++# mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) -+ ::mc_setup -++ mov r3, 16 -+ -+-# Read starting kernel -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-mov ra31, unif -+- -+-# Compute base address for first and second access -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl ra_xshift_next, r0, 3 # Compute shifts -+-add ra_y, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add r2, r2, r0 # r2 is address for frame0 (not including y offset) -+-max r1, r1, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+-add t0s, r2, r1 ; mov ra_frame_base, r2 -+- -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl rx_xshift2_next, r0, 3 # Compute shifts -+-add ra_y2, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add r2, r2, r0 # r2 is address for frame1 (not including y offset) -+-max r1, r1, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -+-add t0s, r2, r1 ; mov ra_frame_base2, r2 -+- -++ # Need to save these because we need to know the frame dimensions before computing texture coordinates -++ mov ra8, unif -++ mov ra9, unif -++ mov ra10, unif -++ mov ra11, unif -+ -+ # Read image dimensions -+-sub rb25,unif,1 -+-sub rb30,unif,1 -++ mov r1, unif # width_height -++ shl r0,r1,r3 -++ asr r1,r1,r3 # width -++ asr r0,r0,r3 # height -++ sub rb_frame_width_minus_1,r1,1 -++ sub rb_frame_height_minus_1,r0,1 -+ -+ # get source pitch -+-mov rb16, unif -++ mov rb_pitch, unif -+ -+ # get destination pitch -+-mov r0, unif -+-mov r1, vdw_setup_1(0) -+-add rb24, r1, r0 -++ mov r0, unif -++ mov r1, vdw_setup_1(0) -++ add rb24, r1, r0 -+ -+-# load constants -+- -+-mov ra20, 1 -+-mov ra22, 256 -+-mov ra30, 64 -+- -+-mov rb20, 0xffffff00 -+-mov rb22, 255 -+-mov rb23, 24 -++# Compute base address for first and second access -++ mov r1, ra8 # y_x -++ shl r0,r1,r3 # r0 is x<<16 -++ asr r1,r1,r3 # r1 is y -++ asr r0,r0,r3 # r0 is x -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra9 # Load the frame base -++ shl ra_xshift_next, r0, 3 # Compute shifts -++ add ra_y, r1, 1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add r2, r2, r0 # r2 is address for frame0 (not including y offset) -++ max r1, r1, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++ add t0s, r2, r1 ; mov ra_frame_base, r2 -++ -++ mov r1, ra10 # y_x -++ shl r0,r1,r3 # r0 is x<<16 -++ asr r1,r1,r3 # r1 is y -++ asr r0,r0,r3 # r0 is x -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, ra11 # Load the frame base -++ shl rx_xshift2_next, r0, 3 # Compute shifts -++ add ra_y2, r1, 1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add r2, r2, r0 # r2 is address for frame1 (not including y offset) -++ max r1, r1, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ nop ; mul24 r1, r1, rb_pitch # r2 contains the addresses (not including y offset) for frame0 -++ add t1s, r2, r1 ; mov ra_frame_base2, r2 -+ -+-# touch vertical context to keep simulator happy -+ -+-mov ra8, 0 -+-mov ra9, 0 -+-mov ra10, 0 -+-mov ra11, 0 -+-mov ra12, 0 -+-mov ra13, 0 -+-mov ra14, 0 -+-mov ra15, 0 -++# load constants -+ -+-# Compute part of VPM to use for DMA output -+-mov r2, qpu_num -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -+-shl r0, r0, 5 -+-add rb27, r0, r1 -++ mov ra20, 1 -++ mov ra22, 256 -++ mov ra30, 64 -+ -+-# Compute part of VPM to save data into -+-mov r2, qpu_num # qpu_num = abcd -+-mov r1, r2 -+-asr r1, r1, 2 -+-shl r1, r1, 6 -+-mov r0, r2 -+-and r0, r0, 3 -+-add r0, r0, r1 -+-mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -+-add rb28, r0, r1 -++ mov rb20, 0xffffff00 -++ mov rb22, 255 -++ mov rb23, 24 -+ -+-mov rb12,unif # offset before shift -+-mov rb13,unif # shift -++# touch vertical context to keep simulator happy -+ -+-# Dump padding words -+-mov r0, unif -++ mov ra8, 0 -++ mov ra9, 0 -++ mov ra10, 0 -++ mov ra11, 0 -++ mov ra12, 0 -++ mov ra13, 0 -++ mov ra14, 0 -++ mov ra15, 0 -++ mov ra18, 0x4000 -++ -++# Compute part of VPM to use -++ mov r2, qpu_num -++ mov r1, r2 -++ asr r1, r1, 2 -++ shl r1, r1, 6 -++ mov r0, r2 -++ and r0, r0, 3 -++ add r0, r0, r1 -++ mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit -++ add rb28, r0, r1 # VPM for saving data -++ mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later -++ shl r0, r0, 5 -++ add rb27, r0, r1 # Command for dma output -++ -++# Weighted prediction denom -++ -++ mov r1, unif # offset_shift -++ shl r0,r1,r3 ; mov r2,8 -++ asr rb13,r0,r3 # shift -++ asr rb12,r1,r3 # offset -++ add rb13,rb13,r2 # mul24 is unsigned so scale up into high bits -++ shl rb12, rb12, r2 # Account for larger shift -+ -+ # submit texture requests for second line -+-max r1, ra_y, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 -+-nop ; mul24 r1, r1, rb_pitch -+-add t0s, r1, ra_frame_base -+- -+-max r1, ra_y2, 0 -+-min r1, r1, rb_frame_height_minus_1 -+-bra -, ra31 -+-add ra_y2, ra_y2, 1 # Delay 1 -+-nop ; mul24 r1, r1, rb_pitch # Delay 2 -+-add t0s, r1, ra_frame_base2 # Delay 3 -+- -+- -+-################################################################################ -+- -+-# mc_filter(next_kernel, x, y, frame_base, x2, y2, frame_base2, height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -+-# In a P block, only the first half of coefficients contain used information. -+-# At this point we have already issued two pairs of texture requests for the current block -+-# ra_x, ra_x16_base point to the current coordinates for this block -+-::mc_filter -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-mov ra31, unif -++ max r1, ra_y, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ add ra_y, ra_y, 1 -++ nop ; mul24 r1, r1, rb_pitch -++ add t0s, r1, ra_frame_base -++ -++ max r1, ra_y2, 0 -++ min r1, r1, rb_frame_height_minus_1 -++ add ra_y2, ra_y2, 1 -++ nop ; mul24 r1, r1, rb_pitch -++ add t1s, r1, ra_frame_base2 -++ -++# FALL THROUGHT TO PER-BLOCK SETUP -++ -++# Start of per-block setup code -++# P and B blocks share the same setup code to save on Icache space -++:per_block_setup -++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ mov ra31, unif -+ -+ # per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+-mov rx_xshift2, rx_xshift2_next -++ mov ra_xshift, ra_xshift_next -++ mov rx_xshift2, rx_xshift2_next -+ -+ # get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl ra_xshift_next, r0, 3 # Compute shifts -+-mov ra_y_next, r1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -+- -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0 ; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl rx_xshift2_next, r0, 3 # Compute shifts -+-add ra_y2_next, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+- -++ mov r3, 16 -++ mov r1, unif # y_x -++ shl r0,r1,r3 # r0 is x<<16 -++ asr r1,r1,r3 # r1 is y -++ asr r0,r0,r3 # r0 is x -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++ shl ra_xshift_next, r0, 3 # Compute shifts -++ mov ra_y_next, r1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add ra_frame_base_next, r2, r0 ; mov r1, unif # y2_x2 -++ -++ shl r0,r1,r3 # r0 is x2<<16 -++ asr r1,r1,r3 # r1 is y2 -++ asr r0,r0,r3 # r0 is x2 -++ add r0, r0, elem_num # Load x -++ max r0, r0, 0 -++ min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -++ shl rx_xshift2_next, r0, 3 # Compute shifts -++ mov ra_y2_next, r1 -++ and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -++ add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+ -+ # set up VPM write -+-mov vw_setup, rb28 -++ mov vw_setup, rb28 -+ -+ # get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -++ mov r0, unif -++ shr r1, r0, r3 # Extract width -++ sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -++ and r0, r0, rb22 # Extract height -++ add rb17, r0, 5 -++ add rb18, r0, 7 -++ shl r0, r0, 7 -++ add r0, r0, r1 # Combine width and height of destination area -++ shl r0, r0, r3 # Shift into bits 16 upwards of the vdw_setup0 register -++ add rb26, r0, rb27 -+ -+ # get filter coefficients and discard unused B frame values -+-mov r0, unif -+-mov.ifnz -, unif # Alternate coefficients are unused for P frames -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 # These may need some pre-rotation to be used in B frames correctly -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-mov.ifnz -, unif -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-asr ra4, r0, rb23; mov r0, unif -+-mov.ifnz -, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-mov.ifnz -, unif -+-asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-asr rb4, r0, rb23 -+- -+-mov r0, unif # Frame0 offset/weight -+-mov.ifnz -, unif # Frame1 offset/weight unused -+-asr rb15, r0, r2 # Compute offset from MSBs -+-shl r0, r0, r2 -+-asr rb14, r0, r2 # Compute weight from LSBs -+- -+-# r3 is loop counter -++ mov r0, unif ; mov r1,1 # Packed filter offsets, unpack into ra8... (to be used for vertical context later) -++ asr ra9, r0, rb23; mul24 r0, r0, ra22 # my2 -++ asr ra8, r0, rb23; mul24 r0, r0, ra22 # mx2 -++ asr.ifz ra9, r0, rb23; mul24 r0, r0, ra22 # my:my2 -++ asr.ifz ra8, r0, rb23 # mx:mx2 -++ sub ra9,3,ra9 -++ sub ra8,3,ra8 -++ shl ra9,ra9,3 # Scale up by 8 -++ shl ra8,ra8,3 # Scale up by 8 -++# Now if we want aligned we have a mul of 1, so put 0 coefficients at the top -++ mov r1,0xffff00 -++ shl r0, r1, ra8 -++ asr ra0, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb4, r0, rb23 -++ -++ mov r1,0x1040400 -++ shl r0, r1, ra8 -++ asr ra1, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb5, r0, rb23 -++ -++ mov r1,0xfbf5f600 -++ shl r0, r1, ra8 -++ asr ra2, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb6, r0, rb23 -++ -++ mov r1,0x11283a40 -++ shl r0, r1, ra8 -++ asr ra3, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb7, r0, rb23 -++ -++ mov r1,0x3a281100 -++ shl r0, r1, ra8 -++ asr ra4, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb8, r0, rb23 -++ -++ mov r1,0xf6f5fb00 -++ shl r0, r1, ra8 -++ asr ra5, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb9, r0, rb23 -++ -++ mov r1,0x4040100 -++ shl r0, r1, ra8 -++ asr ra6, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb10, r0, rb23 -++ -++ mov r1,0xffff0000 -++ shl r0, r1, ra8 -++ asr ra7, r0, rb23 -++ shl r0, r1, ra9 -++ asr rb11, r0, rb23 -++ -++# Extract weighted prediction information -++ mov r0, unif # offset/weight TODO move up -++ asr rb15, r0, r3 # Compute offset from MSBs -++ bra -, ra31 -++ shl r0, r0, r3 # Delay 1 -++ asr r0, r0, r3 ; mov r3, 0 # Compute weight from LSBs and reset loop counter Delay 2 -++ shl rb14, r0, 8 # Use a larger shift to avoid unsigned multiply problem Delay 3 -+ -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -++################################################################################ -++# mc_filter(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -++# In a P block, y2_x2 should be y_x+8 -++# At this point we have already issued two pairs of texture requests for the current block -+ -+-mov r3, 0 -++::mc_filter -+ -+ :yloop -+ # retrieve texture results and pick out bytes -+@@ -858,91 +892,90 @@ mov r3, 0 -+ # If we knew there was no clipping then this code would get simpler. -+ # Perhaps we could add on the pitch and clip using larger values? -+ -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, rx_xshift2 -+-mov.ifz ra_y2, ra_y2_next -++ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++ shr r1, r4, rx_xshift2 -++ mov.ifz ra_y2, ra_y2_next -+ -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y2, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ max r2, ra_y, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -++ max r2, ra_y2, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+ -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ # apply horizontal filter -+-nop ; mul24 r2, r0, ra0 -+-nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-nop ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-add r0, r2, r3 ; mov r3, rb31 -+-sub.setf -, r3, 8 ; mov ra12, ra13 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-brr.anyn -, r:yloop -+-mov ra13, ra14 # Delay slot 1 -+-mov ra14, ra15 # Delay slot 2 -+-mov ra15, r0 # Delay slot 3 -++ nop ; mul24 r2, r0, ra0 -++ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++ nop ; mul24 r3, ra1 << 1, r0 << 1 -++ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++ add r0, r2, r3 ; mov r3, rb31 -++ sub.setf -, r3, 8 ; mov ra8, ra9 -++ mov ra9, ra10 -++ mov ra10, ra11 -++ mov ra11, ra12 -++ mov ra12, ra13 -++ brr.anyn -, r:yloop -++ mov ra13, ra14 # Delay slot 1 -++ mov ra14, ra15 # Delay slot 2 -++ mov ra15, r0 # Delay slot 3 -+ -+ # apply vertical filter and write to VPM -+ -+-nop ; mul24 r1, ra14, rb10 -+-nop ; mul24 r0, ra13, rb9 -+-add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-add r1, r1, r0 ; mul24 r0, ra11, rb7 -+- -+-add r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-nop ; mul24 r1, r1, rb14 -+-add r1, r1, rb12 -+-asr r1, r1, rb13 -+-brr.anyn -, r:yloop -+-add r1, r1, rb15 # Delay 1 -+-min r1, r1, rb22 # Delay 2 -+-max vpm, r1, 0 # Delay 3 -++ nop ; mul24 r1, ra14, rb10 -++ nop ; mul24 r0, ra13, rb9 -++ add r1, r1, r0 ; mul24 r0, ra12, rb8 -++ add r1, r1, r0 ; mul24 r0, ra15, rb11 -++ add r1, r1, r0 ; mul24 r0, ra8, rb4 -++ add r1, r1, r0 ; mul24 r0, ra9, rb5 -++ add r1, r1, r0 ; mul24 r0, ra10, rb6 -++ add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++ add r1, r1, r0 ; mov -, vw_wait -++ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++ asr r1, r1, 14 -++ nop ; mul24 r1, r1, rb14 -++ add r1, r1, rb12 -++ asr r1, r1, rb13 -++ brr.anyn -, r:yloop -++ add r1, r1, rb15 # Delay 1 -++ min r1, r1, rb22 # Delay 2 -++ max vpm, r1, 0 # Delay 3 -+ -+ # DMA out -+ -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW setup 0 Delay 1 -+-mov vw_setup, rb29 # Stride Delay 2 -+-mov vw_addr, unif # start the VDW Delay 3 -++ brr -, r:per_block_setup -++ mov vw_setup, rb26 # VDW setup 0 Delay 1 -++ mov vw_setup, rb29 # Stride Delay 2 -++ mov vw_addr, unif # start the VDW Delay 3 -+ -+ -+ -+ ################################################################################ -+ -+-# mc_filter_b(next_kernel, x, y, frame_base, x2, y2, frame_base2, width_height, hcoeffs[0], hcoeffs2[0], hcoeffs[1], hcoeffs2[1], vcoeffs[0], vcoeffs2[0], vcoeffs[1], vcoeffs2[1], offsetweight0, offsetweight1, this_dst) -++# mc_filter_b(y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -+ # In a P block, only the first half of coefficients contain used information. -+ # At this point we have already issued two pairs of texture requests for the current block -+ # May be better to just send 16.16 motion vector and figure out the coefficients inside this block (only 4 cases so can compute hcoeffs in around 24 cycles?) -+@@ -952,92 +985,6 @@ mov vw_addr, unif # start the VDW Delay 3 -+ # Or possibly by taking advantage of symmetry? -+ # From 19->7 32bits per command. -+ ::mc_filter_b -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+-mov ra31, unif -+- -+-# per-channel shifts were calculated on the *previous* invocation -+- -+-mov ra_xshift, ra_xshift_next -+-mov rx_xshift2, rx_xshift2_next -+- -+-# get base addresses and per-channel shifts for *next* invocation -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl ra_xshift_next, r0, 3 # Compute shifts -+-mov ra_y_next, r1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add ra_frame_base_next, r2, r0 # r2 is address for frame0 (not including y offset) -+- -+-add r0, unif, elem_num # Load x -+-max r0, r0, 0 ; mov r1, unif # Load y -+-min r0, r0, rb_frame_width_minus_1 ; mov r2, unif # Load the frame base -+-shl rx_xshift2_next, r0, 3 # Compute shifts -+-add ra_y2_next, r1, 1 -+-and r0, r0, ~3 # r0 gives the clipped and aligned x coordinate -+-add rx_frame_base2_next, r2, r0 # r2 is address for frame1 (not including y offset) -+- -+- -+-# set up VPM write -+-mov vw_setup, rb28 -+- -+-# get width,height of block -+-mov r2, 16 -+-mov r0, unif -+-shr r1, r0, r2 # Extract width -+-sub rb29, rb24, r1 # Compute vdw_setup1(dst_pitch-width) -+-and r0, r0, rb22 # Extract height -+-add rb17, r0, 5 -+-add rb18, r0, 7 -+-shl r0, r0, 7 -+-add r0, r0, r1 # Combine width and height of destination area -+-shl r0, r0, r2 # Shift into bits 16 upwards of the vdw_setup0 register -+-add rb26, r0, rb27 -+- -+-# get filter coefficients and discard unused B frame values -+-mov r0, unif -+-mov r1, 1 -+-mov.ifnz r0, unif # Alternate coefficients are unused for P frames -+-nop ; mul24 r0, r0 << 13, r1 << 13 -+-asr ra3, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 14, r1 << 14 -+-asr ra2, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 15, r1 << 15 # Adjust such that a rotate of 1 will produce the values with first 8 on left, second 8 on right -+-asr ra1, r0, rb23; mul24 r0, r0, ra22 -+-asr ra0, r0, rb23; mov r0, unif -+-mov.ifnz r0, unif -+-nop ; mul24 r0, r0 << 9, r1 << 9 -+-asr ra7, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 10, r1 << 10 -+-asr ra6, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 11, r1 << 11 -+-asr ra5, r0, rb23; mul24 r0, r0, ra22 -+-nop ; mul24 r0, r0 << 12, r1 << 12 -+-asr ra4, r0, rb23; mov r0, unif -+-mov.ifnz r0, unif -+-asr rb11, r0, rb23; mul24 r0, r0, ra22 -+-asr rb10, r0, rb23; mul24 r0, r0, ra22 -+-asr rb9, r0, rb23; mul24 r0, r0, ra22 -+-asr rb8, r0, rb23; mov r0, unif -+-mov.ifnz r0, unif -+-asr rb7, r0, rb23; mul24 r0, r0, ra22 -+-asr rb6, r0, rb23; mul24 r0, r0, ra22 -+-asr rb5, r0, rb23; mul24 r0, r0, ra22 -+-asr rb4, r0, rb23 -+- -+-mov r0, unif # Frame0 offset/weight -+-mov.ifnz r0, unif # Frame1 offset/weight unused -+-asr rb15, r0, r2 # Compute offset from MSBs -+-shl r0, r0, r2 -+-asr rb14, r0, r2 # Compute weight from LSBs -+- -+-# r3 is loop counter -+- -+-# retrieve texture results and pick out bytes -+-# then submit two more texture requests -+- -+-mov r3, 0 -+- -+ :yloopb -+ # retrieve texture results and pick out bytes -+ # then submit two more texture requests -+@@ -1045,111 +992,123 @@ mov r3, 0 -+ # If we knew there was no clipping then this code would get simpler. -+ # Perhaps we could add on the pitch and clip using larger values? -+ -+-sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -+-shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu0 -+-mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -+-mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -+-shr r1, r4, rx_xshift2 -+-mov.ifz ra_y2, ra_y2_next -++ sub.setf -, r3, rb17 ; v8adds r3, r3, ra20 ; ldtmu0 -++ shr r0, r4, ra_xshift ; mov.ifz ra_frame_base2, rx_frame_base2_next ; ldtmu1 -++ mov.ifz ra_frame_base, ra_frame_base_next ; mov rb31, r3 -++ mov.ifz ra_y, ra_y_next ; mov r3, rb_pitch -++ shr r1, r4, rx_xshift2 -++ mov.ifz ra_y2, ra_y2_next -+ -+-max r2, ra_y, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+- -+-max r2, ra_y2, 0 # y -+-min r2, r2, rb_frame_height_minus_1 -+-add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+-add t0s, ra_frame_base2, r2 ; v8subs r0, r0, rb20 -++ max r2, ra_y, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -++ add t0s, ra_frame_base, r2 ; v8subs r0, r0, rb20 # v8subs masks out all but bottom byte -+ -++ max r2, ra_y2, 0 # y -++ min r2, r2, rb_frame_height_minus_1 -++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -++ add t1s, ra_frame_base2, r2 ; v8subs r1, r1, rb20 -+ -+ # generate seven shifted versions -+ # interleave with scroll of vertical context -+ -+-mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -++ mov.setf -, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1] -+ -+ # apply horizontal filter -+-nop ; mul24 r2, r0, ra0 -+-nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -+-nop ; mul24 r3, ra1 << 1, r0 << 1 -+-nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -+-add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -+-nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -+-add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -+-nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -+-add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -+-nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -+-add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -+-nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -+-add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -+-nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -+-add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -+-nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -+-add r0, r2, r3 ; mov r3, rb31 -+-sub.setf -, r3, 8 ; mov ra12, ra13 -+-mov ra9, ra10 -+-mov ra10, ra11 -+-mov ra11, ra12 -+-mov ra12, ra13 -+-brr.anyn -, r:yloopb -+-mov ra13, ra14 # Delay slot 1 -+-mov ra14, ra15 # Delay slot 2 -+-mov ra15, r0 # Delay slot 3 -+- -+-# apply vertical filter and write to VPM -+- -+-nop ; mul24 r1, ra14, rb10 -+-nop ; mul24 r0, ra13, rb9 -+-add r1, r1, r0 ; mul24 r0, ra12, rb8 -+-add r1, r1, r0 ; mul24 r0, ra15, rb11 -+-add r1, r1, r0 ; mul24 r0, ra8, rb4 -+-add r1, r1, r0 ; mul24 r0, ra9, rb5 -+-add r1, r1, r0 ; mul24 r0, ra10, rb6 -+-add r1, r1, r0 ; mul24 r0, ra11, rb7 -+- -+-add r1, r1, r0 ; mov -, vw_wait -+-sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -+-asr r1, r1, 14 -+-nop ; mul24 r1, r1 << 8, ra20 << 8 # Rotate to align left and right halves -+-add r1, r1, ra30 ; mul24 r0, r1, rb14 -+-add r1, r1, r0 -+-brr.anyn -, r:yloopb -+-asr r1, r1, 7 # Delay 1 -+-min r1, r1, rb22 # Delay 2 -+-max vpm, r1, 0 # Delay 3 -++ nop ; mul24 r2, r0, ra0 -++ nop ; mul24.ifnz r2, ra0 << 8, r1 << 8 -++ nop ; mul24 r3, ra1 << 1, r0 << 1 -++ nop ; mul24.ifnz r3, ra1 << 9, r1 << 9 -++ add r2, r2, r3 ; mul24 r3, ra2 << 2, r0 << 2 -++ nop ; mul24.ifnz r3, ra2 << 10, r1 << 10 -++ add r2, r2, r3 ; mul24 r3, ra3 << 3, r0 << 3 -++ nop ; mul24.ifnz r3, ra3 << 11, r1 << 11 -++ add r2, r2, r3 ; mul24 r3, ra4 << 4, r0 << 4 -++ nop ; mul24.ifnz r3, ra4 << 12, r1 << 12 -++ add r2, r2, r3 ; mul24 r3, ra5 << 5, r0 << 5 -++ nop ; mul24.ifnz r3, ra5 << 13, r1 << 13 -++ add r2, r2, r3 ; mul24 r3, ra6 << 6, r0 << 6 -++ nop ; mul24.ifnz r3, ra6 << 14, r1 << 14 -++ add r2, r2, r3 ; mul24 r3, ra7 << 7, r0 << 7 -++ nop ; mul24.ifnz r3, ra7 << 15, r1 << 15 -++ add r0, r2, r3 ; mov r3, rb31 -++ sub.setf -, r3, 8 ; mov ra8, ra9 -++ mov ra9, ra10 -++ mov ra10, ra11 -++ mov ra11, ra12 -++ mov ra12, ra13 -++ brr.anyn -, r:yloopb -++ mov ra13, ra14 # Delay slot 1 -++ mov ra14, ra15 # Delay slot 2 -++ mov ra15, r0 # Delay slot 3 -++ -++ # apply vertical filter and write to VPM -++ -++ nop ; mul24 r1, ra14, rb10 -++ nop ; mul24 r0, ra13, rb9 -++ add r1, r1, r0 ; mul24 r0, ra12, rb8 -++ add r1, r1, r0 ; mul24 r0, ra15, rb11 -++ add r1, r1, r0 ; mul24 r0, ra8, rb4 -++ add r1, r1, r0 ; mul24 r0, ra9, rb5 -++ add r1, r1, r0 ; mul24 r0, ra10, rb6 -++ add r1, r1, r0 ; mul24 r0, ra11, rb7 -++ -++ add r1, r1, r0 ; mov -, vw_wait -++ sub.setf -, r3, rb18 ; mul24 r1, r1, ra22 -++ asr r0, r1, 14 -++ asr r1, r1, 6 # Wait state so we can use the rotate instruction -++ nop ; mul24 r0, r0 << 8, ra22 << 8 # Rotate to align left and right halves -++ add r1, r1, ra18 -++ add r1, r1, r0 -++ brr.anyn -, r:yloopb -++ asr r1, r1, 15 # Delay 1 -++ min r1, r1, rb22 # Delay 2 -++ max vpm, r1, 0 # Delay 3 -+ -+ # DMA out -+-bra -, ra31 -+-mov vw_setup, rb26 # VDW setup 0 Delay 1 -+-mov vw_setup, rb29 # Stride Delay 2 -+-mov vw_addr, unif # start the VDW Delay 3 -++ brr -, r:per_block_setup -++ mov vw_setup, rb26 # VDW setup 0 Delay 1 -++ mov vw_setup, rb29 # Stride Delay 2 -++ mov vw_addr, unif # start the VDW Delay 3 -+ -+ ################################################################################ -+ -+ # mc_interrupt_exit12() -+ ::mc_interrupt_exit12 -+-mov -, vw_wait # wait on the VDW -+- -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+-ldtmu0 -+- -+-mov -,sacq(0) # 1 -+-mov -,sacq(0) # 2 -+-mov -,sacq(0) # 3 -+-mov -,sacq(0) # 4 -+-mov -,sacq(0) # 5 -+-mov -,sacq(0) # 6 -+-mov -,sacq(0) # 7 -+-mov -,sacq(0) # 8 -+-mov -,sacq(0) # 9 -+-mov -,sacq(0) # 10 -+-mov -,sacq(0) # 11 -+- -+-nop ; nop ; thrend -+-mov interrupt, 1; nop # delay slot 1 -+-nop ; nop # delay slot 2 -++ mov -, vw_wait # wait on the VDW -++ -++ ldtmu0 -++ ldtmu0 -++ ldtmu1 -++ ldtmu1 -++ -++ mov -,sacq(0) # 1 -++ mov -,sacq(0) # 2 -++ mov -,sacq(0) # 3 -++ mov -,sacq(0) # 4 -++ mov -,sacq(0) # 5 -++ mov -,sacq(0) # 6 -++ mov -,sacq(0) # 7 -++ mov -,sacq(0) # 8 -++ mov -,sacq(0) # 9 -++ mov -,sacq(0) # 10 -++ mov -,sacq(0) # 11 -++ -++ nop ; nop ; thrend -++ mov interrupt, 1; nop # delay slot 1 -++ nop ; nop # delay slot 2 -++ -++ -++::mc_exit1 -++ mov -, vw_wait # wait on the VDW -++ -++ ldtmu0 -++ ldtmu1 -++ ldtmu0 -++ ldtmu1 -++ nop ; nop ; thrend -++ mov interrupt, 1; nop # delay slot 1 -++ nop ; nop # delay slot 2 -+ -+ -+ ::mc_end -+-- -+2.7.4 -+ -+ -+From f02ec34c772aad3caa17432c6a4860f9ed0d5dc6 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 10:58:25 +0100 -+Subject: [PATCH 48/68] Added option to simulate QPUs -+ -+--- -+ libavcodec/hevc.c | 288 +++++++++++++++++++++++++++++++++++++++++++-- -+ libavcodec/rpi_qpu.c | 24 ++-- -+ libavcodec/rpi_shader.qasm | 6 +- -+ 3 files changed, 295 insertions(+), 23 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 2da88ec..34d92e2 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -56,6 +56,8 @@ -+ // Define RPI_CACHE_UNIF_MVS to write motion vector uniform stream to cached memory -+ // RPI_CACHE_UNIF_MVS doesn't seem to make much difference, so left undefined. -+ -++ // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs -++ //#define RPI_SIMULATE_QPUS -+ -+ #endif -+ -+@@ -124,7 +126,6 @@ static void pic_arrays_free(HEVCContext *s) -+ -+ #ifdef EARLY_MALLOC -+ #else -+- printf("pic_arrays_free\n"); -+ if (s->coeffs_buf_arm[0]) { -+ gpu_free(&s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = 0; -+@@ -174,11 +175,9 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ #ifdef RPI -+ #ifdef EARLY_MALLOC -+ #else -+- assert(sps); -++ av_assert0(sps); -+ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+- printf("pic_arrays_init\n"); -+- printf("Allocated %d\n",coefs_per_row); -+ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+ s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+ if (!s->coeffs_buf_arm[0]) -+@@ -2988,6 +2987,274 @@ static void rpi_inter_clear(HEVCContext *s) -+ #endif -+ } -+ -++ -++#ifdef RPI_SIMULATE_QPUS -++ -++static int32_t clipx(int x,int FRAME_WIDTH) -++{ -++ if (x<=0) return 0; -++ if (x>=FRAME_WIDTH) return FRAME_WIDTH-1; -++ return x; -++} -++ -++static int32_t clipy(int y,int FRAME_HEIGHT) -++{ -++ if (y<=0) return 0; -++ if (y>=FRAME_HEIGHT) return FRAME_HEIGHT-1; -++ return y; -++} -++ -++/*static int32_t filter8(uint8_t *data, int x0, int y0, int pitch, int mx, int my,int round,int denom,int weight,int offset) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ -++ for (y = 0; y < 8; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 8; x++) -++ hsum += lumaFilter[mx][x]*data[clipx(x + x0) + clipy(y + y0) * pitch]; -++ -++ vsum += lumaFilter[my][y]*hsum; -++ } -++ vsum >>= 6; -++ vsum = (((vsum*weight)+round)>>denom)+offset; -++ -++ return av_clip_uint8( vsum ); -++}*/ -++ -++static int32_t filter8_chroma(uint8_t *data, int x0, int y0, int pitch, int hcoeffs, int vcoeffs,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ int chromaFilterH[4]; -++ int chromaFilterV[4]; -++ int i; -++ int offset_after = offset_weight>>16; -++ int weight = (offset_weight<<16)>>16; -++ for(i=0;i<4;i++) { -++ chromaFilterH[i] = ((hcoeffs>>(8*i))<<24)>>24; -++ chromaFilterV[i] = ((vcoeffs>>(8*i))<<24)>>24; -++ } -++ -++ for (y = 0; y < 4; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 4; x++) -++ hsum += chromaFilterH[x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; -++ -++ vsum += chromaFilterV[y]*hsum; -++ } -++ vsum >>= 6; -++ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; -++ -++ return vsum; -++} -++ -++int lumaFilter[4][8]={ {0,0,0,64,0,0,0,0},{-1,4,-10,58,17,-5,1,0},{-1,4,-11,40,40,-11,4,-1},{0,1,-5,17,58,-10,4,-1} }; -++ -++static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx,int offset_weight,int offset_before,int denom,int pic_width, int pic_height) -++{ -++ int32_t vsum = 0; -++ int x, y; -++ int i; -++ int offset_after = offset_weight>>16; -++ int weight = (offset_weight<<16)>>16; -++ -++ for (y = 0; y < 8; y++) { -++ int32_t hsum = 0; -++ -++ for (x = 0; x < 8; x++) -++ hsum += lumaFilter[my_mx&3][x]*data[clipx(x + x0,pic_width) + clipy(y + y0,pic_height) * pitch]; -++ -++ vsum += lumaFilter[(my_mx>>8)&3][y]*hsum; -++ } -++ vsum >>= 6; -++ vsum = (((vsum*weight)+offset_before)>>denom)+offset_after; -++ -++ return vsum; -++} -++ -++static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) -++{ -++ //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; -++ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; -++ int pitch = frame->linesize[cIdx]; -++ uint32_t base = get_vc_address(frame->buf[cIdx]); -++ if (p>=base && pdata[cIdx] + (p-base); -++ } -++ return NULL; -++} -++ -++static uint8_t *compute_arm_addr(HEVCContext *s,uint32_t p, int cIdx) -++{ -++ SliceHeader *sh = &s->sh; -++ uint8_t *arm = test_frame(s,p,s->frame,cIdx); -++ int i; -++ if (arm) return arm; -++ if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) -++ { -++ for(i=0;inb_refs[L0];i++) { -++ arm = test_frame(s,p,s->ref->refPicList[0].ref[i]->frame,cIdx); -++ if (arm) return arm; -++ } -++ } -++ if (sh->slice_type == B_SLICE) { -++ for(i=0;inb_refs[L1];i++) { -++ arm = test_frame(s,p,s->ref->refPicList[1].ref[i]->frame,cIdx); -++ if (arm) return arm; -++ } -++ } -++ printf("Frame 0x%x not found! Exit=%x\n",p,qpu_get_fn(QPU_MC_EXIT)); -++ exit(-1); -++ return NULL; -++} -++ -++static void rpi_simulate_inter_chroma(HEVCContext *s,uint32_t *p) -++{ -++ uint32_t next_kernel; -++ uint32_t x0; -++ uint32_t y0; -++ uint8_t *ref_u_base; -++ uint8_t *ref_v_base; -++ uint32_t frame_width = p[5]; -++ uint32_t frame_height = p[6]; -++ uint32_t pitch = p[7]; -++ uint32_t dst_pitch = p[8]; -++ int32_t offset_before = p[9]; -++ int32_t denom = p[10]; -++ uint32_t vpm_id = p[11]; -++ uint32_t tmp_u_dst[256]; -++ uint32_t tmp_v_dst[256]; -++ while(1) { -++ p += 12; -++ next_kernel = p[0-12]; -++ x0 = p[1-12]; -++ y0 = p[2-12]; -++ if (next_kernel==s->mc_filter_uv || next_kernel==s->mc_filter_uv_b0 || next_kernel==s->mc_filter_uv_b) { -++ int x,y; -++ uint32_t width_height = p[5]; -++ uint32_t hcoeffs = p[6]; -++ uint32_t vcoeffs = p[7]; -++ uint32_t offset_weight_u = p[8]; -++ uint32_t offset_weight_v = p[9]; -++ uint8_t *this_u_dst; -++ uint8_t *this_v_dst; -++ uint32_t width = width_height >> 16; -++ uint32_t height = (width_height << 16) >> 16; -++ ref_u_base = compute_arm_addr(s,p[3-12],1); -++ ref_v_base = compute_arm_addr(s,p[4-12],2); -++ if (next_kernel!=s->mc_filter_uv_b0) -++ { -++ this_u_dst = compute_arm_addr(s,p[10],1); -++ this_v_dst = compute_arm_addr(s,p[11],2); -++ } -++ for (y=0; ymc_filter_uv) { -++ int32_t refa = filter8_chroma(ref_u_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_u,offset_before,denom,frame_width,frame_height); -++ int32_t refb = filter8_chroma(ref_v_base,x+x0, y+y0, pitch, hcoeffs, vcoeffs, offset_weight_v,offset_before,denom,frame_width,frame_height); -++ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); -++ } else if (next_kernel==s->mc_filter_uv_b0) { -++ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); -++ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1,0,0,frame_width,frame_height); -++ tmp_u_dst[x+y*16] = refa; -++ tmp_v_dst[x+y*16] = refb; -++ } else { -++ int32_t refa = filter8_chroma(ref_u_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_u_dst[x+y*16], 7, frame_width, frame_height); -++ int32_t refb = filter8_chroma(ref_v_base, x+x0, y+y0, pitch, hcoeffs, vcoeffs, 1, 64 + tmp_v_dst[x+y*16], 7, frame_width, frame_height); -++ this_u_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ this_v_dst[x+y*dst_pitch] = av_clip_uint8(refb); -++ } -++ } -++ } -++ } else { -++ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT8) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); -++ break; -++ } -++ } -++} -++ -++// mc_setup(y_x, ref_y_base, y2_x2, ref_y2_base, frame_width_height, pitch, dst_pitch, offset_shift, next_kernel) -++static void rpi_simulate_inter_luma(HEVCContext *s,uint32_t *p) -++{ -++ uint32_t next_kernel; -++ int y_x,y2_x2; -++ uint32_t x0; -++ uint32_t y0; -++ uint32_t x2; -++ uint32_t y2; -++ uint8_t *ref_y_base; -++ uint8_t *ref_y2_base; -++ uint32_t frame_width_height = p[4]; -++ uint32_t frame_width = frame_width_height>>16; -++ uint32_t frame_height = (frame_width_height<<16)>>16; -++ uint32_t pitch = p[5]; -++ uint32_t dst_pitch = p[6]; -++ int offset_shift = p[7]; -++ int32_t offset_before = offset_shift>>16; -++ int32_t denom = (offset_shift<<16)>>16; -++ while(1) { -++ p += 9; -++ next_kernel = p[8-9]; -++ y_x = p[0-9]; -++ x0 = (y_x<<16)>>16; -++ y0 = y_x>>16; -++ y2_x2 = p[2-9]; -++ x2 = (y2_x2<<16)>>16; -++ y2 = y2_x2>>16; -++ -++ if (next_kernel==s->mc_filter || next_kernel==s->mc_filter_b) { -++ // y_x, frame_base, y2_x2, frame_base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -++ int x,y; -++ uint32_t width_height = p[4]; -++ uint32_t my2_mx2_my_mx = p[5]; -++ uint32_t offset_weight = p[6]; -++ uint8_t *this_dst = compute_arm_addr(s,p[7],0); -++ uint32_t width = width_height >> 16; -++ uint32_t height = (width_height << 16) >> 16; -++ ref_y_base = compute_arm_addr(s,p[1-9],0); -++ ref_y2_base = compute_arm_addr(s,p[3-9],0); -++ for (y=0; ymc_filter) { -++ int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); -++ this_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ } -++ else { -++ int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); -++ int32_t refb = filter8_luma(ref_y2_base, x+x2, y+y2, pitch, my2_mx2_my_mx>>16, 1, 64 + refa, 7, frame_width, frame_height); -++ this_dst[x+y*dst_pitch] = av_clip_uint8(refb); -++ } -++ } -++ } -++ } else { -++ av_assert0(next_kernel==qpu_get_fn(QPU_MC_INTERRUPT_EXIT12) || next_kernel==qpu_get_fn(QPU_MC_EXIT) ); -++ break; -++ } -++ } -++} -++ -++static void rpi_simulate_inter_qpu(HEVCContext *s) -++{ -++ // First run the transform as normal -++ int i; -++ rpi_execute_transform(s); -++ for(i=0;i<8;i++) -++ { -++ rpi_simulate_inter_chroma(s,s->mvs_base[i]); -++ } -++ for(i=0;i<12;i++) -++ { -++ rpi_simulate_inter_luma(s,s->y_mvs_base[i]); -++ } -++} -++ -++#endif -++ -++ -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+ { -+ int k; -+@@ -3006,7 +3273,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+- assert(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -++ av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -+ } -+ -+ s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+@@ -3016,11 +3283,16 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -+ s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- assert(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -++ av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -+ } -+ s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ #endif -+ -++#ifdef RPI_SIMULATE_QPUS -++ rpi_simulate_inter_qpu(s); -++ s->vpu_id = -1; -++ return; -++#endif -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+@@ -3101,7 +3373,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -+ #endif -+ -+- /*if (!s->enable_rpi) { -++ if (!s->enable_rpi) { -+ if (s->ps.pps->cross_component_prediction_enabled_flag) -+ printf("Cross component\n"); -+ if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -+@@ -3110,7 +3382,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ printf("Weighted P slice\n"); -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+- }*/ -++ } -+ -+ #endif -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index e12304b..4480f72 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -13,7 +13,7 @@ -+ #include -+ #include -+ #include -+-#include -++#include "libavutil/avassert.h" -+ -+ #include "config.h" -+ -+@@ -160,13 +160,13 @@ static int gpu_init(volatile struct GPU **gpu) { -+ // Now copy over the QPU code into GPU memory -+ { -+ int num_bytes = qpu_get_fn(QPU_MC_END) - qpu_get_fn(QPU_MC_SETUP_UV); -+- assert(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -++ av_assert0(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->qpu_code, rpi_shader, num_bytes); -+ } -+ // And the VPU code -+ { -+ int num_bytes = sizeof(rpi_hevc_transform); -+- assert(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -++ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code, rpi_hevc_transform, num_bytes); -+ } -+ // And the transform coefficients -+@@ -216,13 +216,13 @@ static void gpu_unlock(void) { -+ static int gpu_malloc_uncached_internal(int numbytes, GPU_MEM_PTR_T *p, int mb) { -+ p->numbytes = numbytes; -+ p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+- assert(p->vcsm_handle); -++ av_assert0(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+- assert(p->vc_handle); -++ av_assert0(p->vc_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+- assert(p->arm); -++ av_assert0(p->arm); -+ p->vc = mem_lock(mb, p->vc_handle); -+- assert(p->vc); -++ av_assert0(p->vc); -+ return 0; -+ } -+ -+@@ -243,7 +243,7 @@ int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -+ -+ int gpu_get_mailbox(void) -+ { -+- assert(gpu); -++ av_assert0(gpu); -+ return gpu->mb; -+ } -+ -+@@ -297,13 +297,13 @@ static int gpu_malloc_cached_internal(int numbytes, GPU_MEM_PTR_T *p) { -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_VC, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_NONE, (char *)"Video Frame" ); -+ //p->vcsm_handle = vcsm_malloc_cache(numbytes, VCSM_CACHE_TYPE_HOST_AND_VC, (char *)"Video Frame" ); -+- assert(p->vcsm_handle); -++ av_assert0(p->vcsm_handle); -+ p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle); -+- assert(p->vc_handle); -++ av_assert0(p->vc_handle); -+ p->arm = vcsm_lock(p->vcsm_handle); -+- assert(p->arm); -++ av_assert0(p->arm); -+ p->vc = mem_lock(gpu->mb, p->vc_handle); -+- assert(p->vc); -++ av_assert0(p->vc); -+ return 0; -+ } -+ -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 60d1ec2..0686249 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -149,8 +149,8 @@ add t0s, r0, r1 ; mov ra_frame_base, r2 -+ add t1s, r2, r1 -+ -+ mov r2,8 -+-shl rb12,unif, r2 # offset before shift -+-add rb13,unif,r2 # offset after shift -++shl rb12,unif,r2 # offset before shift -++add rb13,unif,r2 # denominator -+ -+ # Compute part of VPM to use for DMA output -+ mov r2, unif -+@@ -185,7 +185,7 @@ add t1s, r1, ra_frame_base -+ -+ ################################################################################ -+ -+-# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, height, hcoeffs[0], hcoeffs[1], vcoeffs[0], vcoeffs[1], this_u_dst, this_v_dst) -++# mc_filter_uv(next_kernel, x, y, frame_u_base, frame_v_base, width_height, hcoeffs, vcoeffs, offset_weight_u, offset_weight_v, this_u_dst, this_v_dst) -+ -+ # At this point we have already issued two pairs of texture requests for the current block -+ # ra_x, ra_x16_base point to the current coordinates for this block -+-- -+2.7.4 -+ -+ -+From 8bdf6b06c612ff4971c2ce99a62d093cf92468ca Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 13:17:50 +0100 -+Subject: [PATCH 49/68] Increased motion vector memory and fixed block size -+ computation for non-multiple of 2 block sizes -+ -+--- -+ libavcodec/hevc.c | 50 +++++++++++++++++++++++++++++++------------------- -+ 1 file changed, 31 insertions(+), 19 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 34d92e2..3fb1e2a 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -83,11 +83,9 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ // Split image of 2048 into parts 64 wide -+ // So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -+-// Each block of 64*64 -+-// Smallest CTU size is 16x16, so smallest block is 8x8 -+-// Corresponds to a total of 83kbytes over all 12 QPUs -++// For each block of 64*64 the smallest block size is 8x4 -+ #define RPI_LUMA_COMMAND_WORDS 9 -+-#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*8)) * RPI_LUMA_COMMAND_WORDS) -++#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -+ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+@@ -2042,11 +2040,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ int bw = nPbW-start_x; -++ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -+@@ -2089,12 +2089,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ int bw = nPbW_c-start_x; -++ int bh = nPbH_c-start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+- *u++ = ( (nPbW_cy_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -++ int bw = nPbW-start_x; -++ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+- *y++ = ( (nPbW<16 ? nPbW : 16) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+ *y++ = (s->sh.luma_offset_l0[current_mv.ref_idx[reflist]] << 16) + (s->sh.luma_weight_l0[current_mv.ref_idx[reflist]] & 0xffff); -+@@ -2189,12 +2193,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ int bw = nPbW_c-start_x; -++ int bh = nPbH_c-start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+- *u++ = ( (nPbW_csh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+ *u++ = rpi_filter_coefs[_my][0]; -+@@ -2246,11 +2252,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *y = s->y_mvs[chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -++ int bw = nPbW-start_x; -++ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -+ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -+- *y++ = ( (nPbW<8 ? nPbW : 8) << 16 ) + (nPbH<16 ? nPbH : 16); -++ *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ *y++ = 1; // B frame weighted prediction not supported -+ *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+@@ -2293,12 +2301,14 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ uint32_t *u = s->u_mvs[chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -++ int bw = nPbW_c-start_x; -++ int bh = nPbH_c-start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -+- *u++ = ( (nPbW_cframe->buf[1]); -+ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -+- *u++ = ( (nPbW_c> 16; -+ uint32_t height = (width_height << 16) >> 16; -++ uint8_t *dst_base = s->frame->data[0]; -+ ref_y_base = compute_arm_addr(s,p[1-9],0); -+ ref_y2_base = compute_arm_addr(s,p[3-9],0); -+ for (y=0; ymc_filter) { -+ int32_t refa = filter8_luma(ref_y_base,x+x0, y+y0, pitch, my2_mx2_my_mx, offset_weight,offset_before,denom,frame_width,frame_height); -+- this_dst[x+y*dst_pitch] = av_clip_uint8(refa); -++ refa = av_clip_uint8(refa); -++ this_dst[x+y*dst_pitch] = refa; -+ } -+ else { -+ int32_t refa = filter8_luma(ref_y_base, x+x0, y+y0, pitch, my2_mx2_my_mx, 1, 0, 0, frame_width, frame_height); -+@@ -3248,7 +3261,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ } -+ for(i=0;i<12;i++) -+ { -+- rpi_simulate_inter_luma(s,s->y_mvs_base[i]); -++ rpi_simulate_inter_luma(s,s->y_mvs_base[i],i); -+ } -+ } -+ -+@@ -3290,7 +3303,6 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ #ifdef RPI_SIMULATE_QPUS -+ rpi_simulate_inter_qpu(s); -+- s->vpu_id = -1; -+ return; -+ #endif -+ -+-- -+2.7.4 -+ -+ -+From da5ae7e96dd961ccc7bc162c8acf336d54a50092 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 14:36:54 +0100 -+Subject: [PATCH 50/68] Added support for skip deblock -+ -+--- -+ libavcodec/hevc.c | 5 +++++ -+ libavcodec/hevc.h | 2 ++ -+ libavcodec/hevc_filter.c | 14 ++++---------- -+ 3 files changed, 11 insertions(+), 10 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 3fb1e2a..0ac4f4c 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3397,6 +3397,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ -+ #endif -++ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N); -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 5df9dcd..5cb90b5 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -890,6 +890,8 @@ typedef struct HEVCContext { -+ int width; -+ int height; -+ -++ int used_for_ref; -++ -+ #ifdef RPI -+ int enable_rpi; -+ HEVCMvCmd *unif_mv_cmds; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 11629e4..14a0952 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -512,16 +512,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->ps.pps->transquant_bypass_enable_flag; -+ -+ #ifdef DISABLE_DEBLOCK_NONREF -+- if ( s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N ) -++ if (!s->used_for_ref) -+ return; // Don't deblock non-reference frames -+ #endif -+ #ifdef DISABLE_DEBLOCK -+ return; -+ #endif -++ if (!s->used_for_ref && s->avctx->skip_loop_filter >= AVDISCARD_NONREF) -++ return; -+ -+ if (x0) { -+ left_tc_offset = s->deblock[ctb - 1].tc_offset; -+@@ -885,11 +883,7 @@ static int ff_hevc_buf_base(AVBufferRef *bref) { -+ -+ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+- if (s->enable_rpi && !( s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N )) { -++ if (s->enable_rpi && s->used_for_ref) { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int curr_y = ((int *)f->progress->data)[0]; -+-- -+2.7.4 -+ -+ -+From 6401d88c310cd3bfec7be94bf3ceb6d0c5736c7e Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Tue, 2 Jun 2015 15:22:52 +0100 -+Subject: [PATCH 51/68] Added support for skip_frame -+ -+--- -+ libavcodec/hevc.c | 15 ++++++++++----- -+ 1 file changed, 10 insertions(+), 5 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 0ac4f4c..639e4df 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3397,11 +3397,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ -+ #endif -+- s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -+- s->nal_unit_type == NAL_TSA_N || -+- s->nal_unit_type == NAL_STSA_N || -+- s->nal_unit_type == NAL_RADL_N || -+- s->nal_unit_type == NAL_RASL_N); -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+@@ -3925,6 +3920,16 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) -+ if (ret < 0) -+ return ret; -+ -++ s->used_for_ref = !(s->nal_unit_type == NAL_TRAIL_N || -++ s->nal_unit_type == NAL_TSA_N || -++ s->nal_unit_type == NAL_STSA_N || -++ s->nal_unit_type == NAL_RADL_N || -++ s->nal_unit_type == NAL_RASL_N); -++ -++ if (!s->used_for_ref && s->avctx->skip_frame >= AVDISCARD_NONREF) { -++ s->is_decoded = 0; -++ break; -++ } -+ if (s->max_ra == INT_MAX) { -+ if (s->nal_unit_type == NAL_CRA_NUT || IS_BLA(s)) { -+ s->max_ra = s->poc; -+-- -+2.7.4 -+ -+ -+From d2951e2ca73e234d1b775621e3993948a4a2c8ea Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 09:15:38 +0100 -+Subject: [PATCH 52/68] Fixed cache flushing of luma when using old method -+ -+--- -+ libavcodec/hevc_filter.c | 2 +- -+ 1 file changed, 1 insertion(+), 1 deletion(-) -+ -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 14a0952..b286bbf 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -919,7 +919,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ flush_buffer(s->frame->buf[1]); -+ flush_buffer(s->frame->buf[2]); -+ #ifdef RPI_LUMA_QPU -+- flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[0]); -+ #endif -+ -+ #endif -+-- -+2.7.4 -+ -+ -+From 7ae612e69c1cabcc7d0b37b65efa8c5bdcfa7bf5 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 11:37:27 +0100 -+Subject: [PATCH 53/68] Option to parallelise coefficient decode and inter -+ prediction and deblock for each frame -+ -+--- -+ libavcodec/hevc.c | 701 +++++++++++++++++++++++++++-------------- -+ libavcodec/hevc.h | 74 +++-- -+ libavcodec/hevc_cabac.c | 12 +- -+ libavcodec/hevcpred_template.c | 5 +- -+ 4 files changed, 522 insertions(+), 270 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 639e4df..12aacc5 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -43,8 +43,6 @@ -+ -+ #ifdef RPI -+ #include "rpi_qpu.h" -+- // For some unknown reason, the code seems to crash if I do a late malloc -+- //#define EARLY_MALLOC -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -+ -+@@ -58,6 +56,21 @@ -+ -+ // Define RPI_SIMULATE_QPUS for debugging to run QPU code on the ARMs -+ //#define RPI_SIMULATE_QPUS -++ #ifdef RPI_WORKER -++ #include "pthread.h" -++ #endif -++ -++ static void rpi_execute_dblk_cmds(HEVCContext *s); -++ static void rpi_execute_transform(HEVCContext *s); -++ static void rpi_execute_inter_qpu(HEVCContext *s); -++ static void rpi_execute_pred_cmds(HEVCContext *s); -++ static void rpi_execute_inter_cmds(HEVCContext *s); -++ static void rpi_inter_clear(HEVCContext *s); -++ -++ // Define INTER_PASS0 to do inter prediction in first pass -++ //#define INTER_PASS0 -++ // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 -++ //#define LAUNCH_PASS0 -+ -+ #endif -+ -+@@ -105,6 +118,143 @@ static uint32_t get_vc_address(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ return p->vc; -+ } -++#endif -++ -++ -++#ifdef RPI_WORKER -++ -++//#define LOG_ENTER printf("Enter %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); -++//#define LOG_EXIT printf("Exit %s: p0=%d p1=%d (%d jobs) %p\n", __func__,s->pass0_job,s->pass1_job,s->worker_tail-s->worker_head,s); -++ -++#define LOG_ENTER -++#define LOG_EXIT -++ -++// Call this when we have completed pass0 and wish to trigger pass1 for the current job -++static void worker_submit_job(HEVCContext *s) -++{ -++ LOG_ENTER -++ //pthread_mutex_lock(&s->worker_mutex); -++ s->worker_tail++; // This is the only place that can change tail so we do not need the mutex -++ s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved -++ //pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call this to say we have completed pass1 -++static void worker_complete_middle_job(HEVCContext *s) -++{ -++ LOG_ENTER -++ //pthread_mutex_lock(&s->worker_mutex); -++ s->worker_middle++; // This is the only place that can change head so we do not need the mutex -++ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved -++ //pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call this to say we have completed pass2 -++static void worker_complete_job(HEVCContext *s) -++{ -++ LOG_ENTER -++ //pthread_mutex_lock(&s->worker_mutex); -++ s->worker_head++; // This is the only place that can change head so we do not need the mutex -++ s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved -++ //pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call this to wait for all jobs to have completed at the end of a frame -++static void worker_wait(HEVCContext *s) -++{ -++ LOG_ENTER -++ pthread_mutex_lock(&s->worker_mutex); -++ while( s->worker_head !=s->worker_tail) -++ { -++ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++// Call worker_pass0_ready to wait until the s->pass0_job slot becomes -++// available to receive the next job. -++static void worker_pass0_ready(HEVCContext *s) -++{ -++ LOG_ENTER -++ pthread_mutex_lock(&s->worker_mutex); -++ // tail is number of submitted jobs -++ // head is number of completed jobs -++ // tail-head is number of outstanding jobs in the queue -++ // we need to ensure there is at least 1 space left for us to use -++ while( s->worker_tail - s->worker_head >= RPI_MAX_JOBS) -++ { -++ // Wait until another job is completed -++ pthread_cond_wait(&s->worker_cond_head, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ LOG_EXIT -++} -++ -++static void *worker_start(void *arg) -++{ -++ HEVCContext *s = (HEVCContext *)arg; -++ while(1) { -++ pthread_mutex_lock(&s->worker_mutex); -++ -++ while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) -++ { -++ pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ -++ if (s->kill_worker) { -++ break; -++ } -++ LOG_ENTER -++ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -++#ifndef LAUNCH_PASS0 -++ rpi_execute_inter_qpu(s); -++#endif -++#ifndef INTER_PASS0 -++ // Perform inter prediction -++ rpi_execute_inter_cmds(s); -++#endif -++ // Wait for transform completion -++ vpu_wait(s->vpu_id); -++ -++ worker_complete_middle_job(s); -++ LOG_EXIT -++ } -++ return NULL; -++} -++ -++static void *worker_deblock_start(void *arg) -++{ -++ HEVCContext *s = (HEVCContext *)arg; -++ while(1) { -++ pthread_mutex_lock(&s->worker_mutex); -++ while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) -++ { -++ pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); -++ } -++ pthread_mutex_unlock(&s->worker_mutex); -++ -++ if (s->kill_worker) { -++ break; -++ } -++ LOG_ENTER -++ // Perform intra prediction and residual reconstruction -++ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ rpi_execute_dblk_cmds(s); -++ -++ worker_complete_job(s); -++ LOG_EXIT -++ } -++ return NULL; -++} -+ -+ #endif -+ -+@@ -121,19 +271,18 @@ static uint32_t get_vc_address(AVBufferRef *bref) { -+ static void pic_arrays_free(HEVCContext *s) -+ { -+ #ifdef RPI -+- -+-#ifdef EARLY_MALLOC -+-#else -+- if (s->coeffs_buf_arm[0]) { -+- gpu_free(&s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = 0; -+- } -+- if (s->coeffs_buf_arm[2]) { -+- gpu_free(&s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = 0; -++ int job; -++ for(job=0;jobcoeffs_buf_arm[job][0]) { -++ gpu_free(&s->coeffs_buf_default[job]); -++ s->coeffs_buf_arm[job][0] = 0; -++ } -++ if (s->coeffs_buf_arm[job][2]) { -++ gpu_free(&s->coeffs_buf_accelerated[job]); -++ s->coeffs_buf_arm[job][2] = 0; -++ } -+ } -+ #endif -+-#endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+@@ -171,24 +320,26 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ int min_pu_size = sps->min_pu_width * sps->min_pu_height; -+ -+ #ifdef RPI -+-#ifdef EARLY_MALLOC -+-#else -+ av_assert0(sps); -+ int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+- if (!s->coeffs_buf_arm[0]) -+- goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+- if (!s->coeffs_buf_arm[2]) -+- goto fail; -+- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+- printf("Done\n"); -+-#endif -++ int job; -++ for(job=0;jobcoeffs_buf_default[job]); -++ s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; -++ if (!s->coeffs_buf_arm[job][0]) -++ goto fail; -++ gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); -++ s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; -++ s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; -++ if (!s->coeffs_buf_arm[job][2]) -++ goto fail; -++ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; -++ s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; -++ } -++ } -+ #endif -+ -+ s->bs_width = (width >> 2) + 1; -+@@ -1036,7 +1187,7 @@ static void rpi_intra_pred(HEVCContext *s, int log2_trafo_size, int x0, int y0, -+ { -+ if (s->enable_rpi) { -+ HEVCLocalContext *lc = s->HEVClc; -+- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; -+ cmd->type = RPI_PRED_INTRA; -+ cmd->size = log2_trafo_size; -+ cmd->c_idx = c_idx; -+@@ -1496,7 +1647,7 @@ static void rpi_luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref, const Mv *mv, int x_off, int y_off, -+ int block_w, int block_h, int luma_weight, int luma_offset) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_LUMA_UNI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+@@ -1515,7 +1666,7 @@ static void rpi_luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, -+ AVFrame *ref0, const Mv *mv0, int x_off, int y_off, -+ int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_LUMA_BI; -+ cmd->dst = dst; -+ cmd->dststride = dststride; -+@@ -1537,7 +1688,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_CHROMA_UNI; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+@@ -1555,7 +1706,7 @@ static void rpi_chroma_mc_uni(HEVCContext *s, uint8_t *dst0, -+ static void rpi_chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, -+ int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds + s->num_mv_cmds++; -++ HEVCMvCmd *cmd = s->unif_mv_cmds[s->pass0_job] + s->num_mv_cmds[s->pass0_job]++; -+ cmd->cmd = RPI_CMD_CHROMA_BI+cidx; -+ cmd->dst = dst0; -+ cmd->dststride = dststride; -+@@ -2037,7 +2188,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[chan % 12]; -++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2057,7 +2208,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[chan % 12] = y; -++ s->y_mvs[s->pass0_job][chan % 12] = y; -+ } else -+ #endif -+ { -+@@ -2086,7 +2237,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[chan & 7]; -++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2110,7 +2261,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[chan & 7] = u; -++ s->u_mvs[s->pass0_job][chan & 7] = u; -+ return; -+ } -+ #endif -+@@ -2140,7 +2291,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[chan % 12]; -++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2160,7 +2311,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[chan % 12] = y; -++ s->y_mvs[s->pass0_job][chan % 12] = y; -+ } else -+ #endif -+ -+@@ -2190,7 +2341,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[chan & 7]; -++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2215,7 +2366,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[chan & 7] = u; -++ s->u_mvs[s->pass0_job][chan & 7] = u; -+ return; -+ } -+ #endif -+@@ -2249,7 +2400,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int x2 = x0 + (mv2->x >> 2); -+ int y2 = y0 + (mv2->y >> 2); -+ int chan = x0>>6; // 64 wide blocks per QPU -+- uint32_t *y = s->y_mvs[chan % 12]; -++ uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -+ int bw = nPbW-start_x; -+@@ -2265,7 +2416,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+- s->y_mvs[chan % 12] = y; -++ s->y_mvs[s->pass0_job][chan % 12] = y; -+ } else -+ #endif -+ { -+@@ -2298,7 +2449,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ -+- uint32_t *u = s->u_mvs[chan & 7]; -++ uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2327,7 +2478,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[chan & 7] = u; -++ s->u_mvs[s->pass0_job][chan & 7] = u; -+ return; -+ } -+ #endif -+@@ -2832,40 +2983,54 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ static void rpi_execute_dblk_cmds(HEVCContext *s) -+ { -+ int n; -++ int job = s->pass2_job; -+ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -+- int (*p)[2] = s->dblk_cmds; -+- for(n = s->num_dblk_cmds; n>0 ;n--,p++) { -++ int (*p)[2] = s->dblk_cmds[job]; -++ for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { -+ ff_hevc_hls_filters(s, (*p)[0], (*p)[1], ctb_size); -+ } -+- s->num_dblk_cmds = 0; -++ s->num_dblk_cmds[job] = 0; -+ } -+ -+ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -++#ifdef LAUNCH_PASS0 -++ int job = s->pass0_job; -++#else -++ int job = s->pass1_job; -++#endif -+ //int j; -+ //int16_t *coeffs = s->coeffs_buf_arm[i]; -+ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+ // s->hevcdsp.idct[4-2](coeffs, 16); -+ //} -+ -+- gpu_cache_flush(&s->coeffs_buf_accelerated); -+- s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, &s->coeffs_buf_accelerated); -++ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -++ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], -++ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], -++ s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); -+ //vpu_wait(s->vpu_id); -+ -+ for(i=0;i<4;i++) -+- s->num_coeffs[i] = 0; -++ s->num_coeffs[job][i] = 0; -+ } -+ -+ static void rpi_execute_pred_cmds(HEVCContext *s) -+ { -+ int i; -+- HEVCPredCmd *cmd = s->univ_pred_cmds; -++ int job = s->pass2_job; -++ HEVCPredCmd *cmd = s->univ_pred_cmds[job]; -++#ifdef RPI_WORKER -++ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -++#else -+ HEVCLocalContext *lc = s->HEVClc; -++#endif -+ -+- for(i = s->num_pred_cmds; i > 0; i--, cmd++) { -++ for(i = s->num_pred_cmds[job]; i > 0; i--, cmd++) { -++ //printf("i=%d cmd=%p job1=%d job0=%d\n",i,cmd,s->pass1_job,s->pass0_job); -+ if (cmd->type == RPI_PRED_INTRA) { -+ lc->tu.intra_pred_mode_c = lc->tu.intra_pred_mode = cmd->mode; -+ lc->na.cand_bottom_left = (cmd->na >> 4) & 1; -+@@ -2884,21 +3049,26 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ #endif -+ } -+ } -+- s->num_pred_cmds = 0; -++ s->num_pred_cmds[job] = 0; -+ } -+ -+ static void rpi_execute_inter_cmds(HEVCContext *s) -+ { -+- HEVCMvCmd *cmd = s->unif_mv_cmds; -++#ifdef INTER_PASS0 -++ int job = s->pass0_job; -++#else -++ int job = s->pass1_job; -++#endif -++ HEVCMvCmd *cmd = s->unif_mv_cmds[job]; -+ int n,cidx; -+ AVFrame myref; -+ AVFrame myref1; -+ struct MvField mymv; -+- if (s->num_mv_cmds > RPI_MAX_MV_CMDS) { -++ if (s->num_mv_cmds[job] > RPI_MAX_MV_CMDS) { -+ printf("Overflow inter_cmds\n"); -+ exit(-1); -+ } -+- for(n = s->num_mv_cmds; n>0 ; n--, cmd++) { -++ for(n = s->num_mv_cmds[job]; n>0 ; n--, cmd++) { -+ switch(cmd->cmd) { -+ case RPI_CMD_LUMA_UNI: -+ myref.data[0] = cmd->src; -+@@ -2938,7 +3108,28 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ break; -+ } -+ } -+- s->num_mv_cmds = 0; -++ s->num_mv_cmds[job] = 0; -++} -++ -++static void rpi_do_all_passes(HEVCContext *s) -++{ -++#ifdef RPI_INTER_QPU -++ // Kick off inter prediction on QPUs -++ rpi_execute_inter_qpu(s); -++#else -++ rpi_execute_transform(s); -++#endif -++ // Perform luma inter prediction -++ rpi_execute_inter_cmds(s); -++ // Wait for transform completion -++ vpu_wait(s->vpu_id); -++ // Perform intra prediction and residual reconstruction -++ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ rpi_execute_dblk_cmds(s); -++#ifdef RPI_INTER_QPU -++ rpi_inter_clear(s); -++#endif -+ } -+ -+ #endif -+@@ -2946,6 +3137,7 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ #ifdef RPI_INTER_QPU -+ static void rpi_inter_clear(HEVCContext *s) -+ { -++ int job = s->pass0_job; -+ int i; -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -+@@ -2953,51 +3145,50 @@ static void rpi_inter_clear(HEVCContext *s) -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+ for(i=0;i<8;i++) { -+- s->u_mvs[i] = s->mvs_base[i]; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = 0; -+- *s->u_mvs[i]++ = pic_width; -+- *s->u_mvs[i]++ = pic_height; -+- *s->u_mvs[i]++ = s->frame->linesize[1]; -+- *s->u_mvs[i]++ = s->frame->linesize[2]; -++ s->u_mvs[job][i] = s->mvs_base[job][i]; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = 0; -++ *s->u_mvs[job][i]++ = pic_width; -++ *s->u_mvs[job][i]++ = pic_height; -++ *s->u_mvs[job][i]++ = s->frame->linesize[1]; -++ *s->u_mvs[job][i]++ = s->frame->linesize[2]; -+ if (weight_flag) { -+- *s->u_mvs[i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -+- *s->u_mvs[i]++ = s->sh.chroma_log2_weight_denom + 6; -++ *s->u_mvs[job][i]++ = 1 << (s->sh.chroma_log2_weight_denom + 6 - 1); -++ *s->u_mvs[job][i]++ = s->sh.chroma_log2_weight_denom + 6; -+ } else { -+- *s->u_mvs[i]++ = 1 << 5; -+- *s->u_mvs[i]++ = 6; -++ *s->u_mvs[job][i]++ = 1 << 5; -++ *s->u_mvs[job][i]++ = 6; -+ } -+- *s->u_mvs[i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -++ *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -+ } -+ -+ #ifdef RPI_LUMA_QPU -+ for(i=0;i<12;i++) { -+- s->y_mvs[i] = s->y_mvs_base[i]; -+- *s->y_mvs[i]++ = 0; // y_x -+- *s->y_mvs[i]++ = 0; // ref_y_base -+- *s->y_mvs[i]++ = 0; // y2_x2 -+- *s->y_mvs[i]++ = 0; // ref_y2_base -+- *s->y_mvs[i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -+- *s->y_mvs[i]++ = s->frame->linesize[0]; // pitch -+- *s->y_mvs[i]++ = s->frame->linesize[0]; // dst_pitch -++ s->y_mvs[job][i] = s->y_mvs_base[job][i]; -++ *s->y_mvs[job][i]++ = 0; // y_x -++ *s->y_mvs[job][i]++ = 0; // ref_y_base -++ *s->y_mvs[job][i]++ = 0; // y2_x2 -++ *s->y_mvs[job][i]++ = 0; // ref_y2_base -++ *s->y_mvs[job][i]++ = (s->ps.sps->width << 16) + s->ps.sps->height; -++ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // pitch -++ *s->y_mvs[job][i]++ = s->frame->linesize[0]; // dst_pitch -+ if (weight_flag) { -+ int offset = 1 << (s->sh.luma_log2_weight_denom + 6 - 1); -+ int shift = s->sh.luma_log2_weight_denom + 6; -+- *s->y_mvs[i]++ = (offset << 16) + shift; -++ *s->y_mvs[job][i]++ = (offset << 16) + shift; -+ } else { -+ int offset = 1 << 5; -+ int shift = 6; -+- *s->y_mvs[i]++ = (offset << 16) + shift; -++ *s->y_mvs[job][i]++ = (offset << 16) + shift; -+ } -+- *s->y_mvs[i]++ = 0; // Next kernel -++ *s->y_mvs[job][i]++ = 0; // Next kernel -+ } -+ #endif -+ } -+ -+- -+ #ifdef RPI_SIMULATE_QPUS -+ -+ static int32_t clipx(int x,int FRAME_WIDTH) -+@@ -3271,10 +3462,15 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ static void rpi_execute_inter_qpu(HEVCContext *s) -+ { -+ int k; -++#ifdef LAUNCH_PASS0 -++ int job = s->pass0_job; -++#else -++ int job = s->pass1_job; -++#endif -+ int i; -+- uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr.vc; -++ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; -+ #ifdef RPI_LUMA_QPU -+- uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr.vc; -++ uint32_t *y_unif_vc = (uint32_t *)s->y_unif_mvs_ptr[job].vc; -+ #endif -+ if (s->sh.slice_type == I_SLICE) { -+ #ifdef RPI_MULTI_MAILBOX -+@@ -3283,22 +3479,22 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ #endif -+ } -+ for(k=0;k<8;k++) { -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+- s->u_mvs[k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -+- av_assert0(s->u_mvs[k] - s->mvs_base[k] < UV_COMMANDS_PER_QPU); -++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->u_mvs[job][k][-RPI_CHROMA_COMMAND_WORDS+4] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for V -++ av_assert0(s->u_mvs[job][k] - s->mvs_base[job][k] < UV_COMMANDS_PER_QPU); -+ } -+ -+- s->u_mvs[8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ s->u_mvs[job][8-1][-RPI_CHROMA_COMMAND_WORDS] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT8); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ -+ #ifdef RPI_LUMA_QPU -+ for(k=0;k<12;k++) { -+- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -+- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -+- s->y_mvs[k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -+- av_assert0(s->y_mvs[k] - s->y_mvs_base[k] < Y_COMMANDS_PER_QPU); -++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+1] = qpu_get_fn(QPU_MC_SETUP_UV); // A dummy texture location (maps to our code) - this is needed as the texture requests are pipelined -++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+3] = qpu_get_fn(QPU_MC_SETUP_UV); // Also need a dummy for second request -++ s->y_mvs[job][k][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_EXIT); // Add exit command -++ av_assert0(s->y_mvs[job][k] - s->y_mvs_base[job][k] < Y_COMMANDS_PER_QPU); -+ } -+- s->y_mvs[12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -++ s->y_mvs[job][12-1][-RPI_LUMA_COMMAND_WORDS+8] = qpu_get_fn(QPU_MC_INTERRUPT_EXIT12); // This QPU will signal interrupt when all others are done and have acquired a semaphore -+ #endif -+ -+ #ifdef RPI_SIMULATE_QPUS -+@@ -3308,34 +3504,34 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+- gpu_cache_flush3(&s->coeffs_buf_accelerated,&s->y_unif_mvs_ptr, &s->unif_mvs_ptr); -++ gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -+ #else -+- gpu_cache_flush(&s->coeffs_buf_accelerated); -++ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ #endif -+- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0, -++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ #ifdef RPI_LUMA_QPU -+ qpu_get_fn(QPU_MC_SETUP), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[0 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[1 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[2 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[3 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[4 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[5 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[6 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[7 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[8 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[9 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[10 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)), -+- (uint32_t)(y_unif_vc+(s->y_mvs_base[11 ] - (uint32_t*)s->y_unif_mvs_ptr.arm)) -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][0 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][1 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][2 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][3 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][4 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][5 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][6 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][7 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][8 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][9 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][10 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)), -++ (uint32_t)(y_unif_vc+(s->y_mvs_base[job][11 ] - (uint32_t*)s->y_unif_mvs_ptr[job].arm)) -+ #else -+ 0, -+ 0,0,0,0, -+@@ -3344,17 +3540,17 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ #endif -+ ); -+ for(i=0;i<4;i++) -+- s->num_coeffs[i] = 0; -++ s->num_coeffs[job][i] = 0; -+ #else -+ qpu_run_shader8(qpu_get_fn(QPU_MC_SETUP_UV), -+- (uint32_t)(unif_vc+(s->mvs_base[0 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[1 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[2 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[3 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[4 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[5 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[6 ] - (uint32_t*)s->unif_mvs_ptr.arm)), -+- (uint32_t)(unif_vc+(s->mvs_base[7 ] - (uint32_t*)s->unif_mvs_ptr.arm)) -++ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][2 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][3 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][4 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][5 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][6 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -++ (uint32_t)(unif_vc+(s->mvs_base[job][7 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)) -+ ); -+ #endif -+ -+@@ -3411,6 +3607,11 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ } -+ -++#ifdef RPI_WORKER -++ s->pass0_job = 0; -++ s->pass1_job = 0; -++ s->pass2_job = 0; -++#endif -+ #ifdef RPI_INTER_QPU -+ rpi_inter_clear(s); -+ #endif -+@@ -3431,46 +3632,42 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -++ -+ #ifdef RPI -+ if (s->enable_rpi) { -+- s->dblk_cmds[s->num_dblk_cmds][0] = x_ctb; -+- s->dblk_cmds[s->num_dblk_cmds++][1] = y_ctb; -++ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; -++ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; -+ if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -+- // Transform all blocks -+- // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+-#ifdef RPI_MULTI_MAILBOX -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+- // Perform luma inter prediction -+- rpi_execute_inter_cmds(s); -+-#else -+- rpi_execute_transform(s); -+- // Perform inter prediction -+- rpi_execute_inter_cmds(s); -+-#ifdef RPI_INTER_QPU -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+-#endif -+-#endif -+- -+- // Wait for transform completion -+- vpu_wait(s->vpu_id); -+- -+- // Copy back reconstructed data -+- //memcpy(s->frame->data[0],s->dummy.arm,2048*64); -+- //memcpy(s->frame->data[1],s->dummy.arm,1024*32); -+- //memcpy(s->frame->data[2],s->dummy.arm,1024*32); -++#ifdef RPI_WORKER -++ if (s->used_for_ref) { -++ // Split work load onto separate threads so we make as rapid progress as possible with this frame -++ #ifdef INTER_PASS0 -++ rpi_execute_inter_cmds(s); -++ #endif -++ #ifdef LAUNCH_PASS0 -++ rpi_execute_inter_qpu(s); -++ #endif -++ // Pass on this job to worker thread -++ worker_submit_job(s); -++ // Make sure we have space to prepare the next job -++ worker_pass0_ready(s); -+ -+- // Perform intra prediction and residual reconstruction -+- rpi_execute_pred_cmds(s); -+- // Perform deblocking for CTBs in this row -+- rpi_execute_dblk_cmds(s); -++ // Prepare the next batch of commands -+ #ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -++ rpi_inter_clear(s); -++#endif -++ } else { -++ // Non-ref frame so do it all on this thread -++ rpi_do_all_passes(s); -++ } -++#else -++ rpi_do_all_passes(s); -+ #endif -+ } -+ } -+ #endif -++ -++ -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = -1; -+ return more_data; -+@@ -3487,18 +3684,21 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ } -+ -+ #ifdef RPI -+- if (s->enable_rpi && s->num_dblk_cmds) { -+-#ifdef RPI_INTER_QPU -+- rpi_execute_inter_qpu(s); -+-#endif -+-#ifndef RPI_MULTI_MAILBOX -+- rpi_execute_transform(s); -++ -++#ifdef RPI_WORKER -++ // Wait for the worker to finish all its jobs -++ if (s->enable_rpi) { -++ worker_wait(s); -++ av_assert0(s->pass0_job==s->pass1_job); -++ av_assert0(s->pass1_job==s->pass2_job); -++ } -+ #endif -+- rpi_execute_inter_cmds(s); -+- vpu_wait(s->vpu_id); -+- rpi_execute_pred_cmds(s); -+- rpi_execute_dblk_cmds(s); -++ -++ // Finish off any half-completed rows -++ if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { -++ rpi_do_all_passes(s); -+ } -++ -+ #endif -+ -+ if (x_ctb + ctb_size >= s->ps.sps->width && -+@@ -4230,6 +4430,48 @@ fail: -+ return AVERROR(ENOMEM); -+ } -+ -++#ifdef RPI_WORKER -++static av_cold void hevc_init_worker(HEVCContext *s) -++{ -++ int err; -++ pthread_cond_init(&s->worker_cond_head, NULL); -++ pthread_cond_init(&s->worker_cond_middle, NULL); -++ pthread_cond_init(&s->worker_cond_tail, NULL); -++ pthread_mutex_init(&s->worker_mutex, NULL); -++ -++ s->worker_tail=0; -++ s->worker_middle=0; -++ s->worker_head=0; -++ s->kill_worker=0; -++ err = pthread_create(&s->worker_thread, NULL, worker_start, s); -++ err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); -++ if (err) { -++ printf("Failed to create worker thread\n"); -++ exit(-1); -++ } -++} -++ -++static av_cold void hevc_exit_worker(HEVCContext *s) -++{ -++ void *res; -++ s->kill_worker=1; -++ pthread_cond_broadcast(&s->worker_cond_tail); -++ pthread_cond_broadcast(&s->worker_cond_middle); -++ pthread_join(s->worker_thread, &res); -++ pthread_join(s->worker_deblock_thread, &res); -++ -++ pthread_cond_destroy(&s->worker_cond_head); -++ pthread_cond_destroy(&s->worker_cond_middle); -++ pthread_cond_destroy(&s->worker_cond_tail); -++ pthread_mutex_destroy(&s->worker_mutex); -++ -++ s->worker_tail=0; -++ s->worker_middle=0; -++ s->worker_head=0; -++ s->kill_worker=0; -++} -++#endif -++ -+ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ { -+ HEVCContext *s = avctx->priv_data; -+@@ -4242,33 +4484,29 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) -+ av_freep(&s->cabac_state); -+ -+ #ifdef RPI -+- av_freep(&s->unif_mv_cmds); -+- av_freep(&s->univ_pred_cmds); -++ -++#ifdef RPI_WORKER -++ hevc_exit_worker(s); -++#endif -++ -++ for(i=0;iunif_mv_cmds[i]); -++ av_freep(&s->univ_pred_cmds[i]); -+ -+ #ifdef RPI_INTER_QPU -+- if (s->unif_mvs) { -+- gpu_free( &s->unif_mvs_ptr ); -+- s->unif_mvs = 0; -+- } -++ if (s->unif_mvs[i]) { -++ gpu_free( &s->unif_mvs_ptr[i] ); -++ s->unif_mvs[i] = 0; -++ } -+ #endif -+ #ifdef RPI_LUMA_QPU -+- if (s->y_unif_mvs) { -+- gpu_free( &s->y_unif_mvs_ptr ); -+- s->y_unif_mvs = 0; -+- } -++ if (s->y_unif_mvs[i]) { -++ gpu_free( &s->y_unif_mvs_ptr[i] ); -++ s->y_unif_mvs[i] = 0; -++ } -+ #endif -+- -+-#ifdef EARLY_MALLOC -+- printf("hevc_decode_free\n"); -+- if (s->coeffs_buf_arm[0]) { -+- gpu_free(&s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = 0; -+- } -+- if (s->coeffs_buf_arm[2]) { -+- gpu_free(&s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = 0; -+ } -+-#endif -++ -+ #endif -+ -+ for (i = 0; i < 3; i++) { -+@@ -4328,6 +4566,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+ HEVCContext *s = avctx->priv_data; -+ int i; -++ int job; -+ -+ s->avctx = avctx; -+ -+@@ -4338,12 +4577,14 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ s->sList[0] = s; -+ -+ #ifdef RPI -+- s->unif_mv_cmds = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -+- if (!s->unif_mv_cmds) -+- goto fail; -+- s->univ_pred_cmds = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -+- if (!s->univ_pred_cmds) -+- goto fail; -++ for(job=0;jobunif_mv_cmds[job] = av_mallocz(sizeof(HEVCMvCmd)*RPI_MAX_MV_CMDS); -++ if (!s->unif_mv_cmds[job]) -++ goto fail; -++ s->univ_pred_cmds[job] = av_mallocz(sizeof(HEVCPredCmd)*RPI_MAX_PRED_CMDS); -++ if (!s->univ_pred_cmds[job]) -++ goto fail; -++ } -+ -+ #ifdef RPI_INTER_QPU -+ // We divide the image into blocks 256 wide and 64 high -+@@ -4354,18 +4595,20 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ { -+ int uv_commands_per_qpu = UV_COMMANDS_PER_QPU; -+ uint32_t *p; -++ for(job=0;jobunif_mvs_ptr ); -++ gpu_malloc_cached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); -+ #else -+- gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr ); -++ gpu_malloc_uncached( 8 * uv_commands_per_qpu * sizeof(uint32_t), &s->unif_mvs_ptr[job] ); -+ #endif -+- s->unif_mvs = (uint32_t *) s->unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ s->unif_mvs[job] = (uint32_t *) s->unif_mvs_ptr[job].arm; -+ -+- // Set up initial locations for uniform streams -+- p = s->unif_mvs; -+- for(i = 0; i < 8; i++) { -+- s->mvs_base[i] = p; -++ // Set up initial locations for uniform streams -++ p = s->unif_mvs[job]; -++ for(i = 0; i < 8; i++) { -++ s->mvs_base[job][i] = p; -+ p += uv_commands_per_qpu; -++ } -+ } -+ s->mc_filter_uv = qpu_get_fn(QPU_MC_FILTER_UV); -+ s->mc_filter_uv_b0 = qpu_get_fn(QPU_MC_FILTER_UV_B0); -+@@ -4374,61 +4617,35 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) -+ } -+ #endif -+ #ifdef RPI_LUMA_QPU -++ for(job=0;joby_unif_mvs_ptr ); -++ gpu_malloc_cached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); -+ #else -+- gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr ); -++ gpu_malloc_uncached( 12 * y_commands_per_qpu * sizeof(uint32_t), &s->y_unif_mvs_ptr[job] ); -+ #endif -+- s->y_unif_mvs = (uint32_t *) s->y_unif_mvs_ptr.arm; // TODO support this allocation in non EARLY_MALLOC -++ s->y_unif_mvs[job] = (uint32_t *) s->y_unif_mvs_ptr[job].arm; -+ -+ // Set up initial locations for uniform streams -+- p = s->y_unif_mvs; -++ p = s->y_unif_mvs[job]; -+ for(i = 0; i < 12; i++) { -+- s->y_mvs_base[i] = p; -++ s->y_mvs_base[job][i] = p; -+ p += y_commands_per_qpu; -+ } -+- s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -+- s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -+- -+ } -++ s->mc_filter = qpu_get_fn(QPU_MC_FILTER); -++ s->mc_filter_b = qpu_get_fn(QPU_MC_FILTER_B); -+ #endif -+ //gpu_malloc_uncached(2048*64,&s->dummy); -+ -+-#ifdef EARLY_MALLOC -+- { -+- int coeffs_in_ctb = 64*64; -+- int coefs_per_row = (2048/64) * coeffs_in_ctb * 3; // Allow space for chroma -+- s->coeffs_buf_arm[0] = 0; -+- s->coeffs_buf_arm[2] = 0; -+- printf("Allocated %d\n",coefs_per_row); -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row, &s->coeffs_buf_default); -+- s->coeffs_buf_arm[0] = (int16_t*) s->coeffs_buf_default.arm; -+- if (!s->coeffs_buf_arm[0]) -+- goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated); -+- s->coeffs_buf_arm[2] = (int16_t*) s->coeffs_buf_accelerated.arm; -+- s->coeffs_buf_vc[2] = s->coeffs_buf_accelerated.vc; -+- if (!s->coeffs_buf_arm[2]) -+- goto fail; -+- s->coeffs_buf_arm[3] = coefs_per_row + s->coeffs_buf_arm[2]; -+- s->coeffs_buf_vc[3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[2]; -+- printf("Done\n"); -+-#ifdef RPI_PRECLEAR -+- //memset(s->coeffs_buf_arm[0],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[0], coefs_per_row); -+- //memset(s->coeffs_buf_arm[2],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[2], coefs_per_row); -+- //memset(s->coeffs_buf_arm[3],0, sizeof(int16_t) * coefs_per_row); -+- memclear16(s->coeffs_buf_arm[3], coefs_per_row); -+-#endif -+- } -+-#endif -+- -+ s->enable_rpi = 0; -+ -++#ifdef RPI_WORKER -++ hevc_init_worker(s); -++#endif -++ -+ #endif -+ -+ s->cabac_state = av_malloc(HEVC_CONTEXTS); -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 5cb90b5..7bd295a 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -51,6 +51,12 @@ -+ // Define RPI_LUMA_QPU to also use QPU for luma inter prediction -+ #define RPI_LUMA_QPU -+ #endif -++ -++ // By passing jobs to a worker thread we hope to be able to catch up during slow frames -++ #define RPI_MAX_JOBS 2 -++ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -++ #define RPI_WORKER -++ -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -806,6 +812,13 @@ typedef struct HEVCLocalContext { -+ int boundary_flags; -+ } HEVCLocalContext; -+ -++#ifdef RPI_WORKER -++typedef struct HEVCLocalContextIntra { -++ TransformUnit tu; -++ NeighbourAvailable na; -++} HEVCLocalContextIntra; -++#endif -++ -+ #ifdef RPI -+ -+ // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+@@ -874,7 +887,7 @@ typedef struct HEVCPredCmd { -+ -+ typedef struct HEVCContext { -+ #ifdef RPI -+- int dblk_cmds[RPI_MAX_DEBLOCK_CMDS][2]; -++ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -+ #endif -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+@@ -883,7 +896,9 @@ typedef struct HEVCContext { -+ -+ HEVCLocalContext *HEVClcList[MAX_NB_THREADS]; -+ HEVCLocalContext *HEVClc; -+- -++#ifdef RPI_WORKER -++ HEVCLocalContextIntra HEVClcIntra; -++#endif -+ uint8_t threads_type; -+ uint8_t threads_number; -+ -+@@ -894,43 +909,60 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI -+ int enable_rpi; -+- HEVCMvCmd *unif_mv_cmds; -+- HEVCPredCmd *univ_pred_cmds; -++ HEVCMvCmd *unif_mv_cmds[RPI_MAX_JOBS]; -++ HEVCPredCmd *univ_pred_cmds[RPI_MAX_JOBS]; -+ int buf_width; -+- GPU_MEM_PTR_T coeffs_buf_default; -+- GPU_MEM_PTR_T coeffs_buf_accelerated; -+- int16_t *coeffs_buf_arm[4]; -+- unsigned int coeffs_buf_vc[4]; -+- int num_coeffs[4]; -+- int num_xfm_cmds; -+- int num_mv_cmds; -+- int num_pred_cmds; -+- int num_dblk_cmds; -++ GPU_MEM_PTR_T coeffs_buf_default[RPI_MAX_JOBS]; -++ GPU_MEM_PTR_T coeffs_buf_accelerated[RPI_MAX_JOBS]; -++ int16_t *coeffs_buf_arm[RPI_MAX_JOBS][4]; -++ unsigned int coeffs_buf_vc[RPI_MAX_JOBS][4]; -++ int num_coeffs[RPI_MAX_JOBS][4]; -++ int num_xfm_cmds[RPI_MAX_JOBS]; -++ int num_mv_cmds[RPI_MAX_JOBS]; -++ int num_pred_cmds[RPI_MAX_JOBS]; -++ int num_dblk_cmds[RPI_MAX_JOBS]; -+ int vpu_id; -+ //GPU_MEM_PTR_T dummy; -++ int pass0_job; // Pass0 does coefficient decode -++ int pass1_job; // Pass1 does pixel processing -++ int pass2_job; // Pass2 does reconstruction and deblocking -+ #ifdef RPI_INTER_QPU -+- GPU_MEM_PTR_T unif_mvs_ptr; -+- uint32_t *unif_mvs; // Base of memory for motion vector commands -++ GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; -++ uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+ -+ // _base pointers are to the start of the row -+- uint32_t *mvs_base[8]; -++ uint32_t *mvs_base[RPI_MAX_JOBS][8]; -+ // these pointers are to the next free space -+- uint32_t *u_mvs[8]; -++ uint32_t *u_mvs[RPI_MAX_JOBS][8]; -+ // Function pointers -+ uint32_t mc_filter_uv; -+ uint32_t mc_filter_uv_b0; -+ uint32_t mc_filter_uv_b; -+ #endif -+ #ifdef RPI_LUMA_QPU -+- GPU_MEM_PTR_T y_unif_mvs_ptr; -+- uint32_t *y_unif_mvs; // Base of memory for motion vector commands -+- uint32_t *y_mvs_base[12]; -+- uint32_t *y_mvs[12]; -++ GPU_MEM_PTR_T y_unif_mvs_ptr[RPI_MAX_JOBS]; -++ uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -++ uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; -++ uint32_t *y_mvs[RPI_MAX_JOBS][12]; -+ // Function pointers -+ uint32_t mc_filter; -+ uint32_t mc_filter_b; -+ #endif -+ -++#ifdef RPI_WORKER -++ pthread_t worker_thread; -++ pthread_t worker_deblock_thread; -++ pthread_cond_t worker_cond_head; -++ pthread_cond_t worker_cond_tail; -++ pthread_cond_t worker_cond_middle; -++ pthread_mutex_t worker_mutex; -++ -++ int worker_tail; // Contains the number of posted jobs -++ int worker_head; // Contains the number of completed jobs -++ int worker_middle; // Contains the number of completed jobs -++ int kill_worker; // set to 1 to terminate the worker -++#endif -++ -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 38f53de..f0982cd 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1051,11 +1051,11 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+ if (use_vpu) { -+- coeffs = s->coeffs_buf_arm[log2_trafo_size - 2] + s->num_coeffs[log2_trafo_size - 2]; -+- s->num_coeffs[log2_trafo_size - 2] += n; -++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -++ s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; -+ } else { -+- coeffs = s->coeffs_buf_arm[0] + s->num_coeffs[0]; -+- s->num_coeffs[0] += n; -++ coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; -++ s->num_coeffs[s->pass0_job][0] += n; -+ } -+ } -+ // We now do the memset after transform_add while we know the data is cached. -+@@ -1508,7 +1508,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); -+ } -+ } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { -+- s->hevcdsp.idct_4x4_luma(coeffs); -++ s->hevcdsp.idct_4x4_luma(coeffs); -+ } else { -+ #ifdef RPI -+ if (!use_vpu) { -+@@ -1553,7 +1553,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ #ifdef RPI -+ if (s->enable_rpi) { -+- HEVCPredCmd *cmd = s->univ_pred_cmds + s->num_pred_cmds++; -++ HEVCPredCmd *cmd = s->univ_pred_cmds[s->pass0_job] + s->num_pred_cmds[s->pass0_job]++; -+ cmd->type = RPI_PRED_TRANSFORM_ADD; -+ cmd->size = log2_trafo_size; -+ cmd->buf = coeffs; -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 71c6d52..344e021 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -71,8 +71,11 @@ do { \ -+ AV_WN4P(&ptr[i], a); \ -+ else \ -+ a = PIXEL_SPLAT_X4(ptr[i + 3]) -+- -++#ifdef RPI_WORKER -++ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -++#else -+ HEVCLocalContext *lc = s->HEVClc; -++#endif -+ int i; -+ int hshift = s->ps.sps->hshift[c_idx]; -+ int vshift = s->ps.sps->vshift[c_idx]; -+-- -+2.7.4 -+ -+ -+From 1e0885f8d98175777fff65b4cedd708176c2abcf Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 13:43:48 +0100 -+Subject: [PATCH 54/68] Avoid lockup bug with RPI_WORKER enabled -+ -+--- -+ libavcodec/hevc.c | 22 +++++++++++----------- -+ libavcodec/hevc_cabac.c | 1 - -+ 2 files changed, 11 insertions(+), 12 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 12aacc5..182a82f 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -133,11 +133,11 @@ static uint32_t get_vc_address(AVBufferRef *bref) { -+ static void worker_submit_job(HEVCContext *s) -+ { -+ LOG_ENTER -+- //pthread_mutex_lock(&s->worker_mutex); -+- s->worker_tail++; // This is the only place that can change tail so we do not need the mutex -++ pthread_mutex_lock(&s->worker_mutex); -++ s->worker_tail++; -+ s->pass0_job = (s->pass0_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_tail); // Let people know that the tail has moved -+- //pthread_mutex_unlock(&s->worker_mutex); -++ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+ } -+ -+@@ -145,11 +145,11 @@ static void worker_submit_job(HEVCContext *s) -+ static void worker_complete_middle_job(HEVCContext *s) -+ { -+ LOG_ENTER -+- //pthread_mutex_lock(&s->worker_mutex); -+- s->worker_middle++; // This is the only place that can change head so we do not need the mutex -++ pthread_mutex_lock(&s->worker_mutex); -++ s->worker_middle++; -+ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the tail has moved -+- //pthread_mutex_unlock(&s->worker_mutex); -++ pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved -++ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+ } -+ -+@@ -157,11 +157,11 @@ static void worker_complete_middle_job(HEVCContext *s) -+ static void worker_complete_job(HEVCContext *s) -+ { -+ LOG_ENTER -+- //pthread_mutex_lock(&s->worker_mutex); -+- s->worker_head++; // This is the only place that can change head so we do not need the mutex -++ pthread_mutex_lock(&s->worker_mutex); -++ s->worker_head++; -+ s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+- pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the tail has moved -+- //pthread_mutex_unlock(&s->worker_mutex); -++ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved -++ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+ } -+ -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index f0982cd..6523e66 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1497,7 +1497,6 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ for (i = 0; i < 8; i++) -+ FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); -+ } -+- -+ s->hevcdsp.transform_skip(coeffs, log2_trafo_size); -+ -+ if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && -+-- -+2.7.4 -+ -+ -+From 1d7ad81069dec6914ec7e9983855d7a1b5e4b123 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 15:37:19 +0100 -+Subject: [PATCH 55/68] Added code to flush buffers at start of frame -+ -+--- -+ libavcodec/hevc.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -+ 1 file changed, 72 insertions(+) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 182a82f..e5b9f1e 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -43,6 +43,7 @@ -+ -+ #ifdef RPI -+ #include "rpi_qpu.h" -++ #include "rpi_user_vcsm.h" -+ // Move Inter prediction into separate pass -+ #define RPI_INTER -+ -+@@ -3508,6 +3509,7 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ #else -+ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ #endif -++ -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+@@ -3558,6 +3560,71 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ } -+ #endif -+ -++#ifdef RPI -++ -++static void flush_buffer(AVBufferRef *bref) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -++ gpu_cache_flush(p); -++} -++ -++static void flush_frame(HEVCContext *s,AVFrame *frame) -++{ -++#if 1 -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int n = s->ps.sps->height; -++ int curr_y = 0; -++ int curr_uv = 0; -++ int n_uv = n >> s->ps.sps->vshift[1]; -++ int sz,base; -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = p->arm + base; -++ iocache.s[1].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = p->arm + base; -++ iocache.s[2].size = sz; -++ vcsm_clean_invalid( &iocache ); -++#else -++ flush_buffer(frame->buf[0]); -++ flush_buffer(frame->buf[1]); -++ flush_buffer(frame->buf[2]); -++#endif -++} -++ -++static void flush_all(HEVCContext *s) -++{ -++#if 0 -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 4; // Flush all -++ iocache.s[0].addr = p->arm; -++ iocache.s[0].size = 4096; -++ vcsm_clean_invalid( &iocache ); -++#else -++ int i,k; -++ for(i=0;i<2;i++) { -++ for (k = 0; k < s->sh.nb_refs[i]; k++) { -++ flush_frame(s,s->ref->refPicList[i].ref[k]->frame); -++ } -++ } -++ flush_frame(s,s->frame); -++#endif -++} -++#endif -++ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ { -+ HEVCContext *s = avctxt->priv_data; -+@@ -3592,8 +3659,12 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ printf("Weighted B slice\n"); -+ } -+ -++ // Now flush all reference frames and our destination frame to get everything ready for decode -++ flush_all(s); -+ #endif -+ -++ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -++ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+ return AVERROR_INVALIDDATA; -+@@ -3664,6 +3735,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ rpi_do_all_passes(s); -+ #endif -+ } -++ -+ } -+ #endif -+ -+-- -+2.7.4 -+ -+ -+From 7a57f233dcd4048e20a0b5bc06bc20abb589d3fa Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 3 Jun 2015 16:42:24 +0100 -+Subject: [PATCH 56/68] Reduce the amount that needs to be flushed -+ -+--- -+ libavcodec/hevc.c | 35 +++++++++++------------------------ -+ 1 file changed, 11 insertions(+), 24 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index e5b9f1e..73d7f74 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3569,7 +3569,7 @@ static void flush_buffer(AVBufferRef *bref) { -+ -+ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+-#if 1 -++#ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+@@ -3603,26 +3603,6 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ #endif -+ } -+ -+-static void flush_all(HEVCContext *s) -+-{ -+-#if 0 -+- struct vcsm_user_clean_invalid_s iocache = {}; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[0]); -+- iocache.s[0].handle = p->vcsm_handle; -+- iocache.s[0].cmd = 4; // Flush all -+- iocache.s[0].addr = p->arm; -+- iocache.s[0].size = 4096; -+- vcsm_clean_invalid( &iocache ); -+-#else -+- int i,k; -+- for(i=0;i<2;i++) { -+- for (k = 0; k < s->sh.nb_refs[i]; k++) { -+- flush_frame(s,s->ref->refPicList[i].ref[k]->frame); -+- } -+- } -+- flush_frame(s,s->frame); -+-#endif -+-} -+ #endif -+ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+@@ -3658,9 +3638,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+ } -+- -+- // Now flush all reference frames and our destination frame to get everything ready for decode -+- flush_all(s); -+ #endif -+ -+ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -+@@ -4130,6 +4107,11 @@ static int hevc_frame_start(HEVCContext *s) -+ if (!s->avctx->hwaccel) -+ ff_thread_finish_setup(s->avctx); -+ -++#ifdef RPI_INTER_QPU -++ // Invalidate the output data buffer so it is ready for the QPUs to write into it. -++ flush_frame(s,s->frame); -++#endif -++ -+ return 0; -+ -+ fail: -+@@ -4331,6 +4313,11 @@ fail: -+ ff_hevc_flush_buffer(s, &s->ref->tf, s->ps.sps->height); -+ #endif -+ ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); -++ } else if (s->ref) { -++#ifdef RPI_INTER_QPU -++ // When running single threaded we need to flush the whole frame -++ flush_frame(s,s->frame); -++#endif -+ } -+ return ret; -+ } -+-- -+2.7.4 -+ -+ -+From 26eba8e3266cc5f2120e8284a1ce486d6a402010 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 4 Jun 2015 07:59:28 +0100 -+Subject: [PATCH 57/68] Corrected support for disabled rpi when using -+ RPI_WORKER -+ -+--- -+ libavcodec/hevc.h | 18 ++++++++++-------- -+ libavcodec/hevcpred_template.c | 2 +- -+ 2 files changed, 11 insertions(+), 9 deletions(-) -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 7bd295a..3cb34bd 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -769,7 +769,17 @@ typedef struct HEVCFrame { -+ uint8_t flags; -+ } HEVCFrame; -+ -++#ifdef RPI_WORKER -++typedef struct HEVCLocalContextIntra { -++ TransformUnit tu; -++ NeighbourAvailable na; -++} HEVCLocalContextIntra; -++#endif -++ -+ typedef struct HEVCLocalContext { -++ TransformUnit tu; -++ NeighbourAvailable na; // WARNING tu and na must be the first two fields to match HEVCLocalContextIntra -++ -+ uint8_t cabac_state[HEVC_CONTEXTS]; -+ -+ uint8_t stat_coeff[4]; -+@@ -784,7 +794,6 @@ typedef struct HEVCLocalContext { -+ -+ int qPy_pred; -+ -+- TransformUnit tu; -+ -+ uint8_t ctb_left_flag; -+ uint8_t ctb_up_flag; -+@@ -801,7 +810,6 @@ typedef struct HEVCLocalContext { -+ int ct_depth; -+ CodingUnit cu; -+ PredictionUnit pu; -+- NeighbourAvailable na; -+ -+ #define BOUNDARY_LEFT_SLICE (1 << 0) -+ #define BOUNDARY_LEFT_TILE (1 << 1) -+@@ -812,12 +820,6 @@ typedef struct HEVCLocalContext { -+ int boundary_flags; -+ } HEVCLocalContext; -+ -+-#ifdef RPI_WORKER -+-typedef struct HEVCLocalContextIntra { -+- TransformUnit tu; -+- NeighbourAvailable na; -+-} HEVCLocalContextIntra; -+-#endif -+ -+ #ifdef RPI -+ -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 344e021..325b60e 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -72,7 +72,7 @@ do { \ -+ else \ -+ a = PIXEL_SPLAT_X4(ptr[i + 3]) -+ #ifdef RPI_WORKER -+- HEVCLocalContextIntra *lc = &s->HEVClcIntra; -++ HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -+ #else -+ HEVCLocalContext *lc = s->HEVClc; -+ #endif -+-- -+2.7.4 -+ -+ -+From 5b3eee9be88a5326df7621de95095def969e05a8 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 4 Jun 2015 11:52:55 +0100 -+Subject: [PATCH 58/68] Draft support for tiles -+ -+--- -+ libavcodec/hevc.c | 140 +++++++++++++++++++++++------------------ -+ libavcodec/hevc.h | 21 +++++-- -+ libavcodec/hevc_filter.c | 2 +- -+ libavcodec/hevcpred_template.c | 2 +- -+ 4 files changed, 99 insertions(+), 66 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 73d7f74..ec67252 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -63,10 +63,10 @@ -+ -+ static void rpi_execute_dblk_cmds(HEVCContext *s); -+ static void rpi_execute_transform(HEVCContext *s); -+- static void rpi_execute_inter_qpu(HEVCContext *s); -++ static void rpi_launch_vpu_qpu(HEVCContext *s); -+ static void rpi_execute_pred_cmds(HEVCContext *s); -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+- static void rpi_inter_clear(HEVCContext *s); -++ static void rpi_begin(HEVCContext *s); -+ -+ // Define INTER_PASS0 to do inter prediction in first pass -+ //#define INTER_PASS0 -+@@ -90,16 +90,18 @@ const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12 -+ -+ #ifdef RPI_INTER_QPU -+ -++// Each luma QPU processes 2*RPI_NUM_CHUNKS 64x64 blocks -++// Each chroma QPU processes 3*RPI_NUM_CHUNKS 64x64 blocks, but requires two commands for B blocks -++// For each block of 64*64 the smallest block size is 8x4 -++// We also need an extra command for the setup information -++ -+ #define RPI_CHROMA_COMMAND_WORDS 12 -+-#define UV_COMMANDS_PER_QPU ((1 + (256*64*2)/(4*4)) * RPI_CHROMA_COMMAND_WORDS) -++#define UV_COMMANDS_PER_QPU ((1 + 3*RPI_NUM_CHUNKS*(64*64)*2/(8*4)) * RPI_CHROMA_COMMAND_WORDS) -+ // The QPU code for UV blocks only works up to a block width of 8 -+ #define RPI_CHROMA_BLOCK_WIDTH 8 -+ -+-// Split image of 2048 into parts 64 wide -+-// So some QPUs will have 3 blocks of 64 to do, and others 2 blocks for an image 2048 wide with 32 blocks across -+-// For each block of 64*64 the smallest block size is 8x4 -+ #define RPI_LUMA_COMMAND_WORDS 9 -+-#define Y_COMMANDS_PER_QPU ((1+3*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -++#define Y_COMMANDS_PER_QPU ((1+2*RPI_NUM_CHUNKS*(64*64)/(8*4)) * RPI_LUMA_COMMAND_WORDS) -+ -+ #define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+@@ -216,7 +218,7 @@ static void *worker_start(void *arg) -+ LOG_ENTER -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+ #ifndef LAUNCH_PASS0 -+- rpi_execute_inter_qpu(s); -++ rpi_launch_vpu_qpu(s); -+ #endif -+ #ifndef INTER_PASS0 -+ // Perform inter prediction -+@@ -322,9 +324,14 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ -+ #ifdef RPI -+ av_assert0(sps); -+- int coeffs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+- int coefs_per_row = sps->ctb_width * coeffs_in_ctb * 3; // Allow space for chroma -++ int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -++ int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; -++ int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; -++ int coefs_per_row = coefs_per_luma + coefs_per_chroma; -+ int job; -++ s->max_ctu_count = coefs_per_luma / coefs_in_ctb; -++ s->ctu_per_y_chan = s->max_ctu_count / 12; -++ s->ctu_per_uv_chan = s->max_ctu_count / 8; -+ for(job=0;jobx >> 2); -+ int y1 = y0 + (mv->y >> 2); -+- int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -++ uint32_t *y = s->curr_y_mvs; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2209,7 +2215,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[s->pass0_job][chan % 12] = y; -++ s->curr_y_mvs = y; -+ } else -+ #endif -+ { -+@@ -2233,12 +2239,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+- int chan = x0>>8; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -++ uint32_t *u = s->curr_u_mvs; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2262,7 +2266,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[s->pass0_job][chan & 7] = u; -++ s->curr_u_mvs = u; -+ return; -+ } -+ #endif -+@@ -2289,10 +2293,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int my2_mx2_my_mx = (my_mx << 16) + my_mx; -+ int x1 = x0 + (mv->x >> 2); -+ int y1 = y0 + (mv->y >> 2); -+- int chan = x0>>6; // 64 wide blocks per QPU -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -++ uint32_t *y = s->curr_y_mvs; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=16) { -+ int bw = nPbW-start_x; -+@@ -2312,7 +2315,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+- s->y_mvs[s->pass0_job][chan % 12] = y; -++ s->curr_y_mvs = y; -+ } else -+ #endif -+ -+@@ -2337,12 +2340,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ -+ int x1_c = x0_c + (mv->x >> (2 + hshift)); -+ int y1_c = y0_c + (mv->y >> (2 + hshift)); -+- //int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+- int chan = x0>>8; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+ (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); -+ -+- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -++ uint32_t *u = s->curr_u_mvs; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2367,7 +2368,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[s->pass0_job][chan & 7] = u; -++ s->curr_u_mvs = u; -+ return; -+ } -+ #endif -+@@ -2400,8 +2401,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int y1 = y0 + (mv->y >> 2); -+ int x2 = x0 + (mv2->x >> 2); -+ int y2 = y0 + (mv2->y >> 2); -+- int chan = x0>>6; // 64 wide blocks per QPU -+- uint32_t *y = s->y_mvs[s->pass0_job][chan % 12]; -++ uint32_t *y = s->curr_y_mvs; -+ for(int start_y=0;start_y < nPbH;start_y+=16) { // Potentially we could change the assembly code to support taller sizes in one go -+ for(int start_x=0;start_x < nPbW;start_x+=8) { // B blocks work 8 at a time -+ int bw = nPbW-start_x; -+@@ -2417,7 +2417,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+- s->y_mvs[s->pass0_job][chan % 12] = y; -++ s->curr_y_mvs = y; -+ } else -+ #endif -+ { -+@@ -2448,9 +2448,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int x2_c = x0_c + (mv2->x >> (2 + hshift)); -+ int y2_c = y0_c + (mv2->y >> (2 + hshift)); -+ -+- int chan = x0>>8; // Allocate commands for the first 256 luma pixels across to the first QPU. This is optimised for images around 1920 width -+ -+- uint32_t *u = s->u_mvs[s->pass0_job][chan & 7]; -++ uint32_t *u = s->curr_u_mvs; -+ for(int start_y=0;start_y < nPbH_c;start_y+=16) { -+ for(int start_x=0;start_x < nPbW_c;start_x+=RPI_CHROMA_BLOCK_WIDTH) { -+ int bw = nPbW_c-start_x; -+@@ -2479,7 +2478,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+- s->u_mvs[s->pass0_job][chan & 7] = u; -++ s->curr_u_mvs = u; -+ return; -+ } -+ #endif -+@@ -3114,12 +3113,8 @@ static void rpi_execute_inter_cmds(HEVCContext *s) -+ -+ static void rpi_do_all_passes(HEVCContext *s) -+ { -+-#ifdef RPI_INTER_QPU -+- // Kick off inter prediction on QPUs -+- rpi_execute_inter_qpu(s); -+-#else -+- rpi_execute_transform(s); -+-#endif -++ // Kick off QPUs and VPUs -++ rpi_launch_vpu_qpu(s); -+ // Perform luma inter prediction -+ rpi_execute_inter_cmds(s); -+ // Wait for transform completion -+@@ -3128,18 +3123,18 @@ static void rpi_do_all_passes(HEVCContext *s) -+ rpi_execute_pred_cmds(s); -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+-#ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -+-#endif -++ // Prepare next batch -++ rpi_begin(s); -+ } -+ -+ #endif -+ -+-#ifdef RPI_INTER_QPU -+-static void rpi_inter_clear(HEVCContext *s) -++#ifdef RPI -++static void rpi_begin(HEVCContext *s) -+ { -+ int job = s->pass0_job; -+ int i; -++#ifdef RPI_INTER_QPU -+ int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; -+ int weight_flag = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || -+@@ -3165,6 +3160,8 @@ static void rpi_inter_clear(HEVCContext *s) -+ } -+ *s->u_mvs[job][i]++ = i; // Select section of VPM (avoid collisions with 3d unit) -+ } -++ s->curr_u_mvs = s->u_mvs[job][0]; -++#endif -+ -+ #ifdef RPI_LUMA_QPU -+ for(i=0;i<12;i++) { -+@@ -3187,8 +3184,11 @@ static void rpi_inter_clear(HEVCContext *s) -+ } -+ *s->y_mvs[job][i]++ = 0; // Next kernel -+ } -++ s->curr_y_mvs = s->y_mvs[job][0]; -+ #endif -++ s->ctu_count = 0; -+ } -++#endif -+ -+ #ifdef RPI_SIMULATE_QPUS -+ -+@@ -3459,8 +3459,9 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ -+ #endif -+ -++#ifdef RPI_INTER_QPU -+ -+-static void rpi_execute_inter_qpu(HEVCContext *s) -++static void rpi_launch_vpu_qpu(HEVCContext *s) -+ { -+ int k; -+ #ifdef LAUNCH_PASS0 -+@@ -3558,6 +3559,15 @@ static void rpi_execute_inter_qpu(HEVCContext *s) -+ -+ -+ } -++#else -++ -++#ifdef RPI -++static void rpi_launch_vpu_qpu(HEVCContext *s) -++{ -++ rpi_execute_transform(s); -++} -++#endif -++ -+ #endif -+ -+ #ifdef RPI -+@@ -3617,29 +3627,20 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI -+ #ifdef RPI_INTER_QPU -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+- && s->ps.sps->width <= RPI_MAX_WIDTH -+ && !s->ps.pps->cross_component_prediction_enabled_flag -+- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1 -+ && !(s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE); -+ #else -+ s->enable_rpi = s->ps.sps->bit_depth == 8 -+- && s->ps.sps->width <= RPI_MAX_WIDTH -+- && !s->ps.pps->cross_component_prediction_enabled_flag -+- && s->ps.pps->num_tile_rows <= 1 && s->ps.pps->num_tile_columns <= 1; -++ && !s->ps.pps->cross_component_prediction_enabled_flag; -+ #endif -+ -+ if (!s->enable_rpi) { -+ if (s->ps.pps->cross_component_prediction_enabled_flag) -+ printf("Cross component\n"); -+- if (s->ps.pps->num_tile_rows > 1 || s->ps.pps->num_tile_columns > 1) -+- printf("Tiles\n"); -+- if (s->ps.pps->weighted_pred_flag && s->sh.slice_type == P_SLICE) -+- printf("Weighted P slice\n"); -+ if (s->ps.pps->weighted_bipred_flag && s->sh.slice_type == B_SLICE) -+ printf("Weighted B slice\n"); -+ } -+ #endif -+- -+ //printf("L0=%d L1=%d\n",s->sh.nb_refs[L1],s->sh.nb_refs[L1]); -+ -+ if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) { -+@@ -3660,8 +3661,8 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->pass1_job = 0; -+ s->pass2_job = 0; -+ #endif -+-#ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -++#ifdef RPI -++ rpi_begin(s); -+ #endif -+ -+ while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) { -+@@ -3679,13 +3680,34 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -++#ifdef RPI_INTER_QPU -++ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; -++#endif -++#ifdef RPI_LUMA_QPU -++ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; -++#endif -++ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ -++#ifdef RPI_INTER_QPU -++ s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; -++#endif -++#ifdef RPI_LUMA_QPU -++ s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; -++#endif -++ -+ #ifdef RPI -+ if (s->enable_rpi) { -++ //av_assert0(s->num_dblk_cmds[s->pass0_job]>=0); -++ //av_assert0(s->num_dblk_cmds[s->pass0_job]pass0_jobpass0_job>=0); -+ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]][0] = x_ctb; -+ s->dblk_cmds[s->pass0_job][s->num_dblk_cmds[s->pass0_job]++][1] = y_ctb; -+- if ( (((y_ctb + ctb_size)&63) == 0) && x_ctb + ctb_size >= s->ps.sps->width) { -++ s->ctu_count++; -++ //printf("%d %d/%d job=%d\n",s->ctu_count,s->num_dblk_cmds[s->pass0_job],RPI_MAX_DEBLOCK_CMDS,s->pass0_job); -++ -++ if ( s->ctu_count >= s->max_ctu_count ) { -+ #ifdef RPI_WORKER -+ if (s->used_for_ref) { -+ // Split work load onto separate threads so we make as rapid progress as possible with this frame -+@@ -3693,7 +3715,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ rpi_execute_inter_cmds(s); -+ #endif -+ #ifdef LAUNCH_PASS0 -+- rpi_execute_inter_qpu(s); -++ rpi_launch_vpu_qpu(s); -+ #endif -+ // Pass on this job to worker thread -+ worker_submit_job(s); -+@@ -3701,9 +3723,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ worker_pass0_ready(s); -+ -+ // Prepare the next batch of commands -+-#ifdef RPI_INTER_QPU -+- rpi_inter_clear(s); -+-#endif -++ rpi_begin(s); -+ } else { -+ // Non-ref frame so do it all on this thread -+ rpi_do_all_passes(s); -+@@ -3744,7 +3764,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #endif -+ -+ // Finish off any half-completed rows -+- if (s->enable_rpi && s->num_dblk_cmds[s->pass0_job]) { -++ if (s->enable_rpi && s->ctu_count) { -+ rpi_do_all_passes(s); -+ } -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 3cb34bd..a141316 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -823,8 +823,15 @@ typedef struct HEVCLocalContext { -+ -+ #ifdef RPI -+ -++// The processing is done in chunks -++// Each chunk corresponds to 24 64x64 luma blocks (24 so it is divisible by 8 for chroma and 12 for luma) -++// This is a distance of 1536 pixels across the screen -++// Increasing RPI_NUM_CHUNKS will reduce time spent activating QPUs and cache flushing, -++// but allocate more memory and increase the latency before data in the next frame can be processed -++#define RPI_NUM_CHUNKS 1 -++ -+ // RPI_MAX_WIDTH is maximum width in pixels supported by the accelerated code -+-#define RPI_MAX_WIDTH 2048 -++#define RPI_MAX_WIDTH (RPI_NUM_CHUNKS*64*24) -+ -+ // Worst case is for 4:4:4 4x4 blocks with 64 high coding tree blocks, so 16 MV cmds per 4 pixels across for each colour plane, * 2 for bi -+ #define RPI_MAX_MV_CMDS (2*16*3*(RPI_MAX_WIDTH/4)) -+@@ -888,9 +895,6 @@ typedef struct HEVCPredCmd { -+ #endif -+ -+ typedef struct HEVCContext { -+-#ifdef RPI -+- int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -+-#endif -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+ -+@@ -928,6 +932,10 @@ typedef struct HEVCContext { -+ int pass0_job; // Pass0 does coefficient decode -+ int pass1_job; // Pass1 does pixel processing -+ int pass2_job; // Pass2 does reconstruction and deblocking -++ int ctu_count; // Number of CTUs done in pass0 so far -++ int max_ctu_count; // Number of CTUs when we trigger a round of processing -++ int ctu_per_y_chan; // Number of CTUs per luma QPU -++ int ctu_per_uv_chan; // Number of CTUs per chroma QPU -+ #ifdef RPI_INTER_QPU -+ GPU_MEM_PTR_T unif_mvs_ptr[RPI_MAX_JOBS]; -+ uint32_t *unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+@@ -936,6 +944,7 @@ typedef struct HEVCContext { -+ uint32_t *mvs_base[RPI_MAX_JOBS][8]; -+ // these pointers are to the next free space -+ uint32_t *u_mvs[RPI_MAX_JOBS][8]; -++ uint32_t *curr_u_mvs; // Current uniform stream to use for chroma -+ // Function pointers -+ uint32_t mc_filter_uv; -+ uint32_t mc_filter_uv_b0; -+@@ -946,6 +955,7 @@ typedef struct HEVCContext { -+ uint32_t *y_unif_mvs[RPI_MAX_JOBS]; // Base of memory for motion vector commands -+ uint32_t *y_mvs_base[RPI_MAX_JOBS][12]; -+ uint32_t *y_mvs[RPI_MAX_JOBS][12]; -++ uint32_t *curr_y_mvs; // Current uniform stream for luma -+ // Function pointers -+ uint32_t mc_filter; -+ uint32_t mc_filter_b; -+@@ -1084,6 +1094,9 @@ typedef struct HEVCContext { -+ uint32_t max_mastering_luminance; -+ uint32_t min_mastering_luminance; -+ -++#ifdef RPI -++ int dblk_cmds[RPI_MAX_JOBS][RPI_MAX_DEBLOCK_CMDS][2]; -++#endif -+ } HEVCContext; -+ -+ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index b286bbf..1f04790 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -891,7 +891,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+ if (curr_uv < 0) curr_uv = 0; -+- if (n_uv<=curr_uv) { assert(0); return; } // Should not happen -++ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -+diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c -+index 325b60e..28d2653 100644 -+--- a/libavcodec/hevcpred_template.c -++++ b/libavcodec/hevcpred_template.c -+@@ -72,7 +72,7 @@ do { \ -+ else \ -+ a = PIXEL_SPLAT_X4(ptr[i + 3]) -+ #ifdef RPI_WORKER -+- HEVCLocalContextIntra *lc = s->enable_rpi ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -++ HEVCLocalContextIntra *lc = (s->enable_rpi) ? &s->HEVClcIntra : (HEVCLocalContextIntra *)s->HEVClc ; -+ #else -+ HEVCLocalContext *lc = s->HEVClc; -+ #endif -+-- -+2.7.4 -+ -+ -+From 1674a80d147e5342ef6ea9a4fb4ddfc640c15a05 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 4 Jun 2015 15:48:10 +0100 -+Subject: [PATCH 59/68] Move deblocker into second pass -+ -+--- -+ libavcodec/hevc.c | 79 +++++++++++++++++++++++++++++++++++++++++++++---------- -+ 1 file changed, 65 insertions(+), 14 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ec67252..6cecbdd 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -67,6 +67,8 @@ -+ static void rpi_execute_pred_cmds(HEVCContext *s); -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+ static void rpi_begin(HEVCContext *s); -++ static void flush_frame(HEVCContext *s,AVFrame *frame); -++ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -+ // Define INTER_PASS0 to do inter prediction in first pass -+ //#define INTER_PASS0 -+@@ -227,6 +229,11 @@ static void *worker_start(void *arg) -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -++ // Perform intra prediction and residual reconstruction -++ rpi_execute_pred_cmds(s); -++ // Perform deblocking for CTBs in this row -++ rpi_execute_dblk_cmds(s); -++ -+ worker_complete_middle_job(s); -+ LOG_EXIT -+ } -+@@ -248,10 +255,6 @@ static void *worker_deblock_start(void *arg) -+ break; -+ } -+ LOG_ENTER -+- // Perform intra prediction and residual reconstruction -+- rpi_execute_pred_cmds(s); -+- // Perform deblocking for CTBs in this row -+- rpi_execute_dblk_cmds(s); -+ -+ worker_complete_job(s); -+ LOG_EXIT -+@@ -2983,7 +2986,7 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, -+ static void rpi_execute_dblk_cmds(HEVCContext *s) -+ { -+ int n; -+- int job = s->pass2_job; -++ int job = s->pass1_job; -+ int ctb_size = 1 << s->ps.sps->log2_ctb_size; -+ int (*p)[2] = s->dblk_cmds[job]; -+ for(n = s->num_dblk_cmds[job]; n>0 ;n--,p++) { -+@@ -3021,7 +3024,7 @@ static void rpi_execute_transform(HEVCContext *s) -+ static void rpi_execute_pred_cmds(HEVCContext *s) -+ { -+ int i; -+- int job = s->pass2_job; -++ int job = s->pass1_job; -+ HEVCPredCmd *cmd = s->univ_pred_cmds[job]; -+ #ifdef RPI_WORKER -+ HEVCLocalContextIntra *lc = &s->HEVClcIntra; -+@@ -3506,11 +3509,10 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+- gpu_cache_flush3(&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -+ #else -+- gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); -+ #endif -+- -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+@@ -3613,6 +3615,60 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ #endif -+ } -+ -++static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -++{ -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int n = s->ps.sps->height; -++ int curr_y = 0; -++ int curr_uv = 0; -++ int n_uv = n >> s->ps.sps->vshift[1]; -++ int sz,base; -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = p->arm + base; -++ iocache.s[1].size = sz; -++ p = av_buffer_pool_opaque(frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = p->arm + base; -++ iocache.s[2].size = sz; -++ -++ iocache.s[3].handle = p0->vcsm_handle; -++ iocache.s[3].cmd = 3; // clean+invalidate -++ iocache.s[3].addr = (int) p0->arm; -++ iocache.s[3].size = p0->numbytes; -++ if (p1) { -++ iocache.s[4].handle = p1->vcsm_handle; -++ iocache.s[4].cmd = 3; // clean+invalidate -++ iocache.s[4].addr = (int) p1->arm; -++ iocache.s[4].size = p1->numbytes; -++ } -++ if (p2) { -++ iocache.s[5].handle = p2->vcsm_handle; -++ iocache.s[5].cmd = 3; // clean+invalidate -++ iocache.s[5].addr = (int) p2->arm; -++ iocache.s[5].size = p2->numbytes; -++ } -++ vcsm_clean_invalid( &iocache ); -++#else -++ flush_buffer(frame->buf[0]); -++ flush_buffer(frame->buf[1]); -++ flush_buffer(frame->buf[2]); -++ gpu_cache_flush3(p0, p1, p2); -++#endif -++} -++ -+ #endif -+ -+ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+@@ -4127,11 +4183,6 @@ static int hevc_frame_start(HEVCContext *s) -+ if (!s->avctx->hwaccel) -+ ff_thread_finish_setup(s->avctx); -+ -+-#ifdef RPI_INTER_QPU -+- // Invalidate the output data buffer so it is ready for the QPUs to write into it. -+- flush_frame(s,s->frame); -+-#endif -+- -+ return 0; -+ -+ fail: -+-- -+2.7.4 -+ -+ -+From a453fe438c4ab311d6476955d0a40a5d2ed8a1c6 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Thu, 4 Jun 2015 16:10:23 +0100 -+Subject: [PATCH 60/68] Change order of ctu accesses to improve qpu performance -+ -+--- -+ libavcodec/hevc.c | 8 ++++---- -+ 1 file changed, 4 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 6cecbdd..ec17e64 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -3737,19 +3737,19 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ #ifdef RPI_INTER_QPU -+- s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan]; -++ s->curr_u_mvs = s->u_mvs[s->pass0_job][s->ctu_count % 8]; -+ #endif -+ #ifdef RPI_LUMA_QPU -+- s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan]; -++ s->curr_y_mvs = s->y_mvs[s->pass0_job][s->ctu_count % 12]; -+ #endif -+ -+ more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); -+ -+ #ifdef RPI_INTER_QPU -+- s->u_mvs[s->pass0_job][s->ctu_count / s->ctu_per_uv_chan] = s->curr_u_mvs; -++ s->u_mvs[s->pass0_job][s->ctu_count % 8]= s->curr_u_mvs; -+ #endif -+ #ifdef RPI_LUMA_QPU -+- s->y_mvs[s->pass0_job][s->ctu_count / s->ctu_per_y_chan] = s->curr_y_mvs; -++ s->y_mvs[s->pass0_job][s->ctu_count % 12] = s->curr_y_mvs; -+ #endif -+ -+ #ifdef RPI -+-- -+2.7.4 -+ -+ -+From 504de0435e8f660c1b7b2d6ec053dc922a2d2896 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 8 Jun 2015 09:36:59 +0100 -+Subject: [PATCH 61/68] Removed deblocker thread -+ -+--- -+ libavcodec/hevc.c | 77 +++---------------------------------------------------- -+ libavcodec/hevc.h | 4 --- -+ 2 files changed, 4 insertions(+), 77 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index ec17e64..1868532 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -70,11 +70,6 @@ -+ static void flush_frame(HEVCContext *s,AVFrame *frame); -+ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -+- // Define INTER_PASS0 to do inter prediction in first pass -+- //#define INTER_PASS0 -+- // Define LAUNCH_PASS0 to launch QPU/VPU from pass0 -+- //#define LAUNCH_PASS0 -+- -+ #endif -+ -+ // #define DISABLE_MC -+@@ -147,24 +142,12 @@ static void worker_submit_job(HEVCContext *s) -+ } -+ -+ // Call this to say we have completed pass1 -+-static void worker_complete_middle_job(HEVCContext *s) -+-{ -+- LOG_ENTER -+- pthread_mutex_lock(&s->worker_mutex); -+- s->worker_middle++; -+- s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+- pthread_cond_broadcast(&s->worker_cond_middle); // Let people know that the middle has moved -+- pthread_mutex_unlock(&s->worker_mutex); -+- LOG_EXIT -+-} -+- -+-// Call this to say we have completed pass2 -+ static void worker_complete_job(HEVCContext *s) -+ { -+ LOG_ENTER -+ pthread_mutex_lock(&s->worker_mutex); -+ s->worker_head++; -+- s->pass2_job = (s->pass2_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -++ s->pass1_job = (s->pass1_job + 1) % RPI_MAX_JOBS; // Move onto the next slot -+ pthread_cond_broadcast(&s->worker_cond_head); // Let people know that the head has moved -+ pthread_mutex_unlock(&s->worker_mutex); -+ LOG_EXIT -+@@ -208,7 +191,7 @@ static void *worker_start(void *arg) -+ while(1) { -+ pthread_mutex_lock(&s->worker_mutex); -+ -+- while( !s->kill_worker && s->worker_tail - s->worker_middle <= 0) -++ while( !s->kill_worker && s->worker_tail - s->worker_head <= 0) -+ { -+ pthread_cond_wait(&s->worker_cond_tail, &s->worker_mutex); -+ } -+@@ -219,13 +202,9 @@ static void *worker_start(void *arg) -+ } -+ LOG_ENTER -+ // printf("%d %d %d : %d %d %d %d\n",s->poc, x_ctb, y_ctb, s->num_pred_cmds,s->num_mv_cmds,s->num_coeffs[2] >> 8,s->num_coeffs[3] >> 10); -+-#ifndef LAUNCH_PASS0 -+ rpi_launch_vpu_qpu(s); -+-#endif -+-#ifndef INTER_PASS0 -+ // Perform inter prediction -+ rpi_execute_inter_cmds(s); -+-#endif -+ // Wait for transform completion -+ vpu_wait(s->vpu_id); -+ -+@@ -234,28 +213,6 @@ static void *worker_start(void *arg) -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s); -+ -+- worker_complete_middle_job(s); -+- LOG_EXIT -+- } -+- return NULL; -+-} -+- -+-static void *worker_deblock_start(void *arg) -+-{ -+- HEVCContext *s = (HEVCContext *)arg; -+- while(1) { -+- pthread_mutex_lock(&s->worker_mutex); -+- while( !s->kill_worker && s->worker_middle - s->worker_head <= 0) -+- { -+- pthread_cond_wait(&s->worker_cond_middle, &s->worker_mutex); -+- } -+- pthread_mutex_unlock(&s->worker_mutex); -+- -+- if (s->kill_worker) { -+- break; -+- } -+- LOG_ENTER -+- -+ worker_complete_job(s); -+ LOG_EXIT -+ } -+@@ -2998,11 +2955,7 @@ static void rpi_execute_dblk_cmds(HEVCContext *s) -+ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -+-#ifdef LAUNCH_PASS0 -+- int job = s->pass0_job; -+-#else -+ int job = s->pass1_job; -+-#endif -+ //int j; -+ //int16_t *coeffs = s->coeffs_buf_arm[i]; -+ //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+@@ -3057,11 +3010,7 @@ static void rpi_execute_pred_cmds(HEVCContext *s) -+ -+ static void rpi_execute_inter_cmds(HEVCContext *s) -+ { -+-#ifdef INTER_PASS0 -+- int job = s->pass0_job; -+-#else -+ int job = s->pass1_job; -+-#endif -+ HEVCMvCmd *cmd = s->unif_mv_cmds[job]; -+ int n,cidx; -+ AVFrame myref; -+@@ -3467,11 +3416,7 @@ static void rpi_simulate_inter_qpu(HEVCContext *s) -+ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ { -+ int k; -+-#ifdef LAUNCH_PASS0 -+- int job = s->pass0_job; -+-#else -+ int job = s->pass1_job; -+-#endif -+ int i; -+ uint32_t *unif_vc = (uint32_t *)s->unif_mvs_ptr[job].vc; -+ #ifdef RPI_LUMA_QPU -+@@ -3574,10 +3519,12 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ -+ #ifdef RPI -+ -++#ifndef RPI_FAST_CACHEFLUSH -+ static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+ } -++#endif -+ -+ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+@@ -3715,7 +3662,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI_WORKER -+ s->pass0_job = 0; -+ s->pass1_job = 0; -+- s->pass2_job = 0; -+ #endif -+ #ifdef RPI -+ rpi_begin(s); -+@@ -3767,12 +3713,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ #ifdef RPI_WORKER -+ if (s->used_for_ref) { -+ // Split work load onto separate threads so we make as rapid progress as possible with this frame -+- #ifdef INTER_PASS0 -+- rpi_execute_inter_cmds(s); -+- #endif -+- #ifdef LAUNCH_PASS0 -+- rpi_launch_vpu_qpu(s); -+- #endif -+ // Pass on this job to worker thread -+ worker_submit_job(s); -+ // Make sure we have space to prepare the next job -+@@ -3814,8 +3754,6 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+ // Wait for the worker to finish all its jobs -+ if (s->enable_rpi) { -+ worker_wait(s); -+- av_assert0(s->pass0_job==s->pass1_job); -+- av_assert0(s->pass1_job==s->pass2_job); -+ } -+ #endif -+ -+@@ -4565,16 +4503,13 @@ static av_cold void hevc_init_worker(HEVCContext *s) -+ { -+ int err; -+ pthread_cond_init(&s->worker_cond_head, NULL); -+- pthread_cond_init(&s->worker_cond_middle, NULL); -+ pthread_cond_init(&s->worker_cond_tail, NULL); -+ pthread_mutex_init(&s->worker_mutex, NULL); -+ -+ s->worker_tail=0; -+- s->worker_middle=0; -+ s->worker_head=0; -+ s->kill_worker=0; -+ err = pthread_create(&s->worker_thread, NULL, worker_start, s); -+- err = pthread_create(&s->worker_deblock_thread, NULL, worker_deblock_start, s); -+ if (err) { -+ printf("Failed to create worker thread\n"); -+ exit(-1); -+@@ -4586,17 +4521,13 @@ static av_cold void hevc_exit_worker(HEVCContext *s) -+ void *res; -+ s->kill_worker=1; -+ pthread_cond_broadcast(&s->worker_cond_tail); -+- pthread_cond_broadcast(&s->worker_cond_middle); -+ pthread_join(s->worker_thread, &res); -+- pthread_join(s->worker_deblock_thread, &res); -+ -+ pthread_cond_destroy(&s->worker_cond_head); -+- pthread_cond_destroy(&s->worker_cond_middle); -+ pthread_cond_destroy(&s->worker_cond_tail); -+ pthread_mutex_destroy(&s->worker_mutex); -+ -+ s->worker_tail=0; -+- s->worker_middle=0; -+ s->worker_head=0; -+ s->kill_worker=0; -+ } -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index a141316..ef5bfb1 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -931,7 +931,6 @@ typedef struct HEVCContext { -+ //GPU_MEM_PTR_T dummy; -+ int pass0_job; // Pass0 does coefficient decode -+ int pass1_job; // Pass1 does pixel processing -+- int pass2_job; // Pass2 does reconstruction and deblocking -+ int ctu_count; // Number of CTUs done in pass0 so far -+ int max_ctu_count; // Number of CTUs when we trigger a round of processing -+ int ctu_per_y_chan; // Number of CTUs per luma QPU -+@@ -963,15 +962,12 @@ typedef struct HEVCContext { -+ -+ #ifdef RPI_WORKER -+ pthread_t worker_thread; -+- pthread_t worker_deblock_thread; -+ pthread_cond_t worker_cond_head; -+ pthread_cond_t worker_cond_tail; -+- pthread_cond_t worker_cond_middle; -+ pthread_mutex_t worker_mutex; -+ -+ int worker_tail; // Contains the number of posted jobs -+ int worker_head; // Contains the number of completed jobs -+- int worker_middle; // Contains the number of completed jobs -+ int kill_worker; // set to 1 to terminate the worker -+ #endif -+ -+-- -+2.7.4 -+ -+ -+From 74892301cdb0829de959b798debac6ffe1c71603 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 8 Jun 2015 11:04:43 +0100 -+Subject: [PATCH 62/68] Reduced amount of output frame that is invalidated -+ -+--- -+ libavcodec/hevc.c | 45 +++++++++++++++++++++++++++++---------------- -+ 1 file changed, 29 insertions(+), 16 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 1868532..cbb4f46 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -68,7 +68,7 @@ -+ static void rpi_execute_inter_cmds(HEVCContext *s); -+ static void rpi_begin(HEVCContext *s); -+ static void flush_frame(HEVCContext *s,AVFrame *frame); -+- static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -++ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job); -+ -+ #endif -+ -+@@ -3454,9 +3454,9 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ -+ #ifdef RPI_MULTI_MAILBOX -+ #ifdef RPI_CACHE_UNIF_MVS -+- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job]); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],&s->y_unif_mvs_ptr[job], &s->unif_mvs_ptr[job], job); -+ #else -+- flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL); -++ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); -+ #endif -+ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+@@ -3530,6 +3530,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+ int curr_uv = 0; -+@@ -3537,22 +3538,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ int sz,base; -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm + base; -++ iocache.s[0].addr = (int)(p->arm) + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = p->arm + base; -++ iocache.s[1].addr = (int)(p->arm) + base; -+ iocache.s[1].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = p->arm + base; -++ iocache.s[2].addr = (int)(p->arm) + base; -+ iocache.s[2].size = sz; -+ vcsm_clean_invalid( &iocache ); -+ #else -+@@ -3562,33 +3562,46 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ #endif -+ } -+ -+-static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2) -++static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2, int job) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+- int n = s->ps.sps->height; -+- int curr_y = 0; -+- int curr_uv = 0; -+- int n_uv = n >> s->ps.sps->vshift[1]; -++ int n; -++ int curr_y; -++ int curr_uv; -++ int n_uv; -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ int sz,base; -++ int (*d)[2] = s->dblk_cmds[job]; -++ int low=(*d)[1]; -++ int high=(*d)[1]; -++ for(n = s->num_dblk_cmds[job]; n>0 ;n--,d++) { -++ int y = (*d)[1]; -++ low=FFMIN(low,y); -++ high=FFMAX(high,y); -++ } -++ curr_y = low; -++ n = high+(1 << s->ps.sps->log2_ctb_size); -++ curr_uv = curr_y >> s->ps.sps->vshift[1]; -++ n_uv = n >> s->ps.sps->vshift[1]; -++ -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm + base; -++ iocache.s[0].addr = (int)(p->arm) + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = p->arm + base; -++ iocache.s[1].addr = (int)(p->arm) + base; -+ iocache.s[1].size = sz; -+ p = av_buffer_pool_opaque(frame->buf[0]); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = p->arm + base; -++ iocache.s[2].addr = (int)(p->arm) + base; -+ iocache.s[2].size = sz; -+ -+ iocache.s[3].handle = p0->vcsm_handle; -+-- -+2.7.4 -+ -+ -+From 090b6be5b501bd3c547700926e540397f0b39e69 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Mon, 8 Jun 2015 11:55:29 +0100 -+Subject: [PATCH 63/68] Packed 16x16 and 32x32 into the same buffer -+ -+--- -+ libavcodec/hevc.c | 24 +++++++++++++++--------- -+ libavcodec/hevc_cabac.c | 9 ++++++++- -+ libavcodec/rpi_qpu.c | 2 +- -+ 3 files changed, 24 insertions(+), 11 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index cbb4f46..a596534 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -299,12 +299,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ s->coeffs_buf_arm[job][0] = (int16_t*) s->coeffs_buf_default[job].arm; -+ if (!s->coeffs_buf_arm[job][0]) -+ goto fail; -+- gpu_malloc_cached(sizeof(int16_t) * coefs_per_row * 2, &s->coeffs_buf_accelerated[job]); -++ gpu_malloc_cached(sizeof(int16_t) * (coefs_per_row + 32*32), &s->coeffs_buf_accelerated[job]); // We prefetch past the end so provide an extra blocks worth of data -+ s->coeffs_buf_arm[job][2] = (int16_t*) s->coeffs_buf_accelerated[job].arm; -+ s->coeffs_buf_vc[job][2] = s->coeffs_buf_accelerated[job].vc; -+ if (!s->coeffs_buf_arm[job][2]) -+ goto fail; -+- s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; -++ s->coeffs_buf_arm[job][3] = coefs_per_row + s->coeffs_buf_arm[job][2]; // This points to just beyond the end of the buffer. Coefficients fill in backwards. -+ s->coeffs_buf_vc[job][3] = sizeof(int16_t) * coefs_per_row + s->coeffs_buf_vc[job][2]; -+ } -+ } -+@@ -2956,15 +2956,20 @@ static void rpi_execute_transform(HEVCContext *s) -+ { -+ int i=2; -+ int job = s->pass1_job; -+- //int j; -+- //int16_t *coeffs = s->coeffs_buf_arm[i]; -+- //for(j=s->num_coeffs[i]; j > 0; j-= 16*16, coeffs+=16*16) { -+- // s->hevcdsp.idct[4-2](coeffs, 16); -+- //} -++ /*int j; -++ int16_t *coeffs = s->coeffs_buf_arm[job][i]; -++ for(j=s->num_coeffs[job][i]; j > 0; j-= 16*16, coeffs+=16*16) { -++ s->hevcdsp.idct[4-2](coeffs, 16); -++ } -++ i=3; -++ coeffs = s->coeffs_buf_arm[job][i] - s->num_coeffs[job][i]; -++ for(j=s->num_coeffs[job][i]; j > 0; j-= 32*32, coeffs+=32*32) { -++ s->hevcdsp.idct[5-2](coeffs, 32); -++ }*/ -+ -+ gpu_cache_flush(&s->coeffs_buf_accelerated[job]); -+ s->vpu_id = vpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], -+- s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], -++ s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], -+ s->num_coeffs[job][3] >> 10, 0, &s->coeffs_buf_accelerated[job]); -+ //vpu_execute_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[2], s->num_coeffs[2] >> 8, s->coeffs_buf_vc[3], s->num_coeffs[3] >> 10, 0); -+ //gpu_cache_flush(&s->coeffs_buf_accelerated); -+@@ -3458,7 +3463,8 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ #else -+ flush_frame3(s, s->frame,&s->coeffs_buf_accelerated[job],NULL,NULL, job); -+ #endif -+- s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, s->coeffs_buf_vc[job][3], s->num_coeffs[job][3] >> 10, 0, -++ s->vpu_id = vpu_qpu_post_code( vpu_get_fn(), vpu_get_constants(), s->coeffs_buf_vc[job][2], s->num_coeffs[job][2] >> 8, -++ s->coeffs_buf_vc[job][3] - sizeof(int16_t) * s->num_coeffs[job][3], s->num_coeffs[job][3] >> 10, 0, -+ qpu_get_fn(QPU_MC_SETUP_UV), -+ (uint32_t)(unif_vc+(s->mvs_base[job][0 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+ (uint32_t)(unif_vc+(s->mvs_base[job][1 ] - (uint32_t*)s->unif_mvs_ptr[job].arm)), -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 6523e66..8656917 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -1051,7 +1051,14 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+ if (use_vpu) { -+- coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -++ // We support size 4 and size 5. -++ // Size 4 grows from the front (Coeffs_buf_arm[2] points to start of buf) -++ // Size 5 grows from the back (Coeffs_buf_arm[3] points to end of buf) -++ // num_coeffs is indexed by log2_trafo_size-2 -++ if (log2_trafo_size == 4) -++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] + s->num_coeffs[s->pass0_job][log2_trafo_size - 2]; -++ else -++ coeffs = s->coeffs_buf_arm[s->pass0_job][log2_trafo_size - 2] - s->num_coeffs[s->pass0_job][log2_trafo_size - 2] - n; -+ s->num_coeffs[s->pass0_job][log2_trafo_size - 2] += n; -+ } else { -+ coeffs = s->coeffs_buf_arm[s->pass0_job][0] + s->num_coeffs[s->pass0_job][0]; -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 4480f72..0121fca 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -5,7 +5,7 @@ -+ // define RPI_TIME_TOTAL_VPU to print out how much time is spent in the VPI code -+ //#define RPI_TIME_TOTAL_VPU -+ // define RPI_TIME_TOTAL_POSTED to print out how much time is spent in the multi execute QPU/VPU combined -+-//#define RPI_TIME_TOTAL_POSTED -++#define RPI_TIME_TOTAL_POSTED -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -+ -+-- -+2.7.4 -+ -+ -+From ed359bbce56817bf9db0e54701103bd0505c353b Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Thu, 25 Jun 2015 09:02:47 +0100 -+Subject: [PATCH 64/68] Moved luma deblock to VPU -+ -+--- -+ libavcodec/hevc.c | 18 +- -+ libavcodec/hevc.h | 11 + -+ libavcodec/hevc_filter.c | 120 ++- -+ libavcodec/rpi_hevc_transform.h | 1802 ++++++++++++++++++++++++++++++++++++++- -+ libavcodec/rpi_hevc_transform.s | 426 +++++++++ -+ libavcodec/rpi_qpu.c | 12 +- -+ libavcodec/rpi_shader.c | 2 +- -+ 7 files changed, 2378 insertions(+), 13 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index a596534..4ce94a7 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -246,6 +246,12 @@ static void pic_arrays_free(HEVCContext *s) -+ } -+ } -+ #endif -++#ifdef RPI_DEBLOCK_VPU -++ if (s->y_setup_arm) { -++ gpu_free(&s->y_setup_ptr); -++ s->y_setup_arm = 0; -++ } -++#endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+@@ -283,12 +289,12 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ int min_pu_size = sps->min_pu_width * sps->min_pu_height; -+ -+ #ifdef RPI -+- av_assert0(sps); -+ int coefs_in_ctb = (1 << sps->log2_ctb_size) * (1 << sps->log2_ctb_size); -+ int coefs_per_luma = 64*64*24*RPI_NUM_CHUNKS; -+ int coefs_per_chroma = (coefs_per_luma * 2) >> sps->vshift[1] >> sps->hshift[1]; -+ int coefs_per_row = coefs_per_luma + coefs_per_chroma; -+ int job; -++ av_assert0(sps); -+ s->max_ctu_count = coefs_per_luma / coefs_in_ctb; -+ s->ctu_per_y_chan = s->max_ctu_count / 12; -+ s->ctu_per_uv_chan = s->max_ctu_count / 8; -+@@ -309,6 +315,16 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ } -+ } -+ #endif -++#ifdef RPI_DEBLOCK_VPU -++ s->enable_rpi_deblock = !sps->sao_enabled; -++ s->setup_width = (sps->width+15) / 16; -++ s->setup_height = (sps->height+15) / 16; -++ gpu_malloc_uncached(sizeof(*s->y_setup_arm) * s->setup_width * s->setup_height, &s->y_setup_ptr); // TODO make this cached -++ s->y_setup_arm = (void*)s->y_setup_ptr.arm; -++ s->y_setup_vc = (void*)s->y_setup_ptr.vc; -++ memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); -++ printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); -++#endif -+ -+ s->bs_width = (width >> 2) + 1; -+ s->bs_height = (height >> 2) + 1; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index ef5bfb1..cf08489 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -57,6 +57,8 @@ -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+ -++ #define RPI_DEBLOCK_VPU -++ -+ #endif -+ -+ #define MAX_DPB_SIZE 16 // A.4.1 -+@@ -971,6 +973,15 @@ typedef struct HEVCContext { -+ int kill_worker; // set to 1 to terminate the worker -+ #endif -+ -++#ifdef RPI_DEBLOCK_VPU -++ int enable_rpi_deblock; -++ GPU_MEM_PTR_T y_setup_ptr; -++ uint8_t (*y_setup_arm)[2][2][2][4]; -++ uint8_t (*y_setup_vc)[2][2][2][4]; -++ int setup_width; // Number of 16x16 blocks across the image -++ int setup_height; // Number of 16x16 blocks down the image -++#endif -++ -+ #endif -+ -+ uint8_t *cabac_state; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 1f04790..06371da 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -564,6 +564,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int num16 = (y>>4)*s->setup_width + (x>>4); -++ int a = ((y>>3) & 1) << 1; -++ int b = (x>>3) & 1; -++ setup = s->y_setup_arm[num16]; -++ setup[0][b][0][a] = beta; -++ setup[0][b][0][a + 1] = beta; -++ setup[0][b][1][a] = tc[0]; -++ setup[0][b][1][a + 1] = tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_v_loop_filter_luma(src, -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+@@ -596,6 +609,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int num16 = (y>>4)*s->setup_width + (x>>4); -++ int a = ((x>>3) & 1) << 1; -++ int b = (y>>3) & 1; -++ setup = s->y_setup_arm[num16]; -++ setup[1][b][0][a] = beta; -++ setup[1][b][0][a + 1] = beta; -++ setup[1][b][1][a] = tc[0]; -++ setup[1][b][1][a + 1] = tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_h_loop_filter_luma(src, -+ s->frame->linesize[LUMA], -+ beta, tc, no_p, no_q); -+@@ -876,33 +902,85 @@ static void flush_buffer(AVBufferRef *bref) { -+ } -+ -+ // Return Physical address for this image -+-static int ff_hevc_buf_base(AVBufferRef *bref) { -++static uint32_t get_vc_address(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return p->vc & 0x3fffffff; -++ return p->vc; -+ } -+ -++// ff_hevc_flush_buffer_lines -++// flushes and invalidates all pixel rows in [start,end-1] -++static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) -++{ -++#ifdef RPI_FAST_CACHEFLUSH -++ struct vcsm_user_clean_invalid_s iocache = {}; -++ int curr_y = start; -++ int n = end; -++ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -++ int n_uv = n >> s->ps.sps->vshift[1]; -++ int sz,base; -++ GPU_MEM_PTR_T *p; -++ if (curr_uv < 0) curr_uv = 0; -++ if (n_uv<=curr_uv) { return; } -++ sz = s->frame->linesize[1] * (n_uv-curr_uv); -++ base = s->frame->linesize[1] * curr_uv; -++ if (flush_chroma) { -++ p = av_buffer_pool_opaque(s->frame->buf[1]); -++ iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].cmd = 3; // clean+invalidate -++ iocache.s[0].addr = (int)p->arm + base; -++ iocache.s[0].size = sz; -++ p = av_buffer_pool_opaque(s->frame->buf[2]); -++ iocache.s[1].handle = p->vcsm_handle; -++ iocache.s[1].cmd = 3; // clean+invalidate -++ iocache.s[1].addr = (int)p->arm + base; -++ iocache.s[1].size = sz; -++ } -++ if (flush_luma) { -++ p = av_buffer_pool_opaque(s->frame->buf[0]); -++ sz = s->frame->linesize[0] * (n-curr_y); -++ base = s->frame->linesize[0] * curr_y; -++ iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].cmd = 3; // clean+invalidate -++ iocache.s[2].addr = (int)p->arm + base; -++ iocache.s[2].size = sz; -++ } -++ vcsm_clean_invalid( &iocache ); -++#else -++ if (flush_chroma) { -++ flush_buffer(s->frame->buf[1]); -++ flush_buffer(s->frame->buf[2]); -++ } -++ if (flush_luma) { -++ flush_buffer(s->frame->buf[0]); -++ } -++#endif -++} -++ -++ -+ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+ if (s->enable_rpi && s->used_for_ref) { -++ // TODO make this use ff_hevc_flush_buffer_lines -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ int curr_y = ((int *)f->progress->data)[0]; -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -++ GPU_MEM_PTR_T *p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(s->frame->buf[1]); -++ p = av_buffer_pool_opaque(s->frame->buf[1]); -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm + base; -++ iocache.s[0].addr = (int)p->arm + base; -+ iocache.s[0].size = sz; -+ p = av_buffer_pool_opaque(s->frame->buf[2]); -+ iocache.s[1].handle = p->vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = p->arm + base; -++ iocache.s[1].addr = (int)p->arm + base; -+ iocache.s[1].size = sz; -+ -+ #ifdef RPI_LUMA_QPU -+@@ -911,7 +989,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ base = s->frame->linesize[0] * curr_y; -+ iocache.s[2].handle = p->vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = p->arm + base; -++ iocache.s[2].addr = (int)p->arm + base; -+ iocache.s[2].size = sz; -+ #endif -+ vcsm_clean_invalid( &iocache ); -+@@ -930,11 +1008,40 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ } -+ #endif -+ -++#ifdef RPI_DEBLOCK_VPU -++/* rpi_deblock deblocks an entire row of ctbs using the VPU */ -++static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -++{ -++ // Flush image, 4 lines above to bottom of ctb stripe -++ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); -++ // TODO flush buffer of beta/tc setup when it becomes cached -++ // Call VPU -++ // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion -++ vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], -++ s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), -++ ctb_size>>4, 2, 0)); // 2 means to do the deblocking code -++} -++ -++static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) -++{ -++ int y2; -++ for(y2=y;y2= s->ps.sps->width - ctb_size; -+ if (s->avctx->skip_loop_filter < AVDISCARD_ALL) -+ deblocking_filter_CTB(s, x, y); -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock && x_end) -++ { -++ rpi_deblock(s, y, ctb_size); -++ } -++#endif -+ if (s->ps.sps->sao_enabled) { -+ int y_end = y >= s->ps.sps->height - ctb_size; -+ if (y && x) -+@@ -965,6 +1072,7 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //if (((y + ctb_size)&63)==0) -+ #ifdef RPI_INTER_QPU -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -++ // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -+ } -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index 4f13622..b3f155f 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -3,7 +3,13 @@ unsigned char rpi_hevc_transform [] = { -+ 106, -+ 0, -+ 144, -+-35, -++38, -++1, -++37, -++106, -++0, -++144, -++57, -+ 1, -+ 169, -+ 3, -+@@ -627,4 +633,1798 @@ unsigned char rpi_hevc_transform [] = { -+ 30, -+ 90, -+ 0, -++169, -++3, -++73, -++64, -++52, -++64, -++45, -++64, -++2, -++64, -++10, -++64, -++64, -++198, -++1, -++7, -++8, -++232, -++63, -++0, -++0, -++0, -++6, -++232, -++253, -++255, -++255, -++255, -++0, -++246, -++0, -++0, -++0, -++4, -++215, -++64, -++3, -++96, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++137, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++129, -++0, -++131, -++102, -++0, -++158, -++67, -++0, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++108, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++100, -++0, -++131, -++102, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++161, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++150, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++3, -++99, -++131, -++71, -++68, -++232, -++32, -++0, -++0, -++0, -++0, -++99, -++2, -++99, -++23, -++102, -++7, -++106, -++127, -++156, -++182, -++255, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++112, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++101, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++25, -++102, -++9, -++106, -++2, -++30, -++41, -++3, -++26, -++87, -++162, -++64, -++64, -++198, -++1, -++23, -++127, -++158, -++103, -++255, -++239, -++3, -++0, -++254, -++0, -++143, -++92, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++143, -++93, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++143, -++94, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++95, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++208, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++209, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++142, -++210, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++0, -++142, -++211, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++107, -++0, -++8, -++255, -++99, -++23, -++0, -++212, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++23, -++0, -++228, -++192, -++51, -++0, -++0, -++8, -++255, -++227, -++23, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++52, -++0, -++180, -++192, -++51, -++0, -++0, -++8, -++255, -++99, -++52, -++0, -++164, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++52, -++0, -++148, -++192, -++51, -++0, -++0, -++111, -++3, -++239, -++3, -++0, -++254, -++0, -++143, -++12, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++143, -++13, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++143, -++14, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++15, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++16, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++17, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++64, -++142, -++18, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++0, -++142, -++19, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++33, -++0, -++8, -++255, -++99, -++3, -++0, -++212, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++3, -++0, -++228, -++192, -++51, -++0, -++0, -++8, -++255, -++227, -++3, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++4, -++0, -++180, -++192, -++51, -++0, -++0, -++8, -++255, -++99, -++4, -++0, -++164, -++192, -++51, -++0, -++0, -++8, -++255, -++163, -++4, -++0, -++148, -++192, -++51, -++0, -++0, -++111, -++3, -++32, -++246, -++192, -++11, -++1, -++16, -++32, -++246, -++2, -++137, -++47, -++240, -++40, -++246, -++2, -++140, -++47, -++240, -++128, -++245, -++99, -++140, -++5, -++4, -++0, -++247, -++99, -++140, -++1, -++20, -++88, -++246, -++99, -++140, -++1, -++20, -++0, -++247, -++35, -++136, -++62, -++226, -++32, -++247, -++35, -++136, -++32, -++210, -++0, -++247, -++34, -++136, -++63, -++2, -++208, -++246, -++34, -++136, -++0, -++4, -++0, -++247, -++99, -++136, -++58, -++162, -++32, -++247, -++99, -++136, -++33, -++146, -++0, -++247, -++98, -++136, -++59, -++18, -++208, -++246, -++98, -++136, -++0, -++20, -++0, -++247, -++162, -++136, -++33, -++2, -++88, -++246, -++98, -++137, -++2, -++68, -++88, -++246, -++162, -++137, -++3, -++68, -++208, -++254, -++227, -++136, -++60, -++242, -++192, -++243, -++188, -++11, -++208, -++254, -++227, -++136, -++56, -++178, -++192, -++243, -++188, -++10, -++32, -++255, -++226, -++136, -++38, -++58, -++192, -++243, -++60, -++0, -++208, -++254, -++227, -++136, -++59, -++242, -++192, -++243, -++60, -++128, -++32, -++255, -++226, -++136, -++49, -++58, -++192, -++243, -++60, -++128, -++0, -++255, -++226, -++136, -++34, -++34, -++192, -++243, -++60, -++128, -++32, -++255, -++226, -++136, -++37, -++58, -++192, -++243, -++60, -++128, -++0, -++254, -++192, -++136, -++1, -++4, -++0, -++240, -++0, -++160, -++0, -++255, -++194, -++8, -++0, -++52, -++195, -++243, -++0, -++128, -++0, -++255, -++202, -++40, -++0, -++52, -++195, -++243, -++0, -++128, -++0, -++254, -++0, -++240, -++35, -++10, -++0, -++240, -++60, -++0, -++0, -++254, -++192, -++136, -++1, -++4, -++0, -++240, -++0, -++160, -++0, -++255, -++226, -++140, -++34, -++34, -++195, -++243, -++60, -++0, -++32, -++255, -++227, -++140, -++36, -++58, -++192, -++243, -++60, -++0, -++0, -++254, -++192, -++136, -++0, -++4, -++0, -++240, -++0, -++160, -++16, -++246, -++226, -++136, -++35, -++50, -++16, -++246, -++226, -++136, -++35, -++50, -++32, -++246, -++226, -++136, -++35, -++50, -++32, -++254, -++226, -++136, -++35, -++58, -++192, -++243, -++60, -++0, -++11, -++96, -++0, -++254, -++0, -++240, -++1, -++4, -++0, -++240, -++64, -++115, -++5, -++106, -++0, -++144, -++173, -++1, -++27, -++96, -++0, -++254, -++0, -++240, -++1, -++4, -++0, -++240, -++64, -++147, -++5, -++106, -++0, -++144, -++227, -++0, -++64, -++246, -++163, -++140, -++1, -++4, -++0, -++246, -++192, -++175, -++63, -++2, -++0, -++246, -++192, -++174, -++59, -++2, -++0, -++246, -++128, -++175, -++62, -++2, -++0, -++246, -++128, -++174, -++58, -++2, -++0, -++246, -++64, -++175, -++61, -++2, -++0, -++246, -++64, -++174, -++57, -++2, -++0, -++255, -++43, -++240, -++4, -++212, -++192, -++243, -++128, -++11, -++64, -++254, -++43, -++240, -++1, -++228, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++244, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++180, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++141, -++0, -++164, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++191, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++235, -++143, -++52, -++242, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++2, -++212, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++191, -++226, -++192, -++243, -++188, -++10, -++64, -++254, -++43, -++141, -++0, -++180, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++2, -++68, -++32, -++247, -++35, -++141, -++190, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++171, -++143, -++52, -++226, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++4, -++180, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++191, -++226, -++192, -++243, -++188, -++10, -++128, -++253, -++43, -++240, -++3, -++212, -++192, -++243, -++128, -++10, -++64, -++254, -++35, -++141, -++1, -++196, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++189, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++107, -++143, -++52, -++210, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++4, -++148, -++192, -++243, -++128, -++11, -++64, -++254, -++43, -++240, -++1, -++164, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++180, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++240, -++1, -++244, -++192, -++243, -++128, -++10, -++64, -++254, -++43, -++141, -++0, -++228, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++187, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++235, -++142, -++52, -++178, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++2, -++148, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++187, -++162, -++192, -++243, -++188, -++10, -++64, -++254, -++43, -++141, -++0, -++244, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++2, -++68, -++32, -++247, -++35, -++141, -++186, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++171, -++142, -++52, -++162, -++192, -++243, -++60, -++128, -++0, -++255, -++43, -++240, -++4, -++244, -++192, -++243, -++128, -++11, -++0, -++255, -++43, -++240, -++187, -++162, -++192, -++243, -++188, -++10, -++128, -++253, -++43, -++240, -++3, -++148, -++192, -++243, -++128, -++10, -++64, -++254, -++35, -++141, -++1, -++132, -++192, -++243, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++32, -++247, -++35, -++141, -++185, -++66, -++240, -++246, -++35, -++141, -++50, -++66, -++0, -++255, -++107, -++142, -++52, -++146, -++192, -++243, -++60, -++128, -++64, -++255, -++98, -++141, -++0, -++52, -++192, -++243, -++0, -++0, -++0, -++254, -++0, -++240, -++53, -++10, -++0, -++240, -++60, -++0, -++0, -++254, -++0, -++240, -++1, -++4, -++0, -++240, -++64, -++147, -++5, -++106, -++0, -++144, -++177, -++0, -++88, -++246, -++163, -++140, -++1, -++4, -++128, -++245, -++99, -++141, -++10, -++4, -++88, -++246, -++162, -++138, -++1, -++68, -++0, -++247, -++162, -++138, -++36, -++162, -++88, -++254, -++162, -++138, -++3, -++164, -++192, -++243, -++128, -++11, -++0, -++255, -++226, -++137, -++32, -++2, -++195, -++243, -++60, -++0, -++32, -++247, -++226, -++137, -++42, -++114, -++0, -++255, -++34, -++138, -++33, -++18, -++195, -++243, -++60, -++0, -++32, -++247, -++34, -++138, -++42, -++130, -++16, -++246, -++98, -++138, -++40, -++114, -++16, -++246, -++98, -++138, -++41, -++146, -++32, -++246, -++98, -++138, -++41, -++146, -++32, -++246, -++226, -++137, -++41, -++146, -++40, -++246, -++34, -++138, -++41, -++146, -++32, -++247, -++163, -++141, -++63, -++178, -++32, -++247, -++227, -++141, -++62, -++162, -++0, -++254, -++0, -++240, -++8, -++4, -++0, -++240, -++128, -++11, -++128, -++253, -++35, -++240, -++9, -++100, -++192, -++243, -++128, -++10, -++128, -++253, -++163, -++141, -++128, -++115, -++192, -++243, -++152, -++10, -++88, -++246, -++163, -++141, -++4, -++100, -++208, -++246, -++35, -++139, -++0, -++100, -++32, -++255, -++34, -++139, -++53, -++202, -++192, -++243, -++60, -++128, -++0, -++254, -++0, -++139, -++0, -++4, -++0, -++240, -++0, -++160, -++240, -++246, -++163, -++141, -++48, -++98, -++0, -++247, -++99, -++139, -++63, -++210, -++0, -++247, -++98, -++139, -++1, -++212, -++88, -++254, -++98, -++139, -++1, -++212, -++192, -++243, -++128, -++11, -++32, -++255, -++99, -++139, -++62, -++98, -++192, -++243, -++188, -++10, -++88, -++246, -++98, -++139, -++1, -++212, -++240, -++246, -++98, -++139, -++50, -++210, -++0, -++247, -++163, -++128, -++59, -++146, -++0, -++247, -++160, -++128, -++1, -++36, -++88, -++254, -++160, -++128, -++1, -++36, -++192, -++243, -++128, -++11, -++0, -++247, -++163, -++128, -++58, -++98, -++64, -++255, -++35, -++240, -++0, -++100, -++192, -++243, -++128, -++10, -++64, -++255, -++163, -++128, -++0, -++164, -++192, -++243, -++128, -++10, -++88, -++246, -++160, -++128, -++1, -++36, -++240, -++246, -++160, -++128, -++50, -++34, -++8, -++255, -++227, -++143, -++54, -++242, -++192, -++243, -++60, -++128, -++40, -++255, -++227, -++142, -++54, -++178, -++192, -++243, -++60, -++128, -++0, -++254, -++0, -++240, -++39, -++10, -++0, -++240, -++60, -++128, -++8, -++255, -++163, -++143, -++45, -++226, -++192, -++243, -++60, -++128, -++0, -++254, -++0, -++240, -++44, -++10, -++0, -++240, -++60, -++0, -++0, -++254, -++0, -++240, -++40, -++10, -++0, -++240, -++60, -++128, -++8, -++255, -++163, -++142, -++2, -++162, -++192, -++243, -++60, -++128, -++90, -++0, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index fd159bc..b055208 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -83,6 +83,8 @@ -+ hevc_trans_16x16: -+ cmp r5,1 -+ beq memclear16 -++ cmp r5,2 -++ beq hevc_deblock_16x16 -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+@@ -282,3 +284,427 @@ loop: -+ cmp r1,0 -+ bgt loop -+ b lr -++ -++ -++################################################################################ -++# HEVC VPU Deblock -++# -++# Vertical edges before horizontal -++# Decision can change every 4 pixels, but only 8 pixel boundaries are deblocked -++# -++# ARM is responsible for storing beta and tc for each 4 pixels horiz and vert edge. -++# The VPU code works in units of 16x16 blocks. -++# We do vertical filtering for the current block followed by horizontal filtering for the previous (except for the first time). -++# One final horizontal filter is required at the end. -++# PCM is not allowed in this code. -++# -++# -++# H(16-4:16+15,0) contains previous block (note that we need 4 lines above of context that may get altered during filtering) -++# H(16:31,16) contains current block (note that we do not need the upper lines until the horizontal filtering. -++ -++.set P0,63 -++.set P1,62 -++.set P2,61 -++.set P3,60 -++.set Q0,59 -++.set Q1,58 -++.set Q2,57 -++.set Q3,56 -++ -++.set dp,32 -++.set dq,33 -++.set d,34 -++.set decision,35 -++.set beta,36 -++.set beta2,37 -++.set beta3,38 -++.set ptest,39 -++.set qtest,40 -++.set pqtest,41 -++.set thresh,42 -++.set deltatest, 44 -++.set deltap1, 45 -++.set tc25, 46 -++.set setup,47 -++.set tc,48 -++.set tc25,49 -++.set tc2, 50 -++.set do_filter, 51 -++.set delta, 52 -++.set tc10, 53 -++.set delta0, 54 -++.set delta1, 55 -++.set zeros, 0 -++.set setup_input, 1 -++.set deltaq1, 2 -++ -++ -++ -++# hevc_deblock_16x16 deblocks an entire row that is 16 pixels high by the full width of the image. -++# Row has num16 16x16 blocks across -++# Beta goes from 0 to 64 -++# tc goes from 0 to 24 -++# setup[block_idx][0=vert,1=horz][0=first edge, 1=second edge][0=beta,1=tc][0..3=edge number] -++# has 8 bytes per edge -++# has 16 bytes per direction -++# has 32 bytes per 16x16 block -++# hevc_deblock_16x16(uint8_t *img (r0), int stride (r1), int num16w (r2), uint8_t setup[num16][2][2][2][4](r3),int num16h(r4)) -++hevc_deblock_16x16: -++ push r6-r15, lr -++ mov r9,r4 -++ mov r4,r3 -++ mov r13,r2 -++ mov r2,r0 -++ mov r10,r0 -++ subscale4 r0,r1 -++ mov r8,63 -++ mov r6,-3 -++ vmov H(zeros,0),0 -++# r7 is number of blocks still to load -++# r0 is location of current block - 4 * stride -++# r1 is stride -++# r2 is location of current block -++# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical -++# r4 is setup -++# r5 is for temporary calculations -++# r8 holds 63 -++# r6 holds -3 -++# r9 holds the number of 16 high rows to process -++# r10 holds the original img base -++# r11 returns 0 if no filtering was done on the edge -++# r12 saves a copy of this -++# r13 is copy of width -++ -++process_row: -++ # First iteration does not do horizontal filtering on previous -++ mov r7, r13 -++ mov r3,0 -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) # We may wish to prefetch these -++ vstb H(zeros,0),(r4) -++ bl vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 -++ bl vert_filter -++ sub r3,8 -++ b start_deblock_loop -++deblock_loop: -++ # Middle iterations do vertical on current block and horizontal on preceding -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) -++ vstb H(zeros,0),(r4) -++ bl vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl vert_filter -++ sub r3,8 -++ vldb H(setup_input,0), -16(r4) -++ vstb H(zeros,0),-16(r4) -++ bl horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl horz_filter -++ sub r3,8*64 -++ addcmpbeq r12,0,0,skip_save_top -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++skip_save_top: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++start_deblock_loop: -++ # move onto next 16x16 (could do this with circular buffer support instead) -++ add r3,16 -++ and r3,r8 -++ add r4,32 -++ # Perform loop counter operations (may work with an addcmpbgt as well?) -++ add r0,16 -++ add r2,16 -++ sub r7,1 -++ cmp r7,0 # Are there still more blocks to load -++ bgt deblock_loop -++ -++ # Final iteration needs to just do horizontal filtering -++ vldb H(setup_input,0), -16(r4) -++ vstb H(zeros,0),-16(r4) -++ bl horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl horz_filter -++ sub r3,64*8 -++ addcmpbeq r12,0,0,skip_save_top2 -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++skip_save_top2: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++ -++# Now look to see if we should do another row -++ sub r9,1 -++ cmp r9,0 -++ bgt start_again -++ pop r6-r15, pc -++start_again: -++ # Need to sort out r0,r2 to point to next row down -++ addscale16 r10,r1 -++ mov r2,r10 -++ subscale4 r0,r2,r1 -++ b process_row -++ -++ -++# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered -++# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations -++ -++vert_filter: -++ push lr -++ -++ vmov HX(P3,0), V(16,12)+r3 -++ vmov HX(P2,0), V(16,13)+r3 -++ vmov HX(P1,0), V(16,14)+r3 -++ vmov HX(P0,0), V(16,15)+r3 -++ vmov HX(Q0,0), V(16,16)+r3 -++ vmov HX(Q1,0), V(16,17)+r3 -++ vmov HX(Q2,0), V(16,18)+r3 -++ vmov HX(Q3,0), V(16,19)+r3 -++ -++ bl do_luma_filter -++ -++ vadds V(16,13)+r3, HX(P2,0), 0 -++ vadds V(16,14)+r3, HX(P1,0), 0 -++ vadds V(16,15)+r3, HX(P0,0), 0 -++ # P3 and Q3 never change so don't bother saving back -++ vadds V(16,16)+r3, HX(Q0,0), 0 -++ vadds V(16,17)+r3, HX(Q1,0), 0 -++ vadds V(16,18)+r3, HX(Q2,0), 0 -++ -++ pop pc -++ -++# Filter edge at H(16,0)+r3 -++horz_filter: -++ push lr -++ -++ vmov HX(P3,0), H(12,0)+r3 -++ vmov HX(P2,0), H(13,0)+r3 -++ vmov HX(P1,0), H(14,0)+r3 -++ vmov HX(P0,0), H(15,0)+r3 -++ vmov HX(Q0,0), H(16,0)+r3 -++ vmov HX(Q1,0), H(17,0)+r3 -++ vmov HX(Q2,0), H(18,0)+r3 -++ vmov HX(Q3,0), H(19,0)+r3 -++ -++ bl do_luma_filter -++ -++ vadds H(13,0)+r3, HX(P2,0), 0 -++ vadds H(14,0)+r3, HX(P1,0), 0 -++ vadds H(15,0)+r3, HX(P0,0), 0 -++ # P3 and Q3 never change so don't bother saving back -++ vadds H(16,0)+r3, HX(Q0,0), 0 -++ vadds H(17,0)+r3, HX(Q1,0), 0 -++ vadds H(18,0)+r3, HX(Q2,0), 0 -++ -++ pop pc -++ -++# r4 points to array of beta/tc for each 4 length edge -++do_luma_filter: -++ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # b*8tc*8 -++ valtl HX(beta,0),H(setup,0),H(setup,0) -++ valtu HX(tc,0),H(setup,0),H(setup,0) -++ vmul HX(tc25,0), HX(tc,0), 5 -++ vadd HX(tc25,0),HX(tc25,0), 1 -++ vasr HX(tc25,0), HX(tc25,0), 1 -++ -++ # Compute decision -++ vadd HX(dp,0),HX(P1,0),HX(P1,0) # 2*P1 -++ vsub HX(dp,0),HX(P2,0),HX(dp,0) # P2-2*P1 -++ vadd HX(dp,0),HX(dp,0),HX(P0,0) # P2-2*P1+P0 -++ vdist HX(dp,0),HX(dp,0),0 # abs(P2-2*P1+P0) # dp0 -++ -++ vadd HX(dq,0),HX(Q1,0),HX(Q1,0) # 2*Q1 -++ vsub HX(dq,0),HX(Q2,0),HX(dq,0) # Q2-2*Q1 -++ vadd HX(dq,0),HX(dq,0),HX(Q0,0) # Q2-2*Q1+Q0 -++ vdist HX(dq,0),HX(dq,0),0 # abs(Q2-2*Q1+Q0) # dq0 -++ -++ vadd HX(d,0), HX(dp,0), HX(dq,0) -++ vasr HX(beta2,0),HX(beta,0),2 -++ vasr HX(beta3,0),HX(beta,0),3 -++ -++ # Compute flags that are negative if all conditions pass -++ vdist HX(decision,0), HX(P0,0), HX(P3,0) CLRA SACC -++ vdist HX(decision,0), HX(Q0,0), HX(Q3,0) SACC -++ vsub HX(decision,0), HX(decision,0), HX(beta3,0) SETF -++ -++ vdist HX(decision,0), HX(P0,0), HX(Q0,0) IFN -++ vsub HX(decision,0), HX(decision,0), HX(tc25,0) IFN SETF -++ vadd HX(decision,0), HX(d,0), HX(d,0) IFN -++ vsub HX(decision,0), HX(decision,0), HX(beta2,0) IFN SETF -++ vmov HX(decision,0), 1 IFNN -++ vadd H(decision,0),H(decision,3),0 IFN -++ vadd H(decision,16),H(decision,19),0 IFN -++ vmov -,HX(decision,0) SETF # N marks strong filter -++ vmov HX(decision,0), 1 IFNN # NN marks normal filter -++ -++ vadd HX(do_filter,0), HX(d,3), HX(d,0) -++ vsub HX(do_filter,0), HX(do_filter,0), HX(beta,0) SETF # IFNN means no filter -++ vmov HX(decision,0),0 IFNN # Z marks no filter -++ -++ # Expand out decision (currently valid one every 4 pixels) 0...1...2...3 -++ # First extract out even terms -++ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0.1.2.3 -++ vodd HX(decision,0),HX(decision,0),HX(decision,0) # 0123 -++ # Now expand back -++ valtl HX(decision,0),HX(decision,0),HX(decision,0) # 00112233 -++ valtl HX(decision,0),HX(decision,0),HX(decision,0) SETF # 0000111122223333 -++ -++ # HX(decision,0) is negative if want strong filtering, 1 if want normal filtering, 0 if want no filtering -++ -++ # Do a quick check to see if there is anything to do -++ mov r11, 0 # Signal no filtering -++ vmov -,1 IFNZ SUMS r5 -++ cmp r5,0 -++ beq filtering_done -++ mov r11, 1 # Signal some filtering -++ # And whether there is any strong filtering -++ vmov -,1 IFN SUMS r5 -++ cmp r5,0 -++ beq normal_filtering -++ -++ ############################################################################## -++ # Strong filtering - could maybe fast case if all have same sign? (especially if all disabled!) -++ vshl HX(tc2,0), HX(tc,0), 1 # Note that in normal filtering tx2 is tc/2, while here it is tc*2 -++ -++ # Take a copy of the original pixels for use in decision calculation -++ vmov HX(P0,32),HX(P0,0) -++ vmov HX(Q0,32),HX(Q0,0) -++ vmov HX(P1,32),HX(P1,0) -++ vmov HX(Q1,32),HX(Q1,0) -++ vmov HX(P2,32),HX(P2,0) -++ vmov HX(Q2,32),HX(Q2,0) -++ -++ vadd -,HX(P2,32),4 CLRA SACC -++ vshl -,HX(P1,32),1 SACC -++ vshl -,HX(P0,32),1 SACC -++ vshl -,HX(Q0,32),1 SACC -++ vshl HX(delta,0),HX(Q1,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(P0,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(P0,0),HX(P0,32),HX(delta,0) IFN -++ -++ vadd -,HX(P2,32),2 CLRA SACC -++ vadd -,HX(P1,32),HX(P0,32) SACC -++ vshl HX(delta,0),HX(Q0,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 2 -++ vsub HX(delta,0),HX(delta,0),HX(P1,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(P1,0),HX(P1,32),HX(delta,0) IFN -++ -++ vadd -,HX(Q0,32),4 CLRA SACC -++ vadd -,HX(P1,32),HX(P0,32) SACC -++ vmul -,HX(P2,32),3 SACC -++ vshl HX(delta,0),HX(P3,0),1 SACC # Note that we have not made a copy of P3, so using P3,0 is correct -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(P2,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(P2,0),HX(P2,32),HX(delta,0) IFN -++ #vmov HX(P2,0),3 IFN -++ -++ # Now reverse all P/Qs -++ -++ vadd -,HX(Q2,32),4 CLRA SACC -++ vshl -,HX(Q1,32),1 SACC -++ vshl -,HX(Q0,32),1 SACC -++ vshl -,HX(P0,32),1 SACC -++ vshl HX(delta,0),HX(P1,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(Q0,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(Q0,0),HX(Q0,32),HX(delta,0) IFN -++ -++ vadd -,HX(Q2,32),2 CLRA SACC -++ vadd -,HX(Q1,32),HX(Q0,32) SACC -++ vshl HX(delta,0),HX(P0,32),0 SACC -++ vasr HX(delta,0),HX(delta,0), 2 -++ vsub HX(delta,0),HX(delta,0),HX(Q1,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(Q1,0),HX(Q1,32),HX(delta,0) IFN -++ -++ vadd -,HX(P0,32),4 CLRA SACC -++ vadd -,HX(Q1,32),HX(Q0,32) SACC -++ vmul -,HX(Q2,32),3 SACC -++ vshl HX(delta,0),HX(Q3,0),1 SACC # Note that we have not made a copy of Q3, so using Q3,0 is correct -++ vasr HX(delta,0),HX(delta,0), 3 -++ vsub HX(delta,0),HX(delta,0),HX(Q2,32) -++ vclamps HX(delta,0), HX(delta,0), HX(tc2,0) -++ vadd HX(Q2,0),HX(Q2,32),HX(delta,0) IFN -++ -++ ############################################################################## -++ # Normal filtering -++normal_filtering: -++ # Invert the decision flags -++ # make instruction more complicated as assembler has error and loses SETF -++ vrsub HX(tc10,0), HX(decision,0), 0 SETF # IFN means normal filtering -++ vmov -, HX(tc10,0) SETF # IFN means normal filtering -++ -++ vmov -,1 IFN SUMS r5 -++ cmp r5,0 -++ beq filtering_done -++ -++ vasr HX(tc2,0), HX(tc,0), 1 -++ vmul HX(tc10,0), HX(tc,0), 10 -++ -++ vasr HX(thresh,0), HX(beta,0), 1 -++ vadd HX(thresh,0), HX(thresh,0), HX(beta,0) -++ vasr HX(thresh,0), HX(thresh,0), 3 CLRA SACC -++ -++ vadd HX(ptest,0),HX(dp,3),HX(dp,0) -++ vsub HX(ptest,0),HX(ptest,0),HX(thresh,0) # ptest is negative if we need to do the P2 pixel -++ vadd HX(qtest,0),HX(dq,3),HX(dq,0) -++ vsub HX(qtest,0),HX(qtest,0),HX(thresh,0) # qtest is negative if we need to do the Q2 pixel -++ # Expand ptest and qtest together -++ vodd HX(pqtest,0),HX(ptest,0),HX(qtest,0) # p.p.p.p.q.q.q.q -++ vodd HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppqqqq........ -++ valtl HX(pqtest,0),HX(pqtest,0),HX(pqtest,0) # ppppppppqqqqqqqq -++ valtl HX(ptest,0),HX(pqtest,0),HX(pqtest,0) -++ valtu HX(qtest,0),HX(pqtest,0),HX(pqtest,0) -++ -++ vsub HX(delta0,0), HX(Q0,0), HX(P0,0) -++ vsub HX(delta1,0), HX(Q1,0), HX(P1,0) -++ vmov -,8 CLRA SACC -++ vmul -,HX(delta0,0), 9 SACC -++ vmul HX(delta0,0),HX(delta1,0), r6 SACC -++ vasr HX(delta0,0), HX(delta0,0), 4 -++ vdist HX(deltatest,0), HX(delta0,0), 0 -++ vsub HX(deltatest,0), HX(deltatest,0), HX(tc10,0) IFN SETF # negative if still need to do something -++ vmov HX(deltatest,0), 0 IFNN # clear if no need to do anything so we can reload flags later -++ -++ vclamps HX(delta0,0), HX(delta0,0), HX(tc,0) -++ -++ vadd HX(deltap1,0), HX(P2,0), HX(P0,0) -++ vadd HX(deltap1,0), HX(deltap1,0), 1 -++ vasr HX(deltap1,0), HX(deltap1,0), 1 CLRA SACC -++ vsub HX(deltap1,0), HX(delta0,0), HX(P1,0) SACC -++ vasr HX(deltap1,0), HX(deltap1,0), 1 -++ vclamps HX(deltap1,0), HX(deltap1,0), HX(tc2,0) -++ -++ vadd HX(deltaq1,0), HX(Q2,0), HX(Q0,0) -++ vadd HX(deltaq1,0), HX(deltaq1,0), 1 -++ vasr HX(deltaq1,0), HX(deltaq1,0), 1 CLRA SACC -++ vadd HX(deltaq1,0), HX(delta0,0), HX(Q1,0) -++ vrsub -, HX(delta0,0), 0 SACC -++ vrsub HX(deltaq1,0), HX(Q1,0), 0 SACC -++ vasr HX(deltaq1,0), HX(deltaq1,0), 1 -++ vclamps HX(deltaq1,0), HX(deltaq1,0), HX(tc2,0) -++ -++ vadds HX(P0,0), HX(P0,0), HX(delta0,0) IFN -++ vsubs HX(Q0,0), HX(Q0,0), HX(delta0,0) IFN -++ -++ vmov -,HX(ptest,0) IFN SETF # Negative if need to do p1 -++ vadds HX(P1,0), HX(P1,0), HX(deltap1,0) IFN -++ -++ vmov -,HX(deltatest,0) SETF -++ vmov -,HX(qtest,0) IFN SETF # Negative if need to do q1 -++ vadds HX(Q1,0), HX(Q1,0), HX(deltaq1,0) IFN -++ -++ #vmov HX(P2,0),1 IFN -++ -++filtering_done: -++ b lr -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 0121fca..05b2169 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -147,7 +147,7 @@ static int gpu_init(volatile struct GPU **gpu) { -+ vcsm_init(); -+ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -+ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -+- memset(ptr, 0, sizeof *ptr); -++ memset((void*)ptr, 0, sizeof *ptr); -+ vc = gpu_mem_ptr.vc; -+ -+ ptr->mb = mb; -+@@ -254,7 +254,7 @@ void gpu_cache_flush(GPU_MEM_PTR_T *p) -+ struct vcsm_user_clean_invalid_s iocache = {}; -+ iocache.s[0].handle = p->vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = p->arm; -++ iocache.s[0].addr = (int) p->arm; -+ iocache.s[0].size = p->numbytes; -+ vcsm_clean_invalid( &iocache ); -+ #else -+@@ -390,6 +390,7 @@ static void *vpu_start(void *arg) { -+ #ifdef RPI_TIME_TOTAL_POSTED -+ int last_time=0; -+ long long on_time=0; -++ long long on_time_deblock=0; -+ long long off_time=0; -+ int start_time; -+ int end_time; -+@@ -451,10 +452,13 @@ static void *vpu_start(void *arg) { -+ #ifdef RPI_TIME_TOTAL_POSTED -+ end_time = Microseconds(); -+ last_time = end_time; -+- on_time += end_time - start_time; -++ if (p[6]==2) -++ on_time_deblock += end_time - start_time; -++ else -++ on_time += end_time - start_time; -+ count++; -+ if ((count&0x7f)==0) -+- printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++ printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -+ #endif -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+diff --git a/libavcodec/rpi_shader.c b/libavcodec/rpi_shader.c -+index e86eb30..c5d8b29 100644 -+--- a/libavcodec/rpi_shader.c -++++ b/libavcodec/rpi_shader.c -+@@ -61,7 +61,7 @@ unsigned int rpi_shader[] = { -+ /* [0x00000120] */ 0x8c9e7052, 0x10025e18, // add t0s, r0, r1 ; mov ra_frame_base, r2 -+ /* [0x00000128] */ 0x0c9e7440, 0x10020f27, // add t1s, r2, r1 -+ /* [0x00000130] */ 0x00000008, 0xe00208a7, // mov r2,8 -+-/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif, r2 -++/* [0x00000138] */ 0x11827c80, 0x10021327, // shl rb12,unif,r2 -+ /* [0x00000140] */ 0x0c827c80, 0x10021367, // add rb13,unif,r2 -+ /* [0x00000148] */ 0x15827d80, 0x100208a7, // mov r2, unif -+ /* [0x00000150] */ 0x119c15c0, 0xd00208a7, // shl r2, r2, 1 -+-- -+2.7.4 -+ -+ -+From e9c59f0d7b42dfb10d85ab2477f95b44484a8d70 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 1 Jul 2015 09:21:17 +0100 -+Subject: [PATCH 65/68] Added ability to combine jobs -+ -+--- -+ libavcodec/rpi_qpu.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++- -+ 1 file changed, 80 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 05b2169..91777be 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -8,6 +8,8 @@ -+ #define RPI_TIME_TOTAL_POSTED -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -++// Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel -++#define RPI_COMBINE_JOBS -+ -+ #include -+ #include -+@@ -398,9 +400,15 @@ static void *vpu_start(void *arg) { -+ #endif -+ while(1) { -+ int i; -+- int *p; -++ int *p; // Pointer for a QPU/VPU job -++#ifdef RPI_COMBINE_JOBS -++ int *q = NULL; // Pointer for a VPU only job -++ int have_qpu = 0; -++ int have_vpu = 0; -++#endif -+ int qpu_code; -+ int qpu_codeb; -++ int num_jobs; // Number of jobs available -+ pthread_mutex_lock(&post_mutex); -+ while( vpu_async_tail - vpu_async_head <= 0) -+ { -+@@ -408,13 +416,38 @@ static void *vpu_start(void *arg) { -+ pthread_cond_wait(&post_cond_tail, &post_mutex); -+ } -+ p = vpu_cmds[vpu_async_head%MAXCMDS]; -++ num_jobs = vpu_async_tail - vpu_async_head; -+ pthread_mutex_unlock(&post_mutex); -+ -+ if (p[6] == -1) { -+ break; // Last job -+ } -++ if (p[7] == 0 && p[0] == 0 && p[16]==0) -++ goto job_done_early; -++ -++#ifdef RPI_COMBINE_JOBS -++ // First scan for a qpu job -++ for (int x=0;xmail[i*2] = p[8+i]; -++ gpu->mail[i*2 + 1] = qpu_code; -++ } -++ for(i=0;i<12;i++) { -++ gpu->mail2[i*2] = p[17+i]; -++ gpu->mail2[i*2 + 1] = qpu_codeb; -++ } -++ if (have_vpu) { -++ execute_multi(gpu->mb, -++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -++ q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 -++ q[0] = 0; -++ } else { -++ execute_multi(gpu->mb, -++ 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -++ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -++ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -++ } -++ p[0] = 0; -++ p[7] = 0; -++ p[16] = 0; -++ } else { -++ av_assert0(have_vpu); -++ vpu_execute_code(q[0], q[1], q[2], q[3], q[4], q[5], q[6]); -++ q[0] = 0; -++ } -++#else -++ -+ if (!qpu_code) { -+ vpu_execute_code(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); -+ } else { -+@@ -449,17 +516,29 @@ static void *vpu_start(void *arg) { -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+ #endif -+ } -++#endif -++ -+ #ifdef RPI_TIME_TOTAL_POSTED -+ end_time = Microseconds(); -+ last_time = end_time; -++#ifdef RPI_COMBINE_JOBS -++ // There are three cases we may wish to distinguish of VPU/QPU activity -++ on_time += end_time - start_time; -++#else -+ if (p[6]==2) -+ on_time_deblock += end_time - start_time; -+ else -+ on_time += end_time - start_time; -++#endif -+ count++; -+ if ((count&0x7f)==0) -++#ifdef RPI_COMBINE_JOBS -+ printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -++#else -++ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++#endif -+ #endif -++job_done_early: -+ pthread_mutex_lock(&post_mutex); -+ vpu_async_head++; -+ pthread_cond_broadcast(&post_cond_head); -+-- -+2.7.4 -+ -+ -+From 0d54661f303b2a8903e806648ed54a34dcf315dc Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 1 Jul 2015 12:53:10 +0100 -+Subject: [PATCH 66/68] Added chroma deblocking -+ -+--- -+ libavcodec/hevc.c | 20 ++ -+ libavcodec/hevc.h | 12 +- -+ libavcodec/hevc_filter.c | 92 +++++- -+ libavcodec/rpi_hevc_transform.h | 644 +++++++++++++++++++++++++++++++++++++++- -+ libavcodec/rpi_hevc_transform.s | 207 +++++++++++++ -+ libavcodec/rpi_qpu.c | 27 +- -+ libavcodec/rpi_shader.qasm | 11 + -+ 7 files changed, 988 insertions(+), 25 deletions(-) -+ -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 4ce94a7..8437e10 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -251,6 +251,14 @@ static void pic_arrays_free(HEVCContext *s) -+ gpu_free(&s->y_setup_ptr); -+ s->y_setup_arm = 0; -+ } -++ if (s->uv_setup_arm) { -++ gpu_free(&s->uv_setup_ptr); -++ s->uv_setup_arm = 0; -++ } -++ if (s->vpu_cmds_arm) { -++ gpu_free(&s->vpu_cmds_ptr); -++ s->vpu_cmds_arm = 0; -++ } -+ #endif -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+@@ -324,6 +332,18 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps) -+ s->y_setup_vc = (void*)s->y_setup_ptr.vc; -+ memset(s->y_setup_arm, 0, s->y_setup_ptr.numbytes); -+ printf("Setup %d by %d by %d\n",s->setup_width,s->setup_height,sizeof(*s->y_setup_arm)); -++ -++ s->uv_setup_width = ( (sps->width >> sps->hshift[1]) + 15) / 16; -++ s->uv_setup_height = ( (sps->height >> sps->vshift[1]) + 15) / 16; -++ gpu_malloc_uncached(sizeof(*s->uv_setup_arm) * s->uv_setup_width * s->uv_setup_height, &s->uv_setup_ptr); // TODO make this cached -++ s->uv_setup_arm = (void*)s->uv_setup_ptr.arm; -++ s->uv_setup_vc = (void*)s->uv_setup_ptr.vc; -++ memset(s->uv_setup_arm, 0, s->uv_setup_ptr.numbytes); -++ printf("Setup uv %d by %d by %d\n",s->uv_setup_width,s->uv_setup_height,sizeof(*s->uv_setup_arm)); -++ -++ gpu_malloc_uncached(sizeof(*s->vpu_cmds_arm) * 3,&s->vpu_cmds_ptr); -++ s->vpu_cmds_arm = (void*) s->vpu_cmds_ptr.arm; -++ s->vpu_cmds_vc = s->vpu_cmds_ptr.vc; -+ #endif -+ -+ s->bs_width = (width >> 2) + 1; -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index cf08489..7eb37e6 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -56,7 +56,7 @@ -+ #define RPI_MAX_JOBS 2 -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+- -++ // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs -+ #define RPI_DEBLOCK_VPU -+ -+ #endif -+@@ -980,6 +980,16 @@ typedef struct HEVCContext { -+ uint8_t (*y_setup_vc)[2][2][2][4]; -+ int setup_width; // Number of 16x16 blocks across the image -+ int setup_height; // Number of 16x16 blocks down the image -++ -++ GPU_MEM_PTR_T uv_setup_ptr; -++ uint8_t (*uv_setup_arm)[2][2][2][4]; // Half of this is unused [][][1][], but easier for the VPU as it allows us to store with zeros and addresses are aligned -++ uint8_t (*uv_setup_vc)[2][2][2][4]; -++ int uv_setup_width; -++ int uv_setup_height; -++ -++ GPU_MEM_PTR_T vpu_cmds_ptr; -++ int (*vpu_cmds_arm)[6]; // r0-r5 for each command -++ int vpu_cmds_vc; -+ #endif -+ -+ #endif -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 06371da..6367068 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -656,9 +656,23 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int xc = x>>s->ps.sps->hshift[chroma]; -++ int yc = y>>s->ps.sps->vshift[chroma]; -++ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); -++ int a = ((yc>>3) & 1) << 1; -++ int b = (xc>>3) & 1; -++ setup = s->uv_setup_arm[num16]; -++ setup[0][b][0][a] = c_tc[0]; -++ setup[0][b][0][a + 1] = c_tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_v_loop_filter_chroma(src, -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -++ -+ } -+ } -+ -+@@ -689,6 +703,19 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -+ } else -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ uint8_t (*setup)[2][2][4]; -++ int xc = x>>s->ps.sps->hshift[chroma]; -++ int yc = y>>s->ps.sps->vshift[chroma]; -++ int num16 = (yc>>4)*s->uv_setup_width + (xc>>4); -++ int a = ((xc>>3) & 1) << 1; -++ int b = (yc>>3) & 1; -++ setup = s->uv_setup_arm[num16]; -++ setup[1][b][0][a] = c_tc[0]; -++ setup[1][b][0][a + 1] = c_tc[1]; -++ } else -++#endif -+ s->hevcdsp.hevc_h_loop_filter_chroma(src, -+ s->frame->linesize[chroma], -+ c_tc, no_p, no_q); -+@@ -1013,33 +1040,56 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+ { -+ // Flush image, 4 lines above to bottom of ctb stripe -+- ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 0); -++ ff_hevc_flush_buffer_lines(s, FFMAX(y-4,0), y+ctb_size, 1, 1); -+ // TODO flush buffer of beta/tc setup when it becomes cached -++ -++ // Prepare three commands at once to avoid calling overhead -++ s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; -++ s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; -++ s->vpu_cmds_arm[0][2] = s->setup_width; -++ s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); -++ s->vpu_cmds_arm[0][4] = ctb_size>>4; -++ s->vpu_cmds_arm[0][5] = 2; -++ -++ s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -++ s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; -++ s->vpu_cmds_arm[1][2] = s->uv_setup_width; -++ s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -++ s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -++ s->vpu_cmds_arm[1][5] = 3; -++ -++ s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -++ s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; -++ s->vpu_cmds_arm[2][2] = s->uv_setup_width; -++ s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -++ s->vpu_cmds_arm[2][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -++ s->vpu_cmds_arm[2][5] = 4; -++ -+ // Call VPU -+- // TODO add this to a separate pipeline of VPU jobs that can be run in parallel and wait for completion -+- vpu_wait(vpu_post_code( vpu_get_fn(), get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y, s->frame->linesize[0], -+- s->setup_width, (int) ( s->y_setup_vc + s->setup_width * (y>>4) ), -+- ctb_size>>4, 2, 0)); // 2 means to do the deblocking code -++ vpu_wait(vpu_post_code( vpu_get_fn(), s->vpu_cmds_vc, 3, 0, 0, 0, 5, 0)); // 5 means to do all the commands -+ } -+ -+-static void rpi_deblock2(HEVCContext *s, int y, int ctb_size) -+-{ -+- int y2; -+- for(y2=y;y2= s->ps.sps->width - ctb_size; -++#ifdef RPI_DEBLOCK_VPU -++ int done_deblock = 0; -++#endif -+ if (s->avctx->skip_loop_filter < AVDISCARD_ALL) -+ deblocking_filter_CTB(s, x, y); -+ #ifdef RPI_DEBLOCK_VPU -+ if (s->enable_rpi_deblock && x_end) -+ { -+- rpi_deblock(s, y, ctb_size); -++ int y_at_end = y >= s->ps.sps->height - ctb_size; -++ int height = 64; // Deblock in units 64 high to avoid too many VPU calls -++ int y_start = y&~63; -++ if (y_at_end) height = s->ps.sps->height - y_start; -++ if ((((y+ctb_size)&63)==0) || y_at_end) { -++ done_deblock = 1; -++ rpi_deblock(s, y_start, height); -++ } -+ } -+ #endif -+ if (s->ps.sps->sao_enabled) { -+@@ -1070,11 +1120,25 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) -+ //int newh = y + ctb_size - 4; -+ //int currh = s->ref->tf.progress->data[0]; -+ //if (((y + ctb_size)&63)==0) -++#ifdef RPI_DEBLOCK_VPU -++ if (s->enable_rpi_deblock) { -++ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -++ if (done_deblock) { -++ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++ } -++ } else { -++#ifdef RPI_INTER_QPU -++ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -++#endif -++ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++ } -++#else -+ #ifdef RPI_INTER_QPU -+ ff_hevc_flush_buffer(s, &s->ref->tf, y + ctb_size - 4); -+- // TODO we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -++ // we no longer need to flush the luma buffer as it is in GPU memory when using deblocking on the rpi -+ #endif -+ ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0); -++#endif -+ } -+ } -+ -+diff --git a/libavcodec/rpi_hevc_transform.h b/libavcodec/rpi_hevc_transform.h -+index b3f155f..4309f1c 100644 -+--- a/libavcodec/rpi_hevc_transform.h -++++ b/libavcodec/rpi_hevc_transform.h -+@@ -3,14 +3,32 @@ unsigned char rpi_hevc_transform [] = { -+ 106, -+ 0, -+ 144, -+-38, -++47, -+ 1, -+ 37, -+ 106, -+ 0, -+ 144, -+-57, -++66, -+ 1, -++53, -++106, -++0, -++144, -++192, -++4, -++69, -++106, -++0, -++144, -++192, -++4, -++85, -++106, -++0, -++144, -++220, -++5, -+ 169, -+ 3, -+ 62, -+@@ -2427,4 +2445,626 @@ unsigned char rpi_hevc_transform [] = { -+ 128, -+ 90, -+ 0, -++169, -++3, -++14, -++96, -++4, -++31, -++169, -++3, -++30, -++96, -++1, -++31, -++73, -++64, -++52, -++64, -++45, -++64, -++2, -++64, -++10, -++64, -++64, -++198, -++1, -++7, -++8, -++232, -++63, -++0, -++0, -++0, -++6, -++232, -++253, -++255, -++255, -++255, -++0, -++246, -++0, -++0, -++0, -++4, -++215, -++64, -++3, -++96, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++30, -++106, -++132, -++24, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++143, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++135, -++0, -++131, -++102, -++0, -++158, -++71, -++0, -++2, -++248, -++0, -++35, -++0, -++0, -++64, -++56, -++0, -++0, -++4, -++248, -++0, -++36, -++0, -++0, -++64, -++56, -++8, -++0, -++0, -++240, -++64, -++0, -++132, -++3, -++30, -++106, -++132, -++24, -++128, -++240, -++0, -++0, -++132, -++3, -++128, -++144, -++112, -++0, -++131, -++98, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++104, -++0, -++131, -++102, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++30, -++106, -++134, -++24, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++123, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++112, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++3, -++99, -++131, -++71, -++68, -++232, -++32, -++0, -++0, -++0, -++0, -++99, -++2, -++99, -++23, -++102, -++7, -++106, -++127, -++156, -++178, -++255, -++0, -++248, -++64, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++30, -++106, -++134, -++24, -++128, -++248, -++0, -++0, -++112, -++0, -++192, -++243, -++211, -++31, -++128, -++144, -++72, -++0, -++188, -++64, -++67, -++232, -++0, -++2, -++0, -++0, -++0, -++255, -++64, -++0, -++0, -++20, -++200, -++243, -++0, -++0, -++128, -++144, -++61, -++0, -++195, -++232, -++0, -++2, -++0, -++0, -++12, -++128, -++7, -++192, -++130, -++248, -++0, -++0, -++112, -++192, -++224, -++16, -++195, -++31, -++132, -++248, -++1, -++0, -++112, -++0, -++224, -++16, -++203, -++31, -++25, -++102, -++9, -++106, -++2, -++30, -++41, -++3, -++26, -++87, -++162, -++64, -++64, -++198, -++1, -++23, -++127, -++158, -++95, -++255, -++239, -++3, -++0, -++254, -++128, -++143, -++94, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++95, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++208, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++209, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++47, -++0, -++8, -++255, -++227, -++23, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++52, -++0, -++180, -++192, -++51, -++0, -++0, -++111, -++3, -++239, -++3, -++0, -++254, -++128, -++143, -++14, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++143, -++15, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++192, -++142, -++16, -++0, -++0, -++240, -++12, -++0, -++0, -++254, -++128, -++142, -++17, -++0, -++0, -++240, -++12, -++0, -++128, -++144, -++13, -++0, -++8, -++255, -++227, -++3, -++0, -++244, -++192, -++51, -++0, -++0, -++8, -++255, -++35, -++4, -++0, -++180, -++192, -++51, -++0, -++0, -++111, -++3, -++32, -++246, -++192, -++11, -++1, -++16, -++32, -++246, -++2, -++140, -++47, -++240, -++32, -++247, -++35, -++141, -++63, -++178, -++64, -++254, -++35, -++141, -++2, -++68, -++192, -++243, -++128, -++11, -++32, -++255, -++35, -++240, -++58, -++226, -++192, -++243, -++188, -++10, -++0, -++254, -++0, -++141, -++4, -++4, -++0, -++240, -++128, -++10, -++88, -++246, -++35, -++141, -++3, -++68, -++240, -++246, -++35, -++141, -++48, -++66, -++0, -++247, -++227, -++143, -++52, -++242, -++32, -++247, -++227, -++142, -++52, -++178, -++90, -++0, -++161, -++3, -++6, -++64, -++23, -++64, -++96, -++8, -++70, -++98, -++97, -++8, -++70, -++98, -++98, -++8, -++70, -++98, -++99, -++8, -++70, -++98, -++100, -++8, -++70, -++98, -++101, -++8, -++70, -++98, -++255, -++159, -++8, -++250, -++23, -++102, -++7, -++106, -++112, -++30, -++33, -++3, -+ }; -+diff --git a/libavcodec/rpi_hevc_transform.s b/libavcodec/rpi_hevc_transform.s -+index b055208..5543093 100644 -+--- a/libavcodec/rpi_hevc_transform.s -++++ b/libavcodec/rpi_hevc_transform.s -+@@ -85,6 +85,13 @@ hevc_trans_16x16: -+ beq memclear16 -+ cmp r5,2 -+ beq hevc_deblock_16x16 -++ cmp r5,3 -++ beq hevc_uv_deblock_16x16 -++ cmp r5,4 -++ beq hevc_uv_deblock_16x16_with_clear -++ cmp r5,5 -++ beq hevc_run_command_list -++ -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+@@ -708,3 +715,203 @@ normal_filtering: -+ -+ filtering_done: -+ b lr -++ -++ -++hevc_uv_deblock_16x16: -++ push r6-r15, lr -++ mov r14,0 -++ b hevc_uv_start -++hevc_uv_deblock_16x16_with_clear: -++ push r6-r15, lr -++ mov r14,1 -++ b hevc_uv_start -++ -++hevc_uv_start: -++ mov r9,r4 -++ mov r4,r3 -++ mov r13,r2 -++ mov r2,r0 -++ mov r10,r0 -++ subscale4 r0,r1 -++ mov r8,63 -++ mov r6,-3 -++ vmov H(zeros,0),0 -++# r7 is number of blocks still to load -++# r0 is location of current block - 4 * stride -++# r1 is stride -++# r2 is location of current block -++# r3 is offset of start of block (actual edges start at H(16,16)+r3 for horizontal and H(16,0)+r3 for vertical -++# r4 is setup -++# r5 is for temporary calculations -++# r8 holds 63 -++# r6 holds -3 -++# r9 holds the number of 16 high rows to process -++# r10 holds the original img base -++# r11 returns 0 if no filtering was done on the edge -++# r12 saves a copy of this -++# r13 is copy of width -++# r14 is 1 if we should clear the old contents, or 0 if not -++ -++uv_process_row: -++ # First iteration does not do horizontal filtering on previous -++ mov r7, r13 -++ mov r3,0 -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # Load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) # We may wish to prefetch these -++ cmp r14,1 -++ bne uv_skip0 -++ vstb H(zeros,0),(r4) -++uv_skip0: -++ bl uv_vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 # Rotate to second set of 8 -++ bl uv_vert_filter -++ sub r3,8 -++ b uv_start_deblock_loop -++uv_deblock_loop: -++ # Middle iterations do vertical on current block and horizontal on preceding -++ vldb H(12++,16)+r3,(r0 += r1) REP 4 # load the current block -++ vldb H(16++,16)+r3,(r2 += r1) REP 16 -++ vldb H(setup_input,0), (r4) -++ cmp r14,1 -++ bne uv_skip1 -++ vstb H(zeros,0),(r4) -++uv_skip1: -++ bl uv_vert_filter -++ add r3,8 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl uv_vert_filter -++ sub r3,8 -++ vldb H(setup_input,0), -16(r4) -++ cmp r14,1 -++ bne uv_skip3 -++ vstb H(zeros,0),-16(r4) -++uv_skip3: -++ bl uv_horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl uv_horz_filter -++ sub r3,8*64 -++ addcmpbeq r12,0,0,uv_skip_save_top -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++uv_skip_save_top: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++uv_start_deblock_loop: -++ # move onto next 16x16 (could do this with circular buffer support instead) -++ add r3,16 -++ and r3,r8 -++ add r4,32 -++ # Perform loop counter operations (may work with an addcmpbgt as well?) -++ add r0,16 -++ add r2,16 -++ sub r7,1 -++ cmp r7,0 # Are there still more blocks to load -++ bgt uv_deblock_loop -++ -++ # Final iteration needs to just do horizontal filtering -++ vldb H(setup_input,0), -16(r4) -++ cmp r14,1 -++ bne uv_skip2 -++ vstb H(zeros,0),-16(r4) -++uv_skip2: -++ bl uv_horz_filter -++ mov r12,r11 -++ add r3,8*64 -++ vadd H(setup_input,0),H(setup_input,8),0 -++ bl uv_horz_filter -++ sub r3,64*8 -++ addcmpbeq r12,0,0,uv_skip_save_top2 -++ vstb H(12++,0)+r3,-16(r0 += r1) REP 4 # Save the deblocked pixels for the previous block -++uv_skip_save_top2: -++ vstb H(16++,0)+r3,-16(r2 += r1) REP 16 -++ -++# Now look to see if we should do another row -++ sub r9,1 -++ cmp r9,0 -++ bgt uv_start_again -++ pop r6-r15, pc -++uv_start_again: -++ # Need to sort out r0,r2 to point to next row down -++ addscale16 r10,r1 -++ mov r2,r10 -++ subscale4 r0,r2,r1 -++ b uv_process_row -++ -++ -++# At this stage H(16,16)+r3 points to the first pixel of the 16 high edge to be filtered -++# So we can reuse the code we move the parts to be filtered into HX(P0/P1/P2/P3/Q0/Q1/Q2/Q3,0) - we will perform a final saturation step on placing them back into the correct locations -++ -++uv_vert_filter: -++ push lr -++ -++ vmov HX(P1,0), V(16,14)+r3 -++ vmov HX(P0,0), V(16,15)+r3 -++ vmov HX(Q0,0), V(16,16)+r3 -++ vmov HX(Q1,0), V(16,17)+r3 -++ -++ bl do_chroma_filter -++ -++ vadds V(16,15)+r3, HX(P0,0), 0 -++ vadds V(16,16)+r3, HX(Q0,0), 0 -++ -++ pop pc -++ -++# Filter edge at H(16,0)+r3 -++uv_horz_filter: -++ push lr -++ -++ vmov HX(P1,0), H(14,0)+r3 -++ vmov HX(P0,0), H(15,0)+r3 -++ vmov HX(Q0,0), H(16,0)+r3 -++ vmov HX(Q1,0), H(17,0)+r3 -++ -++ bl do_chroma_filter -++ -++ vadds H(15,0)+r3, HX(P0,0), 0 -++ # P3 and Q3 never change so don't bother saving back -++ vadds H(16,0)+r3, HX(Q0,0), 0 -++ -++ pop pc -++ -++# r4 points to array of beta/tc for each 4 length edge -++do_chroma_filter: -++ valtl H(setup,0),H(setup_input,0),H(setup_input,0) # tc*8 -++ valtl HX(tc,0),H(setup,0),H(setup,0) -++ -++ vsub HX(delta,0),HX(Q0,0),HX(P0,0) -++ vshl HX(delta,0),HX(delta,0),2 CLRA SACC -++ vsub -,HX(P1,0),HX(Q1,0) SACC -++ vmov HX(delta,0),4 SACC -++ vasr HX(delta,0),HX(delta,0),3 -++ vclamps HX(delta,0), HX(delta,0), HX(tc,0) -++ vadd HX(P0,0),HX(P0,0),HX(delta,0) -++ vsub HX(Q0,0),HX(Q0,0),HX(delta,0) -++ b lr -++ -++# r0 = list -++# r1 = number -++hevc_run_command_list: -++ push r6-r7, lr -++ mov r6, r0 -++ mov r7, r1 -++loop_cmds: -++ ld r0,(r6) # How to encode r6++? -++ add r6,4 -++ ld r1,(r6) -++ add r6,4 -++ ld r2,(r6) -++ add r6,4 -++ ld r3,(r6) -++ add r6,4 -++ ld r4,(r6) -++ add r6,4 -++ ld r5,(r6) -++ add r6,4 -++ bl hevc_trans_16x16 -++ sub r7,1 -++ cmp r7,0 -++ bgt loop_cmds -++ -++ pop r6-r7, pc -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 91777be..5aa0432 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -397,6 +397,8 @@ static void *vpu_start(void *arg) { -+ int start_time; -+ int end_time; -+ int count=0; -++ int count_deblock=0; -++ int count_qpu=0; -+ #endif -+ while(1) { -+ int i; -+@@ -442,7 +444,7 @@ static void *vpu_start(void *arg) { -+ break; -+ } -+ } -+- printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); -++ //printf("Have_qpu = %d, have_vpu=%d\n",have_qpu,have_vpu); -+ #endif -+ qpu_code = p[7]; -+ qpu_codeb = p[16]; -+@@ -460,6 +462,12 @@ static void *vpu_start(void *arg) { -+ off_time += start_time-last_time; -+ #endif -+ -++#define NO_FLUSH 1 -++#define CLEAR_PROFILE 2 -++#define OUTPUT_COUNTS 4 -++ -++#define FLAGS_FOR_PROFILING (NO_FLUSH) -++ -+ #ifdef RPI_COMBINE_JOBS -+ if (have_qpu) { -+ for(i=0;i<8;i++) { -+@@ -472,14 +480,14 @@ static void *vpu_start(void *arg) { -+ } -+ if (have_vpu) { -+ execute_multi(gpu->mb, -+- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ q[0], q[1], q[2], q[3], q[4], q[5], q[6]); // VPU1 -+ q[0] = 0; -+ } else { -+ execute_multi(gpu->mb, -+- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING, 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+@@ -510,7 +518,7 @@ static void *vpu_start(void *arg) { -+ execute_qpu(gpu->mb,8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */); -+ #else -+ execute_multi(gpu->mb, -+- 12,gpu->vc + offsetof(struct GPU, mail2), 1, 5000, -++ 12,gpu->vc + offsetof(struct GPU, mail2), FLAGS_FOR_PROFILING , 5000, -+ 8,gpu->vc + offsetof(struct GPU, mail), 1 /* no flush */, 5000 /* timeout ms */, -+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], // VPU0 -+ 0, 0 , 0 , 0 , 0 , 0 , 0); // VPU1 -+@@ -525,17 +533,20 @@ static void *vpu_start(void *arg) { -+ // There are three cases we may wish to distinguish of VPU/QPU activity -+ on_time += end_time - start_time; -+ #else -+- if (p[6]==2) -++ if (p[6]>1) { -++ count_deblock++; -+ on_time_deblock += end_time - start_time; -+- else -++ } else { -+ on_time += end_time - start_time; -++ count_qpu++; -++ } -+ #endif -+ count++; -+ if ((count&0x7f)==0) -+ #ifdef RPI_COMBINE_JOBS -+- printf("Posted %d On=%dms, On_deblock=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(on_time_deblock/1000),(int)(off_time/1000)); -+-#else -+ printf("Posted %d On=%dms, Off=%dms\n",count,(int)(on_time/1000),(int)(off_time/1000)); -++#else -++ printf("Posted %d On=%dms (%d calls), On_deblock=%dms (%d calls), Off=%dms\n",count,(int)(on_time/1000),count_qpu,(int)(on_time_deblock/1000),count_deblock,(int)(off_time/1000)); -+ #endif -+ #endif -+ job_done_early: -+diff --git a/libavcodec/rpi_shader.qasm b/libavcodec/rpi_shader.qasm -+index 0686249..64bf5b0 100644 -+--- a/libavcodec/rpi_shader.qasm -++++ b/libavcodec/rpi_shader.qasm -+@@ -1077,6 +1077,17 @@ nop ; nop # delay slot 2 -+ ::mc_interrupt_exit12 -+ mov -, vw_wait # wait on the VDW -+ -++ # Dummy wait to test instructions -++# mov r3,1000000 -++#:dummy_loop -++# sub.setf r3, r3, 1 -++# nop -++# nop -++# brr.anynn -, r:dummy_loop -++# nop -++# nop -++# nop -++ -+ ldtmu0 -+ ldtmu0 -+ ldtmu1 -+-- -+2.7.4 -+ -+ -+From 12a194bddd049ab97154e9fbdd46b63b558a3bee Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Tue, 23 Jun 2015 23:42:03 +0100 -+Subject: [PATCH 67/68] armv7/hevc: Optimise deblocking boundary strength -+ calculation -+ -+--- -+ libavcodec/arm/hevcdsp_deblock_neon.S | 115 +++++++++++++++++ -+ libavcodec/arm/hevcdsp_init_neon.c | 9 ++ -+ libavcodec/hevc.h | 11 -- -+ libavcodec/hevc_filter.c | 224 ++++++++++++++-------------------- -+ libavcodec/hevcdsp.c | 116 ++++++++++++++++++ -+ libavcodec/hevcdsp.h | 14 +++ -+ 6 files changed, 344 insertions(+), 145 deletions(-) -+ -+diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S -+index 166bddb..bad4589 100644 -+--- a/libavcodec/arm/hevcdsp_deblock_neon.S -++++ b/libavcodec/arm/hevcdsp_deblock_neon.S -+@@ -383,3 +383,118 @@ function ff_hevc_h_loop_filter_chroma_neon, export=1 -+ vst1.8 {d4}, [r0] -+ bx lr -+ endfunc -++ -++/* ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, -++ * int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ * MvField *curr, MvField *neigh, uint8_t *bs) -++ */ -++function ff_hevc_deblocking_boundary_strengths_neon, export=1 -++ add ip, sp, #4*4 -++ push {a2-a4,v1-v8,lr} -++ ldmia ip, {v5-v7} -++1: ldmdb ip, {v1-v4} -++ ldrsb a3, [v5, #8] @ curr->ref_idx -++ ldrsb v8, [v5, #9] -++ ldrsb ip, [v6, #8] @ neigh->ref_idx -++ ldrsb lr, [v6, #9] -++ ldr v1, [v1, a3, lsl #2] -++ ldrb a3, [v5, #10] @ curr->pred_flag -++ ldr v2, [v2, v8, lsl #2] -++ ldrb v8, [v6, #10] @ neigh->pred_flag -++ ldr v3, [v3, ip, lsl #2] -++ ldr v4, [v4, lr, lsl #2] -++ teq a3, #3 -++ beq 20f -++ teq v8, #3 -++ beq 90f -++ -++ tst a3, #1 -++ ldrne a3, [v5, #0] @ curr->mv[0] -++ ldreq a3, [v5, #4] @ curr->mv[1] -++ moveq v1, v2 -++ tst v8, #1 -++ ldrne v8, [v6, #0] @ neigh->mv[0] -++ ldreq v8, [v6, #4] @ neigh->mv[1] -++ moveq v3, v4 -++ teq v1, v3 -++ bne 10f -++ ldr lr, =0xFFFCFFFC -++ ssub16 ip, v8, a3 -++ ssub16 a3, a3, v8 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ @ drop through -++10: movne a3, #1 -++11: subs a2, a2, #1 -++12: strbhs a3, [v7], a4 -++ subs a2, a2, #1 -++ bhs 12b -++ -++ ldm sp, {a2, a3} -++ add ip, sp, #16*4 -++ subs a1, a1, #1 -++ add v5, v5, a3 -++ add v6, v6, a3 -++ bhi 1b -++ pop {a2-a4,v1-v8,pc} -++ -++20: teq v8, #3 -++ bne 10b -++ -++ teq v1, v3 -++ teqeq v2, v4 -++ bne 40f -++ teq v1, v2 -++ bne 30f -++ -++ ldrd v1, v2, [v5] @ curr->mv -++ ldrd v3, v4, [v6] @ neigh->mv -++ ldr lr, =0xFFFCFFFC -++ ssub16 ip, v3, v1 -++ ssub16 a3, v1, v3 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ bne 25f -++ ssub16 ip, v4, v2 -++ ssub16 a3, v2, v4 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ beq 11b -++ @ drop through -++25: ssub16 ip, v4, v1 -++ ssub16 a3, v1, v4 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ bne 10b -++ ssub16 ip, v3, v2 -++ ssub16 a3, v2, v3 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ b 10b -++ -++30: ldrd v1, v2, [v5] @ curr->mv -++ ldrd v3, v4, [v6] @ neigh->mv -++ ldr lr, =0xFFFCFFFC -++ ssub16 ip, v3, v1 -++ ssub16 a3, v1, v3 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ bne 10b -++ ssub16 ip, v4, v2 -++ ssub16 a3, v2, v4 -++ sel a3, a3, ip -++ ands a3, a3, lr -++ b 10b -++ -++40: teq v1, v4 -++ teqeq v2, v3 -++ bne 10b -++ -++ ldrd v1, v2, [v5] @ curr->mv -++ ldrd v3, v4, [v6] @ neigh->mv -++ ldr lr, =0xFFFCFFFC -++ b 25b -++ -++90: mov a3, #1 -++ b 11b -++endfunc -+diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c -+index e5da7e9..49c70dd 100644 -+--- a/libavcodec/arm/hevcdsp_init_neon.c -++++ b/libavcodec/arm/hevcdsp_init_neon.c -+@@ -290,6 +290,10 @@ static void ff_hevc_sao_edge_neon_wrapper(uint8_t *_dst /* align 16 */, uint8_t -+ } -+ #undef CMP -+ -++void ff_hevc_deblocking_boundary_strengths_neon(int pus, int dup, int in_inc, int out_inc, -++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ MvField *curr, MvField *neigh, uint8_t *bs); -++ -+ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ { -+ if (bit_depth == 8) { -+@@ -387,4 +391,9 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth) -+ c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8; -+ c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8; -+ } -++ -++ assert(offsetof(MvField, mv) == 0); -++ assert(offsetof(MvField, ref_idx) == 8); -++ assert(offsetof(MvField, pred_flag) == 10); -++ c->hevc_deblocking_boundary_strengths = ff_hevc_deblocking_boundary_strengths_neon; -+ } -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 7eb37e6..496c0e1 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -684,17 +684,6 @@ typedef struct CodingUnit { -+ uint8_t cu_transquant_bypass_flag; -+ } CodingUnit; -+ -+-typedef struct Mv { -+- int16_t x; ///< horizontal component of motion vector -+- int16_t y; ///< vertical component of motion vector -+-} Mv; -+- -+-typedef struct MvField { -+- DECLARE_ALIGNED(4, Mv, mv)[2]; -+- int8_t ref_idx[2]; -+- int8_t pred_flag; -+-} MvField; -+- -+ typedef struct NeighbourAvailable { -+ int cand_bottom_left; -+ int cand_left; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 6367068..826a82f 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -726,69 +726,6 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) -+ } -+ } -+ -+-static int boundary_strength(HEVCContext *s, MvField *curr, MvField *neigh, -+- RefPicList *neigh_refPicList) -+-{ -+- if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -+- // same L0 and L1 -+- if (s->ref->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] && -+- s->ref->refPicList[0].list[curr->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]] && -+- neigh_refPicList[0].list[neigh->ref_idx[0]] == neigh_refPicList[1].list[neigh->ref_idx[1]]) { -+- if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && -+- (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) -+- return 1; -+- else -+- return 0; -+- } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && -+- neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { -+- if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) -+- return 1; -+- else -+- return 0; -+- } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[0].list[curr->ref_idx[0]] && -+- neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) { -+- if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -+- FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) -+- return 1; -+- else -+- return 0; -+- } else { -+- return 1; -+- } -+- } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -+- Mv A, B; -+- int ref_A, ref_B; -+- -+- if (curr->pred_flag & 1) { -+- A = curr->mv[0]; -+- ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]]; -+- } else { -+- A = curr->mv[1]; -+- ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]]; -+- } -+- -+- if (neigh->pred_flag & 1) { -+- B = neigh->mv[0]; -+- ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]]; -+- } else { -+- B = neigh->mv[1]; -+- ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]]; -+- } -+- -+- if (ref_A == ref_B) { -+- if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4) -+- return 1; -+- else -+- return 0; -+- } else -+- return 1; -+- } -+- -+- return 1; -+-} -+ -+ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ int log2_trafo_size) -+@@ -799,10 +736,17 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ int log2_min_tu_size = s->ps.sps->log2_min_tb_size; -+ int min_pu_width = s->ps.sps->min_pu_width; -+ int min_tu_width = s->ps.sps->min_tb_width; -+- int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width + -+- (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA; -+ int boundary_upper, boundary_left; -+- int i, j, bs; -++ int i, j; -++ RefPicList *rpl = s->ref->refPicList; -++ int min_pu_in_4pix = (1 << log2_min_pu_size) >> 2; -++ int trafo_in_min_pus = (1 << log2_trafo_size) >> log2_min_pu_size; -++ int y_pu = y0 >> log2_min_pu_size; -++ int x_pu = x0 >> log2_min_pu_size; -++ MvField *curr = &tab_mvf[y_pu * min_pu_width + x_pu]; -++ int is_intra = curr->pred_flag == PF_INTRA; -++ int inc = log2_min_pu_size == 2 ? 2 : 1; -++ uint8_t *bs; -+ -+ #ifdef DISABLE_STRENGTHS -+ return; -+@@ -818,34 +762,56 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) -+ boundary_upper = 0; -+ -++ bs = &s->horizontal_bs[(x0 + y0 * s->bs_width) >> 2]; -++ -+ if (boundary_upper) { -+ RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ? -+ ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) : -+- s->ref->refPicList; -+- int yp_pu = (y0 - 1) >> log2_min_pu_size; -+- int yq_pu = y0 >> log2_min_pu_size; -+- int yp_tu = (y0 - 1) >> log2_min_tu_size; -+- int yq_tu = y0 >> log2_min_tu_size; -++ rpl; -++ MvField *top = curr - min_pu_width; -++ -++ if (is_intra) { -++ for (i = 0; i < (1 << log2_trafo_size); i += 4) -++ bs[i >> 2] = 2; -++ -++ } else { -++ int y_tu = y0 >> log2_min_tu_size; -++ int x_tu = x0 >> log2_min_tu_size; -++ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; -++ uint8_t *top_cbf_luma = curr_cbf_luma - min_tu_width; -++ -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, sizeof (MvField), 4 >> 2, -++ rpl[0].list, rpl[1].list, rpl_top[0].list, rpl_top[1].list, -++ curr, top, bs); -+ -+ for (i = 0; i < (1 << log2_trafo_size); i += 4) { -+- int x_pu = (x0 + i) >> log2_min_pu_size; -+- int x_tu = (x0 + i) >> log2_min_tu_size; -+- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; -+- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; -+- uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu]; -+- uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu]; -+- -+- if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA) -+- bs = 2; -+- else if (curr_cbf_luma || top_cbf_luma) -+- bs = 1; -+- else -+- bs = boundary_strength(s, curr, top, rpl_top); -+- s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs; -++ int i_pu = i >> log2_min_pu_size; -++ int i_tu = i >> log2_min_tu_size; -++ -++ if (top[i_pu].pred_flag == PF_INTRA) -++ bs[i >> 2] = 2; -++ else if (curr_cbf_luma[i_tu] || top_cbf_luma[i_tu]) -++ bs[i >> 2] = 1; -+ } -++ } -++ } -++ -++ if (!is_intra) { -++ for (j = inc; j < trafo_in_min_pus; j += inc) { -++ MvField *top; -++ -++ curr += min_pu_width * inc; -++ top = curr - min_pu_width; -++ bs += s->bs_width * inc << log2_min_pu_size >> 2; -++ -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, sizeof (MvField), 4 >> 2, -++ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, -++ curr, top, bs); -++ } -+ } -+ -+- // bs for vertical TU boundaries -+ boundary_left = x0 > 0 && !(x0 & 7); -+ if (boundary_left && -+ ((!s->sh.slice_loop_filter_across_slices_enabled_flag && -+@@ -856,64 +822,54 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0))) -+ boundary_left = 0; -+ -++ curr = &tab_mvf[y_pu * min_pu_width + x_pu]; -++ bs = &s->vertical_bs[(x0 + y0 * s->bs_width) >> 2]; -++ -+ if (boundary_left) { -+ RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? -+ ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) : -+- s->ref->refPicList; -+- int xp_pu = (x0 - 1) >> log2_min_pu_size; -+- int xq_pu = x0 >> log2_min_pu_size; -+- int xp_tu = (x0 - 1) >> log2_min_tu_size; -+- int xq_tu = x0 >> log2_min_tu_size; -+- -+- for (i = 0; i < (1 << log2_trafo_size); i += 4) { -+- int y_pu = (y0 + i) >> log2_min_pu_size; -+- int y_tu = (y0 + i) >> log2_min_tu_size; -+- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -+- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -+- uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu]; -+- uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu]; -+- -+- if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA) -+- bs = 2; -+- else if (curr_cbf_luma || left_cbf_luma) -+- bs = 1; -+- else -+- bs = boundary_strength(s, curr, left, rpl_left); -+- s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs; -+- } -+- } -++ rpl; -++ MvField *left = curr - 1; -+ -+- if (log2_trafo_size > log2_min_pu_size && !is_intra) { -+- RefPicList *rpl = s->ref->refPicList; -++ if (is_intra) { -++ for (j = 0; j < (1 << log2_trafo_size); j += 4) -++ bs[j * s->bs_width >> 2] = 2; -+ -+- // bs for TU internal horizontal PU boundaries -+- for (j = 8; j < (1 << log2_trafo_size); j += 8) { -+- int yp_pu = (y0 + j - 1) >> log2_min_pu_size; -+- int yq_pu = (y0 + j) >> log2_min_pu_size; -+- -+- for (i = 0; i < (1 << log2_trafo_size); i += 4) { -+- int x_pu = (x0 + i) >> log2_min_pu_size; -+- MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu]; -+- MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu]; -+- -+- bs = boundary_strength(s, curr, top, rpl); -+- s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; -++ } else { -++ int y_tu = y0 >> log2_min_tu_size; -++ int x_tu = x0 >> log2_min_tu_size; -++ uint8_t *curr_cbf_luma = &s->cbf_luma[y_tu * min_tu_width + x_tu]; -++ uint8_t *left_cbf_luma = curr_cbf_luma - 1; -++ -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, -++ rpl[0].list, rpl[1].list, rpl_left[0].list, rpl_left[1].list, -++ curr, left, bs); -++ -++ for (j = 0; j < (1 << log2_trafo_size); j += 4) { -++ int j_pu = j >> log2_min_pu_size; -++ int j_tu = j >> log2_min_tu_size; -++ -++ if (left[j_pu * min_pu_width].pred_flag == PF_INTRA) -++ bs[j * s->bs_width >> 2] = 2; -++ else if (curr_cbf_luma[j_tu * min_tu_width] || left_cbf_luma[j_tu * min_tu_width]) -++ bs[j * s->bs_width >> 2] = 1; -+ } -+ } -++ } -+ -+- // bs for TU internal vertical PU boundaries -+- for (j = 0; j < (1 << log2_trafo_size); j += 4) { -+- int y_pu = (y0 + j) >> log2_min_pu_size; -++ if (!is_intra) { -++ for (i = inc; i < trafo_in_min_pus; i += inc) { -++ MvField *left; -+ -+- for (i = 8; i < (1 << log2_trafo_size); i += 8) { -+- int xp_pu = (x0 + i - 1) >> log2_min_pu_size; -+- int xq_pu = (x0 + i) >> log2_min_pu_size; -+- MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu]; -+- MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu]; -++ curr += inc; -++ left = curr - 1; -++ bs += inc << log2_min_pu_size >> 2; -+ -+- bs = boundary_strength(s, curr, left, rpl); -+- s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs; -+- } -++ s->hevcdsp.hevc_deblocking_boundary_strengths(trafo_in_min_pus, -++ min_pu_in_4pix, min_pu_width * sizeof (MvField), 4 * s->bs_width >> 2, -++ rpl[0].list, rpl[1].list, rpl[0].list, rpl[1].list, -++ curr, left, bs); -+ } -+ } -+ } -+diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c -+index 9d773d9..a6534a9 100644 -+--- a/libavcodec/hevcdsp.c -++++ b/libavcodec/hevcdsp.c -+@@ -123,6 +123,120 @@ DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters[3][16]) = { -+ #include "hevcdsp_template.c" -+ #undef BIT_DEPTH -+ -++static void hevc_deblocking_boundary_strengths(int pus, int dup, int in_inc, int out_inc, -++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ MvField *curr, MvField *neigh, uint8_t *bs) -++{ -++ for (; pus > 0; pus--) { -++ int strength, out; -++ int curr_refL0 = curr_rpl0[curr->ref_idx[0]]; -++ int curr_refL1 = curr_rpl1[curr->ref_idx[1]]; -++ int neigh_refL0 = neigh_rpl0[neigh->ref_idx[0]]; -++ int neigh_refL1 = neigh_rpl1[neigh->ref_idx[1]]; -++ -++#if 1 // This more directly matches the original implementation -++ if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -++ // same L0 and L1 -++ if (curr_refL0 == neigh_refL0 && -++ curr_refL0 == curr_refL1 && -++ neigh_refL0 == neigh_refL1) { -++ if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) && -++ (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)) -++ strength = 1; -++ else -++ strength = 0; -++ } else if (neigh_refL0 == curr_refL0 && -++ neigh_refL1 == curr_refL1) { -++ if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) -++ strength = 1; -++ else -++ strength = 0; -++ } else if (neigh_refL1 == curr_refL0 && -++ neigh_refL0 == curr_refL1) { -++ if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 || -++ FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4) -++ strength = 1; -++ else -++ strength = 0; -++ } else { -++ strength = 1; -++ } -++ } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -++ Mv curr_mv0, neigh_mv0; -++ -++ if (curr->pred_flag & 1) { -++ curr_mv0 = curr->mv[0]; -++ } else { -++ curr_mv0 = curr->mv[1]; -++ curr_refL0 = curr_refL1; -++ } -++ -++ if (neigh->pred_flag & 1) { -++ neigh_mv0 = neigh->mv[0]; -++ } else { -++ neigh_mv0 = neigh->mv[1]; -++ neigh_refL0 = neigh_refL1; -++ } -++ -++ if (curr_refL0 == neigh_refL0) { -++ if (FFABS(curr_mv0.x - neigh_mv0.x) >= 4 || FFABS(curr_mv0.y - neigh_mv0.y) >= 4) -++ strength = 1; -++ else -++ strength = 0; -++ } else -++ strength = 1; -++ } else -++ strength = 1; -++#else // This has exactly the same effect, but is more suitable for vectorisation -++ Mv curr_mv[2]; -++ Mv neigh_mv[2]; -++ memcpy(curr_mv, curr->mv, sizeof curr_mv); -++ memcpy(neigh_mv, neigh->mv, sizeof neigh_mv); -++ -++ if (!(curr->pred_flag & 2)) { -++ curr_mv[1] = curr_mv[0]; -++ curr_refL1 = curr_refL0; -++ } -++ if (!(neigh->pred_flag & 2)) { -++ neigh_mv[1] = neigh_mv[0]; -++ neigh_refL1 = neigh_refL0; -++ } -++ if (!(curr->pred_flag & 1)) { -++ curr_mv[0] = curr_mv[1]; -++ curr_refL0 = curr_refL1; -++ } -++ if (!(neigh->pred_flag & 1)) { -++ neigh_mv[0] = neigh_mv[1]; -++ neigh_refL0 = neigh_refL1; -++ } -++ -++ strength = 1; -++ -++ strength &= (neigh_refL0 != curr_refL0) | (neigh_refL1 != curr_refL1) | -++ (FFABS(neigh_mv[0].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[0].y) >= 4) | -++ (FFABS(neigh_mv[1].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[1].y) >= 4); -++ -++ strength &= (neigh_refL1 != curr_refL0) | (neigh_refL0 != curr_refL1) | -++ (FFABS(neigh_mv[1].x - curr_mv[0].x) >= 4) | (FFABS(neigh_mv[1].y - curr_mv[0].y) >= 4) | -++ (FFABS(neigh_mv[0].x - curr_mv[1].x) >= 4) | (FFABS(neigh_mv[0].y - curr_mv[1].y) >= 4); -++ -++ strength |= (((curr->pred_flag + 1) ^ (neigh->pred_flag + 1)) >> 2); -++#endif -++ -++ curr += in_inc / sizeof (MvField); -++ neigh += in_inc / sizeof (MvField); -++ -++ for (out = dup; out > 0; out--) -++ { -++ *bs = strength; -++ bs += out_inc; -++ } -++ } -++} -++ -+ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) -+ { -+ #undef FUNC -+@@ -257,6 +371,8 @@ int i = 0; -+ break; -+ } -+ -++ hevcdsp->hevc_deblocking_boundary_strengths = hevc_deblocking_boundary_strengths; -++ -+ if (ARCH_X86) -+ ff_hevc_dsp_init_x86(hevcdsp, bit_depth); -+ if (ARCH_ARM) -+diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h -+index 9f1f6dd..e221e54 100644 -+--- a/libavcodec/hevcdsp.h -++++ b/libavcodec/hevcdsp.h -+@@ -42,6 +42,17 @@ typedef struct SAOParams { -+ uint8_t type_idx[3]; ///< sao_type_idx -+ } SAOParams; -+ -++typedef struct Mv { -++ int16_t x; ///< horizontal component of motion vector -++ int16_t y; ///< vertical component of motion vector -++} Mv; -++ -++typedef struct MvField { -++ DECLARE_ALIGNED(4, Mv, mv)[2]; -++ int8_t ref_idx[2]; -++ int8_t pred_flag; -++} MvField; -++ -+ typedef struct HEVCDSPContext { -+ void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height, -+ struct GetBitContext *gb, int pcm_bit_depth); -+@@ -120,6 +131,9 @@ typedef struct HEVCDSPContext { -+ void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride, -+ int32_t *tc, uint8_t *no_p, -+ uint8_t *no_q); -++ void (*hevc_deblocking_boundary_strengths)(int pus, int dup, int in_inc, int out_inc, -++ int *curr_rpl0, int *curr_rpl1, int *neigh_rpl0, int *neigh_rpl1, -++ MvField *curr, MvField *neigh, uint8_t *bs); -+ } HEVCDSPContext; -+ -+ void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); -+-- -+2.7.4 -+ -+ -+From 619366d6acfd5f040a3116fda97b1146c8e40250 Mon Sep 17 00:00:00 2001 -+From: Peter de Rivaz -+Date: Wed, 15 Jul 2015 09:09:11 +0100 -+Subject: [PATCH 68/68] Only enable qpu when needed -+ -+--- -+ libavcodec/hevc.h | 2 +- -+ libavcodec/rpi_qpu.c | 21 ++++++++++++++++----- -+ 2 files changed, 17 insertions(+), 6 deletions(-) -+ -+diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h -+index 496c0e1..ce14975 100644 -+--- a/libavcodec/hevc.h -++++ b/libavcodec/hevc.h -+@@ -57,7 +57,7 @@ -+ // Define RPI_WORKER to launch a worker thread for pixel processing tasks -+ #define RPI_WORKER -+ // Define RPI_DEBLOCK_VPU to perform deblocking on the VPUs -+- #define RPI_DEBLOCK_VPU -++ //#define RPI_DEBLOCK_VPU -+ -+ #endif -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index 5aa0432..ffd13ca 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -9,7 +9,7 @@ -+ // define RPI_ASYNC to run the VPU in a separate thread, need to make a separate call to check for completion -+ #define RPI_ASYNC -+ // Define RPI_COMBINE_JOBS to find jobs that can be executed in parallel -+-#define RPI_COMBINE_JOBS -++//#define RPI_COMBINE_JOBS -+ -+ #include -+ #include -+@@ -143,9 +143,9 @@ static int gpu_init(volatile struct GPU **gpu) { -+ volatile struct GPU* ptr; -+ if (mb < 0) -+ return -1; -+- -++#ifndef RPI_ASYNC -+ if (qpu_enable(mb, 1)) return -2; -+- -++#endif -+ vcsm_init(); -+ gpu_malloc_uncached_internal(sizeof(struct GPU), &gpu_mem_ptr, mb); -+ ptr = (volatile struct GPU*)gpu_mem_ptr.arm; -+@@ -336,9 +336,9 @@ static void gpu_term(void) -+ vpu_post_code(0, 0, 0, 0, 0, 0, -1, NULL); -+ pthread_join(vpu_thread, &res); -+ } -+-#endif -+- -++#else -+ qpu_enable(mb, 0); -++#endif -+ gpu_free_internal(&gpu_mem_ptr); -+ -+ vcsm_exit(); -+@@ -400,6 +400,7 @@ static void *vpu_start(void *arg) { -+ int count_deblock=0; -+ int count_qpu=0; -+ #endif -++ int qpu_started = 0; -+ while(1) { -+ int i; -+ int *p; // Pointer for a QPU/VPU job -+@@ -427,6 +428,12 @@ static void *vpu_start(void *arg) { -+ if (p[7] == 0 && p[0] == 0 && p[16]==0) -+ goto job_done_early; -+ -++ if (!qpu_started) { -++ int result = qpu_enable(gpu->mb, 1); -++ av_assert0(result==0); -++ qpu_started = 1; -++ } -++ -+ #ifdef RPI_COMBINE_JOBS -+ // First scan for a qpu job -+ for (int x=0;xmb, 0); -++ } -++ -+ return NULL; -+ } -+ -+-- -+2.7.4 -+ -+From a0d0946951b53e64ce103dd61b455f8d1f72caf9 Mon Sep 17 00:00:00 2001 -+From: John Cox -+Date: Tue, 9 Feb 2016 11:57:40 +0000 -+Subject: [PATCH 1/2] Zero copy code v6 -+ -+This version has GPU buffer pooling code -+--- -+ ffmpeg.c | 123 +++++++++----- -+ libavcodec/Makefile | 2 + -+ libavcodec/avcodec.h | 6 + -+ libavcodec/hevc.c | 92 ++++++----- -+ libavcodec/hevc_filter.c | 83 +++++----- -+ libavcodec/rpi_qpu.c | 2 +- -+ libavcodec/rpi_qpu.h | 109 ++++++++++++- -+ libavcodec/rpi_zc.c | 406 +++++++++++++++++++++++++++++++++++++++++++++++ -+ libavcodec/rpi_zc.h | 83 ++++++++++ -+ 9 files changed, 779 insertions(+), 127 deletions(-) -+ create mode 100644 libavcodec/rpi_zc.c -+ create mode 100644 libavcodec/rpi_zc.h -+ -+diff --git a/ffmpeg.c b/ffmpeg.c -+index 50c6e86..953e5b8 100644 -+--- a/ffmpeg.c -++++ b/ffmpeg.c -+@@ -25,7 +25,7 @@ -+ -+ #ifdef RPI -+ #define RPI_DISPLAY -+-//#define RPI_ZERO_COPY -++#define RPI_ZERO_COPY -+ #endif -+ -+ #include "config.h" -+@@ -80,9 +80,7 @@ -+ #include -+ #include -+ #include -+-#ifdef RPI_ZERO_COPY -+-#include "libavcodec/rpi_qpu.h" -+-#endif -++#include "libavcodec/rpi_zc.h" -+ #endif -+ -+ #if HAVE_SYS_RESOURCE_H -+@@ -183,13 +181,7 @@ static void free_input_threads(void); -+ -+ static MMAL_COMPONENT_T* rpi_display = NULL; -+ static MMAL_POOL_T *rpi_pool = NULL; -+- -+-#ifdef RPI_ZERO_COPY -+-static uint8_t *get_vc_handle(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return (uint8_t *)p->vc_handle; -+-} -+-#endif -++static volatile int rpi_display_count = 0; -+ -+ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+ { -+@@ -206,7 +198,7 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+ for (i = 0; i < NUM_BUFFERS; ++i) -+ { -+ MMAL_BUFFER_HEADER_T* buffer = pool->header[i]; -+- void* bufPtr = buffer->data; -++ char * bufPtr = buffer->data; -+ memset(bufPtr, i*30, w*h); -+ memset(bufPtr+w*h, 128, (w*h)/2); -+ } -+@@ -215,23 +207,31 @@ static MMAL_POOL_T* display_alloc_pool(MMAL_PORT_T* port, size_t w, size_t h) -+ return pool; -+ } -+ -+-static void display_cb_input(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -++static void display_cb_input(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { -++#ifdef RPI_ZERO_COPY -++ av_rpi_zc_unref(buffer->user_data); -++ --rpi_display_count; -++#endif -++ mmal_buffer_header_release(buffer); -++} -++ -++static void display_cb_control(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -+ mmal_buffer_header_release(buffer); -+ } -+ -+ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+ { -+ MMAL_COMPONENT_T* display; -+- int w2 = (w+31)&~31; -+- int h2 = (h+15)&~15; -+ MMAL_DISPLAYREGION_T region = -+ { -+- {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -++ .hdr = {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_DEST_RECT, -+ .layer = 2, -+ .fullscreen = 0, -+ .dest_rect = {x, y, w, h} -+ }; -++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(w, h); -++ -+ bcm_host_init(); // TODO is this needed? -+ mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &display); -+ assert(display); -+@@ -240,8 +240,8 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+ -+ MMAL_ES_FORMAT_T* format = display->input[0]->format; -+ format->encoding = MMAL_ENCODING_I420; -+- format->es->video.width = w2; -+- format->es->video.height = h2; -++ format->es->video.width = geo.stride_y; -++ format->es->video.height = geo.height_y; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = w; -+@@ -250,46 +250,75 @@ static MMAL_COMPONENT_T* display_init(size_t x, size_t y, size_t w, size_t h) -+ -+ mmal_component_enable(display); -+ -+- rpi_pool = display_alloc_pool(display->input[0], w2, h2); -++ rpi_pool = display_alloc_pool(display->input[0], geo.stride_y, geo.height_y); -+ -+ mmal_port_enable(display->input[0],display_cb_input); -+- mmal_port_enable(display->control,display_cb_input); -++ mmal_port_enable(display->control,display_cb_control); -+ -+- printf("Allocated display %d %d\n",w,h); -++ printf("Allocated display %dx%d in %dx%d\n", w, h, geo.stride_y, geo.height_y); -+ -+ return display; -+ } -+ -+-static void display_frame(MMAL_COMPONENT_T* display,AVFrame* fr) -++static void display_frame(struct AVCodecContext * const s, MMAL_COMPONENT_T* const display, const AVFrame* const fr) -+ { -+- int w = fr->width; -+- int h = fr->height; -+- int w2 = (w+31)&~31; -+- int h2 = (h+15)&~15; -+ if (!display || !rpi_pool) -+ return; -++ -++ if (rpi_display_count >= 3) { -++ av_log(s, AV_LOG_VERBOSE, "Frame dropped\n"); -++ return; -++ } -++ -+ MMAL_BUFFER_HEADER_T* buf = mmal_queue_get(rpi_pool->queue); -+ if (!buf) { -+- // Running too fast so drop the frame -+- return; -++ // Running too fast so drop the frame -++ printf("Q alloc failure\n"); -++ return; -+ } -+ assert(buf); -+ buf->cmd = 0; -+- buf->length = (w2 * h2 * 3)/2; -+ buf->offset = 0; // Offset to valid data -+ buf->flags = 0; -+ #ifdef RPI_ZERO_COPY -+- buf->data = get_vc_handle(fr->buf[0]); -+- buf->alloc_size = (w2*h2*3)/2; -++{ -++ const AVRpiZcRefPtr fr_buf = av_rpi_zc_ref(s, fr, 1); -++ -++ buf->user_data = fr_buf; -++ buf->data = av_rpi_zc_vc_handle(fr_buf); -++ buf->alloc_size = -++ buf->length = av_rpi_zc_numbytes(fr_buf); -++ -++ ++rpi_display_count; -++} -+ #else -++{ -++#error YYY -++ int w = fr->width; -++ int h = fr->height; -++ int w2 = (w+31)&~31; -++ int h2 = (h+15)&~15; -++ -++ buf->length = (w2 * h2 * 3)/2; -++ buf->user_data = NULL; -++ -+ //mmal_buffer_header_mem_lock(buf); -+ memcpy(buf->data, fr->data[0], w2 * h); -+ memcpy(buf->data+w2*h2, fr->data[1], w2 * h / 4); -+ memcpy(buf->data+w2*h2*5/4, fr->data[2], w2 * h / 4); -+ //mmal_buffer_header_mem_unlock(buf); -++} -+ #endif -+ -+- mmal_port_send_buffer(display->input[0], buf); // I assume this will automatically get released -++ while (rpi_display_count >= 3) { -++ usleep(5000); -++ } -++ -++ if (mmal_port_send_buffer(display->input[0], buf) != MMAL_SUCCESS) -++ { -++ printf("** send failed: depth=%d\n", rpi_display_count); -++ display_cb_input(NULL, buf); -++ } -+ } -+ -+ static void display_exit(MMAL_COMPONENT_T* display) -+@@ -687,6 +716,11 @@ static void ffmpeg_cleanup(int ret) -+ avformat_close_input(&input_files[i]->ctx); -+ av_freep(&input_files[i]); -+ } -++ -++#ifdef RPI_DISPLAY -++ display_exit(rpi_display); -++#endif -++ -+ for (i = 0; i < nb_input_streams; i++) { -+ InputStream *ist = input_streams[i]; -+ -+@@ -698,6 +732,9 @@ static void ffmpeg_cleanup(int ret) -+ av_freep(&ist->filters); -+ av_freep(&ist->hwaccel_device); -+ -++#ifdef RPI_ZERO_COPY -++ av_rpi_zc_uninit(ist->dec_ctx); -++#endif -+ avcodec_free_context(&ist->dec_ctx); -+ -+ av_freep(&input_streams[i]); -+@@ -729,9 +766,6 @@ static void ffmpeg_cleanup(int ret) -+ term_exit(); -+ ffmpeg_exited = 1; -+ -+-#ifdef RPI_DISPLAY -+- display_exit(rpi_display); -+-#endif -+ } -+ -+ void remove_avoptions(AVDictionary **a, AVDictionary *b) -+@@ -1091,18 +1125,19 @@ static void do_video_out(AVFormatContext *s, -+ int frame_size = 0; -+ InputStream *ist = NULL; -+ AVFilterContext *filter = ost->filter->filter; -++ -++ if (ost->source_index >= 0) -++ ist = input_streams[ost->source_index]; -++ -+ #ifdef RPI_DISPLAY -+- if (next_picture) -++ if (next_picture && ist != NULL) -+ { -+- if (!rpi_display) -++ if (!rpi_display) -+ rpi_display = display_init(0,0,next_picture->width,next_picture->height); -+- display_frame(rpi_display,next_picture); -++ display_frame(ist->dec_ctx, rpi_display, next_picture); -+ } -+ #endif -+ -+- if (ost->source_index >= 0) -+- ist = input_streams[ost->source_index]; -+- -+ if (filter->inputs[0]->frame_rate.num > 0 && -+ filter->inputs[0]->frame_rate.den > 0) -+ duration = 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base)); -+@@ -2708,6 +2743,12 @@ static int init_input_stream(int ist_index, char *error, int error_len) -+ ist->dec_ctx->opaque = ist; -+ ist->dec_ctx->get_format = get_format; -+ ist->dec_ctx->get_buffer2 = get_buffer; -++ -++#ifdef RPI_ZERO_COPY -++ // Overrides the above get_buffer2 -++ av_rpi_zc_init(ist->dec_ctx); -++#endif -++ -+ ist->dec_ctx->thread_safe_callbacks = 1; -+ -+ av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0); -+diff --git a/libavcodec/Makefile b/libavcodec/Makefile -+index 03065cd..21e4514 100644 -+--- a/libavcodec/Makefile -++++ b/libavcodec/Makefile -+@@ -9,6 +9,7 @@ HEADERS = avcodec.h \ -+ rpi_shader.h \ -+ rpi_mailbox.h \ -+ rpi_hevc_transform.h \ -++ rpi_zc.h \ -+ d3d11va.h \ -+ dirac.h \ -+ dv_profile.h \ -+@@ -50,6 +51,7 @@ OBJS = allcodecs.o \ -+ rpi_qpu.o \ -+ rpi_shader.o \ -+ rpi_mailbox.o \ -++ rpi_zc.o \ -+ vorbis_parser.o \ -+ xiph.o \ -+ -+diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -+index 39713ed..a1ba217 100644 -+--- a/libavcodec/avcodec.h -++++ b/libavcodec/avcodec.h -+@@ -3505,6 +3505,12 @@ typedef struct AVCodecContext { -+ #define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 -+ #endif -+ -++ /** -++ * Opaque pointer for use by replacement get_buffer2 code -++ * -++ * @author jc (08/02/2016) -++ */ -++ void * get_buffer_context; -+ } AVCodecContext; -+ -+ AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -+diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c -+index 8437e10..51736c7 100644 -+--- a/libavcodec/hevc.c -++++ b/libavcodec/hevc.c -+@@ -114,10 +114,6 @@ static uint32_t rpi_filter_coefs[8][1] = { -+ { ENCODE_COEFFS( -2, 10, 58, -2) } -+ }; -+ -+-static uint32_t get_vc_address(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return p->vc; -+-} -+ #endif -+ -+ -+@@ -2197,9 +2193,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); -+ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+@@ -2207,7 +2203,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ } else { -+ *y++ = 1; // Weight of 1 and offset of 0 -+ } -+- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+@@ -2246,8 +2242,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); -+ *u++ = ( (bwframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->curr_u_mvs = u; -+@@ -2297,9 +2293,9 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + 8 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); -+ *y++ = ( (bw<16 ? bw : 16) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ if (weight_flag) { -+@@ -2307,7 +2303,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ } else { -+ *y++ = 1; // Weight of 1 and offset of 0 -+ } -+- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter; -+ } -+ } -+@@ -2347,8 +2343,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); -+ *u++ = ( (bwsh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0] -+ *u++ = rpi_filter_coefs[_mx][0]; -+@@ -2360,8 +2356,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ *u++ = 1; // Weight of 1 and offset of 0 -+ *u++ = 1; -+ } -+- *u++ = (get_vc_address(s->frame->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->curr_u_mvs = u; -+@@ -2403,13 +2399,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ int bw = nPbW-start_x; -+ int bh = nPbH-start_y; -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y1 - 3 + start_y) << 16) + ( (x1 - 3 + start_x) & 0xffff); -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref0->frame); -+ y++[-RPI_LUMA_COMMAND_WORDS] = ((y2 - 3 + start_y) << 16) + ( (x2 - 3 + start_x) & 0xffff); // Second fetch is for ref1 -+- y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[0]); -++ y++[-RPI_LUMA_COMMAND_WORDS] = get_vc_address_y(ref1->frame); -+ *y++ = ( (bw<8 ? bw : 8) << 16 ) + (bh<16 ? bh : 16); -+ *y++ = my2_mx2_my_mx; -+ *y++ = 1; // B frame weighted prediction not supported -+- *y++ = (get_vc_address(s->frame->buf[0]) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -++ *y++ = (get_vc_address_y(s->frame) + x0 + start_x + (start_y + y0) * s->frame->linesize[0]); -+ y++[-RPI_LUMA_COMMAND_WORDS] = s->mc_filter_b; -+ } -+ } -+@@ -2453,8 +2449,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, -+ u++[-RPI_CHROMA_COMMAND_WORDS] = s->mc_filter_uv_b0; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x1_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y1_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref0->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref0->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref0->frame); -+ *u++ = ( (bwmc_filter_uv_b; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = x2_c - 1 + start_x; -+ u++[-RPI_CHROMA_COMMAND_WORDS] = y2_c - 1 + start_y; -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[1]); -+- u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address(ref1->frame->buf[2]); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_u(ref1->frame); -++ u++[-RPI_CHROMA_COMMAND_WORDS] = get_vc_address_v(ref1->frame); -+ *u++ = ( (bwframe->buf[1]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -+- *u++ = (get_vc_address(s->frame->buf[2]) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -++ *u++ = (get_vc_address_u(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[1]); -++ *u++ = (get_vc_address_v(s->frame) + x0_c + start_x + (start_y + y0_c) * s->frame->linesize[2]); -+ } -+ } -+ s->curr_u_mvs = u; -+@@ -3270,12 +3266,13 @@ static int32_t filter8_luma(uint8_t *data, int x0, int y0, int pitch, int my_mx, -+ return vsum; -+ } -+ -+-static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, int cIdx) -++static uint8_t *test_frame(HEVCContext *s,uint32_t p, AVFrame *frame, const int cIdx) -+ { -+ //int pic_width = s->ps.sps->width >> s->ps.sps->hshift[cIdx]; -+ int pic_height = s->ps.sps->height >> s->ps.sps->vshift[cIdx]; -+ int pitch = frame->linesize[cIdx]; -+- uint32_t base = get_vc_address(frame->buf[cIdx]); -++ uint32_t base = c_idx == 0 ? get_vc_address_y(frame); -++ c_idx == 1 ? get_vc_address_u(frame) : get_vc_address_v(frame); -+ if (p>=base && pdata[cIdx] + (p-base); -+ } -+@@ -3562,6 +3559,7 @@ static void rpi_launch_vpu_qpu(HEVCContext *s) -+ #ifdef RPI -+ -+ #ifndef RPI_FAST_CACHEFLUSH -++#error RPI_FAST_CACHEFLUSH is broken -+ static void flush_buffer(AVBufferRef *bref) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+ gpu_cache_flush(p); -+@@ -3572,7 +3570,7 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); -+ int n = s->ps.sps->height; -+ int curr_y = 0; -+ int curr_uv = 0; -+@@ -3580,21 +3578,21 @@ static void flush_frame(HEVCContext *s,AVFrame *frame) -+ int sz,base; -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)(p->arm) + base; -++ iocache.s[0].addr = (int)(p.arm) + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)(p->arm) + base; -++ iocache.s[1].addr = (int)(p.arm) + base; -+ iocache.s[1].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)(p->arm) + base; -++ iocache.s[2].addr = (int)(p.arm) + base; -+ iocache.s[2].size = sz; -+ vcsm_clean_invalid( &iocache ); -+ #else -+@@ -3612,7 +3610,7 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM -+ int curr_y; -+ int curr_uv; -+ int n_uv; -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(s->frame); -+ int sz,base; -+ int (*d)[2] = s->dblk_cmds[job]; -+ int low=(*d)[1]; -+@@ -3629,21 +3627,21 @@ static void flush_frame3(HEVCContext *s,AVFrame *frame,GPU_MEM_PTR_T *p0,GPU_MEM -+ -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- iocache.s[0].handle = p->vcsm_handle; -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)(p->arm) + base; -++ iocache.s[0].addr = (int)(p.arm) + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)(p->arm) + base; -++ iocache.s[1].addr = (int)(p.arm) + base; -+ iocache.s[1].size = sz; -+- p = av_buffer_pool_opaque(frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)(p->arm) + base; -++ iocache.s[2].addr = (int)(p.arm) + base; -+ iocache.s[2].size = sz; -+ -+ iocache.s[3].handle = p0->vcsm_handle; -+diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c -+index 826a82f..c4fa305 100644 -+--- a/libavcodec/hevc_filter.c -++++ b/libavcodec/hevc_filter.c -+@@ -879,17 +879,25 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, -+ #undef CR -+ -+ #ifdef RPI_INTER_QPU -+-static void flush_buffer(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- gpu_cache_flush(p); -++static void flush_buffer_y(const AVFrame * const frame) { -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_y(frame); -++ gpu_cache_flush(&p); -+ } -+ -+-// Return Physical address for this image -+-static uint32_t get_vc_address(AVBufferRef *bref) { -+- GPU_MEM_PTR_T *p = av_buffer_pool_opaque(bref); -+- return p->vc; -++static void flush_buffer_u(const AVFrame * const frame) { -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_u(frame); -++ gpu_cache_flush(&p); -+ } -+ -++static void flush_buffer_v(const AVFrame * const frame) { -++ GPU_MEM_PTR_T p = get_gpu_mem_ptr_v(frame); -++ gpu_cache_flush(&p); -++} -++ -++ -++#ifdef RPI_DEBLOCK_VPU -++#error Not fixed yet -++ -+ // ff_hevc_flush_buffer_lines -+ // flushes and invalidates all pixel rows in [start,end-1] -+ static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int flush_luma, int flush_chroma) -+@@ -901,44 +909,44 @@ static void ff_hevc_flush_buffer_lines(HEVCContext *s, int start, int end, int f -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+- GPU_MEM_PTR_T *p; -++ GPU_MEM_PTR_T p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+ if (flush_chroma) { -+- p = av_buffer_pool_opaque(s->frame->buf[1]); -+- iocache.s[0].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_u(s->frame); -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)p->arm + base; -++ iocache.s[0].addr = (int)p.arm + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(s->frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)p->arm + base; -++ iocache.s[1].addr = (int)p.arm + base; -+ iocache.s[1].size = sz; -+ } -+ if (flush_luma) { -+- p = av_buffer_pool_opaque(s->frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)p->arm + base; -++ iocache.s[2].addr = (int)p.arm + base; -+ iocache.s[2].size = sz; -+ } -+ vcsm_clean_invalid( &iocache ); -+ #else -+ if (flush_chroma) { -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ flush_buffer_u(s->frame); -++ flush_buffer_v(s->frame); -+ } -+ if (flush_luma) { -+- flush_buffer(s->frame->buf[0]); -++ flush_buffer_y(s->frame); -+ } -+ #endif -+ } -+- -++#endif -+ -+ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ { -+@@ -950,37 +958,37 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ int curr_uv = curr_y >> s->ps.sps->vshift[1]; -+ int n_uv = n >> s->ps.sps->vshift[1]; -+ int sz,base; -+- GPU_MEM_PTR_T *p; -++ GPU_MEM_PTR_T p; -+ if (curr_uv < 0) curr_uv = 0; -+ if (n_uv<=curr_uv) { return; } -+ sz = s->frame->linesize[1] * (n_uv-curr_uv); -+ base = s->frame->linesize[1] * curr_uv; -+- p = av_buffer_pool_opaque(s->frame->buf[1]); -+- iocache.s[0].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_u(s->frame); -++ iocache.s[0].handle = p.vcsm_handle; -+ iocache.s[0].cmd = 3; // clean+invalidate -+- iocache.s[0].addr = (int)p->arm + base; -++ iocache.s[0].addr = (int)p.arm + base; -+ iocache.s[0].size = sz; -+- p = av_buffer_pool_opaque(s->frame->buf[2]); -+- iocache.s[1].handle = p->vcsm_handle; -++ p = get_gpu_mem_ptr_v(s->frame); -++ iocache.s[1].handle = p.vcsm_handle; -+ iocache.s[1].cmd = 3; // clean+invalidate -+- iocache.s[1].addr = (int)p->arm + base; -++ iocache.s[1].addr = (int)p.arm + base; -+ iocache.s[1].size = sz; -+ -+ #ifdef RPI_LUMA_QPU -+- p = av_buffer_pool_opaque(s->frame->buf[0]); -++ p = get_gpu_mem_ptr_y(s->frame); -+ sz = s->frame->linesize[0] * (n-curr_y); -+ base = s->frame->linesize[0] * curr_y; -+- iocache.s[2].handle = p->vcsm_handle; -++ iocache.s[2].handle = p.vcsm_handle; -+ iocache.s[2].cmd = 3; // clean+invalidate -+- iocache.s[2].addr = (int)p->arm + base; -++ iocache.s[2].addr = (int)p.arm + base; -+ iocache.s[2].size = sz; -+ #endif -+ vcsm_clean_invalid( &iocache ); -+ #else -+- flush_buffer(s->frame->buf[1]); -+- flush_buffer(s->frame->buf[2]); -++ flush_buffer_u(s->frame); -++ flush_buffer_v(s->frame); -+ #ifdef RPI_LUMA_QPU -+- flush_buffer(s->frame->buf[0]); -++ flush_buffer_y(s->frame); -+ #endif -+ -+ #endif -+@@ -992,6 +1000,7 @@ void ff_hevc_flush_buffer(HEVCContext *s, ThreadFrame *f, int n) -+ #endif -+ -+ #ifdef RPI_DEBLOCK_VPU -++#error XXX -+ /* rpi_deblock deblocks an entire row of ctbs using the VPU */ -+ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+ { -+@@ -1000,21 +1009,21 @@ static void rpi_deblock(HEVCContext *s, int y, int ctb_size) -+ // TODO flush buffer of beta/tc setup when it becomes cached -+ -+ // Prepare three commands at once to avoid calling overhead -+- s->vpu_cmds_arm[0][0] = get_vc_address(s->frame->buf[0]) + s->frame->linesize[0] * y; -++ s->vpu_cmds_arm[0][0] = get_vc_address_y(s->frame) + s->frame->linesize[0] * y; -+ s->vpu_cmds_arm[0][1] = s->frame->linesize[0]; -+ s->vpu_cmds_arm[0][2] = s->setup_width; -+ s->vpu_cmds_arm[0][3] = (int) ( s->y_setup_vc + s->setup_width * (y>>4) ); -+ s->vpu_cmds_arm[0][4] = ctb_size>>4; -+ s->vpu_cmds_arm[0][5] = 2; -+ -+- s->vpu_cmds_arm[1][0] = get_vc_address(s->frame->buf[1]) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -++ s->vpu_cmds_arm[1][0] = get_vc_address_u(s->frame) + s->frame->linesize[1] * (y>> s->ps.sps->vshift[1]); -+ s->vpu_cmds_arm[1][1] = s->frame->linesize[1]; -+ s->vpu_cmds_arm[1][2] = s->uv_setup_width; -+ s->vpu_cmds_arm[1][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -+ s->vpu_cmds_arm[1][4] = (ctb_size>>4)>> s->ps.sps->vshift[1]; -+ s->vpu_cmds_arm[1][5] = 3; -+ -+- s->vpu_cmds_arm[2][0] = get_vc_address(s->frame->buf[2]) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -++ s->vpu_cmds_arm[2][0] = get_vc_address_v(s->frame) + s->frame->linesize[2] * (y>> s->ps.sps->vshift[2]); -+ s->vpu_cmds_arm[2][1] = s->frame->linesize[2]; -+ s->vpu_cmds_arm[2][2] = s->uv_setup_width; -+ s->vpu_cmds_arm[2][3] = (int) ( s->uv_setup_vc + s->uv_setup_width * ((y>>4)>> s->ps.sps->vshift[1]) ); -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index ffd13ca..b0c9bc5 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -250,7 +250,7 @@ int gpu_get_mailbox(void) -+ } -+ -+ // Call this to clean and invalidate a region of memory -+-void gpu_cache_flush(GPU_MEM_PTR_T *p) -++void gpu_cache_flush(const GPU_MEM_PTR_T * const p) -+ { -+ #ifdef RPI_FAST_CACHEFLUSH -+ struct vcsm_user_clean_invalid_s iocache = {}; -+diff --git a/libavcodec/rpi_qpu.h b/libavcodec/rpi_qpu.h -+index 81c2bb1..b913f79 100644 -+--- a/libavcodec/rpi_qpu.h -++++ b/libavcodec/rpi_qpu.h -+@@ -2,8 +2,11 @@ -+ #define RPI_QPU_H -+ -+ // Define RPI_FAST_CACHEFLUSH to use the VCSM cache flush code -++// *** N.B. Code has rotted & crashes if this is unset (before this set of changes) -+ #define RPI_FAST_CACHEFLUSH -+ -++#define RPI_ONE_BUF 1 -++ -+ typedef struct gpu_mem_ptr_s { -+ unsigned char *arm; // Pointer to memory mapped on ARM side -+ int vc_handle; // Videocore handle of relocatable memory -+@@ -16,9 +19,113 @@ typedef struct gpu_mem_ptr_s { -+ extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -+ extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -+ extern void gpu_free(GPU_MEM_PTR_T *p); -+-extern void gpu_cache_flush(GPU_MEM_PTR_T *p); -++extern void gpu_cache_flush(const GPU_MEM_PTR_T * const p); -+ extern void gpu_cache_flush3(GPU_MEM_PTR_T *p0,GPU_MEM_PTR_T *p1,GPU_MEM_PTR_T *p2); -+ -++#include "libavutil/frame.h" -++#if !RPI_ONE_BUF -++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[0]); -++ return p->vc; -++} -++ -++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[1]); -++ return p->vc; -++} -++ -++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -++ GPU_MEM_PTR_T *p = av_buffer_pool_opaque(frame->buf[2]); -++ return p->vc; -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[0]); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[1]); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -++ return *(GPU_MEM_PTR_T *)av_buffer_pool_opaque(frame->buf[2]); -++} -++ -++#else -++ -++static inline int gpu_is_buf1(const AVFrame * const frame) -++{ -++ return frame->buf[1] == NULL; -++} -++ -++static inline GPU_MEM_PTR_T * gpu_buf1_gmem(const AVFrame * const frame) -++{ -++ return av_buffer_get_opaque(frame->buf[0]); -++} -++ -++static inline GPU_MEM_PTR_T * gpu_buf3_gmem(const AVFrame * const frame, const int n) -++{ -++ return av_buffer_pool_opaque(frame->buf[n]); -++} -++ -++ -++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -++ return gpu_is_buf1(frame) ? gpu_buf1_gmem(frame)->vc : gpu_buf3_gmem(frame, 0)->vc; -++} -++ -++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -++ return gpu_is_buf1(frame) ? -++ gpu_buf1_gmem(frame)->vc + frame->data[1] - frame->data[0] : -++ gpu_buf3_gmem(frame, 1)->vc; -++} -++ -++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -++ return gpu_is_buf1(frame) ? -++ gpu_buf1_gmem(frame)->vc + frame->data[2] - frame->data[0] : -++ gpu_buf3_gmem(frame, 2)->vc; -++} -++ -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -++ if (gpu_is_buf1(frame)) -++ { -++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -++ g.numbytes = frame->data[1] - frame->data[0]; -++ return g; -++ } -++ else -++ return *gpu_buf3_gmem(frame, 0); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -++ if (gpu_is_buf1(frame)) -++ { -++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -++ g.arm += frame->data[1] - frame->data[0]; -++ g.vc += frame->data[1] - frame->data[0]; -++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -++ return g; -++ } -++ else -++ return *gpu_buf3_gmem(frame, 1); -++} -++ -++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -++ if (gpu_is_buf1(frame)) -++ { -++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -++ g.arm += frame->data[2] - frame->data[0]; -++ g.vc += frame->data[2] - frame->data[0]; -++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -++ return g; -++ } -++ else -++ return *gpu_buf3_gmem(frame, 2); -++} -++ -++#endif -++ -++ -+ // QPU specific functions -+ extern void qpu_run_shader8(int code, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8); -+ extern void qpu_run_shader12(int code, int num, int code2, int num2, int unifs1, int unifs2, int unifs3, int unifs4, int unifs5, int unifs6, int unifs7, int unifs8, int unifs9, int unifs10, int unifs11, int unifs12); -+diff --git a/libavcodec/rpi_zc.c b/libavcodec/rpi_zc.c -+new file mode 100644 -+index 0000000..9580165 -+--- /dev/null -++++ b/libavcodec/rpi_zc.c -+@@ -0,0 +1,406 @@ -++#include "config.h" -++#ifdef RPI -++#include "rpi_qpu.h" -++#include "rpi_zc.h" -++ -++#include "libavutil/buffer_internal.h" -++ -++struct ZcPoolEnt; -++ -++typedef struct ZcPool -++{ -++ int numbytes; -++ struct ZcPoolEnt * head; -++ pthread_mutex_t lock; -++} ZcPool; -++ -++typedef struct ZcPoolEnt -++{ -++ // It is important that we start with gmem as other bits of code will expect to see that -++ GPU_MEM_PTR_T gmem; -++ struct ZcPoolEnt * next; -++ struct ZcPool * pool; -++} ZcPoolEnt; -++ -++static ZcPoolEnt * zc_pool_ent_alloc(ZcPool * const pool, const int size) -++{ -++ ZcPoolEnt * const zp = av_malloc(sizeof(ZcPoolEnt)); -++ -++ if (zp == NULL) { -++ av_log(NULL, AV_LOG_ERROR, "av_malloc(ZcPoolEnt) failed\n"); -++ goto fail0; -++ } -++ -++ if (gpu_malloc_cached(size, &zp->gmem) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "av_gpu_malloc_cached(%d) failed\n", size); -++ goto fail1; -++ } -++ -++ zp->next = NULL; -++ zp->pool = pool; -++ return zp; -++ -++fail1: -++ av_free(zp); -++fail0: -++ return NULL; -++} -++ -++static void zc_pool_ent_free(ZcPoolEnt * const zp) -++{ -++ gpu_free(&zp->gmem); -++ av_free(zp); -++} -++ -++static void zc_pool_flush(ZcPool * const pool) -++{ -++ ZcPoolEnt * p = pool->head; -++ pool->head = NULL; -++ while (p != NULL) -++ { -++ ZcPoolEnt * const zp = p; -++ p = p->next; -++ zc_pool_ent_free(zp); -++ } -++} -++ -++static ZcPoolEnt * zc_pool_alloc(ZcPool * const pool, const int numbytes) -++{ -++ ZcPoolEnt * zp; -++ pthread_mutex_lock(&pool->lock); -++ -++ if (numbytes != pool->numbytes) -++ { -++ zc_pool_flush(pool); -++ pool->numbytes = numbytes; -++ } -++ -++ if (pool->head != NULL) -++ { -++ zp = pool->head; -++ pool->head = zp->next; -++ } -++ else -++ { -++ zp = zc_pool_ent_alloc(pool, numbytes); -++ } -++ -++ pthread_mutex_unlock(&pool->lock); -++ return zp; -++} -++ -++static void zc_pool_free(ZcPoolEnt * const zp) -++{ -++ ZcPool * const pool = zp == NULL ? NULL : zp->pool; -++ if (zp != NULL) -++ { -++ pthread_mutex_lock(&pool->lock); -++ if (pool->numbytes == zp->gmem.numbytes) -++ { -++ zp->next = pool->head; -++ pool->head = zp; -++ pthread_mutex_unlock(&pool->lock); -++ } -++ else -++ { -++ pthread_mutex_unlock(&pool->lock); -++ zc_pool_ent_free(zp); -++ } -++ } -++} -++ -++static void -++zc_pool_init(ZcPool * const pool) -++{ -++ pool->numbytes = -1; -++ pool->head = NULL; -++ pthread_mutex_init(&pool->lock, NULL); -++} -++ -++static void -++zc_pool_destroy(ZcPool * const pool) -++{ -++ pool->numbytes = -1; -++ zc_pool_flush(pool); -++ pthread_mutex_destroy(&pool->lock); -++} -++ -++ -++typedef struct AVZcEnv -++{ -++ ZcPool pool; -++} ZcEnv; -++ -++// Callback when buffer unrefed to zero -++static void rpi_free_display_buffer(void *opaque, uint8_t *data) -++{ -++ ZcPoolEnt *const zp = opaque; -++// printf("%s: data=%p\n", __func__, data); -++ zc_pool_free(zp); -++} -++ -++static inline GPU_MEM_PTR_T * pic_gm_ptr(AVBufferRef * const buf) -++{ -++ // Kludge where we check the free fn to check this is really -++ // one of our buffers - can't think of a better way -++ return buf == NULL || buf->buffer->free != rpi_free_display_buffer ? NULL : -++ av_buffer_get_opaque(buf); -++} -++ -++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -++ const unsigned int video_width, const unsigned int video_height) -++{ -++ AVRpiZcFrameGeometry geo; -++ geo.stride_y = (video_width + 32 + 31) & ~31; -++ geo.stride_c = geo.stride_y / 2; -++// geo.height_y = (video_height + 15) & ~15; -++ geo.height_y = (video_height + 32 + 31) & ~31; -++ geo.height_c = geo.height_y / 2; -++ return geo; -++} -++ -++static AVBufferRef * rpi_buf_pool_alloc(ZcPool * const pool, int size) -++{ -++ ZcPoolEnt *const zp = zc_pool_alloc(pool, size); -++ AVBufferRef * buf; -++ -++ if (zp == NULL) { -++ av_log(NULL, AV_LOG_ERROR, "zc_pool_alloc(%d) failed\n", size); -++ goto fail0; -++ } -++ -++ if ((buf = av_buffer_create(zp->gmem.arm, size, rpi_free_display_buffer, zp, AV_BUFFER_FLAG_READONLY)) == NULL) -++ { -++ av_log(NULL, AV_LOG_ERROR, "av_buffer_create() failed\n"); -++ goto fail2; -++ } -++ -++ return buf; -++ -++fail2: -++ zc_pool_free(zp); -++fail0: -++ return NULL; -++} -++ -++static int rpi_get_display_buffer(struct AVCodecContext * const s, AVFrame * const frame) -++{ -++ ZcEnv *const zc = s->get_buffer_context; -++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(frame->width, frame->height); -++ const unsigned int size_y = geo.stride_y * geo.height_y; -++ const unsigned int size_c = geo.stride_c * geo.height_c; -++ const unsigned int size_pic = size_y + size_c * 2; -++ AVBufferRef * buf; -++ unsigned int i; -++ -++// printf("Do local alloc: format=%#x, %dx%d: %u\n", frame->format, frame->width, frame->height, size_pic); -++ -++ if ((buf = rpi_buf_pool_alloc(&zc->pool, size_pic)) == NULL) -++ { -++ av_log(s, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); -++ return AVERROR(ENOMEM); -++ } -++ -++ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { -++ frame->buf[i] = NULL; -++ frame->data[i] = NULL; -++ frame->linesize[i] = 0; -++ } -++ -++ frame->buf[0] = buf; -++ frame->linesize[0] = geo.stride_y; -++ frame->linesize[1] = geo.stride_c; -++ frame->linesize[2] = geo.stride_c; -++ frame->data[0] = buf->data; -++ frame->data[1] = frame->data[0] + size_y; -++ frame->data[2] = frame->data[1] + size_c; -++ frame->extended_data = frame->data; -++ // Leave extended buf alone -++ -++ return 0; -++} -++ -++ -++#define RPI_GET_BUFFER2 1 -++ -++int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags) -++{ -++#if !RPI_GET_BUFFER2 -++ return avcodec_default_get_buffer2(s, frame, flags); -++#else -++ int rv; -++ -++ if ((s->codec->capabilities & AV_CODEC_CAP_DR1) == 0 || -++ frame->format != AV_PIX_FMT_YUV420P) -++ { -++// printf("Do default alloc: format=%#x\n", frame->format); -++ rv = avcodec_default_get_buffer2(s, frame, flags); -++ } -++ else -++ { -++ rv = rpi_get_display_buffer(s, frame); -++ } -++ -++#if 0 -++ printf("%s: %dx%d lsize=%d/%d/%d data=%p/%p/%p bref=%p/%p/%p opaque[0]=%p\n", __func__, -++ frame->width, frame->height, -++ frame->linesize[0], frame->linesize[1], frame->linesize[2], -++ frame->data[0], frame->data[1], frame->data[2], -++ frame->buf[0], frame->buf[1], frame->buf[2], -++ av_buffer_get_opaque(frame->buf[0])); -++#endif -++ return rv; -++#endif -++} -++ -++ -++static AVBufferRef * zc_copy(struct AVCodecContext * const s, -++ const AVFrame * const src) -++{ -++ AVFrame dest_frame; -++ AVFrame * const dest = &dest_frame; -++ unsigned int i; -++ uint8_t * psrc, * pdest; -++ -++ dest->width = src->width; -++ dest->height = src->height; -++ -++ if (rpi_get_display_buffer(s, dest) != 0) -++ { -++ return NULL; -++ } -++ -++ for (i = 0, psrc = src->data[0], pdest = dest->data[0]; -++ i != dest->height; -++ ++i, psrc += src->linesize[0], pdest += dest->linesize[0]) -++ { -++ memcpy(pdest, psrc, dest->width); -++ } -++ for (i = 0, psrc = src->data[1], pdest = dest->data[1]; -++ i != dest->height / 2; -++ ++i, psrc += src->linesize[1], pdest += dest->linesize[1]) -++ { -++ memcpy(pdest, psrc, dest->width / 2); -++ } -++ for (i = 0, psrc = src->data[2], pdest = dest->data[2]; -++ i != dest->height / 2; -++ ++i, psrc += src->linesize[2], pdest += dest->linesize[2]) -++ { -++ memcpy(pdest, psrc, dest->width / 2); -++ } -++ -++ return dest->buf[0]; -++} -++ -++ -++AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, -++ const AVFrame * const frame, const int maycopy) -++{ -++ assert(s != NULL); -++ -++ if (frame->format != AV_PIX_FMT_YUV420P) -++ { -++ av_log(s, AV_LOG_WARNING, "%s: *** Format not YUV420P: %d\n", __func__, frame->format); -++ return NULL; -++ } -++ -++ if (frame->buf[1] != NULL) -++ { -++ if (maycopy) -++ { -++ av_log(s, AV_LOG_INFO, "%s: *** Not a single buf frame: copying\n", __func__); -++ return zc_copy(s, frame); -++ } -++ else -++ { -++ av_log(s, AV_LOG_WARNING, "%s: *** Not a single buf frame: NULL\n", __func__); -++ return NULL; -++ } -++ } -++ -++ if (pic_gm_ptr(frame->buf[0]) == NULL) -++ { -++ if (maycopy) -++ { -++ av_log(s, AV_LOG_INFO, "%s: *** Not one of our buffers: copying\n", __func__); -++ return zc_copy(s, frame); -++ } -++ else -++ { -++ av_log(s, AV_LOG_WARNING, "%s: *** Not one of our buffers: NULL\n", __func__); -++ return NULL; -++ } -++ } -++ -++ return av_buffer_ref(frame->buf[0]); -++} -++ -++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref) -++{ -++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -++ return p == NULL ? -1 : p->vc_handle; -++} -++ -++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref) -++{ -++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -++ return p == NULL ? 0 : p->numbytes; -++} -++ -++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref) -++{ -++ if (fr_ref != NULL) -++ { -++ av_buffer_unref(&fr_ref); -++ } -++} -++ -++AVZcEnvPtr av_rpi_zc_env_alloc(void) -++{ -++ ZcEnv * const zc = av_mallocz(sizeof(ZcEnv)); -++ if (zc == NULL) -++ { -++ av_log(NULL, AV_LOG_ERROR, "av_rpi_zc_env_alloc: Context allocation failed\n"); -++ return NULL; -++ } -++ -++ zc_pool_init(&zc->pool); -++ return zc; -++} -++ -++void av_rpi_zc_env_free(AVZcEnvPtr zc) -++{ -++ if (zc != NULL) -++ { -++ zc_pool_destroy(&zc->pool); ; -++ av_free(zc); -++ } -++} -++ -++int av_rpi_zc_init(struct AVCodecContext * const s) -++{ -++ ZcEnv * const zc = av_rpi_zc_env_alloc(); -++ if (zc == NULL) -++ { -++ return AVERROR(ENOMEM); -++ } -++ -++ s->get_buffer_context = zc; -++ s->get_buffer2 = av_rpi_zc_get_buffer2; -++ return 0; -++} -++ -++void av_rpi_zc_uninit(struct AVCodecContext * const s) -++{ -++ if (s->get_buffer2 == av_rpi_zc_get_buffer2) -++ { -++ ZcEnv * const zc = s->get_buffer_context; -++ s->get_buffer2 = avcodec_default_get_buffer2; -++ s->get_buffer_context = NULL; -++ av_rpi_zc_env_free(zc); -++ } -++} -++ -++#endif // RPI -++ -+diff --git a/libavcodec/rpi_zc.h b/libavcodec/rpi_zc.h -+new file mode 100644 -+index 0000000..f0109f4 -+--- /dev/null -++++ b/libavcodec/rpi_zc.h -+@@ -0,0 +1,83 @@ -++#ifndef LIBAVCODEC_RPI_ZC_H -++#define LIBAVCODEC_RPI_ZC_H -++ -++// Zero-Copy frame code for RPi -++// RPi needs Y/U/V planes to be contiguous for display. By default -++// ffmpeg will allocate separated planes so a memcpy is needed before -++// display. This code prodes a method a making ffmpeg allocate a single -++// bit of memory for the frame when can then be refrence counted until -++// display ahs finsihed with it. -++ -++#include "libavutil/frame.h" -++#include "libavcodec/avcodec.h" -++ -++// "Opaque" pointer to whatever we are using as a buffer reference -++typedef AVBufferRef * AVRpiZcRefPtr; -++ -++struct AVZcEnv; -++typedef struct AVZcEnv * AVZcEnvPtr; -++ -++typedef struct AVRpiZcFrameGeometry -++{ -++ unsigned int stride_y; -++ unsigned int height_y; -++ unsigned int stride_c; -++ unsigned int height_c; -++} AVRpiZcFrameGeometry; -++ -++ -++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -++ const unsigned int video_width, const unsigned int video_height); -++ -++// Replacement fn for avctx->get_buffer2 -++// Should be set before calling avcodec_decode_open2 -++// -++// N.B. in addition to to setting avctx->get_buffer2, avctx->refcounted_frames -++// must be set to 1 as otherwise the buffer info is killed before being returned -++// by avcodec_decode_video2. Note also that this means that the AVFrame that is -++// return must be manually derefed with av_frame_unref. This should be done -++// after av_rpi_zc_ref has been called. -++int av_rpi_zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags); -++ -++// Generate a ZC reference to the buffer(s) in this frame -++// If the buffer doesn't appear to be one allocated by _get_buffer_2 -++// then the behaviour depends on maycopy: -++// If maycopy=0 then return NULL -++// If maycopy=1 && the src frame is in a form where we can easily copy -++// the data, then allocate a new buffer and copy the data into it -++// Otherwise return NULL -++AVRpiZcRefPtr av_rpi_zc_ref(struct AVCodecContext * const s, -++ const AVFrame * const frame, const int maycopy); -++ -++// Get the vc_handle from the frame ref -++// Returns -1 if ref doesn't look valid -++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref); -++// Get the number of bytes allocated from the frame ref -++// Returns 0 if ref doesn't look valid -++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref); -++ -++// Unreference the buffer refed/allocated by _zc_ref -++// If fr_ref is NULL then this will NOP -++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref); -++ -++// Allocate an environment for the buffer pool used by the ZC code -++// This should be put in avctx->get_buffer_context so it can be found by -++// av_rpi_zc_get_buffer2 when it is called from ffmpeg -++AVZcEnvPtr av_rpi_zc_env_alloc(void); -++ -++// Allocate the environment used by the ZC code -++void av_rpi_zc_env_free(AVZcEnvPtr); -++ -++ -++// Init ZC into a context -++// There is nothing magic in this fn - it just packages setting -++// get_buffer2 & get_buffer_context -++int av_rpi_zc_init(struct AVCodecContext * const s); -++ -++// Free ZC from a context -++// There is nothing magic in this fn - it just packages unsetting -++// get_buffer2 & get_buffer_context -++void av_rpi_zc_uninit(struct AVCodecContext * const s); -++ -++#endif -++ -+-- -+2.7.4 -+ -+ -+From a6da64e1ca42f0394ccfa55dca782a456841da94 Mon Sep 17 00:00:00 2001 -+From: John Cox -+Date: Tue, 1 Mar 2016 14:21:25 +0000 -+Subject: [PATCH 2/2] Set VPU scheduling thread to high priority after creation -+ -+--- -+ libavcodec/rpi_qpu.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- -+ 1 file changed, 47 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/rpi_qpu.c b/libavcodec/rpi_qpu.c -+index b0c9bc5..ee19231 100644 -+--- a/libavcodec/rpi_qpu.c -++++ b/libavcodec/rpi_qpu.c -+@@ -182,9 +182,55 @@ static int gpu_init(volatile struct GPU **gpu) { -+ err = pthread_create(&vpu_thread, NULL, vpu_start, NULL); -+ //printf("Created thread\n"); -+ if (err) { -+- printf("Failed to create vpu thread\n"); -++ av_log(NULL, AV_LOG_FATAL, "Failed to create vpu thread\n"); -+ return -4; -+ } -++ -++ { -++ struct sched_param param = {0}; -++ int policy = 0; -++ -++ if (pthread_getschedparam(vpu_thread, &policy, ¶m) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); -++ } -++ else -++ { -++ av_log(NULL, AV_LOG_INFO, "VPU thread: policy=%d (%s), pri=%d\n", -++ policy, -++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -++ param.sched_priority); -++ -++ policy = SCHED_FIFO; -++ param.sched_priority = sched_get_priority_max(SCHED_FIFO); -++ -++ av_log(NULL, AV_LOG_INFO, "Attempt to set: policy=%d (%s), pri=%d\n", -++ policy, -++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -++ param.sched_priority); -++ -++ if (pthread_setschedparam(vpu_thread, policy, ¶m) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "Unable to set VPU thread scheduling parameters\n"); -++ } -++ else -++ { -++ if (pthread_getschedparam(vpu_thread, &policy, ¶m) != 0) -++ { -++ av_log(NULL, AV_LOG_ERROR, "Unable to get VPU thread scheduling parameters\n"); -++ } -++ else -++ { -++ av_log(NULL, AV_LOG_INFO, "VPU thread (after): policy=%d (%s), pri=%d\n", -++ policy, -++ policy == SCHED_RR ? "RR" : policy == SCHED_FIFO ? "FIFO" : "???" , -++ param.sched_priority); -++ } -++ } -++ } -++ -++ } -++ -+ } -+ #endif -+ -+-- -+2.7.4 -+ - -From 8e5e6f713dc181bc3f3b4bfb728d11aca00c846e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 12 Jan 2016 16:29:57 +0000 -Subject: [PATCH 27/62] ffmpeg: Add cabac opimisations for hevc - ---- - .../0001-Squashed-commit-of-the-following.patch | 2179 ++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 5 +- - tools/depends/target/ffmpeg/autobuild.sh | 2 + - 3 files changed, 2185 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch - -diff --git a/tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch b/tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..38554af0af30a85b7d88d31b7d21775cf294b0e3 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-Squashed-commit-of-the-following.patch -@@ -0,0 +1,2179 @@ -+From d08594462136274636c1f2f476a6410ff92a9e16 Mon Sep 17 00:00:00 2001 -+From: John Cox -+Date: Wed, 13 Jan 2016 16:13:33 +0000 -+Subject: [PATCH] H.265 residual decode rework (v2) -+ -+Rework the cabac decode functions -+Simplify the code flow and variable usage where possible -+ -+(Remove profiling and other spurious deltas that were in v1) -+--- -+ libavcodec/arm/cabac.h | 155 ++++- -+ libavcodec/arm/hevc_cabac.h | 491 +++++++++++++++ -+ libavcodec/arm/hevcdsp_deblock_neon.S | 13 +- -+ libavcodec/arm/hevcdsp_epel_neon.S | 9 +- -+ libavcodec/cabac.h | 9 +- -+ libavcodec/hevc_cabac.c | 1096 +++++++++++++++++++++++++-------- -+ 6 files changed, 1509 insertions(+), 264 deletions(-) -+ create mode 100644 libavcodec/arm/hevc_cabac.h -+ -+diff --git a/libavcodec/arm/cabac.h b/libavcodec/arm/cabac.h -+index fdbf86b..0a3980a 100644 -+--- a/libavcodec/arm/cabac.h -++++ b/libavcodec/arm/cabac.h -+@@ -26,13 +26,34 @@ -+ #include "libavutil/internal.h" -+ #include "libavcodec/cabac.h" -+ -++ -++#if UNCHECKED_BITSTREAM_READER -++#define LOAD_16BITS_BEHI\ -++ "ldrh %[tmp] , [%[ptr]] , #2 \n\t"\ -++ "rev %[tmp] , %[tmp] \n\t" -++#elif CONFIG_THUMB -++#define LOAD_16BITS_BEHI\ -++ "ldr %[tmp] , [%[c], %[end]] \n\t"\ -++ "cmp %[tmp] , %[ptr] \n\t"\ -++ "it cs \n\t"\ -++ "ldrhcs %[tmp] , [%[ptr]] , #2 \n\t"\ -++ "rev %[tmp] , %[tmp] \n\t" -++#else -++#define LOAD_16BITS_BEHI\ -++ "ldr %[tmp] , [%[c], %[end]] \n\t"\ -++ "cmp %[tmp] , %[ptr] \n\t"\ -++ "ldrcsh %[tmp] , [%[ptr]] , #2 \n\t"\ -++ "rev %[tmp] , %[tmp] \n\t" -++#endif -++ -++ -+ #define get_cabac_inline get_cabac_inline_arm -+ static av_always_inline int get_cabac_inline_arm(CABACContext *c, -+ uint8_t *const state) -+ { -+ int bit; -++#if 0 -+ void *reg_b, *reg_c, *tmp; -+- -+ __asm__ volatile( -+ "ldrb %[bit] , [%[state]] \n\t" -+ "add %[r_b] , %[tables] , %[lps_off] \n\t" -+@@ -100,9 +121,141 @@ static av_always_inline int get_cabac_inline_arm(CABACContext *c, -+ [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) -+ : "memory", "cc" -+ ); -++#else -++ // *** Not thumb compatible yet -++ unsigned int reg_b, tmp; -++ __asm__ ( -++ "ldrb %[bit] , [%[state]] \n\t" -++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -++ "and %[tmp] , %[range] , #0xC0 \n\t" -++ "add %[r_b] , %[r_b] , %[bit] \n\t" -++ "ldrb %[tmp] , [%[r_b] , %[tmp], lsl #1] \n\t" -++// %bit = *state -++// %range = range -++// %tmp = RangeLPS -++ "sub %[range] , %[range] , %[tmp] \n\t" -++ -++ "cmp %[low] , %[range] , lsl #17 \n\t" -++ "ittt ge \n\t" -++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -++ "mvnge %[bit] , %[bit] \n\t" -++ "movge %[range] , %[tmp] \n\t" -++ -++ "clz %[tmp] , %[range] \n\t" -++ "sub %[tmp] , #23 \n\t" -++ -++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -++ "lsl %[low] , %[low] , %[tmp] \n\t" -++ "lsl %[range] , %[range] , %[tmp] \n\t" -++ -++ "strb %[r_b] , [%[state]] \n\t" -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ -++ "bne 2f \n\t" -++ LOAD_16BITS_BEHI -++ "lsr %[tmp] , %[tmp] , #15 \n\t" -++ "movw %[r_b] , #0xFFFF \n\t" -++ "sub %[tmp] , %[tmp] , %[r_b] \n\t" -++ -++ "rbit %[r_b] , %[low] \n\t" -++ "clz %[r_b] , %[r_b] \n\t" -++ "sub %[r_b] , %[r_b] , #16 \n\t" -++#if CONFIG_THUMB -++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -++ "add %[low] , %[low] , %[tmp] \n\t" -++#else -++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -++#endif -++ "2: \n\t" -++ : [bit]"=&r"(bit), -++ [low]"+&r"(c->low), -++ [range]"+&r"(c->range), -++ [r_b]"=&r"(reg_b), -++ [ptr]"+&r"(c->bytestream), -++ [tmp]"=&r"(tmp) -++ : [state]"r"(state), -++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -++ [byte]"M"(offsetof(CABACContext, bytestream)), -++#if !UNCHECKED_BITSTREAM_READER -++ [c]"r"(c), -++ [end]"M"(offsetof(CABACContext, bytestream_end)), -++#endif -++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -++ : "memory", "cc" -++ ); -++#endif -+ -+ return bit & 1; -+ } -++ -++#define get_cabac_bypass get_cabac_bypass_arm -++static inline int get_cabac_bypass_arm(CABACContext * const c) -++{ -++ int rv = 0; -++ unsigned int tmp; -++ __asm ( -++ "lsl %[low] , #1 \n\t" -++ "cmp %[low] , %[range] , lsl #17 \n\t" -++ "adc %[rv] , %[rv] , #0 \n\t" -++ "it cs \n\t" -++ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "bne 1f \n\t" -++ LOAD_16BITS_BEHI -++ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" -++ "movw %[tmp] , #0xFFFF \n\t" -++ "sub %[low] , %[low] , %[tmp] \n\t" -++ "1: \n\t" -++ : // Outputs -++ [rv]"+&r"(rv), -++ [low]"+&r"(c->low), -++ [tmp]"=&r"(tmp), -++ [ptr]"+&r"(c->bytestream) -++ : // Inputs -++#if !UNCHECKED_BITSTREAM_READER -++ [c]"r"(c), -++ [end]"M"(offsetof(CABACContext, bytestream_end)), -++#endif -++ [range]"r"(c->range) -++ : "cc" -++ ); -++ return rv; -++} -++ -++ -++#define get_cabac_bypass_sign get_cabac_bypass_sign_arm -++static inline int get_cabac_bypass_sign_arm(CABACContext * const c, int rv) -++{ -++ unsigned int tmp; -++ __asm ( -++ "lsl %[low] , #1 \n\t" -++ "cmp %[low] , %[range] , lsl #17 \n\t" -++ "ite cc \n\t" -++ "rsbcc %[rv] , %[rv] , #0 \n\t" -++ "subcs %[low] , %[low] , %[range], lsl #17 \n\t" -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "bne 1f \n\t" -++ LOAD_16BITS_BEHI -++ "add %[low] , %[low] , %[tmp], lsr #15 \n\t" -++ "movw %[tmp] , #0xFFFF \n\t" -++ "sub %[low] , %[low] , %[tmp] \n\t" -++ "1: \n\t" -++ : // Outputs -++ [rv]"+&r"(rv), -++ [low]"+&r"(c->low), -++ [tmp]"=&r"(tmp), -++ [ptr]"+&r"(c->bytestream) -++ : // Inputs -++#if !UNCHECKED_BITSTREAM_READER -++ [c]"r"(c), -++ [end]"M"(offsetof(CABACContext, bytestream_end)), -++#endif -++ [range]"r"(c->range) -++ : "cc" -++ ); -++ return rv; -++} -++ -+ #endif /* HAVE_ARMV6T2_INLINE */ -+ -+ #endif /* AVCODEC_ARM_CABAC_H */ -+diff --git a/libavcodec/arm/hevc_cabac.h b/libavcodec/arm/hevc_cabac.h -+new file mode 100644 -+index 0000000..31d3c59 -+--- /dev/null -++++ b/libavcodec/arm/hevc_cabac.h -+@@ -0,0 +1,491 @@ -++/* -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#ifndef AVCODEC_ARM_HEVC_CABAC_H -++#define AVCODEC_ARM_HEVC_CABAC_H -++ -++#include "config.h" -++#if HAVE_ARMV6T2_INLINE -++ -++#define hevc_mem_bits32 hevc_mem_bits32_arm -++static inline uint32_t hevc_mem_bits32_arm(const void * p, const unsigned int bits) -++{ -++ unsigned int n; -++ __asm__ ( -++ "rev %[n], %[x] \n\t" -++ : [n]"=r"(n) -++ : [x]"r"(*(const uint32_t *)((const uint8_t *)p + (bits >> 3))) -++ : -++ ); -++ return n << (bits & 7); -++} -++ -++ -++// --------------------------------------------------------------------------- -++// -++// Helper fns - little bits of code where ARM has an instraction that the -++// compiler doesn't know about / use -++ -++#define trans_scale_sat trans_scale_sat_arm -++static inline int trans_scale_sat_arm(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) -++{ -++ int rv; -++ int t = ((level * (int)(scale * scale_m)) >> shift) + 1; -++ -++ __asm__ ( -++ "ssat %[rv], #16, %[t], ASR #1 \n\t" -++ : [rv]"=r"(rv) -++ : [t]"r"(t) -++ : -++ ); -++ return rv; -++} -++ -++#define update_rice update_rice_arm -++static inline void update_rice_arm(uint8_t * const stat_coeff, -++ const unsigned int last_coeff_abs_level_remaining, -++ const unsigned int c_rice_param) -++{ -++ int t; -++ __asm__ ( -++ "lsl %[t], %[coeff], #1 \n\t" -++ "lsrs %[t], %[t], %[shift] \n\t" -++ "it eq \n\t" -++ "subeq %[stat], %[stat], #1 \n\t" -++ "cmp %[t], #6 \n\t" -++ "adc %[stat], %[stat], #0 \n\t" -++ "usat %[stat], #8, %[stat] \n\t" -++ : [stat]"+&r"(*stat_coeff), -++ [t]"=&r"(t) -++ : [coeff]"r"(last_coeff_abs_level_remaining), -++ [shift]"r"(c_rice_param) -++ : "cc" -++ ); -++} -++ -++// --------------------------------------------------------------------------- -++// -++// CABAC get loops -++// -++// Where the loop is simple enough we can normally do 10-30% better than the -++// compiler -++ -++// Get the residual greater than 1 bits -++ -++#define get_cabac_greater1_bits get_cabac_greater1_bits_arm -++static inline unsigned int get_cabac_greater1_bits_arm(CABACContext * const c, const unsigned int n, -++ uint8_t * const state0) -++{ -++ unsigned int i, reg_b, st, tmp, bit, rv; -++ __asm__ ( -++ "mov %[i] , #0 \n\t" -++ "mov %[rv] , #0 \n\t" -++ "1: \n\t" -++ "add %[i] , %[i] , #1 \n\t" -++ "cmp %[rv] , #0 \n\t" -++ "ite eq \n\t" -++ "usateq %[st] , #2 , %[i] \n\t" -++ "movne %[st] , #0 \n\t" -++ -++ "ldrb %[bit] , [%[state0], %[st]] \n\t" -++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -++ "and %[tmp] , %[range] , #0xC0 \n\t" -++ "add %[r_b] , %[r_b] , %[bit] \n\t" -++ "ldrb %[tmp] , [%[r_b], %[tmp], lsl #1] \n\t" -++ "sub %[range] , %[range] , %[tmp] \n\t" -++ -++ "cmp %[low] , %[range], lsl #17 \n\t" -++ "ittt ge \n\t" -++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -++ "mvnge %[bit] , %[bit] \n\t" -++ "movge %[range] , %[tmp] \n\t" -++ -++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -++ "and %[bit] , %[bit] , #1 \n\t" -++ "orr %[rv] , %[bit] , %[rv], lsl #1 \n\t" -++ -++ "clz %[tmp] , %[range] \n\t" -++ "sub %[tmp] , #23 \n\t" -++ -++ "lsl %[low] , %[low] , %[tmp] \n\t" -++ "lsl %[range] , %[range] , %[tmp] \n\t" -++ -++ "strb %[r_b] , [%[state0], %[st]] \n\t" -++// There is a small speed gain from combining both conditions, using a single -++// branch and then working out what that meant later -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "it ne \n\t" -++ "cmpne %[n] , %[i] \n\t" -++ "bne 1b \n\t" -++ -++// If reload is not required then we must have run out of flags to decode -++ "tst %[tmp] , %[tmp] \n\t" -++ "bne 2f \n\t" -++ -++// Do reload -++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" -++ "movw %[r_b] , #0xFFFF \n\t" -++ "rev %[tmp] , %[tmp] \n\t" -++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" -++ -++ "rbit %[r_b] , %[low] \n\t" -++ "clz %[r_b] , %[r_b] \n\t" -++ "sub %[r_b] , %[r_b] , #16 \n\t" -++ -++#if CONFIG_THUMB -++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -++ "add %[low] , %[low] , %[tmp] \n\t" -++#else -++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -++#endif -++ -++ "cmp %[n] , %[i] \n\t" -++ "bne 1b \n\t" -++ "2: \n\t" -++ : [bit]"=&r"(bit), -++ [low]"+&r"(c->low), -++ [range]"+&r"(c->range), -++ [r_b]"=&r"(reg_b), -++ [bptr]"+&r"(c->bytestream), -++ [i]"=&r"(i), -++ [tmp]"=&r"(tmp), -++ [st]"=&r"(st), -++ [rv]"=&r"(rv) -++ : [state0]"r"(state0), -++ [n]"r"(n), -++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -++ [byte]"M"(offsetof(CABACContext, bytestream)), -++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -++ : "memory", "cc" -++ ); -++ return rv; -++} -++ -++ -++// n must be > 0 on entry -++#define get_cabac_sig_coeff_flag_idxs get_cabac_sig_coeff_flag_idxs_arm -++static inline uint8_t * get_cabac_sig_coeff_flag_idxs_arm(CABACContext * const c, uint8_t * const state0, -++ unsigned int n, -++ const uint8_t const * ctx_map, -++ uint8_t * p) -++{ -++ unsigned int reg_b, tmp, st, bit; -++ __asm__ ( -++ "1: \n\t" -++// Get bin from map -++ "ldrb %[st] , [%[ctx_map], %[n]] \n\t" -++ -++// Load state & ranges -++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" -++ "ldrb %[bit] , [%[state0], %[st]] \n\t" -++ "and %[tmp] , %[range] , #0xC0 \n\t" -++ "add %[r_b] , %[r_b] , %[tmp], lsl #1 \n\t" -++ "ldrb %[tmp] , [%[r_b], %[bit]] \n\t" -++ "sub %[range] , %[range] , %[tmp] \n\t" -++ -++ "cmp %[low] , %[range], lsl #17 \n\t" -++ "ittt ge \n\t" -++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" -++ "mvnge %[bit] , %[bit] \n\t" -++ "movge %[range] , %[tmp] \n\t" -++ -++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" -++ "tst %[bit] , #1 \n\t" -++// GCC asm seems to need strbne written differently for thumb and arm -++#if CONFIG_THUMB -++ "it ne \n\t" -++ "strbne %[n] , [%[idx]] , #1 \n\t" -++#else -++ "strneb %[n] , [%[idx]] , #1 \n\t" -++#endif -++ -++// Renorm -++ "clz %[tmp] , %[range] \n\t" -++ "sub %[tmp] , #23 \n\t" -++ "lsl %[low] , %[low] , %[tmp] \n\t" -++ "lsl %[range] , %[range] , %[tmp] \n\t" -++ -++ "strb %[r_b] , [%[state0], %[st]] \n\t" -++// There is a small speed gain from combining both conditions, using a single -++// branch and then working out what that meant later -++ "subs %[n] , %[n] , #1 \n\t" -++#if CONFIG_THUMB -++ "itt ne \n\t" -++ "lslsne %[tmp] , %[low] , #16 \n\t" -++ "bne 1b \n\t" -++#else -++ "lslnes %[tmp] , %[low] , #16 \n\t" -++ "bne 1b \n\t" -++#endif -++ -++// If we have bits left then n must be 0 so give up now -++ "lsls %[tmp] , %[low] , #16 \n\t" -++ "bne 2f \n\t" -++ -++// Do reload -++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" -++ "movw %[r_b] , #0xFFFF \n\t" -++ "rev %[tmp] , %[tmp] \n\t" -++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" -++ -++ "rbit %[r_b] , %[low] \n\t" -++ "clz %[r_b] , %[r_b] \n\t" -++ "sub %[r_b] , %[r_b] , #16 \n\t" -++ -++#if CONFIG_THUMB -++ "lsl %[tmp] , %[tmp] , %[r_b] \n\t" -++ "add %[low] , %[low] , %[tmp] \n\t" -++#else -++ "add %[low] , %[low] , %[tmp], lsl %[r_b] \n\t" -++#endif -++ -++// Check to see if we still have more to do -++ "cmp %[n] , #0 \n\t" -++ "bne 1b \n\t" -++ "2: \n\t" -++ : [bit]"=&r"(bit), -++ [low]"+&r"(c->low), -++ [range]"+&r"(c->range), -++ [r_b]"=&r"(reg_b), -++ [bptr]"+&r"(c->bytestream), -++ [idx]"+&r"(p), -++ [n]"+&r"(n), -++ [tmp]"=&r"(tmp), -++ [st]"=&r"(st) -++ : [state0]"r"(state0), -++ [ctx_map]"r"(ctx_map), -++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), -++ [byte]"M"(offsetof(CABACContext, bytestream)), -++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) -++ : "memory", "cc" -++ ); -++ -++ return p; -++} -++ -++// --------------------------------------------------------------------------- -++// -++// CABAC_BY22 functions -++// -++// By and large these are (at best) no faster than their C equivalents - the -++// only one worth having is _peek where we do a slightly better job than the -++// compiler -++// -++// The others have been stashed here for reference in case larger scale asm -++// is attempted in which case they might be a useful base -++ -++ -++#define get_cabac_by22_peek get_cabac_by22_peek_arm -++static inline uint32_t get_cabac_by22_peek_arm(const CABACContext *const c) -++{ -++ uint32_t rv, tmp; -++ __asm__ ( -++ "bic %[rv] , %[low], #1 \n\t" -++ "cmp %[inv] , #0 \n\t" -++ "it ne \n\t" -++ "umullne %[tmp] , %[rv] , %[inv], %[rv] \n\t" -++ : // Outputs -++ [rv]"=&r"(rv), -++ [tmp]"=r"(tmp) -++ : // Inputs -++ [low]"r"(c->low), -++ [inv]"r"(c->range) -++ : // Clobbers -++ "cc" -++ ); -++ return rv << 1; -++} -++ -++#if 0 -++ -++// ***** Slower than the C :-( -++#define get_cabac_by22_flush get_cabac_by22_flush_arm -++static inline void get_cabac_by22_flush_arm(CABACContext *const c, const unsigned int n, const uint32_t val) -++{ -++ uint32_t m, tmp; -++ __asm__ ( -++ "add %[bits], %[bits], %[n] \n\t" -++ "ldr %[m], [%[ptr], %[bits], lsr #3] \n\t" -++ -++ "rsb %[tmp], %[n], #32 \n\t" -++ "lsr %[tmp], %[val], %[tmp] \n\t" -++ "mul %[tmp], %[range], %[tmp] \n\t" -++ -++ "rev %[m], %[m] \n\t" -++ -++ "lsl %[tmp], %[tmp], #23 \n\t" -++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -++ -++ "and %[tmp], %[bits], #7 \n\t" -++ "lsl %[m], %[m], %[tmp] \n\t" -++ -++ "orr %[low], %[low], %[m], lsr #9 \n\t" -++ : // Outputs -++ [m]"=&r"(m), -++ [tmp]"=&r"(tmp), -++ [bits]"+&r"(c->by22.bits), -++ [low]"+&r"(c->low) -++ : // Inputs -++ [n]"r"(n), -++ [val]"r"(val), -++ [inv]"r"(c->range), -++ [range]"r"(c->by22.range), -++ [ptr]"r"(c->bytestream) -++ : // Clobbers -++ ); -++} -++ -++ -++// Works but slower than C -++#define coeff_abs_level_remaining_decode_by22(c,r) coeff_abs_level_remaining_decode_by22_arm(c, r) -++static int coeff_abs_level_remaining_decode_by22_arm(CABACContext * const c, const unsigned int c_rice_param) -++{ -++ uint32_t n, val, tmp, level; -++ -++// PROFILE_START(); -++ -++ __asm__ ( -++ // Peek -++ "bic %[val], %[low], #1 \n\t" -++ "cmp %[inv], #0 \n\t" -++ "umullne %[tmp], %[val], %[inv], %[val] \n\t" -++ "lsl %[val], %[val], #1 \n\t" -++ -++ // Count bits (n = prefix) -++ "mvn %[n], %[val] \n\t" -++ "clz %[n], %[n] \n\t" -++ -++ "lsl %[level], %[val], %[n] \n\t" -++ "subs %[tmp], %[n], #3 \n\t" -++ "blo 2f \n\t" -++ -++ // prefix >= 3 -++ // < tmp = prefix - 3 -++ // > tmp = prefix + rice - 3 -++ "add %[tmp], %[tmp], %[rice] \n\t" -++ // > n = prefix * 2 + rice - 3 -++ "add %[n], %[tmp], %[n] \n\t" -++ "cmp %[n], #21 \n\t" -++ "bhi 3f \n\t" -++ -++ "orr %[level], %[level], #0x80000000 \n\t" -++ "rsb %[tmp], %[tmp], #31 \n\t" -++ "lsr %[level], %[level], %[tmp] \n\t" -++ -++ "mov %[tmp], #2 \n\t" -++ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" -++ "b 1f \n\t" -++ -++ // > 22 bits used in total - need reload -++ "3: \n\t" -++ -++ // Stash prefix + rice - 3 in level (only spare reg) -++ "mov %[level], %[tmp] \n\t" -++ // Restore n to flush value (prefix) -++ "sub %[n], %[n], %[tmp] \n\t" -++ -++ // Flush + reload -++ -++// "rsb %[tmp], %[n], #32 \n\t" -++// "lsr %[tmp], %[val], %[tmp] \n\t" -++// "mul %[tmp], %[range], %[tmp] \n\t" -++ -++ // As it happens we know that all the bits we are flushing are 1 -++ // so we can cheat slightly -++ "rsb %[tmp], %[range], %[range], lsl %[n] \n\t" -++ "lsl %[tmp], %[tmp], #23 \n\t" -++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -++ -++ "add %[bits], %[bits], %[n] \n\t" -++ "ldr %[n], [%[ptr], %[bits], lsr #3] \n\t" -++ "rev %[n], %[n] \n\t" -++ "and %[tmp], %[bits], #7 \n\t" -++ "lsl %[n], %[n], %[tmp] \n\t" -++ -++ "orr %[low], %[low], %[n], lsr #9 \n\t" -++ -++ // (reload) -++ -++ "bic %[val], %[low], #1 \n\t" -++ "cmp %[inv], #0 \n\t" -++ "umullne %[tmp], %[val], %[inv], %[val] \n\t" -++ "lsl %[val], %[val], #1 \n\t" -++ -++ // Build value -++ -++ "mov %[n], %[level] \n\t" -++ -++ "orr %[tmp], %[val], #0x80000000 \n\t" -++ "rsb %[level], %[level], #31 \n\t" -++ "lsr %[level], %[tmp], %[level] \n\t" -++ -++ "mov %[tmp], #2 \n\t" -++ "add %[level], %[level], %[tmp], lsl %[rice] \n\t" -++ "b 1f \n\t" -++ -++ // prefix < 3 -++ "2: \n\t" -++ "rsb %[tmp], %[rice], #31 \n\t" -++ "lsr %[level], %[level], %[tmp] \n\t" -++ "orr %[level], %[level], %[n], lsl %[rice] \n\t" -++ "add %[n], %[n], %[rice] \n\t" -++ -++ "1: \n\t" -++ // Flush -++ "add %[n], %[n], #1 \n\t" -++ -++ "rsb %[tmp], %[n], #32 \n\t" -++ "lsr %[tmp], %[val], %[tmp] \n\t" -++ -++ "add %[bits], %[bits], %[n] \n\t" -++ "ldr %[val], [%[ptr], %[bits], lsr #3] \n\t" -++ -++ "mul %[tmp], %[range], %[tmp] \n\t" -++ "lsl %[tmp], %[tmp], #23 \n\t" -++ "rsb %[low], %[tmp], %[low], lsl %[n] \n\t" -++ -++ "rev %[val], %[val] \n\t" -++ "and %[tmp], %[bits], #7 \n\t" -++ "lsl %[val], %[val], %[tmp] \n\t" -++ -++ "orr %[low], %[low], %[val], lsr #9 \n\t" -++ : // Outputs -++ [level]"=&r"(level), -++ [n]"=&r"(n), -++ [val]"=&r"(val), -++ [tmp]"=&r"(tmp), -++ [bits]"+&r"(c->by22.bits), -++ [low]"+&r"(c->low) -++ : // Inputs -++ [rice]"r"(c_rice_param), -++ [inv]"r"(c->range), -++ [range]"r"(c->by22.range), -++ [ptr]"r"(c->bytestream) -++ : // Clobbers -++ "cc" -++ ); -++ -++// PROFILE_ACC(residual_abs); -++ -++ return level; -++} -++#endif -++ -++#endif /* HAVE_ARMV6T2_INLINE */ -++ -++#endif /* AVCODEC_ARM_HEVC_CABAC_H */ -+diff --git a/libavcodec/arm/hevcdsp_deblock_neon.S b/libavcodec/arm/hevcdsp_deblock_neon.S -+index bad4589..a088cc3 100644 -+--- a/libavcodec/arm/hevcdsp_deblock_neon.S -++++ b/libavcodec/arm/hevcdsp_deblock_neon.S -+@@ -409,10 +409,12 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ beq 90f -+ -+ tst a3, #1 -++ itee ne -+ ldrne a3, [v5, #0] @ curr->mv[0] -+ ldreq a3, [v5, #4] @ curr->mv[1] -+ moveq v1, v2 -+ tst v8, #1 -++ itee ne -+ ldrne v8, [v6, #0] @ neigh->mv[0] -+ ldreq v8, [v6, #4] @ neigh->mv[1] -+ moveq v3, v4 -+@@ -424,9 +426,14 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ sel a3, a3, ip -+ ands a3, a3, lr -+ @ drop through -+-10: movne a3, #1 -++10: it ne -++ movne a3, #1 -+ 11: subs a2, a2, #1 -+-12: strbhs a3, [v7], a4 -++12: -++A strbhs a3, [v7], a4 -++T itt hs -++T strbhs a3, [v7] -++T addhs v7, v7, a4 -+ subs a2, a2, #1 -+ bhs 12b -+ -+@@ -442,6 +449,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ bne 10b -+ -+ teq v1, v3 -++ it eq -+ teqeq v2, v4 -+ bne 40f -+ teq v1, v2 -+@@ -487,6 +495,7 @@ function ff_hevc_deblocking_boundary_strengths_neon, export=1 -+ b 10b -+ -+ 40: teq v1, v4 -++ ite eq -+ teqeq v2, v3 -+ bne 10b -+ -+diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S -+index 516ae5b..00eab9e 100644 -+--- a/libavcodec/arm/hevcdsp_epel_neon.S -++++ b/libavcodec/arm/hevcdsp_epel_neon.S -+@@ -110,7 +110,9 @@ function ff_hevc_put_epel_h_neon_8, export=1 -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+- adrl r12, epel_coeffs -++@ adr reaches if we are in thumb mode but not in arm -++T adr r12, epel_coeffs -++A adrl r12, epel_coeffs -+ add r7, r12 -+ sub r1, #1 -+ lsl r4, #1 -+@@ -170,7 +172,8 @@ function ff_hevc_put_epel_v_neon_8, export=1 -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+- adrl r12, epel_coeffs -++T adr r12, epel_coeffs -++A adrl r12, epel_coeffs -+ add r7, r12 -+ load_coeffs_16b r7 -+ sub r1, r2 -+@@ -246,7 +249,7 @@ function ff_hevc_put_epel_hv_neon_8, export=1 -+ sub r7, #1 -+ lsl r7, #2 -+ vpush {d8-d15} -+- adrl r12, epel_coeffs -++ adr r12, epel_coeffs -+ sub r6, #1 -+ lsl r6, #2 -+ add r6, r12 // mx epel coeff offset -+diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h -+index 1bf1c62..ccfa991 100644 -+--- a/libavcodec/cabac.h -++++ b/libavcodec/cabac.h -+@@ -43,7 +43,14 @@ extern const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63]; -+ typedef struct CABACContext{ -+ int low; -+ int range; -+- int outstanding_count; -++ union -++ { -++ int outstanding_count; -++ struct { -++ uint16_t bits; -++ uint16_t range; -++ } by22; -++ }; -+ const uint8_t *bytestream_start; -+ const uint8_t *bytestream; -+ const uint8_t *bytestream_end; -+diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c -+index 8656917..4caf720 100644 -+--- a/libavcodec/hevc_cabac.c -++++ b/libavcodec/hevc_cabac.c -+@@ -21,14 +21,72 @@ -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -++#define UNCHECKED_BITSTREAM_READER 1 -++ -+ #include "libavutil/attributes.h" -+ #include "libavutil/common.h" -+ -+-#include "cabac_functions.h" -+ #include "hevc.h" -++#include "cabac_functions.h" -++ -++// BY22 is probably faster than simple bypass if the processor has -++// either a fast 32-bit divide or a fast 32x32->64[63:32] instruction -++// x86 has fast int divide -++// Arm doesn't have divide or general fast 64 bit, but does have the multiply -++// * Beware: ARCH_xxx isn't set if configure --disable-asm is used -++#define USE_BY22 (HAVE_FAST_64BIT || ARCH_ARM || ARCH_X86) -++// Use native divide if we have a fast one - otherwise use mpy 1/x -++// x86 has a fast integer divide - arm doesn't - unsure about other -++// architectures -++#define USE_BY22_DIV ARCH_X86 -++ -++// Special case blocks with a single significant ceoff -++// Decreases the complexity of the code for a common case but increases the -++// code size. -++#define USE_N_END_1 1 -++ -++#if ARCH_ARM -++#include "arm/hevc_cabac.h" -++#endif -+ -+ #define CABAC_MAX_BIN 31 -+ -++ -++#if USE_BY22 && !USE_BY22_DIV -++#define I(x) (uint32_t)((0x10000000000ULL / (uint64_t)(x)) + 1ULL) -++ -++static const uint32_t cabac_by22_inv_range[256] = { -++ 0, I(257), I(258), I(259), -++ I(260), I(261), I(262), I(263), I(264), I(265), I(266), I(267), I(268), I(269), -++ I(270), I(271), I(272), I(273), I(274), I(275), I(276), I(277), I(278), I(279), -++ I(280), I(281), I(282), I(283), I(284), I(285), I(286), I(287), I(288), I(289), -++ I(290), I(291), I(292), I(293), I(294), I(295), I(296), I(297), I(298), I(299), -++ I(300), I(301), I(302), I(303), I(304), I(305), I(306), I(307), I(308), I(309), -++ I(310), I(311), I(312), I(313), I(314), I(315), I(316), I(317), I(318), I(319), -++ I(320), I(321), I(322), I(323), I(324), I(325), I(326), I(327), I(328), I(329), -++ I(330), I(331), I(332), I(333), I(334), I(335), I(336), I(337), I(338), I(339), -++ I(340), I(341), I(342), I(343), I(344), I(345), I(346), I(347), I(348), I(349), -++ I(350), I(351), I(352), I(353), I(354), I(355), I(356), I(357), I(358), I(359), -++ I(360), I(361), I(362), I(363), I(364), I(365), I(366), I(367), I(368), I(369), -++ I(370), I(371), I(372), I(373), I(374), I(375), I(376), I(377), I(378), I(379), -++ I(380), I(381), I(382), I(383), I(384), I(385), I(386), I(387), I(388), I(389), -++ I(390), I(391), I(392), I(393), I(394), I(395), I(396), I(397), I(398), I(399), -++ I(400), I(401), I(402), I(403), I(404), I(405), I(406), I(407), I(408), I(409), -++ I(410), I(411), I(412), I(413), I(414), I(415), I(416), I(417), I(418), I(419), -++ I(420), I(421), I(422), I(423), I(424), I(425), I(426), I(427), I(428), I(429), -++ I(430), I(431), I(432), I(433), I(434), I(435), I(436), I(437), I(438), I(439), -++ I(440), I(441), I(442), I(443), I(444), I(445), I(446), I(447), I(448), I(449), -++ I(450), I(451), I(452), I(453), I(454), I(455), I(456), I(457), I(458), I(459), -++ I(460), I(461), I(462), I(463), I(464), I(465), I(466), I(467), I(468), I(469), -++ I(470), I(471), I(472), I(473), I(474), I(475), I(476), I(477), I(478), I(479), -++ I(480), I(481), I(482), I(483), I(484), I(485), I(486), I(487), I(488), I(489), -++ I(490), I(491), I(492), I(493), I(494), I(495), I(496), I(497), I(498), I(499), -++ I(500), I(501), I(502), I(503), I(504), I(505), I(506), I(507), I(508), I(509), -++ I(510), I(511) -++}; -++#undef I -++#endif // USE_BY22 -++ -+ /** -+ * number of bin by SyntaxElement. -+ */ -+@@ -445,6 +503,211 @@ static const uint8_t diag_scan8x8_inv[8][8] = { -+ { 28, 36, 43, 49, 54, 58, 61, 63, }, -+ }; -+ -++ -++typedef struct -++{ -++ uint16_t coeff; -++ uint16_t scale; -++} xy_off_t; -++ -++#define XYT_C(x,y,t) ((x) + ((y) << (t))) -++#define SCALE_TRAFO(t) ((t) > 3 ? 3 : (t)) -++#define SCALE_SHR(t) ((t) - SCALE_TRAFO(t)) -++#define XYT_S(x,y,t) (((x) >> SCALE_SHR(t)) + (((y) >> SCALE_SHR(t)) << SCALE_TRAFO(t))) -++ -++#define XYT(x,y,t) {XYT_C(x,y,t), XYT_S(x,y,t)} -++ -++#define OFF_DIAG(t) {\ -++ XYT(0,0,t), XYT(0,1,t), XYT(1,0,t), XYT(0,2,t),\ -++ XYT(1,1,t), XYT(2,0,t), XYT(0,3,t), XYT(1,2,t),\ -++ XYT(2,1,t), XYT(3,0,t), XYT(1,3,t), XYT(2,2,t),\ -++ XYT(3,1,t), XYT(2,3,t), XYT(3,2,t), XYT(3,3,t)\ -++} -++ -++#define OFF_HORIZ(t) {\ -++ XYT(0,0,t), XYT(1,0,t), XYT(2,0,t), XYT(3,0,t),\ -++ XYT(0,1,t), XYT(1,1,t), XYT(2,1,t), XYT(3,1,t),\ -++ XYT(0,2,t), XYT(1,2,t), XYT(2,2,t), XYT(3,2,t),\ -++ XYT(0,3,t), XYT(1,3,t), XYT(2,3,t), XYT(3,3,t)\ -++} -++ -++#define OFF_VERT(t) {\ -++ XYT(0,0,t), XYT(0,1,t), XYT(0,2,t), XYT(0,3,t),\ -++ XYT(1,0,t), XYT(1,1,t), XYT(1,2,t), XYT(1,3,t),\ -++ XYT(2,0,t), XYT(2,1,t), XYT(2,2,t), XYT(2,3,t),\ -++ XYT(3,0,t), XYT(3,1,t), XYT(3,2,t), XYT(3,3,t)\ -++} -++ -++static const xy_off_t off_xys[3][4][16] = -++{ -++ {OFF_DIAG(2), OFF_DIAG(3), OFF_DIAG(4), OFF_DIAG(5)}, -++ {OFF_HORIZ(2), OFF_HORIZ(3), OFF_HORIZ(4), OFF_HORIZ(5)}, -++ {OFF_VERT(2), OFF_VERT(3), OFF_VERT(4), OFF_VERT(5)} -++}; -++ -++ -++// Helper fns -++#ifndef hevc_mem_bits32 -++static av_always_inline uint32_t hevc_mem_bits32(const void * buf, const unsigned int offset) -++{ -++ return AV_RB32((const uint8_t *)buf + (offset >> 3)) << (offset & 7); -++} -++#endif -++ -++#if AV_GCC_VERSION_AT_LEAST(3,4) && !defined(hevc_clz32) -++#define hevc_clz32 hevc_clz32_builtin -++static av_always_inline unsigned int hevc_clz32_builtin(const uint32_t x) -++{ -++ // __builtin_clz says it works on ints - so adjust if int is >32 bits long -++ return __builtin_clz(x) - (sizeof(int) * 8 - 32); -++} -++#endif -++ -++// It is unlikely that we will ever need this but include for completeness -++#ifndef hevc_clz32 -++static inline unsigned int hevc_clz32(unsigned int x) -++{ -++ unsigned int n = 1; -++ if ((x & 0xffff0000) == 0) { -++ n += 16; -++ x <<= 16; -++ } -++ if ((x & 0xff000000) == 0) { -++ n += 8; -++ x <<= 8; -++ } -++ if ((x & 0xf0000000) == 0) { -++ n += 4; -++ x <<= 4; -++ } -++ if ((x & 0xc0000000) == 0) { -++ n += 2; -++ x <<= 2; -++ } -++ return n - ((x >> 31) & 1); -++} -++#endif -++ -++ -++#if !USE_BY22 -++// If no by22 then _by22 functions will revert to normal and so _peek/_flush -++// will no longer be called but the setup calls will still exist and we want -++// to null them out -++#define bypass_start(s) -++#define bypass_finish(s) -++#else -++// Use BY22 for residual bypass block -++ -++#define bypass_start(s) get_cabac_by22_start(&s->HEVClc->cc) -++#define bypass_finish(s) get_cabac_by22_finish(&s->HEVClc->cc) -++ -++// BY22 notes that bypass is simply a divide into the bitstream and so we -++// can peek out large quantities of bits at one and treat the result as if -++// it was VLC. In many cases this will lead to O(1) processing rather than -++// O(n) though the setup and teardown is sufficiently expensive that it is -++// only worth using if we expect to be dealing with more than a few bits -++// The definition of "a few bits" will vary from platform to platform but -++// tests on ARM show that it probably isn't worth it for a single coded -++// residual, but is for >1 - this is probaly reinforced that if there are -++// more residuals then they are likely to be bigger and this will make the -++// O(1) nature of the code more worthwhile. -++ -++ -++#if !USE_BY22_DIV -++// * 1/x @ 32 bits gets us 22 bits of accuracy -++#define CABAC_BY22_PEEK_BITS 22 -++#else -++// A real 32-bit divide gets us another bit -++// If we have a 64 bit int & a unit time divider then we should get a lot -++// of bits (55) but that is untested and it is unclear if it would give -++// us a large advantage -++#define CABAC_BY22_PEEK_BITS 23 -++#endif -++ -++// Bypass block start -++// Must be called before _by22_peek is used as it sets the CABAC environment -++// into the correct state. _by22_finish must be called to return to 'normal' -++// (i.e. non-bypass) cabac decoding -++static inline void get_cabac_by22_start(CABACContext * const c) -++{ -++ const unsigned int bits = __builtin_ctz(c->low); -++ const uint32_t m = hevc_mem_bits32(c->bytestream, 0); -++ uint32_t x = (c->low << (22 - CABAC_BITS)) ^ ((m ^ 0x80000000U) >> (9 + CABAC_BITS - bits)); -++#if !USE_BY22_DIV -++ const uint32_t inv = cabac_by22_inv_range[c->range & 0xff]; -++#endif -++ -++ c->bytestream -= (CABAC_BITS / 8); -++ c->by22.bits = bits; -++#if !USE_BY22_DIV -++ c->by22.range = c->range; -++ c->range = inv; -++#endif -++ c->low = x; -++} -++ -++// Bypass block finish -++// Must be called at the end of the bypass block to return to normal operation -++static inline void get_cabac_by22_finish(CABACContext * const c) -++{ -++ unsigned int used = c->by22.bits; -++ unsigned int bytes_used = (used / CABAC_BITS) * (CABAC_BITS / 8); -++ unsigned int bits_used = used & (CABAC_BITS == 16 ? 15 : 7); -++ -++ c->bytestream += bytes_used + (CABAC_BITS / 8); -++ c->low = (((uint32_t)c->low >> (22 - CABAC_BITS + bits_used)) | 1) << bits_used; -++#if !USE_BY22_DIV -++ c->range = c->by22.range; -++#endif -++} -++ -++// Peek bypass bits -++// _by22_start must be called before _by22_peek is called and _by22_flush -++// must be called afterwards to flush any used bits -++// The actual number of valid bits returned is -++// min(, CABAC_BY22_PEEK_BITS). CABAC_BY22_PEEK_BITS -++// will be at least 22 which should be long enough for any prefix or suffix -++// though probably not long enough for the worst case combination -++#ifndef get_cabac_by22_peek -++static inline uint32_t get_cabac_by22_peek(const CABACContext * const c) -++{ -++#if USE_BY22_DIV -++ return ((unsigned int)c->low / (unsigned int)c->range) << 9; -++#else -++ uint32_t x = c->low & ~1U; -++ const uint32_t inv = c->range; -++ -++ if (inv != 0) -++ x = (uint32_t)(((uint64_t)x * (uint64_t)inv) >> 32); -++ -++ return x << 1; -++#endif -++} -++#endif -++ -++// Flush bypass bits peeked by _by22_peek -++// Flush n bypass bits. n must be >= 1 to guarantee correct operation -++// val is an unmodified copy of whatever _by22_peek returned -++#ifndef get_cabac_by22_flush -++static inline void get_cabac_by22_flush(CABACContext * c, const unsigned int n, const uint32_t val) -++{ -++ // Subtract the bits used & reshift up to the top of the word -++#if USE_BY22_DIV -++ const uint32_t low = (((unsigned int)c->low << n) - (((val >> (32 - n)) * (unsigned int)c->range) << 23)); -++#else -++ const uint32_t low = (((uint32_t)c->low << n) - (((val >> (32 - n)) * c->by22.range) << 23)); -++#endif -++ -++ // and refill lower bits -++ // We will probably OR over some existing bits but that doesn't matter -++ c->by22.bits += n; -++ c->low = low | (hevc_mem_bits32(c->bytestream, c->by22.bits) >> 9); -++} -++#endif -++ -++#endif // USE_BY22 -++ -++ -+ void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts) -+ { -+ if (s->ps.pps->entropy_coding_sync_enabled_flag && -+@@ -863,19 +1126,19 @@ int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth) -+ return GET_CABAC(elem_offset[CBF_LUMA] + !trafo_depth); -+ } -+ -+-static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx) -++static int hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx_nz) -+ { -+- return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + !!c_idx); -++ return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + c_idx_nz); -+ } -+ -+-static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx) -++static int explicit_rdpcm_flag_decode(HEVCContext *s, int c_idx_nz) -+ { -+- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + !!c_idx); -++ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_FLAG] + c_idx_nz); -+ } -+ -+-static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx) -++static int explicit_rdpcm_dir_flag_decode(HEVCContext *s, int c_idx_nz) -+ { -+- return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + !!c_idx); -++ return GET_CABAC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + c_idx_nz); -+ } -+ -+ int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx) { -+@@ -891,14 +1154,14 @@ int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx) { -+ return GET_CABAC(elem_offset[RES_SCALE_SIGN_FLAG] + idx); -+ } -+ -+-static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx, -++static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCContext *s, int c_idx_nz, -+ int log2_size, int *last_scx_prefix, int *last_scy_prefix) -+ { -+ int i = 0; -+ int max = (log2_size << 1) - 1; -+ int ctx_offset, ctx_shift; -+ -+- if (!c_idx) { -++ if (!c_idx_nz) { -+ ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2); -+ ctx_shift = (log2_size + 1) >> 2; -+ } else { -+@@ -929,22 +1192,16 @@ static av_always_inline int last_significant_coeff_suffix_decode(HEVCContext *s, -+ return value; -+ } -+ -+-static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx, int ctx_cg) -++static av_always_inline int significant_coeff_group_flag_decode(HEVCContext *s, int c_idx_nz, int ctx_cg) -+ { -+ int inc; -+ -+- inc = FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0); -++ inc = (ctx_cg != 0) + (c_idx_nz << 1); -+ -+ return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_GROUP_FLAG] + inc); -+ } -+-static av_always_inline int significant_coeff_flag_decode(HEVCContext *s, int x_c, int y_c, -+- int offset, const uint8_t *ctx_idx_map) -+-{ -+- int inc = ctx_idx_map[(y_c << 2) + x_c] + offset; -+- return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + inc); -+-} -+ -+-static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int c_idx, int offset) -++static av_always_inline int significant_coeff_flag_decode_0(HEVCContext *s, int offset) -+ { -+ return GET_CABAC(elem_offset[SIGNIFICANT_COEFF_FLAG] + offset); -+ } -+@@ -966,65 +1223,305 @@ static av_always_inline int coeff_abs_level_greater2_flag_decode(HEVCContext *s, -+ return GET_CABAC(elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + inc); -+ } -+ -+-static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int rc_rice_param) -++ -++#if !USE_BY22 -++#define coeff_abs_level_remaining_decode_bypass(s,r) coeff_abs_level_remaining_decode(s, r) -++#endif -++ -++ -++#ifndef coeff_abs_level_remaining_decode_bypass -++static int coeff_abs_level_remaining_decode_bypass(HEVCContext * const s, const unsigned int rice_param) -++{ -++ CABACContext * const c = &s->HEVClc->cc; -++ uint32_t y; -++ unsigned int prefix; -++ unsigned int last_coeff_abs_level_remaining; -++ unsigned int n; -++ -++ y = get_cabac_by22_peek(c); -++ prefix = hevc_clz32(~y); -++ // y << prefix will always have top bit 0 -++ -++ if (prefix < 3) { -++ const unsigned int suffix = (y << prefix) >> (31 - rice_param); -++ last_coeff_abs_level_remaining = (prefix << rice_param) + suffix; -++ n = prefix + 1 + rice_param; -++ } -++ else if (prefix * 2 + rice_param <= CABAC_BY22_PEEK_BITS + 2) -++ { -++ const uint32_t suffix = ((y << prefix) | 0x80000000) >> (34 - (prefix + rice_param)); -++ -++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; -++ n = prefix * 2 + rice_param - 2; -++ } -++ else { -++ unsigned int suffix; -++ -++ get_cabac_by22_flush(c, prefix, y); -++ y = get_cabac_by22_peek(c); -++ -++ suffix = (y | 0x80000000) >> (34 - (prefix + rice_param)); -++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; -++ n = prefix + rice_param - 2; -++ } -++ -++ get_cabac_by22_flush(c, n, y); -++ -++ return last_coeff_abs_level_remaining; -++} -++#endif -++ -++static int coeff_abs_level_remaining_decode(HEVCContext * const s, int rc_rice_param) -+ { -++ CABACContext * const c = &s->HEVClc->cc; -+ int prefix = 0; -+ int suffix = 0; -+ int last_coeff_abs_level_remaining; -+ int i; -+ -+- while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) -++ while (prefix < CABAC_MAX_BIN && get_cabac_bypass(c)) -+ prefix++; -+ if (prefix == CABAC_MAX_BIN) { -+ av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix); -+ return 0; -+ } -++ -+ if (prefix < 3) { -+ for (i = 0; i < rc_rice_param; i++) -+- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); -++ suffix = (suffix << 1) | get_cabac_bypass(c); -+ last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix; -+ } else { -+ int prefix_minus3 = prefix - 3; -+ for (i = 0; i < prefix_minus3 + rc_rice_param; i++) -+- suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc); -++ suffix = (suffix << 1) | get_cabac_bypass(c); -+ last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1) -+ << rc_rice_param) + suffix; -+ } -++ -+ return last_coeff_abs_level_remaining; -+ } -+ -+-static av_always_inline int coeff_sign_flag_decode(HEVCContext *s, uint8_t nb) -++#if !USE_BY22 -++#define coeff_sign_flag_decode_bypass coeff_sign_flag_decode -++static inline uint32_t coeff_sign_flag_decode(HEVCContext * const s, const unsigned int nb) -+ { -+- int i; -+- int ret = 0; -++ CABACContext * const c = &s->HEVClc->cc; -++ unsigned int i; -++ uint32_t ret = 0; -+ -+ for (i = 0; i < nb; i++) -+- ret = (ret << 1) | get_cabac_bypass(&s->HEVClc->cc); -+- return ret; -++ ret = (ret << 1) | get_cabac_bypass(c); -++ -++ return ret << (32 - nb); -+ } -++#endif -++ -++#ifndef coeff_sign_flag_decode_bypass -++static inline uint32_t coeff_sign_flag_decode_bypass(HEVCContext * const s, const unsigned int nb) -++{ -++ CABACContext * const c = &s->HEVClc->cc; -++ uint32_t y; -++ y = get_cabac_by22_peek(c); -++ get_cabac_by22_flush(c, nb, y); -++ return y & ~(0xffffffffU >> nb); -++} -++#endif -++ -++ -++#ifndef get_cabac_greater1_bits -++static inline unsigned int get_cabac_greater1_bits(CABACContext * const c, const unsigned int n, -++ uint8_t * const state0) -++{ -++ unsigned int i; -++ unsigned int rv = 0; -++ for (i = 0; i != n; ++i) { -++ const unsigned int idx = rv != 0 ? 0 : i < 3 ? i + 1 : 3; -++ const unsigned int b = get_cabac(c, state0 + idx); -++ rv = (rv << 1) | b; -++ } -++ return rv; -++} -++#endif -++ -++ -++// N.B. levels returned are the values assuming coeff_abs_level_remaining -++// is uncoded, so 1 must be added if it is coded. sum_abs also reflects -++// this version of events. -++static inline uint32_t get_greaterx_bits(HEVCContext * const s, const unsigned int n_end, int * const levels, -++ int * const pprev_subset_coded, int * const psum, -++ const unsigned int idx0_gt1, const unsigned int idx_gt2) -++{ -++ CABACContext * const c = &s->HEVClc->cc; -++ uint8_t * const state0 = s->HEVClc->cabac_state + idx0_gt1; -++ uint8_t * const state_gt2 = s->HEVClc->cabac_state + idx_gt2; -++ unsigned int rv; -++ unsigned int i; -++ const unsigned int n = FFMIN(n_end, 8); -++ -++ // Really this is i != n but the simple unconditional loop is cheaper -++ // and faster -++ for (i = 0; i != 8; ++i) -++ levels[i] = 1; -++ -++ rv = get_cabac_greater1_bits(c, n, state0); -++ -++ *pprev_subset_coded = 0; -++ *psum = n; -++ -++ rv <<= (32 - n); -++ if (rv != 0) -++ { -++ *pprev_subset_coded = 1; -++ *psum = n + 1; -++ i = hevc_clz32(rv); -++ levels[i] = 2; -++ if (get_cabac(c, state_gt2) == 0) -++ { -++ // Unset first coded bit -++ rv &= ~(0x80000000U >> i); -++ } -++ } -++ -++ if (n_end > 8) { -++ const unsigned int g8 = n_end - 8; -++ rv |= ((1 << g8) - 1) << (24 - g8); -++ for (i = 0; i != g8; ++i) { -++ levels[i + 8] = 0; -++ } -++ } -++ -++ return rv; -++} -++ -++// extended_precision_processing_flag must be false given we are -++// putting the result into a 16-bit array -++// So trans_coeff_level must fit in 16 bits too (7.4.9.1 definition of coeff_abs_level_remaining) -++// scale_m is uint8_t -++// -++// scale is [40 - 72] << [0..12] based on qp- worst case is (45 << 12) -++// or it can be 2 (if we have transquant_bypass) -++// shift is set to one less than we really want but would normally be -++// s->ps.sps->bit_depth (max 16, min 8) + log2_trafo_size (max 5, min 2?) - 5 = max 16 min 5? -++// however the scale shift is substracted from shift to a min 0 so scale_m worst = 45 << 6 -++// This can still theoretically lead to overflow but the coding would have to be very odd (& inefficient) -++// to achieve it -++ -++#ifndef trans_scale_sat -++static inline int trans_scale_sat(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) -++{ -++ return av_clip_int16((((level * (int)(scale * scale_m)) >> shift) + 1) >> 1); -++} -++#endif -++ -++ -++#ifndef update_rice -++static inline void update_rice(uint8_t * const stat_coeff, -++ const unsigned int last_coeff_abs_level_remaining, -++ const unsigned int c_rice_param) -++{ -++ const unsigned int x = (last_coeff_abs_level_remaining << 1) >> c_rice_param; -++ if (x >= 6) -++ (*stat_coeff)++; -++ else if (x == 0 && *stat_coeff > 0) -++ (*stat_coeff)--; -++} -++#endif -++ -++ -++// n must be > 0 on entry -++#ifndef get_cabac_sig_coeff_flag_idxs -++static inline uint8_t * get_cabac_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, -++ unsigned int n, -++ const uint8_t const * ctx_map, -++ uint8_t * p) -++{ -++ do { -++ if (get_cabac(c, state0 + ctx_map[n])) -++ *p++ = n; -++ } while (--n != 0); -++ return p; -++} -++#endif -++ -++ -++static int get_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, -++ unsigned int n, -++ const uint8_t const * ctx_map, -++ uint8_t * const flag_idx) -++{ -++ int rv; -++ -++ rv = get_cabac_sig_coeff_flag_idxs(c, state0, n, ctx_map, flag_idx) - flag_idx; -++ -++ return rv; -++} -++ -++#define H4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -++ x0, x1, x2, x3,\ -++ x4, x5, x6, x7,\ -++ x8, x9, x10, x11,\ -++ x12, x13, x14, x15} -++ -++#define V4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -++ x0, x4, x8, x12,\ -++ x1, x5, x9, x13,\ -++ x2, x6, x10, x14,\ -++ x3, x7, x11, x15} -++ -++#define D4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ -++ x0, x4, x1, x8,\ -++ x5, x2, x12, x9,\ -++ x6, x3, x13, x10,\ -++ x7, x14, x11, x15} -++ -++ -++static inline int next_subset(HEVCContext * const s, int i, const int c_idx_nz, -++ uint8_t * const significant_coeff_group_flag, -++ const uint8_t * const scan_x_cg, const uint8_t * const scan_y_cg, -++ int * const pPrev_sig) -++{ -++ while (--i >= 0) { -++ unsigned int x_cg = scan_x_cg[i]; -++ unsigned int y_cg = scan_y_cg[i]; -++ -++ // For the flag decode we only care about Z/NZ but -++ // we use the full Right + Down * 2 when calculating -++ // significant coeff flags so we obtain it here -++ //. -++ // The group flag array is one longer than it needs to -++ // be so we don't need to check for y_cg limits -++ unsigned int prev_sig = ((significant_coeff_group_flag[y_cg] >> (x_cg + 1)) & 1) | -++ (((significant_coeff_group_flag[y_cg + 1] >> x_cg) & 1) << 1); -++ -++ if (i == 0 || -++ significant_coeff_group_flag_decode(s, c_idx_nz, prev_sig)) -++ { -++ significant_coeff_group_flag[y_cg] |= (1 << x_cg); -++ *pPrev_sig = prev_sig; -++ break; -++ } -++ } -++ -++ return i; -++} -++ -+ -+ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int log2_trafo_size, enum ScanType scan_idx, -+ int c_idx) -+ { -+-#define GET_COORD(offset, n) \ -+- do { \ -+- x_c = (x_cg << 2) + scan_x_off[n]; \ -+- y_c = (y_cg << 2) + scan_y_off[n]; \ -+- } while (0) -+- HEVCLocalContext *lc = s->HEVClc; -+- int transform_skip_flag = 0; -++ HEVCLocalContext * const lc = s->HEVClc; -++ int trans_skip_or_bypass = lc->cu.cu_transquant_bypass_flag; -+ -+ int last_significant_coeff_x, last_significant_coeff_y; -+- int last_scan_pos; -+- int n_end; -+ int num_coeff = 0; -+- int greater1_ctx = 1; -++ int prev_subset_coded = 0; -+ -+ int num_last_subset; -+ int x_cg_last_sig, y_cg_last_sig; -+ -+- const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off; -++ const uint8_t *scan_x_cg, *scan_y_cg; -++ const xy_off_t * scan_xy_off; -+ -+ ptrdiff_t stride = s->frame->linesize[c_idx]; -+ int hshift = s->ps.sps->hshift[c_idx]; -+@@ -1032,21 +1529,28 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + -+ ((x0 >> hshift) << s->ps.sps->pixel_shift)]; -+ #ifdef RPI -+- int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag && !transform_skip_flag && !lc->tu.cross_pf && log2_trafo_size>=4; -++ //***** transform_skip_flag decoded later! -++ int use_vpu = s->enable_rpi && !lc->cu.cu_transquant_bypass_flag /* && !transform_skip_flag*/ && !lc->tu.cross_pf && log2_trafo_size>=4; -+ #endif -+ int16_t *coeffs = (int16_t*)(c_idx ? lc->edge_emu_buffer2 : lc->edge_emu_buffer); -+- uint8_t significant_coeff_group_flag[8][8] = {{0}}; -++ uint8_t significant_coeff_group_flag[9] = {0}; // Allow 1 final byte that is always zero -+ int explicit_rdpcm_flag = 0; -+ int explicit_rdpcm_dir_flag; -+ -+ int trafo_size = 1 << log2_trafo_size; -+ int i; -+- int qp,shift,add,scale,scale_m; -++ int qp,shift,scale; -+ static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 }; -+ const uint8_t *scale_matrix = NULL; -+ uint8_t dc_scale; -+ int pred_mode_intra = (c_idx == 0) ? lc->tu.intra_pred_mode : -+ lc->tu.intra_pred_mode_c; -++ -++ int prev_sig = 0; -++ const int c_idx_nz = (c_idx != 0); -++ -++ int may_hide_sign; -++ -+ #ifdef RPI -+ if (s->enable_rpi) { -+ int n = trafo_size * trafo_size; -+@@ -1078,7 +1582,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ -+ // Derive QP for dequant -+ if (!lc->cu.cu_transquant_bypass_flag) { -+- static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; -++ static const uint8_t qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; -+ static const uint8_t rem6[51 + 4 * 6 + 1] = { -+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, -+ 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, -+@@ -1094,9 +1598,19 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ }; -+ int qp_y = lc->qp_y; -+ -++ may_hide_sign = s->ps.pps->sign_data_hiding_flag; -++ -+ if (s->ps.pps->transform_skip_enabled_flag && -+ log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) { -+- transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx); -++ int transform_skip_flag = hevc_transform_skip_flag_decode(s, c_idx_nz); -++ if (transform_skip_flag) { -++ trans_skip_or_bypass = 1; -++ if (lc->cu.pred_mode == MODE_INTRA && -++ s->ps.sps->implicit_rdpcm_enabled_flag && -++ (pred_mode_intra == 10 || pred_mode_intra == 26)) { -++ may_hide_sign = 0; -++ } -++ } -+ } -+ -+ if (c_idx == 0) { -+@@ -1129,39 +1643,73 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ qp += s->ps.sps->qp_bd_offset; -+ } -+ -+- shift = s->ps.sps->bit_depth + log2_trafo_size - 5; -+- add = 1 << (shift-1); -+- scale = level_scale[rem6[qp]] << (div6[qp]); -+- scale_m = 16; // default when no custom scaling lists. -+- dc_scale = 16; -++ // Shift is set to one less than will actually occur as the scale -++ // and saturate step adds 1 and then shifts right again -++ shift = s->ps.sps->bit_depth + log2_trafo_size - 6; -++ scale = level_scale[rem6[qp]]; -++ if (div6[qp] >= shift) { -++ scale <<= (div6[qp] - shift); -++ shift = 0; -++ } else { -++ shift -= div6[qp]; -++ } -+ -+- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { -++ if (s->ps.sps->scaling_list_enable_flag && !(trans_skip_or_bypass && log2_trafo_size > 2)) { -+ const ScalingList *sl = s->ps.pps->scaling_list_data_present_flag ? -+- &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; -++ &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; -+ int matrix_id = lc->cu.pred_mode != MODE_INTRA; -+ -+ matrix_id = 3 * matrix_id + c_idx; -+ -+ scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; -++ dc_scale = scale_matrix[0]; -+ if (log2_trafo_size >= 4) -+ dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; -+ } -++ else -++ { -++ static const uint8_t sixteen_scale[64] = { -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16, -++ 16, 16, 16, 16, 16, 16, 16, 16 -++ }; -++ scale_matrix = sixteen_scale; -++ dc_scale = 16; -++ } -+ } else { -++ static const uint8_t unit_scale[64] = { -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ 1, 1, 1, 1, 1, 1, 1, 1, -++ }; -++ scale_matrix = unit_scale; -+ shift = 0; -+- add = 0; -+- scale = 0; -+- dc_scale = 0; -++ scale = 2; // We will shift right to kill this -++ dc_scale = 1; -++ -++ may_hide_sign = 0; -+ } -+ -+ if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag && -+- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -+- explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx); -++ trans_skip_or_bypass) { -++ explicit_rdpcm_flag = explicit_rdpcm_flag_decode(s, c_idx_nz); -+ if (explicit_rdpcm_flag) { -+- explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx); -++ may_hide_sign = 0; -++ explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(s, c_idx_nz); -+ } -+ } -+ -+- last_significant_coeff_xy_prefix_decode(s, c_idx, log2_trafo_size, -++ last_significant_coeff_xy_prefix_decode(s, c_idx_nz, log2_trafo_size, -+ &last_significant_coeff_x, &last_significant_coeff_y); -+ -+ if (last_significant_coeff_x > 3) { -+@@ -1189,119 +1737,113 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ int last_x_c = last_significant_coeff_x & 3; -+ int last_y_c = last_significant_coeff_y & 3; -+ -+- scan_x_off = ff_hevc_diag_scan4x4_x; -+- scan_y_off = ff_hevc_diag_scan4x4_y; -+ num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; -+- if (trafo_size == 4) { -++ -++ switch (log2_trafo_size) { -++ case 2: -+ scan_x_cg = scan_1x1; -+ scan_y_cg = scan_1x1; -+- } else if (trafo_size == 8) { -++ break; -++ case 3: -+ num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; -+ scan_x_cg = diag_scan2x2_x; -+ scan_y_cg = diag_scan2x2_y; -+- } else if (trafo_size == 16) { -++ break; -++ case 4: -+ num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; -+ scan_x_cg = ff_hevc_diag_scan4x4_x; -+ scan_y_cg = ff_hevc_diag_scan4x4_y; -+- } else { // trafo_size == 32 -++ break; -++ case 5: -++ default: -+ num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; -+ scan_x_cg = ff_hevc_diag_scan8x8_x; -+ scan_y_cg = ff_hevc_diag_scan8x8_y; -++ break; -+ } -+ break; -+ } -+ case SCAN_HORIZ: -+ scan_x_cg = horiz_scan2x2_x; -+ scan_y_cg = horiz_scan2x2_y; -+- scan_x_off = horiz_scan4x4_x; -+- scan_y_off = horiz_scan4x4_y; -+ num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; -+ break; -+ default: //SCAN_VERT -+ scan_x_cg = horiz_scan2x2_y; -+ scan_y_cg = horiz_scan2x2_x; -+- scan_x_off = horiz_scan4x4_y; -+- scan_y_off = horiz_scan4x4_x; -+ num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; -+ break; -+ } -+ num_coeff++; -+ num_last_subset = (num_coeff - 1) >> 4; -+ -+- for (i = num_last_subset; i >= 0; i--) { -+- int n, m; -+- int x_cg, y_cg, x_c, y_c, pos; -+- int implicit_non_zero_coeff = 0; -+- int64_t trans_coeff_level; -+- int prev_sig = 0; -+- int offset = i << 4; -+- int rice_init = 0; -+- -+- uint8_t significant_coeff_flag_idx[16]; -+- uint8_t nb_significant_coeff_flag = 0; -++ significant_coeff_group_flag[y_cg_last_sig] = 1 << x_cg_last_sig; // 1st subset always significant -+ -+- x_cg = scan_x_cg[i]; -+- y_cg = scan_y_cg[i]; -++ scan_xy_off = off_xys[scan_idx][log2_trafo_size - 2]; -+ -+- if ((i < num_last_subset) && (i > 0)) { -+- int ctx_cg = 0; -+- if (x_cg < (1 << (log2_trafo_size - 2)) - 1) -+- ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg]; -+- if (y_cg < (1 << (log2_trafo_size - 2)) - 1) -+- ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1]; -+- -+- significant_coeff_group_flag[x_cg][y_cg] = -+- significant_coeff_group_flag_decode(s, c_idx, ctx_cg); -+- implicit_non_zero_coeff = 1; -+- } else { -+- significant_coeff_group_flag[x_cg][y_cg] = -+- ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) || -+- (x_cg == 0 && y_cg == 0)); -+- } -++ i = num_last_subset; -++ do { -++ int implicit_non_zero_coeff = 0; -++ int n_end; -+ -+- last_scan_pos = num_coeff - offset - 1; -++ uint8_t significant_coeff_flag_idx[16]; -++ unsigned int nb_significant_coeff_flag = 0; -+ -+ if (i == num_last_subset) { -++ // First time through -++ int last_scan_pos = num_coeff - (i << 4) - 1; -+ n_end = last_scan_pos - 1; -+ significant_coeff_flag_idx[0] = last_scan_pos; -+ nb_significant_coeff_flag = 1; -+ } else { -+ n_end = 15; -++ implicit_non_zero_coeff = (i != 0); -+ } -+ -+- if (x_cg < ((1 << log2_trafo_size) - 1) >> 2) -+- prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg]; -+- if (y_cg < ((1 << log2_trafo_size) - 1) >> 2) -+- prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1); -+- -+- if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) { -+- static const uint8_t ctx_idx_map[] = { -+- 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8, // log2_trafo_size == 2 -+- 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 0 -+- 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, // prev_sig == 1 -+- 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, // prev_sig == 2 -+- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 // default -++ if (n_end >= 0) { -++ static const uint8_t ctx_idx_maps_ts2[3][16] = { -++ D4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 -++ H4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 -++ V4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8) // log2_trafo_size == 2 -++ }; -++ static const uint8_t ctx_idx_maps[3][4][16] = { -++ { -++ D4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -++ D4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -++ D4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -++ D4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -++ }, -++ { -++ H4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -++ H4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -++ H4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -++ H4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -++ }, -++ { -++ V4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 -++ V4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 1 -++ V4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 2 -++ V4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default -++ } -+ }; -+ const uint8_t *ctx_idx_map_p; -+ int scf_offset = 0; -+- if (s->ps.sps->transform_skip_context_enabled_flag && -+- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -+- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[4 * 16]; -+- if (c_idx == 0) { -+- scf_offset = 40; -+- } else { -+- scf_offset = 14 + 27; -+- } -++ -++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { -++ ctx_idx_map_p = ctx_idx_maps[0][3]; -++ scf_offset = 40 + c_idx_nz; -+ } else { -+- if (c_idx != 0) -++ if (c_idx_nz != 0) -+ scf_offset = 27; -++ -+ if (log2_trafo_size == 2) { -+- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[0]; -++ ctx_idx_map_p = ctx_idx_maps_ts2[scan_idx]; -+ } else { -+- ctx_idx_map_p = (uint8_t*) &ctx_idx_map[(prev_sig + 1) << 4]; -+- if (c_idx == 0) { -+- if ((x_cg > 0 || y_cg > 0)) -++ ctx_idx_map_p = ctx_idx_maps[scan_idx][prev_sig]; -++ if (!c_idx_nz) { -++ if (i != 0) -+ scf_offset += 3; -++ -+ if (log2_trafo_size == 3) { -+ scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; -+ } else { -+@@ -1315,34 +1857,30 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ } -+ } -+- for (n = n_end; n > 0; n--) { -+- x_c = scan_x_off[n]; -+- y_c = scan_y_off[n]; -+- if (significant_coeff_flag_decode(s, x_c, y_c, scf_offset, ctx_idx_map_p)) { -+- significant_coeff_flag_idx[nb_significant_coeff_flag] = n; -+- nb_significant_coeff_flag++; -++ -++ if (n_end > 0) { -++ int cnt = get_sig_coeff_flag_idxs(&s->HEVClc->cc, -++ s->HEVClc->cabac_state + elem_offset[SIGNIFICANT_COEFF_FLAG] + scf_offset, -++ n_end, ctx_idx_map_p, -++ significant_coeff_flag_idx + nb_significant_coeff_flag); -++ -++ nb_significant_coeff_flag += cnt; -++ if (cnt != 0) { -+ implicit_non_zero_coeff = 0; -+ } -+ } -++ -+ if (implicit_non_zero_coeff == 0) { -+- if (s->ps.sps->transform_skip_context_enabled_flag && -+- (transform_skip_flag || lc->cu.cu_transquant_bypass_flag)) { -+- if (c_idx == 0) { -+- scf_offset = 42; -+- } else { -+- scf_offset = 16 + 27; -+- } -++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { -++ scf_offset = 42 + c_idx_nz; -+ } else { -+ if (i == 0) { -+- if (c_idx == 0) -+- scf_offset = 0; -+- else -+- scf_offset = 27; -++ scf_offset = c_idx_nz ? 27 : 0; -+ } else { -+ scf_offset = 2 + scf_offset; -+ } -+ } -+- if (significant_coeff_flag_decode_0(s, c_idx, scf_offset) == 1) { -++ if (significant_coeff_flag_decode_0(s, scf_offset) == 1) { -+ significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; -+ nb_significant_coeff_flag++; -+ } -+@@ -1352,141 +1890,185 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ } -+ } -+ -+- n_end = nb_significant_coeff_flag; -+- -++ if (nb_significant_coeff_flag != 0) { -++ const unsigned int gt1_idx_delta = (c_idx_nz << 2) | -++ ((i != 0 && !c_idx_nz) ? 2 : 0) | -++ prev_subset_coded; -++ const unsigned int idx0_gt1 = elem_offset[COEFF_ABS_LEVEL_GREATER1_FLAG] + -++ (gt1_idx_delta << 2); -++ const unsigned int idx_gt2 = elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + -++ gt1_idx_delta; -++ -++ const unsigned int x_cg = scan_x_cg[i]; -++ const unsigned int y_cg = scan_y_cg[i]; -++ int16_t * const blk_coeffs = coeffs + -++ ((x_cg + (y_cg << log2_trafo_size)) << 2); -++ // This calculation is 'wrong' for log2_traffo_size == 2 -++ // but that doesn't mattor as in this case x_cg & y_cg -++ // are always 0 so result is correct (0) anyway -++ const uint8_t * const blk_scale = scale_matrix + -++ (((x_cg + (y_cg << 3)) << (5 - log2_trafo_size))); -++ -++ // * THe following code block doesn't deal with these flags: -++ // (nor did the one it replaces) -++ // -++ // cabac_bypass_alignment_enabled_flag -++ // This should be easy but I can't find a test case -++ // extended_precision_processing_flag -++ // This can extend the required precision past 16bits -++ // so is probably tricky - also no example found yet -++ -++#if USE_N_END_1 -++ if (nb_significant_coeff_flag == 1) { -++ // There is a small gain to be had from special casing the single -++ // transform coefficient case. The reduction in complexity -++ // makes up for the code duplicatioon. -++ -++ int trans_coeff_level = 1; -++ int coeff_sign_flag; -++ int coded_val = 0; -++ -++ // initialize first elem of coeff_bas_level_greater1_flag -++ prev_subset_coded = 0; -++ -++ if (get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx0_gt1 + 1)) { -++ trans_coeff_level = 2; -++ prev_subset_coded = 1; -++ coded_val = get_cabac(&s->HEVClc->cc, s->HEVClc->cabac_state + idx_gt2); -++ } -+ -+- if (n_end) { -+- int first_nz_pos_in_cg; -+- int last_nz_pos_in_cg; -+- int c_rice_param = 0; -+- int first_greater1_coeff_idx = -1; -+- uint8_t coeff_abs_level_greater1_flag[8]; -+- uint16_t coeff_sign_flag; -+- int sum_abs = 0; -+- int sign_hidden; -+- int sb_type; -++ // Probably not worth the overhead of starting by22 for just one value -++ coeff_sign_flag = get_cabac_bypass(&s->HEVClc->cc); -+ -++ if (coded_val) -++ { -++ if (!s->ps.sps->persistent_rice_adaptation_enabled_flag) { -++ trans_coeff_level = 3 + coeff_abs_level_remaining_decode(s, 0); -++ } else { -++ uint8_t * const stat_coeff = -++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); -++ const unsigned int c_rice_param = *stat_coeff >> 2; -++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -+ -+- // initialize first elem of coeff_bas_level_greater1_flag -+- int ctx_set = (i > 0 && c_idx == 0) ? 2 : 0; -++ trans_coeff_level = 3 + last_coeff_abs_level_remaining; -++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); -++ } -++ } -+ -+- if (s->ps.sps->persistent_rice_adaptation_enabled_flag) { -+- if (!transform_skip_flag && !lc->cu.cu_transquant_bypass_flag) -+- sb_type = 2 * (c_idx == 0 ? 1 : 0); -+- else -+- sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1; -+- c_rice_param = lc->stat_coeff[sb_type] / 4; -+- } -++ { -++ const xy_off_t * const xy_off = scan_xy_off + significant_coeff_flag_idx[0]; -++ const int k = (int32_t)(coeff_sign_flag << 31) >> 31; -++ const unsigned int scale_m = blk_scale[xy_off->scale]; -+ -+- if (!(i == num_last_subset) && greater1_ctx == 0) -+- ctx_set++; -+- greater1_ctx = 1; -+- last_nz_pos_in_cg = significant_coeff_flag_idx[0]; -+- -+- for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) { -+- int inc = (ctx_set << 2) + greater1_ctx; -+- coeff_abs_level_greater1_flag[m] = -+- coeff_abs_level_greater1_flag_decode(s, c_idx, inc); -+- if (coeff_abs_level_greater1_flag[m]) { -+- greater1_ctx = 0; -+- if (first_greater1_coeff_idx == -1) -+- first_greater1_coeff_idx = m; -+- } else if (greater1_ctx > 0 && greater1_ctx < 3) { -+- greater1_ctx++; -++ blk_coeffs[xy_off->coeff] = trans_scale_sat( -++ (trans_coeff_level ^ k) - k, // Apply sign -++ scale, -++ i == 0 && xy_off->coeff == 0 ? dc_scale : scale_m, -++ shift); -+ } -+ } -+- first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1]; -+- -+- if (lc->cu.cu_transquant_bypass_flag || -+- (lc->cu.pred_mode == MODE_INTRA && -+- s->ps.sps->implicit_rdpcm_enabled_flag && transform_skip_flag && -+- (pred_mode_intra == 10 || pred_mode_intra == 26 )) || -+- explicit_rdpcm_flag) -+- sign_hidden = 0; -+ else -+- sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4); -++#endif -++ { -++ int sign_hidden = may_hide_sign; -++ int levels[16]; // Should be able to get away with int16_t but that fails some tests -++ uint32_t coeff_sign_flags; -++ uint32_t coded_vals = 0; -++ // Sum(abs(level[])) -++ // In fact we only need the bottom bit and in some future -++ // version that may be all we calculate -++ unsigned int sum_abs; -++ -++ coded_vals = get_greaterx_bits(s, nb_significant_coeff_flag, levels, -++ &prev_subset_coded, &sum_abs, idx0_gt1, idx_gt2); -++ -++ if (significant_coeff_flag_idx[0] - significant_coeff_flag_idx[nb_significant_coeff_flag - 1] <= 3) -++ sign_hidden = 0; -++ -++ // -- Start bypass block -++ -++ bypass_start(s); -++ -++ coeff_sign_flags = coeff_sign_flag_decode_bypass(s, nb_significant_coeff_flag - sign_hidden); -++ -++ if (coded_vals != 0) -++ { -++ const int rice_adaptation_enabled = s->ps.sps->persistent_rice_adaptation_enabled_flag; -++ uint8_t * stat_coeff = !rice_adaptation_enabled ? NULL : -++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); -++ int c_rice_param = !rice_adaptation_enabled ? 0 : *stat_coeff >> 2; -++ int * level = levels - 1; -++ -++ do { -++ { -++ const unsigned int z = hevc_clz32(coded_vals) + 1; -++ level += z; -++ coded_vals <<= z; -++ } -+ -+- if (first_greater1_coeff_idx != -1) { -+- coeff_abs_level_greater1_flag[first_greater1_coeff_idx] += coeff_abs_level_greater2_flag_decode(s, c_idx, ctx_set); -+- } -+- if (!s->ps.pps->sign_data_hiding_flag || !sign_hidden ) { -+- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag) << (16 - nb_significant_coeff_flag); -+- } else { -+- coeff_sign_flag = coeff_sign_flag_decode(s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1)); -+- } -++ { -++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode_bypass(s, c_rice_param); -++ const int trans_coeff_level = *level + last_coeff_abs_level_remaining + 1; -++ -++ sum_abs += last_coeff_abs_level_remaining + 1; -++ *level = trans_coeff_level; -+ -+- for (m = 0; m < n_end; m++) { -+- n = significant_coeff_flag_idx[m]; -+- GET_COORD(offset, n); -+- if (m < 8) { -+- trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m]; -+- if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) { -+- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -+- -+- trans_coeff_level += last_coeff_abs_level_remaining; -+- if (trans_coeff_level > (3 << c_rice_param)) -+- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); -+- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { -+- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; -+- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) -+- lc->stat_coeff[sb_type]++; -+- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) -+- if (lc->stat_coeff[sb_type] > 0) -+- lc->stat_coeff[sb_type]--; -+- rice_init = 1; -++ if (stat_coeff != NULL) -++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); -++ stat_coeff = NULL; -++ -++ if (trans_coeff_level > (3 << c_rice_param) && -++ (c_rice_param < 4 || rice_adaptation_enabled)) -++ ++c_rice_param; -+ } -+- } -+- } else { -+- int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(s, c_rice_param); -+- -+- trans_coeff_level = 1 + last_coeff_abs_level_remaining; -+- if (trans_coeff_level > (3 << c_rice_param)) -+- c_rice_param = s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 : FFMIN(c_rice_param + 1, 4); -+- if (s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) { -+- int c_rice_p_init = lc->stat_coeff[sb_type] / 4; -+- if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init)) -+- lc->stat_coeff[sb_type]++; -+- else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init)) -+- if (lc->stat_coeff[sb_type] > 0) -+- lc->stat_coeff[sb_type]--; -+- rice_init = 1; -+- } -++ } while (coded_vals != 0); -+ } -+- if (s->ps.pps->sign_data_hiding_flag && sign_hidden) { -+- sum_abs += trans_coeff_level; -+- if (n == first_nz_pos_in_cg && (sum_abs&1)) -+- trans_coeff_level = -trans_coeff_level; -++ -++ // sign_hidden = 0 or 1 so we can combine the tests -++ if ((sign_hidden & sum_abs) != 0) { -++ levels[nb_significant_coeff_flag - 1] = -levels[nb_significant_coeff_flag - 1]; -+ } -+- if (coeff_sign_flag >> 15) -+- trans_coeff_level = -trans_coeff_level; -+- coeff_sign_flag <<= 1; -+- if(!lc->cu.cu_transquant_bypass_flag) { -+- if (s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) { -+- if(y_c || x_c || log2_trafo_size < 4) { -+- switch(log2_trafo_size) { -+- case 3: pos = (y_c << 3) + x_c; break; -+- case 4: pos = ((y_c >> 1) << 3) + (x_c >> 1); break; -+- case 5: pos = ((y_c >> 2) << 3) + (x_c >> 2); break; -+- default: pos = (y_c << 2) + x_c; break; -+- } -+- scale_m = scale_matrix[pos]; -+- } else { -+- scale_m = dc_scale; -+- } -++ -++ bypass_finish(s); -++ -++ // -- Finish bypass block -++ -++ // Scale loop -++ { -++ int m = nb_significant_coeff_flag - 1; -++ -++ // Deal with DC component (if any) first -++ if (i == 0 && significant_coeff_flag_idx[m] == 0) -++ { -++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; -++ blk_coeffs[0] = trans_scale_sat( -++ (levels[m] ^ k) - k, scale, dc_scale, shift); -++ --m; -+ } -+- trans_coeff_level = (trans_coeff_level * (int64_t)scale * (int64_t)scale_m + add) >> shift; -+- if(trans_coeff_level < 0) { -+- if((~trans_coeff_level) & 0xFffffffffff8000) -+- trans_coeff_level = -32768; -+- } else { -+- if(trans_coeff_level & 0xffffffffffff8000) -+- trans_coeff_level = 32767; -++ -++#if !USE_N_END_1 -++ // If N_END_! set then m was at least 1 initially -++ if (m >= 0) -++#endif -++ { -++ do { -++ const xy_off_t * const xy_off = scan_xy_off + -++ significant_coeff_flag_idx[m]; -++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; -++ -++ blk_coeffs[xy_off->coeff] = trans_scale_sat( -++ (levels[m] ^ k) - k, -++ scale, -++ blk_scale[xy_off->scale], -++ shift); -++ } while (--m >= 0); -+ } -+ } -+- coeffs[y_c * trafo_size + x_c] = trans_coeff_level; -++ -+ } -+ } -+- } -++ } while ((i = next_subset(s, i, c_idx_nz, -++ significant_coeff_group_flag, scan_x_cg, scan_y_cg, &prev_sig)) >= 0); -+ -+ if (lc->cu.cu_transquant_bypass_flag) { -+ if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && -+@@ -1496,7 +2078,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, -+ s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); -+ } -+ } else { -+- if (transform_skip_flag) { -++ if (trans_skip_or_bypass) { // Must be trans_skip as we've already dealt with bypass -+ int rot = s->ps.sps->transform_skip_rotation_enabled_flag && -+ log2_trafo_size == 2 && -+ lc->cu.pred_mode == MODE_INTRA; -+-- -+2.7.4 -+ -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 48f8d56988718dd53294e8291a53e532f0ff338d..337dbaab927919858e44d79f647207ef0513eea1 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -3,7 +3,8 @@ include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ - hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \ -- pfcd_hevc_optimisations.patch -+ pfcd_hevc_optimisations.patch \ -+ 0001-Squashed-commit-of-the-following.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -71,6 +72,7 @@ ifeq ($(Configuration), Release) - ffmpg_config += --disable-debug - endif - -+ffmpg_config += --extra-cflags="-DRPI=1" - - CLEAN_FILES=$(ARCHIVE) $(PLATFORM) - -@@ -87,6 +89,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch -+ cd $(PLATFORM); patch -p1 < ../0001-Squashed-commit-of-the-following.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index d6856dbd4fb4957ace700cbc08332223c01938f6..a61357f14cb2139e8125ae04684bed1b29fefb12 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -136,6 +136,7 @@ patch -p1 < ../0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch - patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - patch -p1 < ../pfcd_hevc_optimisations.patch -+patch -p1 < ../0001-Squashed-commit-of-the-following.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -@@ -170,6 +171,7 @@ CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - --enable-zlib \ - --disable-mipsdsp \ - --disable-mipsdspr2 \ -+ --extra-cflags="-DRPI=1" \ - ${FLAGS} - - make -j ${BUILDTHREADS} - -From 74ed08120dcf15fe8429da268d7dd63711e7fc48 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 16 Sep 2015 19:05:12 +0100 -Subject: [PATCH 28/62] [3d] Make MVC a valid 3D filename tag - ---- - xbmc/guilib/StereoscopicsManager.cpp | 9 +++++++++ - xbmc/settings/AdvancedSettings.cpp | 2 ++ - xbmc/settings/AdvancedSettings.h | 1 + - 3 files changed, 12 insertions(+) - -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index b34873cba6534086ae243326550385867a03256a..1443acaf0f25df458ae49766e13dd0323454f2eb 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -197,6 +197,15 @@ std::string CStereoscopicsManager::DetectStereoModeByString(const std::string &n - if (re.RegFind(searchString) > -1) - stereoMode = "top_bottom"; - -+ if (!re.RegComp(g_advancedSettings.m_stereoscopicregex_mvc.c_str())) -+ { -+ CLog::Log(LOGERROR, "%s: Invalid RegExp for matching 3d MVC content:'%s'", __FUNCTION__, g_advancedSettings.m_stereoscopicregex_mvc.c_str()); -+ return stereoMode; -+ } -+ -+ if (re.RegFind(searchString) > -1) -+ stereoMode = "left_right"; -+ - return stereoMode; - } - -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 3891a7ed34acb3489a860678d56a8ec049890f6e..974305ff329eb6999c908d5e05d723f93137ae33 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -402,6 +402,7 @@ void CAdvancedSettings::Initialize() - m_stereoscopicregex_3d = "[-. _]3d[-. _]"; - m_stereoscopicregex_sbs = "[-. _]h?sbs[-. _]"; - m_stereoscopicregex_tab = "[-. _]h?tab[-. _]"; -+ m_stereoscopicregex_mvc = "[-. _]h?mvc[-. _]"; - - m_useDisplayControlHWStereo = false; - -@@ -551,6 +552,7 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) - XMLUtils::GetString(pElement, "stereoscopicregex3d", m_stereoscopicregex_3d); - XMLUtils::GetString(pElement, "stereoscopicregexsbs", m_stereoscopicregex_sbs); - XMLUtils::GetString(pElement, "stereoscopicregextab", m_stereoscopicregex_tab); -+ XMLUtils::GetString(pElement, "stereoscopicregexmvc", m_stereoscopicregex_mvc); - XMLUtils::GetFloat(pElement, "subsdelayrange", m_videoSubsDelayRange, 10, 600); - XMLUtils::GetFloat(pElement, "audiodelayrange", m_videoAudioDelayRange, 10, 600); - XMLUtils::GetString(pElement, "defaultplayer", m_videoDefaultPlayer); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index fc526d11c3a78bc74125429120e29bf295bd3b16..6b0e3b8cf9e3ff40e6af758c54fe7eefb89a131c 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -372,6 +372,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - std::string m_stereoscopicregex_3d; - std::string m_stereoscopicregex_sbs; - std::string m_stereoscopicregex_tab; -+ std::string m_stereoscopicregex_mvc; - - bool m_useDisplayControlHWStereo; - - -From 4c051282f501f503dd7fffa2c5de404c7f226bf5 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 5 Oct 2015 14:58:05 +0100 -Subject: [PATCH 29/62] [3d] Swap top/bottom sides of GUI - ---- - xbmc/guilib/GraphicContext.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp -index 3706e4d80b3b31da4c5be0a1b21f36e59d2910f2..e170b3fb05279ffa316794dbce1d4f9dc5697bd0 100644 ---- a/xbmc/guilib/GraphicContext.cpp -+++ b/xbmc/guilib/GraphicContext.cpp -@@ -266,7 +266,7 @@ CPoint CGraphicContext::StereoCorrection(const CPoint &point) const - { - const RESOLUTION_INFO info = GetResInfo(); - -- if(m_stereoView == RENDER_STEREO_VIEW_RIGHT) -+ if(m_stereoView == RENDER_STEREO_VIEW_LEFT) - res.y += info.iHeight + info.iBlanking; - } - if(m_stereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL) - -From f29ad40c8e501bebc8aa27133b3197ed9b7314dc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 11 Oct 2015 20:51:37 +0100 -Subject: [PATCH 30/62] Revert "Revert "Disable extra logging by default"" - -This reverts commit a880554325be187b877cd8f0e2b338e7267da636. ---- - system/settings/settings.xml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 326ffbd0f08428c3b4a95208134253feeabf1b1f..22dcff1c06577055f84c3d2c2fda73cfa16c53d4 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2822,12 +2822,12 @@ - - - 1 -- true -+ false - - - - 1 -- 32768 -+ - - loggingcomponents - , - -From 27644a4501775081bd9d7e70c3dc327b2edf5575 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 21 Dec 2015 22:17:25 +0000 -Subject: [PATCH 31/62] [omximage] Fall back to arm jpeg encode/decode when gpu - is busy - ---- - xbmc/cores/omxplayer/OMXImage.cpp | 50 ++++++++++++++++++++++++++++++++------- - xbmc/cores/omxplayer/OMXImage.h | 7 ++++++ - 2 files changed, 48 insertions(+), 9 deletions(-) - -diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index d2560aa78980e44d5f2d1483bce976cb83353502..e16dbf00b8d8192df4c6e946a48d8f20a72d762d 100644 ---- a/xbmc/cores/omxplayer/OMXImage.cpp -+++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -57,12 +57,17 @@ static XbmcThreads::ConditionVariable g_count_cond; - static CCriticalSection g_count_lock; - static int g_count_val; - --static void limit_calls_enter() -+static bool limit_calls_enter() - { - CSingleLock lock(g_count_lock); -+ // on Pi2 fall back to arm decode if the queue is getting big -+ if (g_RBP.RasberryPiVersion() > 1 && g_count_val >= 2) -+ return false; -+ - while (g_count_val >= 3) - g_count_cond.wait(lock); - g_count_val++; -+ return true; - } - - static void limit_calls_leave() -@@ -112,6 +117,9 @@ bool COMXImage::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int w - unsigned int format, unsigned int pitch, const std::string& destFile) - { - COMXImageEnc omxImageEnc; -+ if (!omxImageEnc.Gpu()) -+ return false; -+ - bool ret = omxImageEnc.CreateThumbnailFromSurface(buffer, width, height, format, pitch, destFile); - if (!ret) - CLog::Log(LOGNOTICE, "%s: unable to create thumbnail %s %dx%d", __func__, destFile.c_str(), width, height); -@@ -205,6 +213,8 @@ bool COMXImage::CreateThumb(const std::string& srcFile, unsigned int maxHeight, - bool okay = false; - COMXImageFile file; - COMXImageReEnc reenc; -+ if (!reenc.Gpu()) -+ return false; - void *pDestBuffer; - unsigned int nDestSize; - int orientation = additional_info == "flipped" ? 1:0; -@@ -310,6 +320,9 @@ bool COMXImage::DecodeJpegToTexture(COMXImageFile *file, unsigned int width, uns - bool ret = false; - COMXTexture omx_image; - -+ if (!omx_image.Gpu()) -+ return false; -+ - struct textureinfo *tex = new struct textureinfo; - if (!tex) - return NULL; -@@ -924,7 +937,7 @@ bool COMXImageFile::ReadFile(const std::string& inputFile, int orientation) - - COMXImageDec::COMXImageDec() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - m_decoded_buffer = NULL; - OMX_INIT_STRUCTURE(m_decoded_format); - m_success = false; -@@ -936,7 +949,8 @@ COMXImageDec::~COMXImageDec() - - OMX_INIT_STRUCTURE(m_decoded_format); - m_decoded_buffer = NULL; -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - void COMXImageDec::Close() -@@ -1086,6 +1100,9 @@ bool COMXImageDec::HandlePortSettingChange(unsigned int resize_width, unsigned i - - bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, unsigned width, unsigned height, unsigned stride, void *pixels) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - OMX_BUFFERHEADERTYPE *omx_buffer = NULL; -@@ -1223,7 +1240,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes - - COMXImageEnc::COMXImageEnc() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - CSingleLock lock(m_OMXSection); - OMX_INIT_STRUCTURE(m_encoded_format); - m_encoded_buffer = NULL; -@@ -1247,11 +1264,15 @@ COMXImageEnc::~COMXImageEnc() - m_omx_encoder.Deinitialize(); - } - } -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsigned height, unsigned int pitch) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - - unsigned int demuxer_bytes = 0; -@@ -1432,6 +1453,9 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig - bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const std::string& destFile) - { -+ if (!m_gpu) -+ return false; -+ - if(format != XB_FMT_A8R8G8B8 || !buffer) - { - CLog::Log(LOGDEBUG, "%s::%s : %s failed format=0x%x\n", CLASSNAME, __func__, destFile.c_str(), format); -@@ -1465,7 +1489,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in - - COMXImageReEnc::COMXImageReEnc() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - m_encoded_buffer = NULL; - m_pDestBuffer = NULL; - m_nDestAllocSize = 0; -@@ -1479,7 +1503,8 @@ COMXImageReEnc::~COMXImageReEnc() - free (m_pDestBuffer); - m_pDestBuffer = NULL; - m_nDestAllocSize = 0; -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - void COMXImageReEnc::Close() -@@ -1771,6 +1796,9 @@ bool COMXImageReEnc::HandlePortSettingChange(unsigned int resize_width, unsigned - - bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, unsigned int maxHeight, void * &pDestBuffer, unsigned int &nDestSize) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - -@@ -1943,14 +1971,15 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns - - COMXTexture::COMXTexture() - { -- limit_calls_enter(); -+ m_gpu = limit_calls_enter(); - m_success = false; - } - - COMXTexture::~COMXTexture() - { - Close(); -- limit_calls_leave(); -+ if (m_gpu) -+ limit_calls_leave(); - } - - void COMXTexture::Close() -@@ -2134,6 +2163,9 @@ bool COMXTexture::HandlePortSettingChange(unsigned int resize_width, unsigned in - - bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, unsigned int width, unsigned int height, void *egl_image) - { -+ if (!m_gpu) -+ return false; -+ - CSingleLock lock(m_OMXSection); - OMX_ERRORTYPE omx_err = OMX_ErrorNone; - -diff --git a/xbmc/cores/omxplayer/OMXImage.h b/xbmc/cores/omxplayer/OMXImage.h -index a93aa82663903fb1bf712058c2e259290ee742e6..6f38dbc7e5cc721c59a3633935f08218eb1dd169 100644 ---- a/xbmc/cores/omxplayer/OMXImage.h -+++ b/xbmc/cores/omxplayer/OMXImage.h -@@ -133,6 +133,7 @@ protected: - OMX_PARAM_PORTDEFINITIONTYPE m_decoded_format; - CCriticalSection m_OMXSection; - bool m_success; -+ bool m_gpu; - }; - - class COMXImageEnc -@@ -144,6 +145,7 @@ public: - // Required overrides - bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const std::string& destFile); -+ bool Gpu() { return m_gpu; } - protected: - bool Encode(unsigned char *buffer, int size, unsigned int width, unsigned int height, unsigned int pitch); - // Components -@@ -152,6 +154,7 @@ protected: - OMX_PARAM_PORTDEFINITIONTYPE m_encoded_format; - CCriticalSection m_OMXSection; - bool m_success; -+ bool m_gpu; - }; - - class COMXImageReEnc -@@ -163,6 +166,7 @@ public: - // Required overrides - void Close(); - bool ReEncode(COMXImageFile &srcFile, unsigned int width, unsigned int height, void * &pDestBuffer, unsigned int &nDestSize); -+ bool Gpu() { return m_gpu; } - protected: - bool HandlePortSettingChange(unsigned int resize_width, unsigned int resize_height, int orientation, bool port_settings_changed); - // Components -@@ -176,6 +180,7 @@ protected: - void *m_pDestBuffer; - unsigned int m_nDestAllocSize; - bool m_success; -+ bool m_gpu; - }; - - class COMXTexture -@@ -187,6 +192,7 @@ public: - // Required overrides - void Close(void); - bool Decode(const uint8_t *data, unsigned size, unsigned int width, unsigned int height, void *egl_image); -+ bool Gpu() { return m_gpu; } - protected: - bool HandlePortSettingChange(unsigned int resize_width, unsigned int resize_height, void *egl_image, bool port_settings_changed); - -@@ -201,6 +207,7 @@ protected: - OMX_BUFFERHEADERTYPE *m_egl_buffer; - CCriticalSection m_OMXSection; - bool m_success; -+ bool m_gpu; - }; - - extern COMXImage g_OMXImage; - -From 7d8d250f20930ac4d8684579b45c122f80b19bdd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 9 Dec 2015 13:31:14 +0000 -Subject: [PATCH 32/62] [mmalcodec] Fail to open when width is invalid. Can - happen with mpegts files - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index 822b7bf75f2e732b5eed8687403d0eda503fa641..c43952d4d29b42f3a5c7605573294568f79ca010 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -368,6 +368,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s usemmal:%d software:%d %dx%d renderer:%p", CLASSNAME, __func__, CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMMAL), hints.software, hints.width, hints.height, options.m_opaque_pointer); - -+ // This occurs at start of m2ts files before streams have been fully identified - just ignore -+ if (!hints.width) -+ return false; - // we always qualify even if DVDFactoryCodec does this too. - if (!CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMMAL) || hints.software) - return false; - -From d458533c19e59c92917de490a1214fd883f59ab2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 33/62] [videoplayer/rbp] Add pi specific option to maintain - vsync with pll adjustment - -New A/V sync option in settings/video/playback to do "Adjust PLL". -This uses video clock (so perfect video syncing) but avoids having to resample -or drop/dupe audio packets which is normally required. ---- - .../resource.language.en_gb/resources/strings.po | 32 ++++++++++++++++++++++ - system/settings/rbp.xml | 14 ++++++++++ - .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 25 +++++++++++------ - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 9 +++++- - .../Engines/ActiveAE/ActiveAEStream.cpp | 24 +++++++++++++--- - .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 7 +++-- - xbmc/cores/AudioEngine/Interfaces/AEStream.h | 10 ++++++- - xbmc/cores/VideoPlayer/DVDAudio.cpp | 4 +-- - xbmc/cores/VideoPlayer/DVDAudio.h | 2 +- - xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 12 ++++++-- - xbmc/linux/RBP.cpp | 20 ++++++++++++++ - xbmc/linux/RBP.h | 5 ++++ - 12 files changed, 143 insertions(+), 21 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ae3aa10aa65beac6689f129d60056cadf8a5b5c1..7c7969d381bf15ac1ba2fd8f16e463f6b12fe4c3 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -19767,3 +19767,35 @@ msgstr "" - msgctxt "#38190" - msgid "Extract thumbnails from video files" - msgstr "" -+ -+#. Description of setting "System -> Audio Ouput -> A/V sync method" with label #38200 -+#: system/settings/settings.xml -+msgctxt "#38200" -+msgid "PLL adjustment to maintain audio/video sync" -+msgstr "" -+ -+#. Description of setting "Videos -> Playback -> A/V sync method" with label #38201 -+#: system/settings/settings.xml -+msgctxt "#38201" -+msgid "Allows sync adjustment without resampling. Lower the settings if you get audio/video dropouts." -+msgstr "" -+ -+msgctxt "#38202" -+msgid "Off" -+msgstr "" -+ -+msgctxt "#38203" -+msgid "Low" -+msgstr "" -+ -+msgctxt "#38204" -+msgid "Medium" -+msgstr "" -+ -+msgctxt "#38205" -+msgid "High" -+msgstr "" -+ -+msgctxt "#38206" -+msgid "Max" -+msgstr "" -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 289dc55ec41aa44848519a05f8ee1ccc72740085..2572e25753712186f69390965ee1448bff3fadd5 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -101,6 +101,20 @@ - - 100 - -+ -+ 3 -+ 0 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index f5671b8dfb03216301d936ae3b08bfc3e8225729..68399ab14faf813bd195d2fdf03a4a376307b4cd 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -363,11 +363,12 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) - m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::APPFOCUSED, msg->data, sizeof(bool)); - return; - case CActiveAEControlProtocol::STREAMRESAMPLEMODE: -- MsgStreamParameter *par; -- par = (MsgStreamParameter*)msg->data; -+ MsgStreamResample *par; -+ par = (MsgStreamResample*)msg->data; - if (par->stream) - { -- par->stream->m_resampleMode = par->parameter.int_par; -+ par->stream->m_resampleMode = par->mode; -+ par->stream->m_pllAdjust = par->plladjust; - par->stream->m_resampleIntegral = 0.0; - } - return; -@@ -2456,7 +2457,14 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream) - { - if (stream->m_processingBuffers) - { -- stream->m_processingBuffers->SetRR(stream->CalcResampleRatio(error), m_settings.atempoThreshold); -+ double pllAdjustRequest = 0.0, pllAdjustActual = 0.0, e = 0.0; -+ if (stream->m_pllAdjust > 0.0) -+ { -+ e = std::max(std::min(error / 50.0, 1.0), - 1.0); -+ pllAdjustRequest = 1.0 + e * stream->m_pllAdjust; -+ } -+ stream->m_processingBuffers->SetRR(stream->CalcResampleRatio(error), m_settings.atempoThreshold, pllAdjustRequest, stream->m_pllAdjust, pllAdjustActual); -+ CLog::Log(LOGDEBUG, "ActiveAE::%s pll:%.5f (act:%.5f lim:%.5f) rr:%.5f threshold:%.3f error:%.6f", __FUNCTION__, pllAdjustRequest, pllAdjustActual, stream->m_pllAdjust, stream->m_processingBuffers->GetRR(), m_settings.atempoThreshold, error ); - } - } - else if (stream->m_processingBuffers) -@@ -3322,13 +3330,14 @@ void CActiveAE::SetStreamResampleRatio(CActiveAEStream *stream, double ratio) - &msg, sizeof(MsgStreamParameter)); - } - --void CActiveAE::SetStreamResampleMode(CActiveAEStream *stream, int mode) -+void CActiveAE::SetStreamResampleMode(CActiveAEStream *stream, int mode, float plladjust) - { -- MsgStreamParameter msg; -+ MsgStreamResample msg; - msg.stream = stream; -- msg.parameter.int_par = mode; -+ msg.mode = mode; -+ msg.plladjust = plladjust; - m_controlPort.SendOutMessage(CActiveAEControlProtocol::STREAMRESAMPLEMODE, -- &msg, sizeof(MsgStreamParameter)); -+ &msg, sizeof(MsgStreamResample)); - } - - void CActiveAE::SetStreamFFmpegInfo(CActiveAEStream *stream, int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type) -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index e29eb5719a2e24562a16180e53b2decd955e50a5..e2d3a6824ca0dc93fb08f3374c745ac1dcc63db3 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -177,6 +177,13 @@ struct MsgStreamFFmpegInfo - enum AVAudioServiceType audio_service_type; - }; - -+struct MsgStreamResample -+{ -+ CActiveAEStream *stream; -+ int mode; -+ float plladjust; -+}; -+ - class CEngineStats - { - public: -@@ -293,7 +300,7 @@ protected: - void SetStreamReplaygain(CActiveAEStream *stream, float rgain); - void SetStreamVolume(CActiveAEStream *stream, float volume); - void SetStreamResampleRatio(CActiveAEStream *stream, double ratio); -- void SetStreamResampleMode(CActiveAEStream *stream, int mode); -+ void SetStreamResampleMode(CActiveAEStream *stream, int mode, float plladjust); - void SetStreamFFmpegInfo(CActiveAEStream *stream, int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type); - void SetStreamFade(CActiveAEStream *stream, float from, float target, unsigned int millis); - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -index 246d7e6c05242f1d64bbc3983b7342e24423ba8c..6b009dcea60e7431d418286c7602e1c29e793cb5 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp -@@ -29,6 +29,10 @@ - #include "ActiveAE.h" - #include "ActiveAEStream.h" - -+#if defined(TARGET_RASPBERRY_PI) -+#include "linux/RBP.h" -+#endif -+ - using namespace ActiveAE; - - /* typecast AE to CActiveAE */ -@@ -71,6 +75,7 @@ CActiveAEStream::CActiveAEStream(AEAudioFormat *format, unsigned int streamid) - m_lastPtsJump = 0; - m_errorInterval = 1000; - m_clockSpeed = 1.0; -+ m_pllAdjust = 0.0f; - } - - CActiveAEStream::~CActiveAEStream() -@@ -509,11 +514,12 @@ void CActiveAEStream::SetResampleRatio(double ratio) - m_streamResampleRatio = ratio; - } - --void CActiveAEStream::SetResampleMode(int mode) -+void CActiveAEStream::SetResampleMode(int mode, float plladjust) - { -- if (mode != m_streamResampleMode) -- AE.SetStreamResampleMode(this, mode); -+ if (mode != m_streamResampleMode || plladjust != m_streamPllAdjust) -+ AE.SetStreamResampleMode(this, mode, plladjust); - m_streamResampleMode = mode; -+ m_streamPllAdjust = plladjust; - } - - void CActiveAEStream::SetFFmpegInfo(int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type) -@@ -714,8 +720,18 @@ bool CActiveAEStreamBuffers::IsDrained() - return false; - } - --void CActiveAEStreamBuffers::SetRR(double rr, double atempoThreshold) -+void CActiveAEStreamBuffers::SetRR(double rr, double atempoThreshold, double pllAdjustRequest, double pllThreshold, double &pllAdjustActual) - { -+#if defined(TARGET_RASPBERRY_PI) -+ if (pllAdjustRequest > 0.0f) // pll adjust -+ { -+ pllAdjustActual = g_RBP.AdjustHDMIClock(pllAdjustRequest); -+ rr = 1.0; -+ } -+ else -+ pllAdjustActual = g_RBP.AdjustHDMIClock(1.0); -+#endif -+ - if (fabs(rr - 1.0) < atempoThreshold) - { - m_resampleBuffers->SetRR(rr); -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -index 531dedc71f8b342d1556518e1fb7cb051f334e88..80ab096a417d53fcdf7703d11437f92df23f6f46 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h -@@ -103,7 +103,8 @@ public: - void Flush(); - void SetDrain(bool drain); - bool IsDrained(); -- void SetRR(double rr, double atempoThreshold); -+ void SetRR(double rr, double atempoThreshold, double pllAdjustRequest, double pllThreshold, double &pllAdjustActual); -+ void SetRR(double rr, double atempoThreshold) { double pllAdjustActual; SetRR(rr, atempoThreshold, 0.0, 0.0, pllAdjustActual); } - double GetRR(); - void FillBuffer(); - bool DoesNormalize(); -@@ -169,7 +170,7 @@ public: - - virtual double GetResampleRatio(); - virtual void SetResampleRatio(double ratio); -- virtual void SetResampleMode(int mode); -+ virtual void SetResampleMode(int mode, float plladjust); - virtual void RegisterAudioCallback(IAudioCallback* pCallback); - virtual void UnRegisterAudioCallback(); - virtual void FadeVolume(float from, float to, unsigned int time); -@@ -186,6 +187,7 @@ protected: - float m_streamAmplify; - double m_streamResampleRatio; - int m_streamResampleMode; -+ float m_streamPllAdjust; - unsigned int m_streamSpace; - bool m_streamDraining; - bool m_streamDrained; -@@ -226,6 +228,7 @@ protected: - int m_fadingTime; - int m_profile; - int m_resampleMode; -+ float m_pllAdjust; - double m_resampleIntegral; - double m_clockSpeed; - enum AVMatrixEncoding m_matrixEncoding; -diff --git a/xbmc/cores/AudioEngine/Interfaces/AEStream.h b/xbmc/cores/AudioEngine/Interfaces/AEStream.h -index 533f6715d4e39215942d9ddd59f1242336daf32d..9e33493fd1a9f252162b8aa982609f161532d8ac 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AEStream.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AEStream.h -@@ -41,6 +41,14 @@ public: - class CAESyncInfo - { - public: -+ CAESyncInfo() -+ { -+ delay = 0.0; -+ error = 0.0; -+ rr = 1.0; -+ errortime = 0; -+ state = SYNC_OFF; -+ } - double delay; - double error; - double rr; -@@ -231,7 +239,7 @@ public: - /** - * Sets the resamplling on/ff - */ -- virtual void SetResampleMode(int mode) = 0; -+ virtual void SetResampleMode(int mode, float plladjust) = 0; - - /** - * Registers the audio callback to call with each block of data, this is used by Audio Visualizations -diff --git a/xbmc/cores/VideoPlayer/DVDAudio.cpp b/xbmc/cores/VideoPlayer/DVDAudio.cpp -index 2dd9b3689a37874a8199ff6edf64ba0b26d8c69f..8a7c2a7d86422bf7573d00a1f9d3084367ff19aa 100644 ---- a/xbmc/cores/VideoPlayer/DVDAudio.cpp -+++ b/xbmc/cores/VideoPlayer/DVDAudio.cpp -@@ -313,12 +313,12 @@ double CDVDAudio::GetResampleRatio() - return m_resampleRatio; - } - --void CDVDAudio::SetResampleMode(int mode) -+void CDVDAudio::SetResampleMode(int mode, float plladjust) - { - CSingleLock lock (m_critSection); - if(m_pAudioStream) - { -- m_pAudioStream->SetResampleMode(mode); -+ m_pAudioStream->SetResampleMode(mode, plladjust); - } - } - -diff --git a/xbmc/cores/VideoPlayer/DVDAudio.h b/xbmc/cores/VideoPlayer/DVDAudio.h -index 81882a1a3828e3f95df26c1bd88c061d3b994b44..ed6974b1155a7272f3ef5bfed3f749674b831b93 100644 ---- a/xbmc/cores/VideoPlayer/DVDAudio.h -+++ b/xbmc/cores/VideoPlayer/DVDAudio.h -@@ -61,7 +61,7 @@ public: - double GetSyncError(); - void SetSyncErrorCorrection(double correction); - double GetResampleRatio(); -- void SetResampleMode(int mode); -+ void SetResampleMode(int mode, float plladjust); - void Flush(); - void Drain(); - void AbortAddPackets(); -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -index 9db3a9cc91fd5f9b194d6c1aa66aa02121164c29..56170f48cda417554c57b2adf934c2df58a23abf 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp -@@ -96,6 +96,7 @@ bool CVideoPlayerAudio::OpenStream(CDVDStreamInfo &hints) - bool allowpassthrough = !CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEDISPLAYASCLOCK); - if (hints.realtime) - allowpassthrough = false; -+ allowpassthrough |= CSettings::GetInstance().GetInt("audiooutput.plladjust") > 0; - CDVDAudioCodec* codec = CDVDFactoryCodec::CreateAudioCodec(hints, m_processInfo, allowpassthrough, m_processInfo.AllowDTSHDDecode()); - if(!codec) - { -@@ -217,8 +218,12 @@ void CVideoPlayerAudio::UpdatePlayerInfo() - - //print the inverse of the resample ratio, since that makes more sense - //if the resample ratio is 0.5, then we're playing twice as fast -+#ifdef TARGET_RASPBERRY_PI -+ s << ", rr:" << std::fixed << std::setprecision(5) << 1.0 / m_dvdAudio.GetResampleRatio() << ", pll:" << std::fixed << std::setprecision(5) << g_RBP.GetAdjustHDMIClock() << ", err:" << std::fixed << std::setprecision(1) << m_dvdAudio.GetSyncError() * 1e-3 << "ms"; -+#else - if (m_synctype == SYNC_RESAMPLE) - s << ", rr:" << std::fixed << std::setprecision(5) << 1.0 / m_dvdAudio.GetResampleRatio(); -+#endif - - s << ", att:" << std::fixed << std::setprecision(1) << log(GetCurrentAttenuation()) * 20.0f << " dB"; - -@@ -541,10 +546,12 @@ void CVideoPlayerAudio::SetSyncType(bool passthrough) - int synctype = (m_synctype >= 0 && m_synctype <= 1) ? m_synctype : 2; - CLog::Log(LOGDEBUG, "CVideoPlayerAudio:: synctype set to %i: %s", m_synctype, synctypes[synctype]); - m_prevsynctype = m_synctype; -+ const float plladjusts[] = { 0.0f, 0.00001f, 0.0001f, 0.001f, 0.01f }; -+ float plladjust = plladjusts[CSettings::GetInstance().GetInt("audiooutput.plladjust")]; - if (m_synctype == SYNC_RESAMPLE) -- m_dvdAudio.SetResampleMode(1); -+ m_dvdAudio.SetResampleMode(1, plladjust); - else -- m_dvdAudio.SetResampleMode(0); -+ m_dvdAudio.SetResampleMode(0, plladjust); - } - } - -@@ -602,6 +609,7 @@ bool CVideoPlayerAudio::SwitchCodecIfNeeded() - bool allowpassthrough = !CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEDISPLAYASCLOCK); - if (m_streaminfo.realtime) - allowpassthrough = false; -+ allowpassthrough |= CSettings::GetInstance().GetInt("audiooutput.plladjust") > 0; - CDVDAudioCodec *codec = CDVDFactoryCodec::CreateAudioCodec(m_streaminfo, m_processInfo, allowpassthrough, m_processInfo.AllowDTSHDDecode()); - if (!codec || codec->NeedPassthrough() == m_pAudioCodec->NeedPassthrough()) { - // passthrough state has not changed -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 5a6f780517cff0c31f1c40e5e95445d448eb2297..6e8529001b1a464b4547a846f553d98f5bc0b6c0 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -46,6 +46,8 @@ CRBP::CRBP() - m_DllBcmHost = new DllBcmHost(); - m_OMX = new COMXCore(); - m_display = DISPMANX_NO_HANDLE; -+ m_requested_pll_adjust = -1.0; -+ m_actual_pll_adjust = -1.0; - m_mb = mbox_open(); - vcsm_init(); - m_vsync_count = 0; -@@ -153,6 +155,8 @@ void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) - assert(s == 0); - vc_dispmanx_display_close(m_display); - m_display = DISPMANX_NO_HANDLE; -+ m_requested_pll_adjust = -1.0; -+ m_actual_pll_adjust = -1.0; - } - - void CRBP::GetDisplaySize(int &width, int &height) -@@ -366,4 +370,20 @@ void CGPUMEM::Flush() - vcsm_clean_invalid( &iocache ); - } - -+double CRBP::AdjustHDMIClock(double adjust) -+{ -+ char response[80]; -+ -+ if (adjust == m_requested_pll_adjust) -+ return m_actual_pll_adjust; -+ -+ m_requested_pll_adjust = adjust; -+ vc_gencmd(response, sizeof response, "hdmi_adjust_clock %f", adjust); -+ char *p = strchr(response, '='); -+ if (p) -+ m_actual_pll_adjust = atof(p+1); -+ CLog::Log(LOGDEBUG, "CRBP::%s(%.5f) = %.5f", __func__, adjust, m_actual_pll_adjust); -+ return m_actual_pll_adjust; -+} -+ - #endif -diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h -index fffa5182126159f6dfcf750b21fa0464e229e545..815d758e7086d73b4d4eb16849fdbb509a3c251d 100644 ---- a/xbmc/linux/RBP.h -+++ b/xbmc/linux/RBP.h -@@ -82,6 +82,8 @@ public: - uint32_t WaitVsync(uint32_t target = ~0U); - void VSyncCallback(); - int GetMBox() { return m_mb; } -+ double AdjustHDMIClock(double adjust); -+ double GetAdjustHDMIClock() { return m_actual_pll_adjust; } - - private: - DllBcmHost *m_DllBcmHost; -@@ -103,6 +105,9 @@ private: - CCriticalSection m_critSection; - - int m_mb; -+ double m_requested_pll_adjust; -+ double m_actual_pll_adjust; -+ public: - }; - - extern CRBP g_RBP; - -From 5798c44c892111b789e14fb89e15dec6e8a5dcb4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 7 May 2015 15:35:43 +0100 -Subject: [PATCH 34/62] rbp: Support zero copy interface with hevc acceleration - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 9 +++++++++ - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp | 5 +++-- - 2 files changed, 12 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 4129d3d6a77ce1a3f15bad045746970f6e640ea6..619515c9411172261d8f0bef24c5d679c35e5d7d 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -368,6 +368,15 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options - if (tryhw && m_decoderState == STATE_NONE) - { - m_decoderState = STATE_HW_SINGLE; -+#ifdef TARGET_RASPBERRY_PI -+ int num_threads = g_cpuInfo.getCPUCount() * 3 / 2; -+ num_threads = std::max(1, std::min(num_threads, 16)); -+ if (pCodec->id == AV_CODEC_ID_HEVC) -+ num_threads = 8; -+ m_pCodecContext->thread_count = num_threads; -+ m_pCodecContext->thread_safe_callbacks = 0; -+ CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - open frame threaded with %d threads", num_threads); -+#endif - } - else - { -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp -index 77ae3273bc8e224fe6c193300ccef32fb7fbafe1..c0b3f19f2ef9cdef9adf00cf81154803b12feb4f 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.cpp -@@ -296,8 +296,9 @@ bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture - picture->MMALBuffer->mmal_buffer->alloc_size = picture->MMALBuffer->mmal_buffer->length = gmem->m_numbytes; - picture->MMALBuffer->m_stills = m_hints.stills; - -- // need to flush ARM cache so GPU can see it -- gmem->Flush(); -+ // need to flush ARM cache so GPU can see it (HEVC will have already done this) -+ if (avctx->codec_id != AV_CODEC_ID_HEVC) -+ gmem->Flush(); - - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - mmal:%p dts:%.3f pts:%.3f buf:%p gpu:%p", CLASSNAME, __FUNCTION__, picture->MMALBuffer->mmal_buffer, 1e-6*picture->dts, 1e-6*picture->pts, picture->MMALBuffer, gmem); - -From 0a99bc0eb1d4a036f4df0d9f88c0f8bb3c6b0e6d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 16 May 2015 18:26:04 +0100 -Subject: [PATCH 35/62] ffmpeg: use upstream mvc patches - ---- - ...vcodec-add-h264_mvc-codec-id-and-profiles.patch | 68 ++++++++++++ - ...er-add-support-for-parsing-h264-mvc-NALUs.patch | 116 +++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 7 +- - tools/depends/target/ffmpeg/autobuild.sh | 3 + - ...arsing_of_mvc_slices_in_some_corner_cases.patch | 55 ++++++++++ - 5 files changed, 248 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch - create mode 100644 tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch - create mode 100644 tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - -diff --git a/tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch b/tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..2e7381fe6538089759ebc7288c0a5d908cd0973c ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -@@ -0,0 +1,68 @@ -+From 4060f15e2d29e268110032d4366382e370e088d0 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sun, 26 Jun 2016 20:09:18 +0100 -+Subject: [PATCH] avcodec: add h264_mvc codec id and profiles -+ -+--- -+ libavcodec/avcodec.h | 5 +++++ -+ libavcodec/codec_desc.c | 7 +++++++ -+ libavformat/mpegts.c | 2 +- -+ 3 files changed, 13 insertions(+), 1 deletion(-) -+ -+diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -+index a1ba217..abd2e91 100644 -+--- a/libavcodec/avcodec.h -++++ b/libavcodec/avcodec.h -+@@ -410,6 +410,8 @@ enum AVCodecID { -+ AV_CODEC_ID_SHEERVIDEO, -+ AV_CODEC_ID_YLC, -+ -++ AV_CODEC_ID_H264_MVC, -++ -+ /* various PCM "codecs" */ -+ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs -+ AV_CODEC_ID_PCM_S16LE = 0x10000, -+@@ -3195,6 +3197,9 @@ typedef struct AVCodecContext { -+ #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 -+ #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) -+ #define FF_PROFILE_H264_CAVLC_444 44 -++#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 -++#define FF_PROFILE_H264_STEREO_HIGH 128 -++#define FF_PROFILE_H264_MULTIVIEW_HIGH_DEPTH 138 -+ -+ #define FF_PROFILE_VC1_SIMPLE 0 -+ #define FF_PROFILE_VC1_MAIN 1 -+diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -+index 9d94b72..535ebf0 100644 -+--- a/libavcodec/codec_desc.c -++++ b/libavcodec/codec_desc.c -+@@ -1563,6 +1563,13 @@ static const AVCodecDescriptor codec_descriptors[] = { -+ .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"), -+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, -+ }, -++ { -++ .id = AV_CODEC_ID_H264_MVC, -++ .type = AVMEDIA_TYPE_VIDEO, -++ .name = "h264_mvc", -++ .long_name = NULL_IF_CONFIG_SMALL("H264 MVC"), -++ .props = AV_CODEC_PROP_LOSSY, -++ }, -+ -+ /* various PCM "codecs" */ -+ { -+diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -+index b31d233..2767306 100644 -+--- a/libavformat/mpegts.c -++++ b/libavformat/mpegts.c -+@@ -701,7 +701,7 @@ static const StreamType ISO_types[] = { -+ #endif -+ { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, -+ { 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC }, -+- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 }, -++ { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264_MVC }, -+ { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 }, -+ { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC }, -+ { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, -+-- -+2.7.4 -+ -diff --git a/tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch b/tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..399e8a95984771e4388bfe4785423ff3f664f89b ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -@@ -0,0 +1,116 @@ -+From 23dd20678a05e1764e5d8d30481cb354a51b6c8b Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sun, 26 Jun 2016 20:16:03 +0100 -+Subject: [PATCH] h264_parser: add support for parsing h264 mvc NALUs -+ -+--- -+ libavcodec/allcodecs.c | 1 + -+ libavcodec/h264.h | 2 ++ -+ libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++---- -+ 3 files changed, 33 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -+index 54efaad..02a89c3 100644 -+--- a/libavcodec/allcodecs.c -++++ b/libavcodec/allcodecs.c -+@@ -667,6 +667,7 @@ void avcodec_register_all(void) -+ REGISTER_PARSER(H261, h261); -+ REGISTER_PARSER(H263, h263); -+ REGISTER_PARSER(H264, h264); -++ REGISTER_PARSER(H264_MVC, h264_mvc); -+ REGISTER_PARSER(HEVC, hevc); -+ REGISTER_PARSER(MJPEG, mjpeg); -+ REGISTER_PARSER(MLP, mlp); -+diff --git a/libavcodec/h264.h b/libavcodec/h264.h -+index efe3555..16358aa 100644 -+--- a/libavcodec/h264.h -++++ b/libavcodec/h264.h -+@@ -126,7 +126,9 @@ enum { -+ NAL_END_STREAM = 11, -+ NAL_FILLER_DATA = 12, -+ NAL_SPS_EXT = 13, -++ NAL_SPS_SUBSET = 15, -+ NAL_AUXILIARY_SLICE = 19, -++ NAL_SLICE_EXT = 20, -+ NAL_FF_IGNORE = 0xff0f001, -+ }; -+ -+diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -+index ce4bab2..082ac17 100644 -+--- a/libavcodec/h264_parser.c -++++ b/libavcodec/h264_parser.c -+@@ -58,6 +58,7 @@ typedef struct H264ParseContext { -+ uint8_t parse_history[6]; -+ int parse_history_count; -+ int parse_last_mb; -++ int is_mvc; -+ } H264ParseContext; -+ -+ -+@@ -105,14 +106,18 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, -+ } else if (state <= 5) { -+ int nalu_type = buf[i] & 0x1F; -+ if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || -+- nalu_type == NAL_PPS || nalu_type == NAL_AUD) { -++ nalu_type == NAL_PPS || nalu_type == NAL_AUD || -++ nalu_type == NAL_SPS_SUBSET) { -+ if (pc->frame_start_found) { -+ i++; -+ goto found; -+ } -+ } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || -+- nalu_type == NAL_IDR_SLICE) { -++ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { -+ state += 8; -++ -++ if (nalu_type == NAL_SLICE_EXT) -++ i += 3; // skip mvc extension -+ continue; -+ } -+ state = 7; -+@@ -585,7 +590,8 @@ static int h264_parse(AVCodecParserContext *s, -+ } -+ } -+ -+- parse_nal_units(s, avctx, buf, buf_size); -++ if (!p->is_mvc) -++ parse_nal_units(s, avctx, buf, buf_size); -+ -+ if (avctx->framerate.num) -+ avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); -+@@ -622,7 +628,7 @@ static int h264_split(AVCodecContext *avctx, -+ if ((state & 0xFFFFFF00) != 0x100) -+ break; -+ nalu_type = state & 0x1F; -+- if (nalu_type == NAL_SPS) { -++ if (nalu_type == NAL_SPS || nalu_type == NAL_SPS_SUBSET) { -+ has_sps = 1; -+ } else if (nalu_type == NAL_PPS) -+ has_pps = 1; -+@@ -672,3 +678,23 @@ AVCodecParser ff_h264_parser = { -+ .parser_close = h264_close, -+ .split = h264_split, -+ }; -++ -++static av_cold int init_mvc(AVCodecParserContext *s) -++{ -++ H264ParseContext *p = s->priv_data; -++ int ret = init(s); -++ if (ret < 0) -++ return ret; -++ -++ p->is_mvc = 1; -++ return 0; -++} -++ -++AVCodecParser ff_h264_mvc_parser = { -++ .codec_ids = { AV_CODEC_ID_H264_MVC }, -++ .priv_data_size = sizeof(H264ParseContext), -++ .parser_init = init_mvc, -++ .parser_parse = h264_parse, -++ .parser_close = h264_close, -++ .split = h264_split, -++}; -+-- -+2.7.4 -+ -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 337dbaab927919858e44d79f647207ef0513eea1..7e97e4d91a443d46d933df528763422ff5e8f4fa 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -4,7 +4,9 @@ DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - 0001-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch \ - hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \ - pfcd_hevc_optimisations.patch \ -- 0001-Squashed-commit-of-the-following.patch -+ 0001-Squashed-commit-of-the-following.patch \ -+ 0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch 0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch \ -+ h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -90,6 +92,9 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch - cd $(PLATFORM); patch -p1 < ../0001-Squashed-commit-of-the-following.patch -+ cd $(PLATFORM); patch -p1 < ../0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -+ cd $(PLATFORM); patch -p1 < ../0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -+ cd $(PLATFORM); patch -p1 < ../h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ -diff --git a/tools/depends/target/ffmpeg/autobuild.sh b/tools/depends/target/ffmpeg/autobuild.sh -index a61357f14cb2139e8125ae04684bed1b29fefb12..9f6c26c8acd08ed603aadeb4d9d81b07026e7506 100755 ---- a/tools/depends/target/ffmpeg/autobuild.sh -+++ b/tools/depends/target/ffmpeg/autobuild.sh -@@ -137,6 +137,9 @@ patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch - patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch - patch -p1 < ../pfcd_hevc_optimisations.patch - patch -p1 < ../0001-Squashed-commit-of-the-following.patch -+patch -p1 < ../0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch -+patch -p1 < ../0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch -+patch -p1 < ../h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch - - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - ./configure --prefix=$FFMPEG_PREFIX \ -diff --git a/tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch b/tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..b39480ad098b9cd0882fcf75b96afb1b98686bcc ---- /dev/null -+++ b/tools/depends/target/ffmpeg/h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -@@ -0,0 +1,55 @@ -+From 12d99a92469e5916de3bc787dce4c13abfdd5e09 Mon Sep 17 00:00:00 2001 -+From: popcornmix -+Date: Sun, 26 Jun 2016 20:20:04 +0100 -+Subject: [PATCH] h264_parser: fix parsing of mvc slices in some corner cases -+ -+--- -+ libavcodec/h264_parser.c | 10 +++++----- -+ 1 file changed, 5 insertions(+), 5 deletions(-) -+ -+diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -+index 082ac17..b9b0c78 100644 -+--- a/libavcodec/h264_parser.c -++++ b/libavcodec/h264_parser.c -+@@ -59,6 +59,7 @@ typedef struct H264ParseContext { -+ int parse_history_count; -+ int parse_last_mb; -+ int is_mvc; -++ int slice_ext; -+ } H264ParseContext; -+ -+ -+@@ -116,18 +117,17 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, -+ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) { -+ state += 8; -+ -+- if (nalu_type == NAL_SLICE_EXT) -+- i += 3; // skip mvc extension -++ p->slice_ext = (nalu_type == NAL_SLICE_EXT); -+ continue; -+ } -+ state = 7; -+ } else { -+ p->parse_history[p->parse_history_count++] = buf[i]; -+- if (p->parse_history_count > 5) { -++ if (p->parse_history_count > 8) { -+ unsigned int mb, last_mb = p->parse_last_mb; -+ GetBitContext gb; -+ -+- init_get_bits(&gb, p->parse_history, 8*p->parse_history_count); -++ init_get_bits8(&gb, p->parse_history + 3*p->slice_ext, p->parse_history_count - 3*p->slice_ext); -+ p->parse_history_count = 0; -+ mb= get_ue_golomb_long(&gb); -+ p->parse_last_mb = mb; -+@@ -150,7 +150,7 @@ found: -+ pc->frame_start_found = 0; -+ if (p->is_avc) -+ return next_avc; -+- return i - (state & 5) - 5 * (state > 7); -++ return i - (state & 5) - 8 * (state > 7); -+ } -+ -+ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb, -+-- -+2.7.4 -+ - -From 7d4ef5a5e251a218f9609c0e2bb0cb7d3093f8b9 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 29 Jan 2016 17:18:50 +0300 -Subject: [PATCH 36/62] [win32] Settings: Added setting to enable/disable MVC - decoder. - ---- - system/settings/win32.xml | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/system/settings/win32.xml b/system/settings/win32.xml -index a017d30c24232fb01220b87b29398403b8ed9662..2fcee72a64e8b701c8e895143410bbe9fd617356 100644 ---- a/system/settings/win32.xml -+++ b/system/settings/win32.xml -@@ -12,6 +12,17 @@ - false - - -+

-+ -+ -+ -+ 2 -+ true -+ -+ -+ -+ -+
-
- - - -From 492201a86d20da77a664e197a42f4a32945420be Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Wed, 20 Jan 2016 17:02:16 +0300 -Subject: [PATCH 37/62] [VideoPlayer] DemuxFFmpeg: Properly demuxing h264_mvc - streams. - ---- - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 23 +++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 54a18c669a058b705e0276cb7e14522ae6cd04ae..55431978dcfabee8da95e2e76292ff815cc74433 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -25,6 +25,7 @@ - - #include "commons/Exception.h" - #include "cores/FFmpeg.h" -+#include "DVDCodecs/DVDCodecUtils.h" - #include "DVDClock.h" // for DVD_TIME_BASE - #include "DVDDemuxUtils.h" - #include "DVDInputStreams/DVDInputStream.h" -@@ -1355,6 +1356,15 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - } - case AVMEDIA_TYPE_VIDEO: - { -+ if (pStream->codec->codec_id == AV_CODEC_ID_H264_MVC) -+ { -+ // ignore MVC extension streams, they are handled specially -+ stream = new CDemuxStream(); -+ stream->type = STREAM_DATA; -+ stream->disabled = true; -+ pStream->need_parsing = AVSTREAM_PARSE_NONE; -+ break; -+ } - CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(this, pStream); - stream = st; - if(strcmp(m_pFormatContext->iformat->name, "flv") == 0) -@@ -1363,7 +1373,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - st->bVFR = false; - - // never trust pts in avi files with h264. -- if (m_bAVI && pStream->codec->codec_id == AV_CODEC_ID_H264) -+ if (m_bAVI && (pStream->codec->codec_id == AV_CODEC_ID_H264 || pStream->codec->codec_id == AV_CODEC_ID_H264_MVC)) - st->bPTSInvalid = true; - - #if defined(AVFORMAT_HAS_STREAM_GET_R_FRAME_RATE) -@@ -1434,6 +1444,17 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - if (av_dict_get(pStream->metadata, "title", NULL, 0)) - st->m_description = av_dict_get(pStream->metadata, "title", NULL, 0)->value; - -+ if (pStream->codec->codec_id == AV_CODEC_ID_H264) -+ { -+ if (CDVDCodecUtils::IsH264AnnexB(m_pFormatContext->iformat->name, pStream)) -+ { -+ // TODO -+ } -+ else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size)) -+ { -+ pStream->codec->codec_tag = MKTAG('M', 'V', 'C', '1'); -+ } -+ } - break; - } - case AVMEDIA_TYPE_DATA: - -From f32639c9513373f4c25dac7d9697f8c04760a7c8 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 25 Feb 2016 11:21:25 +0300 -Subject: [PATCH 38/62] [Stereo3D] Added block_lr and block_rl to supported - modes. - ---- - xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp | 4 ++-- - xbmc/guilib/StereoscopicsManager.cpp | 8 +++++--- - 2 files changed, 7 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp -index 24b1b10519467cbbfd96f7048efaf49aab7700cc..49f7f7ca7e144a259f6d06bd11cd97aa0b3242aa 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.cpp -@@ -102,8 +102,8 @@ namespace RenderManager { - convert["right_left"] = CONF_FLAGS_STEREO_MODE_SBS | CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT; - convert["anaglyph_green_magenta"] = 0u; - convert["anaglyph_yellow_blue"] = 0u; -- convert["block_lr"] = 0u; -- convert["block_rl"] = 0u; -+ convert["block_lr"] = CONF_FLAGS_STEREO_CADANCE_LEFT_RIGHT; -+ convert["block_rl"] = CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT; - } - return convert[mode]; - } -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index 1443acaf0f25df458ae49766e13dd0323454f2eb..6aaa82f4d883b8cae0ccdedf6c5a6814e7aaa720 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -70,8 +70,10 @@ static const struct StereoModeMap VideoModeToGuiModeMap[] = - { "anaglyph_cyan_red", RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN }, - { "anaglyph_green_magenta", RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA }, - { "anaglyph_yellow_blue", RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE }, -- { "block_lr", RENDER_STEREO_MODE_OFF }, // unsupported -- { "block_rl", RENDER_STEREO_MODE_OFF }, // unsupported -+ { "block_lr", RENDER_STEREO_MODE_HARDWAREBASED }, -+ { "block_rl", RENDER_STEREO_MODE_HARDWAREBASED }, -+ { "block_lr", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback -+ { "block_rl", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback - {} - }; - -@@ -310,7 +312,7 @@ int CStereoscopicsManager::ConvertVideoToGuiStereoMode(const std::string &mode) - size_t i = 0; - while (VideoModeToGuiModeMap[i].name) - { -- if (mode == VideoModeToGuiModeMap[i].name) -+ if (mode == VideoModeToGuiModeMap[i].name && g_Windowing.SupportsStereo(VideoModeToGuiModeMap[i].mode)) - return VideoModeToGuiModeMap[i].mode; - i++; - } - -From 653902ed14aa61b97188eb1ce3bcfa47bc95046e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Sat, 23 Jan 2016 10:21:32 +0300 -Subject: [PATCH 39/62] [VideoPlayer] Fix possible wrong aspect. - ---- - xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -index 903f0d83527d9088ff1bf0ba056f357f6abfda81..a5a33d34c70892cde77ad4d8f3cb65fdd9703081 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp -@@ -181,7 +181,7 @@ void CVideoPlayerVideo::OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec) - } - - // use aspect in stream if available -- if(hint.forced_aspect) -+ if (hint.forced_aspect && !std::isnan(hint.aspect)) - m_fForcedAspectRatio = hint.aspect; - else - m_fForcedAspectRatio = 0.0; - -From bb360aef2259c1ac131f9829726f42aaf7ddde8e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 22 Jan 2016 18:18:33 +0300 -Subject: [PATCH 40/62] [VideoPlayer] DemuxFFmpeg: ssif remux - ---- - xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt | 2 + - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 47 ++++++- - .../cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h | 2 + - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 156 +++++++++++++++++++++ - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h | 49 +++++++ - xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in | 1 + - xbmc/settings/AdvancedSettings.cpp | 2 +- - 7 files changed, 251 insertions(+), 8 deletions(-) - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -index 63776b1333bb66483303e44d6ebe60f3cd7e14d7..156ec2021002d9d7a355db2f0dcf099aabb1db48 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -@@ -5,6 +5,7 @@ set(SOURCES DemuxMultiSource.cpp - DVDDemuxCDDA.cpp - DVDDemuxClient.cpp - DVDDemuxFFmpeg.cpp -+ DemuxStreamSSIF.cpp - DVDDemuxUtils.cpp - DVDDemuxVobsub.cpp - DVDFactoryDemuxer.cpp) -@@ -16,6 +17,7 @@ set(HEADERS DemuxMultiSource.h - DVDDemuxCDDA.h - DVDDemuxClient.h - DVDDemuxFFmpeg.h -+ DemuxStreamSSIF.h - DVDDemuxPacket.h - DVDDemuxUtils.h - DVDDemuxVobsub.h -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 55431978dcfabee8da95e2e76292ff815cc74433..6df586ac1f2d00e55307358228a4be89278ce67e 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -166,6 +166,7 @@ CDVDDemuxFFmpeg::CDVDDemuxFFmpeg() : CDVDDemux() - m_currentPts = DVD_NOPTS_VALUE; - m_bMatroska = false; - m_bAVI = false; -+ m_pSSIF = nullptr; - m_speed = DVD_PLAYSPEED_NORMAL; - m_program = UINT_MAX; - m_pkt.result = -1; -@@ -553,6 +554,8 @@ void CDVDDemuxFFmpeg::Dispose() - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -+ SAFE_DELETE(m_pSSIF); -+ - if (m_pFormatContext) - { - for (unsigned int i = 0; i < m_pFormatContext->nb_streams; i++) -@@ -606,6 +609,9 @@ void CDVDDemuxFFmpeg::Flush() - - m_displayTime = 0; - m_dtsAtDisplayTime = DVD_NOPTS_VALUE; -+ -+ if (m_pSSIF) -+ m_pSSIF->Flush(); - } - - void CDVDDemuxFFmpeg::Abort() -@@ -878,7 +884,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - { - Flush(); - } -- else if (IsProgramChange()) -+ // libavformat is confused by the interleaved SSIF. -+ // Disable program management for those -+ else if (!m_pSSIF && IsProgramChange()) - { - // update streams - CreateStreams(m_program); -@@ -906,6 +914,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); -+ -+ if (m_pSSIF) -+ m_pSSIF->Flush(); - } - else - { -@@ -915,7 +926,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - - if (IsVideoReady()) - { -- if (m_program != UINT_MAX) -+ // libavformat is confused by the interleaved SSIF. -+ // Disable program management for those -+ if (!m_pSSIF && m_program != UINT_MAX ) - { - /* check so packet belongs to selected program */ - for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++) -@@ -1064,6 +1077,15 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - stream = AddStream(pPacket->iStreamId); - } - } -+ if (stream && m_pSSIF) -+ { -+ if (stream->type == STREAM_VIDEO || -+ stream->type == STREAM_DATA) -+ pPacket = m_pSSIF->AddPacket(pPacket); -+ -+ if (stream->type == STREAM_DATA && stream->codec == AV_CODEC_ID_H264_MVC && pPacket->iSize) -+ stream = GetStream(pPacket->iStreamId); -+ } - if (!stream) - { - CLog::Log(LOGERROR, "CDVDDemuxFFmpeg::AddStream - internal error, stream is null"); -@@ -1093,6 +1115,9 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double *startpts) - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -+ if (m_pSSIF) -+ m_pSSIF->Flush(); -+ - CDVDInputStream::IPosTime* ist = m_pInput->GetIPosTime(); - if (ist) - { -@@ -1173,6 +1198,9 @@ bool CDVDDemuxFFmpeg::SeekByte(int64_t pos) - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -+ if (m_pSSIF) -+ m_pSSIF->Flush(); -+ - return (ret >= 0); - } - -@@ -1358,11 +1386,12 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - { - if (pStream->codec->codec_id == AV_CODEC_ID_H264_MVC) - { -- // ignore MVC extension streams, they are handled specially -+ m_pSSIF = new CDemuxStreamSSIF(); -+ m_pSSIF->SetMVCStreamId(streamIdx); -+ - stream = new CDemuxStream(); - stream->type = STREAM_DATA; -- stream->disabled = true; -- pStream->need_parsing = AVSTREAM_PARSE_NONE; -+ pStream->codec->codec_type = AVMEDIA_TYPE_DATA; - break; - } - CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(this, pStream); -@@ -1448,7 +1477,11 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - { - if (CDVDCodecUtils::IsH264AnnexB(m_pFormatContext->iformat->name, pStream)) - { -- // TODO -+ if (m_pSSIF) -+ { -+ m_pSSIF->SetH264StreamId(streamIdx); -+ pStream->codec->codec_tag = MKTAG('A', 'M', 'V', 'C'); -+ } - } - else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size)) - { -@@ -1560,7 +1593,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - if (langTag) - strncpy(stream->language, langTag->value, 3); - -- if( stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0 ) -+ if (stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0) - { - stream->ExtraSize = pStream->codec->extradata_size; - stream->ExtraData = new uint8_t[pStream->codec->extradata_size]; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h -index 0bc498e8e387c7ff0aef065832c121d1367454aa..85ce39ee858992a5f095cdf6b4d35398c7ce7dcc 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h -@@ -21,6 +21,7 @@ - */ - - #include "DVDDemux.h" -+#include "DemuxStreamSSIF.h" - #include "threads/CriticalSection.h" - #include "threads/SystemClock.h" - #include -@@ -152,6 +153,7 @@ protected: - double m_currentPts; // used for stream length estimation - bool m_bMatroska; - bool m_bAVI; -+ CDemuxStreamSSIF* m_pSSIF; - int m_speed; - unsigned m_program; - XbmcThreads::EndTime m_timeout; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..f75532016a1395782b59dc124676835c7254de56 ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -0,0 +1,156 @@ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DemuxStreamSSIF.h" -+#include "DVDClock.h" -+#include "DVDDemuxUtils.h" -+#include "utils/log.h" -+ -+//#define DEBUG_VERBOSE -+ -+DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) -+{ -+ if (srcPkt->iStreamId != m_h264StreamId && -+ srcPkt->iStreamId != m_mvcStreamId) -+ return srcPkt; -+ -+ if (srcPkt->iStreamId == m_h264StreamId) -+ { -+ m_H264queue.push(srcPkt); -+ } -+ else if (srcPkt->iStreamId == m_mvcStreamId) -+ { -+ m_MVCqueue.push(srcPkt); -+ } -+ -+ return GetMVCPacket(); -+} -+ -+void CDemuxStreamSSIF::Flush() -+{ -+ while (!m_H264queue.empty()) -+ { -+ CDVDDemuxUtils::FreeDemuxPacket(m_H264queue.front()); -+ m_H264queue.pop(); -+ } -+ while (!m_MVCqueue.empty()) -+ { -+ CDVDDemuxUtils::FreeDemuxPacket(m_MVCqueue.front()); -+ m_MVCqueue.pop(); -+ } -+} -+ -+DemuxPacket* CDemuxStreamSSIF::MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt) -+{ -+ DemuxPacket* newpkt = NULL; -+ newpkt = CDVDDemuxUtils::AllocateDemuxPacket(srcPkt->iSize + appendPkt->iSize); -+ newpkt->iSize = srcPkt->iSize + appendPkt->iSize; -+ -+ newpkt->pts = srcPkt->pts; -+ newpkt->dts = srcPkt->dts; -+ newpkt->duration = srcPkt->duration; -+ newpkt->iGroupId = srcPkt->iGroupId; -+ newpkt->iStreamId = srcPkt->iStreamId; -+ memcpy(newpkt->pData, srcPkt->pData, srcPkt->iSize); -+ memcpy(newpkt->pData + srcPkt->iSize, appendPkt->pData, appendPkt->iSize); -+ -+ CDVDDemuxUtils::FreeDemuxPacket(srcPkt); -+ srcPkt = NULL; -+ CDVDDemuxUtils::FreeDemuxPacket(appendPkt); -+ appendPkt = NULL; -+ -+ return newpkt; -+} -+ -+DemuxPacket* CDemuxStreamSSIF::GetMVCPacket() -+{ -+ // Here, we recreate a h264 MVC packet from the base one + buffered MVC NALU's -+ while (!m_H264queue.empty() && !m_MVCqueue.empty()) -+ { -+ DemuxPacket* h264pkt = m_H264queue.front(); -+ double tsH264 = (h264pkt->dts != DVD_NOPTS_VALUE ? h264pkt->dts : h264pkt->pts); -+ DemuxPacket* mvcpkt = m_MVCqueue.front(); -+ double tsMVC = (mvcpkt->dts != DVD_NOPTS_VALUE ? mvcpkt->dts : mvcpkt->pts); -+ -+ if (tsH264 == tsMVC) -+ { -+ m_H264queue.pop(); -+ m_MVCqueue.pop(); -+ -+ while (!m_H264queue.empty()) -+ { -+ DemuxPacket* pkt = m_H264queue.front(); -+ double ts = (pkt->dts != DVD_NOPTS_VALUE ? pkt->dts : pkt->pts); -+ if (ts == DVD_NOPTS_VALUE) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC merge h264 fragment: %6d+%6d, pts(%.3f/%.3f) dts(%.3f/%.3f)", h264pkt->iSize, pkt->iSize, h264pkt->pts*1e-6, pkt->pts*1e-6, h264pkt->dts*1e-6, pkt->dts*1e-6); -+#endif -+ h264pkt = MergePacket(h264pkt, pkt); -+ m_H264queue.pop(); -+ } -+ else -+ break; -+ } -+ while (!m_MVCqueue.empty()) -+ { -+ DemuxPacket* pkt = m_MVCqueue.front(); -+ double ts = (pkt->dts != DVD_NOPTS_VALUE ? pkt->dts : pkt->pts); -+ if (ts == DVD_NOPTS_VALUE) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC merge mvc fragment: %6d+%6d, pts(%.3f/%.3f) dts(%.3f/%.3f)", mvcpkt->iSize, pkt->iSize, mvcpkt->pts*1e-6, pkt->pts*1e-6, mvcpkt->dts*1e-6, pkt->dts*1e-6); -+#endif -+ mvcpkt = MergePacket(mvcpkt, pkt); -+ m_MVCqueue.pop(); -+ } -+ else -+ break; -+ } -+ -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC merge packet: %6d+%6d, pts(%.3f/%.3f) dts(%.3f/%.3f)", h264pkt->iSize, mvcpkt->iSize, h264pkt->pts*1e-6, mvcpkt->pts*1e-6, h264pkt->dts*1e-6, mvcpkt->dts*1e-6); -+#endif -+ return MergePacket(h264pkt, mvcpkt); -+ } -+ else if (tsH264 > tsMVC) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d, pts(%.3f) dts(%.3f)", mvcpkt->iSize, mvcpkt->pts*1e-6, mvcpkt->dts*1e-6); -+#endif -+ CDVDDemuxUtils::FreeDemuxPacket(mvcpkt); -+ m_MVCqueue.pop(); -+ } -+ else -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC discard h264: %6d, pts(%.3f) dts(%.3f)", h264pkt->iSize, h264pkt->pts*1e-6, h264pkt->dts*1e-6); -+#endif -+ CDVDDemuxUtils::FreeDemuxPacket(h264pkt); -+ m_H264queue.pop(); -+ } -+ } -+ -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC waiting. MVC(%d) H264(%d)", m_MVCqueue.size(), m_H264queue.size()); -+#endif -+ -+ return CDVDDemuxUtils::AllocateDemuxPacket(0); -+} -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -new file mode 100644 -index 0000000000000000000000000000000000000000..1dafdc58db3f9cb5eac032c591942439117e13c4 ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -@@ -0,0 +1,49 @@ -+#pragma once -+ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DVDDemuxPacket.h" -+#include -+ -+extern "C" { -+#include "libavformat/avformat.h" -+} -+ -+class CDemuxStreamSSIF -+{ -+public: -+ CDemuxStreamSSIF() {}; -+ ~CDemuxStreamSSIF() { Flush(); } -+ -+ DemuxPacket* AddPacket(DemuxPacket* &scrPkt); -+ void Flush(); -+ void SetH264StreamId(int id) { m_h264StreamId = id; }; -+ void SetMVCStreamId(int id) { m_mvcStreamId = id; }; -+ -+private: -+ DemuxPacket* GetMVCPacket(); -+ DemuxPacket* MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt); -+ -+ std::queue m_H264queue; -+ std::queue m_MVCqueue; -+ int m_h264StreamId = 0; -+ int m_mvcStreamId = 0; -+}; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -index e4f8aed0af96fe0dceec4d8517087742f2c7df81..30076937bd084936571abf0e6eeecf5ad916c7b3 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -@@ -10,6 +10,7 @@ SRCS += DVDDemuxUtils.cpp - SRCS += DVDDemuxVobsub.cpp - SRCS += DVDDemuxCC.cpp - SRCS += DVDFactoryDemuxer.cpp -+SRCS += DemuxStreamSSIF.cpp - - LIB = DVDDemuxers.a - -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 974305ff329eb6999c908d5e05d723f93137ae33..985ecf9722141d78471c00e90da15bfad931462a 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -391,7 +391,7 @@ void CAdvancedSettings::Initialize() - - m_pictureExtensions = ".png|.jpg|.jpeg|.bmp|.gif|.ico|.tif|.tiff|.tga|.pcx|.cbz|.zip|.cbr|.rar|.rss|.webp|.jp2|.apng"; - m_musicExtensions = ".nsv|.m4a|.flac|.aac|.strm|.pls|.rm|.rma|.mpa|.wav|.wma|.ogg|.mp3|.mp2|.m3u|.gdm|.imf|.m15|.sfx|.uni|.ac3|.dts|.cue|.aif|.aiff|.wpl|.ape|.mac|.mpc|.mp+|.mpp|.shn|.zip|.rar|.wv|.dsp|.xsp|.xwav|.waa|.wvs|.wam|.gcm|.idsp|.mpdsp|.mss|.spt|.rsd|.sap|.cmc|.cmr|.dmc|.mpt|.mpd|.rmt|.tmc|.tm8|.tm2|.oga|.url|.pxml|.tta|.rss|.wtv|.mka|.tak|.opus|.dff|.dsf"; -- m_videoExtensions = ".m4v|.3g2|.3gp|.nsv|.tp|.ts|.ty|.strm|.pls|.rm|.rmvb|.mpd|.m3u|.m3u8|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.mk3d|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp|.mts|.m2t|.m2ts|.evo|.ogv|.sdp|.avs|.rec|.url|.pxml|.vc1|.h264|.rcv|.rss|.mpls|.webm|.bdmv|.wtv"; -+ m_videoExtensions = ".m4v|.3g2|.3gp|.nsv|.tp|.ts|.ty|.strm|.pls|.rm|.rmvb|.mpd|.m3u|.m3u8|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.mk3d|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp|.mts|.m2t|.m2ts|.evo|.ogv|.sdp|.avs|.rec|.url|.pxml|.vc1|.h264|.rcv|.rss|.mpls|.webm|.bdmv|.wtv|.ssif"; - m_subtitlesExtensions = ".utf|.utf8|.utf-8|.sub|.srt|.smi|.rt|.txt|.ssa|.text|.ssa|.aqt|.jss|.ass|.idx|.ifo|.rar|.zip"; - m_discStubExtensions = ".disc"; - // internal music extensions - -From d5804f4eeee51ca51afea69ff07b5afcd17ed8d9 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Tue, 23 Feb 2016 16:02:46 +0300 -Subject: [PATCH 41/62] [3DBD] Added support of 3D-BluRay playback. - ---- - lib/DllLibbluray.h | 8 + - xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt | 2 + - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 51 +++- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp | 266 +++++++++++++++++++++ - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h | 57 +++++ - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 40 +++- - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h | 12 +- - xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in | 1 + - .../DVDInputStreams/DVDInputStreamBluray.cpp | 159 ++++++++++-- - .../DVDInputStreams/DVDInputStreamBluray.h | 20 ++ - 10 files changed, 581 insertions(+), 35 deletions(-) - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp - create mode 100644 xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h - -diff --git a/lib/DllLibbluray.h b/lib/DllLibbluray.h -index f5a337fe19beff472557c97ff7a203ad30a912b2..03f93391265e164837c2a17a8fe6d7da41c2f13e 100644 ---- a/lib/DllLibbluray.h -+++ b/lib/DllLibbluray.h -@@ -31,6 +31,8 @@ extern "C" - #include - #include - #include -+#include -+#include - } - - class DllLibblurayInterface -@@ -80,6 +82,8 @@ public: - #endif - virtual int bd_menu_call (BLURAY *bd, int64_t pts)=0; - virtual int bd_mouse_select (BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)=0; -+ virtual MPLS_PL* bd_get_title_mpls (BLURAY *bd) = 0; -+ virtual int bd_get_clip_infos (BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration) = 0; - }; - - class DllLibbluray : public DllDynamic, DllLibblurayInterface -@@ -128,6 +132,8 @@ class DllLibbluray : public DllDynamic, DllLibblurayInterface - #endif - DEFINE_METHOD2(int, bd_menu_call, (BLURAY *p1, int64_t p2)) - DEFINE_METHOD4(int, bd_mouse_select, (BLURAY *p1, int64_t p2, uint16_t p3, uint16_t p4)) -+ DEFINE_METHOD1(MPLS_PL*, bd_get_title_mpls, (BLURAY *p1)) -+ DEFINE_METHOD6(int, bd_get_clip_infos, (BLURAY *p1, unsigned p2, uint64_t *p3, uint64_t *p4, uint64_t *p5, uint64_t *p6)) - - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(bd_get_titles) -@@ -172,6 +178,8 @@ class DllLibbluray : public DllDynamic, DllLibblurayInterface - #endif - RESOLVE_METHOD(bd_menu_call) - RESOLVE_METHOD(bd_mouse_select) -+ RESOLVE_METHOD(bd_get_title_mpls) -+ RESOLVE_METHOD(bd_get_clip_infos) - END_METHOD_RESOLVE() - - public: -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -index 156ec2021002d9d7a355db2f0dcf099aabb1db48..87d27b666f703743bb0170252cf1190da5bce261 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/CMakeLists.txt -@@ -6,6 +6,7 @@ set(SOURCES DemuxMultiSource.cpp - DVDDemuxClient.cpp - DVDDemuxFFmpeg.cpp - DemuxStreamSSIF.cpp -+ DemuxMVC.cpp - DVDDemuxUtils.cpp - DVDDemuxVobsub.cpp - DVDFactoryDemuxer.cpp) -@@ -18,6 +19,7 @@ set(HEADERS DemuxMultiSource.h - DVDDemuxClient.h - DVDDemuxFFmpeg.h - DemuxStreamSSIF.h -+ DemuxMVC.h - DVDDemuxPacket.h - DVDDemuxUtils.h - DVDDemuxVobsub.h -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 6df586ac1f2d00e55307358228a4be89278ce67e..b7e5081bc0fc32eaaae42d894a288e7971139356 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -27,6 +27,7 @@ - #include "cores/FFmpeg.h" - #include "DVDCodecs/DVDCodecUtils.h" - #include "DVDClock.h" // for DVD_TIME_BASE -+#include "DemuxMVC.h" - #include "DVDDemuxUtils.h" - #include "DVDInputStreams/DVDInputStream.h" - #include "DVDInputStreams/DVDInputStreamFFmpeg.h" -@@ -503,6 +504,16 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein - - UpdateCurrentPTS(); - -+ if (!fileinfo && m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ { -+ CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -+ if (bluRay->HasMVC()) -+ { -+ SAFE_DELETE(m_pSSIF); -+ m_pSSIF = new CDemuxStreamSSIF(); -+ m_pSSIF->SetBluRay(bluRay); -+ } -+ } - // in case of mpegts and we have not seen pat/pmt, defer creation of streams - if (!skipCreateStreams || m_pFormatContext->nb_programs > 0) - { -@@ -884,9 +895,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - { - Flush(); - } -- // libavformat is confused by the interleaved SSIF. -- // Disable program management for those -- else if (!m_pSSIF && IsProgramChange()) -+ else if (IsProgramChange()) - { - // update streams - CreateStreams(m_program); -@@ -927,8 +936,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - if (IsVideoReady()) - { - // libavformat is confused by the interleaved SSIF. -- // Disable program management for those -- if (!m_pSSIF && m_program != UINT_MAX ) -+ if ((!m_pSSIF || m_pSSIF->IsBluRay()) && m_program != UINT_MAX) - { - /* check so packet belongs to selected program */ - for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++) -@@ -1079,10 +1087,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() - } - if (stream && m_pSSIF) - { -- if (stream->type == STREAM_VIDEO || -- stream->type == STREAM_DATA) -- pPacket = m_pSSIF->AddPacket(pPacket); -- -+ pPacket = m_pSSIF->AddPacket(pPacket); - if (stream->type == STREAM_DATA && stream->codec == AV_CODEC_ID_H264_MVC && pPacket->iSize) - stream = GetStream(pPacket->iStreamId); - } -@@ -1481,6 +1486,29 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - { - m_pSSIF->SetH264StreamId(streamIdx); - pStream->codec->codec_tag = MKTAG('A', 'M', 'V', 'C'); -+ -+ AVStream* mvcStream = nullptr; -+ if (m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ { -+ CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -+ if (bluRay->HasMVC()) -+ { -+ st->stereo_mode = bluRay->AreEyesFlipped() ? "block_rl" : "block_lr"; -+ mvcStream = static_cast(bluRay->GetDemuxMVC())->GetAVStream(); -+ } -+ } -+ else -+ mvcStream = m_pFormatContext->streams[m_pSSIF->GetMVCStreamId()]; -+ -+ if (mvcStream && pStream->codec->extradata_size > 0 && mvcStream->codec->extradata_size > 0) -+ { -+ uint8_t* extr = pStream->codec->extradata; -+ pStream->codec->extradata = (uint8_t*)av_mallocz(pStream->codec->extradata_size + mvcStream->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); -+ memcpy(pStream->codec->extradata, extr, pStream->codec->extradata_size); -+ memcpy(pStream->codec->extradata + pStream->codec->extradata_size, mvcStream->codec->extradata, mvcStream->codec->extradata_size); -+ pStream->codec->extradata_size += mvcStream->codec->extradata_size; -+ av_free(extr); -+ } - } - } - else if (CDVDCodecUtils::ProcessH264MVCExtradata(pStream->codec->extradata, pStream->codec->extradata_size)) -@@ -1804,6 +1832,11 @@ std::string CDVDDemuxFFmpeg::GetStreamCodecName(int iStreamId) - - bool CDVDDemuxFFmpeg::IsProgramChange() - { -+ // libavformat is confused by the interleaved SSIF. -+ // disable program management for those -+ if (m_pSSIF && !m_pSSIF->IsBluRay()) -+ return false; -+ - if (m_program == UINT_MAX) - return false; - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -new file mode 100644 -index 0000000000000000000000000000000000000000..ade6a4454fc3915b0c787b1a4f72aedbd74903db ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -@@ -0,0 +1,266 @@ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DemuxMVC.h" -+#include "DVDDemuxUtils.h" -+#include "DVDInputStreams/DVDInputStream.h" -+#include "DVDClock.h" -+#include "cores/FFmpeg.h" -+#include "utils/log.h" -+ -+extern "C" { -+#include "libavutil/opt.h" -+}; -+ -+#define MVC_SEEK_TIME_WINDOW 75000 // experimental value depends on seeking accurate -+ -+static int mvc_file_read(void *h, uint8_t* buf, int size) -+{ -+ CDVDInputStream* pInputStream = static_cast(h)->m_pInput; -+ return pInputStream->Read(buf, size); -+} -+ -+static int64_t mvc_file_seek(void *h, int64_t pos, int whence) -+{ -+ CDVDInputStream* pInputStream = static_cast(h)->m_pInput; -+ if (whence == AVSEEK_SIZE) -+ return pInputStream->GetLength(); -+ else -+ return pInputStream->Seek(pos, whence & ~AVSEEK_FORCE); -+} -+ -+CDemuxMVC::CDemuxMVC() -+{ -+ m_ioContext = nullptr; -+ m_pFormatContext = nullptr; -+ m_pInput = nullptr; -+ m_nStreamIndex = -1; -+} -+ -+CDemuxMVC::~CDemuxMVC() -+{ -+ Dispose(); -+} -+ -+bool CDemuxMVC::Open(CDVDInputStream* pInput) -+{ -+ int ret; -+ -+ if (!pInput) -+ return false; -+ m_pInput = pInput; -+ -+ unsigned char* buffer = (unsigned char*)av_malloc(FFMPEG_FILE_BUFFER_SIZE); -+ m_ioContext = avio_alloc_context(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, this, mvc_file_read, NULL, mvc_file_seek); -+ m_ioContext->max_packet_size = m_pInput->GetBlockSize(); -+ if (m_ioContext->max_packet_size) -+ m_ioContext->max_packet_size *= FFMPEG_FILE_BUFFER_SIZE / m_ioContext->max_packet_size; -+ -+ m_pFormatContext = avformat_alloc_context(); -+ m_pFormatContext->pb = m_ioContext; -+ -+ AVInputFormat *format = av_find_input_format("mpegts"); -+ ret = avformat_open_input(&m_pFormatContext, m_pInput->GetFileName().c_str(), format, nullptr); -+ if (ret < 0) -+ { -+ CLog::Log(LOGDEBUG, "%s: Opening MVC demuxing context failed (%d)", __FUNCTION__, ret); -+ Dispose(); -+ return false; -+ } -+ -+ av_opt_set_int(m_pFormatContext, "analyzeduration", 500000, 0); -+ av_opt_set_int(m_pFormatContext, "correct_ts_overflow", 0, 0); -+ m_pFormatContext->flags |= AVFMT_FLAG_KEEP_SIDE_DATA; -+ -+ // Find the streams -+ ret = avformat_find_stream_info(m_pFormatContext, nullptr); -+ //it always returns -1 so just ignore it -+ //if (ret < 0) -+ //{ -+ // CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::OpenMVCDemuxer(): avformat_find_stream_info failed (%d)", ret); -+ // Dispose(); -+ // return false; -+ //} -+ -+ // print some extra information -+ av_dump_format(m_pFormatContext, 0, m_pInput->GetFileName().c_str(), 0); -+ -+ // Find and select our MVC stream -+ CLog::Log(LOGDEBUG, "%s: MVC m2ts has %d streams", __FUNCTION__, m_pFormatContext->nb_streams); -+ for (unsigned i = 0; i < m_pFormatContext->nb_streams; i++) -+ { -+ if (m_pFormatContext->streams[i]->codec->codec_id == AV_CODEC_ID_H264_MVC -+ && m_pFormatContext->streams[i]->codec->extradata_size > 0) -+ { -+ m_nStreamIndex = i; -+ break; -+ } -+ else -+ m_pFormatContext->streams[i]->discard = AVDISCARD_ALL; -+ } -+ -+ if (m_nStreamIndex < 0) -+ { -+ CLog::Log(LOGDEBUG, "%s: MVC Stream not found", __FUNCTION__); -+ Dispose(); -+ return false; -+ } -+ -+ return true; -+} -+ -+void CDemuxMVC::Reset() -+{ -+ CDVDInputStream* pInput = m_pInput; -+ Dispose(); -+ Open(pInput); -+} -+ -+void CDemuxMVC::Abort() -+{ -+} -+ -+void CDemuxMVC::Flush() -+{ -+ if (m_pFormatContext) -+ { -+ if (m_pFormatContext->pb) -+ avio_flush(m_pFormatContext->pb); -+ avformat_flush(m_pFormatContext); -+ } -+} -+ -+DemuxPacket* CDemuxMVC::Read() -+{ -+ int ret; -+ AVPacket mvcPacket = { 0 }; -+ av_init_packet(&mvcPacket); -+ -+ while (true) -+ { -+ ret = av_read_frame(m_pFormatContext, &mvcPacket); -+ -+ if (ret == AVERROR(EINTR) || ret == AVERROR(EAGAIN)) -+ continue; -+ else if (ret == AVERROR_EOF) -+ break; -+ else if (mvcPacket.size <= 0 || mvcPacket.stream_index != m_nStreamIndex) -+ { -+ av_packet_unref(&mvcPacket); -+ continue; -+ } -+ else -+ { -+ AVStream *stream = m_pFormatContext->streams[mvcPacket.stream_index]; -+ double dts = ConvertTimestamp(mvcPacket.dts, stream->time_base.den, stream->time_base.num); -+ double pts = ConvertTimestamp(mvcPacket.pts, stream->time_base.den, stream->time_base.num); -+ -+ DemuxPacket* newPkt = CDVDDemuxUtils::AllocateDemuxPacket(mvcPacket.size); -+ if (mvcPacket.data) -+ memcpy(newPkt->pData, mvcPacket.data, mvcPacket.size); -+ newPkt->iSize = mvcPacket.size; -+ newPkt->dts = dts; -+ newPkt->pts = pts; -+ newPkt->iStreamId = stream->id; -+ -+ av_packet_unref(&mvcPacket); -+ return newPkt; -+ } -+ } -+ -+ return nullptr; -+} -+ -+bool CDemuxMVC::SeekTime(int time, bool backwords, double* startpts) -+{ -+ if (!m_pInput) -+ return false; -+ -+ AVRational time_base = m_pFormatContext->streams[m_nStreamIndex]->time_base; -+ int64_t seek_pts = av_rescale(DVD_MSEC_TO_TIME(time), time_base.den, (int64_t)time_base.num * AV_TIME_BASE); -+ int64_t starttime = 0; -+ -+ if (m_pFormatContext->start_time != (int64_t)AV_NOPTS_VALUE) -+ starttime = av_rescale(m_pFormatContext->start_time, time_base.den, (int64_t)time_base.num * AV_TIME_BASE); -+ if (starttime != 0) -+ seek_pts += starttime; -+ if (seek_pts < MVC_SEEK_TIME_WINDOW) -+ seek_pts = 0; -+ else -+ seek_pts -= MVC_SEEK_TIME_WINDOW; -+ -+ av_seek_frame(m_pFormatContext, m_nStreamIndex, seek_pts, AVSEEK_FLAG_BACKWARD); -+ return true; -+} -+ -+std::string CDemuxMVC::GetFileName() -+{ -+ return m_pInput->GetFileName(); -+} -+ -+AVStream* CDemuxMVC::GetAVStream() -+{ -+ return m_pFormatContext ? m_pFormatContext->streams[m_nStreamIndex] : nullptr; -+} -+ -+void CDemuxMVC::Dispose() -+{ -+ if (m_pFormatContext) -+ avformat_close_input(&m_pFormatContext); -+ -+ if (m_ioContext) -+ { -+ av_free(m_ioContext->buffer); -+ av_free(m_ioContext); -+ } -+ -+ m_ioContext = nullptr; -+ m_pFormatContext = nullptr; -+ m_pInput = nullptr; -+ m_nStreamIndex = -1; -+} -+ -+double CDemuxMVC::ConvertTimestamp(int64_t pts, int den, int num) -+{ -+ if (pts == (int64_t)AV_NOPTS_VALUE) -+ return DVD_NOPTS_VALUE; -+ -+ // do calculations in floats as they can easily overflow otherwise -+ // we don't care for having a completly exact timestamp anyway -+ double timestamp = (double)pts * num / den; -+ double starttime = 0.0f; -+ -+ /*if (m_MVCFormatContext->start_time != (int64_t)AV_NOPTS_VALUE) -+ starttime = (double)m_MVCFormatContext->start_time / AV_TIME_BASE;*/ -+ -+ if (timestamp > starttime) -+ timestamp -= starttime; -+ // allow for largest possible difference in pts and dts for a single packet -+ else if (timestamp + 0.5f > starttime) -+ timestamp = 0; -+ -+ return timestamp * DVD_TIME_BASE; -+} -+ -+std::vector CDemuxMVC::GetStreams() const -+{ -+ std::vector streams; -+ return streams; -+} -\ No newline at end of file -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -new file mode 100644 -index 0000000000000000000000000000000000000000..bbb836a61344689a83af68c821c05c212a86b097 ---- /dev/null -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -@@ -0,0 +1,57 @@ -+#pragma once -+ -+/* -+* Copyright (C) 2005-2013 Team XBMC -+* http://xbmc.org -+* -+* 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, or (at your option) -+* any later version. -+* -+* This Program 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. -+* -+* You should have received a copy of the GNU General Public License -+* along with XBMC; see the file COPYING. If not, see -+* . -+* -+*/ -+ -+#include "DVDDemux.h" -+ -+extern "C" { -+#include "libavformat/avformat.h" -+} -+ -+class CDemuxMVC : public CDVDDemux -+{ -+public: -+ CDemuxMVC(); -+ virtual ~CDemuxMVC(); -+ bool Open(CDVDInputStream* pInput); -+ virtual void Reset(); -+ virtual void Abort(); -+ virtual void Flush(); -+ virtual DemuxPacket* Read(); -+ virtual bool SeekTime(int time, bool backwords = false, double* startpts = nullptr); -+ virtual void SetSpeed(int iSpeed) { }; -+ virtual int GetStreamLength() { return 0; }; -+ virtual CDemuxStream* GetStream(int iStreamId) const override { return nullptr; }; -+ virtual std::vector GetStreams() const override; -+ virtual int GetNrOfStreams() const override { return 1; }; -+ virtual std::string GetFileName(); -+ -+ AVStream* GetAVStream(); -+ CDVDInputStream* m_pInput; -+ -+private: -+ void Dispose(); -+ double ConvertTimestamp(int64_t pts, int den, int num); -+ -+ AVIOContext *m_ioContext = nullptr; -+ AVFormatContext *m_pFormatContext = nullptr; -+ int m_nStreamIndex = -1; -+}; -\ No newline at end of file -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -index f75532016a1395782b59dc124676835c7254de56..2c7e66f7ee5683a0fbcde5ad5c65ebfd6853f3d0 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -19,11 +19,13 @@ - */ - - #include "DemuxStreamSSIF.h" -+#include "DVDDemux.h" - #include "DVDClock.h" - #include "DVDDemuxUtils.h" - #include "utils/log.h" - - //#define DEBUG_VERBOSE -+#define MVC_QUEUE_SIZE 100 - - DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) - { -@@ -37,7 +39,7 @@ DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) - } - else if (srcPkt->iStreamId == m_mvcStreamId) - { -- m_MVCqueue.push(srcPkt); -+ AddMVCExtPacket(srcPkt); - } - - return GetMVCPacket(); -@@ -81,6 +83,10 @@ DemuxPacket* CDemuxStreamSSIF::MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &a - - DemuxPacket* CDemuxStreamSSIF::GetMVCPacket() - { -+ // if input is a bluray fill mvc queue before processing -+ if (m_bluRay && m_MVCqueue.empty() && !m_H264queue.empty()) -+ FillMVCQueue(m_H264queue.front()->dts); -+ - // Here, we recreate a h264 MVC packet from the base one + buffered MVC NALU's - while (!m_H264queue.empty() && !m_MVCqueue.empty()) - { -@@ -151,6 +157,36 @@ DemuxPacket* CDemuxStreamSSIF::GetMVCPacket() - #if defined(DEBUG_VERBOSE) - CLog::Log(LOGDEBUG, ">>> MVC waiting. MVC(%d) H264(%d)", m_MVCqueue.size(), m_H264queue.size()); - #endif -- - return CDVDDemuxUtils::AllocateDemuxPacket(0); - } -+ -+void CDemuxStreamSSIF::AddMVCExtPacket(DemuxPacket* &mvcExtPkt) -+{ -+ m_MVCqueue.push(mvcExtPkt); -+} -+ -+bool CDemuxStreamSSIF::FillMVCQueue(double dtsBase) -+{ -+ if (!m_bluRay) -+ return false; -+ -+ CDVDDemux* demux = m_bluRay->GetDemuxMVC(); -+ DemuxPacket* mvc; -+ while ((m_MVCqueue.size() < MVC_QUEUE_SIZE) && (mvc = demux->Read())) -+ { -+ if (dtsBase == DVD_NOPTS_VALUE || mvc->dts == DVD_NOPTS_VALUE) -+ { -+ // do nothing, can't compare timestamps when they are not set -+ } -+ else if (mvc->dts < dtsBase) -+ { -+#if defined(DEBUG_VERBOSE) -+ CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d, pts(%.3f) dts(%.3f)", mvc->iSize, mvc->pts*1e-6, mvc->dts*1e-6); -+#endif -+ CDVDDemuxUtils::FreeDemuxPacket(mvc); -+ continue; -+ } -+ AddMVCExtPacket(mvc); -+ }; -+ return m_MVCqueue.size() == MVC_QUEUE_SIZE; -+} -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -index 1dafdc58db3f9cb5eac032c591942439117e13c4..508e9debd3e6679a1433842a65649fa68ead76ec 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -@@ -21,6 +21,7 @@ - */ - - #include "DVDDemuxPacket.h" -+#include "DVDInputStreams/DVDInputStreamBluray.h" - #include - - extern "C" { -@@ -37,13 +38,20 @@ public: - void Flush(); - void SetH264StreamId(int id) { m_h264StreamId = id; }; - void SetMVCStreamId(int id) { m_mvcStreamId = id; }; -+ int GetH264StreamId() { return m_h264StreamId; }; -+ int GetMVCStreamId() { return m_mvcStreamId; }; -+ void AddMVCExtPacket(DemuxPacket* &scrPkt); -+ void SetBluRay(CDVDInputStreamBluray* &bluRay) { m_bluRay = bluRay; }; -+ bool IsBluRay() { return m_bluRay != nullptr; }; - - private: - DemuxPacket* GetMVCPacket(); - DemuxPacket* MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt); -+ bool FillMVCQueue(double dtsBase); - -+ CDVDInputStreamBluray* m_bluRay = nullptr; - std::queue m_H264queue; - std::queue m_MVCqueue; -- int m_h264StreamId = 0; -- int m_mvcStreamId = 0; -+ int m_h264StreamId = -1; -+ int m_mvcStreamId = -1; - }; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -index 30076937bd084936571abf0e6eeecf5ad916c7b3..0359426b85683a4c3a80ef0e0d52f7a79564daaa 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -@@ -11,6 +11,7 @@ SRCS += DVDDemuxVobsub.cpp - SRCS += DVDDemuxCC.cpp - SRCS += DVDFactoryDemuxer.cpp - SRCS += DemuxStreamSSIF.cpp -+SRCS += DVDDemuxMVC.cpp - - LIB = DVDDemuxers.a - -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index 6ccd9a8c00fdc5175df3ecbb3a5d30dc93e319ab..ad2c65ba5b80c5ac5d055d621a1e8319e3f770c0 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -26,6 +26,8 @@ - #include "IVideoPlayer.h" - #include "DVDCodecs/Overlay/DVDOverlay.h" - #include "DVDCodecs/Overlay/DVDOverlayImage.h" -+#include "DVDInputStreamFile.h" -+#include "DVDDemuxers/DemuxMVC.h" - #include "settings/Settings.h" - #include "LangInfo.h" - #include "utils/log.h" -@@ -231,10 +233,8 @@ bool CDVDInputStreamBluray::IsEOF() - - BLURAY_TITLE_INFO* CDVDInputStreamBluray::GetTitleLongest() - { -- int titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0); -- - BLURAY_TITLE_INFO *s = NULL; -- for(int i=0; i < titles; i++) -+ for(int i=0; i < m_nTitles; i++) - { - BLURAY_TITLE_INFO *t = m_dll->bd_get_title_info(m_bd, i, 0); - if(!t) -@@ -326,6 +326,7 @@ bool CDVDInputStreamBluray::Open() - return false; - } - -+ m_root = root; - const BLURAY_DISC_INFO *disc_info; - - disc_info = m_dll->bd_get_disc_info(m_bd); -@@ -349,6 +350,7 @@ bool CDVDInputStreamBluray::Open() - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - BD+ detected : %d", disc_info->bdplus_detected); - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - libbdplus detected : %d", disc_info->libbdplus_detected); - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - BD+ handled : %d", disc_info->bdplus_handled); -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - 3D content exist : %d", disc_info->content_exist_3D); - } - else - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - BluRay not detected"); -@@ -365,6 +367,7 @@ bool CDVDInputStreamBluray::Open() - return false; - } - -+ m_nTitles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0); - int mode = CSettings::GetInstance().GetInt(CSettings::SETTING_DISC_PLAYBACK); - - if (URIUtils::HasExtension(filename, ".mpls")) -@@ -393,18 +396,17 @@ bool CDVDInputStreamBluray::Open() - m_title = GetTitleLongest(); - } - -- if(m_navmode) -+ SetupPlayerSettings(); -+ m_dll->bd_get_event(m_bd, NULL); -+ -+ if (m_navmode) - { -- SetupPlayerSettings(); - - m_dll->bd_register_overlay_proc (m_bd, this, bluray_overlay_cb); - #ifdef HAVE_LIBBLURAY_BDJ - m_dll->bd_register_argb_overlay_proc (m_bd, this, bluray_overlay_argb_cb, NULL); - #endif - -- m_dll->bd_get_event(m_bd, NULL); -- -- - if(m_dll->bd_play(m_bd) <= 0) - { - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed play disk %s", strPath.c_str()); -@@ -419,21 +421,25 @@ bool CDVDInputStreamBluray::Open() - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to get title info"); - return false; - } -- -- if(m_dll->bd_select_playlist(m_bd, m_title->playlist) == 0 ) -+ if (m_dll->bd_select_playlist(m_bd, m_title->playlist) == 0) - { - CLog::Log(LOGERROR, "CDVDInputStreamBluray::Open - failed to select title %d", m_title->idx); - return false; - } -- m_clip = 0; - } - -+ // Process any events that occured during opening -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ - return true; - } - - // close file and reset everyting - void CDVDInputStreamBluray::Close() - { -+ CloseMVCDemux(); -+ - if (!m_dll) - return; - if(m_title) -@@ -449,7 +455,7 @@ void CDVDInputStreamBluray::Close() - - void CDVDInputStreamBluray::ProcessEvent() { - -- int pid = -1; -+ int pid = -1, ret; - switch (m_event.event) { - - case BD_EVENT_ERROR: -@@ -514,15 +520,17 @@ void CDVDInputStreamBluray::ProcessEvent() { - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - BD_EVENT_PLAYLIST %d", - m_event.param); - m_playlist = m_event.param; -- if(m_title) -- m_dll->bd_free_title_info(m_title); -- m_title = m_dll->bd_get_playlist_info(m_bd, m_playlist, m_angle); -+ ProcessItem(m_playlist); - break; - - case BD_EVENT_PLAYITEM: - CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - BD_EVENT_PLAYITEM %d", - m_event.param); - m_clip = m_event.param; -+ uint64_t clip_start, clip_in, bytepos; -+ ret = m_dll->bd_get_clip_infos(m_bd, m_clip, &clip_start, &clip_in, &bytepos, nullptr); -+ if (ret) -+ m_clipStartTime = clip_start / 90; - break; - - case BD_EVENT_CHAPTER: -@@ -601,14 +609,20 @@ void CDVDInputStreamBluray::ProcessEvent() { - - /* event has been consumed */ - m_event.event = BD_EVENT_NONE; -+ -+ if (m_bMVCPlayback && m_clip >= 0 && m_title && m_clip < m_title->clip_count && m_nMVCClip != m_clip) -+ { -+ CloseMVCDemux(); -+ OpenMVCDemux(m_clip); -+ } - } - - int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size) - { -+ int result = 0; - m_dispTimeBeforeRead = (int)(m_dll->bd_tell_time(m_bd) / 90); - if(m_navmode) - { -- int result = 0; - do { - - if(m_hold == HOLD_HELD) -@@ -658,10 +672,14 @@ int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size) - - } while(result == 0); - -- return result; - } - else -- return m_dll->bd_read(m_bd, buf, buf_size); -+ { -+ result = m_dll->bd_read(m_bd, buf, buf_size); -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ } -+ return result; - } - - static uint8_t clamp(double v) -@@ -909,8 +927,12 @@ bool CDVDInputStreamBluray::PosTime(int ms) - { - if(m_dll->bd_seek_time(m_bd, ms * 90) < 0) - return false; -- else -- return true; -+ -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ -+ SeekMVCDemux(ms - m_clipStartTime); -+ return true; - } - - int CDVDInputStreamBluray::GetChapterCount() -@@ -933,8 +955,12 @@ bool CDVDInputStreamBluray::SeekChapter(int ch) - { - if(m_title && m_dll->bd_seek_chapter(m_bd, ch-1) < 0) - return false; -- else -- return true; -+ -+ while (m_dll->bd_get_event(m_bd, &m_event)) -+ ProcessEvent(); -+ -+ SeekMVCDemux(GetChapterPos(ch) * 1000 - m_clipStartTime); -+ return true; - } - - int64_t CDVDInputStreamBluray::GetChapterPos(int ch) -@@ -1132,6 +1158,95 @@ bool CDVDInputStreamBluray::HasMenu() - return m_navmode; - } - -+bool CDVDInputStreamBluray::ProcessItem(int playitem) -+{ -+ if (m_title) -+ m_dll->bd_free_title_info(m_title); -+ -+ m_title = m_dll->bd_get_playlist_info(m_bd, playitem, m_angle); -+ -+ if (CSettings::GetInstance().GetBool("videoplayer.supportmvc")) -+ { -+ MPLS_PL * mpls = m_dll->bd_get_title_mpls(m_bd); -+ if (mpls) -+ { -+ for (int i = 0; i < mpls->ext_sub_count; i++) -+ { -+ if (mpls->ext_sub_path[i].type == 8 -+ && mpls->ext_sub_path[i].sub_playitem_count == mpls->list_count) -+ { -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - Enabling BD3D MVC demuxing"); -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - MVC_Base_view_R_flag: %d", m_title->mvc_base_view_r_flag); -+ m_bMVCPlayback = true; -+ m_nMVCSubPathIndex = i; -+ m_bFlipEyes = m_title->mvc_base_view_r_flag != 0; -+ break; -+ } -+ } -+ } -+ } -+ CloseMVCDemux(); -+ return true; -+} -+ -+bool CDVDInputStreamBluray::OpenMVCDemux(int playItem) -+{ -+ MPLS_PL *pl = m_dll->bd_get_title_mpls(m_bd); -+ if (!pl) -+ return false; -+ -+ std::string strFileName; -+ strFileName.append(m_root); -+ strFileName.append("/BDMV/STREAM/"); -+ strFileName.append(pl->ext_sub_path[m_nMVCSubPathIndex].sub_play_item[playItem].clip->clip_id); -+ strFileName.append(".m2ts"); -+ -+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::OpenMVCDemuxer(): Opening MVC extension stream at %s", strFileName.c_str()); -+ -+ CFileItem fileitem(CURL(strFileName), false); -+ m_pMVCInput = new CDVDInputStreamFile(fileitem); -+ -+ // Try to open the MVC stream -+ if (!m_pMVCInput->Open()) -+ { -+ CloseMVCDemux(); -+ m_bMVCPlayback = false; -+ return false; -+ } -+ -+ if (m_pMVCDemux) -+ SAFE_DELETE(m_pMVCDemux); -+ -+ CDemuxMVC* pMVCDemux = new CDemuxMVC; -+ m_pMVCDemux = pMVCDemux; -+ -+ if (!pMVCDemux->Open(m_pMVCInput)) -+ { -+ CloseMVCDemux(); -+ m_bMVCPlayback = false; -+ return false; -+ } -+ -+ m_nMVCClip = playItem; -+ return true; -+} -+ -+bool CDVDInputStreamBluray::CloseMVCDemux() -+{ -+ if (m_pMVCDemux) -+ SAFE_DELETE(m_pMVCDemux); -+ -+ SAFE_DELETE(m_pMVCInput); -+ m_nMVCClip = -1; -+ return true; -+} -+ -+void CDVDInputStreamBluray::SeekMVCDemux(int64_t time) -+{ -+ if (m_bMVCPlayback && m_pMVCDemux) -+ m_pMVCDemux->SeekTime(time); -+} -+ - void CDVDInputStreamBluray::SetupPlayerSettings() - { - int region = CSettings::GetInstance().GetInt(CSettings::SETTING_BLURAY_PLAYERREGION); -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -index b967a85e6557e42a7f1235cdd804d5a0263b866f..561fb5cd4f971bc9ee4f41218a60bb3d5bc5625f 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -38,6 +38,7 @@ extern "C" - class CDVDOverlayImage; - class DllLibbluray; - class IVideoPlayer; -+class CDVDDemux; - - class CDVDInputStreamBluray - : public CDVDInputStream -@@ -119,6 +120,9 @@ public: - BLURAY_TITLE_INFO* GetTitleFile(const std::string& name); - - void ProcessEvent(); -+ CDVDDemux* GetDemuxMVC() { return m_pMVCDemux; }; -+ bool HasMVC() { return m_bMVCPlayback; } -+ bool AreEyesFlipped() { return m_bFlipEyes; } - - protected: - struct SPlane; -@@ -127,6 +131,11 @@ protected: - void OverlayClose(); - static void OverlayClear(SPlane& plane, int x, int y, int w, int h); - static void OverlayInit (SPlane& plane, int w, int h); -+ bool ProcessItem(int playitem); -+ -+ bool OpenMVCDemux(int playItem); -+ bool CloseMVCDemux(); -+ void SeekMVCDemux(int64_t time); - - IVideoPlayer* m_player; - DllLibbluray* m_dll; -@@ -138,6 +147,17 @@ protected: - bool m_menu; - bool m_navmode; - int m_dispTimeBeforeRead; -+ int m_nTitles = -1; -+ std::string m_root; -+ -+ // MVC related members -+ CDVDDemux* m_pMVCDemux = nullptr; -+ CDVDInputStream *m_pMVCInput = nullptr; -+ bool m_bMVCPlayback = false; -+ int m_nMVCSubPathIndex = 0; -+ int m_nMVCClip = -1; -+ bool m_bFlipEyes = false; -+ uint64_t m_clipStartTime = 0; - - typedef std::shared_ptr SOverlay; - typedef std::list SOverlays; - -From ba23ff0a3563eb2bf120bf5b7b068120112448a8 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 11 Mar 2016 16:58:53 +0300 -Subject: [PATCH 42/62] [VideoPlayer] HasVideo returns true if video stream - exists. This don't allow start visualization if audio is opened before video. - ---- - xbmc/cores/VideoPlayer/VideoPlayer.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -index dded334532841911a34d75808c3c350709d881f7..b9b0d866fe112d291a8d80a8269c3f572d254447 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -@@ -3115,7 +3115,7 @@ void CVideoPlayer::Pause() - - bool CVideoPlayer::HasVideo() const - { -- return m_HasVideo; -+ return m_HasVideo || GetVideoStream() >= 0; - } - - bool CVideoPlayer::HasAudio() const - -From 6faee73797c05d2c8140c6c11c7eace3231ea20e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 10 Mar 2016 18:11:33 +0300 -Subject: [PATCH 43/62] fixup! Revert supporting crappy tab/sbs subtitles. this - fixes regular subtitles. - ---- - .../cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -index 3a080d06c90b0762482816928642e6de7810b539..a8323f419e404037c4e5fb4d78fa1b45409337a7 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -@@ -243,20 +243,20 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay() - } - } - -- RENDER_STEREO_MODE render_stereo_mode = g_graphicsContext.GetStereoMode(); -+ /*RENDER_STEREO_MODE render_stereo_mode = g_graphicsContext.GetStereoMode(); - if (render_stereo_mode != RENDER_STEREO_MODE_OFF) - { -- if (rect.h > m_height / 2) -+ if ((rect.h - rect.y) > m_height / 2) - { - m_height /= 2; - rect.h /= 2; - } -- else if (rect.w > m_width / 2) -+ else if ((rect.w - rect.x) > m_width / 2) - { - m_width /= 2; - rect.w /= 2; - } -- } -+ }*/ - - CDVDOverlayImage* overlay = new CDVDOverlayImage(); - - -From b9eb944c52a9e09bfa084f4bd8f8862f13ec6f7e Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 7 Apr 2016 17:28:50 +0300 -Subject: [PATCH 44/62] [VideoPlayer] Disable reading extension stream from - input stream if decoder doesn't support it. - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h | 5 +++++ - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 18 +++++++++--------- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 4 +++- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h | 6 +++--- - .../cores/VideoPlayer/DVDInputStreams/DVDInputStream.h | 11 +++++++++++ - .../DVDInputStreams/DVDInputStreamBluray.cpp | 9 ++++++++- - .../VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h | 9 ++++++--- - xbmc/cores/VideoPlayer/IVideoPlayer.h | 1 + - xbmc/cores/VideoPlayer/VideoPlayer.cpp | 4 ++++ - xbmc/cores/VideoPlayer/VideoPlayerVideo.h | 1 + - 10 files changed, 51 insertions(+), 17 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -index a2da9de4375939f3711c594dc854b9a533c755b4..8101b6eeff0341a94736df7ee815dd4c18337a32 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -311,6 +311,11 @@ public: - */ - virtual void Reopen() {}; - -+ /** -+ * Indicates that the decoder supports extention streams. -+ */ -+ virtual bool SupportsExtention() { return false; } -+ - protected: - CProcessInfo &m_processInfo; - }; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index b7e5081bc0fc32eaaae42d894a288e7971139356..6ea1a19173e36d49f7391b6f350c8ae3173db7ff 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -504,14 +504,14 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein - - UpdateCurrentPTS(); - -- if (!fileinfo && m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ if (!fileinfo) - { -- CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -- if (bluRay->HasMVC()) -+ CDVDInputStream::IExtentionStream* pExt = dynamic_cast(m_pInput); -+ if (pExt && pExt->HasExtention()) - { - SAFE_DELETE(m_pSSIF); - m_pSSIF = new CDemuxStreamSSIF(); -- m_pSSIF->SetBluRay(bluRay); -+ m_pSSIF->SetBluRay(pExt); - } - } - // in case of mpegts and we have not seen pat/pmt, defer creation of streams -@@ -1488,13 +1488,13 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - pStream->codec->codec_tag = MKTAG('A', 'M', 'V', 'C'); - - AVStream* mvcStream = nullptr; -- if (m_pInput->IsStreamType(DVDSTREAM_TYPE_BLURAY)) -+ CDVDInputStream::IExtentionStream* pExt = dynamic_cast(m_pInput); -+ if (pExt) - { -- CDVDInputStreamBluray *bluRay = static_cast(m_pInput); -- if (bluRay->HasMVC()) -+ if (pExt->HasExtention()) - { -- st->stereo_mode = bluRay->AreEyesFlipped() ? "block_rl" : "block_lr"; -- mvcStream = static_cast(bluRay->GetDemuxMVC())->GetAVStream(); -+ st->stereo_mode = pExt->AreEyesFlipped() ? "block_rl" : "block_lr"; -+ mvcStream = static_cast(pExt->GetExtentionDemux())->GetAVStream(); - } - } - else -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -index 2c7e66f7ee5683a0fbcde5ad5c65ebfd6853f3d0..7c8719ce40e725e27b7551250398022a1f1a4fc6 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -35,6 +35,8 @@ DemuxPacket* CDemuxStreamSSIF::AddPacket(DemuxPacket* &srcPkt) - - if (srcPkt->iStreamId == m_h264StreamId) - { -+ if (m_bluRay && !m_bluRay->HasExtention()) -+ return srcPkt; - m_H264queue.push(srcPkt); - } - else if (srcPkt->iStreamId == m_mvcStreamId) -@@ -170,7 +172,7 @@ bool CDemuxStreamSSIF::FillMVCQueue(double dtsBase) - if (!m_bluRay) - return false; - -- CDVDDemux* demux = m_bluRay->GetDemuxMVC(); -+ CDVDDemux* demux = m_bluRay->GetExtentionDemux(); - DemuxPacket* mvc; - while ((m_MVCqueue.size() < MVC_QUEUE_SIZE) && (mvc = demux->Read())) - { -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -index 508e9debd3e6679a1433842a65649fa68ead76ec..26cd97dddcae208afacfb241e96b4935ad0f81f3 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.h -@@ -21,7 +21,7 @@ - */ - - #include "DVDDemuxPacket.h" --#include "DVDInputStreams/DVDInputStreamBluray.h" -+#include "DVDInputStreams/DVDInputStream.h" - #include - - extern "C" { -@@ -41,7 +41,7 @@ public: - int GetH264StreamId() { return m_h264StreamId; }; - int GetMVCStreamId() { return m_mvcStreamId; }; - void AddMVCExtPacket(DemuxPacket* &scrPkt); -- void SetBluRay(CDVDInputStreamBluray* &bluRay) { m_bluRay = bluRay; }; -+ void SetBluRay(CDVDInputStream::IExtentionStream* &bluRay) { m_bluRay = bluRay; }; - bool IsBluRay() { return m_bluRay != nullptr; }; - - private: -@@ -49,7 +49,7 @@ private: - DemuxPacket* MergePacket(DemuxPacket* &srcPkt, DemuxPacket* &appendPkt); - bool FillMVCQueue(double dtsBase); - -- CDVDInputStreamBluray* m_bluRay = nullptr; -+ CDVDInputStream::IExtentionStream* m_bluRay = nullptr; - std::queue m_H264queue; - std::queue m_MVCqueue; - int m_h264StreamId = -1; -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -index 932f0e4093c836453b07932df9075afc6f6e5ae5..7aee35cef8f42d080882e4bdd20a4a9ed234a8c2 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -@@ -57,6 +57,7 @@ namespace XFILE - - struct DemuxPacket; - class CDemuxStream; -+class CDVDDemux; - - class CDVDInputStream - { -@@ -131,6 +132,16 @@ public: - virtual void SetVideoResolution(int width, int height) {}; - }; - -+ class IExtentionStream -+ { -+ public: -+ virtual ~IExtentionStream() {} -+ virtual bool HasExtention() = 0; -+ virtual bool AreEyesFlipped() = 0; -+ virtual CDVDDemux* GetExtentionDemux() = 0; -+ virtual void DisableExtention() = 0; -+ }; -+ - enum ENextStream - { - NEXTSTREAM_NONE, -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index ad2c65ba5b80c5ac5d055d621a1e8319e3f770c0..74e8e1fc2da66d3c98a5bab04faa2f6bf16539ff 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -617,6 +617,13 @@ void CDVDInputStreamBluray::ProcessEvent() { - } - } - -+void CDVDInputStreamBluray::DisableExtention() -+{ -+ CloseMVCDemux(); -+ m_bMVCDisabled = true; -+ m_bMVCPlayback = false; -+} -+ - int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size) - { - int result = 0; -@@ -1165,7 +1172,7 @@ bool CDVDInputStreamBluray::ProcessItem(int playitem) - - m_title = m_dll->bd_get_playlist_info(m_bd, playitem, m_angle); - -- if (CSettings::GetInstance().GetBool("videoplayer.supportmvc")) -+ if (CSettings::GetInstance().GetBool("videoplayer.supportmvc") && !m_bMVCDisabled) - { - MPLS_PL * mpls = m_dll->bd_get_title_mpls(m_bd); - if (mpls) -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -index 561fb5cd4f971bc9ee4f41218a60bb3d5bc5625f..f70657c9e31fb2460d12910c635dba5163282e74 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -46,6 +46,7 @@ class CDVDInputStreamBluray - , public CDVDInputStream::IChapter - , public CDVDInputStream::IPosTime - , public CDVDInputStream::IMenus -+ , public CDVDInputStream::IExtentionStream - { - public: - CDVDInputStreamBluray(IVideoPlayer* player, const CFileItem& fileitem); -@@ -120,9 +121,10 @@ public: - BLURAY_TITLE_INFO* GetTitleFile(const std::string& name); - - void ProcessEvent(); -- CDVDDemux* GetDemuxMVC() { return m_pMVCDemux; }; -- bool HasMVC() { return m_bMVCPlayback; } -- bool AreEyesFlipped() { return m_bFlipEyes; } -+ CDVDDemux* GetExtentionDemux() override { return m_pMVCDemux; }; -+ bool HasExtention() override { return m_bMVCPlayback; } -+ bool AreEyesFlipped() override { return m_bFlipEyes; } -+ void DisableExtention() override; - - protected: - struct SPlane; -@@ -157,6 +159,7 @@ protected: - int m_nMVCSubPathIndex = 0; - int m_nMVCClip = -1; - bool m_bFlipEyes = false; -+ bool m_bMVCDisabled = false; - uint64_t m_clipStartTime = 0; - - typedef std::shared_ptr SOverlay; -diff --git a/xbmc/cores/VideoPlayer/IVideoPlayer.h b/xbmc/cores/VideoPlayer/IVideoPlayer.h -index 0b676c9b611fe956f1aa721013412e41ff5b62f6..6762e733848d1298a75a862b0aaf81aa5690537d 100644 ---- a/xbmc/cores/VideoPlayer/IVideoPlayer.h -+++ b/xbmc/cores/VideoPlayer/IVideoPlayer.h -@@ -111,6 +111,7 @@ public: - virtual int GetDecoderBufferSize() { return 0; } - virtual int GetDecoderFreeSpace() = 0; - virtual bool IsEOS() { return false; }; -+ virtual bool SupportsExtention() const = 0; - }; - - class CDVDAudioCodec; -diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -index b9b0d866fe112d291a8d80a8269c3f572d254447..d74c03d1ef7e0146a57964376dbff190876a8598 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp -@@ -3891,6 +3891,10 @@ bool CVideoPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) - if (!player->OpenStream(hint)) - return false; - -+ CDVDInputStream::IExtentionStream* pExt = dynamic_cast(m_pInputStream); -+ if (pExt && !static_cast(player)->SupportsExtention()) -+ pExt->DisableExtention(); -+ - s.stereo_mode = static_cast(player)->GetStereoMode(); - if (s.stereo_mode == "mono") - s.stereo_mode = ""; -diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.h b/xbmc/cores/VideoPlayer/VideoPlayerVideo.h -index 0d4100e58e9db7e5035bcf9ae23b0147f80cec8f..69570153f0810a5840f3780c7a6681a102b85cec 100644 ---- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.h -+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.h -@@ -91,6 +91,7 @@ public: - int GetVideoBitrate(); - std::string GetStereoMode(); - void SetSpeed(int iSpeed); -+ bool SupportsExtention() const override { return m_pVideoCodec && m_pVideoCodec->SupportsExtention(); } - - // classes - CDVDOverlayContainer* m_pOverlayContainer; - -From a5dcb2315b90a4868559d51964f9d59b69901773 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 16 Sep 2016 11:37:48 +0300 -Subject: [PATCH 45/62] [Settings] move SETTING_VIDEOPLAYER_SUPPORTMVC from - platform settings to common settings. - ---- - system/settings/rbp.xml | 7 ------- - system/settings/settings.xml | 6 ++++++ - system/settings/win32.xml | 11 ----------- - .../VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp | 2 +- - xbmc/settings/SettingConditions.cpp | 3 +++ - 5 files changed, 10 insertions(+), 19 deletions(-) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 2572e25753712186f69390965ee1448bff3fadd5..7098edf32dff8c00e192229c3ffb060be6a42482 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -28,13 +28,6 @@ - - - -- -- -- 2 -- true -- -- -- - -
-
-diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 22dcff1c06577055f84c3d2c2fda73cfa16c53d4..eb610a8aaa795d2caeaf2ab12bcf61b1148524b4 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -343,6 +343,12 @@ - true - - -+ -+ 2 -+ true -+ -+ HAS_MVC -+ - - - -diff --git a/system/settings/win32.xml b/system/settings/win32.xml -index 2fcee72a64e8b701c8e895143410bbe9fd617356..a017d30c24232fb01220b87b29398403b8ed9662 100644 ---- a/system/settings/win32.xml -+++ b/system/settings/win32.xml -@@ -12,17 +12,6 @@ - false - -
--
-- -- -- -- 2 -- true -- -- -- -- --
-
- - -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index 74e8e1fc2da66d3c98a5bab04faa2f6bf16539ff..7dd85f0173bd636f4f5ae6e7fc43b3064e2ff822 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -1172,7 +1172,7 @@ bool CDVDInputStreamBluray::ProcessItem(int playitem) - - m_title = m_dll->bd_get_playlist_info(m_bd, playitem, m_angle); - -- if (CSettings::GetInstance().GetBool("videoplayer.supportmvc") && !m_bMVCDisabled) -+ if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC) && !m_bMVCDisabled) - { - MPLS_PL * mpls = m_dll->bd_get_title_mpls(m_bd); - if (mpls) -diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp -index 6b1f2b6d757354d6065c2862b44dfb47184a1dcc..9163ec85bd0feb48a698a025d9870bf40042c675 100644 ---- a/xbmc/settings/SettingConditions.cpp -+++ b/xbmc/settings/SettingConditions.cpp -@@ -327,6 +327,9 @@ void CSettingConditions::Initialize() - m_simpleConditions.insert("has_dx"); - m_simpleConditions.insert("hasdxva2"); - #endif -+#if defined(HAVE_LIBMFX) || defined(TARGET_RASPBERRY_PI) -+ m_simpleConditions.insert("has_mvc"); -+#endif - #ifdef HAVE_LCMS2 - m_simpleConditions.insert("have_lcms2"); - #endif - -From b5a7b94739f0da0c2de4e33a3fff027c412d93f6 Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Fri, 4 Nov 2016 22:56:56 +0300 -Subject: [PATCH 46/62] [VideoPlayer] SSIF: fix for corner case when mvc stream - is switched before the last packet is read from previous stream. - ---- - .../VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 5 ++- - .../VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp | 7 ++-- - .../VideoPlayer/DVDInputStreams/DVDInputStream.h | 1 + - .../DVDInputStreams/DVDInputStreamBluray.cpp | 39 +++++++++++++++++++--- - .../DVDInputStreams/DVDInputStreamBluray.h | 3 ++ - 5 files changed, 45 insertions(+), 10 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 6ea1a19173e36d49f7391b6f350c8ae3173db7ff..9149698884c8ae6a23649abbaa0e659587dfe982 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1120,9 +1120,6 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double *startpts) - m_pkt.result = -1; - av_packet_unref(&m_pkt.pkt); - -- if (m_pSSIF) -- m_pSSIF->Flush(); -- - CDVDInputStream::IPosTime* ist = m_pInput->GetIPosTime(); - if (ist) - { -@@ -1136,6 +1133,8 @@ bool CDVDDemuxFFmpeg::SeekTime(double time, bool backwards, double *startpts) - - return true; - } -+ else if (m_pSSIF) -+ m_pSSIF->Flush(); - - if (!m_pInput->Seek(0, SEEK_POSSIBLE) && - !m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -index 7c8719ce40e725e27b7551250398022a1f1a4fc6..c675e31f731bc6afb8aabc37bbb5495aed45f4f6 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxStreamSSIF.cpp -@@ -183,12 +183,15 @@ bool CDemuxStreamSSIF::FillMVCQueue(double dtsBase) - else if (mvc->dts < dtsBase) - { - #if defined(DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, ">>> MVC discard mvc: %6d, pts(%.3f) dts(%.3f)", mvc->iSize, mvc->pts*1e-6, mvc->dts*1e-6); -+ CLog::Log(LOGDEBUG, ">>> MVC drop mvc: %6d, pts(%.3f) dts(%.3f)", mvc->iSize, mvc->pts*1e-6, mvc->dts*1e-6); - #endif - CDVDDemuxUtils::FreeDemuxPacket(mvc); - continue; - } - AddMVCExtPacket(mvc); - }; -- return m_MVCqueue.size() == MVC_QUEUE_SIZE; -+ if (m_MVCqueue.size() != MVC_QUEUE_SIZE) -+ m_bluRay->OpenNextStream(); -+ -+ return true; - } -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -index 7aee35cef8f42d080882e4bdd20a4a9ed234a8c2..ea138f95bac915a946800f6bc7b964bd928e1a89 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h -@@ -140,6 +140,7 @@ public: - virtual bool AreEyesFlipped() = 0; - virtual CDVDDemux* GetExtentionDemux() = 0; - virtual void DisableExtention() = 0; -+ virtual bool OpenNextStream() = 0; - }; - - enum ENextStream -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -index 7dd85f0173bd636f4f5ae6e7fc43b3064e2ff822..23053d7f8ebf494c7b35bf41bcf9952fa9a5f261 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp -@@ -48,6 +48,7 @@ - #endif - - #define LIBBLURAY_BYTESEEK 0 -+#define EMPTY_QUEUE(x) { while(!x.empty()) x.pop(); } - - using namespace XFILE; - -@@ -432,6 +433,8 @@ bool CDVDInputStreamBluray::Open() - while (m_dll->bd_get_event(m_bd, &m_event)) - ProcessEvent(); - -+ OpenNextStream(); -+ - return true; - } - -@@ -610,10 +613,14 @@ void CDVDInputStreamBluray::ProcessEvent() { - /* event has been consumed */ - m_event.event = BD_EVENT_NONE; - -- if (m_bMVCPlayback && m_clip >= 0 && m_title && m_clip < m_title->clip_count && m_nMVCClip != m_clip) -+ if ( m_bMVCPlayback && m_clip >= 0 -+ && m_title -+ && m_clip < m_title->clip_count -+ && m_nMVCClip != m_clip -+ && (m_clipQueue.empty() -+ || m_clip != m_clipQueue.front())) - { -- CloseMVCDemux(); -- OpenMVCDemux(m_clip); -+ m_clipQueue.push(m_clip); - } - } - -@@ -935,10 +942,15 @@ bool CDVDInputStreamBluray::PosTime(int ms) - if(m_dll->bd_seek_time(m_bd, ms * 90) < 0) - return false; - -+ EMPTY_QUEUE(m_clipQueue); - while (m_dll->bd_get_event(m_bd, &m_event)) - ProcessEvent(); - -- SeekMVCDemux(ms - m_clipStartTime); -+ if (m_bMVCPlayback) -+ { -+ OpenNextStream(); -+ SeekMVCDemux(ms - m_clipStartTime); -+ } - return true; - } - -@@ -963,10 +975,15 @@ bool CDVDInputStreamBluray::SeekChapter(int ch) - if(m_title && m_dll->bd_seek_chapter(m_bd, ch-1) < 0) - return false; - -+ EMPTY_QUEUE(m_clipQueue); - while (m_dll->bd_get_event(m_bd, &m_event)) - ProcessEvent(); - -- SeekMVCDemux(GetChapterPos(ch) * 1000 - m_clipStartTime); -+ if (m_bMVCPlayback) -+ { -+ OpenNextStream(); -+ SeekMVCDemux(GetChapterPos(ch) * 1000 - m_clipStartTime); -+ } - return true; - } - -@@ -1196,6 +1213,18 @@ bool CDVDInputStreamBluray::ProcessItem(int playitem) - return true; - } - -+bool CDVDInputStreamBluray::OpenNextStream() -+{ -+ if (m_clipQueue.empty()) -+ return false; -+ -+ int clip = m_clipQueue.front(); -+ m_clipQueue.pop(); -+ -+ CloseMVCDemux(); -+ return OpenMVCDemux(clip); -+} -+ - bool CDVDInputStreamBluray::OpenMVCDemux(int playItem) - { - MPLS_PL *pl = m_dll->bd_get_title_mpls(m_bd); -diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -index f70657c9e31fb2460d12910c635dba5163282e74..a11ec77903d2a9b2c68106a8e2301af93823b0bd 100644 ---- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.h -@@ -23,6 +23,7 @@ - #include "DVDInputStream.h" - #include - #include -+#include - - extern "C" - { -@@ -125,6 +126,7 @@ public: - bool HasExtention() override { return m_bMVCPlayback; } - bool AreEyesFlipped() override { return m_bFlipEyes; } - void DisableExtention() override; -+ bool OpenNextStream() override; - - protected: - struct SPlane; -@@ -161,6 +163,7 @@ protected: - bool m_bFlipEyes = false; - bool m_bMVCDisabled = false; - uint64_t m_clipStartTime = 0; -+ std::queue m_clipQueue; - - typedef std::shared_ptr SOverlay; - typedef std::list SOverlays; - -From 68303efd88570df113b4e6d4816255f671ff02ef Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Tue, 23 Feb 2016 16:01:08 +0300 -Subject: [PATCH 47/62] [libbluray] bump libbluray to 0.9.2-mvc. - ---- - project/BuildDependencies/scripts/0_package.list | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/project/BuildDependencies/scripts/0_package.list b/project/BuildDependencies/scripts/0_package.list -index e6c608023a46d377ef520bf23e9863ee0350d980..f8db70ab3861835f33f0e4be79cf3d193093a45f 100644 ---- a/project/BuildDependencies/scripts/0_package.list -+++ b/project/BuildDependencies/scripts/0_package.list -@@ -17,7 +17,7 @@ freetype-2.6.3-win32-vc140.7z - giflib-5.1.4-win32-vc140.7z - jsonschemabuilder-1.0.0-win32-3.7z - libass-542975a-win32-vc140.7z --libbluray-0.9.3-win32-vc140.7z -+libbluray-0.9.2-mvc-win32-vc120.7z - libcdio-0.9.3-win32-vc140.7z - libcec-4.0.0-win32-vc140-2.7z - libfribidi-0.19.2-win32.7z - -From 535c34fdcb4be388fa3554b364f3dcaebac7ef19 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 29 Feb 2016 17:00:50 +0000 -Subject: [PATCH 48/62] libbluray: Bump to Nevcairie's v0.9.2 - -This includes 3D support ---- - tools/depends/target/libbluray/Makefile | 1 + - .../libbluray/bump_to_Nevcairie_v0.9.2.patch | 1629 ++++++++++++++++++++ - 2 files changed, 1630 insertions(+) - create mode 100644 tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch - -diff --git a/tools/depends/target/libbluray/Makefile b/tools/depends/target/libbluray/Makefile -index 09d2a8e04ef4ef694f3d7a6152ab9be0e294ce2f..741a820df47fd8014192f6c0c546abb72d33ab1f 100644 ---- a/tools/depends/target/libbluray/Makefile -+++ b/tools/depends/target/libbluray/Makefile -@@ -24,6 +24,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - # libbluray has borked Makefile.am with respect to CFLAGS, remove the offending line - sed -i -e "s|CFLAGS=|#CFLAGS=|" $(PLATFORM)/Makefile.am -+ cd $(PLATFORM); patch -p1 < ../bump_to_Nevcairie_v0.9.2.patch - cd $(PLATFORM); ./bootstrap - cd $(PLATFORM); $(CONFIGURE) - -diff --git a/tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch b/tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..5ef0124e35c9d81143921a328e272220640fb84e ---- /dev/null -+++ b/tools/depends/target/libbluray/bump_to_Nevcairie_v0.9.2.patch -@@ -0,0 +1,1629 @@ -+diff --git a/Makefile.am b/Makefile.am -+index 3a54bfc..035553b 100644 -+--- a/Makefile.am -++++ b/Makefile.am -+@@ -161,6 +161,15 @@ noinst_HEADERS = \ -+ jni/win32/jni_md.h \ -+ jni/darwin/jni_md.h -+ -++ -++bdnavdir=$(pkgincludedir)/bdnav -++bdnav_HEADERS = \ -++ src/libbluray/bdnav/clpi_data.h -++ -++utildir=$(pkgincludedir)/../util -++util_HEADERS = \ -++ src/util/attributes.h -++ -+ pkginclude_HEADERS = \ -+ src/file/filesystem.h \ -+ src/libbluray/bluray.h \ -+@@ -168,6 +177,9 @@ pkginclude_HEADERS = \ -+ src/libbluray/keys.h \ -+ src/libbluray/player_settings.h \ -+ src/libbluray/bdnav/clpi_data.h \ -++ src/libbluray/bdnav/clpi_parse.h \ -++ src/libbluray/bdnav/mpls_parse.h \ -++ src/libbluray/bdnav/uo_mask_table.h \ -+ src/libbluray/bdnav/meta_data.h \ -+ src/libbluray/decoders/overlay.h \ -+ src/util/log_control.h -+diff --git a/config.h b/config.h -+new file mode 100644 -+index 0000000..6764704 -+--- /dev/null -++++ b/config.h -+@@ -0,0 +1,157 @@ -++/* config.h. Generated from config.h.in by configure. */ -++/* config.h.in. Generated from configure.ac by autoheader. */ -++ -++/* Define to 1 if libudfread is to be used for disc image access */ -++/* #undef ENABLE_UDF */ -++ -++/* Define to 1 if using libbluray J2ME stack */ -++/* #undef HAVE_BDJ_J2ME */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. -++ */ -++/* #undef HAVE_DIRENT_H */ -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_DLFCN_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_ERRNO_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_FCNTL_H */ -++ -++/* Define this if you have fontconfig library */ -++/* #undef HAVE_FONTCONFIG */ -++ -++/* Define this if you have FreeType2 library */ -++/* #undef HAVE_FT2 */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_INTTYPES_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_JNI_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_LIBGEN_H 1 -++ -++/* Define to 1 if libxml2 is to be used for metadata parsing */ -++/* #undef HAVE_LIBXML2 */ -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_LINUX_CDROM_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_MALLOC_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_MEMORY_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_MNTENT_H */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. */ -++/* #undef HAVE_NDIR_H */ -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_PTHREAD_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STDARG_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STDINT_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STDLIB_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_STRINGS_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_STRING_H 1 -++ -++/* Define to 1 if `d_type' is a member of `struct dirent'. */ -++/* #undef HAVE_STRUCT_DIRENT_D_TYPE */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. -++ */ -++/* #undef HAVE_SYS_DIR_H */ -++ -++/* Define to 1 if you have the header file, and it defines `DIR'. -++ */ -++/* #undef HAVE_SYS_NDIR_H */ -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_SYS_STAT_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_SYS_TIME_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_SYS_TYPES_H 1 -++ -++/* Define to 1 if you have the header file. */ -++#define HAVE_TIME_H 1 -++ -++/* Define to 1 if you have the header file. */ -++/* #undef HAVE_UNISTD_H */ -++ -++/* "Defines the architecture of the java vm." */ -++/* #undef JAVA_ARCH */ -++ -++/* "" */ -++/* #undef JDK_HOME */ -++ -++/* Define to the sub-directory where libtool stores uninstalled libraries. */ -++#define LT_OBJDIR ".libs/" -++ -++/* Name of package */ -++#define PACKAGE "libbluray" -++ -++/* Define to the address where bug reports for this package should be sent. */ -++#define PACKAGE_BUGREPORT "http://www.videolan.org/developers/libbluray.html" -++ -++/* Define to the full name of this package. */ -++#define PACKAGE_NAME "libbluray" -++ -++/* Define to the full name and version of this package. */ -++#define PACKAGE_STRING "libbluray 0.9.2" -++ -++/* Define to the one symbol short name of this package. */ -++#define PACKAGE_TARNAME "libbluray" -++ -++/* Define to the home page for this package. */ -++#define PACKAGE_URL "" -++ -++/* Define to the version of this package. */ -++#define PACKAGE_VERSION "0.9.2" -++ -++/* Define as the return type of signal handlers (`int' or `void'). */ -++#define RETSIGTYPE void -++ -++/* Define to 1 if you have the ANSI C header files. */ -++#define STDC_HEADERS 1 -++ -++/* "Define to 1 if using BD-Java" */ -++/* #undef USING_BDJAVA */ -++ -++/* Version number of package */ -++#define VERSION "0.9.2" -++ -++/* Enable large inode numbers on Mac OS X 10.5. */ -++#ifndef _DARWIN_USE_64_BIT_INODE -++# define _DARWIN_USE_64_BIT_INODE 1 -++#endif -++ -++/* Number of bits in a file offset, on hosts where this is settable. */ -++#define _FILE_OFFSET_BITS 64 -++ -++/* Define for large files, on AIX-style hosts. */ -++/* #undef _LARGE_FILES */ -++ -++/* Define to '0x0501' for IE 5.01. */ -++#define _WIN32_IE 0x0501 -++ -++/* Define to '0x0502' for Windows XP SP2 APIs. */ -++#define _WIN32_WINNT 0x0502 -+diff --git a/includes/inttypes.h b/includes/inttypes.h -+new file mode 100644 -+index 0000000..ead903f -+--- /dev/null -++++ b/includes/inttypes.h -+@@ -0,0 +1,305 @@ -++// ISO C9x compliant inttypes.h for Microsoft Visual Studio -++// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -++// -++// Copyright (c) 2006 Alexander Chemeris -++// -++// Redistribution and use in source and binary forms, with or without -++// modification, are permitted provided that the following conditions are met: -++// -++// 1. Redistributions of source code must retain the above copyright notice, -++// this list of conditions and the following disclaimer. -++// -++// 2. Redistributions in binary form must reproduce the above copyright -++// notice, this list of conditions and the following disclaimer in the -++// documentation and/or other materials provided with the distribution. -++// -++// 3. The name of the author may be used to endorse or promote products -++// derived from this software without specific prior written permission. -++// -++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -++// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -++// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -++// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -++// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -++// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -++// -++/////////////////////////////////////////////////////////////////////////////// -++ -++#ifndef _MSC_VER // [ -++#error "Use this header only with Microsoft Visual C++ compilers!" -++#endif // _MSC_VER ] -++ -++#ifndef _MSC_INTTYPES_H_ // [ -++#define _MSC_INTTYPES_H_ -++ -++#if _MSC_VER > 1000 -++#pragma once -++#endif -++ -++#include "stdint.h" -++ -++// 7.8 Format conversion of integer types -++ -++typedef struct { -++ intmax_t quot; -++ intmax_t rem; -++} imaxdiv_t; -++ -++// 7.8.1 Macros for format specifiers -++ -++#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 -++ -++// The fprintf macros for signed integers are: -++#define PRId8 "d" -++#define PRIi8 "i" -++#define PRIdLEAST8 "d" -++#define PRIiLEAST8 "i" -++#define PRIdFAST8 "d" -++#define PRIiFAST8 "i" -++ -++#define PRId16 "hd" -++#define PRIi16 "hi" -++#define PRIdLEAST16 "hd" -++#define PRIiLEAST16 "hi" -++#define PRIdFAST16 "hd" -++#define PRIiFAST16 "hi" -++ -++#define PRId32 "I32d" -++#define PRIi32 "I32i" -++#define PRIdLEAST32 "I32d" -++#define PRIiLEAST32 "I32i" -++#define PRIdFAST32 "I32d" -++#define PRIiFAST32 "I32i" -++ -++#define PRId64 "I64d" -++#define PRIi64 "I64i" -++#define PRIdLEAST64 "I64d" -++#define PRIiLEAST64 "I64i" -++#define PRIdFAST64 "I64d" -++#define PRIiFAST64 "I64i" -++ -++#define PRIdMAX "I64d" -++#define PRIiMAX "I64i" -++ -++#define PRIdPTR "Id" -++#define PRIiPTR "Ii" -++ -++// The fprintf macros for unsigned integers are: -++#define PRIo8 "o" -++#define PRIu8 "u" -++#define PRIx8 "x" -++#define PRIX8 "X" -++#define PRIoLEAST8 "o" -++#define PRIuLEAST8 "u" -++#define PRIxLEAST8 "x" -++#define PRIXLEAST8 "X" -++#define PRIoFAST8 "o" -++#define PRIuFAST8 "u" -++#define PRIxFAST8 "x" -++#define PRIXFAST8 "X" -++ -++#define PRIo16 "ho" -++#define PRIu16 "hu" -++#define PRIx16 "hx" -++#define PRIX16 "hX" -++#define PRIoLEAST16 "ho" -++#define PRIuLEAST16 "hu" -++#define PRIxLEAST16 "hx" -++#define PRIXLEAST16 "hX" -++#define PRIoFAST16 "ho" -++#define PRIuFAST16 "hu" -++#define PRIxFAST16 "hx" -++#define PRIXFAST16 "hX" -++ -++#define PRIo32 "I32o" -++#define PRIu32 "I32u" -++#define PRIx32 "I32x" -++#define PRIX32 "I32X" -++#define PRIoLEAST32 "I32o" -++#define PRIuLEAST32 "I32u" -++#define PRIxLEAST32 "I32x" -++#define PRIXLEAST32 "I32X" -++#define PRIoFAST32 "I32o" -++#define PRIuFAST32 "I32u" -++#define PRIxFAST32 "I32x" -++#define PRIXFAST32 "I32X" -++ -++#define PRIo64 "I64o" -++#define PRIu64 "I64u" -++#define PRIx64 "I64x" -++#define PRIX64 "I64X" -++#define PRIoLEAST64 "I64o" -++#define PRIuLEAST64 "I64u" -++#define PRIxLEAST64 "I64x" -++#define PRIXLEAST64 "I64X" -++#define PRIoFAST64 "I64o" -++#define PRIuFAST64 "I64u" -++#define PRIxFAST64 "I64x" -++#define PRIXFAST64 "I64X" -++ -++#define PRIoMAX "I64o" -++#define PRIuMAX "I64u" -++#define PRIxMAX "I64x" -++#define PRIXMAX "I64X" -++ -++#define PRIoPTR "Io" -++#define PRIuPTR "Iu" -++#define PRIxPTR "Ix" -++#define PRIXPTR "IX" -++ -++// The fscanf macros for signed integers are: -++#define SCNd8 "d" -++#define SCNi8 "i" -++#define SCNdLEAST8 "d" -++#define SCNiLEAST8 "i" -++#define SCNdFAST8 "d" -++#define SCNiFAST8 "i" -++ -++#define SCNd16 "hd" -++#define SCNi16 "hi" -++#define SCNdLEAST16 "hd" -++#define SCNiLEAST16 "hi" -++#define SCNdFAST16 "hd" -++#define SCNiFAST16 "hi" -++ -++#define SCNd32 "ld" -++#define SCNi32 "li" -++#define SCNdLEAST32 "ld" -++#define SCNiLEAST32 "li" -++#define SCNdFAST32 "ld" -++#define SCNiFAST32 "li" -++ -++#define SCNd64 "I64d" -++#define SCNi64 "I64i" -++#define SCNdLEAST64 "I64d" -++#define SCNiLEAST64 "I64i" -++#define SCNdFAST64 "I64d" -++#define SCNiFAST64 "I64i" -++ -++#define SCNdMAX "I64d" -++#define SCNiMAX "I64i" -++ -++#ifdef _WIN64 // [ -++# define SCNdPTR "I64d" -++# define SCNiPTR "I64i" -++#else // _WIN64 ][ -++# define SCNdPTR "ld" -++# define SCNiPTR "li" -++#endif // _WIN64 ] -++ -++// The fscanf macros for unsigned integers are: -++#define SCNo8 "o" -++#define SCNu8 "u" -++#define SCNx8 "x" -++#define SCNX8 "X" -++#define SCNoLEAST8 "o" -++#define SCNuLEAST8 "u" -++#define SCNxLEAST8 "x" -++#define SCNXLEAST8 "X" -++#define SCNoFAST8 "o" -++#define SCNuFAST8 "u" -++#define SCNxFAST8 "x" -++#define SCNXFAST8 "X" -++ -++#define SCNo16 "ho" -++#define SCNu16 "hu" -++#define SCNx16 "hx" -++#define SCNX16 "hX" -++#define SCNoLEAST16 "ho" -++#define SCNuLEAST16 "hu" -++#define SCNxLEAST16 "hx" -++#define SCNXLEAST16 "hX" -++#define SCNoFAST16 "ho" -++#define SCNuFAST16 "hu" -++#define SCNxFAST16 "hx" -++#define SCNXFAST16 "hX" -++ -++#define SCNo32 "lo" -++#define SCNu32 "lu" -++#define SCNx32 "lx" -++#define SCNX32 "lX" -++#define SCNoLEAST32 "lo" -++#define SCNuLEAST32 "lu" -++#define SCNxLEAST32 "lx" -++#define SCNXLEAST32 "lX" -++#define SCNoFAST32 "lo" -++#define SCNuFAST32 "lu" -++#define SCNxFAST32 "lx" -++#define SCNXFAST32 "lX" -++ -++#define SCNo64 "I64o" -++#define SCNu64 "I64u" -++#define SCNx64 "I64x" -++#define SCNX64 "I64X" -++#define SCNoLEAST64 "I64o" -++#define SCNuLEAST64 "I64u" -++#define SCNxLEAST64 "I64x" -++#define SCNXLEAST64 "I64X" -++#define SCNoFAST64 "I64o" -++#define SCNuFAST64 "I64u" -++#define SCNxFAST64 "I64x" -++#define SCNXFAST64 "I64X" -++ -++#define SCNoMAX "I64o" -++#define SCNuMAX "I64u" -++#define SCNxMAX "I64x" -++#define SCNXMAX "I64X" -++ -++#ifdef _WIN64 // [ -++# define SCNoPTR "I64o" -++# define SCNuPTR "I64u" -++# define SCNxPTR "I64x" -++# define SCNXPTR "I64X" -++#else // _WIN64 ][ -++# define SCNoPTR "lo" -++# define SCNuPTR "lu" -++# define SCNxPTR "lx" -++# define SCNXPTR "lX" -++#endif // _WIN64 ] -++ -++#endif // __STDC_FORMAT_MACROS ] -++ -++// 7.8.2 Functions for greatest-width integer types -++ -++// 7.8.2.1 The imaxabs function -++#define imaxabs _abs64 -++ -++// 7.8.2.2 The imaxdiv function -++ -++// This is modified version of div() function from Microsoft's div.c found -++// in %MSVC.NET%\crt\src\div.c -++#ifdef STATIC_IMAXDIV // [ -++static -++#else // STATIC_IMAXDIV ][ -++_inline -++#endif // STATIC_IMAXDIV ] -++imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -++{ -++ imaxdiv_t result; -++ -++ result.quot = numer / denom; -++ result.rem = numer % denom; -++ -++ if (numer < 0 && result.rem > 0) { -++ // did division wrong; must fix up -++ ++result.quot; -++ result.rem -= denom; -++ } -++ -++ return result; -++} -++ -++// 7.8.2.3 The strtoimax and strtoumax functions -++#define strtoimax _strtoi64 -++#define strtoumax _strtoui64 -++ -++// 7.8.2.4 The wcstoimax and wcstoumax functions -++#define wcstoimax _wcstoi64 -++#define wcstoumax _wcstoui64 -++ -++ -++#endif // _MSC_INTTYPES_H_ ] -+diff --git a/libbluray.def b/libbluray.def -+new file mode 100644 -+index 0000000..d4c93cb -+--- /dev/null -++++ b/libbluray.def -+@@ -0,0 +1,63 @@ -++; libbluray.def ; declares the exports -++ -++LIBRARY "libbluray.dll" -++ -++EXPORTS -++ ; bluray.h -++ bd_get_version -++ bd_get_titles -++ bd_get_title_info -++ bd_get_playlist_info -++ bd_free_title_info -++ bd_open -++ bd_close -++ bd_seek -++ bd_seek_time -++ bd_find_seek_point -++ bd_read -++ bd_read_skip_still -++ bd_seek_chapter -++ bd_chapter_pos -++ bd_get_current_chapter -++ bd_seek_mark -++ bd_seek_playitem -++ bd_select_playlist -++ bd_select_title -++ bd_select_angle -++ bd_seamless_angle_change -++ bd_get_title_size -++ bd_get_current_title -++ bd_get_current_angle -++ bd_tell -++ bd_tell_time -++ bd_get_disc_info -++ bd_set_player_setting -++ bd_set_player_setting_str -++ bd_start_bdj -++ bd_stop_bdj -++ bd_get_event -++ bd_play -++ bd_read_ext -++ bd_play_title -++ bd_menu_call -++ bd_register_overlay_proc -++ bd_register_argb_overlay_proc -++ bd_set_scr -++ bd_user_input -++ bd_mouse_select -++ bd_get_sound_effect -++ bd_get_meta -++ bd_get_clpi -++ bd_read_clpi -++ bd_free_clpi -++ bd_read_mpls -++ bd_free_mpls -++ bd_read_mobj -++ bd_free_mobj -++ bd_get_clip_infos -++ bd_get_title_mpls -++ -++ ; additional functions -++ bd_set_debug_handler -++ bd_set_debug_mask -++ bd_get_debug_mask -+diff --git a/libbluray.vcxproj b/libbluray.vcxproj -+new file mode 100644 -+index 0000000..c778955 -+--- /dev/null -++++ b/libbluray.vcxproj -+@@ -0,0 +1,231 @@ -++ -++ -++ -++ -++ DebugRelease -++ Win32 -++ -++ -++ DebugRelease -++ x64 -++ -++ -++ Debug -++ Win32 -++ -++ -++ Debug -++ x64 -++ -++ -++ Release -++ Win32 -++ -++ -++ Release -++ x64 -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ {E1DA1B95-71F1-4C21-A271-121176925062} -++ Win32Proj -++ libbluray -++ -++ -++ -++ v110_xp -++ -++ -++ v120_xp -++ -++ -++ v140_xp -++ -++ -++ DynamicLibrary -++ true -++ Unicode -++ -++ -++ DynamicLibrary -++ false -++ true -++ Unicode -++ -++ -++ -++ -++ -++ -++ -++ -++ -++ true -++ $(SolutionDir)bin_$(PlatformName)d\ -++ $(SolutionDir)bin_$(PlatformName)d\$(ProjectName)\ -++ -++ -++ false -++ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ -++ $(SolutionDir)bin_$(PlatformName)\$(ProjectName)\ -++ -++ -++ -++ -++ -++ Level3 -++ Disabled -++ HAVE_CONFIG_H;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -++ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) -++ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) -++ MultiThreadedDebugDLL -++ CompileAsCpp -++ -++ -++ Windows -++ true -++ libbluray.def -++ -++ -++ xcopy /I /Y "$(OutDir)$(TargetName).lib" "$(OutDir)lib\" -++ Copy .lib into library path -++ -++ -++ -++ -++ MultiThreadedDebug -++ -++ -++ -++ -++ Level3 -++ MaxSpeed -++ true -++ true -++ HAVE_CONFIG_H;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBBLURAY_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -++ __STDC_FORMAT_MACROS;%(PreprocessorDefinitions) -++ $(ProjectDir);$(ProjectDir)includes;$(ProjectDir)src;$(ProjectDir)src\libbluray;%(AdditionalIncludeDirectories) -++ MultiThreaded -++ StreamingSIMDExtensions -++ CompileAsCpp -++ -++ -++ Windows -++ true -++ true -++ true -++ libbluray.def -++ true -++ -++ -++ xcopy /I /Y "$(TargetDir)$(TargetName)$(TargetExt)" "$(OutDir)..\" -++xcopy /I /Y "$(TargetDir)$(TargetName).lib" "$(OutDir)..\lib\" -++ Copy .dll/.lib into library path -++ -++ -++ -++ -++ -++ -+\ No newline at end of file -+diff --git a/libbluray.vcxproj.filters b/libbluray.vcxproj.filters -+new file mode 100644 -+index 0000000..57ff16c -+--- /dev/null -++++ b/libbluray.vcxproj.filters -+@@ -0,0 +1,353 @@ -++ -++ -++ -++ -++ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} -++ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx -++ -++ -++ {93995380-89BD-4b04-88EB-625FBE52EBFB} -++ h;hpp;hxx;hm;inl;inc;xsd -++ -++ -++ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} -++ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms -++ -++ -++ {1ab0e905-7c04-4090-b385-6363dd1c961c} -++ -++ -++ {b8fa3348-a089-461f-9ef5-3d9df997b8e5} -++ -++ -++ {125333e9-0b5e-45f9-a444-f0aaaf547d9b} -++ -++ -++ {a743058f-f07a-4d0f-bab6-02dc57defda9} -++ -++ -++ {7dacc7c4-ef59-452b-9e5b-392c9df07c98} -++ -++ -++ {c7895c81-c186-4d5e-a8ff-645c6d55a731} -++ -++ -++ {c8619466-211b-4c85-9d30-d1b1a822d32e} -++ -++ -++ {8afb6919-994f-4d1f-9638-ce4a06d0b473} -++ -++ -++ {0e9086a7-eebf-4b8e-a4fe-b1724d148877} -++ -++ -++ {fc5e776b-0f32-493a-b823-240288288502} -++ -++ -++ {96d2d786-cd45-4856-937d-9e6f85ced241} -++ -++ -++ {9f4ea4ae-217a-4d97-a5f3-e561ce1e49cd} -++ -++ -++ {09e1b1b8-3aa3-4918-b157-3dfc0554ccbb} -++ -++ -++ {1e02e503-752e-4765-9dfb-8cc67a7b79f8} -++ -++ -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\file -++ -++ -++ Header Files\file -++ -++ -++ Header Files\file -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\hdmv -++ -++ -++ Header Files\libbluray\hdmv -++ -++ -++ Header Files\libbluray\hdmv -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\bdnav -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\util -++ -++ -++ Header Files\util -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\libbluray\decoders -++ -++ -++ Header Files\file -++ -++ -++ Header Files\libbluray -++ -++ -++ Header Files\util -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\libbluray\disc -++ -++ -++ Header Files\file -++ -++ -++ -++ -++ Source Files\util -++ -++ -++ Source Files\util -++ -++ -++ Source Files\file -++ -++ -++ Source Files\libbluray -++ -++ -++ Source Files\libbluray -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\hdmv -++ -++ -++ Source Files\libbluray\hdmv -++ -++ -++ Source Files\libbluray\hdmv -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\libbluray\bdnav -++ -++ -++ Source Files\util -++ -++ -++ Source Files\file -++ -++ -++ Source Files\file -++ -++ -++ Source Files\file -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\util -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\libbluray\decoders -++ -++ -++ Source Files\file -++ -++ -++ Source Files\file -++ -++ -++ Source Files\util -++ -++ -++ Source Files\util -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\libbluray\disc -++ -++ -++ Source Files\util -++ -++ -++ Source Files\file -++ -++ -++ -++ -++ Source Files -++ -++ -++ -+\ No newline at end of file -+diff --git a/src/file/dir_win32.c b/src/file/dir_win32.c -+index 2690658..f42114d 100644 -+--- a/src/file/dir_win32.c -++++ b/src/file/dir_win32.c -+@@ -86,8 +86,8 @@ static BD_DIR_H *_dir_open_win32(const char* dirname) -+ -+ dir->internal = priv; -+ -+- wchar_t wfilespec[MAX_PATH]; -+- if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, MAX_PATH)) -++ wchar_t wfilespec[4096 + 1] = {0}; -++ if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filespec, -1, wfilespec, 4096)) -+ priv->handle = _wfindfirst(wfilespec, &priv->info); -+ else -+ priv->handle = -1; -+diff --git a/src/file/dirs_win32.c b/src/file/dirs_win32.c -+index e165fea..3d07251 100644 -+--- a/src/file/dirs_win32.c -++++ b/src/file/dirs_win32.c -+@@ -36,7 +36,7 @@ -+ -+ char *win32_get_font_dir(const char *font_file) -+ { -+- wchar_t wdir[MAX_PATH]; -++ wchar_t wdir[MAX_PATH+1] = {0}; -+ if (S_OK != SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir)) { -+ int lenght = GetWindowsDirectoryW(wdir, MAX_PATH); -+ if (lenght == 0 || lenght > (MAX_PATH - 8)) { -+@@ -67,7 +67,7 @@ char *file_get_config_home(void) -+ -+ char *file_get_data_home(void) -+ { -+- wchar_t wdir[MAX_PATH]; -++ wchar_t wdir[MAX_PATH+1] = {0}; -+ -+ /* Get the "Application Data" folder for the user */ -+ if (S_OK == SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, -+@@ -92,7 +92,7 @@ char *file_get_cache_home(void) -+ const char *file_get_config_system(const char *dir) -+ { -+ static char *appdir = NULL; -+- wchar_t wdir[MAX_PATH]; -++ wchar_t wdir[MAX_PATH+1] = {0}; -+ -+ if (!dir) { -+ // first call -+diff --git a/src/file/dl_win32.c b/src/file/dl_win32.c -+index e4492e1..7f6ae73 100644 -+--- a/src/file/dl_win32.c -++++ b/src/file/dl_win32.c -+@@ -57,7 +57,7 @@ void *dl_dlopen(const char *path, const char *version) -+ { -+ (void)version; -+ -+- wchar_t wname[MAX_PATH]; -++ wchar_t wname[MAX_PATH+1] = {0}; -+ char *name; -+ void *result; -+ -+@@ -109,7 +109,7 @@ const char *dl_get_path(void) -+ if (!initialized) { -+ initialized = 1; -+ -+- static char path[MAX_PATH]; -++ static char path[MAX_PATH + 1]; -+ HMODULE hModule; -+ wchar_t wpath[MAX_PATH]; -+ -+diff --git a/src/file/file_win32.c b/src/file/file_win32.c -+index d9845fb..b4fb7ad 100644 -+--- a/src/file/file_win32.c -++++ b/src/file/file_win32.c -+@@ -107,9 +107,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) -+ { -+ BD_FILE_H *file; -+ FILE *fp; -+- wchar_t wfilename[MAX_PATH], wmode[8]; -++ wchar_t wfilename[4096 + 1] = {0}, wmode[8] = {0}; -+ -+- if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, MAX_PATH) || -++ if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, -1, wfilename, 4096) || -+ !MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mode, -1, wmode, 8)) { -+ -+ BD_DEBUG(DBG_FILE, "Error opening file %s\n", filename); -+@@ -122,6 +122,9 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode) -+ return NULL; -+ } -+ -++ // Set file buffer -++ setvbuf(fp, NULL, _IOFBF, 6144 * 10); -++ -+ file = calloc(1, sizeof(BD_FILE_H)); -+ if (!file) { -+ BD_DEBUG(DBG_FILE | DBG_CRIT, "Error opening file %s (out of memory)\n", filename); -+diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c -+index 394347e..39bbcef 100644 -+--- a/src/libbluray/bdnav/clpi_parse.c -++++ b/src/libbluray/bdnav/clpi_parse.c -+@@ -39,6 +39,7 @@ -+ #define CLPI_SIG1 ('H' << 24 | 'D' << 16 | 'M' << 8 | 'V') -+ #define CLPI_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0') -+ #define CLPI_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0') -++#define CLPI_SIG2C ('0' << 24 | '2' << 16 | '4' << 8 | '0') -+ -+ static void -+ _human_readable_sig(char *sig, uint32_t s1, uint32_t s2) -+@@ -129,7 +130,8 @@ _parse_header(BITSTREAM *bits, CLPI_CL *cl) -+ cl->type_indicator2 = bs_read(bits, 32); -+ if (cl->type_indicator != CLPI_SIG1 || -+ (cl->type_indicator2 != CLPI_SIG2A && -+- cl->type_indicator2 != CLPI_SIG2B)) { -++ cl->type_indicator2 != CLPI_SIG2B && -++ cl->type_indicator2 != CLPI_SIG2C)) { -+ -+ char sig[9]; -+ char expect[9]; -+diff --git a/src/libbluray/bdnav/mpls_parse.c b/src/libbluray/bdnav/mpls_parse.c -+index e196118..87b240a 100644 -+--- a/src/libbluray/bdnav/mpls_parse.c -++++ b/src/libbluray/bdnav/mpls_parse.c -+@@ -39,6 +39,7 @@ -+ #define MPLS_SIG1 ('M' << 24 | 'P' << 16 | 'L' << 8 | 'S') -+ #define MPLS_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0') -+ #define MPLS_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0') -++#define MPLS_SIG2C ('0' << 24 | '2' << 16 | '4' << 8 | '0') -+ -+ static void -+ _human_readable_sig(char *sig, uint32_t s1, uint32_t s2) -+@@ -137,8 +138,9 @@ _parse_appinfo(BITSTREAM *bits, MPLS_AI *ai) -+ ai->random_access_flag = bs_read(bits, 1); -+ ai->audio_mix_flag = bs_read(bits, 1); -+ ai->lossless_bypass_flag = bs_read(bits, 1); -++ ai->mvc_base_view_r_flag = bs_read(bits, 1); -+ // Reserved -+- bs_skip(bits, 13); -++ bs_skip(bits, 12); -+ bs_seek_byte(bits, pos + len); -+ return 1; -+ } -+@@ -155,7 +157,8 @@ _parse_header(BITSTREAM *bits, MPLS_PL *pl) -+ pl->type_indicator2 = bs_read(bits, 32); -+ if (pl->type_indicator != MPLS_SIG1 || -+ (pl->type_indicator2 != MPLS_SIG2A && -+- pl->type_indicator2 != MPLS_SIG2B)) { -++ pl->type_indicator2 != MPLS_SIG2B && -++ pl->type_indicator2 != MPLS_SIG2C)) { -+ -+ char sig[9]; -+ char expect[9]; -+@@ -259,6 +262,7 @@ _parse_stream(BITSTREAM *bits, MPLS_STREAM *s) -+ break; -+ }; -+ s->lang[3] = '\0'; -++ s->ss_offset_sequence_id = 0xFF; -+ -+ bs_seek_byte(bits, pos + len); -+ return 1; -+@@ -882,6 +886,99 @@ _parse_subpath_extension(BITSTREAM *bits, MPLS_PL *pl) -+ } -+ -+ static int -++_parse_stn_ss_extension(BITSTREAM *bits, MPLS_PL *pl) -++{ -++ int ii, s; -++ int64_t pos; -++ -++ for (ii = 0; ii < pl->list_count; ii++) { -++ uint32_t len = bs_read(bits, 16); -++ pos = bs_pos(bits) >> 3; -++ int Fixed_offset_during_PopUp_flag = bs_read(bits, 1); -++ bs_skip(bits, 15); // reserved -++ -++ for (s = 0; s < pl->play_item[ii].stn.num_video; s++) { -++ // stream_entry -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ // stream_attributes_ss -++ slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 10); // reserved -++ bs_skip(bits, 6); // number_of_offset_sequences -++ } -++ -++ for (s = 0; s < pl->play_item[ii].stn.num_pg; s++) { -++ pl->play_item[ii].stn.pg[s].ss_offset_sequence_id = bs_read(bits, 8); -++ -++ bs_skip(bits, 4); // reserved -++ bs_skip(bits, 1); // dialog_region_offset_valid_flag -++ int is_SS_PG = bs_read(bits, 1); -++ int is_top_AS_PG_textST = bs_read(bits, 1); -++ int is_bottom_AS_PG_textST = bs_read(bits, 1); -++ if (is_SS_PG) { -++ // stream_entry left eye -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ // stream_entry right eye -++ slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ if (is_top_AS_PG_textST) { -++ // stream_entry -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ if (is_bottom_AS_PG_textST) { -++ // stream_entry -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ } -++ -++ for (s = 0; s < pl->play_item[ii].stn.num_ig; s++) { -++ if (Fixed_offset_during_PopUp_flag) -++ bs_skip(bits, 8); -++ else -++ pl->play_item[ii].stn.ig[s].ss_offset_sequence_id = bs_read(bits, 8); -++ -++ bs_skip(bits, 16); // IG_Plane_offset_during_BB_video -++ bs_skip(bits, 7); // reserved -++ int is_SS_IG = bs_read(bits, 1); -++ if (is_SS_IG) { -++ // stream_entry left eye -++ uint32_t slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ // stream_entry right eye -++ slen = bs_read(bits, 8); -++ bs_skip(bits, slen * 8); -++ -++ bs_skip(bits, 8); // reserved -++ bs_skip(bits, 8); // PG offset -++ } -++ } -++ -++ // Skip to next play item -++ bs_seek_byte(bits, pos + len); -++ } -++ -++ return 0; -++} -++ -++static int -+ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) -+ { -+ MPLS_PL *pl = (MPLS_PL*)handle; -+@@ -895,7 +992,7 @@ _parse_mpls_extension(BITSTREAM *bits, int id1, int id2, void *handle) -+ -+ if (id1 == 2) { -+ if (id2 == 1) { -+- return 0; -++ return _parse_stn_ss_extension(bits, pl); -+ } -+ if (id2 == 2) { -+ // SubPath entries extension -+diff --git a/src/libbluray/bdnav/mpls_parse.h b/src/libbluray/bdnav/mpls_parse.h -+index 94bfa67..c1b2c31 100644 -+--- a/src/libbluray/bdnav/mpls_parse.h -++++ b/src/libbluray/bdnav/mpls_parse.h -+@@ -49,6 +49,7 @@ typedef struct -+ uint8_t sv_num_pip_pg_ref; -+ uint8_t *sv_secondary_audio_ref; -+ uint8_t *sv_pip_pg_ref; -++ uint8_t ss_offset_sequence_id; -+ } MPLS_STREAM; -+ -+ typedef struct -+@@ -109,6 +110,7 @@ typedef struct -+ uint8_t random_access_flag; -+ uint8_t audio_mix_flag; -+ uint8_t lossless_bypass_flag; -++ uint8_t mvc_base_view_r_flag; -+ } MPLS_AI; -+ -+ typedef struct -+diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c -+index 0e60b68..f633d7a 100644 -+--- a/src/libbluray/bluray.c -++++ b/src/libbluray/bluray.c -+@@ -1626,6 +1626,25 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick) -+ return bd->s_pos; -+ } -+ -++int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick) -++{ -++ uint32_t clip_pkt, out_pkt; -++ NAV_CLIP *clip; -++ -++ tick /= 2; -++ -++ if (bd->title && -++ tick < bd->title->duration) { -++ -++ // Find the closest access unit to the requested position -++ clip = nav_time_search(bd->title, (uint32_t)tick, &clip_pkt, &out_pkt); -++ -++ return (int64_t)out_pkt * 192; -++ } -++ -++ return bd->s_pos; -++} -++ -+ uint64_t bd_tell_time(BLURAY *bd) -+ { -+ uint32_t clip_pkt = 0, out_pkt = 0, out_time = 0; -+@@ -2602,6 +2621,7 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, -+ BLURAY_CLIP_INFO *ci = &title_info->clips[ii]; -+ NAV_CLIP *nc = &title->clip_list.clip[ii]; -+ -++ ci->idx = nc->clip_id; -+ ci->pkt_count = nc->end_pkt - nc->start_pkt; -+ ci->start_time = (uint64_t)nc->title_time * 2; -+ ci->in_time = (uint64_t)pi->in_time * 2; -+@@ -2628,6 +2648,8 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, -+ _copy_streams(nc, ci->sec_audio_streams, pi->stn.secondary_audio, ci->sec_audio_stream_count); -+ } -+ -++ title_info->mvc_base_view_r_flag = title->pl->app_info.mvc_base_view_r_flag; -++ -+ return title_info; -+ } -+ -+@@ -3746,3 +3768,28 @@ void bd_free_bdjo(struct bdjo_data *obj) -+ (void)obj; -+ #endif -+ } -++ -++int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration) -++{ -++ if (bd && bd->title && bd->title->clip_list.count > clip) { -++ if (clip_start_time) -++ *clip_start_time = (uint64_t)bd->title->clip_list.clip[clip].title_time << 1; -++ if (stream_start_time) -++ *stream_start_time = (uint64_t)bd->title->clip_list.clip[clip].in_time << 1; -++ if (pos) -++ *pos = (uint64_t)bd->title->clip_list.clip[clip].title_pkt * 192; -++ if (duration) -++ *duration = (uint64_t)bd->title->clip_list.clip[clip].duration << 1; -++ -++ return 1; -++ } -++ return 0; -++} -++ -++struct mpls_pl* bd_get_title_mpls(BLURAY * bd) -++{ -++ if (bd && bd->title) { -++ return bd->title->pl; -++ } -++ return NULL; -++} -+diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h -+index cbf16fc..97dc1a3 100644 -+--- a/src/libbluray/bluray.h -++++ b/src/libbluray/bluray.h -+@@ -32,6 +32,7 @@ extern "C" { -+ */ -+ -+ #include -++#include "bdnav/clpi_data.h" -+ -+ #define TITLES_ALL 0 /**< all titles. */ -+ #define TITLES_FILTER_DUP_TITLE 0x01 /**< remove duplicate titles. */ -+@@ -225,6 +226,7 @@ typedef struct bd_stream_info { -+ } BLURAY_STREAM_INFO; -+ -+ typedef struct bd_clip { -++ uint32_t idx; -+ uint32_t pkt_count; -+ uint8_t still_mode; -+ uint16_t still_time; /* seconds */ -+@@ -275,6 +277,8 @@ typedef struct bd_title_info { -+ -+ uint32_t mark_count; -+ BLURAY_TITLE_MARK *marks; -++ -++ uint8_t mvc_base_view_r_flag; -+ } BLURAY_TITLE_INFO; -+ -+ /* -+@@ -483,6 +487,16 @@ uint32_t bd_get_current_title(BLURAY *bd); -+ -+ /** -+ * -++ * Find the byte position to specific time in 90Khz ticks -++ * -++ * @param bd BLURAY ojbect -++ * @param tick tick count -++ * @return byte position -++ */ -++int64_t bd_find_seek_point(BLURAY *bd, uint64_t tick); -++ -++/** -++ * -+ * Read from currently selected title file, decrypt if possible -+ * -+ * @param bd BLURAY object -+@@ -1007,7 +1021,6 @@ int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y); -+ -+ /* access to internal information */ -+ -+-struct clpi_cl; -+ /** -+ * -+ * Get copy of clip information for requested playitem. -+@@ -1060,6 +1073,28 @@ void bd_stop_bdj(BLURAY *bd); // shutdown BD-J and clean up resources -+ */ -+ int bd_read_file(BLURAY *, const char *path, void **data, int64_t *size); -+ -++/** -++ * -++ * Get information about the clip -++ * -++ * @param bd BLURAY object -++ * @param clip clip index -++ * @param clip_start_time start of the clip (in the total title) (in 90khz) -++ * @param stream_start_time first pts in the clip (in 90khz) -++ * @param byte position of the clip (absolute) -++ * @param duration duration of the clip (in 90khz) -++ */ -++int bd_get_clip_infos(BLURAY *bd, unsigned clip, uint64_t *clip_start_time, uint64_t *stream_start_time, uint64_t *pos, uint64_t *duration); -++ -++/** -++ * Get the MPLS struct of the current title -++ * -++ * @param bd BLURAY object -++ * @return the MPLS struct -++ * -++ * Lifetime of the MPLS pointer is limited to the lifetime of the BD title -++ */ -++struct mpls_pl* bd_get_title_mpls(BLURAY * bd); -+ -+ #ifdef __cplusplus -+ } -+diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c -+index defa084..375e6c3 100644 -+--- a/src/libbluray/disc/disc.c -++++ b/src/libbluray/disc/disc.c -+@@ -69,7 +69,7 @@ static BD_FILE_H *_bdrom_open_path(void *p, const char *rel_path) -+ return NULL; -+ } -+ -+- fp = file_open(abs_path, "rb"); -++ fp = file_open(abs_path, "rbS"); -+ X_FREE(abs_path); -+ -+ return fp; - -From 10e05003e7721f2e77e20c286b1849c22ef1e5f6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 6 Mar 2016 12:54:59 +0000 -Subject: [PATCH 49/62] mvc: Automatically enable stereo mode - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 6 +++++- - xbmc/cores/omxplayer/OMXVideo.cpp | 6 +++++- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index c43952d4d29b42f3a5c7605573294568f79ca010..68459e35bc2cda048c150c7079fb30eb0ffb823c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -403,13 +403,17 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - switch (hints.codec) - { - case AV_CODEC_ID_H264: -+ case AV_CODEC_ID_H264_MVC: - // H.264 - m_codingType = MMAL_ENCODING_H264; - m_pFormatName = "mmal-h264"; -- if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) -+ if ((hints.codec_tag == MKTAG('M', 'V', 'C', '1') || hints.codec_tag == MKTAG('A', 'M', 'V', 'C')) && -+ CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) - { - m_codingType = MMAL_ENCODING_MVC; - m_pFormatName= "mmal-mvc"; -+ if (hints.stereo_mode == "mono") -+ hints.stereo_mode = "mvc_lr"; - } - break; - case AV_CODEC_ID_H263: -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 311dd6689236d660919c4c4483c51dca2752514a..536332c43e22ccb229e72b88518e54dd8a23ac41 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -398,6 +398,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool hdmi_clock_syn - switch (hints.codec) - { - case AV_CODEC_ID_H264: -+ case AV_CODEC_ID_H264_MVC: - { - switch(hints.profile) - { -@@ -434,10 +435,13 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool hdmi_clock_syn - break; - } - } -- if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) -+ if ((hints.codec_tag == MKTAG('M', 'V', 'C', '1') || hints.codec_tag == MKTAG('A', 'M', 'V', 'C')) && -+ CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) - { - m_codingType = OMX_VIDEO_CodingMVC; - m_video_codec_name = "omx-mvc"; -+ if (hints.stereo_mode == "mono") -+ hints.stereo_mode = "mvc_lr"; - } - break; - case AV_CODEC_ID_MPEG4: - -From 1707fe3577c485f641a9b44974bdd72658f2ba05 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 24 Mar 2016 13:02:58 +0000 -Subject: [PATCH 50/62] ffmpeg: mvc: fix for pixelation from packets with no - pts/dts - ---- - .../73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch | 24 ++++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 4 +++- - 2 files changed, 27 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch - -diff --git a/tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch b/tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..5240cf58ce40c28d12354db63b7e29143ba46978 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch -@@ -0,0 +1,24 @@ -+From 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105 Mon Sep 17 00:00:00 2001 -+From: Hendrik Leppkes -+Date: Mon, 1 Sep 2014 11:39:09 +0200 -+Subject: [PATCH] h264_parser: force grabing a new timestamp until a frame -+ start was found -+ -+--- -+ libavcodec/h264_parser.c | 3 +++ -+ 1 file changed, 3 insertions(+) -+ -+diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c -+index 2fd3f2b..7165652 100644 -+--- a/libavcodec/h264_parser.c -++++ b/libavcodec/h264_parser.c -+@@ -525,6 +525,9 @@ static int h264_parse(AVCodecParserContext *s, -+ } else { -+ next = h264_find_frame_end(p, buf, buf_size); -+ -++ if (next == END_NOT_FOUND && pc->frame_start_found == 0) -++ s->fetch_timestamp = 1; -++ -+ if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { -+ *poutbuf = NULL; -+ *poutbuf_size = 0; -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 7e97e4d91a443d46d933df528763422ff5e8f4fa..d4f279fd4f2ceb260698cd6fedb124bae61018d0 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -6,7 +6,8 @@ DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - pfcd_hevc_optimisations.patch \ - 0001-Squashed-commit-of-the-following.patch \ - 0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch 0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch \ -- h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -+ h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch \ -+ 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -95,6 +96,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../0001-avcodec-add-h264_mvc-codec-id-and-profiles.patch - cd $(PLATFORM); patch -p1 < ../0001-h264_parser-add-support-for-parsing-h264-mvc-NALUs.patch - cd $(PLATFORM); patch -p1 < ../h264_parser_fix_parsing_of_mvc_slices_in_some_corner_cases.patch -+ cd $(PLATFORM); patch -p1 < ../73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105.patch - - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - -From 0043ac6433c7b39bbf2eb1da01b83ffc491faf07 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 11 Nov 2016 15:53:53 +0000 -Subject: [PATCH 51/62] stereoscopicmanager: fixups for rbp - ---- - xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp | 61 ++++++++++++++++++++++ - xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h | 4 ++ - .../VideoPlayer/DVDCodecs/Video/MMALCodec.cpp | 9 +++- - xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h | 1 + - xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in | 2 +- - xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 5 ++ - xbmc/cores/omxplayer/OMXPlayerVideo.h | 1 + - xbmc/cores/omxplayer/OMXVideo.cpp | 2 +- - xbmc/guilib/StereoscopicsManager.cpp | 3 ++ - 9 files changed, 84 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp -index ac4e063460a39888a1a1113aab37b74cbf0a0766..0d88acfb85333e88b3774144499eb4421abc4566 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.cpp -@@ -24,6 +24,7 @@ - #include "utils/log.h" - #include "cores/FFmpeg.h" - #include "Util.h" -+#include - - #ifdef TARGET_WINDOWS - #pragma comment(lib, "avcodec.lib") -@@ -37,6 +38,7 @@ - - extern "C" { - #include "libswscale/swscale.h" -+#include "libavutil/intreadwrite.h" - } - - // allocate a new picture (AV_PIX_FMT_YUV420P) -@@ -402,6 +404,65 @@ double CDVDCodecUtils::NormalizeFrameduration(double frameduration, bool *match) - } - } - -+bool CDVDCodecUtils::IsH264AnnexB(std::string format, AVStream *avstream) -+{ -+ assert(avstream->codec->codec_id == AV_CODEC_ID_H264 || avstream->codec->codec_id == AV_CODEC_ID_H264_MVC); -+ if (avstream->codec->extradata_size < 4) -+ return true; -+ if (avstream->codec->extradata[0] == 1) -+ return false; -+ if (format == "avi") -+ { -+ BYTE *src = avstream->codec->extradata; -+ unsigned startcode = AV_RB32(src); -+ if (startcode == 0x00000001 || (startcode & 0xffffff00) == 0x00000100) -+ return true; -+ if (avstream->codec->codec_tag == MKTAG('A', 'V', 'C', '1') || avstream->codec->codec_tag == MKTAG('a', 'v', 'c', '1')) -+ return false; -+ } -+ return true; -+} -+ -+bool CDVDCodecUtils::ProcessH264MVCExtradata(uint8_t *data, int data_size, uint8_t **mvc_data, int *mvc_data_size) -+{ -+ uint8_t* extradata = data; -+ int extradata_size = data_size; -+ -+ if (extradata_size > 4 && *(char *)extradata == 1) -+ { -+ // Find "mvcC" atom -+ uint32_t state = -1; -+ int i = 0; -+ for (; i < extradata_size; i++) -+ { -+ state = (state << 8) | extradata[i]; -+ if (state == MKBETAG('m', 'v', 'c', 'C')) -+ break; -+ } -+ if (i >= 8 && i < extradata_size) -+ { -+ // Update pointers to the start of the mvcC atom -+ extradata = extradata + i - 7; -+ extradata_size = extradata_size - i + 7; -+ // verify size atom and actual size -+ if (extradata_size >= 14 && (AV_RB32(extradata) + 4) <= extradata_size) -+ { -+ extradata += 8; -+ extradata_size -= 8; -+ if (*(char *)extradata == 1) -+ { -+ if (mvc_data) -+ *mvc_data = extradata; -+ if (mvc_data_size) -+ *mvc_data_size = extradata_size; -+ return true; -+ } -+ } -+ } -+ } -+ return false; -+} -+ - struct EFormatMap { - AVPixelFormat pix_fmt; - ERenderFormat format; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h -index 361c96623660305fc393273b1eaea4db096c417d..8ec50bbf79e9e163ccae25e30f3a40bfbb0d3450 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDCodecUtils.h -@@ -28,6 +28,7 @@ extern "C" { - } - - struct YV12Image; -+class AVStream; - - class CDVDCodecUtils - { -@@ -46,6 +47,9 @@ public: - - static double NormalizeFrameduration(double frameduration, bool *match = NULL); - -+ static bool IsH264AnnexB(std::string format, AVStream *avstream); -+ static bool ProcessH264MVCExtradata(uint8_t *extradata, int extradata_size, uint8_t **mvc_extradata = nullptr, int *mvc_extradata_size = nullptr); -+ - static ERenderFormat EFormatFromPixfmt(int fmt); - static AVPixelFormat PixfmtFromEFormat(ERenderFormat format); - }; -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -index 68459e35bc2cda048c150c7079fb30eb0ffb823c..dca872373080156100618d58d9782e2461fa2648 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp -@@ -362,6 +362,11 @@ bool CMMALVideo::SendCodecConfigData() - return true; - } - -+bool CMMALVideo::SupportsExtention() -+{ -+ return CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC); -+} -+ - bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - { - CSingleLock lock(m_sharedSection); -@@ -408,12 +413,12 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) - m_codingType = MMAL_ENCODING_H264; - m_pFormatName = "mmal-h264"; - if ((hints.codec_tag == MKTAG('M', 'V', 'C', '1') || hints.codec_tag == MKTAG('A', 'M', 'V', 'C')) && -- CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC)) -+ SupportsExtention()) - { - m_codingType = MMAL_ENCODING_MVC; - m_pFormatName= "mmal-mvc"; - if (hints.stereo_mode == "mono") -- hints.stereo_mode = "mvc_lr"; -+ hints.stereo_mode = "block_lr"; - } - break; - case AV_CODEC_ID_H263: -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h -index baff1f031149da5d669536711cc0057b2db078e3..1e49f09574c2a93b938d5eb405ebcb06543dec01 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h -@@ -104,6 +104,7 @@ public: - virtual bool GetCodecStats(double &pts, int &droppedPics); - virtual void SetCodecControl(int flags); - virtual void SetSpeed(int iSpeed); -+ virtual bool SupportsExtention(); - - // MMAL decoder callback routines. - void dec_output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer); -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -index 0359426b85683a4c3a80ef0e0d52f7a79564daaa..7d19ec3c56fdea514628d27cf36e641707be030f 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile.in -@@ -11,7 +11,7 @@ SRCS += DVDDemuxVobsub.cpp - SRCS += DVDDemuxCC.cpp - SRCS += DVDFactoryDemuxer.cpp - SRCS += DemuxStreamSSIF.cpp --SRCS += DVDDemuxMVC.cpp -+SRCS += DemuxMVC.cpp - - LIB = DVDDemuxers.a - -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index f6fb241dfec9269f4e501248de4dc83d5fdc2d3a..58ad6672e3351edbec537ad5b142ff14cb7389ea 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -111,6 +111,11 @@ OMXPlayerVideo::~OMXPlayerVideo() - CloseStream(false); - } - -+bool OMXPlayerVideo::SupportsExtention() const -+{ -+ return CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_SUPPORTMVC); -+} -+ - bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints) - { - m_hints = hints; -diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h -index b5050081c360d29b1b478c27e6b88291e20ecdac..c880fa6bbb128b99f8a5393056586821143d99ff 100644 ---- a/xbmc/cores/omxplayer/OMXPlayerVideo.h -+++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h -@@ -96,6 +96,7 @@ public: - void WaitForBuffers() { m_messageQueue.WaitUntilEmpty(); } - int GetLevel() const { return m_messageQueue.GetLevel(); } - bool IsStalled() const { return m_stalled; } -+ bool SupportsExtention() const; - bool IsEOS(); - void CloseStream(bool bWaitForBuffers); - void Output(double pts, bool bDropPacket); -diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 536332c43e22ccb229e72b88518e54dd8a23ac41..39bc0530cecd54ae8c3a5481c92f1a6a18a4d9c5 100644 ---- a/xbmc/cores/omxplayer/OMXVideo.cpp -+++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -441,7 +441,7 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool hdmi_clock_syn - m_codingType = OMX_VIDEO_CodingMVC; - m_video_codec_name = "omx-mvc"; - if (hints.stereo_mode == "mono") -- hints.stereo_mode = "mvc_lr"; -+ hints.stereo_mode = "block_lr"; - } - break; - case AV_CODEC_ID_MPEG4: -diff --git a/xbmc/guilib/StereoscopicsManager.cpp b/xbmc/guilib/StereoscopicsManager.cpp -index 6aaa82f4d883b8cae0ccdedf6c5a6814e7aaa720..cc929b599125a44ac128713fd4331782d9931791 100644 ---- a/xbmc/guilib/StereoscopicsManager.cpp -+++ b/xbmc/guilib/StereoscopicsManager.cpp -@@ -70,10 +70,13 @@ static const struct StereoModeMap VideoModeToGuiModeMap[] = - { "anaglyph_cyan_red", RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN }, - { "anaglyph_green_magenta", RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA }, - { "anaglyph_yellow_blue", RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE }, -+#ifndef TARGET_RASPBERRY_PI - { "block_lr", RENDER_STEREO_MODE_HARDWAREBASED }, - { "block_rl", RENDER_STEREO_MODE_HARDWAREBASED }, -+#else - { "block_lr", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback - { "block_rl", RENDER_STEREO_MODE_SPLIT_HORIZONTAL }, // fallback -+#endif - {} - }; - - -From 56bda93bf04b76e40175db4eebfe7fa26585b90b Mon Sep 17 00:00:00 2001 -From: Anton Fedchin -Date: Thu, 10 Mar 2016 18:11:33 +0300 -Subject: [PATCH 52/62] fixup! Revert supporting crappy tab/sbs subtitles. this - fixes regular subtitles. - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -index a8323f419e404037c4e5fb4d78fa1b45409337a7..7c0b70777556ac7694e7fc511cd4bb189fc42e08 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp -@@ -290,6 +290,7 @@ CDVDOverlay* CDVDOverlayCodecFFmpeg::GetOverlay() - - m_SubtitleIndex++; - -+ CLog::Log(LOGDEBUG, "Overlay: x:%d y:%d w:%d h:%d", overlay->x, overlay->y, overlay->width, overlay->height); - return overlay; - } - - -From 40f9ac9217dbe0a5f3ea5d7e8f6b36f79d9455fe Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 26 Nov 2016 18:24:18 +0000 -Subject: [PATCH 53/62] DemuxMVC: fixup after SeekTime API change - ---- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp | 2 +- - xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -index ade6a4454fc3915b0c787b1a4f72aedbd74903db..baefe44ca932ee98e482f1bed70d8949be71cfac 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.cpp -@@ -188,7 +188,7 @@ DemuxPacket* CDemuxMVC::Read() - return nullptr; - } - --bool CDemuxMVC::SeekTime(int time, bool backwords, double* startpts) -+bool CDemuxMVC::SeekTime(double time, bool backwords, double* startpts) - { - if (!m_pInput) - return false; -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -index bbb836a61344689a83af68c821c05c212a86b097..54f91a02391368fbfbb4d669c003f42568347f62 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMVC.h -@@ -36,7 +36,7 @@ public: - virtual void Abort(); - virtual void Flush(); - virtual DemuxPacket* Read(); -- virtual bool SeekTime(int time, bool backwords = false, double* startpts = nullptr); -+ virtual bool SeekTime(double time, bool backwords = false, double* startpts = nullptr); - virtual void SetSpeed(int iSpeed) { }; - virtual int GetStreamLength() { return 0; }; - virtual CDemuxStream* GetStream(int iStreamId) const override { return nullptr; }; - -From 07af63a05c028937005d37d901c1e3be4aaa8784 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 3 Nov 2014 23:17:46 +0000 -Subject: [PATCH 54/62] [cec] Don't discard buttons when repeat mode is enabled - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 30367a3fde956090afdca9930fa52e829f35046f..febacb3b7964eab3b8615a6a807e0f27d911b4da 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -803,7 +803,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); - - CSingleLock lock(m_critSection); -- if (key.iDuration > 0) -+ // avoid the queue getting too long -+ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) -+ return; -+ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) - { - if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) - { - -From 4066e9289576eb4def863476331d73d081f9ac85 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 4 Nov 2014 18:50:00 +0000 -Subject: [PATCH 55/62] [cec] Temp - more logging - ---- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index febacb3b7964eab3b8615a6a807e0f27d911b4da..52d6e6a7ab68ce91faf5a3881b23ea7adde96cb8 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -800,12 +800,15 @@ void CPeripheralCecAdapter::GetNextKey(void) - - void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - { -- CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); -+ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d (rep:%d size:%d)", __FUNCTION__, key.iButton, key.iDuration, m_configuration.iButtonRepeatRateMs, m_buttonQueue.size()); - - CSingleLock lock(m_critSection); - // avoid the queue getting too long - if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) -+ { -+ CLog::Log(LOGDEBUG, "%s - discarded key %2x", __FUNCTION__, key.iButton); - return; -+ } - if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) - { - if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) -@@ -814,6 +817,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - if (m_bHasButton) - m_currentButton.iDuration = key.iDuration; - // ignore this one, since it's already been handled by xbmc -+ CLog::Log(LOGDEBUG, "%s - ignored key %2x", __FUNCTION__, key.iButton); - return; - } - // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it -@@ -824,6 +828,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - if ((*it).iDuration == 0) - { - // replace this entry -+ CLog::Log(LOGDEBUG, "%s - replaced key %2x", __FUNCTION__, key.iButton); - (*it).iDuration = key.iDuration; - return; - } -@@ -833,6 +838,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) - } - } - -+ CLog::Log(LOGDEBUG, "%s - added key %2x", __FUNCTION__, key.iButton); - m_buttonQueue.push_back(key); - } - - -From 9771f5dd741a349b93481848ea2be760106755bc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 25 May 2016 18:31:17 +0100 -Subject: [PATCH 56/62] rbp: Hard code the number of buffers to improve audio - sync - ---- - system/settings/rbp.xml | 6 ++++++ - xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp | 4 ++++ - 2 files changed, 10 insertions(+) - -diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml -index 7098edf32dff8c00e192229c3ffb060be6a42482..0ce6735e11fabd1d07a4860b9d985a4e1fd5f35a 100644 ---- a/system/settings/rbp.xml -+++ b/system/settings/rbp.xml -@@ -85,6 +85,12 @@ - - - -+ -+ -+ false -+ 2 -+ -+ - - - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -index 8626a1b449ff0963089f6a7ad191a6c99512521a..53fc987b4ebb0555a804477bfb5b1d8443a98bcd 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp -@@ -1067,7 +1067,11 @@ void CRenderManager::UpdateDisplayLatency() - refresh = 0; // No idea about refresh rate when windowed, just get the default latency - m_displayLatency = (double) g_advancedSettings.GetDisplayLatency(refresh); - -+#ifdef TARGET_RASPBERRY_PI -+ int buffers = CSettings::GetInstance().GetBool("videoplayer.usedisplayasclock") ? 1:2; -+#else - int buffers = g_Windowing.NoOfBuffers(); -+#endif - m_displayLatency += (buffers - 1) / fps; - - } - -From 77b9beb43349ae1335090f53d2a4d4f08aff928e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 4 Jul 2016 18:30:03 +0100 -Subject: [PATCH 57/62] rbp: Update the GL libs to new naming scheme - -As the opensource mesa GL library is getting more usable, the name collision wih the firmware GL driver is causing issues. -As such we are renaming the firmware GL driver to avoid this. - -The new names are libbrcmEGL.so and libbrcmGLESv2.so. Both will be supported for some time, but the original name -will be dropped at some point ---- - configure.ac | 2 +- - project/cmake/modules/FindOpenGLES.cmake | 6 +++--- - tools/depends/configure.ac | 2 +- - 3 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/configure.ac b/configure.ac -index d2186cbda52213aa85b5734b6c8f45a69e5e2e20..75e264b24629480880d4ea758c25db26c754bc9b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -949,7 +949,7 @@ if test "$use_gles" = "yes"; then - AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) - AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) - AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) -- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" -+ LIBS="$LIBS -lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" - else - AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) - AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) -diff --git a/project/cmake/modules/FindOpenGLES.cmake b/project/cmake/modules/FindOpenGLES.cmake -index ab06f968b3e314fca1ae001139f687dce9a5098b..87f1faa248b91a2e50758b23c0b9e5b09e4a69ff 100644 ---- a/project/cmake/modules/FindOpenGLES.cmake -+++ b/project/cmake/modules/FindOpenGLES.cmake -@@ -13,7 +13,7 @@ - find_package(EMBEDDED) - - if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi") -- pkg_check_modules(PC_OPENGLES glesv2 QUIET) -+ pkg_check_modules(PC_OPENGLES brcmglesv2 QUIET) - if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND) - set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH}) - endif() -@@ -22,9 +22,9 @@ endif() - if(NOT CORE_SYSTEM_NAME STREQUAL ios) - find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h - PATHS ${PC_OPENGLES_INCLUDEDIR}) -- find_library(OPENGLES_gl_LIBRARY NAMES GLESv2 -+ find_library(OPENGLES_gl_LIBRARY NAMES brcmGLESv2 - PATHS ${PC_OPENGLES_LIBDIR}) -- find_library(OPENGLES_egl_LIBRARY NAMES EGL -+ find_library(OPENGLES_egl_LIBRARY NAMES brcmEGL - PATHS ${PC_OPENGLES_LIBDIR}) - else() - find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES -diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac -index 3626ea5204eb561dc1ae0b64c6bb7253d2ec59ec..100ff3178bafe7434bd5456100b5bb7189a5378d 100644 ---- a/tools/depends/configure.ac -+++ b/tools/depends/configure.ac -@@ -433,7 +433,7 @@ if test "$target_platform" = "raspberry-pi" ; then - -isystem${use_firmware}/opt/vc/include \ - -isystem${use_firmware}/opt/vc/include/interface/vcos/pthreads \ - -isystem${use_firmware}/opt/vc/include/interface/vmcs_host/linux" -- platform_ldflags+=" -L${use_firmware}/opt/vc/lib -lEGL -lGLESv2 -lbcm_host -lvcos \ -+ platform_ldflags+=" -L${use_firmware}/opt/vc/lib -lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvcos \ - -lvchiq_arm" - fi - - -From 16d9562395384270f1dca8ef062d0048b08ca2dc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Jun 2016 14:46:01 +0100 -Subject: [PATCH 58/62] ffmpeg: hacky fix for files with GMC - ---- - xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -index 9149698884c8ae6a23649abbaa0e659587dfe982..84d515e9e2df6a4c1c448a52a42f4675deab7991 100644 ---- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp -@@ -1458,8 +1458,8 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) - stereoMode = GetStereoModeFromMetadata(m_pFormatContext->metadata); - if (!stereoMode.empty()) - st->stereo_mode = stereoMode; -- -- st->workaround_bugs = pStream->codec->workaround_bugs; -+ AVCodecContext *c = (AVCodecContext *)(((uint32_t *)pStream->internal)[4]); /* Eek! */ -+ st->workaround_bugs = c->workaround_bugs; - if ( m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD) ) - { - if (pStream->codec->codec_id == AV_CODEC_ID_PROBE) - -From 7d20983a4ed4a55b9e465ae121dc621a4527464a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 19 Jul 2016 20:39:18 +0100 -Subject: [PATCH 59/62] mmalrender: Add sharpness control - ---- - addons/resource.language.en_gb/resources/strings.po | 2 +- - .../VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp | 13 ++++++++++++- - .../VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h | 1 + - 3 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 7c7969d381bf15ac1ba2fd8f16e463f6b12fe4c3..45cf0830ea6079a0f2ad22792f2497c5ad53b625 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -8694,7 +8694,7 @@ msgstr "" - - #: xbmc/video/dialogs/GUIDialogVideoSettings.cpp - msgctxt "#16313" --msgid "VDPAU - Sharpness" -+msgid "Sharpness" - msgstr "" - - #empty string with id 16314 -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp -index 84953d116610e9fd262de968ffe26d6063a9193b..f5f0f0d01227b3b4dcebb4a22a54dbcaac2d5ee9 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp -@@ -411,6 +411,7 @@ CMMALRenderer::CMMALRenderer() : CThread("MMALRenderer"), m_processThread(this, - m_frameInterval = 0.0; - m_frameIntervalDiff = 1e5; - m_vsync_count = ~0U; -+ m_sharpness = -2.0f; - m_vout_width = 0; - m_vout_height = 0; - m_vout_aligned_width = 0; -@@ -847,6 +848,15 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) - goto exit; - } - -+ // if sharpness setting has changed, we should update it -+ if (m_sharpness != CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Sharpness) -+ { -+ m_sharpness = CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Sharpness; -+ char command[80], response[80]; -+ sprintf(command, "scaling_sharpness %d", ((int)(50.0f * (m_sharpness + 1.0f) + 0.5f))); -+ vc_gencmd(response, sizeof response, command); -+ } -+ - if (m_format != RENDER_FMT_MMAL) - { - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -@@ -1023,7 +1033,8 @@ bool CMMALRenderer::Supports(ERENDERFEATURE feature) - feature == RENDERFEATURE_ZOOM || - feature == RENDERFEATURE_ROTATION || - feature == RENDERFEATURE_VERTICAL_SHIFT || -- feature == RENDERFEATURE_PIXEL_RATIO) -+ feature == RENDERFEATURE_PIXEL_RATIO || -+ feature == RENDERFEATURE_SHARPNESS) - return true; - - return false; -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h -index e0e6f7c0e0546013ca74265aef54704fd332f8e4..69eae6cbef0131d20dc979dcb35915cd73967592 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h -@@ -140,6 +140,7 @@ protected: - RENDER_STEREO_MODE m_video_stereo_mode; - RENDER_STEREO_MODE m_display_stereo_mode; - bool m_StereoInvert; -+ float m_sharpness; - - CCriticalSection m_sharedSection; - MMAL_COMPONENT_T *m_vout; - -From 4767086e68edac21dc112be1262e38c5c83d1aea Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 14 Oct 2016 15:37:53 +0100 -Subject: [PATCH 60/62] MMALFFMpeg: Report as SW decode in codec overlay info - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -index 619515c9411172261d8f0bef24c5d679c35e5d7d..b31c984c0a507891f2754146a4c62802f0096505 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp -@@ -579,7 +579,7 @@ void CDVDVideoCodecFFmpeg::UpdateName() - if(m_pHardware) - m_name += "-" + m_pHardware->Name(); - -- m_processInfo.SetVideoDecoderName(m_name, m_pHardware ? true : false); -+ m_processInfo.SetVideoDecoderName(m_name, m_pHardware && m_pHardware->Name() != "mmal" ? true : false); - - CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - Updated codec: %s", m_name.c_str()); - } - -From bc4cb4cb7618aecf4735f783e5ef97f0cae72d83 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 7 Nov 2016 18:28:01 +0000 -Subject: [PATCH 61/62] advancedsettings: Add option to set cache size on - libass - -E.g to set total cache size in libass to 32M - - - 32 - - -When unset it defaults to 192M ---- - xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp | 3 +++ - xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h | 3 +++ - xbmc/settings/AdvancedSettings.cpp | 5 +++++ - xbmc/settings/AdvancedSettings.h | 2 ++ - 4 files changed, 13 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp b/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp -index 0f5e1ace4c85f65a0ab5dbd8e6f1c2715d60467d..7a236080bc96466d34e14b9b0d82ba4084276abd 100644 ---- a/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp -+++ b/xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp -@@ -28,6 +28,7 @@ - #include "utils/StringUtils.h" - #include "threads/SingleLock.h" - #include "guilib/GraphicContext.h" -+#include "settings/AdvancedSettings.h" - - static void libass_log(int level, const char *fmt, va_list args, void *data) - { -@@ -75,6 +76,8 @@ CDVDSubtitlesLibass::CDVDSubtitlesLibass() - if(!m_renderer) - return; - -+ m_dll.ass_set_cache_limits(m_renderer, 0, g_advancedSettings.m_libAssCache); -+ - //Setting default font to the Arial in \media\fonts (used if FontConfig fails) - strPath = URIUtils::AddFileToFolder("special://home/media/Fonts/", CSettings::GetInstance().GetString(CSettings::SETTING_SUBTITLES_FONT)); - if (!XFILE::CFile::Exists(strPath)) -diff --git a/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h b/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h -index f9de4f15e7c612d69ef46e7cad870ecb61afaec3..b5303fd100f1a930eb5c010a951932064d5190c4 100644 ---- a/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h -+++ b/xbmc/cores/VideoPlayer/DVDSubtitles/DllLibass.h -@@ -64,6 +64,7 @@ public: - virtual void ass_set_message_cb(ASS_Library *priv - , void (*msg_cb)(int level, const char *fmt, va_list args, void *data) - , void *data)=0; -+ virtual void ass_set_cache_limits(ASS_Renderer *render_priv, int glyph_max, int bitmap_max)=0; - }; - - class DllLibass : public DllDynamic, DllLibassInterface -@@ -91,6 +92,7 @@ class DllLibass : public DllDynamic, DllLibassInterface - DEFINE_METHOD5(void, ass_process_chunk, (ASS_Track* p1, char* p2, int p3, long long p4, long long p5)) - DEFINE_METHOD3(void, ass_process_codec_private, (ASS_Track* p1, char* p2, int p3)) - DEFINE_METHOD3(void, ass_set_message_cb, (ASS_Library* p1, void (*p2)(int level, const char *fmt, va_list args, void *data), void* p3)) -+ DEFINE_METHOD3(void, ass_set_cache_limits, (ASS_Renderer *p1, int p2, int p3)) - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(ass_set_extract_fonts) - RESOLVE_METHOD(ass_set_fonts_dir) -@@ -114,5 +116,6 @@ class DllLibass : public DllDynamic, DllLibassInterface - RESOLVE_METHOD(ass_process_chunk) - RESOLVE_METHOD(ass_process_codec_private) - RESOLVE_METHOD(ass_set_message_cb) -+ RESOLVE_METHOD(ass_set_cache_limits) - END_METHOD_RESOLVE() - }; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 985ecf9722141d78471c00e90da15bfad931462a..a33581ba02a26110105a2d0ae810d96c410efbf1 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -364,6 +364,8 @@ void CAdvancedSettings::Initialize() - #else - m_cacheMemSize = 1024 * 1024 * 20; - #endif -+ m_libAssCache = 0; -+ - m_cacheBufferMode = CACHE_BUFFER_MODE_INTERNET; // Default (buffer all internet streams/filesystems) - // the following setting determines the readRate of a player data - // as multiply of the default data read rate -@@ -1026,6 +1028,9 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) - XMLUtils::GetFloat(pRootElement, "controllerdeadzone", m_controllerDeadzone, 0.0f, 1.0f); - XMLUtils::GetUInt(pRootElement, "fanartres", m_fanartRes, 0, 1080); - XMLUtils::GetUInt(pRootElement, "imageres", m_imageRes, 0, 1080); -+ -+ XMLUtils::GetUInt(pRootElement, "libasscache", m_libAssCache, 0, 1024); -+ - if (XMLUtils::GetString(pRootElement, "imagescalingalgorithm", tmp)) - m_imageScalingAlgorithm = CPictureScalingAlgorithm::FromString(tmp); - XMLUtils::GetBoolean(pRootElement, "playlistasfolders", m_playlistAsFolders); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index 6b0e3b8cf9e3ff40e6af758c54fe7eefb89a131c..35bf38719f0eaaa5ac29e9495480ae97f6aceca7 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -345,6 +345,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - unsigned int m_cacheBufferMode; - float m_cacheReadFactor; - -+ unsigned int m_libAssCache; -+ - bool m_jsonOutputCompact; - unsigned int m_jsonTcpPort; - - -From 567ad87b2bdbf86ae8540720c58716fd4f3ac46b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 13 Nov 2016 20:30:15 +0000 -Subject: [PATCH 62/62] [rbp] Experimental limit libass cache size depending on - arm memory size - ---- - xbmc/linux/RBP.cpp | 4 +++- - xbmc/settings/AdvancedSettings.cpp | 2 ++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp -index 6e8529001b1a464b4547a846f553d98f5bc0b6c0..238eba372af2cbab11d7543c857ee47640901d13 100644 ---- a/xbmc/linux/RBP.cpp -+++ b/xbmc/linux/RBP.cpp -@@ -65,6 +65,8 @@ void CRBP::InitializeSettings() - { - if (m_initialized && g_advancedSettings.m_cacheMemSize == ~0U) - g_advancedSettings.m_cacheMemSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; -+ if (m_initialized && g_advancedSettings.m_libAssCache == ~0U) -+ g_advancedSettings.m_libAssCache = m_arm_mem < 256 ? 21 : m_arm_mem < 512 ? 42 : 96; - } - - bool CRBP::Initialize() -@@ -120,7 +122,7 @@ void CRBP::LogFirmwareVerison() - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); - CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); -- CLog::Log(LOGNOTICE, "cache.memorysize: %dMB", g_advancedSettings.m_cacheMemSize >> 20); -+ CLog::Log(LOGNOTICE, "cache.memorysize: %dMB libass.cache: %dMB", g_advancedSettings.m_cacheMemSize >> 20, g_advancedSettings.m_libAssCache); - m_DllBcmHost->vc_gencmd(response, sizeof response, "get_config int"); - response[sizeof(response) - 1] = '\0'; - CLog::Log(LOGNOTICE, "Config:\n%s", response); -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index a33581ba02a26110105a2d0ae810d96c410efbf1..d70e2cf3113bbe0dad60dfc7accc8d77f7f30c30 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -361,8 +361,10 @@ void CAdvancedSettings::Initialize() - #ifdef TARGET_RASPBERRY_PI - // want default to be memory dependent, but interface to gpu not available yet, so set in RBP.cpp - m_cacheMemSize = ~0; -+ m_libAssCache = ~0; - #else - m_cacheMemSize = 1024 * 1024 * 20; -+ m_libAssCache = 0; - #endif - m_libAssCache = 0; - diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch deleted file mode 100644 index 53be0e10d6..0000000000 --- a/projects/RPi2/patches/linux/linux-01-RPi_support.patch +++ /dev/null @@ -1,127016 +0,0 @@ -From 726155a02a2642c4f992655ae4a4c062a0761260 Mon Sep 17 00:00:00 2001 -From: Steve Glendinning -Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/122] smsx95xx: fix crimes against truesize - -smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. - -This patch stops smsc95xx from changing truesize. - -Signed-off-by: Steve Glendinning ---- - drivers/net/usb/smsc95xx.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 831aa33d078ae7d2dd57fdded5de71d1eb915f99..b77935bded8c0ff7808b00f170ff10e594300ad0 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -82,6 +82,10 @@ static bool turbo_mode = true; - module_param(turbo_mode, bool, 0644); - MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); - -+static bool truesize_mode = false; -+module_param(truesize_mode, bool, 0644); -+MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); -+ - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -1951,7 +1955,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(skb); - skb_trim(skb, skb->len - 4); /* remove fcs */ -- skb->truesize = size + sizeof(struct sk_buff); -+ if (truesize_mode) -+ skb->truesize = size + sizeof(struct sk_buff); - - return 1; - } -@@ -1969,7 +1974,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) - if (dev->net->features & NETIF_F_RXCSUM) - smsc95xx_rx_csum_offload(ax_skb); - skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ -- ax_skb->truesize = size + sizeof(struct sk_buff); -+ if (truesize_mode) -+ ax_skb->truesize = size + sizeof(struct sk_buff); - - usbnet_skb_return(dev, ax_skb); - } - -From f1afc1dcb1c34955d1a9d756abb1b61c3a9f1da8 Mon Sep 17 00:00:00 2001 -From: Sam Nazarko -Date: Fri, 1 Apr 2016 17:27:21 +0100 -Subject: [PATCH 002/122] smsc95xx: Experimental: Enable turbo_mode and - packetsize=2560 by default - -See: http://forum.kodi.tv/showthread.php?tid=285288 ---- - drivers/net/usb/smsc95xx.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index b77935bded8c0ff7808b00f170ff10e594300ad0..693f163684de921404738e33244881e0aab92ec9 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -86,6 +86,10 @@ static bool truesize_mode = false; - module_param(truesize_mode, bool, 0644); - MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); - -+static int packetsize = 2560; -+module_param(packetsize, int, 0644); -+MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); -+ - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -1106,13 +1110,13 @@ static int smsc95xx_reset(struct usbnet *dev) - - if (!turbo_mode) { - burst_cap = 0; -- dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE; -+ dev->rx_urb_size = packetsize ? packetsize : MAX_SINGLE_PACKET_SIZE; - } else if (dev->udev->speed == USB_SPEED_HIGH) { -- burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; -- dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE; -+ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_HS_BURST_CAP_SIZE; -+ burst_cap = dev->rx_urb_size / HS_USB_PKT_SIZE; - } else { -- burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE; -- dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; -+ dev->rx_urb_size = packetsize ? packetsize : DEFAULT_FS_BURST_CAP_SIZE; -+ burst_cap = dev->rx_urb_size / FS_USB_PKT_SIZE; - } - - netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", - -From 69f6712212df74f6c27b1dfec7e3cc1408416653 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 003/122] Allow mac address to be set in smsc95xx - -Signed-off-by: popcornmix ---- - drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 693f163684de921404738e33244881e0aab92ec9..df60c989fc229bf0aab3c27e95ccd45323367840 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -60,6 +60,7 @@ - #define SUSPEND_SUSPEND3 (0x08) - #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ - SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) -+#define MAC_ADDR_LEN (6) - - #define CARRIER_CHECK_DELAY (2 * HZ) - -@@ -90,6 +91,10 @@ static int packetsize = 2560; - module_param(packetsize, int, 0644); - MODULE_PARM_DESC(packetsize, "Override the RX URB packet size"); - -+static char *macaddr = ":"; -+module_param(macaddr, charp, 0); -+MODULE_PARM_DESC(macaddr, "MAC address"); -+ - static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, - u32 *data, int in_pm) - { -@@ -918,6 +923,53 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) - return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); - } - -+/* Check the macaddr module parameter for a MAC address */ -+static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) -+{ -+ int i, j, got_num, num; -+ u8 mtbl[MAC_ADDR_LEN]; -+ -+ if (macaddr[0] == ':') -+ return 0; -+ -+ i = 0; -+ j = 0; -+ num = 0; -+ got_num = 0; -+ while (j < MAC_ADDR_LEN) { -+ if (macaddr[i] && macaddr[i] != ':') { -+ got_num++; -+ if ('0' <= macaddr[i] && macaddr[i] <= '9') -+ num = num * 16 + macaddr[i] - '0'; -+ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') -+ num = num * 16 + 10 + macaddr[i] - 'A'; -+ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') -+ num = num * 16 + 10 + macaddr[i] - 'a'; -+ else -+ break; -+ i++; -+ } else if (got_num == 2) { -+ mtbl[j++] = (u8) num; -+ num = 0; -+ got_num = 0; -+ i++; -+ } else { -+ break; -+ } -+ } -+ -+ if (j == MAC_ADDR_LEN) { -+ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " -+ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], -+ mtbl[3], mtbl[4], mtbl[5]); -+ for (i = 0; i < MAC_ADDR_LEN; i++) -+ dev_mac[i] = mtbl[i]; -+ return 1; -+ } else { -+ return 0; -+ } -+} -+ - static void smsc95xx_init_mac_address(struct usbnet *dev) - { - const u8 *mac_addr; -@@ -939,6 +991,10 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) - } - } - -+ /* Check module parameters */ -+ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) -+ return; -+ - /* no useful static MAC address found. generate a random one */ - eth_hw_addr_random(dev->net); - netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); - -From 10945e4697799ceff36fbdea420081b746d67429 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 13 Mar 2015 12:43:36 +0000 -Subject: [PATCH 004/122] Protect __release_resource against resources without - parents - -Without this patch, removing a device tree overlay can crash here. - -Signed-off-by: Phil Elwell ---- - kernel/resource.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/kernel/resource.c b/kernel/resource.c -index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b4010644bdc882 100644 ---- a/kernel/resource.c -+++ b/kernel/resource.c -@@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) - { - struct resource *tmp, **p, *chd; - -+ if (!old->parent) { -+ WARN(old->sibling, "sibling but no parent"); -+ if (old->sibling) -+ return -EINVAL; -+ return 0; -+ } - p = &old->parent->child; - for (;;) { - tmp = *p; - -From ab1aef30de5e9424f87d7d6e1edb1a5240a76ae5 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 005/122] mm: Remove the PFN busy warning - -See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is -expected sometimes when using CMA. However, that commit still spams -my kernel log with these warnings. - -Signed-off-by: Eric Anholt ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 34ada718ef47c4b27730214d584f9350fefb9883..3fa01a5280db96075798e4cbd58d5520ddf36d88 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -7297,8 +7297,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } - -From a1c2520dc2663b442e4b43010df6917f233ff40e Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 006/122] irq-bcm2836: Prevent spurious interrupts, and trap - them early - -The old arch-specific IRQ macros included a dsb to ensure the -write to clear the mailbox interrupt completed before returning -from the interrupt. The BCM2836 irqchip driver needs the same -precaution to avoid spurious interrupts. - -Spurious interrupts are still possible for other reasons, -though, so trap them early. ---- - drivers/irqchip/irq-bcm2836.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c -index d96b2c947e74e3edab3917551c64fbd1ced0f34c..93e3f7660c4230c9f1dd3b195958cb498949b0ca 100644 ---- a/drivers/irqchip/irq-bcm2836.c -+++ b/drivers/irqchip/irq-bcm2836.c -@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) - u32 ipi = ffs(mbox_val) - 1; - - writel(1 << ipi, mailbox0); -+ dsb(sy); - handle_IPI(ipi, regs); - #endif - } else if (stat) { - -From 2d51d14c0cea3d9d52f323b58a0a5d99a65eef24 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 007/122] irqchip: bcm2835: Add FIQ support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add a duplicate irq range with an offset on the hwirq's so the -driver can detect that enable_fiq() is used. -Tested with downstream dwc_otg USB controller driver. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt -Acked-by: Stephen Warren ---- - arch/arm/mach-bcm/Kconfig | 1 + - drivers/irqchip/irq-bcm2835.c | 51 ++++++++++++++++++++++++++++++++++++++----- - 2 files changed, 47 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index a0e66d8200c5cf8f2ea592abf870a32800213fa2..4ff30d5278a7ce093c9629d4c25d37e3bbbda752 100644 ---- a/arch/arm/mach-bcm/Kconfig -+++ b/arch/arm/mach-bcm/Kconfig -@@ -152,6 +152,7 @@ config ARCH_BCM2835 - select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 - select CLKSRC_OF - select BCM2835_TIMER -+ select FIQ - select PINCTRL - select PINCTRL_BCM2835 - help -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index 44d7c38dde479d771f3552e914bf8c1c1f5019f7..42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -54,7 +54,7 @@ - #include - - /* Put the bank and irq (32 bits) into the hwirq */ --#define MAKE_HWIRQ(b, n) ((b << 5) | (n)) -+#define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) - #define HWIRQ_BANK(i) (i >> 5) - #define HWIRQ_BIT(i) BIT(i & 0x1f) - -@@ -70,9 +70,13 @@ - | SHORTCUT1_MASK | SHORTCUT2_MASK) - - #define REG_FIQ_CONTROL 0x0c -+#define REG_FIQ_ENABLE 0x80 -+#define REG_FIQ_DISABLE 0 - - #define NR_BANKS 3 - #define IRQS_PER_BANK 32 -+#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) -+#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) - - static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; - static const int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; -@@ -97,14 +101,38 @@ static void __exception_irq_entry bcm2835_handle_irq( - struct pt_regs *regs); - static void bcm2836_chained_handle_irq(struct irq_desc *desc); - -+static inline unsigned int hwirq_to_fiq(unsigned long hwirq) -+{ -+ hwirq -= NUMBER_IRQS; -+ /* -+ * The hwirq numbering used in this driver is: -+ * BASE (0-7) GPU1 (32-63) GPU2 (64-95). -+ * This differ from the one used in the FIQ register: -+ * GPU1 (0-31) GPU2 (32-63) BASE (64-71) -+ */ -+ if (hwirq >= 32) -+ return hwirq - 32; -+ -+ return hwirq + 64; -+} -+ - static void armctrl_mask_irq(struct irq_data *d) - { -- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); -+ if (d->hwirq >= NUMBER_IRQS) -+ writel_relaxed(REG_FIQ_DISABLE, intc.base + REG_FIQ_CONTROL); -+ else -+ writel_relaxed(HWIRQ_BIT(d->hwirq), -+ intc.disable[HWIRQ_BANK(d->hwirq)]); - } - - static void armctrl_unmask_irq(struct irq_data *d) - { -- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); -+ if (d->hwirq >= NUMBER_IRQS) -+ writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), -+ intc.base + REG_FIQ_CONTROL); -+ else -+ writel_relaxed(HWIRQ_BIT(d->hwirq), -+ intc.enable[HWIRQ_BANK(d->hwirq)]); - } - - static struct irq_chip armctrl_chip = { -@@ -150,8 +178,9 @@ static int __init armctrl_of_init(struct device_node *node, - panic("%s: unable to map IC registers\n", - node->full_name); - -- intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), -- &armctrl_ops, NULL); -+ intc.base = base; -+ intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2, -+ &armctrl_ops, NULL); - if (!intc.domain) - panic("%s: unable to create IRQ domain\n", node->full_name); - -@@ -181,6 +210,18 @@ static int __init armctrl_of_init(struct device_node *node, - set_handle_irq(bcm2835_handle_irq); - } - -+ /* Make a duplicate irq range which is used to enable FIQ */ -+ for (b = 0; b < NR_BANKS; b++) { -+ for (i = 0; i < bank_irqs[b]; i++) { -+ irq = irq_create_mapping(intc.domain, -+ MAKE_HWIRQ(b, i) + NUMBER_IRQS); -+ BUG_ON(irq <= 0); -+ irq_set_chip(irq, &armctrl_chip); -+ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); -+ } -+ } -+ init_FIQ(FIQ_START); -+ - return 0; - } - - -From 2d9b0ef8dc1a5975dfccfb7e78b8f5a94ab5f2bb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 008/122] irqchip: irq-bcm2835: Add 2836 FIQ support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Noralf Trønnes ---- - drivers/irqchip/irq-bcm2835.c | 43 +++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 41 insertions(+), 2 deletions(-) - -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index 42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008..eccf6ed025299cb480884f5bcbe77abf55a6bbb1 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -50,8 +50,11 @@ - #include - #include - #include -+#include -+#include - - #include -+#include - - /* Put the bank and irq (32 bits) into the hwirq */ - #define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) -@@ -69,6 +72,9 @@ - #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \ - | SHORTCUT1_MASK | SHORTCUT2_MASK) - -+#undef ARM_LOCAL_GPU_INT_ROUTING -+#define ARM_LOCAL_GPU_INT_ROUTING 0x0c -+ - #define REG_FIQ_CONTROL 0x0c - #define REG_FIQ_ENABLE 0x80 - #define REG_FIQ_DISABLE 0 -@@ -94,6 +100,7 @@ struct armctrl_ic { - void __iomem *enable[NR_BANKS]; - void __iomem *disable[NR_BANKS]; - struct irq_domain *domain; -+ struct regmap *local_regmap; - }; - - static struct armctrl_ic intc __read_mostly; -@@ -127,12 +134,35 @@ static void armctrl_mask_irq(struct irq_data *d) - - static void armctrl_unmask_irq(struct irq_data *d) - { -- if (d->hwirq >= NUMBER_IRQS) -+ if (d->hwirq >= NUMBER_IRQS) { -+ if (num_online_cpus() > 1) { -+ unsigned int data; -+ int ret; -+ -+ if (!intc.local_regmap) { -+ pr_err("FIQ is disabled due to missing regmap\n"); -+ return; -+ } -+ -+ ret = regmap_read(intc.local_regmap, -+ ARM_LOCAL_GPU_INT_ROUTING, &data); -+ if (ret) { -+ pr_err("Failed to read int routing %d\n", ret); -+ return; -+ } -+ -+ data &= ~0xc; -+ data |= (1 << 2); -+ regmap_write(intc.local_regmap, -+ ARM_LOCAL_GPU_INT_ROUTING, data); -+ } -+ - writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), - intc.base + REG_FIQ_CONTROL); -- else -+ } else { - writel_relaxed(HWIRQ_BIT(d->hwirq), - intc.enable[HWIRQ_BANK(d->hwirq)]); -+ } - } - - static struct irq_chip armctrl_chip = { -@@ -210,6 +240,15 @@ static int __init armctrl_of_init(struct device_node *node, - set_handle_irq(bcm2835_handle_irq); - } - -+ if (is_2836) { -+ intc.local_regmap = -+ syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local"); -+ if (IS_ERR(intc.local_regmap)) { -+ pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n"); -+ intc.local_regmap = NULL; -+ } -+ } -+ - /* Make a duplicate irq range which is used to enable FIQ */ - for (b = 0; b < NR_BANKS; b++) { - for (i = 0; i < bank_irqs[b]; i++) { - -From 39974a29633d89316e5de24d87294b444b24f381 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 009/122] spidev: Add "spidev" compatible string to silence - warning - -See: https://github.com/raspberrypi/linux/issues/1054 ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c -index 2e05046f866bd01bf87edcdeff0d5b76d4d0aea7..d780491b8013a4e97fa843958964454e4463fe5e 100644 ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -696,6 +696,7 @@ static struct class *spidev_class; - static const struct of_device_id spidev_dt_ids[] = { - { .compatible = "rohm,dh2228fv" }, - { .compatible = "lineartechnology,ltc2488" }, -+ { .compatible = "spidev" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); - -From 51c39f512e9b370f126afcdcf6306561ea1f50f2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 010/122] serial: 8250: Don't crash when nr_uarts is 0 - ---- - drivers/tty/serial/8250/8250_core.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c -index 240a361b674fe72ce657067e5303156b7add6a6f..14f6cdfd744209482056d206dc476d9427cba9ba 100644 ---- a/drivers/tty/serial/8250/8250_core.c -+++ b/drivers/tty/serial/8250/8250_core.c -@@ -509,6 +509,8 @@ static void __init serial8250_isa_init_ports(void) - - if (nr_uarts > UART_NR) - nr_uarts = UART_NR; -+ if (!nr_uarts) -+ return; - - for (i = 0; i < nr_uarts; i++) { - struct uart_8250_port *up = &serial8250_ports[i]; - -From f56196076549fabcdf0cca5685d1ea3e0308622a Mon Sep 17 00:00:00 2001 -From: notro -Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 011/122] pinctrl-bcm2835: Set base to 0 give expected gpio - numbering - -Signed-off-by: Noralf Tronnes ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index fa77165fab2c1348163979da507df17e7168c49b..d11e2e4ea189466e686d762cb6c6fef9111ecf8e 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -386,7 +386,7 @@ static struct gpio_chip bcm2835_gpio_chip = { - .get = bcm2835_gpio_get, - .set = bcm2835_gpio_set, - .to_irq = bcm2835_gpio_to_irq, -- .base = -1, -+ .base = 0, - .ngpio = BCM2835_NUM_GPIOS, - .can_sleep = false, - }; - -From 40a7420d0d585951fbc02f232df97a15beff7a57 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 012/122] pinctrl-bcm2835: Fix interrupt handling for GPIOs - 28-31 and 46-53 - -Contrary to the documentation, the BCM2835 GPIO controller actually has -four interrupt lines - one each for the three IRQ groups and one common. Rather -confusingly, the GPIO interrupt groups don't correspond directly with the GPIO -control banks. Instead, GPIOs 0-27 generate IRQ GPIO0, 28-45 GPIO1 and -46-53 GPIO2. - -Awkwardly, the GPIOS for IRQ GPIO1 straddle two 32-entry GPIO banks, so it is -cleaner to split out a function to process the interrupts for a single GPIO -bank. - -This bug has only just been observed because GPIOs above 27 can only be -accessed on an old Raspberry Pi with the optional P5 header fitted, where -the pins are often used for I2S instead. ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 51 ++++++++++++++++++++++++++--------- - 1 file changed, 39 insertions(+), 12 deletions(-) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index d11e2e4ea189466e686d762cb6c6fef9111ecf8e..107ad7d58de8f8a7f55e09c9cdcf7d66fa7ab66b 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -47,6 +47,7 @@ - #define MODULE_NAME "pinctrl-bcm2835" - #define BCM2835_NUM_GPIOS 54 - #define BCM2835_NUM_BANKS 2 -+#define BCM2835_NUM_IRQS 3 - - #define BCM2835_PIN_BITMAP_SZ \ - DIV_ROUND_UP(BCM2835_NUM_GPIOS, sizeof(unsigned long) * 8) -@@ -88,13 +89,13 @@ enum bcm2835_pinconf_pull { - - struct bcm2835_gpio_irqdata { - struct bcm2835_pinctrl *pc; -- int bank; -+ int irqgroup; - }; - - struct bcm2835_pinctrl { - struct device *dev; - void __iomem *base; -- int irq[BCM2835_NUM_BANKS]; -+ int irq[BCM2835_NUM_IRQS]; - - /* note: locking assumes each bank will have its own unsigned long */ - unsigned long enabled_irq_map[BCM2835_NUM_BANKS]; -@@ -105,7 +106,7 @@ struct bcm2835_pinctrl { - struct gpio_chip gpio_chip; - struct pinctrl_gpio_range gpio_range; - -- struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_BANKS]; -+ struct bcm2835_gpio_irqdata irq_data[BCM2835_NUM_IRQS]; - spinlock_t irq_lock[BCM2835_NUM_BANKS]; - }; - -@@ -391,17 +392,16 @@ static struct gpio_chip bcm2835_gpio_chip = { - .can_sleep = false, - }; - --static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) -+static int bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc, -+ unsigned int bank, u32 mask) - { -- struct bcm2835_gpio_irqdata *irqdata = dev_id; -- struct bcm2835_pinctrl *pc = irqdata->pc; -- int bank = irqdata->bank; - unsigned long events; - unsigned offset; - unsigned gpio; - unsigned int type; - - events = bcm2835_gpio_rd(pc, GPEDS0 + bank * 4); -+ events &= mask; - events &= pc->enabled_irq_map[bank]; - for_each_set_bit(offset, &events, 32) { - gpio = (32 * bank) + offset; -@@ -409,7 +409,30 @@ static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) - - generic_handle_irq(irq_linear_revmap(pc->irq_domain, gpio)); - } -- return events ? IRQ_HANDLED : IRQ_NONE; -+ -+ return (events != 0); -+} -+ -+static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id) -+{ -+ struct bcm2835_gpio_irqdata *irqdata = dev_id; -+ struct bcm2835_pinctrl *pc = irqdata->pc; -+ int handled = 0; -+ -+ switch (irqdata->irqgroup) { -+ case 0: /* IRQ0 covers GPIOs 0-27 */ -+ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0x0fffffff); -+ break; -+ case 1: /* IRQ1 covers GPIOs 28-45 */ -+ handled = bcm2835_gpio_irq_handle_bank(pc, 0, 0xf0000000) | -+ bcm2835_gpio_irq_handle_bank(pc, 1, 0x00003fff); -+ break; -+ case 2: /* IRQ2 covers GPIOs 46-53 */ -+ handled = bcm2835_gpio_irq_handle_bank(pc, 1, 0x003fc000); -+ break; -+ } -+ -+ return handled ? IRQ_HANDLED : IRQ_NONE; - } - - static inline void __bcm2835_gpio_irq_config(struct bcm2835_pinctrl *pc, -@@ -998,8 +1021,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) - for (i = 0; i < BCM2835_NUM_BANKS; i++) { - unsigned long events; - unsigned offset; -- int len; -- char *name; - - /* clear event detection flags */ - bcm2835_gpio_wr(pc, GPREN0 + i * 4, 0); -@@ -1014,10 +1035,15 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) - for_each_set_bit(offset, &events, 32) - bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset)); - -+ spin_lock_init(&pc->irq_lock[i]); -+ } -+ -+ for (i = 0; i < BCM2835_NUM_IRQS; i++) { -+ int len; -+ char *name; - pc->irq[i] = irq_of_parse_and_map(np, i); - pc->irq_data[i].pc = pc; -- pc->irq_data[i].bank = i; -- spin_lock_init(&pc->irq_lock[i]); -+ pc->irq_data[i].irqgroup = i; - - len = strlen(dev_name(pc->dev)) + 16; - name = devm_kzalloc(pc->dev, len, GFP_KERNEL); -@@ -1074,6 +1100,7 @@ static struct platform_driver bcm2835_pinctrl_driver = { - .remove = bcm2835_pinctrl_remove, - .driver = { - .name = MODULE_NAME, -+ .owner = THIS_MODULE, - .of_match_table = bcm2835_pinctrl_match, - }, - }; - -From a19df9159eb1e9745593febf2ef6aa5868e8d12f Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 013/122] pinctrl-bcm2835: Only request the interrupts listed - in the DTB - -Although the GPIO controller can generate three interrupts (four counting -the common one), the device tree files currently only specify two. In the -absence of the third, simply don't register that interrupt (as opposed to -registering 0), which has the effect of making it impossible to generate -interrupts for GPIOs 46-53 which, since they share pins with the SD card -interface, is unlikely to be a problem. ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 107ad7d58de8f8a7f55e09c9cdcf7d66fa7ab66b..644bdecbcfcb79d3b84a33769265fca5d3d0c9e5 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -1042,6 +1042,8 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) - int len; - char *name; - pc->irq[i] = irq_of_parse_and_map(np, i); -+ if (pc->irq[i] == 0) -+ break; - pc->irq_data[i].pc = pc; - pc->irq_data[i].irqgroup = i; - - -From eee7c2b51a8b1753aca3d01ecda24713576d14e5 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 6 May 2016 12:32:47 +0100 -Subject: [PATCH 014/122] pinctrl-bcm2835: Return pins to inputs when freed - -When dynamically unloading overlays, it is important that freed pins are -restored to being inputs to prevent functions from being enabled in -multiple places at once. - -Signed-off-by: Phil Elwell ---- - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -index 644bdecbcfcb79d3b84a33769265fca5d3d0c9e5..81a66cba2ab0f7e3ae179de7edd10122630e7abc 100644 ---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c -+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c -@@ -844,6 +844,16 @@ static const struct pinctrl_ops bcm2835_pctl_ops = { - .dt_free_map = bcm2835_pctl_dt_free_map, - }; - -+static int bcm2835_pmx_free(struct pinctrl_dev *pctldev, -+ unsigned offset) -+{ -+ struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable by setting to GPIO_IN */ -+ bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); -+ return 0; -+} -+ - static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev) - { - return BCM2835_FSEL_COUNT; -@@ -903,6 +913,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, - } - - static const struct pinmux_ops bcm2835_pmx_ops = { -+ .free = bcm2835_pmx_free, - .get_functions_count = bcm2835_pmx_get_functions_count, - .get_function_name = bcm2835_pmx_get_function_name, - .get_function_groups = bcm2835_pmx_get_function_groups, - -From 7d54b896b5523a49b1038dd301b2d359d2321ef2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 015/122] spi-bcm2835: Support pin groups other than 7-11 - -The spi-bcm2835 driver automatically uses GPIO chip-selects due to -some unreliability of the native ones. In doing so it chooses the -same pins as the native chip-selects would use, but the existing -code always uses pins 7 and 8, wherever the SPI function is mapped. - -Search the pinctrl group assigned to the driver for pins that -correspond to native chip-selects, and use those for GPIO chip- -selects. - -Signed-off-by: Phil Elwell ---- - drivers/spi/spi-bcm2835.c | 45 +++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 37 insertions(+), 8 deletions(-) - -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index f35cc10772f6670397ea923ad30158270dd68578..5dfe20ffc2866fa6789825016c585175a29705b6 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -688,6 +688,8 @@ static int bcm2835_spi_setup(struct spi_device *spi) - { - int err; - struct gpio_chip *chip; -+ struct device_node *pins; -+ u32 pingroup_index; - /* - * sanity checking the native-chipselects - */ -@@ -704,15 +706,42 @@ static int bcm2835_spi_setup(struct spi_device *spi) - "setup: only two native chip-selects are supported\n"); - return -EINVAL; - } -- /* now translate native cs to GPIO */ -- -- /* get the gpio chip for the base */ -- chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); -- if (!chip) -- return 0; - -- /* and calculate the real CS */ -- spi->cs_gpio = chip->base + 8 - spi->chip_select; -+ /* now translate native cs to GPIO */ -+ /* first look for chip select pins in the devices pin groups */ -+ for (pingroup_index = 0; -+ (pins = of_parse_phandle(spi->master->dev.of_node, -+ "pinctrl-0", -+ pingroup_index)) != 0; -+ pingroup_index++) { -+ u32 pin; -+ u32 pin_index; -+ for (pin_index = 0; -+ of_property_read_u32_index(pins, -+ "brcm,pins", -+ pin_index, -+ &pin) == 0; -+ pin_index++) { -+ if (((spi->chip_select == 0) && -+ ((pin == 8) || (pin == 36) || (pin == 46))) || -+ ((spi->chip_select == 1) && -+ ((pin == 7) || (pin == 35)))) { -+ spi->cs_gpio = pin; -+ break; -+ } -+ } -+ of_node_put(pins); -+ } -+ /* if that fails, assume GPIOs 7-11 are used */ -+ if (!gpio_is_valid(spi->cs_gpio) ) { -+ /* get the gpio chip for the base */ -+ chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); -+ if (!chip) -+ return 0; -+ -+ /* and calculate the real CS */ -+ spi->cs_gpio = chip->base + 8 - spi->chip_select; -+ } - - /* and set up the "mode" and level */ - dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", - -From de045c3b6df0c0d56f02c0f782627249bbad09d2 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 016/122] spi-bcm2835: Disable forced software CS - -Select software CS in bcm2708_common.dtsi, and disable the automatic -conversion in the driver to allow hardware CS to be re-enabled with an -overlay. - -See: https://github.com/raspberrypi/linux/issues/1547 - -Signed-off-by: Phil Elwell ---- - drivers/spi/spi-bcm2835.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 5dfe20ffc2866fa6789825016c585175a29705b6..8493474d286f7a1ac6454a22c61c8c2cef9121bf 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -707,6 +707,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) - return -EINVAL; - } - -+#if 0 - /* now translate native cs to GPIO */ - /* first look for chip select pins in the devices pin groups */ - for (pingroup_index = 0; -@@ -756,6 +757,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) - spi->chip_select, spi->cs_gpio, err); - return err; - } -+#endif - - return 0; - } - -From a161509667da54c9d5066a0c6bc0584d093a8923 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 8 Nov 2016 21:35:38 +0000 -Subject: [PATCH 017/122] spi-bcm2835: Remove unused code - ---- - drivers/spi/spi-bcm2835.c | 61 ----------------------------------------------- - 1 file changed, 61 deletions(-) - -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 8493474d286f7a1ac6454a22c61c8c2cef9121bf..33d75ad38a7f77d085321ace9101900a83bebcac 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -679,17 +679,8 @@ static void bcm2835_spi_set_cs(struct spi_device *spi, bool gpio_level) - bcm2835_wr(bs, BCM2835_SPI_CS, cs); - } - --static int chip_match_name(struct gpio_chip *chip, void *data) --{ -- return !strcmp(chip->label, data); --} -- - static int bcm2835_spi_setup(struct spi_device *spi) - { -- int err; -- struct gpio_chip *chip; -- struct device_node *pins; -- u32 pingroup_index; - /* - * sanity checking the native-chipselects - */ -@@ -707,58 +698,6 @@ static int bcm2835_spi_setup(struct spi_device *spi) - return -EINVAL; - } - --#if 0 -- /* now translate native cs to GPIO */ -- /* first look for chip select pins in the devices pin groups */ -- for (pingroup_index = 0; -- (pins = of_parse_phandle(spi->master->dev.of_node, -- "pinctrl-0", -- pingroup_index)) != 0; -- pingroup_index++) { -- u32 pin; -- u32 pin_index; -- for (pin_index = 0; -- of_property_read_u32_index(pins, -- "brcm,pins", -- pin_index, -- &pin) == 0; -- pin_index++) { -- if (((spi->chip_select == 0) && -- ((pin == 8) || (pin == 36) || (pin == 46))) || -- ((spi->chip_select == 1) && -- ((pin == 7) || (pin == 35)))) { -- spi->cs_gpio = pin; -- break; -- } -- } -- of_node_put(pins); -- } -- /* if that fails, assume GPIOs 7-11 are used */ -- if (!gpio_is_valid(spi->cs_gpio) ) { -- /* get the gpio chip for the base */ -- chip = gpiochip_find("pinctrl-bcm2835", chip_match_name); -- if (!chip) -- return 0; -- -- /* and calculate the real CS */ -- spi->cs_gpio = chip->base + 8 - spi->chip_select; -- } -- -- /* and set up the "mode" and level */ -- dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -- spi->chip_select, spi->cs_gpio); -- -- /* set up GPIO as output and pull to the correct level */ -- err = gpio_direction_output(spi->cs_gpio, -- (spi->mode & SPI_CS_HIGH) ? 0 : 1); -- if (err) { -- dev_err(&spi->dev, -- "could not set CS%i gpio %i as output: %i", -- spi->chip_select, spi->cs_gpio, err); -- return err; -- } --#endif -- - return 0; - } - - -From 2ec6cfba14ff71b08f797c69d1a9c5bd53fc66a6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 018/122] ARM: bcm2835: Set Serial number and Revision -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The VideoCore bootloader passes in Serial number and -Revision number through Device Tree. Make these available to -userspace through /proc/cpuinfo. - -Mainline status: - -There is a commit in linux-next that standardize passing the serial -number through Device Tree (string: /serial-number): -ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo - -There was an attempt to do the same with the revision number, but it -didn't get in: -[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision - -Signed-off-by: Noralf Trønnes ---- - arch/arm/mach-bcm/board_bcm2835.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158ed2079834 100644 ---- a/arch/arm/mach-bcm/board_bcm2835.c -+++ b/arch/arm/mach-bcm/board_bcm2835.c -@@ -16,13 +16,23 @@ - #include - #include - #include -+#include - - #include - #include - - static void __init bcm2835_init(void) - { -+ struct device_node *np = of_find_node_by_path("/system"); -+ u32 val; -+ u64 val64; -+ - bcm2835_init_clocks(); -+ -+ if (!of_property_read_u32(np, "linux,revision", &val)) -+ system_rev = val; -+ if (!of_property_read_u64(np, "linux,serial", &val64)) -+ system_serial_low = val64; - } - - static const char * const bcm2835_compat[] = { - -From 7cd4e838461cb6cefa1ca5246ef3a6773363f0e0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 019/122] dmaengine: bcm2835: Load driver early and support - legacy API -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Load driver early since at least bcm2708_fb doesn't support deferred -probing and even if it did, we don't want the video driver deferred. -Support the legacy DMA API which is needed by bcm2708_fb. -Don't mask out channel 2. - -Signed-off-by: Noralf Trønnes ---- - drivers/dma/Kconfig | 2 +- - drivers/dma/bcm2835-dma.c | 26 +++++++++++++++++++++++++- - 2 files changed, 26 insertions(+), 2 deletions(-) - -diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 141aefbe37ec93d1f4f38d1be5e2cf8d93266725..9c931d36c6a499a02f4f215f8cd77d3f2254a3b9 100644 ---- a/drivers/dma/Kconfig -+++ b/drivers/dma/Kconfig -@@ -108,7 +108,7 @@ config COH901318 - - config DMA_BCM2835 - tristate "BCM2835 DMA engine support" -- depends on ARCH_BCM2835 -+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 - select DMA_ENGINE - select DMA_VIRTUAL_CHANNELS - -diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c -index e18dc596cf2447fa9ef7e41b62d9396e29043426..80d35f760b4a4a51e60c355a84d538bac3892a4d 100644 ---- a/drivers/dma/bcm2835-dma.c -+++ b/drivers/dma/bcm2835-dma.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -48,6 +49,7 @@ - - #define BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED 14 - #define BCM2835_DMA_CHAN_NAME_SIZE 8 -+#define BCM2835_DMA_BULK_MASK BIT(0) - - struct bcm2835_dmadev { - struct dma_device ddev; -@@ -922,6 +924,9 @@ static int bcm2835_dma_probe(struct platform_device *pdev) - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); -+ rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK); -+ if (rc) -+ dev_err(&pdev->dev, "Failed to initialize the legacy API\n"); - - od->base = base; - -@@ -959,6 +964,9 @@ static int bcm2835_dma_probe(struct platform_device *pdev) - goto err_no_dma; - } - -+ /* Channel 0 is used by the legacy API */ -+ chans_available &= ~BCM2835_DMA_BULK_MASK; -+ - /* get irqs for each channel that we support */ - for (i = 0; i <= BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED; i++) { - /* skip masked out channels */ -@@ -1033,6 +1041,7 @@ static int bcm2835_dma_remove(struct platform_device *pdev) - { - struct bcm2835_dmadev *od = platform_get_drvdata(pdev); - -+ bcm_dmaman_remove(pdev); - dma_async_device_unregister(&od->ddev); - bcm2835_dma_free(od); - -@@ -1048,7 +1057,22 @@ static struct platform_driver bcm2835_dma_driver = { - }, - }; - --module_platform_driver(bcm2835_dma_driver); -+static int bcm2835_dma_init(void) -+{ -+ return platform_driver_register(&bcm2835_dma_driver); -+} -+ -+static void bcm2835_dma_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_dma_driver); -+} -+ -+/* -+ * Load after serial driver (arch_initcall) so we see the messages if it fails, -+ * but before drivers (module_init) that need a DMA channel. -+ */ -+subsys_initcall(bcm2835_dma_init); -+module_exit(bcm2835_dma_exit); - - MODULE_ALIAS("platform:bcm2835-dma"); - MODULE_DESCRIPTION("BCM2835 DMA engine driver"); - -From e19d2f37545f78b50f4f82b72099b036f42d2bcd Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 25 Jan 2016 17:25:12 +0000 -Subject: [PATCH 020/122] firmware: Updated mailbox header - ---- - include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 3fb357193f09914fe21f8555a4b8613f74f22bc3..227a107214a02deadcca3db202da265eba1fdd21 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -63,6 +63,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, - RPI_FIRMWARE_GET_TURBO = 0x00030009, - RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, -+ RPI_FIRMWARE_GET_STC = 0x0003000b, - RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, - RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, - RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, -@@ -72,12 +73,15 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, - RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, - RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, -+ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, - RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030, - RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, - RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, - RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, - RPI_FIRMWARE_SET_TURBO = 0x00038009, -+ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, - RPI_FIRMWARE_SET_DOMAIN_STATE = 0x00038030, -+ RPI_FIRMWARE_SET_SDHOST_CLOCK = 0x00038042, - - /* Dispmanx TAGS */ - RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -@@ -91,6 +95,8 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, - RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, - RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, - RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, - RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, - RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, -@@ -100,6 +106,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, - RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, - RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, -+ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, - RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, - RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, - RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, -@@ -108,6 +115,10 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -+ -+ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, - - RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, - RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, - -From 99e1f06dcc2bf78742380b9697c354b627fd02c2 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 9 May 2016 17:28:18 -0700 -Subject: [PATCH 021/122] clk: bcm2835: Mark GPIO clocks enabled at boot as - critical. - -These divide off of PLLD_PER and are used for the ethernet and wifi -PHYs source PLLs. Neither of them is currently represented by a phy -device that would grab the clock for us. - -This keeps other drivers from killing the networking PHYs when they -disable their own clocks and trigger PLLD_PER's refcount going to 0. - -v2: Skip marking as critical if they aren't on at boot. - -Signed-off-by: Eric Anholt ---- - drivers/clk/bcm/clk-bcm2835.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c -index 3bbd2a58db470a89b870a793e59ddf9fc4f48e57..7040c6426e35c11608121893b662c601cd8d6543 100644 ---- a/drivers/clk/bcm/clk-bcm2835.c -+++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1262,6 +1262,15 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, - init.name = data->name; - init.flags = data->flags | CLK_IGNORE_UNUSED; - -+ /* -+ * Some GPIO clocks for ethernet/wifi PLLs are marked as -+ * critical (since some platforms use them), but if the -+ * firmware didn't have them turned on then they clearly -+ * aren't actually critical. -+ */ -+ if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0) -+ init.flags &= ~CLK_IS_CRITICAL; -+ - if (data->is_vpu_clock) { - init.ops = &bcm2835_vpu_clock_clk_ops; - } else { - -From 946babad832c9ed45bbb31fd89fce025a9f7db48 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 15 Jun 2016 16:48:41 +0100 -Subject: [PATCH 022/122] rtc: Add SPI alias for pcf2123 driver - -Without this alias, Device Tree won't cause the driver -to be loaded. - -See: https://github.com/raspberrypi/linux/pull/1510 ---- - drivers/rtc/rtc-pcf2123.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c -index 8895f77726e8da5444afcd602dceff8f25a9b3fd..1833b8853ceb0e6147cceb93a00e558c3a5db10c 100644 ---- a/drivers/rtc/rtc-pcf2123.c -+++ b/drivers/rtc/rtc-pcf2123.c -@@ -472,3 +472,4 @@ module_spi_driver(pcf2123_driver); - MODULE_AUTHOR("Chris Verges "); - MODULE_DESCRIPTION("NXP PCF2123 RTC driver"); - MODULE_LICENSE("GPL"); -+MODULE_ALIAS("spi:rtc-pcf2123"); - -From a929f2b203a1bafb1ca88f7022cb286f28fa98bd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 7 Oct 2016 16:50:59 +0200 -Subject: [PATCH 023/122] watchdog: bcm2835: Support setting reboot partition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Raspberry Pi firmware looks at the RSTS register to know which -partition to boot from. The reboot syscall command -LINUX_REBOOT_CMD_RESTART2 supports passing in a string argument. - -Add support for passing in a partition number 0..63 to boot from. -Partition 63 is a special partiton indicating halt. -If the partition doesn't exist, the firmware falls back to partition 0. - -Signed-off-by: Noralf Trønnes ---- - drivers/watchdog/bcm2835_wdt.c | 61 +++++++++++++++++++++++++----------------- - 1 file changed, 36 insertions(+), 25 deletions(-) - -diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c -index 4dddd8298a227d64862f2e92954a465f2e44b3f6..1f545e024422f59280932713e6a1b05150b39b22 100644 ---- a/drivers/watchdog/bcm2835_wdt.c -+++ b/drivers/watchdog/bcm2835_wdt.c -@@ -35,13 +35,7 @@ - #define PM_RSTC_WRCFG_SET 0x00000030 - #define PM_RSTC_WRCFG_FULL_RESET 0x00000020 - #define PM_RSTC_RESET 0x00000102 -- --/* -- * The Raspberry Pi firmware uses the RSTS register to know which partiton -- * to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10. -- * Partiton 63 is a special partition used by the firmware to indicate halt. -- */ --#define PM_RSTS_RASPBERRYPI_HALT 0x555 -+#define PM_RSTS_PARTITION_CLR 0xfffffaaa - - #define SECS_TO_WDOG_TICKS(x) ((x) << 16) - #define WDOG_TICKS_TO_SECS(x) ((x) >> 16) -@@ -111,15 +105,28 @@ static struct watchdog_device bcm2835_wdt_wdd = { - .timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET), - }; - --static int --bcm2835_restart(struct notifier_block *this, unsigned long mode, void *cmd) -+/* -+ * The Raspberry Pi firmware uses the RSTS register to know which partiton -+ * to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10. -+ * Partiton 63 is a special partition used by the firmware to indicate halt. -+ */ -+ -+static void bcm2835_restart(struct bcm2835_wdt *wdt, u8 partition) - { -- struct bcm2835_wdt *wdt = container_of(this, struct bcm2835_wdt, -- restart_handler); -- u32 val; -+ u32 val, rsts; -+ -+ rsts = (partition & BIT(0)) | ((partition & BIT(1)) << 1) | -+ ((partition & BIT(2)) << 2) | ((partition & BIT(3)) << 3) | -+ ((partition & BIT(4)) << 4) | ((partition & BIT(5)) << 5); -+ -+ val = readl_relaxed(wdt->base + PM_RSTS); -+ val &= PM_RSTS_PARTITION_CLR; -+ val |= PM_PASSWORD | rsts; -+ writel_relaxed(val, wdt->base + PM_RSTS); - - /* use a timeout of 10 ticks (~150us) */ - writel_relaxed(10 | PM_PASSWORD, wdt->base + PM_WDOG); -+ - val = readl_relaxed(wdt->base + PM_RSTC); - val &= PM_RSTC_WRCFG_CLR; - val |= PM_PASSWORD | PM_RSTC_WRCFG_FULL_RESET; -@@ -127,6 +134,20 @@ bcm2835_restart(struct notifier_block *this, unsigned long mode, void *cmd) - - /* No sleeping, possibly atomic. */ - mdelay(1); -+} -+ -+static int bcm2835_restart_notifier_call(struct notifier_block *this, -+ unsigned long mode, void *cmd) -+{ -+ struct bcm2835_wdt *wdt = container_of(this, struct bcm2835_wdt, -+ restart_handler); -+ unsigned long long val; -+ u8 partition = 0; -+ -+ if (cmd && !kstrtoull(cmd, 0, &val) && val <= 63) -+ partition = val; -+ -+ bcm2835_restart(wdt, partition); - - return 0; - } -@@ -142,19 +163,9 @@ static void bcm2835_power_off(void) - of_find_compatible_node(NULL, NULL, "brcm,bcm2835-pm-wdt"); - struct platform_device *pdev = of_find_device_by_node(np); - struct bcm2835_wdt *wdt = platform_get_drvdata(pdev); -- u32 val; -- -- /* -- * We set the watchdog hard reset bit here to distinguish this reset -- * from the normal (full) reset. bootcode.bin will not reboot after a -- * hard reset. -- */ -- val = readl_relaxed(wdt->base + PM_RSTS); -- val |= PM_PASSWORD | PM_RSTS_RASPBERRYPI_HALT; -- writel_relaxed(val, wdt->base + PM_RSTS); - -- /* Continue with normal reset mechanism */ -- bcm2835_restart(&wdt->restart_handler, REBOOT_HARD, NULL); -+ /* Partition 63 tells the firmware that this is a halt */ -+ bcm2835_restart(wdt, 63); - } - - static int bcm2835_wdt_probe(struct platform_device *pdev) -@@ -188,7 +199,7 @@ static int bcm2835_wdt_probe(struct platform_device *pdev) - return err; - } - -- wdt->restart_handler.notifier_call = bcm2835_restart; -+ wdt->restart_handler.notifier_call = bcm2835_restart_notifier_call; - wdt->restart_handler.priority = 128; - register_restart_handler(&wdt->restart_handler); - if (pm_power_off == NULL) - -From 2e7833eae38410bc31d3a86166868a55d0999394 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 Apr 2016 19:40:12 +0100 -Subject: [PATCH 024/122] reboot: Use power off rather than busy spinning when - halt is requested - ---- - arch/arm/kernel/reboot.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c -index 3fa867a2aae672755c6ce6448f4148c989dbf964..80dca8dcd6709034b643c6a3f35729e00fb59a19 100644 ---- a/arch/arm/kernel/reboot.c -+++ b/arch/arm/kernel/reboot.c -@@ -102,9 +102,7 @@ void machine_shutdown(void) - */ - void machine_halt(void) - { -- local_irq_disable(); -- smp_send_stop(); -- while (1); -+ machine_power_off(); - } - - /* - -From 0d4700ca51eb31fa70e10da67fa92e986275f2d3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 9 Nov 2016 13:02:52 +0000 -Subject: [PATCH 025/122] bcm: Make RASPBERRYPI_POWER depend on PM - ---- - drivers/soc/bcm/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig -index a39b0d58ddd0fdf0ac1cc7295f8aafb12546e226..e037a6dd79d1881a09e3ca911578270917888846 100644 ---- a/drivers/soc/bcm/Kconfig -+++ b/drivers/soc/bcm/Kconfig -@@ -4,6 +4,7 @@ config RASPBERRYPI_POWER - bool "Raspberry Pi power domain driver" - depends on ARCH_BCM2835 || (COMPILE_TEST && OF) - depends on RASPBERRYPI_FIRMWARE=y -+ depends on PM - select PM_GENERIC_DOMAINS if PM - help - This enables support for the RPi power domains which can be enabled - -From 53b503a7256d432bfa51f5ffba58a446c2cc6ebb Mon Sep 17 00:00:00 2001 -From: Martin Sperl -Date: Fri, 2 Sep 2016 16:45:27 +0100 -Subject: [PATCH 026/122] Register the clocks early during the boot process, so - that special/critical clocks can get enabled early on in the boot process - avoiding the risk of disabling a clock, pll_divider or pll when a claiming - driver fails to install propperly - maybe it needs to defer. - -Signed-off-by: Martin Sperl ---- - drivers/clk/bcm/clk-bcm2835.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c -index 7040c6426e35c11608121893b662c601cd8d6543..21e2a538ff0d0ab4e63adff9b93705f3d45fa15d 100644 ---- a/drivers/clk/bcm/clk-bcm2835.c -+++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1903,8 +1903,15 @@ static int bcm2835_clk_probe(struct platform_device *pdev) - if (ret) - return ret; - -- return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, -+ ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, - &cprman->onecell); -+ if (ret) -+ return ret; -+ -+ /* note that we have registered all the clocks */ -+ dev_dbg(dev, "registered %d clocks\n", asize); -+ -+ return 0; - } - - static const struct of_device_id bcm2835_clk_of_match[] = { -@@ -1921,7 +1928,11 @@ static struct platform_driver bcm2835_clk_driver = { - .probe = bcm2835_clk_probe, - }; - --builtin_platform_driver(bcm2835_clk_driver); -+static int __init __bcm2835_clk_driver_init(void) -+{ -+ return platform_driver_register(&bcm2835_clk_driver); -+} -+core_initcall(__bcm2835_clk_driver_init); - - MODULE_AUTHOR("Eric Anholt "); - MODULE_DESCRIPTION("BCM2835 clock driver"); - -From e367c208dc6a9d92e5c0d6e5e089e7b56c7cf189 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 6 Dec 2016 17:05:39 +0000 -Subject: [PATCH 027/122] bcm2835-rng: Avoid initialising if already enabled - -Avoids the 0x40000 cycles of warmup again if firmware has already used it ---- - drivers/char/hw_random/bcm2835-rng.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c -index 574211a495491d9d6021dcaefe4274a63ed02055..e66c0fca8c6090e32f72796c0877a1cf1d499fb6 100644 ---- a/drivers/char/hw_random/bcm2835-rng.c -+++ b/drivers/char/hw_random/bcm2835-rng.c -@@ -102,9 +102,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev) - rng_setup(rng_base); - - /* set warm-up count & enable */ -- __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS); -- __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL); -- -+ if (!(__raw_readl(rng_base + RNG_CTRL) & RNG_RBGEN)) { -+ __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS); -+ __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL); -+ } - /* register driver */ - err = hwrng_register(&bcm2835_rng_ops); - if (err) { - -From da0b1ac76230b33baa5cd0391388d32d43889d69 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 24 Aug 2016 16:28:44 +0100 -Subject: [PATCH 028/122] kbuild: Ignore dtco targets when filtering symbols - ---- - scripts/Kbuild.include | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include -index 179219845dfcdfbeb586d12c5ec1296095d9fbf4..e0743e44f84188667a0c322e8c3d36f18385dcd3 100644 ---- a/scripts/Kbuild.include -+++ b/scripts/Kbuild.include -@@ -284,7 +284,7 @@ ksym_dep_filter = \ - $(CPP) $(call flags_nodeps,c_flags) -D__KSYM_DEPS__ $< ;; \ - as_*_S|cpp_s_S) \ - $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \ -- boot*|build*|*cpp_lds_S|dtc|host*|vdso*) : ;; \ -+ boot*|build*|*cpp_lds_S|dtc*|host*|vdso*) : ;; \ - *) echo "Don't know how to preprocess $(1)" >&2; false ;; \ - esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' - - -From f96bacbe5b20000d29c0b1bc81f66f5b15231b48 Mon Sep 17 00:00:00 2001 -From: Robert Tiemann -Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 029/122] BCM2835_DT: Fix I2S register map - ---- - Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- - Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt -index baf9b34d20bfb5b5493e0a69841362530c900a77..11c052acf65e74f032ae77bfd2749db860762b2d 100644 ---- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt -+++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt -@@ -74,8 +74,8 @@ Example: - - bcm2835_i2s: i2s@7e203000 { - compatible = "brcm,bcm2835-i2s"; -- reg = < 0x7e203000 0x20>, -- < 0x7e101098 0x02>; -+ reg = < 0x7e203000 0x24>, -+ < 0x7e101098 0x08>; - - dmas = <&dma 2>, - <&dma 3>; -diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt -index 65783de0aedf3da79adc36fd077b7a89954ddb6b..a89fe4220fdc3f26f75ee66daf187554427118a2 100644 ---- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt -+++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt -@@ -16,8 +16,8 @@ Example: - - bcm2835_i2s: i2s@7e203000 { - compatible = "brcm,bcm2835-i2s"; -- reg = <0x7e203000 0x20>, -- <0x7e101098 0x02>; -+ reg = <0x7e203000 0x24>, -+ <0x7e101098 0x08>; - - dmas = <&dma 2>, - <&dma 3>; - -From 967e1d016f69607cb5f1d8337f9249ef31e19d81 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 030/122] Main bcm2708/bcm2709 linux port -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix -Signed-off-by: Noralf Trønnes - -bcm2709: Drop platform smp and timer init code - -irq-bcm2836 handles this through these functions: -bcm2835_init_local_timer_frequency() -bcm2836_arm_irqchip_smp_init() - -Signed-off-by: Noralf Trønnes - -bcm270x: Use watchdog for reboot/poweroff - -The watchdog driver already has support for reboot/poweroff. -Make use of this and remove the code from the platform files. - -Signed-off-by: Noralf Trønnes ---- - arch/arm/mach-bcm/Kconfig | 1 + - arch/arm/mach-bcm/board_bcm2835.c | 17 +++++++++++++++++ - arch/arm/mm/proc-v6.S | 15 ++++++++++++--- - drivers/irqchip/irq-bcm2835.c | 7 ++++++- - drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- - 5 files changed, 52 insertions(+), 6 deletions(-) - -diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 4ff30d5278a7ce093c9629d4c25d37e3bbbda752..333dc3c2e5ffbb2c5ab8fcfb6115b6162643cf20 100644 ---- a/arch/arm/mach-bcm/Kconfig -+++ b/arch/arm/mach-bcm/Kconfig -@@ -155,6 +155,7 @@ config ARCH_BCM2835 - select FIQ - select PINCTRL - select PINCTRL_BCM2835 -+ select MFD_SYSCON if ARCH_MULTI_V7 - help - This enables support for the Broadcom BCM2835 and BCM2836 SoCs. - This SoC is used in the Raspberry Pi and Roku 2 devices. -diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 8f152266ba9b470df2eaaed9ebcf158ed2079834..133338f0a21237fda9b7660d2c57a33b991f08ae 100644 ---- a/arch/arm/mach-bcm/board_bcm2835.c -+++ b/arch/arm/mach-bcm/board_bcm2835.c -@@ -16,17 +16,21 @@ - #include - #include - #include -+#include - #include - - #include - #include - -+#include -+ - static void __init bcm2835_init(void) - { - struct device_node *np = of_find_node_by_path("/system"); - u32 val; - u64 val64; - -+ vc_cma_early_init(); - bcm2835_init_clocks(); - - if (!of_property_read_u32(np, "linux,revision", &val)) -@@ -35,6 +39,17 @@ static void __init bcm2835_init(void) - system_serial_low = val64; - } - -+static void __init bcm2835_init_early(void) -+{ -+ /* dwc_otg needs this for bounce buffers on non-aligned transfers */ -+ init_dma_coherent_pool_size(SZ_1M); -+} -+ -+static void __init bcm2835_board_reserve(void) -+{ -+ vc_cma_reserve(); -+} -+ - static const char * const bcm2835_compat[] = { - #ifdef CONFIG_ARCH_MULTI_V6 - "brcm,bcm2835", -@@ -47,5 +62,7 @@ static const char * const bcm2835_compat[] = { - - DT_MACHINE_START(BCM2835, "BCM2835") - .init_machine = bcm2835_init, -+ .reserve = bcm2835_board_reserve, -+ .init_early = bcm2835_init_early, - .dt_compat = bcm2835_compat - MACHINE_END -diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S -index 06d890a2342b1600e2eae6e350994ad59f5c3a08..30d96e81c0e052c725bdb00bb3df56194023ab9f 100644 ---- a/arch/arm/mm/proc-v6.S -+++ b/arch/arm/mm/proc-v6.S -@@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset) - * - * IRQs are already disabled. - */ -+ -+/* See jira SW-5991 for details of this workaround */ - ENTRY(cpu_v6_do_idle) -- mov r1, #0 -- mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode -- mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt -+ .align 5 -+ mov r1, #2 -+1: subs r1, #1 -+ nop -+ mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode -+ mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt -+ nop -+ nop -+ nop -+ bne 1b - ret lr - - ENTRY(cpu_v6_dcache_clean_area) -diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c -index eccf6ed025299cb480884f5bcbe77abf55a6bbb1..8ed457fd74bd23bee27b64a2c9e3828ce0e4fb87 100644 ---- a/drivers/irqchip/irq-bcm2835.c -+++ b/drivers/irqchip/irq-bcm2835.c -@@ -54,7 +54,9 @@ - #include - - #include -+#ifndef CONFIG_ARM64 - #include -+#endif - - /* Put the bank and irq (32 bits) into the hwirq */ - #define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) -@@ -82,6 +84,7 @@ - #define NR_BANKS 3 - #define IRQS_PER_BANK 32 - #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) -+#undef FIQ_START - #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) - - static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; -@@ -256,10 +259,12 @@ static int __init armctrl_of_init(struct device_node *node, - MAKE_HWIRQ(b, i) + NUMBER_IRQS); - BUG_ON(irq <= 0); - irq_set_chip(irq, &armctrl_chip); -- set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); -+ irq_set_probe(irq); - } - } -+#ifndef CONFIG_ARM64 - init_FIQ(FIQ_START); -+#endif - - return 0; - } -diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c -index cfb4b4496dd9f61362dea012176c146120fada07..d9c6c217c4d6a2408abe2665bf7f27006f4edd15 100644 ---- a/drivers/mailbox/bcm2835-mailbox.c -+++ b/drivers/mailbox/bcm2835-mailbox.c -@@ -51,12 +51,15 @@ - #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) - #define MAIL1_STA (ARM_0_MAIL1 + 0x18) - -+/* On ARCH_BCM270x these come through (arm_control.h ) */ -+#ifndef ARM_MS_FULL - /* Status register: FIFO state. */ - #define ARM_MS_FULL BIT(31) - #define ARM_MS_EMPTY BIT(30) - - /* Configuration register: Enable interrupts. */ - #define ARM_MC_IHAVEDATAIRQEN BIT(0) -+#endif - - struct bcm2835_mbox { - void __iomem *regs; -@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) - return -ENOMEM; - spin_lock_init(&mbox->lock); - -- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), -+ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), - bcm2835_mbox_irq, 0, dev_name(dev), mbox); - if (ret) { - dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", -@@ -209,7 +212,18 @@ static struct platform_driver bcm2835_mbox_driver = { - .probe = bcm2835_mbox_probe, - .remove = bcm2835_mbox_remove, - }; --module_platform_driver(bcm2835_mbox_driver); -+ -+static int __init bcm2835_mbox_init(void) -+{ -+ return platform_driver_register(&bcm2835_mbox_driver); -+} -+arch_initcall(bcm2835_mbox_init); -+ -+static void __init bcm2835_mbox_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_mbox_driver); -+} -+module_exit(bcm2835_mbox_exit); - - MODULE_AUTHOR("Lubomir Rintel "); - MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); - -From 9ccdf13082f318de0091066517c7f7309b245456 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 031/122] Add dwc_otg driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -usb: dwc: fix lockdep false positive - -Signed-off-by: Kari Suvanto - -usb: dwc: fix inconsistent lock state - -Signed-off-by: Kari Suvanto - -Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance. -Thanks to Gordon and Costas - -Avoid dynamic memory allocation for channel lock in USB driver. Thanks ddv2005. - -Add NAK holdoff scheme. Enabled by default, disable with dwc_otg.nak_holdoff_enable=0. Thanks gsh - -Make sure we wait for the reset to finish - -dwc_otg: fix bug in dwc_otg_hcd.c resulting in silent kernel - memory corruption, escalating to OOPS under high USB load. - -dwc_otg: Fix unsafe access of QTD during URB enqueue - -In dwc_otg_hcd_urb_enqueue during qtd creation, it was possible that the -transaction could complete almost immediately after the qtd was assigned -to a host channel during URB enqueue, which meant the qtd pointer was no -longer valid having been completed and removed. Usually, this resulted in -an OOPS during URB submission. By predetermining whether transactions -need to be queued or not, this unsafe pointer access is avoided. - -This bug was only evident on the Pi model A where a device was attached -that had no periodic endpoints (e.g. USB pendrive or some wlan devices). - -dwc_otg: Fix incorrect URB allocation error handling - -If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS -because for some reason a member of the *unallocated* struct was set to -zero. Error handling changed to fail correctly. - -dwc_otg: fix potential use-after-free case in interrupt handler - -If a transaction had previously aborted, certain interrupts are -enabled to track error counts and reset where necessary. On IN -endpoints the host generates an ACK interrupt near-simultaneously -with completion of transfer. In the case where this transfer had -previously had an error, this results in a use-after-free on -the QTD memory space with a 1-byte length being overwritten to -0x00. - -dwc_otg: add handling of SPLIT transaction data toggle errors - -Previously a data toggle error on packets from a USB1.1 device behind -a TT would result in the Pi locking up as the driver never handled -the associated interrupt. Patch adds basic retry mechanism and -interrupt acknowledgement to cater for either a chance toggle error or -for devices that have a broken initial toggle state (FT8U232/FT232BM). - -dwc_otg: implement tasklet for returning URBs to usbcore hcd layer - -The dwc_otg driver interrupt handler for transfer completion will spend -a very long time with interrupts disabled when a URB is completed - -this is because usb_hcd_giveback_urb is called from within the handler -which for a USB device driver with complicated processing (e.g. webcam) -will take an exorbitant amount of time to complete. This results in -missed completion interrupts for other USB packets which lead to them -being dropped due to microframe overruns. - -This patch splits returning the URB to the usb hcd layer into a -high-priority tasklet. This will have most benefit for isochronous IN -transfers but will also have incidental benefit where multiple periodic -devices are active at once. - -dwc_otg: fix NAK holdoff and allow on split transactions only - -This corrects a bug where if a single active non-periodic endpoint -had at least one transaction in its qh, on frnum == MAX_FRNUM the qh -would get skipped and never get queued again. This would result in -a silent device until error detection (automatic or otherwise) would -either reset the device or flush and requeue the URBs. - -Additionally the NAK holdoff was enabled for all transactions - this -would potentially stall a HS endpoint for 1ms if a previous error state -enabled this interrupt and the next response was a NAK. Fix so that -only split transactions get held off. - -dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler - -usb_hcd_unlink_urb_from_ep must be called with the HCD lock held. Calling it -asynchronously in the tasklet was not safe (regression in -c4564d4a1a0a9b10d4419e48239f5d99e88d2667). - -This change unlinks it from the endpoint prior to queueing it for handling in -the tasklet, and also adds a check to ensure the urb is OK to be unlinked -before doing so. - -NULL pointer dereference kernel oopses had been observed in usb_hcd_giveback_urb -when a USB device was unplugged/replugged during data transfer. This effect -was reproduced using automated USB port power control, hundreds of replug -events were performed during active transfers to confirm that the problem was -eliminated. - -USB fix using a FIQ to implement split transactions - -This commit adds a FIQ implementaion that schedules -the split transactions using a FIQ so we don't get -held off by the interrupt latency of Linux - -dwc_otg: fix device attributes and avoid kernel warnings on boot - -dcw_otg: avoid logging function that can cause panics - -See: https://github.com/raspberrypi/firmware/issues/21 -Thanks to cleverca22 for fix - -dwc_otg: mask correct interrupts after transaction error recovery - -The dwc_otg driver will unmask certain interrupts on a transaction -that previously halted in the error state in order to reset the -QTD error count. The various fine-grained interrupt handlers do not -consider that other interrupts besides themselves were unmasked. - -By disabling the two other interrupts only ever enabled in DMA mode -for this purpose, we can avoid unnecessary function calls in the -IRQ handler. This will also prevent an unneccesary FIQ interrupt -from being generated if the FIQ is enabled. - -dwc_otg: fiq: prevent FIQ thrash and incorrect state passing to IRQ - -In the case of a transaction to a device that had previously aborted -due to an error, several interrupts are enabled to reset the error -count when a device responds. This has the side-effect of making the -FIQ thrash because the hardware will generate multiple instances of -a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK -on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the -associated interrupts. - -Additionally, on non-split transactions make sure that only unmasked -interrupts are cleared. This caused a hard-to-trigger but serious -race condition when you had the combination of an endpoint awaiting -error recovery and a transaction completed on an endpoint - due to -the sequencing and timing of interrupts generated by the dwc_otg core, -it was possible to confuse the IRQ handler. - -Fix function tracing - -dwc_otg: whitespace cleanup in dwc_otg_urb_enqueue - -dwc_otg: prevent OOPSes during device disconnects - -The dwc_otg_urb_enqueue function is thread-unsafe. In particular the -access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and -friends does not occur within a critical section and so if a device -was unplugged during activity there was a high chance that the -usbcore hub_thread would try to disable the endpoint with partially- -formed entries in the URB queue. This would result in BUG() or null -pointer dereferences. - -Fix so that access of urb->hcpriv, enqueuing to the hardware and -adding to usbcore endpoint URB lists is contained within a single -critical section. - -dwc_otg: prevent BUG() in TT allocation if hub address is > 16 - -A fixed-size array is used to track TT allocation. This was -previously set to 16 which caused a crash because -dwc_otg_hcd_allocate_port would read past the end of the array. - -This was hit if a hub was plugged in which enumerated as addr > 16, -due to previous device resets or unplugs. - -Also add #ifdef FIQ_DEBUG around hcd->hub_port_alloc[], which grows -to a large size if 128 hub addresses are supported. This field is -for debug only for tracking which frame an allocate happened in. - -dwc_otg: make channel halts with unknown state less damaging - -If the IRQ received a channel halt interrupt through the FIQ -with no other bits set, the IRQ would not release the host -channel and never complete the URB. - -Add catchall handling to treat as a transaction error and retry. - -dwc_otg: fiq_split: use TTs with more granularity - -This fixes certain issues with split transaction scheduling. - -- Isochronous multi-packet OUT transactions now hog the TT until - they are completed - this prevents hubs aborting transactions - if they get a periodic start-split out-of-order -- Don't perform TT allocation on non-periodic endpoints - this - allows simultaneous use of the TT's bulk/control and periodic - transaction buffers - -This commit will mainly affect USB audio playback. - -dwc_otg: fix potential sleep while atomic during urb enqueue - -Fixes a regression introduced with eb1b482a. Kmalloc called from -dwc_otg_hcd_qtd_add / dwc_otg_hcd_qtd_create did not always have -the GPF_ATOMIC flag set. Force this flag when inside the larger -critical section. - -dwc_otg: make fiq_split_enable imply fiq_fix_enable - -Failing to set up the FIQ correctly would result in -"IRQ 32: nobody cared" errors in dmesg. - -dwc_otg: prevent crashes on host port disconnects - -Fix several issues resulting in crashes or inconsistent state -if a Model A root port was disconnected. - -- Clean up queue heads properly in kill_urbs_in_qh_list by - removing the empty QHs from the schedule lists -- Set the halt status properly to prevent IRQ handlers from - using freed memory -- Add fiq_split related cleanup for saved registers -- Make microframe scheduling reclaim host channels if - active during a disconnect -- Abort URBs with -ESHUTDOWN status response, informing - device drivers so they respond in a more correct fashion - and don't try to resubmit URBs -- Prevent IRQ handlers from attempting to handle channel - interrupts if the associated URB was dequeued (and the - driver state was cleared) - -dwc_otg: prevent leaking URBs during enqueue - -A dwc_otg_urb would get leaked if the HCD enqueue function -failed for any reason. Free the URB at the appropriate points. - -dwc_otg: Enable NAK holdoff for control split transactions - -Certain low-speed devices take a very long time to complete a -data or status stage of a control transaction, producing NAK -responses until they complete internal processing - the USB2.0 -spec limit is up to 500mS. This causes the same type of interrupt -storm as seen with USB-serial dongles prior to c8edb238. - -In certain circumstances, usually while booting, this interrupt -storm could cause SD card timeouts. - -dwc_otg: Fix for occasional lockup on boot when doing a USB reset - -dwc_otg: Don't issue traffic to LS devices in FS mode - -Issuing low-speed packets when the root port is in full-speed mode -causes the root port to stop responding. Explicitly fail when -enqueuing URBs to a LS endpoint on a FS bus. - -Fix ARM architecture issue with local_irq_restore() - -If local_fiq_enable() is called before a local_irq_restore(flags) where -the flags variable has the F bit set, the FIQ will be erroneously disabled. - -Fixup arch_local_irq_restore to avoid trampling the F bit in CPSR. - -Also fix some of the hacks previously implemented for previous dwc_otg -incarnations. - -dwc_otg: fiq_fsm: Base commit for driver rewrite - -This commit removes the previous FIQ fixes entirely and adds fiq_fsm. - -This rewrite features much more complete support for split transactions -and takes into account several OTG hardware bugs. High-speed -isochronous transactions are also capable of being performed by fiq_fsm. - -All driver options have been removed and replaced with: - - dwc_otg.fiq_enable (bool) - - dwc_otg.fiq_fsm_enable (bool) - - dwc_otg.fiq_fsm_mask (bitmask) - - dwc_otg.nak_holdoff (unsigned int) - -Defaults are specified such that fiq_fsm behaves similarly to the -previously implemented FIQ fixes. - -fiq_fsm: Push error recovery into the FIQ when fiq_fsm is used - -If the transfer associated with a QTD failed due to a bus error, the HCD -would retry the transfer up to 3 times (implementing the USB2.0 -three-strikes retry in software). - -Due to the masking mechanism used by fiq_fsm, it is only possible to pass -a single interrupt through to the HCD per-transfer. - -In this instance host channels would fall off the radar because the error -reset would function, but the subsequent channel halt would be lost. - -Push the error count reset into the FIQ handler. - -fiq_fsm: Implement timeout mechanism - -For full-speed endpoints with a large packet size, interrupt latency -runs the risk of the FIQ starting a transaction too late in a full-speed -frame. If the device is still transmitting data when EOF2 for the -downstream frame occurs, the hub will disable the port. This change is -not reflected in the hub status endpoint and the device becomes -unresponsive. - -Prevent high-bandwidth transactions from being started too late in a -frame. The mechanism is not guaranteed: a combination of bit stuffing -and hub latency may still result in a device overrunning. - -fiq_fsm: fix bounce buffer utilisation for Isochronous OUT - -Multi-packet isochronous OUT transactions were subject to a few bounday -bugs. Fix them. - -Audio playback is now much more robust: however, an issue stands with -devices that have adaptive sinks - ALSA plays samples too fast. - -dwc_otg: Return full-speed frame numbers in HS mode - -The frame counter increments on every *microframe* in high-speed mode. -Most device drivers expect this number to be in full-speed frames - this -caused considerable confusion to e.g. snd_usb_audio which uses the -frame counter to estimate the number of samples played. - -fiq_fsm: save PID on completion of interrupt OUT transfers - -Also add edge case handling for interrupt transports. - -Note that for periodic split IN, data toggles are unimplemented in the -OTG host hardware - it unconditionally accepts any PID. - -fiq_fsm: add missing case for fiq_fsm_tt_in_use() - -Certain combinations of bitrate and endpoint activity could -result in a periodic transaction erroneously getting started -while the previous Isochronous OUT was still active. - -fiq_fsm: clear hcintmsk for aborted transactions - -Prevents the FIQ from erroneously handling interrupts -on a timed out channel. - -fiq_fsm: enable by default - -fiq_fsm: fix dequeues for non-periodic split transactions - -If a dequeue happened between the SSPLIT and CSPLIT phases of the -transaction, the HCD would never receive an interrupt. - -fiq_fsm: Disable by default - -fiq_fsm: Handle HC babble errors - -The HCTSIZ transfer size field raises a babble interrupt if -the counter wraps. Handle the resulting interrupt in this case. - -dwc_otg: fix interrupt registration for fiq_enable=0 - -Additionally make the module parameter conditional for wherever -hcd->fiq_state is touched. - -fiq_fsm: Enable by default - -dwc_otg: Fix various issues with root port and transaction errors - -Process the host port interrupts correctly (and don't trample them). -Root port hotplug now functional again. - -Fix a few thinkos with the transaction error passthrough for fiq_fsm. - -fiq_fsm: Implement hack for Split Interrupt transactions - -Hubs aren't too picky about which endpoint we send Control type split -transactions to. By treating Interrupt transfers as Control, it is -possible to use the non-periodic queue in the OTG core as well as the -non-periodic FIFOs in the hub itself. This massively reduces the -microframe exclusivity/contention that periodic split transactions -otherwise have to enforce. - -It goes without saying that this is a fairly egregious USB specification -violation, but it works. - -Original idea by Hans Petter Selasky @ FreeBSD.org. - -dwc_otg: FIQ support on SMP. Set up FIQ stack and handler on Core 0 only. - -dwc_otg: introduce fiq_fsm_spin(un|)lock() - -SMP safety for the FIQ relies on register read-modify write cycles being -completed in the correct order. Several places in the DWC code modify -registers also touched by the FIQ. Protect these by a bare-bones lock -mechanism. - -This also makes it possible to run the FIQ and IRQ handlers on different -cores. - -fiq_fsm: fix build on bcm2708 and bcm2709 platforms - -dwc_otg: put some barriers back where they should be for UP - -bcm2709/dwc_otg: Setup FIQ on core 1 if >1 core active - -dwc_otg: fixup read-modify-write in critical paths - -Be more careful about read-modify-write on registers that the FIQ -also touches. - -Guard fiq_fsm_spin_lock with fiq_enable check - -fiq_fsm: Falling out of the state machine isn't fatal - -This edge case can be hit if the port is disabled while the FIQ is -in the middle of a transaction. Make the effects less severe. - -Also get rid of the useless return value. - -squash: dwc_otg: Allow to build without SMP - -usb: core: make overcurrent messages more prominent - -Hub overcurrent messages are more serious than "debug". Increase loglevel. - -usb: dwc_otg: Don't use dma_to_virt() - -Commit 6ce0d20 changes dma_to_virt() which breaks this driver. -Open code the old dma_to_virt() implementation to work around this. - -Limit the use of __bus_to_virt() to cases where transfer_buffer_length -is set and transfer_buffer is not set. This is done to increase the -chance that this driver will also work on ARCH_BCM2835. - -transfer_buffer should not be NULL if the length is set, but the -comment in the code indicates that there are situations where this -might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar -comment pointing to a possible: 'usb storage / SCSI bug'. - -Signed-off-by: Noralf Trønnes - -dwc_otg: Fix crash when fiq_enable=0 - -dwc_otg: fiq_fsm: Make high-speed isochronous strided transfers work properly - -Certain low-bandwidth high-speed USB devices (specialist audio devices, -compressed-frame webcams) have packet intervals > 1 microframe. - -Stride these transfers in the FIQ by using the start-of-frame interrupt -to restart the channel at the right time. - -dwc_otg: Force host mode to fix incorrect compute module boards - -dwc_otg: Add ARCH_BCM2835 support - -Signed-off-by: Noralf Trønnes - -dwc_otg: Simplify FIQ irq number code - -Dropping ATAGS means we can simplify the FIQ irq number code. -Also add error checking on the returned irq number. - -Signed-off-by: Noralf Trønnes - -dwc_otg: Remove duplicate gadget probe/unregister function - -dwc_otg: Properly set the HFIR - -Douglas Anderson reported: - -According to the most up to date version of the dwc2 databook, the FRINT -field of the HFIR register should be programmed to: -* 125 us * (PHY clock freq for HS) - 1 -* 1000 us * (PHY clock freq for FS/LS) - 1 - -This is opposed to older versions of the doc that claimed it should be: -* 125 us * (PHY clock freq for HS) -* 1000 us * (PHY clock freq for FS/LS) - -and reported lower timing jitter on a USB analyser - -dcw_otg: trim xfer length when buffer larger than allocated size is received - -dwc_otg: Don't free qh align buffers in atomic context - -dwc_otg: Enable the hack for Split Interrupt transactions by default - -dwc_otg.fiq_fsm_mask=0xF has long been a suggestion for users with audio stutters or other USB bandwidth issues. -So far we are aware of many success stories but no failure caused by this setting. -Make it a default to learn more. - -See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=70437 - -Signed-off-by: popcornmix - -dwc_otg: Use kzalloc when suitable - -dwc_otg: Pass struct device to dma_alloc*() - -This makes it possible to get the bus address from Device Tree. - -Signed-off-by: Noralf Trønnes ---- - arch/arm/include/asm/irqflags.h | 16 +- - arch/arm/kernel/fiqasm.S | 4 + - drivers/usb/Makefile | 1 + - drivers/usb/core/generic.c | 1 + - drivers/usb/core/hub.c | 2 +- - drivers/usb/core/message.c | 79 + - drivers/usb/core/otg_whitelist.h | 114 +- - drivers/usb/gadget/file_storage.c | 3676 ++++++++++ - drivers/usb/host/Kconfig | 13 + - drivers/usb/host/Makefile | 2 + - drivers/usb/host/dwc_common_port/Makefile | 58 + - drivers/usb/host/dwc_common_port/Makefile.fbsd | 17 + - drivers/usb/host/dwc_common_port/Makefile.linux | 49 + - drivers/usb/host/dwc_common_port/changes.txt | 174 + - drivers/usb/host/dwc_common_port/doc/doxygen.cfg | 270 + - drivers/usb/host/dwc_common_port/dwc_cc.c | 532 ++ - drivers/usb/host/dwc_common_port/dwc_cc.h | 224 + - drivers/usb/host/dwc_common_port/dwc_common_fbsd.c | 1308 ++++ - .../usb/host/dwc_common_port/dwc_common_linux.c | 1418 ++++ - drivers/usb/host/dwc_common_port/dwc_common_nbsd.c | 1275 ++++ - drivers/usb/host/dwc_common_port/dwc_crypto.c | 308 + - drivers/usb/host/dwc_common_port/dwc_crypto.h | 111 + - drivers/usb/host/dwc_common_port/dwc_dh.c | 291 + - drivers/usb/host/dwc_common_port/dwc_dh.h | 106 + - drivers/usb/host/dwc_common_port/dwc_list.h | 594 ++ - drivers/usb/host/dwc_common_port/dwc_mem.c | 245 + - drivers/usb/host/dwc_common_port/dwc_modpow.c | 636 ++ - drivers/usb/host/dwc_common_port/dwc_modpow.h | 34 + - drivers/usb/host/dwc_common_port/dwc_notifier.c | 319 + - drivers/usb/host/dwc_common_port/dwc_notifier.h | 122 + - drivers/usb/host/dwc_common_port/dwc_os.h | 1276 ++++ - drivers/usb/host/dwc_common_port/usb.h | 946 +++ - drivers/usb/host/dwc_otg/Makefile | 82 + - drivers/usb/host/dwc_otg/doc/doxygen.cfg | 224 + - drivers/usb/host/dwc_otg/dummy_audio.c | 1574 +++++ - drivers/usb/host/dwc_otg/dwc_cfi_common.h | 142 + - drivers/usb/host/dwc_otg/dwc_otg_adp.c | 854 +++ - drivers/usb/host/dwc_otg/dwc_otg_adp.h | 80 + - drivers/usb/host/dwc_otg/dwc_otg_attr.c | 1210 ++++ - drivers/usb/host/dwc_otg/dwc_otg_attr.h | 89 + - drivers/usb/host/dwc_otg/dwc_otg_cfi.c | 1876 +++++ - drivers/usb/host/dwc_otg/dwc_otg_cfi.h | 320 + - drivers/usb/host/dwc_otg/dwc_otg_cil.c | 7141 ++++++++++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_cil.h | 1464 ++++ - drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c | 1594 +++++ - drivers/usb/host/dwc_otg/dwc_otg_core_if.h | 705 ++ - drivers/usb/host/dwc_otg/dwc_otg_dbg.h | 117 + - drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1757 +++++ - drivers/usb/host/dwc_otg/dwc_otg_driver.h | 86 + - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 1355 ++++ - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 370 + - drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S | 80 + - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 4260 ++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 868 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1139 ++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2727 ++++++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1005 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 963 +++ - drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + - drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2725 ++++++++ - drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 273 + - drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h | 361 + - drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 5148 ++++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c | 1280 ++++ - drivers/usb/host/dwc_otg/dwc_otg_regs.h | 2550 +++++++ - drivers/usb/host/dwc_otg/test/Makefile | 16 + - drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + - drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + - drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + - 70 files changed, 59908 insertions(+), 16 deletions(-) - create mode 100644 drivers/usb/gadget/file_storage.c - create mode 100644 drivers/usb/host/dwc_common_port/Makefile - create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd - create mode 100644 drivers/usb/host/dwc_common_port/Makefile.linux - create mode 100644 drivers/usb/host/dwc_common_port/changes.txt - create mode 100644 drivers/usb/host/dwc_common_port/doc/doxygen.cfg - create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_cc.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_fbsd.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_linux.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_common_nbsd.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_crypto.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_dh.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_list.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_mem.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_modpow.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.c - create mode 100644 drivers/usb/host/dwc_common_port/dwc_notifier.h - create mode 100644 drivers/usb/host/dwc_common_port/dwc_os.h - create mode 100644 drivers/usb/host/dwc_common_port/usb.h - create mode 100644 drivers/usb/host/dwc_otg/Makefile - create mode 100644 drivers/usb/host/dwc_otg/doc/doxygen.cfg - create mode 100644 drivers/usb/host/dwc_otg/dummy_audio.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_cfi_common.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_adp.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_attr.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cfi.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_core_if.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_dbg.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_driver.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_os_dep.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c - create mode 100644 drivers/usb/host/dwc_otg/dwc_otg_regs.h - create mode 100644 drivers/usb/host/dwc_otg/test/Makefile - create mode 100644 drivers/usb/host/dwc_otg/test/dwc_otg_test.pm - create mode 100644 drivers/usb/host/dwc_otg/test/test_mod_param.pl - create mode 100644 drivers/usb/host/dwc_otg/test/test_sysfs.pl - -diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h -index e6b70d9d084ea5d369c237f9a3f81c92e331a429..a48ccf7c73d873eb236b61e25a9e1cbde93b60e7 100644 ---- a/arch/arm/include/asm/irqflags.h -+++ b/arch/arm/include/asm/irqflags.h -@@ -162,13 +162,23 @@ static inline unsigned long arch_local_save_flags(void) - } - - /* -- * restore saved IRQ & FIQ state -+ * restore saved IRQ state - */ - #define arch_local_irq_restore arch_local_irq_restore - static inline void arch_local_irq_restore(unsigned long flags) - { -- asm volatile( -- " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore" -+ unsigned long temp = 0; -+ flags &= ~(1 << 6); -+ asm volatile ( -+ " mrs %0, cpsr" -+ : "=r" (temp) -+ : -+ : "memory", "cc"); -+ /* Preserve FIQ bit */ -+ temp &= (1 << 6); -+ flags = flags | temp; -+ asm volatile ( -+ " msr cpsr_c, %0 @ local_irq_restore" - : - : "r" (flags) - : "memory", "cc"); -diff --git a/arch/arm/kernel/fiqasm.S b/arch/arm/kernel/fiqasm.S -index 8dd26e1a9bd69051a1548d99c157cad2e65ba81b..eef484756af2179be8acd76b9ddbd3e983605990 100644 ---- a/arch/arm/kernel/fiqasm.S -+++ b/arch/arm/kernel/fiqasm.S -@@ -47,3 +47,7 @@ ENTRY(__get_fiq_regs) - mov r0, r0 @ avoid hazard prior to ARMv4 - ret lr - ENDPROC(__get_fiq_regs) -+ -+ENTRY(__FIQ_Branch) -+ mov pc, r8 -+ENDPROC(__FIQ_Branch) -diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index dca78565eb5500263051e9e1c889d84d6afd8fd9..5c467de6914e742b2ba25eb16e0c08b2e363532c 100644 ---- a/drivers/usb/Makefile -+++ b/drivers/usb/Makefile -@@ -7,6 +7,7 @@ - obj-$(CONFIG_USB) += core/ - obj-$(CONFIG_USB_SUPPORT) += phy/ - -+obj-$(CONFIG_USB_DWCOTG) += host/ - obj-$(CONFIG_USB_DWC3) += dwc3/ - obj-$(CONFIG_USB_DWC2) += dwc2/ - obj-$(CONFIG_USB_ISP1760) += isp1760/ -diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c -index 358ca8dd784fe43700ae070764fa783500a792fe..abaac7c7142d8887c1516957fc52162c0e1683f7 100644 ---- a/drivers/usb/core/generic.c -+++ b/drivers/usb/core/generic.c -@@ -152,6 +152,7 @@ int usb_choose_configuration(struct usb_device *udev) - dev_warn(&udev->dev, - "no configuration chosen from %d choice%s\n", - num_configs, plural(num_configs)); -+ dev_warn(&udev->dev, "No support over %dmA\n", udev->bus_mA); - } - return i; - } -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index aef81a16e2c8534701b8583392400faf77971d23..4197a5b5fb7abae67bd4aa32c29cb84c1f2fe22e 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -5009,7 +5009,7 @@ static void port_event(struct usb_hub *hub, int port1) - if (portchange & USB_PORT_STAT_C_OVERCURRENT) { - u16 status = 0, unused; - -- dev_dbg(&port_dev->dev, "over-current change\n"); -+ dev_notice(&port_dev->dev, "over-current change\n"); - usb_clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_OVER_CURRENT); - msleep(100); /* Cool down */ -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index 3a47077461578f2af47af8d551353c2c7cb12f0e..85b7ff6f24b8023e1b589aa1a3557885c48d7a13 100644 ---- a/drivers/usb/core/message.c -+++ b/drivers/usb/core/message.c -@@ -1908,6 +1908,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) - if (cp->string == NULL && - !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) - cp->string = usb_cache_string(dev, cp->desc.iConfiguration); -+/* Uncomment this define to enable the HS Electrical Test support */ -+#define DWC_HS_ELECT_TST 1 -+#ifdef DWC_HS_ELECT_TST -+ /* Here we implement the HS Electrical Test support. The -+ * tester uses a vendor ID of 0x1A0A to indicate we should -+ * run a special test sequence. The product ID tells us -+ * which sequence to run. We invoke the test sequence by -+ * sending a non-standard SetFeature command to our root -+ * hub port. Our dwc_otg_hcd_hub_control() routine will -+ * recognize the command and perform the desired test -+ * sequence. -+ */ -+ if (dev->descriptor.idVendor == 0x1A0A) { -+ /* HSOTG Electrical Test */ -+ dev_warn(&dev->dev, "VID from HSOTG Electrical Test Fixture\n"); -+ -+ if (dev->bus && dev->bus->root_hub) { -+ struct usb_device *hdev = dev->bus->root_hub; -+ dev_warn(&dev->dev, "Got PID 0x%x\n", dev->descriptor.idProduct); -+ -+ switch (dev->descriptor.idProduct) { -+ case 0x0101: /* TEST_SE0_NAK */ -+ dev_warn(&dev->dev, "TEST_SE0_NAK\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x300, NULL, 0, HZ); -+ break; -+ -+ case 0x0102: /* TEST_J */ -+ dev_warn(&dev->dev, "TEST_J\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x100, NULL, 0, HZ); -+ break; -+ -+ case 0x0103: /* TEST_K */ -+ dev_warn(&dev->dev, "TEST_K\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x200, NULL, 0, HZ); -+ break; -+ -+ case 0x0104: /* TEST_PACKET */ -+ dev_warn(&dev->dev, "TEST_PACKET\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x400, NULL, 0, HZ); -+ break; -+ -+ case 0x0105: /* TEST_FORCE_ENABLE */ -+ dev_warn(&dev->dev, "TEST_FORCE_ENABLE\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x500, NULL, 0, HZ); -+ break; -+ -+ case 0x0106: /* HS_HOST_PORT_SUSPEND_RESUME */ -+ dev_warn(&dev->dev, "HS_HOST_PORT_SUSPEND_RESUME\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x600, NULL, 0, 40 * HZ); -+ break; -+ -+ case 0x0107: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ -+ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x700, NULL, 0, 40 * HZ); -+ break; -+ -+ case 0x0108: /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ -+ dev_warn(&dev->dev, "SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute\n"); -+ usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), -+ USB_REQ_SET_FEATURE, USB_RT_PORT, -+ USB_PORT_FEAT_TEST, 0x800, NULL, 0, 40 * HZ); -+ } -+ } -+ } -+#endif /* DWC_HS_ELECT_TST */ - - /* Now that the interfaces are installed, re-enable LPM. */ - usb_unlocked_enable_lpm(dev); -diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h -index 085049d37d7a5b23ff8dbf44b02afc1837fe3b68..63a461a21cc14b9c6f14db7c1d03c7a2ebcdba65 100644 ---- a/drivers/usb/core/otg_whitelist.h -+++ b/drivers/usb/core/otg_whitelist.h -@@ -19,33 +19,82 @@ - static struct usb_device_id whitelist_table[] = { - - /* hubs are optional in OTG, but very handy ... */ -+#define CERT_WITHOUT_HUBS -+#if defined(CERT_WITHOUT_HUBS) -+{ USB_DEVICE( 0x0000, 0x0000 ), }, /* Root HUB Only*/ -+#else - { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), }, - { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), }, -+{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 2), }, -+#endif - - #ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */ - /* FIXME actually, printers are NOT supposed to use device classes; - * they're supposed to use interface classes... - */ --{ USB_DEVICE_INFO(7, 1, 1) }, --{ USB_DEVICE_INFO(7, 1, 2) }, --{ USB_DEVICE_INFO(7, 1, 3) }, -+//{ USB_DEVICE_INFO(7, 1, 1) }, -+//{ USB_DEVICE_INFO(7, 1, 2) }, -+//{ USB_DEVICE_INFO(7, 1, 3) }, - #endif - - #ifdef CONFIG_USB_NET_CDCETHER - /* Linux-USB CDC Ethernet gadget */ --{ USB_DEVICE(0x0525, 0xa4a1), }, -+//{ USB_DEVICE(0x0525, 0xa4a1), }, - /* Linux-USB CDC Ethernet + RNDIS gadget */ --{ USB_DEVICE(0x0525, 0xa4a2), }, -+//{ USB_DEVICE(0x0525, 0xa4a2), }, - #endif - - #if IS_ENABLED(CONFIG_USB_TEST) - /* gadget zero, for testing */ --{ USB_DEVICE(0x0525, 0xa4a0), }, -+//{ USB_DEVICE(0x0525, 0xa4a0), }, - #endif - -+/* OPT Tester */ -+{ USB_DEVICE( 0x1a0a, 0x0101 ), }, /* TEST_SE0_NAK */ -+{ USB_DEVICE( 0x1a0a, 0x0102 ), }, /* Test_J */ -+{ USB_DEVICE( 0x1a0a, 0x0103 ), }, /* Test_K */ -+{ USB_DEVICE( 0x1a0a, 0x0104 ), }, /* Test_PACKET */ -+{ USB_DEVICE( 0x1a0a, 0x0105 ), }, /* Test_FORCE_ENABLE */ -+{ USB_DEVICE( 0x1a0a, 0x0106 ), }, /* HS_PORT_SUSPEND_RESUME */ -+{ USB_DEVICE( 0x1a0a, 0x0107 ), }, /* SINGLE_STEP_GET_DESCRIPTOR setup */ -+{ USB_DEVICE( 0x1a0a, 0x0108 ), }, /* SINGLE_STEP_GET_DESCRIPTOR execute */ -+ -+/* Sony cameras */ -+{ USB_DEVICE_VER(0x054c,0x0010,0x0410, 0x0500), }, -+ -+/* Memory Devices */ -+//{ USB_DEVICE( 0x0781, 0x5150 ), }, /* SanDisk */ -+//{ USB_DEVICE( 0x05DC, 0x0080 ), }, /* Lexar */ -+//{ USB_DEVICE( 0x4146, 0x9281 ), }, /* IOMEGA */ -+//{ USB_DEVICE( 0x067b, 0x2507 ), }, /* Hammer 20GB External HD */ -+{ USB_DEVICE( 0x0EA0, 0x2168 ), }, /* Ours Technology Inc. (BUFFALO ClipDrive)*/ -+//{ USB_DEVICE( 0x0457, 0x0150 ), }, /* Silicon Integrated Systems Corp. */ -+ -+/* HP Printers */ -+//{ USB_DEVICE( 0x03F0, 0x1102 ), }, /* HP Photosmart 245 */ -+//{ USB_DEVICE( 0x03F0, 0x1302 ), }, /* HP Photosmart 370 Series */ -+ -+/* Speakers */ -+//{ USB_DEVICE( 0x0499, 0x3002 ), }, /* YAMAHA YST-MS35D USB Speakers */ -+//{ USB_DEVICE( 0x0672, 0x1041 ), }, /* Labtec USB Headset */ -+ - { } /* Terminating entry */ - }; - -+static inline void report_errors(struct usb_device *dev) -+{ -+ /* OTG MESSAGE: report errors here, customize to match your product */ -+ dev_info(&dev->dev, "device Vendor:%04x Product:%04x is not supported\n", -+ le16_to_cpu(dev->descriptor.idVendor), -+ le16_to_cpu(dev->descriptor.idProduct)); -+ if (USB_CLASS_HUB == dev->descriptor.bDeviceClass){ -+ dev_printk(KERN_CRIT, &dev->dev, "Unsupported Hub Topology\n"); -+ } else { -+ dev_printk(KERN_CRIT, &dev->dev, "Attached Device is not Supported\n"); -+ } -+} -+ -+ - static int is_targeted(struct usb_device *dev) - { - struct usb_device_id *id = whitelist_table; -@@ -95,16 +144,57 @@ static int is_targeted(struct usb_device *dev) - continue; - - return 1; -- } -+ /* NOTE: can't use usb_match_id() since interface caches -+ * aren't set up yet. this is cut/paste from that code. -+ */ -+ for (id = whitelist_table; id->match_flags; id++) { -+#ifdef DEBUG -+ dev_dbg(&dev->dev, -+ "ID: V:%04x P:%04x DC:%04x SC:%04x PR:%04x \n", -+ id->idVendor, -+ id->idProduct, -+ id->bDeviceClass, -+ id->bDeviceSubClass, -+ id->bDeviceProtocol); -+#endif - -- /* add other match criteria here ... */ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && -+ id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) -+ continue; - -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && -+ id->idProduct != le16_to_cpu(dev->descriptor.idProduct)) -+ continue; - -- /* OTG MESSAGE: report errors here, customize to match your product */ -- dev_err(&dev->dev, "device v%04x p%04x is not supported\n", -- le16_to_cpu(dev->descriptor.idVendor), -- le16_to_cpu(dev->descriptor.idProduct)); -+ /* No need to test id->bcdDevice_lo != 0, since 0 is never -+ greater than any unsigned number. */ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && -+ (id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice))) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && -+ (id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice))) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && -+ (id->bDeviceClass != dev->descriptor.bDeviceClass)) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && -+ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) -+ continue; -+ -+ if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && -+ (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) -+ continue; -+ -+ return 1; -+ } -+ } -+ -+ /* add other match criteria here ... */ - -+ report_errors(dev); - return 0; - } - -diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c -new file mode 100644 -index 0000000000000000000000000000000000000000..a896d73f7a9336f5a34015c44ea5a6b04ce34f10 ---- /dev/null -+++ b/drivers/usb/gadget/file_storage.c -@@ -0,0 +1,3676 @@ -+/* -+ * file_storage.c -- File-backed USB Storage Gadget, for USB development -+ * -+ * Copyright (C) 2003-2008 Alan Stern -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") as published by the Free Software -+ * Foundation, either version 2 of that License or (at your option) any -+ * later version. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+ -+/* -+ * The File-backed Storage Gadget acts as a USB Mass Storage device, -+ * appearing to the host as a disk drive or as a CD-ROM drive. In addition -+ * to providing an example of a genuinely useful gadget driver for a USB -+ * device, it also illustrates a technique of double-buffering for increased -+ * throughput. Last but not least, it gives an easy way to probe the -+ * behavior of the Mass Storage drivers in a USB host. -+ * -+ * Backing storage is provided by a regular file or a block device, specified -+ * by the "file" module parameter. Access can be limited to read-only by -+ * setting the optional "ro" module parameter. (For CD-ROM emulation, -+ * access is always read-only.) The gadget will indicate that it has -+ * removable media if the optional "removable" module parameter is set. -+ * -+ * The gadget supports the Control-Bulk (CB), Control-Bulk-Interrupt (CBI), -+ * and Bulk-Only (also known as Bulk-Bulk-Bulk or BBB) transports, selected -+ * by the optional "transport" module parameter. It also supports the -+ * following protocols: RBC (0x01), ATAPI or SFF-8020i (0x02), QIC-157 (0c03), -+ * UFI (0x04), SFF-8070i (0x05), and transparent SCSI (0x06), selected by -+ * the optional "protocol" module parameter. In addition, the default -+ * Vendor ID, Product ID, release number and serial number can be overridden. -+ * -+ * There is support for multiple logical units (LUNs), each of which has -+ * its own backing file. The number of LUNs can be set using the optional -+ * "luns" module parameter (anywhere from 1 to 8), and the corresponding -+ * files are specified using comma-separated lists for "file" and "ro". -+ * The default number of LUNs is taken from the number of "file" elements; -+ * it is 1 if "file" is not given. If "removable" is not set then a backing -+ * file must be specified for each LUN. If it is set, then an unspecified -+ * or empty backing filename means the LUN's medium is not loaded. Ideally -+ * each LUN would be settable independently as a disk drive or a CD-ROM -+ * drive, but currently all LUNs have to be the same type. The CD-ROM -+ * emulation includes a single data track and no audio tracks; hence there -+ * need be only one backing file per LUN. -+ * -+ * Requirements are modest; only a bulk-in and a bulk-out endpoint are -+ * needed (an interrupt-out endpoint is also needed for CBI). The memory -+ * requirement amounts to two 16K buffers, size configurable by a parameter. -+ * Support is included for both full-speed and high-speed operation. -+ * -+ * Note that the driver is slightly non-portable in that it assumes a -+ * single memory/DMA buffer will be useable for bulk-in, bulk-out, and -+ * interrupt-in endpoints. With most device controllers this isn't an -+ * issue, but there may be some with hardware restrictions that prevent -+ * a buffer from being used by more than one endpoint. -+ * -+ * Module options: -+ * -+ * file=filename[,filename...] -+ * Required if "removable" is not set, names of -+ * the files or block devices used for -+ * backing storage -+ * serial=HHHH... Required serial number (string of hex chars) -+ * ro=b[,b...] Default false, booleans for read-only access -+ * removable Default false, boolean for removable media -+ * luns=N Default N = number of filenames, number of -+ * LUNs to support -+ * nofua=b[,b...] Default false, booleans for ignore FUA flag -+ * in SCSI WRITE(10,12) commands -+ * stall Default determined according to the type of -+ * USB device controller (usually true), -+ * boolean to permit the driver to halt -+ * bulk endpoints -+ * cdrom Default false, boolean for whether to emulate -+ * a CD-ROM drive -+ * transport=XXX Default BBB, transport name (CB, CBI, or BBB) -+ * protocol=YYY Default SCSI, protocol name (RBC, 8020 or -+ * ATAPI, QIC, UFI, 8070, or SCSI; -+ * also 1 - 6) -+ * vendor=0xVVVV Default 0x0525 (NetChip), USB Vendor ID -+ * product=0xPPPP Default 0xa4a5 (FSG), USB Product ID -+ * release=0xRRRR Override the USB release number (bcdDevice) -+ * buflen=N Default N=16384, buffer size used (will be -+ * rounded down to a multiple of -+ * PAGE_CACHE_SIZE) -+ * -+ * If CONFIG_USB_FILE_STORAGE_TEST is not set, only the "file", "serial", "ro", -+ * "removable", "luns", "nofua", "stall", and "cdrom" options are available; -+ * default values are used for everything else. -+ * -+ * The pathnames of the backing files and the ro settings are available in -+ * the attribute files "file", "nofua", and "ro" in the lun subdirectory of -+ * the gadget's sysfs directory. If the "removable" option is set, writing to -+ * these files will simulate ejecting/loading the medium (writing an empty -+ * line means eject) and adjusting a write-enable tab. Changes to the ro -+ * setting are not allowed when the medium is loaded or if CD-ROM emulation -+ * is being used. -+ * -+ * This gadget driver is heavily based on "Gadget Zero" by David Brownell. -+ * The driver's SCSI command interface was based on the "Information -+ * technology - Small Computer System Interface - 2" document from -+ * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at -+ * . The single exception -+ * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the -+ * "Universal Serial Bus Mass Storage Class UFI Command Specification" -+ * document, Revision 1.0, December 14, 1998, available at -+ * . -+ */ -+ -+ -+/* -+ * Driver Design -+ * -+ * The FSG driver is fairly straightforward. There is a main kernel -+ * thread that handles most of the work. Interrupt routines field -+ * callbacks from the controller driver: bulk- and interrupt-request -+ * completion notifications, endpoint-0 events, and disconnect events. -+ * Completion events are passed to the main thread by wakeup calls. Many -+ * ep0 requests are handled at interrupt time, but SetInterface, -+ * SetConfiguration, and device reset requests are forwarded to the -+ * thread in the form of "exceptions" using SIGUSR1 signals (since they -+ * should interrupt any ongoing file I/O operations). -+ * -+ * The thread's main routine implements the standard command/data/status -+ * parts of a SCSI interaction. It and its subroutines are full of tests -+ * for pending signals/exceptions -- all this polling is necessary since -+ * the kernel has no setjmp/longjmp equivalents. (Maybe this is an -+ * indication that the driver really wants to be running in userspace.) -+ * An important point is that so long as the thread is alive it keeps an -+ * open reference to the backing file. This will prevent unmounting -+ * the backing file's underlying filesystem and could cause problems -+ * during system shutdown, for example. To prevent such problems, the -+ * thread catches INT, TERM, and KILL signals and converts them into -+ * an EXIT exception. -+ * -+ * In normal operation the main thread is started during the gadget's -+ * fsg_bind() callback and stopped during fsg_unbind(). But it can also -+ * exit when it receives a signal, and there's no point leaving the -+ * gadget running when the thread is dead. So just before the thread -+ * exits, it deregisters the gadget driver. This makes things a little -+ * tricky: The driver is deregistered at two places, and the exiting -+ * thread can indirectly call fsg_unbind() which in turn can tell the -+ * thread to exit. The first problem is resolved through the use of the -+ * REGISTERED atomic bitflag; the driver will only be deregistered once. -+ * The second problem is resolved by having fsg_unbind() check -+ * fsg->state; it won't try to stop the thread if the state is already -+ * FSG_STATE_TERMINATED. -+ * -+ * To provide maximum throughput, the driver uses a circular pipeline of -+ * buffer heads (struct fsg_buffhd). In principle the pipeline can be -+ * arbitrarily long; in practice the benefits don't justify having more -+ * than 2 stages (i.e., double buffering). But it helps to think of the -+ * pipeline as being a long one. Each buffer head contains a bulk-in and -+ * a bulk-out request pointer (since the buffer can be used for both -+ * output and input -- directions always are given from the host's -+ * point of view) as well as a pointer to the buffer and various state -+ * variables. -+ * -+ * Use of the pipeline follows a simple protocol. There is a variable -+ * (fsg->next_buffhd_to_fill) that points to the next buffer head to use. -+ * At any time that buffer head may still be in use from an earlier -+ * request, so each buffer head has a state variable indicating whether -+ * it is EMPTY, FULL, or BUSY. Typical use involves waiting for the -+ * buffer head to be EMPTY, filling the buffer either by file I/O or by -+ * USB I/O (during which the buffer head is BUSY), and marking the buffer -+ * head FULL when the I/O is complete. Then the buffer will be emptied -+ * (again possibly by USB I/O, during which it is marked BUSY) and -+ * finally marked EMPTY again (possibly by a completion routine). -+ * -+ * A module parameter tells the driver to avoid stalling the bulk -+ * endpoints wherever the transport specification allows. This is -+ * necessary for some UDCs like the SuperH, which cannot reliably clear a -+ * halt on a bulk endpoint. However, under certain circumstances the -+ * Bulk-only specification requires a stall. In such cases the driver -+ * will halt the endpoint and set a flag indicating that it should clear -+ * the halt in software during the next device reset. Hopefully this -+ * will permit everything to work correctly. Furthermore, although the -+ * specification allows the bulk-out endpoint to halt when the host sends -+ * too much data, implementing this would cause an unavoidable race. -+ * The driver will always use the "no-stall" approach for OUT transfers. -+ * -+ * One subtle point concerns sending status-stage responses for ep0 -+ * requests. Some of these requests, such as device reset, can involve -+ * interrupting an ongoing file I/O operation, which might take an -+ * arbitrarily long time. During that delay the host might give up on -+ * the original ep0 request and issue a new one. When that happens the -+ * driver should not notify the host about completion of the original -+ * request, as the host will no longer be waiting for it. So the driver -+ * assigns to each ep0 request a unique tag, and it keeps track of the -+ * tag value of the request associated with a long-running exception -+ * (device-reset, interface-change, or configuration-change). When the -+ * exception handler is finished, the status-stage response is submitted -+ * only if the current ep0 request tag is equal to the exception request -+ * tag. Thus only the most recently received ep0 request will get a -+ * status-stage response. -+ * -+ * Warning: This driver source file is too long. It ought to be split up -+ * into a header file plus about 3 separate .c files, to handle the details -+ * of the Gadget, USB Mass Storage, and SCSI protocols. -+ */ -+ -+ -+/* #define VERBOSE_DEBUG */ -+/* #define DUMP_MSGS */ -+ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "gadget_chips.h" -+ -+ -+ -+/* -+ * Kbuild is not very cooperative with respect to linking separately -+ * compiled library objects into one module. So for now we won't use -+ * separate compilation ... ensuring init/exit sections work to shrink -+ * the runtime footprint, and giving us at least some parts of what -+ * a "gcc --combine ... part1.c part2.c part3.c ... " build would. -+ */ -+#include "usbstring.c" -+#include "config.c" -+#include "epautoconf.c" -+ -+/*-------------------------------------------------------------------------*/ -+ -+#define DRIVER_DESC "File-backed Storage Gadget" -+#define DRIVER_NAME "g_file_storage" -+#define DRIVER_VERSION "1 September 2010" -+ -+static char fsg_string_manufacturer[64]; -+static const char fsg_string_product[] = DRIVER_DESC; -+static const char fsg_string_config[] = "Self-powered"; -+static const char fsg_string_interface[] = "Mass Storage"; -+ -+ -+#include "storage_common.c" -+ -+ -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_AUTHOR("Alan Stern"); -+MODULE_LICENSE("Dual BSD/GPL"); -+ -+/* -+ * This driver assumes self-powered hardware and has no way for users to -+ * trigger remote wakeup. It uses autoconfiguration to select endpoints -+ * and endpoint addresses. -+ */ -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+ -+/* Encapsulate the module parameter settings */ -+ -+static struct { -+ char *file[FSG_MAX_LUNS]; -+ char *serial; -+ bool ro[FSG_MAX_LUNS]; -+ bool nofua[FSG_MAX_LUNS]; -+ unsigned int num_filenames; -+ unsigned int num_ros; -+ unsigned int num_nofuas; -+ unsigned int nluns; -+ -+ bool removable; -+ bool can_stall; -+ bool cdrom; -+ -+ char *transport_parm; -+ char *protocol_parm; -+ unsigned short vendor; -+ unsigned short product; -+ unsigned short release; -+ unsigned int buflen; -+ -+ int transport_type; -+ char *transport_name; -+ int protocol_type; -+ char *protocol_name; -+ -+} mod_data = { // Default values -+ .transport_parm = "BBB", -+ .protocol_parm = "SCSI", -+ .removable = 0, -+ .can_stall = 1, -+ .cdrom = 0, -+ .vendor = FSG_VENDOR_ID, -+ .product = FSG_PRODUCT_ID, -+ .release = 0xffff, // Use controller chip type -+ .buflen = 16384, -+ }; -+ -+ -+module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames, -+ S_IRUGO); -+MODULE_PARM_DESC(file, "names of backing files or devices"); -+ -+module_param_named(serial, mod_data.serial, charp, S_IRUGO); -+MODULE_PARM_DESC(serial, "USB serial number"); -+ -+module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO); -+MODULE_PARM_DESC(ro, "true to force read-only"); -+ -+module_param_array_named(nofua, mod_data.nofua, bool, &mod_data.num_nofuas, -+ S_IRUGO); -+MODULE_PARM_DESC(nofua, "true to ignore SCSI WRITE(10,12) FUA bit"); -+ -+module_param_named(luns, mod_data.nluns, uint, S_IRUGO); -+MODULE_PARM_DESC(luns, "number of LUNs"); -+ -+module_param_named(removable, mod_data.removable, bool, S_IRUGO); -+MODULE_PARM_DESC(removable, "true to simulate removable media"); -+ -+module_param_named(stall, mod_data.can_stall, bool, S_IRUGO); -+MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); -+ -+module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO); -+MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk"); -+ -+/* In the non-TEST version, only the module parameters listed above -+ * are available. */ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ -+module_param_named(transport, mod_data.transport_parm, charp, S_IRUGO); -+MODULE_PARM_DESC(transport, "type of transport (BBB, CBI, or CB)"); -+ -+module_param_named(protocol, mod_data.protocol_parm, charp, S_IRUGO); -+MODULE_PARM_DESC(protocol, "type of protocol (RBC, 8020, QIC, UFI, " -+ "8070, or SCSI)"); -+ -+module_param_named(vendor, mod_data.vendor, ushort, S_IRUGO); -+MODULE_PARM_DESC(vendor, "USB Vendor ID"); -+ -+module_param_named(product, mod_data.product, ushort, S_IRUGO); -+MODULE_PARM_DESC(product, "USB Product ID"); -+ -+module_param_named(release, mod_data.release, ushort, S_IRUGO); -+MODULE_PARM_DESC(release, "USB release number"); -+ -+module_param_named(buflen, mod_data.buflen, uint, S_IRUGO); -+MODULE_PARM_DESC(buflen, "I/O buffer size"); -+ -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+/* -+ * These definitions will permit the compiler to avoid generating code for -+ * parts of the driver that aren't used in the non-TEST version. Even gcc -+ * can recognize when a test of a constant expression yields a dead code -+ * path. -+ */ -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ -+#define transport_is_bbb() (mod_data.transport_type == USB_PR_BULK) -+#define transport_is_cbi() (mod_data.transport_type == USB_PR_CBI) -+#define protocol_is_scsi() (mod_data.protocol_type == USB_SC_SCSI) -+ -+#else -+ -+#define transport_is_bbb() 1 -+#define transport_is_cbi() 0 -+#define protocol_is_scsi() 1 -+ -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+ -+struct fsg_dev { -+ /* lock protects: state, all the req_busy's, and cbbuf_cmnd */ -+ spinlock_t lock; -+ struct usb_gadget *gadget; -+ -+ /* filesem protects: backing files in use */ -+ struct rw_semaphore filesem; -+ -+ /* reference counting: wait until all LUNs are released */ -+ struct kref ref; -+ -+ struct usb_ep *ep0; // Handy copy of gadget->ep0 -+ struct usb_request *ep0req; // For control responses -+ unsigned int ep0_req_tag; -+ const char *ep0req_name; -+ -+ struct usb_request *intreq; // For interrupt responses -+ int intreq_busy; -+ struct fsg_buffhd *intr_buffhd; -+ -+ unsigned int bulk_out_maxpacket; -+ enum fsg_state state; // For exception handling -+ unsigned int exception_req_tag; -+ -+ u8 config, new_config; -+ -+ unsigned int running : 1; -+ unsigned int bulk_in_enabled : 1; -+ unsigned int bulk_out_enabled : 1; -+ unsigned int intr_in_enabled : 1; -+ unsigned int phase_error : 1; -+ unsigned int short_packet_received : 1; -+ unsigned int bad_lun_okay : 1; -+ -+ unsigned long atomic_bitflags; -+#define REGISTERED 0 -+#define IGNORE_BULK_OUT 1 -+#define SUSPENDED 2 -+ -+ struct usb_ep *bulk_in; -+ struct usb_ep *bulk_out; -+ struct usb_ep *intr_in; -+ -+ struct fsg_buffhd *next_buffhd_to_fill; -+ struct fsg_buffhd *next_buffhd_to_drain; -+ -+ int thread_wakeup_needed; -+ struct completion thread_notifier; -+ struct task_struct *thread_task; -+ -+ int cmnd_size; -+ u8 cmnd[MAX_COMMAND_SIZE]; -+ enum data_direction data_dir; -+ u32 data_size; -+ u32 data_size_from_cmnd; -+ u32 tag; -+ unsigned int lun; -+ u32 residue; -+ u32 usb_amount_left; -+ -+ /* The CB protocol offers no way for a host to know when a command -+ * has completed. As a result the next command may arrive early, -+ * and we will still have to handle it. For that reason we need -+ * a buffer to store new commands when using CB (or CBI, which -+ * does not oblige a host to wait for command completion either). */ -+ int cbbuf_cmnd_size; -+ u8 cbbuf_cmnd[MAX_COMMAND_SIZE]; -+ -+ unsigned int nluns; -+ struct fsg_lun *luns; -+ struct fsg_lun *curlun; -+ /* Must be the last entry */ -+ struct fsg_buffhd buffhds[]; -+}; -+ -+typedef void (*fsg_routine_t)(struct fsg_dev *); -+ -+static int exception_in_progress(struct fsg_dev *fsg) -+{ -+ return (fsg->state > FSG_STATE_IDLE); -+} -+ -+/* Make bulk-out requests be divisible by the maxpacket size */ -+static void set_bulk_out_req_length(struct fsg_dev *fsg, -+ struct fsg_buffhd *bh, unsigned int length) -+{ -+ unsigned int rem; -+ -+ bh->bulk_out_intended_length = length; -+ rem = length % fsg->bulk_out_maxpacket; -+ if (rem > 0) -+ length += fsg->bulk_out_maxpacket - rem; -+ bh->outreq->length = length; -+} -+ -+static struct fsg_dev *the_fsg; -+static struct usb_gadget_driver fsg_driver; -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) -+{ -+ const char *name; -+ -+ if (ep == fsg->bulk_in) -+ name = "bulk-in"; -+ else if (ep == fsg->bulk_out) -+ name = "bulk-out"; -+ else -+ name = ep->name; -+ DBG(fsg, "%s set halt\n", name); -+ return usb_ep_set_halt(ep); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* -+ * DESCRIPTORS ... most are static, but strings and (full) configuration -+ * descriptors are built on demand. Also the (static) config and interface -+ * descriptors are adjusted during fsg_bind(). -+ */ -+ -+/* There is only one configuration. */ -+#define CONFIG_VALUE 1 -+ -+static struct usb_device_descriptor -+device_desc = { -+ .bLength = sizeof device_desc, -+ .bDescriptorType = USB_DT_DEVICE, -+ -+ .bcdUSB = cpu_to_le16(0x0200), -+ .bDeviceClass = USB_CLASS_PER_INTERFACE, -+ -+ /* The next three values can be overridden by module parameters */ -+ .idVendor = cpu_to_le16(FSG_VENDOR_ID), -+ .idProduct = cpu_to_le16(FSG_PRODUCT_ID), -+ .bcdDevice = cpu_to_le16(0xffff), -+ -+ .iManufacturer = FSG_STRING_MANUFACTURER, -+ .iProduct = FSG_STRING_PRODUCT, -+ .iSerialNumber = FSG_STRING_SERIAL, -+ .bNumConfigurations = 1, -+}; -+ -+static struct usb_config_descriptor -+config_desc = { -+ .bLength = sizeof config_desc, -+ .bDescriptorType = USB_DT_CONFIG, -+ -+ /* wTotalLength computed by usb_gadget_config_buf() */ -+ .bNumInterfaces = 1, -+ .bConfigurationValue = CONFIG_VALUE, -+ .iConfiguration = FSG_STRING_CONFIG, -+ .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, -+ .bMaxPower = CONFIG_USB_GADGET_VBUS_DRAW / 2, -+}; -+ -+ -+static struct usb_qualifier_descriptor -+dev_qualifier = { -+ .bLength = sizeof dev_qualifier, -+ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, -+ -+ .bcdUSB = cpu_to_le16(0x0200), -+ .bDeviceClass = USB_CLASS_PER_INTERFACE, -+ -+ .bNumConfigurations = 1, -+}; -+ -+static int populate_bos(struct fsg_dev *fsg, u8 *buf) -+{ -+ memcpy(buf, &fsg_bos_desc, USB_DT_BOS_SIZE); -+ buf += USB_DT_BOS_SIZE; -+ -+ memcpy(buf, &fsg_ext_cap_desc, USB_DT_USB_EXT_CAP_SIZE); -+ buf += USB_DT_USB_EXT_CAP_SIZE; -+ -+ memcpy(buf, &fsg_ss_cap_desc, USB_DT_USB_SS_CAP_SIZE); -+ -+ return USB_DT_BOS_SIZE + USB_DT_USB_SS_CAP_SIZE -+ + USB_DT_USB_EXT_CAP_SIZE; -+} -+ -+/* -+ * Config descriptors must agree with the code that sets configurations -+ * and with code managing interfaces and their altsettings. They must -+ * also handle different speeds and other-speed requests. -+ */ -+static int populate_config_buf(struct usb_gadget *gadget, -+ u8 *buf, u8 type, unsigned index) -+{ -+ enum usb_device_speed speed = gadget->speed; -+ int len; -+ const struct usb_descriptor_header **function; -+ -+ if (index > 0) -+ return -EINVAL; -+ -+ if (gadget_is_dualspeed(gadget) && type == USB_DT_OTHER_SPEED_CONFIG) -+ speed = (USB_SPEED_FULL + USB_SPEED_HIGH) - speed; -+ function = gadget_is_dualspeed(gadget) && speed == USB_SPEED_HIGH -+ ? (const struct usb_descriptor_header **)fsg_hs_function -+ : (const struct usb_descriptor_header **)fsg_fs_function; -+ -+ /* for now, don't advertise srp-only devices */ -+ if (!gadget_is_otg(gadget)) -+ function++; -+ -+ len = usb_gadget_config_buf(&config_desc, buf, EP0_BUFSIZE, function); -+ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; -+ return len; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* These routines may be called in process context or in_irq */ -+ -+/* Caller must hold fsg->lock */ -+static void wakeup_thread(struct fsg_dev *fsg) -+{ -+ /* Tell the main thread that something has happened */ -+ fsg->thread_wakeup_needed = 1; -+ if (fsg->thread_task) -+ wake_up_process(fsg->thread_task); -+} -+ -+ -+static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) -+{ -+ unsigned long flags; -+ -+ /* Do nothing if a higher-priority exception is already in progress. -+ * If a lower-or-equal priority exception is in progress, preempt it -+ * and notify the main thread by sending it a signal. */ -+ spin_lock_irqsave(&fsg->lock, flags); -+ if (fsg->state <= new_state) { -+ fsg->exception_req_tag = fsg->ep0_req_tag; -+ fsg->state = new_state; -+ if (fsg->thread_task) -+ send_sig_info(SIGUSR1, SEND_SIG_FORCED, -+ fsg->thread_task); -+ } -+ spin_unlock_irqrestore(&fsg->lock, flags); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* The disconnect callback and ep0 routines. These always run in_irq, -+ * except that ep0_queue() is called in the main thread to acknowledge -+ * completion of various requests: set config, set interface, and -+ * Bulk-only device reset. */ -+ -+static void fsg_disconnect(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ -+ DBG(fsg, "disconnect or port reset\n"); -+ raise_exception(fsg, FSG_STATE_DISCONNECT); -+} -+ -+ -+static int ep0_queue(struct fsg_dev *fsg) -+{ -+ int rc; -+ -+ rc = usb_ep_queue(fsg->ep0, fsg->ep0req, GFP_ATOMIC); -+ if (rc != 0 && rc != -ESHUTDOWN) { -+ -+ /* We can't do much more than wait for a reset */ -+ WARNING(fsg, "error in submission: %s --> %d\n", -+ fsg->ep0->name, rc); -+ } -+ return rc; -+} -+ -+static void ep0_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ -+ if (req->actual > 0) -+ dump_msg(fsg, fsg->ep0req_name, req->buf, req->actual); -+ if (req->status || req->actual != req->length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, req->length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ if (req->status == 0 && req->context) -+ ((fsg_routine_t) (req->context))(fsg); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Bulk and interrupt endpoint completion handlers. -+ * These always run in_irq. */ -+ -+static void bulk_in_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ struct fsg_buffhd *bh = req->context; -+ -+ if (req->status || req->actual != req->length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, req->length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ /* Hold the lock while we update the request and buffer states */ -+ smp_wmb(); -+ spin_lock(&fsg->lock); -+ bh->inreq_busy = 0; -+ bh->state = BUF_STATE_EMPTY; -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+static void bulk_out_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ struct fsg_buffhd *bh = req->context; -+ -+ dump_msg(fsg, "bulk-out", req->buf, req->actual); -+ if (req->status || req->actual != bh->bulk_out_intended_length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, -+ bh->bulk_out_intended_length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ /* Hold the lock while we update the request and buffer states */ -+ smp_wmb(); -+ spin_lock(&fsg->lock); -+ bh->outreq_busy = 0; -+ bh->state = BUF_STATE_FULL; -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) -+{ -+ struct fsg_dev *fsg = ep->driver_data; -+ struct fsg_buffhd *bh = req->context; -+ -+ if (req->status || req->actual != req->length) -+ DBG(fsg, "%s --> %d, %u/%u\n", __func__, -+ req->status, req->actual, req->length); -+ if (req->status == -ECONNRESET) // Request was cancelled -+ usb_ep_fifo_flush(ep); -+ -+ /* Hold the lock while we update the request and buffer states */ -+ smp_wmb(); -+ spin_lock(&fsg->lock); -+ fsg->intreq_busy = 0; -+ bh->state = BUF_STATE_EMPTY; -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+#else -+static void intr_in_complete(struct usb_ep *ep, struct usb_request *req) -+{} -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Ep0 class-specific handlers. These always run in_irq. */ -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct usb_request *req = fsg->ep0req; -+ static u8 cbi_reset_cmnd[6] = { -+ SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; -+ -+ /* Error in command transfer? */ -+ if (req->status || req->length != req->actual || -+ req->actual < 6 || req->actual > MAX_COMMAND_SIZE) { -+ -+ /* Not all controllers allow a protocol stall after -+ * receiving control-out data, but we'll try anyway. */ -+ fsg_set_halt(fsg, fsg->ep0); -+ return; // Wait for reset -+ } -+ -+ /* Is it the special reset command? */ -+ if (req->actual >= sizeof cbi_reset_cmnd && -+ memcmp(req->buf, cbi_reset_cmnd, -+ sizeof cbi_reset_cmnd) == 0) { -+ -+ /* Raise an exception to stop the current operation -+ * and reinitialize our state. */ -+ DBG(fsg, "cbi reset request\n"); -+ raise_exception(fsg, FSG_STATE_RESET); -+ return; -+ } -+ -+ VDBG(fsg, "CB[I] accept device-specific command\n"); -+ spin_lock(&fsg->lock); -+ -+ /* Save the command for later */ -+ if (fsg->cbbuf_cmnd_size) -+ WARNING(fsg, "CB[I] overwriting previous command\n"); -+ fsg->cbbuf_cmnd_size = req->actual; -+ memcpy(fsg->cbbuf_cmnd, req->buf, fsg->cbbuf_cmnd_size); -+ -+ wakeup_thread(fsg); -+ spin_unlock(&fsg->lock); -+} -+ -+#else -+static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{} -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ -+static int class_setup_req(struct fsg_dev *fsg, -+ const struct usb_ctrlrequest *ctrl) -+{ -+ struct usb_request *req = fsg->ep0req; -+ int value = -EOPNOTSUPP; -+ u16 w_index = le16_to_cpu(ctrl->wIndex); -+ u16 w_value = le16_to_cpu(ctrl->wValue); -+ u16 w_length = le16_to_cpu(ctrl->wLength); -+ -+ if (!fsg->config) -+ return value; -+ -+ /* Handle Bulk-only class-specific requests */ -+ if (transport_is_bbb()) { -+ switch (ctrl->bRequest) { -+ -+ case US_BULK_RESET_REQUEST: -+ if (ctrl->bRequestType != (USB_DIR_OUT | -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) -+ break; -+ if (w_index != 0 || w_value != 0 || w_length != 0) { -+ value = -EDOM; -+ break; -+ } -+ -+ /* Raise an exception to stop the current operation -+ * and reinitialize our state. */ -+ DBG(fsg, "bulk reset request\n"); -+ raise_exception(fsg, FSG_STATE_RESET); -+ value = DELAYED_STATUS; -+ break; -+ -+ case US_BULK_GET_MAX_LUN: -+ if (ctrl->bRequestType != (USB_DIR_IN | -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) -+ break; -+ if (w_index != 0 || w_value != 0 || w_length != 1) { -+ value = -EDOM; -+ break; -+ } -+ VDBG(fsg, "get max LUN\n"); -+ *(u8 *) req->buf = fsg->nluns - 1; -+ value = 1; -+ break; -+ } -+ } -+ -+ /* Handle CBI class-specific requests */ -+ else { -+ switch (ctrl->bRequest) { -+ -+ case USB_CBI_ADSC_REQUEST: -+ if (ctrl->bRequestType != (USB_DIR_OUT | -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE)) -+ break; -+ if (w_index != 0 || w_value != 0) { -+ value = -EDOM; -+ break; -+ } -+ if (w_length > MAX_COMMAND_SIZE) { -+ value = -EOVERFLOW; -+ break; -+ } -+ value = w_length; -+ fsg->ep0req->context = received_cbi_adsc; -+ break; -+ } -+ } -+ -+ if (value == -EOPNOTSUPP) -+ VDBG(fsg, -+ "unknown class-specific control req " -+ "%02x.%02x v%04x i%04x l%u\n", -+ ctrl->bRequestType, ctrl->bRequest, -+ le16_to_cpu(ctrl->wValue), w_index, w_length); -+ return value; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Ep0 standard request handlers. These always run in_irq. */ -+ -+static int standard_setup_req(struct fsg_dev *fsg, -+ const struct usb_ctrlrequest *ctrl) -+{ -+ struct usb_request *req = fsg->ep0req; -+ int value = -EOPNOTSUPP; -+ u16 w_index = le16_to_cpu(ctrl->wIndex); -+ u16 w_value = le16_to_cpu(ctrl->wValue); -+ -+ /* Usually this just stores reply data in the pre-allocated ep0 buffer, -+ * but config change events will also reconfigure hardware. */ -+ switch (ctrl->bRequest) { -+ -+ case USB_REQ_GET_DESCRIPTOR: -+ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | -+ USB_RECIP_DEVICE)) -+ break; -+ switch (w_value >> 8) { -+ -+ case USB_DT_DEVICE: -+ VDBG(fsg, "get device descriptor\n"); -+ device_desc.bMaxPacketSize0 = fsg->ep0->maxpacket; -+ value = sizeof device_desc; -+ memcpy(req->buf, &device_desc, value); -+ break; -+ case USB_DT_DEVICE_QUALIFIER: -+ VDBG(fsg, "get device qualifier\n"); -+ if (!gadget_is_dualspeed(fsg->gadget) || -+ fsg->gadget->speed == USB_SPEED_SUPER) -+ break; -+ /* -+ * Assume ep0 uses the same maxpacket value for both -+ * speeds -+ */ -+ dev_qualifier.bMaxPacketSize0 = fsg->ep0->maxpacket; -+ value = sizeof dev_qualifier; -+ memcpy(req->buf, &dev_qualifier, value); -+ break; -+ -+ case USB_DT_OTHER_SPEED_CONFIG: -+ VDBG(fsg, "get other-speed config descriptor\n"); -+ if (!gadget_is_dualspeed(fsg->gadget) || -+ fsg->gadget->speed == USB_SPEED_SUPER) -+ break; -+ goto get_config; -+ case USB_DT_CONFIG: -+ VDBG(fsg, "get configuration descriptor\n"); -+get_config: -+ value = populate_config_buf(fsg->gadget, -+ req->buf, -+ w_value >> 8, -+ w_value & 0xff); -+ break; -+ -+ case USB_DT_STRING: -+ VDBG(fsg, "get string descriptor\n"); -+ -+ /* wIndex == language code */ -+ value = usb_gadget_get_string(&fsg_stringtab, -+ w_value & 0xff, req->buf); -+ break; -+ -+ case USB_DT_BOS: -+ VDBG(fsg, "get bos descriptor\n"); -+ -+ if (gadget_is_superspeed(fsg->gadget)) -+ value = populate_bos(fsg, req->buf); -+ break; -+ } -+ -+ break; -+ -+ /* One config, two speeds */ -+ case USB_REQ_SET_CONFIGURATION: -+ if (ctrl->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD | -+ USB_RECIP_DEVICE)) -+ break; -+ VDBG(fsg, "set configuration\n"); -+ if (w_value == CONFIG_VALUE || w_value == 0) { -+ fsg->new_config = w_value; -+ -+ /* Raise an exception to wipe out previous transaction -+ * state (queued bufs, etc) and set the new config. */ -+ raise_exception(fsg, FSG_STATE_CONFIG_CHANGE); -+ value = DELAYED_STATUS; -+ } -+ break; -+ case USB_REQ_GET_CONFIGURATION: -+ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | -+ USB_RECIP_DEVICE)) -+ break; -+ VDBG(fsg, "get configuration\n"); -+ *(u8 *) req->buf = fsg->config; -+ value = 1; -+ break; -+ -+ case USB_REQ_SET_INTERFACE: -+ if (ctrl->bRequestType != (USB_DIR_OUT| USB_TYPE_STANDARD | -+ USB_RECIP_INTERFACE)) -+ break; -+ if (fsg->config && w_index == 0) { -+ -+ /* Raise an exception to wipe out previous transaction -+ * state (queued bufs, etc) and install the new -+ * interface altsetting. */ -+ raise_exception(fsg, FSG_STATE_INTERFACE_CHANGE); -+ value = DELAYED_STATUS; -+ } -+ break; -+ case USB_REQ_GET_INTERFACE: -+ if (ctrl->bRequestType != (USB_DIR_IN | USB_TYPE_STANDARD | -+ USB_RECIP_INTERFACE)) -+ break; -+ if (!fsg->config) -+ break; -+ if (w_index != 0) { -+ value = -EDOM; -+ break; -+ } -+ VDBG(fsg, "get interface\n"); -+ *(u8 *) req->buf = 0; -+ value = 1; -+ break; -+ -+ default: -+ VDBG(fsg, -+ "unknown control req %02x.%02x v%04x i%04x l%u\n", -+ ctrl->bRequestType, ctrl->bRequest, -+ w_value, w_index, le16_to_cpu(ctrl->wLength)); -+ } -+ -+ return value; -+} -+ -+ -+static int fsg_setup(struct usb_gadget *gadget, -+ const struct usb_ctrlrequest *ctrl) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ int rc; -+ int w_length = le16_to_cpu(ctrl->wLength); -+ -+ ++fsg->ep0_req_tag; // Record arrival of a new request -+ fsg->ep0req->context = NULL; -+ fsg->ep0req->length = 0; -+ dump_msg(fsg, "ep0-setup", (u8 *) ctrl, sizeof(*ctrl)); -+ -+ if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_CLASS) -+ rc = class_setup_req(fsg, ctrl); -+ else -+ rc = standard_setup_req(fsg, ctrl); -+ -+ /* Respond with data/status or defer until later? */ -+ if (rc >= 0 && rc != DELAYED_STATUS) { -+ rc = min(rc, w_length); -+ fsg->ep0req->length = rc; -+ fsg->ep0req->zero = rc < w_length; -+ fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ? -+ "ep0-in" : "ep0-out"); -+ rc = ep0_queue(fsg); -+ } -+ -+ /* Device either stalls (rc < 0) or reports success */ -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* All the following routines run in process context */ -+ -+ -+/* Use this for bulk or interrupt transfers, not ep0 */ -+static void start_transfer(struct fsg_dev *fsg, struct usb_ep *ep, -+ struct usb_request *req, int *pbusy, -+ enum fsg_buffer_state *state) -+{ -+ int rc; -+ -+ if (ep == fsg->bulk_in) -+ dump_msg(fsg, "bulk-in", req->buf, req->length); -+ else if (ep == fsg->intr_in) -+ dump_msg(fsg, "intr-in", req->buf, req->length); -+ -+ spin_lock_irq(&fsg->lock); -+ *pbusy = 1; -+ *state = BUF_STATE_BUSY; -+ spin_unlock_irq(&fsg->lock); -+ rc = usb_ep_queue(ep, req, GFP_KERNEL); -+ if (rc != 0) { -+ *pbusy = 0; -+ *state = BUF_STATE_EMPTY; -+ -+ /* We can't do much more than wait for a reset */ -+ -+ /* Note: currently the net2280 driver fails zero-length -+ * submissions if DMA is enabled. */ -+ if (rc != -ESHUTDOWN && !(rc == -EOPNOTSUPP && -+ req->length == 0)) -+ WARNING(fsg, "error in submission: %s --> %d\n", -+ ep->name, rc); -+ } -+} -+ -+ -+static int sleep_thread(struct fsg_dev *fsg) -+{ -+ int rc = 0; -+ -+ /* Wait until a signal arrives or we are woken up */ -+ for (;;) { -+ try_to_freeze(); -+ set_current_state(TASK_INTERRUPTIBLE); -+ if (signal_pending(current)) { -+ rc = -EINTR; -+ break; -+ } -+ if (fsg->thread_wakeup_needed) -+ break; -+ schedule(); -+ } -+ __set_current_state(TASK_RUNNING); -+ fsg->thread_wakeup_needed = 0; -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_read(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba; -+ struct fsg_buffhd *bh; -+ int rc; -+ u32 amount_left; -+ loff_t file_offset, file_offset_tmp; -+ unsigned int amount; -+ ssize_t nread; -+ -+ /* Get the starting Logical Block Address and check that it's -+ * not too big */ -+ if (fsg->cmnd[0] == READ_6) -+ lba = get_unaligned_be24(&fsg->cmnd[1]); -+ else { -+ lba = get_unaligned_be32(&fsg->cmnd[2]); -+ -+ /* We allow DPO (Disable Page Out = don't save data in the -+ * cache) and FUA (Force Unit Access = don't read from the -+ * cache), but we don't implement them. */ -+ if ((fsg->cmnd[1] & ~0x18) != 0) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ } -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ file_offset = ((loff_t) lba) << curlun->blkbits; -+ -+ /* Carry out the file reads */ -+ amount_left = fsg->data_size_from_cmnd; -+ if (unlikely(amount_left == 0)) -+ return -EIO; // No default reply -+ -+ for (;;) { -+ -+ /* Figure out how much we need to read: -+ * Try to read the remaining amount. -+ * But don't read more than the buffer size. -+ * And don't try to read past the end of the file. -+ */ -+ amount = min((unsigned int) amount_left, mod_data.buflen); -+ amount = min((loff_t) amount, -+ curlun->file_length - file_offset); -+ -+ /* Wait for the next buffer to become available */ -+ bh = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ /* If we were asked to read past the end of file, -+ * end with an empty buffer. */ -+ if (amount == 0) { -+ curlun->sense_data = -+ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ bh->inreq->length = 0; -+ bh->state = BUF_STATE_FULL; -+ break; -+ } -+ -+ /* Perform the read */ -+ file_offset_tmp = file_offset; -+ nread = vfs_read(curlun->filp, -+ (char __user *) bh->buf, -+ amount, &file_offset_tmp); -+ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, -+ (unsigned long long) file_offset, -+ (int) nread); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ if (nread < 0) { -+ LDBG(curlun, "error in file read: %d\n", -+ (int) nread); -+ nread = 0; -+ } else if (nread < amount) { -+ LDBG(curlun, "partial file read: %d/%u\n", -+ (int) nread, amount); -+ nread = round_down(nread, curlun->blksize); -+ } -+ file_offset += nread; -+ amount_left -= nread; -+ fsg->residue -= nread; -+ -+ /* Except at the end of the transfer, nread will be -+ * equal to the buffer size, which is divisible by the -+ * bulk-in maxpacket size. -+ */ -+ bh->inreq->length = nread; -+ bh->state = BUF_STATE_FULL; -+ -+ /* If an error occurred, report it and its position */ -+ if (nread < amount) { -+ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ if (amount_left == 0) -+ break; // No more left to read -+ -+ /* Send this buffer and go read some more */ -+ bh->inreq->zero = 0; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ } -+ -+ return -EIO; // No default reply -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_write(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba; -+ struct fsg_buffhd *bh; -+ int get_some_more; -+ u32 amount_left_to_req, amount_left_to_write; -+ loff_t usb_offset, file_offset, file_offset_tmp; -+ unsigned int amount; -+ ssize_t nwritten; -+ int rc; -+ -+ if (curlun->ro) { -+ curlun->sense_data = SS_WRITE_PROTECTED; -+ return -EINVAL; -+ } -+ spin_lock(&curlun->filp->f_lock); -+ curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait -+ spin_unlock(&curlun->filp->f_lock); -+ -+ /* Get the starting Logical Block Address and check that it's -+ * not too big */ -+ if (fsg->cmnd[0] == WRITE_6) -+ lba = get_unaligned_be24(&fsg->cmnd[1]); -+ else { -+ lba = get_unaligned_be32(&fsg->cmnd[2]); -+ -+ /* We allow DPO (Disable Page Out = don't save data in the -+ * cache) and FUA (Force Unit Access = write directly to the -+ * medium). We don't implement DPO; we implement FUA by -+ * performing synchronous output. */ -+ if ((fsg->cmnd[1] & ~0x18) != 0) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ /* FUA */ -+ if (!curlun->nofua && (fsg->cmnd[1] & 0x08)) { -+ spin_lock(&curlun->filp->f_lock); -+ curlun->filp->f_flags |= O_DSYNC; -+ spin_unlock(&curlun->filp->f_lock); -+ } -+ } -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ -+ /* Carry out the file writes */ -+ get_some_more = 1; -+ file_offset = usb_offset = ((loff_t) lba) << curlun->blkbits; -+ amount_left_to_req = amount_left_to_write = fsg->data_size_from_cmnd; -+ -+ while (amount_left_to_write > 0) { -+ -+ /* Queue a request for more data from the host */ -+ bh = fsg->next_buffhd_to_fill; -+ if (bh->state == BUF_STATE_EMPTY && get_some_more) { -+ -+ /* Figure out how much we want to get: -+ * Try to get the remaining amount, -+ * but not more than the buffer size. -+ */ -+ amount = min(amount_left_to_req, mod_data.buflen); -+ -+ /* Beyond the end of the backing file? */ -+ if (usb_offset >= curlun->file_length) { -+ get_some_more = 0; -+ curlun->sense_data = -+ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ curlun->sense_data_info = usb_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ continue; -+ } -+ -+ /* Get the next buffer */ -+ usb_offset += amount; -+ fsg->usb_amount_left -= amount; -+ amount_left_to_req -= amount; -+ if (amount_left_to_req == 0) -+ get_some_more = 0; -+ -+ /* Except at the end of the transfer, amount will be -+ * equal to the buffer size, which is divisible by -+ * the bulk-out maxpacket size. -+ */ -+ set_bulk_out_req_length(fsg, bh, amount); -+ start_transfer(fsg, fsg->bulk_out, bh->outreq, -+ &bh->outreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ continue; -+ } -+ -+ /* Write the received data to the backing file */ -+ bh = fsg->next_buffhd_to_drain; -+ if (bh->state == BUF_STATE_EMPTY && !get_some_more) -+ break; // We stopped early -+ if (bh->state == BUF_STATE_FULL) { -+ smp_rmb(); -+ fsg->next_buffhd_to_drain = bh->next; -+ bh->state = BUF_STATE_EMPTY; -+ -+ /* Did something go wrong with the transfer? */ -+ if (bh->outreq->status != 0) { -+ curlun->sense_data = SS_COMMUNICATION_FAILURE; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ amount = bh->outreq->actual; -+ if (curlun->file_length - file_offset < amount) { -+ LERROR(curlun, -+ "write %u @ %llu beyond end %llu\n", -+ amount, (unsigned long long) file_offset, -+ (unsigned long long) curlun->file_length); -+ amount = curlun->file_length - file_offset; -+ } -+ -+ /* Don't accept excess data. The spec doesn't say -+ * what to do in this case. We'll ignore the error. -+ */ -+ amount = min(amount, bh->bulk_out_intended_length); -+ -+ /* Don't write a partial block */ -+ amount = round_down(amount, curlun->blksize); -+ if (amount == 0) -+ goto empty_write; -+ -+ /* Perform the write */ -+ file_offset_tmp = file_offset; -+ nwritten = vfs_write(curlun->filp, -+ (char __user *) bh->buf, -+ amount, &file_offset_tmp); -+ VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, -+ (unsigned long long) file_offset, -+ (int) nwritten); -+ if (signal_pending(current)) -+ return -EINTR; // Interrupted! -+ -+ if (nwritten < 0) { -+ LDBG(curlun, "error in file write: %d\n", -+ (int) nwritten); -+ nwritten = 0; -+ } else if (nwritten < amount) { -+ LDBG(curlun, "partial file write: %d/%u\n", -+ (int) nwritten, amount); -+ nwritten = round_down(nwritten, curlun->blksize); -+ } -+ file_offset += nwritten; -+ amount_left_to_write -= nwritten; -+ fsg->residue -= nwritten; -+ -+ /* If an error occurred, report it and its position */ -+ if (nwritten < amount) { -+ curlun->sense_data = SS_WRITE_ERROR; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ empty_write: -+ /* Did the host decide to stop early? */ -+ if (bh->outreq->actual < bh->bulk_out_intended_length) { -+ fsg->short_packet_received = 1; -+ break; -+ } -+ continue; -+ } -+ -+ /* Wait for something to happen */ -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ return -EIO; // No default reply -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_synchronize_cache(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int rc; -+ -+ /* We ignore the requested LBA and write out all file's -+ * dirty data buffers. */ -+ rc = fsg_lun_fsync_sub(curlun); -+ if (rc) -+ curlun->sense_data = SS_WRITE_ERROR; -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void invalidate_sub(struct fsg_lun *curlun) -+{ -+ struct file *filp = curlun->filp; -+ struct inode *inode = filp->f_path.dentry->d_inode; -+ unsigned long rc; -+ -+ rc = invalidate_mapping_pages(inode->i_mapping, 0, -1); -+ VLDBG(curlun, "invalidate_mapping_pages -> %ld\n", rc); -+} -+ -+static int do_verify(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba; -+ u32 verification_length; -+ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; -+ loff_t file_offset, file_offset_tmp; -+ u32 amount_left; -+ unsigned int amount; -+ ssize_t nread; -+ -+ /* Get the starting Logical Block Address and check that it's -+ * not too big */ -+ lba = get_unaligned_be32(&fsg->cmnd[2]); -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ -+ /* We allow DPO (Disable Page Out = don't save data in the -+ * cache) but we don't implement it. */ -+ if ((fsg->cmnd[1] & ~0x10) != 0) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ verification_length = get_unaligned_be16(&fsg->cmnd[7]); -+ if (unlikely(verification_length == 0)) -+ return -EIO; // No default reply -+ -+ /* Prepare to carry out the file verify */ -+ amount_left = verification_length << curlun->blkbits; -+ file_offset = ((loff_t) lba) << curlun->blkbits; -+ -+ /* Write out all the dirty buffers before invalidating them */ -+ fsg_lun_fsync_sub(curlun); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ invalidate_sub(curlun); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ /* Just try to read the requested blocks */ -+ while (amount_left > 0) { -+ -+ /* Figure out how much we need to read: -+ * Try to read the remaining amount, but not more than -+ * the buffer size. -+ * And don't try to read past the end of the file. -+ */ -+ amount = min((unsigned int) amount_left, mod_data.buflen); -+ amount = min((loff_t) amount, -+ curlun->file_length - file_offset); -+ if (amount == 0) { -+ curlun->sense_data = -+ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ -+ /* Perform the read */ -+ file_offset_tmp = file_offset; -+ nread = vfs_read(curlun->filp, -+ (char __user *) bh->buf, -+ amount, &file_offset_tmp); -+ VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, -+ (unsigned long long) file_offset, -+ (int) nread); -+ if (signal_pending(current)) -+ return -EINTR; -+ -+ if (nread < 0) { -+ LDBG(curlun, "error in file verify: %d\n", -+ (int) nread); -+ nread = 0; -+ } else if (nread < amount) { -+ LDBG(curlun, "partial file verify: %d/%u\n", -+ (int) nread, amount); -+ nread = round_down(nread, curlun->blksize); -+ } -+ if (nread == 0) { -+ curlun->sense_data = SS_UNRECOVERED_READ_ERROR; -+ curlun->sense_data_info = file_offset >> curlun->blkbits; -+ curlun->info_valid = 1; -+ break; -+ } -+ file_offset += nread; -+ amount_left -= nread; -+ } -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ u8 *buf = (u8 *) bh->buf; -+ -+ static char vendor_id[] = "Linux "; -+ static char product_disk_id[] = "File-Stor Gadget"; -+ static char product_cdrom_id[] = "File-CD Gadget "; -+ -+ if (!fsg->curlun) { // Unsupported LUNs are okay -+ fsg->bad_lun_okay = 1; -+ memset(buf, 0, 36); -+ buf[0] = 0x7f; // Unsupported, no device-type -+ buf[4] = 31; // Additional length -+ return 36; -+ } -+ -+ memset(buf, 0, 8); -+ buf[0] = (mod_data.cdrom ? TYPE_ROM : TYPE_DISK); -+ if (mod_data.removable) -+ buf[1] = 0x80; -+ buf[2] = 2; // ANSI SCSI level 2 -+ buf[3] = 2; // SCSI-2 INQUIRY data format -+ buf[4] = 31; // Additional length -+ // No special options -+ sprintf(buf + 8, "%-8s%-16s%04x", vendor_id, -+ (mod_data.cdrom ? product_cdrom_id : -+ product_disk_id), -+ mod_data.release); -+ return 36; -+} -+ -+ -+static int do_request_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u8 *buf = (u8 *) bh->buf; -+ u32 sd, sdinfo; -+ int valid; -+ -+ /* -+ * From the SCSI-2 spec., section 7.9 (Unit attention condition): -+ * -+ * If a REQUEST SENSE command is received from an initiator -+ * with a pending unit attention condition (before the target -+ * generates the contingent allegiance condition), then the -+ * target shall either: -+ * a) report any pending sense data and preserve the unit -+ * attention condition on the logical unit, or, -+ * b) report the unit attention condition, may discard any -+ * pending sense data, and clear the unit attention -+ * condition on the logical unit for that initiator. -+ * -+ * FSG normally uses option a); enable this code to use option b). -+ */ -+#if 0 -+ if (curlun && curlun->unit_attention_data != SS_NO_SENSE) { -+ curlun->sense_data = curlun->unit_attention_data; -+ curlun->unit_attention_data = SS_NO_SENSE; -+ } -+#endif -+ -+ if (!curlun) { // Unsupported LUNs are okay -+ fsg->bad_lun_okay = 1; -+ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; -+ sdinfo = 0; -+ valid = 0; -+ } else { -+ sd = curlun->sense_data; -+ sdinfo = curlun->sense_data_info; -+ valid = curlun->info_valid << 7; -+ curlun->sense_data = SS_NO_SENSE; -+ curlun->sense_data_info = 0; -+ curlun->info_valid = 0; -+ } -+ -+ memset(buf, 0, 18); -+ buf[0] = valid | 0x70; // Valid, current error -+ buf[2] = SK(sd); -+ put_unaligned_be32(sdinfo, &buf[3]); /* Sense information */ -+ buf[7] = 18 - 8; // Additional sense length -+ buf[12] = ASC(sd); -+ buf[13] = ASCQ(sd); -+ return 18; -+} -+ -+ -+static int do_read_capacity(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); -+ int pmi = fsg->cmnd[8]; -+ u8 *buf = (u8 *) bh->buf; -+ -+ /* Check the PMI and LBA fields */ -+ if (pmi > 1 || (pmi == 0 && lba != 0)) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); -+ /* Max logical block */ -+ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ -+ return 8; -+} -+ -+ -+static int do_read_header(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int msf = fsg->cmnd[1] & 0x02; -+ u32 lba = get_unaligned_be32(&fsg->cmnd[2]); -+ u8 *buf = (u8 *) bh->buf; -+ -+ if ((fsg->cmnd[1] & ~0x02) != 0) { /* Mask away MSF */ -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ if (lba >= curlun->num_sectors) { -+ curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; -+ return -EINVAL; -+ } -+ -+ memset(buf, 0, 8); -+ buf[0] = 0x01; /* 2048 bytes of user data, rest is EC */ -+ store_cdrom_address(&buf[4], msf, lba); -+ return 8; -+} -+ -+ -+static int do_read_toc(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int msf = fsg->cmnd[1] & 0x02; -+ int start_track = fsg->cmnd[6]; -+ u8 *buf = (u8 *) bh->buf; -+ -+ if ((fsg->cmnd[1] & ~0x02) != 0 || /* Mask away MSF */ -+ start_track > 1) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ memset(buf, 0, 20); -+ buf[1] = (20-2); /* TOC data length */ -+ buf[2] = 1; /* First track number */ -+ buf[3] = 1; /* Last track number */ -+ buf[5] = 0x16; /* Data track, copying allowed */ -+ buf[6] = 0x01; /* Only track is number 1 */ -+ store_cdrom_address(&buf[8], msf, 0); -+ -+ buf[13] = 0x16; /* Lead-out track is data */ -+ buf[14] = 0xAA; /* Lead-out track number */ -+ store_cdrom_address(&buf[16], msf, curlun->num_sectors); -+ return 20; -+} -+ -+ -+static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int mscmnd = fsg->cmnd[0]; -+ u8 *buf = (u8 *) bh->buf; -+ u8 *buf0 = buf; -+ int pc, page_code; -+ int changeable_values, all_pages; -+ int valid_page = 0; -+ int len, limit; -+ -+ if ((fsg->cmnd[1] & ~0x08) != 0) { // Mask away DBD -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ pc = fsg->cmnd[2] >> 6; -+ page_code = fsg->cmnd[2] & 0x3f; -+ if (pc == 3) { -+ curlun->sense_data = SS_SAVING_PARAMETERS_NOT_SUPPORTED; -+ return -EINVAL; -+ } -+ changeable_values = (pc == 1); -+ all_pages = (page_code == 0x3f); -+ -+ /* Write the mode parameter header. Fixed values are: default -+ * medium type, no cache control (DPOFUA), and no block descriptors. -+ * The only variable value is the WriteProtect bit. We will fill in -+ * the mode data length later. */ -+ memset(buf, 0, 8); -+ if (mscmnd == MODE_SENSE) { -+ buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA -+ buf += 4; -+ limit = 255; -+ } else { // MODE_SENSE_10 -+ buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA -+ buf += 8; -+ limit = 65535; // Should really be mod_data.buflen -+ } -+ -+ /* No block descriptors */ -+ -+ /* The mode pages, in numerical order. The only page we support -+ * is the Caching page. */ -+ if (page_code == 0x08 || all_pages) { -+ valid_page = 1; -+ buf[0] = 0x08; // Page code -+ buf[1] = 10; // Page length -+ memset(buf+2, 0, 10); // None of the fields are changeable -+ -+ if (!changeable_values) { -+ buf[2] = 0x04; // Write cache enable, -+ // Read cache not disabled -+ // No cache retention priorities -+ put_unaligned_be16(0xffff, &buf[4]); -+ /* Don't disable prefetch */ -+ /* Minimum prefetch = 0 */ -+ put_unaligned_be16(0xffff, &buf[8]); -+ /* Maximum prefetch */ -+ put_unaligned_be16(0xffff, &buf[10]); -+ /* Maximum prefetch ceiling */ -+ } -+ buf += 12; -+ } -+ -+ /* Check that a valid page was requested and the mode data length -+ * isn't too long. */ -+ len = buf - buf0; -+ if (!valid_page || len > limit) { -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ /* Store the mode data length */ -+ if (mscmnd == MODE_SENSE) -+ buf0[0] = len - 1; -+ else -+ put_unaligned_be16(len - 2, buf0); -+ return len; -+} -+ -+ -+static int do_start_stop(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int loej, start; -+ -+ if (!mod_data.removable) { -+ curlun->sense_data = SS_INVALID_COMMAND; -+ return -EINVAL; -+ } -+ -+ // int immed = fsg->cmnd[1] & 0x01; -+ loej = fsg->cmnd[4] & 0x02; -+ start = fsg->cmnd[4] & 0x01; -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ if ((fsg->cmnd[1] & ~0x01) != 0 || // Mask away Immed -+ (fsg->cmnd[4] & ~0x03) != 0) { // Mask LoEj, Start -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ if (!start) { -+ -+ /* Are we allowed to unload the media? */ -+ if (curlun->prevent_medium_removal) { -+ LDBG(curlun, "unload attempt prevented\n"); -+ curlun->sense_data = SS_MEDIUM_REMOVAL_PREVENTED; -+ return -EINVAL; -+ } -+ if (loej) { // Simulate an unload/eject -+ up_read(&fsg->filesem); -+ down_write(&fsg->filesem); -+ fsg_lun_close(curlun); -+ up_write(&fsg->filesem); -+ down_read(&fsg->filesem); -+ } -+ } else { -+ -+ /* Our emulation doesn't support mounting; the medium is -+ * available for use as soon as it is loaded. */ -+ if (!fsg_lun_is_open(curlun)) { -+ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; -+ return -EINVAL; -+ } -+ } -+#endif -+ return 0; -+} -+ -+ -+static int do_prevent_allow(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ int prevent; -+ -+ if (!mod_data.removable) { -+ curlun->sense_data = SS_INVALID_COMMAND; -+ return -EINVAL; -+ } -+ -+ prevent = fsg->cmnd[4] & 0x01; -+ if ((fsg->cmnd[4] & ~0x01) != 0) { // Mask away Prevent -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ -+ if (curlun->prevent_medium_removal && !prevent) -+ fsg_lun_fsync_sub(curlun); -+ curlun->prevent_medium_removal = prevent; -+ return 0; -+} -+ -+ -+static int do_read_format_capacities(struct fsg_dev *fsg, -+ struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ u8 *buf = (u8 *) bh->buf; -+ -+ buf[0] = buf[1] = buf[2] = 0; -+ buf[3] = 8; // Only the Current/Maximum Capacity Descriptor -+ buf += 4; -+ -+ put_unaligned_be32(curlun->num_sectors, &buf[0]); -+ /* Number of blocks */ -+ put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ -+ buf[4] = 0x02; /* Current capacity */ -+ return 12; -+} -+ -+ -+static int do_mode_select(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ -+ /* We don't support MODE SELECT */ -+ curlun->sense_data = SS_INVALID_COMMAND; -+ return -EINVAL; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int halt_bulk_in_endpoint(struct fsg_dev *fsg) -+{ -+ int rc; -+ -+ rc = fsg_set_halt(fsg, fsg->bulk_in); -+ if (rc == -EAGAIN) -+ VDBG(fsg, "delayed bulk-in endpoint halt\n"); -+ while (rc != 0) { -+ if (rc != -EAGAIN) { -+ WARNING(fsg, "usb_ep_set_halt -> %d\n", rc); -+ rc = 0; -+ break; -+ } -+ -+ /* Wait for a short time and then try again */ -+ if (msleep_interruptible(100) != 0) -+ return -EINTR; -+ rc = usb_ep_set_halt(fsg->bulk_in); -+ } -+ return rc; -+} -+ -+static int wedge_bulk_in_endpoint(struct fsg_dev *fsg) -+{ -+ int rc; -+ -+ DBG(fsg, "bulk-in set wedge\n"); -+ rc = usb_ep_set_wedge(fsg->bulk_in); -+ if (rc == -EAGAIN) -+ VDBG(fsg, "delayed bulk-in endpoint wedge\n"); -+ while (rc != 0) { -+ if (rc != -EAGAIN) { -+ WARNING(fsg, "usb_ep_set_wedge -> %d\n", rc); -+ rc = 0; -+ break; -+ } -+ -+ /* Wait for a short time and then try again */ -+ if (msleep_interruptible(100) != 0) -+ return -EINTR; -+ rc = usb_ep_set_wedge(fsg->bulk_in); -+ } -+ return rc; -+} -+ -+static int throw_away_data(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh; -+ u32 amount; -+ int rc; -+ -+ while ((bh = fsg->next_buffhd_to_drain)->state != BUF_STATE_EMPTY || -+ fsg->usb_amount_left > 0) { -+ -+ /* Throw away the data in a filled buffer */ -+ if (bh->state == BUF_STATE_FULL) { -+ smp_rmb(); -+ bh->state = BUF_STATE_EMPTY; -+ fsg->next_buffhd_to_drain = bh->next; -+ -+ /* A short packet or an error ends everything */ -+ if (bh->outreq->actual < bh->bulk_out_intended_length || -+ bh->outreq->status != 0) { -+ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); -+ return -EINTR; -+ } -+ continue; -+ } -+ -+ /* Try to submit another request if we need one */ -+ bh = fsg->next_buffhd_to_fill; -+ if (bh->state == BUF_STATE_EMPTY && fsg->usb_amount_left > 0) { -+ amount = min(fsg->usb_amount_left, -+ (u32) mod_data.buflen); -+ -+ /* Except at the end of the transfer, amount will be -+ * equal to the buffer size, which is divisible by -+ * the bulk-out maxpacket size. -+ */ -+ set_bulk_out_req_length(fsg, bh, amount); -+ start_transfer(fsg, fsg->bulk_out, bh->outreq, -+ &bh->outreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ fsg->usb_amount_left -= amount; -+ continue; -+ } -+ -+ /* Otherwise wait for something to happen */ -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ return 0; -+} -+ -+ -+static int finish_reply(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh = fsg->next_buffhd_to_fill; -+ int rc = 0; -+ -+ switch (fsg->data_dir) { -+ case DATA_DIR_NONE: -+ break; // Nothing to send -+ -+ /* If we don't know whether the host wants to read or write, -+ * this must be CB or CBI with an unknown command. We mustn't -+ * try to send or receive any data. So stall both bulk pipes -+ * if we can and wait for a reset. */ -+ case DATA_DIR_UNKNOWN: -+ if (mod_data.can_stall) { -+ fsg_set_halt(fsg, fsg->bulk_out); -+ rc = halt_bulk_in_endpoint(fsg); -+ } -+ break; -+ -+ /* All but the last buffer of data must have already been sent */ -+ case DATA_DIR_TO_HOST: -+ if (fsg->data_size == 0) -+ ; // Nothing to send -+ -+ /* If there's no residue, simply send the last buffer */ -+ else if (fsg->residue == 0) { -+ bh->inreq->zero = 0; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ } -+ -+ /* There is a residue. For CB and CBI, simply mark the end -+ * of the data with a short packet. However, if we are -+ * allowed to stall, there was no data at all (residue == -+ * data_size), and the command failed (invalid LUN or -+ * sense data is set), then halt the bulk-in endpoint -+ * instead. */ -+ else if (!transport_is_bbb()) { -+ if (mod_data.can_stall && -+ fsg->residue == fsg->data_size && -+ (!fsg->curlun || fsg->curlun->sense_data != SS_NO_SENSE)) { -+ bh->state = BUF_STATE_EMPTY; -+ rc = halt_bulk_in_endpoint(fsg); -+ } else { -+ bh->inreq->zero = 1; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ } -+ } -+ -+ /* -+ * For Bulk-only, mark the end of the data with a short -+ * packet. If we are allowed to stall, halt the bulk-in -+ * endpoint. (Note: This violates the Bulk-Only Transport -+ * specification, which requires us to pad the data if we -+ * don't halt the endpoint. Presumably nobody will mind.) -+ */ -+ else { -+ bh->inreq->zero = 1; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ fsg->next_buffhd_to_fill = bh->next; -+ if (mod_data.can_stall) -+ rc = halt_bulk_in_endpoint(fsg); -+ } -+ break; -+ -+ /* We have processed all we want from the data the host has sent. -+ * There may still be outstanding bulk-out requests. */ -+ case DATA_DIR_FROM_HOST: -+ if (fsg->residue == 0) -+ ; // Nothing to receive -+ -+ /* Did the host stop sending unexpectedly early? */ -+ else if (fsg->short_packet_received) { -+ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); -+ rc = -EINTR; -+ } -+ -+ /* We haven't processed all the incoming data. Even though -+ * we may be allowed to stall, doing so would cause a race. -+ * The controller may already have ACK'ed all the remaining -+ * bulk-out packets, in which case the host wouldn't see a -+ * STALL. Not realizing the endpoint was halted, it wouldn't -+ * clear the halt -- leading to problems later on. */ -+#if 0 -+ else if (mod_data.can_stall) { -+ fsg_set_halt(fsg, fsg->bulk_out); -+ raise_exception(fsg, FSG_STATE_ABORT_BULK_OUT); -+ rc = -EINTR; -+ } -+#endif -+ -+ /* We can't stall. Read in the excess data and throw it -+ * all away. */ -+ else -+ rc = throw_away_data(fsg); -+ break; -+ } -+ return rc; -+} -+ -+ -+static int send_status(struct fsg_dev *fsg) -+{ -+ struct fsg_lun *curlun = fsg->curlun; -+ struct fsg_buffhd *bh; -+ int rc; -+ u8 status = US_BULK_STAT_OK; -+ u32 sd, sdinfo = 0; -+ -+ /* Wait for the next buffer to become available */ -+ bh = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ if (curlun) { -+ sd = curlun->sense_data; -+ sdinfo = curlun->sense_data_info; -+ } else if (fsg->bad_lun_okay) -+ sd = SS_NO_SENSE; -+ else -+ sd = SS_LOGICAL_UNIT_NOT_SUPPORTED; -+ -+ if (fsg->phase_error) { -+ DBG(fsg, "sending phase-error status\n"); -+ status = US_BULK_STAT_PHASE; -+ sd = SS_INVALID_COMMAND; -+ } else if (sd != SS_NO_SENSE) { -+ DBG(fsg, "sending command-failure status\n"); -+ status = US_BULK_STAT_FAIL; -+ VDBG(fsg, " sense data: SK x%02x, ASC x%02x, ASCQ x%02x;" -+ " info x%x\n", -+ SK(sd), ASC(sd), ASCQ(sd), sdinfo); -+ } -+ -+ if (transport_is_bbb()) { -+ struct bulk_cs_wrap *csw = bh->buf; -+ -+ /* Store and send the Bulk-only CSW */ -+ csw->Signature = cpu_to_le32(US_BULK_CS_SIGN); -+ csw->Tag = fsg->tag; -+ csw->Residue = cpu_to_le32(fsg->residue); -+ csw->Status = status; -+ -+ bh->inreq->length = US_BULK_CS_WRAP_LEN; -+ bh->inreq->zero = 0; -+ start_transfer(fsg, fsg->bulk_in, bh->inreq, -+ &bh->inreq_busy, &bh->state); -+ -+ } else if (mod_data.transport_type == USB_PR_CB) { -+ -+ /* Control-Bulk transport has no status phase! */ -+ return 0; -+ -+ } else { // USB_PR_CBI -+ struct interrupt_data *buf = bh->buf; -+ -+ /* Store and send the Interrupt data. UFI sends the ASC -+ * and ASCQ bytes. Everything else sends a Type (which -+ * is always 0) and the status Value. */ -+ if (mod_data.protocol_type == USB_SC_UFI) { -+ buf->bType = ASC(sd); -+ buf->bValue = ASCQ(sd); -+ } else { -+ buf->bType = 0; -+ buf->bValue = status; -+ } -+ fsg->intreq->length = CBI_INTERRUPT_DATA_LEN; -+ -+ fsg->intr_buffhd = bh; // Point to the right buffhd -+ fsg->intreq->buf = bh->inreq->buf; -+ fsg->intreq->context = bh; -+ start_transfer(fsg, fsg->intr_in, fsg->intreq, -+ &fsg->intreq_busy, &bh->state); -+ } -+ -+ fsg->next_buffhd_to_fill = bh->next; -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Check whether the command is properly formed and whether its data size -+ * and direction agree with the values we already have. */ -+static int check_command(struct fsg_dev *fsg, int cmnd_size, -+ enum data_direction data_dir, unsigned int mask, -+ int needs_medium, const char *name) -+{ -+ int i; -+ int lun = fsg->cmnd[1] >> 5; -+ static const char dirletter[4] = {'u', 'o', 'i', 'n'}; -+ char hdlen[20]; -+ struct fsg_lun *curlun; -+ -+ /* Adjust the expected cmnd_size for protocol encapsulation padding. -+ * Transparent SCSI doesn't pad. */ -+ if (protocol_is_scsi()) -+ ; -+ -+ /* There's some disagreement as to whether RBC pads commands or not. -+ * We'll play it safe and accept either form. */ -+ else if (mod_data.protocol_type == USB_SC_RBC) { -+ if (fsg->cmnd_size == 12) -+ cmnd_size = 12; -+ -+ /* All the other protocols pad to 12 bytes */ -+ } else -+ cmnd_size = 12; -+ -+ hdlen[0] = 0; -+ if (fsg->data_dir != DATA_DIR_UNKNOWN) -+ sprintf(hdlen, ", H%c=%u", dirletter[(int) fsg->data_dir], -+ fsg->data_size); -+ VDBG(fsg, "SCSI command: %s; Dc=%d, D%c=%u; Hc=%d%s\n", -+ name, cmnd_size, dirletter[(int) data_dir], -+ fsg->data_size_from_cmnd, fsg->cmnd_size, hdlen); -+ -+ /* We can't reply at all until we know the correct data direction -+ * and size. */ -+ if (fsg->data_size_from_cmnd == 0) -+ data_dir = DATA_DIR_NONE; -+ if (fsg->data_dir == DATA_DIR_UNKNOWN) { // CB or CBI -+ fsg->data_dir = data_dir; -+ fsg->data_size = fsg->data_size_from_cmnd; -+ -+ } else { // Bulk-only -+ if (fsg->data_size < fsg->data_size_from_cmnd) { -+ -+ /* Host data size < Device data size is a phase error. -+ * Carry out the command, but only transfer as much -+ * as we are allowed. */ -+ fsg->data_size_from_cmnd = fsg->data_size; -+ fsg->phase_error = 1; -+ } -+ } -+ fsg->residue = fsg->usb_amount_left = fsg->data_size; -+ -+ /* Conflicting data directions is a phase error */ -+ if (fsg->data_dir != data_dir && fsg->data_size_from_cmnd > 0) { -+ fsg->phase_error = 1; -+ return -EINVAL; -+ } -+ -+ /* Verify the length of the command itself */ -+ if (cmnd_size != fsg->cmnd_size) { -+ -+ /* Special case workaround: There are plenty of buggy SCSI -+ * implementations. Many have issues with cbw->Length -+ * field passing a wrong command size. For those cases we -+ * always try to work around the problem by using the length -+ * sent by the host side provided it is at least as large -+ * as the correct command length. -+ * Examples of such cases would be MS-Windows, which issues -+ * REQUEST SENSE with cbw->Length == 12 where it should -+ * be 6, and xbox360 issuing INQUIRY, TEST UNIT READY and -+ * REQUEST SENSE with cbw->Length == 10 where it should -+ * be 6 as well. -+ */ -+ if (cmnd_size <= fsg->cmnd_size) { -+ DBG(fsg, "%s is buggy! Expected length %d " -+ "but we got %d\n", name, -+ cmnd_size, fsg->cmnd_size); -+ cmnd_size = fsg->cmnd_size; -+ } else { -+ fsg->phase_error = 1; -+ return -EINVAL; -+ } -+ } -+ -+ /* Check that the LUN values are consistent */ -+ if (transport_is_bbb()) { -+ if (fsg->lun != lun) -+ DBG(fsg, "using LUN %d from CBW, " -+ "not LUN %d from CDB\n", -+ fsg->lun, lun); -+ } -+ -+ /* Check the LUN */ -+ curlun = fsg->curlun; -+ if (curlun) { -+ if (fsg->cmnd[0] != REQUEST_SENSE) { -+ curlun->sense_data = SS_NO_SENSE; -+ curlun->sense_data_info = 0; -+ curlun->info_valid = 0; -+ } -+ } else { -+ fsg->bad_lun_okay = 0; -+ -+ /* INQUIRY and REQUEST SENSE commands are explicitly allowed -+ * to use unsupported LUNs; all others may not. */ -+ if (fsg->cmnd[0] != INQUIRY && -+ fsg->cmnd[0] != REQUEST_SENSE) { -+ DBG(fsg, "unsupported LUN %d\n", fsg->lun); -+ return -EINVAL; -+ } -+ } -+ -+ /* If a unit attention condition exists, only INQUIRY and -+ * REQUEST SENSE commands are allowed; anything else must fail. */ -+ if (curlun && curlun->unit_attention_data != SS_NO_SENSE && -+ fsg->cmnd[0] != INQUIRY && -+ fsg->cmnd[0] != REQUEST_SENSE) { -+ curlun->sense_data = curlun->unit_attention_data; -+ curlun->unit_attention_data = SS_NO_SENSE; -+ return -EINVAL; -+ } -+ -+ /* Check that only command bytes listed in the mask are non-zero */ -+ fsg->cmnd[1] &= 0x1f; // Mask away the LUN -+ for (i = 1; i < cmnd_size; ++i) { -+ if (fsg->cmnd[i] && !(mask & (1 << i))) { -+ if (curlun) -+ curlun->sense_data = SS_INVALID_FIELD_IN_CDB; -+ return -EINVAL; -+ } -+ } -+ -+ /* If the medium isn't mounted and the command needs to access -+ * it, return an error. */ -+ if (curlun && !fsg_lun_is_open(curlun) && needs_medium) { -+ curlun->sense_data = SS_MEDIUM_NOT_PRESENT; -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/* wrapper of check_command for data size in blocks handling */ -+static int check_command_size_in_blocks(struct fsg_dev *fsg, int cmnd_size, -+ enum data_direction data_dir, unsigned int mask, -+ int needs_medium, const char *name) -+{ -+ if (fsg->curlun) -+ fsg->data_size_from_cmnd <<= fsg->curlun->blkbits; -+ return check_command(fsg, cmnd_size, data_dir, -+ mask, needs_medium, name); -+} -+ -+static int do_scsi_command(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh; -+ int rc; -+ int reply = -EINVAL; -+ int i; -+ static char unknown[16]; -+ -+ dump_cdb(fsg); -+ -+ /* Wait for the next buffer to become available for data or status */ -+ bh = fsg->next_buffhd_to_drain = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ fsg->phase_error = 0; -+ fsg->short_packet_received = 0; -+ -+ down_read(&fsg->filesem); // We're using the backing file -+ switch (fsg->cmnd[0]) { -+ -+ case INQUIRY: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, -+ (1<<4), 0, -+ "INQUIRY")) == 0) -+ reply = do_inquiry(fsg, bh); -+ break; -+ -+ case MODE_SELECT: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, -+ (1<<1) | (1<<4), 0, -+ "MODE SELECT(6)")) == 0) -+ reply = do_mode_select(fsg, bh); -+ break; -+ -+ case MODE_SELECT_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, -+ (1<<1) | (3<<7), 0, -+ "MODE SELECT(10)")) == 0) -+ reply = do_mode_select(fsg, bh); -+ break; -+ -+ case MODE_SENSE: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, -+ (1<<1) | (1<<2) | (1<<4), 0, -+ "MODE SENSE(6)")) == 0) -+ reply = do_mode_sense(fsg, bh); -+ break; -+ -+ case MODE_SENSE_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (1<<1) | (1<<2) | (3<<7), 0, -+ "MODE SENSE(10)")) == 0) -+ reply = do_mode_sense(fsg, bh); -+ break; -+ -+ case ALLOW_MEDIUM_REMOVAL: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, -+ (1<<4), 0, -+ "PREVENT-ALLOW MEDIUM REMOVAL")) == 0) -+ reply = do_prevent_allow(fsg); -+ break; -+ -+ case READ_6: -+ i = fsg->cmnd[4]; -+ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; -+ if ((reply = check_command_size_in_blocks(fsg, 6, -+ DATA_DIR_TO_HOST, -+ (7<<1) | (1<<4), 1, -+ "READ(6)")) == 0) -+ reply = do_read(fsg); -+ break; -+ -+ case READ_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command_size_in_blocks(fsg, 10, -+ DATA_DIR_TO_HOST, -+ (1<<1) | (0xf<<2) | (3<<7), 1, -+ "READ(10)")) == 0) -+ reply = do_read(fsg); -+ break; -+ -+ case READ_12: -+ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); -+ if ((reply = check_command_size_in_blocks(fsg, 12, -+ DATA_DIR_TO_HOST, -+ (1<<1) | (0xf<<2) | (0xf<<6), 1, -+ "READ(12)")) == 0) -+ reply = do_read(fsg); -+ break; -+ -+ case READ_CAPACITY: -+ fsg->data_size_from_cmnd = 8; -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (0xf<<2) | (1<<8), 1, -+ "READ CAPACITY")) == 0) -+ reply = do_read_capacity(fsg, bh); -+ break; -+ -+ case READ_HEADER: -+ if (!mod_data.cdrom) -+ goto unknown_cmnd; -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (3<<7) | (0x1f<<1), 1, -+ "READ HEADER")) == 0) -+ reply = do_read_header(fsg, bh); -+ break; -+ -+ case READ_TOC: -+ if (!mod_data.cdrom) -+ goto unknown_cmnd; -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (7<<6) | (1<<1), 1, -+ "READ TOC")) == 0) -+ reply = do_read_toc(fsg, bh); -+ break; -+ -+ case READ_FORMAT_CAPACITIES: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, -+ (3<<7), 1, -+ "READ FORMAT CAPACITIES")) == 0) -+ reply = do_read_format_capacities(fsg, bh); -+ break; -+ -+ case REQUEST_SENSE: -+ fsg->data_size_from_cmnd = fsg->cmnd[4]; -+ if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, -+ (1<<4), 0, -+ "REQUEST SENSE")) == 0) -+ reply = do_request_sense(fsg, bh); -+ break; -+ -+ case START_STOP: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 6, DATA_DIR_NONE, -+ (1<<1) | (1<<4), 0, -+ "START-STOP UNIT")) == 0) -+ reply = do_start_stop(fsg); -+ break; -+ -+ case SYNCHRONIZE_CACHE: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, -+ (0xf<<2) | (3<<7), 1, -+ "SYNCHRONIZE CACHE")) == 0) -+ reply = do_synchronize_cache(fsg); -+ break; -+ -+ case TEST_UNIT_READY: -+ fsg->data_size_from_cmnd = 0; -+ reply = check_command(fsg, 6, DATA_DIR_NONE, -+ 0, 1, -+ "TEST UNIT READY"); -+ break; -+ -+ /* Although optional, this command is used by MS-Windows. We -+ * support a minimal version: BytChk must be 0. */ -+ case VERIFY: -+ fsg->data_size_from_cmnd = 0; -+ if ((reply = check_command(fsg, 10, DATA_DIR_NONE, -+ (1<<1) | (0xf<<2) | (3<<7), 1, -+ "VERIFY")) == 0) -+ reply = do_verify(fsg); -+ break; -+ -+ case WRITE_6: -+ i = fsg->cmnd[4]; -+ fsg->data_size_from_cmnd = (i == 0) ? 256 : i; -+ if ((reply = check_command_size_in_blocks(fsg, 6, -+ DATA_DIR_FROM_HOST, -+ (7<<1) | (1<<4), 1, -+ "WRITE(6)")) == 0) -+ reply = do_write(fsg); -+ break; -+ -+ case WRITE_10: -+ fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); -+ if ((reply = check_command_size_in_blocks(fsg, 10, -+ DATA_DIR_FROM_HOST, -+ (1<<1) | (0xf<<2) | (3<<7), 1, -+ "WRITE(10)")) == 0) -+ reply = do_write(fsg); -+ break; -+ -+ case WRITE_12: -+ fsg->data_size_from_cmnd = get_unaligned_be32(&fsg->cmnd[6]); -+ if ((reply = check_command_size_in_blocks(fsg, 12, -+ DATA_DIR_FROM_HOST, -+ (1<<1) | (0xf<<2) | (0xf<<6), 1, -+ "WRITE(12)")) == 0) -+ reply = do_write(fsg); -+ break; -+ -+ /* Some mandatory commands that we recognize but don't implement. -+ * They don't mean much in this setting. It's left as an exercise -+ * for anyone interested to implement RESERVE and RELEASE in terms -+ * of Posix locks. */ -+ case FORMAT_UNIT: -+ case RELEASE: -+ case RESERVE: -+ case SEND_DIAGNOSTIC: -+ // Fall through -+ -+ default: -+ unknown_cmnd: -+ fsg->data_size_from_cmnd = 0; -+ sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); -+ if ((reply = check_command(fsg, fsg->cmnd_size, -+ DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { -+ fsg->curlun->sense_data = SS_INVALID_COMMAND; -+ reply = -EINVAL; -+ } -+ break; -+ } -+ up_read(&fsg->filesem); -+ -+ if (reply == -EINTR || signal_pending(current)) -+ return -EINTR; -+ -+ /* Set up the single reply buffer for finish_reply() */ -+ if (reply == -EINVAL) -+ reply = 0; // Error reply length -+ if (reply >= 0 && fsg->data_dir == DATA_DIR_TO_HOST) { -+ reply = min((u32) reply, fsg->data_size_from_cmnd); -+ bh->inreq->length = reply; -+ bh->state = BUF_STATE_FULL; -+ fsg->residue -= reply; -+ } // Otherwise it's already set -+ -+ return 0; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) -+{ -+ struct usb_request *req = bh->outreq; -+ struct bulk_cb_wrap *cbw = req->buf; -+ -+ /* Was this a real packet? Should it be ignored? */ -+ if (req->status || test_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) -+ return -EINVAL; -+ -+ /* Is the CBW valid? */ -+ if (req->actual != US_BULK_CB_WRAP_LEN || -+ cbw->Signature != cpu_to_le32( -+ US_BULK_CB_SIGN)) { -+ DBG(fsg, "invalid CBW: len %u sig 0x%x\n", -+ req->actual, -+ le32_to_cpu(cbw->Signature)); -+ -+ /* The Bulk-only spec says we MUST stall the IN endpoint -+ * (6.6.1), so it's unavoidable. It also says we must -+ * retain this state until the next reset, but there's -+ * no way to tell the controller driver it should ignore -+ * Clear-Feature(HALT) requests. -+ * -+ * We aren't required to halt the OUT endpoint; instead -+ * we can simply accept and discard any data received -+ * until the next reset. */ -+ wedge_bulk_in_endpoint(fsg); -+ set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); -+ return -EINVAL; -+ } -+ -+ /* Is the CBW meaningful? */ -+ if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN || -+ cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) { -+ DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, " -+ "cmdlen %u\n", -+ cbw->Lun, cbw->Flags, cbw->Length); -+ -+ /* We can do anything we want here, so let's stall the -+ * bulk pipes if we are allowed to. */ -+ if (mod_data.can_stall) { -+ fsg_set_halt(fsg, fsg->bulk_out); -+ halt_bulk_in_endpoint(fsg); -+ } -+ return -EINVAL; -+ } -+ -+ /* Save the command for later */ -+ fsg->cmnd_size = cbw->Length; -+ memcpy(fsg->cmnd, cbw->CDB, fsg->cmnd_size); -+ if (cbw->Flags & US_BULK_FLAG_IN) -+ fsg->data_dir = DATA_DIR_TO_HOST; -+ else -+ fsg->data_dir = DATA_DIR_FROM_HOST; -+ fsg->data_size = le32_to_cpu(cbw->DataTransferLength); -+ if (fsg->data_size == 0) -+ fsg->data_dir = DATA_DIR_NONE; -+ fsg->lun = cbw->Lun; -+ fsg->tag = cbw->Tag; -+ return 0; -+} -+ -+ -+static int get_next_command(struct fsg_dev *fsg) -+{ -+ struct fsg_buffhd *bh; -+ int rc = 0; -+ -+ if (transport_is_bbb()) { -+ -+ /* Wait for the next buffer to become available */ -+ bh = fsg->next_buffhd_to_fill; -+ while (bh->state != BUF_STATE_EMPTY) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ /* Queue a request to read a Bulk-only CBW */ -+ set_bulk_out_req_length(fsg, bh, US_BULK_CB_WRAP_LEN); -+ start_transfer(fsg, fsg->bulk_out, bh->outreq, -+ &bh->outreq_busy, &bh->state); -+ -+ /* We will drain the buffer in software, which means we -+ * can reuse it for the next filling. No need to advance -+ * next_buffhd_to_fill. */ -+ -+ /* Wait for the CBW to arrive */ -+ while (bh->state != BUF_STATE_FULL) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ smp_rmb(); -+ rc = received_cbw(fsg, bh); -+ bh->state = BUF_STATE_EMPTY; -+ -+ } else { // USB_PR_CB or USB_PR_CBI -+ -+ /* Wait for the next command to arrive */ -+ while (fsg->cbbuf_cmnd_size == 0) { -+ rc = sleep_thread(fsg); -+ if (rc) -+ return rc; -+ } -+ -+ /* Is the previous status interrupt request still busy? -+ * The host is allowed to skip reading the status, -+ * so we must cancel it. */ -+ if (fsg->intreq_busy) -+ usb_ep_dequeue(fsg->intr_in, fsg->intreq); -+ -+ /* Copy the command and mark the buffer empty */ -+ fsg->data_dir = DATA_DIR_UNKNOWN; -+ spin_lock_irq(&fsg->lock); -+ fsg->cmnd_size = fsg->cbbuf_cmnd_size; -+ memcpy(fsg->cmnd, fsg->cbbuf_cmnd, fsg->cmnd_size); -+ fsg->cbbuf_cmnd_size = 0; -+ spin_unlock_irq(&fsg->lock); -+ -+ /* Use LUN from the command */ -+ fsg->lun = fsg->cmnd[1] >> 5; -+ } -+ -+ /* Update current lun */ -+ if (fsg->lun >= 0 && fsg->lun < fsg->nluns) -+ fsg->curlun = &fsg->luns[fsg->lun]; -+ else -+ fsg->curlun = NULL; -+ -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int enable_endpoint(struct fsg_dev *fsg, struct usb_ep *ep, -+ const struct usb_endpoint_descriptor *d) -+{ -+ int rc; -+ -+ ep->driver_data = fsg; -+ ep->desc = d; -+ rc = usb_ep_enable(ep); -+ if (rc) -+ ERROR(fsg, "can't enable %s, result %d\n", ep->name, rc); -+ return rc; -+} -+ -+static int alloc_request(struct fsg_dev *fsg, struct usb_ep *ep, -+ struct usb_request **preq) -+{ -+ *preq = usb_ep_alloc_request(ep, GFP_ATOMIC); -+ if (*preq) -+ return 0; -+ ERROR(fsg, "can't allocate request for %s\n", ep->name); -+ return -ENOMEM; -+} -+ -+/* -+ * Reset interface setting and re-init endpoint state (toggle etc). -+ * Call with altsetting < 0 to disable the interface. The only other -+ * available altsetting is 0, which enables the interface. -+ */ -+static int do_set_interface(struct fsg_dev *fsg, int altsetting) -+{ -+ int rc = 0; -+ int i; -+ const struct usb_endpoint_descriptor *d; -+ -+ if (fsg->running) -+ DBG(fsg, "reset interface\n"); -+ -+reset: -+ /* Deallocate the requests */ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ struct fsg_buffhd *bh = &fsg->buffhds[i]; -+ -+ if (bh->inreq) { -+ usb_ep_free_request(fsg->bulk_in, bh->inreq); -+ bh->inreq = NULL; -+ } -+ if (bh->outreq) { -+ usb_ep_free_request(fsg->bulk_out, bh->outreq); -+ bh->outreq = NULL; -+ } -+ } -+ if (fsg->intreq) { -+ usb_ep_free_request(fsg->intr_in, fsg->intreq); -+ fsg->intreq = NULL; -+ } -+ -+ /* Disable the endpoints */ -+ if (fsg->bulk_in_enabled) { -+ usb_ep_disable(fsg->bulk_in); -+ fsg->bulk_in_enabled = 0; -+ } -+ if (fsg->bulk_out_enabled) { -+ usb_ep_disable(fsg->bulk_out); -+ fsg->bulk_out_enabled = 0; -+ } -+ if (fsg->intr_in_enabled) { -+ usb_ep_disable(fsg->intr_in); -+ fsg->intr_in_enabled = 0; -+ } -+ -+ fsg->running = 0; -+ if (altsetting < 0 || rc != 0) -+ return rc; -+ -+ DBG(fsg, "set interface %d\n", altsetting); -+ -+ /* Enable the endpoints */ -+ d = fsg_ep_desc(fsg->gadget, -+ &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc, -+ &fsg_ss_bulk_in_desc); -+ if ((rc = enable_endpoint(fsg, fsg->bulk_in, d)) != 0) -+ goto reset; -+ fsg->bulk_in_enabled = 1; -+ -+ d = fsg_ep_desc(fsg->gadget, -+ &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc, -+ &fsg_ss_bulk_out_desc); -+ if ((rc = enable_endpoint(fsg, fsg->bulk_out, d)) != 0) -+ goto reset; -+ fsg->bulk_out_enabled = 1; -+ fsg->bulk_out_maxpacket = usb_endpoint_maxp(d); -+ clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); -+ -+ if (transport_is_cbi()) { -+ d = fsg_ep_desc(fsg->gadget, -+ &fsg_fs_intr_in_desc, &fsg_hs_intr_in_desc, -+ &fsg_ss_intr_in_desc); -+ if ((rc = enable_endpoint(fsg, fsg->intr_in, d)) != 0) -+ goto reset; -+ fsg->intr_in_enabled = 1; -+ } -+ -+ /* Allocate the requests */ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ struct fsg_buffhd *bh = &fsg->buffhds[i]; -+ -+ if ((rc = alloc_request(fsg, fsg->bulk_in, &bh->inreq)) != 0) -+ goto reset; -+ if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) -+ goto reset; -+ bh->inreq->buf = bh->outreq->buf = bh->buf; -+ bh->inreq->context = bh->outreq->context = bh; -+ bh->inreq->complete = bulk_in_complete; -+ bh->outreq->complete = bulk_out_complete; -+ } -+ if (transport_is_cbi()) { -+ if ((rc = alloc_request(fsg, fsg->intr_in, &fsg->intreq)) != 0) -+ goto reset; -+ fsg->intreq->complete = intr_in_complete; -+ } -+ -+ fsg->running = 1; -+ for (i = 0; i < fsg->nluns; ++i) -+ fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; -+ return rc; -+} -+ -+ -+/* -+ * Change our operational configuration. This code must agree with the code -+ * that returns config descriptors, and with interface altsetting code. -+ * -+ * It's also responsible for power management interactions. Some -+ * configurations might not work with our current power sources. -+ * For now we just assume the gadget is always self-powered. -+ */ -+static int do_set_config(struct fsg_dev *fsg, u8 new_config) -+{ -+ int rc = 0; -+ -+ /* Disable the single interface */ -+ if (fsg->config != 0) { -+ DBG(fsg, "reset config\n"); -+ fsg->config = 0; -+ rc = do_set_interface(fsg, -1); -+ } -+ -+ /* Enable the interface */ -+ if (new_config != 0) { -+ fsg->config = new_config; -+ if ((rc = do_set_interface(fsg, 0)) != 0) -+ fsg->config = 0; // Reset on errors -+ else -+ INFO(fsg, "%s config #%d\n", -+ usb_speed_string(fsg->gadget->speed), -+ fsg->config); -+ } -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void handle_exception(struct fsg_dev *fsg) -+{ -+ siginfo_t info; -+ int sig; -+ int i; -+ int num_active; -+ struct fsg_buffhd *bh; -+ enum fsg_state old_state; -+ u8 new_config; -+ struct fsg_lun *curlun; -+ unsigned int exception_req_tag; -+ int rc; -+ -+ /* Clear the existing signals. Anything but SIGUSR1 is converted -+ * into a high-priority EXIT exception. */ -+ for (;;) { -+ sig = dequeue_signal_lock(current, ¤t->blocked, &info); -+ if (!sig) -+ break; -+ if (sig != SIGUSR1) { -+ if (fsg->state < FSG_STATE_EXIT) -+ DBG(fsg, "Main thread exiting on signal\n"); -+ raise_exception(fsg, FSG_STATE_EXIT); -+ } -+ } -+ -+ /* Cancel all the pending transfers */ -+ if (fsg->intreq_busy) -+ usb_ep_dequeue(fsg->intr_in, fsg->intreq); -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ bh = &fsg->buffhds[i]; -+ if (bh->inreq_busy) -+ usb_ep_dequeue(fsg->bulk_in, bh->inreq); -+ if (bh->outreq_busy) -+ usb_ep_dequeue(fsg->bulk_out, bh->outreq); -+ } -+ -+ /* Wait until everything is idle */ -+ for (;;) { -+ num_active = fsg->intreq_busy; -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ bh = &fsg->buffhds[i]; -+ num_active += bh->inreq_busy + bh->outreq_busy; -+ } -+ if (num_active == 0) -+ break; -+ if (sleep_thread(fsg)) -+ return; -+ } -+ -+ /* Clear out the controller's fifos */ -+ if (fsg->bulk_in_enabled) -+ usb_ep_fifo_flush(fsg->bulk_in); -+ if (fsg->bulk_out_enabled) -+ usb_ep_fifo_flush(fsg->bulk_out); -+ if (fsg->intr_in_enabled) -+ usb_ep_fifo_flush(fsg->intr_in); -+ -+ /* Reset the I/O buffer states and pointers, the SCSI -+ * state, and the exception. Then invoke the handler. */ -+ spin_lock_irq(&fsg->lock); -+ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ bh = &fsg->buffhds[i]; -+ bh->state = BUF_STATE_EMPTY; -+ } -+ fsg->next_buffhd_to_fill = fsg->next_buffhd_to_drain = -+ &fsg->buffhds[0]; -+ -+ exception_req_tag = fsg->exception_req_tag; -+ new_config = fsg->new_config; -+ old_state = fsg->state; -+ -+ if (old_state == FSG_STATE_ABORT_BULK_OUT) -+ fsg->state = FSG_STATE_STATUS_PHASE; -+ else { -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ curlun->prevent_medium_removal = 0; -+ curlun->sense_data = curlun->unit_attention_data = -+ SS_NO_SENSE; -+ curlun->sense_data_info = 0; -+ curlun->info_valid = 0; -+ } -+ fsg->state = FSG_STATE_IDLE; -+ } -+ spin_unlock_irq(&fsg->lock); -+ -+ /* Carry out any extra actions required for the exception */ -+ switch (old_state) { -+ default: -+ break; -+ -+ case FSG_STATE_ABORT_BULK_OUT: -+ send_status(fsg); -+ spin_lock_irq(&fsg->lock); -+ if (fsg->state == FSG_STATE_STATUS_PHASE) -+ fsg->state = FSG_STATE_IDLE; -+ spin_unlock_irq(&fsg->lock); -+ break; -+ -+ case FSG_STATE_RESET: -+ /* In case we were forced against our will to halt a -+ * bulk endpoint, clear the halt now. (The SuperH UDC -+ * requires this.) */ -+ if (test_and_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) -+ usb_ep_clear_halt(fsg->bulk_in); -+ -+ if (transport_is_bbb()) { -+ if (fsg->ep0_req_tag == exception_req_tag) -+ ep0_queue(fsg); // Complete the status stage -+ -+ } else if (transport_is_cbi()) -+ send_status(fsg); // Status by interrupt pipe -+ -+ /* Technically this should go here, but it would only be -+ * a waste of time. Ditto for the INTERFACE_CHANGE and -+ * CONFIG_CHANGE cases. */ -+ // for (i = 0; i < fsg->nluns; ++i) -+ // fsg->luns[i].unit_attention_data = SS_RESET_OCCURRED; -+ break; -+ -+ case FSG_STATE_INTERFACE_CHANGE: -+ rc = do_set_interface(fsg, 0); -+ if (fsg->ep0_req_tag != exception_req_tag) -+ break; -+ if (rc != 0) // STALL on errors -+ fsg_set_halt(fsg, fsg->ep0); -+ else // Complete the status stage -+ ep0_queue(fsg); -+ break; -+ -+ case FSG_STATE_CONFIG_CHANGE: -+ rc = do_set_config(fsg, new_config); -+ if (fsg->ep0_req_tag != exception_req_tag) -+ break; -+ if (rc != 0) // STALL on errors -+ fsg_set_halt(fsg, fsg->ep0); -+ else // Complete the status stage -+ ep0_queue(fsg); -+ break; -+ -+ case FSG_STATE_DISCONNECT: -+ for (i = 0; i < fsg->nluns; ++i) -+ fsg_lun_fsync_sub(fsg->luns + i); -+ do_set_config(fsg, 0); // Unconfigured state -+ break; -+ -+ case FSG_STATE_EXIT: -+ case FSG_STATE_TERMINATED: -+ do_set_config(fsg, 0); // Free resources -+ spin_lock_irq(&fsg->lock); -+ fsg->state = FSG_STATE_TERMINATED; // Stop the thread -+ spin_unlock_irq(&fsg->lock); -+ break; -+ } -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static int fsg_main_thread(void *fsg_) -+{ -+ struct fsg_dev *fsg = fsg_; -+ -+ /* Allow the thread to be killed by a signal, but set the signal mask -+ * to block everything but INT, TERM, KILL, and USR1. */ -+ allow_signal(SIGINT); -+ allow_signal(SIGTERM); -+ allow_signal(SIGKILL); -+ allow_signal(SIGUSR1); -+ -+ /* Allow the thread to be frozen */ -+ set_freezable(); -+ -+ /* Arrange for userspace references to be interpreted as kernel -+ * pointers. That way we can pass a kernel pointer to a routine -+ * that expects a __user pointer and it will work okay. */ -+ set_fs(get_ds()); -+ -+ /* The main loop */ -+ while (fsg->state != FSG_STATE_TERMINATED) { -+ if (exception_in_progress(fsg) || signal_pending(current)) { -+ handle_exception(fsg); -+ continue; -+ } -+ -+ if (!fsg->running) { -+ sleep_thread(fsg); -+ continue; -+ } -+ -+ if (get_next_command(fsg)) -+ continue; -+ -+ spin_lock_irq(&fsg->lock); -+ if (!exception_in_progress(fsg)) -+ fsg->state = FSG_STATE_DATA_PHASE; -+ spin_unlock_irq(&fsg->lock); -+ -+ if (do_scsi_command(fsg) || finish_reply(fsg)) -+ continue; -+ -+ spin_lock_irq(&fsg->lock); -+ if (!exception_in_progress(fsg)) -+ fsg->state = FSG_STATE_STATUS_PHASE; -+ spin_unlock_irq(&fsg->lock); -+ -+ if (send_status(fsg)) -+ continue; -+ -+ spin_lock_irq(&fsg->lock); -+ if (!exception_in_progress(fsg)) -+ fsg->state = FSG_STATE_IDLE; -+ spin_unlock_irq(&fsg->lock); -+ } -+ -+ spin_lock_irq(&fsg->lock); -+ fsg->thread_task = NULL; -+ spin_unlock_irq(&fsg->lock); -+ -+ /* If we are exiting because of a signal, unregister the -+ * gadget driver. */ -+ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) -+ usb_gadget_unregister_driver(&fsg_driver); -+ -+ /* Let the unbind and cleanup routines know the thread has exited */ -+ complete_and_exit(&fsg->thread_notifier, 0); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+ -+/* The write permissions and store_xxx pointers are set in fsg_bind() */ -+static DEVICE_ATTR(ro, 0444, fsg_show_ro, NULL); -+static DEVICE_ATTR(nofua, 0644, fsg_show_nofua, NULL); -+static DEVICE_ATTR(file, 0444, fsg_show_file, NULL); -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void fsg_release(struct kref *ref) -+{ -+ struct fsg_dev *fsg = container_of(ref, struct fsg_dev, ref); -+ -+ kfree(fsg->luns); -+ kfree(fsg); -+} -+ -+static void lun_release(struct device *dev) -+{ -+ struct rw_semaphore *filesem = dev_get_drvdata(dev); -+ struct fsg_dev *fsg = -+ container_of(filesem, struct fsg_dev, filesem); -+ -+ kref_put(&fsg->ref, fsg_release); -+} -+ -+static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ int i; -+ struct fsg_lun *curlun; -+ struct usb_request *req = fsg->ep0req; -+ -+ DBG(fsg, "unbind\n"); -+ clear_bit(REGISTERED, &fsg->atomic_bitflags); -+ -+ /* If the thread isn't already dead, tell it to exit now */ -+ if (fsg->state != FSG_STATE_TERMINATED) { -+ raise_exception(fsg, FSG_STATE_EXIT); -+ wait_for_completion(&fsg->thread_notifier); -+ -+ /* The cleanup routine waits for this completion also */ -+ complete(&fsg->thread_notifier); -+ } -+ -+ /* Unregister the sysfs attribute files and the LUNs */ -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ if (curlun->registered) { -+ device_remove_file(&curlun->dev, &dev_attr_nofua); -+ device_remove_file(&curlun->dev, &dev_attr_ro); -+ device_remove_file(&curlun->dev, &dev_attr_file); -+ fsg_lun_close(curlun); -+ device_unregister(&curlun->dev); -+ curlun->registered = 0; -+ } -+ } -+ -+ /* Free the data buffers */ -+ for (i = 0; i < fsg_num_buffers; ++i) -+ kfree(fsg->buffhds[i].buf); -+ -+ /* Free the request and buffer for endpoint 0 */ -+ if (req) { -+ kfree(req->buf); -+ usb_ep_free_request(fsg->ep0, req); -+ } -+ -+ set_gadget_data(gadget, NULL); -+} -+ -+ -+static int __init check_parameters(struct fsg_dev *fsg) -+{ -+ int prot; -+ int gcnum; -+ -+ /* Store the default values */ -+ mod_data.transport_type = USB_PR_BULK; -+ mod_data.transport_name = "Bulk-only"; -+ mod_data.protocol_type = USB_SC_SCSI; -+ mod_data.protocol_name = "Transparent SCSI"; -+ -+ /* Some peripheral controllers are known not to be able to -+ * halt bulk endpoints correctly. If one of them is present, -+ * disable stalls. -+ */ -+ if (gadget_is_at91(fsg->gadget)) -+ mod_data.can_stall = 0; -+ -+ if (mod_data.release == 0xffff) { // Parameter wasn't set -+ gcnum = usb_gadget_controller_number(fsg->gadget); -+ if (gcnum >= 0) -+ mod_data.release = 0x0300 + gcnum; -+ else { -+ WARNING(fsg, "controller '%s' not recognized\n", -+ fsg->gadget->name); -+ mod_data.release = 0x0399; -+ } -+ } -+ -+ prot = simple_strtol(mod_data.protocol_parm, NULL, 0); -+ -+#ifdef CONFIG_USB_FILE_STORAGE_TEST -+ if (strnicmp(mod_data.transport_parm, "BBB", 10) == 0) { -+ ; // Use default setting -+ } else if (strnicmp(mod_data.transport_parm, "CB", 10) == 0) { -+ mod_data.transport_type = USB_PR_CB; -+ mod_data.transport_name = "Control-Bulk"; -+ } else if (strnicmp(mod_data.transport_parm, "CBI", 10) == 0) { -+ mod_data.transport_type = USB_PR_CBI; -+ mod_data.transport_name = "Control-Bulk-Interrupt"; -+ } else { -+ ERROR(fsg, "invalid transport: %s\n", mod_data.transport_parm); -+ return -EINVAL; -+ } -+ -+ if (strnicmp(mod_data.protocol_parm, "SCSI", 10) == 0 || -+ prot == USB_SC_SCSI) { -+ ; // Use default setting -+ } else if (strnicmp(mod_data.protocol_parm, "RBC", 10) == 0 || -+ prot == USB_SC_RBC) { -+ mod_data.protocol_type = USB_SC_RBC; -+ mod_data.protocol_name = "RBC"; -+ } else if (strnicmp(mod_data.protocol_parm, "8020", 4) == 0 || -+ strnicmp(mod_data.protocol_parm, "ATAPI", 10) == 0 || -+ prot == USB_SC_8020) { -+ mod_data.protocol_type = USB_SC_8020; -+ mod_data.protocol_name = "8020i (ATAPI)"; -+ } else if (strnicmp(mod_data.protocol_parm, "QIC", 3) == 0 || -+ prot == USB_SC_QIC) { -+ mod_data.protocol_type = USB_SC_QIC; -+ mod_data.protocol_name = "QIC-157"; -+ } else if (strnicmp(mod_data.protocol_parm, "UFI", 10) == 0 || -+ prot == USB_SC_UFI) { -+ mod_data.protocol_type = USB_SC_UFI; -+ mod_data.protocol_name = "UFI"; -+ } else if (strnicmp(mod_data.protocol_parm, "8070", 4) == 0 || -+ prot == USB_SC_8070) { -+ mod_data.protocol_type = USB_SC_8070; -+ mod_data.protocol_name = "8070i"; -+ } else { -+ ERROR(fsg, "invalid protocol: %s\n", mod_data.protocol_parm); -+ return -EINVAL; -+ } -+ -+ mod_data.buflen &= PAGE_CACHE_MASK; -+ if (mod_data.buflen <= 0) { -+ ERROR(fsg, "invalid buflen\n"); -+ return -ETOOSMALL; -+ } -+ -+#endif /* CONFIG_USB_FILE_STORAGE_TEST */ -+ -+ /* Serial string handling. -+ * On a real device, the serial string would be loaded -+ * from permanent storage. */ -+ if (mod_data.serial) { -+ const char *ch; -+ unsigned len = 0; -+ -+ /* Sanity check : -+ * The CB[I] specification limits the serial string to -+ * 12 uppercase hexadecimal characters. -+ * BBB need at least 12 uppercase hexadecimal characters, -+ * with a maximum of 126. */ -+ for (ch = mod_data.serial; *ch; ++ch) { -+ ++len; -+ if ((*ch < '0' || *ch > '9') && -+ (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */ -+ WARNING(fsg, -+ "Invalid serial string character: %c\n", -+ *ch); -+ goto no_serial; -+ } -+ } -+ if (len > 126 || -+ (mod_data.transport_type == USB_PR_BULK && len < 12) || -+ (mod_data.transport_type != USB_PR_BULK && len > 12)) { -+ WARNING(fsg, "Invalid serial string length!\n"); -+ goto no_serial; -+ } -+ fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial; -+ } else { -+ WARNING(fsg, "No serial-number string provided!\n"); -+ no_serial: -+ device_desc.iSerialNumber = 0; -+ } -+ -+ return 0; -+} -+ -+ -+static int __init fsg_bind(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = the_fsg; -+ int rc; -+ int i; -+ struct fsg_lun *curlun; -+ struct usb_ep *ep; -+ struct usb_request *req; -+ char *pathbuf, *p; -+ -+ fsg->gadget = gadget; -+ set_gadget_data(gadget, fsg); -+ fsg->ep0 = gadget->ep0; -+ fsg->ep0->driver_data = fsg; -+ -+ if ((rc = check_parameters(fsg)) != 0) -+ goto out; -+ -+ if (mod_data.removable) { // Enable the store_xxx attributes -+ dev_attr_file.attr.mode = 0644; -+ dev_attr_file.store = fsg_store_file; -+ if (!mod_data.cdrom) { -+ dev_attr_ro.attr.mode = 0644; -+ dev_attr_ro.store = fsg_store_ro; -+ } -+ } -+ -+ /* Only for removable media? */ -+ dev_attr_nofua.attr.mode = 0644; -+ dev_attr_nofua.store = fsg_store_nofua; -+ -+ /* Find out how many LUNs there should be */ -+ i = mod_data.nluns; -+ if (i == 0) -+ i = max(mod_data.num_filenames, 1u); -+ if (i > FSG_MAX_LUNS) { -+ ERROR(fsg, "invalid number of LUNs: %d\n", i); -+ rc = -EINVAL; -+ goto out; -+ } -+ -+ /* Create the LUNs, open their backing files, and register the -+ * LUN devices in sysfs. */ -+ fsg->luns = kzalloc(i * sizeof(struct fsg_lun), GFP_KERNEL); -+ if (!fsg->luns) { -+ rc = -ENOMEM; -+ goto out; -+ } -+ fsg->nluns = i; -+ -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ curlun->cdrom = !!mod_data.cdrom; -+ curlun->ro = mod_data.cdrom || mod_data.ro[i]; -+ curlun->initially_ro = curlun->ro; -+ curlun->removable = mod_data.removable; -+ curlun->nofua = mod_data.nofua[i]; -+ curlun->dev.release = lun_release; -+ curlun->dev.parent = &gadget->dev; -+ curlun->dev.driver = &fsg_driver.driver; -+ dev_set_drvdata(&curlun->dev, &fsg->filesem); -+ dev_set_name(&curlun->dev,"%s-lun%d", -+ dev_name(&gadget->dev), i); -+ -+ kref_get(&fsg->ref); -+ rc = device_register(&curlun->dev); -+ if (rc) { -+ INFO(fsg, "failed to register LUN%d: %d\n", i, rc); -+ put_device(&curlun->dev); -+ goto out; -+ } -+ curlun->registered = 1; -+ -+ rc = device_create_file(&curlun->dev, &dev_attr_ro); -+ if (rc) -+ goto out; -+ rc = device_create_file(&curlun->dev, &dev_attr_nofua); -+ if (rc) -+ goto out; -+ rc = device_create_file(&curlun->dev, &dev_attr_file); -+ if (rc) -+ goto out; -+ -+ if (mod_data.file[i] && *mod_data.file[i]) { -+ rc = fsg_lun_open(curlun, mod_data.file[i]); -+ if (rc) -+ goto out; -+ } else if (!mod_data.removable) { -+ ERROR(fsg, "no file given for LUN%d\n", i); -+ rc = -EINVAL; -+ goto out; -+ } -+ } -+ -+ /* Find all the endpoints we will use */ -+ usb_ep_autoconfig_reset(gadget); -+ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_in_desc); -+ if (!ep) -+ goto autoconf_fail; -+ ep->driver_data = fsg; // claim the endpoint -+ fsg->bulk_in = ep; -+ -+ ep = usb_ep_autoconfig(gadget, &fsg_fs_bulk_out_desc); -+ if (!ep) -+ goto autoconf_fail; -+ ep->driver_data = fsg; // claim the endpoint -+ fsg->bulk_out = ep; -+ -+ if (transport_is_cbi()) { -+ ep = usb_ep_autoconfig(gadget, &fsg_fs_intr_in_desc); -+ if (!ep) -+ goto autoconf_fail; -+ ep->driver_data = fsg; // claim the endpoint -+ fsg->intr_in = ep; -+ } -+ -+ /* Fix up the descriptors */ -+ device_desc.idVendor = cpu_to_le16(mod_data.vendor); -+ device_desc.idProduct = cpu_to_le16(mod_data.product); -+ device_desc.bcdDevice = cpu_to_le16(mod_data.release); -+ -+ i = (transport_is_cbi() ? 3 : 2); // Number of endpoints -+ fsg_intf_desc.bNumEndpoints = i; -+ fsg_intf_desc.bInterfaceSubClass = mod_data.protocol_type; -+ fsg_intf_desc.bInterfaceProtocol = mod_data.transport_type; -+ fsg_fs_function[i + FSG_FS_FUNCTION_PRE_EP_ENTRIES] = NULL; -+ -+ if (gadget_is_dualspeed(gadget)) { -+ fsg_hs_function[i + FSG_HS_FUNCTION_PRE_EP_ENTRIES] = NULL; -+ -+ /* Assume endpoint addresses are the same for both speeds */ -+ fsg_hs_bulk_in_desc.bEndpointAddress = -+ fsg_fs_bulk_in_desc.bEndpointAddress; -+ fsg_hs_bulk_out_desc.bEndpointAddress = -+ fsg_fs_bulk_out_desc.bEndpointAddress; -+ fsg_hs_intr_in_desc.bEndpointAddress = -+ fsg_fs_intr_in_desc.bEndpointAddress; -+ } -+ -+ if (gadget_is_superspeed(gadget)) { -+ unsigned max_burst; -+ -+ fsg_ss_function[i + FSG_SS_FUNCTION_PRE_EP_ENTRIES] = NULL; -+ -+ /* Calculate bMaxBurst, we know packet size is 1024 */ -+ max_burst = min_t(unsigned, mod_data.buflen / 1024, 15); -+ -+ /* Assume endpoint addresses are the same for both speeds */ -+ fsg_ss_bulk_in_desc.bEndpointAddress = -+ fsg_fs_bulk_in_desc.bEndpointAddress; -+ fsg_ss_bulk_in_comp_desc.bMaxBurst = max_burst; -+ -+ fsg_ss_bulk_out_desc.bEndpointAddress = -+ fsg_fs_bulk_out_desc.bEndpointAddress; -+ fsg_ss_bulk_out_comp_desc.bMaxBurst = max_burst; -+ } -+ -+ if (gadget_is_otg(gadget)) -+ fsg_otg_desc.bmAttributes |= USB_OTG_HNP; -+ -+ rc = -ENOMEM; -+ -+ /* Allocate the request and buffer for endpoint 0 */ -+ fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); -+ if (!req) -+ goto out; -+ req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); -+ if (!req->buf) -+ goto out; -+ req->complete = ep0_complete; -+ -+ /* Allocate the data buffers */ -+ for (i = 0; i < fsg_num_buffers; ++i) { -+ struct fsg_buffhd *bh = &fsg->buffhds[i]; -+ -+ /* Allocate for the bulk-in endpoint. We assume that -+ * the buffer will also work with the bulk-out (and -+ * interrupt-in) endpoint. */ -+ bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); -+ if (!bh->buf) -+ goto out; -+ bh->next = bh + 1; -+ } -+ fsg->buffhds[fsg_num_buffers - 1].next = &fsg->buffhds[0]; -+ -+ /* This should reflect the actual gadget power source */ -+ usb_gadget_set_selfpowered(gadget); -+ -+ snprintf(fsg_string_manufacturer, sizeof fsg_string_manufacturer, -+ "%s %s with %s", -+ init_utsname()->sysname, init_utsname()->release, -+ gadget->name); -+ -+ fsg->thread_task = kthread_create(fsg_main_thread, fsg, -+ "file-storage-gadget"); -+ if (IS_ERR(fsg->thread_task)) { -+ rc = PTR_ERR(fsg->thread_task); -+ goto out; -+ } -+ -+ INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); -+ INFO(fsg, "NOTE: This driver is deprecated. " -+ "Consider using g_mass_storage instead.\n"); -+ INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); -+ -+ pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); -+ for (i = 0; i < fsg->nluns; ++i) { -+ curlun = &fsg->luns[i]; -+ if (fsg_lun_is_open(curlun)) { -+ p = NULL; -+ if (pathbuf) { -+ p = d_path(&curlun->filp->f_path, -+ pathbuf, PATH_MAX); -+ if (IS_ERR(p)) -+ p = NULL; -+ } -+ LINFO(curlun, "ro=%d, nofua=%d, file: %s\n", -+ curlun->ro, curlun->nofua, (p ? p : "(error)")); -+ } -+ } -+ kfree(pathbuf); -+ -+ DBG(fsg, "transport=%s (x%02x)\n", -+ mod_data.transport_name, mod_data.transport_type); -+ DBG(fsg, "protocol=%s (x%02x)\n", -+ mod_data.protocol_name, mod_data.protocol_type); -+ DBG(fsg, "VendorID=x%04x, ProductID=x%04x, Release=x%04x\n", -+ mod_data.vendor, mod_data.product, mod_data.release); -+ DBG(fsg, "removable=%d, stall=%d, cdrom=%d, buflen=%u\n", -+ mod_data.removable, mod_data.can_stall, -+ mod_data.cdrom, mod_data.buflen); -+ DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task)); -+ -+ set_bit(REGISTERED, &fsg->atomic_bitflags); -+ -+ /* Tell the thread to start working */ -+ wake_up_process(fsg->thread_task); -+ return 0; -+ -+autoconf_fail: -+ ERROR(fsg, "unable to autoconfigure all endpoints\n"); -+ rc = -ENOTSUPP; -+ -+out: -+ fsg->state = FSG_STATE_TERMINATED; // The thread is dead -+ fsg_unbind(gadget); -+ complete(&fsg->thread_notifier); -+ return rc; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void fsg_suspend(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ -+ DBG(fsg, "suspend\n"); -+ set_bit(SUSPENDED, &fsg->atomic_bitflags); -+} -+ -+static void fsg_resume(struct usb_gadget *gadget) -+{ -+ struct fsg_dev *fsg = get_gadget_data(gadget); -+ -+ DBG(fsg, "resume\n"); -+ clear_bit(SUSPENDED, &fsg->atomic_bitflags); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static struct usb_gadget_driver fsg_driver = { -+ .max_speed = USB_SPEED_SUPER, -+ .function = (char *) fsg_string_product, -+ .unbind = fsg_unbind, -+ .disconnect = fsg_disconnect, -+ .setup = fsg_setup, -+ .suspend = fsg_suspend, -+ .resume = fsg_resume, -+ -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ // .release = ... -+ // .suspend = ... -+ // .resume = ... -+ }, -+}; -+ -+ -+static int __init fsg_alloc(void) -+{ -+ struct fsg_dev *fsg; -+ -+ fsg = kzalloc(sizeof *fsg + -+ fsg_num_buffers * sizeof *(fsg->buffhds), GFP_KERNEL); -+ -+ if (!fsg) -+ return -ENOMEM; -+ spin_lock_init(&fsg->lock); -+ init_rwsem(&fsg->filesem); -+ kref_init(&fsg->ref); -+ init_completion(&fsg->thread_notifier); -+ -+ the_fsg = fsg; -+ return 0; -+} -+ -+ -+static int __init fsg_init(void) -+{ -+ int rc; -+ struct fsg_dev *fsg; -+ -+ rc = fsg_num_buffers_validate(); -+ if (rc != 0) -+ return rc; -+ -+ if ((rc = fsg_alloc()) != 0) -+ return rc; -+ fsg = the_fsg; -+ if ((rc = usb_gadget_probe_driver(&fsg_driver, fsg_bind)) != 0) -+ kref_put(&fsg->ref, fsg_release); -+ return rc; -+} -+module_init(fsg_init); -+ -+ -+static void __exit fsg_cleanup(void) -+{ -+ struct fsg_dev *fsg = the_fsg; -+ -+ /* Unregister the driver iff the thread hasn't already done so */ -+ if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) -+ usb_gadget_unregister_driver(&fsg_driver); -+ -+ /* Wait for the thread to finish up */ -+ wait_for_completion(&fsg->thread_notifier); -+ -+ kref_put(&fsg->ref, fsg_release); -+} -+module_exit(fsg_cleanup); -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 0b80cee30da4740e8c28c6ea7a4cc700163a12ee..f17b939c149562527937f49d90e23c7ab8b72328 100644 ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -762,6 +762,19 @@ config USB_HWA_HCD - To compile this driver a module, choose M here: the module - will be called "hwa-hc". - -+config USB_DWCOTG -+ tristate "Synopsis DWC host support" -+ depends on USB -+ help -+ The Synopsis DWC controller is a dual-role -+ host/peripheral/OTG ("On The Go") USB controllers. -+ -+ Enable this option to support this IP in host controller mode. -+ If unsure, say N. -+ -+ To compile this driver as a module, choose M here: the -+ modules built will be called dwc_otg and dwc_common_port. -+ - config USB_IMX21_HCD - tristate "i.MX21 HCD support" - depends on ARM && ARCH_MXC -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index 6ef785b0ea8ff0b5f4ee3bc40ba22d17c855478f..c28acc1b2877b6ac43604d1968351ce42e9470a5 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -74,6 +74,8 @@ obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o - obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o - obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o - obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ - obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o - obj-$(CONFIG_USB_FSL_USB2) += fsl-mph-dr-of.o - obj-$(CONFIG_USB_EHCI_FSL) += fsl-mph-dr-of.o -diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..f10d466d1aea8696fb394aebebb9945e6b79a991 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile -@@ -0,0 +1,58 @@ -+# -+# Makefile for DWC_common library -+# -+ -+ifneq ($(KERNELRELEASE),) -+ -+ccflags-y += -DDWC_LINUX -+#ccflags-y += -DDEBUG -+#ccflags-y += -DDWC_DEBUG_REGS -+#ccflags-y += -DDWC_DEBUG_MEMORY -+ -+ccflags-y += -DDWC_LIBMODULE -+ccflags-y += -DDWC_CCLIB -+#ccflags-y += -DDWC_CRYPTOLIB -+ccflags-y += -DDWC_NOTIFYLIB -+ccflags-y += -DDWC_UTFLIB -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o -+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ -+ dwc_crypto.o dwc_notifier.o \ -+ dwc_common_linux.o dwc_mem.o -+ -+kernrelwd := $(subst ., ,$(KERNELRELEASE)) -+kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) -+ -+ifneq ($(kernrel3),2.6.20) -+# grayg - I only know that we use ccflags-y in 2.6.31 actually -+ccflags-y += $(CPPFLAGS) -+endif -+ -+else -+ -+#ifeq ($(KDIR),) -+#$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) -+#endif -+ -+ifeq ($(ARCH),) -+$(error Must give "ARCH=" on command line or in environment. Also, if \ -+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") -+endif -+ -+ifeq ($(DOXYGEN),) -+DOXYGEN := doxygen -+endif -+ -+default: -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+endif -+ -+clean: -+ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ -diff --git a/drivers/usb/host/dwc_common_port/Makefile.fbsd b/drivers/usb/host/dwc_common_port/Makefile.fbsd -new file mode 100644 -index 0000000000000000000000000000000000000000..45db9915b9d31f39dd9aaf97772b3c31234c4ce6 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile.fbsd -@@ -0,0 +1,17 @@ -+CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include -+CFLAGS += -DDWC_FREEBSD -+CFLAGS += -DDEBUG -+#CFLAGS += -DDWC_DEBUG_REGS -+#CFLAGS += -DDWC_DEBUG_MEMORY -+ -+#CFLAGS += -DDWC_LIBMODULE -+#CFLAGS += -DDWC_CCLIB -+#CFLAGS += -DDWC_CRYPTOLIB -+#CFLAGS += -DDWC_NOTIFYLIB -+#CFLAGS += -DDWC_UTFLIB -+ -+KMOD = dwc_common_port_lib -+SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \ -+ dwc_common_fbsd.c dwc_mem.c -+ -+.include -diff --git a/drivers/usb/host/dwc_common_port/Makefile.linux b/drivers/usb/host/dwc_common_port/Makefile.linux -new file mode 100644 -index 0000000000000000000000000000000000000000..0cef7b461bd5084f261b28ebd05d62418956956e ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile.linux -@@ -0,0 +1,49 @@ -+# -+# Makefile for DWC_common library -+# -+ifneq ($(KERNELRELEASE),) -+ -+ccflags-y += -DDWC_LINUX -+#ccflags-y += -DDEBUG -+#ccflags-y += -DDWC_DEBUG_REGS -+#ccflags-y += -DDWC_DEBUG_MEMORY -+ -+ccflags-y += -DDWC_LIBMODULE -+ccflags-y += -DDWC_CCLIB -+ccflags-y += -DDWC_CRYPTOLIB -+ccflags-y += -DDWC_NOTIFYLIB -+ccflags-y += -DDWC_UTFLIB -+ -+obj-m := dwc_common_port_lib.o -+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ -+ dwc_crypto.o dwc_notifier.o \ -+ dwc_common_linux.o dwc_mem.o -+ -+else -+ -+ifeq ($(KDIR),) -+$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment) -+endif -+ -+ifeq ($(ARCH),) -+$(error Must give "ARCH=" on command line or in environment. Also, if \ -+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-") -+endif -+ -+ifeq ($(DOXYGEN),) -+DOXYGEN := doxygen -+endif -+ -+default: -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+endif -+ -+clean: -+ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/ -diff --git a/drivers/usb/host/dwc_common_port/changes.txt b/drivers/usb/host/dwc_common_port/changes.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..f6839f92c2760d8dc29e514a1f6833d356cfd217 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/changes.txt -@@ -0,0 +1,174 @@ -+ -+dwc_read_reg32() and friends now take an additional parameter, a pointer to an -+IO context struct. The IO context struct should live in an os-dependent struct -+in your driver. As an example, the dwc_usb3 driver has an os-dependent struct -+named 'os_dep' embedded in the main device struct. So there these calls look -+like this: -+ -+ dwc_read_reg32(&usb3_dev->os_dep.ioctx, &pcd->dev_global_regs->dcfg); -+ -+ dwc_write_reg32(&usb3_dev->os_dep.ioctx, -+ &pcd->dev_global_regs->dcfg, 0); -+ -+Note that for the existing Linux driver ports, it is not necessary to actually -+define the 'ioctx' member in the os-dependent struct. Since Linux does not -+require an IO context, its macros for dwc_read_reg32() and friends do not -+use the context pointer, so it is optimized away by the compiler. But it is -+necessary to add the pointer parameter to all of the call sites, to be ready -+for any future ports (such as FreeBSD) which do require an IO context. -+ -+ -+Similarly, dwc_alloc(), dwc_alloc_atomic(), dwc_strdup(), and dwc_free() now -+take an additional parameter, a pointer to a memory context. Examples: -+ -+ addr = dwc_alloc(&usb3_dev->os_dep.memctx, size); -+ -+ dwc_free(&usb3_dev->os_dep.memctx, addr); -+ -+Again, for the Linux ports, it is not necessary to actually define the memctx -+member, but it is necessary to add the pointer parameter to all of the call -+sites. -+ -+ -+Same for dwc_dma_alloc() and dwc_dma_free(). Examples: -+ -+ virt_addr = dwc_dma_alloc(&usb3_dev->os_dep.dmactx, size, &phys_addr); -+ -+ dwc_dma_free(&usb3_dev->os_dep.dmactx, size, virt_addr, phys_addr); -+ -+ -+Same for dwc_mutex_alloc() and dwc_mutex_free(). Examples: -+ -+ mutex = dwc_mutex_alloc(&usb3_dev->os_dep.mtxctx); -+ -+ dwc_mutex_free(&usb3_dev->os_dep.mtxctx, mutex); -+ -+ -+Same for dwc_spinlock_alloc() and dwc_spinlock_free(). Examples: -+ -+ lock = dwc_spinlock_alloc(&usb3_dev->osdep.splctx); -+ -+ dwc_spinlock_free(&usb3_dev->osdep.splctx, lock); -+ -+ -+Same for dwc_timer_alloc(). Example: -+ -+ timer = dwc_timer_alloc(&usb3_dev->os_dep.tmrctx, "dwc_usb3_tmr1", -+ cb_func, cb_data); -+ -+ -+Same for dwc_waitq_alloc(). Example: -+ -+ waitq = dwc_waitq_alloc(&usb3_dev->os_dep.wtqctx); -+ -+ -+Same for dwc_thread_run(). Example: -+ -+ thread = dwc_thread_run(&usb3_dev->os_dep.thdctx, func, -+ "dwc_usb3_thd1", data); -+ -+ -+Same for dwc_workq_alloc(). Example: -+ -+ workq = dwc_workq_alloc(&usb3_dev->osdep.wkqctx, "dwc_usb3_wkq1"); -+ -+ -+Same for dwc_task_alloc(). Example: -+ -+ task = dwc_task_alloc(&usb3_dev->os_dep.tskctx, "dwc_usb3_tsk1", -+ cb_func, cb_data); -+ -+ -+In addition to the context pointer additions, a few core functions have had -+other changes made to their parameters: -+ -+The 'flags' parameter to dwc_spinlock_irqsave() and dwc_spinunlock_irqrestore() -+has been changed from a uint64_t to a dwc_irqflags_t. -+ -+dwc_thread_should_stop() now takes a 'dwc_thread_t *' parameter, because the -+FreeBSD equivalent of that function requires it. -+ -+And, in addition to the context pointer, dwc_task_alloc() also adds a -+'char *name' parameter, to be consistent with dwc_thread_run() and -+dwc_workq_alloc(), and because the FreeBSD equivalent of that function -+requires a unique name. -+ -+ -+Here is a complete list of the core functions that now take a pointer to a -+context as their first parameter: -+ -+ dwc_read_reg32 -+ dwc_read_reg64 -+ dwc_write_reg32 -+ dwc_write_reg64 -+ dwc_modify_reg32 -+ dwc_modify_reg64 -+ dwc_alloc -+ dwc_alloc_atomic -+ dwc_strdup -+ dwc_free -+ dwc_dma_alloc -+ dwc_dma_free -+ dwc_mutex_alloc -+ dwc_mutex_free -+ dwc_spinlock_alloc -+ dwc_spinlock_free -+ dwc_timer_alloc -+ dwc_waitq_alloc -+ dwc_thread_run -+ dwc_workq_alloc -+ dwc_task_alloc Also adds a 'char *name' as its 2nd parameter -+ -+And here are the core functions that have other changes to their parameters: -+ -+ dwc_spinlock_irqsave 'flags' param is now a 'dwc_irqflags_t *' -+ dwc_spinunlock_irqrestore 'flags' param is now a 'dwc_irqflags_t' -+ dwc_thread_should_stop Adds a 'dwc_thread_t *' parameter -+ -+ -+ -+The changes to the core functions also require some of the other library -+functions to change: -+ -+ dwc_cc_if_alloc() and dwc_cc_if_free() now take a 'void *memctx' -+ (for memory allocation) as the 1st param and a 'void *mtxctx' -+ (for mutex allocation) as the 2nd param. -+ -+ dwc_cc_clear(), dwc_cc_add(), dwc_cc_change(), dwc_cc_remove(), -+ dwc_cc_data_for_save(), and dwc_cc_restore_from_data() now take a -+ 'void *memctx' as the 1st param. -+ -+ dwc_dh_modpow(), dwc_dh_pk(), and dwc_dh_derive_keys() now take a -+ 'void *memctx' as the 1st param. -+ -+ dwc_modpow() now takes a 'void *memctx' as the 1st param. -+ -+ dwc_alloc_notification_manager() now takes a 'void *memctx' as the -+ 1st param and a 'void *wkqctx' (for work queue allocation) as the 2nd -+ param, and also now returns an integer value that is non-zero if -+ allocation of its data structures or work queue fails. -+ -+ dwc_register_notifier() now takes a 'void *memctx' as the 1st param. -+ -+ dwc_memory_debug_start() now takes a 'void *mem_ctx' as the first -+ param, and also now returns an integer value that is non-zero if -+ allocation of its data structures fails. -+ -+ -+ -+Other miscellaneous changes: -+ -+The DEBUG_MEMORY and DEBUG_REGS #define's have been renamed to -+DWC_DEBUG_MEMORY and DWC_DEBUG_REGS. -+ -+The following #define's have been added to allow selectively compiling library -+features: -+ -+ DWC_CCLIB -+ DWC_CRYPTOLIB -+ DWC_NOTIFYLIB -+ DWC_UTFLIB -+ -+A DWC_LIBMODULE #define has also been added. If this is not defined, then the -+module code in dwc_common_linux.c is not compiled in. This allows linking the -+library code directly into a driver module, instead of as a standalone module. -diff --git a/drivers/usb/host/dwc_common_port/doc/doxygen.cfg b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg -new file mode 100644 -index 0000000000000000000000000000000000000000..89aa887af29dfc3a71580acec4f10dc7cf00185d ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/doc/doxygen.cfg -@@ -0,0 +1,270 @@ -+# Doxyfile 1.4.5 -+ -+#--------------------------------------------------------------------------- -+# Project related configuration options -+#--------------------------------------------------------------------------- -+PROJECT_NAME = "Synopsys DWC Portability and Common Library for UWB" -+PROJECT_NUMBER = -+OUTPUT_DIRECTORY = doc -+CREATE_SUBDIRS = NO -+OUTPUT_LANGUAGE = English -+BRIEF_MEMBER_DESC = YES -+REPEAT_BRIEF = YES -+ABBREVIATE_BRIEF = "The $name class" \ -+ "The $name widget" \ -+ "The $name file" \ -+ is \ -+ provides \ -+ specifies \ -+ contains \ -+ represents \ -+ a \ -+ an \ -+ the -+ALWAYS_DETAILED_SEC = YES -+INLINE_INHERITED_MEMB = NO -+FULL_PATH_NAMES = NO -+STRIP_FROM_PATH = .. -+STRIP_FROM_INC_PATH = -+SHORT_NAMES = NO -+JAVADOC_AUTOBRIEF = YES -+MULTILINE_CPP_IS_BRIEF = NO -+DETAILS_AT_TOP = YES -+INHERIT_DOCS = YES -+SEPARATE_MEMBER_PAGES = NO -+TAB_SIZE = 8 -+ALIASES = -+OPTIMIZE_OUTPUT_FOR_C = YES -+OPTIMIZE_OUTPUT_JAVA = NO -+BUILTIN_STL_SUPPORT = NO -+DISTRIBUTE_GROUP_DOC = NO -+SUBGROUPING = NO -+#--------------------------------------------------------------------------- -+# Build related configuration options -+#--------------------------------------------------------------------------- -+EXTRACT_ALL = NO -+EXTRACT_PRIVATE = NO -+EXTRACT_STATIC = YES -+EXTRACT_LOCAL_CLASSES = NO -+EXTRACT_LOCAL_METHODS = NO -+HIDE_UNDOC_MEMBERS = NO -+HIDE_UNDOC_CLASSES = NO -+HIDE_FRIEND_COMPOUNDS = NO -+HIDE_IN_BODY_DOCS = NO -+INTERNAL_DOCS = NO -+CASE_SENSE_NAMES = YES -+HIDE_SCOPE_NAMES = NO -+SHOW_INCLUDE_FILES = NO -+INLINE_INFO = YES -+SORT_MEMBER_DOCS = NO -+SORT_BRIEF_DOCS = NO -+SORT_BY_SCOPE_NAME = NO -+GENERATE_TODOLIST = YES -+GENERATE_TESTLIST = YES -+GENERATE_BUGLIST = YES -+GENERATE_DEPRECATEDLIST= YES -+ENABLED_SECTIONS = -+MAX_INITIALIZER_LINES = 30 -+SHOW_USED_FILES = YES -+SHOW_DIRECTORIES = YES -+FILE_VERSION_FILTER = -+#--------------------------------------------------------------------------- -+# configuration options related to warning and progress messages -+#--------------------------------------------------------------------------- -+QUIET = YES -+WARNINGS = YES -+WARN_IF_UNDOCUMENTED = NO -+WARN_IF_DOC_ERROR = YES -+WARN_NO_PARAMDOC = YES -+WARN_FORMAT = "$file:$line: $text" -+WARN_LOGFILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the input files -+#--------------------------------------------------------------------------- -+INPUT = . -+FILE_PATTERNS = *.c \ -+ *.cc \ -+ *.cxx \ -+ *.cpp \ -+ *.c++ \ -+ *.d \ -+ *.java \ -+ *.ii \ -+ *.ixx \ -+ *.ipp \ -+ *.i++ \ -+ *.inl \ -+ *.h \ -+ *.hh \ -+ *.hxx \ -+ *.hpp \ -+ *.h++ \ -+ *.idl \ -+ *.odl \ -+ *.cs \ -+ *.php \ -+ *.php3 \ -+ *.inc \ -+ *.m \ -+ *.mm \ -+ *.dox \ -+ *.py \ -+ *.C \ -+ *.CC \ -+ *.C++ \ -+ *.II \ -+ *.I++ \ -+ *.H \ -+ *.HH \ -+ *.H++ \ -+ *.CS \ -+ *.PHP \ -+ *.PHP3 \ -+ *.M \ -+ *.MM \ -+ *.PY -+RECURSIVE = NO -+EXCLUDE = -+EXCLUDE_SYMLINKS = NO -+EXCLUDE_PATTERNS = -+EXAMPLE_PATH = -+EXAMPLE_PATTERNS = * -+EXAMPLE_RECURSIVE = NO -+IMAGE_PATH = -+INPUT_FILTER = -+FILTER_PATTERNS = -+FILTER_SOURCE_FILES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to source browsing -+#--------------------------------------------------------------------------- -+SOURCE_BROWSER = NO -+INLINE_SOURCES = NO -+STRIP_CODE_COMMENTS = YES -+REFERENCED_BY_RELATION = YES -+REFERENCES_RELATION = YES -+USE_HTAGS = NO -+VERBATIM_HEADERS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the alphabetical class index -+#--------------------------------------------------------------------------- -+ALPHABETICAL_INDEX = NO -+COLS_IN_ALPHA_INDEX = 5 -+IGNORE_PREFIX = -+#--------------------------------------------------------------------------- -+# configuration options related to the HTML output -+#--------------------------------------------------------------------------- -+GENERATE_HTML = YES -+HTML_OUTPUT = html -+HTML_FILE_EXTENSION = .html -+HTML_HEADER = -+HTML_FOOTER = -+HTML_STYLESHEET = -+HTML_ALIGN_MEMBERS = YES -+GENERATE_HTMLHELP = NO -+CHM_FILE = -+HHC_LOCATION = -+GENERATE_CHI = NO -+BINARY_TOC = NO -+TOC_EXPAND = NO -+DISABLE_INDEX = NO -+ENUM_VALUES_PER_LINE = 4 -+GENERATE_TREEVIEW = YES -+TREEVIEW_WIDTH = 250 -+#--------------------------------------------------------------------------- -+# configuration options related to the LaTeX output -+#--------------------------------------------------------------------------- -+GENERATE_LATEX = NO -+LATEX_OUTPUT = latex -+LATEX_CMD_NAME = latex -+MAKEINDEX_CMD_NAME = makeindex -+COMPACT_LATEX = NO -+PAPER_TYPE = a4wide -+EXTRA_PACKAGES = -+LATEX_HEADER = -+PDF_HYPERLINKS = NO -+USE_PDFLATEX = NO -+LATEX_BATCHMODE = NO -+LATEX_HIDE_INDICES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the RTF output -+#--------------------------------------------------------------------------- -+GENERATE_RTF = NO -+RTF_OUTPUT = rtf -+COMPACT_RTF = NO -+RTF_HYPERLINKS = NO -+RTF_STYLESHEET_FILE = -+RTF_EXTENSIONS_FILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the man page output -+#--------------------------------------------------------------------------- -+GENERATE_MAN = NO -+MAN_OUTPUT = man -+MAN_EXTENSION = .3 -+MAN_LINKS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the XML output -+#--------------------------------------------------------------------------- -+GENERATE_XML = NO -+XML_OUTPUT = xml -+XML_SCHEMA = -+XML_DTD = -+XML_PROGRAMLISTING = YES -+#--------------------------------------------------------------------------- -+# configuration options for the AutoGen Definitions output -+#--------------------------------------------------------------------------- -+GENERATE_AUTOGEN_DEF = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the Perl module output -+#--------------------------------------------------------------------------- -+GENERATE_PERLMOD = NO -+PERLMOD_LATEX = NO -+PERLMOD_PRETTY = YES -+PERLMOD_MAKEVAR_PREFIX = -+#--------------------------------------------------------------------------- -+# Configuration options related to the preprocessor -+#--------------------------------------------------------------------------- -+ENABLE_PREPROCESSING = YES -+MACRO_EXPANSION = NO -+EXPAND_ONLY_PREDEF = NO -+SEARCH_INCLUDES = YES -+INCLUDE_PATH = -+INCLUDE_FILE_PATTERNS = -+PREDEFINED = DEBUG DEBUG_MEMORY -+EXPAND_AS_DEFINED = -+SKIP_FUNCTION_MACROS = YES -+#--------------------------------------------------------------------------- -+# Configuration::additions related to external references -+#--------------------------------------------------------------------------- -+TAGFILES = -+GENERATE_TAGFILE = -+ALLEXTERNALS = NO -+EXTERNAL_GROUPS = YES -+PERL_PATH = /usr/bin/perl -+#--------------------------------------------------------------------------- -+# Configuration options related to the dot tool -+#--------------------------------------------------------------------------- -+CLASS_DIAGRAMS = YES -+HIDE_UNDOC_RELATIONS = YES -+HAVE_DOT = NO -+CLASS_GRAPH = YES -+COLLABORATION_GRAPH = YES -+GROUP_GRAPHS = YES -+UML_LOOK = NO -+TEMPLATE_RELATIONS = NO -+INCLUDE_GRAPH = NO -+INCLUDED_BY_GRAPH = YES -+CALL_GRAPH = NO -+GRAPHICAL_HIERARCHY = YES -+DIRECTORY_GRAPH = YES -+DOT_IMAGE_FORMAT = png -+DOT_PATH = -+DOTFILE_DIRS = -+MAX_DOT_GRAPH_DEPTH = 1000 -+DOT_TRANSPARENT = NO -+DOT_MULTI_TARGETS = NO -+GENERATE_LEGEND = YES -+DOT_CLEANUP = YES -+#--------------------------------------------------------------------------- -+# Configuration::additions related to the search engine -+#--------------------------------------------------------------------------- -+SEARCHENGINE = NO -diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.c b/drivers/usb/host/dwc_common_port/dwc_cc.c -new file mode 100644 -index 0000000000000000000000000000000000000000..5ec2ae28698c15d1c441d3104706b04e9f1dde27 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_cc.c -@@ -0,0 +1,532 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.c $ -+ * $Revision: #4 $ -+ * $Date: 2010/11/04 $ -+ * $Change: 1621692 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifdef DWC_CCLIB -+ -+#include "dwc_cc.h" -+ -+typedef struct dwc_cc -+{ -+ uint32_t uid; -+ uint8_t chid[16]; -+ uint8_t cdid[16]; -+ uint8_t ck[16]; -+ uint8_t *name; -+ uint8_t length; -+ DWC_CIRCLEQ_ENTRY(dwc_cc) list_entry; -+} dwc_cc_t; -+ -+DWC_CIRCLEQ_HEAD(context_list, dwc_cc); -+ -+/** The main structure for CC management. */ -+struct dwc_cc_if -+{ -+ dwc_mutex_t *mutex; -+ char *filename; -+ -+ unsigned is_host:1; -+ -+ dwc_notifier_t *notifier; -+ -+ struct context_list list; -+}; -+ -+#ifdef DEBUG -+static inline void dump_bytes(char *name, uint8_t *bytes, int len) -+{ -+ int i; -+ DWC_PRINTF("%s: ", name); -+ for (i=0; ilength = length; -+ cc->name = dwc_alloc(mem_ctx, length); -+ if (!cc->name) { -+ dwc_free(mem_ctx, cc); -+ return NULL; -+ } -+ -+ DWC_MEMCPY(cc->name, name, length); -+ } -+ -+ return cc; -+} -+ -+static void free_cc(void *mem_ctx, dwc_cc_t *cc) -+{ -+ if (cc->name) { -+ dwc_free(mem_ctx, cc->name); -+ } -+ dwc_free(mem_ctx, cc); -+} -+ -+static uint32_t next_uid(dwc_cc_if_t *cc_if) -+{ -+ uint32_t uid = 0; -+ dwc_cc_t *cc; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (cc->uid > uid) { -+ uid = cc->uid; -+ } -+ } -+ -+ if (uid == 0) { -+ uid = 255; -+ } -+ -+ return uid + 1; -+} -+ -+static dwc_cc_t *cc_find(dwc_cc_if_t *cc_if, uint32_t uid) -+{ -+ dwc_cc_t *cc; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (cc->uid == uid) { -+ return cc; -+ } -+ } -+ return NULL; -+} -+ -+static unsigned int cc_data_size(dwc_cc_if_t *cc_if) -+{ -+ unsigned int size = 0; -+ dwc_cc_t *cc; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ size += (48 + 1); -+ if (cc->name) { -+ size += cc->length; -+ } -+ } -+ return size; -+} -+ -+static uint32_t cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) -+{ -+ uint32_t uid = 0; -+ dwc_cc_t *cc; -+ -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (DWC_MEMCMP(cc->chid, chid, 16) == 0) { -+ uid = cc->uid; -+ break; -+ } -+ } -+ return uid; -+} -+static uint32_t cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) -+{ -+ uint32_t uid = 0; -+ dwc_cc_t *cc; -+ -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ if (DWC_MEMCMP(cc->cdid, cdid, 16) == 0) { -+ uid = cc->uid; -+ break; -+ } -+ } -+ return uid; -+} -+ -+/* Internal cc_add */ -+static int32_t cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) -+{ -+ dwc_cc_t *cc; -+ uint32_t uid; -+ -+ if (cc_if->is_host) { -+ uid = cc_match_cdid(cc_if, cdid); -+ } -+ else { -+ uid = cc_match_chid(cc_if, chid); -+ } -+ -+ if (uid) { -+ DWC_DEBUGC("Replacing previous connection context id=%d name=%p name_len=%d", uid, name, length); -+ cc = cc_find(cc_if, uid); -+ } -+ else { -+ cc = alloc_cc(mem_ctx, name, length); -+ cc->uid = next_uid(cc_if); -+ DWC_CIRCLEQ_INSERT_TAIL(&cc_if->list, cc, list_entry); -+ } -+ -+ DWC_MEMCPY(&(cc->chid[0]), chid, 16); -+ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); -+ DWC_MEMCPY(&(cc->ck[0]), ck, 16); -+ -+ DWC_DEBUGC("Added connection context id=%d name=%p name_len=%d", cc->uid, name, length); -+ dump_bytes("CHID", cc->chid, 16); -+ dump_bytes("CDID", cc->cdid, 16); -+ dump_bytes("CK", cc->ck, 16); -+ return cc->uid; -+} -+ -+/* Internal cc_clear */ -+static void cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) -+{ -+ while (!DWC_CIRCLEQ_EMPTY(&cc_if->list)) { -+ dwc_cc_t *cc = DWC_CIRCLEQ_FIRST(&cc_if->list); -+ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); -+ free_cc(mem_ctx, cc); -+ } -+} -+ -+dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, -+ dwc_notifier_t *notifier, unsigned is_host) -+{ -+ dwc_cc_if_t *cc_if = NULL; -+ -+ /* Allocate a common_cc_if structure */ -+ cc_if = dwc_alloc(mem_ctx, sizeof(dwc_cc_if_t)); -+ -+ if (!cc_if) -+ return NULL; -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+ DWC_MUTEX_ALLOC_LINUX_DEBUG(cc_if->mutex); -+#else -+ cc_if->mutex = dwc_mutex_alloc(mtx_ctx); -+#endif -+ if (!cc_if->mutex) { -+ dwc_free(mem_ctx, cc_if); -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INIT(&cc_if->list); -+ cc_if->is_host = is_host; -+ cc_if->notifier = notifier; -+ return cc_if; -+} -+ -+void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if) -+{ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+ DWC_MUTEX_FREE(cc_if->mutex); -+#else -+ dwc_mutex_free(mtx_ctx, cc_if->mutex); -+#endif -+ cc_clear(mem_ctx, cc_if); -+ dwc_free(mem_ctx, cc_if); -+} -+ -+static void cc_changed(dwc_cc_if_t *cc_if) -+{ -+ if (cc_if->notifier) { -+ dwc_notify(cc_if->notifier, DWC_CC_LIST_CHANGED_NOTIFICATION, cc_if); -+ } -+} -+ -+void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if) -+{ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc_clear(mem_ctx, cc_if); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ cc_changed(cc_if); -+} -+ -+int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) -+{ -+ uint32_t uid; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ uid = cc_add(mem_ctx, cc_if, chid, cdid, ck, name, length); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ cc_changed(cc_if); -+ -+ return uid; -+} -+ -+void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, uint8_t length) -+{ -+ dwc_cc_t* cc; -+ -+ DWC_DEBUGC("Change connection context %d", id); -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (!cc) { -+ DWC_ERROR("Uid %d not found in cc list\n", id); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return; -+ } -+ -+ if (chid) { -+ DWC_MEMCPY(&(cc->chid[0]), chid, 16); -+ } -+ if (cdid) { -+ DWC_MEMCPY(&(cc->cdid[0]), cdid, 16); -+ } -+ if (ck) { -+ DWC_MEMCPY(&(cc->ck[0]), ck, 16); -+ } -+ -+ if (name) { -+ if (cc->name) { -+ dwc_free(mem_ctx, cc->name); -+ } -+ cc->name = dwc_alloc(mem_ctx, length); -+ if (!cc->name) { -+ DWC_ERROR("Out of memory in dwc_cc_change()\n"); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return; -+ } -+ cc->length = length; -+ DWC_MEMCPY(cc->name, name, length); -+ } -+ -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ cc_changed(cc_if); -+ -+ DWC_DEBUGC("Changed connection context id=%d\n", id); -+ dump_bytes("New CHID", cc->chid, 16); -+ dump_bytes("New CDID", cc->cdid, 16); -+ dump_bytes("New CK", cc->ck, 16); -+} -+ -+void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id) -+{ -+ dwc_cc_t *cc; -+ -+ DWC_DEBUGC("Removing connection context %d", id); -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (!cc) { -+ DWC_ERROR("Uid %d not found in cc list\n", id); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return; -+ } -+ -+ DWC_CIRCLEQ_REMOVE_INIT(&cc_if->list, cc, list_entry); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ free_cc(mem_ctx, cc); -+ -+ cc_changed(cc_if); -+} -+ -+uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, unsigned int *length) -+{ -+ uint8_t *buf, *x; -+ uint8_t zero = 0; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ *length = cc_data_size(cc_if); -+ if (!(*length)) { -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return NULL; -+ } -+ -+ DWC_DEBUGC("Creating data for saving (length=%d)", *length); -+ -+ buf = dwc_alloc(mem_ctx, *length); -+ if (!buf) { -+ *length = 0; -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return NULL; -+ } -+ -+ x = buf; -+ DWC_CIRCLEQ_FOREACH(cc, &cc_if->list, list_entry) { -+ DWC_MEMCPY(x, cc->chid, 16); -+ x += 16; -+ DWC_MEMCPY(x, cc->cdid, 16); -+ x += 16; -+ DWC_MEMCPY(x, cc->ck, 16); -+ x += 16; -+ if (cc->name) { -+ DWC_MEMCPY(x, &cc->length, 1); -+ x += 1; -+ DWC_MEMCPY(x, cc->name, cc->length); -+ x += cc->length; -+ } -+ else { -+ DWC_MEMCPY(x, &zero, 1); -+ x += 1; -+ } -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return buf; -+} -+ -+void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *data, uint32_t length) -+{ -+ uint8_t name_length; -+ uint8_t *name; -+ uint8_t *chid; -+ uint8_t *cdid; -+ uint8_t *ck; -+ uint32_t i = 0; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc_clear(mem_ctx, cc_if); -+ -+ while (i < length) { -+ chid = &data[i]; -+ i += 16; -+ cdid = &data[i]; -+ i += 16; -+ ck = &data[i]; -+ i += 16; -+ -+ name_length = data[i]; -+ i ++; -+ -+ if (name_length) { -+ name = &data[i]; -+ i += name_length; -+ } -+ else { -+ name = NULL; -+ } -+ -+ /* check to see if we haven't overflown the buffer */ -+ if (i > length) { -+ DWC_ERROR("Data format error while attempting to load CCs " -+ "(nlen=%d, iter=%d, buflen=%d).\n", name_length, i, length); -+ break; -+ } -+ -+ cc_add(mem_ctx, cc_if, chid, cdid, ck, name, name_length); -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ cc_changed(cc_if); -+} -+ -+uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid) -+{ -+ uint32_t uid = 0; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ uid = cc_match_chid(cc_if, chid); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return uid; -+} -+uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid) -+{ -+ uint32_t uid = 0; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ uid = cc_match_cdid(cc_if, cdid); -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ return uid; -+} -+ -+uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id) -+{ -+ uint8_t *ck = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ ck = cc->ck; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return ck; -+ -+} -+ -+uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id) -+{ -+ uint8_t *retval = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ retval = cc->chid; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return retval; -+} -+ -+uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id) -+{ -+ uint8_t *retval = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ retval = cc->cdid; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return retval; -+} -+ -+uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length) -+{ -+ uint8_t *retval = NULL; -+ dwc_cc_t *cc; -+ -+ DWC_MUTEX_LOCK(cc_if->mutex); -+ *length = 0; -+ cc = cc_find(cc_if, id); -+ if (cc) { -+ *length = cc->length; -+ retval = cc->name; -+ } -+ DWC_MUTEX_UNLOCK(cc_if->mutex); -+ -+ return retval; -+} -+ -+#endif /* DWC_CCLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.h b/drivers/usb/host/dwc_common_port/dwc_cc.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f86e6f21792b9961bda7d569f4d35f7076947546 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_cc.h -@@ -0,0 +1,224 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.h $ -+ * $Revision: #4 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifndef _DWC_CC_H_ -+#define _DWC_CC_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** @file -+ * -+ * This file defines the Context Context library. -+ * -+ * The main data structure is dwc_cc_if_t which is returned by either the -+ * dwc_cc_if_alloc function or returned by the module to the user via a provided -+ * function. The data structure is opaque and should only be manipulated via the -+ * functions provied in this API. -+ * -+ * It manages a list of connection contexts and operations can be performed to -+ * add, remove, query, search, and change, those contexts. Additionally, -+ * a dwc_notifier_t object can be requested from the manager so that -+ * the user can be notified whenever the context list has changed. -+ */ -+ -+#include "dwc_os.h" -+#include "dwc_list.h" -+#include "dwc_notifier.h" -+ -+ -+/* Notifications */ -+#define DWC_CC_LIST_CHANGED_NOTIFICATION "DWC_CC_LIST_CHANGED_NOTIFICATION" -+ -+struct dwc_cc_if; -+typedef struct dwc_cc_if dwc_cc_if_t; -+ -+ -+/** @name Connection Context Operations */ -+/** @{ */ -+ -+/** This function allocates memory for a dwc_cc_if_t structure, initializes -+ * fields to default values, and returns a pointer to the structure or NULL on -+ * error. */ -+extern dwc_cc_if_t *dwc_cc_if_alloc(void *mem_ctx, void *mtx_ctx, -+ dwc_notifier_t *notifier, unsigned is_host); -+ -+/** Frees the memory for the specified CC structure allocated from -+ * dwc_cc_if_alloc(). */ -+extern void dwc_cc_if_free(void *mem_ctx, void *mtx_ctx, dwc_cc_if_t *cc_if); -+ -+/** Removes all contexts from the connection context list */ -+extern void dwc_cc_clear(void *mem_ctx, dwc_cc_if_t *cc_if); -+ -+/** Adds a connection context (CHID, CK, CDID, Name) to the connection context list. -+ * If a CHID already exists, the CK and name are overwritten. Statistics are -+ * not overwritten. -+ * -+ * @param cc_if The cc_if structure. -+ * @param chid A pointer to the 16-byte CHID. This value will be copied. -+ * @param ck A pointer to the 16-byte CK. This value will be copied. -+ * @param cdid A pointer to the 16-byte CDID. This value will be copied. -+ * @param name An optional host friendly name as defined in the association model -+ * spec. Must be a UTF16-LE unicode string. Can be NULL to indicated no name. -+ * @param length The length othe unicode string. -+ * @return A unique identifier used to refer to this context that is valid for -+ * as long as this context is still in the list. */ -+extern int32_t dwc_cc_add(void *mem_ctx, dwc_cc_if_t *cc_if, uint8_t *chid, -+ uint8_t *cdid, uint8_t *ck, uint8_t *name, -+ uint8_t length); -+ -+/** Changes the CHID, CK, CDID, or Name values of a connection context in the -+ * list, preserving any accumulated statistics. This would typically be called -+ * if the host decideds to change the context with a SET_CONNECTION request. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @param chid A pointer to the 16-byte CHID. This value will be copied. NULL -+ * indicates no change. -+ * @param cdid A pointer to the 16-byte CDID. This value will be copied. NULL -+ * indicates no change. -+ * @param ck A pointer to the 16-byte CK. This value will be copied. NULL -+ * indicates no change. -+ * @param name Host friendly name UTF16-LE. NULL indicates no change. -+ * @param length Length of name. */ -+extern void dwc_cc_change(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id, -+ uint8_t *chid, uint8_t *cdid, uint8_t *ck, -+ uint8_t *name, uint8_t length); -+ -+/** Remove the specified connection context. -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context to remove. */ -+extern void dwc_cc_remove(void *mem_ctx, dwc_cc_if_t *cc_if, int32_t id); -+ -+/** Get a binary block of data for the connection context list and attributes. -+ * This data can be used by the OS specific driver to save the connection -+ * context list into non-volatile memory. -+ * -+ * @param cc_if The cc_if structure. -+ * @param length Return the length of the data buffer. -+ * @return A pointer to the data buffer. The memory for this buffer should be -+ * freed with DWC_FREE() after use. */ -+extern uint8_t *dwc_cc_data_for_save(void *mem_ctx, dwc_cc_if_t *cc_if, -+ unsigned int *length); -+ -+/** Restore the connection context list from the binary data that was previously -+ * returned from a call to dwc_cc_data_for_save. This can be used by the OS specific -+ * driver to load a connection context list from non-volatile memory. -+ * -+ * @param cc_if The cc_if structure. -+ * @param data The data bytes as returned from dwc_cc_data_for_save. -+ * @param length The length of the data. */ -+extern void dwc_cc_restore_from_data(void *mem_ctx, dwc_cc_if_t *cc_if, -+ uint8_t *data, unsigned int length); -+ -+/** Find the connection context from the specified CHID. -+ * -+ * @param cc_if The cc_if structure. -+ * @param chid A pointer to the CHID data. -+ * @return A non-zero identifier of the connection context if the CHID matches. -+ * Otherwise returns 0. */ -+extern uint32_t dwc_cc_match_chid(dwc_cc_if_t *cc_if, uint8_t *chid); -+ -+/** Find the connection context from the specified CDID. -+ * -+ * @param cc_if The cc_if structure. -+ * @param cdid A pointer to the CDID data. -+ * @return A non-zero identifier of the connection context if the CHID matches. -+ * Otherwise returns 0. */ -+extern uint32_t dwc_cc_match_cdid(dwc_cc_if_t *cc_if, uint8_t *cdid); -+ -+/** Retrieve the CK from the specified connection context. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @return A pointer to the CK data. The memory does not need to be freed. */ -+extern uint8_t *dwc_cc_ck(dwc_cc_if_t *cc_if, int32_t id); -+ -+/** Retrieve the CHID from the specified connection context. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @return A pointer to the CHID data. The memory does not need to be freed. */ -+extern uint8_t *dwc_cc_chid(dwc_cc_if_t *cc_if, int32_t id); -+ -+/** Retrieve the CDID from the specified connection context. -+ * -+ * @param cc_if The cc_if structure. -+ * @param id The identifier of the connection context. -+ * @return A pointer to the CDID data. The memory does not need to be freed. */ -+extern uint8_t *dwc_cc_cdid(dwc_cc_if_t *cc_if, int32_t id); -+ -+extern uint8_t *dwc_cc_name(dwc_cc_if_t *cc_if, int32_t id, uint8_t *length); -+ -+/** Checks a buffer for non-zero. -+ * @param id A pointer to a 16 byte buffer. -+ * @return true if the 16 byte value is non-zero. */ -+static inline unsigned dwc_assoc_is_not_zero_id(uint8_t *id) { -+ int i; -+ for (i=0; i<16; i++) { -+ if (id[i]) return 1; -+ } -+ return 0; -+} -+ -+/** Checks a buffer for zero. -+ * @param id A pointer to a 16 byte buffer. -+ * @return true if the 16 byte value is zero. */ -+static inline unsigned dwc_assoc_is_zero_id(uint8_t *id) { -+ return !dwc_assoc_is_not_zero_id(id); -+} -+ -+/** Prints an ASCII representation for the 16-byte chid, cdid, or ck, into -+ * buffer. */ -+static inline int dwc_print_id_string(char *buffer, uint8_t *id) { -+ char *ptr = buffer; -+ int i; -+ for (i=0; i<16; i++) { -+ ptr += DWC_SPRINTF(ptr, "%02x", id[i]); -+ if (i < 15) { -+ ptr += DWC_SPRINTF(ptr, " "); -+ } -+ } -+ return ptr - buffer; -+} -+ -+/** @} */ -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_CC_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..6dd04b58f8f6c6d5ddad3b0b0148ff5dd936ac28 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c -@@ -0,0 +1,1308 @@ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+#ifdef DWC_CCLIB -+# include "dwc_cc.h" -+#endif -+ -+#ifdef DWC_CRYPTOLIB -+# include "dwc_modpow.h" -+# include "dwc_dh.h" -+# include "dwc_crypto.h" -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+# include "dwc_notifier.h" -+#endif -+ -+/* OS-Level Implementations */ -+ -+/* This is the FreeBSD 7.0 kernel implementation of the DWC platform library. */ -+ -+ -+/* MISC */ -+ -+void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) -+{ -+ return memset(dest, byte, size); -+} -+ -+void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) -+{ -+ return memcpy(dest, src, size); -+} -+ -+void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) -+{ -+ bcopy(src, dest, size); -+ return dest; -+} -+ -+int DWC_MEMCMP(void *m1, void *m2, uint32_t size) -+{ -+ return memcmp(m1, m2, size); -+} -+ -+int DWC_STRNCMP(void *s1, void *s2, uint32_t size) -+{ -+ return strncmp(s1, s2, size); -+} -+ -+int DWC_STRCMP(void *s1, void *s2) -+{ -+ return strcmp(s1, s2); -+} -+ -+int DWC_STRLEN(char const *str) -+{ -+ return strlen(str); -+} -+ -+char *DWC_STRCPY(char *to, char const *from) -+{ -+ return strcpy(to, from); -+} -+ -+char *DWC_STRDUP(char const *str) -+{ -+ int len = DWC_STRLEN(str) + 1; -+ char *new = DWC_ALLOC_ATOMIC(len); -+ -+ if (!new) { -+ return NULL; -+ } -+ -+ DWC_MEMCPY(new, str, len); -+ return new; -+} -+ -+int DWC_ATOI(char *str, int32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = strtol(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+int DWC_ATOUI(char *str, uint32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+ -+#ifdef DWC_UTFLIB -+/* From usbstring.c */ -+ -+int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+ -+#endif /* DWC_UTFLIB */ -+ -+ -+/* dwc_debug.h */ -+ -+dwc_bool_t DWC_IN_IRQ(void) -+{ -+// return in_irq(); -+ return 0; -+} -+ -+dwc_bool_t DWC_IN_BH(void) -+{ -+// return in_softirq(); -+ return 0; -+} -+ -+void DWC_VPRINTF(char *format, va_list args) -+{ -+ vprintf(format, args); -+} -+ -+int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) -+{ -+ return vsnprintf(str, size, format, args); -+} -+ -+void DWC_PRINTF(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+int DWC_SPRINTF(char *buffer, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsprintf(buffer, format, args); -+ va_end(args); -+ return retval; -+} -+ -+int DWC_SNPRINTF(char *buffer, int size, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsnprintf(buffer, size, format, args); -+ va_end(args); -+ return retval; -+} -+ -+void __DWC_WARN(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void __DWC_ERROR(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void DWC_EXCEPTION(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+// BUG_ON(1); ??? -+} -+ -+#ifdef DEBUG -+void __DWC_DEBUG(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+#endif -+ -+ -+/* dwc_mem.h */ -+ -+#if 0 -+dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, -+ uint32_t align, -+ uint32_t alloc) -+{ -+ struct dma_pool *pool = dma_pool_create("Pool", NULL, -+ size, align, alloc); -+ return (dwc_pool_t *)pool; -+} -+ -+void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) -+{ -+ dma_pool_destroy((struct dma_pool *)pool); -+} -+ -+void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); -+ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); -+} -+ -+void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); -+ memset(..); -+} -+ -+void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) -+{ -+ dma_pool_free(pool, vaddr, daddr); -+} -+#endif -+ -+static void dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) -+{ -+ if (error) -+ return; -+ *(bus_addr_t *)arg = segs[0].ds_addr; -+} -+ -+void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ int error; -+ -+ error = bus_dma_tag_create( -+#if __FreeBSD_version >= 700000 -+ bus_get_dma_tag(dma->dev), /* parent */ -+#else -+ NULL, /* parent */ -+#endif -+ 4, 0, /* alignment, bounds */ -+ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ -+ BUS_SPACE_MAXADDR, /* highaddr */ -+ NULL, NULL, /* filter, filterarg */ -+ size, /* maxsize */ -+ 1, /* nsegments */ -+ size, /* maxsegsize */ -+ 0, /* flags */ -+ NULL, /* lockfunc */ -+ NULL, /* lockarg */ -+ &dma->dma_tag); -+ if (error) { -+ device_printf(dma->dev, "%s: bus_dma_tag_create failed: %d\n", -+ __func__, error); -+ goto fail_0; -+ } -+ -+ error = bus_dmamem_alloc(dma->dma_tag, &dma->dma_vaddr, -+ BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &dma->dma_map); -+ if (error) { -+ device_printf(dma->dev, "%s: bus_dmamem_alloc(%ju) failed: %d\n", -+ __func__, (uintmax_t)size, error); -+ goto fail_1; -+ } -+ -+ dma->dma_paddr = 0; -+ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, size, -+ dmamap_cb, &dma->dma_paddr, BUS_DMA_NOWAIT); -+ if (error || dma->dma_paddr == 0) { -+ device_printf(dma->dev, "%s: bus_dmamap_load failed: %d\n", -+ __func__, error); -+ goto fail_2; -+ } -+ -+ *dma_addr = dma->dma_paddr; -+ return dma->dma_vaddr; -+ -+fail_2: -+ bus_dmamap_unload(dma->dma_tag, dma->dma_map); -+fail_1: -+ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); -+ bus_dma_tag_destroy(dma->dma_tag); -+fail_0: -+ dma->dma_map = NULL; -+ dma->dma_tag = NULL; -+ -+ return NULL; -+} -+ -+void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ -+ if (dma->dma_tag == NULL) -+ return; -+ if (dma->dma_map != NULL) { -+ bus_dmamap_sync(dma->dma_tag, dma->dma_map, -+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); -+ bus_dmamap_unload(dma->dma_tag, dma->dma_map); -+ bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); -+ dma->dma_map = NULL; -+ } -+ -+ bus_dma_tag_destroy(dma->dma_tag); -+ dma->dma_tag = NULL; -+} -+ -+void *__DWC_ALLOC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); -+} -+ -+void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); -+} -+ -+void __DWC_FREE(void *mem_ctx, void *addr) -+{ -+ free(addr, M_DEVBUF); -+} -+ -+ -+#ifdef DWC_CRYPTOLIB -+/* dwc_crypto.h */ -+ -+void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) -+{ -+ get_random_bytes(buffer, length); -+} -+ -+int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) -+{ -+ struct crypto_blkcipher *tfm; -+ struct blkcipher_desc desc; -+ struct scatterlist sgd; -+ struct scatterlist sgs; -+ -+ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); -+ if (tfm == NULL) { -+ printk("failed to load transform for aes CBC\n"); -+ return -1; -+ } -+ -+ crypto_blkcipher_setkey(tfm, key, keylen); -+ crypto_blkcipher_set_iv(tfm, iv, 16); -+ -+ sg_init_one(&sgd, out, messagelen); -+ sg_init_one(&sgs, message, messagelen); -+ -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { -+ crypto_free_blkcipher(tfm); -+ DWC_ERROR("AES CBC encryption failed"); -+ return -1; -+ } -+ -+ crypto_free_blkcipher(tfm); -+ return 0; -+} -+ -+int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, len); -+ crypto_hash_digest(&desc, &sg, len, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, -+ uint8_t *key, uint32_t keylen, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, messagelen); -+ crypto_hash_setkey(tfm, key, keylen); -+ crypto_hash_digest(&desc, &sg, messagelen, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/* Byte Ordering Conversions */ -+ -+uint32_t DWC_CPU_TO_LE32(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_CPU_TO_BE32(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_LE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_BE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_LE16(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_BE16(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_LE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_BE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+ -+/* Registers */ -+ -+uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_4(io->iot, io->ioh, ior); -+} -+ -+#if 0 -+uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_8(io->iot, io->ioh, ior); -+} -+#endif -+ -+void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, value); -+} -+ -+#if 0 -+void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, value); -+} -+#endif -+ -+void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, -+ uint32_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, -+ (bus_space_read_4(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+ -+#if 0 -+void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, -+ uint64_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, -+ (bus_space_read_8(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+#endif -+ -+ -+/* Locking */ -+ -+dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) -+{ -+ struct mtx *sl = DWC_ALLOC(sizeof(*sl)); -+ -+ if (!sl) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ return NULL; -+ } -+ -+ mtx_init(sl, "dw3spn", NULL, MTX_SPIN); -+ return (dwc_spinlock_t *)sl; -+} -+ -+void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) -+{ -+ struct mtx *sl = (struct mtx *)lock; -+ -+ mtx_destroy(sl); -+ DWC_FREE(sl); -+} -+ -+void DWC_SPINLOCK(dwc_spinlock_t *lock) -+{ -+ mtx_lock_spin((struct mtx *)lock); // ??? -+} -+ -+void DWC_SPINUNLOCK(dwc_spinlock_t *lock) -+{ -+ mtx_unlock_spin((struct mtx *)lock); // ??? -+} -+ -+void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) -+{ -+ mtx_lock_spin((struct mtx *)lock); -+} -+ -+void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) -+{ -+ mtx_unlock_spin((struct mtx *)lock); -+} -+ -+dwc_mutex_t *DWC_MUTEX_ALLOC(void) -+{ -+ struct mtx *m; -+ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mtx)); -+ -+ if (!mutex) { -+ DWC_ERROR("Cannot allocate memory for mutex"); -+ return NULL; -+ } -+ -+ m = (struct mtx *)mutex; -+ mtx_init(m, "dw3mtx", NULL, MTX_DEF); -+ return mutex; -+} -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+#else -+void DWC_MUTEX_FREE(dwc_mutex_t *mutex) -+{ -+ mtx_destroy((struct mtx *)mutex); -+ DWC_FREE(mutex); -+} -+#endif -+ -+void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) -+{ -+ struct mtx *m = (struct mtx *)mutex; -+ -+ mtx_lock(m); -+} -+ -+int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) -+{ -+ struct mtx *m = (struct mtx *)mutex; -+ -+ return mtx_trylock(m); -+} -+ -+void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) -+{ -+ struct mtx *m = (struct mtx *)mutex; -+ -+ mtx_unlock(m); -+} -+ -+ -+/* Timing */ -+ -+void DWC_UDELAY(uint32_t usecs) -+{ -+ DELAY(usecs); -+} -+ -+void DWC_MDELAY(uint32_t msecs) -+{ -+ do { -+ DELAY(1000); -+ } while (--msecs); -+} -+ -+void DWC_MSLEEP(uint32_t msecs) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ pause("dw3slp", tvtohz(&tv)); -+} -+ -+uint32_t DWC_TIME(void) -+{ -+ struct timeval tv; -+ -+ microuptime(&tv); // or getmicrouptime? (less precise, but faster) -+ return tv.tv_sec * 1000 + tv.tv_usec / 1000; -+} -+ -+ -+/* Timers */ -+ -+struct dwc_timer { -+ struct callout t; -+ char *name; -+ dwc_spinlock_t *lock; -+ dwc_timer_callback_t cb; -+ void *data; -+}; -+ -+dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) -+{ -+ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (!t) { -+ DWC_ERROR("Cannot allocate memory for timer"); -+ return NULL; -+ } -+ -+ callout_init(&t->t, 1); -+ -+ t->name = DWC_STRDUP(name); -+ if (!t->name) { -+ DWC_ERROR("Cannot allocate memory for timer->name"); -+ goto no_name; -+ } -+ -+ t->lock = DWC_SPINLOCK_ALLOC(); -+ if (!t->lock) { -+ DWC_ERROR("Cannot allocate memory for lock"); -+ goto no_lock; -+ } -+ -+ t->cb = cb; -+ t->data = data; -+ -+ return t; -+ -+ no_lock: -+ DWC_FREE(t->name); -+ no_name: -+ DWC_FREE(t); -+ -+ return NULL; -+} -+ -+void DWC_TIMER_FREE(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+ DWC_SPINLOCK_FREE(timer->lock); -+ DWC_FREE(timer->name); -+ DWC_FREE(timer); -+} -+ -+void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); -+} -+ -+void DWC_TIMER_CANCEL(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+} -+ -+ -+/* Wait Queues */ -+ -+struct dwc_waitq { -+ struct mtx lock; -+ int abort; -+}; -+ -+dwc_waitq_t *DWC_WAITQ_ALLOC(void) -+{ -+ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ return NULL; -+ } -+ -+ mtx_init(&wq->lock, "dw3wtq", NULL, MTX_DEF); -+ wq->abort = 0; -+ -+ return wq; -+} -+ -+void DWC_WAITQ_FREE(dwc_waitq_t *wq) -+{ -+ mtx_destroy(&wq->lock); -+ DWC_FREE(wq); -+} -+ -+int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) -+{ -+// intrmask_t ipl; -+ int result = 0; -+ -+ mtx_lock(&wq->lock); -+// ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+// splx(ipl); -+ result = msleep(wq, &wq->lock, PCATCH, "dw3wat", 0); // infinite timeout -+// ipl = splbio(); -+ } -+ -+ if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ -+ } else if (result == EINTR) { // signaled - interrupt -+ result = -DWC_E_ABORT; -+ -+ } else if (wq->abort) { -+ result = -DWC_E_ABORT; -+ -+ } else { -+ result = 0; -+ } -+ -+ wq->abort = 0; -+// splx(ipl); -+ mtx_unlock(&wq->lock); -+ return result; -+} -+ -+int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs) -+{ -+ struct timeval tv, tv1, tv2; -+// intrmask_t ipl; -+ int result = 0; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ -+ mtx_lock(&wq->lock); -+// ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+// splx(ipl); -+ getmicrouptime(&tv1); -+ result = msleep(wq, &wq->lock, PCATCH, "dw3wto", tvtohz(&tv)); -+ getmicrouptime(&tv2); -+// ipl = splbio(); -+ } -+ -+ if (result == 0) { // awoken -+ if (wq->abort) { -+ result = -DWC_E_ABORT; -+ } else { -+ tv2.tv_usec -= tv1.tv_usec; -+ if (tv2.tv_usec < 0) { -+ tv2.tv_usec += 1000000; -+ tv2.tv_sec--; -+ } -+ -+ tv2.tv_sec -= tv1.tv_sec; -+ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; -+ result = msecs - result; -+ if (result <= 0) -+ result = 1; -+ } -+ } else if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ -+ } else if (result == EINTR) { // signaled - interrupt -+ result = -DWC_E_ABORT; -+ -+ } else { // timed out -+ result = -DWC_E_TIMEOUT; -+ } -+ -+ wq->abort = 0; -+// splx(ipl); -+ mtx_unlock(&wq->lock); -+ return result; -+} -+ -+void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) -+{ -+ wakeup(wq); -+} -+ -+void DWC_WAITQ_ABORT(dwc_waitq_t *wq) -+{ -+// intrmask_t ipl; -+ -+ mtx_lock(&wq->lock); -+// ipl = splbio(); -+ wq->abort = 1; -+ wakeup(wq); -+// splx(ipl); -+ mtx_unlock(&wq->lock); -+} -+ -+ -+/* Threading */ -+ -+struct dwc_thread { -+ struct proc *proc; -+ int abort; -+}; -+ -+dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) -+{ -+ int retval; -+ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); -+ -+ if (!thread) { -+ return NULL; -+ } -+ -+ thread->abort = 0; -+ retval = kthread_create((void (*)(void *))func, data, &thread->proc, -+ RFPROC | RFNOWAIT, 0, "%s", name); -+ if (retval) { -+ DWC_FREE(thread); -+ return NULL; -+ } -+ -+ return thread; -+} -+ -+int DWC_THREAD_STOP(dwc_thread_t *thread) -+{ -+ int retval; -+ -+ thread->abort = 1; -+ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); -+ -+ if (retval == 0) { -+ /* DWC_THREAD_EXIT() will free the thread struct */ -+ return 0; -+ } -+ -+ /* NOTE: We leak the thread struct if thread doesn't die */ -+ -+ if (retval == EWOULDBLOCK) { -+ return -DWC_E_TIMEOUT; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) -+{ -+ return thread->abort; -+} -+ -+void DWC_THREAD_EXIT(dwc_thread_t *thread) -+{ -+ wakeup(&thread->abort); -+ DWC_FREE(thread); -+ kthread_exit(0); -+} -+ -+ -+/* tasklets -+ - Runs in interrupt context (cannot sleep) -+ - Each tasklet runs on a single CPU [ How can we ensure this on FreeBSD? Does it matter? ] -+ - Different tasklets can be running simultaneously on different CPUs [ shouldn't matter ] -+ */ -+struct dwc_tasklet { -+ struct task t; -+ dwc_tasklet_callback_t cb; -+ void *data; -+}; -+ -+static void tasklet_callback(void *data, int pending) // what to do with pending ??? -+{ -+ dwc_tasklet_t *task = (dwc_tasklet_t *)data; -+ -+ task->cb(task->data); -+} -+ -+dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) -+{ -+ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); -+ -+ if (task) { -+ task->cb = cb; -+ task->data = data; -+ TASK_INIT(&task->t, 0, tasklet_callback, task); -+ } else { -+ DWC_ERROR("Cannot allocate memory for tasklet"); -+ } -+ -+ return task; -+} -+ -+void DWC_TASK_FREE(dwc_tasklet_t *task) -+{ -+ taskqueue_drain(taskqueue_fast, &task->t); // ??? -+ DWC_FREE(task); -+} -+ -+void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) -+{ -+ /* Uses predefined system queue */ -+ taskqueue_enqueue_fast(taskqueue_fast, &task->t); -+} -+ -+ -+/* workqueues -+ - Runs in process context (can sleep) -+ */ -+typedef struct work_container { -+ dwc_work_callback_t cb; -+ void *data; -+ dwc_workq_t *wq; -+ char *name; -+ int hz; -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_ENTRY(work_container) entry; -+#endif -+ struct task task; -+} work_container_t; -+ -+#ifdef DEBUG -+DWC_CIRCLEQ_HEAD(work_container_queue, work_container); -+#endif -+ -+struct dwc_workq { -+ struct taskqueue *taskq; -+ dwc_spinlock_t *lock; -+ dwc_waitq_t *waitq; -+ int pending; -+ -+#ifdef DEBUG -+ struct work_container_queue entries; -+#endif -+}; -+ -+static void do_work(void *data, int pending) // what to do with pending ??? -+{ -+ work_container_t *container = (work_container_t *)data; -+ dwc_workq_t *wq = container->wq; -+ dwc_irqflags_t flags; -+ -+ if (container->hz) { -+ pause("dw3wrk", container->hz); -+ } -+ -+ container->cb(container->data); -+ DWC_DEBUG("Work done: %s, container=%p", container->name, container); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); -+#endif -+ if (container->name) -+ DWC_FREE(container->name); -+ DWC_FREE(container); -+ wq->pending--; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+} -+ -+static int work_done(void *data) -+{ -+ dwc_workq_t *workq = (dwc_workq_t *)data; -+ -+ return workq->pending == 0; -+} -+ -+int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) -+{ -+ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); -+} -+ -+dwc_workq_t *DWC_WORKQ_ALLOC(char *name) -+{ -+ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for workqueue"); -+ return NULL; -+ } -+ -+ wq->taskq = taskqueue_create(name, M_NOWAIT, taskqueue_thread_enqueue, &wq->taskq); -+ if (!wq->taskq) { -+ DWC_ERROR("Cannot allocate memory for taskqueue"); -+ goto no_taskq; -+ } -+ -+ wq->pending = 0; -+ -+ wq->lock = DWC_SPINLOCK_ALLOC(); -+ if (!wq->lock) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ goto no_lock; -+ } -+ -+ wq->waitq = DWC_WAITQ_ALLOC(); -+ if (!wq->waitq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ goto no_waitq; -+ } -+ -+ taskqueue_start_threads(&wq->taskq, 1, PWAIT, "%s taskq", "dw3tsk"); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INIT(&wq->entries); -+#endif -+ return wq; -+ -+ no_waitq: -+ DWC_SPINLOCK_FREE(wq->lock); -+ no_lock: -+ taskqueue_free(wq->taskq); -+ no_taskq: -+ DWC_FREE(wq); -+ -+ return NULL; -+} -+ -+void DWC_WORKQ_FREE(dwc_workq_t *wq) -+{ -+#ifdef DEBUG -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ -+ if (wq->pending != 0) { -+ struct work_container *container; -+ -+ DWC_ERROR("Destroying work queue with pending work"); -+ -+ DWC_CIRCLEQ_FOREACH(container, &wq->entries, entry) { -+ DWC_ERROR("Work %s still pending", container->name); -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+#endif -+ DWC_WAITQ_FREE(wq->waitq); -+ DWC_SPINLOCK_FREE(wq->lock); -+ taskqueue_free(wq->taskq); -+ DWC_FREE(wq); -+} -+ -+void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, -+ char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ container->hz = 0; -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ -+ TASK_INIT(&container->task, 0, do_work, container); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ taskqueue_enqueue_fast(wq->taskq, &container->task); -+} -+ -+void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ struct timeval tv; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ container->hz = tvtohz(&tv); -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ -+ TASK_INIT(&container->task, 0, do_work, container); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ taskqueue_enqueue_fast(wq->taskq, &container->task); -+} -+ -+int DWC_WORKQ_PENDING(dwc_workq_t *wq) -+{ -+ return wq->pending; -+} -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_linux.c b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -new file mode 100644 -index 0000000000000000000000000000000000000000..0d641e6da24beeb07109e23847d1d6e81dc7d4ea ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -@@ -0,0 +1,1418 @@ -+#include -+#include -+#include -+#include -+ -+#ifdef DWC_CCLIB -+# include "dwc_cc.h" -+#endif -+ -+#ifdef DWC_CRYPTOLIB -+# include "dwc_modpow.h" -+# include "dwc_dh.h" -+# include "dwc_crypto.h" -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+# include "dwc_notifier.h" -+#endif -+ -+/* OS-Level Implementations */ -+ -+/* This is the Linux kernel implementation of the DWC platform library. */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -+# include -+#else -+# include -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+ -+/* MISC */ -+ -+void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) -+{ -+ return memset(dest, byte, size); -+} -+ -+void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) -+{ -+ return memcpy(dest, src, size); -+} -+ -+void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) -+{ -+ return memmove(dest, src, size); -+} -+ -+int DWC_MEMCMP(void *m1, void *m2, uint32_t size) -+{ -+ return memcmp(m1, m2, size); -+} -+ -+int DWC_STRNCMP(void *s1, void *s2, uint32_t size) -+{ -+ return strncmp(s1, s2, size); -+} -+ -+int DWC_STRCMP(void *s1, void *s2) -+{ -+ return strcmp(s1, s2); -+} -+ -+int DWC_STRLEN(char const *str) -+{ -+ return strlen(str); -+} -+ -+char *DWC_STRCPY(char *to, char const *from) -+{ -+ return strcpy(to, from); -+} -+ -+char *DWC_STRDUP(char const *str) -+{ -+ int len = DWC_STRLEN(str) + 1; -+ char *new = DWC_ALLOC_ATOMIC(len); -+ -+ if (!new) { -+ return NULL; -+ } -+ -+ DWC_MEMCPY(new, str, len); -+ return new; -+} -+ -+int DWC_ATOI(const char *str, int32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = simple_strtol(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+int DWC_ATOUI(const char *str, uint32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = simple_strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+ -+#ifdef DWC_UTFLIB -+/* From usbstring.c */ -+ -+int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+#endif /* DWC_UTFLIB */ -+ -+ -+/* dwc_debug.h */ -+ -+dwc_bool_t DWC_IN_IRQ(void) -+{ -+ return in_irq(); -+} -+ -+dwc_bool_t DWC_IN_BH(void) -+{ -+ return in_softirq(); -+} -+ -+void DWC_VPRINTF(char *format, va_list args) -+{ -+ vprintk(format, args); -+} -+ -+int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) -+{ -+ return vsnprintf(str, size, format, args); -+} -+ -+void DWC_PRINTF(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+int DWC_SPRINTF(char *buffer, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsprintf(buffer, format, args); -+ va_end(args); -+ return retval; -+} -+ -+int DWC_SNPRINTF(char *buffer, int size, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsnprintf(buffer, size, format, args); -+ va_end(args); -+ return retval; -+} -+ -+void __DWC_WARN(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_WARNING); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void __DWC_ERROR(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_ERR); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void DWC_EXCEPTION(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_ERR); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+ BUG_ON(1); -+} -+ -+#ifdef DEBUG -+void __DWC_DEBUG(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_PRINTF(KERN_DEBUG); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+#endif -+ -+ -+/* dwc_mem.h */ -+ -+#if 0 -+dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, -+ uint32_t align, -+ uint32_t alloc) -+{ -+ struct dma_pool *pool = dma_pool_create("Pool", NULL, -+ size, align, alloc); -+ return (dwc_pool_t *)pool; -+} -+ -+void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) -+{ -+ dma_pool_destroy((struct dma_pool *)pool); -+} -+ -+void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); -+} -+ -+void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); -+ memset(..); -+} -+ -+void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) -+{ -+ dma_pool_free(pool, vaddr, daddr); -+} -+#endif -+ -+void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ return dma_zalloc_coherent(dma_ctx, size, dma_addr, GFP_KERNEL | GFP_DMA32); -+} -+ -+void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ return dma_zalloc_coherent(dma_ctx, size, dma_addr, GFP_ATOMIC); -+} -+ -+void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) -+{ -+ dma_free_coherent(dma_ctx, size, virt_addr, dma_addr); -+} -+ -+void *__DWC_ALLOC(void *mem_ctx, uint32_t size) -+{ -+ return kzalloc(size, GFP_KERNEL); -+} -+ -+void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) -+{ -+ return kzalloc(size, GFP_ATOMIC); -+} -+ -+void __DWC_FREE(void *mem_ctx, void *addr) -+{ -+ kfree(addr); -+} -+ -+ -+#ifdef DWC_CRYPTOLIB -+/* dwc_crypto.h */ -+ -+void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) -+{ -+ get_random_bytes(buffer, length); -+} -+ -+int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) -+{ -+ struct crypto_blkcipher *tfm; -+ struct blkcipher_desc desc; -+ struct scatterlist sgd; -+ struct scatterlist sgs; -+ -+ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); -+ if (tfm == NULL) { -+ printk("failed to load transform for aes CBC\n"); -+ return -1; -+ } -+ -+ crypto_blkcipher_setkey(tfm, key, keylen); -+ crypto_blkcipher_set_iv(tfm, iv, 16); -+ -+ sg_init_one(&sgd, out, messagelen); -+ sg_init_one(&sgs, message, messagelen); -+ -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { -+ crypto_free_blkcipher(tfm); -+ DWC_ERROR("AES CBC encryption failed"); -+ return -1; -+ } -+ -+ crypto_free_blkcipher(tfm); -+ return 0; -+} -+ -+int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for sha256: %ld\n", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, len); -+ crypto_hash_digest(&desc, &sg, len, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, -+ uint8_t *key, uint32_t keylen, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for hmac(sha256): %ld\n", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, messagelen); -+ crypto_hash_setkey(tfm, key, keylen); -+ crypto_hash_digest(&desc, &sg, messagelen, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/* Byte Ordering Conversions */ -+ -+uint32_t DWC_CPU_TO_LE32(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_CPU_TO_BE32(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_LE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_BE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_LE16(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_BE16(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_LE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_BE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+ -+/* Registers */ -+ -+uint32_t DWC_READ_REG32(uint32_t volatile *reg) -+{ -+ return readl(reg); -+} -+ -+#if 0 -+uint64_t DWC_READ_REG64(uint64_t volatile *reg) -+{ -+} -+#endif -+ -+void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value) -+{ -+ writel(value, reg); -+} -+ -+#if 0 -+void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value) -+{ -+} -+#endif -+ -+void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask) -+{ -+ writel((readl(reg) & ~clear_mask) | set_mask, reg); -+} -+ -+#if 0 -+void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask) -+{ -+} -+#endif -+ -+ -+/* Locking */ -+ -+dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) -+{ -+ spinlock_t *sl = (spinlock_t *)1; -+ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ sl = DWC_ALLOC(sizeof(*sl)); -+ if (!sl) { -+ DWC_ERROR("Cannot allocate memory for spinlock\n"); -+ return NULL; -+ } -+ -+ spin_lock_init(sl); -+#endif -+ return (dwc_spinlock_t *)sl; -+} -+ -+void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ DWC_FREE(lock); -+#endif -+} -+ -+void DWC_SPINLOCK(dwc_spinlock_t *lock) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_lock((spinlock_t *)lock); -+#endif -+} -+ -+void DWC_SPINUNLOCK(dwc_spinlock_t *lock) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_unlock((spinlock_t *)lock); -+#endif -+} -+ -+void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) -+{ -+ dwc_irqflags_t f; -+ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_lock_irqsave((spinlock_t *)lock, f); -+#else -+ local_irq_save(f); -+#endif -+ *flags = f; -+} -+ -+void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) -+{ -+#if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP) -+ spin_unlock_irqrestore((spinlock_t *)lock, flags); -+#else -+ local_irq_restore(flags); -+#endif -+} -+ -+dwc_mutex_t *DWC_MUTEX_ALLOC(void) -+{ -+ struct mutex *m; -+ dwc_mutex_t *mutex = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); -+ -+ if (!mutex) { -+ DWC_ERROR("Cannot allocate memory for mutex\n"); -+ return NULL; -+ } -+ -+ m = (struct mutex *)mutex; -+ mutex_init(m); -+ return mutex; -+} -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+#else -+void DWC_MUTEX_FREE(dwc_mutex_t *mutex) -+{ -+ mutex_destroy((struct mutex *)mutex); -+ DWC_FREE(mutex); -+} -+#endif -+ -+void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) -+{ -+ struct mutex *m = (struct mutex *)mutex; -+ mutex_lock(m); -+} -+ -+int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) -+{ -+ struct mutex *m = (struct mutex *)mutex; -+ return mutex_trylock(m); -+} -+ -+void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) -+{ -+ struct mutex *m = (struct mutex *)mutex; -+ mutex_unlock(m); -+} -+ -+ -+/* Timing */ -+ -+void DWC_UDELAY(uint32_t usecs) -+{ -+ udelay(usecs); -+} -+ -+void DWC_MDELAY(uint32_t msecs) -+{ -+ mdelay(msecs); -+} -+ -+void DWC_MSLEEP(uint32_t msecs) -+{ -+ msleep(msecs); -+} -+ -+uint32_t DWC_TIME(void) -+{ -+ return jiffies_to_msecs(jiffies); -+} -+ -+ -+/* Timers */ -+ -+struct dwc_timer { -+ struct timer_list *t; -+ char *name; -+ dwc_timer_callback_t cb; -+ void *data; -+ uint8_t scheduled; -+ dwc_spinlock_t *lock; -+}; -+ -+static void timer_callback(unsigned long data) -+{ -+ dwc_timer_t *timer = (dwc_timer_t *)data; -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); -+ timer->scheduled = 0; -+ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); -+ DWC_DEBUGC("Timer %s callback", timer->name); -+ timer->cb(timer->data); -+} -+ -+dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) -+{ -+ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (!t) { -+ DWC_ERROR("Cannot allocate memory for timer"); -+ return NULL; -+ } -+ -+ t->t = DWC_ALLOC(sizeof(*t->t)); -+ if (!t->t) { -+ DWC_ERROR("Cannot allocate memory for timer->t"); -+ goto no_timer; -+ } -+ -+ t->name = DWC_STRDUP(name); -+ if (!t->name) { -+ DWC_ERROR("Cannot allocate memory for timer->name"); -+ goto no_name; -+ } -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(t->lock); -+#else -+ t->lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ if (!t->lock) { -+ DWC_ERROR("Cannot allocate memory for lock"); -+ goto no_lock; -+ } -+ -+ t->scheduled = 0; -+ t->t->expires = jiffies; -+ setup_timer(t->t, timer_callback, (unsigned long)t); -+ -+ t->cb = cb; -+ t->data = data; -+ -+ return t; -+ -+ no_lock: -+ DWC_FREE(t->name); -+ no_name: -+ DWC_FREE(t->t); -+ no_timer: -+ DWC_FREE(t); -+ return NULL; -+} -+ -+void DWC_TIMER_FREE(dwc_timer_t *timer) -+{ -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); -+ -+ if (timer->scheduled) { -+ del_timer(timer->t); -+ timer->scheduled = 0; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); -+ DWC_SPINLOCK_FREE(timer->lock); -+ DWC_FREE(timer->t); -+ DWC_FREE(timer->name); -+ DWC_FREE(timer); -+} -+ -+void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) -+{ -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(timer->lock, &flags); -+ -+ if (!timer->scheduled) { -+ timer->scheduled = 1; -+ DWC_DEBUGC("Scheduling timer %s to expire in +%d msec", timer->name, time); -+ timer->t->expires = jiffies + msecs_to_jiffies(time); -+ add_timer(timer->t); -+ } else { -+ DWC_DEBUGC("Modifying timer %s to expire in +%d msec", timer->name, time); -+ mod_timer(timer->t, jiffies + msecs_to_jiffies(time)); -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(timer->lock, flags); -+} -+ -+void DWC_TIMER_CANCEL(dwc_timer_t *timer) -+{ -+ del_timer(timer->t); -+} -+ -+ -+/* Wait Queues */ -+ -+struct dwc_waitq { -+ wait_queue_head_t queue; -+ int abort; -+}; -+ -+dwc_waitq_t *DWC_WAITQ_ALLOC(void) -+{ -+ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue\n"); -+ return NULL; -+ } -+ -+ init_waitqueue_head(&wq->queue); -+ wq->abort = 0; -+ return wq; -+} -+ -+void DWC_WAITQ_FREE(dwc_waitq_t *wq) -+{ -+ DWC_FREE(wq); -+} -+ -+int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) -+{ -+ int result = wait_event_interruptible(wq->queue, -+ cond(data) || wq->abort); -+ if (result == -ERESTARTSYS) { -+ wq->abort = 0; -+ return -DWC_E_RESTART; -+ } -+ -+ if (wq->abort == 1) { -+ wq->abort = 0; -+ return -DWC_E_ABORT; -+ } -+ -+ wq->abort = 0; -+ -+ if (result == 0) { -+ return 0; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs) -+{ -+ int32_t tmsecs; -+ int result = wait_event_interruptible_timeout(wq->queue, -+ cond(data) || wq->abort, -+ msecs_to_jiffies(msecs)); -+ if (result == -ERESTARTSYS) { -+ wq->abort = 0; -+ return -DWC_E_RESTART; -+ } -+ -+ if (wq->abort == 1) { -+ wq->abort = 0; -+ return -DWC_E_ABORT; -+ } -+ -+ wq->abort = 0; -+ -+ if (result > 0) { -+ tmsecs = jiffies_to_msecs(result); -+ if (!tmsecs) { -+ return 1; -+ } -+ -+ return tmsecs; -+ } -+ -+ if (result == 0) { -+ return -DWC_E_TIMEOUT; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) -+{ -+ wq->abort = 0; -+ wake_up_interruptible(&wq->queue); -+} -+ -+void DWC_WAITQ_ABORT(dwc_waitq_t *wq) -+{ -+ wq->abort = 1; -+ wake_up_interruptible(&wq->queue); -+} -+ -+ -+/* Threading */ -+ -+dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) -+{ -+ struct task_struct *thread = kthread_run(func, data, name); -+ -+ if (thread == ERR_PTR(-ENOMEM)) { -+ return NULL; -+ } -+ -+ return (dwc_thread_t *)thread; -+} -+ -+int DWC_THREAD_STOP(dwc_thread_t *thread) -+{ -+ return kthread_stop((struct task_struct *)thread); -+} -+ -+dwc_bool_t DWC_THREAD_SHOULD_STOP(void) -+{ -+ return kthread_should_stop(); -+} -+ -+ -+/* tasklets -+ - run in interrupt context (cannot sleep) -+ - each tasklet runs on a single CPU -+ - different tasklets can be running simultaneously on different CPUs -+ */ -+struct dwc_tasklet { -+ struct tasklet_struct t; -+ dwc_tasklet_callback_t cb; -+ void *data; -+}; -+ -+static void tasklet_callback(unsigned long data) -+{ -+ dwc_tasklet_t *t = (dwc_tasklet_t *)data; -+ t->cb(t->data); -+} -+ -+dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) -+{ -+ dwc_tasklet_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (t) { -+ t->cb = cb; -+ t->data = data; -+ tasklet_init(&t->t, tasklet_callback, (unsigned long)t); -+ } else { -+ DWC_ERROR("Cannot allocate memory for tasklet\n"); -+ } -+ -+ return t; -+} -+ -+void DWC_TASK_FREE(dwc_tasklet_t *task) -+{ -+ DWC_FREE(task); -+} -+ -+void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) -+{ -+ tasklet_schedule(&task->t); -+} -+ -+void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task) -+{ -+ tasklet_hi_schedule(&task->t); -+} -+ -+ -+/* workqueues -+ - run in process context (can sleep) -+ */ -+typedef struct work_container { -+ dwc_work_callback_t cb; -+ void *data; -+ dwc_workq_t *wq; -+ char *name; -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_ENTRY(work_container) entry; -+#endif -+ struct delayed_work work; -+} work_container_t; -+ -+#ifdef DEBUG -+DWC_CIRCLEQ_HEAD(work_container_queue, work_container); -+#endif -+ -+struct dwc_workq { -+ struct workqueue_struct *wq; -+ dwc_spinlock_t *lock; -+ dwc_waitq_t *waitq; -+ int pending; -+ -+#ifdef DEBUG -+ struct work_container_queue entries; -+#endif -+}; -+ -+static void do_work(struct work_struct *work) -+{ -+ dwc_irqflags_t flags; -+ struct delayed_work *dw = container_of(work, struct delayed_work, work); -+ work_container_t *container = container_of(dw, struct work_container, work); -+ dwc_workq_t *wq = container->wq; -+ -+ container->cb(container->data); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry); -+#endif -+ DWC_DEBUGC("Work done: %s, container=%p", container->name, container); -+ if (container->name) { -+ DWC_FREE(container->name); -+ } -+ DWC_FREE(container); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending--; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+} -+ -+static int work_done(void *data) -+{ -+ dwc_workq_t *workq = (dwc_workq_t *)data; -+ return workq->pending == 0; -+} -+ -+int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) -+{ -+ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); -+} -+ -+dwc_workq_t *DWC_WORKQ_ALLOC(char *name) -+{ -+ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ return NULL; -+ } -+ -+ wq->wq = create_singlethread_workqueue(name); -+ if (!wq->wq) { -+ goto no_wq; -+ } -+ -+ wq->pending = 0; -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(wq->lock); -+#else -+ wq->lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ if (!wq->lock) { -+ goto no_lock; -+ } -+ -+ wq->waitq = DWC_WAITQ_ALLOC(); -+ if (!wq->waitq) { -+ goto no_waitq; -+ } -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INIT(&wq->entries); -+#endif -+ return wq; -+ -+ no_waitq: -+ DWC_SPINLOCK_FREE(wq->lock); -+ no_lock: -+ destroy_workqueue(wq->wq); -+ no_wq: -+ DWC_FREE(wq); -+ -+ return NULL; -+} -+ -+void DWC_WORKQ_FREE(dwc_workq_t *wq) -+{ -+#ifdef DEBUG -+ if (wq->pending != 0) { -+ struct work_container *wc; -+ DWC_ERROR("Destroying work queue with pending work"); -+ DWC_CIRCLEQ_FOREACH(wc, &wq->entries, entry) { -+ DWC_ERROR("Work %s still pending", wc->name); -+ } -+ } -+#endif -+ destroy_workqueue(wq->wq); -+ DWC_SPINLOCK_FREE(wq->lock); -+ DWC_WAITQ_FREE(wq->waitq); -+ DWC_FREE(wq); -+} -+ -+void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, -+ char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container\n"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name\n"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); -+ INIT_WORK(&container->work.work, do_work); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ queue_work(wq->wq, &container->work.work); -+} -+ -+void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container\n"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name\n"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ DWC_DEBUGC("Queueing work: %s, container=%p", container->name, container); -+ INIT_DELAYED_WORK(&container->work, do_work); -+ -+#ifdef DEBUG -+ DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry); -+#endif -+ queue_delayed_work(wq->wq, &container->work, msecs_to_jiffies(time)); -+} -+ -+int DWC_WORKQ_PENDING(dwc_workq_t *wq) -+{ -+ return wq->pending; -+} -+ -+ -+#ifdef DWC_LIBMODULE -+ -+#ifdef DWC_CCLIB -+/* CC */ -+EXPORT_SYMBOL(dwc_cc_if_alloc); -+EXPORT_SYMBOL(dwc_cc_if_free); -+EXPORT_SYMBOL(dwc_cc_clear); -+EXPORT_SYMBOL(dwc_cc_add); -+EXPORT_SYMBOL(dwc_cc_remove); -+EXPORT_SYMBOL(dwc_cc_change); -+EXPORT_SYMBOL(dwc_cc_data_for_save); -+EXPORT_SYMBOL(dwc_cc_restore_from_data); -+EXPORT_SYMBOL(dwc_cc_match_chid); -+EXPORT_SYMBOL(dwc_cc_match_cdid); -+EXPORT_SYMBOL(dwc_cc_ck); -+EXPORT_SYMBOL(dwc_cc_chid); -+EXPORT_SYMBOL(dwc_cc_cdid); -+EXPORT_SYMBOL(dwc_cc_name); -+#endif /* DWC_CCLIB */ -+ -+#ifdef DWC_CRYPTOLIB -+# ifndef CONFIG_MACH_IPMATE -+/* Modpow */ -+EXPORT_SYMBOL(dwc_modpow); -+ -+/* DH */ -+EXPORT_SYMBOL(dwc_dh_modpow); -+EXPORT_SYMBOL(dwc_dh_derive_keys); -+EXPORT_SYMBOL(dwc_dh_pk); -+# endif /* CONFIG_MACH_IPMATE */ -+ -+/* Crypto */ -+EXPORT_SYMBOL(dwc_wusb_aes_encrypt); -+EXPORT_SYMBOL(dwc_wusb_cmf); -+EXPORT_SYMBOL(dwc_wusb_prf); -+EXPORT_SYMBOL(dwc_wusb_fill_ccm_nonce); -+EXPORT_SYMBOL(dwc_wusb_gen_nonce); -+EXPORT_SYMBOL(dwc_wusb_gen_key); -+EXPORT_SYMBOL(dwc_wusb_gen_mic); -+#endif /* DWC_CRYPTOLIB */ -+ -+/* Notification */ -+#ifdef DWC_NOTIFYLIB -+EXPORT_SYMBOL(dwc_alloc_notification_manager); -+EXPORT_SYMBOL(dwc_free_notification_manager); -+EXPORT_SYMBOL(dwc_register_notifier); -+EXPORT_SYMBOL(dwc_unregister_notifier); -+EXPORT_SYMBOL(dwc_add_observer); -+EXPORT_SYMBOL(dwc_remove_observer); -+EXPORT_SYMBOL(dwc_notify); -+#endif -+ -+/* Memory Debugging Routines */ -+#ifdef DWC_DEBUG_MEMORY -+EXPORT_SYMBOL(dwc_alloc_debug); -+EXPORT_SYMBOL(dwc_alloc_atomic_debug); -+EXPORT_SYMBOL(dwc_free_debug); -+EXPORT_SYMBOL(dwc_dma_alloc_debug); -+EXPORT_SYMBOL(dwc_dma_free_debug); -+#endif -+ -+EXPORT_SYMBOL(DWC_MEMSET); -+EXPORT_SYMBOL(DWC_MEMCPY); -+EXPORT_SYMBOL(DWC_MEMMOVE); -+EXPORT_SYMBOL(DWC_MEMCMP); -+EXPORT_SYMBOL(DWC_STRNCMP); -+EXPORT_SYMBOL(DWC_STRCMP); -+EXPORT_SYMBOL(DWC_STRLEN); -+EXPORT_SYMBOL(DWC_STRCPY); -+EXPORT_SYMBOL(DWC_STRDUP); -+EXPORT_SYMBOL(DWC_ATOI); -+EXPORT_SYMBOL(DWC_ATOUI); -+ -+#ifdef DWC_UTFLIB -+EXPORT_SYMBOL(DWC_UTF8_TO_UTF16LE); -+#endif /* DWC_UTFLIB */ -+ -+EXPORT_SYMBOL(DWC_IN_IRQ); -+EXPORT_SYMBOL(DWC_IN_BH); -+EXPORT_SYMBOL(DWC_VPRINTF); -+EXPORT_SYMBOL(DWC_VSNPRINTF); -+EXPORT_SYMBOL(DWC_PRINTF); -+EXPORT_SYMBOL(DWC_SPRINTF); -+EXPORT_SYMBOL(DWC_SNPRINTF); -+EXPORT_SYMBOL(__DWC_WARN); -+EXPORT_SYMBOL(__DWC_ERROR); -+EXPORT_SYMBOL(DWC_EXCEPTION); -+ -+#ifdef DEBUG -+EXPORT_SYMBOL(__DWC_DEBUG); -+#endif -+ -+EXPORT_SYMBOL(__DWC_DMA_ALLOC); -+EXPORT_SYMBOL(__DWC_DMA_ALLOC_ATOMIC); -+EXPORT_SYMBOL(__DWC_DMA_FREE); -+EXPORT_SYMBOL(__DWC_ALLOC); -+EXPORT_SYMBOL(__DWC_ALLOC_ATOMIC); -+EXPORT_SYMBOL(__DWC_FREE); -+ -+#ifdef DWC_CRYPTOLIB -+EXPORT_SYMBOL(DWC_RANDOM_BYTES); -+EXPORT_SYMBOL(DWC_AES_CBC); -+EXPORT_SYMBOL(DWC_SHA256); -+EXPORT_SYMBOL(DWC_HMAC_SHA256); -+#endif -+ -+EXPORT_SYMBOL(DWC_CPU_TO_LE32); -+EXPORT_SYMBOL(DWC_CPU_TO_BE32); -+EXPORT_SYMBOL(DWC_LE32_TO_CPU); -+EXPORT_SYMBOL(DWC_BE32_TO_CPU); -+EXPORT_SYMBOL(DWC_CPU_TO_LE16); -+EXPORT_SYMBOL(DWC_CPU_TO_BE16); -+EXPORT_SYMBOL(DWC_LE16_TO_CPU); -+EXPORT_SYMBOL(DWC_BE16_TO_CPU); -+EXPORT_SYMBOL(DWC_READ_REG32); -+EXPORT_SYMBOL(DWC_WRITE_REG32); -+EXPORT_SYMBOL(DWC_MODIFY_REG32); -+ -+#if 0 -+EXPORT_SYMBOL(DWC_READ_REG64); -+EXPORT_SYMBOL(DWC_WRITE_REG64); -+EXPORT_SYMBOL(DWC_MODIFY_REG64); -+#endif -+ -+EXPORT_SYMBOL(DWC_SPINLOCK_ALLOC); -+EXPORT_SYMBOL(DWC_SPINLOCK_FREE); -+EXPORT_SYMBOL(DWC_SPINLOCK); -+EXPORT_SYMBOL(DWC_SPINUNLOCK); -+EXPORT_SYMBOL(DWC_SPINLOCK_IRQSAVE); -+EXPORT_SYMBOL(DWC_SPINUNLOCK_IRQRESTORE); -+EXPORT_SYMBOL(DWC_MUTEX_ALLOC); -+ -+#if (!defined(DWC_LINUX) || !defined(CONFIG_DEBUG_MUTEXES)) -+EXPORT_SYMBOL(DWC_MUTEX_FREE); -+#endif -+ -+EXPORT_SYMBOL(DWC_MUTEX_LOCK); -+EXPORT_SYMBOL(DWC_MUTEX_TRYLOCK); -+EXPORT_SYMBOL(DWC_MUTEX_UNLOCK); -+EXPORT_SYMBOL(DWC_UDELAY); -+EXPORT_SYMBOL(DWC_MDELAY); -+EXPORT_SYMBOL(DWC_MSLEEP); -+EXPORT_SYMBOL(DWC_TIME); -+EXPORT_SYMBOL(DWC_TIMER_ALLOC); -+EXPORT_SYMBOL(DWC_TIMER_FREE); -+EXPORT_SYMBOL(DWC_TIMER_SCHEDULE); -+EXPORT_SYMBOL(DWC_TIMER_CANCEL); -+EXPORT_SYMBOL(DWC_WAITQ_ALLOC); -+EXPORT_SYMBOL(DWC_WAITQ_FREE); -+EXPORT_SYMBOL(DWC_WAITQ_WAIT); -+EXPORT_SYMBOL(DWC_WAITQ_WAIT_TIMEOUT); -+EXPORT_SYMBOL(DWC_WAITQ_TRIGGER); -+EXPORT_SYMBOL(DWC_WAITQ_ABORT); -+EXPORT_SYMBOL(DWC_THREAD_RUN); -+EXPORT_SYMBOL(DWC_THREAD_STOP); -+EXPORT_SYMBOL(DWC_THREAD_SHOULD_STOP); -+EXPORT_SYMBOL(DWC_TASK_ALLOC); -+EXPORT_SYMBOL(DWC_TASK_FREE); -+EXPORT_SYMBOL(DWC_TASK_SCHEDULE); -+EXPORT_SYMBOL(DWC_WORKQ_WAIT_WORK_DONE); -+EXPORT_SYMBOL(DWC_WORKQ_ALLOC); -+EXPORT_SYMBOL(DWC_WORKQ_FREE); -+EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE); -+EXPORT_SYMBOL(DWC_WORKQ_SCHEDULE_DELAYED); -+EXPORT_SYMBOL(DWC_WORKQ_PENDING); -+ -+static int dwc_common_port_init_module(void) -+{ -+ int result = 0; -+ -+ printk(KERN_DEBUG "Module dwc_common_port init\n" ); -+ -+#ifdef DWC_DEBUG_MEMORY -+ result = dwc_memory_debug_start(NULL); -+ if (result) { -+ printk(KERN_ERR -+ "dwc_memory_debug_start() failed with error %d\n", -+ result); -+ return result; -+ } -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+ result = dwc_alloc_notification_manager(NULL, NULL); -+ if (result) { -+ printk(KERN_ERR -+ "dwc_alloc_notification_manager() failed with error %d\n", -+ result); -+ return result; -+ } -+#endif -+ return result; -+} -+ -+static void dwc_common_port_exit_module(void) -+{ -+ printk(KERN_DEBUG "Module dwc_common_port exit\n" ); -+ -+#ifdef DWC_NOTIFYLIB -+ dwc_free_notification_manager(); -+#endif -+ -+#ifdef DWC_DEBUG_MEMORY -+ dwc_memory_debug_stop(); -+#endif -+} -+ -+module_init(dwc_common_port_init_module); -+module_exit(dwc_common_port_exit_module); -+ -+MODULE_DESCRIPTION("DWC Common Library - Portable version"); -+MODULE_AUTHOR("Synopsys Inc."); -+MODULE_LICENSE ("GPL"); -+ -+#endif /* DWC_LIBMODULE */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..49b07e1722645105e0433dceaec91add3412523f ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c -@@ -0,0 +1,1275 @@ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+#ifdef DWC_CCLIB -+# include "dwc_cc.h" -+#endif -+ -+#ifdef DWC_CRYPTOLIB -+# include "dwc_modpow.h" -+# include "dwc_dh.h" -+# include "dwc_crypto.h" -+#endif -+ -+#ifdef DWC_NOTIFYLIB -+# include "dwc_notifier.h" -+#endif -+ -+/* OS-Level Implementations */ -+ -+/* This is the NetBSD 4.0.1 kernel implementation of the DWC platform library. */ -+ -+ -+/* MISC */ -+ -+void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size) -+{ -+ return memset(dest, byte, size); -+} -+ -+void *DWC_MEMCPY(void *dest, void const *src, uint32_t size) -+{ -+ return memcpy(dest, src, size); -+} -+ -+void *DWC_MEMMOVE(void *dest, void *src, uint32_t size) -+{ -+ bcopy(src, dest, size); -+ return dest; -+} -+ -+int DWC_MEMCMP(void *m1, void *m2, uint32_t size) -+{ -+ return memcmp(m1, m2, size); -+} -+ -+int DWC_STRNCMP(void *s1, void *s2, uint32_t size) -+{ -+ return strncmp(s1, s2, size); -+} -+ -+int DWC_STRCMP(void *s1, void *s2) -+{ -+ return strcmp(s1, s2); -+} -+ -+int DWC_STRLEN(char const *str) -+{ -+ return strlen(str); -+} -+ -+char *DWC_STRCPY(char *to, char const *from) -+{ -+ return strcpy(to, from); -+} -+ -+char *DWC_STRDUP(char const *str) -+{ -+ int len = DWC_STRLEN(str) + 1; -+ char *new = DWC_ALLOC_ATOMIC(len); -+ -+ if (!new) { -+ return NULL; -+ } -+ -+ DWC_MEMCPY(new, str, len); -+ return new; -+} -+ -+int DWC_ATOI(char *str, int32_t *value) -+{ -+ char *end = NULL; -+ -+ /* NetBSD doesn't have 'strtol' in the kernel, but 'strtoul' -+ * should be equivalent on 2's complement machines -+ */ -+ *value = strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+int DWC_ATOUI(char *str, uint32_t *value) -+{ -+ char *end = NULL; -+ -+ *value = strtoul(str, &end, 0); -+ if (*end == '\0') { -+ return 0; -+ } -+ -+ return -1; -+} -+ -+ -+#ifdef DWC_UTFLIB -+/* From usbstring.c */ -+ -+int DWC_UTF8_TO_UTF16LE(uint8_t const *s, uint16_t *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+ -+#endif /* DWC_UTFLIB */ -+ -+ -+/* dwc_debug.h */ -+ -+dwc_bool_t DWC_IN_IRQ(void) -+{ -+// return in_irq(); -+ return 0; -+} -+ -+dwc_bool_t DWC_IN_BH(void) -+{ -+// return in_softirq(); -+ return 0; -+} -+ -+void DWC_VPRINTF(char *format, va_list args) -+{ -+ vprintf(format, args); -+} -+ -+int DWC_VSNPRINTF(char *str, int size, char *format, va_list args) -+{ -+ return vsnprintf(str, size, format, args); -+} -+ -+void DWC_PRINTF(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+int DWC_SPRINTF(char *buffer, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsprintf(buffer, format, args); -+ va_end(args); -+ return retval; -+} -+ -+int DWC_SNPRINTF(char *buffer, int size, char *format, ...) -+{ -+ int retval; -+ va_list args; -+ -+ va_start(args, format); -+ retval = vsnprintf(buffer, size, format, args); -+ va_end(args); -+ return retval; -+} -+ -+void __DWC_WARN(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void __DWC_ERROR(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+ -+void DWC_EXCEPTION(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+// BUG_ON(1); ??? -+} -+ -+#ifdef DEBUG -+void __DWC_DEBUG(char *format, ...) -+{ -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VPRINTF(format, args); -+ va_end(args); -+} -+#endif -+ -+ -+/* dwc_mem.h */ -+ -+#if 0 -+dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, -+ uint32_t align, -+ uint32_t alloc) -+{ -+ struct dma_pool *pool = dma_pool_create("Pool", NULL, -+ size, align, alloc); -+ return (dwc_pool_t *)pool; -+} -+ -+void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool) -+{ -+ dma_pool_destroy((struct dma_pool *)pool); -+} -+ -+void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+// return dma_pool_alloc((struct dma_pool *)pool, GFP_KERNEL, dma_addr); -+ return dma_pool_alloc((struct dma_pool *)pool, M_WAITOK, dma_addr); -+} -+ -+void *DWC_DMA_POOL_ZALLOC(dwc_pool_t *pool, uint64_t *dma_addr) -+{ -+ void *vaddr = DWC_DMA_POOL_ALLOC(pool, dma_addr); -+ memset(..); -+} -+ -+void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr) -+{ -+ dma_pool_free(pool, vaddr, daddr); -+} -+#endif -+ -+void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ int error; -+ -+ error = bus_dmamem_alloc(dma->dma_tag, size, 1, size, dma->segs, -+ sizeof(dma->segs) / sizeof(dma->segs[0]), -+ &dma->nsegs, BUS_DMA_NOWAIT); -+ if (error) { -+ printf("%s: bus_dmamem_alloc(%ju) failed: %d\n", __func__, -+ (uintmax_t)size, error); -+ goto fail_0; -+ } -+ -+ error = bus_dmamem_map(dma->dma_tag, dma->segs, dma->nsegs, size, -+ (caddr_t *)&dma->dma_vaddr, -+ BUS_DMA_NOWAIT | BUS_DMA_COHERENT); -+ if (error) { -+ printf("%s: bus_dmamem_map failed: %d\n", __func__, error); -+ goto fail_1; -+ } -+ -+ error = bus_dmamap_create(dma->dma_tag, size, 1, size, 0, -+ BUS_DMA_NOWAIT, &dma->dma_map); -+ if (error) { -+ printf("%s: bus_dmamap_create failed: %d\n", __func__, error); -+ goto fail_2; -+ } -+ -+ error = bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->dma_vaddr, -+ size, NULL, BUS_DMA_NOWAIT); -+ if (error) { -+ printf("%s: bus_dmamap_load failed: %d\n", __func__, error); -+ goto fail_3; -+ } -+ -+ dma->dma_paddr = (bus_addr_t)dma->segs[0].ds_addr; -+ *dma_addr = dma->dma_paddr; -+ return dma->dma_vaddr; -+ -+fail_3: -+ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); -+fail_2: -+ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); -+fail_1: -+ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); -+fail_0: -+ dma->dma_map = NULL; -+ dma->dma_vaddr = NULL; -+ dma->nsegs = 0; -+ -+ return NULL; -+} -+ -+void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr) -+{ -+ dwc_dmactx_t *dma = (dwc_dmactx_t *)dma_ctx; -+ -+ if (dma->dma_map != NULL) { -+ bus_dmamap_sync(dma->dma_tag, dma->dma_map, 0, size, -+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); -+ bus_dmamap_unload(dma->dma_tag, dma->dma_map); -+ bus_dmamap_destroy(dma->dma_tag, dma->dma_map); -+ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, size); -+ bus_dmamem_free(dma->dma_tag, dma->segs, dma->nsegs); -+ dma->dma_paddr = 0; -+ dma->dma_map = NULL; -+ dma->dma_vaddr = NULL; -+ dma->nsegs = 0; -+ } -+} -+ -+void *__DWC_ALLOC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); -+} -+ -+void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size) -+{ -+ return malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); -+} -+ -+void __DWC_FREE(void *mem_ctx, void *addr) -+{ -+ free(addr, M_DEVBUF); -+} -+ -+ -+#ifdef DWC_CRYPTOLIB -+/* dwc_crypto.h */ -+ -+void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length) -+{ -+ get_random_bytes(buffer, length); -+} -+ -+int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out) -+{ -+ struct crypto_blkcipher *tfm; -+ struct blkcipher_desc desc; -+ struct scatterlist sgd; -+ struct scatterlist sgs; -+ -+ tfm = crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); -+ if (tfm == NULL) { -+ printk("failed to load transform for aes CBC\n"); -+ return -1; -+ } -+ -+ crypto_blkcipher_setkey(tfm, key, keylen); -+ crypto_blkcipher_set_iv(tfm, iv, 16); -+ -+ sg_init_one(&sgd, out, messagelen); -+ sg_init_one(&sgs, message, messagelen); -+ -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ if (crypto_blkcipher_encrypt(&desc, &sgd, &sgs, messagelen)) { -+ crypto_free_blkcipher(tfm); -+ DWC_ERROR("AES CBC encryption failed"); -+ return -1; -+ } -+ -+ crypto_free_blkcipher(tfm); -+ return 0; -+} -+ -+int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for sha256: %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, len); -+ crypto_hash_digest(&desc, &sg, len, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, -+ uint8_t *key, uint32_t keylen, uint8_t *out) -+{ -+ struct crypto_hash *tfm; -+ struct hash_desc desc; -+ struct scatterlist sg; -+ -+ tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(tfm)) { -+ DWC_ERROR("Failed to load transform for hmac(sha256): %ld", PTR_ERR(tfm)); -+ return 0; -+ } -+ desc.tfm = tfm; -+ desc.flags = 0; -+ -+ sg_init_one(&sg, message, messagelen); -+ crypto_hash_setkey(tfm, key, keylen); -+ crypto_hash_digest(&desc, &sg, messagelen, out); -+ crypto_free_hash(tfm); -+ -+ return 1; -+} -+ -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/* Byte Ordering Conversions */ -+ -+uint32_t DWC_CPU_TO_LE32(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_CPU_TO_BE32(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_LE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint32_t DWC_BE32_TO_CPU(uint32_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ -+ return (u_p[3] | (u_p[2] << 8) | (u_p[1] << 16) | (u_p[0] << 24)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_LE16(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_CPU_TO_BE16(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_LE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __LITTLE_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+uint16_t DWC_BE16_TO_CPU(uint16_t *p) -+{ -+#ifdef __BIG_ENDIAN -+ return *p; -+#else -+ uint8_t *u_p = (uint8_t *)p; -+ return (u_p[1] | (u_p[0] << 8)); -+#endif -+} -+ -+ -+/* Registers */ -+ -+uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_4(io->iot, io->ioh, ior); -+} -+ -+#if 0 -+uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ return bus_space_read_8(io->iot, io->ioh, ior); -+} -+#endif -+ -+void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, value); -+} -+ -+#if 0 -+void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, value); -+} -+#endif -+ -+void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, -+ uint32_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_4(io->iot, io->ioh, ior, -+ (bus_space_read_4(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+ -+#if 0 -+void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, -+ uint64_t set_mask) -+{ -+ dwc_ioctx_t *io = (dwc_ioctx_t *)io_ctx; -+ bus_size_t ior = (bus_size_t)reg; -+ -+ bus_space_write_8(io->iot, io->ioh, ior, -+ (bus_space_read_8(io->iot, io->ioh, ior) & -+ ~clear_mask) | set_mask); -+} -+#endif -+ -+ -+/* Locking */ -+ -+dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void) -+{ -+ struct simplelock *sl = DWC_ALLOC(sizeof(*sl)); -+ -+ if (!sl) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ return NULL; -+ } -+ -+ simple_lock_init(sl); -+ return (dwc_spinlock_t *)sl; -+} -+ -+void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock) -+{ -+ struct simplelock *sl = (struct simplelock *)lock; -+ -+ DWC_FREE(sl); -+} -+ -+void DWC_SPINLOCK(dwc_spinlock_t *lock) -+{ -+ simple_lock((struct simplelock *)lock); -+} -+ -+void DWC_SPINUNLOCK(dwc_spinlock_t *lock) -+{ -+ simple_unlock((struct simplelock *)lock); -+} -+ -+void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags) -+{ -+ simple_lock((struct simplelock *)lock); -+ *flags = splbio(); -+} -+ -+void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags) -+{ -+ splx(flags); -+ simple_unlock((struct simplelock *)lock); -+} -+ -+dwc_mutex_t *DWC_MUTEX_ALLOC(void) -+{ -+ dwc_mutex_t *mutex = DWC_ALLOC(sizeof(struct lock)); -+ -+ if (!mutex) { -+ DWC_ERROR("Cannot allocate memory for mutex"); -+ return NULL; -+ } -+ -+ lockinit((struct lock *)mutex, 0, "dw3mtx", 0, 0); -+ return mutex; -+} -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES)) -+#else -+void DWC_MUTEX_FREE(dwc_mutex_t *mutex) -+{ -+ DWC_FREE(mutex); -+} -+#endif -+ -+void DWC_MUTEX_LOCK(dwc_mutex_t *mutex) -+{ -+ lockmgr((struct lock *)mutex, LK_EXCLUSIVE, NULL); -+} -+ -+int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex) -+{ -+ int status; -+ -+ status = lockmgr((struct lock *)mutex, LK_EXCLUSIVE | LK_NOWAIT, NULL); -+ return status == 0; -+} -+ -+void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex) -+{ -+ lockmgr((struct lock *)mutex, LK_RELEASE, NULL); -+} -+ -+ -+/* Timing */ -+ -+void DWC_UDELAY(uint32_t usecs) -+{ -+ DELAY(usecs); -+} -+ -+void DWC_MDELAY(uint32_t msecs) -+{ -+ do { -+ DELAY(1000); -+ } while (--msecs); -+} -+ -+void DWC_MSLEEP(uint32_t msecs) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ tsleep(&tv, 0, "dw3slp", tvtohz(&tv)); -+} -+ -+uint32_t DWC_TIME(void) -+{ -+ struct timeval tv; -+ -+ microuptime(&tv); // or getmicrouptime? (less precise, but faster) -+ return tv.tv_sec * 1000 + tv.tv_usec / 1000; -+} -+ -+ -+/* Timers */ -+ -+struct dwc_timer { -+ struct callout t; -+ char *name; -+ dwc_spinlock_t *lock; -+ dwc_timer_callback_t cb; -+ void *data; -+}; -+ -+dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data) -+{ -+ dwc_timer_t *t = DWC_ALLOC(sizeof(*t)); -+ -+ if (!t) { -+ DWC_ERROR("Cannot allocate memory for timer"); -+ return NULL; -+ } -+ -+ callout_init(&t->t); -+ -+ t->name = DWC_STRDUP(name); -+ if (!t->name) { -+ DWC_ERROR("Cannot allocate memory for timer->name"); -+ goto no_name; -+ } -+ -+ t->lock = DWC_SPINLOCK_ALLOC(); -+ if (!t->lock) { -+ DWC_ERROR("Cannot allocate memory for timer->lock"); -+ goto no_lock; -+ } -+ -+ t->cb = cb; -+ t->data = data; -+ -+ return t; -+ -+ no_lock: -+ DWC_FREE(t->name); -+ no_name: -+ DWC_FREE(t); -+ -+ return NULL; -+} -+ -+void DWC_TIMER_FREE(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+ DWC_SPINLOCK_FREE(timer->lock); -+ DWC_FREE(timer->name); -+ DWC_FREE(timer); -+} -+ -+void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time) -+{ -+ struct timeval tv; -+ -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ callout_reset(&timer->t, tvtohz(&tv), timer->cb, timer->data); -+} -+ -+void DWC_TIMER_CANCEL(dwc_timer_t *timer) -+{ -+ callout_stop(&timer->t); -+} -+ -+ -+/* Wait Queues */ -+ -+struct dwc_waitq { -+ struct simplelock lock; -+ int abort; -+}; -+ -+dwc_waitq_t *DWC_WAITQ_ALLOC(void) -+{ -+ dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ return NULL; -+ } -+ -+ simple_lock_init(&wq->lock); -+ wq->abort = 0; -+ -+ return wq; -+} -+ -+void DWC_WAITQ_FREE(dwc_waitq_t *wq) -+{ -+ DWC_FREE(wq); -+} -+ -+int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data) -+{ -+ int ipl; -+ int result = 0; -+ -+ simple_lock(&wq->lock); -+ ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+ splx(ipl); -+ result = ltsleep(wq, PCATCH, "dw3wat", 0, &wq->lock); // infinite timeout -+ ipl = splbio(); -+ } -+ -+ if (result == 0) { // awoken -+ if (wq->abort) { -+ wq->abort = 0; -+ result = -DWC_E_ABORT; -+ } else { -+ result = 0; -+ } -+ -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ } else { -+ wq->abort = 0; -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ -+ if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ } else { // signaled - must be EINTR -+ result = -DWC_E_ABORT; -+ } -+ } -+ -+ return result; -+} -+ -+int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs) -+{ -+ struct timeval tv, tv1, tv2; -+ int ipl; -+ int result = 0; -+ -+ tv.tv_sec = msecs / 1000; -+ tv.tv_usec = (msecs - tv.tv_sec * 1000) * 1000; -+ -+ simple_lock(&wq->lock); -+ ipl = splbio(); -+ -+ /* Skip the sleep if already aborted or triggered */ -+ if (!wq->abort && !cond(data)) { -+ splx(ipl); -+ getmicrouptime(&tv1); -+ result = ltsleep(wq, PCATCH, "dw3wto", tvtohz(&tv), &wq->lock); -+ getmicrouptime(&tv2); -+ ipl = splbio(); -+ } -+ -+ if (result == 0) { // awoken -+ if (wq->abort) { -+ wq->abort = 0; -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ result = -DWC_E_ABORT; -+ } else { -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ -+ tv2.tv_usec -= tv1.tv_usec; -+ if (tv2.tv_usec < 0) { -+ tv2.tv_usec += 1000000; -+ tv2.tv_sec--; -+ } -+ -+ tv2.tv_sec -= tv1.tv_sec; -+ result = tv2.tv_sec * 1000 + tv2.tv_usec / 1000; -+ result = msecs - result; -+ if (result <= 0) -+ result = 1; -+ } -+ } else { -+ wq->abort = 0; -+ splx(ipl); -+ simple_unlock(&wq->lock); -+ -+ if (result == ERESTART) { // signaled - restart -+ result = -DWC_E_RESTART; -+ -+ } else if (result == EINTR) { // signaled - interrupt -+ result = -DWC_E_ABORT; -+ -+ } else { // timed out -+ result = -DWC_E_TIMEOUT; -+ } -+ } -+ -+ return result; -+} -+ -+void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq) -+{ -+ wakeup(wq); -+} -+ -+void DWC_WAITQ_ABORT(dwc_waitq_t *wq) -+{ -+ int ipl; -+ -+ simple_lock(&wq->lock); -+ ipl = splbio(); -+ wq->abort = 1; -+ wakeup(wq); -+ splx(ipl); -+ simple_unlock(&wq->lock); -+} -+ -+ -+/* Threading */ -+ -+struct dwc_thread { -+ struct proc *proc; -+ int abort; -+}; -+ -+dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data) -+{ -+ int retval; -+ dwc_thread_t *thread = DWC_ALLOC(sizeof(*thread)); -+ -+ if (!thread) { -+ return NULL; -+ } -+ -+ thread->abort = 0; -+ retval = kthread_create1((void (*)(void *))func, data, &thread->proc, -+ "%s", name); -+ if (retval) { -+ DWC_FREE(thread); -+ return NULL; -+ } -+ -+ return thread; -+} -+ -+int DWC_THREAD_STOP(dwc_thread_t *thread) -+{ -+ int retval; -+ -+ thread->abort = 1; -+ retval = tsleep(&thread->abort, 0, "dw3stp", 60 * hz); -+ -+ if (retval == 0) { -+ /* DWC_THREAD_EXIT() will free the thread struct */ -+ return 0; -+ } -+ -+ /* NOTE: We leak the thread struct if thread doesn't die */ -+ -+ if (retval == EWOULDBLOCK) { -+ return -DWC_E_TIMEOUT; -+ } -+ -+ return -DWC_E_UNKNOWN; -+} -+ -+dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread) -+{ -+ return thread->abort; -+} -+ -+void DWC_THREAD_EXIT(dwc_thread_t *thread) -+{ -+ wakeup(&thread->abort); -+ DWC_FREE(thread); -+ kthread_exit(0); -+} -+ -+/* tasklets -+ - Runs in interrupt context (cannot sleep) -+ - Each tasklet runs on a single CPU -+ - Different tasklets can be running simultaneously on different CPUs -+ [ On NetBSD there is no corresponding mechanism, drivers don't have bottom- -+ halves. So we just call the callback directly from DWC_TASK_SCHEDULE() ] -+ */ -+struct dwc_tasklet { -+ dwc_tasklet_callback_t cb; -+ void *data; -+}; -+ -+static void tasklet_callback(void *data) -+{ -+ dwc_tasklet_t *task = (dwc_tasklet_t *)data; -+ -+ task->cb(task->data); -+} -+ -+dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data) -+{ -+ dwc_tasklet_t *task = DWC_ALLOC(sizeof(*task)); -+ -+ if (task) { -+ task->cb = cb; -+ task->data = data; -+ } else { -+ DWC_ERROR("Cannot allocate memory for tasklet"); -+ } -+ -+ return task; -+} -+ -+void DWC_TASK_FREE(dwc_tasklet_t *task) -+{ -+ DWC_FREE(task); -+} -+ -+void DWC_TASK_SCHEDULE(dwc_tasklet_t *task) -+{ -+ tasklet_callback(task); -+} -+ -+ -+/* workqueues -+ - Runs in process context (can sleep) -+ */ -+typedef struct work_container { -+ dwc_work_callback_t cb; -+ void *data; -+ dwc_workq_t *wq; -+ char *name; -+ int hz; -+ struct work task; -+} work_container_t; -+ -+struct dwc_workq { -+ struct workqueue *taskq; -+ dwc_spinlock_t *lock; -+ dwc_waitq_t *waitq; -+ int pending; -+ struct work_container *container; -+}; -+ -+static void do_work(struct work *task, void *data) -+{ -+ dwc_workq_t *wq = (dwc_workq_t *)data; -+ work_container_t *container = wq->container; -+ dwc_irqflags_t flags; -+ -+ if (container->hz) { -+ tsleep(container, 0, "dw3wrk", container->hz); -+ } -+ -+ container->cb(container->data); -+ DWC_DEBUG("Work done: %s, container=%p", container->name, container); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ if (container->name) -+ DWC_FREE(container->name); -+ DWC_FREE(container); -+ wq->pending--; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+} -+ -+static int work_done(void *data) -+{ -+ dwc_workq_t *workq = (dwc_workq_t *)data; -+ -+ return workq->pending == 0; -+} -+ -+int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout) -+{ -+ return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout); -+} -+ -+dwc_workq_t *DWC_WORKQ_ALLOC(char *name) -+{ -+ int result; -+ dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq)); -+ -+ if (!wq) { -+ DWC_ERROR("Cannot allocate memory for workqueue"); -+ return NULL; -+ } -+ -+ result = workqueue_create(&wq->taskq, name, do_work, wq, 0 /*PWAIT*/, -+ IPL_BIO, 0); -+ if (result) { -+ DWC_ERROR("Cannot create workqueue"); -+ goto no_taskq; -+ } -+ -+ wq->pending = 0; -+ -+ wq->lock = DWC_SPINLOCK_ALLOC(); -+ if (!wq->lock) { -+ DWC_ERROR("Cannot allocate memory for spinlock"); -+ goto no_lock; -+ } -+ -+ wq->waitq = DWC_WAITQ_ALLOC(); -+ if (!wq->waitq) { -+ DWC_ERROR("Cannot allocate memory for waitqueue"); -+ goto no_waitq; -+ } -+ -+ return wq; -+ -+ no_waitq: -+ DWC_SPINLOCK_FREE(wq->lock); -+ no_lock: -+ workqueue_destroy(wq->taskq); -+ no_taskq: -+ DWC_FREE(wq); -+ -+ return NULL; -+} -+ -+void DWC_WORKQ_FREE(dwc_workq_t *wq) -+{ -+#ifdef DEBUG -+ dwc_irqflags_t flags; -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ -+ if (wq->pending != 0) { -+ struct work_container *container = wq->container; -+ -+ DWC_ERROR("Destroying work queue with pending work"); -+ -+ if (container && container->name) { -+ DWC_ERROR("Work %s still pending", container->name); -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+#endif -+ DWC_WAITQ_FREE(wq->waitq); -+ DWC_SPINLOCK_FREE(wq->lock); -+ workqueue_destroy(wq->taskq); -+ DWC_FREE(wq); -+} -+ -+void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t cb, void *data, -+ char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ container->hz = 0; -+ wq->container = container; -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ workqueue_enqueue(wq->taskq, &container->task); -+} -+ -+void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+{ -+ dwc_irqflags_t flags; -+ work_container_t *container; -+ static char name[128]; -+ struct timeval tv; -+ va_list args; -+ -+ va_start(args, format); -+ DWC_VSNPRINTF(name, 128, format, args); -+ va_end(args); -+ -+ DWC_SPINLOCK_IRQSAVE(wq->lock, &flags); -+ wq->pending++; -+ DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags); -+ DWC_WAITQ_TRIGGER(wq->waitq); -+ -+ container = DWC_ALLOC_ATOMIC(sizeof(*container)); -+ if (!container) { -+ DWC_ERROR("Cannot allocate memory for container"); -+ return; -+ } -+ -+ container->name = DWC_STRDUP(name); -+ if (!container->name) { -+ DWC_ERROR("Cannot allocate memory for container->name"); -+ DWC_FREE(container); -+ return; -+ } -+ -+ container->cb = cb; -+ container->data = data; -+ container->wq = wq; -+ tv.tv_sec = time / 1000; -+ tv.tv_usec = (time - tv.tv_sec * 1000) * 1000; -+ container->hz = tvtohz(&tv); -+ wq->container = container; -+ -+ DWC_DEBUG("Queueing work: %s, container=%p", container->name, container); -+ workqueue_enqueue(wq->taskq, &container->task); -+} -+ -+int DWC_WORKQ_PENDING(dwc_workq_t *wq) -+{ -+ return wq->pending; -+} -diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.c b/drivers/usb/host/dwc_common_port/dwc_crypto.c -new file mode 100644 -index 0000000000000000000000000000000000000000..3b0353296148f6297b5bdc2f45e9fe92a17c680d ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_crypto.c -@@ -0,0 +1,308 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.c $ -+ * $Revision: #5 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+ -+/** @file -+ * This file contains the WUSB cryptographic routines. -+ */ -+ -+#ifdef DWC_CRYPTOLIB -+ -+#include "dwc_crypto.h" -+#include "usb.h" -+ -+#ifdef DEBUG -+static inline void dump_bytes(char *name, uint8_t *bytes, int len) -+{ -+ int i; -+ DWC_PRINTF("%s: ", name); -+ for (i=0; idst == src, then the bytes will be encrypted -+ * in-place. -+ * -+ * @return 0 on success, negative error code on error. -+ */ -+int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst) -+{ -+ u8 block_t[16]; -+ DWC_MEMSET(block_t, 0, 16); -+ -+ return DWC_AES_CBC(src, 16, key, 16, block_t, dst); -+} -+ -+/** -+ * The CCM-MAC-FUNCTION described in section 6.5 of the WUSB spec. -+ * This function takes a data string and returns the encrypted CBC -+ * Counter-mode MIC. -+ * -+ * @param key The 128-bit symmetric key. -+ * @param nonce The CCM nonce. -+ * @param label The unique 14-byte ASCII text label. -+ * @param bytes The byte array to be encrypted. -+ * @param len Length of the byte array. -+ * @param result Byte array to receive the 8-byte encrypted MIC. -+ */ -+void dwc_wusb_cmf(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ u8 block_m[16]; -+ u8 block_x[16]; -+ u8 block_t[8]; -+ int idx, blkNum; -+ u16 la = (u16)(len + 14); -+ -+ /* Set the AES-128 key */ -+ //dwc_aes_setkey(tfm, key, 16); -+ -+ /* Fill block B0 from flags = 0x59, N, and l(m) = 0 */ -+ block_m[0] = 0x59; -+ for (idx = 0; idx < 13; idx++) -+ block_m[idx + 1] = nonce[idx]; -+ block_m[14] = 0; -+ block_m[15] = 0; -+ -+ /* Produce the CBC IV */ -+ dwc_wusb_aes_encrypt(block_m, key, block_x); -+ show_block(block_m, "CBC IV in: ", "\n", 0); -+ show_block(block_x, "CBC IV out:", "\n", 0); -+ -+ /* Fill block B1 from l(a) = Blen + 14, and A */ -+ block_x[0] ^= (u8)(la >> 8); -+ block_x[1] ^= (u8)la; -+ for (idx = 0; idx < 14; idx++) -+ block_x[idx + 2] ^= label[idx]; -+ show_block(block_x, "After xor: ", "b1\n", 16); -+ -+ dwc_wusb_aes_encrypt(block_x, key, block_x); -+ show_block(block_x, "After AES: ", "b1\n", 16); -+ -+ idx = 0; -+ blkNum = 0; -+ -+ /* Fill remaining blocks with B */ -+ while (len-- > 0) { -+ block_x[idx] ^= *bytes++; -+ if (++idx >= 16) { -+ idx = 0; -+ show_block(block_x, "After xor: ", "\n", blkNum); -+ dwc_wusb_aes_encrypt(block_x, key, block_x); -+ show_block(block_x, "After AES: ", "\n", blkNum); -+ blkNum++; -+ } -+ } -+ -+ /* Handle partial last block */ -+ if (idx > 0) { -+ show_block(block_x, "After xor: ", "\n", blkNum); -+ dwc_wusb_aes_encrypt(block_x, key, block_x); -+ show_block(block_x, "After AES: ", "\n", blkNum); -+ } -+ -+ /* Save the MIC tag */ -+ DWC_MEMCPY(block_t, block_x, 8); -+ show_block(block_t, "MIC tag : ", NULL, 8); -+ -+ /* Fill block A0 from flags = 0x01, N, and counter = 0 */ -+ block_m[0] = 0x01; -+ block_m[14] = 0; -+ block_m[15] = 0; -+ -+ /* Encrypt the counter */ -+ dwc_wusb_aes_encrypt(block_m, key, block_x); -+ show_block(block_x, "CTR[MIC] : ", NULL, 8); -+ -+ /* XOR with MIC tag */ -+ for (idx = 0; idx < 8; idx++) { -+ block_t[idx] ^= block_x[idx]; -+ } -+ -+ /* Return result to caller */ -+ DWC_MEMCPY(result, block_t, 8); -+ show_block(result, "CCM-MIC : ", NULL, 8); -+ -+} -+ -+/** -+ * The PRF function described in section 6.5 of the WUSB spec. This function -+ * concatenates MIC values returned from dwc_cmf() to create a value of -+ * the requested length. -+ * -+ * @param prf_len Length of the PRF function in bits (64, 128, or 256). -+ * @param key, nonce, label, bytes, len Same as for dwc_cmf(). -+ * @param result Byte array to receive the result. -+ */ -+void dwc_wusb_prf(int prf_len, u8 *key, -+ u8 *nonce, char *label, u8 *bytes, int len, u8 *result) -+{ -+ int i; -+ -+ nonce[0] = 0; -+ for (i = 0; i < prf_len >> 6; i++, nonce[0]++) { -+ dwc_wusb_cmf(key, nonce, label, bytes, len, result); -+ result += 8; -+ } -+} -+ -+/** -+ * Fills in CCM Nonce per the WUSB spec. -+ * -+ * @param[in] haddr Host address. -+ * @param[in] daddr Device address. -+ * @param[in] tkid Session Key(PTK) identifier. -+ * @param[out] nonce Pointer to where the CCM Nonce output is to be written. -+ */ -+void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, -+ uint8_t *nonce) -+{ -+ -+ DWC_DEBUG("%s %x %x\n", __func__, daddr, haddr); -+ -+ DWC_MEMSET(&nonce[0], 0, 16); -+ -+ DWC_MEMCPY(&nonce[6], tkid, 3); -+ nonce[9] = daddr & 0xFF; -+ nonce[10] = (daddr >> 8) & 0xFF; -+ nonce[11] = haddr & 0xFF; -+ nonce[12] = (haddr >> 8) & 0xFF; -+ -+ dump_bytes("CCM nonce", nonce, 16); -+} -+ -+/** -+ * Generates a 16-byte cryptographic-grade random number for the Host/Device -+ * Nonce. -+ */ -+void dwc_wusb_gen_nonce(uint16_t addr, uint8_t *nonce) -+{ -+ uint8_t inonce[16]; -+ uint32_t temp[4]; -+ -+ /* Fill in the Nonce */ -+ DWC_MEMSET(&inonce[0], 0, sizeof(inonce)); -+ inonce[9] = addr & 0xFF; -+ inonce[10] = (addr >> 8) & 0xFF; -+ inonce[11] = inonce[9]; -+ inonce[12] = inonce[10]; -+ -+ /* Collect "randomness samples" */ -+ DWC_RANDOM_BYTES((uint8_t *)temp, 16); -+ -+ dwc_wusb_prf_128((uint8_t *)temp, nonce, -+ "Random Numbers", (uint8_t *)temp, sizeof(temp), -+ nonce); -+} -+ -+/** -+ * Generates the Session Key (PTK) and Key Confirmation Key (KCK) per the -+ * WUSB spec. -+ * -+ * @param[in] ccm_nonce Pointer to CCM Nonce. -+ * @param[in] mk Master Key to derive the session from -+ * @param[in] hnonce Pointer to Host Nonce. -+ * @param[in] dnonce Pointer to Device Nonce. -+ * @param[out] kck Pointer to where the KCK output is to be written. -+ * @param[out] ptk Pointer to where the PTK output is to be written. -+ */ -+void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, uint8_t *hnonce, -+ uint8_t *dnonce, uint8_t *kck, uint8_t *ptk) -+{ -+ uint8_t idata[32]; -+ uint8_t odata[32]; -+ -+ dump_bytes("ck", mk, 16); -+ dump_bytes("hnonce", hnonce, 16); -+ dump_bytes("dnonce", dnonce, 16); -+ -+ /* The data is the HNonce and DNonce concatenated */ -+ DWC_MEMCPY(&idata[0], hnonce, 16); -+ DWC_MEMCPY(&idata[16], dnonce, 16); -+ -+ dwc_wusb_prf_256(mk, ccm_nonce, "Pair-wise keys", idata, 32, odata); -+ -+ /* Low 16 bytes of the result is the KCK, high 16 is the PTK */ -+ DWC_MEMCPY(kck, &odata[0], 16); -+ DWC_MEMCPY(ptk, &odata[16], 16); -+ -+ dump_bytes("kck", kck, 16); -+ dump_bytes("ptk", ptk, 16); -+} -+ -+/** -+ * Generates the Message Integrity Code over the Handshake data per the -+ * WUSB spec. -+ * -+ * @param ccm_nonce Pointer to CCM Nonce. -+ * @param kck Pointer to Key Confirmation Key. -+ * @param data Pointer to Handshake data to be checked. -+ * @param mic Pointer to where the MIC output is to be written. -+ */ -+void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t *kck, -+ uint8_t *data, uint8_t *mic) -+{ -+ -+ dwc_wusb_prf_64(kck, ccm_nonce, "out-of-bandMIC", -+ data, WUSB_HANDSHAKE_LEN_FOR_MIC, mic); -+} -+ -+#endif /* DWC_CRYPTOLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_crypto.h b/drivers/usb/host/dwc_common_port/dwc_crypto.h -new file mode 100644 -index 0000000000000000000000000000000000000000..26fcddcfe9ba4b83c921cd2ef8498021176a287f ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_crypto.h -@@ -0,0 +1,111 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.h $ -+ * $Revision: #3 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+ -+#ifndef _DWC_CRYPTO_H_ -+#define _DWC_CRYPTO_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** @file -+ * -+ * This file contains declarations for the WUSB Cryptographic routines as -+ * defined in the WUSB spec. They are only to be used internally by the DWC UWB -+ * modules. -+ */ -+ -+#include "dwc_os.h" -+ -+int dwc_wusb_aes_encrypt(u8 *src, u8 *key, u8 *dst); -+ -+void dwc_wusb_cmf(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result); -+void dwc_wusb_prf(int prf_len, u8 *key, -+ u8 *nonce, char *label, u8 *bytes, int len, u8 *result); -+ -+/** -+ * The PRF-64 function described in section 6.5 of the WUSB spec. -+ * -+ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). -+ */ -+static inline void dwc_wusb_prf_64(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ dwc_wusb_prf(64, key, nonce, label, bytes, len, result); -+} -+ -+/** -+ * The PRF-128 function described in section 6.5 of the WUSB spec. -+ * -+ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). -+ */ -+static inline void dwc_wusb_prf_128(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ dwc_wusb_prf(128, key, nonce, label, bytes, len, result); -+} -+ -+/** -+ * The PRF-256 function described in section 6.5 of the WUSB spec. -+ * -+ * @param key, nonce, label, bytes, len, result Same as for dwc_prf(). -+ */ -+static inline void dwc_wusb_prf_256(u8 *key, u8 *nonce, -+ char *label, u8 *bytes, int len, u8 *result) -+{ -+ dwc_wusb_prf(256, key, nonce, label, bytes, len, result); -+} -+ -+ -+void dwc_wusb_fill_ccm_nonce(uint16_t haddr, uint16_t daddr, uint8_t *tkid, -+ uint8_t *nonce); -+void dwc_wusb_gen_nonce(uint16_t addr, -+ uint8_t *nonce); -+ -+void dwc_wusb_gen_key(uint8_t *ccm_nonce, uint8_t *mk, -+ uint8_t *hnonce, uint8_t *dnonce, -+ uint8_t *kck, uint8_t *ptk); -+ -+ -+void dwc_wusb_gen_mic(uint8_t *ccm_nonce, uint8_t -+ *kck, uint8_t *data, uint8_t *mic); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_CRYPTO_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_dh.c b/drivers/usb/host/dwc_common_port/dwc_dh.c -new file mode 100644 -index 0000000000000000000000000000000000000000..2b429a32aaf0903c2b73e9aa30ef78ba280393ee ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_dh.c -@@ -0,0 +1,291 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.c $ -+ * $Revision: #3 $ -+ * $Date: 2010/09/28 $ -+ * $Change: 1596182 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifdef DWC_CRYPTOLIB -+ -+#ifndef CONFIG_MACH_IPMATE -+ -+#include "dwc_dh.h" -+#include "dwc_modpow.h" -+ -+#ifdef DEBUG -+/* This function prints out a buffer in the format described in the Association -+ * Model specification. */ -+static void dh_dump(char *str, void *_num, int len) -+{ -+ uint8_t *num = _num; -+ int i; -+ DWC_PRINTF("%s\n", str); -+ for (i = 0; i < len; i ++) { -+ DWC_PRINTF("%02x", num[i]); -+ if (((i + 1) % 2) == 0) DWC_PRINTF(" "); -+ if (((i + 1) % 26) == 0) DWC_PRINTF("\n"); -+ } -+ -+ DWC_PRINTF("\n"); -+} -+#else -+#define dh_dump(_x...) do {; } while(0) -+#endif -+ -+/* Constant g value */ -+static __u32 dh_g[] = { -+ 0x02000000, -+}; -+ -+/* Constant p value */ -+static __u32 dh_p[] = { -+ 0xFFFFFFFF, 0xFFFFFFFF, 0xA2DA0FC9, 0x34C26821, 0x8B62C6C4, 0xD11CDC80, 0x084E0229, 0x74CC678A, -+ 0xA6BE0B02, 0x229B133B, 0x79084A51, 0xDD04348E, 0xB31995EF, 0x1B433ACD, 0x6D0A2B30, 0x37145FF2, -+ 0x6D35E14F, 0x45C2516D, 0x76B585E4, 0xC67E5E62, 0xE9424CF4, 0x6BED37A6, 0xB65CFF0B, 0xEDB706F4, -+ 0xFB6B38EE, 0xA59F895A, 0x11249FAE, 0xE61F4B7C, 0x51662849, 0x3D5BE4EC, 0xB87C00C2, 0x05BF63A1, -+ 0x3648DA98, 0x9AD3551C, 0xA83F1669, 0x5FCF24FD, 0x235D6583, 0x96ADA3DC, 0x56F3621C, 0xBB528520, -+ 0x0729D59E, 0x6D969670, 0x4E350C67, 0x0498BC4A, 0x086C74F1, 0x7C2118CA, 0x465E9032, 0x3BCE362E, -+ 0x2C779EE3, 0x03860E18, 0xA283279B, 0x8FA207EC, 0xF05DC5B5, 0xC9524C6F, 0xF6CB2BDE, 0x18175895, -+ 0x7C499539, 0xE56A95EA, 0x1826D215, 0x1005FA98, 0x5A8E7215, 0x2DC4AA8A, 0x0D1733AD, 0x337A5004, -+ 0xAB2155A8, 0x64BA1CDF, 0x0485FBEC, 0x0AEFDB58, 0x5771EA8A, 0x7D0C065D, 0x850F97B3, 0xC7E4E1A6, -+ 0x8CAEF5AB, 0xD73309DB, 0xE0948C1E, 0x9D61254A, 0x26D2E3CE, 0x6BEED21A, 0x06FA2FF1, 0x64088AD9, -+ 0x730276D8, 0x646AC83E, 0x182B1F52, 0x0C207B17, 0x5717E1BB, 0x6C5D617A, 0xC0880977, 0xE246D9BA, -+ 0xA04FE208, 0x31ABE574, 0xFC5BDB43, 0x8E10FDE0, 0x20D1824B, 0xCAD23AA9, 0xFFFFFFFF, 0xFFFFFFFF, -+}; -+ -+static void dh_swap_bytes(void *_in, void *_out, uint32_t len) -+{ -+ uint8_t *in = _in; -+ uint8_t *out = _out; -+ int i; -+ for (i=0; inext = (link); \ -+ (link)->prev = (link); \ -+} while (0) -+ -+#define DWC_LIST_FIRST(link) ((link)->next) -+#define DWC_LIST_LAST(link) ((link)->prev) -+#define DWC_LIST_END(link) (link) -+#define DWC_LIST_NEXT(link) ((link)->next) -+#define DWC_LIST_PREV(link) ((link)->prev) -+#define DWC_LIST_EMPTY(link) \ -+ (DWC_LIST_FIRST(link) == DWC_LIST_END(link)) -+#define DWC_LIST_ENTRY(link, type, field) \ -+ (type *)((uint8_t *)(link) - (size_t)(&((type *)0)->field)) -+ -+#if 0 -+#define DWC_LIST_INSERT_HEAD(list, link) do { \ -+ (link)->next = (list)->next; \ -+ (link)->prev = (list); \ -+ (list)->next->prev = (link); \ -+ (list)->next = (link); \ -+} while (0) -+ -+#define DWC_LIST_INSERT_TAIL(list, link) do { \ -+ (link)->next = (list); \ -+ (link)->prev = (list)->prev; \ -+ (list)->prev->next = (link); \ -+ (list)->prev = (link); \ -+} while (0) -+#else -+#define DWC_LIST_INSERT_HEAD(list, link) do { \ -+ dwc_list_link_t *__next__ = (list)->next; \ -+ __next__->prev = (link); \ -+ (link)->next = __next__; \ -+ (link)->prev = (list); \ -+ (list)->next = (link); \ -+} while (0) -+ -+#define DWC_LIST_INSERT_TAIL(list, link) do { \ -+ dwc_list_link_t *__prev__ = (list)->prev; \ -+ (list)->prev = (link); \ -+ (link)->next = (list); \ -+ (link)->prev = __prev__; \ -+ __prev__->next = (link); \ -+} while (0) -+#endif -+ -+#if 0 -+static inline void __list_add(struct list_head *new, -+ struct list_head *prev, -+ struct list_head *next) -+{ -+ next->prev = new; -+ new->next = next; -+ new->prev = prev; -+ prev->next = new; -+} -+ -+static inline void list_add(struct list_head *new, struct list_head *head) -+{ -+ __list_add(new, head, head->next); -+} -+ -+static inline void list_add_tail(struct list_head *new, struct list_head *head) -+{ -+ __list_add(new, head->prev, head); -+} -+ -+static inline void __list_del(struct list_head * prev, struct list_head * next) -+{ -+ next->prev = prev; -+ prev->next = next; -+} -+ -+static inline void list_del(struct list_head *entry) -+{ -+ __list_del(entry->prev, entry->next); -+ entry->next = LIST_POISON1; -+ entry->prev = LIST_POISON2; -+} -+#endif -+ -+#define DWC_LIST_REMOVE(link) do { \ -+ (link)->next->prev = (link)->prev; \ -+ (link)->prev->next = (link)->next; \ -+} while (0) -+ -+#define DWC_LIST_REMOVE_INIT(link) do { \ -+ DWC_LIST_REMOVE(link); \ -+ DWC_LIST_INIT(link); \ -+} while (0) -+ -+#define DWC_LIST_MOVE_HEAD(list, link) do { \ -+ DWC_LIST_REMOVE(link); \ -+ DWC_LIST_INSERT_HEAD(list, link); \ -+} while (0) -+ -+#define DWC_LIST_MOVE_TAIL(list, link) do { \ -+ DWC_LIST_REMOVE(link); \ -+ DWC_LIST_INSERT_TAIL(list, link); \ -+} while (0) -+ -+#define DWC_LIST_FOREACH(var, list) \ -+ for((var) = DWC_LIST_FIRST(list); \ -+ (var) != DWC_LIST_END(list); \ -+ (var) = DWC_LIST_NEXT(var)) -+ -+#define DWC_LIST_FOREACH_SAFE(var, var2, list) \ -+ for((var) = DWC_LIST_FIRST(list), (var2) = DWC_LIST_NEXT(var); \ -+ (var) != DWC_LIST_END(list); \ -+ (var) = (var2), (var2) = DWC_LIST_NEXT(var2)) -+ -+#define DWC_LIST_FOREACH_REVERSE(var, list) \ -+ for((var) = DWC_LIST_LAST(list); \ -+ (var) != DWC_LIST_END(list); \ -+ (var) = DWC_LIST_PREV(var)) -+ -+/* -+ * Singly-linked List definitions. -+ */ -+#define DWC_SLIST_HEAD(name, type) \ -+struct name { \ -+ struct type *slh_first; /* first element */ \ -+} -+ -+#define DWC_SLIST_HEAD_INITIALIZER(head) \ -+ { NULL } -+ -+#define DWC_SLIST_ENTRY(type) \ -+struct { \ -+ struct type *sle_next; /* next element */ \ -+} -+ -+/* -+ * Singly-linked List access methods. -+ */ -+#define DWC_SLIST_FIRST(head) ((head)->slh_first) -+#define DWC_SLIST_END(head) NULL -+#define DWC_SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) -+#define DWC_SLIST_NEXT(elm, field) ((elm)->field.sle_next) -+ -+#define DWC_SLIST_FOREACH(var, head, field) \ -+ for((var) = SLIST_FIRST(head); \ -+ (var) != SLIST_END(head); \ -+ (var) = SLIST_NEXT(var, field)) -+ -+#define DWC_SLIST_FOREACH_PREVPTR(var, varp, head, field) \ -+ for((varp) = &SLIST_FIRST((head)); \ -+ ((var) = *(varp)) != SLIST_END(head); \ -+ (varp) = &SLIST_NEXT((var), field)) -+ -+/* -+ * Singly-linked List functions. -+ */ -+#define DWC_SLIST_INIT(head) { \ -+ SLIST_FIRST(head) = SLIST_END(head); \ -+} -+ -+#define DWC_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ -+ (elm)->field.sle_next = (slistelm)->field.sle_next; \ -+ (slistelm)->field.sle_next = (elm); \ -+} while (0) -+ -+#define DWC_SLIST_INSERT_HEAD(head, elm, field) do { \ -+ (elm)->field.sle_next = (head)->slh_first; \ -+ (head)->slh_first = (elm); \ -+} while (0) -+ -+#define DWC_SLIST_REMOVE_NEXT(head, elm, field) do { \ -+ (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ -+} while (0) -+ -+#define DWC_SLIST_REMOVE_HEAD(head, field) do { \ -+ (head)->slh_first = (head)->slh_first->field.sle_next; \ -+} while (0) -+ -+#define DWC_SLIST_REMOVE(head, elm, type, field) do { \ -+ if ((head)->slh_first == (elm)) { \ -+ SLIST_REMOVE_HEAD((head), field); \ -+ } \ -+ else { \ -+ struct type *curelm = (head)->slh_first; \ -+ while( curelm->field.sle_next != (elm) ) \ -+ curelm = curelm->field.sle_next; \ -+ curelm->field.sle_next = \ -+ curelm->field.sle_next->field.sle_next; \ -+ } \ -+} while (0) -+ -+/* -+ * Simple queue definitions. -+ */ -+#define DWC_SIMPLEQ_HEAD(name, type) \ -+struct name { \ -+ struct type *sqh_first; /* first element */ \ -+ struct type **sqh_last; /* addr of last next element */ \ -+} -+ -+#define DWC_SIMPLEQ_HEAD_INITIALIZER(head) \ -+ { NULL, &(head).sqh_first } -+ -+#define DWC_SIMPLEQ_ENTRY(type) \ -+struct { \ -+ struct type *sqe_next; /* next element */ \ -+} -+ -+/* -+ * Simple queue access methods. -+ */ -+#define DWC_SIMPLEQ_FIRST(head) ((head)->sqh_first) -+#define DWC_SIMPLEQ_END(head) NULL -+#define DWC_SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) -+#define DWC_SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) -+ -+#define DWC_SIMPLEQ_FOREACH(var, head, field) \ -+ for((var) = SIMPLEQ_FIRST(head); \ -+ (var) != SIMPLEQ_END(head); \ -+ (var) = SIMPLEQ_NEXT(var, field)) -+ -+/* -+ * Simple queue functions. -+ */ -+#define DWC_SIMPLEQ_INIT(head) do { \ -+ (head)->sqh_first = NULL; \ -+ (head)->sqh_last = &(head)->sqh_first; \ -+} while (0) -+ -+#define DWC_SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ -+ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ -+ (head)->sqh_last = &(elm)->field.sqe_next; \ -+ (head)->sqh_first = (elm); \ -+} while (0) -+ -+#define DWC_SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ -+ (elm)->field.sqe_next = NULL; \ -+ *(head)->sqh_last = (elm); \ -+ (head)->sqh_last = &(elm)->field.sqe_next; \ -+} while (0) -+ -+#define DWC_SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ -+ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ -+ (head)->sqh_last = &(elm)->field.sqe_next; \ -+ (listelm)->field.sqe_next = (elm); \ -+} while (0) -+ -+#define DWC_SIMPLEQ_REMOVE_HEAD(head, field) do { \ -+ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ -+ (head)->sqh_last = &(head)->sqh_first; \ -+} while (0) -+ -+/* -+ * Tail queue definitions. -+ */ -+#define DWC_TAILQ_HEAD(name, type) \ -+struct name { \ -+ struct type *tqh_first; /* first element */ \ -+ struct type **tqh_last; /* addr of last next element */ \ -+} -+ -+#define DWC_TAILQ_HEAD_INITIALIZER(head) \ -+ { NULL, &(head).tqh_first } -+ -+#define DWC_TAILQ_ENTRY(type) \ -+struct { \ -+ struct type *tqe_next; /* next element */ \ -+ struct type **tqe_prev; /* address of previous next element */ \ -+} -+ -+/* -+ * tail queue access methods -+ */ -+#define DWC_TAILQ_FIRST(head) ((head)->tqh_first) -+#define DWC_TAILQ_END(head) NULL -+#define DWC_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -+#define DWC_TAILQ_LAST(head, headname) \ -+ (*(((struct headname *)((head)->tqh_last))->tqh_last)) -+/* XXX */ -+#define DWC_TAILQ_PREV(elm, headname, field) \ -+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -+#define DWC_TAILQ_EMPTY(head) \ -+ (DWC_TAILQ_FIRST(head) == DWC_TAILQ_END(head)) -+ -+#define DWC_TAILQ_FOREACH(var, head, field) \ -+ for ((var) = DWC_TAILQ_FIRST(head); \ -+ (var) != DWC_TAILQ_END(head); \ -+ (var) = DWC_TAILQ_NEXT(var, field)) -+ -+#define DWC_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ -+ for ((var) = DWC_TAILQ_LAST(head, headname); \ -+ (var) != DWC_TAILQ_END(head); \ -+ (var) = DWC_TAILQ_PREV(var, headname, field)) -+ -+/* -+ * Tail queue functions. -+ */ -+#define DWC_TAILQ_INIT(head) do { \ -+ (head)->tqh_first = NULL; \ -+ (head)->tqh_last = &(head)->tqh_first; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_HEAD(head, elm, field) do { \ -+ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ -+ (head)->tqh_first->field.tqe_prev = \ -+ &(elm)->field.tqe_next; \ -+ else \ -+ (head)->tqh_last = &(elm)->field.tqe_next; \ -+ (head)->tqh_first = (elm); \ -+ (elm)->field.tqe_prev = &(head)->tqh_first; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_TAIL(head, elm, field) do { \ -+ (elm)->field.tqe_next = NULL; \ -+ (elm)->field.tqe_prev = (head)->tqh_last; \ -+ *(head)->tqh_last = (elm); \ -+ (head)->tqh_last = &(elm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ -+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ -+ (elm)->field.tqe_next->field.tqe_prev = \ -+ &(elm)->field.tqe_next; \ -+ else \ -+ (head)->tqh_last = &(elm)->field.tqe_next; \ -+ (listelm)->field.tqe_next = (elm); \ -+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ -+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ -+ (elm)->field.tqe_next = (listelm); \ -+ *(listelm)->field.tqe_prev = (elm); \ -+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_REMOVE(head, elm, field) do { \ -+ if (((elm)->field.tqe_next) != NULL) \ -+ (elm)->field.tqe_next->field.tqe_prev = \ -+ (elm)->field.tqe_prev; \ -+ else \ -+ (head)->tqh_last = (elm)->field.tqe_prev; \ -+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -+} while (0) -+ -+#define DWC_TAILQ_REPLACE(head, elm, elm2, field) do { \ -+ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ -+ (elm2)->field.tqe_next->field.tqe_prev = \ -+ &(elm2)->field.tqe_next; \ -+ else \ -+ (head)->tqh_last = &(elm2)->field.tqe_next; \ -+ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ -+ *(elm2)->field.tqe_prev = (elm2); \ -+} while (0) -+ -+/* -+ * Circular queue definitions. -+ */ -+#define DWC_CIRCLEQ_HEAD(name, type) \ -+struct name { \ -+ struct type *cqh_first; /* first element */ \ -+ struct type *cqh_last; /* last element */ \ -+} -+ -+#define DWC_CIRCLEQ_HEAD_INITIALIZER(head) \ -+ { DWC_CIRCLEQ_END(&head), DWC_CIRCLEQ_END(&head) } -+ -+#define DWC_CIRCLEQ_ENTRY(type) \ -+struct { \ -+ struct type *cqe_next; /* next element */ \ -+ struct type *cqe_prev; /* previous element */ \ -+} -+ -+/* -+ * Circular queue access methods -+ */ -+#define DWC_CIRCLEQ_FIRST(head) ((head)->cqh_first) -+#define DWC_CIRCLEQ_LAST(head) ((head)->cqh_last) -+#define DWC_CIRCLEQ_END(head) ((void *)(head)) -+#define DWC_CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -+#define DWC_CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) -+#define DWC_CIRCLEQ_EMPTY(head) \ -+ (DWC_CIRCLEQ_FIRST(head) == DWC_CIRCLEQ_END(head)) -+ -+#define DWC_CIRCLEQ_EMPTY_ENTRY(elm, field) (((elm)->field.cqe_next == NULL) && ((elm)->field.cqe_prev == NULL)) -+ -+#define DWC_CIRCLEQ_FOREACH(var, head, field) \ -+ for((var) = DWC_CIRCLEQ_FIRST(head); \ -+ (var) != DWC_CIRCLEQ_END(head); \ -+ (var) = DWC_CIRCLEQ_NEXT(var, field)) -+ -+#define DWC_CIRCLEQ_FOREACH_SAFE(var, var2, head, field) \ -+ for((var) = DWC_CIRCLEQ_FIRST(head), var2 = DWC_CIRCLEQ_NEXT(var, field); \ -+ (var) != DWC_CIRCLEQ_END(head); \ -+ (var) = var2, var2 = DWC_CIRCLEQ_NEXT(var, field)) -+ -+#define DWC_CIRCLEQ_FOREACH_REVERSE(var, head, field) \ -+ for((var) = DWC_CIRCLEQ_LAST(head); \ -+ (var) != DWC_CIRCLEQ_END(head); \ -+ (var) = DWC_CIRCLEQ_PREV(var, field)) -+ -+/* -+ * Circular queue functions. -+ */ -+#define DWC_CIRCLEQ_INIT(head) do { \ -+ (head)->cqh_first = DWC_CIRCLEQ_END(head); \ -+ (head)->cqh_last = DWC_CIRCLEQ_END(head); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INIT_ENTRY(elm, field) do { \ -+ (elm)->field.cqe_next = NULL; \ -+ (elm)->field.cqe_prev = NULL; \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ -+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ -+ (elm)->field.cqe_prev = (listelm); \ -+ if ((listelm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_last = (elm); \ -+ else \ -+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ -+ (listelm)->field.cqe_next = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ -+ (elm)->field.cqe_next = (listelm); \ -+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ -+ if ((listelm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_first = (elm); \ -+ else \ -+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ -+ (listelm)->field.cqe_prev = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ -+ (elm)->field.cqe_next = (head)->cqh_first; \ -+ (elm)->field.cqe_prev = DWC_CIRCLEQ_END(head); \ -+ if ((head)->cqh_last == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_last = (elm); \ -+ else \ -+ (head)->cqh_first->field.cqe_prev = (elm); \ -+ (head)->cqh_first = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ -+ (elm)->field.cqe_next = DWC_CIRCLEQ_END(head); \ -+ (elm)->field.cqe_prev = (head)->cqh_last; \ -+ if ((head)->cqh_first == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_first = (elm); \ -+ else \ -+ (head)->cqh_last->field.cqe_next = (elm); \ -+ (head)->cqh_last = (elm); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_REMOVE(head, elm, field) do { \ -+ if ((elm)->field.cqe_next == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_last = (elm)->field.cqe_prev; \ -+ else \ -+ (elm)->field.cqe_next->field.cqe_prev = \ -+ (elm)->field.cqe_prev; \ -+ if ((elm)->field.cqe_prev == DWC_CIRCLEQ_END(head)) \ -+ (head)->cqh_first = (elm)->field.cqe_next; \ -+ else \ -+ (elm)->field.cqe_prev->field.cqe_next = \ -+ (elm)->field.cqe_next; \ -+} while (0) -+ -+#define DWC_CIRCLEQ_REMOVE_INIT(head, elm, field) do { \ -+ DWC_CIRCLEQ_REMOVE(head, elm, field); \ -+ DWC_CIRCLEQ_INIT_ENTRY(elm, field); \ -+} while (0) -+ -+#define DWC_CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ -+ if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \ -+ DWC_CIRCLEQ_END(head)) \ -+ (head).cqh_last = (elm2); \ -+ else \ -+ (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ -+ if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \ -+ DWC_CIRCLEQ_END(head)) \ -+ (head).cqh_first = (elm2); \ -+ else \ -+ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ -+} while (0) -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_LIST_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_mem.c b/drivers/usb/host/dwc_common_port/dwc_mem.c -new file mode 100644 -index 0000000000000000000000000000000000000000..ad645ff1ba7e06c852440396767e69279b3b31db ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_mem.c -@@ -0,0 +1,245 @@ -+/* Memory Debugging */ -+#ifdef DWC_DEBUG_MEMORY -+ -+#include "dwc_os.h" -+#include "dwc_list.h" -+ -+struct allocation { -+ void *addr; -+ void *ctx; -+ char *func; -+ int line; -+ uint32_t size; -+ int dma; -+ DWC_CIRCLEQ_ENTRY(allocation) entry; -+}; -+ -+DWC_CIRCLEQ_HEAD(allocation_queue, allocation); -+ -+struct allocation_manager { -+ void *mem_ctx; -+ struct allocation_queue allocations; -+ -+ /* statistics */ -+ int num; -+ int num_freed; -+ int num_active; -+ uint32_t total; -+ uint32_t cur; -+ uint32_t max; -+}; -+ -+static struct allocation_manager *manager = NULL; -+ -+static int add_allocation(void *ctx, uint32_t size, char const *func, int line, void *addr, -+ int dma) -+{ -+ struct allocation *a; -+ -+ DWC_ASSERT(manager != NULL, "manager not allocated"); -+ -+ a = __DWC_ALLOC_ATOMIC(manager->mem_ctx, sizeof(*a)); -+ if (!a) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ a->func = __DWC_ALLOC_ATOMIC(manager->mem_ctx, DWC_STRLEN(func) + 1); -+ if (!a->func) { -+ __DWC_FREE(manager->mem_ctx, a); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_MEMCPY(a->func, func, DWC_STRLEN(func) + 1); -+ a->addr = addr; -+ a->ctx = ctx; -+ a->line = line; -+ a->size = size; -+ a->dma = dma; -+ DWC_CIRCLEQ_INSERT_TAIL(&manager->allocations, a, entry); -+ -+ /* Update stats */ -+ manager->num++; -+ manager->num_active++; -+ manager->total += size; -+ manager->cur += size; -+ -+ if (manager->max < manager->cur) { -+ manager->max = manager->cur; -+ } -+ -+ return 0; -+} -+ -+static struct allocation *find_allocation(void *ctx, void *addr) -+{ -+ struct allocation *a; -+ -+ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { -+ if (a->ctx == ctx && a->addr == addr) { -+ return a; -+ } -+ } -+ -+ return NULL; -+} -+ -+static void free_allocation(void *ctx, void *addr, char const *func, int line) -+{ -+ struct allocation *a = find_allocation(ctx, addr); -+ -+ if (!a) { -+ DWC_ASSERT(0, -+ "Free of address %p that was never allocated or already freed %s:%d", -+ addr, func, line); -+ return; -+ } -+ -+ DWC_CIRCLEQ_REMOVE(&manager->allocations, a, entry); -+ -+ manager->num_active--; -+ manager->num_freed++; -+ manager->cur -= a->size; -+ __DWC_FREE(manager->mem_ctx, a->func); -+ __DWC_FREE(manager->mem_ctx, a); -+} -+ -+int dwc_memory_debug_start(void *mem_ctx) -+{ -+ DWC_ASSERT(manager == NULL, "Memory debugging has already started\n"); -+ -+ if (manager) { -+ return -DWC_E_BUSY; -+ } -+ -+ manager = __DWC_ALLOC(mem_ctx, sizeof(*manager)); -+ if (!manager) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_CIRCLEQ_INIT(&manager->allocations); -+ manager->mem_ctx = mem_ctx; -+ manager->num = 0; -+ manager->num_freed = 0; -+ manager->num_active = 0; -+ manager->total = 0; -+ manager->cur = 0; -+ manager->max = 0; -+ -+ return 0; -+} -+ -+void dwc_memory_debug_stop(void) -+{ -+ struct allocation *a; -+ -+ dwc_memory_debug_report(); -+ -+ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { -+ DWC_ERROR("Memory leaked from %s:%d\n", a->func, a->line); -+ free_allocation(a->ctx, a->addr, NULL, -1); -+ } -+ -+ __DWC_FREE(manager->mem_ctx, manager); -+} -+ -+void dwc_memory_debug_report(void) -+{ -+ struct allocation *a; -+ -+ DWC_PRINTF("\n\n\n----------------- Memory Debugging Report -----------------\n\n"); -+ DWC_PRINTF("Num Allocations = %d\n", manager->num); -+ DWC_PRINTF("Freed = %d\n", manager->num_freed); -+ DWC_PRINTF("Active = %d\n", manager->num_active); -+ DWC_PRINTF("Current Memory Used = %d\n", manager->cur); -+ DWC_PRINTF("Total Memory Used = %d\n", manager->total); -+ DWC_PRINTF("Maximum Memory Used at Once = %d\n", manager->max); -+ DWC_PRINTF("Unfreed allocations:\n"); -+ -+ DWC_CIRCLEQ_FOREACH(a, &manager->allocations, entry) { -+ DWC_PRINTF(" addr=%p, size=%d from %s:%d, DMA=%d\n", -+ a->addr, a->size, a->func, a->line, a->dma); -+ } -+} -+ -+/* The replacement functions */ -+void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line) -+{ -+ void *addr = __DWC_ALLOC(mem_ctx, size); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { -+ __DWC_FREE(mem_ctx, addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, -+ int line) -+{ -+ void *addr = __DWC_ALLOC_ATOMIC(mem_ctx, size); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(mem_ctx, size, func, line, addr, 0)) { -+ __DWC_FREE(mem_ctx, addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line) -+{ -+ free_allocation(mem_ctx, addr, func, line); -+ __DWC_FREE(mem_ctx, addr); -+} -+ -+void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, -+ char const *func, int line) -+{ -+ void *addr = __DWC_DMA_ALLOC(dma_ctx, size, dma_addr); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { -+ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, -+ dwc_dma_t *dma_addr, char const *func, int line) -+{ -+ void *addr = __DWC_DMA_ALLOC_ATOMIC(dma_ctx, size, dma_addr); -+ -+ if (!addr) { -+ return NULL; -+ } -+ -+ if (add_allocation(dma_ctx, size, func, line, addr, 1)) { -+ __DWC_DMA_FREE(dma_ctx, size, addr, *dma_addr); -+ return NULL; -+ } -+ -+ return addr; -+} -+ -+void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, -+ dwc_dma_t dma_addr, char const *func, int line) -+{ -+ free_allocation(dma_ctx, virt_addr, func, line); -+ __DWC_DMA_FREE(dma_ctx, size, virt_addr, dma_addr); -+} -+ -+#endif /* DWC_DEBUG_MEMORY */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.c b/drivers/usb/host/dwc_common_port/dwc_modpow.c -new file mode 100644 -index 0000000000000000000000000000000000000000..20045381208a31d5dfb420318b0a4fbb1eca51a1 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_modpow.c -@@ -0,0 +1,636 @@ -+/* Bignum routines adapted from PUTTY sources. PuTTY copyright notice follows. -+ * -+ * PuTTY is copyright 1997-2007 Simon Tatham. -+ * -+ * Portions copyright Robert de Bath, Joris van Rantwijk, Delian -+ * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, -+ * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus -+ * Kuhn, and CORE SDI S.A. -+ * -+ * 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 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. -+ * -+ */ -+#ifdef DWC_CRYPTOLIB -+ -+#ifndef CONFIG_MACH_IPMATE -+ -+#include "dwc_modpow.h" -+ -+#define BIGNUM_INT_MASK 0xFFFFFFFFUL -+#define BIGNUM_TOP_BIT 0x80000000UL -+#define BIGNUM_INT_BITS 32 -+ -+ -+static void *snmalloc(void *mem_ctx, size_t n, size_t size) -+{ -+ void *p; -+ size *= n; -+ if (size == 0) size = 1; -+ p = dwc_alloc(mem_ctx, size); -+ return p; -+} -+ -+#define snewn(ctx, n, type) ((type *)snmalloc((ctx), (n), sizeof(type))) -+#define sfree dwc_free -+ -+/* -+ * Usage notes: -+ * * Do not call the DIVMOD_WORD macro with expressions such as array -+ * subscripts, as some implementations object to this (see below). -+ * * Note that none of the division methods below will cope if the -+ * quotient won't fit into BIGNUM_INT_BITS. Callers should be careful -+ * to avoid this case. -+ * If this condition occurs, in the case of the x86 DIV instruction, -+ * an overflow exception will occur, which (according to a correspondent) -+ * will manifest on Windows as something like -+ * 0xC0000095: Integer overflow -+ * The C variant won't give the right answer, either. -+ */ -+ -+#define MUL_WORD(w1, w2) ((BignumDblInt)w1 * w2) -+ -+#if defined __GNUC__ && defined __i386__ -+#define DIVMOD_WORD(q, r, hi, lo, w) \ -+ __asm__("div %2" : \ -+ "=d" (r), "=a" (q) : \ -+ "r" (w), "d" (hi), "a" (lo)) -+#else -+#define DIVMOD_WORD(q, r, hi, lo, w) do { \ -+ BignumDblInt n = (((BignumDblInt)hi) << BIGNUM_INT_BITS) | lo; \ -+ q = n / w; \ -+ r = n % w; \ -+} while (0) -+#endif -+ -+// q = n / w; -+// r = n % w; -+ -+#define BIGNUM_INT_BYTES (BIGNUM_INT_BITS / 8) -+ -+#define BIGNUM_INTERNAL -+ -+static Bignum newbn(void *mem_ctx, int length) -+{ -+ Bignum b = snewn(mem_ctx, length + 1, BignumInt); -+ //if (!b) -+ //abort(); /* FIXME */ -+ DWC_MEMSET(b, 0, (length + 1) * sizeof(*b)); -+ b[0] = length; -+ return b; -+} -+ -+void freebn(void *mem_ctx, Bignum b) -+{ -+ /* -+ * Burn the evidence, just in case. -+ */ -+ DWC_MEMSET(b, 0, sizeof(b[0]) * (b[0] + 1)); -+ sfree(mem_ctx, b); -+} -+ -+/* -+ * Compute c = a * b. -+ * Input is in the first len words of a and b. -+ * Result is returned in the first 2*len words of c. -+ */ -+static void internal_mul(BignumInt *a, BignumInt *b, -+ BignumInt *c, int len) -+{ -+ int i, j; -+ BignumDblInt t; -+ -+ for (j = 0; j < 2 * len; j++) -+ c[j] = 0; -+ -+ for (i = len - 1; i >= 0; i--) { -+ t = 0; -+ for (j = len - 1; j >= 0; j--) { -+ t += MUL_WORD(a[i], (BignumDblInt) b[j]); -+ t += (BignumDblInt) c[i + j + 1]; -+ c[i + j + 1] = (BignumInt) t; -+ t = t >> BIGNUM_INT_BITS; -+ } -+ c[i] = (BignumInt) t; -+ } -+} -+ -+static void internal_add_shifted(BignumInt *number, -+ unsigned n, int shift) -+{ -+ int word = 1 + (shift / BIGNUM_INT_BITS); -+ int bshift = shift % BIGNUM_INT_BITS; -+ BignumDblInt addend; -+ -+ addend = (BignumDblInt)n << bshift; -+ -+ while (addend) { -+ addend += number[word]; -+ number[word] = (BignumInt) addend & BIGNUM_INT_MASK; -+ addend >>= BIGNUM_INT_BITS; -+ word++; -+ } -+} -+ -+/* -+ * Compute a = a % m. -+ * Input in first alen words of a and first mlen words of m. -+ * Output in first alen words of a -+ * (of which first alen-mlen words will be zero). -+ * The MSW of m MUST have its high bit set. -+ * Quotient is accumulated in the `quotient' array, which is a Bignum -+ * rather than the internal bigendian format. Quotient parts are shifted -+ * left by `qshift' before adding into quot. -+ */ -+static void internal_mod(BignumInt *a, int alen, -+ BignumInt *m, int mlen, -+ BignumInt *quot, int qshift) -+{ -+ BignumInt m0, m1; -+ unsigned int h; -+ int i, k; -+ -+ m0 = m[0]; -+ if (mlen > 1) -+ m1 = m[1]; -+ else -+ m1 = 0; -+ -+ for (i = 0; i <= alen - mlen; i++) { -+ BignumDblInt t; -+ unsigned int q, r, c, ai1; -+ -+ if (i == 0) { -+ h = 0; -+ } else { -+ h = a[i - 1]; -+ a[i - 1] = 0; -+ } -+ -+ if (i == alen - 1) -+ ai1 = 0; -+ else -+ ai1 = a[i + 1]; -+ -+ /* Find q = h:a[i] / m0 */ -+ if (h >= m0) { -+ /* -+ * Special case. -+ * -+ * To illustrate it, suppose a BignumInt is 8 bits, and -+ * we are dividing (say) A1:23:45:67 by A1:B2:C3. Then -+ * our initial division will be 0xA123 / 0xA1, which -+ * will give a quotient of 0x100 and a divide overflow. -+ * However, the invariants in this division algorithm -+ * are not violated, since the full number A1:23:... is -+ * _less_ than the quotient prefix A1:B2:... and so the -+ * following correction loop would have sorted it out. -+ * -+ * In this situation we set q to be the largest -+ * quotient we _can_ stomach (0xFF, of course). -+ */ -+ q = BIGNUM_INT_MASK; -+ } else { -+ /* Macro doesn't want an array subscript expression passed -+ * into it (see definition), so use a temporary. */ -+ BignumInt tmplo = a[i]; -+ DIVMOD_WORD(q, r, h, tmplo, m0); -+ -+ /* Refine our estimate of q by looking at -+ h:a[i]:a[i+1] / m0:m1 */ -+ t = MUL_WORD(m1, q); -+ if (t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) { -+ q--; -+ t -= m1; -+ r = (r + m0) & BIGNUM_INT_MASK; /* overflow? */ -+ if (r >= (BignumDblInt) m0 && -+ t > ((BignumDblInt) r << BIGNUM_INT_BITS) + ai1) q--; -+ } -+ } -+ -+ /* Subtract q * m from a[i...] */ -+ c = 0; -+ for (k = mlen - 1; k >= 0; k--) { -+ t = MUL_WORD(q, m[k]); -+ t += c; -+ c = (unsigned)(t >> BIGNUM_INT_BITS); -+ if ((BignumInt) t > a[i + k]) -+ c++; -+ a[i + k] -= (BignumInt) t; -+ } -+ -+ /* Add back m in case of borrow */ -+ if (c != h) { -+ t = 0; -+ for (k = mlen - 1; k >= 0; k--) { -+ t += m[k]; -+ t += a[i + k]; -+ a[i + k] = (BignumInt) t; -+ t = t >> BIGNUM_INT_BITS; -+ } -+ q--; -+ } -+ if (quot) -+ internal_add_shifted(quot, q, qshift + BIGNUM_INT_BITS * (alen - mlen - i)); -+ } -+} -+ -+/* -+ * Compute p % mod. -+ * The most significant word of mod MUST be non-zero. -+ * We assume that the result array is the same size as the mod array. -+ * We optionally write out a quotient if `quotient' is non-NULL. -+ * We can avoid writing out the result if `result' is NULL. -+ */ -+void bigdivmod(void *mem_ctx, Bignum p, Bignum mod, Bignum result, Bignum quotient) -+{ -+ BignumInt *n, *m; -+ int mshift; -+ int plen, mlen, i, j; -+ -+ /* Allocate m of size mlen, copy mod to m */ -+ /* We use big endian internally */ -+ mlen = mod[0]; -+ m = snewn(mem_ctx, mlen, BignumInt); -+ //if (!m) -+ //abort(); /* FIXME */ -+ for (j = 0; j < mlen; j++) -+ m[j] = mod[mod[0] - j]; -+ -+ /* Shift m left to make msb bit set */ -+ for (mshift = 0; mshift < BIGNUM_INT_BITS-1; mshift++) -+ if ((m[0] << mshift) & BIGNUM_TOP_BIT) -+ break; -+ if (mshift) { -+ for (i = 0; i < mlen - 1; i++) -+ m[i] = (m[i] << mshift) | (m[i + 1] >> (BIGNUM_INT_BITS - mshift)); -+ m[mlen - 1] = m[mlen - 1] << mshift; -+ } -+ -+ plen = p[0]; -+ /* Ensure plen > mlen */ -+ if (plen <= mlen) -+ plen = mlen + 1; -+ -+ /* Allocate n of size plen, copy p to n */ -+ n = snewn(mem_ctx, plen, BignumInt); -+ //if (!n) -+ //abort(); /* FIXME */ -+ for (j = 0; j < plen; j++) -+ n[j] = 0; -+ for (j = 1; j <= (int)p[0]; j++) -+ n[plen - j] = p[j]; -+ -+ /* Main computation */ -+ internal_mod(n, plen, m, mlen, quotient, mshift); -+ -+ /* Fixup result in case the modulus was shifted */ -+ if (mshift) { -+ for (i = plen - mlen - 1; i < plen - 1; i++) -+ n[i] = (n[i] << mshift) | (n[i + 1] >> (BIGNUM_INT_BITS - mshift)); -+ n[plen - 1] = n[plen - 1] << mshift; -+ internal_mod(n, plen, m, mlen, quotient, 0); -+ for (i = plen - 1; i >= plen - mlen; i--) -+ n[i] = (n[i] >> mshift) | (n[i - 1] << (BIGNUM_INT_BITS - mshift)); -+ } -+ -+ /* Copy result to buffer */ -+ if (result) { -+ for (i = 1; i <= (int)result[0]; i++) { -+ int j = plen - i; -+ result[i] = j >= 0 ? n[j] : 0; -+ } -+ } -+ -+ /* Free temporary arrays */ -+ for (i = 0; i < mlen; i++) -+ m[i] = 0; -+ sfree(mem_ctx, m); -+ for (i = 0; i < plen; i++) -+ n[i] = 0; -+ sfree(mem_ctx, n); -+} -+ -+/* -+ * Simple remainder. -+ */ -+Bignum bigmod(void *mem_ctx, Bignum a, Bignum b) -+{ -+ Bignum r = newbn(mem_ctx, b[0]); -+ bigdivmod(mem_ctx, a, b, r, NULL); -+ return r; -+} -+ -+/* -+ * Compute (base ^ exp) % mod. -+ */ -+Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod) -+{ -+ BignumInt *a, *b, *n, *m; -+ int mshift; -+ int mlen, i, j; -+ Bignum base, result; -+ -+ /* -+ * The most significant word of mod needs to be non-zero. It -+ * should already be, but let's make sure. -+ */ -+ //assert(mod[mod[0]] != 0); -+ -+ /* -+ * Make sure the base is smaller than the modulus, by reducing -+ * it modulo the modulus if not. -+ */ -+ base = bigmod(mem_ctx, base_in, mod); -+ -+ /* Allocate m of size mlen, copy mod to m */ -+ /* We use big endian internally */ -+ mlen = mod[0]; -+ m = snewn(mem_ctx, mlen, BignumInt); -+ //if (!m) -+ //abort(); /* FIXME */ -+ for (j = 0; j < mlen; j++) -+ m[j] = mod[mod[0] - j]; -+ -+ /* Shift m left to make msb bit set */ -+ for (mshift = 0; mshift < BIGNUM_INT_BITS - 1; mshift++) -+ if ((m[0] << mshift) & BIGNUM_TOP_BIT) -+ break; -+ if (mshift) { -+ for (i = 0; i < mlen - 1; i++) -+ m[i] = -+ (m[i] << mshift) | (m[i + 1] >> -+ (BIGNUM_INT_BITS - mshift)); -+ m[mlen - 1] = m[mlen - 1] << mshift; -+ } -+ -+ /* Allocate n of size mlen, copy base to n */ -+ n = snewn(mem_ctx, mlen, BignumInt); -+ //if (!n) -+ //abort(); /* FIXME */ -+ i = mlen - base[0]; -+ for (j = 0; j < i; j++) -+ n[j] = 0; -+ for (j = 0; j < base[0]; j++) -+ n[i + j] = base[base[0] - j]; -+ -+ /* Allocate a and b of size 2*mlen. Set a = 1 */ -+ a = snewn(mem_ctx, 2 * mlen, BignumInt); -+ //if (!a) -+ //abort(); /* FIXME */ -+ b = snewn(mem_ctx, 2 * mlen, BignumInt); -+ //if (!b) -+ //abort(); /* FIXME */ -+ for (i = 0; i < 2 * mlen; i++) -+ a[i] = 0; -+ a[2 * mlen - 1] = 1; -+ -+ /* Skip leading zero bits of exp. */ -+ i = 0; -+ j = BIGNUM_INT_BITS - 1; -+ while (i < exp[0] && (exp[exp[0] - i] & (1 << j)) == 0) { -+ j--; -+ if (j < 0) { -+ i++; -+ j = BIGNUM_INT_BITS - 1; -+ } -+ } -+ -+ /* Main computation */ -+ while (i < exp[0]) { -+ while (j >= 0) { -+ internal_mul(a + mlen, a + mlen, b, mlen); -+ internal_mod(b, mlen * 2, m, mlen, NULL, 0); -+ if ((exp[exp[0] - i] & (1 << j)) != 0) { -+ internal_mul(b + mlen, n, a, mlen); -+ internal_mod(a, mlen * 2, m, mlen, NULL, 0); -+ } else { -+ BignumInt *t; -+ t = a; -+ a = b; -+ b = t; -+ } -+ j--; -+ } -+ i++; -+ j = BIGNUM_INT_BITS - 1; -+ } -+ -+ /* Fixup result in case the modulus was shifted */ -+ if (mshift) { -+ for (i = mlen - 1; i < 2 * mlen - 1; i++) -+ a[i] = -+ (a[i] << mshift) | (a[i + 1] >> -+ (BIGNUM_INT_BITS - mshift)); -+ a[2 * mlen - 1] = a[2 * mlen - 1] << mshift; -+ internal_mod(a, mlen * 2, m, mlen, NULL, 0); -+ for (i = 2 * mlen - 1; i >= mlen; i--) -+ a[i] = -+ (a[i] >> mshift) | (a[i - 1] << -+ (BIGNUM_INT_BITS - mshift)); -+ } -+ -+ /* Copy result to buffer */ -+ result = newbn(mem_ctx, mod[0]); -+ for (i = 0; i < mlen; i++) -+ result[result[0] - i] = a[i + mlen]; -+ while (result[0] > 1 && result[result[0]] == 0) -+ result[0]--; -+ -+ /* Free temporary arrays */ -+ for (i = 0; i < 2 * mlen; i++) -+ a[i] = 0; -+ sfree(mem_ctx, a); -+ for (i = 0; i < 2 * mlen; i++) -+ b[i] = 0; -+ sfree(mem_ctx, b); -+ for (i = 0; i < mlen; i++) -+ m[i] = 0; -+ sfree(mem_ctx, m); -+ for (i = 0; i < mlen; i++) -+ n[i] = 0; -+ sfree(mem_ctx, n); -+ -+ freebn(mem_ctx, base); -+ -+ return result; -+} -+ -+ -+#ifdef UNITTEST -+ -+static __u32 dh_p[] = { -+ 96, -+ 0xFFFFFFFF, -+ 0xFFFFFFFF, -+ 0xA93AD2CA, -+ 0x4B82D120, -+ 0xE0FD108E, -+ 0x43DB5BFC, -+ 0x74E5AB31, -+ 0x08E24FA0, -+ 0xBAD946E2, -+ 0x770988C0, -+ 0x7A615D6C, -+ 0xBBE11757, -+ 0x177B200C, -+ 0x521F2B18, -+ 0x3EC86A64, -+ 0xD8760273, -+ 0xD98A0864, -+ 0xF12FFA06, -+ 0x1AD2EE6B, -+ 0xCEE3D226, -+ 0x4A25619D, -+ 0x1E8C94E0, -+ 0xDB0933D7, -+ 0xABF5AE8C, -+ 0xA6E1E4C7, -+ 0xB3970F85, -+ 0x5D060C7D, -+ 0x8AEA7157, -+ 0x58DBEF0A, -+ 0xECFB8504, -+ 0xDF1CBA64, -+ 0xA85521AB, -+ 0x04507A33, -+ 0xAD33170D, -+ 0x8AAAC42D, -+ 0x15728E5A, -+ 0x98FA0510, -+ 0x15D22618, -+ 0xEA956AE5, -+ 0x3995497C, -+ 0x95581718, -+ 0xDE2BCBF6, -+ 0x6F4C52C9, -+ 0xB5C55DF0, -+ 0xEC07A28F, -+ 0x9B2783A2, -+ 0x180E8603, -+ 0xE39E772C, -+ 0x2E36CE3B, -+ 0x32905E46, -+ 0xCA18217C, -+ 0xF1746C08, -+ 0x4ABC9804, -+ 0x670C354E, -+ 0x7096966D, -+ 0x9ED52907, -+ 0x208552BB, -+ 0x1C62F356, -+ 0xDCA3AD96, -+ 0x83655D23, -+ 0xFD24CF5F, -+ 0x69163FA8, -+ 0x1C55D39A, -+ 0x98DA4836, -+ 0xA163BF05, -+ 0xC2007CB8, -+ 0xECE45B3D, -+ 0x49286651, -+ 0x7C4B1FE6, -+ 0xAE9F2411, -+ 0x5A899FA5, -+ 0xEE386BFB, -+ 0xF406B7ED, -+ 0x0BFF5CB6, -+ 0xA637ED6B, -+ 0xF44C42E9, -+ 0x625E7EC6, -+ 0xE485B576, -+ 0x6D51C245, -+ 0x4FE1356D, -+ 0xF25F1437, -+ 0x302B0A6D, -+ 0xCD3A431B, -+ 0xEF9519B3, -+ 0x8E3404DD, -+ 0x514A0879, -+ 0x3B139B22, -+ 0x020BBEA6, -+ 0x8A67CC74, -+ 0x29024E08, -+ 0x80DC1CD1, -+ 0xC4C6628B, -+ 0x2168C234, -+ 0xC90FDAA2, -+ 0xFFFFFFFF, -+ 0xFFFFFFFF, -+}; -+ -+static __u32 dh_a[] = { -+ 8, -+ 0xdf367516, -+ 0x86459caa, -+ 0xe2d459a4, -+ 0xd910dae0, -+ 0x8a8b5e37, -+ 0x67ab31c6, -+ 0xf0b55ea9, -+ 0x440051d6, -+}; -+ -+static __u32 dh_b[] = { -+ 8, -+ 0xded92656, -+ 0xe07a048a, -+ 0x6fa452cd, -+ 0x2df89d30, -+ 0xc75f1b0f, -+ 0x8ce3578f, -+ 0x7980a324, -+ 0x5daec786, -+}; -+ -+static __u32 dh_g[] = { -+ 1, -+ 2, -+}; -+ -+int main(void) -+{ -+ int i; -+ __u32 *k; -+ k = dwc_modpow(NULL, dh_g, dh_a, dh_p); -+ -+ printf("\n\n"); -+ for (i=0; i> 16; -+ printf("%04x %04x ", m, l); -+ if (!((i + 1)%13)) printf("\n"); -+ } -+ printf("\n\n"); -+ -+ if ((k[0] == 0x60) && (k[1] == 0x28e490e5) && (k[0x60] == 0x5a0d3d4e)) { -+ printf("PASS\n\n"); -+ } -+ else { -+ printf("FAIL\n\n"); -+ } -+ -+} -+ -+#endif /* UNITTEST */ -+ -+#endif /* CONFIG_MACH_IPMATE */ -+ -+#endif /*DWC_CRYPTOLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_modpow.h b/drivers/usb/host/dwc_common_port/dwc_modpow.h -new file mode 100644 -index 0000000000000000000000000000000000000000..64f00c276e71bf2e1d58bc9e02ff64c13489dbd4 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_modpow.h -@@ -0,0 +1,34 @@ -+/* -+ * dwc_modpow.h -+ * See dwc_modpow.c for license and changes -+ */ -+#ifndef _DWC_MODPOW_H -+#define _DWC_MODPOW_H -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#include "dwc_os.h" -+ -+/** @file -+ * -+ * This file defines the module exponentiation function which is only used -+ * internally by the DWC UWB modules for calculation of PKs during numeric -+ * association. The routine is taken from the PUTTY, an open source terminal -+ * emulator. The PUTTY License is preserved in the dwc_modpow.c file. -+ * -+ */ -+ -+typedef uint32_t BignumInt; -+typedef uint64_t BignumDblInt; -+typedef BignumInt *Bignum; -+ -+/* Compute modular exponentiaion */ -+extern Bignum dwc_modpow(void *mem_ctx, Bignum base_in, Bignum exp, Bignum mod); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _LINUX_BIGNUM_H */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.c b/drivers/usb/host/dwc_common_port/dwc_notifier.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8b3772afe11d1d81bdb7cabe335f0f3bc834fb7a ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_notifier.c -@@ -0,0 +1,319 @@ -+#ifdef DWC_NOTIFYLIB -+ -+#include "dwc_notifier.h" -+#include "dwc_list.h" -+ -+typedef struct dwc_observer { -+ void *observer; -+ dwc_notifier_callback_t callback; -+ void *data; -+ char *notification; -+ DWC_CIRCLEQ_ENTRY(dwc_observer) list_entry; -+} observer_t; -+ -+DWC_CIRCLEQ_HEAD(observer_queue, dwc_observer); -+ -+typedef struct dwc_notifier { -+ void *mem_ctx; -+ void *object; -+ struct observer_queue observers; -+ DWC_CIRCLEQ_ENTRY(dwc_notifier) list_entry; -+} notifier_t; -+ -+DWC_CIRCLEQ_HEAD(notifier_queue, dwc_notifier); -+ -+typedef struct manager { -+ void *mem_ctx; -+ void *wkq_ctx; -+ dwc_workq_t *wq; -+// dwc_mutex_t *mutex; -+ struct notifier_queue notifiers; -+} manager_t; -+ -+static manager_t *manager = NULL; -+ -+static int create_manager(void *mem_ctx, void *wkq_ctx) -+{ -+ manager = dwc_alloc(mem_ctx, sizeof(manager_t)); -+ if (!manager) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_CIRCLEQ_INIT(&manager->notifiers); -+ -+ manager->wq = dwc_workq_alloc(wkq_ctx, "DWC Notification WorkQ"); -+ if (!manager->wq) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ return 0; -+} -+ -+static void free_manager(void) -+{ -+ dwc_workq_free(manager->wq); -+ -+ /* All notifiers must have unregistered themselves before this module -+ * can be removed. Hitting this assertion indicates a programmer -+ * error. */ -+ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(&manager->notifiers), -+ "Notification manager being freed before all notifiers have been removed"); -+ dwc_free(manager->mem_ctx, manager); -+} -+ -+#ifdef DEBUG -+static void dump_manager(void) -+{ -+ notifier_t *n; -+ observer_t *o; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ DWC_DEBUG("List of all notifiers and observers:\n"); -+ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { -+ DWC_DEBUG("Notifier %p has observers:\n", n->object); -+ DWC_CIRCLEQ_FOREACH(o, &n->observers, list_entry) { -+ DWC_DEBUG(" %p watching %s\n", o->observer, o->notification); -+ } -+ } -+} -+#else -+#define dump_manager(...) -+#endif -+ -+static observer_t *alloc_observer(void *mem_ctx, void *observer, char *notification, -+ dwc_notifier_callback_t callback, void *data) -+{ -+ observer_t *new_observer = dwc_alloc(mem_ctx, sizeof(observer_t)); -+ -+ if (!new_observer) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INIT_ENTRY(new_observer, list_entry); -+ new_observer->observer = observer; -+ new_observer->notification = notification; -+ new_observer->callback = callback; -+ new_observer->data = data; -+ return new_observer; -+} -+ -+static void free_observer(void *mem_ctx, observer_t *observer) -+{ -+ dwc_free(mem_ctx, observer); -+} -+ -+static notifier_t *alloc_notifier(void *mem_ctx, void *object) -+{ -+ notifier_t *notifier; -+ -+ if (!object) { -+ return NULL; -+ } -+ -+ notifier = dwc_alloc(mem_ctx, sizeof(notifier_t)); -+ if (!notifier) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INIT(¬ifier->observers); -+ DWC_CIRCLEQ_INIT_ENTRY(notifier, list_entry); -+ -+ notifier->mem_ctx = mem_ctx; -+ notifier->object = object; -+ return notifier; -+} -+ -+static void free_notifier(notifier_t *notifier) -+{ -+ observer_t *observer; -+ -+ DWC_CIRCLEQ_FOREACH(observer, ¬ifier->observers, list_entry) { -+ free_observer(notifier->mem_ctx, observer); -+ } -+ -+ dwc_free(notifier->mem_ctx, notifier); -+} -+ -+static notifier_t *find_notifier(void *object) -+{ -+ notifier_t *notifier; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ if (!object) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_FOREACH(notifier, &manager->notifiers, list_entry) { -+ if (notifier->object == object) { -+ return notifier; -+ } -+ } -+ -+ return NULL; -+} -+ -+int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx) -+{ -+ return create_manager(mem_ctx, wkq_ctx); -+} -+ -+void dwc_free_notification_manager(void) -+{ -+ free_manager(); -+} -+ -+dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object) -+{ -+ notifier_t *notifier; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ notifier = find_notifier(object); -+ if (notifier) { -+ DWC_ERROR("Notifier %p is already registered\n", object); -+ return NULL; -+ } -+ -+ notifier = alloc_notifier(mem_ctx, object); -+ if (!notifier) { -+ return NULL; -+ } -+ -+ DWC_CIRCLEQ_INSERT_TAIL(&manager->notifiers, notifier, list_entry); -+ -+ DWC_INFO("Notifier %p registered", object); -+ dump_manager(); -+ -+ return notifier; -+} -+ -+void dwc_unregister_notifier(dwc_notifier_t *notifier) -+{ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ if (!DWC_CIRCLEQ_EMPTY(¬ifier->observers)) { -+ observer_t *o; -+ -+ DWC_ERROR("Notifier %p has active observers when removing\n", notifier->object); -+ DWC_CIRCLEQ_FOREACH(o, ¬ifier->observers, list_entry) { -+ DWC_DEBUGC(" %p watching %s\n", o->observer, o->notification); -+ } -+ -+ DWC_ASSERT(DWC_CIRCLEQ_EMPTY(¬ifier->observers), -+ "Notifier %p has active observers when removing", notifier); -+ } -+ -+ DWC_CIRCLEQ_REMOVE_INIT(&manager->notifiers, notifier, list_entry); -+ free_notifier(notifier); -+ -+ DWC_INFO("Notifier unregistered"); -+ dump_manager(); -+} -+ -+/* Add an observer to observe the notifier for a particular state, event, or notification. */ -+int dwc_add_observer(void *observer, void *object, char *notification, -+ dwc_notifier_callback_t callback, void *data) -+{ -+ notifier_t *notifier = find_notifier(object); -+ observer_t *new_observer; -+ -+ if (!notifier) { -+ DWC_ERROR("Notifier %p is not found when adding observer\n", object); -+ return -DWC_E_INVALID; -+ } -+ -+ new_observer = alloc_observer(notifier->mem_ctx, observer, notification, callback, data); -+ if (!new_observer) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_CIRCLEQ_INSERT_TAIL(¬ifier->observers, new_observer, list_entry); -+ -+ DWC_INFO("Added observer %p to notifier %p observing notification %s, callback=%p, data=%p", -+ observer, object, notification, callback, data); -+ -+ dump_manager(); -+ return 0; -+} -+ -+int dwc_remove_observer(void *observer) -+{ -+ notifier_t *n; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ DWC_CIRCLEQ_FOREACH(n, &manager->notifiers, list_entry) { -+ observer_t *o; -+ observer_t *o2; -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(o, o2, &n->observers, list_entry) { -+ if (o->observer == observer) { -+ DWC_CIRCLEQ_REMOVE_INIT(&n->observers, o, list_entry); -+ DWC_INFO("Removing observer %p from notifier %p watching notification %s:", -+ o->observer, n->object, o->notification); -+ free_observer(n->mem_ctx, o); -+ } -+ } -+ } -+ -+ dump_manager(); -+ return 0; -+} -+ -+typedef struct callback_data { -+ void *mem_ctx; -+ dwc_notifier_callback_t cb; -+ void *observer; -+ void *data; -+ void *object; -+ char *notification; -+ void *notification_data; -+} cb_data_t; -+ -+static void cb_task(void *data) -+{ -+ cb_data_t *cb = (cb_data_t *)data; -+ -+ cb->cb(cb->object, cb->notification, cb->observer, cb->notification_data, cb->data); -+ dwc_free(cb->mem_ctx, cb); -+} -+ -+void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data) -+{ -+ observer_t *o; -+ -+ DWC_ASSERT(manager, "Notification manager not found"); -+ -+ DWC_CIRCLEQ_FOREACH(o, ¬ifier->observers, list_entry) { -+ int len = DWC_STRLEN(notification); -+ -+ if (DWC_STRLEN(o->notification) != len) { -+ continue; -+ } -+ -+ if (DWC_STRNCMP(o->notification, notification, len) == 0) { -+ cb_data_t *cb_data = dwc_alloc(notifier->mem_ctx, sizeof(cb_data_t)); -+ -+ if (!cb_data) { -+ DWC_ERROR("Failed to allocate callback data\n"); -+ return; -+ } -+ -+ cb_data->mem_ctx = notifier->mem_ctx; -+ cb_data->cb = o->callback; -+ cb_data->observer = o->observer; -+ cb_data->data = o->data; -+ cb_data->object = notifier->object; -+ cb_data->notification = notification; -+ cb_data->notification_data = notification_data; -+ DWC_DEBUGC("Observer found %p for notification %s\n", o->observer, notification); -+ DWC_WORKQ_SCHEDULE(manager->wq, cb_task, cb_data, -+ "Notify callback from %p for Notification %s, to observer %p", -+ cb_data->object, notification, cb_data->observer); -+ } -+ } -+} -+ -+#endif /* DWC_NOTIFYLIB */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.h b/drivers/usb/host/dwc_common_port/dwc_notifier.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4a8cdfe565b1fcefb400706dc7bc13cf69a9d3b2 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_notifier.h -@@ -0,0 +1,122 @@ -+ -+#ifndef __DWC_NOTIFIER_H__ -+#define __DWC_NOTIFIER_H__ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#include "dwc_os.h" -+ -+/** @file -+ * -+ * A simple implementation of the Observer pattern. Any "module" can -+ * register as an observer or notifier. The notion of "module" is abstract and -+ * can mean anything used to identify either an observer or notifier. Usually -+ * it will be a pointer to a data structure which contains some state, ie an -+ * object. -+ * -+ * Before any notifiers can be added, the global notification manager must be -+ * brought up with dwc_alloc_notification_manager(). -+ * dwc_free_notification_manager() will bring it down and free all resources. -+ * These would typically be called upon module load and unload. The -+ * notification manager is a single global instance that handles all registered -+ * observable modules and observers so this should be done only once. -+ * -+ * A module can be observable by using Notifications to publicize some general -+ * information about it's state or operation. It does not care who listens, or -+ * even if anyone listens, or what they do with the information. The observable -+ * modules do not need to know any information about it's observers or their -+ * interface, or their state or data. -+ * -+ * Any module can register to emit Notifications. It should publish a list of -+ * notifications that it can emit and their behavior, such as when they will get -+ * triggered, and what information will be provided to the observer. Then it -+ * should register itself as an observable module. See dwc_register_notifier(). -+ * -+ * Any module can observe any observable, registered module, provided it has a -+ * handle to the other module and knows what notifications to observe. See -+ * dwc_add_observer(). -+ * -+ * A function of type dwc_notifier_callback_t is called whenever a notification -+ * is triggered with one or more observers observing it. This function is -+ * called in it's own process so it may sleep or block if needed. It is -+ * guaranteed to be called sometime after the notification has occurred and will -+ * be called once per each time the notification is triggered. It will NOT be -+ * called in the same process context used to trigger the notification. -+ * -+ * @section Limitiations -+ * -+ * Keep in mind that Notifications that can be triggered in rapid sucession may -+ * schedule too many processes too handle. Be aware of this limitation when -+ * designing to use notifications, and only add notifications for appropriate -+ * observable information. -+ * -+ * Also Notification callbacks are not synchronous. If you need to synchronize -+ * the behavior between module/observer you must use other means. And perhaps -+ * that will mean Notifications are not the proper solution. -+ */ -+ -+struct dwc_notifier; -+typedef struct dwc_notifier dwc_notifier_t; -+ -+/** The callback function must be of this type. -+ * -+ * @param object This is the object that is being observed. -+ * @param notification This is the notification that was triggered. -+ * @param observer This is the observer -+ * @param notification_data This is notification-specific data that the notifier -+ * has included in this notification. The value of this should be published in -+ * the documentation of the observable module with the notifications. -+ * @param user_data This is any custom data that the observer provided when -+ * adding itself as an observer to the notification. */ -+typedef void (*dwc_notifier_callback_t)(void *object, char *notification, void *observer, -+ void *notification_data, void *user_data); -+ -+/** Brings up the notification manager. */ -+extern int dwc_alloc_notification_manager(void *mem_ctx, void *wkq_ctx); -+/** Brings down the notification manager. */ -+extern void dwc_free_notification_manager(void); -+ -+/** This function registers an observable module. A dwc_notifier_t object is -+ * returned to the observable module. This is an opaque object that is used by -+ * the observable module to trigger notifications. This object should only be -+ * accessible to functions that are authorized to trigger notifications for this -+ * module. Observers do not need this object. */ -+extern dwc_notifier_t *dwc_register_notifier(void *mem_ctx, void *object); -+ -+/** This function unregisters an observable module. All observers have to be -+ * removed prior to unregistration. */ -+extern void dwc_unregister_notifier(dwc_notifier_t *notifier); -+ -+/** Add a module as an observer to the observable module. The observable module -+ * needs to have previously registered with the notification manager. -+ * -+ * @param observer The observer module -+ * @param object The module to observe -+ * @param notification The notification to observe -+ * @param callback The callback function to call -+ * @param user_data Any additional user data to pass into the callback function */ -+extern int dwc_add_observer(void *observer, void *object, char *notification, -+ dwc_notifier_callback_t callback, void *user_data); -+ -+/** Removes the specified observer from all notifications that it is currently -+ * observing. */ -+extern int dwc_remove_observer(void *observer); -+ -+/** This function triggers a Notification. It should be called by the -+ * observable module, or any module or library which the observable module -+ * allows to trigger notification on it's behalf. Such as the dwc_cc_t. -+ * -+ * dwc_notify is a non-blocking function. Callbacks are scheduled called in -+ * their own process context for each trigger. Callbacks can be blocking. -+ * dwc_notify can be called from interrupt context if needed. -+ * -+ */ -+void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* __DWC_NOTIFIER_H__ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_os.h b/drivers/usb/host/dwc_common_port/dwc_os.h -new file mode 100644 -index 0000000000000000000000000000000000000000..9a86d299403bd1dfdcdb6532fad702b2b65138d7 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_os.h -@@ -0,0 +1,1276 @@ -+/* ========================================================================= -+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_os.h $ -+ * $Revision: #14 $ -+ * $Date: 2010/11/04 $ -+ * $Change: 1621695 $ -+ * -+ * Synopsys Portability Library Software and documentation -+ * (hereinafter, "Software") is an Unsupported proprietary work of -+ * Synopsys, Inc. unless otherwise expressly agreed to in writing -+ * between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product -+ * under any End User Software License Agreement or Agreement for -+ * Licensed Product with Synopsys or any supplement thereto. You are -+ * permitted to use and redistribute this Software in source and binary -+ * forms, with or without modification, provided that redistributions -+ * of source code must retain this notice. You may not view, use, -+ * disclose, copy or distribute this file or any information contained -+ * herein except pursuant to this license grant from Synopsys. If you -+ * do not agree with this notice, including the disclaimer below, then -+ * you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" -+ * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -+ * FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL -+ * SYNOPSYS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================= */ -+#ifndef _DWC_OS_H_ -+#define _DWC_OS_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** @file -+ * -+ * DWC portability library, low level os-wrapper functions -+ * -+ */ -+ -+/* These basic types need to be defined by some OS header file or custom header -+ * file for your specific target architecture. -+ * -+ * uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t -+ * -+ * Any custom or alternate header file must be added and enabled here. -+ */ -+ -+#ifdef DWC_LINUX -+# include -+# ifdef CONFIG_DEBUG_MUTEXES -+# include -+# endif -+# include -+# include -+# include -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+# include -+#endif -+ -+ -+/** @name Primitive Types and Values */ -+ -+/** We define a boolean type for consistency. Can be either YES or NO */ -+typedef uint8_t dwc_bool_t; -+#define YES 1 -+#define NO 0 -+ -+#ifdef DWC_LINUX -+ -+/** @name Error Codes */ -+#define DWC_E_INVALID EINVAL -+#define DWC_E_NO_MEMORY ENOMEM -+#define DWC_E_NO_DEVICE ENODEV -+#define DWC_E_NOT_SUPPORTED EOPNOTSUPP -+#define DWC_E_TIMEOUT ETIMEDOUT -+#define DWC_E_BUSY EBUSY -+#define DWC_E_AGAIN EAGAIN -+#define DWC_E_RESTART ERESTART -+#define DWC_E_ABORT ECONNABORTED -+#define DWC_E_SHUTDOWN ESHUTDOWN -+#define DWC_E_NO_DATA ENODATA -+#define DWC_E_DISCONNECT ECONNRESET -+#define DWC_E_UNKNOWN EINVAL -+#define DWC_E_NO_STREAM_RES ENOSR -+#define DWC_E_COMMUNICATION ECOMM -+#define DWC_E_OVERFLOW EOVERFLOW -+#define DWC_E_PROTOCOL EPROTO -+#define DWC_E_IN_PROGRESS EINPROGRESS -+#define DWC_E_PIPE EPIPE -+#define DWC_E_IO EIO -+#define DWC_E_NO_SPACE ENOSPC -+ -+#else -+ -+/** @name Error Codes */ -+#define DWC_E_INVALID 1001 -+#define DWC_E_NO_MEMORY 1002 -+#define DWC_E_NO_DEVICE 1003 -+#define DWC_E_NOT_SUPPORTED 1004 -+#define DWC_E_TIMEOUT 1005 -+#define DWC_E_BUSY 1006 -+#define DWC_E_AGAIN 1007 -+#define DWC_E_RESTART 1008 -+#define DWC_E_ABORT 1009 -+#define DWC_E_SHUTDOWN 1010 -+#define DWC_E_NO_DATA 1011 -+#define DWC_E_DISCONNECT 2000 -+#define DWC_E_UNKNOWN 3000 -+#define DWC_E_NO_STREAM_RES 4001 -+#define DWC_E_COMMUNICATION 4002 -+#define DWC_E_OVERFLOW 4003 -+#define DWC_E_PROTOCOL 4004 -+#define DWC_E_IN_PROGRESS 4005 -+#define DWC_E_PIPE 4006 -+#define DWC_E_IO 4007 -+#define DWC_E_NO_SPACE 4008 -+ -+#endif -+ -+ -+/** @name Tracing/Logging Functions -+ * -+ * These function provide the capability to add tracing, debugging, and error -+ * messages, as well exceptions as assertions. The WUDEV uses these -+ * extensively. These could be logged to the main console, the serial port, an -+ * internal buffer, etc. These functions could also be no-op if they are too -+ * expensive on your system. By default undefining the DEBUG macro already -+ * no-ops some of these functions. */ -+ -+/** Returns non-zero if in interrupt context. */ -+extern dwc_bool_t DWC_IN_IRQ(void); -+#define dwc_in_irq DWC_IN_IRQ -+ -+/** Returns "IRQ" if DWC_IN_IRQ is true. */ -+static inline char *dwc_irq(void) { -+ return DWC_IN_IRQ() ? "IRQ" : ""; -+} -+ -+/** Returns non-zero if in bottom-half context. */ -+extern dwc_bool_t DWC_IN_BH(void); -+#define dwc_in_bh DWC_IN_BH -+ -+/** Returns "BH" if DWC_IN_BH is true. */ -+static inline char *dwc_bh(void) { -+ return DWC_IN_BH() ? "BH" : ""; -+} -+ -+/** -+ * A vprintf() clone. Just call vprintf if you've got it. -+ */ -+extern void DWC_VPRINTF(char *format, va_list args); -+#define dwc_vprintf DWC_VPRINTF -+ -+/** -+ * A vsnprintf() clone. Just call vprintf if you've got it. -+ */ -+extern int DWC_VSNPRINTF(char *str, int size, char *format, va_list args); -+#define dwc_vsnprintf DWC_VSNPRINTF -+ -+/** -+ * printf() clone. Just call printf if you've go it. -+ */ -+extern void DWC_PRINTF(char *format, ...) -+/* This provides compiler level static checking of the parameters if you're -+ * using GCC. */ -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+#define dwc_printf DWC_PRINTF -+ -+/** -+ * sprintf() clone. Just call sprintf if you've got it. -+ */ -+extern int DWC_SPRINTF(char *string, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 2, 3))); -+#else -+ ; -+#endif -+#define dwc_sprintf DWC_SPRINTF -+ -+/** -+ * snprintf() clone. Just call snprintf if you've got it. -+ */ -+extern int DWC_SNPRINTF(char *string, int size, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 3, 4))); -+#else -+ ; -+#endif -+#define dwc_snprintf DWC_SNPRINTF -+ -+/** -+ * Prints a WARNING message. On systems that don't differentiate between -+ * warnings and regular log messages, just print it. Indicates that something -+ * may be wrong with the driver. Works like printf(). -+ * -+ * Use the DWC_WARN macro to call this function. -+ */ -+extern void __DWC_WARN(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+ -+/** -+ * Prints an error message. On systems that don't differentiate between errors -+ * and regular log messages, just print it. Indicates that something went wrong -+ * with the driver. Works like printf(). -+ * -+ * Use the DWC_ERROR macro to call this function. -+ */ -+extern void __DWC_ERROR(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+ -+/** -+ * Prints an exception error message and takes some user-defined action such as -+ * print out a backtrace or trigger a breakpoint. Indicates that something went -+ * abnormally wrong with the driver such as programmer error, or other -+ * exceptional condition. It should not be ignored so even on systems without -+ * printing capability, some action should be taken to notify the developer of -+ * it. Works like printf(). -+ */ -+extern void DWC_EXCEPTION(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+#define dwc_exception DWC_EXCEPTION -+ -+#ifndef DWC_OTG_DEBUG_LEV -+#define DWC_OTG_DEBUG_LEV 0 -+#endif -+ -+#ifdef DEBUG -+/** -+ * Prints out a debug message. Used for logging/trace messages. -+ * -+ * Use the DWC_DEBUG macro to call this function -+ */ -+extern void __DWC_DEBUG(char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 1, 2))); -+#else -+ ; -+#endif -+#else -+#define __DWC_DEBUG printk -+#endif -+ -+/** -+ * Prints out a Debug message. -+ */ -+#define DWC_DEBUG(_format, _args...) __DWC_DEBUG("DEBUG:%s:%s: " _format "\n", \ -+ __func__, dwc_irq(), ## _args) -+#define dwc_debug DWC_DEBUG -+/** -+ * Prints out a Debug message if enabled at compile time. -+ */ -+#if DWC_OTG_DEBUG_LEV > 0 -+#define DWC_DEBUGC(_format, _args...) DWC_DEBUG(_format, ##_args ) -+#else -+#define DWC_DEBUGC(_format, _args...) -+#endif -+#define dwc_debugc DWC_DEBUGC -+/** -+ * Prints out an informative message. -+ */ -+#define DWC_INFO(_format, _args...) DWC_PRINTF("INFO:%s: " _format "\n", \ -+ dwc_irq(), ## _args) -+#define dwc_info DWC_INFO -+/** -+ * Prints out an informative message if enabled at compile time. -+ */ -+#if DWC_OTG_DEBUG_LEV > 1 -+#define DWC_INFOC(_format, _args...) DWC_INFO(_format, ##_args ) -+#else -+#define DWC_INFOC(_format, _args...) -+#endif -+#define dwc_infoc DWC_INFOC -+/** -+ * Prints out a warning message. -+ */ -+#define DWC_WARN(_format, _args...) __DWC_WARN("WARN:%s:%s:%d: " _format "\n", \ -+ dwc_irq(), __func__, __LINE__, ## _args) -+#define dwc_warn DWC_WARN -+/** -+ * Prints out an error message. -+ */ -+#define DWC_ERROR(_format, _args...) __DWC_ERROR("ERROR:%s:%s:%d: " _format "\n", \ -+ dwc_irq(), __func__, __LINE__, ## _args) -+#define dwc_error DWC_ERROR -+ -+#define DWC_PROTO_ERROR(_format, _args...) __DWC_WARN("ERROR:%s:%s:%d: " _format "\n", \ -+ dwc_irq(), __func__, __LINE__, ## _args) -+#define dwc_proto_error DWC_PROTO_ERROR -+ -+#ifdef DEBUG -+/** Prints out a exception error message if the _expr expression fails. Disabled -+ * if DEBUG is not enabled. */ -+#define DWC_ASSERT(_expr, _format, _args...) do { \ -+ if (!(_expr)) { DWC_EXCEPTION("%s:%s:%d: " _format "\n", dwc_irq(), \ -+ __FILE__, __LINE__, ## _args); } \ -+ } while (0) -+#else -+#define DWC_ASSERT(_x...) -+#endif -+#define dwc_assert DWC_ASSERT -+ -+ -+/** @name Byte Ordering -+ * The following functions are for conversions between processor's byte ordering -+ * and specific ordering you want. -+ */ -+ -+/** Converts 32 bit data in CPU byte ordering to little endian. */ -+extern uint32_t DWC_CPU_TO_LE32(uint32_t *p); -+#define dwc_cpu_to_le32 DWC_CPU_TO_LE32 -+ -+/** Converts 32 bit data in CPU byte orderint to big endian. */ -+extern uint32_t DWC_CPU_TO_BE32(uint32_t *p); -+#define dwc_cpu_to_be32 DWC_CPU_TO_BE32 -+ -+/** Converts 32 bit little endian data to CPU byte ordering. */ -+extern uint32_t DWC_LE32_TO_CPU(uint32_t *p); -+#define dwc_le32_to_cpu DWC_LE32_TO_CPU -+ -+/** Converts 32 bit big endian data to CPU byte ordering. */ -+extern uint32_t DWC_BE32_TO_CPU(uint32_t *p); -+#define dwc_be32_to_cpu DWC_BE32_TO_CPU -+ -+/** Converts 16 bit data in CPU byte ordering to little endian. */ -+extern uint16_t DWC_CPU_TO_LE16(uint16_t *p); -+#define dwc_cpu_to_le16 DWC_CPU_TO_LE16 -+ -+/** Converts 16 bit data in CPU byte orderint to big endian. */ -+extern uint16_t DWC_CPU_TO_BE16(uint16_t *p); -+#define dwc_cpu_to_be16 DWC_CPU_TO_BE16 -+ -+/** Converts 16 bit little endian data to CPU byte ordering. */ -+extern uint16_t DWC_LE16_TO_CPU(uint16_t *p); -+#define dwc_le16_to_cpu DWC_LE16_TO_CPU -+ -+/** Converts 16 bit bi endian data to CPU byte ordering. */ -+extern uint16_t DWC_BE16_TO_CPU(uint16_t *p); -+#define dwc_be16_to_cpu DWC_BE16_TO_CPU -+ -+ -+/** @name Register Read/Write -+ * -+ * The following six functions should be implemented to read/write registers of -+ * 32-bit and 64-bit sizes. All modules use this to read/write register values. -+ * The reg value is a pointer to the register calculated from the void *base -+ * variable passed into the driver when it is started. */ -+ -+#ifdef DWC_LINUX -+/* Linux doesn't need any extra parameters for register read/write, so we -+ * just throw away the IO context parameter. -+ */ -+/** Reads the content of a 32-bit register. */ -+extern uint32_t DWC_READ_REG32(uint32_t volatile *reg); -+#define dwc_read_reg32(_ctx_,_reg_) DWC_READ_REG32(_reg_) -+ -+/** Reads the content of a 64-bit register. */ -+extern uint64_t DWC_READ_REG64(uint64_t volatile *reg); -+#define dwc_read_reg64(_ctx_,_reg_) DWC_READ_REG64(_reg_) -+ -+/** Writes to a 32-bit register. */ -+extern void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value); -+#define dwc_write_reg32(_ctx_,_reg_,_val_) DWC_WRITE_REG32(_reg_, _val_) -+ -+/** Writes to a 64-bit register. */ -+extern void DWC_WRITE_REG64(uint64_t volatile *reg, uint64_t value); -+#define dwc_write_reg64(_ctx_,_reg_,_val_) DWC_WRITE_REG64(_reg_, _val_) -+ -+/** -+ * Modify bit values in a register. Using the -+ * algorithm: (reg_contents & ~clear_mask) | set_mask. -+ */ -+extern void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); -+#define dwc_modify_reg32(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG32(_reg_,_cmsk_,_smsk_) -+extern void DWC_MODIFY_REG64(uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); -+#define dwc_modify_reg64(_ctx_,_reg_,_cmsk_,_smsk_) DWC_MODIFY_REG64(_reg_,_cmsk_,_smsk_) -+ -+#endif /* DWC_LINUX */ -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+typedef struct dwc_ioctx { -+ struct device *dev; -+ bus_space_tag_t iot; -+ bus_space_handle_t ioh; -+} dwc_ioctx_t; -+ -+/** BSD needs two extra parameters for register read/write, so we pass -+ * them in using the IO context parameter. -+ */ -+/** Reads the content of a 32-bit register. */ -+extern uint32_t DWC_READ_REG32(void *io_ctx, uint32_t volatile *reg); -+#define dwc_read_reg32 DWC_READ_REG32 -+ -+/** Reads the content of a 64-bit register. */ -+extern uint64_t DWC_READ_REG64(void *io_ctx, uint64_t volatile *reg); -+#define dwc_read_reg64 DWC_READ_REG64 -+ -+/** Writes to a 32-bit register. */ -+extern void DWC_WRITE_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t value); -+#define dwc_write_reg32 DWC_WRITE_REG32 -+ -+/** Writes to a 64-bit register. */ -+extern void DWC_WRITE_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t value); -+#define dwc_write_reg64 DWC_WRITE_REG64 -+ -+/** -+ * Modify bit values in a register. Using the -+ * algorithm: (reg_contents & ~clear_mask) | set_mask. -+ */ -+extern void DWC_MODIFY_REG32(void *io_ctx, uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask); -+#define dwc_modify_reg32 DWC_MODIFY_REG32 -+extern void DWC_MODIFY_REG64(void *io_ctx, uint64_t volatile *reg, uint64_t clear_mask, uint64_t set_mask); -+#define dwc_modify_reg64 DWC_MODIFY_REG64 -+ -+#endif /* DWC_FREEBSD || DWC_NETBSD */ -+ -+/** @cond */ -+ -+/** @name Some convenience MACROS used internally. Define DWC_DEBUG_REGS to log the -+ * register writes. */ -+ -+#ifdef DWC_LINUX -+ -+# ifdef DWC_DEBUG_REGS -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ -+ return DWC_READ_REG32(&container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ -+ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ -+ &(((uint32_t*)container->regs->_reg)[num]), data); \ -+ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(_container_type *container) { \ -+ return DWC_READ_REG32(&container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ -+ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ -+ DWC_WRITE_REG32(&container->regs->_reg, data); \ -+} -+ -+# else /* DWC_DEBUG_REGS */ -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(_container_type *container, int num) { \ -+ return DWC_READ_REG32(&container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(_container_type *container, int num, uint32_t data) { \ -+ DWC_WRITE_REG32(&(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(_container_type *container) { \ -+ return DWC_READ_REG32(&container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(_container_type *container, uint32_t data) { \ -+ DWC_WRITE_REG32(&container->regs->_reg, data); \ -+} -+ -+# endif /* DWC_DEBUG_REGS */ -+ -+#endif /* DWC_LINUX */ -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+ -+# ifdef DWC_DEBUG_REGS -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ -+ DWC_DEBUG("WRITING %8s[%d]: %p: %08x", #_reg, num, \ -+ &(((uint32_t*)container->regs->_reg)[num]), data); \ -+ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ -+ DWC_DEBUG("WRITING %11s: %p: %08x", #_reg, &container->regs->_reg, data); \ -+ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ -+} -+ -+# else /* DWC_DEBUG_REGS */ -+ -+#define dwc_define_read_write_reg_n(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg##_n(void *io_ctx, _container_type *container, int num) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg[num]); \ -+} \ -+static inline void dwc_write_##_reg##_n(void *io_ctx, _container_type *container, int num, uint32_t data) { \ -+ DWC_WRITE_REG32(io_ctx, &(((uint32_t*)container->regs->_reg)[num]), data); \ -+} -+ -+#define dwc_define_read_write_reg(_reg,_container_type) \ -+static inline uint32_t dwc_read_##_reg(void *io_ctx, _container_type *container) { \ -+ return DWC_READ_REG32(io_ctx, &container->regs->_reg); \ -+} \ -+static inline void dwc_write_##_reg(void *io_ctx, _container_type *container, uint32_t data) { \ -+ DWC_WRITE_REG32(io_ctx, &container->regs->_reg, data); \ -+} -+ -+# endif /* DWC_DEBUG_REGS */ -+ -+#endif /* DWC_FREEBSD || DWC_NETBSD */ -+ -+/** @endcond */ -+ -+ -+#ifdef DWC_CRYPTOLIB -+/** @name Crypto Functions -+ * -+ * These are the low-level cryptographic functions used by the driver. */ -+ -+/** Perform AES CBC */ -+extern int DWC_AES_CBC(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t iv[16], uint8_t *out); -+#define dwc_aes_cbc DWC_AES_CBC -+ -+/** Fill the provided buffer with random bytes. These should be cryptographic grade random numbers. */ -+extern void DWC_RANDOM_BYTES(uint8_t *buffer, uint32_t length); -+#define dwc_random_bytes DWC_RANDOM_BYTES -+ -+/** Perform the SHA-256 hash function */ -+extern int DWC_SHA256(uint8_t *message, uint32_t len, uint8_t *out); -+#define dwc_sha256 DWC_SHA256 -+ -+/** Calculated the HMAC-SHA256 */ -+extern int DWC_HMAC_SHA256(uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t *out); -+#define dwc_hmac_sha256 DWC_HMAC_SHA256 -+ -+#endif /* DWC_CRYPTOLIB */ -+ -+ -+/** @name Memory Allocation -+ * -+ * These function provide access to memory allocation. There are only 2 DMA -+ * functions and 3 Regular memory functions that need to be implemented. None -+ * of the memory debugging routines need to be implemented. The allocation -+ * routines all ZERO the contents of the memory. -+ * -+ * Defining DWC_DEBUG_MEMORY turns on memory debugging and statistic gathering. -+ * This checks for memory leaks, keeping track of alloc/free pairs. It also -+ * keeps track of how much memory the driver is using at any given time. */ -+ -+#define DWC_PAGE_SIZE 4096 -+#define DWC_PAGE_OFFSET(addr) (((uint32_t)addr) & 0xfff) -+#define DWC_PAGE_ALIGNED(addr) ((((uint32_t)addr) & 0xfff) == 0) -+ -+#define DWC_INVALID_DMA_ADDR 0x0 -+ -+#ifdef DWC_LINUX -+/** Type for a DMA address */ -+typedef dma_addr_t dwc_dma_t; -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+typedef bus_addr_t dwc_dma_t; -+#endif -+ -+#ifdef DWC_FREEBSD -+typedef struct dwc_dmactx { -+ struct device *dev; -+ bus_dma_tag_t dma_tag; -+ bus_dmamap_t dma_map; -+ bus_addr_t dma_paddr; -+ void *dma_vaddr; -+} dwc_dmactx_t; -+#endif -+ -+#ifdef DWC_NETBSD -+typedef struct dwc_dmactx { -+ struct device *dev; -+ bus_dma_tag_t dma_tag; -+ bus_dmamap_t dma_map; -+ bus_dma_segment_t segs[1]; -+ int nsegs; -+ bus_addr_t dma_paddr; -+ void *dma_vaddr; -+} dwc_dmactx_t; -+#endif -+ -+/* @todo these functions will be added in the future */ -+#if 0 -+/** -+ * Creates a DMA pool from which you can allocate DMA buffers. Buffers -+ * allocated from this pool will be guaranteed to meet the size, alignment, and -+ * boundary requirements specified. -+ * -+ * @param[in] size Specifies the size of the buffers that will be allocated from -+ * this pool. -+ * @param[in] align Specifies the byte alignment requirements of the buffers -+ * allocated from this pool. Must be a power of 2. -+ * @param[in] boundary Specifies the N-byte boundary that buffers allocated from -+ * this pool must not cross. -+ * -+ * @returns A pointer to an internal opaque structure which is not to be -+ * accessed outside of these library functions. Use this handle to specify -+ * which pools to allocate/free DMA buffers from and also to destroy the pool, -+ * when you are done with it. -+ */ -+extern dwc_pool_t *DWC_DMA_POOL_CREATE(uint32_t size, uint32_t align, uint32_t boundary); -+ -+/** -+ * Destroy a DMA pool. All buffers allocated from that pool must be freed first. -+ */ -+extern void DWC_DMA_POOL_DESTROY(dwc_pool_t *pool); -+ -+/** -+ * Allocate a buffer from the specified DMA pool and zeros its contents. -+ */ -+extern void *DWC_DMA_POOL_ALLOC(dwc_pool_t *pool, uint64_t *dma_addr); -+ -+/** -+ * Free a previously allocated buffer from the DMA pool. -+ */ -+extern void DWC_DMA_POOL_FREE(dwc_pool_t *pool, void *vaddr, void *daddr); -+#endif -+ -+/** Allocates a DMA capable buffer and zeroes its contents. */ -+extern void *__DWC_DMA_ALLOC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); -+ -+/** Allocates a DMA capable buffer and zeroes its contents in atomic contest */ -+extern void *__DWC_DMA_ALLOC_ATOMIC(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr); -+ -+/** Frees a previously allocated buffer. */ -+extern void __DWC_DMA_FREE(void *dma_ctx, uint32_t size, void *virt_addr, dwc_dma_t dma_addr); -+ -+/** Allocates a block of memory and zeroes its contents. */ -+extern void *__DWC_ALLOC(void *mem_ctx, uint32_t size); -+ -+/** Allocates a block of memory and zeroes its contents, in an atomic manner -+ * which can be used inside interrupt context. The size should be sufficiently -+ * small, a few KB at most, such that failures are not likely to occur. Can just call -+ * __DWC_ALLOC if it is atomic. */ -+extern void *__DWC_ALLOC_ATOMIC(void *mem_ctx, uint32_t size); -+ -+/** Frees a previously allocated buffer. */ -+extern void __DWC_FREE(void *mem_ctx, void *addr); -+ -+#ifndef DWC_DEBUG_MEMORY -+ -+#define DWC_ALLOC(_size_) __DWC_ALLOC(NULL, _size_) -+#define DWC_ALLOC_ATOMIC(_size_) __DWC_ALLOC_ATOMIC(NULL, _size_) -+#define DWC_FREE(_addr_) __DWC_FREE(NULL, _addr_) -+ -+# ifdef DWC_LINUX -+#define DWC_DMA_ALLOC(_dev, _size_, _dma_) __DWC_DMA_ALLOC(_dev, _size_, _dma_) -+#define DWC_DMA_ALLOC_ATOMIC(_dev, _size_, _dma_) __DWC_DMA_ALLOC_ATOMIC(_dev, _size_, _dma_) -+#define DWC_DMA_FREE(_dev, _size_,_virt_, _dma_) __DWC_DMA_FREE(_dev, _size_, _virt_, _dma_) -+# endif -+ -+# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+#define DWC_DMA_ALLOC __DWC_DMA_ALLOC -+#define DWC_DMA_FREE __DWC_DMA_FREE -+# endif -+extern void *dwc_dma_alloc_atomic_debug(uint32_t size, dwc_dma_t *dma_addr, char const *func, int line); -+ -+#else /* DWC_DEBUG_MEMORY */ -+ -+extern void *dwc_alloc_debug(void *mem_ctx, uint32_t size, char const *func, int line); -+extern void *dwc_alloc_atomic_debug(void *mem_ctx, uint32_t size, char const *func, int line); -+extern void dwc_free_debug(void *mem_ctx, void *addr, char const *func, int line); -+extern void *dwc_dma_alloc_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, -+ char const *func, int line); -+extern void *dwc_dma_alloc_atomic_debug(void *dma_ctx, uint32_t size, dwc_dma_t *dma_addr, -+ char const *func, int line); -+extern void dwc_dma_free_debug(void *dma_ctx, uint32_t size, void *virt_addr, -+ dwc_dma_t dma_addr, char const *func, int line); -+ -+extern int dwc_memory_debug_start(void *mem_ctx); -+extern void dwc_memory_debug_stop(void); -+extern void dwc_memory_debug_report(void); -+ -+#define DWC_ALLOC(_size_) dwc_alloc_debug(NULL, _size_, __func__, __LINE__) -+#define DWC_ALLOC_ATOMIC(_size_) dwc_alloc_atomic_debug(NULL, _size_, \ -+ __func__, __LINE__) -+#define DWC_FREE(_addr_) dwc_free_debug(NULL, _addr_, __func__, __LINE__) -+ -+# ifdef DWC_LINUX -+#define DWC_DMA_ALLOC(_dev, _size_, _dma_) \ -+ dwc_dma_alloc_debug(_dev, _size_, _dma_, __func__, __LINE__) -+#define DWC_DMA_ALLOC_ATOMIC(_dev, _size_, _dma_) \ -+ dwc_dma_alloc_atomic_debug(_dev, _size_, _dma_, __func__, __LINE__) -+#define DWC_DMA_FREE(_dev, _size_, _virt_, _dma_) \ -+ dwc_dma_free_debug(_dev, _size_, _virt_, _dma_, __func__, __LINE__) -+# endif -+ -+# if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+#define DWC_DMA_ALLOC(_ctx_,_size_,_dma_) dwc_dma_alloc_debug(_ctx_, _size_, \ -+ _dma_, __func__, __LINE__) -+#define DWC_DMA_FREE(_ctx_,_size_,_virt_,_dma_) dwc_dma_free_debug(_ctx_, _size_, \ -+ _virt_, _dma_, __func__, __LINE__) -+# endif -+ -+#endif /* DWC_DEBUG_MEMORY */ -+ -+#define dwc_alloc(_ctx_,_size_) DWC_ALLOC(_size_) -+#define dwc_alloc_atomic(_ctx_,_size_) DWC_ALLOC_ATOMIC(_size_) -+#define dwc_free(_ctx_,_addr_) DWC_FREE(_addr_) -+ -+#ifdef DWC_LINUX -+/* Linux doesn't need any extra parameters for DMA buffer allocation, so we -+ * just throw away the DMA context parameter. -+ */ -+#define dwc_dma_alloc(_ctx_,_size_,_dma_) DWC_DMA_ALLOC(_size_, _dma_) -+#define dwc_dma_alloc_atomic(_ctx_,_size_,_dma_) DWC_DMA_ALLOC_ATOMIC(_size_, _dma_) -+#define dwc_dma_free(_ctx_,_size_,_virt_,_dma_) DWC_DMA_FREE(_size_, _virt_, _dma_) -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+/** BSD needs several extra parameters for DMA buffer allocation, so we pass -+ * them in using the DMA context parameter. -+ */ -+#define dwc_dma_alloc DWC_DMA_ALLOC -+#define dwc_dma_free DWC_DMA_FREE -+#endif -+ -+ -+/** @name Memory and String Processing */ -+ -+/** memset() clone */ -+extern void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size); -+#define dwc_memset DWC_MEMSET -+ -+/** memcpy() clone */ -+extern void *DWC_MEMCPY(void *dest, void const *src, uint32_t size); -+#define dwc_memcpy DWC_MEMCPY -+ -+/** memmove() clone */ -+extern void *DWC_MEMMOVE(void *dest, void *src, uint32_t size); -+#define dwc_memmove DWC_MEMMOVE -+ -+/** memcmp() clone */ -+extern int DWC_MEMCMP(void *m1, void *m2, uint32_t size); -+#define dwc_memcmp DWC_MEMCMP -+ -+/** strcmp() clone */ -+extern int DWC_STRCMP(void *s1, void *s2); -+#define dwc_strcmp DWC_STRCMP -+ -+/** strncmp() clone */ -+extern int DWC_STRNCMP(void *s1, void *s2, uint32_t size); -+#define dwc_strncmp DWC_STRNCMP -+ -+/** strlen() clone, for NULL terminated ASCII strings */ -+extern int DWC_STRLEN(char const *str); -+#define dwc_strlen DWC_STRLEN -+ -+/** strcpy() clone, for NULL terminated ASCII strings */ -+extern char *DWC_STRCPY(char *to, const char *from); -+#define dwc_strcpy DWC_STRCPY -+ -+/** strdup() clone. If you wish to use memory allocation debugging, this -+ * implementation of strdup should use the DWC_* memory routines instead of -+ * calling a predefined strdup. Otherwise the memory allocated by this routine -+ * will not be seen by the debugging routines. */ -+extern char *DWC_STRDUP(char const *str); -+#define dwc_strdup(_ctx_,_str_) DWC_STRDUP(_str_) -+ -+/** NOT an atoi() clone. Read the description carefully. Returns an integer -+ * converted from the string str in base 10 unless the string begins with a "0x" -+ * in which case it is base 16. String must be a NULL terminated sequence of -+ * ASCII characters and may optionally begin with whitespace, a + or -, and a -+ * "0x" prefix if base 16. The remaining characters must be valid digits for -+ * the number and end with a NULL character. If any invalid characters are -+ * encountered or it returns with a negative error code and the results of the -+ * conversion are undefined. On sucess it returns 0. Overflow conditions are -+ * undefined. An example implementation using atoi() can be referenced from the -+ * Linux implementation. */ -+extern int DWC_ATOI(const char *str, int32_t *value); -+#define dwc_atoi DWC_ATOI -+ -+/** Same as above but for unsigned. */ -+extern int DWC_ATOUI(const char *str, uint32_t *value); -+#define dwc_atoui DWC_ATOUI -+ -+#ifdef DWC_UTFLIB -+/** This routine returns a UTF16LE unicode encoded string from a UTF8 string. */ -+extern int DWC_UTF8_TO_UTF16LE(uint8_t const *utf8string, uint16_t *utf16string, unsigned len); -+#define dwc_utf8_to_utf16le DWC_UTF8_TO_UTF16LE -+#endif -+ -+ -+/** @name Wait queues -+ * -+ * Wait queues provide a means of synchronizing between threads or processes. A -+ * process can block on a waitq if some condition is not true, waiting for it to -+ * become true. When the waitq is triggered all waiting process will get -+ * unblocked and the condition will be check again. Waitqs should be triggered -+ * every time a condition can potentially change.*/ -+struct dwc_waitq; -+ -+/** Type for a waitq */ -+typedef struct dwc_waitq dwc_waitq_t; -+ -+/** The type of waitq condition callback function. This is called every time -+ * condition is evaluated. */ -+typedef int (*dwc_waitq_condition_t)(void *data); -+ -+/** Allocate a waitq */ -+extern dwc_waitq_t *DWC_WAITQ_ALLOC(void); -+#define dwc_waitq_alloc(_ctx_) DWC_WAITQ_ALLOC() -+ -+/** Free a waitq */ -+extern void DWC_WAITQ_FREE(dwc_waitq_t *wq); -+#define dwc_waitq_free DWC_WAITQ_FREE -+ -+/** Check the condition and if it is false, block on the waitq. When unblocked, check the -+ * condition again. The function returns when the condition becomes true. The return value -+ * is 0 on condition true, DWC_WAITQ_ABORTED on abort or killed, or DWC_WAITQ_UNKNOWN on error. */ -+extern int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, void *data); -+#define dwc_waitq_wait DWC_WAITQ_WAIT -+ -+/** Check the condition and if it is false, block on the waitq. When unblocked, -+ * check the condition again. The function returns when the condition become -+ * true or the timeout has passed. The return value is 0 on condition true or -+ * DWC_TIMED_OUT on timeout, or DWC_WAITQ_ABORTED, or DWC_WAITQ_UNKNOWN on -+ * error. */ -+extern int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t cond, -+ void *data, int32_t msecs); -+#define dwc_waitq_wait_timeout DWC_WAITQ_WAIT_TIMEOUT -+ -+/** Trigger a waitq, unblocking all processes. This should be called whenever a condition -+ * has potentially changed. */ -+extern void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq); -+#define dwc_waitq_trigger DWC_WAITQ_TRIGGER -+ -+/** Unblock all processes waiting on the waitq with an ABORTED result. */ -+extern void DWC_WAITQ_ABORT(dwc_waitq_t *wq); -+#define dwc_waitq_abort DWC_WAITQ_ABORT -+ -+ -+/** @name Threads -+ * -+ * A thread must be explicitly stopped. It must check DWC_THREAD_SHOULD_STOP -+ * whenever it is woken up, and then return. The DWC_THREAD_STOP function -+ * returns the value from the thread. -+ */ -+ -+struct dwc_thread; -+ -+/** Type for a thread */ -+typedef struct dwc_thread dwc_thread_t; -+ -+/** The thread function */ -+typedef int (*dwc_thread_function_t)(void *data); -+ -+/** Create a thread and start it running the thread_function. Returns a handle -+ * to the thread */ -+extern dwc_thread_t *DWC_THREAD_RUN(dwc_thread_function_t func, char *name, void *data); -+#define dwc_thread_run(_ctx_,_func_,_name_,_data_) DWC_THREAD_RUN(_func_, _name_, _data_) -+ -+/** Stops a thread. Return the value returned by the thread. Or will return -+ * DWC_ABORT if the thread never started. */ -+extern int DWC_THREAD_STOP(dwc_thread_t *thread); -+#define dwc_thread_stop DWC_THREAD_STOP -+ -+/** Signifies to the thread that it must stop. */ -+#ifdef DWC_LINUX -+/* Linux doesn't need any parameters for kthread_should_stop() */ -+extern dwc_bool_t DWC_THREAD_SHOULD_STOP(void); -+#define dwc_thread_should_stop(_thrd_) DWC_THREAD_SHOULD_STOP() -+ -+/* No thread_exit function in Linux */ -+#define dwc_thread_exit(_thrd_) -+#endif -+ -+#if defined(DWC_FREEBSD) || defined(DWC_NETBSD) -+/** BSD needs the thread pointer for kthread_suspend_check() */ -+extern dwc_bool_t DWC_THREAD_SHOULD_STOP(dwc_thread_t *thread); -+#define dwc_thread_should_stop DWC_THREAD_SHOULD_STOP -+ -+/** The thread must call this to exit. */ -+extern void DWC_THREAD_EXIT(dwc_thread_t *thread); -+#define dwc_thread_exit DWC_THREAD_EXIT -+#endif -+ -+ -+/** @name Work queues -+ * -+ * Workqs are used to queue a callback function to be called at some later time, -+ * in another thread. */ -+struct dwc_workq; -+ -+/** Type for a workq */ -+typedef struct dwc_workq dwc_workq_t; -+ -+/** The type of the callback function to be called. */ -+typedef void (*dwc_work_callback_t)(void *data); -+ -+/** Allocate a workq */ -+extern dwc_workq_t *DWC_WORKQ_ALLOC(char *name); -+#define dwc_workq_alloc(_ctx_,_name_) DWC_WORKQ_ALLOC(_name_) -+ -+/** Free a workq. All work must be completed before being freed. */ -+extern void DWC_WORKQ_FREE(dwc_workq_t *workq); -+#define dwc_workq_free DWC_WORKQ_FREE -+ -+/** Schedule a callback on the workq, passing in data. The function will be -+ * scheduled at some later time. */ -+extern void DWC_WORKQ_SCHEDULE(dwc_workq_t *workq, dwc_work_callback_t cb, -+ void *data, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 4, 5))); -+#else -+ ; -+#endif -+#define dwc_workq_schedule DWC_WORKQ_SCHEDULE -+ -+/** Schedule a callback on the workq, that will be called until at least -+ * given number miliseconds have passed. */ -+extern void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *workq, dwc_work_callback_t cb, -+ void *data, uint32_t time, char *format, ...) -+#ifdef __GNUC__ -+ __attribute__ ((format(printf, 5, 6))); -+#else -+ ; -+#endif -+#define dwc_workq_schedule_delayed DWC_WORKQ_SCHEDULE_DELAYED -+ -+/** The number of processes in the workq */ -+extern int DWC_WORKQ_PENDING(dwc_workq_t *workq); -+#define dwc_workq_pending DWC_WORKQ_PENDING -+ -+/** Blocks until all the work in the workq is complete or timed out. Returns < -+ * 0 on timeout. */ -+extern int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout); -+#define dwc_workq_wait_work_done DWC_WORKQ_WAIT_WORK_DONE -+ -+ -+/** @name Tasklets -+ * -+ */ -+struct dwc_tasklet; -+ -+/** Type for a tasklet */ -+typedef struct dwc_tasklet dwc_tasklet_t; -+ -+/** The type of the callback function to be called */ -+typedef void (*dwc_tasklet_callback_t)(void *data); -+ -+/** Allocates a tasklet */ -+extern dwc_tasklet_t *DWC_TASK_ALLOC(char *name, dwc_tasklet_callback_t cb, void *data); -+#define dwc_task_alloc(_ctx_,_name_,_cb_,_data_) DWC_TASK_ALLOC(_name_, _cb_, _data_) -+ -+/** Frees a tasklet */ -+extern void DWC_TASK_FREE(dwc_tasklet_t *task); -+#define dwc_task_free DWC_TASK_FREE -+ -+/** Schedules a tasklet to run */ -+extern void DWC_TASK_SCHEDULE(dwc_tasklet_t *task); -+#define dwc_task_schedule DWC_TASK_SCHEDULE -+ -+extern void DWC_TASK_HI_SCHEDULE(dwc_tasklet_t *task); -+#define dwc_task_hi_schedule DWC_TASK_HI_SCHEDULE -+ -+/** @name Timer -+ * -+ * Callbacks must be small and atomic. -+ */ -+struct dwc_timer; -+ -+/** Type for a timer */ -+typedef struct dwc_timer dwc_timer_t; -+ -+/** The type of the callback function to be called */ -+typedef void (*dwc_timer_callback_t)(void *data); -+ -+/** Allocates a timer */ -+extern dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data); -+#define dwc_timer_alloc(_ctx_,_name_,_cb_,_data_) DWC_TIMER_ALLOC(_name_,_cb_,_data_) -+ -+/** Frees a timer */ -+extern void DWC_TIMER_FREE(dwc_timer_t *timer); -+#define dwc_timer_free DWC_TIMER_FREE -+ -+/** Schedules the timer to run at time ms from now. And will repeat at every -+ * repeat_interval msec therafter -+ * -+ * Modifies a timer that is still awaiting execution to a new expiration time. -+ * The mod_time is added to the old time. */ -+extern void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time); -+#define dwc_timer_schedule DWC_TIMER_SCHEDULE -+ -+/** Disables the timer from execution. */ -+extern void DWC_TIMER_CANCEL(dwc_timer_t *timer); -+#define dwc_timer_cancel DWC_TIMER_CANCEL -+ -+ -+/** @name Spinlocks -+ * -+ * These locks are used when the work between the lock/unlock is atomic and -+ * short. Interrupts are also disabled during the lock/unlock and thus they are -+ * suitable to lock between interrupt/non-interrupt context. They also lock -+ * between processes if you have multiple CPUs or Preemption. If you don't have -+ * multiple CPUS or Preemption, then the you can simply implement the -+ * DWC_SPINLOCK and DWC_SPINUNLOCK to disable and enable interrupts. Because -+ * the work between the lock/unlock is atomic, the process context will never -+ * change, and so you never have to lock between processes. */ -+ -+struct dwc_spinlock; -+ -+/** Type for a spinlock */ -+typedef struct dwc_spinlock dwc_spinlock_t; -+ -+/** Type for the 'flags' argument to spinlock funtions */ -+typedef unsigned long dwc_irqflags_t; -+ -+/** Returns an initialized lock variable. This function should allocate and -+ * initialize the OS-specific data structure used for locking. This data -+ * structure is to be used for the DWC_LOCK and DWC_UNLOCK functions and should -+ * be freed by the DWC_FREE_LOCK when it is no longer used. -+ * -+ * For Linux Spinlock Debugging make it macro because the debugging routines use -+ * the symbol name to determine recursive locking. Using a wrapper function -+ * makes it falsely think recursive locking occurs. */ -+#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK) -+#define DWC_SPINLOCK_ALLOC_LINUX_DEBUG(lock) ({ \ -+ lock = DWC_ALLOC(sizeof(spinlock_t)); \ -+ if (lock) { \ -+ spin_lock_init((spinlock_t *)lock); \ -+ } \ -+}) -+#else -+extern dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void); -+#define dwc_spinlock_alloc(_ctx_) DWC_SPINLOCK_ALLOC() -+#endif -+ -+/** Frees an initialized lock variable. */ -+extern void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock); -+#define dwc_spinlock_free(_ctx_,_lock_) DWC_SPINLOCK_FREE(_lock_) -+ -+/** Disables interrupts and blocks until it acquires the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ * @param flags Unsigned long for irq flags storage. -+ */ -+extern void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, dwc_irqflags_t *flags); -+#define dwc_spinlock_irqsave DWC_SPINLOCK_IRQSAVE -+ -+/** Re-enables the interrupt and releases the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ * @param flags Unsigned long for irq flags storage. Must be the same as was -+ * passed into DWC_LOCK. -+ */ -+extern void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, dwc_irqflags_t flags); -+#define dwc_spinunlock_irqrestore DWC_SPINUNLOCK_IRQRESTORE -+ -+/** Blocks until it acquires the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ */ -+extern void DWC_SPINLOCK(dwc_spinlock_t *lock); -+#define dwc_spinlock DWC_SPINLOCK -+ -+/** Releases the lock. -+ * -+ * @param lock Pointer to the spinlock. -+ */ -+extern void DWC_SPINUNLOCK(dwc_spinlock_t *lock); -+#define dwc_spinunlock DWC_SPINUNLOCK -+ -+ -+/** @name Mutexes -+ * -+ * Unlike spinlocks Mutexes lock only between processes and the work between the -+ * lock/unlock CAN block, therefore it CANNOT be called from interrupt context. -+ */ -+ -+struct dwc_mutex; -+ -+/** Type for a mutex */ -+typedef struct dwc_mutex dwc_mutex_t; -+ -+/* For Linux Mutex Debugging make it inline because the debugging routines use -+ * the symbol to determine recursive locking. This makes it falsely think -+ * recursive locking occurs. */ -+#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) -+#define DWC_MUTEX_ALLOC_LINUX_DEBUG(__mutexp) ({ \ -+ __mutexp = (dwc_mutex_t *)DWC_ALLOC(sizeof(struct mutex)); \ -+ mutex_init((struct mutex *)__mutexp); \ -+}) -+#endif -+ -+/** Allocate a mutex */ -+extern dwc_mutex_t *DWC_MUTEX_ALLOC(void); -+#define dwc_mutex_alloc(_ctx_) DWC_MUTEX_ALLOC() -+ -+/* For memory leak debugging when using Linux Mutex Debugging */ -+#if defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES) -+#define DWC_MUTEX_FREE(__mutexp) do { \ -+ mutex_destroy((struct mutex *)__mutexp); \ -+ DWC_FREE(__mutexp); \ -+} while(0) -+#else -+/** Free a mutex */ -+extern void DWC_MUTEX_FREE(dwc_mutex_t *mutex); -+#define dwc_mutex_free(_ctx_,_mutex_) DWC_MUTEX_FREE(_mutex_) -+#endif -+ -+/** Lock a mutex */ -+extern void DWC_MUTEX_LOCK(dwc_mutex_t *mutex); -+#define dwc_mutex_lock DWC_MUTEX_LOCK -+ -+/** Non-blocking lock returns 1 on successful lock. */ -+extern int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex); -+#define dwc_mutex_trylock DWC_MUTEX_TRYLOCK -+ -+/** Unlock a mutex */ -+extern void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex); -+#define dwc_mutex_unlock DWC_MUTEX_UNLOCK -+ -+ -+/** @name Time */ -+ -+/** Microsecond delay. -+ * -+ * @param usecs Microseconds to delay. -+ */ -+extern void DWC_UDELAY(uint32_t usecs); -+#define dwc_udelay DWC_UDELAY -+ -+/** Millisecond delay. -+ * -+ * @param msecs Milliseconds to delay. -+ */ -+extern void DWC_MDELAY(uint32_t msecs); -+#define dwc_mdelay DWC_MDELAY -+ -+/** Non-busy waiting. -+ * Sleeps for specified number of milliseconds. -+ * -+ * @param msecs Milliseconds to sleep. -+ */ -+extern void DWC_MSLEEP(uint32_t msecs); -+#define dwc_msleep DWC_MSLEEP -+ -+/** -+ * Returns number of milliseconds since boot. -+ */ -+extern uint32_t DWC_TIME(void); -+#define dwc_time DWC_TIME -+ -+ -+ -+ -+/* @mainpage DWC Portability and Common Library -+ * -+ * This is the documentation for the DWC Portability and Common Library. -+ * -+ * @section intro Introduction -+ * -+ * The DWC Portability library consists of wrapper calls and data structures to -+ * all low-level functions which are typically provided by the OS. The WUDEV -+ * driver uses only these functions. In order to port the WUDEV driver, only -+ * the functions in this library need to be re-implemented, with the same -+ * behavior as documented here. -+ * -+ * The Common library consists of higher level functions, which rely only on -+ * calling the functions from the DWC Portability library. These common -+ * routines are shared across modules. Some of the common libraries need to be -+ * used directly by the driver programmer when porting WUDEV. Such as the -+ * parameter and notification libraries. -+ * -+ * @section low Portability Library OS Wrapper Functions -+ * -+ * Any function starting with DWC and in all CAPS is a low-level OS-wrapper that -+ * needs to be implemented when porting, for example DWC_MUTEX_ALLOC(). All of -+ * these functions are included in the dwc_os.h file. -+ * -+ * There are many functions here covering a wide array of OS services. Please -+ * see dwc_os.h for details, and implementation notes for each function. -+ * -+ * @section common Common Library Functions -+ * -+ * Any function starting with dwc and in all lowercase is a common library -+ * routine. These functions have a portable implementation and do not need to -+ * be reimplemented when porting. The common routines can be used by any -+ * driver, and some must be used by the end user to control the drivers. For -+ * example, you must use the Parameter common library in order to set the -+ * parameters in the WUDEV module. -+ * -+ * The common libraries consist of the following: -+ * -+ * - Connection Contexts - Used internally and can be used by end-user. See dwc_cc.h -+ * - Parameters - Used internally and can be used by end-user. See dwc_params.h -+ * - Notifications - Used internally and can be used by end-user. See dwc_notifier.h -+ * - Lists - Used internally and can be used by end-user. See dwc_list.h -+ * - Memory Debugging - Used internally and can be used by end-user. See dwc_os.h -+ * - Modpow - Used internally only. See dwc_modpow.h -+ * - DH - Used internally only. See dwc_dh.h -+ * - Crypto - Used internally only. See dwc_crypto.h -+ * -+ * -+ * @section prereq Prerequistes For dwc_os.h -+ * @subsection types Data Types -+ * -+ * The dwc_os.h file assumes that several low-level data types are pre defined for the -+ * compilation environment. These data types are: -+ * -+ * - uint8_t - unsigned 8-bit data type -+ * - int8_t - signed 8-bit data type -+ * - uint16_t - unsigned 16-bit data type -+ * - int16_t - signed 16-bit data type -+ * - uint32_t - unsigned 32-bit data type -+ * - int32_t - signed 32-bit data type -+ * - uint64_t - unsigned 64-bit data type -+ * - int64_t - signed 64-bit data type -+ * -+ * Ensure that these are defined before using dwc_os.h. The easiest way to do -+ * that is to modify the top of the file to include the appropriate header. -+ * This is already done for the Linux environment. If the DWC_LINUX macro is -+ * defined, the correct header will be added. A standard header is -+ * also used for environments where standard C headers are available. -+ * -+ * @subsection stdarg Variable Arguments -+ * -+ * Variable arguments are provided by a standard C header . it is -+ * available in Both the Linux and ANSI C enviornment. An equivalent must be -+ * provided in your enviornment in order to use dwc_os.h with the debug and -+ * tracing message functionality. -+ * -+ * @subsection thread Threading -+ * -+ * WUDEV Core must be run on an operating system that provides for multiple -+ * threads/processes. Threading can be implemented in many ways, even in -+ * embedded systems without an operating system. At the bare minimum, the -+ * system should be able to start any number of processes at any time to handle -+ * special work. It need not be a pre-emptive system. Process context can -+ * change upon a call to a blocking function. The hardware interrupt context -+ * that calls the module's ISR() function must be differentiable from process -+ * context, even if your processes are impemented via a hardware interrupt. -+ * Further locking mechanism between process must exist (or be implemented), and -+ * process context must have a way to disable interrupts for a period of time to -+ * lock them out. If all of this exists, the functions in dwc_os.h related to -+ * threading should be able to be implemented with the defined behavior. -+ * -+ */ -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _DWC_OS_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/usb.h b/drivers/usb/host/dwc_common_port/usb.h -new file mode 100644 -index 0000000000000000000000000000000000000000..27bda82dac2eb27923120c43aac3610974610221 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/usb.h -@@ -0,0 +1,946 @@ -+/* -+ * Copyright (c) 1998 The NetBSD Foundation, Inc. -+ * All rights reserved. -+ * -+ * This code is derived from software contributed to The NetBSD Foundation -+ * by Lennart Augustsson (lennart@augustsson.net) at -+ * Carlstedt Research & Technology. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. All advertising materials mentioning features or use of this software -+ * must display the following acknowledgement: -+ * This product includes software developed by the NetBSD -+ * Foundation, Inc. and its contributors. -+ * 4. Neither the name of The NetBSD Foundation nor the names of its -+ * contributors may be used to endorse or promote products derived -+ * from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+/* Modified by Synopsys, Inc, 12/12/2007 */ -+ -+ -+#ifndef _USB_H_ -+#define _USB_H_ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* -+ * The USB records contain some unaligned little-endian word -+ * components. The U[SG]ETW macros take care of both the alignment -+ * and endian problem and should always be used to access non-byte -+ * values. -+ */ -+typedef u_int8_t uByte; -+typedef u_int8_t uWord[2]; -+typedef u_int8_t uDWord[4]; -+ -+#define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h)) -+#define UCONSTW(x) { (x) & 0xff, ((x) >> 8) & 0xff } -+#define UCONSTDW(x) { (x) & 0xff, ((x) >> 8) & 0xff, \ -+ ((x) >> 16) & 0xff, ((x) >> 24) & 0xff } -+ -+#if 1 -+#define UGETW(w) ((w)[0] | ((w)[1] << 8)) -+#define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8)) -+#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24)) -+#define USETDW(w,v) ((w)[0] = (u_int8_t)(v), \ -+ (w)[1] = (u_int8_t)((v) >> 8), \ -+ (w)[2] = (u_int8_t)((v) >> 16), \ -+ (w)[3] = (u_int8_t)((v) >> 24)) -+#else -+/* -+ * On little-endian machines that can handle unanliged accesses -+ * (e.g. i386) these macros can be replaced by the following. -+ */ -+#define UGETW(w) (*(u_int16_t *)(w)) -+#define USETW(w,v) (*(u_int16_t *)(w) = (v)) -+#define UGETDW(w) (*(u_int32_t *)(w)) -+#define USETDW(w,v) (*(u_int32_t *)(w) = (v)) -+#endif -+ -+/* -+ * Macros for accessing UAS IU fields, which are big-endian -+ */ -+#define IUSETW2(w,h,l) ((w)[0] = (u_int8_t)(h), (w)[1] = (u_int8_t)(l)) -+#define IUCONSTW(x) { ((x) >> 8) & 0xff, (x) & 0xff } -+#define IUCONSTDW(x) { ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ -+ ((x) >> 8) & 0xff, (x) & 0xff } -+#define IUGETW(w) (((w)[0] << 8) | (w)[1]) -+#define IUSETW(w,v) ((w)[0] = (u_int8_t)((v) >> 8), (w)[1] = (u_int8_t)(v)) -+#define IUGETDW(w) (((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) -+#define IUSETDW(w,v) ((w)[0] = (u_int8_t)((v) >> 24), \ -+ (w)[1] = (u_int8_t)((v) >> 16), \ -+ (w)[2] = (u_int8_t)((v) >> 8), \ -+ (w)[3] = (u_int8_t)(v)) -+ -+#define UPACKED __attribute__((__packed__)) -+ -+typedef struct { -+ uByte bmRequestType; -+ uByte bRequest; -+ uWord wValue; -+ uWord wIndex; -+ uWord wLength; -+} UPACKED usb_device_request_t; -+ -+#define UT_GET_DIR(a) ((a) & 0x80) -+#define UT_WRITE 0x00 -+#define UT_READ 0x80 -+ -+#define UT_GET_TYPE(a) ((a) & 0x60) -+#define UT_STANDARD 0x00 -+#define UT_CLASS 0x20 -+#define UT_VENDOR 0x40 -+ -+#define UT_GET_RECIPIENT(a) ((a) & 0x1f) -+#define UT_DEVICE 0x00 -+#define UT_INTERFACE 0x01 -+#define UT_ENDPOINT 0x02 -+#define UT_OTHER 0x03 -+ -+#define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE) -+#define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE) -+#define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT) -+#define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE) -+#define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE) -+#define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT) -+#define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE) -+#define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE) -+#define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER) -+#define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT) -+#define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE) -+#define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE) -+#define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER) -+#define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT) -+#define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) -+#define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE) -+#define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER) -+#define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT) -+#define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE) -+#define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE) -+#define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER) -+#define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT) -+ -+/* Requests */ -+#define UR_GET_STATUS 0x00 -+#define USTAT_STANDARD_STATUS 0x00 -+#define WUSTAT_WUSB_FEATURE 0x01 -+#define WUSTAT_CHANNEL_INFO 0x02 -+#define WUSTAT_RECEIVED_DATA 0x03 -+#define WUSTAT_MAS_AVAILABILITY 0x04 -+#define WUSTAT_CURRENT_TRANSMIT_POWER 0x05 -+#define UR_CLEAR_FEATURE 0x01 -+#define UR_SET_FEATURE 0x03 -+#define UR_SET_AND_TEST_FEATURE 0x0c -+#define UR_SET_ADDRESS 0x05 -+#define UR_GET_DESCRIPTOR 0x06 -+#define UDESC_DEVICE 0x01 -+#define UDESC_CONFIG 0x02 -+#define UDESC_STRING 0x03 -+#define UDESC_INTERFACE 0x04 -+#define UDESC_ENDPOINT 0x05 -+#define UDESC_SS_USB_COMPANION 0x30 -+#define UDESC_DEVICE_QUALIFIER 0x06 -+#define UDESC_OTHER_SPEED_CONFIGURATION 0x07 -+#define UDESC_INTERFACE_POWER 0x08 -+#define UDESC_OTG 0x09 -+#define WUDESC_SECURITY 0x0c -+#define WUDESC_KEY 0x0d -+#define WUD_GET_KEY_INDEX(_wValue_) ((_wValue_) & 0xf) -+#define WUD_GET_KEY_TYPE(_wValue_) (((_wValue_) & 0x30) >> 4) -+#define WUD_KEY_TYPE_ASSOC 0x01 -+#define WUD_KEY_TYPE_GTK 0x02 -+#define WUD_GET_KEY_ORIGIN(_wValue_) (((_wValue_) & 0x40) >> 6) -+#define WUD_KEY_ORIGIN_HOST 0x00 -+#define WUD_KEY_ORIGIN_DEVICE 0x01 -+#define WUDESC_ENCRYPTION_TYPE 0x0e -+#define WUDESC_BOS 0x0f -+#define WUDESC_DEVICE_CAPABILITY 0x10 -+#define WUDESC_WIRELESS_ENDPOINT_COMPANION 0x11 -+#define UDESC_BOS 0x0f -+#define UDESC_DEVICE_CAPABILITY 0x10 -+#define UDESC_CS_DEVICE 0x21 /* class specific */ -+#define UDESC_CS_CONFIG 0x22 -+#define UDESC_CS_STRING 0x23 -+#define UDESC_CS_INTERFACE 0x24 -+#define UDESC_CS_ENDPOINT 0x25 -+#define UDESC_HUB 0x29 -+#define UR_SET_DESCRIPTOR 0x07 -+#define UR_GET_CONFIG 0x08 -+#define UR_SET_CONFIG 0x09 -+#define UR_GET_INTERFACE 0x0a -+#define UR_SET_INTERFACE 0x0b -+#define UR_SYNCH_FRAME 0x0c -+#define WUR_SET_ENCRYPTION 0x0d -+#define WUR_GET_ENCRYPTION 0x0e -+#define WUR_SET_HANDSHAKE 0x0f -+#define WUR_GET_HANDSHAKE 0x10 -+#define WUR_SET_CONNECTION 0x11 -+#define WUR_SET_SECURITY_DATA 0x12 -+#define WUR_GET_SECURITY_DATA 0x13 -+#define WUR_SET_WUSB_DATA 0x14 -+#define WUDATA_DRPIE_INFO 0x01 -+#define WUDATA_TRANSMIT_DATA 0x02 -+#define WUDATA_TRANSMIT_PARAMS 0x03 -+#define WUDATA_RECEIVE_PARAMS 0x04 -+#define WUDATA_TRANSMIT_POWER 0x05 -+#define WUR_LOOPBACK_DATA_WRITE 0x15 -+#define WUR_LOOPBACK_DATA_READ 0x16 -+#define WUR_SET_INTERFACE_DS 0x17 -+ -+/* Feature numbers */ -+#define UF_ENDPOINT_HALT 0 -+#define UF_DEVICE_REMOTE_WAKEUP 1 -+#define UF_TEST_MODE 2 -+#define UF_DEVICE_B_HNP_ENABLE 3 -+#define UF_DEVICE_A_HNP_SUPPORT 4 -+#define UF_DEVICE_A_ALT_HNP_SUPPORT 5 -+#define WUF_WUSB 3 -+#define WUF_TX_DRPIE 0x0 -+#define WUF_DEV_XMIT_PACKET 0x1 -+#define WUF_COUNT_PACKETS 0x2 -+#define WUF_CAPTURE_PACKETS 0x3 -+#define UF_FUNCTION_SUSPEND 0 -+#define UF_U1_ENABLE 48 -+#define UF_U2_ENABLE 49 -+#define UF_LTM_ENABLE 50 -+ -+/* Class requests from the USB 2.0 hub spec, table 11-15 */ -+#define UCR_CLEAR_HUB_FEATURE (0x2000 | UR_CLEAR_FEATURE) -+#define UCR_CLEAR_PORT_FEATURE (0x2300 | UR_CLEAR_FEATURE) -+#define UCR_GET_HUB_DESCRIPTOR (0xa000 | UR_GET_DESCRIPTOR) -+#define UCR_GET_HUB_STATUS (0xa000 | UR_GET_STATUS) -+#define UCR_GET_PORT_STATUS (0xa300 | UR_GET_STATUS) -+#define UCR_SET_HUB_FEATURE (0x2000 | UR_SET_FEATURE) -+#define UCR_SET_PORT_FEATURE (0x2300 | UR_SET_FEATURE) -+#define UCR_SET_AND_TEST_PORT_FEATURE (0xa300 | UR_SET_AND_TEST_FEATURE) -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDescriptorSubtype; -+} UPACKED usb_descriptor_t; -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+} UPACKED usb_descriptor_header_t; -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord bcdUSB; -+#define UD_USB_2_0 0x0200 -+#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0) -+ uByte bDeviceClass; -+ uByte bDeviceSubClass; -+ uByte bDeviceProtocol; -+ uByte bMaxPacketSize; -+ /* The fields below are not part of the initial descriptor. */ -+ uWord idVendor; -+ uWord idProduct; -+ uWord bcdDevice; -+ uByte iManufacturer; -+ uByte iProduct; -+ uByte iSerialNumber; -+ uByte bNumConfigurations; -+} UPACKED usb_device_descriptor_t; -+#define USB_DEVICE_DESCRIPTOR_SIZE 18 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord wTotalLength; -+ uByte bNumInterface; -+ uByte bConfigurationValue; -+ uByte iConfiguration; -+#define UC_ATT_ONE (1 << 7) /* must be set */ -+#define UC_ATT_SELFPOWER (1 << 6) /* self powered */ -+#define UC_ATT_WAKEUP (1 << 5) /* can wakeup */ -+#define UC_ATT_BATTERY (1 << 4) /* battery powered */ -+ uByte bmAttributes; -+#define UC_BUS_POWERED 0x80 -+#define UC_SELF_POWERED 0x40 -+#define UC_REMOTE_WAKEUP 0x20 -+ uByte bMaxPower; /* max current in 2 mA units */ -+#define UC_POWER_FACTOR 2 -+} UPACKED usb_config_descriptor_t; -+#define USB_CONFIG_DESCRIPTOR_SIZE 9 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bInterfaceNumber; -+ uByte bAlternateSetting; -+ uByte bNumEndpoints; -+ uByte bInterfaceClass; -+ uByte bInterfaceSubClass; -+ uByte bInterfaceProtocol; -+ uByte iInterface; -+} UPACKED usb_interface_descriptor_t; -+#define USB_INTERFACE_DESCRIPTOR_SIZE 9 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bEndpointAddress; -+#define UE_GET_DIR(a) ((a) & 0x80) -+#define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) -+#define UE_DIR_IN 0x80 -+#define UE_DIR_OUT 0x00 -+#define UE_ADDR 0x0f -+#define UE_GET_ADDR(a) ((a) & UE_ADDR) -+ uByte bmAttributes; -+#define UE_XFERTYPE 0x03 -+#define UE_CONTROL 0x00 -+#define UE_ISOCHRONOUS 0x01 -+#define UE_BULK 0x02 -+#define UE_INTERRUPT 0x03 -+#define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE) -+#define UE_ISO_TYPE 0x0c -+#define UE_ISO_ASYNC 0x04 -+#define UE_ISO_ADAPT 0x08 -+#define UE_ISO_SYNC 0x0c -+#define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE) -+ uWord wMaxPacketSize; -+ uByte bInterval; -+} UPACKED usb_endpoint_descriptor_t; -+#define USB_ENDPOINT_DESCRIPTOR_SIZE 7 -+ -+typedef struct ss_endpoint_companion_descriptor { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bMaxBurst; -+#define USSE_GET_MAX_STREAMS(a) ((a) & 0x1f) -+#define USSE_SET_MAX_STREAMS(a, b) ((a) | ((b) & 0x1f)) -+#define USSE_GET_MAX_PACKET_NUM(a) ((a) & 0x03) -+#define USSE_SET_MAX_PACKET_NUM(a, b) ((a) | ((b) & 0x03)) -+ uByte bmAttributes; -+ uWord wBytesPerInterval; -+} UPACKED ss_endpoint_companion_descriptor_t; -+#define USB_SS_ENDPOINT_COMPANION_DESCRIPTOR_SIZE 6 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord bString[127]; -+} UPACKED usb_string_descriptor_t; -+#define USB_MAX_STRING_LEN 128 -+#define USB_LANGUAGE_TABLE 0 /* # of the string language id table */ -+ -+/* Hub specific request */ -+#define UR_GET_BUS_STATE 0x02 -+#define UR_CLEAR_TT_BUFFER 0x08 -+#define UR_RESET_TT 0x09 -+#define UR_GET_TT_STATE 0x0a -+#define UR_STOP_TT 0x0b -+ -+/* Hub features */ -+#define UHF_C_HUB_LOCAL_POWER 0 -+#define UHF_C_HUB_OVER_CURRENT 1 -+#define UHF_PORT_CONNECTION 0 -+#define UHF_PORT_ENABLE 1 -+#define UHF_PORT_SUSPEND 2 -+#define UHF_PORT_OVER_CURRENT 3 -+#define UHF_PORT_RESET 4 -+#define UHF_PORT_L1 5 -+#define UHF_PORT_POWER 8 -+#define UHF_PORT_LOW_SPEED 9 -+#define UHF_PORT_HIGH_SPEED 10 -+#define UHF_C_PORT_CONNECTION 16 -+#define UHF_C_PORT_ENABLE 17 -+#define UHF_C_PORT_SUSPEND 18 -+#define UHF_C_PORT_OVER_CURRENT 19 -+#define UHF_C_PORT_RESET 20 -+#define UHF_C_PORT_L1 23 -+#define UHF_PORT_TEST 21 -+#define UHF_PORT_INDICATOR 22 -+ -+typedef struct { -+ uByte bDescLength; -+ uByte bDescriptorType; -+ uByte bNbrPorts; -+ uWord wHubCharacteristics; -+#define UHD_PWR 0x0003 -+#define UHD_PWR_GANGED 0x0000 -+#define UHD_PWR_INDIVIDUAL 0x0001 -+#define UHD_PWR_NO_SWITCH 0x0002 -+#define UHD_COMPOUND 0x0004 -+#define UHD_OC 0x0018 -+#define UHD_OC_GLOBAL 0x0000 -+#define UHD_OC_INDIVIDUAL 0x0008 -+#define UHD_OC_NONE 0x0010 -+#define UHD_TT_THINK 0x0060 -+#define UHD_TT_THINK_8 0x0000 -+#define UHD_TT_THINK_16 0x0020 -+#define UHD_TT_THINK_24 0x0040 -+#define UHD_TT_THINK_32 0x0060 -+#define UHD_PORT_IND 0x0080 -+ uByte bPwrOn2PwrGood; /* delay in 2 ms units */ -+#define UHD_PWRON_FACTOR 2 -+ uByte bHubContrCurrent; -+ uByte DeviceRemovable[32]; /* max 255 ports */ -+#define UHD_NOT_REMOV(desc, i) \ -+ (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1) -+ /* deprecated */ uByte PortPowerCtrlMask[1]; -+} UPACKED usb_hub_descriptor_t; -+#define USB_HUB_DESCRIPTOR_SIZE 9 /* includes deprecated PortPowerCtrlMask */ -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord bcdUSB; -+ uByte bDeviceClass; -+ uByte bDeviceSubClass; -+ uByte bDeviceProtocol; -+ uByte bMaxPacketSize0; -+ uByte bNumConfigurations; -+ uByte bReserved; -+} UPACKED usb_device_qualifier_t; -+#define USB_DEVICE_QUALIFIER_SIZE 10 -+ -+typedef struct { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bmAttributes; -+#define UOTG_SRP 0x01 -+#define UOTG_HNP 0x02 -+} UPACKED usb_otg_descriptor_t; -+ -+/* OTG feature selectors */ -+#define UOTG_B_HNP_ENABLE 3 -+#define UOTG_A_HNP_SUPPORT 4 -+#define UOTG_A_ALT_HNP_SUPPORT 5 -+ -+typedef struct { -+ uWord wStatus; -+/* Device status flags */ -+#define UDS_SELF_POWERED 0x0001 -+#define UDS_REMOTE_WAKEUP 0x0002 -+/* Endpoint status flags */ -+#define UES_HALT 0x0001 -+} UPACKED usb_status_t; -+ -+typedef struct { -+ uWord wHubStatus; -+#define UHS_LOCAL_POWER 0x0001 -+#define UHS_OVER_CURRENT 0x0002 -+ uWord wHubChange; -+} UPACKED usb_hub_status_t; -+ -+typedef struct { -+ uWord wPortStatus; -+#define UPS_CURRENT_CONNECT_STATUS 0x0001 -+#define UPS_PORT_ENABLED 0x0002 -+#define UPS_SUSPEND 0x0004 -+#define UPS_OVERCURRENT_INDICATOR 0x0008 -+#define UPS_RESET 0x0010 -+#define UPS_PORT_POWER 0x0100 -+#define UPS_LOW_SPEED 0x0200 -+#define UPS_HIGH_SPEED 0x0400 -+#define UPS_PORT_TEST 0x0800 -+#define UPS_PORT_INDICATOR 0x1000 -+ uWord wPortChange; -+#define UPS_C_CONNECT_STATUS 0x0001 -+#define UPS_C_PORT_ENABLED 0x0002 -+#define UPS_C_SUSPEND 0x0004 -+#define UPS_C_OVERCURRENT_INDICATOR 0x0008 -+#define UPS_C_PORT_RESET 0x0010 -+} UPACKED usb_port_status_t; -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+/* Device class codes */ -+#define UDCLASS_IN_INTERFACE 0x00 -+#define UDCLASS_COMM 0x02 -+#define UDCLASS_HUB 0x09 -+#define UDSUBCLASS_HUB 0x00 -+#define UDPROTO_FSHUB 0x00 -+#define UDPROTO_HSHUBSTT 0x01 -+#define UDPROTO_HSHUBMTT 0x02 -+#define UDCLASS_DIAGNOSTIC 0xdc -+#define UDCLASS_WIRELESS 0xe0 -+#define UDSUBCLASS_RF 0x01 -+#define UDPROTO_BLUETOOTH 0x01 -+#define UDCLASS_VENDOR 0xff -+ -+/* Interface class codes */ -+#define UICLASS_UNSPEC 0x00 -+ -+#define UICLASS_AUDIO 0x01 -+#define UISUBCLASS_AUDIOCONTROL 1 -+#define UISUBCLASS_AUDIOSTREAM 2 -+#define UISUBCLASS_MIDISTREAM 3 -+ -+#define UICLASS_CDC 0x02 /* communication */ -+#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1 -+#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2 -+#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3 -+#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4 -+#define UISUBCLASS_CAPI_CONTROLMODEL 5 -+#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6 -+#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7 -+#define UIPROTO_CDC_AT 1 -+ -+#define UICLASS_HID 0x03 -+#define UISUBCLASS_BOOT 1 -+#define UIPROTO_BOOT_KEYBOARD 1 -+ -+#define UICLASS_PHYSICAL 0x05 -+ -+#define UICLASS_IMAGE 0x06 -+ -+#define UICLASS_PRINTER 0x07 -+#define UISUBCLASS_PRINTER 1 -+#define UIPROTO_PRINTER_UNI 1 -+#define UIPROTO_PRINTER_BI 2 -+#define UIPROTO_PRINTER_1284 3 -+ -+#define UICLASS_MASS 0x08 -+#define UISUBCLASS_RBC 1 -+#define UISUBCLASS_SFF8020I 2 -+#define UISUBCLASS_QIC157 3 -+#define UISUBCLASS_UFI 4 -+#define UISUBCLASS_SFF8070I 5 -+#define UISUBCLASS_SCSI 6 -+#define UIPROTO_MASS_CBI_I 0 -+#define UIPROTO_MASS_CBI 1 -+#define UIPROTO_MASS_BBB_OLD 2 /* Not in the spec anymore */ -+#define UIPROTO_MASS_BBB 80 /* 'P' for the Iomega Zip drive */ -+ -+#define UICLASS_HUB 0x09 -+#define UISUBCLASS_HUB 0 -+#define UIPROTO_FSHUB 0 -+#define UIPROTO_HSHUBSTT 0 /* Yes, same as previous */ -+#define UIPROTO_HSHUBMTT 1 -+ -+#define UICLASS_CDC_DATA 0x0a -+#define UISUBCLASS_DATA 0 -+#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */ -+#define UIPROTO_DATA_HDLC 0x31 /* HDLC */ -+#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */ -+#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */ -+#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */ -+#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */ -+#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */ -+#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */ -+#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */ -+#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */ -+#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */ -+#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/ -+#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */ -+ -+#define UICLASS_SMARTCARD 0x0b -+ -+/*#define UICLASS_FIRM_UPD 0x0c*/ -+ -+#define UICLASS_SECURITY 0x0d -+ -+#define UICLASS_DIAGNOSTIC 0xdc -+ -+#define UICLASS_WIRELESS 0xe0 -+#define UISUBCLASS_RF 0x01 -+#define UIPROTO_BLUETOOTH 0x01 -+ -+#define UICLASS_APPL_SPEC 0xfe -+#define UISUBCLASS_FIRMWARE_DOWNLOAD 1 -+#define UISUBCLASS_IRDA 2 -+#define UIPROTO_IRDA 0 -+ -+#define UICLASS_VENDOR 0xff -+ -+#define USB_HUB_MAX_DEPTH 5 -+ -+/* -+ * Minimum time a device needs to be powered down to go through -+ * a power cycle. XXX Are these time in the spec? -+ */ -+#define USB_POWER_DOWN_TIME 200 /* ms */ -+#define USB_PORT_POWER_DOWN_TIME 100 /* ms */ -+ -+#if 0 -+/* These are the values from the spec. */ -+#define USB_PORT_RESET_DELAY 10 /* ms */ -+#define USB_PORT_ROOT_RESET_DELAY 50 /* ms */ -+#define USB_PORT_RESET_RECOVERY 10 /* ms */ -+#define USB_PORT_POWERUP_DELAY 100 /* ms */ -+#define USB_SET_ADDRESS_SETTLE 2 /* ms */ -+#define USB_RESUME_DELAY (20*5) /* ms */ -+#define USB_RESUME_WAIT 10 /* ms */ -+#define USB_RESUME_RECOVERY 10 /* ms */ -+#define USB_EXTRA_POWER_UP_TIME 0 /* ms */ -+#else -+/* Allow for marginal (i.e. non-conforming) devices. */ -+#define USB_PORT_RESET_DELAY 50 /* ms */ -+#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */ -+#define USB_PORT_RESET_RECOVERY 250 /* ms */ -+#define USB_PORT_POWERUP_DELAY 300 /* ms */ -+#define USB_SET_ADDRESS_SETTLE 10 /* ms */ -+#define USB_RESUME_DELAY (50*5) /* ms */ -+#define USB_RESUME_WAIT 50 /* ms */ -+#define USB_RESUME_RECOVERY 50 /* ms */ -+#define USB_EXTRA_POWER_UP_TIME 20 /* ms */ -+#endif -+ -+#define USB_MIN_POWER 100 /* mA */ -+#define USB_MAX_POWER 500 /* mA */ -+ -+#define USB_BUS_RESET_DELAY 100 /* ms XXX?*/ -+ -+#define USB_UNCONFIG_NO 0 -+#define USB_UNCONFIG_INDEX (-1) -+ -+/*** ioctl() related stuff ***/ -+ -+struct usb_ctl_request { -+ int ucr_addr; -+ usb_device_request_t ucr_request; -+ void *ucr_data; -+ int ucr_flags; -+#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ -+ int ucr_actlen; /* actual length transferred */ -+}; -+ -+struct usb_alt_interface { -+ int uai_config_index; -+ int uai_interface_index; -+ int uai_alt_no; -+}; -+ -+#define USB_CURRENT_CONFIG_INDEX (-1) -+#define USB_CURRENT_ALT_INDEX (-1) -+ -+struct usb_config_desc { -+ int ucd_config_index; -+ usb_config_descriptor_t ucd_desc; -+}; -+ -+struct usb_interface_desc { -+ int uid_config_index; -+ int uid_interface_index; -+ int uid_alt_index; -+ usb_interface_descriptor_t uid_desc; -+}; -+ -+struct usb_endpoint_desc { -+ int ued_config_index; -+ int ued_interface_index; -+ int ued_alt_index; -+ int ued_endpoint_index; -+ usb_endpoint_descriptor_t ued_desc; -+}; -+ -+struct usb_full_desc { -+ int ufd_config_index; -+ u_int ufd_size; -+ u_char *ufd_data; -+}; -+ -+struct usb_string_desc { -+ int usd_string_index; -+ int usd_language_id; -+ usb_string_descriptor_t usd_desc; -+}; -+ -+struct usb_ctl_report_desc { -+ int ucrd_size; -+ u_char ucrd_data[1024]; /* filled data size will vary */ -+}; -+ -+typedef struct { u_int32_t cookie; } usb_event_cookie_t; -+ -+#define USB_MAX_DEVNAMES 4 -+#define USB_MAX_DEVNAMELEN 16 -+struct usb_device_info { -+ u_int8_t udi_bus; -+ u_int8_t udi_addr; /* device address */ -+ usb_event_cookie_t udi_cookie; -+ char udi_product[USB_MAX_STRING_LEN]; -+ char udi_vendor[USB_MAX_STRING_LEN]; -+ char udi_release[8]; -+ u_int16_t udi_productNo; -+ u_int16_t udi_vendorNo; -+ u_int16_t udi_releaseNo; -+ u_int8_t udi_class; -+ u_int8_t udi_subclass; -+ u_int8_t udi_protocol; -+ u_int8_t udi_config; -+ u_int8_t udi_speed; -+#define USB_SPEED_UNKNOWN 0 -+#define USB_SPEED_LOW 1 -+#define USB_SPEED_FULL 2 -+#define USB_SPEED_HIGH 3 -+#define USB_SPEED_VARIABLE 4 -+#define USB_SPEED_SUPER 5 -+ int udi_power; /* power consumption in mA, 0 if selfpowered */ -+ int udi_nports; -+ char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; -+ u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */ -+#define USB_PORT_ENABLED 0xff -+#define USB_PORT_SUSPENDED 0xfe -+#define USB_PORT_POWERED 0xfd -+#define USB_PORT_DISABLED 0xfc -+}; -+ -+struct usb_ctl_report { -+ int ucr_report; -+ u_char ucr_data[1024]; /* filled data size will vary */ -+}; -+ -+struct usb_device_stats { -+ u_long uds_requests[4]; /* indexed by transfer type UE_* */ -+}; -+ -+#define WUSB_MIN_IE 0x80 -+#define WUSB_WCTA_IE 0x80 -+#define WUSB_WCONNECTACK_IE 0x81 -+#define WUSB_WHOSTINFO_IE 0x82 -+#define WUHI_GET_CA(_bmAttributes_) ((_bmAttributes_) & 0x3) -+#define WUHI_CA_RECONN 0x00 -+#define WUHI_CA_LIMITED 0x01 -+#define WUHI_CA_ALL 0x03 -+#define WUHI_GET_MLSI(_bmAttributes_) (((_bmAttributes_) & 0x38) >> 3) -+#define WUSB_WCHCHANGEANNOUNCE_IE 0x83 -+#define WUSB_WDEV_DISCONNECT_IE 0x84 -+#define WUSB_WHOST_DISCONNECT_IE 0x85 -+#define WUSB_WRELEASE_CHANNEL_IE 0x86 -+#define WUSB_WWORK_IE 0x87 -+#define WUSB_WCHANNEL_STOP_IE 0x88 -+#define WUSB_WDEV_KEEPALIVE_IE 0x89 -+#define WUSB_WISOCH_DISCARD_IE 0x8A -+#define WUSB_WRESETDEVICE_IE 0x8B -+#define WUSB_WXMIT_PACKET_ADJUST_IE 0x8C -+#define WUSB_MAX_IE 0x8C -+ -+/* Device Notification Types */ -+ -+#define WUSB_DN_MIN 0x01 -+#define WUSB_DN_CONNECT 0x01 -+# define WUSB_DA_OLDCONN 0x00 -+# define WUSB_DA_NEWCONN 0x01 -+# define WUSB_DA_SELF_BEACON 0x02 -+# define WUSB_DA_DIR_BEACON 0x04 -+# define WUSB_DA_NO_BEACON 0x06 -+#define WUSB_DN_DISCONNECT 0x02 -+#define WUSB_DN_EPRDY 0x03 -+#define WUSB_DN_MASAVAILCHANGED 0x04 -+#define WUSB_DN_REMOTEWAKEUP 0x05 -+#define WUSB_DN_SLEEP 0x06 -+#define WUSB_DN_ALIVE 0x07 -+#define WUSB_DN_MAX 0x07 -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+/* WUSB Handshake Data. Used during the SET/GET HANDSHAKE requests */ -+typedef struct wusb_hndshk_data { -+ uByte bMessageNumber; -+ uByte bStatus; -+ uByte tTKID[3]; -+ uByte bReserved; -+ uByte CDID[16]; -+ uByte Nonce[16]; -+ uByte MIC[8]; -+} UPACKED wusb_hndshk_data_t; -+#define WUSB_HANDSHAKE_LEN_FOR_MIC 38 -+ -+/* WUSB Connection Context */ -+typedef struct wusb_conn_context { -+ uByte CHID [16]; -+ uByte CDID [16]; -+ uByte CK [16]; -+} UPACKED wusb_conn_context_t; -+ -+/* WUSB Security Descriptor */ -+typedef struct wusb_security_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord wTotalLength; -+ uByte bNumEncryptionTypes; -+} UPACKED wusb_security_desc_t; -+ -+/* WUSB Encryption Type Descriptor */ -+typedef struct wusb_encrypt_type_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ -+ uByte bEncryptionType; -+#define WUETD_UNSECURE 0 -+#define WUETD_WIRED 1 -+#define WUETD_CCM_1 2 -+#define WUETD_RSA_1 3 -+ -+ uByte bEncryptionValue; -+ uByte bAuthKeyIndex; -+} UPACKED wusb_encrypt_type_desc_t; -+ -+/* WUSB Key Descriptor */ -+typedef struct wusb_key_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte tTKID[3]; -+ uByte bReserved; -+ uByte KeyData[1]; /* variable length */ -+} UPACKED wusb_key_desc_t; -+ -+/* WUSB BOS Descriptor (Binary device Object Store) */ -+typedef struct wusb_bos_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uWord wTotalLength; -+ uByte bNumDeviceCaps; -+} UPACKED wusb_bos_desc_t; -+ -+#define USB_DEVICE_CAPABILITY_20_EXTENSION 0x02 -+typedef struct usb_dev_cap_20_ext_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+#define USB_20_EXT_LPM 0x02 -+ uDWord bmAttributes; -+} UPACKED usb_dev_cap_20_ext_desc_t; -+ -+#define USB_DEVICE_CAPABILITY_SS_USB 0x03 -+typedef struct usb_dev_cap_ss_usb { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+#define USB_DC_SS_USB_LTM_CAPABLE 0x02 -+ uByte bmAttributes; -+#define USB_DC_SS_USB_SPEED_SUPPORT_LOW 0x01 -+#define USB_DC_SS_USB_SPEED_SUPPORT_FULL 0x02 -+#define USB_DC_SS_USB_SPEED_SUPPORT_HIGH 0x04 -+#define USB_DC_SS_USB_SPEED_SUPPORT_SS 0x08 -+ uWord wSpeedsSupported; -+ uByte bFunctionalitySupport; -+ uByte bU1DevExitLat; -+ uWord wU2DevExitLat; -+} UPACKED usb_dev_cap_ss_usb_t; -+ -+#define USB_DEVICE_CAPABILITY_CONTAINER_ID 0x04 -+typedef struct usb_dev_cap_container_id { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+ uByte bReserved; -+ uByte containerID[16]; -+} UPACKED usb_dev_cap_container_id_t; -+ -+/* Device Capability Type Codes */ -+#define WUSB_DEVICE_CAPABILITY_WIRELESS_USB 0x01 -+ -+/* Device Capability Descriptor */ -+typedef struct wusb_dev_cap_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+ uByte caps[1]; /* Variable length */ -+} UPACKED wusb_dev_cap_desc_t; -+ -+/* Device Capability Descriptor */ -+typedef struct wusb_dev_cap_uwb_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bDevCapabilityType; -+ uByte bmAttributes; -+ uWord wPHYRates; /* Bitmap */ -+ uByte bmTFITXPowerInfo; -+ uByte bmFFITXPowerInfo; -+ uWord bmBandGroup; -+ uByte bReserved; -+} UPACKED wusb_dev_cap_uwb_desc_t; -+ -+/* Wireless USB Endpoint Companion Descriptor */ -+typedef struct wusb_endpoint_companion_desc { -+ uByte bLength; -+ uByte bDescriptorType; -+ uByte bMaxBurst; -+ uByte bMaxSequence; -+ uWord wMaxStreamDelay; -+ uWord wOverTheAirPacketSize; -+ uByte bOverTheAirInterval; -+ uByte bmCompAttributes; -+} UPACKED wusb_endpoint_companion_desc_t; -+ -+/* Wireless USB Numeric Association M1 Data Structure */ -+typedef struct wusb_m1_data { -+ uByte version; -+ uWord langId; -+ uByte deviceFriendlyNameLength; -+ uByte sha_256_m3[32]; -+ uByte deviceFriendlyName[256]; -+} UPACKED wusb_m1_data_t; -+ -+typedef struct wusb_m2_data { -+ uByte version; -+ uWord langId; -+ uByte hostFriendlyNameLength; -+ uByte pkh[384]; -+ uByte hostFriendlyName[256]; -+} UPACKED wusb_m2_data_t; -+ -+typedef struct wusb_m3_data { -+ uByte pkd[384]; -+ uByte nd; -+} UPACKED wusb_m3_data_t; -+ -+typedef struct wusb_m4_data { -+ uDWord _attributeTypeIdAndLength_1; -+ uWord associationTypeId; -+ -+ uDWord _attributeTypeIdAndLength_2; -+ uWord associationSubTypeId; -+ -+ uDWord _attributeTypeIdAndLength_3; -+ uDWord length; -+ -+ uDWord _attributeTypeIdAndLength_4; -+ uDWord associationStatus; -+ -+ uDWord _attributeTypeIdAndLength_5; -+ uByte chid[16]; -+ -+ uDWord _attributeTypeIdAndLength_6; -+ uByte cdid[16]; -+ -+ uDWord _attributeTypeIdAndLength_7; -+ uByte bandGroups[2]; -+} UPACKED wusb_m4_data_t; -+ -+#ifdef _MSC_VER -+#include -+#endif -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _USB_H_ */ -diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..e7bdd12015fee1727a7956ae3e3b2786e88892c1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/Makefile -@@ -0,0 +1,82 @@ -+# -+# Makefile for DWC_otg Highspeed USB controller driver -+# -+ -+ifneq ($(KERNELRELEASE),) -+ -+# Use the BUS_INTERFACE variable to compile the software for either -+# PCI(PCI_INTERFACE) or LM(LM_INTERFACE) bus. -+ifeq ($(BUS_INTERFACE),) -+# BUS_INTERFACE = -DPCI_INTERFACE -+# BUS_INTERFACE = -DLM_INTERFACE -+ BUS_INTERFACE = -DPLATFORM_INTERFACE -+endif -+ -+#ccflags-y += -DDEBUG -+#ccflags-y += -DDWC_OTG_DEBUGLEV=1 # reduce common debug msgs -+ -+# Use one of the following flags to compile the software in host-only or -+# device-only mode. -+#ccflags-y += -DDWC_HOST_ONLY -+#ccflags-y += -DDWC_DEVICE_ONLY -+ -+ccflags-y += -Dlinux -DDWC_HS_ELECT_TST -+#ccflags-y += -DDWC_EN_ISOC -+ccflags-y += -I$(obj)/../dwc_common_port -+#ccflags-y += -I$(PORTLIB) -+ccflags-y += -DDWC_LINUX -+ccflags-y += $(CFI) -+ccflags-y += $(BUS_INTERFACE) -+#ccflags-y += -DDWC_DEV_SRPCAP -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o -+ -+dwc_otg-objs := dwc_otg_driver.o dwc_otg_attr.o -+dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o -+dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o -+dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o -+dwc_otg-objs += dwc_otg_adp.o -+dwc_otg-objs += dwc_otg_fiq_fsm.o -+dwc_otg-objs += dwc_otg_fiq_stub.o -+ifneq ($(CFI),) -+dwc_otg-objs += dwc_otg_cfi.o -+endif -+ -+kernrelwd := $(subst ., ,$(KERNELRELEASE)) -+kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) -+ -+ifneq ($(kernrel3),2.6.20) -+ccflags-y += $(CPPFLAGS) -+endif -+ -+else -+ -+PWD := $(shell pwd) -+PORTLIB := $(PWD)/../dwc_common_port -+ -+# Command paths -+CTAGS := $(CTAGS) -+DOXYGEN := $(DOXYGEN) -+ -+default: portlib -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+install: default -+ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install -+ $(MAKE) -C$(KDIR) M=$(PWD) modules_install -+ -+portlib: -+ $(MAKE) -C$(KDIR) M=$(PORTLIB) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ cp $(PORTLIB)/Module.symvers $(PWD)/ -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+ -+clean: -+ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers -+ -+endif -diff --git a/drivers/usb/host/dwc_otg/doc/doxygen.cfg b/drivers/usb/host/dwc_otg/doc/doxygen.cfg -new file mode 100644 -index 0000000000000000000000000000000000000000..712b057ef7c293e8ddfa95d89e2471fb96a38006 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/doc/doxygen.cfg -@@ -0,0 +1,224 @@ -+# Doxyfile 1.3.9.1 -+ -+#--------------------------------------------------------------------------- -+# Project related configuration options -+#--------------------------------------------------------------------------- -+PROJECT_NAME = "DesignWare USB 2.0 OTG Controller (DWC_otg) Device Driver" -+PROJECT_NUMBER = v3.00a -+OUTPUT_DIRECTORY = ./doc/ -+CREATE_SUBDIRS = NO -+OUTPUT_LANGUAGE = English -+BRIEF_MEMBER_DESC = YES -+REPEAT_BRIEF = YES -+ABBREVIATE_BRIEF = "The $name class" \ -+ "The $name widget" \ -+ "The $name file" \ -+ is \ -+ provides \ -+ specifies \ -+ contains \ -+ represents \ -+ a \ -+ an \ -+ the -+ALWAYS_DETAILED_SEC = NO -+INLINE_INHERITED_MEMB = NO -+FULL_PATH_NAMES = NO -+STRIP_FROM_PATH = -+STRIP_FROM_INC_PATH = -+SHORT_NAMES = NO -+JAVADOC_AUTOBRIEF = YES -+MULTILINE_CPP_IS_BRIEF = NO -+INHERIT_DOCS = YES -+DISTRIBUTE_GROUP_DOC = NO -+TAB_SIZE = 8 -+ALIASES = -+OPTIMIZE_OUTPUT_FOR_C = YES -+OPTIMIZE_OUTPUT_JAVA = NO -+SUBGROUPING = YES -+#--------------------------------------------------------------------------- -+# Build related configuration options -+#--------------------------------------------------------------------------- -+EXTRACT_ALL = NO -+EXTRACT_PRIVATE = YES -+EXTRACT_STATIC = YES -+EXTRACT_LOCAL_CLASSES = YES -+EXTRACT_LOCAL_METHODS = NO -+HIDE_UNDOC_MEMBERS = NO -+HIDE_UNDOC_CLASSES = NO -+HIDE_FRIEND_COMPOUNDS = NO -+HIDE_IN_BODY_DOCS = NO -+INTERNAL_DOCS = NO -+CASE_SENSE_NAMES = NO -+HIDE_SCOPE_NAMES = NO -+SHOW_INCLUDE_FILES = YES -+INLINE_INFO = YES -+SORT_MEMBER_DOCS = NO -+SORT_BRIEF_DOCS = NO -+SORT_BY_SCOPE_NAME = NO -+GENERATE_TODOLIST = YES -+GENERATE_TESTLIST = YES -+GENERATE_BUGLIST = YES -+GENERATE_DEPRECATEDLIST= YES -+ENABLED_SECTIONS = -+MAX_INITIALIZER_LINES = 30 -+SHOW_USED_FILES = YES -+SHOW_DIRECTORIES = YES -+#--------------------------------------------------------------------------- -+# configuration options related to warning and progress messages -+#--------------------------------------------------------------------------- -+QUIET = YES -+WARNINGS = YES -+WARN_IF_UNDOCUMENTED = NO -+WARN_IF_DOC_ERROR = YES -+WARN_FORMAT = "$file:$line: $text" -+WARN_LOGFILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the input files -+#--------------------------------------------------------------------------- -+INPUT = . -+FILE_PATTERNS = *.c \ -+ *.h \ -+ ./linux/*.c \ -+ ./linux/*.h -+RECURSIVE = NO -+EXCLUDE = ./test/ \ -+ ./dwc_otg/.AppleDouble/ -+EXCLUDE_SYMLINKS = YES -+EXCLUDE_PATTERNS = *.mod.* -+EXAMPLE_PATH = -+EXAMPLE_PATTERNS = * -+EXAMPLE_RECURSIVE = NO -+IMAGE_PATH = -+INPUT_FILTER = -+FILTER_PATTERNS = -+FILTER_SOURCE_FILES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to source browsing -+#--------------------------------------------------------------------------- -+SOURCE_BROWSER = YES -+INLINE_SOURCES = NO -+STRIP_CODE_COMMENTS = YES -+REFERENCED_BY_RELATION = NO -+REFERENCES_RELATION = NO -+VERBATIM_HEADERS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the alphabetical class index -+#--------------------------------------------------------------------------- -+ALPHABETICAL_INDEX = NO -+COLS_IN_ALPHA_INDEX = 5 -+IGNORE_PREFIX = -+#--------------------------------------------------------------------------- -+# configuration options related to the HTML output -+#--------------------------------------------------------------------------- -+GENERATE_HTML = YES -+HTML_OUTPUT = html -+HTML_FILE_EXTENSION = .html -+HTML_HEADER = -+HTML_FOOTER = -+HTML_STYLESHEET = -+HTML_ALIGN_MEMBERS = YES -+GENERATE_HTMLHELP = NO -+CHM_FILE = -+HHC_LOCATION = -+GENERATE_CHI = NO -+BINARY_TOC = NO -+TOC_EXPAND = NO -+DISABLE_INDEX = NO -+ENUM_VALUES_PER_LINE = 4 -+GENERATE_TREEVIEW = YES -+TREEVIEW_WIDTH = 250 -+#--------------------------------------------------------------------------- -+# configuration options related to the LaTeX output -+#--------------------------------------------------------------------------- -+GENERATE_LATEX = NO -+LATEX_OUTPUT = latex -+LATEX_CMD_NAME = latex -+MAKEINDEX_CMD_NAME = makeindex -+COMPACT_LATEX = NO -+PAPER_TYPE = a4wide -+EXTRA_PACKAGES = -+LATEX_HEADER = -+PDF_HYPERLINKS = NO -+USE_PDFLATEX = NO -+LATEX_BATCHMODE = NO -+LATEX_HIDE_INDICES = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the RTF output -+#--------------------------------------------------------------------------- -+GENERATE_RTF = NO -+RTF_OUTPUT = rtf -+COMPACT_RTF = NO -+RTF_HYPERLINKS = NO -+RTF_STYLESHEET_FILE = -+RTF_EXTENSIONS_FILE = -+#--------------------------------------------------------------------------- -+# configuration options related to the man page output -+#--------------------------------------------------------------------------- -+GENERATE_MAN = NO -+MAN_OUTPUT = man -+MAN_EXTENSION = .3 -+MAN_LINKS = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the XML output -+#--------------------------------------------------------------------------- -+GENERATE_XML = NO -+XML_OUTPUT = xml -+XML_SCHEMA = -+XML_DTD = -+XML_PROGRAMLISTING = YES -+#--------------------------------------------------------------------------- -+# configuration options for the AutoGen Definitions output -+#--------------------------------------------------------------------------- -+GENERATE_AUTOGEN_DEF = NO -+#--------------------------------------------------------------------------- -+# configuration options related to the Perl module output -+#--------------------------------------------------------------------------- -+GENERATE_PERLMOD = NO -+PERLMOD_LATEX = NO -+PERLMOD_PRETTY = YES -+PERLMOD_MAKEVAR_PREFIX = -+#--------------------------------------------------------------------------- -+# Configuration options related to the preprocessor -+#--------------------------------------------------------------------------- -+ENABLE_PREPROCESSING = YES -+MACRO_EXPANSION = YES -+EXPAND_ONLY_PREDEF = YES -+SEARCH_INCLUDES = YES -+INCLUDE_PATH = -+INCLUDE_FILE_PATTERNS = -+PREDEFINED = DEVICE_ATTR DWC_EN_ISOC -+EXPAND_AS_DEFINED = DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW DWC_OTG_DEVICE_ATTR_BITFIELD_STORE DWC_OTG_DEVICE_ATTR_BITFIELD_RW DWC_OTG_DEVICE_ATTR_BITFIELD_RO DWC_OTG_DEVICE_ATTR_REG_SHOW DWC_OTG_DEVICE_ATTR_REG_STORE DWC_OTG_DEVICE_ATTR_REG32_RW DWC_OTG_DEVICE_ATTR_REG32_RO DWC_EN_ISOC -+SKIP_FUNCTION_MACROS = NO -+#--------------------------------------------------------------------------- -+# Configuration::additions related to external references -+#--------------------------------------------------------------------------- -+TAGFILES = -+GENERATE_TAGFILE = -+ALLEXTERNALS = NO -+EXTERNAL_GROUPS = YES -+PERL_PATH = /usr/bin/perl -+#--------------------------------------------------------------------------- -+# Configuration options related to the dot tool -+#--------------------------------------------------------------------------- -+CLASS_DIAGRAMS = YES -+HIDE_UNDOC_RELATIONS = YES -+HAVE_DOT = NO -+CLASS_GRAPH = YES -+COLLABORATION_GRAPH = YES -+UML_LOOK = NO -+TEMPLATE_RELATIONS = NO -+INCLUDE_GRAPH = YES -+INCLUDED_BY_GRAPH = YES -+CALL_GRAPH = NO -+GRAPHICAL_HIERARCHY = YES -+DOT_IMAGE_FORMAT = png -+DOT_PATH = -+DOTFILE_DIRS = -+MAX_DOT_GRAPH_DEPTH = 1000 -+GENERATE_LEGEND = YES -+DOT_CLEANUP = YES -+#--------------------------------------------------------------------------- -+# Configuration::additions related to the search engine -+#--------------------------------------------------------------------------- -+SEARCHENGINE = NO -diff --git a/drivers/usb/host/dwc_otg/dummy_audio.c b/drivers/usb/host/dwc_otg/dummy_audio.c -new file mode 100644 -index 0000000000000000000000000000000000000000..f827102fa64414d0f6e6ad47948a87fa4ab97e69 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dummy_audio.c -@@ -0,0 +1,1574 @@ -+/* -+ * zero.c -- Gadget Zero, for USB development -+ * -+ * Copyright (C) 2003-2004 David Brownell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") as published by the Free Software -+ * Foundation, either version 2 of that License or (at your option) any -+ * later version. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+ -+/* -+ * Gadget Zero only needs two bulk endpoints, and is an example of how you -+ * can write a hardware-agnostic gadget driver running inside a USB device. -+ * -+ * Hardware details are visible (see CONFIG_USB_ZERO_* below) but don't -+ * affect most of the driver. -+ * -+ * Use it with the Linux host/master side "usbtest" driver to get a basic -+ * functional test of your device-side usb stack, or with "usb-skeleton". -+ * -+ * It supports two similar configurations. One sinks whatever the usb host -+ * writes, and in return sources zeroes. The other loops whatever the host -+ * writes back, so the host can read it. Module options include: -+ * -+ * buflen=N default N=4096, buffer size used -+ * qlen=N default N=32, how many buffers in the loopback queue -+ * loopdefault default false, list loopback config first -+ * -+ * Many drivers will only have one configuration, letting them be much -+ * simpler if they also don't support high speed operation (like this -+ * driver does). -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -+# include -+#else -+# include -+#endif -+ -+#include -+ -+ -+/*-------------------------------------------------------------------------*/ -+/*-------------------------------------------------------------------------*/ -+ -+ -+static int utf8_to_utf16le(const char *s, u16 *cp, unsigned len) -+{ -+ int count = 0; -+ u8 c; -+ u16 uchar; -+ -+ /* this insists on correct encodings, though not minimal ones. -+ * BUT it currently rejects legit 4-byte UTF-8 code points, -+ * which need surrogate pairs. (Unicode 3.1 can use them.) -+ */ -+ while (len != 0 && (c = (u8) *s++) != 0) { -+ if (unlikely(c & 0x80)) { -+ // 2-byte sequence: -+ // 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx -+ if ((c & 0xe0) == 0xc0) { -+ uchar = (c & 0x1f) << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ // 3-byte sequence (most CJKV characters): -+ // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx -+ } else if ((c & 0xf0) == 0xe0) { -+ uchar = (c & 0x0f) << 12; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c << 6; -+ -+ c = (u8) *s++; -+ if ((c & 0xc0) != 0xc0) -+ goto fail; -+ c &= 0x3f; -+ uchar |= c; -+ -+ /* no bogus surrogates */ -+ if (0xd800 <= uchar && uchar <= 0xdfff) -+ goto fail; -+ -+ // 4-byte sequence (surrogate pairs, currently rare): -+ // 11101110wwwwzzzzyy + 110111yyyyxxxxxx -+ // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx -+ // (uuuuu = wwww + 1) -+ // FIXME accept the surrogate code points (only) -+ -+ } else -+ goto fail; -+ } else -+ uchar = c; -+ put_unaligned (cpu_to_le16 (uchar), cp++); -+ count++; -+ len--; -+ } -+ return count; -+fail: -+ return -1; -+} -+ -+ -+/** -+ * usb_gadget_get_string - fill out a string descriptor -+ * @table: of c strings encoded using UTF-8 -+ * @id: string id, from low byte of wValue in get string descriptor -+ * @buf: at least 256 bytes -+ * -+ * Finds the UTF-8 string matching the ID, and converts it into a -+ * string descriptor in utf16-le. -+ * Returns length of descriptor (always even) or negative errno -+ * -+ * If your driver needs stings in multiple languages, you'll probably -+ * "switch (wIndex) { ... }" in your ep0 string descriptor logic, -+ * using this routine after choosing which set of UTF-8 strings to use. -+ * Note that US-ASCII is a strict subset of UTF-8; any string bytes with -+ * the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1 -+ * characters (which are also widely used in C strings). -+ */ -+int -+usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) -+{ -+ struct usb_string *s; -+ int len; -+ -+ /* descriptor 0 has the language id */ -+ if (id == 0) { -+ buf [0] = 4; -+ buf [1] = USB_DT_STRING; -+ buf [2] = (u8) table->language; -+ buf [3] = (u8) (table->language >> 8); -+ return 4; -+ } -+ for (s = table->strings; s && s->s; s++) -+ if (s->id == id) -+ break; -+ -+ /* unrecognized: stall. */ -+ if (!s || !s->s) -+ return -EINVAL; -+ -+ /* string descriptors have length, tag, then UTF16-LE text */ -+ len = min ((size_t) 126, strlen (s->s)); -+ memset (buf + 2, 0, 2 * len); /* zero all the bytes */ -+ len = utf8_to_utf16le(s->s, (u16 *)&buf[2], len); -+ if (len < 0) -+ return -EINVAL; -+ buf [0] = (len + 1) * 2; -+ buf [1] = USB_DT_STRING; -+ return buf [0]; -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+/*-------------------------------------------------------------------------*/ -+ -+ -+/** -+ * usb_descriptor_fillbuf - fill buffer with descriptors -+ * @buf: Buffer to be filled -+ * @buflen: Size of buf -+ * @src: Array of descriptor pointers, terminated by null pointer. -+ * -+ * Copies descriptors into the buffer, returning the length or a -+ * negative error code if they can't all be copied. Useful when -+ * assembling descriptors for an associated set of interfaces used -+ * as part of configuring a composite device; or in other cases where -+ * sets of descriptors need to be marshaled. -+ */ -+int -+usb_descriptor_fillbuf(void *buf, unsigned buflen, -+ const struct usb_descriptor_header **src) -+{ -+ u8 *dest = buf; -+ -+ if (!src) -+ return -EINVAL; -+ -+ /* fill buffer from src[] until null descriptor ptr */ -+ for (; 0 != *src; src++) { -+ unsigned len = (*src)->bLength; -+ -+ if (len > buflen) -+ return -EINVAL; -+ memcpy(dest, *src, len); -+ buflen -= len; -+ dest += len; -+ } -+ return dest - (u8 *)buf; -+} -+ -+ -+/** -+ * usb_gadget_config_buf - builts a complete configuration descriptor -+ * @config: Header for the descriptor, including characteristics such -+ * as power requirements and number of interfaces. -+ * @desc: Null-terminated vector of pointers to the descriptors (interface, -+ * endpoint, etc) defining all functions in this device configuration. -+ * @buf: Buffer for the resulting configuration descriptor. -+ * @length: Length of buffer. If this is not big enough to hold the -+ * entire configuration descriptor, an error code will be returned. -+ * -+ * This copies descriptors into the response buffer, building a descriptor -+ * for that configuration. It returns the buffer length or a negative -+ * status code. The config.wTotalLength field is set to match the length -+ * of the result, but other descriptor fields (including power usage and -+ * interface count) must be set by the caller. -+ * -+ * Gadget drivers could use this when constructing a config descriptor -+ * in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the -+ * resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. -+ */ -+int usb_gadget_config_buf( -+ const struct usb_config_descriptor *config, -+ void *buf, -+ unsigned length, -+ const struct usb_descriptor_header **desc -+) -+{ -+ struct usb_config_descriptor *cp = buf; -+ int len; -+ -+ /* config descriptor first */ -+ if (length < USB_DT_CONFIG_SIZE || !desc) -+ return -EINVAL; -+ *cp = *config; -+ -+ /* then interface/endpoint/class/vendor/... */ -+ len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf, -+ length - USB_DT_CONFIG_SIZE, desc); -+ if (len < 0) -+ return len; -+ len += USB_DT_CONFIG_SIZE; -+ if (len > 0xffff) -+ return -EINVAL; -+ -+ /* patch up the config descriptor */ -+ cp->bLength = USB_DT_CONFIG_SIZE; -+ cp->bDescriptorType = USB_DT_CONFIG; -+ cp->wTotalLength = cpu_to_le16(len); -+ cp->bmAttributes |= USB_CONFIG_ATT_ONE; -+ return len; -+} -+ -+/*-------------------------------------------------------------------------*/ -+/*-------------------------------------------------------------------------*/ -+ -+ -+#define RBUF_LEN (1024*1024) -+static int rbuf_start; -+static int rbuf_len; -+static __u8 rbuf[RBUF_LEN]; -+ -+/*-------------------------------------------------------------------------*/ -+ -+#define DRIVER_VERSION "St Patrick's Day 2004" -+ -+static const char shortname [] = "zero"; -+static const char longname [] = "YAMAHA YST-MS35D USB Speaker "; -+ -+static const char source_sink [] = "source and sink data"; -+static const char loopback [] = "loop input to output"; -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* -+ * driver assumes self-powered hardware, and -+ * has no way for users to trigger remote wakeup. -+ * -+ * this version autoconfigures as much as possible, -+ * which is reasonable for most "bulk-only" drivers. -+ */ -+static const char *EP_IN_NAME; /* source */ -+static const char *EP_OUT_NAME; /* sink */ -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* big enough to hold our biggest descriptor */ -+#define USB_BUFSIZ 512 -+ -+struct zero_dev { -+ spinlock_t lock; -+ struct usb_gadget *gadget; -+ struct usb_request *req; /* for control responses */ -+ -+ /* when configured, we have one of two configs: -+ * - source data (in to host) and sink it (out from host) -+ * - or loop it back (out from host back in to host) -+ */ -+ u8 config; -+ struct usb_ep *in_ep, *out_ep; -+ -+ /* autoresume timer */ -+ struct timer_list resume; -+}; -+ -+#define xprintk(d,level,fmt,args...) \ -+ dev_printk(level , &(d)->gadget->dev , fmt , ## args) -+ -+#ifdef DEBUG -+#define DBG(dev,fmt,args...) \ -+ xprintk(dev , KERN_DEBUG , fmt , ## args) -+#else -+#define DBG(dev,fmt,args...) \ -+ do { } while (0) -+#endif /* DEBUG */ -+ -+#ifdef VERBOSE -+#define VDBG DBG -+#else -+#define VDBG(dev,fmt,args...) \ -+ do { } while (0) -+#endif /* VERBOSE */ -+ -+#define ERROR(dev,fmt,args...) \ -+ xprintk(dev , KERN_ERR , fmt , ## args) -+#define WARN(dev,fmt,args...) \ -+ xprintk(dev , KERN_WARNING , fmt , ## args) -+#define INFO(dev,fmt,args...) \ -+ xprintk(dev , KERN_INFO , fmt , ## args) -+ -+/*-------------------------------------------------------------------------*/ -+ -+static unsigned buflen = 4096; -+static unsigned qlen = 32; -+static unsigned pattern = 0; -+ -+module_param (buflen, uint, S_IRUGO|S_IWUSR); -+module_param (qlen, uint, S_IRUGO|S_IWUSR); -+module_param (pattern, uint, S_IRUGO|S_IWUSR); -+ -+/* -+ * if it's nonzero, autoresume says how many seconds to wait -+ * before trying to wake up the host after suspend. -+ */ -+static unsigned autoresume = 0; -+module_param (autoresume, uint, 0); -+ -+/* -+ * Normally the "loopback" configuration is second (index 1) so -+ * it's not the default. Here's where to change that order, to -+ * work better with hosts where config changes are problematic. -+ * Or controllers (like superh) that only support one config. -+ */ -+static int loopdefault = 0; -+ -+module_param (loopdefault, bool, S_IRUGO|S_IWUSR); -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* Thanks to NetChip Technologies for donating this product ID. -+ * -+ * DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! -+ * Instead: allocate your own, using normal USB-IF procedures. -+ */ -+#ifndef CONFIG_USB_ZERO_HNPTEST -+#define DRIVER_VENDOR_NUM 0x0525 /* NetChip */ -+#define DRIVER_PRODUCT_NUM 0xa4a0 /* Linux-USB "Gadget Zero" */ -+#else -+#define DRIVER_VENDOR_NUM 0x1a0a /* OTG test device IDs */ -+#define DRIVER_PRODUCT_NUM 0xbadd -+#endif -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* -+ * DESCRIPTORS ... most are static, but strings and (full) -+ * configuration descriptors are built on demand. -+ */ -+ -+/* -+#define STRING_MANUFACTURER 25 -+#define STRING_PRODUCT 42 -+#define STRING_SERIAL 101 -+*/ -+#define STRING_MANUFACTURER 1 -+#define STRING_PRODUCT 2 -+#define STRING_SERIAL 3 -+ -+#define STRING_SOURCE_SINK 250 -+#define STRING_LOOPBACK 251 -+ -+/* -+ * This device advertises two configurations; these numbers work -+ * on a pxa250 as well as more flexible hardware. -+ */ -+#define CONFIG_SOURCE_SINK 3 -+#define CONFIG_LOOPBACK 2 -+ -+/* -+static struct usb_device_descriptor -+device_desc = { -+ .bLength = sizeof device_desc, -+ .bDescriptorType = USB_DT_DEVICE, -+ -+ .bcdUSB = __constant_cpu_to_le16 (0x0200), -+ .bDeviceClass = USB_CLASS_VENDOR_SPEC, -+ -+ .idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM), -+ .idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM), -+ .iManufacturer = STRING_MANUFACTURER, -+ .iProduct = STRING_PRODUCT, -+ .iSerialNumber = STRING_SERIAL, -+ .bNumConfigurations = 2, -+}; -+*/ -+static struct usb_device_descriptor -+device_desc = { -+ .bLength = sizeof device_desc, -+ .bDescriptorType = USB_DT_DEVICE, -+ .bcdUSB = __constant_cpu_to_le16 (0x0100), -+ .bDeviceClass = USB_CLASS_PER_INTERFACE, -+ .bDeviceSubClass = 0, -+ .bDeviceProtocol = 0, -+ .bMaxPacketSize0 = 64, -+ .bcdDevice = __constant_cpu_to_le16 (0x0100), -+ .idVendor = __constant_cpu_to_le16 (0x0499), -+ .idProduct = __constant_cpu_to_le16 (0x3002), -+ .iManufacturer = STRING_MANUFACTURER, -+ .iProduct = STRING_PRODUCT, -+ .iSerialNumber = STRING_SERIAL, -+ .bNumConfigurations = 1, -+}; -+ -+static struct usb_config_descriptor -+z_config = { -+ .bLength = sizeof z_config, -+ .bDescriptorType = USB_DT_CONFIG, -+ -+ /* compute wTotalLength on the fly */ -+ .bNumInterfaces = 2, -+ .bConfigurationValue = 1, -+ .iConfiguration = 0, -+ .bmAttributes = 0x40, -+ .bMaxPower = 0, /* self-powered */ -+}; -+ -+ -+static struct usb_otg_descriptor -+otg_descriptor = { -+ .bLength = sizeof otg_descriptor, -+ .bDescriptorType = USB_DT_OTG, -+ -+ .bmAttributes = USB_OTG_SRP, -+}; -+ -+/* one interface in each configuration */ -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ -+/* -+ * usb 2.0 devices need to expose both high speed and full speed -+ * descriptors, unless they only run at full speed. -+ * -+ * that means alternate endpoint descriptors (bigger packets) -+ * and a "device qualifier" ... plus more construction options -+ * for the config descriptor. -+ */ -+ -+static struct usb_qualifier_descriptor -+dev_qualifier = { -+ .bLength = sizeof dev_qualifier, -+ .bDescriptorType = USB_DT_DEVICE_QUALIFIER, -+ -+ .bcdUSB = __constant_cpu_to_le16 (0x0200), -+ .bDeviceClass = USB_CLASS_VENDOR_SPEC, -+ -+ .bNumConfigurations = 2, -+}; -+ -+ -+struct usb_cs_as_general_descriptor { -+ __u8 bLength; -+ __u8 bDescriptorType; -+ -+ __u8 bDescriptorSubType; -+ __u8 bTerminalLink; -+ __u8 bDelay; -+ __u16 wFormatTag; -+} __attribute__ ((packed)); -+ -+struct usb_cs_as_format_descriptor { -+ __u8 bLength; -+ __u8 bDescriptorType; -+ -+ __u8 bDescriptorSubType; -+ __u8 bFormatType; -+ __u8 bNrChannels; -+ __u8 bSubframeSize; -+ __u8 bBitResolution; -+ __u8 bSamfreqType; -+ __u8 tLowerSamFreq[3]; -+ __u8 tUpperSamFreq[3]; -+} __attribute__ ((packed)); -+ -+static const struct usb_interface_descriptor -+z_audio_control_if_desc = { -+ .bLength = sizeof z_audio_control_if_desc, -+ .bDescriptorType = USB_DT_INTERFACE, -+ .bInterfaceNumber = 0, -+ .bAlternateSetting = 0, -+ .bNumEndpoints = 0, -+ .bInterfaceClass = USB_CLASS_AUDIO, -+ .bInterfaceSubClass = 0x1, -+ .bInterfaceProtocol = 0, -+ .iInterface = 0, -+}; -+ -+static const struct usb_interface_descriptor -+z_audio_if_desc = { -+ .bLength = sizeof z_audio_if_desc, -+ .bDescriptorType = USB_DT_INTERFACE, -+ .bInterfaceNumber = 1, -+ .bAlternateSetting = 0, -+ .bNumEndpoints = 0, -+ .bInterfaceClass = USB_CLASS_AUDIO, -+ .bInterfaceSubClass = 0x2, -+ .bInterfaceProtocol = 0, -+ .iInterface = 0, -+}; -+ -+static const struct usb_interface_descriptor -+z_audio_if_desc2 = { -+ .bLength = sizeof z_audio_if_desc, -+ .bDescriptorType = USB_DT_INTERFACE, -+ .bInterfaceNumber = 1, -+ .bAlternateSetting = 1, -+ .bNumEndpoints = 1, -+ .bInterfaceClass = USB_CLASS_AUDIO, -+ .bInterfaceSubClass = 0x2, -+ .bInterfaceProtocol = 0, -+ .iInterface = 0, -+}; -+ -+static const struct usb_cs_as_general_descriptor -+z_audio_cs_as_if_desc = { -+ .bLength = 7, -+ .bDescriptorType = 0x24, -+ -+ .bDescriptorSubType = 0x01, -+ .bTerminalLink = 0x01, -+ .bDelay = 0x0, -+ .wFormatTag = __constant_cpu_to_le16 (0x0001) -+}; -+ -+ -+static const struct usb_cs_as_format_descriptor -+z_audio_cs_as_format_desc = { -+ .bLength = 0xe, -+ .bDescriptorType = 0x24, -+ -+ .bDescriptorSubType = 2, -+ .bFormatType = 1, -+ .bNrChannels = 1, -+ .bSubframeSize = 1, -+ .bBitResolution = 8, -+ .bSamfreqType = 0, -+ .tLowerSamFreq = {0x7e, 0x13, 0x00}, -+ .tUpperSamFreq = {0xe2, 0xd6, 0x00}, -+}; -+ -+static const struct usb_endpoint_descriptor -+z_iso_ep = { -+ .bLength = 0x09, -+ .bDescriptorType = 0x05, -+ .bEndpointAddress = 0x04, -+ .bmAttributes = 0x09, -+ .wMaxPacketSize = 0x0038, -+ .bInterval = 0x01, -+ .bRefresh = 0x00, -+ .bSynchAddress = 0x00, -+}; -+ -+static char z_iso_ep2[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+// 9 bytes -+static char z_ac_interface_header_desc[] = -+{ 0x09, 0x24, 0x01, 0x00, 0x01, 0x2b, 0x00, 0x01, 0x01 }; -+ -+// 12 bytes -+static char z_0[] = {0x0c, 0x24, 0x02, 0x01, 0x01, 0x01, 0x00, 0x02, -+ 0x03, 0x00, 0x00, 0x00}; -+// 13 bytes -+static char z_1[] = {0x0d, 0x24, 0x06, 0x02, 0x01, 0x02, 0x15, 0x00, -+ 0x02, 0x00, 0x02, 0x00, 0x00}; -+// 9 bytes -+static char z_2[] = {0x09, 0x24, 0x03, 0x03, 0x01, 0x03, 0x00, 0x02, -+ 0x00}; -+ -+static char za_0[] = {0x09, 0x04, 0x01, 0x02, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_1[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_2[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x01, 0x08, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_3[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_4[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_5[] = {0x09, 0x04, 0x01, 0x03, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_6[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_7[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x02, 0x10, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_8[] = {0x09, 0x05, 0x04, 0x09, 0x70, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_9[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_10[] = {0x09, 0x04, 0x01, 0x04, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_11[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_12[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x00, -+ 0x73, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_13[] = {0x09, 0x05, 0x04, 0x09, 0xe0, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_14[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_15[] = {0x09, 0x04, 0x01, 0x05, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_16[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_17[] = {0x0e, 0x24, 0x02, 0x01, 0x01, 0x03, 0x14, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_18[] = {0x09, 0x05, 0x04, 0x09, 0xa8, 0x00, 0x01, 0x00, -+ 0x00}; -+ -+static char za_19[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+static char za_20[] = {0x09, 0x04, 0x01, 0x06, 0x01, 0x01, 0x02, 0x00, -+ 0x00}; -+ -+static char za_21[] = {0x07, 0x24, 0x01, 0x01, 0x00, 0x01, 0x00}; -+ -+static char za_22[] = {0x0e, 0x24, 0x02, 0x01, 0x02, 0x03, 0x14, 0x00, -+ 0x7e, 0x13, 0x00, 0xe2, 0xd6, 0x00}; -+ -+static char za_23[] = {0x09, 0x05, 0x04, 0x09, 0x50, 0x01, 0x01, 0x00, -+ 0x00}; -+ -+static char za_24[] = {0x07, 0x25, 0x01, 0x00, 0x02, 0x00, 0x02}; -+ -+ -+ -+static const struct usb_descriptor_header *z_function [] = { -+ (struct usb_descriptor_header *) &z_audio_control_if_desc, -+ (struct usb_descriptor_header *) &z_ac_interface_header_desc, -+ (struct usb_descriptor_header *) &z_0, -+ (struct usb_descriptor_header *) &z_1, -+ (struct usb_descriptor_header *) &z_2, -+ (struct usb_descriptor_header *) &z_audio_if_desc, -+ (struct usb_descriptor_header *) &z_audio_if_desc2, -+ (struct usb_descriptor_header *) &z_audio_cs_as_if_desc, -+ (struct usb_descriptor_header *) &z_audio_cs_as_format_desc, -+ (struct usb_descriptor_header *) &z_iso_ep, -+ (struct usb_descriptor_header *) &z_iso_ep2, -+ (struct usb_descriptor_header *) &za_0, -+ (struct usb_descriptor_header *) &za_1, -+ (struct usb_descriptor_header *) &za_2, -+ (struct usb_descriptor_header *) &za_3, -+ (struct usb_descriptor_header *) &za_4, -+ (struct usb_descriptor_header *) &za_5, -+ (struct usb_descriptor_header *) &za_6, -+ (struct usb_descriptor_header *) &za_7, -+ (struct usb_descriptor_header *) &za_8, -+ (struct usb_descriptor_header *) &za_9, -+ (struct usb_descriptor_header *) &za_10, -+ (struct usb_descriptor_header *) &za_11, -+ (struct usb_descriptor_header *) &za_12, -+ (struct usb_descriptor_header *) &za_13, -+ (struct usb_descriptor_header *) &za_14, -+ (struct usb_descriptor_header *) &za_15, -+ (struct usb_descriptor_header *) &za_16, -+ (struct usb_descriptor_header *) &za_17, -+ (struct usb_descriptor_header *) &za_18, -+ (struct usb_descriptor_header *) &za_19, -+ (struct usb_descriptor_header *) &za_20, -+ (struct usb_descriptor_header *) &za_21, -+ (struct usb_descriptor_header *) &za_22, -+ (struct usb_descriptor_header *) &za_23, -+ (struct usb_descriptor_header *) &za_24, -+ NULL, -+}; -+ -+/* maxpacket and other transfer characteristics vary by speed. */ -+#define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs)) -+ -+#else -+ -+/* if there's no high speed support, maxpacket doesn't change. */ -+#define ep_desc(g,hs,fs) fs -+ -+#endif /* !CONFIG_USB_GADGET_DUALSPEED */ -+ -+static char manufacturer [40]; -+//static char serial [40]; -+static char serial [] = "Ser 00 em"; -+ -+/* static strings, in UTF-8 */ -+static struct usb_string strings [] = { -+ { STRING_MANUFACTURER, manufacturer, }, -+ { STRING_PRODUCT, longname, }, -+ { STRING_SERIAL, serial, }, -+ { STRING_LOOPBACK, loopback, }, -+ { STRING_SOURCE_SINK, source_sink, }, -+ { } /* end of list */ -+}; -+ -+static struct usb_gadget_strings stringtab = { -+ .language = 0x0409, /* en-us */ -+ .strings = strings, -+}; -+ -+/* -+ * config descriptors are also handcrafted. these must agree with code -+ * that sets configurations, and with code managing interfaces and their -+ * altsettings. other complexity may come from: -+ * -+ * - high speed support, including "other speed config" rules -+ * - multiple configurations -+ * - interfaces with alternate settings -+ * - embedded class or vendor-specific descriptors -+ * -+ * this handles high speed, and has a second config that could as easily -+ * have been an alternate interface setting (on most hardware). -+ * -+ * NOTE: to demonstrate (and test) more USB capabilities, this driver -+ * should include an altsetting to test interrupt transfers, including -+ * high bandwidth modes at high speed. (Maybe work like Intel's test -+ * device?) -+ */ -+static int -+config_buf (struct usb_gadget *gadget, u8 *buf, u8 type, unsigned index) -+{ -+ int len; -+ const struct usb_descriptor_header **function; -+ -+ function = z_function; -+ len = usb_gadget_config_buf (&z_config, buf, USB_BUFSIZ, function); -+ if (len < 0) -+ return len; -+ ((struct usb_config_descriptor *) buf)->bDescriptorType = type; -+ return len; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static struct usb_request * -+alloc_ep_req (struct usb_ep *ep, unsigned length) -+{ -+ struct usb_request *req; -+ -+ req = usb_ep_alloc_request (ep, GFP_ATOMIC); -+ if (req) { -+ req->length = length; -+ req->buf = usb_ep_alloc_buffer (ep, length, -+ &req->dma, GFP_ATOMIC); -+ if (!req->buf) { -+ usb_ep_free_request (ep, req); -+ req = NULL; -+ } -+ } -+ return req; -+} -+ -+static void free_ep_req (struct usb_ep *ep, struct usb_request *req) -+{ -+ if (req->buf) -+ usb_ep_free_buffer (ep, req->buf, req->dma, req->length); -+ usb_ep_free_request (ep, req); -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+/* optionally require specific source/sink data patterns */ -+ -+static int -+check_read_data ( -+ struct zero_dev *dev, -+ struct usb_ep *ep, -+ struct usb_request *req -+) -+{ -+ unsigned i; -+ u8 *buf = req->buf; -+ -+ for (i = 0; i < req->actual; i++, buf++) { -+ switch (pattern) { -+ /* all-zeroes has no synchronization issues */ -+ case 0: -+ if (*buf == 0) -+ continue; -+ break; -+ /* mod63 stays in sync with short-terminated transfers, -+ * or otherwise when host and gadget agree on how large -+ * each usb transfer request should be. resync is done -+ * with set_interface or set_config. -+ */ -+ case 1: -+ if (*buf == (u8)(i % 63)) -+ continue; -+ break; -+ } -+ ERROR (dev, "bad OUT byte, buf [%d] = %d\n", i, *buf); -+ usb_ep_set_halt (ep); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void zero_reset_config (struct zero_dev *dev) -+{ -+ if (dev->config == 0) -+ return; -+ -+ DBG (dev, "reset config\n"); -+ -+ /* just disable endpoints, forcing completion of pending i/o. -+ * all our completion handlers free their requests in this case. -+ */ -+ if (dev->in_ep) { -+ usb_ep_disable (dev->in_ep); -+ dev->in_ep = NULL; -+ } -+ if (dev->out_ep) { -+ usb_ep_disable (dev->out_ep); -+ dev->out_ep = NULL; -+ } -+ dev->config = 0; -+ del_timer (&dev->resume); -+} -+ -+#define _write(f, buf, sz) (f->f_op->write(f, buf, sz, &f->f_pos)) -+ -+static void -+zero_isoc_complete (struct usb_ep *ep, struct usb_request *req) -+{ -+ struct zero_dev *dev = ep->driver_data; -+ int status = req->status; -+ int i, j; -+ -+ switch (status) { -+ -+ case 0: /* normal completion? */ -+ //printk ("\nzero ---------------> isoc normal completion %d bytes\n", req->actual); -+ for (i=0, j=rbuf_start; iactual; i++) { -+ //printk ("%02x ", ((__u8*)req->buf)[i]); -+ rbuf[j] = ((__u8*)req->buf)[i]; -+ j++; -+ if (j >= RBUF_LEN) j=0; -+ } -+ rbuf_start = j; -+ //printk ("\n\n"); -+ -+ if (rbuf_len < RBUF_LEN) { -+ rbuf_len += req->actual; -+ if (rbuf_len > RBUF_LEN) { -+ rbuf_len = RBUF_LEN; -+ } -+ } -+ -+ break; -+ -+ /* this endpoint is normally active while we're configured */ -+ case -ECONNABORTED: /* hardware forced ep reset */ -+ case -ECONNRESET: /* request dequeued */ -+ case -ESHUTDOWN: /* disconnect from host */ -+ VDBG (dev, "%s gone (%d), %d/%d\n", ep->name, status, -+ req->actual, req->length); -+ if (ep == dev->out_ep) -+ check_read_data (dev, ep, req); -+ free_ep_req (ep, req); -+ return; -+ -+ case -EOVERFLOW: /* buffer overrun on read means that -+ * we didn't provide a big enough -+ * buffer. -+ */ -+ default: -+#if 1 -+ DBG (dev, "%s complete --> %d, %d/%d\n", ep->name, -+ status, req->actual, req->length); -+#endif -+ case -EREMOTEIO: /* short read */ -+ break; -+ } -+ -+ status = usb_ep_queue (ep, req, GFP_ATOMIC); -+ if (status) { -+ ERROR (dev, "kill %s: resubmit %d bytes --> %d\n", -+ ep->name, req->length, status); -+ usb_ep_set_halt (ep); -+ /* FIXME recover later ... somehow */ -+ } -+} -+ -+static struct usb_request * -+zero_start_isoc_ep (struct usb_ep *ep, int gfp_flags) -+{ -+ struct usb_request *req; -+ int status; -+ -+ req = alloc_ep_req (ep, 512); -+ if (!req) -+ return NULL; -+ -+ req->complete = zero_isoc_complete; -+ -+ status = usb_ep_queue (ep, req, gfp_flags); -+ if (status) { -+ struct zero_dev *dev = ep->driver_data; -+ -+ ERROR (dev, "start %s --> %d\n", ep->name, status); -+ free_ep_req (ep, req); -+ req = NULL; -+ } -+ -+ return req; -+} -+ -+/* change our operational config. this code must agree with the code -+ * that returns config descriptors, and altsetting code. -+ * -+ * it's also responsible for power management interactions. some -+ * configurations might not work with our current power sources. -+ * -+ * note that some device controller hardware will constrain what this -+ * code can do, perhaps by disallowing more than one configuration or -+ * by limiting configuration choices (like the pxa2xx). -+ */ -+static int -+zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) -+{ -+ int result = 0; -+ struct usb_gadget *gadget = dev->gadget; -+ const struct usb_endpoint_descriptor *d; -+ struct usb_ep *ep; -+ -+ if (number == dev->config) -+ return 0; -+ -+ zero_reset_config (dev); -+ -+ gadget_for_each_ep (ep, gadget) { -+ -+ if (strcmp (ep->name, "ep4") == 0) { -+ -+ d = (struct usb_endpoint_descripter *)&za_23; // isoc ep desc for audio i/f alt setting 6 -+ result = usb_ep_enable (ep, d); -+ -+ if (result == 0) { -+ ep->driver_data = dev; -+ dev->in_ep = ep; -+ -+ if (zero_start_isoc_ep (ep, gfp_flags) != 0) { -+ -+ dev->in_ep = ep; -+ continue; -+ } -+ -+ usb_ep_disable (ep); -+ result = -EIO; -+ } -+ } -+ -+ } -+ -+ dev->config = number; -+ return result; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void zero_setup_complete (struct usb_ep *ep, struct usb_request *req) -+{ -+ if (req->status || req->actual != req->length) -+ DBG ((struct zero_dev *) ep->driver_data, -+ "setup complete --> %d, %d/%d\n", -+ req->status, req->actual, req->length); -+} -+ -+/* -+ * The setup() callback implements all the ep0 functionality that's -+ * not handled lower down, in hardware or the hardware driver (like -+ * device and endpoint feature flags, and their status). It's all -+ * housekeeping for the gadget function we're implementing. Most of -+ * the work is in config-specific setup. -+ */ -+static int -+zero_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ struct usb_request *req = dev->req; -+ int value = -EOPNOTSUPP; -+ -+ /* usually this stores reply data in the pre-allocated ep0 buffer, -+ * but config change events will reconfigure hardware. -+ */ -+ req->zero = 0; -+ switch (ctrl->bRequest) { -+ -+ case USB_REQ_GET_DESCRIPTOR: -+ -+ switch (ctrl->wValue >> 8) { -+ -+ case USB_DT_DEVICE: -+ value = min (ctrl->wLength, (u16) sizeof device_desc); -+ memcpy (req->buf, &device_desc, value); -+ break; -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ case USB_DT_DEVICE_QUALIFIER: -+ if (!gadget->is_dualspeed) -+ break; -+ value = min (ctrl->wLength, (u16) sizeof dev_qualifier); -+ memcpy (req->buf, &dev_qualifier, value); -+ break; -+ -+ case USB_DT_OTHER_SPEED_CONFIG: -+ if (!gadget->is_dualspeed) -+ break; -+ // FALLTHROUGH -+#endif /* CONFIG_USB_GADGET_DUALSPEED */ -+ case USB_DT_CONFIG: -+ value = config_buf (gadget, req->buf, -+ ctrl->wValue >> 8, -+ ctrl->wValue & 0xff); -+ if (value >= 0) -+ value = min (ctrl->wLength, (u16) value); -+ break; -+ -+ case USB_DT_STRING: -+ /* wIndex == language code. -+ * this driver only handles one language, you can -+ * add string tables for other languages, using -+ * any UTF-8 characters -+ */ -+ value = usb_gadget_get_string (&stringtab, -+ ctrl->wValue & 0xff, req->buf); -+ if (value >= 0) { -+ value = min (ctrl->wLength, (u16) value); -+ } -+ break; -+ } -+ break; -+ -+ /* currently two configs, two speeds */ -+ case USB_REQ_SET_CONFIGURATION: -+ if (ctrl->bRequestType != 0) -+ goto unknown; -+ -+ spin_lock (&dev->lock); -+ value = zero_set_config (dev, ctrl->wValue, GFP_ATOMIC); -+ spin_unlock (&dev->lock); -+ break; -+ case USB_REQ_GET_CONFIGURATION: -+ if (ctrl->bRequestType != USB_DIR_IN) -+ goto unknown; -+ *(u8 *)req->buf = dev->config; -+ value = min (ctrl->wLength, (u16) 1); -+ break; -+ -+ /* until we add altsetting support, or other interfaces, -+ * only 0/0 are possible. pxa2xx only supports 0/0 (poorly) -+ * and already killed pending endpoint I/O. -+ */ -+ case USB_REQ_SET_INTERFACE: -+ -+ if (ctrl->bRequestType != USB_RECIP_INTERFACE) -+ goto unknown; -+ spin_lock (&dev->lock); -+ if (dev->config) { -+ u8 config = dev->config; -+ -+ /* resets interface configuration, forgets about -+ * previous transaction state (queued bufs, etc) -+ * and re-inits endpoint state (toggle etc) -+ * no response queued, just zero status == success. -+ * if we had more than one interface we couldn't -+ * use this "reset the config" shortcut. -+ */ -+ zero_reset_config (dev); -+ zero_set_config (dev, config, GFP_ATOMIC); -+ value = 0; -+ } -+ spin_unlock (&dev->lock); -+ break; -+ case USB_REQ_GET_INTERFACE: -+ if ((ctrl->bRequestType == 0x21) && (ctrl->wIndex == 0x02)) { -+ value = ctrl->wLength; -+ break; -+ } -+ else { -+ if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)) -+ goto unknown; -+ if (!dev->config) -+ break; -+ if (ctrl->wIndex != 0) { -+ value = -EDOM; -+ break; -+ } -+ *(u8 *)req->buf = 0; -+ value = min (ctrl->wLength, (u16) 1); -+ } -+ break; -+ -+ /* -+ * These are the same vendor-specific requests supported by -+ * Intel's USB 2.0 compliance test devices. We exceed that -+ * device spec by allowing multiple-packet requests. -+ */ -+ case 0x5b: /* control WRITE test -- fill the buffer */ -+ if (ctrl->bRequestType != (USB_DIR_OUT|USB_TYPE_VENDOR)) -+ goto unknown; -+ if (ctrl->wValue || ctrl->wIndex) -+ break; -+ /* just read that many bytes into the buffer */ -+ if (ctrl->wLength > USB_BUFSIZ) -+ break; -+ value = ctrl->wLength; -+ break; -+ case 0x5c: /* control READ test -- return the buffer */ -+ if (ctrl->bRequestType != (USB_DIR_IN|USB_TYPE_VENDOR)) -+ goto unknown; -+ if (ctrl->wValue || ctrl->wIndex) -+ break; -+ /* expect those bytes are still in the buffer; send back */ -+ if (ctrl->wLength > USB_BUFSIZ -+ || ctrl->wLength != req->length) -+ break; -+ value = ctrl->wLength; -+ break; -+ -+ case 0x01: // SET_CUR -+ case 0x02: -+ case 0x03: -+ case 0x04: -+ case 0x05: -+ value = ctrl->wLength; -+ break; -+ case 0x81: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0xe3; -+ break; -+ case 0x0300: -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x00; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x81; -+ //((u8*)req->buf)[1] = 0x81; -+ value = ctrl->wLength; -+ break; -+ case 0x82: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0xc3; -+ break; -+ case 0x0300: -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x00; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x82; -+ //((u8*)req->buf)[1] = 0x82; -+ value = ctrl->wLength; -+ break; -+ case 0x83: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0x00; -+ break; -+ case 0x0300: -+ ((u8*)req->buf)[0] = 0x60; -+ break; -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x18; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x83; -+ //((u8*)req->buf)[1] = 0x83; -+ value = ctrl->wLength; -+ break; -+ case 0x84: -+ switch (ctrl->wValue) { -+ case 0x0201: -+ case 0x0202: -+ ((u8*)req->buf)[0] = 0x00; -+ ((u8*)req->buf)[1] = 0x01; -+ break; -+ case 0x0300: -+ case 0x0500: -+ ((u8*)req->buf)[0] = 0x08; -+ break; -+ } -+ //((u8*)req->buf)[0] = 0x84; -+ //((u8*)req->buf)[1] = 0x84; -+ value = ctrl->wLength; -+ break; -+ case 0x85: -+ ((u8*)req->buf)[0] = 0x85; -+ ((u8*)req->buf)[1] = 0x85; -+ value = ctrl->wLength; -+ break; -+ -+ -+ default: -+unknown: -+ printk("unknown control req%02x.%02x v%04x i%04x l%d\n", -+ ctrl->bRequestType, ctrl->bRequest, -+ ctrl->wValue, ctrl->wIndex, ctrl->wLength); -+ } -+ -+ /* respond with data transfer before status phase? */ -+ if (value >= 0) { -+ req->length = value; -+ req->zero = value < ctrl->wLength -+ && (value % gadget->ep0->maxpacket) == 0; -+ value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC); -+ if (value < 0) { -+ DBG (dev, "ep_queue < 0 --> %d\n", value); -+ req->status = 0; -+ zero_setup_complete (gadget->ep0, req); -+ } -+ } -+ -+ /* device either stalls (value < 0) or reports success */ -+ return value; -+} -+ -+static void -+zero_disconnect (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ unsigned long flags; -+ -+ spin_lock_irqsave (&dev->lock, flags); -+ zero_reset_config (dev); -+ -+ /* a more significant application might have some non-usb -+ * activities to quiesce here, saving resources like power -+ * or pushing the notification up a network stack. -+ */ -+ spin_unlock_irqrestore (&dev->lock, flags); -+ -+ /* next we may get setup() calls to enumerate new connections; -+ * or an unbind() during shutdown (including removing module). -+ */ -+} -+ -+static void -+zero_autoresume (unsigned long _dev) -+{ -+ struct zero_dev *dev = (struct zero_dev *) _dev; -+ int status; -+ -+ /* normally the host would be woken up for something -+ * more significant than just a timer firing... -+ */ -+ if (dev->gadget->speed != USB_SPEED_UNKNOWN) { -+ status = usb_gadget_wakeup (dev->gadget); -+ DBG (dev, "wakeup --> %d\n", status); -+ } -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void -+zero_unbind (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ -+ DBG (dev, "unbind\n"); -+ -+ /* we've already been disconnected ... no i/o is active */ -+ if (dev->req) -+ free_ep_req (gadget->ep0, dev->req); -+ del_timer_sync (&dev->resume); -+ kfree (dev); -+ set_gadget_data (gadget, NULL); -+} -+ -+static int -+zero_bind (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev; -+ //struct usb_ep *ep; -+ -+ printk("binding\n"); -+ /* -+ * DRIVER POLICY CHOICE: you may want to do this differently. -+ * One thing to avoid is reusing a bcdDevice revision code -+ * with different host-visible configurations or behavior -+ * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc -+ */ -+ //device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201); -+ -+ -+ /* ok, we made sense of the hardware ... */ -+ dev = kzalloc (sizeof *dev, SLAB_KERNEL); -+ if (!dev) -+ return -ENOMEM; -+ spin_lock_init (&dev->lock); -+ dev->gadget = gadget; -+ set_gadget_data (gadget, dev); -+ -+ /* preallocate control response and buffer */ -+ dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL); -+ if (!dev->req) -+ goto enomem; -+ dev->req->buf = usb_ep_alloc_buffer (gadget->ep0, USB_BUFSIZ, -+ &dev->req->dma, GFP_KERNEL); -+ if (!dev->req->buf) -+ goto enomem; -+ -+ dev->req->complete = zero_setup_complete; -+ -+ device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; -+ -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ /* assume ep0 uses the same value for both speeds ... */ -+ dev_qualifier.bMaxPacketSize0 = device_desc.bMaxPacketSize0; -+ -+ /* and that all endpoints are dual-speed */ -+ //hs_source_desc.bEndpointAddress = fs_source_desc.bEndpointAddress; -+ //hs_sink_desc.bEndpointAddress = fs_sink_desc.bEndpointAddress; -+#endif -+ -+ usb_gadget_set_selfpowered (gadget); -+ -+ init_timer (&dev->resume); -+ dev->resume.function = zero_autoresume; -+ dev->resume.data = (unsigned long) dev; -+ -+ gadget->ep0->driver_data = dev; -+ -+ INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname); -+ INFO (dev, "using %s, OUT %s IN %s\n", gadget->name, -+ EP_OUT_NAME, EP_IN_NAME); -+ -+ snprintf (manufacturer, sizeof manufacturer, -+ UTS_SYSNAME " " UTS_RELEASE " with %s", -+ gadget->name); -+ -+ return 0; -+ -+enomem: -+ zero_unbind (gadget); -+ return -ENOMEM; -+} -+ -+/*-------------------------------------------------------------------------*/ -+ -+static void -+zero_suspend (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ -+ if (gadget->speed == USB_SPEED_UNKNOWN) -+ return; -+ -+ if (autoresume) { -+ mod_timer (&dev->resume, jiffies + (HZ * autoresume)); -+ DBG (dev, "suspend, wakeup in %d seconds\n", autoresume); -+ } else -+ DBG (dev, "suspend\n"); -+} -+ -+static void -+zero_resume (struct usb_gadget *gadget) -+{ -+ struct zero_dev *dev = get_gadget_data (gadget); -+ -+ DBG (dev, "resume\n"); -+ del_timer (&dev->resume); -+} -+ -+ -+/*-------------------------------------------------------------------------*/ -+ -+static struct usb_gadget_driver zero_driver = { -+#ifdef CONFIG_USB_GADGET_DUALSPEED -+ .speed = USB_SPEED_HIGH, -+#else -+ .speed = USB_SPEED_FULL, -+#endif -+ .function = (char *) longname, -+ .bind = zero_bind, -+ .unbind = zero_unbind, -+ -+ .setup = zero_setup, -+ .disconnect = zero_disconnect, -+ -+ .suspend = zero_suspend, -+ .resume = zero_resume, -+ -+ .driver = { -+ .name = (char *) shortname, -+ // .shutdown = ... -+ // .suspend = ... -+ // .resume = ... -+ }, -+}; -+ -+MODULE_AUTHOR ("David Brownell"); -+MODULE_LICENSE ("Dual BSD/GPL"); -+ -+static struct proc_dir_entry *pdir, *pfile; -+ -+static int isoc_read_data (char *page, char **start, -+ off_t off, int count, -+ int *eof, void *data) -+{ -+ int i; -+ static int c = 0; -+ static int done = 0; -+ static int s = 0; -+ -+/* -+ printk ("\ncount: %d\n", count); -+ printk ("rbuf_start: %d\n", rbuf_start); -+ printk ("rbuf_len: %d\n", rbuf_len); -+ printk ("off: %d\n", off); -+ printk ("start: %p\n\n", *start); -+*/ -+ if (done) { -+ c = 0; -+ done = 0; -+ *eof = 1; -+ return 0; -+ } -+ -+ if (c == 0) { -+ if (rbuf_len == RBUF_LEN) -+ s = rbuf_start; -+ else s = 0; -+ } -+ -+ for (i=0; i= rbuf_len) { -+ *eof = 1; -+ done = 1; -+ } -+ -+ -+ return i; -+} -+ -+static int __init init (void) -+{ -+ -+ int retval = 0; -+ -+ pdir = proc_mkdir("isoc_test", NULL); -+ if(pdir == NULL) { -+ retval = -ENOMEM; -+ printk("Error creating dir\n"); -+ goto done; -+ } -+ pdir->owner = THIS_MODULE; -+ -+ pfile = create_proc_read_entry("isoc_data", -+ 0444, pdir, -+ isoc_read_data, -+ NULL); -+ if (pfile == NULL) { -+ retval = -ENOMEM; -+ printk("Error creating file\n"); -+ goto no_file; -+ } -+ pfile->owner = THIS_MODULE; -+ -+ return usb_gadget_register_driver (&zero_driver); -+ -+ no_file: -+ remove_proc_entry("isoc_data", NULL); -+ done: -+ return retval; -+} -+module_init (init); -+ -+static void __exit cleanup (void) -+{ -+ -+ usb_gadget_unregister_driver (&zero_driver); -+ -+ remove_proc_entry("isoc_data", pdir); -+ remove_proc_entry("isoc_test", NULL); -+} -+module_exit (cleanup); -diff --git a/drivers/usb/host/dwc_otg/dwc_cfi_common.h b/drivers/usb/host/dwc_otg/dwc_cfi_common.h -new file mode 100644 -index 0000000000000000000000000000000000000000..7770e201ad3bd877f1bb613284091301d084ade9 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_cfi_common.h -@@ -0,0 +1,142 @@ -+/* ========================================================================== -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_CFI_COMMON_H__) -+#define __DWC_CFI_COMMON_H__ -+ -+//#include -+ -+/** -+ * @file -+ * -+ * This file contains the CFI specific common constants, interfaces -+ * (functions and macros) and structures for Linux. No PCD specific -+ * data structure or definition is to be included in this file. -+ * -+ */ -+ -+/** This is a request for all Core Features */ -+#define VEN_CORE_GET_FEATURES 0xB1 -+ -+/** This is a request to get the value of a specific Core Feature */ -+#define VEN_CORE_GET_FEATURE 0xB2 -+ -+/** This command allows the host to set the value of a specific Core Feature */ -+#define VEN_CORE_SET_FEATURE 0xB3 -+ -+/** This command allows the host to set the default values of -+ * either all or any specific Core Feature -+ */ -+#define VEN_CORE_RESET_FEATURES 0xB4 -+ -+/** This command forces the PCD to write the deferred values of a Core Features */ -+#define VEN_CORE_ACTIVATE_FEATURES 0xB5 -+ -+/** This request reads a DWORD value from a register at the specified offset */ -+#define VEN_CORE_READ_REGISTER 0xB6 -+ -+/** This request writes a DWORD value into a register at the specified offset */ -+#define VEN_CORE_WRITE_REGISTER 0xB7 -+ -+/** This structure is the header of the Core Features dataset returned to -+ * the Host -+ */ -+struct cfi_all_features_header { -+/** The features header structure length is */ -+#define CFI_ALL_FEATURES_HDR_LEN 8 -+ /** -+ * The total length of the features dataset returned to the Host -+ */ -+ uint16_t wTotalLen; -+ -+ /** -+ * CFI version number inBinary-Coded Decimal (i.e., 1.00 is 100H). -+ * This field identifies the version of the CFI Specification with which -+ * the device is compliant. -+ */ -+ uint16_t wVersion; -+ -+ /** The ID of the Core */ -+ uint16_t wCoreID; -+#define CFI_CORE_ID_UDC 1 -+#define CFI_CORE_ID_OTG 2 -+#define CFI_CORE_ID_WUDEV 3 -+ -+ /** Number of features returned by VEN_CORE_GET_FEATURES request */ -+ uint16_t wNumFeatures; -+} UPACKED; -+ -+typedef struct cfi_all_features_header cfi_all_features_header_t; -+ -+/** This structure is a header of the Core Feature descriptor dataset returned to -+ * the Host after the VEN_CORE_GET_FEATURES request -+ */ -+struct cfi_feature_desc_header { -+#define CFI_FEATURE_DESC_HDR_LEN 8 -+ -+ /** The feature ID */ -+ uint16_t wFeatureID; -+ -+ /** Length of this feature descriptor in bytes - including the -+ * length of the feature name string -+ */ -+ uint16_t wLength; -+ -+ /** The data length of this feature in bytes */ -+ uint16_t wDataLength; -+ -+ /** -+ * Attributes of this features -+ * D0: Access rights -+ * 0 - Read/Write -+ * 1 - Read only -+ */ -+ uint8_t bmAttributes; -+#define CFI_FEATURE_ATTR_RO 1 -+#define CFI_FEATURE_ATTR_RW 0 -+ -+ /** Length of the feature name in bytes */ -+ uint8_t bNameLen; -+ -+ /** The feature name buffer */ -+ //uint8_t *name; -+} UPACKED; -+ -+typedef struct cfi_feature_desc_header cfi_feature_desc_header_t; -+ -+/** -+ * This structure describes a NULL terminated string referenced by its id field. -+ * It is very similar to usb_string structure but has the id field type set to 16-bit. -+ */ -+struct cfi_string { -+ uint16_t id; -+ const uint8_t *s; -+}; -+typedef struct cfi_string cfi_string_t; -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.c b/drivers/usb/host/dwc_otg/dwc_otg_adp.c -new file mode 100644 -index 0000000000000000000000000000000000000000..ce0618dd3f4a6b2b2e7e65ba75f1214faca7c6f0 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.c -@@ -0,0 +1,854 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.c $ -+ * $Revision: #12 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#include "dwc_os.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_adp.h" -+ -+/** @file -+ * -+ * This file contains the most of the Attach Detect Protocol implementation for -+ * the driver to support OTG Rev2.0. -+ * -+ */ -+ -+void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value) -+{ -+ adpctl_data_t adpctl; -+ -+ adpctl.d32 = value; -+ adpctl.b.ar = 0x2; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); -+ -+ while (adpctl.b.ar) { -+ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); -+ } -+ -+} -+ -+/** -+ * Function is called to read ADP registers -+ */ -+uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ adpctl.d32 = 0; -+ adpctl.b.ar = 0x1; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->adpctl, adpctl.d32); -+ -+ while (adpctl.b.ar) { -+ adpctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->adpctl); -+ } -+ -+ return adpctl.d32; -+} -+ -+/** -+ * Function is called to read ADPCTL register and filter Write-clear bits -+ */ -+uint32_t dwc_otg_adp_read_reg_filter(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_tmout_int = 0; -+ adpctl.b.adp_prb_int = 0; -+ adpctl.b.adp_tmout_int = 0; -+ -+ return adpctl.d32; -+} -+ -+/** -+ * Function is called to write ADP registers -+ */ -+void dwc_otg_adp_modify_reg(dwc_otg_core_if_t * core_if, uint32_t clr, -+ uint32_t set) -+{ -+ dwc_otg_adp_write_reg(core_if, -+ (dwc_otg_adp_read_reg(core_if) & (~clr)) | set); -+} -+ -+static void adp_sense_timeout(void *ptr) -+{ -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ core_if->adp.sense_timer_started = 0; -+ DWC_PRINTF("ADP SENSE TIMEOUT\n"); -+ if (core_if->adp_enable) { -+ dwc_otg_adp_sense_stop(core_if); -+ dwc_otg_adp_probe_start(core_if); -+ } -+} -+ -+/** -+ * This function is called when the ADP vbus timer expires. Timeout is 1.1s. -+ */ -+static void adp_vbuson_timeout(void *ptr) -+{ -+ gpwrdn_data_t gpwrdn; -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ DWC_PRINTF("%s: 1.1 seconds expire after turning on VBUS\n",__FUNCTION__); -+ if (core_if) { -+ core_if->adp.vbuson_timer_started = 0; -+ /* Turn off vbus */ -+ hprt0.b.prtpwr = 1; -+ DWC_MODIFY_REG32(core_if->host_if->hprt0, hprt0.d32, 0); -+ gpwrdn.d32 = 0; -+ -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ /* Enable Wakeup Logic */ -+// gpwrdn.b.wkupactiv = 1; -+ gpwrdn.b.pmuactv = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ -+ /* Suspend the Phy Clock */ -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ /* Switch on VDD */ -+// gpwrdn.b.wkupactiv = 1; -+ gpwrdn.b.pmuactv = 1; -+ gpwrdn.b.pwrdnrstn = 1; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ } else { -+ /* Enable Power Down Logic */ -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ } -+ -+ /* Unmask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ -+ dwc_otg_adp_probe_start(core_if); -+ dwc_otg_dump_global_registers(core_if); -+ dwc_otg_dump_host_registers(core_if); -+ } -+ -+} -+ -+/** -+ * Start the ADP Initial Probe timer to detect if Port Connected interrupt is -+ * not asserted within 1.1 seconds. -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+void dwc_otg_adp_vbuson_timer_start(dwc_otg_core_if_t * core_if) -+{ -+ core_if->adp.vbuson_timer_started = 1; -+ if (core_if->adp.vbuson_timer) -+ { -+ DWC_PRINTF("SCHEDULING VBUSON TIMER\n"); -+ /* 1.1 secs + 60ms necessary for cil_hcd_start*/ -+ DWC_TIMER_SCHEDULE(core_if->adp.vbuson_timer, 1160); -+ } else { -+ DWC_WARN("VBUSON_TIMER = %p\n",core_if->adp.vbuson_timer); -+ } -+} -+ -+#if 0 -+/** -+ * Masks all DWC OTG core interrupts -+ * -+ */ -+static void mask_all_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ -+ /* Mask Host Interrupts */ -+ -+ /* Clear and disable HCINTs */ -+ for (i = 0; i < core_if->core_params->host_channels; i++) { -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, 0); -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcint, 0xFFFFFFFF); -+ -+ } -+ -+ /* Clear and disable HAINT */ -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, 0x0000); -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haint, 0xFFFFFFFF); -+ -+ /* Mask Device Interrupts */ -+ if (!core_if->multiproc_int_enable) { -+ /* Clear and disable IN Endpoint interrupts */ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, 0); -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> -+ diepint, 0xFFFFFFFF); -+ } -+ -+ /* Clear and disable OUT Endpoint interrupts */ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, 0); -+ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> -+ doepint, 0xFFFFFFFF); -+ } -+ -+ /* Clear and disable DAINT */ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daint, -+ 0xFFFFFFFF); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, 0); -+ } else { -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ diepeachintmsk[i], 0); -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]-> -+ diepint, 0xFFFFFFFF); -+ } -+ -+ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[i], 0); -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]-> -+ doepint, 0xFFFFFFFF); -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, -+ 0); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->deachint, -+ 0xFFFFFFFF); -+ -+ } -+ -+ /* Disable interrupts */ -+ ahbcfg.b.glblintrmsk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); -+ -+ /* Disable all interrupts. */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); -+ -+ /* Clear any pending interrupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Clear any pending OTG Interrupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, 0xFFFFFFFF); -+} -+ -+/** -+ * Unmask Port Connection Detected interrupt -+ * -+ */ -+static void unmask_conn_det_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintmsk_data_t gintmsk = {.d32 = 0,.b.portintr = 1 }; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); -+} -+#endif -+ -+/** -+ * Starts the ADP Probing -+ * -+ * @param core_if the pointer to core_if structure. -+ */ -+uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if) -+{ -+ -+ adpctl_data_t adpctl = {.d32 = 0}; -+ gpwrdn_data_t gpwrdn; -+#if 0 -+ adpctl_data_t adpctl_int = {.d32 = 0, .b.adp_prb_int = 1, -+ .b.adp_sns_int = 1, b.adp_tmout_int}; -+#endif -+ dwc_otg_disable_global_interrupts(core_if); -+ DWC_PRINTF("ADP Probe Start\n"); -+ core_if->adp.probe_enabled = 1; -+ -+ adpctl.b.adpres = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ while (adpctl.b.adpres) { -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ } -+ -+ adpctl.d32 = 0; -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ /* In Host mode unmask SRP detected interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.sts_chngint_msk = 1; -+ if (!gpwrdn.b.idsts) { -+ gpwrdn.b.srp_det_msk = 1; -+ } -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ -+ adpctl.b.adp_tmout_int_msk = 1; -+ adpctl.b.adp_prb_int_msk = 1; -+ adpctl.b.prb_dschg = 1; -+ adpctl.b.prb_delta = 1; -+ adpctl.b.prb_per = 1; -+ adpctl.b.adpen = 1; -+ adpctl.b.enaprb = 1; -+ -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ DWC_PRINTF("ADP Probe Finish\n"); -+ return 0; -+} -+ -+/** -+ * Starts the ADP Sense timer to detect if ADP Sense interrupt is not asserted -+ * within 3 seconds. -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+void dwc_otg_adp_sense_timer_start(dwc_otg_core_if_t * core_if) -+{ -+ core_if->adp.sense_timer_started = 1; -+ DWC_TIMER_SCHEDULE(core_if->adp.sense_timer, 3000 /* 3 secs */ ); -+} -+ -+/** -+ * Starts the ADP Sense -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ DWC_PRINTF("ADP Sense Start\n"); -+ -+ /* Unmask ADP sense interrupt and mask all other from the core */ -+ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); -+ adpctl.b.adp_sns_int_msk = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ dwc_otg_disable_global_interrupts(core_if); // vahrama -+ -+ /* Set ADP reset bit*/ -+ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); -+ adpctl.b.adpres = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ while (adpctl.b.adpres) { -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ } -+ -+ adpctl.b.adpres = 0; -+ adpctl.b.adpen = 1; -+ adpctl.b.enasns = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ dwc_otg_adp_sense_timer_start(core_if); -+ -+ return 0; -+} -+ -+/** -+ * Stops the ADP Probing -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if) -+{ -+ -+ adpctl_data_t adpctl; -+ DWC_PRINTF("Stop ADP probe\n"); -+ core_if->adp.probe_enabled = 0; -+ core_if->adp.probe_counter = 0; -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ -+ adpctl.b.adpen = 0; -+ adpctl.b.adp_prb_int = 1; -+ adpctl.b.adp_tmout_int = 1; -+ adpctl.b.adp_sns_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * Stops the ADP Sensing -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ -+ core_if->adp.sense_enabled = 0; -+ -+ adpctl.d32 = dwc_otg_adp_read_reg_filter(core_if); -+ adpctl.b.enasns = 0; -+ adpctl.b.adp_sns_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * Called to turn on the VBUS after initial ADP probe in host mode. -+ * If port power was already enabled in cil_hcd_start function then -+ * only schedule a timer. -+ * -+ * @param core_if the pointer to core_if structure. -+ */ -+void dwc_otg_adp_turnon_vbus(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ DWC_PRINTF("Turn on VBUS for 1.1s, port power is %d\n", hprt0.b.prtpwr); -+ -+ if (hprt0.b.prtpwr == 0) { -+ hprt0.b.prtpwr = 1; -+ //DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ -+ dwc_otg_adp_vbuson_timer_start(core_if); -+} -+ -+/** -+ * Called right after driver is loaded -+ * to perform initial actions for ADP -+ * -+ * @param core_if the pointer to core_if structure. -+ * @param is_host - flag for current mode of operation either from GINTSTS or GPWRDN -+ */ -+void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host) -+{ -+ gpwrdn_data_t gpwrdn; -+ -+ DWC_PRINTF("ADP Initial Start\n"); -+ core_if->adp.adp_started = 1; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ dwc_otg_disable_global_interrupts(core_if); -+ if (is_host) { -+ DWC_PRINTF("HOST MODE\n"); -+ /* Enable Power Down Logic Interrupt*/ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ /* Initialize first ADP probe to obtain Ramp Time value */ -+ core_if->adp.initial_probe = 1; -+ dwc_otg_adp_probe_start(core_if); -+ } else { -+ gotgctl_data_t gotgctl; -+ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ DWC_PRINTF("DEVICE MODE\n"); -+ if (gotgctl.b.bsesvld == 0) { -+ /* Enable Power Down Logic Interrupt*/ -+ gpwrdn.d32 = 0; -+ DWC_PRINTF("VBUS is not valid - start ADP probe\n"); -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ core_if->adp.initial_probe = 1; -+ dwc_otg_adp_probe_start(core_if); -+ } else { -+ DWC_PRINTF("VBUS is valid - initialize core as a Device\n"); -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ dwc_otg_dump_global_registers(core_if); -+ dwc_otg_dump_dev_registers(core_if); -+ } -+ } -+} -+ -+void dwc_otg_adp_init(dwc_otg_core_if_t * core_if) -+{ -+ core_if->adp.adp_started = 0; -+ core_if->adp.initial_probe = 0; -+ core_if->adp.probe_timer_values[0] = -1; -+ core_if->adp.probe_timer_values[1] = -1; -+ core_if->adp.probe_enabled = 0; -+ core_if->adp.sense_enabled = 0; -+ core_if->adp.sense_timer_started = 0; -+ core_if->adp.vbuson_timer_started = 0; -+ core_if->adp.probe_counter = 0; -+ core_if->adp.gpwrdn = 0; -+ core_if->adp.attached = DWC_OTG_ADP_UNKOWN; -+ /* Initialize timers */ -+ core_if->adp.sense_timer = -+ DWC_TIMER_ALLOC("ADP SENSE TIMER", adp_sense_timeout, core_if); -+ core_if->adp.vbuson_timer = -+ DWC_TIMER_ALLOC("ADP VBUS ON TIMER", adp_vbuson_timeout, core_if); -+ if (!core_if->adp.sense_timer || !core_if->adp.vbuson_timer) -+ { -+ DWC_ERROR("Could not allocate memory for ADP timers\n"); -+ } -+} -+ -+void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = { .d32 = 0 }; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ if (core_if->adp.probe_enabled) -+ dwc_otg_adp_probe_stop(core_if); -+ if (core_if->adp.sense_enabled) -+ dwc_otg_adp_sense_stop(core_if); -+ if (core_if->adp.sense_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.sense_timer); -+ if (core_if->adp.vbuson_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); -+ DWC_TIMER_FREE(core_if->adp.sense_timer); -+ DWC_TIMER_FREE(core_if->adp.vbuson_timer); -+} -+ -+///////////////////////////////////////////////////////////////////// -+////////////// ADP Interrupt Handlers /////////////////////////////// -+///////////////////////////////////////////////////////////////////// -+/** -+ * This function sets Ramp Timer values -+ */ -+static uint32_t set_timer_value(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ if (core_if->adp.probe_timer_values[0] == -1) { -+ core_if->adp.probe_timer_values[0] = val; -+ core_if->adp.probe_timer_values[1] = -1; -+ return 1; -+ } else { -+ core_if->adp.probe_timer_values[1] = -+ core_if->adp.probe_timer_values[0]; -+ core_if->adp.probe_timer_values[0] = val; -+ return 0; -+ } -+} -+ -+/** -+ * This function compares Ramp Timer values -+ */ -+static uint32_t compare_timer_values(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t diff; -+ if (core_if->adp.probe_timer_values[0]>=core_if->adp.probe_timer_values[1]) -+ diff = core_if->adp.probe_timer_values[0]-core_if->adp.probe_timer_values[1]; -+ else -+ diff = core_if->adp.probe_timer_values[1]-core_if->adp.probe_timer_values[0]; -+ if(diff < 2) { -+ return 0; -+ } else { -+ return 1; -+ } -+} -+ -+/** -+ * This function handles ADP Probe Interrupts -+ */ -+static int32_t dwc_otg_adp_handle_prb_intr(dwc_otg_core_if_t * core_if, -+ uint32_t val) -+{ -+ adpctl_data_t adpctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn, temp; -+ adpctl.d32 = val; -+ -+ temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ core_if->adp.probe_counter++; -+ core_if->adp.gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (adpctl.b.rtim == 0 && !temp.b.idsts){ -+ DWC_PRINTF("RTIM value is 0\n"); -+ goto exit; -+ } -+ if (set_timer_value(core_if, adpctl.b.rtim) && -+ core_if->adp.initial_probe) { -+ core_if->adp.initial_probe = 0; -+ dwc_otg_adp_probe_stop(core_if); -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* check which value is for device mode and which for Host mode */ -+ if (!temp.b.idsts) { /* considered host mode value is 0 */ -+ /* -+ * Turn on VBUS after initial ADP probe. -+ */ -+ core_if->op_state = A_HOST; -+ dwc_otg_enable_global_interrupts(core_if); -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_start(core_if); -+ dwc_otg_adp_turnon_vbus(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ } else { -+ /* -+ * Initiate SRP after initial ADP probe. -+ */ -+ dwc_otg_enable_global_interrupts(core_if); -+ dwc_otg_initiate_srp(core_if); -+ } -+ } else if (core_if->adp.probe_counter > 2){ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (compare_timer_values(core_if)) { -+ DWC_PRINTF("Difference in timer values !!! \n"); -+// core_if->adp.attached = DWC_OTG_ADP_ATTACHED; -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Power on the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ /* check which value is for device mode and which for Host mode */ -+ if (!temp.b.idsts) { /* considered host mode value is 0 */ -+ /* Disable Interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Host mode. -+ */ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } else { -+ gotgctl_data_t gotgctl; -+ /* Mask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ -+ /* Disable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Device mode. -+ */ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ -+ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ if (!gotgctl.b.bsesvld) { -+ dwc_otg_initiate_srp(core_if); -+ } -+ } -+ } -+ if (core_if->power_down == 2) { -+ if (gpwrdn.b.bsessvld) { -+ /* Mask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Disable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Device mode. -+ */ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } -+ } -+ } -+exit: -+ /* Clear interrupt */ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_prb_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * This function hadles ADP Sense Interrupt -+ */ -+static int32_t dwc_otg_adp_handle_sns_intr(dwc_otg_core_if_t * core_if) -+{ -+ adpctl_data_t adpctl; -+ /* Stop ADP Sense timer */ -+ DWC_TIMER_CANCEL(core_if->adp.sense_timer); -+ -+ /* Restart ADP Sense timer */ -+ dwc_otg_adp_sense_timer_start(core_if); -+ -+ /* Clear interrupt */ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_sns_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * This function handles ADP Probe Interrupts -+ */ -+static int32_t dwc_otg_adp_handle_prb_tmout_intr(dwc_otg_core_if_t * core_if, -+ uint32_t val) -+{ -+ adpctl_data_t adpctl = {.d32 = 0 }; -+ adpctl.d32 = val; -+ set_timer_value(core_if, adpctl.b.rtim); -+ -+ /* Clear interrupt */ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ adpctl.b.adp_tmout_int = 1; -+ dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ -+ return 0; -+} -+ -+/** -+ * ADP Interrupt handler. -+ * -+ */ -+int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if) -+{ -+ int retval = 0; -+ adpctl_data_t adpctl = {.d32 = 0}; -+ -+ adpctl.d32 = dwc_otg_adp_read_reg(core_if); -+ DWC_PRINTF("ADPCTL = %08x\n",adpctl.d32); -+ -+ if (adpctl.b.adp_sns_int & adpctl.b.adp_sns_int_msk) { -+ DWC_PRINTF("ADP Sense interrupt\n"); -+ retval |= dwc_otg_adp_handle_sns_intr(core_if); -+ } -+ if (adpctl.b.adp_tmout_int & adpctl.b.adp_tmout_int_msk) { -+ DWC_PRINTF("ADP timeout interrupt\n"); -+ retval |= dwc_otg_adp_handle_prb_tmout_intr(core_if, adpctl.d32); -+ } -+ if (adpctl.b.adp_prb_int & adpctl.b.adp_prb_int_msk) { -+ DWC_PRINTF("ADP Probe interrupt\n"); -+ adpctl.b.adp_prb_int = 1; -+ retval |= dwc_otg_adp_handle_prb_intr(core_if, adpctl.d32); -+ } -+ -+// dwc_otg_adp_modify_reg(core_if, adpctl.d32, 0); -+ //dwc_otg_adp_write_reg(core_if, adpctl.d32); -+ DWC_PRINTF("RETURN FROM ADP ISR\n"); -+ -+ return retval; -+} -+ -+/** -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if) -+{ -+ -+#ifndef DWC_HOST_ONLY -+ hprt0_data_t hprt0; -+ gpwrdn_data_t gpwrdn; -+ DWC_DEBUGPL(DBG_ANY, "++ Power Down Logic Session Request Interrupt++\n"); -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ /* check which value is for device mode and which for Host mode */ -+ if (!gpwrdn.b.idsts) { /* considered host mode value is 0 */ -+ DWC_PRINTF("SRP: Host mode\n"); -+ -+ if (core_if->adp_enable) { -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Power on the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+ -+ /* Turn on the port power bit. */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Start the Connection timer. So a message can be displayed -+ * if connect does not occur within 10 seconds. */ -+ cil_hcd_session_start(core_if); -+ } else { -+ DWC_PRINTF("SRP: Device mode %s\n", __FUNCTION__); -+ if (core_if->adp_enable) { -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Power on the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 0; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } -+ } -+#endif -+ return 1; -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_adp.h b/drivers/usb/host/dwc_otg/dwc_otg_adp.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4110b25d2002ed64a760cf41bbf81c903b5bc572 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_adp.h -@@ -0,0 +1,80 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.h $ -+ * $Revision: #7 $ -+ * $Date: 2011/10/24 $ -+ * $Change: 1871159 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_ADP_H__ -+#define __DWC_OTG_ADP_H__ -+ -+/** -+ * @file -+ * -+ * This file contains the Attach Detect Protocol interfaces and defines -+ * (functions) and structures for Linux. -+ * -+ */ -+ -+#define DWC_OTG_ADP_UNATTACHED 0 -+#define DWC_OTG_ADP_ATTACHED 1 -+#define DWC_OTG_ADP_UNKOWN 2 -+ -+typedef struct dwc_otg_adp { -+ uint32_t adp_started; -+ uint32_t initial_probe; -+ int32_t probe_timer_values[2]; -+ uint32_t probe_enabled; -+ uint32_t sense_enabled; -+ dwc_timer_t *sense_timer; -+ uint32_t sense_timer_started; -+ dwc_timer_t *vbuson_timer; -+ uint32_t vbuson_timer_started; -+ uint32_t attached; -+ uint32_t probe_counter; -+ uint32_t gpwrdn; -+} dwc_otg_adp_t; -+ -+/** -+ * Attach Detect Protocol functions -+ */ -+ -+extern void dwc_otg_adp_write_reg(dwc_otg_core_if_t * core_if, uint32_t value); -+extern uint32_t dwc_otg_adp_read_reg(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_probe_start(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_sense_start(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_probe_stop(dwc_otg_core_if_t * core_if); -+extern uint32_t dwc_otg_adp_sense_stop(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); -+extern void dwc_otg_adp_init(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_adp_remove(dwc_otg_core_if_t * core_if); -+extern int32_t dwc_otg_adp_handle_intr(dwc_otg_core_if_t * core_if); -+extern int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if); -+ -+#endif //__DWC_OTG_ADP_H__ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.c b/drivers/usb/host/dwc_otg/dwc_otg_attr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9da0c92aaeca2fc393016442cc6578cb4a52c978 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.c -@@ -0,0 +1,1210 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ -+ * $Revision: #44 $ -+ * $Date: 2010/11/29 $ -+ * $Change: 1636033 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * The diagnostic interface will provide access to the controller for -+ * bringing up the hardware and testing. The Linux driver attributes -+ * feature will be used to provide the Linux Diagnostic -+ * Interface. These attributes are accessed through sysfs. -+ */ -+ -+/** @page "Linux Module Attributes" -+ * -+ * The Linux module attributes feature is used to provide the Linux -+ * Diagnostic Interface. These attributes are accessed through sysfs. -+ * The diagnostic interface will provide access to the controller for -+ * bringing up the hardware and testing. -+ -+ The following table shows the attributes. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
Name Description Access
mode Returns the current mode: 0 for device mode, 1 for host mode Read
hnpcapable Gets or sets the "HNP-capable" bit in the Core USB Configuraton Register. -+ Read returns the current value. Read/Write
srpcapable Gets or sets the "SRP-capable" bit in the Core USB Configuraton Register. -+ Read returns the current value. Read/Write
hsic_connect Gets or sets the "HSIC-Connect" bit in the GLPMCFG Register. -+ Read returns the current value. Read/Write
inv_sel_hsic Gets or sets the "Invert Select HSIC" bit in the GLPMFG Register. -+ Read returns the current value. Read/Write
hnp Initiates the Host Negotiation Protocol. Read returns the status. Read/Write
srp Initiates the Session Request Protocol. Read returns the status. Read/Write
buspower Gets or sets the Power State of the bus (0 - Off or 1 - On) Read/Write
bussuspend Suspends the USB bus. Read/Write
busconnected Gets the connection status of the bus Read
gotgctl Gets or sets the Core Control Status Register. Read/Write
gusbcfg Gets or sets the Core USB Configuration Register Read/Write
grxfsiz Gets or sets the Receive FIFO Size Register Read/Write
gnptxfsiz Gets or sets the non-periodic Transmit Size Register Read/Write
gpvndctl Gets or sets the PHY Vendor Control Register Read/Write
ggpio Gets the value in the lower 16-bits of the General Purpose IO Register -+ or sets the upper 16 bits. Read/Write
guid Gets or sets the value of the User ID Register Read/Write
gsnpsid Gets the value of the Synopsys ID Regester Read
devspeed Gets or sets the device speed setting in the DCFG register Read/Write
enumspeed Gets the device enumeration Speed. Read
hptxfsiz Gets the value of the Host Periodic Transmit FIFO Read
hprt0 Gets or sets the value in the Host Port Control and Status Register Read/Write
regoffset Sets the register offset for the next Register Access Read/Write
regvalue Gets or sets the value of the register at the offset in the regoffset attribute. Read/Write
remote_wakeup On read, shows the status of Remote Wakeup. On write, initiates a remote -+ wakeup of the host. When bit 0 is 1 and Remote Wakeup is enabled, the Remote -+ Wakeup signalling bit in the Device Control Register is set for 1 -+ milli-second. Read/Write
rem_wakeup_pwrdn On read, shows the status core - hibernated or not. On write, initiates -+ a remote wakeup of the device from Hibernation. Read/Write
mode_ch_tim_en This bit is used to enable or disable the host core to wait for 200 PHY -+ clock cycles at the end of Resume to change the opmode signal to the PHY to 00 -+ after Suspend or LPM. Read/Write
fr_interval On read, shows the value of HFIR Frame Interval. On write, dynamically -+ reload HFIR register during runtime. The application can write a value to this -+ register only after the Port Enable bit of the Host Port Control and Status -+ register (HPRT.PrtEnaPort) has been set Read/Write
disconnect_us On read, shows the status of disconnect_device_us. On write, sets disconnect_us -+ which causes soft disconnect for 100us. Applicable only for device mode of operation. Read/Write
regdump Dumps the contents of core registers. Read
spramdump Dumps the contents of core registers. Read
hcddump Dumps the current HCD state. Read
hcd_frrem Shows the average value of the Frame Remaining -+ field in the Host Frame Number/Frame Remaining register when an SOF interrupt -+ occurs. This can be used to determine the average interrupt latency. Also -+ shows the average Frame Remaining value for start_transfer and the "a" and -+ "b" sample points. The "a" and "b" sample points may be used during debugging -+ bto determine how long it takes to execute a section of the HCD code. Read
rd_reg_test Displays the time required to read the GNPTXFSIZ register many times -+ (the output shows the number of times the register is read). -+ Read
wr_reg_test Displays the time required to write the GNPTXFSIZ register many times -+ (the output shows the number of times the register is written). -+ Read
lpm_response Gets or sets lpm_response mode. Applicable only in device mode. -+ Write
sleep_status Shows sleep status of device. -+ Read
-+ -+ Example usage: -+ To get the current mode: -+ cat /sys/devices/lm0/mode -+ -+ To power down the USB: -+ echo 0 > /sys/devices/lm0/buspower -+ */ -+ -+#include "dwc_otg_os_dep.h" -+#include "dwc_os.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_attr.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_hcd_if.h" -+ -+/* -+ * MACROs for defining sysfs attribute -+ */ -+#ifdef LM_INTERFACE -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t set = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ -+ return count; \ -+} -+ -+#elif defined(PCI_INTERFACE) -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t set = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ -+ return count; \ -+} -+ -+#elif defined(PLATFORM_INTERFACE) -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct platform_device *platform_dev = \ -+ container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t val; \ -+ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ -+ __func__, _dev, platform_dev, otg_dev); \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t set = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_(otg_dev->core_if, set);\ -+ return count; \ -+} -+#endif -+ -+/* -+ * MACROs for defining sysfs attribute for 32-bit registers -+ */ -+#ifdef LM_INTERFACE -+#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ -+ dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ -+ uint32_t val = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ -+ return count; \ -+} -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t val; \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); \ -+ uint32_t val = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ -+ return count; \ -+} -+ -+#elif defined(PLATFORM_INTERFACE) -+#include "dwc_otg_dbg.h" -+#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ -+{ \ -+ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t val; \ -+ DWC_PRINTF("%s(%p) -> platform_dev %p, otg_dev %p\n", \ -+ __func__, _dev, platform_dev, otg_dev); \ -+ val = dwc_otg_get_##_otg_attr_name_ (otg_dev->core_if); \ -+ return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ -+} -+#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ -+ const char *buf, size_t count) \ -+{ \ -+ struct platform_device *platform_dev = container_of(_dev, struct platform_device, dev); \ -+ dwc_otg_device_t *otg_dev = platform_get_drvdata(platform_dev); \ -+ uint32_t val = simple_strtoul(buf, NULL, 16); \ -+ dwc_otg_set_##_otg_attr_name_ (otg_dev->core_if, val); \ -+ return count; \ -+} -+ -+#endif -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_RW(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); -+ -+#define DWC_OTG_DEVICE_ATTR_BITFIELD_RO(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); -+ -+#define DWC_OTG_DEVICE_ATTR_REG32_RW(_otg_attr_name_,_addr_,_string_) \ -+DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0644,_otg_attr_name_##_show,_otg_attr_name_##_store); -+ -+#define DWC_OTG_DEVICE_ATTR_REG32_RO(_otg_attr_name_,_addr_,_string_) \ -+DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_string_) \ -+DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); -+ -+/** @name Functions for Show/Store of Attributes */ -+/**@{*/ -+ -+/** -+ * Helper function returning the otg_device structure of the given device -+ */ -+static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) -+{ -+ dwc_otg_device_t *otg_dev; -+ DWC_OTG_GETDRVDEV(otg_dev, _dev); -+ return otg_dev; -+} -+ -+/** -+ * Show the register offset of the Register Access. -+ */ -+static ssize_t regoffset_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return snprintf(buf, sizeof("0xFFFFFFFF\n") + 1, "0x%08x\n", -+ otg_dev->os_dep.reg_offset); -+} -+ -+/** -+ * Set the register offset for the next Register Access Read/Write -+ */ -+static ssize_t regoffset_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t offset = simple_strtoul(buf, NULL, 16); -+#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) -+ if (offset < SZ_256K) { -+#elif defined(PCI_INTERFACE) -+ if (offset < 0x00040000) { -+#endif -+ otg_dev->os_dep.reg_offset = offset; -+ } else { -+ dev_err(_dev, "invalid offset\n"); -+ } -+ -+ return count; -+} -+ -+DEVICE_ATTR(regoffset, S_IRUGO | S_IWUSR, regoffset_show, regoffset_store); -+ -+/** -+ * Show the value of the register at the offset in the reg_offset -+ * attribute. -+ */ -+static ssize_t regvalue_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val; -+ volatile uint32_t *addr; -+ -+ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { -+ /* Calculate the address */ -+ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + -+ (uint8_t *) otg_dev->os_dep.base); -+ val = DWC_READ_REG32(addr); -+ return snprintf(buf, -+ sizeof("Reg@0xFFFFFFFF = 0xFFFFFFFF\n") + 1, -+ "Reg@0x%06x = 0x%08x\n", otg_dev->os_dep.reg_offset, -+ val); -+ } else { -+ dev_err(_dev, "Invalid offset (0x%0x)\n", otg_dev->os_dep.reg_offset); -+ return sprintf(buf, "invalid offset\n"); -+ } -+} -+ -+/** -+ * Store the value in the register at the offset in the reg_offset -+ * attribute. -+ * -+ */ -+static ssize_t regvalue_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ volatile uint32_t *addr; -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ //dev_dbg(_dev, "Offset=0x%08x Val=0x%08x\n", otg_dev->reg_offset, val); -+ if (otg_dev->os_dep.reg_offset != 0xFFFFFFFF && 0 != otg_dev->os_dep.base) { -+ /* Calculate the address */ -+ addr = (uint32_t *) (otg_dev->os_dep.reg_offset + -+ (uint8_t *) otg_dev->os_dep.base); -+ DWC_WRITE_REG32(addr, val); -+ } else { -+ dev_err(_dev, "Invalid Register Offset (0x%08x)\n", -+ otg_dev->os_dep.reg_offset); -+ } -+ return count; -+} -+ -+DEVICE_ATTR(regvalue, S_IRUGO | S_IWUSR, regvalue_show, regvalue_store); -+ -+/* -+ * Attributes -+ */ -+DWC_OTG_DEVICE_ATTR_BITFIELD_RO(mode, "Mode"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hnpcapable, "HNPCapable"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(srpcapable, "SRPCapable"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(hsic_connect, "HSIC Connect"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(inv_sel_hsic, "Invert Select HSIC"); -+ -+//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(buspower,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); -+//DWC_OTG_DEVICE_ATTR_BITFIELD_RW(bussuspend,&(otg_dev->core_if->core_global_regs->gotgctl),(1<<8),8,"Mode"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RO(busconnected, "Bus Connected"); -+ -+DWC_OTG_DEVICE_ATTR_REG32_RW(gotgctl, 0, "GOTGCTL"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(gusbcfg, -+ &(otg_dev->core_if->core_global_regs->gusbcfg), -+ "GUSBCFG"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(grxfsiz, -+ &(otg_dev->core_if->core_global_regs->grxfsiz), -+ "GRXFSIZ"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(gnptxfsiz, -+ &(otg_dev->core_if->core_global_regs->gnptxfsiz), -+ "GNPTXFSIZ"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(gpvndctl, -+ &(otg_dev->core_if->core_global_regs->gpvndctl), -+ "GPVNDCTL"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(ggpio, -+ &(otg_dev->core_if->core_global_regs->ggpio), -+ "GGPIO"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(guid, &(otg_dev->core_if->core_global_regs->guid), -+ "GUID"); -+DWC_OTG_DEVICE_ATTR_REG32_RO(gsnpsid, -+ &(otg_dev->core_if->core_global_regs->gsnpsid), -+ "GSNPSID"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RW(devspeed, "Device Speed"); -+DWC_OTG_DEVICE_ATTR_BITFIELD_RO(enumspeed, "Device Enumeration Speed"); -+ -+DWC_OTG_DEVICE_ATTR_REG32_RO(hptxfsiz, -+ &(otg_dev->core_if->core_global_regs->hptxfsiz), -+ "HPTXFSIZ"); -+DWC_OTG_DEVICE_ATTR_REG32_RW(hprt0, otg_dev->core_if->host_if->hprt0, "HPRT0"); -+ -+/** -+ * @todo Add code to initiate the HNP. -+ */ -+/** -+ * Show the HNP status bit -+ */ -+static ssize_t hnp_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "HstNegScs = 0x%x\n", -+ dwc_otg_get_hnpstatus(otg_dev->core_if)); -+} -+ -+/** -+ * Set the HNP Request bit -+ */ -+static ssize_t hnp_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_hnpreq(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(hnp, 0644, hnp_show, hnp_store); -+ -+/** -+ * @todo Add code to initiate the SRP. -+ */ -+/** -+ * Show the SRP status bit -+ */ -+static ssize_t srp_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "SesReqScs = 0x%x\n", -+ dwc_otg_get_srpstatus(otg_dev->core_if)); -+#else -+ return sprintf(buf, "Host Only Mode!\n"); -+#endif -+} -+ -+/** -+ * Set the SRP Request bit -+ */ -+static ssize_t srp_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_pcd_initiate_srp(otg_dev->pcd); -+#endif -+ return count; -+} -+ -+DEVICE_ATTR(srp, 0644, srp_show, srp_store); -+ -+/** -+ * @todo Need to do more for power on/off? -+ */ -+/** -+ * Show the Bus Power status -+ */ -+static ssize_t buspower_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Bus Power = 0x%x\n", -+ dwc_otg_get_prtpower(otg_dev->core_if)); -+} -+ -+/** -+ * Set the Bus Power status -+ */ -+static ssize_t buspower_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t on = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_prtpower(otg_dev->core_if, on); -+ return count; -+} -+ -+DEVICE_ATTR(buspower, 0644, buspower_show, buspower_store); -+ -+/** -+ * @todo Need to do more for suspend? -+ */ -+/** -+ * Show the Bus Suspend status -+ */ -+static ssize_t bussuspend_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Bus Suspend = 0x%x\n", -+ dwc_otg_get_prtsuspend(otg_dev->core_if)); -+} -+ -+/** -+ * Set the Bus Suspend status -+ */ -+static ssize_t bussuspend_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_prtsuspend(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(bussuspend, 0644, bussuspend_show, bussuspend_store); -+ -+/** -+ * Show the Mode Change Ready Timer status -+ */ -+static ssize_t mode_ch_tim_en_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Mode Change Ready Timer Enable = 0x%x\n", -+ dwc_otg_get_mode_ch_tim(otg_dev->core_if)); -+} -+ -+/** -+ * Set the Mode Change Ready Timer status -+ */ -+static ssize_t mode_ch_tim_en_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 16); -+ dwc_otg_set_mode_ch_tim(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(mode_ch_tim_en, 0644, mode_ch_tim_en_show, mode_ch_tim_en_store); -+ -+/** -+ * Show the value of HFIR Frame Interval bitfield -+ */ -+static ssize_t fr_interval_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Frame Interval = 0x%x\n", -+ dwc_otg_get_fr_interval(otg_dev->core_if)); -+} -+ -+/** -+ * Set the HFIR Frame Interval value -+ */ -+static ssize_t fr_interval_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t in = simple_strtoul(buf, NULL, 10); -+ dwc_otg_set_fr_interval(otg_dev->core_if, in); -+ return count; -+} -+ -+DEVICE_ATTR(fr_interval, 0644, fr_interval_show, fr_interval_store); -+ -+/** -+ * Show the status of Remote Wakeup. -+ */ -+static ssize_t remote_wakeup_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ return sprintf(buf, -+ "Remote Wakeup Sig = %d Enabled = %d LPM Remote Wakeup = %d\n", -+ dwc_otg_get_remotewakesig(otg_dev->core_if), -+ dwc_otg_pcd_get_rmwkup_enable(otg_dev->pcd), -+ dwc_otg_get_lpm_remotewakeenabled(otg_dev->core_if)); -+#else -+ return sprintf(buf, "Host Only Mode!\n"); -+#endif /* DWC_HOST_ONLY */ -+} -+ -+/** -+ * Initiate a remote wakeup of the host. The Device control register -+ * Remote Wakeup Signal bit is written if the PCD Remote wakeup enable -+ * flag is set. -+ * -+ */ -+static ssize_t remote_wakeup_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ -+ if (val & 1) { -+ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 1); -+ } else { -+ dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 0); -+ } -+#endif /* DWC_HOST_ONLY */ -+ return count; -+} -+ -+DEVICE_ATTR(remote_wakeup, S_IRUGO | S_IWUSR, remote_wakeup_show, -+ remote_wakeup_store); -+ -+/** -+ * Show the whether core is hibernated or not. -+ */ -+static ssize_t rem_wakeup_pwrdn_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ if (dwc_otg_get_core_state(otg_dev->core_if)) { -+ DWC_PRINTF("Core is in hibernation\n"); -+ } else { -+ DWC_PRINTF("Core is not in hibernation\n"); -+ } -+#endif /* DWC_HOST_ONLY */ -+ return 0; -+} -+ -+extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset); -+ -+/** -+ * Initiate a remote wakeup of the device to exit from hibernation. -+ */ -+static ssize_t rem_wakeup_pwrdn_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_device_hibernation_restore(otg_dev->core_if, 1, 0); -+#endif -+ return count; -+} -+ -+DEVICE_ATTR(rem_wakeup_pwrdn, S_IRUGO | S_IWUSR, rem_wakeup_pwrdn_show, -+ rem_wakeup_pwrdn_store); -+ -+static ssize_t disconnect_us(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ -+#ifndef DWC_HOST_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ DWC_PRINTF("The Passed value is %04x\n", val); -+ -+ dwc_otg_pcd_disconnect_us(otg_dev->pcd, 50); -+ -+#endif /* DWC_HOST_ONLY */ -+ return count; -+} -+ -+DEVICE_ATTR(disconnect_us, S_IWUSR, 0, disconnect_us); -+ -+/** -+ * Dump global registers and either host or device registers (depending on the -+ * current mode of the core). -+ */ -+static ssize_t regdump_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ dwc_otg_dump_global_registers(otg_dev->core_if); -+ if (dwc_otg_is_host_mode(otg_dev->core_if)) { -+ dwc_otg_dump_host_registers(otg_dev->core_if); -+ } else { -+ dwc_otg_dump_dev_registers(otg_dev->core_if); -+ -+ } -+ return sprintf(buf, "Register Dump\n"); -+} -+ -+DEVICE_ATTR(regdump, S_IRUGO, regdump_show, 0); -+ -+/** -+ * Dump global registers and either host or device registers (depending on the -+ * current mode of the core). -+ */ -+static ssize_t spramdump_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ //dwc_otg_dump_spram(otg_dev->core_if); -+ -+ return sprintf(buf, "SPRAM Dump\n"); -+} -+ -+DEVICE_ATTR(spramdump, S_IRUGO, spramdump_show, 0); -+ -+/** -+ * Dump the current hcd state. -+ */ -+static ssize_t hcddump_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_DEVICE_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_hcd_dump_state(otg_dev->hcd); -+#endif /* DWC_DEVICE_ONLY */ -+ return sprintf(buf, "HCD Dump\n"); -+} -+ -+DEVICE_ATTR(hcddump, S_IRUGO, hcddump_show, 0); -+ -+/** -+ * Dump the average frame remaining at SOF. This can be used to -+ * determine average interrupt latency. Frame remaining is also shown for -+ * start transfer and two additional sample points. -+ */ -+static ssize_t hcd_frrem_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+#ifndef DWC_DEVICE_ONLY -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ dwc_otg_hcd_dump_frrem(otg_dev->hcd); -+#endif /* DWC_DEVICE_ONLY */ -+ return sprintf(buf, "HCD Dump Frame Remaining\n"); -+} -+ -+DEVICE_ATTR(hcd_frrem, S_IRUGO, hcd_frrem_show, 0); -+ -+/** -+ * Displays the time required to read the GNPTXFSIZ register many times (the -+ * output shows the number of times the register is read). -+ */ -+#define RW_REG_COUNT 10000000 -+#define MSEC_PER_JIFFIE 1000/HZ -+static ssize_t rd_reg_test_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ int i; -+ int time; -+ int start_jiffies; -+ -+ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", -+ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); -+ start_jiffies = jiffies; -+ for (i = 0; i < RW_REG_COUNT; i++) { -+ dwc_otg_get_gnptxfsiz(otg_dev->core_if); -+ } -+ time = jiffies - start_jiffies; -+ return sprintf(buf, -+ "Time to read GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", -+ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); -+} -+ -+DEVICE_ATTR(rd_reg_test, S_IRUGO, rd_reg_test_show, 0); -+ -+/** -+ * Displays the time required to write the GNPTXFSIZ register many times (the -+ * output shows the number of times the register is written). -+ */ -+static ssize_t wr_reg_test_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t reg_val; -+ int i; -+ int time; -+ int start_jiffies; -+ -+ printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", -+ HZ, MSEC_PER_JIFFIE, loops_per_jiffy); -+ reg_val = dwc_otg_get_gnptxfsiz(otg_dev->core_if); -+ start_jiffies = jiffies; -+ for (i = 0; i < RW_REG_COUNT; i++) { -+ dwc_otg_set_gnptxfsiz(otg_dev->core_if, reg_val); -+ } -+ time = jiffies - start_jiffies; -+ return sprintf(buf, -+ "Time to write GNPTXFSIZ reg %d times: %d msecs (%d jiffies)\n", -+ RW_REG_COUNT, time * MSEC_PER_JIFFIE, time); -+} -+ -+DEVICE_ATTR(wr_reg_test, S_IRUGO, wr_reg_test_show, 0); -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ -+/** -+* Show the lpm_response attribute. -+*/ -+static ssize_t lpmresp_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ -+ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) -+ return sprintf(buf, "** LPM is DISABLED **\n"); -+ -+ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { -+ return sprintf(buf, "** Current mode is not device mode\n"); -+ } -+ return sprintf(buf, "lpm_response = %d\n", -+ dwc_otg_get_lpmresponse(otg_dev->core_if)); -+} -+ -+/** -+* Store the lpm_response attribute. -+*/ -+static ssize_t lpmresp_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ uint32_t val = simple_strtoul(buf, NULL, 16); -+ -+ if (!dwc_otg_get_param_lpm_enable(otg_dev->core_if)) { -+ return 0; -+ } -+ -+ if (!dwc_otg_is_device_mode(otg_dev->core_if)) { -+ return 0; -+ } -+ -+ dwc_otg_set_lpmresponse(otg_dev->core_if, val); -+ return count; -+} -+ -+DEVICE_ATTR(lpm_response, S_IRUGO | S_IWUSR, lpmresp_show, lpmresp_store); -+ -+/** -+* Show the sleep_status attribute. -+*/ -+static ssize_t sleepstatus_show(struct device *_dev, -+ struct device_attribute *attr, char *buf) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ return sprintf(buf, "Sleep Status = %d\n", -+ dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)); -+} -+ -+/** -+ * Store the sleep_status attribure. -+ */ -+static ssize_t sleepstatus_store(struct device *_dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ dwc_otg_device_t *otg_dev = dwc_otg_drvdev(_dev); -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ -+ if (dwc_otg_get_lpm_portsleepstatus(otg_dev->core_if)) { -+ if (dwc_otg_is_host_mode(core_if)) { -+ -+ DWC_PRINTF("Host initiated resume\n"); -+ dwc_otg_set_prtresume(otg_dev->core_if, 1); -+ } -+ } -+ -+ return count; -+} -+ -+DEVICE_ATTR(sleep_status, S_IRUGO | S_IWUSR, sleepstatus_show, -+ sleepstatus_store); -+ -+#endif /* CONFIG_USB_DWC_OTG_LPM_ENABLE */ -+ -+/**@}*/ -+ -+/** -+ * Create the device files -+ */ -+void dwc_otg_attr_create( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ) -+{ -+ int error; -+ -+ error = device_create_file(&dev->dev, &dev_attr_regoffset); -+ error = device_create_file(&dev->dev, &dev_attr_regvalue); -+ error = device_create_file(&dev->dev, &dev_attr_mode); -+ error = device_create_file(&dev->dev, &dev_attr_hnpcapable); -+ error = device_create_file(&dev->dev, &dev_attr_srpcapable); -+ error = device_create_file(&dev->dev, &dev_attr_hsic_connect); -+ error = device_create_file(&dev->dev, &dev_attr_inv_sel_hsic); -+ error = device_create_file(&dev->dev, &dev_attr_hnp); -+ error = device_create_file(&dev->dev, &dev_attr_srp); -+ error = device_create_file(&dev->dev, &dev_attr_buspower); -+ error = device_create_file(&dev->dev, &dev_attr_bussuspend); -+ error = device_create_file(&dev->dev, &dev_attr_mode_ch_tim_en); -+ error = device_create_file(&dev->dev, &dev_attr_fr_interval); -+ error = device_create_file(&dev->dev, &dev_attr_busconnected); -+ error = device_create_file(&dev->dev, &dev_attr_gotgctl); -+ error = device_create_file(&dev->dev, &dev_attr_gusbcfg); -+ error = device_create_file(&dev->dev, &dev_attr_grxfsiz); -+ error = device_create_file(&dev->dev, &dev_attr_gnptxfsiz); -+ error = device_create_file(&dev->dev, &dev_attr_gpvndctl); -+ error = device_create_file(&dev->dev, &dev_attr_ggpio); -+ error = device_create_file(&dev->dev, &dev_attr_guid); -+ error = device_create_file(&dev->dev, &dev_attr_gsnpsid); -+ error = device_create_file(&dev->dev, &dev_attr_devspeed); -+ error = device_create_file(&dev->dev, &dev_attr_enumspeed); -+ error = device_create_file(&dev->dev, &dev_attr_hptxfsiz); -+ error = device_create_file(&dev->dev, &dev_attr_hprt0); -+ error = device_create_file(&dev->dev, &dev_attr_remote_wakeup); -+ error = device_create_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); -+ error = device_create_file(&dev->dev, &dev_attr_disconnect_us); -+ error = device_create_file(&dev->dev, &dev_attr_regdump); -+ error = device_create_file(&dev->dev, &dev_attr_spramdump); -+ error = device_create_file(&dev->dev, &dev_attr_hcddump); -+ error = device_create_file(&dev->dev, &dev_attr_hcd_frrem); -+ error = device_create_file(&dev->dev, &dev_attr_rd_reg_test); -+ error = device_create_file(&dev->dev, &dev_attr_wr_reg_test); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ error = device_create_file(&dev->dev, &dev_attr_lpm_response); -+ error = device_create_file(&dev->dev, &dev_attr_sleep_status); -+#endif -+} -+ -+/** -+ * Remove the device files -+ */ -+void dwc_otg_attr_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ) -+{ -+ device_remove_file(&dev->dev, &dev_attr_regoffset); -+ device_remove_file(&dev->dev, &dev_attr_regvalue); -+ device_remove_file(&dev->dev, &dev_attr_mode); -+ device_remove_file(&dev->dev, &dev_attr_hnpcapable); -+ device_remove_file(&dev->dev, &dev_attr_srpcapable); -+ device_remove_file(&dev->dev, &dev_attr_hsic_connect); -+ device_remove_file(&dev->dev, &dev_attr_inv_sel_hsic); -+ device_remove_file(&dev->dev, &dev_attr_hnp); -+ device_remove_file(&dev->dev, &dev_attr_srp); -+ device_remove_file(&dev->dev, &dev_attr_buspower); -+ device_remove_file(&dev->dev, &dev_attr_bussuspend); -+ device_remove_file(&dev->dev, &dev_attr_mode_ch_tim_en); -+ device_remove_file(&dev->dev, &dev_attr_fr_interval); -+ device_remove_file(&dev->dev, &dev_attr_busconnected); -+ device_remove_file(&dev->dev, &dev_attr_gotgctl); -+ device_remove_file(&dev->dev, &dev_attr_gusbcfg); -+ device_remove_file(&dev->dev, &dev_attr_grxfsiz); -+ device_remove_file(&dev->dev, &dev_attr_gnptxfsiz); -+ device_remove_file(&dev->dev, &dev_attr_gpvndctl); -+ device_remove_file(&dev->dev, &dev_attr_ggpio); -+ device_remove_file(&dev->dev, &dev_attr_guid); -+ device_remove_file(&dev->dev, &dev_attr_gsnpsid); -+ device_remove_file(&dev->dev, &dev_attr_devspeed); -+ device_remove_file(&dev->dev, &dev_attr_enumspeed); -+ device_remove_file(&dev->dev, &dev_attr_hptxfsiz); -+ device_remove_file(&dev->dev, &dev_attr_hprt0); -+ device_remove_file(&dev->dev, &dev_attr_remote_wakeup); -+ device_remove_file(&dev->dev, &dev_attr_rem_wakeup_pwrdn); -+ device_remove_file(&dev->dev, &dev_attr_disconnect_us); -+ device_remove_file(&dev->dev, &dev_attr_regdump); -+ device_remove_file(&dev->dev, &dev_attr_spramdump); -+ device_remove_file(&dev->dev, &dev_attr_hcddump); -+ device_remove_file(&dev->dev, &dev_attr_hcd_frrem); -+ device_remove_file(&dev->dev, &dev_attr_rd_reg_test); -+ device_remove_file(&dev->dev, &dev_attr_wr_reg_test); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ device_remove_file(&dev->dev, &dev_attr_lpm_response); -+ device_remove_file(&dev->dev, &dev_attr_sleep_status); -+#endif -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.h b/drivers/usb/host/dwc_otg/dwc_otg_attr.h -new file mode 100644 -index 0000000000000000000000000000000000000000..e10b67f97c522094b553b7675741ba1b3cae293d ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.h -@@ -0,0 +1,89 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ -+ * $Revision: #13 $ -+ * $Date: 2010/06/21 $ -+ * $Change: 1532021 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_OTG_ATTR_H__) -+#define __DWC_OTG_ATTR_H__ -+ -+/** @file -+ * This file contains the interface to the Linux device attributes. -+ */ -+extern struct device_attribute dev_attr_regoffset; -+extern struct device_attribute dev_attr_regvalue; -+ -+extern struct device_attribute dev_attr_mode; -+extern struct device_attribute dev_attr_hnpcapable; -+extern struct device_attribute dev_attr_srpcapable; -+extern struct device_attribute dev_attr_hnp; -+extern struct device_attribute dev_attr_srp; -+extern struct device_attribute dev_attr_buspower; -+extern struct device_attribute dev_attr_bussuspend; -+extern struct device_attribute dev_attr_mode_ch_tim_en; -+extern struct device_attribute dev_attr_fr_interval; -+extern struct device_attribute dev_attr_busconnected; -+extern struct device_attribute dev_attr_gotgctl; -+extern struct device_attribute dev_attr_gusbcfg; -+extern struct device_attribute dev_attr_grxfsiz; -+extern struct device_attribute dev_attr_gnptxfsiz; -+extern struct device_attribute dev_attr_gpvndctl; -+extern struct device_attribute dev_attr_ggpio; -+extern struct device_attribute dev_attr_guid; -+extern struct device_attribute dev_attr_gsnpsid; -+extern struct device_attribute dev_attr_devspeed; -+extern struct device_attribute dev_attr_enumspeed; -+extern struct device_attribute dev_attr_hptxfsiz; -+extern struct device_attribute dev_attr_hprt0; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+extern struct device_attribute dev_attr_lpm_response; -+extern struct device_attribute devi_attr_sleep_status; -+#endif -+ -+void dwc_otg_attr_create( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+ -+void dwc_otg_attr_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.c b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..bbb3d32093d029e93f903bd76f45a3f715e55afd ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c -@@ -0,0 +1,1876 @@ -+/* ========================================================================== -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * This file contains the most of the CFI(Core Feature Interface) -+ * implementation for the OTG. -+ */ -+ -+#ifdef DWC_UTE_CFI -+ -+#include "dwc_otg_pcd.h" -+#include "dwc_otg_cfi.h" -+ -+/** This definition should actually migrate to the Portability Library */ -+#define DWC_CONSTANT_CPU_TO_LE16(x) (x) -+ -+extern dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex); -+ -+static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen); -+static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, -+ struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *ctrl_req); -+static int cfi_set_feature_value(struct dwc_otg_pcd *pcd); -+static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req); -+static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep); -+ -+static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if); -+static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue); -+static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue); -+ -+static uint8_t resize_fifos(dwc_otg_core_if_t * core_if); -+ -+/** This is the header of the all features descriptor */ -+static cfi_all_features_header_t all_props_desc_header = { -+ .wVersion = DWC_CONSTANT_CPU_TO_LE16(0x100), -+ .wCoreID = DWC_CONSTANT_CPU_TO_LE16(CFI_CORE_ID_OTG), -+ .wNumFeatures = DWC_CONSTANT_CPU_TO_LE16(9), -+}; -+ -+/** This is an array of statically allocated feature descriptors */ -+static cfi_feature_desc_header_t prop_descs[] = { -+ -+ /* FT_ID_DMA_MODE */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_MODE), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(1), -+ }, -+ -+ /* FT_ID_DMA_BUFFER_SETUP */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFFER_SETUP), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_DMA_BUFF_ALIGN */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_BUFF_ALIGN), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ }, -+ -+ /* FT_ID_DMA_CONCAT_SETUP */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CONCAT_SETUP), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ //.wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_DMA_CIRCULAR */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DMA_CIRCULAR), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_THRESHOLD_SETUP */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_THRESHOLD_SETUP), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(6), -+ }, -+ -+ /* FT_ID_DFIFO_DEPTH */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_DFIFO_DEPTH), -+ .bmAttributes = CFI_FEATURE_ATTR_RO, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ }, -+ -+ /* FT_ID_TX_FIFO_DEPTH */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_TX_FIFO_DEPTH), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ }, -+ -+ /* FT_ID_RX_FIFO_DEPTH */ -+ { -+ .wFeatureID = DWC_CONSTANT_CPU_TO_LE16(FT_ID_RX_FIFO_DEPTH), -+ .bmAttributes = CFI_FEATURE_ATTR_RW, -+ .wDataLength = DWC_CONSTANT_CPU_TO_LE16(2), -+ } -+}; -+ -+/** The table of feature names */ -+cfi_string_t prop_name_table[] = { -+ {FT_ID_DMA_MODE, "dma_mode"}, -+ {FT_ID_DMA_BUFFER_SETUP, "buffer_setup"}, -+ {FT_ID_DMA_BUFF_ALIGN, "buffer_align"}, -+ {FT_ID_DMA_CONCAT_SETUP, "concat_setup"}, -+ {FT_ID_DMA_CIRCULAR, "buffer_circular"}, -+ {FT_ID_THRESHOLD_SETUP, "threshold_setup"}, -+ {FT_ID_DFIFO_DEPTH, "dfifo_depth"}, -+ {FT_ID_TX_FIFO_DEPTH, "txfifo_depth"}, -+ {FT_ID_RX_FIFO_DEPTH, "rxfifo_depth"}, -+ {} -+}; -+ -+/************************************************************************/ -+ -+/** -+ * Returns the name of the feature by its ID -+ * or NULL if no featute ID matches. -+ * -+ */ -+const uint8_t *get_prop_name(uint16_t prop_id, int *len) -+{ -+ cfi_string_t *pstr; -+ *len = 0; -+ -+ for (pstr = prop_name_table; pstr && pstr->s; pstr++) { -+ if (pstr->id == prop_id) { -+ *len = DWC_STRLEN(pstr->s); -+ return pstr->s; -+ } -+ } -+ return NULL; -+} -+ -+/** -+ * This function handles all CFI specific control requests. -+ * -+ * Return a negative value to stall the DCE. -+ */ -+int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl) -+{ -+ int retval = 0; -+ dwc_otg_pcd_ep_t *ep = NULL; -+ cfiobject_t *cfi = pcd->cfi; -+ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); -+ uint16_t wLen = DWC_LE16_TO_CPU(&ctrl->wLength); -+ uint16_t wValue = DWC_LE16_TO_CPU(&ctrl->wValue); -+ uint16_t wIndex = DWC_LE16_TO_CPU(&ctrl->wIndex); -+ uint32_t regaddr = 0; -+ uint32_t regval = 0; -+ -+ /* Save this Control Request in the CFI object. -+ * The data field will be assigned in the data stage completion CB function. -+ */ -+ cfi->ctrl_req = *ctrl; -+ cfi->ctrl_req.data = NULL; -+ -+ cfi->need_gadget_att = 0; -+ cfi->need_status_in_complete = 0; -+ -+ switch (ctrl->bRequest) { -+ case VEN_CORE_GET_FEATURES: -+ retval = cfi_core_features_buf(cfi->buf_in.buf, CFI_IN_BUF_LEN); -+ if (retval >= 0) { -+ //dump_msg(cfi->buf_in.buf, retval); -+ ep = &pcd->ep0; -+ -+ retval = min((uint16_t) retval, wLen); -+ /* Transfer this buffer to the host through the EP0-IN EP */ -+ ep->dwc_ep.dma_addr = cfi->buf_in.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_len = retval; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ } -+ retval = 0; -+ break; -+ -+ case VEN_CORE_GET_FEATURE: -+ CFI_INFO("VEN_CORE_GET_FEATURE\n"); -+ retval = cfi_get_feature_value(cfi->buf_in.buf, CFI_IN_BUF_LEN, -+ pcd, ctrl); -+ if (retval >= 0) { -+ ep = &pcd->ep0; -+ -+ retval = min((uint16_t) retval, wLen); -+ /* Transfer this buffer to the host through the EP0-IN EP */ -+ ep->dwc_ep.dma_addr = cfi->buf_in.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_len = retval; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ } -+ CFI_INFO("VEN_CORE_GET_FEATURE=%d\n", retval); -+ dump_msg(cfi->buf_in.buf, retval); -+ break; -+ -+ case VEN_CORE_SET_FEATURE: -+ CFI_INFO("VEN_CORE_SET_FEATURE\n"); -+ /* Set up an XFER to get the data stage of the control request, -+ * which is the new value of the feature to be modified. -+ */ -+ ep = &pcd->ep0; -+ ep->dwc_ep.is_in = 0; -+ ep->dwc_ep.dma_addr = cfi->buf_out.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_len = wLen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ /* Read the control write's data stage */ -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ retval = 0; -+ break; -+ -+ case VEN_CORE_RESET_FEATURES: -+ CFI_INFO("VEN_CORE_RESET_FEATURES\n"); -+ cfi->need_gadget_att = 1; -+ cfi->need_status_in_complete = 1; -+ retval = cfi_preproc_reset(pcd, ctrl); -+ CFI_INFO("VEN_CORE_RESET_FEATURES = (%d)\n", retval); -+ break; -+ -+ case VEN_CORE_ACTIVATE_FEATURES: -+ CFI_INFO("VEN_CORE_ACTIVATE_FEATURES\n"); -+ break; -+ -+ case VEN_CORE_READ_REGISTER: -+ CFI_INFO("VEN_CORE_READ_REGISTER\n"); -+ /* wValue optionally contains the HI WORD of the register offset and -+ * wIndex contains the LOW WORD of the register offset -+ */ -+ if (wValue == 0) { -+ /* @TODO - MAS - fix the access to the base field */ -+ regaddr = 0; -+ //regaddr = (uint32_t) pcd->otg_dev->os_dep.base; -+ //GET_CORE_IF(pcd)->co -+ regaddr |= wIndex; -+ } else { -+ regaddr = (wValue << 16) | wIndex; -+ } -+ -+ /* Read a 32-bit value of the memory at the regaddr */ -+ regval = DWC_READ_REG32((uint32_t *) regaddr); -+ -+ ep = &pcd->ep0; -+ dwc_memcpy(cfi->buf_in.buf, ®val, sizeof(uint32_t)); -+ ep->dwc_ep.is_in = 1; -+ ep->dwc_ep.dma_addr = cfi->buf_in.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_in.buf; -+ ep->dwc_ep.xfer_len = wLen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ cfi->need_gadget_att = 0; -+ retval = 0; -+ break; -+ -+ case VEN_CORE_WRITE_REGISTER: -+ CFI_INFO("VEN_CORE_WRITE_REGISTER\n"); -+ /* Set up an XFER to get the data stage of the control request, -+ * which is the new value of the register to be modified. -+ */ -+ ep = &pcd->ep0; -+ ep->dwc_ep.is_in = 0; -+ ep->dwc_ep.dma_addr = cfi->buf_out.addr; -+ ep->dwc_ep.start_xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_buff = cfi->buf_out.buf; -+ ep->dwc_ep.xfer_len = wLen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ pcd->ep0_pending = 1; -+ /* Read the control write's data stage */ -+ dwc_otg_ep0_start_transfer(coreif, &ep->dwc_ep); -+ retval = 0; -+ break; -+ -+ default: -+ retval = -DWC_E_NOT_SUPPORTED; -+ break; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function prepares the core features descriptors and copies its -+ * raw representation into the buffer . -+ * -+ * The buffer structure is as follows: -+ * all_features_header (8 bytes) -+ * features_#1 (8 bytes + feature name string length) -+ * features_#2 (8 bytes + feature name string length) -+ * ..... -+ * features_#n - where n=the total count of feature descriptors -+ */ -+static int cfi_core_features_buf(uint8_t * buf, uint16_t buflen) -+{ -+ cfi_feature_desc_header_t *prop_hdr = prop_descs; -+ cfi_feature_desc_header_t *prop; -+ cfi_all_features_header_t *all_props_hdr = &all_props_desc_header; -+ cfi_all_features_header_t *tmp; -+ uint8_t *tmpbuf = buf; -+ const uint8_t *pname = NULL; -+ int i, j, namelen = 0, totlen; -+ -+ /* Prepare and copy the core features into the buffer */ -+ CFI_INFO("%s:\n", __func__); -+ -+ tmp = (cfi_all_features_header_t *) tmpbuf; -+ *tmp = *all_props_hdr; -+ tmpbuf += CFI_ALL_FEATURES_HDR_LEN; -+ -+ j = sizeof(prop_descs) / sizeof(cfi_all_features_header_t); -+ for (i = 0; i < j; i++, prop_hdr++) { -+ pname = get_prop_name(prop_hdr->wFeatureID, &namelen); -+ prop = (cfi_feature_desc_header_t *) tmpbuf; -+ *prop = *prop_hdr; -+ -+ prop->bNameLen = namelen; -+ prop->wLength = -+ DWC_CONSTANT_CPU_TO_LE16(CFI_FEATURE_DESC_HDR_LEN + -+ namelen); -+ -+ tmpbuf += CFI_FEATURE_DESC_HDR_LEN; -+ dwc_memcpy(tmpbuf, pname, namelen); -+ tmpbuf += namelen; -+ } -+ -+ totlen = tmpbuf - buf; -+ -+ if (totlen > 0) { -+ tmp = (cfi_all_features_header_t *) buf; -+ tmp->wTotalLen = DWC_CONSTANT_CPU_TO_LE16(totlen); -+ } -+ -+ return totlen; -+} -+ -+/** -+ * This function releases all the dynamic memory in the CFI object. -+ */ -+static void cfi_release(cfiobject_t * cfiobj) -+{ -+ cfi_ep_t *cfiep; -+ dwc_list_link_t *tmp; -+ -+ CFI_INFO("%s\n", __func__); -+ -+ if (cfiobj->buf_in.buf) { -+ DWC_DMA_FREE(CFI_IN_BUF_LEN, cfiobj->buf_in.buf, -+ cfiobj->buf_in.addr); -+ cfiobj->buf_in.buf = NULL; -+ } -+ -+ if (cfiobj->buf_out.buf) { -+ DWC_DMA_FREE(CFI_OUT_BUF_LEN, cfiobj->buf_out.buf, -+ cfiobj->buf_out.addr); -+ cfiobj->buf_out.buf = NULL; -+ } -+ -+ /* Free the Buffer Setup values for each EP */ -+ //list_for_each_entry(cfiep, &cfiobj->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfiobj->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ cfi_free_ep_bs_dyn_data(cfiep); -+ } -+} -+ -+/** -+ * This function frees the dynamically allocated EP buffer setup data. -+ */ -+static void cfi_free_ep_bs_dyn_data(cfi_ep_t * cfiep) -+{ -+ if (cfiep->bm_sg) { -+ DWC_FREE(cfiep->bm_sg); -+ cfiep->bm_sg = NULL; -+ } -+ -+ if (cfiep->bm_align) { -+ DWC_FREE(cfiep->bm_align); -+ cfiep->bm_align = NULL; -+ } -+ -+ if (cfiep->bm_concat) { -+ if (NULL != cfiep->bm_concat->wTxBytes) { -+ DWC_FREE(cfiep->bm_concat->wTxBytes); -+ cfiep->bm_concat->wTxBytes = NULL; -+ } -+ DWC_FREE(cfiep->bm_concat); -+ cfiep->bm_concat = NULL; -+ } -+} -+ -+/** -+ * This function initializes the default values of the features -+ * for a specific endpoint and should be called only once when -+ * the EP is enabled first time. -+ */ -+static int cfi_ep_init_defaults(struct dwc_otg_pcd *pcd, cfi_ep_t * cfiep) -+{ -+ int retval = 0; -+ -+ cfiep->bm_sg = DWC_ALLOC(sizeof(ddma_sg_buffer_setup_t)); -+ if (NULL == cfiep->bm_sg) { -+ CFI_INFO("Failed to allocate memory for SG feature value\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); -+ -+ /* For the Concatenation feature's default value we do not allocate -+ * memory for the wTxBytes field - it will be done in the set_feature_value -+ * request handler. -+ */ -+ cfiep->bm_concat = DWC_ALLOC(sizeof(ddma_concat_buffer_setup_t)); -+ if (NULL == cfiep->bm_concat) { -+ CFI_INFO -+ ("Failed to allocate memory for CONCATENATION feature value\n"); -+ DWC_FREE(cfiep->bm_sg); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); -+ -+ cfiep->bm_align = DWC_ALLOC(sizeof(ddma_align_buffer_setup_t)); -+ if (NULL == cfiep->bm_align) { -+ CFI_INFO -+ ("Failed to allocate memory for Alignment feature value\n"); -+ DWC_FREE(cfiep->bm_sg); -+ DWC_FREE(cfiep->bm_concat); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep->bm_align, 0, sizeof(ddma_align_buffer_setup_t)); -+ -+ return retval; -+} -+ -+/** -+ * The callback function that notifies the CFI on the activation of -+ * an endpoint in the PCD. The following steps are done in this function: -+ * -+ * Create a dynamically allocated cfi_ep_t object (a CFI wrapper to the PCD's -+ * active endpoint) -+ * Create MAX_DMA_DESCS_PER_EP count DMA Descriptors for the EP -+ * Set the Buffer Mode to standard -+ * Initialize the default values for all EP modes (SG, Circular, Concat, Align) -+ * Add the cfi_ep_t object to the list of active endpoints in the CFI object -+ */ -+static int cfi_ep_enable(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, -+ struct dwc_otg_pcd_ep *ep) -+{ -+ cfi_ep_t *cfiep; -+ int retval = -DWC_E_NOT_SUPPORTED; -+ -+ CFI_INFO("%s: epname=%s; epnum=0x%02x\n", __func__, -+ "EP_" /*ep->ep.name */ , ep->desc->bEndpointAddress); -+ /* MAS - Check whether this endpoint already is in the list */ -+ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); -+ -+ if (NULL == cfiep) { -+ /* Allocate a cfi_ep_t object */ -+ cfiep = DWC_ALLOC(sizeof(cfi_ep_t)); -+ if (NULL == cfiep) { -+ CFI_INFO -+ ("Unable to allocate memory for in function %s\n", -+ __func__); -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_memset(cfiep, 0, sizeof(cfi_ep_t)); -+ -+ /* Save the dwc_otg_pcd_ep pointer in the cfiep object */ -+ cfiep->ep = ep; -+ -+ /* Allocate the DMA Descriptors chain of MAX_DMA_DESCS_PER_EP count */ -+ ep->dwc_ep.descs = -+ DWC_DMA_ALLOC(MAX_DMA_DESCS_PER_EP * -+ sizeof(dwc_otg_dma_desc_t), -+ &ep->dwc_ep.descs_dma_addr); -+ -+ if (NULL == ep->dwc_ep.descs) { -+ DWC_FREE(cfiep); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ DWC_LIST_INIT(&cfiep->lh); -+ -+ /* Set the buffer mode to BM_STANDARD. It will be modified -+ * when building descriptors for a specific buffer mode */ -+ ep->dwc_ep.buff_mode = BM_STANDARD; -+ -+ /* Create and initialize the default values for this EP's Buffer modes */ -+ if ((retval = cfi_ep_init_defaults(pcd, cfiep)) < 0) -+ return retval; -+ -+ /* Add the cfi_ep_t object to the CFI object's list of active endpoints */ -+ DWC_LIST_INSERT_TAIL(&cfi->active_eps, &cfiep->lh); -+ retval = 0; -+ } else { /* The sought EP already is in the list */ -+ CFI_INFO("%s: The sought EP already is in the list\n", -+ __func__); -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function is called when the data stage of a 3-stage Control Write request -+ * is complete. -+ * -+ */ -+static int cfi_ctrl_write_complete(struct cfiobject *cfi, -+ struct dwc_otg_pcd *pcd) -+{ -+ uint32_t addr, reg_value; -+ uint16_t wIndex, wValue; -+ uint8_t bRequest; -+ uint8_t *buf = cfi->buf_out.buf; -+ //struct usb_ctrlrequest *ctrl_req = &cfi->ctrl_req_saved; -+ struct cfi_usb_ctrlrequest *ctrl_req = &cfi->ctrl_req; -+ int retval = -DWC_E_NOT_SUPPORTED; -+ -+ CFI_INFO("%s\n", __func__); -+ -+ bRequest = ctrl_req->bRequest; -+ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); -+ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); -+ -+ /* -+ * Save the pointer to the data stage in the ctrl_req's field. -+ * The request should be already saved in the command stage by now. -+ */ -+ ctrl_req->data = cfi->buf_out.buf; -+ cfi->need_status_in_complete = 0; -+ cfi->need_gadget_att = 0; -+ -+ switch (bRequest) { -+ case VEN_CORE_WRITE_REGISTER: -+ /* The buffer contains raw data of the new value for the register */ -+ reg_value = *((uint32_t *) buf); -+ if (wValue == 0) { -+ addr = 0; -+ //addr = (uint32_t) pcd->otg_dev->os_dep.base; -+ addr += wIndex; -+ } else { -+ addr = (wValue << 16) | wIndex; -+ } -+ -+ //writel(reg_value, addr); -+ -+ retval = 0; -+ cfi->need_status_in_complete = 1; -+ break; -+ -+ case VEN_CORE_SET_FEATURE: -+ /* The buffer contains raw data of the new value of the feature */ -+ retval = cfi_set_feature_value(pcd); -+ if (retval < 0) -+ return retval; -+ -+ cfi->need_status_in_complete = 1; -+ break; -+ -+ default: -+ break; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function builds the DMA descriptors for the SG buffer mode. -+ */ -+static void cfi_build_sg_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ struct dwc_otg_pcd_ep *ep = cfiep->ep; -+ ddma_sg_buffer_setup_t *sgval = cfiep->bm_sg; -+ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; -+ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; -+ dma_addr_t buff_addr = req->dma; -+ int i; -+ uint32_t txsize, off; -+ -+ txsize = sgval->wSize; -+ off = sgval->bOffset; -+ -+// CFI_INFO("%s: %s TXSIZE=0x%08x; OFFSET=0x%08x\n", -+// __func__, cfiep->ep->ep.name, txsize, off); -+ -+ for (i = 0; i < sgval->bCount; i++) { -+ desc->status.b.bs = BS_HOST_BUSY; -+ desc->buf = buff_addr; -+ desc->status.b.l = 0; -+ desc->status.b.ioc = 0; -+ desc->status.b.sp = 0; -+ desc->status.b.bytes = txsize; -+ desc->status.b.bs = BS_HOST_READY; -+ -+ /* Set the next address of the buffer */ -+ buff_addr += txsize + off; -+ desc_last = desc; -+ desc++; -+ } -+ -+ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ -+ desc_last->status.b.l = 1; -+ desc_last->status.b.ioc = 1; -+ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; -+ /* Save the last DMA descriptor pointer */ -+ cfiep->dma_desc_last = desc_last; -+ cfiep->desc_count = sgval->bCount; -+} -+ -+/** -+ * This function builds the DMA descriptors for the Concatenation buffer mode. -+ */ -+static void cfi_build_concat_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ struct dwc_otg_pcd_ep *ep = cfiep->ep; -+ ddma_concat_buffer_setup_t *concatval = cfiep->bm_concat; -+ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; -+ struct dwc_otg_dma_desc *desc_last = cfiep->ep->dwc_ep.descs; -+ dma_addr_t buff_addr = req->dma; -+ int i; -+ uint16_t *txsize; -+ -+ txsize = concatval->wTxBytes; -+ -+ for (i = 0; i < concatval->hdr.bDescCount; i++) { -+ desc->buf = buff_addr; -+ desc->status.b.bs = BS_HOST_BUSY; -+ desc->status.b.l = 0; -+ desc->status.b.ioc = 0; -+ desc->status.b.sp = 0; -+ desc->status.b.bytes = *txsize; -+ desc->status.b.bs = BS_HOST_READY; -+ -+ txsize++; -+ /* Set the next address of the buffer */ -+ buff_addr += UGETW(ep->desc->wMaxPacketSize); -+ desc_last = desc; -+ desc++; -+ } -+ -+ /* Set the last, ioc and sp bits on the Last DMA Descriptor */ -+ desc_last->status.b.l = 1; -+ desc_last->status.b.ioc = 1; -+ desc_last->status.b.sp = ep->dwc_ep.sent_zlp; -+ cfiep->dma_desc_last = desc_last; -+ cfiep->desc_count = concatval->hdr.bDescCount; -+} -+ -+/** -+ * This function builds the DMA descriptors for the Circular buffer mode -+ */ -+static void cfi_build_circ_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ /* @todo: MAS - add implementation when this feature needs to be tested */ -+} -+ -+/** -+ * This function builds the DMA descriptors for the Alignment buffer mode -+ */ -+static void cfi_build_align_descs(struct cfiobject *cfi, cfi_ep_t * cfiep, -+ dwc_otg_pcd_request_t * req) -+{ -+ struct dwc_otg_pcd_ep *ep = cfiep->ep; -+ ddma_align_buffer_setup_t *alignval = cfiep->bm_align; -+ struct dwc_otg_dma_desc *desc = cfiep->ep->dwc_ep.descs; -+ dma_addr_t buff_addr = req->dma; -+ -+ desc->status.b.bs = BS_HOST_BUSY; -+ desc->status.b.l = 1; -+ desc->status.b.ioc = 1; -+ desc->status.b.sp = ep->dwc_ep.sent_zlp; -+ desc->status.b.bytes = req->length; -+ /* Adjust the buffer alignment */ -+ desc->buf = (buff_addr + alignval->bAlign); -+ desc->status.b.bs = BS_HOST_READY; -+ cfiep->dma_desc_last = desc; -+ cfiep->desc_count = 1; -+} -+ -+/** -+ * This function builds the DMA descriptors chain for different modes of the -+ * buffer setup of an endpoint. -+ */ -+static void cfi_build_descriptors(struct cfiobject *cfi, -+ struct dwc_otg_pcd *pcd, -+ struct dwc_otg_pcd_ep *ep, -+ dwc_otg_pcd_request_t * req) -+{ -+ cfi_ep_t *cfiep; -+ -+ /* Get the cfiep by the dwc_otg_pcd_ep */ -+ cfiep = get_cfi_ep_by_pcd_ep(cfi, ep); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Unable to find a matching active endpoint\n", -+ __func__); -+ return; -+ } -+ -+ cfiep->xfer_len = req->length; -+ -+ /* Iterate through all the DMA descriptors */ -+ switch (cfiep->ep->dwc_ep.buff_mode) { -+ case BM_SG: -+ cfi_build_sg_descs(cfi, cfiep, req); -+ break; -+ -+ case BM_CONCAT: -+ cfi_build_concat_descs(cfi, cfiep, req); -+ break; -+ -+ case BM_CIRCULAR: -+ cfi_build_circ_descs(cfi, cfiep, req); -+ break; -+ -+ case BM_ALIGN: -+ cfi_build_align_descs(cfi, cfiep, req); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+/** -+ * Allocate DMA buffer for different Buffer modes. -+ */ -+static void *cfi_ep_alloc_buf(struct cfiobject *cfi, struct dwc_otg_pcd *pcd, -+ struct dwc_otg_pcd_ep *ep, dma_addr_t * dma, -+ unsigned size, gfp_t flags) -+{ -+ return DWC_DMA_ALLOC(size, dma); -+} -+ -+/** -+ * This function initializes the CFI object. -+ */ -+int init_cfi(cfiobject_t * cfiobj) -+{ -+ CFI_INFO("%s\n", __func__); -+ -+ /* Allocate a buffer for IN XFERs */ -+ cfiobj->buf_in.buf = -+ DWC_DMA_ALLOC(CFI_IN_BUF_LEN, &cfiobj->buf_in.addr); -+ if (NULL == cfiobj->buf_in.buf) { -+ CFI_INFO("Unable to allocate buffer for INs\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Allocate a buffer for OUT XFERs */ -+ cfiobj->buf_out.buf = -+ DWC_DMA_ALLOC(CFI_OUT_BUF_LEN, &cfiobj->buf_out.addr); -+ if (NULL == cfiobj->buf_out.buf) { -+ CFI_INFO("Unable to allocate buffer for OUT\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Initialize the callback function pointers */ -+ cfiobj->ops.release = cfi_release; -+ cfiobj->ops.ep_enable = cfi_ep_enable; -+ cfiobj->ops.ctrl_write_complete = cfi_ctrl_write_complete; -+ cfiobj->ops.build_descriptors = cfi_build_descriptors; -+ cfiobj->ops.ep_alloc_buf = cfi_ep_alloc_buf; -+ -+ /* Initialize the list of active endpoints in the CFI object */ -+ DWC_LIST_INIT(&cfiobj->active_eps); -+ -+ return 0; -+} -+ -+/** -+ * This function reads the required feature's current value into the buffer -+ * -+ * @retval: Returns negative as error, or the data length of the feature -+ */ -+static int cfi_get_feature_value(uint8_t * buf, uint16_t buflen, -+ struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *ctrl_req) -+{ -+ int retval = -DWC_E_NOT_SUPPORTED; -+ struct dwc_otg_core_if *coreif = GET_CORE_IF(pcd); -+ uint16_t dfifo, rxfifo, txfifo; -+ -+ switch (ctrl_req->wIndex) { -+ /* Whether the DDMA is enabled or not */ -+ case FT_ID_DMA_MODE: -+ *buf = (coreif->dma_enable && coreif->dma_desc_enable) ? 1 : 0; -+ retval = 1; -+ break; -+ -+ case FT_ID_DMA_BUFFER_SETUP: -+ retval = cfi_ep_get_sg_val(buf, pcd, ctrl_req); -+ break; -+ -+ case FT_ID_DMA_BUFF_ALIGN: -+ retval = cfi_ep_get_align_val(buf, pcd, ctrl_req); -+ break; -+ -+ case FT_ID_DMA_CONCAT_SETUP: -+ retval = cfi_ep_get_concat_val(buf, pcd, ctrl_req); -+ break; -+ -+ case FT_ID_DMA_CIRCULAR: -+ CFI_INFO("GetFeature value (FT_ID_DMA_CIRCULAR)\n"); -+ break; -+ -+ case FT_ID_THRESHOLD_SETUP: -+ CFI_INFO("GetFeature value (FT_ID_THRESHOLD_SETUP)\n"); -+ break; -+ -+ case FT_ID_DFIFO_DEPTH: -+ dfifo = get_dfifo_size(coreif); -+ *((uint16_t *) buf) = dfifo; -+ retval = sizeof(uint16_t); -+ break; -+ -+ case FT_ID_TX_FIFO_DEPTH: -+ retval = get_txfifo_size(pcd, ctrl_req->wValue); -+ if (retval >= 0) { -+ txfifo = retval; -+ *((uint16_t *) buf) = txfifo; -+ retval = sizeof(uint16_t); -+ } -+ break; -+ -+ case FT_ID_RX_FIFO_DEPTH: -+ retval = get_rxfifo_size(coreif, ctrl_req->wValue); -+ if (retval >= 0) { -+ rxfifo = retval; -+ *((uint16_t *) buf) = rxfifo; -+ retval = sizeof(uint16_t); -+ } -+ break; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function resets the SG for the specified EP to its default value -+ */ -+static int cfi_reset_sg_val(cfi_ep_t * cfiep) -+{ -+ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); -+ return 0; -+} -+ -+/** -+ * This function resets the Alignment for the specified EP to its default value -+ */ -+static int cfi_reset_align_val(cfi_ep_t * cfiep) -+{ -+ dwc_memset(cfiep->bm_sg, 0, sizeof(ddma_sg_buffer_setup_t)); -+ return 0; -+} -+ -+/** -+ * This function resets the Concatenation for the specified EP to its default value -+ * This function will also set the value of the wTxBytes field to NULL after -+ * freeing the memory previously allocated for this field. -+ */ -+static int cfi_reset_concat_val(cfi_ep_t * cfiep) -+{ -+ /* First we need to free the wTxBytes field */ -+ if (cfiep->bm_concat->wTxBytes) { -+ DWC_FREE(cfiep->bm_concat->wTxBytes); -+ cfiep->bm_concat->wTxBytes = NULL; -+ } -+ -+ dwc_memset(cfiep->bm_concat, 0, sizeof(ddma_concat_buffer_setup_t)); -+ return 0; -+} -+ -+/** -+ * This function resets all the buffer setups of the specified endpoint -+ */ -+static int cfi_ep_reset_all_setup_vals(cfi_ep_t * cfiep) -+{ -+ cfi_reset_sg_val(cfiep); -+ cfi_reset_align_val(cfiep); -+ cfi_reset_concat_val(cfiep); -+ return 0; -+} -+ -+static int cfi_handle_reset_fifo_val(struct dwc_otg_pcd *pcd, uint8_t ep_addr, -+ uint8_t rx_rst, uint8_t tx_rst) -+{ -+ int retval = -DWC_E_INVALID; -+ uint16_t tx_siz[15]; -+ uint16_t rx_siz = 0; -+ dwc_otg_pcd_ep_t *ep = NULL; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; -+ -+ if (rx_rst) { -+ rx_siz = params->dev_rx_fifo_size; -+ params->dev_rx_fifo_size = GET_CORE_IF(pcd)->init_rxfsiz; -+ } -+ -+ if (tx_rst) { -+ if (ep_addr == 0) { -+ int i; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ tx_siz[i] = -+ core_if->core_params->dev_tx_fifo_size[i]; -+ core_if->core_params->dev_tx_fifo_size[i] = -+ core_if->init_txfsiz[i]; -+ } -+ } else { -+ -+ ep = get_ep_by_addr(pcd, ep_addr); -+ -+ if (NULL == ep) { -+ CFI_INFO -+ ("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, ep_addr); -+ return -DWC_E_INVALID; -+ } -+ -+ tx_siz[0] = -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - -+ 1]; -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = -+ GET_CORE_IF(pcd)->init_txfsiz[ep-> -+ dwc_ep.tx_fifo_num - -+ 1]; -+ } -+ } -+ -+ if (resize_fifos(GET_CORE_IF(pcd))) { -+ retval = 0; -+ } else { -+ CFI_INFO -+ ("%s: Error resetting the feature Reset All(FIFO size)\n", -+ __func__); -+ if (rx_rst) { -+ params->dev_rx_fifo_size = rx_siz; -+ } -+ -+ if (tx_rst) { -+ if (ep_addr == 0) { -+ int i; -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; -+ i++) { -+ core_if-> -+ core_params->dev_tx_fifo_size[i] = -+ tx_siz[i]; -+ } -+ } else { -+ params->dev_tx_fifo_size[ep-> -+ dwc_ep.tx_fifo_num - -+ 1] = tx_siz[0]; -+ } -+ } -+ retval = -DWC_E_INVALID; -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_all(struct dwc_otg_pcd *pcd, uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ retval = cfi_handle_reset_fifo_val(pcd, addr, 1, 1); -+ if (retval < 0) { -+ return retval; -+ } -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_ep_reset_all_setup_vals(cfiep); -+ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_ep_reset_all_setup_vals(cfiep); -+ cfiep->ep->dwc_ep.buff_mode = BM_STANDARD; -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Reset All\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_dma_buff_setup(struct dwc_otg_pcd *pcd, -+ uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_reset_sg_val(cfiep); -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_reset_sg_val(cfiep); -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Buffer Setup\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_concat_val(struct dwc_otg_pcd *pcd, uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_reset_concat_val(cfiep); -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_reset_concat_val(cfiep); -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Concatenation Value\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+} -+ -+static int cfi_handle_reset_align_val(struct dwc_otg_pcd *pcd, uint8_t addr) -+{ -+ int retval = 0; -+ cfi_ep_t *cfiep; -+ cfiobject_t *cfi = pcd->cfi; -+ dwc_list_link_t *tmp; -+ -+ /* If the EP address is known then reset the features for only that EP */ -+ if (addr) { -+ cfiep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == cfiep) { -+ CFI_INFO("%s: Error getting the EP address 0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ retval = cfi_reset_align_val(cfiep); -+ } -+ /* Otherwise (wValue == 0), reset all features of all EP's */ -+ else { -+ /* Traverse all the active EP's and reset the feature(s) value(s) */ -+ //list_for_each_entry(cfiep, &cfi->active_eps, lh) { -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ cfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ retval = cfi_reset_align_val(cfiep); -+ if (retval < 0) { -+ CFI_INFO -+ ("%s: Error resetting the feature Aliignment Value\n", -+ __func__); -+ return retval; -+ } -+ } -+ } -+ return retval; -+ -+} -+ -+static int cfi_preproc_reset(struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = 0; -+ -+ switch (req->wIndex) { -+ case 0: -+ /* Reset all features */ -+ retval = cfi_handle_reset_all(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_DMA_BUFFER_SETUP: -+ /* Reset the SG buffer setup */ -+ retval = -+ cfi_handle_reset_dma_buff_setup(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_DMA_CONCAT_SETUP: -+ /* Reset the Concatenation buffer setup */ -+ retval = cfi_handle_reset_concat_val(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_DMA_BUFF_ALIGN: -+ /* Reset the Alignment buffer setup */ -+ retval = cfi_handle_reset_align_val(pcd, req->wValue & 0xff); -+ break; -+ -+ case FT_ID_TX_FIFO_DEPTH: -+ retval = -+ cfi_handle_reset_fifo_val(pcd, req->wValue & 0xff, 0, 1); -+ pcd->cfi->need_gadget_att = 0; -+ break; -+ -+ case FT_ID_RX_FIFO_DEPTH: -+ retval = cfi_handle_reset_fifo_val(pcd, 0, 1, 0); -+ pcd->cfi->need_gadget_att = 0; -+ break; -+ default: -+ break; -+ } -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the SG buffer setup. -+ */ -+static int cfi_ep_set_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd) -+{ -+ uint8_t inaddr, outaddr; -+ cfi_ep_t *epin, *epout; -+ ddma_sg_buffer_setup_t *psgval; -+ uint32_t desccount, size; -+ -+ CFI_INFO("%s\n", __func__); -+ -+ psgval = (ddma_sg_buffer_setup_t *) buf; -+ desccount = (uint32_t) psgval->bCount; -+ size = (uint32_t) psgval->wSize; -+ -+ /* Check the DMA descriptor count */ -+ if ((desccount > MAX_DMA_DESCS_PER_EP) || (desccount == 0)) { -+ CFI_INFO -+ ("%s: The count of DMA Descriptors should be between 1 and %d\n", -+ __func__, MAX_DMA_DESCS_PER_EP); -+ return -DWC_E_INVALID; -+ } -+ -+ /* Check the DMA descriptor count */ -+ -+ if (size == 0) { -+ -+ CFI_INFO("%s: The transfer size should be at least 1 byte\n", -+ __func__); -+ -+ return -DWC_E_INVALID; -+ -+ } -+ -+ inaddr = psgval->bInEndpointAddress; -+ outaddr = psgval->bOutEndpointAddress; -+ -+ epin = get_cfi_ep_by_addr(pcd->cfi, inaddr); -+ epout = get_cfi_ep_by_addr(pcd->cfi, outaddr); -+ -+ if (NULL == epin || NULL == epout) { -+ CFI_INFO -+ ("%s: Unable to get the endpoints inaddr=0x%02x outaddr=0x%02x\n", -+ __func__, inaddr, outaddr); -+ return -DWC_E_INVALID; -+ } -+ -+ epin->ep->dwc_ep.buff_mode = BM_SG; -+ dwc_memcpy(epin->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); -+ -+ epout->ep->dwc_ep.buff_mode = BM_SG; -+ dwc_memcpy(epout->bm_sg, psgval, sizeof(ddma_sg_buffer_setup_t)); -+ -+ return 0; -+} -+ -+/** -+ * This function sets a new value for the buffer Alignment setup. -+ */ -+static int cfi_ep_set_alignment_val(uint8_t * buf, struct dwc_otg_pcd *pcd) -+{ -+ cfi_ep_t *ep; -+ uint8_t addr; -+ ddma_align_buffer_setup_t *palignval; -+ -+ palignval = (ddma_align_buffer_setup_t *) buf; -+ addr = palignval->bEndpointAddress; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ -+ ep->ep->dwc_ep.buff_mode = BM_ALIGN; -+ dwc_memcpy(ep->bm_align, palignval, sizeof(ddma_align_buffer_setup_t)); -+ -+ return 0; -+} -+ -+/** -+ * This function sets a new value for the Concatenation buffer setup. -+ */ -+static int cfi_ep_set_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd) -+{ -+ uint8_t addr; -+ cfi_ep_t *ep; -+ struct _ddma_concat_buffer_setup_hdr *pConcatValHdr; -+ uint16_t *pVals; -+ uint32_t desccount; -+ int i; -+ uint16_t mps; -+ -+ pConcatValHdr = (struct _ddma_concat_buffer_setup_hdr *)buf; -+ desccount = (uint32_t) pConcatValHdr->bDescCount; -+ pVals = (uint16_t *) (buf + BS_CONCAT_VAL_HDR_LEN); -+ -+ /* Check the DMA descriptor count */ -+ if (desccount > MAX_DMA_DESCS_PER_EP) { -+ CFI_INFO("%s: Maximum DMA Descriptor count should be %d\n", -+ __func__, MAX_DMA_DESCS_PER_EP); -+ return -DWC_E_INVALID; -+ } -+ -+ addr = pConcatValHdr->bEndpointAddress; -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, addr); -+ return -DWC_E_INVALID; -+ } -+ -+ mps = UGETW(ep->ep->desc->wMaxPacketSize); -+ -+#if 0 -+ for (i = 0; i < desccount; i++) { -+ CFI_INFO("%s: wTxSize[%d]=0x%04x\n", __func__, i, pVals[i]); -+ } -+ CFI_INFO("%s: epname=%s; mps=%d\n", __func__, ep->ep->ep.name, mps); -+#endif -+ -+ /* Check the wTxSizes to be less than or equal to the mps */ -+ for (i = 0; i < desccount; i++) { -+ if (pVals[i] > mps) { -+ CFI_INFO -+ ("%s: ERROR - the wTxSize[%d] should be <= MPS (wTxSize=%d)\n", -+ __func__, i, pVals[i]); -+ return -DWC_E_INVALID; -+ } -+ } -+ -+ ep->ep->dwc_ep.buff_mode = BM_CONCAT; -+ dwc_memcpy(ep->bm_concat, pConcatValHdr, BS_CONCAT_VAL_HDR_LEN); -+ -+ /* Free the previously allocated storage for the wTxBytes */ -+ if (ep->bm_concat->wTxBytes) { -+ DWC_FREE(ep->bm_concat->wTxBytes); -+ } -+ -+ /* Allocate a new storage for the wTxBytes field */ -+ ep->bm_concat->wTxBytes = -+ DWC_ALLOC(sizeof(uint16_t) * pConcatValHdr->bDescCount); -+ if (NULL == ep->bm_concat->wTxBytes) { -+ CFI_INFO("%s: Unable to allocate memory\n", __func__); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Copy the new values into the wTxBytes filed */ -+ dwc_memcpy(ep->bm_concat->wTxBytes, buf + BS_CONCAT_VAL_HDR_LEN, -+ sizeof(uint16_t) * pConcatValHdr->bDescCount); -+ -+ return 0; -+} -+ -+/** -+ * This function calculates the total of all FIFO sizes -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return The total of data FIFO sizes. -+ * -+ */ -+static uint16_t get_dfifo_size(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_params_t *params = core_if->core_params; -+ uint16_t dfifo_total = 0; -+ int i; -+ -+ /* The shared RxFIFO size */ -+ dfifo_total = -+ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; -+ -+ /* Add up each TxFIFO size to the total */ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ dfifo_total += params->dev_tx_fifo_size[i]; -+ } -+ -+ return dfifo_total; -+} -+ -+/** -+ * This function returns Rx FIFO size -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return The total of data FIFO sizes. -+ * -+ */ -+static int32_t get_rxfifo_size(dwc_otg_core_if_t * core_if, uint16_t wValue) -+{ -+ switch (wValue >> 8) { -+ case 0: -+ return (core_if->pwron_rxfsiz < -+ 32768) ? core_if->pwron_rxfsiz : 32768; -+ break; -+ case 1: -+ return core_if->core_params->dev_rx_fifo_size; -+ break; -+ default: -+ return -DWC_E_INVALID; -+ break; -+ } -+} -+ -+/** -+ * This function returns Tx FIFO size for IN EP -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return The total of data FIFO sizes. -+ * -+ */ -+static int32_t get_txfifo_size(struct dwc_otg_pcd *pcd, uint16_t wValue) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ -+ ep = get_ep_by_addr(pcd, wValue & 0xff); -+ -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, wValue & 0xff); -+ return -DWC_E_INVALID; -+ } -+ -+ if (!ep->dwc_ep.is_in) { -+ CFI_INFO -+ ("%s: No Tx FIFO assingned to the Out endpoint addr=0x%02x\n", -+ __func__, wValue & 0xff); -+ return -DWC_E_INVALID; -+ } -+ -+ switch (wValue >> 8) { -+ case 0: -+ return (GET_CORE_IF(pcd)->pwron_txfsiz -+ [ep->dwc_ep.tx_fifo_num - 1] < -+ 768) ? GET_CORE_IF(pcd)->pwron_txfsiz[ep-> -+ dwc_ep.tx_fifo_num -+ - 1] : 32768; -+ break; -+ case 1: -+ return GET_CORE_IF(pcd)->core_params-> -+ dev_tx_fifo_size[ep->dwc_ep.num - 1]; -+ break; -+ default: -+ return -DWC_E_INVALID; -+ break; -+ } -+} -+ -+/** -+ * This function checks if the submitted combination of -+ * device mode FIFO sizes is possible or not. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return 1 if possible, 0 otherwise. -+ * -+ */ -+static uint8_t check_fifo_sizes(dwc_otg_core_if_t * core_if) -+{ -+ uint16_t dfifo_actual = 0; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ uint16_t start_addr = 0; -+ int i; -+ -+ dfifo_actual = -+ params->dev_rx_fifo_size + params->dev_nperio_tx_fifo_size; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ dfifo_actual += params->dev_tx_fifo_size[i]; -+ } -+ -+ if (dfifo_actual > core_if->total_fifo_size) { -+ return 0; -+ } -+ -+ if (params->dev_rx_fifo_size > 32768 || params->dev_rx_fifo_size < 16) -+ return 0; -+ -+ if (params->dev_nperio_tx_fifo_size > 32768 -+ || params->dev_nperio_tx_fifo_size < 16) -+ return 0; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ -+ if (params->dev_tx_fifo_size[i] > 768 -+ || params->dev_tx_fifo_size[i] < 4) -+ return 0; -+ } -+ -+ if (params->dev_rx_fifo_size > core_if->pwron_rxfsiz) -+ return 0; -+ start_addr = params->dev_rx_fifo_size; -+ -+ if (params->dev_nperio_tx_fifo_size > core_if->pwron_gnptxfsiz) -+ return 0; -+ start_addr += params->dev_nperio_tx_fifo_size; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ -+ if (params->dev_tx_fifo_size[i] > core_if->pwron_txfsiz[i]) -+ return 0; -+ start_addr += params->dev_tx_fifo_size[i]; -+ } -+ -+ return 1; -+} -+ -+/** -+ * This function resizes Device mode FIFOs -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ * @return 1 if successful, 0 otherwise -+ * -+ */ -+static uint8_t resize_fifos(dwc_otg_core_if_t * core_if) -+{ -+ int i = 0; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ uint32_t rx_fifo_size; -+ fifosize_data_t nptxfifosize; -+ fifosize_data_t txfifosize[15]; -+ -+ uint32_t rx_fsz_bak; -+ uint32_t nptxfsz_bak; -+ uint32_t txfsz_bak[15]; -+ -+ uint16_t start_address; -+ uint8_t retval = 1; -+ -+ if (!check_fifo_sizes(core_if)) { -+ return 0; -+ } -+ -+ /* Configure data FIFO sizes */ -+ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { -+ rx_fsz_bak = DWC_READ_REG32(&global_regs->grxfsiz); -+ rx_fifo_size = params->dev_rx_fifo_size; -+ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); -+ -+ /* -+ * Tx FIFOs These FIFOs are numbered from 1 to 15. -+ * Indexes of the FIFO size module parameters in the -+ * dev_tx_fifo_size array and the FIFO size registers in -+ * the dtxfsiz array run from 0 to 14. -+ */ -+ -+ /* Non-periodic Tx FIFO */ -+ nptxfsz_bak = DWC_READ_REG32(&global_regs->gnptxfsiz); -+ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; -+ start_address = params->dev_rx_fifo_size; -+ nptxfifosize.b.startaddr = start_address; -+ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); -+ -+ start_address += nptxfifosize.b.depth; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ txfsz_bak[i] = DWC_READ_REG32(&global_regs->dtxfsiz[i]); -+ -+ txfifosize[i].b.depth = params->dev_tx_fifo_size[i]; -+ txfifosize[i].b.startaddr = start_address; -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ txfifosize[i].d32); -+ -+ start_address += txfifosize[i].b.depth; -+ } -+ -+ /** Check if register values are set correctly */ -+ if (rx_fifo_size != DWC_READ_REG32(&global_regs->grxfsiz)) { -+ retval = 0; -+ } -+ -+ if (nptxfifosize.d32 != DWC_READ_REG32(&global_regs->gnptxfsiz)) { -+ retval = 0; -+ } -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ if (txfifosize[i].d32 != -+ DWC_READ_REG32(&global_regs->dtxfsiz[i])) { -+ retval = 0; -+ } -+ } -+ -+ /** If register values are not set correctly, reset old values */ -+ if (retval == 0) { -+ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fsz_bak); -+ -+ /* Non-periodic Tx FIFO */ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfsz_bak); -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ txfsz_bak[i]); -+ } -+ } -+ } else { -+ return 0; -+ } -+ -+ /* Flush the FIFOs */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ -+ dwc_otg_flush_rx_fifo(core_if); -+ -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the buffer Alignment setup. -+ */ -+static int cfi_ep_set_tx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) -+{ -+ int retval; -+ uint32_t fsiz; -+ uint16_t size; -+ uint16_t ep_addr; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; -+ tx_fifo_size_setup_t *ptxfifoval; -+ -+ ptxfifoval = (tx_fifo_size_setup_t *) buf; -+ ep_addr = ptxfifoval->bEndpointAddress; -+ size = ptxfifoval->wDepth; -+ -+ ep = get_ep_by_addr(pcd, ep_addr); -+ -+ CFI_INFO -+ ("%s: Set Tx FIFO size: endpoint addr=0x%02x, depth=%d, FIFO Num=%d\n", -+ __func__, ep_addr, size, ep->dwc_ep.tx_fifo_num); -+ -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint addr=0x%02x\n", -+ __func__, ep_addr); -+ return -DWC_E_INVALID; -+ } -+ -+ fsiz = params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1]; -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = size; -+ -+ if (resize_fifos(GET_CORE_IF(pcd))) { -+ retval = 0; -+ } else { -+ CFI_INFO -+ ("%s: Error setting the feature Tx FIFO Size for EP%d\n", -+ __func__, ep_addr); -+ params->dev_tx_fifo_size[ep->dwc_ep.tx_fifo_num - 1] = fsiz; -+ retval = -DWC_E_INVALID; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the buffer Alignment setup. -+ */ -+static int cfi_set_rx_fifo_val(uint8_t * buf, dwc_otg_pcd_t * pcd) -+{ -+ int retval; -+ uint32_t fsiz; -+ uint16_t size; -+ dwc_otg_core_params_t *params = GET_CORE_IF(pcd)->core_params; -+ rx_fifo_size_setup_t *prxfifoval; -+ -+ prxfifoval = (rx_fifo_size_setup_t *) buf; -+ size = prxfifoval->wDepth; -+ -+ fsiz = params->dev_rx_fifo_size; -+ params->dev_rx_fifo_size = size; -+ -+ if (resize_fifos(GET_CORE_IF(pcd))) { -+ retval = 0; -+ } else { -+ CFI_INFO("%s: Error setting the feature Rx FIFO Size\n", -+ __func__); -+ params->dev_rx_fifo_size = fsiz; -+ retval = -DWC_E_INVALID; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function reads the SG of an EP's buffer setup into the buffer buf -+ */ -+static int cfi_ep_get_sg_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = -DWC_E_INVALID; -+ uint8_t addr; -+ cfi_ep_t *ep; -+ -+ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ -+ addr = req->wValue & 0xFF; -+ if (addr == 0) /* The address should be non-zero */ -+ return retval; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", -+ __func__, addr); -+ return retval; -+ } -+ -+ dwc_memcpy(buf, ep->bm_sg, BS_SG_VAL_DESC_LEN); -+ retval = BS_SG_VAL_DESC_LEN; -+ return retval; -+} -+ -+/** -+ * This function reads the Concatenation value of an EP's buffer mode into -+ * the buffer buf -+ */ -+static int cfi_ep_get_concat_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = -DWC_E_INVALID; -+ uint8_t addr; -+ cfi_ep_t *ep; -+ uint8_t desc_count; -+ -+ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ -+ addr = req->wValue & 0xFF; -+ if (addr == 0) /* The address should be non-zero */ -+ return retval; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", -+ __func__, addr); -+ return retval; -+ } -+ -+ /* Copy the header to the buffer */ -+ dwc_memcpy(buf, ep->bm_concat, BS_CONCAT_VAL_HDR_LEN); -+ /* Advance the buffer pointer by the header size */ -+ buf += BS_CONCAT_VAL_HDR_LEN; -+ -+ desc_count = ep->bm_concat->hdr.bDescCount; -+ /* Copy alll the wTxBytes to the buffer */ -+ dwc_memcpy(buf, ep->bm_concat->wTxBytes, sizeof(uid16_t) * desc_count); -+ -+ retval = BS_CONCAT_VAL_HDR_LEN + sizeof(uid16_t) * desc_count; -+ return retval; -+} -+ -+/** -+ * This function reads the buffer Alignment value of an EP's buffer mode into -+ * the buffer buf -+ * -+ * @return The total number of bytes copied to the buffer or negative error code. -+ */ -+static int cfi_ep_get_align_val(uint8_t * buf, struct dwc_otg_pcd *pcd, -+ struct cfi_usb_ctrlrequest *req) -+{ -+ int retval = -DWC_E_INVALID; -+ uint8_t addr; -+ cfi_ep_t *ep; -+ -+ /* The Low Byte of the wValue contains a non-zero address of the endpoint */ -+ addr = req->wValue & 0xFF; -+ if (addr == 0) /* The address should be non-zero */ -+ return retval; -+ -+ ep = get_cfi_ep_by_addr(pcd->cfi, addr); -+ if (NULL == ep) { -+ CFI_INFO("%s: Unable to get the endpoint address(0x%02x)\n", -+ __func__, addr); -+ return retval; -+ } -+ -+ dwc_memcpy(buf, ep->bm_align, BS_ALIGN_VAL_HDR_LEN); -+ retval = BS_ALIGN_VAL_HDR_LEN; -+ -+ return retval; -+} -+ -+/** -+ * This function sets a new value for the specified feature -+ * -+ * @param pcd A pointer to the PCD object -+ * -+ * @return 0 if successful, negative error code otherwise to stall the DCE. -+ */ -+static int cfi_set_feature_value(struct dwc_otg_pcd *pcd) -+{ -+ int retval = -DWC_E_NOT_SUPPORTED; -+ uint16_t wIndex, wValue; -+ uint8_t bRequest; -+ struct dwc_otg_core_if *coreif; -+ cfiobject_t *cfi = pcd->cfi; -+ struct cfi_usb_ctrlrequest *ctrl_req; -+ uint8_t *buf; -+ ctrl_req = &cfi->ctrl_req; -+ -+ buf = pcd->cfi->ctrl_req.data; -+ -+ coreif = GET_CORE_IF(pcd); -+ bRequest = ctrl_req->bRequest; -+ wIndex = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wIndex); -+ wValue = DWC_CONSTANT_CPU_TO_LE16(ctrl_req->wValue); -+ -+ /* See which feature is to be modified */ -+ switch (wIndex) { -+ case FT_ID_DMA_BUFFER_SETUP: -+ /* Modify the feature */ -+ if ((retval = cfi_ep_set_sg_val(buf, pcd)) < 0) -+ return retval; -+ -+ /* And send this request to the gadget */ -+ cfi->need_gadget_att = 1; -+ break; -+ -+ case FT_ID_DMA_BUFF_ALIGN: -+ if ((retval = cfi_ep_set_alignment_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 1; -+ break; -+ -+ case FT_ID_DMA_CONCAT_SETUP: -+ /* Modify the feature */ -+ if ((retval = cfi_ep_set_concat_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 1; -+ break; -+ -+ case FT_ID_DMA_CIRCULAR: -+ CFI_INFO("FT_ID_DMA_CIRCULAR\n"); -+ break; -+ -+ case FT_ID_THRESHOLD_SETUP: -+ CFI_INFO("FT_ID_THRESHOLD_SETUP\n"); -+ break; -+ -+ case FT_ID_DFIFO_DEPTH: -+ CFI_INFO("FT_ID_DFIFO_DEPTH\n"); -+ break; -+ -+ case FT_ID_TX_FIFO_DEPTH: -+ CFI_INFO("FT_ID_TX_FIFO_DEPTH\n"); -+ if ((retval = cfi_ep_set_tx_fifo_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 0; -+ break; -+ -+ case FT_ID_RX_FIFO_DEPTH: -+ CFI_INFO("FT_ID_RX_FIFO_DEPTH\n"); -+ if ((retval = cfi_set_rx_fifo_val(buf, pcd)) < 0) -+ return retval; -+ cfi->need_gadget_att = 0; -+ break; -+ } -+ -+ return retval; -+} -+ -+#endif //DWC_UTE_CFI -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h -new file mode 100644 -index 0000000000000000000000000000000000000000..55fd337a283c39512eb1409dfc1183c56dfd7680 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h -@@ -0,0 +1,320 @@ -+/* ========================================================================== -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_OTG_CFI_H__) -+#define __DWC_OTG_CFI_H__ -+ -+#include "dwc_otg_pcd.h" -+#include "dwc_cfi_common.h" -+ -+/** -+ * @file -+ * This file contains the CFI related OTG PCD specific common constants, -+ * interfaces(functions and macros) and data structures.The CFI Protocol is an -+ * optional interface for internal testing purposes that a DUT may implement to -+ * support testing of configurable features. -+ * -+ */ -+ -+struct dwc_otg_pcd; -+struct dwc_otg_pcd_ep; -+ -+/** OTG CFI Features (properties) ID constants */ -+/** This is a request for all Core Features */ -+#define FT_ID_DMA_MODE 0x0001 -+#define FT_ID_DMA_BUFFER_SETUP 0x0002 -+#define FT_ID_DMA_BUFF_ALIGN 0x0003 -+#define FT_ID_DMA_CONCAT_SETUP 0x0004 -+#define FT_ID_DMA_CIRCULAR 0x0005 -+#define FT_ID_THRESHOLD_SETUP 0x0006 -+#define FT_ID_DFIFO_DEPTH 0x0007 -+#define FT_ID_TX_FIFO_DEPTH 0x0008 -+#define FT_ID_RX_FIFO_DEPTH 0x0009 -+ -+/**********************************************************/ -+#define CFI_INFO_DEF -+ -+#ifdef CFI_INFO_DEF -+#define CFI_INFO(fmt...) DWC_PRINTF("CFI: " fmt); -+#else -+#define CFI_INFO(fmt...) -+#endif -+ -+#define min(x,y) ({ \ -+ x < y ? x : y; }) -+ -+#define max(x,y) ({ \ -+ x > y ? x : y; }) -+ -+/** -+ * Descriptor DMA SG Buffer setup structure (SG buffer). This structure is -+ * also used for setting up a buffer for Circular DDMA. -+ */ -+struct _ddma_sg_buffer_setup { -+#define BS_SG_VAL_DESC_LEN 6 -+ /* The OUT EP address */ -+ uint8_t bOutEndpointAddress; -+ /* The IN EP address */ -+ uint8_t bInEndpointAddress; -+ /* Number of bytes to put between transfer segments (must be DWORD boundaries) */ -+ uint8_t bOffset; -+ /* The number of transfer segments (a DMA descriptors per each segment) */ -+ uint8_t bCount; -+ /* Size (in byte) of each transfer segment */ -+ uint16_t wSize; -+} __attribute__ ((packed)); -+typedef struct _ddma_sg_buffer_setup ddma_sg_buffer_setup_t; -+ -+/** Descriptor DMA Concatenation Buffer setup structure */ -+struct _ddma_concat_buffer_setup_hdr { -+#define BS_CONCAT_VAL_HDR_LEN 4 -+ /* The endpoint for which the buffer is to be set up */ -+ uint8_t bEndpointAddress; -+ /* The count of descriptors to be used */ -+ uint8_t bDescCount; -+ /* The total size of the transfer */ -+ uint16_t wSize; -+} __attribute__ ((packed)); -+typedef struct _ddma_concat_buffer_setup_hdr ddma_concat_buffer_setup_hdr_t; -+ -+/** Descriptor DMA Concatenation Buffer setup structure */ -+struct _ddma_concat_buffer_setup { -+ /* The SG header */ -+ ddma_concat_buffer_setup_hdr_t hdr; -+ -+ /* The XFER sizes pointer (allocated dynamically) */ -+ uint16_t *wTxBytes; -+} __attribute__ ((packed)); -+typedef struct _ddma_concat_buffer_setup ddma_concat_buffer_setup_t; -+ -+/** Descriptor DMA Alignment Buffer setup structure */ -+struct _ddma_align_buffer_setup { -+#define BS_ALIGN_VAL_HDR_LEN 2 -+ uint8_t bEndpointAddress; -+ uint8_t bAlign; -+} __attribute__ ((packed)); -+typedef struct _ddma_align_buffer_setup ddma_align_buffer_setup_t; -+ -+/** Transmit FIFO Size setup structure */ -+struct _tx_fifo_size_setup { -+ uint8_t bEndpointAddress; -+ uint16_t wDepth; -+} __attribute__ ((packed)); -+typedef struct _tx_fifo_size_setup tx_fifo_size_setup_t; -+ -+/** Transmit FIFO Size setup structure */ -+struct _rx_fifo_size_setup { -+ uint16_t wDepth; -+} __attribute__ ((packed)); -+typedef struct _rx_fifo_size_setup rx_fifo_size_setup_t; -+ -+/** -+ * struct cfi_usb_ctrlrequest - the CFI implementation of the struct usb_ctrlrequest -+ * This structure encapsulates the standard usb_ctrlrequest and adds a pointer -+ * to the data returned in the data stage of a 3-stage Control Write requests. -+ */ -+struct cfi_usb_ctrlrequest { -+ uint8_t bRequestType; -+ uint8_t bRequest; -+ uint16_t wValue; -+ uint16_t wIndex; -+ uint16_t wLength; -+ uint8_t *data; -+} UPACKED; -+ -+/*---------------------------------------------------------------------------*/ -+ -+/** -+ * The CFI wrapper of the enabled and activated dwc_otg_pcd_ep structures. -+ * This structure is used to store the buffer setup data for any -+ * enabled endpoint in the PCD. -+ */ -+struct cfi_ep { -+ /* Entry for the list container */ -+ dwc_list_link_t lh; -+ /* Pointer to the active PCD endpoint structure */ -+ struct dwc_otg_pcd_ep *ep; -+ /* The last descriptor in the chain of DMA descriptors of the endpoint */ -+ struct dwc_otg_dma_desc *dma_desc_last; -+ /* The SG feature value */ -+ ddma_sg_buffer_setup_t *bm_sg; -+ /* The Circular feature value */ -+ ddma_sg_buffer_setup_t *bm_circ; -+ /* The Concatenation feature value */ -+ ddma_concat_buffer_setup_t *bm_concat; -+ /* The Alignment feature value */ -+ ddma_align_buffer_setup_t *bm_align; -+ /* XFER length */ -+ uint32_t xfer_len; -+ /* -+ * Count of DMA descriptors currently used. -+ * The total should not exceed the MAX_DMA_DESCS_PER_EP value -+ * defined in the dwc_otg_cil.h -+ */ -+ uint32_t desc_count; -+}; -+typedef struct cfi_ep cfi_ep_t; -+ -+typedef struct cfi_dma_buff { -+#define CFI_IN_BUF_LEN 1024 -+#define CFI_OUT_BUF_LEN 1024 -+ dma_addr_t addr; -+ uint8_t *buf; -+} cfi_dma_buff_t; -+ -+struct cfiobject; -+ -+/** -+ * This is the interface for the CFI operations. -+ * -+ * @param ep_enable Called when any endpoint is enabled and activated. -+ * @param release Called when the CFI object is released and it needs to correctly -+ * deallocate the dynamic memory -+ * @param ctrl_write_complete Called when the data stage of the request is complete -+ */ -+typedef struct cfi_ops { -+ int (*ep_enable) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, -+ struct dwc_otg_pcd_ep * ep); -+ void *(*ep_alloc_buf) (struct cfiobject * cfi, struct dwc_otg_pcd * pcd, -+ struct dwc_otg_pcd_ep * ep, dma_addr_t * dma, -+ unsigned size, gfp_t flags); -+ void (*release) (struct cfiobject * cfi); -+ int (*ctrl_write_complete) (struct cfiobject * cfi, -+ struct dwc_otg_pcd * pcd); -+ void (*build_descriptors) (struct cfiobject * cfi, -+ struct dwc_otg_pcd * pcd, -+ struct dwc_otg_pcd_ep * ep, -+ dwc_otg_pcd_request_t * req); -+} cfi_ops_t; -+ -+struct cfiobject { -+ cfi_ops_t ops; -+ struct dwc_otg_pcd *pcd; -+ struct usb_gadget *gadget; -+ -+ /* Buffers used to send/receive CFI-related request data */ -+ cfi_dma_buff_t buf_in; -+ cfi_dma_buff_t buf_out; -+ -+ /* CFI specific Control request wrapper */ -+ struct cfi_usb_ctrlrequest ctrl_req; -+ -+ /* The list of active EP's in the PCD of type cfi_ep_t */ -+ dwc_list_link_t active_eps; -+ -+ /* This flag shall control the propagation of a specific request -+ * to the gadget's processing routines. -+ * 0 - no gadget handling -+ * 1 - the gadget needs to know about this request (w/o completing a status -+ * phase - just return a 0 to the _setup callback) -+ */ -+ uint8_t need_gadget_att; -+ -+ /* Flag indicating whether the status IN phase needs to be -+ * completed by the PCD -+ */ -+ uint8_t need_status_in_complete; -+}; -+typedef struct cfiobject cfiobject_t; -+ -+#define DUMP_MSG -+ -+#if defined(DUMP_MSG) -+static inline void dump_msg(const u8 * buf, unsigned int length) -+{ -+ unsigned int start, num, i; -+ char line[52], *p; -+ -+ if (length >= 512) -+ return; -+ -+ start = 0; -+ while (length > 0) { -+ num = min(length, 16u); -+ p = line; -+ for (i = 0; i < num; ++i) { -+ if (i == 8) -+ *p++ = ' '; -+ DWC_SPRINTF(p, " %02x", buf[i]); -+ p += 3; -+ } -+ *p = 0; -+ DWC_DEBUG("%6x: %s\n", start, line); -+ buf += num; -+ start += num; -+ length -= num; -+ } -+} -+#else -+static inline void dump_msg(const u8 * buf, unsigned int length) -+{ -+} -+#endif -+ -+/** -+ * This function returns a pointer to cfi_ep_t object with the addr address. -+ */ -+static inline struct cfi_ep *get_cfi_ep_by_addr(struct cfiobject *cfi, -+ uint8_t addr) -+{ -+ struct cfi_ep *pcfiep; -+ dwc_list_link_t *tmp; -+ -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ -+ if (pcfiep->ep->desc->bEndpointAddress == addr) { -+ return pcfiep; -+ } -+ } -+ -+ return NULL; -+} -+ -+/** -+ * This function returns a pointer to cfi_ep_t object that matches -+ * the dwc_otg_pcd_ep object. -+ */ -+static inline struct cfi_ep *get_cfi_ep_by_pcd_ep(struct cfiobject *cfi, -+ struct dwc_otg_pcd_ep *ep) -+{ -+ struct cfi_ep *pcfiep = NULL; -+ dwc_list_link_t *tmp; -+ -+ DWC_LIST_FOREACH(tmp, &cfi->active_eps) { -+ pcfiep = DWC_LIST_ENTRY(tmp, struct cfi_ep, lh); -+ if (pcfiep->ep == ep) { -+ return pcfiep; -+ } -+ } -+ return NULL; -+} -+ -+int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl); -+ -+#endif /* (__DWC_OTG_CFI_H__) */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c -new file mode 100644 -index 0000000000000000000000000000000000000000..38abd0b1f0341b50a2d7ad7493e2d09b6b8a55a9 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c -@@ -0,0 +1,7141 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ -+ * $Revision: #191 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * The Core Interface Layer provides basic services for accessing and -+ * managing the DWC_otg hardware. These services are used by both the -+ * Host Controller Driver and the Peripheral Controller Driver. -+ * -+ * The CIL manages the memory map for the core so that the HCD and PCD -+ * don't have to do this separately. It also handles basic tasks like -+ * reading/writing the registers and data FIFOs in the controller. -+ * Some of the data access functions provide encapsulation of several -+ * operations required to perform a task, such as writing multiple -+ * registers to start a transfer. Finally, the CIL performs basic -+ * services that are not specific to either the host or device modes -+ * of operation. These services include management of the OTG Host -+ * Negotiation Protocol (HNP) and Session Request Protocol (SRP). A -+ * Diagnostic API is also provided to allow testing of the controller -+ * hardware. -+ * -+ * The Core Interface Layer has the following requirements: -+ * - Provides basic controller operations. -+ * - Minimal use of OS services. -+ * - The OS services used will be abstracted by using inline functions -+ * or macros. -+ * -+ */ -+ -+#include "dwc_os.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+ -+static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if); -+ -+/** -+ * This function is called to initialize the DWC_otg CSR data -+ * structures. The register addresses in the device and host -+ * structures are initialized from the base address supplied by the -+ * caller. The calling function must make the OS calls to get the -+ * base address of the DWC_otg controller registers. The core_params -+ * argument holds the parameters that specify how the core should be -+ * configured. -+ * -+ * @param reg_base_addr Base address of DWC_otg core registers -+ * -+ */ -+dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * reg_base_addr) -+{ -+ dwc_otg_core_if_t *core_if = 0; -+ dwc_otg_dev_if_t *dev_if = 0; -+ dwc_otg_host_if_t *host_if = 0; -+ uint8_t *reg_base = (uint8_t *) reg_base_addr; -+ int i = 0; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, reg_base_addr); -+ -+ core_if = DWC_ALLOC(sizeof(dwc_otg_core_if_t)); -+ -+ if (core_if == NULL) { -+ DWC_DEBUGPL(DBG_CIL, -+ "Allocation of dwc_otg_core_if_t failed\n"); -+ return 0; -+ } -+ core_if->core_global_regs = (dwc_otg_core_global_regs_t *) reg_base; -+ -+ /* -+ * Allocate the Device Mode structures. -+ */ -+ dev_if = DWC_ALLOC(sizeof(dwc_otg_dev_if_t)); -+ -+ if (dev_if == NULL) { -+ DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_dev_if_t failed\n"); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ dev_if->dev_global_regs = -+ (dwc_otg_device_global_regs_t *) (reg_base + -+ DWC_DEV_GLOBAL_REG_OFFSET); -+ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ dev_if->in_ep_regs[i] = (dwc_otg_dev_in_ep_regs_t *) -+ (reg_base + DWC_DEV_IN_EP_REG_OFFSET + -+ (i * DWC_EP_REG_OFFSET)); -+ -+ dev_if->out_ep_regs[i] = (dwc_otg_dev_out_ep_regs_t *) -+ (reg_base + DWC_DEV_OUT_EP_REG_OFFSET + -+ (i * DWC_EP_REG_OFFSET)); -+ DWC_DEBUGPL(DBG_CILV, "in_ep_regs[%d]->diepctl=%p\n", -+ i, &dev_if->in_ep_regs[i]->diepctl); -+ DWC_DEBUGPL(DBG_CILV, "out_ep_regs[%d]->doepctl=%p\n", -+ i, &dev_if->out_ep_regs[i]->doepctl); -+ } -+ -+ dev_if->speed = 0; // unknown -+ -+ core_if->dev_if = dev_if; -+ -+ /* -+ * Allocate the Host Mode structures. -+ */ -+ host_if = DWC_ALLOC(sizeof(dwc_otg_host_if_t)); -+ -+ if (host_if == NULL) { -+ DWC_DEBUGPL(DBG_CIL, -+ "Allocation of dwc_otg_host_if_t failed\n"); -+ DWC_FREE(dev_if); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ host_if->host_global_regs = (dwc_otg_host_global_regs_t *) -+ (reg_base + DWC_OTG_HOST_GLOBAL_REG_OFFSET); -+ -+ host_if->hprt0 = -+ (uint32_t *) (reg_base + DWC_OTG_HOST_PORT_REGS_OFFSET); -+ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ host_if->hc_regs[i] = (dwc_otg_hc_regs_t *) -+ (reg_base + DWC_OTG_HOST_CHAN_REGS_OFFSET + -+ (i * DWC_OTG_CHAN_REGS_OFFSET)); -+ DWC_DEBUGPL(DBG_CILV, "hc_reg[%d]->hcchar=%p\n", -+ i, &host_if->hc_regs[i]->hcchar); -+ } -+ -+ host_if->num_host_channels = MAX_EPS_CHANNELS; -+ core_if->host_if = host_if; -+ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ core_if->data_fifo[i] = -+ (uint32_t *) (reg_base + DWC_OTG_DATA_FIFO_OFFSET + -+ (i * DWC_OTG_DATA_FIFO_SIZE)); -+ DWC_DEBUGPL(DBG_CILV, "data_fifo[%d]=0x%08lx\n", -+ i, (unsigned long)core_if->data_fifo[i]); -+ } -+ -+ core_if->pcgcctl = (uint32_t *) (reg_base + DWC_OTG_PCGCCTL_OFFSET); -+ -+ /* Initiate lx_state to L3 disconnected state */ -+ core_if->lx_state = DWC_OTG_L3; -+ /* -+ * Store the contents of the hardware configuration registers here for -+ * easy access later. -+ */ -+ core_if->hwcfg1.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg1); -+ core_if->hwcfg2.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); -+ core_if->hwcfg3.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg3); -+ core_if->hwcfg4.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); -+ -+ /* Force host mode to get HPTXFSIZ exact power on value */ -+ { -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ gusbcfg.b.force_host_mode = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); -+ dwc_mdelay(100); -+ core_if->hptxfsiz.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); -+ gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ gusbcfg.b.force_host_mode = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); -+ dwc_mdelay(100); -+ } -+ -+ DWC_DEBUGPL(DBG_CILV, "hwcfg1=%08x\n", core_if->hwcfg1.d32); -+ DWC_DEBUGPL(DBG_CILV, "hwcfg2=%08x\n", core_if->hwcfg2.d32); -+ DWC_DEBUGPL(DBG_CILV, "hwcfg3=%08x\n", core_if->hwcfg3.d32); -+ DWC_DEBUGPL(DBG_CILV, "hwcfg4=%08x\n", core_if->hwcfg4.d32); -+ -+ core_if->hcfg.d32 = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ core_if->dcfg.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ -+ DWC_DEBUGPL(DBG_CILV, "hcfg=%08x\n", core_if->hcfg.d32); -+ DWC_DEBUGPL(DBG_CILV, "dcfg=%08x\n", core_if->dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_CILV, "op_mode=%0x\n", core_if->hwcfg2.b.op_mode); -+ DWC_DEBUGPL(DBG_CILV, "arch=%0x\n", core_if->hwcfg2.b.architecture); -+ DWC_DEBUGPL(DBG_CILV, "num_dev_ep=%d\n", core_if->hwcfg2.b.num_dev_ep); -+ DWC_DEBUGPL(DBG_CILV, "num_host_chan=%d\n", -+ core_if->hwcfg2.b.num_host_chan); -+ DWC_DEBUGPL(DBG_CILV, "nonperio_tx_q_depth=0x%0x\n", -+ core_if->hwcfg2.b.nonperio_tx_q_depth); -+ DWC_DEBUGPL(DBG_CILV, "host_perio_tx_q_depth=0x%0x\n", -+ core_if->hwcfg2.b.host_perio_tx_q_depth); -+ DWC_DEBUGPL(DBG_CILV, "dev_token_q_depth=0x%0x\n", -+ core_if->hwcfg2.b.dev_token_q_depth); -+ -+ DWC_DEBUGPL(DBG_CILV, "Total FIFO SZ=%d\n", -+ core_if->hwcfg3.b.dfifo_depth); -+ DWC_DEBUGPL(DBG_CILV, "xfer_size_cntr_width=%0x\n", -+ core_if->hwcfg3.b.xfer_size_cntr_width); -+ -+ /* -+ * Set the SRP sucess bit for FS-I2c -+ */ -+ core_if->srp_success = 0; -+ core_if->srp_timer_started = 0; -+ -+ /* -+ * Create new workqueue and init works -+ */ -+ core_if->wq_otg = DWC_WORKQ_ALLOC("dwc_otg"); -+ if (core_if->wq_otg == 0) { -+ DWC_WARN("DWC_WORKQ_ALLOC failed\n"); -+ DWC_FREE(host_if); -+ DWC_FREE(dev_if); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ core_if->snpsid = DWC_READ_REG32(&core_if->core_global_regs->gsnpsid); -+ -+ DWC_PRINTF("Core Release: %x.%x%x%x\n", -+ (core_if->snpsid >> 12 & 0xF), -+ (core_if->snpsid >> 8 & 0xF), -+ (core_if->snpsid >> 4 & 0xF), (core_if->snpsid & 0xF)); -+ -+ core_if->wkp_timer = DWC_TIMER_ALLOC("Wake Up Timer", -+ w_wakeup_detected, core_if); -+ if (core_if->wkp_timer == 0) { -+ DWC_WARN("DWC_TIMER_ALLOC failed\n"); -+ DWC_FREE(host_if); -+ DWC_FREE(dev_if); -+ DWC_WORKQ_FREE(core_if->wq_otg); -+ DWC_FREE(core_if); -+ return 0; -+ } -+ -+ if (dwc_otg_setup_params(core_if)) { -+ DWC_WARN("Error while setting core params\n"); -+ } -+ -+ core_if->hibernation_suspend = 0; -+ -+ /** ADP initialization */ -+ dwc_otg_adp_init(core_if); -+ -+ return core_if; -+} -+ -+/** -+ * This function frees the structures allocated by dwc_otg_cil_init(). -+ * -+ * @param core_if The core interface pointer returned from -+ * dwc_otg_cil_init(). -+ * -+ */ -+void dwc_otg_cil_remove(dwc_otg_core_if_t * core_if) -+{ -+ dctl_data_t dctl = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); -+ -+ /* Disable all interrupts */ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 1, 0); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0); -+ -+ dctl.b.sftdiscon = 1; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, -+ dctl.d32); -+ } -+ -+ if (core_if->wq_otg) { -+ DWC_WORKQ_WAIT_WORK_DONE(core_if->wq_otg, 500); -+ DWC_WORKQ_FREE(core_if->wq_otg); -+ } -+ if (core_if->dev_if) { -+ DWC_FREE(core_if->dev_if); -+ } -+ if (core_if->host_if) { -+ DWC_FREE(core_if->host_if); -+ } -+ -+ /** Remove ADP Stuff */ -+ dwc_otg_adp_remove(core_if); -+ if (core_if->core_params) { -+ DWC_FREE(core_if->core_params); -+ } -+ if (core_if->wkp_timer) { -+ DWC_TIMER_FREE(core_if->wkp_timer); -+ } -+ if (core_if->srp_timer) { -+ DWC_TIMER_FREE(core_if->srp_timer); -+ } -+ DWC_FREE(core_if); -+} -+ -+/** -+ * This function enables the controller's Global Interrupt in the AHB Config -+ * register. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, 0, ahbcfg.d32); -+} -+ -+/** -+ * This function disables the controller's Global Interrupt in the AHB Config -+ * register. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ ahbcfg.b.glblintrmsk = 1; /* Disable interrupts */ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); -+} -+ -+/** -+ * This function initializes the commmon interrupts, used in both -+ * device and host modes. -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ * -+ */ -+static void dwc_otg_enable_common_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ /* Clear any pending OTG Interrupts */ -+ DWC_WRITE_REG32(&global_regs->gotgint, 0xFFFFFFFF); -+ -+ /* Clear any pending interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* -+ * Enable the interrupts in the GINTMSK. -+ */ -+ intr_mask.b.modemismatch = 1; -+ intr_mask.b.otgintr = 1; -+ -+ if (!core_if->dma_enable) { -+ intr_mask.b.rxstsqlvl = 1; -+ } -+ -+ intr_mask.b.conidstschng = 1; -+ intr_mask.b.wkupintr = 1; -+ intr_mask.b.disconnect = 0; -+ intr_mask.b.usbsuspend = 1; -+ intr_mask.b.sessreqintr = 1; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (core_if->core_params->lpm_enable) { -+ intr_mask.b.lpmtranrcvd = 1; -+ } -+#endif -+ DWC_WRITE_REG32(&global_regs->gintmsk, intr_mask.d32); -+} -+ -+/* -+ * The restore operation is modified to support Synopsys Emulated Powerdown and -+ * Hibernation. This function is for exiting from Device mode hibernation by -+ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. -+ * @param core_if Programming view of DWC_otg controller. -+ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. -+ * @param reset - indicates whether resume is initiated by Reset. -+ */ -+int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ -+ int timeout = 2000; -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "%s called\n", __FUNCTION__); -+ /* Switch-on voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Assert Restore signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ if (rem_wakeup) { -+ dwc_udelay(70); -+ } -+ -+ /* Deassert Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Mask interrupts from gpwrdn */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.connect_det_msk = 1; -+ gpwrdn.b.srp_det_msk = 1; -+ gpwrdn.b.disconn_det_msk = 1; -+ gpwrdn.b.rst_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Indicates that we are going out from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* -+ * Set Restore Essential Regs bit in PCGCCTL register, restore_mode = 1 -+ * indicates restore from remote_wakeup -+ */ -+ restore_essential_regs(core_if, rem_wakeup, 0); -+ -+ /* -+ * Wait a little for seeing new value of variable hibernation_suspend if -+ * Restore done interrupt received before polling -+ */ -+ dwc_udelay(10); -+ -+ if (core_if->hibernation_suspend == 0) { -+ /* -+ * Wait For Restore_done Interrupt. This mechanism of polling the -+ * interrupt is introduced to avoid any possible race conditions -+ */ -+ do { -+ gintsts_data_t gintsts; -+ gintsts.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (gintsts.b.restoredone) { -+ gintsts.d32 = 0; -+ gintsts.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, gintsts.d32); -+ DWC_PRINTF("Restore Done Interrupt seen\n"); -+ break; -+ } -+ dwc_udelay(10); -+ } while (--timeout); -+ if (!timeout) { -+ DWC_PRINTF("Restore Done interrupt wasn't generated here\n"); -+ } -+ } -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* De-assert Restore */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ if (!rem_wakeup) { -+ pcgcctl.d32 = 0; -+ pcgcctl.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ } -+ -+ /* Restore GUSBCFG and DCFG */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, -+ core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, -+ core_if->dr_backup->dcfg); -+ -+ /* De-assert Wakeup Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ if (!rem_wakeup) { -+ /* Set Device programming done bit */ -+ dctl.b.pwronprgdone = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } else { -+ /* Start Remote Wakeup Signaling */ -+ dctl.d32 = core_if->dr_backup->dctl; -+ dctl.b.rmtwkupsig = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+ } -+ -+ dwc_mdelay(2); -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Restore global registers */ -+ dwc_otg_restore_global_regs(core_if); -+ /* Restore device global registers */ -+ dwc_otg_restore_dev_regs(core_if, rem_wakeup); -+ -+ if (rem_wakeup) { -+ dwc_mdelay(7); -+ dctl.d32 = 0; -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); -+ } -+ -+ core_if->hibernation_suspend = 0; -+ /* The core will be in ON STATE */ -+ core_if->lx_state = DWC_OTG_L0; -+ DWC_PRINTF("Hibernation recovery completes here\n"); -+ -+ return 1; -+} -+ -+/* -+ * The restore operation is modified to support Synopsys Emulated Powerdown and -+ * Hibernation. This function is for exiting from Host mode hibernation by -+ * Host Initiated Resume/Reset and Device Initiated Remote-Wakeup. -+ * @param core_if Programming view of DWC_otg controller. -+ * @param rem_wakeup - indicates whether resume is initiated by Device or Host. -+ * @param reset - indicates whether resume is initiated by Reset. -+ */ -+int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ -+ int timeout = 2000; -+ -+ DWC_DEBUGPL(DBG_HCD, "%s called\n", __FUNCTION__); -+ /* Switch-on voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Assert Restore signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ if (!rem_wakeup) { -+ dwc_udelay(50); -+ } -+ -+ /* Deassert Reset core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.connect_det_msk = 1; -+ gpwrdn.b.srp_det_msk = 1; -+ gpwrdn.b.disconn_det_msk = 1; -+ gpwrdn.b.rst_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Indicates that we are going out from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Set Restore Essential Regs bit in PCGCCTL register */ -+ restore_essential_regs(core_if, rem_wakeup, 1); -+ -+ /* Wait a little for seeing new value of variable hibernation_suspend if -+ * Restore done interrupt received before polling */ -+ dwc_udelay(10); -+ -+ if (core_if->hibernation_suspend == 0) { -+ /* Wait For Restore_done Interrupt. This mechanism of polling the -+ * interrupt is introduced to avoid any possible race conditions -+ */ -+ do { -+ gintsts_data_t gintsts; -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (gintsts.b.restoredone) { -+ gintsts.d32 = 0; -+ gintsts.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ DWC_DEBUGPL(DBG_HCD,"Restore Done Interrupt seen\n"); -+ break; -+ } -+ dwc_udelay(10); -+ } while (--timeout); -+ if (!timeout) { -+ DWC_WARN("Restore Done interrupt wasn't generated\n"); -+ } -+ } -+ -+ /* Set the flag's value to 0 again after receiving restore done interrupt */ -+ core_if->hibernation_suspend = 0; -+ -+ /* This step is not described in functional spec but if not wait for this -+ * delay, mismatch interrupts occurred because just after restore core is -+ * in Device mode(gintsts.curmode == 0) */ -+ dwc_mdelay(100); -+ -+ /* Clear all pending interrupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* De-assert Restore */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Restore GUSBCFG and HCFG */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, -+ core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, -+ core_if->hr_backup->hcfg_local); -+ -+ /* De-assert Wakeup Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Start the Resume operation by programming HPRT0 */ -+ hprt0.d32 = core_if->hr_backup->hprt0_local; -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtena = 0; -+ hprt0.b.prtsusp = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ DWC_PRINTF("Resume Starts Now\n"); -+ if (!reset) { // Indicates it is Resume Operation -+ hprt0.d32 = core_if->hr_backup->hprt0_local; -+ hprt0.b.prtres = 1; -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtena = 0; -+ hprt0.b.prtsusp = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ if (!rem_wakeup) -+ hprt0.b.prtres = 0; -+ /* Wait for Resume time and then program HPRT again */ -+ dwc_mdelay(100); -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ } else { // Indicates it is Reset Operation -+ hprt0.d32 = core_if->hr_backup->hprt0_local; -+ hprt0.b.prtrst = 1; -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtena = 0; -+ hprt0.b.prtsusp = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ /* Wait for Reset time and then program HPRT again */ -+ dwc_mdelay(60); -+ hprt0.b.prtrst = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ /* Clear all interrupt status */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtconndet = 1; -+ hprt0.b.prtenchng = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Restore global registers */ -+ dwc_otg_restore_global_regs(core_if); -+ /* Restore host global registers */ -+ dwc_otg_restore_host_regs(core_if, reset); -+ -+ /* The core will be in ON STATE */ -+ core_if->lx_state = DWC_OTG_L0; -+ DWC_PRINTF("Hibernation recovery is complete here\n"); -+ return 0; -+} -+ -+/** Saves some register values into system memory. */ -+int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ int i; -+ -+ gr = core_if->gr_backup; -+ if (!gr) { -+ gr = DWC_ALLOC(sizeof(*gr)); -+ if (!gr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->gr_backup = gr; -+ } -+ -+ gr->gotgctl_local = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ gr->gahbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); -+ gr->gusbcfg_local = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ gr->grxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ gr->gnptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); -+ gr->hptxfsiz_local = DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ gr->glpmcfg_local = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+#endif -+ gr->gi2cctl_local = DWC_READ_REG32(&core_if->core_global_regs->gi2cctl); -+ gr->pcgcctl_local = DWC_READ_REG32(core_if->pcgcctl); -+ gr->gdfifocfg_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gdfifocfg); -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ gr->dtxfsiz_local[i] = -+ DWC_READ_REG32(&(core_if->core_global_regs->dtxfsiz[i])); -+ } -+ -+ DWC_DEBUGPL(DBG_ANY, "===========Backing Global registers==========\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gotgctl = %08x\n", gr->gotgctl_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gahbcfg = %08x\n", gr->gahbcfg_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gusbcfg = %08x\n", gr->gusbcfg_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up grxfsiz = %08x\n", gr->grxfsiz_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gnptxfsiz = %08x\n", -+ gr->gnptxfsiz_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up hptxfsiz = %08x\n", -+ gr->hptxfsiz_local); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ DWC_DEBUGPL(DBG_ANY, "Backed up glpmcfg = %08x\n", gr->glpmcfg_local); -+#endif -+ DWC_DEBUGPL(DBG_ANY, "Backed up gi2cctl = %08x\n", gr->gi2cctl_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up pcgcctl = %08x\n", gr->pcgcctl_local); -+ DWC_DEBUGPL(DBG_ANY,"Backed up gdfifocfg = %08x\n",gr->gdfifocfg_local); -+ -+ return 0; -+} -+ -+/** Saves GINTMSK register before setting the msk bits. */ -+int dwc_otg_save_gintmsk_reg(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ -+ gr = core_if->gr_backup; -+ if (!gr) { -+ gr = DWC_ALLOC(sizeof(*gr)); -+ if (!gr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->gr_backup = gr; -+ } -+ -+ gr->gintmsk_local = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ -+ DWC_DEBUGPL(DBG_ANY,"=============Backing GINTMSK registers============\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up gintmsk = %08x\n", gr->gintmsk_local); -+ -+ return 0; -+} -+ -+int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_dev_regs_backup *dr; -+ int i; -+ -+ dr = core_if->dr_backup; -+ if (!dr) { -+ dr = DWC_ALLOC(sizeof(*dr)); -+ if (!dr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->dr_backup = dr; -+ } -+ -+ dr->dcfg = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dr->dctl = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ dr->daintmsk = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); -+ dr->diepmsk = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->diepmsk); -+ dr->doepmsk = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->doepmsk); -+ -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ dr->diepctl[i] = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); -+ dr->dieptsiz[i] = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz); -+ dr->diepdma[i] = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma); -+ } -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "=============Backing Host registers==============\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up dcfg = %08x\n", dr->dcfg); -+ DWC_DEBUGPL(DBG_ANY, "Backed up dctl = %08x\n", dr->dctl); -+ DWC_DEBUGPL(DBG_ANY, "Backed up daintmsk = %08x\n", -+ dr->daintmsk); -+ DWC_DEBUGPL(DBG_ANY, "Backed up diepmsk = %08x\n", dr->diepmsk); -+ DWC_DEBUGPL(DBG_ANY, "Backed up doepmsk = %08x\n", dr->doepmsk); -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_DEBUGPL(DBG_ANY, "Backed up diepctl[%d] = %08x\n", i, -+ dr->diepctl[i]); -+ DWC_DEBUGPL(DBG_ANY, "Backed up dieptsiz[%d] = %08x\n", -+ i, dr->dieptsiz[i]); -+ DWC_DEBUGPL(DBG_ANY, "Backed up diepdma[%d] = %08x\n", i, -+ dr->diepdma[i]); -+ } -+ -+ return 0; -+} -+ -+int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_host_regs_backup *hr; -+ int i; -+ -+ hr = core_if->hr_backup; -+ if (!hr) { -+ hr = DWC_ALLOC(sizeof(*hr)); -+ if (!hr) { -+ return -DWC_E_NO_MEMORY; -+ } -+ core_if->hr_backup = hr; -+ } -+ -+ hr->hcfg_local = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ hr->haintmsk_local = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); -+ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { -+ hr->hcintmsk_local[i] = -+ DWC_READ_REG32(&core_if->host_if->hc_regs[i]->hcintmsk); -+ } -+ hr->hprt0_local = DWC_READ_REG32(core_if->host_if->hprt0); -+ hr->hfir_local = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "=============Backing Host registers===============\n"); -+ DWC_DEBUGPL(DBG_ANY, "Backed up hcfg = %08x\n", -+ hr->hcfg_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up haintmsk = %08x\n", hr->haintmsk_local); -+ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { -+ DWC_DEBUGPL(DBG_ANY, "Backed up hcintmsk[%02d]=%08x\n", i, -+ hr->hcintmsk_local[i]); -+ } -+ DWC_DEBUGPL(DBG_ANY, "Backed up hprt0 = %08x\n", -+ hr->hprt0_local); -+ DWC_DEBUGPL(DBG_ANY, "Backed up hfir = %08x\n", -+ hr->hfir_local); -+ -+ return 0; -+} -+ -+int dwc_otg_restore_global_regs(dwc_otg_core_if_t *core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ int i; -+ -+ gr = core_if->gr_backup; -+ if (!gr) { -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, gr->gotgctl_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gr->gintmsk_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gr->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gr->gahbcfg_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, gr->grxfsiz_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, -+ gr->gnptxfsiz_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->hptxfsiz, -+ gr->hptxfsiz_local); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gdfifocfg, -+ gr->gdfifocfg_local); -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ DWC_WRITE_REG32(&core_if->core_global_regs->dtxfsiz[i], -+ gr->dtxfsiz_local[i]); -+ } -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ DWC_WRITE_REG32(core_if->host_if->hprt0, 0x0000100A); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, -+ (gr->gahbcfg_local)); -+ return 0; -+} -+ -+int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, int rem_wakeup) -+{ -+ struct dwc_otg_dev_regs_backup *dr; -+ int i; -+ -+ dr = core_if->dr_backup; -+ -+ if (!dr) { -+ return -DWC_E_INVALID; -+ } -+ -+ if (!rem_wakeup) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ dr->dctl); -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->daintmsk, dr->daintmsk); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->diepmsk, dr->diepmsk); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->doepmsk, dr->doepmsk); -+ -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->dieptsiz, dr->dieptsiz[i]); -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepdma, dr->diepdma[i]); -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl, dr->diepctl[i]); -+ } -+ -+ return 0; -+} -+ -+int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset) -+{ -+ struct dwc_otg_host_regs_backup *hr; -+ int i; -+ hr = core_if->hr_backup; -+ -+ if (!hr) { -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hr->hcfg_local); -+ //if (!reset) -+ //{ -+ // DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hr->hfir_local); -+ //} -+ -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->haintmsk, -+ hr->haintmsk_local); -+ for (i = 0; i < dwc_otg_get_param_host_channels(core_if); ++i) { -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[i]->hcintmsk, -+ hr->hcintmsk_local[i]); -+ } -+ -+ return 0; -+} -+ -+int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ -+ gr = core_if->gr_backup; -+ -+ /* Restore values for LPM and I2C */ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, gr->glpmcfg_local); -+#endif -+ DWC_WRITE_REG32(&core_if->core_global_regs->gi2cctl, gr->gi2cctl_local); -+ -+ return 0; -+} -+ -+int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, int is_host) -+{ -+ struct dwc_otg_global_regs_backup *gr; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gahbcfg_data_t gahbcfg = {.d32 = 0 }; -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ /* Restore LPM and I2C registers */ -+ restore_lpm_i2c_regs(core_if); -+ -+ /* Set PCGCCTL to 0 */ -+ DWC_WRITE_REG32(core_if->pcgcctl, 0x00000000); -+ -+ gr = core_if->gr_backup; -+ /* Load restore values for [31:14] bits */ -+ DWC_WRITE_REG32(core_if->pcgcctl, -+ ((gr->pcgcctl_local & 0xffffc000) | 0x00020000)); -+ -+ /* Umnask global Interrupt in GAHBCFG and restore it */ -+ gahbcfg.d32 = gr->gahbcfg_local; -+ gahbcfg.b.glblintrmsk = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); -+ -+ /* Clear all pending interupts */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Unmask restore done interrupt */ -+ gintmsk.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32); -+ -+ /* Restore GUSBCFG and HCFG/DCFG */ -+ gusbcfg.d32 = core_if->gr_backup->gusbcfg_local; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32); -+ -+ if (is_host) { -+ hcfg_data_t hcfg = {.d32 = 0 }; -+ hcfg.d32 = core_if->hr_backup->hcfg_local; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, -+ hcfg.d32); -+ -+ /* Load restore values for [31:14] bits */ -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; -+ -+ if (rmode) -+ pcgcctl.b.restoremode = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ /* Load restore values for [31:14] bits and set EssRegRestored bit */ -+ pcgcctl.d32 = gr->pcgcctl_local | 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.b.ess_reg_restored = 1; -+ if (rmode) -+ pcgcctl.b.restoremode = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ } else { -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ dcfg.d32 = core_if->dr_backup->dcfg; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ /* Load restore values for [31:14] bits */ -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; -+ if (!rmode) { -+ pcgcctl.d32 |= 0x208; -+ } -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ /* Load restore values for [31:14] bits */ -+ pcgcctl.d32 = gr->pcgcctl_local & 0xffffc000; -+ pcgcctl.d32 = gr->pcgcctl_local | 0x00020000; -+ pcgcctl.b.ess_reg_restored = 1; -+ if (!rmode) -+ pcgcctl.d32 |= 0x208; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ } -+ -+ return 0; -+} -+ -+/** -+ * Initializes the FSLSPClkSel field of the HCFG register depending on the PHY -+ * type. -+ */ -+static void init_fslspclksel(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t val; -+ hcfg_data_t hcfg; -+ -+ if (((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls)) || -+ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { -+ /* Full speed PHY */ -+ val = DWC_HCFG_48_MHZ; -+ } else { -+ /* High speed PHY running at full speed or high speed */ -+ val = DWC_HCFG_30_60_MHZ; -+ } -+ -+ DWC_DEBUGPL(DBG_CIL, "Initializing HCFG.FSLSPClkSel to 0x%1x\n", val); -+ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ hcfg.b.fslspclksel = val; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+} -+ -+/** -+ * Initializes the DevSpd field of the DCFG register depending on the PHY type -+ * and the enumeration speed of the device. -+ */ -+static void init_devspd(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t val; -+ dcfg_data_t dcfg; -+ -+ if (((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls)) || -+ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { -+ /* Full speed PHY */ -+ val = 0x3; -+ } else if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { -+ /* High speed PHY running at full speed */ -+ val = 0x1; -+ } else { -+ /* High speed PHY running at high speed */ -+ val = 0x0; -+ } -+ -+ DWC_DEBUGPL(DBG_CIL, "Initializing DCFG.DevSpd to 0x%1x\n", val); -+ -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.b.devspd = val; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); -+} -+ -+/** -+ * This function calculates the number of IN EPS -+ * using GHWCFG1 and GHWCFG2 registers values -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ */ -+static uint32_t calc_num_in_eps(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t num_in_eps = 0; -+ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; -+ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; -+ uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; -+ int i; -+ -+ for (i = 0; i < num_eps; ++i) { -+ if (!(hwcfg1 & 0x1)) -+ num_in_eps++; -+ -+ hwcfg1 >>= 2; -+ } -+ -+ if (core_if->hwcfg4.b.ded_fifo_en) { -+ num_in_eps = -+ (num_in_eps > num_tx_fifos) ? num_tx_fifos : num_in_eps; -+ } -+ -+ return num_in_eps; -+} -+ -+/** -+ * This function calculates the number of OUT EPS -+ * using GHWCFG1 and GHWCFG2 registers values -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ */ -+static uint32_t calc_num_out_eps(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t num_out_eps = 0; -+ uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; -+ uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 2; -+ int i; -+ -+ for (i = 0; i < num_eps; ++i) { -+ if (!(hwcfg1 & 0x1)) -+ num_out_eps++; -+ -+ hwcfg1 >>= 2; -+ } -+ return num_out_eps; -+} -+ -+/** -+ * This function initializes the DWC_otg controller registers and -+ * prepares the core for device mode or host mode operation. -+ * -+ * @param core_if Programming view of the DWC_otg controller -+ * -+ */ -+void dwc_otg_core_init(dwc_otg_core_if_t * core_if) -+{ -+ int i = 0; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ gahbcfg_data_t ahbcfg = {.d32 = 0 }; -+ gusbcfg_data_t usbcfg = {.d32 = 0 }; -+ gi2cctl_data_t i2cctl = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CILV, "dwc_otg_core_init(%p) regs at %p\n", -+ core_if, global_regs); -+ -+ /* Common Initialization */ -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ -+ /* Program the ULPI External VBUS bit if needed */ -+ usbcfg.b.ulpi_ext_vbus_drv = -+ (core_if->core_params->phy_ulpi_ext_vbus == -+ DWC_PHY_ULPI_EXTERNAL_VBUS) ? 1 : 0; -+ -+ /* Set external TS Dline pulsing */ -+ usbcfg.b.term_sel_dl_pulse = -+ (core_if->core_params->ts_dline == 1) ? 1 : 0; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+ /* Reset the Controller */ -+ dwc_otg_core_reset(core_if); -+ -+ core_if->adp_enable = core_if->core_params->adp_supp_enable; -+ core_if->power_down = core_if->core_params->power_down; -+ core_if->otg_sts = 0; -+ -+ /* Initialize parameters from Hardware configuration registers. */ -+ dev_if->num_in_eps = calc_num_in_eps(core_if); -+ dev_if->num_out_eps = calc_num_out_eps(core_if); -+ -+ DWC_DEBUGPL(DBG_CIL, "num_dev_perio_in_ep=%d\n", -+ core_if->hwcfg4.b.num_dev_perio_in_ep); -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { -+ dev_if->perio_tx_fifo_size[i] = -+ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; -+ DWC_DEBUGPL(DBG_CIL, "Periodic Tx FIFO SZ #%d=0x%0x\n", -+ i, dev_if->perio_tx_fifo_size[i]); -+ } -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ dev_if->tx_fifo_size[i] = -+ DWC_READ_REG32(&global_regs->dtxfsiz[i]) >> 16; -+ DWC_DEBUGPL(DBG_CIL, "Tx FIFO SZ #%d=0x%0x\n", -+ i, dev_if->tx_fifo_size[i]); -+ } -+ -+ core_if->total_fifo_size = core_if->hwcfg3.b.dfifo_depth; -+ core_if->rx_fifo_size = DWC_READ_REG32(&global_regs->grxfsiz); -+ core_if->nperio_tx_fifo_size = -+ DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16; -+ -+ DWC_DEBUGPL(DBG_CIL, "Total FIFO SZ=%d\n", core_if->total_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "Rx FIFO SZ=%d\n", core_if->rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO SZ=%d\n", -+ core_if->nperio_tx_fifo_size); -+ -+ /* This programming sequence needs to happen in FS mode before any other -+ * programming occurs */ -+ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) && -+ (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { -+ /* If FS mode with FS PHY */ -+ -+ /* core_init() is now called on every switch so only call the -+ * following for the first time through. */ -+ if (!core_if->phy_init_done) { -+ core_if->phy_init_done = 1; -+ DWC_DEBUGPL(DBG_CIL, "FS_PHY detected\n"); -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.physel = 1; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+ /* Reset after a PHY select */ -+ dwc_otg_core_reset(core_if); -+ } -+ -+ /* Program DCFG.DevSpd or HCFG.FSLSPclkSel to 48Mhz in FS. Also -+ * do this on HNP Dev/Host mode switches (done in dev_init and -+ * host_init). */ -+ if (dwc_otg_is_host_mode(core_if)) { -+ init_fslspclksel(core_if); -+ } else { -+ init_devspd(core_if); -+ } -+ -+ if (core_if->core_params->i2c_enable) { -+ DWC_DEBUGPL(DBG_CIL, "FS_PHY Enabling I2c\n"); -+ /* Program GUSBCFG.OtgUtmifsSel to I2C */ -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.otgutmifssel = 1; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+ /* Program GI2CCTL.I2CEn */ -+ i2cctl.d32 = DWC_READ_REG32(&global_regs->gi2cctl); -+ i2cctl.b.i2cdevaddr = 1; -+ i2cctl.b.i2cen = 0; -+ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); -+ i2cctl.b.i2cen = 1; -+ DWC_WRITE_REG32(&global_regs->gi2cctl, i2cctl.d32); -+ } -+ -+ } /* endif speed == DWC_SPEED_PARAM_FULL */ -+ else { -+ /* High speed PHY. */ -+ if (!core_if->phy_init_done) { -+ core_if->phy_init_done = 1; -+ /* HS PHY parameters. These parameters are preserved -+ * during soft reset so only program the first time. Do -+ * a soft reset immediately after setting phyif. */ -+ -+ if (core_if->core_params->phy_type == 2) { -+ /* ULPI interface */ -+ usbcfg.b.ulpi_utmi_sel = 1; -+ usbcfg.b.phyif = 0; -+ usbcfg.b.ddrsel = -+ core_if->core_params->phy_ulpi_ddr; -+ } else if (core_if->core_params->phy_type == 1) { -+ /* UTMI+ interface */ -+ usbcfg.b.ulpi_utmi_sel = 0; -+ if (core_if->core_params->phy_utmi_width == 16) { -+ usbcfg.b.phyif = 1; -+ -+ } else { -+ usbcfg.b.phyif = 0; -+ } -+ } else { -+ DWC_ERROR("FS PHY TYPE\n"); -+ } -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ /* Reset after setting the PHY parameters */ -+ dwc_otg_core_reset(core_if); -+ } -+ } -+ -+ if ((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls)) { -+ DWC_DEBUGPL(DBG_CIL, "Setting ULPI FSLS\n"); -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.ulpi_fsls = 1; -+ usbcfg.b.ulpi_clk_sus_m = 1; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ } else { -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ usbcfg.b.ulpi_fsls = 0; -+ usbcfg.b.ulpi_clk_sus_m = 0; -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ } -+ -+ /* Program the GAHBCFG Register. */ -+ switch (core_if->hwcfg2.b.architecture) { -+ -+ case DWC_SLAVE_ONLY_ARCH: -+ DWC_DEBUGPL(DBG_CIL, "Slave Only Mode\n"); -+ ahbcfg.b.nptxfemplvl_txfemplvl = -+ DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; -+ ahbcfg.b.ptxfemplvl = DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; -+ core_if->dma_enable = 0; -+ core_if->dma_desc_enable = 0; -+ break; -+ -+ case DWC_EXT_DMA_ARCH: -+ DWC_DEBUGPL(DBG_CIL, "External DMA Mode\n"); -+ { -+ uint8_t brst_sz = core_if->core_params->dma_burst_size; -+ ahbcfg.b.hburstlen = 0; -+ while (brst_sz > 1) { -+ ahbcfg.b.hburstlen++; -+ brst_sz >>= 1; -+ } -+ } -+ core_if->dma_enable = (core_if->core_params->dma_enable != 0); -+ core_if->dma_desc_enable = -+ (core_if->core_params->dma_desc_enable != 0); -+ break; -+ -+ case DWC_INT_DMA_ARCH: -+ DWC_DEBUGPL(DBG_CIL, "Internal DMA Mode\n"); -+ /* Old value was DWC_GAHBCFG_INT_DMA_BURST_INCR - done for -+ Host mode ISOC in issue fix - vahrama */ -+ /* Broadcom had altered to (1<<3)|(0<<0) - WRESP=1, max 4 beats */ -+ ahbcfg.b.hburstlen = (1<<3)|(0<<0);//DWC_GAHBCFG_INT_DMA_BURST_INCR4; -+ core_if->dma_enable = (core_if->core_params->dma_enable != 0); -+ core_if->dma_desc_enable = -+ (core_if->core_params->dma_desc_enable != 0); -+ break; -+ -+ } -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ DWC_PRINTF("Using Descriptor DMA mode\n"); -+ } else { -+ DWC_PRINTF("Using Buffer DMA mode\n"); -+ -+ } -+ } else { -+ DWC_PRINTF("Using Slave mode\n"); -+ core_if->dma_desc_enable = 0; -+ } -+ -+ if (core_if->core_params->ahb_single) { -+ ahbcfg.b.ahbsingle = 1; -+ } -+ -+ ahbcfg.b.dmaenable = core_if->dma_enable; -+ DWC_WRITE_REG32(&global_regs->gahbcfg, ahbcfg.d32); -+ -+ core_if->en_multiple_tx_fifo = core_if->hwcfg4.b.ded_fifo_en; -+ -+ core_if->pti_enh_enable = core_if->core_params->pti_enable != 0; -+ core_if->multiproc_int_enable = core_if->core_params->mpi_enable; -+ DWC_PRINTF("Periodic Transfer Interrupt Enhancement - %s\n", -+ ((core_if->pti_enh_enable) ? "enabled" : "disabled")); -+ DWC_PRINTF("Multiprocessor Interrupt Enhancement - %s\n", -+ ((core_if->multiproc_int_enable) ? "enabled" : "disabled")); -+ -+ /* -+ * Program the GUSBCFG register. -+ */ -+ usbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ -+ switch (core_if->hwcfg2.b.op_mode) { -+ case DWC_MODE_HNP_SRP_CAPABLE: -+ usbcfg.b.hnpcap = (core_if->core_params->otg_cap == -+ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_SRP_ONLY_CAPABLE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_NO_HNP_SRP_CAPABLE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = 0; -+ break; -+ -+ case DWC_MODE_SRP_CAPABLE_DEVICE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_NO_SRP_CAPABLE_DEVICE: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = 0; -+ break; -+ -+ case DWC_MODE_SRP_CAPABLE_HOST: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = (core_if->core_params->otg_cap != -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ break; -+ -+ case DWC_MODE_NO_SRP_CAPABLE_HOST: -+ usbcfg.b.hnpcap = 0; -+ usbcfg.b.srpcap = 0; -+ break; -+ } -+ -+ DWC_WRITE_REG32(&global_regs->gusbcfg, usbcfg.d32); -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (core_if->core_params->lpm_enable) { -+ glpmcfg_data_t lpmcfg = {.d32 = 0 }; -+ -+ /* To enable LPM support set lpm_cap_en bit */ -+ lpmcfg.b.lpm_cap_en = 1; -+ -+ /* Make AppL1Res ACK */ -+ lpmcfg.b.appl_resp = 1; -+ -+ /* Retry 3 times */ -+ lpmcfg.b.retry_count = 3; -+ -+ DWC_MODIFY_REG32(&core_if->core_global_regs->glpmcfg, -+ 0, lpmcfg.d32); -+ -+ } -+#endif -+ if (core_if->core_params->ic_usb_cap) { -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ gusbcfg.b.ic_usb_cap = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gusbcfg, -+ 0, gusbcfg.d32); -+ } -+ { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gotgctl.b.otgver = core_if->core_params->otg_ver; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, 0, -+ gotgctl.d32); -+ /* Set OTG version supported */ -+ core_if->otg_ver = core_if->core_params->otg_ver; -+ DWC_PRINTF("OTG VER PARAM: %d, OTG VER FLAG: %d\n", -+ core_if->core_params->otg_ver, core_if->otg_ver); -+ } -+ -+ -+ /* Enable common interrupts */ -+ dwc_otg_enable_common_interrupts(core_if); -+ -+ /* Do device or host intialization based on mode during PCD -+ * and HCD initialization */ -+ if (dwc_otg_is_host_mode(core_if)) { -+ DWC_DEBUGPL(DBG_ANY, "Host Mode\n"); -+ core_if->op_state = A_HOST; -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "Device Mode\n"); -+ core_if->op_state = B_PERIPHERAL; -+#ifdef DWC_DEVICE_ONLY -+ dwc_otg_core_dev_init(core_if); -+#endif -+ } -+} -+ -+/** -+ * This function enables the Device mode interrupts. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ -+ DWC_DEBUGPL(DBG_CIL, "%s()\n", __func__); -+ -+ /* Disable all interrupts. */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* Clear any pending interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Enable the common interrupts */ -+ dwc_otg_enable_common_interrupts(core_if); -+ -+ /* Enable interrupts */ -+ intr_mask.b.usbreset = 1; -+ intr_mask.b.enumdone = 1; -+ /* Disable Disconnect interrupt in Device mode */ -+ intr_mask.b.disconnect = 0; -+ -+ if (!core_if->multiproc_int_enable) { -+ intr_mask.b.inepintr = 1; -+ intr_mask.b.outepintr = 1; -+ } -+ -+ intr_mask.b.erlysuspend = 1; -+ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.epmismatch = 1; -+ } -+ -+ //intr_mask.b.incomplisoout = 1; -+ intr_mask.b.incomplisoin = 1; -+ -+/* Enable the ignore frame number for ISOC xfers - MAS */ -+/* Disable to support high bandwith ISOC transfers - manukz */ -+#if 0 -+#ifdef DWC_UTE_PER_IO -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ dctl_data_t dctl1 = {.d32 = 0 }; -+ dctl1.b.ifrmnum = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, 0, dctl1.d32); -+ DWC_DEBUG("----Enabled Ignore frame number (0x%08x)", -+ DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dctl)); -+ } -+ } -+#endif -+#endif -+#ifdef DWC_EN_ISOC -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ if (core_if->pti_enh_enable) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.ifrmnum = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dctl, -+ 0, dctl.d32); -+ } else { -+ intr_mask.b.incomplisoin = 1; -+ intr_mask.b.incomplisoout = 1; -+ } -+ } -+ } else { -+ intr_mask.b.incomplisoin = 1; -+ intr_mask.b.incomplisoout = 1; -+ } -+#endif /* DWC_EN_ISOC */ -+ -+ /** @todo NGS: Should this be a module parameter? */ -+#ifdef USE_PERIODIC_EP -+ intr_mask.b.isooutdrop = 1; -+ intr_mask.b.eopframe = 1; -+ intr_mask.b.incomplisoin = 1; -+ intr_mask.b.incomplisoout = 1; -+#endif -+ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, "%s() gintmsk=%0x\n", __func__, -+ DWC_READ_REG32(&global_regs->gintmsk)); -+} -+ -+/** -+ * This function initializes the DWC_otg controller registers for -+ * device mode. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ */ -+void dwc_otg_core_dev_init(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ depctl_data_t diepctl = {.d32 = 0 }; -+ grstctl_t resetctl = {.d32 = 0 }; -+ uint32_t rx_fifo_size; -+ fifosize_data_t nptxfifosize; -+ fifosize_data_t txfifosize; -+ dthrctl_data_t dthrctl; -+ fifosize_data_t ptxfifosize; -+ uint16_t rxfsiz, nptxfsiz; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ hwcfg3_data_t hwcfg3 = {.d32 = 0 }; -+ -+ /* Restart the Phy Clock */ -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ -+ /* Device configuration register */ -+ init_devspd(core_if); -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.descdma = (core_if->dma_desc_enable) ? 1 : 0; -+ dcfg.b.perfrint = DWC_DCFG_FRAME_INTERVAL_80; -+ /* Enable Device OUT NAK in case of DDMA mode*/ -+ if (core_if->core_params->dev_out_nak) { -+ dcfg.b.endevoutnak = 1; -+ } -+ -+ if (core_if->core_params->cont_on_bna) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.encontonbna = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } -+ -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ /* Configure data FIFO sizes */ -+ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { -+ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", -+ core_if->total_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", -+ params->dev_rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", -+ params->dev_nperio_tx_fifo_size); -+ -+ /* Rx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ -+#ifdef DWC_UTE_CFI -+ core_if->pwron_rxfsiz = DWC_READ_REG32(&global_regs->grxfsiz); -+ core_if->init_rxfsiz = params->dev_rx_fifo_size; -+#endif -+ rx_fifo_size = params->dev_rx_fifo_size; -+ DWC_WRITE_REG32(&global_regs->grxfsiz, rx_fifo_size); -+ -+ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ -+ /** Set Periodic Tx FIFO Mask all bits 0 */ -+ core_if->p_tx_msk = 0; -+ -+ /** Set Tx FIFO Mask all bits 0 */ -+ core_if->tx_msk = 0; -+ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ /* Non-periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; -+ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; -+ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, -+ nptxfifosize.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ /**@todo NGS: Fix Periodic FIFO Sizing! */ -+ /* -+ * Periodic Tx FIFOs These FIFOs are numbered from 1 to 15. -+ * Indexes of the FIFO size module parameters in the -+ * dev_perio_tx_fifo_size array and the FIFO size registers in -+ * the dptxfsiz array run from 0 to 14. -+ */ -+ /** @todo Finish debug of this */ -+ ptxfifosize.b.startaddr = -+ nptxfifosize.b.startaddr + nptxfifosize.b.depth; -+ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++) { -+ ptxfifosize.b.depth = -+ params->dev_perio_tx_fifo_size[i]; -+ DWC_DEBUGPL(DBG_CIL, -+ "initial dtxfsiz[%d]=%08x\n", i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ ptxfifosize.d32); -+ DWC_DEBUGPL(DBG_CIL, "new dtxfsiz[%d]=%08x\n", -+ i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ ptxfifosize.b.startaddr += ptxfifosize.b.depth; -+ } -+ } else { -+ /* -+ * Tx FIFOs These FIFOs are numbered from 1 to 15. -+ * Indexes of the FIFO size module parameters in the -+ * dev_tx_fifo_size array and the FIFO size registers in -+ * the dtxfsiz array run from 0 to 14. -+ */ -+ -+ /* Non-periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+#ifdef DWC_UTE_CFI -+ core_if->pwron_gnptxfsiz = -+ (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); -+ core_if->init_gnptxfsiz = -+ params->dev_nperio_tx_fifo_size; -+#endif -+ nptxfifosize.b.depth = params->dev_nperio_tx_fifo_size; -+ nptxfifosize.b.startaddr = params->dev_rx_fifo_size; -+ -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, -+ nptxfifosize.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ txfifosize.b.startaddr = -+ nptxfifosize.b.startaddr + nptxfifosize.b.depth; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; i++) { -+ -+ txfifosize.b.depth = -+ params->dev_tx_fifo_size[i]; -+ -+ DWC_DEBUGPL(DBG_CIL, -+ "initial dtxfsiz[%d]=%08x\n", -+ i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ -+#ifdef DWC_UTE_CFI -+ core_if->pwron_txfsiz[i] = -+ (DWC_READ_REG32 -+ (&global_regs->dtxfsiz[i]) >> 16); -+ core_if->init_txfsiz[i] = -+ params->dev_tx_fifo_size[i]; -+#endif -+ DWC_WRITE_REG32(&global_regs->dtxfsiz[i], -+ txfifosize.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, -+ "new dtxfsiz[%d]=%08x\n", -+ i, -+ DWC_READ_REG32(&global_regs->dtxfsiz -+ [i])); -+ -+ txfifosize.b.startaddr += txfifosize.b.depth; -+ } -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ /* Calculating DFIFOCFG for Device mode to include RxFIFO and NPTXFIFO */ -+ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); -+ hwcfg3.d32 = DWC_READ_REG32(&global_regs->ghwcfg3); -+ gdfifocfg.b.gdfifocfg = (DWC_READ_REG32(&global_regs->ghwcfg3) >> 16); -+ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); -+ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); -+ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); -+ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz; -+ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); -+ } -+ } -+ -+ /* Flush the FIFOs */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ -+ dwc_otg_flush_rx_fifo(core_if); -+ -+ /* Flush the Learning Queue. */ -+ resetctl.b.intknqflsh = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { -+ core_if->start_predict = 0; -+ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { -+ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active -+ } -+ core_if->nextep_seq[0] = 0; -+ core_if->first_in_nextep_seq = 0; -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); -+ diepctl.b.nextep = 0; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); -+ -+ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt = 2; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_CILV,"%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_CILV, "%2d ", core_if->nextep_seq[i]); -+ } -+ DWC_DEBUGPL(DBG_CILV,"\n"); -+ } -+ -+ /* Clear all pending Device Interrupts */ -+ /** @todo - if the condition needed to be checked -+ * or in any case all pending interrutps should be cleared? -+ */ -+ if (core_if->multiproc_int_enable) { -+ for (i = 0; i < core_if->dev_if->num_in_eps; ++i) { -+ DWC_WRITE_REG32(&dev_if-> -+ dev_global_regs->diepeachintmsk[i], 0); -+ } -+ } -+ -+ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { -+ DWC_WRITE_REG32(&dev_if-> -+ dev_global_regs->doepeachintmsk[i], 0); -+ } -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachint, 0xFFFFFFFF); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, 0); -+ } else { -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, 0); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, 0); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->daint, 0xFFFFFFFF); -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, 0); -+ } -+ -+ for (i = 0; i <= dev_if->num_in_eps; i++) { -+ depctl_data_t depctl; -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (depctl.b.epena) { -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ } else { -+ depctl.d32 = 0; -+ } -+ -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); -+ -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, 0); -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, 0); -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepint, 0xFF); -+ } -+ -+ for (i = 0; i <= dev_if->num_out_eps; i++) { -+ depctl_data_t depctl; -+ depctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); -+ if (depctl.b.epena) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ gintmsk_data_t gintsts = {.d32 = 0 }; -+ doepint_data_t doepint = {.d32 = 0 }; -+ dctl.b.sgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ do { -+ dwc_udelay(10); -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ } while (!gintsts.b.goutnakeff); -+ gintsts.d32 = 0; -+ gintsts.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepctl, depctl.d32); -+ do { -+ dwc_udelay(10); -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[i]->doepint); -+ } while (!doepint.b.epdisabled); -+ -+ doepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[i]->doepint, doepint.d32); -+ -+ dctl.d32 = 0; -+ dctl.b.cgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } else { -+ depctl.d32 = 0; -+ } -+ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, depctl.d32); -+ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doeptsiz, 0); -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepdma, 0); -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepint, 0xFF); -+ } -+ -+ if (core_if->en_multiple_tx_fifo && core_if->dma_enable) { -+ dev_if->non_iso_tx_thr_en = params->thr_ctl & 0x1; -+ dev_if->iso_tx_thr_en = (params->thr_ctl >> 1) & 0x1; -+ dev_if->rx_thr_en = (params->thr_ctl >> 2) & 0x1; -+ -+ dev_if->rx_thr_length = params->rx_thr_length; -+ dev_if->tx_thr_length = params->tx_thr_length; -+ -+ dev_if->setup_desc_index = 0; -+ -+ dthrctl.d32 = 0; -+ dthrctl.b.non_iso_thr_en = dev_if->non_iso_tx_thr_en; -+ dthrctl.b.iso_thr_en = dev_if->iso_tx_thr_en; -+ dthrctl.b.tx_thr_len = dev_if->tx_thr_length; -+ dthrctl.b.rx_thr_en = dev_if->rx_thr_en; -+ dthrctl.b.rx_thr_len = dev_if->rx_thr_length; -+ dthrctl.b.ahb_thr_ratio = params->ahb_thr_ratio; -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dtknqr3_dthrctl, -+ dthrctl.d32); -+ -+ DWC_DEBUGPL(DBG_CIL, -+ "Non ISO Tx Thr - %d\nISO Tx Thr - %d\nRx Thr - %d\nTx Thr Len - %d\nRx Thr Len - %d\n", -+ dthrctl.b.non_iso_thr_en, dthrctl.b.iso_thr_en, -+ dthrctl.b.rx_thr_en, dthrctl.b.tx_thr_len, -+ dthrctl.b.rx_thr_len); -+ -+ } -+ -+ dwc_otg_enable_device_interrupts(core_if); -+ -+ { -+ diepmsk_data_t msk = {.d32 = 0 }; -+ msk.b.txfifoundrn = 1; -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs-> -+ diepeachintmsk[0], msk.d32, msk.d32); -+ } else { -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, -+ msk.d32, msk.d32); -+ } -+ } -+ -+ if (core_if->multiproc_int_enable) { -+ /* Set NAK on Babble */ -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.nakonbble = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } -+ -+ if (core_if->snpsid >= OTG_CORE_REV_2_94a) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dctl); -+ dctl.b.sftdiscon = 0; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, dctl.d32); -+ } -+} -+ -+/** -+ * This function enables the Host mode interrupts. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CIL, "%s(%p)\n", __func__, core_if); -+ -+ /* Disable all interrupts. */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* Clear any pending interrupts. */ -+ DWC_WRITE_REG32(&global_regs->gintsts, 0xFFFFFFFF); -+ -+ /* Enable the common interrupts */ -+ dwc_otg_enable_common_interrupts(core_if); -+ -+ /* -+ * Enable host mode interrupts without disturbing common -+ * interrupts. -+ */ -+ -+ intr_mask.b.disconnect = 1; -+ intr_mask.b.portintr = 1; -+ intr_mask.b.hcintr = 1; -+ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+} -+ -+/** -+ * This function disables the Host Mode interrupts. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s()\n", __func__); -+ -+ /* -+ * Disable host mode interrupts without disturbing common -+ * interrupts. -+ */ -+ intr_mask.b.sofintr = 1; -+ intr_mask.b.portintr = 1; -+ intr_mask.b.hcintr = 1; -+ intr_mask.b.ptxfempty = 1; -+ intr_mask.b.nptxfempty = 1; -+ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, 0); -+} -+ -+/** -+ * This function initializes the DWC_otg controller registers for -+ * host mode. -+ * -+ * This function flushes the Tx and Rx FIFOs and it flushes any entries in the -+ * request queues. Host channels are reset to ensure that they are ready for -+ * performing transfers. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * -+ */ -+void dwc_otg_core_host_init(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_host_if_t *host_if = core_if->host_if; -+ dwc_otg_core_params_t *params = core_if->core_params; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ fifosize_data_t nptxfifosize; -+ fifosize_data_t ptxfifosize; -+ uint16_t rxfsiz, nptxfsiz, hptxfsiz; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ int i; -+ hcchar_data_t hcchar; -+ hcfg_data_t hcfg; -+ hfir_data_t hfir; -+ dwc_otg_hc_regs_t *hc_regs; -+ int num_channels; -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s(%p)\n", __func__, core_if); -+ -+ /* Restart the Phy Clock */ -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ -+ /* Initialize Host Configuration Register */ -+ init_fslspclksel(core_if); -+ if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { -+ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); -+ hcfg.b.fslssupp = 1; -+ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); -+ -+ } -+ -+ /* This bit allows dynamic reloading of the HFIR register -+ * during runtime. This bit needs to be programmed during -+ * initial configuration and its value must not be changed -+ * during runtime.*/ -+ if (core_if->core_params->reload_ctl == 1) { -+ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); -+ hfir.b.hfirrldctrl = 1; -+ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); -+ } -+ -+ if (core_if->core_params->dma_desc_enable) { -+ uint8_t op_mode = core_if->hwcfg2.b.op_mode; -+ if (! -+ (core_if->hwcfg4.b.desc_dma -+ && (core_if->snpsid >= OTG_CORE_REV_2_90a) -+ && ((op_mode == DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) -+ || (op_mode == -+ DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG) -+ || (op_mode == DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST) -+ || (op_mode == -+ DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST)))) { -+ -+ DWC_ERROR("Host can't operate in Descriptor DMA mode.\n" -+ "Either core version is below 2.90a or " -+ "GHWCFG2, GHWCFG4 registers' values do not allow Descriptor DMA in host mode.\n" -+ "To run the driver in Buffer DMA host mode set dma_desc_enable " -+ "module parameter to 0.\n"); -+ return; -+ } -+ hcfg.d32 = DWC_READ_REG32(&host_if->host_global_regs->hcfg); -+ hcfg.b.descdma = 1; -+ DWC_WRITE_REG32(&host_if->host_global_regs->hcfg, hcfg.d32); -+ } -+ -+ /* Configure data FIFO sizes */ -+ if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { -+ DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", -+ core_if->total_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", -+ params->host_rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", -+ params->host_nperio_tx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "P Tx FIFO Size=%d\n", -+ params->host_perio_tx_fifo_size); -+ -+ /* Rx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ DWC_WRITE_REG32(&global_regs->grxfsiz, -+ params->host_rx_fifo_size); -+ DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->grxfsiz)); -+ -+ /* Non-periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ nptxfifosize.b.depth = params->host_nperio_tx_fifo_size; -+ nptxfifosize.b.startaddr = params->host_rx_fifo_size; -+ DWC_WRITE_REG32(&global_regs->gnptxfsiz, nptxfifosize.d32); -+ DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxfsiz)); -+ -+ /* Periodic Tx FIFO */ -+ DWC_DEBUGPL(DBG_CIL, "initial hptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->hptxfsiz)); -+ ptxfifosize.b.depth = params->host_perio_tx_fifo_size; -+ ptxfifosize.b.startaddr = -+ nptxfifosize.b.startaddr + nptxfifosize.b.depth; -+ DWC_WRITE_REG32(&global_regs->hptxfsiz, ptxfifosize.d32); -+ DWC_DEBUGPL(DBG_CIL, "new hptxfsiz=%08x\n", -+ DWC_READ_REG32(&global_regs->hptxfsiz)); -+ -+ if (core_if->en_multiple_tx_fifo -+ && core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ /* Global DFIFOCFG calculation for Host mode - include RxFIFO, NPTXFIFO and HPTXFIFO */ -+ gdfifocfg.d32 = DWC_READ_REG32(&global_regs->gdfifocfg); -+ rxfsiz = (DWC_READ_REG32(&global_regs->grxfsiz) & 0x0000ffff); -+ nptxfsiz = (DWC_READ_REG32(&global_regs->gnptxfsiz) >> 16); -+ hptxfsiz = (DWC_READ_REG32(&global_regs->hptxfsiz) >> 16); -+ gdfifocfg.b.epinfobase = rxfsiz + nptxfsiz + hptxfsiz; -+ DWC_WRITE_REG32(&global_regs->gdfifocfg, gdfifocfg.d32); -+ } -+ } -+ -+ /* TODO - check this */ -+ /* Clear Host Set HNP Enable in the OTG Control Register */ -+ gotgctl.b.hstsethnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ /* Make sure the FIFOs are flushed. */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10 /* all TX FIFOs */ ); -+ dwc_otg_flush_rx_fifo(core_if); -+ -+ /* Clear Host Set HNP Enable in the OTG Control Register */ -+ gotgctl.b.hstsethnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ -+ if (!core_if->core_params->dma_desc_enable) { -+ /* Flush out any leftover queued requests. */ -+ num_channels = core_if->core_params->host_channels; -+ -+ for (i = 0; i < num_channels; i++) { -+ hc_regs = core_if->host_if->hc_regs[i]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.chen = 0; -+ hcchar.b.chdis = 1; -+ hcchar.b.epdir = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ } -+ -+ /* Halt all channels to put them into a known state. */ -+ for (i = 0; i < num_channels; i++) { -+ int count = 0; -+ hc_regs = core_if->host_if->hc_regs[i]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 1; -+ hcchar.b.epdir = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ DWC_DEBUGPL(DBG_HCDV, "%s: Halt channel %d regs %p\n", __func__, i, hc_regs); -+ do { -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (++count > 1000) { -+ DWC_ERROR -+ ("%s: Unable to clear halt on channel %d (timeout HCCHAR 0x%X @%p)\n", -+ __func__, i, hcchar.d32, &hc_regs->hcchar); -+ break; -+ } -+ dwc_udelay(1); -+ } while (hcchar.b.chen); -+ } -+ } -+ -+ /* Turn on the vbus power. */ -+ DWC_PRINTF("Init: Port Power? op_state=%d\n", core_if->op_state); -+ if (core_if->op_state == A_HOST) { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ DWC_PRINTF("Init: Power Port (%d)\n", hprt0.b.prtpwr); -+ if (hprt0.b.prtpwr == 0) { -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(host_if->hprt0, hprt0.d32); -+ } -+ } -+ -+ dwc_otg_enable_host_interrupts(core_if); -+} -+ -+/** -+ * Prepares a host channel for transferring packets to/from a specific -+ * endpoint. The HCCHARn register is set up with the characteristics specified -+ * in _hc. Host channel interrupts that may need to be serviced while this -+ * transfer is in progress are enabled. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ * @param hc Information needed to initialize the host channel -+ */ -+void dwc_otg_hc_init(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ hcintmsk_data_t hc_intr_mask; -+ hcchar_data_t hcchar; -+ hcsplt_data_t hcsplt; -+ -+ uint8_t hc_num = hc->hc_num; -+ dwc_otg_host_if_t *host_if = core_if->host_if; -+ dwc_otg_hc_regs_t *hc_regs = host_if->hc_regs[hc_num]; -+ -+ /* Clear old interrupt conditions for this host channel. */ -+ hc_intr_mask.d32 = 0xFFFFFFFF; -+ hc_intr_mask.b.reserved14_31 = 0; -+ DWC_WRITE_REG32(&hc_regs->hcint, hc_intr_mask.d32); -+ -+ /* Enable channel interrupts required for this transfer. */ -+ hc_intr_mask.d32 = 0; -+ hc_intr_mask.b.chhltd = 1; -+ if (core_if->dma_enable) { -+ /* For Descriptor DMA mode core halts the channel on AHB error. Interrupt is not required */ -+ if (!core_if->dma_desc_enable) -+ hc_intr_mask.b.ahberr = 1; -+ else { -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ hc_intr_mask.b.xfercompl = 1; -+ } -+ -+ if (hc->error_state && !hc->do_split && -+ hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { -+ hc_intr_mask.b.ack = 1; -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.datatglerr = 1; -+ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { -+ hc_intr_mask.b.nak = 1; -+ } -+ } -+ } -+ } else { -+ switch (hc->ep_type) { -+ case DWC_OTG_EP_TYPE_CONTROL: -+ case DWC_OTG_EP_TYPE_BULK: -+ hc_intr_mask.b.xfercompl = 1; -+ hc_intr_mask.b.stall = 1; -+ hc_intr_mask.b.xacterr = 1; -+ hc_intr_mask.b.datatglerr = 1; -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.bblerr = 1; -+ } else { -+ hc_intr_mask.b.nak = 1; -+ hc_intr_mask.b.nyet = 1; -+ if (hc->do_ping) { -+ hc_intr_mask.b.ack = 1; -+ } -+ } -+ -+ if (hc->do_split) { -+ hc_intr_mask.b.nak = 1; -+ if (hc->complete_split) { -+ hc_intr_mask.b.nyet = 1; -+ } else { -+ hc_intr_mask.b.ack = 1; -+ } -+ } -+ -+ if (hc->error_state) { -+ hc_intr_mask.b.ack = 1; -+ } -+ break; -+ case DWC_OTG_EP_TYPE_INTR: -+ hc_intr_mask.b.xfercompl = 1; -+ hc_intr_mask.b.nak = 1; -+ hc_intr_mask.b.stall = 1; -+ hc_intr_mask.b.xacterr = 1; -+ hc_intr_mask.b.datatglerr = 1; -+ hc_intr_mask.b.frmovrun = 1; -+ -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.bblerr = 1; -+ } -+ if (hc->error_state) { -+ hc_intr_mask.b.ack = 1; -+ } -+ if (hc->do_split) { -+ if (hc->complete_split) { -+ hc_intr_mask.b.nyet = 1; -+ } else { -+ hc_intr_mask.b.ack = 1; -+ } -+ } -+ break; -+ case DWC_OTG_EP_TYPE_ISOC: -+ hc_intr_mask.b.xfercompl = 1; -+ hc_intr_mask.b.frmovrun = 1; -+ hc_intr_mask.b.ack = 1; -+ -+ if (hc->ep_is_in) { -+ hc_intr_mask.b.xacterr = 1; -+ hc_intr_mask.b.bblerr = 1; -+ } -+ break; -+ } -+ } -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, hc_intr_mask.d32); -+ -+ /* -+ * Program the HCCHARn register with the endpoint characteristics for -+ * the current transfer. -+ */ -+ hcchar.d32 = 0; -+ hcchar.b.devaddr = hc->dev_addr; -+ hcchar.b.epnum = hc->ep_num; -+ hcchar.b.epdir = hc->ep_is_in; -+ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); -+ hcchar.b.eptype = hc->ep_type; -+ hcchar.b.mps = hc->max_packet; -+ -+ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcchar, hcchar.d32); -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d, Dev Addr %d, EP #%d\n", -+ __func__, hc->hc_num, hcchar.b.devaddr, hcchar.b.epnum); -+ DWC_DEBUGPL(DBG_HCDV, " Is In %d, Is Low Speed %d, EP Type %d, " -+ "Max Pkt %d, Multi Cnt %d\n", -+ hcchar.b.epdir, hcchar.b.lspddev, hcchar.b.eptype, -+ hcchar.b.mps, hcchar.b.multicnt); -+ -+ /* -+ * Program the HCSPLIT register for SPLITs -+ */ -+ hcsplt.d32 = 0; -+ if (hc->do_split) { -+ DWC_DEBUGPL(DBG_HCDV, "Programming HC %d with split --> %s\n", -+ hc->hc_num, -+ hc->complete_split ? "CSPLIT" : "SSPLIT"); -+ hcsplt.b.compsplt = hc->complete_split; -+ hcsplt.b.xactpos = hc->xact_pos; -+ hcsplt.b.hubaddr = hc->hub_addr; -+ hcsplt.b.prtaddr = hc->port_addr; -+ DWC_DEBUGPL(DBG_HCDV, "\t comp split %d\n", hc->complete_split); -+ DWC_DEBUGPL(DBG_HCDV, "\t xact pos %d\n", hc->xact_pos); -+ DWC_DEBUGPL(DBG_HCDV, "\t hub addr %d\n", hc->hub_addr); -+ DWC_DEBUGPL(DBG_HCDV, "\t port addr %d\n", hc->port_addr); -+ DWC_DEBUGPL(DBG_HCDV, "\t is_in %d\n", hc->ep_is_in); -+ DWC_DEBUGPL(DBG_HCDV, "\t Max Pkt: %d\n", hcchar.b.mps); -+ DWC_DEBUGPL(DBG_HCDV, "\t xferlen: %d\n", hc->xfer_len); -+ } -+ DWC_WRITE_REG32(&host_if->hc_regs[hc_num]->hcsplt, hcsplt.d32); -+ -+} -+ -+/** -+ * Attempts to halt a host channel. This function should only be called in -+ * Slave mode or to abort a transfer in either Slave mode or DMA mode. Under -+ * normal circumstances in DMA mode, the controller halts the channel when the -+ * transfer is complete or a condition occurs that requires application -+ * intervention. -+ * -+ * In slave mode, checks for a free request queue entry, then sets the Channel -+ * Enable and Channel Disable bits of the Host Channel Characteristics -+ * register of the specified channel to intiate the halt. If there is no free -+ * request queue entry, sets only the Channel Disable bit of the HCCHARn -+ * register to flush requests for this channel. In the latter case, sets a -+ * flag to indicate that the host channel needs to be halted when a request -+ * queue slot is open. -+ * -+ * In DMA mode, always sets the Channel Enable and Channel Disable bits of the -+ * HCCHARn register. The controller ensures there is space in the request -+ * queue before submitting the halt request. -+ * -+ * Some time may elapse before the core flushes any posted requests for this -+ * host channel and halts. The Channel Halted interrupt handler completes the -+ * deactivation of the host channel. -+ * -+ * @param core_if Controller register interface. -+ * @param hc Host channel to halt. -+ * @param halt_status Reason for halting the channel. -+ */ -+void dwc_otg_hc_halt(dwc_otg_core_if_t * core_if, -+ dwc_hc_t * hc, dwc_otg_halt_status_e halt_status) -+{ -+ gnptxsts_data_t nptxsts; -+ hptxsts_data_t hptxsts; -+ hcchar_data_t hcchar; -+ dwc_otg_hc_regs_t *hc_regs; -+ dwc_otg_core_global_regs_t *global_regs; -+ dwc_otg_host_global_regs_t *host_global_regs; -+ -+ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ global_regs = core_if->core_global_regs; -+ host_global_regs = core_if->host_if->host_global_regs; -+ -+ DWC_ASSERT(!(halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS), -+ "halt_status = %d\n", halt_status); -+ -+ if (halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || -+ halt_status == DWC_OTG_HC_XFER_AHB_ERR) { -+ /* -+ * Disable all channel interrupts except Ch Halted. The QTD -+ * and QH state associated with this transfer has been cleared -+ * (in the case of URB_DEQUEUE), so the channel needs to be -+ * shut down carefully to prevent crashes. -+ */ -+ hcintmsk_data_t hcintmsk; -+ hcintmsk.d32 = 0; -+ hcintmsk.b.chhltd = 1; -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, hcintmsk.d32); -+ -+ /* -+ * Make sure no other interrupts besides halt are currently -+ * pending. Handling another interrupt could cause a crash due -+ * to the QTD and QH state. -+ */ -+ DWC_WRITE_REG32(&hc_regs->hcint, ~hcintmsk.d32); -+ -+ /* -+ * Make sure the halt status is set to URB_DEQUEUE or AHB_ERR -+ * even if the channel was already halted for some other -+ * reason. -+ */ -+ hc->halt_status = halt_status; -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen == 0) { -+ /* -+ * The channel is either already halted or it hasn't -+ * started yet. In DMA mode, the transfer may halt if -+ * it finishes normally or a condition occurs that -+ * requires driver intervention. Don't want to halt -+ * the channel again. In either Slave or DMA mode, -+ * it's possible that the transfer has been assigned -+ * to a channel, but not started yet when an URB is -+ * dequeued. Don't want to halt a channel that hasn't -+ * started yet. -+ */ -+ return; -+ } -+ } -+ if (hc->halt_pending) { -+ /* -+ * A halt has already been issued for this channel. This might -+ * happen when a transfer is aborted by a higher level in -+ * the stack. -+ */ -+#ifdef DEBUG -+ DWC_PRINTF -+ ("*** %s: Channel %d, _hc->halt_pending already set ***\n", -+ __func__, hc->hc_num); -+ -+#endif -+ return; -+ } -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* No need to set the bit in DDMA for disabling the channel */ -+ //TODO check it everywhere channel is disabled -+ if (!core_if->core_params->dma_desc_enable) -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 1; -+ -+ if (!core_if->dma_enable) { -+ /* Check for space in the request queue to issue the halt. */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || -+ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { -+ nptxsts.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ if (nptxsts.b.nptxqspcavail == 0) { -+ hcchar.b.chen = 0; -+ } -+ } else { -+ hptxsts.d32 = -+ DWC_READ_REG32(&host_global_regs->hptxsts); -+ if ((hptxsts.b.ptxqspcavail == 0) -+ || (core_if->queuing_high_bandwidth)) { -+ hcchar.b.chen = 0; -+ } -+ } -+ } -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ hc->halt_status = halt_status; -+ -+ if (hcchar.b.chen) { -+ hc->halt_pending = 1; -+ hc->halt_on_queue = 0; -+ } else { -+ hc->halt_on_queue = 1; -+ } -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " hcchar: 0x%08x\n", hcchar.d32); -+ DWC_DEBUGPL(DBG_HCDV, " halt_pending: %d\n", hc->halt_pending); -+ DWC_DEBUGPL(DBG_HCDV, " halt_on_queue: %d\n", hc->halt_on_queue); -+ DWC_DEBUGPL(DBG_HCDV, " halt_status: %d\n", hc->halt_status); -+ -+ return; -+} -+ -+/** -+ * Clears the transfer state for a host channel. This function is normally -+ * called after a transfer is done and the host channel is being released. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Identifies the host channel to clean up. -+ */ -+void dwc_otg_hc_cleanup(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ dwc_otg_hc_regs_t *hc_regs; -+ -+ hc->xfer_started = 0; -+ -+ /* -+ * Clear channel interrupt enables and any unhandled channel interrupt -+ * conditions. -+ */ -+ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0); -+ DWC_WRITE_REG32(&hc_regs->hcint, 0xFFFFFFFF); -+#ifdef DEBUG -+ DWC_TIMER_CANCEL(core_if->hc_xfer_timer[hc->hc_num]); -+#endif -+} -+ -+/** -+ * Sets the channel property that indicates in which frame a periodic transfer -+ * should occur. This is always set to the _next_ frame. This function has no -+ * effect on non-periodic transfers. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Identifies the host channel to set up and its properties. -+ * @param hcchar Current value of the HCCHAR register for the specified host -+ * channel. -+ */ -+static inline void hc_set_even_odd_frame(dwc_otg_core_if_t * core_if, -+ dwc_hc_t * hc, hcchar_data_t * hcchar) -+{ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ hfnum_data_t hfnum; -+ hfnum.d32 = -+ DWC_READ_REG32(&core_if->host_if->host_global_regs->hfnum); -+ -+ /* 1 if _next_ frame is odd, 0 if it's even */ -+ hcchar->b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; -+#ifdef DEBUG -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR && hc->do_split -+ && !hc->complete_split) { -+ switch (hfnum.b.frnum & 0x7) { -+ case 7: -+ core_if->hfnum_7_samples++; -+ core_if->hfnum_7_frrem_accum += hfnum.b.frrem; -+ break; -+ case 0: -+ core_if->hfnum_0_samples++; -+ core_if->hfnum_0_frrem_accum += hfnum.b.frrem; -+ break; -+ default: -+ core_if->hfnum_other_samples++; -+ core_if->hfnum_other_frrem_accum += -+ hfnum.b.frrem; -+ break; -+ } -+ } -+#endif -+ } -+} -+ -+#ifdef DEBUG -+void hc_xfer_timeout(void *ptr) -+{ -+ hc_xfer_info_t *xfer_info = NULL; -+ int hc_num = 0; -+ -+ if (ptr) -+ xfer_info = (hc_xfer_info_t *) ptr; -+ -+ if (!xfer_info->hc) { -+ DWC_ERROR("xfer_info->hc = %p\n", xfer_info->hc); -+ return; -+ } -+ -+ hc_num = xfer_info->hc->hc_num; -+ DWC_WARN("%s: timeout on channel %d\n", __func__, hc_num); -+ DWC_WARN(" start_hcchar_val 0x%08x\n", -+ xfer_info->core_if->start_hcchar_val[hc_num]); -+} -+#endif -+ -+void ep_xfer_timeout(void *ptr) -+{ -+ ep_xfer_info_t *xfer_info = NULL; -+ int ep_num = 0; -+ dctl_data_t dctl = {.d32 = 0 }; -+ gintsts_data_t gintsts = {.d32 = 0 }; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ if (ptr) -+ xfer_info = (ep_xfer_info_t *) ptr; -+ -+ if (!xfer_info->ep) { -+ DWC_ERROR("xfer_info->ep = %p\n", xfer_info->ep); -+ return; -+ } -+ -+ ep_num = xfer_info->ep->num; -+ DWC_WARN("%s: timeout on endpoit %d\n", __func__, ep_num); -+ /* Put the sate to 2 as it was time outed */ -+ xfer_info->state = 2; -+ -+ dctl.d32 = -+ DWC_READ_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl); -+ gintsts.d32 = -+ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintsts); -+ gintmsk.d32 = -+ DWC_READ_REG32(&xfer_info->core_if->core_global_regs->gintmsk); -+ -+ if (!gintmsk.b.goutnakeff) { -+ /* Unmask it */ -+ gintmsk.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&xfer_info->core_if->core_global_regs->gintmsk, -+ gintmsk.d32); -+ -+ } -+ -+ if (!gintsts.b.goutnakeff) { -+ dctl.b.sgoutnak = 1; -+ } -+ DWC_WRITE_REG32(&xfer_info->core_if->dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ -+} -+ -+void set_pid_isoc(dwc_hc_t * hc) -+{ -+ /* Set up the initial PID for the transfer. */ -+ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) { -+ if (hc->ep_is_in) { -+ if (hc->multi_count == 1) { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; -+ } else if (hc->multi_count == 2) { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; -+ } else { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA2; -+ } -+ } else { -+ if (hc->multi_count == 1) { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; -+ } else { -+ hc->data_pid_start = DWC_OTG_HC_PID_MDATA; -+ } -+ } -+ } else { -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA0; -+ } -+} -+ -+/** -+ * This function does the setup for a data transfer for a host channel and -+ * starts the transfer. May be called in either Slave mode or DMA mode. In -+ * Slave mode, the caller must ensure that there is sufficient space in the -+ * request queue and Tx Data FIFO. -+ * -+ * For an OUT transfer in Slave mode, it loads a data packet into the -+ * appropriate FIFO. If necessary, additional data packets will be loaded in -+ * the Host ISR. -+ * -+ * For an IN transfer in Slave mode, a data packet is requested. The data -+ * packets are unloaded from the Rx FIFO in the Host ISR. If necessary, -+ * additional data packets are requested in the Host ISR. -+ * -+ * For a PING transfer in Slave mode, the Do Ping bit is set in the HCTSIZ -+ * register along with a packet count of 1 and the channel is enabled. This -+ * causes a single PING transaction to occur. Other fields in HCTSIZ are -+ * simply set to 0 since no data transfer occurs in this case. -+ * -+ * For a PING transfer in DMA mode, the HCTSIZ register is initialized with -+ * all the information required to perform the subsequent data transfer. In -+ * addition, the Do Ping bit is set in the HCTSIZ register. In this case, the -+ * controller performs the entire PING protocol, then starts the data -+ * transfer. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Information needed to initialize the host channel. The xfer_len -+ * value may be reduced to accommodate the max widths of the XferSize and -+ * PktCnt fields in the HCTSIZn register. The multi_count value may be changed -+ * to reflect the final xfer_len value. -+ */ -+void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ uint16_t num_packets; -+ uint32_t max_hc_xfer_size = core_if->core_params->max_transfer_size; -+ uint16_t max_hc_pkt_count = core_if->core_params->max_packet_count; -+ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ -+ hctsiz.d32 = 0; -+ -+ if (hc->do_ping) { -+ if (!core_if->dma_enable) { -+ dwc_otg_hc_do_ping(core_if, hc); -+ hc->xfer_started = 1; -+ return; -+ } else { -+ hctsiz.b.dopng = 1; -+ } -+ } -+ -+ if (hc->do_split) { -+ num_packets = 1; -+ -+ if (hc->complete_split && !hc->ep_is_in) { -+ /* For CSPLIT OUT Transfer, set the size to 0 so the -+ * core doesn't expect any data written to the FIFO */ -+ hc->xfer_len = 0; -+ } else if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { -+ hc->xfer_len = hc->max_packet; -+ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { -+ hc->xfer_len = 188; -+ } -+ -+ hctsiz.b.xfersize = hc->xfer_len; -+ } else { -+ /* -+ * Ensure that the transfer length and packet count will fit -+ * in the widths allocated for them in the HCTSIZn register. -+ */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * Make sure the transfer size is no larger than one -+ * (micro)frame's worth of data. (A check was done -+ * when the periodic transfer was accepted to ensure -+ * that a (micro)frame's worth of data can be -+ * programmed into a channel.) -+ */ -+ uint32_t max_periodic_len = -+ hc->multi_count * hc->max_packet; -+ if (hc->xfer_len > max_periodic_len) { -+ hc->xfer_len = max_periodic_len; -+ } else { -+ } -+ } else if (hc->xfer_len > max_hc_xfer_size) { -+ /* Make sure that xfer_len is a multiple of max packet size. */ -+ hc->xfer_len = max_hc_xfer_size - hc->max_packet + 1; -+ } -+ -+ if (hc->xfer_len > 0) { -+ num_packets = -+ (hc->xfer_len + hc->max_packet - -+ 1) / hc->max_packet; -+ if (num_packets > max_hc_pkt_count) { -+ num_packets = max_hc_pkt_count; -+ hc->xfer_len = num_packets * hc->max_packet; -+ } -+ } else { -+ /* Need 1 packet for transfer length of 0. */ -+ num_packets = 1; -+ } -+ -+ if (hc->ep_is_in) { -+ /* Always program an integral # of max packets for IN transfers. */ -+ hc->xfer_len = num_packets * hc->max_packet; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * Make sure that the multi_count field matches the -+ * actual transfer length. -+ */ -+ hc->multi_count = num_packets; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ set_pid_isoc(hc); -+ -+ hctsiz.b.xfersize = hc->xfer_len; -+ } -+ -+ hc->start_pkt_count = num_packets; -+ hctsiz.b.pktcnt = num_packets; -+ hctsiz.b.pid = hc->data_pid_start; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " Xfer Size: %d\n", hctsiz.b.xfersize); -+ DWC_DEBUGPL(DBG_HCDV, " Num Pkts: %d\n", hctsiz.b.pktcnt); -+ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); -+ -+ if (core_if->dma_enable) { -+ dwc_dma_t dma_addr; -+ if (hc->align_buff) { -+ dma_addr = hc->align_buff; -+ } else { -+ dma_addr = ((unsigned long)hc->xfer_buff & 0xffffffff); -+ } -+ DWC_WRITE_REG32(&hc_regs->hcdma, dma_addr); -+ } -+ -+ /* Start the split */ -+ if (hc->do_split) { -+ hcsplt_data_t hcsplt; -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ hcsplt.b.spltena = 1; -+ DWC_WRITE_REG32(&hc_regs->hcsplt, hcsplt.d32); -+ } -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.multicnt = hc->multi_count; -+ hc_set_even_odd_frame(core_if, hc, &hcchar); -+#ifdef DEBUG -+ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; -+ if (hcchar.b.chdis) { -+ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", -+ __func__, hc->hc_num, hcchar.d32); -+ } -+#endif -+ -+ /* Set host channel enable after all other setup is complete. */ -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ hc->xfer_started = 1; -+ hc->requests++; -+ -+ if (!core_if->dma_enable && !hc->ep_is_in && hc->xfer_len > 0) { -+ /* Load OUT packet into the appropriate Tx FIFO. */ -+ dwc_otg_hc_write_packet(core_if, hc); -+ } -+#ifdef DEBUG -+ if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { -+ DWC_DEBUGPL(DBG_HCDV, "transfer %d from core_if %p\n", -+ hc->hc_num, core_if);//GRAYG -+ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; -+ core_if->hc_xfer_info[hc->hc_num].hc = hc; -+ -+ /* Start a timer for this transfer. */ -+ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); -+ } -+#endif -+} -+ -+/** -+ * This function does the setup for a data transfer for a host channel -+ * and starts the transfer in Descriptor DMA mode. -+ * -+ * Initializes HCTSIZ register. For a PING transfer the Do Ping bit is set. -+ * Sets PID and NTD values. For periodic transfers -+ * initializes SCHED_INFO field with micro-frame bitmap. -+ * -+ * Initializes HCDMA register with descriptor list address and CTD value -+ * then starts the transfer via enabling the channel. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param hc Information needed to initialize the host channel. -+ */ -+void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ hcdma_data_t hcdma; -+ -+ hctsiz.d32 = 0; -+ -+ if (hc->do_ping) -+ hctsiz.b_ddma.dopng = 1; -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ set_pid_isoc(hc); -+ -+ /* Packet Count and Xfer Size are not used in Descriptor DMA mode */ -+ hctsiz.b_ddma.pid = hc->data_pid_start; -+ hctsiz.b_ddma.ntd = hc->ntd - 1; /* 0 - 1 descriptor, 1 - 2 descriptors, etc. */ -+ hctsiz.b_ddma.schinfo = hc->schinfo; /* Non-zero only for high-speed interrupt endpoints */ -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " Start PID: %d\n", hctsiz.b.pid); -+ DWC_DEBUGPL(DBG_HCDV, " NTD: %d\n", hctsiz.b_ddma.ntd); -+ -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ hcdma.d32 = 0; -+ hcdma.b.dma_addr = ((uint32_t) hc->desc_list_addr) >> 11; -+ -+ /* Always start from first descriptor. */ -+ hcdma.b.ctd = 0; -+ DWC_WRITE_REG32(&hc_regs->hcdma, hcdma.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.multicnt = hc->multi_count; -+ -+#ifdef DEBUG -+ core_if->start_hcchar_val[hc->hc_num] = hcchar.d32; -+ if (hcchar.b.chdis) { -+ DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", -+ __func__, hc->hc_num, hcchar.d32); -+ } -+#endif -+ -+ /* Set host channel enable after all other setup is complete. */ -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ hc->xfer_started = 1; -+ hc->requests++; -+ -+#ifdef DEBUG -+ if ((hc->ep_type != DWC_OTG_EP_TYPE_INTR) -+ && (hc->ep_type != DWC_OTG_EP_TYPE_ISOC)) { -+ DWC_DEBUGPL(DBG_HCDV, "DMA transfer %d from core_if %p\n", -+ hc->hc_num, core_if);//GRAYG -+ core_if->hc_xfer_info[hc->hc_num].core_if = core_if; -+ core_if->hc_xfer_info[hc->hc_num].hc = hc; -+ /* Start a timer for this transfer. */ -+ DWC_TIMER_SCHEDULE(core_if->hc_xfer_timer[hc->hc_num], 10000); -+ } -+#endif -+ -+} -+ -+/** -+ * This function continues a data transfer that was started by previous call -+ * to dwc_otg_hc_start_transfer. The caller must ensure there is -+ * sufficient space in the request queue and Tx Data FIFO. This function -+ * should only be called in Slave mode. In DMA mode, the controller acts -+ * autonomously to complete transfers programmed to a host channel. -+ * -+ * For an OUT transfer, a new data packet is loaded into the appropriate FIFO -+ * if there is any data remaining to be queued. For an IN transfer, another -+ * data packet is always requested. For the SETUP phase of a control transfer, -+ * this function does nothing. -+ * -+ * @return 1 if a new request is queued, 0 if no more requests are required -+ * for this transfer. -+ */ -+int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ -+ if (hc->do_split) { -+ /* SPLITs always queue just once per channel */ -+ return 0; -+ } else if (hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { -+ /* SETUPs are queued only once since they can't be NAKed. */ -+ return 0; -+ } else if (hc->ep_is_in) { -+ /* -+ * Always queue another request for other IN transfers. If -+ * back-to-back INs are issued and NAKs are received for both, -+ * the driver may still be processing the first NAK when the -+ * second NAK is received. When the interrupt handler clears -+ * the NAK interrupt for the first NAK, the second NAK will -+ * not be seen. So we can't depend on the NAK interrupt -+ * handler to requeue a NAKed request. Instead, IN requests -+ * are issued each time this function is called. When the -+ * transfer completes, the extra requests for the channel will -+ * be flushed. -+ */ -+ hcchar_data_t hcchar; -+ dwc_otg_hc_regs_t *hc_regs = -+ core_if->host_if->hc_regs[hc->hc_num]; -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hc_set_even_odd_frame(core_if, hc, &hcchar); -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ DWC_DEBUGPL(DBG_HCDV, " IN xfer: hcchar = 0x%08x\n", -+ hcchar.d32); -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ hc->requests++; -+ return 1; -+ } else { -+ /* OUT transfers. */ -+ if (hc->xfer_count < hc->xfer_len) { -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ hcchar_data_t hcchar; -+ dwc_otg_hc_regs_t *hc_regs; -+ hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hc_set_even_odd_frame(core_if, hc, &hcchar); -+ } -+ -+ /* Load OUT packet into the appropriate Tx FIFO. */ -+ dwc_otg_hc_write_packet(core_if, hc); -+ hc->requests++; -+ return 1; -+ } else { -+ return 0; -+ } -+ } -+} -+ -+/** -+ * Starts a PING transfer. This function should only be called in Slave mode. -+ * The Do Ping bit is set in the HCTSIZ register, then the channel is enabled. -+ */ -+void dwc_otg_hc_do_ping(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); -+ -+ hctsiz.d32 = 0; -+ hctsiz.b.dopng = 1; -+ hctsiz.b.pktcnt = 1; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.chen = 1; -+ hcchar.b.chdis = 0; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+} -+ -+/* -+ * This function writes a packet into the Tx FIFO associated with the Host -+ * Channel. For a channel associated with a non-periodic EP, the non-periodic -+ * Tx FIFO is written. For a channel associated with a periodic EP, the -+ * periodic Tx FIFO is written. This function should only be called in Slave -+ * mode. -+ * -+ * Upon return the xfer_buff and xfer_count fields in _hc are incremented by -+ * then number of bytes written to the Tx FIFO. -+ */ -+void dwc_otg_hc_write_packet(dwc_otg_core_if_t * core_if, dwc_hc_t * hc) -+{ -+ uint32_t i; -+ uint32_t remaining_count; -+ uint32_t byte_count; -+ uint32_t dword_count; -+ -+ uint32_t *data_buff = (uint32_t *) (hc->xfer_buff); -+ uint32_t *data_fifo = core_if->data_fifo[hc->hc_num]; -+ -+ remaining_count = hc->xfer_len - hc->xfer_count; -+ if (remaining_count > hc->max_packet) { -+ byte_count = hc->max_packet; -+ } else { -+ byte_count = remaining_count; -+ } -+ -+ dword_count = (byte_count + 3) / 4; -+ -+ if ((((unsigned long)data_buff) & 0x3) == 0) { -+ /* xfer_buff is DWORD aligned. */ -+ for (i = 0; i < dword_count; i++, data_buff++) { -+ DWC_WRITE_REG32(data_fifo, *data_buff); -+ } -+ } else { -+ /* xfer_buff is not DWORD aligned. */ -+ for (i = 0; i < dword_count; i++, data_buff++) { -+ uint32_t data; -+ data = -+ (data_buff[0] | data_buff[1] << 8 | data_buff[2] << -+ 16 | data_buff[3] << 24); -+ DWC_WRITE_REG32(data_fifo, data); -+ } -+ } -+ -+ hc->xfer_count += byte_count; -+ hc->xfer_buff += byte_count; -+} -+ -+/** -+ * Gets the current USB frame number. This is the frame number from the last -+ * SOF packet. -+ */ -+uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ /* read current frame/microframe number from DSTS register */ -+ return dsts.b.soffn; -+} -+ -+/** -+ * Calculates and gets the frame Interval value of HFIR register according PHY -+ * type and speed.The application can modify a value of HFIR register only after -+ * the Port Enable bit of the Host Port Control and Status register -+ * (HPRT.PrtEnaPort) has been set. -+*/ -+ -+uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if) -+{ -+ gusbcfg_data_t usbcfg; -+ hwcfg2_data_t hwcfg2; -+ hprt0_data_t hprt0; -+ int clock = 60; // default value -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ hwcfg2.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg2); -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ if (!usbcfg.b.physel && usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) -+ clock = 60; -+ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 3) -+ clock = 48; -+ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && -+ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) -+ clock = 30; -+ if (!usbcfg.b.phylpwrclksel && !usbcfg.b.physel && -+ !usbcfg.b.ulpi_utmi_sel && !usbcfg.b.phyif) -+ clock = 60; -+ if (usbcfg.b.phylpwrclksel && !usbcfg.b.physel && -+ !usbcfg.b.ulpi_utmi_sel && usbcfg.b.phyif) -+ clock = 48; -+ if (usbcfg.b.physel && !usbcfg.b.phyif && hwcfg2.b.fs_phy_type == 2) -+ clock = 48; -+ if (usbcfg.b.physel && hwcfg2.b.fs_phy_type == 1) -+ clock = 48; -+ if (hprt0.b.prtspd == 0) -+ /* High speed case */ -+ return 125 * clock - 1; -+ else -+ /* FS/LS case */ -+ return 1000 * clock - 1; -+} -+ -+/** -+ * This function reads a setup packet from the Rx FIFO into the destination -+ * buffer. This function is called from the Rx Status Queue Level (RxStsQLvl) -+ * Interrupt routine when a SETUP packet has been received in Slave mode. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dest Destination buffer for packet data. -+ */ -+void dwc_otg_read_setup_packet(dwc_otg_core_if_t * core_if, uint32_t * dest) -+{ -+ device_grxsts_data_t status; -+ /* Get the 8 bytes of a setup transaction data */ -+ -+ /* Pop 2 DWORDS off the receive data FIFO into memory */ -+ dest[0] = DWC_READ_REG32(core_if->data_fifo[0]); -+ dest[1] = DWC_READ_REG32(core_if->data_fifo[0]); -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ status.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->grxstsp); -+ DWC_DEBUGPL(DBG_ANY, -+ "EP:%d BCnt:%d " "pktsts:%x Frame:%d(0x%0x)\n", -+ status.b.epnum, status.b.bcnt, status.b.pktsts, -+ status.b.fn, status.b.fn); -+ } -+} -+ -+/** -+ * This function enables EP0 OUT to receive SETUP packets and configures EP0 -+ * IN for transmitting packets. It is normally called when the -+ * "Enumeration Done" interrupt occurs. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP0 data. -+ */ -+void dwc_otg_ep0_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dsts_data_t dsts; -+ depctl_data_t diepctl; -+ depctl_data_t doepctl; -+ dctl_data_t dctl = {.d32 = 0 }; -+ -+ ep->stp_rollover = 0; -+ /* Read the Device Status and Endpoint 0 Control registers */ -+ dsts.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dsts); -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); -+ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); -+ -+ /* Set the MPS of the IN EP based on the enumeration speed */ -+ switch (dsts.b.enumspd) { -+ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: -+ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: -+ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: -+ diepctl.b.mps = DWC_DEP0CTL_MPS_64; -+ break; -+ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: -+ diepctl.b.mps = DWC_DEP0CTL_MPS_8; -+ break; -+ } -+ -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); -+ -+ /* Enable OUT EP for receive */ -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ doepctl.b.epena = 1; -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); -+ } -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); -+ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); -+#endif -+ dctl.b.cgnpinnak = 1; -+ -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ DWC_DEBUGPL(DBG_PCDV, "dctl=%0x\n", -+ DWC_READ_REG32(&dev_if->dev_global_regs->dctl)); -+ -+} -+ -+/** -+ * This function activates an EP. The Device EP control register for -+ * the EP is configured as defined in the ep structure. Note: This -+ * function is not used for EP0. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to activate. -+ */ -+void dwc_otg_ep_activate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ depctl_data_t depctl; -+ volatile uint32_t *addr; -+ daint_data_t daintmsk = {.d32 = 0 }; -+ dcfg_data_t dcfg; -+ uint8_t i; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s() EP%d-%s\n", __func__, ep->num, -+ (ep->is_in ? "IN" : "OUT")); -+ -+#ifdef DWC_UTE_PER_IO -+ ep->xiso_frame_num = 0xFFFFFFFF; -+ ep->xiso_active_xfers = 0; -+ ep->xiso_queued_xfers = 0; -+#endif -+ /* Read DEPCTLn register */ -+ if (ep->is_in == 1) { -+ addr = &dev_if->in_ep_regs[ep->num]->diepctl; -+ daintmsk.ep.in = 1 << ep->num; -+ } else { -+ addr = &dev_if->out_ep_regs[ep->num]->doepctl; -+ daintmsk.ep.out = 1 << ep->num; -+ } -+ -+ /* If the EP is already active don't change the EP Control -+ * register. */ -+ depctl.d32 = DWC_READ_REG32(addr); -+ if (!depctl.b.usbactep) { -+ depctl.b.mps = ep->maxpacket; -+ depctl.b.eptype = ep->type; -+ depctl.b.txfnum = ep->tx_fifo_num; -+ -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ depctl.b.setd0pid = 1; // ??? -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ depctl.b.usbactep = 1; -+ -+ /* Update nextep_seq array and EPMSCNT in DCFG*/ -+ if (!(depctl.b.eptype & 1) && (ep->is_in == 1)) { // NP IN EP -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ if (core_if->nextep_seq[i] == core_if->first_in_nextep_seq) -+ break; -+ } -+ core_if->nextep_seq[i] = ep->num; -+ core_if->nextep_seq[ep->num] = core_if->first_in_nextep_seq; -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt++; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV, "%2d\n", -+ core_if->nextep_seq[i]); -+ } -+ -+ } -+ -+ -+ DWC_WRITE_REG32(addr, depctl.d32); -+ DWC_DEBUGPL(DBG_PCDV, "DEPCTL=%08x\n", DWC_READ_REG32(addr)); -+ } -+ -+ /* Enable the Interrupt for this EP */ -+ if (core_if->multiproc_int_enable) { -+ if (ep->is_in == 1) { -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.xfercompl = 1; -+ diepmsk.b.timeout = 1; -+ diepmsk.b.epdisabled = 1; -+ diepmsk.b.ahberr = 1; -+ diepmsk.b.intknepmis = 1; -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) -+ diepmsk.b.intknepmis = 0; -+ diepmsk.b.txfifoundrn = 1; //????? -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ diepmsk.b.nak = 1; -+ } -+ -+ -+ -+/* -+ if (core_if->dma_desc_enable) { -+ diepmsk.b.bna = 1; -+ } -+*/ -+/* -+ if (core_if->dma_enable) { -+ doepmsk.b.nak = 1; -+ } -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs-> -+ diepeachintmsk[ep->num], diepmsk.d32); -+ -+ } else { -+ doepmsk_data_t doepmsk = {.d32 = 0 }; -+ doepmsk.b.xfercompl = 1; -+ doepmsk.b.ahberr = 1; -+ doepmsk.b.epdisabled = 1; -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) -+ doepmsk.b.outtknepdis = 1; -+ -+/* -+ -+ if (core_if->dma_desc_enable) { -+ doepmsk.b.bna = 1; -+ } -+*/ -+/* -+ doepmsk.b.babble = 1; -+ doepmsk.b.nyet = 1; -+ doepmsk.b.nak = 1; -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs-> -+ doepeachintmsk[ep->num], doepmsk.d32); -+ } -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->deachintmsk, -+ 0, daintmsk.d32); -+ } else { -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (ep->is_in) { -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.nak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->diepmsk, 0, diepmsk.d32); -+ } else { -+ doepmsk_data_t doepmsk = {.d32 = 0 }; -+ doepmsk.b.outtknepdis = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->doepmsk, 0, doepmsk.d32); -+ } -+ } -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->daintmsk, -+ 0, daintmsk.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "DAINTMSK=%0x\n", -+ DWC_READ_REG32(&dev_if->dev_global_regs->daintmsk)); -+ -+ ep->stall_clear_flag = 0; -+ -+ return; -+} -+ -+/** -+ * This function deactivates an EP. This is done by clearing the USB Active -+ * EP bit in the Device EP control register. Note: This function is not used -+ * for EP0. EP0 cannot be deactivated. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to deactivate. -+ */ -+void dwc_otg_ep_deactivate(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ daint_data_t daintmsk = {.d32 = 0 }; -+ dcfg_data_t dcfg; -+ uint8_t i = 0; -+ -+#ifdef DWC_UTE_PER_IO -+ ep->xiso_frame_num = 0xFFFFFFFF; -+ ep->xiso_active_xfers = 0; -+ ep->xiso_queued_xfers = 0; -+#endif -+ -+ /* Read DEPCTLn register */ -+ if (ep->is_in == 1) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ daintmsk.ep.in = 1 << ep->num; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ daintmsk.ep.out = 1 << ep->num; -+ } -+ -+ depctl.d32 = DWC_READ_REG32(addr); -+ -+ depctl.b.usbactep = 0; -+ -+ /* Update nextep_seq array and EPMSCNT in DCFG*/ -+ if (!(depctl.b.eptype & 1) && ep->is_in == 1) { // NP EP IN -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ if (core_if->nextep_seq[i] == ep->num) -+ break; -+ } -+ core_if->nextep_seq[i] = core_if->nextep_seq[ep->num]; -+ if (core_if->first_in_nextep_seq == ep->num) -+ core_if->first_in_nextep_seq = i; -+ core_if->nextep_seq[ep->num] = 0xff; -+ depctl.b.nextep = 0; -+ dcfg.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt--; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, -+ dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); -+ } -+ } -+ -+ if (ep->is_in == 1) -+ depctl.b.txfnum = 0; -+ -+ if (core_if->dma_desc_enable) -+ depctl.b.epdis = 1; -+ -+ DWC_WRITE_REG32(addr, depctl.d32); -+ depctl.d32 = DWC_READ_REG32(addr); -+ if (core_if->dma_enable && ep->type == DWC_OTG_EP_TYPE_ISOC -+ && depctl.b.epena) { -+ depctl_data_t depctl = {.d32 = 0}; -+ if (ep->is_in) { -+ diepint_data_t diepint = {.d32 = 0}; -+ -+ depctl.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepctl, depctl.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->in_ep_regs[ep->num]-> -+ diepint); -+ } while (!diepint.b.inepnakeff); -+ diepint.b.inepnakeff = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepint, diepint.d32); -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepctl, depctl.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->in_ep_regs[ep->num]-> -+ diepint); -+ } while (!diepint.b.epdisabled); -+ diepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ diepint, diepint.d32); -+ } else { -+ dctl_data_t dctl = {.d32 = 0}; -+ gintmsk_data_t gintsts = {.d32 = 0}; -+ doepint_data_t doepint = {.d32 = 0}; -+ dctl.b.sgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, 0, dctl.d32); -+ do { -+ dwc_udelay(10); -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ } while (!gintsts.b.goutnakeff); -+ gintsts.d32 = 0; -+ gintsts.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ depctl.d32 = 0; -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepctl, depctl.d32); -+ do -+ { -+ dwc_udelay(10); -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->num]->doepint); -+ } while (!doepint.b.epdisabled); -+ -+ doepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]->doepint, doepint.d32); -+ -+ dctl.d32 = 0; -+ dctl.b.cgoutnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ } -+ } -+ -+ /* Disable the Interrupt for this EP */ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->deachintmsk, -+ daintmsk.d32, 0); -+ -+ if (ep->is_in == 1) { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ diepeachintmsk[ep->num], 0); -+ } else { -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[ep->num], 0); -+ } -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->daintmsk, -+ daintmsk.d32, 0); -+ } -+ -+} -+ -+/** -+ * This function initializes dma descriptor chain. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+static void init_dma_desc_chain(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ uint32_t offset; -+ uint32_t xfer_est; -+ int i; -+ unsigned maxxfer_local, total_len; -+ -+ if (!ep->is_in && ep->type == DWC_OTG_EP_TYPE_INTR && -+ (ep->maxpacket%4)) { -+ maxxfer_local = ep->maxpacket; -+ total_len = ep->xfer_len; -+ } else { -+ maxxfer_local = ep->maxxfer; -+ total_len = ep->total_len; -+ } -+ -+ ep->desc_cnt = (total_len / maxxfer_local) + -+ ((total_len % maxxfer_local) ? 1 : 0); -+ -+ if (!ep->desc_cnt) -+ ep->desc_cnt = 1; -+ -+ if (ep->desc_cnt > MAX_DMA_DESC_CNT) -+ ep->desc_cnt = MAX_DMA_DESC_CNT; -+ -+ dma_desc = ep->desc_addr; -+ if (maxxfer_local == ep->maxpacket) { -+ if ((total_len % maxxfer_local) && -+ (total_len/maxxfer_local < MAX_DMA_DESC_CNT)) { -+ xfer_est = (ep->desc_cnt - 1) * maxxfer_local + -+ (total_len % maxxfer_local); -+ } else -+ xfer_est = ep->desc_cnt * maxxfer_local; -+ } else -+ xfer_est = total_len; -+ offset = 0; -+ for (i = 0; i < ep->desc_cnt; ++i) { -+ /** DMA Descriptor Setup */ -+ if (xfer_est > maxxfer_local) { -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 0; -+ dma_desc->status.b.ioc = 0; -+ dma_desc->status.b.sp = 0; -+ dma_desc->status.b.bytes = maxxfer_local; -+ dma_desc->buf = ep->dma_addr + offset; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ xfer_est -= maxxfer_local; -+ offset += maxxfer_local; -+ } else { -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ if (ep->is_in) { -+ dma_desc->status.b.sp = -+ (xfer_est % -+ ep->maxpacket) ? 1 : ((ep-> -+ sent_zlp) ? 1 : 0); -+ dma_desc->status.b.bytes = xfer_est; -+ } else { -+ if (maxxfer_local == ep->maxpacket) -+ dma_desc->status.b.bytes = xfer_est; -+ else -+ dma_desc->status.b.bytes = -+ xfer_est + ((4 - (xfer_est & 0x3)) & 0x3); -+ } -+ -+ dma_desc->buf = ep->dma_addr + offset; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ } -+ dma_desc++; -+ } -+} -+/** -+ * This function is called when to write ISOC data into appropriate dedicated -+ * periodic FIFO. -+ */ -+static int32_t write_isoc_tx_fifo(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ dtxfsts_data_t txstatus = {.d32 = 0 }; -+ uint32_t len = 0; -+ int epnum = dwc_ep->num; -+ int dwords; -+ -+ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); -+ -+ ep_regs = core_if->dev_if->in_ep_regs[epnum]; -+ -+ len = dwc_ep->xfer_len - dwc_ep->xfer_count; -+ -+ if (len > dwc_ep->maxpacket) { -+ len = dwc_ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); -+ -+ while (txstatus.b.txfspcavail > dwords && -+ dwc_ep->xfer_count < dwc_ep->xfer_len && dwc_ep->xfer_len != 0) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, dwc_ep, 0); -+ -+ len = dwc_ep->xfer_len - dwc_ep->xfer_count; -+ if (len > dwc_ep->maxpacket) { -+ len = dwc_ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, -+ txstatus.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); -+ -+ return 1; -+} -+/** -+ * This function does the setup for a data transfer for an EP and -+ * starts the transfer. For an IN transfer, the packets will be -+ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, -+ * the packets are unloaded from the Rx FIFO in the ISR. the ISR. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+ -+void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ deptsiz_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); -+ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " -+ "xfer_buff=%p start_xfer_buff=%p, total_len = %d\n", -+ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, -+ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff, -+ ep->total_len); -+ /* IN endpoint */ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[ep->num]; -+ -+ gnptxsts_data_t gtxstatus; -+ -+ gtxstatus.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); -+ -+ if (core_if->en_multiple_tx_fifo == 0 -+ && gtxstatus.b.nptxqspcavail == 0 && !core_if->dma_enable) { -+#ifdef DEBUG -+ DWC_PRINTF("TX Queue Full (0x%0x)\n", gtxstatus.d32); -+#endif -+ return; -+ } -+ -+ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); -+ -+ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) -+ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? -+ ep->maxxfer : (ep->total_len - ep->xfer_len); -+ else -+ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len - ep->xfer_len)) ? -+ MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); -+ -+ -+ /* Zero Length Packet? */ -+ if ((ep->xfer_len - ep->xfer_count) == 0) { -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 1; -+ } else { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - ep->xfer_count - 1 + -+ ep->maxpacket) / ep->maxpacket; -+ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { -+ deptsiz.b.pktcnt = MAX_PKT_CNT; -+ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; -+ } -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) -+ deptsiz.b.mc = deptsiz.b.pktcnt; -+ } -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ if (ep->type != DWC_OTG_EP_TYPE_ISOC) -+ deptsiz.b.mc = 1; -+ DWC_WRITE_REG32(&in_regs->dieptsiz, -+ deptsiz.d32); -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+#ifdef DWC_UTE_CFI -+ /* The descriptor chain should be already initialized by now */ -+ if (ep->buff_mode != BM_STANDARD) { -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ ep->descs_dma_addr); -+ } else { -+#endif -+ init_dma_desc_chain(core_if, ep); -+ /** DIEPDMAn Register write */ -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ ep->dma_desc_addr); -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ } -+ } else { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ if (ep->type != DWC_OTG_EP_TYPE_ISOC) { -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, -+ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, -+ * the data will be written into the fifo by the ISR. -+ */ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32 -+ (&core_if->core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk = 1 << ep->num; -+ DWC_MODIFY_REG32 -+ (&core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ -+ } -+ } -+ } else { -+ write_isoc_tx_fifo(core_if, ep); -+ } -+ } -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ dsts_data_t dsts = {.d32 = 0}; -+ if (ep->bInterval == 1) { -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dsts); -+ ep->frame_num = dsts.b.soffn + ep->bInterval; -+ if (ep->frame_num > 0x3FFF) { -+ ep->frm_overrun = 1; -+ ep->frame_num &= 0x3FFF; -+ } else -+ ep->frm_overrun = 0; -+ if (ep->frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } -+ } -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ } else { -+ /* OUT endpoint */ -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[ep->num]; -+ -+ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); -+ -+ if (!core_if->dma_desc_enable) { -+ if (ep->maxpacket > ep->maxxfer / MAX_PKT_CNT) -+ ep->xfer_len += (ep->maxxfer < (ep->total_len - ep->xfer_len)) ? -+ ep->maxxfer : (ep->total_len - ep->xfer_len); -+ else -+ ep->xfer_len += (MAX_PKT_CNT * ep->maxpacket < (ep->total_len -+ - ep->xfer_len)) ? MAX_PKT_CNT * ep->maxpacket : (ep->total_len - ep->xfer_len); -+ } -+ -+ /* Program the transfer size and packet count as follows: -+ * -+ * pktcnt = N -+ * xfersize = N * maxpacket -+ */ -+ if ((ep->xfer_len - ep->xfer_count) == 0) { -+ /* Zero Length Packet */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ } else { -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - ep->xfer_count + -+ (ep->maxpacket - 1)) / ep->maxpacket; -+ if (deptsiz.b.pktcnt > MAX_PKT_CNT) { -+ deptsiz.b.pktcnt = MAX_PKT_CNT; -+ } -+ if (!core_if->dma_desc_enable) { -+ ep->xfer_len = -+ deptsiz.b.pktcnt * ep->maxpacket + ep->xfer_count; -+ } -+ deptsiz.b.xfersize = ep->xfer_len - ep->xfer_count; -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "ep%d xfersize=%d pktcnt=%d\n", -+ ep->num, deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+#ifdef DWC_UTE_CFI -+ /* The descriptor chain should be already initialized by now */ -+ if (ep->buff_mode != BM_STANDARD) { -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ ep->descs_dma_addr); -+ } else { -+#endif -+ /** This is used for interrupt out transfers*/ -+ if (!ep->xfer_len) -+ ep->xfer_len = ep->total_len; -+ init_dma_desc_chain(core_if, ep); -+ -+ if (core_if->core_params->dev_out_nak) { -+ if (ep->type == DWC_OTG_EP_TYPE_BULK) { -+ deptsiz.b.pktcnt = (ep->total_len + -+ (ep->maxpacket - 1)) / ep->maxpacket; -+ deptsiz.b.xfersize = ep->total_len; -+ /* Remember initial value of doeptsiz */ -+ core_if->start_doeptsiz_val[ep->num] = deptsiz.d32; -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ } -+ } -+ /** DOEPDMAn Register write */ -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ ep->dma_desc_addr); -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ } -+ } else { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } -+ -+ if (ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ dsts_data_t dsts = {.d32 = 0}; -+ if (ep->bInterval == 1) { -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dsts); -+ ep->frame_num = dsts.b.soffn + ep->bInterval; -+ if (ep->frame_num > 0x3FFF) { -+ ep->frm_overrun = 1; -+ ep->frame_num &= 0x3FFF; -+ } else -+ ep->frm_overrun = 0; -+ -+ if (ep->frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } -+ } -+ -+ /* EP enable */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ -+ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); -+ -+ DWC_DEBUGPL(DBG_PCD, "DOEPCTL=%08x DOEPTSIZ=%08x\n", -+ DWC_READ_REG32(&out_regs->doepctl), -+ DWC_READ_REG32(&out_regs->doeptsiz)); -+ DWC_DEBUGPL(DBG_PCD, "DAINTMSK=%08x GINTMSK=%08x\n", -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> -+ daintmsk), -+ DWC_READ_REG32(&core_if->core_global_regs-> -+ gintmsk)); -+ -+ /* Timer is scheduling only for out bulk transfers for -+ * "Device DDMA OUT NAK Enhancement" feature to inform user -+ * about received data payload in case of timeout -+ */ -+ if (core_if->core_params->dev_out_nak) { -+ if (ep->type == DWC_OTG_EP_TYPE_BULK) { -+ core_if->ep_xfer_info[ep->num].core_if = core_if; -+ core_if->ep_xfer_info[ep->num].ep = ep; -+ core_if->ep_xfer_info[ep->num].state = 1; -+ -+ /* Start a timer for this transfer. */ -+ DWC_TIMER_SCHEDULE(core_if->ep_xfer_timer[ep->num], 10000); -+ } -+ } -+ } -+} -+ -+/** -+ * This function setup a zero length transfer in Buffer DMA and -+ * Slave modes for usb requests with zero field set -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ -+ depctl_data_t depctl; -+ deptsiz_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s()\n", __func__); -+ DWC_PRINTF("zero length transfer is called\n"); -+ -+ /* IN endpoint */ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[ep->num]; -+ -+ depctl.d32 = DWC_READ_REG32(&(in_regs->diepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(in_regs->dieptsiz)); -+ -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 1; -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.b.mc = 1; -+ DWC_WRITE_REG32(&in_regs->dieptsiz, -+ deptsiz.d32); -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, -+ * or the Tx FIFO epmty interrupt in dedicated Tx FIFO mode, -+ * the data will be written into the fifo by the ISR. -+ */ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk = 1 << ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ } -+ } -+ } -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ } else { -+ /* OUT endpoint */ -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[ep->num]; -+ -+ depctl.d32 = DWC_READ_REG32(&(out_regs->doepctl)); -+ deptsiz.d32 = DWC_READ_REG32(&(out_regs->doeptsiz)); -+ -+ /* Zero Length Packet */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } -+ -+ /* EP enable */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ -+ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); -+ -+ } -+} -+ -+/** -+ * This function does the setup for a data transfer for EP0 and starts -+ * the transfer. For an IN transfer, the packets will be loaded into -+ * the appropriate Tx FIFO in the ISR. For OUT transfers, the packets are -+ * unloaded from the Rx FIFO in the ISR. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP0 data. -+ */ -+void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ deptsiz0_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ -+ DWC_DEBUGPL(DBG_PCD, "ep%d-%s xfer_len=%d xfer_cnt=%d " -+ "xfer_buff=%p start_xfer_buff=%p \n", -+ ep->num, (ep->is_in ? "IN" : "OUT"), ep->xfer_len, -+ ep->xfer_count, ep->xfer_buff, ep->start_xfer_buff); -+ -+ ep->total_len = ep->xfer_len; -+ -+ /* IN endpoint */ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[0]; -+ -+ gnptxsts_data_t gtxstatus; -+ -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); -+ if (depctl.b.epena) -+ return; -+ } -+ -+ gtxstatus.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); -+ -+ /* If dedicated FIFO every time flush fifo before enable ep*/ -+ if (core_if->en_multiple_tx_fifo && core_if->snpsid >= OTG_CORE_REV_3_00a) -+ dwc_otg_flush_tx_fifo(core_if, ep->tx_fifo_num); -+ -+ if (core_if->en_multiple_tx_fifo == 0 -+ && gtxstatus.b.nptxqspcavail == 0 -+ && !core_if->dma_enable) { -+#ifdef DEBUG -+ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); -+ DWC_DEBUGPL(DBG_PCD, "DIEPCTL0=%0x\n", -+ DWC_READ_REG32(&in_regs->diepctl)); -+ DWC_DEBUGPL(DBG_PCD, "DIEPTSIZ0=%0x (sz=%d, pcnt=%d)\n", -+ deptsiz.d32, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ DWC_PRINTF("TX Queue or FIFO Full (0x%0x)\n", -+ gtxstatus.d32); -+#endif -+ return; -+ } -+ -+ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); -+ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); -+ -+ /* Zero Length Packet? */ -+ if (ep->xfer_len == 0) { -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 1; -+ } else { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ if (ep->xfer_len > ep->maxpacket) { -+ ep->xfer_len = ep->maxpacket; -+ deptsiz.b.xfersize = ep->maxpacket; -+ } else { -+ deptsiz.b.xfersize = ep->xfer_len; -+ } -+ deptsiz.b.pktcnt = 1; -+ -+ } -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+ dma_desc = core_if->dev_if->in_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.sp = -+ (ep->xfer_len == ep->maxpacket) ? 0 : 1; -+ dma_desc->status.b.bytes = ep->xfer_len; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DIEPDMA0 Register write */ -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ core_if-> -+ dev_if->dma_in_desc_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ } -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, the -+ * data will be written into the fifo by the ISR. -+ */ -+ if (!core_if->dma_enable) { -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk |= 1 << ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ } -+ } -+ } -+ } else { -+ /* OUT endpoint */ -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[0]; -+ -+ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); -+ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); -+ -+ /* Program the transfer size and packet count as follows: -+ * xfersize = N * (maxpacket + 4 - (maxpacket % 4)) -+ * pktcnt = N */ -+ /* Zero Length Packet */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) -+ deptsiz.b.supcnt = 3; -+ -+ DWC_DEBUGPL(DBG_PCDV, "len=%d xfersize=%d pktcnt=%d\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, -+ deptsiz.d32); -+ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ } else { -+ dma_desc = core_if->dev_if->out_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ dma_desc->status.b.mtrf = 0; -+ dma_desc->status.b.sr = 0; -+ } -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.bytes = ep->maxpacket; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DOEPDMA0 Register write */ -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ core_if->dev_if-> -+ dma_out_desc_addr); -+ } -+ } else { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } -+ -+ /* EP enable */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&(out_regs->doepctl), depctl.d32); -+ } -+} -+ -+/** -+ * This function continues control IN transfers started by -+ * dwc_otg_ep0_start_transfer, when the transfer does not fit in a -+ * single packet. NOTE: The DIEPCTL0/DOEPCTL0 registers only have one -+ * bit for the packet count. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP0 data. -+ */ -+void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ deptsiz0_data_t deptsiz; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ -+ if (ep->is_in == 1) { -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[0]; -+ gnptxsts_data_t tx_status = {.d32 = 0 }; -+ -+ tx_status.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gnptxsts); -+ /** @todo Should there be check for room in the Tx -+ * Status Queue. If not remove the code above this comment. */ -+ -+ depctl.d32 = DWC_READ_REG32(&in_regs->diepctl); -+ deptsiz.d32 = DWC_READ_REG32(&in_regs->dieptsiz); -+ -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.b.xfersize = -+ (ep->total_len - ep->xfer_count) > -+ ep->maxpacket ? ep->maxpacket : (ep->total_len - -+ ep->xfer_count); -+ deptsiz.b.pktcnt = 1; -+ if (core_if->dma_enable == 0) { -+ ep->xfer_len += deptsiz.b.xfersize; -+ } else { -+ ep->xfer_len = deptsiz.b.xfersize; -+ } -+ DWC_WRITE_REG32(&in_regs->dieptsiz, deptsiz.d32); -+ } else { -+ ep->xfer_len = -+ (ep->total_len - ep->xfer_count) > -+ ep->maxpacket ? ep->maxpacket : (ep->total_len - -+ ep->xfer_count); -+ -+ dma_desc = core_if->dev_if->in_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.sp = -+ (ep->xfer_len == ep->maxpacket) ? 0 : 1; -+ dma_desc->status.b.bytes = ep->xfer_len; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DIEPDMA0 Register write */ -+ DWC_WRITE_REG32(&in_regs->diepdma, -+ core_if->dev_if->dma_in_desc_addr); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { -+ if (core_if->dma_desc_enable == 0) -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) -+ depctl.b.nextep = core_if->nextep_seq[ep->num]; -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&in_regs->diepctl, depctl.d32); -+ -+ /** -+ * Enable the Non-Periodic Tx FIFO empty interrupt, the -+ * data will be written into the fifo by the ISR. -+ */ -+ if (!core_if->dma_enable) { -+ if (core_if->en_multiple_tx_fifo == 0) { -+ /* First clear it from GINTSTS */ -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gintmsk, -+ intr_mask.d32, intr_mask.d32); -+ -+ } else { -+ /* Enable the Tx FIFO Empty Interrupt for this EP */ -+ if (ep->xfer_len > 0) { -+ uint32_t fifoemptymsk = 0; -+ fifoemptymsk |= 1 << ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ 0, fifoemptymsk); -+ } -+ } -+ } -+ } else { -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[0]; -+ -+ depctl.d32 = DWC_READ_REG32(&out_regs->doepctl); -+ deptsiz.d32 = DWC_READ_REG32(&out_regs->doeptsiz); -+ -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.xfersize = ep->maxpacket; -+ deptsiz.b.pktcnt = 1; -+ -+ if (core_if->dma_desc_enable == 0) { -+ DWC_WRITE_REG32(&out_regs->doeptsiz, deptsiz.d32); -+ } else { -+ dma_desc = core_if->dev_if->out_desc_addr; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.bytes = ep->maxpacket; -+ dma_desc->buf = ep->dma_addr; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DOEPDMA0 Register write */ -+ DWC_WRITE_REG32(&out_regs->doepdma, -+ core_if->dev_if->dma_out_desc_addr); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN len=%d xfersize=%d pktcnt=%d [%08x]\n", -+ ep->xfer_len, deptsiz.b.xfersize, deptsiz.b.pktcnt, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->hwcfg2.b.architecture == DWC_INT_DMA_ARCH) { -+ if (core_if->dma_desc_enable == 0) -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) ep->dma_addr); -+ -+ } -+ -+ /* EP enable, IN data in FIFO */ -+ depctl.b.cnak = 1; -+ depctl.b.epena = 1; -+ DWC_WRITE_REG32(&out_regs->doepctl, depctl.d32); -+ -+ } -+} -+ -+#ifdef DEBUG -+void dump_msg(const u8 * buf, unsigned int length) -+{ -+ unsigned int start, num, i; -+ char line[52], *p; -+ -+ if (length >= 512) -+ return; -+ start = 0; -+ while (length > 0) { -+ num = length < 16u ? length : 16u; -+ p = line; -+ for (i = 0; i < num; ++i) { -+ if (i == 8) -+ *p++ = ' '; -+ DWC_SPRINTF(p, " %02x", buf[i]); -+ p += 3; -+ } -+ *p = 0; -+ DWC_PRINTF("%6x: %s\n", start, line); -+ buf += num; -+ start += num; -+ length -= num; -+ } -+} -+#else -+static inline void dump_msg(const u8 * buf, unsigned int length) -+{ -+} -+#endif -+ -+/** -+ * This function writes a packet into the Tx FIFO associated with the -+ * EP. For non-periodic EPs the non-periodic Tx FIFO is written. For -+ * periodic EPs the periodic Tx FIFO associated with the EP is written -+ * with all packets for the next micro-frame. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to write packet for. -+ * @param dma Indicates if DMA is being used. -+ */ -+void dwc_otg_ep_write_packet(dwc_otg_core_if_t * core_if, dwc_ep_t * ep, -+ int dma) -+{ -+ /** -+ * The buffer is padded to DWORD on a per packet basis in -+ * slave/dma mode if the MPS is not DWORD aligned. The last -+ * packet, if short, is also padded to a multiple of DWORD. -+ * -+ * ep->xfer_buff always starts DWORD aligned in memory and is a -+ * multiple of DWORD in length -+ * -+ * ep->xfer_len can be any number of bytes -+ * -+ * ep->xfer_count is a multiple of ep->maxpacket until the last -+ * packet -+ * -+ * FIFO access is DWORD */ -+ -+ uint32_t i; -+ uint32_t byte_count; -+ uint32_t dword_count; -+ uint32_t *fifo; -+ uint32_t *data_buff = (uint32_t *) ep->xfer_buff; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p)\n", __func__, core_if, -+ ep); -+ if (ep->xfer_count >= ep->xfer_len) { -+ DWC_WARN("%s() No data for EP%d!!!\n", __func__, ep->num); -+ return; -+ } -+ -+ /* Find the byte length of the packet either short packet or MPS */ -+ if ((ep->xfer_len - ep->xfer_count) < ep->maxpacket) { -+ byte_count = ep->xfer_len - ep->xfer_count; -+ } else { -+ byte_count = ep->maxpacket; -+ } -+ -+ /* Find the DWORD length, padded by extra bytes as neccessary if MPS -+ * is not a multiple of DWORD */ -+ dword_count = (byte_count + 3) / 4; -+ -+#ifdef VERBOSE -+ dump_msg(ep->xfer_buff, byte_count); -+#endif -+ -+ /**@todo NGS Where are the Periodic Tx FIFO addresses -+ * intialized? What should this be? */ -+ -+ fifo = core_if->data_fifo[ep->num]; -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "fifo=%p buff=%p *p=%08x bc=%d\n", -+ fifo, data_buff, *data_buff, byte_count); -+ -+ if (!dma) { -+ for (i = 0; i < dword_count; i++, data_buff++) { -+ DWC_WRITE_REG32(fifo, *data_buff); -+ } -+ } -+ -+ ep->xfer_count += byte_count; -+ ep->xfer_buff += byte_count; -+ ep->dma_addr += byte_count; -+} -+ -+/** -+ * Set the EP STALL. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to set the stall on. -+ */ -+void dwc_otg_ep_set_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ volatile uint32_t *depctl_addr; -+ -+ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, -+ (ep->is_in ? "IN" : "OUT")); -+ -+ if (ep->is_in == 1) { -+ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); -+ depctl.d32 = DWC_READ_REG32(depctl_addr); -+ -+ /* set the disable and stall bits */ -+ if (depctl.b.epena) { -+ depctl.b.epdis = 1; -+ } -+ depctl.b.stall = 1; -+ DWC_WRITE_REG32(depctl_addr, depctl.d32); -+ } else { -+ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); -+ depctl.d32 = DWC_READ_REG32(depctl_addr); -+ -+ /* set the stall bit */ -+ depctl.b.stall = 1; -+ DWC_WRITE_REG32(depctl_addr, depctl.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); -+ -+ return; -+} -+ -+/** -+ * Clear the EP STALL. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to clear stall from. -+ */ -+void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl; -+ volatile uint32_t *depctl_addr; -+ -+ DWC_DEBUGPL(DBG_PCD, "%s ep%d-%s\n", __func__, ep->num, -+ (ep->is_in ? "IN" : "OUT")); -+ -+ if (ep->is_in == 1) { -+ depctl_addr = &(core_if->dev_if->in_ep_regs[ep->num]->diepctl); -+ } else { -+ depctl_addr = &(core_if->dev_if->out_ep_regs[ep->num]->doepctl); -+ } -+ -+ depctl.d32 = DWC_READ_REG32(depctl_addr); -+ -+ /* clear the stall bits */ -+ depctl.b.stall = 0; -+ -+ /* -+ * USB Spec 9.4.5: For endpoints using data toggle, regardless -+ * of whether an endpoint has the Halt feature set, a -+ * ClearFeature(ENDPOINT_HALT) request always results in the -+ * data toggle being reinitialized to DATA0. -+ */ -+ if (ep->type == DWC_OTG_EP_TYPE_INTR || -+ ep->type == DWC_OTG_EP_TYPE_BULK) { -+ depctl.b.setd0pid = 1; /* DATA0 */ -+ } -+ -+ DWC_WRITE_REG32(depctl_addr, depctl.d32); -+ DWC_DEBUGPL(DBG_PCD, "DEPCTL=%0x\n", DWC_READ_REG32(depctl_addr)); -+ return; -+} -+ -+/** -+ * This function reads a packet from the Rx FIFO into the destination -+ * buffer. To read SETUP data use dwc_otg_read_setup_packet. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dest Destination buffer for the packet. -+ * @param bytes Number of bytes to copy to the destination. -+ */ -+void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, -+ uint8_t * dest, uint16_t bytes) -+{ -+ int i; -+ int word_count = (bytes + 3) / 4; -+ -+ volatile uint32_t *fifo = core_if->data_fifo[0]; -+ uint32_t *data_buff = (uint32_t *) dest; -+ -+ /** -+ * @todo Account for the case where _dest is not dword aligned. This -+ * requires reading data from the FIFO into a uint32_t temp buffer, -+ * then moving it into the data buffer. -+ */ -+ -+ DWC_DEBUGPL((DBG_PCDV | DBG_CILV), "%s(%p,%p,%d)\n", __func__, -+ core_if, dest, bytes); -+ -+ for (i = 0; i < word_count; i++, data_buff++) { -+ *data_buff = DWC_READ_REG32(fifo); -+ } -+ -+ return; -+} -+ -+/** -+ * This functions reads the device registers and prints them -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ volatile uint32_t *addr; -+ -+ DWC_PRINTF("Device Global Registers\n"); -+ addr = &core_if->dev_if->dev_global_regs->dcfg; -+ DWC_PRINTF("DCFG @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->dctl; -+ DWC_PRINTF("DCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->dsts; -+ DWC_PRINTF("DSTS @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->diepmsk; -+ DWC_PRINTF("DIEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->doepmsk; -+ DWC_PRINTF("DOEPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->daint; -+ DWC_PRINTF("DAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->daintmsk; -+ DWC_PRINTF("DAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->dtknqr1; -+ DWC_PRINTF("DTKNQR1 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ if (core_if->hwcfg2.b.dev_token_q_depth > 6) { -+ addr = &core_if->dev_if->dev_global_regs->dtknqr2; -+ DWC_PRINTF("DTKNQR2 @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ addr = &core_if->dev_if->dev_global_regs->dvbusdis; -+ DWC_PRINTF("DVBUSID @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ addr = &core_if->dev_if->dev_global_regs->dvbuspulse; -+ DWC_PRINTF("DVBUSPULSE @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ -+ addr = &core_if->dev_if->dev_global_regs->dtknqr3_dthrctl; -+ DWC_PRINTF("DTKNQR3_DTHRCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ -+ if (core_if->hwcfg2.b.dev_token_q_depth > 22) { -+ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; -+ DWC_PRINTF("DTKNQR4 @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ addr = &core_if->dev_if->dev_global_regs->dtknqr4_fifoemptymsk; -+ DWC_PRINTF("FIFOEMPMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ if (core_if->hwcfg2.b.multi_proc_int) { -+ -+ addr = &core_if->dev_if->dev_global_regs->deachint; -+ DWC_PRINTF("DEACHINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->dev_global_regs->deachintmsk; -+ DWC_PRINTF("DEACHINTMSK @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ addr = -+ &core_if->dev_if-> -+ dev_global_regs->diepeachintmsk[i]; -+ DWC_PRINTF("DIEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", -+ i, (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ } -+ -+ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { -+ addr = -+ &core_if->dev_if-> -+ dev_global_regs->doepeachintmsk[i]; -+ DWC_PRINTF("DOEPEACHINTMSK[%d] @0x%08lX : 0x%08X\n", -+ i, (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ } -+ } -+ -+ for (i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_PRINTF("Device IN EP %d Registers\n", i); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepctl; -+ DWC_PRINTF("DIEPCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepint; -+ DWC_PRINTF("DIEPINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->dieptsiz; -+ DWC_PRINTF("DIETSIZ @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepdma; -+ DWC_PRINTF("DIEPDMA @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->dtxfsts; -+ DWC_PRINTF("DTXFSTS @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->in_ep_regs[i]->diepdmab; -+ DWC_PRINTF("DIEPDMAB @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, 0 /*DWC_READ_REG32(addr) */ ); -+ } -+ -+ for (i = 0; i <= core_if->dev_if->num_out_eps; i++) { -+ DWC_PRINTF("Device OUT EP %d Registers\n", i); -+ addr = &core_if->dev_if->out_ep_regs[i]->doepctl; -+ DWC_PRINTF("DOEPCTL @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->out_ep_regs[i]->doepint; -+ DWC_PRINTF("DOEPINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->out_ep_regs[i]->doeptsiz; -+ DWC_PRINTF("DOETSIZ @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->dev_if->out_ep_regs[i]->doepdma; -+ DWC_PRINTF("DOEPDMA @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ if (core_if->dma_enable) { /* Don't access this register in SLAVE mode */ -+ addr = &core_if->dev_if->out_ep_regs[i]->doepdmab; -+ DWC_PRINTF("DOEPDMAB @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ } -+} -+ -+/** -+ * This functions reads the SPRAM and prints its content -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_spram(dwc_otg_core_if_t * core_if) -+{ -+ volatile uint8_t *addr, *start_addr, *end_addr; -+ -+ DWC_PRINTF("SPRAM Data:\n"); -+ start_addr = (void *)core_if->core_global_regs; -+ DWC_PRINTF("Base Address: 0x%8lX\n", (unsigned long)start_addr); -+ start_addr += 0x00028000; -+ end_addr = (void *)core_if->core_global_regs; -+ end_addr += 0x000280e0; -+ -+ for (addr = start_addr; addr < end_addr; addr += 16) { -+ DWC_PRINTF -+ ("0x%8lX:\t%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X\n", -+ (unsigned long)addr, addr[0], addr[1], addr[2], addr[3], -+ addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], -+ addr[10], addr[11], addr[12], addr[13], addr[14], addr[15] -+ ); -+ } -+ -+ return; -+} -+ -+/** -+ * This function reads the host registers and prints them -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ volatile uint32_t *addr; -+ -+ DWC_PRINTF("Host Global Registers\n"); -+ addr = &core_if->host_if->host_global_regs->hcfg; -+ DWC_PRINTF("HCFG @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->hfir; -+ DWC_PRINTF("HFIR @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->hfnum; -+ DWC_PRINTF("HFNUM @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->hptxsts; -+ DWC_PRINTF("HPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->haint; -+ DWC_PRINTF("HAINT @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->host_global_regs->haintmsk; -+ DWC_PRINTF("HAINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ if (core_if->dma_desc_enable) { -+ addr = &core_if->host_if->host_global_regs->hflbaddr; -+ DWC_PRINTF("HFLBADDR @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ addr = core_if->host_if->hprt0; -+ DWC_PRINTF("HPRT0 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ for (i = 0; i < core_if->core_params->host_channels; i++) { -+ DWC_PRINTF("Host Channel %d Specific Registers\n", i); -+ addr = &core_if->host_if->hc_regs[i]->hcchar; -+ DWC_PRINTF("HCCHAR @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcsplt; -+ DWC_PRINTF("HCSPLT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcint; -+ DWC_PRINTF("HCINT @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcintmsk; -+ DWC_PRINTF("HCINTMSK @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hctsiz; -+ DWC_PRINTF("HCTSIZ @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->host_if->hc_regs[i]->hcdma; -+ DWC_PRINTF("HCDMA @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ if (core_if->dma_desc_enable) { -+ addr = &core_if->host_if->hc_regs[i]->hcdmab; -+ DWC_PRINTF("HCDMAB @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ -+ } -+ return; -+} -+ -+/** -+ * This function reads the core global registers and prints them -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_dump_global_registers(dwc_otg_core_if_t * core_if) -+{ -+ int i, ep_num; -+ volatile uint32_t *addr; -+ char *txfsiz; -+ -+ DWC_PRINTF("Core Global Registers\n"); -+ addr = &core_if->core_global_regs->gotgctl; -+ DWC_PRINTF("GOTGCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gotgint; -+ DWC_PRINTF("GOTGINT @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gahbcfg; -+ DWC_PRINTF("GAHBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gusbcfg; -+ DWC_PRINTF("GUSBCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->grstctl; -+ DWC_PRINTF("GRSTCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gintsts; -+ DWC_PRINTF("GINTSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gintmsk; -+ DWC_PRINTF("GINTMSK @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->grxstsr; -+ DWC_PRINTF("GRXSTSR @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->grxfsiz; -+ DWC_PRINTF("GRXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gnptxfsiz; -+ DWC_PRINTF("GNPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gnptxsts; -+ DWC_PRINTF("GNPTXSTS @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gi2cctl; -+ DWC_PRINTF("GI2CCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gpvndctl; -+ DWC_PRINTF("GPVNDCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ggpio; -+ DWC_PRINTF("GGPIO @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->guid; -+ DWC_PRINTF("GUID @0x%08lX : 0x%08X\n", -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gsnpsid; -+ DWC_PRINTF("GSNPSID @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg1; -+ DWC_PRINTF("GHWCFG1 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg2; -+ DWC_PRINTF("GHWCFG2 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg3; -+ DWC_PRINTF("GHWCFG3 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->ghwcfg4; -+ DWC_PRINTF("GHWCFG4 @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->glpmcfg; -+ DWC_PRINTF("GLPMCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gpwrdn; -+ DWC_PRINTF("GPWRDN @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->gdfifocfg; -+ DWC_PRINTF("GDFIFOCFG @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ addr = &core_if->core_global_regs->adpctl; -+ DWC_PRINTF("ADPCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ dwc_otg_adp_read_reg(core_if)); -+ addr = &core_if->core_global_regs->hptxfsiz; -+ DWC_PRINTF("HPTXFSIZ @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ ep_num = core_if->hwcfg4.b.num_dev_perio_in_ep; -+ txfsiz = "DPTXFSIZ"; -+ } else { -+ ep_num = core_if->hwcfg4.b.num_in_eps; -+ txfsiz = "DIENPTXF"; -+ } -+ for (i = 0; i < ep_num; i++) { -+ addr = &core_if->core_global_regs->dtxfsiz[i]; -+ DWC_PRINTF("%s[%d] @0x%08lX : 0x%08X\n", txfsiz, i + 1, -+ (unsigned long)addr, DWC_READ_REG32(addr)); -+ } -+ addr = core_if->pcgcctl; -+ DWC_PRINTF("PCGCCTL @0x%08lX : 0x%08X\n", (unsigned long)addr, -+ DWC_READ_REG32(addr)); -+} -+ -+/** -+ * Flush a Tx FIFO. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param num Tx FIFO to flush. -+ */ -+void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * core_if, const int num) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ volatile grstctl_t greset = {.d32 = 0 }; -+ int count = 0; -+ -+ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "Flush Tx FIFO %d\n", num); -+ -+ greset.b.txfflsh = 1; -+ greset.b.txfnum = num; -+ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); -+ -+ do { -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 10000) { -+ DWC_WARN("%s() HANG! GRSTCTL=%0x GNPTXSTS=0x%08x\n", -+ __func__, greset.d32, -+ DWC_READ_REG32(&global_regs->gnptxsts)); -+ break; -+ } -+ dwc_udelay(1); -+ } while (greset.b.txfflsh == 1); -+ -+ /* Wait for 3 PHY Clocks */ -+ dwc_udelay(1); -+} -+ -+/** -+ * Flush Rx FIFO. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ volatile grstctl_t greset = {.d32 = 0 }; -+ int count = 0; -+ -+ DWC_DEBUGPL((DBG_CIL | DBG_PCDV), "%s\n", __func__); -+ /* -+ * -+ */ -+ greset.b.rxfflsh = 1; -+ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); -+ -+ do { -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 10000) { -+ DWC_WARN("%s() HANG! GRSTCTL=%0x\n", __func__, -+ greset.d32); -+ break; -+ } -+ dwc_udelay(1); -+ } while (greset.b.rxfflsh == 1); -+ -+ /* Wait for 3 PHY Clocks */ -+ dwc_udelay(1); -+} -+ -+/** -+ * Do core a soft reset of the core. Be careful with this because it -+ * resets all the internal state machines of the core. -+ */ -+void dwc_otg_core_reset(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ volatile grstctl_t greset = {.d32 = 0 }; -+ int count = 0; -+ -+ DWC_DEBUGPL(DBG_CILV, "%s\n", __func__); -+ /* Wait for AHB master IDLE state. */ -+ do { -+ dwc_udelay(10); -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 100000) { -+ DWC_WARN("%s() HANG! AHB Idle GRSTCTL=%0x\n", __func__, -+ greset.d32); -+ return; -+ } -+ } -+ while (greset.b.ahbidle == 0); -+ -+ /* Core Soft Reset */ -+ count = 0; -+ greset.b.csftrst = 1; -+ DWC_WRITE_REG32(&global_regs->grstctl, greset.d32); -+ do { -+ greset.d32 = DWC_READ_REG32(&global_regs->grstctl); -+ if (++count > 10000) { -+ DWC_WARN("%s() HANG! Soft Reset GRSTCTL=%0x\n", -+ __func__, greset.d32); -+ break; -+ } -+ dwc_udelay(1); -+ } -+ while (greset.b.csftrst == 1); -+ -+ /* Wait for 3 PHY Clocks */ -+ dwc_mdelay(100); -+} -+ -+uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if) -+{ -+ return (dwc_otg_mode(_core_if) != DWC_HOST_MODE); -+} -+ -+uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if) -+{ -+ return (dwc_otg_mode(_core_if) == DWC_HOST_MODE); -+} -+ -+/** -+ * Register HCD callbacks. The callbacks are used to start and stop -+ * the HCD for interrupt processing. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param cb the HCD callback structure. -+ * @param p pointer to be passed to callback function (usb_hcd*). -+ */ -+void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * core_if, -+ dwc_otg_cil_callbacks_t * cb, void *p) -+{ -+ core_if->hcd_cb = cb; -+ cb->p = p; -+} -+ -+/** -+ * Register PCD callbacks. The callbacks are used to start and stop -+ * the PCD for interrupt processing. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param cb the PCD callback structure. -+ * @param p pointer to be passed to callback function (pcd*). -+ */ -+void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * core_if, -+ dwc_otg_cil_callbacks_t * cb, void *p) -+{ -+ core_if->pcd_cb = cb; -+ cb->p = p; -+} -+ -+#ifdef DWC_EN_ISOC -+ -+/** -+ * This function writes isoc data per 1 (micro)frame into tx fifo -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void write_isoc_frame_data(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ dtxfsts_data_t txstatus = {.d32 = 0 }; -+ uint32_t len = 0; -+ uint32_t dwords; -+ -+ ep->xfer_len = ep->data_per_frame; -+ ep->xfer_count = 0; -+ -+ ep_regs = core_if->dev_if->in_ep_regs[ep->num]; -+ -+ len = ep->xfer_len - ep->xfer_count; -+ -+ if (len > ep->maxpacket) { -+ len = ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", ep->num, txstatus.d32); -+ -+ while (txstatus.b.txfspcavail > dwords && -+ ep->xfer_count < ep->xfer_len && ep->xfer_len != 0) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, ep, 0); -+ -+ len = ep->xfer_len - ep->xfer_count; -+ if (len > ep->maxpacket) { -+ len = ep->maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", ep->num, -+ txstatus.d32); -+ } -+} -+ -+/** -+ * This function initializes a descriptor chain for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dsts_data_t dsts = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ -+ if (ep->is_in) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ } -+ -+ ep->xfer_len = ep->data_per_frame; -+ ep->xfer_count = 0; -+ ep->xfer_buff = ep->cur_pkt_addr; -+ ep->dma_addr = ep->cur_pkt_dma_addr; -+ -+ if (ep->is_in) { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.xfersize = ep->xfer_len; -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; -+ deptsiz.b.mc = deptsiz.b.pktcnt; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]->dieptsiz, -+ deptsiz.d32); -+ -+ /* Write the DMA register */ -+ if (core_if->dma_enable) { -+ DWC_WRITE_REG32(& -+ (core_if->dev_if->in_ep_regs[ep->num]-> -+ diepdma), (uint32_t) ep->dma_addr); -+ } -+ } else { -+ deptsiz.b.pktcnt = -+ (ep->xfer_len + (ep->maxpacket - 1)) / ep->maxpacket; -+ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; -+ -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->num]->doeptsiz, deptsiz.d32); -+ -+ if (core_if->dma_enable) { -+ DWC_WRITE_REG32(& -+ (core_if->dev_if-> -+ out_ep_regs[ep->num]->doepdma), -+ (uint32_t) ep->dma_addr); -+ } -+ } -+ -+ /** Enable endpoint, clear nak */ -+ -+ depctl.d32 = 0; -+ if (ep->bInterval == 1) { -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ ep->next_frame = dsts.b.soffn + ep->bInterval; -+ -+ if (ep->next_frame & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } else { -+ ep->next_frame += ep->bInterval; -+ -+ if (ep->next_frame & 0x1) { -+ depctl.b.setd1pid = 1; -+ } else { -+ depctl.b.setd0pid = 1; -+ } -+ } -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(addr, 0, depctl.d32); -+ depctl.d32 = DWC_READ_REG32(addr); -+ -+ if (ep->is_in && core_if->dma_enable == 0) { -+ write_isoc_frame_data(core_if, ep); -+ } -+ -+} -+#endif /* DWC_EN_ISOC */ -+ -+static void dwc_otg_set_uninitialized(int32_t * p, int size) -+{ -+ int i; -+ for (i = 0; i < size; i++) { -+ p[i] = -1; -+ } -+} -+ -+static int dwc_otg_param_initialized(int32_t val) -+{ -+ return val != -1; -+} -+ -+static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if) -+{ -+ int i; -+ core_if->core_params = DWC_ALLOC(sizeof(*core_if->core_params)); -+ if (!core_if->core_params) { -+ return -DWC_E_NO_MEMORY; -+ } -+ dwc_otg_set_uninitialized((int32_t *) core_if->core_params, -+ sizeof(*core_if->core_params) / -+ sizeof(int32_t)); -+ DWC_PRINTF("Setting default values for core params\n"); -+ dwc_otg_set_param_otg_cap(core_if, dwc_param_otg_cap_default); -+ dwc_otg_set_param_dma_enable(core_if, dwc_param_dma_enable_default); -+ dwc_otg_set_param_dma_desc_enable(core_if, -+ dwc_param_dma_desc_enable_default); -+ dwc_otg_set_param_opt(core_if, dwc_param_opt_default); -+ dwc_otg_set_param_dma_burst_size(core_if, -+ dwc_param_dma_burst_size_default); -+ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, -+ dwc_param_host_support_fs_ls_low_power_default); -+ dwc_otg_set_param_enable_dynamic_fifo(core_if, -+ dwc_param_enable_dynamic_fifo_default); -+ dwc_otg_set_param_data_fifo_size(core_if, -+ dwc_param_data_fifo_size_default); -+ dwc_otg_set_param_dev_rx_fifo_size(core_if, -+ dwc_param_dev_rx_fifo_size_default); -+ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, -+ dwc_param_dev_nperio_tx_fifo_size_default); -+ dwc_otg_set_param_host_rx_fifo_size(core_if, -+ dwc_param_host_rx_fifo_size_default); -+ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, -+ dwc_param_host_nperio_tx_fifo_size_default); -+ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, -+ dwc_param_host_perio_tx_fifo_size_default); -+ dwc_otg_set_param_max_transfer_size(core_if, -+ dwc_param_max_transfer_size_default); -+ dwc_otg_set_param_max_packet_count(core_if, -+ dwc_param_max_packet_count_default); -+ dwc_otg_set_param_host_channels(core_if, -+ dwc_param_host_channels_default); -+ dwc_otg_set_param_dev_endpoints(core_if, -+ dwc_param_dev_endpoints_default); -+ dwc_otg_set_param_phy_type(core_if, dwc_param_phy_type_default); -+ dwc_otg_set_param_speed(core_if, dwc_param_speed_default); -+ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, -+ dwc_param_host_ls_low_power_phy_clk_default); -+ dwc_otg_set_param_phy_ulpi_ddr(core_if, dwc_param_phy_ulpi_ddr_default); -+ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, -+ dwc_param_phy_ulpi_ext_vbus_default); -+ dwc_otg_set_param_phy_utmi_width(core_if, -+ dwc_param_phy_utmi_width_default); -+ dwc_otg_set_param_ts_dline(core_if, dwc_param_ts_dline_default); -+ dwc_otg_set_param_i2c_enable(core_if, dwc_param_i2c_enable_default); -+ dwc_otg_set_param_ulpi_fs_ls(core_if, dwc_param_ulpi_fs_ls_default); -+ dwc_otg_set_param_en_multiple_tx_fifo(core_if, -+ dwc_param_en_multiple_tx_fifo_default); -+ for (i = 0; i < 15; i++) { -+ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, -+ dwc_param_dev_perio_tx_fifo_size_default, -+ i); -+ } -+ -+ for (i = 0; i < 15; i++) { -+ dwc_otg_set_param_dev_tx_fifo_size(core_if, -+ dwc_param_dev_tx_fifo_size_default, -+ i); -+ } -+ dwc_otg_set_param_thr_ctl(core_if, dwc_param_thr_ctl_default); -+ dwc_otg_set_param_mpi_enable(core_if, dwc_param_mpi_enable_default); -+ dwc_otg_set_param_pti_enable(core_if, dwc_param_pti_enable_default); -+ dwc_otg_set_param_lpm_enable(core_if, dwc_param_lpm_enable_default); -+ dwc_otg_set_param_ic_usb_cap(core_if, dwc_param_ic_usb_cap_default); -+ dwc_otg_set_param_tx_thr_length(core_if, -+ dwc_param_tx_thr_length_default); -+ dwc_otg_set_param_rx_thr_length(core_if, -+ dwc_param_rx_thr_length_default); -+ dwc_otg_set_param_ahb_thr_ratio(core_if, -+ dwc_param_ahb_thr_ratio_default); -+ dwc_otg_set_param_power_down(core_if, dwc_param_power_down_default); -+ dwc_otg_set_param_reload_ctl(core_if, dwc_param_reload_ctl_default); -+ dwc_otg_set_param_dev_out_nak(core_if, dwc_param_dev_out_nak_default); -+ dwc_otg_set_param_cont_on_bna(core_if, dwc_param_cont_on_bna_default); -+ dwc_otg_set_param_ahb_single(core_if, dwc_param_ahb_single_default); -+ dwc_otg_set_param_otg_ver(core_if, dwc_param_otg_ver_default); -+ dwc_otg_set_param_adp_enable(core_if, dwc_param_adp_enable_default); -+ DWC_PRINTF("Finished setting default values for core params\n"); -+ -+ return 0; -+} -+ -+uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->dma_enable; -+} -+ -+/* Checks if the parameter is outside of its valid range of values */ -+#define DWC_OTG_PARAM_TEST(_param_, _low_, _high_) \ -+ (((_param_) < (_low_)) || \ -+ ((_param_) > (_high_))) -+ -+/* Parameter access functions */ -+int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int valid; -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { -+ DWC_WARN("Wrong value for otg_cap parameter\n"); -+ DWC_WARN("otg_cap parameter must be 0,1 or 2\n"); -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ valid = 1; -+ switch (val) { -+ case DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE: -+ if (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ valid = 0; -+ break; -+ case DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE: -+ if ((core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ && (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) -+ && (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) -+ && (core_if->hwcfg2.b.op_mode != -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) { -+ valid = 0; -+ } -+ break; -+ case DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE: -+ /* always valid */ -+ break; -+ } -+ if (!valid) { -+ if (dwc_otg_param_initialized(core_if->core_params->otg_cap)) { -+ DWC_ERROR -+ ("%d invalid for otg_cap paremter. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (((core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG) -+ || (core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG) -+ || (core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) -+ || (core_if->hwcfg2.b.op_mode == -+ DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST)) ? -+ DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE : -+ DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->otg_cap = val; -+out: -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->otg_cap; -+} -+ -+int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for opt parameter\n"); -+ return -DWC_E_INVALID; -+ } -+ core_if->core_params->opt = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->opt; -+} -+ -+int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for dma enable\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->hwcfg2.b.architecture == 0)) { -+ if (dwc_otg_param_initialized(core_if->core_params->dma_enable)) { -+ DWC_ERROR -+ ("%d invalid for dma_enable paremter. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dma_enable = val; -+ if (val == 0) { -+ dwc_otg_set_param_dma_desc_enable(core_if, 0); -+ } -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dma_enable; -+} -+ -+int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for dma_enable\n"); -+ DWC_WARN("dma_desc_enable must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) -+ && ((dwc_otg_get_param_dma_enable(core_if) == 0) -+ || (core_if->hwcfg4.b.desc_dma == 0))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dma_desc_enable)) { -+ DWC_ERROR -+ ("%d invalid for dma_desc_enable paremter. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ core_if->core_params->dma_desc_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dma_desc_enable; -+} -+ -+int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for host_support_fs_low_power\n"); -+ DWC_WARN("host_support_fs_low_power must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ core_if->core_params->host_support_fs_ls_low_power = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * -+ core_if) -+{ -+ return core_if->core_params->host_support_fs_ls_low_power; -+} -+ -+int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for enable_dynamic_fifo\n"); -+ DWC_WARN("enable_dynamic_fifo must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->hwcfg2.b.dynamic_fifo == 0)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->enable_dynamic_fifo)) { -+ DWC_ERROR -+ ("%d invalid for enable_dynamic_fifo paremter. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ core_if->core_params->enable_dynamic_fifo = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->enable_dynamic_fifo; -+} -+ -+int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 32, 32768)) { -+ DWC_WARN("Wrong value for data_fifo_size\n"); -+ DWC_WARN("data_fifo_size must be 32-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > core_if->hwcfg3.b.dfifo_depth) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->data_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for data_fifo_size parameter. Check HW configuration.\n", -+ val); -+ } -+ val = core_if->hwcfg3.b.dfifo_depth; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->data_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->data_fifo_size; -+} -+ -+int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for dev_rx_fifo_size\n"); -+ DWC_WARN("dev_rx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { -+ if (dwc_otg_param_initialized(core_if->core_params->dev_rx_fifo_size)) { -+ DWC_WARN("%d invalid for dev_rx_fifo_size parameter\n", val); -+ } -+ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_rx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_rx_fifo_size; -+} -+ -+int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for dev_nperio_tx_fifo\n"); -+ DWC_WARN("dev_nperio_tx_fifo must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_nperio_tx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for dev_nperio_tx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> -+ 16); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_nperio_tx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_nperio_tx_fifo_size; -+} -+ -+int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for host_rx_fifo_size\n"); -+ DWC_WARN("host_rx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > DWC_READ_REG32(&core_if->core_global_regs->grxfsiz)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_rx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for host_rx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_rx_fifo_size = val; -+ return retval; -+ -+} -+ -+int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_rx_fifo_size; -+} -+ -+int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for host_nperio_tx_fifo_size\n"); -+ DWC_WARN("host_nperio_tx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> 16)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_nperio_tx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for host_nperio_tx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz) >> -+ 16); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_nperio_tx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_nperio_tx_fifo_size; -+} -+ -+int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 16, 32768)) { -+ DWC_WARN("Wrong value for host_perio_tx_fifo_size\n"); -+ DWC_WARN("host_perio_tx_fifo_size must be 16-32768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > ((core_if->hptxfsiz.d32) >> 16)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_perio_tx_fifo_size)) { -+ DWC_ERROR -+ ("%d invalid for host_perio_tx_fifo_size. Check HW configuration.\n", -+ val); -+ } -+ val = (core_if->hptxfsiz.d32) >> 16; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_perio_tx_fifo_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_perio_tx_fifo_size; -+} -+ -+int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 2047, 524288)) { -+ DWC_WARN("Wrong value for max_transfer_size\n"); -+ DWC_WARN("max_transfer_size must be 2047-524288\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val >= (1 << (core_if->hwcfg3.b.xfer_size_cntr_width + 11))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->max_transfer_size)) { -+ DWC_ERROR -+ ("%d invalid for max_transfer_size. Check HW configuration.\n", -+ val); -+ } -+ val = -+ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 11)) - -+ 1); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->max_transfer_size = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->max_transfer_size; -+} -+ -+int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 15, 511)) { -+ DWC_WARN("Wrong value for max_packet_count\n"); -+ DWC_WARN("max_packet_count must be 15-511\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->max_packet_count)) { -+ DWC_ERROR -+ ("%d invalid for max_packet_count. Check HW configuration.\n", -+ val); -+ } -+ val = -+ ((1 << (core_if->hwcfg3.b.packet_size_cntr_width + 4)) - 1); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->max_packet_count = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->max_packet_count; -+} -+ -+int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 1, 16)) { -+ DWC_WARN("Wrong value for host_channels\n"); -+ DWC_WARN("host_channels must be 1-16\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (core_if->hwcfg2.b.num_host_chan + 1)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_channels)) { -+ DWC_ERROR -+ ("%d invalid for host_channels. Check HW configurations.\n", -+ val); -+ } -+ val = (core_if->hwcfg2.b.num_host_chan + 1); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_channels = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_channels; -+} -+ -+int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 1, 15)) { -+ DWC_WARN("Wrong value for dev_endpoints\n"); -+ DWC_WARN("dev_endpoints must be 1-15\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > (core_if->hwcfg2.b.num_dev_ep)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_endpoints)) { -+ DWC_ERROR -+ ("%d invalid for dev_endpoints. Check HW configurations.\n", -+ val); -+ } -+ val = core_if->hwcfg2.b.num_dev_ep; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_endpoints = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_endpoints; -+} -+ -+int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 2)) { -+ DWC_WARN("Wrong value for phy_type\n"); -+ DWC_WARN("phy_type must be 0,1 or 2\n"); -+ return -DWC_E_INVALID; -+ } -+#ifndef NO_FS_PHY_HW_CHECKS -+ if ((val == DWC_PHY_TYPE_PARAM_UTMI) && -+ ((core_if->hwcfg2.b.hs_phy_type == 1) || -+ (core_if->hwcfg2.b.hs_phy_type == 3))) { -+ valid = 1; -+ } else if ((val == DWC_PHY_TYPE_PARAM_ULPI) && -+ ((core_if->hwcfg2.b.hs_phy_type == 2) || -+ (core_if->hwcfg2.b.hs_phy_type == 3))) { -+ valid = 1; -+ } else if ((val == DWC_PHY_TYPE_PARAM_FS) && -+ (core_if->hwcfg2.b.fs_phy_type == 1)) { -+ valid = 1; -+ } -+ if (!valid) { -+ if (dwc_otg_param_initialized(core_if->core_params->phy_type)) { -+ DWC_ERROR -+ ("%d invalid for phy_type. Check HW configurations.\n", -+ val); -+ } -+ if (core_if->hwcfg2.b.hs_phy_type) { -+ if ((core_if->hwcfg2.b.hs_phy_type == 3) || -+ (core_if->hwcfg2.b.hs_phy_type == 1)) { -+ val = DWC_PHY_TYPE_PARAM_UTMI; -+ } else { -+ val = DWC_PHY_TYPE_PARAM_ULPI; -+ } -+ } -+ retval = -DWC_E_INVALID; -+ } -+#endif -+ core_if->core_params->phy_type = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_type; -+} -+ -+int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for speed parameter\n"); -+ DWC_WARN("max_speed parameter must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ if ((val == 0) -+ && dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS) { -+ if (dwc_otg_param_initialized(core_if->core_params->speed)) { -+ DWC_ERROR -+ ("%d invalid for speed paremter. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (dwc_otg_get_param_phy_type(core_if) == -+ DWC_PHY_TYPE_PARAM_FS ? 1 : 0); -+ retval = -DWC_E_INVALID; -+ } -+ core_if->core_params->speed = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->speed; -+} -+ -+int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN -+ ("Wrong value for host_ls_low_power_phy_clk parameter\n"); -+ DWC_WARN("host_ls_low_power_phy_clk must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ) -+ && (dwc_otg_get_param_phy_type(core_if) == DWC_PHY_TYPE_PARAM_FS)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->host_ls_low_power_phy_clk)) { -+ DWC_ERROR -+ ("%d invalid for host_ls_low_power_phy_clk. Check HW configuration.\n", -+ val); -+ } -+ val = -+ (dwc_otg_get_param_phy_type(core_if) == -+ DWC_PHY_TYPE_PARAM_FS) ? -+ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ : -+ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->host_ls_low_power_phy_clk = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->host_ls_low_power_phy_clk; -+} -+ -+int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for phy_ulpi_ddr\n"); -+ DWC_WARN("phy_upli_ddr must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->phy_ulpi_ddr = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_ulpi_ddr; -+} -+ -+int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for phy_ulpi_ext_vbus\n"); -+ DWC_WARN("phy_ulpi_ext_vbus must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->phy_ulpi_ext_vbus = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_ulpi_ext_vbus; -+} -+ -+int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 8, 8) && DWC_OTG_PARAM_TEST(val, 16, 16)) { -+ DWC_WARN("Wrong valaue for phy_utmi_width\n"); -+ DWC_WARN("phy_utmi_width must be 8 or 16\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->phy_utmi_width = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->phy_utmi_width; -+} -+ -+int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for ulpi_fs_ls\n"); -+ DWC_WARN("ulpi_fs_ls must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->ulpi_fs_ls = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ulpi_fs_ls; -+} -+ -+int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for ts_dline\n"); -+ DWC_WARN("ts_dline must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->ts_dline = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ts_dline; -+} -+ -+int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for i2c_enable\n"); -+ DWC_WARN("i2c_enable must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+#ifndef NO_FS_PHY_HW_CHECK -+ if (val == 1 && core_if->hwcfg3.b.i2c == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->i2c_enable)) { -+ DWC_ERROR -+ ("%d invalid for i2c_enable. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+#endif -+ -+ core_if->core_params->i2c_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->i2c_enable; -+} -+ -+int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val, int fifo_num) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { -+ DWC_WARN("Wrong value for dev_perio_tx_fifo_size\n"); -+ DWC_WARN("dev_perio_tx_fifo_size must be 4-768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > -+ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_perio_tx_fifo_size[fifo_num])) { -+ DWC_ERROR -+ ("`%d' invalid for parameter `dev_perio_fifo_size_%d'. Check HW configuration.\n", -+ val, fifo_num); -+ } -+ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_perio_tx_fifo_size[fifo_num] = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num) -+{ -+ return core_if->core_params->dev_perio_tx_fifo_size[fifo_num]; -+} -+ -+int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong valaue for en_multiple_tx_fifo,\n"); -+ DWC_WARN("en_multiple_tx_fifo must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val == 1 && core_if->hwcfg4.b.ded_fifo_en == 0) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->en_multiple_tx_fifo)) { -+ DWC_ERROR -+ ("%d invalid for parameter en_multiple_tx_fifo. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->en_multiple_tx_fifo = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->en_multiple_tx_fifo; -+} -+ -+int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, int32_t val, -+ int fifo_num) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 4, 768)) { -+ DWC_WARN("Wrong value for dev_tx_fifo_size\n"); -+ DWC_WARN("dev_tx_fifo_size must be 4-768\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val > -+ (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num]))) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->dev_tx_fifo_size[fifo_num])) { -+ DWC_ERROR -+ ("`%d' invalid for parameter `dev_tx_fifo_size_%d'. Check HW configuration.\n", -+ val, fifo_num); -+ } -+ val = (DWC_READ_REG32(&core_if->core_global_regs->dtxfsiz[fifo_num])); -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->dev_tx_fifo_size[fifo_num] = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num) -+{ -+ return core_if->core_params->dev_tx_fifo_size[fifo_num]; -+} -+ -+int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 7)) { -+ DWC_WARN("Wrong value for thr_ctl\n"); -+ DWC_WARN("thr_ctl must be 0-7\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val != 0) && -+ (!dwc_otg_get_param_dma_enable(core_if) || -+ !core_if->hwcfg4.b.ded_fifo_en)) { -+ if (dwc_otg_param_initialized(core_if->core_params->thr_ctl)) { -+ DWC_ERROR -+ ("%d invalid for parameter thr_ctl. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->thr_ctl = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_thr_ctl(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->thr_ctl; -+} -+ -+int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("Wrong value for lpm_enable\n"); -+ DWC_WARN("lpm_enable must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val && !core_if->hwcfg3.b.otg_lpm_en) { -+ if (dwc_otg_param_initialized(core_if->core_params->lpm_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter lpm_enable. Check HW configuration.\n", -+ val); -+ } -+ val = 0; -+ retval = -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->lpm_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->lpm_enable; -+} -+ -+int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { -+ DWC_WARN("Wrong valaue for tx_thr_length\n"); -+ DWC_WARN("tx_thr_length must be 8 - 128\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->tx_thr_length = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_tx_thr_length(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->tx_thr_length; -+} -+ -+int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 8, 128)) { -+ DWC_WARN("Wrong valaue for rx_thr_length\n"); -+ DWC_WARN("rx_thr_length must be 8 - 128\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->rx_thr_length = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_rx_thr_length(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->rx_thr_length; -+} -+ -+int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ if (DWC_OTG_PARAM_TEST(val, 1, 1) && -+ DWC_OTG_PARAM_TEST(val, 4, 4) && -+ DWC_OTG_PARAM_TEST(val, 8, 8) && -+ DWC_OTG_PARAM_TEST(val, 16, 16) && -+ DWC_OTG_PARAM_TEST(val, 32, 32) && -+ DWC_OTG_PARAM_TEST(val, 64, 64) && -+ DWC_OTG_PARAM_TEST(val, 128, 128) && -+ DWC_OTG_PARAM_TEST(val, 256, 256)) { -+ DWC_WARN("`%d' invalid for parameter `dma_burst_size'\n", val); -+ return -DWC_E_INVALID; -+ } -+ core_if->core_params->dma_burst_size = val; -+ return 0; -+} -+ -+int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dma_burst_size; -+} -+ -+int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `pti_enable'\n", val); -+ return -DWC_E_INVALID; -+ } -+ if (val && (core_if->snpsid < OTG_CORE_REV_2_72a)) { -+ if (dwc_otg_param_initialized(core_if->core_params->pti_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter pti_enable. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->pti_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->pti_enable; -+} -+ -+int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `mpi_enable'\n", val); -+ return -DWC_E_INVALID; -+ } -+ if (val && (core_if->hwcfg2.b.multi_proc_int == 0)) { -+ if (dwc_otg_param_initialized(core_if->core_params->mpi_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter mpi_enable. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->mpi_enable = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->mpi_enable; -+} -+ -+int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `adp_enable'\n", val); -+ return -DWC_E_INVALID; -+ } -+ if (val && (core_if->hwcfg3.b.adp_supp == 0)) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->adp_supp_enable)) { -+ DWC_ERROR -+ ("%d invalid for parameter adp_enable. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->adp_supp_enable = val; -+ /*Set OTG version 2.0 in case of enabling ADP*/ -+ if (val) -+ dwc_otg_set_param_otg_ver(core_if, 1); -+ -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->adp_supp_enable; -+} -+ -+int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `ic_usb_cap'\n", val); -+ DWC_WARN("ic_usb_cap must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val && (core_if->hwcfg2.b.otg_enable_ic_usb == 0)) { -+ if (dwc_otg_param_initialized(core_if->core_params->ic_usb_cap)) { -+ DWC_ERROR -+ ("%d invalid for parameter ic_usb_cap. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->ic_usb_cap = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ic_usb_cap; -+} -+ -+int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { -+ DWC_WARN("`%d' invalid for parameter `ahb_thr_ratio'\n", val); -+ DWC_WARN("ahb_thr_ratio must be 0 - 3\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (val -+ && (core_if->snpsid < OTG_CORE_REV_2_81a -+ || !dwc_otg_get_param_thr_ctl(core_if))) { -+ valid = 0; -+ } else if (val -+ && ((dwc_otg_get_param_tx_thr_length(core_if) / (1 << val)) < -+ 4)) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized -+ (core_if->core_params->ahb_thr_ratio)) { -+ DWC_ERROR -+ ("%d invalid for parameter ahb_thr_ratio. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ -+ core_if->core_params->ahb_thr_ratio = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ahb_thr_ratio; -+} -+ -+int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ hwcfg4_data_t hwcfg4 = {.d32 = 0 }; -+ hwcfg4.d32 = DWC_READ_REG32(&core_if->core_global_regs->ghwcfg4); -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 3)) { -+ DWC_WARN("`%d' invalid for parameter `power_down'\n", val); -+ DWC_WARN("power_down must be 0 - 2\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 2) && (core_if->snpsid < OTG_CORE_REV_2_91a)) { -+ valid = 0; -+ } -+ if ((val == 3) -+ && ((core_if->snpsid < OTG_CORE_REV_3_00a) -+ || (hwcfg4.b.xhiber == 0))) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->power_down)) { -+ DWC_ERROR -+ ("%d invalid for parameter power_down. Check HW configuration.\n", -+ val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->power_down = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->power_down; -+} -+ -+int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `reload_ctl'\n", val); -+ DWC_WARN("reload_ctl must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_92a)) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->reload_ctl)) { -+ DWC_ERROR("%d invalid for parameter reload_ctl." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->reload_ctl = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->reload_ctl; -+} -+ -+int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `dev_out_nak'\n", val); -+ DWC_WARN("dev_out_nak must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_93a) || -+ !(core_if->core_params->dma_desc_enable))) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->dev_out_nak)) { -+ DWC_ERROR("%d invalid for parameter dev_out_nak." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->dev_out_nak = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->dev_out_nak; -+} -+ -+int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `cont_on_bna'\n", val); -+ DWC_WARN("cont_on_bna must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && ((core_if->snpsid < OTG_CORE_REV_2_94a) || -+ !(core_if->core_params->dma_desc_enable))) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->cont_on_bna)) { -+ DWC_ERROR("%d invalid for parameter cont_on_bna." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->cont_on_bna = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->cont_on_bna; -+} -+ -+int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ int valid = 1; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `ahb_single'\n", val); -+ DWC_WARN("ahb_single must be 0 or 1\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if ((val == 1) && (core_if->snpsid < OTG_CORE_REV_2_94a)) { -+ valid = 0; -+ } -+ if (valid == 0) { -+ if (dwc_otg_param_initialized(core_if->core_params->ahb_single)) { -+ DWC_ERROR("%d invalid for parameter ahb_single." -+ "Check HW configuration.\n", val); -+ } -+ retval = -DWC_E_INVALID; -+ val = 0; -+ } -+ core_if->core_params->ahb_single = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->ahb_single; -+} -+ -+int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val) -+{ -+ int retval = 0; -+ -+ if (DWC_OTG_PARAM_TEST(val, 0, 1)) { -+ DWC_WARN("`%d' invalid for parameter `otg_ver'\n", val); -+ DWC_WARN -+ ("otg_ver must be 0(for OTG 1.3 support) or 1(for OTG 2.0 support)\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ core_if->core_params->otg_ver = val; -+ return retval; -+} -+ -+int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->core_params->otg_ver; -+} -+ -+uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if) -+{ -+ gotgctl_data_t otgctl; -+ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ return otgctl.b.hstnegscs; -+} -+ -+uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if) -+{ -+ gotgctl_data_t otgctl; -+ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ return otgctl.b.sesreqscs; -+} -+ -+void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ if(core_if->otg_ver == 0) { -+ gotgctl_data_t otgctl; -+ otgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ otgctl.b.hnpreq = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, otgctl.d32); -+ } else { -+ core_if->otg_sts = val; -+ } -+} -+ -+uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->snpsid; -+} -+ -+uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ return gintsts.b.curmode; -+} -+ -+uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ return usbcfg.b.hnpcap; -+} -+ -+void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ usbcfg.b.hnpcap = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); -+} -+ -+uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ return usbcfg.b.srpcap; -+} -+ -+void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ gusbcfg_data_t usbcfg; -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ usbcfg.b.srpcap = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, usbcfg.d32); -+} -+ -+uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if) -+{ -+ dcfg_data_t dcfg; -+ /* originally: dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); */ -+ -+ dcfg.d32 = -1; //GRAYG -+ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)\n", __func__, core_if); -+ if (NULL == core_if) -+ DWC_ERROR("reg request with NULL core_if\n"); -+ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)\n", __func__, -+ core_if, core_if->dev_if); -+ if (NULL == core_if->dev_if) -+ DWC_ERROR("reg request with NULL dev_if\n"); -+ DWC_DEBUGPL(DBG_CILV, "%s - core_if(%p)->dev_if(%p)->" -+ "dev_global_regs(%p)\n", __func__, -+ core_if, core_if->dev_if, -+ core_if->dev_if->dev_global_regs); -+ if (NULL == core_if->dev_if->dev_global_regs) -+ DWC_ERROR("reg request with NULL dev_global_regs\n"); -+ else { -+ DWC_DEBUGPL(DBG_CILV, "%s - &core_if(%p)->dev_if(%p)->" -+ "dev_global_regs(%p)->dcfg = %p\n", __func__, -+ core_if, core_if->dev_if, -+ core_if->dev_if->dev_global_regs, -+ &core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ } -+ return dcfg.b.devspd; -+} -+ -+void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ dcfg_data_t dcfg; -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ dcfg.b.devspd = val; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); -+} -+ -+uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ return hprt0.b.prtconnsts; -+} -+ -+uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ return dsts.b.enumspd; -+} -+ -+uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ return hprt0.b.prtpwr; -+ -+} -+ -+uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if) -+{ -+ return core_if->hibernation_suspend; -+} -+ -+void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = val; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+} -+ -+uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ return hprt0.b.prtsusp; -+ -+} -+ -+void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = val; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+} -+ -+uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if) -+{ -+ hfir_data_t hfir; -+ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); -+ return hfir.b.frint; -+ -+} -+ -+void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hfir_data_t hfir; -+ uint32_t fram_int; -+ fram_int = calc_frame_interval(core_if); -+ hfir.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hfir); -+ if (!core_if->core_params->reload_ctl) { -+ DWC_WARN("\nCannot reload HFIR register.HFIR.HFIRRldCtrl bit is" -+ "not set to 1.\nShould load driver with reload_ctl=1" -+ " module parameter\n"); -+ return; -+ } -+ switch (fram_int) { -+ case 3750: -+ if ((val < 3350) || (val > 4150)) { -+ DWC_WARN("HFIR interval for HS core and 30 MHz" -+ "clock freq should be from 3350 to 4150\n"); -+ return; -+ } -+ break; -+ case 30000: -+ if ((val < 26820) || (val > 33180)) { -+ DWC_WARN("HFIR interval for FS/LS core and 30 MHz" -+ "clock freq should be from 26820 to 33180\n"); -+ return; -+ } -+ break; -+ case 6000: -+ if ((val < 5360) || (val > 6640)) { -+ DWC_WARN("HFIR interval for HS core and 48 MHz" -+ "clock freq should be from 5360 to 6640\n"); -+ return; -+ } -+ break; -+ case 48000: -+ if ((val < 42912) || (val > 53088)) { -+ DWC_WARN("HFIR interval for FS/LS core and 48 MHz" -+ "clock freq should be from 42912 to 53088\n"); -+ return; -+ } -+ break; -+ case 7500: -+ if ((val < 6700) || (val > 8300)) { -+ DWC_WARN("HFIR interval for HS core and 60 MHz" -+ "clock freq should be from 6700 to 8300\n"); -+ return; -+ } -+ break; -+ case 60000: -+ if ((val < 53640) || (val > 65536)) { -+ DWC_WARN("HFIR interval for FS/LS core and 60 MHz" -+ "clock freq should be from 53640 to 65536\n"); -+ return; -+ } -+ break; -+ default: -+ DWC_WARN("Unknown frame interval\n"); -+ return; -+ break; -+ -+ } -+ hfir.b.frint = val; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hfir, hfir.d32); -+} -+ -+uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if) -+{ -+ hcfg_data_t hcfg; -+ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ return hcfg.b.modechtimen; -+ -+} -+ -+void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hcfg_data_t hcfg; -+ hcfg.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->hcfg); -+ hcfg.b.modechtimen = val; -+ DWC_WRITE_REG32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+} -+ -+void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtres = val; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+} -+ -+uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if) -+{ -+ dctl_data_t dctl; -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ return dctl.b.rmtwkupsig; -+} -+ -+uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ -+ DWC_ASSERT(! -+ ((core_if->lx_state == DWC_OTG_L1) ^ lpmcfg.b.prt_sleep_sts), -+ "lx_state = %d, lmpcfg.prt_sleep_sts = %d\n", -+ core_if->lx_state, lpmcfg.b.prt_sleep_sts); -+ -+ return lpmcfg.b.prt_sleep_sts; -+} -+ -+uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.rem_wkup_en; -+} -+ -+uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.appl_resp; -+} -+ -+void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.appl_resp = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+} -+ -+uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.hsic_connect; -+} -+ -+void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.hsic_connect = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+} -+ -+uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ return lpmcfg.b.inv_sel_hsic; -+ -+} -+ -+void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.inv_sel_hsic = val; -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+} -+ -+uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+} -+ -+void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgctl, val); -+} -+ -+uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+} -+ -+void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, val); -+} -+ -+uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+} -+ -+void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->grxfsiz, val); -+} -+ -+uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gnptxfsiz); -+} -+ -+void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gnptxfsiz, val); -+} -+ -+uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->gpvndctl); -+} -+ -+void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gpvndctl, val); -+} -+ -+uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->ggpio); -+} -+ -+void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, val); -+} -+ -+uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(core_if->host_if->hprt0); -+ -+} -+ -+void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(core_if->host_if->hprt0, val); -+} -+ -+uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->guid); -+} -+ -+void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val) -+{ -+ DWC_WRITE_REG32(&core_if->core_global_regs->guid, val); -+} -+ -+uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if) -+{ -+ return DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz); -+} -+ -+uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if) -+{ -+ return ((core_if->otg_ver == 1) ? (uint16_t)0x0200 : (uint16_t)0x0103); -+} -+ -+/** -+ * Start the SRP timer to detect when the SRP does not complete within -+ * 6 seconds. -+ * -+ * @param core_if the pointer to core_if strucure. -+ */ -+void dwc_otg_pcd_start_srp_timer(dwc_otg_core_if_t * core_if) -+{ -+ core_if->srp_timer_started = 1; -+ DWC_TIMER_SCHEDULE(core_if->srp_timer, 6000 /* 6 secs */ ); -+} -+ -+void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t *addr = (uint32_t *) & (core_if->core_global_regs->gotgctl); -+ gotgctl_data_t mem; -+ gotgctl_data_t val; -+ -+ val.d32 = DWC_READ_REG32(addr); -+ if (val.b.sesreq) { -+ DWC_ERROR("Session Request Already active!\n"); -+ return; -+ } -+ -+ DWC_INFO("Session Request Initated\n"); //NOTICE -+ mem.d32 = DWC_READ_REG32(addr); -+ mem.b.sesreq = 1; -+ DWC_WRITE_REG32(addr, mem.d32); -+ -+ /* Start the SRP timer */ -+ dwc_otg_pcd_start_srp_timer(core_if); -+ return; -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.h b/drivers/usb/host/dwc_otg/dwc_otg_cil.h -new file mode 100644 -index 0000000000000000000000000000000000000000..79dbf8374f023e262e3bfb755ff0f67604a456cb ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.h -@@ -0,0 +1,1464 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $ -+ * $Revision: #123 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#if !defined(__DWC_CIL_H__) -+#define __DWC_CIL_H__ -+ -+#include "dwc_list.h" -+#include "dwc_otg_dbg.h" -+#include "dwc_otg_regs.h" -+ -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_adp.h" -+ -+/** -+ * @file -+ * This file contains the interface to the Core Interface Layer. -+ */ -+ -+#ifdef DWC_UTE_CFI -+ -+#define MAX_DMA_DESCS_PER_EP 256 -+ -+/** -+ * Enumeration for the data buffer mode -+ */ -+typedef enum _data_buffer_mode { -+ BM_STANDARD = 0, /* data buffer is in normal mode */ -+ BM_SG = 1, /* data buffer uses the scatter/gather mode */ -+ BM_CONCAT = 2, /* data buffer uses the concatenation mode */ -+ BM_CIRCULAR = 3, /* data buffer uses the circular DMA mode */ -+ BM_ALIGN = 4 /* data buffer is in buffer alignment mode */ -+} data_buffer_mode_e; -+#endif //DWC_UTE_CFI -+ -+/** Macros defined for DWC OTG HW Release version */ -+ -+#define OTG_CORE_REV_2_60a 0x4F54260A -+#define OTG_CORE_REV_2_71a 0x4F54271A -+#define OTG_CORE_REV_2_72a 0x4F54272A -+#define OTG_CORE_REV_2_80a 0x4F54280A -+#define OTG_CORE_REV_2_81a 0x4F54281A -+#define OTG_CORE_REV_2_90a 0x4F54290A -+#define OTG_CORE_REV_2_91a 0x4F54291A -+#define OTG_CORE_REV_2_92a 0x4F54292A -+#define OTG_CORE_REV_2_93a 0x4F54293A -+#define OTG_CORE_REV_2_94a 0x4F54294A -+#define OTG_CORE_REV_3_00a 0x4F54300A -+ -+/** -+ * Information for each ISOC packet. -+ */ -+typedef struct iso_pkt_info { -+ uint32_t offset; -+ uint32_t length; -+ int32_t status; -+} iso_pkt_info_t; -+ -+/** -+ * The dwc_ep structure represents the state of a single -+ * endpoint when acting in device mode. It contains the data items -+ * needed for an endpoint to be activated and transfer packets. -+ */ -+typedef struct dwc_ep { -+ /** EP number used for register address lookup */ -+ uint8_t num; -+ /** EP direction 0 = OUT */ -+ unsigned is_in:1; -+ /** EP active. */ -+ unsigned active:1; -+ -+ /** -+ * Periodic Tx FIFO # for IN EPs For INTR EP set to 0 to use non-periodic -+ * Tx FIFO. If dedicated Tx FIFOs are enabled Tx FIFO # FOR IN EPs*/ -+ unsigned tx_fifo_num:4; -+ /** EP type: 0 - Control, 1 - ISOC, 2 - BULK, 3 - INTR */ -+ unsigned type:2; -+#define DWC_OTG_EP_TYPE_CONTROL 0 -+#define DWC_OTG_EP_TYPE_ISOC 1 -+#define DWC_OTG_EP_TYPE_BULK 2 -+#define DWC_OTG_EP_TYPE_INTR 3 -+ -+ /** DATA start PID for INTR and BULK EP */ -+ unsigned data_pid_start:1; -+ /** Frame (even/odd) for ISOC EP */ -+ unsigned even_odd_frame:1; -+ /** Max Packet bytes */ -+ unsigned maxpacket:11; -+ -+ /** Max Transfer size */ -+ uint32_t maxxfer; -+ -+ /** @name Transfer state */ -+ /** @{ */ -+ -+ /** -+ * Pointer to the beginning of the transfer buffer -- do not modify -+ * during transfer. -+ */ -+ -+ dwc_dma_t dma_addr; -+ -+ dwc_dma_t dma_desc_addr; -+ dwc_otg_dev_dma_desc_t *desc_addr; -+ -+ uint8_t *start_xfer_buff; -+ /** pointer to the transfer buffer */ -+ uint8_t *xfer_buff; -+ /** Number of bytes to transfer */ -+ unsigned xfer_len:19; -+ /** Number of bytes transferred. */ -+ unsigned xfer_count:19; -+ /** Sent ZLP */ -+ unsigned sent_zlp:1; -+ /** Total len for control transfer */ -+ unsigned total_len:19; -+ -+ /** stall clear flag */ -+ unsigned stall_clear_flag:1; -+ -+ /** SETUP pkt cnt rollover flag for EP0 out*/ -+ unsigned stp_rollover; -+ -+#ifdef DWC_UTE_CFI -+ /* The buffer mode */ -+ data_buffer_mode_e buff_mode; -+ -+ /* The chain of DMA descriptors. -+ * MAX_DMA_DESCS_PER_EP will be allocated for each active EP. -+ */ -+ dwc_otg_dma_desc_t *descs; -+ -+ /* The DMA address of the descriptors chain start */ -+ dma_addr_t descs_dma_addr; -+ /** This variable stores the length of the last enqueued request */ -+ uint32_t cfi_req_len; -+#endif //DWC_UTE_CFI -+ -+/** Max DMA Descriptor count for any EP */ -+#define MAX_DMA_DESC_CNT 256 -+ /** Allocated DMA Desc count */ -+ uint32_t desc_cnt; -+ -+ /** bInterval */ -+ uint32_t bInterval; -+ /** Next frame num to setup next ISOC transfer */ -+ uint32_t frame_num; -+ /** Indicates SOF number overrun in DSTS */ -+ uint8_t frm_overrun; -+ -+#ifdef DWC_UTE_PER_IO -+ /** Next frame num for which will be setup DMA Desc */ -+ uint32_t xiso_frame_num; -+ /** bInterval */ -+ uint32_t xiso_bInterval; -+ /** Count of currently active transfers - shall be either 0 or 1 */ -+ int xiso_active_xfers; -+ int xiso_queued_xfers; -+#endif -+#ifdef DWC_EN_ISOC -+ /** -+ * Variables specific for ISOC EPs -+ * -+ */ -+ /** DMA addresses of ISOC buffers */ -+ dwc_dma_t dma_addr0; -+ dwc_dma_t dma_addr1; -+ -+ dwc_dma_t iso_dma_desc_addr; -+ dwc_otg_dev_dma_desc_t *iso_desc_addr; -+ -+ /** pointer to the transfer buffers */ -+ uint8_t *xfer_buff0; -+ uint8_t *xfer_buff1; -+ -+ /** number of ISOC Buffer is processing */ -+ uint32_t proc_buf_num; -+ /** Interval of ISOC Buffer processing */ -+ uint32_t buf_proc_intrvl; -+ /** Data size for regular frame */ -+ uint32_t data_per_frame; -+ -+ /* todo - pattern data support is to be implemented in the future */ -+ /** Data size for pattern frame */ -+ uint32_t data_pattern_frame; -+ /** Frame number of pattern data */ -+ uint32_t sync_frame; -+ -+ /** bInterval */ -+ uint32_t bInterval; -+ /** ISO Packet number per frame */ -+ uint32_t pkt_per_frm; -+ /** Next frame num for which will be setup DMA Desc */ -+ uint32_t next_frame; -+ /** Number of packets per buffer processing */ -+ uint32_t pkt_cnt; -+ /** Info for all isoc packets */ -+ iso_pkt_info_t *pkt_info; -+ /** current pkt number */ -+ uint32_t cur_pkt; -+ /** current pkt number */ -+ uint8_t *cur_pkt_addr; -+ /** current pkt number */ -+ uint32_t cur_pkt_dma_addr; -+#endif /* DWC_EN_ISOC */ -+ -+/** @} */ -+} dwc_ep_t; -+ -+/* -+ * Reasons for halting a host channel. -+ */ -+typedef enum dwc_otg_halt_status { -+ DWC_OTG_HC_XFER_NO_HALT_STATUS, -+ DWC_OTG_HC_XFER_COMPLETE, -+ DWC_OTG_HC_XFER_URB_COMPLETE, -+ DWC_OTG_HC_XFER_ACK, -+ DWC_OTG_HC_XFER_NAK, -+ DWC_OTG_HC_XFER_NYET, -+ DWC_OTG_HC_XFER_STALL, -+ DWC_OTG_HC_XFER_XACT_ERR, -+ DWC_OTG_HC_XFER_FRAME_OVERRUN, -+ DWC_OTG_HC_XFER_BABBLE_ERR, -+ DWC_OTG_HC_XFER_DATA_TOGGLE_ERR, -+ DWC_OTG_HC_XFER_AHB_ERR, -+ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE, -+ DWC_OTG_HC_XFER_URB_DEQUEUE -+} dwc_otg_halt_status_e; -+ -+/** -+ * Host channel descriptor. This structure represents the state of a single -+ * host channel when acting in host mode. It contains the data items needed to -+ * transfer packets to an endpoint via a host channel. -+ */ -+typedef struct dwc_hc { -+ /** Host channel number used for register address lookup */ -+ uint8_t hc_num; -+ -+ /** Device to access */ -+ unsigned dev_addr:7; -+ -+ /** EP to access */ -+ unsigned ep_num:4; -+ -+ /** EP direction. 0: OUT, 1: IN */ -+ unsigned ep_is_in:1; -+ -+ /** -+ * EP speed. -+ * One of the following values: -+ * - DWC_OTG_EP_SPEED_LOW -+ * - DWC_OTG_EP_SPEED_FULL -+ * - DWC_OTG_EP_SPEED_HIGH -+ */ -+ unsigned speed:2; -+#define DWC_OTG_EP_SPEED_LOW 0 -+#define DWC_OTG_EP_SPEED_FULL 1 -+#define DWC_OTG_EP_SPEED_HIGH 2 -+ -+ /** -+ * Endpoint type. -+ * One of the following values: -+ * - DWC_OTG_EP_TYPE_CONTROL: 0 -+ * - DWC_OTG_EP_TYPE_ISOC: 1 -+ * - DWC_OTG_EP_TYPE_BULK: 2 -+ * - DWC_OTG_EP_TYPE_INTR: 3 -+ */ -+ unsigned ep_type:2; -+ -+ /** Max packet size in bytes */ -+ unsigned max_packet:11; -+ -+ /** -+ * PID for initial transaction. -+ * 0: DATA0,
-+ * 1: DATA2,
-+ * 2: DATA1,
-+ * 3: MDATA (non-Control EP), -+ * SETUP (Control EP) -+ */ -+ unsigned data_pid_start:2; -+#define DWC_OTG_HC_PID_DATA0 0 -+#define DWC_OTG_HC_PID_DATA2 1 -+#define DWC_OTG_HC_PID_DATA1 2 -+#define DWC_OTG_HC_PID_MDATA 3 -+#define DWC_OTG_HC_PID_SETUP 3 -+ -+ /** Number of periodic transactions per (micro)frame */ -+ unsigned multi_count:2; -+ -+ /** @name Transfer State */ -+ /** @{ */ -+ -+ /** Pointer to the current transfer buffer position. */ -+ uint8_t *xfer_buff; -+ /** -+ * In Buffer DMA mode this buffer will be used -+ * if xfer_buff is not DWORD aligned. -+ */ -+ dwc_dma_t align_buff; -+ /** Total number of bytes to transfer. */ -+ uint32_t xfer_len; -+ /** Number of bytes transferred so far. */ -+ uint32_t xfer_count; -+ /** Packet count at start of transfer.*/ -+ uint16_t start_pkt_count; -+ -+ /** -+ * Flag to indicate whether the transfer has been started. Set to 1 if -+ * it has been started, 0 otherwise. -+ */ -+ uint8_t xfer_started; -+ -+ /** -+ * Set to 1 to indicate that a PING request should be issued on this -+ * channel. If 0, process normally. -+ */ -+ uint8_t do_ping; -+ -+ /** -+ * Set to 1 to indicate that the error count for this transaction is -+ * non-zero. Set to 0 if the error count is 0. -+ */ -+ uint8_t error_state; -+ -+ /** -+ * Set to 1 to indicate that this channel should be halted the next -+ * time a request is queued for the channel. This is necessary in -+ * slave mode if no request queue space is available when an attempt -+ * is made to halt the channel. -+ */ -+ uint8_t halt_on_queue; -+ -+ /** -+ * Set to 1 if the host channel has been halted, but the core is not -+ * finished flushing queued requests. Otherwise 0. -+ */ -+ uint8_t halt_pending; -+ -+ /** -+ * Reason for halting the host channel. -+ */ -+ dwc_otg_halt_status_e halt_status; -+ -+ /* -+ * Split settings for the host channel -+ */ -+ uint8_t do_split; /**< Enable split for the channel */ -+ uint8_t complete_split; /**< Enable complete split */ -+ uint8_t hub_addr; /**< Address of high speed hub */ -+ -+ uint8_t port_addr; /**< Port of the low/full speed device */ -+ /** Split transaction position -+ * One of the following values: -+ * - DWC_HCSPLIT_XACTPOS_MID -+ * - DWC_HCSPLIT_XACTPOS_BEGIN -+ * - DWC_HCSPLIT_XACTPOS_END -+ * - DWC_HCSPLIT_XACTPOS_ALL */ -+ uint8_t xact_pos; -+ -+ /** Set when the host channel does a short read. */ -+ uint8_t short_read; -+ -+ /** -+ * Number of requests issued for this channel since it was assigned to -+ * the current transfer (not counting PINGs). -+ */ -+ uint8_t requests; -+ -+ /** -+ * Queue Head for the transfer being processed by this channel. -+ */ -+ struct dwc_otg_qh *qh; -+ -+ /** @} */ -+ -+ /** Entry in list of host channels. */ -+ DWC_CIRCLEQ_ENTRY(dwc_hc) hc_list_entry; -+ -+ /** @name Descriptor DMA support */ -+ /** @{ */ -+ -+ /** Number of Transfer Descriptors */ -+ uint16_t ntd; -+ -+ /** Descriptor List DMA address */ -+ dwc_dma_t desc_list_addr; -+ -+ /** Scheduling micro-frame bitmap. */ -+ uint8_t schinfo; -+ -+ /** @} */ -+} dwc_hc_t; -+ -+/** -+ * The following parameters may be specified when starting the module. These -+ * parameters define how the DWC_otg controller should be configured. -+ */ -+typedef struct dwc_otg_core_params { -+ int32_t opt; -+ -+ /** -+ * Specifies the OTG capabilities. The driver will automatically -+ * detect the value for this parameter if none is specified. -+ * 0 - HNP and SRP capable (default) -+ * 1 - SRP Only capable -+ * 2 - No HNP/SRP capable -+ */ -+ int32_t otg_cap; -+ -+ /** -+ * Specifies whether to use slave or DMA mode for accessing the data -+ * FIFOs. The driver will automatically detect the value for this -+ * parameter if none is specified. -+ * 0 - Slave -+ * 1 - DMA (default, if available) -+ */ -+ int32_t dma_enable; -+ -+ /** -+ * When DMA mode is enabled specifies whether to use address DMA or DMA -+ * Descriptor mode for accessing the data FIFOs in device mode. The driver -+ * will automatically detect the value for this if none is specified. -+ * 0 - address DMA -+ * 1 - DMA Descriptor(default, if available) -+ */ -+ int32_t dma_desc_enable; -+ /** The DMA Burst size (applicable only for External DMA -+ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) -+ */ -+ int32_t dma_burst_size; /* Translate this to GAHBCFG values */ -+ -+ /** -+ * Specifies the maximum speed of operation in host and device mode. -+ * The actual speed depends on the speed of the attached device and -+ * the value of phy_type. The actual speed depends on the speed of the -+ * attached device. -+ * 0 - High Speed (default) -+ * 1 - Full Speed -+ */ -+ int32_t speed; -+ /** Specifies whether low power mode is supported when attached -+ * to a Full Speed or Low Speed device in host mode. -+ * 0 - Don't support low power mode (default) -+ * 1 - Support low power mode -+ */ -+ int32_t host_support_fs_ls_low_power; -+ -+ /** Specifies the PHY clock rate in low power mode when connected to a -+ * Low Speed device in host mode. This parameter is applicable only if -+ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS -+ * then defaults to 6 MHZ otherwise 48 MHZ. -+ * -+ * 0 - 48 MHz -+ * 1 - 6 MHz -+ */ -+ int32_t host_ls_low_power_phy_clk; -+ -+ /** -+ * 0 - Use cC FIFO size parameters -+ * 1 - Allow dynamic FIFO sizing (default) -+ */ -+ int32_t enable_dynamic_fifo; -+ -+ /** Total number of 4-byte words in the data FIFO memory. This -+ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic -+ * Tx FIFOs. -+ * 32 to 32768 (default 8192) -+ * Note: The total FIFO memory depth in the FPGA configuration is 8192. -+ */ -+ int32_t data_fifo_size; -+ -+ /** Number of 4-byte words in the Rx FIFO in device mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1064) -+ */ -+ int32_t dev_rx_fifo_size; -+ -+ /** Number of 4-byte words in the non-periodic Tx FIFO in device mode -+ * when dynamic FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t dev_nperio_tx_fifo_size; -+ -+ /** Number of 4-byte words in each of the periodic Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; -+ -+ /** Number of 4-byte words in the Rx FIFO in host mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t host_rx_fifo_size; -+ -+ /** Number of 4-byte words in the non-periodic Tx FIFO in host mode -+ * when Dynamic FIFO sizing is enabled in the core. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t host_nperio_tx_fifo_size; -+ -+ /** Number of 4-byte words in the host periodic Tx FIFO when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+ int32_t host_perio_tx_fifo_size; -+ -+ /** The maximum transfer size supported in bytes. -+ * 2047 to 65,535 (default 65,535) -+ */ -+ int32_t max_transfer_size; -+ -+ /** The maximum number of packets in a transfer. -+ * 15 to 511 (default 511) -+ */ -+ int32_t max_packet_count; -+ -+ /** The number of host channel registers to use. -+ * 1 to 16 (default 12) -+ * Note: The FPGA configuration supports a maximum of 12 host channels. -+ */ -+ int32_t host_channels; -+ -+ /** The number of endpoints in addition to EP0 available for device -+ * mode operations. -+ * 1 to 15 (default 6 IN and OUT) -+ * Note: The FPGA configuration supports a maximum of 6 IN and OUT -+ * endpoints in addition to EP0. -+ */ -+ int32_t dev_endpoints; -+ -+ /** -+ * Specifies the type of PHY interface to use. By default, the driver -+ * will automatically detect the phy_type. -+ * -+ * 0 - Full Speed PHY -+ * 1 - UTMI+ (default) -+ * 2 - ULPI -+ */ -+ int32_t phy_type; -+ -+ /** -+ * Specifies the UTMI+ Data Width. This parameter is -+ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI -+ * PHY_TYPE, this parameter indicates the data width between -+ * the MAC and the ULPI Wrapper.) Also, this parameter is -+ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set -+ * to "8 and 16 bits", meaning that the core has been -+ * configured to work at either data path width. -+ * -+ * 8 or 16 bits (default 16) -+ */ -+ int32_t phy_utmi_width; -+ -+ /** -+ * Specifies whether the ULPI operates at double or single -+ * data rate. This parameter is only applicable if PHY_TYPE is -+ * ULPI. -+ * -+ * 0 - single data rate ULPI interface with 8 bit wide data -+ * bus (default) -+ * 1 - double data rate ULPI interface with 4 bit wide data -+ * bus -+ */ -+ int32_t phy_ulpi_ddr; -+ -+ /** -+ * Specifies whether to use the internal or external supply to -+ * drive the vbus with a ULPI phy. -+ */ -+ int32_t phy_ulpi_ext_vbus; -+ -+ /** -+ * Specifies whether to use the I2Cinterface for full speed PHY. This -+ * parameter is only applicable if PHY_TYPE is FS. -+ * 0 - No (default) -+ * 1 - Yes -+ */ -+ int32_t i2c_enable; -+ -+ int32_t ulpi_fs_ls; -+ -+ int32_t ts_dline; -+ -+ /** -+ * Specifies whether dedicated transmit FIFOs are -+ * enabled for non periodic IN endpoints in device mode -+ * 0 - No -+ * 1 - Yes -+ */ -+ int32_t en_multiple_tx_fifo; -+ -+ /** Number of 4-byte words in each of the Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; -+ -+ /** Thresholding enable flag- -+ * bit 0 - enable non-ISO Tx thresholding -+ * bit 1 - enable ISO Tx thresholding -+ * bit 2 - enable Rx thresholding -+ */ -+ uint32_t thr_ctl; -+ -+ /** Thresholding length for Tx -+ * FIFOs in 32 bit DWORDs -+ */ -+ uint32_t tx_thr_length; -+ -+ /** Thresholding length for Rx -+ * FIFOs in 32 bit DWORDs -+ */ -+ uint32_t rx_thr_length; -+ -+ /** -+ * Specifies whether LPM (Link Power Management) support is enabled -+ */ -+ int32_t lpm_enable; -+ -+ /** Per Transfer Interrupt -+ * mode enable flag -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t pti_enable; -+ -+ /** Multi Processor Interrupt -+ * mode enable flag -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t mpi_enable; -+ -+ /** IS_USB Capability -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t ic_usb_cap; -+ -+ /** AHB Threshold Ratio -+ * 2'b00 AHB Threshold = MAC Threshold -+ * 2'b01 AHB Threshold = 1/2 MAC Threshold -+ * 2'b10 AHB Threshold = 1/4 MAC Threshold -+ * 2'b11 AHB Threshold = 1/8 MAC Threshold -+ */ -+ int32_t ahb_thr_ratio; -+ -+ /** ADP Support -+ * 1 - Enabled -+ * 0 - Disabled -+ */ -+ int32_t adp_supp_enable; -+ -+ /** HFIR Reload Control -+ * 0 - The HFIR cannot be reloaded dynamically. -+ * 1 - Allow dynamic reloading of the HFIR register during runtime. -+ */ -+ int32_t reload_ctl; -+ -+ /** DCFG: Enable device Out NAK -+ * 0 - The core does not set NAK after Bulk Out transfer complete. -+ * 1 - The core sets NAK after Bulk OUT transfer complete. -+ */ -+ int32_t dev_out_nak; -+ -+ /** DCFG: Enable Continue on BNA -+ * After receiving BNA interrupt the core disables the endpoint,when the -+ * endpoint is re-enabled by the application the core starts processing -+ * 0 - from the DOEPDMA descriptor -+ * 1 - from the descriptor which received the BNA. -+ */ -+ int32_t cont_on_bna; -+ -+ /** GAHBCFG: AHB Single Support -+ * This bit when programmed supports SINGLE transfers for remainder -+ * data in a transfer for DMA mode of operation. -+ * 0 - in this case the remainder data will be sent using INCR burst size. -+ * 1 - in this case the remainder data will be sent using SINGLE burst size. -+ */ -+ int32_t ahb_single; -+ -+ /** Core Power down mode -+ * 0 - No Power Down is enabled -+ * 1 - Reserved -+ * 2 - Complete Power Down (Hibernation) -+ */ -+ int32_t power_down; -+ -+ /** OTG revision supported -+ * 0 - OTG 1.3 revision -+ * 1 - OTG 2.0 revision -+ */ -+ int32_t otg_ver; -+ -+} dwc_otg_core_params_t; -+ -+#ifdef DEBUG -+struct dwc_otg_core_if; -+typedef struct hc_xfer_info { -+ struct dwc_otg_core_if *core_if; -+ dwc_hc_t *hc; -+} hc_xfer_info_t; -+#endif -+ -+typedef struct ep_xfer_info { -+ struct dwc_otg_core_if *core_if; -+ dwc_ep_t *ep; -+ uint8_t state; -+} ep_xfer_info_t; -+/* -+ * Device States -+ */ -+typedef enum dwc_otg_lx_state { -+ /** On state */ -+ DWC_OTG_L0, -+ /** LPM sleep state*/ -+ DWC_OTG_L1, -+ /** USB suspend state*/ -+ DWC_OTG_L2, -+ /** Off state*/ -+ DWC_OTG_L3 -+} dwc_otg_lx_state_e; -+ -+struct dwc_otg_global_regs_backup { -+ uint32_t gotgctl_local; -+ uint32_t gintmsk_local; -+ uint32_t gahbcfg_local; -+ uint32_t gusbcfg_local; -+ uint32_t grxfsiz_local; -+ uint32_t gnptxfsiz_local; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ uint32_t glpmcfg_local; -+#endif -+ uint32_t gi2cctl_local; -+ uint32_t hptxfsiz_local; -+ uint32_t pcgcctl_local; -+ uint32_t gdfifocfg_local; -+ uint32_t dtxfsiz_local[MAX_EPS_CHANNELS]; -+ uint32_t gpwrdn_local; -+ uint32_t xhib_pcgcctl; -+ uint32_t xhib_gpwrdn; -+}; -+ -+struct dwc_otg_host_regs_backup { -+ uint32_t hcfg_local; -+ uint32_t haintmsk_local; -+ uint32_t hcintmsk_local[MAX_EPS_CHANNELS]; -+ uint32_t hprt0_local; -+ uint32_t hfir_local; -+}; -+ -+struct dwc_otg_dev_regs_backup { -+ uint32_t dcfg; -+ uint32_t dctl; -+ uint32_t daintmsk; -+ uint32_t diepmsk; -+ uint32_t doepmsk; -+ uint32_t diepctl[MAX_EPS_CHANNELS]; -+ uint32_t dieptsiz[MAX_EPS_CHANNELS]; -+ uint32_t diepdma[MAX_EPS_CHANNELS]; -+}; -+/** -+ * The dwc_otg_core_if structure contains information needed to manage -+ * the DWC_otg controller acting in either host or device mode. It -+ * represents the programming view of the controller as a whole. -+ */ -+struct dwc_otg_core_if { -+ /** Parameters that define how the core should be configured.*/ -+ dwc_otg_core_params_t *core_params; -+ -+ /** Core Global registers starting at offset 000h. */ -+ dwc_otg_core_global_regs_t *core_global_regs; -+ -+ /** Device-specific information */ -+ dwc_otg_dev_if_t *dev_if; -+ /** Host-specific information */ -+ dwc_otg_host_if_t *host_if; -+ -+ /** Value from SNPSID register */ -+ uint32_t snpsid; -+ -+ /* -+ * Set to 1 if the core PHY interface bits in USBCFG have been -+ * initialized. -+ */ -+ uint8_t phy_init_done; -+ -+ /* -+ * SRP Success flag, set by srp success interrupt in FS I2C mode -+ */ -+ uint8_t srp_success; -+ uint8_t srp_timer_started; -+ /** Timer for SRP. If it expires before SRP is successful -+ * clear the SRP. */ -+ dwc_timer_t *srp_timer; -+ -+#ifdef DWC_DEV_SRPCAP -+ /* This timer is needed to power on the hibernated host core if SRP is not -+ * initiated on connected SRP capable device for limited period of time -+ */ -+ uint8_t pwron_timer_started; -+ dwc_timer_t *pwron_timer; -+#endif -+ /* Common configuration information */ -+ /** Power and Clock Gating Control Register */ -+ volatile uint32_t *pcgcctl; -+#define DWC_OTG_PCGCCTL_OFFSET 0xE00 -+ -+ /** Push/pop addresses for endpoints or host channels.*/ -+ uint32_t *data_fifo[MAX_EPS_CHANNELS]; -+#define DWC_OTG_DATA_FIFO_OFFSET 0x1000 -+#define DWC_OTG_DATA_FIFO_SIZE 0x1000 -+ -+ /** Total RAM for FIFOs (Bytes) */ -+ uint16_t total_fifo_size; -+ /** Size of Rx FIFO (Bytes) */ -+ uint16_t rx_fifo_size; -+ /** Size of Non-periodic Tx FIFO (Bytes) */ -+ uint16_t nperio_tx_fifo_size; -+ -+ /** 1 if DMA is enabled, 0 otherwise. */ -+ uint8_t dma_enable; -+ -+ /** 1 if DMA descriptor is enabled, 0 otherwise. */ -+ uint8_t dma_desc_enable; -+ -+ /** 1 if PTI Enhancement mode is enabled, 0 otherwise. */ -+ uint8_t pti_enh_enable; -+ -+ /** 1 if MPI Enhancement mode is enabled, 0 otherwise. */ -+ uint8_t multiproc_int_enable; -+ -+ /** 1 if dedicated Tx FIFOs are enabled, 0 otherwise. */ -+ uint8_t en_multiple_tx_fifo; -+ -+ /** Set to 1 if multiple packets of a high-bandwidth transfer is in -+ * process of being queued */ -+ uint8_t queuing_high_bandwidth; -+ -+ /** Hardware Configuration -- stored here for convenience.*/ -+ hwcfg1_data_t hwcfg1; -+ hwcfg2_data_t hwcfg2; -+ hwcfg3_data_t hwcfg3; -+ hwcfg4_data_t hwcfg4; -+ fifosize_data_t hptxfsiz; -+ -+ /** Host and Device Configuration -- stored here for convenience.*/ -+ hcfg_data_t hcfg; -+ dcfg_data_t dcfg; -+ -+ /** The operational State, during transations -+ * (a_host>>a_peripherial and b_device=>b_host) this may not -+ * match the core but allows the software to determine -+ * transitions. -+ */ -+ uint8_t op_state; -+ -+ /** -+ * Set to 1 if the HCD needs to be restarted on a session request -+ * interrupt. This is required if no connector ID status change has -+ * occurred since the HCD was last disconnected. -+ */ -+ uint8_t restart_hcd_on_session_req; -+ -+ /** HCD callbacks */ -+ /** A-Device is a_host */ -+#define A_HOST (1) -+ /** A-Device is a_suspend */ -+#define A_SUSPEND (2) -+ /** A-Device is a_peripherial */ -+#define A_PERIPHERAL (3) -+ /** B-Device is operating as a Peripheral. */ -+#define B_PERIPHERAL (4) -+ /** B-Device is operating as a Host. */ -+#define B_HOST (5) -+ -+ /** HCD callbacks */ -+ struct dwc_otg_cil_callbacks *hcd_cb; -+ /** PCD callbacks */ -+ struct dwc_otg_cil_callbacks *pcd_cb; -+ -+ /** Device mode Periodic Tx FIFO Mask */ -+ uint32_t p_tx_msk; -+ /** Device mode Periodic Tx FIFO Mask */ -+ uint32_t tx_msk; -+ -+ /** Workqueue object used for handling several interrupts */ -+ dwc_workq_t *wq_otg; -+ -+ /** Timer object used for handling "Wakeup Detected" Interrupt */ -+ dwc_timer_t *wkp_timer; -+ /** This arrays used for debug purposes for DEV OUT NAK enhancement */ -+ uint32_t start_doeptsiz_val[MAX_EPS_CHANNELS]; -+ ep_xfer_info_t ep_xfer_info[MAX_EPS_CHANNELS]; -+ dwc_timer_t *ep_xfer_timer[MAX_EPS_CHANNELS]; -+#ifdef DEBUG -+ uint32_t start_hcchar_val[MAX_EPS_CHANNELS]; -+ -+ hc_xfer_info_t hc_xfer_info[MAX_EPS_CHANNELS]; -+ dwc_timer_t *hc_xfer_timer[MAX_EPS_CHANNELS]; -+ -+ uint32_t hfnum_7_samples; -+ uint64_t hfnum_7_frrem_accum; -+ uint32_t hfnum_0_samples; -+ uint64_t hfnum_0_frrem_accum; -+ uint32_t hfnum_other_samples; -+ uint64_t hfnum_other_frrem_accum; -+#endif -+ -+#ifdef DWC_UTE_CFI -+ uint16_t pwron_rxfsiz; -+ uint16_t pwron_gnptxfsiz; -+ uint16_t pwron_txfsiz[15]; -+ -+ uint16_t init_rxfsiz; -+ uint16_t init_gnptxfsiz; -+ uint16_t init_txfsiz[15]; -+#endif -+ -+ /** Lx state of device */ -+ dwc_otg_lx_state_e lx_state; -+ -+ /** Saved Core Global registers */ -+ struct dwc_otg_global_regs_backup *gr_backup; -+ /** Saved Host registers */ -+ struct dwc_otg_host_regs_backup *hr_backup; -+ /** Saved Device registers */ -+ struct dwc_otg_dev_regs_backup *dr_backup; -+ -+ /** Power Down Enable */ -+ uint32_t power_down; -+ -+ /** ADP support Enable */ -+ uint32_t adp_enable; -+ -+ /** ADP structure object */ -+ dwc_otg_adp_t adp; -+ -+ /** hibernation/suspend flag */ -+ int hibernation_suspend; -+ -+ /** Device mode extended hibernation flag */ -+ int xhib; -+ -+ /** OTG revision supported */ -+ uint32_t otg_ver; -+ -+ /** OTG status flag used for HNP polling */ -+ uint8_t otg_sts; -+ -+ /** Pointer to either hcd->lock or pcd->lock */ -+ dwc_spinlock_t *lock; -+ -+ /** Start predict NextEP based on Learning Queue if equal 1, -+ * also used as counter of disabled NP IN EP's */ -+ uint8_t start_predict; -+ -+ /** NextEp sequence, including EP0: nextep_seq[] = EP if non-periodic and -+ * active, 0xff otherwise */ -+ uint8_t nextep_seq[MAX_EPS_CHANNELS]; -+ -+ /** Index of fisrt EP in nextep_seq array which should be re-enabled **/ -+ uint8_t first_in_nextep_seq; -+ -+ /** Frame number while entering to ISR - needed for ISOCs **/ -+ uint32_t frame_num; -+ -+}; -+ -+#ifdef DEBUG -+/* -+ * This function is called when transfer is timed out. -+ */ -+extern void hc_xfer_timeout(void *ptr); -+#endif -+ -+/* -+ * This function is called when transfer is timed out on endpoint. -+ */ -+extern void ep_xfer_timeout(void *ptr); -+ -+/* -+ * The following functions are functions for works -+ * using during handling some interrupts -+ */ -+extern void w_conn_id_status_change(void *p); -+ -+extern void w_wakeup_detected(void *p); -+ -+/** Saves global register values into system memory. */ -+extern int dwc_otg_save_global_regs(dwc_otg_core_if_t * core_if); -+/** Saves device register values into system memory. */ -+extern int dwc_otg_save_dev_regs(dwc_otg_core_if_t * core_if); -+/** Saves host register values into system memory. */ -+extern int dwc_otg_save_host_regs(dwc_otg_core_if_t * core_if); -+/** Restore global register values. */ -+extern int dwc_otg_restore_global_regs(dwc_otg_core_if_t * core_if); -+/** Restore host register values. */ -+extern int dwc_otg_restore_host_regs(dwc_otg_core_if_t * core_if, int reset); -+/** Restore device register values. */ -+extern int dwc_otg_restore_dev_regs(dwc_otg_core_if_t * core_if, -+ int rem_wakeup); -+extern int restore_lpm_i2c_regs(dwc_otg_core_if_t * core_if); -+extern int restore_essential_regs(dwc_otg_core_if_t * core_if, int rmode, -+ int is_host); -+ -+extern int dwc_otg_host_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int restore_mode, int reset); -+extern int dwc_otg_device_hibernation_restore(dwc_otg_core_if_t * core_if, -+ int rem_wakeup, int reset); -+ -+/* -+ * The following functions support initialization of the CIL driver component -+ * and the DWC_otg controller. -+ */ -+extern void dwc_otg_core_host_init(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_core_dev_init(dwc_otg_core_if_t * _core_if); -+ -+/** @name Device CIL Functions -+ * The following functions support managing the DWC_otg controller in device -+ * mode. -+ */ -+/**@{*/ -+extern void dwc_otg_wakeup(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_read_setup_packet(dwc_otg_core_if_t * _core_if, -+ uint32_t * _dest); -+extern uint32_t dwc_otg_get_frame_number(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_ep0_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_activate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_deactivate(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_start_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep_start_zl_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep0_start_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_ep_write_packet(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep, int _dma); -+extern void dwc_otg_ep_set_stall(dwc_otg_core_if_t * _core_if, dwc_ep_t * _ep); -+extern void dwc_otg_ep_clear_stall(dwc_otg_core_if_t * _core_if, -+ dwc_ep_t * _ep); -+extern void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t * _core_if); -+ -+#ifdef DWC_EN_ISOC -+extern void dwc_otg_iso_ep_start_frm_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep); -+extern void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep); -+#endif /* DWC_EN_ISOC */ -+/**@}*/ -+ -+/** @name Host CIL Functions -+ * The following functions support managing the DWC_otg controller in host -+ * mode. -+ */ -+/**@{*/ -+extern void dwc_otg_hc_init(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); -+extern void dwc_otg_hc_halt(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc, dwc_otg_halt_status_e _halt_status); -+extern void dwc_otg_hc_cleanup(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); -+extern void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc); -+extern int dwc_otg_hc_continue_transfer(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc); -+extern void dwc_otg_hc_do_ping(dwc_otg_core_if_t * _core_if, dwc_hc_t * _hc); -+extern void dwc_otg_hc_write_packet(dwc_otg_core_if_t * _core_if, -+ dwc_hc_t * _hc); -+extern void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t * _core_if); -+ -+extern void dwc_otg_hc_start_transfer_ddma(dwc_otg_core_if_t * core_if, -+ dwc_hc_t * hc); -+ -+extern uint32_t calc_frame_interval(dwc_otg_core_if_t * core_if); -+ -+/* Macro used to clear one channel interrupt */ -+#define clear_hc_int(_hc_regs_, _intr_) \ -+do { \ -+ hcint_data_t hcint_clear = {.d32 = 0}; \ -+ hcint_clear.b._intr_ = 1; \ -+ DWC_WRITE_REG32(&(_hc_regs_)->hcint, hcint_clear.d32); \ -+} while (0) -+ -+/* -+ * Macro used to disable one channel interrupt. Channel interrupts are -+ * disabled when the channel is halted or released by the interrupt handler. -+ * There is no need to handle further interrupts of that type until the -+ * channel is re-assigned. In fact, subsequent handling may cause crashes -+ * because the channel structures are cleaned up when the channel is released. -+ */ -+#define disable_hc_int(_hc_regs_, _intr_) \ -+do { \ -+ hcintmsk_data_t hcintmsk = {.d32 = 0}; \ -+ hcintmsk.b._intr_ = 1; \ -+ DWC_MODIFY_REG32(&(_hc_regs_)->hcintmsk, hcintmsk.d32, 0); \ -+} while (0) -+ -+/** -+ * This function Reads HPRT0 in preparation to modify. It keeps the -+ * WC bits 0 so that if they are read as 1, they won't clear when you -+ * write it back -+ */ -+static inline uint32_t dwc_otg_read_hprt0(dwc_otg_core_if_t * _core_if) -+{ -+ hprt0_data_t hprt0; -+ hprt0.d32 = DWC_READ_REG32(_core_if->host_if->hprt0); -+ hprt0.b.prtena = 0; -+ hprt0.b.prtconndet = 0; -+ hprt0.b.prtenchng = 0; -+ hprt0.b.prtovrcurrchng = 0; -+ return hprt0.d32; -+} -+ -+/**@}*/ -+ -+/** @name Common CIL Functions -+ * The following functions support managing the DWC_otg controller in either -+ * device or host mode. -+ */ -+/**@{*/ -+ -+extern void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, -+ uint8_t * dest, uint16_t bytes); -+ -+extern void dwc_otg_flush_tx_fifo(dwc_otg_core_if_t * _core_if, const int _num); -+extern void dwc_otg_flush_rx_fifo(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_core_reset(dwc_otg_core_if_t * _core_if); -+ -+/** -+ * This function returns the Core Interrupt register. -+ */ -+static inline uint32_t dwc_otg_read_core_intr(dwc_otg_core_if_t * core_if) -+{ -+ return (DWC_READ_REG32(&core_if->core_global_regs->gintsts) & -+ DWC_READ_REG32(&core_if->core_global_regs->gintmsk)); -+} -+ -+/** -+ * This function returns the OTG Interrupt register. -+ */ -+static inline uint32_t dwc_otg_read_otg_intr(dwc_otg_core_if_t * core_if) -+{ -+ return (DWC_READ_REG32(&core_if->core_global_regs->gotgint)); -+} -+ -+/** -+ * This function reads the Device All Endpoints Interrupt register and -+ * returns the IN endpoint interrupt bits. -+ */ -+static inline uint32_t dwc_otg_read_dev_all_in_ep_intr(dwc_otg_core_if_t * -+ core_if) -+{ -+ -+ uint32_t v; -+ -+ if (core_if->multiproc_int_enable) { -+ v = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->deachint) & -+ DWC_READ_REG32(&core_if-> -+ dev_if->dev_global_regs->deachintmsk); -+ } else { -+ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); -+ } -+ return (v & 0xffff); -+} -+ -+/** -+ * This function reads the Device All Endpoints Interrupt register and -+ * returns the OUT endpoint interrupt bits. -+ */ -+static inline uint32_t dwc_otg_read_dev_all_out_ep_intr(dwc_otg_core_if_t * -+ core_if) -+{ -+ uint32_t v; -+ -+ if (core_if->multiproc_int_enable) { -+ v = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->deachint) & -+ DWC_READ_REG32(&core_if-> -+ dev_if->dev_global_regs->deachintmsk); -+ } else { -+ v = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daint) & -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->daintmsk); -+ } -+ -+ return ((v & 0xffff0000) >> 16); -+} -+ -+/** -+ * This function returns the Device IN EP Interrupt register -+ */ -+static inline uint32_t dwc_otg_read_dev_in_ep_intr(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ uint32_t v, msk, emp; -+ -+ if (core_if->multiproc_int_enable) { -+ msk = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->diepeachintmsk[ep->num]); -+ emp = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->dtknqr4_fifoemptymsk); -+ msk |= ((emp >> ep->num) & 0x1) << 7; -+ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; -+ } else { -+ msk = DWC_READ_REG32(&dev_if->dev_global_regs->diepmsk); -+ emp = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->dtknqr4_fifoemptymsk); -+ msk |= ((emp >> ep->num) & 0x1) << 7; -+ v = DWC_READ_REG32(&dev_if->in_ep_regs[ep->num]->diepint) & msk; -+ } -+ -+ return v; -+} -+ -+/** -+ * This function returns the Device OUT EP Interrupt register -+ */ -+static inline uint32_t dwc_otg_read_dev_out_ep_intr(dwc_otg_core_if_t * -+ _core_if, dwc_ep_t * _ep) -+{ -+ dwc_otg_dev_if_t *dev_if = _core_if->dev_if; -+ uint32_t v; -+ doepmsk_data_t msk = {.d32 = 0 }; -+ -+ if (_core_if->multiproc_int_enable) { -+ msk.d32 = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->doepeachintmsk[_ep->num]); -+ if (_core_if->pti_enh_enable) { -+ msk.b.pktdrpsts = 1; -+ } -+ v = DWC_READ_REG32(&dev_if-> -+ out_ep_regs[_ep->num]->doepint) & msk.d32; -+ } else { -+ msk.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->doepmsk); -+ if (_core_if->pti_enh_enable) { -+ msk.b.pktdrpsts = 1; -+ } -+ v = DWC_READ_REG32(&dev_if-> -+ out_ep_regs[_ep->num]->doepint) & msk.d32; -+ } -+ return v; -+} -+ -+/** -+ * This function returns the Host All Channel Interrupt register -+ */ -+static inline uint32_t dwc_otg_read_host_all_channels_intr(dwc_otg_core_if_t * -+ _core_if) -+{ -+ return (DWC_READ_REG32(&_core_if->host_if->host_global_regs->haint)); -+} -+ -+static inline uint32_t dwc_otg_read_host_channel_intr(dwc_otg_core_if_t * -+ _core_if, dwc_hc_t * _hc) -+{ -+ return (DWC_READ_REG32 -+ (&_core_if->host_if->hc_regs[_hc->hc_num]->hcint)); -+} -+ -+/** -+ * This function returns the mode of the operation, host or device. -+ * -+ * @return 0 - Device Mode, 1 - Host Mode -+ */ -+static inline uint32_t dwc_otg_mode(dwc_otg_core_if_t * _core_if) -+{ -+ return (DWC_READ_REG32(&_core_if->core_global_regs->gintsts) & 0x1); -+} -+ -+/**@}*/ -+ -+/** -+ * DWC_otg CIL callback structure. This structure allows the HCD and -+ * PCD to register functions used for starting and stopping the PCD -+ * and HCD for role change on for a DRD. -+ */ -+typedef struct dwc_otg_cil_callbacks { -+ /** Start function for role change */ -+ int (*start) (void *_p); -+ /** Stop Function for role change */ -+ int (*stop) (void *_p); -+ /** Disconnect Function for role change */ -+ int (*disconnect) (void *_p); -+ /** Resume/Remote wakeup Function */ -+ int (*resume_wakeup) (void *_p); -+ /** Suspend function */ -+ int (*suspend) (void *_p); -+ /** Session Start (SRP) */ -+ int (*session_start) (void *_p); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ /** Sleep (switch to L0 state) */ -+ int (*sleep) (void *_p); -+#endif -+ /** Pointer passed to start() and stop() */ -+ void *p; -+} dwc_otg_cil_callbacks_t; -+ -+extern void dwc_otg_cil_register_pcd_callbacks(dwc_otg_core_if_t * _core_if, -+ dwc_otg_cil_callbacks_t * _cb, -+ void *_p); -+extern void dwc_otg_cil_register_hcd_callbacks(dwc_otg_core_if_t * _core_if, -+ dwc_otg_cil_callbacks_t * _cb, -+ void *_p); -+ -+void dwc_otg_initiate_srp(dwc_otg_core_if_t * core_if); -+ -+////////////////////////////////////////////////////////////////////// -+/** Start the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_start(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->start) { -+ core_if->hcd_cb->start(core_if->hcd_cb->p); -+ } -+} -+ -+/** Stop the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_stop(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->stop) { -+ core_if->hcd_cb->stop(core_if->hcd_cb->p); -+ } -+} -+ -+/** Disconnect the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_disconnect(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->disconnect) { -+ core_if->hcd_cb->disconnect(core_if->hcd_cb->p); -+ } -+} -+ -+/** Inform the HCD the a New Session has begun. Helper function for -+ * using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_session_start(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->session_start) { -+ core_if->hcd_cb->session_start(core_if->hcd_cb->p); -+ } -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * Inform the HCD about LPM sleep. -+ * Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_sleep(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->sleep) { -+ core_if->hcd_cb->sleep(core_if->hcd_cb->p); -+ } -+} -+#endif -+ -+/** Resume the HCD. Helper function for using the HCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_hcd_resume(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->hcd_cb && core_if->hcd_cb->resume_wakeup) { -+ core_if->hcd_cb->resume_wakeup(core_if->hcd_cb->p); -+ } -+} -+ -+/** Start the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_start(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->start) { -+ core_if->pcd_cb->start(core_if->pcd_cb->p); -+ } -+} -+ -+/** Stop the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_stop(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->stop) { -+ core_if->pcd_cb->stop(core_if->pcd_cb->p); -+ } -+} -+ -+/** Suspend the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_suspend(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->suspend) { -+ core_if->pcd_cb->suspend(core_if->pcd_cb->p); -+ } -+} -+ -+/** Resume the PCD. Helper function for using the PCD callbacks. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static inline void cil_pcd_resume(dwc_otg_core_if_t * core_if) -+{ -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+} -+ -+////////////////////////////////////////////////////////////////////// -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..96c76e38cd372b8ca8c375ae8d8653f32a3faf80 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -@@ -0,0 +1,1594 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $ -+ * $Revision: #32 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * -+ * The Core Interface Layer provides basic services for accessing and -+ * managing the DWC_otg hardware. These services are used by both the -+ * Host Controller Driver and the Peripheral Controller Driver. -+ * -+ * This file contains the Common Interrupt handlers. -+ */ -+#include "dwc_os.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_pcd.h" -+#include "dwc_otg_hcd.h" -+ -+#ifdef DEBUG -+inline const char *op_state_str(dwc_otg_core_if_t * core_if) -+{ -+ return (core_if->op_state == A_HOST ? "a_host" : -+ (core_if->op_state == A_SUSPEND ? "a_suspend" : -+ (core_if->op_state == A_PERIPHERAL ? "a_peripheral" : -+ (core_if->op_state == B_PERIPHERAL ? "b_peripheral" : -+ (core_if->op_state == B_HOST ? "b_host" : "unknown"))))); -+} -+#endif -+ -+/** This function will log a debug message -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_mode_mismatch_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ DWC_WARN("Mode Mismatch Interrupt: currently in %s mode\n", -+ dwc_otg_mode(core_if) ? "Host" : "Device"); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.modemismatch = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This function handles the OTG Interrupts. It reads the OTG -+ * Interrupt Register (GOTGINT) to determine what interrupt has -+ * occurred. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_otg_intr(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gotgint_data_t gotgint; -+ gotgctl_data_t gotgctl; -+ gintmsk_data_t gintmsk; -+ gpwrdn_data_t gpwrdn; -+ -+ gotgint.d32 = DWC_READ_REG32(&global_regs->gotgint); -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ DWC_DEBUGPL(DBG_CIL, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint.d32, -+ op_state_str(core_if)); -+ -+ if (gotgint.b.sesenddet) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "Session End Detected++ (%s)\n", -+ op_state_str(core_if)); -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ -+ if (core_if->op_state == B_HOST) { -+ cil_pcd_start(core_if); -+ core_if->op_state = B_PERIPHERAL; -+ } else { -+ /* If not B_HOST and Device HNP still set. HNP -+ * Did not succeed!*/ -+ if (gotgctl.b.devhnpen) { -+ DWC_DEBUGPL(DBG_ANY, "Session End Detected\n"); -+ __DWC_ERROR("Device Not Connected/Responding!\n"); -+ } -+ -+ /* If Session End Detected the B-Cable has -+ * been disconnected. */ -+ /* Reset PCD and Gadget driver to a -+ * clean state. */ -+ core_if->lx_state = DWC_OTG_L0; -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ -+ if (core_if->adp_enable) { -+ if (core_if->power_down == 2) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, gpwrdn.d32, 0); -+ } -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ dwc_otg_adp_sense_start(core_if); -+ } -+ } -+ -+ gotgctl.d32 = 0; -+ gotgctl.b.devhnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ } -+ if (gotgint.b.sesreqsucstschng) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "Session Reqeust Success Status Change++\n"); -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ if (gotgctl.b.sesreqscs) { -+ -+ if ((core_if->core_params->phy_type == -+ DWC_PHY_TYPE_PARAM_FS) && (core_if->core_params->i2c_enable)) { -+ core_if->srp_success = 1; -+ } else { -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_resume(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ /* Clear Session Request */ -+ gotgctl.d32 = 0; -+ gotgctl.b.sesreq = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, -+ gotgctl.d32, 0); -+ } -+ } -+ } -+ if (gotgint.b.hstnegsucstschng) { -+ /* Print statements during the HNP interrupt handling -+ * can cause it to fail.*/ -+ gotgctl.d32 = DWC_READ_REG32(&global_regs->gotgctl); -+ /* WA for 3.00a- HW is not setting cur_mode, even sometimes -+ * this does not help*/ -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) -+ dwc_udelay(100); -+ if (gotgctl.b.hstnegscs) { -+ if (dwc_otg_is_host_mode(core_if)) { -+ core_if->op_state = B_HOST; -+ /* -+ * Need to disable SOF interrupt immediately. -+ * When switching from device to host, the PCD -+ * interrupt handler won't handle the -+ * interrupt if host mode is already set. The -+ * HCD interrupt handler won't get called if -+ * the HCD state is HALT. This means that the -+ * interrupt does not get handled and Linux -+ * complains loudly. -+ */ -+ gintmsk.d32 = 0; -+ gintmsk.b.sofintr = 1; -+ DWC_MODIFY_REG32(&global_regs->gintmsk, -+ gintmsk.d32, 0); -+ /* Call callback function with spin lock released */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ /* -+ * Initialize the Core for Host mode. -+ */ -+ cil_hcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = B_HOST; -+ } -+ } else { -+ gotgctl.d32 = 0; -+ gotgctl.b.hnpreq = 1; -+ gotgctl.b.devhnpen = 1; -+ DWC_MODIFY_REG32(&global_regs->gotgctl, gotgctl.d32, 0); -+ DWC_DEBUGPL(DBG_ANY, "HNP Failed\n"); -+ __DWC_ERROR("Device Not Connected/Responding\n"); -+ } -+ } -+ if (gotgint.b.hstnegdet) { -+ /* The disconnect interrupt is set at the same time as -+ * Host Negotiation Detected. During the mode -+ * switch all interrupts are cleared so the disconnect -+ * interrupt handler will not get executed. -+ */ -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "Host Negotiation Detected++ (%s)\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : -+ "Device")); -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_DEBUGPL(DBG_ANY, "a_suspend->a_peripheral (%d)\n", -+ core_if->op_state); -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_disconnect(core_if); -+ cil_pcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = A_PERIPHERAL; -+ } else { -+ /* -+ * Need to disable SOF interrupt immediately. When -+ * switching from device to host, the PCD interrupt -+ * handler won't handle the interrupt if host mode is -+ * already set. The HCD interrupt handler won't get -+ * called if the HCD state is HALT. This means that -+ * the interrupt does not get handled and Linux -+ * complains loudly. -+ */ -+ gintmsk.d32 = 0; -+ gintmsk.b.sofintr = 1; -+ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmsk.d32, 0); -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ cil_hcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = A_HOST; -+ } -+ } -+ if (gotgint.b.adevtoutchng) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " -+ "A-Device Timeout Change++\n"); -+ } -+ if (gotgint.b.debdone) { -+ DWC_DEBUGPL(DBG_ANY, " ++OTG Interrupt: " "Debounce Done++\n"); -+ } -+ -+ /* Clear GOTGINT */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gotgint, gotgint.d32); -+ -+ return 1; -+} -+ -+void w_conn_id_status_change(void *p) -+{ -+ dwc_otg_core_if_t *core_if = p; -+ uint32_t count = 0; -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ -+ gotgctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ DWC_DEBUGPL(DBG_CIL, "gotgctl=%0x\n", gotgctl.d32); -+ DWC_DEBUGPL(DBG_CIL, "gotgctl.b.conidsts=%d\n", gotgctl.b.conidsts); -+ -+ /* B-Device connector (Device Mode) */ -+ if (gotgctl.b.conidsts) { -+ /* Wait for switch to device mode. */ -+ while (!dwc_otg_is_device_mode(core_if)) { -+ DWC_PRINTF("Waiting for Peripheral Mode, Mode=%s\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : -+ "Peripheral")); -+ dwc_mdelay(100); -+ if (++count > 10000) -+ break; -+ } -+ DWC_ASSERT(++count < 10000, -+ "Connection id status change timed out"); -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } else { -+ /* A-Device connector (Host Mode) */ -+ while (!dwc_otg_is_host_mode(core_if)) { -+ DWC_PRINTF("Waiting for Host Mode, Mode=%s\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : -+ "Peripheral")); -+ dwc_mdelay(100); -+ if (++count > 10000) -+ break; -+ } -+ DWC_ASSERT(++count < 10000, -+ "Connection id status change timed out"); -+ core_if->op_state = A_HOST; -+ /* -+ * Initialize the Core for Host mode. -+ */ -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+} -+ -+/** -+ * This function handles the Connector ID Status Change Interrupt. It -+ * reads the OTG Interrupt Register (GOTCTL) to determine whether this -+ * is a Device to Host Mode transition or a Host Mode to Device -+ * Transition. -+ * -+ * This only occurs when the cable is connected/removed from the PHY -+ * connector. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_conn_id_status_change_intr(dwc_otg_core_if_t * core_if) -+{ -+ -+ /* -+ * Need to disable SOF interrupt immediately. If switching from device -+ * to host, the PCD interrupt handler won't handle the interrupt if -+ * host mode is already set. The HCD interrupt handler won't get -+ * called if the HCD state is HALT. This means that the interrupt does -+ * not get handled and Linux complains loudly. -+ */ -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ gintsts_data_t gintsts = {.d32 = 0 }; -+ -+ gintmsk.b.sofintr = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ -+ DWC_DEBUGPL(DBG_CIL, -+ " ++Connector ID Status Change Interrupt++ (%s)\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device")); -+ -+ DWC_SPINUNLOCK(core_if->lock); -+ -+ /* -+ * Need to schedule a work, as there are possible DELAY function calls -+ * Release lock before scheduling workq as it holds spinlock during scheduling -+ */ -+ -+ DWC_WORKQ_SCHEDULE(core_if->wq_otg, w_conn_id_status_change, -+ core_if, "connection id status change"); -+ DWC_SPINLOCK(core_if->lock); -+ -+ /* Set flag and clear interrupt */ -+ gintsts.b.conidstschng = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that a device is initiating the Session -+ * Request Protocol to request the host to turn on bus power so a new -+ * session can begin. The handler responds by turning on bus power. If -+ * the DWC_otg controller is in low power mode, the handler brings the -+ * controller out of low power mode before turning on bus power. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+int32_t dwc_otg_handle_session_req_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ -+#ifndef DWC_HOST_ONLY -+ DWC_DEBUGPL(DBG_ANY, "++Session Request Interrupt++\n"); -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_PRINTF("SRP: Device mode\n"); -+ } else { -+ hprt0_data_t hprt0; -+ DWC_PRINTF("SRP: Host mode\n"); -+ -+ /* Turn on the port power bit. */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Start the Connection timer. So a message can be displayed -+ * if connect does not occur within 10 seconds. */ -+ cil_hcd_session_start(core_if); -+ } -+#endif -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.sessreqintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+void w_wakeup_detected(void *p) -+{ -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) p; -+ /* -+ * Clear the Resume after 70ms. (Need 20 ms minimum. Use 70 ms -+ * so that OPT tests pass with all PHYs). -+ */ -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+#if 0 -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ /* Restart the Phy Clock */ -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ dwc_udelay(10); -+#endif //0 -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ DWC_DEBUGPL(DBG_ANY, "Resume: HPRT0=%0x\n", hprt0.d32); -+// dwc_mdelay(70); -+ hprt0.b.prtres = 0; /* Resume */ -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ DWC_DEBUGPL(DBG_ANY, "Clear Resume: HPRT0=%0x\n", -+ DWC_READ_REG32(core_if->host_if->hprt0)); -+ -+ cil_hcd_resume(core_if); -+ -+ /** Change to L0 state*/ -+ core_if->lx_state = DWC_OTG_L0; -+} -+ -+/** -+ * This interrupt indicates that the DWC_otg controller has detected a -+ * resume or remote wakeup sequence. If the DWC_otg controller is in -+ * low power mode, the handler must brings the controller out of low -+ * power mode. The controller automatically begins resume -+ * signaling. The handler schedules a time to stop resume signaling. -+ */ -+int32_t dwc_otg_handle_wakeup_detected_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "++Resume and Remote Wakeup Detected Interrupt++\n"); -+ -+ DWC_PRINTF("%s lxstate = %d\n", __func__, core_if->lx_state); -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs-> -+ dsts)); -+ if (core_if->lx_state == DWC_OTG_L2) { -+#ifdef PARTIAL_POWER_DOWN -+ if (core_if->hwcfg4.b.power_optimiz) { -+ pcgcctl_data_t power = {.d32 = 0 }; -+ -+ power.d32 = DWC_READ_REG32(core_if->pcgcctl); -+ DWC_DEBUGPL(DBG_CIL, "PCGCCTL=%0x\n", -+ power.d32); -+ -+ power.b.stoppclk = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ -+ power.b.pwrclmp = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ -+ power.b.rstpdwnmodule = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ } -+#endif -+ /* Clear the Remote Wakeup Signaling */ -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, dctl.d32, 0); -+ -+ DWC_SPINUNLOCK(core_if->lock); -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+ DWC_SPINLOCK(core_if->lock); -+ } else { -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ } -+ /** Change to L0 state*/ -+ core_if->lx_state = DWC_OTG_L0; -+ } else { -+ if (core_if->lx_state != DWC_OTG_L1) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ -+ /* Restart the Phy Clock */ -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ DWC_TIMER_SCHEDULE(core_if->wkp_timer, 71); -+ } else { -+ /** Change to L0 state*/ -+ core_if->lx_state = DWC_OTG_L0; -+ } -+ } -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.wkupintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * Device disconnect. -+ */ -+static int32_t dwc_otg_handle_pwrdn_disconnect_intr(dwc_otg_core_if_t *core_if) -+{ -+ gpwrdn_data_t gpwrdn = { .d32 = 0 }; -+ gpwrdn_data_t gpwrdn_temp = { .d32 = 0 }; -+ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps*/ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ if (gpwrdn_temp.b.idsts) { -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } else { -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * remote wakeup sequence. -+ */ -+static int32_t dwc_otg_handle_pwrdn_wakeup_detected_intr(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_ANY, -+ "++Powerdown Remote Wakeup Detected Interrupt++\n"); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (gpwrdn.b.idsts) { // Device Mode -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ dwc_otg_device_hibernation_restore(core_if, 0, 0); -+ } -+ } else { -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ dwc_otg_host_hibernation_restore(core_if, 1, 0); -+ } -+ } -+ return 1; -+} -+ -+static int32_t dwc_otg_handle_pwrdn_idsts_change(dwc_otg_device_t *otg_dev) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ -+ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); -+ gpwrdn_temp.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (core_if->power_down == 2) { -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ DWC_DEBUGPL(DBG_ANY, "Exit from hibernation on ID sts change\n"); -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /*Indicates that we are exiting from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ gpwrdn.d32 = core_if->gr_backup->gpwrdn_local; -+ if (gpwrdn.b.dis_vbus == 1) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ } -+ -+ if (gpwrdn_temp.b.idsts) { -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } else { -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ } -+ } -+ -+ if (core_if->adp_enable) { -+ uint8_t is_host = 0; -+ DWC_SPINUNLOCK(core_if->lock); -+ /* Change the core_if's lock to hcd/pcd lock depend on mode? */ -+#ifndef DWC_HOST_ONLY -+ if (gpwrdn_temp.b.idsts) -+ core_if->lock = otg_dev->pcd->lock; -+#endif -+#ifndef DWC_DEVICE_ONLY -+ if (!gpwrdn_temp.b.idsts) { -+ core_if->lock = otg_dev->hcd->lock; -+ is_host = 1; -+ } -+#endif -+ DWC_PRINTF("RESTART ADP\n"); -+ if (core_if->adp.probe_enabled) -+ dwc_otg_adp_probe_stop(core_if); -+ if (core_if->adp.sense_enabled) -+ dwc_otg_adp_sense_stop(core_if); -+ if (core_if->adp.sense_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.sense_timer); -+ if (core_if->adp.vbuson_timer_started) -+ DWC_TIMER_CANCEL(core_if->adp.vbuson_timer); -+ core_if->adp.probe_timer_values[0] = -1; -+ core_if->adp.probe_timer_values[1] = -1; -+ core_if->adp.sense_timer_started = 0; -+ core_if->adp.vbuson_timer_started = 0; -+ core_if->adp.probe_counter = 0; -+ core_if->adp.gpwrdn = 0; -+ -+ /* Disable PMU and restart ADP */ -+ gpwrdn_temp.d32 = 0; -+ gpwrdn_temp.b.pmuactv = 1; -+ gpwrdn_temp.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ DWC_PRINTF("Check point 1\n"); -+ dwc_mdelay(110); -+ dwc_otg_adp_start(core_if, is_host); -+ DWC_SPINLOCK(core_if->lock); -+ } -+ -+ -+ return 1; -+} -+ -+static int32_t dwc_otg_handle_pwrdn_session_change(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ int32_t otg_cap_param = core_if->core_params->otg_cap; -+ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (core_if->power_down == 2) { -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+ -+ if ((otg_cap_param != DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || -+ otg_cap_param != DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) && -+ gpwrdn.b.bsessvld == 0) { -+ /* Save gpwrdn register for further usage if stschng interrupt */ -+ core_if->gr_backup->gpwrdn_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ /*Exit from ISR and wait for stschng interrupt with bsessvld = 1 */ -+ return 1; -+ } -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /*Indicates that we are exiting from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE || -+ otg_cap_param == DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE) { -+ /* -+ * Initiate SRP after initial ADP probe. -+ */ -+ dwc_otg_initiate_srp(core_if); -+ } -+ } -+ -+ return 1; -+} -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * status change either on IDDIG or BSessVld. -+ */ -+static uint32_t dwc_otg_handle_pwrdn_stschng_intr(dwc_otg_device_t *otg_dev) -+{ -+ int retval; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn_temp = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (core_if->power_down == 2) { -+ if (core_if->hibernation_suspend <= 0) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } else -+ gpwrdn_temp.d32 = core_if->gr_backup->gpwrdn_local; -+ -+ } else { -+ gpwrdn_temp.d32 = core_if->adp.gpwrdn; -+ } -+ -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ if (gpwrdn.b.idsts ^ gpwrdn_temp.b.idsts) { -+ retval = dwc_otg_handle_pwrdn_idsts_change(otg_dev); -+ } else if (gpwrdn.b.bsessvld ^ gpwrdn_temp.b.bsessvld) { -+ retval = dwc_otg_handle_pwrdn_session_change(core_if); -+ } -+ -+ return retval; -+} -+ -+/** -+ * This interrupt indicates that the Wakeup Logic has detected a -+ * SRP. -+ */ -+static int32_t dwc_otg_handle_pwrdn_srp_intr(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return 1; -+ } -+#ifdef DWC_DEV_SRPCAP -+ if (core_if->pwron_timer_started) { -+ core_if->pwron_timer_started = 0; -+ DWC_TIMER_CANCEL(core_if->pwron_timer); -+ } -+#endif -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Indicates that we are exiting from hibernation */ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Programm Disable VBUS to 0 */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /*Initialize the core as Host */ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+ -+ return 1; -+} -+ -+/** This interrupt indicates that restore command after Hibernation -+ * was completed by the core. */ -+int32_t dwc_otg_handle_restore_done_intr(dwc_otg_core_if_t * core_if) -+{ -+ pcgcctl_data_t pcgcctl; -+ DWC_DEBUGPL(DBG_ANY, "++Restore Done Interrupt++\n"); -+ -+ //TODO De-assert restore signal. 8.a -+ pcgcctl.d32 = DWC_READ_REG32(core_if->pcgcctl); -+ if (pcgcctl.b.restoremode == 1) { -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ /* -+ * If restore mode is Remote Wakeup, -+ * unmask Remote Wakeup interrupt. -+ */ -+ gintmsk.b.wkupintr = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ 0, gintmsk.d32); -+ } -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that a device has been disconnected from -+ * the root port. -+ */ -+int32_t dwc_otg_handle_disconnect_intr(dwc_otg_core_if_t * core_if) -+{ -+ gintsts_data_t gintsts; -+ -+ DWC_DEBUGPL(DBG_ANY, "++Disconnect Detected Interrupt++ (%s) %s\n", -+ (dwc_otg_is_host_mode(core_if) ? "Host" : "Device"), -+ op_state_str(core_if)); -+ -+/** @todo Consolidate this if statement. */ -+#ifndef DWC_HOST_ONLY -+ if (core_if->op_state == B_HOST) { -+ /* If in device mode Disconnect and stop the HCD, then -+ * start the PCD. */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_disconnect(core_if); -+ cil_pcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = B_PERIPHERAL; -+ } else if (dwc_otg_is_device_mode(core_if)) { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gotgctl.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gotgctl); -+ if (gotgctl.b.hstsethnpen == 1) { -+ /* Do nothing, if HNP in process the OTG -+ * interrupt "Host Negotiation Detected" -+ * interrupt will do the mode switch. -+ */ -+ } else if (gotgctl.b.devhnpen == 0) { -+ /* If in device mode Disconnect and stop the HCD, then -+ * start the PCD. */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_hcd_disconnect(core_if); -+ cil_pcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = B_PERIPHERAL; -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "!a_peripheral && !devhnpen\n"); -+ } -+ } else { -+ if (core_if->op_state == A_HOST) { -+ /* A-Cable still connected but device disconnected. */ -+ cil_hcd_disconnect(core_if); -+ if (core_if->adp_enable) { -+ gpwrdn_data_t gpwrdn = { .d32 = 0 }; -+ cil_hcd_stop(core_if); -+ /* Enable Power Down Logic */ -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_otg_adp_probe_start(core_if); -+ -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32 -+ (&core_if->core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ } -+ } -+ } -+ } -+#endif -+ /* Change to L3(OFF) state */ -+ core_if->lx_state = DWC_OTG_L3; -+ -+ gintsts.d32 = 0; -+ gintsts.b.disconnect = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that SUSPEND state has been detected on -+ * the USB. -+ * -+ * For HNP the USB Suspend interrupt signals the change from -+ * "a_peripheral" to "a_host". -+ * -+ * When power management is enabled the core will be put in low power -+ * mode. -+ */ -+int32_t dwc_otg_handle_usb_suspend_intr(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ gintsts_data_t gintsts; -+ dcfg_data_t dcfg; -+ -+ DWC_DEBUGPL(DBG_ANY, "USB SUSPEND\n"); -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ /* Check the Device status register to determine if the Suspend -+ * state is active. */ -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ DWC_DEBUGPL(DBG_PCD, "DSTS=0x%0x\n", dsts.d32); -+ DWC_DEBUGPL(DBG_PCD, "DSTS.Suspend Status=%d " -+ "HWCFG4.power Optimize=%d\n", -+ dsts.b.suspsts, core_if->hwcfg4.b.power_optimiz); -+ -+#ifdef PARTIAL_POWER_DOWN -+/** @todo Add a module parameter for power management. */ -+ -+ if (dsts.b.suspsts && core_if->hwcfg4.b.power_optimiz) { -+ pcgcctl_data_t power = {.d32 = 0 }; -+ DWC_DEBUGPL(DBG_CIL, "suspend\n"); -+ -+ power.b.pwrclmp = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, power.d32); -+ -+ power.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); -+ -+ power.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, power.d32); -+ -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "disconnect?\n"); -+ } -+#endif -+ /* PCD callback for suspend. Release the lock inside of callback function */ -+ cil_pcd_suspend(core_if); -+ if (core_if->power_down == 2) -+ { -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ DWC_DEBUGPL(DBG_ANY,"lx_state = %08x\n",core_if->lx_state); -+ DWC_DEBUGPL(DBG_ANY," device address = %08d\n",dcfg.b.devaddr); -+ -+ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+ -+ /* Change to L2(suspend) state */ -+ core_if->lx_state = DWC_OTG_L2; -+ -+ /* Clear interrupt in gintsts */ -+ gintsts.d32 = 0; -+ gintsts.b.usbsuspend = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, gintsts.d32); -+ DWC_PRINTF("Start of hibernation completed\n"); -+ dwc_otg_save_global_regs(core_if); -+ dwc_otg_save_dev_regs(core_if); -+ -+ gusbcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs-> -+ gusbcfg); -+ if (gusbcfg.b.ulpi_utmi_sel == 1) { -+ /* ULPI interface */ -+ /* Suspend the Phy Clock */ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } else { -+ /* UTMI+ Interface */ -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ } -+ -+ /* Set flag to indicate that we are in hibernation */ -+ core_if->hibernation_suspend = 1; -+ /* Enable interrupts from wake up logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Unmask device mode interrupts in GPWRDN */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.rst_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ gpwrdn.b.sts_chngint_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Enable Power Down Clamp */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Switch off VDD */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ /* Save gpwrdn register for further usage if stschng interrupt */ -+ core_if->gr_backup->gpwrdn_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ DWC_PRINTF("Hibernation completed\n"); -+ -+ return 1; -+ } -+ } else if (core_if->power_down == 3) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ dcfg.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dcfg); -+ DWC_DEBUGPL(DBG_ANY, "lx_state = %08x\n",core_if->lx_state); -+ DWC_DEBUGPL(DBG_ANY, " device address = %08d\n",dcfg.b.devaddr); -+ -+ if (core_if->lx_state != DWC_OTG_L3 && dcfg.b.devaddr) { -+ DWC_DEBUGPL(DBG_ANY, "Start entering to extended hibernation\n"); -+ core_if->xhib = 1; -+ -+ /* Clear interrupt in gintsts */ -+ gintsts.d32 = 0; -+ gintsts.b.usbsuspend = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, gintsts.d32); -+ -+ dwc_otg_save_global_regs(core_if); -+ dwc_otg_save_dev_regs(core_if); -+ -+ /* Wait for 10 PHY clocks */ -+ dwc_udelay(10); -+ -+ /* Program GPIO register while entering to xHib */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x1); -+ -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.extnd_hiber_pwrclmp = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.extnd_hiber_switch = 1; -+ core_if->gr_backup->xhib_gpwrdn = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ core_if->gr_backup->xhib_pcgcctl = DWC_READ_REG32(core_if->pcgcctl) | pcgcctl.d32; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ DWC_DEBUGPL(DBG_ANY, "Finished entering to extended hibernation\n"); -+ -+ return 1; -+ } -+ } -+ } else { -+ if (core_if->op_state == A_PERIPHERAL) { -+ DWC_DEBUGPL(DBG_ANY, "a_peripheral->a_host\n"); -+ /* Clear the a_peripheral flag, back to a_host. */ -+ DWC_SPINUNLOCK(core_if->lock); -+ cil_pcd_stop(core_if); -+ cil_hcd_start(core_if); -+ DWC_SPINLOCK(core_if->lock); -+ core_if->op_state = A_HOST; -+ } -+ } -+ -+ /* Change to L2(suspend) state */ -+ core_if->lx_state = DWC_OTG_L2; -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.usbsuspend = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+static int32_t dwc_otg_handle_xhib_exit_intr(dwc_otg_core_if_t * core_if) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gahbcfg_data_t gahbcfg = {.d32 = 0 }; -+ -+ dwc_udelay(10); -+ -+ /* Program GPIO register while entering to xHib */ -+ DWC_WRITE_REG32(&core_if->core_global_regs->ggpio, 0x0); -+ -+ pcgcctl.d32 = core_if->gr_backup->xhib_pcgcctl; -+ pcgcctl.b.extnd_hiber_pwrclmp = 0; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ gpwrdn.d32 = core_if->gr_backup->xhib_gpwrdn; -+ gpwrdn.b.restore = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ restore_lpm_i2c_regs(core_if); -+ -+ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); -+ pcgcctl.b.max_xcvrselect = 1; -+ pcgcctl.b.ess_reg_restored = 0; -+ pcgcctl.b.extnd_hiber_switch = 0; -+ pcgcctl.b.extnd_hiber_pwrclmp = 0; -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ -+ gahbcfg.d32 = core_if->gr_backup->gahbcfg_local; -+ gahbcfg.b.glblintrmsk = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gahbcfg, gahbcfg.d32); -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, 0xFFFFFFFF); -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, 0x1 << 16); -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, -+ core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, -+ core_if->dr_backup->dcfg); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); -+ pcgcctl.b.max_xcvrselect = 1; -+ pcgcctl.d32 |= 0x608; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ dwc_udelay(10); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.d32 = core_if->gr_backup->pcgcctl_local & (0x3FFFF << 14); -+ pcgcctl.b.max_xcvrselect = 1; -+ pcgcctl.b.ess_reg_restored = 1; -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ pcgcctl.b.rstpdwnmodule = 1; -+ pcgcctl.b.restoremode = 1; -+ DWC_WRITE_REG32(core_if->pcgcctl, pcgcctl.d32); -+ -+ DWC_DEBUGPL(DBG_ANY, "%s called\n", __FUNCTION__); -+ -+ return 1; -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * This function hadles LPM transaction received interrupt. -+ */ -+static int32_t dwc_otg_handle_lpm_intr(dwc_otg_core_if_t * core_if) -+{ -+ glpmcfg_data_t lpmcfg; -+ gintsts_data_t gintsts; -+ -+ if (!core_if->core_params->lpm_enable) { -+ DWC_PRINTF("Unexpected LPM interrupt\n"); -+ } -+ -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ DWC_PRINTF("LPM config register = 0x%08x\n", lpmcfg.d32); -+ -+ if (dwc_otg_is_host_mode(core_if)) { -+ cil_hcd_sleep(core_if); -+ } else { -+ lpmcfg.b.hird_thres |= (1 << 4); -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ } -+ -+ /* Examine prt_sleep_sts after TL1TokenTetry period max (10 us) */ -+ dwc_udelay(10); -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.prt_sleep_sts) { -+ /* Save the current state */ -+ core_if->lx_state = DWC_OTG_L1; -+ } -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.lpmtranrcvd = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ return 1; -+} -+#endif /* CONFIG_USB_DWC_OTG_LPM */ -+ -+/** -+ * This function returns the Core Interrupt register. -+ */ -+static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gintmsk_data_t *reenable_gintmsk, dwc_otg_hcd_t *hcd) -+{ -+ gahbcfg_data_t gahbcfg = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk; -+ gintmsk_data_t gintmsk_common = {.d32 = 0 }; -+ gintmsk_common.b.wkupintr = 1; -+ gintmsk_common.b.sessreqintr = 1; -+ gintmsk_common.b.conidstschng = 1; -+ gintmsk_common.b.otgintr = 1; -+ gintmsk_common.b.modemismatch = 1; -+ gintmsk_common.b.disconnect = 1; -+ gintmsk_common.b.usbsuspend = 1; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ gintmsk_common.b.lpmtranrcvd = 1; -+#endif -+ gintmsk_common.b.restoredone = 1; -+ if(dwc_otg_is_device_mode(core_if)) -+ { -+ /** @todo: The port interrupt occurs while in device -+ * mode. Added code to CIL to clear the interrupt for now! -+ */ -+ gintmsk_common.b.portintr = 1; -+ } -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ if(fiq_enable) { -+ local_fiq_disable(); -+ /* Pull in the interrupts that the FIQ has masked */ -+ gintmsk.d32 |= ~(hcd->fiq_state->gintmsk_saved.d32); -+ gintmsk.d32 |= gintmsk_common.d32; -+ /* for the upstairs function to reenable - have to read it here in case FIQ triggers again */ -+ reenable_gintmsk->d32 = gintmsk.d32; -+ local_fiq_enable(); -+ } -+ -+ gahbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg); -+ -+#ifdef DEBUG -+ /* if any common interrupts set */ -+ if (gintsts.d32 & gintmsk_common.d32) { -+ DWC_DEBUGPL(DBG_ANY, "common_intr: gintsts=%08x gintmsk=%08x\n", -+ gintsts.d32, gintmsk.d32); -+ } -+#endif -+ if (!fiq_enable){ -+ if (gahbcfg.b.glblintrmsk) -+ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); -+ else -+ return 0; -+ } else { -+ /* Our IRQ kicker is no longer the USB hardware, it's the MPHI interface. -+ * Can't trust the global interrupt mask bit in this case. -+ */ -+ return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32); -+ } -+ -+} -+ -+/* MACRO for clearing interupt bits in GPWRDN register */ -+#define CLEAR_GPWRDN_INTR(__core_if,__intr) \ -+do { \ -+ gpwrdn_data_t gpwrdn = {.d32=0}; \ -+ gpwrdn.b.__intr = 1; \ -+ DWC_MODIFY_REG32(&__core_if->core_global_regs->gpwrdn, \ -+ 0, gpwrdn.d32); \ -+} while (0) -+ -+/** -+ * Common interrupt handler. -+ * -+ * The common interrupts are those that occur in both Host and Device mode. -+ * This handler handles the following interrupts: -+ * - Mode Mismatch Interrupt -+ * - Disconnect Interrupt -+ * - OTG Interrupt -+ * - Connector ID Status Change Interrupt -+ * - Session Request Interrupt. -+ * - Resume / Remote Wakeup Detected Interrupt. -+ * - LPM Transaction Received Interrupt -+ * - ADP Transaction Received Interrupt -+ * -+ */ -+int32_t dwc_otg_handle_common_intr(void *dev) -+{ -+ int retval = 0; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk_reenable = { .d32 = 0 }; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ dwc_otg_device_t *otg_dev = dev; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ gpwrdn.d32 = DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ if (dwc_otg_is_device_mode(core_if)) -+ core_if->frame_num = dwc_otg_get_frame_number(core_if); -+ -+ if (core_if->lock) -+ DWC_SPINLOCK(core_if->lock); -+ -+ if (core_if->power_down == 3 && core_if->xhib == 1) { -+ DWC_DEBUGPL(DBG_ANY, "Exiting from xHIB state\n"); -+ retval |= dwc_otg_handle_xhib_exit_intr(core_if); -+ core_if->xhib = 2; -+ if (core_if->lock) -+ DWC_SPINUNLOCK(core_if->lock); -+ -+ return retval; -+ } -+ -+ if (core_if->hibernation_suspend <= 0) { -+ /* read_common will have to poke the FIQ's saved mask. We must then clear this mask at the end -+ * of this handler - god only knows why it's done like this -+ */ -+ gintsts.d32 = dwc_otg_read_common_intr(core_if, &gintmsk_reenable, otg_dev->hcd); -+ -+ if (gintsts.b.modemismatch) { -+ retval |= dwc_otg_handle_mode_mismatch_intr(core_if); -+ } -+ if (gintsts.b.otgintr) { -+ retval |= dwc_otg_handle_otg_intr(core_if); -+ } -+ if (gintsts.b.conidstschng) { -+ retval |= -+ dwc_otg_handle_conn_id_status_change_intr(core_if); -+ } -+ if (gintsts.b.disconnect) { -+ retval |= dwc_otg_handle_disconnect_intr(core_if); -+ } -+ if (gintsts.b.sessreqintr) { -+ retval |= dwc_otg_handle_session_req_intr(core_if); -+ } -+ if (gintsts.b.wkupintr) { -+ retval |= dwc_otg_handle_wakeup_detected_intr(core_if); -+ } -+ if (gintsts.b.usbsuspend) { -+ retval |= dwc_otg_handle_usb_suspend_intr(core_if); -+ } -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (gintsts.b.lpmtranrcvd) { -+ retval |= dwc_otg_handle_lpm_intr(core_if); -+ } -+#endif -+ if (gintsts.b.restoredone) { -+ gintsts.d32 = 0; -+ if (core_if->power_down == 2) -+ core_if->hibernation_suspend = -1; -+ else if (core_if->power_down == 3 && core_if->xhib == 2) { -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs-> -+ gintsts, 0xFFFFFFFF); -+ -+ DWC_DEBUGPL(DBG_ANY, -+ "RESTORE DONE generated\n"); -+ -+ gpwrdn.b.restore = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ pcgcctl.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ -+ DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, core_if->gr_backup->gusbcfg_local); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dcfg, core_if->dr_backup->dcfg); -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, core_if->dr_backup->dctl); -+ dwc_udelay(50); -+ -+ dctl.b.pwronprgdone = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ dwc_udelay(10); -+ -+ dwc_otg_restore_global_regs(core_if); -+ dwc_otg_restore_dev_regs(core_if, 0); -+ -+ dctl.d32 = 0; -+ dctl.b.pwronprgdone = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); -+ dwc_udelay(10); -+ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.enbl_extnd_hiber = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ -+ /* The core will be in ON STATE */ -+ core_if->lx_state = DWC_OTG_L0; -+ core_if->xhib = 0; -+ -+ DWC_SPINUNLOCK(core_if->lock); -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+ DWC_SPINLOCK(core_if->lock); -+ -+ } -+ -+ gintsts.b.restoredone = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); -+ DWC_PRINTF(" --Restore done interrupt received-- \n"); -+ retval |= 1; -+ } -+ if (gintsts.b.portintr && dwc_otg_is_device_mode(core_if)) { -+ /* The port interrupt occurs while in device mode with HPRT0 -+ * Port Enable/Disable. -+ */ -+ gintsts.d32 = 0; -+ gintsts.b.portintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32); -+ retval |= 1; -+ gintmsk_reenable.b.portintr = 1; -+ -+ } -+ /* Did we actually handle anything? if so, unmask the interrupt */ -+// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "CILOUT %1d", retval); -+// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintsts.d32); -+// fiq_print(FIQDBG_INT, otg_dev->hcd->fiq_state, "%08x", gintmsk_reenable.d32); -+ if (retval && fiq_enable) { -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_reenable.d32); -+ } -+ -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "gpwrdn=%08x\n", gpwrdn.d32); -+ -+ if (gpwrdn.b.disconn_det && gpwrdn.b.disconn_det_msk) { -+ CLEAR_GPWRDN_INTR(core_if, disconn_det); -+ if (gpwrdn.b.linestate == 0) { -+ dwc_otg_handle_pwrdn_disconnect_intr(core_if); -+ } else { -+ DWC_PRINTF("Disconnect detected while linestate is not 0\n"); -+ } -+ -+ retval |= 1; -+ } -+ if (gpwrdn.b.lnstschng && gpwrdn.b.lnstchng_msk) { -+ CLEAR_GPWRDN_INTR(core_if, lnstschng); -+ /* remote wakeup from hibernation */ -+ if (gpwrdn.b.linestate == 2 || gpwrdn.b.linestate == 1) { -+ dwc_otg_handle_pwrdn_wakeup_detected_intr(core_if); -+ } else { -+ DWC_PRINTF("gpwrdn.linestate = %d\n", gpwrdn.b.linestate); -+ } -+ retval |= 1; -+ } -+ if (gpwrdn.b.rst_det && gpwrdn.b.rst_det_msk) { -+ CLEAR_GPWRDN_INTR(core_if, rst_det); -+ if (gpwrdn.b.linestate == 0) { -+ DWC_PRINTF("Reset detected\n"); -+ retval |= dwc_otg_device_hibernation_restore(core_if, 0, 1); -+ } -+ } -+ if (gpwrdn.b.srp_det && gpwrdn.b.srp_det_msk) { -+ CLEAR_GPWRDN_INTR(core_if, srp_det); -+ dwc_otg_handle_pwrdn_srp_intr(core_if); -+ retval |= 1; -+ } -+ } -+ /* Handle ADP interrupt here */ -+ if (gpwrdn.b.adp_int) { -+ DWC_PRINTF("ADP interrupt\n"); -+ CLEAR_GPWRDN_INTR(core_if, adp_int); -+ dwc_otg_adp_handle_intr(core_if); -+ retval |= 1; -+ } -+ if (gpwrdn.b.sts_chngint && gpwrdn.b.sts_chngint_msk) { -+ DWC_PRINTF("STS CHNG interrupt asserted\n"); -+ CLEAR_GPWRDN_INTR(core_if, sts_chngint); -+ dwc_otg_handle_pwrdn_stschng_intr(otg_dev); -+ -+ retval |= 1; -+ } -+ if (core_if->lock) -+ DWC_SPINUNLOCK(core_if->lock); -+ return retval; -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4138fd173337dd566d402d5b924d4dc121e32428 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h -@@ -0,0 +1,705 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $ -+ * $Revision: #13 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#if !defined(__DWC_CORE_IF_H__) -+#define __DWC_CORE_IF_H__ -+ -+#include "dwc_os.h" -+ -+/** @file -+ * This file defines DWC_OTG Core API -+ */ -+ -+struct dwc_otg_core_if; -+typedef struct dwc_otg_core_if dwc_otg_core_if_t; -+ -+/** Maximum number of Periodic FIFOs */ -+#define MAX_PERIO_FIFOS 15 -+/** Maximum number of Periodic FIFOs */ -+#define MAX_TX_FIFOS 15 -+ -+/** Maximum number of Endpoints/HostChannels */ -+#define MAX_EPS_CHANNELS 16 -+ -+extern dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * _reg_base_addr); -+extern void dwc_otg_core_init(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_cil_remove(dwc_otg_core_if_t * _core_if); -+ -+extern void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t * _core_if); -+ -+extern uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t * _core_if); -+extern uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t * _core_if); -+ -+extern uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t * core_if); -+ -+/** This function should be called on every hardware interrupt. */ -+extern int32_t dwc_otg_handle_common_intr(void *otg_dev); -+ -+/** @name OTG Core Parameters */ -+/** @{ */ -+ -+/** -+ * Specifies the OTG capabilities. The driver will automatically -+ * detect the value for this parameter if none is specified. -+ * 0 - HNP and SRP capable (default) -+ * 1 - SRP Only capable -+ * 2 - No HNP/SRP capable -+ */ -+extern int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t * core_if); -+#define DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE 0 -+#define DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE 1 -+#define DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE 2 -+#define dwc_param_otg_cap_default DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE -+ -+extern int dwc_otg_set_param_opt(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t * core_if); -+#define dwc_param_opt_default 1 -+ -+/** -+ * Specifies whether to use slave or DMA mode for accessing the data -+ * FIFOs. The driver will automatically detect the value for this -+ * parameter if none is specified. -+ * 0 - Slave -+ * 1 - DMA (default, if available) -+ */ -+extern int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_dma_enable_default 1 -+ -+/** -+ * When DMA mode is enabled specifies whether to use -+ * address DMA or DMA Descritor mode for accessing the data -+ * FIFOs in device mode. The driver will automatically detect -+ * the value for this parameter if none is specified. -+ * 0 - address DMA -+ * 1 - DMA Descriptor(default, if available) -+ */ -+extern int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t * core_if); -+//#define dwc_param_dma_desc_enable_default 1 -+#define dwc_param_dma_desc_enable_default 0 // Broadcom BCM2708 -+ -+/** The DMA Burst size (applicable only for External DMA -+ * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32) -+ */ -+extern int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t * core_if); -+#define dwc_param_dma_burst_size_default 32 -+ -+/** -+ * Specifies the maximum speed of operation in host and device mode. -+ * The actual speed depends on the speed of the attached device and -+ * the value of phy_type. The actual speed depends on the speed of the -+ * attached device. -+ * 0 - High Speed (default) -+ * 1 - Full Speed -+ */ -+extern int dwc_otg_set_param_speed(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t * core_if); -+#define dwc_param_speed_default 0 -+#define DWC_SPEED_PARAM_HIGH 0 -+#define DWC_SPEED_PARAM_FULL 1 -+ -+/** Specifies whether low power mode is supported when attached -+ * to a Full Speed or Low Speed device in host mode. -+ * 0 - Don't support low power mode (default) -+ * 1 - Support low power mode -+ */ -+extern int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t -+ * core_if); -+#define dwc_param_host_support_fs_ls_low_power_default 0 -+ -+/** Specifies the PHY clock rate in low power mode when connected to a -+ * Low Speed device in host mode. This parameter is applicable only if -+ * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS -+ * then defaults to 6 MHZ otherwise 48 MHZ. -+ * -+ * 0 - 48 MHz -+ * 1 - 6 MHz -+ */ -+extern int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_host_ls_low_power_phy_clk_default 0 -+#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ 0 -+#define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ 1 -+ -+/** -+ * 0 - Use cC FIFO size parameters -+ * 1 - Allow dynamic FIFO sizing (default) -+ */ -+extern int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_enable_dynamic_fifo_default 1 -+ -+/** Total number of 4-byte words in the data FIFO memory. This -+ * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic -+ * Tx FIFOs. -+ * 32 to 32768 (default 8192) -+ * Note: The total FIFO memory depth in the FPGA configuration is 8192. -+ */ -+extern int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t * core_if); -+//#define dwc_param_data_fifo_size_default 8192 -+#define dwc_param_data_fifo_size_default 0xFF0 // Broadcom BCM2708 -+ -+/** Number of 4-byte words in the Rx FIFO in device mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1064) -+ */ -+extern int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t * core_if); -+#define dwc_param_dev_rx_fifo_size_default 1064 -+ -+/** Number of 4-byte words in the non-periodic Tx FIFO in device mode -+ * when dynamic FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_dev_nperio_tx_fifo_size_default 1024 -+ -+/** Number of 4-byte words in each of the periodic Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+extern int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val, int fifo_num); -+extern int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int fifo_num); -+#define dwc_param_dev_perio_tx_fifo_size_default 256 -+ -+/** Number of 4-byte words in the Rx FIFO in host mode when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t * core_if); -+//#define dwc_param_host_rx_fifo_size_default 1024 -+#define dwc_param_host_rx_fifo_size_default 774 // Broadcom BCM2708 -+ -+/** Number of 4-byte words in the non-periodic Tx FIFO in host mode -+ * when Dynamic FIFO sizing is enabled in the core. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if); -+//#define dwc_param_host_nperio_tx_fifo_size_default 1024 -+#define dwc_param_host_nperio_tx_fifo_size_default 0x100 // Broadcom BCM2708 -+ -+/** Number of 4-byte words in the host periodic Tx FIFO when dynamic -+ * FIFO sizing is enabled. -+ * 16 to 32768 (default 1024) -+ */ -+extern int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if, int32_t val); -+extern int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t * -+ core_if); -+//#define dwc_param_host_perio_tx_fifo_size_default 1024 -+#define dwc_param_host_perio_tx_fifo_size_default 0x200 // Broadcom BCM2708 -+ -+/** The maximum transfer size supported in bytes. -+ * 2047 to 65,535 (default 65,535) -+ */ -+extern int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t * core_if); -+#define dwc_param_max_transfer_size_default 65535 -+ -+/** The maximum number of packets in a transfer. -+ * 15 to 511 (default 511) -+ */ -+extern int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t * core_if); -+#define dwc_param_max_packet_count_default 511 -+ -+/** The number of host channel registers to use. -+ * 1 to 16 (default 12) -+ * Note: The FPGA configuration supports a maximum of 12 host channels. -+ */ -+extern int dwc_otg_set_param_host_channels(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t * core_if); -+//#define dwc_param_host_channels_default 12 -+#define dwc_param_host_channels_default 8 // Broadcom BCM2708 -+ -+/** The number of endpoints in addition to EP0 available for device -+ * mode operations. -+ * 1 to 15 (default 6 IN and OUT) -+ * Note: The FPGA configuration supports a maximum of 6 IN and OUT -+ * endpoints in addition to EP0. -+ */ -+extern int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t * core_if); -+#define dwc_param_dev_endpoints_default 6 -+ -+/** -+ * Specifies the type of PHY interface to use. By default, the driver -+ * will automatically detect the phy_type. -+ * -+ * 0 - Full Speed PHY -+ * 1 - UTMI+ (default) -+ * 2 - ULPI -+ */ -+extern int dwc_otg_set_param_phy_type(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t * core_if); -+#define DWC_PHY_TYPE_PARAM_FS 0 -+#define DWC_PHY_TYPE_PARAM_UTMI 1 -+#define DWC_PHY_TYPE_PARAM_ULPI 2 -+#define dwc_param_phy_type_default DWC_PHY_TYPE_PARAM_UTMI -+ -+/** -+ * Specifies the UTMI+ Data Width. This parameter is -+ * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI -+ * PHY_TYPE, this parameter indicates the data width between -+ * the MAC and the ULPI Wrapper.) Also, this parameter is -+ * applicable only if the OTG_HSPHY_WIDTH cC parameter was set -+ * to "8 and 16 bits", meaning that the core has been -+ * configured to work at either data path width. -+ * -+ * 8 or 16 bits (default 16) -+ */ -+extern int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t * core_if); -+//#define dwc_param_phy_utmi_width_default 16 -+#define dwc_param_phy_utmi_width_default 8 // Broadcom BCM2708 -+ -+/** -+ * Specifies whether the ULPI operates at double or single -+ * data rate. This parameter is only applicable if PHY_TYPE is -+ * ULPI. -+ * -+ * 0 - single data rate ULPI interface with 8 bit wide data -+ * bus (default) -+ * 1 - double data rate ULPI interface with 4 bit wide data -+ * bus -+ */ -+extern int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t * core_if); -+#define dwc_param_phy_ulpi_ddr_default 0 -+ -+/** -+ * Specifies whether to use the internal or external supply to -+ * drive the vbus with a ULPI phy. -+ */ -+extern int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t * core_if); -+#define DWC_PHY_ULPI_INTERNAL_VBUS 0 -+#define DWC_PHY_ULPI_EXTERNAL_VBUS 1 -+#define dwc_param_phy_ulpi_ext_vbus_default DWC_PHY_ULPI_INTERNAL_VBUS -+ -+/** -+ * Specifies whether to use the I2Cinterface for full speed PHY. This -+ * parameter is only applicable if PHY_TYPE is FS. -+ * 0 - No (default) -+ * 1 - Yes -+ */ -+extern int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_i2c_enable_default 0 -+ -+extern int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t * core_if); -+#define dwc_param_ulpi_fs_ls_default 0 -+ -+extern int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t * core_if); -+#define dwc_param_ts_dline_default 0 -+ -+/** -+ * Specifies whether dedicated transmit FIFOs are -+ * enabled for non periodic IN endpoints in device mode -+ * 0 - No -+ * 1 - Yes -+ */ -+extern int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t * -+ core_if); -+#define dwc_param_en_multiple_tx_fifo_default 1 -+ -+/** Number of 4-byte words in each of the Tx FIFOs in device -+ * mode when dynamic FIFO sizing is enabled. -+ * 4 to 768 (default 256) -+ */ -+extern int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num, int32_t val); -+extern int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t * core_if, -+ int fifo_num); -+#define dwc_param_dev_tx_fifo_size_default 768 -+ -+/** Thresholding enable flag- -+ * bit 0 - enable non-ISO Tx thresholding -+ * bit 1 - enable ISO Tx thresholding -+ * bit 2 - enable Rx thresholding -+ */ -+extern int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_thr_ctl(dwc_otg_core_if_t * core_if, int fifo_num); -+#define dwc_param_thr_ctl_default 0 -+ -+/** Thresholding length for Tx -+ * FIFOs in 32 bit DWORDs -+ */ -+extern int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_tx_thr_length(dwc_otg_core_if_t * core_if); -+#define dwc_param_tx_thr_length_default 64 -+ -+/** Thresholding length for Rx -+ * FIFOs in 32 bit DWORDs -+ */ -+extern int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_rx_thr_length(dwc_otg_core_if_t * core_if); -+#define dwc_param_rx_thr_length_default 64 -+ -+/** -+ * Specifies whether LPM (Link Power Management) support is enabled -+ */ -+extern int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_lpm_enable_default 1 -+ -+/** -+ * Specifies whether PTI enhancement is enabled -+ */ -+extern int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_pti_enable_default 0 -+ -+/** -+ * Specifies whether MPI enhancement is enabled -+ */ -+extern int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_mpi_enable_default 0 -+ -+/** -+ * Specifies whether ADP capability is enabled -+ */ -+extern int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t * core_if); -+#define dwc_param_adp_enable_default 0 -+ -+/** -+ * Specifies whether IC_USB capability is enabled -+ */ -+ -+extern int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t * core_if); -+#define dwc_param_ic_usb_cap_default 0 -+ -+extern int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t * core_if); -+#define dwc_param_ahb_thr_ratio_default 0 -+ -+extern int dwc_otg_set_param_power_down(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t * core_if); -+#define dwc_param_power_down_default 0 -+ -+extern int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t * core_if); -+#define dwc_param_reload_ctl_default 0 -+ -+extern int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t * core_if); -+#define dwc_param_dev_out_nak_default 0 -+ -+extern int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t * core_if); -+#define dwc_param_cont_on_bna_default 0 -+ -+extern int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t * core_if, -+ int32_t val); -+extern int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t * core_if); -+#define dwc_param_ahb_single_default 0 -+ -+extern int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t * core_if, int32_t val); -+extern int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t * core_if); -+#define dwc_param_otg_ver_default 0 -+ -+/** @} */ -+ -+/** @name Access to registers and bit-fields */ -+ -+/** -+ * Dump core registers and SPRAM -+ */ -+extern void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_dump_spram(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_dump_host_registers(dwc_otg_core_if_t * _core_if); -+extern void dwc_otg_dump_global_registers(dwc_otg_core_if_t * _core_if); -+ -+/** -+ * Get host negotiation status. -+ */ -+extern uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get srp status -+ */ -+extern uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Set hnpreq bit in the GOTGCTL register. -+ */ -+extern void dwc_otg_set_hnpreq(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get Content of SNPSID register. -+ */ -+extern uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get current mode. -+ * Returns 0 if in device mode, and 1 if in host mode. -+ */ -+extern uint32_t dwc_otg_get_mode(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of hnpcapable field in the GUSBCFG register -+ */ -+extern uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of hnpcapable field in the GUSBCFG register -+ */ -+extern void dwc_otg_set_hnpcapable(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of srpcapable field in the GUSBCFG register -+ */ -+extern uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of srpcapable field in the GUSBCFG register -+ */ -+extern void dwc_otg_set_srpcapable(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of devspeed field in the DCFG register -+ */ -+extern uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of devspeed field in the DCFG register -+ */ -+extern void dwc_otg_set_devspeed(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get the value of busconnected field from the HPRT0 register -+ */ -+extern uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Gets the device enumeration Speed. -+ */ -+extern uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of prtpwr field from the HPRT0 register -+ */ -+extern uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of flag indicating core state - hibernated or not -+ */ -+extern uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Set value of prtpwr field from the HPRT0 register -+ */ -+extern void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of prtsusp field from the HPRT0 regsiter -+ */ -+extern uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of prtpwr field from the HPRT0 register -+ */ -+extern void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of ModeChTimEn field from the HCFG regsiter -+ */ -+extern uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of ModeChTimEn field from the HCFG regsiter -+ */ -+extern void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of Fram Interval field from the HFIR regsiter -+ */ -+extern uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of Frame Interval field from the HFIR regsiter -+ */ -+extern void dwc_otg_set_fr_interval(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Set value of prtres field from the HPRT0 register -+ *FIXME Remove? -+ */ -+extern void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of rmtwkupsig bit in DCTL register -+ */ -+extern uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of prt_sleep_sts field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of rem_wkup_en field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Get value of appl_resp field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of appl_resp field from the GLPMCFG register -+ */ -+extern void dwc_otg_set_lpmresponse(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of hsic_connect field from the GLPMCFG register -+ */ -+extern uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of hsic_connect field from the GLPMCFG register -+ */ -+extern void dwc_otg_set_hsic_connect(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * Get value of inv_sel_hsic field from the GLPMCFG register. -+ */ -+extern uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t * core_if); -+/** -+ * Set value of inv_sel_hsic field from the GLPMFG register. -+ */ -+extern void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/* -+ * Some functions for accessing registers -+ */ -+ -+/** -+ * GOTGCTL register -+ */ -+extern uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gotgctl(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GUSBCFG register -+ */ -+extern uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gusbcfg(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GRXFSIZ register -+ */ -+extern uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_grxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GNPTXFSIZ register -+ */ -+extern uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+extern uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_gpvndctl(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GGPIO register -+ */ -+extern uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_ggpio(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GUID register -+ */ -+extern uint32_t dwc_otg_get_guid(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_guid(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * HPRT0 register -+ */ -+extern uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t * core_if); -+extern void dwc_otg_set_hprt0(dwc_otg_core_if_t * core_if, uint32_t val); -+ -+/** -+ * GHPTXFSIZE -+ */ -+extern uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t * core_if); -+ -+/** @} */ -+ -+#endif /* __DWC_CORE_IF_H__ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_dbg.h b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h -new file mode 100644 -index 0000000000000000000000000000000000000000..ccc24e010e449cbda488050d901e9a3995236e33 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h -@@ -0,0 +1,117 @@ -+/* ========================================================================== -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_DBG_H__ -+#define __DWC_OTG_DBG_H__ -+ -+/** @file -+ * This file defines debug levels. -+ * Debugging support vanishes in non-debug builds. -+ */ -+ -+/** -+ * The Debug Level bit-mask variable. -+ */ -+extern uint32_t g_dbg_lvl; -+/** -+ * Set the Debug Level variable. -+ */ -+static inline uint32_t SET_DEBUG_LEVEL(const uint32_t new) -+{ -+ uint32_t old = g_dbg_lvl; -+ g_dbg_lvl = new; -+ return old; -+} -+ -+#define DBG_USER (0x1) -+/** When debug level has the DBG_CIL bit set, display CIL Debug messages. */ -+#define DBG_CIL (0x2) -+/** When debug level has the DBG_CILV bit set, display CIL Verbose debug -+ * messages */ -+#define DBG_CILV (0x20) -+/** When debug level has the DBG_PCD bit set, display PCD (Device) debug -+ * messages */ -+#define DBG_PCD (0x4) -+/** When debug level has the DBG_PCDV set, display PCD (Device) Verbose debug -+ * messages */ -+#define DBG_PCDV (0x40) -+/** When debug level has the DBG_HCD bit set, display Host debug messages */ -+#define DBG_HCD (0x8) -+/** When debug level has the DBG_HCDV bit set, display Verbose Host debug -+ * messages */ -+#define DBG_HCDV (0x80) -+/** When debug level has the DBG_HCD_URB bit set, display enqueued URBs in host -+ * mode. */ -+#define DBG_HCD_URB (0x800) -+/** When debug level has the DBG_HCDI bit set, display host interrupt -+ * messages. */ -+#define DBG_HCDI (0x1000) -+ -+/** When debug level has any bit set, display debug messages */ -+#define DBG_ANY (0xFF) -+ -+/** All debug messages off */ -+#define DBG_OFF 0 -+ -+/** Prefix string for DWC_DEBUG print macros. */ -+#define USB_DWC "DWC_otg: " -+ -+/** -+ * Print a debug message when the Global debug level variable contains -+ * the bit defined in lvl. -+ * -+ * @param[in] lvl - Debug level, use one of the DBG_ constants above. -+ * @param[in] x - like printf -+ * -+ * Example:

-+ * -+ * DWC_DEBUGPL( DBG_ANY, "%s(%p)\n", __func__, _reg_base_addr); -+ * -+ *
-+ * results in:
-+ * -+ * usb-DWC_otg: dwc_otg_cil_init(ca867000) -+ * -+ */ -+#ifdef DEBUG -+ -+# define DWC_DEBUGPL(lvl, x...) do{ if ((lvl)&g_dbg_lvl)__DWC_DEBUG(USB_DWC x ); }while(0) -+# define DWC_DEBUGP(x...) DWC_DEBUGPL(DBG_ANY, x ) -+ -+# define CHK_DEBUG_LEVEL(level) ((level) & g_dbg_lvl) -+ -+#else -+ -+# define DWC_DEBUGPL(lvl, x...) do{}while(0) -+# define DWC_DEBUGP(x...) -+ -+# define CHK_DEBUG_LEVEL(level) (0) -+ -+#endif /*DEBUG*/ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -new file mode 100644 -index 0000000000000000000000000000000000000000..cb060a7179a3eec791506ed2779b553cad9841b0 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -@@ -0,0 +1,1757 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ -+ * $Revision: #92 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+/** @file -+ * The dwc_otg_driver module provides the initialization and cleanup entry -+ * points for the DWC_otg driver. This module will be dynamically installed -+ * after Linux is booted using the insmod command. When the module is -+ * installed, the dwc_otg_driver_init function is called. When the module is -+ * removed (using rmmod), the dwc_otg_driver_cleanup function is called. -+ * -+ * This module also defines a data structure for the dwc_otg_driver, which is -+ * used in conjunction with the standard ARM lm_device structure. These -+ * structures allow the OTG driver to comply with the standard Linux driver -+ * model in which devices and drivers are registered with a bus driver. This -+ * has the benefit that Linux can expose attributes of the driver and device -+ * in its special sysfs file system. Users can then read or write files in -+ * this file system to perform diagnostics on the driver components or the -+ * device. -+ */ -+ -+#include "dwc_otg_os_dep.h" -+#include "dwc_os.h" -+#include "dwc_otg_dbg.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_attr.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_fiq_fsm.h" -+ -+#define DWC_DRIVER_VERSION "3.00a 10-AUG-2012" -+#define DWC_DRIVER_DESC "HS OTG USB Controller driver" -+ -+bool microframe_schedule=true; -+ -+static const char dwc_driver_name[] = "dwc_otg"; -+ -+ -+extern int pcd_init( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+extern int hcd_init( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *dev -+#endif -+ ); -+ -+extern int pcd_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *_dev -+#endif -+ ); -+ -+extern void hcd_remove( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *_dev -+#endif -+ ); -+ -+extern void dwc_otg_adp_start(dwc_otg_core_if_t * core_if, uint8_t is_host); -+ -+/*-------------------------------------------------------------------------*/ -+/* Encapsulate the module parameter settings */ -+ -+struct dwc_otg_driver_module_params { -+ int32_t opt; -+ int32_t otg_cap; -+ int32_t dma_enable; -+ int32_t dma_desc_enable; -+ int32_t dma_burst_size; -+ int32_t speed; -+ int32_t host_support_fs_ls_low_power; -+ int32_t host_ls_low_power_phy_clk; -+ int32_t enable_dynamic_fifo; -+ int32_t data_fifo_size; -+ int32_t dev_rx_fifo_size; -+ int32_t dev_nperio_tx_fifo_size; -+ uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; -+ int32_t host_rx_fifo_size; -+ int32_t host_nperio_tx_fifo_size; -+ int32_t host_perio_tx_fifo_size; -+ int32_t max_transfer_size; -+ int32_t max_packet_count; -+ int32_t host_channels; -+ int32_t dev_endpoints; -+ int32_t phy_type; -+ int32_t phy_utmi_width; -+ int32_t phy_ulpi_ddr; -+ int32_t phy_ulpi_ext_vbus; -+ int32_t i2c_enable; -+ int32_t ulpi_fs_ls; -+ int32_t ts_dline; -+ int32_t en_multiple_tx_fifo; -+ uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; -+ uint32_t thr_ctl; -+ uint32_t tx_thr_length; -+ uint32_t rx_thr_length; -+ int32_t pti_enable; -+ int32_t mpi_enable; -+ int32_t lpm_enable; -+ int32_t ic_usb_cap; -+ int32_t ahb_thr_ratio; -+ int32_t power_down; -+ int32_t reload_ctl; -+ int32_t dev_out_nak; -+ int32_t cont_on_bna; -+ int32_t ahb_single; -+ int32_t otg_ver; -+ int32_t adp_enable; -+}; -+ -+static struct dwc_otg_driver_module_params dwc_otg_module_params = { -+ .opt = -1, -+ .otg_cap = -1, -+ .dma_enable = -1, -+ .dma_desc_enable = -1, -+ .dma_burst_size = -1, -+ .speed = -1, -+ .host_support_fs_ls_low_power = -1, -+ .host_ls_low_power_phy_clk = -1, -+ .enable_dynamic_fifo = -1, -+ .data_fifo_size = -1, -+ .dev_rx_fifo_size = -1, -+ .dev_nperio_tx_fifo_size = -1, -+ .dev_perio_tx_fifo_size = { -+ /* dev_perio_tx_fifo_size_1 */ -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1 -+ /* 15 */ -+ }, -+ .host_rx_fifo_size = -1, -+ .host_nperio_tx_fifo_size = -1, -+ .host_perio_tx_fifo_size = -1, -+ .max_transfer_size = -1, -+ .max_packet_count = -1, -+ .host_channels = -1, -+ .dev_endpoints = -1, -+ .phy_type = -1, -+ .phy_utmi_width = -1, -+ .phy_ulpi_ddr = -1, -+ .phy_ulpi_ext_vbus = -1, -+ .i2c_enable = -1, -+ .ulpi_fs_ls = -1, -+ .ts_dline = -1, -+ .en_multiple_tx_fifo = -1, -+ .dev_tx_fifo_size = { -+ /* dev_tx_fifo_size */ -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1, -+ -1 -+ /* 15 */ -+ }, -+ .thr_ctl = -1, -+ .tx_thr_length = -1, -+ .rx_thr_length = -1, -+ .pti_enable = -1, -+ .mpi_enable = -1, -+ .lpm_enable = 0, -+ .ic_usb_cap = -1, -+ .ahb_thr_ratio = -1, -+ .power_down = -1, -+ .reload_ctl = -1, -+ .dev_out_nak = -1, -+ .cont_on_bna = -1, -+ .ahb_single = -1, -+ .otg_ver = -1, -+ .adp_enable = -1, -+}; -+ -+//Global variable to switch the fiq fix on or off -+bool fiq_enable = 1; -+// Global variable to enable the split transaction fix -+bool fiq_fsm_enable = true; -+//Bulk split-transaction NAK holdoff in microframes -+uint16_t nak_holdoff = 8; -+ -+unsigned short fiq_fsm_mask = 0x0F; -+ -+/** -+ * This function shows the Driver Version. -+ */ -+static ssize_t version_show(struct device_driver *dev, char *buf) -+{ -+ return snprintf(buf, sizeof(DWC_DRIVER_VERSION) + 2, "%s\n", -+ DWC_DRIVER_VERSION); -+} -+ -+static DRIVER_ATTR(version, S_IRUGO, version_show, NULL); -+ -+/** -+ * Global Debug Level Mask. -+ */ -+uint32_t g_dbg_lvl = 0; /* OFF */ -+ -+/** -+ * This function shows the driver Debug Level. -+ */ -+static ssize_t dbg_level_show(struct device_driver *drv, char *buf) -+{ -+ return sprintf(buf, "0x%0x\n", g_dbg_lvl); -+} -+ -+/** -+ * This function stores the driver Debug Level. -+ */ -+static ssize_t dbg_level_store(struct device_driver *drv, const char *buf, -+ size_t count) -+{ -+ g_dbg_lvl = simple_strtoul(buf, NULL, 16); -+ return count; -+} -+ -+static DRIVER_ATTR(debuglevel, S_IRUGO | S_IWUSR, dbg_level_show, -+ dbg_level_store); -+ -+/** -+ * This function is called during module intialization -+ * to pass module parameters to the DWC_OTG CORE. -+ */ -+static int set_parameters(dwc_otg_core_if_t * core_if) -+{ -+ int retval = 0; -+ int i; -+ -+ if (dwc_otg_module_params.otg_cap != -1) { -+ retval += -+ dwc_otg_set_param_otg_cap(core_if, -+ dwc_otg_module_params.otg_cap); -+ } -+ if (dwc_otg_module_params.dma_enable != -1) { -+ retval += -+ dwc_otg_set_param_dma_enable(core_if, -+ dwc_otg_module_params. -+ dma_enable); -+ } -+ if (dwc_otg_module_params.dma_desc_enable != -1) { -+ retval += -+ dwc_otg_set_param_dma_desc_enable(core_if, -+ dwc_otg_module_params. -+ dma_desc_enable); -+ } -+ if (dwc_otg_module_params.opt != -1) { -+ retval += -+ dwc_otg_set_param_opt(core_if, dwc_otg_module_params.opt); -+ } -+ if (dwc_otg_module_params.dma_burst_size != -1) { -+ retval += -+ dwc_otg_set_param_dma_burst_size(core_if, -+ dwc_otg_module_params. -+ dma_burst_size); -+ } -+ if (dwc_otg_module_params.host_support_fs_ls_low_power != -1) { -+ retval += -+ dwc_otg_set_param_host_support_fs_ls_low_power(core_if, -+ dwc_otg_module_params. -+ host_support_fs_ls_low_power); -+ } -+ if (dwc_otg_module_params.enable_dynamic_fifo != -1) { -+ retval += -+ dwc_otg_set_param_enable_dynamic_fifo(core_if, -+ dwc_otg_module_params. -+ enable_dynamic_fifo); -+ } -+ if (dwc_otg_module_params.data_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_data_fifo_size(core_if, -+ dwc_otg_module_params. -+ data_fifo_size); -+ } -+ if (dwc_otg_module_params.dev_rx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_dev_rx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_rx_fifo_size); -+ } -+ if (dwc_otg_module_params.dev_nperio_tx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_dev_nperio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_nperio_tx_fifo_size); -+ } -+ if (dwc_otg_module_params.host_rx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_host_rx_fifo_size(core_if, -+ dwc_otg_module_params.host_rx_fifo_size); -+ } -+ if (dwc_otg_module_params.host_nperio_tx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_host_nperio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ host_nperio_tx_fifo_size); -+ } -+ if (dwc_otg_module_params.host_perio_tx_fifo_size != -1) { -+ retval += -+ dwc_otg_set_param_host_perio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ host_perio_tx_fifo_size); -+ } -+ if (dwc_otg_module_params.max_transfer_size != -1) { -+ retval += -+ dwc_otg_set_param_max_transfer_size(core_if, -+ dwc_otg_module_params. -+ max_transfer_size); -+ } -+ if (dwc_otg_module_params.max_packet_count != -1) { -+ retval += -+ dwc_otg_set_param_max_packet_count(core_if, -+ dwc_otg_module_params. -+ max_packet_count); -+ } -+ if (dwc_otg_module_params.host_channels != -1) { -+ retval += -+ dwc_otg_set_param_host_channels(core_if, -+ dwc_otg_module_params. -+ host_channels); -+ } -+ if (dwc_otg_module_params.dev_endpoints != -1) { -+ retval += -+ dwc_otg_set_param_dev_endpoints(core_if, -+ dwc_otg_module_params. -+ dev_endpoints); -+ } -+ if (dwc_otg_module_params.phy_type != -1) { -+ retval += -+ dwc_otg_set_param_phy_type(core_if, -+ dwc_otg_module_params.phy_type); -+ } -+ if (dwc_otg_module_params.speed != -1) { -+ retval += -+ dwc_otg_set_param_speed(core_if, -+ dwc_otg_module_params.speed); -+ } -+ if (dwc_otg_module_params.host_ls_low_power_phy_clk != -1) { -+ retval += -+ dwc_otg_set_param_host_ls_low_power_phy_clk(core_if, -+ dwc_otg_module_params. -+ host_ls_low_power_phy_clk); -+ } -+ if (dwc_otg_module_params.phy_ulpi_ddr != -1) { -+ retval += -+ dwc_otg_set_param_phy_ulpi_ddr(core_if, -+ dwc_otg_module_params. -+ phy_ulpi_ddr); -+ } -+ if (dwc_otg_module_params.phy_ulpi_ext_vbus != -1) { -+ retval += -+ dwc_otg_set_param_phy_ulpi_ext_vbus(core_if, -+ dwc_otg_module_params. -+ phy_ulpi_ext_vbus); -+ } -+ if (dwc_otg_module_params.phy_utmi_width != -1) { -+ retval += -+ dwc_otg_set_param_phy_utmi_width(core_if, -+ dwc_otg_module_params. -+ phy_utmi_width); -+ } -+ if (dwc_otg_module_params.ulpi_fs_ls != -1) { -+ retval += -+ dwc_otg_set_param_ulpi_fs_ls(core_if, -+ dwc_otg_module_params.ulpi_fs_ls); -+ } -+ if (dwc_otg_module_params.ts_dline != -1) { -+ retval += -+ dwc_otg_set_param_ts_dline(core_if, -+ dwc_otg_module_params.ts_dline); -+ } -+ if (dwc_otg_module_params.i2c_enable != -1) { -+ retval += -+ dwc_otg_set_param_i2c_enable(core_if, -+ dwc_otg_module_params. -+ i2c_enable); -+ } -+ if (dwc_otg_module_params.en_multiple_tx_fifo != -1) { -+ retval += -+ dwc_otg_set_param_en_multiple_tx_fifo(core_if, -+ dwc_otg_module_params. -+ en_multiple_tx_fifo); -+ } -+ for (i = 0; i < 15; i++) { -+ if (dwc_otg_module_params.dev_perio_tx_fifo_size[i] != -1) { -+ retval += -+ dwc_otg_set_param_dev_perio_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_perio_tx_fifo_size -+ [i], i); -+ } -+ } -+ -+ for (i = 0; i < 15; i++) { -+ if (dwc_otg_module_params.dev_tx_fifo_size[i] != -1) { -+ retval += dwc_otg_set_param_dev_tx_fifo_size(core_if, -+ dwc_otg_module_params. -+ dev_tx_fifo_size -+ [i], i); -+ } -+ } -+ if (dwc_otg_module_params.thr_ctl != -1) { -+ retval += -+ dwc_otg_set_param_thr_ctl(core_if, -+ dwc_otg_module_params.thr_ctl); -+ } -+ if (dwc_otg_module_params.mpi_enable != -1) { -+ retval += -+ dwc_otg_set_param_mpi_enable(core_if, -+ dwc_otg_module_params. -+ mpi_enable); -+ } -+ if (dwc_otg_module_params.pti_enable != -1) { -+ retval += -+ dwc_otg_set_param_pti_enable(core_if, -+ dwc_otg_module_params. -+ pti_enable); -+ } -+ if (dwc_otg_module_params.lpm_enable != -1) { -+ retval += -+ dwc_otg_set_param_lpm_enable(core_if, -+ dwc_otg_module_params. -+ lpm_enable); -+ } -+ if (dwc_otg_module_params.ic_usb_cap != -1) { -+ retval += -+ dwc_otg_set_param_ic_usb_cap(core_if, -+ dwc_otg_module_params. -+ ic_usb_cap); -+ } -+ if (dwc_otg_module_params.tx_thr_length != -1) { -+ retval += -+ dwc_otg_set_param_tx_thr_length(core_if, -+ dwc_otg_module_params.tx_thr_length); -+ } -+ if (dwc_otg_module_params.rx_thr_length != -1) { -+ retval += -+ dwc_otg_set_param_rx_thr_length(core_if, -+ dwc_otg_module_params. -+ rx_thr_length); -+ } -+ if (dwc_otg_module_params.ahb_thr_ratio != -1) { -+ retval += -+ dwc_otg_set_param_ahb_thr_ratio(core_if, -+ dwc_otg_module_params.ahb_thr_ratio); -+ } -+ if (dwc_otg_module_params.power_down != -1) { -+ retval += -+ dwc_otg_set_param_power_down(core_if, -+ dwc_otg_module_params.power_down); -+ } -+ if (dwc_otg_module_params.reload_ctl != -1) { -+ retval += -+ dwc_otg_set_param_reload_ctl(core_if, -+ dwc_otg_module_params.reload_ctl); -+ } -+ -+ if (dwc_otg_module_params.dev_out_nak != -1) { -+ retval += -+ dwc_otg_set_param_dev_out_nak(core_if, -+ dwc_otg_module_params.dev_out_nak); -+ } -+ -+ if (dwc_otg_module_params.cont_on_bna != -1) { -+ retval += -+ dwc_otg_set_param_cont_on_bna(core_if, -+ dwc_otg_module_params.cont_on_bna); -+ } -+ -+ if (dwc_otg_module_params.ahb_single != -1) { -+ retval += -+ dwc_otg_set_param_ahb_single(core_if, -+ dwc_otg_module_params.ahb_single); -+ } -+ -+ if (dwc_otg_module_params.otg_ver != -1) { -+ retval += -+ dwc_otg_set_param_otg_ver(core_if, -+ dwc_otg_module_params.otg_ver); -+ } -+ if (dwc_otg_module_params.adp_enable != -1) { -+ retval += -+ dwc_otg_set_param_adp_enable(core_if, -+ dwc_otg_module_params. -+ adp_enable); -+ } -+ return retval; -+} -+ -+/** -+ * This function is the top level interrupt handler for the Common -+ * (Device and host modes) interrupts. -+ */ -+static irqreturn_t dwc_otg_common_irq(int irq, void *dev) -+{ -+ int32_t retval = IRQ_NONE; -+ -+ retval = dwc_otg_handle_common_intr(dev); -+ if (retval != 0) { -+ S3C2410X_CLEAR_EINTPEND(); -+ } -+ return IRQ_RETVAL(retval); -+} -+ -+/** -+ * This function is called when a lm_device is unregistered with the -+ * dwc_otg_driver. This happens, for example, when the rmmod command is -+ * executed. The device may or may not be electrically present. If it is -+ * present, the driver stops device processing. Any resources used on behalf -+ * of this device are freed. -+ * -+ * @param _dev -+ */ -+#ifdef LM_INTERFACE -+#define REM_RETVAL(n) -+static void dwc_otg_driver_remove( struct lm_device *_dev ) -+{ dwc_otg_device_t *otg_dev = lm_get_drvdata(_dev); -+#elif defined(PCI_INTERFACE) -+#define REM_RETVAL(n) -+static void dwc_otg_driver_remove( struct pci_dev *_dev ) -+{ dwc_otg_device_t *otg_dev = pci_get_drvdata(_dev); -+#elif defined(PLATFORM_INTERFACE) -+#define REM_RETVAL(n) n -+static int dwc_otg_driver_remove( struct platform_device *_dev ) -+{ dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); -+#endif -+ -+ DWC_DEBUGPL(DBG_ANY, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); -+ -+ if (!otg_dev) { -+ /* Memory allocation for the dwc_otg_device failed. */ -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); -+ return REM_RETVAL(-ENOMEM); -+ } -+#ifndef DWC_DEVICE_ONLY -+ if (otg_dev->hcd) { -+ hcd_remove(_dev); -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); -+ return REM_RETVAL(-EINVAL); -+ } -+#endif -+ -+#ifndef DWC_HOST_ONLY -+ if (otg_dev->pcd) { -+ pcd_remove(_dev); -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->pcd NULL!\n", __func__); -+ return REM_RETVAL(-EINVAL); -+ } -+#endif -+ /* -+ * Free the IRQ -+ */ -+ if (otg_dev->common_irq_installed) { -+#ifdef PLATFORM_INTERFACE -+ free_irq(platform_get_irq(_dev, 0), otg_dev); -+#else -+ free_irq(_dev->irq, otg_dev); -+#endif -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: There is no installed irq!\n", __func__); -+ return REM_RETVAL(-ENXIO); -+ } -+ -+ if (otg_dev->core_if) { -+ dwc_otg_cil_remove(otg_dev->core_if); -+ } else { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->core_if NULL!\n", __func__); -+ return REM_RETVAL(-ENXIO); -+ } -+ -+ /* -+ * Remove the device attributes -+ */ -+ dwc_otg_attr_remove(_dev); -+ -+ /* -+ * Return the memory. -+ */ -+ if (otg_dev->os_dep.base) { -+ iounmap(otg_dev->os_dep.base); -+ } -+ DWC_FREE(otg_dev); -+ -+ /* -+ * Clear the drvdata pointer. -+ */ -+#ifdef LM_INTERFACE -+ lm_set_drvdata(_dev, 0); -+#elif defined(PCI_INTERFACE) -+ release_mem_region(otg_dev->os_dep.rsrc_start, -+ otg_dev->os_dep.rsrc_len); -+ pci_set_drvdata(_dev, 0); -+#elif defined(PLATFORM_INTERFACE) -+ platform_set_drvdata(_dev, 0); -+#endif -+ return REM_RETVAL(0); -+} -+ -+/** -+ * This function is called when an lm_device is bound to a -+ * dwc_otg_driver. It creates the driver components required to -+ * control the device (CIL, HCD, and PCD) and it initializes the -+ * device. The driver components are stored in a dwc_otg_device -+ * structure. A reference to the dwc_otg_device is saved in the -+ * lm_device. This allows the driver to access the dwc_otg_device -+ * structure on subsequent calls to driver methods for this device. -+ * -+ * @param _dev Bus device -+ */ -+static int dwc_otg_driver_probe( -+#ifdef LM_INTERFACE -+ struct lm_device *_dev -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *_dev, -+ const struct pci_device_id *id -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *_dev -+#endif -+ ) -+{ -+ int retval = 0; -+ dwc_otg_device_t *dwc_otg_device; -+ int devirq; -+ -+ dev_dbg(&_dev->dev, "dwc_otg_driver_probe(%p)\n", _dev); -+#ifdef LM_INTERFACE -+ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)_dev->resource.start); -+#elif defined(PCI_INTERFACE) -+ if (!id) { -+ DWC_ERROR("Invalid pci_device_id %p", id); -+ return -EINVAL; -+ } -+ -+ if (!_dev || (pci_enable_device(_dev) < 0)) { -+ DWC_ERROR("Invalid pci_device %p", _dev); -+ return -ENODEV; -+ } -+ dev_dbg(&_dev->dev, "start=0x%08x\n", (unsigned)pci_resource_start(_dev,0)); -+ /* other stuff needed as well? */ -+ -+#elif defined(PLATFORM_INTERFACE) -+ dev_dbg(&_dev->dev, "start=0x%08x (len 0x%x)\n", -+ (unsigned)_dev->resource->start, -+ (unsigned)(_dev->resource->end - _dev->resource->start)); -+#endif -+ -+ dwc_otg_device = DWC_ALLOC(sizeof(dwc_otg_device_t)); -+ -+ if (!dwc_otg_device) { -+ dev_err(&_dev->dev, "kmalloc of dwc_otg_device failed\n"); -+ return -ENOMEM; -+ } -+ -+ memset(dwc_otg_device, 0, sizeof(*dwc_otg_device)); -+ dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF; -+ dwc_otg_device->os_dep.platformdev = _dev; -+ -+ /* -+ * Map the DWC_otg Core memory into virtual address space. -+ */ -+#ifdef LM_INTERFACE -+ dwc_otg_device->os_dep.base = ioremap(_dev->resource.start, SZ_256K); -+ -+ if (!dwc_otg_device->os_dep.base) { -+ dev_err(&_dev->dev, "ioremap() failed\n"); -+ DWC_FREE(dwc_otg_device); -+ return -ENOMEM; -+ } -+ dev_dbg(&_dev->dev, "base=0x%08x\n", -+ (unsigned)dwc_otg_device->os_dep.base); -+#elif defined(PCI_INTERFACE) -+ _dev->current_state = PCI_D0; -+ _dev->dev.power.power_state = PMSG_ON; -+ -+ if (!_dev->irq) { -+ DWC_ERROR("Found HC with no IRQ. Check BIOS/PCI %s setup!", -+ pci_name(_dev)); -+ iounmap(dwc_otg_device->os_dep.base); -+ DWC_FREE(dwc_otg_device); -+ return -ENODEV; -+ } -+ -+ dwc_otg_device->os_dep.rsrc_start = pci_resource_start(_dev, 0); -+ dwc_otg_device->os_dep.rsrc_len = pci_resource_len(_dev, 0); -+ DWC_DEBUGPL(DBG_ANY, "PCI resource: start=%08x, len=%08x\n", -+ (unsigned)dwc_otg_device->os_dep.rsrc_start, -+ (unsigned)dwc_otg_device->os_dep.rsrc_len); -+ if (!request_mem_region -+ (dwc_otg_device->os_dep.rsrc_start, dwc_otg_device->os_dep.rsrc_len, -+ "dwc_otg")) { -+ dev_dbg(&_dev->dev, "error requesting memory\n"); -+ iounmap(dwc_otg_device->os_dep.base); -+ DWC_FREE(dwc_otg_device); -+ return -EFAULT; -+ } -+ -+ dwc_otg_device->os_dep.base = -+ ioremap_nocache(dwc_otg_device->os_dep.rsrc_start, -+ dwc_otg_device->os_dep.rsrc_len); -+ if (dwc_otg_device->os_dep.base == NULL) { -+ dev_dbg(&_dev->dev, "error mapping memory\n"); -+ release_mem_region(dwc_otg_device->os_dep.rsrc_start, -+ dwc_otg_device->os_dep.rsrc_len); -+ iounmap(dwc_otg_device->os_dep.base); -+ DWC_FREE(dwc_otg_device); -+ return -EFAULT; -+ } -+ dev_dbg(&_dev->dev, "base=0x%p (before adjust) \n", -+ dwc_otg_device->os_dep.base); -+ dwc_otg_device->os_dep.base = (char *)dwc_otg_device->os_dep.base; -+ dev_dbg(&_dev->dev, "base=0x%p (after adjust) \n", -+ dwc_otg_device->os_dep.base); -+ dev_dbg(&_dev->dev, "%s: mapped PA 0x%x to VA 0x%p\n", __func__, -+ (unsigned)dwc_otg_device->os_dep.rsrc_start, -+ dwc_otg_device->os_dep.base); -+ -+ pci_set_master(_dev); -+ pci_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PLATFORM_INTERFACE) -+ DWC_DEBUGPL(DBG_ANY,"Platform resource: start=%08x, len=%08x\n", -+ _dev->resource->start, -+ _dev->resource->end - _dev->resource->start + 1); -+#if 1 -+ if (!request_mem_region(_dev->resource[0].start, -+ _dev->resource[0].end - _dev->resource[0].start + 1, -+ "dwc_otg")) { -+ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); -+ retval = -EFAULT; -+ goto fail; -+ } -+ -+ dwc_otg_device->os_dep.base = ioremap_nocache(_dev->resource[0].start, -+ _dev->resource[0].end - -+ _dev->resource[0].start+1); -+ if (fiq_enable) -+ { -+ if (!request_mem_region(_dev->resource[1].start, -+ _dev->resource[1].end - _dev->resource[1].start + 1, -+ "dwc_otg")) { -+ dev_dbg(&_dev->dev, "error reserving mapped memory\n"); -+ retval = -EFAULT; -+ goto fail; -+ } -+ -+ dwc_otg_device->os_dep.mphi_base = ioremap_nocache(_dev->resource[1].start, -+ _dev->resource[1].end - -+ _dev->resource[1].start + 1); -+ } -+ -+#else -+ { -+ struct map_desc desc = { -+ .virtual = IO_ADDRESS((unsigned)_dev->resource->start), -+ .pfn = __phys_to_pfn((unsigned)_dev->resource->start), -+ .length = SZ_128K, -+ .type = MT_DEVICE -+ }; -+ iotable_init(&desc, 1); -+ dwc_otg_device->os_dep.base = (void *)desc.virtual; -+ } -+#endif -+ if (!dwc_otg_device->os_dep.base) { -+ dev_err(&_dev->dev, "ioremap() failed\n"); -+ retval = -ENOMEM; -+ goto fail; -+ } -+ dev_dbg(&_dev->dev, "base=0x%08x\n", -+ (unsigned)dwc_otg_device->os_dep.base); -+#endif -+ -+ /* -+ * Initialize driver data to point to the global DWC_otg -+ * Device structure. -+ */ -+#ifdef LM_INTERFACE -+ lm_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PLATFORM_INTERFACE) -+ platform_set_drvdata(_dev, dwc_otg_device); -+#endif -+ dev_dbg(&_dev->dev, "dwc_otg_device=0x%p\n", dwc_otg_device); -+ -+ dwc_otg_device->core_if = dwc_otg_cil_init(dwc_otg_device->os_dep.base); -+ DWC_DEBUGPL(DBG_HCDV, "probe of device %p given core_if %p\n", -+ dwc_otg_device, dwc_otg_device->core_if);//GRAYG -+ -+ if (!dwc_otg_device->core_if) { -+ dev_err(&_dev->dev, "CIL initialization failed!\n"); -+ retval = -ENOMEM; -+ goto fail; -+ } -+ -+ dev_dbg(&_dev->dev, "Calling get_gsnpsid\n"); -+ /* -+ * Attempt to ensure this device is really a DWC_otg Controller. -+ * Read and verify the SNPSID register contents. The value should be -+ * 0x45F42XXX or 0x45F42XXX, which corresponds to either "OT2" or "OTG3", -+ * as in "OTG version 2.XX" or "OTG version 3.XX". -+ */ -+ -+ if (((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F542000) && -+ ((dwc_otg_get_gsnpsid(dwc_otg_device->core_if) & 0xFFFFF000) != 0x4F543000)) { -+ dev_err(&_dev->dev, "Bad value for SNPSID: 0x%08x\n", -+ dwc_otg_get_gsnpsid(dwc_otg_device->core_if)); -+ retval = -EINVAL; -+ goto fail; -+ } -+ -+ /* -+ * Validate parameter values. -+ */ -+ dev_dbg(&_dev->dev, "Calling set_parameters\n"); -+ if (set_parameters(dwc_otg_device->core_if)) { -+ retval = -EINVAL; -+ goto fail; -+ } -+ -+ /* -+ * Create Device Attributes in sysfs -+ */ -+ dev_dbg(&_dev->dev, "Calling attr_create\n"); -+ dwc_otg_attr_create(_dev); -+ -+ /* -+ * Disable the global interrupt until all the interrupt -+ * handlers are installed. -+ */ -+ dev_dbg(&_dev->dev, "Calling disable_global_interrupts\n"); -+ dwc_otg_disable_global_interrupts(dwc_otg_device->core_if); -+ -+ /* -+ * Install the interrupt handler for the common interrupts before -+ * enabling common interrupts in core_init below. -+ */ -+ -+#if defined(PLATFORM_INTERFACE) -+ devirq = platform_get_irq(_dev, fiq_enable ? 0 : 1); -+#else -+ devirq = _dev->irq; -+#endif -+ DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n", -+ devirq); -+ dev_dbg(&_dev->dev, "Calling request_irq(%d)\n", devirq); -+ retval = request_irq(devirq, dwc_otg_common_irq, -+ IRQF_SHARED, -+ "dwc_otg", dwc_otg_device); -+ if (retval) { -+ DWC_ERROR("request of irq%d failed\n", devirq); -+ retval = -EBUSY; -+ goto fail; -+ } else { -+ dwc_otg_device->common_irq_installed = 1; -+ } -+ -+#ifndef IRQF_TRIGGER_LOW -+#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) -+ dev_dbg(&_dev->dev, "Calling set_irq_type\n"); -+ set_irq_type(devirq, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -+ IRQT_LOW -+#else -+ IRQ_TYPE_LEVEL_LOW -+#endif -+ ); -+#endif -+#endif /*IRQF_TRIGGER_LOW*/ -+ -+ /* -+ * Initialize the DWC_otg core. -+ */ -+ dev_dbg(&_dev->dev, "Calling dwc_otg_core_init\n"); -+ dwc_otg_core_init(dwc_otg_device->core_if); -+ -+#ifndef DWC_HOST_ONLY -+ /* -+ * Initialize the PCD -+ */ -+ dev_dbg(&_dev->dev, "Calling pcd_init\n"); -+ retval = pcd_init(_dev); -+ if (retval != 0) { -+ DWC_ERROR("pcd_init failed\n"); -+ dwc_otg_device->pcd = NULL; -+ goto fail; -+ } -+#endif -+#ifndef DWC_DEVICE_ONLY -+ /* -+ * Initialize the HCD -+ */ -+ dev_dbg(&_dev->dev, "Calling hcd_init\n"); -+ retval = hcd_init(_dev); -+ if (retval != 0) { -+ DWC_ERROR("hcd_init failed\n"); -+ dwc_otg_device->hcd = NULL; -+ goto fail; -+ } -+#endif -+ /* Recover from drvdata having been overwritten by hcd_init() */ -+#ifdef LM_INTERFACE -+ lm_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PLATFORM_INTERFACE) -+ platform_set_drvdata(_dev, dwc_otg_device); -+#elif defined(PCI_INTERFACE) -+ pci_set_drvdata(_dev, dwc_otg_device); -+ dwc_otg_device->os_dep.pcidev = _dev; -+#endif -+ -+ /* -+ * Enable the global interrupt after all the interrupt -+ * handlers are installed if there is no ADP support else -+ * perform initial actions required for Internal ADP logic. -+ */ -+ if (!dwc_otg_get_param_adp_enable(dwc_otg_device->core_if)) { -+ dev_dbg(&_dev->dev, "Calling enable_global_interrupts\n"); -+ dwc_otg_enable_global_interrupts(dwc_otg_device->core_if); -+ dev_dbg(&_dev->dev, "Done\n"); -+ } else -+ dwc_otg_adp_start(dwc_otg_device->core_if, -+ dwc_otg_is_host_mode(dwc_otg_device->core_if)); -+ -+ return 0; -+ -+fail: -+ dwc_otg_driver_remove(_dev); -+ return retval; -+} -+ -+/** -+ * This structure defines the methods to be called by a bus driver -+ * during the lifecycle of a device on that bus. Both drivers and -+ * devices are registered with a bus driver. The bus driver matches -+ * devices to drivers based on information in the device and driver -+ * structures. -+ * -+ * The probe function is called when the bus driver matches a device -+ * to this driver. The remove function is called when a device is -+ * unregistered with the bus driver. -+ */ -+#ifdef LM_INTERFACE -+static struct lm_driver dwc_otg_driver = { -+ .drv = {.name = (char *)dwc_driver_name,}, -+ .probe = dwc_otg_driver_probe, -+ .remove = dwc_otg_driver_remove, -+ // 'suspend' and 'resume' absent -+}; -+#elif defined(PCI_INTERFACE) -+static const struct pci_device_id pci_ids[] = { { -+ PCI_DEVICE(0x16c3, 0xabcd), -+ .driver_data = -+ (unsigned long)0xdeadbeef, -+ }, { /* end: all zeroes */ } -+}; -+ -+MODULE_DEVICE_TABLE(pci, pci_ids); -+ -+/* pci driver glue; this is a "new style" PCI driver module */ -+static struct pci_driver dwc_otg_driver = { -+ .name = "dwc_otg", -+ .id_table = pci_ids, -+ -+ .probe = dwc_otg_driver_probe, -+ .remove = dwc_otg_driver_remove, -+ -+ .driver = { -+ .name = (char *)dwc_driver_name, -+ }, -+}; -+#elif defined(PLATFORM_INTERFACE) -+static struct platform_device_id platform_ids[] = { -+ { -+ .name = "bcm2708_usb", -+ .driver_data = (kernel_ulong_t) 0xdeadbeef, -+ }, -+ { /* end: all zeroes */ } -+}; -+MODULE_DEVICE_TABLE(platform, platform_ids); -+ -+static const struct of_device_id dwc_otg_of_match_table[] = { -+ { .compatible = "brcm,bcm2708-usb", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, dwc_otg_of_match_table); -+ -+static struct platform_driver dwc_otg_driver = { -+ .driver = { -+ .name = (char *)dwc_driver_name, -+ .of_match_table = dwc_otg_of_match_table, -+ }, -+ .id_table = platform_ids, -+ -+ .probe = dwc_otg_driver_probe, -+ .remove = dwc_otg_driver_remove, -+ // no 'shutdown', 'suspend', 'resume', 'suspend_late' or 'resume_early' -+}; -+#endif -+ -+/** -+ * This function is called when the dwc_otg_driver is installed with the -+ * insmod command. It registers the dwc_otg_driver structure with the -+ * appropriate bus driver. This will cause the dwc_otg_driver_probe function -+ * to be called. In addition, the bus driver will automatically expose -+ * attributes defined for the device and driver in the special sysfs file -+ * system. -+ * -+ * @return -+ */ -+static int __init dwc_otg_driver_init(void) -+{ -+ int retval = 0; -+ int error; -+ struct device_driver *drv; -+ -+ if(fiq_fsm_enable && !fiq_enable) { -+ printk(KERN_WARNING "dwc_otg: fiq_fsm_enable was set without fiq_enable! Correcting.\n"); -+ fiq_enable = 1; -+ } -+ -+ printk(KERN_INFO "%s: version %s (%s bus)\n", dwc_driver_name, -+ DWC_DRIVER_VERSION, -+#ifdef LM_INTERFACE -+ "logicmodule"); -+ retval = lm_driver_register(&dwc_otg_driver); -+ drv = &dwc_otg_driver.drv; -+#elif defined(PCI_INTERFACE) -+ "pci"); -+ retval = pci_register_driver(&dwc_otg_driver); -+ drv = &dwc_otg_driver.driver; -+#elif defined(PLATFORM_INTERFACE) -+ "platform"); -+ retval = platform_driver_register(&dwc_otg_driver); -+ drv = &dwc_otg_driver.driver; -+#endif -+ if (retval < 0) { -+ printk(KERN_ERR "%s retval=%d\n", __func__, retval); -+ return retval; -+ } -+ printk(KERN_DEBUG "dwc_otg: FIQ %s\n", fiq_enable ? "enabled":"disabled"); -+ printk(KERN_DEBUG "dwc_otg: NAK holdoff %s\n", nak_holdoff ? "enabled":"disabled"); -+ printk(KERN_DEBUG "dwc_otg: FIQ split-transaction FSM %s\n", fiq_fsm_enable ? "enabled":"disabled"); -+ -+ error = driver_create_file(drv, &driver_attr_version); -+#ifdef DEBUG -+ error = driver_create_file(drv, &driver_attr_debuglevel); -+#endif -+ return retval; -+} -+ -+module_init(dwc_otg_driver_init); -+ -+/** -+ * This function is called when the driver is removed from the kernel -+ * with the rmmod command. The driver unregisters itself with its bus -+ * driver. -+ * -+ */ -+static void __exit dwc_otg_driver_cleanup(void) -+{ -+ printk(KERN_DEBUG "dwc_otg_driver_cleanup()\n"); -+ -+#ifdef LM_INTERFACE -+ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_debuglevel); -+ driver_remove_file(&dwc_otg_driver.drv, &driver_attr_version); -+ lm_driver_unregister(&dwc_otg_driver); -+#elif defined(PCI_INTERFACE) -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); -+ pci_unregister_driver(&dwc_otg_driver); -+#elif defined(PLATFORM_INTERFACE) -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel); -+ driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version); -+ platform_driver_unregister(&dwc_otg_driver); -+#endif -+ -+ printk(KERN_INFO "%s module removed\n", dwc_driver_name); -+} -+ -+module_exit(dwc_otg_driver_cleanup); -+ -+MODULE_DESCRIPTION(DWC_DRIVER_DESC); -+MODULE_AUTHOR("Synopsys Inc."); -+MODULE_LICENSE("GPL"); -+ -+module_param_named(otg_cap, dwc_otg_module_params.otg_cap, int, 0444); -+MODULE_PARM_DESC(otg_cap, "OTG Capabilities 0=HNP&SRP 1=SRP Only 2=None"); -+module_param_named(opt, dwc_otg_module_params.opt, int, 0444); -+MODULE_PARM_DESC(opt, "OPT Mode"); -+module_param_named(dma_enable, dwc_otg_module_params.dma_enable, int, 0444); -+MODULE_PARM_DESC(dma_enable, "DMA Mode 0=Slave 1=DMA enabled"); -+ -+module_param_named(dma_desc_enable, dwc_otg_module_params.dma_desc_enable, int, -+ 0444); -+MODULE_PARM_DESC(dma_desc_enable, -+ "DMA Desc Mode 0=Address DMA 1=DMA Descriptor enabled"); -+ -+module_param_named(dma_burst_size, dwc_otg_module_params.dma_burst_size, int, -+ 0444); -+MODULE_PARM_DESC(dma_burst_size, -+ "DMA Burst Size 1, 4, 8, 16, 32, 64, 128, 256"); -+module_param_named(speed, dwc_otg_module_params.speed, int, 0444); -+MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); -+module_param_named(host_support_fs_ls_low_power, -+ dwc_otg_module_params.host_support_fs_ls_low_power, int, -+ 0444); -+MODULE_PARM_DESC(host_support_fs_ls_low_power, -+ "Support Low Power w/FS or LS 0=Support 1=Don't Support"); -+module_param_named(host_ls_low_power_phy_clk, -+ dwc_otg_module_params.host_ls_low_power_phy_clk, int, 0444); -+MODULE_PARM_DESC(host_ls_low_power_phy_clk, -+ "Low Speed Low Power Clock 0=48Mhz 1=6Mhz"); -+module_param_named(enable_dynamic_fifo, -+ dwc_otg_module_params.enable_dynamic_fifo, int, 0444); -+MODULE_PARM_DESC(enable_dynamic_fifo, "0=cC Setting 1=Allow Dynamic Sizing"); -+module_param_named(data_fifo_size, dwc_otg_module_params.data_fifo_size, int, -+ 0444); -+MODULE_PARM_DESC(data_fifo_size, -+ "Total number of words in the data FIFO memory 32-32768"); -+module_param_named(dev_rx_fifo_size, dwc_otg_module_params.dev_rx_fifo_size, -+ int, 0444); -+MODULE_PARM_DESC(dev_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); -+module_param_named(dev_nperio_tx_fifo_size, -+ dwc_otg_module_params.dev_nperio_tx_fifo_size, int, 0444); -+MODULE_PARM_DESC(dev_nperio_tx_fifo_size, -+ "Number of words in the non-periodic Tx FIFO 16-32768"); -+module_param_named(dev_perio_tx_fifo_size_1, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[0], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_1, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_2, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[1], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_2, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_3, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[2], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_3, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_4, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[3], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_4, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_5, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[4], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_5, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_6, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[5], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_6, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_7, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[6], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_7, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_8, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[7], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_8, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_9, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[8], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_9, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_10, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[9], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_10, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_11, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[10], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_11, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_12, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[11], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_12, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_13, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[12], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_13, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_14, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[13], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_14, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(dev_perio_tx_fifo_size_15, -+ dwc_otg_module_params.dev_perio_tx_fifo_size[14], int, 0444); -+MODULE_PARM_DESC(dev_perio_tx_fifo_size_15, -+ "Number of words in the periodic Tx FIFO 4-768"); -+module_param_named(host_rx_fifo_size, dwc_otg_module_params.host_rx_fifo_size, -+ int, 0444); -+MODULE_PARM_DESC(host_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); -+module_param_named(host_nperio_tx_fifo_size, -+ dwc_otg_module_params.host_nperio_tx_fifo_size, int, 0444); -+MODULE_PARM_DESC(host_nperio_tx_fifo_size, -+ "Number of words in the non-periodic Tx FIFO 16-32768"); -+module_param_named(host_perio_tx_fifo_size, -+ dwc_otg_module_params.host_perio_tx_fifo_size, int, 0444); -+MODULE_PARM_DESC(host_perio_tx_fifo_size, -+ "Number of words in the host periodic Tx FIFO 16-32768"); -+module_param_named(max_transfer_size, dwc_otg_module_params.max_transfer_size, -+ int, 0444); -+/** @todo Set the max to 512K, modify checks */ -+MODULE_PARM_DESC(max_transfer_size, -+ "The maximum transfer size supported in bytes 2047-65535"); -+module_param_named(max_packet_count, dwc_otg_module_params.max_packet_count, -+ int, 0444); -+MODULE_PARM_DESC(max_packet_count, -+ "The maximum number of packets in a transfer 15-511"); -+module_param_named(host_channels, dwc_otg_module_params.host_channels, int, -+ 0444); -+MODULE_PARM_DESC(host_channels, -+ "The number of host channel registers to use 1-16"); -+module_param_named(dev_endpoints, dwc_otg_module_params.dev_endpoints, int, -+ 0444); -+MODULE_PARM_DESC(dev_endpoints, -+ "The number of endpoints in addition to EP0 available for device mode 1-15"); -+module_param_named(phy_type, dwc_otg_module_params.phy_type, int, 0444); -+MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI"); -+module_param_named(phy_utmi_width, dwc_otg_module_params.phy_utmi_width, int, -+ 0444); -+MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); -+module_param_named(phy_ulpi_ddr, dwc_otg_module_params.phy_ulpi_ddr, int, 0444); -+MODULE_PARM_DESC(phy_ulpi_ddr, -+ "ULPI at double or single data rate 0=Single 1=Double"); -+module_param_named(phy_ulpi_ext_vbus, dwc_otg_module_params.phy_ulpi_ext_vbus, -+ int, 0444); -+MODULE_PARM_DESC(phy_ulpi_ext_vbus, -+ "ULPI PHY using internal or external vbus 0=Internal"); -+module_param_named(i2c_enable, dwc_otg_module_params.i2c_enable, int, 0444); -+MODULE_PARM_DESC(i2c_enable, "FS PHY Interface"); -+module_param_named(ulpi_fs_ls, dwc_otg_module_params.ulpi_fs_ls, int, 0444); -+MODULE_PARM_DESC(ulpi_fs_ls, "ULPI PHY FS/LS mode only"); -+module_param_named(ts_dline, dwc_otg_module_params.ts_dline, int, 0444); -+MODULE_PARM_DESC(ts_dline, "Term select Dline pulsing for all PHYs"); -+module_param_named(debug, g_dbg_lvl, int, 0444); -+MODULE_PARM_DESC(debug, ""); -+ -+module_param_named(en_multiple_tx_fifo, -+ dwc_otg_module_params.en_multiple_tx_fifo, int, 0444); -+MODULE_PARM_DESC(en_multiple_tx_fifo, -+ "Dedicated Non Periodic Tx FIFOs 0=disabled 1=enabled"); -+module_param_named(dev_tx_fifo_size_1, -+ dwc_otg_module_params.dev_tx_fifo_size[0], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_1, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_2, -+ dwc_otg_module_params.dev_tx_fifo_size[1], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_2, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_3, -+ dwc_otg_module_params.dev_tx_fifo_size[2], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_3, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_4, -+ dwc_otg_module_params.dev_tx_fifo_size[3], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_4, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_5, -+ dwc_otg_module_params.dev_tx_fifo_size[4], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_5, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_6, -+ dwc_otg_module_params.dev_tx_fifo_size[5], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_6, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_7, -+ dwc_otg_module_params.dev_tx_fifo_size[6], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_7, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_8, -+ dwc_otg_module_params.dev_tx_fifo_size[7], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_8, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_9, -+ dwc_otg_module_params.dev_tx_fifo_size[8], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_9, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_10, -+ dwc_otg_module_params.dev_tx_fifo_size[9], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_10, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_11, -+ dwc_otg_module_params.dev_tx_fifo_size[10], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_11, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_12, -+ dwc_otg_module_params.dev_tx_fifo_size[11], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_12, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_13, -+ dwc_otg_module_params.dev_tx_fifo_size[12], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_13, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_14, -+ dwc_otg_module_params.dev_tx_fifo_size[13], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_14, "Number of words in the Tx FIFO 4-768"); -+module_param_named(dev_tx_fifo_size_15, -+ dwc_otg_module_params.dev_tx_fifo_size[14], int, 0444); -+MODULE_PARM_DESC(dev_tx_fifo_size_15, "Number of words in the Tx FIFO 4-768"); -+ -+module_param_named(thr_ctl, dwc_otg_module_params.thr_ctl, int, 0444); -+MODULE_PARM_DESC(thr_ctl, -+ "Thresholding enable flag bit 0 - non ISO Tx thr., 1 - ISO Tx thr., 2 - Rx thr.- bit 0=disabled 1=enabled"); -+module_param_named(tx_thr_length, dwc_otg_module_params.tx_thr_length, int, -+ 0444); -+MODULE_PARM_DESC(tx_thr_length, "Tx Threshold length in 32 bit DWORDs"); -+module_param_named(rx_thr_length, dwc_otg_module_params.rx_thr_length, int, -+ 0444); -+MODULE_PARM_DESC(rx_thr_length, "Rx Threshold length in 32 bit DWORDs"); -+ -+module_param_named(pti_enable, dwc_otg_module_params.pti_enable, int, 0444); -+module_param_named(mpi_enable, dwc_otg_module_params.mpi_enable, int, 0444); -+module_param_named(lpm_enable, dwc_otg_module_params.lpm_enable, int, 0444); -+MODULE_PARM_DESC(lpm_enable, "LPM Enable 0=LPM Disabled 1=LPM Enabled"); -+module_param_named(ic_usb_cap, dwc_otg_module_params.ic_usb_cap, int, 0444); -+MODULE_PARM_DESC(ic_usb_cap, -+ "IC_USB Capability 0=IC_USB Disabled 1=IC_USB Enabled"); -+module_param_named(ahb_thr_ratio, dwc_otg_module_params.ahb_thr_ratio, int, -+ 0444); -+MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio"); -+module_param_named(power_down, dwc_otg_module_params.power_down, int, 0444); -+MODULE_PARM_DESC(power_down, "Power Down Mode"); -+module_param_named(reload_ctl, dwc_otg_module_params.reload_ctl, int, 0444); -+MODULE_PARM_DESC(reload_ctl, "HFIR Reload Control"); -+module_param_named(dev_out_nak, dwc_otg_module_params.dev_out_nak, int, 0444); -+MODULE_PARM_DESC(dev_out_nak, "Enable Device OUT NAK"); -+module_param_named(cont_on_bna, dwc_otg_module_params.cont_on_bna, int, 0444); -+MODULE_PARM_DESC(cont_on_bna, "Enable Enable Continue on BNA"); -+module_param_named(ahb_single, dwc_otg_module_params.ahb_single, int, 0444); -+MODULE_PARM_DESC(ahb_single, "Enable AHB Single Support"); -+module_param_named(adp_enable, dwc_otg_module_params.adp_enable, int, 0444); -+MODULE_PARM_DESC(adp_enable, "ADP Enable 0=ADP Disabled 1=ADP Enabled"); -+module_param_named(otg_ver, dwc_otg_module_params.otg_ver, int, 0444); -+MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0"); -+module_param(microframe_schedule, bool, 0444); -+MODULE_PARM_DESC(microframe_schedule, "Enable the microframe scheduler"); -+ -+module_param(fiq_enable, bool, 0444); -+MODULE_PARM_DESC(fiq_enable, "Enable the FIQ"); -+module_param(nak_holdoff, ushort, 0644); -+MODULE_PARM_DESC(nak_holdoff, "Throttle duration for bulk split-transaction endpoints on a NAK. Default 8"); -+module_param(fiq_fsm_enable, bool, 0444); -+MODULE_PARM_DESC(fiq_fsm_enable, "Enable the FIQ to perform split transactions as defined by fiq_fsm_mask"); -+module_param(fiq_fsm_mask, ushort, 0444); -+MODULE_PARM_DESC(fiq_fsm_mask, "Bitmask of transactions to perform in the FIQ.\n" -+ "Bit 0 : Non-periodic split transactions\n" -+ "Bit 1 : Periodic split transactions\n" -+ "Bit 2 : High-speed multi-transfer isochronous\n" -+ "All other bits should be set 0."); -+ -+ -+/** @page "Module Parameters" -+ * -+ * The following parameters may be specified when starting the module. -+ * These parameters define how the DWC_otg controller should be -+ * configured. Parameter values are passed to the CIL initialization -+ * function dwc_otg_cil_init -+ * -+ * Example: modprobe dwc_otg speed=1 otg_cap=1 -+ * -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+*/ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.h b/drivers/usb/host/dwc_otg/dwc_otg_driver.h -new file mode 100644 -index 0000000000000000000000000000000000000000..6a8be63a0ab20f4e1c56251b85648aa2a1d66383 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.h -@@ -0,0 +1,86 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $ -+ * $Revision: #19 $ -+ * $Date: 2010/11/15 $ -+ * $Change: 1627671 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_DRIVER_H__ -+#define __DWC_OTG_DRIVER_H__ -+ -+/** @file -+ * This file contains the interface to the Linux driver. -+ */ -+#include "dwc_otg_os_dep.h" -+#include "dwc_otg_core_if.h" -+ -+/* Type declarations */ -+struct dwc_otg_pcd; -+struct dwc_otg_hcd; -+ -+/** -+ * This structure is a wrapper that encapsulates the driver components used to -+ * manage a single DWC_otg controller. -+ */ -+typedef struct dwc_otg_device { -+ /** Structure containing OS-dependent stuff. KEEP THIS STRUCT AT THE -+ * VERY BEGINNING OF THE DEVICE STRUCT. OSes such as FreeBSD and NetBSD -+ * require this. */ -+ struct os_dependent os_dep; -+ -+ /** Pointer to the core interface structure. */ -+ dwc_otg_core_if_t *core_if; -+ -+ /** Pointer to the PCD structure. */ -+ struct dwc_otg_pcd *pcd; -+ -+ /** Pointer to the HCD structure. */ -+ struct dwc_otg_hcd *hcd; -+ -+ /** Flag to indicate whether the common IRQ handler is installed. */ -+ uint8_t common_irq_installed; -+ -+} dwc_otg_device_t; -+ -+/*We must clear S3C24XX_EINTPEND external interrupt register -+ * because after clearing in this register trigerred IRQ from -+ * H/W core in kernel interrupt can be occured again before OTG -+ * handlers clear all IRQ sources of Core registers because of -+ * timing latencies and Low Level IRQ Type. -+ */ -+#ifdef CONFIG_MACH_IPMATE -+#define S3C2410X_CLEAR_EINTPEND() \ -+do { \ -+ __raw_writel(1UL << 11,S3C24XX_EINTPEND); \ -+} while (0) -+#else -+#define S3C2410X_CLEAR_EINTPEND() do { } while (0) -+#endif -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -new file mode 100644 -index 0000000000000000000000000000000000000000..13047c08fb71cc6e44c66096720d4654d3f9e4e1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -@@ -0,0 +1,1355 @@ -+/* -+ * dwc_otg_fiq_fsm.c - The finite state machine FIQ -+ * -+ * Copyright (c) 2013 Raspberry Pi Foundation -+ * -+ * Author: Jonathan Bell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of Raspberry Pi nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * This FIQ implements functionality that performs split transactions on -+ * the dwc_otg hardware without any outside intervention. A split transaction -+ * is "queued" by nominating a specific host channel to perform the entirety -+ * of a split transaction. This FIQ will then perform the microframe-precise -+ * scheduling required in each phase of the transaction until completion. -+ * -+ * The FIQ functionality is glued into the Synopsys driver via the entry point -+ * in the FSM enqueue function, and at the exit point in handling a HC interrupt -+ * for a FSM-enabled channel. -+ * -+ * NB: Large parts of this implementation have architecture-specific code. -+ * For porting this functionality to other ARM machines, the minimum is required: -+ * - An interrupt controller allowing the top-level dwc USB interrupt to be routed -+ * to the FIQ -+ * - A method of forcing a software generated interrupt from FIQ mode that then -+ * triggers an IRQ entry (with the dwc USB handler called by this IRQ number) -+ * - Guaranteed interrupt routing such that both the FIQ and SGI occur on the same -+ * processor core - there is no locking between the FIQ and IRQ (aside from -+ * local_fiq_disable) -+ * -+ */ -+ -+#include "dwc_otg_fiq_fsm.h" -+ -+ -+char buffer[1000*16]; -+int wptr; -+void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...) -+{ -+ enum fiq_debug_level dbg_lvl_req = FIQDBG_ERR; -+ va_list args; -+ char text[17]; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + 0x408) }; -+ -+ if((dbg_lvl & dbg_lvl_req) || dbg_lvl == FIQDBG_ERR) -+ { -+ snprintf(text, 9, " %4d:%1u ", hfnum.b.frnum/8, hfnum.b.frnum & 7); -+ va_start(args, fmt); -+ vsnprintf(text+8, 9, fmt, args); -+ va_end(args); -+ -+ memcpy(buffer + wptr, text, 16); -+ wptr = (wptr + 16) % sizeof(buffer); -+ } -+} -+ -+/** -+ * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock -+ * Must be called with local interrupts and FIQ disabled. -+ */ -+#if defined(CONFIG_ARCH_BCM2835) && defined(CONFIG_SMP) -+inline void fiq_fsm_spin_lock(fiq_lock_t *lock) -+{ -+ unsigned long tmp; -+ uint32_t newval; -+ fiq_lock_t lockval; -+ smp_mb__before_spinlock(); -+ /* Nested locking, yay. If we are on the same CPU as the fiq, then the disable -+ * will be sufficient. If we are on a different CPU, then the lock protects us. */ -+ prefetchw(&lock->slock); -+ asm volatile ( -+ "1: ldrex %0, [%3]\n" -+ " add %1, %0, %4\n" -+ " strex %2, %1, [%3]\n" -+ " teq %2, #0\n" -+ " bne 1b" -+ : "=&r" (lockval), "=&r" (newval), "=&r" (tmp) -+ : "r" (&lock->slock), "I" (1 << 16) -+ : "cc"); -+ -+ while (lockval.tickets.next != lockval.tickets.owner) { -+ wfe(); -+ lockval.tickets.owner = ACCESS_ONCE(lock->tickets.owner); -+ } -+ smp_mb(); -+} -+#else -+inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { } -+#endif -+ -+/** -+ * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock -+ */ -+#if defined(CONFIG_ARCH_BCM2835) && defined(CONFIG_SMP) -+inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) -+{ -+ smp_mb(); -+ lock->tickets.owner++; -+ dsb_sev(); -+} -+#else -+inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) { } -+#endif -+ -+/** -+ * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction -+ * @channel: channel to re-enable -+ */ -+static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force) -+{ -+ hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) }; -+ -+ hcchar.b.chen = 0; -+ if (st->channel[n].hcchar_copy.b.eptype & 0x1) { -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; -+ /* Hardware bug workaround: update the ssplit index */ -+ if (st->channel[n].hcsplt_copy.b.spltena) -+ st->channel[n].expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; -+ -+ hcchar.b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; -+ } -+ -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); -+ hcchar.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ hcchar.b.chen = 1; -+ -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, hcchar.d32); -+ fiq_print(FIQDBG_INT, st, "HCGO %01d %01d", n, force); -+} -+ -+/** -+ * fiq_fsm_setup_csplit() - Prepare a host channel for a CSplit transaction stage -+ * @st: Pointer to the channel's state -+ * @n : channel number -+ * -+ * Change host channel registers to perform a complete-split transaction. Being mindful of the -+ * endpoint direction, set control regs up correctly. -+ */ -+static void notrace fiq_fsm_setup_csplit(struct fiq_state *st, int n) -+{ -+ hcsplt_data_t hcsplt = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT) }; -+ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; -+ -+ hcsplt.b.compsplt = 1; -+ if (st->channel[n].hcchar_copy.b.epdir == 1) { -+ // If IN, the CSPLIT result contains the data or a hub handshake. hctsiz = maxpacket. -+ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; -+ } else { -+ // If OUT, the CSPLIT result contains handshake only. -+ hctsiz.b.xfersize = 0; -+ } -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); -+ mb(); -+} -+ -+static inline int notrace fiq_get_xfer_len(struct fiq_state *st, int n) -+{ -+ /* The xfersize register is a bit wonky. For IN transfers, it decrements by the packet size. */ -+ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; -+ -+ if (st->channel[n].hcchar_copy.b.epdir == 0) { -+ return st->channel[n].hctsiz_copy.b.xfersize; -+ } else { -+ return st->channel[n].hctsiz_copy.b.xfersize - hctsiz.b.xfersize; -+ } -+ -+} -+ -+ -+/** -+ * fiq_increment_dma_buf() - update DMA address for bounce buffers after a CSPLIT -+ * -+ * Of use only for IN periodic transfers. -+ */ -+static int notrace fiq_increment_dma_buf(struct fiq_state *st, int num_channels, int n) -+{ -+ hcdma_data_t hcdma; -+ int i = st->channel[n].dma_info.index; -+ int len; -+ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; -+ -+ len = fiq_get_xfer_len(st, n); -+ fiq_print(FIQDBG_INT, st, "LEN: %03d", len); -+ st->channel[n].dma_info.slot_len[i] = len; -+ i++; -+ if (i > 6) -+ BUG(); -+ -+ hcdma.d32 = (dma_addr_t) &blob->channel[n].index[i].buf[0]; -+ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); -+ st->channel[n].dma_info.index = i; -+ return 0; -+} -+ -+/** -+ * fiq_reload_hctsiz() - for IN transactions, reset HCTSIZ -+ */ -+static void notrace fiq_fsm_reload_hctsiz(struct fiq_state *st, int n) -+{ -+ hctsiz_data_t hctsiz = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ) }; -+ hctsiz.b.xfersize = st->channel[n].hctsiz_copy.b.xfersize; -+ hctsiz.b.pktcnt = 1; -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); -+} -+ -+/** -+ * fiq_iso_out_advance() - update DMA address and split position bits -+ * for isochronous OUT transactions. -+ * -+ * Returns 1 if this is the last packet queued, 0 otherwise. Split-ALL and -+ * Split-BEGIN states are not handled - this is done when the transaction was queued. -+ * -+ * This function must only be called from the FIQ_ISO_OUT_ACTIVE state. -+ */ -+static int notrace fiq_iso_out_advance(struct fiq_state *st, int num_channels, int n) -+{ -+ hcsplt_data_t hcsplt; -+ hctsiz_data_t hctsiz; -+ hcdma_data_t hcdma; -+ struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base; -+ int last = 0; -+ int i = st->channel[n].dma_info.index; -+ -+ fiq_print(FIQDBG_INT, st, "ADV %01d %01d ", n, i); -+ i++; -+ if (i == 4) -+ last = 1; -+ if (st->channel[n].dma_info.slot_len[i+1] == 255) -+ last = 1; -+ -+ /* New DMA address - address of bounce buffer referred to in index */ -+ hcdma.d32 = (uint32_t) &blob->channel[n].index[i].buf[0]; -+ //hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n)); -+ //hcdma.d32 += st->channel[n].dma_info.slot_len[i]; -+ fiq_print(FIQDBG_INT, st, "LAST: %01d ", last); -+ fiq_print(FIQDBG_INT, st, "LEN: %03d", st->channel[n].dma_info.slot_len[i]); -+ hcsplt.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT); -+ hctsiz.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ); -+ hcsplt.b.xactpos = (last) ? ISOC_XACTPOS_END : ISOC_XACTPOS_MID; -+ /* Set up new packet length */ -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.xfersize = st->channel[n].dma_info.slot_len[i]; -+ fiq_print(FIQDBG_INT, st, "%08x", hctsiz.d32); -+ -+ st->channel[n].dma_info.index++; -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32); -+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32); -+ FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); -+ return last; -+} -+ -+/** -+ * fiq_fsm_tt_next_isoc() - queue next pending isochronous out start-split on a TT -+ * -+ * Despite the limitations of the DWC core, we can force a microframe pipeline of -+ * isochronous OUT start-split transactions while waiting for a corresponding other-type -+ * of endpoint to finish its CSPLITs. TTs have big periodic buffers therefore it -+ * is very unlikely that filling the start-split FIFO will cause data loss. -+ * This allows much better interleaving of transactions in an order-independent way- -+ * there is no requirement to prioritise isochronous, just a state-space search has -+ * to be performed on each periodic start-split complete interrupt. -+ */ -+static int notrace fiq_fsm_tt_next_isoc(struct fiq_state *st, int num_channels, int n) -+{ -+ int hub_addr = st->channel[n].hub_addr; -+ int port_addr = st->channel[n].port_addr; -+ int i, poked = 0; -+ for (i = 0; i < num_channels; i++) { -+ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) -+ continue; -+ if (st->channel[i].hub_addr == hub_addr && -+ st->channel[i].port_addr == port_addr) { -+ switch (st->channel[i].fsm) { -+ case FIQ_PER_ISO_OUT_PENDING: -+ if (st->channel[i].nrpackets == 1) { -+ st->channel[i].fsm = FIQ_PER_ISO_OUT_LAST; -+ } else { -+ st->channel[i].fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ } -+ fiq_fsm_restart_channel(st, i, 0); -+ poked = 1; -+ break; -+ -+ default: -+ break; -+ } -+ } -+ if (poked) -+ break; -+ } -+ return poked; -+} -+ -+/** -+ * fiq_fsm_tt_in_use() - search for host channels using this TT -+ * @n: Channel to use as reference -+ * -+ */ -+int notrace noinline fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n) -+{ -+ int hub_addr = st->channel[n].hub_addr; -+ int port_addr = st->channel[n].port_addr; -+ int i, in_use = 0; -+ for (i = 0; i < num_channels; i++) { -+ if (i == n || st->channel[i].fsm == FIQ_PASSTHROUGH) -+ continue; -+ switch (st->channel[i].fsm) { -+ /* TT is reserved for channels that are in the middle of a periodic -+ * split transaction. -+ */ -+ case FIQ_PER_SSPLIT_STARTED: -+ case FIQ_PER_CSPLIT_WAIT: -+ case FIQ_PER_CSPLIT_NYET1: -+ //case FIQ_PER_CSPLIT_POLL: -+ case FIQ_PER_ISO_OUT_ACTIVE: -+ case FIQ_PER_ISO_OUT_LAST: -+ if (st->channel[i].hub_addr == hub_addr && -+ st->channel[i].port_addr == port_addr) { -+ in_use = 1; -+ } -+ break; -+ default: -+ break; -+ } -+ if (in_use) -+ break; -+ } -+ return in_use; -+} -+ -+/** -+ * fiq_fsm_more_csplits() - determine whether additional CSPLITs need -+ * to be issued for this IN transaction. -+ * -+ * We cannot tell the inbound PID of a data packet due to hardware limitations. -+ * we need to make an educated guess as to whether we need to queue another CSPLIT -+ * or not. A no-brainer is when we have received enough data to fill the endpoint -+ * size, but for endpoints that give variable-length data then we have to resort -+ * to heuristics. -+ * -+ * We also return whether this is the last CSPLIT to be queued, again based on -+ * heuristics. This is to allow a 1-uframe overlap of periodic split transactions. -+ * Note: requires at least 1 CSPLIT to have been performed prior to being called. -+ */ -+ -+/* -+ * We need some way of guaranteeing if a returned periodic packet of size X -+ * has a DATA0 PID. -+ * The heuristic value of 144 bytes assumes that the received data has maximal -+ * bit-stuffing and the clock frequency of the transmitting device is at the lowest -+ * permissible limit. If the transfer length results in a final packet size -+ * 144 < p <= 188, then an erroneous CSPLIT will be issued. -+ * Also used to ensure that an endpoint will nominally only return a single -+ * complete-split worth of data. -+ */ -+#define DATA0_PID_HEURISTIC 144 -+ -+static int notrace noinline fiq_fsm_more_csplits(struct fiq_state *state, int n, int *probably_last) -+{ -+ -+ int i; -+ int total_len = 0; -+ int more_needed = 1; -+ struct fiq_channel_state *st = &state->channel[n]; -+ -+ for (i = 0; i < st->dma_info.index; i++) { -+ total_len += st->dma_info.slot_len[i]; -+ } -+ -+ *probably_last = 0; -+ -+ if (st->hcchar_copy.b.eptype == 0x3) { -+ /* -+ * An interrupt endpoint will take max 2 CSPLITs. if we are receiving data -+ * then this is definitely the last CSPLIT. -+ */ -+ *probably_last = 1; -+ } else { -+ /* Isoc IN. This is a bit risky if we are the first transaction: -+ * we may have been held off slightly. */ -+ if (i > 1 && st->dma_info.slot_len[st->dma_info.index-1] <= DATA0_PID_HEURISTIC) { -+ more_needed = 0; -+ } -+ /* If in the next uframe we will receive enough data to fill the endpoint, -+ * then only issue 1 more csplit. -+ */ -+ if (st->hctsiz_copy.b.xfersize - total_len <= DATA0_PID_HEURISTIC) -+ *probably_last = 1; -+ } -+ -+ if (total_len >= st->hctsiz_copy.b.xfersize || -+ i == 6 || total_len == 0) -+ /* Note: due to bit stuffing it is possible to have > 6 CSPLITs for -+ * a single endpoint. Accepting more would completely break our scheduling mechanism though -+ * - in these extreme cases we will pass through a truncated packet. -+ */ -+ more_needed = 0; -+ -+ return more_needed; -+} -+ -+/** -+ * fiq_fsm_too_late() - Test transaction for lateness -+ * -+ * If a SSPLIT for a large IN transaction is issued too late in a frame, -+ * the hub will disable the port to the device and respond with ERR handshakes. -+ * The hub status endpoint will not reflect this change. -+ * Returns 1 if we will issue a SSPLIT that will result in a device babble. -+ */ -+int notrace fiq_fsm_too_late(struct fiq_state *st, int n) -+{ -+ int uframe; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; -+ uframe = hfnum.b.frnum & 0x7; -+ if ((uframe < 6) && (st->channel[n].nrpackets + 1 + uframe > 7)) { -+ return 1; -+ } else { -+ return 0; -+ } -+} -+ -+ -+/** -+ * fiq_fsm_start_next_periodic() - A half-arsed attempt at a microframe pipeline -+ * -+ * Search pending transactions in the start-split pending state and queue them. -+ * Don't queue packets in uframe .5 (comes out in .6) (USB2.0 11.18.4). -+ * Note: we specifically don't do isochronous OUT transactions first because better -+ * use of the TT's start-split fifo can be achieved by pipelining an IN before an OUT. -+ */ -+static void notrace noinline fiq_fsm_start_next_periodic(struct fiq_state *st, int num_channels) -+{ -+ int n; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(st->dwc_regs_base + HFNUM) }; -+ if ((hfnum.b.frnum & 0x7) == 5) -+ return; -+ for (n = 0; n < num_channels; n++) { -+ if (st->channel[n].fsm == FIQ_PER_SSPLIT_QUEUED) { -+ /* Check to see if any other transactions are using this TT */ -+ if(!fiq_fsm_tt_in_use(st, num_channels, n)) { -+ if (!fiq_fsm_too_late(st, n)) { -+ st->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; -+ fiq_print(FIQDBG_INT, st, "NEXTPER "); -+ fiq_fsm_restart_channel(st, n, 0); -+ } else { -+ st->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; -+ } -+ break; -+ } -+ } -+ } -+ for (n = 0; n < num_channels; n++) { -+ if (st->channel[n].fsm == FIQ_PER_ISO_OUT_PENDING) { -+ if (!fiq_fsm_tt_in_use(st, num_channels, n)) { -+ fiq_print(FIQDBG_INT, st, "NEXTISO "); -+ st->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ fiq_fsm_restart_channel(st, n, 0); -+ break; -+ } -+ } -+ } -+} -+ -+/** -+ * fiq_fsm_update_hs_isoc() - update isochronous frame and transfer data -+ * @state: Pointer to fiq_state -+ * @n: Channel transaction is active on -+ * @hcint: Copy of host channel interrupt register -+ * -+ * Returns 0 if there are no more transactions for this HC to do, 1 -+ * otherwise. -+ */ -+static int notrace noinline fiq_fsm_update_hs_isoc(struct fiq_state *state, int n, hcint_data_t hcint) -+{ -+ struct fiq_channel_state *st = &state->channel[n]; -+ int xfer_len = 0, nrpackets = 0; -+ hcdma_data_t hcdma; -+ fiq_print(FIQDBG_INT, state, "HSISO %02d", n); -+ -+ xfer_len = fiq_get_xfer_len(state, n); -+ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].actual_length = xfer_len; -+ -+ st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].status = hcint.d32; -+ -+ st->hs_isoc_info.index++; -+ if (st->hs_isoc_info.index == st->hs_isoc_info.nrframes) { -+ return 0; -+ } -+ -+ /* grab the next DMA address offset from the array */ -+ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].offset; -+ FIQ_WRITE(state->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32); -+ -+ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as -+ * the core needs to be told to send the correct number. Caution: for IN transfers, -+ * this is always set to the maximum size of the endpoint. */ -+ xfer_len = st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].length; -+ /* Integer divide in a FIQ: fun. FIXME: make this not suck */ -+ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; -+ if (nrpackets == 0) -+ nrpackets = 1; -+ st->hcchar_copy.b.multicnt = nrpackets; -+ st->hctsiz_copy.b.pktcnt = nrpackets; -+ -+ /* Initial PID also needs to be set */ -+ if (st->hcchar_copy.b.epdir == 0) { -+ st->hctsiz_copy.b.xfersize = xfer_len; -+ switch (st->hcchar_copy.b.multicnt) { -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_MDATA; -+ break; -+ } -+ -+ } else { -+ switch (st->hcchar_copy.b.multicnt) { -+ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA1; -+ break; -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA2; -+ break; -+ } -+ } -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, st->hctsiz_copy.d32); -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR, st->hcchar_copy.d32); -+ /* Channel is enabled on hcint handler exit */ -+ fiq_print(FIQDBG_INT, state, "HSISOOUT"); -+ return 1; -+} -+ -+ -+/** -+ * fiq_fsm_do_sof() - FSM start-of-frame interrupt handler -+ * @state: Pointer to the state struct passed from banked FIQ mode registers. -+ * @num_channels: set according to the DWC hardware configuration -+ * -+ * The SOF handler in FSM mode has two functions -+ * 1. Hold off SOF from causing schedule advancement in IRQ context if there's -+ * nothing to do -+ * 2. Advance certain FSM states that require either a microframe delay, or a microframe -+ * of holdoff. -+ * -+ * The second part is architecture-specific to mach-bcm2835 - -+ * a sane interrupt controller would have a mask register for ARM interrupt sources -+ * to be promoted to the nFIQ line, but it doesn't. Instead a single interrupt -+ * number (USB) can be enabled. This means that certain parts of the USB specification -+ * that require "wait a little while, then issue another packet" cannot be fulfilled with -+ * the timing granularity required to achieve optimal throughout. The workaround is to use -+ * the SOF "timer" (125uS) to perform this task. -+ */ -+static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_channels) -+{ -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(state->dwc_regs_base + HFNUM) }; -+ int n; -+ int kick_irq = 0; -+ -+ if ((hfnum.b.frnum & 0x7) == 1) { -+ /* We cannot issue csplits for transactions in the last frame past (n+1).1 -+ * Check to see if there are any transactions that are stale. -+ * Boot them out. -+ */ -+ for (n = 0; n < num_channels; n++) { -+ switch (state->channel[n].fsm) { -+ case FIQ_PER_CSPLIT_WAIT: -+ case FIQ_PER_CSPLIT_NYET1: -+ case FIQ_PER_CSPLIT_POLL: -+ case FIQ_PER_CSPLIT_LAST: -+ /* Check if we are no longer in the same full-speed frame. */ -+ if (((state->channel[n].expected_uframe & 0x3FFF) & ~0x7) < -+ (hfnum.b.frnum & ~0x7)) -+ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; -+ break; -+ default: -+ break; -+ } -+ } -+ } -+ -+ for (n = 0; n < num_channels; n++) { -+ switch (state->channel[n].fsm) { -+ -+ case FIQ_NP_SSPLIT_RETRY: -+ case FIQ_NP_IN_CSPLIT_RETRY: -+ case FIQ_NP_OUT_CSPLIT_RETRY: -+ fiq_fsm_restart_channel(state, n, 0); -+ break; -+ -+ case FIQ_HS_ISOC_SLEEPING: -+ /* Is it time to wake this channel yet? */ -+ if (--state->channel[n].uframe_sleeps == 0) { -+ state->channel[n].fsm = FIQ_HS_ISOC_TURBO; -+ fiq_fsm_restart_channel(state, n, 0); -+ } -+ break; -+ -+ case FIQ_PER_SSPLIT_QUEUED: -+ if ((hfnum.b.frnum & 0x7) == 5) -+ break; -+ if(!fiq_fsm_tt_in_use(state, num_channels, n)) { -+ if (!fiq_fsm_too_late(state, n)) { -+ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n); -+ fiq_fsm_restart_channel(state, n, 0); -+ state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; -+ } else { -+ /* Transaction cannot be started without risking a device babble error */ -+ state->channel[n].fsm = FIQ_PER_SPLIT_TIMEOUT; -+ state->haintmsk_saved.b2.chint &= ~(1 << n); -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); -+ kick_irq |= 1; -+ } -+ } -+ break; -+ -+ case FIQ_PER_ISO_OUT_PENDING: -+ /* Ordinarily, this should be poked after the SSPLIT -+ * complete interrupt for a competing transfer on the same -+ * TT. Doesn't happen for aborted transactions though. -+ */ -+ if ((hfnum.b.frnum & 0x7) >= 5) -+ break; -+ if (!fiq_fsm_tt_in_use(state, num_channels, n)) { -+ /* Hardware bug. SOF can sometimes occur after the channel halt interrupt -+ * that caused this. -+ */ -+ fiq_fsm_restart_channel(state, n, 0); -+ fiq_print(FIQDBG_INT, state, "SOF ISOC"); -+ if (state->channel[n].nrpackets == 1) { -+ state->channel[n].fsm = FIQ_PER_ISO_OUT_LAST; -+ } else { -+ state->channel[n].fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ } -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_WAIT: -+ /* we are guaranteed to be in this state if and only if the SSPLIT interrupt -+ * occurred when the bus transaction occurred. The SOF interrupt reversal bug -+ * will utterly bugger this up though. -+ */ -+ if (hfnum.b.frnum != state->channel[n].expected_uframe) { -+ fiq_print(FIQDBG_INT, state, "SOFCS %d ", n); -+ state->channel[n].fsm = FIQ_PER_CSPLIT_POLL; -+ fiq_fsm_restart_channel(state, n, 0); -+ fiq_fsm_start_next_periodic(state, num_channels); -+ -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_TIMEOUT: -+ case FIQ_DEQUEUE_ISSUED: -+ /* Ugly: we have to force a HCD interrupt. -+ * Poke the mask for the channel in question. -+ * We will take a fake SOF because of this, but -+ * that's OK. -+ */ -+ state->haintmsk_saved.b2.chint &= ~(1 << n); -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, 0); -+ kick_irq |= 1; -+ break; -+ -+ default: -+ break; -+ } -+ } -+ -+ if (state->kick_np_queues || -+ dwc_frame_num_le(state->next_sched_frame, hfnum.b.frnum)) -+ kick_irq |= 1; -+ -+ return !kick_irq; -+} -+ -+ -+/** -+ * fiq_fsm_do_hcintr() - FSM host channel interrupt handler -+ * @state: Pointer to the FIQ state struct -+ * @num_channels: Number of channels as per hardware config -+ * @n: channel for which HAINT(i) was raised -+ * -+ * An important property is that only the CHHLT interrupt is unmasked. Unfortunately, AHBerr is as well. -+ */ -+static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_channels, int n) -+{ -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ hcint_data_t hcint_probe; -+ hcchar_data_t hcchar; -+ int handled = 0; -+ int restart = 0; -+ int last_csplit = 0; -+ int start_next_periodic = 0; -+ struct fiq_channel_state *st = &state->channel[n]; -+ hfnum_data_t hfnum; -+ -+ hcint.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT); -+ hcintmsk.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK); -+ hcint_probe.d32 = hcint.d32 & hcintmsk.d32; -+ -+ if (st->fsm != FIQ_PASSTHROUGH) { -+ fiq_print(FIQDBG_INT, state, "HC%01d ST%02d", n, st->fsm); -+ fiq_print(FIQDBG_INT, state, "%08x", hcint.d32); -+ } -+ -+ switch (st->fsm) { -+ -+ case FIQ_PASSTHROUGH: -+ case FIQ_DEQUEUE_ISSUED: -+ /* doesn't belong to us, kick it upstairs */ -+ break; -+ -+ case FIQ_PASSTHROUGH_ERRORSTATE: -+ /* We are here to emulate the error recovery mechanism of the dwc HCD. -+ * Several interrupts are unmasked if a previous transaction failed - it's -+ * death for the FIQ to attempt to handle them as the channel isn't halted. -+ * Emulate what the HCD does in this situation: mask and continue. -+ * The FSM has no other state setup so this has to be handled out-of-band. -+ */ -+ fiq_print(FIQDBG_ERR, state, "ERRST %02d", n); -+ if (hcint_probe.b.nak || hcint_probe.b.ack || hcint_probe.b.datatglerr) { -+ fiq_print(FIQDBG_ERR, state, "RESET %02d", n); -+ /* In some random cases we can get a NAK interrupt coincident with a Xacterr -+ * interrupt, after the device has disappeared. -+ */ -+ if (!hcint.b.xacterr) -+ st->nr_errors = 0; -+ hcintmsk.b.nak = 0; -+ hcintmsk.b.ack = 0; -+ hcintmsk.b.datatglerr = 0; -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINTMSK, hcintmsk.d32); -+ return 1; -+ } -+ if (hcint_probe.b.chhltd) { -+ fiq_print(FIQDBG_ERR, state, "CHHLT %02d", n); -+ fiq_print(FIQDBG_ERR, state, "%08x", hcint.d32); -+ return 0; -+ } -+ break; -+ -+ /* Non-periodic state groups */ -+ case FIQ_NP_SSPLIT_STARTED: -+ case FIQ_NP_SSPLIT_RETRY: -+ /* Got a HCINT for a NP SSPLIT. Expected ACK / NAK / fail */ -+ if (hcint.b.ack) { -+ /* SSPLIT complete. For OUT, the data has been sent. For IN, the LS transaction -+ * will start shortly. SOF needs to kick the transaction to prevent a NYET flood. -+ */ -+ if(st->hcchar_copy.b.epdir == 1) -+ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; -+ else -+ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; -+ st->nr_errors = 0; -+ handled = 1; -+ fiq_fsm_setup_csplit(state, n); -+ } else if (hcint.b.nak) { -+ // No buffer space in TT. Retry on a uframe boundary. -+ st->fsm = FIQ_NP_SSPLIT_RETRY; -+ handled = 1; -+ } else if (hcint.b.xacterr) { -+ // The only other one we care about is xacterr. This implies HS bus error - retry. -+ st->nr_errors++; -+ st->fsm = FIQ_NP_SSPLIT_RETRY; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ restart = 1; -+ } -+ } else { -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ handled = 0; -+ restart = 0; -+ } -+ break; -+ -+ case FIQ_NP_IN_CSPLIT_RETRY: -+ /* Received a CSPLIT done interrupt. -+ * Expected Data/NAK/STALL/NYET for IN. -+ */ -+ if (hcint.b.xfercomp) { -+ /* For IN, data is present. */ -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nak) { -+ /* no endpoint data. Punt it upstairs */ -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nyet) { -+ /* CSPLIT NYET - retry on a uframe boundary. */ -+ handled = 1; -+ st->nr_errors = 0; -+ } else if (hcint.b.datatglerr) { -+ /* data toggle errors do not set the xfercomp bit. */ -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ } else if (hcint.b.xacterr) { -+ /* HS error. Retry immediate */ -+ st->fsm = FIQ_NP_IN_CSPLIT_RETRY; -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ restart = 1; -+ } -+ } else if (hcint.b.stall || hcint.b.bblerr) { -+ /* A STALL implies either a LS bus error or a genuine STALL. */ -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ } else { -+ /* Hardware bug. It's possible in some cases to -+ * get a channel halt with nothing else set when -+ * the response was a NYET. Treat as local 3-strikes retry. -+ */ -+ hcint_data_t hcint_test = hcint; -+ hcint_test.b.chhltd = 0; -+ if (!hcint_test.d32) { -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ } -+ } else { -+ /* Bail out if something unexpected happened */ -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } -+ } -+ break; -+ -+ case FIQ_NP_OUT_CSPLIT_RETRY: -+ /* Received a CSPLIT done interrupt. -+ * Expected ACK/NAK/STALL/NYET/XFERCOMP for OUT.*/ -+ if (hcint.b.xfercomp) { -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nak) { -+ // The HCD will implement the holdoff on frame boundaries. -+ st->fsm = FIQ_NP_SPLIT_DONE; -+ } else if (hcint.b.nyet) { -+ // Hub still processing. -+ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; -+ handled = 1; -+ st->nr_errors = 0; -+ //restart = 1; -+ } else if (hcint.b.xacterr) { -+ /* HS error. retry immediate */ -+ st->fsm = FIQ_NP_OUT_CSPLIT_RETRY; -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ restart = 1; -+ } -+ } else if (hcint.b.stall) { -+ /* LS bus error or genuine stall */ -+ st->fsm = FIQ_NP_SPLIT_LS_ABORTED; -+ } else { -+ /* -+ * Hardware bug. It's possible in some cases to get a -+ * channel halt with nothing else set when the response was a NYET. -+ * Treat as local 3-strikes retry. -+ */ -+ hcint_data_t hcint_test = hcint; -+ hcint_test.b.chhltd = 0; -+ if (!hcint_test.d32) { -+ st->nr_errors++; -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } else { -+ handled = 1; -+ } -+ } else { -+ // Something unexpected happened. AHBerror or babble perhaps. Let the IRQ deal with it. -+ st->fsm = FIQ_NP_SPLIT_HS_ABORTED; -+ } -+ } -+ break; -+ -+ /* Periodic split states (except isoc out) */ -+ case FIQ_PER_SSPLIT_STARTED: -+ /* Expect an ACK or failure for SSPLIT */ -+ if (hcint.b.ack) { -+ /* -+ * SSPLIT transfer complete interrupt - the generation of this interrupt is fraught with bugs. -+ * For a packet queued in microframe n-3 to appear in n-2, if the channel is enabled near the EOF1 -+ * point for microframe n-3, the packet will not appear on the bus until microframe n. -+ * Additionally, the generation of the actual interrupt is dodgy. For a packet appearing on the bus -+ * in microframe n, sometimes the interrupt is generated immediately. Sometimes, it appears in n+1 -+ * coincident with SOF for n+1. -+ * SOF is also buggy. It can sometimes be raised AFTER the first bus transaction has taken place. -+ * These appear to be caused by timing/clock crossing bugs within the core itself. -+ * State machine workaround. -+ */ -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ fiq_fsm_setup_csplit(state, n); -+ /* Poke the oddfrm bit. If we are equivalent, we received the interrupt at the correct -+ * time. If not, then we're in the next SOF. -+ */ -+ if ((hfnum.b.frnum & 0x1) == hcchar.b.oddfrm) { -+ fiq_print(FIQDBG_INT, state, "CSWAIT %01d", n); -+ st->expected_uframe = hfnum.b.frnum; -+ st->fsm = FIQ_PER_CSPLIT_WAIT; -+ } else { -+ fiq_print(FIQDBG_INT, state, "CSPOL %01d", n); -+ /* For isochronous IN endpoints, -+ * we need to hold off if we are expecting a lot of data */ -+ if (st->hcchar_copy.b.mps < DATA0_PID_HEURISTIC) { -+ start_next_periodic = 1; -+ } -+ /* Danger will robinson: we are in a broken state. If our first interrupt after -+ * this is a NYET, it will be delayed by 1 uframe and result in an unrecoverable -+ * lag. Unmask the NYET interrupt. -+ */ -+ st->expected_uframe = (hfnum.b.frnum + 1) & 0x3FFF; -+ st->fsm = FIQ_PER_CSPLIT_BROKEN_NYET1; -+ restart = 1; -+ } -+ handled = 1; -+ } else if (hcint.b.xacterr) { -+ /* 3-strikes retry is enabled, we have hit our max nr_errors */ -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ start_next_periodic = 1; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ start_next_periodic = 1; -+ } -+ /* We can now queue the next isochronous OUT transaction, if one is pending. */ -+ if(fiq_fsm_tt_next_isoc(state, num_channels, n)) { -+ fiq_print(FIQDBG_INT, state, "NEXTISO "); -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_NYET1: -+ /* First CSPLIT attempt was a NYET. If we get a subsequent NYET, -+ * we are too late and the TT has dropped its CSPLIT fifo. -+ */ -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ start_next_periodic = 1; -+ if (hcint.b.nak) { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } else if (hcint.b.xfercomp) { -+ fiq_increment_dma_buf(state, num_channels, n); -+ st->fsm = FIQ_PER_CSPLIT_POLL; -+ st->nr_errors = 0; -+ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { -+ handled = 1; -+ restart = 1; -+ if (!last_csplit) -+ start_next_periodic = 0; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } else if (hcint.b.nyet) { -+ /* Doh. Data lost. */ -+ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; -+ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { -+ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_BROKEN_NYET1: -+ /* -+ * we got here because our host channel is in the delayed-interrupt -+ * state and we cannot take a NYET interrupt any later than when it -+ * occurred. Disable then re-enable the channel if this happens to force -+ * CSPLITs to occur at the right time. -+ */ -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ fiq_print(FIQDBG_INT, state, "BROK: %01d ", n); -+ if (hcint.b.nak) { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ start_next_periodic = 1; -+ } else if (hcint.b.xfercomp) { -+ fiq_increment_dma_buf(state, num_channels, n); -+ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { -+ st->fsm = FIQ_PER_CSPLIT_POLL; -+ handled = 1; -+ restart = 1; -+ start_next_periodic = 1; -+ /* Reload HCTSIZ for the next transfer */ -+ fiq_fsm_reload_hctsiz(state, n); -+ if (!last_csplit) -+ start_next_periodic = 0; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } else if (hcint.b.nyet) { -+ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; -+ start_next_periodic = 1; -+ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { -+ /* Local 3-strikes retry is handled by the core. This is a ERR response.*/ -+ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ } -+ break; -+ -+ case FIQ_PER_CSPLIT_POLL: -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ hcchar.d32 = FIQ_READ(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR); -+ start_next_periodic = 1; -+ if (hcint.b.nak) { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } else if (hcint.b.xfercomp) { -+ fiq_increment_dma_buf(state, num_channels, n); -+ if (fiq_fsm_more_csplits(state, n, &last_csplit)) { -+ handled = 1; -+ restart = 1; -+ /* Reload HCTSIZ for the next transfer */ -+ fiq_fsm_reload_hctsiz(state, n); -+ if (!last_csplit) -+ start_next_periodic = 0; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } else if (hcint.b.nyet) { -+ /* Are we a NYET after the first data packet? */ -+ if (st->nrpackets == 0) { -+ st->fsm = FIQ_PER_CSPLIT_NYET1; -+ handled = 1; -+ restart = 1; -+ } else { -+ /* We got a NYET when polling CSPLITs. Can happen -+ * if our heuristic fails, or if someone disables us -+ * for any significant length of time. -+ */ -+ if (st->nr_errors >= 3) { -+ st->fsm = FIQ_PER_SPLIT_NYET_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_DONE; -+ } -+ } -+ } else if (hcint.b.xacterr || hcint.b.stall || hcint.b.bblerr) { -+ /* For xacterr, Local 3-strikes retry is handled by the core. This is a ERR response.*/ -+ st->fsm = FIQ_PER_SPLIT_LS_ABORTED; -+ } else { -+ st->fsm = FIQ_PER_SPLIT_HS_ABORTED; -+ } -+ break; -+ -+ case FIQ_HS_ISOC_TURBO: -+ if (fiq_fsm_update_hs_isoc(state, n, hcint)) { -+ /* more transactions to come */ -+ handled = 1; -+ fiq_print(FIQDBG_INT, state, "HSISO M "); -+ /* For strided transfers, put ourselves to sleep */ -+ if (st->hs_isoc_info.stride > 1) { -+ st->uframe_sleeps = st->hs_isoc_info.stride - 1; -+ st->fsm = FIQ_HS_ISOC_SLEEPING; -+ } else { -+ restart = 1; -+ } -+ } else { -+ st->fsm = FIQ_HS_ISOC_DONE; -+ fiq_print(FIQDBG_INT, state, "HSISO F "); -+ } -+ break; -+ -+ case FIQ_HS_ISOC_ABORTED: -+ /* This abort is called by the driver rewriting the state mid-transaction -+ * which allows the dequeue mechanism to work more effectively. -+ */ -+ break; -+ -+ case FIQ_PER_ISO_OUT_ACTIVE: -+ if (hcint.b.ack) { -+ if(fiq_iso_out_advance(state, num_channels, n)) { -+ /* last OUT transfer */ -+ st->fsm = FIQ_PER_ISO_OUT_LAST; -+ /* -+ * Assuming the periodic FIFO in the dwc core -+ * actually does its job properly, we can queue -+ * the next ssplit now and in theory, the wire -+ * transactions will be in-order. -+ */ -+ // No it doesn't. It appears to process requests in host channel order. -+ //start_next_periodic = 1; -+ } -+ handled = 1; -+ restart = 1; -+ } else { -+ /* -+ * Isochronous transactions carry on regardless. Log the error -+ * and continue. -+ */ -+ //explode += 1; -+ st->nr_errors++; -+ if(fiq_iso_out_advance(state, num_channels, n)) { -+ st->fsm = FIQ_PER_ISO_OUT_LAST; -+ //start_next_periodic = 1; -+ } -+ handled = 1; -+ restart = 1; -+ } -+ break; -+ -+ case FIQ_PER_ISO_OUT_LAST: -+ if (hcint.b.ack) { -+ /* All done here */ -+ st->fsm = FIQ_PER_ISO_OUT_DONE; -+ } else { -+ st->fsm = FIQ_PER_ISO_OUT_DONE; -+ st->nr_errors++; -+ } -+ start_next_periodic = 1; -+ break; -+ -+ case FIQ_PER_SPLIT_TIMEOUT: -+ /* SOF kicked us because we overran. */ -+ start_next_periodic = 1; -+ break; -+ -+ default: -+ break; -+ } -+ -+ if (handled) { -+ FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCINT, hcint.d32); -+ } else { -+ /* Copy the regs into the state so the IRQ knows what to do */ -+ st->hcint_copy.d32 = hcint.d32; -+ } -+ -+ if (restart) { -+ /* Restart always implies handled. */ -+ if (restart == 2) { -+ /* For complete-split INs, the show must go on. -+ * Force a channel restart */ -+ fiq_fsm_restart_channel(state, n, 1); -+ } else { -+ fiq_fsm_restart_channel(state, n, 0); -+ } -+ } -+ if (start_next_periodic) { -+ fiq_fsm_start_next_periodic(state, num_channels); -+ } -+ if (st->fsm != FIQ_PASSTHROUGH) -+ fiq_print(FIQDBG_INT, state, "FSMOUT%02d", st->fsm); -+ -+ return handled; -+} -+ -+ -+/** -+ * dwc_otg_fiq_fsm() - Flying State Machine (monster) FIQ -+ * @state: pointer to state struct passed from the banked FIQ mode registers. -+ * @num_channels: set according to the DWC hardware configuration -+ * @dma: pointer to DMA bounce buffers for split transaction slots -+ * -+ * The FSM FIQ performs the low-level tasks that normally would be performed by the microcode -+ * inside an EHCI or similar host controller regarding split transactions. The DWC core -+ * interrupts each and every time a split transaction packet is received or sent successfully. -+ * This results in either an interrupt storm when everything is working "properly", or -+ * the interrupt latency of the system in general breaks time-sensitive periodic split -+ * transactions. Pushing the low-level, but relatively easy state machine work into the FIQ -+ * solves these problems. -+ * -+ * Return: void -+ */ -+void notrace dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels) -+{ -+ gintsts_data_t gintsts, gintsts_handled; -+ gintmsk_data_t gintmsk; -+ //hfnum_data_t hfnum; -+ haint_data_t haint, haint_handled; -+ haintmsk_data_t haintmsk; -+ int kick_irq = 0; -+ -+ gintsts_handled.d32 = 0; -+ haint_handled.d32 = 0; -+ -+ fiq_fsm_spin_lock(&state->lock); -+ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); -+ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); -+ gintsts.d32 &= gintmsk.d32; -+ -+ if (gintsts.b.sofintr) { -+ /* For FSM mode, SOF is required to keep the state machine advance for -+ * certain stages of the periodic pipeline. It's death to mask this -+ * interrupt in that case. -+ */ -+ -+ if (!fiq_fsm_do_sof(state, num_channels)) { -+ /* Kick IRQ once. Queue advancement means that all pending transactions -+ * will get serviced when the IRQ finally executes. -+ */ -+ if (state->gintmsk_saved.b.sofintr == 1) -+ kick_irq |= 1; -+ state->gintmsk_saved.b.sofintr = 0; -+ } -+ gintsts_handled.b.sofintr = 1; -+ } -+ -+ if (gintsts.b.hcintr) { -+ int i; -+ haint.d32 = FIQ_READ(state->dwc_regs_base + HAINT); -+ haintmsk.d32 = FIQ_READ(state->dwc_regs_base + HAINTMSK); -+ haint.d32 &= haintmsk.d32; -+ haint_handled.d32 = 0; -+ for (i=0; ihaintmsk_saved.b2.chint &= ~(1 << i); -+ } else { -+ /* do_hcintr cleaned up after itself, but clear haint */ -+ haint_handled.b2.chint |= (1 << i); -+ } -+ } -+ } -+ -+ if (haint_handled.b2.chint) { -+ FIQ_WRITE(state->dwc_regs_base + HAINT, haint_handled.d32); -+ } -+ -+ if (haintmsk.d32 != (haintmsk.d32 & state->haintmsk_saved.d32)) { -+ /* -+ * This is necessary to avoid multiple retriggers of the MPHI in the case -+ * where interrupts are held off and HCINTs start to pile up. -+ * Only wake up the IRQ if a new interrupt came in, was not handled and was -+ * masked. -+ */ -+ haintmsk.d32 &= state->haintmsk_saved.d32; -+ FIQ_WRITE(state->dwc_regs_base + HAINTMSK, haintmsk.d32); -+ kick_irq |= 1; -+ } -+ /* Top-Level interrupt - always handled because it's level-sensitive */ -+ gintsts_handled.b.hcintr = 1; -+ } -+ -+ -+ /* Clear the bits in the saved register that were not handled but were triggered. */ -+ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); -+ -+ /* FIQ didn't handle something - mask has changed - write new mask */ -+ if (gintmsk.d32 != (gintmsk.d32 & state->gintmsk_saved.d32)) { -+ gintmsk.d32 &= state->gintmsk_saved.d32; -+ gintmsk.b.sofintr = 1; -+ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); -+// fiq_print(FIQDBG_INT, state, "KICKGINT"); -+// fiq_print(FIQDBG_INT, state, "%08x", gintmsk.d32); -+// fiq_print(FIQDBG_INT, state, "%08x", state->gintmsk_saved.d32); -+ kick_irq |= 1; -+ } -+ -+ if (gintsts_handled.d32) { -+ /* Only applies to edge-sensitive bits in GINTSTS */ -+ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); -+ } -+ -+ /* We got an interrupt, didn't handle it. */ -+ if (kick_irq) { -+ state->mphi_int_count++; -+ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); -+ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); -+ -+ } -+ state->fiq_done++; -+ mb(); -+ fiq_fsm_spin_unlock(&state->lock); -+} -+ -+ -+/** -+ * dwc_otg_fiq_nop() - FIQ "lite" -+ * @state: pointer to state struct passed from the banked FIQ mode registers. -+ * -+ * The "nop" handler does not intervene on any interrupts other than SOF. -+ * It is limited in scope to deciding at each SOF if the IRQ SOF handler (which deals -+ * with non-periodic/periodic queues) needs to be kicked. -+ * -+ * This is done to hold off the SOF interrupt, which occurs at a rate of 8000 per second. -+ * -+ * Return: void -+ */ -+void notrace dwc_otg_fiq_nop(struct fiq_state *state) -+{ -+ gintsts_data_t gintsts, gintsts_handled; -+ gintmsk_data_t gintmsk; -+ hfnum_data_t hfnum; -+ -+ fiq_fsm_spin_lock(&state->lock); -+ hfnum.d32 = FIQ_READ(state->dwc_regs_base + HFNUM); -+ gintsts.d32 = FIQ_READ(state->dwc_regs_base + GINTSTS); -+ gintmsk.d32 = FIQ_READ(state->dwc_regs_base + GINTMSK); -+ gintsts.d32 &= gintmsk.d32; -+ gintsts_handled.d32 = 0; -+ -+ if (gintsts.b.sofintr) { -+ if (!state->kick_np_queues && -+ dwc_frame_num_gt(state->next_sched_frame, hfnum.b.frnum)) { -+ /* SOF handled, no work to do, just ACK interrupt */ -+ gintsts_handled.b.sofintr = 1; -+ } else { -+ /* Kick IRQ */ -+ state->gintmsk_saved.b.sofintr = 0; -+ } -+ } -+ -+ /* Reset handled interrupts */ -+ if(gintsts_handled.d32) { -+ FIQ_WRITE(state->dwc_regs_base + GINTSTS, gintsts_handled.d32); -+ } -+ -+ /* Clear the bits in the saved register that were not handled but were triggered. */ -+ state->gintmsk_saved.d32 &= ~(gintsts.d32 & ~gintsts_handled.d32); -+ -+ /* We got an interrupt, didn't handle it and want to mask it */ -+ if (~(state->gintmsk_saved.d32)) { -+ state->mphi_int_count++; -+ gintmsk.d32 &= state->gintmsk_saved.d32; -+ FIQ_WRITE(state->dwc_regs_base + GINTMSK, gintmsk.d32); -+ /* Force a clear before another dummy send */ -+ FIQ_WRITE(state->mphi_regs.intstat, (1<<29)); -+ FIQ_WRITE(state->mphi_regs.outdda, (int) state->dummy_send); -+ FIQ_WRITE(state->mphi_regs.outddb, (1<<29)); -+ -+ } -+ state->fiq_done++; -+ mb(); -+ fiq_fsm_spin_unlock(&state->lock); -+} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f9fddfbcffb37f32c808fd78f222b676378398b1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -@@ -0,0 +1,370 @@ -+/* -+ * dwc_otg_fiq_fsm.h - Finite state machine FIQ header definitions -+ * -+ * Copyright (c) 2013 Raspberry Pi Foundation -+ * -+ * Author: Jonathan Bell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of Raspberry Pi nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * This FIQ implements functionality that performs split transactions on -+ * the dwc_otg hardware without any outside intervention. A split transaction -+ * is "queued" by nominating a specific host channel to perform the entirety -+ * of a split transaction. This FIQ will then perform the microframe-precise -+ * scheduling required in each phase of the transaction until completion. -+ * -+ * The FIQ functionality has been surgically implanted into the Synopsys -+ * vendor-provided driver. -+ * -+ */ -+ -+#ifndef DWC_OTG_FIQ_FSM_H_ -+#define DWC_OTG_FIQ_FSM_H_ -+ -+#include "dwc_otg_regs.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_hcd.h" -+#include -+#include -+#include -+#include -+ -+#if 0 -+#define FLAME_ON(x) \ -+do { \ -+ int gpioreg; \ -+ \ -+ gpioreg = readl(__io_address(0x20200000+0x8)); \ -+ gpioreg &= ~(7 << (x-20)*3); \ -+ gpioreg |= 0x1 << (x-20)*3; \ -+ writel(gpioreg, __io_address(0x20200000+0x8)); \ -+ \ -+ writel(1< 1, SOF wakes up the isochronous FSM */ -+ FIQ_HS_ISOC_SLEEPING = 24, -+ FIQ_HS_ISOC_DONE = 25, -+ FIQ_HS_ISOC_ABORTED = 26, -+ FIQ_DEQUEUE_ISSUED = 30, -+ FIQ_TEST = 32, -+}; -+ -+struct fiq_stack { -+ int magic1; -+ uint8_t stack[2048]; -+ int magic2; -+}; -+ -+ -+/** -+ * struct fiq_dma_info - DMA bounce buffer utilisation information (per-channel) -+ * @index: Number of slots reported used for IN transactions / number of slots -+ * transmitted for an OUT transaction -+ * @slot_len[6]: Number of actual transfer bytes in each slot (255 if unused) -+ * -+ * Split transaction transfers can have variable length depending on other bus -+ * traffic. The OTG core DMA engine requires 4-byte aligned addresses therefore -+ * each transaction needs a guaranteed aligned address. A maximum of 6 split transfers -+ * can happen per-frame. -+ */ -+struct fiq_dma_info { -+ u8 index; -+ u8 slot_len[6]; -+}; -+ -+struct __attribute__((packed)) fiq_split_dma_slot { -+ u8 buf[188]; -+}; -+ -+struct fiq_dma_channel { -+ struct __attribute__((packed)) fiq_split_dma_slot index[6]; -+}; -+ -+struct fiq_dma_blob { -+ struct __attribute__((packed)) fiq_dma_channel channel[0]; -+}; -+ -+/** -+ * struct fiq_hs_isoc_info - USB2.0 isochronous data -+ * @iso_frame: Pointer to the array of OTG URB iso_frame_descs. -+ * @nrframes: Total length of iso_frame_desc array -+ * @index: Current index (FIQ-maintained) -+ * @stride: Interval in uframes between HS isoc transactions -+ */ -+struct fiq_hs_isoc_info { -+ struct dwc_otg_hcd_iso_packet_desc *iso_desc; -+ unsigned int nrframes; -+ unsigned int index; -+ unsigned int stride; -+}; -+ -+/** -+ * struct fiq_channel_state - FIQ state machine storage -+ * @fsm: Current state of the channel as understood by the FIQ -+ * @nr_errors: Number of transaction errors on this split-transaction -+ * @hub_addr: SSPLIT/CSPLIT destination hub -+ * @port_addr: SSPLIT/CSPLIT destination port - always 1 if single TT hub -+ * @nrpackets: For isoc OUT, the number of split-OUT packets to transmit. For -+ * split-IN, number of CSPLIT data packets that were received. -+ * @hcchar_copy: -+ * @hcsplt_copy: -+ * @hcintmsk_copy: -+ * @hctsiz_copy: Copies of the host channel registers. -+ * For use as scratch, or for returning state. -+ * -+ * The fiq_channel_state is state storage between interrupts for a host channel. The -+ * FSM state is stored here. Members of this structure must only be set up by the -+ * driver prior to enabling the FIQ for this host channel, and not touched until the FIQ -+ * has updated the state to either a COMPLETE state group or ABORT state group. -+ */ -+ -+struct fiq_channel_state { -+ enum fiq_fsm_state fsm; -+ unsigned int nr_errors; -+ unsigned int hub_addr; -+ unsigned int port_addr; -+ /* Hardware bug workaround: sometimes channel halt interrupts are -+ * delayed until the next SOF. Keep track of when we expected to get interrupted. */ -+ unsigned int expected_uframe; -+ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */ -+ unsigned int uframe_sleeps; -+ /* in/out for communicating number of dma buffers used, or number of ISOC to do */ -+ unsigned int nrpackets; -+ struct fiq_dma_info dma_info; -+ struct fiq_hs_isoc_info hs_isoc_info; -+ /* Copies of HC registers - in/out communication from/to IRQ handler -+ * and for ease of channel setup. A bit of mungeing is performed - for -+ * example the hctsiz.b.maxp is _always_ the max packet size of the endpoint. -+ */ -+ hcchar_data_t hcchar_copy; -+ hcsplt_data_t hcsplt_copy; -+ hcint_data_t hcint_copy; -+ hcintmsk_data_t hcintmsk_copy; -+ hctsiz_data_t hctsiz_copy; -+ hcdma_data_t hcdma_copy; -+}; -+ -+/** -+ * struct fiq_state - top-level FIQ state machine storage -+ * @mphi_regs: virtual address of the MPHI peripheral register file -+ * @dwc_regs_base: virtual address of the base of the DWC core register file -+ * @dma_base: physical address for the base of the DMA bounce buffers -+ * @dummy_send: Scratch area for sending a fake message to the MPHI peripheral -+ * @gintmsk_saved: Top-level mask of interrupts that the FIQ has not handled. -+ * Used for determining which interrupts fired to set off the IRQ handler. -+ * @haintmsk_saved: Mask of interrupts from host channels that the FIQ did not handle internally. -+ * @np_count: Non-periodic transactions in the active queue -+ * @np_sent: Count of non-periodic transactions that have completed -+ * @next_sched_frame: For periodic transactions handled by the driver's SOF-driven queuing mechanism, -+ * this is the next frame on which a SOF interrupt is required. Used to hold off -+ * passing SOF through to the driver until necessary. -+ * @channel[n]: Per-channel FIQ state. Allocated during init depending on the number of host -+ * channels configured into the core logic. -+ * -+ * This is passed as the first argument to the dwc_otg_fiq_fsm top-level FIQ handler from the asm stub. -+ * It contains top-level state information. -+ */ -+struct fiq_state { -+ fiq_lock_t lock; -+ mphi_regs_t mphi_regs; -+ void *dwc_regs_base; -+ dma_addr_t dma_base; -+ struct fiq_dma_blob *fiq_dmab; -+ void *dummy_send; -+ gintmsk_data_t gintmsk_saved; -+ haintmsk_data_t haintmsk_saved; -+ int mphi_int_count; -+ unsigned int fiq_done; -+ unsigned int kick_np_queues; -+ unsigned int next_sched_frame; -+#ifdef FIQ_DEBUG -+ char * buffer; -+ unsigned int bufsiz; -+#endif -+ struct fiq_channel_state channel[0]; -+}; -+ -+extern void fiq_fsm_spin_lock(fiq_lock_t *lock); -+ -+extern void fiq_fsm_spin_unlock(fiq_lock_t *lock); -+ -+extern int fiq_fsm_too_late(struct fiq_state *st, int n); -+ -+extern int fiq_fsm_tt_in_use(struct fiq_state *st, int num_channels, int n); -+ -+extern void dwc_otg_fiq_fsm(struct fiq_state *state, int num_channels); -+ -+extern void dwc_otg_fiq_nop(struct fiq_state *state); -+ -+#endif /* DWC_OTG_FIQ_FSM_H_ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S -new file mode 100644 -index 0000000000000000000000000000000000000000..ffa8d21bc61e893fee86ba04955587e7661d3ff2 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S -@@ -0,0 +1,80 @@ -+/* -+ * dwc_otg_fiq_fsm.S - assembly stub for the FSM FIQ -+ * -+ * Copyright (c) 2013 Raspberry Pi Foundation -+ * -+ * Author: Jonathan Bell -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * * Neither the name of Raspberry Pi nor the -+ * names of its contributors may be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+ -+#include -+#include -+ -+ -+.text -+ -+.global _dwc_otg_fiq_stub_end; -+ -+/** -+ * _dwc_otg_fiq_stub() - entry copied to the FIQ vector page to allow -+ * a C-style function call with arguments from the FIQ banked registers. -+ * r0 = &hcd->fiq_state -+ * r1 = &hcd->num_channels -+ * r2 = &hcd->dma_buffers -+ * Tramples: r0, r1, r2, r4, fp, ip -+ */ -+ -+ENTRY(_dwc_otg_fiq_stub) -+ /* Stash unbanked regs - SP will have been set up for us */ -+ mov ip, sp; -+ stmdb sp!, {r0-r12, lr}; -+#ifdef FIQ_DEBUG -+ // Cycle profiling - read cycle counter at start -+ mrc p15, 0, r5, c15, c12, 1; -+#endif -+ /* r11 = fp, don't trample it */ -+ mov r4, fp; -+ /* set EABI frame size */ -+ sub fp, ip, #512; -+ -+ /* for fiq NOP mode - just need state */ -+ mov r0, r8; -+ /* r9 = num_channels */ -+ mov r1, r9; -+ /* r10 = struct *dma_bufs */ -+// mov r2, r10; -+ -+ /* r4 = &fiq_c_function */ -+ blx r4; -+#ifdef FIQ_DEBUG -+ mrc p15, 0, r4, c15, c12, 1; -+ subs r5, r5, r4; -+ // r5 is now the cycle count time for executing the FIQ. Store it somewhere? -+#endif -+ ldmia sp!, {r0-r12, lr}; -+ subs pc, lr, #4; -+_dwc_otg_fiq_stub_end: -+END(_dwc_otg_fiq_stub) -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..027414bb2bf9fc3f3652407724187f3c6dc5ff68 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -0,0 +1,4260 @@ -+ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ -+ * $Revision: #104 $ -+ * $Date: 2011/10/24 $ -+ * $Change: 1871159 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** @file -+ * This file implements HCD Core. All code in this file is portable and doesn't -+ * use any OS specific functions. -+ * Interface provided by HCD Core is defined in -+ * header file. -+ */ -+ -+#include -+#include -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+#include "dwc_otg_fiq_fsm.h" -+ -+extern bool microframe_schedule; -+extern uint16_t fiq_fsm_mask, nak_holdoff; -+ -+//#define DEBUG_HOST_CHANNELS -+#ifdef DEBUG_HOST_CHANNELS -+static int last_sel_trans_num_per_scheduled = 0; -+static int last_sel_trans_num_nonper_scheduled = 0; -+static int last_sel_trans_num_avail_hc_at_start = 0; -+static int last_sel_trans_num_avail_hc_at_end = 0; -+#endif /* DEBUG_HOST_CHANNELS */ -+ -+ -+dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void) -+{ -+ return DWC_ALLOC(sizeof(dwc_otg_hcd_t)); -+} -+ -+/** -+ * Connection timeout function. An OTG host is required to display a -+ * message if the device does not connect within 10 seconds. -+ */ -+void dwc_otg_hcd_connect_timeout(void *ptr) -+{ -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, ptr); -+ DWC_PRINTF("Connect Timeout\n"); -+ __DWC_ERROR("Device Not Connected/Responding\n"); -+} -+ -+#if defined(DEBUG) -+static void dump_channel_info(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ if (qh->channel != NULL) { -+ dwc_hc_t *hc = qh->channel; -+ dwc_list_link_t *item; -+ dwc_otg_qh_t *qh_item; -+ int num_channels = hcd->core_if->core_params->host_channels; -+ int i; -+ -+ dwc_otg_hc_regs_t *hc_regs; -+ hcchar_data_t hcchar; -+ hcsplt_data_t hcsplt; -+ hctsiz_data_t hctsiz; -+ uint32_t hcdma; -+ -+ hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ hcdma = DWC_READ_REG32(&hc_regs->hcdma); -+ -+ DWC_PRINTF(" Assigned to channel %p:\n", hc); -+ DWC_PRINTF(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, -+ hcsplt.d32); -+ DWC_PRINTF(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, -+ hcdma); -+ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", -+ hc->dev_addr, hc->ep_num, hc->ep_is_in); -+ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); -+ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); -+ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); -+ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); -+ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); -+ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); -+ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); -+ DWC_PRINTF(" qh: %p\n", hc->qh); -+ DWC_PRINTF(" NP inactive sched:\n"); -+ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_inactive) { -+ qh_item = -+ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); -+ DWC_PRINTF(" %p\n", qh_item); -+ } -+ DWC_PRINTF(" NP active sched:\n"); -+ DWC_LIST_FOREACH(item, &hcd->non_periodic_sched_active) { -+ qh_item = -+ DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); -+ DWC_PRINTF(" %p\n", qh_item); -+ } -+ DWC_PRINTF(" Channels: \n"); -+ for (i = 0; i < num_channels; i++) { -+ dwc_hc_t *hc = hcd->hc_ptr_array[i]; -+ DWC_PRINTF(" %2d: %p\n", i, hc); -+ } -+ } -+} -+#else -+#define dump_channel_info(hcd, qh) -+#endif /* DEBUG */ -+ -+/** -+ * Work queue function for starting the HCD when A-Cable is connected. -+ * The hcd_start() must be called in a process context. -+ */ -+static void hcd_start_func(void *_vp) -+{ -+ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) _vp; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s() %p\n", __func__, hcd); -+ if (hcd) { -+ hcd->fops->start(hcd); -+ } -+} -+ -+static void del_xfer_timers(dwc_otg_hcd_t * hcd) -+{ -+#ifdef DEBUG -+ int i; -+ int num_channels = hcd->core_if->core_params->host_channels; -+ for (i = 0; i < num_channels; i++) { -+ DWC_TIMER_CANCEL(hcd->core_if->hc_xfer_timer[i]); -+ } -+#endif -+} -+ -+static void del_timers(dwc_otg_hcd_t * hcd) -+{ -+ del_xfer_timers(hcd); -+ DWC_TIMER_CANCEL(hcd->conn_timer); -+} -+ -+/** -+ * Processes all the URBs in a single list of QHs. Completes them with -+ * -ESHUTDOWN and frees the QTD. -+ */ -+static void kill_urbs_in_qh_list(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) -+{ -+ dwc_list_link_t *qh_item, *qh_tmp; -+ dwc_otg_qh_t *qh; -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ -+ DWC_LIST_FOREACH_SAFE(qh_item, qh_tmp, qh_list) { -+ qh = DWC_LIST_ENTRY(qh_item, dwc_otg_qh_t, qh_list_entry); -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, -+ &qh->qtd_list, qtd_list_entry) { -+ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ if (qtd->urb != NULL) { -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_SHUTDOWN); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ } -+ -+ } -+ if(qh->channel) { -+ /* Using hcchar.chen == 1 is not a reliable test. -+ * It is possible that the channel has already halted -+ * but not yet been through the IRQ handler. -+ */ -+ dwc_otg_hc_halt(hcd->core_if, qh->channel, -+ DWC_OTG_HC_XFER_URB_DEQUEUE); -+ if(microframe_schedule) -+ hcd->available_host_channels++; -+ qh->channel = NULL; -+ } -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } -+} -+ -+/** -+ * Responds with an error status of ESHUTDOWN to all URBs in the non-periodic -+ * and periodic schedules. The QTD associated with each URB is removed from -+ * the schedule and freed. This function may be called when a disconnect is -+ * detected or when the HCD is being stopped. -+ */ -+static void kill_all_urbs(dwc_otg_hcd_t * hcd) -+{ -+ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_inactive); -+ kill_urbs_in_qh_list(hcd, &hcd->non_periodic_sched_active); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_inactive); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_ready); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_assigned); -+ kill_urbs_in_qh_list(hcd, &hcd->periodic_sched_queued); -+} -+ -+/** -+ * Start the connection timer. An OTG host is required to display a -+ * message if the device does not connect within 10 seconds. The -+ * timer is deleted if a port connect interrupt occurs before the -+ * timer expires. -+ */ -+static void dwc_otg_hcd_start_connect_timer(dwc_otg_hcd_t * hcd) -+{ -+ DWC_TIMER_SCHEDULE(hcd->conn_timer, 10000 /* 10 secs */ ); -+} -+ -+/** -+ * HCD Callback function for disconnect of the HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_session_start_cb(void *p) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd; -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); -+ dwc_otg_hcd = p; -+ dwc_otg_hcd_start_connect_timer(dwc_otg_hcd); -+ return 1; -+} -+ -+/** -+ * HCD Callback function for starting the HCD when A-Cable is -+ * connected. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_start_cb(void *p) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = p; -+ dwc_otg_core_if_t *core_if; -+ hprt0_data_t hprt0; -+ -+ core_if = dwc_otg_hcd->core_if; -+ -+ if (core_if->op_state == B_HOST) { -+ /* -+ * Reset the port. During a HNP mode switch the reset -+ * needs to occur within 1ms and have a duration of at -+ * least 50ms. -+ */ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtrst = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ DWC_WORKQ_SCHEDULE_DELAYED(core_if->wq_otg, -+ hcd_start_func, dwc_otg_hcd, 50, -+ "start hcd"); -+ -+ return 1; -+} -+ -+/** -+ * HCD Callback function for disconnect of the HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_disconnect_cb(void *p) -+{ -+ gintsts_data_t intr; -+ dwc_otg_hcd_t *dwc_otg_hcd = p; -+ -+ /* -+ * Set status flags for the hub driver. -+ */ -+ dwc_otg_hcd->flags.b.port_connect_status_change = 1; -+ dwc_otg_hcd->flags.b.port_connect_status = 0; -+ if(fiq_enable) -+ local_fiq_disable(); -+ /* -+ * Shutdown any transfers in process by clearing the Tx FIFO Empty -+ * interrupt mask and status bits and disabling subsequent host -+ * channel interrupts. -+ */ -+ intr.d32 = 0; -+ intr.b.nptxfempty = 1; -+ intr.b.ptxfempty = 1; -+ intr.b.hcintr = 1; -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, -+ intr.d32, 0); -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintsts, -+ intr.d32, 0); -+ -+ del_timers(dwc_otg_hcd); -+ -+ /* -+ * Turn off the vbus power only if the core has transitioned to device -+ * mode. If still in host mode, need to keep power on to detect a -+ * reconnection. -+ */ -+ if (dwc_otg_is_device_mode(dwc_otg_hcd->core_if)) { -+ if (dwc_otg_hcd->core_if->op_state != A_SUSPEND) { -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ DWC_PRINTF("Disconnect: PortPower off\n"); -+ hprt0.b.prtpwr = 0; -+ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, -+ hprt0.d32); -+ } -+ -+ dwc_otg_disable_host_interrupts(dwc_otg_hcd->core_if); -+ } -+ -+ /* Respond with an error status to all URBs in the schedule. */ -+ kill_all_urbs(dwc_otg_hcd); -+ -+ if (dwc_otg_is_host_mode(dwc_otg_hcd->core_if)) { -+ /* Clean up any host channels that were in use. */ -+ int num_channels; -+ int i; -+ dwc_hc_t *channel; -+ dwc_otg_hc_regs_t *hc_regs; -+ hcchar_data_t hcchar; -+ -+ num_channels = dwc_otg_hcd->core_if->core_params->host_channels; -+ -+ if (!dwc_otg_hcd->core_if->dma_enable) { -+ /* Flush out any channel requests in slave mode. */ -+ for (i = 0; i < num_channels; i++) { -+ channel = dwc_otg_hcd->hc_ptr_array[i]; -+ if (DWC_CIRCLEQ_EMPTY_ENTRY -+ (channel, hc_list_entry)) { -+ hc_regs = -+ dwc_otg_hcd->core_if-> -+ host_if->hc_regs[i]; -+ hcchar.d32 = -+ DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chen = 0; -+ hcchar.b.chdis = 1; -+ hcchar.b.epdir = 0; -+ DWC_WRITE_REG32 -+ (&hc_regs->hcchar, -+ hcchar.d32); -+ } -+ } -+ } -+ } -+ -+ for (i = 0; i < num_channels; i++) { -+ channel = dwc_otg_hcd->hc_ptr_array[i]; -+ if (DWC_CIRCLEQ_EMPTY_ENTRY(channel, hc_list_entry)) { -+ hc_regs = -+ dwc_otg_hcd->core_if->host_if->hc_regs[i]; -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ /* Halt the channel. */ -+ hcchar.b.chdis = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, -+ hcchar.d32); -+ } -+ -+ dwc_otg_hc_cleanup(dwc_otg_hcd->core_if, -+ channel); -+ DWC_CIRCLEQ_INSERT_TAIL -+ (&dwc_otg_hcd->free_hc_list, channel, -+ hc_list_entry); -+ /* -+ * Added for Descriptor DMA to prevent channel double cleanup -+ * in release_channel_ddma(). Which called from ep_disable -+ * when device disconnect. -+ */ -+ channel->qh = NULL; -+ } -+ } -+ if(fiq_fsm_enable) { -+ for(i=0; i < 128; i++) { -+ dwc_otg_hcd->hub_port[i] = 0; -+ } -+ } -+ -+ } -+ -+ if(fiq_enable) -+ local_fiq_enable(); -+ -+ if (dwc_otg_hcd->fops->disconnect) { -+ dwc_otg_hcd->fops->disconnect(dwc_otg_hcd); -+ } -+ -+ return 1; -+} -+ -+/** -+ * HCD Callback function for stopping the HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int32_t dwc_otg_hcd_stop_cb(void *p) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = p; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p)\n", __func__, p); -+ dwc_otg_hcd_stop(dwc_otg_hcd); -+ return 1; -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * HCD Callback function for sleep of HCD. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int dwc_otg_hcd_sleep_cb(void *p) -+{ -+ dwc_otg_hcd_t *hcd = p; -+ -+ dwc_otg_hcd_free_hc_from_lpm(hcd); -+ -+ return 0; -+} -+#endif -+ -+ -+/** -+ * HCD Callback function for Remote Wakeup. -+ * -+ * @param p void pointer to the struct usb_hcd -+ */ -+static int dwc_otg_hcd_rem_wakeup_cb(void *p) -+{ -+ dwc_otg_hcd_t *hcd = p; -+ -+ if (hcd->core_if->lx_state == DWC_OTG_L2) { -+ hcd->flags.b.port_suspend_change = 1; -+ } -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ else { -+ hcd->flags.b.port_l1_change = 1; -+ } -+#endif -+ return 0; -+} -+ -+/** -+ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are -+ * stopped. -+ */ -+void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd) -+{ -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD STOP\n"); -+ -+ /* -+ * The root hub should be disconnected before this function is called. -+ * The disconnect will clear the QTD lists (via ..._hcd_urb_dequeue) -+ * and the QH lists (via ..._hcd_endpoint_disable). -+ */ -+ -+ /* Turn off all host-specific interrupts. */ -+ dwc_otg_disable_host_interrupts(hcd->core_if); -+ -+ /* Turn off the vbus power */ -+ DWC_PRINTF("PortPower off\n"); -+ hprt0.b.prtpwr = 0; -+ DWC_WRITE_REG32(hcd->core_if->host_if->hprt0, hprt0.d32); -+ dwc_mdelay(1); -+} -+ -+int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, void **ep_handle, -+ int atomic_alloc) -+{ -+ int retval = 0; -+ uint8_t needs_scheduling = 0; -+ dwc_otg_transaction_type_e tr_type; -+ dwc_otg_qtd_t *qtd; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ hprt0_data_t hprt0 = { .d32 = 0 }; -+ -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ if (NULL == hcd->core_if) { -+ DWC_ERROR("**** DWC OTG HCD URB Enqueue - HCD has NULL core_if\n"); -+ /* No longer connected. */ -+ return -DWC_E_INVALID; -+ } -+#endif -+ if (!hcd->flags.b.port_connect_status) { -+ /* No longer connected. */ -+ DWC_ERROR("Not connected\n"); -+ return -DWC_E_NO_DEVICE; -+ } -+ -+ /* Some core configurations cannot support LS traffic on a FS root port */ -+ if ((hcd->fops->speed(hcd, dwc_otg_urb->priv) == USB_SPEED_LOW) && -+ (hcd->core_if->hwcfg2.b.fs_phy_type == 1) && -+ (hcd->core_if->hwcfg2.b.hs_phy_type == 1)) { -+ hprt0.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_FULL_SPEED) { -+ return -DWC_E_NO_DEVICE; -+ } -+ } -+ -+ qtd = dwc_otg_hcd_qtd_create(dwc_otg_urb, atomic_alloc); -+ if (qtd == NULL) { -+ DWC_ERROR("DWC OTG HCD URB Enqueue failed creating QTD\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ if (qtd->urb == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD with no URBs\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+ if (qtd->urb->priv == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Enqueue created QTD URB with no URB handle\n"); -+ return -DWC_E_NO_MEMORY; -+ } -+#endif -+ intr_mask.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->gintmsk); -+ if(!intr_mask.b.sofintr || fiq_enable) needs_scheduling = 1; -+ if((((dwc_otg_qh_t *)ep_handle)->ep_type == UE_BULK) && !(qtd->urb->flags & URB_GIVEBACK_ASAP)) -+ /* Do not schedule SG transactions until qtd has URB_GIVEBACK_ASAP set */ -+ needs_scheduling = 0; -+ -+ retval = dwc_otg_hcd_qtd_add(qtd, hcd, (dwc_otg_qh_t **) ep_handle, atomic_alloc); -+ // creates a new queue in ep_handle if it doesn't exist already -+ if (retval < 0) { -+ DWC_ERROR("DWC OTG HCD URB Enqueue failed adding QTD. " -+ "Error status %d\n", retval); -+ dwc_otg_hcd_qtd_free(qtd); -+ return retval; -+ } -+ -+ if(needs_scheduling) { -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE) { -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ } -+ } -+ return retval; -+} -+ -+int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ dwc_otg_qh_t *qh; -+ dwc_otg_qtd_t *urb_qtd; -+ BUG_ON(!hcd); -+ BUG_ON(!dwc_otg_urb); -+ -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ -+ if (hcd == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL HCD\n"); -+ return -DWC_E_INVALID; -+ } -+ if (dwc_otg_urb == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue has NULL URB\n"); -+ return -DWC_E_INVALID; -+ } -+ if (dwc_otg_urb->qtd == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue with NULL QTD\n"); -+ return -DWC_E_INVALID; -+ } -+ urb_qtd = dwc_otg_urb->qtd; -+ BUG_ON(!urb_qtd); -+ if (urb_qtd->qh == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue with QTD with NULL Q handler\n"); -+ return -DWC_E_INVALID; -+ } -+#else -+ urb_qtd = dwc_otg_urb->qtd; -+ BUG_ON(!urb_qtd); -+#endif -+ qh = urb_qtd->qh; -+ BUG_ON(!qh); -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ if (urb_qtd->in_process) { -+ dump_channel_info(hcd, qh); -+ } -+ } -+#ifdef DEBUG /* integrity checks (Broadcom) */ -+ if (hcd->core_if == NULL) { -+ DWC_ERROR("**** DWC OTG HCD URB Dequeue HCD has NULL core_if\n"); -+ return -DWC_E_INVALID; -+ } -+#endif -+ if (urb_qtd->in_process && qh->channel) { -+ /* The QTD is in process (it has been assigned to a channel). */ -+ if (hcd->flags.b.port_connect_status) { -+ int n = qh->channel->hc_num; -+ /* -+ * If still connected (i.e. in host mode), halt the -+ * channel so it can be used for other transfers. If -+ * no longer connected, the host registers can't be -+ * written to halt the channel since the core is in -+ * device mode. -+ */ -+ /* In FIQ FSM mode, we need to shut down carefully. -+ * The FIQ may attempt to restart a disabled channel */ -+ if (fiq_fsm_enable && (hcd->fiq_state->channel[n].fsm != FIQ_PASSTHROUGH)) { -+ qh->channel->halt_status = DWC_OTG_HC_XFER_URB_DEQUEUE; -+ qh->channel->halt_pending = 1; -+ hcd->fiq_state->channel[n].fsm = FIQ_DEQUEUE_ISSUED; -+ } else { -+ dwc_otg_hc_halt(hcd->core_if, qh->channel, -+ DWC_OTG_HC_XFER_URB_DEQUEUE); -+ } -+ } -+ } -+ -+ /* -+ * Free the QTD and clean up the associated QH. Leave the QH in the -+ * schedule if it has any remaining QTDs. -+ */ -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue - " -+ "delete %sQueue handler\n", -+ hcd->core_if->dma_desc_enable?"DMA ":""); -+ if (!hcd->core_if->dma_desc_enable) { -+ uint8_t b = urb_qtd->in_process; -+ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); -+ if (b) { -+ dwc_otg_hcd_qh_deactivate(hcd, qh, 0); -+ qh->channel = NULL; -+ } else if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } -+ } else { -+ dwc_otg_hcd_qtd_remove_and_free(hcd, urb_qtd, qh); -+ } -+ return 0; -+} -+ -+int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, -+ int retry) -+{ -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ int retval = 0; -+ dwc_irqflags_t flags; -+ -+ if (retry < 0) { -+ retval = -DWC_E_INVALID; -+ goto done; -+ } -+ -+ if (!qh) { -+ retval = -DWC_E_INVALID; -+ goto done; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ -+ while (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list) && retry) { -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ retry--; -+ dwc_msleep(5); -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ } -+ -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ /* -+ * Split dwc_otg_hcd_qh_remove_and_free() into qh_remove -+ * and qh_free to prevent stack dump on DWC_DMA_FREE() with -+ * irq_disabled (spinlock_irqsave) in dwc_otg_hcd_desc_list_free() -+ * and dwc_otg_hcd_frame_list_alloc(). -+ */ -+ dwc_otg_hcd_qh_free(hcd, qh); -+ -+done: -+ return retval; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ int retval = 0; -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ if (!qh) -+ return -DWC_E_INVALID; -+ -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ return retval; -+} -+#endif -+ -+/** -+ * HCD Callback structure for handling mode switching. -+ */ -+static dwc_otg_cil_callbacks_t hcd_cil_callbacks = { -+ .start = dwc_otg_hcd_start_cb, -+ .stop = dwc_otg_hcd_stop_cb, -+ .disconnect = dwc_otg_hcd_disconnect_cb, -+ .session_start = dwc_otg_hcd_session_start_cb, -+ .resume_wakeup = dwc_otg_hcd_rem_wakeup_cb, -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ .sleep = dwc_otg_hcd_sleep_cb, -+#endif -+ .p = 0, -+}; -+ -+/** -+ * Reset tasklet function -+ */ -+static void reset_tasklet_func(void *data) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = (dwc_otg_hcd_t *) data; -+ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; -+ hprt0_data_t hprt0; -+ -+ DWC_DEBUGPL(DBG_HCDV, "USB RESET tasklet called\n"); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtrst = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ dwc_mdelay(60); -+ -+ hprt0.b.prtrst = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ dwc_otg_hcd->flags.b.port_reset_change = 1; -+} -+ -+static void completion_tasklet_func(void *ptr) -+{ -+ dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) ptr; -+ struct urb *urb; -+ urb_tq_entry_t *item; -+ dwc_irqflags_t flags; -+ -+ /* This could just be spin_lock_irq */ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ while (!DWC_TAILQ_EMPTY(&hcd->completed_urb_list)) { -+ item = DWC_TAILQ_FIRST(&hcd->completed_urb_list); -+ urb = item->urb; -+ DWC_TAILQ_REMOVE(&hcd->completed_urb_list, item, -+ urb_tq_entries); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ DWC_FREE(item); -+ -+ usb_hcd_giveback_urb(hcd->priv, urb, urb->status); -+ -+ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ return; -+} -+ -+static void qh_list_free(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) -+{ -+ dwc_list_link_t *item; -+ dwc_otg_qh_t *qh; -+ dwc_irqflags_t flags; -+ -+ if (!qh_list->next) { -+ /* The list hasn't been initialized yet. */ -+ return; -+ } -+ /* -+ * Hold spinlock here. Not needed in that case if bellow -+ * function is being called from ISR -+ */ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ /* Ensure there are no QTDs or URBs left. */ -+ kill_urbs_in_qh_list(hcd, qh_list); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ -+ DWC_LIST_FOREACH(item, qh_list) { -+ qh = DWC_LIST_ENTRY(item, dwc_otg_qh_t, qh_list_entry); -+ dwc_otg_hcd_qh_remove_and_free(hcd, qh); -+ } -+} -+ -+/** -+ * Exit from Hibernation if Host did not detect SRP from connected SRP capable -+ * Device during SRP time by host power up. -+ */ -+void dwc_otg_hcd_power_up(void *ptr) -+{ -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ -+ DWC_PRINTF("%s called\n", __FUNCTION__); -+ -+ if (!core_if->hibernation_suspend) { -+ DWC_PRINTF("Already exited from Hibernation\n"); -+ return; -+ } -+ -+ /* Switch on the voltage to the core */ -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Reset the core */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Disable power clamps */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ /* Remove reset the core signal */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnrstn = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Disable PMU interrupt */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ core_if->hibernation_suspend = 0; -+ -+ /* Disable PMU */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ dwc_udelay(10); -+ -+ /* Enable VBUS */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, gpwrdn.d32, 0); -+ -+ core_if->op_state = A_HOST; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_hcd_start(core_if); -+} -+ -+void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num) -+{ -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; -+ struct fiq_dma_blob *blob = hcd->fiq_dmab; -+ int i; -+ -+ st->fsm = FIQ_PASSTHROUGH; -+ st->hcchar_copy.d32 = 0; -+ st->hcsplt_copy.d32 = 0; -+ st->hcint_copy.d32 = 0; -+ st->hcintmsk_copy.d32 = 0; -+ st->hctsiz_copy.d32 = 0; -+ st->hcdma_copy.d32 = 0; -+ st->nr_errors = 0; -+ st->hub_addr = 0; -+ st->port_addr = 0; -+ st->expected_uframe = 0; -+ st->nrpackets = 0; -+ st->dma_info.index = 0; -+ for (i = 0; i < 6; i++) -+ st->dma_info.slot_len[i] = 255; -+ st->hs_isoc_info.index = 0; -+ st->hs_isoc_info.iso_desc = NULL; -+ st->hs_isoc_info.nrframes = 0; -+ -+ DWC_MEMSET(&blob->channel[num].index[0], 0x6b, 1128); -+} -+ -+/** -+ * Frees secondary storage associated with the dwc_otg_hcd structure contained -+ * in the struct usb_hcd field. -+ */ -+static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(dwc_otg_hcd); -+ int i; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD FREE\n"); -+ -+ del_timers(dwc_otg_hcd); -+ -+ /* Free memory for QH/QTD lists */ -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_inactive); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->non_periodic_sched_active); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_inactive); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_ready); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_assigned); -+ qh_list_free(dwc_otg_hcd, &dwc_otg_hcd->periodic_sched_queued); -+ -+ /* Free memory for the host channels. */ -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ dwc_hc_t *hc = dwc_otg_hcd->hc_ptr_array[i]; -+ -+#ifdef DEBUG -+ if (dwc_otg_hcd->core_if->hc_xfer_timer[i]) { -+ DWC_TIMER_FREE(dwc_otg_hcd->core_if->hc_xfer_timer[i]); -+ } -+#endif -+ if (hc != NULL) { -+ DWC_DEBUGPL(DBG_HCDV, "HCD Free channel #%i, hc=%p\n", -+ i, hc); -+ DWC_FREE(hc); -+ } -+ } -+ -+ if (dwc_otg_hcd->core_if->dma_enable) { -+ if (dwc_otg_hcd->status_buf_dma) { -+ DWC_DMA_FREE(dev, DWC_OTG_HCD_STATUS_BUF_SIZE, -+ dwc_otg_hcd->status_buf, -+ dwc_otg_hcd->status_buf_dma); -+ } -+ } else if (dwc_otg_hcd->status_buf != NULL) { -+ DWC_FREE(dwc_otg_hcd->status_buf); -+ } -+ DWC_SPINLOCK_FREE(dwc_otg_hcd->channel_lock); -+ DWC_SPINLOCK_FREE(dwc_otg_hcd->lock); -+ /* Set core_if's lock pointer to NULL */ -+ dwc_otg_hcd->core_if->lock = NULL; -+ -+ DWC_TIMER_FREE(dwc_otg_hcd->conn_timer); -+ DWC_TASK_FREE(dwc_otg_hcd->reset_tasklet); -+ DWC_TASK_FREE(dwc_otg_hcd->completion_tasklet); -+ DWC_FREE(dwc_otg_hcd->fiq_state); -+ -+#ifdef DWC_DEV_SRPCAP -+ if (dwc_otg_hcd->core_if->power_down == 2 && -+ dwc_otg_hcd->core_if->pwron_timer) { -+ DWC_TIMER_FREE(dwc_otg_hcd->core_if->pwron_timer); -+ } -+#endif -+ DWC_FREE(dwc_otg_hcd); -+} -+ -+int init_hcd_usecs(dwc_otg_hcd_t *_hcd); -+ -+int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ int retval = 0; -+ int num_channels; -+ int i; -+ dwc_hc_t *channel; -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->lock); -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(hcd->channel_lock); -+#else -+ hcd->lock = DWC_SPINLOCK_ALLOC(); -+ hcd->channel_lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ DWC_DEBUGPL(DBG_HCDV, "init of HCD %p given core_if %p\n", -+ hcd, core_if); -+ if (!hcd->lock) { -+ DWC_ERROR("Could not allocate lock for pcd"); -+ DWC_FREE(hcd); -+ retval = -DWC_E_NO_MEMORY; -+ goto out; -+ } -+ hcd->core_if = core_if; -+ -+ /* Register the HCD CIL Callbacks */ -+ dwc_otg_cil_register_hcd_callbacks(hcd->core_if, -+ &hcd_cil_callbacks, hcd); -+ -+ /* Initialize the non-periodic schedule. */ -+ DWC_LIST_INIT(&hcd->non_periodic_sched_inactive); -+ DWC_LIST_INIT(&hcd->non_periodic_sched_active); -+ -+ /* Initialize the periodic schedule. */ -+ DWC_LIST_INIT(&hcd->periodic_sched_inactive); -+ DWC_LIST_INIT(&hcd->periodic_sched_ready); -+ DWC_LIST_INIT(&hcd->periodic_sched_assigned); -+ DWC_LIST_INIT(&hcd->periodic_sched_queued); -+ DWC_TAILQ_INIT(&hcd->completed_urb_list); -+ /* -+ * Create a host channel descriptor for each host channel implemented -+ * in the controller. Initialize the channel descriptor array. -+ */ -+ DWC_CIRCLEQ_INIT(&hcd->free_hc_list); -+ num_channels = hcd->core_if->core_params->host_channels; -+ DWC_MEMSET(hcd->hc_ptr_array, 0, sizeof(hcd->hc_ptr_array)); -+ for (i = 0; i < num_channels; i++) { -+ channel = DWC_ALLOC(sizeof(dwc_hc_t)); -+ if (channel == NULL) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: host channel allocation failed\n", -+ __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ channel->hc_num = i; -+ hcd->hc_ptr_array[i] = channel; -+#ifdef DEBUG -+ hcd->core_if->hc_xfer_timer[i] = -+ DWC_TIMER_ALLOC("hc timer", hc_xfer_timeout, -+ &hcd->core_if->hc_xfer_info[i]); -+#endif -+ DWC_DEBUGPL(DBG_HCDV, "HCD Added channel #%d, hc=%p\n", i, -+ channel); -+ } -+ -+ if (fiq_enable) { -+ hcd->fiq_state = DWC_ALLOC(sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels)); -+ if (!hcd->fiq_state) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: cannot allocate fiq_state structure\n", __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ DWC_MEMSET(hcd->fiq_state, 0, (sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels))); -+ -+ for (i = 0; i < num_channels; i++) { -+ hcd->fiq_state->channel[i].fsm = FIQ_PASSTHROUGH; -+ } -+ hcd->fiq_state->dummy_send = DWC_ALLOC_ATOMIC(16); -+ -+ hcd->fiq_stack = DWC_ALLOC(sizeof(struct fiq_stack)); -+ if (!hcd->fiq_stack) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: cannot allocate fiq_stack structure\n", __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ hcd->fiq_stack->magic1 = 0xDEADBEEF; -+ hcd->fiq_stack->magic2 = 0xD00DFEED; -+ hcd->fiq_state->gintmsk_saved.d32 = ~0; -+ hcd->fiq_state->haintmsk_saved.b2.chint = ~0; -+ -+ /* This bit is terrible and uses no API, but necessary. The FIQ has no concept of DMA pools -+ * (and if it did, would be a lot slower). This allocates a chunk of memory (~9kiB for 8 host channels) -+ * for use as transaction bounce buffers in a 2-D array. Our access into this chunk is done by some -+ * moderately readable array casts. -+ */ -+ hcd->fiq_dmab = DWC_DMA_ALLOC(dev, (sizeof(struct fiq_dma_channel) * num_channels), &hcd->fiq_state->dma_base); -+ DWC_WARN("FIQ DMA bounce buffers: virt = 0x%08x dma = 0x%08x len=%d", -+ (unsigned int)hcd->fiq_dmab, (unsigned int)hcd->fiq_state->dma_base, -+ sizeof(struct fiq_dma_channel) * num_channels); -+ -+ DWC_MEMSET(hcd->fiq_dmab, 0x6b, 9024); -+ -+ /* pointer for debug in fiq_print */ -+ hcd->fiq_state->fiq_dmab = hcd->fiq_dmab; -+ if (fiq_fsm_enable) { -+ int i; -+ for (i=0; i < hcd->core_if->core_params->host_channels; i++) { -+ dwc_otg_cleanup_fiq_channel(hcd, i); -+ } -+ DWC_PRINTF("FIQ FSM acceleration enabled for :\n%s%s%s%s", -+ (fiq_fsm_mask & 0x1) ? "Non-periodic Split Transactions\n" : "", -+ (fiq_fsm_mask & 0x2) ? "Periodic Split Transactions\n" : "", -+ (fiq_fsm_mask & 0x4) ? "High-Speed Isochronous Endpoints\n" : "", -+ (fiq_fsm_mask & 0x8) ? "Interrupt/Control Split Transaction hack enabled\n" : ""); -+ } -+ } -+ -+ /* Initialize the Connection timeout timer. */ -+ hcd->conn_timer = DWC_TIMER_ALLOC("Connection timer", -+ dwc_otg_hcd_connect_timeout, 0); -+ -+ printk(KERN_DEBUG "dwc_otg: Microframe scheduler %s\n", microframe_schedule ? "enabled":"disabled"); -+ if (microframe_schedule) -+ init_hcd_usecs(hcd); -+ -+ /* Initialize reset tasklet. */ -+ hcd->reset_tasklet = DWC_TASK_ALLOC("reset_tasklet", reset_tasklet_func, hcd); -+ -+ hcd->completion_tasklet = DWC_TASK_ALLOC("completion_tasklet", -+ completion_tasklet_func, hcd); -+#ifdef DWC_DEV_SRPCAP -+ if (hcd->core_if->power_down == 2) { -+ /* Initialize Power on timer for Host power up in case hibernation */ -+ hcd->core_if->pwron_timer = DWC_TIMER_ALLOC("PWRON TIMER", -+ dwc_otg_hcd_power_up, core_if); -+ } -+#endif -+ -+ /* -+ * Allocate space for storing data on status transactions. Normally no -+ * data is sent, but this space acts as a bit bucket. This must be -+ * done after usb_add_hcd since that function allocates the DMA buffer -+ * pool. -+ */ -+ if (hcd->core_if->dma_enable) { -+ hcd->status_buf = -+ DWC_DMA_ALLOC(dev, DWC_OTG_HCD_STATUS_BUF_SIZE, -+ &hcd->status_buf_dma); -+ } else { -+ hcd->status_buf = DWC_ALLOC(DWC_OTG_HCD_STATUS_BUF_SIZE); -+ } -+ if (!hcd->status_buf) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: status_buf allocation failed\n", __func__); -+ dwc_otg_hcd_free(hcd); -+ goto out; -+ } -+ -+ hcd->otg_port = 1; -+ hcd->frame_list = NULL; -+ hcd->frame_list_dma = 0; -+ hcd->periodic_qh_count = 0; -+ -+ DWC_MEMSET(hcd->hub_port, 0, sizeof(hcd->hub_port)); -+#ifdef FIQ_DEBUG -+ DWC_MEMSET(hcd->hub_port_alloc, -1, sizeof(hcd->hub_port_alloc)); -+#endif -+ -+out: -+ return retval; -+} -+ -+void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd) -+{ -+ /* Turn off all host-specific interrupts. */ -+ dwc_otg_disable_host_interrupts(hcd->core_if); -+ -+ dwc_otg_hcd_free(hcd); -+} -+ -+/** -+ * Initializes dynamic portions of the DWC_otg HCD state. -+ */ -+static void dwc_otg_hcd_reinit(dwc_otg_hcd_t * hcd) -+{ -+ int num_channels; -+ int i; -+ dwc_hc_t *channel; -+ dwc_hc_t *channel_tmp; -+ -+ hcd->flags.d32 = 0; -+ -+ hcd->non_periodic_qh_ptr = &hcd->non_periodic_sched_active; -+ if (!microframe_schedule) { -+ hcd->non_periodic_channels = 0; -+ hcd->periodic_channels = 0; -+ } else { -+ hcd->available_host_channels = hcd->core_if->core_params->host_channels; -+ } -+ /* -+ * Put all channels in the free channel list and clean up channel -+ * states. -+ */ -+ DWC_CIRCLEQ_FOREACH_SAFE(channel, channel_tmp, -+ &hcd->free_hc_list, hc_list_entry) { -+ DWC_CIRCLEQ_REMOVE(&hcd->free_hc_list, channel, hc_list_entry); -+ } -+ -+ num_channels = hcd->core_if->core_params->host_channels; -+ for (i = 0; i < num_channels; i++) { -+ channel = hcd->hc_ptr_array[i]; -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, channel, -+ hc_list_entry); -+ dwc_otg_hc_cleanup(hcd->core_if, channel); -+ } -+ -+ /* Initialize the DWC core for host mode operation. */ -+ dwc_otg_core_host_init(hcd->core_if); -+ -+ /* Set core_if's lock pointer to the hcd->lock */ -+ hcd->core_if->lock = hcd->lock; -+} -+ -+/** -+ * Assigns transactions from a QTD to a free host channel and initializes the -+ * host channel to perform the transactions. The host channel is removed from -+ * the free list. -+ * -+ * @param hcd The HCD state structure. -+ * @param qh Transactions from the first QTD for this QH are selected and -+ * assigned to a free host channel. -+ */ -+static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ dwc_hc_t *hc; -+ dwc_otg_qtd_t *qtd; -+ dwc_otg_hcd_urb_t *urb; -+ void* ptr = NULL; -+ uint32_t intr_enable; -+ unsigned long flags; -+ gintmsk_data_t gintmsk = { .d32 = 0, }; -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ -+ urb = qtd->urb; -+ -+ DWC_DEBUGPL(DBG_HCDV, "%s(%p,%p) - urb %x, actual_length %d\n", __func__, hcd, qh, (unsigned int)urb, urb->actual_length); -+ -+ if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info)) -+ urb->actual_length = urb->length; -+ -+ -+ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); -+ -+ /* Remove the host channel from the free list. */ -+ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); -+ -+ qh->channel = hc; -+ -+ qtd->in_process = 1; -+ -+ /* -+ * Use usb_pipedevice to determine device address. This address is -+ * 0 before the SET_ADDRESS command and the correct address afterward. -+ */ -+ hc->dev_addr = dwc_otg_hcd_get_dev_addr(&urb->pipe_info); -+ hc->ep_num = dwc_otg_hcd_get_ep_num(&urb->pipe_info); -+ hc->speed = qh->dev_speed; -+ hc->max_packet = dwc_max_packet(qh->maxp); -+ -+ hc->xfer_started = 0; -+ hc->halt_status = DWC_OTG_HC_XFER_NO_HALT_STATUS; -+ hc->error_state = (qtd->error_count > 0); -+ hc->halt_on_queue = 0; -+ hc->halt_pending = 0; -+ hc->requests = 0; -+ -+ /* -+ * The following values may be modified in the transfer type section -+ * below. The xfer_len value may be reduced when the transfer is -+ * started to accommodate the max widths of the XferSize and PktCnt -+ * fields in the HCTSIZn register. -+ */ -+ -+ hc->ep_is_in = (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) != 0); -+ if (hc->ep_is_in) { -+ hc->do_ping = 0; -+ } else { -+ hc->do_ping = qh->ping_state; -+ } -+ -+ hc->data_pid_start = qh->data_toggle; -+ hc->multi_count = 1; -+ -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) urb->dma + urb->actual_length; -+ -+ /* For non-dword aligned case */ -+ if (((unsigned long)hc->xfer_buff & 0x3) -+ && !hcd->core_if->dma_desc_enable) { -+ ptr = (uint8_t *) urb->buf + urb->actual_length; -+ } -+ } else { -+ hc->xfer_buff = (uint8_t *) urb->buf + urb->actual_length; -+ } -+ hc->xfer_len = urb->length - urb->actual_length; -+ hc->xfer_count = 0; -+ -+ /* -+ * Set the split attributes -+ */ -+ hc->do_split = 0; -+ if (qh->do_split) { -+ uint32_t hub_addr, port_addr; -+ hc->do_split = 1; -+ hc->xact_pos = qtd->isoc_split_pos; -+ /* We don't need to do complete splits anymore */ -+// if(fiq_fsm_enable) -+ if (0) -+ hc->complete_split = qtd->complete_split = 0; -+ else -+ hc->complete_split = qtd->complete_split; -+ -+ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &port_addr); -+ hc->hub_addr = (uint8_t) hub_addr; -+ hc->port_addr = (uint8_t) port_addr; -+ } -+ -+ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { -+ case UE_CONTROL: -+ hc->ep_type = DWC_OTG_EP_TYPE_CONTROL; -+ switch (qtd->control_phase) { -+ case DWC_OTG_CONTROL_SETUP: -+ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction\n"); -+ hc->do_ping = 0; -+ hc->ep_is_in = 0; -+ hc->data_pid_start = DWC_OTG_HC_PID_SETUP; -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) urb->setup_dma; -+ } else { -+ hc->xfer_buff = (uint8_t *) urb->setup_packet; -+ } -+ hc->xfer_len = 8; -+ ptr = NULL; -+ break; -+ case DWC_OTG_CONTROL_DATA: -+ DWC_DEBUGPL(DBG_HCDV, " Control data transaction\n"); -+ hc->data_pid_start = qtd->data_toggle; -+ break; -+ case DWC_OTG_CONTROL_STATUS: -+ /* -+ * Direction is opposite of data direction or IN if no -+ * data. -+ */ -+ DWC_DEBUGPL(DBG_HCDV, " Control status transaction\n"); -+ if (urb->length == 0) { -+ hc->ep_is_in = 1; -+ } else { -+ hc->ep_is_in = -+ dwc_otg_hcd_is_pipe_out(&urb->pipe_info); -+ } -+ if (hc->ep_is_in) { -+ hc->do_ping = 0; -+ } -+ -+ hc->data_pid_start = DWC_OTG_HC_PID_DATA1; -+ -+ hc->xfer_len = 0; -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) hcd->status_buf_dma; -+ } else { -+ hc->xfer_buff = (uint8_t *) hcd->status_buf; -+ } -+ ptr = NULL; -+ break; -+ } -+ break; -+ case UE_BULK: -+ hc->ep_type = DWC_OTG_EP_TYPE_BULK; -+ break; -+ case UE_INTERRUPT: -+ hc->ep_type = DWC_OTG_EP_TYPE_INTR; -+ break; -+ case UE_ISOCHRONOUS: -+ { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ -+ hc->ep_type = DWC_OTG_EP_TYPE_ISOC; -+ -+ if (hcd->core_if->dma_desc_enable) -+ break; -+ -+ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; -+ -+ frame_desc->status = 0; -+ -+ if (hcd->core_if->dma_enable) { -+ hc->xfer_buff = (uint8_t *) urb->dma; -+ } else { -+ hc->xfer_buff = (uint8_t *) urb->buf; -+ } -+ hc->xfer_buff += -+ frame_desc->offset + qtd->isoc_split_offset; -+ hc->xfer_len = -+ frame_desc->length - qtd->isoc_split_offset; -+ -+ /* For non-dword aligned buffers */ -+ if (((unsigned long)hc->xfer_buff & 0x3) -+ && hcd->core_if->dma_enable) { -+ ptr = -+ (uint8_t *) urb->buf + frame_desc->offset + -+ qtd->isoc_split_offset; -+ } else -+ ptr = NULL; -+ -+ if (hc->xact_pos == DWC_HCSPLIT_XACTPOS_ALL) { -+ if (hc->xfer_len <= 188) { -+ hc->xact_pos = DWC_HCSPLIT_XACTPOS_ALL; -+ } else { -+ hc->xact_pos = -+ DWC_HCSPLIT_XACTPOS_BEGIN; -+ } -+ } -+ } -+ break; -+ } -+ /* non DWORD-aligned buffer case */ -+ if (ptr) { -+ uint32_t buf_size; -+ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { -+ buf_size = hcd->core_if->core_params->max_transfer_size; -+ } else { -+ buf_size = 4096; -+ } -+ if (!qh->dw_align_buf) { -+ qh->dw_align_buf = DWC_DMA_ALLOC_ATOMIC(dev, buf_size, -+ &qh->dw_align_buf_dma); -+ if (!qh->dw_align_buf) { -+ DWC_ERROR -+ ("%s: Failed to allocate memory to handle " -+ "non-dword aligned buffer case\n", -+ __func__); -+ return; -+ } -+ } -+ if (!hc->ep_is_in) { -+ dwc_memcpy(qh->dw_align_buf, ptr, hc->xfer_len); -+ } -+ hc->align_buff = qh->dw_align_buf_dma; -+ } else { -+ hc->align_buff = 0; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * This value may be modified when the transfer is started to -+ * reflect the actual transfer length. -+ */ -+ hc->multi_count = dwc_hb_mult(qh->maxp); -+ } -+ -+ if (hcd->core_if->dma_desc_enable) -+ hc->desc_list_addr = qh->desc_list_dma; -+ -+ dwc_otg_hc_init(hcd->core_if, hc); -+ -+ local_irq_save(flags); -+ -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ } -+ -+ /* Enable the top level host channel interrupt. */ -+ intr_enable = (1 << hc->hc_num); -+ DWC_MODIFY_REG32(&hcd->core_if->host_if->host_global_regs->haintmsk, 0, intr_enable); -+ -+ /* Make sure host channel interrupts are enabled. */ -+ gintmsk.b.hcintr = 1; -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); -+ -+ if (fiq_enable) { -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } -+ -+ local_irq_restore(flags); -+ hc->qh = qh; -+} -+ -+ -+/** -+ * fiq_fsm_transaction_suitable() - Test a QH for compatibility with the FIQ -+ * @qh: pointer to the endpoint's queue head -+ * -+ * Transaction start/end control flow is grafted onto the existing dwc_otg -+ * mechanisms, to avoid spaghettifying the functions more than they already are. -+ * This function's eligibility check is altered by debug parameter. -+ * -+ * Returns: 0 for unsuitable, 1 implies the FIQ can be enabled for this transaction. -+ */ -+ -+int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh) -+{ -+ if (qh->do_split) { -+ switch (qh->ep_type) { -+ case UE_CONTROL: -+ case UE_BULK: -+ if (fiq_fsm_mask & (1 << 0)) -+ return 1; -+ break; -+ case UE_INTERRUPT: -+ case UE_ISOCHRONOUS: -+ if (fiq_fsm_mask & (1 << 1)) -+ return 1; -+ break; -+ default: -+ break; -+ } -+ } else if (qh->ep_type == UE_ISOCHRONOUS) { -+ if (fiq_fsm_mask & (1 << 2)) { -+ /* HS ISOCH support. We test for compatibility: -+ * - DWORD aligned buffers -+ * - Must be at least 2 transfers (otherwise pointless to use the FIQ) -+ * If yes, then the fsm enqueue function will handle the state machine setup. -+ */ -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ struct dwc_otg_hcd_iso_packet_desc (*iso_descs)[0] = &urb->iso_descs; -+ int nr_iso_frames = urb->packet_count; -+ int i; -+ uint32_t ptr; -+ -+ if (nr_iso_frames < 2) -+ return 0; -+ for (i = 0; i < nr_iso_frames; i++) { -+ ptr = urb->dma + iso_descs[i]->offset; -+ if (ptr & 0x3) { -+ printk_ratelimited("%s: Non-Dword aligned isochronous frame offset." -+ " Cannot queue FIQ-accelerated transfer to device %d endpoint %d\n", -+ __FUNCTION__, qh->channel->dev_addr, qh->channel->ep_num); -+ return 0; -+ } -+ } -+ return 1; -+ } -+ } -+ return 0; -+} -+ -+/** -+ * fiq_fsm_setup_periodic_dma() - Set up DMA bounce buffers -+ * @hcd: Pointer to the dwc_otg_hcd struct -+ * @qh: Pointer to the endpoint's queue head -+ * -+ * Periodic split transactions are transmitted modulo 188 bytes. -+ * This necessitates slicing data up into buckets for isochronous out -+ * and fixing up the DMA address for all IN transfers. -+ * -+ * Returns 1 if the DMA bounce buffers have been used, 0 if the default -+ * HC buffer has been used. -+ */ -+int fiq_fsm_setup_periodic_dma(dwc_otg_hcd_t *hcd, struct fiq_channel_state *st, dwc_otg_qh_t *qh) -+ { -+ int frame_length, i = 0; -+ uint8_t *ptr = NULL; -+ dwc_hc_t *hc = qh->channel; -+ struct fiq_dma_blob *blob; -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ -+ for (i = 0; i < 6; i++) { -+ st->dma_info.slot_len[i] = 255; -+ } -+ st->dma_info.index = 0; -+ i = 0; -+ if (hc->ep_is_in) { -+ /* -+ * Set dma_regs to bounce buffer. FIQ will update the -+ * state depending on transaction progress. -+ */ -+ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; -+ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; -+ /* Calculate the max number of CSPLITS such that the FIQ can time out -+ * a transaction if it fails. -+ */ -+ frame_length = st->hcchar_copy.b.mps; -+ do { -+ i++; -+ frame_length -= 188; -+ } while (frame_length >= 0); -+ st->nrpackets = i; -+ return 1; -+ } else { -+ if (qh->ep_type == UE_ISOCHRONOUS) { -+ -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ frame_length = frame_desc->length; -+ -+ /* Virtual address for bounce buffers */ -+ blob = hcd->fiq_dmab; -+ -+ ptr = qtd->urb->buf + frame_desc->offset; -+ if (frame_length == 0) { -+ /* -+ * for isochronous transactions, we must still transmit a packet -+ * even if the length is zero. -+ */ -+ st->dma_info.slot_len[0] = 0; -+ st->nrpackets = 1; -+ } else { -+ do { -+ if (frame_length <= 188) { -+ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, frame_length); -+ st->dma_info.slot_len[i] = frame_length; -+ ptr += frame_length; -+ } else { -+ dwc_memcpy(&blob->channel[hc->hc_num].index[i].buf[0], ptr, 188); -+ st->dma_info.slot_len[i] = 188; -+ ptr += 188; -+ } -+ i++; -+ frame_length -= 188; -+ } while (frame_length > 0); -+ st->nrpackets = i; -+ } -+ ptr = qtd->urb->buf + frame_desc->offset; -+ /* Point the HC at the DMA address of the bounce buffers */ -+ blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base; -+ st->hcdma_copy.d32 = (uint32_t) &blob->channel[hc->hc_num].index[0].buf[0]; -+ -+ /* fixup xfersize to the actual packet size */ -+ st->hctsiz_copy.b.pid = 0; -+ st->hctsiz_copy.b.xfersize = st->dma_info.slot_len[0]; -+ return 1; -+ } else { -+ /* For interrupt, single OUT packet required, goes in the SSPLIT from hc_buff. */ -+ return 0; -+ } -+ } -+} -+ -+/* -+ * Pushing a periodic request into the queue near the EOF1 point -+ * in a microframe causes erroneous behaviour (frmovrun) interrupt. -+ * Usually, the request goes out on the bus causing a transfer but -+ * the core does not transfer the data to memory. -+ * This guard interval (in number of 60MHz clocks) is required which -+ * must cater for CPU latency between reading the value and enabling -+ * the channel. -+ */ -+#define PERIODIC_FRREM_BACKOFF 1000 -+ -+int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) -+{ -+ dwc_hc_t *hc = qh->channel; -+ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ int frame; -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; -+ int xfer_len, nrpackets; -+ hcdma_data_t hcdma; -+ hfnum_data_t hfnum; -+ -+ if (st->fsm != FIQ_PASSTHROUGH) -+ return 0; -+ -+ st->nr_errors = 0; -+ -+ st->hcchar_copy.d32 = 0; -+ st->hcchar_copy.b.mps = hc->max_packet; -+ st->hcchar_copy.b.epdir = hc->ep_is_in; -+ st->hcchar_copy.b.devaddr = hc->dev_addr; -+ st->hcchar_copy.b.epnum = hc->ep_num; -+ st->hcchar_copy.b.eptype = hc->ep_type; -+ -+ st->hcintmsk_copy.b.chhltd = 1; -+ -+ frame = dwc_otg_hcd_get_frame_number(hcd); -+ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; -+ -+ st->hcchar_copy.b.lspddev = 0; -+ /* Enable the channel later as a final register write. */ -+ -+ st->hcsplt_copy.d32 = 0; -+ -+ st->hs_isoc_info.iso_desc = (struct dwc_otg_hcd_iso_packet_desc *) &qtd->urb->iso_descs; -+ st->hs_isoc_info.nrframes = qtd->urb->packet_count; -+ /* grab the next DMA address offset from the array */ -+ st->hcdma_copy.d32 = qtd->urb->dma; -+ hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[0].offset; -+ -+ /* We need to set multi_count. This is a bit tricky - has to be set per-transaction as -+ * the core needs to be told to send the correct number. Caution: for IN transfers, -+ * this is always set to the maximum size of the endpoint. */ -+ xfer_len = st->hs_isoc_info.iso_desc[0].length; -+ nrpackets = (xfer_len + st->hcchar_copy.b.mps - 1) / st->hcchar_copy.b.mps; -+ if (nrpackets == 0) -+ nrpackets = 1; -+ st->hcchar_copy.b.multicnt = nrpackets; -+ st->hctsiz_copy.b.pktcnt = nrpackets; -+ -+ /* Initial PID also needs to be set */ -+ if (st->hcchar_copy.b.epdir == 0) { -+ st->hctsiz_copy.b.xfersize = xfer_len; -+ switch (st->hcchar_copy.b.multicnt) { -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_MDATA; -+ break; -+ } -+ -+ } else { -+ st->hctsiz_copy.b.xfersize = nrpackets * st->hcchar_copy.b.mps; -+ switch (st->hcchar_copy.b.multicnt) { -+ case 1: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA0; -+ break; -+ case 2: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA1; -+ break; -+ case 3: -+ st->hctsiz_copy.b.pid = DWC_PID_DATA2; -+ break; -+ } -+ } -+ -+ st->hs_isoc_info.stride = qh->interval; -+ st->uframe_sleeps = 0; -+ -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); -+ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); -+ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { -+ /* Prevent queueing near EOF1. Bad things happen if a periodic -+ * split transaction is queued very close to EOF. SOF interrupt handler -+ * will wake this channel at the next interrupt. -+ */ -+ st->fsm = FIQ_HS_ISOC_SLEEPING; -+ st->uframe_sleeps = 1; -+ } else { -+ st->fsm = FIQ_HS_ISOC_TURBO; -+ st->hcchar_copy.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ } -+ mb(); -+ st->hcchar_copy.b.chen = 0; -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ return 0; -+} -+ -+ -+/** -+ * fiq_fsm_queue_split_transaction() - Set up a host channel and FIQ state -+ * @hcd: Pointer to the dwc_otg_hcd struct -+ * @qh: Pointer to the endpoint's queue head -+ * -+ * This overrides the dwc_otg driver's normal method of queueing a transaction. -+ * Called from dwc_otg_hcd_queue_transactions(), this performs specific setup -+ * for the nominated host channel. -+ * -+ * For periodic transfers, it also peeks at the FIQ state to see if an immediate -+ * start is possible. If not, then the FIQ is left to start the transfer. -+ */ -+int fiq_fsm_queue_split_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) -+{ -+ int start_immediate = 1, i; -+ hfnum_data_t hfnum; -+ dwc_hc_t *hc = qh->channel; -+ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[hc->hc_num]; -+ /* Program HC registers, setup FIQ_state, examine FIQ if periodic, start transfer (not if uframe 5) */ -+ int hub_addr, port_addr, frame, uframe; -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[hc->hc_num]; -+ -+ if (st->fsm != FIQ_PASSTHROUGH) -+ return 0; -+ st->nr_errors = 0; -+ -+ st->hcchar_copy.d32 = 0; -+ st->hcchar_copy.b.mps = hc->max_packet; -+ st->hcchar_copy.b.epdir = hc->ep_is_in; -+ st->hcchar_copy.b.devaddr = hc->dev_addr; -+ st->hcchar_copy.b.epnum = hc->ep_num; -+ st->hcchar_copy.b.eptype = hc->ep_type; -+ if (hc->ep_type & 0x1) { -+ if (hc->ep_is_in) -+ st->hcchar_copy.b.multicnt = 3; -+ else -+ /* Docs say set this to 1, but driver sets to 0! */ -+ st->hcchar_copy.b.multicnt = 0; -+ } else { -+ st->hcchar_copy.b.multicnt = 1; -+ st->hcchar_copy.b.oddfrm = 0; -+ } -+ st->hcchar_copy.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW) ? 1 : 0; -+ /* Enable the channel later as a final register write. */ -+ -+ st->hcsplt_copy.d32 = 0; -+ if(qh->do_split) { -+ hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr); -+ st->hcsplt_copy.b.compsplt = 0; -+ st->hcsplt_copy.b.spltena = 1; -+ // XACTPOS is for isoc-out only but needs initialising anyway. -+ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_ALL; -+ if((qh->ep_type == DWC_OTG_EP_TYPE_ISOC) && (!qh->ep_is_in)) { -+ /* For packetsize 0 < L < 188, ISOC_XACTPOS_ALL. -+ * for longer than this, ISOC_XACTPOS_BEGIN and the FIQ -+ * will update as necessary. -+ */ -+ if (hc->xfer_len > 188) { -+ st->hcsplt_copy.b.xactpos = ISOC_XACTPOS_BEGIN; -+ } -+ } -+ st->hcsplt_copy.b.hubaddr = (uint8_t) hub_addr; -+ st->hcsplt_copy.b.prtaddr = (uint8_t) port_addr; -+ st->hub_addr = hub_addr; -+ st->port_addr = port_addr; -+ } -+ -+ st->hctsiz_copy.d32 = 0; -+ st->hctsiz_copy.b.dopng = 0; -+ st->hctsiz_copy.b.pid = hc->data_pid_start; -+ -+ if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { -+ hc->xfer_len = hc->max_packet; -+ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) { -+ hc->xfer_len = 188; -+ } -+ st->hctsiz_copy.b.xfersize = hc->xfer_len; -+ -+ st->hctsiz_copy.b.pktcnt = 1; -+ -+ if (hc->ep_type & 0x1) { -+ /* -+ * For potentially multi-packet transfers, must use the DMA bounce buffers. For IN transfers, -+ * the DMA address is the address of the first 188byte slot buffer in the bounce buffer array. -+ * For multi-packet OUT transfers, we need to copy the data into the bounce buffer array so the FIQ can punt -+ * the right address out as necessary. hc->xfer_buff and hc->xfer_len have already been set -+ * in assign_and_init_hc(), but this is for the eventual transaction completion only. The FIQ -+ * must not touch internal driver state. -+ */ -+ if(!fiq_fsm_setup_periodic_dma(hcd, st, qh)) { -+ if (hc->align_buff) { -+ st->hcdma_copy.d32 = hc->align_buff; -+ } else { -+ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); -+ } -+ } -+ } else { -+ if (hc->align_buff) { -+ st->hcdma_copy.d32 = hc->align_buff; -+ } else { -+ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); -+ } -+ } -+ /* The FIQ depends upon no other interrupts being enabled except channel halt. -+ * Fixup channel interrupt mask. */ -+ st->hcintmsk_copy.d32 = 0; -+ st->hcintmsk_copy.b.chhltd = 1; -+ st->hcintmsk_copy.b.ahberr = 1; -+ -+ /* Hack courtesy of FreeBSD: apparently forcing Interrupt Split transactions -+ * as Control puts the transfer into the non-periodic request queue and the -+ * non-periodic handler in the hub. Makes things lots easier. -+ */ -+ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) { -+ st->hcchar_copy.b.multicnt = 0; -+ st->hcchar_copy.b.oddfrm = 0; -+ st->hcchar_copy.b.eptype = UE_CONTROL; -+ if (hc->align_buff) { -+ st->hcdma_copy.d32 = hc->align_buff; -+ } else { -+ st->hcdma_copy.d32 = ((unsigned long) hc->xfer_buff & 0xFFFFFFFF); -+ } -+ } -+ DWC_WRITE_REG32(&hc_regs->hcdma, st->hcdma_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hctsiz, st->hctsiz_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcsplt, st->hcsplt_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); -+ -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ -+ if (hc->ep_type & 0x1) { -+ hfnum.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); -+ frame = (hfnum.b.frnum & ~0x7) >> 3; -+ uframe = hfnum.b.frnum & 0x7; -+ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { -+ /* Prevent queueing near EOF1. Bad things happen if a periodic -+ * split transaction is queued very close to EOF. -+ */ -+ start_immediate = 0; -+ } else if (uframe == 5) { -+ start_immediate = 0; -+ } else if (hc->ep_type == UE_ISOCHRONOUS && !hc->ep_is_in) { -+ start_immediate = 0; -+ } else if (hc->ep_is_in && fiq_fsm_too_late(hcd->fiq_state, hc->hc_num)) { -+ start_immediate = 0; -+ } else { -+ /* Search through all host channels to determine if a transaction -+ * is currently in progress */ -+ for (i = 0; i < hcd->core_if->core_params->host_channels; i++) { -+ if (i == hc->hc_num || hcd->fiq_state->channel[i].fsm == FIQ_PASSTHROUGH) -+ continue; -+ switch (hcd->fiq_state->channel[i].fsm) { -+ /* TT is reserved for channels that are in the middle of a periodic -+ * split transaction. -+ */ -+ case FIQ_PER_SSPLIT_STARTED: -+ case FIQ_PER_CSPLIT_WAIT: -+ case FIQ_PER_CSPLIT_NYET1: -+ case FIQ_PER_CSPLIT_POLL: -+ case FIQ_PER_ISO_OUT_ACTIVE: -+ case FIQ_PER_ISO_OUT_LAST: -+ if (hcd->fiq_state->channel[i].hub_addr == hub_addr && -+ hcd->fiq_state->channel[i].port_addr == port_addr) { -+ start_immediate = 0; -+ } -+ break; -+ default: -+ break; -+ } -+ if (!start_immediate) -+ break; -+ } -+ } -+ } -+ if ((fiq_fsm_mask & 0x8) && hc->ep_type == UE_INTERRUPT) -+ start_immediate = 1; -+ -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d %01d", hc->hc_num, start_immediate); -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08d", hfnum.b.frrem); -+ //fiq_print(FIQDBG_INT, hcd->fiq_state, "H:%02dP:%02d", hub_addr, port_addr); -+ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); -+ //fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcdma_copy.d32); -+ switch (hc->ep_type) { -+ case UE_CONTROL: -+ case UE_BULK: -+ st->fsm = FIQ_NP_SSPLIT_STARTED; -+ break; -+ case UE_ISOCHRONOUS: -+ if (hc->ep_is_in) { -+ if (start_immediate) { -+ st->fsm = FIQ_PER_SSPLIT_STARTED; -+ } else { -+ st->fsm = FIQ_PER_SSPLIT_QUEUED; -+ } -+ } else { -+ if (start_immediate) { -+ /* Single-isoc OUT packets don't require FIQ involvement */ -+ if (st->nrpackets == 1) { -+ st->fsm = FIQ_PER_ISO_OUT_LAST; -+ } else { -+ st->fsm = FIQ_PER_ISO_OUT_ACTIVE; -+ } -+ } else { -+ st->fsm = FIQ_PER_ISO_OUT_PENDING; -+ } -+ } -+ break; -+ case UE_INTERRUPT: -+ if (fiq_fsm_mask & 0x8) { -+ st->fsm = FIQ_NP_SSPLIT_STARTED; -+ } else if (start_immediate) { -+ st->fsm = FIQ_PER_SSPLIT_STARTED; -+ } else { -+ st->fsm = FIQ_PER_SSPLIT_QUEUED; -+ } -+ default: -+ break; -+ } -+ if (start_immediate) { -+ /* Set the oddfrm bit as close as possible to actual queueing */ -+ frame = dwc_otg_hcd_get_frame_number(hcd); -+ st->expected_uframe = (frame + 1) & 0x3FFF; -+ st->hcchar_copy.b.oddfrm = (frame & 0x1) ? 0 : 1; -+ st->hcchar_copy.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, st->hcchar_copy.d32); -+ } -+ mb(); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ return 0; -+} -+ -+ -+/** -+ * This function selects transactions from the HCD transfer schedule and -+ * assigns them to available host channels. It is called from HCD interrupt -+ * handler functions. -+ * -+ * @param hcd The HCD state structure. -+ * -+ * @return The types of new transactions that were assigned to host channels. -+ */ -+dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) -+{ -+ dwc_list_link_t *qh_ptr; -+ dwc_otg_qh_t *qh; -+ int num_channels; -+ dwc_irqflags_t flags; -+ dwc_spinlock_t *channel_lock = hcd->channel_lock; -+ dwc_otg_transaction_type_e ret_val = DWC_OTG_TRANSACTION_NONE; -+ -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_per_scheduled = 0; -+ last_sel_trans_num_nonper_scheduled = 0; -+ last_sel_trans_num_avail_hc_at_start = hcd->available_host_channels; -+#endif /* DEBUG_HOST_CHANNELS */ -+ -+ /* Process entries in the periodic ready list. */ -+ qh_ptr = DWC_LIST_FIRST(&hcd->periodic_sched_ready); -+ -+ while (qh_ptr != &hcd->periodic_sched_ready && -+ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -+ -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ -+ if (microframe_schedule) { -+ // Make sure we leave one channel for non periodic transactions. -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ if (hcd->available_host_channels <= 1) { -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ break; -+ } -+ hcd->available_host_channels--; -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_per_scheduled++; -+#endif /* DEBUG_HOST_CHANNELS */ -+ } -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ assign_and_init_hc(hcd, qh); -+ -+ /* -+ * Move the QH from the periodic ready schedule to the -+ * periodic assigned schedule. -+ */ -+ qh_ptr = DWC_LIST_NEXT(qh_ptr); -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, -+ &qh->qh_list_entry); -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ } -+ -+ /* -+ * Process entries in the inactive portion of the non-periodic -+ * schedule. Some free host channels may not be used if they are -+ * reserved for periodic transfers. -+ */ -+ qh_ptr = hcd->non_periodic_sched_inactive.next; -+ num_channels = hcd->core_if->core_params->host_channels; -+ while (qh_ptr != &hcd->non_periodic_sched_inactive && -+ (microframe_schedule || hcd->non_periodic_channels < -+ num_channels - hcd->periodic_channels) && -+ !DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -+ -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ /* -+ * Check to see if this is a NAK'd retransmit, in which case ignore for retransmission -+ * we hold off on bulk retransmissions to reduce NAK interrupt overhead for full-speed -+ * cheeky devices that just hold off using NAKs -+ */ -+ if (fiq_enable && nak_holdoff && qh->do_split) { -+ if (qh->nak_frame != 0xffff) { -+ uint16_t next_frame = dwc_frame_num_inc(qh->nak_frame, (qh->ep_type == UE_BULK) ? nak_holdoff : 8); -+ uint16_t frame = dwc_otg_hcd_get_frame_number(hcd); -+ if (dwc_frame_num_le(frame, next_frame)) { -+ if(dwc_frame_num_le(next_frame, hcd->fiq_state->next_sched_frame)) { -+ hcd->fiq_state->next_sched_frame = next_frame; -+ } -+ qh_ptr = DWC_LIST_NEXT(qh_ptr); -+ continue; -+ } else { -+ qh->nak_frame = 0xFFFF; -+ } -+ } -+ } -+ -+ if (microframe_schedule) { -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ if (hcd->available_host_channels < 1) { -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ break; -+ } -+ hcd->available_host_channels--; -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_nonper_scheduled++; -+#endif /* DEBUG_HOST_CHANNELS */ -+ } -+ -+ assign_and_init_hc(hcd, qh); -+ -+ /* -+ * Move the QH from the non-periodic inactive schedule to the -+ * non-periodic active schedule. -+ */ -+ qh_ptr = DWC_LIST_NEXT(qh_ptr); -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ DWC_LIST_MOVE_HEAD(&hcd->non_periodic_sched_active, -+ &qh->qh_list_entry); -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ -+ -+ if (!microframe_schedule) -+ hcd->non_periodic_channels++; -+ } -+ /* we moved a non-periodic QH to the active schedule. If the inactive queue is empty, -+ * stop the FIQ from kicking us. We could potentially still have elements here if we -+ * ran out of host channels. -+ */ -+ if (fiq_enable) { -+ if (DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) { -+ hcd->fiq_state->kick_np_queues = 0; -+ } else { -+ /* For each entry remaining in the NP inactive queue, -+ * if this a NAK'd retransmit then don't set the kick flag. -+ */ -+ if(nak_holdoff) { -+ DWC_LIST_FOREACH(qh_ptr, &hcd->non_periodic_sched_inactive) { -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ if (qh->nak_frame == 0xFFFF) { -+ hcd->fiq_state->kick_np_queues = 1; -+ } -+ } -+ } -+ } -+ } -+ if(!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) -+ ret_val |= DWC_OTG_TRANSACTION_PERIODIC; -+ -+ if(!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) -+ ret_val |= DWC_OTG_TRANSACTION_NON_PERIODIC; -+ -+ -+#ifdef DEBUG_HOST_CHANNELS -+ last_sel_trans_num_avail_hc_at_end = hcd->available_host_channels; -+#endif /* DEBUG_HOST_CHANNELS */ -+ return ret_val; -+} -+ -+/** -+ * Attempts to queue a single transaction request for a host channel -+ * associated with either a periodic or non-periodic transfer. This function -+ * assumes that there is space available in the appropriate request queue. For -+ * an OUT transfer or SETUP transaction in Slave mode, it checks whether space -+ * is available in the appropriate Tx FIFO. -+ * -+ * @param hcd The HCD state structure. -+ * @param hc Host channel descriptor associated with either a periodic or -+ * non-periodic transfer. -+ * @param fifo_dwords_avail Number of DWORDs available in the periodic Tx -+ * FIFO for periodic transfers or the non-periodic Tx FIFO for non-periodic -+ * transfers. -+ * -+ * @return 1 if a request is queued and more requests may be needed to -+ * complete the transfer, 0 if no more requests are required for this -+ * transfer, -1 if there is insufficient space in the Tx FIFO. -+ */ -+static int queue_transaction(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, uint16_t fifo_dwords_avail) -+{ -+ int retval; -+ -+ if (hcd->core_if->dma_enable) { -+ if (hcd->core_if->dma_desc_enable) { -+ if (!hc->xfer_started -+ || (hc->ep_type == DWC_OTG_EP_TYPE_ISOC)) { -+ dwc_otg_hcd_start_xfer_ddma(hcd, hc->qh); -+ hc->qh->ping_state = 0; -+ } -+ } else if (!hc->xfer_started) { -+ if (fiq_fsm_enable && hc->error_state) { -+ hcd->fiq_state->channel[hc->hc_num].nr_errors = -+ DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list)->error_count; -+ hcd->fiq_state->channel[hc->hc_num].fsm = -+ FIQ_PASSTHROUGH_ERRORSTATE; -+ } -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ hc->qh->ping_state = 0; -+ } -+ retval = 0; -+ } else if (hc->halt_pending) { -+ /* Don't queue a request if the channel has been halted. */ -+ retval = 0; -+ } else if (hc->halt_on_queue) { -+ dwc_otg_hc_halt(hcd->core_if, hc, hc->halt_status); -+ retval = 0; -+ } else if (hc->do_ping) { -+ if (!hc->xfer_started) { -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ } -+ retval = 0; -+ } else if (!hc->ep_is_in || hc->data_pid_start == DWC_OTG_HC_PID_SETUP) { -+ if ((fifo_dwords_avail * 4) >= hc->max_packet) { -+ if (!hc->xfer_started) { -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ retval = 1; -+ } else { -+ retval = -+ dwc_otg_hc_continue_transfer(hcd->core_if, -+ hc); -+ } -+ } else { -+ retval = -1; -+ } -+ } else { -+ if (!hc->xfer_started) { -+ dwc_otg_hc_start_transfer(hcd->core_if, hc); -+ retval = 1; -+ } else { -+ retval = dwc_otg_hc_continue_transfer(hcd->core_if, hc); -+ } -+ } -+ -+ return retval; -+} -+ -+/** -+ * Processes periodic channels for the next frame and queues transactions for -+ * these channels to the DWC_otg controller. After queueing transactions, the -+ * Periodic Tx FIFO Empty interrupt is enabled if there are more transactions -+ * to queue as Periodic Tx FIFO or request queue space becomes available. -+ * Otherwise, the Periodic Tx FIFO Empty interrupt is disabled. -+ */ -+static void process_periodic_channels(dwc_otg_hcd_t * hcd) -+{ -+ hptxsts_data_t tx_status; -+ dwc_list_link_t *qh_ptr; -+ dwc_otg_qh_t *qh; -+ int status = 0; -+ int no_queue_space = 0; -+ int no_fifo_space = 0; -+ -+ dwc_otg_host_global_regs_t *host_regs; -+ host_regs = hcd->core_if->host_if->host_global_regs; -+ -+ DWC_DEBUGPL(DBG_HCDV, "Queue periodic transactions\n"); -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " P Tx Req Queue Space Avail (before queue): %d\n", -+ tx_status.b.ptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, " P Tx FIFO Space Avail (before queue): %d\n", -+ tx_status.b.ptxfspcavail); -+#endif -+ -+ qh_ptr = hcd->periodic_sched_assigned.next; -+ while (qh_ptr != &hcd->periodic_sched_assigned) { -+ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); -+ if (tx_status.b.ptxqspcavail == 0) { -+ no_queue_space = 1; -+ break; -+ } -+ -+ qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry); -+ -+ // Do not send a split start transaction any later than frame .6 -+ // Note, we have to schedule a periodic in .5 to make it go in .6 -+ if(fiq_fsm_enable && qh->do_split && ((dwc_otg_hcd_get_frame_number(hcd) + 1) & 7) > 6) -+ { -+ qh_ptr = qh_ptr->next; -+ hcd->fiq_state->next_sched_frame = dwc_otg_hcd_get_frame_number(hcd) | 7; -+ continue; -+ } -+ -+ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { -+ if (qh->do_split) -+ fiq_fsm_queue_split_transaction(hcd, qh); -+ else -+ fiq_fsm_queue_isoc_transaction(hcd, qh); -+ } else { -+ -+ /* -+ * Set a flag if we're queueing high-bandwidth in slave mode. -+ * The flag prevents any halts to get into the request queue in -+ * the middle of multiple high-bandwidth packets getting queued. -+ */ -+ if (!hcd->core_if->dma_enable && qh->channel->multi_count > 1) { -+ hcd->core_if->queuing_high_bandwidth = 1; -+ } -+ status = queue_transaction(hcd, qh->channel, -+ tx_status.b.ptxfspcavail); -+ if (status < 0) { -+ no_fifo_space = 1; -+ break; -+ } -+ } -+ -+ /* -+ * In Slave mode, stay on the current transfer until there is -+ * nothing more to do or the high-bandwidth request count is -+ * reached. In DMA mode, only need to queue one request. The -+ * controller automatically handles multiple packets for -+ * high-bandwidth transfers. -+ */ -+ if (hcd->core_if->dma_enable || status == 0 || -+ qh->channel->requests == qh->channel->multi_count) { -+ qh_ptr = qh_ptr->next; -+ /* -+ * Move the QH from the periodic assigned schedule to -+ * the periodic queued schedule. -+ */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_queued, -+ &qh->qh_list_entry); -+ -+ /* done queuing high bandwidth */ -+ hcd->core_if->queuing_high_bandwidth = 0; -+ } -+ } -+ -+ if (!hcd->core_if->dma_enable) { -+ dwc_otg_core_global_regs_t *global_regs; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ global_regs = hcd->core_if->core_global_regs; -+ intr_mask.b.ptxfempty = 1; -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&host_regs->hptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " P Tx Req Queue Space Avail (after queue): %d\n", -+ tx_status.b.ptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, -+ " P Tx FIFO Space Avail (after queue): %d\n", -+ tx_status.b.ptxfspcavail); -+#endif -+ if (!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned) || -+ no_queue_space || no_fifo_space) { -+ /* -+ * May need to queue more transactions as the request -+ * queue or Tx FIFO empties. Enable the periodic Tx -+ * FIFO empty interrupt. (Always use the half-empty -+ * level to ensure that new requests are loaded as -+ * soon as possible.) -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, -+ intr_mask.d32); -+ } else { -+ /* -+ * Disable the Tx FIFO empty interrupt since there are -+ * no more transactions that need to be queued right -+ * now. This function is called from interrupt -+ * handlers to queue more transactions as transfer -+ * states change. -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, -+ 0); -+ } -+ } -+} -+ -+/** -+ * Processes active non-periodic channels and queues transactions for these -+ * channels to the DWC_otg controller. After queueing transactions, the NP Tx -+ * FIFO Empty interrupt is enabled if there are more transactions to queue as -+ * NP Tx FIFO or request queue space becomes available. Otherwise, the NP Tx -+ * FIFO Empty interrupt is disabled. -+ */ -+static void process_non_periodic_channels(dwc_otg_hcd_t * hcd) -+{ -+ gnptxsts_data_t tx_status; -+ dwc_list_link_t *orig_qh_ptr; -+ dwc_otg_qh_t *qh; -+ int status; -+ int no_queue_space = 0; -+ int no_fifo_space = 0; -+ int more_to_do = 0; -+ -+ dwc_otg_core_global_regs_t *global_regs = -+ hcd->core_if->core_global_regs; -+ -+ DWC_DEBUGPL(DBG_HCDV, "Queue non-periodic transactions\n"); -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " NP Tx Req Queue Space Avail (before queue): %d\n", -+ tx_status.b.nptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, " NP Tx FIFO Space Avail (before queue): %d\n", -+ tx_status.b.nptxfspcavail); -+#endif -+ /* -+ * Keep track of the starting point. Skip over the start-of-list -+ * entry. -+ */ -+ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { -+ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; -+ } -+ orig_qh_ptr = hcd->non_periodic_qh_ptr; -+ -+ /* -+ * Process once through the active list or until no more space is -+ * available in the request queue or the Tx FIFO. -+ */ -+ do { -+ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ if (!hcd->core_if->dma_enable && tx_status.b.nptxqspcavail == 0) { -+ no_queue_space = 1; -+ break; -+ } -+ -+ qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, -+ qh_list_entry); -+ -+ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { -+ fiq_fsm_queue_split_transaction(hcd, qh); -+ } else { -+ status = queue_transaction(hcd, qh->channel, -+ tx_status.b.nptxfspcavail); -+ -+ if (status > 0) { -+ more_to_do = 1; -+ } else if (status < 0) { -+ no_fifo_space = 1; -+ break; -+ } -+ } -+ /* Advance to next QH, skipping start-of-list entry. */ -+ hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next; -+ if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) { -+ hcd->non_periodic_qh_ptr = -+ hcd->non_periodic_qh_ptr->next; -+ } -+ -+ } while (hcd->non_periodic_qh_ptr != orig_qh_ptr); -+ -+ if (!hcd->core_if->dma_enable) { -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ intr_mask.b.nptxfempty = 1; -+ -+#ifdef DEBUG -+ tx_status.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_HCDV, -+ " NP Tx Req Queue Space Avail (after queue): %d\n", -+ tx_status.b.nptxqspcavail); -+ DWC_DEBUGPL(DBG_HCDV, -+ " NP Tx FIFO Space Avail (after queue): %d\n", -+ tx_status.b.nptxfspcavail); -+#endif -+ if (more_to_do || no_queue_space || no_fifo_space) { -+ /* -+ * May need to queue more transactions as the request -+ * queue or Tx FIFO empties. Enable the non-periodic -+ * Tx FIFO empty interrupt. (Always use the half-empty -+ * level to ensure that new requests are loaded as -+ * soon as possible.) -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, -+ intr_mask.d32); -+ } else { -+ /* -+ * Disable the Tx FIFO empty interrupt since there are -+ * no more transactions that need to be queued right -+ * now. This function is called from interrupt -+ * handlers to queue more transactions as transfer -+ * states change. -+ */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, -+ 0); -+ } -+ } -+} -+ -+/** -+ * This function processes the currently active host channels and queues -+ * transactions for these channels to the DWC_otg controller. It is called -+ * from HCD interrupt handler functions. -+ * -+ * @param hcd The HCD state structure. -+ * @param tr_type The type(s) of transactions to queue (non-periodic, -+ * periodic, or both). -+ */ -+void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, -+ dwc_otg_transaction_type_e tr_type) -+{ -+#ifdef DEBUG_SOF -+ DWC_DEBUGPL(DBG_HCD, "Queue Transactions\n"); -+#endif -+ /* Process host channels associated with periodic transfers. */ -+ if ((tr_type == DWC_OTG_TRANSACTION_PERIODIC || -+ tr_type == DWC_OTG_TRANSACTION_ALL) && -+ !DWC_LIST_EMPTY(&hcd->periodic_sched_assigned)) { -+ -+ process_periodic_channels(hcd); -+ } -+ -+ /* Process host channels associated with non-periodic transfers. */ -+ if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC || -+ tr_type == DWC_OTG_TRANSACTION_ALL) { -+ if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_active)) { -+ process_non_periodic_channels(hcd); -+ } else { -+ /* -+ * Ensure NP Tx FIFO empty interrupt is disabled when -+ * there are no non-periodic transfers to process. -+ */ -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ gintmsk.b.nptxfempty = 1; -+ -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ } -+ } -+ } -+} -+ -+#ifdef DWC_HS_ELECT_TST -+/* -+ * Quick and dirty hack to implement the HS Electrical Test -+ * SINGLE_STEP_GET_DEVICE_DESCRIPTOR feature. -+ * -+ * This code was copied from our userspace app "hset". It sends a -+ * Get Device Descriptor control sequence in two parts, first the -+ * Setup packet by itself, followed some time later by the In and -+ * Ack packets. Rather than trying to figure out how to add this -+ * functionality to the normal driver code, we just hijack the -+ * hardware, using these two function to drive the hardware -+ * directly. -+ */ -+ -+static dwc_otg_core_global_regs_t *global_regs; -+static dwc_otg_host_global_regs_t *hc_global_regs; -+static dwc_otg_hc_regs_t *hc_regs; -+static uint32_t *data_fifo; -+ -+static void do_setup(void) -+{ -+ gintsts_data_t gintsts; -+ hctsiz_data_t hctsiz; -+ hcchar_data_t hcchar; -+ haint_data_t haint; -+ hcint_data_t hcint; -+ -+ /* Enable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); -+ -+ /* Enable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* -+ * Send Setup packet (Get Device Descriptor) -+ */ -+ -+ /* Make sure channel is disabled */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chdis = 1; -+// hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ //sleep(1); -+ dwc_mdelay(1000); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ } -+ -+ /* Set HCTSIZ */ -+ hctsiz.d32 = 0; -+ hctsiz.b.xfersize = 8; -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.pid = DWC_OTG_HC_PID_SETUP; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ /* Set HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.epdir = 0; -+ hcchar.b.epnum = 0; -+ hcchar.b.mps = 8; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ /* Fill FIFO with Setup data for Get Device Descriptor */ -+ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); -+ DWC_WRITE_REG32(data_fifo++, 0x01000680); -+ DWC_WRITE_REG32(data_fifo++, 0x00080000); -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for host channel interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.hcintr == 0); -+ -+ /* Disable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); -+ -+ /* Disable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+} -+ -+static void do_in_ack(void) -+{ -+ gintsts_data_t gintsts; -+ hctsiz_data_t hctsiz; -+ hcchar_data_t hcchar; -+ haint_data_t haint; -+ hcint_data_t hcint; -+ host_grxsts_data_t grxsts; -+ -+ /* Enable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0001); -+ -+ /* Enable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x04a3); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* -+ * Receive Control In packet -+ */ -+ -+ /* Make sure channel is disabled */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chdis = 1; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ //sleep(1); -+ dwc_mdelay(1000); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ } -+ -+ /* Set HCTSIZ */ -+ hctsiz.d32 = 0; -+ hctsiz.b.xfersize = 8; -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ /* Set HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.epdir = 1; -+ hcchar.b.epnum = 0; -+ hcchar.b.mps = 8; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for receive status queue interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.rxstsqlvl == 0); -+ -+ /* Read RXSTS */ -+ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); -+ -+ /* Clear RXSTSQLVL in GINTSTS */ -+ gintsts.d32 = 0; -+ gintsts.b.rxstsqlvl = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ switch (grxsts.b.pktsts) { -+ case DWC_GRXSTS_PKTSTS_IN: -+ /* Read the data into the host buffer */ -+ if (grxsts.b.bcnt > 0) { -+ int i; -+ int word_count = (grxsts.b.bcnt + 3) / 4; -+ -+ data_fifo = (uint32_t *) ((char *)global_regs + 0x1000); -+ -+ for (i = 0; i < word_count; i++) { -+ (void)DWC_READ_REG32(data_fifo++); -+ } -+ } -+ break; -+ -+ default: -+ break; -+ } -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for receive status queue interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.rxstsqlvl == 0); -+ -+ /* Read RXSTS */ -+ grxsts.d32 = DWC_READ_REG32(&global_regs->grxstsp); -+ -+ /* Clear RXSTSQLVL in GINTSTS */ -+ gintsts.d32 = 0; -+ gintsts.b.rxstsqlvl = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ switch (grxsts.b.pktsts) { -+ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: -+ break; -+ -+ default: -+ break; -+ } -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for host channel interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.hcintr == 0); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+// usleep(100000); -+// mdelay(100); -+ dwc_mdelay(1); -+ -+ /* -+ * Send handshake packet -+ */ -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Make sure channel is disabled */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chen) { -+ hcchar.b.chdis = 1; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ //sleep(1); -+ dwc_mdelay(1000); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ } -+ -+ /* Set HCTSIZ */ -+ hctsiz.d32 = 0; -+ hctsiz.b.xfersize = 0; -+ hctsiz.b.pktcnt = 1; -+ hctsiz.b.pid = DWC_OTG_HC_PID_DATA1; -+ DWC_WRITE_REG32(&hc_regs->hctsiz, hctsiz.d32); -+ -+ /* Set HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.epdir = 0; -+ hcchar.b.epnum = 0; -+ hcchar.b.mps = 8; -+ hcchar.b.chen = 1; -+ DWC_WRITE_REG32(&hc_regs->hcchar, hcchar.d32); -+ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ -+ /* Wait for host channel interrupt */ -+ do { -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+ } while (gintsts.b.hcintr == 0); -+ -+ /* Disable HCINTs */ -+ DWC_WRITE_REG32(&hc_regs->hcintmsk, 0x0000); -+ -+ /* Disable HAINTs */ -+ DWC_WRITE_REG32(&hc_global_regs->haintmsk, 0x0000); -+ -+ /* Read HAINT */ -+ haint.d32 = DWC_READ_REG32(&hc_global_regs->haint); -+ -+ /* Read HCINT */ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ -+ /* Read HCCHAR */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ -+ /* Clear HCINT */ -+ DWC_WRITE_REG32(&hc_regs->hcint, hcint.d32); -+ -+ /* Clear HAINT */ -+ DWC_WRITE_REG32(&hc_global_regs->haint, haint.d32); -+ -+ /* Clear GINTSTS */ -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ /* Read GINTSTS */ -+ gintsts.d32 = DWC_READ_REG32(&global_regs->gintsts); -+} -+#endif -+ -+/** Handles hub class-specific requests. */ -+int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint16_t typeReq, -+ uint16_t wValue, -+ uint16_t wIndex, uint8_t * buf, uint16_t wLength) -+{ -+ int retval = 0; -+ -+ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; -+ usb_hub_descriptor_t *hub_desc; -+ hprt0_data_t hprt0 = {.d32 = 0 }; -+ -+ uint32_t port_status; -+ -+ switch (typeReq) { -+ case UCR_CLEAR_HUB_FEATURE: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearHubFeature 0x%x\n", wValue); -+ switch (wValue) { -+ case UHF_C_HUB_LOCAL_POWER: -+ case UHF_C_HUB_OVER_CURRENT: -+ /* Nothing required here */ -+ break; -+ default: -+ retval = -DWC_E_INVALID; -+ DWC_ERROR("DWC OTG HCD - " -+ "ClearHubFeature request %xh unknown\n", -+ wValue); -+ } -+ break; -+ case UCR_CLEAR_PORT_FEATURE: -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (wValue != UHF_PORT_L1) -+#endif -+ if (!wIndex || wIndex > 1) -+ goto error; -+ -+ switch (wValue) { -+ case UHF_PORT_ENABLE: -+ DWC_DEBUGPL(DBG_ANY, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_ENABLE\n"); -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtena = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ break; -+ case UHF_PORT_SUSPEND: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); -+ -+ if (core_if->power_down == 2) { -+ dwc_otg_host_hibernation_restore(core_if, 0, 0); -+ } else { -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ dwc_mdelay(5); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtres = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ hprt0.b.prtsusp = 0; -+ /* Clear Resume bit */ -+ dwc_mdelay(100); -+ hprt0.b.prtres = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ } -+ break; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ case UHF_PORT_L1: -+ { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ glpmcfg_data_t lpmcfg = {.d32 = 0 }; -+ -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if-> -+ core_global_regs->glpmcfg); -+ lpmcfg.b.en_utmi_sleep = 0; -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ lpmcfg.b.prt_sleep_sts = 1; -+ DWC_WRITE_REG32(&core_if-> -+ core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ -+ /* Clear Enbl_L1Gating bit. */ -+ pcgcctl.b.enbl_sleep_gating = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, -+ 0); -+ -+ dwc_mdelay(5); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtres = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+ /* This bit will be cleared in wakeup interrupt handle */ -+ break; -+ } -+#endif -+ case UHF_PORT_POWER: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_POWER\n"); -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ break; -+ case UHF_PORT_INDICATOR: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_INDICATOR\n"); -+ /* Port inidicator not supported */ -+ break; -+ case UHF_C_PORT_CONNECTION: -+ /* Clears drivers internal connect status change -+ * flag */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_CONNECTION\n"); -+ dwc_otg_hcd->flags.b.port_connect_status_change = 0; -+ break; -+ case UHF_C_PORT_RESET: -+ /* Clears the driver's internal Port Reset Change -+ * flag */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_RESET\n"); -+ dwc_otg_hcd->flags.b.port_reset_change = 0; -+ break; -+ case UHF_C_PORT_ENABLE: -+ /* Clears the driver's internal Port -+ * Enable/Disable Change flag */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_ENABLE\n"); -+ dwc_otg_hcd->flags.b.port_enable_change = 0; -+ break; -+ case UHF_C_PORT_SUSPEND: -+ /* Clears the driver's internal Port Suspend -+ * Change flag, which is set when resume signaling on -+ * the host port is complete */ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_SUSPEND\n"); -+ dwc_otg_hcd->flags.b.port_suspend_change = 0; -+ break; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ case UHF_C_PORT_L1: -+ dwc_otg_hcd->flags.b.port_l1_change = 0; -+ break; -+#endif -+ case UHF_C_PORT_OVER_CURRENT: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "ClearPortFeature USB_PORT_FEAT_C_OVER_CURRENT\n"); -+ dwc_otg_hcd->flags.b.port_over_current_change = 0; -+ break; -+ default: -+ retval = -DWC_E_INVALID; -+ DWC_ERROR("DWC OTG HCD - " -+ "ClearPortFeature request %xh " -+ "unknown or unsupported\n", wValue); -+ } -+ break; -+ case UCR_GET_HUB_DESCRIPTOR: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "GetHubDescriptor\n"); -+ hub_desc = (usb_hub_descriptor_t *) buf; -+ hub_desc->bDescLength = 9; -+ hub_desc->bDescriptorType = 0x29; -+ hub_desc->bNbrPorts = 1; -+ USETW(hub_desc->wHubCharacteristics, 0x08); -+ hub_desc->bPwrOn2PwrGood = 1; -+ hub_desc->bHubContrCurrent = 0; -+ hub_desc->DeviceRemovable[0] = 0; -+ hub_desc->DeviceRemovable[1] = 0xff; -+ break; -+ case UCR_GET_HUB_STATUS: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "GetHubStatus\n"); -+ DWC_MEMSET(buf, 0, 4); -+ break; -+ case UCR_GET_PORT_STATUS: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "GetPortStatus wIndex = 0x%04x FLAGS=0x%08x\n", -+ wIndex, dwc_otg_hcd->flags.d32); -+ if (!wIndex || wIndex > 1) -+ goto error; -+ -+ port_status = 0; -+ -+ if (dwc_otg_hcd->flags.b.port_connect_status_change) -+ port_status |= (1 << UHF_C_PORT_CONNECTION); -+ -+ if (dwc_otg_hcd->flags.b.port_enable_change) -+ port_status |= (1 << UHF_C_PORT_ENABLE); -+ -+ if (dwc_otg_hcd->flags.b.port_suspend_change) -+ port_status |= (1 << UHF_C_PORT_SUSPEND); -+ -+ if (dwc_otg_hcd->flags.b.port_l1_change) -+ port_status |= (1 << UHF_C_PORT_L1); -+ -+ if (dwc_otg_hcd->flags.b.port_reset_change) { -+ port_status |= (1 << UHF_C_PORT_RESET); -+ } -+ -+ if (dwc_otg_hcd->flags.b.port_over_current_change) { -+ DWC_WARN("Overcurrent change detected\n"); -+ port_status |= (1 << UHF_C_PORT_OVER_CURRENT); -+ } -+ -+ if (!dwc_otg_hcd->flags.b.port_connect_status) { -+ /* -+ * The port is disconnected, which means the core is -+ * either in device mode or it soon will be. Just -+ * return 0's for the remainder of the port status -+ * since the port register can't be read if the core -+ * is in device mode. -+ */ -+ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); -+ break; -+ } -+ -+ hprt0.d32 = DWC_READ_REG32(core_if->host_if->hprt0); -+ DWC_DEBUGPL(DBG_HCDV, " HPRT0: 0x%08x\n", hprt0.d32); -+ -+ if (hprt0.b.prtconnsts) -+ port_status |= (1 << UHF_PORT_CONNECTION); -+ -+ if (hprt0.b.prtena) -+ port_status |= (1 << UHF_PORT_ENABLE); -+ -+ if (hprt0.b.prtsusp) -+ port_status |= (1 << UHF_PORT_SUSPEND); -+ -+ if (hprt0.b.prtovrcurract) -+ port_status |= (1 << UHF_PORT_OVER_CURRENT); -+ -+ if (hprt0.b.prtrst) -+ port_status |= (1 << UHF_PORT_RESET); -+ -+ if (hprt0.b.prtpwr) -+ port_status |= (1 << UHF_PORT_POWER); -+ -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) -+ port_status |= (1 << UHF_PORT_HIGH_SPEED); -+ else if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED) -+ port_status |= (1 << UHF_PORT_LOW_SPEED); -+ -+ if (hprt0.b.prttstctl) -+ port_status |= (1 << UHF_PORT_TEST); -+ if (dwc_otg_get_lpm_portsleepstatus(dwc_otg_hcd->core_if)) { -+ port_status |= (1 << UHF_PORT_L1); -+ } -+ /* -+ For Synopsys HW emulation of Power down wkup_control asserts the -+ hreset_n and prst_n on suspned. This causes the HPRT0 to be zero. -+ We intentionally tell the software that port is in L2Suspend state. -+ Only for STE. -+ */ -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ port_status |= (1 << UHF_PORT_SUSPEND); -+ } -+ /* USB_PORT_FEAT_INDICATOR unsupported always 0 */ -+ -+ *((__le32 *) buf) = dwc_cpu_to_le32(&port_status); -+ -+ break; -+ case UCR_SET_HUB_FEATURE: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetHubFeature\n"); -+ /* No HUB features supported */ -+ break; -+ case UCR_SET_PORT_FEATURE: -+ if (wValue != UHF_PORT_TEST && (!wIndex || wIndex > 1)) -+ goto error; -+ -+ if (!dwc_otg_hcd->flags.b.port_connect_status) { -+ /* -+ * The port is disconnected, which means the core is -+ * either in device mode or it soon will be. Just -+ * return without doing anything since the port -+ * register can't be written if the core is in device -+ * mode. -+ */ -+ break; -+ } -+ -+ switch (wValue) { -+ case UHF_PORT_SUSPEND: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); -+ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) != wIndex) { -+ goto error; -+ } -+ if (core_if->power_down == 2) { -+ int timeout = 300; -+ dwc_irqflags_t flags; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ gusbcfg_data_t gusbcfg = {.d32 = 0 }; -+#ifdef DWC_DEV_SRPCAP -+ int32_t otg_cap_param = core_if->core_params->otg_cap; -+#endif -+ DWC_PRINTF("Preparing for complete power-off\n"); -+ -+ /* Save registers before hibernation */ -+ dwc_otg_save_global_regs(core_if); -+ dwc_otg_save_host_regs(core_if); -+ -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 1; -+ hprt0.b.prtena = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ /* Spin hprt0.b.prtsusp to became 1 */ -+ do { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ if (hprt0.b.prtsusp) { -+ break; -+ } -+ dwc_mdelay(1); -+ } while (--timeout); -+ if (!timeout) { -+ DWC_WARN("Suspend wasn't genereted\n"); -+ } -+ dwc_udelay(10); -+ -+ /* -+ * We need to disable interrupts to prevent servicing of any IRQ -+ * during going to hibernation -+ */ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ core_if->lx_state = DWC_OTG_L2; -+#ifdef DWC_DEV_SRPCAP -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 0; -+ hprt0.b.prtena = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+#endif -+ gusbcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs-> -+ gusbcfg); -+ if (gusbcfg.b.ulpi_utmi_sel == 1) { -+ /* ULPI interface */ -+ /* Suspend the Phy Clock */ -+ pcgcctl.d32 = 0; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ } else { -+ /* UTMI+ Interface */ -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, pcgcctl.d32); -+ dwc_udelay(10); -+ } -+#ifdef DWC_DEV_SRPCAP -+ gpwrdn.d32 = 0; -+ gpwrdn.b.dis_vbus = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+#endif -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ gpwrdn.d32 = 0; -+#ifdef DWC_DEV_SRPCAP -+ gpwrdn.b.srp_det_msk = 1; -+#endif -+ gpwrdn.b.disconn_det_msk = 1; -+ gpwrdn.b.lnstchng_msk = 1; -+ gpwrdn.b.sts_chngint_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Enable Power Down Clamp and all interrupts in GPWRDN */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnclmp = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ dwc_udelay(10); -+ -+ /* Switch off VDD */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+#ifdef DWC_DEV_SRPCAP -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) -+ { -+ core_if->pwron_timer_started = 1; -+ DWC_TIMER_SCHEDULE(core_if->pwron_timer, 6000 /* 6 secs */ ); -+ } -+#endif -+ /* Save gpwrdn register for further usage if stschng interrupt */ -+ core_if->gr_backup->gpwrdn_local = -+ DWC_READ_REG32(&core_if->core_global_regs->gpwrdn); -+ -+ /* Set flag to indicate that we are in hibernation */ -+ core_if->hibernation_suspend = 1; -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock,flags); -+ -+ DWC_PRINTF("Host hibernation completed\n"); -+ // Exit from case statement -+ break; -+ -+ } -+ if (dwc_otg_hcd_otg_port(dwc_otg_hcd) == wIndex && -+ dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gotgctl.b.hstsethnpen = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gotgctl, 0, gotgctl.d32); -+ core_if->op_state = A_SUSPEND; -+ } -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ { -+ dwc_irqflags_t flags; -+ /* Update lx_state */ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ core_if->lx_state = DWC_OTG_L2; -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+ } -+ /* Suspend the Phy Clock */ -+ { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, 0, -+ pcgcctl.d32); -+ dwc_udelay(10); -+ } -+ -+ /* For HNP the bus must be suspended for at least 200ms. */ -+ if (dwc_otg_hcd->fops->get_b_hnp_enable(dwc_otg_hcd)) { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ dwc_mdelay(200); -+ } -+ -+ /** @todo - check how sw can wait for 1 sec to check asesvld??? */ -+#if 0 //vahrama !!!!!!!!!!!!!!!!!! -+ if (core_if->adp_enable) { -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ gpwrdn_data_t gpwrdn; -+ -+ while (gotgctl.b.asesvld == 1) { -+ gotgctl.d32 = -+ DWC_READ_REG32(&core_if-> -+ core_global_regs-> -+ gotgctl); -+ dwc_mdelay(100); -+ } -+ -+ /* Enable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ /* Unmask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs-> -+ gpwrdn, 0, gpwrdn.d32); -+ -+ dwc_otg_adp_probe_start(core_if); -+ } -+#endif -+ break; -+ case UHF_PORT_POWER: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_POWER\n"); -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtpwr = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ break; -+ case UHF_PORT_RESET: -+ if ((core_if->power_down == 2) -+ && (core_if->hibernation_suspend == 1)) { -+ /* If we are going to exit from Hibernated -+ * state via USB RESET. -+ */ -+ dwc_otg_host_hibernation_restore(core_if, 0, 1); -+ } else { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ -+ DWC_DEBUGPL(DBG_HCD, -+ "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_RESET\n"); -+ { -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ pcgcctl.b.enbl_sleep_gating = 1; -+ pcgcctl.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, pcgcctl.d32, 0); -+ DWC_WRITE_REG32(core_if->pcgcctl, 0); -+ } -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ { -+ glpmcfg_data_t lpmcfg; -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.prt_sleep_sts) { -+ lpmcfg.b.en_utmi_sleep = 0; -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ DWC_WRITE_REG32 -+ (&core_if->core_global_regs->glpmcfg, -+ lpmcfg.d32); -+ dwc_mdelay(1); -+ } -+ } -+#endif -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ /* Clear suspend bit if resetting from suspended state. */ -+ hprt0.b.prtsusp = 0; -+ /* When B-Host the Port reset bit is set in -+ * the Start HCD Callback function, so that -+ * the reset is started within 1ms of the HNP -+ * success interrupt. */ -+ if (!dwc_otg_hcd_is_b_host(dwc_otg_hcd)) { -+ hprt0.b.prtpwr = 1; -+ hprt0.b.prtrst = 1; -+ DWC_PRINTF("Indeed it is in host mode hprt0 = %08x\n",hprt0.d32); -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+ } -+ /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */ -+ dwc_mdelay(60); -+ hprt0.b.prtrst = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ core_if->lx_state = DWC_OTG_L0; /* Now back to the on state */ -+ } -+ break; -+#ifdef DWC_HS_ELECT_TST -+ case UHF_PORT_TEST: -+ { -+ uint32_t t; -+ gintmsk_data_t gintmsk; -+ -+ t = (wIndex >> 8); /* MSB wIndex USB */ -+ DWC_DEBUGPL(DBG_HCD, -+ "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_TEST %d\n", -+ t); -+ DWC_WARN("USB_PORT_FEAT_TEST %d\n", t); -+ if (t < 6) { -+ hprt0.d32 = dwc_otg_read_hprt0(core_if); -+ hprt0.b.prttstctl = t; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, -+ hprt0.d32); -+ } else { -+ /* Setup global vars with reg addresses (quick and -+ * dirty hack, should be cleaned up) -+ */ -+ global_regs = core_if->core_global_regs; -+ hc_global_regs = -+ core_if->host_if->host_global_regs; -+ hc_regs = -+ (dwc_otg_hc_regs_t *) ((char *) -+ global_regs + -+ 0x500); -+ data_fifo = -+ (uint32_t *) ((char *)global_regs + -+ 0x1000); -+ -+ if (t == 6) { /* HS_HOST_PORT_SUSPEND_RESUME */ -+ /* Save current interrupt mask */ -+ gintmsk.d32 = -+ DWC_READ_REG32 -+ (&global_regs->gintmsk); -+ -+ /* Disable all interrupts while we muck with -+ * the hardware directly -+ */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* 15 second delay per the test spec */ -+ dwc_mdelay(15000); -+ -+ /* Drive suspend on the root port */ -+ hprt0.d32 = -+ dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 1; -+ hprt0.b.prtres = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* 15 second delay per the test spec */ -+ dwc_mdelay(15000); -+ -+ /* Drive resume on the root port */ -+ hprt0.d32 = -+ dwc_otg_read_hprt0(core_if); -+ hprt0.b.prtsusp = 0; -+ hprt0.b.prtres = 1; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ dwc_mdelay(100); -+ -+ /* Clear the resume bit */ -+ hprt0.b.prtres = 0; -+ DWC_WRITE_REG32(core_if->host_if->hprt0, hprt0.d32); -+ -+ /* Restore interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); -+ } else if (t == 7) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR setup */ -+ /* Save current interrupt mask */ -+ gintmsk.d32 = -+ DWC_READ_REG32 -+ (&global_regs->gintmsk); -+ -+ /* Disable all interrupts while we muck with -+ * the hardware directly -+ */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* 15 second delay per the test spec */ -+ dwc_mdelay(15000); -+ -+ /* Send the Setup packet */ -+ do_setup(); -+ -+ /* 15 second delay so nothing else happens for awhile */ -+ dwc_mdelay(15000); -+ -+ /* Restore interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); -+ } else if (t == 8) { /* SINGLE_STEP_GET_DEVICE_DESCRIPTOR execute */ -+ /* Save current interrupt mask */ -+ gintmsk.d32 = -+ DWC_READ_REG32 -+ (&global_regs->gintmsk); -+ -+ /* Disable all interrupts while we muck with -+ * the hardware directly -+ */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, 0); -+ -+ /* Send the Setup packet */ -+ do_setup(); -+ -+ /* 15 second delay so nothing else happens for awhile */ -+ dwc_mdelay(15000); -+ -+ /* Send the In and Ack packets */ -+ do_in_ack(); -+ -+ /* 15 second delay so nothing else happens for awhile */ -+ dwc_mdelay(15000); -+ -+ /* Restore interrupts */ -+ DWC_WRITE_REG32(&global_regs->gintmsk, gintmsk.d32); -+ } -+ } -+ break; -+ } -+#endif /* DWC_HS_ELECT_TST */ -+ -+ case UHF_PORT_INDICATOR: -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB CONTROL - " -+ "SetPortFeature - USB_PORT_FEAT_INDICATOR\n"); -+ /* Not supported */ -+ break; -+ default: -+ retval = -DWC_E_INVALID; -+ DWC_ERROR("DWC OTG HCD - " -+ "SetPortFeature request %xh " -+ "unknown or unsupported\n", wValue); -+ break; -+ } -+ break; -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ case UCR_SET_AND_TEST_PORT_FEATURE: -+ if (wValue != UHF_PORT_L1) { -+ goto error; -+ } -+ { -+ int portnum, hird, devaddr, remwake; -+ glpmcfg_data_t lpmcfg; -+ uint32_t time_usecs; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk; -+ -+ if (!dwc_otg_get_param_lpm_enable(core_if)) { -+ goto error; -+ } -+ if (wValue != UHF_PORT_L1 || wLength != 1) { -+ goto error; -+ } -+ /* Check if the port currently is in SLEEP state */ -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.prt_sleep_sts) { -+ DWC_INFO("Port is already in sleep mode\n"); -+ buf[0] = 0; /* Return success */ -+ break; -+ } -+ -+ portnum = wIndex & 0xf; -+ hird = (wIndex >> 4) & 0xf; -+ devaddr = (wIndex >> 8) & 0x7f; -+ remwake = (wIndex >> 15); -+ -+ if (portnum != 1) { -+ retval = -DWC_E_INVALID; -+ DWC_WARN -+ ("Wrong port number(%d) in SetandTestPortFeature request\n", -+ portnum); -+ break; -+ } -+ -+ DWC_PRINTF -+ ("SetandTestPortFeature request: portnum = %d, hird = %d, devaddr = %d, rewake = %d\n", -+ portnum, hird, devaddr, remwake); -+ /* Disable LPM interrupt */ -+ gintmsk.d32 = 0; -+ gintmsk.b.lpmtranrcvd = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ gintmsk.d32, 0); -+ -+ if (dwc_otg_hcd_send_lpm -+ (dwc_otg_hcd, devaddr, hird, remwake)) { -+ retval = -DWC_E_INVALID; -+ break; -+ } -+ -+ time_usecs = 10 * (lpmcfg.b.retry_count + 1); -+ /* We will consider timeout if time_usecs microseconds pass, -+ * and we don't receive LPM transaction status. -+ * After receiving non-error responce(ACK/NYET/STALL) from device, -+ * core will set lpmtranrcvd bit. -+ */ -+ do { -+ gintsts.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (gintsts.b.lpmtranrcvd) { -+ break; -+ } -+ dwc_udelay(1); -+ } while (--time_usecs); -+ /* lpm_int bit will be cleared in LPM interrupt handler */ -+ -+ /* Now fill status -+ * 0x00 - Success -+ * 0x10 - NYET -+ * 0x11 - Timeout -+ */ -+ if (!gintsts.b.lpmtranrcvd) { -+ buf[0] = 0x3; /* Completion code is Timeout */ -+ dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd); -+ } else { -+ lpmcfg.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ if (lpmcfg.b.lpm_resp == 0x3) { -+ /* ACK responce from the device */ -+ buf[0] = 0x00; /* Success */ -+ } else if (lpmcfg.b.lpm_resp == 0x2) { -+ /* NYET responce from the device */ -+ buf[0] = 0x2; -+ } else { -+ /* Otherwise responce with Timeout */ -+ buf[0] = 0x3; -+ } -+ } -+ DWC_PRINTF("Device responce to LPM trans is %x\n", -+ lpmcfg.b.lpm_resp); -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, -+ gintmsk.d32); -+ -+ break; -+ } -+#endif /* CONFIG_USB_DWC_OTG_LPM */ -+ default: -+error: -+ retval = -DWC_E_INVALID; -+ DWC_WARN("DWC OTG HCD - " -+ "Unknown hub control request type or invalid typeReq: %xh wIndex: %xh wValue: %xh\n", -+ typeReq, wIndex, wValue); -+ break; -+ } -+ -+ return retval; -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** Returns index of host channel to perform LPM transaction. */ -+int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, uint8_t devaddr) -+{ -+ dwc_otg_core_if_t *core_if = hcd->core_if; -+ dwc_hc_t *hc; -+ hcchar_data_t hcchar; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ if (DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) { -+ DWC_PRINTF("No free channel to select for LPM transaction\n"); -+ return -1; -+ } -+ -+ hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); -+ -+ /* Mask host channel interrupts. */ -+ gintmsk.b.hcintr = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, gintmsk.d32, 0); -+ -+ /* Fill fields that core needs for LPM transaction */ -+ hcchar.b.devaddr = devaddr; -+ hcchar.b.epnum = 0; -+ hcchar.b.eptype = DWC_OTG_EP_TYPE_CONTROL; -+ hcchar.b.mps = 64; -+ hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); -+ hcchar.b.epdir = 0; /* OUT */ -+ DWC_WRITE_REG32(&core_if->host_if->hc_regs[hc->hc_num]->hcchar, -+ hcchar.d32); -+ -+ /* Remove the host channel from the free list. */ -+ DWC_CIRCLEQ_REMOVE_INIT(&hcd->free_hc_list, hc, hc_list_entry); -+ -+ DWC_PRINTF("hcnum = %d devaddr = %d\n", hc->hc_num, devaddr); -+ -+ return hc->hc_num; -+} -+ -+/** Release hc after performing LPM transaction */ -+void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd) -+{ -+ dwc_hc_t *hc; -+ glpmcfg_data_t lpmcfg; -+ uint8_t hc_num; -+ -+ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); -+ hc_num = lpmcfg.b.lpm_chan_index; -+ -+ hc = hcd->hc_ptr_array[hc_num]; -+ -+ DWC_PRINTF("Freeing channel %d after LPM\n", hc_num); -+ /* Return host channel to free list */ -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); -+} -+ -+int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, uint8_t hird, -+ uint8_t bRemoteWake) -+{ -+ glpmcfg_data_t lpmcfg; -+ pcgcctl_data_t pcgcctl = {.d32 = 0 }; -+ int channel; -+ -+ channel = dwc_otg_hcd_get_hc_for_lpm_tran(hcd, devaddr); -+ if (channel < 0) { -+ return channel; -+ } -+ -+ pcgcctl.b.enbl_sleep_gating = 1; -+ DWC_MODIFY_REG32(hcd->core_if->pcgcctl, 0, pcgcctl.d32); -+ -+ /* Read LPM config register */ -+ lpmcfg.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->glpmcfg); -+ -+ /* Program LPM transaction fields */ -+ lpmcfg.b.rem_wkup_en = bRemoteWake; -+ lpmcfg.b.hird = hird; -+ lpmcfg.b.hird_thres = 0x1c; -+ lpmcfg.b.lpm_chan_index = channel; -+ lpmcfg.b.en_utmi_sleep = 1; -+ /* Program LPM config register */ -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+ -+ /* Send LPM transaction */ -+ lpmcfg.b.send_lpm = 1; -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+ -+ return 0; -+} -+ -+#endif /* CONFIG_USB_DWC_OTG_LPM */ -+ -+int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port) -+{ -+ int retval; -+ -+ if (port != 1) { -+ return -DWC_E_INVALID; -+ } -+ -+ retval = (hcd->flags.b.port_connect_status_change || -+ hcd->flags.b.port_reset_change || -+ hcd->flags.b.port_enable_change || -+ hcd->flags.b.port_suspend_change || -+ hcd->flags.b.port_over_current_change); -+#ifdef DEBUG -+ if (retval) { -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD HUB STATUS DATA:" -+ " Root port status changed\n"); -+ DWC_DEBUGPL(DBG_HCDV, " port_connect_status_change: %d\n", -+ hcd->flags.b.port_connect_status_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_reset_change: %d\n", -+ hcd->flags.b.port_reset_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_enable_change: %d\n", -+ hcd->flags.b.port_enable_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_suspend_change: %d\n", -+ hcd->flags.b.port_suspend_change); -+ DWC_DEBUGPL(DBG_HCDV, " port_over_current_change: %d\n", -+ hcd->flags.b.port_over_current_change); -+ } -+#endif -+ return retval; -+} -+ -+int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ hfnum_data_t hfnum; -+ hfnum.d32 = -+ DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs-> -+ hfnum); -+ -+#ifdef DEBUG_SOF -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD GET FRAME NUMBER %d\n", -+ hfnum.b.frnum); -+#endif -+ return hfnum.b.frnum; -+} -+ -+int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, -+ struct dwc_otg_hcd_function_ops *fops) -+{ -+ int retval = 0; -+ -+ hcd->fops = fops; -+ if (!dwc_otg_is_device_mode(hcd->core_if) && -+ (!hcd->core_if->adp_enable || hcd->core_if->adp.adp_started)) { -+ dwc_otg_hcd_reinit(hcd); -+ } else { -+ retval = -DWC_E_NO_DEVICE; -+ } -+ -+ return retval; -+} -+ -+void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd) -+{ -+ return hcd->priv; -+} -+ -+void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data) -+{ -+ hcd->priv = priv_data; -+} -+ -+uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd) -+{ -+ return hcd->otg_port; -+} -+ -+uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd) -+{ -+ uint32_t is_b_host; -+ if (hcd->core_if->op_state == B_HOST) { -+ is_b_host = 1; -+ } else { -+ is_b_host = 0; -+ } -+ -+ return is_b_host; -+} -+ -+dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, -+ int iso_desc_count, int atomic_alloc) -+{ -+ dwc_otg_hcd_urb_t *dwc_otg_urb; -+ uint32_t size; -+ -+ size = -+ sizeof(*dwc_otg_urb) + -+ iso_desc_count * sizeof(struct dwc_otg_hcd_iso_packet_desc); -+ if (atomic_alloc) -+ dwc_otg_urb = DWC_ALLOC_ATOMIC(size); -+ else -+ dwc_otg_urb = DWC_ALLOC(size); -+ -+ if (dwc_otg_urb) -+ dwc_otg_urb->packet_count = iso_desc_count; -+ else { -+ DWC_ERROR("**** DWC OTG HCD URB alloc - " -+ "%salloc of %db failed\n", -+ atomic_alloc?"atomic ":"", size); -+ } -+ return dwc_otg_urb; -+} -+ -+void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ uint8_t dev_addr, uint8_t ep_num, -+ uint8_t ep_type, uint8_t ep_dir, uint16_t mps) -+{ -+ dwc_otg_hcd_fill_pipe(&dwc_otg_urb->pipe_info, dev_addr, ep_num, -+ ep_type, ep_dir, mps); -+#if 0 -+ DWC_PRINTF -+ ("addr = %d, ep_num = %d, ep_dir = 0x%x, ep_type = 0x%x, mps = %d\n", -+ dev_addr, ep_num, ep_dir, ep_type, mps); -+#endif -+} -+ -+void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ void *urb_handle, void *buf, dwc_dma_t dma, -+ uint32_t buflen, void *setup_packet, -+ dwc_dma_t setup_dma, uint32_t flags, -+ uint16_t interval) -+{ -+ dwc_otg_urb->priv = urb_handle; -+ dwc_otg_urb->buf = buf; -+ dwc_otg_urb->dma = dma; -+ dwc_otg_urb->length = buflen; -+ dwc_otg_urb->setup_packet = setup_packet; -+ dwc_otg_urb->setup_dma = setup_dma; -+ dwc_otg_urb->flags = flags; -+ dwc_otg_urb->interval = interval; -+ dwc_otg_urb->status = -DWC_E_IN_PROGRESS; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ return dwc_otg_urb->status; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ return dwc_otg_urb->actual_length; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * dwc_otg_urb) -+{ -+ return dwc_otg_urb->error_count; -+} -+ -+void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int desc_num, uint32_t offset, -+ uint32_t length) -+{ -+ dwc_otg_urb->iso_descs[desc_num].offset = offset; -+ dwc_otg_urb->iso_descs[desc_num].length = length; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int desc_num) -+{ -+ return dwc_otg_urb->iso_descs[desc_num].status; -+} -+ -+uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * -+ dwc_otg_urb, int desc_num) -+{ -+ return dwc_otg_urb->iso_descs[desc_num].actual_length; -+} -+ -+int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ int allocated = 0; -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ -+ if (qh) { -+ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ allocated = 1; -+ } -+ } -+ return allocated; -+} -+ -+int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ int freed = 0; -+ DWC_ASSERT(qh, "qh is not allocated\n"); -+ -+ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ freed = 1; -+ } -+ -+ return freed; -+} -+ -+uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, void *ep_handle) -+{ -+ dwc_otg_qh_t *qh = (dwc_otg_qh_t *) ep_handle; -+ DWC_ASSERT(qh, "qh is not allocated\n"); -+ return qh->usecs; -+} -+ -+void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd) -+{ -+#ifdef DEBUG -+ int num_channels; -+ int i; -+ gnptxsts_data_t np_tx_status; -+ hptxsts_data_t p_tx_status; -+ -+ num_channels = hcd->core_if->core_params->host_channels; -+ DWC_PRINTF("\n"); -+ DWC_PRINTF -+ ("************************************************************\n"); -+ DWC_PRINTF("HCD State:\n"); -+ DWC_PRINTF(" Num channels: %d\n", num_channels); -+ for (i = 0; i < num_channels; i++) { -+ dwc_hc_t *hc = hcd->hc_ptr_array[i]; -+ DWC_PRINTF(" Channel %d:\n", i); -+ DWC_PRINTF(" dev_addr: %d, ep_num: %d, ep_is_in: %d\n", -+ hc->dev_addr, hc->ep_num, hc->ep_is_in); -+ DWC_PRINTF(" speed: %d\n", hc->speed); -+ DWC_PRINTF(" ep_type: %d\n", hc->ep_type); -+ DWC_PRINTF(" max_packet: %d\n", hc->max_packet); -+ DWC_PRINTF(" data_pid_start: %d\n", hc->data_pid_start); -+ DWC_PRINTF(" multi_count: %d\n", hc->multi_count); -+ DWC_PRINTF(" xfer_started: %d\n", hc->xfer_started); -+ DWC_PRINTF(" xfer_buff: %p\n", hc->xfer_buff); -+ DWC_PRINTF(" xfer_len: %d\n", hc->xfer_len); -+ DWC_PRINTF(" xfer_count: %d\n", hc->xfer_count); -+ DWC_PRINTF(" halt_on_queue: %d\n", hc->halt_on_queue); -+ DWC_PRINTF(" halt_pending: %d\n", hc->halt_pending); -+ DWC_PRINTF(" halt_status: %d\n", hc->halt_status); -+ DWC_PRINTF(" do_split: %d\n", hc->do_split); -+ DWC_PRINTF(" complete_split: %d\n", hc->complete_split); -+ DWC_PRINTF(" hub_addr: %d\n", hc->hub_addr); -+ DWC_PRINTF(" port_addr: %d\n", hc->port_addr); -+ DWC_PRINTF(" xact_pos: %d\n", hc->xact_pos); -+ DWC_PRINTF(" requests: %d\n", hc->requests); -+ DWC_PRINTF(" qh: %p\n", hc->qh); -+ if (hc->xfer_started) { -+ hfnum_data_t hfnum; -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ hfnum.d32 = -+ DWC_READ_REG32(&hcd->core_if-> -+ host_if->host_global_regs->hfnum); -+ hcchar.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hcchar); -+ hctsiz.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hctsiz); -+ hcint.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hcint); -+ hcintmsk.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if-> -+ hc_regs[i]->hcintmsk); -+ DWC_PRINTF(" hfnum: 0x%08x\n", hfnum.d32); -+ DWC_PRINTF(" hcchar: 0x%08x\n", hcchar.d32); -+ DWC_PRINTF(" hctsiz: 0x%08x\n", hctsiz.d32); -+ DWC_PRINTF(" hcint: 0x%08x\n", hcint.d32); -+ DWC_PRINTF(" hcintmsk: 0x%08x\n", hcintmsk.d32); -+ } -+ if (hc->xfer_started && hc->qh) { -+ dwc_otg_qtd_t *qtd; -+ dwc_otg_hcd_urb_t *urb; -+ -+ DWC_CIRCLEQ_FOREACH(qtd, &hc->qh->qtd_list, qtd_list_entry) { -+ if (!qtd->in_process) -+ break; -+ -+ urb = qtd->urb; -+ DWC_PRINTF(" URB Info:\n"); -+ DWC_PRINTF(" qtd: %p, urb: %p\n", qtd, urb); -+ if (urb) { -+ DWC_PRINTF(" Dev: %d, EP: %d %s\n", -+ dwc_otg_hcd_get_dev_addr(&urb-> -+ pipe_info), -+ dwc_otg_hcd_get_ep_num(&urb-> -+ pipe_info), -+ dwc_otg_hcd_is_pipe_in(&urb-> -+ pipe_info) ? -+ "IN" : "OUT"); -+ DWC_PRINTF(" Max packet size: %d\n", -+ dwc_otg_hcd_get_mps(&urb-> -+ pipe_info)); -+ DWC_PRINTF(" transfer_buffer: %p\n", -+ urb->buf); -+ DWC_PRINTF(" transfer_dma: %p\n", -+ (void *)urb->dma); -+ DWC_PRINTF(" transfer_buffer_length: %d\n", -+ urb->length); -+ DWC_PRINTF(" actual_length: %d\n", -+ urb->actual_length); -+ } -+ } -+ } -+ } -+ DWC_PRINTF(" non_periodic_channels: %d\n", hcd->non_periodic_channels); -+ DWC_PRINTF(" periodic_channels: %d\n", hcd->periodic_channels); -+ DWC_PRINTF(" periodic_usecs: %d\n", hcd->periodic_usecs); -+ np_tx_status.d32 = -+ DWC_READ_REG32(&hcd->core_if->core_global_regs->gnptxsts); -+ DWC_PRINTF(" NP Tx Req Queue Space Avail: %d\n", -+ np_tx_status.b.nptxqspcavail); -+ DWC_PRINTF(" NP Tx FIFO Space Avail: %d\n", -+ np_tx_status.b.nptxfspcavail); -+ p_tx_status.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hptxsts); -+ DWC_PRINTF(" P Tx Req Queue Space Avail: %d\n", -+ p_tx_status.b.ptxqspcavail); -+ DWC_PRINTF(" P Tx FIFO Space Avail: %d\n", p_tx_status.b.ptxfspcavail); -+ dwc_otg_hcd_dump_frrem(hcd); -+ dwc_otg_dump_global_registers(hcd->core_if); -+ dwc_otg_dump_host_registers(hcd->core_if); -+ DWC_PRINTF -+ ("************************************************************\n"); -+ DWC_PRINTF("\n"); -+#endif -+} -+ -+#ifdef DEBUG -+void dwc_print_setup_data(uint8_t * setup) -+{ -+ int i; -+ if (CHK_DEBUG_LEVEL(DBG_HCD)) { -+ DWC_PRINTF("Setup Data = MSB "); -+ for (i = 7; i >= 0; i--) -+ DWC_PRINTF("%02x ", setup[i]); -+ DWC_PRINTF("\n"); -+ DWC_PRINTF(" bmRequestType Tranfer = %s\n", -+ (setup[0] & 0x80) ? "Device-to-Host" : -+ "Host-to-Device"); -+ DWC_PRINTF(" bmRequestType Type = "); -+ switch ((setup[0] & 0x60) >> 5) { -+ case 0: -+ DWC_PRINTF("Standard\n"); -+ break; -+ case 1: -+ DWC_PRINTF("Class\n"); -+ break; -+ case 2: -+ DWC_PRINTF("Vendor\n"); -+ break; -+ case 3: -+ DWC_PRINTF("Reserved\n"); -+ break; -+ } -+ DWC_PRINTF(" bmRequestType Recipient = "); -+ switch (setup[0] & 0x1f) { -+ case 0: -+ DWC_PRINTF("Device\n"); -+ break; -+ case 1: -+ DWC_PRINTF("Interface\n"); -+ break; -+ case 2: -+ DWC_PRINTF("Endpoint\n"); -+ break; -+ case 3: -+ DWC_PRINTF("Other\n"); -+ break; -+ default: -+ DWC_PRINTF("Reserved\n"); -+ break; -+ } -+ DWC_PRINTF(" bRequest = 0x%0x\n", setup[1]); -+ DWC_PRINTF(" wValue = 0x%0x\n", *((uint16_t *) & setup[2])); -+ DWC_PRINTF(" wIndex = 0x%0x\n", *((uint16_t *) & setup[4])); -+ DWC_PRINTF(" wLength = 0x%0x\n\n", *((uint16_t *) & setup[6])); -+ } -+} -+#endif -+ -+void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd) -+{ -+#if 0 -+ DWC_PRINTF("Frame remaining at SOF:\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->frrem_samples, hcd->frrem_accum, -+ (hcd->frrem_samples > 0) ? -+ hcd->frrem_accum / hcd->frrem_samples : 0); -+ -+ DWC_PRINTF("\n"); -+ DWC_PRINTF("Frame remaining at start_transfer (uframe 7):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->core_if->hfnum_7_samples, -+ hcd->core_if->hfnum_7_frrem_accum, -+ (hcd->core_if->hfnum_7_samples > -+ 0) ? hcd->core_if->hfnum_7_frrem_accum / -+ hcd->core_if->hfnum_7_samples : 0); -+ DWC_PRINTF("Frame remaining at start_transfer (uframe 0):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->core_if->hfnum_0_samples, -+ hcd->core_if->hfnum_0_frrem_accum, -+ (hcd->core_if->hfnum_0_samples > -+ 0) ? hcd->core_if->hfnum_0_frrem_accum / -+ hcd->core_if->hfnum_0_samples : 0); -+ DWC_PRINTF("Frame remaining at start_transfer (uframe 1-6):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->core_if->hfnum_other_samples, -+ hcd->core_if->hfnum_other_frrem_accum, -+ (hcd->core_if->hfnum_other_samples > -+ 0) ? hcd->core_if->hfnum_other_frrem_accum / -+ hcd->core_if->hfnum_other_samples : 0); -+ -+ DWC_PRINTF("\n"); -+ DWC_PRINTF("Frame remaining at sample point A (uframe 7):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_7_samples_a, hcd->hfnum_7_frrem_accum_a, -+ (hcd->hfnum_7_samples_a > 0) ? -+ hcd->hfnum_7_frrem_accum_a / hcd->hfnum_7_samples_a : 0); -+ DWC_PRINTF("Frame remaining at sample point A (uframe 0):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_0_samples_a, hcd->hfnum_0_frrem_accum_a, -+ (hcd->hfnum_0_samples_a > 0) ? -+ hcd->hfnum_0_frrem_accum_a / hcd->hfnum_0_samples_a : 0); -+ DWC_PRINTF("Frame remaining at sample point A (uframe 1-6):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_other_samples_a, hcd->hfnum_other_frrem_accum_a, -+ (hcd->hfnum_other_samples_a > 0) ? -+ hcd->hfnum_other_frrem_accum_a / -+ hcd->hfnum_other_samples_a : 0); -+ -+ DWC_PRINTF("\n"); -+ DWC_PRINTF("Frame remaining at sample point B (uframe 7):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_7_samples_b, hcd->hfnum_7_frrem_accum_b, -+ (hcd->hfnum_7_samples_b > 0) ? -+ hcd->hfnum_7_frrem_accum_b / hcd->hfnum_7_samples_b : 0); -+ DWC_PRINTF("Frame remaining at sample point B (uframe 0):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_0_samples_b, hcd->hfnum_0_frrem_accum_b, -+ (hcd->hfnum_0_samples_b > 0) ? -+ hcd->hfnum_0_frrem_accum_b / hcd->hfnum_0_samples_b : 0); -+ DWC_PRINTF("Frame remaining at sample point B (uframe 1-6):\n"); -+ DWC_PRINTF(" samples %u, accum %llu, avg %llu\n", -+ hcd->hfnum_other_samples_b, hcd->hfnum_other_frrem_accum_b, -+ (hcd->hfnum_other_samples_b > 0) ? -+ hcd->hfnum_other_frrem_accum_b / -+ hcd->hfnum_other_samples_b : 0); -+#endif -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4539cd7b802d3e49ac9a6cb3f1d88b475a1ace16 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -@@ -0,0 +1,868 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ -+ * $Revision: #58 $ -+ * $Date: 2011/09/15 $ -+ * $Change: 1846647 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+#ifndef __DWC_HCD_H__ -+#define __DWC_HCD_H__ -+ -+#include "dwc_otg_os_dep.h" -+#include "usb.h" -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_list.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_fiq_fsm.h" -+#include "dwc_otg_driver.h" -+ -+ -+/** -+ * @file -+ * -+ * This file contains the structures, constants, and interfaces for -+ * the Host Contoller Driver (HCD). -+ * -+ * The Host Controller Driver (HCD) is responsible for translating requests -+ * from the USB Driver into the appropriate actions on the DWC_otg controller. -+ * It isolates the USBD from the specifics of the controller by providing an -+ * API to the USBD. -+ */ -+ -+struct dwc_otg_hcd_pipe_info { -+ uint8_t dev_addr; -+ uint8_t ep_num; -+ uint8_t pipe_type; -+ uint8_t pipe_dir; -+ uint16_t mps; -+}; -+ -+struct dwc_otg_hcd_iso_packet_desc { -+ uint32_t offset; -+ uint32_t length; -+ uint32_t actual_length; -+ uint32_t status; -+}; -+ -+struct dwc_otg_qtd; -+ -+struct dwc_otg_hcd_urb { -+ void *priv; -+ struct dwc_otg_qtd *qtd; -+ void *buf; -+ dwc_dma_t dma; -+ void *setup_packet; -+ dwc_dma_t setup_dma; -+ uint32_t length; -+ uint32_t actual_length; -+ uint32_t status; -+ uint32_t error_count; -+ uint32_t packet_count; -+ uint32_t flags; -+ uint16_t interval; -+ struct dwc_otg_hcd_pipe_info pipe_info; -+ struct dwc_otg_hcd_iso_packet_desc iso_descs[0]; -+}; -+ -+static inline uint8_t dwc_otg_hcd_get_ep_num(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return pipe->ep_num; -+} -+ -+static inline uint8_t dwc_otg_hcd_get_pipe_type(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return pipe->pipe_type; -+} -+ -+static inline uint16_t dwc_otg_hcd_get_mps(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return pipe->mps; -+} -+ -+static inline uint8_t dwc_otg_hcd_get_dev_addr(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return pipe->dev_addr; -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_isoc(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_ISOCHRONOUS); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_int(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_INTERRUPT); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_bulk(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_BULK); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_control(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_CONTROL); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_in(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return (pipe->pipe_dir == UE_DIR_IN); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_out(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (!dwc_otg_hcd_is_pipe_in(pipe)); -+} -+ -+static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, -+ uint8_t devaddr, uint8_t ep_num, -+ uint8_t pipe_type, uint8_t pipe_dir, -+ uint16_t mps) -+{ -+ pipe->dev_addr = devaddr; -+ pipe->ep_num = ep_num; -+ pipe->pipe_type = pipe_type; -+ pipe->pipe_dir = pipe_dir; -+ pipe->mps = mps; -+} -+ -+/** -+ * Phases for control transfers. -+ */ -+typedef enum dwc_otg_control_phase { -+ DWC_OTG_CONTROL_SETUP, -+ DWC_OTG_CONTROL_DATA, -+ DWC_OTG_CONTROL_STATUS -+} dwc_otg_control_phase_e; -+ -+/** Transaction types. */ -+typedef enum dwc_otg_transaction_type { -+ DWC_OTG_TRANSACTION_NONE = 0, -+ DWC_OTG_TRANSACTION_PERIODIC = 1, -+ DWC_OTG_TRANSACTION_NON_PERIODIC = 2, -+ DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC -+} dwc_otg_transaction_type_e; -+ -+struct dwc_otg_qh; -+ -+/** -+ * A Queue Transfer Descriptor (QTD) holds the state of a bulk, control, -+ * interrupt, or isochronous transfer. A single QTD is created for each URB -+ * (of one of these types) submitted to the HCD. The transfer associated with -+ * a QTD may require one or multiple transactions. -+ * -+ * A QTD is linked to a Queue Head, which is entered in either the -+ * non-periodic or periodic schedule for execution. When a QTD is chosen for -+ * execution, some or all of its transactions may be executed. After -+ * execution, the state of the QTD is updated. The QTD may be retired if all -+ * its transactions are complete or if an error occurred. Otherwise, it -+ * remains in the schedule so more transactions can be executed later. -+ */ -+typedef struct dwc_otg_qtd { -+ /** -+ * Determines the PID of the next data packet for the data phase of -+ * control transfers. Ignored for other transfer types.
-+ * One of the following values: -+ * - DWC_OTG_HC_PID_DATA0 -+ * - DWC_OTG_HC_PID_DATA1 -+ */ -+ uint8_t data_toggle; -+ -+ /** Current phase for control transfers (Setup, Data, or Status). */ -+ dwc_otg_control_phase_e control_phase; -+ -+ /** Keep track of the current split type -+ * for FS/LS endpoints on a HS Hub */ -+ uint8_t complete_split; -+ -+ /** How many bytes transferred during SSPLIT OUT */ -+ uint32_t ssplit_out_xfer_count; -+ -+ /** -+ * Holds the number of bus errors that have occurred for a transaction -+ * within this transfer. -+ */ -+ uint8_t error_count; -+ -+ /** -+ * Index of the next frame descriptor for an isochronous transfer. A -+ * frame descriptor describes the buffer position and length of the -+ * data to be transferred in the next scheduled (micro)frame of an -+ * isochronous transfer. It also holds status for that transaction. -+ * The frame index starts at 0. -+ */ -+ uint16_t isoc_frame_index; -+ -+ /** Position of the ISOC split on full/low speed */ -+ uint8_t isoc_split_pos; -+ -+ /** Position of the ISOC split in the buffer for the current frame */ -+ uint16_t isoc_split_offset; -+ -+ /** URB for this transfer */ -+ struct dwc_otg_hcd_urb *urb; -+ -+ struct dwc_otg_qh *qh; -+ -+ /** This list of QTDs */ -+ DWC_CIRCLEQ_ENTRY(dwc_otg_qtd) qtd_list_entry; -+ -+ /** Indicates if this QTD is currently processed by HW. */ -+ uint8_t in_process; -+ -+ /** Number of DMA descriptors for this QTD */ -+ uint8_t n_desc; -+ -+ /** -+ * Last activated frame(packet) index. -+ * Used in Descriptor DMA mode only. -+ */ -+ uint16_t isoc_frame_index_last; -+ -+} dwc_otg_qtd_t; -+ -+DWC_CIRCLEQ_HEAD(dwc_otg_qtd_list, dwc_otg_qtd); -+ -+/** -+ * A Queue Head (QH) holds the static characteristics of an endpoint and -+ * maintains a list of transfers (QTDs) for that endpoint. A QH structure may -+ * be entered in either the non-periodic or periodic schedule. -+ */ -+typedef struct dwc_otg_qh { -+ /** -+ * Endpoint type. -+ * One of the following values: -+ * - UE_CONTROL -+ * - UE_BULK -+ * - UE_INTERRUPT -+ * - UE_ISOCHRONOUS -+ */ -+ uint8_t ep_type; -+ uint8_t ep_is_in; -+ -+ /** wMaxPacketSize Field of Endpoint Descriptor. */ -+ uint16_t maxp; -+ -+ /** -+ * Device speed. -+ * One of the following values: -+ * - DWC_OTG_EP_SPEED_LOW -+ * - DWC_OTG_EP_SPEED_FULL -+ * - DWC_OTG_EP_SPEED_HIGH -+ */ -+ uint8_t dev_speed; -+ -+ /** -+ * Determines the PID of the next data packet for non-control -+ * transfers. Ignored for control transfers.
-+ * One of the following values: -+ * - DWC_OTG_HC_PID_DATA0 -+ * - DWC_OTG_HC_PID_DATA1 -+ */ -+ uint8_t data_toggle; -+ -+ /** Ping state if 1. */ -+ uint8_t ping_state; -+ -+ /** -+ * List of QTDs for this QH. -+ */ -+ struct dwc_otg_qtd_list qtd_list; -+ -+ /** Host channel currently processing transfers for this QH. */ -+ struct dwc_hc *channel; -+ -+ /** Full/low speed endpoint on high-speed hub requires split. */ -+ uint8_t do_split; -+ -+ /** @name Periodic schedule information */ -+ /** @{ */ -+ -+ /** Bandwidth in microseconds per (micro)frame. */ -+ uint16_t usecs; -+ -+ /** Interval between transfers in (micro)frames. */ -+ uint16_t interval; -+ -+ /** -+ * (micro)frame to initialize a periodic transfer. The transfer -+ * executes in the following (micro)frame. -+ */ -+ uint16_t sched_frame; -+ -+ /* -+ ** Frame a NAK was received on this queue head, used to minimise NAK retransmission -+ */ -+ uint16_t nak_frame; -+ -+ /** (micro)frame at which last start split was initialized. */ -+ uint16_t start_split_frame; -+ -+ /** @} */ -+ -+ /** -+ * Used instead of original buffer if -+ * it(physical address) is not dword-aligned. -+ */ -+ uint8_t *dw_align_buf; -+ dwc_dma_t dw_align_buf_dma; -+ -+ /** Entry for QH in either the periodic or non-periodic schedule. */ -+ dwc_list_link_t qh_list_entry; -+ -+ /** @name Descriptor DMA support */ -+ /** @{ */ -+ -+ /** Descriptor List. */ -+ dwc_otg_host_dma_desc_t *desc_list; -+ -+ /** Descriptor List physical address. */ -+ dwc_dma_t desc_list_dma; -+ -+ /** -+ * Xfer Bytes array. -+ * Each element corresponds to a descriptor and indicates -+ * original XferSize size value for the descriptor. -+ */ -+ uint32_t *n_bytes; -+ -+ /** Actual number of transfer descriptors in a list. */ -+ uint16_t ntd; -+ -+ /** First activated isochronous transfer descriptor index. */ -+ uint8_t td_first; -+ /** Last activated isochronous transfer descriptor index. */ -+ uint8_t td_last; -+ -+ /** @} */ -+ -+ -+ uint16_t speed; -+ uint16_t frame_usecs[8]; -+ -+ uint32_t skip_count; -+} dwc_otg_qh_t; -+ -+DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); -+ -+typedef struct urb_tq_entry { -+ struct urb *urb; -+ DWC_TAILQ_ENTRY(urb_tq_entry) urb_tq_entries; -+} urb_tq_entry_t; -+ -+DWC_TAILQ_HEAD(urb_list, urb_tq_entry); -+ -+/** -+ * This structure holds the state of the HCD, including the non-periodic and -+ * periodic schedules. -+ */ -+struct dwc_otg_hcd { -+ /** The DWC otg device pointer */ -+ struct dwc_otg_device *otg_dev; -+ /** DWC OTG Core Interface Layer */ -+ dwc_otg_core_if_t *core_if; -+ -+ /** Function HCD driver callbacks */ -+ struct dwc_otg_hcd_function_ops *fops; -+ -+ /** Internal DWC HCD Flags */ -+ volatile union dwc_otg_hcd_internal_flags { -+ uint32_t d32; -+ struct { -+ unsigned port_connect_status_change:1; -+ unsigned port_connect_status:1; -+ unsigned port_reset_change:1; -+ unsigned port_enable_change:1; -+ unsigned port_suspend_change:1; -+ unsigned port_over_current_change:1; -+ unsigned port_l1_change:1; -+ unsigned reserved:26; -+ } b; -+ } flags; -+ -+ /** -+ * Inactive items in the non-periodic schedule. This is a list of -+ * Queue Heads. Transfers associated with these Queue Heads are not -+ * currently assigned to a host channel. -+ */ -+ dwc_list_link_t non_periodic_sched_inactive; -+ -+ /** -+ * Active items in the non-periodic schedule. This is a list of -+ * Queue Heads. Transfers associated with these Queue Heads are -+ * currently assigned to a host channel. -+ */ -+ dwc_list_link_t non_periodic_sched_active; -+ -+ /** -+ * Pointer to the next Queue Head to process in the active -+ * non-periodic schedule. -+ */ -+ dwc_list_link_t *non_periodic_qh_ptr; -+ -+ /** -+ * Inactive items in the periodic schedule. This is a list of QHs for -+ * periodic transfers that are _not_ scheduled for the next frame. -+ * Each QH in the list has an interval counter that determines when it -+ * needs to be scheduled for execution. This scheduling mechanism -+ * allows only a simple calculation for periodic bandwidth used (i.e. -+ * must assume that all periodic transfers may need to execute in the -+ * same frame). However, it greatly simplifies scheduling and should -+ * be sufficient for the vast majority of OTG hosts, which need to -+ * connect to a small number of peripherals at one time. -+ * -+ * Items move from this list to periodic_sched_ready when the QH -+ * interval counter is 0 at SOF. -+ */ -+ dwc_list_link_t periodic_sched_inactive; -+ -+ /** -+ * List of periodic QHs that are ready for execution in the next -+ * frame, but have not yet been assigned to host channels. -+ * -+ * Items move from this list to periodic_sched_assigned as host -+ * channels become available during the current frame. -+ */ -+ dwc_list_link_t periodic_sched_ready; -+ -+ /** -+ * List of periodic QHs to be executed in the next frame that are -+ * assigned to host channels. -+ * -+ * Items move from this list to periodic_sched_queued as the -+ * transactions for the QH are queued to the DWC_otg controller. -+ */ -+ dwc_list_link_t periodic_sched_assigned; -+ -+ /** -+ * List of periodic QHs that have been queued for execution. -+ * -+ * Items move from this list to either periodic_sched_inactive or -+ * periodic_sched_ready when the channel associated with the transfer -+ * is released. If the interval for the QH is 1, the item moves to -+ * periodic_sched_ready because it must be rescheduled for the next -+ * frame. Otherwise, the item moves to periodic_sched_inactive. -+ */ -+ dwc_list_link_t periodic_sched_queued; -+ -+ /** -+ * Total bandwidth claimed so far for periodic transfers. This value -+ * is in microseconds per (micro)frame. The assumption is that all -+ * periodic transfers may occur in the same (micro)frame. -+ */ -+ uint16_t periodic_usecs; -+ -+ /** -+ * Total bandwidth claimed so far for all periodic transfers -+ * in a frame. -+ * This will include a mixture of HS and FS transfers. -+ * Units are microseconds per (micro)frame. -+ * We have a budget per frame and have to schedule -+ * transactions accordingly. -+ * Watch out for the fact that things are actually scheduled for the -+ * "next frame". -+ */ -+ uint16_t frame_usecs[8]; -+ -+ -+ /** -+ * Frame number read from the core at SOF. The value ranges from 0 to -+ * DWC_HFNUM_MAX_FRNUM. -+ */ -+ uint16_t frame_number; -+ -+ /** -+ * Count of periodic QHs, if using several eps. For SOF enable/disable. -+ */ -+ uint16_t periodic_qh_count; -+ -+ /** -+ * Free host channels in the controller. This is a list of -+ * dwc_hc_t items. -+ */ -+ struct hc_list free_hc_list; -+ /** -+ * Number of host channels assigned to periodic transfers. Currently -+ * assuming that there is a dedicated host channel for each periodic -+ * transaction and at least one host channel available for -+ * non-periodic transactions. -+ */ -+ int periodic_channels; /* microframe_schedule==0 */ -+ -+ /** -+ * Number of host channels assigned to non-periodic transfers. -+ */ -+ int non_periodic_channels; /* microframe_schedule==0 */ -+ -+ /** -+ * Number of host channels assigned to non-periodic transfers. -+ */ -+ int available_host_channels; -+ -+ /** -+ * Array of pointers to the host channel descriptors. Allows accessing -+ * a host channel descriptor given the host channel number. This is -+ * useful in interrupt handlers. -+ */ -+ struct dwc_hc *hc_ptr_array[MAX_EPS_CHANNELS]; -+ -+ /** -+ * Buffer to use for any data received during the status phase of a -+ * control transfer. Normally no data is transferred during the status -+ * phase. This buffer is used as a bit bucket. -+ */ -+ uint8_t *status_buf; -+ -+ /** -+ * DMA address for status_buf. -+ */ -+ dma_addr_t status_buf_dma; -+#define DWC_OTG_HCD_STATUS_BUF_SIZE 64 -+ -+ /** -+ * Connection timer. An OTG host must display a message if the device -+ * does not connect. Started when the VBus power is turned on via -+ * sysfs attribute "buspower". -+ */ -+ dwc_timer_t *conn_timer; -+ -+ /* Tasket to do a reset */ -+ dwc_tasklet_t *reset_tasklet; -+ -+ dwc_tasklet_t *completion_tasklet; -+ struct urb_list completed_urb_list; -+ -+ /* */ -+ dwc_spinlock_t *lock; -+ dwc_spinlock_t *channel_lock; -+ /** -+ * Private data that could be used by OS wrapper. -+ */ -+ void *priv; -+ -+ uint8_t otg_port; -+ -+ /** Frame List */ -+ uint32_t *frame_list; -+ -+ /** Hub - Port assignment */ -+ int hub_port[128]; -+#ifdef FIQ_DEBUG -+ int hub_port_alloc[2048]; -+#endif -+ -+ /** Frame List DMA address */ -+ dma_addr_t frame_list_dma; -+ -+ struct fiq_stack *fiq_stack; -+ struct fiq_state *fiq_state; -+ -+ /** Virtual address for split transaction DMA bounce buffers */ -+ struct fiq_dma_blob *fiq_dmab; -+ -+#ifdef DEBUG -+ uint32_t frrem_samples; -+ uint64_t frrem_accum; -+ -+ uint32_t hfnum_7_samples_a; -+ uint64_t hfnum_7_frrem_accum_a; -+ uint32_t hfnum_0_samples_a; -+ uint64_t hfnum_0_frrem_accum_a; -+ uint32_t hfnum_other_samples_a; -+ uint64_t hfnum_other_frrem_accum_a; -+ -+ uint32_t hfnum_7_samples_b; -+ uint64_t hfnum_7_frrem_accum_b; -+ uint32_t hfnum_0_samples_b; -+ uint64_t hfnum_0_frrem_accum_b; -+ uint32_t hfnum_other_samples_b; -+ uint64_t hfnum_other_frrem_accum_b; -+#endif -+}; -+ -+static inline struct device *dwc_otg_hcd_to_dev(struct dwc_otg_hcd *hcd) -+{ -+ return &hcd->otg_dev->os_dep.platformdev->dev; -+} -+ -+/** @name Transaction Execution Functions */ -+/** @{ */ -+extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t -+ * hcd); -+extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, -+ dwc_otg_transaction_type_e tr_type); -+ -+int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh); -+void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); -+ -+extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); -+extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh); -+extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num); -+ -+/** @} */ -+ -+/** @name Interrupt Handler Functions */ -+/** @{ */ -+extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_incomplete_periodic_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_conn_id_status_change_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_disconnect_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint32_t num); -+extern int32_t dwc_otg_hcd_handle_session_req_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_wakeup_detected_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+/** @} */ -+ -+/** @name Schedule Queue Functions */ -+/** @{ */ -+ -+/* Implemented in dwc_otg_hcd_queue.c */ -+extern dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * urb, int atomic_alloc); -+extern void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ int sched_csplit); -+ -+/** Remove and free a QH */ -+static inline void dwc_otg_hcd_qh_remove_and_free(dwc_otg_hcd_t * hcd, -+ dwc_otg_qh_t * qh) -+{ -+ dwc_irqflags_t flags; -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ dwc_otg_hcd_qh_free(hcd, qh); -+} -+ -+/** Allocates memory for a QH structure. -+ * @return Returns the memory allocate or NULL on error. */ -+static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(int atomic_alloc) -+{ -+ if (atomic_alloc) -+ return (dwc_otg_qh_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qh_t)); -+ else -+ return (dwc_otg_qh_t *) DWC_ALLOC(sizeof(dwc_otg_qh_t)); -+} -+ -+extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, -+ int atomic_alloc); -+extern void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb); -+extern int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_qh_t ** qh, int atomic_alloc); -+ -+/** Allocates memory for a QTD structure. -+ * @return Returns the memory allocate or NULL on error. */ -+static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(int atomic_alloc) -+{ -+ if (atomic_alloc) -+ return (dwc_otg_qtd_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qtd_t)); -+ else -+ return (dwc_otg_qtd_t *) DWC_ALLOC(sizeof(dwc_otg_qtd_t)); -+} -+ -+/** Frees the memory for a QTD structure. QTD should already be removed from -+ * list. -+ * @param qtd QTD to free.*/ -+static inline void dwc_otg_hcd_qtd_free(dwc_otg_qtd_t * qtd) -+{ -+ DWC_FREE(qtd); -+} -+ -+/** Removes a QTD from list. -+ * @param hcd HCD instance. -+ * @param qtd QTD to remove from list. -+ * @param qh QTD belongs to. -+ */ -+static inline void dwc_otg_hcd_qtd_remove(dwc_otg_hcd_t * hcd, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_qh_t * qh) -+{ -+ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); -+} -+ -+/** Remove and free a QTD -+ * Need to disable IRQ and hold hcd lock while calling this function out of -+ * interrupt servicing chain */ -+static inline void dwc_otg_hcd_qtd_remove_and_free(dwc_otg_hcd_t * hcd, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_qh_t * qh) -+{ -+ dwc_otg_hcd_qtd_remove(hcd, qtd, qh); -+ dwc_otg_hcd_qtd_free(qtd); -+} -+ -+/** @} */ -+ -+/** @name Descriptor DMA Supporting Functions */ -+/** @{ */ -+ -+extern void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status); -+ -+extern int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+ -+/** @} */ -+ -+/** @name Internal Functions */ -+/** @{ */ -+dwc_otg_qh_t *dwc_urb_to_qh(dwc_otg_hcd_urb_t * urb); -+/** @} */ -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+extern int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, -+ uint8_t devaddr); -+extern void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd); -+#endif -+ -+/** Gets the QH that contains the list_head */ -+#define dwc_list_to_qh(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qh_t, qh_list_entry) -+ -+/** Gets the QTD that contains the list_head */ -+#define dwc_list_to_qtd(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qtd_t, qtd_list_entry) -+ -+/** Check if QH is non-periodic */ -+#define dwc_qh_is_non_per(_qh_ptr_) ((_qh_ptr_->ep_type == UE_BULK) || \ -+ (_qh_ptr_->ep_type == UE_CONTROL)) -+ -+/** High bandwidth multiplier as encoded in highspeed endpoint descriptors */ -+#define dwc_hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) -+ -+/** Packet size for any kind of endpoint descriptor */ -+#define dwc_max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) -+ -+/** -+ * Returns true if _frame1 is less than or equal to _frame2. The comparison is -+ * done modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the -+ * frame number when the max frame number is reached. -+ */ -+static inline int dwc_frame_num_le(uint16_t frame1, uint16_t frame2) -+{ -+ return ((frame2 - frame1) & DWC_HFNUM_MAX_FRNUM) <= -+ (DWC_HFNUM_MAX_FRNUM >> 1); -+} -+ -+/** -+ * Returns true if _frame1 is greater than _frame2. The comparison is done -+ * modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the frame -+ * number when the max frame number is reached. -+ */ -+static inline int dwc_frame_num_gt(uint16_t frame1, uint16_t frame2) -+{ -+ return (frame1 != frame2) && -+ (((frame1 - frame2) & DWC_HFNUM_MAX_FRNUM) < -+ (DWC_HFNUM_MAX_FRNUM >> 1)); -+} -+ -+/** -+ * Increments _frame by the amount specified by _inc. The addition is done -+ * modulo DWC_HFNUM_MAX_FRNUM. Returns the incremented value. -+ */ -+static inline uint16_t dwc_frame_num_inc(uint16_t frame, uint16_t inc) -+{ -+ return (frame + inc) & DWC_HFNUM_MAX_FRNUM; -+} -+ -+static inline uint16_t dwc_full_frame_num(uint16_t frame) -+{ -+ return (frame & DWC_HFNUM_MAX_FRNUM) >> 3; -+} -+ -+static inline uint16_t dwc_micro_frame_num(uint16_t frame) -+{ -+ return frame & 0x7; -+} -+ -+void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd); -+ -+#ifdef DEBUG -+/** -+ * Macro to sample the remaining PHY clocks left in the current frame. This -+ * may be used during debugging to determine the average time it takes to -+ * execute sections of code. There are two possible sample points, "a" and -+ * "b", so the _letter argument must be one of these values. -+ * -+ * To dump the average sample times, read the "hcd_frrem" sysfs attribute. For -+ * example, "cat /sys/devices/lm0/hcd_frrem". -+ */ -+#define dwc_sample_frrem(_hcd, _qh, _letter) \ -+{ \ -+ hfnum_data_t hfnum; \ -+ dwc_otg_qtd_t *qtd; \ -+ qtd = list_entry(_qh->qtd_list.next, dwc_otg_qtd_t, qtd_list_entry); \ -+ if (usb_pipeint(qtd->urb->pipe) && _qh->start_split_frame != 0 && !qtd->complete_split) { \ -+ hfnum.d32 = DWC_READ_REG32(&_hcd->core_if->host_if->host_global_regs->hfnum); \ -+ switch (hfnum.b.frnum & 0x7) { \ -+ case 7: \ -+ _hcd->hfnum_7_samples_##_letter++; \ -+ _hcd->hfnum_7_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ case 0: \ -+ _hcd->hfnum_0_samples_##_letter++; \ -+ _hcd->hfnum_0_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ default: \ -+ _hcd->hfnum_other_samples_##_letter++; \ -+ _hcd->hfnum_other_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ } \ -+ } \ -+} -+#else -+#define dwc_sample_frrem(_hcd, _qh, _letter) -+#endif -+#endif -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c -new file mode 100644 -index 0000000000000000000000000000000000000000..126e99ab2fc43f11d89a08ff0476181ead84029f ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c -@@ -0,0 +1,1139 @@ -+/*========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $ -+ * $Revision: #10 $ -+ * $Date: 2011/10/20 $ -+ * $Change: 1869464 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** @file -+ * This file contains Descriptor DMA support implementation for host mode. -+ */ -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+ -+extern bool microframe_schedule; -+ -+static inline uint8_t frame_list_idx(uint16_t frame) -+{ -+ return (frame & (MAX_FRLIST_EN_NUM - 1)); -+} -+ -+static inline uint16_t desclist_idx_inc(uint16_t idx, uint16_t inc, uint8_t speed) -+{ -+ return (idx + inc) & -+ (((speed == -+ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : -+ MAX_DMA_DESC_NUM_GENERIC) - 1); -+} -+ -+static inline uint16_t desclist_idx_dec(uint16_t idx, uint16_t inc, uint8_t speed) -+{ -+ return (idx - inc) & -+ (((speed == -+ DWC_OTG_EP_SPEED_HIGH) ? MAX_DMA_DESC_NUM_HS_ISOC : -+ MAX_DMA_DESC_NUM_GENERIC) - 1); -+} -+ -+static inline uint16_t max_desc_num(dwc_otg_qh_t * qh) -+{ -+ return (((qh->ep_type == UE_ISOCHRONOUS) -+ && (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH)) -+ ? MAX_DMA_DESC_NUM_HS_ISOC : MAX_DMA_DESC_NUM_GENERIC); -+} -+static inline uint16_t frame_incr_val(dwc_otg_qh_t * qh) -+{ -+ return ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) -+ ? ((qh->interval + 8 - 1) / 8) -+ : qh->interval); -+} -+ -+static int desc_list_alloc(struct device *dev, dwc_otg_qh_t * qh) -+{ -+ int retval = 0; -+ -+ qh->desc_list = (dwc_otg_host_dma_desc_t *) -+ DWC_DMA_ALLOC(dev, sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh), -+ &qh->desc_list_dma); -+ -+ if (!qh->desc_list) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: DMA descriptor list allocation failed\n", __func__); -+ -+ } -+ -+ dwc_memset(qh->desc_list, 0x00, -+ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); -+ -+ qh->n_bytes = -+ (uint32_t *) DWC_ALLOC(sizeof(uint32_t) * max_desc_num(qh)); -+ -+ if (!qh->n_bytes) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR -+ ("%s: Failed to allocate array for descriptors' size actual values\n", -+ __func__); -+ -+ } -+ return retval; -+ -+} -+ -+static void desc_list_free(struct device *dev, dwc_otg_qh_t * qh) -+{ -+ if (qh->desc_list) { -+ DWC_DMA_FREE(dev, max_desc_num(qh), qh->desc_list, -+ qh->desc_list_dma); -+ qh->desc_list = NULL; -+ } -+ -+ if (qh->n_bytes) { -+ DWC_FREE(qh->n_bytes); -+ qh->n_bytes = NULL; -+ } -+} -+ -+static int frame_list_alloc(dwc_otg_hcd_t * hcd) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ int retval = 0; -+ -+ if (hcd->frame_list) -+ return 0; -+ -+ hcd->frame_list = DWC_DMA_ALLOC(dev, 4 * MAX_FRLIST_EN_NUM, -+ &hcd->frame_list_dma); -+ if (!hcd->frame_list) { -+ retval = -DWC_E_NO_MEMORY; -+ DWC_ERROR("%s: Frame List allocation failed\n", __func__); -+ } -+ -+ dwc_memset(hcd->frame_list, 0x00, 4 * MAX_FRLIST_EN_NUM); -+ -+ return retval; -+} -+ -+static void frame_list_free(dwc_otg_hcd_t * hcd) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ if (!hcd->frame_list) -+ return; -+ -+ DWC_DMA_FREE(dev, 4 * MAX_FRLIST_EN_NUM, hcd->frame_list, hcd->frame_list_dma); -+ hcd->frame_list = NULL; -+} -+ -+static void per_sched_enable(dwc_otg_hcd_t * hcd, uint16_t fr_list_en) -+{ -+ -+ hcfg_data_t hcfg; -+ -+ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); -+ -+ if (hcfg.b.perschedena) { -+ /* already enabled */ -+ return; -+ } -+ -+ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hflbaddr, -+ hcd->frame_list_dma); -+ -+ switch (fr_list_en) { -+ case 64: -+ hcfg.b.frlisten = 3; -+ break; -+ case 32: -+ hcfg.b.frlisten = 2; -+ break; -+ case 16: -+ hcfg.b.frlisten = 1; -+ break; -+ case 8: -+ hcfg.b.frlisten = 0; -+ break; -+ default: -+ break; -+ } -+ -+ hcfg.b.perschedena = 1; -+ -+ DWC_DEBUGPL(DBG_HCD, "Enabling Periodic schedule\n"); -+ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+ -+} -+ -+static void per_sched_disable(dwc_otg_hcd_t * hcd) -+{ -+ hcfg_data_t hcfg; -+ -+ hcfg.d32 = DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hcfg); -+ -+ if (!hcfg.b.perschedena) { -+ /* already disabled */ -+ return; -+ } -+ hcfg.b.perschedena = 0; -+ -+ DWC_DEBUGPL(DBG_HCD, "Disabling Periodic schedule\n"); -+ DWC_WRITE_REG32(&hcd->core_if->host_if->host_global_regs->hcfg, hcfg.d32); -+} -+ -+/* -+ * Activates/Deactivates FrameList entries for the channel -+ * based on endpoint servicing period. -+ */ -+void update_frame_list(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, uint8_t enable) -+{ -+ uint16_t i, j, inc; -+ dwc_hc_t *hc = NULL; -+ -+ if (!qh->channel) { -+ DWC_ERROR("qh->channel = %p", qh->channel); -+ return; -+ } -+ -+ if (!hcd) { -+ DWC_ERROR("------hcd = %p", hcd); -+ return; -+ } -+ -+ if (!hcd->frame_list) { -+ DWC_ERROR("-------hcd->frame_list = %p", hcd->frame_list); -+ return; -+ } -+ -+ hc = qh->channel; -+ inc = frame_incr_val(qh); -+ if (qh->ep_type == UE_ISOCHRONOUS) -+ i = frame_list_idx(qh->sched_frame); -+ else -+ i = 0; -+ -+ j = i; -+ do { -+ if (enable) -+ hcd->frame_list[j] |= (1 << hc->hc_num); -+ else -+ hcd->frame_list[j] &= ~(1 << hc->hc_num); -+ j = (j + inc) & (MAX_FRLIST_EN_NUM - 1); -+ } -+ while (j != i); -+ if (!enable) -+ return; -+ hc->schinfo = 0; -+ if (qh->channel->speed == DWC_OTG_EP_SPEED_HIGH) { -+ j = 1; -+ /* TODO - check this */ -+ inc = (8 + qh->interval - 1) / qh->interval; -+ for (i = 0; i < inc; i++) { -+ hc->schinfo |= j; -+ j = j << qh->interval; -+ } -+ } else { -+ hc->schinfo = 0xff; -+ } -+} -+ -+#if 1 -+void dump_frame_list(dwc_otg_hcd_t * hcd) -+{ -+ int i = 0; -+ DWC_PRINTF("--FRAME LIST (hex) --\n"); -+ for (i = 0; i < MAX_FRLIST_EN_NUM; i++) { -+ DWC_PRINTF("%x\t", hcd->frame_list[i]); -+ if (!(i % 8) && i) -+ DWC_PRINTF("\n"); -+ } -+ DWC_PRINTF("\n----\n"); -+ -+} -+#endif -+ -+static void release_channel_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ dwc_irqflags_t flags; -+ dwc_spinlock_t *channel_lock = hcd->channel_lock; -+ -+ dwc_hc_t *hc = qh->channel; -+ if (dwc_qh_is_non_per(qh)) { -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ if (!microframe_schedule) -+ hcd->non_periodic_channels--; -+ else -+ hcd->available_host_channels++; -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ } else -+ update_frame_list(hcd, qh, 0); -+ -+ /* -+ * The condition is added to prevent double cleanup try in case of device -+ * disconnect. See channel cleanup in dwc_otg_hcd_disconnect_cb(). -+ */ -+ if (hc->qh) { -+ dwc_otg_hc_cleanup(hcd->core_if, hc); -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); -+ hc->qh = NULL; -+ } -+ -+ qh->channel = NULL; -+ qh->ntd = 0; -+ -+ if (qh->desc_list) { -+ dwc_memset(qh->desc_list, 0x00, -+ sizeof(dwc_otg_host_dma_desc_t) * max_desc_num(qh)); -+ } -+} -+ -+/** -+ * Initializes a QH structure's Descriptor DMA related members. -+ * Allocates memory for descriptor list. -+ * On first periodic QH, allocates memory for FrameList -+ * and enables periodic scheduling. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ int retval = 0; -+ -+ if (qh->do_split) { -+ DWC_ERROR("SPLIT Transfers are not supported in Descriptor DMA.\n"); -+ return -1; -+ } -+ -+ retval = desc_list_alloc(dev, qh); -+ -+ if ((retval == 0) -+ && (qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT)) { -+ if (!hcd->frame_list) { -+ retval = frame_list_alloc(hcd); -+ /* Enable periodic schedule on first periodic QH */ -+ if (retval == 0) -+ per_sched_enable(hcd, MAX_FRLIST_EN_NUM); -+ } -+ } -+ -+ qh->ntd = 0; -+ -+ return retval; -+} -+ -+/** -+ * Frees descriptor list memory associated with the QH. -+ * If QH is periodic and the last, frees FrameList memory -+ * and disables periodic scheduling. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ */ -+void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ desc_list_free(dev, qh); -+ -+ /* -+ * Channel still assigned due to some reasons. -+ * Seen on Isoc URB dequeue. Channel halted but no subsequent -+ * ChHalted interrupt to release the channel. Afterwards -+ * when it comes here from endpoint disable routine -+ * channel remains assigned. -+ */ -+ if (qh->channel) -+ release_channel_ddma(hcd, qh); -+ -+ if ((qh->ep_type == UE_ISOCHRONOUS || qh->ep_type == UE_INTERRUPT) -+ && (microframe_schedule || !hcd->periodic_channels) && hcd->frame_list) { -+ -+ per_sched_disable(hcd); -+ frame_list_free(hcd); -+ } -+} -+ -+static uint8_t frame_to_desc_idx(dwc_otg_qh_t * qh, uint16_t frame_idx) -+{ -+ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { -+ /* -+ * Descriptor set(8 descriptors) index -+ * which is 8-aligned. -+ */ -+ return (frame_idx & ((MAX_DMA_DESC_NUM_HS_ISOC / 8) - 1)) * 8; -+ } else { -+ return (frame_idx & (MAX_DMA_DESC_NUM_GENERIC - 1)); -+ } -+} -+ -+/* -+ * Determine starting frame for Isochronous transfer. -+ * Few frames skipped to prevent race condition with HC. -+ */ -+static uint8_t calc_starting_frame(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ uint8_t * skip_frames) -+{ -+ uint16_t frame = 0; -+ hcd->frame_number = dwc_otg_hcd_get_frame_number(hcd); -+ -+ /* sched_frame is always frame number(not uFrame) both in FS and HS !! */ -+ -+ /* -+ * skip_frames is used to limit activated descriptors number -+ * to avoid the situation when HC services the last activated -+ * descriptor firstly. -+ * Example for FS: -+ * Current frame is 1, scheduled frame is 3. Since HC always fetches the descriptor -+ * corresponding to curr_frame+1, the descriptor corresponding to frame 2 -+ * will be fetched. If the number of descriptors is max=64 (or greather) the -+ * list will be fully programmed with Active descriptors and it is possible -+ * case(rare) that the latest descriptor(considering rollback) corresponding -+ * to frame 2 will be serviced first. HS case is more probable because, in fact, -+ * up to 11 uframes(16 in the code) may be skipped. -+ */ -+ if (qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) { -+ /* -+ * Consider uframe counter also, to start xfer asap. -+ * If half of the frame elapsed skip 2 frames otherwise -+ * just 1 frame. -+ * Starting descriptor index must be 8-aligned, so -+ * if the current frame is near to complete the next one -+ * is skipped as well. -+ */ -+ -+ if (dwc_micro_frame_num(hcd->frame_number) >= 5) { -+ *skip_frames = 2 * 8; -+ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); -+ } else { -+ *skip_frames = 1 * 8; -+ frame = dwc_frame_num_inc(hcd->frame_number, *skip_frames); -+ } -+ -+ frame = dwc_full_frame_num(frame); -+ } else { -+ /* -+ * Two frames are skipped for FS - the current and the next. -+ * But for descriptor programming, 1 frame(descriptor) is enough, -+ * see example above. -+ */ -+ *skip_frames = 1; -+ frame = dwc_frame_num_inc(hcd->frame_number, 2); -+ } -+ -+ return frame; -+} -+ -+/* -+ * Calculate initial descriptor index for isochronous transfer -+ * based on scheduled frame. -+ */ -+static uint8_t recalc_initial_desc_idx(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ uint16_t frame = 0, fr_idx, fr_idx_tmp; -+ uint8_t skip_frames = 0; -+ /* -+ * With current ISOC processing algorithm the channel is being -+ * released when no more QTDs in the list(qh->ntd == 0). -+ * Thus this function is called only when qh->ntd == 0 and qh->channel == 0. -+ * -+ * So qh->channel != NULL branch is not used and just not removed from the -+ * source file. It is required for another possible approach which is, -+ * do not disable and release the channel when ISOC session completed, -+ * just move QH to inactive schedule until new QTD arrives. -+ * On new QTD, the QH moved back to 'ready' schedule, -+ * starting frame and therefore starting desc_index are recalculated. -+ * In this case channel is released only on ep_disable. -+ */ -+ -+ /* Calculate starting descriptor index. For INTERRUPT endpoint it is always 0. */ -+ if (qh->channel) { -+ frame = calc_starting_frame(hcd, qh, &skip_frames); -+ /* -+ * Calculate initial descriptor index based on FrameList current bitmap -+ * and servicing period. -+ */ -+ fr_idx_tmp = frame_list_idx(frame); -+ fr_idx = -+ (MAX_FRLIST_EN_NUM + frame_list_idx(qh->sched_frame) - -+ fr_idx_tmp) -+ % frame_incr_val(qh); -+ fr_idx = (fr_idx + fr_idx_tmp) % MAX_FRLIST_EN_NUM; -+ } else { -+ qh->sched_frame = calc_starting_frame(hcd, qh, &skip_frames); -+ fr_idx = frame_list_idx(qh->sched_frame); -+ } -+ -+ qh->td_first = qh->td_last = frame_to_desc_idx(qh, fr_idx); -+ -+ return skip_frames; -+} -+ -+#define ISOC_URB_GIVEBACK_ASAP -+ -+#define MAX_ISOC_XFER_SIZE_FS 1023 -+#define MAX_ISOC_XFER_SIZE_HS 3072 -+#define DESCNUM_THRESHOLD 4 -+ -+static void init_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ uint8_t skip_frames) -+{ -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ dwc_otg_qtd_t *qtd; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ uint16_t idx, inc, n_desc, ntd_max, max_xfer_size; -+ -+ idx = qh->td_last; -+ inc = qh->interval; -+ n_desc = 0; -+ -+ ntd_max = (max_desc_num(qh) + qh->interval - 1) / qh->interval; -+ if (skip_frames && !qh->channel) -+ ntd_max = ntd_max - skip_frames / qh->interval; -+ -+ max_xfer_size = -+ (qh->dev_speed == -+ DWC_OTG_EP_SPEED_HIGH) ? MAX_ISOC_XFER_SIZE_HS : -+ MAX_ISOC_XFER_SIZE_FS; -+ -+ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { -+ while ((qh->ntd < ntd_max) -+ && (qtd->isoc_frame_index_last < -+ qtd->urb->packet_count)) { -+ -+ dma_desc = &qh->desc_list[idx]; -+ dwc_memset(dma_desc, 0x00, sizeof(dwc_otg_host_dma_desc_t)); -+ -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index_last]; -+ -+ if (frame_desc->length > max_xfer_size) -+ qh->n_bytes[idx] = max_xfer_size; -+ else -+ qh->n_bytes[idx] = frame_desc->length; -+ dma_desc->status.b_isoc.n_bytes = qh->n_bytes[idx]; -+ dma_desc->status.b_isoc.a = 1; -+ dma_desc->status.b_isoc.sts = 0; -+ -+ dma_desc->buf = qtd->urb->dma + frame_desc->offset; -+ -+ qh->ntd++; -+ -+ qtd->isoc_frame_index_last++; -+ -+#ifdef ISOC_URB_GIVEBACK_ASAP -+ /* -+ * Set IOC for each descriptor corresponding to the -+ * last frame of the URB. -+ */ -+ if (qtd->isoc_frame_index_last == -+ qtd->urb->packet_count) -+ dma_desc->status.b_isoc.ioc = 1; -+ -+#endif -+ idx = desclist_idx_inc(idx, inc, qh->dev_speed); -+ n_desc++; -+ -+ } -+ qtd->in_process = 1; -+ } -+ -+ qh->td_last = idx; -+ -+#ifdef ISOC_URB_GIVEBACK_ASAP -+ /* Set IOC for the last descriptor if descriptor list is full */ -+ if (qh->ntd == ntd_max) { -+ idx = desclist_idx_dec(qh->td_last, inc, qh->dev_speed); -+ qh->desc_list[idx].status.b_isoc.ioc = 1; -+ } -+#else -+ /* -+ * Set IOC bit only for one descriptor. -+ * Always try to be ahead of HW processing, -+ * i.e. on IOC generation driver activates next descriptors but -+ * core continues to process descriptors followed the one with IOC set. -+ */ -+ -+ if (n_desc > DESCNUM_THRESHOLD) { -+ /* -+ * Move IOC "up". Required even if there is only one QTD -+ * in the list, cause QTDs migth continue to be queued, -+ * but during the activation it was only one queued. -+ * Actually more than one QTD might be in the list if this function called -+ * from XferCompletion - QTDs was queued during HW processing of the previous -+ * descriptor chunk. -+ */ -+ idx = dwc_desclist_idx_dec(idx, inc * ((qh->ntd + 1) / 2), qh->dev_speed); -+ } else { -+ /* -+ * Set the IOC for the latest descriptor -+ * if either number of descriptor is not greather than threshold -+ * or no more new descriptors activated. -+ */ -+ idx = dwc_desclist_idx_dec(qh->td_last, inc, qh->dev_speed); -+ } -+ -+ qh->desc_list[idx].status.b_isoc.ioc = 1; -+#endif -+} -+ -+static void init_non_isoc_dma_desc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ -+ dwc_hc_t *hc; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ dwc_otg_qtd_t *qtd; -+ int num_packets, len, n_desc = 0; -+ -+ hc = qh->channel; -+ -+ /* -+ * Start with hc->xfer_buff initialized in -+ * assign_and_init_hc(), then if SG transfer consists of multiple URBs, -+ * this pointer re-assigned to the buffer of the currently processed QTD. -+ * For non-SG request there is always one QTD active. -+ */ -+ -+ DWC_CIRCLEQ_FOREACH(qtd, &qh->qtd_list, qtd_list_entry) { -+ -+ if (n_desc) { -+ /* SG request - more than 1 QTDs */ -+ hc->xfer_buff = (uint8_t *)qtd->urb->dma + qtd->urb->actual_length; -+ hc->xfer_len = qtd->urb->length - qtd->urb->actual_length; -+ } -+ -+ qtd->n_desc = 0; -+ -+ do { -+ dma_desc = &qh->desc_list[n_desc]; -+ len = hc->xfer_len; -+ -+ if (len > MAX_DMA_DESC_SIZE) -+ len = MAX_DMA_DESC_SIZE - hc->max_packet + 1; -+ -+ if (hc->ep_is_in) { -+ if (len > 0) { -+ num_packets = (len + hc->max_packet - 1) / hc->max_packet; -+ } else { -+ /* Need 1 packet for transfer length of 0. */ -+ num_packets = 1; -+ } -+ /* Always program an integral # of max packets for IN transfers. */ -+ len = num_packets * hc->max_packet; -+ } -+ -+ dma_desc->status.b.n_bytes = len; -+ -+ qh->n_bytes[n_desc] = len; -+ -+ if ((qh->ep_type == UE_CONTROL) -+ && (qtd->control_phase == DWC_OTG_CONTROL_SETUP)) -+ dma_desc->status.b.sup = 1; /* Setup Packet */ -+ -+ dma_desc->status.b.a = 1; /* Active descriptor */ -+ dma_desc->status.b.sts = 0; -+ -+ dma_desc->buf = -+ ((unsigned long)hc->xfer_buff & 0xffffffff); -+ -+ /* -+ * Last descriptor(or single) of IN transfer -+ * with actual size less than MaxPacket. -+ */ -+ if (len > hc->xfer_len) { -+ hc->xfer_len = 0; -+ } else { -+ hc->xfer_buff += len; -+ hc->xfer_len -= len; -+ } -+ -+ qtd->n_desc++; -+ n_desc++; -+ } -+ while ((hc->xfer_len > 0) && (n_desc != MAX_DMA_DESC_NUM_GENERIC)); -+ -+ -+ qtd->in_process = 1; -+ -+ if (qh->ep_type == UE_CONTROL) -+ break; -+ -+ if (n_desc == MAX_DMA_DESC_NUM_GENERIC) -+ break; -+ } -+ -+ if (n_desc) { -+ /* Request Transfer Complete interrupt for the last descriptor */ -+ qh->desc_list[n_desc - 1].status.b.ioc = 1; -+ /* End of List indicator */ -+ qh->desc_list[n_desc - 1].status.b.eol = 1; -+ -+ hc->ntd = n_desc; -+ } -+} -+ -+/** -+ * For Control and Bulk endpoints initializes descriptor list -+ * and starts the transfer. -+ * -+ * For Interrupt and Isochronous endpoints initializes descriptor list -+ * then updates FrameList, marking appropriate entries as active. -+ * In case of Isochronous, the starting descriptor index is calculated based -+ * on the scheduled frame, but only on the first transfer descriptor within a session. -+ * Then starts the transfer via enabling the channel. -+ * For Isochronous endpoint the channel is not halted on XferComplete -+ * interrupt so remains assigned to the endpoint(QH) until session is done. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ /* Channel is already assigned */ -+ dwc_hc_t *hc = qh->channel; -+ uint8_t skip_frames = 0; -+ -+ switch (hc->ep_type) { -+ case DWC_OTG_EP_TYPE_CONTROL: -+ case DWC_OTG_EP_TYPE_BULK: -+ init_non_isoc_dma_desc(hcd, qh); -+ -+ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); -+ break; -+ case DWC_OTG_EP_TYPE_INTR: -+ init_non_isoc_dma_desc(hcd, qh); -+ -+ update_frame_list(hcd, qh, 1); -+ -+ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); -+ break; -+ case DWC_OTG_EP_TYPE_ISOC: -+ -+ if (!qh->ntd) -+ skip_frames = recalc_initial_desc_idx(hcd, qh); -+ -+ init_isoc_dma_desc(hcd, qh, skip_frames); -+ -+ if (!hc->xfer_started) { -+ -+ update_frame_list(hcd, qh, 1); -+ -+ /* -+ * Always set to max, instead of actual size. -+ * Otherwise ntd will be changed with -+ * channel being enabled. Not recommended. -+ * -+ */ -+ hc->ntd = max_desc_num(qh); -+ /* Enable channel only once for ISOC */ -+ dwc_otg_hc_start_transfer_ddma(hcd->core_if, hc); -+ } -+ -+ break; -+ default: -+ -+ break; -+ } -+} -+ -+static void complete_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status) -+{ -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ dwc_otg_qh_t *qh; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ uint16_t idx, remain; -+ uint8_t urb_compl; -+ -+ qh = hc->qh; -+ idx = qh->td_first; -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) -+ qtd->in_process = 0; -+ return; -+ } else if ((halt_status == DWC_OTG_HC_XFER_AHB_ERR) || -+ (halt_status == DWC_OTG_HC_XFER_BABBLE_ERR)) { -+ /* -+ * Channel is halted in these error cases. -+ * Considered as serious issues. -+ * Complete all URBs marking all frames as failed, -+ * irrespective whether some of the descriptors(frames) succeeded or no. -+ * Pass error code to completion routine as well, to -+ * update urb->status, some of class drivers might use it to stop -+ * queing transfer requests. -+ */ -+ int err = (halt_status == DWC_OTG_HC_XFER_AHB_ERR) -+ ? (-DWC_E_IO) -+ : (-DWC_E_OVERFLOW); -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { -+ for (idx = 0; idx < qtd->urb->packet_count; idx++) { -+ frame_desc = &qtd->urb->iso_descs[idx]; -+ frame_desc->status = err; -+ } -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, err); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ } -+ return; -+ } -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { -+ -+ if (!qtd->in_process) -+ break; -+ -+ urb_compl = 0; -+ -+ do { -+ -+ dma_desc = &qh->desc_list[idx]; -+ -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ remain = hc->ep_is_in ? dma_desc->status.b_isoc.n_bytes : 0; -+ -+ if (dma_desc->status.b_isoc.sts == DMA_DESC_STS_PKTERR) { -+ /* -+ * XactError or, unable to complete all the transactions -+ * in the scheduled micro-frame/frame, -+ * both indicated by DMA_DESC_STS_PKTERR. -+ */ -+ qtd->urb->error_count++; -+ frame_desc->actual_length = qh->n_bytes[idx] - remain; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ } else { -+ /* Success */ -+ -+ frame_desc->actual_length = qh->n_bytes[idx] - remain; -+ frame_desc->status = 0; -+ } -+ -+ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { -+ /* -+ * urb->status is not used for isoc transfers here. -+ * The individual frame_desc status are used instead. -+ */ -+ -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ -+ /* -+ * This check is necessary because urb_dequeue can be called -+ * from urb complete callback(sound driver example). -+ * All pending URBs are dequeued there, so no need for -+ * further processing. -+ */ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ return; -+ } -+ -+ urb_compl = 1; -+ -+ } -+ -+ qh->ntd--; -+ -+ /* Stop if IOC requested descriptor reached */ -+ if (dma_desc->status.b_isoc.ioc) { -+ idx = desclist_idx_inc(idx, qh->interval, hc->speed); -+ goto stop_scan; -+ } -+ -+ idx = desclist_idx_inc(idx, qh->interval, hc->speed); -+ -+ if (urb_compl) -+ break; -+ } -+ while (idx != qh->td_first); -+ } -+stop_scan: -+ qh->td_first = idx; -+} -+ -+uint8_t update_non_isoc_urb_state_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_host_dma_desc_t * dma_desc, -+ dwc_otg_halt_status_e halt_status, -+ uint32_t n_bytes, uint8_t * xfer_done) -+{ -+ -+ uint16_t remain = hc->ep_is_in ? dma_desc->status.b.n_bytes : 0; -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ -+ if (halt_status == DWC_OTG_HC_XFER_AHB_ERR) { -+ urb->status = -DWC_E_IO; -+ return 1; -+ } -+ if (dma_desc->status.b.sts == DMA_DESC_STS_PKTERR) { -+ switch (halt_status) { -+ case DWC_OTG_HC_XFER_STALL: -+ urb->status = -DWC_E_PIPE; -+ break; -+ case DWC_OTG_HC_XFER_BABBLE_ERR: -+ urb->status = -DWC_E_OVERFLOW; -+ break; -+ case DWC_OTG_HC_XFER_XACT_ERR: -+ urb->status = -DWC_E_PROTOCOL; -+ break; -+ default: -+ DWC_ERROR("%s: Unhandled descriptor error status (%d)\n", __func__, -+ halt_status); -+ break; -+ } -+ return 1; -+ } -+ -+ if (dma_desc->status.b.a == 1) { -+ DWC_DEBUGPL(DBG_HCDV, -+ "Active descriptor encountered on channel %d\n", -+ hc->hc_num); -+ return 0; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL) { -+ if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { -+ urb->actual_length += n_bytes - remain; -+ if (remain || urb->actual_length == urb->length) { -+ /* -+ * For Control Data stage do not set urb->status=0 to prevent -+ * URB callback. Set it when Status phase done. See below. -+ */ -+ *xfer_done = 1; -+ } -+ -+ } else if (qtd->control_phase == DWC_OTG_CONTROL_STATUS) { -+ urb->status = 0; -+ *xfer_done = 1; -+ } -+ /* No handling for SETUP stage */ -+ } else { -+ /* BULK and INTR */ -+ urb->actual_length += n_bytes - remain; -+ if (remain || urb->actual_length == urb->length) { -+ urb->status = 0; -+ *xfer_done = 1; -+ } -+ } -+ -+ return 0; -+} -+ -+static void complete_non_isoc_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status) -+{ -+ dwc_otg_hcd_urb_t *urb = NULL; -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ dwc_otg_qh_t *qh; -+ dwc_otg_host_dma_desc_t *dma_desc; -+ uint32_t n_bytes, n_desc, i; -+ uint8_t failed = 0, xfer_done; -+ -+ n_desc = 0; -+ -+ qh = hc->qh; -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &hc->qh->qtd_list, qtd_list_entry) { -+ qtd->in_process = 0; -+ } -+ return; -+ } -+ -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { -+ -+ urb = qtd->urb; -+ -+ n_bytes = 0; -+ xfer_done = 0; -+ -+ for (i = 0; i < qtd->n_desc; i++) { -+ dma_desc = &qh->desc_list[n_desc]; -+ -+ n_bytes = qh->n_bytes[n_desc]; -+ -+ failed = -+ update_non_isoc_urb_state_ddma(hcd, hc, qtd, -+ dma_desc, -+ halt_status, n_bytes, -+ &xfer_done); -+ -+ if (failed -+ || (xfer_done -+ && (urb->status != -DWC_E_IN_PROGRESS))) { -+ -+ hcd->fops->complete(hcd, urb->priv, urb, -+ urb->status); -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ -+ if (failed) -+ goto stop_scan; -+ } else if (qh->ep_type == UE_CONTROL) { -+ if (qtd->control_phase == DWC_OTG_CONTROL_SETUP) { -+ if (urb->length > 0) { -+ qtd->control_phase = DWC_OTG_CONTROL_DATA; -+ } else { -+ qtd->control_phase = DWC_OTG_CONTROL_STATUS; -+ } -+ DWC_DEBUGPL(DBG_HCDV, " Control setup transaction done\n"); -+ } else if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { -+ if (xfer_done) { -+ qtd->control_phase = DWC_OTG_CONTROL_STATUS; -+ DWC_DEBUGPL(DBG_HCDV, " Control data transfer done\n"); -+ } else if (i + 1 == qtd->n_desc) { -+ /* -+ * Last descriptor for Control data stage which is -+ * not completed yet. -+ */ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ } -+ } -+ } -+ -+ n_desc++; -+ } -+ -+ } -+ -+stop_scan: -+ -+ if (qh->ep_type != UE_CONTROL) { -+ /* -+ * Resetting the data toggle for bulk -+ * and interrupt endpoints in case of stall. See handle_hc_stall_intr() -+ */ -+ if (halt_status == DWC_OTG_HC_XFER_STALL) -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ else -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ } -+ -+ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { -+ hcint_data_t hcint; -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ if (hcint.b.nyet) { -+ /* -+ * Got a NYET on the last transaction of the transfer. It -+ * means that the endpoint should be in the PING state at the -+ * beginning of the next transfer. -+ */ -+ qh->ping_state = 1; -+ clear_hc_int(hc_regs, nyet); -+ } -+ -+ } -+ -+} -+ -+/** -+ * This function is called from interrupt handlers. -+ * Scans the descriptor list, updates URB's status and -+ * calls completion routine for the URB if it's done. -+ * Releases the channel to be used by other transfers. -+ * In case of Isochronous endpoint the channel is not halted until -+ * the end of the session, i.e. QTD list is empty. -+ * If periodic channel released the FrameList is updated accordingly. -+ * -+ * Calls transaction selection routines to activate pending transfers. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param hc Host channel, the transfer is completed on. -+ * @param hc_regs Host channel registers. -+ * @param halt_status Reason the channel is being halted, -+ * or just XferComplete for isochronous transfer -+ */ -+void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status) -+{ -+ uint8_t continue_isoc_xfer = 0; -+ dwc_otg_transaction_type_e tr_type; -+ dwc_otg_qh_t *qh = hc->qh; -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ -+ complete_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); -+ -+ /* Release the channel if halted or session completed */ -+ if (halt_status != DWC_OTG_HC_XFER_COMPLETE || -+ DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ -+ /* Halt the channel if session completed */ -+ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { -+ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); -+ } -+ -+ release_channel_ddma(hcd, qh); -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } else { -+ /* Keep in assigned schedule to continue transfer */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, -+ &qh->qh_list_entry); -+ continue_isoc_xfer = 1; -+ -+ } -+ /** @todo Consider the case when period exceeds FrameList size. -+ * Frame Rollover interrupt should be used. -+ */ -+ } else { -+ /* Scan descriptor list to complete the URB(s), then release the channel */ -+ complete_non_isoc_xfer_ddma(hcd, hc, hc_regs, halt_status); -+ -+ release_channel_ddma(hcd, qh); -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ -+ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ /* Add back to inactive non-periodic schedule on normal completion */ -+ dwc_otg_hcd_qh_add(hcd, qh); -+ } -+ -+ } -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE || continue_isoc_xfer) { -+ if (continue_isoc_xfer) { -+ if (tr_type == DWC_OTG_TRANSACTION_NONE) { -+ tr_type = DWC_OTG_TRANSACTION_PERIODIC; -+ } else if (tr_type == DWC_OTG_TRANSACTION_NON_PERIODIC) { -+ tr_type = DWC_OTG_TRANSACTION_ALL; -+ } -+ } -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ } -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h -new file mode 100644 -index 0000000000000000000000000000000000000000..fb57db09378f4ab95d57cb58aa570a915ccb61c3 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h -@@ -0,0 +1,417 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $ -+ * $Revision: #12 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+#ifndef __DWC_HCD_IF_H__ -+#define __DWC_HCD_IF_H__ -+ -+#include "dwc_otg_core_if.h" -+ -+/** @file -+ * This file defines DWC_OTG HCD Core API. -+ */ -+ -+struct dwc_otg_hcd; -+typedef struct dwc_otg_hcd dwc_otg_hcd_t; -+ -+struct dwc_otg_hcd_urb; -+typedef struct dwc_otg_hcd_urb dwc_otg_hcd_urb_t; -+ -+/** @name HCD Function Driver Callbacks */ -+/** @{ */ -+ -+/** This function is called whenever core switches to host mode. */ -+typedef int (*dwc_otg_hcd_start_cb_t) (dwc_otg_hcd_t * hcd); -+ -+/** This function is called when device has been disconnected */ -+typedef int (*dwc_otg_hcd_disconnect_cb_t) (dwc_otg_hcd_t * hcd); -+ -+/** Wrapper provides this function to HCD to core, so it can get hub information to which device is connected */ -+typedef int (*dwc_otg_hcd_hub_info_from_urb_cb_t) (dwc_otg_hcd_t * hcd, -+ void *urb_handle, -+ uint32_t * hub_addr, -+ uint32_t * port_addr); -+/** Via this function HCD core gets device speed */ -+typedef int (*dwc_otg_hcd_speed_from_urb_cb_t) (dwc_otg_hcd_t * hcd, -+ void *urb_handle); -+ -+/** This function is called when urb is completed */ -+typedef int (*dwc_otg_hcd_complete_urb_cb_t) (dwc_otg_hcd_t * hcd, -+ void *urb_handle, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int32_t status); -+ -+/** Via this function HCD core gets b_hnp_enable parameter */ -+typedef int (*dwc_otg_hcd_get_b_hnp_enable) (dwc_otg_hcd_t * hcd); -+ -+struct dwc_otg_hcd_function_ops { -+ dwc_otg_hcd_start_cb_t start; -+ dwc_otg_hcd_disconnect_cb_t disconnect; -+ dwc_otg_hcd_hub_info_from_urb_cb_t hub_info; -+ dwc_otg_hcd_speed_from_urb_cb_t speed; -+ dwc_otg_hcd_complete_urb_cb_t complete; -+ dwc_otg_hcd_get_b_hnp_enable get_b_hnp_enable; -+}; -+/** @} */ -+ -+/** @name HCD Core API */ -+/** @{ */ -+/** This function allocates dwc_otg_hcd structure and returns pointer on it. */ -+extern dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void); -+ -+/** This function should be called to initiate HCD Core. -+ * -+ * @param hcd The HCD -+ * @param core_if The DWC_OTG Core -+ * -+ * Returns -DWC_E_NO_MEMORY if no enough memory. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if); -+ -+/** Frees HCD -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_remove(dwc_otg_hcd_t * hcd); -+ -+/** This function should be called on every hardware interrupt. -+ * -+ * @param dwc_otg_hcd The HCD -+ * -+ * Returns non zero if interrupt is handled -+ * Return 0 if interrupt is not handled -+ */ -+extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+ -+/** This function is used to handle the fast interrupt -+ * -+ */ -+extern void __attribute__ ((naked)) dwc_otg_hcd_handle_fiq(void); -+ -+/** -+ * Returns private data set by -+ * dwc_otg_hcd_set_priv_data function. -+ * -+ * @param hcd The HCD -+ */ -+extern void *dwc_otg_hcd_get_priv_data(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Set private data. -+ * -+ * @param hcd The HCD -+ * @param priv_data pointer to be stored in private data -+ */ -+extern void dwc_otg_hcd_set_priv_data(dwc_otg_hcd_t * hcd, void *priv_data); -+ -+/** -+ * This function initializes the HCD Core. -+ * -+ * @param hcd The HCD -+ * @param fops The Function Driver Operations data structure containing pointers to all callbacks. -+ * -+ * Returns -DWC_E_NO_DEVICE if Core is currently is in device mode. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_start(dwc_otg_hcd_t * hcd, -+ struct dwc_otg_hcd_function_ops *fops); -+ -+/** -+ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are -+ * stopped. -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_stop(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Handles hub class-specific requests. -+ * -+ * @param dwc_otg_hcd The HCD -+ * @param typeReq Request Type -+ * @param wValue wValue from control request -+ * @param wIndex wIndex from control request -+ * @param buf data buffer -+ * @param wLength data buffer length -+ * -+ * Returns -DWC_E_INVALID if invalid argument is passed -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_hub_control(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint16_t typeReq, uint16_t wValue, -+ uint16_t wIndex, uint8_t * buf, -+ uint16_t wLength); -+ -+/** -+ * Returns otg port number. -+ * -+ * @param hcd The HCD -+ */ -+extern uint32_t dwc_otg_hcd_otg_port(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Returns OTG version - either 1.3 or 2.0. -+ * -+ * @param core_if The core_if structure pointer -+ */ -+extern uint16_t dwc_otg_get_otg_version(dwc_otg_core_if_t * core_if); -+ -+/** -+ * Returns 1 if currently core is acting as B host, and 0 otherwise. -+ * -+ * @param hcd The HCD -+ */ -+extern uint32_t dwc_otg_hcd_is_b_host(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Returns current frame number. -+ * -+ * @param hcd The HCD -+ */ -+extern int dwc_otg_hcd_get_frame_number(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Dumps hcd state. -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_dump_state(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Dump the average frame remaining at SOF. This can be used to -+ * determine average interrupt latency. Frame remaining is also shown for -+ * start transfer and two additional sample points. -+ * Currently this function is not implemented. -+ * -+ * @param hcd The HCD -+ */ -+extern void dwc_otg_hcd_dump_frrem(dwc_otg_hcd_t * hcd); -+ -+/** -+ * Sends LPM transaction to the local device. -+ * -+ * @param hcd The HCD -+ * @param devaddr Device Address -+ * @param hird Host initiated resume duration -+ * @param bRemoteWake Value of bRemoteWake field in LPM transaction -+ * -+ * Returns negative value if sending LPM transaction was not succeeded. -+ * Returns 0 on success. -+ */ -+extern int dwc_otg_hcd_send_lpm(dwc_otg_hcd_t * hcd, uint8_t devaddr, -+ uint8_t hird, uint8_t bRemoteWake); -+ -+/* URB interface */ -+ -+/** -+ * Allocates memory for dwc_otg_hcd_urb structure. -+ * Allocated memory should be freed by call of DWC_FREE. -+ * -+ * @param hcd The HCD -+ * @param iso_desc_count Count of ISOC descriptors -+ * @param atomic_alloc Specefies whether to perform atomic allocation. -+ */ -+extern dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd, -+ int iso_desc_count, -+ int atomic_alloc); -+ -+/** -+ * Set pipe information in URB. -+ * -+ * @param hcd_urb DWC_OTG URB -+ * @param devaddr Device Address -+ * @param ep_num Endpoint Number -+ * @param ep_type Endpoint Type -+ * @param ep_dir Endpoint Direction -+ * @param mps Max Packet Size -+ */ -+extern void dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_hcd_urb_t * hcd_urb, -+ uint8_t devaddr, uint8_t ep_num, -+ uint8_t ep_type, uint8_t ep_dir, -+ uint16_t mps); -+ -+/* Transfer flags */ -+#define URB_GIVEBACK_ASAP 0x1 -+#define URB_SEND_ZERO_PACKET 0x2 -+ -+/** -+ * Sets dwc_otg_hcd_urb parameters. -+ * -+ * @param urb DWC_OTG URB allocated by dwc_otg_hcd_urb_alloc function. -+ * @param urb_handle Unique handle for request, this will be passed back -+ * to function driver in completion callback. -+ * @param buf The buffer for the data -+ * @param dma The DMA buffer for the data -+ * @param buflen Transfer length -+ * @param sp Buffer for setup data -+ * @param sp_dma DMA address of setup data buffer -+ * @param flags Transfer flags -+ * @param interval Polling interval for interrupt or isochronous transfers. -+ */ -+extern void dwc_otg_hcd_urb_set_params(dwc_otg_hcd_urb_t * urb, -+ void *urb_handle, void *buf, -+ dwc_dma_t dma, uint32_t buflen, void *sp, -+ dwc_dma_t sp_dma, uint32_t flags, -+ uint16_t interval); -+ -+/** Gets status from dwc_otg_hcd_urb -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_status(dwc_otg_hcd_urb_t * dwc_otg_urb); -+ -+/** Gets actual length from dwc_otg_hcd_urb -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_actual_length(dwc_otg_hcd_urb_t * -+ dwc_otg_urb); -+ -+/** Gets error count from dwc_otg_hcd_urb. Only for ISOC URBs -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_error_count(dwc_otg_hcd_urb_t * -+ dwc_otg_urb); -+ -+/** Set ISOC descriptor offset and length -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param desc_num ISOC descriptor number -+ * @param offset Offset from beginig of buffer. -+ * @param length Transaction length -+ */ -+extern void dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_hcd_urb_t * dwc_otg_urb, -+ int desc_num, uint32_t offset, -+ uint32_t length); -+ -+/** Get status of ISOC descriptor, specified by desc_num -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param desc_num ISOC descriptor number -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_hcd_urb_t * -+ dwc_otg_urb, int desc_num); -+ -+/** Get actual length of ISOC descriptor, specified by desc_num -+ * -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param desc_num ISOC descriptor number -+ */ -+extern uint32_t dwc_otg_hcd_urb_get_iso_desc_actual_length(dwc_otg_hcd_urb_t * -+ dwc_otg_urb, -+ int desc_num); -+ -+/** Queue URB. After transfer is completes, the complete callback will be called with the URB status -+ * -+ * @param dwc_otg_hcd The HCD -+ * @param dwc_otg_urb DWC_OTG URB -+ * @param ep_handle Out parameter for returning endpoint handle -+ * @param atomic_alloc Flag to do atomic allocation if needed -+ * -+ * Returns -DWC_E_NO_DEVICE if no device is connected. -+ * Returns -DWC_E_NO_MEMORY if there is no enough memory. -+ * Returns 0 on success. -+ */ -+extern int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, -+ void **ep_handle, int atomic_alloc); -+ -+/** De-queue the specified URB -+ * -+ * @param dwc_otg_hcd The HCD -+ * @param dwc_otg_urb DWC_OTG URB -+ */ -+extern int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_hcd_urb_t * dwc_otg_urb); -+ -+/** Frees resources in the DWC_otg controller related to a given endpoint. -+ * Any URBs for the endpoint must already be dequeued. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function -+ * @param retry Number of retries if there are queued transfers. -+ * -+ * Returns -DWC_E_INVALID if invalid arguments are passed. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_endpoint_disable(dwc_otg_hcd_t * hcd, void *ep_handle, -+ int retry); -+ -+/* Resets the data toggle in qh structure. This function can be called from -+ * usb_clear_halt routine. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle, returned by dwc_otg_hcd_urb_enqueue function -+ * -+ * Returns -DWC_E_INVALID if invalid arguments are passed. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle); -+ -+/** Returns 1 if status of specified port is changed and 0 otherwise. -+ * -+ * @param hcd The HCD -+ * @param port Port number -+ */ -+extern int dwc_otg_hcd_is_status_changed(dwc_otg_hcd_t * hcd, int port); -+ -+/** Call this function to check if bandwidth was allocated for specified endpoint. -+ * Only for ISOC and INTERRUPT endpoints. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle -+ */ -+extern int dwc_otg_hcd_is_bandwidth_allocated(dwc_otg_hcd_t * hcd, -+ void *ep_handle); -+ -+/** Call this function to check if bandwidth was freed for specified endpoint. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle -+ */ -+extern int dwc_otg_hcd_is_bandwidth_freed(dwc_otg_hcd_t * hcd, void *ep_handle); -+ -+/** Returns bandwidth allocated for specified endpoint in microseconds. -+ * Only for ISOC and INTERRUPT endpoints. -+ * -+ * @param hcd The HCD -+ * @param ep_handle Endpoint handle -+ */ -+extern uint8_t dwc_otg_hcd_get_ep_bandwidth(dwc_otg_hcd_t * hcd, -+ void *ep_handle); -+ -+/** @} */ -+ -+#endif /* __DWC_HCD_IF_H__ */ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e6b38ac330b72152204c2a6879c20f0ce02ac2e5 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -0,0 +1,2727 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ -+ * $Revision: #89 $ -+ * $Date: 2011/10/20 $ -+ * $Change: 1869487 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+ -+#include -+#include -+ -+ -+extern bool microframe_schedule; -+ -+/** @file -+ * This file contains the implementation of the HCD Interrupt handlers. -+ */ -+ -+int fiq_done, int_done; -+ -+#ifdef FIQ_DEBUG -+char buffer[1000*16]; -+int wptr; -+void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...) -+{ -+ FIQDBG_T dbg_lvl_req = FIQDBG_PORTHUB; -+ va_list args; -+ char text[17]; -+ hfnum_data_t hfnum = { .d32 = FIQ_READ(dwc_regs_base + 0x408) }; -+ -+ if(dbg_lvl & dbg_lvl_req || dbg_lvl == FIQDBG_ERR) -+ { -+ local_fiq_disable(); -+ snprintf(text, 9, "%4d%d:%d ", hfnum.b.frnum/8, hfnum.b.frnum%8, 8 - hfnum.b.frrem/937); -+ va_start(args, fmt); -+ vsnprintf(text+8, 9, fmt, args); -+ va_end(args); -+ -+ memcpy(buffer + wptr, text, 16); -+ wptr = (wptr + 16) % sizeof(buffer); -+ local_fiq_enable(); -+ } -+} -+#endif -+ -+/** This function handles interrupts for the HCD. */ -+int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ int retval = 0; -+ static int last_time; -+ dwc_otg_core_if_t *core_if = dwc_otg_hcd->core_if; -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk; -+ hfnum_data_t hfnum; -+ haintmsk_data_t haintmsk; -+ -+#ifdef DEBUG -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ -+#endif -+ -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ -+ /* Exit from ISR if core is hibernated */ -+ if (core_if->hibernation_suspend == 1) { -+ goto exit_handler_routine; -+ } -+ DWC_SPINLOCK(dwc_otg_hcd->lock); -+ /* Check if HOST Mode */ -+ if (dwc_otg_is_host_mode(core_if)) { -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ /* Pull in from the FIQ's disabled mask */ -+ gintmsk.d32 = gintmsk.d32 | ~(dwc_otg_hcd->fiq_state->gintmsk_saved.d32); -+ dwc_otg_hcd->fiq_state->gintmsk_saved.d32 = ~0; -+ } -+ -+ if (fiq_fsm_enable && ( 0x0000FFFF & ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint))) { -+ gintsts.b.hcintr = 1; -+ } -+ -+ /* Danger will robinson: fake a SOF if necessary */ -+ if (fiq_fsm_enable && (dwc_otg_hcd->fiq_state->gintmsk_saved.b.sofintr == 1)) { -+ gintsts.b.sofintr = 1; -+ } -+ gintsts.d32 &= gintmsk.d32; -+ -+ if (fiq_enable) { -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } -+ -+ if (!gintsts.d32) { -+ goto exit_handler_routine; -+ } -+ -+#ifdef DEBUG -+ // We should be OK doing this because the common interrupts should already have been serviced -+ /* Don't print debug message in the interrupt handler on SOF */ -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ DWC_DEBUGPL(DBG_HCDI, "\n"); -+#endif -+ -+#ifdef DEBUG -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ DWC_DEBUGPL(DBG_HCDI, -+ "DWC OTG HCD Interrupt Detected gintsts&gintmsk=0x%08x core_if=%p\n", -+ gintsts.d32, core_if); -+#endif -+ hfnum.d32 = DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs->hfnum); -+ if (gintsts.b.sofintr) { -+ retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd); -+ } -+ -+ if (gintsts.b.rxstsqlvl) { -+ retval |= -+ dwc_otg_hcd_handle_rx_status_q_level_intr -+ (dwc_otg_hcd); -+ } -+ if (gintsts.b.nptxfempty) { -+ retval |= -+ dwc_otg_hcd_handle_np_tx_fifo_empty_intr -+ (dwc_otg_hcd); -+ } -+ if (gintsts.b.i2cintr) { -+ /** @todo Implement i2cintr handler. */ -+ } -+ if (gintsts.b.portintr) { -+ -+ gintmsk_data_t gintmsk = { .b.portintr = 1}; -+ retval |= dwc_otg_hcd_handle_port_intr(dwc_otg_hcd); -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&dwc_otg_hcd->core_if->core_global_regs->gintmsk, 0, gintmsk.d32); -+ } -+ } -+ if (gintsts.b.hcintr) { -+ retval |= dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd); -+ } -+ if (gintsts.b.ptxfempty) { -+ retval |= -+ dwc_otg_hcd_handle_perio_tx_fifo_empty_intr -+ (dwc_otg_hcd); -+ } -+#ifdef DEBUG -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ { -+ DWC_DEBUGPL(DBG_HCDI, -+ "DWC OTG HCD Finished Servicing Interrupts\n"); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintsts=0x%08x\n", -+ DWC_READ_REG32(&global_regs->gintsts)); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD gintmsk=0x%08x\n", -+ DWC_READ_REG32(&global_regs->gintmsk)); -+ } -+#endif -+ -+#ifdef DEBUG -+#ifndef DEBUG_SOF -+ if (gintsts.d32 != DWC_SOF_INTR_MASK) -+#endif -+ DWC_DEBUGPL(DBG_HCDI, "\n"); -+#endif -+ -+ } -+ -+exit_handler_routine: -+ if (fiq_enable) { -+ gintmsk_data_t gintmsk_new; -+ haintmsk_data_t haintmsk_new; -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ gintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->gintmsk_saved.d32; -+ if(fiq_fsm_enable) -+ haintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->haintmsk_saved.d32; -+ else -+ haintmsk_new.d32 = 0x0000FFFF; -+ -+ /* The FIQ could have sneaked another interrupt in. If so, don't clear MPHI */ -+ if ((gintmsk_new.d32 == ~0) && (haintmsk_new.d32 == 0x0000FFFF)) { -+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.intstat, (1<<16)); -+ if (dwc_otg_hcd->fiq_state->mphi_int_count >= 50) { -+ fiq_print(FIQDBG_INT, dwc_otg_hcd->fiq_state, "MPHI CLR"); -+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, ((1<<31) + (1<<16))); -+ while (!(DWC_READ_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & (1 << 17))) -+ ; -+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.ctrl, (1<<31)); -+ dwc_otg_hcd->fiq_state->mphi_int_count = 0; -+ } -+ int_done++; -+ } -+ haintmsk.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk); -+ /* Re-enable interrupts that the FIQ masked (first time round) */ -+ FIQ_WRITE(dwc_otg_hcd->fiq_state->dwc_regs_base + GINTMSK, gintmsk.d32); -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ -+ if ((jiffies / HZ) > last_time) { -+ //dwc_otg_qh_t *qh; -+ //dwc_list_link_t *cur; -+ /* Once a second output the fiq and irq numbers, useful for debug */ -+ last_time = jiffies / HZ; -+ // DWC_WARN("np_kick=%d AHC=%d sched_frame=%d cur_frame=%d int_done=%d fiq_done=%d", -+ // dwc_otg_hcd->fiq_state->kick_np_queues, dwc_otg_hcd->available_host_channels, -+ // dwc_otg_hcd->fiq_state->next_sched_frame, hfnum.b.frnum, int_done, dwc_otg_hcd->fiq_state->fiq_done); -+ //printk(KERN_WARNING "Periodic queues:\n"); -+ } -+ } -+ -+ DWC_SPINUNLOCK(dwc_otg_hcd->lock); -+ return retval; -+} -+ -+#ifdef DWC_TRACK_MISSED_SOFS -+ -+#warning Compiling code to track missed SOFs -+#define FRAME_NUM_ARRAY_SIZE 1000 -+/** -+ * This function is for debug only. -+ */ -+static inline void track_missed_sofs(uint16_t curr_frame_number) -+{ -+ static uint16_t frame_num_array[FRAME_NUM_ARRAY_SIZE]; -+ static uint16_t last_frame_num_array[FRAME_NUM_ARRAY_SIZE]; -+ static int frame_num_idx = 0; -+ static uint16_t last_frame_num = DWC_HFNUM_MAX_FRNUM; -+ static int dumped_frame_num_array = 0; -+ -+ if (frame_num_idx < FRAME_NUM_ARRAY_SIZE) { -+ if (((last_frame_num + 1) & DWC_HFNUM_MAX_FRNUM) != -+ curr_frame_number) { -+ frame_num_array[frame_num_idx] = curr_frame_number; -+ last_frame_num_array[frame_num_idx++] = last_frame_num; -+ } -+ } else if (!dumped_frame_num_array) { -+ int i; -+ DWC_PRINTF("Frame Last Frame\n"); -+ DWC_PRINTF("----- ----------\n"); -+ for (i = 0; i < FRAME_NUM_ARRAY_SIZE; i++) { -+ DWC_PRINTF("0x%04x 0x%04x\n", -+ frame_num_array[i], last_frame_num_array[i]); -+ } -+ dumped_frame_num_array = 1; -+ } -+ last_frame_num = curr_frame_number; -+} -+#endif -+ -+/** -+ * Handles the start-of-frame interrupt in host mode. Non-periodic -+ * transactions may be queued to the DWC_otg controller for the current -+ * (micro)frame. Periodic transactions may be queued to the controller for the -+ * next (micro)frame. -+ */ -+int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd) -+{ -+ hfnum_data_t hfnum; -+ gintsts_data_t gintsts = { .d32 = 0 }; -+ dwc_list_link_t *qh_entry; -+ dwc_otg_qh_t *qh; -+ dwc_otg_transaction_type_e tr_type; -+ int did_something = 0; -+ int32_t next_sched_frame = -1; -+ -+ hfnum.d32 = -+ DWC_READ_REG32(&hcd->core_if->host_if->host_global_regs->hfnum); -+ -+#ifdef DEBUG_SOF -+ DWC_DEBUGPL(DBG_HCD, "--Start of Frame Interrupt--\n"); -+#endif -+ hcd->frame_number = hfnum.b.frnum; -+ -+#ifdef DEBUG -+ hcd->frrem_accum += hfnum.b.frrem; -+ hcd->frrem_samples++; -+#endif -+ -+#ifdef DWC_TRACK_MISSED_SOFS -+ track_missed_sofs(hcd->frame_number); -+#endif -+ /* Determine whether any periodic QHs should be executed. */ -+ qh_entry = DWC_LIST_FIRST(&hcd->periodic_sched_inactive); -+ while (qh_entry != &hcd->periodic_sched_inactive) { -+ qh = DWC_LIST_ENTRY(qh_entry, dwc_otg_qh_t, qh_list_entry); -+ qh_entry = qh_entry->next; -+ if (dwc_frame_num_le(qh->sched_frame, hcd->frame_number)) { -+ -+ /* -+ * Move QH to the ready list to be executed next -+ * (micro)frame. -+ */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, -+ &qh->qh_list_entry); -+ -+ did_something = 1; -+ } -+ else -+ { -+ if(next_sched_frame < 0 || dwc_frame_num_le(qh->sched_frame, next_sched_frame)) -+ { -+ next_sched_frame = qh->sched_frame; -+ } -+ } -+ } -+ if (fiq_enable) -+ hcd->fiq_state->next_sched_frame = next_sched_frame; -+ -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE) { -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ did_something = 1; -+ } -+ -+ /* Clear interrupt - but do not trample on the FIQ sof */ -+ if (!fiq_fsm_enable) { -+ gintsts.b.sofintr = 1; -+ DWC_WRITE_REG32(&hcd->core_if->core_global_regs->gintsts, gintsts.d32); -+ } -+ return 1; -+} -+ -+/** Handles the Rx Status Queue Level Interrupt, which indicates that there is at -+ * least one packet in the Rx FIFO. The packets are moved from the FIFO to -+ * memory if the DWC_otg controller is operating in Slave mode. */ -+int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ host_grxsts_data_t grxsts; -+ dwc_hc_t *hc = NULL; -+ -+ DWC_DEBUGPL(DBG_HCD, "--RxStsQ Level Interrupt--\n"); -+ -+ grxsts.d32 = -+ DWC_READ_REG32(&dwc_otg_hcd->core_if->core_global_regs->grxstsp); -+ -+ hc = dwc_otg_hcd->hc_ptr_array[grxsts.b.chnum]; -+ if (!hc) { -+ DWC_ERROR("Unable to get corresponding channel\n"); -+ return 0; -+ } -+ -+ /* Packet Status */ -+ DWC_DEBUGPL(DBG_HCDV, " Ch num = %d\n", grxsts.b.chnum); -+ DWC_DEBUGPL(DBG_HCDV, " Count = %d\n", grxsts.b.bcnt); -+ DWC_DEBUGPL(DBG_HCDV, " DPID = %d, hc.dpid = %d\n", grxsts.b.dpid, -+ hc->data_pid_start); -+ DWC_DEBUGPL(DBG_HCDV, " PStatus = %d\n", grxsts.b.pktsts); -+ -+ switch (grxsts.b.pktsts) { -+ case DWC_GRXSTS_PKTSTS_IN: -+ /* Read the data into the host buffer. */ -+ if (grxsts.b.bcnt > 0) { -+ dwc_otg_read_packet(dwc_otg_hcd->core_if, -+ hc->xfer_buff, grxsts.b.bcnt); -+ -+ /* Update the HC fields for the next packet received. */ -+ hc->xfer_count += grxsts.b.bcnt; -+ hc->xfer_buff += grxsts.b.bcnt; -+ } -+ -+ case DWC_GRXSTS_PKTSTS_IN_XFER_COMP: -+ case DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR: -+ case DWC_GRXSTS_PKTSTS_CH_HALTED: -+ /* Handled in interrupt, just ignore data */ -+ break; -+ default: -+ DWC_ERROR("RX_STS_Q Interrupt: Unknown status %d\n", -+ grxsts.b.pktsts); -+ break; -+ } -+ -+ return 1; -+} -+ -+/** This interrupt occurs when the non-periodic Tx FIFO is half-empty. More -+ * data packets may be written to the FIFO for OUT transfers. More requests -+ * may be written to the non-periodic request queue for IN transfers. This -+ * interrupt is enabled only in Slave mode. */ -+int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ DWC_DEBUGPL(DBG_HCD, "--Non-Periodic TxFIFO Empty Interrupt--\n"); -+ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, -+ DWC_OTG_TRANSACTION_NON_PERIODIC); -+ return 1; -+} -+ -+/** This interrupt occurs when the periodic Tx FIFO is half-empty. More data -+ * packets may be written to the FIFO for OUT transfers. More requests may be -+ * written to the periodic request queue for IN transfers. This interrupt is -+ * enabled only in Slave mode. */ -+int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ DWC_DEBUGPL(DBG_HCD, "--Periodic TxFIFO Empty Interrupt--\n"); -+ dwc_otg_hcd_queue_transactions(dwc_otg_hcd, -+ DWC_OTG_TRANSACTION_PERIODIC); -+ return 1; -+} -+ -+/** There are multiple conditions that can cause a port interrupt. This function -+ * determines which interrupt conditions have occurred and handles them -+ * appropriately. */ -+int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ int retval = 0; -+ hprt0_data_t hprt0; -+ hprt0_data_t hprt0_modify; -+ -+ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ hprt0_modify.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ -+ /* Clear appropriate bits in HPRT0 to clear the interrupt bit in -+ * GINTSTS */ -+ -+ hprt0_modify.b.prtena = 0; -+ hprt0_modify.b.prtconndet = 0; -+ hprt0_modify.b.prtenchng = 0; -+ hprt0_modify.b.prtovrcurrchng = 0; -+ -+ /* Port Connect Detected -+ * Set flag and clear if detected */ -+ if (dwc_otg_hcd->core_if->hibernation_suspend == 1) { -+ // Dont modify port status if we are in hibernation state -+ hprt0_modify.b.prtconndet = 1; -+ hprt0_modify.b.prtenchng = 1; -+ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); -+ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ return retval; -+ } -+ -+ if (hprt0.b.prtconndet) { -+ /** @todo - check if steps performed in 'else' block should be perfromed regardles adp */ -+ if (dwc_otg_hcd->core_if->adp_enable && -+ dwc_otg_hcd->core_if->adp.vbuson_timer_started == 1) { -+ DWC_PRINTF("PORT CONNECT DETECTED ----------------\n"); -+ DWC_TIMER_CANCEL(dwc_otg_hcd->core_if->adp.vbuson_timer); -+ dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; -+ /* TODO - check if this is required, as -+ * host initialization was already performed -+ * after initial ADP probing -+ */ -+ /*dwc_otg_hcd->core_if->adp.vbuson_timer_started = 0; -+ dwc_otg_core_init(dwc_otg_hcd->core_if); -+ dwc_otg_enable_global_interrupts(dwc_otg_hcd->core_if); -+ cil_hcd_start(dwc_otg_hcd->core_if);*/ -+ } else { -+ -+ DWC_DEBUGPL(DBG_HCD, "--Port Interrupt HPRT0=0x%08x " -+ "Port Connect Detected--\n", hprt0.d32); -+ dwc_otg_hcd->flags.b.port_connect_status_change = 1; -+ dwc_otg_hcd->flags.b.port_connect_status = 1; -+ hprt0_modify.b.prtconndet = 1; -+ -+ /* B-Device has connected, Delete the connection timer. */ -+ DWC_TIMER_CANCEL(dwc_otg_hcd->conn_timer); -+ } -+ /* The Hub driver asserts a reset when it sees port connect -+ * status change flag */ -+ retval |= 1; -+ } -+ -+ /* Port Enable Changed -+ * Clear if detected - Set internal flag if disabled */ -+ if (hprt0.b.prtenchng) { -+ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " -+ "Port Enable Changed--\n", hprt0.d32); -+ hprt0_modify.b.prtenchng = 1; -+ if (hprt0.b.prtena == 1) { -+ hfir_data_t hfir; -+ int do_reset = 0; -+ dwc_otg_core_params_t *params = -+ dwc_otg_hcd->core_if->core_params; -+ dwc_otg_core_global_regs_t *global_regs = -+ dwc_otg_hcd->core_if->core_global_regs; -+ dwc_otg_host_if_t *host_if = -+ dwc_otg_hcd->core_if->host_if; -+ -+ /* Every time when port enables calculate -+ * HFIR.FrInterval -+ */ -+ hfir.d32 = DWC_READ_REG32(&host_if->host_global_regs->hfir); -+ hfir.b.frint = calc_frame_interval(dwc_otg_hcd->core_if); -+ DWC_WRITE_REG32(&host_if->host_global_regs->hfir, hfir.d32); -+ -+ /* Check if we need to adjust the PHY clock speed for -+ * low power and adjust it */ -+ if (params->host_support_fs_ls_low_power) { -+ gusbcfg_data_t usbcfg; -+ -+ usbcfg.d32 = -+ DWC_READ_REG32(&global_regs->gusbcfg); -+ -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_LOW_SPEED -+ || hprt0.b.prtspd == -+ DWC_HPRT0_PRTSPD_FULL_SPEED) { -+ /* -+ * Low power -+ */ -+ hcfg_data_t hcfg; -+ if (usbcfg.b.phylpwrclksel == 0) { -+ /* Set PHY low power clock select for FS/LS devices */ -+ usbcfg.b.phylpwrclksel = 1; -+ DWC_WRITE_REG32 -+ (&global_regs->gusbcfg, -+ usbcfg.d32); -+ do_reset = 1; -+ } -+ -+ hcfg.d32 = -+ DWC_READ_REG32 -+ (&host_if->host_global_regs->hcfg); -+ -+ if (hprt0.b.prtspd == -+ DWC_HPRT0_PRTSPD_LOW_SPEED -+ && params->host_ls_low_power_phy_clk -+ == -+ DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ) -+ { -+ /* 6 MHZ */ -+ DWC_DEBUGPL(DBG_CIL, -+ "FS_PHY programming HCFG to 6 MHz (Low Power)\n"); -+ if (hcfg.b.fslspclksel != -+ DWC_HCFG_6_MHZ) { -+ hcfg.b.fslspclksel = -+ DWC_HCFG_6_MHZ; -+ DWC_WRITE_REG32 -+ (&host_if->host_global_regs->hcfg, -+ hcfg.d32); -+ do_reset = 1; -+ } -+ } else { -+ /* 48 MHZ */ -+ DWC_DEBUGPL(DBG_CIL, -+ "FS_PHY programming HCFG to 48 MHz ()\n"); -+ if (hcfg.b.fslspclksel != -+ DWC_HCFG_48_MHZ) { -+ hcfg.b.fslspclksel = -+ DWC_HCFG_48_MHZ; -+ DWC_WRITE_REG32 -+ (&host_if->host_global_regs->hcfg, -+ hcfg.d32); -+ do_reset = 1; -+ } -+ } -+ } else { -+ /* -+ * Not low power -+ */ -+ if (usbcfg.b.phylpwrclksel == 1) { -+ usbcfg.b.phylpwrclksel = 0; -+ DWC_WRITE_REG32 -+ (&global_regs->gusbcfg, -+ usbcfg.d32); -+ do_reset = 1; -+ } -+ } -+ -+ if (do_reset) { -+ DWC_TASK_SCHEDULE(dwc_otg_hcd->reset_tasklet); -+ } -+ } -+ -+ if (!do_reset) { -+ /* Port has been enabled set the reset change flag */ -+ dwc_otg_hcd->flags.b.port_reset_change = 1; -+ } -+ } else { -+ dwc_otg_hcd->flags.b.port_enable_change = 1; -+ } -+ retval |= 1; -+ } -+ -+ /** Overcurrent Change Interrupt */ -+ if (hprt0.b.prtovrcurrchng) { -+ DWC_DEBUGPL(DBG_HCD, " --Port Interrupt HPRT0=0x%08x " -+ "Port Overcurrent Changed--\n", hprt0.d32); -+ dwc_otg_hcd->flags.b.port_over_current_change = 1; -+ hprt0_modify.b.prtovrcurrchng = 1; -+ retval |= 1; -+ } -+ -+ /* Clear Port Interrupts */ -+ DWC_WRITE_REG32(dwc_otg_hcd->core_if->host_if->hprt0, hprt0_modify.d32); -+ -+ return retval; -+} -+ -+/** This interrupt indicates that one or more host channels has a pending -+ * interrupt. There are multiple conditions that can cause each host channel -+ * interrupt. This function determines which conditions have occurred for each -+ * host channel interrupt and handles them appropriately. */ -+int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ int i; -+ int retval = 0; -+ haint_data_t haint = { .d32 = 0 } ; -+ -+ /* Clear appropriate bits in HCINTn to clear the interrupt bit in -+ * GINTSTS */ -+ -+ if (!fiq_fsm_enable) -+ haint.d32 = dwc_otg_read_host_all_channels_intr(dwc_otg_hcd->core_if); -+ -+ // Overwrite with saved interrupts from fiq handler -+ if(fiq_fsm_enable) -+ { -+ /* check the mask? */ -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&dwc_otg_hcd->fiq_state->lock); -+ haint.b2.chint |= ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint); -+ dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint = ~0; -+ fiq_fsm_spin_unlock(&dwc_otg_hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } -+ -+ for (i = 0; i < dwc_otg_hcd->core_if->core_params->host_channels; i++) { -+ if (haint.b2.chint & (1 << i)) { -+ retval |= dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd, i); -+ } -+ } -+ -+ return retval; -+} -+ -+/** -+ * Gets the actual length of a transfer after the transfer halts. _halt_status -+ * holds the reason for the halt. -+ * -+ * For IN transfers where halt_status is DWC_OTG_HC_XFER_COMPLETE, -+ * *short_read is set to 1 upon return if less than the requested -+ * number of bytes were transferred. Otherwise, *short_read is set to 0 upon -+ * return. short_read may also be NULL on entry, in which case it remains -+ * unchanged. -+ */ -+static uint32_t get_actual_xfer_length(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status, -+ int *short_read) -+{ -+ hctsiz_data_t hctsiz; -+ uint32_t length; -+ -+ if (short_read != NULL) { -+ *short_read = 0; -+ } -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ -+ if (halt_status == DWC_OTG_HC_XFER_COMPLETE) { -+ if (hc->ep_is_in) { -+ length = hc->xfer_len - hctsiz.b.xfersize; -+ if (short_read != NULL) { -+ *short_read = (hctsiz.b.xfersize != 0); -+ } -+ } else if (hc->qh->do_split) { -+ //length = split_out_xfersize[hc->hc_num]; -+ length = qtd->ssplit_out_xfer_count; -+ } else { -+ length = hc->xfer_len; -+ } -+ } else { -+ /* -+ * Must use the hctsiz.pktcnt field to determine how much data -+ * has been transferred. This field reflects the number of -+ * packets that have been transferred via the USB. This is -+ * always an integral number of packets if the transfer was -+ * halted before its normal completion. (Can't use the -+ * hctsiz.xfersize field because that reflects the number of -+ * bytes transferred via the AHB, not the USB). -+ */ -+ length = -+ (hc->start_pkt_count - hctsiz.b.pktcnt) * hc->max_packet; -+ } -+ -+ return length; -+} -+ -+/** -+ * Updates the state of the URB after a Transfer Complete interrupt on the -+ * host channel. Updates the actual_length field of the URB based on the -+ * number of bytes transferred via the host channel. Sets the URB status -+ * if the data transfer is finished. -+ * -+ * @return 1 if the data transfer specified by the URB is completely finished, -+ * 0 otherwise. -+ */ -+static int update_urb_state_xfer_comp(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_hcd_urb_t * urb, -+ dwc_otg_qtd_t * qtd) -+{ -+ int xfer_done = 0; -+ int short_read = 0; -+ -+ int xfer_length; -+ -+ xfer_length = get_actual_xfer_length(hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_COMPLETE, -+ &short_read); -+ -+ if (urb->actual_length + xfer_length > urb->length) { -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); -+ xfer_length = urb->length - urb->actual_length; -+ } -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && xfer_length && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -+ xfer_length); -+ } -+ -+ urb->actual_length += xfer_length; -+ -+ if (xfer_length && (hc->ep_type == DWC_OTG_EP_TYPE_BULK) && -+ (urb->flags & URB_SEND_ZERO_PACKET) -+ && (urb->actual_length == urb->length) -+ && !(urb->length % hc->max_packet)) { -+ xfer_done = 0; -+ } else if (short_read || urb->actual_length >= urb->length) { -+ xfer_done = 1; -+ urb->status = 0; -+ } -+ -+#ifdef DEBUG -+ { -+ hctsiz_data_t hctsiz; -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", -+ __func__, (hc->ep_is_in ? "IN" : "OUT"), -+ hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " hc->xfer_len %d\n", hc->xfer_len); -+ DWC_DEBUGPL(DBG_HCDV, " hctsiz.xfersize %d\n", -+ hctsiz.b.xfersize); -+ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", -+ urb->length); -+ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", -+ urb->actual_length); -+ DWC_DEBUGPL(DBG_HCDV, " short_read %d, xfer_done %d\n", -+ short_read, xfer_done); -+ } -+#endif -+ -+ return xfer_done; -+} -+ -+/* -+ * Save the starting data toggle for the next transfer. The data toggle is -+ * saved in the QH for non-control transfers and it's saved in the QTD for -+ * control transfers. -+ */ -+void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, dwc_otg_qtd_t * qtd) -+{ -+ hctsiz_data_t hctsiz; -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ -+ if (hc->ep_type != DWC_OTG_EP_TYPE_CONTROL) { -+ dwc_otg_qh_t *qh = hc->qh; -+ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ } else { -+ qh->data_toggle = DWC_OTG_HC_PID_DATA1; -+ } -+ } else { -+ if (hctsiz.b.pid == DWC_HCTSIZ_DATA0) { -+ qtd->data_toggle = DWC_OTG_HC_PID_DATA0; -+ } else { -+ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; -+ } -+ } -+} -+ -+/** -+ * Updates the state of an Isochronous URB when the transfer is stopped for -+ * any reason. The fields of the current entry in the frame descriptor array -+ * are set based on the transfer state and the input _halt_status. Completes -+ * the Isochronous URB if all the URB frames have been completed. -+ * -+ * @return DWC_OTG_HC_XFER_COMPLETE if there are more frames remaining to be -+ * transferred in the URB. Otherwise return DWC_OTG_HC_XFER_URB_COMPLETE. -+ */ -+static dwc_otg_halt_status_e -+update_isoc_urb_state(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) -+{ -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ dwc_otg_halt_status_e ret_val = halt_status; -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ -+ frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; -+ switch (halt_status) { -+ case DWC_OTG_HC_XFER_COMPLETE: -+ frame_desc->status = 0; -+ frame_desc->actual_length = -+ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, -+ hc->qh->dw_align_buf, frame_desc->actual_length); -+ } -+ -+ break; -+ case DWC_OTG_HC_XFER_FRAME_OVERRUN: -+ urb->error_count++; -+ if (hc->ep_is_in) { -+ frame_desc->status = -DWC_E_NO_STREAM_RES; -+ } else { -+ frame_desc->status = -DWC_E_COMMUNICATION; -+ } -+ frame_desc->actual_length = 0; -+ break; -+ case DWC_OTG_HC_XFER_BABBLE_ERR: -+ urb->error_count++; -+ frame_desc->status = -DWC_E_OVERFLOW; -+ /* Don't need to update actual_length in this case. */ -+ break; -+ case DWC_OTG_HC_XFER_XACT_ERR: -+ urb->error_count++; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ frame_desc->actual_length = -+ get_actual_xfer_length(hc, hc_regs, qtd, halt_status, NULL); -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && frame_desc->actual_length && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, -+ hc->qh->dw_align_buf, frame_desc->actual_length); -+ } -+ /* Skip whole frame */ -+ if (hc->qh->do_split && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && -+ hc->ep_is_in && hcd->core_if->dma_enable) { -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ } -+ -+ break; -+ default: -+ DWC_ASSERT(1, "Unhandled _halt_status (%d)\n", halt_status); -+ break; -+ } -+ if (++qtd->isoc_frame_index == urb->packet_count) { -+ /* -+ * urb->status is not used for isoc transfers. -+ * The individual frame_desc statuses are used instead. -+ */ -+ hcd->fops->complete(hcd, urb->priv, urb, 0); -+ ret_val = DWC_OTG_HC_XFER_URB_COMPLETE; -+ } else { -+ ret_val = DWC_OTG_HC_XFER_COMPLETE; -+ } -+ return ret_val; -+} -+ -+/** -+ * Frees the first QTD in the QH's list if free_qtd is 1. For non-periodic -+ * QHs, removes the QH from the active non-periodic schedule. If any QTDs are -+ * still linked to the QH, the QH is added to the end of the inactive -+ * non-periodic schedule. For periodic QHs, removes the QH from the periodic -+ * schedule if no more QTDs are linked to the QH. -+ */ -+static void deactivate_qh(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, int free_qtd) -+{ -+ int continue_split = 0; -+ dwc_otg_qtd_t *qtd; -+ -+ DWC_DEBUGPL(DBG_HCDV, " %s(%p,%p,%d)\n", __func__, hcd, qh, free_qtd); -+ -+ qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); -+ -+ if (qtd->complete_split) { -+ continue_split = 1; -+ } else if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_MID || -+ qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_END) { -+ continue_split = 1; -+ } -+ -+ if (free_qtd) { -+ dwc_otg_hcd_qtd_remove_and_free(hcd, qtd, qh); -+ continue_split = 0; -+ } -+ -+ qh->channel = NULL; -+ dwc_otg_hcd_qh_deactivate(hcd, qh, continue_split); -+} -+ -+/** -+ * Releases a host channel for use by other transfers. Attempts to select and -+ * queue more transactions since at least one host channel is available. -+ * -+ * @param hcd The HCD state structure. -+ * @param hc The host channel to release. -+ * @param qtd The QTD associated with the host channel. This QTD may be freed -+ * if the transfer is complete or an error has occurred. -+ * @param halt_status Reason the channel is being released. This status -+ * determines the actions taken by this function. -+ */ -+static void release_channel(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ dwc_otg_transaction_type_e tr_type; -+ int free_qtd; -+ dwc_irqflags_t flags; -+ dwc_spinlock_t *channel_lock = hcd->channel_lock; -+ -+ int hog_port = 0; -+ -+ DWC_DEBUGPL(DBG_HCDV, " %s: channel %d, halt_status %d, xfer_len %d\n", -+ __func__, hc->hc_num, halt_status, hc->xfer_len); -+ -+ if(fiq_fsm_enable && hc->do_split) { -+ if(!hc->ep_is_in && hc->ep_type == UE_ISOCHRONOUS) { -+ if(hc->xact_pos == DWC_HCSPLIT_XACTPOS_MID || -+ hc->xact_pos == DWC_HCSPLIT_XACTPOS_BEGIN) { -+ hog_port = 0; -+ } -+ } -+ } -+ -+ switch (halt_status) { -+ case DWC_OTG_HC_XFER_URB_COMPLETE: -+ free_qtd = 1; -+ break; -+ case DWC_OTG_HC_XFER_AHB_ERR: -+ case DWC_OTG_HC_XFER_STALL: -+ case DWC_OTG_HC_XFER_BABBLE_ERR: -+ free_qtd = 1; -+ break; -+ case DWC_OTG_HC_XFER_XACT_ERR: -+ if (qtd->error_count >= 3) { -+ DWC_DEBUGPL(DBG_HCDV, -+ " Complete URB with transaction error\n"); -+ free_qtd = 1; -+ qtd->urb->status = -DWC_E_PROTOCOL; -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_PROTOCOL); -+ } else { -+ free_qtd = 0; -+ } -+ break; -+ case DWC_OTG_HC_XFER_URB_DEQUEUE: -+ /* -+ * The QTD has already been removed and the QH has been -+ * deactivated. Don't want to do anything except release the -+ * host channel and try to queue more transfers. -+ */ -+ goto cleanup; -+ case DWC_OTG_HC_XFER_NO_HALT_STATUS: -+ free_qtd = 0; -+ break; -+ case DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE: -+ DWC_DEBUGPL(DBG_HCDV, -+ " Complete URB with I/O error\n"); -+ free_qtd = 1; -+ qtd->urb->status = -DWC_E_IO; -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_IO); -+ break; -+ default: -+ free_qtd = 0; -+ break; -+ } -+ -+ deactivate_qh(hcd, hc->qh, free_qtd); -+ -+cleanup: -+ /* -+ * Release the host channel for use by other transfers. The cleanup -+ * function clears the channel interrupt enables and conditions, so -+ * there's no need to clear the Channel Halted interrupt separately. -+ */ -+ if (fiq_fsm_enable && hcd->fiq_state->channel[hc->hc_num].fsm != FIQ_PASSTHROUGH) -+ dwc_otg_cleanup_fiq_channel(hcd, hc->hc_num); -+ dwc_otg_hc_cleanup(hcd->core_if, hc); -+ DWC_CIRCLEQ_INSERT_TAIL(&hcd->free_hc_list, hc, hc_list_entry); -+ -+ if (!microframe_schedule) { -+ switch (hc->ep_type) { -+ case DWC_OTG_EP_TYPE_CONTROL: -+ case DWC_OTG_EP_TYPE_BULK: -+ hcd->non_periodic_channels--; -+ break; -+ -+ default: -+ /* -+ * Don't release reservations for periodic channels here. -+ * That's done when a periodic transfer is descheduled (i.e. -+ * when the QH is removed from the periodic schedule). -+ */ -+ break; -+ } -+ } else { -+ -+ DWC_SPINLOCK_IRQSAVE(channel_lock, &flags); -+ hcd->available_host_channels++; -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "AHC = %d ", hcd->available_host_channels); -+ DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags); -+ } -+ -+ /* Try to queue more transfers now that there's a free channel. */ -+ tr_type = dwc_otg_hcd_select_transactions(hcd); -+ if (tr_type != DWC_OTG_TRANSACTION_NONE) { -+ dwc_otg_hcd_queue_transactions(hcd, tr_type); -+ } -+} -+ -+/** -+ * Halts a host channel. If the channel cannot be halted immediately because -+ * the request queue is full, this function ensures that the FIFO empty -+ * interrupt for the appropriate queue is enabled so that the halt request can -+ * be queued when there is space in the request queue. -+ * -+ * This function may also be called in DMA mode. In that case, the channel is -+ * simply released since the core always halts the channel automatically in -+ * DMA mode. -+ */ -+static void halt_channel(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_qtd_t * qtd, dwc_otg_halt_status_e halt_status) -+{ -+ if (hcd->core_if->dma_enable) { -+ release_channel(hcd, hc, qtd, halt_status); -+ return; -+ } -+ -+ /* Slave mode processing... */ -+ dwc_otg_hc_halt(hcd->core_if, hc, halt_status); -+ -+ if (hc->halt_on_queue) { -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ dwc_otg_core_global_regs_t *global_regs; -+ global_regs = hcd->core_if->core_global_regs; -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || -+ hc->ep_type == DWC_OTG_EP_TYPE_BULK) { -+ /* -+ * Make sure the Non-periodic Tx FIFO empty interrupt -+ * is enabled so that the non-periodic schedule will -+ * be processed. -+ */ -+ gintmsk.b.nptxfempty = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ } -+ } else { -+ /* -+ * Move the QH from the periodic queued schedule to -+ * the periodic assigned schedule. This allows the -+ * halt to be queued when the periodic schedule is -+ * processed. -+ */ -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_assigned, -+ &hc->qh->qh_list_entry); -+ -+ /* -+ * Make sure the Periodic Tx FIFO Empty interrupt is -+ * enabled so that the periodic schedule will be -+ * processed. -+ */ -+ gintmsk.b.ptxfempty = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmsk.d32); -+ } -+ } -+ } -+} -+ -+/** -+ * Performs common cleanup for non-periodic transfers after a Transfer -+ * Complete interrupt. This function should be called after any endpoint type -+ * specific handling is finished to release the host channel. -+ */ -+static void complete_non_periodic_xfer(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ hcint_data_t hcint; -+ -+ qtd->error_count = 0; -+ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ if (hcint.b.nyet) { -+ /* -+ * Got a NYET on the last transaction of the transfer. This -+ * means that the endpoint should be in the PING state at the -+ * beginning of the next transfer. -+ */ -+ hc->qh->ping_state = 1; -+ clear_hc_int(hc_regs, nyet); -+ } -+ -+ /* -+ * Always halt and release the host channel to make it available for -+ * more transfers. There may still be more phases for a control -+ * transfer or more data packets for a bulk transfer at this point, -+ * but the host channel is still halted. A channel will be reassigned -+ * to the transfer when the non-periodic schedule is processed after -+ * the channel is released. This allows transactions to be queued -+ * properly via dwc_otg_hcd_queue_transactions, which also enables the -+ * Tx FIFO Empty interrupt if necessary. -+ */ -+ if (hc->ep_is_in) { -+ /* -+ * IN transfers in Slave mode require an explicit disable to -+ * halt the channel. (In DMA mode, this call simply releases -+ * the channel.) -+ */ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } else { -+ /* -+ * The channel is automatically disabled by the core for OUT -+ * transfers in Slave mode. -+ */ -+ release_channel(hcd, hc, qtd, halt_status); -+ } -+} -+ -+/** -+ * Performs common cleanup for periodic transfers after a Transfer Complete -+ * interrupt. This function should be called after any endpoint type specific -+ * handling is finished to release the host channel. -+ */ -+static void complete_periodic_xfer(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ hctsiz_data_t hctsiz; -+ qtd->error_count = 0; -+ -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ if (!hc->ep_is_in || hctsiz.b.pktcnt == 0) { -+ /* Core halts channel in these cases. */ -+ release_channel(hcd, hc, qtd, halt_status); -+ } else { -+ /* Flush any outstanding requests from the Tx queue. */ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+} -+ -+static int32_t handle_xfercomp_isoc_split_in(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ uint32_t len; -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc; -+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ -+ len = get_actual_xfer_length(hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_COMPLETE, NULL); -+ -+ if (!len) { -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ return 0; -+ } -+ frame_desc->actual_length += len; -+ -+ if (hc->align_buff && len) -+ dwc_memcpy(qtd->urb->buf + frame_desc->offset + -+ qtd->isoc_split_offset, hc->qh->dw_align_buf, len); -+ qtd->isoc_split_offset += len; -+ -+ if (frame_desc->length == frame_desc->actual_length) { -+ frame_desc->status = 0; -+ qtd->isoc_frame_index++; -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ } -+ -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ -+ return 1; /* Indicates that channel released */ -+} -+ -+/** -+ * Handles a host channel Transfer Complete interrupt. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_xfercomp_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ int urb_xfer_done; -+ dwc_otg_halt_status_e halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); -+ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Transfer Complete--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, halt_status); -+ if (pipe_type == UE_ISOCHRONOUS) { -+ /* Do not disable the interrupt, just clear it */ -+ clear_hc_int(hc_regs, xfercomp); -+ return 1; -+ } -+ goto handle_xfercomp_done; -+ } -+ -+ /* -+ * Handle xfer complete on CSPLIT. -+ */ -+ -+ if (hc->qh->do_split) { -+ if ((hc->ep_type == DWC_OTG_EP_TYPE_ISOC) && hc->ep_is_in -+ && hcd->core_if->dma_enable) { -+ if (qtd->complete_split -+ && handle_xfercomp_isoc_split_in(hcd, hc, hc_regs, -+ qtd)) -+ goto handle_xfercomp_done; -+ } else { -+ qtd->complete_split = 0; -+ } -+ } -+ -+ /* Update the QTD and URB states. */ -+ switch (pipe_type) { -+ case UE_CONTROL: -+ switch (qtd->control_phase) { -+ case DWC_OTG_CONTROL_SETUP: -+ if (urb->length > 0) { -+ qtd->control_phase = DWC_OTG_CONTROL_DATA; -+ } else { -+ qtd->control_phase = DWC_OTG_CONTROL_STATUS; -+ } -+ DWC_DEBUGPL(DBG_HCDV, -+ " Control setup transaction done\n"); -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ break; -+ case DWC_OTG_CONTROL_DATA:{ -+ urb_xfer_done = -+ update_urb_state_xfer_comp(hc, hc_regs, urb, -+ qtd); -+ if (urb_xfer_done) { -+ qtd->control_phase = -+ DWC_OTG_CONTROL_STATUS; -+ DWC_DEBUGPL(DBG_HCDV, -+ " Control data transfer done\n"); -+ } else { -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ } -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ break; -+ } -+ case DWC_OTG_CONTROL_STATUS: -+ DWC_DEBUGPL(DBG_HCDV, " Control transfer complete\n"); -+ if (urb->status == -DWC_E_IN_PROGRESS) { -+ urb->status = 0; -+ } -+ hcd->fops->complete(hcd, urb->priv, urb, urb->status); -+ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; -+ break; -+ } -+ -+ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ case UE_BULK: -+ DWC_DEBUGPL(DBG_HCDV, " Bulk transfer complete\n"); -+ urb_xfer_done = -+ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); -+ if (urb_xfer_done) { -+ hcd->fops->complete(hcd, urb->priv, urb, urb->status); -+ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; -+ } else { -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ } -+ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ complete_non_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ case UE_INTERRUPT: -+ DWC_DEBUGPL(DBG_HCDV, " Interrupt transfer complete\n"); -+ urb_xfer_done = -+ update_urb_state_xfer_comp(hc, hc_regs, urb, qtd); -+ -+ /* -+ * Interrupt URB is done on the first transfer complete -+ * interrupt. -+ */ -+ if (urb_xfer_done) { -+ hcd->fops->complete(hcd, urb->priv, urb, urb->status); -+ halt_status = DWC_OTG_HC_XFER_URB_COMPLETE; -+ } else { -+ halt_status = DWC_OTG_HC_XFER_COMPLETE; -+ } -+ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ case UE_ISOCHRONOUS: -+ DWC_DEBUGPL(DBG_HCDV, " Isochronous transfer complete\n"); -+ if (qtd->isoc_split_pos == DWC_HCSPLIT_XACTPOS_ALL) { -+ halt_status = -+ update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_COMPLETE); -+ } -+ complete_periodic_xfer(hcd, hc, hc_regs, qtd, halt_status); -+ break; -+ } -+ -+handle_xfercomp_done: -+ disable_hc_int(hc_regs, xfercompl); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel STALL interrupt. This handler may be called in -+ * either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_stall_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ int pipe_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); -+ -+ DWC_DEBUGPL(DBG_HCD, "--Host Channel %d Interrupt: " -+ "STALL Received--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, DWC_OTG_HC_XFER_STALL); -+ goto handle_stall_done; -+ } -+ -+ if (pipe_type == UE_CONTROL) { -+ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); -+ } -+ -+ if (pipe_type == UE_BULK || pipe_type == UE_INTERRUPT) { -+ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_PIPE); -+ /* -+ * USB protocol requires resetting the data toggle for bulk -+ * and interrupt endpoints when a CLEAR_FEATURE(ENDPOINT_HALT) -+ * setup command is issued to the endpoint. Anticipate the -+ * CLEAR_FEATURE command since a STALL has occurred and reset -+ * the data toggle now. -+ */ -+ hc->qh->data_toggle = 0; -+ } -+ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_STALL); -+ -+handle_stall_done: -+ disable_hc_int(hc_regs, stall); -+ -+ return 1; -+} -+ -+/* -+ * Updates the state of the URB when a transfer has been stopped due to an -+ * abnormal condition before the transfer completes. Modifies the -+ * actual_length field of the URB to reflect the number of bytes that have -+ * actually been transferred via the host channel. -+ */ -+static void update_urb_state_xfer_intr(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_hcd_urb_t * urb, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_halt_status_e halt_status) -+{ -+ uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, -+ halt_status, NULL); -+ -+ if (urb->actual_length + bytes_transferred > urb->length) { -+ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", -+ hc->dev_addr, __func__, __LINE__); -+ bytes_transferred = urb->length - urb->actual_length; -+ } -+ -+ /* non DWORD-aligned buffer case handling. */ -+ if (hc->align_buff && bytes_transferred && hc->ep_is_in) { -+ dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, -+ bytes_transferred); -+ } -+ -+ urb->actual_length += bytes_transferred; -+ -+#ifdef DEBUG -+ { -+ hctsiz_data_t hctsiz; -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ DWC_DEBUGPL(DBG_HCDV, "DWC_otg: %s: %s, channel %d\n", -+ __func__, (hc->ep_is_in ? "IN" : "OUT"), -+ hc->hc_num); -+ DWC_DEBUGPL(DBG_HCDV, " hc->start_pkt_count %d\n", -+ hc->start_pkt_count); -+ DWC_DEBUGPL(DBG_HCDV, " hctsiz.pktcnt %d\n", hctsiz.b.pktcnt); -+ DWC_DEBUGPL(DBG_HCDV, " hc->max_packet %d\n", hc->max_packet); -+ DWC_DEBUGPL(DBG_HCDV, " bytes_transferred %d\n", -+ bytes_transferred); -+ DWC_DEBUGPL(DBG_HCDV, " urb->actual_length %d\n", -+ urb->actual_length); -+ DWC_DEBUGPL(DBG_HCDV, " urb->transfer_buffer_length %d\n", -+ urb->length); -+ } -+#endif -+} -+ -+/** -+ * Handles a host channel NAK interrupt. This handler may be called in either -+ * DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_nak_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "NAK Received--\n", hc->hc_num); -+ -+ /* -+ * When we get bulk NAKs then remember this so we holdoff on this qh until -+ * the beginning of the next frame -+ */ -+ switch(dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_BULK: -+ case UE_CONTROL: -+ if (nak_holdoff && qtd->qh->do_split) -+ hc->qh->nak_frame = dwc_otg_hcd_get_frame_number(hcd); -+ } -+ -+ /* -+ * Handle NAK for IN/OUT SSPLIT/CSPLIT transfers, bulk, control, and -+ * interrupt. Re-start the SSPLIT transfer. -+ */ -+ if (hc->do_split) { -+ if (hc->complete_split) { -+ qtd->error_count = 0; -+ } -+ qtd->complete_split = 0; -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); -+ goto handle_nak_done; -+ } -+ -+ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_CONTROL: -+ case UE_BULK: -+ if (hcd->core_if->dma_enable && hc->ep_is_in) { -+ /* -+ * NAK interrupts are enabled on bulk/control IN -+ * transfers in DMA mode for the sole purpose of -+ * resetting the error count after a transaction error -+ * occurs. The core will continue transferring data. -+ * Disable other interrupts unmasked for the same -+ * reason. -+ */ -+ disable_hc_int(hc_regs, datatglerr); -+ disable_hc_int(hc_regs, ack); -+ qtd->error_count = 0; -+ goto handle_nak_done; -+ } -+ -+ /* -+ * NAK interrupts normally occur during OUT transfers in DMA -+ * or Slave mode. For IN transfers, more requests will be -+ * queued as request queue space is available. -+ */ -+ qtd->error_count = 0; -+ -+ if (!hc->qh->ping_state) { -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, -+ DWC_OTG_HC_XFER_NAK); -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ -+ if (hc->speed == DWC_OTG_EP_SPEED_HIGH) -+ hc->qh->ping_state = 1; -+ } -+ -+ /* -+ * Halt the channel so the transfer can be re-started from -+ * the appropriate point or the PING protocol will -+ * start/continue. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); -+ break; -+ case UE_INTERRUPT: -+ qtd->error_count = 0; -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NAK); -+ break; -+ case UE_ISOCHRONOUS: -+ /* Should never get called for isochronous transfers. */ -+ DWC_ASSERT(1, "NACK interrupt for ISOC transfer\n"); -+ break; -+ } -+ -+handle_nak_done: -+ disable_hc_int(hc_regs, nak); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel ACK interrupt. This interrupt is enabled when -+ * performing the PING protocol in Slave mode, when errors occur during -+ * either Slave mode or DMA mode, and during Start Split transactions. -+ */ -+static int32_t handle_hc_ack_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "ACK Received--\n", hc->hc_num); -+ -+ if (hc->do_split) { -+ /* -+ * Handle ACK on SSPLIT. -+ * ACK should not occur in CSPLIT. -+ */ -+ if (!hc->ep_is_in && hc->data_pid_start != DWC_OTG_HC_PID_SETUP) { -+ qtd->ssplit_out_xfer_count = hc->xfer_len; -+ } -+ if (!(hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in)) { -+ /* Don't need complete for isochronous out transfers. */ -+ qtd->complete_split = 1; -+ } -+ -+ /* ISOC OUT */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { -+ switch (hc->xact_pos) { -+ case DWC_HCSPLIT_XACTPOS_ALL: -+ break; -+ case DWC_HCSPLIT_XACTPOS_END: -+ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; -+ qtd->isoc_split_offset = 0; -+ break; -+ case DWC_HCSPLIT_XACTPOS_BEGIN: -+ case DWC_HCSPLIT_XACTPOS_MID: -+ /* -+ * For BEGIN or MID, calculate the length for -+ * the next microframe to determine the correct -+ * SSPLIT token, either MID or END. -+ */ -+ { -+ struct dwc_otg_hcd_iso_packet_desc -+ *frame_desc; -+ -+ frame_desc = -+ &qtd->urb-> -+ iso_descs[qtd->isoc_frame_index]; -+ qtd->isoc_split_offset += 188; -+ -+ if ((frame_desc->length - -+ qtd->isoc_split_offset) <= 188) { -+ qtd->isoc_split_pos = -+ DWC_HCSPLIT_XACTPOS_END; -+ } else { -+ qtd->isoc_split_pos = -+ DWC_HCSPLIT_XACTPOS_MID; -+ } -+ -+ } -+ break; -+ } -+ } else { -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); -+ } -+ } else { -+ /* -+ * An unmasked ACK on a non-split DMA transaction is -+ * for the sole purpose of resetting error counts. Disable other -+ * interrupts unmasked for the same reason. -+ */ -+ if(hcd->core_if->dma_enable) { -+ disable_hc_int(hc_regs, datatglerr); -+ disable_hc_int(hc_regs, nak); -+ } -+ qtd->error_count = 0; -+ -+ if (hc->qh->ping_state) { -+ hc->qh->ping_state = 0; -+ /* -+ * Halt the channel so the transfer can be re-started -+ * from the appropriate point. This only happens in -+ * Slave mode. In DMA mode, the ping_state is cleared -+ * when the transfer is started because the core -+ * automatically executes the PING, then the transfer. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_ACK); -+ } -+ } -+ -+ /* -+ * If the ACK occurred when _not_ in the PING state, let the channel -+ * continue transferring data after clearing the error count. -+ */ -+ -+ disable_hc_int(hc_regs, ack); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel NYET interrupt. This interrupt should only occur on -+ * Bulk and Control OUT endpoints and for complete split transactions. If a -+ * NYET occurs at the same time as a Transfer Complete interrupt, it is -+ * handled in the xfercomp interrupt handler, not here. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "NYET Received--\n", hc->hc_num); -+ -+ /* -+ * NYET on CSPLIT -+ * re-do the CSPLIT immediately on non-periodic -+ */ -+ if (hc->do_split && hc->complete_split) { -+ if (hc->ep_is_in && (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) -+ && hcd->core_if->dma_enable) { -+ qtd->complete_split = 0; -+ qtd->isoc_split_offset = 0; -+ if (++qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } -+ else -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ goto handle_nyet_done; -+ } -+ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ int frnum = dwc_otg_hcd_get_frame_number(hcd); -+ -+ // With the FIQ running we only ever see the failed NYET -+ if (dwc_full_frame_num(frnum) != -+ dwc_full_frame_num(hc->qh->sched_frame) || -+ fiq_fsm_enable) { -+ /* -+ * No longer in the same full speed frame. -+ * Treat this as a transaction error. -+ */ -+#if 0 -+ /** @todo Fix system performance so this can -+ * be treated as an error. Right now complete -+ * splits cannot be scheduled precisely enough -+ * due to other system activity, so this error -+ * occurs regularly in Slave mode. -+ */ -+ qtd->error_count++; -+#endif -+ qtd->complete_split = 0; -+ halt_channel(hcd, hc, qtd, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ /** @todo add support for isoc release */ -+ goto handle_nyet_done; -+ } -+ } -+ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); -+ goto handle_nyet_done; -+ } -+ -+ hc->qh->ping_state = 1; -+ qtd->error_count = 0; -+ -+ update_urb_state_xfer_intr(hc, hc_regs, qtd->urb, qtd, -+ DWC_OTG_HC_XFER_NYET); -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ -+ /* -+ * Halt the channel and re-start the transfer so the PING -+ * protocol will start. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NYET); -+ -+handle_nyet_done: -+ disable_hc_int(hc_regs, nyet); -+ return 1; -+} -+ -+/** -+ * Handles a host channel babble interrupt. This handler may be called in -+ * either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_babble_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Babble Error--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ DWC_OTG_HC_XFER_BABBLE_ERR); -+ goto handle_babble_done; -+ } -+ -+ if (hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { -+ hcd->fops->complete(hcd, qtd->urb->priv, -+ qtd->urb, -DWC_E_OVERFLOW); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_BABBLE_ERR); -+ } else { -+ dwc_otg_halt_status_e halt_status; -+ halt_status = update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_BABBLE_ERR); -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+ -+handle_babble_done: -+ disable_hc_int(hc_regs, bblerr); -+ return 1; -+} -+ -+/** -+ * Handles a host channel AHB error interrupt. This handler is only called in -+ * DMA mode. -+ */ -+static int32_t handle_hc_ahberr_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ hcchar_data_t hcchar; -+ hcsplt_data_t hcsplt; -+ hctsiz_data_t hctsiz; -+ uint32_t hcdma; -+ char *pipetype, *speed; -+ -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "AHB Error--\n", hc->hc_num); -+ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ hcdma = DWC_READ_REG32(&hc_regs->hcdma); -+ -+ DWC_ERROR("AHB ERROR, Channel %d\n", hc->hc_num); -+ DWC_ERROR(" hcchar 0x%08x, hcsplt 0x%08x\n", hcchar.d32, hcsplt.d32); -+ DWC_ERROR(" hctsiz 0x%08x, hcdma 0x%08x\n", hctsiz.d32, hcdma); -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Enqueue\n"); -+ DWC_ERROR(" Device address: %d\n", -+ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); -+ DWC_ERROR(" Endpoint: %d, %s\n", -+ dwc_otg_hcd_get_ep_num(&urb->pipe_info), -+ (dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT")); -+ -+ switch (dwc_otg_hcd_get_pipe_type(&urb->pipe_info)) { -+ case UE_CONTROL: -+ pipetype = "CONTROL"; -+ break; -+ case UE_BULK: -+ pipetype = "BULK"; -+ break; -+ case UE_INTERRUPT: -+ pipetype = "INTERRUPT"; -+ break; -+ case UE_ISOCHRONOUS: -+ pipetype = "ISOCHRONOUS"; -+ break; -+ default: -+ pipetype = "UNKNOWN"; -+ break; -+ } -+ -+ DWC_ERROR(" Endpoint type: %s\n", pipetype); -+ -+ switch (hc->speed) { -+ case DWC_OTG_EP_SPEED_HIGH: -+ speed = "HIGH"; -+ break; -+ case DWC_OTG_EP_SPEED_FULL: -+ speed = "FULL"; -+ break; -+ case DWC_OTG_EP_SPEED_LOW: -+ speed = "LOW"; -+ break; -+ default: -+ speed = "UNKNOWN"; -+ break; -+ }; -+ -+ DWC_ERROR(" Speed: %s\n", speed); -+ -+ DWC_ERROR(" Max packet size: %d\n", -+ dwc_otg_hcd_get_mps(&urb->pipe_info)); -+ DWC_ERROR(" Data buffer length: %d\n", urb->length); -+ DWC_ERROR(" Transfer buffer: %p, Transfer DMA: %p\n", -+ urb->buf, (void *)urb->dma); -+ DWC_ERROR(" Setup buffer: %p, Setup DMA: %p\n", -+ urb->setup_packet, (void *)urb->setup_dma); -+ DWC_ERROR(" Interval: %d\n", urb->interval); -+ -+ /* Core haltes the channel for Descriptor DMA mode */ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ DWC_OTG_HC_XFER_AHB_ERR); -+ goto handle_ahberr_done; -+ } -+ -+ hcd->fops->complete(hcd, urb->priv, urb, -DWC_E_IO); -+ -+ /* -+ * Force a channel halt. Don't call halt_channel because that won't -+ * write to the HCCHARn register in DMA mode to force the halt. -+ */ -+ dwc_otg_hc_halt(hcd->core_if, hc, DWC_OTG_HC_XFER_AHB_ERR); -+handle_ahberr_done: -+ disable_hc_int(hc_regs, ahberr); -+ return 1; -+} -+ -+/** -+ * Handles a host channel transaction error interrupt. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_xacterr_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Transaction Error--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ goto handle_xacterr_done; -+ } -+ -+ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_CONTROL: -+ case UE_BULK: -+ qtd->error_count++; -+ if (!hc->qh->ping_state) { -+ -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ if (!hc->ep_is_in && hc->speed == DWC_OTG_EP_SPEED_HIGH) { -+ hc->qh->ping_state = 1; -+ } -+ } -+ -+ /* -+ * Halt the channel so the transfer can be re-started from -+ * the appropriate point or the PING protocol will start. -+ */ -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ break; -+ case UE_INTERRUPT: -+ qtd->error_count++; -+ if (hc->do_split && hc->complete_split) { -+ qtd->complete_split = 0; -+ } -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ break; -+ case UE_ISOCHRONOUS: -+ { -+ dwc_otg_halt_status_e halt_status; -+ halt_status = -+ update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_XACT_ERR); -+ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+ break; -+ } -+handle_xacterr_done: -+ disable_hc_int(hc_regs, xacterr); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel frame overrun interrupt. This handler may be called -+ * in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_frmovrun_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Frame Overrun--\n", hc->hc_num); -+ -+ switch (dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) { -+ case UE_CONTROL: -+ case UE_BULK: -+ break; -+ case UE_INTERRUPT: -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_FRAME_OVERRUN); -+ break; -+ case UE_ISOCHRONOUS: -+ { -+ dwc_otg_halt_status_e halt_status; -+ halt_status = -+ update_isoc_urb_state(hcd, hc, hc_regs, qtd, -+ DWC_OTG_HC_XFER_FRAME_OVERRUN); -+ -+ halt_channel(hcd, hc, qtd, halt_status); -+ } -+ break; -+ } -+ -+ disable_hc_int(hc_regs, frmovrun); -+ -+ return 1; -+} -+ -+/** -+ * Handles a host channel data toggle error interrupt. This handler may be -+ * called in either DMA mode or Slave mode. -+ */ -+static int32_t handle_hc_datatglerr_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Data Toggle Error on %s transfer--\n", -+ hc->hc_num, (hc->ep_is_in ? "IN" : "OUT")); -+ -+ /* Data toggles on split transactions cause the hc to halt. -+ * restart transfer */ -+ if(hc->qh->do_split) -+ { -+ qtd->error_count++; -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ } else if (hc->ep_is_in) { -+ /* An unmasked data toggle error on a non-split DMA transaction is -+ * for the sole purpose of resetting error counts. Disable other -+ * interrupts unmasked for the same reason. -+ */ -+ if(hcd->core_if->dma_enable) { -+ disable_hc_int(hc_regs, ack); -+ disable_hc_int(hc_regs, nak); -+ } -+ qtd->error_count = 0; -+ } -+ -+ disable_hc_int(hc_regs, datatglerr); -+ -+ return 1; -+} -+ -+#ifdef DEBUG -+/** -+ * This function is for debug only. It checks that a valid halt status is set -+ * and that HCCHARn.chdis is clear. If there's a problem, corrective action is -+ * taken and a warning is issued. -+ * @return 1 if halt status is ok, 0 otherwise. -+ */ -+static inline int halt_status_ok(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ hcchar_data_t hcchar; -+ hctsiz_data_t hctsiz; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ hcsplt_data_t hcsplt; -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS) { -+ /* -+ * This code is here only as a check. This condition should -+ * never happen. Ignore the halt if it does occur. -+ */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ hctsiz.d32 = DWC_READ_REG32(&hc_regs->hctsiz); -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -+ hcsplt.d32 = DWC_READ_REG32(&hc_regs->hcsplt); -+ DWC_WARN -+ ("%s: hc->halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS, " -+ "channel %d, hcchar 0x%08x, hctsiz 0x%08x, " -+ "hcint 0x%08x, hcintmsk 0x%08x, " -+ "hcsplt 0x%08x, qtd->complete_split %d\n", __func__, -+ hc->hc_num, hcchar.d32, hctsiz.d32, hcint.d32, -+ hcintmsk.d32, hcsplt.d32, qtd->complete_split); -+ -+ DWC_WARN("%s: no halt status, channel %d, ignoring interrupt\n", -+ __func__, hc->hc_num); -+ DWC_WARN("\n"); -+ clear_hc_int(hc_regs, chhltd); -+ return 0; -+ } -+ -+ /* -+ * This code is here only as a check. hcchar.chdis should -+ * never be set when the halt interrupt occurs. Halt the -+ * channel again if it does occur. -+ */ -+ hcchar.d32 = DWC_READ_REG32(&hc_regs->hcchar); -+ if (hcchar.b.chdis) { -+ DWC_WARN("%s: hcchar.chdis set unexpectedly, " -+ "hcchar 0x%08x, trying to halt again\n", -+ __func__, hcchar.d32); -+ clear_hc_int(hc_regs, chhltd); -+ hc->halt_pending = 0; -+ halt_channel(hcd, hc, qtd, hc->halt_status); -+ return 0; -+ } -+ -+ return 1; -+} -+#endif -+ -+/** -+ * Handles a host Channel Halted interrupt in DMA mode. This handler -+ * determines the reason the channel halted and proceeds accordingly. -+ */ -+static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ int out_nak_enh = 0; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ /* For core with OUT NAK enhancement, the flow for high- -+ * speed CONTROL/BULK OUT is handled a little differently. -+ */ -+ if (hcd->core_if->snpsid >= OTG_CORE_REV_2_71a) { -+ if (hc->speed == DWC_OTG_EP_SPEED_HIGH && !hc->ep_is_in && -+ (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || -+ hc->ep_type == DWC_OTG_EP_TYPE_BULK)) { -+ out_nak_enh = 1; -+ } -+ } -+ -+ if (hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || -+ (hc->halt_status == DWC_OTG_HC_XFER_AHB_ERR -+ && !hcd->core_if->dma_desc_enable)) { -+ /* -+ * Just release the channel. A dequeue can happen on a -+ * transfer timeout. In the case of an AHB Error, the channel -+ * was forced to halt because there's no way to gracefully -+ * recover. -+ */ -+ if (hcd->core_if->dma_desc_enable) -+ dwc_otg_hcd_complete_xfer_ddma(hcd, hc, hc_regs, -+ hc->halt_status); -+ else -+ release_channel(hcd, hc, qtd, hc->halt_status); -+ return; -+ } -+ -+ /* Read the HCINTn register to determine the cause for the halt. */ -+ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -+ -+ if (hcint.b.xfercomp) { -+ /** @todo This is here because of a possible hardware bug. Spec -+ * says that on SPLIT-ISOC OUT transfers in DMA mode that a HALT -+ * interrupt w/ACK bit set should occur, but I only see the -+ * XFERCOMP bit, even with it masked out. This is a workaround -+ * for that behavior. Should fix this when hardware is fixed. -+ */ -+ if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC && !hc->ep_is_in) { -+ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); -+ } -+ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.stall) { -+ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.xacterr && !hcd->core_if->dma_desc_enable) { -+ if (out_nak_enh) { -+ if (hcint.b.nyet || hcint.b.nak || hcint.b.ack) { -+ DWC_DEBUGPL(DBG_HCD, "XactErr with NYET/NAK/ACK\n"); -+ qtd->error_count = 0; -+ } else { -+ DWC_DEBUGPL(DBG_HCD, "XactErr without NYET/NAK/ACK\n"); -+ } -+ } -+ -+ /* -+ * Must handle xacterr before nak or ack. Could get a xacterr -+ * at the same time as either of these on a BULK/CONTROL OUT -+ * that started with a PING. The xacterr takes precedence. -+ */ -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.xcs_xact && hcd->core_if->dma_desc_enable) { -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ahberr && hcd->core_if->dma_desc_enable) { -+ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.bblerr) { -+ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.frmovrun) { -+ handle_hc_frmovrun_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.datatglerr) { -+ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); -+ } else if (!out_nak_enh) { -+ if (hcint.b.nyet) { -+ /* -+ * Must handle nyet before nak or ack. Could get a nyet at the -+ * same time as either of those on a BULK/CONTROL OUT that -+ * started with a PING. The nyet takes precedence. -+ */ -+ handle_hc_nyet_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.nak && !hcintmsk.b.nak) { -+ /* -+ * If nak is not masked, it's because a non-split IN transfer -+ * is in an error state. In that case, the nak is handled by -+ * the nak interrupt handler, not here. Handle nak here for -+ * BULK/CONTROL OUT transfers, which halt on a NAK to allow -+ * rewinding the buffer pointer. -+ */ -+ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ack && !hcintmsk.b.ack) { -+ /* -+ * If ack is not masked, it's because a non-split IN transfer -+ * is in an error state. In that case, the ack is handled by -+ * the ack interrupt handler, not here. Handle ack here for -+ * split transfers. Start splits halt on ACK. -+ */ -+ handle_hc_ack_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || -+ hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * A periodic transfer halted with no other channel -+ * interrupts set. Assume it was halted by the core -+ * because it could not be completed in its scheduled -+ * (micro)frame. -+ */ -+#ifdef DEBUG -+ DWC_PRINTF -+ ("%s: Halt channel %d (assume incomplete periodic transfer)\n", -+ __func__, hc->hc_num); -+#endif -+ halt_channel(hcd, hc, qtd, -+ DWC_OTG_HC_XFER_PERIODIC_INCOMPLETE); -+ } else { -+ DWC_ERROR -+ ("%s: Channel %d, DMA Mode -- ChHltd set, but reason " -+ "for halting is unknown, hcint 0x%08x, intsts 0x%08x\n", -+ __func__, hc->hc_num, hcint.d32, -+ DWC_READ_REG32(&hcd-> -+ core_if->core_global_regs-> -+ gintsts)); -+ /* Failthrough: use 3-strikes rule */ -+ qtd->error_count++; -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ } -+ -+ } -+ } else { -+ DWC_PRINTF("NYET/NAK/ACK/other in non-error case, 0x%08x\n", -+ hcint.d32); -+ /* Failthrough: use 3-strikes rule */ -+ qtd->error_count++; -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ update_urb_state_xfer_intr(hc, hc_regs, -+ qtd->urb, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ halt_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_XACT_ERR); -+ } -+} -+ -+/** -+ * Handles a host channel Channel Halted interrupt. -+ * -+ * In slave mode, this handler is called only when the driver specifically -+ * requests a halt. This occurs during handling other host channel interrupts -+ * (e.g. nak, xacterr, stall, nyet, etc.). -+ * -+ * In DMA mode, this is the interrupt that occurs when the core has finished -+ * processing a transfer on a channel. Other host channel interrupts (except -+ * ahberr) are disabled in DMA mode. -+ */ -+static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd) -+{ -+ DWC_DEBUGPL(DBG_HCDI, "--Host Channel %d Interrupt: " -+ "Channel Halted--\n", hc->hc_num); -+ -+ if (hcd->core_if->dma_enable) { -+ handle_hc_chhltd_intr_dma(hcd, hc, hc_regs, qtd); -+ } else { -+#ifdef DEBUG -+ if (!halt_status_ok(hcd, hc, hc_regs, qtd)) { -+ return 1; -+ } -+#endif -+ release_channel(hcd, hc, qtd, hc->halt_status); -+ } -+ -+ return 1; -+} -+ -+ -+/** -+ * dwc_otg_fiq_unmangle_isoc() - Update the iso_frame_desc structure on -+ * FIQ transfer completion -+ * @hcd: Pointer to dwc_otg_hcd struct -+ * @num: Host channel number -+ * -+ * 1. Un-mangle the status as recorded in each iso_frame_desc status -+ * 2. Copy it from the dwc_otg_urb into the real URB -+ */ -+void dwc_otg_fiq_unmangle_isoc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) -+{ -+ struct dwc_otg_hcd_urb *dwc_urb = qtd->urb; -+ int nr_frames = dwc_urb->packet_count; -+ int i; -+ hcint_data_t frame_hcint; -+ -+ for (i = 0; i < nr_frames; i++) { -+ frame_hcint.d32 = dwc_urb->iso_descs[i].status; -+ if (frame_hcint.b.xfercomp) { -+ dwc_urb->iso_descs[i].status = 0; -+ dwc_urb->actual_length += dwc_urb->iso_descs[i].actual_length; -+ } else if (frame_hcint.b.frmovrun) { -+ if (qh->ep_is_in) -+ dwc_urb->iso_descs[i].status = -DWC_E_NO_STREAM_RES; -+ else -+ dwc_urb->iso_descs[i].status = -DWC_E_COMMUNICATION; -+ dwc_urb->error_count++; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ } else if (frame_hcint.b.xacterr) { -+ dwc_urb->iso_descs[i].status = -DWC_E_PROTOCOL; -+ dwc_urb->error_count++; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ } else if (frame_hcint.b.bblerr) { -+ dwc_urb->iso_descs[i].status = -DWC_E_OVERFLOW; -+ dwc_urb->error_count++; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ } else { -+ /* Something went wrong */ -+ dwc_urb->iso_descs[i].status = -1; -+ dwc_urb->iso_descs[i].actual_length = 0; -+ dwc_urb->error_count++; -+ } -+ } -+ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1)); -+ -+ //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n", -+ // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count); -+} -+ -+/** -+ * dwc_otg_fiq_unsetup_per_dma() - Remove data from bounce buffers for split transactions -+ * @hcd: Pointer to dwc_otg_hcd struct -+ * @num: Host channel number -+ * -+ * Copies data from the FIQ bounce buffers into the URB's transfer buffer. Does not modify URB state. -+ * Returns total length of data or -1 if the buffers were not used. -+ * -+ */ -+int dwc_otg_fiq_unsetup_per_dma(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd_t *qtd, uint32_t num) -+{ -+ dwc_hc_t *hc = qh->channel; -+ struct fiq_dma_blob *blob = hcd->fiq_dmab; -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; -+ uint8_t *ptr = NULL; -+ int index = 0, len = 0; -+ int i = 0; -+ if (hc->ep_is_in) { -+ /* Copy data out of the DMA bounce buffers to the URB's buffer. -+ * The align_buf is ignored as this is ignored on FSM enqueue. */ -+ ptr = qtd->urb->buf; -+ if (qh->ep_type == UE_ISOCHRONOUS) { -+ /* Isoc IN transactions - grab the offset of the iso_frame_desc into the URB transfer buffer */ -+ index = qtd->isoc_frame_index; -+ ptr += qtd->urb->iso_descs[index].offset; -+ } else { -+ /* Need to increment by actual_length for interrupt IN */ -+ ptr += qtd->urb->actual_length; -+ } -+ -+ for (i = 0; i < st->dma_info.index; i++) { -+ len += st->dma_info.slot_len[i]; -+ dwc_memcpy(ptr, &blob->channel[num].index[i].buf[0], st->dma_info.slot_len[i]); -+ ptr += st->dma_info.slot_len[i]; -+ } -+ return len; -+ } else { -+ /* OUT endpoints - nothing to do. */ -+ return -1; -+ } -+ -+} -+/** -+ * dwc_otg_hcd_handle_hc_fsm() - handle an unmasked channel interrupt -+ * from a channel handled in the FIQ -+ * @hcd: Pointer to dwc_otg_hcd struct -+ * @num: Host channel number -+ * -+ * If a host channel interrupt was received by the IRQ and this was a channel -+ * used by the FIQ, the execution flow for transfer completion is substantially -+ * different from the normal (messy) path. This function and its friends handles -+ * channel cleanup and transaction completion from a FIQ transaction. -+ */ -+void dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num) -+{ -+ struct fiq_channel_state *st = &hcd->fiq_state->channel[num]; -+ dwc_hc_t *hc = hcd->hc_ptr_array[num]; -+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); -+ dwc_otg_qh_t *qh = hc->qh; -+ dwc_otg_hc_regs_t *hc_regs = hcd->core_if->host_if->hc_regs[num]; -+ hcint_data_t hcint = hcd->fiq_state->channel[num].hcint_copy; -+ int hostchannels = 0; -+ fiq_print(FIQDBG_INT, hcd->fiq_state, "OUT %01d %01d ", num , st->fsm); -+ -+ hostchannels = hcd->available_host_channels; -+ switch (st->fsm) { -+ case FIQ_TEST: -+ break; -+ -+ case FIQ_DEQUEUE_ISSUED: -+ /* hc_halt was called. QTD no longer exists. */ -+ /* TODO: for a nonperiodic split transaction, need to issue a -+ * CLEAR_TT_BUFFER hub command if we were in the start-split phase. -+ */ -+ release_channel(hcd, hc, NULL, hc->halt_status); -+ break; -+ -+ case FIQ_NP_SPLIT_DONE: -+ /* Nonperiodic transaction complete. */ -+ if (!hc->ep_is_in) { -+ qtd->ssplit_out_xfer_count = hc->xfer_len; -+ } -+ if (hcint.b.xfercomp) { -+ handle_hc_xfercomp_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.nak) { -+ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); -+ } -+ break; -+ -+ case FIQ_NP_SPLIT_HS_ABORTED: -+ /* A HS abort is a 3-strikes on the HS bus at any point in the transaction. -+ * Normally a CLEAR_TT_BUFFER hub command would be required: we can't do that -+ * because there's no guarantee which order a non-periodic split happened in. -+ * We could end up clearing a perfectly good transaction out of the buffer. -+ */ -+ if (hcint.b.xacterr) { -+ qtd->error_count += st->nr_errors; -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ahberr) { -+ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ local_fiq_disable(); -+ BUG(); -+ } -+ break; -+ -+ case FIQ_NP_SPLIT_LS_ABORTED: -+ /* A few cases can cause this - either an unknown state on a SSPLIT or -+ * STALL/data toggle error response on a CSPLIT */ -+ if (hcint.b.stall) { -+ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.datatglerr) { -+ handle_hc_datatglerr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.bblerr) { -+ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.ahberr) { -+ handle_hc_ahberr_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ local_fiq_disable(); -+ BUG(); -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_DONE: -+ /* Isoc IN or Interrupt IN/OUT */ -+ -+ /* Flow control here is different from the normal execution by the driver. -+ * We need to completely ignore most of the driver's method of handling -+ * split transactions and do it ourselves. -+ */ -+ if (hc->ep_type == UE_INTERRUPT) { -+ if (hcint.b.nak) { -+ handle_hc_nak_intr(hcd, hc, hc_regs, qtd); -+ } else if (hc->ep_is_in) { -+ int len; -+ len = dwc_otg_fiq_unsetup_per_dma(hcd, hc->qh, qtd, num); -+ //printk(KERN_NOTICE "FIQ Transaction: hc=%d len=%d urb_len = %d\n", num, len, qtd->urb->length); -+ qtd->urb->actual_length += len; -+ if (qtd->urb->actual_length >= qtd->urb->length) { -+ qtd->urb->status = 0; -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ /* Interrupt transfer not complete yet - is it a short read? */ -+ if (len < hc->max_packet) { -+ /* Interrupt transaction complete */ -+ qtd->urb->status = 0; -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ /* Further transactions required */ -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ } else { -+ /* Interrupt OUT complete. */ -+ dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd); -+ qtd->urb->actual_length += hc->xfer_len; -+ if (qtd->urb->actual_length >= qtd->urb->length) { -+ qtd->urb->status = 0; -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ } else { -+ /* ISOC IN complete. */ -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ int len = 0; -+ /* Record errors, update qtd. */ -+ if (st->nr_errors) { -+ frame_desc->actual_length = 0; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ } else { -+ frame_desc->status = 0; -+ /* Unswizzle dma */ -+ len = dwc_otg_fiq_unsetup_per_dma(hcd, qh, qtd, num); -+ frame_desc->actual_length = len; -+ } -+ qtd->isoc_frame_index++; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ break; -+ -+ case FIQ_PER_ISO_OUT_DONE: { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ /* Record errors, update qtd. */ -+ if (st->nr_errors) { -+ frame_desc->actual_length = 0; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ } else { -+ frame_desc->status = 0; -+ frame_desc->actual_length = frame_desc->length; -+ } -+ qtd->isoc_frame_index++; -+ qtd->isoc_split_offset = 0; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_NYET_ABORTED: -+ /* Doh. lost the data. */ -+ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " -+ "- FIQ reported NYET. Data may have been lost.\n", -+ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); -+ if (hc->ep_type == UE_ISOCHRONOUS) { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ /* Record errors, update qtd. */ -+ frame_desc->actual_length = 0; -+ frame_desc->status = -DWC_E_PROTOCOL; -+ qtd->isoc_frame_index++; -+ qtd->isoc_split_offset = 0; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ break; -+ -+ case FIQ_HS_ISOC_DONE: -+ /* The FIQ has performed a whole pile of isochronous transactions. -+ * The status is recorded as the interrupt state should the transaction -+ * fail. -+ */ -+ dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num); -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ break; -+ -+ case FIQ_PER_SPLIT_LS_ABORTED: -+ if (hcint.b.xacterr) { -+ /* Hub has responded with an ERR packet. Device -+ * has been unplugged or the port has been disabled. -+ * TODO: need to issue a reset to the hub port. */ -+ qtd->error_count += 3; -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.stall) { -+ handle_hc_stall_intr(hcd, hc, hc_regs, qtd); -+ } else if (hcint.b.bblerr) { -+ handle_hc_babble_intr(hcd, hc, hc_regs, qtd); -+ } else { -+ printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x failed " -+ "- FIQ reported FSM=%d. Data may have been lost.\n", -+ st->fsm, hc->dev_addr, hc->ep_num); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ break; -+ -+ case FIQ_PER_SPLIT_HS_ABORTED: -+ /* Either the SSPLIT phase suffered transaction errors or something -+ * unexpected happened. -+ */ -+ qtd->error_count += 3; -+ handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ break; -+ -+ case FIQ_PER_SPLIT_TIMEOUT: -+ /* Couldn't complete in the nominated frame */ -+ printk(KERN_INFO "Transfer to device %d endpoint 0x%x frame %d failed " -+ "- FIQ timed out. Data may have been lost.\n", -+ hc->dev_addr, hc->ep_num, dwc_otg_hcd_get_frame_number(hcd) >> 3); -+ if (hc->ep_type == UE_ISOCHRONOUS) { -+ struct dwc_otg_hcd_iso_packet_desc *frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; -+ /* Record errors, update qtd. */ -+ frame_desc->actual_length = 0; -+ if (hc->ep_is_in) { -+ frame_desc->status = -DWC_E_NO_STREAM_RES; -+ } else { -+ frame_desc->status = -DWC_E_COMMUNICATION; -+ } -+ qtd->isoc_frame_index++; -+ if (qtd->isoc_frame_index == qtd->urb->packet_count) { -+ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE); -+ } -+ } else { -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ break; -+ -+ default: -+ DWC_WARN("Unexpected state received on hc=%d fsm=%d on transfer to device %d ep 0x%x", -+ hc->hc_num, st->fsm, hc->dev_addr, hc->ep_num); -+ qtd->error_count++; -+ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_NO_HALT_STATUS); -+ } -+ return; -+} -+ -+/** Handles interrupt for a specific Host Channel */ -+int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num) -+{ -+ int retval = 0; -+ hcint_data_t hcint; -+ hcintmsk_data_t hcintmsk; -+ dwc_hc_t *hc; -+ dwc_otg_hc_regs_t *hc_regs; -+ dwc_otg_qtd_t *qtd; -+ -+ DWC_DEBUGPL(DBG_HCDV, "--Host Channel Interrupt--, Channel %d\n", num); -+ -+ hc = dwc_otg_hcd->hc_ptr_array[num]; -+ hc_regs = dwc_otg_hcd->core_if->host_if->hc_regs[num]; -+ if(hc->halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE) { -+ /* We are responding to a channel disable. Driver -+ * state is cleared - our qtd has gone away. -+ */ -+ release_channel(dwc_otg_hcd, hc, NULL, hc->halt_status); -+ return 1; -+ } -+ qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); -+ -+ /* -+ * FSM mode: Check to see if this is a HC interrupt from a channel handled by the FIQ. -+ * Execution path is fundamentally different for the channels after a FIQ has completed -+ * a split transaction. -+ */ -+ if (fiq_fsm_enable) { -+ switch (dwc_otg_hcd->fiq_state->channel[num].fsm) { -+ case FIQ_PASSTHROUGH: -+ break; -+ case FIQ_PASSTHROUGH_ERRORSTATE: -+ /* Hook into the error count */ -+ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "HCDERR%02d", num); -+ if (!dwc_otg_hcd->fiq_state->channel[num].nr_errors) { -+ qtd->error_count = 0; -+ fiq_print(FIQDBG_ERR, dwc_otg_hcd->fiq_state, "RESET "); -+ } -+ break; -+ default: -+ dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd, num); -+ return 1; -+ } -+ } -+ -+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint); -+ hcintmsk.d32 = DWC_READ_REG32(&hc_regs->hcintmsk); -+ hcint.d32 = hcint.d32 & hcintmsk.d32; -+ if (!dwc_otg_hcd->core_if->dma_enable) { -+ if (hcint.b.chhltd && hcint.d32 != 0x2) { -+ hcint.b.chhltd = 0; -+ } -+ } -+ -+ if (hcint.b.xfercomp) { -+ retval |= -+ handle_hc_xfercomp_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ /* -+ * If NYET occurred at same time as Xfer Complete, the NYET is -+ * handled by the Xfer Complete interrupt handler. Don't want -+ * to call the NYET interrupt handler in this case. -+ */ -+ hcint.b.nyet = 0; -+ } -+ if (hcint.b.chhltd) { -+ retval |= handle_hc_chhltd_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.ahberr) { -+ retval |= handle_hc_ahberr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.stall) { -+ retval |= handle_hc_stall_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.nak) { -+ retval |= handle_hc_nak_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.ack) { -+ if(!hcint.b.chhltd) -+ retval |= handle_hc_ack_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.nyet) { -+ retval |= handle_hc_nyet_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.xacterr) { -+ retval |= handle_hc_xacterr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.bblerr) { -+ retval |= handle_hc_babble_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.frmovrun) { -+ retval |= -+ handle_hc_frmovrun_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ if (hcint.b.datatglerr) { -+ retval |= -+ handle_hc_datatglerr_intr(dwc_otg_hcd, hc, hc_regs, qtd); -+ } -+ -+ return retval; -+} -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -new file mode 100644 -index 0000000000000000000000000000000000000000..74cd5fa54aed5241b61371477ef67d706477fd30 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -0,0 +1,1005 @@ -+ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ -+ * $Revision: #20 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1872981 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** -+ * @file -+ * -+ * This file contains the implementation of the HCD. In Linux, the HCD -+ * implements the hc_driver API. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) -+#include <../drivers/usb/core/hcd.h> -+#else -+#include -+#endif -+#include -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) -+#define USB_URB_EP_LINKING 1 -+#else -+#define USB_URB_EP_LINKING 0 -+#endif -+ -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_dbg.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_hcd.h" -+ -+extern unsigned char _dwc_otg_fiq_stub, _dwc_otg_fiq_stub_end; -+ -+/** -+ * Gets the endpoint number from a _bEndpointAddress argument. The endpoint is -+ * qualified with its direction (possible 32 endpoints per device). -+ */ -+#define dwc_ep_addr_to_endpoint(_bEndpointAddress_) ((_bEndpointAddress_ & USB_ENDPOINT_NUMBER_MASK) | \ -+ ((_bEndpointAddress_ & USB_DIR_IN) != 0) << 4) -+ -+static const char dwc_otg_hcd_name[] = "dwc_otg_hcd"; -+ -+extern bool fiq_enable; -+ -+/** @name Linux HC Driver API Functions */ -+/** @{ */ -+/* manage i/o requests, device state */ -+static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep, -+#endif -+ struct urb *urb, gfp_t mem_flags); -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb); -+#endif -+#else /* kernels at or post 2.6.30 */ -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, -+ struct urb *urb, int status); -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ -+ -+static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); -+#endif -+static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd); -+extern int hcd_start(struct usb_hcd *hcd); -+extern void hcd_stop(struct usb_hcd *hcd); -+static int get_frame_number(struct usb_hcd *hcd); -+extern int hub_status_data(struct usb_hcd *hcd, char *buf); -+extern int hub_control(struct usb_hcd *hcd, -+ u16 typeReq, -+ u16 wValue, u16 wIndex, char *buf, u16 wLength); -+ -+struct wrapper_priv_data { -+ dwc_otg_hcd_t *dwc_otg_hcd; -+}; -+ -+/** @} */ -+ -+static struct hc_driver dwc_otg_hc_driver = { -+ -+ .description = dwc_otg_hcd_name, -+ .product_desc = "DWC OTG Controller", -+ .hcd_priv_size = sizeof(struct wrapper_priv_data), -+ -+ .irq = dwc_otg_hcd_irq, -+ -+ .flags = HCD_MEMORY | HCD_USB2, -+ -+ //.reset = -+ .start = hcd_start, -+ //.suspend = -+ //.resume = -+ .stop = hcd_stop, -+ -+ .urb_enqueue = dwc_otg_urb_enqueue, -+ .urb_dequeue = dwc_otg_urb_dequeue, -+ .endpoint_disable = endpoint_disable, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+ .endpoint_reset = endpoint_reset, -+#endif -+ .get_frame_number = get_frame_number, -+ -+ .hub_status_data = hub_status_data, -+ .hub_control = hub_control, -+ //.bus_suspend = -+ //.bus_resume = -+}; -+ -+/** Gets the dwc_otg_hcd from a struct usb_hcd */ -+static inline dwc_otg_hcd_t *hcd_to_dwc_otg_hcd(struct usb_hcd *hcd) -+{ -+ struct wrapper_priv_data *p; -+ p = (struct wrapper_priv_data *)(hcd->hcd_priv); -+ return p->dwc_otg_hcd; -+} -+ -+/** Gets the struct usb_hcd that contains a dwc_otg_hcd_t. */ -+static inline struct usb_hcd *dwc_otg_hcd_to_hcd(dwc_otg_hcd_t * dwc_otg_hcd) -+{ -+ return dwc_otg_hcd_get_priv_data(dwc_otg_hcd); -+} -+ -+/** Gets the usb_host_endpoint associated with an URB. */ -+inline struct usb_host_endpoint *dwc_urb_to_endpoint(struct urb *urb) -+{ -+ struct usb_device *dev = urb->dev; -+ int ep_num = usb_pipeendpoint(urb->pipe); -+ -+ if (usb_pipein(urb->pipe)) -+ return dev->ep_in[ep_num]; -+ else -+ return dev->ep_out[ep_num]; -+} -+ -+static int _disconnect(dwc_otg_hcd_t * hcd) -+{ -+ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); -+ -+ usb_hcd->self.is_b_host = 0; -+ return 0; -+} -+ -+static int _start(dwc_otg_hcd_t * hcd) -+{ -+ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); -+ -+ usb_hcd->self.is_b_host = dwc_otg_hcd_is_b_host(hcd); -+ hcd_start(usb_hcd); -+ -+ return 0; -+} -+ -+static int _hub_info(dwc_otg_hcd_t * hcd, void *urb_handle, uint32_t * hub_addr, -+ uint32_t * port_addr) -+{ -+ struct urb *urb = (struct urb *)urb_handle; -+ struct usb_bus *bus; -+#if 1 //GRAYG - temporary -+ if (NULL == urb_handle) -+ DWC_ERROR("**** %s - NULL URB handle\n", __func__);//GRAYG -+ if (NULL == urb->dev) -+ DWC_ERROR("**** %s - URB has no device\n", __func__);//GRAYG -+ if (NULL == port_addr) -+ DWC_ERROR("**** %s - NULL port_address\n", __func__);//GRAYG -+#endif -+ if (urb->dev->tt) { -+ if (NULL == urb->dev->tt->hub) { -+ DWC_ERROR("**** %s - (URB's transactor has no TT - giving no hub)\n", -+ __func__); //GRAYG -+ //*hub_addr = (u8)usb_pipedevice(urb->pipe); //GRAYG -+ *hub_addr = 0; //GRAYG -+ // we probably shouldn't have a transaction translator if -+ // there's no associated hub? -+ } else { -+ bus = hcd_to_bus(dwc_otg_hcd_to_hcd(hcd)); -+ if (urb->dev->tt->hub == bus->root_hub) -+ *hub_addr = 0; -+ else -+ *hub_addr = urb->dev->tt->hub->devnum; -+ } -+ *port_addr = urb->dev->tt->multi ? urb->dev->ttport : 1; -+ } else { -+ *hub_addr = 0; -+ *port_addr = urb->dev->ttport; -+ } -+ return 0; -+} -+ -+static int _speed(dwc_otg_hcd_t * hcd, void *urb_handle) -+{ -+ struct urb *urb = (struct urb *)urb_handle; -+ return urb->dev->speed; -+} -+ -+static int _get_b_hnp_enable(dwc_otg_hcd_t * hcd) -+{ -+ struct usb_hcd *usb_hcd = dwc_otg_hcd_to_hcd(hcd); -+ return usb_hcd->self.b_hnp_enable; -+} -+ -+static void allocate_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, -+ struct urb *urb) -+{ -+ hcd_to_bus(hcd)->bandwidth_allocated += bw / urb->interval; -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ hcd_to_bus(hcd)->bandwidth_isoc_reqs++; -+ } else { -+ hcd_to_bus(hcd)->bandwidth_int_reqs++; -+ } -+} -+ -+static void free_bus_bandwidth(struct usb_hcd *hcd, uint32_t bw, -+ struct urb *urb) -+{ -+ hcd_to_bus(hcd)->bandwidth_allocated -= bw / urb->interval; -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ hcd_to_bus(hcd)->bandwidth_isoc_reqs--; -+ } else { -+ hcd_to_bus(hcd)->bandwidth_int_reqs--; -+ } -+} -+ -+/** -+ * Sets the final status of an URB and returns it to the device driver. Any -+ * required cleanup of the URB is performed. The HCD lock should be held on -+ * entry. -+ */ -+static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle, -+ dwc_otg_hcd_urb_t * dwc_otg_urb, int32_t status) -+{ -+ struct urb *urb = (struct urb *)urb_handle; -+ urb_tq_entry_t *new_entry; -+ int rc = 0; -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ DWC_PRINTF("%s: urb %p, device %d, ep %d %s, status=%d\n", -+ __func__, urb, usb_pipedevice(urb->pipe), -+ usb_pipeendpoint(urb->pipe), -+ usb_pipein(urb->pipe) ? "IN" : "OUT", status); -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ int i; -+ for (i = 0; i < urb->number_of_packets; i++) { -+ DWC_PRINTF(" ISO Desc %d status: %d\n", -+ i, urb->iso_frame_desc[i].status); -+ } -+ } -+ } -+ new_entry = DWC_ALLOC_ATOMIC(sizeof(urb_tq_entry_t)); -+ urb->actual_length = dwc_otg_hcd_urb_get_actual_length(dwc_otg_urb); -+ /* Convert status value. */ -+ switch (status) { -+ case -DWC_E_PROTOCOL: -+ status = -EPROTO; -+ break; -+ case -DWC_E_IN_PROGRESS: -+ status = -EINPROGRESS; -+ break; -+ case -DWC_E_PIPE: -+ status = -EPIPE; -+ break; -+ case -DWC_E_IO: -+ status = -EIO; -+ break; -+ case -DWC_E_TIMEOUT: -+ status = -ETIMEDOUT; -+ break; -+ case -DWC_E_OVERFLOW: -+ status = -EOVERFLOW; -+ break; -+ case -DWC_E_SHUTDOWN: -+ status = -ESHUTDOWN; -+ break; -+ default: -+ if (status) { -+ DWC_PRINTF("Uknown urb status %d\n", status); -+ -+ } -+ } -+ -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ int i; -+ -+ urb->error_count = dwc_otg_hcd_urb_get_error_count(dwc_otg_urb); -+ for (i = 0; i < urb->number_of_packets; ++i) { -+ urb->iso_frame_desc[i].actual_length = -+ dwc_otg_hcd_urb_get_iso_desc_actual_length -+ (dwc_otg_urb, i); -+ urb->iso_frame_desc[i].status = -+ dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i); -+ } -+ } -+ -+ urb->status = status; -+ urb->hcpriv = NULL; -+ if (!status) { -+ if ((urb->transfer_flags & URB_SHORT_NOT_OK) && -+ (urb->actual_length < urb->transfer_buffer_length)) { -+ urb->status = -EREMOTEIO; -+ } -+ } -+ -+ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) || -+ (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { -+ struct usb_host_endpoint *ep = dwc_urb_to_endpoint(urb); -+ if (ep) { -+ free_bus_bandwidth(dwc_otg_hcd_to_hcd(hcd), -+ dwc_otg_hcd_get_ep_bandwidth(hcd, -+ ep->hcpriv), -+ urb); -+ } -+ } -+ DWC_FREE(dwc_otg_urb); -+ if (!new_entry) { -+ DWC_ERROR("dwc_otg_hcd: complete: cannot allocate URB TQ entry\n"); -+ urb->status = -EPROTO; -+ /* don't schedule the tasklet - -+ * directly return the packet here with error. */ -+#if USB_URB_EP_LINKING -+ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb); -+#else -+ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); -+#endif -+ } else { -+ new_entry->urb = urb; -+#if USB_URB_EP_LINKING -+ rc = usb_hcd_check_unlink_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); -+ if(0 == rc) { -+ usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); -+ } -+#endif -+ if(0 == rc) { -+ DWC_TAILQ_INSERT_TAIL(&hcd->completed_urb_list, new_entry, -+ urb_tq_entries); -+ DWC_TASK_HI_SCHEDULE(hcd->completion_tasklet); -+ } -+ } -+ return 0; -+} -+ -+static struct dwc_otg_hcd_function_ops hcd_fops = { -+ .start = _start, -+ .disconnect = _disconnect, -+ .hub_info = _hub_info, -+ .speed = _speed, -+ .complete = _complete, -+ .get_b_hnp_enable = _get_b_hnp_enable, -+}; -+ -+static struct fiq_handler fh = { -+ .name = "usb_fiq", -+}; -+ -+static void hcd_init_fiq(void *cookie) -+{ -+ dwc_otg_device_t *otg_dev = cookie; -+ dwc_otg_hcd_t *dwc_otg_hcd = otg_dev->hcd; -+ struct pt_regs regs; -+ int irq; -+ -+ if (claim_fiq(&fh)) { -+ DWC_ERROR("Can't claim FIQ"); -+ BUG(); -+ } -+ DWC_WARN("FIQ on core %d at 0x%08x", -+ smp_processor_id(), -+ (fiq_fsm_enable ? (int)&dwc_otg_fiq_fsm : (int)&dwc_otg_fiq_nop)); -+ DWC_WARN("FIQ ASM at 0x%08x length %d", (int)&_dwc_otg_fiq_stub, (int)(&_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub)); -+ set_fiq_handler((void *) &_dwc_otg_fiq_stub, &_dwc_otg_fiq_stub_end - &_dwc_otg_fiq_stub); -+ memset(®s,0,sizeof(regs)); -+ -+ regs.ARM_r8 = (long) dwc_otg_hcd->fiq_state; -+ if (fiq_fsm_enable) { -+ regs.ARM_r9 = dwc_otg_hcd->core_if->core_params->host_channels; -+ //regs.ARM_r10 = dwc_otg_hcd->dma; -+ regs.ARM_fp = (long) dwc_otg_fiq_fsm; -+ } else { -+ regs.ARM_fp = (long) dwc_otg_fiq_nop; -+ } -+ -+ regs.ARM_sp = (long) dwc_otg_hcd->fiq_stack + (sizeof(struct fiq_stack) - 4); -+ -+// __show_regs(®s); -+ set_fiq_regs(®s); -+ -+ //Set the mphi periph to the required registers -+ dwc_otg_hcd->fiq_state->mphi_regs.base = otg_dev->os_dep.mphi_base; -+ dwc_otg_hcd->fiq_state->mphi_regs.ctrl = otg_dev->os_dep.mphi_base + 0x4c; -+ dwc_otg_hcd->fiq_state->mphi_regs.outdda = otg_dev->os_dep.mphi_base + 0x28; -+ dwc_otg_hcd->fiq_state->mphi_regs.outddb = otg_dev->os_dep.mphi_base + 0x2c; -+ dwc_otg_hcd->fiq_state->mphi_regs.intstat = otg_dev->os_dep.mphi_base + 0x50; -+ dwc_otg_hcd->fiq_state->dwc_regs_base = otg_dev->os_dep.base; -+ DWC_WARN("MPHI regs_base at 0x%08x", (int)dwc_otg_hcd->fiq_state->mphi_regs.base); -+ //Enable mphi peripheral -+ writel((1<<31),dwc_otg_hcd->fiq_state->mphi_regs.ctrl); -+#ifdef DEBUG -+ if (readl(dwc_otg_hcd->fiq_state->mphi_regs.ctrl) & 0x80000000) -+ DWC_WARN("MPHI periph has been enabled"); -+ else -+ DWC_WARN("MPHI periph has NOT been enabled"); -+#endif -+ // Enable FIQ interrupt from USB peripheral -+#ifdef CONFIG_MULTI_IRQ_HANDLER -+ irq = platform_get_irq(otg_dev->os_dep.platformdev, 1); -+#else -+ irq = INTERRUPT_VC_USB; -+#endif -+ if (irq < 0) { -+ DWC_ERROR("Can't get FIQ irq"); -+ return; -+ } -+ enable_fiq(irq); -+ local_fiq_enable(); -+} -+ -+/** -+ * Initializes the HCD. This function allocates memory for and initializes the -+ * static parts of the usb_hcd and dwc_otg_hcd structures. It also registers the -+ * USB bus with the core and calls the hc_driver->start() function. It returns -+ * a negative error on failure. -+ */ -+int hcd_init(dwc_bus_dev_t *_dev) -+{ -+ struct usb_hcd *hcd = NULL; -+ dwc_otg_hcd_t *dwc_otg_hcd = NULL; -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ int retval = 0; -+ u64 dmamask; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT otg_dev=%p\n", otg_dev); -+ -+ /* Set device flags indicating whether the HCD supports DMA. */ -+ if (dwc_otg_is_dma_enable(otg_dev->core_if)) -+ dmamask = DMA_BIT_MASK(32); -+ else -+ dmamask = 0; -+ -+#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) -+ dma_set_mask(&_dev->dev, dmamask); -+ dma_set_coherent_mask(&_dev->dev, dmamask); -+#elif defined(PCI_INTERFACE) -+ pci_set_dma_mask(_dev, dmamask); -+ pci_set_consistent_dma_mask(_dev, dmamask); -+#endif -+ -+ /* -+ * Allocate memory for the base HCD plus the DWC OTG HCD. -+ * Initialize the base HCD. -+ */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, _dev->dev.bus_id); -+#else -+ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, dev_name(&_dev->dev)); -+ hcd->has_tt = 1; -+// hcd->uses_new_polling = 1; -+// hcd->poll_rh = 0; -+#endif -+ if (!hcd) { -+ retval = -ENOMEM; -+ goto error1; -+ } -+ -+ hcd->regs = otg_dev->os_dep.base; -+ -+ -+ /* Initialize the DWC OTG HCD. */ -+ dwc_otg_hcd = dwc_otg_hcd_alloc_hcd(); -+ if (!dwc_otg_hcd) { -+ goto error2; -+ } -+ ((struct wrapper_priv_data *)(hcd->hcd_priv))->dwc_otg_hcd = -+ dwc_otg_hcd; -+ otg_dev->hcd = dwc_otg_hcd; -+ otg_dev->hcd->otg_dev = otg_dev; -+ -+ if (dwc_otg_hcd_init(dwc_otg_hcd, otg_dev->core_if)) { -+ goto error2; -+ } -+ -+ if (fiq_enable) { -+ if (num_online_cpus() > 1) { -+ /* bcm2709: can run the FIQ on a separate core to IRQs */ -+ smp_call_function_single(1, hcd_init_fiq, otg_dev, 1); -+ } else { -+ smp_call_function_single(0, hcd_init_fiq, otg_dev, 1); -+ } -+ } -+ -+ hcd->self.otg_port = dwc_otg_hcd_otg_port(dwc_otg_hcd); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) //don't support for LM(with 2.6.20.1 kernel) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) //version field absent later -+ hcd->self.otg_version = dwc_otg_get_otg_version(otg_dev->core_if); -+#endif -+ /* Don't support SG list at this point */ -+ hcd->self.sg_tablesize = 0; -+#endif -+ /* -+ * Finish generic HCD initialization and start the HCD. This function -+ * allocates the DMA buffer pool, registers the USB bus, requests the -+ * IRQ line, and calls hcd_start method. -+ */ -+#ifdef PLATFORM_INTERFACE -+ retval = usb_add_hcd(hcd, platform_get_irq(_dev, fiq_enable ? 0 : 1), IRQF_SHARED); -+#else -+ retval = usb_add_hcd(hcd, _dev->irq, IRQF_SHARED); -+#endif -+ if (retval < 0) { -+ goto error2; -+ } -+ -+ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, hcd); -+ return 0; -+ -+error2: -+ usb_put_hcd(hcd); -+error1: -+ return retval; -+} -+ -+/** -+ * Removes the HCD. -+ * Frees memory and resources associated with the HCD and deregisters the bus. -+ */ -+void hcd_remove(dwc_bus_dev_t *_dev) -+{ -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ dwc_otg_hcd_t *dwc_otg_hcd; -+ struct usb_hcd *hcd; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD REMOVE otg_dev=%p\n", otg_dev); -+ -+ if (!otg_dev) { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); -+ return; -+ } -+ -+ dwc_otg_hcd = otg_dev->hcd; -+ -+ if (!dwc_otg_hcd) { -+ DWC_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); -+ return; -+ } -+ -+ hcd = dwc_otg_hcd_to_hcd(dwc_otg_hcd); -+ -+ if (!hcd) { -+ DWC_DEBUGPL(DBG_ANY, -+ "%s: dwc_otg_hcd_to_hcd(dwc_otg_hcd) NULL!\n", -+ __func__); -+ return; -+ } -+ usb_remove_hcd(hcd); -+ dwc_otg_hcd_set_priv_data(dwc_otg_hcd, NULL); -+ dwc_otg_hcd_remove(dwc_otg_hcd); -+ usb_put_hcd(hcd); -+} -+ -+/* ========================================================================= -+ * Linux HC Driver Functions -+ * ========================================================================= */ -+ -+/** Initializes the DWC_otg controller and its root hub and prepares it for host -+ * mode operation. Activates the root port. Returns 0 on success and a negative -+ * error code on failure. */ -+int hcd_start(struct usb_hcd *hcd) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ struct usb_bus *bus; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD START\n"); -+ bus = hcd_to_bus(hcd); -+ -+ hcd->state = HC_STATE_RUNNING; -+ if (dwc_otg_hcd_start(dwc_otg_hcd, &hcd_fops)) { -+ return 0; -+ } -+ -+ /* Initialize and connect root hub if one is not already attached */ -+ if (bus->root_hub) { -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD Has Root Hub\n"); -+ /* Inform the HUB driver to resume. */ -+ usb_hcd_resume_root_hub(hcd); -+ } -+ -+ return 0; -+} -+ -+/** -+ * Halts the DWC_otg host mode operations in a clean manner. USB transfers are -+ * stopped. -+ */ -+void hcd_stop(struct usb_hcd *hcd) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+ dwc_otg_hcd_stop(dwc_otg_hcd); -+} -+ -+/** Returns the current frame number. */ -+static int get_frame_number(struct usb_hcd *hcd) -+{ -+ hprt0_data_t hprt0; -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ hprt0.d32 = DWC_READ_REG32(dwc_otg_hcd->core_if->host_if->hprt0); -+ if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) -+ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd) >> 3; -+ else -+ return dwc_otg_hcd_get_frame_number(dwc_otg_hcd); -+} -+ -+#ifdef DEBUG -+static void dump_urb_info(struct urb *urb, char *fn_name) -+{ -+ DWC_PRINTF("%s, urb %p\n", fn_name, urb); -+ DWC_PRINTF(" Device address: %d\n", usb_pipedevice(urb->pipe)); -+ DWC_PRINTF(" Endpoint: %d, %s\n", usb_pipeendpoint(urb->pipe), -+ (usb_pipein(urb->pipe) ? "IN" : "OUT")); -+ DWC_PRINTF(" Endpoint type: %s\n", ( { -+ char *pipetype; -+ switch (usb_pipetype(urb->pipe)) { -+case PIPE_CONTROL: -+pipetype = "CONTROL"; break; case PIPE_BULK: -+pipetype = "BULK"; break; case PIPE_INTERRUPT: -+pipetype = "INTERRUPT"; break; case PIPE_ISOCHRONOUS: -+pipetype = "ISOCHRONOUS"; break; default: -+ pipetype = "UNKNOWN"; break;}; -+ pipetype;} -+ )) ; -+ DWC_PRINTF(" Speed: %s\n", ( { -+ char *speed; switch (urb->dev->speed) { -+case USB_SPEED_HIGH: -+speed = "HIGH"; break; case USB_SPEED_FULL: -+speed = "FULL"; break; case USB_SPEED_LOW: -+speed = "LOW"; break; default: -+ speed = "UNKNOWN"; break;}; -+ speed;} -+ )) ; -+ DWC_PRINTF(" Max packet size: %d\n", -+ usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe))); -+ DWC_PRINTF(" Data buffer length: %d\n", urb->transfer_buffer_length); -+ DWC_PRINTF(" Transfer buffer: %p, Transfer DMA: %p\n", -+ urb->transfer_buffer, (void *)urb->transfer_dma); -+ DWC_PRINTF(" Setup buffer: %p, Setup DMA: %p\n", -+ urb->setup_packet, (void *)urb->setup_dma); -+ DWC_PRINTF(" Interval: %d\n", urb->interval); -+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { -+ int i; -+ for (i = 0; i < urb->number_of_packets; i++) { -+ DWC_PRINTF(" ISO Desc %d:\n", i); -+ DWC_PRINTF(" offset: %d, length %d\n", -+ urb->iso_frame_desc[i].offset, -+ urb->iso_frame_desc[i].length); -+ } -+ } -+} -+#endif -+ -+/** Starts processing a USB transfer request specified by a USB Request Block -+ * (URB). mem_flags indicates the type of memory allocation to use while -+ * processing this URB. */ -+static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep, -+#endif -+ struct urb *urb, gfp_t mem_flags) -+{ -+ int retval = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep = urb->ep; -+#endif -+ dwc_irqflags_t irqflags; -+ void **ref_ep_hcpriv = &ep->hcpriv; -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ dwc_otg_hcd_urb_t *dwc_otg_urb; -+ int i; -+ int alloc_bandwidth = 0; -+ uint8_t ep_type = 0; -+ uint32_t flags = 0; -+ void *buf; -+ -+#ifdef DEBUG -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ dump_urb_info(urb, "dwc_otg_urb_enqueue"); -+ } -+#endif -+ -+ if (!urb->transfer_buffer && urb->transfer_buffer_length) -+ return -EINVAL; -+ -+ if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) -+ || (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { -+ if (!dwc_otg_hcd_is_bandwidth_allocated -+ (dwc_otg_hcd, ref_ep_hcpriv)) { -+ alloc_bandwidth = 1; -+ } -+ } -+ -+ switch (usb_pipetype(urb->pipe)) { -+ case PIPE_CONTROL: -+ ep_type = USB_ENDPOINT_XFER_CONTROL; -+ break; -+ case PIPE_ISOCHRONOUS: -+ ep_type = USB_ENDPOINT_XFER_ISOC; -+ break; -+ case PIPE_BULK: -+ ep_type = USB_ENDPOINT_XFER_BULK; -+ break; -+ case PIPE_INTERRUPT: -+ ep_type = USB_ENDPOINT_XFER_INT; -+ break; -+ default: -+ DWC_WARN("Wrong EP type - %d\n", usb_pipetype(urb->pipe)); -+ } -+ -+ /* # of packets is often 0 - do we really need to call this then? */ -+ dwc_otg_urb = dwc_otg_hcd_urb_alloc(dwc_otg_hcd, -+ urb->number_of_packets, -+ mem_flags == GFP_ATOMIC ? 1 : 0); -+ -+ if(dwc_otg_urb == NULL) -+ return -ENOMEM; -+ -+ if (!dwc_otg_urb && urb->number_of_packets) -+ return -ENOMEM; -+ -+ dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe), -+ usb_pipeendpoint(urb->pipe), ep_type, -+ usb_pipein(urb->pipe), -+ usb_maxpacket(urb->dev, urb->pipe, -+ !(usb_pipein(urb->pipe)))); -+ -+ buf = urb->transfer_buffer; -+ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) { -+ /* -+ * Calculate virtual address from physical address, -+ * because some class driver may not fill transfer_buffer. -+ * In Buffer DMA mode virual address is used, -+ * when handling non DWORD aligned buffers. -+ */ -+ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma); -+ dev_warn_once(&urb->dev->dev, -+ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n", -+ &urb->transfer_dma, buf); -+ } -+ -+ if (!(urb->transfer_flags & URB_NO_INTERRUPT)) -+ flags |= URB_GIVEBACK_ASAP; -+ if (urb->transfer_flags & URB_ZERO_PACKET) -+ flags |= URB_SEND_ZERO_PACKET; -+ -+ dwc_otg_hcd_urb_set_params(dwc_otg_urb, urb, buf, -+ urb->transfer_dma, -+ urb->transfer_buffer_length, -+ urb->setup_packet, -+ urb->setup_dma, flags, urb->interval); -+ -+ for (i = 0; i < urb->number_of_packets; ++i) { -+ dwc_otg_hcd_urb_set_iso_desc_params(dwc_otg_urb, i, -+ urb-> -+ iso_frame_desc[i].offset, -+ urb-> -+ iso_frame_desc[i].length); -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &irqflags); -+ urb->hcpriv = dwc_otg_urb; -+#if USB_URB_EP_LINKING -+ retval = usb_hcd_link_urb_to_ep(hcd, urb); -+ if (0 == retval) -+#endif -+ { -+ retval = dwc_otg_hcd_urb_enqueue(dwc_otg_hcd, dwc_otg_urb, -+ /*(dwc_otg_qh_t **)*/ -+ ref_ep_hcpriv, 1); -+ if (0 == retval) { -+ if (alloc_bandwidth) { -+ allocate_bus_bandwidth(hcd, -+ dwc_otg_hcd_get_ep_bandwidth( -+ dwc_otg_hcd, *ref_ep_hcpriv), -+ urb); -+ } -+ } else { -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG dwc_otg_hcd_urb_enqueue failed rc %d\n", retval); -+#if USB_URB_EP_LINKING -+ usb_hcd_unlink_urb_from_ep(hcd, urb); -+#endif -+ DWC_FREE(dwc_otg_urb); -+ urb->hcpriv = NULL; -+ if (retval == -DWC_E_NO_DEVICE) -+ retval = -ENODEV; -+ } -+ } -+#if USB_URB_EP_LINKING -+ else -+ { -+ DWC_FREE(dwc_otg_urb); -+ urb->hcpriv = NULL; -+ } -+#endif -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags); -+ return retval; -+} -+ -+/** Aborts/cancels a USB transfer request. Always returns 0 to indicate -+ * success. */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) -+#else -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) -+#endif -+{ -+ dwc_irqflags_t flags; -+ dwc_otg_hcd_t *dwc_otg_hcd; -+ int rc; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue\n"); -+ -+ dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+#ifdef DEBUG -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ dump_urb_info(urb, "dwc_otg_urb_dequeue"); -+ } -+#endif -+ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ rc = usb_hcd_check_unlink_urb(hcd, urb, status); -+ if (0 == rc) { -+ if(urb->hcpriv != NULL) { -+ dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, -+ (dwc_otg_hcd_urb_t *)urb->hcpriv); -+ -+ DWC_FREE(urb->hcpriv); -+ urb->hcpriv = NULL; -+ } -+ } -+ -+ if (0 == rc) { -+ /* Higher layer software sets URB status. */ -+#if USB_URB_EP_LINKING -+ usb_hcd_unlink_urb_from_ep(hcd, urb); -+#endif -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+ -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ usb_hcd_giveback_urb(hcd, urb); -+#else -+ usb_hcd_giveback_urb(hcd, urb, status); -+#endif -+ if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { -+ DWC_PRINTF("Called usb_hcd_giveback_urb() \n"); -+ DWC_PRINTF(" 1urb->status = %d\n", urb->status); -+ } -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue OK\n"); -+ } else { -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD URB Dequeue failed - rc %d\n", -+ rc); -+ } -+ -+ return rc; -+} -+ -+/* Frees resources in the DWC_otg controller related to a given endpoint. Also -+ * clears state in the HCD related to the endpoint. Any URBs for the endpoint -+ * must already be dequeued. */ -+static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+ DWC_DEBUGPL(DBG_HCD, -+ "DWC OTG HCD EP DISABLE: _bEndpointAddress=0x%02x, " -+ "endpoint=%d\n", ep->desc.bEndpointAddress, -+ dwc_ep_addr_to_endpoint(ep->desc.bEndpointAddress)); -+ dwc_otg_hcd_endpoint_disable(dwc_otg_hcd, ep->hcpriv, 250); -+ ep->hcpriv = NULL; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) -+/* Resets endpoint specific parameter values, in current version used to reset -+ * the data toggle(as a WA). This function can be called from usb_clear_halt routine */ -+static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) -+{ -+ dwc_irqflags_t flags; -+ struct usb_device *udev = NULL; -+ int epnum = usb_endpoint_num(&ep->desc); -+ int is_out = usb_endpoint_dir_out(&ep->desc); -+ int is_control = usb_endpoint_xfer_control(&ep->desc); -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ struct device *dev = DWC_OTG_OS_GETDEV(dwc_otg_hcd->otg_dev->os_dep); -+ -+ if (dev) -+ udev = to_usb_device(dev); -+ else -+ return; -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD EP RESET: Endpoint Num=0x%02d\n", epnum); -+ -+ DWC_SPINLOCK_IRQSAVE(dwc_otg_hcd->lock, &flags); -+ usb_settoggle(udev, epnum, is_out, 0); -+ if (is_control) -+ usb_settoggle(udev, epnum, !is_out, 0); -+ -+ if (ep->hcpriv) { -+ dwc_otg_hcd_endpoint_reset(dwc_otg_hcd, ep->hcpriv); -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); -+} -+#endif -+ -+/** Handles host mode interrupts for the DWC_otg controller. Returns IRQ_NONE if -+ * there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid -+ * interrupt. -+ * -+ * This function is called by the USB core when an interrupt occurs */ -+static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ int32_t retval = dwc_otg_hcd_handle_intr(dwc_otg_hcd); -+ if (retval != 0) { -+ S3C2410X_CLEAR_EINTPEND(); -+ } -+ return IRQ_RETVAL(retval); -+} -+ -+/** Creates Status Change bitmap for the root hub and root port. The bitmap is -+ * returned in buf. Bit 0 is the status change indicator for the root hub. Bit 1 -+ * is the status change indicator for the single root port. Returns 1 if either -+ * change indicator is 1, otherwise returns 0. */ -+int hub_status_data(struct usb_hcd *hcd, char *buf) -+{ -+ dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); -+ -+ buf[0] = 0; -+ buf[0] |= (dwc_otg_hcd_is_status_changed(dwc_otg_hcd, 1)) << 1; -+ -+ return (buf[0] != 0); -+} -+ -+/** Handles hub class-specific requests. */ -+int hub_control(struct usb_hcd *hcd, -+ u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength) -+{ -+ int retval; -+ -+ retval = dwc_otg_hcd_hub_control(hcd_to_dwc_otg_hcd(hcd), -+ typeReq, wValue, wIndex, buf, wLength); -+ -+ switch (retval) { -+ case -DWC_E_INVALID: -+ retval = -EINVAL; -+ break; -+ } -+ -+ return retval; -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c2dff94e8e6edd22e4427aaa1eac7aad972cb6bd ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -0,0 +1,963 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ -+ * $Revision: #44 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+ -+/** -+ * @file -+ * -+ * This file contains the functions to manage Queue Heads and Queue -+ * Transfer Descriptors. -+ */ -+ -+#include "dwc_otg_hcd.h" -+#include "dwc_otg_regs.h" -+ -+extern bool microframe_schedule; -+ -+/** -+ * Free each QTD in the QH's QTD-list then free the QH. QH should already be -+ * removed from a list. QTD list should already be empty if called from URB -+ * Dequeue. -+ * -+ * @param hcd HCD instance. -+ * @param qh The QH to free. -+ */ -+void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ dwc_otg_qtd_t *qtd, *qtd_tmp; -+ dwc_irqflags_t flags; -+ uint32_t buf_size = 0; -+ uint8_t *align_buf_virt = NULL; -+ dwc_dma_t align_buf_dma; -+ struct device *dev = dwc_otg_hcd_to_dev(hcd); -+ -+ /* Free each QTD in the QTD list */ -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ DWC_CIRCLEQ_FOREACH_SAFE(qtd, qtd_tmp, &qh->qtd_list, qtd_list_entry) { -+ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); -+ dwc_otg_hcd_qtd_free(qtd); -+ } -+ -+ if (hcd->core_if->dma_desc_enable) { -+ dwc_otg_hcd_qh_free_ddma(hcd, qh); -+ } else if (qh->dw_align_buf) { -+ if (qh->ep_type == UE_ISOCHRONOUS) { -+ buf_size = 4096; -+ } else { -+ buf_size = hcd->core_if->core_params->max_transfer_size; -+ } -+ align_buf_virt = qh->dw_align_buf; -+ align_buf_dma = qh->dw_align_buf_dma; -+ } -+ -+ DWC_FREE(qh); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+ if (align_buf_virt) -+ DWC_DMA_FREE(dev, buf_size, align_buf_virt, align_buf_dma); -+ return; -+} -+ -+#define BitStuffTime(bytecount) ((8 * 7* bytecount) / 6) -+#define HS_HOST_DELAY 5 /* nanoseconds */ -+#define FS_LS_HOST_DELAY 1000 /* nanoseconds */ -+#define HUB_LS_SETUP 333 /* nanoseconds */ -+#define NS_TO_US(ns) ((ns + 500) / 1000) -+ /* convert & round nanoseconds to microseconds */ -+ -+static uint32_t calc_bus_time(int speed, int is_in, int is_isoc, int bytecount) -+{ -+ unsigned long retval; -+ -+ switch (speed) { -+ case USB_SPEED_HIGH: -+ if (is_isoc) { -+ retval = -+ ((38 * 8 * 2083) + -+ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + -+ HS_HOST_DELAY; -+ } else { -+ retval = -+ ((55 * 8 * 2083) + -+ (2083 * (3 + BitStuffTime(bytecount)))) / 1000 + -+ HS_HOST_DELAY; -+ } -+ break; -+ case USB_SPEED_FULL: -+ if (is_isoc) { -+ retval = -+ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; -+ if (is_in) { -+ retval = 7268 + FS_LS_HOST_DELAY + retval; -+ } else { -+ retval = 6265 + FS_LS_HOST_DELAY + retval; -+ } -+ } else { -+ retval = -+ (8354 * (31 + 10 * BitStuffTime(bytecount))) / 1000; -+ retval = 9107 + FS_LS_HOST_DELAY + retval; -+ } -+ break; -+ case USB_SPEED_LOW: -+ if (is_in) { -+ retval = -+ (67667 * (31 + 10 * BitStuffTime(bytecount))) / -+ 1000; -+ retval = -+ 64060 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + -+ retval; -+ } else { -+ retval = -+ (66700 * (31 + 10 * BitStuffTime(bytecount))) / -+ 1000; -+ retval = -+ 64107 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + -+ retval; -+ } -+ break; -+ default: -+ DWC_WARN("Unknown device speed\n"); -+ retval = -1; -+ } -+ -+ return NS_TO_US(retval); -+} -+ -+/** -+ * Initializes a QH structure. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh The QH to init. -+ * @param urb Holds the information about the device/endpoint that we need -+ * to initialize the QH. -+ */ -+#define SCHEDULE_SLOP 10 -+void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb) -+{ -+ char *speed, *type; -+ int dev_speed; -+ uint32_t hub_addr, hub_port; -+ -+ dwc_memset(qh, 0, sizeof(dwc_otg_qh_t)); -+ -+ /* Initialize QH */ -+ qh->ep_type = dwc_otg_hcd_get_pipe_type(&urb->pipe_info); -+ qh->ep_is_in = dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? 1 : 0; -+ -+ qh->data_toggle = DWC_OTG_HC_PID_DATA0; -+ qh->maxp = dwc_otg_hcd_get_mps(&urb->pipe_info); -+ DWC_CIRCLEQ_INIT(&qh->qtd_list); -+ DWC_LIST_INIT(&qh->qh_list_entry); -+ qh->channel = NULL; -+ -+ /* FS/LS Enpoint on HS Hub -+ * NOT virtual root hub */ -+ dev_speed = hcd->fops->speed(hcd, urb->priv); -+ -+ hcd->fops->hub_info(hcd, urb->priv, &hub_addr, &hub_port); -+ qh->do_split = 0; -+ if (microframe_schedule) -+ qh->speed = dev_speed; -+ -+ qh->nak_frame = 0xffff; -+ -+ if (((dev_speed == USB_SPEED_LOW) || -+ (dev_speed == USB_SPEED_FULL)) && -+ (hub_addr != 0 && hub_addr != 1)) { -+ DWC_DEBUGPL(DBG_HCD, -+ "QH init: EP %d: TT found at hub addr %d, for port %d\n", -+ dwc_otg_hcd_get_ep_num(&urb->pipe_info), hub_addr, -+ hub_port); -+ qh->do_split = 1; -+ qh->skip_count = 0; -+ } -+ -+ if (qh->ep_type == UE_INTERRUPT || qh->ep_type == UE_ISOCHRONOUS) { -+ /* Compute scheduling parameters once and save them. */ -+ hprt0_data_t hprt; -+ -+ /** @todo Account for split transfers in the bus time. */ -+ int bytecount = -+ dwc_hb_mult(qh->maxp) * dwc_max_packet(qh->maxp); -+ -+ qh->usecs = -+ calc_bus_time((qh->do_split ? USB_SPEED_HIGH : dev_speed), -+ qh->ep_is_in, (qh->ep_type == UE_ISOCHRONOUS), -+ bytecount); -+ /* Start in a slightly future (micro)frame. */ -+ qh->sched_frame = dwc_frame_num_inc(hcd->frame_number, -+ SCHEDULE_SLOP); -+ qh->interval = urb->interval; -+ -+#if 0 -+ /* Increase interrupt polling rate for debugging. */ -+ if (qh->ep_type == UE_INTERRUPT) { -+ qh->interval = 8; -+ } -+#endif -+ hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); -+ if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) && -+ ((dev_speed == USB_SPEED_LOW) || -+ (dev_speed == USB_SPEED_FULL))) { -+ qh->interval *= 8; -+ qh->sched_frame |= 0x7; -+ qh->start_split_frame = qh->sched_frame; -+ } -+ -+ } -+ -+ DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - qh = %p\n", qh); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Device Address = %d\n", -+ dwc_otg_hcd_get_dev_addr(&urb->pipe_info)); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Endpoint %d, %s\n", -+ dwc_otg_hcd_get_ep_num(&urb->pipe_info), -+ dwc_otg_hcd_is_pipe_in(&urb->pipe_info) ? "IN" : "OUT"); -+ switch (dev_speed) { -+ case USB_SPEED_LOW: -+ qh->dev_speed = DWC_OTG_EP_SPEED_LOW; -+ speed = "low"; -+ break; -+ case USB_SPEED_FULL: -+ qh->dev_speed = DWC_OTG_EP_SPEED_FULL; -+ speed = "full"; -+ break; -+ case USB_SPEED_HIGH: -+ qh->dev_speed = DWC_OTG_EP_SPEED_HIGH; -+ speed = "high"; -+ break; -+ default: -+ speed = "?"; -+ break; -+ } -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Speed = %s\n", speed); -+ -+ switch (qh->ep_type) { -+ case UE_ISOCHRONOUS: -+ type = "isochronous"; -+ break; -+ case UE_INTERRUPT: -+ type = "interrupt"; -+ break; -+ case UE_CONTROL: -+ type = "control"; -+ break; -+ case UE_BULK: -+ type = "bulk"; -+ break; -+ default: -+ type = "?"; -+ break; -+ } -+ -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - Type = %s\n", type); -+ -+#ifdef DEBUG -+ if (qh->ep_type == UE_INTERRUPT) { -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - usecs = %d\n", -+ qh->usecs); -+ DWC_DEBUGPL(DBG_HCDV, "DWC OTG HCD QH - interval = %d\n", -+ qh->interval); -+ } -+#endif -+ -+} -+ -+/** -+ * This function allocates and initializes a QH. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param urb Holds the information about the device/endpoint that we need -+ * to initialize the QH. -+ * @param atomic_alloc Flag to do atomic allocation if needed -+ * -+ * @return Returns pointer to the newly allocated QH, or NULL on error. */ -+dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * urb, int atomic_alloc) -+{ -+ dwc_otg_qh_t *qh; -+ -+ /* Allocate memory */ -+ /** @todo add memflags argument */ -+ qh = dwc_otg_hcd_qh_alloc(atomic_alloc); -+ if (qh == NULL) { -+ DWC_ERROR("qh allocation failed"); -+ return NULL; -+ } -+ -+ qh_init(hcd, qh, urb); -+ -+ if (hcd->core_if->dma_desc_enable -+ && (dwc_otg_hcd_qh_init_ddma(hcd, qh) < 0)) { -+ dwc_otg_hcd_qh_free(hcd, qh); -+ return NULL; -+ } -+ -+ return qh; -+} -+ -+/* microframe_schedule=0 start */ -+ -+/** -+ * Checks that a channel is available for a periodic transfer. -+ * -+ * @return 0 if successful, negative error code otherise. -+ */ -+static int periodic_channel_available(dwc_otg_hcd_t * hcd) -+{ -+ /* -+ * Currently assuming that there is a dedicated host channnel for each -+ * periodic transaction plus at least one host channel for -+ * non-periodic transactions. -+ */ -+ int status; -+ int num_channels; -+ -+ num_channels = hcd->core_if->core_params->host_channels; -+ if ((hcd->periodic_channels + hcd->non_periodic_channels < num_channels) -+ && (hcd->periodic_channels < num_channels - 1)) { -+ status = 0; -+ } else { -+ DWC_INFO("%s: Total channels: %d, Periodic: %d, Non-periodic: %d\n", -+ __func__, num_channels, hcd->periodic_channels, hcd->non_periodic_channels); //NOTICE -+ status = -DWC_E_NO_SPACE; -+ } -+ -+ return status; -+} -+ -+/** -+ * Checks that there is sufficient bandwidth for the specified QH in the -+ * periodic schedule. For simplicity, this calculation assumes that all the -+ * transfers in the periodic schedule may occur in the same (micro)frame. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH containing periodic bandwidth required. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+static int check_periodic_bandwidth(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status; -+ int16_t max_claimed_usecs; -+ -+ status = 0; -+ -+ if ((qh->dev_speed == DWC_OTG_EP_SPEED_HIGH) || qh->do_split) { -+ /* -+ * High speed mode. -+ * Max periodic usecs is 80% x 125 usec = 100 usec. -+ */ -+ -+ max_claimed_usecs = 100 - qh->usecs; -+ } else { -+ /* -+ * Full speed mode. -+ * Max periodic usecs is 90% x 1000 usec = 900 usec. -+ */ -+ max_claimed_usecs = 900 - qh->usecs; -+ } -+ -+ if (hcd->periodic_usecs > max_claimed_usecs) { -+ DWC_INFO("%s: already claimed usecs %d, required usecs %d\n", __func__, hcd->periodic_usecs, qh->usecs); //NOTICE -+ status = -DWC_E_NO_SPACE; -+ } -+ -+ return status; -+} -+ -+/* microframe_schedule=0 end */ -+ -+/** -+ * Microframe scheduler -+ * track the total use in hcd->frame_usecs -+ * keep each qh use in qh->frame_usecs -+ * when surrendering the qh then donate the time back -+ */ -+const unsigned short max_uframe_usecs[]={ 100, 100, 100, 100, 100, 100, 30, 0 }; -+ -+/* -+ * called from dwc_otg_hcd.c:dwc_otg_hcd_init -+ */ -+int init_hcd_usecs(dwc_otg_hcd_t *_hcd) -+{ -+ int i; -+ for (i=0; i<8; i++) { -+ _hcd->frame_usecs[i] = max_uframe_usecs[i]; -+ } -+ return 0; -+} -+ -+static int find_single_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -+{ -+ int i; -+ unsigned short utime; -+ int t_left; -+ int ret; -+ int done; -+ -+ ret = -1; -+ utime = _qh->usecs; -+ t_left = utime; -+ i = 0; -+ done = 0; -+ while (done == 0) { -+ /* At the start _hcd->frame_usecs[i] = max_uframe_usecs[i]; */ -+ if (utime <= _hcd->frame_usecs[i]) { -+ _hcd->frame_usecs[i] -= utime; -+ _qh->frame_usecs[i] += utime; -+ t_left -= utime; -+ ret = i; -+ done = 1; -+ return ret; -+ } else { -+ i++; -+ if (i == 8) { -+ done = 1; -+ ret = -1; -+ } -+ } -+ } -+ return ret; -+ } -+ -+/* -+ * use this for FS apps that can span multiple uframes -+ */ -+static int find_multi_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -+{ -+ int i; -+ int j; -+ unsigned short utime; -+ int t_left; -+ int ret; -+ int done; -+ unsigned short xtime; -+ -+ ret = -1; -+ utime = _qh->usecs; -+ t_left = utime; -+ i = 0; -+ done = 0; -+loop: -+ while (done == 0) { -+ if(_hcd->frame_usecs[i] <= 0) { -+ i++; -+ if (i == 8) { -+ done = 1; -+ ret = -1; -+ } -+ goto loop; -+ } -+ -+ /* -+ * we need n consecutive slots -+ * so use j as a start slot j plus j+1 must be enough time (for now) -+ */ -+ xtime= _hcd->frame_usecs[i]; -+ for (j = i+1 ; j < 8 ; j++ ) { -+ /* -+ * if we add this frame remaining time to xtime we may -+ * be OK, if not we need to test j for a complete frame -+ */ -+ if ((xtime+_hcd->frame_usecs[j]) < utime) { -+ if (_hcd->frame_usecs[j] < max_uframe_usecs[j]) { -+ j = 8; -+ ret = -1; -+ continue; -+ } -+ } -+ if (xtime >= utime) { -+ ret = i; -+ j = 8; /* stop loop with a good value ret */ -+ continue; -+ } -+ /* add the frame time to x time */ -+ xtime += _hcd->frame_usecs[j]; -+ /* we must have a fully available next frame or break */ -+ if ((xtime < utime) -+ && (_hcd->frame_usecs[j] == max_uframe_usecs[j])) { -+ ret = -1; -+ j = 8; /* stop loop with a bad value ret */ -+ continue; -+ } -+ } -+ if (ret >= 0) { -+ t_left = utime; -+ for (j = i; (t_left>0) && (j < 8); j++ ) { -+ t_left -= _hcd->frame_usecs[j]; -+ if ( t_left <= 0 ) { -+ _qh->frame_usecs[j] += _hcd->frame_usecs[j] + t_left; -+ _hcd->frame_usecs[j]= -t_left; -+ ret = i; -+ done = 1; -+ } else { -+ _qh->frame_usecs[j] += _hcd->frame_usecs[j]; -+ _hcd->frame_usecs[j] = 0; -+ } -+ } -+ } else { -+ i++; -+ if (i == 8) { -+ done = 1; -+ ret = -1; -+ } -+ } -+ } -+ return ret; -+} -+ -+static int find_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -+{ -+ int ret; -+ ret = -1; -+ -+ if (_qh->speed == USB_SPEED_HIGH) { -+ /* if this is a hs transaction we need a full frame */ -+ ret = find_single_uframe(_hcd, _qh); -+ } else { -+ /* if this is a fs transaction we may need a sequence of frames */ -+ ret = find_multi_uframe(_hcd, _qh); -+ } -+ return ret; -+} -+ -+/** -+ * Checks that the max transfer size allowed in a host channel is large enough -+ * to handle the maximum data transfer in a single (micro)frame for a periodic -+ * transfer. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH for a periodic endpoint. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+static int check_max_xfer_size(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status; -+ uint32_t max_xfer_size; -+ uint32_t max_channel_xfer_size; -+ -+ status = 0; -+ -+ max_xfer_size = dwc_max_packet(qh->maxp) * dwc_hb_mult(qh->maxp); -+ max_channel_xfer_size = hcd->core_if->core_params->max_transfer_size; -+ -+ if (max_xfer_size > max_channel_xfer_size) { -+ DWC_INFO("%s: Periodic xfer length %d > " "max xfer length for channel %d\n", -+ __func__, max_xfer_size, max_channel_xfer_size); //NOTICE -+ status = -DWC_E_NO_SPACE; -+ } -+ -+ return status; -+} -+ -+ -+ -+/** -+ * Schedules an interrupt or isochronous transfer in the periodic schedule. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH for the periodic transfer. The QH should already contain the -+ * scheduling information. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status = 0; -+ -+ if (microframe_schedule) { -+ int frame; -+ status = find_uframe(hcd, qh); -+ frame = -1; -+ if (status == 0) { -+ frame = 7; -+ } else { -+ if (status > 0 ) -+ frame = status-1; -+ } -+ -+ /* Set the new frame up */ -+ if (frame > -1) { -+ qh->sched_frame &= ~0x7; -+ qh->sched_frame |= (frame & 7); -+ } -+ -+ if (status != -1) -+ status = 0; -+ } else { -+ status = periodic_channel_available(hcd); -+ if (status) { -+ DWC_INFO("%s: No host channel available for periodic " "transfer.\n", __func__); //NOTICE -+ return status; -+ } -+ -+ status = check_periodic_bandwidth(hcd, qh); -+ } -+ if (status) { -+ DWC_INFO("%s: Insufficient periodic bandwidth for " -+ "periodic transfer.\n", __func__); -+ return status; -+ } -+ status = check_max_xfer_size(hcd, qh); -+ if (status) { -+ DWC_INFO("%s: Channel max transfer size too small " -+ "for periodic transfer.\n", __func__); -+ return status; -+ } -+ -+ if (hcd->core_if->dma_desc_enable) { -+ /* Don't rely on SOF and start in ready schedule */ -+ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_ready, &qh->qh_list_entry); -+ } -+ else { -+ if(fiq_enable && (DWC_LIST_EMPTY(&hcd->periodic_sched_inactive) || dwc_frame_num_le(qh->sched_frame, hcd->fiq_state->next_sched_frame))) -+ { -+ hcd->fiq_state->next_sched_frame = qh->sched_frame; -+ -+ } -+ /* Always start in the inactive schedule. */ -+ DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_inactive, &qh->qh_list_entry); -+ } -+ -+ if (!microframe_schedule) { -+ /* Reserve the periodic channel. */ -+ hcd->periodic_channels++; -+ } -+ -+ /* Update claimed usecs per (micro)frame. */ -+ hcd->periodic_usecs += qh->usecs; -+ -+ return status; -+} -+ -+ -+/** -+ * This function adds a QH to either the non periodic or periodic schedule if -+ * it is not already in the schedule. If the QH is already in the schedule, no -+ * action is taken. -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int status = 0; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ if (!DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ /* QH already in a schedule. */ -+ return status; -+ } -+ -+ /* Add the new QH to the appropriate schedule */ -+ if (dwc_qh_is_non_per(qh)) { -+ /* Always start in the inactive schedule. */ -+ DWC_LIST_INSERT_TAIL(&hcd->non_periodic_sched_inactive, -+ &qh->qh_list_entry); -+ //hcd->fiq_state->kick_np_queues = 1; -+ } else { -+ status = schedule_periodic(hcd, qh); -+ if ( !hcd->periodic_qh_count ) { -+ intr_mask.b.sofintr = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, intr_mask.d32); -+ } -+ } -+ hcd->periodic_qh_count++; -+ } -+ -+ return status; -+} -+ -+/** -+ * Removes an interrupt or isochronous transfer from the periodic schedule. -+ * -+ * @param hcd The HCD state structure for the DWC OTG controller. -+ * @param qh QH for the periodic transfer. -+ */ -+static void deschedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ int i; -+ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); -+ -+ /* Update claimed usecs per (micro)frame. */ -+ hcd->periodic_usecs -= qh->usecs; -+ -+ if (!microframe_schedule) { -+ /* Release the periodic channel reservation. */ -+ hcd->periodic_channels--; -+ } else { -+ for (i = 0; i < 8; i++) { -+ hcd->frame_usecs[i] += qh->frame_usecs[i]; -+ qh->frame_usecs[i] = 0; -+ } -+ } -+} -+ -+/** -+ * Removes a QH from either the non-periodic or periodic schedule. Memory is -+ * not freed. -+ * -+ * @param hcd The HCD state structure. -+ * @param qh QH to remove from schedule. */ -+void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ if (DWC_LIST_EMPTY(&qh->qh_list_entry)) { -+ /* QH is not in a schedule. */ -+ return; -+ } -+ -+ if (dwc_qh_is_non_per(qh)) { -+ if (hcd->non_periodic_qh_ptr == &qh->qh_list_entry) { -+ hcd->non_periodic_qh_ptr = -+ hcd->non_periodic_qh_ptr->next; -+ } -+ DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); -+ //if (!DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) -+ // hcd->fiq_state->kick_np_queues = 1; -+ } else { -+ deschedule_periodic(hcd, qh); -+ hcd->periodic_qh_count--; -+ if( !hcd->periodic_qh_count && !fiq_fsm_enable ) { -+ intr_mask.b.sofintr = 1; -+ if (fiq_enable) { -+ local_fiq_disable(); -+ fiq_fsm_spin_lock(&hcd->fiq_state->lock); -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); -+ fiq_fsm_spin_unlock(&hcd->fiq_state->lock); -+ local_fiq_enable(); -+ } else { -+ DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk, intr_mask.d32, 0); -+ } -+ } -+ } -+} -+ -+/** -+ * Deactivates a QH. For non-periodic QHs, removes the QH from the active -+ * non-periodic schedule. The QH is added to the inactive non-periodic -+ * schedule if any QTDs are still attached to the QH. -+ * -+ * For periodic QHs, the QH is removed from the periodic queued schedule. If -+ * there are any QTDs still attached to the QH, the QH is added to either the -+ * periodic inactive schedule or the periodic ready schedule and its next -+ * scheduled frame is calculated. The QH is placed in the ready schedule if -+ * the scheduled frame has been reached already. Otherwise it's placed in the -+ * inactive schedule. If there are no QTDs attached to the QH, the QH is -+ * completely removed from the periodic schedule. -+ */ -+void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ int sched_next_periodic_split) -+{ -+ if (dwc_qh_is_non_per(qh)) { -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ if (!DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ /* Add back to inactive non-periodic schedule. */ -+ dwc_otg_hcd_qh_add(hcd, qh); -+ //hcd->fiq_state->kick_np_queues = 1; -+ } -+ } else { -+ uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd); -+ -+ if (qh->do_split) { -+ /* Schedule the next continuing periodic split transfer */ -+ if (sched_next_periodic_split) { -+ -+ qh->sched_frame = frame_number; -+ -+ if (dwc_frame_num_le(frame_number, -+ dwc_frame_num_inc -+ (qh->start_split_frame, -+ 1))) { -+ /* -+ * Allow one frame to elapse after start -+ * split microframe before scheduling -+ * complete split, but DONT if we are -+ * doing the next start split in the -+ * same frame for an ISOC out. -+ */ -+ if ((qh->ep_type != UE_ISOCHRONOUS) || -+ (qh->ep_is_in != 0)) { -+ qh->sched_frame = -+ dwc_frame_num_inc(qh->sched_frame, 1); -+ } -+ } -+ } else { -+ qh->sched_frame = -+ dwc_frame_num_inc(qh->start_split_frame, -+ qh->interval); -+ if (dwc_frame_num_le -+ (qh->sched_frame, frame_number)) { -+ qh->sched_frame = frame_number; -+ } -+ qh->sched_frame |= 0x7; -+ qh->start_split_frame = qh->sched_frame; -+ } -+ } else { -+ qh->sched_frame = -+ dwc_frame_num_inc(qh->sched_frame, qh->interval); -+ if (dwc_frame_num_le(qh->sched_frame, frame_number)) { -+ qh->sched_frame = frame_number; -+ } -+ } -+ -+ if (DWC_CIRCLEQ_EMPTY(&qh->qtd_list)) { -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ } else { -+ /* -+ * Remove from periodic_sched_queued and move to -+ * appropriate queue. -+ */ -+ if ((microframe_schedule && dwc_frame_num_le(qh->sched_frame, frame_number)) || -+ (!microframe_schedule && qh->sched_frame == frame_number)) { -+ DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready, -+ &qh->qh_list_entry); -+ } else { -+ if(fiq_enable && !dwc_frame_num_le(hcd->fiq_state->next_sched_frame, qh->sched_frame)) -+ { -+ hcd->fiq_state->next_sched_frame = qh->sched_frame; -+ } -+ -+ DWC_LIST_MOVE_HEAD -+ (&hcd->periodic_sched_inactive, -+ &qh->qh_list_entry); -+ } -+ } -+ } -+} -+ -+/** -+ * This function allocates and initializes a QTD. -+ * -+ * @param urb The URB to create a QTD from. Each URB-QTD pair will end up -+ * pointing to each other so each pair should have a unique correlation. -+ * @param atomic_alloc Flag to do atomic alloc if needed -+ * -+ * @return Returns pointer to the newly allocated QTD, or NULL on error. */ -+dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb, int atomic_alloc) -+{ -+ dwc_otg_qtd_t *qtd; -+ -+ qtd = dwc_otg_hcd_qtd_alloc(atomic_alloc); -+ if (qtd == NULL) { -+ return NULL; -+ } -+ -+ dwc_otg_hcd_qtd_init(qtd, urb); -+ return qtd; -+} -+ -+/** -+ * Initializes a QTD structure. -+ * -+ * @param qtd The QTD to initialize. -+ * @param urb The URB to use for initialization. */ -+void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb) -+{ -+ dwc_memset(qtd, 0, sizeof(dwc_otg_qtd_t)); -+ qtd->urb = urb; -+ if (dwc_otg_hcd_get_pipe_type(&urb->pipe_info) == UE_CONTROL) { -+ /* -+ * The only time the QTD data toggle is used is on the data -+ * phase of control transfers. This phase always starts with -+ * DATA1. -+ */ -+ qtd->data_toggle = DWC_OTG_HC_PID_DATA1; -+ qtd->control_phase = DWC_OTG_CONTROL_SETUP; -+ } -+ -+ /* start split */ -+ qtd->complete_split = 0; -+ qtd->isoc_split_pos = DWC_HCSPLIT_XACTPOS_ALL; -+ qtd->isoc_split_offset = 0; -+ qtd->in_process = 0; -+ -+ /* Store the qtd ptr in the urb to reference what QTD. */ -+ urb->qtd = qtd; -+ return; -+} -+ -+/** -+ * This function adds a QTD to the QTD-list of a QH. It will find the correct -+ * QH to place the QTD into. If it does not find a QH, then it will create a -+ * new QH. If the QH to which the QTD is added is not currently scheduled, it -+ * is placed into the proper schedule based on its EP type. -+ * HCD lock must be held and interrupts must be disabled on entry -+ * -+ * @param[in] qtd The QTD to add -+ * @param[in] hcd The DWC HCD structure -+ * @param[out] qh out parameter to return queue head -+ * @param atomic_alloc Flag to do atomic alloc if needed -+ * -+ * @return 0 if successful, negative error code otherwise. -+ */ -+int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, -+ dwc_otg_hcd_t * hcd, dwc_otg_qh_t ** qh, int atomic_alloc) -+{ -+ int retval = 0; -+ dwc_otg_hcd_urb_t *urb = qtd->urb; -+ -+ /* -+ * Get the QH which holds the QTD-list to insert to. Create QH if it -+ * doesn't exist. -+ */ -+ if (*qh == NULL) { -+ *qh = dwc_otg_hcd_qh_create(hcd, urb, atomic_alloc); -+ if (*qh == NULL) { -+ retval = -DWC_E_NO_MEMORY; -+ goto done; -+ } else { -+ if (fiq_enable) -+ hcd->fiq_state->kick_np_queues = 1; -+ } -+ } -+ retval = dwc_otg_hcd_qh_add(hcd, *qh); -+ if (retval == 0) { -+ DWC_CIRCLEQ_INSERT_TAIL(&((*qh)->qtd_list), qtd, -+ qtd_list_entry); -+ qtd->qh = *qh; -+ } -+done: -+ -+ return retval; -+} -+ -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h -new file mode 100644 -index 0000000000000000000000000000000000000000..6b2c7d0c93f36a63863ff4b0ecc1f3eab77e058b ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h -@@ -0,0 +1,188 @@ -+#ifndef _DWC_OS_DEP_H_ -+#define _DWC_OS_DEP_H_ -+ -+/** -+ * @file -+ * -+ * This file contains OS dependent structures. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+# include -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -+# include -+#else -+# include -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -+# include -+#else -+# include -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+# include -+#endif -+ -+#ifdef PCI_INTERFACE -+# include -+#endif -+ -+#ifdef LM_INTERFACE -+# include -+# include -+# include -+# include -+# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -+# include -+# include -+# include -+# include -+# else -+/* in 2.6.31, at least, we seem to have lost the generic LM infrastructure - -+ here we assume that the machine architecture provides definitions -+ in its own header -+*/ -+# include -+# include -+# endif -+#endif -+ -+#ifdef PLATFORM_INTERFACE -+#include -+#include -+#endif -+ -+/** The OS page size */ -+#define DWC_OS_PAGE_SIZE PAGE_SIZE -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) -+typedef int gfp_t; -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+# define IRQF_SHARED SA_SHIRQ -+#endif -+ -+typedef struct os_dependent { -+ /** Base address returned from ioremap() */ -+ void *base; -+ -+ /** Register offset for Diagnostic API */ -+ uint32_t reg_offset; -+ -+ /** Base address for MPHI peripheral */ -+ void *mphi_base; -+ -+#ifdef LM_INTERFACE -+ struct lm_device *lmdev; -+#elif defined(PCI_INTERFACE) -+ struct pci_dev *pcidev; -+ -+ /** Start address of a PCI region */ -+ resource_size_t rsrc_start; -+ -+ /** Length address of a PCI region */ -+ resource_size_t rsrc_len; -+#elif defined(PLATFORM_INTERFACE) -+ struct platform_device *platformdev; -+#endif -+ -+} os_dependent_t; -+ -+#ifdef __cplusplus -+} -+#endif -+ -+ -+ -+/* Type for the our device on the chosen bus */ -+#if defined(LM_INTERFACE) -+typedef struct lm_device dwc_bus_dev_t; -+#elif defined(PCI_INTERFACE) -+typedef struct pci_dev dwc_bus_dev_t; -+#elif defined(PLATFORM_INTERFACE) -+typedef struct platform_device dwc_bus_dev_t; -+#endif -+ -+/* Helper macro to retrieve drvdata from the device on the chosen bus */ -+#if defined(LM_INTERFACE) -+#define DWC_OTG_BUSDRVDATA(_dev) lm_get_drvdata(_dev) -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_BUSDRVDATA(_dev) pci_get_drvdata(_dev) -+#elif defined(PLATFORM_INTERFACE) -+#define DWC_OTG_BUSDRVDATA(_dev) platform_get_drvdata(_dev) -+#endif -+ -+/** -+ * Helper macro returning the otg_device structure of a given struct device -+ * -+ * c.f. static dwc_otg_device_t *dwc_otg_drvdev(struct device *_dev) -+ */ -+#ifdef LM_INTERFACE -+#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ -+ struct lm_device *lm_dev = \ -+ container_of(_dev, struct lm_device, dev); \ -+ _var = lm_get_drvdata(lm_dev); \ -+ } while (0) -+ -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ -+ _var = dev_get_drvdata(_dev); \ -+ } while (0) -+ -+#elif defined(PLATFORM_INTERFACE) -+#define DWC_OTG_GETDRVDEV(_var, _dev) do { \ -+ struct platform_device *platform_dev = \ -+ container_of(_dev, struct platform_device, dev); \ -+ _var = platform_get_drvdata(platform_dev); \ -+ } while (0) -+#endif -+ -+ -+/** -+ * Helper macro returning the struct dev of the given struct os_dependent -+ * -+ * c.f. static struct device *dwc_otg_getdev(struct os_dependent *osdep) -+ */ -+#ifdef LM_INTERFACE -+#define DWC_OTG_OS_GETDEV(_osdep) \ -+ ((_osdep).lmdev == NULL? NULL: &(_osdep).lmdev->dev) -+#elif defined(PCI_INTERFACE) -+#define DWC_OTG_OS_GETDEV(_osdep) \ -+ ((_osdep).pci_dev == NULL? NULL: &(_osdep).pci_dev->dev) -+#elif defined(PLATFORM_INTERFACE) -+#define DWC_OTG_OS_GETDEV(_osdep) \ -+ ((_osdep).platformdev == NULL? NULL: &(_osdep).platformdev->dev) -+#endif -+ -+ -+ -+ -+#endif /* _DWC_OS_DEP_H_ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9dabbe5c9791c5296d1cc7b663afa6ec462173cb ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c -@@ -0,0 +1,2725 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $ -+ * $Revision: #101 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+/** @file -+ * This file implements PCD Core. All code in this file is portable and doesn't -+ * use any OS specific functions. -+ * PCD Core provides Interface, defined in -+ * header file, which can be used to implement OS specific PCD interface. -+ * -+ * An important function of the PCD is managing interrupts generated -+ * by the DWC_otg controller. The implementation of the DWC_otg device -+ * mode interrupt service routines is in dwc_otg_pcd_intr.c. -+ * -+ * @todo Add Device Mode test modes (Test J mode, Test K mode, etc). -+ * @todo Does it work when the request size is greater than DEPTSIZ -+ * transfer size -+ * -+ */ -+ -+#include "dwc_otg_pcd.h" -+ -+#ifdef DWC_UTE_CFI -+#include "dwc_otg_cfi.h" -+ -+extern int init_cfi(cfiobject_t * cfiobj); -+#endif -+ -+/** -+ * Choose endpoint from ep arrays using usb_ep structure. -+ */ -+static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) -+{ -+ int i; -+ if (pcd->ep0.priv == handle) { -+ return &pcd->ep0; -+ } -+ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { -+ if (pcd->in_ep[i].priv == handle) -+ return &pcd->in_ep[i]; -+ if (pcd->out_ep[i].priv == handle) -+ return &pcd->out_ep[i]; -+ } -+ -+ return NULL; -+} -+ -+/** -+ * This function completes a request. It call's the request call back. -+ */ -+void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req, -+ int32_t status) -+{ -+ unsigned stopped = ep->stopped; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(ep %p req %p)\n", __func__, ep, req); -+ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); -+ -+ /* don't modify queue heads during completion callback */ -+ ep->stopped = 1; -+ /* spin_unlock/spin_lock now done in fops->complete() */ -+ ep->pcd->fops->complete(ep->pcd, ep->priv, req->priv, status, -+ req->actual); -+ -+ if (ep->pcd->request_pending > 0) { -+ --ep->pcd->request_pending; -+ } -+ -+ ep->stopped = stopped; -+ DWC_FREE(req); -+} -+ -+/** -+ * This function terminates all the requsts in the EP request queue. -+ */ -+void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_pcd_request_t *req; -+ -+ ep->stopped = 1; -+ -+ /* called with irqs blocked?? */ -+ while (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ dwc_otg_request_done(ep, req, -DWC_E_SHUTDOWN); -+ } -+} -+ -+void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, -+ const struct dwc_otg_pcd_function_ops *fops) -+{ -+ pcd->fops = fops; -+} -+ -+/** -+ * PCD Callback function for initializing the PCD when switching to -+ * device mode. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_start_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ /* -+ * Initialized the Core for Device mode. -+ */ -+ if (dwc_otg_is_device_mode(core_if)) { -+ dwc_otg_core_dev_init(core_if); -+ /* Set core_if's lock pointer to the pcd->lock */ -+ core_if->lock = pcd->lock; -+ } -+ return 1; -+} -+ -+/** CFI-specific buffer allocation function for EP */ -+#ifdef DWC_UTE_CFI -+uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, -+ size_t buflen, int flags) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ ep = get_ep_from_handle(pcd, pep); -+ if (!ep) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ return pcd->cfi->ops.ep_alloc_buf(pcd->cfi, pcd, ep, addr, buflen, -+ flags); -+} -+#else -+uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, dwc_dma_t * addr, -+ size_t buflen, int flags); -+#endif -+ -+/** -+ * PCD Callback function for notifying the PCD when resuming from -+ * suspend. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_resume_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ -+ if (pcd->fops->resume) { -+ pcd->fops->resume(pcd); -+ } -+ -+ /* Stop the SRP timeout timer. */ -+ if ((GET_CORE_IF(pcd)->core_params->phy_type != DWC_PHY_TYPE_PARAM_FS) -+ || (!GET_CORE_IF(pcd)->core_params->i2c_enable)) { -+ if (GET_CORE_IF(pcd)->srp_timer_started) { -+ GET_CORE_IF(pcd)->srp_timer_started = 0; -+ DWC_TIMER_CANCEL(GET_CORE_IF(pcd)->srp_timer); -+ } -+ } -+ return 1; -+} -+ -+/** -+ * PCD Callback function for notifying the PCD device is suspended. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_suspend_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ -+ if (pcd->fops->suspend) { -+ DWC_SPINUNLOCK(pcd->lock); -+ pcd->fops->suspend(pcd); -+ DWC_SPINLOCK(pcd->lock); -+ } -+ -+ return 1; -+} -+ -+/** -+ * PCD Callback function for stopping the PCD when switching to Host -+ * mode. -+ * -+ * @param p void pointer to the dwc_otg_pcd_t -+ */ -+static int32_t dwc_otg_pcd_stop_cb(void *p) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) p; -+ extern void dwc_otg_pcd_stop(dwc_otg_pcd_t * _pcd); -+ -+ dwc_otg_pcd_stop(pcd); -+ return 1; -+} -+ -+/** -+ * PCD Callback structure for handling mode switching. -+ */ -+static dwc_otg_cil_callbacks_t pcd_callbacks = { -+ .start = dwc_otg_pcd_start_cb, -+ .stop = dwc_otg_pcd_stop_cb, -+ .suspend = dwc_otg_pcd_suspend_cb, -+ .resume_wakeup = dwc_otg_pcd_resume_cb, -+ .p = 0, /* Set at registration */ -+}; -+ -+/** -+ * This function allocates a DMA Descriptor chain for the Endpoint -+ * buffer to be used for a transfer to/from the specified endpoint. -+ */ -+dwc_otg_dev_dma_desc_t *dwc_otg_ep_alloc_desc_chain(struct device *dev, -+ dwc_dma_t * dma_desc_addr, -+ uint32_t count) -+{ -+ return DWC_DMA_ALLOC_ATOMIC(dev, count * sizeof(dwc_otg_dev_dma_desc_t), -+ dma_desc_addr); -+} -+ -+/** -+ * This function frees a DMA Descriptor chain that was allocated by ep_alloc_desc. -+ */ -+void dwc_otg_ep_free_desc_chain(struct device *dev, -+ dwc_otg_dev_dma_desc_t * desc_addr, -+ uint32_t dma_desc_addr, uint32_t count) -+{ -+ DWC_DMA_FREE(dev, count * sizeof(dwc_otg_dev_dma_desc_t), desc_addr, -+ dma_desc_addr); -+} -+ -+#ifdef DWC_EN_ISOC -+ -+/** -+ * This function initializes a descriptor chain for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_iso_ep_start_ddma_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * dwc_ep) -+{ -+ -+ dsts_data_t dsts = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ int i, j; -+ uint32_t len; -+ -+ if (dwc_ep->is_in) -+ dwc_ep->desc_cnt = dwc_ep->buf_proc_intrvl / dwc_ep->bInterval; -+ else -+ dwc_ep->desc_cnt = -+ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / -+ dwc_ep->bInterval; -+ -+ /** Allocate descriptors for double buffering */ -+ dwc_ep->iso_desc_addr = -+ dwc_otg_ep_alloc_desc_chain(&dwc_ep->iso_dma_desc_addr, -+ dwc_ep->desc_cnt * 2); -+ if (dwc_ep->desc_addr) { -+ DWC_WARN("%s, can't allocate DMA descriptor chain\n", __func__); -+ return; -+ } -+ -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ /** ISO OUT EP */ -+ if (dwc_ep->is_in == 0) { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; -+ dma_addr_t dma_ad; -+ uint32_t data_per_desc; -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[dwc_ep->num]; -+ int offset; -+ -+ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; -+ dma_ad = (dma_addr_t) DWC_READ_REG32(&(out_regs->doepdma)); -+ -+ /** Buffer 0 descriptors setup */ -+ dma_ad = dwc_ep->dma_addr0; -+ -+ sts.b_iso_out.bs = BS_HOST_READY; -+ sts.b_iso_out.rxsts = 0; -+ sts.b_iso_out.l = 0; -+ sts.b_iso_out.sp = 0; -+ sts.b_iso_out.ioc = 0; -+ sts.b_iso_out.pid = 0; -+ sts.b_iso_out.framenum = 0; -+ -+ offset = 0; -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ uint32_t len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ } -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ uint32_t len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ -+ sts.b_iso_out.ioc = 1; -+ len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ dma_desc++; -+ -+ /** Buffer 1 descriptors setup */ -+ sts.b_iso_out.ioc = 0; -+ dma_ad = dwc_ep->dma_addr1; -+ -+ offset = 0; -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ uint32_t len = (j + 1) * dwc_ep->maxpacket; -+ if (len > dwc_ep->data_per_frame) -+ data_per_desc = -+ dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket; -+ else -+ data_per_desc = dwc_ep->maxpacket; -+ len = data_per_desc % 4; -+ if (len) -+ data_per_desc += 4 - len; -+ -+ data_per_desc = -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ } -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ -+ sts.b_iso_out.ioc = 1; -+ sts.b_iso_out.l = 1; -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dwc_ep->next_frame = 0; -+ -+ /** Write dma_ad into DOEPDMA register */ -+ DWC_WRITE_REG32(&(out_regs->doepdma), -+ (uint32_t) dwc_ep->iso_dma_desc_addr); -+ -+ } -+ /** ISO IN EP */ -+ else { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc = dwc_ep->iso_desc_addr; -+ dma_addr_t dma_ad; -+ dwc_otg_dev_in_ep_regs_t *in_regs = -+ core_if->dev_if->in_ep_regs[dwc_ep->num]; -+ unsigned int frmnumber; -+ fifosize_data_t txfifosize, rxfifosize; -+ -+ txfifosize.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[dwc_ep->num]-> -+ dtxfsts); -+ rxfifosize.d32 = -+ DWC_READ_REG32(&core_if->core_global_regs->grxfsiz); -+ -+ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ -+ dma_ad = dwc_ep->dma_addr0; -+ -+ dsts.d32 = -+ DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ sts.b_iso_in.bs = BS_HOST_READY; -+ sts.b_iso_in.txsts = 0; -+ sts.b_iso_in.sp = -+ (dwc_ep->data_per_frame % dwc_ep->maxpacket) ? 1 : 0; -+ sts.b_iso_in.ioc = 0; -+ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; -+ -+ frmnumber = dwc_ep->next_frame; -+ -+ sts.b_iso_in.framenum = frmnumber; -+ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; -+ sts.b_iso_in.l = 0; -+ -+ /** Buffer 0 descriptors setup */ -+ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ dma_desc++; -+ -+ dma_ad += dwc_ep->data_per_frame; -+ sts.b_iso_in.framenum += dwc_ep->bInterval; -+ } -+ -+ sts.b_iso_in.ioc = 1; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ ++dma_desc; -+ -+ /** Buffer 1 descriptors setup */ -+ sts.b_iso_in.ioc = 0; -+ dma_ad = dwc_ep->dma_addr1; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ dma_desc++; -+ -+ dma_ad += dwc_ep->data_per_frame; -+ sts.b_iso_in.framenum += dwc_ep->bInterval; -+ -+ sts.b_iso_in.ioc = 0; -+ } -+ sts.b_iso_in.ioc = 1; -+ sts.b_iso_in.l = 1; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dwc_ep->next_frame = sts.b_iso_in.framenum + dwc_ep->bInterval; -+ -+ /** Write dma_ad into diepdma register */ -+ DWC_WRITE_REG32(&(in_regs->diepdma), -+ (uint32_t) dwc_ep->iso_dma_desc_addr); -+ } -+ /** Enable endpoint, clear nak */ -+ depctl.d32 = 0; -+ depctl.b.epena = 1; -+ depctl.b.usbactep = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); -+ depctl.d32 = DWC_READ_REG32(addr); -+} -+ -+/** -+ * This function initializes a descriptor chain for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void dwc_otg_iso_ep_start_buf_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ -+ if (ep->is_in) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ } -+ -+ if (core_if->dma_enable == 0 || core_if->dma_desc_enable != 0) { -+ return; -+ } else { -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ -+ ep->xfer_len = -+ ep->data_per_frame * ep->buf_proc_intrvl / ep->bInterval; -+ ep->pkt_cnt = -+ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; -+ ep->xfer_count = 0; -+ ep->xfer_buff = -+ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; -+ ep->dma_addr = -+ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; -+ -+ if (ep->is_in) { -+ /* Program the transfer size and packet count -+ * as follows: xfersize = N * maxpacket + -+ * short_packet pktcnt = N + (short_packet -+ * exist ? 1 : 0) -+ */ -+ deptsiz.b.mc = ep->pkt_per_frm; -+ deptsiz.b.xfersize = ep->xfer_len; -+ deptsiz.b.pktcnt = -+ (ep->xfer_len - 1 + ep->maxpacket) / ep->maxpacket; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ dieptsiz, deptsiz.d32); -+ -+ /* Write the DMA register */ -+ DWC_WRITE_REG32(& -+ (core_if->dev_if->in_ep_regs[ep->num]-> -+ diepdma), (uint32_t) ep->dma_addr); -+ -+ } else { -+ deptsiz.b.pktcnt = -+ (ep->xfer_len + (ep->maxpacket - 1)) / -+ ep->maxpacket; -+ deptsiz.b.xfersize = deptsiz.b.pktcnt * ep->maxpacket; -+ -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> -+ doeptsiz, deptsiz.d32); -+ -+ /* Write the DMA register */ -+ DWC_WRITE_REG32(& -+ (core_if->dev_if->out_ep_regs[ep->num]-> -+ doepdma), (uint32_t) ep->dma_addr); -+ -+ } -+ /** Enable endpoint, clear nak */ -+ depctl.d32 = 0; -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); -+ } -+} -+ -+/** -+ * This function does the setup for a data transfer for an EP and -+ * starts the transfer. For an IN transfer, the packets will be -+ * loaded into the appropriate Tx FIFO in the ISR. For OUT transfers, -+ * the packets are unloaded from the Rx FIFO in the ISR. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+ -+static void dwc_otg_iso_ep_start_transfer(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * ep) -+{ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ if (ep->is_in) { -+ ep->desc_cnt = ep->pkt_cnt / ep->pkt_per_frm; -+ } else { -+ ep->desc_cnt = ep->pkt_cnt; -+ } -+ dwc_otg_iso_ep_start_ddma_transfer(core_if, ep); -+ } else { -+ if (core_if->pti_enh_enable) { -+ dwc_otg_iso_ep_start_buf_transfer(core_if, ep); -+ } else { -+ ep->cur_pkt_addr = -+ (ep->proc_buf_num) ? ep->xfer_buff1 : ep-> -+ xfer_buff0; -+ ep->cur_pkt_dma_addr = -+ (ep->proc_buf_num) ? ep->dma_addr1 : ep-> -+ dma_addr0; -+ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); -+ } -+ } -+ } else { -+ ep->cur_pkt_addr = -+ (ep->proc_buf_num) ? ep->xfer_buff1 : ep->xfer_buff0; -+ ep->cur_pkt_dma_addr = -+ (ep->proc_buf_num) ? ep->dma_addr1 : ep->dma_addr0; -+ dwc_otg_iso_ep_start_frm_transfer(core_if, ep); -+ } -+} -+ -+/** -+ * This function stops transfer for an EP and -+ * resets the ep's variables. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ */ -+ -+void dwc_otg_iso_ep_stop_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ depctl_data_t depctl = {.d32 = 0 }; -+ volatile uint32_t *addr; -+ -+ if (ep->is_in == 1) { -+ addr = &core_if->dev_if->in_ep_regs[ep->num]->diepctl; -+ } else { -+ addr = &core_if->dev_if->out_ep_regs[ep->num]->doepctl; -+ } -+ -+ /* disable the ep */ -+ depctl.d32 = DWC_READ_REG32(addr); -+ -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ -+ DWC_WRITE_REG32(addr, depctl.d32); -+ -+ if (core_if->dma_desc_enable && -+ ep->iso_desc_addr && ep->iso_dma_desc_addr) { -+ dwc_otg_ep_free_desc_chain(ep->iso_desc_addr, -+ ep->iso_dma_desc_addr, -+ ep->desc_cnt * 2); -+ } -+ -+ /* reset varibales */ -+ ep->dma_addr0 = 0; -+ ep->dma_addr1 = 0; -+ ep->xfer_buff0 = 0; -+ ep->xfer_buff1 = 0; -+ ep->data_per_frame = 0; -+ ep->data_pattern_frame = 0; -+ ep->sync_frame = 0; -+ ep->buf_proc_intrvl = 0; -+ ep->bInterval = 0; -+ ep->proc_buf_num = 0; -+ ep->pkt_per_frm = 0; -+ ep->pkt_per_frm = 0; -+ ep->desc_cnt = 0; -+ ep->iso_desc_addr = 0; -+ ep->iso_dma_desc_addr = 0; -+} -+ -+int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf0, uint8_t * buf1, dwc_dma_t dma0, -+ dwc_dma_t dma1, int sync_frame, int dp_frame, -+ int data_per_frame, int start_frame, -+ int buf_proc_intrvl, void *req_handle, -+ int atomic_alloc) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags = 0; -+ dwc_ep_t *dwc_ep; -+ int32_t frm_data; -+ dsts_data_t dsts; -+ dwc_otg_core_if_t *core_if; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ core_if = GET_CORE_IF(pcd); -+ dwc_ep = &ep->dwc_ep; -+ -+ if (ep->iso_req_handle) { -+ DWC_WARN("ISO request in progress\n"); -+ } -+ -+ dwc_ep->dma_addr0 = dma0; -+ dwc_ep->dma_addr1 = dma1; -+ -+ dwc_ep->xfer_buff0 = buf0; -+ dwc_ep->xfer_buff1 = buf1; -+ -+ dwc_ep->data_per_frame = data_per_frame; -+ -+ /** @todo - pattern data support is to be implemented in the future */ -+ dwc_ep->data_pattern_frame = dp_frame; -+ dwc_ep->sync_frame = sync_frame; -+ -+ dwc_ep->buf_proc_intrvl = buf_proc_intrvl; -+ -+ dwc_ep->bInterval = 1 << (ep->desc->bInterval - 1); -+ -+ dwc_ep->proc_buf_num = 0; -+ -+ dwc_ep->pkt_per_frm = 0; -+ frm_data = ep->dwc_ep.data_per_frame; -+ while (frm_data > 0) { -+ dwc_ep->pkt_per_frm++; -+ frm_data -= ep->dwc_ep.maxpacket; -+ } -+ -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ if (start_frame == -1) { -+ dwc_ep->next_frame = dsts.b.soffn + 1; -+ if (dwc_ep->bInterval != 1) { -+ dwc_ep->next_frame = -+ dwc_ep->next_frame + (dwc_ep->bInterval - 1 - -+ dwc_ep->next_frame % -+ dwc_ep->bInterval); -+ } -+ } else { -+ dwc_ep->next_frame = start_frame; -+ } -+ -+ if (!core_if->pti_enh_enable) { -+ dwc_ep->pkt_cnt = -+ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / -+ dwc_ep->bInterval; -+ } else { -+ dwc_ep->pkt_cnt = -+ (dwc_ep->data_per_frame * -+ (dwc_ep->buf_proc_intrvl / dwc_ep->bInterval) -+ - 1 + dwc_ep->maxpacket) / dwc_ep->maxpacket; -+ } -+ -+ if (core_if->dma_desc_enable) { -+ dwc_ep->desc_cnt = -+ dwc_ep->buf_proc_intrvl * dwc_ep->pkt_per_frm / -+ dwc_ep->bInterval; -+ } -+ -+ if (atomic_alloc) { -+ dwc_ep->pkt_info = -+ DWC_ALLOC_ATOMIC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); -+ } else { -+ dwc_ep->pkt_info = -+ DWC_ALLOC(sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); -+ } -+ if (!dwc_ep->pkt_info) { -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_NO_MEMORY; -+ } -+ if (core_if->pti_enh_enable) { -+ dwc_memset(dwc_ep->pkt_info, 0, -+ sizeof(iso_pkt_info_t) * dwc_ep->pkt_cnt); -+ } -+ -+ dwc_ep->cur_pkt = 0; -+ ep->iso_req_handle = req_handle; -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ dwc_otg_iso_ep_start_transfer(core_if, dwc_ep); -+ return 0; -+} -+ -+int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle) -+{ -+ dwc_irqflags_t flags = 0; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep || !ep->desc || ep->dwc_ep.num == 0) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ dwc_ep = &ep->dwc_ep; -+ -+ dwc_otg_iso_ep_stop_transfer(GET_CORE_IF(pcd), dwc_ep); -+ -+ DWC_FREE(dwc_ep->pkt_info); -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ if (ep->iso_req_handle != req_handle) { -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ ep->iso_req_handle = 0; -+ return 0; -+} -+ -+/** -+ * This function is used for perodical data exchnage between PCD and gadget drivers. -+ * for Isochronous EPs -+ * -+ * - Every time a sync period completes this function is called to -+ * perform data exchange between PCD and gadget -+ */ -+void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, -+ void *req_handle) -+{ -+ int i; -+ dwc_ep_t *dwc_ep; -+ -+ dwc_ep = &ep->dwc_ep; -+ -+ DWC_SPINUNLOCK(ep->pcd->lock); -+ pcd->fops->isoc_complete(pcd, ep->priv, ep->iso_req_handle, -+ dwc_ep->proc_buf_num ^ 0x1); -+ DWC_SPINLOCK(ep->pcd->lock); -+ -+ for (i = 0; i < dwc_ep->pkt_cnt; ++i) { -+ dwc_ep->pkt_info[i].status = 0; -+ dwc_ep->pkt_info[i].offset = 0; -+ dwc_ep->pkt_info[i].length = 0; -+ } -+} -+ -+int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *iso_req_handle) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep->desc || ep->dwc_ep.num == 0) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ dwc_ep = &ep->dwc_ep; -+ -+ return dwc_ep->pkt_cnt; -+} -+ -+void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *iso_req_handle, int packet, -+ int *status, int *actual, int *offset) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep) -+ DWC_WARN("bad ep\n"); -+ -+ dwc_ep = &ep->dwc_ep; -+ -+ *status = dwc_ep->pkt_info[packet].status; -+ *actual = dwc_ep->pkt_info[packet].length; -+ *offset = dwc_ep->pkt_info[packet].offset; -+} -+ -+#endif /* DWC_EN_ISOC */ -+ -+static void dwc_otg_pcd_init_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * pcd_ep, -+ uint32_t is_in, uint32_t ep_num) -+{ -+ /* Init EP structure */ -+ pcd_ep->desc = 0; -+ pcd_ep->pcd = pcd; -+ pcd_ep->stopped = 1; -+ pcd_ep->queue_sof = 0; -+ -+ /* Init DWC ep structure */ -+ pcd_ep->dwc_ep.is_in = is_in; -+ pcd_ep->dwc_ep.num = ep_num; -+ pcd_ep->dwc_ep.active = 0; -+ pcd_ep->dwc_ep.tx_fifo_num = 0; -+ /* Control until ep is actvated */ -+ pcd_ep->dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; -+ pcd_ep->dwc_ep.maxpacket = MAX_PACKET_SIZE; -+ pcd_ep->dwc_ep.dma_addr = 0; -+ pcd_ep->dwc_ep.start_xfer_buff = 0; -+ pcd_ep->dwc_ep.xfer_buff = 0; -+ pcd_ep->dwc_ep.xfer_len = 0; -+ pcd_ep->dwc_ep.xfer_count = 0; -+ pcd_ep->dwc_ep.sent_zlp = 0; -+ pcd_ep->dwc_ep.total_len = 0; -+ pcd_ep->dwc_ep.desc_addr = 0; -+ pcd_ep->dwc_ep.dma_desc_addr = 0; -+ DWC_CIRCLEQ_INIT(&pcd_ep->queue); -+} -+ -+/** -+ * Initialize ep's -+ */ -+static void dwc_otg_pcd_reinit(dwc_otg_pcd_t * pcd) -+{ -+ int i; -+ uint32_t hwcfg1; -+ dwc_otg_pcd_ep_t *ep; -+ int in_ep_cntr, out_ep_cntr; -+ uint32_t num_in_eps = (GET_CORE_IF(pcd))->dev_if->num_in_eps; -+ uint32_t num_out_eps = (GET_CORE_IF(pcd))->dev_if->num_out_eps; -+ -+ /** -+ * Initialize the EP0 structure. -+ */ -+ ep = &pcd->ep0; -+ dwc_otg_pcd_init_ep(pcd, ep, 0, 0); -+ -+ in_ep_cntr = 0; -+ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 3; -+ for (i = 1; in_ep_cntr < num_in_eps; i++) { -+ if ((hwcfg1 & 0x1) == 0) { -+ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[in_ep_cntr]; -+ in_ep_cntr++; -+ /** -+ * @todo NGS: Add direction to EP, based on contents -+ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? -+ * sprintf(";r -+ */ -+ dwc_otg_pcd_init_ep(pcd, ep, 1 /* IN */ , i); -+ -+ DWC_CIRCLEQ_INIT(&ep->queue); -+ } -+ hwcfg1 >>= 2; -+ } -+ -+ out_ep_cntr = 0; -+ hwcfg1 = (GET_CORE_IF(pcd))->hwcfg1.d32 >> 2; -+ for (i = 1; out_ep_cntr < num_out_eps; i++) { -+ if ((hwcfg1 & 0x1) == 0) { -+ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[out_ep_cntr]; -+ out_ep_cntr++; -+ /** -+ * @todo NGS: Add direction to EP, based on contents -+ * of HWCFG1. Need a copy of HWCFG1 in pcd structure? -+ * sprintf(";r -+ */ -+ dwc_otg_pcd_init_ep(pcd, ep, 0 /* OUT */ , i); -+ DWC_CIRCLEQ_INIT(&ep->queue); -+ } -+ hwcfg1 >>= 2; -+ } -+ -+ pcd->ep0state = EP0_DISCONNECT; -+ pcd->ep0.dwc_ep.maxpacket = MAX_EP0_SIZE; -+ pcd->ep0.dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; -+} -+ -+/** -+ * This function is called when the SRP timer expires. The SRP should -+ * complete within 6 seconds. -+ */ -+static void srp_timeout(void *ptr) -+{ -+ gotgctl_data_t gotgctl; -+ dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr; -+ volatile uint32_t *addr = &core_if->core_global_regs->gotgctl; -+ -+ gotgctl.d32 = DWC_READ_REG32(addr); -+ -+ core_if->srp_timer_started = 0; -+ -+ if (core_if->adp_enable) { -+ if (gotgctl.b.bsesvld == 0) { -+ gpwrdn_data_t gpwrdn = {.d32 = 0 }; -+ DWC_PRINTF("SRP Timeout BSESSVLD = 0\n"); -+ /* Power off the core */ -+ if (core_if->power_down == 2) { -+ gpwrdn.b.pwrdnswtch = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ } -+ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuintsel = 1; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gpwrdn, 0, -+ gpwrdn.d32); -+ dwc_otg_adp_probe_start(core_if); -+ } else { -+ DWC_PRINTF("SRP Timeout BSESSVLD = 1\n"); -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ } -+ } -+ -+ if ((core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS) && -+ (core_if->core_params->i2c_enable)) { -+ DWC_PRINTF("SRP Timeout\n"); -+ -+ if ((core_if->srp_success) && (gotgctl.b.bsesvld)) { -+ if (core_if->pcd_cb && core_if->pcd_cb->resume_wakeup) { -+ core_if->pcd_cb->resume_wakeup(core_if->pcd_cb->p); -+ } -+ -+ /* Clear Session Request */ -+ gotgctl.d32 = 0; -+ gotgctl.b.sesreq = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gotgctl, -+ gotgctl.d32, 0); -+ -+ core_if->srp_success = 0; -+ } else { -+ __DWC_ERROR("Device not connected/responding\n"); -+ gotgctl.b.sesreq = 0; -+ DWC_WRITE_REG32(addr, gotgctl.d32); -+ } -+ } else if (gotgctl.b.sesreq) { -+ DWC_PRINTF("SRP Timeout\n"); -+ -+ __DWC_ERROR("Device not connected/responding\n"); -+ gotgctl.b.sesreq = 0; -+ DWC_WRITE_REG32(addr, gotgctl.d32); -+ } else { -+ DWC_PRINTF(" SRP GOTGCTL=%0x\n", gotgctl.d32); -+ } -+} -+ -+/** -+ * Tasklet -+ * -+ */ -+extern void start_next_request(dwc_otg_pcd_ep_t * ep); -+ -+static void start_xfer_tasklet_func(void *data) -+{ -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ int i; -+ depctl_data_t diepctl; -+ -+ DWC_DEBUGPL(DBG_PCDV, "Start xfer tasklet\n"); -+ -+ diepctl.d32 = DWC_READ_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl); -+ -+ if (pcd->ep0.queue_sof) { -+ pcd->ep0.queue_sof = 0; -+ start_next_request(&pcd->ep0); -+ // break; -+ } -+ -+ for (i = 0; i < core_if->dev_if->num_in_eps; i++) { -+ depctl_data_t diepctl; -+ diepctl.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[i]->diepctl); -+ -+ if (pcd->in_ep[i].queue_sof) { -+ pcd->in_ep[i].queue_sof = 0; -+ start_next_request(&pcd->in_ep[i]); -+ // break; -+ } -+ } -+ -+ return; -+} -+ -+/** -+ * This function initialized the PCD portion of the driver. -+ * -+ */ -+dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_device_t *otg_dev) -+{ -+ struct device *dev = &otg_dev->os_dep.platformdev->dev; -+ dwc_otg_core_if_t *core_if = otg_dev->core_if; -+ dwc_otg_pcd_t *pcd = NULL; -+ dwc_otg_dev_if_t *dev_if; -+ int i; -+ -+ /* -+ * Allocate PCD structure -+ */ -+ pcd = DWC_ALLOC(sizeof(dwc_otg_pcd_t)); -+ -+ if (pcd == NULL) { -+ return NULL; -+ } -+ -+#if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_SPINLOCK)) -+ DWC_SPINLOCK_ALLOC_LINUX_DEBUG(pcd->lock); -+#else -+ pcd->lock = DWC_SPINLOCK_ALLOC(); -+#endif -+ DWC_DEBUGPL(DBG_HCDV, "Init of PCD %p given core_if %p\n", -+ pcd, core_if);//GRAYG -+ if (!pcd->lock) { -+ DWC_ERROR("Could not allocate lock for pcd"); -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ /* Set core_if's lock pointer to hcd->lock */ -+ core_if->lock = pcd->lock; -+ pcd->core_if = core_if; -+ -+ dev_if = core_if->dev_if; -+ dev_if->isoc_ep = NULL; -+ -+ if (core_if->hwcfg4.b.ded_fifo_en) { -+ DWC_PRINTF("Dedicated Tx FIFOs mode\n"); -+ } else { -+ DWC_PRINTF("Shared Tx FIFO mode\n"); -+ } -+ -+ /* -+ * Initialized the Core for Device mode here if there is nod ADP support. -+ * Otherwise it will be done later in dwc_otg_adp_start routine. -+ */ -+ if (dwc_otg_is_device_mode(core_if) /*&& !core_if->adp_enable*/) { -+ dwc_otg_core_dev_init(core_if); -+ } -+ -+ /* -+ * Register the PCD Callbacks. -+ */ -+ dwc_otg_cil_register_pcd_callbacks(core_if, &pcd_callbacks, pcd); -+ -+ /* -+ * Initialize the DMA buffer for SETUP packets -+ */ -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ pcd->setup_pkt = -+ DWC_DMA_ALLOC(dev, sizeof(*pcd->setup_pkt) * 5, -+ &pcd->setup_pkt_dma_handle); -+ if (pcd->setup_pkt == NULL) { -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ -+ pcd->status_buf = -+ DWC_DMA_ALLOC(dev, sizeof(uint16_t), -+ &pcd->status_buf_dma_handle); -+ if (pcd->status_buf == NULL) { -+ DWC_DMA_FREE(dev, sizeof(*pcd->setup_pkt) * 5, -+ pcd->setup_pkt, pcd->setup_pkt_dma_handle); -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ dev_if->setup_desc_addr[0] = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_setup_desc_addr[0], 1); -+ dev_if->setup_desc_addr[1] = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_setup_desc_addr[1], 1); -+ dev_if->in_desc_addr = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_in_desc_addr, 1); -+ dev_if->out_desc_addr = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &dev_if->dma_out_desc_addr, 1); -+ pcd->data_terminated = 0; -+ -+ if (dev_if->setup_desc_addr[0] == 0 -+ || dev_if->setup_desc_addr[1] == 0 -+ || dev_if->in_desc_addr == 0 -+ || dev_if->out_desc_addr == 0) { -+ -+ if (dev_if->out_desc_addr) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->out_desc_addr, -+ dev_if->dma_out_desc_addr, 1); -+ if (dev_if->in_desc_addr) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->in_desc_addr, -+ dev_if->dma_in_desc_addr, 1); -+ if (dev_if->setup_desc_addr[1]) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[1], -+ dev_if->dma_setup_desc_addr[1], 1); -+ if (dev_if->setup_desc_addr[0]) -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[0], -+ dev_if->dma_setup_desc_addr[0], 1); -+ -+ DWC_DMA_FREE(dev, sizeof(*pcd->setup_pkt) * 5, -+ pcd->setup_pkt, -+ pcd->setup_pkt_dma_handle); -+ DWC_DMA_FREE(dev, sizeof(*pcd->status_buf), -+ pcd->status_buf, -+ pcd->status_buf_dma_handle); -+ -+ DWC_FREE(pcd); -+ -+ return NULL; -+ } -+ } -+ } else { -+ pcd->setup_pkt = DWC_ALLOC(sizeof(*pcd->setup_pkt) * 5); -+ if (pcd->setup_pkt == NULL) { -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ -+ pcd->status_buf = DWC_ALLOC(sizeof(uint16_t)); -+ if (pcd->status_buf == NULL) { -+ DWC_FREE(pcd->setup_pkt); -+ DWC_FREE(pcd); -+ return NULL; -+ } -+ } -+ -+ dwc_otg_pcd_reinit(pcd); -+ -+ /* Allocate the cfi object for the PCD */ -+#ifdef DWC_UTE_CFI -+ pcd->cfi = DWC_ALLOC(sizeof(cfiobject_t)); -+ if (NULL == pcd->cfi) -+ goto fail; -+ if (init_cfi(pcd->cfi)) { -+ CFI_INFO("%s: Failed to init the CFI object\n", __func__); -+ goto fail; -+ } -+#endif -+ -+ /* Initialize tasklets */ -+ pcd->start_xfer_tasklet = DWC_TASK_ALLOC("xfer_tasklet", -+ start_xfer_tasklet_func, pcd); -+ pcd->test_mode_tasklet = DWC_TASK_ALLOC("test_mode_tasklet", -+ do_test_mode, pcd); -+ -+ /* Initialize SRP timer */ -+ core_if->srp_timer = DWC_TIMER_ALLOC("SRP TIMER", srp_timeout, core_if); -+ -+ if (core_if->core_params->dev_out_nak) { -+ /** -+ * Initialize xfer timeout timer. Implemented for -+ * 2.93a feature "Device DDMA OUT NAK Enhancement" -+ */ -+ for(i = 0; i < MAX_EPS_CHANNELS; i++) { -+ pcd->core_if->ep_xfer_timer[i] = -+ DWC_TIMER_ALLOC("ep timer", ep_xfer_timeout, -+ &pcd->core_if->ep_xfer_info[i]); -+ } -+ } -+ -+ return pcd; -+#ifdef DWC_UTE_CFI -+fail: -+#endif -+ if (pcd->setup_pkt) -+ DWC_FREE(pcd->setup_pkt); -+ if (pcd->status_buf) -+ DWC_FREE(pcd->status_buf); -+#ifdef DWC_UTE_CFI -+ if (pcd->cfi) -+ DWC_FREE(pcd->cfi); -+#endif -+ if (pcd) -+ DWC_FREE(pcd); -+ return NULL; -+ -+} -+ -+/** -+ * Remove PCD specific data -+ */ -+void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ int i; -+ -+ if (pcd->core_if->core_params->dev_out_nak) { -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[i]); -+ pcd->core_if->ep_xfer_info[i].state = 0; -+ } -+ } -+ -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ DWC_DMA_FREE(dev, sizeof(*pcd->setup_pkt) * 5, pcd->setup_pkt, -+ pcd->setup_pkt_dma_handle); -+ DWC_DMA_FREE(dev, sizeof(uint16_t), pcd->status_buf, -+ pcd->status_buf_dma_handle); -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[0], -+ dev_if->dma_setup_desc_addr -+ [0], 1); -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->setup_desc_addr[1], -+ dev_if->dma_setup_desc_addr -+ [1], 1); -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->in_desc_addr, -+ dev_if->dma_in_desc_addr, 1); -+ dwc_otg_ep_free_desc_chain(dev, -+ dev_if->out_desc_addr, -+ dev_if->dma_out_desc_addr, -+ 1); -+ } -+ } else { -+ DWC_FREE(pcd->setup_pkt); -+ DWC_FREE(pcd->status_buf); -+ } -+ DWC_SPINLOCK_FREE(pcd->lock); -+ /* Set core_if's lock pointer to NULL */ -+ pcd->core_if->lock = NULL; -+ -+ DWC_TASK_FREE(pcd->start_xfer_tasklet); -+ DWC_TASK_FREE(pcd->test_mode_tasklet); -+ if (pcd->core_if->core_params->dev_out_nak) { -+ for (i = 0; i < MAX_EPS_CHANNELS; i++) { -+ if (pcd->core_if->ep_xfer_timer[i]) { -+ DWC_TIMER_FREE(pcd->core_if->ep_xfer_timer[i]); -+ } -+ } -+ } -+ -+/* Release the CFI object's dynamic memory */ -+#ifdef DWC_UTE_CFI -+ if (pcd->cfi->ops.release) { -+ pcd->cfi->ops.release(pcd->cfi); -+ } -+#endif -+ -+ DWC_FREE(pcd); -+} -+ -+/** -+ * Returns whether registered pcd is dual speed or not -+ */ -+uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) || -+ ((core_if->hwcfg2.b.hs_phy_type == 2) && -+ (core_if->hwcfg2.b.fs_phy_type == 1) && -+ (core_if->core_params->ulpi_fs_ls))) { -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/** -+ * Returns whether registered pcd is OTG capable or not -+ */ -+uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ gusbcfg_data_t usbcfg = {.d32 = 0 }; -+ -+ usbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg); -+ if (!usbcfg.b.srpcap || !usbcfg.b.hnpcap) { -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/** -+ * This function assigns periodic Tx FIFO to an periodic EP -+ * in shared Tx FIFO mode -+ */ -+static uint32_t assign_tx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t TxMsk = 1; -+ int i; -+ -+ for (i = 0; i < core_if->hwcfg4.b.num_in_eps; ++i) { -+ if ((TxMsk & core_if->tx_msk) == 0) { -+ core_if->tx_msk |= TxMsk; -+ return i + 1; -+ } -+ TxMsk <<= 1; -+ } -+ return 0; -+} -+ -+/** -+ * This function assigns periodic Tx FIFO to an periodic EP -+ * in shared Tx FIFO mode -+ */ -+static uint32_t assign_perio_tx_fifo(dwc_otg_core_if_t * core_if) -+{ -+ uint32_t PerTxMsk = 1; -+ int i; -+ for (i = 0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; ++i) { -+ if ((PerTxMsk & core_if->p_tx_msk) == 0) { -+ core_if->p_tx_msk |= PerTxMsk; -+ return i + 1; -+ } -+ PerTxMsk <<= 1; -+ } -+ return 0; -+} -+ -+/** -+ * This function releases periodic Tx FIFO -+ * in shared Tx FIFO mode -+ */ -+static void release_perio_tx_fifo(dwc_otg_core_if_t * core_if, -+ uint32_t fifo_num) -+{ -+ core_if->p_tx_msk = -+ (core_if->p_tx_msk & (1 << (fifo_num - 1))) ^ core_if->p_tx_msk; -+} -+ -+/** -+ * This function releases periodic Tx FIFO -+ * in shared Tx FIFO mode -+ */ -+static void release_tx_fifo(dwc_otg_core_if_t * core_if, uint32_t fifo_num) -+{ -+ core_if->tx_msk = -+ (core_if->tx_msk & (1 << (fifo_num - 1))) ^ core_if->tx_msk; -+} -+ -+/** -+ * This function is being called from gadget -+ * to enable PCD endpoint. -+ */ -+int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, -+ const uint8_t * ep_desc, void *usb_ep) -+{ -+ int num, dir; -+ dwc_otg_pcd_ep_t *ep = NULL; -+ const usb_endpoint_descriptor_t *desc; -+ dwc_irqflags_t flags; -+ fifosize_data_t dptxfsiz = {.d32 = 0 }; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; -+ int retval = 0; -+ int i, epcount; -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ -+ desc = (const usb_endpoint_descriptor_t *)ep_desc; -+ -+ if (!desc) { -+ pcd->ep0.priv = usb_ep; -+ ep = &pcd->ep0; -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ num = UE_GET_ADDR(desc->bEndpointAddress); -+ dir = UE_GET_DIR(desc->bEndpointAddress); -+ -+ if (!desc->wMaxPacketSize) { -+ DWC_WARN("bad maxpacketsize\n"); -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ if (dir == UE_DIR_IN) { -+ epcount = pcd->core_if->dev_if->num_in_eps; -+ for (i = 0; i < epcount; i++) { -+ if (num == pcd->in_ep[i].dwc_ep.num) { -+ ep = &pcd->in_ep[i]; -+ break; -+ } -+ } -+ } else { -+ epcount = pcd->core_if->dev_if->num_out_eps; -+ for (i = 0; i < epcount; i++) { -+ if (num == pcd->out_ep[i].dwc_ep.num) { -+ ep = &pcd->out_ep[i]; -+ break; -+ } -+ } -+ } -+ -+ if (!ep) { -+ DWC_WARN("bad address\n"); -+ retval = -DWC_E_INVALID; -+ goto out; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ ep->desc = desc; -+ ep->priv = usb_ep; -+ -+ /* -+ * Activate the EP -+ */ -+ ep->stopped = 0; -+ -+ ep->dwc_ep.is_in = (dir == UE_DIR_IN); -+ ep->dwc_ep.maxpacket = UGETW(desc->wMaxPacketSize); -+ -+ ep->dwc_ep.type = desc->bmAttributes & UE_XFERTYPE; -+ -+ if (ep->dwc_ep.is_in) { -+ if (!GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ ep->dwc_ep.tx_fifo_num = 0; -+ -+ if (ep->dwc_ep.type == UE_ISOCHRONOUS) { -+ /* -+ * if ISOC EP then assign a Periodic Tx FIFO. -+ */ -+ ep->dwc_ep.tx_fifo_num = -+ assign_perio_tx_fifo(GET_CORE_IF(pcd)); -+ } -+ } else { -+ /* -+ * if Dedicated FIFOs mode is on then assign a Tx FIFO. -+ */ -+ ep->dwc_ep.tx_fifo_num = -+ assign_tx_fifo(GET_CORE_IF(pcd)); -+ } -+ -+ /* Calculating EP info controller base address */ -+ if (ep->dwc_ep.tx_fifo_num -+ && GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ gdfifocfg.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)-> -+ core_global_regs->gdfifocfg); -+ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; -+ dptxfsiz.d32 = -+ (DWC_READ_REG32 -+ (&GET_CORE_IF(pcd)->core_global_regs-> -+ dtxfsiz[ep->dwc_ep.tx_fifo_num - 1]) >> 16); -+ gdfifocfg.b.epinfobase = -+ gdfifocfgbase.d32 + dptxfsiz.d32; -+ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> -+ core_global_regs->gdfifocfg, -+ gdfifocfg.d32); -+ } -+ } -+ } -+ /* Set initial data PID. */ -+ if (ep->dwc_ep.type == UE_BULK) { -+ ep->dwc_ep.data_pid_start = 0; -+ } -+ -+ /* Alloc DMA Descriptors */ -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+#ifndef DWC_UTE_PER_IO -+ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { -+#endif -+ ep->dwc_ep.desc_addr = -+ dwc_otg_ep_alloc_desc_chain(dev, -+ &ep->dwc_ep.dma_desc_addr, -+ MAX_DMA_DESC_CNT); -+ if (!ep->dwc_ep.desc_addr) { -+ DWC_WARN("%s, can't allocate DMA descriptor\n", -+ __func__); -+ retval = -DWC_E_SHUTDOWN; -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ goto out; -+ } -+#ifndef DWC_UTE_PER_IO -+ } -+#endif -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "Activate %s: type=%d, mps=%d desc=%p\n", -+ (ep->dwc_ep.is_in ? "IN" : "OUT"), -+ ep->dwc_ep.type, ep->dwc_ep.maxpacket, ep->desc); -+#ifdef DWC_UTE_PER_IO -+ ep->dwc_ep.xiso_bInterval = 1 << (ep->desc->bInterval - 1); -+#endif -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ ep->dwc_ep.bInterval = 1 << (ep->desc->bInterval - 1); -+ ep->dwc_ep.frame_num = 0xFFFFFFFF; -+ } -+ -+ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); -+ -+#ifdef DWC_UTE_CFI -+ if (pcd->cfi->ops.ep_enable) { -+ pcd->cfi->ops.ep_enable(pcd->cfi, pcd, ep); -+ } -+#endif -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+out: -+ return retval; -+} -+ -+/** -+ * This function is being called from gadget -+ * to disable PCD endpoint. -+ */ -+int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ dwc_otg_dev_dma_desc_t *desc_addr; -+ dwc_dma_t dma_desc_addr; -+ gdfifocfg_data_t gdfifocfgbase = {.d32 = 0 }; -+ gdfifocfg_data_t gdfifocfg = {.d32 = 0 }; -+ fifosize_data_t dptxfsiz = {.d32 = 0 }; -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if (!ep || !ep->desc) { -+ DWC_DEBUGPL(DBG_PCD, "bad ep address\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ dwc_otg_request_nuke(ep); -+ -+ dwc_otg_ep_deactivate(GET_CORE_IF(pcd), &ep->dwc_ep); -+ if (pcd->core_if->core_params->dev_out_nak) { -+ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[ep->dwc_ep.num]); -+ pcd->core_if->ep_xfer_info[ep->dwc_ep.num].state = 0; -+ } -+ ep->desc = NULL; -+ ep->stopped = 1; -+ -+ gdfifocfg.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg); -+ gdfifocfgbase.d32 = gdfifocfg.d32 >> 16; -+ -+ if (ep->dwc_ep.is_in) { -+ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ /* Flush the Tx FIFO */ -+ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), -+ ep->dwc_ep.tx_fifo_num); -+ } -+ release_perio_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); -+ release_tx_fifo(GET_CORE_IF(pcd), ep->dwc_ep.tx_fifo_num); -+ if (GET_CORE_IF(pcd)->en_multiple_tx_fifo) { -+ /* Decreasing EPinfo Base Addr */ -+ dptxfsiz.d32 = -+ (DWC_READ_REG32 -+ (&GET_CORE_IF(pcd)-> -+ core_global_regs->dtxfsiz[ep->dwc_ep.tx_fifo_num-1]) >> 16); -+ gdfifocfg.b.epinfobase = gdfifocfgbase.d32 - dptxfsiz.d32; -+ if (GET_CORE_IF(pcd)->snpsid <= OTG_CORE_REV_2_94a) { -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gdfifocfg, -+ gdfifocfg.d32); -+ } -+ } -+ } -+ -+ /* Free DMA Descriptors */ -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ if (ep->dwc_ep.type != UE_ISOCHRONOUS) { -+ desc_addr = ep->dwc_ep.desc_addr; -+ dma_desc_addr = ep->dwc_ep.dma_desc_addr; -+ -+ /* Cannot call dma_free_coherent() with IRQs disabled */ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ dwc_otg_ep_free_desc_chain(dev, desc_addr, dma_desc_addr, -+ MAX_DMA_DESC_CNT); -+ -+ goto out_unlocked; -+ } -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+out_unlocked: -+ DWC_DEBUGPL(DBG_PCD, "%d %s disabled\n", ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT"); -+ return 0; -+ -+} -+ -+/******************************************************************************/ -+#ifdef DWC_UTE_PER_IO -+ -+/** -+ * Free the request and its extended parts -+ * -+ */ -+void dwc_pcd_xiso_ereq_free(dwc_otg_pcd_ep_t * ep, dwc_otg_pcd_request_t * req) -+{ -+ DWC_FREE(req->ext_req.per_io_frame_descs); -+ DWC_FREE(req); -+} -+ -+/** -+ * Start the next request in the endpoint's queue. -+ * -+ */ -+int dwc_otg_pcd_xiso_start_next_request(dwc_otg_pcd_t * pcd, -+ dwc_otg_pcd_ep_t * ep) -+{ -+ int i; -+ dwc_otg_pcd_request_t *req = NULL; -+ dwc_ep_t *dwcep = NULL; -+ struct dwc_iso_xreq_port *ereq = NULL; -+ struct dwc_iso_pkt_desc_port *ddesc_iso; -+ uint16_t nat; -+ depctl_data_t diepctl; -+ -+ dwcep = &ep->dwc_ep; -+ -+ if (dwcep->xiso_active_xfers > 0) { -+#if 0 //Disable this to decrease s/w overhead that is crucial for Isoc transfers -+ DWC_WARN("There are currently active transfers for EP%d \ -+ (active=%d; queued=%d)", dwcep->num, dwcep->xiso_active_xfers, -+ dwcep->xiso_queued_xfers); -+#endif -+ return 0; -+ } -+ -+ nat = UGETW(ep->desc->wMaxPacketSize); -+ nat = (nat >> 11) & 0x03; -+ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ ereq = &req->ext_req; -+ ep->stopped = 0; -+ -+ /* Get the frame number */ -+ dwcep->xiso_frame_num = -+ dwc_otg_get_frame_number(GET_CORE_IF(pcd)); -+ DWC_DEBUG("FRM_NUM=%d", dwcep->xiso_frame_num); -+ -+ ddesc_iso = ereq->per_io_frame_descs; -+ -+ if (dwcep->is_in) { -+ /* Setup DMA Descriptor chain for IN Isoc request */ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ //if ((i % (nat + 1)) == 0) -+ if ( i > 0 ) -+ dwcep->xiso_frame_num = -+ (dwcep->xiso_bInterval + -+ dwcep->xiso_frame_num) & 0x3FFF; -+ dwcep->desc_addr[i].buf = -+ req->dma + ddesc_iso[i].offset; -+ dwcep->desc_addr[i].status.b_iso_in.txbytes = -+ ddesc_iso[i].length; -+ dwcep->desc_addr[i].status.b_iso_in.framenum = -+ dwcep->xiso_frame_num; -+ dwcep->desc_addr[i].status.b_iso_in.bs = -+ BS_HOST_READY; -+ dwcep->desc_addr[i].status.b_iso_in.txsts = 0; -+ dwcep->desc_addr[i].status.b_iso_in.sp = -+ (ddesc_iso[i].length % -+ dwcep->maxpacket) ? 1 : 0; -+ dwcep->desc_addr[i].status.b_iso_in.ioc = 0; -+ dwcep->desc_addr[i].status.b_iso_in.pid = nat + 1; -+ dwcep->desc_addr[i].status.b_iso_in.l = 0; -+ -+ /* Process the last descriptor */ -+ if (i == ereq->pio_pkt_count - 1) { -+ dwcep->desc_addr[i].status.b_iso_in.ioc = 1; -+ dwcep->desc_addr[i].status.b_iso_in.l = 1; -+ } -+ } -+ -+ /* Setup and start the transfer for this endpoint */ -+ dwcep->xiso_active_xfers++; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ in_ep_regs[dwcep->num]->diepdma, -+ dwcep->dma_desc_addr); -+ diepctl.d32 = 0; -+ diepctl.b.epena = 1; -+ diepctl.b.cnak = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ in_ep_regs[dwcep->num]->diepctl, 0, -+ diepctl.d32); -+ } else { -+ /* Setup DMA Descriptor chain for OUT Isoc request */ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ //if ((i % (nat + 1)) == 0) -+ dwcep->xiso_frame_num = (dwcep->xiso_bInterval + -+ dwcep->xiso_frame_num) & 0x3FFF; -+ dwcep->desc_addr[i].buf = -+ req->dma + ddesc_iso[i].offset; -+ dwcep->desc_addr[i].status.b_iso_out.rxbytes = -+ ddesc_iso[i].length; -+ dwcep->desc_addr[i].status.b_iso_out.framenum = -+ dwcep->xiso_frame_num; -+ dwcep->desc_addr[i].status.b_iso_out.bs = -+ BS_HOST_READY; -+ dwcep->desc_addr[i].status.b_iso_out.rxsts = 0; -+ dwcep->desc_addr[i].status.b_iso_out.sp = -+ (ddesc_iso[i].length % -+ dwcep->maxpacket) ? 1 : 0; -+ dwcep->desc_addr[i].status.b_iso_out.ioc = 0; -+ dwcep->desc_addr[i].status.b_iso_out.pid = nat + 1; -+ dwcep->desc_addr[i].status.b_iso_out.l = 0; -+ -+ /* Process the last descriptor */ -+ if (i == ereq->pio_pkt_count - 1) { -+ dwcep->desc_addr[i].status.b_iso_out.ioc = 1; -+ dwcep->desc_addr[i].status.b_iso_out.l = 1; -+ } -+ } -+ -+ /* Setup and start the transfer for this endpoint */ -+ dwcep->xiso_active_xfers++; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->out_ep_regs[dwcep->num]-> -+ doepdma, dwcep->dma_desc_addr); -+ diepctl.d32 = 0; -+ diepctl.b.epena = 1; -+ diepctl.b.cnak = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->out_ep_regs[dwcep->num]-> -+ doepctl, 0, diepctl.d32); -+ } -+ -+ } else { -+ ep->stopped = 1; -+ } -+ -+ return 0; -+} -+ -+/** -+ * - Remove the request from the queue -+ */ -+void complete_xiso_ep(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_pcd_request_t *req = NULL; -+ struct dwc_iso_xreq_port *ereq = NULL; -+ struct dwc_iso_pkt_desc_port *ddesc_iso = NULL; -+ dwc_ep_t *dwcep = NULL; -+ int i; -+ -+ //DWC_DEBUG(); -+ dwcep = &ep->dwc_ep; -+ -+ /* Get the first pending request from the queue */ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (!req) { -+ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); -+ return; -+ } -+ dwcep->xiso_active_xfers--; -+ dwcep->xiso_queued_xfers--; -+ /* Remove this request from the queue */ -+ DWC_CIRCLEQ_REMOVE_INIT(&ep->queue, req, queue_entry); -+ } else { -+ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); -+ return; -+ } -+ -+ ep->stopped = 1; -+ ereq = &req->ext_req; -+ ddesc_iso = ereq->per_io_frame_descs; -+ -+ if (dwcep->xiso_active_xfers < 0) { -+ DWC_WARN("EP#%d (xiso_active_xfers=%d)", dwcep->num, -+ dwcep->xiso_active_xfers); -+ } -+ -+ /* Fill the Isoc descs of portable extended req from dma descriptors */ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ if (dwcep->is_in) { /* IN endpoints */ -+ ddesc_iso[i].actual_length = ddesc_iso[i].length - -+ dwcep->desc_addr[i].status.b_iso_in.txbytes; -+ ddesc_iso[i].status = -+ dwcep->desc_addr[i].status.b_iso_in.txsts; -+ } else { /* OUT endpoints */ -+ ddesc_iso[i].actual_length = ddesc_iso[i].length - -+ dwcep->desc_addr[i].status.b_iso_out.rxbytes; -+ ddesc_iso[i].status = -+ dwcep->desc_addr[i].status.b_iso_out.rxsts; -+ } -+ } -+ -+ DWC_SPINUNLOCK(ep->pcd->lock); -+ -+ /* Call the completion function in the non-portable logic */ -+ ep->pcd->fops->xisoc_complete(ep->pcd, ep->priv, req->priv, 0, -+ &req->ext_req); -+ -+ DWC_SPINLOCK(ep->pcd->lock); -+ -+ /* Free the request - specific freeing needed for extended request object */ -+ dwc_pcd_xiso_ereq_free(ep, req); -+ -+ /* Start the next request */ -+ dwc_otg_pcd_xiso_start_next_request(ep->pcd, ep); -+ -+ return; -+} -+ -+/** -+ * Create and initialize the Isoc pkt descriptors of the extended request. -+ * -+ */ -+static int dwc_otg_pcd_xiso_create_pkt_descs(dwc_otg_pcd_request_t * req, -+ void *ereq_nonport, -+ int atomic_alloc) -+{ -+ struct dwc_iso_xreq_port *ereq = NULL; -+ struct dwc_iso_xreq_port *req_mapped = NULL; -+ struct dwc_iso_pkt_desc_port *ipds = NULL; /* To be created in this function */ -+ uint32_t pkt_count; -+ int i; -+ -+ ereq = &req->ext_req; -+ req_mapped = (struct dwc_iso_xreq_port *)ereq_nonport; -+ pkt_count = req_mapped->pio_pkt_count; -+ -+ /* Create the isoc descs */ -+ if (atomic_alloc) { -+ ipds = DWC_ALLOC_ATOMIC(sizeof(*ipds) * pkt_count); -+ } else { -+ ipds = DWC_ALLOC(sizeof(*ipds) * pkt_count); -+ } -+ -+ if (!ipds) { -+ DWC_ERROR("Failed to allocate isoc descriptors"); -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Initialize the extended request fields */ -+ ereq->per_io_frame_descs = ipds; -+ ereq->error_count = 0; -+ ereq->pio_alloc_pkt_count = pkt_count; -+ ereq->pio_pkt_count = pkt_count; -+ ereq->tr_sub_flags = req_mapped->tr_sub_flags; -+ -+ /* Init the Isoc descriptors */ -+ for (i = 0; i < pkt_count; i++) { -+ ipds[i].length = req_mapped->per_io_frame_descs[i].length; -+ ipds[i].offset = req_mapped->per_io_frame_descs[i].offset; -+ ipds[i].status = req_mapped->per_io_frame_descs[i].status; /* 0 */ -+ ipds[i].actual_length = -+ req_mapped->per_io_frame_descs[i].actual_length; -+ } -+ -+ return 0; -+} -+ -+static void prn_ext_request(struct dwc_iso_xreq_port *ereq) -+{ -+ struct dwc_iso_pkt_desc_port *xfd = NULL; -+ int i; -+ -+ DWC_DEBUG("per_io_frame_descs=%p", ereq->per_io_frame_descs); -+ DWC_DEBUG("tr_sub_flags=%d", ereq->tr_sub_flags); -+ DWC_DEBUG("error_count=%d", ereq->error_count); -+ DWC_DEBUG("pio_alloc_pkt_count=%d", ereq->pio_alloc_pkt_count); -+ DWC_DEBUG("pio_pkt_count=%d", ereq->pio_pkt_count); -+ DWC_DEBUG("res=%d", ereq->res); -+ -+ for (i = 0; i < ereq->pio_pkt_count; i++) { -+ xfd = &ereq->per_io_frame_descs[0]; -+ DWC_DEBUG("FD #%d", i); -+ -+ DWC_DEBUG("xfd->actual_length=%d", xfd->actual_length); -+ DWC_DEBUG("xfd->length=%d", xfd->length); -+ DWC_DEBUG("xfd->offset=%d", xfd->offset); -+ DWC_DEBUG("xfd->status=%d", xfd->status); -+ } -+} -+ -+/** -+ * -+ */ -+int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, -+ int zero, void *req_handle, int atomic_alloc, -+ void *ereq_nonport) -+{ -+ dwc_otg_pcd_request_t *req = NULL; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ int res; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ /* We support this extension only for DDMA mode */ -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) -+ if (!GET_CORE_IF(pcd)->dma_desc_enable) -+ return -DWC_E_INVALID; -+ -+ /* Create a dwc_otg_pcd_request_t object */ -+ if (atomic_alloc) { -+ req = DWC_ALLOC_ATOMIC(sizeof(*req)); -+ } else { -+ req = DWC_ALLOC(sizeof(*req)); -+ } -+ -+ if (!req) { -+ return -DWC_E_NO_MEMORY; -+ } -+ -+ /* Create the Isoc descs for this request which shall be the exact match -+ * of the structure sent to us from the non-portable logic */ -+ res = -+ dwc_otg_pcd_xiso_create_pkt_descs(req, ereq_nonport, atomic_alloc); -+ if (res) { -+ DWC_WARN("Failed to init the Isoc descriptors"); -+ DWC_FREE(req); -+ return res; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); -+ req->buf = buf; -+ req->dma = dma_buf; -+ req->length = buflen; -+ req->sent_zlp = zero; -+ req->priv = req_handle; -+ -+ //DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ ep->dwc_ep.dma_addr = dma_buf; -+ ep->dwc_ep.start_xfer_buff = buf; -+ ep->dwc_ep.xfer_buff = buf; -+ ep->dwc_ep.xfer_len = 0; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = buflen; -+ -+ /* Add this request to the tail */ -+ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); -+ ep->dwc_ep.xiso_queued_xfers++; -+ -+//DWC_DEBUG("CP_0"); -+//DWC_DEBUG("req->ext_req.tr_sub_flags=%d", req->ext_req.tr_sub_flags); -+//prn_ext_request((struct dwc_iso_xreq_port *) ereq_nonport); -+//prn_ext_request(&req->ext_req); -+ -+ //DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ /* If the req->status == ASAP then check if there is any active transfer -+ * for this endpoint. If no active transfers, then get the first entry -+ * from the queue and start that transfer -+ */ -+ if (req->ext_req.tr_sub_flags == DWC_EREQ_TF_ASAP) { -+ res = dwc_otg_pcd_xiso_start_next_request(pcd, ep); -+ if (res) { -+ DWC_WARN("Failed to start the next Isoc transfer"); -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ DWC_FREE(req); -+ return res; -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return 0; -+} -+ -+#endif -+/* END ifdef DWC_UTE_PER_IO ***************************************************/ -+int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, -+ int zero, void *req_handle, int atomic_alloc) -+{ -+ struct device *dev = dwc_otg_pcd_to_dev(pcd); -+ dwc_irqflags_t flags; -+ dwc_otg_pcd_request_t *req; -+ dwc_otg_pcd_ep_t *ep; -+ uint32_t max_transfer; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { -+ DWC_WARN("bad ep\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ if (atomic_alloc) { -+ req = DWC_ALLOC_ATOMIC(sizeof(*req)); -+ } else { -+ req = DWC_ALLOC(sizeof(*req)); -+ } -+ -+ if (!req) { -+ return -DWC_E_NO_MEMORY; -+ } -+ DWC_CIRCLEQ_INIT_ENTRY(req, queue_entry); -+ if (!GET_CORE_IF(pcd)->core_params->opt) { -+ if (ep->dwc_ep.num != 0) { -+ DWC_ERROR("queue req %p, len %d buf %p\n", -+ req_handle, buflen, buf); -+ } -+ } -+ -+ req->buf = buf; -+ req->dma = dma_buf; -+ req->length = buflen; -+ req->sent_zlp = zero; -+ req->priv = req_handle; -+ req->dw_align_buf = NULL; -+ if ((dma_buf & 0x3) && GET_CORE_IF(pcd)->dma_enable -+ && !GET_CORE_IF(pcd)->dma_desc_enable) -+ req->dw_align_buf = DWC_DMA_ALLOC(dev, buflen, -+ &req->dw_align_buf_dma); -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ /* -+ * After adding request to the queue for IN ISOC wait for In Token Received -+ * when TX FIFO is empty interrupt and for OUT ISOC wait for OUT Token -+ * Received when EP is disabled interrupt to obtain starting microframe -+ * (odd/even) start transfer -+ */ -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ if (req != 0) { -+ depctl_data_t depctl = {.d32 = -+ DWC_READ_REG32(&pcd->core_if->dev_if-> -+ in_ep_regs[ep->dwc_ep.num]-> -+ diepctl) }; -+ ++pcd->request_pending; -+ -+ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); -+ if (ep->dwc_ep.is_in) { -+ depctl.b.cnak = 1; -+ DWC_WRITE_REG32(&pcd->core_if->dev_if-> -+ in_ep_regs[ep->dwc_ep.num]-> -+ diepctl, depctl.d32); -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ } -+ return 0; -+ } -+ -+ /* -+ * For EP0 IN without premature status, zlp is required? -+ */ -+ if (ep->dwc_ep.num == 0 && ep->dwc_ep.is_in) { -+ DWC_DEBUGPL(DBG_PCDV, "%d-OUT ZLP\n", ep->dwc_ep.num); -+ //_req->zero = 1; -+ } -+ -+ /* Start the transfer */ -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue) && !ep->stopped) { -+ /* EP0 Transfer? */ -+ if (ep->dwc_ep.num == 0) { -+ switch (pcd->ep0state) { -+ case EP0_IN_DATA_PHASE: -+ DWC_DEBUGPL(DBG_PCD, -+ "%s ep0: EP0_IN_DATA_PHASE\n", -+ __func__); -+ break; -+ -+ case EP0_OUT_DATA_PHASE: -+ DWC_DEBUGPL(DBG_PCD, -+ "%s ep0: EP0_OUT_DATA_PHASE\n", -+ __func__); -+ if (pcd->request_config) { -+ /* Complete STATUS PHASE */ -+ ep->dwc_ep.is_in = 1; -+ pcd->ep0state = EP0_IN_STATUS_PHASE; -+ } -+ break; -+ -+ case EP0_IN_STATUS_PHASE: -+ DWC_DEBUGPL(DBG_PCD, -+ "%s ep0: EP0_IN_STATUS_PHASE\n", -+ __func__); -+ break; -+ -+ default: -+ DWC_DEBUGPL(DBG_ANY, "ep0: odd state %d\n", -+ pcd->ep0state); -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_SHUTDOWN; -+ } -+ -+ ep->dwc_ep.dma_addr = dma_buf; -+ ep->dwc_ep.start_xfer_buff = buf; -+ ep->dwc_ep.xfer_buff = buf; -+ ep->dwc_ep.xfer_len = buflen; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; -+ -+ if (zero) { -+ if ((ep->dwc_ep.xfer_len % -+ ep->dwc_ep.maxpacket == 0) -+ && (ep->dwc_ep.xfer_len != 0)) { -+ ep->dwc_ep.sent_zlp = 1; -+ } -+ -+ } -+ -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } // non-ep0 endpoints -+ else { -+#ifdef DWC_UTE_CFI -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ /* store the request length */ -+ ep->dwc_ep.cfi_req_len = buflen; -+ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, -+ ep, req); -+ } else { -+#endif -+ max_transfer = -+ GET_CORE_IF(ep->pcd)->core_params-> -+ max_transfer_size; -+ -+ /* Setup and start the Transfer */ -+ if (req->dw_align_buf){ -+ if (ep->dwc_ep.is_in) -+ dwc_memcpy(req->dw_align_buf, -+ buf, buflen); -+ ep->dwc_ep.dma_addr = -+ req->dw_align_buf_dma; -+ ep->dwc_ep.start_xfer_buff = -+ req->dw_align_buf; -+ ep->dwc_ep.xfer_buff = -+ req->dw_align_buf; -+ } else { -+ ep->dwc_ep.dma_addr = dma_buf; -+ ep->dwc_ep.start_xfer_buff = buf; -+ ep->dwc_ep.xfer_buff = buf; -+ } -+ ep->dwc_ep.xfer_len = 0; -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = buflen; -+ -+ ep->dwc_ep.maxxfer = max_transfer; -+ if (GET_CORE_IF(pcd)->dma_desc_enable) { -+ uint32_t out_max_xfer = -+ DDMA_MAX_TRANSFER_SIZE - -+ (DDMA_MAX_TRANSFER_SIZE % 4); -+ if (ep->dwc_ep.is_in) { -+ if (ep->dwc_ep.maxxfer > -+ DDMA_MAX_TRANSFER_SIZE) { -+ ep->dwc_ep.maxxfer = -+ DDMA_MAX_TRANSFER_SIZE; -+ } -+ } else { -+ if (ep->dwc_ep.maxxfer > -+ out_max_xfer) { -+ ep->dwc_ep.maxxfer = -+ out_max_xfer; -+ } -+ } -+ } -+ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { -+ ep->dwc_ep.maxxfer -= -+ (ep->dwc_ep.maxxfer % -+ ep->dwc_ep.maxpacket); -+ } -+ -+ if (zero) { -+ if ((ep->dwc_ep.total_len % -+ ep->dwc_ep.maxpacket == 0) -+ && (ep->dwc_ep.total_len != 0)) { -+ ep->dwc_ep.sent_zlp = 1; -+ } -+ } -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ dwc_otg_ep_start_transfer(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } -+ } -+ -+ if (req != 0) { -+ ++pcd->request_pending; -+ DWC_CIRCLEQ_INSERT_TAIL(&ep->queue, req, queue_entry); -+ if (ep->dwc_ep.is_in && ep->stopped -+ && !(GET_CORE_IF(pcd)->dma_enable)) { -+ /** @todo NGS Create a function for this. */ -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.intktxfemp = 1; -+ if (GET_CORE_IF(pcd)->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->dev_global_regs->diepeachintmsk -+ [ep->dwc_ep.num], 0, -+ diepmsk.d32); -+ } else { -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->dev_global_regs-> -+ diepmsk, 0, diepmsk.d32); -+ } -+ -+ } -+ } -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return 0; -+} -+ -+int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle) -+{ -+ dwc_irqflags_t flags; -+ dwc_otg_pcd_request_t *req; -+ dwc_otg_pcd_ep_t *ep; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ if (!ep || (!ep->desc && ep->dwc_ep.num != 0)) { -+ DWC_WARN("bad argument\n"); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ -+ /* make sure it's actually queued on this endpoint */ -+ DWC_CIRCLEQ_FOREACH(req, &ep->queue, queue_entry) { -+ if (req->priv == (void *)req_handle) { -+ break; -+ } -+ } -+ -+ if (req->priv != (void *)req_handle) { -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ return -DWC_E_INVALID; -+ } -+ -+ if (!DWC_CIRCLEQ_EMPTY_ENTRY(req, queue_entry)) { -+ dwc_otg_request_done(ep, req, -DWC_E_RESTART); -+ } else { -+ req = NULL; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return req ? 0 : -DWC_E_SHUTDOWN; -+ -+} -+ -+/** -+ * dwc_otg_pcd_ep_wedge - sets the halt feature and ignores clear requests -+ * -+ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) -+ * requests. If the gadget driver clears the halt status, it will -+ * automatically unwedge the endpoint. -+ * -+ * Returns zero on success, else negative DWC error code. -+ */ -+int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ int retval = 0; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if ((!ep->desc && ep != &pcd->ep0) || -+ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { -+ DWC_WARN("%s, bad ep\n", __func__); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT"); -+ retval = -DWC_E_AGAIN; -+ } else { -+ /* This code needs to be reviewed */ -+ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { -+ dtxfsts_data_t txstatus; -+ fifosize_data_t txfifosize; -+ -+ txfifosize.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)-> -+ core_global_regs->dtxfsiz[ep->dwc_ep. -+ tx_fifo_num]); -+ txstatus.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)-> -+ dev_if->in_ep_regs[ep->dwc_ep.num]-> -+ dtxfsts); -+ -+ if (txstatus.b.txfspcavail < txfifosize.b.depth) { -+ DWC_WARN("%s() Data In Tx Fifo\n", __func__); -+ retval = -DWC_E_AGAIN; -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ } -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return retval; -+} -+ -+int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ dwc_irqflags_t flags; -+ int retval = 0; -+ -+ ep = get_ep_from_handle(pcd, ep_handle); -+ -+ if (!ep || (!ep->desc && ep != &pcd->ep0) || -+ (ep->desc && (ep->desc->bmAttributes == UE_ISOCHRONOUS))) { -+ DWC_WARN("%s, bad ep\n", __func__); -+ return -DWC_E_INVALID; -+ } -+ -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_WARN("%d %s XFer In process\n", ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT"); -+ retval = -DWC_E_AGAIN; -+ } else if (value == 0) { -+ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ } else if (value == 1) { -+ if (ep->dwc_ep.is_in == 1 && GET_CORE_IF(pcd)->dma_desc_enable) { -+ dtxfsts_data_t txstatus; -+ fifosize_data_t txfifosize; -+ -+ txfifosize.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->core_global_regs-> -+ dtxfsiz[ep->dwc_ep.tx_fifo_num]); -+ txstatus.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ in_ep_regs[ep->dwc_ep.num]->dtxfsts); -+ -+ if (txstatus.b.txfspcavail < txfifosize.b.depth) { -+ DWC_WARN("%s() Data In Tx Fifo\n", __func__); -+ retval = -DWC_E_AGAIN; -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), -+ &ep->dwc_ep); -+ } -+ } else { -+ if (ep->dwc_ep.num == 0) { -+ pcd->ep0state = EP0_STALL; -+ } -+ -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ } -+ } else if (value == 2) { -+ ep->dwc_ep.stall_clear_flag = 0; -+ } else if (value == 3) { -+ ep->dwc_ep.stall_clear_flag = 1; -+ } -+ -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ -+ return retval; -+} -+ -+/** -+ * This function initiates remote wakeup of the host from suspend state. -+ */ -+void dwc_otg_pcd_rem_wkup_from_suspend(dwc_otg_pcd_t * pcd, int set) -+{ -+ dctl_data_t dctl = { 0 }; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dsts_data_t dsts; -+ -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ if (!dsts.b.suspsts) { -+ DWC_WARN("Remote wakeup while is not in suspend state\n"); -+ } -+ /* Check if DEVICE_REMOTE_WAKEUP feature enabled */ -+ if (pcd->remote_wakeup_enable) { -+ if (set) { -+ -+ if (core_if->adp_enable) { -+ gpwrdn_data_t gpwrdn; -+ -+ dwc_otg_adp_probe_stop(core_if); -+ -+ /* Mask SRP detected interrupt from Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.srp_det_msk = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ -+ /* Disable Power Down Logic */ -+ gpwrdn.d32 = 0; -+ gpwrdn.b.pmuactv = 1; -+ DWC_MODIFY_REG32(&core_if-> -+ core_global_regs->gpwrdn, -+ gpwrdn.d32, 0); -+ -+ /* -+ * Initialize the Core for Device mode. -+ */ -+ core_if->op_state = B_PERIPHERAL; -+ dwc_otg_core_init(core_if); -+ dwc_otg_enable_global_interrupts(core_if); -+ cil_pcd_start(core_if); -+ -+ dwc_otg_initiate_srp(core_if); -+ } -+ -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, 0, dctl.d32); -+ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); -+ -+ dwc_mdelay(2); -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ dctl, dctl.d32, 0); -+ DWC_DEBUGPL(DBG_PCD, "Clear Remote Wakeup\n"); -+ } -+ } else { -+ DWC_DEBUGPL(DBG_PCD, "Remote Wakeup is disabled\n"); -+ } -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+/** -+ * This function initiates remote wakeup of the host from L1 sleep state. -+ */ -+void dwc_otg_pcd_rem_wkup_from_sleep(dwc_otg_pcd_t * pcd, int set) -+{ -+ glpmcfg_data_t lpmcfg; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ -+ /* Check if we are in L1 state */ -+ if (!lpmcfg.b.prt_sleep_sts) { -+ DWC_DEBUGPL(DBG_PCD, "Device is not in sleep state\n"); -+ return; -+ } -+ -+ /* Check if host allows remote wakeup */ -+ if (!lpmcfg.b.rem_wkup_en) { -+ DWC_DEBUGPL(DBG_PCD, "Host does not allow remote wakeup\n"); -+ return; -+ } -+ -+ /* Check if Resume OK */ -+ if (!lpmcfg.b.sleep_state_resumeok) { -+ DWC_DEBUGPL(DBG_PCD, "Sleep state resume is not OK\n"); -+ return; -+ } -+ -+ lpmcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->glpmcfg); -+ lpmcfg.b.en_utmi_sleep = 0; -+ lpmcfg.b.hird_thres &= (~(1 << 4)); -+ DWC_WRITE_REG32(&core_if->core_global_regs->glpmcfg, lpmcfg.d32); -+ -+ if (set) { -+ dctl_data_t dctl = {.d32 = 0 }; -+ dctl.b.rmtwkupsig = 1; -+ /* Set RmtWkUpSig bit to start remote wakup signaling. -+ * Hardware will automatically clear this bit. -+ */ -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ 0, dctl.d32); -+ DWC_DEBUGPL(DBG_PCD, "Set Remote Wakeup\n"); -+ } -+ -+} -+#endif -+ -+/** -+ * Performs remote wakeup. -+ */ -+void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_irqflags_t flags; -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ if (core_if->lx_state == DWC_OTG_L1) { -+ dwc_otg_pcd_rem_wkup_from_sleep(pcd, set); -+ } else { -+#endif -+ dwc_otg_pcd_rem_wkup_from_suspend(pcd, set); -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ } -+#endif -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+ } -+ return; -+} -+ -+void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dctl_data_t dctl = { 0 }; -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ dctl.b.sftdiscon = 1; -+ DWC_PRINTF("Soft disconnect for %d useconds\n",no_of_usecs); -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); -+ dwc_udelay(no_of_usecs); -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32,0); -+ -+ } else{ -+ DWC_PRINTF("NOT SUPPORTED IN HOST MODE\n"); -+ } -+ return; -+ -+} -+ -+int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd) -+{ -+ dsts_data_t dsts; -+ gotgctl_data_t gotgctl; -+ -+ /* -+ * This function starts the Protocol if no session is in progress. If -+ * a session is already in progress, but the device is suspended, -+ * remote wakeup signaling is started. -+ */ -+ -+ /* Check if valid session */ -+ gotgctl.d32 = -+ DWC_READ_REG32(&(GET_CORE_IF(pcd)->core_global_regs->gotgctl)); -+ if (gotgctl.b.bsesvld) { -+ /* Check if suspend state */ -+ dsts.d32 = -+ DWC_READ_REG32(& -+ (GET_CORE_IF(pcd)->dev_if-> -+ dev_global_regs->dsts)); -+ if (dsts.b.suspsts) { -+ dwc_otg_pcd_remote_wakeup(pcd, 1); -+ } -+ } else { -+ dwc_otg_pcd_initiate_srp(pcd); -+ } -+ -+ return 0; -+ -+} -+ -+/** -+ * Start the SRP timer to detect when the SRP does not complete within -+ * 6 seconds. -+ * -+ * @param pcd the pcd structure. -+ */ -+void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd) -+{ -+ dwc_irqflags_t flags; -+ DWC_SPINLOCK_IRQSAVE(pcd->lock, &flags); -+ dwc_otg_initiate_srp(GET_CORE_IF(pcd)); -+ DWC_SPINUNLOCK_IRQRESTORE(pcd->lock, flags); -+} -+ -+int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd) -+{ -+ return dwc_otg_get_frame_number(GET_CORE_IF(pcd)); -+} -+ -+int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd) -+{ -+ return GET_CORE_IF(pcd)->core_params->lpm_enable; -+} -+ -+uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->b_hnp_enable; -+} -+ -+uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->a_hnp_support; -+} -+ -+uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->a_alt_hnp_support; -+} -+ -+int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd) -+{ -+ return pcd->remote_wakeup_enable; -+} -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h -new file mode 100644 -index 0000000000000000000000000000000000000000..a70ebd049d2cca3bf988a1f809832eebede14f96 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h -@@ -0,0 +1,273 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $ -+ * $Revision: #48 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+#if !defined(__DWC_PCD_H__) -+#define __DWC_PCD_H__ -+ -+#include "dwc_otg_os_dep.h" -+#include "usb.h" -+#include "dwc_otg_cil.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_driver.h" -+ -+struct cfiobject; -+ -+/** -+ * @file -+ * -+ * This file contains the structures, constants, and interfaces for -+ * the Perpherial Contoller Driver (PCD). -+ * -+ * The Peripheral Controller Driver (PCD) for Linux will implement the -+ * Gadget API, so that the existing Gadget drivers can be used. For -+ * the Mass Storage Function driver the File-backed USB Storage Gadget -+ * (FBS) driver will be used. The FBS driver supports the -+ * Control-Bulk (CB), Control-Bulk-Interrupt (CBI), and Bulk-Only -+ * transports. -+ * -+ */ -+ -+/** Invalid DMA Address */ -+#define DWC_DMA_ADDR_INVALID (~(dwc_dma_t)0) -+ -+/** Max Transfer size for any EP */ -+#define DDMA_MAX_TRANSFER_SIZE 65535 -+ -+/** -+ * Get the pointer to the core_if from the pcd pointer. -+ */ -+#define GET_CORE_IF( _pcd ) (_pcd->core_if) -+ -+/** -+ * States of EP0. -+ */ -+typedef enum ep0_state { -+ EP0_DISCONNECT, /* no host */ -+ EP0_IDLE, -+ EP0_IN_DATA_PHASE, -+ EP0_OUT_DATA_PHASE, -+ EP0_IN_STATUS_PHASE, -+ EP0_OUT_STATUS_PHASE, -+ EP0_STALL, -+} ep0state_e; -+ -+/** Fordward declaration.*/ -+struct dwc_otg_pcd; -+ -+/** DWC_otg iso request structure. -+ * -+ */ -+typedef struct usb_iso_request dwc_otg_pcd_iso_request_t; -+ -+#ifdef DWC_UTE_PER_IO -+ -+/** -+ * This shall be the exact analogy of the same type structure defined in the -+ * usb_gadget.h. Each descriptor contains -+ */ -+struct dwc_iso_pkt_desc_port { -+ uint32_t offset; -+ uint32_t length; /* expected length */ -+ uint32_t actual_length; -+ uint32_t status; -+}; -+ -+struct dwc_iso_xreq_port { -+ /** transfer/submission flag */ -+ uint32_t tr_sub_flags; -+ /** Start the request ASAP */ -+#define DWC_EREQ_TF_ASAP 0x00000002 -+ /** Just enqueue the request w/o initiating a transfer */ -+#define DWC_EREQ_TF_ENQUEUE 0x00000004 -+ -+ /** -+ * count of ISO packets attached to this request - shall -+ * not exceed the pio_alloc_pkt_count -+ */ -+ uint32_t pio_pkt_count; -+ /** count of ISO packets allocated for this request */ -+ uint32_t pio_alloc_pkt_count; -+ /** number of ISO packet errors */ -+ uint32_t error_count; -+ /** reserved for future extension */ -+ uint32_t res; -+ /** Will be allocated and freed in the UTE gadget and based on the CFC value */ -+ struct dwc_iso_pkt_desc_port *per_io_frame_descs; -+}; -+#endif -+/** DWC_otg request structure. -+ * This structure is a list of requests. -+ */ -+typedef struct dwc_otg_pcd_request { -+ void *priv; -+ void *buf; -+ dwc_dma_t dma; -+ uint32_t length; -+ uint32_t actual; -+ unsigned sent_zlp:1; -+ /** -+ * Used instead of original buffer if -+ * it(physical address) is not dword-aligned. -+ **/ -+ uint8_t *dw_align_buf; -+ dwc_dma_t dw_align_buf_dma; -+ -+ DWC_CIRCLEQ_ENTRY(dwc_otg_pcd_request) queue_entry; -+#ifdef DWC_UTE_PER_IO -+ struct dwc_iso_xreq_port ext_req; -+ //void *priv_ereq_nport; /* */ -+#endif -+} dwc_otg_pcd_request_t; -+ -+DWC_CIRCLEQ_HEAD(req_list, dwc_otg_pcd_request); -+ -+/** PCD EP structure. -+ * This structure describes an EP, there is an array of EPs in the PCD -+ * structure. -+ */ -+typedef struct dwc_otg_pcd_ep { -+ /** USB EP Descriptor */ -+ const usb_endpoint_descriptor_t *desc; -+ -+ /** queue of dwc_otg_pcd_requests. */ -+ struct req_list queue; -+ unsigned stopped:1; -+ unsigned disabling:1; -+ unsigned dma:1; -+ unsigned queue_sof:1; -+ -+#ifdef DWC_EN_ISOC -+ /** ISOC req handle passed */ -+ void *iso_req_handle; -+#endif //_EN_ISOC_ -+ -+ /** DWC_otg ep data. */ -+ dwc_ep_t dwc_ep; -+ -+ /** Pointer to PCD */ -+ struct dwc_otg_pcd *pcd; -+ -+ void *priv; -+} dwc_otg_pcd_ep_t; -+ -+/** DWC_otg PCD Structure. -+ * This structure encapsulates the data for the dwc_otg PCD. -+ */ -+struct dwc_otg_pcd { -+ const struct dwc_otg_pcd_function_ops *fops; -+ /** The DWC otg device pointer */ -+ struct dwc_otg_device *otg_dev; -+ /** Core Interface */ -+ dwc_otg_core_if_t *core_if; -+ /** State of EP0 */ -+ ep0state_e ep0state; -+ /** EP0 Request is pending */ -+ unsigned ep0_pending:1; -+ /** Indicates when SET CONFIGURATION Request is in process */ -+ unsigned request_config:1; -+ /** The state of the Remote Wakeup Enable. */ -+ unsigned remote_wakeup_enable:1; -+ /** The state of the B-Device HNP Enable. */ -+ unsigned b_hnp_enable:1; -+ /** The state of A-Device HNP Support. */ -+ unsigned a_hnp_support:1; -+ /** The state of the A-Device Alt HNP support. */ -+ unsigned a_alt_hnp_support:1; -+ /** Count of pending Requests */ -+ unsigned request_pending; -+ -+ /** SETUP packet for EP0 -+ * This structure is allocated as a DMA buffer on PCD initialization -+ * with enough space for up to 3 setup packets. -+ */ -+ union { -+ usb_device_request_t req; -+ uint32_t d32[2]; -+ } *setup_pkt; -+ -+ dwc_dma_t setup_pkt_dma_handle; -+ -+ /* Additional buffer and flag for CTRL_WR premature case */ -+ uint8_t *backup_buf; -+ unsigned data_terminated; -+ -+ /** 2-byte dma buffer used to return status from GET_STATUS */ -+ uint16_t *status_buf; -+ dwc_dma_t status_buf_dma_handle; -+ -+ /** EP0 */ -+ dwc_otg_pcd_ep_t ep0; -+ -+ /** Array of IN EPs. */ -+ dwc_otg_pcd_ep_t in_ep[MAX_EPS_CHANNELS - 1]; -+ /** Array of OUT EPs. */ -+ dwc_otg_pcd_ep_t out_ep[MAX_EPS_CHANNELS - 1]; -+ /** number of valid EPs in the above array. */ -+// unsigned num_eps : 4; -+ dwc_spinlock_t *lock; -+ -+ /** Tasklet to defer starting of TEST mode transmissions until -+ * Status Phase has been completed. -+ */ -+ dwc_tasklet_t *test_mode_tasklet; -+ -+ /** Tasklet to delay starting of xfer in DMA mode */ -+ dwc_tasklet_t *start_xfer_tasklet; -+ -+ /** The test mode to enter when the tasklet is executed. */ -+ unsigned test_mode; -+ /** The cfi_api structure that implements most of the CFI API -+ * and OTG specific core configuration functionality -+ */ -+#ifdef DWC_UTE_CFI -+ struct cfiobject *cfi; -+#endif -+ -+}; -+ -+static inline struct device *dwc_otg_pcd_to_dev(struct dwc_otg_pcd *pcd) -+{ -+ return &pcd->otg_dev->os_dep.platformdev->dev; -+} -+ -+//FIXME this functions should be static, and this prototypes should be removed -+extern void dwc_otg_request_nuke(dwc_otg_pcd_ep_t * ep); -+extern void dwc_otg_request_done(dwc_otg_pcd_ep_t * ep, -+ dwc_otg_pcd_request_t * req, int32_t status); -+ -+void dwc_otg_iso_buffer_done(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep, -+ void *req_handle); -+ -+extern void do_test_mode(void *data); -+#endif -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4c1d591fbc098b2f4a745669e4f243e068735b20 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h -@@ -0,0 +1,361 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $ -+ * $Revision: #11 $ -+ * $Date: 2011/10/26 $ -+ * $Change: 1873028 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+#if !defined(__DWC_PCD_IF_H__) -+#define __DWC_PCD_IF_H__ -+ -+//#include "dwc_os.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_otg_driver.h" -+ -+/** @file -+ * This file defines DWC_OTG PCD Core API. -+ */ -+ -+struct dwc_otg_pcd; -+typedef struct dwc_otg_pcd dwc_otg_pcd_t; -+ -+/** Maxpacket size for EP0 */ -+#define MAX_EP0_SIZE 64 -+/** Maxpacket size for any EP */ -+#define MAX_PACKET_SIZE 1024 -+ -+/** @name Function Driver Callbacks */ -+/** @{ */ -+ -+/** This function will be called whenever a previously queued request has -+ * completed. The status value will be set to -DWC_E_SHUTDOWN to indicated a -+ * failed or aborted transfer, or -DWC_E_RESTART to indicate the device was reset, -+ * or -DWC_E_TIMEOUT to indicate it timed out, or -DWC_E_INVALID to indicate invalid -+ * parameters. */ -+typedef int (*dwc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, -+ uint32_t actual); -+/** -+ * This function will be called whenever a previousle queued ISOC request has -+ * completed. Count of ISOC packets could be read using dwc_otg_pcd_get_iso_packet_count -+ * function. -+ * The status of each ISOC packet could be read using dwc_otg_pcd_get_iso_packet_* -+ * functions. -+ */ -+typedef int (*dwc_isoc_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int proc_buf_num); -+/** This function should handle any SETUP request that cannot be handled by the -+ * PCD Core. This includes most GET_DESCRIPTORs, SET_CONFIGS, Any -+ * class-specific requests, etc. The function must non-blocking. -+ * -+ * Returns 0 on success. -+ * Returns -DWC_E_NOT_SUPPORTED if the request is not supported. -+ * Returns -DWC_E_INVALID if the setup request had invalid parameters or bytes. -+ * Returns -DWC_E_SHUTDOWN on any other error. */ -+typedef int (*dwc_setup_cb_t) (dwc_otg_pcd_t * pcd, uint8_t * bytes); -+/** This is called whenever the device has been disconnected. The function -+ * driver should take appropriate action to clean up all pending requests in the -+ * PCD Core, remove all endpoints (except ep0), and initialize back to reset -+ * state. */ -+typedef int (*dwc_disconnect_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called when device has been connected. */ -+typedef int (*dwc_connect_cb_t) (dwc_otg_pcd_t * pcd, int speed); -+/** This function is called when device has been suspended */ -+typedef int (*dwc_suspend_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called when device has received LPM tokens, i.e. -+ * device has been sent to sleep state. */ -+typedef int (*dwc_sleep_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called when device has been resumed -+ * from suspend(L2) or L1 sleep state. */ -+typedef int (*dwc_resume_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called whenever hnp params has been changed. -+ * User can call get_b_hnp_enable, get_a_hnp_support, get_a_alt_hnp_support functions -+ * to get hnp parameters. */ -+typedef int (*dwc_hnp_params_changed_cb_t) (dwc_otg_pcd_t * pcd); -+/** This function is called whenever USB RESET is detected. */ -+typedef int (*dwc_reset_cb_t) (dwc_otg_pcd_t * pcd); -+ -+typedef int (*cfi_setup_cb_t) (dwc_otg_pcd_t * pcd, void *ctrl_req_bytes); -+ -+/** -+ * -+ * @param ep_handle Void pointer to the usb_ep structure -+ * @param ereq_port Pointer to the extended request structure created in the -+ * portable part. -+ */ -+typedef int (*xiso_completion_cb_t) (dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, -+ void *ereq_port); -+/** Function Driver Ops Data Structure */ -+struct dwc_otg_pcd_function_ops { -+ dwc_connect_cb_t connect; -+ dwc_disconnect_cb_t disconnect; -+ dwc_setup_cb_t setup; -+ dwc_completion_cb_t complete; -+ dwc_isoc_completion_cb_t isoc_complete; -+ dwc_suspend_cb_t suspend; -+ dwc_sleep_cb_t sleep; -+ dwc_resume_cb_t resume; -+ dwc_reset_cb_t reset; -+ dwc_hnp_params_changed_cb_t hnp_changed; -+ cfi_setup_cb_t cfi_setup; -+#ifdef DWC_UTE_PER_IO -+ xiso_completion_cb_t xisoc_complete; -+#endif -+}; -+/** @} */ -+ -+/** @name Function Driver Functions */ -+/** @{ */ -+ -+/** Call this function to get pointer on dwc_otg_pcd_t, -+ * this pointer will be used for all PCD API functions. -+ * -+ * @param core_if The DWC_OTG Core -+ */ -+extern dwc_otg_pcd_t *dwc_otg_pcd_init(dwc_otg_device_t *otg_dev); -+ -+/** Frees PCD allocated by dwc_otg_pcd_init -+ * -+ * @param pcd The PCD -+ */ -+extern void dwc_otg_pcd_remove(dwc_otg_pcd_t * pcd); -+ -+/** Call this to bind the function driver to the PCD Core. -+ * -+ * @param pcd Pointer on dwc_otg_pcd_t returned by dwc_otg_pcd_init function. -+ * @param fops The Function Driver Ops data structure containing pointers to all callbacks. -+ */ -+extern void dwc_otg_pcd_start(dwc_otg_pcd_t * pcd, -+ const struct dwc_otg_pcd_function_ops *fops); -+ -+/** Enables an endpoint for use. This function enables an endpoint in -+ * the PCD. The endpoint is described by the ep_desc which has the -+ * same format as a USB ep descriptor. The ep_handle parameter is used to refer -+ * to the endpoint from other API functions and in callbacks. Normally this -+ * should be called after a SET_CONFIGURATION/SET_INTERFACE to configure the -+ * core for that interface. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns 0 on success. -+ * -+ * @param pcd The PCD -+ * @param ep_desc Endpoint descriptor -+ * @param usb_ep Handle on endpoint, that will be used to identify endpoint. -+ */ -+extern int dwc_otg_pcd_ep_enable(dwc_otg_pcd_t * pcd, -+ const uint8_t * ep_desc, void *usb_ep); -+ -+/** Disable the endpoint referenced by ep_handle. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error occurred. -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_disable(dwc_otg_pcd_t * pcd, void *ep_handle); -+ -+/** Queue a data transfer request on the endpoint referenced by ep_handle. -+ * After the transfer is completes, the complete callback will be called with -+ * the request status. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param buf The buffer for the data -+ * @param dma_buf The DMA buffer for the data -+ * @param buflen The length of the data transfer -+ * @param zero Specifies whether to send zero length last packet. -+ * @param req_handle Set this handle to any value to use to reference this -+ * request in the ep_dequeue function or from the complete callback -+ * @param atomic_alloc If driver need to perform atomic allocations -+ * for internal data structures. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, -+ uint32_t buflen, int zero, void *req_handle, -+ int atomic_alloc); -+#ifdef DWC_UTE_PER_IO -+/** -+ * -+ * @param ereq_nonport Pointer to the extended request part of the -+ * usb_request structure defined in usb_gadget.h file. -+ */ -+extern int dwc_otg_pcd_xiso_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf, dwc_dma_t dma_buf, -+ uint32_t buflen, int zero, -+ void *req_handle, int atomic_alloc, -+ void *ereq_nonport); -+ -+#endif -+ -+/** De-queue the specified data transfer that has not yet completed. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_dequeue(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle); -+ -+/** Halt (STALL) an endpoint or clear it. -+ * -+ * Returns -DWC_E_INVALID if invalid parameters were passed. -+ * Returns -DWC_E_SHUTDOWN if any other error ocurred. -+ * Returns -DWC_E_AGAIN if the STALL cannot be sent and must be tried again later -+ * Returns 0 on success. */ -+extern int dwc_otg_pcd_ep_halt(dwc_otg_pcd_t * pcd, void *ep_handle, int value); -+ -+/** This function */ -+extern int dwc_otg_pcd_ep_wedge(dwc_otg_pcd_t * pcd, void *ep_handle); -+ -+/** This function should be called on every hardware interrupt */ -+extern int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd); -+ -+/** This function returns current frame number */ -+extern int dwc_otg_pcd_get_frame_number(dwc_otg_pcd_t * pcd); -+ -+/** -+ * Start isochronous transfers on the endpoint referenced by ep_handle. -+ * For isochronous transfers duble buffering is used. -+ * After processing each of buffers comlete callback will be called with -+ * status for each transaction. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param buf0 The virtual address of first data buffer -+ * @param buf1 The virtual address of second data buffer -+ * @param dma0 The DMA address of first data buffer -+ * @param dma1 The DMA address of second data buffer -+ * @param sync_frame Data pattern frame number -+ * @param dp_frame Data size for pattern frame -+ * @param data_per_frame Data size for regular frame -+ * @param start_frame Frame number to start transfers, if -1 then start transfers ASAP. -+ * @param buf_proc_intrvl Interval of ISOC Buffer processing -+ * @param req_handle Handle of ISOC request -+ * @param atomic_alloc Specefies whether to perform atomic allocation for -+ * internal data structures. -+ * -+ * Returns -DWC_E_NO_MEMORY if there is no enough memory. -+ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function. -+ * Returns -DW_E_SHUTDOWN for any other error. -+ * Returns 0 on success -+ */ -+extern int dwc_otg_pcd_iso_ep_start(dwc_otg_pcd_t * pcd, void *ep_handle, -+ uint8_t * buf0, uint8_t * buf1, -+ dwc_dma_t dma0, dwc_dma_t dma1, -+ int sync_frame, int dp_frame, -+ int data_per_frame, int start_frame, -+ int buf_proc_intrvl, void *req_handle, -+ int atomic_alloc); -+ -+/** Stop ISOC transfers on endpoint referenced by ep_handle. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param req_handle Handle of ISOC request -+ * -+ * Returns -DWC_E_INVALID if incorrect arguments are passed to the function -+ * Returns 0 on success -+ */ -+int dwc_otg_pcd_iso_ep_stop(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle); -+ -+/** Get ISOC packet status. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param iso_req_handle Isochronoush request handle -+ * @param packet Number of packet -+ * @param status Out parameter for returning status -+ * @param actual Out parameter for returning actual length -+ * @param offset Out parameter for returning offset -+ * -+ */ -+extern void dwc_otg_pcd_get_iso_packet_params(dwc_otg_pcd_t * pcd, -+ void *ep_handle, -+ void *iso_req_handle, int packet, -+ int *status, int *actual, -+ int *offset); -+ -+/** Get ISOC packet count. -+ * -+ * @param pcd The PCD -+ * @param ep_handle The handle of the endpoint -+ * @param iso_req_handle -+ */ -+extern int dwc_otg_pcd_get_iso_packet_count(dwc_otg_pcd_t * pcd, -+ void *ep_handle, -+ void *iso_req_handle); -+ -+/** This function starts the SRP Protocol if no session is in progress. If -+ * a session is already in progress, but the device is suspended, -+ * remote wakeup signaling is started. -+ */ -+extern int dwc_otg_pcd_wakeup(dwc_otg_pcd_t * pcd); -+ -+/** This function returns 1 if LPM support is enabled, and 0 otherwise. */ -+extern int dwc_otg_pcd_is_lpm_enabled(dwc_otg_pcd_t * pcd); -+ -+/** This function returns 1 if remote wakeup is allowed and 0, otherwise. */ -+extern int dwc_otg_pcd_get_rmwkup_enable(dwc_otg_pcd_t * pcd); -+ -+/** Initiate SRP */ -+extern void dwc_otg_pcd_initiate_srp(dwc_otg_pcd_t * pcd); -+ -+/** Starts remote wakeup signaling. */ -+extern void dwc_otg_pcd_remote_wakeup(dwc_otg_pcd_t * pcd, int set); -+ -+/** Starts micorsecond soft disconnect. */ -+extern void dwc_otg_pcd_disconnect_us(dwc_otg_pcd_t * pcd, int no_of_usecs); -+/** This function returns whether device is dualspeed.*/ -+extern uint32_t dwc_otg_pcd_is_dualspeed(dwc_otg_pcd_t * pcd); -+ -+/** This function returns whether device is otg. */ -+extern uint32_t dwc_otg_pcd_is_otg(dwc_otg_pcd_t * pcd); -+ -+/** These functions allow to get hnp parameters */ -+extern uint32_t get_b_hnp_enable(dwc_otg_pcd_t * pcd); -+extern uint32_t get_a_hnp_support(dwc_otg_pcd_t * pcd); -+extern uint32_t get_a_alt_hnp_support(dwc_otg_pcd_t * pcd); -+ -+/** CFI specific Interface functions */ -+/** Allocate a cfi buffer */ -+extern uint8_t *cfiw_ep_alloc_buffer(dwc_otg_pcd_t * pcd, void *pep, -+ dwc_dma_t * addr, size_t buflen, -+ int flags); -+ -+/******************************************************************************/ -+ -+/** @} */ -+ -+#endif /* __DWC_PCD_IF_H__ */ -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e55ea9c74be46167a41dc14a2d88a1228878b1bb ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -@@ -0,0 +1,5148 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $ -+ * $Revision: #116 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+#include "dwc_otg_pcd.h" -+ -+#ifdef DWC_UTE_CFI -+#include "dwc_otg_cfi.h" -+#endif -+ -+#ifdef DWC_UTE_PER_IO -+extern void complete_xiso_ep(dwc_otg_pcd_ep_t * ep); -+#endif -+//#define PRINT_CFI_DMA_DESCS -+ -+#define DEBUG_EP0 -+ -+/** -+ * This function updates OTG. -+ */ -+static void dwc_otg_pcd_update_otg(dwc_otg_pcd_t * pcd, const unsigned reset) -+{ -+ -+ if (reset) { -+ pcd->b_hnp_enable = 0; -+ pcd->a_hnp_support = 0; -+ pcd->a_alt_hnp_support = 0; -+ } -+ -+ if (pcd->fops->hnp_changed) { -+ pcd->fops->hnp_changed(pcd); -+ } -+} -+ -+/** @file -+ * This file contains the implementation of the PCD Interrupt handlers. -+ * -+ * The PCD handles the device interrupts. Many conditions can cause a -+ * device interrupt. When an interrupt occurs, the device interrupt -+ * service routine determines the cause of the interrupt and -+ * dispatches handling to the appropriate function. These interrupt -+ * handling functions are described below. -+ * All interrupt registers are processed from LSB to MSB. -+ */ -+ -+/** -+ * This function prints the ep0 state for debug purposes. -+ */ -+static inline void print_ep0_state(dwc_otg_pcd_t * pcd) -+{ -+#ifdef DEBUG -+ char str[40]; -+ -+ switch (pcd->ep0state) { -+ case EP0_DISCONNECT: -+ dwc_strcpy(str, "EP0_DISCONNECT"); -+ break; -+ case EP0_IDLE: -+ dwc_strcpy(str, "EP0_IDLE"); -+ break; -+ case EP0_IN_DATA_PHASE: -+ dwc_strcpy(str, "EP0_IN_DATA_PHASE"); -+ break; -+ case EP0_OUT_DATA_PHASE: -+ dwc_strcpy(str, "EP0_OUT_DATA_PHASE"); -+ break; -+ case EP0_IN_STATUS_PHASE: -+ dwc_strcpy(str, "EP0_IN_STATUS_PHASE"); -+ break; -+ case EP0_OUT_STATUS_PHASE: -+ dwc_strcpy(str, "EP0_OUT_STATUS_PHASE"); -+ break; -+ case EP0_STALL: -+ dwc_strcpy(str, "EP0_STALL"); -+ break; -+ default: -+ dwc_strcpy(str, "EP0_INVALID"); -+ } -+ -+ DWC_DEBUGPL(DBG_ANY, "%s(%d)\n", str, pcd->ep0state); -+#endif -+} -+ -+/** -+ * This function calculate the size of the payload in the memory -+ * for out endpoints and prints size for debug purposes(used in -+ * 2.93a DevOutNak feature). -+ */ -+static inline void print_memory_payload(dwc_otg_pcd_t * pcd, dwc_ep_t * ep) -+{ -+#ifdef DEBUG -+ deptsiz_data_t deptsiz_init = {.d32 = 0 }; -+ deptsiz_data_t deptsiz_updt = {.d32 = 0 }; -+ int pack_num; -+ unsigned payload; -+ -+ deptsiz_init.d32 = pcd->core_if->start_doeptsiz_val[ep->num]; -+ deptsiz_updt.d32 = -+ DWC_READ_REG32(&pcd->core_if->dev_if-> -+ out_ep_regs[ep->num]->doeptsiz); -+ /* Payload will be */ -+ payload = deptsiz_init.b.xfersize - deptsiz_updt.b.xfersize; -+ /* Packet count is decremented every time a packet -+ * is written to the RxFIFO not in to the external memory -+ * So, if payload == 0, then it means no packet was sent to ext memory*/ -+ pack_num = (!payload) ? 0 : (deptsiz_init.b.pktcnt - deptsiz_updt.b.pktcnt); -+ DWC_DEBUGPL(DBG_PCDV, -+ "Payload for EP%d-%s\n", -+ ep->num, (ep->is_in ? "IN" : "OUT")); -+ DWC_DEBUGPL(DBG_PCDV, -+ "Number of transfered bytes = 0x%08x\n", payload); -+ DWC_DEBUGPL(DBG_PCDV, -+ "Number of transfered packets = %d\n", pack_num); -+#endif -+} -+ -+ -+#ifdef DWC_UTE_CFI -+static inline void print_desc(struct dwc_otg_dma_desc *ddesc, -+ const uint8_t * epname, int descnum) -+{ -+ CFI_INFO -+ ("%s DMA_DESC(%d) buf=0x%08x bytes=0x%04x; sp=0x%x; l=0x%x; sts=0x%02x; bs=0x%02x\n", -+ epname, descnum, ddesc->buf, ddesc->status.b.bytes, -+ ddesc->status.b.sp, ddesc->status.b.l, ddesc->status.b.sts, -+ ddesc->status.b.bs); -+} -+#endif -+ -+/** -+ * This function returns pointer to in ep struct with number ep_num -+ */ -+static inline dwc_otg_pcd_ep_t *get_in_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) -+{ -+ int i; -+ int num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; -+ if (ep_num == 0) { -+ return &pcd->ep0; -+ } else { -+ for (i = 0; i < num_in_eps; ++i) { -+ if (pcd->in_ep[i].dwc_ep.num == ep_num) -+ return &pcd->in_ep[i]; -+ } -+ return 0; -+ } -+} -+ -+/** -+ * This function returns pointer to out ep struct with number ep_num -+ */ -+static inline dwc_otg_pcd_ep_t *get_out_ep(dwc_otg_pcd_t * pcd, uint32_t ep_num) -+{ -+ int i; -+ int num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; -+ if (ep_num == 0) { -+ return &pcd->ep0; -+ } else { -+ for (i = 0; i < num_out_eps; ++i) { -+ if (pcd->out_ep[i].dwc_ep.num == ep_num) -+ return &pcd->out_ep[i]; -+ } -+ return 0; -+ } -+} -+ -+/** -+ * This functions gets a pointer to an EP from the wIndex address -+ * value of the control request. -+ */ -+dwc_otg_pcd_ep_t *get_ep_by_addr(dwc_otg_pcd_t * pcd, u16 wIndex) -+{ -+ dwc_otg_pcd_ep_t *ep; -+ uint32_t ep_num = UE_GET_ADDR(wIndex); -+ -+ if (ep_num == 0) { -+ ep = &pcd->ep0; -+ } else if (UE_GET_DIR(wIndex) == UE_DIR_IN) { /* in ep */ -+ ep = &pcd->in_ep[ep_num - 1]; -+ } else { -+ ep = &pcd->out_ep[ep_num - 1]; -+ } -+ -+ return ep; -+} -+ -+/** -+ * This function checks the EP request queue, if the queue is not -+ * empty the next request is started. -+ */ -+void start_next_request(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_pcd_request_t *req = 0; -+ uint32_t max_transfer = -+ GET_CORE_IF(ep->pcd)->core_params->max_transfer_size; -+ -+#ifdef DWC_UTE_CFI -+ struct dwc_otg_pcd *pcd; -+ pcd = ep->pcd; -+#endif -+ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ -+#ifdef DWC_UTE_CFI -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ ep->dwc_ep.cfi_req_len = req->length; -+ pcd->cfi->ops.build_descriptors(pcd->cfi, pcd, ep, req); -+ } else { -+#endif -+ /* Setup and start the Transfer */ -+ if (req->dw_align_buf) { -+ ep->dwc_ep.dma_addr = req->dw_align_buf_dma; -+ ep->dwc_ep.start_xfer_buff = req->dw_align_buf; -+ ep->dwc_ep.xfer_buff = req->dw_align_buf; -+ } else { -+ ep->dwc_ep.dma_addr = req->dma; -+ ep->dwc_ep.start_xfer_buff = req->buf; -+ ep->dwc_ep.xfer_buff = req->buf; -+ } -+ ep->dwc_ep.sent_zlp = 0; -+ ep->dwc_ep.total_len = req->length; -+ ep->dwc_ep.xfer_len = 0; -+ ep->dwc_ep.xfer_count = 0; -+ -+ ep->dwc_ep.maxxfer = max_transfer; -+ if (GET_CORE_IF(ep->pcd)->dma_desc_enable) { -+ uint32_t out_max_xfer = DDMA_MAX_TRANSFER_SIZE -+ - (DDMA_MAX_TRANSFER_SIZE % 4); -+ if (ep->dwc_ep.is_in) { -+ if (ep->dwc_ep.maxxfer > -+ DDMA_MAX_TRANSFER_SIZE) { -+ ep->dwc_ep.maxxfer = -+ DDMA_MAX_TRANSFER_SIZE; -+ } -+ } else { -+ if (ep->dwc_ep.maxxfer > out_max_xfer) { -+ ep->dwc_ep.maxxfer = -+ out_max_xfer; -+ } -+ } -+ } -+ if (ep->dwc_ep.maxxfer < ep->dwc_ep.total_len) { -+ ep->dwc_ep.maxxfer -= -+ (ep->dwc_ep.maxxfer % ep->dwc_ep.maxpacket); -+ } -+ if (req->sent_zlp) { -+ if ((ep->dwc_ep.total_len % -+ ep->dwc_ep.maxpacket == 0) -+ && (ep->dwc_ep.total_len != 0)) { -+ ep->dwc_ep.sent_zlp = 1; -+ } -+ -+ } -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ dwc_otg_ep_start_transfer(GET_CORE_IF(ep->pcd), &ep->dwc_ep); -+ } else if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ DWC_PRINTF("There are no more ISOC requests \n"); -+ ep->dwc_ep.frame_num = 0xFFFFFFFF; -+ } -+} -+ -+/** -+ * This function handles the SOF Interrupts. At this time the SOF -+ * Interrupt is disabled. -+ */ -+int32_t dwc_otg_pcd_handle_sof_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+ gintsts_data_t gintsts; -+ -+ DWC_DEBUGPL(DBG_PCD, "SOF\n"); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.sofintr = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This function handles the Rx Status Queue Level Interrupt, which -+ * indicates that there is a least one packet in the Rx FIFO. The -+ * packets are moved from the FIFO to memory, where they will be -+ * processed when the Endpoint Interrupt Register indicates Transfer -+ * Complete or SETUP Phase Done. -+ * -+ * Repeat the following until the Rx Status Queue is empty: -+ * -# Read the Receive Status Pop Register (GRXSTSP) to get Packet -+ * info -+ * -# If Receive FIFO is empty then skip to step Clear the interrupt -+ * and exit -+ * -# If SETUP Packet call dwc_otg_read_setup_packet to copy the -+ * SETUP data to the buffer -+ * -# If OUT Data Packet call dwc_otg_read_packet to copy the data -+ * to the destination buffer -+ */ -+int32_t dwc_otg_pcd_handle_rx_status_q_level_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ gintmsk_data_t gintmask = {.d32 = 0 }; -+ device_grxsts_data_t status; -+ dwc_otg_pcd_ep_t *ep; -+ gintsts_data_t gintsts; -+#ifdef DEBUG -+ static char *dpid_str[] = { "D0", "D2", "D1", "MDATA" }; -+#endif -+ -+ //DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _pcd); -+ /* Disable the Rx Status Queue Level interrupt */ -+ gintmask.b.rxstsqlvl = 1; -+ DWC_MODIFY_REG32(&global_regs->gintmsk, gintmask.d32, 0); -+ -+ /* Get the Status from the top of the FIFO */ -+ status.d32 = DWC_READ_REG32(&global_regs->grxstsp); -+ -+ DWC_DEBUGPL(DBG_PCD, "EP:%d BCnt:%d DPID:%s " -+ "pktsts:%x Frame:%d(0x%0x)\n", -+ status.b.epnum, status.b.bcnt, -+ dpid_str[status.b.dpid], -+ status.b.pktsts, status.b.fn, status.b.fn); -+ /* Get pointer to EP structure */ -+ ep = get_out_ep(pcd, status.b.epnum); -+ -+ switch (status.b.pktsts) { -+ case DWC_DSTS_GOUT_NAK: -+ DWC_DEBUGPL(DBG_PCDV, "Global OUT NAK\n"); -+ break; -+ case DWC_STS_DATA_UPDT: -+ DWC_DEBUGPL(DBG_PCDV, "OUT Data Packet\n"); -+ if (status.b.bcnt && ep->dwc_ep.xfer_buff) { -+ /** @todo NGS Check for buffer overflow? */ -+ dwc_otg_read_packet(core_if, -+ ep->dwc_ep.xfer_buff, -+ status.b.bcnt); -+ ep->dwc_ep.xfer_count += status.b.bcnt; -+ ep->dwc_ep.xfer_buff += status.b.bcnt; -+ } -+ break; -+ case DWC_STS_XFER_COMP: -+ DWC_DEBUGPL(DBG_PCDV, "OUT Complete\n"); -+ break; -+ case DWC_DSTS_SETUP_COMP: -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Setup Complete\n"); -+#endif -+ break; -+ case DWC_DSTS_SETUP_UPDT: -+ dwc_otg_read_setup_packet(core_if, pcd->setup_pkt->d32); -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, -+ "SETUP PKT: %02x.%02x v%04x i%04x l%04x\n", -+ pcd->setup_pkt->req.bmRequestType, -+ pcd->setup_pkt->req.bRequest, -+ UGETW(pcd->setup_pkt->req.wValue), -+ UGETW(pcd->setup_pkt->req.wIndex), -+ UGETW(pcd->setup_pkt->req.wLength)); -+#endif -+ ep->dwc_ep.xfer_count += status.b.bcnt; -+ break; -+ default: -+ DWC_DEBUGPL(DBG_PCDV, "Invalid Packet Status (0x%0x)\n", -+ status.b.pktsts); -+ break; -+ } -+ -+ /* Enable the Rx Status Queue Level interrupt */ -+ DWC_MODIFY_REG32(&global_regs->gintmsk, 0, gintmask.d32); -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.rxstsqlvl = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ //DWC_DEBUGPL(DBG_PCDV, "EXIT: %s\n", __func__); -+ return 1; -+} -+ -+/** -+ * This function examines the Device IN Token Learning Queue to -+ * determine the EP number of the last IN token received. This -+ * implementation is for the Mass Storage device where there are only -+ * 2 IN EPs (Control-IN and BULK-IN). -+ * -+ * The EP numbers for the first six IN Tokens are in DTKNQR1 and there -+ * are 8 EP Numbers in each of the other possible DTKNQ Registers. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * -+ */ -+static inline int get_ep_of_last_in_token(dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_device_global_regs_t *dev_global_regs = -+ core_if->dev_if->dev_global_regs; -+ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; -+ /* Number of Token Queue Registers */ -+ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; -+ dtknq1_data_t dtknqr1; -+ uint32_t in_tkn_epnums[4]; -+ int ndx = 0; -+ int i = 0; -+ volatile uint32_t *addr = &dev_global_regs->dtknqr1; -+ int epnum = 0; -+ -+ //DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); -+ -+ /* Read the DTKNQ Registers */ -+ for (i = 0; i < DTKNQ_REG_CNT; i++) { -+ in_tkn_epnums[i] = DWC_READ_REG32(addr); -+ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, -+ in_tkn_epnums[i]); -+ if (addr == &dev_global_regs->dvbusdis) { -+ addr = &dev_global_regs->dtknqr3_dthrctl; -+ } else { -+ ++addr; -+ } -+ -+ } -+ -+ /* Copy the DTKNQR1 data to the bit field. */ -+ dtknqr1.d32 = in_tkn_epnums[0]; -+ /* Get the EP numbers */ -+ in_tkn_epnums[0] = dtknqr1.b.epnums0_5; -+ ndx = dtknqr1.b.intknwptr - 1; -+ -+ //DWC_DEBUGPL(DBG_PCDV,"ndx=%d\n",ndx); -+ if (ndx == -1) { -+ /** @todo Find a simpler way to calculate the max -+ * queue position.*/ -+ int cnt = TOKEN_Q_DEPTH; -+ if (TOKEN_Q_DEPTH <= 6) { -+ cnt = TOKEN_Q_DEPTH - 1; -+ } else if (TOKEN_Q_DEPTH <= 14) { -+ cnt = TOKEN_Q_DEPTH - 7; -+ } else if (TOKEN_Q_DEPTH <= 22) { -+ cnt = TOKEN_Q_DEPTH - 15; -+ } else { -+ cnt = TOKEN_Q_DEPTH - 23; -+ } -+ epnum = (in_tkn_epnums[DTKNQ_REG_CNT - 1] >> (cnt * 4)) & 0xF; -+ } else { -+ if (ndx <= 5) { -+ epnum = (in_tkn_epnums[0] >> (ndx * 4)) & 0xF; -+ } else if (ndx <= 13) { -+ ndx -= 6; -+ epnum = (in_tkn_epnums[1] >> (ndx * 4)) & 0xF; -+ } else if (ndx <= 21) { -+ ndx -= 14; -+ epnum = (in_tkn_epnums[2] >> (ndx * 4)) & 0xF; -+ } else if (ndx <= 29) { -+ ndx -= 22; -+ epnum = (in_tkn_epnums[3] >> (ndx * 4)) & 0xF; -+ } -+ } -+ //DWC_DEBUGPL(DBG_PCD,"epnum=%d\n",epnum); -+ return epnum; -+} -+ -+/** -+ * This interrupt occurs when the non-periodic Tx FIFO is half-empty. -+ * The active request is checked for the next packet to be loaded into -+ * the non-periodic Tx FIFO. -+ */ -+int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ gnptxsts_data_t txstatus = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ -+ int epnum = 0; -+ dwc_otg_pcd_ep_t *ep = 0; -+ uint32_t len = 0; -+ int dwords; -+ -+ /* Get the epnum from the IN Token Learning Queue. */ -+ epnum = get_ep_of_last_in_token(core_if); -+ ep = get_in_ep(pcd, epnum); -+ -+ DWC_DEBUGPL(DBG_PCD, "NP TxFifo Empty: %d \n", epnum); -+ -+ ep_regs = core_if->dev_if->in_ep_regs[epnum]; -+ -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 GNPTXSTS=0x%08x\n", txstatus.d32); -+ -+ while (txstatus.b.nptxqspcavail > 0 && -+ txstatus.b.nptxfspcavail > dwords && -+ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = DWC_READ_REG32(&global_regs->gnptxsts); -+ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", txstatus.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "GNPTXSTS=0x%08x\n", -+ DWC_READ_REG32(&global_regs->gnptxsts)); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.nptxfempty = 1; -+ DWC_WRITE_REG32(&global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This function is called when dedicated Tx FIFO Empty interrupt occurs. -+ * The active request is checked for the next packet to be loaded into -+ * apropriate Tx FIFO. -+ */ -+static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *ep_regs; -+ dtxfsts_data_t txstatus = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep = 0; -+ uint32_t len = 0; -+ int dwords; -+ -+ ep = get_in_ep(pcd, epnum); -+ -+ DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); -+ -+ ep_regs = core_if->dev_if->in_ep_regs[epnum]; -+ -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ -+ /* While there is space in the queue and space in the FIFO and -+ * More data to tranfer, Write packets to the Tx FIFO */ -+ txstatus.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, txstatus.d32); -+ -+ while (txstatus.b.txfspcavail > dwords && -+ ep->dwc_ep.xfer_count < ep->dwc_ep.xfer_len && -+ ep->dwc_ep.xfer_len != 0) { -+ /* Write the FIFO */ -+ dwc_otg_ep_write_packet(core_if, &ep->dwc_ep, 0); -+ -+ len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; -+ if (len > ep->dwc_ep.maxpacket) { -+ len = ep->dwc_ep.maxpacket; -+ } -+ -+ dwords = (len + 3) / 4; -+ txstatus.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts); -+ DWC_DEBUGPL(DBG_PCDV, "dtxfsts[%d]=0x%08x\n", epnum, -+ txstatus.d32); -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "b4 dtxfsts[%d]=0x%08x\n", epnum, -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dtxfsts)); -+ -+ return 1; -+} -+ -+/** -+ * This function is called when the Device is disconnected. It stops -+ * any active requests and informs the Gadget driver of the -+ * disconnect. -+ */ -+void dwc_otg_pcd_stop(dwc_otg_pcd_t * pcd) -+{ -+ int i, num_in_eps, num_out_eps; -+ dwc_otg_pcd_ep_t *ep; -+ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_SPINLOCK(pcd->lock); -+ -+ num_in_eps = GET_CORE_IF(pcd)->dev_if->num_in_eps; -+ num_out_eps = GET_CORE_IF(pcd)->dev_if->num_out_eps; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s() \n", __func__); -+ /* don't disconnect drivers more than once */ -+ if (pcd->ep0state == EP0_DISCONNECT) { -+ DWC_DEBUGPL(DBG_ANY, "%s() Already Disconnected\n", __func__); -+ DWC_SPINUNLOCK(pcd->lock); -+ return; -+ } -+ pcd->ep0state = EP0_DISCONNECT; -+ -+ /* Reset the OTG state. */ -+ dwc_otg_pcd_update_otg(pcd, 1); -+ -+ /* Disable the NP Tx Fifo Empty Interrupt. */ -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Flush the FIFOs */ -+ /**@todo NGS Flush Periodic FIFOs */ -+ dwc_otg_flush_tx_fifo(GET_CORE_IF(pcd), 0x10); -+ dwc_otg_flush_rx_fifo(GET_CORE_IF(pcd)); -+ -+ /* prevent new request submissions, kill any outstanding requests */ -+ ep = &pcd->ep0; -+ dwc_otg_request_nuke(ep); -+ /* prevent new request submissions, kill any outstanding requests */ -+ for (i = 0; i < num_in_eps; i++) { -+ dwc_otg_pcd_ep_t *ep = &pcd->in_ep[i]; -+ dwc_otg_request_nuke(ep); -+ } -+ /* prevent new request submissions, kill any outstanding requests */ -+ for (i = 0; i < num_out_eps; i++) { -+ dwc_otg_pcd_ep_t *ep = &pcd->out_ep[i]; -+ dwc_otg_request_nuke(ep); -+ } -+ -+ /* report disconnect; the driver is already quiesced */ -+ if (pcd->fops->disconnect) { -+ DWC_SPINUNLOCK(pcd->lock); -+ pcd->fops->disconnect(pcd); -+ DWC_SPINLOCK(pcd->lock); -+ } -+ DWC_SPINUNLOCK(pcd->lock); -+} -+ -+/** -+ * This interrupt indicates that ... -+ */ -+int32_t dwc_otg_pcd_handle_i2c_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "i2cintr"); -+ intr_mask.b.i2cintr = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.i2cintr = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that ... -+ */ -+int32_t dwc_otg_pcd_handle_early_suspend_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+#if defined(VERBOSE) -+ DWC_PRINTF("Early Suspend Detected\n"); -+#endif -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.erlysuspend = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This function configures EPO to receive SETUP packets. -+ * -+ * @todo NGS: Update the comments from the HW FS. -+ * -+ * -# Program the following fields in the endpoint specific registers -+ * for Control OUT EP 0, in order to receive a setup packet -+ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back -+ * setup packets) -+ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back -+ * to back setup packets) -+ * - In DMA mode, DOEPDMA0 Register with a memory address to -+ * store any setup packets received -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param pcd Programming view of the PCD. -+ */ -+static inline void ep0_out_start(dwc_otg_core_if_t * core_if, -+ dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ depctl_data_t doepctl = {.d32 = 0 }; -+ -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "%s() doepctl0=%0x\n", __func__, -+ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); -+#endif -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl); -+ if (doepctl.b.epena) { -+ return; -+ } -+ } -+ -+ doeptsize0.b.supcnt = 3; -+ doeptsize0.b.pktcnt = 1; -+ doeptsize0.b.xfersize = 8 * 3; -+ -+ if (core_if->dma_enable) { -+ if (!core_if->dma_desc_enable) { -+ /** put here as for Hermes mode deptisz register should not be written */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, -+ doeptsize0.d32); -+ -+ /** @todo dma needs to handle multiple setup packets (up to 3) */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, -+ pcd->setup_pkt_dma_handle); -+ } else { -+ dev_if->setup_desc_index = -+ (dev_if->setup_desc_index + 1) & 1; -+ dma_desc = -+ dev_if->setup_desc_addr[dev_if->setup_desc_index]; -+ -+ /** DMA Descriptor Setup */ -+ dma_desc->status.b.bs = BS_HOST_BUSY; -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ dma_desc->status.b.sr = 0; -+ dma_desc->status.b.mtrf = 0; -+ } -+ dma_desc->status.b.l = 1; -+ dma_desc->status.b.ioc = 1; -+ dma_desc->status.b.bytes = pcd->ep0.dwc_ep.maxpacket; -+ dma_desc->buf = pcd->setup_pkt_dma_handle; -+ dma_desc->status.b.sts = 0; -+ dma_desc->status.b.bs = BS_HOST_READY; -+ -+ /** DOEPDMA0 Register write */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepdma, -+ dev_if->dma_setup_desc_addr -+ [dev_if->setup_desc_index]); -+ } -+ -+ } else { -+ /** put here as for Hermes mode deptisz register should not be written */ -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doeptsiz, -+ doeptsize0.d32); -+ } -+ -+ /** DOEPCTL0 Register write cnak will be set after setup interrupt */ -+ doepctl.d32 = 0; -+ doepctl.b.epena = 1; -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) { -+ doepctl.b.cnak = 1; -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); -+ } else { -+ DWC_MODIFY_REG32(&dev_if->out_ep_regs[0]->doepctl, 0, doepctl.d32); -+ } -+ -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->out_ep_regs[0]->doepctl)); -+ DWC_DEBUGPL(DBG_PCDV, "diepctl0=%0x\n", -+ DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl)); -+#endif -+} -+ -+/** -+ * This interrupt occurs when a USB Reset is detected. When the USB -+ * Reset Interrupt occurs the device state is set to DEFAULT and the -+ * EP0 state is set to IDLE. -+ * -# Set the NAK bit for all OUT endpoints (DOEPCTLn.SNAK = 1) -+ * -# Unmask the following interrupt bits -+ * - DAINTMSK.INEP0 = 1 (Control 0 IN endpoint) -+ * - DAINTMSK.OUTEP0 = 1 (Control 0 OUT endpoint) -+ * - DOEPMSK.SETUP = 1 -+ * - DOEPMSK.XferCompl = 1 -+ * - DIEPMSK.XferCompl = 1 -+ * - DIEPMSK.TimeOut = 1 -+ * -# Program the following fields in the endpoint specific registers -+ * for Control OUT EP 0, in order to receive a setup packet -+ * - DOEPTSIZ0.Packet Count = 3 (To receive up to 3 back to back -+ * setup packets) -+ * - DOEPTSIZE0.Transfer Size = 24 Bytes (To receive up to 3 back -+ * to back setup packets) -+ * - In DMA mode, DOEPDMA0 Register with a memory address to -+ * store any setup packets received -+ * At this point, all the required initialization, except for enabling -+ * the control 0 OUT endpoint is done, for receiving SETUP packets. -+ */ -+int32_t dwc_otg_pcd_handle_usb_reset_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ depctl_data_t doepctl = {.d32 = 0 }; -+ depctl_data_t diepctl = {.d32 = 0 }; -+ daint_data_t daintmsk = {.d32 = 0 }; -+ doepmsk_data_t doepmsk = {.d32 = 0 }; -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ grstctl_t resetctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ int i = 0; -+ gintsts_data_t gintsts; -+ pcgcctl_data_t power = {.d32 = 0 }; -+ -+ power.d32 = DWC_READ_REG32(core_if->pcgcctl); -+ if (power.b.stoppclk) { -+ power.d32 = 0; -+ power.b.stoppclk = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); -+ -+ power.b.pwrclmp = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); -+ -+ power.b.rstpdwnmodule = 1; -+ DWC_MODIFY_REG32(core_if->pcgcctl, power.d32, 0); -+ } -+ -+ core_if->lx_state = DWC_OTG_L0; -+ -+ DWC_PRINTF("USB RESET\n"); -+#ifdef DWC_EN_ISOC -+ for (i = 1; i < 16; ++i) { -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ ep = get_in_ep(pcd, i); -+ if (ep != 0) { -+ dwc_ep = &ep->dwc_ep; -+ dwc_ep->next_frame = 0xffffffff; -+ } -+ } -+#endif /* DWC_EN_ISOC */ -+ -+ /* reset the HNP settings */ -+ dwc_otg_pcd_update_otg(pcd, 1); -+ -+ /* Clear the Remote Wakeup Signalling */ -+ dctl.b.rmtwkupsig = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, 0); -+ -+ /* Set NAK for all OUT EPs */ -+ doepctl.b.snak = 1; -+ for (i = 0; i <= dev_if->num_out_eps; i++) { -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); -+ } -+ -+ /* Flush the NP Tx FIFO */ -+ dwc_otg_flush_tx_fifo(core_if, 0x10); -+ /* Flush the Learning Queue */ -+ resetctl.b.intknqflsh = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); -+ -+ if (!core_if->core_params->en_multiple_tx_fifo && core_if->dma_enable) { -+ core_if->start_predict = 0; -+ for (i = 0; i<= core_if->dev_if->num_in_eps; ++i) { -+ core_if->nextep_seq[i] = 0xff; // 0xff - EP not active -+ } -+ core_if->nextep_seq[0] = 0; -+ core_if->first_in_nextep_seq = 0; -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[0]->diepctl); -+ diepctl.b.nextep = 0; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[0]->diepctl, diepctl.d32); -+ -+ /* Update IN Endpoint Mismatch Count by active IN NP EP count + 1 */ -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.epmscnt = 2; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV, "%2d\n", core_if->nextep_seq[i]); -+ } -+ } -+ -+ if (core_if->multiproc_int_enable) { -+ daintmsk.b.inep0 = 1; -+ daintmsk.b.outep0 = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->deachintmsk, -+ daintmsk.d32); -+ -+ doepmsk.b.setup = 1; -+ doepmsk.b.xfercompl = 1; -+ doepmsk.b.ahberr = 1; -+ doepmsk.b.epdisabled = 1; -+ -+ if ((core_if->dma_desc_enable) || -+ (core_if->dma_enable -+ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { -+ doepmsk.b.stsphsercvd = 1; -+ } -+ if (core_if->dma_desc_enable) -+ doepmsk.b.bna = 1; -+/* -+ doepmsk.b.babble = 1; -+ doepmsk.b.nyet = 1; -+ -+ if (core_if->dma_enable) { -+ doepmsk.b.nak = 1; -+ } -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepeachintmsk[0], -+ doepmsk.d32); -+ -+ diepmsk.b.xfercompl = 1; -+ diepmsk.b.timeout = 1; -+ diepmsk.b.epdisabled = 1; -+ diepmsk.b.ahberr = 1; -+ diepmsk.b.intknepmis = 1; -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) -+ diepmsk.b.intknepmis = 0; -+ -+/* if (core_if->dma_desc_enable) { -+ diepmsk.b.bna = 1; -+ } -+*/ -+/* -+ if (core_if->dma_enable) { -+ diepmsk.b.nak = 1; -+ } -+*/ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepeachintmsk[0], -+ diepmsk.d32); -+ } else { -+ daintmsk.b.inep0 = 1; -+ daintmsk.b.outep0 = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->daintmsk, -+ daintmsk.d32); -+ -+ doepmsk.b.setup = 1; -+ doepmsk.b.xfercompl = 1; -+ doepmsk.b.ahberr = 1; -+ doepmsk.b.epdisabled = 1; -+ -+ if ((core_if->dma_desc_enable) || -+ (core_if->dma_enable -+ && core_if->snpsid >= OTG_CORE_REV_3_00a)) { -+ doepmsk.b.stsphsercvd = 1; -+ } -+ if (core_if->dma_desc_enable) -+ doepmsk.b.bna = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->doepmsk, doepmsk.d32); -+ -+ diepmsk.b.xfercompl = 1; -+ diepmsk.b.timeout = 1; -+ diepmsk.b.epdisabled = 1; -+ diepmsk.b.ahberr = 1; -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) -+ diepmsk.b.intknepmis = 0; -+/* -+ if (core_if->dma_desc_enable) { -+ diepmsk.b.bna = 1; -+ } -+*/ -+ -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->diepmsk, diepmsk.d32); -+ } -+ -+ /* Reset Device Address */ -+ dcfg.d32 = DWC_READ_REG32(&dev_if->dev_global_regs->dcfg); -+ dcfg.b.devaddr = 0; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dcfg, dcfg.d32); -+ -+ /* setup EP0 to receive SETUP packets */ -+ if (core_if->snpsid <= OTG_CORE_REV_2_94a) -+ ep0_out_start(core_if, pcd); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.usbreset = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * Get the device speed from the device status register and convert it -+ * to USB speed constant. -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ */ -+static int get_device_speed(dwc_otg_core_if_t * core_if) -+{ -+ dsts_data_t dsts; -+ int speed = 0; -+ dsts.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dsts); -+ -+ switch (dsts.b.enumspd) { -+ case DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ: -+ speed = USB_SPEED_HIGH; -+ break; -+ case DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ: -+ case DWC_DSTS_ENUMSPD_FS_PHY_48MHZ: -+ speed = USB_SPEED_FULL; -+ break; -+ -+ case DWC_DSTS_ENUMSPD_LS_PHY_6MHZ: -+ speed = USB_SPEED_LOW; -+ break; -+ } -+ -+ return speed; -+} -+ -+/** -+ * Read the device status register and set the device speed in the -+ * data structure. -+ * Set up EP0 to receive SETUP packets by calling dwc_ep0_activate. -+ */ -+int32_t dwc_otg_pcd_handle_enum_done_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ gintsts_data_t gintsts; -+ gusbcfg_data_t gusbcfg; -+ dwc_otg_core_global_regs_t *global_regs = -+ GET_CORE_IF(pcd)->core_global_regs; -+ uint8_t utmi16b, utmi8b; -+ int speed; -+ DWC_DEBUGPL(DBG_PCD, "SPEED ENUM\n"); -+ -+ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_2_60a) { -+ utmi16b = 6; //vahrama old value was 6; -+ utmi8b = 9; -+ } else { -+ utmi16b = 4; -+ utmi8b = 8; -+ } -+ dwc_otg_ep0_activate(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) { -+ ep0_out_start(GET_CORE_IF(pcd), pcd); -+ } -+ -+#ifdef DEBUG_EP0 -+ print_ep0_state(pcd); -+#endif -+ -+ if (pcd->ep0state == EP0_DISCONNECT) { -+ pcd->ep0state = EP0_IDLE; -+ } else if (pcd->ep0state == EP0_STALL) { -+ pcd->ep0state = EP0_IDLE; -+ } -+ -+ pcd->ep0state = EP0_IDLE; -+ -+ ep0->stopped = 0; -+ -+ speed = get_device_speed(GET_CORE_IF(pcd)); -+ pcd->fops->connect(pcd, speed); -+ -+ /* Set USB turnaround time based on device speed and PHY interface. */ -+ gusbcfg.d32 = DWC_READ_REG32(&global_regs->gusbcfg); -+ if (speed == USB_SPEED_HIGH) { -+ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == -+ DWC_HWCFG2_HS_PHY_TYPE_ULPI) { -+ /* ULPI interface */ -+ gusbcfg.b.usbtrdtim = 9; -+ } -+ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == -+ DWC_HWCFG2_HS_PHY_TYPE_UTMI) { -+ /* UTMI+ interface */ -+ if (GET_CORE_IF(pcd)->hwcfg4.b.utmi_phy_data_width == 0) { -+ gusbcfg.b.usbtrdtim = utmi8b; -+ } else if (GET_CORE_IF(pcd)->hwcfg4. -+ b.utmi_phy_data_width == 1) { -+ gusbcfg.b.usbtrdtim = utmi16b; -+ } else if (GET_CORE_IF(pcd)-> -+ core_params->phy_utmi_width == 8) { -+ gusbcfg.b.usbtrdtim = utmi8b; -+ } else { -+ gusbcfg.b.usbtrdtim = utmi16b; -+ } -+ } -+ if (GET_CORE_IF(pcd)->hwcfg2.b.hs_phy_type == -+ DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI) { -+ /* UTMI+ OR ULPI interface */ -+ if (gusbcfg.b.ulpi_utmi_sel == 1) { -+ /* ULPI interface */ -+ gusbcfg.b.usbtrdtim = 9; -+ } else { -+ /* UTMI+ interface */ -+ if (GET_CORE_IF(pcd)-> -+ core_params->phy_utmi_width == 16) { -+ gusbcfg.b.usbtrdtim = utmi16b; -+ } else { -+ gusbcfg.b.usbtrdtim = utmi8b; -+ } -+ } -+ } -+ } else { -+ /* Full or low speed */ -+ gusbcfg.b.usbtrdtim = 9; -+ } -+ DWC_WRITE_REG32(&global_regs->gusbcfg, gusbcfg.d32); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.enumdone = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that the ISO OUT Packet was dropped due to -+ * Rx FIFO full or Rx Status Queue Full. If this interrupt occurs -+ * read all the data from the Rx FIFO. -+ */ -+int32_t dwc_otg_pcd_handle_isoc_out_packet_dropped_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ -+ DWC_WARN("INTERRUPT Handler not implemented for %s\n", -+ "ISOC Out Dropped"); -+ -+ intr_mask.b.isooutdrop = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.isooutdrop = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates the end of the portion of the micro-frame -+ * for periodic transactions. If there is a periodic transaction for -+ * the next frame, load the packets into the EP periodic Tx FIFO. -+ */ -+int32_t dwc_otg_pcd_handle_end_periodic_frame_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "EOP"); -+ -+ intr_mask.b.eopframe = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.eopframe = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that EP of the packet on the top of the -+ * non-periodic Tx FIFO does not match EP of the IN Token received. -+ * -+ * The "Device IN Token Queue" Registers are read to determine the -+ * order the IN Tokens have been received. The non-periodic Tx FIFO -+ * is flushed, so it can be reloaded in the order seen in the IN Token -+ * Queue. -+ */ -+int32_t dwc_otg_pcd_handle_ep_mismatch_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dctl_data_t dctl; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ if (!core_if->en_multiple_tx_fifo && core_if->dma_enable) { -+ core_if->start_predict = 1; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); -+ -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ if (!gintsts.b.ginnakeff) { -+ /* Disable EP Mismatch interrupt */ -+ intr_mask.d32 = 0; -+ intr_mask.b.epmismatch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32, 0); -+ /* Enable the Global IN NAK Effective Interrupt */ -+ intr_mask.d32 = 0; -+ intr_mask.b.ginnakeff = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); -+ /* Set the global non-periodic IN NAK handshake */ -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ dctl.b.sgnpinnak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+ } else { -+ DWC_PRINTF("gintsts.b.ginnakeff = 1! dctl.b.sgnpinnak not set\n"); -+ } -+ /* Disabling of all EP's will be done in dwc_otg_pcd_handle_in_nak_effective() -+ * handler after Global IN NAK Effective interrupt will be asserted */ -+ } -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.epmismatch = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This interrupt is valid only in DMA mode. This interrupt indicates that the -+ * core has stopped fetching data for IN endpoints due to the unavailability of -+ * TxFIFO space or Request Queue space. This interrupt is used by the -+ * application for an endpoint mismatch algorithm. -+ * -+ * @param pcd The PCD -+ */ -+int32_t dwc_otg_pcd_handle_ep_fetsusp_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+ gintmsk_data_t gintmsk_data; -+ dctl_data_t dctl; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, core_if); -+ -+ /* Clear the global non-periodic IN NAK handshake */ -+ dctl.d32 = 0; -+ dctl.b.cgnpinnak = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ -+ /* Mask GINTSTS.FETSUSP interrupt */ -+ gintmsk_data.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ gintmsk_data.b.fetsusp = 0; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, gintmsk_data.d32); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.fetsusp = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32); -+ -+ return 1; -+} -+/** -+ * This funcion stalls EP0. -+ */ -+static inline void ep0_do_stall(dwc_otg_pcd_t * pcd, const int err_val) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ usb_device_request_t *ctrl = &pcd->setup_pkt->req; -+ DWC_WARN("req %02x.%02x protocol STALL; err %d\n", -+ ctrl->bmRequestType, ctrl->bRequest, err_val); -+ -+ ep0->dwc_ep.is_in = 1; -+ dwc_otg_ep_set_stall(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ pcd->ep0.stopped = 1; -+ pcd->ep0state = EP0_IDLE; -+ ep0_out_start(GET_CORE_IF(pcd), pcd); -+} -+ -+/** -+ * This functions delegates the setup command to the gadget driver. -+ */ -+static inline void do_gadget_setup(dwc_otg_pcd_t * pcd, -+ usb_device_request_t * ctrl) -+{ -+ int ret = 0; -+ DWC_SPINUNLOCK(pcd->lock); -+ ret = pcd->fops->setup(pcd, (uint8_t *) ctrl); -+ DWC_SPINLOCK(pcd->lock); -+ if (ret < 0) { -+ ep0_do_stall(pcd, ret); -+ } -+ -+ /** @todo This is a g_file_storage gadget driver specific -+ * workaround: a DELAYED_STATUS result from the fsg_setup -+ * routine will result in the gadget queueing a EP0 IN status -+ * phase for a two-stage control transfer. Exactly the same as -+ * a SET_CONFIGURATION/SET_INTERFACE except that this is a class -+ * specific request. Need a generic way to know when the gadget -+ * driver will queue the status phase. Can we assume when we -+ * call the gadget driver setup() function that it will always -+ * queue and require the following flag? Need to look into -+ * this. -+ */ -+ -+ if (ret == 256 + 999) { -+ pcd->request_config = 1; -+ } -+} -+ -+#ifdef DWC_UTE_CFI -+/** -+ * This functions delegates the CFI setup commands to the gadget driver. -+ * This function will return a negative value to indicate a failure. -+ */ -+static inline int cfi_gadget_setup(dwc_otg_pcd_t * pcd, -+ struct cfi_usb_ctrlrequest *ctrl_req) -+{ -+ int ret = 0; -+ -+ if (pcd->fops && pcd->fops->cfi_setup) { -+ DWC_SPINUNLOCK(pcd->lock); -+ ret = pcd->fops->cfi_setup(pcd, ctrl_req); -+ DWC_SPINLOCK(pcd->lock); -+ if (ret < 0) { -+ ep0_do_stall(pcd, ret); -+ return ret; -+ } -+ } -+ -+ return ret; -+} -+#endif -+ -+/** -+ * This function starts the Zero-Length Packet for the IN status phase -+ * of a 2 stage control transfer. -+ */ -+static inline void do_setup_in_status_phase(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ if (pcd->ep0state == EP0_STALL) { -+ return; -+ } -+ -+ pcd->ep0state = EP0_IN_STATUS_PHASE; -+ -+ /* Prepare for more SETUP Packets */ -+ DWC_DEBUGPL(DBG_PCD, "EP0 IN ZLP\n"); -+ if ((GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_3_00a) -+ && (pcd->core_if->dma_desc_enable) -+ && (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len)) { -+ DWC_DEBUGPL(DBG_PCDV, -+ "Data terminated wait next packet in out_desc_addr\n"); -+ pcd->backup_buf = phys_to_virt(ep0->dwc_ep.dma_addr); -+ pcd->data_terminated = 1; -+ } -+ ep0->dwc_ep.xfer_len = 0; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.is_in = 1; -+ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ -+ /* Prepare for more SETUP Packets */ -+ //ep0_out_start(GET_CORE_IF(pcd), pcd); -+} -+ -+/** -+ * This function starts the Zero-Length Packet for the OUT status phase -+ * of a 2 stage control transfer. -+ */ -+static inline void do_setup_out_status_phase(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ if (pcd->ep0state == EP0_STALL) { -+ DWC_DEBUGPL(DBG_PCD, "EP0 STALLED\n"); -+ return; -+ } -+ pcd->ep0state = EP0_OUT_STATUS_PHASE; -+ -+ DWC_DEBUGPL(DBG_PCD, "EP0 OUT ZLP\n"); -+ ep0->dwc_ep.xfer_len = 0; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.is_in = 0; -+ ep0->dwc_ep.dma_addr = pcd->setup_pkt_dma_handle; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); -+ -+ /* Prepare for more SETUP Packets */ -+ if (GET_CORE_IF(pcd)->dma_enable == 0) { -+ ep0_out_start(GET_CORE_IF(pcd), pcd); -+ } -+} -+ -+/** -+ * Clear the EP halt (STALL) and if pending requests start the -+ * transfer. -+ */ -+static inline void pcd_clear_halt(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) -+{ -+ if (ep->dwc_ep.stall_clear_flag == 0) -+ dwc_otg_ep_clear_stall(GET_CORE_IF(pcd), &ep->dwc_ep); -+ -+ /* Reactive the EP */ -+ dwc_otg_ep_activate(GET_CORE_IF(pcd), &ep->dwc_ep); -+ if (ep->stopped) { -+ ep->stopped = 0; -+ /* If there is a request in the EP queue start it */ -+ -+ /** @todo FIXME: this causes an EP mismatch in DMA mode. -+ * epmismatch not yet implemented. */ -+ -+ /* -+ * Above fixme is solved by implmenting a tasklet to call the -+ * start_next_request(), outside of interrupt context at some -+ * time after the current time, after a clear-halt setup packet. -+ * Still need to implement ep mismatch in the future if a gadget -+ * ever uses more than one endpoint at once -+ */ -+ ep->queue_sof = 1; -+ DWC_TASK_SCHEDULE(pcd->start_xfer_tasklet); -+ } -+ /* Start Control Status Phase */ -+ do_setup_in_status_phase(pcd); -+} -+ -+/** -+ * This function is called when the SET_FEATURE TEST_MODE Setup packet -+ * is sent from the host. The Device Control register is written with -+ * the Test Mode bits set to the specified Test Mode. This is done as -+ * a tasklet so that the "Status" phase of the control transfer -+ * completes before transmitting the TEST packets. -+ * -+ * @todo This has not been tested since the tasklet struct was put -+ * into the PCD struct! -+ * -+ */ -+void do_test_mode(void *data) -+{ -+ dctl_data_t dctl; -+ dwc_otg_pcd_t *pcd = (dwc_otg_pcd_t *) data; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ int test_mode = pcd->test_mode; -+ -+// DWC_WARN("%s() has not been tested since being rewritten!\n", __func__); -+ -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ switch (test_mode) { -+ case 1: // TEST_J -+ dctl.b.tstctl = 1; -+ break; -+ -+ case 2: // TEST_K -+ dctl.b.tstctl = 2; -+ break; -+ -+ case 3: // TEST_SE0_NAK -+ dctl.b.tstctl = 3; -+ break; -+ -+ case 4: // TEST_PACKET -+ dctl.b.tstctl = 4; -+ break; -+ -+ case 5: // TEST_FORCE_ENABLE -+ dctl.b.tstctl = 5; -+ break; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+} -+ -+/** -+ * This function process the GET_STATUS Setup Commands. -+ */ -+static inline void do_get_status(dwc_otg_pcd_t * pcd) -+{ -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ uint16_t *status = pcd->status_buf; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, -+ "GET_STATUS %02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+#endif -+ -+ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { -+ case UT_DEVICE: -+ if(UGETW(ctrl.wIndex) == 0xF000) { /* OTG Status selector */ -+ DWC_PRINTF("wIndex - %d\n", UGETW(ctrl.wIndex)); -+ DWC_PRINTF("OTG VERSION - %d\n", core_if->otg_ver); -+ DWC_PRINTF("OTG CAP - %d, %d\n", -+ core_if->core_params->otg_cap, -+ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); -+ if (core_if->otg_ver == 1 -+ && core_if->core_params->otg_cap == -+ DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ uint8_t *otgsts = (uint8_t*)pcd->status_buf; -+ *otgsts = (core_if->otg_sts & 0x1); -+ pcd->ep0_pending = 1; -+ ep0->dwc_ep.start_xfer_buff = -+ (uint8_t *) otgsts; -+ ep0->dwc_ep.xfer_buff = (uint8_t *) otgsts; -+ ep0->dwc_ep.dma_addr = -+ pcd->status_buf_dma_handle; -+ ep0->dwc_ep.xfer_len = 1; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ return; -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ } else { -+ *status = 0x1; /* Self powered */ -+ *status |= pcd->remote_wakeup_enable << 1; -+ break; -+ } -+ case UT_INTERFACE: -+ *status = 0; -+ break; -+ -+ case UT_ENDPOINT: -+ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); -+ if (ep == 0 || UGETW(ctrl.wLength) > 2) { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ /** @todo check for EP stall */ -+ *status = ep->stopped; -+ break; -+ } -+ pcd->ep0_pending = 1; -+ ep0->dwc_ep.start_xfer_buff = (uint8_t *) status; -+ ep0->dwc_ep.xfer_buff = (uint8_t *) status; -+ ep0->dwc_ep.dma_addr = pcd->status_buf_dma_handle; -+ ep0->dwc_ep.xfer_len = 2; -+ ep0->dwc_ep.xfer_count = 0; -+ ep0->dwc_ep.total_len = ep0->dwc_ep.xfer_len; -+ dwc_otg_ep0_start_transfer(GET_CORE_IF(pcd), &ep0->dwc_ep); -+} -+ -+/** -+ * This function process the SET_FEATURE Setup Commands. -+ */ -+static inline void do_set_feature(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep = 0; -+ int32_t otg_cap_param = core_if->core_params->otg_cap; -+ gotgctl_data_t gotgctl = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_PCD, "SET_FEATURE:%02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+ DWC_DEBUGPL(DBG_PCD, "otg_cap=%d\n", otg_cap_param); -+ -+ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { -+ case UT_DEVICE: -+ switch (UGETW(ctrl.wValue)) { -+ case UF_DEVICE_REMOTE_WAKEUP: -+ pcd->remote_wakeup_enable = 1; -+ break; -+ -+ case UF_TEST_MODE: -+ /* Setup the Test Mode tasklet to do the Test -+ * Packet generation after the SETUP Status -+ * phase has completed. */ -+ -+ /** @todo This has not been tested since the -+ * tasklet struct was put into the PCD -+ * struct! */ -+ pcd->test_mode = UGETW(ctrl.wIndex) >> 8; -+ DWC_TASK_SCHEDULE(pcd->test_mode_tasklet); -+ break; -+ -+ case UF_DEVICE_B_HNP_ENABLE: -+ DWC_DEBUGPL(DBG_PCDV, -+ "SET_FEATURE: USB_DEVICE_B_HNP_ENABLE\n"); -+ -+ /* dev may initiate HNP */ -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ pcd->b_hnp_enable = 1; -+ dwc_otg_pcd_update_otg(pcd, 0); -+ DWC_DEBUGPL(DBG_PCD, "Request B HNP\n"); -+ /**@todo Is the gotgctl.devhnpen cleared -+ * by a USB Reset? */ -+ gotgctl.b.devhnpen = 1; -+ gotgctl.b.hnpreq = 1; -+ DWC_WRITE_REG32(&global_regs->gotgctl, -+ gotgctl.d32); -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ -+ case UF_DEVICE_A_HNP_SUPPORT: -+ /* RH port supports HNP */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "SET_FEATURE: USB_DEVICE_A_HNP_SUPPORT\n"); -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ pcd->a_hnp_support = 1; -+ dwc_otg_pcd_update_otg(pcd, 0); -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ -+ case UF_DEVICE_A_ALT_HNP_SUPPORT: -+ /* other RH port does */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "SET_FEATURE: USB_DEVICE_A_ALT_HNP_SUPPORT\n"); -+ if (otg_cap_param == DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE) { -+ pcd->a_alt_hnp_support = 1; -+ dwc_otg_pcd_update_otg(pcd, 0); -+ } else { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ break; -+ -+ default: -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ -+ } -+ do_setup_in_status_phase(pcd); -+ break; -+ -+ case UT_INTERFACE: -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ -+ case UT_ENDPOINT: -+ if (UGETW(ctrl.wValue) == UF_ENDPOINT_HALT) { -+ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); -+ if (ep == 0) { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ ep->stopped = 1; -+ dwc_otg_ep_set_stall(core_if, &ep->dwc_ep); -+ } -+ do_setup_in_status_phase(pcd); -+ break; -+ } -+} -+ -+/** -+ * This function process the CLEAR_FEATURE Setup Commands. -+ */ -+static inline void do_clear_feature(dwc_otg_pcd_t * pcd) -+{ -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep = 0; -+ -+ DWC_DEBUGPL(DBG_PCD, -+ "CLEAR_FEATURE:%02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+ -+ switch (UT_GET_RECIPIENT(ctrl.bmRequestType)) { -+ case UT_DEVICE: -+ switch (UGETW(ctrl.wValue)) { -+ case UF_DEVICE_REMOTE_WAKEUP: -+ pcd->remote_wakeup_enable = 0; -+ break; -+ -+ case UF_TEST_MODE: -+ /** @todo Add CLEAR_FEATURE for TEST modes. */ -+ break; -+ -+ default: -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ do_setup_in_status_phase(pcd); -+ break; -+ -+ case UT_ENDPOINT: -+ ep = get_ep_by_addr(pcd, UGETW(ctrl.wIndex)); -+ if (ep == 0) { -+ ep0_do_stall(pcd, -DWC_E_NOT_SUPPORTED); -+ return; -+ } -+ -+ pcd_clear_halt(pcd, ep); -+ -+ break; -+ } -+} -+ -+/** -+ * This function process the SET_ADDRESS Setup Commands. -+ */ -+static inline void do_set_address(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ -+ if (ctrl.bmRequestType == UT_DEVICE) { -+ dcfg_data_t dcfg = {.d32 = 0 }; -+ -+#ifdef DEBUG_EP0 -+// DWC_DEBUGPL(DBG_PCDV, "SET_ADDRESS:%d\n", ctrl.wValue); -+#endif -+ dcfg.b.devaddr = UGETW(ctrl.wValue); -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dcfg, 0, dcfg.d32); -+ do_setup_in_status_phase(pcd); -+ } -+} -+ -+/** -+ * This function processes SETUP commands. In Linux, the USB Command -+ * processing is done in two places - the first being the PCD and the -+ * second in the Gadget Driver (for example, the File-Backed Storage -+ * Gadget Driver). -+ * -+ *
Parameter NameMeaning
otg_capSpecifies the OTG capabilities. The driver will automatically detect the -+ value for this parameter if none is specified. -+ - 0: HNP and SRP capable (default, if available) -+ - 1: SRP Only capable -+ - 2: No HNP/SRP capable -+
dma_enableSpecifies whether to use slave or DMA mode for accessing the data FIFOs. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Slave -+ - 1: DMA (default, if available) -+
dma_burst_sizeThe DMA Burst size (applicable only for External DMA Mode). -+ - Values: 1, 4, 8 16, 32, 64, 128, 256 (default 32) -+
speedSpecifies the maximum speed of operation in host and device mode. The -+ actual speed depends on the speed of the attached device and the value of -+ phy_type. -+ - 0: High Speed (default) -+ - 1: Full Speed -+
host_support_fs_ls_low_powerSpecifies whether low power mode is supported when attached to a Full -+ Speed or Low Speed device in host mode. -+ - 0: Don't support low power mode (default) -+ - 1: Support low power mode -+
host_ls_low_power_phy_clkSpecifies the PHY clock rate in low power mode when connected to a Low -+ Speed device in host mode. This parameter is applicable only if -+ HOST_SUPPORT_FS_LS_LOW_POWER is enabled. -+ - 0: 48 MHz (default) -+ - 1: 6 MHz -+
enable_dynamic_fifo Specifies whether FIFOs may be resized by the driver software. -+ - 0: Use cC FIFO size parameters -+ - 1: Allow dynamic FIFO sizing (default) -+
data_fifo_sizeTotal number of 4-byte words in the data FIFO memory. This memory -+ includes the Rx FIFO, non-periodic Tx FIFO, and periodic Tx FIFOs. -+ - Values: 32 to 32768 (default 8192) -+ -+ Note: The total FIFO memory depth in the FPGA configuration is 8192. -+
dev_rx_fifo_sizeNumber of 4-byte words in the Rx FIFO in device mode when dynamic -+ FIFO sizing is enabled. -+ - Values: 16 to 32768 (default 1064) -+
dev_nperio_tx_fifo_sizeNumber of 4-byte words in the non-periodic Tx FIFO in device mode when -+ dynamic FIFO sizing is enabled. -+ - Values: 16 to 32768 (default 1024) -+
dev_perio_tx_fifo_size_n (n = 1 to 15)Number of 4-byte words in each of the periodic Tx FIFOs in device mode -+ when dynamic FIFO sizing is enabled. -+ - Values: 4 to 768 (default 256) -+
host_rx_fifo_sizeNumber of 4-byte words in the Rx FIFO in host mode when dynamic FIFO -+ sizing is enabled. -+ - Values: 16 to 32768 (default 1024) -+
host_nperio_tx_fifo_sizeNumber of 4-byte words in the non-periodic Tx FIFO in host mode when -+ dynamic FIFO sizing is enabled in the core. -+ - Values: 16 to 32768 (default 1024) -+
host_perio_tx_fifo_sizeNumber of 4-byte words in the host periodic Tx FIFO when dynamic FIFO -+ sizing is enabled. -+ - Values: 16 to 32768 (default 1024) -+
max_transfer_sizeThe maximum transfer size supported in bytes. -+ - Values: 2047 to 65,535 (default 65,535) -+
max_packet_countThe maximum number of packets in a transfer. -+ - Values: 15 to 511 (default 511) -+
host_channelsThe number of host channel registers to use. -+ - Values: 1 to 16 (default 12) -+ -+ Note: The FPGA configuration supports a maximum of 12 host channels. -+
dev_endpointsThe number of endpoints in addition to EP0 available for device mode -+ operations. -+ - Values: 1 to 15 (default 6 IN and OUT) -+ -+ Note: The FPGA configuration supports a maximum of 6 IN and OUT endpoints in -+ addition to EP0. -+
phy_typeSpecifies the type of PHY interface to use. By default, the driver will -+ automatically detect the phy_type. -+ - 0: Full Speed -+ - 1: UTMI+ (default, if available) -+ - 2: ULPI -+
phy_utmi_widthSpecifies the UTMI+ Data Width. This parameter is applicable for a -+ phy_type of UTMI+. Also, this parameter is applicable only if the -+ OTG_HSPHY_WIDTH cC parameter was set to "8 and 16 bits", meaning that the -+ core has been configured to work at either data path width. -+ - Values: 8 or 16 bits (default 16) -+
phy_ulpi_ddrSpecifies whether the ULPI operates at double or single data rate. This -+ parameter is only applicable if phy_type is ULPI. -+ - 0: single data rate ULPI interface with 8 bit wide data bus (default) -+ - 1: double data rate ULPI interface with 4 bit wide data bus -+
i2c_enableSpecifies whether to use the I2C interface for full speed PHY. This -+ parameter is only applicable if PHY_TYPE is FS. -+ - 0: Disabled (default) -+ - 1: Enabled -+
ulpi_fs_lsSpecifies whether to use ULPI FS/LS mode only. -+ - 0: Disabled (default) -+ - 1: Enabled -+
ts_dlineSpecifies whether term select D-Line pulsing for all PHYs is enabled. -+ - 0: Disabled (default) -+ - 1: Enabled -+
en_multiple_tx_fifoSpecifies whether dedicatedto tx fifos are enabled for non periodic IN EPs. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Disabled -+ - 1: Enabled (default, if available) -+
dev_tx_fifo_size_n (n = 1 to 15)Number of 4-byte words in each of the Tx FIFOs in device mode -+ when dynamic FIFO sizing is enabled. -+ - Values: 4 to 768 (default 256) -+
tx_thr_lengthTransmit Threshold length in 32 bit double words -+ - Values: 8 to 128 (default 64) -+
rx_thr_lengthReceive Threshold length in 32 bit double words -+ - Values: 8 to 128 (default 64) -+
thr_ctlSpecifies whether to enable Thresholding for Device mode. Bits 0, 1, 2 of -+ this parmater specifies if thresholding is enabled for non-Iso Tx, Iso Tx and -+ Rx transfers accordingly. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - Values: 0 to 7 (default 0) -+ Bit values indicate: -+ - 0: Thresholding disabled -+ - 1: Thresholding enabled -+
dma_desc_enableSpecifies whether to enable Descriptor DMA mode. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Descriptor DMA disabled -+ - 1: Descriptor DMA (default, if available) -+
mpi_enableSpecifies whether to enable MPI enhancement mode. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: MPI disabled (default) -+ - 1: MPI enable -+
pti_enableSpecifies whether to enable PTI enhancement support. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: PTI disabled (default) -+ - 1: PTI enable -+
lpm_enableSpecifies whether to enable LPM support. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: LPM disabled -+ - 1: LPM enable (default, if available) -+
ic_usb_capSpecifies whether to enable IC_USB capability. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: IC_USB disabled (default, if available) -+ - 1: IC_USB enable -+
ahb_thr_ratioSpecifies AHB Threshold ratio. -+ - Values: 0 to 3 (default 0) -+
power_downSpecifies Power Down(Hibernation) Mode. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: Power Down disabled (default) -+ - 2: Power Down enabled -+
reload_ctlSpecifies whether dynamic reloading of the HFIR register is allowed during -+ run time. The driver will automatically detect the value for this parameter if -+ none is specified. In case the HFIR value is reloaded when HFIR.RldCtrl == 1'b0 -+ the core might misbehave. -+ - 0: Reload Control disabled (default) -+ - 1: Reload Control enabled -+
dev_out_nakSpecifies whether Device OUT NAK enhancement enabled or no. -+ The driver will automatically detect the value for this parameter if -+ none is specified. This parameter is valid only when OTG_EN_DESC_DMA == 1b1. -+ - 0: The core does not set NAK after Bulk OUT transfer complete (default) -+ - 1: The core sets NAK after Bulk OUT transfer complete -+
cont_on_bnaSpecifies whether Enable Continue on BNA enabled or no. -+ After receiving BNA interrupt the core disables the endpoint,when the -+ endpoint is re-enabled by the application the -+ - 0: Core starts processing from the DOEPDMA descriptor (default) -+ - 1: Core starts processing from the descriptor which received the BNA. -+ This parameter is valid only when OTG_EN_DESC_DMA == 1b1. -+
ahb_singleThis bit when programmed supports SINGLE transfers for remainder data -+ in a transfer for DMA mode of operation. -+ - 0: The remainder data will be sent using INCR burst size (default) -+ - 1: The remainder data will be sent using SINGLE burst size. -+
adp_enableSpecifies whether ADP feature is enabled. -+ The driver will automatically detect the value for this parameter if none is -+ specified. -+ - 0: ADP feature disabled (default) -+ - 1: ADP feature enabled -+
otg_verSpecifies whether OTG is performing as USB OTG Revision 2.0 or Revision 1.3 -+ USB OTG device. -+ - 0: OTG 2.0 support disabled (default) -+ - 1: OTG 2.0 support enabled -+
-+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ * -+ *
Command Driver Description
GET_STATUS PCD Command is processed as -+ * defined in chapter 9 of the USB 2.0 Specification chapter 9 -+ *
CLEAR_FEATURE PCD The Device and Endpoint -+ * requests are the ENDPOINT_HALT feature is procesed, all others the -+ * interface requests are ignored.
SET_FEATURE PCD The Device and Endpoint -+ * requests are processed by the PCD. Interface requests are passed -+ * to the Gadget Driver.
SET_ADDRESS PCD Program the DCFG reg, -+ * with device address received
GET_DESCRIPTOR Gadget Driver Return the -+ * requested descriptor
SET_DESCRIPTOR Gadget Driver Optional - -+ * not implemented by any of the existing Gadget Drivers.
SET_CONFIGURATION Gadget Driver Disable -+ * all EPs and enable EPs for new configuration.
GET_CONFIGURATION Gadget Driver Return -+ * the current configuration
SET_INTERFACE Gadget Driver Disable all -+ * EPs and enable EPs for new configuration.
GET_INTERFACE Gadget Driver Return the -+ * current interface.
SYNC_FRAME PCD Display debug -+ * message.
-+ * -+ * When the SETUP Phase Done interrupt occurs, the PCD SETUP commands are -+ * processed by pcd_setup. Calling the Function Driver's setup function from -+ * pcd_setup processes the gadget SETUP commands. -+ */ -+static inline void pcd_setup(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ usb_device_request_t ctrl = pcd->setup_pkt->req; -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ -+ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; -+ -+#ifdef DWC_UTE_CFI -+ int retval = 0; -+ struct cfi_usb_ctrlrequest cfi_req; -+#endif -+ -+ doeptsize0.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[0]->doeptsiz); -+ -+ /** In BDMA more then 1 setup packet is not supported till 3.00a */ -+ if (core_if->dma_enable && core_if->dma_desc_enable == 0 -+ && (doeptsize0.b.supcnt < 2) -+ && (core_if->snpsid < OTG_CORE_REV_2_94a)) { -+ DWC_ERROR -+ ("\n\n----------- CANNOT handle > 1 setup packet in DMA mode\n\n"); -+ } -+ if ((core_if->snpsid >= OTG_CORE_REV_3_00a) -+ && (core_if->dma_enable == 1) && (core_if->dma_desc_enable == 0)) { -+ ctrl = -+ (pcd->setup_pkt + -+ (3 - doeptsize0.b.supcnt - 1 + -+ ep0->dwc_ep.stp_rollover))->req; -+ } -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "SETUP %02x.%02x v%04x i%04x l%04x\n", -+ ctrl.bmRequestType, ctrl.bRequest, -+ UGETW(ctrl.wValue), UGETW(ctrl.wIndex), -+ UGETW(ctrl.wLength)); -+#endif -+ -+ /* Clean up the request queue */ -+ dwc_otg_request_nuke(ep0); -+ ep0->stopped = 0; -+ -+ if (ctrl.bmRequestType & UE_DIR_IN) { -+ ep0->dwc_ep.is_in = 1; -+ pcd->ep0state = EP0_IN_DATA_PHASE; -+ } else { -+ ep0->dwc_ep.is_in = 0; -+ pcd->ep0state = EP0_OUT_DATA_PHASE; -+ } -+ -+ if (UGETW(ctrl.wLength) == 0) { -+ ep0->dwc_ep.is_in = 1; -+ pcd->ep0state = EP0_IN_STATUS_PHASE; -+ } -+ -+ if (UT_GET_TYPE(ctrl.bmRequestType) != UT_STANDARD) { -+ -+#ifdef DWC_UTE_CFI -+ DWC_MEMCPY(&cfi_req, &ctrl, sizeof(usb_device_request_t)); -+ -+ //printk(KERN_ALERT "CFI: req_type=0x%02x; req=0x%02x\n", -+ ctrl.bRequestType, ctrl.bRequest); -+ if (UT_GET_TYPE(cfi_req.bRequestType) == UT_VENDOR) { -+ if (cfi_req.bRequest > 0xB0 && cfi_req.bRequest < 0xBF) { -+ retval = cfi_setup(pcd, &cfi_req); -+ if (retval < 0) { -+ ep0_do_stall(pcd, retval); -+ pcd->ep0_pending = 0; -+ return; -+ } -+ -+ /* if need gadget setup then call it and check the retval */ -+ if (pcd->cfi->need_gadget_att) { -+ retval = -+ cfi_gadget_setup(pcd, -+ &pcd-> -+ cfi->ctrl_req); -+ if (retval < 0) { -+ pcd->ep0_pending = 0; -+ return; -+ } -+ } -+ -+ if (pcd->cfi->need_status_in_complete) { -+ do_setup_in_status_phase(pcd); -+ } -+ return; -+ } -+ } -+#endif -+ -+ /* handle non-standard (class/vendor) requests in the gadget driver */ -+ do_gadget_setup(pcd, &ctrl); -+ return; -+ } -+ -+ /** @todo NGS: Handle bad setup packet? */ -+ -+/////////////////////////////////////////// -+//// --- Standard Request handling --- //// -+ -+ switch (ctrl.bRequest) { -+ case UR_GET_STATUS: -+ do_get_status(pcd); -+ break; -+ -+ case UR_CLEAR_FEATURE: -+ do_clear_feature(pcd); -+ break; -+ -+ case UR_SET_FEATURE: -+ do_set_feature(pcd); -+ break; -+ -+ case UR_SET_ADDRESS: -+ do_set_address(pcd); -+ break; -+ -+ case UR_SET_INTERFACE: -+ case UR_SET_CONFIG: -+// _pcd->request_config = 1; /* Configuration changed */ -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ -+ case UR_SYNCH_FRAME: -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ -+ default: -+ /* Call the Gadget Driver's setup functions */ -+ do_gadget_setup(pcd, &ctrl); -+ break; -+ } -+} -+ -+/** -+ * This function completes the ep0 control transfer. -+ */ -+static int32_t ep0_complete_request(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *in_ep_regs = -+ dev_if->in_ep_regs[ep->dwc_ep.num]; -+#ifdef DEBUG_EP0 -+ dwc_otg_dev_out_ep_regs_t *out_ep_regs = -+ dev_if->out_ep_regs[ep->dwc_ep.num]; -+#endif -+ deptsiz0_data_t deptsiz; -+ dev_dma_desc_sts_t desc_sts; -+ dwc_otg_pcd_request_t *req; -+ int is_last = 0; -+ dwc_otg_pcd_t *pcd = ep->pcd; -+ -+#ifdef DWC_UTE_CFI -+ struct cfi_usb_ctrlrequest *ctrlreq; -+ int retval = -DWC_E_NOT_SUPPORTED; -+#endif -+ -+ desc_sts.b.bytes = 0; -+ -+ if (pcd->ep0_pending && DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ if (ep->dwc_ep.is_in) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Do setup OUT status phase\n"); -+#endif -+ do_setup_out_status_phase(pcd); -+ } else { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Do setup IN status phase\n"); -+#endif -+ -+#ifdef DWC_UTE_CFI -+ ctrlreq = &pcd->cfi->ctrl_req; -+ -+ if (UT_GET_TYPE(ctrlreq->bRequestType) == UT_VENDOR) { -+ if (ctrlreq->bRequest > 0xB0 -+ && ctrlreq->bRequest < 0xBF) { -+ -+ /* Return if the PCD failed to handle the request */ -+ if ((retval = -+ pcd->cfi->ops. -+ ctrl_write_complete(pcd->cfi, -+ pcd)) < 0) { -+ CFI_INFO -+ ("ERROR setting a new value in the PCD(%d)\n", -+ retval); -+ ep0_do_stall(pcd, retval); -+ pcd->ep0_pending = 0; -+ return 0; -+ } -+ -+ /* If the gadget needs to be notified on the request */ -+ if (pcd->cfi->need_gadget_att == 1) { -+ //retval = do_gadget_setup(pcd, &pcd->cfi->ctrl_req); -+ retval = -+ cfi_gadget_setup(pcd, -+ &pcd->cfi-> -+ ctrl_req); -+ -+ /* Return from the function if the gadget failed to process -+ * the request properly - this should never happen !!! -+ */ -+ if (retval < 0) { -+ CFI_INFO -+ ("ERROR setting a new value in the gadget(%d)\n", -+ retval); -+ pcd->ep0_pending = 0; -+ return 0; -+ } -+ } -+ -+ CFI_INFO("%s: RETVAL=%d\n", __func__, -+ retval); -+ /* If we hit here then the PCD and the gadget has properly -+ * handled the request - so send the ZLP IN to the host. -+ */ -+ /* @todo: MAS - decide whether we need to start the setup -+ * stage based on the need_setup value of the cfi object -+ */ -+ do_setup_in_status_phase(pcd); -+ pcd->ep0_pending = 0; -+ return 1; -+ } -+ } -+#endif -+ -+ do_setup_in_status_phase(pcd); -+ } -+ pcd->ep0_pending = 0; -+ return 1; -+ } -+ -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ return 0; -+ } -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ -+ if (pcd->ep0state == EP0_OUT_STATUS_PHASE -+ || pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ is_last = 1; -+ } else if (ep->dwc_ep.is_in) { -+ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); -+ if (core_if->dma_desc_enable != 0) -+ desc_sts = dev_if->in_desc_addr->status; -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xfersize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+#endif -+ -+ if (((core_if->dma_desc_enable == 0) -+ && (deptsiz.b.xfersize == 0)) -+ || ((core_if->dma_desc_enable != 0) -+ && (desc_sts.b.bytes == 0))) { -+ req->actual = ep->dwc_ep.xfer_count; -+ /* Is a Zero Len Packet needed? */ -+ if (req->sent_zlp) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "Setup Rx ZLP\n"); -+#endif -+ req->sent_zlp = 0; -+ } -+ do_setup_out_status_phase(pcd); -+ } -+ } else { -+ /* ep0-OUT */ -+#ifdef DEBUG_EP0 -+ deptsiz.d32 = DWC_READ_REG32(&out_ep_regs->doeptsiz); -+ DWC_DEBUGPL(DBG_PCDV, "%d len=%d xsize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+#endif -+ req->actual = ep->dwc_ep.xfer_count; -+ -+ /* Is a Zero Len Packet needed? */ -+ if (req->sent_zlp) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "Setup Tx ZLP\n"); -+#endif -+ req->sent_zlp = 0; -+ } -+ /* For older cores do setup in status phase in Slave/BDMA modes, -+ * starting from 3.00 do that only in slave, and for DMA modes -+ * just re-enable ep 0 OUT here*/ -+ if (core_if->dma_enable == 0 -+ || (core_if->dma_desc_enable == 0 -+ && core_if->snpsid <= OTG_CORE_REV_2_94a)) { -+ do_setup_in_status_phase(pcd); -+ } else if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ DWC_DEBUGPL(DBG_PCDV, -+ "Enable out ep before in status phase\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ -+ /* Complete the request */ -+ if (is_last) { -+ dwc_otg_request_done(ep, req, 0); -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ return 1; -+ } -+ return 0; -+} -+ -+#ifdef DWC_UTE_CFI -+/** -+ * This function calculates traverses all the CFI DMA descriptors and -+ * and accumulates the bytes that are left to be transfered. -+ * -+ * @return The total bytes left to transfered, or a negative value as failure -+ */ -+static inline int cfi_calc_desc_residue(dwc_otg_pcd_ep_t * ep) -+{ -+ int32_t ret = 0; -+ int i; -+ struct dwc_otg_dma_desc *ddesc = NULL; -+ struct cfi_ep *cfiep; -+ -+ /* See if the pcd_ep has its respective cfi_ep mapped */ -+ cfiep = get_cfi_ep_by_pcd_ep(ep->pcd->cfi, ep); -+ if (!cfiep) { -+ CFI_INFO("%s: Failed to find ep\n", __func__); -+ return -1; -+ } -+ -+ ddesc = ep->dwc_ep.descs; -+ -+ for (i = 0; (i < cfiep->desc_count) && (i < MAX_DMA_DESCS_PER_EP); i++) { -+ -+#if defined(PRINT_CFI_DMA_DESCS) -+ print_desc(ddesc, ep->ep.name, i); -+#endif -+ ret += ddesc->status.b.bytes; -+ ddesc++; -+ } -+ -+ if (ret) -+ CFI_INFO("!!!!!!!!!! WARNING (%s) - residue=%d\n", __func__, -+ ret); -+ -+ return ret; -+} -+#endif -+ -+/** -+ * This function completes the request for the EP. If there are -+ * additional requests for the EP in the queue they will be started. -+ */ -+static void complete_ep(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); -+ struct device *dev = dwc_otg_pcd_to_dev(ep->pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ dwc_otg_dev_in_ep_regs_t *in_ep_regs = -+ dev_if->in_ep_regs[ep->dwc_ep.num]; -+ deptsiz_data_t deptsiz; -+ dev_dma_desc_sts_t desc_sts; -+ dwc_otg_pcd_request_t *req = 0; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ uint32_t byte_count = 0; -+ int is_last = 0; -+ int i; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s() %d-%s\n", __func__, ep->dwc_ep.num, -+ (ep->dwc_ep.is_in ? "IN" : "OUT")); -+ -+ /* Get any pending requests */ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (!req) { -+ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); -+ return; -+ } -+ } else { -+ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); -+ return; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "Requests %d\n", ep->pcd->request_pending); -+ -+ if (ep->dwc_ep.is_in) { -+ deptsiz.d32 = DWC_READ_REG32(&in_ep_regs->dieptsiz); -+ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable == 0) { -+ if (deptsiz.b.xfersize == 0 -+ && deptsiz.b.pktcnt == 0) { -+ byte_count = -+ ep->dwc_ep.xfer_len - -+ ep->dwc_ep.xfer_count; -+ -+ ep->dwc_ep.xfer_buff += byte_count; -+ ep->dwc_ep.dma_addr += byte_count; -+ ep->dwc_ep.xfer_count += byte_count; -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "%d-%s len=%d xfersize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, -+ (ep->dwc_ep. -+ is_in ? "IN" : "OUT"), -+ ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, -+ deptsiz.b.pktcnt); -+ -+ if (ep->dwc_ep.xfer_len < -+ ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer -+ (core_if, &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length transfer in case if it is queued -+ * a transfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Descriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 length. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer -+ (core_if, &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } else { -+ if (ep->dwc_ep.type == -+ DWC_OTG_EP_TYPE_ISOC) { -+ req->actual = 0; -+ dwc_otg_request_done(ep, req, 0); -+ -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ -+ /* If there is a request in the queue start it. */ -+ start_next_request(ep); -+ } else -+ DWC_WARN -+ ("Incomplete transfer (%d - %s [siz=%d pkt=%d])\n", -+ ep->dwc_ep.num, -+ (ep->dwc_ep.is_in ? "IN" : "OUT"), -+ deptsiz.b.xfersize, -+ deptsiz.b.pktcnt); -+ } -+ } else { -+ dma_desc = ep->dwc_ep.desc_addr; -+ byte_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ -+#ifdef DWC_UTE_CFI -+ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, -+ ep->dwc_ep.buff_mode); -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ int residue; -+ -+ residue = cfi_calc_desc_residue(ep); -+ if (residue < 0) -+ return; -+ -+ byte_count = residue; -+ } else { -+#endif -+ for (i = 0; i < ep->dwc_ep.desc_cnt; -+ ++i) { -+ desc_sts = dma_desc->status; -+ byte_count += desc_sts.b.bytes; -+ dma_desc++; -+ } -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ if (byte_count == 0) { -+ ep->dwc_ep.xfer_count = -+ ep->dwc_ep.total_len; -+ is_last = 1; -+ } else { -+ DWC_WARN("Incomplete transfer\n"); -+ } -+ } -+ } else { -+ if (deptsiz.b.xfersize == 0 && deptsiz.b.pktcnt == 0) { -+ DWC_DEBUGPL(DBG_PCDV, -+ "%d-%s len=%d xfersize=%d pktcnt=%d\n", -+ ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT", -+ ep->dwc_ep.xfer_len, -+ deptsiz.b.xfersize, -+ deptsiz.b.pktcnt); -+ -+ /* Check if the whole transfer was completed, -+ * if no, setup transfer for next portion of data -+ */ -+ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer(core_if, -+ &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length trasfer in case if it is queued -+ * a trasfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Desriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 legth. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer(core_if, -+ &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } else { -+ DWC_WARN -+ ("Incomplete transfer (%d-%s [siz=%d pkt=%d])\n", -+ ep->dwc_ep.num, -+ (ep->dwc_ep.is_in ? "IN" : "OUT"), -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ } -+ } -+ } else { -+ dwc_otg_dev_out_ep_regs_t *out_ep_regs = -+ dev_if->out_ep_regs[ep->dwc_ep.num]; -+ desc_sts.d32 = 0; -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ dma_desc = ep->dwc_ep.desc_addr; -+ byte_count = 0; -+ ep->dwc_ep.sent_zlp = 0; -+ -+#ifdef DWC_UTE_CFI -+ CFI_INFO("%s: BUFFER_MODE=%d\n", __func__, -+ ep->dwc_ep.buff_mode); -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ int residue; -+ residue = cfi_calc_desc_residue(ep); -+ if (residue < 0) -+ return; -+ byte_count = residue; -+ } else { -+#endif -+ -+ for (i = 0; i < ep->dwc_ep.desc_cnt; -+ ++i) { -+ desc_sts = dma_desc->status; -+ byte_count += desc_sts.b.bytes; -+ dma_desc++; -+ } -+ -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ /* Checking for interrupt Out transfers with not -+ * dword aligned mps sizes -+ */ -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_INTR && -+ (ep->dwc_ep.maxpacket%4)) { -+ ep->dwc_ep.xfer_count = -+ ep->dwc_ep.total_len - byte_count; -+ if ((ep->dwc_ep.xfer_len % -+ ep->dwc_ep.maxpacket) -+ && (ep->dwc_ep.xfer_len / -+ ep->dwc_ep.maxpacket < -+ MAX_DMA_DESC_CNT)) -+ ep->dwc_ep.xfer_len -= -+ (ep->dwc_ep.desc_cnt - -+ 1) * ep->dwc_ep.maxpacket + -+ ep->dwc_ep.xfer_len % -+ ep->dwc_ep.maxpacket; -+ else -+ ep->dwc_ep.xfer_len -= -+ ep->dwc_ep.desc_cnt * -+ ep->dwc_ep.maxpacket; -+ if (ep->dwc_ep.xfer_len > 0) { -+ dwc_otg_ep_start_transfer -+ (core_if, &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } else { -+ ep->dwc_ep.xfer_count = -+ ep->dwc_ep.total_len - byte_count + -+ ((4 - -+ (ep->dwc_ep. -+ total_len & 0x3)) & 0x3); -+ is_last = 1; -+ } -+ } else { -+ deptsiz.d32 = 0; -+ deptsiz.d32 = -+ DWC_READ_REG32(&out_ep_regs->doeptsiz); -+ -+ byte_count = (ep->dwc_ep.xfer_len - -+ ep->dwc_ep.xfer_count - -+ deptsiz.b.xfersize); -+ ep->dwc_ep.xfer_buff += byte_count; -+ ep->dwc_ep.dma_addr += byte_count; -+ ep->dwc_ep.xfer_count += byte_count; -+ -+ /* Check if the whole transfer was completed, -+ * if no, setup transfer for next portion of data -+ */ -+ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer(core_if, -+ &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length trasfer in case if it is queued -+ * a trasfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Desriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 legth. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer(core_if, -+ &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } -+ } else { -+ /* Check if the whole transfer was completed, -+ * if no, setup transfer for next portion of data -+ */ -+ if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) { -+ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); -+ } else if (ep->dwc_ep.sent_zlp) { -+ /* -+ * This fragment of code should initiate 0 -+ * length transfer in case if it is queued -+ * a transfer with size divisible to EPs max -+ * packet size and with usb_request zero field -+ * is set, which means that after data is transfered, -+ * it is also should be transfered -+ * a 0 length packet at the end. For Slave and -+ * Buffer DMA modes in this case SW has -+ * to initiate 2 transfers one with transfer size, -+ * and the second with 0 size. For Descriptor -+ * DMA mode SW is able to initiate a transfer, -+ * which will handle all the packets including -+ * the last 0 length. -+ */ -+ ep->dwc_ep.sent_zlp = 0; -+ dwc_otg_ep_start_zl_transfer(core_if, -+ &ep->dwc_ep); -+ } else { -+ is_last = 1; -+ } -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "addr %p, %d-%s len=%d cnt=%d xsize=%d pktcnt=%d\n", -+ &out_ep_regs->doeptsiz, ep->dwc_ep.num, -+ ep->dwc_ep.is_in ? "IN" : "OUT", -+ ep->dwc_ep.xfer_len, ep->dwc_ep.xfer_count, -+ deptsiz.b.xfersize, deptsiz.b.pktcnt); -+ } -+ -+ /* Complete the request */ -+ if (is_last) { -+#ifdef DWC_UTE_CFI -+ if (ep->dwc_ep.buff_mode != BM_STANDARD) { -+ req->actual = ep->dwc_ep.cfi_req_len - byte_count; -+ } else { -+#endif -+ req->actual = ep->dwc_ep.xfer_count; -+#ifdef DWC_UTE_CFI -+ } -+#endif -+ if (req->dw_align_buf) { -+ if (!ep->dwc_ep.is_in) { -+ dwc_memcpy(req->buf, req->dw_align_buf, req->length); -+ } -+ DWC_DMA_FREE(dev, req->length, req->dw_align_buf, -+ req->dw_align_buf_dma); -+ } -+ -+ dwc_otg_request_done(ep, req, 0); -+ -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ -+ /* If there is a request in the queue start it. */ -+ start_next_request(ep); -+ } -+} -+ -+#ifdef DWC_EN_ISOC -+ -+/** -+ * This function BNA interrupt for Isochronous EPs -+ * -+ */ -+static void dwc_otg_pcd_handle_iso_bna(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_ep_t *dwc_ep = &ep->dwc_ep; -+ volatile uint32_t *addr; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dwc_otg_pcd_t *pcd = ep->pcd; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ int i; -+ -+ dma_desc = -+ dwc_ep->iso_desc_addr + dwc_ep->desc_cnt * (dwc_ep->proc_buf_num); -+ -+ if (dwc_ep->is_in) { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { -+ sts.d32 = dma_desc->status.d32; -+ sts.b_iso_in.bs = BS_HOST_READY; -+ dma_desc->status.d32 = sts.d32; -+ } -+ } else { -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ for (i = 0; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { -+ sts.d32 = dma_desc->status.d32; -+ sts.b_iso_out.bs = BS_HOST_READY; -+ dma_desc->status.d32 = sts.d32; -+ } -+ } -+ -+ if (dwc_ep->is_in == 0) { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep-> -+ num]->doepctl; -+ } else { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ } -+ depctl.b.epena = 1; -+ DWC_MODIFY_REG32(addr, depctl.d32, depctl.d32); -+} -+ -+/** -+ * This function sets latest iso packet information(non-PTI mode) -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+void set_current_pkt_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ dma_addr_t dma_addr; -+ uint32_t offset; -+ -+ if (ep->proc_buf_num) -+ dma_addr = ep->dma_addr1; -+ else -+ dma_addr = ep->dma_addr0; -+ -+ if (ep->is_in) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[ep->num]->dieptsiz); -+ offset = ep->data_per_frame; -+ } else { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->num]->doeptsiz); -+ offset = -+ ep->data_per_frame + -+ (0x4 & (0x4 - (ep->data_per_frame & 0x3))); -+ } -+ -+ if (!deptsiz.b.xfersize) { -+ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; -+ ep->pkt_info[ep->cur_pkt].offset = -+ ep->cur_pkt_dma_addr - dma_addr; -+ ep->pkt_info[ep->cur_pkt].status = 0; -+ } else { -+ ep->pkt_info[ep->cur_pkt].length = ep->data_per_frame; -+ ep->pkt_info[ep->cur_pkt].offset = -+ ep->cur_pkt_dma_addr - dma_addr; -+ ep->pkt_info[ep->cur_pkt].status = -DWC_E_NO_DATA; -+ } -+ ep->cur_pkt_addr += offset; -+ ep->cur_pkt_dma_addr += offset; -+ ep->cur_pkt++; -+} -+ -+/** -+ * This function sets latest iso packet information(DDMA mode) -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP to start the transfer on. -+ * -+ */ -+static void set_ddma_iso_pkts_info(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * dwc_ep) -+{ -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ iso_pkt_info_t *iso_packet; -+ uint32_t data_per_desc; -+ uint32_t offset; -+ int i, j; -+ -+ iso_packet = dwc_ep->pkt_info; -+ -+ /** Reinit closed DMA Descriptors*/ -+ /** ISO OUT EP */ -+ if (dwc_ep->is_in == 0) { -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ offset = 0; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep-> -+ data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - -+ data_per_desc % -+ 4) : 0; -+ -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso_packet_decsriptor */ -+ iso_packet->status = -+ sts.b_iso_out.rxsts + -+ (sts.b_iso_out.bs ^ BS_DMA_DONE); -+ if (iso_packet->status) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ -+ /* Received data length */ -+ if (!sts.b_iso_out.rxbytes) { -+ iso_packet->length = -+ data_per_desc - -+ sts.b_iso_out.rxbytes; -+ } else { -+ iso_packet->length = -+ data_per_desc - -+ sts.b_iso_out.rxbytes + (4 - -+ dwc_ep->data_per_frame -+ % 4); -+ } -+ -+ iso_packet->offset = offset; -+ -+ offset += data_per_desc; -+ dma_desc++; -+ iso_packet++; -+ } -+ } -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso_packet_decsriptor */ -+ iso_packet->status = -+ sts.b_iso_out.rxsts + -+ (sts.b_iso_out.bs ^ BS_DMA_DONE); -+ if (iso_packet->status) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ -+ /* Received data length */ -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; -+ -+ iso_packet->offset = offset; -+ -+ offset += data_per_desc; -+ iso_packet++; -+ dma_desc++; -+ } -+ -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso_packet_decsriptor */ -+ iso_packet->status = -+ sts.b_iso_out.rxsts + (sts.b_iso_out.bs ^ BS_DMA_DONE); -+ if (iso_packet->status) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ /* Received data length */ -+ if (!sts.b_iso_out.rxbytes) { -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes; -+ } else { -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_out.rxbytes + -+ (4 - dwc_ep->data_per_frame % 4); -+ } -+ -+ iso_packet->offset = offset; -+ } else { -+/** ISO IN EP */ -+ -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { -+ sts.d32 = dma_desc->status.d32; -+ -+ /* Write status in iso packet descriptor */ -+ iso_packet->status = -+ sts.b_iso_in.txsts + -+ (sts.b_iso_in.bs ^ BS_DMA_DONE); -+ if (iso_packet->status != 0) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ -+ } -+ /* Bytes has been transfered */ -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; -+ -+ dma_desc++; -+ iso_packet++; -+ } -+ -+ sts.d32 = dma_desc->status.d32; -+ while (sts.b_iso_in.bs == BS_DMA_BUSY) { -+ sts.d32 = dma_desc->status.d32; -+ } -+ -+ /* Write status in iso packet descriptor ??? do be done with ERROR codes */ -+ iso_packet->status = -+ sts.b_iso_in.txsts + (sts.b_iso_in.bs ^ BS_DMA_DONE); -+ if (iso_packet->status != 0) { -+ iso_packet->status = -DWC_E_NO_DATA; -+ } -+ -+ /* Bytes has been transfered */ -+ iso_packet->length = -+ dwc_ep->data_per_frame - sts.b_iso_in.txbytes; -+ } -+} -+ -+/** -+ * This function reinitialize DMA Descriptors for Isochronous transfer -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP to start the transfer on. -+ * -+ */ -+static void reinit_ddma_iso_xfer(dwc_otg_core_if_t * core_if, dwc_ep_t * dwc_ep) -+{ -+ int i, j; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ dma_addr_t dma_ad; -+ volatile uint32_t *addr; -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ uint32_t data_per_desc; -+ -+ if (dwc_ep->is_in == 0) { -+ addr = &core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl; -+ } else { -+ addr = &core_if->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ } -+ -+ if (dwc_ep->proc_buf_num == 0) { -+ /** Buffer 0 descriptors setup */ -+ dma_ad = dwc_ep->dma_addr0; -+ } else { -+ /** Buffer 1 descriptors setup */ -+ dma_ad = dwc_ep->dma_addr1; -+ } -+ -+ /** Reinit closed DMA Descriptors*/ -+ /** ISO OUT EP */ -+ if (dwc_ep->is_in == 0) { -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ -+ sts.b_iso_out.bs = BS_HOST_READY; -+ sts.b_iso_out.rxsts = 0; -+ sts.b_iso_out.l = 0; -+ sts.b_iso_out.sp = 0; -+ sts.b_iso_out.ioc = 0; -+ sts.b_iso_out.pid = 0; -+ sts.b_iso_out.framenum = 0; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - dwc_ep->pkt_per_frm; -+ i += dwc_ep->pkt_per_frm) { -+ for (j = 0; j < dwc_ep->pkt_per_frm; ++j) { -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep-> -+ data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - -+ data_per_desc % -+ 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dma_ad += data_per_desc; -+ dma_desc++; -+ } -+ } -+ -+ for (j = 0; j < dwc_ep->pkt_per_frm - 1; ++j) { -+ -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dma_desc++; -+ dma_ad += data_per_desc; -+ } -+ -+ sts.b_iso_out.ioc = 1; -+ sts.b_iso_out.l = dwc_ep->proc_buf_num; -+ -+ data_per_desc = -+ ((j + 1) * dwc_ep->maxpacket > -+ dwc_ep->data_per_frame) ? dwc_ep->data_per_frame - -+ j * dwc_ep->maxpacket : dwc_ep->maxpacket; -+ data_per_desc += -+ (data_per_desc % 4) ? (4 - data_per_desc % 4) : 0; -+ sts.b_iso_out.rxbytes = data_per_desc; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ } else { -+/** ISO IN EP */ -+ -+ dma_desc = -+ dwc_ep->iso_desc_addr + -+ dwc_ep->desc_cnt * dwc_ep->proc_buf_num; -+ -+ sts.b_iso_in.bs = BS_HOST_READY; -+ sts.b_iso_in.txsts = 0; -+ sts.b_iso_in.sp = 0; -+ sts.b_iso_in.ioc = 0; -+ sts.b_iso_in.pid = dwc_ep->pkt_per_frm; -+ sts.b_iso_in.framenum = dwc_ep->next_frame; -+ sts.b_iso_in.txbytes = dwc_ep->data_per_frame; -+ sts.b_iso_in.l = 0; -+ -+ for (i = 0; i < dwc_ep->desc_cnt - 1; i++) { -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ sts.b_iso_in.framenum += dwc_ep->bInterval; -+ dma_ad += dwc_ep->data_per_frame; -+ dma_desc++; -+ } -+ -+ sts.b_iso_in.ioc = 1; -+ sts.b_iso_in.l = dwc_ep->proc_buf_num; -+ -+ dma_desc->buf = dma_ad; -+ dma_desc->status.d32 = sts.d32; -+ -+ dwc_ep->next_frame = -+ sts.b_iso_in.framenum + dwc_ep->bInterval * 1; -+ } -+ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; -+} -+ -+/** -+ * This function is to handle Iso EP transfer complete interrupt -+ * in case Iso out packet was dropped -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param dwc_ep The EP for wihich transfer complete was asserted -+ * -+ */ -+static uint32_t handle_iso_out_pkt_dropped(dwc_otg_core_if_t * core_if, -+ dwc_ep_t * dwc_ep) -+{ -+ uint32_t dma_addr; -+ uint32_t drp_pkt; -+ uint32_t drp_pkt_cnt; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ int i; -+ -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[dwc_ep->num]->doeptsiz); -+ -+ drp_pkt = dwc_ep->pkt_cnt - deptsiz.b.pktcnt; -+ drp_pkt_cnt = dwc_ep->pkt_per_frm - (drp_pkt % dwc_ep->pkt_per_frm); -+ -+ /* Setting dropped packets status */ -+ for (i = 0; i < drp_pkt_cnt; ++i) { -+ dwc_ep->pkt_info[drp_pkt].status = -DWC_E_NO_DATA; -+ drp_pkt++; -+ deptsiz.b.pktcnt--; -+ } -+ -+ if (deptsiz.b.pktcnt > 0) { -+ deptsiz.b.xfersize = -+ dwc_ep->xfer_len - (dwc_ep->pkt_cnt - -+ deptsiz.b.pktcnt) * dwc_ep->maxpacket; -+ } else { -+ deptsiz.b.xfersize = 0; -+ deptsiz.b.pktcnt = 0; -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz, -+ deptsiz.d32); -+ -+ if (deptsiz.b.pktcnt > 0) { -+ if (dwc_ep->proc_buf_num) { -+ dma_addr = -+ dwc_ep->dma_addr1 + dwc_ep->xfer_len - -+ deptsiz.b.xfersize; -+ } else { -+ dma_addr = -+ dwc_ep->dma_addr0 + dwc_ep->xfer_len - -+ deptsiz.b.xfersize;; -+ } -+ -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ out_ep_regs[dwc_ep->num]->doepdma, dma_addr); -+ -+ /** Re-enable endpoint, clear nak */ -+ depctl.d32 = 0; -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ -+ DWC_MODIFY_REG32(&core_if->dev_if-> -+ out_ep_regs[dwc_ep->num]->doepctl, depctl.d32, -+ depctl.d32); -+ return 0; -+ } else { -+ return 1; -+ } -+} -+ -+/** -+ * This function sets iso packets information(PTI mode) -+ * -+ * @param core_if Programming view of DWC_otg controller. -+ * @param ep The EP to start the transfer on. -+ * -+ */ -+static uint32_t set_iso_pkts_info(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) -+{ -+ int i, j; -+ dma_addr_t dma_ad; -+ iso_pkt_info_t *packet_info = ep->pkt_info; -+ uint32_t offset; -+ uint32_t frame_data; -+ deptsiz_data_t deptsiz; -+ -+ if (ep->proc_buf_num == 0) { -+ /** Buffer 0 descriptors setup */ -+ dma_ad = ep->dma_addr0; -+ } else { -+ /** Buffer 1 descriptors setup */ -+ dma_ad = ep->dma_addr1; -+ } -+ -+ if (ep->is_in) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if->in_ep_regs[ep->num]-> -+ dieptsiz); -+ } else { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[ep->num]-> -+ doeptsiz); -+ } -+ -+ if (!deptsiz.b.xfersize) { -+ offset = 0; -+ for (i = 0; i < ep->pkt_cnt; i += ep->pkt_per_frm) { -+ frame_data = ep->data_per_frame; -+ for (j = 0; j < ep->pkt_per_frm; ++j) { -+ -+ /* Packet status - is not set as initially -+ * it is set to 0 and if packet was sent -+ successfully, status field will remain 0*/ -+ -+ /* Bytes has been transfered */ -+ packet_info->length = -+ (ep->maxpacket < -+ frame_data) ? ep->maxpacket : frame_data; -+ -+ /* Received packet offset */ -+ packet_info->offset = offset; -+ offset += packet_info->length; -+ frame_data -= packet_info->length; -+ -+ packet_info++; -+ } -+ } -+ return 1; -+ } else { -+ /* This is a workaround for in case of Transfer Complete with -+ * PktDrpSts interrupts merging - in this case Transfer complete -+ * interrupt for Isoc Out Endpoint is asserted without PktDrpSts -+ * set and with DOEPTSIZ register non zero. Investigations showed, -+ * that this happens when Out packet is dropped, but because of -+ * interrupts merging during first interrupt handling PktDrpSts -+ * bit is cleared and for next merged interrupts it is not reset. -+ * In this case SW hadles the interrupt as if PktDrpSts bit is set. -+ */ -+ if (ep->is_in) { -+ return 1; -+ } else { -+ return handle_iso_out_pkt_dropped(core_if, ep); -+ } -+ } -+} -+ -+/** -+ * This function is to handle Iso EP transfer complete interrupt -+ * -+ * @param pcd The PCD -+ * @param ep The EP for which transfer complete was asserted -+ * -+ */ -+static void complete_iso_ep(dwc_otg_pcd_t * pcd, dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(ep->pcd); -+ dwc_ep_t *dwc_ep = &ep->dwc_ep; -+ uint8_t is_last = 0; -+ -+ if (ep->dwc_ep.next_frame == 0xffffffff) { -+ DWC_WARN("Next frame is not set!\n"); -+ return; -+ } -+ -+ if (core_if->dma_enable) { -+ if (core_if->dma_desc_enable) { -+ set_ddma_iso_pkts_info(core_if, dwc_ep); -+ reinit_ddma_iso_xfer(core_if, dwc_ep); -+ is_last = 1; -+ } else { -+ if (core_if->pti_enh_enable) { -+ if (set_iso_pkts_info(core_if, dwc_ep)) { -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ dwc_otg_iso_ep_start_buf_transfer -+ (core_if, dwc_ep); -+ is_last = 1; -+ } -+ } else { -+ set_current_pkt_info(core_if, dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ is_last = 1; -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr0; -+ } -+ -+ } -+ dwc_otg_iso_ep_start_frm_transfer(core_if, -+ dwc_ep); -+ } -+ } -+ } else { -+ set_current_pkt_info(core_if, dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ is_last = 1; -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = dwc_ep->dma_addr0; -+ } -+ -+ } -+ dwc_otg_iso_ep_start_frm_transfer(core_if, dwc_ep); -+ } -+ if (is_last) -+ dwc_otg_iso_buffer_done(pcd, ep, ep->iso_req_handle); -+} -+#endif /* DWC_EN_ISOC */ -+ -+/** -+ * This function handle BNA interrupt for Non Isochronous EPs -+ * -+ */ -+static void dwc_otg_pcd_handle_noniso_bna(dwc_otg_pcd_ep_t * ep) -+{ -+ dwc_ep_t *dwc_ep = &ep->dwc_ep; -+ volatile uint32_t *addr; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dwc_otg_pcd_t *pcd = ep->pcd; -+ dwc_otg_dev_dma_desc_t *dma_desc; -+ dev_dma_desc_sts_t sts = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if = ep->pcd->core_if; -+ int i, start; -+ -+ if (!dwc_ep->desc_cnt) -+ DWC_WARN("Ep%d %s Descriptor count = %d \n", dwc_ep->num, -+ (dwc_ep->is_in ? "IN" : "OUT"), dwc_ep->desc_cnt); -+ -+ if (core_if->core_params->cont_on_bna && !dwc_ep->is_in -+ && dwc_ep->type != DWC_OTG_EP_TYPE_CONTROL) { -+ uint32_t doepdma; -+ dwc_otg_dev_out_ep_regs_t *out_regs = -+ core_if->dev_if->out_ep_regs[dwc_ep->num]; -+ doepdma = DWC_READ_REG32(&(out_regs->doepdma)); -+ start = (doepdma - dwc_ep->dma_desc_addr)/sizeof(dwc_otg_dev_dma_desc_t); -+ dma_desc = &(dwc_ep->desc_addr[start]); -+ } else { -+ start = 0; -+ dma_desc = dwc_ep->desc_addr; -+ } -+ -+ -+ for (i = start; i < dwc_ep->desc_cnt; ++i, ++dma_desc) { -+ sts.d32 = dma_desc->status.d32; -+ sts.b.bs = BS_HOST_READY; -+ dma_desc->status.d32 = sts.d32; -+ } -+ -+ if (dwc_ep->is_in == 0) { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->out_ep_regs[dwc_ep->num]-> -+ doepctl; -+ } else { -+ addr = -+ &GET_CORE_IF(pcd)->dev_if->in_ep_regs[dwc_ep->num]->diepctl; -+ } -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ DWC_MODIFY_REG32(addr, 0, depctl.d32); -+} -+ -+/** -+ * This function handles EP0 Control transfers. -+ * -+ * The state of the control transfers are tracked in -+ * ep0state. -+ */ -+static void handle_ep0(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_pcd_ep_t *ep0 = &pcd->ep0; -+ dev_dma_desc_sts_t desc_sts; -+ deptsiz0_data_t deptsiz; -+ uint32_t byte_count; -+ -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); -+ print_ep0_state(pcd); -+#endif -+ -+// DWC_PRINTF("HANDLE EP0\n"); -+ -+ switch (pcd->ep0state) { -+ case EP0_DISCONNECT: -+ break; -+ -+ case EP0_IDLE: -+ pcd->request_config = 0; -+ -+ pcd_setup(pcd); -+ break; -+ -+ case EP0_IN_DATA_PHASE: -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "DATA_IN EP%d-%s: type=%d, mps=%d\n", -+ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), -+ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); -+#endif -+ -+ if (core_if->dma_enable != 0) { -+ /* -+ * For EP0 we can only program 1 packet at a time so we -+ * need to do the make calculations after each complete. -+ * Call write_packet to make the calculations, as in -+ * slave mode, and use those values to determine if we -+ * can complete. -+ */ -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->in_ep_regs[0]-> -+ dieptsiz); -+ byte_count = -+ ep0->dwc_ep.xfer_len - deptsiz.b.xfersize; -+ } else { -+ desc_sts = -+ core_if->dev_if->in_desc_addr->status; -+ byte_count = -+ ep0->dwc_ep.xfer_len - desc_sts.b.bytes; -+ } -+ ep0->dwc_ep.xfer_count += byte_count; -+ ep0->dwc_ep.xfer_buff += byte_count; -+ ep0->dwc_ep.dma_addr += byte_count; -+ } -+ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); -+ } else if (ep0->dwc_ep.sent_zlp) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ ep0->dwc_ep.sent_zlp = 0; -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); -+ } else { -+ ep0_complete_request(ep0); -+ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); -+ } -+ break; -+ case EP0_OUT_DATA_PHASE: -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "DATA_OUT EP%d-%s: type=%d, mps=%d\n", -+ ep0->dwc_ep.num, (ep0->dwc_ep.is_in ? "IN" : "OUT"), -+ ep0->dwc_ep.type, ep0->dwc_ep.maxpacket); -+#endif -+ if (core_if->dma_enable != 0) { -+ if (core_if->dma_desc_enable == 0) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if-> -+ dev_if->out_ep_regs[0]-> -+ doeptsiz); -+ byte_count = -+ ep0->dwc_ep.maxpacket - deptsiz.b.xfersize; -+ } else { -+ desc_sts = -+ core_if->dev_if->out_desc_addr->status; -+ byte_count = -+ ep0->dwc_ep.maxpacket - desc_sts.b.bytes; -+ } -+ ep0->dwc_ep.xfer_count += byte_count; -+ ep0->dwc_ep.xfer_buff += byte_count; -+ ep0->dwc_ep.dma_addr += byte_count; -+ } -+ if (ep0->dwc_ep.xfer_count < ep0->dwc_ep.total_len) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); -+ } else if (ep0->dwc_ep.sent_zlp) { -+ dwc_otg_ep0_continue_transfer(GET_CORE_IF(pcd), -+ &ep0->dwc_ep); -+ ep0->dwc_ep.sent_zlp = 0; -+ DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); -+ } else { -+ ep0_complete_request(ep0); -+ DWC_DEBUGPL(DBG_PCD, "COMPLETE TRANSFER\n"); -+ } -+ break; -+ -+ case EP0_IN_STATUS_PHASE: -+ case EP0_OUT_STATUS_PHASE: -+ DWC_DEBUGPL(DBG_PCD, "CASE: EP0_STATUS\n"); -+ ep0_complete_request(ep0); -+ pcd->ep0state = EP0_IDLE; -+ ep0->stopped = 1; -+ ep0->dwc_ep.is_in = 0; /* OUT for next SETUP */ -+ -+ /* Prepare for more SETUP Packets */ -+ if (core_if->dma_enable) { -+ ep0_out_start(core_if, pcd); -+ } -+ break; -+ -+ case EP0_STALL: -+ DWC_ERROR("EP0 STALLed, should not get here pcd_setup()\n"); -+ break; -+ } -+#ifdef DEBUG_EP0 -+ print_ep0_state(pcd); -+#endif -+} -+ -+/** -+ * Restart transfer -+ */ -+static void restart_transfer(dwc_otg_pcd_t * pcd, const uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if; -+ dwc_otg_dev_if_t *dev_if; -+ deptsiz_data_t dieptsiz = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep; -+ -+ ep = get_in_ep(pcd, epnum); -+ -+#ifdef DWC_EN_ISOC -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ return; -+ } -+#endif /* DWC_EN_ISOC */ -+ -+ core_if = GET_CORE_IF(pcd); -+ dev_if = core_if->dev_if; -+ -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); -+ -+ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x xfer_len=%0x" -+ " stopped=%d\n", ep->dwc_ep.xfer_buff, -+ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, ep->stopped); -+ /* -+ * If xfersize is 0 and pktcnt in not 0, resend the last packet. -+ */ -+ if (dieptsiz.b.pktcnt && dieptsiz.b.xfersize == 0 && -+ ep->dwc_ep.start_xfer_buff != 0) { -+ if (ep->dwc_ep.total_len <= ep->dwc_ep.maxpacket) { -+ ep->dwc_ep.xfer_count = 0; -+ ep->dwc_ep.xfer_buff = ep->dwc_ep.start_xfer_buff; -+ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; -+ } else { -+ ep->dwc_ep.xfer_count -= ep->dwc_ep.maxpacket; -+ /* convert packet size to dwords. */ -+ ep->dwc_ep.xfer_buff -= ep->dwc_ep.maxpacket; -+ ep->dwc_ep.xfer_len = ep->dwc_ep.xfer_count; -+ } -+ ep->stopped = 0; -+ DWC_DEBUGPL(DBG_PCD, "xfer_buff=%p xfer_count=%0x " -+ "xfer_len=%0x stopped=%d\n", -+ ep->dwc_ep.xfer_buff, -+ ep->dwc_ep.xfer_count, ep->dwc_ep.xfer_len, -+ ep->stopped); -+ if (epnum == 0) { -+ dwc_otg_ep0_start_transfer(core_if, &ep->dwc_ep); -+ } else { -+ dwc_otg_ep_start_transfer(core_if, &ep->dwc_ep); -+ } -+ } -+} -+ -+/* -+ * This function create new nextep sequnce based on Learn Queue. -+ * -+ * @param core_if Programming view of DWC_otg controller -+ */ -+void predict_nextep_seq( dwc_otg_core_if_t * core_if) -+{ -+ dwc_otg_device_global_regs_t *dev_global_regs = -+ core_if->dev_if->dev_global_regs; -+ const uint32_t TOKEN_Q_DEPTH = core_if->hwcfg2.b.dev_token_q_depth; -+ /* Number of Token Queue Registers */ -+ const int DTKNQ_REG_CNT = (TOKEN_Q_DEPTH + 7) / 8; -+ dtknq1_data_t dtknqr1; -+ uint32_t in_tkn_epnums[4]; -+ uint8_t seqnum[MAX_EPS_CHANNELS]; -+ uint8_t intkn_seq[TOKEN_Q_DEPTH]; -+ grstctl_t resetctl = {.d32 = 0 }; -+ uint8_t temp; -+ int ndx = 0; -+ int start = 0; -+ int end = 0; -+ int sort_done = 0; -+ int i = 0; -+ volatile uint32_t *addr = &dev_global_regs->dtknqr1; -+ -+ -+ DWC_DEBUGPL(DBG_PCD,"dev_token_q_depth=%d\n",TOKEN_Q_DEPTH); -+ -+ /* Read the DTKNQ Registers */ -+ for (i = 0; i < DTKNQ_REG_CNT; i++) { -+ in_tkn_epnums[i] = DWC_READ_REG32(addr); -+ DWC_DEBUGPL(DBG_PCDV, "DTKNQR%d=0x%08x\n", i + 1, -+ in_tkn_epnums[i]); -+ if (addr == &dev_global_regs->dvbusdis) { -+ addr = &dev_global_regs->dtknqr3_dthrctl; -+ } else { -+ ++addr; -+ } -+ -+ } -+ -+ /* Copy the DTKNQR1 data to the bit field. */ -+ dtknqr1.d32 = in_tkn_epnums[0]; -+ if (dtknqr1.b.wrap_bit) { -+ ndx = dtknqr1.b.intknwptr; -+ end = ndx -1; -+ if (end < 0) -+ end = TOKEN_Q_DEPTH -1; -+ } else { -+ ndx = 0; -+ end = dtknqr1.b.intknwptr -1; -+ if (end < 0) -+ end = 0; -+ } -+ start = ndx; -+ -+ /* Fill seqnum[] by initial values: EP number + 31 */ -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ seqnum[i] = i +31; -+ } -+ -+ /* Fill intkn_seq[] from in_tkn_epnums[0] */ -+ for (i=0; i < 6; i++) -+ intkn_seq[i] = (in_tkn_epnums[0] >> ((7-i) * 4)) & 0xf; -+ -+ if (TOKEN_Q_DEPTH > 6) { -+ /* Fill intkn_seq[] from in_tkn_epnums[1] */ -+ for (i=6; i < 14; i++) -+ intkn_seq[i] = -+ (in_tkn_epnums[1] >> ((7 - (i - 6)) * 4)) & 0xf; -+ } -+ -+ if (TOKEN_Q_DEPTH > 14) { -+ /* Fill intkn_seq[] from in_tkn_epnums[1] */ -+ for (i=14; i < 22; i++) -+ intkn_seq[i] = -+ (in_tkn_epnums[2] >> ((7 - (i - 14)) * 4)) & 0xf; -+ } -+ -+ if (TOKEN_Q_DEPTH > 22) { -+ /* Fill intkn_seq[] from in_tkn_epnums[1] */ -+ for (i=22; i < 30; i++) -+ intkn_seq[i] = -+ (in_tkn_epnums[3] >> ((7 - (i - 22)) * 4)) & 0xf; -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s start=%d end=%d intkn_seq[]:\n", __func__, -+ start, end); -+ for (i=0; idev_if->num_in_eps; i++) { -+ if (core_if->nextep_seq[i] == 0xff ) -+ seqnum[i] = 0xff; -+ } -+ -+ /* Sort seqnum[] */ -+ sort_done = 0; -+ while (!sort_done) { -+ sort_done = 1; -+ for (i=0; idev_if->num_in_eps; i++) { -+ if (seqnum[i] > seqnum[i+1]) { -+ temp = seqnum[i]; -+ seqnum[i] = seqnum[i+1]; -+ seqnum[i+1] = temp; -+ sort_done = 0; -+ } -+ } -+ } -+ -+ ndx = start + seqnum[0]; -+ if (ndx >= TOKEN_Q_DEPTH) -+ ndx = ndx % TOKEN_Q_DEPTH; -+ core_if->first_in_nextep_seq = intkn_seq[ndx]; -+ -+ /* Update seqnum[] by EP numbers */ -+ for (i=0; i<=core_if->dev_if->num_in_eps; i++) { -+ ndx = start + i; -+ if (seqnum[i] < 31) { -+ ndx = start + seqnum[i]; -+ if (ndx >= TOKEN_Q_DEPTH) -+ ndx = ndx % TOKEN_Q_DEPTH; -+ seqnum[i] = intkn_seq[ndx]; -+ } else { -+ if (seqnum[i] < 0xff) { -+ seqnum[i] = seqnum[i] - 31; -+ } else { -+ break; -+ } -+ } -+ } -+ -+ /* Update nextep_seq[] based on seqnum[] */ -+ for (i=0; idev_if->num_in_eps; i++) { -+ if (seqnum[i] != 0xff) { -+ if (seqnum[i+1] != 0xff) { -+ core_if->nextep_seq[seqnum[i]] = seqnum[i+1]; -+ } else { -+ core_if->nextep_seq[seqnum[i]] = core_if->first_in_nextep_seq; -+ break; -+ } -+ } else { -+ break; -+ } -+ } -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s first_in_nextep_seq= %2d; nextep_seq[]:\n", -+ __func__, core_if->first_in_nextep_seq); -+ for (i=0; i <= core_if->dev_if->num_in_eps; i++) { -+ DWC_DEBUGPL(DBG_PCDV,"%2d\n", core_if->nextep_seq[i]); -+ } -+ -+ /* Flush the Learning Queue */ -+ resetctl.d32 = DWC_READ_REG32(&core_if->core_global_regs->grstctl); -+ resetctl.b.intknqflsh = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32); -+ -+ -+} -+ -+/** -+ * handle the IN EP disable interrupt. -+ */ -+static inline void handle_in_ep_disable_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ deptsiz_data_t dieptsiz = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ gintmsk_data_t gintmsk_data; -+ depctl_data_t depctl; -+ uint32_t diepdma; -+ uint32_t remain_to_transfer = 0; -+ uint8_t i; -+ uint32_t xfer_size; -+ -+ ep = get_in_ep(pcd, epnum); -+ dwc_ep = &ep->dwc_ep; -+ -+ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); -+ complete_ep(ep); -+ return; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "diepctl%d=%0x\n", epnum, -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl)); -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->dieptsiz); -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); -+ -+ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", -+ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); -+ -+ if ((core_if->start_predict == 0) || (depctl.b.eptype & 1)) { -+ if (ep->stopped) { -+ if (core_if->en_multiple_tx_fifo) -+ /* Flush the Tx FIFO */ -+ dwc_otg_flush_tx_fifo(core_if, dwc_ep->tx_fifo_num); -+ /* Clear the Global IN NP NAK */ -+ dctl.d32 = 0; -+ dctl.b.cgnpinnak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ /* Restart the transaction */ -+ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { -+ restart_transfer(pcd, epnum); -+ } -+ } else { -+ /* Restart the transaction */ -+ if (dieptsiz.b.pktcnt != 0 || dieptsiz.b.xfersize != 0) { -+ restart_transfer(pcd, epnum); -+ } -+ DWC_DEBUGPL(DBG_ANY, "STOPPED!!!\n"); -+ } -+ return; -+ } -+ -+ if (core_if->start_predict > 2) { // NP IN EP -+ core_if->start_predict--; -+ return; -+ } -+ -+ core_if->start_predict--; -+ -+ if (core_if->start_predict == 1) { // All NP IN Ep's disabled now -+ -+ predict_nextep_seq(core_if); -+ -+ /* Update all active IN EP's NextEP field based of nextep_seq[] */ -+ for ( i = 0; i <= core_if->dev_if->num_in_eps; i++) { -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (core_if->nextep_seq[i] != 0xff) { // Active NP IN EP -+ depctl.b.nextep = core_if->nextep_seq[i]; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); -+ } -+ } -+ /* Flush Shared NP TxFIFO */ -+ dwc_otg_flush_tx_fifo(core_if, 0); -+ /* Rewind buffers */ -+ if (!core_if->dma_desc_enable) { -+ i = core_if->first_in_nextep_seq; -+ do { -+ ep = get_in_ep(pcd, i); -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); -+ xfer_size = ep->dwc_ep.total_len - ep->dwc_ep.xfer_count; -+ if (xfer_size > ep->dwc_ep.maxxfer) -+ xfer_size = ep->dwc_ep.maxxfer; -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (dieptsiz.b.pktcnt != 0) { -+ if (xfer_size == 0) { -+ remain_to_transfer = 0; -+ } else { -+ if ((xfer_size % ep->dwc_ep.maxpacket) == 0) { -+ remain_to_transfer = -+ dieptsiz.b.pktcnt * ep->dwc_ep.maxpacket; -+ } else { -+ remain_to_transfer = ((dieptsiz.b.pktcnt -1) * ep->dwc_ep.maxpacket) -+ + (xfer_size % ep->dwc_ep.maxpacket); -+ } -+ } -+ diepdma = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepdma); -+ dieptsiz.b.xfersize = remain_to_transfer; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->dieptsiz, dieptsiz.d32); -+ diepdma = ep->dwc_ep.dma_addr + (xfer_size - remain_to_transfer); -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepdma, diepdma); -+ } -+ i = core_if->nextep_seq[i]; -+ } while (i != core_if->first_in_nextep_seq); -+ } else { // dma_desc_enable -+ DWC_PRINTF("%s Learning Queue not supported in DDMA\n", __func__); -+ } -+ -+ /* Restart transfers in predicted sequences */ -+ i = core_if->first_in_nextep_seq; -+ do { -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (dieptsiz.b.pktcnt != 0) { -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ depctl.b.epena = 1; -+ depctl.b.cnak = 1; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); -+ } -+ i = core_if->nextep_seq[i]; -+ } while (i != core_if->first_in_nextep_seq); -+ -+ /* Clear the global non-periodic IN NAK handshake */ -+ dctl.d32 = 0; -+ dctl.b.cgnpinnak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ -+ /* Unmask EP Mismatch interrupt */ -+ gintmsk_data.d32 = 0; -+ gintmsk_data.b.epmismatch = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, gintmsk_data.d32); -+ -+ core_if->start_predict = 0; -+ -+ } -+} -+ -+/** -+ * Handler for the IN EP timeout handshake interrupt. -+ */ -+static inline void handle_in_ep_timeout_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ -+#ifdef DEBUG -+ deptsiz_data_t dieptsiz = {.d32 = 0 }; -+ uint32_t num = 0; -+#endif -+ dctl_data_t dctl = {.d32 = 0 }; -+ dwc_otg_pcd_ep_t *ep; -+ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ ep = get_in_ep(pcd, epnum); -+ -+ /* Disable the NP Tx Fifo Empty Interrrupt */ -+ if (!core_if->dma_enable) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ } -+ /** @todo NGS Check EP type. -+ * Implement for Periodic EPs */ -+ /* -+ * Non-periodic EP -+ */ -+ /* Enable the Global IN NAK Effective Interrupt */ -+ intr_mask.b.ginnakeff = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, 0, intr_mask.d32); -+ -+ /* Set Global IN NAK */ -+ dctl.b.sgnpinnak = 1; -+ DWC_MODIFY_REG32(&dev_if->dev_global_regs->dctl, dctl.d32, dctl.d32); -+ -+ ep->stopped = 1; -+ -+#ifdef DEBUG -+ dieptsiz.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[num]->dieptsiz); -+ DWC_DEBUGPL(DBG_ANY, "pktcnt=%d size=%d\n", -+ dieptsiz.b.pktcnt, dieptsiz.b.xfersize); -+#endif -+ -+#ifdef DISABLE_PERIODIC_EP -+ /* -+ * Set the NAK bit for this EP to -+ * start the disable process. -+ */ -+ diepctl.d32 = 0; -+ diepctl.b.snak = 1; -+ DWC_MODIFY_REG32(&dev_if->in_ep_regs[num]->diepctl, diepctl.d32, -+ diepctl.d32); -+ ep->disabling = 1; -+ ep->stopped = 1; -+#endif -+} -+ -+/** -+ * Handler for the IN EP NAK interrupt. -+ */ -+static inline int32_t handle_in_ep_nak_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ diepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "IN EP NAK"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.nak = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ diepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->diepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * Handler for the OUT EP Babble interrupt. -+ */ -+static inline int32_t handle_out_ep_babble_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ doepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", -+ "OUT EP Babble"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.babble = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * Handler for the OUT EP NAK interrupt. -+ */ -+static inline int32_t handle_out_ep_nak_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ doepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_ANY, "INTERRUPT Handler not implemented for %s\n", "OUT EP NAK"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.nak = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * Handler for the OUT EP NYET interrupt. -+ */ -+static inline int32_t handle_out_ep_nyet_intr(dwc_otg_pcd_t * pcd, -+ const uint32_t epnum) -+{ -+ /** @todo implement ISR */ -+ dwc_otg_core_if_t *core_if; -+ doepmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", "OUT EP NYET"); -+ core_if = GET_CORE_IF(pcd); -+ intr_mask.b.nyet = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs-> -+ doepeachintmsk[epnum], intr_mask.d32, 0); -+ } else { -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ intr_mask.d32, 0); -+ } -+ -+ return 1; -+} -+ -+/** -+ * This interrupt indicates that an IN EP has a pending Interrupt. -+ * The sequence for handling the IN EP interrupt is shown below: -+ * -# Read the Device All Endpoint Interrupt register -+ * -# Repeat the following for each IN EP interrupt bit set (from -+ * LSB to MSB). -+ * -# Read the Device Endpoint Interrupt (DIEPINTn) register -+ * -# If "Transfer Complete" call the request complete function -+ * -# If "Endpoint Disabled" complete the EP disable procedure. -+ * -# If "AHB Error Interrupt" log error -+ * -# If "Time-out Handshake" log error -+ * -# If "IN Token Received when TxFIFO Empty" write packet to Tx -+ * FIFO. -+ * -# If "IN Token EP Mismatch" (disable, this is handled by EP -+ * Mismatch Interrupt) -+ */ -+static int32_t dwc_otg_pcd_handle_in_ep_intr(dwc_otg_pcd_t * pcd) -+{ -+#define CLEAR_IN_EP_INTR(__core_if,__epnum,__intr) \ -+do { \ -+ diepint_data_t diepint = {.d32=0}; \ -+ diepint.b.__intr = 1; \ -+ DWC_WRITE_REG32(&__core_if->dev_if->in_ep_regs[__epnum]->diepint, \ -+ diepint.d32); \ -+} while (0) -+ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ dwc_otg_dev_if_t *dev_if = core_if->dev_if; -+ diepint_data_t diepint = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ uint32_t ep_intr; -+ uint32_t epnum = 0; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, pcd); -+ -+ /* Read in the device interrupt bits */ -+ ep_intr = dwc_otg_read_dev_all_in_ep_intr(core_if); -+ -+ /* Service the Device IN interrupts for each endpoint */ -+ while (ep_intr) { -+ if (ep_intr & 0x1) { -+ uint32_t empty_msk; -+ /* Get EP pointer */ -+ ep = get_in_ep(pcd, epnum); -+ dwc_ep = &ep->dwc_ep; -+ -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); -+ empty_msk = -+ DWC_READ_REG32(&dev_if-> -+ dev_global_regs->dtknqr4_fifoemptymsk); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "IN EP INTERRUPT - %d\nepmty_msk - %8x diepctl - %8x\n", -+ epnum, empty_msk, depctl.d32); -+ -+ DWC_DEBUGPL(DBG_PCD, -+ "EP%d-%s: type=%d, mps=%d\n", -+ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), -+ dwc_ep->type, dwc_ep->maxpacket); -+ -+ diepint.d32 = -+ dwc_otg_read_dev_in_ep_intr(core_if, dwc_ep); -+ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP %d Interrupt Register - 0x%x\n", epnum, -+ diepint.d32); -+ /* Transfer complete */ -+ if (diepint.b.xfercompl) { -+ /* Disable the NP Tx FIFO Empty -+ * Interrupt */ -+ if (core_if->en_multiple_tx_fifo == 0) { -+ intr_mask.b.nptxfempty = 1; -+ DWC_MODIFY_REG32 -+ (&core_if->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ } else { -+ /* Disable the Tx FIFO Empty Interrupt for this EP */ -+ uint32_t fifoemptymsk = -+ 0x1 << dwc_ep->num; -+ DWC_MODIFY_REG32(&core_if-> -+ dev_if->dev_global_regs->dtknqr4_fifoemptymsk, -+ fifoemptymsk, 0); -+ } -+ /* Clear the bit in DIEPINTn for this interrupt */ -+ CLEAR_IN_EP_INTR(core_if, epnum, xfercompl); -+ -+ /* Complete the transfer */ -+ if (epnum == 0) { -+ handle_ep0(pcd); -+ } -+#ifdef DWC_EN_ISOC -+ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (!ep->stopped) -+ complete_iso_ep(pcd, ep); -+ } -+#endif /* DWC_EN_ISOC */ -+#ifdef DWC_UTE_PER_IO -+ else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (!ep->stopped) -+ complete_xiso_ep(ep); -+ } -+#endif /* DWC_UTE_PER_IO */ -+ else { -+ if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC && -+ dwc_ep->bInterval > 1) { -+ dwc_ep->frame_num += dwc_ep->bInterval; -+ if (dwc_ep->frame_num > 0x3FFF) -+ { -+ dwc_ep->frm_overrun = 1; -+ dwc_ep->frame_num &= 0x3FFF; -+ } else -+ dwc_ep->frm_overrun = 0; -+ } -+ complete_ep(ep); -+ if(diepint.b.nak) -+ CLEAR_IN_EP_INTR(core_if, epnum, nak); -+ } -+ } -+ /* Endpoint disable */ -+ if (diepint.b.epdisabled) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d IN disabled\n", -+ epnum); -+ handle_in_ep_disable_intr(pcd, epnum); -+ -+ /* Clear the bit in DIEPINTn for this interrupt */ -+ CLEAR_IN_EP_INTR(core_if, epnum, epdisabled); -+ } -+ /* AHB Error */ -+ if (diepint.b.ahberr) { -+ DWC_ERROR("EP%d IN AHB Error\n", epnum); -+ /* Clear the bit in DIEPINTn for this interrupt */ -+ CLEAR_IN_EP_INTR(core_if, epnum, ahberr); -+ } -+ /* TimeOUT Handshake (non-ISOC IN EPs) */ -+ if (diepint.b.timeout) { -+ DWC_ERROR("EP%d IN Time-out\n", epnum); -+ handle_in_ep_timeout_intr(pcd, epnum); -+ -+ CLEAR_IN_EP_INTR(core_if, epnum, timeout); -+ } -+ /** IN Token received with TxF Empty */ -+ if (diepint.b.intktxfemp) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d IN TKN TxFifo Empty\n", -+ epnum); -+ if (!ep->stopped && epnum != 0) { -+ -+ diepmsk_data_t diepmsk = {.d32 = 0 }; -+ diepmsk.b.intktxfemp = 1; -+ -+ if (core_if->multiproc_int_enable) { -+ DWC_MODIFY_REG32 -+ (&dev_if->dev_global_regs->diepeachintmsk -+ [epnum], diepmsk.d32, 0); -+ } else { -+ DWC_MODIFY_REG32 -+ (&dev_if->dev_global_regs->diepmsk, -+ diepmsk.d32, 0); -+ } -+ } else if (core_if->dma_desc_enable -+ && epnum == 0 -+ && pcd->ep0state == -+ EP0_OUT_STATUS_PHASE) { -+ // EP0 IN set STALL -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs -+ [epnum]->diepctl); -+ -+ /* set the disable and stall bits */ -+ if (depctl.b.epena) { -+ depctl.b.epdis = 1; -+ } -+ depctl.b.stall = 1; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs -+ [epnum]->diepctl, -+ depctl.d32); -+ } -+ CLEAR_IN_EP_INTR(core_if, epnum, intktxfemp); -+ } -+ /** IN Token Received with EP mismatch */ -+ if (diepint.b.intknepmis) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d IN TKN EP Mismatch\n", epnum); -+ CLEAR_IN_EP_INTR(core_if, epnum, intknepmis); -+ } -+ /** IN Endpoint NAK Effective */ -+ if (diepint.b.inepnakeff) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d IN EP NAK Effective\n", -+ epnum); -+ /* Periodic EP */ -+ if (ep->disabling) { -+ depctl.d32 = 0; -+ depctl.b.snak = 1; -+ depctl.b.epdis = 1; -+ DWC_MODIFY_REG32(&dev_if->in_ep_regs -+ [epnum]->diepctl, -+ depctl.d32, -+ depctl.d32); -+ } -+ CLEAR_IN_EP_INTR(core_if, epnum, inepnakeff); -+ -+ } -+ -+ /** IN EP Tx FIFO Empty Intr */ -+ if (diepint.b.emptyintr) { -+ DWC_DEBUGPL(DBG_ANY, -+ "EP%d Tx FIFO Empty Intr \n", -+ epnum); -+ write_empty_tx_fifo(pcd, epnum); -+ -+ CLEAR_IN_EP_INTR(core_if, epnum, emptyintr); -+ -+ } -+ -+ /** IN EP BNA Intr */ -+ if (diepint.b.bna) { -+ CLEAR_IN_EP_INTR(core_if, epnum, bna); -+ if (core_if->dma_desc_enable) { -+#ifdef DWC_EN_ISOC -+ if (dwc_ep->type == -+ DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * This checking is performed to prevent first "false" BNA -+ * handling occuring right after reconnect -+ */ -+ if (dwc_ep->next_frame != -+ 0xffffffff) -+ dwc_otg_pcd_handle_iso_bna(ep); -+ } else -+#endif /* DWC_EN_ISOC */ -+ { -+ dwc_otg_pcd_handle_noniso_bna(ep); -+ } -+ } -+ } -+ /* NAK Interrutp */ -+ if (diepint.b.nak) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d IN NAK Interrupt\n", -+ epnum); -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ depctl_data_t depctl; -+ if (ep->dwc_ep.frame_num == 0xFFFFFFFF) { -+ ep->dwc_ep.frame_num = core_if->frame_num; -+ if (ep->dwc_ep.bInterval > 1) { -+ depctl.d32 = 0; -+ depctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[epnum]->diepctl); -+ if (ep->dwc_ep.frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ depctl.b.setd0pid = 0; -+ } else { -+ depctl.b.setd0pid = 1; -+ depctl.b.setd1pid = 0; -+ } -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[epnum]->diepctl, depctl.d32); -+ } -+ start_next_request(ep); -+ } -+ ep->dwc_ep.frame_num += ep->dwc_ep.bInterval; -+ if (dwc_ep->frame_num > 0x3FFF) { -+ dwc_ep->frm_overrun = 1; -+ dwc_ep->frame_num &= 0x3FFF; -+ } else -+ dwc_ep->frm_overrun = 0; -+ } -+ -+ CLEAR_IN_EP_INTR(core_if, epnum, nak); -+ } -+ } -+ epnum++; -+ ep_intr >>= 1; -+ } -+ -+ return 1; -+#undef CLEAR_IN_EP_INTR -+} -+ -+/** -+ * This interrupt indicates that an OUT EP has a pending Interrupt. -+ * The sequence for handling the OUT EP interrupt is shown below: -+ * -# Read the Device All Endpoint Interrupt register -+ * -# Repeat the following for each OUT EP interrupt bit set (from -+ * LSB to MSB). -+ * -# Read the Device Endpoint Interrupt (DOEPINTn) register -+ * -# If "Transfer Complete" call the request complete function -+ * -# If "Endpoint Disabled" complete the EP disable procedure. -+ * -# If "AHB Error Interrupt" log error -+ * -# If "Setup Phase Done" process Setup Packet (See Standard USB -+ * Command Processing) -+ */ -+static int32_t dwc_otg_pcd_handle_out_ep_intr(dwc_otg_pcd_t * pcd) -+{ -+#define CLEAR_OUT_EP_INTR(__core_if,__epnum,__intr) \ -+do { \ -+ doepint_data_t doepint = {.d32=0}; \ -+ doepint.b.__intr = 1; \ -+ DWC_WRITE_REG32(&__core_if->dev_if->out_ep_regs[__epnum]->doepint, \ -+ doepint.d32); \ -+} while (0) -+ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ uint32_t ep_intr; -+ doepint_data_t doepint = {.d32 = 0 }; -+ uint32_t epnum = 0; -+ dwc_otg_pcd_ep_t *ep; -+ dwc_ep_t *dwc_ep; -+ dctl_data_t dctl = {.d32 = 0 }; -+ gintmsk_data_t gintmsk = {.d32 = 0 }; -+ -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s()\n", __func__); -+ -+ /* Read in the device interrupt bits */ -+ ep_intr = dwc_otg_read_dev_all_out_ep_intr(core_if); -+ -+ while (ep_intr) { -+ if (ep_intr & 0x1) { -+ /* Get EP pointer */ -+ ep = get_out_ep(pcd, epnum); -+ dwc_ep = &ep->dwc_ep; -+ -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP%d-%s: type=%d, mps=%d\n", -+ dwc_ep->num, (dwc_ep->is_in ? "IN" : "OUT"), -+ dwc_ep->type, dwc_ep->maxpacket); -+#endif -+ doepint.d32 = -+ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep); -+ /* Moved this interrupt upper due to core deffect of asserting -+ * OUT EP 0 xfercompl along with stsphsrcvd in BDMA */ -+ if (doepint.b.stsphsercvd) { -+ deptsiz0_data_t deptsiz; -+ CLEAR_OUT_EP_INTR(core_if, epnum, stsphsercvd); -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doeptsiz); -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a -+ && core_if->dma_enable -+ && core_if->dma_desc_enable == 0 -+ && doepint.b.xfercompl -+ && deptsiz.b.xfersize == 24) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, -+ xfercompl); -+ doepint.b.xfercompl = 0; -+ ep0_out_start(core_if, pcd); -+ } -+ if ((core_if->dma_desc_enable) || -+ (core_if->dma_enable -+ && core_if->snpsid >= -+ OTG_CORE_REV_3_00a)) { -+ do_setup_in_status_phase(pcd); -+ } -+ } -+ /* Transfer complete */ -+ if (doepint.b.xfercompl) { -+ -+ if (epnum == 0) { -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a) { -+ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepint), -+ doepint.d32); -+ DWC_DEBUGPL(DBG_PCDV, "DOEPCTL=%x \n", -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[0]->doepctl)); -+ -+ if (core_if->snpsid >= OTG_CORE_REV_3_00a -+ && core_if->dma_enable == 0) { -+ doepint_data_t doepint; -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doepint); -+ if (pcd->ep0state == EP0_IDLE && doepint.b.sr) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, sr); -+ goto exit_xfercompl; -+ } -+ } -+ /* In case of DDMA look at SR bit to go to the Data Stage */ -+ if (core_if->dma_desc_enable) { -+ dev_dma_desc_sts_t status = {.d32 = 0}; -+ if (pcd->ep0state == EP0_IDLE) { -+ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> -+ dev_if->setup_desc_index]->status.d32; -+ if(pcd->data_terminated) { -+ pcd->data_terminated = 0; -+ status.d32 = core_if->dev_if->out_desc_addr->status.d32; -+ dwc_memcpy(&pcd->setup_pkt->req, pcd->backup_buf, 8); -+ } -+ if (status.b.sr) { -+ if (doepint.b.setup) { -+ DWC_DEBUGPL(DBG_PCDV, "DMA DESC EP0_IDLE SR=1 setup=1\n"); -+ /* Already started data stage, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ /* Prepare for more setup packets */ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE || -+ pcd->ep0state == EP0_IN_DATA_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP0_IDLE SR=1 setup=0 new setup comes\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ } else { -+ dwc_otg_pcd_request_t *req; -+ dev_dma_desc_sts_t status = {.d32 = 0}; -+ diepint_data_t diepint0; -+ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ -+ if (pcd->ep0state == EP0_STALL || pcd->ep0state == EP0_DISCONNECT) { -+ DWC_ERROR("EP0 is stalled/disconnected\n"); -+ } -+ -+ /* Clear IN xfercompl if set */ -+ if (diepint0.b.xfercompl && (pcd->ep0state == EP0_IN_STATUS_PHASE -+ || pcd->ep0state == EP0_IN_DATA_PHASE)) { -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint, diepint0.d32); -+ } -+ -+ status.d32 = core_if->dev_if->setup_desc_addr[core_if-> -+ dev_if->setup_desc_index]->status.d32; -+ -+ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len -+ && (pcd->ep0state == EP0_OUT_DATA_PHASE)) -+ status.d32 = core_if->dev_if->out_desc_addr->status.d32; -+ if (pcd->ep0state == EP0_OUT_STATUS_PHASE) -+ status.d32 = core_if->dev_if-> -+ out_desc_addr->status.d32; -+ -+ if (status.b.sr) { -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); -+ } else { -+ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && -+ pcd->ep0state == EP0_OUT_DATA_PHASE) { -+ /* Read arrived setup packet from req->buf */ -+ dwc_memcpy(&pcd->setup_pkt->req, -+ req->buf + ep->dwc_ep.xfer_count, 8); -+ } -+ req->actual = ep->dwc_ep.xfer_count; -+ dwc_otg_request_done(ep, req, -ECONNRESET); -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ } -+ pcd->ep0state = EP0_IDLE; -+ if (doepint.b.setup) { -+ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); -+ /* Data stage started, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ /* Prepare for setup packets if ep0in was enabled*/ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ } -+ } -+ if (core_if->snpsid >= OTG_CORE_REV_2_94a && core_if->dma_enable -+ && core_if->dma_desc_enable == 0) { -+ doepint_data_t doepint_temp = {.d32 = 0}; -+ deptsiz0_data_t doeptsize0 = {.d32 = 0 }; -+ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->dwc_ep.num]->doepint); -+ doeptsize0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->dwc_ep.num]->doeptsiz); -+ if (pcd->ep0state == EP0_IDLE) { -+ if (doepint_temp.b.sr) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, sr); -+ } -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doepint); -+ if (doeptsize0.b.supcnt == 3) { -+ DWC_DEBUGPL(DBG_ANY, "Rolling over!!!!!!!\n"); -+ ep->dwc_ep.stp_rollover = 1; -+ } -+ if (doepint.b.setup) { -+retry: -+ /* Already started data stage, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ ep->dwc_ep.stp_rollover = 0; -+ /* Prepare for more setup packets */ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE || -+ pcd->ep0state == EP0_IN_DATA_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_ANY, -+ "EP0_IDLE SR=1 setup=0 new setup comes\n"); -+ doepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[0]->doepint); -+ if(doepint.b.setup) -+ goto retry; -+ ep0_out_start(core_if, pcd); -+ } -+ } else { -+ dwc_otg_pcd_request_t *req; -+ diepint_data_t diepint0 = {.d32 = 0}; -+ doepint_data_t doepint_temp = {.d32 = 0}; -+ depctl_data_t diepctl0; -+ diepint0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ diepctl0.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepctl); -+ -+ if (pcd->ep0state == EP0_IN_DATA_PHASE -+ || pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ if (diepint0.b.xfercompl) { -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint, diepint0.d32); -+ } -+ if (diepctl0.b.epena) { -+ diepint_data_t diepint = {.d32 = 0}; -+ diepctl0.b.snak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepctl, diepctl0.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ } while (!diepint.b.inepnakeff); -+ diepint.b.inepnakeff = 1; -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint, diepint.d32); -+ diepctl0.d32 = 0; -+ diepctl0.b.epdis = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepctl, -+ diepctl0.d32); -+ do { -+ dwc_udelay(10); -+ diepint.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ in_ep_regs[0]->diepint); -+ } while (!diepint.b.epdisabled); -+ diepint.b.epdisabled = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->in_ep_regs[0]->diepint, -+ diepint.d32); -+ } -+ } -+ doepint_temp.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[ep->dwc_ep.num]->doepint); -+ if (doepint_temp.b.sr) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, sr); -+ if (DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ DWC_DEBUGPL(DBG_PCDV, "Request queue empty!!\n"); -+ } else { -+ DWC_DEBUGPL(DBG_PCDV, "complete req!!\n"); -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (ep->dwc_ep.xfer_count != ep->dwc_ep.total_len && -+ pcd->ep0state == EP0_OUT_DATA_PHASE) { -+ /* Read arrived setup packet from req->buf */ -+ dwc_memcpy(&pcd->setup_pkt->req, -+ req->buf + ep->dwc_ep.xfer_count, 8); -+ } -+ req->actual = ep->dwc_ep.xfer_count; -+ dwc_otg_request_done(ep, req, -ECONNRESET); -+ ep->dwc_ep.start_xfer_buff = 0; -+ ep->dwc_ep.xfer_buff = 0; -+ ep->dwc_ep.xfer_len = 0; -+ } -+ pcd->ep0state = EP0_IDLE; -+ if (doepint.b.setup) { -+ DWC_DEBUGPL(DBG_PCDV, "EP0_IDLE SR=1 setup=1\n"); -+ /* Data stage started, clear setup */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ doepint.b.setup = 0; -+ handle_ep0(pcd); -+ /* Prepare for setup packets if ep0in was enabled*/ -+ if (pcd->ep0state == EP0_IN_STATUS_PHASE) { -+ ep0_out_start(core_if, pcd); -+ } -+ goto exit_xfercompl; -+ } else { -+ /* Prepare for more setup packets */ -+ DWC_DEBUGPL(DBG_PCDV, -+ "EP0_IDLE SR=1 setup=0 new setup comes 2\n"); -+ ep0_out_start(core_if, pcd); -+ } -+ } -+ } -+ } -+ if (core_if->dma_enable == 0 || pcd->ep0state != EP0_IDLE) -+ handle_ep0(pcd); -+exit_xfercompl: -+ DWC_DEBUGPL(DBG_PCDV, "DOEPINT=%x doepint=%x\n", -+ dwc_otg_read_dev_out_ep_intr(core_if, dwc_ep), doepint.d32); -+ } else { -+ if (core_if->dma_desc_enable == 0 -+ || pcd->ep0state != EP0_IDLE) -+ handle_ep0(pcd); -+ } -+#ifdef DWC_EN_ISOC -+ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (doepint.b.pktdrpsts == 0) { -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, -+ epnum, -+ xfercompl); -+ complete_iso_ep(pcd, ep); -+ } else { -+ -+ doepint_data_t doepint = {.d32 = 0 }; -+ doepint.b.xfercompl = 1; -+ doepint.b.pktdrpsts = 1; -+ DWC_WRITE_REG32 -+ (&core_if->dev_if->out_ep_regs -+ [epnum]->doepint, -+ doepint.d32); -+ if (handle_iso_out_pkt_dropped -+ (core_if, dwc_ep)) { -+ complete_iso_ep(pcd, -+ ep); -+ } -+ } -+#endif /* DWC_EN_ISOC */ -+#ifdef DWC_UTE_PER_IO -+ } else if (dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, xfercompl); -+ if (!ep->stopped) -+ complete_xiso_ep(ep); -+#endif /* DWC_UTE_PER_IO */ -+ } else { -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, -+ xfercompl); -+ -+ if (core_if->core_params->dev_out_nak) { -+ DWC_TIMER_CANCEL(pcd->core_if->ep_xfer_timer[epnum]); -+ pcd->core_if->ep_xfer_info[epnum].state = 0; -+#ifdef DEBUG -+ print_memory_payload(pcd, dwc_ep); -+#endif -+ } -+ complete_ep(ep); -+ } -+ -+ } -+ -+ /* Endpoint disable */ -+ if (doepint.b.epdisabled) { -+ -+ /* Clear the bit in DOEPINTn for this interrupt */ -+ CLEAR_OUT_EP_INTR(core_if, epnum, epdisabled); -+ if (core_if->core_params->dev_out_nak) { -+#ifdef DEBUG -+ print_memory_payload(pcd, dwc_ep); -+#endif -+ /* In case of timeout condition */ -+ if (core_if->ep_xfer_info[epnum].state == 2) { -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dctl); -+ dctl.b.cgoutnak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ /* Unmask goutnakeff interrupt which was masked -+ * during handle nak out interrupt */ -+ gintmsk.b.goutnakeff = 1; -+ DWC_MODIFY_REG32(&core_if->core_global_regs->gintmsk, -+ 0, gintmsk.d32); -+ -+ complete_ep(ep); -+ } -+ } -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) -+ { -+ dctl_data_t dctl; -+ gintmsk_data_t intr_mask = {.d32 = 0}; -+ dwc_otg_pcd_request_t *req = 0; -+ -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ dev_global_regs->dctl); -+ dctl.b.cgoutnak = 1; -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ -+ intr_mask.d32 = 0; -+ intr_mask.b.incomplisoout = 1; -+ -+ /* Get any pending requests */ -+ if (!DWC_CIRCLEQ_EMPTY(&ep->queue)) { -+ req = DWC_CIRCLEQ_FIRST(&ep->queue); -+ if (!req) { -+ DWC_PRINTF("complete_ep 0x%p, req = NULL!\n", ep); -+ } else { -+ dwc_otg_request_done(ep, req, 0); -+ start_next_request(ep); -+ } -+ } else { -+ DWC_PRINTF("complete_ep 0x%p, ep->queue empty!\n", ep); -+ } -+ } -+ } -+ /* AHB Error */ -+ if (doepint.b.ahberr) { -+ DWC_ERROR("EP%d OUT AHB Error\n", epnum); -+ DWC_ERROR("EP%d DEPDMA=0x%08x \n", -+ epnum, core_if->dev_if->out_ep_regs[epnum]->doepdma); -+ CLEAR_OUT_EP_INTR(core_if, epnum, ahberr); -+ } -+ /* Setup Phase Done (contorl EPs) */ -+ if (doepint.b.setup) { -+#ifdef DEBUG_EP0 -+ DWC_DEBUGPL(DBG_PCD, "EP%d SETUP Done\n", epnum); -+#endif -+ CLEAR_OUT_EP_INTR(core_if, epnum, setup); -+ -+ handle_ep0(pcd); -+ } -+ -+ /** OUT EP BNA Intr */ -+ if (doepint.b.bna) { -+ CLEAR_OUT_EP_INTR(core_if, epnum, bna); -+ if (core_if->dma_desc_enable) { -+#ifdef DWC_EN_ISOC -+ if (dwc_ep->type == -+ DWC_OTG_EP_TYPE_ISOC) { -+ /* -+ * This checking is performed to prevent first "false" BNA -+ * handling occuring right after reconnect -+ */ -+ if (dwc_ep->next_frame != -+ 0xffffffff) -+ dwc_otg_pcd_handle_iso_bna(ep); -+ } else -+#endif /* DWC_EN_ISOC */ -+ { -+ dwc_otg_pcd_handle_noniso_bna(ep); -+ } -+ } -+ } -+ /* Babble Interrupt */ -+ if (doepint.b.babble) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Babble\n", -+ epnum); -+ handle_out_ep_babble_intr(pcd, epnum); -+ -+ CLEAR_OUT_EP_INTR(core_if, epnum, babble); -+ } -+ if (doepint.b.outtknepdis) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT Token received when EP is \ -+ disabled\n",epnum); -+ if (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ doepmsk_data_t doepmsk = {.d32 = 0}; -+ ep->dwc_ep.frame_num = core_if->frame_num; -+ if (ep->dwc_ep.bInterval > 1) { -+ depctl_data_t depctl; -+ depctl.d32 = DWC_READ_REG32(&core_if->dev_if-> -+ out_ep_regs[epnum]->doepctl); -+ if (ep->dwc_ep.frame_num & 0x1) { -+ depctl.b.setd1pid = 1; -+ depctl.b.setd0pid = 0; -+ } else { -+ depctl.b.setd0pid = 1; -+ depctl.b.setd1pid = 0; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if-> -+ out_ep_regs[epnum]->doepctl, depctl.d32); -+ } -+ start_next_request(ep); -+ doepmsk.b.outtknepdis = 1; -+ DWC_MODIFY_REG32(&core_if->dev_if->dev_global_regs->doepmsk, -+ doepmsk.d32, 0); -+ } -+ CLEAR_OUT_EP_INTR(core_if, epnum, outtknepdis); -+ } -+ -+ /* NAK Interrutp */ -+ if (doepint.b.nak) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NAK\n", epnum); -+ handle_out_ep_nak_intr(pcd, epnum); -+ -+ CLEAR_OUT_EP_INTR(core_if, epnum, nak); -+ } -+ /* NYET Interrutp */ -+ if (doepint.b.nyet) { -+ DWC_DEBUGPL(DBG_ANY, "EP%d OUT NYET\n", epnum); -+ handle_out_ep_nyet_intr(pcd, epnum); -+ -+ CLEAR_OUT_EP_INTR(core_if, epnum, nyet); -+ } -+ } -+ -+ epnum++; -+ ep_intr >>= 1; -+ } -+ -+ return 1; -+ -+#undef CLEAR_OUT_EP_INTR -+} -+static int drop_transfer(uint32_t trgt_fr, uint32_t curr_fr, uint8_t frm_overrun) -+{ -+ int retval = 0; -+ if(!frm_overrun && curr_fr >= trgt_fr) -+ retval = 1; -+ else if (frm_overrun -+ && (curr_fr >= trgt_fr && ((curr_fr - trgt_fr) < 0x3FFF / 2))) -+ retval = 1; -+ return retval; -+} -+/** -+ * Incomplete ISO IN Transfer Interrupt. -+ * This interrupt indicates one of the following conditions occurred -+ * while transmitting an ISOC transaction. -+ * - Corrupted IN Token for ISOC EP. -+ * - Packet not complete in FIFO. -+ * The follow actions will be taken: -+ * -# Determine the EP -+ * -# Set incomplete flag in dwc_ep structure -+ * -# Disable EP; when "Endpoint Disabled" interrupt is received -+ * Flush FIFO -+ */ -+int32_t dwc_otg_pcd_handle_incomplete_isoc_in_intr(dwc_otg_pcd_t * pcd) -+{ -+ gintsts_data_t gintsts; -+ -+#ifdef DWC_EN_ISOC -+ dwc_otg_dev_if_t *dev_if; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dsts_data_t dsts = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep; -+ int i; -+ -+ dev_if = GET_CORE_IF(pcd)->dev_if; -+ -+ for (i = 1; i <= dev_if->num_in_eps; ++i) { -+ dwc_ep = &pcd->in_ep[i].dwc_ep; -+ if (dwc_ep->active && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->dieptsiz); -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ -+ if (depctl.b.epdis && deptsiz.d32) { -+ set_current_pkt_info(GET_CORE_IF(pcd), dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr0; -+ } -+ -+ } -+ -+ dsts.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ dev_global_regs->dsts); -+ dwc_ep->next_frame = dsts.b.soffn; -+ -+ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF -+ (pcd), -+ dwc_ep); -+ } -+ } -+ } -+ -+#else -+ depctl_data_t depctl = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep; -+ dwc_otg_dev_if_t *dev_if; -+ int i; -+ dev_if = GET_CORE_IF(pcd)->dev_if; -+ -+ DWC_DEBUGPL(DBG_PCD,"Incomplete ISO IN \n"); -+ -+ for (i = 1; i <= dev_if->num_in_eps; ++i) { -+ dwc_ep = &pcd->in_ep[i-1].dwc_ep; -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (depctl.b.epena && dwc_ep->type == DWC_OTG_EP_TYPE_ISOC) { -+ if (drop_transfer(dwc_ep->frame_num, GET_CORE_IF(pcd)->frame_num, -+ dwc_ep->frm_overrun)) -+ { -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ depctl.b.snak = 1; -+ depctl.b.epdis = 1; -+ DWC_MODIFY_REG32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32, depctl.d32); -+ } -+ } -+ } -+ -+ /*intr_mask.b.incomplisoin = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); */ -+#endif //DWC_EN_ISOC -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.incomplisoin = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * Incomplete ISO OUT Transfer Interrupt. -+ * -+ * This interrupt indicates that the core has dropped an ISO OUT -+ * packet. The following conditions can be the cause: -+ * - FIFO Full, the entire packet would not fit in the FIFO. -+ * - CRC Error -+ * - Corrupted Token -+ * The follow actions will be taken: -+ * -# Determine the EP -+ * -# Set incomplete flag in dwc_ep structure -+ * -# Read any data from the FIFO -+ * -# Disable EP. When "Endpoint Disabled" interrupt is received -+ * re-enable EP. -+ */ -+int32_t dwc_otg_pcd_handle_incomplete_isoc_out_intr(dwc_otg_pcd_t * pcd) -+{ -+ -+ gintsts_data_t gintsts; -+ -+#ifdef DWC_EN_ISOC -+ dwc_otg_dev_if_t *dev_if; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dsts_data_t dsts = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep; -+ int i; -+ -+ dev_if = GET_CORE_IF(pcd)->dev_if; -+ -+ for (i = 1; i <= dev_if->num_out_eps; ++i) { -+ dwc_ep = &pcd->in_ep[i].dwc_ep; -+ if (pcd->out_ep[i].dwc_ep.active && -+ pcd->out_ep[i].dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) { -+ deptsiz.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doeptsiz); -+ depctl.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); -+ -+ if (depctl.b.epdis && deptsiz.d32) { -+ set_current_pkt_info(GET_CORE_IF(pcd), -+ &pcd->out_ep[i].dwc_ep); -+ if (dwc_ep->cur_pkt >= dwc_ep->pkt_cnt) { -+ dwc_ep->cur_pkt = 0; -+ dwc_ep->proc_buf_num = -+ (dwc_ep->proc_buf_num ^ 1) & 0x1; -+ -+ if (dwc_ep->proc_buf_num) { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff1; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr1; -+ } else { -+ dwc_ep->cur_pkt_addr = -+ dwc_ep->xfer_buff0; -+ dwc_ep->cur_pkt_dma_addr = -+ dwc_ep->dma_addr0; -+ } -+ -+ } -+ -+ dsts.d32 = -+ DWC_READ_REG32(&GET_CORE_IF(pcd)->dev_if-> -+ dev_global_regs->dsts); -+ dwc_ep->next_frame = dsts.b.soffn; -+ -+ dwc_otg_iso_ep_start_frm_transfer(GET_CORE_IF -+ (pcd), -+ dwc_ep); -+ } -+ } -+ } -+#else -+ /** @todo implement ISR */ -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ dwc_otg_core_if_t *core_if; -+ deptsiz_data_t deptsiz = {.d32 = 0 }; -+ depctl_data_t depctl = {.d32 = 0 }; -+ dctl_data_t dctl = {.d32 = 0 }; -+ dwc_ep_t *dwc_ep = NULL; -+ int i; -+ core_if = GET_CORE_IF(pcd); -+ -+ for (i = 0; i < core_if->dev_if->num_out_eps; ++i) { -+ dwc_ep = &pcd->out_ep[i].dwc_ep; -+ depctl.d32 = -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); -+ if (depctl.b.epena && depctl.b.dpid == (core_if->frame_num & 0x1)) { -+ core_if->dev_if->isoc_ep = dwc_ep; -+ deptsiz.d32 = -+ DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doeptsiz); -+ break; -+ } -+ } -+ dctl.d32 = DWC_READ_REG32(&core_if->dev_if->dev_global_regs->dctl); -+ gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts); -+ intr_mask.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk); -+ -+ if (!intr_mask.b.goutnakeff) { -+ /* Unmask it */ -+ intr_mask.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&core_if->core_global_regs->gintmsk, intr_mask.d32); -+ } -+ if (!gintsts.b.goutnakeff) { -+ dctl.b.sgoutnak = 1; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl, dctl.d32); -+ -+ depctl.d32 = DWC_READ_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl); -+ if (depctl.b.epena) { -+ depctl.b.epdis = 1; -+ depctl.b.snak = 1; -+ } -+ DWC_WRITE_REG32(&core_if->dev_if->out_ep_regs[dwc_ep->num]->doepctl, depctl.d32); -+ -+ intr_mask.d32 = 0; -+ intr_mask.b.incomplisoout = 1; -+ -+#endif /* DWC_EN_ISOC */ -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.incomplisoout = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * This function handles the Global IN NAK Effective interrupt. -+ * -+ */ -+int32_t dwc_otg_pcd_handle_in_nak_effective(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ depctl_data_t diepctl = {.d32 = 0 }; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+ int i; -+ -+ DWC_DEBUGPL(DBG_PCD, "Global IN NAK Effective\n"); -+ -+ /* Disable all active IN EPs */ -+ for (i = 0; i <= dev_if->num_in_eps; i++) { -+ diepctl.d32 = DWC_READ_REG32(&dev_if->in_ep_regs[i]->diepctl); -+ if (!(diepctl.b.eptype & 1) && diepctl.b.epena) { -+ if (core_if->start_predict > 0) -+ core_if->start_predict++; -+ diepctl.b.epdis = 1; -+ diepctl.b.snak = 1; -+ DWC_WRITE_REG32(&dev_if->in_ep_regs[i]->diepctl, diepctl.d32); -+ } -+ } -+ -+ -+ /* Disable the Global IN NAK Effective Interrupt */ -+ intr_mask.b.ginnakeff = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.ginnakeff = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * OUT NAK Effective. -+ * -+ */ -+int32_t dwc_otg_pcd_handle_out_nak_effective(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_dev_if_t *dev_if = GET_CORE_IF(pcd)->dev_if; -+ gintmsk_data_t intr_mask = {.d32 = 0 }; -+ gintsts_data_t gintsts; -+ depctl_data_t doepctl; -+ int i; -+ -+ /* Disable the Global OUT NAK Effective Interrupt */ -+ intr_mask.b.goutnakeff = 1; -+ DWC_MODIFY_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintmsk, -+ intr_mask.d32, 0); -+ -+ /* If DEV OUT NAK enabled*/ -+ if (pcd->core_if->core_params->dev_out_nak) { -+ /* Run over all out endpoints to determine the ep number on -+ * which the timeout has happened -+ */ -+ for (i = 0; i <= dev_if->num_out_eps; i++) { -+ if ( pcd->core_if->ep_xfer_info[i].state == 2 ) -+ break; -+ } -+ if (i > dev_if->num_out_eps) { -+ dctl_data_t dctl; -+ dctl.d32 = -+ DWC_READ_REG32(&dev_if->dev_global_regs->dctl); -+ dctl.b.cgoutnak = 1; -+ DWC_WRITE_REG32(&dev_if->dev_global_regs->dctl, -+ dctl.d32); -+ goto out; -+ } -+ -+ /* Disable the endpoint */ -+ doepctl.d32 = DWC_READ_REG32(&dev_if->out_ep_regs[i]->doepctl); -+ if (doepctl.b.epena) { -+ doepctl.b.epdis = 1; -+ doepctl.b.snak = 1; -+ } -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32); -+ return 1; -+ } -+ /* We come here from Incomplete ISO OUT handler */ -+ if (dev_if->isoc_ep) { -+ dwc_ep_t *dwc_ep = (dwc_ep_t *)dev_if->isoc_ep; -+ uint32_t epnum = dwc_ep->num; -+ doepint_data_t doepint; -+ doepint.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[dwc_ep->num]->doepint); -+ dev_if->isoc_ep = NULL; -+ doepctl.d32 = -+ DWC_READ_REG32(&dev_if->out_ep_regs[epnum]->doepctl); -+ DWC_PRINTF("Before disable DOEPCTL = %08x\n", doepctl.d32); -+ if (doepctl.b.epena) { -+ doepctl.b.epdis = 1; -+ doepctl.b.snak = 1; -+ } -+ DWC_WRITE_REG32(&dev_if->out_ep_regs[epnum]->doepctl, -+ doepctl.d32); -+ return 1; -+ } else -+ DWC_PRINTF("INTERRUPT Handler not implemented for %s\n", -+ "Global OUT NAK Effective\n"); -+ -+out: -+ /* Clear interrupt */ -+ gintsts.d32 = 0; -+ gintsts.b.goutnakeff = 1; -+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->core_global_regs->gintsts, -+ gintsts.d32); -+ -+ return 1; -+} -+ -+/** -+ * PCD interrupt handler. -+ * -+ * The PCD handles the device interrupts. Many conditions can cause a -+ * device interrupt. When an interrupt occurs, the device interrupt -+ * service routine determines the cause of the interrupt and -+ * dispatches handling to the appropriate function. These interrupt -+ * handling functions are described below. -+ * -+ * All interrupt registers are processed from LSB to MSB. -+ * -+ */ -+int32_t dwc_otg_pcd_handle_intr(dwc_otg_pcd_t * pcd) -+{ -+ dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); -+#ifdef VERBOSE -+ dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; -+#endif -+ gintsts_data_t gintr_status; -+ int32_t retval = 0; -+ -+ /* Exit from ISR if core is hibernated */ -+ if (core_if->hibernation_suspend == 1) { -+ return retval; -+ } -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_ANY, "%s() gintsts=%08x gintmsk=%08x\n", -+ __func__, -+ DWC_READ_REG32(&global_regs->gintsts), -+ DWC_READ_REG32(&global_regs->gintmsk)); -+#endif -+ -+ if (dwc_otg_is_device_mode(core_if)) { -+ DWC_SPINLOCK(pcd->lock); -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%08x gintmsk=%08x\n", -+ __func__, -+ DWC_READ_REG32(&global_regs->gintsts), -+ DWC_READ_REG32(&global_regs->gintmsk)); -+#endif -+ -+ gintr_status.d32 = dwc_otg_read_core_intr(core_if); -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s: gintsts&gintmsk=%08x\n", -+ __func__, gintr_status.d32); -+ -+ if (gintr_status.b.sofintr) { -+ retval |= dwc_otg_pcd_handle_sof_intr(pcd); -+ } -+ if (gintr_status.b.rxstsqlvl) { -+ retval |= -+ dwc_otg_pcd_handle_rx_status_q_level_intr(pcd); -+ } -+ if (gintr_status.b.nptxfempty) { -+ retval |= dwc_otg_pcd_handle_np_tx_fifo_empty_intr(pcd); -+ } -+ if (gintr_status.b.goutnakeff) { -+ retval |= dwc_otg_pcd_handle_out_nak_effective(pcd); -+ } -+ if (gintr_status.b.i2cintr) { -+ retval |= dwc_otg_pcd_handle_i2c_intr(pcd); -+ } -+ if (gintr_status.b.erlysuspend) { -+ retval |= dwc_otg_pcd_handle_early_suspend_intr(pcd); -+ } -+ if (gintr_status.b.usbreset) { -+ retval |= dwc_otg_pcd_handle_usb_reset_intr(pcd); -+ } -+ if (gintr_status.b.enumdone) { -+ retval |= dwc_otg_pcd_handle_enum_done_intr(pcd); -+ } -+ if (gintr_status.b.isooutdrop) { -+ retval |= -+ dwc_otg_pcd_handle_isoc_out_packet_dropped_intr -+ (pcd); -+ } -+ if (gintr_status.b.eopframe) { -+ retval |= -+ dwc_otg_pcd_handle_end_periodic_frame_intr(pcd); -+ } -+ if (gintr_status.b.inepint) { -+ if (!core_if->multiproc_int_enable) { -+ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); -+ } -+ } -+ if (gintr_status.b.outepintr) { -+ if (!core_if->multiproc_int_enable) { -+ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); -+ } -+ } -+ if (gintr_status.b.epmismatch) { -+ retval |= dwc_otg_pcd_handle_ep_mismatch_intr(pcd); -+ } -+ if (gintr_status.b.fetsusp) { -+ retval |= dwc_otg_pcd_handle_ep_fetsusp_intr(pcd); -+ } -+ if (gintr_status.b.ginnakeff) { -+ retval |= dwc_otg_pcd_handle_in_nak_effective(pcd); -+ } -+ if (gintr_status.b.incomplisoin) { -+ retval |= -+ dwc_otg_pcd_handle_incomplete_isoc_in_intr(pcd); -+ } -+ if (gintr_status.b.incomplisoout) { -+ retval |= -+ dwc_otg_pcd_handle_incomplete_isoc_out_intr(pcd); -+ } -+ -+ /* In MPI mode Device Endpoints interrupts are asserted -+ * without setting outepintr and inepint bits set, so these -+ * Interrupt handlers are called without checking these bit-fields -+ */ -+ if (core_if->multiproc_int_enable) { -+ retval |= dwc_otg_pcd_handle_in_ep_intr(pcd); -+ retval |= dwc_otg_pcd_handle_out_ep_intr(pcd); -+ } -+#ifdef VERBOSE -+ DWC_DEBUGPL(DBG_PCDV, "%s() gintsts=%0x\n", __func__, -+ DWC_READ_REG32(&global_regs->gintsts)); -+#endif -+ DWC_SPINUNLOCK(pcd->lock); -+ } -+ return retval; -+} -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e799f15f294706ad7ac328dcb9ce68fbd0e71d38 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c -@@ -0,0 +1,1280 @@ -+ /* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ -+ * $Revision: #21 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_HOST_ONLY -+ -+/** @file -+ * This file implements the Peripheral Controller Driver. -+ * -+ * The Peripheral Controller Driver (PCD) is responsible for -+ * translating requests from the Function Driver into the appropriate -+ * actions on the DWC_otg controller. It isolates the Function Driver -+ * from the specifics of the controller by providing an API to the -+ * Function Driver. -+ * -+ * The Peripheral Controller Driver for Linux will implement the -+ * Gadget API, so that the existing Gadget drivers can be used. -+ * (Gadget Driver is the Linux terminology for a Function Driver.) -+ * -+ * The Linux Gadget API is defined in the header file -+ * . The USB EP operations API is -+ * defined in the structure usb_ep_ops and the USB -+ * Controller API is defined in the structure -+ * usb_gadget_ops. -+ * -+ */ -+ -+#include "dwc_otg_os_dep.h" -+#include "dwc_otg_pcd_if.h" -+#include "dwc_otg_pcd.h" -+#include "dwc_otg_driver.h" -+#include "dwc_otg_dbg.h" -+ -+extern bool fiq_enable; -+ -+static struct gadget_wrapper { -+ dwc_otg_pcd_t *pcd; -+ -+ struct usb_gadget gadget; -+ struct usb_gadget_driver *driver; -+ -+ struct usb_ep ep0; -+ struct usb_ep in_ep[16]; -+ struct usb_ep out_ep[16]; -+ -+} *gadget_wrapper; -+ -+/* Display the contents of the buffer */ -+extern void dump_msg(const u8 * buf, unsigned int length); -+/** -+ * Get the dwc_otg_pcd_ep_t* from usb_ep* pointer - NULL in case -+ * if the endpoint is not found -+ */ -+static struct dwc_otg_pcd_ep *ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) -+{ -+ int i; -+ if (pcd->ep0.priv == handle) { -+ return &pcd->ep0; -+ } -+ -+ for (i = 0; i < MAX_EPS_CHANNELS - 1; i++) { -+ if (pcd->in_ep[i].priv == handle) -+ return &pcd->in_ep[i]; -+ if (pcd->out_ep[i].priv == handle) -+ return &pcd->out_ep[i]; -+ } -+ -+ return NULL; -+} -+ -+/* USB Endpoint Operations */ -+/* -+ * The following sections briefly describe the behavior of the Gadget -+ * API endpoint operations implemented in the DWC_otg driver -+ * software. Detailed descriptions of the generic behavior of each of -+ * these functions can be found in the Linux header file -+ * include/linux/usb_gadget.h. -+ * -+ * The Gadget API provides wrapper functions for each of the function -+ * pointers defined in usb_ep_ops. The Gadget Driver calls the wrapper -+ * function, which then calls the underlying PCD function. The -+ * following sections are named according to the wrapper -+ * functions. Within each section, the corresponding DWC_otg PCD -+ * function name is specified. -+ * -+ */ -+ -+/** -+ * This function is called by the Gadget Driver for each EP to be -+ * configured for the current configuration (SET_CONFIGURATION). -+ * -+ * This function initializes the dwc_otg_ep_t data structure, and then -+ * calls dwc_otg_ep_activate. -+ */ -+static int ep_enable(struct usb_ep *usb_ep, -+ const struct usb_endpoint_descriptor *ep_desc) -+{ -+ int retval; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, ep_desc); -+ -+ if (!usb_ep || !ep_desc || ep_desc->bDescriptorType != USB_DT_ENDPOINT) { -+ DWC_WARN("%s, bad ep or descriptor\n", __func__); -+ return -EINVAL; -+ } -+ if (usb_ep == &gadget_wrapper->ep0) { -+ DWC_WARN("%s, bad ep(0)\n", __func__); -+ return -EINVAL; -+ } -+ -+ /* Check FIFO size? */ -+ if (!ep_desc->wMaxPacketSize) { -+ DWC_WARN("%s, bad %s maxpacket\n", __func__, usb_ep->name); -+ return -ERANGE; -+ } -+ -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_WARN("%s, bogus device state\n", __func__); -+ return -ESHUTDOWN; -+ } -+ -+ /* Delete after check - MAS */ -+#if 0 -+ nat = (uint32_t) ep_desc->wMaxPacketSize; -+ printk(KERN_ALERT "%s: nat (before) =%d\n", __func__, nat); -+ nat = (nat >> 11) & 0x03; -+ printk(KERN_ALERT "%s: nat (after) =%d\n", __func__, nat); -+#endif -+ retval = dwc_otg_pcd_ep_enable(gadget_wrapper->pcd, -+ (const uint8_t *)ep_desc, -+ (void *)usb_ep); -+ if (retval) { -+ DWC_WARN("dwc_otg_pcd_ep_enable failed\n"); -+ return -EINVAL; -+ } -+ -+ usb_ep->maxpacket = le16_to_cpu(ep_desc->wMaxPacketSize); -+ -+ return 0; -+} -+ -+/** -+ * This function is called when an EP is disabled due to disconnect or -+ * change in configuration. Any pending requests will terminate with a -+ * status of -ESHUTDOWN. -+ * -+ * This function modifies the dwc_otg_ep_t data structure for this EP, -+ * and then calls dwc_otg_ep_deactivate. -+ */ -+static int ep_disable(struct usb_ep *usb_ep) -+{ -+ int retval; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, usb_ep); -+ if (!usb_ep) { -+ DWC_DEBUGPL(DBG_PCD, "%s, %s not enabled\n", __func__, -+ usb_ep ? usb_ep->name : NULL); -+ return -EINVAL; -+ } -+ -+ retval = dwc_otg_pcd_ep_disable(gadget_wrapper->pcd, usb_ep); -+ if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function allocates a request object to use with the specified -+ * endpoint. -+ * -+ * @param ep The endpoint to be used with with the request -+ * @param gfp_flags the GFP_* flags to use. -+ */ -+static struct usb_request *dwc_otg_pcd_alloc_request(struct usb_ep *ep, -+ gfp_t gfp_flags) -+{ -+ struct usb_request *usb_req; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d)\n", __func__, ep, gfp_flags); -+ if (0 == ep) { -+ DWC_WARN("%s() %s\n", __func__, "Invalid EP!\n"); -+ return 0; -+ } -+ usb_req = kzalloc(sizeof(*usb_req), gfp_flags); -+ if (0 == usb_req) { -+ DWC_WARN("%s() %s\n", __func__, "request allocation failed!\n"); -+ return 0; -+ } -+ usb_req->dma = DWC_DMA_ADDR_INVALID; -+ -+ return usb_req; -+} -+ -+/** -+ * This function frees a request object. -+ * -+ * @param ep The endpoint associated with the request -+ * @param req The request being freed -+ */ -+static void dwc_otg_pcd_free_request(struct usb_ep *ep, struct usb_request *req) -+{ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, ep, req); -+ -+ if (0 == ep || 0 == req) { -+ DWC_WARN("%s() %s\n", __func__, -+ "Invalid ep or req argument!\n"); -+ return; -+ } -+ -+ kfree(req); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+/** -+ * This function allocates an I/O buffer to be used for a transfer -+ * to/from the specified endpoint. -+ * -+ * @param usb_ep The endpoint to be used with with the request -+ * @param bytes The desired number of bytes for the buffer -+ * @param dma Pointer to the buffer's DMA address; must be valid -+ * @param gfp_flags the GFP_* flags to use. -+ * @return address of a new buffer or null is buffer could not be allocated. -+ */ -+static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *usb_ep, unsigned bytes, -+ dma_addr_t * dma, gfp_t gfp_flags) -+{ -+ void *buf; -+ dwc_otg_pcd_t *pcd = 0; -+ -+ pcd = gadget_wrapper->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d,%p,%0x)\n", __func__, usb_ep, bytes, -+ dma, gfp_flags); -+ -+ /* Check dword alignment */ -+ if ((bytes & 0x3UL) != 0) { -+ DWC_WARN("%s() Buffer size is not a multiple of" -+ "DWORD size (%d)", __func__, bytes); -+ } -+ -+ buf = dma_alloc_coherent(NULL, bytes, dma, gfp_flags); -+ WARN_ON(!buf); -+ -+ /* Check dword alignment */ -+ if (((int)buf & 0x3UL) != 0) { -+ DWC_WARN("%s() Buffer is not DWORD aligned (%p)", -+ __func__, buf); -+ } -+ -+ return buf; -+} -+ -+/** -+ * This function frees an I/O buffer that was allocated by alloc_buffer. -+ * -+ * @param usb_ep the endpoint associated with the buffer -+ * @param buf address of the buffer -+ * @param dma The buffer's DMA address -+ * @param bytes The number of bytes of the buffer -+ */ -+static void dwc_otg_pcd_free_buffer(struct usb_ep *usb_ep, void *buf, -+ dma_addr_t dma, unsigned bytes) -+{ -+ dwc_otg_pcd_t *pcd = 0; -+ -+ pcd = gadget_wrapper->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%0x,%d)\n", __func__, buf, dma, bytes); -+ -+ dma_free_coherent(NULL, bytes, buf, dma); -+} -+#endif -+ -+/** -+ * This function is used to submit an I/O Request to an EP. -+ * -+ * - When the request completes the request's completion callback -+ * is called to return the request to the driver. -+ * - An EP, except control EPs, may have multiple requests -+ * pending. -+ * - Once submitted the request cannot be examined or modified. -+ * - Each request is turned into one or more packets. -+ * - A BULK EP can queue any amount of data; the transfer is -+ * packetized. -+ * - Zero length Packets are specified with the request 'zero' -+ * flag. -+ */ -+static int ep_queue(struct usb_ep *usb_ep, struct usb_request *usb_req, -+ gfp_t gfp_flags) -+{ -+ dwc_otg_pcd_t *pcd; -+ struct dwc_otg_pcd_ep *ep = NULL; -+ int retval = 0, is_isoc_ep = 0; -+ dma_addr_t dma_addr = DWC_DMA_ADDR_INVALID; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p,%d)\n", -+ __func__, usb_ep, usb_req, gfp_flags); -+ -+ if (!usb_req || !usb_req->complete || !usb_req->buf) { -+ DWC_WARN("bad params\n"); -+ return -EINVAL; -+ } -+ -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ return -EINVAL; -+ } -+ -+ pcd = gadget_wrapper->pcd; -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", -+ gadget_wrapper->gadget.speed); -+ DWC_WARN("bogus device state\n"); -+ return -ESHUTDOWN; -+ } -+ -+ DWC_DEBUGPL(DBG_PCD, "%s queue req %p, len %d buf %p\n", -+ usb_ep->name, usb_req, usb_req->length, usb_req->buf); -+ -+ usb_req->status = -EINPROGRESS; -+ usb_req->actual = 0; -+ -+ ep = ep_from_handle(pcd, usb_ep); -+ if (ep == NULL) -+ is_isoc_ep = 0; -+ else -+ is_isoc_ep = (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ? 1 : 0; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ dma_addr = usb_req->dma; -+#else -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; -+ struct device *dev = NULL; -+ -+ if (otg_dev != NULL) -+ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); -+ -+ if (usb_req->length != 0 && -+ usb_req->dma == DWC_DMA_ADDR_INVALID) { -+ dma_addr = dma_map_single(dev, usb_req->buf, -+ usb_req->length, -+ ep->dwc_ep.is_in ? -+ DMA_TO_DEVICE: -+ DMA_FROM_DEVICE); -+ } -+ } -+#endif -+ -+#ifdef DWC_UTE_PER_IO -+ if (is_isoc_ep == 1) { -+ retval = dwc_otg_pcd_xiso_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, -+ usb_req->length, usb_req->zero, usb_req, -+ gfp_flags == GFP_ATOMIC ? 1 : 0, &usb_req->ext_req); -+ if (retval) -+ return -EINVAL; -+ -+ return 0; -+ } -+#endif -+ retval = dwc_otg_pcd_ep_queue(pcd, usb_ep, usb_req->buf, dma_addr, -+ usb_req->length, usb_req->zero, usb_req, -+ gfp_flags == GFP_ATOMIC ? 1 : 0); -+ if (retval) { -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/** -+ * This function cancels an I/O request from an EP. -+ */ -+static int ep_dequeue(struct usb_ep *usb_ep, struct usb_request *usb_req) -+{ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, usb_req); -+ -+ if (!usb_ep || !usb_req) { -+ DWC_WARN("bad argument\n"); -+ return -EINVAL; -+ } -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_WARN("bogus device state\n"); -+ return -ESHUTDOWN; -+ } -+ if (dwc_otg_pcd_ep_dequeue(gadget_wrapper->pcd, usb_ep, usb_req)) { -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/** -+ * usb_ep_set_halt stalls an endpoint. -+ * -+ * usb_ep_clear_halt clears an endpoint halt and resets its data -+ * toggle. -+ * -+ * Both of these functions are implemented with the same underlying -+ * function. The behavior depends on the value argument. -+ * -+ * @param[in] usb_ep the Endpoint to halt or clear halt. -+ * @param[in] value -+ * - 0 means clear_halt. -+ * - 1 means set_halt, -+ * - 2 means clear stall lock flag. -+ * - 3 means set stall lock flag. -+ */ -+static int ep_halt(struct usb_ep *usb_ep, int value) -+{ -+ int retval = 0; -+ -+ DWC_DEBUGPL(DBG_PCD, "HALT %s %d\n", usb_ep->name, value); -+ -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ return -EINVAL; -+ } -+ -+ retval = dwc_otg_pcd_ep_halt(gadget_wrapper->pcd, usb_ep, value); -+ if (retval == -DWC_E_AGAIN) { -+ return -EAGAIN; -+ } else if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+ -+//#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) -+#if 0 -+/** -+ * ep_wedge: sets the halt feature and ignores clear requests -+ * -+ * @usb_ep: the endpoint being wedged -+ * -+ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT) -+ * requests. If the gadget driver clears the halt status, it will -+ * automatically unwedge the endpoint. -+ * -+ * Returns zero on success, else negative errno. * -+ * Check usb_ep_set_wedge() at "usb_gadget.h" for details -+ */ -+static int ep_wedge(struct usb_ep *usb_ep) -+{ -+ int retval = 0; -+ -+ DWC_DEBUGPL(DBG_PCD, "WEDGE %s\n", usb_ep->name); -+ -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ return -EINVAL; -+ } -+ -+ retval = dwc_otg_pcd_ep_wedge(gadget_wrapper->pcd, usb_ep); -+ if (retval == -DWC_E_AGAIN) { -+ retval = -EAGAIN; -+ } else if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+#endif -+ -+#ifdef DWC_EN_ISOC -+/** -+ * This function is used to submit an ISOC Transfer Request to an EP. -+ * -+ * - Every time a sync period completes the request's completion callback -+ * is called to provide data to the gadget driver. -+ * - Once submitted the request cannot be modified. -+ * - Each request is turned into periodic data packets untill ISO -+ * Transfer is stopped.. -+ */ -+static int iso_ep_start(struct usb_ep *usb_ep, struct usb_iso_request *req, -+ gfp_t gfp_flags) -+{ -+ int retval = 0; -+ -+ if (!req || !req->process_buffer || !req->buf0 || !req->buf1) { -+ DWC_WARN("bad params\n"); -+ return -EINVAL; -+ } -+ -+ if (!usb_ep) { -+ DWC_PRINTF("bad params\n"); -+ return -EINVAL; -+ } -+ -+ req->status = -EINPROGRESS; -+ -+ retval = -+ dwc_otg_pcd_iso_ep_start(gadget_wrapper->pcd, usb_ep, req->buf0, -+ req->buf1, req->dma0, req->dma1, -+ req->sync_frame, req->data_pattern_frame, -+ req->data_per_frame, -+ req-> -+ flags & USB_REQ_ISO_ASAP ? -1 : -+ req->start_frame, req->buf_proc_intrvl, -+ req, gfp_flags == GFP_ATOMIC ? 1 : 0); -+ -+ if (retval) { -+ return -EINVAL; -+ } -+ -+ return retval; -+} -+ -+/** -+ * This function stops ISO EP Periodic Data Transfer. -+ */ -+static int iso_ep_stop(struct usb_ep *usb_ep, struct usb_iso_request *req) -+{ -+ int retval = 0; -+ if (!usb_ep) { -+ DWC_WARN("bad ep\n"); -+ } -+ -+ if (!gadget_wrapper->driver || -+ gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) { -+ DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n", -+ gadget_wrapper->gadget.speed); -+ DWC_WARN("bogus device state\n"); -+ } -+ -+ dwc_otg_pcd_iso_ep_stop(gadget_wrapper->pcd, usb_ep, req); -+ if (retval) { -+ retval = -EINVAL; -+ } -+ -+ return retval; -+} -+ -+static struct usb_iso_request *alloc_iso_request(struct usb_ep *ep, -+ int packets, gfp_t gfp_flags) -+{ -+ struct usb_iso_request *pReq = NULL; -+ uint32_t req_size; -+ -+ req_size = sizeof(struct usb_iso_request); -+ req_size += -+ (2 * packets * (sizeof(struct usb_gadget_iso_packet_descriptor))); -+ -+ pReq = kmalloc(req_size, gfp_flags); -+ if (!pReq) { -+ DWC_WARN("Can't allocate Iso Request\n"); -+ return 0; -+ } -+ pReq->iso_packet_desc0 = (void *)(pReq + 1); -+ -+ pReq->iso_packet_desc1 = pReq->iso_packet_desc0 + packets; -+ -+ return pReq; -+} -+ -+static void free_iso_request(struct usb_ep *ep, struct usb_iso_request *req) -+{ -+ kfree(req); -+} -+ -+static struct usb_isoc_ep_ops dwc_otg_pcd_ep_ops = { -+ .ep_ops = { -+ .enable = ep_enable, -+ .disable = ep_disable, -+ -+ .alloc_request = dwc_otg_pcd_alloc_request, -+ .free_request = dwc_otg_pcd_free_request, -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ .alloc_buffer = dwc_otg_pcd_alloc_buffer, -+ .free_buffer = dwc_otg_pcd_free_buffer, -+#endif -+ -+ .queue = ep_queue, -+ .dequeue = ep_dequeue, -+ -+ .set_halt = ep_halt, -+ .fifo_status = 0, -+ .fifo_flush = 0, -+ }, -+ .iso_ep_start = iso_ep_start, -+ .iso_ep_stop = iso_ep_stop, -+ .alloc_iso_request = alloc_iso_request, -+ .free_iso_request = free_iso_request, -+}; -+ -+#else -+ -+ int (*enable) (struct usb_ep *ep, -+ const struct usb_endpoint_descriptor *desc); -+ int (*disable) (struct usb_ep *ep); -+ -+ struct usb_request *(*alloc_request) (struct usb_ep *ep, -+ gfp_t gfp_flags); -+ void (*free_request) (struct usb_ep *ep, struct usb_request *req); -+ -+ int (*queue) (struct usb_ep *ep, struct usb_request *req, -+ gfp_t gfp_flags); -+ int (*dequeue) (struct usb_ep *ep, struct usb_request *req); -+ -+ int (*set_halt) (struct usb_ep *ep, int value); -+ int (*set_wedge) (struct usb_ep *ep); -+ -+ int (*fifo_status) (struct usb_ep *ep); -+ void (*fifo_flush) (struct usb_ep *ep); -+static struct usb_ep_ops dwc_otg_pcd_ep_ops = { -+ .enable = ep_enable, -+ .disable = ep_disable, -+ -+ .alloc_request = dwc_otg_pcd_alloc_request, -+ .free_request = dwc_otg_pcd_free_request, -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ .alloc_buffer = dwc_otg_pcd_alloc_buffer, -+ .free_buffer = dwc_otg_pcd_free_buffer, -+#else -+ /* .set_wedge = ep_wedge, */ -+ .set_wedge = NULL, /* uses set_halt instead */ -+#endif -+ -+ .queue = ep_queue, -+ .dequeue = ep_dequeue, -+ -+ .set_halt = ep_halt, -+ .fifo_status = 0, -+ .fifo_flush = 0, -+ -+}; -+ -+#endif /* _EN_ISOC_ */ -+/* Gadget Operations */ -+/** -+ * The following gadget operations will be implemented in the DWC_otg -+ * PCD. Functions in the API that are not described below are not -+ * implemented. -+ * -+ * The Gadget API provides wrapper functions for each of the function -+ * pointers defined in usb_gadget_ops. The Gadget Driver calls the -+ * wrapper function, which then calls the underlying PCD function. The -+ * following sections are named according to the wrapper functions -+ * (except for ioctl, which doesn't have a wrapper function). Within -+ * each section, the corresponding DWC_otg PCD function name is -+ * specified. -+ * -+ */ -+ -+/** -+ *Gets the USB Frame number of the last SOF. -+ */ -+static int get_frame_number(struct usb_gadget *gadget) -+{ -+ struct gadget_wrapper *d; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); -+ -+ if (gadget == 0) { -+ return -ENODEV; -+ } -+ -+ d = container_of(gadget, struct gadget_wrapper, gadget); -+ return dwc_otg_pcd_get_frame_number(d->pcd); -+} -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+static int test_lpm_enabled(struct usb_gadget *gadget) -+{ -+ struct gadget_wrapper *d; -+ -+ d = container_of(gadget, struct gadget_wrapper, gadget); -+ -+ return dwc_otg_pcd_is_lpm_enabled(d->pcd); -+} -+#endif -+ -+/** -+ * Initiates Session Request Protocol (SRP) to wakeup the host if no -+ * session is in progress. If a session is already in progress, but -+ * the device is suspended, remote wakeup signaling is started. -+ * -+ */ -+static int wakeup(struct usb_gadget *gadget) -+{ -+ struct gadget_wrapper *d; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, gadget); -+ -+ if (gadget == 0) { -+ return -ENODEV; -+ } else { -+ d = container_of(gadget, struct gadget_wrapper, gadget); -+ } -+ dwc_otg_pcd_wakeup(d->pcd); -+ return 0; -+} -+ -+static const struct usb_gadget_ops dwc_otg_pcd_ops = { -+ .get_frame = get_frame_number, -+ .wakeup = wakeup, -+#ifdef CONFIG_USB_DWC_OTG_LPM -+ .lpm_support = test_lpm_enabled, -+#endif -+ // current versions must always be self-powered -+}; -+ -+static int _setup(dwc_otg_pcd_t * pcd, uint8_t * bytes) -+{ -+ int retval = -DWC_E_NOT_SUPPORTED; -+ if (gadget_wrapper->driver && gadget_wrapper->driver->setup) { -+ retval = gadget_wrapper->driver->setup(&gadget_wrapper->gadget, -+ (struct usb_ctrlrequest -+ *)bytes); -+ } -+ -+ if (retval == -ENOTSUPP) { -+ retval = -DWC_E_NOT_SUPPORTED; -+ } else if (retval < 0) { -+ retval = -DWC_E_INVALID; -+ } -+ -+ return retval; -+} -+ -+#ifdef DWC_EN_ISOC -+static int _isoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int proc_buf_num) -+{ -+ int i, packet_count; -+ struct usb_gadget_iso_packet_descriptor *iso_packet = 0; -+ struct usb_iso_request *iso_req = req_handle; -+ -+ if (proc_buf_num) { -+ iso_packet = iso_req->iso_packet_desc1; -+ } else { -+ iso_packet = iso_req->iso_packet_desc0; -+ } -+ packet_count = -+ dwc_otg_pcd_get_iso_packet_count(pcd, ep_handle, req_handle); -+ for (i = 0; i < packet_count; ++i) { -+ int status; -+ int actual; -+ int offset; -+ dwc_otg_pcd_get_iso_packet_params(pcd, ep_handle, req_handle, -+ i, &status, &actual, &offset); -+ switch (status) { -+ case -DWC_E_NO_DATA: -+ status = -ENODATA; -+ break; -+ default: -+ if (status) { -+ DWC_PRINTF("unknown status in isoc packet\n"); -+ } -+ -+ } -+ iso_packet[i].status = status; -+ iso_packet[i].offset = offset; -+ iso_packet[i].actual_length = actual; -+ } -+ -+ iso_req->status = 0; -+ iso_req->process_buffer(ep_handle, iso_req); -+ -+ return 0; -+} -+#endif /* DWC_EN_ISOC */ -+ -+#ifdef DWC_UTE_PER_IO -+/** -+ * Copy the contents of the extended request to the Linux usb_request's -+ * extended part and call the gadget's completion. -+ * -+ * @param pcd Pointer to the pcd structure -+ * @param ep_handle Void pointer to the usb_ep structure -+ * @param req_handle Void pointer to the usb_request structure -+ * @param status Request status returned from the portable logic -+ * @param ereq_port Void pointer to the extended request structure -+ * created in the the portable part that contains the -+ * results of the processed iso packets. -+ */ -+static int _xisoc_complete(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, void *ereq_port) -+{ -+ struct dwc_ute_iso_req_ext *ereqorg = NULL; -+ struct dwc_iso_xreq_port *ereqport = NULL; -+ struct dwc_ute_iso_packet_descriptor *desc_org = NULL; -+ int i; -+ struct usb_request *req; -+ //struct dwc_ute_iso_packet_descriptor * -+ //int status = 0; -+ -+ req = (struct usb_request *)req_handle; -+ ereqorg = &req->ext_req; -+ ereqport = (struct dwc_iso_xreq_port *)ereq_port; -+ desc_org = ereqorg->per_io_frame_descs; -+ -+ if (req && req->complete) { -+ /* Copy the request data from the portable logic to our request */ -+ for (i = 0; i < ereqport->pio_pkt_count; i++) { -+ desc_org[i].actual_length = -+ ereqport->per_io_frame_descs[i].actual_length; -+ desc_org[i].status = -+ ereqport->per_io_frame_descs[i].status; -+ } -+ -+ switch (status) { -+ case -DWC_E_SHUTDOWN: -+ req->status = -ESHUTDOWN; -+ break; -+ case -DWC_E_RESTART: -+ req->status = -ECONNRESET; -+ break; -+ case -DWC_E_INVALID: -+ req->status = -EINVAL; -+ break; -+ case -DWC_E_TIMEOUT: -+ req->status = -ETIMEDOUT; -+ break; -+ default: -+ req->status = status; -+ } -+ -+ /* And call the gadget's completion */ -+ req->complete(ep_handle, req); -+ } -+ -+ return 0; -+} -+#endif /* DWC_UTE_PER_IO */ -+ -+static int _complete(dwc_otg_pcd_t * pcd, void *ep_handle, -+ void *req_handle, int32_t status, uint32_t actual) -+{ -+ struct usb_request *req = (struct usb_request *)req_handle; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) -+ struct dwc_otg_pcd_ep *ep = NULL; -+#endif -+ -+ if (req && req->complete) { -+ switch (status) { -+ case -DWC_E_SHUTDOWN: -+ req->status = -ESHUTDOWN; -+ break; -+ case -DWC_E_RESTART: -+ req->status = -ECONNRESET; -+ break; -+ case -DWC_E_INVALID: -+ req->status = -EINVAL; -+ break; -+ case -DWC_E_TIMEOUT: -+ req->status = -ETIMEDOUT; -+ break; -+ default: -+ req->status = status; -+ -+ } -+ -+ req->actual = actual; -+ DWC_SPINUNLOCK(pcd->lock); -+ req->complete(ep_handle, req); -+ DWC_SPINLOCK(pcd->lock); -+ } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) -+ ep = ep_from_handle(pcd, ep_handle); -+ if (GET_CORE_IF(pcd)->dma_enable) { -+ if (req->length != 0) { -+ dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; -+ struct device *dev = NULL; -+ -+ if (otg_dev != NULL) -+ dev = DWC_OTG_OS_GETDEV(otg_dev->os_dep); -+ -+ dma_unmap_single(dev, req->dma, req->length, -+ ep->dwc_ep.is_in ? -+ DMA_TO_DEVICE: DMA_FROM_DEVICE); -+ } -+ } -+#endif -+ -+ return 0; -+} -+ -+static int _connect(dwc_otg_pcd_t * pcd, int speed) -+{ -+ gadget_wrapper->gadget.speed = speed; -+ return 0; -+} -+ -+static int _disconnect(dwc_otg_pcd_t * pcd) -+{ -+ if (gadget_wrapper->driver && gadget_wrapper->driver->disconnect) { -+ gadget_wrapper->driver->disconnect(&gadget_wrapper->gadget); -+ } -+ return 0; -+} -+ -+static int _resume(dwc_otg_pcd_t * pcd) -+{ -+ if (gadget_wrapper->driver && gadget_wrapper->driver->resume) { -+ gadget_wrapper->driver->resume(&gadget_wrapper->gadget); -+ } -+ -+ return 0; -+} -+ -+static int _suspend(dwc_otg_pcd_t * pcd) -+{ -+ if (gadget_wrapper->driver && gadget_wrapper->driver->suspend) { -+ gadget_wrapper->driver->suspend(&gadget_wrapper->gadget); -+ } -+ return 0; -+} -+ -+/** -+ * This function updates the otg values in the gadget structure. -+ */ -+static int _hnp_changed(dwc_otg_pcd_t * pcd) -+{ -+ -+ if (!gadget_wrapper->gadget.is_otg) -+ return 0; -+ -+ gadget_wrapper->gadget.b_hnp_enable = get_b_hnp_enable(pcd); -+ gadget_wrapper->gadget.a_hnp_support = get_a_hnp_support(pcd); -+ gadget_wrapper->gadget.a_alt_hnp_support = get_a_alt_hnp_support(pcd); -+ return 0; -+} -+ -+static int _reset(dwc_otg_pcd_t * pcd) -+{ -+ return 0; -+} -+ -+#ifdef DWC_UTE_CFI -+static int _cfi_setup(dwc_otg_pcd_t * pcd, void *cfi_req) -+{ -+ int retval = -DWC_E_INVALID; -+ if (gadget_wrapper->driver->cfi_feature_setup) { -+ retval = -+ gadget_wrapper->driver-> -+ cfi_feature_setup(&gadget_wrapper->gadget, -+ (struct cfi_usb_ctrlrequest *)cfi_req); -+ } -+ -+ return retval; -+} -+#endif -+ -+static const struct dwc_otg_pcd_function_ops fops = { -+ .complete = _complete, -+#ifdef DWC_EN_ISOC -+ .isoc_complete = _isoc_complete, -+#endif -+ .setup = _setup, -+ .disconnect = _disconnect, -+ .connect = _connect, -+ .resume = _resume, -+ .suspend = _suspend, -+ .hnp_changed = _hnp_changed, -+ .reset = _reset, -+#ifdef DWC_UTE_CFI -+ .cfi_setup = _cfi_setup, -+#endif -+#ifdef DWC_UTE_PER_IO -+ .xisoc_complete = _xisoc_complete, -+#endif -+}; -+ -+/** -+ * This function is the top level PCD interrupt handler. -+ */ -+static irqreturn_t dwc_otg_pcd_irq(int irq, void *dev) -+{ -+ dwc_otg_pcd_t *pcd = dev; -+ int32_t retval = IRQ_NONE; -+ -+ retval = dwc_otg_pcd_handle_intr(pcd); -+ if (retval != 0) { -+ S3C2410X_CLEAR_EINTPEND(); -+ } -+ return IRQ_RETVAL(retval); -+} -+ -+/** -+ * This function initialized the usb_ep structures to there default -+ * state. -+ * -+ * @param d Pointer on gadget_wrapper. -+ */ -+void gadget_add_eps(struct gadget_wrapper *d) -+{ -+ static const char *names[] = { -+ -+ "ep0", -+ "ep1in", -+ "ep2in", -+ "ep3in", -+ "ep4in", -+ "ep5in", -+ "ep6in", -+ "ep7in", -+ "ep8in", -+ "ep9in", -+ "ep10in", -+ "ep11in", -+ "ep12in", -+ "ep13in", -+ "ep14in", -+ "ep15in", -+ "ep1out", -+ "ep2out", -+ "ep3out", -+ "ep4out", -+ "ep5out", -+ "ep6out", -+ "ep7out", -+ "ep8out", -+ "ep9out", -+ "ep10out", -+ "ep11out", -+ "ep12out", -+ "ep13out", -+ "ep14out", -+ "ep15out" -+ }; -+ -+ int i; -+ struct usb_ep *ep; -+ int8_t dev_endpoints; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s\n", __func__); -+ -+ INIT_LIST_HEAD(&d->gadget.ep_list); -+ d->gadget.ep0 = &d->ep0; -+ d->gadget.speed = USB_SPEED_UNKNOWN; -+ -+ INIT_LIST_HEAD(&d->gadget.ep0->ep_list); -+ -+ /** -+ * Initialize the EP0 structure. -+ */ -+ ep = &d->ep0; -+ -+ /* Init the usb_ep structure. */ -+ ep->name = names[0]; -+ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; -+ -+ /** -+ * @todo NGS: What should the max packet size be set to -+ * here? Before EP type is set? -+ */ -+ ep->maxpacket = MAX_PACKET_SIZE; -+ dwc_otg_pcd_ep_enable(d->pcd, NULL, ep); -+ -+ list_add_tail(&ep->ep_list, &d->gadget.ep_list); -+ -+ /** -+ * Initialize the EP structures. -+ */ -+ dev_endpoints = d->pcd->core_if->dev_if->num_in_eps; -+ -+ for (i = 0; i < dev_endpoints; i++) { -+ ep = &d->in_ep[i]; -+ -+ /* Init the usb_ep structure. */ -+ ep->name = names[d->pcd->in_ep[i].dwc_ep.num]; -+ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; -+ -+ /** -+ * @todo NGS: What should the max packet size be set to -+ * here? Before EP type is set? -+ */ -+ ep->maxpacket = MAX_PACKET_SIZE; -+ list_add_tail(&ep->ep_list, &d->gadget.ep_list); -+ } -+ -+ dev_endpoints = d->pcd->core_if->dev_if->num_out_eps; -+ -+ for (i = 0; i < dev_endpoints; i++) { -+ ep = &d->out_ep[i]; -+ -+ /* Init the usb_ep structure. */ -+ ep->name = names[15 + d->pcd->out_ep[i].dwc_ep.num]; -+ ep->ops = (struct usb_ep_ops *)&dwc_otg_pcd_ep_ops; -+ -+ /** -+ * @todo NGS: What should the max packet size be set to -+ * here? Before EP type is set? -+ */ -+ ep->maxpacket = MAX_PACKET_SIZE; -+ -+ list_add_tail(&ep->ep_list, &d->gadget.ep_list); -+ } -+ -+ /* remove ep0 from the list. There is a ep0 pointer. */ -+ list_del_init(&d->ep0.ep_list); -+ -+ d->ep0.maxpacket = MAX_EP0_SIZE; -+} -+ -+/** -+ * This function releases the Gadget device. -+ * required by device_unregister(). -+ * -+ * @todo Should this do something? Should it free the PCD? -+ */ -+static void dwc_otg_pcd_gadget_release(struct device *dev) -+{ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, dev); -+} -+ -+static struct gadget_wrapper *alloc_wrapper(dwc_bus_dev_t *_dev) -+{ -+ static char pcd_name[] = "dwc_otg_pcd"; -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ struct gadget_wrapper *d; -+ int retval; -+ -+ d = DWC_ALLOC(sizeof(*d)); -+ if (d == NULL) { -+ return NULL; -+ } -+ -+ memset(d, 0, sizeof(*d)); -+ -+ d->gadget.name = pcd_name; -+ d->pcd = otg_dev->pcd; -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+ strcpy(d->gadget.dev.bus_id, "gadget"); -+#else -+ dev_set_name(&d->gadget.dev, "%s", "gadget"); -+#endif -+ -+ d->gadget.dev.parent = &_dev->dev; -+ d->gadget.dev.release = dwc_otg_pcd_gadget_release; -+ d->gadget.ops = &dwc_otg_pcd_ops; -+ d->gadget.max_speed = dwc_otg_pcd_is_dualspeed(otg_dev->pcd) ? USB_SPEED_HIGH:USB_SPEED_FULL; -+ d->gadget.is_otg = dwc_otg_pcd_is_otg(otg_dev->pcd); -+ -+ d->driver = 0; -+ /* Register the gadget device */ -+ retval = device_register(&d->gadget.dev); -+ if (retval != 0) { -+ DWC_ERROR("device_register failed\n"); -+ DWC_FREE(d); -+ return NULL; -+ } -+ -+ return d; -+} -+ -+static void free_wrapper(struct gadget_wrapper *d) -+{ -+ if (d->driver) { -+ /* should have been done already by driver model core */ -+ DWC_WARN("driver '%s' is still registered\n", -+ d->driver->driver.name); -+#ifdef CONFIG_USB_GADGET -+ usb_gadget_unregister_driver(d->driver); -+#endif -+ } -+ -+ device_unregister(&d->gadget.dev); -+ DWC_FREE(d); -+} -+ -+/** -+ * This function initialized the PCD portion of the driver. -+ * -+ */ -+int pcd_init(dwc_bus_dev_t *_dev) -+{ -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ int retval = 0; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev=%p\n", __func__, _dev, otg_dev); -+ -+ otg_dev->pcd = dwc_otg_pcd_init(otg_dev); -+ -+ if (!otg_dev->pcd) { -+ DWC_ERROR("dwc_otg_pcd_init failed\n"); -+ return -ENOMEM; -+ } -+ -+ otg_dev->pcd->otg_dev = otg_dev; -+ gadget_wrapper = alloc_wrapper(_dev); -+ -+ /* -+ * Initialize EP structures -+ */ -+ gadget_add_eps(gadget_wrapper); -+ /* -+ * Setup interupt handler -+ */ -+#ifdef PLATFORM_INTERFACE -+ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", -+ platform_get_irq(_dev, fiq_enable ? 0 : 1)); -+ retval = request_irq(platform_get_irq(_dev, fiq_enable ? 0 : 1), dwc_otg_pcd_irq, -+ IRQF_SHARED, gadget_wrapper->gadget.name, -+ otg_dev->pcd); -+ if (retval != 0) { -+ DWC_ERROR("request of irq%d failed\n", -+ platform_get_irq(_dev, fiq_enable ? 0 : 1)); -+ free_wrapper(gadget_wrapper); -+ return -EBUSY; -+ } -+#else -+ DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", -+ _dev->irq); -+ retval = request_irq(_dev->irq, dwc_otg_pcd_irq, -+ IRQF_SHARED | IRQF_DISABLED, -+ gadget_wrapper->gadget.name, otg_dev->pcd); -+ if (retval != 0) { -+ DWC_ERROR("request of irq%d failed\n", _dev->irq); -+ free_wrapper(gadget_wrapper); -+ return -EBUSY; -+ } -+#endif -+ -+ dwc_otg_pcd_start(gadget_wrapper->pcd, &fops); -+ -+ return retval; -+} -+ -+/** -+ * Cleanup the PCD. -+ */ -+void pcd_remove(dwc_bus_dev_t *_dev) -+{ -+ dwc_otg_device_t *otg_dev = DWC_OTG_BUSDRVDATA(_dev); -+ dwc_otg_pcd_t *pcd = otg_dev->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p) otg_dev %p\n", __func__, _dev, otg_dev); -+ -+ /* -+ * Free the IRQ -+ */ -+#ifdef PLATFORM_INTERFACE -+ free_irq(platform_get_irq(_dev, 0), pcd); -+#else -+ free_irq(_dev->irq, pcd); -+#endif -+ dwc_otg_pcd_remove(otg_dev->pcd); -+ free_wrapper(gadget_wrapper); -+ otg_dev->pcd = 0; -+} -+ -+#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_regs.h b/drivers/usb/host/dwc_otg/dwc_otg_regs.h -new file mode 100644 -index 0000000000000000000000000000000000000000..8e0e7b569f1ac00fdbf3cdd2e22102cf195c74b7 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_regs.h -@@ -0,0 +1,2550 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $ -+ * $Revision: #98 $ -+ * $Date: 2012/08/10 $ -+ * $Change: 2047372 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+ -+#ifndef __DWC_OTG_REGS_H__ -+#define __DWC_OTG_REGS_H__ -+ -+#include "dwc_otg_core_if.h" -+ -+/** -+ * @file -+ * -+ * This file contains the data structures for accessing the DWC_otg core registers. -+ * -+ * The application interfaces with the HS OTG core by reading from and -+ * writing to the Control and Status Register (CSR) space through the -+ * AHB Slave interface. These registers are 32 bits wide, and the -+ * addresses are 32-bit-block aligned. -+ * CSRs are classified as follows: -+ * - Core Global Registers -+ * - Device Mode Registers -+ * - Device Global Registers -+ * - Device Endpoint Specific Registers -+ * - Host Mode Registers -+ * - Host Global Registers -+ * - Host Port CSRs -+ * - Host Channel Specific Registers -+ * -+ * Only the Core Global registers can be accessed in both Device and -+ * Host modes. When the HS OTG core is operating in one mode, either -+ * Device or Host, the application must not access registers from the -+ * other mode. When the core switches from one mode to another, the -+ * registers in the new mode of operation must be reprogrammed as they -+ * would be after a power-on reset. -+ */ -+ -+/****************************************************************************/ -+/** DWC_otg Core registers . -+ * The dwc_otg_core_global_regs structure defines the size -+ * and relative field offsets for the Core Global registers. -+ */ -+typedef struct dwc_otg_core_global_regs { -+ /** OTG Control and Status Register. Offset: 000h */ -+ volatile uint32_t gotgctl; -+ /** OTG Interrupt Register. Offset: 004h */ -+ volatile uint32_t gotgint; -+ /**Core AHB Configuration Register. Offset: 008h */ -+ volatile uint32_t gahbcfg; -+ -+#define DWC_GLBINTRMASK 0x0001 -+#define DWC_DMAENABLE 0x0020 -+#define DWC_NPTXEMPTYLVL_EMPTY 0x0080 -+#define DWC_NPTXEMPTYLVL_HALFEMPTY 0x0000 -+#define DWC_PTXEMPTYLVL_EMPTY 0x0100 -+#define DWC_PTXEMPTYLVL_HALFEMPTY 0x0000 -+ -+ /**Core USB Configuration Register. Offset: 00Ch */ -+ volatile uint32_t gusbcfg; -+ /**Core Reset Register. Offset: 010h */ -+ volatile uint32_t grstctl; -+ /**Core Interrupt Register. Offset: 014h */ -+ volatile uint32_t gintsts; -+ /**Core Interrupt Mask Register. Offset: 018h */ -+ volatile uint32_t gintmsk; -+ /**Receive Status Queue Read Register (Read Only). Offset: 01Ch */ -+ volatile uint32_t grxstsr; -+ /**Receive Status Queue Read & POP Register (Read Only). Offset: 020h*/ -+ volatile uint32_t grxstsp; -+ /**Receive FIFO Size Register. Offset: 024h */ -+ volatile uint32_t grxfsiz; -+ /**Non Periodic Transmit FIFO Size Register. Offset: 028h */ -+ volatile uint32_t gnptxfsiz; -+ /**Non Periodic Transmit FIFO/Queue Status Register (Read -+ * Only). Offset: 02Ch */ -+ volatile uint32_t gnptxsts; -+ /**I2C Access Register. Offset: 030h */ -+ volatile uint32_t gi2cctl; -+ /**PHY Vendor Control Register. Offset: 034h */ -+ volatile uint32_t gpvndctl; -+ /**General Purpose Input/Output Register. Offset: 038h */ -+ volatile uint32_t ggpio; -+ /**User ID Register. Offset: 03Ch */ -+ volatile uint32_t guid; -+ /**Synopsys ID Register (Read Only). Offset: 040h */ -+ volatile uint32_t gsnpsid; -+ /**User HW Config1 Register (Read Only). Offset: 044h */ -+ volatile uint32_t ghwcfg1; -+ /**User HW Config2 Register (Read Only). Offset: 048h */ -+ volatile uint32_t ghwcfg2; -+#define DWC_SLAVE_ONLY_ARCH 0 -+#define DWC_EXT_DMA_ARCH 1 -+#define DWC_INT_DMA_ARCH 2 -+ -+#define DWC_MODE_HNP_SRP_CAPABLE 0 -+#define DWC_MODE_SRP_ONLY_CAPABLE 1 -+#define DWC_MODE_NO_HNP_SRP_CAPABLE 2 -+#define DWC_MODE_SRP_CAPABLE_DEVICE 3 -+#define DWC_MODE_NO_SRP_CAPABLE_DEVICE 4 -+#define DWC_MODE_SRP_CAPABLE_HOST 5 -+#define DWC_MODE_NO_SRP_CAPABLE_HOST 6 -+ -+ /**User HW Config3 Register (Read Only). Offset: 04Ch */ -+ volatile uint32_t ghwcfg3; -+ /**User HW Config4 Register (Read Only). Offset: 050h*/ -+ volatile uint32_t ghwcfg4; -+ /** Core LPM Configuration register Offset: 054h*/ -+ volatile uint32_t glpmcfg; -+ /** Global PowerDn Register Offset: 058h */ -+ volatile uint32_t gpwrdn; -+ /** Global DFIFO SW Config Register Offset: 05Ch */ -+ volatile uint32_t gdfifocfg; -+ /** ADP Control Register Offset: 060h */ -+ volatile uint32_t adpctl; -+ /** Reserved Offset: 064h-0FFh */ -+ volatile uint32_t reserved39[39]; -+ /** Host Periodic Transmit FIFO Size Register. Offset: 100h */ -+ volatile uint32_t hptxfsiz; -+ /** Device Periodic Transmit FIFO#n Register if dedicated fifos are disabled, -+ otherwise Device Transmit FIFO#n Register. -+ * Offset: 104h + (FIFO_Number-1)*04h, 1 <= FIFO Number <= 15 (1<=n<=15). */ -+ volatile uint32_t dtxfsiz[15]; -+} dwc_otg_core_global_regs_t; -+ -+/** -+ * This union represents the bit fields of the Core OTG Control -+ * and Status Register (GOTGCTL). Set the bits using the bit -+ * fields then write the d32 value to the register. -+ */ -+typedef union gotgctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned sesreqscs:1; -+ unsigned sesreq:1; -+ unsigned vbvalidoven:1; -+ unsigned vbvalidovval:1; -+ unsigned avalidoven:1; -+ unsigned avalidovval:1; -+ unsigned bvalidoven:1; -+ unsigned bvalidovval:1; -+ unsigned hstnegscs:1; -+ unsigned hnpreq:1; -+ unsigned hstsethnpen:1; -+ unsigned devhnpen:1; -+ unsigned reserved12_15:4; -+ unsigned conidsts:1; -+ unsigned dbnctime:1; -+ unsigned asesvld:1; -+ unsigned bsesvld:1; -+ unsigned otgver:1; -+ unsigned reserved1:1; -+ unsigned multvalidbc:5; -+ unsigned chirpen:1; -+ unsigned reserved28_31:4; -+ } b; -+} gotgctl_data_t; -+ -+/** -+ * This union represents the bit fields of the Core OTG Interrupt Register -+ * (GOTGINT). Set/clear the bits using the bit fields then write the d32 -+ * value to the register. -+ */ -+typedef union gotgint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Current Mode */ -+ unsigned reserved0_1:2; -+ -+ /** Session End Detected */ -+ unsigned sesenddet:1; -+ -+ unsigned reserved3_7:5; -+ -+ /** Session Request Success Status Change */ -+ unsigned sesreqsucstschng:1; -+ /** Host Negotiation Success Status Change */ -+ unsigned hstnegsucstschng:1; -+ -+ unsigned reserved10_16:7; -+ -+ /** Host Negotiation Detected */ -+ unsigned hstnegdet:1; -+ /** A-Device Timeout Change */ -+ unsigned adevtoutchng:1; -+ /** Debounce Done */ -+ unsigned debdone:1; -+ /** Multi-Valued input changed */ -+ unsigned mvic:1; -+ -+ unsigned reserved31_21:11; -+ -+ } b; -+} gotgint_data_t; -+ -+/** -+ * This union represents the bit fields of the Core AHB Configuration -+ * Register (GAHBCFG). Set/clear the bits using the bit fields then -+ * write the d32 value to the register. -+ */ -+typedef union gahbcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned glblintrmsk:1; -+#define DWC_GAHBCFG_GLBINT_ENABLE 1 -+ -+ unsigned hburstlen:4; -+#define DWC_GAHBCFG_INT_DMA_BURST_SINGLE 0 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR 1 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR4 3 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR8 5 -+#define DWC_GAHBCFG_INT_DMA_BURST_INCR16 7 -+ -+ unsigned dmaenable:1; -+#define DWC_GAHBCFG_DMAENABLE 1 -+ unsigned reserved:1; -+ unsigned nptxfemplvl_txfemplvl:1; -+ unsigned ptxfemplvl:1; -+#define DWC_GAHBCFG_TXFEMPTYLVL_EMPTY 1 -+#define DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0 -+ unsigned reserved9_20:12; -+ unsigned remmemsupp:1; -+ unsigned notialldmawrit:1; -+ unsigned ahbsingle:1; -+ unsigned reserved24_31:8; -+ } b; -+} gahbcfg_data_t; -+ -+/** -+ * This union represents the bit fields of the Core USB Configuration -+ * Register (GUSBCFG). Set the bits using the bit fields then write -+ * the d32 value to the register. -+ */ -+typedef union gusbcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned toutcal:3; -+ unsigned phyif:1; -+ unsigned ulpi_utmi_sel:1; -+ unsigned fsintf:1; -+ unsigned physel:1; -+ unsigned ddrsel:1; -+ unsigned srpcap:1; -+ unsigned hnpcap:1; -+ unsigned usbtrdtim:4; -+ unsigned reserved1:1; -+ unsigned phylpwrclksel:1; -+ unsigned otgutmifssel:1; -+ unsigned ulpi_fsls:1; -+ unsigned ulpi_auto_res:1; -+ unsigned ulpi_clk_sus_m:1; -+ unsigned ulpi_ext_vbus_drv:1; -+ unsigned ulpi_int_vbus_indicator:1; -+ unsigned term_sel_dl_pulse:1; -+ unsigned indicator_complement:1; -+ unsigned indicator_pass_through:1; -+ unsigned ulpi_int_prot_dis:1; -+ unsigned ic_usb_cap:1; -+ unsigned ic_traffic_pull_remove:1; -+ unsigned tx_end_delay:1; -+ unsigned force_host_mode:1; -+ unsigned force_dev_mode:1; -+ unsigned reserved31:1; -+ } b; -+} gusbcfg_data_t; -+ -+/** -+ * This union represents the bit fields of the Core Reset Register -+ * (GRSTCTL). Set/clear the bits using the bit fields then write the -+ * d32 value to the register. -+ */ -+typedef union grstctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Core Soft Reset (CSftRst) (Device and Host) -+ * -+ * The application can flush the control logic in the -+ * entire core using this bit. This bit resets the -+ * pipelines in the AHB Clock domain as well as the -+ * PHY Clock domain. -+ * -+ * The state machines are reset to an IDLE state, the -+ * control bits in the CSRs are cleared, all the -+ * transmit FIFOs and the receive FIFO are flushed. -+ * -+ * The status mask bits that control the generation of -+ * the interrupt, are cleared, to clear the -+ * interrupt. The interrupt status bits are not -+ * cleared, so the application can get the status of -+ * any events that occurred in the core after it has -+ * set this bit. -+ * -+ * Any transactions on the AHB are terminated as soon -+ * as possible following the protocol. Any -+ * transactions on the USB are terminated immediately. -+ * -+ * The configuration settings in the CSRs are -+ * unchanged, so the software doesn't have to -+ * reprogram these registers (Device -+ * Configuration/Host Configuration/Core System -+ * Configuration/Core PHY Configuration). -+ * -+ * The application can write to this bit, any time it -+ * wants to reset the core. This is a self clearing -+ * bit and the core clears this bit after all the -+ * necessary logic is reset in the core, which may -+ * take several clocks, depending on the current state -+ * of the core. -+ */ -+ unsigned csftrst:1; -+ /** Hclk Soft Reset -+ * -+ * The application uses this bit to reset the control logic in -+ * the AHB clock domain. Only AHB clock domain pipelines are -+ * reset. -+ */ -+ unsigned hsftrst:1; -+ /** Host Frame Counter Reset (Host Only)
-+ * -+ * The application can reset the (micro)frame number -+ * counter inside the core, using this bit. When the -+ * (micro)frame counter is reset, the subsequent SOF -+ * sent out by the core, will have a (micro)frame -+ * number of 0. -+ */ -+ unsigned hstfrm:1; -+ /** In Token Sequence Learning Queue Flush -+ * (INTknQFlsh) (Device Only) -+ */ -+ unsigned intknqflsh:1; -+ /** RxFIFO Flush (RxFFlsh) (Device and Host) -+ * -+ * The application can flush the entire Receive FIFO -+ * using this bit. The application must first -+ * ensure that the core is not in the middle of a -+ * transaction. The application should write into -+ * this bit, only after making sure that neither the -+ * DMA engine is reading from the RxFIFO nor the MAC -+ * is writing the data in to the FIFO. The -+ * application should wait until the bit is cleared -+ * before performing any other operations. This bit -+ * will takes 8 clocks (slowest of PHY or AHB clock) -+ * to clear. -+ */ -+ unsigned rxfflsh:1; -+ /** TxFIFO Flush (TxFFlsh) (Device and Host). -+ * -+ * This bit is used to selectively flush a single or -+ * all transmit FIFOs. The application must first -+ * ensure that the core is not in the middle of a -+ * transaction. The application should write into -+ * this bit, only after making sure that neither the -+ * DMA engine is writing into the TxFIFO nor the MAC -+ * is reading the data out of the FIFO. The -+ * application should wait until the core clears this -+ * bit, before performing any operations. This bit -+ * will takes 8 clocks (slowest of PHY or AHB clock) -+ * to clear. -+ */ -+ unsigned txfflsh:1; -+ -+ /** TxFIFO Number (TxFNum) (Device and Host). -+ * -+ * This is the FIFO number which needs to be flushed, -+ * using the TxFIFO Flush bit. This field should not -+ * be changed until the TxFIFO Flush bit is cleared by -+ * the core. -+ * - 0x0 : Non Periodic TxFIFO Flush -+ * - 0x1 : Periodic TxFIFO #1 Flush in device mode -+ * or Periodic TxFIFO in host mode -+ * - 0x2 : Periodic TxFIFO #2 Flush in device mode. -+ * - ... -+ * - 0xF : Periodic TxFIFO #15 Flush in device mode -+ * - 0x10: Flush all the Transmit NonPeriodic and -+ * Transmit Periodic FIFOs in the core -+ */ -+ unsigned txfnum:5; -+ /** Reserved */ -+ unsigned reserved11_29:19; -+ /** DMA Request Signal. Indicated DMA request is in -+ * probress. Used for debug purpose. */ -+ unsigned dmareq:1; -+ /** AHB Master Idle. Indicates the AHB Master State -+ * Machine is in IDLE condition. */ -+ unsigned ahbidle:1; -+ } b; -+} grstctl_t; -+ -+/** -+ * This union represents the bit fields of the Core Interrupt Mask -+ * Register (GINTMSK). Set/clear the bits using the bit fields then -+ * write the d32 value to the register. -+ */ -+typedef union gintmsk_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned reserved0:1; -+ unsigned modemismatch:1; -+ unsigned otgintr:1; -+ unsigned sofintr:1; -+ unsigned rxstsqlvl:1; -+ unsigned nptxfempty:1; -+ unsigned ginnakeff:1; -+ unsigned goutnakeff:1; -+ unsigned ulpickint:1; -+ unsigned i2cintr:1; -+ unsigned erlysuspend:1; -+ unsigned usbsuspend:1; -+ unsigned usbreset:1; -+ unsigned enumdone:1; -+ unsigned isooutdrop:1; -+ unsigned eopframe:1; -+ unsigned restoredone:1; -+ unsigned epmismatch:1; -+ unsigned inepintr:1; -+ unsigned outepintr:1; -+ unsigned incomplisoin:1; -+ unsigned incomplisoout:1; -+ unsigned fetsusp:1; -+ unsigned resetdet:1; -+ unsigned portintr:1; -+ unsigned hcintr:1; -+ unsigned ptxfempty:1; -+ unsigned lpmtranrcvd:1; -+ unsigned conidstschng:1; -+ unsigned disconnect:1; -+ unsigned sessreqintr:1; -+ unsigned wkupintr:1; -+ } b; -+} gintmsk_data_t; -+/** -+ * This union represents the bit fields of the Core Interrupt Register -+ * (GINTSTS). Set/clear the bits using the bit fields then write the -+ * d32 value to the register. -+ */ -+typedef union gintsts_data { -+ /** raw register data */ -+ uint32_t d32; -+#define DWC_SOF_INTR_MASK 0x0008 -+ /** register bits */ -+ struct { -+#define DWC_HOST_MODE 1 -+ unsigned curmode:1; -+ unsigned modemismatch:1; -+ unsigned otgintr:1; -+ unsigned sofintr:1; -+ unsigned rxstsqlvl:1; -+ unsigned nptxfempty:1; -+ unsigned ginnakeff:1; -+ unsigned goutnakeff:1; -+ unsigned ulpickint:1; -+ unsigned i2cintr:1; -+ unsigned erlysuspend:1; -+ unsigned usbsuspend:1; -+ unsigned usbreset:1; -+ unsigned enumdone:1; -+ unsigned isooutdrop:1; -+ unsigned eopframe:1; -+ unsigned restoredone:1; -+ unsigned epmismatch:1; -+ unsigned inepint:1; -+ unsigned outepintr:1; -+ unsigned incomplisoin:1; -+ unsigned incomplisoout:1; -+ unsigned fetsusp:1; -+ unsigned resetdet:1; -+ unsigned portintr:1; -+ unsigned hcintr:1; -+ unsigned ptxfempty:1; -+ unsigned lpmtranrcvd:1; -+ unsigned conidstschng:1; -+ unsigned disconnect:1; -+ unsigned sessreqintr:1; -+ unsigned wkupintr:1; -+ } b; -+} gintsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Device Receive Status Read and -+ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the d32 -+ * element then read out the bits using the bit elements. -+ */ -+typedef union device_grxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned epnum:4; -+ unsigned bcnt:11; -+ unsigned dpid:2; -+ -+#define DWC_STS_DATA_UPDT 0x2 // OUT Data Packet -+#define DWC_STS_XFER_COMP 0x3 // OUT Data Transfer Complete -+ -+#define DWC_DSTS_GOUT_NAK 0x1 // Global OUT NAK -+#define DWC_DSTS_SETUP_COMP 0x4 // Setup Phase Complete -+#define DWC_DSTS_SETUP_UPDT 0x6 // SETUP Packet -+ unsigned pktsts:4; -+ unsigned fn:4; -+ unsigned reserved25_31:7; -+ } b; -+} device_grxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Receive Status Read and -+ * Pop Registers (GRXSTSR, GRXSTSP) Read the register into the d32 -+ * element then read out the bits using the bit elements. -+ */ -+typedef union host_grxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned chnum:4; -+ unsigned bcnt:11; -+ unsigned dpid:2; -+ -+ unsigned pktsts:4; -+#define DWC_GRXSTS_PKTSTS_IN 0x2 -+#define DWC_GRXSTS_PKTSTS_IN_XFER_COMP 0x3 -+#define DWC_GRXSTS_PKTSTS_DATA_TOGGLE_ERR 0x5 -+#define DWC_GRXSTS_PKTSTS_CH_HALTED 0x7 -+ -+ unsigned reserved21_31:11; -+ } b; -+} host_grxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the FIFO Size Registers (HPTXFSIZ, -+ * GNPTXFSIZ, DPTXFSIZn, DIEPTXFn). Read the register into the d32 element -+ * then read out the bits using the bit elements. -+ */ -+typedef union fifosize_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned startaddr:16; -+ unsigned depth:16; -+ } b; -+} fifosize_data_t; -+ -+/** -+ * This union represents the bit fields in the Non-Periodic Transmit -+ * FIFO/Queue Status Register (GNPTXSTS). Read the register into the -+ * d32 element then read out the bits using the bit -+ * elements. -+ */ -+typedef union gnptxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned nptxfspcavail:16; -+ unsigned nptxqspcavail:8; -+ /** Top of the Non-Periodic Transmit Request Queue -+ * - bit 24 - Terminate (Last entry for the selected -+ * channel/EP) -+ * - bits 26:25 - Token Type -+ * - 2'b00 - IN/OUT -+ * - 2'b01 - Zero Length OUT -+ * - 2'b10 - PING/Complete Split -+ * - 2'b11 - Channel Halt -+ * - bits 30:27 - Channel/EP Number -+ */ -+ unsigned nptxqtop_terminate:1; -+ unsigned nptxqtop_token:2; -+ unsigned nptxqtop_chnep:4; -+ unsigned reserved:1; -+ } b; -+} gnptxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Transmit -+ * FIFO Status Register (DTXFSTS). Read the register into the -+ * d32 element then read out the bits using the bit -+ * elements. -+ */ -+typedef union dtxfsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned txfspcavail:16; -+ unsigned reserved:16; -+ } b; -+} dtxfsts_data_t; -+ -+/** -+ * This union represents the bit fields in the I2C Control Register -+ * (I2CCTL). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union gi2cctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned rwdata:8; -+ unsigned regaddr:8; -+ unsigned addr:7; -+ unsigned i2cen:1; -+ unsigned ack:1; -+ unsigned i2csuspctl:1; -+ unsigned i2cdevaddr:2; -+ unsigned i2cdatse0:1; -+ unsigned reserved:1; -+ unsigned rw:1; -+ unsigned bsydne:1; -+ } b; -+} gi2cctl_data_t; -+ -+/** -+ * This union represents the bit fields in the PHY Vendor Control Register -+ * (GPVNDCTL). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union gpvndctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned regdata:8; -+ unsigned vctrl:8; -+ unsigned regaddr16_21:6; -+ unsigned regwr:1; -+ unsigned reserved23_24:2; -+ unsigned newregreq:1; -+ unsigned vstsbsy:1; -+ unsigned vstsdone:1; -+ unsigned reserved28_30:3; -+ unsigned disulpidrvr:1; -+ } b; -+} gpvndctl_data_t; -+ -+/** -+ * This union represents the bit fields in the General Purpose -+ * Input/Output Register (GGPIO). -+ * Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union ggpio_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned gpi:16; -+ unsigned gpo:16; -+ } b; -+} ggpio_data_t; -+ -+/** -+ * This union represents the bit fields in the User ID Register -+ * (GUID). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union guid_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned rwdata:32; -+ } b; -+} guid_data_t; -+ -+/** -+ * This union represents the bit fields in the Synopsys ID Register -+ * (GSNPSID). Read the register into the d32 element then read out the -+ * bits using the bit elements. -+ */ -+typedef union gsnpsid_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned rwdata:32; -+ } b; -+} gsnpsid_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config1 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg1_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned ep_dir0:2; -+ unsigned ep_dir1:2; -+ unsigned ep_dir2:2; -+ unsigned ep_dir3:2; -+ unsigned ep_dir4:2; -+ unsigned ep_dir5:2; -+ unsigned ep_dir6:2; -+ unsigned ep_dir7:2; -+ unsigned ep_dir8:2; -+ unsigned ep_dir9:2; -+ unsigned ep_dir10:2; -+ unsigned ep_dir11:2; -+ unsigned ep_dir12:2; -+ unsigned ep_dir13:2; -+ unsigned ep_dir14:2; -+ unsigned ep_dir15:2; -+ } b; -+} hwcfg1_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config2 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg2_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /* GHWCFG2 */ -+ unsigned op_mode:3; -+#define DWC_HWCFG2_OP_MODE_HNP_SRP_CAPABLE_OTG 0 -+#define DWC_HWCFG2_OP_MODE_SRP_ONLY_CAPABLE_OTG 1 -+#define DWC_HWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE_OTG 2 -+#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_DEVICE 3 -+#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE 4 -+#define DWC_HWCFG2_OP_MODE_SRP_CAPABLE_HOST 5 -+#define DWC_HWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST 6 -+ -+ unsigned architecture:2; -+ unsigned point2point:1; -+ unsigned hs_phy_type:2; -+#define DWC_HWCFG2_HS_PHY_TYPE_NOT_SUPPORTED 0 -+#define DWC_HWCFG2_HS_PHY_TYPE_UTMI 1 -+#define DWC_HWCFG2_HS_PHY_TYPE_ULPI 2 -+#define DWC_HWCFG2_HS_PHY_TYPE_UTMI_ULPI 3 -+ -+ unsigned fs_phy_type:2; -+ unsigned num_dev_ep:4; -+ unsigned num_host_chan:4; -+ unsigned perio_ep_supported:1; -+ unsigned dynamic_fifo:1; -+ unsigned multi_proc_int:1; -+ unsigned reserved21:1; -+ unsigned nonperio_tx_q_depth:2; -+ unsigned host_perio_tx_q_depth:2; -+ unsigned dev_token_q_depth:5; -+ unsigned otg_enable_ic_usb:1; -+ } b; -+} hwcfg2_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config3 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg3_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /* GHWCFG3 */ -+ unsigned xfer_size_cntr_width:4; -+ unsigned packet_size_cntr_width:3; -+ unsigned otg_func:1; -+ unsigned i2c:1; -+ unsigned vendor_ctrl_if:1; -+ unsigned optional_features:1; -+ unsigned synch_reset_type:1; -+ unsigned adp_supp:1; -+ unsigned otg_enable_hsic:1; -+ unsigned bc_support:1; -+ unsigned otg_lpm_en:1; -+ unsigned dfifo_depth:16; -+ } b; -+} hwcfg3_data_t; -+ -+/** -+ * This union represents the bit fields in the User HW Config4 -+ * Register. Read the register into the d32 element then read -+ * out the bits using the bit elements. -+ */ -+typedef union hwcfg4_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned num_dev_perio_in_ep:4; -+ unsigned power_optimiz:1; -+ unsigned min_ahb_freq:1; -+ unsigned hiber:1; -+ unsigned xhiber:1; -+ unsigned reserved:6; -+ unsigned utmi_phy_data_width:2; -+ unsigned num_dev_mode_ctrl_ep:4; -+ unsigned iddig_filt_en:1; -+ unsigned vbus_valid_filt_en:1; -+ unsigned a_valid_filt_en:1; -+ unsigned b_valid_filt_en:1; -+ unsigned session_end_filt_en:1; -+ unsigned ded_fifo_en:1; -+ unsigned num_in_eps:4; -+ unsigned desc_dma:1; -+ unsigned desc_dma_dyn:1; -+ } b; -+} hwcfg4_data_t; -+ -+/** -+ * This union represents the bit fields of the Core LPM Configuration -+ * Register (GLPMCFG). Set the bits using bit fields then write -+ * the d32 value to the register. -+ */ -+typedef union glpmctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** LPM-Capable (LPMCap) (Device and Host) -+ * The application uses this bit to control -+ * the DWC_otg core LPM capabilities. -+ */ -+ unsigned lpm_cap_en:1; -+ /** LPM response programmed by application (AppL1Res) (Device) -+ * Handshake response to LPM token pre-programmed -+ * by device application software. -+ */ -+ unsigned appl_resp:1; -+ /** Host Initiated Resume Duration (HIRD) (Device and Host) -+ * In Host mode this field indicates the value of HIRD -+ * to be sent in an LPM transaction. -+ * In Device mode this field is updated with the -+ * Received LPM Token HIRD bmAttribute -+ * when an ACK/NYET/STALL response is sent -+ * to an LPM transaction. -+ */ -+ unsigned hird:4; -+ /** RemoteWakeEnable (bRemoteWake) (Device and Host) -+ * In Host mode this bit indicates the value of remote -+ * wake up to be sent in wIndex field of LPM transaction. -+ * In Device mode this field is updated with the -+ * Received LPM Token bRemoteWake bmAttribute -+ * when an ACK/NYET/STALL response is sent -+ * to an LPM transaction. -+ */ -+ unsigned rem_wkup_en:1; -+ /** Enable utmi_sleep_n (EnblSlpM) (Device and Host) -+ * The application uses this bit to control -+ * the utmi_sleep_n assertion to the PHY when in L1 state. -+ */ -+ unsigned en_utmi_sleep:1; -+ /** HIRD Threshold (HIRD_Thres) (Device and Host) -+ */ -+ unsigned hird_thres:5; -+ /** LPM Response (CoreL1Res) (Device and Host) -+ * In Host mode this bit contains handsake response to -+ * LPM transaction. -+ * In Device mode the response of the core to -+ * LPM transaction received is reflected in these two bits. -+ - 0x0 : ERROR (No handshake response) -+ - 0x1 : STALL -+ - 0x2 : NYET -+ - 0x3 : ACK -+ */ -+ unsigned lpm_resp:2; -+ /** Port Sleep Status (SlpSts) (Device and Host) -+ * This bit is set as long as a Sleep condition -+ * is present on the USB bus. -+ */ -+ unsigned prt_sleep_sts:1; -+ /** Sleep State Resume OK (L1ResumeOK) (Device and Host) -+ * Indicates that the application or host -+ * can start resume from Sleep state. -+ */ -+ unsigned sleep_state_resumeok:1; -+ /** LPM channel Index (LPM_Chnl_Indx) (Host) -+ * The channel number on which the LPM transaction -+ * has to be applied while sending -+ * an LPM transaction to the local device. -+ */ -+ unsigned lpm_chan_index:4; -+ /** LPM Retry Count (LPM_Retry_Cnt) (Host) -+ * Number host retries that would be performed -+ * if the device response was not valid response. -+ */ -+ unsigned retry_count:3; -+ /** Send LPM Transaction (SndLPM) (Host) -+ * When set by application software, -+ * an LPM transaction containing two tokens -+ * is sent. -+ */ -+ unsigned send_lpm:1; -+ /** LPM Retry status (LPM_RetryCnt_Sts) (Host) -+ * Number of LPM Host Retries still remaining -+ * to be transmitted for the current LPM sequence -+ */ -+ unsigned retry_count_sts:3; -+ unsigned reserved28_29:2; -+ /** In host mode once this bit is set, the host -+ * configures to drive the HSIC Idle state on the bus. -+ * It then waits for the device to initiate the Connect sequence. -+ * In device mode once this bit is set, the device waits for -+ * the HSIC Idle line state on the bus. Upon receving the Idle -+ * line state, it initiates the HSIC Connect sequence. -+ */ -+ unsigned hsic_connect:1; -+ /** This bit overrides and functionally inverts -+ * the if_select_hsic input port signal. -+ */ -+ unsigned inv_sel_hsic:1; -+ } b; -+} glpmcfg_data_t; -+ -+/** -+ * This union represents the bit fields of the Core ADP Timer, Control and -+ * Status Register (ADPTIMCTLSTS). Set the bits using bit fields then write -+ * the d32 value to the register. -+ */ -+typedef union adpctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Probe Discharge (PRB_DSCHG) -+ * These bits set the times for TADP_DSCHG. -+ * These bits are defined as follows: -+ * 2'b00 - 4 msec -+ * 2'b01 - 8 msec -+ * 2'b10 - 16 msec -+ * 2'b11 - 32 msec -+ */ -+ unsigned prb_dschg:2; -+ /** Probe Delta (PRB_DELTA) -+ * These bits set the resolution for RTIM value. -+ * The bits are defined in units of 32 kHz clock cycles as follows: -+ * 2'b00 - 1 cycles -+ * 2'b01 - 2 cycles -+ * 2'b10 - 3 cycles -+ * 2'b11 - 4 cycles -+ * For example if this value is chosen to 2'b01, it means that RTIM -+ * increments for every 3(three) 32Khz clock cycles. -+ */ -+ unsigned prb_delta:2; -+ /** Probe Period (PRB_PER) -+ * These bits sets the TADP_PRD as shown in Figure 4 as follows: -+ * 2'b00 - 0.625 to 0.925 sec (typical 0.775 sec) -+ * 2'b01 - 1.25 to 1.85 sec (typical 1.55 sec) -+ * 2'b10 - 1.9 to 2.6 sec (typical 2.275 sec) -+ * 2'b11 - Reserved -+ */ -+ unsigned prb_per:2; -+ /** These bits capture the latest time it took for VBUS to ramp from -+ * VADP_SINK to VADP_PRB. -+ * 0x000 - 1 cycles -+ * 0x001 - 2 cycles -+ * 0x002 - 3 cycles -+ * etc -+ * 0x7FF - 2048 cycles -+ * A time of 1024 cycles at 32 kHz corresponds to a time of 32 msec. -+ */ -+ unsigned rtim:11; -+ /** Enable Probe (EnaPrb) -+ * When programmed to 1'b1, the core performs a probe operation. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned enaprb:1; -+ /** Enable Sense (EnaSns) -+ * When programmed to 1'b1, the core performs a Sense operation. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned enasns:1; -+ /** ADP Reset (ADPRes) -+ * When set, ADP controller is reset. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adpres:1; -+ /** ADP Enable (ADPEn) -+ * When set, the core performs either ADP probing or sensing -+ * based on EnaPrb or EnaSns. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adpen:1; -+ /** ADP Probe Interrupt (ADP_PRB_INT) -+ * When this bit is set, it means that the VBUS -+ * voltage is greater than VADP_PRB or VADP_PRB is reached. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_prb_int:1; -+ /** -+ * ADP Sense Interrupt (ADP_SNS_INT) -+ * When this bit is set, it means that the VBUS voltage is greater than -+ * VADP_SNS value or VADP_SNS is reached. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_sns_int:1; -+ /** ADP Tomeout Interrupt (ADP_TMOUT_INT) -+ * This bit is relevant only for an ADP probe. -+ * When this bit is set, it means that the ramp time has -+ * completed ie ADPCTL.RTIM has reached its terminal value -+ * of 0x7FF. This is a debug feature that allows software -+ * to read the ramp time after each cycle. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_tmout_int:1; -+ /** ADP Probe Interrupt Mask (ADP_PRB_INT_MSK) -+ * When this bit is set, it unmasks the interrupt due to ADP_PRB_INT. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_prb_int_msk:1; -+ /** ADP Sense Interrupt Mask (ADP_SNS_INT_MSK) -+ * When this bit is set, it unmasks the interrupt due to ADP_SNS_INT. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_sns_int_msk:1; -+ /** ADP Timoeout Interrupt Mask (ADP_TMOUT_MSK) -+ * When this bit is set, it unmasks the interrupt due to ADP_TMOUT_INT. -+ * This bit is valid only if OTG_Ver = 1'b1. -+ */ -+ unsigned adp_tmout_int_msk:1; -+ /** Access Request -+ * 2'b00 - Read/Write Valid (updated by the core) -+ * 2'b01 - Read -+ * 2'b00 - Write -+ * 2'b00 - Reserved -+ */ -+ unsigned ar:2; -+ /** Reserved */ -+ unsigned reserved29_31:3; -+ } b; -+} adpctl_data_t; -+ -+//////////////////////////////////////////// -+// Device Registers -+/** -+ * Device Global Registers. Offsets 800h-BFFh -+ * -+ * The following structures define the size and relative field offsets -+ * for the Device Mode Registers. -+ * -+ * These registers are visible only in Device mode and must not be -+ * accessed in Host mode, as the results are unknown. -+ */ -+typedef struct dwc_otg_dev_global_regs { -+ /** Device Configuration Register. Offset 800h */ -+ volatile uint32_t dcfg; -+ /** Device Control Register. Offset: 804h */ -+ volatile uint32_t dctl; -+ /** Device Status Register (Read Only). Offset: 808h */ -+ volatile uint32_t dsts; -+ /** Reserved. Offset: 80Ch */ -+ uint32_t unused; -+ /** Device IN Endpoint Common Interrupt Mask -+ * Register. Offset: 810h */ -+ volatile uint32_t diepmsk; -+ /** Device OUT Endpoint Common Interrupt Mask -+ * Register. Offset: 814h */ -+ volatile uint32_t doepmsk; -+ /** Device All Endpoints Interrupt Register. Offset: 818h */ -+ volatile uint32_t daint; -+ /** Device All Endpoints Interrupt Mask Register. Offset: -+ * 81Ch */ -+ volatile uint32_t daintmsk; -+ /** Device IN Token Queue Read Register-1 (Read Only). -+ * Offset: 820h */ -+ volatile uint32_t dtknqr1; -+ /** Device IN Token Queue Read Register-2 (Read Only). -+ * Offset: 824h */ -+ volatile uint32_t dtknqr2; -+ /** Device VBUS discharge Register. Offset: 828h */ -+ volatile uint32_t dvbusdis; -+ /** Device VBUS Pulse Register. Offset: 82Ch */ -+ volatile uint32_t dvbuspulse; -+ /** Device IN Token Queue Read Register-3 (Read Only). / -+ * Device Thresholding control register (Read/Write) -+ * Offset: 830h */ -+ volatile uint32_t dtknqr3_dthrctl; -+ /** Device IN Token Queue Read Register-4 (Read Only). / -+ * Device IN EPs empty Inr. Mask Register (Read/Write) -+ * Offset: 834h */ -+ volatile uint32_t dtknqr4_fifoemptymsk; -+ /** Device Each Endpoint Interrupt Register (Read Only). / -+ * Offset: 838h */ -+ volatile uint32_t deachint; -+ /** Device Each Endpoint Interrupt mask Register (Read/Write). / -+ * Offset: 83Ch */ -+ volatile uint32_t deachintmsk; -+ /** Device Each In Endpoint Interrupt mask Register (Read/Write). / -+ * Offset: 840h */ -+ volatile uint32_t diepeachintmsk[MAX_EPS_CHANNELS]; -+ /** Device Each Out Endpoint Interrupt mask Register (Read/Write). / -+ * Offset: 880h */ -+ volatile uint32_t doepeachintmsk[MAX_EPS_CHANNELS]; -+} dwc_otg_device_global_regs_t; -+ -+/** -+ * This union represents the bit fields in the Device Configuration -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. Write the -+ * d32 member to the dcfg register. -+ */ -+typedef union dcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Device Speed */ -+ unsigned devspd:2; -+ /** Non Zero Length Status OUT Handshake */ -+ unsigned nzstsouthshk:1; -+#define DWC_DCFG_SEND_STALL 1 -+ -+ unsigned ena32khzs:1; -+ /** Device Addresses */ -+ unsigned devaddr:7; -+ /** Periodic Frame Interval */ -+ unsigned perfrint:2; -+#define DWC_DCFG_FRAME_INTERVAL_80 0 -+#define DWC_DCFG_FRAME_INTERVAL_85 1 -+#define DWC_DCFG_FRAME_INTERVAL_90 2 -+#define DWC_DCFG_FRAME_INTERVAL_95 3 -+ -+ /** Enable Device OUT NAK for bulk in DDMA mode */ -+ unsigned endevoutnak:1; -+ -+ unsigned reserved14_17:4; -+ /** In Endpoint Mis-match count */ -+ unsigned epmscnt:5; -+ /** Enable Descriptor DMA in Device mode */ -+ unsigned descdma:1; -+ unsigned perschintvl:2; -+ unsigned resvalid:6; -+ } b; -+} dcfg_data_t; -+ -+/** -+ * This union represents the bit fields in the Device Control -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union dctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Remote Wakeup */ -+ unsigned rmtwkupsig:1; -+ /** Soft Disconnect */ -+ unsigned sftdiscon:1; -+ /** Global Non-Periodic IN NAK Status */ -+ unsigned gnpinnaksts:1; -+ /** Global OUT NAK Status */ -+ unsigned goutnaksts:1; -+ /** Test Control */ -+ unsigned tstctl:3; -+ /** Set Global Non-Periodic IN NAK */ -+ unsigned sgnpinnak:1; -+ /** Clear Global Non-Periodic IN NAK */ -+ unsigned cgnpinnak:1; -+ /** Set Global OUT NAK */ -+ unsigned sgoutnak:1; -+ /** Clear Global OUT NAK */ -+ unsigned cgoutnak:1; -+ /** Power-On Programming Done */ -+ unsigned pwronprgdone:1; -+ /** Reserved */ -+ unsigned reserved:1; -+ /** Global Multi Count */ -+ unsigned gmc:2; -+ /** Ignore Frame Number for ISOC EPs */ -+ unsigned ifrmnum:1; -+ /** NAK on Babble */ -+ unsigned nakonbble:1; -+ /** Enable Continue on BNA */ -+ unsigned encontonbna:1; -+ -+ unsigned reserved18_31:14; -+ } b; -+} dctl_data_t; -+ -+/** -+ * This union represents the bit fields in the Device Status -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union dsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Suspend Status */ -+ unsigned suspsts:1; -+ /** Enumerated Speed */ -+ unsigned enumspd:2; -+#define DWC_DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0 -+#define DWC_DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1 -+#define DWC_DSTS_ENUMSPD_LS_PHY_6MHZ 2 -+#define DWC_DSTS_ENUMSPD_FS_PHY_48MHZ 3 -+ /** Erratic Error */ -+ unsigned errticerr:1; -+ unsigned reserved4_7:4; -+ /** Frame or Microframe Number of the received SOF */ -+ unsigned soffn:14; -+ unsigned reserved22_31:10; -+ } b; -+} dsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Device IN EP Interrupt -+ * Register and the Device IN EP Common Mask Register. -+ * -+ * - Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union diepint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer complete mask */ -+ unsigned xfercompl:1; -+ /** Endpoint disable mask */ -+ unsigned epdisabled:1; -+ /** AHB Error mask */ -+ unsigned ahberr:1; -+ /** TimeOUT Handshake mask (non-ISOC EPs) */ -+ unsigned timeout:1; -+ /** IN Token received with TxF Empty mask */ -+ unsigned intktxfemp:1; -+ /** IN Token Received with EP mismatch mask */ -+ unsigned intknepmis:1; -+ /** IN Endpoint NAK Effective mask */ -+ unsigned inepnakeff:1; -+ /** Reserved */ -+ unsigned emptyintr:1; -+ -+ unsigned txfifoundrn:1; -+ -+ /** BNA Interrupt mask */ -+ unsigned bna:1; -+ -+ unsigned reserved10_12:3; -+ /** BNA Interrupt mask */ -+ unsigned nak:1; -+ -+ unsigned reserved14_31:18; -+ } b; -+} diepint_data_t; -+ -+/** -+ * This union represents the bit fields in the Device IN EP -+ * Common/Dedicated Interrupt Mask Register. -+ */ -+typedef union diepint_data diepmsk_data_t; -+ -+/** -+ * This union represents the bit fields in the Device OUT EP Interrupt -+ * Registerand Device OUT EP Common Interrupt Mask Register. -+ * -+ * - Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union doepint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer complete */ -+ unsigned xfercompl:1; -+ /** Endpoint disable */ -+ unsigned epdisabled:1; -+ /** AHB Error */ -+ unsigned ahberr:1; -+ /** Setup Phase Done (contorl EPs) */ -+ unsigned setup:1; -+ /** OUT Token Received when Endpoint Disabled */ -+ unsigned outtknepdis:1; -+ -+ unsigned stsphsercvd:1; -+ /** Back-to-Back SETUP Packets Received */ -+ unsigned back2backsetup:1; -+ -+ unsigned reserved7:1; -+ /** OUT packet Error */ -+ unsigned outpkterr:1; -+ /** BNA Interrupt */ -+ unsigned bna:1; -+ -+ unsigned reserved10:1; -+ /** Packet Drop Status */ -+ unsigned pktdrpsts:1; -+ /** Babble Interrupt */ -+ unsigned babble:1; -+ /** NAK Interrupt */ -+ unsigned nak:1; -+ /** NYET Interrupt */ -+ unsigned nyet:1; -+ /** Bit indicating setup packet received */ -+ unsigned sr:1; -+ -+ unsigned reserved16_31:16; -+ } b; -+} doepint_data_t; -+ -+/** -+ * This union represents the bit fields in the Device OUT EP -+ * Common/Dedicated Interrupt Mask Register. -+ */ -+typedef union doepint_data doepmsk_data_t; -+ -+/** -+ * This union represents the bit fields in the Device All EP Interrupt -+ * and Mask Registers. -+ * - Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union daint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** IN Endpoint bits */ -+ unsigned in:16; -+ /** OUT Endpoint bits */ -+ unsigned out:16; -+ } ep; -+ struct { -+ /** IN Endpoint bits */ -+ unsigned inep0:1; -+ unsigned inep1:1; -+ unsigned inep2:1; -+ unsigned inep3:1; -+ unsigned inep4:1; -+ unsigned inep5:1; -+ unsigned inep6:1; -+ unsigned inep7:1; -+ unsigned inep8:1; -+ unsigned inep9:1; -+ unsigned inep10:1; -+ unsigned inep11:1; -+ unsigned inep12:1; -+ unsigned inep13:1; -+ unsigned inep14:1; -+ unsigned inep15:1; -+ /** OUT Endpoint bits */ -+ unsigned outep0:1; -+ unsigned outep1:1; -+ unsigned outep2:1; -+ unsigned outep3:1; -+ unsigned outep4:1; -+ unsigned outep5:1; -+ unsigned outep6:1; -+ unsigned outep7:1; -+ unsigned outep8:1; -+ unsigned outep9:1; -+ unsigned outep10:1; -+ unsigned outep11:1; -+ unsigned outep12:1; -+ unsigned outep13:1; -+ unsigned outep14:1; -+ unsigned outep15:1; -+ } b; -+} daint_data_t; -+ -+/** -+ * This union represents the bit fields in the Device IN Token Queue -+ * Read Registers. -+ * - Read the register into the d32 member. -+ * - READ-ONLY Register -+ */ -+typedef union dtknq1_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** In Token Queue Write Pointer */ -+ unsigned intknwptr:5; -+ /** Reserved */ -+ unsigned reserved05_06:2; -+ /** write pointer has wrapped. */ -+ unsigned wrap_bit:1; -+ /** EP Numbers of IN Tokens 0 ... 4 */ -+ unsigned epnums0_5:24; -+ } b; -+} dtknq1_data_t; -+ -+/** -+ * This union represents Threshold control Register -+ * - Read and write the register into the d32 member. -+ * - READ-WRITABLE Register -+ */ -+typedef union dthrctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** non ISO Tx Thr. Enable */ -+ unsigned non_iso_thr_en:1; -+ /** ISO Tx Thr. Enable */ -+ unsigned iso_thr_en:1; -+ /** Tx Thr. Length */ -+ unsigned tx_thr_len:9; -+ /** AHB Threshold ratio */ -+ unsigned ahb_thr_ratio:2; -+ /** Reserved */ -+ unsigned reserved13_15:3; -+ /** Rx Thr. Enable */ -+ unsigned rx_thr_en:1; -+ /** Rx Thr. Length */ -+ unsigned rx_thr_len:9; -+ unsigned reserved26:1; -+ /** Arbiter Parking Enable*/ -+ unsigned arbprken:1; -+ /** Reserved */ -+ unsigned reserved28_31:4; -+ } b; -+} dthrctl_data_t; -+ -+/** -+ * Device Logical IN Endpoint-Specific Registers. Offsets -+ * 900h-AFCh -+ * -+ * There will be one set of endpoint registers per logical endpoint -+ * implemented. -+ * -+ * These registers are visible only in Device mode and must not be -+ * accessed in Host mode, as the results are unknown. -+ */ -+typedef struct dwc_otg_dev_in_ep_regs { -+ /** Device IN Endpoint Control Register. Offset:900h + -+ * (ep_num * 20h) + 00h */ -+ volatile uint32_t diepctl; -+ /** Reserved. Offset:900h + (ep_num * 20h) + 04h */ -+ uint32_t reserved04; -+ /** Device IN Endpoint Interrupt Register. Offset:900h + -+ * (ep_num * 20h) + 08h */ -+ volatile uint32_t diepint; -+ /** Reserved. Offset:900h + (ep_num * 20h) + 0Ch */ -+ uint32_t reserved0C; -+ /** Device IN Endpoint Transfer Size -+ * Register. Offset:900h + (ep_num * 20h) + 10h */ -+ volatile uint32_t dieptsiz; -+ /** Device IN Endpoint DMA Address Register. Offset:900h + -+ * (ep_num * 20h) + 14h */ -+ volatile uint32_t diepdma; -+ /** Device IN Endpoint Transmit FIFO Status Register. Offset:900h + -+ * (ep_num * 20h) + 18h */ -+ volatile uint32_t dtxfsts; -+ /** Device IN Endpoint DMA Buffer Register. Offset:900h + -+ * (ep_num * 20h) + 1Ch */ -+ volatile uint32_t diepdmab; -+} dwc_otg_dev_in_ep_regs_t; -+ -+/** -+ * Device Logical OUT Endpoint-Specific Registers. Offsets: -+ * B00h-CFCh -+ * -+ * There will be one set of endpoint registers per logical endpoint -+ * implemented. -+ * -+ * These registers are visible only in Device mode and must not be -+ * accessed in Host mode, as the results are unknown. -+ */ -+typedef struct dwc_otg_dev_out_ep_regs { -+ /** Device OUT Endpoint Control Register. Offset:B00h + -+ * (ep_num * 20h) + 00h */ -+ volatile uint32_t doepctl; -+ /** Reserved. Offset:B00h + (ep_num * 20h) + 04h */ -+ uint32_t reserved04; -+ /** Device OUT Endpoint Interrupt Register. Offset:B00h + -+ * (ep_num * 20h) + 08h */ -+ volatile uint32_t doepint; -+ /** Reserved. Offset:B00h + (ep_num * 20h) + 0Ch */ -+ uint32_t reserved0C; -+ /** Device OUT Endpoint Transfer Size Register. Offset: -+ * B00h + (ep_num * 20h) + 10h */ -+ volatile uint32_t doeptsiz; -+ /** Device OUT Endpoint DMA Address Register. Offset:B00h -+ * + (ep_num * 20h) + 14h */ -+ volatile uint32_t doepdma; -+ /** Reserved. Offset:B00h + * (ep_num * 20h) + 18h */ -+ uint32_t unused; -+ /** Device OUT Endpoint DMA Buffer Register. Offset:B00h -+ * + (ep_num * 20h) + 1Ch */ -+ uint32_t doepdmab; -+} dwc_otg_dev_out_ep_regs_t; -+ -+/** -+ * This union represents the bit fields in the Device EP Control -+ * Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union depctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Maximum Packet Size -+ * IN/OUT EPn -+ * IN/OUT EP0 - 2 bits -+ * 2'b00: 64 Bytes -+ * 2'b01: 32 -+ * 2'b10: 16 -+ * 2'b11: 8 */ -+ unsigned mps:11; -+#define DWC_DEP0CTL_MPS_64 0 -+#define DWC_DEP0CTL_MPS_32 1 -+#define DWC_DEP0CTL_MPS_16 2 -+#define DWC_DEP0CTL_MPS_8 3 -+ -+ /** Next Endpoint -+ * IN EPn/IN EP0 -+ * OUT EPn/OUT EP0 - reserved */ -+ unsigned nextep:4; -+ -+ /** USB Active Endpoint */ -+ unsigned usbactep:1; -+ -+ /** Endpoint DPID (INTR/Bulk IN and OUT endpoints) -+ * This field contains the PID of the packet going to -+ * be received or transmitted on this endpoint. The -+ * application should program the PID of the first -+ * packet going to be received or transmitted on this -+ * endpoint , after the endpoint is -+ * activated. Application use the SetD1PID and -+ * SetD0PID fields of this register to program either -+ * D0 or D1 PID. -+ * -+ * The encoding for this field is -+ * - 0: D0 -+ * - 1: D1 -+ */ -+ unsigned dpid:1; -+ -+ /** NAK Status */ -+ unsigned naksts:1; -+ -+ /** Endpoint Type -+ * 2'b00: Control -+ * 2'b01: Isochronous -+ * 2'b10: Bulk -+ * 2'b11: Interrupt */ -+ unsigned eptype:2; -+ -+ /** Snoop Mode -+ * OUT EPn/OUT EP0 -+ * IN EPn/IN EP0 - reserved */ -+ unsigned snp:1; -+ -+ /** Stall Handshake */ -+ unsigned stall:1; -+ -+ /** Tx Fifo Number -+ * IN EPn/IN EP0 -+ * OUT EPn/OUT EP0 - reserved */ -+ unsigned txfnum:4; -+ -+ /** Clear NAK */ -+ unsigned cnak:1; -+ /** Set NAK */ -+ unsigned snak:1; -+ /** Set DATA0 PID (INTR/Bulk IN and OUT endpoints) -+ * Writing to this field sets the Endpoint DPID (DPID) -+ * field in this register to DATA0. Set Even -+ * (micro)frame (SetEvenFr) (ISO IN and OUT Endpoints) -+ * Writing to this field sets the Even/Odd -+ * (micro)frame (EO_FrNum) field to even (micro) -+ * frame. -+ */ -+ unsigned setd0pid:1; -+ /** Set DATA1 PID (INTR/Bulk IN and OUT endpoints) -+ * Writing to this field sets the Endpoint DPID (DPID) -+ * field in this register to DATA1 Set Odd -+ * (micro)frame (SetOddFr) (ISO IN and OUT Endpoints) -+ * Writing to this field sets the Even/Odd -+ * (micro)frame (EO_FrNum) field to odd (micro) frame. -+ */ -+ unsigned setd1pid:1; -+ -+ /** Endpoint Disable */ -+ unsigned epdis:1; -+ /** Endpoint Enable */ -+ unsigned epena:1; -+ } b; -+} depctl_data_t; -+ -+/** -+ * This union represents the bit fields in the Device EP Transfer -+ * Size Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union deptsiz_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer size */ -+ unsigned xfersize:19; -+/** Max packet count for EP (pow(2,10)-1) */ -+#define MAX_PKT_CNT 1023 -+ /** Packet Count */ -+ unsigned pktcnt:10; -+ /** Multi Count - Periodic IN endpoints */ -+ unsigned mc:2; -+ unsigned reserved:1; -+ } b; -+} deptsiz_data_t; -+ -+/** -+ * This union represents the bit fields in the Device EP 0 Transfer -+ * Size Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union deptsiz0_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer size */ -+ unsigned xfersize:7; -+ /** Reserved */ -+ unsigned reserved7_18:12; -+ /** Packet Count */ -+ unsigned pktcnt:2; -+ /** Reserved */ -+ unsigned reserved21_28:8; -+ /**Setup Packet Count (DOEPTSIZ0 Only) */ -+ unsigned supcnt:2; -+ unsigned reserved31; -+ } b; -+} deptsiz0_data_t; -+ -+///////////////////////////////////////////////// -+// DMA Descriptor Specific Structures -+// -+ -+/** Buffer status definitions */ -+ -+#define BS_HOST_READY 0x0 -+#define BS_DMA_BUSY 0x1 -+#define BS_DMA_DONE 0x2 -+#define BS_HOST_BUSY 0x3 -+ -+/** Receive/Transmit status definitions */ -+ -+#define RTS_SUCCESS 0x0 -+#define RTS_BUFFLUSH 0x1 -+#define RTS_RESERVED 0x2 -+#define RTS_BUFERR 0x3 -+ -+/** -+ * This union represents the bit fields in the DMA Descriptor -+ * status quadlet. Read the quadlet into the d32 member then -+ * set/clear the bits using the bit, b_iso_out and -+ * b_iso_in elements. -+ */ -+typedef union dev_dma_desc_sts { -+ /** raw register data */ -+ uint32_t d32; -+ /** quadlet bits */ -+ struct { -+ /** Received number of bytes */ -+ unsigned bytes:16; -+ /** NAK bit - only for OUT EPs */ -+ unsigned nak:1; -+ unsigned reserved17_22:6; -+ /** Multiple Transfer - only for OUT EPs */ -+ unsigned mtrf:1; -+ /** Setup Packet received - only for OUT EPs */ -+ unsigned sr:1; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** Short Packet */ -+ unsigned sp:1; -+ /** Last */ -+ unsigned l:1; -+ /** Receive Status */ -+ unsigned sts:2; -+ /** Buffer Status */ -+ unsigned bs:2; -+ } b; -+ -+//#ifdef DWC_EN_ISOC -+ /** iso out quadlet bits */ -+ struct { -+ /** Received number of bytes */ -+ unsigned rxbytes:11; -+ -+ unsigned reserved11:1; -+ /** Frame Number */ -+ unsigned framenum:11; -+ /** Received ISO Data PID */ -+ unsigned pid:2; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** Short Packet */ -+ unsigned sp:1; -+ /** Last */ -+ unsigned l:1; -+ /** Receive Status */ -+ unsigned rxsts:2; -+ /** Buffer Status */ -+ unsigned bs:2; -+ } b_iso_out; -+ -+ /** iso in quadlet bits */ -+ struct { -+ /** Transmited number of bytes */ -+ unsigned txbytes:12; -+ /** Frame Number */ -+ unsigned framenum:11; -+ /** Transmited ISO Data PID */ -+ unsigned pid:2; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** Short Packet */ -+ unsigned sp:1; -+ /** Last */ -+ unsigned l:1; -+ /** Transmit Status */ -+ unsigned txsts:2; -+ /** Buffer Status */ -+ unsigned bs:2; -+ } b_iso_in; -+//#endif /* DWC_EN_ISOC */ -+} dev_dma_desc_sts_t; -+ -+/** -+ * DMA Descriptor structure -+ * -+ * DMA Descriptor structure contains two quadlets: -+ * Status quadlet and Data buffer pointer. -+ */ -+typedef struct dwc_otg_dev_dma_desc { -+ /** DMA Descriptor status quadlet */ -+ dev_dma_desc_sts_t status; -+ /** DMA Descriptor data buffer pointer */ -+ uint32_t buf; -+} dwc_otg_dev_dma_desc_t; -+ -+/** -+ * The dwc_otg_dev_if structure contains information needed to manage -+ * the DWC_otg controller acting in device mode. It represents the -+ * programming view of the device-specific aspects of the controller. -+ */ -+typedef struct dwc_otg_dev_if { -+ /** Pointer to device Global registers. -+ * Device Global Registers starting at offset 800h -+ */ -+ dwc_otg_device_global_regs_t *dev_global_regs; -+#define DWC_DEV_GLOBAL_REG_OFFSET 0x800 -+ -+ /** -+ * Device Logical IN Endpoint-Specific Registers 900h-AFCh -+ */ -+ dwc_otg_dev_in_ep_regs_t *in_ep_regs[MAX_EPS_CHANNELS]; -+#define DWC_DEV_IN_EP_REG_OFFSET 0x900 -+#define DWC_EP_REG_OFFSET 0x20 -+ -+ /** Device Logical OUT Endpoint-Specific Registers B00h-CFCh */ -+ dwc_otg_dev_out_ep_regs_t *out_ep_regs[MAX_EPS_CHANNELS]; -+#define DWC_DEV_OUT_EP_REG_OFFSET 0xB00 -+ -+ /* Device configuration information */ -+ uint8_t speed; /**< Device Speed 0: Unknown, 1: LS, 2:FS, 3: HS */ -+ uint8_t num_in_eps; /**< Number # of Tx EP range: 0-15 exept ep0 */ -+ uint8_t num_out_eps; /**< Number # of Rx EP range: 0-15 exept ep 0*/ -+ -+ /** Size of periodic FIFOs (Bytes) */ -+ uint16_t perio_tx_fifo_size[MAX_PERIO_FIFOS]; -+ -+ /** Size of Tx FIFOs (Bytes) */ -+ uint16_t tx_fifo_size[MAX_TX_FIFOS]; -+ -+ /** Thresholding enable flags and length varaiables **/ -+ uint16_t rx_thr_en; -+ uint16_t iso_tx_thr_en; -+ uint16_t non_iso_tx_thr_en; -+ -+ uint16_t rx_thr_length; -+ uint16_t tx_thr_length; -+ -+ /** -+ * Pointers to the DMA Descriptors for EP0 Control -+ * transfers (virtual and physical) -+ */ -+ -+ /** 2 descriptors for SETUP packets */ -+ dwc_dma_t dma_setup_desc_addr[2]; -+ dwc_otg_dev_dma_desc_t *setup_desc_addr[2]; -+ -+ /** Pointer to Descriptor with latest SETUP packet */ -+ dwc_otg_dev_dma_desc_t *psetup; -+ -+ /** Index of current SETUP handler descriptor */ -+ uint32_t setup_desc_index; -+ -+ /** Descriptor for Data In or Status In phases */ -+ dwc_dma_t dma_in_desc_addr; -+ dwc_otg_dev_dma_desc_t *in_desc_addr; -+ -+ /** Descriptor for Data Out or Status Out phases */ -+ dwc_dma_t dma_out_desc_addr; -+ dwc_otg_dev_dma_desc_t *out_desc_addr; -+ -+ /** Setup Packet Detected - if set clear NAK when queueing */ -+ uint32_t spd; -+ /** Isoc ep pointer on which incomplete happens */ -+ void *isoc_ep; -+ -+} dwc_otg_dev_if_t; -+ -+///////////////////////////////////////////////// -+// Host Mode Register Structures -+// -+/** -+ * The Host Global Registers structure defines the size and relative -+ * field offsets for the Host Mode Global Registers. Host Global -+ * Registers offsets 400h-7FFh. -+*/ -+typedef struct dwc_otg_host_global_regs { -+ /** Host Configuration Register. Offset: 400h */ -+ volatile uint32_t hcfg; -+ /** Host Frame Interval Register. Offset: 404h */ -+ volatile uint32_t hfir; -+ /** Host Frame Number / Frame Remaining Register. Offset: 408h */ -+ volatile uint32_t hfnum; -+ /** Reserved. Offset: 40Ch */ -+ uint32_t reserved40C; -+ /** Host Periodic Transmit FIFO/ Queue Status Register. Offset: 410h */ -+ volatile uint32_t hptxsts; -+ /** Host All Channels Interrupt Register. Offset: 414h */ -+ volatile uint32_t haint; -+ /** Host All Channels Interrupt Mask Register. Offset: 418h */ -+ volatile uint32_t haintmsk; -+ /** Host Frame List Base Address Register . Offset: 41Ch */ -+ volatile uint32_t hflbaddr; -+} dwc_otg_host_global_regs_t; -+ -+/** -+ * This union represents the bit fields in the Host Configuration Register. -+ * Read the register into the d32 member then set/clear the bits using -+ * the bit elements. Write the d32 member to the hcfg register. -+ */ -+typedef union hcfg_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** FS/LS Phy Clock Select */ -+ unsigned fslspclksel:2; -+#define DWC_HCFG_30_60_MHZ 0 -+#define DWC_HCFG_48_MHZ 1 -+#define DWC_HCFG_6_MHZ 2 -+ -+ /** FS/LS Only Support */ -+ unsigned fslssupp:1; -+ unsigned reserved3_6:4; -+ /** Enable 32-KHz Suspend Mode */ -+ unsigned ena32khzs:1; -+ /** Resume Validation Periiod */ -+ unsigned resvalid:8; -+ unsigned reserved16_22:7; -+ /** Enable Scatter/gather DMA in Host mode */ -+ unsigned descdma:1; -+ /** Frame List Entries */ -+ unsigned frlisten:2; -+ /** Enable Periodic Scheduling */ -+ unsigned perschedena:1; -+ unsigned reserved27_30:4; -+ unsigned modechtimen:1; -+ } b; -+} hcfg_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Frame Remaing/Number -+ * Register. -+ */ -+typedef union hfir_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned frint:16; -+ unsigned hfirrldctrl:1; -+ unsigned reserved:15; -+ } b; -+} hfir_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Frame Remaing/Number -+ * Register. -+ */ -+typedef union hfnum_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned frnum:16; -+#define DWC_HFNUM_MAX_FRNUM 0x3FFF -+ unsigned frrem:16; -+ } b; -+} hfnum_data_t; -+ -+typedef union hptxsts_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned ptxfspcavail:16; -+ unsigned ptxqspcavail:8; -+ /** Top of the Periodic Transmit Request Queue -+ * - bit 24 - Terminate (last entry for the selected channel) -+ * - bits 26:25 - Token Type -+ * - 2'b00 - Zero length -+ * - 2'b01 - Ping -+ * - 2'b10 - Disable -+ * - bits 30:27 - Channel Number -+ * - bit 31 - Odd/even microframe -+ */ -+ unsigned ptxqtop_terminate:1; -+ unsigned ptxqtop_token:2; -+ unsigned ptxqtop_chnum:4; -+ unsigned ptxqtop_odd:1; -+ } b; -+} hptxsts_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Port Control and Status -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hprt0 register. -+ */ -+typedef union hprt0_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned prtconnsts:1; -+ unsigned prtconndet:1; -+ unsigned prtena:1; -+ unsigned prtenchng:1; -+ unsigned prtovrcurract:1; -+ unsigned prtovrcurrchng:1; -+ unsigned prtres:1; -+ unsigned prtsusp:1; -+ unsigned prtrst:1; -+ unsigned reserved9:1; -+ unsigned prtlnsts:2; -+ unsigned prtpwr:1; -+ unsigned prttstctl:4; -+ unsigned prtspd:2; -+#define DWC_HPRT0_PRTSPD_HIGH_SPEED 0 -+#define DWC_HPRT0_PRTSPD_FULL_SPEED 1 -+#define DWC_HPRT0_PRTSPD_LOW_SPEED 2 -+ unsigned reserved19_31:13; -+ } b; -+} hprt0_data_t; -+ -+/** -+ * This union represents the bit fields in the Host All Interrupt -+ * Register. -+ */ -+typedef union haint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned ch0:1; -+ unsigned ch1:1; -+ unsigned ch2:1; -+ unsigned ch3:1; -+ unsigned ch4:1; -+ unsigned ch5:1; -+ unsigned ch6:1; -+ unsigned ch7:1; -+ unsigned ch8:1; -+ unsigned ch9:1; -+ unsigned ch10:1; -+ unsigned ch11:1; -+ unsigned ch12:1; -+ unsigned ch13:1; -+ unsigned ch14:1; -+ unsigned ch15:1; -+ unsigned reserved:16; -+ } b; -+ -+ struct { -+ unsigned chint:16; -+ unsigned reserved:16; -+ } b2; -+} haint_data_t; -+ -+/** -+ * This union represents the bit fields in the Host All Interrupt -+ * Register. -+ */ -+typedef union haintmsk_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned ch0:1; -+ unsigned ch1:1; -+ unsigned ch2:1; -+ unsigned ch3:1; -+ unsigned ch4:1; -+ unsigned ch5:1; -+ unsigned ch6:1; -+ unsigned ch7:1; -+ unsigned ch8:1; -+ unsigned ch9:1; -+ unsigned ch10:1; -+ unsigned ch11:1; -+ unsigned ch12:1; -+ unsigned ch13:1; -+ unsigned ch14:1; -+ unsigned ch15:1; -+ unsigned reserved:16; -+ } b; -+ -+ struct { -+ unsigned chint:16; -+ unsigned reserved:16; -+ } b2; -+} haintmsk_data_t; -+ -+/** -+ * Host Channel Specific Registers. 500h-5FCh -+ */ -+typedef struct dwc_otg_hc_regs { -+ /** Host Channel 0 Characteristic Register. Offset: 500h + (chan_num * 20h) + 00h */ -+ volatile uint32_t hcchar; -+ /** Host Channel 0 Split Control Register. Offset: 500h + (chan_num * 20h) + 04h */ -+ volatile uint32_t hcsplt; -+ /** Host Channel 0 Interrupt Register. Offset: 500h + (chan_num * 20h) + 08h */ -+ volatile uint32_t hcint; -+ /** Host Channel 0 Interrupt Mask Register. Offset: 500h + (chan_num * 20h) + 0Ch */ -+ volatile uint32_t hcintmsk; -+ /** Host Channel 0 Transfer Size Register. Offset: 500h + (chan_num * 20h) + 10h */ -+ volatile uint32_t hctsiz; -+ /** Host Channel 0 DMA Address Register. Offset: 500h + (chan_num * 20h) + 14h */ -+ volatile uint32_t hcdma; -+ volatile uint32_t reserved; -+ /** Host Channel 0 DMA Buffer Address Register. Offset: 500h + (chan_num * 20h) + 1Ch */ -+ volatile uint32_t hcdmab; -+} dwc_otg_hc_regs_t; -+ -+/** -+ * This union represents the bit fields in the Host Channel Characteristics -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hcchar register. -+ */ -+typedef union hcchar_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Maximum packet size in bytes */ -+ unsigned mps:11; -+ -+ /** Endpoint number */ -+ unsigned epnum:4; -+ -+ /** 0: OUT, 1: IN */ -+ unsigned epdir:1; -+ -+ unsigned reserved:1; -+ -+ /** 0: Full/high speed device, 1: Low speed device */ -+ unsigned lspddev:1; -+ -+ /** 0: Control, 1: Isoc, 2: Bulk, 3: Intr */ -+ unsigned eptype:2; -+ -+ /** Packets per frame for periodic transfers. 0 is reserved. */ -+ unsigned multicnt:2; -+ -+ /** Device address */ -+ unsigned devaddr:7; -+ -+ /** -+ * Frame to transmit periodic transaction. -+ * 0: even, 1: odd -+ */ -+ unsigned oddfrm:1; -+ -+ /** Channel disable */ -+ unsigned chdis:1; -+ -+ /** Channel enable */ -+ unsigned chen:1; -+ } b; -+} hcchar_data_t; -+ -+typedef union hcsplt_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Port Address */ -+ unsigned prtaddr:7; -+ -+ /** Hub Address */ -+ unsigned hubaddr:7; -+ -+ /** Transaction Position */ -+ unsigned xactpos:2; -+#define DWC_HCSPLIT_XACTPOS_MID 0 -+#define DWC_HCSPLIT_XACTPOS_END 1 -+#define DWC_HCSPLIT_XACTPOS_BEGIN 2 -+#define DWC_HCSPLIT_XACTPOS_ALL 3 -+ -+ /** Do Complete Split */ -+ unsigned compsplt:1; -+ -+ /** Reserved */ -+ unsigned reserved:14; -+ -+ /** Split Enble */ -+ unsigned spltena:1; -+ } b; -+} hcsplt_data_t; -+ -+/** -+ * This union represents the bit fields in the Host All Interrupt -+ * Register. -+ */ -+typedef union hcint_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** Transfer Complete */ -+ unsigned xfercomp:1; -+ /** Channel Halted */ -+ unsigned chhltd:1; -+ /** AHB Error */ -+ unsigned ahberr:1; -+ /** STALL Response Received */ -+ unsigned stall:1; -+ /** NAK Response Received */ -+ unsigned nak:1; -+ /** ACK Response Received */ -+ unsigned ack:1; -+ /** NYET Response Received */ -+ unsigned nyet:1; -+ /** Transaction Err */ -+ unsigned xacterr:1; -+ /** Babble Error */ -+ unsigned bblerr:1; -+ /** Frame Overrun */ -+ unsigned frmovrun:1; -+ /** Data Toggle Error */ -+ unsigned datatglerr:1; -+ /** Buffer Not Available (only for DDMA mode) */ -+ unsigned bna:1; -+ /** Exessive transaction error (only for DDMA mode) */ -+ unsigned xcs_xact:1; -+ /** Frame List Rollover interrupt */ -+ unsigned frm_list_roll:1; -+ /** Reserved */ -+ unsigned reserved14_31:18; -+ } b; -+} hcint_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Channel Interrupt Mask -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hcintmsk register. -+ */ -+typedef union hcintmsk_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ unsigned xfercompl:1; -+ unsigned chhltd:1; -+ unsigned ahberr:1; -+ unsigned stall:1; -+ unsigned nak:1; -+ unsigned ack:1; -+ unsigned nyet:1; -+ unsigned xacterr:1; -+ unsigned bblerr:1; -+ unsigned frmovrun:1; -+ unsigned datatglerr:1; -+ unsigned bna:1; -+ unsigned xcs_xact:1; -+ unsigned frm_list_roll:1; -+ unsigned reserved14_31:18; -+ } b; -+} hcintmsk_data_t; -+ -+/** -+ * This union represents the bit fields in the Host Channel Transfer Size -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. Write the d32 member to the -+ * hcchar register. -+ */ -+ -+typedef union hctsiz_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Total transfer size in bytes */ -+ unsigned xfersize:19; -+ -+ /** Data packets to transfer */ -+ unsigned pktcnt:10; -+ -+ /** -+ * Packet ID for next data packet -+ * 0: DATA0 -+ * 1: DATA2 -+ * 2: DATA1 -+ * 3: MDATA (non-Control), SETUP (Control) -+ */ -+ unsigned pid:2; -+#define DWC_HCTSIZ_DATA0 0 -+#define DWC_HCTSIZ_DATA1 2 -+#define DWC_HCTSIZ_DATA2 1 -+#define DWC_HCTSIZ_MDATA 3 -+#define DWC_HCTSIZ_SETUP 3 -+ -+ /** Do PING protocol when 1 */ -+ unsigned dopng:1; -+ } b; -+ -+ /** register bits */ -+ struct { -+ /** Scheduling information */ -+ unsigned schinfo:8; -+ -+ /** Number of transfer descriptors. -+ * Max value: -+ * 64 in general, -+ * 256 only for HS isochronous endpoint. -+ */ -+ unsigned ntd:8; -+ -+ /** Data packets to transfer */ -+ unsigned reserved16_28:13; -+ -+ /** -+ * Packet ID for next data packet -+ * 0: DATA0 -+ * 1: DATA2 -+ * 2: DATA1 -+ * 3: MDATA (non-Control) -+ */ -+ unsigned pid:2; -+ -+ /** Do PING protocol when 1 */ -+ unsigned dopng:1; -+ } b_ddma; -+} hctsiz_data_t; -+ -+/** -+ * This union represents the bit fields in the Host DMA Address -+ * Register used in Descriptor DMA mode. -+ */ -+typedef union hcdma_data { -+ /** raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ unsigned reserved0_2:3; -+ /** Current Transfer Descriptor. Not used for ISOC */ -+ unsigned ctd:8; -+ /** Start Address of Descriptor List */ -+ unsigned dma_addr:21; -+ } b; -+} hcdma_data_t; -+ -+/** -+ * This union represents the bit fields in the DMA Descriptor -+ * status quadlet for host mode. Read the quadlet into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union host_dma_desc_sts { -+ /** raw register data */ -+ uint32_t d32; -+ /** quadlet bits */ -+ -+ /* for non-isochronous */ -+ struct { -+ /** Number of bytes */ -+ unsigned n_bytes:17; -+ /** QTD offset to jump when Short Packet received - only for IN EPs */ -+ unsigned qtd_offset:6; -+ /** -+ * Set to request the core to jump to alternate QTD if -+ * Short Packet received - only for IN EPs -+ */ -+ unsigned a_qtd:1; -+ /** -+ * Setup Packet bit. When set indicates that buffer contains -+ * setup packet. -+ */ -+ unsigned sup:1; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ /** End of List */ -+ unsigned eol:1; -+ unsigned reserved27:1; -+ /** Rx/Tx Status */ -+ unsigned sts:2; -+#define DMA_DESC_STS_PKTERR 1 -+ unsigned reserved30:1; -+ /** Active Bit */ -+ unsigned a:1; -+ } b; -+ /* for isochronous */ -+ struct { -+ /** Number of bytes */ -+ unsigned n_bytes:12; -+ unsigned reserved12_24:13; -+ /** Interrupt On Complete */ -+ unsigned ioc:1; -+ unsigned reserved26_27:2; -+ /** Rx/Tx Status */ -+ unsigned sts:2; -+ unsigned reserved30:1; -+ /** Active Bit */ -+ unsigned a:1; -+ } b_isoc; -+} host_dma_desc_sts_t; -+ -+#define MAX_DMA_DESC_SIZE 131071 -+#define MAX_DMA_DESC_NUM_GENERIC 64 -+#define MAX_DMA_DESC_NUM_HS_ISOC 256 -+#define MAX_FRLIST_EN_NUM 64 -+/** -+ * Host-mode DMA Descriptor structure -+ * -+ * DMA Descriptor structure contains two quadlets: -+ * Status quadlet and Data buffer pointer. -+ */ -+typedef struct dwc_otg_host_dma_desc { -+ /** DMA Descriptor status quadlet */ -+ host_dma_desc_sts_t status; -+ /** DMA Descriptor data buffer pointer */ -+ uint32_t buf; -+} dwc_otg_host_dma_desc_t; -+ -+/** OTG Host Interface Structure. -+ * -+ * The OTG Host Interface Structure structure contains information -+ * needed to manage the DWC_otg controller acting in host mode. It -+ * represents the programming view of the host-specific aspects of the -+ * controller. -+ */ -+typedef struct dwc_otg_host_if { -+ /** Host Global Registers starting at offset 400h.*/ -+ dwc_otg_host_global_regs_t *host_global_regs; -+#define DWC_OTG_HOST_GLOBAL_REG_OFFSET 0x400 -+ -+ /** Host Port 0 Control and Status Register */ -+ volatile uint32_t *hprt0; -+#define DWC_OTG_HOST_PORT_REGS_OFFSET 0x440 -+ -+ /** Host Channel Specific Registers at offsets 500h-5FCh. */ -+ dwc_otg_hc_regs_t *hc_regs[MAX_EPS_CHANNELS]; -+#define DWC_OTG_HOST_CHAN_REGS_OFFSET 0x500 -+#define DWC_OTG_CHAN_REGS_OFFSET 0x20 -+ -+ /* Host configuration information */ -+ /** Number of Host Channels (range: 1-16) */ -+ uint8_t num_host_channels; -+ /** Periodic EPs supported (0: no, 1: yes) */ -+ uint8_t perio_eps_supported; -+ /** Periodic Tx FIFO Size (Only 1 host periodic Tx FIFO) */ -+ uint16_t perio_tx_fifo_size; -+ -+} dwc_otg_host_if_t; -+ -+/** -+ * This union represents the bit fields in the Power and Clock Gating Control -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union pcgcctl_data { -+ /** raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** Stop Pclk */ -+ unsigned stoppclk:1; -+ /** Gate Hclk */ -+ unsigned gatehclk:1; -+ /** Power Clamp */ -+ unsigned pwrclmp:1; -+ /** Reset Power Down Modules */ -+ unsigned rstpdwnmodule:1; -+ /** Reserved */ -+ unsigned reserved:1; -+ /** Enable Sleep Clock Gating (Enbl_L1Gating) */ -+ unsigned enbl_sleep_gating:1; -+ /** PHY In Sleep (PhySleep) */ -+ unsigned phy_in_sleep:1; -+ /** Deep Sleep*/ -+ unsigned deep_sleep:1; -+ unsigned resetaftsusp:1; -+ unsigned restoremode:1; -+ unsigned enbl_extnd_hiber:1; -+ unsigned extnd_hiber_pwrclmp:1; -+ unsigned extnd_hiber_switch:1; -+ unsigned ess_reg_restored:1; -+ unsigned prt_clk_sel:2; -+ unsigned port_power:1; -+ unsigned max_xcvrselect:2; -+ unsigned max_termsel:1; -+ unsigned mac_dev_addr:7; -+ unsigned p2hd_dev_enum_spd:2; -+ unsigned p2hd_prt_spd:2; -+ unsigned if_dev_mode:1; -+ } b; -+} pcgcctl_data_t; -+ -+/** -+ * This union represents the bit fields in the Global Data FIFO Software -+ * Configuration Register. Read the register into the d32 member then -+ * set/clear the bits using the bit elements. -+ */ -+typedef union gdfifocfg_data { -+ /* raw register data */ -+ uint32_t d32; -+ /** register bits */ -+ struct { -+ /** OTG Data FIFO depth */ -+ unsigned gdfifocfg:16; -+ /** Start address of EP info controller */ -+ unsigned epinfobase:16; -+ } b; -+} gdfifocfg_data_t; -+ -+/** -+ * This union represents the bit fields in the Global Power Down Register -+ * Register. Read the register into the d32 member then set/clear the -+ * bits using the bit elements. -+ */ -+typedef union gpwrdn_data { -+ /* raw register data */ -+ uint32_t d32; -+ -+ /** register bits */ -+ struct { -+ /** PMU Interrupt Select */ -+ unsigned pmuintsel:1; -+ /** PMU Active */ -+ unsigned pmuactv:1; -+ /** Restore */ -+ unsigned restore:1; -+ /** Power Down Clamp */ -+ unsigned pwrdnclmp:1; -+ /** Power Down Reset */ -+ unsigned pwrdnrstn:1; -+ /** Power Down Switch */ -+ unsigned pwrdnswtch:1; -+ /** Disable VBUS */ -+ unsigned dis_vbus:1; -+ /** Line State Change */ -+ unsigned lnstschng:1; -+ /** Line state change mask */ -+ unsigned lnstchng_msk:1; -+ /** Reset Detected */ -+ unsigned rst_det:1; -+ /** Reset Detect mask */ -+ unsigned rst_det_msk:1; -+ /** Disconnect Detected */ -+ unsigned disconn_det:1; -+ /** Disconnect Detect mask */ -+ unsigned disconn_det_msk:1; -+ /** Connect Detected*/ -+ unsigned connect_det:1; -+ /** Connect Detected Mask*/ -+ unsigned connect_det_msk:1; -+ /** SRP Detected */ -+ unsigned srp_det:1; -+ /** SRP Detect mask */ -+ unsigned srp_det_msk:1; -+ /** Status Change Interrupt */ -+ unsigned sts_chngint:1; -+ /** Status Change Interrupt Mask */ -+ unsigned sts_chngint_msk:1; -+ /** Line State */ -+ unsigned linestate:2; -+ /** Indicates current mode(status of IDDIG signal) */ -+ unsigned idsts:1; -+ /** B Session Valid signal status*/ -+ unsigned bsessvld:1; -+ /** ADP Event Detected */ -+ unsigned adp_int:1; -+ /** Multi Valued ID pin */ -+ unsigned mult_val_id_bc:5; -+ /** Reserved 24_31 */ -+ unsigned reserved29_31:3; -+ } b; -+} gpwrdn_data_t; -+ -+#endif -diff --git a/drivers/usb/host/dwc_otg/test/Makefile b/drivers/usb/host/dwc_otg/test/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..fc453759dea3e88b8f79a1a151bbcaab7e242899 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/Makefile -@@ -0,0 +1,16 @@ -+ -+PERL=/usr/bin/perl -+PL_TESTS=test_sysfs.pl test_mod_param.pl -+ -+.PHONY : test -+test : perl_tests -+ -+perl_tests : -+ @echo -+ @echo Running perl tests -+ @for test in $(PL_TESTS); do \ -+ if $(PERL) ./$$test ; then \ -+ echo "=======> $$test, PASSED" ; \ -+ else echo "=======> $$test, FAILED" ; \ -+ fi \ -+ done -diff --git a/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm -new file mode 100644 -index 0000000000000000000000000000000000000000..85e55fd6ddbc78051d65a11125d4265aea6c24e3 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm -@@ -0,0 +1,337 @@ -+package dwc_otg_test; -+ -+use strict; -+use Exporter (); -+ -+use vars qw(@ISA @EXPORT -+$sysfsdir $paramdir $errors $params -+); -+ -+@ISA = qw(Exporter); -+ -+# -+# Globals -+# -+$sysfsdir = "/sys/devices/lm0"; -+$paramdir = "/sys/module/dwc_otg"; -+$errors = 0; -+ -+$params = [ -+ { -+ NAME => "otg_cap", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 2 -+ }, -+ { -+ NAME => "dma_enable", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "dma_burst_size", -+ DEFAULT => 32, -+ ENUM => [1, 4, 8, 16, 32, 64, 128, 256], -+ LOW => 1, -+ HIGH => 256 -+ }, -+ { -+ NAME => "host_speed", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "host_support_fs_ls_low_power", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "host_ls_low_power_phy_clk", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "dev_speed", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "enable_dynamic_fifo", -+ DEFAULT => 1, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ { -+ NAME => "data_fifo_size", -+ DEFAULT => 8192, -+ ENUM => [], -+ LOW => 32, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "dev_rx_fifo_size", -+ DEFAULT => 1064, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "dev_nperio_tx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_1", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_2", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_3", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_4", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_5", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_6", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_7", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_8", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_9", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_10", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_11", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_12", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_13", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_14", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "dev_perio_tx_fifo_size_15", -+ DEFAULT => 256, -+ ENUM => [], -+ LOW => 4, -+ HIGH => 768 -+ }, -+ { -+ NAME => "host_rx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "host_nperio_tx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "host_perio_tx_fifo_size", -+ DEFAULT => 1024, -+ ENUM => [], -+ LOW => 16, -+ HIGH => 32768 -+ }, -+ { -+ NAME => "max_transfer_size", -+ DEFAULT => 65535, -+ ENUM => [], -+ LOW => 2047, -+ HIGH => 65535 -+ }, -+ { -+ NAME => "max_packet_count", -+ DEFAULT => 511, -+ ENUM => [], -+ LOW => 15, -+ HIGH => 511 -+ }, -+ { -+ NAME => "host_channels", -+ DEFAULT => 12, -+ ENUM => [], -+ LOW => 1, -+ HIGH => 16 -+ }, -+ { -+ NAME => "dev_endpoints", -+ DEFAULT => 6, -+ ENUM => [], -+ LOW => 1, -+ HIGH => 15 -+ }, -+ { -+ NAME => "phy_type", -+ DEFAULT => 1, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 2 -+ }, -+ { -+ NAME => "phy_utmi_width", -+ DEFAULT => 16, -+ ENUM => [8, 16], -+ LOW => 8, -+ HIGH => 16 -+ }, -+ { -+ NAME => "phy_ulpi_ddr", -+ DEFAULT => 0, -+ ENUM => [], -+ LOW => 0, -+ HIGH => 1 -+ }, -+ ]; -+ -+ -+# -+# -+sub check_arch { -+ $_ = `uname -m`; -+ chomp; -+ unless (m/armv4tl/) { -+ warn "# \n# Can't execute on $_. Run on integrator platform.\n# \n"; -+ return 0; -+ } -+ return 1; -+} -+ -+# -+# -+sub load_module { -+ my $params = shift; -+ print "\nRemoving Module\n"; -+ system "rmmod dwc_otg"; -+ print "Loading Module\n"; -+ if ($params ne "") { -+ print "Module Parameters: $params\n"; -+ } -+ if (system("modprobe dwc_otg $params")) { -+ warn "Unable to load module\n"; -+ return 0; -+ } -+ return 1; -+} -+ -+# -+# -+sub test_status { -+ my $arg = shift; -+ -+ print "\n"; -+ -+ if (defined $arg) { -+ warn "WARNING: $arg\n"; -+ } -+ -+ if ($errors > 0) { -+ warn "TEST FAILED with $errors errors\n"; -+ return 0; -+ } else { -+ print "TEST PASSED\n"; -+ return 0 if (defined $arg); -+ } -+ return 1; -+} -+ -+# -+# -+@EXPORT = qw( -+$sysfsdir -+$paramdir -+$params -+$errors -+check_arch -+load_module -+test_status -+); -+ -+1; -diff --git a/drivers/usb/host/dwc_otg/test/test_mod_param.pl b/drivers/usb/host/dwc_otg/test/test_mod_param.pl -new file mode 100644 -index 0000000000000000000000000000000000000000..dc3820df577bae2c51bc2b1cef57ac9c4fdfc6e5 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/test_mod_param.pl -@@ -0,0 +1,133 @@ -+#!/usr/bin/perl -w -+# -+# Run this program on the integrator. -+# -+# - Tests module parameter default values. -+# - Tests setting of valid module parameter values via modprobe. -+# - Tests invalid module parameter values. -+# ----------------------------------------------------------------------------- -+use strict; -+use dwc_otg_test; -+ -+check_arch() or die; -+ -+# -+# -+sub test { -+ my ($param,$expected) = @_; -+ my $value = get($param); -+ -+ if ($value == $expected) { -+ print "$param = $value, okay\n"; -+ } -+ -+ else { -+ warn "ERROR: value of $param != $expected, $value\n"; -+ $errors ++; -+ } -+} -+ -+# -+# -+sub get { -+ my $param = shift; -+ my $tmp = `cat $paramdir/$param`; -+ chomp $tmp; -+ return $tmp; -+} -+ -+# -+# -+sub test_main { -+ -+ print "\nTesting Module Parameters\n"; -+ -+ load_module("") or die; -+ -+ # Test initial values -+ print "\nTesting Default Values\n"; -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ -+ # Test low value -+ print "\nTesting Low Value\n"; -+ my $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . "$_->{NAME}=$_->{LOW} "; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{LOW}); -+ } -+ -+ # Test high value -+ print "\nTesting High Value\n"; -+ $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . "$_->{NAME}=$_->{HIGH} "; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{HIGH}); -+ } -+ -+ # Test Enum -+ print "\nTesting Enumerated\n"; -+ foreach (@{$params}) { -+ if (defined $_->{ENUM}) { -+ my $value; -+ foreach $value (@{$_->{ENUM}}) { -+ $cmd_params = "$_->{NAME}=$value"; -+ load_module($cmd_params) or die; -+ test ($_->{NAME}, $value); -+ } -+ } -+ } -+ -+ # Test Invalid Values -+ print "\nTesting Invalid Values\n"; -+ $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{LOW}-1; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ -+ $cmd_params = ""; -+ foreach (@{$params}) { -+ $cmd_params = $cmd_params . sprintf "$_->{NAME}=%d ", $_->{HIGH}+1; -+ } -+ load_module($cmd_params) or die; -+ -+ foreach (@{$params}) { -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ -+ print "\nTesting Enumerated\n"; -+ foreach (@{$params}) { -+ if (defined $_->{ENUM}) { -+ my $value; -+ foreach $value (@{$_->{ENUM}}) { -+ $value = $value + 1; -+ $cmd_params = "$_->{NAME}=$value"; -+ load_module($cmd_params) or die; -+ test ($_->{NAME}, $_->{DEFAULT}); -+ $value = $value - 2; -+ $cmd_params = "$_->{NAME}=$value"; -+ load_module($cmd_params) or die; -+ test ($_->{NAME}, $_->{DEFAULT}); -+ } -+ } -+ } -+ -+ test_status() or die; -+} -+ -+test_main(); -+0; -diff --git a/drivers/usb/host/dwc_otg/test/test_sysfs.pl b/drivers/usb/host/dwc_otg/test/test_sysfs.pl -new file mode 100644 -index 0000000000000000000000000000000000000000..cdc9963176e5a4a0d5250613b61e26c578d7130a ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/test_sysfs.pl -@@ -0,0 +1,193 @@ -+#!/usr/bin/perl -w -+# -+# Run this program on the integrator -+# - Tests select sysfs attributes. -+# - Todo ... test more attributes, hnp/srp, buspower/bussuspend, etc. -+# ----------------------------------------------------------------------------- -+use strict; -+use dwc_otg_test; -+ -+check_arch() or die; -+ -+# -+# -+sub test { -+ my ($attr,$expected) = @_; -+ my $string = get($attr); -+ -+ if ($string eq $expected) { -+ printf("$attr = $string, okay\n"); -+ } -+ else { -+ warn "ERROR: value of $attr != $expected, $string\n"; -+ $errors ++; -+ } -+} -+ -+# -+# -+sub set { -+ my ($reg, $value) = @_; -+ system "echo $value > $sysfsdir/$reg"; -+} -+ -+# -+# -+sub get { -+ my $attr = shift; -+ my $string = `cat $sysfsdir/$attr`; -+ chomp $string; -+ if ($string =~ m/\s\=\s/) { -+ my $tmp; -+ ($tmp, $string) = split /\s=\s/, $string; -+ } -+ return $string; -+} -+ -+# -+# -+sub test_main { -+ print("\nTesting Sysfs Attributes\n"); -+ -+ load_module("") or die; -+ -+ # Test initial values of regoffset/regvalue/guid/gsnpsid -+ print("\nTesting Default Values\n"); -+ -+ test("regoffset", "0xffffffff"); -+ test("regvalue", "invalid offset"); -+ test("guid", "0x12345678"); # this will fail if it has been changed -+ test("gsnpsid", "0x4f54200a"); -+ -+ # Test operation of regoffset/regvalue -+ print("\nTesting regoffset\n"); -+ set('regoffset', '5a5a5a5a'); -+ test("regoffset", "0xffffffff"); -+ -+ set('regoffset', '0'); -+ test("regoffset", "0x00000000"); -+ -+ set('regoffset', '40000'); -+ test("regoffset", "0x00000000"); -+ -+ set('regoffset', '3ffff'); -+ test("regoffset", "0x0003ffff"); -+ -+ set('regoffset', '1'); -+ test("regoffset", "0x00000001"); -+ -+ print("\nTesting regvalue\n"); -+ set('regoffset', '3c'); -+ test("regvalue", "0x12345678"); -+ set('regvalue', '5a5a5a5a'); -+ test("regvalue", "0x5a5a5a5a"); -+ set('regvalue','a5a5a5a5'); -+ test("regvalue", "0xa5a5a5a5"); -+ set('guid','12345678'); -+ -+ # Test HNP Capable -+ print("\nTesting HNP Capable bit\n"); -+ set('hnpcapable', '1'); -+ test("hnpcapable", "0x1"); -+ set('hnpcapable','0'); -+ test("hnpcapable", "0x0"); -+ -+ set('regoffset','0c'); -+ -+ my $old = get('gusbcfg'); -+ print("setting hnpcapable\n"); -+ set('hnpcapable', '1'); -+ test("hnpcapable", "0x1"); -+ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<9))); -+ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<9))); -+ -+ $old = get('gusbcfg'); -+ print("clearing hnpcapable\n"); -+ set('hnpcapable', '0'); -+ test("hnpcapable", "0x0"); -+ test ('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<9))); -+ test ('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<9))); -+ -+ # Test SRP Capable -+ print("\nTesting SRP Capable bit\n"); -+ set('srpcapable', '1'); -+ test("srpcapable", "0x1"); -+ set('srpcapable','0'); -+ test("srpcapable", "0x0"); -+ -+ set('regoffset','0c'); -+ -+ $old = get('gusbcfg'); -+ print("setting srpcapable\n"); -+ set('srpcapable', '1'); -+ test("srpcapable", "0x1"); -+ test('gusbcfg', sprintf "0x%08x", (oct ($old) | (1<<8))); -+ test('regvalue', sprintf "0x%08x", (oct ($old) | (1<<8))); -+ -+ $old = get('gusbcfg'); -+ print("clearing srpcapable\n"); -+ set('srpcapable', '0'); -+ test("srpcapable", "0x0"); -+ test('gusbcfg', sprintf "0x%08x", oct ($old) & (~(1<<8))); -+ test('regvalue', sprintf "0x%08x", oct ($old) & (~(1<<8))); -+ -+ # Test GGPIO -+ print("\nTesting GGPIO\n"); -+ set('ggpio','5a5a5a5a'); -+ test('ggpio','0x5a5a0000'); -+ set('ggpio','a5a5a5a5'); -+ test('ggpio','0xa5a50000'); -+ set('ggpio','11110000'); -+ test('ggpio','0x11110000'); -+ set('ggpio','00001111'); -+ test('ggpio','0x00000000'); -+ -+ # Test DEVSPEED -+ print("\nTesting DEVSPEED\n"); -+ set('regoffset','800'); -+ $old = get('regvalue'); -+ set('devspeed','0'); -+ test('devspeed','0x0'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); -+ set('devspeed','1'); -+ test('devspeed','0x1'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); -+ set('devspeed','2'); -+ test('devspeed','0x2'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 2)); -+ set('devspeed','3'); -+ test('devspeed','0x3'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 3)); -+ set('devspeed','4'); -+ test('devspeed','0x0'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3))); -+ set('devspeed','5'); -+ test('devspeed','0x1'); -+ test('regvalue',sprintf("0x%08x", oct($old) & ~(0x3) | 1)); -+ -+ -+ # mode Returns the current mode:0 for device mode1 for host mode Read -+ # hnp Initiate the Host Negotiation Protocol. Read returns the status. Read/Write -+ # srp Initiate the Session Request Protocol. Read returns the status. Read/Write -+ # buspower Get or Set the Power State of the bus (0 - Off or 1 - On) Read/Write -+ # bussuspend Suspend the USB bus. Read/Write -+ # busconnected Get the connection status of the bus Read -+ -+ # gotgctl Get or set the Core Control Status Register. Read/Write -+ ## gusbcfg Get or set the Core USB Configuration Register Read/Write -+ # grxfsiz Get or set the Receive FIFO Size Register Read/Write -+ # gnptxfsiz Get or set the non-periodic Transmit Size Register Read/Write -+ # gpvndctl Get or set the PHY Vendor Control Register Read/Write -+ ## ggpio Get the value in the lower 16-bits of the General Purpose IO Register or Set the upper 16 bits. Read/Write -+ ## guid Get or set the value of the User ID Register Read/Write -+ ## gsnpsid Get the value of the Synopsys ID Regester Read -+ ## devspeed Get or set the device speed setting in the DCFG register Read/Write -+ # enumspeed Gets the device enumeration Speed. Read -+ # hptxfsiz Get the value of the Host Periodic Transmit FIFO Read -+ # hprt0 Get or Set the value in the Host Port Control and Status Register Read/Write -+ -+ test_status("TEST NYI") or die; -+} -+ -+test_main(); -+0; - -From 990bd0f738984c3582e6dbba14a1826ea28f9fb6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 032/122] bcm2708 framebuffer driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -bcm2708_fb : Implement blanking support using the mailbox property interface - -bcm2708_fb: Add pan and vsync controls - -bcm2708_fb: DMA acceleration for fb_copyarea - -Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425 -Also used Simon's dmaer_master module as a reference for tweaking DMA -settings for better performance. - -For now busylooping only. IRQ support might be added later. -With non-overclocked Raspberry Pi, the performance is ~360 MB/s -for simple copy or ~260 MB/s for two-pass copy (used when dragging -windows to the right). - -In the case of using DMA channel 0, the performance improves -to ~440 MB/s. - -For comparison, VFP optimized CPU copy can only do ~114 MB/s in -the same conditions (hindered by reading uncached source buffer). - -Signed-off-by: Siarhei Siamashka - -bcm2708_fb: report number of dma copies - -Add a counter (exported via debugfs) reporting the -number of dma copies that the framebuffer driver -has done, in order to help evaluate different -optimization strategies. - -Signed-off-by: Luke Diamand - -bcm2708_fb: use IRQ for DMA copies - -The copyarea ioctl() uses DMA to speed things along. This -was busy-waiting for completion. This change supports using -an interrupt instead for larger transfers. For small -transfers, busy-waiting is still likely to be faster. - -Signed-off-by: Luke Diamand - -bcm2708: Make ioctl logging quieter - -video: fbdev: bcm2708_fb: Don't panic on error - -No need to panic the kernel if the video driver fails. -Just print a message and return an error. - -Signed-off-by: Noralf Trønnes - -fbdev: bcm2708_fb: Add ARCH_BCM2835 support - -Add Device Tree support. -Pass the device to dma_alloc_coherent() in order to get the -correct bus address on ARCH_BCM2835. -Use the new DMA legacy API header file. -Including is not necessary. - -Signed-off-by: Noralf Trønnes - -BCM270x_DT: Add bcm2708-fb device - -Add bcm2708-fb to Device Tree and don't add the -platform device when booting in DT mode. - -Signed-off-by: Noralf Trønnes ---- - drivers/video/fbdev/Kconfig | 14 + - drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/bcm2708_fb.c | 844 ++++++++++ - drivers/video/logo/logo_linux_clut224.ppm | 2483 ++++++++++------------------- - 4 files changed, 1740 insertions(+), 1602 deletions(-) - create mode 100644 drivers/video/fbdev/bcm2708_fb.c - -diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index 5d3b0db5ce0af34997a3aa748292b6bd8d48c191..0ff4f80531e013f028ca4d05559c5464f8cfa5ef 100644 ---- a/drivers/video/fbdev/Kconfig -+++ b/drivers/video/fbdev/Kconfig -@@ -228,6 +228,20 @@ config FB_TILEBLITTING - comment "Frame buffer hardware drivers" - depends on FB - -+config FB_BCM2708 -+ tristate "BCM2708 framebuffer support" -+ depends on FB && RASPBERRYPI_FIRMWARE -+ select FB_CFB_FILLRECT -+ select FB_CFB_COPYAREA -+ select FB_CFB_IMAGEBLIT -+ help -+ This framebuffer device driver is for the BCM2708 framebuffer. -+ -+ If you want to compile this as a module (=code which can be -+ inserted into and removed from the running kernel), say M -+ here and read . The module -+ will be called bcm2708_fb. -+ - config FB_GRVGA - tristate "Aeroflex Gaisler framebuffer support" - depends on FB && SPARC -diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index ee8c81405a7f9af1f190c98ddcfa53666ad97b0f..8cd1193b98690b9c4f49098ab14389504d65af3a 100644 ---- a/drivers/video/fbdev/Makefile -+++ b/drivers/video/fbdev/Makefile -@@ -10,6 +10,7 @@ obj-$(CONFIG_FB_MACMODES) += macmodes.o - obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o - - # Hardware specific drivers go first -+obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o - obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o - obj-$(CONFIG_FB_ARC) += arcfb.o - obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o -diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c -new file mode 100644 -index 0000000000000000000000000000000000000000..37f60813fe1dd95d9f5f725c07ec2e75c09857bf ---- /dev/null -+++ b/drivers/video/fbdev/bcm2708_fb.c -@@ -0,0 +1,844 @@ -+/* -+ * linux/drivers/video/bcm2708_fb.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Broadcom simple framebuffer driver -+ * -+ * This file is derived from cirrusfb.c -+ * Copyright 1999-2001 Jeff Garzik -+ * -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+//#define BCM2708_FB_DEBUG -+#define MODULE_NAME "bcm2708_fb" -+ -+#ifdef BCM2708_FB_DEBUG -+#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) -+#else -+#define print_debug(fmt,...) -+#endif -+ -+/* This is limited to 16 characters when displayed by X startup */ -+static const char *bcm2708_name = "BCM2708 FB"; -+ -+#define DRIVER_NAME "bcm2708_fb" -+ -+static int fbwidth = 800; /* module parameter */ -+static int fbheight = 480; /* module parameter */ -+static int fbdepth = 32; /* module parameter */ -+static int fbswap = 0; /* module parameter */ -+ -+static u32 dma_busy_wait_threshold = 1<<15; -+module_param(dma_busy_wait_threshold, int, 0644); -+MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area"); -+ -+struct fb_alloc_tags { -+ struct rpi_firmware_property_tag_header tag1; -+ u32 xres, yres; -+ struct rpi_firmware_property_tag_header tag2; -+ u32 xres_virtual, yres_virtual; -+ struct rpi_firmware_property_tag_header tag3; -+ u32 bpp; -+ struct rpi_firmware_property_tag_header tag4; -+ u32 xoffset, yoffset; -+ struct rpi_firmware_property_tag_header tag5; -+ u32 base, screen_size; -+ struct rpi_firmware_property_tag_header tag6; -+ u32 pitch; -+}; -+ -+struct bcm2708_fb_stats { -+ struct debugfs_regset32 regset; -+ u32 dma_copies; -+ u32 dma_irqs; -+}; -+ -+struct bcm2708_fb { -+ struct fb_info fb; -+ struct platform_device *dev; -+ struct rpi_firmware *fw; -+ u32 cmap[16]; -+ u32 gpu_cmap[256]; -+ int dma_chan; -+ int dma_irq; -+ void __iomem *dma_chan_base; -+ void *cb_base; /* DMA control blocks */ -+ dma_addr_t cb_handle; -+ struct dentry *debugfs_dir; -+ wait_queue_head_t dma_waitq; -+ struct bcm2708_fb_stats stats; -+ unsigned long fb_bus_address; -+}; -+ -+#define to_bcm2708(info) container_of(info, struct bcm2708_fb, fb) -+ -+static void bcm2708_fb_debugfs_deinit(struct bcm2708_fb *fb) -+{ -+ debugfs_remove_recursive(fb->debugfs_dir); -+ fb->debugfs_dir = NULL; -+} -+ -+static int bcm2708_fb_debugfs_init(struct bcm2708_fb *fb) -+{ -+ static struct debugfs_reg32 stats_registers[] = { -+ { -+ "dma_copies", -+ offsetof(struct bcm2708_fb_stats, dma_copies) -+ }, -+ { -+ "dma_irqs", -+ offsetof(struct bcm2708_fb_stats, dma_irqs) -+ }, -+ }; -+ -+ fb->debugfs_dir = debugfs_create_dir(DRIVER_NAME, NULL); -+ if (!fb->debugfs_dir) { -+ pr_warn("%s: could not create debugfs entry\n", -+ __func__); -+ return -EFAULT; -+ } -+ -+ fb->stats.regset.regs = stats_registers; -+ fb->stats.regset.nregs = ARRAY_SIZE(stats_registers); -+ fb->stats.regset.base = &fb->stats; -+ -+ if (!debugfs_create_regset32( -+ "stats", 0444, fb->debugfs_dir, &fb->stats.regset)) { -+ pr_warn("%s: could not create statistics registers\n", -+ __func__); -+ goto fail; -+ } -+ return 0; -+ -+fail: -+ bcm2708_fb_debugfs_deinit(fb); -+ return -EFAULT; -+} -+ -+static int bcm2708_fb_set_bitfields(struct fb_var_screeninfo *var) -+{ -+ int ret = 0; -+ -+ memset(&var->transp, 0, sizeof(var->transp)); -+ -+ var->red.msb_right = 0; -+ var->green.msb_right = 0; -+ var->blue.msb_right = 0; -+ -+ switch (var->bits_per_pixel) { -+ case 1: -+ case 2: -+ case 4: -+ case 8: -+ var->red.length = var->bits_per_pixel; -+ var->red.offset = 0; -+ var->green.length = var->bits_per_pixel; -+ var->green.offset = 0; -+ var->blue.length = var->bits_per_pixel; -+ var->blue.offset = 0; -+ break; -+ case 16: -+ var->red.length = 5; -+ var->blue.length = 5; -+ /* -+ * Green length can be 5 or 6 depending whether -+ * we're operating in RGB555 or RGB565 mode. -+ */ -+ if (var->green.length != 5 && var->green.length != 6) -+ var->green.length = 6; -+ break; -+ case 24: -+ var->red.length = 8; -+ var->blue.length = 8; -+ var->green.length = 8; -+ break; -+ case 32: -+ var->red.length = 8; -+ var->green.length = 8; -+ var->blue.length = 8; -+ var->transp.length = 8; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ -+ /* -+ * >= 16bpp displays have separate colour component bitfields -+ * encoded in the pixel data. Calculate their position from -+ * the bitfield length defined above. -+ */ -+ if (ret == 0 && var->bits_per_pixel >= 24 && fbswap) { -+ var->blue.offset = 0; -+ var->green.offset = var->blue.offset + var->blue.length; -+ var->red.offset = var->green.offset + var->green.length; -+ var->transp.offset = var->red.offset + var->red.length; -+ } else if (ret == 0 && var->bits_per_pixel >= 24) { -+ var->red.offset = 0; -+ var->green.offset = var->red.offset + var->red.length; -+ var->blue.offset = var->green.offset + var->green.length; -+ var->transp.offset = var->blue.offset + var->blue.length; -+ } else if (ret == 0 && var->bits_per_pixel >= 16) { -+ var->blue.offset = 0; -+ var->green.offset = var->blue.offset + var->blue.length; -+ var->red.offset = var->green.offset + var->green.length; -+ var->transp.offset = var->red.offset + var->red.length; -+ } -+ -+ return ret; -+} -+ -+static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, -+ struct fb_info *info) -+{ -+ /* info input, var output */ -+ print_debug("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, -+ info->var.xres, info->var.yres, info->var.xres_virtual, -+ info->var.yres_virtual, (int)info->screen_size, -+ info->var.bits_per_pixel); -+ print_debug("bcm2708_fb_check_var var(%p) %dx%d (%dx%d), %d\n", var, -+ var->xres, var->yres, var->xres_virtual, var->yres_virtual, -+ var->bits_per_pixel); -+ -+ if (!var->bits_per_pixel) -+ var->bits_per_pixel = 16; -+ -+ if (bcm2708_fb_set_bitfields(var) != 0) { -+ pr_err("bcm2708_fb_check_var: invalid bits_per_pixel %d\n", -+ var->bits_per_pixel); -+ return -EINVAL; -+ } -+ -+ -+ if (var->xres_virtual < var->xres) -+ var->xres_virtual = var->xres; -+ /* use highest possible virtual resolution */ -+ if (var->yres_virtual == -1) { -+ var->yres_virtual = 480; -+ -+ pr_err -+ ("bcm2708_fb_check_var: virtual resolution set to maximum of %dx%d\n", -+ var->xres_virtual, var->yres_virtual); -+ } -+ if (var->yres_virtual < var->yres) -+ var->yres_virtual = var->yres; -+ -+ if (var->xoffset < 0) -+ var->xoffset = 0; -+ if (var->yoffset < 0) -+ var->yoffset = 0; -+ -+ /* truncate xoffset and yoffset to maximum if too high */ -+ if (var->xoffset > var->xres_virtual - var->xres) -+ var->xoffset = var->xres_virtual - var->xres - 1; -+ if (var->yoffset > var->yres_virtual - var->yres) -+ var->yoffset = var->yres_virtual - var->yres - 1; -+ -+ return 0; -+} -+ -+static int bcm2708_fb_set_par(struct fb_info *info) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ struct fb_alloc_tags fbinfo = { -+ .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT, -+ 8, 0, }, -+ .xres = info->var.xres, -+ .yres = info->var.yres, -+ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT, -+ 8, 0, }, -+ .xres_virtual = info->var.xres_virtual, -+ .yres_virtual = info->var.yres_virtual, -+ .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH, 4, 0 }, -+ .bpp = info->var.bits_per_pixel, -+ .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET, 8, 0 }, -+ .xoffset = info->var.xoffset, -+ .yoffset = info->var.yoffset, -+ .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE, 8, 0 }, -+ .base = 0, -+ .screen_size = 0, -+ .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH, 4, 0 }, -+ .pitch = 0, -+ }; -+ int ret; -+ -+ print_debug("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, -+ info->var.xres, info->var.yres, info->var.xres_virtual, -+ info->var.yres_virtual, (int)info->screen_size, -+ info->var.bits_per_pixel); -+ -+ ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo)); -+ if (ret) { -+ dev_err(info->device, -+ "Failed to allocate GPU framebuffer (%d)\n", ret); -+ return ret; -+ } -+ -+ if (info->var.bits_per_pixel <= 8) -+ fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; -+ else -+ fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; -+ -+ fb->fb.fix.line_length = fbinfo.pitch; -+ fbinfo.base |= 0x40000000; -+ fb->fb_bus_address = fbinfo.base; -+ fbinfo.base &= ~0xc0000000; -+ fb->fb.fix.smem_start = fbinfo.base; -+ fb->fb.fix.smem_len = fbinfo.pitch * fbinfo.yres_virtual; -+ fb->fb.screen_size = fbinfo.screen_size; -+ if (fb->fb.screen_base) -+ iounmap(fb->fb.screen_base); -+ fb->fb.screen_base = ioremap_wc(fbinfo.base, fb->fb.screen_size); -+ if (!fb->fb.screen_base) { -+ /* the console may currently be locked */ -+ console_trylock(); -+ console_unlock(); -+ dev_err(info->device, "Failed to set screen_base\n"); -+ return -ENOMEM; -+ } -+ -+ print_debug -+ ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n", -+ (void *)fb->fb.screen_base, (void *)fb->fb_bus_address, -+ fbinfo.xres, fbinfo.yres, fbinfo.bpp, -+ fbinfo.pitch, (int)fb->fb.screen_size); -+ -+ return 0; -+} -+ -+static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) -+{ -+ unsigned int mask = (1 << bf->length) - 1; -+ -+ return (val >> (16 - bf->length) & mask) << bf->offset; -+} -+ -+ -+static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, -+ unsigned int green, unsigned int blue, -+ unsigned int transp, struct fb_info *info) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ -+ /*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ -+ if (fb->fb.var.bits_per_pixel <= 8) { -+ if (regno < 256) { -+ /* blue [23:16], green [15:8], red [7:0] */ -+ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 | -+ ((green >> 8) & 0xff) << 8 | -+ ((blue >> 8) & 0xff) << 16; -+ } -+ /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ -+ /* So just call it for what looks like the last colour in a list for now. */ -+ if (regno == 15 || regno == 255) { -+ struct packet { -+ u32 offset; -+ u32 length; -+ u32 cmap[256]; -+ } *packet; -+ int ret; -+ -+ packet = kmalloc(sizeof(*packet), GFP_KERNEL); -+ if (!packet) -+ return -ENOMEM; -+ packet->offset = 0; -+ packet->length = regno + 1; -+ memcpy(packet->cmap, fb->gpu_cmap, sizeof(packet->cmap)); -+ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE, -+ packet, (2 + packet->length) * sizeof(u32)); -+ if (ret || packet->offset) -+ dev_err(info->device, "Failed to set palette (%d,%u)\n", -+ ret, packet->offset); -+ kfree(packet); -+ } -+ } else if (regno < 16) { -+ fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | -+ convert_bitfield(blue, &fb->fb.var.blue) | -+ convert_bitfield(green, &fb->fb.var.green) | -+ convert_bitfield(red, &fb->fb.var.red); -+ } -+ return regno > 255; -+} -+ -+static int bcm2708_fb_blank(int blank_mode, struct fb_info *info) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ u32 value; -+ int ret; -+ -+ switch (blank_mode) { -+ case FB_BLANK_UNBLANK: -+ value = 0; -+ break; -+ case FB_BLANK_NORMAL: -+ case FB_BLANK_VSYNC_SUSPEND: -+ case FB_BLANK_HSYNC_SUSPEND: -+ case FB_BLANK_POWERDOWN: -+ value = 1; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_BLANK, -+ &value, sizeof(value)); -+ if (ret) -+ dev_err(info->device, "bcm2708_fb_blank(%d) failed: %d\n", -+ blank_mode, ret); -+ -+ return ret; -+} -+ -+static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) -+{ -+ s32 result; -+ info->var.xoffset = var->xoffset; -+ info->var.yoffset = var->yoffset; -+ result = bcm2708_fb_set_par(info); -+ if (result != 0) -+ pr_err("bcm2708_fb_pan_display(%d,%d) returns=%d\n", var->xoffset, var->yoffset, result); -+ return result; -+} -+ -+static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ u32 dummy = 0; -+ int ret; -+ -+ switch (cmd) { -+ case FBIO_WAITFORVSYNC: -+ ret = rpi_firmware_property(fb->fw, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, -+ &dummy, sizeof(dummy)); -+ break; -+ default: -+ dev_dbg(info->device, "Unknown ioctl 0x%x\n", cmd); -+ return -ENOTTY; -+ } -+ -+ if (ret) -+ dev_err(info->device, "ioctl 0x%x failed (%d)\n", cmd, ret); -+ -+ return ret; -+} -+static void bcm2708_fb_fillrect(struct fb_info *info, -+ const struct fb_fillrect *rect) -+{ -+ /* (is called) print_debug("bcm2708_fb_fillrect\n"); */ -+ cfb_fillrect(info, rect); -+} -+ -+/* A helper function for configuring dma control block */ -+static void set_dma_cb(struct bcm2708_dma_cb *cb, -+ int burst_size, -+ dma_addr_t dst, -+ int dst_stride, -+ dma_addr_t src, -+ int src_stride, -+ int w, -+ int h) -+{ -+ cb->info = BCM2708_DMA_BURST(burst_size) | BCM2708_DMA_S_WIDTH | -+ BCM2708_DMA_S_INC | BCM2708_DMA_D_WIDTH | -+ BCM2708_DMA_D_INC | BCM2708_DMA_TDMODE; -+ cb->dst = dst; -+ cb->src = src; -+ /* -+ * This is not really obvious from the DMA documentation, -+ * but the top 16 bits must be programmmed to "height -1" -+ * and not "height" in 2D mode. -+ */ -+ cb->length = ((h - 1) << 16) | w; -+ cb->stride = ((dst_stride - w) << 16) | (u16)(src_stride - w); -+ cb->pad[0] = 0; -+ cb->pad[1] = 0; -+} -+ -+static void bcm2708_fb_copyarea(struct fb_info *info, -+ const struct fb_copyarea *region) -+{ -+ struct bcm2708_fb *fb = to_bcm2708(info); -+ struct bcm2708_dma_cb *cb = fb->cb_base; -+ int bytes_per_pixel = (info->var.bits_per_pixel + 7) >> 3; -+ /* Channel 0 supports larger bursts and is a bit faster */ -+ int burst_size = (fb->dma_chan == 0) ? 8 : 2; -+ int pixels = region->width * region->height; -+ -+ /* Fallback to cfb_copyarea() if we don't like something */ -+ if (in_atomic() || -+ bytes_per_pixel > 4 || -+ info->var.xres * info->var.yres > 1920 * 1200 || -+ region->width <= 0 || region->width > info->var.xres || -+ region->height <= 0 || region->height > info->var.yres || -+ region->sx < 0 || region->sx >= info->var.xres || -+ region->sy < 0 || region->sy >= info->var.yres || -+ region->dx < 0 || region->dx >= info->var.xres || -+ region->dy < 0 || region->dy >= info->var.yres || -+ region->sx + region->width > info->var.xres || -+ region->dx + region->width > info->var.xres || -+ region->sy + region->height > info->var.yres || -+ region->dy + region->height > info->var.yres) { -+ cfb_copyarea(info, region); -+ return; -+ } -+ -+ if (region->dy == region->sy && region->dx > region->sx) { -+ /* -+ * A difficult case of overlapped copy. Because DMA can't -+ * copy individual scanlines in backwards direction, we need -+ * two-pass processing. We do it by programming a chain of dma -+ * control blocks in the first 16K part of the buffer and use -+ * the remaining 48K as the intermediate temporary scratch -+ * buffer. The buffer size is sufficient to handle up to -+ * 1920x1200 resolution at 32bpp pixel depth. -+ */ -+ int y; -+ dma_addr_t control_block_pa = fb->cb_handle; -+ dma_addr_t scratchbuf = fb->cb_handle + 16 * 1024; -+ int scanline_size = bytes_per_pixel * region->width; -+ int scanlines_per_cb = (64 * 1024 - 16 * 1024) / scanline_size; -+ -+ for (y = 0; y < region->height; y += scanlines_per_cb) { -+ dma_addr_t src = -+ fb->fb_bus_address + -+ bytes_per_pixel * region->sx + -+ (region->sy + y) * fb->fb.fix.line_length; -+ dma_addr_t dst = -+ fb->fb_bus_address + -+ bytes_per_pixel * region->dx + -+ (region->dy + y) * fb->fb.fix.line_length; -+ -+ if (region->height - y < scanlines_per_cb) -+ scanlines_per_cb = region->height - y; -+ -+ set_dma_cb(cb, burst_size, scratchbuf, scanline_size, -+ src, fb->fb.fix.line_length, -+ scanline_size, scanlines_per_cb); -+ control_block_pa += sizeof(struct bcm2708_dma_cb); -+ cb->next = control_block_pa; -+ cb++; -+ -+ set_dma_cb(cb, burst_size, dst, fb->fb.fix.line_length, -+ scratchbuf, scanline_size, -+ scanline_size, scanlines_per_cb); -+ control_block_pa += sizeof(struct bcm2708_dma_cb); -+ cb->next = control_block_pa; -+ cb++; -+ } -+ /* move the pointer back to the last dma control block */ -+ cb--; -+ } else { -+ /* A single dma control block is enough. */ -+ int sy, dy, stride; -+ if (region->dy <= region->sy) { -+ /* processing from top to bottom */ -+ dy = region->dy; -+ sy = region->sy; -+ stride = fb->fb.fix.line_length; -+ } else { -+ /* processing from bottom to top */ -+ dy = region->dy + region->height - 1; -+ sy = region->sy + region->height - 1; -+ stride = -fb->fb.fix.line_length; -+ } -+ set_dma_cb(cb, burst_size, -+ fb->fb_bus_address + dy * fb->fb.fix.line_length + -+ bytes_per_pixel * region->dx, -+ stride, -+ fb->fb_bus_address + sy * fb->fb.fix.line_length + -+ bytes_per_pixel * region->sx, -+ stride, -+ region->width * bytes_per_pixel, -+ region->height); -+ } -+ -+ /* end of dma control blocks chain */ -+ cb->next = 0; -+ -+ -+ if (pixels < dma_busy_wait_threshold) { -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ bcm_dma_wait_idle(fb->dma_chan_base); -+ } else { -+ void __iomem *dma_chan = fb->dma_chan_base; -+ cb->info |= BCM2708_DMA_INT_EN; -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ while (bcm_dma_is_busy(dma_chan)) { -+ wait_event_interruptible( -+ fb->dma_waitq, -+ !bcm_dma_is_busy(dma_chan)); -+ } -+ fb->stats.dma_irqs++; -+ } -+ fb->stats.dma_copies++; -+} -+ -+static void bcm2708_fb_imageblit(struct fb_info *info, -+ const struct fb_image *image) -+{ -+ /* (is called) print_debug("bcm2708_fb_imageblit\n"); */ -+ cfb_imageblit(info, image); -+} -+ -+static irqreturn_t bcm2708_fb_dma_irq(int irq, void *cxt) -+{ -+ struct bcm2708_fb *fb = cxt; -+ -+ /* FIXME: should read status register to check if this is -+ * actually interrupting us or not, in case this interrupt -+ * ever becomes shared amongst several DMA channels -+ * -+ * readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_IRQ; -+ */ -+ -+ /* acknowledge the interrupt */ -+ writel(BCM2708_DMA_INT, fb->dma_chan_base + BCM2708_DMA_CS); -+ -+ wake_up(&fb->dma_waitq); -+ return IRQ_HANDLED; -+} -+ -+static struct fb_ops bcm2708_fb_ops = { -+ .owner = THIS_MODULE, -+ .fb_check_var = bcm2708_fb_check_var, -+ .fb_set_par = bcm2708_fb_set_par, -+ .fb_setcolreg = bcm2708_fb_setcolreg, -+ .fb_blank = bcm2708_fb_blank, -+ .fb_fillrect = bcm2708_fb_fillrect, -+ .fb_copyarea = bcm2708_fb_copyarea, -+ .fb_imageblit = bcm2708_fb_imageblit, -+ .fb_pan_display = bcm2708_fb_pan_display, -+ .fb_ioctl = bcm2708_ioctl, -+}; -+ -+static int bcm2708_fb_register(struct bcm2708_fb *fb) -+{ -+ int ret; -+ -+ fb->fb.fbops = &bcm2708_fb_ops; -+ fb->fb.flags = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA; -+ fb->fb.pseudo_palette = fb->cmap; -+ -+ strncpy(fb->fb.fix.id, bcm2708_name, sizeof(fb->fb.fix.id)); -+ fb->fb.fix.type = FB_TYPE_PACKED_PIXELS; -+ fb->fb.fix.type_aux = 0; -+ fb->fb.fix.xpanstep = 1; -+ fb->fb.fix.ypanstep = 1; -+ fb->fb.fix.ywrapstep = 0; -+ fb->fb.fix.accel = FB_ACCEL_NONE; -+ -+ fb->fb.var.xres = fbwidth; -+ fb->fb.var.yres = fbheight; -+ fb->fb.var.xres_virtual = fbwidth; -+ fb->fb.var.yres_virtual = fbheight; -+ fb->fb.var.bits_per_pixel = fbdepth; -+ fb->fb.var.vmode = FB_VMODE_NONINTERLACED; -+ fb->fb.var.activate = FB_ACTIVATE_NOW; -+ fb->fb.var.nonstd = 0; -+ fb->fb.var.height = -1; /* height of picture in mm */ -+ fb->fb.var.width = -1; /* width of picture in mm */ -+ fb->fb.var.accel_flags = 0; -+ -+ fb->fb.monspecs.hfmin = 0; -+ fb->fb.monspecs.hfmax = 100000; -+ fb->fb.monspecs.vfmin = 0; -+ fb->fb.monspecs.vfmax = 400; -+ fb->fb.monspecs.dclkmin = 1000000; -+ fb->fb.monspecs.dclkmax = 100000000; -+ -+ bcm2708_fb_set_bitfields(&fb->fb.var); -+ init_waitqueue_head(&fb->dma_waitq); -+ -+ /* -+ * Allocate colourmap. -+ */ -+ -+ fb_set_var(&fb->fb, &fb->fb.var); -+ ret = bcm2708_fb_set_par(&fb->fb); -+ if (ret) -+ return ret; -+ -+ print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n", fbwidth, -+ fbheight, fbdepth, fbswap); -+ -+ ret = register_framebuffer(&fb->fb); -+ print_debug("BCM2708FB: register framebuffer (%d)\n", ret); -+ if (ret == 0) -+ goto out; -+ -+ print_debug("BCM2708FB: cannot register framebuffer (%d)\n", ret); -+out: -+ return ret; -+} -+ -+static int bcm2708_fb_probe(struct platform_device *dev) -+{ -+ struct device_node *fw_np; -+ struct rpi_firmware *fw; -+ struct bcm2708_fb *fb; -+ int ret; -+ -+ fw_np = of_parse_phandle(dev->dev.of_node, "firmware", 0); -+/* Remove comment when booting without Device Tree is no longer supported -+ if (!fw_np) { -+ dev_err(&dev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+*/ -+ fw = rpi_firmware_get(fw_np); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL); -+ if (!fb) { -+ dev_err(&dev->dev, -+ "could not allocate new bcm2708_fb struct\n"); -+ ret = -ENOMEM; -+ goto free_region; -+ } -+ -+ fb->fw = fw; -+ bcm2708_fb_debugfs_init(fb); -+ -+ fb->cb_base = dma_alloc_writecombine(&dev->dev, SZ_64K, -+ &fb->cb_handle, GFP_KERNEL); -+ if (!fb->cb_base) { -+ dev_err(&dev->dev, "cannot allocate DMA CBs\n"); -+ ret = -ENOMEM; -+ goto free_fb; -+ } -+ -+ pr_info("BCM2708FB: allocated DMA memory %08x\n", -+ fb->cb_handle); -+ -+ ret = bcm_dma_chan_alloc(BCM_DMA_FEATURE_BULK, -+ &fb->dma_chan_base, &fb->dma_irq); -+ if (ret < 0) { -+ dev_err(&dev->dev, "couldn't allocate a DMA channel\n"); -+ goto free_cb; -+ } -+ fb->dma_chan = ret; -+ -+ ret = request_irq(fb->dma_irq, bcm2708_fb_dma_irq, -+ 0, "bcm2708_fb dma", fb); -+ if (ret) { -+ pr_err("%s: failed to request DMA irq\n", __func__); -+ goto free_dma_chan; -+ } -+ -+ -+ pr_info("BCM2708FB: allocated DMA channel %d @ %p\n", -+ fb->dma_chan, fb->dma_chan_base); -+ -+ fb->dev = dev; -+ fb->fb.device = &dev->dev; -+ -+ ret = bcm2708_fb_register(fb); -+ if (ret == 0) { -+ platform_set_drvdata(dev, fb); -+ goto out; -+ } -+ -+free_dma_chan: -+ bcm_dma_chan_free(fb->dma_chan); -+free_cb: -+ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); -+free_fb: -+ kfree(fb); -+free_region: -+ dev_err(&dev->dev, "probe failed, err %d\n", ret); -+out: -+ return ret; -+} -+ -+static int bcm2708_fb_remove(struct platform_device *dev) -+{ -+ struct bcm2708_fb *fb = platform_get_drvdata(dev); -+ -+ platform_set_drvdata(dev, NULL); -+ -+ if (fb->fb.screen_base) -+ iounmap(fb->fb.screen_base); -+ unregister_framebuffer(&fb->fb); -+ -+ dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); -+ bcm_dma_chan_free(fb->dma_chan); -+ -+ bcm2708_fb_debugfs_deinit(fb); -+ -+ free_irq(fb->dma_irq, fb); -+ -+ kfree(fb); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm2708_fb_of_match_table[] = { -+ { .compatible = "brcm,bcm2708-fb", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2708_fb_of_match_table); -+ -+static struct platform_driver bcm2708_fb_driver = { -+ .probe = bcm2708_fb_probe, -+ .remove = bcm2708_fb_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2708_fb_of_match_table, -+ }, -+}; -+ -+static int __init bcm2708_fb_init(void) -+{ -+ return platform_driver_register(&bcm2708_fb_driver); -+} -+ -+module_init(bcm2708_fb_init); -+ -+static void __exit bcm2708_fb_exit(void) -+{ -+ platform_driver_unregister(&bcm2708_fb_driver); -+} -+ -+module_exit(bcm2708_fb_exit); -+ -+module_param(fbwidth, int, 0644); -+module_param(fbheight, int, 0644); -+module_param(fbdepth, int, 0644); -+module_param(fbswap, int, 0644); -+ -+MODULE_DESCRIPTION("BCM2708 framebuffer driver"); -+MODULE_LICENSE("GPL"); -+ -+MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer"); -+MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer"); -+MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); -+MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); -diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43b82fefe1d32f591d1b2f61d2cd28d0fa8..7626beb6a5bb8df601ddf0f6e6909d1f66ae85d0 100644 ---- a/drivers/video/logo/logo_linux_clut224.ppm -+++ b/drivers/video/logo/logo_linux_clut224.ppm -@@ -1,1604 +1,883 @@ - P3 --# Standard 224-color Linux logo --80 80 -+63 80 - 255 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 6 6 6 10 10 10 10 10 10 -- 10 10 10 6 6 6 6 6 6 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 10 10 10 14 14 14 -- 22 22 22 26 26 26 30 30 30 34 34 34 -- 30 30 30 30 30 30 26 26 26 18 18 18 -- 14 14 14 10 10 10 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 26 26 26 42 42 42 -- 54 54 54 66 66 66 78 78 78 78 78 78 -- 78 78 78 74 74 74 66 66 66 54 54 54 -- 42 42 42 26 26 26 18 18 18 10 10 10 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 22 22 22 42 42 42 66 66 66 86 86 86 -- 66 66 66 38 38 38 38 38 38 22 22 22 -- 26 26 26 34 34 34 54 54 54 66 66 66 -- 86 86 86 70 70 70 46 46 46 26 26 26 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 26 26 26 -- 50 50 50 82 82 82 58 58 58 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 54 54 54 86 86 86 66 66 66 -- 38 38 38 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 22 22 22 50 50 50 -- 78 78 78 34 34 34 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 6 6 6 70 70 70 -- 78 78 78 46 46 46 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 42 42 42 82 82 82 -- 26 26 26 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 14 14 14 -- 46 46 46 34 34 34 6 6 6 2 2 6 -- 42 42 42 78 78 78 42 42 42 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 10 10 10 30 30 30 66 66 66 58 58 58 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 26 26 26 -- 86 86 86 101 101 101 46 46 46 10 10 10 -- 2 2 6 58 58 58 70 70 70 34 34 34 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 14 14 14 42 42 42 86 86 86 10 10 10 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 30 30 30 -- 94 94 94 94 94 94 58 58 58 26 26 26 -- 2 2 6 6 6 6 78 78 78 54 54 54 -- 22 22 22 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 22 22 22 62 62 62 62 62 62 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 26 26 26 -- 54 54 54 38 38 38 18 18 18 10 10 10 -- 2 2 6 2 2 6 34 34 34 82 82 82 -- 38 38 38 14 14 14 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 30 30 30 78 78 78 30 30 30 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 10 10 10 -- 10 10 10 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 78 78 78 -- 50 50 50 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 86 86 86 14 14 14 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 54 54 54 -- 66 66 66 26 26 26 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 82 82 82 2 2 6 2 2 6 -- 2 2 6 6 6 6 10 10 10 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 6 6 6 -- 14 14 14 10 10 10 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 18 18 18 -- 82 82 82 34 34 34 10 10 10 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 2 2 6 -- 6 6 6 6 6 6 22 22 22 34 34 34 -- 6 6 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 18 18 18 34 34 34 -- 10 10 10 50 50 50 22 22 22 2 2 6 -- 2 2 6 2 2 6 2 2 6 10 10 10 -- 86 86 86 42 42 42 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 2 2 6 -- 38 38 38 116 116 116 94 94 94 22 22 22 -- 22 22 22 2 2 6 2 2 6 2 2 6 -- 14 14 14 86 86 86 138 138 138 162 162 162 --154 154 154 38 38 38 26 26 26 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 86 86 86 46 46 46 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 14 14 14 --134 134 134 198 198 198 195 195 195 116 116 116 -- 10 10 10 2 2 6 2 2 6 6 6 6 --101 98 89 187 187 187 210 210 210 218 218 218 --214 214 214 134 134 134 14 14 14 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 86 86 86 50 50 50 18 18 18 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 86 86 86 2 2 6 54 54 54 --218 218 218 195 195 195 226 226 226 246 246 246 -- 58 58 58 2 2 6 2 2 6 30 30 30 --210 210 210 253 253 253 174 174 174 123 123 123 --221 221 221 234 234 234 74 74 74 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 70 70 70 58 58 58 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 46 46 46 82 82 82 2 2 6 106 106 106 --170 170 170 26 26 26 86 86 86 226 226 226 --123 123 123 10 10 10 14 14 14 46 46 46 --231 231 231 190 190 190 6 6 6 70 70 70 -- 90 90 90 238 238 238 158 158 158 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 70 70 70 58 58 58 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 0 -- 0 0 1 0 0 1 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 86 86 86 6 6 6 116 116 116 --106 106 106 6 6 6 70 70 70 149 149 149 --128 128 128 18 18 18 38 38 38 54 54 54 --221 221 221 106 106 106 2 2 6 14 14 14 -- 46 46 46 190 190 190 198 198 198 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 74 74 74 62 62 62 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 0 -- 0 0 1 0 0 0 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 94 94 94 14 14 14 101 101 101 --128 128 128 2 2 6 18 18 18 116 116 116 --118 98 46 121 92 8 121 92 8 98 78 10 --162 162 162 106 106 106 2 2 6 2 2 6 -- 2 2 6 195 195 195 195 195 195 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 74 74 74 62 62 62 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 1 0 0 1 -- 0 0 1 0 0 0 0 0 1 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 90 90 90 14 14 14 58 58 58 --210 210 210 26 26 26 54 38 6 154 114 10 --226 170 11 236 186 11 225 175 15 184 144 12 --215 174 15 175 146 61 37 26 9 2 2 6 -- 70 70 70 246 246 246 138 138 138 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 70 70 70 66 66 66 26 26 26 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 86 86 86 14 14 14 10 10 10 --195 195 195 188 164 115 192 133 9 225 175 15 --239 182 13 234 190 10 232 195 16 232 200 30 --245 207 45 241 208 19 232 195 16 184 144 12 --218 194 134 211 206 186 42 42 42 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 50 50 50 74 74 74 30 30 30 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 34 34 34 86 86 86 14 14 14 2 2 6 --121 87 25 192 133 9 219 162 10 239 182 13 --236 186 11 232 195 16 241 208 19 244 214 54 --246 218 60 246 218 38 246 215 20 241 208 19 --241 208 19 226 184 13 121 87 25 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 50 50 50 82 82 82 34 34 34 10 10 10 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 34 34 34 82 82 82 30 30 30 61 42 6 --180 123 7 206 145 10 230 174 11 239 182 13 --234 190 10 238 202 15 241 208 19 246 218 74 --246 218 38 246 215 20 246 215 20 246 215 20 --226 184 13 215 174 15 184 144 12 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 26 26 26 94 94 94 42 42 42 14 14 14 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 50 50 50 104 69 6 --192 133 9 216 158 10 236 178 12 236 186 11 --232 195 16 241 208 19 244 214 54 245 215 43 --246 215 20 246 215 20 241 208 19 198 155 10 --200 144 11 216 158 10 156 118 10 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 90 90 90 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 46 46 46 22 22 22 --137 92 6 210 162 10 239 182 13 238 190 10 --238 202 15 241 208 19 246 215 20 246 215 20 --241 208 19 203 166 17 185 133 11 210 150 10 --216 158 10 210 150 10 102 78 10 2 2 6 -- 6 6 6 54 54 54 14 14 14 2 2 6 -- 2 2 6 62 62 62 74 74 74 30 30 30 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 34 34 34 78 78 78 50 50 50 6 6 6 -- 94 70 30 139 102 15 190 146 13 226 184 13 --232 200 30 232 195 16 215 174 15 190 146 13 --168 122 10 192 133 9 210 150 10 213 154 11 --202 150 34 182 157 106 101 98 89 2 2 6 -- 2 2 6 78 78 78 116 116 116 58 58 58 -- 2 2 6 22 22 22 90 90 90 46 46 46 -- 18 18 18 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 86 86 86 50 50 50 6 6 6 --128 128 128 174 154 114 156 107 11 168 122 10 --198 155 10 184 144 12 197 138 11 200 144 11 --206 145 10 206 145 10 197 138 11 188 164 115 --195 195 195 198 198 198 174 174 174 14 14 14 -- 2 2 6 22 22 22 116 116 116 116 116 116 -- 22 22 22 2 2 6 74 74 74 70 70 70 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 101 101 101 26 26 26 10 10 10 --138 138 138 190 190 190 174 154 114 156 107 11 --197 138 11 200 144 11 197 138 11 192 133 9 --180 123 7 190 142 34 190 178 144 187 187 187 --202 202 202 221 221 221 214 214 214 66 66 66 -- 2 2 6 2 2 6 50 50 50 62 62 62 -- 6 6 6 2 2 6 10 10 10 90 90 90 -- 50 50 50 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 34 34 34 -- 74 74 74 74 74 74 2 2 6 6 6 6 --144 144 144 198 198 198 190 190 190 178 166 146 --154 121 60 156 107 11 156 107 11 168 124 44 --174 154 114 187 187 187 190 190 190 210 210 210 --246 246 246 253 253 253 253 253 253 182 182 182 -- 6 6 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 62 62 62 -- 74 74 74 34 34 34 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 10 10 10 22 22 22 54 54 54 -- 94 94 94 18 18 18 2 2 6 46 46 46 --234 234 234 221 221 221 190 190 190 190 190 190 --190 190 190 187 187 187 187 187 187 190 190 190 --190 190 190 195 195 195 214 214 214 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 -- 82 82 82 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 14 14 14 -- 86 86 86 54 54 54 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 46 46 46 90 90 90 -- 46 46 46 18 18 18 6 6 6 182 182 182 --253 253 253 246 246 246 206 206 206 190 190 190 --190 190 190 190 190 190 190 190 190 190 190 190 --206 206 206 231 231 231 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --202 202 202 14 14 14 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 42 42 42 86 86 86 42 42 42 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 14 14 14 38 38 38 74 74 74 66 66 66 -- 2 2 6 6 6 6 90 90 90 250 250 250 --253 253 253 253 253 253 238 238 238 198 198 198 --190 190 190 190 190 190 195 195 195 221 221 221 --246 246 246 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 82 82 82 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 78 78 78 70 70 70 34 34 34 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 34 34 34 66 66 66 78 78 78 6 6 6 -- 2 2 6 18 18 18 218 218 218 253 253 253 --253 253 253 253 253 253 253 253 253 246 246 246 --226 226 226 231 231 231 246 246 246 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 178 178 178 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 18 18 18 90 90 90 62 62 62 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 26 26 26 -- 58 58 58 90 90 90 18 18 18 2 2 6 -- 2 2 6 110 110 110 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 231 231 231 18 18 18 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 18 18 18 94 94 94 -- 54 54 54 26 26 26 10 10 10 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 22 22 22 50 50 50 -- 90 90 90 26 26 26 2 2 6 2 2 6 -- 14 14 14 195 195 195 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 242 242 242 54 54 54 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 38 38 38 -- 86 86 86 50 50 50 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 38 38 38 82 82 82 -- 34 34 34 2 2 6 2 2 6 2 2 6 -- 42 42 42 195 195 195 246 246 246 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --242 242 242 242 242 242 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 250 250 250 246 246 246 238 238 238 --226 226 226 231 231 231 101 101 101 6 6 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 38 38 38 82 82 82 42 42 42 14 14 14 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 10 10 10 26 26 26 62 62 62 66 66 66 -- 2 2 6 2 2 6 2 2 6 6 6 6 -- 70 70 70 170 170 170 206 206 206 234 234 234 --246 246 246 250 250 250 250 250 250 238 238 238 --226 226 226 231 231 231 238 238 238 250 250 250 --250 250 250 250 250 250 246 246 246 231 231 231 --214 214 214 206 206 206 202 202 202 202 202 202 --198 198 198 202 202 202 182 182 182 18 18 18 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 62 62 62 66 66 66 30 30 30 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 14 14 14 42 42 42 82 82 82 18 18 18 -- 2 2 6 2 2 6 2 2 6 10 10 10 -- 94 94 94 182 182 182 218 218 218 242 242 242 --250 250 250 253 253 253 253 253 253 250 250 250 --234 234 234 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 246 246 246 --238 238 238 226 226 226 210 210 210 202 202 202 --195 195 195 195 195 195 210 210 210 158 158 158 -- 6 6 6 14 14 14 50 50 50 14 14 14 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 86 86 86 46 46 46 -- 18 18 18 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 22 22 22 54 54 54 70 70 70 2 2 6 -- 2 2 6 10 10 10 2 2 6 22 22 22 --166 166 166 231 231 231 250 250 250 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --242 242 242 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 246 246 246 --231 231 231 206 206 206 198 198 198 226 226 226 -- 94 94 94 2 2 6 6 6 6 38 38 38 -- 30 30 30 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 62 62 62 66 66 66 -- 26 26 26 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 74 74 74 50 50 50 2 2 6 -- 26 26 26 26 26 26 2 2 6 106 106 106 --238 238 238 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 246 246 246 218 218 218 202 202 202 --210 210 210 14 14 14 2 2 6 2 2 6 -- 30 30 30 22 22 22 2 2 6 2 2 6 -- 2 2 6 2 2 6 18 18 18 86 86 86 -- 42 42 42 14 14 14 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 42 42 42 90 90 90 22 22 22 2 2 6 -- 42 42 42 2 2 6 18 18 18 218 218 218 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 250 250 250 221 221 221 --218 218 218 101 101 101 2 2 6 14 14 14 -- 18 18 18 38 38 38 10 10 10 2 2 6 -- 2 2 6 2 2 6 2 2 6 78 78 78 -- 58 58 58 22 22 22 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 54 54 54 82 82 82 2 2 6 26 26 26 -- 22 22 22 2 2 6 123 123 123 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --238 238 238 198 198 198 6 6 6 38 38 38 -- 58 58 58 26 26 26 38 38 38 2 2 6 -- 2 2 6 2 2 6 2 2 6 46 46 46 -- 78 78 78 30 30 30 10 10 10 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 10 10 10 30 30 30 -- 74 74 74 58 58 58 2 2 6 42 42 42 -- 2 2 6 22 22 22 231 231 231 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 250 250 250 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 246 246 246 46 46 46 38 38 38 -- 42 42 42 14 14 14 38 38 38 14 14 14 -- 2 2 6 2 2 6 2 2 6 6 6 6 -- 86 86 86 46 46 46 14 14 14 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 14 14 14 42 42 42 -- 90 90 90 18 18 18 18 18 18 26 26 26 -- 2 2 6 116 116 116 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 250 250 250 238 238 238 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 94 94 94 6 6 6 -- 2 2 6 2 2 6 10 10 10 34 34 34 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 74 74 74 58 58 58 22 22 22 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 10 10 10 26 26 26 66 66 66 -- 82 82 82 2 2 6 38 38 38 6 6 6 -- 14 14 14 210 210 210 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 246 246 246 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 144 144 144 2 2 6 -- 2 2 6 2 2 6 2 2 6 46 46 46 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 42 42 42 74 74 74 30 30 30 10 10 10 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 42 42 42 90 90 90 -- 26 26 26 6 6 6 42 42 42 2 2 6 -- 74 74 74 250 250 250 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 242 242 242 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 182 182 182 2 2 6 -- 2 2 6 2 2 6 2 2 6 46 46 46 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 10 10 10 86 86 86 38 38 38 10 10 10 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 10 10 10 26 26 26 66 66 66 82 82 82 -- 2 2 6 22 22 22 18 18 18 2 2 6 --149 149 149 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 206 206 206 2 2 6 -- 2 2 6 2 2 6 2 2 6 38 38 38 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 86 86 86 46 46 46 14 14 14 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 18 18 18 46 46 46 86 86 86 18 18 18 -- 2 2 6 34 34 34 10 10 10 6 6 6 --210 210 210 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 221 221 221 6 6 6 -- 2 2 6 2 2 6 6 6 6 30 30 30 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 82 82 82 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 26 26 26 66 66 66 62 62 62 2 2 6 -- 2 2 6 38 38 38 10 10 10 26 26 26 --238 238 238 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 238 238 238 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 6 6 6 -- 2 2 6 2 2 6 10 10 10 30 30 30 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 58 58 58 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 38 38 38 78 78 78 6 6 6 2 2 6 -- 2 2 6 46 46 46 14 14 14 42 42 42 --246 246 246 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 10 10 10 -- 2 2 6 2 2 6 22 22 22 14 14 14 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 62 62 62 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 74 74 74 2 2 6 2 2 6 -- 14 14 14 70 70 70 34 34 34 62 62 62 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 14 14 14 -- 2 2 6 2 2 6 30 30 30 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 62 62 62 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 54 54 54 62 62 62 2 2 6 2 2 6 -- 2 2 6 30 30 30 46 46 46 70 70 70 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 226 226 226 10 10 10 -- 2 2 6 6 6 6 30 30 30 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 66 66 66 58 58 58 22 22 22 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 22 22 22 -- 58 58 58 62 62 62 2 2 6 2 2 6 -- 2 2 6 2 2 6 30 30 30 78 78 78 --250 250 250 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 206 206 206 2 2 6 -- 22 22 22 34 34 34 18 14 6 22 22 22 -- 26 26 26 18 18 18 6 6 6 2 2 6 -- 2 2 6 82 82 82 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 26 26 26 -- 62 62 62 106 106 106 74 54 14 185 133 11 --210 162 10 121 92 8 6 6 6 62 62 62 --238 238 238 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 246 246 246 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 158 158 158 18 18 18 -- 14 14 14 2 2 6 2 2 6 2 2 6 -- 6 6 6 18 18 18 66 66 66 38 38 38 -- 6 6 6 94 94 94 50 50 50 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 10 10 10 10 10 10 18 18 18 38 38 38 -- 78 78 78 142 134 106 216 158 10 242 186 14 --246 190 14 246 190 14 156 118 10 10 10 10 -- 90 90 90 238 238 238 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 250 250 250 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 246 230 190 --238 204 91 238 204 91 181 142 44 37 26 9 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 38 38 38 46 46 46 -- 26 26 26 106 106 106 54 54 54 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 14 14 14 22 22 22 -- 30 30 30 38 38 38 50 50 50 70 70 70 --106 106 106 190 142 34 226 170 11 242 186 14 --246 190 14 246 190 14 246 190 14 154 114 10 -- 6 6 6 74 74 74 226 226 226 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 231 231 231 250 250 250 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 228 184 62 --241 196 14 241 208 19 232 195 16 38 30 10 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 30 30 30 26 26 26 --203 166 17 154 142 90 66 66 66 26 26 26 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 38 38 38 58 58 58 -- 78 78 78 86 86 86 101 101 101 123 123 123 --175 146 61 210 150 10 234 174 13 246 186 14 --246 190 14 246 190 14 246 190 14 238 190 10 --102 78 10 2 2 6 46 46 46 198 198 198 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 234 234 234 242 242 242 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 224 178 62 --242 186 14 241 196 14 210 166 10 22 18 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 6 6 6 121 92 8 --238 202 15 232 195 16 82 82 82 34 34 34 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 14 14 14 38 38 38 70 70 70 154 122 46 --190 142 34 200 144 11 197 138 11 197 138 11 --213 154 11 226 170 11 242 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --225 175 15 46 32 6 2 2 6 22 22 22 --158 158 158 250 250 250 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 250 250 250 242 242 242 224 178 62 --239 182 13 236 186 11 213 154 11 46 32 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 61 42 6 225 175 15 --238 190 10 236 186 11 112 100 78 42 42 42 -- 14 14 14 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 22 22 22 54 54 54 154 122 46 213 154 11 --226 170 11 230 174 11 226 170 11 226 170 11 --236 178 12 242 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --241 196 14 184 144 12 10 10 10 2 2 6 -- 6 6 6 116 116 116 242 242 242 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 231 231 231 198 198 198 214 170 54 --236 178 12 236 178 12 210 150 10 137 92 6 -- 18 14 6 2 2 6 2 2 6 2 2 6 -- 6 6 6 70 47 6 200 144 11 236 178 12 --239 182 13 239 182 13 124 112 88 58 58 58 -- 22 22 22 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 70 70 70 180 133 36 226 170 11 --239 182 13 242 186 14 242 186 14 246 186 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 232 195 16 98 70 6 2 2 6 -- 2 2 6 2 2 6 66 66 66 221 221 221 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 206 206 206 198 198 198 214 166 58 --230 174 11 230 174 11 216 158 10 192 133 9 --163 110 8 116 81 8 102 78 10 116 81 8 --167 114 7 197 138 11 226 170 11 239 182 13 --242 186 14 242 186 14 162 146 94 78 78 78 -- 34 34 34 14 14 14 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 30 30 30 78 78 78 190 142 34 226 170 11 --239 182 13 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 241 196 14 203 166 17 22 18 6 -- 2 2 6 2 2 6 2 2 6 38 38 38 --218 218 218 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 206 206 206 198 198 198 202 162 69 --226 170 11 236 178 12 224 166 10 210 150 10 --200 144 11 197 138 11 192 133 9 197 138 11 --210 150 10 226 170 11 242 186 14 246 190 14 --246 190 14 246 186 14 225 175 15 124 112 88 -- 62 62 62 30 30 30 14 14 14 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 174 135 50 224 166 10 --239 182 13 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 241 196 14 139 102 15 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 78 78 78 250 250 250 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --250 250 250 214 214 214 198 198 198 190 150 46 --219 162 10 236 178 12 234 174 13 224 166 10 --216 158 10 213 154 11 213 154 11 216 158 10 --226 170 11 239 182 13 246 190 14 246 190 14 --246 190 14 246 190 14 242 186 14 206 162 42 --101 101 101 58 58 58 30 30 30 14 14 14 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 74 74 74 174 135 50 216 158 10 --236 178 12 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 241 196 14 226 184 13 -- 61 42 6 2 2 6 2 2 6 2 2 6 -- 22 22 22 238 238 238 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 226 226 226 187 187 187 180 133 36 --216 158 10 236 178 12 239 182 13 236 178 12 --230 174 11 226 170 11 226 170 11 230 174 11 --236 178 12 242 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 186 14 239 182 13 --206 162 42 106 106 106 66 66 66 34 34 34 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 26 26 26 70 70 70 163 133 67 213 154 11 --236 178 12 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 241 196 14 --190 146 13 18 14 6 2 2 6 2 2 6 -- 46 46 46 246 246 246 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 221 221 221 86 86 86 156 107 11 --216 158 10 236 178 12 242 186 14 246 186 14 --242 186 14 239 182 13 239 182 13 242 186 14 --242 186 14 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --242 186 14 225 175 15 142 122 72 66 66 66 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 26 26 26 70 70 70 163 133 67 210 150 10 --236 178 12 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --232 195 16 121 92 8 34 34 34 106 106 106 --221 221 221 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --242 242 242 82 82 82 18 14 6 163 110 8 --216 158 10 236 178 12 242 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 242 186 14 163 133 67 -- 46 46 46 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 10 10 10 -- 30 30 30 78 78 78 163 133 67 210 150 10 --236 178 12 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --241 196 14 215 174 15 190 178 144 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 218 218 218 -- 58 58 58 2 2 6 22 18 6 167 114 7 --216 158 10 236 178 12 246 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 186 14 242 186 14 190 150 46 -- 54 54 54 22 22 22 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 38 38 38 86 86 86 180 133 36 213 154 11 --236 178 12 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 232 195 16 190 146 13 214 214 214 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 250 250 250 170 170 170 26 26 26 -- 2 2 6 2 2 6 37 26 9 163 110 8 --219 162 10 239 182 13 246 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 186 14 236 178 12 224 166 10 142 122 72 -- 46 46 46 18 18 18 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 109 106 95 192 133 9 224 166 10 --242 186 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --242 186 14 226 184 13 210 162 10 142 110 46 --226 226 226 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --253 253 253 253 253 253 253 253 253 253 253 253 --198 198 198 66 66 66 2 2 6 2 2 6 -- 2 2 6 2 2 6 50 34 6 156 107 11 --219 162 10 239 182 13 246 186 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 242 186 14 --234 174 13 213 154 11 154 122 46 66 66 66 -- 30 30 30 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 22 22 22 -- 58 58 58 154 121 60 206 145 10 234 174 13 --242 186 14 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 186 14 236 178 12 210 162 10 163 110 8 -- 61 42 6 138 138 138 218 218 218 250 250 250 --253 253 253 253 253 253 253 253 253 250 250 250 --242 242 242 210 210 210 144 144 144 66 66 66 -- 6 6 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 61 42 6 163 110 8 --216 158 10 236 178 12 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 239 182 13 230 174 11 216 158 10 --190 142 34 124 112 88 70 70 70 38 38 38 -- 18 18 18 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 22 22 22 -- 62 62 62 168 124 44 206 145 10 224 166 10 --236 178 12 239 182 13 242 186 14 242 186 14 --246 186 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 236 178 12 216 158 10 175 118 6 -- 80 54 7 2 2 6 6 6 6 30 30 30 -- 54 54 54 62 62 62 50 50 50 38 38 38 -- 14 14 14 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 80 54 7 167 114 7 --213 154 11 236 178 12 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 190 14 242 186 14 239 182 13 239 182 13 --230 174 11 210 150 10 174 135 50 124 112 88 -- 82 82 82 54 54 54 34 34 34 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 18 18 18 -- 50 50 50 158 118 36 192 133 9 200 144 11 --216 158 10 219 162 10 224 166 10 226 170 11 --230 174 11 236 178 12 239 182 13 239 182 13 --242 186 14 246 186 14 246 190 14 246 190 14 --246 190 14 246 190 14 246 190 14 246 190 14 --246 186 14 230 174 11 210 150 10 163 110 8 --104 69 6 10 10 10 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 91 60 6 167 114 7 --206 145 10 230 174 11 242 186 14 246 190 14 --246 190 14 246 190 14 246 186 14 242 186 14 --239 182 13 230 174 11 224 166 10 213 154 11 --180 133 36 124 112 88 86 86 86 58 58 58 -- 38 38 38 22 22 22 10 10 10 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 14 14 14 -- 34 34 34 70 70 70 138 110 50 158 118 36 --167 114 7 180 123 7 192 133 9 197 138 11 --200 144 11 206 145 10 213 154 11 219 162 10 --224 166 10 230 174 11 239 182 13 242 186 14 --246 186 14 246 186 14 246 186 14 246 186 14 --239 182 13 216 158 10 185 133 11 152 99 6 --104 69 6 18 14 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 2 2 6 2 2 6 2 2 6 -- 2 2 6 6 6 6 80 54 7 152 99 6 --192 133 9 219 162 10 236 178 12 239 182 13 --246 186 14 242 186 14 239 182 13 236 178 12 --224 166 10 206 145 10 192 133 9 154 121 60 -- 94 94 94 62 62 62 42 42 42 22 22 22 -- 14 14 14 6 6 6 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 18 18 18 34 34 34 58 58 58 78 78 78 --101 98 89 124 112 88 142 110 46 156 107 11 --163 110 8 167 114 7 175 118 6 180 123 7 --185 133 11 197 138 11 210 150 10 219 162 10 --226 170 11 236 178 12 236 178 12 234 174 13 --219 162 10 197 138 11 163 110 8 130 83 6 -- 91 60 6 10 10 10 2 2 6 2 2 6 -- 18 18 18 38 38 38 38 38 38 38 38 38 -- 38 38 38 38 38 38 38 38 38 38 38 38 -- 38 38 38 38 38 38 26 26 26 2 2 6 -- 2 2 6 6 6 6 70 47 6 137 92 6 --175 118 6 200 144 11 219 162 10 230 174 11 --234 174 13 230 174 11 219 162 10 210 150 10 --192 133 9 163 110 8 124 112 88 82 82 82 -- 50 50 50 30 30 30 14 14 14 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 14 14 14 22 22 22 34 34 34 -- 42 42 42 58 58 58 74 74 74 86 86 86 --101 98 89 122 102 70 130 98 46 121 87 25 --137 92 6 152 99 6 163 110 8 180 123 7 --185 133 11 197 138 11 206 145 10 200 144 11 --180 123 7 156 107 11 130 83 6 104 69 6 -- 50 34 6 54 54 54 110 110 110 101 98 89 -- 86 86 86 82 82 82 78 78 78 78 78 78 -- 78 78 78 78 78 78 78 78 78 78 78 78 -- 78 78 78 82 82 82 86 86 86 94 94 94 --106 106 106 101 101 101 86 66 34 124 80 6 --156 107 11 180 123 7 192 133 9 200 144 11 --206 145 10 200 144 11 192 133 9 175 118 6 --139 102 15 109 106 95 70 70 70 42 42 42 -- 22 22 22 10 10 10 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 6 6 6 10 10 10 -- 14 14 14 22 22 22 30 30 30 38 38 38 -- 50 50 50 62 62 62 74 74 74 90 90 90 --101 98 89 112 100 78 121 87 25 124 80 6 --137 92 6 152 99 6 152 99 6 152 99 6 --138 86 6 124 80 6 98 70 6 86 66 30 --101 98 89 82 82 82 58 58 58 46 46 46 -- 38 38 38 34 34 34 34 34 34 34 34 34 -- 34 34 34 34 34 34 34 34 34 34 34 34 -- 34 34 34 34 34 34 38 38 38 42 42 42 -- 54 54 54 82 82 82 94 86 76 91 60 6 --134 86 6 156 107 11 167 114 7 175 118 6 --175 118 6 167 114 7 152 99 6 121 87 25 --101 98 89 62 62 62 34 34 34 18 18 18 -- 6 6 6 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 6 6 6 10 10 10 -- 18 18 18 22 22 22 30 30 30 42 42 42 -- 50 50 50 66 66 66 86 86 86 101 98 89 --106 86 58 98 70 6 104 69 6 104 69 6 --104 69 6 91 60 6 82 62 34 90 90 90 -- 62 62 62 38 38 38 22 22 22 14 14 14 -- 10 10 10 10 10 10 10 10 10 10 10 10 -- 10 10 10 10 10 10 6 6 6 10 10 10 -- 10 10 10 10 10 10 10 10 10 14 14 14 -- 22 22 22 42 42 42 70 70 70 89 81 66 -- 80 54 7 104 69 6 124 80 6 137 92 6 --134 86 6 116 81 8 100 82 52 86 86 86 -- 58 58 58 30 30 30 14 14 14 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 10 10 10 14 14 14 -- 18 18 18 26 26 26 38 38 38 54 54 54 -- 70 70 70 86 86 86 94 86 76 89 81 66 -- 89 81 66 86 86 86 74 74 74 50 50 50 -- 30 30 30 14 14 14 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 18 18 18 34 34 34 58 58 58 -- 82 82 82 89 81 66 89 81 66 89 81 66 -- 94 86 66 94 86 76 74 74 74 50 50 50 -- 26 26 26 14 14 14 6 6 6 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 6 6 6 6 6 6 14 14 14 18 18 18 -- 30 30 30 38 38 38 46 46 46 54 54 54 -- 50 50 50 42 42 42 30 30 30 18 18 18 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 6 6 6 14 14 14 26 26 26 -- 38 38 38 50 50 50 58 58 58 58 58 58 -- 54 54 54 42 42 42 30 30 30 18 18 18 -- 10 10 10 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 6 6 6 10 10 10 14 14 14 18 18 18 -- 18 18 18 14 14 14 10 10 10 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 6 6 6 -- 14 14 14 18 18 18 22 22 22 22 22 22 -- 18 18 18 14 14 14 10 10 10 6 6 6 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -- 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 -+0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 -+0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -+10 15 3 2 3 1 12 18 4 42 61 14 19 27 6 11 16 4 -+38 55 13 10 15 3 3 4 1 10 15 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 1 -+12 18 4 1 1 0 23 34 8 31 45 11 10 15 3 32 47 11 -+34 49 12 3 4 1 3 4 1 3 4 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 10 15 3 29 42 10 26 37 9 12 18 4 -+55 80 19 81 118 28 55 80 19 92 132 31 106 153 36 69 100 23 -+100 144 34 80 116 27 42 61 14 81 118 28 23 34 8 27 40 9 -+15 21 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 1 1 0 29 42 10 15 21 5 50 72 17 -+74 107 25 45 64 15 102 148 35 80 116 27 84 121 28 111 160 38 -+69 100 23 65 94 22 81 118 28 29 42 10 17 25 6 29 42 10 -+23 34 8 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 -+15 21 5 15 21 5 34 49 12 101 146 34 111 161 38 97 141 33 -+97 141 33 119 172 41 117 170 40 116 167 40 118 170 40 118 171 40 -+117 169 40 118 170 40 111 160 38 118 170 40 96 138 32 89 128 30 -+81 118 28 11 16 4 10 15 3 1 1 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+3 4 1 3 4 1 34 49 12 101 146 34 79 115 27 111 160 38 -+114 165 39 113 163 39 118 170 40 117 169 40 118 171 40 117 169 40 -+116 167 40 119 172 41 113 163 39 92 132 31 105 151 36 113 163 39 -+75 109 26 19 27 6 16 23 5 11 16 4 0 1 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 -+80 116 27 106 153 36 105 151 36 114 165 39 118 170 40 118 171 40 -+118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 170 40 117 169 40 118 170 40 118 170 40 -+117 170 40 75 109 26 75 109 26 34 49 12 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 1 -+64 92 22 65 94 22 100 144 34 118 171 40 118 170 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 171 41 118 170 40 117 169 40 -+109 158 37 105 151 36 104 150 35 47 69 16 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+42 61 14 115 167 39 118 170 40 117 169 40 117 169 40 117 169 40 -+117 170 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 118 170 40 96 138 32 17 25 6 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 69 16 -+114 165 39 117 168 40 117 170 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 118 170 40 117 169 40 117 169 40 117 169 40 -+117 170 40 119 172 41 96 138 32 12 18 4 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 -+32 47 11 105 151 36 118 170 40 117 169 40 117 169 40 116 168 40 -+109 157 37 111 160 38 117 169 40 118 171 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 171 40 69 100 23 2 3 1 -+0 0 0 0 0 0 0 0 0 0 0 0 19 27 6 101 146 34 -+118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 170 40 -+118 171 40 115 166 39 107 154 36 111 161 38 117 169 40 117 169 40 -+117 169 40 118 171 40 75 109 26 19 27 6 2 3 1 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 -+89 128 30 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+111 160 38 92 132 31 79 115 27 96 138 32 115 166 39 119 171 41 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 170 40 109 157 37 26 37 9 -+0 0 0 0 0 0 0 0 0 0 0 0 64 92 22 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 170 40 118 171 40 109 157 37 -+89 128 30 81 118 28 100 144 34 115 166 39 117 169 40 117 169 40 -+117 169 40 117 170 40 113 163 39 60 86 20 1 1 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+27 40 9 96 138 32 118 170 40 117 169 40 117 169 40 117 169 40 -+117 170 40 117 169 40 101 146 34 67 96 23 55 80 19 84 121 28 -+113 163 39 119 171 41 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 65 94 22 -+0 0 0 0 0 0 0 0 0 15 21 5 101 146 34 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 118 170 40 118 171 40 104 150 35 69 100 23 53 76 18 -+81 118 28 111 160 38 118 170 40 117 169 40 117 169 40 117 169 40 -+117 169 40 114 165 39 69 100 23 10 15 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -+31 45 11 77 111 26 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 118 170 40 116 168 40 92 132 31 47 69 16 -+38 55 13 81 118 28 113 163 39 119 171 41 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 171 41 92 132 31 -+10 15 3 0 0 0 0 0 0 36 52 12 115 166 39 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 -+118 171 40 102 148 35 64 92 22 34 49 12 65 94 22 106 153 36 -+118 171 40 117 170 40 117 169 40 117 169 40 117 169 40 117 169 40 -+118 170 40 107 154 36 55 80 19 15 21 5 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+29 42 10 101 146 34 118 171 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 113 163 39 -+75 109 26 27 40 9 36 52 12 89 128 30 116 167 40 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 104 150 35 -+16 23 5 0 0 0 0 0 0 53 76 18 118 171 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 119 171 41 109 157 37 -+67 96 23 23 34 8 42 61 14 96 138 32 118 170 40 118 170 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 74 107 25 10 15 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 31 45 11 101 146 34 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+119 171 41 102 148 35 47 69 16 14 20 5 50 72 17 102 148 35 -+118 171 40 117 169 40 117 169 40 117 169 40 118 170 40 102 148 35 -+15 21 5 0 0 0 0 0 0 50 72 17 118 170 40 117 169 40 -+117 169 40 117 169 40 118 170 40 116 167 40 84 121 28 27 40 9 -+19 27 6 74 107 25 114 165 39 118 171 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 75 109 26 10 15 4 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 38 55 13 102 148 35 118 171 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 118 170 40 115 167 39 77 111 26 17 25 6 19 27 6 -+77 111 26 115 166 39 118 170 40 117 169 40 119 172 41 81 118 28 -+3 4 1 0 0 0 0 0 0 27 40 9 111 160 38 118 170 40 -+117 169 40 118 171 40 105 151 36 50 72 17 10 15 3 38 55 13 -+100 144 34 118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 79 115 27 15 21 5 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 10 15 3 64 92 22 111 160 38 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 118 171 40 96 138 32 32 47 11 -+3 4 1 50 72 17 107 154 36 120 173 41 105 151 36 31 45 11 -+0 0 0 0 0 0 0 0 0 3 4 1 65 94 22 117 169 40 -+118 170 40 89 128 30 26 37 9 3 4 1 60 86 20 111 161 38 -+118 171 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+97 141 33 36 52 12 1 1 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 14 20 5 75 109 26 117 168 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 171 40 107 154 36 -+45 64 15 2 3 1 31 45 11 75 109 26 32 47 11 0 1 0 -+0 0 0 0 0 0 0 0 0 0 0 0 10 15 3 55 80 19 -+65 94 22 11 16 4 11 16 4 75 109 26 116 168 40 118 170 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 107 154 36 -+47 69 16 3 4 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 12 18 4 69 100 23 111 161 38 118 171 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 118 170 40 -+111 160 38 50 72 17 2 3 1 2 3 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -+1 1 0 12 18 4 81 118 28 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 170 40 118 171 40 101 146 34 -+42 61 14 2 3 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 3 4 1 36 52 12 89 128 30 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+118 171 41 101 146 34 14 20 5 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 47 69 16 118 170 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 170 40 111 160 38 69 100 23 19 27 6 -+0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 11 16 4 69 100 23 -+115 167 39 119 172 41 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+119 172 41 75 109 26 3 4 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 23 34 8 106 153 36 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+117 169 40 118 170 40 119 172 41 105 151 36 42 61 14 2 3 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 15 21 5 -+45 64 15 80 116 27 114 165 39 118 170 40 117 169 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 119 172 41 -+97 141 33 20 30 7 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 1 1 0 53 76 18 114 165 39 118 171 40 117 169 40 -+117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 117 169 40 -+118 171 40 104 150 35 64 92 22 31 45 11 10 15 3 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 36 52 12 97 141 33 109 158 37 113 163 39 116 168 40 -+117 169 40 117 170 40 118 170 40 119 172 41 115 167 39 84 121 28 -+23 34 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 3 4 1 50 72 17 102 148 35 118 171 40 -+119 171 41 118 170 40 117 169 40 117 169 40 115 166 39 111 161 38 -+109 157 37 79 115 27 12 18 4 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 3 4 1 15 21 5 23 34 8 45 64 15 106 153 36 -+116 167 40 111 160 38 101 146 34 79 115 27 42 61 14 10 15 3 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 1 1 0 20 30 7 60 86 20 -+89 128 30 106 153 36 113 163 39 117 169 40 84 121 28 29 42 10 -+19 27 6 10 15 3 2 3 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 16 23 5 38 55 13 -+36 52 12 26 37 9 12 18 4 2 3 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 1 0 0 19 2 7 52 5 18 -+78 7 27 88 8 31 81 7 29 56 5 19 25 2 9 3 0 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+3 4 1 19 27 6 31 45 11 38 55 13 32 47 11 3 4 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 -+9 0 3 12 1 4 9 0 3 4 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 28 3 10 99 9 35 156 14 55 182 16 64 -+189 17 66 190 17 67 189 17 66 184 17 65 166 15 58 118 13 41 -+45 4 16 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 11 1 4 52 5 18 101 9 35 134 12 47 -+151 14 53 154 14 54 151 14 53 113 10 40 11 1 4 0 0 0 -+3 0 1 67 6 24 159 14 56 190 17 67 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 191 17 67 -+174 16 61 101 9 35 14 1 5 0 0 0 35 3 12 108 10 38 -+122 11 43 122 11 43 112 10 39 87 8 30 50 5 17 13 1 5 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+3 0 1 56 5 19 141 13 49 182 16 64 191 17 67 191 17 67 -+190 17 67 190 17 67 191 17 67 113 10 40 3 0 1 1 0 0 -+79 7 28 180 16 63 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+189 17 66 188 17 66 122 11 43 11 1 4 41 4 14 176 16 62 -+191 17 67 191 17 67 191 17 67 190 17 67 181 16 63 146 13 51 -+75 7 26 10 1 4 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 1 2 -+90 8 32 178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 41 4 14 -+173 16 61 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 88 8 31 1 0 0 89 8 31 -+185 17 65 189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 -+186 17 65 124 11 43 25 2 9 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 89 8 31 -+184 17 65 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 151 14 53 34 3 12 0 0 0 0 0 0 79 7 28 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 191 17 67 146 13 51 9 1 3 7 1 2 -+108 10 38 187 17 66 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 190 17 67 141 13 49 22 2 8 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 176 16 62 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+151 14 53 38 3 13 0 0 0 0 0 0 0 0 0 50 5 17 -+180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 191 17 67 141 13 49 7 1 3 0 0 0 -+11 1 4 112 10 39 187 17 66 189 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 113 10 40 5 0 2 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 7 1 3 132 12 46 191 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 -+35 3 12 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 -+101 9 35 185 17 65 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 190 17 67 180 16 63 67 6 24 0 0 0 0 0 0 -+0 0 0 11 1 4 108 10 38 186 17 65 189 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 44 4 15 177 16 62 189 17 66 -+188 17 66 188 17 66 189 17 66 189 17 66 134 12 47 28 3 10 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+8 1 3 79 7 28 159 14 56 188 17 66 191 17 67 190 17 67 -+189 17 66 189 17 66 189 17 66 189 17 66 190 17 67 191 17 67 -+188 17 66 158 14 55 72 7 25 4 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 8 1 3 95 9 33 182 16 64 189 17 67 -+188 17 66 188 17 66 188 17 66 191 17 67 122 11 43 3 0 1 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 88 8 31 190 17 67 188 17 66 -+188 17 66 189 17 66 185 17 65 113 10 40 18 2 6 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 1 0 0 24 2 8 77 7 27 124 11 43 154 14 54 -+168 15 59 173 16 61 173 16 61 168 15 59 154 14 54 124 11 43 -+77 7 27 22 2 8 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 5 0 2 77 7 27 173 16 61 -+190 17 67 188 17 66 188 17 66 190 17 67 164 15 57 23 2 8 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 1 0 0 118 13 41 191 17 67 188 17 66 -+190 17 67 174 16 61 87 8 30 8 1 3 0 0 0 0 0 0 -+0 0 0 0 0 0 10 1 4 29 3 10 40 4 14 36 3 13 -+18 2 6 2 0 1 0 0 0 0 0 0 3 0 1 14 1 5 -+26 2 9 33 3 11 32 3 11 25 2 9 13 1 5 3 0 1 -+0 0 0 14 1 5 56 5 19 95 9 33 109 10 38 101 9 35 -+77 7 27 35 3 12 5 0 2 0 0 0 1 0 0 56 5 19 -+156 14 55 190 17 67 188 17 66 188 17 66 182 16 64 50 5 17 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 189 17 66 -+151 14 53 52 5 18 2 0 1 0 0 0 0 0 0 1 0 0 -+28 3 10 90 8 32 146 13 51 170 15 60 178 16 62 174 16 61 -+158 14 55 112 10 39 40 4 14 1 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 -+56 5 19 146 13 51 183 17 64 191 17 67 191 17 67 191 17 67 -+188 17 66 173 16 61 122 11 43 41 4 14 1 0 0 0 0 0 -+30 3 10 124 11 43 185 17 65 190 17 67 187 17 66 67 6 24 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 6 1 2 134 12 47 168 15 59 99 9 35 -+21 2 7 0 0 0 0 0 0 0 0 0 6 1 2 77 7 27 -+162 15 57 190 17 67 191 17 67 189 17 66 189 17 66 189 17 66 -+190 17 67 191 17 67 169 15 59 75 7 26 3 0 1 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 79 7 28 -+178 16 62 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 191 17 67 170 15 60 79 7 28 5 0 2 -+0 0 0 10 1 3 78 7 27 159 14 56 188 17 66 75 7 26 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 1 0 0 35 3 12 29 3 10 2 0 1 -+0 0 0 0 0 0 0 0 0 9 1 3 101 9 35 183 17 64 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 178 16 63 67 6 23 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 52 5 18 174 16 61 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 182 16 64 89 8 31 -+4 0 1 0 0 0 0 0 0 25 2 9 73 7 26 31 3 11 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 4 0 1 98 9 34 187 17 66 189 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 25 2 9 -+0 0 0 0 0 0 0 0 0 8 1 3 134 12 47 191 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 -+68 6 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 6 1 2 19 2 7 3 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 65 6 23 180 16 63 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 83 8 29 -+0 0 0 0 0 0 0 0 0 41 4 14 177 16 62 189 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+159 14 56 28 3 10 0 0 0 0 0 0 0 0 0 23 2 8 -+41 4 14 5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+23 2 8 113 10 40 159 14 56 65 6 23 0 0 0 0 0 0 -+0 0 0 16 1 6 146 13 51 191 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 132 12 46 -+5 0 2 0 0 0 0 0 0 77 7 27 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 98 9 34 0 0 0 0 0 0 12 1 4 134 12 47 -+178 16 63 108 10 38 16 1 6 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 3 10 -+141 13 49 190 17 67 191 17 67 134 12 47 6 1 2 0 0 0 -+0 0 0 68 6 24 186 17 65 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 156 14 55 -+14 1 5 0 0 0 0 0 0 98 9 34 191 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 156 14 55 19 2 7 0 0 0 47 4 16 181 16 63 -+190 17 67 189 17 66 126 14 44 17 2 6 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 16 1 6 134 12 47 -+191 17 67 188 17 66 190 17 67 162 15 57 19 2 7 0 0 0 -+3 0 1 123 11 43 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 163 15 57 -+20 2 7 0 0 0 0 0 0 101 9 35 191 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 182 16 64 52 5 18 0 0 0 73 7 26 188 17 66 -+188 17 66 188 17 66 189 17 66 109 10 38 5 0 2 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 95 9 33 189 17 66 -+188 17 66 188 17 66 189 17 66 171 15 60 29 3 10 0 0 0 -+16 1 6 156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 158 14 55 -+17 2 6 0 0 0 0 0 0 85 8 30 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 81 7 29 0 0 0 85 8 30 190 17 67 -+188 17 66 188 17 66 189 17 66 180 16 63 56 5 19 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 25 2 9 162 15 57 190 17 67 -+188 17 66 188 17 66 189 17 66 173 16 61 31 3 11 0 0 0 -+30 3 10 171 15 60 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 141 13 49 -+7 1 2 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 191 17 67 98 9 34 0 0 0 88 8 31 190 17 67 -+188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 5 0 2 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 68 6 24 187 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 170 15 60 28 3 10 0 0 0 -+34 3 12 174 16 61 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 101 9 35 -+0 0 0 0 0 0 0 0 0 21 2 7 159 14 56 190 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 191 17 67 98 9 34 0 0 0 81 7 29 189 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 168 15 59 28 3 10 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 109 10 38 191 17 67 188 17 66 -+188 17 66 188 17 66 190 17 67 163 15 57 21 2 7 0 0 0 -+26 2 9 168 15 59 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 180 16 63 47 4 16 -+0 0 0 0 0 0 0 0 0 0 0 0 108 10 38 190 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 78 7 27 0 0 0 68 6 24 187 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 183 17 64 56 5 19 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 3 0 1 131 12 46 191 17 67 188 17 66 -+188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 0 0 0 -+11 1 4 146 13 51 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 191 17 67 126 14 44 7 1 2 -+0 0 0 0 0 0 0 0 0 0 0 0 32 3 11 164 15 58 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+189 17 66 178 16 62 44 4 15 0 0 0 50 5 17 182 16 64 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 5 0 2 134 12 47 191 17 67 188 17 66 -+188 17 66 188 17 66 191 17 67 131 12 46 3 0 1 0 0 0 -+0 0 0 101 9 35 190 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 170 15 60 44 4 15 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 77 7 27 -+183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+191 17 67 134 12 47 9 1 3 0 0 0 31 3 11 171 15 60 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 72 7 25 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 2 0 1 124 11 43 191 17 67 188 17 66 -+188 17 66 188 17 66 191 17 67 101 9 35 0 0 0 0 0 0 -+0 0 0 35 3 12 168 15 59 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 182 16 64 77 7 27 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 1 2 -+99 9 35 185 17 65 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 -+177 16 62 56 5 19 0 0 0 0 0 0 13 1 5 151 14 53 -+190 17 67 188 17 66 188 17 66 188 17 66 185 17 65 56 5 19 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 99 9 35 191 17 67 188 17 66 -+188 17 66 188 17 66 186 17 65 65 6 23 0 0 0 0 0 0 -+0 0 0 0 0 0 79 7 28 182 16 64 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+191 17 67 177 16 62 83 8 29 4 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+8 1 3 89 8 31 175 16 62 191 17 67 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 181 16 63 -+85 8 30 3 0 1 0 0 0 0 0 0 1 0 0 118 13 41 -+191 17 67 188 17 66 188 17 66 189 17 66 173 16 61 34 3 12 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 56 5 19 183 17 64 188 17 66 -+188 17 66 189 17 66 169 15 59 30 3 10 0 0 0 0 0 0 -+0 0 0 0 0 0 5 0 2 83 8 29 173 16 61 191 17 67 -+190 17 67 189 17 66 189 17 66 190 17 67 191 17 67 187 17 66 -+151 14 53 56 5 19 3 0 1 0 0 0 16 1 6 50 5 17 -+79 7 28 95 9 33 95 9 33 75 7 26 41 4 14 10 1 4 -+0 0 0 2 0 1 50 5 17 132 12 46 178 16 62 190 17 67 -+191 17 67 191 17 67 191 17 67 186 17 65 154 14 54 68 6 24 -+4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 -+187 17 66 188 17 66 188 17 66 191 17 67 141 13 49 9 1 3 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 14 1 5 151 14 53 190 17 67 -+188 17 66 191 17 67 131 12 46 5 0 2 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 2 0 1 44 4 15 113 10 40 -+156 14 55 173 16 61 174 16 61 164 15 58 134 12 47 77 7 27 -+18 2 6 0 0 0 16 1 6 85 8 30 151 14 53 182 16 64 -+189 17 66 191 17 67 190 17 67 188 17 66 177 16 62 141 13 49 -+68 6 24 8 1 3 0 0 0 8 1 3 44 4 15 88 8 31 -+113 10 40 122 11 43 108 10 38 67 6 24 20 2 7 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 3 10 -+166 15 58 190 17 67 188 17 66 187 17 66 79 7 28 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 73 7 26 185 17 65 -+189 17 66 184 17 65 65 6 23 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 -+17 2 6 32 3 11 34 3 12 22 2 8 6 1 2 0 0 0 -+0 0 0 38 3 13 141 13 49 188 17 66 190 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 191 17 67 -+184 17 65 122 11 43 21 2 7 0 0 0 0 0 0 0 0 0 -+0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -+108 10 38 191 17 67 191 17 67 141 13 49 16 1 6 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 8 1 3 112 10 39 -+186 17 65 124 11 43 10 1 4 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+36 3 13 156 14 55 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+189 17 66 190 17 67 134 12 47 18 2 6 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 7 1 2 41 4 14 75 7 26 66 5 23 19 2 7 -+26 2 9 144 13 50 154 14 54 40 4 14 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 -+56 5 19 19 2 7 0 0 0 7 1 2 29 3 10 35 3 12 -+19 2 7 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 1 5 -+134 12 47 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 67 108 10 38 3 0 1 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -+40 4 14 124 11 43 177 16 62 188 17 66 187 17 66 144 13 50 -+24 2 8 17 2 6 22 2 8 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 19 2 7 122 11 43 171 15 60 175 16 62 -+159 14 56 112 10 39 40 4 14 2 0 1 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72 7 25 -+186 17 65 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 174 16 61 41 4 14 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 3 0 1 72 7 25 -+168 15 59 191 17 67 189 17 66 188 17 66 188 17 66 190 17 67 -+95 9 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 95 9 33 191 17 67 189 17 66 189 17 66 -+190 17 67 191 17 67 171 15 60 90 8 32 12 1 4 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 132 12 46 -+191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 98 9 34 0 0 0 -+0 0 0 0 0 0 0 0 0 5 0 2 88 8 31 180 16 63 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 191 17 67 -+146 13 51 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 9 1 3 144 13 50 191 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 187 17 66 123 11 43 20 2 7 -+0 0 0 0 0 0 0 0 0 0 0 0 21 2 7 163 15 57 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 191 17 67 134 12 47 5 0 2 -+0 0 0 0 0 0 3 0 1 88 8 31 182 16 64 189 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 -+171 15 60 31 3 11 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 20 2 7 162 15 57 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 132 12 46 -+20 2 7 0 0 0 0 0 0 0 0 0 32 3 11 173 16 61 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 151 14 53 12 1 4 -+0 0 0 0 0 0 72 7 25 180 16 63 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+181 16 63 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 21 2 7 163 15 57 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+122 11 43 9 1 3 0 0 0 0 0 0 30 3 10 171 15 60 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 190 17 67 146 13 51 10 1 4 -+0 0 0 38 3 13 166 15 58 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+183 17 64 52 5 18 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 13 1 5 154 14 54 190 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+186 17 65 79 7 28 0 0 0 0 0 0 14 1 5 156 14 54 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 191 17 67 124 11 43 2 0 1 -+5 0 2 122 11 43 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+182 16 64 47 4 16 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 3 0 1 126 14 44 191 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 158 14 55 23 2 8 0 0 0 1 0 0 113 10 40 -+191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 78 7 27 0 0 0 -+47 4 16 177 16 62 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 189 17 66 -+173 16 61 34 3 12 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 85 8 30 189 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 79 7 28 0 0 0 0 0 0 47 4 16 -+175 16 62 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 190 17 67 156 14 55 22 2 8 0 0 0 -+109 10 38 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+151 14 53 13 1 5 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 35 3 12 173 16 61 189 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 191 17 67 134 12 47 7 1 2 0 0 0 3 0 1 -+99 9 35 188 17 66 189 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 181 16 63 68 6 24 0 0 0 18 2 6 -+156 14 55 190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 -+101 9 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 3 0 1 118 13 41 191 17 67 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 168 15 59 28 3 10 0 0 0 0 0 0 -+12 1 4 113 10 40 187 17 66 189 17 67 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+190 17 67 180 16 63 88 8 31 4 0 1 0 0 0 47 4 16 -+180 16 63 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 190 17 67 168 15 59 -+36 3 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 38 3 13 164 15 58 190 17 67 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 -+0 0 0 11 1 4 90 8 32 169 15 59 190 17 67 190 17 67 -+189 17 66 189 17 66 189 17 66 189 17 66 191 17 67 189 17 66 -+158 14 55 68 6 24 4 0 1 0 0 0 0 0 0 73 7 26 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 185 17 65 83 8 29 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 65 6 23 174 16 61 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 185 17 65 56 5 19 0 0 0 0 0 0 -+0 0 0 0 0 0 2 0 1 35 3 12 99 9 35 146 13 51 -+170 15 60 177 16 62 177 16 62 166 15 58 141 13 49 85 8 30 -+24 2 8 0 0 0 0 0 0 0 0 0 0 0 0 85 8 30 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 189 17 66 112 10 39 8 1 3 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 68 6 24 -+170 15 60 191 17 67 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 182 16 64 50 5 17 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 11 1 4 -+28 3 10 40 4 14 38 3 13 25 2 9 8 1 3 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78 7 27 -+189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 187 17 66 113 10 40 14 1 5 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -+47 4 16 141 13 49 186 17 65 191 17 67 190 17 67 189 17 66 -+189 17 66 191 17 67 156 14 55 20 2 7 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 4 15 -+178 16 62 190 17 67 188 17 66 188 17 66 188 17 66 190 17 67 -+191 17 67 173 16 61 90 8 32 10 1 4 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 14 1 5 68 6 24 131 12 46 162 15 57 174 16 61 -+171 15 60 146 13 51 56 5 19 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 3 0 1 14 1 5 29 3 10 -+41 4 14 47 4 16 50 5 17 45 4 16 34 3 12 18 2 6 -+5 0 2 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 -+90 8 32 169 15 59 185 17 65 187 17 66 182 16 64 163 15 57 -+113 10 40 41 4 14 2 0 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 5 0 2 21 2 7 34 3 12 -+29 3 10 11 1 4 0 0 0 0 0 0 0 0 0 0 0 0 -+3 0 1 32 3 11 79 7 28 124 11 43 154 14 54 171 15 60 -+180 16 63 182 16 64 182 16 64 180 16 63 174 16 61 159 14 56 -+132 12 46 88 8 31 34 3 12 3 0 1 0 0 0 0 0 0 -+3 0 1 29 3 10 56 5 19 65 6 23 50 5 17 23 2 8 -+3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 2 9 -+109 10 38 169 15 59 189 17 66 191 17 67 190 17 67 189 17 66 -+189 17 66 188 17 66 188 17 66 188 17 66 189 17 66 190 17 67 -+191 17 67 190 17 67 171 15 60 98 9 34 10 1 3 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 14 1 5 141 13 49 -+191 17 67 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 67 186 17 65 65 6 23 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 23 2 8 166 15 58 -+190 17 67 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 189 17 66 176 16 62 45 4 16 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 83 8 29 -+183 17 64 189 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+188 17 66 189 17 66 185 17 65 95 9 33 3 0 1 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 -+85 8 30 176 16 62 191 17 67 188 17 66 188 17 66 188 17 66 -+188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 188 17 66 -+191 17 67 180 16 63 95 9 33 7 1 3 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+2 0 1 52 5 18 141 13 49 185 17 65 191 17 67 189 17 67 -+189 17 66 188 17 66 188 17 66 189 17 66 191 17 67 187 17 66 -+146 13 51 56 5 19 4 0 1 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 14 1 5 68 6 24 131 12 46 166 15 58 -+180 16 63 183 17 64 180 16 63 168 15 59 134 12 47 75 7 26 -+17 2 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 5 0 2 24 2 8 -+44 4 15 52 5 18 45 4 16 26 2 9 6 1 2 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -+0 0 0 0 0 0 0 0 0 - -From baa447618d238275c592e7caa6455b8e4b1d3d77 Mon Sep 17 00:00:00 2001 -From: Florian Meier -Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 033/122] dmaengine: Add support for BCM2708 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add support for DMA controller of BCM2708 as used in the Raspberry Pi. -Currently it only supports cyclic DMA. - -Signed-off-by: Florian Meier - -dmaengine: expand functionality by supporting scatter/gather transfers sdhci-bcm2708 and dma.c: fix for LITE channels - -DMA: fix cyclic LITE length overflow bug - -dmaengine: bcm2708: Remove chancnt affectations - -Mirror bcm2835-dma.c commit 9eba5536a7434c69d8c185d4bd1c70734d92287d: -chancnt is already filled by dma_async_device_register, which uses the channel -list to know how much channels there is. - -Since it's already filled, we can safely remove it from the drivers' probe -function. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: overwrite dreq only if it is not set - -dreq is set when the DMA channel is fetched from Device Tree. -slave_id is set using dmaengine_slave_config(). -Only overwrite dreq with slave_id if it is not set. - -dreq/slave_id in the cyclic DMA case is not touched, because I don't -have hardware to test with. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: do device registration in the board file - -Don't register the device in the driver. Do it in the board file. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: don't restrict DT support to ARCH_BCM2835 - -Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. -Add Device Tree support to the non ARCH_BCM2835 case. -Use the same driver name regardless of architecture. - -Signed-off-by: Noralf Trønnes - -BCM270x_DT: add bcm2835-dma entry - -Add Device Tree entry for bcm2835-dma. -The entry doesn't contain any resources since they are handled -by the arch/arm/mach-bcm270x/dma.c driver. -In non-DT mode, don't add the device in the board file. - -Signed-off-by: Noralf Trønnes - -bcm2708-dmaengine: Add debug options - -BCM270x: Add memory and irq resources to dmaengine device and DT - -Prepare for merging of the legacy DMA API arch driver dma.c -with bcm2708-dmaengine by adding memory and irq resources both -to platform file device and Device Tree node. -Don't use BCM_DMAMAN_DRIVER_NAME so we don't have to include mach/dma.h - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c - -Merge the legacy DMA API driver with bcm2708-dmaengine. -This is done so we can use bcm2708_fb on ARCH_BCM2835 (mailbox -driver is also needed). - -Changes to the dma.c code: -- Use BIT() macro. -- Cutdown some comments to one line. -- Add mutex to vc_dmaman and use this, since the dev lock is locked - during probing of the engine part. -- Add global g_dmaman variable since drvdata is used by the engine part. -- Restructure for readability: - vc_dmaman_chan_alloc() - vc_dmaman_chan_free() - bcm_dma_chan_free() -- Restructure bcm_dma_chan_alloc() to simplify error handling. -- Use device irq resources instead of hardcoded bcm_dma_irqs table. -- Remove dev_dmaman_register() and code it directly. -- Remove dev_dmaman_deregister() and code it directly. -- Simplify bcm_dmaman_probe() using devm_* functions. -- Get dmachans from DT if available. -- Keep 'dma.dmachans' module argument name for backwards compatibility. - -Make it available on ARCH_BCM2835 as well. - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: set residue_granularity field - -bcm2708-dmaengine supports residue reporting at burst level -but didn't report this via the residue_granularity field. - -Without this field set properly we get playback issues with I2S cards. - -dmaengine: bcm2708-dmaengine: Fix memory leak when stopping a running transfer - -bcm2708-dmaengine: Use more DMA channels (but not 12) - -1) Only the bcm2708_fb drivers uses the legacy DMA API, and -it requires a BULK-capable channel, so all other types -(FAST, NORMAL and LITE) can be made available to the regular -DMA API. - -2) DMA channels 11-14 share an interrupt. The driver can't -handle this, so don't use channels 12-14 (12 was used, probably -because it appears to have an interrupt, but in reality that -interrupt is for activity on ANY channel). This may explain -a lockup encountered when running out of DMA channels. - -The combined effect of this patch is to leave 7 DMA channels -available + channel 0 for bcm2708_fb via the legacy API. - -See: https://github.com/raspberrypi/linux/issues/1110 - https://github.com/raspberrypi/linux/issues/1108 - -dmaengine: bcm2708: Make legacy API available for bcm2835-dma - -bcm2708_fb uses the legacy DMA API, so in order to start using -bcm2835-dma, bcm2835-dma has to support the legacy API. Make this -possible by exporting bcm_dmaman_probe() and bcm_dmaman_remove(). - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: Change DT compatible string - -Both bcm2835-dma and bcm2708-dmaengine have the same compatible string. -So change compatible to "brcm,bcm2708-dma". - -Signed-off-by: Noralf Trønnes - -dmaengine: bcm2708: Remove driver but keep legacy API - -Dropping non-DT support means we don't need this driver, -but we still need the legacy DMA API. - -Signed-off-by: Noralf Trønnes - -bcm2708-dmaengine - Fix arm64 portability/build issues ---- - drivers/dma/Kconfig | 6 +- - drivers/dma/Makefile | 1 + - drivers/dma/bcm2708-dmaengine.c | 281 ++++++++++++++++++++++++++++++ - include/linux/platform_data/dma-bcm2708.h | 143 +++++++++++++++ - 4 files changed, 430 insertions(+), 1 deletion(-) - create mode 100644 drivers/dma/bcm2708-dmaengine.c - create mode 100644 include/linux/platform_data/dma-bcm2708.h - -diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index 9c931d36c6a499a02f4f215f8cd77d3f2254a3b9..9ccee1058e4c5c208a196d6d89e700d09754f977 100644 ---- a/drivers/dma/Kconfig -+++ b/drivers/dma/Kconfig -@@ -108,7 +108,7 @@ config COH901318 - - config DMA_BCM2835 - tristate "BCM2835 DMA engine support" -- depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 -+ depends on ARCH_BCM2835 - select DMA_ENGINE - select DMA_VIRTUAL_CHANNELS - -@@ -499,6 +499,10 @@ config TIMB_DMA - help - Enable support for the Timberdale FPGA DMA engine. - -+config DMA_BCM2708 -+ tristate "BCM2708 DMA legacy API support" -+ depends on DMA_BCM2835 -+ - config TI_CPPI41 - tristate "AM33xx CPPI41 DMA support" - depends on ARCH_OMAP -diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile -index e4dc9cac7ee8427184f821896364c232634a444f..58cc24730ed6ab4fd35a9cb182c4862f8f2d546f 100644 ---- a/drivers/dma/Makefile -+++ b/drivers/dma/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o - obj-$(CONFIG_AT_XDMAC) += at_xdmac.o - obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o - obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o -+obj-$(CONFIG_DMA_BCM2708) += bcm2708-dmaengine.o - obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o - obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o - obj-$(CONFIG_DMA_JZ4780) += dma-jz4780.o -diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c -new file mode 100644 -index 0000000000000000000000000000000000000000..0f4a26983e401c60647655dcb35afd58f37515a8 ---- /dev/null -+++ b/drivers/dma/bcm2708-dmaengine.c -@@ -0,0 +1,281 @@ -+/* -+ * BCM2708 legacy DMA API -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "virt-dma.h" -+ -+#define CACHE_LINE_MASK 31 -+#define DEFAULT_DMACHAN_BITMAP 0x10 /* channel 4 only */ -+ -+/* valid only for channels 0 - 14, 15 has its own base address */ -+#define BCM2708_DMA_CHAN(n) ((n) << 8) /* base address */ -+#define BCM2708_DMA_CHANIO(dma_base, n) \ -+ ((void __iomem *)((char *)(dma_base) + BCM2708_DMA_CHAN(n))) -+ -+struct vc_dmaman { -+ void __iomem *dma_base; -+ u32 chan_available; /* bitmap of available channels */ -+ u32 has_feature[BCM_DMA_FEATURE_COUNT]; /* bitmap of feature presence */ -+ struct mutex lock; -+}; -+ -+static struct device *dmaman_dev; /* we assume there's only one! */ -+static struct vc_dmaman *g_dmaman; /* DMA manager */ -+ -+/* DMA Auxiliary Functions */ -+ -+/* A DMA buffer on an arbitrary boundary may separate a cache line into a -+ section inside the DMA buffer and another section outside it. -+ Even if we flush DMA buffers from the cache there is always the chance that -+ during a DMA someone will access the part of a cache line that is outside -+ the DMA buffer - which will then bring in unwelcome data. -+ Without being able to dictate our own buffer pools we must insist that -+ DMA buffers consist of a whole number of cache lines. -+*/ -+extern int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len) -+{ -+ int i; -+ -+ for (i = 0; i < sg_len; i++) { -+ if (sg_ptr[i].offset & CACHE_LINE_MASK || -+ sg_ptr[i].length & CACHE_LINE_MASK) -+ return 0; -+ } -+ -+ return 1; -+} -+EXPORT_SYMBOL_GPL(bcm_sg_suitable_for_dma); -+ -+extern void bcm_dma_start(void __iomem *dma_chan_base, -+ dma_addr_t control_block) -+{ -+ dsb(sy); /* ARM data synchronization (push) operation */ -+ -+ writel(control_block, dma_chan_base + BCM2708_DMA_ADDR); -+ writel(BCM2708_DMA_ACTIVE, dma_chan_base + BCM2708_DMA_CS); -+} -+EXPORT_SYMBOL_GPL(bcm_dma_start); -+ -+extern void bcm_dma_wait_idle(void __iomem *dma_chan_base) -+{ -+ dsb(sy); -+ -+ /* ugly busy wait only option for now */ -+ while (readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE) -+ cpu_relax(); -+} -+EXPORT_SYMBOL_GPL(bcm_dma_wait_idle); -+ -+extern bool bcm_dma_is_busy(void __iomem *dma_chan_base) -+{ -+ dsb(sy); -+ -+ return readl(dma_chan_base + BCM2708_DMA_CS) & BCM2708_DMA_ACTIVE; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_is_busy); -+ -+/* Complete an ongoing DMA (assuming its results are to be ignored) -+ Does nothing if there is no DMA in progress. -+ This routine waits for the current AXI transfer to complete before -+ terminating the current DMA. If the current transfer is hung on a DREQ used -+ by an uncooperative peripheral the AXI transfer may never complete. In this -+ case the routine times out and return a non-zero error code. -+ Use of this routine doesn't guarantee that the ongoing or aborted DMA -+ does not produce an interrupt. -+*/ -+extern int bcm_dma_abort(void __iomem *dma_chan_base) -+{ -+ unsigned long int cs; -+ int rc = 0; -+ -+ cs = readl(dma_chan_base + BCM2708_DMA_CS); -+ -+ if (BCM2708_DMA_ACTIVE & cs) { -+ long int timeout = 10000; -+ -+ /* write 0 to the active bit - pause the DMA */ -+ writel(0, dma_chan_base + BCM2708_DMA_CS); -+ -+ /* wait for any current AXI transfer to complete */ -+ while (0 != (cs & BCM2708_DMA_ISPAUSED) && --timeout >= 0) -+ cs = readl(dma_chan_base + BCM2708_DMA_CS); -+ -+ if (0 != (cs & BCM2708_DMA_ISPAUSED)) { -+ /* we'll un-pause when we set of our next DMA */ -+ rc = -ETIMEDOUT; -+ -+ } else if (BCM2708_DMA_ACTIVE & cs) { -+ /* terminate the control block chain */ -+ writel(0, dma_chan_base + BCM2708_DMA_NEXTCB); -+ -+ /* abort the whole DMA */ -+ writel(BCM2708_DMA_ABORT | BCM2708_DMA_ACTIVE, -+ dma_chan_base + BCM2708_DMA_CS); -+ } -+ } -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_abort); -+ -+ /* DMA Manager Device Methods */ -+ -+static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base, -+ u32 chans_available) -+{ -+ dmaman->dma_base = dma_base; -+ dmaman->chan_available = chans_available; -+ dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* 2 & 3 */ -+ dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* 0 */ -+ dmaman->has_feature[BCM_DMA_FEATURE_NORMAL_ORD] = 0xfe; /* 1 to 7 */ -+ dmaman->has_feature[BCM_DMA_FEATURE_LITE_ORD] = 0x7f00; /* 8 to 14 */ -+} -+ -+static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman, -+ unsigned required_feature_set) -+{ -+ u32 chans; -+ int chan = 0; -+ int feature; -+ -+ chans = dmaman->chan_available; -+ for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++) -+ /* select the subset of available channels with the desired -+ features */ -+ if (required_feature_set & (1 << feature)) -+ chans &= dmaman->has_feature[feature]; -+ -+ if (!chans) -+ return -ENOENT; -+ -+ /* return the ordinal of the first channel in the bitmap */ -+ while (chans != 0 && (chans & 1) == 0) { -+ chans >>= 1; -+ chan++; -+ } -+ /* claim the channel */ -+ dmaman->chan_available &= ~(1 << chan); -+ -+ return chan; -+} -+ -+static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan) -+{ -+ if (chan < 0) -+ return -EINVAL; -+ -+ if ((1 << chan) & dmaman->chan_available) -+ return -EIDRM; -+ -+ dmaman->chan_available |= (1 << chan); -+ -+ return 0; -+} -+ -+/* DMA Manager Monitor */ -+ -+extern int bcm_dma_chan_alloc(unsigned required_feature_set, -+ void __iomem **out_dma_base, int *out_dma_irq) -+{ -+ struct vc_dmaman *dmaman = g_dmaman; -+ struct platform_device *pdev = to_platform_device(dmaman_dev); -+ struct resource *r; -+ int chan; -+ -+ if (!dmaman_dev) -+ return -ENODEV; -+ -+ mutex_lock(&dmaman->lock); -+ chan = vc_dmaman_chan_alloc(dmaman, required_feature_set); -+ if (chan < 0) -+ goto out; -+ -+ r = platform_get_resource(pdev, IORESOURCE_IRQ, (unsigned int)chan); -+ if (!r) { -+ dev_err(dmaman_dev, "failed to get irq for DMA channel %d\n", -+ chan); -+ vc_dmaman_chan_free(dmaman, chan); -+ chan = -ENOENT; -+ goto out; -+ } -+ -+ *out_dma_base = BCM2708_DMA_CHANIO(dmaman->dma_base, chan); -+ *out_dma_irq = r->start; -+ dev_dbg(dmaman_dev, -+ "Legacy API allocated channel=%d, base=%p, irq=%i\n", -+ chan, *out_dma_base, *out_dma_irq); -+ -+out: -+ mutex_unlock(&dmaman->lock); -+ -+ return chan; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_chan_alloc); -+ -+extern int bcm_dma_chan_free(int channel) -+{ -+ struct vc_dmaman *dmaman = g_dmaman; -+ int rc; -+ -+ if (!dmaman_dev) -+ return -ENODEV; -+ -+ mutex_lock(&dmaman->lock); -+ rc = vc_dmaman_chan_free(dmaman, channel); -+ mutex_unlock(&dmaman->lock); -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_dma_chan_free); -+ -+int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, -+ u32 chans_available) -+{ -+ struct device *dev = &pdev->dev; -+ struct vc_dmaman *dmaman; -+ -+ dmaman = devm_kzalloc(dev, sizeof(*dmaman), GFP_KERNEL); -+ if (!dmaman) -+ return -ENOMEM; -+ -+ mutex_init(&dmaman->lock); -+ vc_dmaman_init(dmaman, base, chans_available); -+ g_dmaman = dmaman; -+ dmaman_dev = dev; -+ -+ dev_info(dev, "DMA legacy API manager at %p, dmachans=0x%x\n", -+ base, chans_available); -+ -+ return 0; -+} -+EXPORT_SYMBOL(bcm_dmaman_probe); -+ -+int bcm_dmaman_remove(struct platform_device *pdev) -+{ -+ dmaman_dev = NULL; -+ -+ return 0; -+} -+EXPORT_SYMBOL(bcm_dmaman_remove); -+ -+MODULE_LICENSE("GPL"); -diff --git a/include/linux/platform_data/dma-bcm2708.h b/include/linux/platform_data/dma-bcm2708.h -new file mode 100644 -index 0000000000000000000000000000000000000000..c5bfff2765be4606077e6c8af73040ec13ee8974 ---- /dev/null -+++ b/include/linux/platform_data/dma-bcm2708.h -@@ -0,0 +1,143 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#ifndef _PLAT_BCM2708_DMA_H -+#define _PLAT_BCM2708_DMA_H -+ -+/* DMA CS Control and Status bits */ -+#define BCM2708_DMA_ACTIVE BIT(0) -+#define BCM2708_DMA_INT BIT(2) -+#define BCM2708_DMA_ISPAUSED BIT(4) /* Pause requested or not active */ -+#define BCM2708_DMA_ISHELD BIT(5) /* Is held by DREQ flow control */ -+#define BCM2708_DMA_ERR BIT(8) -+#define BCM2708_DMA_ABORT BIT(30) /* stop current CB, go to next, WO */ -+#define BCM2708_DMA_RESET BIT(31) /* WO, self clearing */ -+ -+/* DMA control block "info" field bits */ -+#define BCM2708_DMA_INT_EN BIT(0) -+#define BCM2708_DMA_TDMODE BIT(1) -+#define BCM2708_DMA_WAIT_RESP BIT(3) -+#define BCM2708_DMA_D_INC BIT(4) -+#define BCM2708_DMA_D_WIDTH BIT(5) -+#define BCM2708_DMA_D_DREQ BIT(6) -+#define BCM2708_DMA_S_INC BIT(8) -+#define BCM2708_DMA_S_WIDTH BIT(9) -+#define BCM2708_DMA_S_DREQ BIT(10) -+ -+#define BCM2708_DMA_BURST(x) (((x) & 0xf) << 12) -+#define BCM2708_DMA_PER_MAP(x) ((x) << 16) -+#define BCM2708_DMA_WAITS(x) (((x) & 0x1f) << 21) -+ -+#define BCM2708_DMA_DREQ_EMMC 11 -+#define BCM2708_DMA_DREQ_SDHOST 13 -+ -+#define BCM2708_DMA_CS 0x00 /* Control and Status */ -+#define BCM2708_DMA_ADDR 0x04 -+/* the current control block appears in the following registers - read only */ -+#define BCM2708_DMA_INFO 0x08 -+#define BCM2708_DMA_SOURCE_AD 0x0c -+#define BCM2708_DMA_DEST_AD 0x10 -+#define BCM2708_DMA_NEXTCB 0x1C -+#define BCM2708_DMA_DEBUG 0x20 -+ -+#define BCM2708_DMA4_CS (BCM2708_DMA_CHAN(4) + BCM2708_DMA_CS) -+#define BCM2708_DMA4_ADDR (BCM2708_DMA_CHAN(4) + BCM2708_DMA_ADDR) -+ -+#define BCM2708_DMA_TDMODE_LEN(w, h) ((h) << 16 | (w)) -+ -+/* When listing features we can ask for when allocating DMA channels give -+ those with higher priority smaller ordinal numbers */ -+#define BCM_DMA_FEATURE_FAST_ORD 0 -+#define BCM_DMA_FEATURE_BULK_ORD 1 -+#define BCM_DMA_FEATURE_NORMAL_ORD 2 -+#define BCM_DMA_FEATURE_LITE_ORD 3 -+#define BCM_DMA_FEATURE_FAST BIT(BCM_DMA_FEATURE_FAST_ORD) -+#define BCM_DMA_FEATURE_BULK BIT(BCM_DMA_FEATURE_BULK_ORD) -+#define BCM_DMA_FEATURE_NORMAL BIT(BCM_DMA_FEATURE_NORMAL_ORD) -+#define BCM_DMA_FEATURE_LITE BIT(BCM_DMA_FEATURE_LITE_ORD) -+#define BCM_DMA_FEATURE_COUNT 4 -+ -+struct bcm2708_dma_cb { -+ u32 info; -+ u32 src; -+ u32 dst; -+ u32 length; -+ u32 stride; -+ u32 next; -+ u32 pad[2]; -+}; -+ -+struct scatterlist; -+struct platform_device; -+ -+#ifdef CONFIG_DMA_BCM2708 -+ -+int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, int sg_len); -+void bcm_dma_start(void __iomem *dma_chan_base, dma_addr_t control_block); -+void bcm_dma_wait_idle(void __iomem *dma_chan_base); -+bool bcm_dma_is_busy(void __iomem *dma_chan_base); -+int bcm_dma_abort(void __iomem *dma_chan_base); -+ -+/* return channel no or -ve error */ -+int bcm_dma_chan_alloc(unsigned preferred_feature_set, -+ void __iomem **out_dma_base, int *out_dma_irq); -+int bcm_dma_chan_free(int channel); -+ -+int bcm_dmaman_probe(struct platform_device *pdev, void __iomem *base, -+ u32 chans_available); -+int bcm_dmaman_remove(struct platform_device *pdev); -+ -+#else /* CONFIG_DMA_BCM2708 */ -+ -+static inline int bcm_sg_suitable_for_dma(struct scatterlist *sg_ptr, -+ int sg_len) -+{ -+ return 0; -+} -+ -+static inline void bcm_dma_start(void __iomem *dma_chan_base, -+ dma_addr_t control_block) { } -+ -+static inline void bcm_dma_wait_idle(void __iomem *dma_chan_base) { } -+ -+static inline bool bcm_dma_is_busy(void __iomem *dma_chan_base) -+{ -+ return false; -+} -+ -+static inline int bcm_dma_abort(void __iomem *dma_chan_base) -+{ -+ return -EINVAL; -+} -+ -+static inline int bcm_dma_chan_alloc(unsigned preferred_feature_set, -+ void __iomem **out_dma_base, -+ int *out_dma_irq) -+{ -+ return -EINVAL; -+} -+ -+static inline int bcm_dma_chan_free(int channel) -+{ -+ return -EINVAL; -+} -+ -+static inline int bcm_dmaman_probe(struct platform_device *pdev, -+ void __iomem *base, u32 chans_available) -+{ -+ return 0; -+} -+ -+static inline int bcm_dmaman_remove(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+#endif /* CONFIG_DMA_BCM2708 */ -+ -+#endif /* _PLAT_BCM2708_DMA_H */ - -From b7d8765eb1e1bb854be09a08acabaf92cd1c45ab Mon Sep 17 00:00:00 2001 -From: gellert -Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 034/122] MMC: added alternative MMC driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -mmc: Disable CMD23 transfers on all cards - -Pending wire-level investigation of these types of transfers -and associated errors on bcm2835-mmc, disable for now. Fallback of -CMD18/CMD25 transfers will be used automatically by the MMC layer. - -Reported/Tested-by: Gellert Weisz - -mmc: bcm2835-mmc: enable DT support for all architectures - -Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. -Enable Device Tree support for all architectures. - -Signed-off-by: Noralf Trønnes - -mmc: bcm2835-mmc: fix probe error handling - -Probe error handling is broken in several places. -Simplify error handling by using device managed functions. -Replace pr_{err,info} with dev_{err,info}. - -Signed-off-by: Noralf Trønnes - -bcm2835-mmc: Add locks when accessing sdhost registers - -bcm2835-mmc: Add range of debug options for slowing things down - -bcm2835-mmc: Add option to disable some delays - -bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 - -bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 - -bcm2835-mmc: Adding overclocking option - -Allow a different clock speed to be substitued for a requested 50MHz. -This option is exposed using the "overclock_50" DT parameter. -Note that the mmc interface is restricted to EVEN integer divisions of -250MHz, and the highest sensible option is 63 (250/4 = 62.5), the -next being 125 (250/2) which is much too high. - -Use at your own risk. - -bcm2835-mmc: Round up the overclock, so 62 works for 62.5Mhz - -Also only warn once for each overclock setting. - -mmc: bcm2835-mmc: Make available on ARCH_BCM2835 - -Make the bcm2835-mmc driver available for use on ARCH_BCM2835. - -Signed-off-by: Noralf Trønnes - -BCM270x_DT: add bcm2835-mmc entry - -Add Device Tree entry for bcm2835-mmc. -In non-DT mode, don't add the device in the board file. - -Signed-off-by: Noralf Trønnes - -bcm2835-mmc: Don't overwrite MMC capabilities from DT - -bcm2835-mmc: Don't override bus width capabilities from devicetree - -Take out the force setting of the MMC_CAP_4_BIT_DATA host capability -so that the result read from devicetree via mmc_of_parse() is -preserved. - -bcm2835-mmc: Only claim one DMA channel - -With both MMC controllers enabled there are few DMA channels left. The -bcm2835-mmc driver only uses DMA in one direction at a time, so it -doesn't need to claim two channels. - -See: https://github.com/raspberrypi/linux/issues/1327 - -Signed-off-by: Phil Elwell ---- - drivers/mmc/core/quirks.c | 10 + - drivers/mmc/host/Kconfig | 29 + - drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-mmc.c | 1574 ++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 1614 insertions(+) - create mode 100644 drivers/mmc/host/bcm2835-mmc.c - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index ca9cade317c7eccee354bb1a075b091f59a62de1..5e9e3518e0eb6be78f6e2847846a90ddd0febb77 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -53,6 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -+#ifdef CONFIG_MMC_BCM2835 -+ extern unsigned mmc_debug; -+#endif - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -79,5 +82,12 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - f->vendor_fixup(card, f->data); - } - } -+ /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. -+ * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). -+ */ -+#ifdef CONFIG_MMC_BCM2835 -+ if (mmc_debug & (1<<13)) -+ card->quirks |= MMC_QUIRK_BLK_NO_CMD23; -+#endif - } - EXPORT_SYMBOL(mmc_fixup_device); -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 5274f503a39ad9c034e23b634ff0ec6634cbbd78..405d62909dd6ac5351684c002414cc02135d98ba 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -4,6 +4,35 @@ - - comment "MMC/SD/SDIO Host Controller Drivers" - -+config MMC_BCM2835 -+ tristate "MMC support on BCM2835" -+ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 -+ help -+ This selects the MMC Interface on BCM2835. -+ -+ If you have a controller with this interface, say Y or M here. -+ -+ If unsure, say N. -+ -+config MMC_BCM2835_DMA -+ bool "DMA support on BCM2835 Arasan controller" -+ depends on MMC_BCM2835 -+ help -+ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 -+ based chips. -+ -+ If unsure, say N. -+ -+config MMC_BCM2835_PIO_DMA_BARRIER -+ int "Block count limit for PIO transfers" -+ depends on MMC_BCM2835 && MMC_BCM2835_DMA -+ range 0 256 -+ default 2 -+ help -+ The inclusive limit in bytes under which PIO will be used instead of DMA -+ -+ If unsure, say 2 here. -+ - config MMC_ARMMMCI - tristate "ARM AMBA Multimedia Card Interface support" - depends on ARM_AMBA -diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index e2bdaaf431841535b936600af56b8e38f52f9845..5133b680970c93fbb9695f83296f0f70b4977240 100644 ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o - obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o - obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o - obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o -+obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o - obj-$(CONFIG_MMC_WBSD) += wbsd.o - obj-$(CONFIG_MMC_AU1X) += au1xmmc.o - obj-$(CONFIG_MMC_MTK) += mtk-sd.o -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a ---- /dev/null -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -0,0 +1,1574 @@ -+/* -+ * BCM2835 MMC host driver. -+ * -+ * Author: Gellert Weisz -+ * Copyright 2014 -+ * -+ * Based on -+ * sdhci-bcm2708.c by Broadcom -+ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko -+ * sdhci.c and sdhci-pci.c by Pierre Ossman -+ * -+ * 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 "sdhci.h" -+ -+ -+#define DRIVER_NAME "mmc-bcm2835" -+ -+#define DBG(f, x...) \ -+pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) -+ -+#ifndef CONFIG_MMC_BCM2835_DMA -+ #define FORCE_PIO -+#endif -+ -+ -+/* the inclusive limit in bytes under which PIO will be used instead of DMA */ -+#ifdef CONFIG_MMC_BCM2835_PIO_DMA_BARRIER -+#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_PIO_DMA_BARRIER -+#else -+#define PIO_DMA_BARRIER 00 -+#endif -+ -+#define MIN_FREQ 400000 -+#define TIMEOUT_VAL 0xE -+#define BCM2835_SDHCI_WRITE_DELAY(f) (((2 * 1000000) / f) + 1) -+ -+ -+unsigned mmc_debug; -+unsigned mmc_debug2; -+ -+struct bcm2835_host { -+ spinlock_t lock; -+ -+ void __iomem *ioaddr; -+ u32 bus_addr; -+ -+ struct mmc_host *mmc; -+ -+ u32 timeout; -+ -+ int clock; /* Current clock speed */ -+ u8 pwr; /* Current voltage */ -+ -+ unsigned int max_clk; /* Max possible freq */ -+ unsigned int timeout_clk; /* Timeout freq (KHz) */ -+ unsigned int clk_mul; /* Clock Muliplier value */ -+ -+ struct tasklet_struct finish_tasklet; /* Tasklet structures */ -+ -+ struct timer_list timer; /* Timer for timeouts */ -+ -+ struct sg_mapping_iter sg_miter; /* SG state for PIO */ -+ unsigned int blocks; /* remaining PIO blocks */ -+ -+ int irq; /* Device IRQ */ -+ -+ -+ u32 ier; /* cached registers */ -+ -+ struct mmc_request *mrq; /* Current request */ -+ struct mmc_command *cmd; /* Current command */ -+ struct mmc_data *data; /* Current data request */ -+ unsigned int data_early:1; /* Data finished before cmd */ -+ -+ wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ -+ -+ u32 thread_isr; -+ -+ u32 shadow; -+ -+ /*DMA part*/ -+ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ -+ struct dma_slave_config dma_cfg_rx; -+ struct dma_slave_config dma_cfg_tx; -+ struct dma_async_tx_descriptor *tx_desc; /* descriptor */ -+ -+ bool have_dma; -+ bool use_dma; -+ /*end of DMA part*/ -+ -+ int max_delay; /* maximum length of time spent waiting */ -+ -+ int flags; /* Host attributes */ -+#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */ -+#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */ -+#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ -+#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ -+#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ -+ -+ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ -+ u32 max_overclock; /* Highest reported */ -+}; -+ -+ -+static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) -+{ -+ unsigned delay; -+ lockdep_assert_held_once(&host->lock); -+ writel(val, host->ioaddr + reg); -+ udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); -+ -+ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -+ if (delay && !((1<lock); -+ writel(val, host->ioaddr + reg); -+ -+ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -+ if (delay) -+ udelay(delay); -+} -+ -+static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) -+{ -+ lockdep_assert_held_once(&host->lock); -+ return readl(host->ioaddr + reg); -+} -+ -+static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) -+{ -+ u32 oldval = (reg == SDHCI_COMMAND) ? host->shadow : -+ bcm2835_mmc_readl(host, reg & ~3); -+ u32 word_num = (reg >> 1) & 1; -+ u32 word_shift = word_num * 16; -+ u32 mask = 0xffff << word_shift; -+ u32 newval = (oldval & ~mask) | (val << word_shift); -+ -+ if (reg == SDHCI_TRANSFER_MODE) -+ host->shadow = newval; -+ else -+ bcm2835_mmc_writel(host, newval, reg & ~3, 0); -+ -+} -+ -+static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) -+{ -+ u32 oldval = bcm2835_mmc_readl(host, reg & ~3); -+ u32 byte_num = reg & 3; -+ u32 byte_shift = byte_num * 8; -+ u32 mask = 0xff << byte_shift; -+ u32 newval = (oldval & ~mask) | (val << byte_shift); -+ -+ bcm2835_mmc_writel(host, newval, reg & ~3, 1); -+} -+ -+ -+static inline u16 bcm2835_mmc_readw(struct bcm2835_host *host, int reg) -+{ -+ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); -+ u32 word_num = (reg >> 1) & 1; -+ u32 word_shift = word_num * 16; -+ u32 word = (val >> word_shift) & 0xffff; -+ -+ return word; -+} -+ -+static inline u8 bcm2835_mmc_readb(struct bcm2835_host *host, int reg) -+{ -+ u32 val = bcm2835_mmc_readl(host, (reg & ~3)); -+ u32 byte_num = reg & 3; -+ u32 byte_shift = byte_num * 8; -+ u32 byte = (val >> byte_shift) & 0xff; -+ -+ return byte; -+} -+ -+static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) -+{ -+ u32 ier; -+ -+ ier = bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE); -+ ier &= ~clear; -+ /* change which requests generate IRQs - makes no difference to -+ the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ -+ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); -+} -+ -+ -+static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) -+{ -+ pr_debug(DRIVER_NAME ": =========== REGISTER DUMP (%s)===========\n", -+ mmc_hostname(host->mmc)); -+ -+ pr_debug(DRIVER_NAME ": Sys addr: 0x%08x | Version: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_DMA_ADDRESS), -+ bcm2835_mmc_readw(host, SDHCI_HOST_VERSION)); -+ pr_debug(DRIVER_NAME ": Blk size: 0x%08x | Blk cnt: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_BLOCK_SIZE), -+ bcm2835_mmc_readw(host, SDHCI_BLOCK_COUNT)); -+ pr_debug(DRIVER_NAME ": Argument: 0x%08x | Trn mode: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_ARGUMENT), -+ bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE)); -+ pr_debug(DRIVER_NAME ": Present: 0x%08x | Host ctl: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE), -+ bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL)); -+ pr_debug(DRIVER_NAME ": Power: 0x%08x | Blk gap: 0x%08x\n", -+ bcm2835_mmc_readb(host, SDHCI_POWER_CONTROL), -+ bcm2835_mmc_readb(host, SDHCI_BLOCK_GAP_CONTROL)); -+ pr_debug(DRIVER_NAME ": Wake-up: 0x%08x | Clock: 0x%08x\n", -+ bcm2835_mmc_readb(host, SDHCI_WAKE_UP_CONTROL), -+ bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)); -+ pr_debug(DRIVER_NAME ": Timeout: 0x%08x | Int stat: 0x%08x\n", -+ bcm2835_mmc_readb(host, SDHCI_TIMEOUT_CONTROL), -+ bcm2835_mmc_readl(host, SDHCI_INT_STATUS)); -+ pr_debug(DRIVER_NAME ": Int enab: 0x%08x | Sig enab: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_INT_ENABLE), -+ bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE)); -+ pr_debug(DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_ACMD12_ERR), -+ bcm2835_mmc_readw(host, SDHCI_SLOT_INT_STATUS)); -+ pr_debug(DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n", -+ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES), -+ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES_1)); -+ pr_debug(DRIVER_NAME ": Cmd: 0x%08x | Max curr: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_COMMAND), -+ bcm2835_mmc_readl(host, SDHCI_MAX_CURRENT)); -+ pr_debug(DRIVER_NAME ": Host ctl2: 0x%08x\n", -+ bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2)); -+ -+ pr_debug(DRIVER_NAME ": ===========================================\n"); -+} -+ -+ -+static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) -+{ -+ unsigned long timeout; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); -+ -+ if (mask & SDHCI_RESET_ALL) -+ host->clock = 0; -+ -+ /* Wait max 100 ms */ -+ timeout = 100; -+ -+ /* hw clears the bit when it's done */ -+ while (bcm2835_mmc_readb(host, SDHCI_SOFTWARE_RESET) & mask) { -+ if (timeout == 0) { -+ pr_err("%s: Reset 0x%x never completed.\n", -+ mmc_hostname(host->mmc), (int)mask); -+ bcm2835_mmc_dumpregs(host); -+ return; -+ } -+ timeout--; -+ spin_unlock_irqrestore(&host->lock, flags); -+ mdelay(1); -+ spin_lock_irqsave(&host->lock, flags); -+ } -+ -+ if (100-timeout > 10 && 100-timeout > host->max_delay) { -+ host->max_delay = 100-timeout; -+ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); -+ } -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -+ -+static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) -+{ -+ unsigned long flags; -+ if (soft) -+ bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); -+ else -+ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -+ -+ host->ier = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | -+ SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | -+ SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC | -+ SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | -+ SDHCI_INT_RESPONSE; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (soft) { -+ /* force clock reconfiguration */ -+ host->clock = 0; -+ bcm2835_mmc_set_ios(host->mmc, &host->mmc->ios); -+ } -+} -+ -+ -+ -+static void bcm2835_mmc_finish_data(struct bcm2835_host *host); -+ -+static void bcm2835_mmc_dma_complete(void *param) -+{ -+ struct bcm2835_host *host = param; -+ struct dma_chan *dma_chan; -+ unsigned long flags; -+ u32 dir_data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { -+ /* otherwise handled in SDHCI IRQ */ -+ dma_chan = host->dma_chan_rxtx; -+ dir_data = DMA_FROM_DEVICE; -+ -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); -+ -+ bcm2835_mmc_finish_data(host); -+ } -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_bcm2835_mmc_read_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len, chunk; -+ -+ u32 uninitialized_var(scratch); -+ u8 *buf; -+ -+ blksize = host->data->blksz; -+ chunk = 0; -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); -+ -+ len = min(host->sg_miter.length, blksize); -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = host->sg_miter.addr; -+ -+ while (len) { -+ if (chunk == 0) { -+ scratch = bcm2835_mmc_readl(host, SDHCI_BUFFER); -+ chunk = 4; -+ } -+ -+ *buf = scratch & 0xFF; -+ -+ buf++; -+ scratch >>= 8; -+ chunk--; -+ len--; -+ } -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+static void bcm2835_bcm2835_mmc_write_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len, chunk; -+ u32 scratch; -+ u8 *buf; -+ -+ blksize = host->data->blksz; -+ chunk = 0; -+ chunk = 0; -+ scratch = 0; -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ if (!sg_miter_next(&host->sg_miter)) -+ BUG(); -+ -+ len = min(host->sg_miter.length, blksize); -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = host->sg_miter.addr; -+ -+ while (len) { -+ scratch |= (u32)*buf << (chunk * 8); -+ -+ buf++; -+ chunk++; -+ len--; -+ -+ if ((chunk == 4) || ((len == 0) && (blksize == 0))) { -+ mmc_raw_writel(host, scratch, SDHCI_BUFFER); -+ chunk = 0; -+ scratch = 0; -+ } -+ } -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+ -+static void bcm2835_mmc_transfer_pio(struct bcm2835_host *host) -+{ -+ u32 mask; -+ -+ BUG_ON(!host->data); -+ -+ if (host->blocks == 0) -+ return; -+ -+ if (host->data->flags & MMC_DATA_READ) -+ mask = SDHCI_DATA_AVAILABLE; -+ else -+ mask = SDHCI_SPACE_AVAILABLE; -+ -+ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { -+ -+ if (host->data->flags & MMC_DATA_READ) -+ bcm2835_bcm2835_mmc_read_block_pio(host); -+ else -+ bcm2835_bcm2835_mmc_write_block_pio(host); -+ -+ host->blocks--; -+ -+ /* QUIRK used in sdhci.c removes the 'if' */ -+ /* but it seems this is unnecessary */ -+ if (host->blocks == 0) -+ break; -+ -+ -+ } -+} -+ -+ -+static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) -+{ -+ u32 len, dir_data, dir_slave; -+ struct dma_async_tx_descriptor *desc = NULL; -+ struct dma_chan *dma_chan; -+ -+ -+ WARN_ON(!host->data); -+ -+ if (!host->data) -+ return; -+ -+ if (host->blocks == 0) -+ return; -+ -+ dma_chan = host->dma_chan_rxtx; -+ if (host->data->flags & MMC_DATA_READ) { -+ dir_data = DMA_FROM_DEVICE; -+ dir_slave = DMA_DEV_TO_MEM; -+ } else { -+ dir_data = DMA_TO_DEVICE; -+ dir_slave = DMA_MEM_TO_DEV; -+ } -+ -+ /* The parameters have already been validated, so this will not fail */ -+ (void)dmaengine_slave_config(dma_chan, -+ (dir_data == DMA_FROM_DEVICE) ? -+ &host->dma_cfg_rx : -+ &host->dma_cfg_tx); -+ -+ BUG_ON(!dma_chan->device); -+ BUG_ON(!dma_chan->device->dev); -+ BUG_ON(!host->data->sg); -+ -+ len = dma_map_sg(dma_chan->device->dev, host->data->sg, -+ host->data->sg_len, dir_data); -+ if (len > 0) { -+ desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, -+ len, dir_slave, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ } else { -+ dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); -+ } -+ if (desc) { -+ unsigned long flags; -+ spin_lock_irqsave(&host->lock, flags); -+ bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | -+ SDHCI_INT_SPACE_AVAIL); -+ host->tx_desc = desc; -+ desc->callback = bcm2835_mmc_dma_complete; -+ desc->callback_param = host; -+ spin_unlock_irqrestore(&host->lock, flags); -+ dmaengine_submit(desc); -+ dma_async_issue_pending(dma_chan); -+ } -+ -+} -+ -+ -+ -+static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) -+{ -+ u32 pio_irqs = SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; -+ u32 dma_irqs = SDHCI_INT_DMA_END | SDHCI_INT_ADMA_ERROR; -+ -+ if (host->use_dma) -+ host->ier = (host->ier & ~pio_irqs) | dma_irqs; -+ else -+ host->ier = (host->ier & ~dma_irqs) | pio_irqs; -+ -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); -+} -+ -+ -+static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) -+{ -+ u8 count; -+ struct mmc_data *data = cmd->data; -+ -+ WARN_ON(host->data); -+ -+ if (data || (cmd->flags & MMC_RSP_BUSY)) { -+ count = TIMEOUT_VAL; -+ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); -+ } -+ -+ if (!data) -+ return; -+ -+ /* Sanity checks */ -+ BUG_ON(data->blksz * data->blocks > 524288); -+ BUG_ON(data->blksz > host->mmc->max_blk_size); -+ BUG_ON(data->blocks > 65535); -+ -+ host->data = data; -+ host->data_early = 0; -+ host->data->bytes_xfered = 0; -+ -+ -+ if (!(host->flags & SDHCI_REQ_USE_DMA)) { -+ int flags; -+ -+ flags = SG_MITER_ATOMIC; -+ if (host->data->flags & MMC_DATA_READ) -+ flags |= SG_MITER_TO_SG; -+ else -+ flags |= SG_MITER_FROM_SG; -+ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); -+ host->blocks = data->blocks; -+ } -+ -+ host->use_dma = host->have_dma && data->blocks > PIO_DMA_BARRIER; -+ -+ bcm2835_mmc_set_transfer_irqs(host); -+ -+ /* Set the DMA boundary value and block size */ -+ bcm2835_mmc_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, -+ data->blksz), SDHCI_BLOCK_SIZE); -+ bcm2835_mmc_writew(host, data->blocks, SDHCI_BLOCK_COUNT); -+ -+ BUG_ON(!host->data); -+} -+ -+static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, -+ struct mmc_command *cmd) -+{ -+ u16 mode; -+ struct mmc_data *data = cmd->data; -+ -+ if (data == NULL) { -+ /* clear Auto CMD settings for no data CMDs */ -+ mode = bcm2835_mmc_readw(host, SDHCI_TRANSFER_MODE); -+ bcm2835_mmc_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 | -+ SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE); -+ return; -+ } -+ -+ WARN_ON(!host->data); -+ -+ mode = SDHCI_TRNS_BLK_CNT_EN; -+ -+ if ((mmc_op_multi(cmd->opcode) || data->blocks > 1)) { -+ mode |= SDHCI_TRNS_MULTI; -+ -+ /* -+ * If we are sending CMD23, CMD12 never gets sent -+ * on successful completion (so no Auto-CMD12). -+ */ -+ if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) -+ mode |= SDHCI_TRNS_AUTO_CMD12; -+ else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { -+ mode |= SDHCI_TRNS_AUTO_CMD23; -+ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); -+ } -+ } -+ -+ if (data->flags & MMC_DATA_READ) -+ mode |= SDHCI_TRNS_READ; -+ if (host->flags & SDHCI_REQ_USE_DMA) -+ mode |= SDHCI_TRNS_DMA; -+ -+ bcm2835_mmc_writew(host, mode, SDHCI_TRANSFER_MODE); -+} -+ -+void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd) -+{ -+ int flags; -+ u32 mask; -+ unsigned long timeout; -+ -+ WARN_ON(host->cmd); -+ -+ /* Wait max 10 ms */ -+ timeout = 1000; -+ -+ mask = SDHCI_CMD_INHIBIT; -+ if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) -+ mask |= SDHCI_DATA_INHIBIT; -+ -+ /* We shouldn't wait for data inihibit for stop commands, even -+ though they might use busy signaling */ -+ if (host->mrq->data && (cmd == host->mrq->data->stop)) -+ mask &= ~SDHCI_DATA_INHIBIT; -+ -+ while (bcm2835_mmc_readl(host, SDHCI_PRESENT_STATE) & mask) { -+ if (timeout == 0) { -+ pr_err("%s: Controller never released inhibit bit(s).\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_mmc_dumpregs(host); -+ cmd->error = -EIO; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ timeout--; -+ udelay(10); -+ } -+ -+ if ((1000-timeout)/100 > 1 && (1000-timeout)/100 > host->max_delay) { -+ host->max_delay = (1000-timeout)/100; -+ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); -+ } -+ -+ timeout = jiffies; -+ if (!cmd->data && cmd->busy_timeout > 9000) -+ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; -+ else -+ timeout += 10 * HZ; -+ mod_timer(&host->timer, timeout); -+ -+ host->cmd = cmd; -+ -+ bcm2835_mmc_prepare_data(host, cmd); -+ -+ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); -+ -+ bcm2835_mmc_set_transfer_mode(host, cmd); -+ -+ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { -+ pr_err("%s: Unsupported response type!\n", -+ mmc_hostname(host->mmc)); -+ cmd->error = -EINVAL; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ -+ if (!(cmd->flags & MMC_RSP_PRESENT)) -+ flags = SDHCI_CMD_RESP_NONE; -+ else if (cmd->flags & MMC_RSP_136) -+ flags = SDHCI_CMD_RESP_LONG; -+ else if (cmd->flags & MMC_RSP_BUSY) -+ flags = SDHCI_CMD_RESP_SHORT_BUSY; -+ else -+ flags = SDHCI_CMD_RESP_SHORT; -+ -+ if (cmd->flags & MMC_RSP_CRC) -+ flags |= SDHCI_CMD_CRC; -+ if (cmd->flags & MMC_RSP_OPCODE) -+ flags |= SDHCI_CMD_INDEX; -+ -+ if (cmd->data) -+ flags |= SDHCI_CMD_DATA; -+ -+ bcm2835_mmc_writew(host, SDHCI_MAKE_CMD(cmd->opcode, flags), SDHCI_COMMAND); -+} -+ -+ -+static void bcm2835_mmc_finish_data(struct bcm2835_host *host) -+{ -+ struct mmc_data *data; -+ -+ BUG_ON(!host->data); -+ -+ data = host->data; -+ host->data = NULL; -+ -+ if (data->error) -+ data->bytes_xfered = 0; -+ else -+ data->bytes_xfered = data->blksz * data->blocks; -+ -+ /* -+ * Need to send CMD12 if - -+ * a) open-ended multiblock transfer (no CMD23) -+ * b) error in multiblock transfer -+ */ -+ if (data->stop && -+ (data->error || -+ !host->mrq->sbc)) { -+ -+ /* -+ * The controller needs a reset of internal state machines -+ * upon error conditions. -+ */ -+ if (data->error) { -+ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); -+ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -+ } -+ -+ bcm2835_mmc_send_command(host, data->stop); -+ } else -+ tasklet_schedule(&host->finish_tasklet); -+} -+ -+static void bcm2835_mmc_finish_command(struct bcm2835_host *host) -+{ -+ int i; -+ -+ BUG_ON(host->cmd == NULL); -+ -+ if (host->cmd->flags & MMC_RSP_PRESENT) { -+ if (host->cmd->flags & MMC_RSP_136) { -+ /* CRC is stripped so we need to do some shifting. */ -+ for (i = 0; i < 4; i++) { -+ host->cmd->resp[i] = bcm2835_mmc_readl(host, -+ SDHCI_RESPONSE + (3-i)*4) << 8; -+ if (i != 3) -+ host->cmd->resp[i] |= -+ bcm2835_mmc_readb(host, -+ SDHCI_RESPONSE + (3-i)*4-1); -+ } -+ } else { -+ host->cmd->resp[0] = bcm2835_mmc_readl(host, SDHCI_RESPONSE); -+ } -+ } -+ -+ host->cmd->error = 0; -+ -+ /* Finished CMD23, now send actual command. */ -+ if (host->cmd == host->mrq->sbc) { -+ host->cmd = NULL; -+ bcm2835_mmc_send_command(host, host->mrq->cmd); -+ -+ if (host->mrq->cmd->data && host->use_dma) { -+ /* DMA transfer starts now, PIO starts after interrupt */ -+ bcm2835_mmc_transfer_dma(host); -+ } -+ } else { -+ -+ /* Processed actual command. */ -+ if (host->data && host->data_early) -+ bcm2835_mmc_finish_data(host); -+ -+ if (!host->cmd->data) -+ tasklet_schedule(&host->finish_tasklet); -+ -+ host->cmd = NULL; -+ } -+} -+ -+ -+static void bcm2835_mmc_timeout_timer(unsigned long data) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = (struct bcm2835_host *)data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (host->mrq) { -+ pr_err("%s: Timeout waiting for hardware interrupt.\n", -+ mmc_hostname(host->mmc)); -+ bcm2835_mmc_dumpregs(host); -+ -+ if (host->data) { -+ host->data->error = -ETIMEDOUT; -+ bcm2835_mmc_finish_data(host); -+ } else { -+ if (host->cmd) -+ host->cmd->error = -ETIMEDOUT; -+ else -+ host->mrq->cmd->error = -ETIMEDOUT; -+ -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ } -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+ -+static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) -+{ -+ if (!(host->flags & SDHCI_DEVICE_DEAD)) { -+ if (enable) -+ host->ier |= SDHCI_INT_CARD_INT; -+ else -+ host->ier &= ~SDHCI_INT_CARD_INT; -+ -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); -+ mmiowb(); -+ } -+} -+ -+static void bcm2835_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) -+{ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ if (enable) -+ host->flags |= SDHCI_SDIO_IRQ_ENABLED; -+ else -+ host->flags &= ~SDHCI_SDIO_IRQ_ENABLED; -+ -+ bcm2835_mmc_enable_sdio_irq_nolock(host, enable); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_mmc_cmd_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ -+ BUG_ON(intmask == 0); -+ -+ if (!host->cmd) { -+ pr_err("%s: Got command interrupt 0x%08x even " -+ "though no command operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_mmc_dumpregs(host); -+ return; -+ } -+ -+ if (intmask & SDHCI_INT_TIMEOUT) -+ host->cmd->error = -ETIMEDOUT; -+ else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT | -+ SDHCI_INT_INDEX)) { -+ host->cmd->error = -EILSEQ; -+ } -+ -+ if (host->cmd->error) { -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ -+ if (intmask & SDHCI_INT_RESPONSE) -+ bcm2835_mmc_finish_command(host); -+ -+} -+ -+static void bcm2835_mmc_data_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ struct dma_chan *dma_chan; -+ u32 dir_data; -+ -+ BUG_ON(intmask == 0); -+ -+ if (!host->data) { -+ /* -+ * The "data complete" interrupt is also used to -+ * indicate that a busy state has ended. See comment -+ * above in sdhci_cmd_irq(). -+ */ -+ if (host->cmd && (host->cmd->flags & MMC_RSP_BUSY)) { -+ if (intmask & SDHCI_INT_DATA_END) { -+ bcm2835_mmc_finish_command(host); -+ return; -+ } -+ } -+ -+ pr_debug("%s: Got data interrupt 0x%08x even " -+ "though no data operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_mmc_dumpregs(host); -+ -+ return; -+ } -+ -+ if (intmask & SDHCI_INT_DATA_TIMEOUT) -+ host->data->error = -ETIMEDOUT; -+ else if (intmask & SDHCI_INT_DATA_END_BIT) -+ host->data->error = -EILSEQ; -+ else if ((intmask & SDHCI_INT_DATA_CRC) && -+ SDHCI_GET_CMD(bcm2835_mmc_readw(host, SDHCI_COMMAND)) -+ != MMC_BUS_TEST_R) -+ host->data->error = -EILSEQ; -+ -+ if (host->use_dma) { -+ if (host->data->flags & MMC_DATA_WRITE) { -+ /* IRQ handled here */ -+ -+ dma_chan = host->dma_chan_rxtx; -+ dir_data = DMA_TO_DEVICE; -+ dma_unmap_sg(dma_chan->device->dev, -+ host->data->sg, host->data->sg_len, -+ dir_data); -+ -+ bcm2835_mmc_finish_data(host); -+ } -+ -+ } else { -+ if (host->data->error) -+ bcm2835_mmc_finish_data(host); -+ else { -+ if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) -+ bcm2835_mmc_transfer_pio(host); -+ -+ if (intmask & SDHCI_INT_DATA_END) { -+ if (host->cmd) { -+ /* -+ * Data managed to finish before the -+ * command completed. Make sure we do -+ * things in the proper order. -+ */ -+ host->data_early = 1; -+ } else { -+ bcm2835_mmc_finish_data(host); -+ } -+ } -+ } -+ } -+} -+ -+ -+static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) -+{ -+ irqreturn_t result = IRQ_NONE; -+ struct bcm2835_host *host = dev_id; -+ u32 intmask, mask, unexpected = 0; -+ int max_loops = 16; -+ -+ spin_lock(&host->lock); -+ -+ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); -+ -+ if (!intmask || intmask == 0xffffffff) { -+ result = IRQ_NONE; -+ goto out; -+ } -+ -+ do { -+ /* Clear selected interrupts. */ -+ mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | -+ SDHCI_INT_BUS_POWER); -+ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); -+ -+ -+ if (intmask & SDHCI_INT_CMD_MASK) -+ bcm2835_mmc_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); -+ -+ if (intmask & SDHCI_INT_DATA_MASK) -+ bcm2835_mmc_data_irq(host, intmask & SDHCI_INT_DATA_MASK); -+ -+ if (intmask & SDHCI_INT_BUS_POWER) -+ pr_err("%s: Card is consuming too much power!\n", -+ mmc_hostname(host->mmc)); -+ -+ if (intmask & SDHCI_INT_CARD_INT) { -+ bcm2835_mmc_enable_sdio_irq_nolock(host, false); -+ host->thread_isr |= SDHCI_INT_CARD_INT; -+ result = IRQ_WAKE_THREAD; -+ } -+ -+ intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE | -+ SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | -+ SDHCI_INT_ERROR | SDHCI_INT_BUS_POWER | -+ SDHCI_INT_CARD_INT); -+ -+ if (intmask) { -+ unexpected |= intmask; -+ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); -+ } -+ -+ if (result == IRQ_NONE) -+ result = IRQ_HANDLED; -+ -+ intmask = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); -+ } while (intmask && --max_loops); -+out: -+ spin_unlock(&host->lock); -+ -+ if (unexpected) { -+ pr_err("%s: Unexpected interrupt 0x%08x.\n", -+ mmc_hostname(host->mmc), unexpected); -+ bcm2835_mmc_dumpregs(host); -+ } -+ -+ return result; -+} -+ -+static irqreturn_t bcm2835_mmc_thread_irq(int irq, void *dev_id) -+{ -+ struct bcm2835_host *host = dev_id; -+ unsigned long flags; -+ u32 isr; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ isr = host->thread_isr; -+ host->thread_isr = 0; -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (isr & SDHCI_INT_CARD_INT) { -+ sdio_run_irqs(host->mmc); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ if (host->flags & SDHCI_SDIO_IRQ_ENABLED) -+ bcm2835_mmc_enable_sdio_irq_nolock(host, true); -+ spin_unlock_irqrestore(&host->lock, flags); -+ } -+ -+ return isr ? IRQ_HANDLED : IRQ_NONE; -+} -+ -+ -+ -+void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) -+{ -+ int div = 0; /* Initialized for compiler warning */ -+ int real_div = div, clk_mul = 1; -+ u16 clk = 0; -+ unsigned long timeout; -+ unsigned int input_clock = clock; -+ -+ if (host->overclock_50 && (clock == 50000000)) -+ clock = host->overclock_50 * 1000000 + 999999; -+ -+ host->mmc->actual_clock = 0; -+ -+ bcm2835_mmc_writew(host, 0, SDHCI_CLOCK_CONTROL); -+ -+ if (clock == 0) -+ return; -+ -+ /* Version 3.00 divisors must be a multiple of 2. */ -+ if (host->max_clk <= clock) -+ div = 1; -+ else { -+ for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; -+ div += 2) { -+ if ((host->max_clk / div) <= clock) -+ break; -+ } -+ } -+ -+ real_div = div; -+ div >>= 1; -+ -+ if (real_div) -+ clock = (host->max_clk * clk_mul) / real_div; -+ host->mmc->actual_clock = clock; -+ -+ if ((clock > input_clock) && (clock > host->max_overclock)) { -+ pr_warn("%s: Overclocking to %dHz\n", -+ mmc_hostname(host->mmc), clock); -+ host->max_overclock = clock; -+ } -+ -+ clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; -+ clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) -+ << SDHCI_DIVIDER_HI_SHIFT; -+ clk |= SDHCI_CLOCK_INT_EN; -+ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); -+ -+ /* Wait max 20 ms */ -+ timeout = 20; -+ while (!((clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL)) -+ & SDHCI_CLOCK_INT_STABLE)) { -+ if (timeout == 0) { -+ pr_err("%s: Internal clock never " -+ "stabilised.\n", mmc_hostname(host->mmc)); -+ bcm2835_mmc_dumpregs(host); -+ return; -+ } -+ timeout--; -+ mdelay(1); -+ } -+ -+ if (20-timeout > 10 && 20-timeout > host->max_delay) { -+ host->max_delay = 20-timeout; -+ pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); -+ } -+ -+ clk |= SDHCI_CLOCK_CARD_EN; -+ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); -+} -+ -+static void bcm2835_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = mmc_priv(mmc); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ WARN_ON(host->mrq != NULL); -+ -+ host->mrq = mrq; -+ -+ if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) -+ bcm2835_mmc_send_command(host, mrq->sbc); -+ else -+ bcm2835_mmc_send_command(host, mrq->cmd); -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (!(mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23)) && mrq->cmd->data && host->use_dma) { -+ /* DMA transfer starts now, PIO starts after interrupt */ -+ bcm2835_mmc_transfer_dma(host); -+ } -+} -+ -+ -+static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) -+{ -+ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ u8 ctrl; -+ u16 clk, ctrl_2; -+ -+ pr_debug("bcm2835_mmc_set_ios: clock %d, pwr %d, bus_width %d, timing %d, vdd %d, drv_type %d\n", -+ ios->clock, ios->power_mode, ios->bus_width, -+ ios->timing, ios->signal_voltage, ios->drv_type); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ if (!ios->clock || ios->clock != host->clock) { -+ bcm2835_mmc_set_clock(host, ios->clock); -+ host->clock = ios->clock; -+ } -+ -+ if (host->pwr != SDHCI_POWER_330) { -+ host->pwr = SDHCI_POWER_330; -+ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); -+ } -+ -+ ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); -+ -+ /* set bus width */ -+ ctrl &= ~SDHCI_CTRL_8BITBUS; -+ if (ios->bus_width == MMC_BUS_WIDTH_4) -+ ctrl |= SDHCI_CTRL_4BITBUS; -+ else -+ ctrl &= ~SDHCI_CTRL_4BITBUS; -+ -+ ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ -+ -+ -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ /* -+ * We only need to set Driver Strength if the -+ * preset value enable is not set. -+ */ -+ ctrl_2 = bcm2835_mmc_readw(host, SDHCI_HOST_CONTROL2); -+ ctrl_2 &= ~SDHCI_CTRL_DRV_TYPE_MASK; -+ if (ios->drv_type == MMC_SET_DRIVER_TYPE_A) -+ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_A; -+ else if (ios->drv_type == MMC_SET_DRIVER_TYPE_C) -+ ctrl_2 |= SDHCI_CTRL_DRV_TYPE_C; -+ -+ bcm2835_mmc_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); -+ -+ /* Reset SD Clock Enable */ -+ clk = bcm2835_mmc_readw(host, SDHCI_CLOCK_CONTROL); -+ clk &= ~SDHCI_CLOCK_CARD_EN; -+ bcm2835_mmc_writew(host, clk, SDHCI_CLOCK_CONTROL); -+ -+ /* Re-enable SD Clock */ -+ bcm2835_mmc_set_clock(host, host->clock); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ -+ mmiowb(); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+ -+static struct mmc_host_ops bcm2835_ops = { -+ .request = bcm2835_mmc_request, -+ .set_ios = bcm2835_mmc_set_ios, -+ .enable_sdio_irq = bcm2835_mmc_enable_sdio_irq, -+}; -+ -+ -+static void bcm2835_mmc_tasklet_finish(unsigned long param) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ struct mmc_request *mrq; -+ -+ host = (struct bcm2835_host *)param; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. -+ */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ del_timer(&host->timer); -+ -+ mrq = host->mrq; -+ -+ /* -+ * The controller needs a reset of internal state machines -+ * upon error conditions. -+ */ -+ if (!(host->flags & SDHCI_DEVICE_DEAD) && -+ ((mrq->cmd && mrq->cmd->error) || -+ (mrq->data && (mrq->data->error || -+ (mrq->data->stop && mrq->data->stop->error))))) { -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ bcm2835_mmc_reset(host, SDHCI_RESET_CMD); -+ bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -+ spin_lock_irqsave(&host->lock, flags); -+ } -+ -+ host->mrq = NULL; -+ host->cmd = NULL; -+ host->data = NULL; -+ -+ mmiowb(); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ mmc_request_done(host->mmc, mrq); -+} -+ -+ -+ -+static int bcm2835_mmc_add_host(struct bcm2835_host *host) -+{ -+ struct mmc_host *mmc = host->mmc; -+ struct device *dev = mmc->parent; -+#ifndef FORCE_PIO -+ struct dma_slave_config cfg; -+#endif -+ int ret; -+ -+ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -+ -+ host->clk_mul = 0; -+ -+ mmc->f_max = host->max_clk; -+ mmc->f_max = host->max_clk; -+ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; -+ -+ /* SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK */ -+ host->timeout_clk = mmc->f_max / 1000; -+ mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; -+ -+ /* host controller capabilities */ -+ mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | -+ MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | -+ MMC_CAP_MMC_HIGHSPEED; -+ -+ mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; -+ -+ host->flags = SDHCI_AUTO_CMD23; -+ -+ dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); -+#ifdef FORCE_PIO -+ dev_info(dev, "Forcing PIO mode\n"); -+ host->have_dma = false; -+#else -+ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { -+ dev_err(dev, "%s: Unable to initialise DMA channel. Falling back to PIO\n", -+ DRIVER_NAME); -+ host->have_dma = false; -+ } else { -+ dev_info(dev, "DMA channel allocated"); -+ -+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.slave_id = 11; /* DREQ channel */ -+ -+ /* Validate the slave configurations */ -+ -+ cfg.direction = DMA_MEM_TO_DEV; -+ cfg.src_addr = 0; -+ cfg.dst_addr = host->bus_addr + SDHCI_BUFFER; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ -+ if (ret == 0) { -+ host->dma_cfg_tx = cfg; -+ -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDHCI_BUFFER; -+ cfg.dst_addr = 0; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ } -+ -+ if (ret == 0) { -+ host->dma_cfg_rx = cfg; -+ -+ host->use_dma = true; -+ } else { -+ pr_err("%s: unable to configure DMA channel. " -+ "Faling back to PIO\n", -+ mmc_hostname(mmc)); -+ dma_release_channel(host->dma_chan_rxtx); -+ host->dma_chan_rxtx = NULL; -+ host->use_dma = false; -+ } -+ } -+#endif -+ mmc->max_segs = 128; -+ mmc->max_req_size = 524288; -+ mmc->max_seg_size = mmc->max_req_size; -+ mmc->max_blk_size = 512; -+ mmc->max_blk_count = 65535; -+ -+ /* report supported voltage ranges */ -+ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; -+ -+ tasklet_init(&host->finish_tasklet, -+ bcm2835_mmc_tasklet_finish, (unsigned long)host); -+ -+ setup_timer(&host->timer, bcm2835_mmc_timeout_timer, (unsigned long)host); -+ init_waitqueue_head(&host->buf_ready_int); -+ -+ bcm2835_mmc_init(host, 0); -+ ret = devm_request_threaded_irq(dev, host->irq, bcm2835_mmc_irq, -+ bcm2835_mmc_thread_irq, IRQF_SHARED, -+ mmc_hostname(mmc), host); -+ if (ret) { -+ dev_err(dev, "Failed to request IRQ %d: %d\n", host->irq, ret); -+ goto untasklet; -+ } -+ -+ mmiowb(); -+ mmc_add_host(mmc); -+ -+ return 0; -+ -+untasklet: -+ tasklet_kill(&host->finish_tasklet); -+ -+ return ret; -+} -+ -+static int bcm2835_mmc_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node; -+ struct clk *clk; -+ struct resource *iomem; -+ struct bcm2835_host *host; -+ struct mmc_host *mmc; -+ const __be32 *addr; -+ int ret; -+ -+ mmc = mmc_alloc_host(sizeof(*host), dev); -+ if (!mmc) -+ return -ENOMEM; -+ -+ mmc->ops = &bcm2835_ops; -+ host = mmc_priv(mmc); -+ host->mmc = mmc; -+ host->timeout = msecs_to_jiffies(1000); -+ spin_lock_init(&host->lock); -+ -+ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ host->ioaddr = devm_ioremap_resource(dev, iomem); -+ if (IS_ERR(host->ioaddr)) { -+ ret = PTR_ERR(host->ioaddr); -+ goto err; -+ } -+ -+ addr = of_get_address(node, 0, NULL, NULL); -+ if (!addr) { -+ dev_err(dev, "could not get DMA-register address\n"); -+ return -ENODEV; -+ } -+ host->bus_addr = be32_to_cpup(addr); -+ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", -+ (unsigned long)host->ioaddr, -+ (unsigned long)iomem->start, -+ (unsigned long)host->bus_addr); -+ -+#ifndef FORCE_PIO -+ if (node) { -+ host->dma_chan_rxtx = dma_request_slave_channel(dev, "rx-tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "rx"); -+ } else { -+ dma_cap_mask_t mask; -+ -+ dma_cap_zero(mask); -+ /* we don't care about the channel, any would work */ -+ dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_rxtx = dma_request_channel(mask, NULL, NULL); -+ } -+#endif -+ clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(clk)) { -+ ret = PTR_ERR(clk); -+ if (ret == -EPROBE_DEFER) -+ dev_info(dev, "could not get clk, deferring probe\n"); -+ else -+ dev_err(dev, "could not get clk\n"); -+ goto err; -+ } -+ -+ host->max_clk = clk_get_rate(clk); -+ -+ host->irq = platform_get_irq(pdev, 0); -+ if (host->irq <= 0) { -+ dev_err(dev, "get IRQ failed\n"); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ if (node) { -+ mmc_of_parse(mmc); -+ -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,overclock-50", -+ &host->overclock_50); -+ } else { -+ mmc->caps |= MMC_CAP_4_BIT_DATA; -+ } -+ -+ ret = bcm2835_mmc_add_host(host); -+ if (ret) -+ goto err; -+ -+ platform_set_drvdata(pdev, host); -+ -+ return 0; -+err: -+ mmc_free_host(mmc); -+ -+ return ret; -+} -+ -+static int bcm2835_mmc_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_host *host = platform_get_drvdata(pdev); -+ unsigned long flags; -+ int dead; -+ u32 scratch; -+ -+ dead = 0; -+ scratch = bcm2835_mmc_readl(host, SDHCI_INT_STATUS); -+ if (scratch == (u32)-1) -+ dead = 1; -+ -+ -+ if (dead) { -+ spin_lock_irqsave(&host->lock, flags); -+ -+ host->flags |= SDHCI_DEVICE_DEAD; -+ -+ if (host->mrq) { -+ pr_err("%s: Controller removed during " -+ " transfer!\n", mmc_hostname(host->mmc)); -+ -+ host->mrq->cmd->error = -ENOMEDIUM; -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ } -+ -+ mmc_remove_host(host->mmc); -+ -+ if (!dead) -+ bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -+ -+ free_irq(host->irq, host); -+ -+ del_timer_sync(&host->timer); -+ -+ tasklet_kill(&host->finish_tasklet); -+ -+ mmc_free_host(host->mmc); -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+ -+ -+static const struct of_device_id bcm2835_mmc_match[] = { -+ { .compatible = "brcm,bcm2835-mmc" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_mmc_match); -+ -+ -+ -+static struct platform_driver bcm2835_mmc_driver = { -+ .probe = bcm2835_mmc_probe, -+ .remove = bcm2835_mmc_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_mmc_match, -+ }, -+}; -+module_platform_driver(bcm2835_mmc_driver); -+ -+module_param(mmc_debug, uint, 0644); -+module_param(mmc_debug2, uint, 0644); -+MODULE_ALIAS("platform:mmc-bcm2835"); -+MODULE_DESCRIPTION("BCM2835 SDHCI driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Gellert Weisz"); - -From a56eb108067d0211a3ba3b987ec15986ac5577a6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 035/122] Adding bcm2835-sdhost driver, and an overlay to - enable it - -BCM2835 has two SD card interfaces. This driver uses the other one. - -bcm2835-sdhost: Error handling fix, and code clarification - -bcm2835-sdhost: Adding overclocking option - -Allow a different clock speed to be substitued for a requested 50MHz. -This option is exposed using the "overclock_50" DT parameter. -Note that the sdhost interface is restricted to integer divisions of -core_freq, and the highest sensible option for a core_freq of 250MHz -is 84 (250/3 = 83.3MHz), the next being 125 (250/2) which is much too -high. - -Use at your own risk. - -bcm2835-sdhost: Round up the overclock, so 62 works for 62.5Mhz - -Also only warn once for each overclock setting. - -bcm2835-sdhost: Improve error handling and recovery - -1) Expose the hw_reset method to the MMC framework, removing many - internal calls by the driver. - -2) Reduce overclock setting on error. - -3) Increase timeout to cope with high capacity cards. - -4) Add properties and parameters to control pio_limit and debug. - -5) Reduce messages at probe time. - -bcm2835-sdhost: Further improve overclock back-off - -bcm2835-sdhost: Clear HBLC for PIO mode - -Also update pio_limit default in overlay README. - -bcm2835-sdhost: Add the ERASE capability - -See: https://github.com/raspberrypi/linux/issues/1076 - -bcm2835-sdhost: Ignore CRC7 for MMC CMD1 - -It seems that the sdhost interface returns CRC7 errors for CMD1, -which is the MMC-specific SEND_OP_COND. Returning these errors to -the MMC layer causes a downward spiral, but ignoring them seems -to be harmless. - -bcm2835-mmc/sdhost: Remove ARCH_BCM2835 differences - -The bcm2835-mmc driver (and -sdhost driver that copied from it) -contains code to handle SDIO interrupts in a threaded interrupt -handler rather than waking the MMC framework thread. The change -follows a patch from Russell King that adds the facility as the -preferred way of working. - -However, the new code path is only present in ARCH_BCM2835 -builds, which I have taken to be a way of testing the waters -rather than making the change across the board; I can't see -any technical reason why it wouldn't be enabled for MACH_BCM270X -builds. So this patch standardises on the ARCH_BCM2835 code, -removing the old code paths. - -bcm2835-sdhost: Don't log timeout errors unless debug=1 - -The MMC card-discovery process generates timeouts. This is -expected behaviour, so reporting it to the user serves no purpose. -Suppress the reporting of timeout errors unless the debug flag -is on. - -bcm2835-sdhost: Add workaround for odd behaviour on some cards - -For reasons not understood, the sdhost driver fails when reading -sectors very near the end of some SD cards. The problem could -be related to the similar issue that reading the final sector -of any card as part of a multiple read never completes, and the -workaround is an extension of the mechanism introduced to solve -that problem which ensures those sectors are always read singly. - -bcm2835-sdhost: Major revision - -This is a significant revision of the bcm2835-sdhost driver. It -improves on the original in a number of ways: - -1) Through the use of CMD23 for reads it appears to avoid problems - reading some sectors on certain high speed cards. -2) Better atomicity to prevent crashes. -3) Higher performance. -4) Activity logging included, for easier diagnosis in the event - of a problem. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping - -Allocation problems have been seen in a wireless driver, and -this is the only change which might have been responsible. - -SQUASH: bcm2835-sdhost: Only claim one DMA channel - -With both MMC controllers enabled there are few DMA channels left. The -bcm2835-sdhost driver only uses DMA in one direction at a time, so it -doesn't need to claim two channels. - -See: https://github.com/raspberrypi/linux/issues/1327 - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Workaround for "slow" sectors - -Some cards have been seen to cause timeouts after certain sectors are -read. This workaround enforces a minimum delay between the stop after -reading one of those sectors and a subsequent data command. - -Using CMD23 (SET_BLOCK_COUNT) avoids this problem, so good cards will -not be penalised by this workaround. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Firmware manages the clock divisor - -The bcm2835-sdhost driver hands control of the CDIV clock divisor -register to matching firmware, allowing it to adjust to a changing -core clock. This removes the need to use the performance governor or -to enable io_is_busy on the on-demand governor in order to get the -best SD performance. - -N.B. As SD clocks must be an integer divisor of the core clock, it is -possible that the SD clock for "turbo" mode can be different (even -lower) than "normal" mode. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Reset the clock in task context - -Since reprogramming the clock can now involve a round-trip to the -firmware it must not be done at atomic context, and a tasklet -is not a task. - -Signed-off-by: Phil Elwell - -bcm2835-sdhost: Don't exit cmd wait loop on error - -The FAIL flag can be set in the CMD register before command processing -is complete, leading to spurious "failed to complete" errors. This has -the effect of promoting harmless CRC7 errors during CMD1 processing -into errors that can delay and even prevent booting. - -Also: -1) Convert the last KERN_ERROR message in the register dumping to - KERN_INFO. -2) Remove an unnecessary reset call from bcm2835_sdhost_add_host. - -See: https://github.com/raspberrypi/linux/pull/1492 - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/Kconfig | 12 +- - drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-sdhost.c | 2189 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 2201 insertions(+), 1 deletion(-) - create mode 100644 drivers/mmc/host/bcm2835-sdhost.c - -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 405d62909dd6ac5351684c002414cc02135d98ba..87d251e93913b216359383812cae196e91bf6cfb 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -6,7 +6,7 @@ comment "MMC/SD/SDIO Host Controller Drivers" - - config MMC_BCM2835 - tristate "MMC support on BCM2835" -- depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 -+ depends on ARCH_BCM2835 - help - This selects the MMC Interface on BCM2835. - -@@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER - - If unsure, say 2 here. - -+config MMC_BCM2835_SDHOST -+ tristate "Support for the SDHost controller on BCM2708/9" -+ depends on ARCH_BCM2835 -+ help -+ This selects the SDHost controller on BCM2835/6. -+ -+ If you have a controller with this interface, say Y or M here. -+ -+ If unsure, say N. -+ - config MMC_ARMMMCI - tristate "ARM AMBA Multimedia Card Interface support" - depends on ARM_AMBA -diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 5133b680970c93fbb9695f83296f0f70b4977240..adbc4586fec94aa8bd70f5ca3e2c90d123849a34 100644 ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o - obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o - obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o - obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o -+obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o - obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o - obj-$(CONFIG_MMC_WBSD) += wbsd.o - obj-$(CONFIG_MMC_AU1X) += au1xmmc.o -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -new file mode 100644 -index 0000000000000000000000000000000000000000..a9bc79bfdbb71807819dfe2d8f1651445997f92a ---- /dev/null -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -0,0 +1,2189 @@ -+/* -+ * BCM2835 SD host driver. -+ * -+ * Author: Phil Elwell -+ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. -+ * -+ * Based on -+ * mmc-bcm2835.c by Gellert Weisz -+ * which is, in turn, based on -+ * sdhci-bcm2708.c by Broadcom -+ * sdhci-bcm2835.c by Stephen Warren and Oleksandr Tymoshenko -+ * sdhci.c and sdhci-pci.c by Pierre Ossman -+ * -+ * 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 . -+ */ -+ -+#define FIFO_READ_THRESHOLD 4 -+#define FIFO_WRITE_THRESHOLD 4 -+#define ALLOW_CMD23_READ 1 -+#define ALLOW_CMD23_WRITE 0 -+#define ENABLE_LOG 1 -+#define SDDATA_FIFO_PIO_BURST 8 -+#define CMD_DALLY_US 1 -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "sdhost-bcm2835" -+ -+#define SDCMD 0x00 /* Command to SD card - 16 R/W */ -+#define SDARG 0x04 /* Argument to SD card - 32 R/W */ -+#define SDTOUT 0x08 /* Start value for timeout counter - 32 R/W */ -+#define SDCDIV 0x0c /* Start value for clock divider - 11 R/W */ -+#define SDRSP0 0x10 /* SD card response (31:0) - 32 R */ -+#define SDRSP1 0x14 /* SD card response (63:32) - 32 R */ -+#define SDRSP2 0x18 /* SD card response (95:64) - 32 R */ -+#define SDRSP3 0x1c /* SD card response (127:96) - 32 R */ -+#define SDHSTS 0x20 /* SD host status - 11 R */ -+#define SDVDD 0x30 /* SD card power control - 1 R/W */ -+#define SDEDM 0x34 /* Emergency Debug Mode - 13 R/W */ -+#define SDHCFG 0x38 /* Host configuration - 2 R/W */ -+#define SDHBCT 0x3c /* Host byte count (debug) - 32 R/W */ -+#define SDDATA 0x40 /* Data to/from SD card - 32 R/W */ -+#define SDHBLC 0x50 /* Host block count (SDIO/SDHC) - 9 R/W */ -+ -+#define SDCMD_NEW_FLAG 0x8000 -+#define SDCMD_FAIL_FLAG 0x4000 -+#define SDCMD_BUSYWAIT 0x800 -+#define SDCMD_NO_RESPONSE 0x400 -+#define SDCMD_LONG_RESPONSE 0x200 -+#define SDCMD_WRITE_CMD 0x80 -+#define SDCMD_READ_CMD 0x40 -+#define SDCMD_CMD_MASK 0x3f -+ -+#define SDCDIV_MAX_CDIV 0x7ff -+ -+#define SDHSTS_BUSY_IRPT 0x400 -+#define SDHSTS_BLOCK_IRPT 0x200 -+#define SDHSTS_SDIO_IRPT 0x100 -+#define SDHSTS_REW_TIME_OUT 0x80 -+#define SDHSTS_CMD_TIME_OUT 0x40 -+#define SDHSTS_CRC16_ERROR 0x20 -+#define SDHSTS_CRC7_ERROR 0x10 -+#define SDHSTS_FIFO_ERROR 0x08 -+/* Reserved */ -+/* Reserved */ -+#define SDHSTS_DATA_FLAG 0x01 -+ -+#define SDHSTS_TRANSFER_ERROR_MASK (SDHSTS_CRC7_ERROR|SDHSTS_CRC16_ERROR|SDHSTS_REW_TIME_OUT|SDHSTS_FIFO_ERROR) -+#define SDHSTS_ERROR_MASK (SDHSTS_CMD_TIME_OUT|SDHSTS_TRANSFER_ERROR_MASK) -+ -+#define SDHCFG_BUSY_IRPT_EN (1<<10) -+#define SDHCFG_BLOCK_IRPT_EN (1<<8) -+#define SDHCFG_SDIO_IRPT_EN (1<<5) -+#define SDHCFG_DATA_IRPT_EN (1<<4) -+#define SDHCFG_SLOW_CARD (1<<3) -+#define SDHCFG_WIDE_EXT_BUS (1<<2) -+#define SDHCFG_WIDE_INT_BUS (1<<1) -+#define SDHCFG_REL_CMD_LINE (1<<0) -+ -+#define SDEDM_FORCE_DATA_MODE (1<<19) -+#define SDEDM_CLOCK_PULSE (1<<20) -+#define SDEDM_BYPASS (1<<21) -+ -+#define SDEDM_WRITE_THRESHOLD_SHIFT 9 -+#define SDEDM_READ_THRESHOLD_SHIFT 14 -+#define SDEDM_THRESHOLD_MASK 0x1f -+ -+#define SDEDM_FSM_MASK 0xf -+#define SDEDM_FSM_IDENTMODE 0x0 -+#define SDEDM_FSM_DATAMODE 0x1 -+#define SDEDM_FSM_READDATA 0x2 -+#define SDEDM_FSM_WRITEDATA 0x3 -+#define SDEDM_FSM_READWAIT 0x4 -+#define SDEDM_FSM_READCRC 0x5 -+#define SDEDM_FSM_WRITECRC 0x6 -+#define SDEDM_FSM_WRITEWAIT1 0x7 -+#define SDEDM_FSM_POWERDOWN 0x8 -+#define SDEDM_FSM_POWERUP 0x9 -+#define SDEDM_FSM_WRITESTART1 0xa -+#define SDEDM_FSM_WRITESTART2 0xb -+#define SDEDM_FSM_GENPULSES 0xc -+#define SDEDM_FSM_WRITEWAIT2 0xd -+#define SDEDM_FSM_STARTPOWDOWN 0xf -+ -+#define SDDATA_FIFO_WORDS 16 -+ -+#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ -+ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) -+ -+#define MHZ 1000000 -+ -+ -+struct bcm2835_host { -+ spinlock_t lock; -+ -+ void __iomem *ioaddr; -+ u32 bus_addr; -+ -+ struct mmc_host *mmc; -+ -+ u32 pio_timeout; /* In jiffies */ -+ -+ int clock; /* Current clock speed */ -+ -+ bool slow_card; /* Force 11-bit divisor */ -+ -+ unsigned int max_clk; /* Max possible freq */ -+ -+ struct tasklet_struct finish_tasklet; /* Tasklet structures */ -+ -+ struct work_struct cmd_wait_wq; /* Workqueue function */ -+ -+ struct timer_list timer; /* Timer for timeouts */ -+ -+ struct sg_mapping_iter sg_miter; /* SG state for PIO */ -+ unsigned int blocks; /* remaining PIO blocks */ -+ -+ int irq; /* Device IRQ */ -+ -+ u32 cmd_quick_poll_retries; -+ u32 ns_per_fifo_word; -+ -+ /* cached registers */ -+ u32 hcfg; -+ u32 cdiv; -+ -+ struct mmc_request *mrq; /* Current request */ -+ struct mmc_command *cmd; /* Current command */ -+ struct mmc_data *data; /* Current data request */ -+ unsigned int data_complete:1; /* Data finished before cmd */ -+ -+ unsigned int flush_fifo:1; /* Drain the fifo when finishing */ -+ -+ unsigned int use_busy:1; /* Wait for busy interrupt */ -+ -+ unsigned int use_sbc:1; /* Send CMD23 */ -+ -+ unsigned int debug:1; /* Enable debug output */ -+ unsigned int firmware_sets_cdiv:1; /* Let the firmware manage the clock */ -+ unsigned int reset_clock:1; /* Reset the clock fore the next request */ -+ -+ /*DMA part*/ -+ struct dma_chan *dma_chan_rxtx; /* DMA channel for reads and writes */ -+ struct dma_chan *dma_chan; /* Channel in use */ -+ struct dma_slave_config dma_cfg_rx; -+ struct dma_slave_config dma_cfg_tx; -+ struct dma_async_tx_descriptor *dma_desc; -+ u32 dma_dir; -+ u32 drain_words; -+ struct page *drain_page; -+ u32 drain_offset; -+ -+ bool allow_dma; -+ bool use_dma; -+ /*end of DMA part*/ -+ -+ int max_delay; /* maximum length of time spent waiting */ -+ struct timeval stop_time; /* when the last stop was issued */ -+ u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ -+ u32 delay_after_this_stop; /* minimum time between this stop and subsequent data transfer */ -+ u32 user_overclock_50; /* User's preferred frequency to use when 50MHz is requested (in MHz) */ -+ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ -+ u32 overclock; /* Current frequency if overclocked, else zero */ -+ u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ -+ -+ u32 sectors; /* Cached card size in sectors */ -+}; -+ -+#if ENABLE_LOG -+ -+struct log_entry_struct { -+ char event[4]; -+ u32 timestamp; -+ u32 param1; -+ u32 param2; -+}; -+ -+typedef struct log_entry_struct LOG_ENTRY_T; -+ -+LOG_ENTRY_T *sdhost_log_buf; -+dma_addr_t sdhost_log_addr; -+static u32 sdhost_log_idx; -+static spinlock_t log_lock; -+static void __iomem *timer_base; -+ -+#define LOG_ENTRIES (256*1) -+#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) -+ -+static void log_init(struct device *dev, u32 bus_to_phys) -+{ -+ spin_lock_init(&log_lock); -+ sdhost_log_buf = dma_zalloc_coherent(dev, LOG_SIZE, &sdhost_log_addr, -+ GFP_KERNEL); -+ if (sdhost_log_buf) { -+ pr_info("sdhost: log_buf @ %p (%x)\n", -+ sdhost_log_buf, sdhost_log_addr); -+ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); -+ if (!timer_base) -+ pr_err("sdhost: failed to remap timer\n"); -+ } -+ else -+ pr_err("sdhost: failed to allocate log buf\n"); -+} -+ -+static void log_event_impl(const char *event, u32 param1, u32 param2) -+{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&log_lock, flags); -+ -+ entry = sdhost_log_buf + sdhost_log_idx; -+ memcpy(entry->event, event, 4); -+ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + -+ (smp_processor_id()<<30); -+ entry->param1 = param1; -+ entry->param2 = param2; -+ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; -+ -+ spin_unlock_irqrestore(&log_lock, flags); -+ } -+} -+ -+static void log_dump(void) -+{ -+ if (sdhost_log_buf) { -+ LOG_ENTRY_T *entry; -+ unsigned long flags; -+ int idx; -+ -+ spin_lock_irqsave(&log_lock, flags); -+ -+ idx = sdhost_log_idx; -+ do { -+ entry = sdhost_log_buf + idx; -+ if (entry->event[0] != '\0') -+ pr_info("[%08x] %.4s %x %x\n", -+ entry->timestamp, -+ entry->event, -+ entry->param1, -+ entry->param2); -+ idx = (idx + 1) % LOG_ENTRIES; -+ } while (idx != sdhost_log_idx); -+ -+ spin_unlock_irqrestore(&log_lock, flags); -+ } -+} -+ -+#define log_event(event, param1, param2) log_event_impl(event, param1, param2) -+ -+#else -+ -+#define log_init(x) (void)0 -+#define log_event(event, param1, param2) (void)0 -+#define log_dump() (void)0 -+ -+#endif -+ -+static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) -+{ -+ writel(val, host->ioaddr + reg); -+} -+ -+static inline u32 bcm2835_sdhost_read(struct bcm2835_host *host, int reg) -+{ -+ return readl(host->ioaddr + reg); -+} -+ -+static inline u32 bcm2835_sdhost_read_relaxed(struct bcm2835_host *host, int reg) -+{ -+ return readl_relaxed(host->ioaddr + reg); -+} -+ -+static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, -+ struct mmc_command *cmd, -+ const char *label) -+{ -+ if (cmd) -+ pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", -+ mmc_hostname(host->mmc), -+ (cmd == host->cmd) ? '>' : ' ', -+ label, cmd->opcode, cmd->arg, cmd->flags, -+ cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3], -+ cmd->error); -+} -+ -+static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) -+{ -+ if (host->mrq) -+ { -+ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); -+ if (host->mrq->data) -+ pr_info("%s: data blocks %x blksz %x - err %d\n", -+ mmc_hostname(host->mmc), -+ host->mrq->data->blocks, -+ host->mrq->data->blksz, -+ host->mrq->data->error); -+ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); -+ } -+ -+ pr_info("%s: =========== REGISTER DUMP ===========\n", -+ mmc_hostname(host->mmc)); -+ -+ pr_info("%s: SDCMD 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCMD)); -+ pr_info("%s: SDARG 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDARG)); -+ pr_info("%s: SDTOUT 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDTOUT)); -+ pr_info("%s: SDCDIV 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCDIV)); -+ pr_info("%s: SDRSP0 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP0)); -+ pr_info("%s: SDRSP1 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP1)); -+ pr_info("%s: SDRSP2 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP2)); -+ pr_info("%s: SDRSP3 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDRSP3)); -+ pr_info("%s: SDHSTS 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHSTS)); -+ pr_info("%s: SDVDD 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDVDD)); -+ pr_info("%s: SDEDM 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDEDM)); -+ pr_info("%s: SDHCFG 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHCFG)); -+ pr_info("%s: SDHBCT 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHBCT)); -+ pr_info("%s: SDHBLC 0x%08x\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDHBLC)); -+ -+ pr_info("%s: ===========================================\n", -+ mmc_hostname(host->mmc)); -+} -+ -+static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) -+{ -+ bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); -+} -+ -+static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) -+{ -+ u32 temp; -+ -+ if (host->debug) -+ pr_info("%s: reset\n", mmc_hostname(host->mmc)); -+ -+ bcm2835_sdhost_set_power(host, false); -+ -+ bcm2835_sdhost_write(host, 0, SDCMD); -+ bcm2835_sdhost_write(host, 0, SDARG); -+ bcm2835_sdhost_write(host, 0xf00000, SDTOUT); -+ bcm2835_sdhost_write(host, 0, SDCDIV); -+ bcm2835_sdhost_write(host, 0x7f8, SDHSTS); /* Write 1s to clear */ -+ bcm2835_sdhost_write(host, 0, SDHCFG); -+ bcm2835_sdhost_write(host, 0, SDHBCT); -+ bcm2835_sdhost_write(host, 0, SDHBLC); -+ -+ /* Limit fifo usage due to silicon bug */ -+ temp = bcm2835_sdhost_read(host, SDEDM); -+ temp &= ~((SDEDM_THRESHOLD_MASK<clock = 0; -+ host->sectors = 0; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_write(host, SDCDIV_MAX_CDIV, SDCDIV); -+ mmiowb(); -+} -+ -+static void bcm2835_sdhost_reset(struct mmc_host *mmc) -+{ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ spin_lock_irqsave(&host->lock, flags); -+ log_event("RST<", 0, 0); -+ -+ bcm2835_sdhost_reset_internal(host); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -+ -+static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) -+{ -+ pr_debug("bcm2835_sdhost_init(%d)\n", soft); -+ -+ /* Set interrupt enables */ -+ host->hcfg = SDHCFG_BUSY_IRPT_EN; -+ -+ bcm2835_sdhost_reset_internal(host); -+ -+ if (soft) { -+ /* force clock reconfiguration */ -+ host->clock = 0; -+ bcm2835_sdhost_set_ios(host->mmc, &host->mmc->ios); -+ } -+} -+ -+static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) -+{ -+ int timediff; -+ u32 alternate_idle; -+ u32 edm; -+ -+ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? -+ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; -+ -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ -+ log_event("WTC<", edm, 0); -+ -+ timediff = 0; -+ -+ while (1) { -+ u32 fsm = edm & SDEDM_FSM_MASK; -+ if ((fsm == SDEDM_FSM_IDENTMODE) || -+ (fsm == SDEDM_FSM_DATAMODE)) -+ break; -+ if (fsm == alternate_idle) { -+ bcm2835_sdhost_write(host, -+ edm | SDEDM_FORCE_DATA_MODE, -+ SDEDM); -+ break; -+ } -+ -+ timediff++; -+ if (timediff == 100000) { -+ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", -+ mmc_hostname(host->mmc), -+ timediff); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ host->mrq->data->error = -ETIMEDOUT; -+ log_event("WTC!", edm, 0); -+ return; -+ } -+ cpu_relax(); -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ } -+ log_event("WTC>", edm, 0); -+} -+ -+static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); -+ -+static void bcm2835_sdhost_dma_complete(void *param) -+{ -+ struct bcm2835_host *host = param; -+ struct mmc_data *data = host->data; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); -+ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), -+ bcm2835_sdhost_read(host, SDEDM)); -+ -+ if (host->dma_chan) { -+ dma_unmap_sg(host->dma_chan->device->dev, -+ data->sg, data->sg_len, -+ host->dma_dir); -+ -+ host->dma_chan = NULL; -+ } -+ -+ if (host->drain_words) { -+ void *page; -+ u32 *buf; -+ -+ page = kmap_atomic(host->drain_page); -+ buf = page + host->drain_offset; -+ -+ while (host->drain_words) { -+ u32 edm = bcm2835_sdhost_read(host, SDEDM); -+ if ((edm >> 4) & 0x1f) -+ *(buf++) = bcm2835_sdhost_read(host, -+ SDDATA); -+ host->drain_words--; -+ } -+ -+ kunmap_atomic(page); -+ } -+ -+ bcm2835_sdhost_finish_data(host); -+ -+ log_event("DMA>", (u32)host->data, 0); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len; -+ u32 *buf; -+ unsigned long wait_max; -+ -+ blksize = host->data->blksz; -+ -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ int copy_words; -+ u32 hsts = 0; -+ -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ len = min(host->sg_miter.length, blksize); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = (u32 *)host->sg_miter.addr; -+ -+ copy_words = len/4; -+ -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; -+ -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = ((edm >> 4) & 0x1f); -+ -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_READDATA) && -+ (fsm_state != SDEDM_FSM_READWAIT) && -+ (fsm_state != SDEDM_FSM_READCRC)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_info("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO read timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } -+ -+ copy_words -= words; -+ -+ while (words) { -+ *(buf++) = bcm2835_sdhost_read(host, SDDATA); -+ words--; -+ } -+ } -+ -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) -+{ -+ unsigned long flags; -+ size_t blksize, len; -+ u32 *buf; -+ unsigned long wait_max; -+ -+ blksize = host->data->blksz; -+ -+ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); -+ -+ local_irq_save(flags); -+ -+ while (blksize) { -+ int copy_words; -+ u32 hsts = 0; -+ -+ if (!sg_miter_next(&host->sg_miter)) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ len = min(host->sg_miter.length, blksize); -+ if (len % 4) { -+ host->data->error = -EINVAL; -+ break; -+ } -+ -+ blksize -= len; -+ host->sg_miter.consumed = len; -+ -+ buf = (u32 *)host->sg_miter.addr; -+ -+ copy_words = len/4; -+ -+ while (copy_words) { -+ int burst_words, words; -+ u32 edm; -+ -+ burst_words = SDDATA_FIFO_PIO_BURST; -+ if (burst_words > copy_words) -+ burst_words = copy_words; -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); -+ -+ if (words < burst_words) { -+ int fsm_state = (edm & SDEDM_FSM_MASK); -+ if ((fsm_state != SDEDM_FSM_WRITEDATA) && -+ (fsm_state != SDEDM_FSM_WRITESTART1) && -+ (fsm_state != SDEDM_FSM_WRITESTART2)) { -+ hsts = bcm2835_sdhost_read(host, -+ SDHSTS); -+ pr_info("%s: fsm %x, hsts %x\n", -+ mmc_hostname(host->mmc), -+ fsm_state, hsts); -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ if (time_after(jiffies, wait_max)) { -+ pr_err("%s: PIO write timeout - EDM %x\n", -+ mmc_hostname(host->mmc), -+ edm); -+ hsts = SDHSTS_REW_TIME_OUT; -+ break; -+ } -+ ndelay((burst_words - words) * -+ host->ns_per_fifo_word); -+ continue; -+ } else if (words > copy_words) { -+ words = copy_words; -+ } -+ -+ copy_words -= words; -+ -+ while (words) { -+ bcm2835_sdhost_write(host, *(buf++), SDDATA); -+ words--; -+ } -+ } -+ -+ if (hsts & SDHSTS_ERROR_MASK) -+ break; -+ } -+ -+ sg_miter_stop(&host->sg_miter); -+ -+ local_irq_restore(flags); -+} -+ -+static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) -+{ -+ u32 sdhsts; -+ bool is_read; -+ BUG_ON(!host->data); -+ log_event("XFP<", (u32)host->data, host->blocks); -+ -+ is_read = (host->data->flags & MMC_DATA_READ) != 0; -+ if (is_read) -+ bcm2835_sdhost_read_block_pio(host); -+ else -+ bcm2835_sdhost_write_block_pio(host); -+ -+ sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ if (sdhsts & (SDHSTS_CRC16_ERROR | -+ SDHSTS_CRC7_ERROR | -+ SDHSTS_FIFO_ERROR)) { -+ pr_err("%s: %s transfer error - HSTS %x\n", -+ mmc_hostname(host->mmc), -+ is_read ? "read" : "write", -+ sdhsts); -+ host->data->error = -EILSEQ; -+ } else if ((sdhsts & (SDHSTS_CMD_TIME_OUT | -+ SDHSTS_REW_TIME_OUT))) { -+ pr_err("%s: %s timeout error - HSTS %x\n", -+ mmc_hostname(host->mmc), -+ is_read ? "read" : "write", -+ sdhsts); -+ host->data->error = -ETIMEDOUT; -+ } -+ log_event("XFP>", (u32)host->data, host->blocks); -+} -+ -+static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, -+ struct mmc_data *data) -+{ -+ int len, dir_data, dir_slave; -+ struct dma_async_tx_descriptor *desc = NULL; -+ struct dma_chan *dma_chan; -+ -+ log_event("PRD<", (u32)data, 0); -+ pr_debug("bcm2835_sdhost_prepare_dma()\n"); -+ -+ dma_chan = host->dma_chan_rxtx; -+ if (data->flags & MMC_DATA_READ) { -+ dir_data = DMA_FROM_DEVICE; -+ dir_slave = DMA_DEV_TO_MEM; -+ } else { -+ dir_data = DMA_TO_DEVICE; -+ dir_slave = DMA_MEM_TO_DEV; -+ } -+ log_event("PRD1", (u32)dma_chan, 0); -+ -+ BUG_ON(!dma_chan->device); -+ BUG_ON(!dma_chan->device->dev); -+ BUG_ON(!data->sg); -+ -+ /* The block doesn't manage the FIFO DREQs properly for multi-block -+ transfers, so don't attempt to DMA the final few words. -+ Unfortunately this requires the final sg entry to be trimmed. -+ N.B. This code demands that the overspill is contained in -+ a single sg entry. -+ */ -+ -+ host->drain_words = 0; -+ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { -+ struct scatterlist *sg; -+ u32 len; -+ int i; -+ -+ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, -+ (u32)data->blocks * data->blksz); -+ -+ for_each_sg(data->sg, sg, data->sg_len, i) { -+ if (sg_is_last(sg)) { -+ BUG_ON(sg->length < len); -+ sg->length -= len; -+ host->drain_page = sg_page(sg); -+ host->drain_offset = sg->offset + sg->length; -+ } -+ } -+ host->drain_words = len/4; -+ } -+ -+ /* The parameters have already been validated, so this will not fail */ -+ (void)dmaengine_slave_config(dma_chan, -+ (dir_data == DMA_FROM_DEVICE) ? -+ &host->dma_cfg_rx : -+ &host->dma_cfg_tx); -+ -+ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, -+ dir_data); -+ -+ log_event("PRD2", len, 0); -+ if (len > 0) -+ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, -+ len, dir_slave, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -+ log_event("PRD3", (u32)desc, 0); -+ -+ if (desc) { -+ desc->callback = bcm2835_sdhost_dma_complete; -+ desc->callback_param = host; -+ host->dma_desc = desc; -+ host->dma_chan = dma_chan; -+ host->dma_dir = dir_data; -+ } -+ log_event("PDM>", (u32)data, 0); -+} -+ -+static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) -+{ -+ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); -+ dmaengine_submit(host->dma_desc); -+ dma_async_issue_pending(host->dma_chan); -+} -+ -+static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) -+{ -+ u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | -+ SDHCFG_BUSY_IRPT_EN; -+ if (host->dma_desc) -+ host->hcfg = (host->hcfg & ~all_irqs) | -+ SDHCFG_BUSY_IRPT_EN; -+ else -+ host->hcfg = (host->hcfg & ~all_irqs) | -+ SDHCFG_DATA_IRPT_EN | -+ SDHCFG_BUSY_IRPT_EN; -+ -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+} -+ -+static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) -+{ -+ struct mmc_data *data = cmd->data; -+ -+ WARN_ON(host->data); -+ -+ host->data = data; -+ if (!data) -+ return; -+ -+ /* Sanity checks */ -+ BUG_ON(data->blksz * data->blocks > 524288); -+ BUG_ON(data->blksz > host->mmc->max_blk_size); -+ BUG_ON(data->blocks > 65535); -+ -+ host->data_complete = 0; -+ host->flush_fifo = 0; -+ host->data->bytes_xfered = 0; -+ -+ if (!host->sectors && host->mmc->card) { -+ struct mmc_card *card = host->mmc->card; -+ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { -+ /* -+ * The EXT_CSD sector count is in number of 512 byte -+ * sectors. -+ */ -+ host->sectors = card->ext_csd.sectors; -+ } else { -+ /* -+ * The CSD capacity field is in units of read_blkbits. -+ * set_capacity takes units of 512 bytes. -+ */ -+ host->sectors = card->csd.capacity << -+ (card->csd.read_blkbits - 9); -+ } -+ } -+ -+ if (!host->dma_desc) { -+ /* Use PIO */ -+ int flags = SG_MITER_ATOMIC; -+ -+ if (data->flags & MMC_DATA_READ) -+ flags |= SG_MITER_TO_SG; -+ else -+ flags |= SG_MITER_FROM_SG; -+ sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); -+ host->blocks = data->blocks; -+ } -+ -+ bcm2835_sdhost_set_transfer_irqs(host); -+ -+ bcm2835_sdhost_write(host, data->blksz, SDHBCT); -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); -+ -+ BUG_ON(!host->data); -+} -+ -+bool bcm2835_sdhost_send_command(struct bcm2835_host *host, -+ struct mmc_command *cmd) -+{ -+ u32 sdcmd, sdhsts; -+ unsigned long timeout; -+ int delay; -+ -+ WARN_ON(host->cmd); -+ log_event("CMD<", cmd->opcode, cmd->arg); -+ -+ if (cmd->data) -+ pr_debug("%s: send_command %d 0x%x " -+ "(flags 0x%x) - %s %d*%d\n", -+ mmc_hostname(host->mmc), -+ cmd->opcode, cmd->arg, cmd->flags, -+ (cmd->data->flags & MMC_DATA_READ) ? -+ "read" : "write", cmd->data->blocks, -+ cmd->data->blksz); -+ else -+ pr_debug("%s: send_command %d 0x%x (flags 0x%x)\n", -+ mmc_hostname(host->mmc), -+ cmd->opcode, cmd->arg, cmd->flags); -+ -+ /* Wait max 100 ms */ -+ timeout = 10000; -+ -+ while (bcm2835_sdhost_read(host, SDCMD) & SDCMD_NEW_FLAG) { -+ if (timeout == 0) { -+ pr_warn("%s: previous command never completed.\n", -+ mmc_hostname(host->mmc)); -+ if (host->debug) -+ bcm2835_sdhost_dumpregs(host); -+ cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ return false; -+ } -+ timeout--; -+ udelay(10); -+ } -+ -+ delay = (10000 - timeout)/100; -+ if (delay > host->max_delay) { -+ host->max_delay = delay; -+ pr_warning("%s: controller hung for %d ms\n", -+ mmc_hostname(host->mmc), -+ host->max_delay); -+ } -+ -+ timeout = jiffies; -+ if (!cmd->data && cmd->busy_timeout > 9000) -+ timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ; -+ else -+ timeout += 10 * HZ; -+ mod_timer(&host->timer, timeout); -+ -+ host->cmd = cmd; -+ -+ /* Clear any error flags */ -+ sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ if (sdhsts & SDHSTS_ERROR_MASK) -+ bcm2835_sdhost_write(host, sdhsts, SDHSTS); -+ -+ if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { -+ pr_err("%s: unsupported response type!\n", -+ mmc_hostname(host->mmc)); -+ cmd->error = -EINVAL; -+ tasklet_schedule(&host->finish_tasklet); -+ return false; -+ } -+ -+ bcm2835_sdhost_prepare_data(host, cmd); -+ -+ bcm2835_sdhost_write(host, cmd->arg, SDARG); -+ -+ sdcmd = cmd->opcode & SDCMD_CMD_MASK; -+ -+ host->use_busy = 0; -+ if (!(cmd->flags & MMC_RSP_PRESENT)) { -+ sdcmd |= SDCMD_NO_RESPONSE; -+ } else { -+ if (cmd->flags & MMC_RSP_136) -+ sdcmd |= SDCMD_LONG_RESPONSE; -+ if (cmd->flags & MMC_RSP_BUSY) { -+ sdcmd |= SDCMD_BUSYWAIT; -+ host->use_busy = 1; -+ } -+ } -+ -+ if (cmd->data) { -+ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); -+ if (host->delay_after_this_stop) { -+ struct timeval now; -+ int time_since_stop; -+ do_gettimeofday(&now); -+ time_since_stop = (now.tv_sec - host->stop_time.tv_sec); -+ if (time_since_stop < 2) { -+ /* Possibly less than one second */ -+ time_since_stop = time_since_stop * 1000000 + -+ (now.tv_usec - host->stop_time.tv_usec); -+ if (time_since_stop < -+ host->delay_after_this_stop) -+ udelay(host->delay_after_this_stop - -+ time_since_stop); -+ } -+ } -+ -+ host->delay_after_this_stop = host->delay_after_stop; -+ if ((cmd->data->flags & MMC_DATA_READ) && !host->use_sbc) { -+ /* See if read crosses one of the hazardous sectors */ -+ u32 first_blk, last_blk; -+ -+ /* Intentionally include the following sector because -+ without CMD23/SBC the read may run on. */ -+ first_blk = host->mrq->cmd->arg; -+ last_blk = first_blk + cmd->data->blocks; -+ -+ if (((last_blk >= (host->sectors - 64)) && -+ (first_blk <= (host->sectors - 64))) || -+ ((last_blk >= (host->sectors - 32)) && -+ (first_blk <= (host->sectors - 32)))) { -+ host->delay_after_this_stop = -+ max(250u, host->delay_after_stop); -+ } -+ } -+ -+ if (cmd->data->flags & MMC_DATA_WRITE) -+ sdcmd |= SDCMD_WRITE_CMD; -+ if (cmd->data->flags & MMC_DATA_READ) -+ sdcmd |= SDCMD_READ_CMD; -+ } -+ -+ bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); -+ -+ return true; -+} -+ -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags); -+static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); -+ -+static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) -+{ -+ struct mmc_data *data; -+ -+ data = host->data; -+ BUG_ON(!data); -+ -+ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); -+ pr_debug("finish_data(error %d, stop %d, sbc %d)\n", -+ data->error, data->stop ? 1 : 0, -+ host->mrq->sbc ? 1 : 0); -+ -+ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ -+ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); -+ -+ host->data_complete = 1; -+ -+ if (host->cmd) { -+ /* -+ * Data managed to finish before the -+ * command completed. Make sure we do -+ * things in the proper order. -+ */ -+ pr_debug("Finished early - HSTS %x\n", -+ bcm2835_sdhost_read(host, SDHSTS)); -+ } -+ else -+ bcm2835_sdhost_transfer_complete(host); -+ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); -+} -+ -+static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) -+{ -+ struct mmc_data *data; -+ -+ BUG_ON(host->cmd); -+ BUG_ON(!host->data); -+ BUG_ON(!host->data_complete); -+ -+ data = host->data; -+ host->data = NULL; -+ -+ log_event("TCM<", (u32)data, data->error); -+ pr_debug("transfer_complete(error %d, stop %d)\n", -+ data->error, data->stop ? 1 : 0); -+ -+ /* -+ * Need to send CMD12 if - -+ * a) open-ended multiblock transfer (no CMD23) -+ * b) error in multiblock transfer -+ */ -+ if (host->mrq->stop && (data->error || !host->use_sbc)) { -+ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { -+ /* No busy, so poll for completion */ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); -+ -+ if (host->delay_after_this_stop) -+ do_gettimeofday(&host->stop_time); -+ } -+ } else { -+ bcm2835_sdhost_wait_transfer_complete(host); -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ log_event("TCM>", (u32)data, 0); -+} -+ -+/* If irq_flags is valid, the caller is in a thread context and is allowed -+ to sleep */ -+static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, -+ unsigned long *irq_flags) -+{ -+ u32 sdcmd; -+ u32 retries; -+#ifdef DEBUG -+ struct timeval before, after; -+ int timediff = 0; -+#endif -+ -+ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); -+ pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); -+ -+ BUG_ON(!host->cmd || !host->mrq); -+ -+ /* Poll quickly at first */ -+ -+ retries = host->cmd_quick_poll_retries; -+ if (!retries) { -+ /* Work out how many polls take 1us by timing 10us */ -+ struct timeval start, now; -+ int us_diff; -+ -+ retries = 1; -+ do { -+ int i; -+ -+ retries *= 2; -+ -+ do_gettimeofday(&start); -+ -+ for (i = 0; i < retries; i++) { -+ cpu_relax(); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ } -+ -+ do_gettimeofday(&now); -+ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + -+ (now.tv_usec - start.tv_usec); -+ } while (us_diff < 10); -+ -+ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; -+ retries = 1; // We've already waited long enough this time -+ } -+ -+ for (sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ (sdcmd & SDCMD_NEW_FLAG) && retries; -+ retries--) { -+ cpu_relax(); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ } -+ -+ if (!retries) { -+ unsigned long wait_max; -+ -+ if (!irq_flags) { -+ /* Schedule the work */ -+ log_event("CWWQ", 0, 0); -+ schedule_work(&host->cmd_wait_wq); -+ return; -+ } -+ -+ /* Wait max 100 ms */ -+ wait_max = jiffies + msecs_to_jiffies(100); -+ while (time_before(jiffies, wait_max)) { -+ spin_unlock_irqrestore(&host->lock, *irq_flags); -+ usleep_range(1, 10); -+ spin_lock_irqsave(&host->lock, *irq_flags); -+ sdcmd = bcm2835_sdhost_read(host, SDCMD); -+ if (!(sdcmd & SDCMD_NEW_FLAG)) -+ break; -+ } -+ } -+ -+ /* Check for errors */ -+ if (sdcmd & SDCMD_NEW_FLAG) { -+ if (host->debug) { -+ pr_err("%s: command %d never completed.\n", -+ mmc_hostname(host->mmc), host->cmd->opcode); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ host->cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } else if (sdcmd & SDCMD_FAIL_FLAG) { -+ u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); -+ -+ /* Clear the errors */ -+ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); -+ -+ if (host->debug) -+ pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", -+ mmc_hostname(host->mmc), sdcmd, sdhsts, -+ bcm2835_sdhost_read(host, SDEDM)); -+ -+ if ((sdhsts & SDHSTS_CRC7_ERROR) && -+ (host->cmd->opcode == 1)) { -+ if (host->debug) -+ pr_info("%s: ignoring CRC7 error for CMD1\n", -+ mmc_hostname(host->mmc)); -+ } else { -+ if (sdhsts & SDHSTS_CMD_TIME_OUT) { -+ if (host->debug) -+ pr_warn("%s: command %d timeout\n", -+ mmc_hostname(host->mmc), -+ host->cmd->opcode); -+ host->cmd->error = -ETIMEDOUT; -+ } else { -+ pr_warn("%s: unexpected command %d error\n", -+ mmc_hostname(host->mmc), -+ host->cmd->opcode); -+ host->cmd->error = -EILSEQ; -+ } -+ tasklet_schedule(&host->finish_tasklet); -+ return; -+ } -+ } -+ -+ if (host->cmd->flags & MMC_RSP_PRESENT) { -+ if (host->cmd->flags & MMC_RSP_136) { -+ int i; -+ for (i = 0; i < 4; i++) -+ host->cmd->resp[3 - i] = bcm2835_sdhost_read(host, SDRSP0 + i*4); -+ pr_debug("%s: finish_command %08x %08x %08x %08x\n", -+ mmc_hostname(host->mmc), -+ host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); -+ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); -+ } else { -+ host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); -+ pr_debug("%s: finish_command %08x\n", -+ mmc_hostname(host->mmc), -+ host->cmd->resp[0]); -+ log_event("RSP ", host->cmd->resp[0], 0); -+ } -+ } -+ -+ if (host->cmd == host->mrq->sbc) { -+ /* Finished CMD23, now send actual command. */ -+ host->cmd = NULL; -+ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); -+ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, NULL); -+ } -+ } else if (host->cmd == host->mrq->stop) { -+ /* Finished CMD12 */ -+ tasklet_schedule(&host->finish_tasklet); -+ } else { -+ /* Processed actual command. */ -+ host->cmd = NULL; -+ if (!host->data) -+ tasklet_schedule(&host->finish_tasklet); -+ else if (host->data_complete) -+ bcm2835_sdhost_transfer_complete(host); -+ } -+ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); -+} -+ -+static void bcm2835_sdhost_timeout(unsigned long data) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = (struct bcm2835_host *)data; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ log_event("TIM<", 0, 0); -+ -+ if (host->mrq) { -+ pr_err("%s: timeout waiting for hardware interrupt.\n", -+ mmc_hostname(host->mmc)); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ -+ if (host->data) { -+ host->data->error = -ETIMEDOUT; -+ bcm2835_sdhost_finish_data(host); -+ } else { -+ if (host->cmd) -+ host->cmd->error = -ETIMEDOUT; -+ else -+ host->mrq->cmd->error = -ETIMEDOUT; -+ -+ pr_debug("timeout_timer tasklet_schedule\n"); -+ tasklet_schedule(&host->finish_tasklet); -+ } -+ } -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ log_event("IRQB", (u32)host->cmd, intmask); -+ if (!host->cmd) { -+ pr_err("%s: got command busy interrupt 0x%08x even " -+ "though no command operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_sdhost_dumpregs(host); -+ return; -+ } -+ -+ if (!host->use_busy) { -+ pr_err("%s: got command busy interrupt 0x%08x even " -+ "though not expecting one.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_sdhost_dumpregs(host); -+ return; -+ } -+ host->use_busy = 0; -+ -+ if (intmask & SDHSTS_ERROR_MASK) -+ { -+ pr_err("sdhost_busy_irq: intmask %x, data %p\n", intmask, host->mrq->data); -+ if (intmask & SDHSTS_CRC7_ERROR) -+ host->cmd->error = -EILSEQ; -+ else if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR)) { -+ if (host->mrq->data) -+ host->mrq->data->error = -EILSEQ; -+ else -+ host->cmd->error = -EILSEQ; -+ } else if (intmask & SDHSTS_REW_TIME_OUT) { -+ if (host->mrq->data) -+ host->mrq->data->error = -ETIMEDOUT; -+ else -+ host->cmd->error = -ETIMEDOUT; -+ } else if (intmask & SDHSTS_CMD_TIME_OUT) -+ host->cmd->error = -ETIMEDOUT; -+ -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ } -+ else -+ bcm2835_sdhost_finish_command(host, NULL); -+} -+ -+static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ /* There are no dedicated data/space available interrupt -+ status bits, so it is necessary to use the single shared -+ data/space available FIFO status bits. It is therefore not -+ an error to get here when there is no data transfer in -+ progress. */ -+ log_event("IRQD", (u32)host->data, intmask); -+ if (!host->data) -+ return; -+ -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR | -+ SDHSTS_REW_TIME_OUT)) { -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR)) -+ host->data->error = -EILSEQ; -+ else -+ host->data->error = -ETIMEDOUT; -+ -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ } -+ -+ if (host->data->error) { -+ bcm2835_sdhost_finish_data(host); -+ } else if (host->data->flags & MMC_DATA_WRITE) { -+ /* Use the block interrupt for writes after the first block */ -+ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); -+ host->hcfg |= SDHCFG_BLOCK_IRPT_EN; -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ bcm2835_sdhost_transfer_pio(host); -+ } else { -+ bcm2835_sdhost_transfer_pio(host); -+ host->blocks--; -+ if ((host->blocks == 0) || host->data->error) -+ bcm2835_sdhost_finish_data(host); -+ } -+} -+ -+static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) -+{ -+ log_event("IRQK", (u32)host->data, intmask); -+ if (!host->data) { -+ pr_err("%s: got block interrupt 0x%08x even " -+ "though no data operation was in progress.\n", -+ mmc_hostname(host->mmc), (unsigned)intmask); -+ bcm2835_sdhost_dumpregs(host); -+ return; -+ } -+ -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR | -+ SDHSTS_REW_TIME_OUT)) { -+ if (intmask & (SDHSTS_CRC16_ERROR | -+ SDHSTS_FIFO_ERROR)) -+ host->data->error = -EILSEQ; -+ else -+ host->data->error = -ETIMEDOUT; -+ -+ if (host->debug) { -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ } -+ -+ if (!host->dma_desc) { -+ BUG_ON(!host->blocks); -+ if (host->data->error || (--host->blocks == 0)) { -+ bcm2835_sdhost_finish_data(host); -+ } else { -+ bcm2835_sdhost_transfer_pio(host); -+ } -+ } else if (host->data->flags & MMC_DATA_WRITE) { -+ bcm2835_sdhost_finish_data(host); -+ } -+} -+ -+static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) -+{ -+ irqreturn_t result = IRQ_NONE; -+ struct bcm2835_host *host = dev_id; -+ u32 intmask; -+ -+ spin_lock(&host->lock); -+ -+ intmask = bcm2835_sdhost_read(host, SDHSTS); -+ log_event("IRQ<", intmask, 0); -+ -+ bcm2835_sdhost_write(host, -+ SDHSTS_BUSY_IRPT | -+ SDHSTS_BLOCK_IRPT | -+ SDHSTS_SDIO_IRPT | -+ SDHSTS_DATA_FLAG, -+ SDHSTS); -+ -+ if (intmask & SDHSTS_BLOCK_IRPT) { -+ bcm2835_sdhost_block_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } -+ -+ if (intmask & SDHSTS_BUSY_IRPT) { -+ bcm2835_sdhost_busy_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } -+ -+ /* There is no true data interrupt status bit, so it is -+ necessary to qualify the data flag with the interrupt -+ enable bit */ -+ if ((intmask & SDHSTS_DATA_FLAG) && -+ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { -+ bcm2835_sdhost_data_irq(host, intmask); -+ result = IRQ_HANDLED; -+ } -+ -+ mmiowb(); -+ -+ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); -+ spin_unlock(&host->lock); -+ -+ return result; -+} -+ -+void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) -+{ -+ int div = 0; /* Initialized for compiler warning */ -+ unsigned int input_clock = clock; -+ unsigned long flags; -+ -+ if (host->debug) -+ pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); -+ -+ if ((host->overclock_50 > 50) && -+ (clock == 50*MHZ)) -+ clock = host->overclock_50 * MHZ + (MHZ - 1); -+ -+ /* The SDCDIV register has 11 bits, and holds (div - 2). -+ But in data mode the max is 50MHz wihout a minimum, and only the -+ bottom 3 bits are used. Since the switch over is automatic (unless -+ we have marked the card as slow...), chosen values have to make -+ sense in both modes. -+ Ident mode must be 100-400KHz, so can range check the requested -+ clock. CMD15 must be used to return to data mode, so this can be -+ monitored. -+ -+ clock 250MHz -> 0->125MHz, 1->83.3MHz, 2->62.5MHz, 3->50.0MHz -+ 4->41.7MHz, 5->35.7MHz, 6->31.3MHz, 7->27.8MHz -+ -+ 623->400KHz/27.8MHz -+ reset value (507)->491159/50MHz -+ -+ BUT, the 3-bit clock divisor in data mode is too small if the -+ core clock is higher than 250MHz, so instead use the SLOW_CARD -+ configuration bit to force the use of the ident clock divisor -+ at all times. -+ */ -+ -+ host->mmc->actual_clock = 0; -+ -+ if (host->firmware_sets_cdiv) { -+ u32 msg[3] = { clock, 0, 0 }; -+ -+ rpi_firmware_property(rpi_firmware_get(NULL), -+ RPI_FIRMWARE_SET_SDHOST_CLOCK, -+ &msg, sizeof(msg)); -+ -+ clock = max(msg[1], msg[2]); -+ spin_lock_irqsave(&host->lock, flags); -+ } else { -+ spin_lock_irqsave(&host->lock, flags); -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as -+ * possible to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ div = host->max_clk / clock; -+ if (div < 2) -+ div = 2; -+ if ((host->max_clk / div) > clock) -+ div++; -+ div -= 2; -+ -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; -+ -+ clock = host->max_clk / (div + 2); -+ -+ host->cdiv = div; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ -+ if (host->debug) -+ pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x " -+ "(actual clock %d)\n", -+ mmc_hostname(host->mmc), input_clock, -+ host->max_clk, host->cdiv, -+ clock); -+ } -+ -+ /* Calibrate some delays */ -+ -+ host->ns_per_fifo_word = (1000000000/clock) * -+ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); -+ -+ if (input_clock == 50 * MHZ) { -+ if (clock > input_clock) { -+ /* Save the closest value, to make it easier -+ to reduce in the event of error */ -+ host->overclock_50 = (clock/MHZ); -+ -+ if (clock != host->overclock) { -+ pr_info("%s: overclocking to %dHz\n", -+ mmc_hostname(host->mmc), clock); -+ host->overclock = clock; -+ } -+ } else if (host->overclock) { -+ host->overclock = 0; -+ if (clock == 50 * MHZ) -+ pr_warn("%s: cancelling overclock\n", -+ mmc_hostname(host->mmc)); -+ } -+ } else if (input_clock == 0) { -+ /* Reset the preferred overclock when the clock is stopped. -+ * This always happens during initialisation. */ -+ host->overclock_50 = host->user_overclock_50; -+ host->overclock = 0; -+ } -+ -+ /* Set the timeout to 500ms */ -+ bcm2835_sdhost_write(host, clock/2, SDTOUT); -+ -+ host->mmc->actual_clock = clock; -+ host->clock = input_clock; -+ host->reset_clock = 0; -+ -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ u32 edm, fsm; -+ -+ host = mmc_priv(mmc); -+ -+ if (host->debug) { -+ struct mmc_command *cmd = mrq->cmd; -+ BUG_ON(!cmd); -+ if (cmd->data) -+ pr_info("%s: cmd %d 0x%x (flags 0x%x) - %s %d*%d\n", -+ mmc_hostname(mmc), -+ cmd->opcode, cmd->arg, cmd->flags, -+ (cmd->data->flags & MMC_DATA_READ) ? -+ "read" : "write", cmd->data->blocks, -+ cmd->data->blksz); -+ else -+ pr_info("%s: cmd %d 0x%x (flags 0x%x)\n", -+ mmc_hostname(mmc), -+ cmd->opcode, cmd->arg, cmd->flags); -+ } -+ -+ /* Reset the error statuses in case this is a retry */ -+ if (mrq->sbc) -+ mrq->sbc->error = 0; -+ if (mrq->cmd) -+ mrq->cmd->error = 0; -+ if (mrq->data) -+ mrq->data->error = 0; -+ if (mrq->stop) -+ mrq->stop->error = 0; -+ -+ if (mrq->data && !is_power_of_2(mrq->data->blksz)) { -+ pr_err("%s: unsupported block size (%d bytes)\n", -+ mmc_hostname(mmc), mrq->data->blksz); -+ mrq->cmd->error = -EINVAL; -+ mmc_request_done(mmc, mrq); -+ return; -+ } -+ -+ if (host->use_dma && mrq->data && -+ (mrq->data->blocks > host->pio_limit)) -+ bcm2835_sdhost_prepare_dma(host, mrq->data); -+ -+ if (host->reset_clock) -+ bcm2835_sdhost_set_clock(host, host->clock); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ WARN_ON(host->mrq != NULL); -+ host->mrq = mrq; -+ -+ edm = bcm2835_sdhost_read(host, SDEDM); -+ fsm = edm & SDEDM_FSM_MASK; -+ -+ log_event("REQ<", (u32)mrq, edm); -+ if ((fsm != SDEDM_FSM_IDENTMODE) && -+ (fsm != SDEDM_FSM_DATAMODE)) { -+ log_event("REQ!", (u32)mrq, edm); -+ if (host->debug) { -+ pr_warn("%s: previous command (%d) not complete (EDM %x)\n", -+ mmc_hostname(host->mmc), -+ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, -+ edm); -+ log_dump(); -+ bcm2835_sdhost_dumpregs(host); -+ } -+ mrq->cmd->error = -EILSEQ; -+ tasklet_schedule(&host->finish_tasklet); -+ mmiowb(); -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ host->use_sbc = !!mrq->sbc && -+ (host->mrq->data->flags & USE_CMD23_FLAGS); -+ if (host->use_sbc) { -+ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } -+ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { -+ if (host->data && host->dma_desc) -+ /* DMA transfer starts now, PIO starts after irq */ -+ bcm2835_sdhost_start_dma(host); -+ -+ if (!host->use_busy) -+ bcm2835_sdhost_finish_command(host, &flags); -+ } -+ -+ log_event("CMD ", (u32)mrq->cmd->opcode, -+ mrq->data ? (u32)mrq->data->blksz : 0); -+ mmiowb(); -+ -+ log_event("REQ>", (u32)mrq, 0); -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) -+{ -+ -+ struct bcm2835_host *host = mmc_priv(mmc); -+ unsigned long flags; -+ -+ if (host->debug) -+ pr_info("%s: ios clock %d, pwr %d, bus_width %d, " -+ "timing %d, vdd %d, drv_type %d\n", -+ mmc_hostname(mmc), -+ ios->clock, ios->power_mode, ios->bus_width, -+ ios->timing, ios->signal_voltage, ios->drv_type); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ log_event("IOS<", ios->clock, 0); -+ -+ /* set bus width */ -+ host->hcfg &= ~SDHCFG_WIDE_EXT_BUS; -+ if (ios->bus_width == MMC_BUS_WIDTH_4) -+ host->hcfg |= SDHCFG_WIDE_EXT_BUS; -+ -+ host->hcfg |= SDHCFG_WIDE_INT_BUS; -+ -+ /* Disable clever clock switching, to cope with fast core clocks */ -+ host->hcfg |= SDHCFG_SLOW_CARD; -+ -+ bcm2835_sdhost_write(host, host->hcfg, SDHCFG); -+ -+ mmiowb(); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (!ios->clock || ios->clock != host->clock) -+ bcm2835_sdhost_set_clock(host, ios->clock); -+} -+ -+static struct mmc_host_ops bcm2835_sdhost_ops = { -+ .request = bcm2835_sdhost_request, -+ .set_ios = bcm2835_sdhost_set_ios, -+ .hw_reset = bcm2835_sdhost_reset, -+}; -+ -+static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ -+ host = container_of(work, struct bcm2835_host, cmd_wait_wq); -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); -+ -+ /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. -+ */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ bcm2835_sdhost_finish_command(host, &flags); -+ -+ mmiowb(); -+ -+ log_event("CWK>", (u32)host->cmd, 0); -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+} -+ -+static void bcm2835_sdhost_tasklet_finish(unsigned long param) -+{ -+ struct bcm2835_host *host; -+ unsigned long flags; -+ struct mmc_request *mrq; -+ struct dma_chan *terminate_chan = NULL; -+ -+ host = (struct bcm2835_host *)param; -+ -+ spin_lock_irqsave(&host->lock, flags); -+ -+ log_event("TSK<", (u32)host->mrq, 0); -+ /* -+ * If this tasklet gets rescheduled while running, it will -+ * be run again afterwards but without any active request. -+ */ -+ if (!host->mrq) { -+ spin_unlock_irqrestore(&host->lock, flags); -+ return; -+ } -+ -+ del_timer(&host->timer); -+ -+ mrq = host->mrq; -+ -+ /* Drop the overclock after any data corruption, or after any -+ * error while overclocked. Ignore errors for status commands, -+ * as they are likely when a card is ejected. */ -+ if (host->overclock) { -+ if ((mrq->cmd && mrq->cmd->error && -+ (mrq->cmd->opcode != MMC_SEND_STATUS)) || -+ (mrq->data && mrq->data->error) || -+ (mrq->stop && mrq->stop->error) || -+ (mrq->sbc && mrq->sbc->error)) { -+ host->overclock_50--; -+ pr_warn("%s: reducing overclock due to errors\n", -+ mmc_hostname(host->mmc)); -+ host->reset_clock = 1; -+ mrq->cmd->error = -ETIMEDOUT; -+ mrq->cmd->retries = 1; -+ } -+ } -+ -+ host->mrq = NULL; -+ host->cmd = NULL; -+ host->data = NULL; -+ -+ mmiowb(); -+ -+ host->dma_desc = NULL; -+ terminate_chan = host->dma_chan; -+ host->dma_chan = NULL; -+ -+ spin_unlock_irqrestore(&host->lock, flags); -+ -+ if (terminate_chan) -+ { -+ int err = dmaengine_terminate_all(terminate_chan); -+ if (err) -+ pr_err("%s: failed to terminate DMA (%d)\n", -+ mmc_hostname(host->mmc), err); -+ } -+ -+ /* The SDHOST block doesn't report any errors for a disconnected -+ interface. All cards and SDIO devices should report some supported -+ voltage range, so a zero response to SEND_OP_COND, IO_SEND_OP_COND -+ or APP_SEND_OP_COND can be treated as an error. */ -+ if (((mrq->cmd->opcode == MMC_SEND_OP_COND) || -+ (mrq->cmd->opcode == SD_IO_SEND_OP_COND) || -+ (mrq->cmd->opcode == SD_APP_OP_COND)) && -+ (mrq->cmd->error == 0) && -+ (mrq->cmd->resp[0] == 0)) { -+ mrq->cmd->error = -ETIMEDOUT; -+ if (host->debug) -+ pr_info("%s: faking timeout due to zero OCR\n", -+ mmc_hostname(host->mmc)); -+ } -+ -+ mmc_request_done(host->mmc, mrq); -+ log_event("TSK>", (u32)mrq, 0); -+} -+ -+int bcm2835_sdhost_add_host(struct bcm2835_host *host) -+{ -+ struct mmc_host *mmc; -+ struct dma_slave_config cfg; -+ char pio_limit_string[20]; -+ int ret; -+ -+ mmc = host->mmc; -+ -+ mmc->f_max = host->max_clk; -+ mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; -+ -+ mmc->max_busy_timeout = (~(unsigned int)0)/(mmc->f_max/1000); -+ -+ pr_debug("f_max %d, f_min %d, max_busy_timeout %d\n", -+ mmc->f_max, mmc->f_min, mmc->max_busy_timeout); -+ -+ /* host controller capabilities */ -+ mmc->caps |= -+ MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | -+ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | -+ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); -+ -+ spin_lock_init(&host->lock); -+ -+ if (host->allow_dma) { -+ if (IS_ERR_OR_NULL(host->dma_chan_rxtx)) { -+ pr_err("%s: unable to initialise DMA channel. " -+ "Falling back to PIO\n", -+ mmc_hostname(mmc)); -+ host->use_dma = false; -+ } else { -+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ cfg.slave_id = 13; /* DREQ channel */ -+ -+ /* Validate the slave configurations */ -+ -+ cfg.direction = DMA_MEM_TO_DEV; -+ cfg.src_addr = 0; -+ cfg.dst_addr = host->bus_addr + SDDATA; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ -+ if (ret == 0) { -+ host->dma_cfg_tx = cfg; -+ -+ cfg.direction = DMA_DEV_TO_MEM; -+ cfg.src_addr = host->bus_addr + SDDATA; -+ cfg.dst_addr = 0; -+ -+ ret = dmaengine_slave_config(host->dma_chan_rxtx, &cfg); -+ } -+ -+ if (ret == 0) { -+ host->dma_cfg_rx = cfg; -+ -+ host->use_dma = true; -+ } else { -+ pr_err("%s: unable to configure DMA channel. " -+ "Falling back to PIO\n", -+ mmc_hostname(mmc)); -+ dma_release_channel(host->dma_chan_rxtx); -+ host->dma_chan_rxtx = NULL; -+ host->use_dma = false; -+ } -+ } -+ } else { -+ host->use_dma = false; -+ } -+ -+ mmc->max_segs = 128; -+ mmc->max_req_size = 524288; -+ mmc->max_seg_size = mmc->max_req_size; -+ mmc->max_blk_size = 512; -+ mmc->max_blk_count = 65535; -+ -+ /* report supported voltage ranges */ -+ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; -+ -+ tasklet_init(&host->finish_tasklet, -+ bcm2835_sdhost_tasklet_finish, (unsigned long)host); -+ -+ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); -+ -+ setup_timer(&host->timer, bcm2835_sdhost_timeout, -+ (unsigned long)host); -+ -+ bcm2835_sdhost_init(host, 0); -+ -+ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, -+ mmc_hostname(mmc), host); -+ if (ret) { -+ pr_err("%s: failed to request IRQ %d: %d\n", -+ mmc_hostname(mmc), host->irq, ret); -+ goto untasklet; -+ } -+ -+ mmiowb(); -+ mmc_add_host(mmc); -+ -+ pio_limit_string[0] = '\0'; -+ if (host->use_dma && (host->pio_limit > 0)) -+ sprintf(pio_limit_string, " (>%d)", host->pio_limit); -+ pr_info("%s: %s loaded - DMA %s%s\n", -+ mmc_hostname(mmc), DRIVER_NAME, -+ host->use_dma ? "enabled" : "disabled", -+ pio_limit_string); -+ -+ return 0; -+ -+untasklet: -+ tasklet_kill(&host->finish_tasklet); -+ -+ return ret; -+} -+ -+static int bcm2835_sdhost_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node; -+ struct clk *clk; -+ struct resource *iomem; -+ struct bcm2835_host *host; -+ struct mmc_host *mmc; -+ const __be32 *addr; -+ u32 msg[3]; -+ int ret; -+ -+ pr_debug("bcm2835_sdhost_probe\n"); -+ mmc = mmc_alloc_host(sizeof(*host), dev); -+ if (!mmc) -+ return -ENOMEM; -+ -+ mmc->ops = &bcm2835_sdhost_ops; -+ host = mmc_priv(mmc); -+ host->mmc = mmc; -+ host->pio_timeout = msecs_to_jiffies(500); -+ host->pio_limit = 1; -+ host->max_delay = 1; /* Warn if over 1ms */ -+ host->allow_dma = 1; -+ spin_lock_init(&host->lock); -+ -+ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ host->ioaddr = devm_ioremap_resource(dev, iomem); -+ if (IS_ERR(host->ioaddr)) { -+ ret = PTR_ERR(host->ioaddr); -+ goto err; -+ } -+ -+ addr = of_get_address(node, 0, NULL, NULL); -+ if (!addr) { -+ dev_err(dev, "could not get DMA-register address\n"); -+ return -ENODEV; -+ } -+ host->bus_addr = be32_to_cpup(addr); -+ pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", -+ (unsigned long)host->ioaddr, -+ (unsigned long)iomem->start, -+ (unsigned long)host->bus_addr); -+ -+ if (node) { -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,delay-after-stop", -+ &host->delay_after_stop); -+ of_property_read_u32(node, -+ "brcm,overclock-50", -+ &host->user_overclock_50); -+ of_property_read_u32(node, -+ "brcm,pio-limit", -+ &host->pio_limit); -+ host->allow_dma = -+ !of_property_read_bool(node, "brcm,force-pio"); -+ host->debug = of_property_read_bool(node, "brcm,debug"); -+ } -+ -+ host->dma_chan = NULL; -+ host->dma_desc = NULL; -+ -+ /* Formally recognise the other way of disabling DMA */ -+ if (host->pio_limit == 0x7fffffff) -+ host->allow_dma = false; -+ -+ if (host->allow_dma) { -+ if (node) { -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "rx-tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "tx"); -+ if (!host->dma_chan_rxtx) -+ host->dma_chan_rxtx = -+ dma_request_slave_channel(dev, "rx"); -+ } else { -+ dma_cap_mask_t mask; -+ -+ dma_cap_zero(mask); -+ /* we don't care about the channel, any would work */ -+ dma_cap_set(DMA_SLAVE, mask); -+ host->dma_chan_rxtx = -+ dma_request_channel(mask, NULL, NULL); -+ } -+ } -+ -+ clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(clk)) { -+ ret = PTR_ERR(clk); -+ if (ret == -EPROBE_DEFER) -+ dev_info(dev, "could not get clk, deferring probe\n"); -+ else -+ dev_err(dev, "could not get clk\n"); -+ goto err; -+ } -+ -+ host->max_clk = clk_get_rate(clk); -+ -+ host->irq = platform_get_irq(pdev, 0); -+ if (host->irq <= 0) { -+ dev_err(dev, "get IRQ failed\n"); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ pr_debug(" - max_clk %lx, irq %d\n", -+ (unsigned long)host->max_clk, -+ (int)host->irq); -+ -+ log_init(dev, iomem->start - host->bus_addr); -+ -+ if (node) -+ mmc_of_parse(mmc); -+ else -+ mmc->caps |= MMC_CAP_4_BIT_DATA; -+ -+ msg[0] = 0; -+ msg[1] = ~0; -+ msg[2] = ~0; -+ -+ rpi_firmware_property(rpi_firmware_get(NULL), -+ RPI_FIRMWARE_SET_SDHOST_CLOCK, -+ &msg, sizeof(msg)); -+ -+ host->firmware_sets_cdiv = (msg[1] != ~0); -+ -+ ret = bcm2835_sdhost_add_host(host); -+ if (ret) -+ goto err; -+ -+ platform_set_drvdata(pdev, host); -+ -+ pr_debug("bcm2835_sdhost_probe -> OK\n"); -+ -+ return 0; -+ -+err: -+ pr_debug("bcm2835_sdhost_probe -> err %d\n", ret); -+ mmc_free_host(mmc); -+ -+ return ret; -+} -+ -+static int bcm2835_sdhost_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_host *host = platform_get_drvdata(pdev); -+ -+ pr_debug("bcm2835_sdhost_remove\n"); -+ -+ mmc_remove_host(host->mmc); -+ -+ bcm2835_sdhost_set_power(host, false); -+ -+ free_irq(host->irq, host); -+ -+ del_timer_sync(&host->timer); -+ -+ tasklet_kill(&host->finish_tasklet); -+ -+ mmc_free_host(host->mmc); -+ platform_set_drvdata(pdev, NULL); -+ -+ pr_debug("bcm2835_sdhost_remove - OK\n"); -+ return 0; -+} -+ -+static const struct of_device_id bcm2835_sdhost_match[] = { -+ { .compatible = "brcm,bcm2835-sdhost" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); -+ -+static struct platform_driver bcm2835_sdhost_driver = { -+ .probe = bcm2835_sdhost_probe, -+ .remove = bcm2835_sdhost_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_sdhost_match, -+ }, -+}; -+module_platform_driver(bcm2835_sdhost_driver); -+ -+MODULE_ALIAS("platform:sdhost-bcm2835"); -+MODULE_DESCRIPTION("BCM2835 SDHost driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Phil Elwell"); - -From 0eda1e885a24ef523c6f88b4f62dc928c47f00c6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 11 May 2016 12:50:33 +0100 -Subject: [PATCH 036/122] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards - -Some SD cards have been found that corrupt data when small blocks -are erased. Add a quirk to indicate that ERASE should not be used, -and set it for cards of that type. - -Signed-off-by: Phil Elwell - -mmc: Apply QUIRK_BROKEN_ERASE to other capacities - -Signed-off-by: Phil Elwell - -mmc: Add card_quirks module parameter, log quirks - -Use mmc_block.card_quirks to override the quirks for all SD or MMC -cards. The value is a bitfield using the bit positions defined in -include/linux/mmc/card.h. If the module parameter is placed in the -kernel command line (or bootargs) stored on the card then, assuming the -device only has one SD card interface, the override effectively becomes -card-specific. - -Signed-off-by: Phil Elwell ---- - drivers/mmc/card/block.c | 39 ++++++++++++++++++++++++++++++++++++--- - drivers/mmc/core/core.c | 3 ++- - include/linux/mmc/card.h | 3 +++ - 3 files changed, 41 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 709a872ed484a9da1ce620238c3222190c612f86..894c105be9ce7f83147a62c433c787b90a5e7c17 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -135,6 +135,13 @@ enum { - module_param(perdev_minors, int, 0444); - MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); - -+/* -+ * Allow quirks to be overridden for the current card -+ */ -+static char *card_quirks; -+module_param(card_quirks, charp, 0644); -+MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); -+ - static inline int mmc_blk_part_switch(struct mmc_card *card, - struct mmc_blk_data *md); - static int get_card_status(struct mmc_card *card, u32 *status, int retries); -@@ -2573,6 +2580,17 @@ static const struct mmc_fixup blk_fixups[] = - MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, - MMC_QUIRK_TRIM_BROKEN), - -+ /* -+ * On some Kingston SD cards, multiple erases of less than 64 -+ * sectors can cause corruption. -+ */ -+ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ - END_FIXUP - }; - -@@ -2580,6 +2598,7 @@ static int mmc_blk_probe(struct mmc_card *card) - { - struct mmc_blk_data *md, *part_md; - char cap_str[10]; -+ char quirk_str[24]; - - /* - * Check that the card supports the command class(es) we need. -@@ -2587,7 +2606,16 @@ static int mmc_blk_probe(struct mmc_card *card) - if (!(card->csd.cmdclass & CCC_BLOCK_READ)) - return -ENODEV; - -- mmc_fixup_device(card, blk_fixups); -+ if (card_quirks) { -+ unsigned long quirks; -+ if (kstrtoul(card_quirks, 0, &quirks) == 0) -+ card->quirks = (unsigned int)quirks; -+ else -+ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", -+ card_quirks); -+ } -+ else -+ mmc_fixup_device(card, blk_fixups); - - md = mmc_blk_alloc(card); - if (IS_ERR(md)) -@@ -2595,9 +2623,14 @@ static int mmc_blk_probe(struct mmc_card *card) - - string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, - cap_str, sizeof(cap_str)); -- pr_info("%s: %s %s %s %s\n", -+ if (card->quirks) -+ snprintf(quirk_str, sizeof(quirk_str), -+ " (quirks 0x%08x)", card->quirks); -+ else -+ quirk_str[0] = '\0'; -+ pr_info("%s: %s %s %s%s%s\n", - md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), -- cap_str, md->read_only ? "(ro)" : ""); -+ cap_str, md->read_only ? " (ro)" : "", quirk_str); - - if (mmc_blk_alloc_parts(card, md)) - goto out; -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index 2553d903a82b9eaa8577c1269bc9f63e18b00085..59a4044ea4c2e1283b1cad8afc7e67efaf8653fb 100644 ---- a/drivers/mmc/core/core.c -+++ b/drivers/mmc/core/core.c -@@ -2409,7 +2409,8 @@ EXPORT_SYMBOL(mmc_erase); - int mmc_can_erase(struct mmc_card *card) - { - if ((card->host->caps & MMC_CAP_ERASE) && -- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) -+ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && -+ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) - return 1; - return 0; - } -diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h -index 73fad83acbcb6a157587180516f9ffe7c61eb7d7..e7c9d3098ac06e3c6554fa3373a311f937cd6f96 100644 ---- a/include/linux/mmc/card.h -+++ b/include/linux/mmc/card.h -@@ -283,6 +283,9 @@ struct mmc_card { - #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ - - -+#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ -+ -+ - unsigned int erase_size; /* erase size in sectors */ - unsigned int erase_shift; /* if erase unit is power 2 */ - unsigned int pref_erase; /* in sectors */ - -From ebd7f1f66e66573d57edc087910e4f34f71a52d9 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 037/122] cma: Add vc_cma driver to enable use of CMA -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -vc_cma: Make the vc_cma area the default contiguous DMA area - -vc_cma: Provide empty functions when module is not built - -Providing empty functions saves the users from guarding the -function call with an #if clause. -Move __init markings from prototypes to functions. - -Signed-off-by: Noralf Trønnes ---- - drivers/char/Kconfig | 2 + - drivers/char/Makefile | 1 + - drivers/char/broadcom/Kconfig | 15 + - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vc_cma/Makefile | 7 + - drivers/char/broadcom/vc_cma/vc_cma.c | 1193 +++++++++++++++++++++++++++++++++ - include/linux/broadcom/vc_cma.h | 36 + - 7 files changed, 1255 insertions(+) - create mode 100644 drivers/char/broadcom/Kconfig - create mode 100644 drivers/char/broadcom/Makefile - create mode 100644 drivers/char/broadcom/vc_cma/Makefile - create mode 100644 drivers/char/broadcom/vc_cma/vc_cma.c - create mode 100644 include/linux/broadcom/vc_cma.h - -diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index dcc09739a54ef860343ac2fca5acf59724ca60e2..6d518c7635ae128f4554945dd3ffd351f9d325bf 100644 ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -4,6 +4,8 @@ - - menu "Character devices" - -+source "drivers/char/broadcom/Kconfig" -+ - source "drivers/tty/Kconfig" - - config DEVMEM -diff --git a/drivers/char/Makefile b/drivers/char/Makefile -index 6e6c244a66a02c4efd57229b0f31d331377bbc55..67c40b8f2ff25f423cb74b64de9afa6f32479aed 100644 ---- a/drivers/char/Makefile -+++ b/drivers/char/Makefile -@@ -60,3 +60,4 @@ js-rtc-y = rtc.o - obj-$(CONFIG_TILE_SROM) += tile-srom.o - obj-$(CONFIG_XILLYBUS) += xillybus/ - obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o -+obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/ -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..2d8bd6e5016aab7340636c1f5dc4dd0cbacae6c0 ---- /dev/null -+++ b/drivers/char/broadcom/Kconfig -@@ -0,0 +1,15 @@ -+# -+# Broadcom char driver config -+# -+ -+menuconfig BRCM_CHAR_DRIVERS -+ bool "Broadcom Char Drivers" -+ help -+ Broadcom's char drivers -+ -+config BCM_VC_CMA -+ bool "Videocore CMA" -+ depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ -+ default n -+ help -+ Helper for videocore CMA access. -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..13c5bca291ccc0df090c4e61169ace8f18ba60fe ---- /dev/null -+++ b/drivers/char/broadcom/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ -diff --git a/drivers/char/broadcom/vc_cma/Makefile b/drivers/char/broadcom/vc_cma/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..d222313e28995bb54e9448192f5c99a352dde2e8 ---- /dev/null -+++ b/drivers/char/broadcom/vc_cma/Makefile -@@ -0,0 +1,7 @@ -+ccflags-$(CONFIG_BCM_VC_CMA) += -Wall -Wstrict-prototypes -Wno-trigraphs -Werror -+ccflags-$(CONFIG_BCM_VC_CMA) += -Iinclude/linux/broadcom -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vchi -Idrivers/staging/vc04_services/interface/vchiq_arm -+ccflags-$(CONFIG_BCM_VC_CMA) += -D__KERNEL__ -D__linux__ -+ -+obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o -+ -+vc-cma-objs := vc_cma.o -diff --git a/drivers/char/broadcom/vc_cma/vc_cma.c b/drivers/char/broadcom/vc_cma/vc_cma.c -new file mode 100644 -index 0000000000000000000000000000000000000000..85f6e9da9e5baa0abfba618a171881c078f38496 ---- /dev/null -+++ b/drivers/char/broadcom/vc_cma/vc_cma.c -@@ -0,0 +1,1193 @@ -+/** -+ * Copyright (c) 2010-2012 Broadcom. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "vc_cma.h" -+ -+#include "vchiq_util.h" -+#include "vchiq_connected.h" -+//#include "debug_sym.h" -+//#include "vc_mem.h" -+ -+#define DRIVER_NAME "vc-cma" -+ -+#define LOG_DBG(fmt, ...) \ -+ if (vc_cma_debug) \ -+ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) -+#define LOG_INFO(fmt, ...) \ -+ printk(KERN_INFO fmt "\n", ##__VA_ARGS__) -+#define LOG_ERR(fmt, ...) \ -+ printk(KERN_ERR fmt "\n", ##__VA_ARGS__) -+ -+#define VC_CMA_FOURCC VCHIQ_MAKE_FOURCC('C', 'M', 'A', ' ') -+#define VC_CMA_VERSION 2 -+ -+#define VC_CMA_CHUNK_ORDER 6 /* 256K */ -+#define VC_CMA_CHUNK_SIZE (4096 << VC_CMA_CHUNK_ORDER) -+#define VC_CMA_MAX_PARAMS_PER_MSG \ -+ ((VCHIQ_MAX_MSG_SIZE - sizeof(unsigned short))/sizeof(unsigned short)) -+#define VC_CMA_RESERVE_COUNT_MAX 16 -+ -+#define PAGES_PER_CHUNK (VC_CMA_CHUNK_SIZE / PAGE_SIZE) -+ -+#define VCADDR_TO_PHYSADDR(vcaddr) (mm_vc_mem_phys_addr + vcaddr) -+ -+#define loud_error(...) \ -+ LOG_ERR("===== " __VA_ARGS__) -+ -+enum { -+ VC_CMA_MSG_QUIT, -+ VC_CMA_MSG_OPEN, -+ VC_CMA_MSG_TICK, -+ VC_CMA_MSG_ALLOC, /* chunk count */ -+ VC_CMA_MSG_FREE, /* chunk, chunk, ... */ -+ VC_CMA_MSG_ALLOCATED, /* chunk, chunk, ... */ -+ VC_CMA_MSG_REQUEST_ALLOC, /* chunk count */ -+ VC_CMA_MSG_REQUEST_FREE, /* chunk count */ -+ VC_CMA_MSG_RESERVE, /* bytes lo, bytes hi */ -+ VC_CMA_MSG_UPDATE_RESERVE, -+ VC_CMA_MSG_MAX -+}; -+ -+struct cma_msg { -+ unsigned short type; -+ unsigned short params[VC_CMA_MAX_PARAMS_PER_MSG]; -+}; -+ -+struct vc_cma_reserve_user { -+ unsigned int pid; -+ unsigned int reserve; -+}; -+ -+/* Device (/dev) related variables */ -+static dev_t vc_cma_devnum; -+static struct class *vc_cma_class; -+static struct cdev vc_cma_cdev; -+static int vc_cma_inited; -+static int vc_cma_debug; -+ -+/* Proc entry */ -+static struct proc_dir_entry *vc_cma_proc_entry; -+ -+phys_addr_t vc_cma_base; -+struct page *vc_cma_base_page; -+unsigned int vc_cma_size; -+EXPORT_SYMBOL(vc_cma_size); -+unsigned int vc_cma_initial; -+unsigned int vc_cma_chunks; -+unsigned int vc_cma_chunks_used; -+unsigned int vc_cma_chunks_reserved; -+ -+ -+void *vc_cma_dma_alloc; -+unsigned int vc_cma_dma_size; -+ -+static int in_loud_error; -+ -+unsigned int vc_cma_reserve_total; -+unsigned int vc_cma_reserve_count; -+struct vc_cma_reserve_user vc_cma_reserve_users[VC_CMA_RESERVE_COUNT_MAX]; -+static DEFINE_SEMAPHORE(vc_cma_reserve_mutex); -+static DEFINE_SEMAPHORE(vc_cma_worker_queue_push_mutex); -+ -+static u64 vc_cma_dma_mask = DMA_BIT_MASK(32); -+static struct platform_device vc_cma_device = { -+ .name = "vc-cma", -+ .id = 0, -+ .dev = { -+ .dma_mask = &vc_cma_dma_mask, -+ .coherent_dma_mask = DMA_BIT_MASK(32), -+ }, -+}; -+ -+static VCHIQ_INSTANCE_T cma_instance; -+static VCHIQ_SERVICE_HANDLE_T cma_service; -+static VCHIU_QUEUE_T cma_msg_queue; -+static struct task_struct *cma_worker; -+ -+static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid); -+static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply); -+static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, -+ VCHIQ_HEADER_T * header, -+ VCHIQ_SERVICE_HANDLE_T service, -+ void *bulk_userdata); -+static void send_vc_msg(unsigned short type, -+ unsigned short param1, unsigned short param2); -+static bool send_worker_msg(VCHIQ_HEADER_T * msg); -+ -+static int early_vc_cma_mem(char *p) -+{ -+ unsigned int new_size; -+ printk(KERN_NOTICE "early_vc_cma_mem(%s)", p); -+ vc_cma_size = memparse(p, &p); -+ vc_cma_initial = vc_cma_size; -+ if (*p == '/') -+ vc_cma_size = memparse(p + 1, &p); -+ if (*p == '@') -+ vc_cma_base = memparse(p + 1, &p); -+ -+ new_size = (vc_cma_size - ((-vc_cma_base) & (VC_CMA_CHUNK_SIZE - 1))) -+ & ~(VC_CMA_CHUNK_SIZE - 1); -+ if (new_size > vc_cma_size) -+ vc_cma_size = 0; -+ vc_cma_initial = (vc_cma_initial + VC_CMA_CHUNK_SIZE - 1) -+ & ~(VC_CMA_CHUNK_SIZE - 1); -+ if (vc_cma_initial > vc_cma_size) -+ vc_cma_initial = vc_cma_size; -+ vc_cma_base = (vc_cma_base + VC_CMA_CHUNK_SIZE - 1) -+ & ~(VC_CMA_CHUNK_SIZE - 1); -+ -+ printk(KERN_NOTICE " -> initial %x, size %x, base %x", vc_cma_initial, -+ vc_cma_size, (unsigned int)vc_cma_base); -+ -+ return 0; -+} -+ -+early_param("vc-cma-mem", early_vc_cma_mem); -+ -+void __init vc_cma_early_init(void) -+{ -+ LOG_DBG("vc_cma_early_init - vc_cma_chunks = %d", vc_cma_chunks); -+ if (vc_cma_size) { -+ int rc = platform_device_register(&vc_cma_device); -+ LOG_DBG("platform_device_register -> %d", rc); -+ } -+} -+ -+void __init vc_cma_reserve(void) -+{ -+ /* if vc_cma_size is set, then declare vc CMA area of the same -+ * size from the end of memory -+ */ -+ if (vc_cma_size) { -+ if (dma_declare_contiguous(&vc_cma_device.dev, vc_cma_size, -+ vc_cma_base, 0) == 0) { -+ if (!dev_get_cma_area(NULL)) { -+ /* There is no default CMA area - make this -+ the default */ -+ struct cma *vc_cma_area = dev_get_cma_area( -+ &vc_cma_device.dev); -+ dma_contiguous_set_default(vc_cma_area); -+ LOG_INFO("vc_cma_reserve - using vc_cma as " -+ "the default contiguous DMA area"); -+ } -+ } else { -+ LOG_ERR("vc_cma: dma_declare_contiguous(%x,%x) failed", -+ vc_cma_size, (unsigned int)vc_cma_base); -+ vc_cma_size = 0; -+ } -+ } -+ vc_cma_chunks = vc_cma_size / VC_CMA_CHUNK_SIZE; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_open -+* -+***************************************************************************/ -+ -+static int vc_cma_open(struct inode *inode, struct file *file) -+{ -+ (void)inode; -+ (void)file; -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_release -+* -+***************************************************************************/ -+ -+static int vc_cma_release(struct inode *inode, struct file *file) -+{ -+ (void)inode; -+ (void)file; -+ -+ vc_cma_set_reserve(0, current->tgid); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_ioctl -+* -+***************************************************************************/ -+ -+static long vc_cma_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int rc = 0; -+ -+ (void)cmd; -+ (void)arg; -+ -+ switch (cmd) { -+ case VC_CMA_IOC_RESERVE: -+ rc = vc_cma_set_reserve((unsigned int)arg, current->tgid); -+ if (rc >= 0) -+ rc = 0; -+ break; -+ default: -+ LOG_ERR("vc-cma: Unknown ioctl %x", cmd); -+ return -ENOTTY; -+ } -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for the driver. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_cma_fops = { -+ .owner = THIS_MODULE, -+ .open = vc_cma_open, -+ .release = vc_cma_release, -+ .unlocked_ioctl = vc_cma_ioctl, -+}; -+ -+/**************************************************************************** -+* -+* vc_cma_proc_open -+* -+***************************************************************************/ -+ -+static int vc_cma_show_info(struct seq_file *m, void *v) -+{ -+ int i; -+ -+ seq_printf(m, "Videocore CMA:\n"); -+ seq_printf(m, " Base : %08x\n", (unsigned int)vc_cma_base); -+ seq_printf(m, " Length : %08x\n", vc_cma_size); -+ seq_printf(m, " Initial : %08x\n", vc_cma_initial); -+ seq_printf(m, " Chunk size : %08x\n", VC_CMA_CHUNK_SIZE); -+ seq_printf(m, " Chunks : %4d (%d bytes)\n", -+ (int)vc_cma_chunks, -+ (int)(vc_cma_chunks * VC_CMA_CHUNK_SIZE)); -+ seq_printf(m, " Used : %4d (%d bytes)\n", -+ (int)vc_cma_chunks_used, -+ (int)(vc_cma_chunks_used * VC_CMA_CHUNK_SIZE)); -+ seq_printf(m, " Reserved : %4d (%d bytes)\n", -+ (unsigned int)vc_cma_chunks_reserved, -+ (int)(vc_cma_chunks_reserved * VC_CMA_CHUNK_SIZE)); -+ -+ for (i = 0; i < vc_cma_reserve_count; i++) { -+ struct vc_cma_reserve_user *user = &vc_cma_reserve_users[i]; -+ seq_printf(m, " PID %5d: %d bytes\n", user->pid, -+ user->reserve); -+ } -+ seq_printf(m, " dma_alloc : %p (%d pages)\n", -+ vc_cma_dma_alloc ? page_address(vc_cma_dma_alloc) : 0, -+ vc_cma_dma_size); -+ -+ seq_printf(m, "\n"); -+ -+ return 0; -+} -+ -+static int vc_cma_proc_open(struct inode *inode, struct file *file) -+{ -+ return single_open(file, vc_cma_show_info, NULL); -+} -+ -+/**************************************************************************** -+* -+* vc_cma_proc_write -+* -+***************************************************************************/ -+ -+static int vc_cma_proc_write(struct file *file, -+ const char __user *buffer, -+ size_t size, loff_t *ppos) -+{ -+ int rc = -EFAULT; -+ char input_str[20]; -+ -+ memset(input_str, 0, sizeof(input_str)); -+ -+ if (size > sizeof(input_str)) { -+ LOG_ERR("%s: input string length too long", __func__); -+ goto out; -+ } -+ -+ if (copy_from_user(input_str, buffer, size - 1)) { -+ LOG_ERR("%s: failed to get input string", __func__); -+ goto out; -+ } -+#define ALLOC_STR "alloc" -+#define FREE_STR "free" -+#define DEBUG_STR "debug" -+#define RESERVE_STR "reserve" -+#define DMA_ALLOC_STR "dma_alloc" -+#define DMA_FREE_STR "dma_free" -+ if (strncmp(input_str, ALLOC_STR, strlen(ALLOC_STR)) == 0) { -+ int alloc_size; -+ char *p = input_str + strlen(ALLOC_STR); -+ -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ LOG_INFO("/proc/vc-cma: alloc %d", alloc_size); -+ if (alloc_size) -+ send_vc_msg(VC_CMA_MSG_REQUEST_FREE, -+ alloc_size / VC_CMA_CHUNK_SIZE, 0); -+ else -+ LOG_ERR("invalid size '%s'", p); -+ rc = size; -+ } else if (strncmp(input_str, FREE_STR, strlen(FREE_STR)) == 0) { -+ int alloc_size; -+ char *p = input_str + strlen(FREE_STR); -+ -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ LOG_INFO("/proc/vc-cma: free %d", alloc_size); -+ if (alloc_size) -+ send_vc_msg(VC_CMA_MSG_REQUEST_ALLOC, -+ alloc_size / VC_CMA_CHUNK_SIZE, 0); -+ else -+ LOG_ERR("invalid size '%s'", p); -+ rc = size; -+ } else if (strncmp(input_str, DEBUG_STR, strlen(DEBUG_STR)) == 0) { -+ char *p = input_str + strlen(DEBUG_STR); -+ while (*p == ' ') -+ p++; -+ if ((strcmp(p, "on") == 0) || (strcmp(p, "1") == 0)) -+ vc_cma_debug = 1; -+ else if ((strcmp(p, "off") == 0) || (strcmp(p, "0") == 0)) -+ vc_cma_debug = 0; -+ LOG_INFO("/proc/vc-cma: debug %s", vc_cma_debug ? "on" : "off"); -+ rc = size; -+ } else if (strncmp(input_str, RESERVE_STR, strlen(RESERVE_STR)) == 0) { -+ int alloc_size; -+ int reserved; -+ char *p = input_str + strlen(RESERVE_STR); -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ -+ reserved = vc_cma_set_reserve(alloc_size, current->tgid); -+ rc = (reserved >= 0) ? size : reserved; -+ } else if (strncmp(input_str, DMA_ALLOC_STR, strlen(DMA_ALLOC_STR)) == 0) { -+ int alloc_size; -+ char *p = input_str + strlen(DMA_ALLOC_STR); -+ while (*p == ' ') -+ p++; -+ alloc_size = memparse(p, NULL); -+ -+ if (vc_cma_dma_alloc) { -+ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, -+ vc_cma_dma_size); -+ vc_cma_dma_alloc = NULL; -+ vc_cma_dma_size = 0; -+ } -+ vc_cma_dma_alloc = dma_alloc_from_contiguous(NULL, alloc_size, 0); -+ vc_cma_dma_size = (vc_cma_dma_alloc ? alloc_size : 0); -+ if (vc_cma_dma_alloc) -+ LOG_INFO("dma_alloc(%d pages) -> %p", alloc_size, page_address(vc_cma_dma_alloc)); -+ else -+ LOG_ERR("dma_alloc(%d pages) failed", alloc_size); -+ rc = size; -+ } else if (strncmp(input_str, DMA_FREE_STR, strlen(DMA_FREE_STR)) == 0) { -+ if (vc_cma_dma_alloc) { -+ dma_release_from_contiguous(NULL, vc_cma_dma_alloc, -+ vc_cma_dma_size); -+ vc_cma_dma_alloc = NULL; -+ vc_cma_dma_size = 0; -+ } -+ rc = size; -+ } -+ -+out: -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for /proc interface. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_cma_proc_fops = { -+ .open = vc_cma_proc_open, -+ .read = seq_read, -+ .write = vc_cma_proc_write, -+ .llseek = seq_lseek, -+ .release = single_release -+}; -+ -+static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid) -+{ -+ struct vc_cma_reserve_user *user = NULL; -+ int delta = 0; -+ int i; -+ -+ if (down_interruptible(&vc_cma_reserve_mutex)) -+ return -ERESTARTSYS; -+ -+ for (i = 0; i < vc_cma_reserve_count; i++) { -+ if (pid == vc_cma_reserve_users[i].pid) { -+ user = &vc_cma_reserve_users[i]; -+ delta = reserve - user->reserve; -+ if (reserve) -+ user->reserve = reserve; -+ else { -+ /* Remove this entry by copying downwards */ -+ while ((i + 1) < vc_cma_reserve_count) { -+ user[0].pid = user[1].pid; -+ user[0].reserve = user[1].reserve; -+ user++; -+ i++; -+ } -+ vc_cma_reserve_count--; -+ user = NULL; -+ } -+ break; -+ } -+ } -+ -+ if (reserve && !user) { -+ if (vc_cma_reserve_count == VC_CMA_RESERVE_COUNT_MAX) { -+ LOG_ERR("vc-cma: Too many reservations - " -+ "increase CMA_RESERVE_COUNT_MAX"); -+ up(&vc_cma_reserve_mutex); -+ return -EBUSY; -+ } -+ user = &vc_cma_reserve_users[vc_cma_reserve_count]; -+ user->pid = pid; -+ user->reserve = reserve; -+ delta = reserve; -+ vc_cma_reserve_count++; -+ } -+ -+ vc_cma_reserve_total += delta; -+ -+ send_vc_msg(VC_CMA_MSG_RESERVE, -+ vc_cma_reserve_total & 0xffff, vc_cma_reserve_total >> 16); -+ -+ send_worker_msg((VCHIQ_HEADER_T *) VC_CMA_MSG_UPDATE_RESERVE); -+ -+ LOG_DBG("/proc/vc-cma: reserve %d (PID %d) - total %u", -+ reserve, pid, vc_cma_reserve_total); -+ -+ up(&vc_cma_reserve_mutex); -+ -+ return vc_cma_reserve_total; -+} -+ -+static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, -+ VCHIQ_HEADER_T * header, -+ VCHIQ_SERVICE_HANDLE_T service, -+ void *bulk_userdata) -+{ -+ switch (reason) { -+ case VCHIQ_MESSAGE_AVAILABLE: -+ if (!send_worker_msg(header)) -+ return VCHIQ_RETRY; -+ break; -+ case VCHIQ_SERVICE_CLOSED: -+ LOG_DBG("CMA service closed"); -+ break; -+ default: -+ LOG_ERR("Unexpected CMA callback reason %d", reason); -+ break; -+ } -+ return VCHIQ_SUCCESS; -+} -+ -+static void send_vc_msg(unsigned short type, -+ unsigned short param1, unsigned short param2) -+{ -+ unsigned short msg[] = { type, param1, param2 }; -+ VCHIQ_ELEMENT_T elem = { &msg, sizeof(msg) }; -+ VCHIQ_STATUS_T ret; -+ vchiq_use_service(cma_service); -+ ret = vchiq_queue_message(cma_service, &elem, 1); -+ vchiq_release_service(cma_service); -+ if (ret != VCHIQ_SUCCESS) -+ LOG_ERR("vchiq_queue_message returned %x", ret); -+} -+ -+static bool send_worker_msg(VCHIQ_HEADER_T * msg) -+{ -+ if (down_interruptible(&vc_cma_worker_queue_push_mutex)) -+ return false; -+ vchiu_queue_push(&cma_msg_queue, msg); -+ up(&vc_cma_worker_queue_push_mutex); -+ return true; -+} -+ -+static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply) -+{ -+ int i; -+ for (i = 0; i < num_chunks; i++) { -+ struct page *chunk; -+ unsigned int chunk_num; -+ uint8_t *chunk_addr; -+ size_t chunk_size = PAGES_PER_CHUNK << PAGE_SHIFT; -+ -+ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, -+ PAGES_PER_CHUNK, -+ VC_CMA_CHUNK_ORDER); -+ if (!chunk) -+ break; -+ -+ chunk_addr = page_address(chunk); -+ dmac_flush_range(chunk_addr, chunk_addr + chunk_size); -+ outer_inv_range(__pa(chunk_addr), __pa(chunk_addr) + -+ chunk_size); -+ -+ chunk_num = -+ (page_to_phys(chunk) - vc_cma_base) / VC_CMA_CHUNK_SIZE; -+ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % -+ VC_CMA_CHUNK_SIZE) != 0); -+ if (chunk_num >= vc_cma_chunks) { -+ phys_addr_t _pa = vc_cma_base + vc_cma_size - 1; -+ LOG_ERR("%s: ===============================", -+ __func__); -+ LOG_ERR("%s: chunk phys %x, vc_cma %pa-%pa - " -+ "bad SPARSEMEM configuration?", -+ __func__, (unsigned int)page_to_phys(chunk), -+ &vc_cma_base, &_pa); -+ LOG_ERR("%s: dev->cma_area = %p", __func__, -+ (void*)0/*vc_cma_device.dev.cma_area*/); -+ LOG_ERR("%s: ===============================", -+ __func__); -+ break; -+ } -+ reply->params[i] = chunk_num; -+ vc_cma_chunks_used++; -+ } -+ -+ if (i < num_chunks) { -+ LOG_ERR("%s: dma_alloc_from_contiguous failed " -+ "for %x bytes (alloc %d of %d, %d free)", -+ __func__, VC_CMA_CHUNK_SIZE, i, -+ num_chunks, vc_cma_chunks - vc_cma_chunks_used); -+ num_chunks = i; -+ } -+ -+ LOG_DBG("CMA allocated %d chunks -> %d used", -+ num_chunks, vc_cma_chunks_used); -+ reply->type = VC_CMA_MSG_ALLOCATED; -+ -+ { -+ VCHIQ_ELEMENT_T elem = { -+ reply, -+ offsetof(struct cma_msg, params[0]) + -+ num_chunks * sizeof(reply->params[0]) -+ }; -+ VCHIQ_STATUS_T ret; -+ vchiq_use_service(cma_service); -+ ret = vchiq_queue_message(cma_service, &elem, 1); -+ vchiq_release_service(cma_service); -+ if (ret != VCHIQ_SUCCESS) -+ LOG_ERR("vchiq_queue_message return " "%x", ret); -+ } -+ -+ return num_chunks; -+} -+ -+static int cma_worker_proc(void *param) -+{ -+ static struct cma_msg reply; -+ (void)param; -+ -+ while (1) { -+ VCHIQ_HEADER_T *msg; -+ static struct cma_msg msg_copy; -+ struct cma_msg *cma_msg = &msg_copy; -+ int type, msg_size; -+ -+ msg = vchiu_queue_pop(&cma_msg_queue); -+ if ((unsigned int)msg >= VC_CMA_MSG_MAX) { -+ msg_size = msg->size; -+ memcpy(&msg_copy, msg->data, msg_size); -+ type = cma_msg->type; -+ vchiq_release_message(cma_service, msg); -+ } else { -+ msg_size = 0; -+ type = (int)msg; -+ if (type == VC_CMA_MSG_QUIT) -+ break; -+ else if (type == VC_CMA_MSG_UPDATE_RESERVE) { -+ msg = NULL; -+ cma_msg = NULL; -+ } else { -+ BUG(); -+ continue; -+ } -+ } -+ -+ switch (type) { -+ case VC_CMA_MSG_ALLOC:{ -+ int num_chunks, free_chunks; -+ num_chunks = cma_msg->params[0]; -+ free_chunks = -+ vc_cma_chunks - vc_cma_chunks_used; -+ LOG_DBG("CMA_MSG_ALLOC(%d chunks)", num_chunks); -+ if (num_chunks > VC_CMA_MAX_PARAMS_PER_MSG) { -+ LOG_ERR -+ ("CMA_MSG_ALLOC - chunk count (%d) " -+ "exceeds VC_CMA_MAX_PARAMS_PER_MSG (%d)", -+ num_chunks, -+ VC_CMA_MAX_PARAMS_PER_MSG); -+ num_chunks = VC_CMA_MAX_PARAMS_PER_MSG; -+ } -+ -+ if (num_chunks > free_chunks) { -+ LOG_ERR -+ ("CMA_MSG_ALLOC - chunk count (%d) " -+ "exceeds free chunks (%d)", -+ num_chunks, free_chunks); -+ num_chunks = free_chunks; -+ } -+ -+ vc_cma_alloc_chunks(num_chunks, &reply); -+ } -+ break; -+ -+ case VC_CMA_MSG_FREE:{ -+ int chunk_count = -+ (msg_size - -+ offsetof(struct cma_msg, -+ params)) / -+ sizeof(cma_msg->params[0]); -+ int i; -+ BUG_ON(chunk_count <= 0); -+ -+ LOG_DBG("CMA_MSG_FREE(%d chunks - %x, ...)", -+ chunk_count, cma_msg->params[0]); -+ for (i = 0; i < chunk_count; i++) { -+ int chunk_num = cma_msg->params[i]; -+ struct page *page = vc_cma_base_page + -+ chunk_num * PAGES_PER_CHUNK; -+ if (chunk_num >= vc_cma_chunks) { -+ LOG_ERR -+ ("CMA_MSG_FREE - chunk %d of %d" -+ " (value %x) exceeds maximum " -+ "(%x)", i, chunk_count, -+ chunk_num, -+ vc_cma_chunks - 1); -+ break; -+ } -+ -+ if (!dma_release_from_contiguous -+ (&vc_cma_device.dev, page, -+ PAGES_PER_CHUNK)) { -+ phys_addr_t _pa = page_to_phys(page); -+ LOG_ERR -+ ("CMA_MSG_FREE - failed to " -+ "release chunk %d (phys %pa, " -+ "page %x)", chunk_num, -+ &_pa, -+ (unsigned int)page); -+ } -+ vc_cma_chunks_used--; -+ } -+ LOG_DBG("CMA released %d chunks -> %d used", -+ i, vc_cma_chunks_used); -+ } -+ break; -+ -+ case VC_CMA_MSG_UPDATE_RESERVE:{ -+ int chunks_needed = -+ ((vc_cma_reserve_total + VC_CMA_CHUNK_SIZE - -+ 1) -+ / VC_CMA_CHUNK_SIZE) - -+ vc_cma_chunks_reserved; -+ -+ LOG_DBG -+ ("CMA_MSG_UPDATE_RESERVE(%d chunks needed)", -+ chunks_needed); -+ -+ /* Cap the reservations to what is available */ -+ if (chunks_needed > 0) { -+ if (chunks_needed > -+ (vc_cma_chunks - -+ vc_cma_chunks_used)) -+ chunks_needed = -+ (vc_cma_chunks - -+ vc_cma_chunks_used); -+ -+ chunks_needed = -+ vc_cma_alloc_chunks(chunks_needed, -+ &reply); -+ } -+ -+ LOG_DBG -+ ("CMA_MSG_UPDATE_RESERVE(%d chunks allocated)", -+ chunks_needed); -+ vc_cma_chunks_reserved += chunks_needed; -+ } -+ break; -+ -+ default: -+ LOG_ERR("unexpected msg type %d", type); -+ break; -+ } -+ } -+ -+ LOG_DBG("quitting..."); -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_connected_init -+* -+* This function is called once the videocore has been connected. -+* -+***************************************************************************/ -+ -+static void vc_cma_connected_init(void) -+{ -+ VCHIQ_SERVICE_PARAMS_T service_params; -+ -+ LOG_DBG("vc_cma_connected_init"); -+ -+ if (!vchiu_queue_init(&cma_msg_queue, 16)) { -+ LOG_ERR("could not create CMA msg queue"); -+ goto fail_queue; -+ } -+ -+ if (vchiq_initialise(&cma_instance) != VCHIQ_SUCCESS) -+ goto fail_vchiq_init; -+ -+ vchiq_connect(cma_instance); -+ -+ service_params.fourcc = VC_CMA_FOURCC; -+ service_params.callback = cma_service_callback; -+ service_params.userdata = NULL; -+ service_params.version = VC_CMA_VERSION; -+ service_params.version_min = VC_CMA_VERSION; -+ -+ if (vchiq_open_service(cma_instance, &service_params, -+ &cma_service) != VCHIQ_SUCCESS) { -+ LOG_ERR("failed to open service - already in use?"); -+ goto fail_vchiq_open; -+ } -+ -+ vchiq_release_service(cma_service); -+ -+ cma_worker = kthread_create(cma_worker_proc, NULL, "cma_worker"); -+ if (!cma_worker) { -+ LOG_ERR("could not create CMA worker thread"); -+ goto fail_worker; -+ } -+ set_user_nice(cma_worker, -20); -+ wake_up_process(cma_worker); -+ -+ return; -+ -+fail_worker: -+ vchiq_close_service(cma_service); -+fail_vchiq_open: -+ vchiq_shutdown(cma_instance); -+fail_vchiq_init: -+ vchiu_queue_delete(&cma_msg_queue); -+fail_queue: -+ return; -+} -+ -+void -+loud_error_header(void) -+{ -+ if (in_loud_error) -+ return; -+ -+ LOG_ERR("============================================================" -+ "================"); -+ LOG_ERR("============================================================" -+ "================"); -+ LOG_ERR("====="); -+ -+ in_loud_error = 1; -+} -+ -+void -+loud_error_footer(void) -+{ -+ if (!in_loud_error) -+ return; -+ -+ LOG_ERR("====="); -+ LOG_ERR("============================================================" -+ "================"); -+ LOG_ERR("============================================================" -+ "================"); -+ -+ in_loud_error = 0; -+} -+ -+#if 1 -+static int check_cma_config(void) { return 1; } -+#else -+static int -+read_vc_debug_var(VC_MEM_ACCESS_HANDLE_T handle, -+ const char *symbol, -+ void *buf, size_t bufsize) -+{ -+ VC_MEM_ADDR_T vcMemAddr; -+ size_t vcMemSize; -+ uint8_t *mapAddr; -+ off_t vcMapAddr; -+ -+ if (!LookupVideoCoreSymbol(handle, symbol, -+ &vcMemAddr, -+ &vcMemSize)) { -+ loud_error_header(); -+ loud_error( -+ "failed to find VC symbol \"%s\".", -+ symbol); -+ loud_error_footer(); -+ return 0; -+ } -+ -+ if (vcMemSize != bufsize) { -+ loud_error_header(); -+ loud_error( -+ "VC symbol \"%s\" is the wrong size.", -+ symbol); -+ loud_error_footer(); -+ return 0; -+ } -+ -+ vcMapAddr = (off_t)vcMemAddr & VC_MEM_TO_ARM_ADDR_MASK; -+ vcMapAddr += mm_vc_mem_phys_addr; -+ mapAddr = ioremap_nocache(vcMapAddr, vcMemSize); -+ if (mapAddr == 0) { -+ loud_error_header(); -+ loud_error( -+ "failed to ioremap \"%s\" @ 0x%x " -+ "(phys: 0x%x, size: %u).", -+ symbol, -+ (unsigned int)vcMapAddr, -+ (unsigned int)vcMemAddr, -+ (unsigned int)vcMemSize); -+ loud_error_footer(); -+ return 0; -+ } -+ -+ memcpy(buf, mapAddr, bufsize); -+ iounmap(mapAddr); -+ -+ return 1; -+} -+ -+ -+static int -+check_cma_config(void) -+{ -+ VC_MEM_ACCESS_HANDLE_T mem_hndl; -+ VC_MEM_ADDR_T mempool_start; -+ VC_MEM_ADDR_T mempool_end; -+ VC_MEM_ADDR_T mempool_offline_start; -+ VC_MEM_ADDR_T mempool_offline_end; -+ VC_MEM_ADDR_T cam_alloc_base; -+ VC_MEM_ADDR_T cam_alloc_size; -+ VC_MEM_ADDR_T cam_alloc_end; -+ int success = 0; -+ -+ if (OpenVideoCoreMemory(&mem_hndl) != 0) -+ goto out; -+ -+ /* Read the relevant VideoCore variables */ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_START", -+ &mempool_start, -+ sizeof(mempool_start))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_END", -+ &mempool_end, -+ sizeof(mempool_end))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_START", -+ &mempool_offline_start, -+ sizeof(mempool_offline_start))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_END", -+ &mempool_offline_end, -+ sizeof(mempool_offline_end))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "cam_alloc_base", -+ &cam_alloc_base, -+ sizeof(cam_alloc_base))) -+ goto close; -+ -+ if (!read_vc_debug_var(mem_hndl, "cam_alloc_size", -+ &cam_alloc_size, -+ sizeof(cam_alloc_size))) -+ goto close; -+ -+ cam_alloc_end = cam_alloc_base + cam_alloc_size; -+ -+ success = 1; -+ -+ /* Now the sanity checks */ -+ if (!mempool_offline_start) -+ mempool_offline_start = mempool_start; -+ if (!mempool_offline_end) -+ mempool_offline_end = mempool_end; -+ -+ if (VCADDR_TO_PHYSADDR(mempool_offline_start) != vc_cma_base) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_START(%x -> %lx) doesn't match " -+ "vc_cma_base(%x)", -+ mempool_offline_start, -+ VCADDR_TO_PHYSADDR(mempool_offline_start), -+ vc_cma_base); -+ success = 0; -+ } -+ -+ if (VCADDR_TO_PHYSADDR(mempool_offline_end) != -+ (vc_cma_base + vc_cma_size)) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_END(%x -> %lx) doesn't match " -+ "vc_cma_base(%x) + vc_cma_size(%x) = %x", -+ mempool_offline_start, -+ VCADDR_TO_PHYSADDR(mempool_offline_end), -+ vc_cma_base, vc_cma_size, vc_cma_base + vc_cma_size); -+ success = 0; -+ } -+ -+ if (mempool_end < mempool_start) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_END(%x) must not be before " -+ "__MEMPOOL_START(%x)", -+ mempool_end, -+ mempool_start); -+ success = 0; -+ } -+ -+ if (mempool_offline_end < mempool_offline_start) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_END(%x) must not be before " -+ "__MEMPOOL_OFFLINE_START(%x)", -+ mempool_offline_end, -+ mempool_offline_start); -+ success = 0; -+ } -+ -+ if (mempool_offline_start < mempool_start) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_START(%x) must not be before " -+ "__MEMPOOL_START(%x)", -+ mempool_offline_start, -+ mempool_start); -+ success = 0; -+ } -+ -+ if (mempool_offline_end > mempool_end) { -+ loud_error_header(); -+ loud_error( -+ "__MEMPOOL_OFFLINE_END(%x) must not be after " -+ "__MEMPOOL_END(%x)", -+ mempool_offline_end, -+ mempool_end); -+ success = 0; -+ } -+ -+ if ((cam_alloc_base < mempool_end) && -+ (cam_alloc_end > mempool_start)) { -+ loud_error_header(); -+ loud_error( -+ "cam_alloc pool(%x-%x) overlaps " -+ "mempool(%x-%x)", -+ cam_alloc_base, cam_alloc_end, -+ mempool_start, mempool_end); -+ success = 0; -+ } -+ -+ loud_error_footer(); -+ -+close: -+ CloseVideoCoreMemory(mem_hndl); -+ -+out: -+ return success; -+} -+#endif -+ -+static int vc_cma_init(void) -+{ -+ int rc = -EFAULT; -+ struct device *dev; -+ -+ if (!check_cma_config()) -+ goto out_release; -+ -+ LOG_INFO("vc-cma: Videocore CMA driver"); -+ LOG_INFO("vc-cma: vc_cma_base = %pa", &vc_cma_base); -+ LOG_INFO("vc-cma: vc_cma_size = 0x%08x (%u MiB)", -+ vc_cma_size, vc_cma_size / (1024 * 1024)); -+ LOG_INFO("vc-cma: vc_cma_initial = 0x%08x (%u MiB)", -+ vc_cma_initial, vc_cma_initial / (1024 * 1024)); -+ -+ vc_cma_base_page = phys_to_page(vc_cma_base); -+ -+ if (vc_cma_chunks) { -+ int chunks_needed = vc_cma_initial / VC_CMA_CHUNK_SIZE; -+ -+ for (vc_cma_chunks_used = 0; -+ vc_cma_chunks_used < chunks_needed; vc_cma_chunks_used++) { -+ struct page *chunk; -+ chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, -+ PAGES_PER_CHUNK, -+ VC_CMA_CHUNK_ORDER); -+ if (!chunk) -+ break; -+ BUG_ON(((page_to_phys(chunk) - vc_cma_base) % -+ VC_CMA_CHUNK_SIZE) != 0); -+ } -+ if (vc_cma_chunks_used != chunks_needed) { -+ LOG_ERR("%s: dma_alloc_from_contiguous failed (%d " -+ "bytes, allocation %d of %d)", -+ __func__, VC_CMA_CHUNK_SIZE, -+ vc_cma_chunks_used, chunks_needed); -+ goto out_release; -+ } -+ -+ vchiq_add_connected_callback(vc_cma_connected_init); -+ } -+ -+ rc = alloc_chrdev_region(&vc_cma_devnum, 0, 1, DRIVER_NAME); -+ if (rc < 0) { -+ LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); -+ goto out_release; -+ } -+ -+ cdev_init(&vc_cma_cdev, &vc_cma_fops); -+ rc = cdev_add(&vc_cma_cdev, vc_cma_devnum, 1); -+ if (rc != 0) { -+ LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); -+ goto out_unregister; -+ } -+ -+ vc_cma_class = class_create(THIS_MODULE, DRIVER_NAME); -+ if (IS_ERR(vc_cma_class)) { -+ rc = PTR_ERR(vc_cma_class); -+ LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); -+ goto out_cdev_del; -+ } -+ -+ dev = device_create(vc_cma_class, NULL, vc_cma_devnum, NULL, -+ DRIVER_NAME); -+ if (IS_ERR(dev)) { -+ rc = PTR_ERR(dev); -+ LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); -+ goto out_class_destroy; -+ } -+ -+ vc_cma_proc_entry = proc_create(DRIVER_NAME, 0444, NULL, &vc_cma_proc_fops); -+ if (vc_cma_proc_entry == NULL) { -+ rc = -EFAULT; -+ LOG_ERR("%s: proc_create failed", __func__); -+ goto out_device_destroy; -+ } -+ -+ vc_cma_inited = 1; -+ return 0; -+ -+out_device_destroy: -+ device_destroy(vc_cma_class, vc_cma_devnum); -+ -+out_class_destroy: -+ class_destroy(vc_cma_class); -+ vc_cma_class = NULL; -+ -+out_cdev_del: -+ cdev_del(&vc_cma_cdev); -+ -+out_unregister: -+ unregister_chrdev_region(vc_cma_devnum, 1); -+ -+out_release: -+ /* It is tempting to try to clean up by calling -+ dma_release_from_contiguous for all allocated chunks, but it isn't -+ a very safe thing to do. If vc_cma_initial is non-zero it is because -+ VideoCore is already using that memory, so giving it back to Linux -+ is likely to be fatal. -+ */ -+ return -1; -+} -+ -+/**************************************************************************** -+* -+* vc_cma_exit -+* -+***************************************************************************/ -+ -+static void __exit vc_cma_exit(void) -+{ -+ LOG_DBG("%s: called", __func__); -+ -+ if (vc_cma_inited) { -+ remove_proc_entry(DRIVER_NAME, NULL); -+ device_destroy(vc_cma_class, vc_cma_devnum); -+ class_destroy(vc_cma_class); -+ cdev_del(&vc_cma_cdev); -+ unregister_chrdev_region(vc_cma_devnum, 1); -+ } -+} -+ -+module_init(vc_cma_init); -+module_exit(vc_cma_exit); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Broadcom Corporation"); -diff --git a/include/linux/broadcom/vc_cma.h b/include/linux/broadcom/vc_cma.h -new file mode 100644 -index 0000000000000000000000000000000000000000..be2819d5d41f9d5ed65daf8eedb94c9e9a4c2f1a ---- /dev/null -+++ b/include/linux/broadcom/vc_cma.h -@@ -0,0 +1,36 @@ -+/***************************************************************************** -+* Copyright 2012 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#if !defined( VC_CMA_H ) -+#define VC_CMA_H -+ -+#include -+ -+#define VC_CMA_IOC_MAGIC 0xc5 -+ -+#define VC_CMA_IOC_RESERVE _IO(VC_CMA_IOC_MAGIC, 0) -+ -+#ifdef __KERNEL__ -+ -+#ifdef CONFIG_BCM_VC_CMA -+void vc_cma_early_init(void); -+void vc_cma_reserve(void); -+#else -+static inline void vc_cma_early_init(void) { } -+static inline void vc_cma_reserve(void) { } -+#endif -+ -+#endif -+ -+#endif /* VC_CMA_H */ - -From 20fda0a0bcd46a01ba801a968f81c55398ff925e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 038/122] bcm2708: alsa sound driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -alsa: add mmap support and some cleanups to bcm2835 ALSA driver - -snd-bcm2835: Add support for spdif/hdmi passthrough - -This adds a dedicated subdevice which can be used for passthrough of non-audio -formats (ie encoded a52) through the hdmi audio link. In addition to this -driver extension an appropriate card config is required to make alsa-lib -support the AES parameters for this device. - -snd-bcm2708: Add mutex, improve logging - -Fix for ALSA driver crash - -Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written - -alsa: reduce severity of expected warning message - -snd-bcm2708: Fix dmesg spam for non-error case - -alsa: Ensure mutexes are released through error paths - -alsa: Make interrupted close paths quieter - -BCM270x: Add onboard sound device to Device Tree - -Add Device Tree support to alsa driver. -Add device to Device Tree. -Don't add platform devices when booting in DT mode. - -Signed-off-by: Noralf Trønnes - -bcm2835: access controls under the audio mutex - -I don't think the ALSA framework provides any kind of automatic -synchronization within the control callbacks. We most likely need -to ensure this manually, so add locking around all access to shared -mutable data. In particular, bcm2835_audio_set_ctls() should -probably always be called under our own audio lock. - -snd-bcm2835: Don't allow responses from VC to be interrupted by user signals - -There should always be a response, and retry after a signal interruption is not handled, so don't report -we are interruptible. - -See: https://github.com/raspberrypi/linux/issues/1560 - -snd-bcm2835: Use bcm2835_hw params in preallocate ---- - sound/arm/Kconfig | 7 + - sound/arm/Makefile | 5 + - sound/arm/bcm2835-ctl.c | 350 +++++++++++++++ - sound/arm/bcm2835-pcm.c | 563 +++++++++++++++++++++++ - sound/arm/bcm2835-vchiq.c | 889 +++++++++++++++++++++++++++++++++++++ - sound/arm/bcm2835.c | 511 +++++++++++++++++++++ - sound/arm/bcm2835.h | 167 +++++++ - sound/arm/vc_vchi_audioserv_defs.h | 116 +++++ - 8 files changed, 2608 insertions(+) - create mode 100755 sound/arm/bcm2835-ctl.c - create mode 100755 sound/arm/bcm2835-pcm.c - create mode 100755 sound/arm/bcm2835-vchiq.c - create mode 100644 sound/arm/bcm2835.c - create mode 100755 sound/arm/bcm2835.h - create mode 100644 sound/arm/vc_vchi_audioserv_defs.h - -diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig -index 65171f6657a2984ccc14ce907a4c7c87d77d196b..02b6d263035ca18c9ce53229369dfb00915c260b 100644 ---- a/sound/arm/Kconfig -+++ b/sound/arm/Kconfig -@@ -32,6 +32,13 @@ config SND_PXA2XX_AC97 - Say Y or M if you want to support any AC97 codec attached to - the PXA2xx AC97 interface. - -+config SND_BCM2835 -+ tristate "BCM2835 ALSA driver" -+ depends on ARCH_BCM2835 && BCM2708_VCHIQ && SND -+ select SND_PCM -+ help -+ Say Y or M if you want to support BCM2835 Alsa pcm card driver -+ - endif # SND_ARM - - config SND_PXA2XX_LIB -diff --git a/sound/arm/Makefile b/sound/arm/Makefile -index 8c0c851d464109819beb296c2624bbec7af131e9..26aabea79a0b5f141f7644a96684470d9b72f681 100644 ---- a/sound/arm/Makefile -+++ b/sound/arm/Makefile -@@ -14,3 +14,8 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o - - obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o - snd-pxa2xx-ac97-objs := pxa2xx-ac97.o -+ -+obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o -+snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o -+ -+ccflags-y += -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -new file mode 100755 -index 0000000000000000000000000000000000000000..75dc3224be7ce8353378e9676ad2c6847dd0750b ---- /dev/null -+++ b/sound/arm/bcm2835-ctl.c -@@ -0,0 +1,350 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* volume maximum and minimum in terms of 0.01dB */ -+#define CTRL_VOL_MAX 400 -+#define CTRL_VOL_MIN -10239 /* originally -10240 */ -+ -+ -+static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ audio_info(" ... IN\n"); -+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = 1; -+ uinfo->value.integer.min = CTRL_VOL_MIN; -+ uinfo->value.integer.max = CTRL_VOL_MAX; /* 2303 */ -+ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = 1; -+ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = AUDIO_DEST_MAX-1; -+ } -+ audio_info(" ... OUT\n"); -+ return 0; -+} -+ -+/* toggles mute on or off depending on the value of nmute, and returns -+ * 1 if the mute value was changed, otherwise 0 -+ */ -+static int toggle_mute(struct bcm2835_chip *chip, int nmute) -+{ -+ /* if settings are ok, just return 0 */ -+ if(chip->mute == nmute) -+ return 0; -+ -+ /* if the sound is muted then we need to unmute */ -+ if(chip->mute == CTRL_VOL_MUTE) -+ { -+ chip->volume = chip->old_volume; /* copy the old volume back */ -+ audio_info("Unmuting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); -+ } -+ else /* otherwise we mute */ -+ { -+ chip->old_volume = chip->volume; -+ chip->volume = 26214; /* set volume to minimum level AKA mute */ -+ audio_info("Muting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume); -+ } -+ -+ chip->mute = nmute; -+ return 1; -+} -+ -+static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); -+ -+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) -+ ucontrol->value.integer.value[0] = chip2alsa(chip->volume); -+ else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) -+ ucontrol->value.integer.value[0] = chip->mute; -+ else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) -+ ucontrol->value.integer.value[0] = chip->dest; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return 0; -+} -+ -+static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ int changed = 0; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { -+ audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); -+ if (chip->mute == CTRL_VOL_MUTE) { -+ /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ -+ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ -+ goto unlock; -+ } -+ if (changed -+ || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { -+ -+ chip->volume = alsa2chip(ucontrol->value.integer.value[0]); -+ changed = 1; -+ } -+ -+ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) { -+ /* Now implemented */ -+ audio_info(" Mute attempted\n"); -+ changed = toggle_mute(chip, ucontrol->value.integer.value[0]); -+ -+ } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) { -+ if (ucontrol->value.integer.value[0] != chip->dest) { -+ chip->dest = ucontrol->value.integer.value[0]; -+ changed = 1; -+ } -+ } -+ -+ if (changed) { -+ if (bcm2835_audio_set_ctls(chip)) -+ printk(KERN_ERR "Failed to set ALSA controls..\n"); -+ } -+ -+unlock: -+ mutex_unlock(&chip->audio_mutex); -+ return changed; -+} -+ -+static DECLARE_TLV_DB_SCALE(snd_bcm2835_db_scale, CTRL_VOL_MIN, 1, 1); -+ -+static struct snd_kcontrol_new snd_bcm2835_ctl[] = { -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Volume", -+ .index = 0, -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, -+ .private_value = PCM_PLAYBACK_VOLUME, -+ .info = snd_bcm2835_ctl_info, -+ .get = snd_bcm2835_ctl_get, -+ .put = snd_bcm2835_ctl_put, -+ .count = 1, -+ .tlv = {.p = snd_bcm2835_db_scale} -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Switch", -+ .index = 0, -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, -+ .private_value = PCM_PLAYBACK_MUTE, -+ .info = snd_bcm2835_ctl_info, -+ .get = snd_bcm2835_ctl_get, -+ .put = snd_bcm2835_ctl_put, -+ .count = 1, -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Route", -+ .index = 0, -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, -+ .private_value = PCM_PLAYBACK_DEVICE, -+ .info = snd_bcm2835_ctl_info, -+ .get = snd_bcm2835_ctl_get, -+ .put = snd_bcm2835_ctl_put, -+ .count = 1, -+ }, -+}; -+ -+static int snd_bcm2835_spdif_default_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ int i; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ ucontrol->value.iec958.status[i] = -+ (chip->spdif_status >> (i * 8)) && 0xff; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ unsigned int val = 0; -+ int i, change; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); -+ -+ change = val != chip->spdif_status; -+ chip->spdif_status = val; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return change; -+} -+ -+static int snd_bcm2835_spdif_mask_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_mask_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ /* bcm2835 supports only consumer mode and sets all other format flags -+ * automatically. So the only thing left is signalling non-audio -+ * content */ -+ ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_stream_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; -+ uinfo->count = 1; -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ int i; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ ucontrol->value.iec958.status[i] = -+ (chip->spdif_status >> (i * 8)) & 0xff; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return 0; -+} -+ -+static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); -+ unsigned int val = 0; -+ int i, change; -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ for (i = 0; i < 4; i++) -+ val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); -+ change = val != chip->spdif_status; -+ chip->spdif_status = val; -+ -+ mutex_unlock(&chip->audio_mutex); -+ return change; -+} -+ -+static struct snd_kcontrol_new snd_bcm2835_spdif[] = { -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), -+ .info = snd_bcm2835_spdif_default_info, -+ .get = snd_bcm2835_spdif_default_get, -+ .put = snd_bcm2835_spdif_default_put -+ }, -+ { -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), -+ .info = snd_bcm2835_spdif_mask_info, -+ .get = snd_bcm2835_spdif_mask_get, -+ }, -+ { -+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | -+ SNDRV_CTL_ELEM_ACCESS_INACTIVE, -+ .iface = SNDRV_CTL_ELEM_IFACE_PCM, -+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), -+ .info = snd_bcm2835_spdif_stream_info, -+ .get = snd_bcm2835_spdif_stream_get, -+ .put = snd_bcm2835_spdif_stream_put, -+ }, -+}; -+ -+int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) -+{ -+ int err; -+ unsigned int idx; -+ -+ strcpy(chip->card->mixername, "Broadcom Mixer"); -+ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_ctl); idx++) { -+ err = -+ snd_ctl_add(chip->card, -+ snd_ctl_new1(&snd_bcm2835_ctl[idx], chip)); -+ if (err < 0) -+ return err; -+ } -+ for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { -+ err = snd_ctl_add(chip->card, -+ snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); -+ if (err < 0) -+ return err; -+ } -+ return 0; -+} -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -new file mode 100755 -index 0000000000000000000000000000000000000000..71b128924affac2b7a01d1169e43d437bb1d0c1a ---- /dev/null -+++ b/sound/arm/bcm2835-pcm.c -@@ -0,0 +1,563 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+ -+#include -+ -+#include "bcm2835.h" -+ -+/* hardware definition */ -+static struct snd_pcm_hardware snd_bcm2835_playback_hw = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -+ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), -+ .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, -+ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, -+ .rate_min = 8000, -+ .rate_max = 48000, -+ .channels_min = 1, -+ .channels_max = 2, -+ .buffer_bytes_max = 128 * 1024, -+ .period_bytes_min = 1 * 1024, -+ .period_bytes_max = 128 * 1024, -+ .periods_min = 1, -+ .periods_max = 128, -+}; -+ -+static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { -+ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -+ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), -+ .formats = SNDRV_PCM_FMTBIT_S16_LE, -+ .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | -+ SNDRV_PCM_RATE_48000, -+ .rate_min = 44100, -+ .rate_max = 48000, -+ .channels_min = 2, -+ .channels_max = 2, -+ .buffer_bytes_max = 128 * 1024, -+ .period_bytes_min = 1 * 1024, -+ .period_bytes_max = 128 * 1024, -+ .periods_min = 1, -+ .periods_max = 128, -+}; -+ -+static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime) -+{ -+ audio_info("Freeing up alsa stream here ..\n"); -+ if (runtime->private_data) -+ kfree(runtime->private_data); -+ runtime->private_data = NULL; -+} -+ -+static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) -+{ -+ bcm2835_alsa_stream_t *alsa_stream = (bcm2835_alsa_stream_t *) dev_id; -+ uint32_t consumed = 0; -+ int new_period = 0; -+ -+ audio_info(" .. IN\n"); -+ -+ audio_info("alsa_stream=%p substream=%p\n", alsa_stream, -+ alsa_stream ? alsa_stream->substream : 0); -+ -+ if (alsa_stream->open) -+ consumed = bcm2835_audio_retrieve_buffers(alsa_stream); -+ -+ /* We get called only if playback was triggered, So, the number of buffers we retrieve in -+ * each iteration are the buffers that have been played out already -+ */ -+ -+ if (alsa_stream->period_size) { -+ if ((alsa_stream->pos / alsa_stream->period_size) != -+ ((alsa_stream->pos + consumed) / alsa_stream->period_size)) -+ new_period = 1; -+ } -+ audio_debug("updating pos cur: %d + %d max:%d period_bytes:%d, hw_ptr: %d new_period:%d\n", -+ alsa_stream->pos, -+ consumed, -+ alsa_stream->buffer_size, -+ (int)(alsa_stream->period_size*alsa_stream->substream->runtime->periods), -+ frames_to_bytes(alsa_stream->substream->runtime, alsa_stream->substream->runtime->status->hw_ptr), -+ new_period); -+ if (alsa_stream->buffer_size) { -+ alsa_stream->pos += consumed &~ (1<<30); -+ alsa_stream->pos %= alsa_stream->buffer_size; -+ } -+ -+ if (alsa_stream->substream) { -+ if (new_period) -+ snd_pcm_period_elapsed(alsa_stream->substream); -+ } else { -+ audio_warning(" unexpected NULL substream\n"); -+ } -+ audio_info(" .. OUT\n"); -+ -+ return IRQ_HANDLED; -+} -+ -+/* open callback */ -+static int snd_bcm2835_playback_open_generic( -+ struct snd_pcm_substream *substream, int spdif) -+{ -+ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream; -+ int idx; -+ int err; -+ -+ audio_info(" .. IN (%d)\n", substream->number); -+ -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ audio_info("Alsa open (%d)\n", substream->number); -+ idx = substream->number; -+ -+ if (spdif && chip->opened != 0) { -+ err = -EBUSY; -+ goto out; -+ } -+ else if (!spdif && (chip->opened & (1 << idx))) { -+ err = -EBUSY; -+ goto out; -+ } -+ if (idx > MAX_SUBSTREAMS) { -+ audio_error -+ ("substream(%d) device doesn't exist max(%d) substreams allowed\n", -+ idx, MAX_SUBSTREAMS); -+ err = -ENODEV; -+ goto out; -+ } -+ -+ /* Check if we are ready */ -+ if (!(chip->avail_substreams & (1 << idx))) { -+ /* We are not ready yet */ -+ audio_error("substream(%d) device is not ready yet\n", idx); -+ err = -EAGAIN; -+ goto out; -+ } -+ -+ alsa_stream = kzalloc(sizeof(bcm2835_alsa_stream_t), GFP_KERNEL); -+ if (alsa_stream == NULL) { -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ /* Initialise alsa_stream */ -+ alsa_stream->chip = chip; -+ alsa_stream->substream = substream; -+ alsa_stream->idx = idx; -+ -+ sema_init(&alsa_stream->buffers_update_sem, 0); -+ sema_init(&alsa_stream->control_sem, 0); -+ spin_lock_init(&alsa_stream->lock); -+ -+ /* Enabled in start trigger, called on each "fifo irq" after that */ -+ alsa_stream->enable_fifo_irq = 0; -+ alsa_stream->fifo_irq_handler = bcm2835_playback_fifo_irq; -+ -+ err = bcm2835_audio_open(alsa_stream); -+ if (err != 0) { -+ kfree(alsa_stream); -+ goto out; -+ } -+ runtime->private_data = alsa_stream; -+ runtime->private_free = snd_bcm2835_playback_free; -+ if (spdif) { -+ runtime->hw = snd_bcm2835_playback_spdif_hw; -+ } else { -+ /* clear spdif status, as we are not in spdif mode */ -+ chip->spdif_status = 0; -+ runtime->hw = snd_bcm2835_playback_hw; -+ } -+ /* minimum 16 bytes alignment (for vchiq bulk transfers) */ -+ snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -+ 16); -+ -+ chip->alsa_stream[idx] = alsa_stream; -+ -+ chip->opened |= (1 << idx); -+ alsa_stream->open = 1; -+ alsa_stream->draining = 1; -+ -+out: -+ mutex_unlock(&chip->audio_mutex); -+ -+ audio_info(" .. OUT =%d\n", err); -+ -+ return err; -+} -+ -+static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream) -+{ -+ return snd_bcm2835_playback_open_generic(substream, 0); -+} -+ -+static int snd_bcm2835_playback_spdif_open(struct snd_pcm_substream *substream) -+{ -+ return snd_bcm2835_playback_open_generic(substream, 1); -+} -+ -+/* close callback */ -+static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) -+{ -+ /* the hardware-specific codes will be here */ -+ -+ bcm2835_chip_t *chip; -+ struct snd_pcm_runtime *runtime; -+ bcm2835_alsa_stream_t *alsa_stream; -+ -+ audio_info(" .. IN\n"); -+ -+ chip = snd_pcm_substream_chip(substream); -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ runtime = substream->runtime; -+ alsa_stream = runtime->private_data; -+ -+ audio_info("Alsa close\n"); -+ -+ /* -+ * Call stop if it's still running. This happens when app -+ * is force killed and we don't get a stop trigger. -+ */ -+ if (alsa_stream->running) { -+ int err; -+ err = bcm2835_audio_stop(alsa_stream); -+ alsa_stream->running = 0; -+ if (err != 0) -+ audio_error(" Failed to STOP alsa device\n"); -+ } -+ -+ alsa_stream->period_size = 0; -+ alsa_stream->buffer_size = 0; -+ -+ if (alsa_stream->open) { -+ alsa_stream->open = 0; -+ bcm2835_audio_close(alsa_stream); -+ } -+ if (alsa_stream->chip) -+ alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL; -+ /* -+ * Do not free up alsa_stream here, it will be freed up by -+ * runtime->private_free callback we registered in *_open above -+ */ -+ -+ chip->opened &= ~(1 << substream->number); -+ -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ -+ return 0; -+} -+ -+/* hw_params callback */ -+static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ -+ err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); -+ if (err < 0) { -+ audio_error -+ (" pcm_lib_malloc failed to allocated pages for buffers\n"); -+ return err; -+ } -+ -+ alsa_stream->channels = params_channels(params); -+ alsa_stream->params_rate = params_rate(params); -+ alsa_stream->pcm_format_width = snd_pcm_format_width(params_format (params)); -+ audio_info(" .. OUT\n"); -+ -+ return err; -+} -+ -+/* hw_free callback */ -+static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) -+{ -+ audio_info(" .. IN\n"); -+ return snd_pcm_lib_free_pages(substream); -+} -+ -+/* prepare callback */ -+static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) -+{ -+ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ int channels; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ -+ if (mutex_lock_interruptible(&chip->audio_mutex)) -+ return -EINTR; -+ -+ /* notify the vchiq that it should enter spdif passthrough mode by -+ * setting channels=0 (see -+ * https://github.com/raspberrypi/linux/issues/528) */ -+ if (chip->spdif_status & IEC958_AES0_NONAUDIO) -+ channels = 0; -+ else -+ channels = alsa_stream->channels; -+ -+ err = bcm2835_audio_set_params(alsa_stream, channels, -+ alsa_stream->params_rate, -+ alsa_stream->pcm_format_width); -+ if (err < 0) { -+ audio_error(" error setting hw params\n"); -+ } -+ -+ bcm2835_audio_setup(alsa_stream); -+ -+ /* in preparation of the stream, set the controls (volume level) of the stream */ -+ bcm2835_audio_set_ctls(alsa_stream->chip); -+ -+ -+ memset(&alsa_stream->pcm_indirect, 0, sizeof(alsa_stream->pcm_indirect)); -+ -+ alsa_stream->pcm_indirect.hw_buffer_size = -+ alsa_stream->pcm_indirect.sw_buffer_size = -+ snd_pcm_lib_buffer_bytes(substream); -+ -+ alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); -+ alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); -+ alsa_stream->pos = 0; -+ -+ audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", -+ alsa_stream->buffer_size, alsa_stream->period_size, -+ alsa_stream->pos, runtime->frame_bits); -+ -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ return 0; -+} -+ -+static void snd_bcm2835_pcm_transfer(struct snd_pcm_substream *substream, -+ struct snd_pcm_indirect *rec, size_t bytes) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ void *src = (void *)(substream->runtime->dma_area + rec->sw_data); -+ int err; -+ -+ err = bcm2835_audio_write(alsa_stream, bytes, src); -+ if (err) -+ audio_error(" Failed to transfer to alsa device (%d)\n", err); -+ -+} -+ -+static int snd_bcm2835_pcm_ack(struct snd_pcm_substream *substream) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ struct snd_pcm_indirect *pcm_indirect = &alsa_stream->pcm_indirect; -+ -+ pcm_indirect->hw_queue_size = runtime->hw.buffer_bytes_max; -+ snd_pcm_indirect_playback_transfer(substream, pcm_indirect, -+ snd_bcm2835_pcm_transfer); -+ return 0; -+} -+ -+/* trigger callback */ -+static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ int err = 0; -+ -+ audio_info(" .. IN\n"); -+ -+ switch (cmd) { -+ case SNDRV_PCM_TRIGGER_START: -+ audio_debug("bcm2835_AUDIO_TRIGGER_START running=%d\n", -+ alsa_stream->running); -+ if (!alsa_stream->running) { -+ err = bcm2835_audio_start(alsa_stream); -+ if (err == 0) { -+ alsa_stream->pcm_indirect.hw_io = -+ alsa_stream->pcm_indirect.hw_data = -+ bytes_to_frames(runtime, -+ alsa_stream->pos); -+ substream->ops->ack(substream); -+ alsa_stream->running = 1; -+ alsa_stream->draining = 1; -+ } else { -+ audio_error(" Failed to START alsa device (%d)\n", err); -+ } -+ } -+ break; -+ case SNDRV_PCM_TRIGGER_STOP: -+ audio_debug -+ ("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n", -+ alsa_stream->running, runtime->status->state == SNDRV_PCM_STATE_DRAINING); -+ if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { -+ audio_info("DRAINING\n"); -+ alsa_stream->draining = 1; -+ } else { -+ audio_info("DROPPING\n"); -+ alsa_stream->draining = 0; -+ } -+ if (alsa_stream->running) { -+ err = bcm2835_audio_stop(alsa_stream); -+ if (err != 0) -+ audio_error(" Failed to STOP alsa device (%d)\n", err); -+ alsa_stream->running = 0; -+ } -+ break; -+ default: -+ err = -EINVAL; -+ } -+ -+ audio_info(" .. OUT\n"); -+ return err; -+} -+ -+/* pointer callback */ -+static snd_pcm_uframes_t -+snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) -+{ -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; -+ -+ audio_info(" .. IN\n"); -+ -+ audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0, -+ frames_to_bytes(runtime, runtime->status->hw_ptr), -+ frames_to_bytes(runtime, runtime->control->appl_ptr), -+ alsa_stream->pos); -+ -+ audio_info(" .. OUT\n"); -+ return snd_pcm_indirect_playback_pointer(substream, -+ &alsa_stream->pcm_indirect, -+ alsa_stream->pos); -+} -+ -+static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream, -+ unsigned int cmd, void *arg) -+{ -+ int ret = snd_pcm_lib_ioctl(substream, cmd, arg); -+ audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream, -+ cmd, arg, arg ? *(unsigned *)arg : 0, ret); -+ return ret; -+} -+ -+/* operators */ -+static struct snd_pcm_ops snd_bcm2835_playback_ops = { -+ .open = snd_bcm2835_playback_open, -+ .close = snd_bcm2835_playback_close, -+ .ioctl = snd_bcm2835_pcm_lib_ioctl, -+ .hw_params = snd_bcm2835_pcm_hw_params, -+ .hw_free = snd_bcm2835_pcm_hw_free, -+ .prepare = snd_bcm2835_pcm_prepare, -+ .trigger = snd_bcm2835_pcm_trigger, -+ .pointer = snd_bcm2835_pcm_pointer, -+ .ack = snd_bcm2835_pcm_ack, -+}; -+ -+static struct snd_pcm_ops snd_bcm2835_playback_spdif_ops = { -+ .open = snd_bcm2835_playback_spdif_open, -+ .close = snd_bcm2835_playback_close, -+ .ioctl = snd_bcm2835_pcm_lib_ioctl, -+ .hw_params = snd_bcm2835_pcm_hw_params, -+ .hw_free = snd_bcm2835_pcm_hw_free, -+ .prepare = snd_bcm2835_pcm_prepare, -+ .trigger = snd_bcm2835_pcm_trigger, -+ .pointer = snd_bcm2835_pcm_pointer, -+ .ack = snd_bcm2835_pcm_ack, -+}; -+ -+/* create a pcm device */ -+int snd_bcm2835_new_pcm(bcm2835_chip_t * chip) -+{ -+ struct snd_pcm *pcm; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ mutex_init(&chip->audio_mutex); -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ err = -+ snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm); -+ if (err < 0) -+ goto out; -+ pcm->private_data = chip; -+ strcpy(pcm->name, "bcm2835 ALSA"); -+ chip->pcm = pcm; -+ chip->dest = AUDIO_DEST_AUTO; -+ chip->volume = alsa2chip(0); -+ chip->mute = CTRL_VOL_UNMUTE; /*disable mute on startup */ -+ /* set operators */ -+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, -+ &snd_bcm2835_playback_ops); -+ -+ /* pre-allocation of buffers */ -+ /* NOTE: this may fail */ -+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, -+ snd_dma_continuous_data (GFP_KERNEL), -+ snd_bcm2835_playback_hw.buffer_bytes_max, snd_bcm2835_playback_hw.buffer_bytes_max); -+ -+ -+out: -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ -+ return 0; -+} -+ -+int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip) -+{ -+ struct snd_pcm *pcm; -+ int err; -+ -+ audio_info(" .. IN\n"); -+ if(mutex_lock_interruptible(&chip->audio_mutex)) -+ { -+ audio_error("Interrupted whilst waiting for lock\n"); -+ return -EINTR; -+ } -+ err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm); -+ if (err < 0) -+ goto out; -+ -+ pcm->private_data = chip; -+ strcpy(pcm->name, "bcm2835 IEC958/HDMI"); -+ chip->pcm_spdif = pcm; -+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, -+ &snd_bcm2835_playback_spdif_ops); -+ -+ /* pre-allocation of buffers */ -+ /* NOTE: this may fail */ -+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, -+ snd_dma_continuous_data (GFP_KERNEL), -+ snd_bcm2835_playback_spdif_hw.buffer_bytes_max, snd_bcm2835_playback_spdif_hw.buffer_bytes_max); -+out: -+ mutex_unlock(&chip->audio_mutex); -+ audio_info(" .. OUT\n"); -+ -+ return 0; -+} -diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c -new file mode 100755 -index 0000000000000000000000000000000000000000..7ee436ca9fa2903d41d1bdd8f8f0774025d22ae0 ---- /dev/null -+++ b/sound/arm/bcm2835-vchiq.c -@@ -0,0 +1,889 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* ---- Include Files -------------------------------------------------------- */ -+ -+#include "interface/vchi/vchi.h" -+#include "vc_vchi_audioserv_defs.h" -+ -+/* ---- Private Constants and Types ------------------------------------------ */ -+ -+#define BCM2835_AUDIO_STOP 0 -+#define BCM2835_AUDIO_START 1 -+#define BCM2835_AUDIO_WRITE 2 -+ -+/* Logging macros (for remapping to other logging mechanisms, i.e., printf) */ -+#ifdef AUDIO_DEBUG_ENABLE -+ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_WARN( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_INFO( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_DBG( fmt, arg... ) pr_info( "%s:%d " fmt, __func__, __LINE__, ##arg) -+#else -+ #define LOG_ERR( fmt, arg... ) pr_err( "%s:%d " fmt, __func__, __LINE__, ##arg) -+ #define LOG_WARN( fmt, arg... ) -+ #define LOG_INFO( fmt, arg... ) -+ #define LOG_DBG( fmt, arg... ) -+#endif -+ -+typedef struct opaque_AUDIO_INSTANCE_T { -+ uint32_t num_connections; -+ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; -+ struct completion msg_avail_comp; -+ struct mutex vchi_mutex; -+ bcm2835_alsa_stream_t *alsa_stream; -+ int32_t result; -+ short peer_version; -+} AUDIO_INSTANCE_T; -+ -+bool force_bulk = false; -+ -+/* ---- Private Variables ---------------------------------------------------- */ -+ -+/* ---- Private Function Prototypes ------------------------------------------ */ -+ -+/* ---- Private Functions ---------------------------------------------------- */ -+ -+static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream); -+static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream); -+static int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, -+ uint32_t count, void *src); -+ -+typedef struct { -+ struct work_struct my_work; -+ bcm2835_alsa_stream_t *alsa_stream; -+ int cmd; -+ void *src; -+ uint32_t count; -+} my_work_t; -+ -+static void my_wq_function(struct work_struct *work) -+{ -+ my_work_t *w = (my_work_t *) work; -+ int ret = -9; -+ LOG_DBG(" .. IN %p:%d\n", w->alsa_stream, w->cmd); -+ switch (w->cmd) { -+ case BCM2835_AUDIO_START: -+ ret = bcm2835_audio_start_worker(w->alsa_stream); -+ break; -+ case BCM2835_AUDIO_STOP: -+ ret = bcm2835_audio_stop_worker(w->alsa_stream); -+ break; -+ case BCM2835_AUDIO_WRITE: -+ ret = bcm2835_audio_write_worker(w->alsa_stream, w->count, -+ w->src); -+ break; -+ default: -+ LOG_ERR(" Unexpected work: %p:%d\n", w->alsa_stream, w->cmd); -+ break; -+ } -+ kfree((void *)work); -+ LOG_DBG(" .. OUT %d\n", ret); -+} -+ -+int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ int ret = -1; -+ LOG_DBG(" .. IN\n"); -+ if (alsa_stream->my_wq) { -+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); -+ /*--- Queue some work (item 1) ---*/ -+ if (work) { -+ INIT_WORK((struct work_struct *)work, my_wq_function); -+ work->alsa_stream = alsa_stream; -+ work->cmd = BCM2835_AUDIO_START; -+ if (queue_work -+ (alsa_stream->my_wq, (struct work_struct *)work)) -+ ret = 0; -+ } else -+ LOG_ERR(" .. Error: NULL work kmalloc\n"); -+ } -+ LOG_DBG(" .. OUT %d\n", ret); -+ return ret; -+} -+ -+int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ int ret = -1; -+ LOG_DBG(" .. IN\n"); -+ if (alsa_stream->my_wq) { -+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); -+ /*--- Queue some work (item 1) ---*/ -+ if (work) { -+ INIT_WORK((struct work_struct *)work, my_wq_function); -+ work->alsa_stream = alsa_stream; -+ work->cmd = BCM2835_AUDIO_STOP; -+ if (queue_work -+ (alsa_stream->my_wq, (struct work_struct *)work)) -+ ret = 0; -+ } else -+ LOG_ERR(" .. Error: NULL work kmalloc\n"); -+ } -+ LOG_DBG(" .. OUT %d\n", ret); -+ return ret; -+} -+ -+int bcm2835_audio_write(bcm2835_alsa_stream_t *alsa_stream, -+ uint32_t count, void *src) -+{ -+ int ret = -1; -+ LOG_DBG(" .. IN\n"); -+ if (alsa_stream->my_wq) { -+ my_work_t *work = kmalloc(sizeof(my_work_t), GFP_ATOMIC); -+ /*--- Queue some work (item 1) ---*/ -+ if (work) { -+ INIT_WORK((struct work_struct *)work, my_wq_function); -+ work->alsa_stream = alsa_stream; -+ work->cmd = BCM2835_AUDIO_WRITE; -+ work->src = src; -+ work->count = count; -+ if (queue_work -+ (alsa_stream->my_wq, (struct work_struct *)work)) -+ ret = 0; -+ } else -+ LOG_ERR(" .. Error: NULL work kmalloc\n"); -+ } -+ LOG_DBG(" .. OUT %d\n", ret); -+ return ret; -+} -+ -+void my_workqueue_init(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ alsa_stream->my_wq = alloc_workqueue("my_queue", WQ_HIGHPRI, 1); -+ return; -+} -+ -+void my_workqueue_quit(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ if (alsa_stream->my_wq) { -+ flush_workqueue(alsa_stream->my_wq); -+ destroy_workqueue(alsa_stream->my_wq); -+ alsa_stream->my_wq = NULL; -+ } -+ return; -+} -+ -+static void audio_vchi_callback(void *param, -+ const VCHI_CALLBACK_REASON_T reason, -+ void *msg_handle) -+{ -+ AUDIO_INSTANCE_T *instance = (AUDIO_INSTANCE_T *) param; -+ int32_t status; -+ int32_t msg_len; -+ VC_AUDIO_MSG_T m; -+ LOG_DBG(" .. IN instance=%p, handle=%p, alsa=%p, reason=%d, handle=%p\n", -+ instance, instance ? instance->vchi_handle[0] : NULL, instance ? instance->alsa_stream : NULL, reason, msg_handle); -+ -+ if (reason != VCHI_CALLBACK_MSG_AVAILABLE) { -+ return; -+ } -+ if (!instance) { -+ LOG_ERR(" .. instance is null\n"); -+ BUG(); -+ return; -+ } -+ if (!instance->vchi_handle[0]) { -+ LOG_ERR(" .. instance->vchi_handle[0] is null\n"); -+ BUG(); -+ return; -+ } -+ status = vchi_msg_dequeue(instance->vchi_handle[0], -+ &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); -+ if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { -+ LOG_DBG -+ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_RESULT, success=%d\n", -+ instance, m.u.result.success); -+ instance->result = m.u.result.success; -+ complete(&instance->msg_avail_comp); -+ } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { -+ bcm2835_alsa_stream_t *alsa_stream = instance->alsa_stream; -+ irq_handler_t callback = (irq_handler_t) m.u.complete.callback; -+ LOG_DBG -+ (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n", -+ instance, m.u.complete.count); -+ if (alsa_stream && callback) { -+ atomic_add(m.u.complete.count, &alsa_stream->retrieved); -+ callback(0, alsa_stream); -+ } else { -+ LOG_ERR(" .. unexpected alsa_stream=%p, callback=%p\n", -+ alsa_stream, callback); -+ } -+ } else { -+ LOG_ERR(" .. unexpected m.type=%d\n", m.type); -+ } -+ LOG_DBG(" .. OUT\n"); -+} -+ -+static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, -+ VCHI_CONNECTION_T ** -+ vchi_connections, -+ uint32_t num_connections) -+{ -+ uint32_t i; -+ AUDIO_INSTANCE_T *instance; -+ int status; -+ -+ LOG_DBG("%s: start", __func__); -+ -+ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { -+ LOG_ERR("%s: unsupported number of connections %u (max=%u)\n", -+ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); -+ -+ return NULL; -+ } -+ /* Allocate memory for this instance */ -+ instance = kmalloc(sizeof(*instance), GFP_KERNEL); -+ if (!instance) -+ return NULL; -+ -+ memset(instance, 0, sizeof(*instance)); -+ instance->num_connections = num_connections; -+ -+ /* Create a lock for exclusive, serialized VCHI connection access */ -+ mutex_init(&instance->vchi_mutex); -+ /* Open the VCHI service connections */ -+ for (i = 0; i < num_connections; i++) { -+ SERVICE_CREATION_T params = { -+ VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER), -+ VC_AUDIO_SERVER_NAME, // 4cc service code -+ vchi_connections[i], // passed in fn pointers -+ 0, // rx fifo size (unused) -+ 0, // tx fifo size (unused) -+ audio_vchi_callback, // service callback -+ instance, // service callback parameter -+ 1, //TODO: remove VCOS_FALSE, // unaligned bulk recieves -+ 1, //TODO: remove VCOS_FALSE, // unaligned bulk transmits -+ 0 // want crc check on bulk transfers -+ }; -+ -+ LOG_DBG("%s: about to open %i\n", __func__, i); -+ status = vchi_service_open(vchi_instance, ¶ms, -+ &instance->vchi_handle[i]); -+ LOG_DBG("%s: opened %i: %p=%d\n", __func__, i, instance->vchi_handle[i], status); -+ if (status) { -+ LOG_ERR -+ ("%s: failed to open VCHI service connection (status=%d)\n", -+ __func__, status); -+ -+ goto err_close_services; -+ } -+ /* Finished with the service for now */ -+ vchi_service_release(instance->vchi_handle[i]); -+ } -+ -+ LOG_DBG("%s: okay\n", __func__); -+ return instance; -+ -+err_close_services: -+ for (i = 0; i < instance->num_connections; i++) { -+ LOG_ERR("%s: closing %i: %p\n", __func__, i, instance->vchi_handle[i]); -+ if (instance->vchi_handle[i]) -+ vchi_service_close(instance->vchi_handle[i]); -+ } -+ -+ kfree(instance); -+ LOG_ERR("%s: error\n", __func__); -+ -+ return NULL; -+} -+ -+static int32_t vc_vchi_audio_deinit(AUDIO_INSTANCE_T * instance) -+{ -+ uint32_t i; -+ -+ LOG_DBG(" .. IN\n"); -+ -+ if (instance == NULL) { -+ LOG_ERR("%s: invalid handle %p\n", __func__, instance); -+ -+ return -1; -+ } -+ -+ LOG_DBG(" .. about to lock (%d)\n", instance->num_connections); -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ -+ /* Close all VCHI service connections */ -+ for (i = 0; i < instance->num_connections; i++) { -+ int32_t success; -+ LOG_DBG(" .. %i:closing %p\n", i, instance->vchi_handle[i]); -+ vchi_service_use(instance->vchi_handle[i]); -+ -+ success = vchi_service_close(instance->vchi_handle[i]); -+ if (success != 0) { -+ LOG_DBG -+ ("%s: failed to close VCHI service connection (status=%d)\n", -+ __func__, success); -+ } -+ } -+ -+ mutex_unlock(&instance->vchi_mutex); -+ -+ kfree(instance); -+ -+ LOG_DBG(" .. OUT\n"); -+ -+ return 0; -+} -+ -+static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ static VCHI_INSTANCE_T vchi_instance; -+ static VCHI_CONNECTION_T *vchi_connection; -+ static int initted; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO("%s: start\n", __func__); -+ BUG_ON(instance); -+ if (instance) { -+ LOG_ERR("%s: VCHI instance already open (%p)\n", -+ __func__, instance); -+ instance->alsa_stream = alsa_stream; -+ alsa_stream->instance = instance; -+ ret = 0; // xxx todo -1; -+ goto err_free_mem; -+ } -+ -+ /* Initialize and create a VCHI connection */ -+ if (!initted) { -+ ret = vchi_initialise(&vchi_instance); -+ if (ret != 0) { -+ LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ ret = vchi_connect(NULL, 0, vchi_instance); -+ if (ret != 0) { -+ LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ initted = 1; -+ } -+ -+ /* Initialize an instance of the audio service */ -+ instance = vc_vchi_audio_init(vchi_instance, &vchi_connection, 1); -+ -+ if (instance == NULL) { -+ LOG_ERR("%s: failed to initialize audio service\n", __func__); -+ -+ ret = -EPERM; -+ goto err_free_mem; -+ } -+ -+ instance->alsa_stream = alsa_stream; -+ alsa_stream->instance = instance; -+ -+ LOG_DBG(" success !\n"); -+err_free_mem: -+ LOG_DBG(" .. OUT\n"); -+ -+ return ret; -+} -+ -+int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ AUDIO_INSTANCE_T *instance; -+ VC_AUDIO_MSG_T m; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ my_workqueue_init(alsa_stream); -+ -+ ret = bcm2835_audio_open_connection(alsa_stream); -+ if (ret != 0) { -+ ret = -1; -+ goto exit; -+ } -+ instance = alsa_stream->instance; -+ LOG_DBG(" instance (%p)\n", instance); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_OPEN; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+exit: -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+static int bcm2835_audio_set_ctls_chan(bcm2835_alsa_stream_t * alsa_stream, -+ bcm2835_chip_t * chip) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO -+ (" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ instance->result = -1; -+ -+ m.type = VC_AUDIO_MSG_TYPE_CONTROL; -+ m.u.control.dest = chip->dest; -+ m.u.control.volume = chip->volume; -+ -+ /* Create the message available completion */ -+ init_completion(&instance->msg_avail_comp); -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ /* We are expecting a reply from the videocore */ -+ wait_for_completion(&instance->msg_avail_comp); -+ -+ if (instance->result != 0) { -+ LOG_ERR("%s: result=%d\n", __func__, instance->result); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_set_ctls(bcm2835_chip_t * chip) -+{ -+ int i; -+ int ret = 0; -+ LOG_DBG(" .. IN\n"); -+ LOG_DBG(" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); -+ -+ /* change ctls for all substreams */ -+ for (i = 0; i < MAX_SUBSTREAMS; i++) { -+ if (chip->avail_substreams & (1 << i)) { -+ if (!chip->alsa_stream[i]) -+ { -+ LOG_DBG(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams); -+ ret = 0; -+ } -+ else if (bcm2835_audio_set_ctls_chan /* returns 0 on success */ -+ (chip->alsa_stream[i], chip) != 0) -+ { -+ LOG_ERR("Couldn't set the controls for stream %d\n", i); -+ ret = -1; -+ } -+ else LOG_DBG(" Controls set for stream %d\n", i); -+ } -+ } -+ LOG_DBG(" .. OUT ret=%d\n", ret); -+ return ret; -+} -+ -+int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, -+ uint32_t channels, uint32_t samplerate, -+ uint32_t bps) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO -+ (" Setting ALSA channels(%d), samplerate(%d), bits-per-sample(%d)\n", -+ channels, samplerate, bps); -+ -+ /* resend ctls - alsa_stream may not have been open when first send */ -+ ret = bcm2835_audio_set_ctls_chan(alsa_stream, alsa_stream->chip); -+ if (ret != 0) { -+ LOG_ERR(" Alsa controls not supported\n"); -+ return -EINVAL; -+ } -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ instance->result = -1; -+ -+ m.type = VC_AUDIO_MSG_TYPE_CONFIG; -+ m.u.config.channels = channels; -+ m.u.config.samplerate = samplerate; -+ m.u.config.bps = bps; -+ -+ /* Create the message available completion */ -+ init_completion(&instance->msg_avail_comp); -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ /* We are expecting a reply from the videocore */ -+ wait_for_completion(&instance->msg_avail_comp); -+ -+ if (instance->result != 0) { -+ LOG_ERR("%s: result=%d", __func__, instance->result); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_DBG(" .. OUT\n"); -+ -+ return 0; -+} -+ -+static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_START; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_STOP; -+ m.u.stop.draining = alsa_stream->draining; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ LOG_DBG(" .. IN\n"); -+ -+ my_workqueue_quit(alsa_stream); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ m.type = VC_AUDIO_MSG_TYPE_CLOSE; -+ -+ /* Create the message available completion */ -+ init_completion(&instance->msg_avail_comp); -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ ret = -1; -+ goto unlock; -+ } -+ -+ /* We are expecting a reply from the videocore */ -+ wait_for_completion(&instance->msg_avail_comp); -+ -+ if (instance->result != 0) { -+ LOG_ERR("%s: failed result (result=%d)\n", -+ __func__, instance->result); -+ -+ ret = -1; -+ goto unlock; -+ } -+ -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ -+ /* Stop the audio service */ -+ if (instance) { -+ vc_vchi_audio_deinit(instance); -+ alsa_stream->instance = NULL; -+ } -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, -+ uint32_t count, void *src) -+{ -+ VC_AUDIO_MSG_T m; -+ AUDIO_INSTANCE_T *instance = alsa_stream->instance; -+ int32_t success; -+ int ret; -+ -+ LOG_DBG(" .. IN\n"); -+ -+ LOG_INFO(" Writing %d bytes from %p\n", count, src); -+ -+ if(mutex_lock_interruptible(&instance->vchi_mutex)) -+ { -+ LOG_DBG("Interrupted whilst waiting for lock on (%d)\n",instance->num_connections); -+ return -EINTR; -+ } -+ vchi_service_use(instance->vchi_handle[0]); -+ -+ if ( instance->peer_version==0 && vchi_get_peer_version(instance->vchi_handle[0], &instance->peer_version) == 0 ) { -+ LOG_DBG("%s: client version %d connected\n", __func__, instance->peer_version); -+ } -+ m.type = VC_AUDIO_MSG_TYPE_WRITE; -+ m.u.write.count = count; -+ // old version uses bulk, new version uses control -+ m.u.write.max_packet = instance->peer_version < 2 || force_bulk ? 0:4000; -+ m.u.write.callback = alsa_stream->fifo_irq_handler; -+ m.u.write.cookie = alsa_stream; -+ m.u.write.silence = src == NULL; -+ -+ /* Send the message to the videocore */ -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ &m, sizeof m, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ if (!m.u.write.silence) { -+ if (m.u.write.max_packet == 0) { -+ /* Send the message to the videocore */ -+ success = vchi_bulk_queue_transmit(instance->vchi_handle[0], -+ src, count, -+ 0 * -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED -+ + -+ 1 * -+ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, -+ NULL); -+ } else { -+ while (count > 0) { -+ int bytes = min((int)m.u.write.max_packet, (int)count); -+ success = vchi_msg_queue(instance->vchi_handle[0], -+ src, bytes, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ src = (char *)src + bytes; -+ count -= bytes; -+ } -+ } -+ if (success != 0) { -+ LOG_ERR -+ ("%s: failed on vchi_bulk_queue_transmit (status=%d)\n", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; -+ } -+ } -+ ret = 0; -+ -+unlock: -+ vchi_service_release(instance->vchi_handle[0]); -+ mutex_unlock(&instance->vchi_mutex); -+ LOG_DBG(" .. OUT\n"); -+ return ret; -+} -+ -+/** -+ * Returns all buffers from arm->vc -+ */ -+void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ LOG_DBG(" .. IN\n"); -+ LOG_DBG(" .. OUT\n"); -+ return; -+} -+ -+/** -+ * Forces VC to flush(drop) its filled playback buffers and -+ * return them the us. (VC->ARM) -+ */ -+void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ LOG_DBG(" .. IN\n"); -+ LOG_DBG(" .. OUT\n"); -+} -+ -+uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream) -+{ -+ uint32_t count = atomic_read(&alsa_stream->retrieved); -+ atomic_sub(count, &alsa_stream->retrieved); -+ return count; -+} -+ -+module_param(force_bulk, bool, 0444); -+MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); -diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c -new file mode 100644 -index 0000000000000000000000000000000000000000..7a2ed78ba19912aad37d46430c7ab36899880581 ---- /dev/null -+++ b/sound/arm/bcm2835.c -@@ -0,0 +1,511 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* module parameters (see "Module Parameters") */ -+/* SNDRV_CARDS: maximum number of cards supported by this module */ -+static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 }; -+static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL }; -+static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 }; -+ -+/* HACKY global pointers needed for successive probes to work : ssp -+ * But compared against the changes we will have to do in VC audio_ipc code -+ * to export 8 audio_ipc devices as a single IPC device and then monitor all -+ * four devices in a thread, this gets things done quickly and should be easier -+ * to debug if we run into issues -+ */ -+ -+static struct snd_card *g_card = NULL; -+static bcm2835_chip_t *g_chip = NULL; -+ -+static int snd_bcm2835_free(bcm2835_chip_t * chip) -+{ -+ kfree(chip); -+ return 0; -+} -+ -+/* component-destructor -+ * (see "Management of Cards and Components") -+ */ -+static int snd_bcm2835_dev_free(struct snd_device *device) -+{ -+ return snd_bcm2835_free(device->device_data); -+} -+ -+/* chip-specific constructor -+ * (see "Management of Cards and Components") -+ */ -+static int snd_bcm2835_create(struct snd_card *card, -+ struct platform_device *pdev, -+ bcm2835_chip_t ** rchip) -+{ -+ bcm2835_chip_t *chip; -+ int err; -+ static struct snd_device_ops ops = { -+ .dev_free = snd_bcm2835_dev_free, -+ }; -+ -+ *rchip = NULL; -+ -+ chip = kzalloc(sizeof(*chip), GFP_KERNEL); -+ if (chip == NULL) -+ return -ENOMEM; -+ -+ chip->card = card; -+ -+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); -+ if (err < 0) { -+ snd_bcm2835_free(chip); -+ return err; -+ } -+ -+ *rchip = chip; -+ return 0; -+} -+ -+static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ bcm2835_chip_t *chip; -+ struct snd_card *card; -+ u32 numchans; -+ int err, i; -+ -+ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", -+ &numchans); -+ if (err) { -+ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); -+ return err; -+ } -+ -+ if (numchans == 0 || numchans > MAX_SUBSTREAMS) { -+ numchans = MAX_SUBSTREAMS; -+ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n", -+ numchans); -+ } -+ -+ err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); -+ if (err) { -+ dev_err(dev, "Failed to create soundcard structure\n"); -+ return err; -+ } -+ -+ snd_card_set_dev(card, dev); -+ strcpy(card->driver, "bcm2835"); -+ strcpy(card->shortname, "bcm2835 ALSA"); -+ sprintf(card->longname, "%s", card->shortname); -+ -+ err = snd_bcm2835_create(card, pdev, &chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create bcm2835 chip\n"); -+ goto err_free; -+ } -+ -+ err = snd_bcm2835_new_pcm(chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create new bcm2835 pcm device\n"); -+ goto err_free; -+ } -+ -+ err = snd_bcm2835_new_spdif_pcm(chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n"); -+ goto err_free; -+ } -+ -+ err = snd_bcm2835_new_ctl(chip); -+ if (err < 0) { -+ dev_err(dev, "Failed to create new bcm2835 ctl\n"); -+ goto err_free; -+ } -+ -+ for (i = 0; i < numchans; i++) { -+ chip->avail_substreams |= (1 << i); -+ chip->pdev[i] = pdev; -+ } -+ -+ err = snd_card_register(card); -+ if (err) { -+ dev_err(dev, "Failed to register bcm2835 ALSA card \n"); -+ goto err_free; -+ } -+ -+ g_card = card; -+ g_chip = chip; -+ platform_set_drvdata(pdev, card); -+ audio_info("bcm2835 ALSA card created with %u channels\n", numchans); -+ -+ return 0; -+ -+err_free: -+ snd_card_free(card); -+ -+ return err; -+} -+ -+static int snd_bcm2835_alsa_probe(struct platform_device *pdev) -+{ -+ static int dev; -+ bcm2835_chip_t *chip; -+ struct snd_card *card; -+ int err; -+ -+ if (pdev->dev.of_node) -+ return snd_bcm2835_alsa_probe_dt(pdev); -+ -+ if (dev >= MAX_SUBSTREAMS) -+ return -ENODEV; -+ -+ if (!enable[dev]) { -+ dev++; -+ return -ENOENT; -+ } -+ -+ if (dev > 0) -+ goto add_register_map; -+ -+ err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, 0, &g_card); -+ if (err < 0) -+ goto out; -+ -+ snd_card_set_dev(g_card, &pdev->dev); -+ strcpy(g_card->driver, "bcm2835"); -+ strcpy(g_card->shortname, "bcm2835 ALSA"); -+ sprintf(g_card->longname, "%s", g_card->shortname); -+ -+ err = snd_bcm2835_create(g_card, pdev, &chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create bcm2835 chip\n"); -+ goto out_bcm2835_create; -+ } -+ -+ g_chip = chip; -+ err = snd_bcm2835_new_pcm(chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create new BCM2835 pcm device\n"); -+ goto out_bcm2835_new_pcm; -+ } -+ -+ err = snd_bcm2835_new_spdif_pcm(chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create new BCM2835 spdif pcm device\n"); -+ goto out_bcm2835_new_spdif; -+ } -+ -+ err = snd_bcm2835_new_ctl(chip); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Failed to create new BCM2835 ctl\n"); -+ goto out_bcm2835_new_ctl; -+ } -+ -+add_register_map: -+ card = g_card; -+ chip = g_chip; -+ -+ BUG_ON(!(card && chip)); -+ -+ chip->avail_substreams |= (1 << dev); -+ chip->pdev[dev] = pdev; -+ -+ if (dev == 0) { -+ err = snd_card_register(card); -+ if (err < 0) { -+ dev_err(&pdev->dev, -+ "Failed to register bcm2835 ALSA card \n"); -+ goto out_card_register; -+ } -+ platform_set_drvdata(pdev, card); -+ audio_info("bcm2835 ALSA card created!\n"); -+ } else { -+ audio_info("bcm2835 ALSA chip created!\n"); -+ platform_set_drvdata(pdev, (void *)dev); -+ } -+ -+ dev++; -+ -+ return 0; -+ -+out_card_register: -+out_bcm2835_new_ctl: -+out_bcm2835_new_spdif: -+out_bcm2835_new_pcm: -+out_bcm2835_create: -+ BUG_ON(!g_card); -+ if (snd_card_free(g_card)) -+ dev_err(&pdev->dev, "Failed to free Registered alsa card\n"); -+ g_card = NULL; -+out: -+ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */ -+ dev_err(&pdev->dev, "BCM2835 ALSA Probe failed !!\n"); -+ return err; -+} -+ -+static int snd_bcm2835_alsa_remove(struct platform_device *pdev) -+{ -+ uint32_t idx; -+ void *drv_data; -+ -+ drv_data = platform_get_drvdata(pdev); -+ -+ if (drv_data == (void *)g_card) { -+ /* This is the card device */ -+ snd_card_free((struct snd_card *)drv_data); -+ g_card = NULL; -+ g_chip = NULL; -+ } else { -+ idx = (uint32_t) drv_data; -+ if (g_card != NULL) { -+ BUG_ON(!g_chip); -+ /* We pass chip device numbers in audio ipc devices -+ * other than the one we registered our card with -+ */ -+ idx = (uint32_t) drv_data; -+ BUG_ON(!idx || idx > MAX_SUBSTREAMS); -+ g_chip->avail_substreams &= ~(1 << idx); -+ /* There should be atleast one substream registered -+ * after we are done here, as it wil be removed when -+ * the *remove* is called for the card device -+ */ -+ BUG_ON(!g_chip->avail_substreams); -+ } -+ } -+ -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_PM -+static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, -+ pm_message_t state) -+{ -+ return 0; -+} -+ -+static int snd_bcm2835_alsa_resume(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+#endif -+ -+static const struct of_device_id snd_bcm2835_of_match_table[] = { -+ { .compatible = "brcm,bcm2835-audio", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); -+ -+static struct platform_driver bcm2835_alsa0_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD0", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_bcm2835_of_match_table, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa1_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD1", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa2_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD2", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa3_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD3", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa4_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD4", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa5_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD5", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa6_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD6", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa7_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD7", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int bcm2835_alsa_device_init(void) -+{ -+ int err; -+ err = platform_driver_register(&bcm2835_alsa0_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto out; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa1_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_0; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa2_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_1; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa3_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_2; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa4_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_3; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa5_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_4; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa6_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_5; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa7_driver); -+ if (err) { -+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto unregister_6; -+ } -+ -+ return 0; -+ -+unregister_6: -+ platform_driver_unregister(&bcm2835_alsa6_driver); -+unregister_5: -+ platform_driver_unregister(&bcm2835_alsa5_driver); -+unregister_4: -+ platform_driver_unregister(&bcm2835_alsa4_driver); -+unregister_3: -+ platform_driver_unregister(&bcm2835_alsa3_driver); -+unregister_2: -+ platform_driver_unregister(&bcm2835_alsa2_driver); -+unregister_1: -+ platform_driver_unregister(&bcm2835_alsa1_driver); -+unregister_0: -+ platform_driver_unregister(&bcm2835_alsa0_driver); -+out: -+ return err; -+} -+ -+static void bcm2835_alsa_device_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_alsa0_driver); -+ platform_driver_unregister(&bcm2835_alsa1_driver); -+ platform_driver_unregister(&bcm2835_alsa2_driver); -+ platform_driver_unregister(&bcm2835_alsa3_driver); -+ platform_driver_unregister(&bcm2835_alsa4_driver); -+ platform_driver_unregister(&bcm2835_alsa5_driver); -+ platform_driver_unregister(&bcm2835_alsa6_driver); -+ platform_driver_unregister(&bcm2835_alsa7_driver); -+} -+ -+late_initcall(bcm2835_alsa_device_init); -+module_exit(bcm2835_alsa_device_exit); -+ -+MODULE_AUTHOR("Dom Cobley"); -+MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:bcm2835_alsa"); -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -new file mode 100755 -index 0000000000000000000000000000000000000000..0f71c5def314a63252fa4fe18ae2ba5a339f2cfb ---- /dev/null -+++ b/sound/arm/bcm2835.h -@@ -0,0 +1,167 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __SOUND_ARM_BCM2835_H -+#define __SOUND_ARM_BCM2835_H -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* -+#define AUDIO_DEBUG_ENABLE -+#define AUDIO_VERBOSE_DEBUG_ENABLE -+*/ -+ -+/* Debug macros */ -+ -+#ifdef AUDIO_DEBUG_ENABLE -+#ifdef AUDIO_VERBOSE_DEBUG_ENABLE -+ -+#define audio_debug(fmt, arg...) \ -+ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_info(fmt, arg...) \ -+ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#else -+ -+#define audio_debug(fmt, arg...) -+ -+#define audio_info(fmt, arg...) -+ -+#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */ -+ -+#else -+ -+#define audio_debug(fmt, arg...) -+ -+#define audio_info(fmt, arg...) -+ -+#endif /* AUDIO_DEBUG_ENABLE */ -+ -+#define audio_error(fmt, arg...) \ -+ printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_warning(fmt, arg...) \ -+ printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_alert(fmt, arg...) \ -+ printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define MAX_SUBSTREAMS (8) -+#define AVAIL_SUBSTREAMS_MASK (0xff) -+enum { -+ CTRL_VOL_MUTE, -+ CTRL_VOL_UNMUTE -+}; -+ -+/* macros for alsa2chip and chip2alsa, instead of functions */ -+ -+#define alsa2chip(vol) (uint)(-((vol << 8) / 100)) /* convert alsa to chip volume (defined as macro rather than function call) */ -+#define chip2alsa(vol) -((vol * 100) >> 8) /* convert chip to alsa volume */ -+ -+/* Some constants for values .. */ -+typedef enum { -+ AUDIO_DEST_AUTO = 0, -+ AUDIO_DEST_HEADPHONES = 1, -+ AUDIO_DEST_HDMI = 2, -+ AUDIO_DEST_MAX, -+} SND_BCM2835_ROUTE_T; -+ -+typedef enum { -+ PCM_PLAYBACK_VOLUME, -+ PCM_PLAYBACK_MUTE, -+ PCM_PLAYBACK_DEVICE, -+} SND_BCM2835_CTRL_T; -+ -+/* definition of the chip-specific record */ -+typedef struct bcm2835_chip { -+ struct snd_card *card; -+ struct snd_pcm *pcm; -+ struct snd_pcm *pcm_spdif; -+ /* Bitmat for valid reg_base and irq numbers */ -+ uint32_t avail_substreams; -+ struct platform_device *pdev[MAX_SUBSTREAMS]; -+ struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS]; -+ -+ int volume; -+ int old_volume; /* stores the volume value whist muted */ -+ int dest; -+ int mute; -+ -+ unsigned int opened; -+ unsigned int spdif_status; -+ struct mutex audio_mutex; -+} bcm2835_chip_t; -+ -+typedef struct bcm2835_alsa_stream { -+ bcm2835_chip_t *chip; -+ struct snd_pcm_substream *substream; -+ struct snd_pcm_indirect pcm_indirect; -+ -+ struct semaphore buffers_update_sem; -+ struct semaphore control_sem; -+ spinlock_t lock; -+ volatile uint32_t control; -+ volatile uint32_t status; -+ -+ int open; -+ int running; -+ int draining; -+ -+ int channels; -+ int params_rate; -+ int pcm_format_width; -+ -+ unsigned int pos; -+ unsigned int buffer_size; -+ unsigned int period_size; -+ -+ uint32_t enable_fifo_irq; -+ irq_handler_t fifo_irq_handler; -+ -+ atomic_t retrieved; -+ struct opaque_AUDIO_INSTANCE_T *instance; -+ struct workqueue_struct *my_wq; -+ int idx; -+} bcm2835_alsa_stream_t; -+ -+int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); -+int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); -+int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); -+ -+int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, -+ uint32_t channels, uint32_t samplerate, -+ uint32_t bps); -+int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_set_ctls(bcm2835_chip_t * chip); -+int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count, -+ void *src); -+uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream); -+ -+#endif /* __SOUND_ARM_BCM2835_H */ -diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h -new file mode 100644 -index 0000000000000000000000000000000000000000..af3e6eb690113fc32ce9e06bd2f0f294da7a7f00 ---- /dev/null -+++ b/sound/arm/vc_vchi_audioserv_defs.h -@@ -0,0 +1,116 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef _VC_AUDIO_DEFS_H_ -+#define _VC_AUDIO_DEFS_H_ -+ -+#define VC_AUDIOSERV_MIN_VER 1 -+#define VC_AUDIOSERV_VER 2 -+ -+// FourCC code used for VCHI connection -+#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -+ -+// Maximum message length -+#define VC_AUDIO_MAX_MSG_LEN (sizeof( VC_AUDIO_MSG_T )) -+ -+// List of screens that are currently supported -+// All message types supported for HOST->VC direction -+typedef enum { -+ VC_AUDIO_MSG_TYPE_RESULT, // Generic result -+ VC_AUDIO_MSG_TYPE_COMPLETE, // Generic result -+ VC_AUDIO_MSG_TYPE_CONFIG, // Configure audio -+ VC_AUDIO_MSG_TYPE_CONTROL, // Configure audio -+ VC_AUDIO_MSG_TYPE_OPEN, // Configure audio -+ VC_AUDIO_MSG_TYPE_CLOSE, // Configure audio -+ VC_AUDIO_MSG_TYPE_START, // Configure audio -+ VC_AUDIO_MSG_TYPE_STOP, // Configure audio -+ VC_AUDIO_MSG_TYPE_WRITE, // Configure audio -+ VC_AUDIO_MSG_TYPE_MAX -+} VC_AUDIO_MSG_TYPE; -+ -+// configure the audio -+typedef struct { -+ uint32_t channels; -+ uint32_t samplerate; -+ uint32_t bps; -+ -+} VC_AUDIO_CONFIG_T; -+ -+typedef struct { -+ uint32_t volume; -+ uint32_t dest; -+ -+} VC_AUDIO_CONTROL_T; -+ -+// audio -+typedef struct { -+ uint32_t dummy; -+ -+} VC_AUDIO_OPEN_T; -+ -+// audio -+typedef struct { -+ uint32_t dummy; -+ -+} VC_AUDIO_CLOSE_T; -+// audio -+typedef struct { -+ uint32_t dummy; -+ -+} VC_AUDIO_START_T; -+// audio -+typedef struct { -+ uint32_t draining; -+ -+} VC_AUDIO_STOP_T; -+ -+// configure the write audio samples -+typedef struct { -+ uint32_t count; // in bytes -+ void *callback; -+ void *cookie; -+ uint16_t silence; -+ uint16_t max_packet; -+} VC_AUDIO_WRITE_T; -+ -+// Generic result for a request (VC->HOST) -+typedef struct { -+ int32_t success; // Success value -+ -+} VC_AUDIO_RESULT_T; -+ -+// Generic result for a request (VC->HOST) -+typedef struct { -+ int32_t count; // Success value -+ void *callback; -+ void *cookie; -+} VC_AUDIO_COMPLETE_T; -+ -+// Message header for all messages in HOST->VC direction -+typedef struct { -+ int32_t type; // Message type (VC_AUDIO_MSG_TYPE) -+ union { -+ VC_AUDIO_CONFIG_T config; -+ VC_AUDIO_CONTROL_T control; -+ VC_AUDIO_OPEN_T open; -+ VC_AUDIO_CLOSE_T close; -+ VC_AUDIO_START_T start; -+ VC_AUDIO_STOP_T stop; -+ VC_AUDIO_WRITE_T write; -+ VC_AUDIO_RESULT_T result; -+ VC_AUDIO_COMPLETE_T complete; -+ } u; -+} VC_AUDIO_MSG_T; -+ -+#endif // _VC_AUDIO_DEFS_H_ - -From f173c4ba6bb591fd104486fec7229cff3648f715 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 28 Oct 2016 15:36:43 +0100 -Subject: [PATCH 039/122] vc_mem: Add vc_mem driver for querying firmware - memory addresses -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -BCM270x: Move vc_mem - -Make the vc_mem module available for ARCH_BCM2835 by moving it. - -Signed-off-by: Noralf Trønnes ---- - drivers/char/broadcom/Kconfig | 12 +- - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vc_mem.c | 422 ++++++++++++++++++++++++++++++++++++++++ - include/linux/broadcom/vc_mem.h | 35 ++++ - 4 files changed, 469 insertions(+), 1 deletion(-) - create mode 100644 drivers/char/broadcom/vc_mem.c - create mode 100644 include/linux/broadcom/vc_mem.h - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index 2d8bd6e5016aab7340636c1f5dc4dd0cbacae6c0..70379287f6261fd833202ac47de1bcca8b84959a 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -7,9 +7,19 @@ menuconfig BRCM_CHAR_DRIVERS - help - Broadcom's char drivers - -+if BRCM_CHAR_DRIVERS -+ - config BCM_VC_CMA - bool "Videocore CMA" -- depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ -+ depends on CMA && BCM2708_VCHIQ - default n - help - Helper for videocore CMA access. -+ -+config BCM2708_VCMEM -+ bool "Videocore Memory" -+ default y -+ help -+ Helper for videocore memory access and total size allocation. -+ -+endif -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index 13c5bca291ccc0df090c4e61169ace8f18ba60fe..fce918c369f7a9430136fea3ab098350339f1b01 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1 +1,2 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ -+obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c -new file mode 100644 -index 0000000000000000000000000000000000000000..be64f238ee0cc1e57f9401b0ee16c23e9fa238cc ---- /dev/null -+++ b/drivers/char/broadcom/vc_mem.c -@@ -0,0 +1,422 @@ -+/***************************************************************************** -+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "vc-mem" -+ -+// Device (/dev) related variables -+static dev_t vc_mem_devnum = 0; -+static struct class *vc_mem_class = NULL; -+static struct cdev vc_mem_cdev; -+static int vc_mem_inited = 0; -+ -+#ifdef CONFIG_DEBUG_FS -+static struct dentry *vc_mem_debugfs_entry; -+#endif -+ -+/* -+ * Videocore memory addresses and size -+ * -+ * Drivers that wish to know the videocore memory addresses and sizes should -+ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in -+ * headers. This allows the other drivers to not be tied down to a a certain -+ * address/size at compile time. -+ * -+ * In the future, the goal is to have the videocore memory virtual address and -+ * size be calculated at boot time rather than at compile time. The decision of -+ * where the videocore memory resides and its size would be in the hands of the -+ * bootloader (and/or kernel). When that happens, the values of these variables -+ * would be calculated and assigned in the init function. -+ */ -+// in the 2835 VC in mapped above ARM, but ARM has full access to VC space -+unsigned long mm_vc_mem_phys_addr = 0x00000000; -+unsigned int mm_vc_mem_size = 0; -+unsigned int mm_vc_mem_base = 0; -+ -+EXPORT_SYMBOL(mm_vc_mem_phys_addr); -+EXPORT_SYMBOL(mm_vc_mem_size); -+EXPORT_SYMBOL(mm_vc_mem_base); -+ -+static uint phys_addr = 0; -+static uint mem_size = 0; -+static uint mem_base = 0; -+ -+ -+/**************************************************************************** -+* -+* vc_mem_open -+* -+***************************************************************************/ -+ -+static int -+vc_mem_open(struct inode *inode, struct file *file) -+{ -+ (void) inode; -+ (void) file; -+ -+ pr_debug("%s: called file = 0x%p\n", __func__, file); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_release -+* -+***************************************************************************/ -+ -+static int -+vc_mem_release(struct inode *inode, struct file *file) -+{ -+ (void) inode; -+ (void) file; -+ -+ pr_debug("%s: called file = 0x%p\n", __func__, file); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_size -+* -+***************************************************************************/ -+ -+static void -+vc_mem_get_size(void) -+{ -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_base -+* -+***************************************************************************/ -+ -+static void -+vc_mem_get_base(void) -+{ -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_current_size -+* -+***************************************************************************/ -+ -+int -+vc_mem_get_current_size(void) -+{ -+ return mm_vc_mem_size; -+} -+ -+EXPORT_SYMBOL_GPL(vc_mem_get_current_size); -+ -+/**************************************************************************** -+* -+* vc_mem_ioctl -+* -+***************************************************************************/ -+ -+static long -+vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int rc = 0; -+ -+ (void) cmd; -+ (void) arg; -+ -+ pr_debug("%s: called file = 0x%p\n", __func__, file); -+ -+ switch (cmd) { -+ case VC_MEM_IOC_MEM_PHYS_ADDR: -+ { -+ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", -+ __func__, (void *) mm_vc_mem_phys_addr); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, -+ sizeof (mm_vc_mem_phys_addr)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_SIZE: -+ { -+ // Get the videocore memory size first -+ vc_mem_get_size(); -+ -+ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, -+ mm_vc_mem_size); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_size, -+ sizeof (mm_vc_mem_size)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_BASE: -+ { -+ // Get the videocore memory base -+ vc_mem_get_base(); -+ -+ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, -+ mm_vc_mem_base); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_base, -+ sizeof (mm_vc_mem_base)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_LOAD: -+ { -+ // Get the videocore memory base -+ vc_mem_get_base(); -+ -+ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, -+ mm_vc_mem_base); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_base, -+ sizeof (mm_vc_mem_base)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ default: -+ { -+ return -ENOTTY; -+ } -+ } -+ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_mmap -+* -+***************************************************************************/ -+ -+static int -+vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ int rc = 0; -+ unsigned long length = vma->vm_end - vma->vm_start; -+ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; -+ -+ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", -+ __func__, (long) vma->vm_start, (long) vma->vm_end, -+ (long) vma->vm_pgoff); -+ -+ if (offset + length > mm_vc_mem_size) { -+ pr_err("%s: length %ld is too big\n", __func__, length); -+ return -EINVAL; -+ } -+ // Do not cache the memory map -+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -+ -+ rc = remap_pfn_range(vma, vma->vm_start, -+ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + -+ vma->vm_pgoff, length, vma->vm_page_prot); -+ if (rc != 0) { -+ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); -+ } -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for the driver. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_mem_fops = { -+ .owner = THIS_MODULE, -+ .open = vc_mem_open, -+ .release = vc_mem_release, -+ .unlocked_ioctl = vc_mem_ioctl, -+ .mmap = vc_mem_mmap, -+}; -+ -+#ifdef CONFIG_DEBUG_FS -+static void vc_mem_debugfs_deinit(void) -+{ -+ debugfs_remove_recursive(vc_mem_debugfs_entry); -+ vc_mem_debugfs_entry = NULL; -+} -+ -+ -+static int vc_mem_debugfs_init( -+ struct device *dev) -+{ -+ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); -+ if (!vc_mem_debugfs_entry) { -+ dev_warn(dev, "could not create debugfs entry\n"); -+ return -EFAULT; -+ } -+ -+ if (!debugfs_create_x32("vc_mem_phys_addr", -+ 0444, -+ vc_mem_debugfs_entry, -+ (u32 *)&mm_vc_mem_phys_addr)) { -+ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", -+ __func__); -+ goto fail; -+ } -+ -+ if (!debugfs_create_x32("vc_mem_size", -+ 0444, -+ vc_mem_debugfs_entry, -+ (u32 *)&mm_vc_mem_size)) { -+ dev_warn(dev, "%s:could not create vc_mem_size entry\n", -+ __func__); -+ goto fail; -+ } -+ -+ if (!debugfs_create_x32("vc_mem_base", -+ 0444, -+ vc_mem_debugfs_entry, -+ (u32 *)&mm_vc_mem_base)) { -+ dev_warn(dev, "%s:could not create vc_mem_base entry\n", -+ __func__); -+ goto fail; -+ } -+ -+ return 0; -+ -+fail: -+ vc_mem_debugfs_deinit(); -+ return -EFAULT; -+} -+ -+#endif /* CONFIG_DEBUG_FS */ -+ -+ -+/**************************************************************************** -+* -+* vc_mem_init -+* -+***************************************************************************/ -+ -+static int __init -+vc_mem_init(void) -+{ -+ int rc = -EFAULT; -+ struct device *dev; -+ -+ pr_debug("%s: called\n", __func__); -+ -+ mm_vc_mem_phys_addr = phys_addr; -+ mm_vc_mem_size = mem_size; -+ mm_vc_mem_base = mem_base; -+ -+ vc_mem_get_size(); -+ -+ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", -+ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); -+ -+ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { -+ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", -+ __func__, rc); -+ goto out_err; -+ } -+ -+ cdev_init(&vc_mem_cdev, &vc_mem_fops); -+ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { -+ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); -+ goto out_unregister; -+ } -+ -+ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); -+ if (IS_ERR(vc_mem_class)) { -+ rc = PTR_ERR(vc_mem_class); -+ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); -+ goto out_cdev_del; -+ } -+ -+ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, -+ DRIVER_NAME); -+ if (IS_ERR(dev)) { -+ rc = PTR_ERR(dev); -+ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); -+ goto out_class_destroy; -+ } -+ -+#ifdef CONFIG_DEBUG_FS -+ /* don't fail if the debug entries cannot be created */ -+ vc_mem_debugfs_init(dev); -+#endif -+ -+ vc_mem_inited = 1; -+ return 0; -+ -+ device_destroy(vc_mem_class, vc_mem_devnum); -+ -+ out_class_destroy: -+ class_destroy(vc_mem_class); -+ vc_mem_class = NULL; -+ -+ out_cdev_del: -+ cdev_del(&vc_mem_cdev); -+ -+ out_unregister: -+ unregister_chrdev_region(vc_mem_devnum, 1); -+ -+ out_err: -+ return -1; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_exit -+* -+***************************************************************************/ -+ -+static void __exit -+vc_mem_exit(void) -+{ -+ pr_debug("%s: called\n", __func__); -+ -+ if (vc_mem_inited) { -+#if CONFIG_DEBUG_FS -+ vc_mem_debugfs_deinit(); -+#endif -+ device_destroy(vc_mem_class, vc_mem_devnum); -+ class_destroy(vc_mem_class); -+ cdev_del(&vc_mem_cdev); -+ unregister_chrdev_region(vc_mem_devnum, 1); -+ } -+} -+ -+module_init(vc_mem_init); -+module_exit(vc_mem_exit); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Broadcom Corporation"); -+ -+module_param(phys_addr, uint, 0644); -+module_param(mem_size, uint, 0644); -+module_param(mem_base, uint, 0644); -diff --git a/include/linux/broadcom/vc_mem.h b/include/linux/broadcom/vc_mem.h -new file mode 100644 -index 0000000000000000000000000000000000000000..20a475377eb3078ea1ecaef2b24efc35a58411b4 ---- /dev/null -+++ b/include/linux/broadcom/vc_mem.h -@@ -0,0 +1,35 @@ -+/***************************************************************************** -+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef _VC_MEM_H -+#define _VC_MEM_H -+ -+#include -+ -+#define VC_MEM_IOC_MAGIC 'v' -+ -+#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) -+#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) -+#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) -+#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) -+ -+#if defined( __KERNEL__ ) -+#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF -+ -+extern unsigned long mm_vc_mem_phys_addr; -+extern unsigned int mm_vc_mem_size; -+extern int vc_mem_get_current_size( void ); -+#endif -+ -+#endif /* _VC_MEM_H */ - -From 826895d0d097fa010aca39acf19d85a1e065876d Mon Sep 17 00:00:00 2001 -From: Tim Gover -Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 040/122] vcsm: VideoCore shared memory service for BCM2835 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add experimental support for the VideoCore shared memory service. -This allows user processes to allocate memory from VideoCore's -GPU relocatable heap and mmap the buffers. Additionally, the memory -handles can passed to other VideoCore services such as MMAL, OpenMax -and DispmanX - -TODO -* This driver was originally released for BCM28155 which has a different - cache architecture to BCM2835. Consequently, in this release only - uncached mappings are supported. However, there's no fundamental - reason which cached mappings cannot be support or BCM2835 -* More refactoring is required to remove the typedefs. -* Re-enable the some of the commented out debug-fs statistics which were - disabled when migrating code from proc-fs. -* There's a lot of code to support sharing of VCSM in order to support - Android. This could probably done more cleanly or perhaps just - removed. - -Signed-off-by: Tim Gover - -config: Disable VC_SM for now to fix hang with cutdown kernel - -vcsm: Use boolean as it cannot be built as module - -On building the bcm_vc_sm as a module we get the following error: - -v7_dma_flush_range and do_munmap are undefined in vc-sm.ko. - -Fix by making it not an option to build as module - -vcsm: Add ioctl for custom cache flushing - -vc-sm: Move headers out of arch directory - -Signed-off-by: Noralf Trønnes ---- - drivers/char/broadcom/Kconfig | 9 + - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vc_sm/Makefile | 9 + - drivers/char/broadcom/vc_sm/vc_sm_defs.h | 181 ++ - drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + - drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 492 +++++ - drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + - drivers/char/broadcom/vc_sm/vmcs_sm.c | 3213 ++++++++++++++++++++++++++++++ - include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ - 9 files changed, 4290 insertions(+) - create mode 100644 drivers/char/broadcom/vc_sm/Makefile - create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h - create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h - create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.c - create mode 100644 drivers/char/broadcom/vc_sm/vc_vchi_sm.h - create mode 100644 drivers/char/broadcom/vc_sm/vmcs_sm.c - create mode 100644 include/linux/broadcom/vmcs_sm_ioctl.h - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index 70379287f6261fd833202ac47de1bcca8b84959a..75fa1cba764084160f7cb77e56058f25b5e9f0ce 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -23,3 +23,12 @@ config BCM2708_VCMEM - Helper for videocore memory access and total size allocation. - - endif -+ -+config BCM_VC_SM -+ bool "VMCS Shared Memory" -+ depends on BCM2708_VCHIQ -+ select BCM2708_VCMEM -+ default n -+ help -+ Support for the VC shared memory on the Broadcom reference -+ design. Uses the VCHIQ stack. -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index fce918c369f7a9430136fea3ab098350339f1b01..de8feb98c63ff1e6437d80a6db85a8d30f433705 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1,2 +1,3 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ - obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -+obj-$(CONFIG_BCM_VC_SM) += vc_sm/ -diff --git a/drivers/char/broadcom/vc_sm/Makefile b/drivers/char/broadcom/vc_sm/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..19ce263bc273dcdb24ea2b4431e4cafcf4ca4a2b ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/Makefile -@@ -0,0 +1,9 @@ -+ccflags-$(CONFIG_BCM_VC_SM) += -Werror -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -+ccflags-$(CONFIG_BCM_VC_SM) += -I"drivers/staging/vc04_services" -I"drivers/staging/vc04_services/interface/vchi" -I"drivers/staging/vc04_services/interface/vchiq_arm" -I"$(srctree)/fs/" -+ccflags-$(CONFIG_BCM_VC_SM) += -DOS_ASSERT_FAILURE -D__STDC_VERSION=199901L -D__STDC_VERSION__=199901L -D__VCCOREVER__=0 -D__KERNEL__ -D__linux__ -+ -+obj-$(CONFIG_BCM_VC_SM) := vc-sm.o -+ -+vc-sm-objs := \ -+ vmcs_sm.o \ -+ vc_vchi_sm.o -diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h -new file mode 100644 -index 0000000000000000000000000000000000000000..c4d5ff718a5ba9071ef87fa4c6cf632486c4d36f ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h -@@ -0,0 +1,181 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __VC_SM_DEFS_H__INCLUDED__ -+#define __VC_SM_DEFS_H__INCLUDED__ -+ -+/* FourCC code used for VCHI connection */ -+#define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") -+ -+/* Maximum message length */ -+#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ -+ sizeof(VC_SM_MSG_HDR_T)) -+#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) -+ -+/* Resource name maximum size */ -+#define VC_SM_RESOURCE_NAME 32 -+ -+/* All message types supported for HOST->VC direction */ -+typedef enum { -+ /* Allocate shared memory block */ -+ VC_SM_MSG_TYPE_ALLOC, -+ /* Lock allocated shared memory block */ -+ VC_SM_MSG_TYPE_LOCK, -+ /* Unlock allocated shared memory block */ -+ VC_SM_MSG_TYPE_UNLOCK, -+ /* Unlock allocated shared memory block, do not answer command */ -+ VC_SM_MSG_TYPE_UNLOCK_NOANS, -+ /* Free shared memory block */ -+ VC_SM_MSG_TYPE_FREE, -+ /* Resize a shared memory block */ -+ VC_SM_MSG_TYPE_RESIZE, -+ /* Walk the allocated shared memory block(s) */ -+ VC_SM_MSG_TYPE_WALK_ALLOC, -+ -+ /* A previously applied action will need to be reverted */ -+ VC_SM_MSG_TYPE_ACTION_CLEAN, -+ VC_SM_MSG_TYPE_MAX -+} VC_SM_MSG_TYPE; -+ -+/* Type of memory to be allocated */ -+typedef enum { -+ VC_SM_ALLOC_CACHED, -+ VC_SM_ALLOC_NON_CACHED, -+ -+} VC_SM_ALLOC_TYPE_T; -+ -+/* Message header for all messages in HOST->VC direction */ -+typedef struct { -+ int32_t type; -+ uint32_t trans_id; -+ uint8_t body[0]; -+ -+} VC_SM_MSG_HDR_T; -+ -+/* Request to allocate memory (HOST->VC) */ -+typedef struct { -+ /* type of memory to allocate */ -+ VC_SM_ALLOC_TYPE_T type; -+ /* byte amount of data to allocate per unit */ -+ uint32_t base_unit; -+ /* number of unit to allocate */ -+ uint32_t num_unit; -+ /* alignement to be applied on allocation */ -+ uint32_t alignement; -+ /* identity of who allocated this block */ -+ uint32_t allocator; -+ /* resource name (for easier tracking on vc side) */ -+ char name[VC_SM_RESOURCE_NAME]; -+ -+} VC_SM_ALLOC_T; -+ -+/* Result of a requested memory allocation (VC->HOST) */ -+typedef struct { -+ /* Transaction identifier */ -+ uint32_t trans_id; -+ -+ /* Resource handle */ -+ uint32_t res_handle; -+ /* Pointer to resource buffer */ -+ void *res_mem; -+ /* Resource base size (bytes) */ -+ uint32_t res_base_size; -+ /* Resource number */ -+ uint32_t res_num; -+ -+} VC_SM_ALLOC_RESULT_T; -+ -+/* Request to free a previously allocated memory (HOST->VC) */ -+typedef struct { -+ /* Resource handle (returned from alloc) */ -+ uint32_t res_handle; -+ /* Resource buffer (returned from alloc) */ -+ void *res_mem; -+ -+} VC_SM_FREE_T; -+ -+/* Request to lock a previously allocated memory (HOST->VC) */ -+typedef struct { -+ /* Resource handle (returned from alloc) */ -+ uint32_t res_handle; -+ /* Resource buffer (returned from alloc) */ -+ void *res_mem; -+ -+} VC_SM_LOCK_UNLOCK_T; -+ -+/* Request to resize a previously allocated memory (HOST->VC) */ -+typedef struct { -+ /* Resource handle (returned from alloc) */ -+ uint32_t res_handle; -+ /* Resource buffer (returned from alloc) */ -+ void *res_mem; -+ /* Resource *new* size requested (bytes) */ -+ uint32_t res_new_size; -+ -+} VC_SM_RESIZE_T; -+ -+/* Result of a requested memory lock (VC->HOST) */ -+typedef struct { -+ /* Transaction identifier */ -+ uint32_t trans_id; -+ -+ /* Resource handle */ -+ uint32_t res_handle; -+ /* Pointer to resource buffer */ -+ void *res_mem; -+ /* Pointer to former resource buffer if the memory -+ * was reallocated */ -+ void *res_old_mem; -+ -+} VC_SM_LOCK_RESULT_T; -+ -+/* Generic result for a request (VC->HOST) */ -+typedef struct { -+ /* Transaction identifier */ -+ uint32_t trans_id; -+ -+ int32_t success; -+ -+} VC_SM_RESULT_T; -+ -+/* Request to revert a previously applied action (HOST->VC) */ -+typedef struct { -+ /* Action of interest */ -+ VC_SM_MSG_TYPE res_action; -+ /* Transaction identifier for the action of interest */ -+ uint32_t action_trans_id; -+ -+} VC_SM_ACTION_CLEAN_T; -+ -+/* Request to remove all data associated with a given allocator (HOST->VC) */ -+typedef struct { -+ /* Allocator identifier */ -+ uint32_t allocator; -+ -+} VC_SM_FREE_ALL_T; -+ -+/* Union of ALL messages */ -+typedef union { -+ VC_SM_ALLOC_T alloc; -+ VC_SM_ALLOC_RESULT_T alloc_result; -+ VC_SM_FREE_T free; -+ VC_SM_ACTION_CLEAN_T action_clean; -+ VC_SM_RESIZE_T resize; -+ VC_SM_LOCK_RESULT_T lock_result; -+ VC_SM_RESULT_T result; -+ VC_SM_FREE_ALL_T free_all; -+ -+} VC_SM_MSG_UNION_T; -+ -+#endif /* __VC_SM_DEFS_H__INCLUDED__ */ -diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h -new file mode 100644 -index 0000000000000000000000000000000000000000..965f9a209a025202fea8065d3947c36f4fa43d0a ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h -@@ -0,0 +1,55 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __VC_SM_KNL_H__INCLUDED__ -+#define __VC_SM_KNL_H__INCLUDED__ -+ -+#if !defined(__KERNEL__) -+#error "This interface is for kernel use only..." -+#endif -+ -+/* Type of memory to be locked (ie mapped) */ -+typedef enum { -+ VC_SM_LOCK_CACHED, -+ VC_SM_LOCK_NON_CACHED, -+ -+} VC_SM_LOCK_CACHE_MODE_T; -+ -+/* Allocate a shared memory handle and block. -+*/ -+int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); -+ -+/* Free a previously allocated shared memory handle and block. -+*/ -+int vc_sm_free(int handle); -+ -+/* Lock a memory handle for use by kernel. -+*/ -+int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data); -+ -+/* Unlock a memory handle in use by kernel. -+*/ -+int vc_sm_unlock(int handle, int flush, int no_vc_unlock); -+ -+/* Get an internal resource handle mapped from the external one. -+*/ -+int vc_sm_int_handle(int handle); -+ -+/* Map a shared memory region for use by kernel. -+*/ -+int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data); -+ -+#endif /* __VC_SM_KNL_H__INCLUDED__ */ -diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c -new file mode 100644 -index 0000000000000000000000000000000000000000..7c6ba1a244a8aff8132e0177e02b2b2a6cd364e0 ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c -@@ -0,0 +1,492 @@ -+/***************************************************************************** -+* Copyright 2011-2012 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+/* ---- Include Files ----------------------------------------------------- */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "vc_vchi_sm.h" -+ -+#define VC_SM_VER 1 -+#define VC_SM_MIN_VER 0 -+ -+/* ---- Private Constants and Types -------------------------------------- */ -+ -+/* Command blocks come from a pool */ -+#define SM_MAX_NUM_CMD_RSP_BLKS 32 -+ -+struct sm_cmd_rsp_blk { -+ struct list_head head; /* To create lists */ -+ struct semaphore sema; /* To be signaled when the response is there */ -+ -+ uint16_t id; -+ uint16_t length; -+ -+ uint8_t msg[VC_SM_MAX_MSG_LEN]; -+ -+ uint32_t wait:1; -+ uint32_t sent:1; -+ uint32_t alloc:1; -+ -+}; -+ -+struct sm_instance { -+ uint32_t num_connections; -+ VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS]; -+ struct task_struct *io_thread; -+ struct semaphore io_sema; -+ -+ uint32_t trans_id; -+ -+ struct mutex lock; -+ struct list_head cmd_list; -+ struct list_head rsp_list; -+ struct list_head dead_list; -+ -+ struct sm_cmd_rsp_blk free_blk[SM_MAX_NUM_CMD_RSP_BLKS]; -+ struct list_head free_list; -+ struct mutex free_lock; -+ struct semaphore free_sema; -+ -+}; -+ -+/* ---- Private Variables ------------------------------------------------ */ -+ -+/* ---- Private Function Prototypes -------------------------------------- */ -+ -+/* ---- Private Functions ------------------------------------------------ */ -+static struct -+sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, -+ VC_SM_MSG_TYPE id, void *msg, -+ uint32_t size, int wait) -+{ -+ struct sm_cmd_rsp_blk *blk; -+ VC_SM_MSG_HDR_T *hdr; -+ -+ if (down_interruptible(&instance->free_sema)) { -+ blk = kmalloc(sizeof(*blk), GFP_KERNEL); -+ if (!blk) -+ return NULL; -+ -+ blk->alloc = 1; -+ sema_init(&blk->sema, 0); -+ } else { -+ mutex_lock(&instance->free_lock); -+ blk = -+ list_first_entry(&instance->free_list, -+ struct sm_cmd_rsp_blk, head); -+ list_del(&blk->head); -+ mutex_unlock(&instance->free_lock); -+ } -+ -+ blk->sent = 0; -+ blk->wait = wait; -+ blk->length = sizeof(*hdr) + size; -+ -+ hdr = (VC_SM_MSG_HDR_T *) blk->msg; -+ hdr->type = id; -+ mutex_lock(&instance->lock); -+ hdr->trans_id = blk->id = ++instance->trans_id; -+ mutex_unlock(&instance->lock); -+ -+ if (size) -+ memcpy(hdr->body, msg, size); -+ -+ return blk; -+} -+ -+static void -+vc_vchi_cmd_delete(struct sm_instance *instance, struct sm_cmd_rsp_blk *blk) -+{ -+ if (blk->alloc) { -+ kfree(blk); -+ return; -+ } -+ -+ mutex_lock(&instance->free_lock); -+ list_add(&blk->head, &instance->free_list); -+ mutex_unlock(&instance->free_lock); -+ up(&instance->free_sema); -+} -+ -+static int vc_vchi_sm_videocore_io(void *arg) -+{ -+ struct sm_instance *instance = arg; -+ struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; -+ VC_SM_RESULT_T *reply; -+ uint32_t reply_len; -+ int32_t status; -+ int svc_use = 1; -+ -+ while (1) { -+ if (svc_use) -+ vchi_service_release(instance->vchi_handle[0]); -+ svc_use = 0; -+ if (!down_interruptible(&instance->io_sema)) { -+ vchi_service_use(instance->vchi_handle[0]); -+ svc_use = 1; -+ -+ do { -+ unsigned int flags; -+ /* -+ * Get new command and move it to response list -+ */ -+ mutex_lock(&instance->lock); -+ if (list_empty(&instance->cmd_list)) { -+ /* no more commands to process */ -+ mutex_unlock(&instance->lock); -+ break; -+ } -+ cmd = -+ list_first_entry(&instance->cmd_list, -+ struct sm_cmd_rsp_blk, -+ head); -+ list_move(&cmd->head, &instance->rsp_list); -+ cmd->sent = 1; -+ mutex_unlock(&instance->lock); -+ -+ /* Send the command */ -+ flags = VCHI_FLAGS_BLOCK_UNTIL_QUEUED; -+ status = vchi_msg_queue( -+ instance->vchi_handle[0], -+ cmd->msg, cmd->length, -+ flags, NULL); -+ if (status) { -+ pr_err("%s: failed to queue message (%d)", -+ __func__, status); -+ } -+ -+ /* If no reply is needed then we're done */ -+ if (!cmd->wait) { -+ mutex_lock(&instance->lock); -+ list_del(&cmd->head); -+ mutex_unlock(&instance->lock); -+ vc_vchi_cmd_delete(instance, cmd); -+ continue; -+ } -+ -+ if (status) { -+ up(&cmd->sema); -+ continue; -+ } -+ -+ } while (1); -+ -+ while (!vchi_msg_peek -+ (instance->vchi_handle[0], (void **)&reply, -+ &reply_len, VCHI_FLAGS_NONE)) { -+ mutex_lock(&instance->lock); -+ list_for_each_entry(cmd, &instance->rsp_list, -+ head) { -+ if (cmd->id == reply->trans_id) -+ break; -+ } -+ mutex_unlock(&instance->lock); -+ -+ if (&cmd->head == &instance->rsp_list) { -+ pr_debug("%s: received response %u, throw away...", -+ __func__, reply->trans_id); -+ } else if (reply_len > sizeof(cmd->msg)) { -+ pr_err("%s: reply too big (%u) %u, throw away...", -+ __func__, reply_len, -+ reply->trans_id); -+ } else { -+ memcpy(cmd->msg, reply, reply_len); -+ up(&cmd->sema); -+ } -+ -+ vchi_msg_remove(instance->vchi_handle[0]); -+ } -+ -+ /* Go through the dead list and free them */ -+ mutex_lock(&instance->lock); -+ list_for_each_entry_safe(cmd, cmd_tmp, -+ &instance->dead_list, head) { -+ list_del(&cmd->head); -+ vc_vchi_cmd_delete(instance, cmd); -+ } -+ mutex_unlock(&instance->lock); -+ } -+ } -+ -+ return 0; -+} -+ -+static void vc_sm_vchi_callback(void *param, -+ const VCHI_CALLBACK_REASON_T reason, -+ void *msg_handle) -+{ -+ struct sm_instance *instance = param; -+ -+ (void)msg_handle; -+ -+ switch (reason) { -+ case VCHI_CALLBACK_MSG_AVAILABLE: -+ up(&instance->io_sema); -+ break; -+ -+ case VCHI_CALLBACK_SERVICE_CLOSED: -+ pr_info("%s: service CLOSED!!", __func__); -+ default: -+ break; -+ } -+} -+ -+VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, -+ VCHI_CONNECTION_T **vchi_connections, -+ uint32_t num_connections) -+{ -+ uint32_t i; -+ struct sm_instance *instance; -+ int status; -+ -+ pr_debug("%s: start", __func__); -+ -+ if (num_connections > VCHI_MAX_NUM_CONNECTIONS) { -+ pr_err("%s: unsupported number of connections %u (max=%u)", -+ __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS); -+ -+ goto err_null; -+ } -+ /* Allocate memory for this instance */ -+ instance = kzalloc(sizeof(*instance), GFP_KERNEL); -+ -+ /* Misc initialisations */ -+ mutex_init(&instance->lock); -+ sema_init(&instance->io_sema, 0); -+ INIT_LIST_HEAD(&instance->cmd_list); -+ INIT_LIST_HEAD(&instance->rsp_list); -+ INIT_LIST_HEAD(&instance->dead_list); -+ INIT_LIST_HEAD(&instance->free_list); -+ sema_init(&instance->free_sema, SM_MAX_NUM_CMD_RSP_BLKS); -+ mutex_init(&instance->free_lock); -+ for (i = 0; i < SM_MAX_NUM_CMD_RSP_BLKS; i++) { -+ sema_init(&instance->free_blk[i].sema, 0); -+ list_add(&instance->free_blk[i].head, &instance->free_list); -+ } -+ -+ /* Open the VCHI service connections */ -+ instance->num_connections = num_connections; -+ for (i = 0; i < num_connections; i++) { -+ SERVICE_CREATION_T params = { -+ VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), -+ VC_SM_SERVER_NAME, -+ vchi_connections[i], -+ 0, -+ 0, -+ vc_sm_vchi_callback, -+ instance, -+ 0, -+ 0, -+ 0, -+ }; -+ -+ status = vchi_service_open(vchi_instance, -+ ¶ms, &instance->vchi_handle[i]); -+ if (status) { -+ pr_err("%s: failed to open VCHI service (%d)", -+ __func__, status); -+ -+ goto err_close_services; -+ } -+ } -+ -+ /* Create the thread which takes care of all io to/from videoocore. */ -+ instance->io_thread = kthread_create(&vc_vchi_sm_videocore_io, -+ (void *)instance, "SMIO"); -+ if (instance->io_thread == NULL) { -+ pr_err("%s: failed to create SMIO thread", __func__); -+ -+ goto err_close_services; -+ } -+ set_user_nice(instance->io_thread, -10); -+ wake_up_process(instance->io_thread); -+ -+ pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); -+ return instance; -+ -+err_close_services: -+ for (i = 0; i < instance->num_connections; i++) { -+ if (instance->vchi_handle[i] != NULL) -+ vchi_service_close(instance->vchi_handle[i]); -+ } -+ kfree(instance); -+err_null: -+ pr_debug("%s: FAILED", __func__); -+ return NULL; -+} -+ -+int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) -+{ -+ struct sm_instance *instance; -+ uint32_t i; -+ -+ if (handle == NULL) { -+ pr_err("%s: invalid pointer to handle %p", __func__, handle); -+ goto lock; -+ } -+ -+ if (*handle == NULL) { -+ pr_err("%s: invalid handle %p", __func__, *handle); -+ goto lock; -+ } -+ -+ instance = *handle; -+ -+ /* Close all VCHI service connections */ -+ for (i = 0; i < instance->num_connections; i++) { -+ int32_t success; -+ vchi_service_use(instance->vchi_handle[i]); -+ -+ success = vchi_service_close(instance->vchi_handle[i]); -+ } -+ -+ kfree(instance); -+ -+ *handle = NULL; -+ return 0; -+ -+lock: -+ return -EINVAL; -+} -+ -+int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_MSG_TYPE msg_id, -+ void *msg, uint32_t msg_size, -+ void *result, uint32_t result_size, -+ uint32_t *cur_trans_id, uint8_t wait_reply) -+{ -+ int status = 0; -+ struct sm_instance *instance = handle; -+ struct sm_cmd_rsp_blk *cmd_blk; -+ -+ if (handle == NULL) { -+ pr_err("%s: invalid handle", __func__); -+ return -EINVAL; -+ } -+ if (msg == NULL) { -+ pr_err("%s: invalid msg pointer", __func__); -+ return -EINVAL; -+ } -+ -+ cmd_blk = -+ vc_vchi_cmd_create(instance, msg_id, msg, msg_size, wait_reply); -+ if (cmd_blk == NULL) { -+ pr_err("[%s]: failed to allocate global tracking resource", -+ __func__); -+ return -ENOMEM; -+ } -+ -+ if (cur_trans_id != NULL) -+ *cur_trans_id = cmd_blk->id; -+ -+ mutex_lock(&instance->lock); -+ list_add_tail(&cmd_blk->head, &instance->cmd_list); -+ mutex_unlock(&instance->lock); -+ up(&instance->io_sema); -+ -+ if (!wait_reply) -+ /* We're done */ -+ return 0; -+ -+ /* Wait for the response */ -+ if (down_interruptible(&cmd_blk->sema)) { -+ mutex_lock(&instance->lock); -+ if (!cmd_blk->sent) { -+ list_del(&cmd_blk->head); -+ mutex_unlock(&instance->lock); -+ vc_vchi_cmd_delete(instance, cmd_blk); -+ return -ENXIO; -+ } -+ mutex_unlock(&instance->lock); -+ -+ mutex_lock(&instance->lock); -+ list_move(&cmd_blk->head, &instance->dead_list); -+ mutex_unlock(&instance->lock); -+ up(&instance->io_sema); -+ return -EINTR; /* We're done */ -+ } -+ -+ if (result && result_size) { -+ memcpy(result, cmd_blk->msg, result_size); -+ } else { -+ VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; -+ status = (res->success == 0) ? 0 : -ENXIO; -+ } -+ -+ mutex_lock(&instance->lock); -+ list_del(&cmd_blk->head); -+ mutex_unlock(&instance->lock); -+ vc_vchi_cmd_delete(instance, cmd_blk); -+ return status; -+} -+ -+int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, -+ VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, -+ msg, sizeof(*msg), result, sizeof(*result), -+ cur_trans_id, 1); -+} -+ -+int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_FREE_T *msg, uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, -+ msg, sizeof(*msg), 0, 0, cur_trans_id, 0); -+} -+ -+int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *msg, -+ VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, -+ msg, sizeof(*msg), result, sizeof(*result), -+ cur_trans_id, 1); -+} -+ -+int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *msg, -+ uint32_t *cur_trans_id, uint8_t wait_reply) -+{ -+ return vc_vchi_sm_send_msg(handle, wait_reply ? -+ VC_SM_MSG_TYPE_UNLOCK : -+ VC_SM_MSG_TYPE_UNLOCK_NOANS, msg, -+ sizeof(*msg), 0, 0, cur_trans_id, -+ wait_reply); -+} -+ -+int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, -+ uint32_t *cur_trans_id) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, -+ msg, sizeof(*msg), 0, 0, cur_trans_id, 1); -+} -+ -+int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, -+ 0, 0, 0, 0, 0, 0); -+} -+ -+int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) -+{ -+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, -+ msg, sizeof(*msg), 0, 0, 0, 0); -+} -diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h -new file mode 100644 -index 0000000000000000000000000000000000000000..5e279f5a95fac7227cea15941bf0570ddc2b0886 ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h -@@ -0,0 +1,82 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __VC_VCHI_SM_H__INCLUDED__ -+#define __VC_VCHI_SM_H__INCLUDED__ -+ -+#include "interface/vchi/vchi.h" -+ -+#include "vc_sm_defs.h" -+ -+/* Forward declare. -+*/ -+typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; -+ -+/* Initialize the shared memory service, opens up vchi connection to talk to it. -+*/ -+VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, -+ VCHI_CONNECTION_T **vchi_connections, -+ uint32_t num_connections); -+ -+/* Terminates the shared memory service. -+*/ -+int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); -+ -+/* Ask the shared memory service to allocate some memory on videocre and -+** return the result of this allocation (which upon success will be a pointer -+** to some memory in videocore space). -+*/ -+int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_ALLOC_T *alloc, -+ VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); -+ -+/* Ask the shared memory service to free up some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_FREE_T *free, uint32_t *trans_id); -+ -+/* Ask the shared memory service to lock up some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *lock_unlock, -+ VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); -+ -+/* Ask the shared memory service to unlock some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *lock_unlock, -+ uint32_t *trans_id, uint8_t wait_reply); -+ -+/* Ask the shared memory service to resize some memory that was previously -+** allocated by the vc_vchi_sm_alloc function call. -+*/ -+int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_RESIZE_T *resize, uint32_t *trans_id); -+ -+/* Walk the allocated resources on the videocore side, the allocation will -+** show up in the log. This is purely for debug/information and takes no -+** specific actions. -+*/ -+int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); -+ -+/* Clean up following a previously interrupted action which left the system -+** in a bad state of some sort. -+*/ -+int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_ACTION_CLEAN_T *action_clean); -+ -+#endif /* __VC_VCHI_SM_H__INCLUDED__ */ -diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c -new file mode 100644 -index 0000000000000000000000000000000000000000..1db6716c2c0c8b2013203391501f92d09db258af ---- /dev/null -+++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c -@@ -0,0 +1,3213 @@ -+/***************************************************************************** -+* Copyright 2011-2012 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+/* ---- Include Files ----------------------------------------------------- */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "vchiq_connected.h" -+#include "vc_vchi_sm.h" -+ -+#include -+#include "vc_sm_knl.h" -+ -+/* ---- Private Constants and Types --------------------------------------- */ -+ -+#define DEVICE_NAME "vcsm" -+#define DEVICE_MINOR 0 -+ -+#define VC_SM_DIR_ROOT_NAME "vc-smem" -+#define VC_SM_DIR_ALLOC_NAME "alloc" -+#define VC_SM_STATE "state" -+#define VC_SM_STATS "statistics" -+#define VC_SM_RESOURCES "resources" -+#define VC_SM_DEBUG "debug" -+#define VC_SM_WRITE_BUF_SIZE 128 -+ -+/* Statistics tracked per resource and globally. -+*/ -+enum SM_STATS_T { -+ /* Attempt. */ -+ ALLOC, -+ FREE, -+ LOCK, -+ UNLOCK, -+ MAP, -+ FLUSH, -+ INVALID, -+ -+ END_ATTEMPT, -+ -+ /* Failure. */ -+ ALLOC_FAIL, -+ FREE_FAIL, -+ LOCK_FAIL, -+ UNLOCK_FAIL, -+ MAP_FAIL, -+ FLUSH_FAIL, -+ INVALID_FAIL, -+ -+ END_ALL, -+ -+}; -+ -+static const char *const sm_stats_human_read[] = { -+ "Alloc", -+ "Free", -+ "Lock", -+ "Unlock", -+ "Map", -+ "Cache Flush", -+ "Cache Invalidate", -+}; -+ -+typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); -+struct SM_PDE_T { -+ VC_SM_SHOW show; /* Debug fs function hookup. */ -+ struct dentry *dir_entry; /* Debug fs directory entry. */ -+ void *priv_data; /* Private data */ -+ -+}; -+ -+/* Single resource allocation tracked for all devices. -+*/ -+struct sm_mmap { -+ struct list_head map_list; /* Linked list of maps. */ -+ -+ struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ -+ -+ pid_t res_pid; /* PID owning that resource. */ -+ unsigned int res_vc_hdl; /* Resource handle (videocore). */ -+ unsigned int res_usr_hdl; /* Resource handle (user). */ -+ -+ long unsigned int res_addr; /* Mapped virtual address. */ -+ struct vm_area_struct *vma; /* VM area for this mapping. */ -+ unsigned int ref_count; /* Reference count to this vma. */ -+ -+ /* Used to link maps associated with a resource. */ -+ struct list_head resource_map_list; -+}; -+ -+/* Single resource allocation tracked for each opened device. -+*/ -+struct SM_RESOURCE_T { -+ struct list_head resource_list; /* List of resources. */ -+ struct list_head global_resource_list; /* Global list of resources. */ -+ -+ pid_t pid; /* PID owning that resource. */ -+ uint32_t res_guid; /* Unique identifier. */ -+ uint32_t lock_count; /* Lock count for this resource. */ -+ uint32_t ref_count; /* Ref count for this resource. */ -+ -+ uint32_t res_handle; /* Resource allocation handle. */ -+ void *res_base_mem; /* Resource base memory address. */ -+ uint32_t res_size; /* Resource size allocated. */ -+ enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ -+ struct SM_RESOURCE_T *res_shared; /* Shared resource */ -+ -+ enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ -+ -+ uint8_t map_count; /* Counter of mappings for this resource. */ -+ struct list_head map_list; /* Maps associated with a resource. */ -+ -+ struct SM_PRIV_DATA_T *private; -+}; -+ -+/* Private file data associated with each opened device. -+*/ -+struct SM_PRIV_DATA_T { -+ struct list_head resource_list; /* List of resources. */ -+ -+ pid_t pid; /* PID of creator. */ -+ -+ struct dentry *dir_pid; /* Debug fs entries root. */ -+ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ -+ struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ -+ -+ int restart_sys; /* Tracks restart on interrupt. */ -+ VC_SM_MSG_TYPE int_action; /* Interrupted action. */ -+ uint32_t int_trans_id; /* Interrupted transaction. */ -+ -+}; -+ -+/* Global state information. -+*/ -+struct SM_STATE_T { -+ VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ -+ struct dentry *dir_root; /* Debug fs entries root. */ -+ struct dentry *dir_alloc; /* Debug fs entries allocations. */ -+ struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ -+ struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ -+ struct dentry *debug; /* Debug fs entries debug. */ -+ -+ struct mutex map_lock; /* Global map lock. */ -+ struct list_head map_list; /* List of maps. */ -+ struct list_head resource_list; /* List of resources. */ -+ -+ enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ -+ enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ -+ uint32_t res_deceased_cnt; /* Natural termination counter. */ -+ uint32_t res_terminated_cnt; /* Forced termination counter. */ -+ -+ struct cdev sm_cdev; /* Device. */ -+ dev_t sm_devid; /* Device identifier. */ -+ struct class *sm_class; /* Class. */ -+ struct device *sm_dev; /* Device. */ -+ -+ struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ -+ -+ struct mutex lock; /* Global lock. */ -+ uint32_t guid; /* GUID (next) tracker. */ -+ -+}; -+ -+/* ---- Private Variables ----------------------------------------------- */ -+ -+static struct SM_STATE_T *sm_state; -+static int sm_inited; -+ -+#if 0 -+static const char *const sm_cache_map_vector[] = { -+ "(null)", -+ "host", -+ "videocore", -+ "host+videocore", -+}; -+#endif -+ -+/* ---- Private Function Prototypes -------------------------------------- */ -+ -+/* ---- Private Functions ------------------------------------------------ */ -+ -+static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) -+{ -+ unsigned long pfn = vc_addr & 0x3FFFFFFF; -+ pfn += mm_vc_mem_phys_addr; -+ pfn >>= PAGE_SHIFT; -+ return pfn; -+} -+ -+/* Carries over to the state statistics the statistics once owned by a deceased -+** resource. -+*/ -+static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) -+{ -+ if (sm_state != NULL) { -+ if (p_res != NULL) { -+ int ix; -+ -+ if (terminated) -+ sm_state->res_terminated_cnt++; -+ else -+ sm_state->res_deceased_cnt++; -+ -+ for (ix = 0; ix < END_ALL; ix++) { -+ if (terminated) -+ sm_state->terminated[ix] += -+ p_res->res_stats[ix]; -+ else -+ sm_state->deceased[ix] += -+ p_res->res_stats[ix]; -+ } -+ } -+ } -+} -+ -+/* Fetch a videocore handle corresponding to a mapping of the pid+address -+** returns 0 (ie NULL) if no such handle exists in the global map. -+*/ -+static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, -+ unsigned int addr) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int handle = 0; -+ -+ if (!sm_state || addr == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_addr != addr) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> vc-hdl %x (usr-hdl %x)\n", -+ __func__, map, map->res_pid, map->res_addr, -+ map->res_vc_hdl, map->res_usr_hdl); -+ -+ handle = map->res_vc_hdl; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ ** for something that is not mapped, we do not want a kernel log each -+ ** time around. -+ ** -+ ** There are other error log that would pop up accordingly if someone -+ ** subsequently tries to use something invalid after being told not to -+ ** use it... -+ */ -+ if (handle == 0) { -+ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", -+ __func__, pid, addr); -+ } -+ -+ return handle; -+} -+ -+/* Fetch a user handle corresponding to a mapping of the pid+address -+** returns 0 (ie NULL) if no such handle exists in the global map. -+*/ -+static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, -+ unsigned int addr) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int handle = 0; -+ -+ if (!sm_state || addr == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_addr != addr) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, addr %lx) -> usr-hdl %x (vc-hdl %x)\n", -+ __func__, map, map->res_pid, map->res_addr, -+ map->res_usr_hdl, map->res_vc_hdl); -+ -+ handle = map->res_usr_hdl; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ * for something that is not mapped yet. -+ * -+ * There are other error log that would pop up accordingly if someone -+ * subsequently tries to use something invalid after being told not to -+ * use it... -+ */ -+ if (handle == 0) -+ pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", -+ __func__, pid, addr); -+ -+ return handle; -+} -+ -+#if defined(DO_NOT_USE) -+/* Fetch an address corresponding to a mapping of the pid+handle -+** returns 0 (ie NULL) if no such address exists in the global map. -+*/ -+static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, -+ unsigned int hdl) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int addr = 0; -+ -+ if (sm_state == NULL || hdl == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_vc_hdl != hdl) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+ -+ addr = map->res_addr; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ ** for something that is not mapped, we do not want a kernel log each -+ ** time around. -+ ** -+ ** There are other error log that would pop up accordingly if someone -+ ** subsequently tries to use something invalid after being told not to -+ ** use it... -+ */ -+ if (addr == 0) -+ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", -+ __func__, pid, hdl); -+ -+ return addr; -+} -+#endif -+ -+/* Fetch an address corresponding to a mapping of the pid+handle -+** returns 0 (ie NULL) if no such address exists in the global map. -+*/ -+static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int -+ pid, -+ unsigned int -+ hdl) -+{ -+ struct sm_mmap *map = NULL; -+ unsigned int addr = 0; -+ -+ if (sm_state == NULL || hdl == 0) -+ goto out; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Lookup the resource. -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (map->res_pid != pid || map->res_usr_hdl != hdl) -+ continue; -+ -+ pr_debug("[%s]: global map %p (pid %u, vc-hdl %x, usr-hdl %x) -> addr %lx\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+ -+ addr = map->res_addr; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+out: -+ /* Use a debug log here as it may be a valid situation that we query -+ * for something that is not mapped, we do not want a kernel log each -+ * time around. -+ * -+ * There are other error log that would pop up accordingly if someone -+ * subsequently tries to use something invalid after being told not to -+ * use it... -+ */ -+ if (addr == 0) -+ pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", __func__, -+ pid, hdl); -+ -+ return addr; -+} -+ -+/* Adds a resource mapping to the global data list. -+*/ -+static void vmcs_sm_add_map(struct SM_STATE_T *state, -+ struct SM_RESOURCE_T *resource, struct sm_mmap *map) -+{ -+ mutex_lock(&(state->map_lock)); -+ -+ /* Add to the global list of mappings -+ */ -+ list_add(&map->map_list, &state->map_list); -+ -+ /* Add to the list of mappings for this resource -+ */ -+ list_add(&map->resource_map_list, &resource->map_list); -+ resource->map_count++; -+ -+ mutex_unlock(&(state->map_lock)); -+ -+ pr_debug("[%s]: added map %p (pid %u, vc-hdl %x, usr-hdl %x, addr %lx)\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+} -+ -+/* Removes a resource mapping from the global data list. -+*/ -+static void vmcs_sm_remove_map(struct SM_STATE_T *state, -+ struct SM_RESOURCE_T *resource, -+ struct sm_mmap *map) -+{ -+ mutex_lock(&(state->map_lock)); -+ -+ /* Remove from the global list of mappings -+ */ -+ list_del(&map->map_list); -+ -+ /* Remove from the list of mapping for this resource -+ */ -+ list_del(&map->resource_map_list); -+ if (resource->map_count > 0) -+ resource->map_count--; -+ -+ mutex_unlock(&(state->map_lock)); -+ -+ pr_debug("[%s]: removed map %p (pid %d, vc-hdl %x, usr-hdl %x, addr %lx)\n", -+ __func__, map, map->res_pid, map->res_vc_hdl, map->res_usr_hdl, -+ map->res_addr); -+ -+ kfree(map); -+} -+ -+/* Read callback for the global state proc entry. -+*/ -+static int vc_sm_global_state_show(struct seq_file *s, void *v) -+{ -+ struct sm_mmap *map = NULL; -+ int map_count = 0; -+ -+ if (sm_state == NULL) -+ return 0; -+ -+ seq_printf(s, "\nVC-ServiceHandle 0x%x\n", -+ (unsigned int)sm_state->sm_handle); -+ -+ /* Log all applicable mapping(s). -+ */ -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ map_count++; -+ -+ seq_printf(s, "\nMapping 0x%x\n", -+ (unsigned int)map); -+ seq_printf(s, " TGID %u\n", -+ map->res_pid); -+ seq_printf(s, " VC-HDL 0x%x\n", -+ map->res_vc_hdl); -+ seq_printf(s, " USR-HDL 0x%x\n", -+ map->res_usr_hdl); -+ seq_printf(s, " USR-ADDR 0x%lx\n", -+ map->res_addr); -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ seq_printf(s, "\n\nTotal map count: %d\n\n", map_count); -+ -+ return 0; -+} -+ -+static int vc_sm_global_statistics_show(struct seq_file *s, void *v) -+{ -+ int ix; -+ -+ /* Global state tracked statistics. -+ */ -+ if (sm_state != NULL) { -+ seq_puts(s, "\nDeceased Resources Statistics\n"); -+ -+ seq_printf(s, "\nNatural Cause (%u occurences)\n", -+ sm_state->res_deceased_cnt); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->deceased[ix] > 0) { -+ seq_printf(s, " %u\t%s\n", -+ sm_state->deceased[ix], -+ sm_stats_human_read[ix]); -+ } -+ } -+ seq_puts(s, "\n"); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->deceased[ix + END_ATTEMPT] > 0) { -+ seq_printf(s, " %u\tFAILED %s\n", -+ sm_state->deceased[ix + END_ATTEMPT], -+ sm_stats_human_read[ix]); -+ } -+ } -+ -+ seq_printf(s, "\nForcefull (%u occurences)\n", -+ sm_state->res_terminated_cnt); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->terminated[ix] > 0) { -+ seq_printf(s, " %u\t%s\n", -+ sm_state->terminated[ix], -+ sm_stats_human_read[ix]); -+ } -+ } -+ seq_puts(s, "\n"); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (sm_state->terminated[ix + END_ATTEMPT] > 0) { -+ seq_printf(s, " %u\tFAILED %s\n", -+ sm_state->terminated[ix + -+ END_ATTEMPT], -+ sm_stats_human_read[ix]); -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+#if 0 -+/* Read callback for the statistics proc entry. -+*/ -+static int vc_sm_statistics_show(struct seq_file *s, void *v) -+{ -+ int ix; -+ struct SM_PRIV_DATA_T *file_data; -+ struct SM_RESOURCE_T *resource; -+ int res_count = 0; -+ struct SM_PDE_T *p_pde; -+ -+ p_pde = (struct SM_PDE_T *)(s->private); -+ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); -+ -+ if (file_data == NULL) -+ return 0; -+ -+ /* Per process statistics. -+ */ -+ -+ seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&file_data->resource_list)) { -+ list_for_each_entry(resource, &file_data->resource_list, -+ resource_list) { -+ res_count++; -+ -+ seq_printf(s, "\nGUID: 0x%x\n\n", -+ resource->res_guid); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (resource->res_stats[ix] > 0) { -+ seq_printf(s, -+ " %u\t%s\n", -+ resource->res_stats[ix], -+ sm_stats_human_read[ix]); -+ } -+ } -+ seq_puts(s, "\n"); -+ for (ix = 0; ix < END_ATTEMPT; ix++) { -+ if (resource->res_stats[ix + END_ATTEMPT] > 0) { -+ seq_printf(s, -+ " %u\tFAILED %s\n", -+ resource->res_stats[ -+ ix + END_ATTEMPT], -+ sm_stats_human_read[ix]); -+ } -+ } -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ seq_printf(s, "\nResources Count %d\n", res_count); -+ -+ return 0; -+} -+#endif -+ -+#if 0 -+/* Read callback for the allocation proc entry. */ -+static int vc_sm_alloc_show(struct seq_file *s, void *v) -+{ -+ struct SM_PRIV_DATA_T *file_data; -+ struct SM_RESOURCE_T *resource; -+ int alloc_count = 0; -+ struct SM_PDE_T *p_pde; -+ -+ p_pde = (struct SM_PDE_T *)(s->private); -+ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); -+ -+ if (!file_data) -+ return 0; -+ -+ /* Per process statistics. */ -+ seq_printf(s, "\nAllocation for TGID %d\n", file_data->pid); -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&file_data->resource_list)) { -+ list_for_each_entry(resource, &file_data->resource_list, -+ resource_list) { -+ alloc_count++; -+ -+ seq_printf(s, "\nGUID: 0x%x\n", -+ resource->res_guid); -+ seq_printf(s, "Lock Count: %u\n", -+ resource->lock_count); -+ seq_printf(s, "Mapped: %s\n", -+ (resource->map_count ? "yes" : "no")); -+ seq_printf(s, "VC-handle: 0x%x\n", -+ resource->res_handle); -+ seq_printf(s, "VC-address: 0x%p\n", -+ resource->res_base_mem); -+ seq_printf(s, "VC-size (bytes): %u\n", -+ resource->res_size); -+ seq_printf(s, "Cache: %s\n", -+ sm_cache_map_vector[resource->res_cached]); -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ seq_printf(s, "\n\nTotal allocation count: %d\n\n", alloc_count); -+ -+ return 0; -+} -+#endif -+ -+static int vc_sm_seq_file_show(struct seq_file *s, void *v) -+{ -+ struct SM_PDE_T *sm_pde; -+ -+ sm_pde = (struct SM_PDE_T *)(s->private); -+ -+ if (sm_pde && sm_pde->show) -+ sm_pde->show(s, v); -+ -+ return 0; -+} -+ -+static int vc_sm_single_open(struct inode *inode, struct file *file) -+{ -+ return single_open(file, vc_sm_seq_file_show, inode->i_private); -+} -+ -+static const struct file_operations vc_sm_debug_fs_fops = { -+ .open = vc_sm_single_open, -+ .read = seq_read, -+ .llseek = seq_lseek, -+ .release = single_release, -+}; -+ -+/* Adds a resource to the private data list which tracks all the allocated -+** data. -+*/ -+static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, -+ struct SM_RESOURCE_T *resource) -+{ -+ mutex_lock(&(sm_state->map_lock)); -+ list_add(&resource->resource_list, &privdata->resource_list); -+ list_add(&resource->global_resource_list, &sm_state->resource_list); -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ pr_debug("[%s]: added resource %p (base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_base_mem, -+ resource->res_handle, resource->res_size, resource->res_cached); -+} -+ -+/* Locates a resource and acquire a reference on it. -+** The resource won't be deleted while there is a reference on it. -+*/ -+static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T -+ *private, -+ unsigned int res_guid) -+{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ list_for_each_entry(resource, &private->resource_list, resource_list) { -+ if (resource->res_guid != res_guid) -+ continue; -+ -+ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_guid, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, resource->res_cached); -+ resource->ref_count++; -+ ret = resource; -+ break; -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return ret; -+} -+ -+/* Locates a resource and acquire a reference on it. -+** The resource won't be deleted while there is a reference on it. -+*/ -+static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( -+ struct SM_PRIV_DATA_T *private) -+{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ list_for_each_entry(resource, &private->resource_list, resource_list) { -+ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_guid, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, resource->res_cached); -+ resource->ref_count++; -+ ret = resource; -+ break; -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return ret; -+} -+ -+/* Locates a resource and acquire a reference on it. -+** The resource won't be deleted while there is a reference on it. -+*/ -+static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int -+ res_guid) -+{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ list_for_each_entry(resource, &sm_state->resource_list, -+ global_resource_list) { -+ if (resource->res_guid != res_guid) -+ continue; -+ -+ pr_debug("[%s]: located resource %p (guid: %x, base addr %p, hdl %x, size %u, cache %u)\n", -+ __func__, resource, resource->res_guid, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, resource->res_cached); -+ resource->ref_count++; -+ ret = resource; -+ break; -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return ret; -+} -+ -+/* Release a previously acquired resource. -+** The resource will be deleted when its refcount reaches 0. -+*/ -+static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) -+{ -+ struct SM_PRIV_DATA_T *private = resource->private; -+ struct sm_mmap *map, *map_tmp; -+ struct SM_RESOURCE_T *res_tmp; -+ int ret; -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (--resource->ref_count) { -+ if (force) -+ pr_err("[%s]: resource %p in use\n", __func__, resource); -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ return; -+ } -+ -+ /* Time to free the resource. Start by removing it from the list */ -+ list_del(&resource->resource_list); -+ list_del(&resource->global_resource_list); -+ -+ /* Walk the global resource list, find out if the resource is used -+ * somewhere else. In which case we don't want to delete it. -+ */ -+ list_for_each_entry(res_tmp, &sm_state->resource_list, -+ global_resource_list) { -+ if (res_tmp->res_handle == resource->res_handle) { -+ resource->res_handle = 0; -+ break; -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ pr_debug("[%s]: freeing data - guid %x, hdl %x, base address %p\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem); -+ resource->res_stats[FREE]++; -+ -+ /* Make sure the resource we're removing is unmapped first */ -+ if (resource->map_count && !list_empty(&resource->map_list)) { -+ down_write(¤t->mm->mmap_sem); -+ list_for_each_entry_safe(map, map_tmp, &resource->map_list, -+ resource_map_list) { -+ ret = -+ do_munmap(current->mm, map->res_addr, -+ resource->res_size); -+ if (ret) { -+ pr_err("[%s]: could not unmap resource %p\n", -+ __func__, resource); -+ } -+ } -+ up_write(¤t->mm->mmap_sem); -+ } -+ -+ /* Free up the videocore allocated resource. -+ */ -+ if (resource->res_handle) { -+ VC_SM_FREE_T free = { -+ resource->res_handle, resource->res_base_mem -+ }; -+ int status = vc_vchi_sm_free(sm_state->sm_handle, &free, -+ &private->int_trans_id); -+ if (status != 0 && status != -EINTR) { -+ pr_err("[%s]: failed to free memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ resource->res_stats[FREE_FAIL]++; -+ ret = -EPERM; -+ } -+ } -+ -+ /* Free up the shared resource. -+ */ -+ if (resource->res_shared) -+ vmcs_sm_release_resource(resource->res_shared, 0); -+ -+ /* Free up the local resource tracking this allocation. -+ */ -+ vc_sm_resource_deceased(resource, force); -+ kfree(resource); -+} -+ -+/* Dump the map table for the driver. If process is -1, dumps the whole table, -+** if process is a valid pid (non -1) dump only the entries associated with the -+** pid of interest. -+*/ -+static void vmcs_sm_host_walk_map_per_pid(int pid) -+{ -+ struct sm_mmap *map = NULL; -+ -+ /* Make sure the device was started properly. -+ */ -+ if (sm_state == NULL) { -+ pr_err("[%s]: invalid device\n", __func__); -+ return; -+ } -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ /* Log all applicable mapping(s). -+ */ -+ if (!list_empty(&sm_state->map_list)) { -+ list_for_each_entry(map, &sm_state->map_list, map_list) { -+ if (pid == -1 || map->res_pid == pid) { -+ pr_info("[%s]: tgid: %u - vc-hdl: %x, usr-hdl: %x, usr-addr: %lx\n", -+ __func__, map->res_pid, map->res_vc_hdl, -+ map->res_usr_hdl, map->res_addr); -+ } -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return; -+} -+ -+/* Dump the allocation table from host side point of view. This only dumps the -+** data allocated for this process/device referenced by the file_data. -+*/ -+static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) -+{ -+ struct SM_RESOURCE_T *resource = NULL; -+ -+ /* Make sure the device was started properly. -+ */ -+ if ((sm_state == NULL) || (file_data == NULL)) { -+ pr_err("[%s]: invalid device\n", __func__); -+ return; -+ } -+ -+ mutex_lock(&(sm_state->map_lock)); -+ -+ if (!list_empty(&file_data->resource_list)) { -+ list_for_each_entry(resource, &file_data->resource_list, -+ resource_list) { -+ pr_info("[%s]: guid: %x - hdl: %x, vc-mem: %p, size: %u, cache: %u\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem, resource->res_size, -+ resource->res_cached); -+ } -+ } -+ -+ mutex_unlock(&(sm_state->map_lock)); -+ -+ return; -+} -+ -+/* Create support for private data tracking. -+*/ -+static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) -+{ -+ char alloc_name[32]; -+ struct SM_PRIV_DATA_T *file_data = NULL; -+ -+ /* Allocate private structure. */ -+ file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); -+ -+ if (!file_data) { -+ pr_err("[%s]: cannot allocate file data\n", __func__); -+ goto out; -+ } -+ -+ snprintf(alloc_name, sizeof(alloc_name), "%d", id); -+ -+ INIT_LIST_HEAD(&file_data->resource_list); -+ file_data->pid = id; -+ file_data->dir_pid = debugfs_create_dir(alloc_name, -+ sm_state->dir_alloc); -+#if 0 -+ /* TODO: fix this to support querying statistics per pid */ -+ -+ if (IS_ERR_OR_NULL(file_data->dir_pid)) { -+ file_data->dir_pid = NULL; -+ } else { -+ struct dentry *dir_entry; -+ -+ dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, -+ file_data->dir_pid, file_data, -+ vc_sm_debug_fs_fops); -+ -+ file_data->dir_res.dir_entry = dir_entry; -+ file_data->dir_res.priv_data = file_data; -+ file_data->dir_res.show = &vc_sm_alloc_show; -+ -+ dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, -+ file_data->dir_pid, file_data, -+ vc_sm_debug_fs_fops); -+ -+ file_data->dir_res.dir_entry = dir_entry; -+ file_data->dir_res.priv_data = file_data; -+ file_data->dir_res.show = &vc_sm_statistics_show; -+ } -+ pr_debug("[%s]: private data allocated %p\n", __func__, file_data); -+ -+#endif -+out: -+ return file_data; -+} -+ -+/* Open the device. Creates a private state to help track all allocation -+** associated with this device. -+*/ -+static int vc_sm_open(struct inode *inode, struct file *file) -+{ -+ int ret = 0; -+ -+ /* Make sure the device was started properly. -+ */ -+ if (!sm_state) { -+ pr_err("[%s]: invalid device\n", __func__); -+ ret = -EPERM; -+ goto out; -+ } -+ -+ file->private_data = vc_sm_create_priv_data(current->tgid); -+ if (file->private_data == NULL) { -+ pr_err("[%s]: failed to create data tracker\n", __func__); -+ -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+out: -+ return ret; -+} -+ -+/* Close the device. Free up all resources still associated with this device -+** at the time. -+*/ -+static int vc_sm_release(struct inode *inode, struct file *file) -+{ -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ -+ /* Make sure the device was started properly. -+ */ -+ if (sm_state == NULL || file_data == NULL) { -+ pr_err("[%s]: invalid device\n", __func__); -+ ret = -EPERM; -+ goto out; -+ } -+ -+ pr_debug("[%s]: using private data %p\n", __func__, file_data); -+ -+ if (file_data->restart_sys == -EINTR) { -+ VC_SM_ACTION_CLEAN_T action_clean; -+ -+ pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", -+ __func__, file_data->int_action, -+ file_data->int_trans_id); -+ -+ action_clean.res_action = file_data->int_action; -+ action_clean.action_trans_id = file_data->int_trans_id; -+ -+ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); -+ } -+ -+ while ((resource = vmcs_sm_acquire_first_resource(file_data)) != NULL) { -+ vmcs_sm_release_resource(resource, 0); -+ vmcs_sm_release_resource(resource, 1); -+ } -+ -+ /* Remove the corresponding proc entry. */ -+ debugfs_remove_recursive(file_data->dir_pid); -+ -+ /* Terminate the private data. -+ */ -+ kfree(file_data); -+ -+out: -+ return ret; -+} -+ -+static void vcsm_vma_open(struct vm_area_struct *vma) -+{ -+ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; -+ -+ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", -+ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, -+ (int)vma->vm_pgoff); -+ -+ map->ref_count++; -+} -+ -+static void vcsm_vma_close(struct vm_area_struct *vma) -+{ -+ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; -+ -+ pr_debug("[%s]: virt %lx-%lx, pid %i, pfn %i\n", -+ __func__, vma->vm_start, vma->vm_end, (int)current->tgid, -+ (int)vma->vm_pgoff); -+ -+ map->ref_count--; -+ -+ /* Remove from the map table. -+ */ -+ if (map->ref_count == 0) -+ vmcs_sm_remove_map(sm_state, map->resource, map); -+} -+ -+static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+{ -+ struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; -+ struct SM_RESOURCE_T *resource = map->resource; -+ pgoff_t page_offset; -+ unsigned long pfn; -+ int ret = 0; -+ -+ /* Lock the resource if necessary. -+ */ -+ if (!resource->lock_count) { -+ VC_SM_LOCK_UNLOCK_T lock_unlock; -+ VC_SM_LOCK_RESULT_T lock_result; -+ int status; -+ -+ lock_unlock.res_handle = resource->res_handle; -+ lock_unlock.res_mem = resource->res_base_mem; -+ -+ pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", -+ __func__, lock_unlock.res_handle, lock_unlock.res_mem); -+ -+ /* Lock the videocore allocated resource. -+ */ -+ status = vc_vchi_sm_lock(sm_state->sm_handle, -+ &lock_unlock, &lock_result, 0); -+ if ((status != 0) || -+ ((status == 0) && (lock_result.res_mem == NULL))) { -+ pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", -+ __func__, status); -+ resource->res_stats[LOCK_FAIL]++; -+ return VM_FAULT_SIGBUS; -+ } -+ -+ pfn = vcaddr_to_pfn((unsigned long)resource->res_base_mem); -+ outer_inv_range(__pfn_to_phys(pfn), -+ __pfn_to_phys(pfn) + resource->res_size); -+ -+ resource->res_stats[LOCK]++; -+ resource->lock_count++; -+ -+ /* Keep track of the new base memory. -+ */ -+ if ((lock_result.res_mem != NULL) && -+ (lock_result.res_old_mem != NULL) && -+ (lock_result.res_mem != lock_result.res_old_mem)) { -+ resource->res_base_mem = lock_result.res_mem; -+ } -+ } -+ -+ /* We don't use vmf->pgoff since that has the fake offset */ -+ page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start); -+ pfn = (uint32_t)resource->res_base_mem & 0x3FFFFFFF; -+ pfn += mm_vc_mem_phys_addr; -+ pfn += page_offset; -+ pfn >>= PAGE_SHIFT; -+ -+ /* Finally, remap it */ -+ ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn); -+ -+ switch (ret) { -+ case 0: -+ case -ERESTARTSYS: -+ return VM_FAULT_NOPAGE; -+ case -ENOMEM: -+ case -EAGAIN: -+ return VM_FAULT_OOM; -+ default: -+ return VM_FAULT_SIGBUS; -+ } -+} -+ -+static struct vm_operations_struct vcsm_vm_ops = { -+ .open = vcsm_vma_open, -+ .close = vcsm_vma_close, -+ .fault = vcsm_vma_fault, -+}; -+ -+/* Walks a VMA and clean each valid page from the cache */ -+static void vcsm_vma_cache_clean_page_range(unsigned long addr, -+ unsigned long end) -+{ -+ pgd_t *pgd; -+ pud_t *pud; -+ pmd_t *pmd; -+ pte_t *pte; -+ unsigned long pgd_next, pud_next, pmd_next; -+ -+ if (addr >= end) -+ return; -+ -+ /* Walk PGD */ -+ pgd = pgd_offset(current->mm, addr); -+ do { -+ pgd_next = pgd_addr_end(addr, end); -+ -+ if (pgd_none(*pgd) || pgd_bad(*pgd)) -+ continue; -+ -+ /* Walk PUD */ -+ pud = pud_offset(pgd, addr); -+ do { -+ pud_next = pud_addr_end(addr, pgd_next); -+ if (pud_none(*pud) || pud_bad(*pud)) -+ continue; -+ -+ /* Walk PMD */ -+ pmd = pmd_offset(pud, addr); -+ do { -+ pmd_next = pmd_addr_end(addr, pud_next); -+ if (pmd_none(*pmd) || pmd_bad(*pmd)) -+ continue; -+ -+ /* Walk PTE */ -+ pte = pte_offset_map(pmd, addr); -+ do { -+ if (pte_none(*pte) -+ || !pte_present(*pte)) -+ continue; -+ -+ /* Clean + invalidate */ -+ dmac_flush_range((const void *) addr, -+ (const void *) -+ (addr + PAGE_SIZE)); -+ -+ } while (pte++, addr += -+ PAGE_SIZE, addr != pmd_next); -+ pte_unmap(pte); -+ -+ } while (pmd++, addr = pmd_next, addr != pud_next); -+ -+ } while (pud++, addr = pud_next, addr != pgd_next); -+ } while (pgd++, addr = pgd_next, addr != end); -+} -+ -+/* Map an allocated data into something that the user space. -+*/ -+static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ int ret = 0; -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource = NULL; -+ struct sm_mmap *map = NULL; -+ -+ /* Make sure the device was started properly. -+ */ -+ if ((sm_state == NULL) || (file_data == NULL)) { -+ pr_err("[%s]: invalid device\n", __func__); -+ return -EPERM; -+ } -+ -+ pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, -+ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); -+ -+ /* We lookup to make sure that the data we are being asked to mmap is -+ ** something that we allocated. -+ ** -+ ** We use the offset information as the key to tell us which resource -+ ** we are mapping. -+ */ -+ resource = vmcs_sm_acquire_resource(file_data, -+ ((unsigned int)vma->vm_pgoff << -+ PAGE_SHIFT)); -+ if (resource == NULL) { -+ pr_err("[%s]: failed to locate resource for guid %x\n", __func__, -+ ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); -+ return -ENOMEM; -+ } -+ -+ pr_debug("[%s]: guid %x, tgid %u, %u, %u\n", -+ __func__, resource->res_guid, current->tgid, resource->pid, -+ file_data->pid); -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", -+ __func__, current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ /* Verify that what we are asked to mmap is proper. -+ */ -+ if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { -+ pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", -+ __func__, -+ resource->res_size, -+ (unsigned int)(vma->vm_end - vma->vm_start)); -+ -+ ret = -EINVAL; -+ goto error; -+ } -+ -+ /* Keep track of the tuple in the global resource list such that one -+ * can do a mapping lookup for address/memory handle. -+ */ -+ map = kzalloc(sizeof(*map), GFP_KERNEL); -+ if (map == NULL) { -+ pr_err("[%s]: failed to allocate global tracking resource\n", -+ __func__); -+ ret = -ENOMEM; -+ goto error; -+ } -+ -+ map->res_pid = current->tgid; -+ map->res_vc_hdl = resource->res_handle; -+ map->res_usr_hdl = resource->res_guid; -+ map->res_addr = (long unsigned int)vma->vm_start; -+ map->resource = resource; -+ map->vma = vma; -+ vmcs_sm_add_map(sm_state, resource, map); -+ -+ /* We are not actually mapping the pages, we just provide a fault -+ ** handler to allow pages to be mapped when accessed -+ */ -+ vma->vm_flags |= -+ VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; -+ vma->vm_ops = &vcsm_vm_ops; -+ vma->vm_private_data = map; -+ -+ /* vm_pgoff is the first PFN of the mapped memory */ -+ vma->vm_pgoff = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; -+ vma->vm_pgoff += mm_vc_mem_phys_addr; -+ vma->vm_pgoff >>= PAGE_SHIFT; -+ -+ if ((resource->res_cached == VMCS_SM_CACHE_NONE) || -+ (resource->res_cached == VMCS_SM_CACHE_VC)) { -+ /* Allocated non host cached memory, honour it. -+ */ -+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -+ } -+ -+ pr_debug("[%s]: resource %p (guid %x) - cnt %u, base address %p, handle %x, size %u (%u), cache %u\n", -+ __func__, -+ resource, resource->res_guid, resource->lock_count, -+ resource->res_base_mem, resource->res_handle, -+ resource->res_size, (unsigned int)(vma->vm_end - vma->vm_start), -+ resource->res_cached); -+ -+ pr_debug("[%s]: resource %p (base address %p, handle %x) - map-count %d, usr-addr %x\n", -+ __func__, resource, resource->res_base_mem, -+ resource->res_handle, resource->map_count, -+ (unsigned int)vma->vm_start); -+ -+ vcsm_vma_open(vma); -+ resource->res_stats[MAP]++; -+ vmcs_sm_release_resource(resource, 0); -+ return 0; -+ -+error: -+ resource->res_stats[MAP_FAIL]++; -+ vmcs_sm_release_resource(resource, 0); -+ return ret; -+} -+ -+/* Allocate a shared memory handle and block. -+*/ -+int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_alloc *ioparam) -+{ -+ int ret = 0; -+ int status; -+ struct SM_RESOURCE_T *resource; -+ VC_SM_ALLOC_T alloc = { 0 }; -+ VC_SM_ALLOC_RESULT_T result = { 0 }; -+ -+ /* Setup our allocation parameters */ -+ alloc.type = ((ioparam->cached == VMCS_SM_CACHE_VC) -+ || (ioparam->cached == -+ VMCS_SM_CACHE_BOTH)) ? VC_SM_ALLOC_CACHED : -+ VC_SM_ALLOC_NON_CACHED; -+ alloc.base_unit = ioparam->size; -+ alloc.num_unit = ioparam->num; -+ alloc.allocator = current->tgid; -+ /* Align to kernel page size */ -+ alloc.alignement = 4096; -+ /* Align the size to the kernel page size */ -+ alloc.base_unit = -+ (alloc.base_unit + alloc.alignement - 1) & ~(alloc.alignement - 1); -+ if (*ioparam->name) { -+ memcpy(alloc.name, ioparam->name, sizeof(alloc.name) - 1); -+ } else { -+ memcpy(alloc.name, VMCS_SM_RESOURCE_NAME_DEFAULT, -+ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); -+ } -+ -+ pr_debug("[%s]: attempt to allocate \"%s\" data - type %u, base %u (%u), num %u, alignement %u\n", -+ __func__, alloc.name, alloc.type, ioparam->size, -+ alloc.base_unit, alloc.num_unit, alloc.alignement); -+ -+ /* Allocate local resource to track this allocation. -+ */ -+ resource = kzalloc(sizeof(*resource), GFP_KERNEL); -+ if (!resource) { -+ ret = -ENOMEM; -+ goto error; -+ } -+ INIT_LIST_HEAD(&resource->map_list); -+ resource->ref_count++; -+ resource->pid = current->tgid; -+ -+ /* Allocate the videocore resource. -+ */ -+ status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, -+ &private->int_trans_id); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting allocate memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ ret = -ERESTARTSYS; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_ALLOC; -+ goto error; -+ } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { -+ pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ ret = -ENOMEM; -+ resource->res_stats[ALLOC_FAIL]++; -+ goto error; -+ } -+ -+ /* Keep track of the resource we created. -+ */ -+ resource->private = private; -+ resource->res_handle = result.res_handle; -+ resource->res_base_mem = result.res_mem; -+ resource->res_size = alloc.base_unit * alloc.num_unit; -+ resource->res_cached = ioparam->cached; -+ -+ /* Kernel/user GUID. This global identifier is used for mmap'ing the -+ * allocated region from user space, it is passed as the mmap'ing -+ * offset, we use it to 'hide' the videocore handle/address. -+ */ -+ mutex_lock(&sm_state->lock); -+ resource->res_guid = ++sm_state->guid; -+ mutex_unlock(&sm_state->lock); -+ resource->res_guid <<= PAGE_SHIFT; -+ -+ vmcs_sm_add_resource(private, resource); -+ -+ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem, resource->res_size, -+ resource->res_cached); -+ -+ /* We're done */ -+ resource->res_stats[ALLOC]++; -+ ioparam->handle = resource->res_guid; -+ return 0; -+ -+error: -+ pr_err("[%s]: failed to allocate \"%s\" data (%i) - type %u, base %u (%u), num %u, alignment %u\n", -+ __func__, alloc.name, ret, alloc.type, ioparam->size, -+ alloc.base_unit, alloc.num_unit, alloc.alignement); -+ if (resource != NULL) { -+ vc_sm_resource_deceased(resource, 1); -+ kfree(resource); -+ } -+ return ret; -+} -+ -+/* Share an allocate memory handle and block. -+*/ -+int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_alloc_share *ioparam) -+{ -+ struct SM_RESOURCE_T *resource, *shared_resource; -+ int ret = 0; -+ -+ pr_debug("[%s]: attempt to share resource %u\n", __func__, -+ ioparam->handle); -+ -+ shared_resource = vmcs_sm_acquire_global_resource(ioparam->handle); -+ if (shared_resource == NULL) { -+ ret = -ENOMEM; -+ goto error; -+ } -+ -+ /* Allocate local resource to track this allocation. -+ */ -+ resource = kzalloc(sizeof(*resource), GFP_KERNEL); -+ if (resource == NULL) { -+ pr_err("[%s]: failed to allocate local tracking resource\n", -+ __func__); -+ ret = -ENOMEM; -+ goto error; -+ } -+ INIT_LIST_HEAD(&resource->map_list); -+ resource->ref_count++; -+ resource->pid = current->tgid; -+ -+ /* Keep track of the resource we created. -+ */ -+ resource->private = private; -+ resource->res_handle = shared_resource->res_handle; -+ resource->res_base_mem = shared_resource->res_base_mem; -+ resource->res_size = shared_resource->res_size; -+ resource->res_cached = shared_resource->res_cached; -+ resource->res_shared = shared_resource; -+ -+ mutex_lock(&sm_state->lock); -+ resource->res_guid = ++sm_state->guid; -+ mutex_unlock(&sm_state->lock); -+ resource->res_guid <<= PAGE_SHIFT; -+ -+ vmcs_sm_add_resource(private, resource); -+ -+ pr_debug("[%s]: allocated data - guid %x, hdl %x, base address %p, size %d, cache %d\n", -+ __func__, resource->res_guid, resource->res_handle, -+ resource->res_base_mem, resource->res_size, -+ resource->res_cached); -+ -+ /* We're done */ -+ resource->res_stats[ALLOC]++; -+ ioparam->handle = resource->res_guid; -+ ioparam->size = resource->res_size; -+ return 0; -+ -+error: -+ pr_err("[%s]: failed to share %u\n", __func__, ioparam->handle); -+ if (shared_resource != NULL) -+ vmcs_sm_release_resource(shared_resource, 0); -+ -+ return ret; -+} -+ -+/* Free a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_free *ioparam) -+{ -+ struct SM_RESOURCE_T *resource = -+ vmcs_sm_acquire_resource(private, ioparam->handle); -+ -+ if (resource == NULL) { -+ pr_err("[%s]: resource for guid %u does not exist\n", __func__, -+ ioparam->handle); -+ return -EINVAL; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", -+ __func__, current->tgid, resource->pid); -+ vmcs_sm_release_resource(resource, 0); -+ return -EPERM; -+ } -+ -+ vmcs_sm_release_resource(resource, 0); -+ vmcs_sm_release_resource(resource, 0); -+ return 0; -+} -+ -+/* Resize a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_resize *ioparam) -+{ -+ int ret = 0; -+ int status; -+ VC_SM_RESIZE_T resize; -+ struct SM_RESOURCE_T *resource; -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(private, ioparam->handle); -+ if (!resource) { -+ pr_err("[%s]: failed resource - guid %x\n", -+ __func__, ioparam->handle); -+ ret = -EFAULT; -+ goto error; -+ } -+ -+ /* If the resource is locked, its reference count will be not NULL, -+ ** in which case we will not be allowed to resize it anyways, so -+ ** reject the attempt here. -+ */ -+ if (resource->lock_count != 0) { -+ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", -+ __func__, ioparam->handle, resource->lock_count); -+ ret = -EFAULT; -+ goto error; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", __func__, -+ current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ if (resource->map_count != 0) { -+ pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", -+ __func__, ioparam->handle, resource->map_count); -+ ret = -EFAULT; -+ goto error; -+ } -+ -+ resize.res_handle = resource->res_handle; -+ resize.res_mem = resource->res_base_mem; -+ resize.res_new_size = ioparam->new_size; -+ -+ pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", -+ __func__, ioparam->handle, resize.res_handle, resize.res_mem); -+ -+ /* Resize the videocore allocated resource. -+ */ -+ status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, -+ &private->int_trans_id); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting resize memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ ret = -ERESTARTSYS; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_RESIZE; -+ goto error; -+ } else if (status != 0) { -+ pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ pr_debug("[%s]: success to resize data - hdl %x, size %d -> %d\n", -+ __func__, resize.res_handle, resource->res_size, -+ resize.res_new_size); -+ -+ /* Successfully resized, save the information and inform the user. -+ */ -+ ioparam->old_size = resource->res_size; -+ resource->res_size = resize.res_new_size; -+ -+error: -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ return ret; -+} -+ -+/* Lock a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_lock_unlock *ioparam, -+ int change_cache, enum vmcs_sm_cache_e cache_type, -+ unsigned int vc_addr) -+{ -+ int status; -+ VC_SM_LOCK_UNLOCK_T lock; -+ VC_SM_LOCK_RESULT_T result; -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ struct sm_mmap *map, *map_tmp; -+ long unsigned int phys_addr; -+ -+ map = NULL; -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(private, ioparam->handle); -+ if (resource == NULL) { -+ ret = -EINVAL; -+ goto error; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", __func__, -+ current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ lock.res_handle = resource->res_handle; -+ lock.res_mem = resource->res_base_mem; -+ -+ /* Take the lock and get the address to be mapped. -+ */ -+ if (vc_addr == 0) { -+ pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", -+ __func__, ioparam->handle, lock.res_handle, -+ lock.res_mem); -+ -+ /* Lock the videocore allocated resource. -+ */ -+ status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, -+ &private->int_trans_id); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting lock memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ ret = -ERESTARTSYS; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_LOCK; -+ goto error; -+ } else if (status != 0 || -+ (status == 0 && result.res_mem == NULL)) { -+ pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ ret = -EPERM; -+ resource->res_stats[LOCK_FAIL]++; -+ goto error; -+ } -+ -+ pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", -+ __func__, lock.res_handle, result.res_mem, -+ lock.res_mem, resource->lock_count); -+ } -+ /* Lock assumed taken already, address to be mapped is known. -+ */ -+ else -+ resource->res_base_mem = (void *)vc_addr; -+ -+ resource->res_stats[LOCK]++; -+ resource->lock_count++; -+ -+ /* Keep track of the new base memory allocation if it has changed. -+ */ -+ if ((vc_addr == 0) && -+ (result.res_mem != NULL) && -+ (result.res_old_mem != NULL) && -+ (result.res_mem != result.res_old_mem)) { -+ resource->res_base_mem = result.res_mem; -+ -+ /* Kernel allocated resources. -+ */ -+ if (resource->pid == 0) { -+ if (!list_empty(&resource->map_list)) { -+ list_for_each_entry_safe(map, map_tmp, -+ &resource->map_list, -+ resource_map_list) { -+ if (map->res_addr) { -+ iounmap((void *)map->res_addr); -+ map->res_addr = 0; -+ -+ vmcs_sm_remove_map(sm_state, -+ map->resource, -+ map); -+ break; -+ } -+ } -+ } -+ } -+ } -+ -+ if (change_cache) -+ resource->res_cached = cache_type; -+ -+ if (resource->map_count) { -+ ioparam->addr = -+ vmcs_sm_usr_address_from_pid_and_usr_handle( -+ current->tgid, ioparam->handle); -+ -+ pr_debug("[%s] map_count %d private->pid %d current->tgid %d hnd %x addr %u\n", -+ __func__, resource->map_count, private->pid, -+ current->tgid, ioparam->handle, ioparam->addr); -+ } else { -+ /* Kernel allocated resources. -+ */ -+ if (resource->pid == 0) { -+ pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", -+ __func__, ioparam->handle, lock.res_handle); -+ -+ ioparam->addr = 0; -+ -+ map = kzalloc(sizeof(*map), GFP_KERNEL); -+ if (map == NULL) { -+ pr_err("[%s]: failed allocating tracker\n", -+ __func__); -+ ret = -ENOMEM; -+ goto error; -+ } else { -+ phys_addr = (uint32_t)resource->res_base_mem & -+ 0x3FFFFFFF; -+ phys_addr += mm_vc_mem_phys_addr; -+ if (resource->res_cached -+ == VMCS_SM_CACHE_HOST) { -+ ioparam->addr = (long unsigned int) -+ /* TODO - make cached work */ -+ ioremap_nocache(phys_addr, -+ resource->res_size); -+ -+ pr_debug("[%s]: mapping kernel - guid %x, hdl %x - cached mapping %u\n", -+ __func__, ioparam->handle, -+ lock.res_handle, ioparam->addr); -+ } else { -+ ioparam->addr = (long unsigned int) -+ ioremap_nocache(phys_addr, -+ resource->res_size); -+ -+ pr_debug("[%s]: mapping kernel- guid %x, hdl %x - non cached mapping %u\n", -+ __func__, ioparam->handle, -+ lock.res_handle, ioparam->addr); -+ } -+ -+ map->res_pid = 0; -+ map->res_vc_hdl = resource->res_handle; -+ map->res_usr_hdl = resource->res_guid; -+ map->res_addr = ioparam->addr; -+ map->resource = resource; -+ map->vma = NULL; -+ -+ vmcs_sm_add_map(sm_state, resource, map); -+ } -+ } else -+ ioparam->addr = 0; -+ } -+ -+error: -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ return ret; -+} -+ -+/* Unlock a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, -+ struct vmcs_sm_ioctl_lock_unlock *ioparam, -+ int flush, int wait_reply, int no_vc_unlock) -+{ -+ int status; -+ VC_SM_LOCK_UNLOCK_T unlock; -+ struct sm_mmap *map, *map_tmp; -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ -+ map = NULL; -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(private, ioparam->handle); -+ if (resource == NULL) { -+ ret = -EINVAL; -+ goto error; -+ } -+ -+ /* Check permissions. -+ */ -+ if (resource->pid && (resource->pid != current->tgid)) { -+ pr_err("[%s]: current tgid %u != %u owner\n", -+ __func__, current->tgid, resource->pid); -+ ret = -EPERM; -+ goto error; -+ } -+ -+ unlock.res_handle = resource->res_handle; -+ unlock.res_mem = resource->res_base_mem; -+ -+ pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", -+ __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); -+ -+ /* User space allocated resources. -+ */ -+ if (resource->pid) { -+ /* Flush if requested */ -+ if (resource->res_cached && flush) { -+ dma_addr_t phys_addr = 0; -+ resource->res_stats[FLUSH]++; -+ -+ phys_addr = -+ (dma_addr_t)((uint32_t)resource->res_base_mem & -+ 0x3FFFFFFF); -+ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; -+ -+ /* L1 cache flush */ -+ down_read(¤t->mm->mmap_sem); -+ list_for_each_entry(map, &resource->map_list, -+ resource_map_list) { -+ if (map->vma) { -+ unsigned long start; -+ unsigned long end; -+ start = map->vma->vm_start; -+ end = map->vma->vm_end; -+ -+ vcsm_vma_cache_clean_page_range( -+ start, end); -+ } -+ } -+ up_read(¤t->mm->mmap_sem); -+ -+ /* L2 cache flush */ -+ outer_clean_range(phys_addr, -+ phys_addr + -+ (size_t) resource->res_size); -+ } -+ -+ /* We need to zap all the vmas associated with this resource */ -+ if (resource->lock_count == 1) { -+ down_read(¤t->mm->mmap_sem); -+ list_for_each_entry(map, &resource->map_list, -+ resource_map_list) { -+ if (map->vma) { -+ zap_vma_ptes(map->vma, -+ map->vma->vm_start, -+ map->vma->vm_end - -+ map->vma->vm_start); -+ } -+ } -+ up_read(¤t->mm->mmap_sem); -+ } -+ } -+ /* Kernel allocated resources. */ -+ else { -+ /* Global + Taken in this context */ -+ if (resource->ref_count == 2) { -+ if (!list_empty(&resource->map_list)) { -+ list_for_each_entry_safe(map, map_tmp, -+ &resource->map_list, -+ resource_map_list) { -+ if (map->res_addr) { -+ if (flush && -+ (resource->res_cached == -+ VMCS_SM_CACHE_HOST)) { -+ long unsigned int -+ phys_addr; -+ phys_addr = (uint32_t) -+ resource->res_base_mem & 0x3FFFFFFF; -+ phys_addr += -+ mm_vc_mem_phys_addr; -+ -+ /* L1 cache flush */ -+ dmac_flush_range((const -+ void -+ *) -+ map->res_addr, (const void *) -+ (map->res_addr + resource->res_size)); -+ -+ /* L2 cache flush */ -+ outer_clean_range -+ (phys_addr, -+ phys_addr + -+ (size_t) -+ resource->res_size); -+ } -+ -+ iounmap((void *)map->res_addr); -+ map->res_addr = 0; -+ -+ vmcs_sm_remove_map(sm_state, -+ map->resource, -+ map); -+ break; -+ } -+ } -+ } -+ } -+ } -+ -+ if (resource->lock_count) { -+ /* Bypass the videocore unlock. -+ */ -+ if (no_vc_unlock) -+ status = 0; -+ /* Unlock the videocore allocated resource. -+ */ -+ else { -+ status = -+ vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, -+ &private->int_trans_id, -+ wait_reply); -+ if (status == -EINTR) { -+ pr_debug("[%s]: requesting unlock memory action restart (trans_id: %u)\n", -+ __func__, private->int_trans_id); -+ -+ ret = -ERESTARTSYS; -+ resource->res_stats[UNLOCK]--; -+ private->restart_sys = -EINTR; -+ private->int_action = VC_SM_MSG_TYPE_UNLOCK; -+ goto error; -+ } else if (status != 0) { -+ pr_err("[%s]: failed to unlock vc mem (status: %u, trans_id: %u)\n", -+ __func__, status, private->int_trans_id); -+ -+ ret = -EPERM; -+ resource->res_stats[UNLOCK_FAIL]++; -+ goto error; -+ } -+ } -+ -+ resource->res_stats[UNLOCK]++; -+ resource->lock_count--; -+ } -+ -+ pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", -+ __func__, unlock.res_handle, unlock.res_mem, -+ resource->lock_count); -+ -+error: -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ return ret; -+} -+ -+/* Handle control from host. */ -+static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int ret = 0; -+ unsigned int cmdnr = _IOC_NR(cmd); -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource = NULL; -+ -+ /* Validate we can work with this device. */ -+ if ((sm_state == NULL) || (file_data == NULL)) { -+ pr_err("[%s]: invalid device\n", __func__); -+ ret = -EPERM; -+ goto out; -+ } -+ -+ pr_debug("[%s]: cmd %x tgid %u, owner %u\n", __func__, cmdnr, -+ current->tgid, file_data->pid); -+ -+ /* Action is a re-post of a previously interrupted action? */ -+ if (file_data->restart_sys == -EINTR) { -+ VC_SM_ACTION_CLEAN_T action_clean; -+ -+ pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", -+ __func__, file_data->int_action, -+ file_data->int_trans_id); -+ -+ action_clean.res_action = file_data->int_action; -+ action_clean.action_trans_id = file_data->int_trans_id; -+ -+ vc_vchi_sm_clean_up(sm_state->sm_handle, &action_clean); -+ -+ file_data->restart_sys = 0; -+ } -+ -+ /* Now process the command. -+ */ -+ switch (cmdnr) { -+ /* New memory allocation. -+ */ -+ case VMCS_SM_CMD_ALLOC: -+ { -+ struct vmcs_sm_ioctl_alloc ioparam; -+ -+ /* Get the parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_alloc(file_data, &ioparam); -+ if (!ret && -+ (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0)) { -+ struct vmcs_sm_ioctl_free freeparam = { -+ ioparam.handle -+ }; -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ vc_sm_ioctl_free(file_data, &freeparam); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Share existing memory allocation. -+ */ -+ case VMCS_SM_CMD_ALLOC_SHARE: -+ { -+ struct vmcs_sm_ioctl_alloc_share ioparam; -+ -+ /* Get the parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); -+ -+ /* Copy result back to user. -+ */ -+ if (!ret -+ && copy_to_user((void *)arg, &ioparam, -+ sizeof(ioparam)) != 0) { -+ struct vmcs_sm_ioctl_free freeparam = { -+ ioparam.handle -+ }; -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ vc_sm_ioctl_free(file_data, &freeparam); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Lock (attempt to) *and* register a cache behavior change. -+ */ -+ case VMCS_SM_CMD_LOCK_CACHE: -+ { -+ struct vmcs_sm_ioctl_lock_cache ioparam; -+ struct vmcs_sm_ioctl_lock_unlock lock; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ lock.handle = ioparam.handle; -+ ret = -+ vc_sm_ioctl_lock(file_data, &lock, 1, -+ ioparam.cached, 0); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Lock (attempt to) existing memory allocation. -+ */ -+ case VMCS_SM_CMD_LOCK: -+ { -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); -+ -+ /* Copy result back to user. -+ */ -+ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) -+ != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Unlock (attempt to) existing memory allocation. -+ */ -+ case VMCS_SM_CMD_UNLOCK: -+ { -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Resize (attempt to) existing memory allocation. -+ */ -+ case VMCS_SM_CMD_RESIZE: -+ { -+ struct vmcs_sm_ioctl_resize ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_resize(file_data, &ioparam); -+ -+ /* Copy result back to user. -+ */ -+ if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) -+ != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Terminate existing memory allocation. -+ */ -+ case VMCS_SM_CMD_FREE: -+ { -+ struct vmcs_sm_ioctl_free ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = vc_sm_ioctl_free(file_data, &ioparam); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Walk allocation on videocore, information shows up in the -+ ** videocore log. -+ */ -+ case VMCS_SM_CMD_VC_WALK_ALLOC: -+ { -+ pr_debug("[%s]: invoking walk alloc\n", __func__); -+ -+ if (vc_vchi_sm_walk_alloc(sm_state->sm_handle) != 0) -+ pr_err("[%s]: failed to walk-alloc on videocore\n", -+ __func__); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+/* Walk mapping table on host, information shows up in the -+ ** kernel log. -+ */ -+ case VMCS_SM_CMD_HOST_WALK_MAP: -+ { -+ /* Use pid of -1 to tell to walk the whole map. */ -+ vmcs_sm_host_walk_map_per_pid(-1); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Walk mapping table per process on host. */ -+ case VMCS_SM_CMD_HOST_WALK_PID_ALLOC: -+ { -+ struct vmcs_sm_ioctl_walk ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ vmcs_sm_host_walk_alloc(file_data); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Walk allocation per process on host. */ -+ case VMCS_SM_CMD_HOST_WALK_PID_MAP: -+ { -+ struct vmcs_sm_ioctl_walk ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ vmcs_sm_host_walk_map_per_pid(ioparam.pid); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Gets the size of the memory associated with a user handle. */ -+ case VMCS_SM_CMD_SIZE_USR_HANDLE: -+ { -+ struct vmcs_sm_ioctl_size ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource != NULL) { -+ ioparam.size = resource->res_size; -+ vmcs_sm_release_resource(resource, 0); -+ } else { -+ ioparam.size = 0; -+ } -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Verify we are dealing with a valid resource. */ -+ case VMCS_SM_CMD_CHK_USR_HANDLE: -+ { -+ struct vmcs_sm_ioctl_chk ioparam; -+ -+ /* Get parameter data. -+ */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource == NULL) -+ ret = -EINVAL; -+ /* If the resource is cacheable, return additional -+ * information that may be needed to flush the cache. -+ */ -+ else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || -+ (resource->res_cached == VMCS_SM_CACHE_BOTH)) { -+ ioparam.addr = -+ vmcs_sm_usr_address_from_pid_and_usr_handle -+ (current->tgid, ioparam.handle); -+ ioparam.size = resource->res_size; -+ ioparam.cache = resource->res_cached; -+ } else { -+ ioparam.addr = 0; -+ ioparam.size = 0; -+ ioparam.cache = resource->res_cached; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* -+ * Maps a user handle given the process and the virtual address. -+ */ -+ case VMCS_SM_CMD_MAPPED_USR_HANDLE: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ioparam.handle = -+ vmcs_sm_usr_handle_from_pid_and_address( -+ ioparam.pid, ioparam.addr); -+ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if ((resource != NULL) -+ && ((resource->res_cached == VMCS_SM_CACHE_HOST) -+ || (resource->res_cached == -+ VMCS_SM_CACHE_BOTH))) { -+ ioparam.size = resource->res_size; -+ } else { -+ ioparam.size = 0; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* -+ * Maps a videocore handle given process and virtual address. -+ */ -+ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ioparam.handle = vmcs_sm_vc_handle_from_pid_and_address( -+ ioparam.pid, ioparam.addr); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ } -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Maps a videocore handle given process and user handle. */ -+ case VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource != NULL) { -+ ioparam.handle = resource->res_handle; -+ vmcs_sm_release_resource(resource, 0); -+ } else { -+ ioparam.handle = 0; -+ } -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* -+ * Maps a videocore address given process and videocore handle. -+ */ -+ case VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ if (resource != NULL) { -+ ioparam.addr = -+ (unsigned int)resource->res_base_mem; -+ vmcs_sm_release_resource(resource, 0); -+ } else { -+ ioparam.addr = 0; -+ } -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Maps a user address given process and vc handle. -+ */ -+ case VMCS_SM_CMD_MAPPED_USR_ADDRESS: -+ { -+ struct vmcs_sm_ioctl_map ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* -+ * Return the address information from the mapping, -+ * 0 (ie NULL) if it cannot locate the actual mapping. -+ */ -+ ioparam.addr = -+ vmcs_sm_usr_address_from_pid_and_usr_handle -+ (ioparam.pid, ioparam.handle); -+ -+ if (copy_to_user((void *)arg, -+ &ioparam, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-to-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ } -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Flush the cache for a given mapping. */ -+ case VMCS_SM_CMD_FLUSH: -+ { -+ struct vmcs_sm_ioctl_cache ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ -+ if ((resource != NULL) && resource->res_cached) { -+ dma_addr_t phys_addr = 0; -+ -+ resource->res_stats[FLUSH]++; -+ -+ phys_addr = -+ (dma_addr_t)((uint32_t) -+ resource->res_base_mem & -+ 0x3FFFFFFF); -+ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; -+ -+ /* L1 cache flush */ -+ down_read(¤t->mm->mmap_sem); -+ vcsm_vma_cache_clean_page_range((unsigned long) -+ ioparam.addr, -+ (unsigned long) -+ ioparam.addr + -+ ioparam.size); -+ up_read(¤t->mm->mmap_sem); -+ -+ /* L2 cache flush */ -+ outer_clean_range(phys_addr, -+ phys_addr + -+ (size_t) ioparam.size); -+ } else if (resource == NULL) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ /* Done. */ -+ goto out; -+ } -+ break; -+ -+ /* Invalidate the cache for a given mapping. */ -+ case VMCS_SM_CMD_INVALID: -+ { -+ struct vmcs_sm_ioctl_cache ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ /* Locate resource from GUID. -+ */ -+ resource = -+ vmcs_sm_acquire_resource(file_data, ioparam.handle); -+ -+ if ((resource != NULL) && resource->res_cached) { -+ dma_addr_t phys_addr = 0; -+ -+ resource->res_stats[INVALID]++; -+ -+ phys_addr = -+ (dma_addr_t)((uint32_t) -+ resource->res_base_mem & -+ 0x3FFFFFFF); -+ phys_addr += (dma_addr_t)mm_vc_mem_phys_addr; -+ -+ /* L2 cache invalidate */ -+ outer_inv_range(phys_addr, -+ phys_addr + -+ (size_t) ioparam.size); -+ -+ /* L1 cache invalidate */ -+ down_read(¤t->mm->mmap_sem); -+ vcsm_vma_cache_clean_page_range((unsigned long) -+ ioparam.addr, -+ (unsigned long) -+ ioparam.addr + -+ ioparam.size); -+ up_read(¤t->mm->mmap_sem); -+ } else if (resource == NULL) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ -+ /* Done. -+ */ -+ goto out; -+ } -+ break; -+ -+ /* Flush/Invalidate the cache for a given mapping. */ -+ case VMCS_SM_CMD_CLEAN_INVALID: -+ { -+ int i; -+ struct vmcs_sm_ioctl_clean_invalid ioparam; -+ -+ /* Get parameter data. */ -+ if (copy_from_user(&ioparam, -+ (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user for cmd %x\n", -+ __func__, cmdnr); -+ ret = -EFAULT; -+ goto out; -+ } -+ for (i=0; ires_cached) { -+ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); -+ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); -+ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; -+ -+ /* L1/L2 cache flush */ -+ down_read(¤t->mm->mmap_sem); -+ vcsm_vma_cache_clean_page_range(base, end); -+ up_read(¤t->mm->mmap_sem); -+ } else if (resource == NULL) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); -+ } -+ break; -+ } -+ } -+ } -+ break; -+ -+ default: -+ { -+ ret = -EINVAL; -+ goto out; -+ } -+ break; -+ } -+ -+out: -+ return ret; -+} -+ -+/* Device operations that we managed in this driver. -+*/ -+static const struct file_operations vmcs_sm_ops = { -+ .owner = THIS_MODULE, -+ .unlocked_ioctl = vc_sm_ioctl, -+ .open = vc_sm_open, -+ .release = vc_sm_release, -+ .mmap = vc_sm_mmap, -+}; -+ -+/* Creation of device. -+*/ -+static int vc_sm_create_sharedmemory(void) -+{ -+ int ret; -+ -+ if (sm_state == NULL) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ /* Create a device class for creating dev nodes. -+ */ -+ sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); -+ if (IS_ERR(sm_state->sm_class)) { -+ pr_err("[%s]: unable to create device class\n", __func__); -+ ret = PTR_ERR(sm_state->sm_class); -+ goto out; -+ } -+ -+ /* Create a character driver. -+ */ -+ ret = alloc_chrdev_region(&sm_state->sm_devid, -+ DEVICE_MINOR, 1, DEVICE_NAME); -+ if (ret != 0) { -+ pr_err("[%s]: unable to allocate device number\n", __func__); -+ goto out_dev_class_destroy; -+ } -+ -+ cdev_init(&sm_state->sm_cdev, &vmcs_sm_ops); -+ ret = cdev_add(&sm_state->sm_cdev, sm_state->sm_devid, 1); -+ if (ret != 0) { -+ pr_err("[%s]: unable to register device\n", __func__); -+ goto out_chrdev_unreg; -+ } -+ -+ /* Create a device node. -+ */ -+ sm_state->sm_dev = device_create(sm_state->sm_class, -+ NULL, -+ MKDEV(MAJOR(sm_state->sm_devid), -+ DEVICE_MINOR), NULL, -+ DEVICE_NAME); -+ if (IS_ERR(sm_state->sm_dev)) { -+ pr_err("[%s]: unable to create device node\n", __func__); -+ ret = PTR_ERR(sm_state->sm_dev); -+ goto out_chrdev_del; -+ } -+ -+ goto out; -+ -+out_chrdev_del: -+ cdev_del(&sm_state->sm_cdev); -+out_chrdev_unreg: -+ unregister_chrdev_region(sm_state->sm_devid, 1); -+out_dev_class_destroy: -+ class_destroy(sm_state->sm_class); -+ sm_state->sm_class = NULL; -+out: -+ return ret; -+} -+ -+/* Termination of the device. -+*/ -+static int vc_sm_remove_sharedmemory(void) -+{ -+ int ret; -+ -+ if (sm_state == NULL) { -+ /* Nothing to do. -+ */ -+ ret = 0; -+ goto out; -+ } -+ -+ /* Remove the sharedmemory character driver. -+ */ -+ cdev_del(&sm_state->sm_cdev); -+ -+ /* Unregister region. -+ */ -+ unregister_chrdev_region(sm_state->sm_devid, 1); -+ -+ ret = 0; -+ goto out; -+ -+out: -+ return ret; -+} -+ -+/* Videocore connected. */ -+static void vc_sm_connected_init(void) -+{ -+ int ret; -+ VCHI_INSTANCE_T vchi_instance; -+ VCHI_CONNECTION_T *vchi_connection = NULL; -+ -+ pr_info("[%s]: start\n", __func__); -+ -+ /* Allocate memory for the state structure. -+ */ -+ sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); -+ if (sm_state == NULL) { -+ pr_err("[%s]: failed to allocate memory\n", __func__); -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ mutex_init(&sm_state->lock); -+ mutex_init(&sm_state->map_lock); -+ -+ /* Initialize and create a VCHI connection for the shared memory service -+ ** running on videocore. -+ */ -+ ret = vchi_initialise(&vchi_instance); -+ if (ret != 0) { -+ pr_err("[%s]: failed to initialise VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ -+ ret = vchi_connect(NULL, 0, vchi_instance); -+ if (ret != 0) { -+ pr_err("[%s]: failed to connect VCHI instance (ret=%d)\n", -+ __func__, ret); -+ -+ ret = -EIO; -+ goto err_free_mem; -+ } -+ -+ /* Initialize an instance of the shared memory service. */ -+ sm_state->sm_handle = -+ vc_vchi_sm_init(vchi_instance, &vchi_connection, 1); -+ if (sm_state->sm_handle == NULL) { -+ pr_err("[%s]: failed to initialize shared memory service\n", -+ __func__); -+ -+ ret = -EPERM; -+ goto err_free_mem; -+ } -+ -+ /* Create a debug fs directory entry (root). */ -+ sm_state->dir_root = debugfs_create_dir(VC_SM_DIR_ROOT_NAME, NULL); -+ if (!sm_state->dir_root) { -+ pr_err("[%s]: failed to create \'%s\' directory entry\n", -+ __func__, VC_SM_DIR_ROOT_NAME); -+ -+ ret = -EPERM; -+ goto err_stop_sm_service; -+ } -+ -+ sm_state->dir_state.show = &vc_sm_global_state_show; -+ sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, -+ S_IRUGO, sm_state->dir_root, &sm_state->dir_state, -+ &vc_sm_debug_fs_fops); -+ -+ sm_state->dir_stats.show = &vc_sm_global_statistics_show; -+ sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, -+ S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, -+ &vc_sm_debug_fs_fops); -+ -+ /* Create the proc entry children. */ -+ sm_state->dir_alloc = debugfs_create_dir(VC_SM_DIR_ALLOC_NAME, -+ sm_state->dir_root); -+ -+ /* Create a shared memory device. */ -+ ret = vc_sm_create_sharedmemory(); -+ if (ret != 0) { -+ pr_err("[%s]: failed to create shared memory device\n", -+ __func__); -+ goto err_remove_debugfs; -+ } -+ -+ INIT_LIST_HEAD(&sm_state->map_list); -+ INIT_LIST_HEAD(&sm_state->resource_list); -+ -+ sm_state->data_knl = vc_sm_create_priv_data(0); -+ if (sm_state->data_knl == NULL) { -+ pr_err("[%s]: failed to create kernel private data tracker\n", -+ __func__); -+ goto err_remove_shared_memory; -+ } -+ -+ /* Done! -+ */ -+ sm_inited = 1; -+ goto out; -+ -+err_remove_shared_memory: -+ vc_sm_remove_sharedmemory(); -+err_remove_debugfs: -+ debugfs_remove_recursive(sm_state->dir_root); -+err_stop_sm_service: -+ vc_vchi_sm_stop(&sm_state->sm_handle); -+err_free_mem: -+ kfree(sm_state); -+out: -+ pr_info("[%s]: end - returning %d\n", __func__, ret); -+} -+ -+/* Driver loading. */ -+static int __init vc_sm_init(void) -+{ -+ pr_info("vc-sm: Videocore shared memory driver\n"); -+ vchiq_add_connected_callback(vc_sm_connected_init); -+ return 0; -+} -+ -+/* Driver unloading. */ -+static void __exit vc_sm_exit(void) -+{ -+ pr_debug("[%s]: start\n", __func__); -+ if (sm_inited) { -+ /* Remove shared memory device. -+ */ -+ vc_sm_remove_sharedmemory(); -+ -+ /* Remove all proc entries. -+ */ -+ debugfs_remove_recursive(sm_state->dir_root); -+ -+ /* Stop the videocore shared memory service. -+ */ -+ vc_vchi_sm_stop(&sm_state->sm_handle); -+ -+ /* Free the memory for the state structure. -+ */ -+ mutex_destroy(&(sm_state->map_lock)); -+ kfree(sm_state); -+ } -+ -+ pr_debug("[%s]: end\n", __func__); -+} -+ -+#if defined(__KERNEL__) -+/* Allocate a shared memory handle and block. */ -+int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) -+{ -+ struct vmcs_sm_ioctl_alloc ioparam = { 0 }; -+ int ret; -+ struct SM_RESOURCE_T *resource; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || alloc == NULL || handle == NULL) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ ioparam.size = alloc->base_unit; -+ ioparam.num = alloc->num_unit; -+ ioparam.cached = -+ alloc->type == VC_SM_ALLOC_CACHED ? VMCS_SM_CACHE_VC : 0; -+ -+ ret = vc_sm_ioctl_alloc(sm_state->data_knl, &ioparam); -+ -+ if (ret == 0) { -+ resource = -+ vmcs_sm_acquire_resource(sm_state->data_knl, -+ ioparam.handle); -+ if (resource) { -+ resource->pid = 0; -+ vmcs_sm_release_resource(resource, 0); -+ -+ /* Assign valid handle at this time. -+ */ -+ *handle = ioparam.handle; -+ } else { -+ ret = -ENOMEM; -+ } -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_alloc); -+ -+/* Get an internal resource handle mapped from the external one. -+*/ -+int vc_sm_int_handle(int handle) -+{ -+ struct SM_RESOURCE_T *resource; -+ int ret = 0; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return 0; -+ } -+ -+ /* Locate resource from GUID. -+ */ -+ resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); -+ if (resource) { -+ ret = resource->res_handle; -+ vmcs_sm_release_resource(resource, 0); -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_int_handle); -+ -+/* Free a previously allocated shared memory handle and block. -+*/ -+int vc_sm_free(int handle) -+{ -+ struct vmcs_sm_ioctl_free ioparam = { handle }; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ return vc_sm_ioctl_free(sm_state->data_knl, &ioparam); -+} -+EXPORT_SYMBOL_GPL(vc_sm_free); -+ -+/* Lock a memory handle for use by kernel. -+*/ -+int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data) -+{ -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ int ret; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0 || data == NULL) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ *data = 0; -+ -+ ioparam.handle = handle; -+ ret = vc_sm_ioctl_lock(sm_state->data_knl, -+ &ioparam, -+ 1, -+ ((mode == -+ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : -+ VMCS_SM_CACHE_NONE), 0); -+ -+ *data = ioparam.addr; -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_lock); -+ -+/* Unlock a memory handle in use by kernel. -+*/ -+int vc_sm_unlock(int handle, int flush, int no_vc_unlock) -+{ -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ ioparam.handle = handle; -+ return vc_sm_ioctl_unlock(sm_state->data_knl, -+ &ioparam, flush, 0, no_vc_unlock); -+} -+EXPORT_SYMBOL_GPL(vc_sm_unlock); -+ -+/* Map a shared memory region for use by kernel. -+*/ -+int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data) -+{ -+ struct vmcs_sm_ioctl_lock_unlock ioparam; -+ int ret; -+ -+ /* Validate we can work with this device. -+ */ -+ if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { -+ pr_err("[%s]: invalid input\n", __func__); -+ return -EPERM; -+ } -+ -+ *data = 0; -+ -+ ioparam.handle = handle; -+ ret = vc_sm_ioctl_lock(sm_state->data_knl, -+ &ioparam, -+ 1, -+ ((mode == -+ VC_SM_LOCK_CACHED) ? VMCS_SM_CACHE_HOST : -+ VMCS_SM_CACHE_NONE), sm_addr); -+ -+ *data = ioparam.addr; -+ return ret; -+} -+EXPORT_SYMBOL_GPL(vc_sm_map); -+#endif -+ -+late_initcall(vc_sm_init); -+module_exit(vc_sm_exit); -+ -+MODULE_AUTHOR("Broadcom"); -+MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); -+MODULE_LICENSE("GPL v2"); -diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h -new file mode 100644 -index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f38cf76564 ---- /dev/null -+++ b/include/linux/broadcom/vmcs_sm_ioctl.h -@@ -0,0 +1,248 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+* -+*****************************************************************************/ -+ -+#if !defined(__VMCS_SM_IOCTL_H__INCLUDED__) -+#define __VMCS_SM_IOCTL_H__INCLUDED__ -+ -+/* ---- Include Files ---------------------------------------------------- */ -+ -+#if defined(__KERNEL__) -+#include /* Needed for standard types */ -+#else -+#include -+#endif -+ -+#include -+ -+/* ---- Constants and Types ---------------------------------------------- */ -+ -+#define VMCS_SM_RESOURCE_NAME 32 -+#define VMCS_SM_RESOURCE_NAME_DEFAULT "sm-host-resource" -+ -+/* Type define used to create unique IOCTL number */ -+#define VMCS_SM_MAGIC_TYPE 'I' -+ -+/* IOCTL commands */ -+enum vmcs_sm_cmd_e { -+ VMCS_SM_CMD_ALLOC = 0x5A, /* Start at 0x5A arbitrarily */ -+ VMCS_SM_CMD_ALLOC_SHARE, -+ VMCS_SM_CMD_LOCK, -+ VMCS_SM_CMD_LOCK_CACHE, -+ VMCS_SM_CMD_UNLOCK, -+ VMCS_SM_CMD_RESIZE, -+ VMCS_SM_CMD_UNMAP, -+ VMCS_SM_CMD_FREE, -+ VMCS_SM_CMD_FLUSH, -+ VMCS_SM_CMD_INVALID, -+ -+ VMCS_SM_CMD_SIZE_USR_HANDLE, -+ VMCS_SM_CMD_CHK_USR_HANDLE, -+ -+ VMCS_SM_CMD_MAPPED_USR_HANDLE, -+ VMCS_SM_CMD_MAPPED_USR_ADDRESS, -+ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR, -+ VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL, -+ VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL, -+ -+ VMCS_SM_CMD_VC_WALK_ALLOC, -+ VMCS_SM_CMD_HOST_WALK_MAP, -+ VMCS_SM_CMD_HOST_WALK_PID_ALLOC, -+ VMCS_SM_CMD_HOST_WALK_PID_MAP, -+ -+ VMCS_SM_CMD_CLEAN_INVALID, -+ -+ VMCS_SM_CMD_LAST /* Do no delete */ -+}; -+ -+/* Cache type supported, conveniently matches the user space definition in -+** user-vcsm.h. -+*/ -+enum vmcs_sm_cache_e { -+ VMCS_SM_CACHE_NONE, -+ VMCS_SM_CACHE_HOST, -+ VMCS_SM_CACHE_VC, -+ VMCS_SM_CACHE_BOTH, -+}; -+ -+/* IOCTL Data structures */ -+struct vmcs_sm_ioctl_alloc { -+ /* user -> kernel */ -+ unsigned int size; -+ unsigned int num; -+ enum vmcs_sm_cache_e cached; -+ char name[VMCS_SM_RESOURCE_NAME]; -+ -+ /* kernel -> user */ -+ unsigned int handle; -+ /* unsigned int base_addr; */ -+}; -+ -+struct vmcs_sm_ioctl_alloc_share { -+ /* user -> kernel */ -+ unsigned int handle; -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_free { -+ /* user -> kernel */ -+ unsigned int handle; -+ /* unsigned int base_addr; */ -+}; -+ -+struct vmcs_sm_ioctl_lock_unlock { -+ /* user -> kernel */ -+ unsigned int handle; -+ -+ /* kernel -> user */ -+ unsigned int addr; -+}; -+ -+struct vmcs_sm_ioctl_lock_cache { -+ /* user -> kernel */ -+ unsigned int handle; -+ enum vmcs_sm_cache_e cached; -+}; -+ -+struct vmcs_sm_ioctl_resize { -+ /* user -> kernel */ -+ unsigned int handle; -+ unsigned int new_size; -+ -+ /* kernel -> user */ -+ unsigned int old_size; -+}; -+ -+struct vmcs_sm_ioctl_map { -+ /* user -> kernel */ -+ /* and kernel -> user */ -+ unsigned int pid; -+ unsigned int handle; -+ unsigned int addr; -+ -+ /* kernel -> user */ -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_walk { -+ /* user -> kernel */ -+ unsigned int pid; -+}; -+ -+struct vmcs_sm_ioctl_chk { -+ /* user -> kernel */ -+ unsigned int handle; -+ -+ /* kernel -> user */ -+ unsigned int addr; -+ unsigned int size; -+ enum vmcs_sm_cache_e cache; -+}; -+ -+struct vmcs_sm_ioctl_size { -+ /* user -> kernel */ -+ unsigned int handle; -+ -+ /* kernel -> user */ -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_cache { -+ /* user -> kernel */ -+ unsigned int handle; -+ unsigned int addr; -+ unsigned int size; -+}; -+ -+struct vmcs_sm_ioctl_clean_invalid { -+ /* user -> kernel */ -+ struct { -+ unsigned int cmd; -+ unsigned int handle; -+ unsigned int addr; -+ unsigned int size; -+ } s[8]; -+}; -+ -+/* IOCTL numbers */ -+#define VMCS_SM_IOCTL_MEM_ALLOC\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ -+ struct vmcs_sm_ioctl_alloc) -+#define VMCS_SM_IOCTL_MEM_ALLOC_SHARE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC_SHARE,\ -+ struct vmcs_sm_ioctl_alloc_share) -+#define VMCS_SM_IOCTL_MEM_LOCK\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK,\ -+ struct vmcs_sm_ioctl_lock_unlock) -+#define VMCS_SM_IOCTL_MEM_LOCK_CACHE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_LOCK_CACHE,\ -+ struct vmcs_sm_ioctl_lock_cache) -+#define VMCS_SM_IOCTL_MEM_UNLOCK\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_UNLOCK,\ -+ struct vmcs_sm_ioctl_lock_unlock) -+#define VMCS_SM_IOCTL_MEM_RESIZE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_RESIZE,\ -+ struct vmcs_sm_ioctl_resize) -+#define VMCS_SM_IOCTL_MEM_FREE\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FREE,\ -+ struct vmcs_sm_ioctl_free) -+#define VMCS_SM_IOCTL_MEM_FLUSH\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_FLUSH,\ -+ struct vmcs_sm_ioctl_cache) -+#define VMCS_SM_IOCTL_MEM_INVALID\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_INVALID,\ -+ struct vmcs_sm_ioctl_cache) -+#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ -+ struct vmcs_sm_ioctl_clean_invalid) -+ -+#define VMCS_SM_IOCTL_SIZE_USR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ -+ struct vmcs_sm_ioctl_size) -+#define VMCS_SM_IOCTL_CHK_USR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CHK_USR_HANDLE,\ -+ struct vmcs_sm_ioctl_chk) -+ -+#define VMCS_SM_IOCTL_MAP_USR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_HANDLE,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_USR_ADDRESS\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_USR_ADDRESS,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_ADDR\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_ADDR,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_VC_HDL_FR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_HDL_FROM_HDL,\ -+ struct vmcs_sm_ioctl_map) -+#define VMCS_SM_IOCTL_MAP_VC_ADDR_FR_HDL\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_MAPPED_VC_ADDR_FROM_HDL,\ -+ struct vmcs_sm_ioctl_map) -+ -+#define VMCS_SM_IOCTL_VC_WALK_ALLOC\ -+ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_VC_WALK_ALLOC) -+#define VMCS_SM_IOCTL_HOST_WALK_MAP\ -+ _IO(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_MAP) -+#define VMCS_SM_IOCTL_HOST_WALK_PID_ALLOC\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_ALLOC,\ -+ struct vmcs_sm_ioctl_walk) -+#define VMCS_SM_IOCTL_HOST_WALK_PID_MAP\ -+ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ -+ struct vmcs_sm_ioctl_walk) -+ -+/* ---- Variable Externs ------------------------------------------------- */ -+ -+/* ---- Function Prototypes ---------------------------------------------- */ -+ -+#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ - -From 3d892851d6e52bec4c02b06146967ecc52b50af0 Mon Sep 17 00:00:00 2001 -From: Luke Wren -Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 041/122] Add /dev/gpiomem device for rootless user GPIO access - -Signed-off-by: Luke Wren - -bcm2835-gpiomem: Fix for ARCH_BCM2835 builds - -Build on ARCH_BCM2835, and fail to probe if no IO resource. - -See: https://github.com/raspberrypi/linux/issues/1154 ---- - drivers/char/broadcom/Kconfig | 9 ++ - drivers/char/broadcom/Makefile | 3 + - drivers/char/broadcom/bcm2835-gpiomem.c | 260 ++++++++++++++++++++++++++++++++ - 3 files changed, 272 insertions(+) - create mode 100644 drivers/char/broadcom/bcm2835-gpiomem.c - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index 75fa1cba764084160f7cb77e56058f25b5e9f0ce..b75c9b2639fb0e63dd2623ddc1dcaac5759c132b 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -32,3 +32,12 @@ config BCM_VC_SM - help - Support for the VC shared memory on the Broadcom reference - design. Uses the VCHIQ stack. -+ -+config BCM2835_DEVGPIOMEM -+ tristate "/dev/gpiomem rootless GPIO access via mmap() on the BCM2835" -+ default m -+ help -+ Provides users with root-free access to the GPIO registers -+ on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO -+ register page to the user's pointer. -+ -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index de8feb98c63ff1e6437d80a6db85a8d30f433705..1eb06e9788663c3e75d201a559db55556cecfe2b 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1,3 +1,6 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ - obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o - obj-$(CONFIG_BCM_VC_SM) += vc_sm/ -+ -+obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o -+ -diff --git a/drivers/char/broadcom/bcm2835-gpiomem.c b/drivers/char/broadcom/bcm2835-gpiomem.c -new file mode 100644 -index 0000000000000000000000000000000000000000..911f5b7393ed48ceed8751f06967ae6463453f9c ---- /dev/null -+++ b/drivers/char/broadcom/bcm2835-gpiomem.c -@@ -0,0 +1,260 @@ -+/** -+ * GPIO memory device driver -+ * -+ * Creates a chardev /dev/gpiomem which will provide user access to -+ * the BCM2835's GPIO registers when it is mmap()'d. -+ * No longer need root for user GPIO access, but without relaxing permissions -+ * on /dev/mem. -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DEVICE_NAME "bcm2835-gpiomem" -+#define DRIVER_NAME "gpiomem-bcm2835" -+#define DEVICE_MINOR 0 -+ -+struct bcm2835_gpiomem_instance { -+ unsigned long gpio_regs_phys; -+ struct device *dev; -+}; -+ -+static struct cdev bcm2835_gpiomem_cdev; -+static dev_t bcm2835_gpiomem_devid; -+static struct class *bcm2835_gpiomem_class; -+static struct device *bcm2835_gpiomem_dev; -+static struct bcm2835_gpiomem_instance *inst; -+ -+ -+/**************************************************************************** -+* -+* GPIO mem chardev file ops -+* -+***************************************************************************/ -+ -+static int bcm2835_gpiomem_open(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ int ret = 0; -+ -+ dev_info(inst->dev, "gpiomem device opened."); -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, "Unknown minor device: %d", dev); -+ ret = -ENXIO; -+ } -+ return ret; -+} -+ -+static int bcm2835_gpiomem_release(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ int ret = 0; -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, "Unknown minor device %d", dev); -+ ret = -ENXIO; -+ } -+ return ret; -+} -+ -+static const struct vm_operations_struct bcm2835_gpiomem_vm_ops = { -+#ifdef CONFIG_HAVE_IOREMAP_PROT -+ .access = generic_access_phys -+#endif -+}; -+ -+static int bcm2835_gpiomem_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ /* Ignore what the user says - they're getting the GPIO regs -+ whether they like it or not! */ -+ unsigned long gpio_page = inst->gpio_regs_phys >> PAGE_SHIFT; -+ -+ vma->vm_page_prot = phys_mem_access_prot(file, gpio_page, -+ PAGE_SIZE, -+ vma->vm_page_prot); -+ vma->vm_ops = &bcm2835_gpiomem_vm_ops; -+ if (remap_pfn_range(vma, vma->vm_start, -+ gpio_page, -+ PAGE_SIZE, -+ vma->vm_page_prot)) { -+ return -EAGAIN; -+ } -+ return 0; -+} -+ -+static const struct file_operations -+bcm2835_gpiomem_fops = { -+ .owner = THIS_MODULE, -+ .open = bcm2835_gpiomem_open, -+ .release = bcm2835_gpiomem_release, -+ .mmap = bcm2835_gpiomem_mmap, -+}; -+ -+ -+ /**************************************************************************** -+* -+* Probe and remove functions -+* -+***************************************************************************/ -+ -+ -+static int bcm2835_gpiomem_probe(struct platform_device *pdev) -+{ -+ int err; -+ void *ptr_err; -+ struct device *dev = &pdev->dev; -+ struct resource *ioresource; -+ -+ /* Allocate buffers and instance data */ -+ -+ inst = kzalloc(sizeof(struct bcm2835_gpiomem_instance), GFP_KERNEL); -+ -+ if (!inst) { -+ err = -ENOMEM; -+ goto failed_inst_alloc; -+ } -+ -+ inst->dev = dev; -+ -+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (ioresource) { -+ inst->gpio_regs_phys = ioresource->start; -+ } else { -+ dev_err(inst->dev, "failed to get IO resource"); -+ err = -ENOENT; -+ goto failed_get_resource; -+ } -+ -+ /* Create character device entries */ -+ -+ err = alloc_chrdev_region(&bcm2835_gpiomem_devid, -+ DEVICE_MINOR, 1, DEVICE_NAME); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to allocate device number"); -+ goto failed_alloc_chrdev; -+ } -+ cdev_init(&bcm2835_gpiomem_cdev, &bcm2835_gpiomem_fops); -+ bcm2835_gpiomem_cdev.owner = THIS_MODULE; -+ err = cdev_add(&bcm2835_gpiomem_cdev, bcm2835_gpiomem_devid, 1); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to register device"); -+ goto failed_cdev_add; -+ } -+ -+ /* Create sysfs entries */ -+ -+ bcm2835_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME); -+ ptr_err = bcm2835_gpiomem_class; -+ if (IS_ERR(ptr_err)) -+ goto failed_class_create; -+ -+ bcm2835_gpiomem_dev = device_create(bcm2835_gpiomem_class, NULL, -+ bcm2835_gpiomem_devid, NULL, -+ "gpiomem"); -+ ptr_err = bcm2835_gpiomem_dev; -+ if (IS_ERR(ptr_err)) -+ goto failed_device_create; -+ -+ dev_info(inst->dev, "Initialised: Registers at 0x%08lx", -+ inst->gpio_regs_phys); -+ -+ return 0; -+ -+failed_device_create: -+ class_destroy(bcm2835_gpiomem_class); -+failed_class_create: -+ cdev_del(&bcm2835_gpiomem_cdev); -+ err = PTR_ERR(ptr_err); -+failed_cdev_add: -+ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); -+failed_alloc_chrdev: -+failed_get_resource: -+ kfree(inst); -+failed_inst_alloc: -+ dev_err(inst->dev, "could not load bcm2835_gpiomem"); -+ return err; -+} -+ -+static int bcm2835_gpiomem_remove(struct platform_device *pdev) -+{ -+ struct device *dev = inst->dev; -+ -+ kfree(inst); -+ device_destroy(bcm2835_gpiomem_class, bcm2835_gpiomem_devid); -+ class_destroy(bcm2835_gpiomem_class); -+ cdev_del(&bcm2835_gpiomem_cdev); -+ unregister_chrdev_region(bcm2835_gpiomem_devid, 1); -+ -+ dev_info(dev, "GPIO mem driver removed - OK"); -+ return 0; -+} -+ -+ /**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_gpiomem_of_match[] = { -+ {.compatible = "brcm,bcm2835-gpiomem",}, -+ { /* sentinel */ }, -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_gpiomem_of_match); -+ -+static struct platform_driver bcm2835_gpiomem_driver = { -+ .probe = bcm2835_gpiomem_probe, -+ .remove = bcm2835_gpiomem_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_gpiomem_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_gpiomem_driver); -+ -+MODULE_ALIAS("platform:gpiomem-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); -+MODULE_AUTHOR("Luke Wren "); - -From fbaa743648d031cbb8afeb81e37f546b4fd7b6b5 Mon Sep 17 00:00:00 2001 -From: Luke Wren -Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 042/122] Add SMI driver - -Signed-off-by: Luke Wren ---- - .../bindings/misc/brcm,bcm2835-smi-dev.txt | 17 + - .../devicetree/bindings/misc/brcm,bcm2835-smi.txt | 48 + - drivers/char/broadcom/Kconfig | 8 + - drivers/char/broadcom/Makefile | 2 +- - drivers/char/broadcom/bcm2835_smi_dev.c | 402 +++++++++ - drivers/misc/Kconfig | 8 + - drivers/misc/Makefile | 1 + - drivers/misc/bcm2835_smi.c | 985 +++++++++++++++++++++ - include/linux/broadcom/bcm2835_smi.h | 391 ++++++++ - 9 files changed, 1861 insertions(+), 1 deletion(-) - create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt - create mode 100644 Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt - create mode 100644 drivers/char/broadcom/bcm2835_smi_dev.c - create mode 100644 drivers/misc/bcm2835_smi.c - create mode 100644 include/linux/broadcom/bcm2835_smi.h - -diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..68cc8ebc3392d45cbccac0dc0354514076d43398 ---- /dev/null -+++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi-dev.txt -@@ -0,0 +1,17 @@ -+* Broadcom BCM2835 SMI character device driver. -+ -+SMI or secondary memory interface is a peripheral specific to certain Broadcom -+SOCs, and is helpful for talking to things like parallel-interface displays -+and NAND flashes (in fact, most things with a parallel register interface). -+ -+This driver adds a character device which provides a user-space interface to -+an instance of the SMI driver. -+ -+Required properties: -+- compatible: "brcm,bcm2835-smi-dev" -+- smi_handle: a phandle to the smi node. -+ -+Optional properties: -+- None. -+ -+ -diff --git a/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..b76dc694f1ac0b8044000ae54d312c803b1ef6f7 ---- /dev/null -+++ b/Documentation/devicetree/bindings/misc/brcm,bcm2835-smi.txt -@@ -0,0 +1,48 @@ -+* Broadcom BCM2835 SMI driver. -+ -+SMI or secondary memory interface is a peripheral specific to certain Broadcom -+SOCs, and is helpful for talking to things like parallel-interface displays -+and NAND flashes (in fact, most things with a parallel register interface). -+ -+Required properties: -+- compatible: "brcm,bcm2835-smi" -+- reg: Should contain location and length of SMI registers and SMI clkman regs -+- interrupts: *the* SMI interrupt. -+- pinctrl-names: should be "default". -+- pinctrl-0: the phandle of the gpio pin node. -+- brcm,smi-clock-source: the clock source for clkman -+- brcm,smi-clock-divisor: the integer clock divisor for clkman -+- dmas: the dma controller phandle and the DREQ number (4 on a 2835) -+- dma-names: the name used by the driver to request its channel. -+ Should be "rx-tx". -+ -+Optional properties: -+- None. -+ -+Examples: -+ -+8 data pin configuration: -+ -+smi: smi@7e600000 { -+ compatible = "brcm,bcm2835-smi"; -+ reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>; -+ interrupts = <2 16>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; -+ brcm,smi-clock-source = <6>; -+ brcm,smi-clock-divisor = <4>; -+ dmas = <&dma 4>; -+ dma-names = "rx-tx"; -+ -+ status = "okay"; -+}; -+ -+smi_pins: smi_pins { -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15>; -+ /* Alt 1: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0>; -+}; -+ -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index b75c9b2639fb0e63dd2623ddc1dcaac5759c132b..f7885466f5bf9c0cf45f2057d07a0d24151f10c3 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -41,3 +41,11 @@ config BCM2835_DEVGPIOMEM - on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO - register page to the user's pointer. - -+config BCM2835_SMI_DEV -+ tristate "Character device driver for BCM2835 Secondary Memory Interface" -+ depends on BCM2835_SMI -+ default m -+ help -+ This driver provides a character device interface (ioctl + read/write) to -+ Broadcom's Secondary Memory interface. The low-level functionality is provided -+ by the SMI driver itself. -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index 1eb06e9788663c3e75d201a559db55556cecfe2b..667d33ef38f3512b52818537c11d369798b6f1c0 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -3,4 +3,4 @@ obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o - obj-$(CONFIG_BCM_VC_SM) += vc_sm/ - - obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o -- -+obj-$(CONFIG_BCM2835_SMI_DEV) += bcm2835_smi_dev.o -diff --git a/drivers/char/broadcom/bcm2835_smi_dev.c b/drivers/char/broadcom/bcm2835_smi_dev.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d6efd92fdfe46df5cfe219d2123e0dff23dc5ab7 ---- /dev/null -+++ b/drivers/char/broadcom/bcm2835_smi_dev.c -@@ -0,0 +1,402 @@ -+/** -+ * Character device driver for Broadcom Secondary Memory Interface -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define DEVICE_NAME "bcm2835-smi-dev" -+#define DRIVER_NAME "smi-dev-bcm2835" -+#define DEVICE_MINOR 0 -+ -+static struct cdev bcm2835_smi_cdev; -+static dev_t bcm2835_smi_devid; -+static struct class *bcm2835_smi_class; -+static struct device *bcm2835_smi_dev; -+ -+struct bcm2835_smi_dev_instance { -+ struct device *dev; -+}; -+ -+static struct bcm2835_smi_instance *smi_inst; -+static struct bcm2835_smi_dev_instance *inst; -+ -+static const char *const ioctl_names[] = { -+ "READ_SETTINGS", -+ "WRITE_SETTINGS", -+ "ADDRESS" -+}; -+ -+/**************************************************************************** -+* -+* SMI chardev file ops -+* -+***************************************************************************/ -+static long -+bcm2835_smi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ long ret = 0; -+ -+ dev_info(inst->dev, "serving ioctl..."); -+ -+ switch (cmd) { -+ case BCM2835_SMI_IOC_GET_SETTINGS:{ -+ struct smi_settings *settings; -+ -+ dev_info(inst->dev, "Reading SMI settings to user."); -+ settings = bcm2835_smi_get_settings_from_regs(smi_inst); -+ if (copy_to_user((void *)arg, settings, -+ sizeof(struct smi_settings))) -+ dev_err(inst->dev, "settings copy failed."); -+ break; -+ } -+ case BCM2835_SMI_IOC_WRITE_SETTINGS:{ -+ struct smi_settings *settings; -+ -+ dev_info(inst->dev, "Setting user's SMI settings."); -+ settings = bcm2835_smi_get_settings_from_regs(smi_inst); -+ if (copy_from_user(settings, (void *)arg, -+ sizeof(struct smi_settings))) -+ dev_err(inst->dev, "settings copy failed."); -+ else -+ bcm2835_smi_set_regs_from_settings(smi_inst); -+ break; -+ } -+ case BCM2835_SMI_IOC_ADDRESS: -+ dev_info(inst->dev, "SMI address set: 0x%02x", (int)arg); -+ bcm2835_smi_set_address(smi_inst, arg); -+ break; -+ default: -+ dev_err(inst->dev, "invalid ioctl cmd: %d", cmd); -+ ret = -ENOTTY; -+ break; -+ } -+ -+ return ret; -+} -+ -+static int bcm2835_smi_open(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ -+ dev_dbg(inst->dev, "SMI device opened."); -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, -+ "bcm2835_smi_release: Unknown minor device: %d", -+ dev); -+ return -ENXIO; -+ } -+ -+ return 0; -+} -+ -+static int bcm2835_smi_release(struct inode *inode, struct file *file) -+{ -+ int dev = iminor(inode); -+ -+ if (dev != DEVICE_MINOR) { -+ dev_err(inst->dev, -+ "bcm2835_smi_release: Unknown minor device %d", dev); -+ return -ENXIO; -+ } -+ -+ return 0; -+} -+ -+static ssize_t dma_bounce_user( -+ enum dma_transfer_direction dma_dir, -+ char __user *user_ptr, -+ size_t count, -+ struct bcm2835_smi_bounce_info *bounce) -+{ -+ int chunk_size; -+ int chunk_no = 0; -+ int count_left = count; -+ -+ while (count_left) { -+ int rv; -+ void *buf; -+ -+ /* Wait for current chunk to complete: */ -+ if (down_timeout(&bounce->callback_sem, -+ msecs_to_jiffies(1000))) { -+ dev_err(inst->dev, "DMA bounce timed out"); -+ count -= (count_left); -+ break; -+ } -+ -+ if (bounce->callback_sem.count >= DMA_BOUNCE_BUFFER_COUNT - 1) -+ dev_err(inst->dev, "WARNING: Ring buffer overflow"); -+ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? -+ DMA_BOUNCE_BUFFER_SIZE : count_left; -+ buf = bounce->buffer[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; -+ if (dma_dir == DMA_DEV_TO_MEM) -+ rv = copy_to_user(user_ptr, buf, chunk_size); -+ else -+ rv = copy_from_user(buf, user_ptr, chunk_size); -+ if (rv) -+ dev_err(inst->dev, "copy_*_user() failed!: %d", rv); -+ user_ptr += chunk_size; -+ count_left -= chunk_size; -+ chunk_no++; -+ } -+ return count; -+} -+ -+static ssize_t -+bcm2835_read_file(struct file *f, char __user *user_ptr, -+ size_t count, loff_t *offs) -+{ -+ int odd_bytes; -+ -+ dev_dbg(inst->dev, "User reading %d bytes from SMI.", count); -+ /* We don't want to DMA a number of bytes % 4 != 0 (32 bit FIFO) */ -+ if (count > DMA_THRESHOLD_BYTES) -+ odd_bytes = count & 0x3; -+ else -+ odd_bytes = count; -+ count -= odd_bytes; -+ if (count) { -+ struct bcm2835_smi_bounce_info *bounce; -+ -+ count = bcm2835_smi_user_dma(smi_inst, -+ DMA_DEV_TO_MEM, user_ptr, count, -+ &bounce); -+ if (count) -+ count = dma_bounce_user(DMA_DEV_TO_MEM, user_ptr, -+ count, bounce); -+ } -+ if (odd_bytes) { -+ /* Read from FIFO directly if not using DMA */ -+ uint8_t buf[DMA_THRESHOLD_BYTES]; -+ -+ bcm2835_smi_read_buf(smi_inst, buf, odd_bytes); -+ if (copy_to_user(user_ptr, buf, odd_bytes)) -+ dev_err(inst->dev, "copy_to_user() failed."); -+ count += odd_bytes; -+ -+ } -+ return count; -+} -+ -+static ssize_t -+bcm2835_write_file(struct file *f, const char __user *user_ptr, -+ size_t count, loff_t *offs) -+{ -+ int odd_bytes; -+ -+ dev_dbg(inst->dev, "User writing %d bytes to SMI.", count); -+ if (count > DMA_THRESHOLD_BYTES) -+ odd_bytes = count & 0x3; -+ else -+ odd_bytes = count; -+ count -= odd_bytes; -+ if (count) { -+ struct bcm2835_smi_bounce_info *bounce; -+ -+ count = bcm2835_smi_user_dma(smi_inst, -+ DMA_MEM_TO_DEV, (char __user *)user_ptr, count, -+ &bounce); -+ if (count) -+ count = dma_bounce_user(DMA_MEM_TO_DEV, -+ (char __user *)user_ptr, -+ count, bounce); -+ } -+ if (odd_bytes) { -+ uint8_t buf[DMA_THRESHOLD_BYTES]; -+ -+ if (copy_from_user(buf, user_ptr, odd_bytes)) -+ dev_err(inst->dev, "copy_from_user() failed."); -+ else -+ bcm2835_smi_write_buf(smi_inst, buf, odd_bytes); -+ count += odd_bytes; -+ } -+ return count; -+} -+ -+static const struct file_operations -+bcm2835_smi_fops = { -+ .owner = THIS_MODULE, -+ .unlocked_ioctl = bcm2835_smi_ioctl, -+ .open = bcm2835_smi_open, -+ .release = bcm2835_smi_release, -+ .read = bcm2835_read_file, -+ .write = bcm2835_write_file, -+}; -+ -+ -+/**************************************************************************** -+* -+* bcm2835_smi_probe - called when the driver is loaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_dev_probe(struct platform_device *pdev) -+{ -+ int err; -+ void *ptr_err; -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node, *smi_node; -+ -+ if (!node) { -+ dev_err(dev, "No device tree node supplied!"); -+ return -EINVAL; -+ } -+ -+ smi_node = of_parse_phandle(node, "smi_handle", 0); -+ -+ if (!smi_node) { -+ dev_err(dev, "No such property: smi_handle"); -+ return -ENXIO; -+ } -+ -+ smi_inst = bcm2835_smi_get(smi_node); -+ -+ if (!smi_inst) -+ return -EPROBE_DEFER; -+ -+ /* Allocate buffers and instance data */ -+ -+ inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL); -+ -+ if (!inst) -+ return -ENOMEM; -+ -+ inst->dev = dev; -+ -+ /* Create character device entries */ -+ -+ err = alloc_chrdev_region(&bcm2835_smi_devid, -+ DEVICE_MINOR, 1, DEVICE_NAME); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to allocate device number"); -+ return -ENOMEM; -+ } -+ cdev_init(&bcm2835_smi_cdev, &bcm2835_smi_fops); -+ bcm2835_smi_cdev.owner = THIS_MODULE; -+ err = cdev_add(&bcm2835_smi_cdev, bcm2835_smi_devid, 1); -+ if (err != 0) { -+ dev_err(inst->dev, "unable to register device"); -+ err = -ENOMEM; -+ goto failed_cdev_add; -+ } -+ -+ /* Create sysfs entries */ -+ -+ bcm2835_smi_class = class_create(THIS_MODULE, DEVICE_NAME); -+ ptr_err = bcm2835_smi_class; -+ if (IS_ERR(ptr_err)) -+ goto failed_class_create; -+ -+ bcm2835_smi_dev = device_create(bcm2835_smi_class, NULL, -+ bcm2835_smi_devid, NULL, -+ "smi"); -+ ptr_err = bcm2835_smi_dev; -+ if (IS_ERR(ptr_err)) -+ goto failed_device_create; -+ -+ dev_info(inst->dev, "initialised"); -+ -+ return 0; -+ -+failed_device_create: -+ class_destroy(bcm2835_smi_class); -+failed_class_create: -+ cdev_del(&bcm2835_smi_cdev); -+ err = PTR_ERR(ptr_err); -+failed_cdev_add: -+ unregister_chrdev_region(bcm2835_smi_devid, 1); -+ dev_err(dev, "could not load bcm2835_smi_dev"); -+ return err; -+} -+ -+/**************************************************************************** -+* -+* bcm2835_smi_remove - called when the driver is unloaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_dev_remove(struct platform_device *pdev) -+{ -+ device_destroy(bcm2835_smi_class, bcm2835_smi_devid); -+ class_destroy(bcm2835_smi_class); -+ cdev_del(&bcm2835_smi_cdev); -+ unregister_chrdev_region(bcm2835_smi_devid, 1); -+ -+ dev_info(inst->dev, "SMI character dev removed - OK"); -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_smi_dev_of_match[] = { -+ {.compatible = "brcm,bcm2835-smi-dev",}, -+ { /* sentinel */ }, -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_smi_dev_of_match); -+ -+static struct platform_driver bcm2835_smi_dev_driver = { -+ .probe = bcm2835_smi_dev_probe, -+ .remove = bcm2835_smi_dev_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_smi_dev_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_smi_dev_driver); -+ -+MODULE_ALIAS("platform:smi-dev-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION( -+ "Character device driver for BCM2835's secondary memory interface"); -+MODULE_AUTHOR("Luke Wren "); -diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 64971baf11faebaff879c58067d23fd9bf29895a..779f7d61a1779decd4dcbba3bc0e6b330e47f335 100644 ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -10,6 +10,14 @@ config SENSORS_LIS3LV02D - select INPUT_POLLDEV - default n - -+config BCM2835_SMI -+ tristate "Broadcom 283x Secondary Memory Interface driver" -+ depends on ARCH_BCM2835 -+ default m -+ help -+ Driver for enabling and using Broadcom's Secondary/Slow Memory Interface. -+ Appears as /dev/bcm2835_smi. For ioctl interface see drivers/misc/bcm2835_smi.h -+ - config AD525X_DPOT - tristate "Analog Devices Digital Potentiometers" - depends on (I2C || SPI) && SYSFS -diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index 31983366090a781441a3235cac5883d6fbb27fa4..6c400f0fb92f5af49e04911b7f103ce1a60af093 100644 ---- a/drivers/misc/Makefile -+++ b/drivers/misc/Makefile -@@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o - obj-$(CONFIG_INTEL_MID_PTI) += pti.o - obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o - obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o -+obj-$(CONFIG_BCM2835_SMI) += bcm2835_smi.o - obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o - obj-$(CONFIG_ICS932S401) += ics932s401.o - obj-$(CONFIG_LKDTM) += lkdtm.o -diff --git a/drivers/misc/bcm2835_smi.c b/drivers/misc/bcm2835_smi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..63a4ea08b9930a3a31a985f0a1d969b488ed49ec ---- /dev/null -+++ b/drivers/misc/bcm2835_smi.c -@@ -0,0 +1,985 @@ -+/** -+ * Broadcom Secondary Memory Interface driver -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BCM2835_SMI_IMPLEMENTATION -+#include -+ -+#define DRIVER_NAME "smi-bcm2835" -+ -+#define N_PAGES_FROM_BYTES(n) ((n + PAGE_SIZE-1) / PAGE_SIZE) -+ -+#define DMA_WRITE_TO_MEM true -+#define DMA_READ_FROM_MEM false -+ -+struct bcm2835_smi_instance { -+ struct device *dev; -+ struct smi_settings settings; -+ __iomem void *smi_regs_ptr, *cm_smi_regs_ptr; -+ dma_addr_t smi_regs_busaddr; -+ -+ struct dma_chan *dma_chan; -+ struct dma_slave_config dma_config; -+ -+ struct bcm2835_smi_bounce_info bounce; -+ -+ struct scatterlist buffer_sgl; -+ -+ int clock_source; -+ int clock_divisor; -+ -+ /* Sometimes we are called into in an atomic context (e.g. by -+ JFFS2 + MTD) so we can't use a mutex */ -+ spinlock_t transaction_lock; -+}; -+ -+/**************************************************************************** -+* -+* SMI clock manager setup -+* -+***************************************************************************/ -+ -+static inline void write_smi_cm_reg(struct bcm2835_smi_instance *inst, -+ u32 val, unsigned reg) -+{ -+ writel(CM_PWD | val, inst->cm_smi_regs_ptr + reg); -+} -+ -+static inline u32 read_smi_cm_reg(struct bcm2835_smi_instance *inst, -+ unsigned reg) -+{ -+ return readl(inst->cm_smi_regs_ptr + reg); -+} -+ -+static void smi_setup_clock(struct bcm2835_smi_instance *inst) -+{ -+ dev_dbg(inst->dev, "Setting up clock..."); -+ /* Disable SMI clock and wait for it to stop. */ -+ write_smi_cm_reg(inst, 0, CM_SMI_CTL); -+ while (read_smi_cm_reg(inst, CM_SMI_CTL) & CM_SMI_CTL_BUSY) -+ ; -+ -+ write_smi_cm_reg(inst, (inst->clock_divisor << CM_SMI_DIV_DIVI_OFFS), -+ CM_SMI_DIV); -+ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS), -+ CM_SMI_CTL); -+ -+ /* Enable the clock */ -+ write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS) | -+ CM_SMI_CTL_ENAB, CM_SMI_CTL); -+} -+ -+/**************************************************************************** -+* -+* SMI peripheral setup -+* -+***************************************************************************/ -+ -+static inline void write_smi_reg(struct bcm2835_smi_instance *inst, -+ u32 val, unsigned reg) -+{ -+ writel(val, inst->smi_regs_ptr + reg); -+} -+ -+static inline u32 read_smi_reg(struct bcm2835_smi_instance *inst, unsigned reg) -+{ -+ return readl(inst->smi_regs_ptr + reg); -+} -+ -+/* Token-paste macro for e.g SMIDSR_RSTROBE -> value of SMIDSR_RSTROBE_MASK */ -+#define _CONCAT(x, y) x##y -+#define CONCAT(x, y) _CONCAT(x, y) -+ -+#define SET_BIT_FIELD(dest, field, bits) ((dest) = \ -+ ((dest) & ~CONCAT(field, _MASK)) | (((bits) << CONCAT(field, _OFFS))& \ -+ CONCAT(field, _MASK))) -+#define GET_BIT_FIELD(src, field) (((src) & \ -+ CONCAT(field, _MASK)) >> CONCAT(field, _OFFS)) -+ -+static void smi_dump_context_labelled(struct bcm2835_smi_instance *inst, -+ const char *label) -+{ -+ dev_err(inst->dev, "SMI context dump: %s", label); -+ dev_err(inst->dev, "SMICS: 0x%08x", read_smi_reg(inst, SMICS)); -+ dev_err(inst->dev, "SMIL: 0x%08x", read_smi_reg(inst, SMIL)); -+ dev_err(inst->dev, "SMIDSR: 0x%08x", read_smi_reg(inst, SMIDSR0)); -+ dev_err(inst->dev, "SMIDSW: 0x%08x", read_smi_reg(inst, SMIDSW0)); -+ dev_err(inst->dev, "SMIDC: 0x%08x", read_smi_reg(inst, SMIDC)); -+ dev_err(inst->dev, "SMIFD: 0x%08x", read_smi_reg(inst, SMIFD)); -+ dev_err(inst->dev, " "); -+} -+ -+static inline void smi_dump_context(struct bcm2835_smi_instance *inst) -+{ -+ smi_dump_context_labelled(inst, ""); -+} -+ -+static void smi_get_default_settings(struct bcm2835_smi_instance *inst) -+{ -+ struct smi_settings *settings = &inst->settings; -+ -+ settings->data_width = SMI_WIDTH_16BIT; -+ settings->pack_data = true; -+ -+ settings->read_setup_time = 1; -+ settings->read_hold_time = 1; -+ settings->read_pace_time = 1; -+ settings->read_strobe_time = 3; -+ -+ settings->write_setup_time = settings->read_setup_time; -+ settings->write_hold_time = settings->read_hold_time; -+ settings->write_pace_time = settings->read_pace_time; -+ settings->write_strobe_time = settings->read_strobe_time; -+ -+ settings->dma_enable = true; -+ settings->dma_passthrough_enable = false; -+ settings->dma_read_thresh = 0x01; -+ settings->dma_write_thresh = 0x3f; -+ settings->dma_panic_read_thresh = 0x20; -+ settings->dma_panic_write_thresh = 0x20; -+} -+ -+void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *inst) -+{ -+ struct smi_settings *settings = &inst->settings; -+ int smidsr_temp = 0, smidsw_temp = 0, smics_temp, -+ smidcs_temp, smidc_temp = 0; -+ -+ spin_lock(&inst->transaction_lock); -+ -+ /* temporarily disable the peripheral: */ -+ smics_temp = read_smi_reg(inst, SMICS); -+ write_smi_reg(inst, 0, SMICS); -+ smidcs_temp = read_smi_reg(inst, SMIDCS); -+ write_smi_reg(inst, 0, SMIDCS); -+ -+ if (settings->pack_data) -+ smics_temp |= SMICS_PXLDAT; -+ else -+ smics_temp &= ~SMICS_PXLDAT; -+ -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RWIDTH, settings->data_width); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSETUP, settings->read_setup_time); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RHOLD, settings->read_hold_time); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RPACE, settings->read_pace_time); -+ SET_BIT_FIELD(smidsr_temp, SMIDSR_RSTROBE, settings->read_strobe_time); -+ write_smi_reg(inst, smidsr_temp, SMIDSR0); -+ -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WWIDTH, settings->data_width); -+ if (settings->data_width == SMI_WIDTH_8BIT) -+ smidsw_temp |= SMIDSW_WSWAP; -+ else -+ smidsw_temp &= ~SMIDSW_WSWAP; -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSETUP, settings->write_setup_time); -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WHOLD, settings->write_hold_time); -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WPACE, settings->write_pace_time); -+ SET_BIT_FIELD(smidsw_temp, SMIDSW_WSTROBE, -+ settings->write_strobe_time); -+ write_smi_reg(inst, smidsw_temp, SMIDSW0); -+ -+ SET_BIT_FIELD(smidc_temp, SMIDC_REQR, settings->dma_read_thresh); -+ SET_BIT_FIELD(smidc_temp, SMIDC_REQW, settings->dma_write_thresh); -+ SET_BIT_FIELD(smidc_temp, SMIDC_PANICR, -+ settings->dma_panic_read_thresh); -+ SET_BIT_FIELD(smidc_temp, SMIDC_PANICW, -+ settings->dma_panic_write_thresh); -+ if (settings->dma_passthrough_enable) { -+ smidc_temp |= SMIDC_DMAP; -+ smidsr_temp |= SMIDSR_RDREQ; -+ write_smi_reg(inst, smidsr_temp, SMIDSR0); -+ smidsw_temp |= SMIDSW_WDREQ; -+ write_smi_reg(inst, smidsw_temp, SMIDSW0); -+ } else -+ smidc_temp &= ~SMIDC_DMAP; -+ if (settings->dma_enable) -+ smidc_temp |= SMIDC_DMAEN; -+ else -+ smidc_temp &= ~SMIDC_DMAEN; -+ -+ write_smi_reg(inst, smidc_temp, SMIDC); -+ -+ /* re-enable (if was previously enabled) */ -+ write_smi_reg(inst, smics_temp, SMICS); -+ write_smi_reg(inst, smidcs_temp, SMIDCS); -+ -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_set_regs_from_settings); -+ -+struct smi_settings *bcm2835_smi_get_settings_from_regs -+ (struct bcm2835_smi_instance *inst) -+{ -+ struct smi_settings *settings = &inst->settings; -+ int smidsr, smidsw, smidc; -+ -+ spin_lock(&inst->transaction_lock); -+ -+ smidsr = read_smi_reg(inst, SMIDSR0); -+ smidsw = read_smi_reg(inst, SMIDSW0); -+ smidc = read_smi_reg(inst, SMIDC); -+ -+ settings->pack_data = (read_smi_reg(inst, SMICS) & SMICS_PXLDAT) ? -+ true : false; -+ -+ settings->data_width = GET_BIT_FIELD(smidsr, SMIDSR_RWIDTH); -+ settings->read_setup_time = GET_BIT_FIELD(smidsr, SMIDSR_RSETUP); -+ settings->read_hold_time = GET_BIT_FIELD(smidsr, SMIDSR_RHOLD); -+ settings->read_pace_time = GET_BIT_FIELD(smidsr, SMIDSR_RPACE); -+ settings->read_strobe_time = GET_BIT_FIELD(smidsr, SMIDSR_RSTROBE); -+ -+ settings->write_setup_time = GET_BIT_FIELD(smidsw, SMIDSW_WSETUP); -+ settings->write_hold_time = GET_BIT_FIELD(smidsw, SMIDSW_WHOLD); -+ settings->write_pace_time = GET_BIT_FIELD(smidsw, SMIDSW_WPACE); -+ settings->write_strobe_time = GET_BIT_FIELD(smidsw, SMIDSW_WSTROBE); -+ -+ settings->dma_read_thresh = GET_BIT_FIELD(smidc, SMIDC_REQR); -+ settings->dma_write_thresh = GET_BIT_FIELD(smidc, SMIDC_REQW); -+ settings->dma_panic_read_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICR); -+ settings->dma_panic_write_thresh = GET_BIT_FIELD(smidc, SMIDC_PANICW); -+ settings->dma_passthrough_enable = (smidc & SMIDC_DMAP) ? true : false; -+ settings->dma_enable = (smidc & SMIDC_DMAEN) ? true : false; -+ -+ spin_unlock(&inst->transaction_lock); -+ -+ return settings; -+} -+EXPORT_SYMBOL(bcm2835_smi_get_settings_from_regs); -+ -+static inline void smi_set_address(struct bcm2835_smi_instance *inst, -+ unsigned int address) -+{ -+ int smia_temp = 0, smida_temp = 0; -+ -+ SET_BIT_FIELD(smia_temp, SMIA_ADDR, address); -+ SET_BIT_FIELD(smida_temp, SMIDA_ADDR, address); -+ -+ /* Write to both address registers - user doesn't care whether we're -+ doing programmed or direct transfers. */ -+ write_smi_reg(inst, smia_temp, SMIA); -+ write_smi_reg(inst, smida_temp, SMIDA); -+} -+ -+static void smi_setup_regs(struct bcm2835_smi_instance *inst) -+{ -+ -+ dev_dbg(inst->dev, "Initialising SMI registers..."); -+ /* Disable the peripheral if already enabled */ -+ write_smi_reg(inst, 0, SMICS); -+ write_smi_reg(inst, 0, SMIDCS); -+ -+ smi_get_default_settings(inst); -+ bcm2835_smi_set_regs_from_settings(inst); -+ smi_set_address(inst, 0); -+ -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ENABLE, SMICS); -+ write_smi_reg(inst, read_smi_reg(inst, SMIDCS) | SMIDCS_ENABLE, -+ SMIDCS); -+} -+ -+/**************************************************************************** -+* -+* Low-level SMI access functions -+* Other modules should use the exported higher-level functions e.g. -+* bcm2835_smi_write_buf() unless they have a good reason to use these -+* -+***************************************************************************/ -+ -+static inline uint32_t smi_read_single_word(struct bcm2835_smi_instance *inst) -+{ -+ int timeout = 0; -+ -+ write_smi_reg(inst, SMIDCS_ENABLE, SMIDCS); -+ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_START, SMIDCS); -+ /* Make sure things happen in the right order...*/ -+ mb(); -+ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && -+ ++timeout < 10000) -+ ; -+ if (timeout < 10000) -+ return read_smi_reg(inst, SMIDD); -+ -+ dev_err(inst->dev, -+ "SMI direct read timed out (is the clock set up correctly?)"); -+ return 0; -+} -+ -+static inline void smi_write_single_word(struct bcm2835_smi_instance *inst, -+ uint32_t data) -+{ -+ int timeout = 0; -+ -+ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE, SMIDCS); -+ write_smi_reg(inst, data, SMIDD); -+ write_smi_reg(inst, SMIDCS_ENABLE | SMIDCS_WRITE | SMIDCS_START, -+ SMIDCS); -+ -+ while (!(read_smi_reg(inst, SMIDCS) & SMIDCS_DONE) && -+ ++timeout < 10000) -+ ; -+ if (timeout >= 10000) -+ dev_err(inst->dev, -+ "SMI direct write timed out (is the clock set up correctly?)"); -+} -+ -+/* Initiates a programmed read into the read FIFO. It is up to the caller to -+ * read data from the FIFO - either via paced DMA transfer, -+ * or polling SMICS_RXD to check whether data is available. -+ * SMICS_ACTIVE will go low upon completion. */ -+static void smi_init_programmed_read(struct bcm2835_smi_instance *inst, -+ int num_transfers) -+{ -+ int smics_temp; -+ -+ /* Disable the peripheral: */ -+ smics_temp = read_smi_reg(inst, SMICS) & ~(SMICS_ENABLE | SMICS_WRITE); -+ write_smi_reg(inst, smics_temp, SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) -+ ; -+ -+ /* Program the transfer count: */ -+ write_smi_reg(inst, num_transfers, SMIL); -+ -+ /* re-enable and start: */ -+ smics_temp |= SMICS_ENABLE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ smics_temp |= SMICS_CLEAR; -+ /* Just to be certain: */ -+ mb(); -+ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) -+ ; -+ write_smi_reg(inst, smics_temp, SMICS); -+ smics_temp |= SMICS_START; -+ write_smi_reg(inst, smics_temp, SMICS); -+} -+ -+/* Initiates a programmed write sequence, using data from the write FIFO. -+ * It is up to the caller to initiate a DMA transfer before calling, -+ * or use another method to keep the write FIFO topped up. -+ * SMICS_ACTIVE will go low upon completion. -+ */ -+static void smi_init_programmed_write(struct bcm2835_smi_instance *inst, -+ int num_transfers) -+{ -+ int smics_temp; -+ -+ /* Disable the peripheral: */ -+ smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ENABLE) -+ ; -+ -+ /* Program the transfer count: */ -+ write_smi_reg(inst, num_transfers, SMIL); -+ -+ /* setup, re-enable and start: */ -+ smics_temp |= SMICS_WRITE | SMICS_ENABLE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ smics_temp |= SMICS_START; -+ write_smi_reg(inst, smics_temp, SMICS); -+} -+ -+/* Initiate a read and then poll FIFO for data, reading out as it appears. */ -+static void smi_read_fifo(struct bcm2835_smi_instance *inst, -+ uint32_t *dest, int n_bytes) -+{ -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { -+ smi_dump_context_labelled(inst, -+ "WARNING: read FIFO not empty at start of read call."); -+ while (read_smi_reg(inst, SMICS)) -+ ; -+ } -+ -+ /* Dispatch the read: */ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_read(inst, n_bytes); -+ else if (inst->settings.data_width == SMI_WIDTH_16BIT) -+ smi_init_programmed_read(inst, n_bytes / 2); -+ else { -+ dev_err(inst->dev, "Unsupported data width for read."); -+ return; -+ } -+ -+ /* Poll FIFO to keep it empty */ -+ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) -+ *dest++ = read_smi_reg(inst, SMID); -+ -+ /* Ensure that the FIFO is emptied */ -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) { -+ int fifo_count; -+ -+ fifo_count = GET_BIT_FIELD(read_smi_reg(inst, SMIFD), -+ SMIFD_FCNT); -+ while (fifo_count--) -+ *dest++ = read_smi_reg(inst, SMID); -+ } -+ -+ if (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) -+ smi_dump_context_labelled(inst, -+ "WARNING: transaction finished but done bit not set."); -+ -+ if (read_smi_reg(inst, SMICS) & SMICS_RXD) -+ smi_dump_context_labelled(inst, -+ "WARNING: read FIFO not empty at end of read call."); -+ -+} -+ -+/* Initiate a write, and then keep the FIFO topped up. */ -+static void smi_write_fifo(struct bcm2835_smi_instance *inst, -+ uint32_t *src, int n_bytes) -+{ -+ int i, timeout = 0; -+ -+ /* Empty FIFOs if not already so */ -+ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) { -+ smi_dump_context_labelled(inst, -+ "WARNING: write fifo not empty at start of write call."); -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_CLEAR, -+ SMICS); -+ } -+ -+ /* Initiate the transfer */ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_write(inst, n_bytes); -+ else if (inst->settings.data_width == SMI_WIDTH_16BIT) -+ smi_init_programmed_write(inst, n_bytes / 2); -+ else { -+ dev_err(inst->dev, "Unsupported data width for write."); -+ return; -+ } -+ /* Fill the FIFO: */ -+ for (i = 0; i < (n_bytes - 1) / 4 + 1; ++i) { -+ while (!(read_smi_reg(inst, SMICS) & SMICS_TXD)) -+ ; -+ write_smi_reg(inst, *src++, SMID); -+ } -+ /* Busy wait... */ -+ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE) && ++timeout < -+ 1000000) -+ ; -+ if (timeout >= 1000000) -+ smi_dump_context_labelled(inst, -+ "Timed out on write operation!"); -+ if (!(read_smi_reg(inst, SMICS) & SMICS_TXE)) -+ smi_dump_context_labelled(inst, -+ "WARNING: FIFO not empty at end of write operation."); -+} -+ -+/**************************************************************************** -+* -+* SMI DMA operations -+* -+***************************************************************************/ -+ -+/* Disable SMI and put it into the correct direction before doing DMA setup. -+ Stops spurious DREQs during setup. Peripheral is re-enabled by init_*() */ -+static void smi_disable(struct bcm2835_smi_instance *inst, -+ enum dma_transfer_direction direction) -+{ -+ int smics_temp = read_smi_reg(inst, SMICS) & ~SMICS_ENABLE; -+ -+ if (direction == DMA_DEV_TO_MEM) -+ smics_temp &= ~SMICS_WRITE; -+ else -+ smics_temp |= SMICS_WRITE; -+ write_smi_reg(inst, smics_temp, SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) -+ ; -+} -+ -+static struct scatterlist *smi_scatterlist_from_buffer( -+ struct bcm2835_smi_instance *inst, -+ dma_addr_t buf, -+ size_t len, -+ struct scatterlist *sg) -+{ -+ sg_init_table(sg, 1); -+ sg_dma_address(sg) = buf; -+ sg_dma_len(sg) = len; -+ return sg; -+} -+ -+static void smi_dma_callback_user_copy(void *param) -+{ -+ /* Notify the bottom half that a chunk is ready for user copy */ -+ struct bcm2835_smi_instance *inst = -+ (struct bcm2835_smi_instance *)param; -+ -+ up(&inst->bounce.callback_sem); -+} -+ -+/* Creates a descriptor, assigns the given callback, and submits the -+ descriptor to dmaengine. Does not block - can queue up multiple -+ descriptors and then wait for them all to complete. -+ sg_len is the number of control blocks, NOT the number of bytes. -+ dir can be DMA_MEM_TO_DEV or DMA_DEV_TO_MEM. -+ callback can be NULL - in this case it is not called. */ -+static inline struct dma_async_tx_descriptor *smi_dma_submit_sgl( -+ struct bcm2835_smi_instance *inst, -+ struct scatterlist *sgl, -+ size_t sg_len, -+ enum dma_transfer_direction dir, -+ dma_async_tx_callback callback) -+{ -+ struct dma_async_tx_descriptor *desc; -+ -+ desc = dmaengine_prep_slave_sg(inst->dma_chan, -+ sgl, -+ sg_len, -+ dir, -+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK | -+ DMA_PREP_FENCE); -+ if (!desc) { -+ dev_err(inst->dev, "read_sgl: dma slave preparation failed!"); -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) & ~SMICS_ACTIVE, -+ SMICS); -+ while (read_smi_reg(inst, SMICS) & SMICS_ACTIVE) -+ cpu_relax(); -+ write_smi_reg(inst, read_smi_reg(inst, SMICS) | SMICS_ACTIVE, -+ SMICS); -+ return NULL; -+ } -+ desc->callback = callback; -+ desc->callback_param = inst; -+ if (dmaengine_submit(desc) < 0) -+ return NULL; -+ return desc; -+} -+ -+/* NB this function blocks until the transfer is complete */ -+static void -+smi_dma_read_sgl(struct bcm2835_smi_instance *inst, -+ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) -+{ -+ struct dma_async_tx_descriptor *desc; -+ -+ /* Disable SMI and set to read before dispatching DMA - if SMI is in -+ * write mode and TX fifo is empty, it will generate a DREQ which may -+ * cause the read DMA to complete before the SMI read command is even -+ * dispatched! We want to dispatch DMA before SMI read so that reading -+ * is gapless, for logic analyser. -+ */ -+ -+ smi_disable(inst, DMA_DEV_TO_MEM); -+ -+ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_DEV_TO_MEM, NULL); -+ dma_async_issue_pending(inst->dma_chan); -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_read(inst, n_bytes); -+ else -+ smi_init_programmed_read(inst, n_bytes / 2); -+ -+ if (dma_wait_for_async_tx(desc) == DMA_ERROR) -+ smi_dump_context_labelled(inst, "DMA timeout!"); -+} -+ -+static void -+smi_dma_write_sgl(struct bcm2835_smi_instance *inst, -+ struct scatterlist *sgl, size_t sg_len, size_t n_bytes) -+{ -+ struct dma_async_tx_descriptor *desc; -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ smi_init_programmed_write(inst, n_bytes); -+ else -+ smi_init_programmed_write(inst, n_bytes / 2); -+ -+ desc = smi_dma_submit_sgl(inst, sgl, sg_len, DMA_MEM_TO_DEV, NULL); -+ dma_async_issue_pending(inst->dma_chan); -+ -+ if (dma_wait_for_async_tx(desc) == DMA_ERROR) -+ smi_dump_context_labelled(inst, "DMA timeout!"); -+ else -+ /* Wait for SMI to finish our writes */ -+ while (!(read_smi_reg(inst, SMICS) & SMICS_DONE)) -+ cpu_relax(); -+} -+ -+ssize_t bcm2835_smi_user_dma( -+ struct bcm2835_smi_instance *inst, -+ enum dma_transfer_direction dma_dir, -+ char __user *user_ptr, size_t count, -+ struct bcm2835_smi_bounce_info **bounce) -+{ -+ int chunk_no = 0, chunk_size, count_left = count; -+ struct scatterlist *sgl; -+ void (*init_trans_func)(struct bcm2835_smi_instance *, int); -+ -+ spin_lock(&inst->transaction_lock); -+ -+ if (dma_dir == DMA_DEV_TO_MEM) -+ init_trans_func = smi_init_programmed_read; -+ else -+ init_trans_func = smi_init_programmed_write; -+ -+ smi_disable(inst, dma_dir); -+ -+ sema_init(&inst->bounce.callback_sem, 0); -+ if (bounce) -+ *bounce = &inst->bounce; -+ while (count_left) { -+ chunk_size = count_left > DMA_BOUNCE_BUFFER_SIZE ? -+ DMA_BOUNCE_BUFFER_SIZE : count_left; -+ if (chunk_size == DMA_BOUNCE_BUFFER_SIZE) { -+ sgl = -+ &inst->bounce.sgl[chunk_no % DMA_BOUNCE_BUFFER_COUNT]; -+ } else { -+ sgl = smi_scatterlist_from_buffer( -+ inst, -+ inst->bounce.phys[ -+ chunk_no % DMA_BOUNCE_BUFFER_COUNT], -+ chunk_size, -+ &inst->buffer_sgl); -+ } -+ -+ if (!smi_dma_submit_sgl(inst, sgl, 1, dma_dir, -+ smi_dma_callback_user_copy -+ )) { -+ dev_err(inst->dev, "sgl submit failed"); -+ count = 0; -+ goto out; -+ } -+ count_left -= chunk_size; -+ chunk_no++; -+ } -+ dma_async_issue_pending(inst->dma_chan); -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) -+ init_trans_func(inst, count); -+ else if (inst->settings.data_width == SMI_WIDTH_16BIT) -+ init_trans_func(inst, count / 2); -+out: -+ spin_unlock(&inst->transaction_lock); -+ return count; -+} -+EXPORT_SYMBOL(bcm2835_smi_user_dma); -+ -+ -+/**************************************************************************** -+* -+* High level buffer transfer functions - for use by other drivers -+* -+***************************************************************************/ -+ -+/* Buffer must be physically contiguous - i.e. kmalloc, not vmalloc! */ -+void bcm2835_smi_write_buf( -+ struct bcm2835_smi_instance *inst, -+ const void *buf, size_t n_bytes) -+{ -+ int odd_bytes = n_bytes & 0x3; -+ -+ n_bytes -= odd_bytes; -+ -+ spin_lock(&inst->transaction_lock); -+ -+ if (n_bytes > DMA_THRESHOLD_BYTES) { -+ dma_addr_t phy_addr = dma_map_single( -+ inst->dev, -+ (void *)buf, -+ n_bytes, -+ DMA_MEM_TO_DEV); -+ struct scatterlist *sgl = -+ smi_scatterlist_from_buffer(inst, phy_addr, n_bytes, -+ &inst->buffer_sgl); -+ -+ if (!sgl) { -+ smi_dump_context_labelled(inst, -+ "Error: could not create scatterlist for write!"); -+ goto out; -+ } -+ smi_dma_write_sgl(inst, sgl, 1, n_bytes); -+ -+ dma_unmap_single -+ (inst->dev, phy_addr, n_bytes, DMA_MEM_TO_DEV); -+ } else if (n_bytes) { -+ smi_write_fifo(inst, (uint32_t *) buf, n_bytes); -+ } -+ buf += n_bytes; -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) { -+ while (odd_bytes--) -+ smi_write_single_word(inst, *(uint8_t *) (buf++)); -+ } else { -+ while (odd_bytes >= 2) { -+ smi_write_single_word(inst, *(uint16_t *)buf); -+ buf += 2; -+ odd_bytes -= 2; -+ } -+ if (odd_bytes) { -+ /* Reading an odd number of bytes on a 16 bit bus is -+ a user bug. It's kinder to fail early and tell them -+ than to e.g. transparently give them the bottom byte -+ of a 16 bit transfer. */ -+ dev_err(inst->dev, -+ "WARNING: odd number of bytes specified for wide transfer."); -+ dev_err(inst->dev, -+ "At least one byte dropped as a result."); -+ dump_stack(); -+ } -+ } -+out: -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_write_buf); -+ -+void bcm2835_smi_read_buf(struct bcm2835_smi_instance *inst, -+ void *buf, size_t n_bytes) -+{ -+ -+ /* SMI is inherently 32-bit, which causes surprising amounts of mess -+ for bytes % 4 != 0. Easiest to avoid this mess altogether -+ by handling remainder separately. */ -+ int odd_bytes = n_bytes & 0x3; -+ -+ spin_lock(&inst->transaction_lock); -+ n_bytes -= odd_bytes; -+ if (n_bytes > DMA_THRESHOLD_BYTES) { -+ dma_addr_t phy_addr = dma_map_single(inst->dev, -+ buf, n_bytes, -+ DMA_DEV_TO_MEM); -+ struct scatterlist *sgl = smi_scatterlist_from_buffer( -+ inst, phy_addr, n_bytes, -+ &inst->buffer_sgl); -+ if (!sgl) { -+ smi_dump_context_labelled(inst, -+ "Error: could not create scatterlist for read!"); -+ goto out; -+ } -+ smi_dma_read_sgl(inst, sgl, 1, n_bytes); -+ dma_unmap_single(inst->dev, phy_addr, n_bytes, DMA_DEV_TO_MEM); -+ } else if (n_bytes) { -+ smi_read_fifo(inst, (uint32_t *)buf, n_bytes); -+ } -+ buf += n_bytes; -+ -+ if (inst->settings.data_width == SMI_WIDTH_8BIT) { -+ while (odd_bytes--) -+ *((uint8_t *) (buf++)) = smi_read_single_word(inst); -+ } else { -+ while (odd_bytes >= 2) { -+ *(uint16_t *) buf = smi_read_single_word(inst); -+ buf += 2; -+ odd_bytes -= 2; -+ } -+ if (odd_bytes) { -+ dev_err(inst->dev, -+ "WARNING: odd number of bytes specified for wide transfer."); -+ dev_err(inst->dev, -+ "At least one byte dropped as a result."); -+ dump_stack(); -+ } -+ } -+out: -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_read_buf); -+ -+void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, -+ unsigned int address) -+{ -+ spin_lock(&inst->transaction_lock); -+ smi_set_address(inst, address); -+ spin_unlock(&inst->transaction_lock); -+} -+EXPORT_SYMBOL(bcm2835_smi_set_address); -+ -+struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node) -+{ -+ struct platform_device *pdev; -+ -+ if (!node) -+ return NULL; -+ -+ pdev = of_find_device_by_node(node); -+ if (!pdev) -+ return NULL; -+ -+ return platform_get_drvdata(pdev); -+} -+EXPORT_SYMBOL(bcm2835_smi_get); -+ -+/**************************************************************************** -+* -+* bcm2835_smi_probe - called when the driver is loaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_dma_setup(struct bcm2835_smi_instance *inst) -+{ -+ int i, rv = 0; -+ -+ inst->dma_chan = dma_request_slave_channel(inst->dev, "rx-tx"); -+ -+ inst->dma_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ inst->dma_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ inst->dma_config.src_addr = inst->smi_regs_busaddr + SMID; -+ inst->dma_config.dst_addr = inst->dma_config.src_addr; -+ /* Direction unimportant - always overridden by prep_slave_sg */ -+ inst->dma_config.direction = DMA_DEV_TO_MEM; -+ dmaengine_slave_config(inst->dma_chan, &inst->dma_config); -+ /* Alloc and map bounce buffers */ -+ for (i = 0; i < DMA_BOUNCE_BUFFER_COUNT; ++i) { -+ inst->bounce.buffer[i] = -+ dmam_alloc_coherent(inst->dev, DMA_BOUNCE_BUFFER_SIZE, -+ &inst->bounce.phys[i], -+ GFP_KERNEL); -+ if (!inst->bounce.buffer[i]) { -+ dev_err(inst->dev, "Could not allocate buffer!"); -+ rv = -ENOMEM; -+ break; -+ } -+ smi_scatterlist_from_buffer( -+ inst, -+ inst->bounce.phys[i], -+ DMA_BOUNCE_BUFFER_SIZE, -+ &inst->bounce.sgl[i] -+ ); -+ } -+ -+ return rv; -+} -+ -+static int bcm2835_smi_probe(struct platform_device *pdev) -+{ -+ int err; -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node; -+ struct resource *ioresource; -+ struct bcm2835_smi_instance *inst; -+ -+ /* Allocate buffers and instance data */ -+ -+ inst = devm_kzalloc(dev, sizeof(struct bcm2835_smi_instance), -+ GFP_KERNEL); -+ -+ if (!inst) -+ return -ENOMEM; -+ -+ inst->dev = dev; -+ spin_lock_init(&inst->transaction_lock); -+ -+ /* We require device tree support */ -+ if (!node) -+ return -EINVAL; -+ -+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -+ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ inst->cm_smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -+ inst->smi_regs_busaddr = be32_to_cpu( -+ *of_get_address(node, 0, NULL, NULL)); -+ of_property_read_u32(node, -+ "brcm,smi-clock-source", -+ &inst->clock_source); -+ of_property_read_u32(node, -+ "brcm,smi-clock-divisor", -+ &inst->clock_divisor); -+ -+ err = bcm2835_smi_dma_setup(inst); -+ if (err) -+ return err; -+ -+ /* Finally, do peripheral setup */ -+ -+ smi_setup_clock(inst); -+ smi_setup_regs(inst); -+ -+ platform_set_drvdata(pdev, inst); -+ -+ dev_info(inst->dev, "initialised"); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* bcm2835_smi_remove - called when the driver is unloaded. -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_smi_instance *inst = platform_get_drvdata(pdev); -+ struct device *dev = inst->dev; -+ -+ dev_info(dev, "SMI device removed - OK"); -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_smi_of_match[] = { -+ {.compatible = "brcm,bcm2835-smi",}, -+ { /* sentinel */ }, -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_smi_of_match); -+ -+static struct platform_driver bcm2835_smi_driver = { -+ .probe = bcm2835_smi_probe, -+ .remove = bcm2835_smi_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_smi_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_smi_driver); -+ -+MODULE_ALIAS("platform:smi-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("Device driver for BCM2835's secondary memory interface"); -+MODULE_AUTHOR("Luke Wren "); -diff --git a/include/linux/broadcom/bcm2835_smi.h b/include/linux/broadcom/bcm2835_smi.h -new file mode 100644 -index 0000000000000000000000000000000000000000..ee3a75edfc033eeb0d90a687ffb68b10fd8543a3 ---- /dev/null -+++ b/include/linux/broadcom/bcm2835_smi.h -@@ -0,0 +1,391 @@ -+/** -+ * Declarations and definitions for Broadcom's Secondary Memory Interface -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * Copyright (c) 2010-2012 Broadcom. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#ifndef BCM2835_SMI_H -+#define BCM2835_SMI_H -+ -+#include -+ -+#ifndef __KERNEL__ -+#include -+#include -+#endif -+ -+#define BCM2835_SMI_IOC_MAGIC 0x1 -+#define BCM2835_SMI_INVALID_HANDLE (~0) -+ -+/* IOCTLs 0x100...0x1ff are not device-specific - we can use them */ -+#define BCM2835_SMI_IOC_GET_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 0) -+#define BCM2835_SMI_IOC_WRITE_SETTINGS _IO(BCM2835_SMI_IOC_MAGIC, 1) -+#define BCM2835_SMI_IOC_ADDRESS _IO(BCM2835_SMI_IOC_MAGIC, 2) -+#define BCM2835_SMI_IOC_MAX 2 -+ -+#define SMI_WIDTH_8BIT 0 -+#define SMI_WIDTH_16BIT 1 -+#define SMI_WIDTH_9BIT 2 -+#define SMI_WIDTH_18BIT 3 -+ -+/* max number of bytes where DMA will not be used */ -+#define DMA_THRESHOLD_BYTES 128 -+#define DMA_BOUNCE_BUFFER_SIZE (1024 * 1024 / 2) -+#define DMA_BOUNCE_BUFFER_COUNT 3 -+ -+ -+struct smi_settings { -+ int data_width; -+ /* Whether or not to pack multiple SMI transfers into a -+ single 32 bit FIFO word */ -+ bool pack_data; -+ -+ /* Timing for reads (writes the same but for WE) -+ * -+ * OE ----------+ +-------------------- -+ * | | -+ * +----------+ -+ * SD -<==============================>----------- -+ * SA -<=========================================>- -+ * <-setup-> <-strobe -> <-hold -> <- pace -> -+ */ -+ -+ int read_setup_time; -+ int read_hold_time; -+ int read_pace_time; -+ int read_strobe_time; -+ -+ int write_setup_time; -+ int write_hold_time; -+ int write_pace_time; -+ int write_strobe_time; -+ -+ bool dma_enable; /* DREQs */ -+ bool dma_passthrough_enable; /* External DREQs */ -+ int dma_read_thresh; -+ int dma_write_thresh; -+ int dma_panic_read_thresh; -+ int dma_panic_write_thresh; -+}; -+ -+/**************************************************************************** -+* -+* Declare exported SMI functions -+* -+***************************************************************************/ -+ -+#ifdef __KERNEL__ -+ -+#include /* for enum dma_transfer_direction */ -+#include -+#include -+ -+struct bcm2835_smi_instance; -+ -+struct bcm2835_smi_bounce_info { -+ struct semaphore callback_sem; -+ void *buffer[DMA_BOUNCE_BUFFER_COUNT]; -+ dma_addr_t phys[DMA_BOUNCE_BUFFER_COUNT]; -+ struct scatterlist sgl[DMA_BOUNCE_BUFFER_COUNT]; -+}; -+ -+ -+void bcm2835_smi_set_regs_from_settings(struct bcm2835_smi_instance *); -+ -+struct smi_settings *bcm2835_smi_get_settings_from_regs( -+ struct bcm2835_smi_instance *inst); -+ -+void bcm2835_smi_write_buf( -+ struct bcm2835_smi_instance *inst, -+ const void *buf, -+ size_t n_bytes); -+ -+void bcm2835_smi_read_buf( -+ struct bcm2835_smi_instance *inst, -+ void *buf, -+ size_t n_bytes); -+ -+void bcm2835_smi_set_address(struct bcm2835_smi_instance *inst, -+ unsigned int address); -+ -+ssize_t bcm2835_smi_user_dma( -+ struct bcm2835_smi_instance *inst, -+ enum dma_transfer_direction dma_dir, -+ char __user *user_ptr, -+ size_t count, -+ struct bcm2835_smi_bounce_info **bounce); -+ -+struct bcm2835_smi_instance *bcm2835_smi_get(struct device_node *node); -+ -+#endif /* __KERNEL__ */ -+ -+/**************************************************************** -+* -+* Implementation-only declarations -+* -+****************************************************************/ -+ -+#ifdef BCM2835_SMI_IMPLEMENTATION -+ -+/* Clock manager registers for SMI clock: */ -+#define CM_SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x1010b0) -+/* Clock manager "password" to protect registers from spurious writes */ -+#define CM_PWD (0x5a << 24) -+ -+#define CM_SMI_CTL 0x00 -+#define CM_SMI_DIV 0x04 -+ -+#define CM_SMI_CTL_FLIP (1 << 8) -+#define CM_SMI_CTL_BUSY (1 << 7) -+#define CM_SMI_CTL_KILL (1 << 5) -+#define CM_SMI_CTL_ENAB (1 << 4) -+#define CM_SMI_CTL_SRC_MASK (0xf) -+#define CM_SMI_CTL_SRC_OFFS (0) -+ -+#define CM_SMI_DIV_DIVI_MASK (0xf << 12) -+#define CM_SMI_DIV_DIVI_OFFS (12) -+#define CM_SMI_DIV_DIVF_MASK (0xff << 4) -+#define CM_SMI_DIV_DIVF_OFFS (4) -+ -+/* SMI register mapping:*/ -+#define SMI_BASE_ADDRESS ((BCM2708_PERI_BASE) + 0x600000) -+ -+#define SMICS 0x00 /* control + status register */ -+#define SMIL 0x04 /* length/count (n external txfers) */ -+#define SMIA 0x08 /* address register */ -+#define SMID 0x0c /* data register */ -+#define SMIDSR0 0x10 /* device 0 read settings */ -+#define SMIDSW0 0x14 /* device 0 write settings */ -+#define SMIDSR1 0x18 /* device 1 read settings */ -+#define SMIDSW1 0x1c /* device 1 write settings */ -+#define SMIDSR2 0x20 /* device 2 read settings */ -+#define SMIDSW2 0x24 /* device 2 write settings */ -+#define SMIDSR3 0x28 /* device 3 read settings */ -+#define SMIDSW3 0x2c /* device 3 write settings */ -+#define SMIDC 0x30 /* DMA control registers */ -+#define SMIDCS 0x34 /* direct control/status register */ -+#define SMIDA 0x38 /* direct address register */ -+#define SMIDD 0x3c /* direct data registers */ -+#define SMIFD 0x40 /* FIFO debug register */ -+ -+ -+ -+/* Control and Status register bits: -+ * SMICS_RXF : RX fifo full: 1 when RX fifo is full -+ * SMICS_TXE : TX fifo empty: 1 when empty. -+ * SMICS_RXD : RX fifo contains data: 1 when there is data. -+ * SMICS_TXD : TX fifo can accept data: 1 when true. -+ * SMICS_RXR : RX fifo needs reading: 1 when fifo more than 3/4 full, or -+ * when "DONE" and fifo not emptied. -+ * SMICS_TXW : TX fifo needs writing: 1 when less than 1/4 full. -+ * SMICS_AFERR : AXI FIFO error: 1 when fifo read when empty or written -+ * when full. Write 1 to clear. -+ * SMICS_EDREQ : 1 when external DREQ received. -+ * SMICS_PXLDAT : Pixel data: write 1 to enable pixel transfer modes. -+ * SMICS_SETERR : 1 if there was an error writing to setup regs (e.g. -+ * tx was in progress). Write 1 to clear. -+ * SMICS_PVMODE : Set to 1 to enable pixel valve mode. -+ * SMICS_INTR : Set to 1 to enable interrupt on RX. -+ * SMICS_INTT : Set to 1 to enable interrupt on TX. -+ * SMICS_INTD : Set to 1 to enable interrupt on DONE condition. -+ * SMICS_TEEN : Tear effect mode enabled: Programmed transfers will wait -+ * for a TE trigger before writing. -+ * SMICS_PAD1 : Padding settings for external transfers. For writes: the -+ * number of bytes initially written to the TX fifo that -+ * SMICS_PAD0 : should be ignored. For reads: the number of bytes that will -+ * be read before the data, and should be dropped. -+ * SMICS_WRITE : Transfer direction: 1 = write to external device, 0 = read -+ * SMICS_CLEAR : Write 1 to clear the FIFOs. -+ * SMICS_START : Write 1 to start the programmed transfer. -+ * SMICS_ACTIVE : Reads as 1 when a programmed transfer is underway. -+ * SMICS_DONE : Reads as 1 when transfer finished. For RX, not set until -+ * FIFO emptied. -+ * SMICS_ENABLE : Set to 1 to enable the SMI peripheral, 0 to disable. -+ */ -+ -+#define SMICS_RXF (1 << 31) -+#define SMICS_TXE (1 << 30) -+#define SMICS_RXD (1 << 29) -+#define SMICS_TXD (1 << 28) -+#define SMICS_RXR (1 << 27) -+#define SMICS_TXW (1 << 26) -+#define SMICS_AFERR (1 << 25) -+#define SMICS_EDREQ (1 << 15) -+#define SMICS_PXLDAT (1 << 14) -+#define SMICS_SETERR (1 << 13) -+#define SMICS_PVMODE (1 << 12) -+#define SMICS_INTR (1 << 11) -+#define SMICS_INTT (1 << 10) -+#define SMICS_INTD (1 << 9) -+#define SMICS_TEEN (1 << 8) -+#define SMICS_PAD1 (1 << 7) -+#define SMICS_PAD0 (1 << 6) -+#define SMICS_WRITE (1 << 5) -+#define SMICS_CLEAR (1 << 4) -+#define SMICS_START (1 << 3) -+#define SMICS_ACTIVE (1 << 2) -+#define SMICS_DONE (1 << 1) -+#define SMICS_ENABLE (1 << 0) -+ -+/* Address register bits: */ -+ -+#define SMIA_DEVICE_MASK ((1 << 9) | (1 << 8)) -+#define SMIA_DEVICE_OFFS (8) -+#define SMIA_ADDR_MASK (0x3f) /* bits 5 -> 0 */ -+#define SMIA_ADDR_OFFS (0) -+ -+/* DMA control register bits: -+ * SMIDC_DMAEN : DMA enable: set 1: DMA requests will be issued. -+ * SMIDC_DMAP : DMA passthrough: when set to 0, top two data pins are used by -+ * SMI as usual. When set to 1, the top two pins are used for -+ * external DREQs: pin 16 read request, 17 write. -+ * SMIDC_PANIC* : Threshold at which DMA will panic during read/write. -+ * SMIDC_REQ* : Threshold at which DMA will generate a DREQ. -+ */ -+ -+#define SMIDC_DMAEN (1 << 28) -+#define SMIDC_DMAP (1 << 24) -+#define SMIDC_PANICR_MASK (0x3f << 18) -+#define SMIDC_PANICR_OFFS (18) -+#define SMIDC_PANICW_MASK (0x3f << 12) -+#define SMIDC_PANICW_OFFS (12) -+#define SMIDC_REQR_MASK (0x3f << 6) -+#define SMIDC_REQR_OFFS (6) -+#define SMIDC_REQW_MASK (0x3f) -+#define SMIDC_REQW_OFFS (0) -+ -+/* Device settings register bits: same for all 4 (or 3?) device register sets. -+ * Device read settings: -+ * SMIDSR_RWIDTH : Read transfer width. 00 = 8bit, 01 = 16bit, -+ * 10 = 18bit, 11 = 9bit. -+ * SMIDSR_RSETUP : Read setup time: number of core cycles between chip -+ * select/address and read strobe. Min 1, max 64. -+ * SMIDSR_MODE68 : 1 for System 68 mode (i.e. enable + direction pins, -+ * rather than OE + WE pin) -+ * SMIDSR_FSETUP : If set to 1, setup time only applies to first -+ * transfer after address change. -+ * SMIDSR_RHOLD : Number of core cycles between read strobe going -+ * inactive and CS/address going inactive. Min 1, max 64 -+ * SMIDSR_RPACEALL : When set to 1, this device's RPACE value will always -+ * be used for the next transaction, even if it is not -+ * to this device. -+ * SMIDSR_RPACE : Number of core cycles spent waiting between CS -+ * deassert and start of next transfer. Min 1, max 128 -+ * SMIDSR_RDREQ : 1 = use external DMA request on SD16 to pace reads -+ * from device. Must also set DMAP in SMICS. -+ * SMIDSR_RSTROBE : Number of cycles to assert the read strobe. -+ * min 1, max 128. -+ */ -+#define SMIDSR_RWIDTH_MASK ((1<<31)|(1<<30)) -+#define SMIDSR_RWIDTH_OFFS (30) -+#define SMIDSR_RSETUP_MASK (0x3f << 24) -+#define SMIDSR_RSETUP_OFFS (24) -+#define SMIDSR_MODE68 (1 << 23) -+#define SMIDSR_FSETUP (1 << 22) -+#define SMIDSR_RHOLD_MASK (0x3f << 16) -+#define SMIDSR_RHOLD_OFFS (16) -+#define SMIDSR_RPACEALL (1 << 15) -+#define SMIDSR_RPACE_MASK (0x7f << 8) -+#define SMIDSR_RPACE_OFFS (8) -+#define SMIDSR_RDREQ (1 << 7) -+#define SMIDSR_RSTROBE_MASK (0x7f) -+#define SMIDSR_RSTROBE_OFFS (0) -+ -+/* Device write settings: -+ * SMIDSW_WWIDTH : Write transfer width. 00 = 8bit, 01 = 16bit, -+ * 10= 18bit, 11 = 9bit. -+ * SMIDSW_WSETUP : Number of cycles between CS assert and write strobe. -+ * Min 1, max 64. -+ * SMIDSW_WFORMAT : Pixel format of input. 0 = 16bit RGB 565, -+ * 1 = 32bit RGBA 8888 -+ * SMIDSW_WSWAP : 1 = swap pixel data bits. (Use with SMICS_PXLDAT) -+ * SMIDSW_WHOLD : Time between WE deassert and CS deassert. 1 to 64 -+ * SMIDSW_WPACEALL : 1: this device's WPACE will be used for the next -+ * transfer, regardless of that transfer's device. -+ * SMIDSW_WPACE : Cycles between CS deassert and next CS assert. -+ * Min 1, max 128 -+ * SMIDSW_WDREQ : Use external DREQ on pin 17 to pace writes. DMAP must -+ * be set in SMICS. -+ * SMIDSW_WSTROBE : Number of cycles to assert the write strobe. -+ * Min 1, max 128 -+ */ -+#define SMIDSW_WWIDTH_MASK ((1<<31)|(1<<30)) -+#define SMIDSW_WWIDTH_OFFS (30) -+#define SMIDSW_WSETUP_MASK (0x3f << 24) -+#define SMIDSW_WSETUP_OFFS (24) -+#define SMIDSW_WFORMAT (1 << 23) -+#define SMIDSW_WSWAP (1 << 22) -+#define SMIDSW_WHOLD_MASK (0x3f << 16) -+#define SMIDSW_WHOLD_OFFS (16) -+#define SMIDSW_WPACEALL (1 << 15) -+#define SMIDSW_WPACE_MASK (0x7f << 8) -+#define SMIDSW_WPACE_OFFS (8) -+#define SMIDSW_WDREQ (1 << 7) -+#define SMIDSW_WSTROBE_MASK (0x7f) -+#define SMIDSW_WSTROBE_OFFS (0) -+ -+/* Direct transfer control + status register -+ * SMIDCS_WRITE : Direction of transfer: 1 -> write, 0 -> read -+ * SMIDCS_DONE : 1 when a transfer has finished. Write 1 to clear. -+ * SMIDCS_START : Write 1 to start a transfer, if one is not already underway. -+ * SMIDCE_ENABLE: Write 1 to enable SMI in direct mode. -+ */ -+ -+#define SMIDCS_WRITE (1 << 3) -+#define SMIDCS_DONE (1 << 2) -+#define SMIDCS_START (1 << 1) -+#define SMIDCS_ENABLE (1 << 0) -+ -+/* Direct transfer address register -+ * SMIDA_DEVICE : Indicates which of the device settings banks should be used. -+ * SMIDA_ADDR : The value to be asserted on the address pins. -+ */ -+ -+#define SMIDA_DEVICE_MASK ((1<<9)|(1<<8)) -+#define SMIDA_DEVICE_OFFS (8) -+#define SMIDA_ADDR_MASK (0x3f) -+#define SMIDA_ADDR_OFFS (0) -+ -+/* FIFO debug register -+ * SMIFD_FLVL : The high-tide mark of FIFO count during the most recent txfer -+ * SMIFD_FCNT : The current FIFO count. -+ */ -+#define SMIFD_FLVL_MASK (0x3f << 8) -+#define SMIFD_FLVL_OFFS (8) -+#define SMIFD_FCNT_MASK (0x3f) -+#define SMIFD_FCNT_OFFS (0) -+ -+#endif /* BCM2835_SMI_IMPLEMENTATION */ -+ -+#endif /* BCM2835_SMI_H */ - -From 7df434185cb69481bdb857fb30c153685feb7c4e Mon Sep 17 00:00:00 2001 -From: Martin Sperl -Date: Tue, 26 Apr 2016 14:59:21 +0000 -Subject: [PATCH 043/122] MISC: bcm2835: smi: use clock manager and fix reload - issues - -Use clock manager instead of self-made clockmanager. - -Also fix some error paths that showd up during development -(especially missing release of dma resources on rmmod) - -Signed-off-by: Martin Sperl ---- - drivers/misc/bcm2835_smi.c | 86 +++++++++++++++------------------------------- - 1 file changed, 28 insertions(+), 58 deletions(-) - -diff --git a/drivers/misc/bcm2835_smi.c b/drivers/misc/bcm2835_smi.c -index 63a4ea08b9930a3a31a985f0a1d969b488ed49ec..1261540703127d1d63b9f3c87042c6e50d3fbec2 100644 ---- a/drivers/misc/bcm2835_smi.c -+++ b/drivers/misc/bcm2835_smi.c -@@ -34,6 +34,7 @@ - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -+#include - #include - #include - #include -@@ -62,7 +63,7 @@ - struct bcm2835_smi_instance { - struct device *dev; - struct smi_settings settings; -- __iomem void *smi_regs_ptr, *cm_smi_regs_ptr; -+ __iomem void *smi_regs_ptr; - dma_addr_t smi_regs_busaddr; - - struct dma_chan *dma_chan; -@@ -72,8 +73,7 @@ struct bcm2835_smi_instance { - - struct scatterlist buffer_sgl; - -- int clock_source; -- int clock_divisor; -+ struct clk *clk; - - /* Sometimes we are called into in an atomic context (e.g. by - JFFS2 + MTD) so we can't use a mutex */ -@@ -82,42 +82,6 @@ struct bcm2835_smi_instance { - - /**************************************************************************** - * --* SMI clock manager setup --* --***************************************************************************/ -- --static inline void write_smi_cm_reg(struct bcm2835_smi_instance *inst, -- u32 val, unsigned reg) --{ -- writel(CM_PWD | val, inst->cm_smi_regs_ptr + reg); --} -- --static inline u32 read_smi_cm_reg(struct bcm2835_smi_instance *inst, -- unsigned reg) --{ -- return readl(inst->cm_smi_regs_ptr + reg); --} -- --static void smi_setup_clock(struct bcm2835_smi_instance *inst) --{ -- dev_dbg(inst->dev, "Setting up clock..."); -- /* Disable SMI clock and wait for it to stop. */ -- write_smi_cm_reg(inst, 0, CM_SMI_CTL); -- while (read_smi_cm_reg(inst, CM_SMI_CTL) & CM_SMI_CTL_BUSY) -- ; -- -- write_smi_cm_reg(inst, (inst->clock_divisor << CM_SMI_DIV_DIVI_OFFS), -- CM_SMI_DIV); -- write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS), -- CM_SMI_CTL); -- -- /* Enable the clock */ -- write_smi_cm_reg(inst, (inst->clock_source << CM_SMI_CTL_SRC_OFFS) | -- CM_SMI_CTL_ENAB, CM_SMI_CTL); --} -- --/**************************************************************************** --* - * SMI peripheral setup - * - ***************************************************************************/ -@@ -894,42 +858,40 @@ static int bcm2835_smi_probe(struct platform_device *pdev) - struct device_node *node = dev->of_node; - struct resource *ioresource; - struct bcm2835_smi_instance *inst; -+ const __be32 *addr; - -+ /* We require device tree support */ -+ if (!node) -+ return -EINVAL; - /* Allocate buffers and instance data */ -- - inst = devm_kzalloc(dev, sizeof(struct bcm2835_smi_instance), - GFP_KERNEL); -- - if (!inst) - return -ENOMEM; - - inst->dev = dev; - spin_lock_init(&inst->transaction_lock); - -- /* We require device tree support */ -- if (!node) -- return -EINVAL; -- - ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); - inst->smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -- ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 1); -- inst->cm_smi_regs_ptr = devm_ioremap_resource(dev, ioresource); -- inst->smi_regs_busaddr = be32_to_cpu( -- *of_get_address(node, 0, NULL, NULL)); -- of_property_read_u32(node, -- "brcm,smi-clock-source", -- &inst->clock_source); -- of_property_read_u32(node, -- "brcm,smi-clock-divisor", -- &inst->clock_divisor); -+ if (IS_ERR(inst->smi_regs_ptr)) { -+ err = PTR_ERR(inst->smi_regs_ptr); -+ goto err; -+ } -+ addr = of_get_address(node, 0, NULL, NULL); -+ inst->smi_regs_busaddr = be32_to_cpu(addr); - - err = bcm2835_smi_dma_setup(inst); - if (err) -- return err; -+ goto err; - -- /* Finally, do peripheral setup */ -+ /* request clock */ -+ inst->clk = devm_clk_get(dev, NULL); -+ if (!inst->clk) -+ goto err; -+ clk_prepare_enable(inst->clk); - -- smi_setup_clock(inst); -+ /* Finally, do peripheral setup */ - smi_setup_regs(inst); - - platform_set_drvdata(pdev, inst); -@@ -937,6 +899,9 @@ static int bcm2835_smi_probe(struct platform_device *pdev) - dev_info(inst->dev, "initialised"); - - return 0; -+err: -+ kfree(inst); -+ return err; - } - - /**************************************************************************** -@@ -950,6 +915,11 @@ static int bcm2835_smi_remove(struct platform_device *pdev) - struct bcm2835_smi_instance *inst = platform_get_drvdata(pdev); - struct device *dev = inst->dev; - -+ dmaengine_terminate_all(inst->dma_chan); -+ dma_release_channel(inst->dma_chan); -+ -+ clk_disable_unprepare(inst->clk); -+ - dev_info(dev, "SMI device removed - OK"); - return 0; - } - -From e80a053c8ec7283b7c93f468b437c1e53ffdd5dc Mon Sep 17 00:00:00 2001 -From: Luke Wren -Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 044/122] Add SMI NAND driver - -Signed-off-by: Luke Wren ---- - .../bindings/mtd/brcm,bcm2835-smi-nand.txt | 42 ++++ - drivers/mtd/nand/Kconfig | 7 + - drivers/mtd/nand/Makefile | 1 + - drivers/mtd/nand/bcm2835_smi_nand.c | 267 +++++++++++++++++++++ - 4 files changed, 317 insertions(+) - create mode 100644 Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt - create mode 100644 drivers/mtd/nand/bcm2835_smi_nand.c - -diff --git a/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..159544d6579070d376d146bd24a86653e7245707 ---- /dev/null -+++ b/Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt -@@ -0,0 +1,42 @@ -+* BCM2835 SMI NAND flash -+ -+This driver is a shim between the BCM2835 SMI driver (SMI is a peripheral for -+talking to parallel register interfaces) and Linux's MTD layer. -+ -+Required properties: -+- compatible: "brcm,bcm2835-smi-nand" -+- status: "okay" -+ -+Optional properties: -+- partition@n, where n is an integer from a consecutive sequence starting at 0 -+ - Difficult to store partition table on NAND device - normally put it -+ in the source code, kernel bootparams, or device tree (the best way!) -+ - Sub-properties: -+ - label: the partition name, as shown by mtdinfo /dev/mtd* -+ - reg: the size and offset of this partition. -+ - (optional) read-only: an empty property flagging as read only -+ -+Example: -+ -+nand: flash@0 { -+ compatible = "brcm,bcm2835-smi-nand"; -+ status = "okay"; -+ -+ partition@0 { -+ label = "stage2"; -+ // 128k -+ reg = <0 0x20000>; -+ read-only; -+ }; -+ partition@1 { -+ label = "firmware"; -+ // 16M -+ reg = <0x20000 0x1000000>; -+ read-only; -+ }; -+ partition@2 { -+ label = "root"; -+ // 2G -+ reg = <0x1020000 0x80000000>; -+ }; -+}; -\ No newline at end of file -diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig -index 7b7a887b4709f0122f32b60833d8c2e36bc4dead..2db503816a8d5d763bef1b08e3f458d1a2e87751 100644 ---- a/drivers/mtd/nand/Kconfig -+++ b/drivers/mtd/nand/Kconfig -@@ -41,6 +41,13 @@ config MTD_SM_COMMON - tristate - default n - -+config MTD_NAND_BCM2835_SMI -+ tristate "Use Broadcom's Secondary Memory Interface as a NAND controller (BCM283x)" -+ depends on BCM2835_SMI -+ default m -+ help -+ Uses the BCM2835's SMI peripheral as a NAND controller. -+ - config MTD_NAND_DENALI - tristate - -diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile -index cafde6f3d95761263d4c5af1395b11bfc000ca9b..d399ab9c92350596ac0970fb1a2a70fa3ac0094b 100644 ---- a/drivers/mtd/nand/Makefile -+++ b/drivers/mtd/nand/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o - obj-$(CONFIG_MTD_NAND_DENALI_PCI) += denali_pci.o - obj-$(CONFIG_MTD_NAND_DENALI_DT) += denali_dt.o - obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o -+obj-$(CONFIG_MTD_NAND_BCM2835_SMI) += bcm2835_smi_nand.o - obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o - obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o - obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o -diff --git a/drivers/mtd/nand/bcm2835_smi_nand.c b/drivers/mtd/nand/bcm2835_smi_nand.c -new file mode 100644 -index 0000000000000000000000000000000000000000..02adda6da18bd0ba9ab19a104975b79de58bfdce ---- /dev/null -+++ b/drivers/mtd/nand/bcm2835_smi_nand.c -@@ -0,0 +1,267 @@ -+/** -+ * NAND flash driver for Broadcom Secondary Memory Interface -+ * -+ * Written by Luke Wren -+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define DEVICE_NAME "bcm2835-smi-nand" -+#define DRIVER_NAME "smi-nand-bcm2835" -+ -+struct bcm2835_smi_nand_host { -+ struct bcm2835_smi_instance *smi_inst; -+ struct nand_chip nand_chip; -+ struct mtd_info mtd; -+ struct device *dev; -+}; -+ -+/**************************************************************************** -+* -+* NAND functionality implementation -+* -+****************************************************************************/ -+ -+#define SMI_NAND_CLE_PIN 0x01 -+#define SMI_NAND_ALE_PIN 0x02 -+ -+static inline void bcm2835_smi_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, -+ unsigned int ctrl) -+{ -+ uint32_t cmd32 = cmd; -+ uint32_t addr = ~(SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ if (ctrl & NAND_CLE) -+ addr |= SMI_NAND_CLE_PIN; -+ if (ctrl & NAND_ALE) -+ addr |= SMI_NAND_ALE_PIN; -+ /* Lower ALL the CS pins! */ -+ if (ctrl & NAND_NCE) -+ addr &= (SMI_NAND_CLE_PIN | SMI_NAND_ALE_PIN); -+ -+ bcm2835_smi_set_address(inst, addr); -+ -+ if (cmd != NAND_CMD_NONE) -+ bcm2835_smi_write_buf(inst, &cmd32, 1); -+} -+ -+static inline uint8_t bcm2835_smi_nand_read_byte(struct mtd_info *mtd) -+{ -+ uint8_t byte; -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_read_buf(inst, &byte, 1); -+ return byte; -+} -+ -+static inline void bcm2835_smi_nand_write_byte(struct mtd_info *mtd, -+ uint8_t byte) -+{ -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_write_buf(inst, &byte, 1); -+} -+ -+static inline void bcm2835_smi_nand_write_buf(struct mtd_info *mtd, -+ const uint8_t *buf, int len) -+{ -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_write_buf(inst, buf, len); -+} -+ -+static inline void bcm2835_smi_nand_read_buf(struct mtd_info *mtd, -+ uint8_t *buf, int len) -+{ -+ struct bcm2835_smi_nand_host *host = dev_get_drvdata(mtd->dev.parent); -+ struct bcm2835_smi_instance *inst = host->smi_inst; -+ -+ bcm2835_smi_read_buf(inst, buf, len); -+} -+ -+/**************************************************************************** -+* -+* Probe and remove functions -+* -+***************************************************************************/ -+ -+static int bcm2835_smi_nand_probe(struct platform_device *pdev) -+{ -+ struct bcm2835_smi_nand_host *host; -+ struct nand_chip *this; -+ struct mtd_info *mtd; -+ struct device *dev = &pdev->dev; -+ struct device_node *node = dev->of_node, *smi_node; -+ struct mtd_part_parser_data ppdata; -+ struct smi_settings *smi_settings; -+ struct bcm2835_smi_instance *smi_inst; -+ int ret = -ENXIO; -+ -+ if (!node) { -+ dev_err(dev, "No device tree node supplied!"); -+ return -EINVAL; -+ } -+ -+ smi_node = of_parse_phandle(node, "smi_handle", 0); -+ -+ /* Request use of SMI peripheral: */ -+ smi_inst = bcm2835_smi_get(smi_node); -+ -+ if (!smi_inst) { -+ dev_err(dev, "Could not register with SMI."); -+ return -EPROBE_DEFER; -+ } -+ -+ /* Set SMI timing and bus width */ -+ -+ smi_settings = bcm2835_smi_get_settings_from_regs(smi_inst); -+ -+ smi_settings->data_width = SMI_WIDTH_8BIT; -+ smi_settings->read_setup_time = 2; -+ smi_settings->read_hold_time = 1; -+ smi_settings->read_pace_time = 1; -+ smi_settings->read_strobe_time = 3; -+ -+ smi_settings->write_setup_time = 2; -+ smi_settings->write_hold_time = 1; -+ smi_settings->write_pace_time = 1; -+ smi_settings->write_strobe_time = 3; -+ -+ bcm2835_smi_set_regs_from_settings(smi_inst); -+ -+ host = devm_kzalloc(dev, sizeof(struct bcm2835_smi_nand_host), -+ GFP_KERNEL); -+ if (!host) -+ return -ENOMEM; -+ -+ host->dev = dev; -+ host->smi_inst = smi_inst; -+ -+ platform_set_drvdata(pdev, host); -+ -+ /* Link the structures together */ -+ -+ this = &host->nand_chip; -+ mtd = &host->mtd; -+ mtd->priv = this; -+ mtd->owner = THIS_MODULE; -+ mtd->dev.parent = dev; -+ mtd->name = DRIVER_NAME; -+ -+ /* 20 us command delay time... */ -+ this->chip_delay = 20; -+ -+ this->priv = host; -+ this->cmd_ctrl = bcm2835_smi_nand_cmd_ctrl; -+ this->read_byte = bcm2835_smi_nand_read_byte; -+ this->write_byte = bcm2835_smi_nand_write_byte; -+ this->write_buf = bcm2835_smi_nand_write_buf; -+ this->read_buf = bcm2835_smi_nand_read_buf; -+ -+ this->ecc.mode = NAND_ECC_SOFT; -+ -+ /* Should never be accessed directly: */ -+ -+ this->IO_ADDR_R = (void *)0xdeadbeef; -+ this->IO_ADDR_W = (void *)0xdeadbeef; -+ -+ /* First scan to find the device and get the page size */ -+ -+ if (nand_scan_ident(mtd, 1, NULL)) -+ return -ENXIO; -+ -+ /* Second phase scan */ -+ -+ if (nand_scan_tail(mtd)) -+ return -ENXIO; -+ -+ ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ if (!ret) -+ return 0; -+ -+ nand_release(mtd); -+ return -EINVAL; -+} -+ -+static int bcm2835_smi_nand_remove(struct platform_device *pdev) -+{ -+ struct bcm2835_smi_nand_host *host = platform_get_drvdata(pdev); -+ -+ nand_release(&host->mtd); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* Register the driver with device tree -+* -+***************************************************************************/ -+ -+static const struct of_device_id bcm2835_smi_nand_of_match[] = { -+ {.compatible = "brcm,bcm2835-smi-nand",}, -+ { /* sentinel */ } -+}; -+ -+MODULE_DEVICE_TABLE(of, bcm2835_smi_nand_of_match); -+ -+static struct platform_driver bcm2835_smi_nand_driver = { -+ .probe = bcm2835_smi_nand_probe, -+ .remove = bcm2835_smi_nand_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2835_smi_nand_of_match, -+ }, -+}; -+ -+module_platform_driver(bcm2835_smi_nand_driver); -+ -+MODULE_ALIAS("platform:smi-nand-bcm2835"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION -+ ("Driver for NAND chips using Broadcom Secondary Memory Interface"); -+MODULE_AUTHOR("Luke Wren "); - -From d5fe3a35c384918e40ad67ae26c5997ca941c98e Mon Sep 17 00:00:00 2001 -From: Aron Szabo -Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 045/122] lirc: added support for RaspberryPi GPIO - -lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others -See: https://github.com/raspberrypi/linux/issues/525 - -lirc: Remove restriction on gpio pins that can be used with lirc - -Compute Module, for example could use different pins - -lirc_rpi: Add parameter to specify input pin pull - -Depending on the connected IR circuitry it might be desirable to change the -gpios internal pull from it pull-down default behaviour. Add a module -parameter to allow the user to set it explicitly. - -Signed-off-by: Julian Scheel - -lirc-rpi: Use the higher-level irq control functions - -This module used to access the irq_chip methods of the -gpio controller directly, rather than going through the -standard enable_irq/irq_set_irq_type functions. This -caused problems on pinctrl-bcm2835 which only implements -the irq_enable/disable methods and not irq_unmask/mask. - -lirc-rpi: Correct the interrupt usage - -1) Correct the use of enable_irq (i.e. don't call it so often) -2) Correct the shutdown sequence. -3) Avoid a bcm2708_gpio driver quirk by setting the irq flags earlier - -lirc-rpi: use getnstimeofday instead of read_current_timer - -read_current_timer isn't guaranteed to return values in -microseconds, and indeed it doesn't on a Pi2. - -Issue: linux#827 - -lirc-rpi: Add device tree support, and a suitable overlay - -The overlay supports DT parameters that match the old module -parameters, except that gpio_in_pull should be set using the -strings "up", "down" or "off". - -lirc-rpi: Also support pinctrl-bcm2835 in non-DT mode - -fix auto-sense in lirc_rpi driver - -On a Raspberry Pi 2, the lirc_rpi driver might receive spurious -interrupts and change it's low-active / high-active setting. -When this happens, the IR remote control stops working. - -This patch disables this auto-detection if the 'sense' parameter -was set in the device tree, making the driver robust to such -spurious interrupts. ---- - drivers/staging/media/lirc/Kconfig | 6 + - drivers/staging/media/lirc/Makefile | 1 + - drivers/staging/media/lirc/lirc_rpi.c | 734 ++++++++++++++++++++++++++++++++++ - include/linux/platform_data/bcm2708.h | 23 ++ - 4 files changed, 764 insertions(+) - create mode 100644 drivers/staging/media/lirc/lirc_rpi.c - create mode 100644 include/linux/platform_data/bcm2708.h - -diff --git a/drivers/staging/media/lirc/Kconfig b/drivers/staging/media/lirc/Kconfig -index 6879c4651b46c8b48460626cb346b8ee23fa6587..77c69f2d4158be625a5956095b988cd3774dbfae 100644 ---- a/drivers/staging/media/lirc/Kconfig -+++ b/drivers/staging/media/lirc/Kconfig -@@ -32,6 +32,12 @@ config LIRC_PARALLEL - help - Driver for Homebrew Parallel Port Receivers - -+config LIRC_RPI -+ tristate "Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi" -+ depends on LIRC -+ help -+ Driver for Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi -+ - config LIRC_SASEM - tristate "Sasem USB IR Remote" - depends on LIRC && USB -diff --git a/drivers/staging/media/lirc/Makefile b/drivers/staging/media/lirc/Makefile -index 5430adf0475ded5abe2ef4b4cf4e7f2c08297894..9e53cd0caf58ba28a939b780c876d4017a23ac2b 100644 ---- a/drivers/staging/media/lirc/Makefile -+++ b/drivers/staging/media/lirc/Makefile -@@ -6,6 +6,7 @@ - obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o - obj-$(CONFIG_LIRC_IMON) += lirc_imon.o - obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o -+obj-$(CONFIG_LIRC_RPI) += lirc_rpi.o - obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o - obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o - obj-$(CONFIG_LIRC_SIR) += lirc_sir.o -diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..61328968d21540b04814cbd5155eaa30b715c8f4 ---- /dev/null -+++ b/drivers/staging/media/lirc/lirc_rpi.c -@@ -0,0 +1,734 @@ -+/* -+ * lirc_rpi.c -+ * -+ * lirc_rpi - Device driver that records pulse- and pause-lengths -+ * (space-lengths) (just like the lirc_serial driver does) -+ * between GPIO interrupt events on the Raspberry Pi. -+ * Lots of code has been taken from the lirc_serial module, -+ * so I would like say thanks to the authors. -+ * -+ * Copyright (C) 2012 Aron Robert Szabo , -+ * Michael Bishop -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define LIRC_DRIVER_NAME "lirc_rpi" -+#define RBUF_LEN 256 -+#define LIRC_TRANSMITTER_LATENCY 50 -+ -+#ifndef MAX_UDELAY_MS -+#define MAX_UDELAY_US 5000 -+#else -+#define MAX_UDELAY_US (MAX_UDELAY_MS*1000) -+#endif -+ -+#define dprintk(fmt, args...) \ -+ do { \ -+ if (debug) \ -+ printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \ -+ fmt, ## args); \ -+ } while (0) -+ -+/* module parameters */ -+ -+/* set the default GPIO input pin */ -+static int gpio_in_pin = 18; -+/* set the default pull behaviour for input pin */ -+static int gpio_in_pull = BCM2708_PULL_DOWN; -+/* set the default GPIO output pin */ -+static int gpio_out_pin = 17; -+/* enable debugging messages */ -+static bool debug; -+/* -1 = auto, 0 = active high, 1 = active low */ -+static int sense = -1; -+/* use softcarrier by default */ -+static bool softcarrier = 1; -+/* 0 = do not invert output, 1 = invert output */ -+static bool invert = 0; -+ -+struct gpio_chip *gpiochip; -+static int irq_num; -+static int auto_sense = 1; -+ -+/* forward declarations */ -+static long send_pulse(unsigned long length); -+static void send_space(long length); -+static void lirc_rpi_exit(void); -+ -+static struct platform_device *lirc_rpi_dev; -+static struct timeval lasttv = { 0, 0 }; -+static struct lirc_buffer rbuf; -+static spinlock_t lock; -+ -+/* initialized/set in init_timing_params() */ -+static unsigned int freq = 38000; -+static unsigned int duty_cycle = 50; -+static unsigned long period; -+static unsigned long pulse_width; -+static unsigned long space_width; -+ -+static void safe_udelay(unsigned long usecs) -+{ -+ while (usecs > MAX_UDELAY_US) { -+ udelay(MAX_UDELAY_US); -+ usecs -= MAX_UDELAY_US; -+ } -+ udelay(usecs); -+} -+ -+static unsigned long read_current_us(void) -+{ -+ struct timespec now; -+ getnstimeofday(&now); -+ return (now.tv_sec * 1000000) + (now.tv_nsec/1000); -+} -+ -+static int init_timing_params(unsigned int new_duty_cycle, -+ unsigned int new_freq) -+{ -+ if (1000 * 1000000L / new_freq * new_duty_cycle / 100 <= -+ LIRC_TRANSMITTER_LATENCY) -+ return -EINVAL; -+ if (1000 * 1000000L / new_freq * (100 - new_duty_cycle) / 100 <= -+ LIRC_TRANSMITTER_LATENCY) -+ return -EINVAL; -+ duty_cycle = new_duty_cycle; -+ freq = new_freq; -+ period = 1000 * 1000000L / freq; -+ pulse_width = period * duty_cycle / 100; -+ space_width = period - pulse_width; -+ dprintk("in init_timing_params, freq=%d pulse=%ld, " -+ "space=%ld\n", freq, pulse_width, space_width); -+ return 0; -+} -+ -+static long send_pulse_softcarrier(unsigned long length) -+{ -+ int flag; -+ unsigned long actual, target; -+ unsigned long actual_us, initial_us, target_us; -+ -+ length *= 1000; -+ -+ actual = 0; target = 0; flag = 0; -+ actual_us = read_current_us(); -+ -+ while (actual < length) { -+ if (flag) { -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ target += space_width; -+ } else { -+ gpiochip->set(gpiochip, gpio_out_pin, !invert); -+ target += pulse_width; -+ } -+ initial_us = actual_us; -+ target_us = actual_us + (target - actual) / 1000; -+ /* -+ * Note - we've checked in ioctl that the pulse/space -+ * widths are big enough so that d is > 0 -+ */ -+ if ((int)(target_us - actual_us) > 0) -+ udelay(target_us - actual_us); -+ actual_us = read_current_us(); -+ actual += (actual_us - initial_us) * 1000; -+ flag = !flag; -+ } -+ return (actual-length) / 1000; -+} -+ -+static long send_pulse(unsigned long length) -+{ -+ if (length <= 0) -+ return 0; -+ -+ if (softcarrier) { -+ return send_pulse_softcarrier(length); -+ } else { -+ gpiochip->set(gpiochip, gpio_out_pin, !invert); -+ safe_udelay(length); -+ return 0; -+ } -+} -+ -+static void send_space(long length) -+{ -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ if (length <= 0) -+ return; -+ safe_udelay(length); -+} -+ -+static void rbwrite(int l) -+{ -+ if (lirc_buffer_full(&rbuf)) { -+ /* no new signals will be accepted */ -+ dprintk("Buffer overrun\n"); -+ return; -+ } -+ lirc_buffer_write(&rbuf, (void *)&l); -+} -+ -+static void frbwrite(int l) -+{ -+ /* simple noise filter */ -+ static int pulse, space; -+ static unsigned int ptr; -+ -+ if (ptr > 0 && (l & PULSE_BIT)) { -+ pulse += l & PULSE_MASK; -+ if (pulse > 250) { -+ rbwrite(space); -+ rbwrite(pulse | PULSE_BIT); -+ ptr = 0; -+ pulse = 0; -+ } -+ return; -+ } -+ if (!(l & PULSE_BIT)) { -+ if (ptr == 0) { -+ if (l > 20000) { -+ space = l; -+ ptr++; -+ return; -+ } -+ } else { -+ if (l > 20000) { -+ space += pulse; -+ if (space > PULSE_MASK) -+ space = PULSE_MASK; -+ space += l; -+ if (space > PULSE_MASK) -+ space = PULSE_MASK; -+ pulse = 0; -+ return; -+ } -+ rbwrite(space); -+ rbwrite(pulse | PULSE_BIT); -+ ptr = 0; -+ pulse = 0; -+ } -+ } -+ rbwrite(l); -+} -+ -+static irqreturn_t irq_handler(int i, void *blah, struct pt_regs *regs) -+{ -+ struct timeval tv; -+ long deltv; -+ int data; -+ int signal; -+ -+ /* use the GPIO signal level */ -+ signal = gpiochip->get(gpiochip, gpio_in_pin); -+ -+ if (sense != -1) { -+ /* get current time */ -+ do_gettimeofday(&tv); -+ -+ /* calc time since last interrupt in microseconds */ -+ deltv = tv.tv_sec-lasttv.tv_sec; -+ if (tv.tv_sec < lasttv.tv_sec || -+ (tv.tv_sec == lasttv.tv_sec && -+ tv.tv_usec < lasttv.tv_usec)) { -+ printk(KERN_WARNING LIRC_DRIVER_NAME -+ ": AIEEEE: your clock just jumped backwards\n"); -+ printk(KERN_WARNING LIRC_DRIVER_NAME -+ ": %d %d %lx %lx %lx %lx\n", signal, sense, -+ tv.tv_sec, lasttv.tv_sec, -+ tv.tv_usec, lasttv.tv_usec); -+ data = PULSE_MASK; -+ } else if (deltv > 15) { -+ data = PULSE_MASK; /* really long time */ -+ if (!(signal^sense)) { -+ /* sanity check */ -+ printk(KERN_DEBUG LIRC_DRIVER_NAME -+ ": AIEEEE: %d %d %lx %lx %lx %lx\n", -+ signal, sense, tv.tv_sec, lasttv.tv_sec, -+ tv.tv_usec, lasttv.tv_usec); -+ /* -+ * detecting pulse while this -+ * MUST be a space! -+ */ -+ if (auto_sense) { -+ sense = sense ? 0 : 1; -+ } -+ } -+ } else { -+ data = (int) (deltv*1000000 + -+ (tv.tv_usec - lasttv.tv_usec)); -+ } -+ frbwrite(signal^sense ? data : (data|PULSE_BIT)); -+ lasttv = tv; -+ wake_up_interruptible(&rbuf.wait_poll); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static int is_right_chip(struct gpio_chip *chip, void *data) -+{ -+ dprintk("is_right_chip %s %d\n", chip->label, strcmp(data, chip->label)); -+ -+ if (strcmp(data, chip->label) == 0) -+ return 1; -+ return 0; -+} -+ -+static inline int read_bool_property(const struct device_node *np, -+ const char *propname, -+ bool *out_value) -+{ -+ u32 value = 0; -+ int err = of_property_read_u32(np, propname, &value); -+ if (err == 0) -+ *out_value = (value != 0); -+ return err; -+} -+ -+static void read_pin_settings(struct device_node *node) -+{ -+ u32 pin; -+ int index; -+ -+ for (index = 0; -+ of_property_read_u32_index( -+ node, -+ "brcm,pins", -+ index, -+ &pin) == 0; -+ index++) { -+ u32 function; -+ int err; -+ err = of_property_read_u32_index( -+ node, -+ "brcm,function", -+ index, -+ &function); -+ if (err == 0) { -+ if (function == 1) /* Output */ -+ gpio_out_pin = pin; -+ else if (function == 0) /* Input */ -+ gpio_in_pin = pin; -+ } -+ } -+} -+ -+static int init_port(void) -+{ -+ int i, nlow, nhigh; -+ struct device_node *node; -+ -+ node = lirc_rpi_dev->dev.of_node; -+ -+ gpiochip = gpiochip_find("bcm2708_gpio", is_right_chip); -+ -+ /* -+ * Because of the lack of a setpull function, only support -+ * pinctrl-bcm2835 if using device tree. -+ */ -+ if (!gpiochip && node) -+ gpiochip = gpiochip_find("pinctrl-bcm2835", is_right_chip); -+ -+ if (!gpiochip) { -+ pr_err(LIRC_DRIVER_NAME ": gpio chip not found!\n"); -+ return -ENODEV; -+ } -+ -+ if (node) { -+ struct device_node *pins_node; -+ -+ pins_node = of_parse_phandle(node, "pinctrl-0", 0); -+ if (!pins_node) { -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": pinctrl settings not found!\n"); -+ return -EINVAL; -+ } -+ -+ read_pin_settings(pins_node); -+ -+ of_property_read_u32(node, "rpi,sense", &sense); -+ -+ read_bool_property(node, "rpi,softcarrier", &softcarrier); -+ -+ read_bool_property(node, "rpi,invert", &invert); -+ -+ read_bool_property(node, "rpi,debug", &debug); -+ -+ } else { -+ return -EINVAL; -+ } -+ -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ -+ irq_num = gpiochip->to_irq(gpiochip, gpio_in_pin); -+ dprintk("to_irq %d\n", irq_num); -+ -+ /* if pin is high, then this must be an active low receiver. */ -+ if (sense == -1) { -+ /* wait 1/2 sec for the power supply */ -+ msleep(500); -+ -+ /* -+ * probe 9 times every 0.04s, collect "votes" for -+ * active high/low -+ */ -+ nlow = 0; -+ nhigh = 0; -+ for (i = 0; i < 9; i++) { -+ if (gpiochip->get(gpiochip, gpio_in_pin)) -+ nlow++; -+ else -+ nhigh++; -+ msleep(40); -+ } -+ sense = (nlow >= nhigh ? 1 : 0); -+ printk(KERN_INFO LIRC_DRIVER_NAME -+ ": auto-detected active %s receiver on GPIO pin %d\n", -+ sense ? "low" : "high", gpio_in_pin); -+ } else { -+ printk(KERN_INFO LIRC_DRIVER_NAME -+ ": manually using active %s receiver on GPIO pin %d\n", -+ sense ? "low" : "high", gpio_in_pin); -+ auto_sense = 0; -+ } -+ -+ return 0; -+} -+ -+// called when the character device is opened -+static int set_use_inc(void *data) -+{ -+ int result; -+ -+ /* initialize timestamp */ -+ do_gettimeofday(&lasttv); -+ -+ result = request_irq(irq_num, -+ (irq_handler_t) irq_handler, -+ IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, -+ LIRC_DRIVER_NAME, (void*) 0); -+ -+ switch (result) { -+ case -EBUSY: -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": IRQ %d is busy\n", -+ irq_num); -+ return -EBUSY; -+ case -EINVAL: -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": Bad irq number or handler\n"); -+ return -EINVAL; -+ default: -+ dprintk("Interrupt %d obtained\n", -+ irq_num); -+ break; -+ }; -+ -+ /* initialize pulse/space widths */ -+ init_timing_params(duty_cycle, freq); -+ -+ return 0; -+} -+ -+static void set_use_dec(void *data) -+{ -+ /* GPIO Pin Falling/Rising Edge Detect Disable */ -+ irq_set_irq_type(irq_num, 0); -+ disable_irq(irq_num); -+ -+ free_irq(irq_num, (void *) 0); -+ -+ dprintk(KERN_INFO LIRC_DRIVER_NAME -+ ": freed IRQ %d\n", irq_num); -+} -+ -+static ssize_t lirc_write(struct file *file, const char *buf, -+ size_t n, loff_t *ppos) -+{ -+ int i, count; -+ unsigned long flags; -+ long delta = 0; -+ int *wbuf; -+ -+ count = n / sizeof(int); -+ if (n % sizeof(int) || count % 2 == 0) -+ return -EINVAL; -+ wbuf = memdup_user(buf, n); -+ if (IS_ERR(wbuf)) -+ return PTR_ERR(wbuf); -+ spin_lock_irqsave(&lock, flags); -+ -+ for (i = 0; i < count; i++) { -+ if (i%2) -+ send_space(wbuf[i] - delta); -+ else -+ delta = send_pulse(wbuf[i]); -+ } -+ gpiochip->set(gpiochip, gpio_out_pin, invert); -+ -+ spin_unlock_irqrestore(&lock, flags); -+ kfree(wbuf); -+ return n; -+} -+ -+static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) -+{ -+ int result; -+ __u32 value; -+ -+ switch (cmd) { -+ case LIRC_GET_SEND_MODE: -+ return -ENOIOCTLCMD; -+ break; -+ -+ case LIRC_SET_SEND_MODE: -+ result = get_user(value, (__u32 *) arg); -+ if (result) -+ return result; -+ /* only LIRC_MODE_PULSE supported */ -+ if (value != LIRC_MODE_PULSE) -+ return -ENOSYS; -+ break; -+ -+ case LIRC_GET_LENGTH: -+ return -ENOSYS; -+ break; -+ -+ case LIRC_SET_SEND_DUTY_CYCLE: -+ dprintk("SET_SEND_DUTY_CYCLE\n"); -+ result = get_user(value, (__u32 *) arg); -+ if (result) -+ return result; -+ if (value <= 0 || value > 100) -+ return -EINVAL; -+ return init_timing_params(value, freq); -+ break; -+ -+ case LIRC_SET_SEND_CARRIER: -+ dprintk("SET_SEND_CARRIER\n"); -+ result = get_user(value, (__u32 *) arg); -+ if (result) -+ return result; -+ if (value > 500000 || value < 20000) -+ return -EINVAL; -+ return init_timing_params(duty_cycle, value); -+ break; -+ -+ default: -+ return lirc_dev_fop_ioctl(filep, cmd, arg); -+ } -+ return 0; -+} -+ -+static const struct file_operations lirc_fops = { -+ .owner = THIS_MODULE, -+ .write = lirc_write, -+ .unlocked_ioctl = lirc_ioctl, -+ .read = lirc_dev_fop_read, -+ .poll = lirc_dev_fop_poll, -+ .open = lirc_dev_fop_open, -+ .release = lirc_dev_fop_close, -+ .llseek = no_llseek, -+}; -+ -+static struct lirc_driver driver = { -+ .name = LIRC_DRIVER_NAME, -+ .minor = -1, -+ .code_length = 1, -+ .sample_rate = 0, -+ .data = NULL, -+ .add_to_buf = NULL, -+ .rbuf = &rbuf, -+ .set_use_inc = set_use_inc, -+ .set_use_dec = set_use_dec, -+ .fops = &lirc_fops, -+ .dev = NULL, -+ .owner = THIS_MODULE, -+}; -+ -+static const struct of_device_id lirc_rpi_of_match[] = { -+ { .compatible = "rpi,lirc-rpi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, lirc_rpi_of_match); -+ -+static struct platform_driver lirc_rpi_driver = { -+ .driver = { -+ .name = LIRC_DRIVER_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(lirc_rpi_of_match), -+ }, -+}; -+ -+static int __init lirc_rpi_init(void) -+{ -+ struct device_node *node; -+ int result; -+ -+ /* Init read buffer. */ -+ result = lirc_buffer_init(&rbuf, sizeof(int), RBUF_LEN); -+ if (result < 0) -+ return -ENOMEM; -+ -+ result = platform_driver_register(&lirc_rpi_driver); -+ if (result) { -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": lirc register returned %d\n", result); -+ goto exit_buffer_free; -+ } -+ -+ node = of_find_compatible_node(NULL, NULL, -+ lirc_rpi_of_match[0].compatible); -+ -+ if (node) { -+ /* DT-enabled */ -+ lirc_rpi_dev = of_find_device_by_node(node); -+ WARN_ON(lirc_rpi_dev->dev.of_node != node); -+ of_node_put(node); -+ } -+ else { -+ lirc_rpi_dev = platform_device_alloc(LIRC_DRIVER_NAME, 0); -+ if (!lirc_rpi_dev) { -+ result = -ENOMEM; -+ goto exit_driver_unregister; -+ } -+ -+ result = platform_device_add(lirc_rpi_dev); -+ if (result) -+ goto exit_device_put; -+ } -+ -+ return 0; -+ -+ exit_device_put: -+ platform_device_put(lirc_rpi_dev); -+ -+ exit_driver_unregister: -+ platform_driver_unregister(&lirc_rpi_driver); -+ -+ exit_buffer_free: -+ lirc_buffer_free(&rbuf); -+ -+ return result; -+} -+ -+static void lirc_rpi_exit(void) -+{ -+ if (!lirc_rpi_dev->dev.of_node) -+ platform_device_unregister(lirc_rpi_dev); -+ platform_driver_unregister(&lirc_rpi_driver); -+ lirc_buffer_free(&rbuf); -+} -+ -+static int __init lirc_rpi_init_module(void) -+{ -+ int result; -+ -+ result = lirc_rpi_init(); -+ if (result) -+ return result; -+ -+ result = init_port(); -+ if (result < 0) -+ goto exit_rpi; -+ -+ driver.features = LIRC_CAN_SET_SEND_DUTY_CYCLE | -+ LIRC_CAN_SET_SEND_CARRIER | -+ LIRC_CAN_SEND_PULSE | -+ LIRC_CAN_REC_MODE2; -+ -+ driver.dev = &lirc_rpi_dev->dev; -+ driver.minor = lirc_register_driver(&driver); -+ -+ if (driver.minor < 0) { -+ printk(KERN_ERR LIRC_DRIVER_NAME -+ ": device registration failed with %d\n", result); -+ result = -EIO; -+ goto exit_rpi; -+ } -+ -+ printk(KERN_INFO LIRC_DRIVER_NAME ": driver registered!\n"); -+ -+ return 0; -+ -+ exit_rpi: -+ lirc_rpi_exit(); -+ -+ return result; -+} -+ -+static void __exit lirc_rpi_exit_module(void) -+{ -+ lirc_unregister_driver(driver.minor); -+ -+ gpio_free(gpio_out_pin); -+ gpio_free(gpio_in_pin); -+ -+ lirc_rpi_exit(); -+ -+ printk(KERN_INFO LIRC_DRIVER_NAME ": cleaned up module\n"); -+} -+ -+module_init(lirc_rpi_init_module); -+module_exit(lirc_rpi_exit_module); -+ -+MODULE_DESCRIPTION("Infra-red receiver and blaster driver for Raspberry Pi GPIO."); -+MODULE_AUTHOR("Aron Robert Szabo "); -+MODULE_AUTHOR("Michael Bishop "); -+MODULE_LICENSE("GPL"); -+ -+module_param(gpio_out_pin, int, S_IRUGO); -+MODULE_PARM_DESC(gpio_out_pin, "GPIO output/transmitter pin number of the BCM" -+ " processor. (default 17"); -+ -+module_param(gpio_in_pin, int, S_IRUGO); -+MODULE_PARM_DESC(gpio_in_pin, "GPIO input pin number of the BCM processor." -+ " (default 18"); -+ -+module_param(gpio_in_pull, int, S_IRUGO); -+MODULE_PARM_DESC(gpio_in_pull, "GPIO input pin pull configuration." -+ " (0 = off, 1 = up, 2 = down, default down)"); -+ -+module_param(sense, int, S_IRUGO); -+MODULE_PARM_DESC(sense, "Override autodetection of IR receiver circuit" -+ " (0 = active high, 1 = active low )"); -+ -+module_param(softcarrier, bool, S_IRUGO); -+MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)"); -+ -+module_param(invert, bool, S_IRUGO); -+MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off"); -+ -+module_param(debug, bool, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(debug, "Enable debugging messages"); -diff --git a/include/linux/platform_data/bcm2708.h b/include/linux/platform_data/bcm2708.h -new file mode 100644 -index 0000000000000000000000000000000000000000..fb69624ccef00ddbdccf8256d6baf1b172de57ec ---- /dev/null -+++ b/include/linux/platform_data/bcm2708.h -@@ -0,0 +1,23 @@ -+/* -+ * include/linux/platform_data/bcm2708.h -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * (C) 2014 Julian Scheel -+ * -+ */ -+#ifndef __BCM2708_H_ -+#define __BCM2708_H_ -+ -+typedef enum { -+ BCM2708_PULL_OFF, -+ BCM2708_PULL_UP, -+ BCM2708_PULL_DOWN -+} bcm2708_gpio_pull_t; -+ -+extern int bcm2708_gpio_setpull(struct gpio_chip *gc, unsigned offset, -+ bcm2708_gpio_pull_t value); -+ -+#endif - -From f66f635379d5b4ebc82d4d18c9bd77d2fbcbdfa6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 046/122] Add cpufreq driver - -Signed-off-by: popcornmix ---- - drivers/cpufreq/Kconfig.arm | 9 ++ - drivers/cpufreq/Makefile | 1 + - drivers/cpufreq/bcm2835-cpufreq.c | 218 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 228 insertions(+) - create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c - -diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm -index d89b8afe23b6956b6c48e19c87cecc081e7725a1..465c727bb3ba70249409728d8f643a0002c6779c 100644 ---- a/drivers/cpufreq/Kconfig.arm -+++ b/drivers/cpufreq/Kconfig.arm -@@ -220,6 +220,15 @@ config ARM_STI_CPUFREQ - this config option if you wish to add CPUFreq support for STi based - SoCs. - -+config ARM_BCM2835_CPUFREQ -+ depends on RASPBERRYPI_FIRMWARE -+ bool "BCM2835 Driver" -+ default y -+ help -+ This adds the CPUFreq driver for BCM2835 -+ -+ If in doubt, say N. -+ - config ARM_TEGRA20_CPUFREQ - bool "Tegra20 CPUFreq support" - depends on ARCH_TEGRA -diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile -index 0a9b6a093646bd1dd60ee092e362b24527f0ef1e..92a628a670c12c39c2be73fc91f65da5fdafd397 100644 ---- a/drivers/cpufreq/Makefile -+++ b/drivers/cpufreq/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o - obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o - obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o - obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o -+obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o - obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o - obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o - obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o -diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c -new file mode 100644 -index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a ---- /dev/null -+++ b/drivers/cpufreq/bcm2835-cpufreq.c -@@ -0,0 +1,218 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+/***************************************************************************** -+* FILENAME: bcm2835-cpufreq.h -+* DESCRIPTION: This driver dynamically manages the CPU Frequency of the ARM -+* processor. Messages are sent to Videocore either setting or requesting the -+* frequency of the ARM in order to match an appropiate frequency to the current -+* usage of the processor. The policy which selects the frequency to use is -+* defined in the kernel .config file, but can be changed during runtime. -+*****************************************************************************/ -+ -+/* ---------- INCLUDES ---------- */ -+#include -+#include -+#include -+#include -+#include -+ -+/* ---------- DEFINES ---------- */ -+/*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ -+#define MODULE_NAME "bcm2835-cpufreq" -+ -+#define VCMSG_ID_ARM_CLOCK 0x000000003 /* Clock/Voltage ID's */ -+ -+/* debug printk macros */ -+#ifdef CPUFREQ_DEBUG_ENABLE -+#define print_debug(fmt,...) pr_debug("%s:%s:%d: "fmt, MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) -+#else -+#define print_debug(fmt,...) -+#endif -+#define print_err(fmt,...) pr_err("%s:%s:%d: "fmt, MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) -+#define print_info(fmt,...) pr_info("%s: "fmt, MODULE_NAME, ##__VA_ARGS__) -+ -+/* ---------- GLOBALS ---------- */ -+static struct cpufreq_driver bcm2835_cpufreq_driver; /* the cpufreq driver global */ -+static unsigned int min_frequency, max_frequency; -+static struct cpufreq_frequency_table bcm2835_freq_table[3]; -+ -+/* -+ =============================================== -+ clk_rate either gets or sets the clock rates. -+ =============================================== -+*/ -+ -+static int bcm2835_cpufreq_clock_property(u32 tag, u32 id, u32 *val) -+{ -+ struct rpi_firmware *fw = rpi_firmware_get(NULL); -+ struct { -+ u32 id; -+ u32 val; -+ } packet; -+ int ret; -+ -+ packet.id = id; -+ packet.val = *val; -+ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); -+ if (ret) -+ return ret; -+ -+ *val = packet.val; -+ -+ return 0; -+} -+ -+static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) -+{ -+ u32 rate = arm_rate * 1000; -+ int ret; -+ -+ ret = bcm2835_cpufreq_clock_property(RPI_FIRMWARE_SET_CLOCK_RATE, VCMSG_ID_ARM_CLOCK, &rate); -+ if (ret) { -+ print_err("Failed to set clock: %d (%d)\n", arm_rate, ret); -+ return 0; -+ } -+ -+ rate /= 1000; -+ print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, rate); -+ -+ return rate; -+} -+ -+static uint32_t bcm2835_cpufreq_get_clock(int tag) -+{ -+ u32 rate; -+ int ret; -+ -+ ret = bcm2835_cpufreq_clock_property(tag, VCMSG_ID_ARM_CLOCK, &rate); -+ if (ret) { -+ print_err("Failed to get clock (%d)\n", ret); -+ return 0; -+ } -+ -+ rate /= 1000; -+ print_debug("%s frequency = %u\n", -+ tag == RPI_FIRMWARE_GET_CLOCK_RATE ? "Current": -+ tag == RPI_FIRMWARE_GET_MIN_CLOCK_RATE ? "Min": -+ tag == RPI_FIRMWARE_GET_MAX_CLOCK_RATE ? "Max": -+ "Unexpected", rate); -+ -+ return rate; -+} -+ -+/* -+ ==================================================== -+ Module Initialisation registers the cpufreq driver -+ ==================================================== -+*/ -+static int __init bcm2835_cpufreq_module_init(void) -+{ -+ print_debug("IN\n"); -+ return cpufreq_register_driver(&bcm2835_cpufreq_driver); -+} -+ -+/* -+ ============= -+ Module exit -+ ============= -+*/ -+static void __exit bcm2835_cpufreq_module_exit(void) -+{ -+ print_debug("IN\n"); -+ cpufreq_unregister_driver(&bcm2835_cpufreq_driver); -+ return; -+} -+ -+/* -+ ============================================================== -+ Initialisation function sets up the CPU policy for first use -+ ============================================================== -+*/ -+static int bcm2835_cpufreq_driver_init(struct cpufreq_policy *policy) -+{ -+ /* measured value of how long it takes to change frequency */ -+ const unsigned int transition_latency = 355000; /* ns */ -+ -+ if (!rpi_firmware_get(NULL)) { -+ print_err("Firmware is not available\n"); -+ return -ENODEV; -+ } -+ -+ /* now find out what the maximum and minimum frequencies are */ -+ min_frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MIN_CLOCK_RATE); -+ max_frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MAX_CLOCK_RATE); -+ -+ if (min_frequency == max_frequency) { -+ bcm2835_freq_table[0].frequency = min_frequency; -+ bcm2835_freq_table[1].frequency = CPUFREQ_TABLE_END; -+ } else { -+ bcm2835_freq_table[0].frequency = min_frequency; -+ bcm2835_freq_table[1].frequency = max_frequency; -+ bcm2835_freq_table[2].frequency = CPUFREQ_TABLE_END; -+ } -+ -+ print_info("min=%d max=%d\n", min_frequency, max_frequency); -+ return cpufreq_generic_init(policy, bcm2835_freq_table, transition_latency); -+} -+ -+/* -+ ===================================================================== -+ Target index function chooses the requested frequency from the table -+ ===================================================================== -+*/ -+ -+static int bcm2835_cpufreq_driver_target_index(struct cpufreq_policy *policy, unsigned int state) -+{ -+ unsigned int target_freq = state == 0 ? min_frequency : max_frequency; -+ unsigned int cur = bcm2835_cpufreq_set_clock(policy->cur, target_freq); -+ -+ if (!cur) -+ { -+ print_err("Error occurred setting a new frequency (%d)\n", target_freq); -+ return -EINVAL; -+ } -+ print_debug("%s: %i: freq %d->%d\n", policy->governor->name, state, policy->cur, cur); -+ return 0; -+} -+ -+/* -+ ====================================================== -+ Get function returns the current frequency from table -+ ====================================================== -+*/ -+ -+static unsigned int bcm2835_cpufreq_driver_get(unsigned int cpu) -+{ -+ unsigned int actual_rate = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_CLOCK_RATE); -+ print_debug("cpu%d: freq=%d\n", cpu, actual_rate); -+ return actual_rate <= min_frequency ? min_frequency : max_frequency; -+} -+ -+/* the CPUFreq driver */ -+static struct cpufreq_driver bcm2835_cpufreq_driver = { -+ .name = "BCM2835 CPUFreq", -+ .init = bcm2835_cpufreq_driver_init, -+ .verify = cpufreq_generic_frequency_table_verify, -+ .target_index = bcm2835_cpufreq_driver_target_index, -+ .get = bcm2835_cpufreq_driver_get, -+ .attr = cpufreq_generic_attr, -+}; -+ -+MODULE_AUTHOR("Dorian Peake and Dom Cobley"); -+MODULE_DESCRIPTION("CPU frequency driver for BCM2835 chip"); -+MODULE_LICENSE("GPL"); -+ -+module_init(bcm2835_cpufreq_module_init); -+module_exit(bcm2835_cpufreq_module_exit); - -From 478277f128dbdcbea6394c4744ada90fce9ab66e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 047/122] Added hwmon/thermal driver for reporting core - temperature. Thanks Dorian -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM270x: Move thermal sensor to Device Tree - -Add Device Tree support to bcm2835-thermal driver. -Add thermal sensor device to Device Tree. -Don't add platform device when booting in DT mode. - -Signed-off-by: Noralf Trønnes ---- - drivers/thermal/Kconfig | 7 +++ - drivers/thermal/Makefile | 1 + - drivers/thermal/bcm2835-thermal.c | 109 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 117 insertions(+) - create mode 100644 drivers/thermal/bcm2835-thermal.c - -diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig -index a13541bdc726899807dd8723c92c21312fbc6439..de45ea51555e5f47498c18a969751ea6dc52d6b9 100644 ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -302,6 +302,13 @@ config INTEL_POWERCLAMP - enforce idle time which results in more package C-state residency. The - user interface is exposed via generic thermal framework. - -+config THERMAL_BCM2835 -+ depends on RASPBERRYPI_FIRMWARE -+ tristate "BCM2835 Thermal Driver" -+ help -+ This will enable temperature monitoring for the Broadcom BCM2835 -+ chip. If built as a module, it will be called 'bcm2835-thermal'. -+ - config X86_PKG_TEMP_THERMAL - tristate "X86 package temperature thermal driver" - depends on X86_THERMAL_VECTOR -diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile -index c92eb22a41ff89f3f1c61c61977de7eb9ba516ae..bcf9e7503c940821ca260774ba9e1cebf185cd3e 100644 ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -41,6 +41,7 @@ obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o - obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o - obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o - obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o -+obj-$(CONFIG_THERMAL_BCM2835) += bcm2835-thermal.o - obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o - obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o - obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o -diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c63fb9f9d143e19612a18fe530c7b2b3518a22a4 ---- /dev/null -+++ b/drivers/thermal/bcm2835-thermal.c -@@ -0,0 +1,109 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+ -+static int bcm2835_thermal_get_property(struct thermal_zone_device *tz, -+ int *temp, u32 tag) -+{ -+ struct rpi_firmware *fw = tz->devdata; -+ struct { -+ u32 id; -+ u32 val; -+ } packet; -+ int ret; -+ -+ *temp = 0; -+ packet.id = 0; -+ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); -+ if (ret) { -+ dev_err(&tz->device, "Failed to get temperature\n"); -+ return ret; -+ } -+ -+ *temp = packet.val; -+ dev_dbg(&tz->device, "%stemp=%d\n", -+ tag == RPI_FIRMWARE_GET_MAX_TEMPERATURE ? "max" : "", *temp); -+ -+ return 0; -+} -+ -+static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, -+ int *temp) -+{ -+ return bcm2835_thermal_get_property(tz, temp, -+ RPI_FIRMWARE_GET_TEMPERATURE); -+} -+ -+static struct thermal_zone_device_ops ops = { -+ .get_temp = bcm2835_thermal_get_temp, -+}; -+ -+static int bcm2835_thermal_probe(struct platform_device *pdev) -+{ -+ struct device_node *fw_np; -+ struct rpi_firmware *fw; -+ struct thermal_zone_device *tz; -+ -+ fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_np) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ fw = rpi_firmware_get(fw_np); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ tz = thermal_zone_device_register("bcm2835_thermal", 0, 0, fw, &ops, -+ NULL, 0, 0); -+ if (IS_ERR(tz)) { -+ dev_err(&pdev->dev, "Failed to register the thermal device\n"); -+ return PTR_ERR(tz); -+ } -+ -+ platform_set_drvdata(pdev, tz); -+ -+ return 0; -+} -+ -+static int bcm2835_thermal_remove(struct platform_device *pdev) -+{ -+ thermal_zone_device_unregister(platform_get_drvdata(pdev)); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm2835_thermal_of_match_table[] = { -+ { .compatible = "brcm,bcm2835-thermal", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); -+ -+static struct platform_driver bcm2835_thermal_driver = { -+ .probe = bcm2835_thermal_probe, -+ .remove = bcm2835_thermal_remove, -+ .driver = { -+ .name = "bcm2835_thermal", -+ .of_match_table = bcm2835_thermal_of_match_table, -+ }, -+}; -+module_platform_driver(bcm2835_thermal_driver); -+ -+MODULE_AUTHOR("Dorian Peake"); -+MODULE_AUTHOR("Noralf Trønnes"); -+MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); -+MODULE_LICENSE("GPL"); - -From aaac339b97bfcc6a67fd3f51400d87fc2ff00198 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 048/122] Add Chris Boot's i2c driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -i2c-bcm2708: fixed baudrate - -Fixed issue where the wrong CDIV value was set for baudrates below 3815 Hz (for 250MHz bus clock). -In that case the computed CDIV value was more than 0xffff. However the CDIV register width is only 16 bits. -This resulted in incorrect setting of CDIV and higher baudrate than intended. -Example: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0x1704 -> 42430Hz -After correction: 3500Hz -> CDIV=0x11704 -> CDIV(16bit)=0xffff -> 3815Hz -The correct baudrate is shown in the log after the cdiv > 0xffff correction. - -Perform I2C combined transactions when possible - -Perform I2C combined transactions whenever possible, within the -restrictions of the Broadcomm Serial Controller. - -Disable DONE interrupt during TA poll - -Prevent interrupt from being triggered if poll is missed and transfer -starts and finishes. - -i2c: Make combined transactions optional and disabled by default - -i2c: bcm2708: add device tree support - -Add DT support to driver and add to .dtsi file. -Setup pins in .dts file. -i2c is disabled by default. - -Signed-off-by: Noralf Tronnes - -bcm2708: don't register i2c controllers when using DT - -The devices for the i2c controllers are in the Device Tree. -Only register devices when not using DT. - -Signed-off-by: Noralf Tronnes - -I2C: Only register the I2C device for the current board revision - -i2c_bcm2708: Fix clock reference counting - -Fix grabbing lock from atomic context in i2c driver - -2 main changes: -- check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: - /* poll for transfer start bit (should only take 1-20 polls) */ - This implies that the setup function can now fail so account for this everywhere it's called -- Removed the clk_get_rate call from inside the setup function as it locks a mutex and that's not ok since we call it from under a spin lock. - -i2c-bcm2708: When using DT, leave the GPIO setup to pinctrl - -i2c-bcm2708: Increase timeouts to allow larger transfers - -Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting -for completion. The default timeout is 1 second. - -See: https://github.com/raspberrypi/linux/issues/260 - -i2c-bcm2708/BCM270X_DT: Add support for I2C2 - -The third I2C bus (I2C2) is normally reserved for HDMI use. Careless -use of this bus can break an attached display - use with caution. - -It is recommended to disable accesses by VideoCore by setting -hdmi_ignore_edid=1 or hdmi_edid_file=1 in config.txt. - -The interface is disabled by default - enable using the -i2c2_iknowwhatimdoing DT parameter. - -bcm2708-spi: Don't use static pin configuration with DT - -Also remove superfluous error checking - the SPI framework ensures the -validity of the chip_select value. - -i2c-bcm2708: Remove non-DT support - -Signed-off-by: Noralf Trønnes - -Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs. - -Fixes i2c_bcm2708: Write to FIFO correctly - v2 (#1574) - -* i2c: fix i2c_bcm2708: Clear FIFO before sending data - -Make sure FIFO gets cleared before trying to send -data in case of a repeated start (COMBINED=Y). - -* i2c: fix i2c_bcm2708: Only write to FIFO when not full - -Check if FIFO can accept data before writing. -To avoid a peripheral read on the last iteration of a loop, -both bcm2708_bsc_fifo_fill and ~drain are changed as well. ---- - drivers/i2c/busses/Kconfig | 19 ++ - drivers/i2c/busses/Makefile | 2 + - drivers/i2c/busses/i2c-bcm2708.c | 512 +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 533 insertions(+) - create mode 100644 drivers/i2c/busses/i2c-bcm2708.c - -diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index d252276feadf6b0b05cbe370330ed7cef5a16857..b81d8133639a34dcec85df50f064d8e9a9ba22fa 100644 ---- a/drivers/i2c/busses/Kconfig -+++ b/drivers/i2c/busses/Kconfig -@@ -8,6 +8,25 @@ menu "I2C Hardware Bus support" - comment "PC SMBus host controller drivers" - depends on PCI - -+config I2C_BCM2708 -+ tristate "BCM2708 BSC" -+ depends on ARCH_BCM2835 -+ help -+ Enabling this option will add BSC (Broadcom Serial Controller) -+ support for the BCM2708. BSC is a Broadcom proprietary bus compatible -+ with I2C/TWI/SMBus. -+ -+config I2C_BCM2708_BAUDRATE -+ prompt "BCM2708 I2C baudrate" -+ depends on I2C_BCM2708 -+ int -+ default 100000 -+ help -+ Set the I2C baudrate. This will alter the default value. A -+ different baudrate can be set by using a module parameter as well. If -+ no parameter is provided when loading, this is the value that will be -+ used. -+ - config I2C_ALI1535 - tristate "ALI 1535" - depends on PCI -diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile -index 29764cc20a440752841272ddfed3993048ecd105..26ae016a15e72cbb2e742aa89238636e3b846b8e 100644 ---- a/drivers/i2c/busses/Makefile -+++ b/drivers/i2c/busses/Makefile -@@ -2,6 +2,8 @@ - # Makefile for the i2c bus drivers. - # - -+obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o -+ - # ACPI drivers - obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o - -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -new file mode 100644 -index 0000000000000000000000000000000000000000..962f2e5c7455d91bf32925d785f5f16b83b049f8 ---- /dev/null -+++ b/drivers/i2c/busses/i2c-bcm2708.c -@@ -0,0 +1,512 @@ -+/* -+ * Driver for Broadcom BCM2708 BSC Controllers -+ * -+ * Copyright (C) 2012 Chris Boot & Frank Buss -+ * -+ * This driver is inspired by: -+ * i2c-ocores.c, by Peter Korsgaard -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* BSC register offsets */ -+#define BSC_C 0x00 -+#define BSC_S 0x04 -+#define BSC_DLEN 0x08 -+#define BSC_A 0x0c -+#define BSC_FIFO 0x10 -+#define BSC_DIV 0x14 -+#define BSC_DEL 0x18 -+#define BSC_CLKT 0x1c -+ -+/* Bitfields in BSC_C */ -+#define BSC_C_I2CEN 0x00008000 -+#define BSC_C_INTR 0x00000400 -+#define BSC_C_INTT 0x00000200 -+#define BSC_C_INTD 0x00000100 -+#define BSC_C_ST 0x00000080 -+#define BSC_C_CLEAR_1 0x00000020 -+#define BSC_C_CLEAR_2 0x00000010 -+#define BSC_C_READ 0x00000001 -+ -+/* Bitfields in BSC_S */ -+#define BSC_S_CLKT 0x00000200 -+#define BSC_S_ERR 0x00000100 -+#define BSC_S_RXF 0x00000080 -+#define BSC_S_TXE 0x00000040 -+#define BSC_S_RXD 0x00000020 -+#define BSC_S_TXD 0x00000010 -+#define BSC_S_RXR 0x00000008 -+#define BSC_S_TXW 0x00000004 -+#define BSC_S_DONE 0x00000002 -+#define BSC_S_TA 0x00000001 -+ -+#define I2C_WAIT_LOOP_COUNT 200 -+ -+#define DRV_NAME "bcm2708_i2c" -+ -+static unsigned int baudrate; -+module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(baudrate, "The I2C baudrate"); -+ -+static bool combined = false; -+module_param(combined, bool, 0644); -+MODULE_PARM_DESC(combined, "Use combined transactions"); -+ -+struct bcm2708_i2c { -+ struct i2c_adapter adapter; -+ -+ spinlock_t lock; -+ void __iomem *base; -+ int irq; -+ struct clk *clk; -+ u32 cdiv; -+ u32 clk_tout; -+ -+ struct completion done; -+ -+ struct i2c_msg *msg; -+ int pos; -+ int nmsgs; -+ bool error; -+}; -+ -+static inline u32 bcm2708_rd(struct bcm2708_i2c *bi, unsigned reg) -+{ -+ return readl(bi->base + reg); -+} -+ -+static inline void bcm2708_wr(struct bcm2708_i2c *bi, unsigned reg, u32 val) -+{ -+ writel(val, bi->base + reg); -+} -+ -+static inline void bcm2708_bsc_reset(struct bcm2708_i2c *bi) -+{ -+ bcm2708_wr(bi, BSC_C, 0); -+ bcm2708_wr(bi, BSC_S, BSC_S_CLKT | BSC_S_ERR | BSC_S_DONE); -+} -+ -+static inline void bcm2708_bsc_fifo_drain(struct bcm2708_i2c *bi) -+{ -+ while ((bi->pos < bi->msg->len) && (bcm2708_rd(bi, BSC_S) & BSC_S_RXD)) -+ bi->msg->buf[bi->pos++] = bcm2708_rd(bi, BSC_FIFO); -+} -+ -+static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) -+{ -+ while ((bi->pos < bi->msg->len) && (bcm2708_rd(bi, BSC_S) & BSC_S_TXD)) -+ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); -+} -+ -+static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) -+{ -+ u32 cdiv, s, clk_tout; -+ u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; -+ int wait_loops = I2C_WAIT_LOOP_COUNT; -+ -+ /* Can't call clk_get_rate as it locks a mutex and here we are spinlocked. -+ * Use the value that we cached in the probe. -+ */ -+ cdiv = bi->cdiv; -+ clk_tout = bi->clk_tout; -+ -+ if (bi->msg->flags & I2C_M_RD) -+ c |= BSC_C_INTR | BSC_C_READ; -+ else -+ c |= BSC_C_INTT; -+ -+ bcm2708_wr(bi, BSC_CLKT, clk_tout); -+ bcm2708_wr(bi, BSC_DIV, cdiv); -+ bcm2708_wr(bi, BSC_A, bi->msg->addr); -+ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); -+ if (combined) -+ { -+ /* Do the next two messages meet combined transaction criteria? -+ - Current message is a write, next message is a read -+ - Both messages to same slave address -+ - Write message can fit inside FIFO (16 bytes or less) */ -+ if ( (bi->nmsgs > 1) && -+ !(bi->msg[0].flags & I2C_M_RD) && (bi->msg[1].flags & I2C_M_RD) && -+ (bi->msg[0].addr == bi->msg[1].addr) && (bi->msg[0].len <= 16)) { -+ -+ /* Clear FIFO */ -+ bcm2708_wr(bi, BSC_C, BSC_C_CLEAR_1); -+ -+ /* Fill FIFO with entire write message (16 byte FIFO) */ -+ while (bi->pos < bi->msg->len) { -+ bcm2708_wr(bi, BSC_FIFO, bi->msg->buf[bi->pos++]); -+ } -+ /* Start write transfer (no interrupts, don't clear FIFO) */ -+ bcm2708_wr(bi, BSC_C, BSC_C_I2CEN | BSC_C_ST); -+ -+ /* poll for transfer start bit (should only take 1-20 polls) */ -+ do { -+ s = bcm2708_rd(bi, BSC_S); -+ } while (!(s & (BSC_S_TA | BSC_S_ERR | BSC_S_CLKT | BSC_S_DONE)) && --wait_loops >= 0); -+ -+ /* did we time out or some error occured? */ -+ if (wait_loops < 0 || (s & (BSC_S_ERR | BSC_S_CLKT))) { -+ return -1; -+ } -+ -+ /* Send next read message before the write transfer finishes. */ -+ bi->nmsgs--; -+ bi->msg++; -+ bi->pos = 0; -+ bcm2708_wr(bi, BSC_DLEN, bi->msg->len); -+ c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_INTR | BSC_C_ST | BSC_C_READ; -+ } -+ } -+ bcm2708_wr(bi, BSC_C, c); -+ -+ return 0; -+} -+ -+static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) -+{ -+ struct bcm2708_i2c *bi = dev_id; -+ bool handled = true; -+ u32 s; -+ int ret; -+ -+ spin_lock(&bi->lock); -+ -+ /* we may see camera interrupts on the "other" I2C channel -+ Just return if we've not sent anything */ -+ if (!bi->nmsgs || !bi->msg) { -+ goto early_exit; -+ } -+ -+ s = bcm2708_rd(bi, BSC_S); -+ -+ if (s & (BSC_S_CLKT | BSC_S_ERR)) { -+ bcm2708_bsc_reset(bi); -+ bi->error = true; -+ -+ bi->msg = 0; /* to inform the that all work is done */ -+ bi->nmsgs = 0; -+ /* wake up our bh */ -+ complete(&bi->done); -+ } else if (s & BSC_S_DONE) { -+ bi->nmsgs--; -+ -+ if (bi->msg->flags & I2C_M_RD) { -+ bcm2708_bsc_fifo_drain(bi); -+ } -+ -+ bcm2708_bsc_reset(bi); -+ -+ if (bi->nmsgs) { -+ /* advance to next message */ -+ bi->msg++; -+ bi->pos = 0; -+ ret = bcm2708_bsc_setup(bi); -+ if (ret < 0) { -+ bcm2708_bsc_reset(bi); -+ bi->error = true; -+ bi->msg = 0; /* to inform the that all work is done */ -+ bi->nmsgs = 0; -+ /* wake up our bh */ -+ complete(&bi->done); -+ goto early_exit; -+ } -+ } else { -+ bi->msg = 0; /* to inform the that all work is done */ -+ bi->nmsgs = 0; -+ /* wake up our bh */ -+ complete(&bi->done); -+ } -+ } else if (s & BSC_S_TXW) { -+ bcm2708_bsc_fifo_fill(bi); -+ } else if (s & BSC_S_RXR) { -+ bcm2708_bsc_fifo_drain(bi); -+ } else { -+ handled = false; -+ } -+ -+early_exit: -+ spin_unlock(&bi->lock); -+ -+ return handled ? IRQ_HANDLED : IRQ_NONE; -+} -+ -+static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap, -+ struct i2c_msg *msgs, int num) -+{ -+ struct bcm2708_i2c *bi = adap->algo_data; -+ unsigned long flags; -+ int ret; -+ -+ spin_lock_irqsave(&bi->lock, flags); -+ -+ reinit_completion(&bi->done); -+ bi->msg = msgs; -+ bi->pos = 0; -+ bi->nmsgs = num; -+ bi->error = false; -+ -+ ret = bcm2708_bsc_setup(bi); -+ -+ spin_unlock_irqrestore(&bi->lock, flags); -+ -+ /* check the result of the setup */ -+ if (ret < 0) -+ { -+ dev_err(&adap->dev, "transfer setup timed out\n"); -+ goto error_timeout; -+ } -+ -+ ret = wait_for_completion_timeout(&bi->done, adap->timeout); -+ if (ret == 0) { -+ dev_err(&adap->dev, "transfer timed out\n"); -+ goto error_timeout; -+ } -+ -+ ret = bi->error ? -EIO : num; -+ return ret; -+ -+error_timeout: -+ spin_lock_irqsave(&bi->lock, flags); -+ bcm2708_bsc_reset(bi); -+ bi->msg = 0; /* to inform the interrupt handler that there's nothing else to be done */ -+ bi->nmsgs = 0; -+ spin_unlock_irqrestore(&bi->lock, flags); -+ return -ETIMEDOUT; -+} -+ -+static u32 bcm2708_i2c_functionality(struct i2c_adapter *adap) -+{ -+ return I2C_FUNC_I2C | /*I2C_FUNC_10BIT_ADDR |*/ I2C_FUNC_SMBUS_EMUL; -+} -+ -+static struct i2c_algorithm bcm2708_i2c_algorithm = { -+ .master_xfer = bcm2708_i2c_master_xfer, -+ .functionality = bcm2708_i2c_functionality, -+}; -+ -+static int bcm2708_i2c_probe(struct platform_device *pdev) -+{ -+ struct resource *regs; -+ int irq, err = -ENOMEM; -+ struct clk *clk; -+ struct bcm2708_i2c *bi; -+ struct i2c_adapter *adap; -+ unsigned long bus_hz; -+ u32 cdiv, clk_tout; -+ u32 baud; -+ -+ baud = CONFIG_I2C_BCM2708_BAUDRATE; -+ -+ if (pdev->dev.of_node) { -+ u32 bus_clk_rate; -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); -+ if (pdev->id < 0) { -+ dev_err(&pdev->dev, "alias is missing\n"); -+ return -EINVAL; -+ } -+ if (!of_property_read_u32(pdev->dev.of_node, -+ "clock-frequency", &bus_clk_rate)) -+ baud = bus_clk_rate; -+ else -+ dev_warn(&pdev->dev, -+ "Could not read clock-frequency property\n"); -+ } -+ -+ if (baudrate) -+ baud = baudrate; -+ -+ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!regs) { -+ dev_err(&pdev->dev, "could not get IO memory\n"); -+ return -ENXIO; -+ } -+ -+ irq = platform_get_irq(pdev, 0); -+ if (irq < 0) { -+ dev_err(&pdev->dev, "could not get IRQ\n"); -+ return irq; -+ } -+ -+ clk = clk_get(&pdev->dev, NULL); -+ if (IS_ERR(clk)) { -+ dev_err(&pdev->dev, "could not find clk: %ld\n", PTR_ERR(clk)); -+ return PTR_ERR(clk); -+ } -+ -+ err = clk_prepare_enable(clk); -+ if (err) { -+ dev_err(&pdev->dev, "could not enable clk: %d\n", err); -+ goto out_clk_put; -+ } -+ -+ bi = kzalloc(sizeof(*bi), GFP_KERNEL); -+ if (!bi) -+ goto out_clk_disable; -+ -+ platform_set_drvdata(pdev, bi); -+ -+ adap = &bi->adapter; -+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DDC; -+ adap->algo = &bcm2708_i2c_algorithm; -+ adap->algo_data = bi; -+ adap->dev.parent = &pdev->dev; -+ adap->nr = pdev->id; -+ strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); -+ adap->dev.of_node = pdev->dev.of_node; -+ -+ switch (pdev->id) { -+ case 0: -+ adap->class = I2C_CLASS_HWMON; -+ break; -+ case 1: -+ adap->class = I2C_CLASS_DDC; -+ break; -+ case 2: -+ adap->class = I2C_CLASS_DDC; -+ break; -+ default: -+ dev_err(&pdev->dev, "can only bind to BSC 0, 1 or 2\n"); -+ err = -ENXIO; -+ goto out_free_bi; -+ } -+ -+ spin_lock_init(&bi->lock); -+ init_completion(&bi->done); -+ -+ bi->base = ioremap(regs->start, resource_size(regs)); -+ if (!bi->base) { -+ dev_err(&pdev->dev, "could not remap memory\n"); -+ goto out_free_bi; -+ } -+ -+ bi->irq = irq; -+ bi->clk = clk; -+ -+ err = request_irq(irq, bcm2708_i2c_interrupt, IRQF_SHARED, -+ dev_name(&pdev->dev), bi); -+ if (err) { -+ dev_err(&pdev->dev, "could not request IRQ: %d\n", err); -+ goto out_iounmap; -+ } -+ -+ bcm2708_bsc_reset(bi); -+ -+ err = i2c_add_numbered_adapter(adap); -+ if (err < 0) { -+ dev_err(&pdev->dev, "could not add I2C adapter: %d\n", err); -+ goto out_free_irq; -+ } -+ -+ bus_hz = clk_get_rate(bi->clk); -+ cdiv = bus_hz / baud; -+ if (cdiv > 0xffff) { -+ cdiv = 0xffff; -+ baud = bus_hz / cdiv; -+ } -+ -+ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. -+ if (clk_tout > 0xffff) -+ clk_tout = 0xffff; -+ -+ bi->cdiv = cdiv; -+ bi->clk_tout = clk_tout; -+ -+ dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", -+ pdev->id, (unsigned long)regs->start, irq, baud); -+ -+ return 0; -+ -+out_free_irq: -+ free_irq(bi->irq, bi); -+out_iounmap: -+ iounmap(bi->base); -+out_free_bi: -+ kfree(bi); -+out_clk_disable: -+ clk_disable_unprepare(clk); -+out_clk_put: -+ clk_put(clk); -+ return err; -+} -+ -+static int bcm2708_i2c_remove(struct platform_device *pdev) -+{ -+ struct bcm2708_i2c *bi = platform_get_drvdata(pdev); -+ -+ platform_set_drvdata(pdev, NULL); -+ -+ i2c_del_adapter(&bi->adapter); -+ free_irq(bi->irq, bi); -+ iounmap(bi->base); -+ clk_disable_unprepare(bi->clk); -+ clk_put(bi->clk); -+ kfree(bi); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm2708_i2c_of_match[] = { -+ { .compatible = "brcm,bcm2708-i2c" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2708_i2c_of_match); -+ -+static struct platform_driver bcm2708_i2c_driver = { -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = bcm2708_i2c_of_match, -+ }, -+ .probe = bcm2708_i2c_probe, -+ .remove = bcm2708_i2c_remove, -+}; -+ -+// module_platform_driver(bcm2708_i2c_driver); -+ -+ -+static int __init bcm2708_i2c_init(void) -+{ -+ return platform_driver_register(&bcm2708_i2c_driver); -+} -+ -+static void __exit bcm2708_i2c_exit(void) -+{ -+ platform_driver_unregister(&bcm2708_i2c_driver); -+} -+ -+module_init(bcm2708_i2c_init); -+module_exit(bcm2708_i2c_exit); -+ -+ -+ -+MODULE_DESCRIPTION("BSC controller driver for Broadcom BCM2708"); -+MODULE_AUTHOR("Chris Boot "); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:" DRV_NAME); - -From fa468e89c790f2e432205e3b16d26e5365d98ec7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 049/122] char: broadcom: Add vcio module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add module for accessing the mailbox property channel through -/dev/vcio. Was previously in bcm2708-vcio. - -Signed-off-by: Noralf Trønnes ---- - drivers/char/broadcom/Kconfig | 6 ++ - drivers/char/broadcom/Makefile | 1 + - drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 182 insertions(+) - create mode 100644 drivers/char/broadcom/vcio.c - -diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig -index f7885466f5bf9c0cf45f2057d07a0d24151f10c3..032164919350db25c586c36f0e05d3e4891fb835 100644 ---- a/drivers/char/broadcom/Kconfig -+++ b/drivers/char/broadcom/Kconfig -@@ -22,6 +22,12 @@ config BCM2708_VCMEM - help - Helper for videocore memory access and total size allocation. - -+config BCM_VCIO -+ tristate "Mailbox userspace access" -+ depends on BCM2835_MBOX -+ help -+ Gives access to the mailbox property channel from userspace. -+ - endif - - config BCM_VC_SM -diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile -index 667d33ef38f3512b52818537c11d369798b6f1c0..14775c9b20b4b6a58f681f3687614676b5e2a871 100644 ---- a/drivers/char/broadcom/Makefile -+++ b/drivers/char/broadcom/Makefile -@@ -1,5 +1,6 @@ - obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ - obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -+obj-$(CONFIG_BCM_VCIO) += vcio.o - obj-$(CONFIG_BCM_VC_SM) += vc_sm/ - - obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o -diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c19bc2075c77879563ef5e59038b5a140fe5aba0 ---- /dev/null -+++ b/drivers/char/broadcom/vcio.c -@@ -0,0 +1,175 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * Copyright (C) 2015 Noralf Trønnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define MBOX_CHAN_PROPERTY 8 -+ -+#define VCIO_IOC_MAGIC 100 -+#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) -+ -+static struct { -+ dev_t devt; -+ struct cdev cdev; -+ struct class *class; -+ struct rpi_firmware *fw; -+} vcio; -+ -+static int vcio_user_property_list(void *user) -+{ -+ u32 *buf, size; -+ int ret; -+ -+ /* The first 32-bit is the size of the buffer */ -+ if (copy_from_user(&size, user, sizeof(size))) -+ return -EFAULT; -+ -+ buf = kmalloc(size, GFP_KERNEL); -+ if (!buf) -+ return -ENOMEM; -+ -+ if (copy_from_user(buf, user, size)) { -+ kfree(buf); -+ return -EFAULT; -+ } -+ -+ /* Strip off protocol encapsulation */ -+ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); -+ if (ret) { -+ kfree(buf); -+ return ret; -+ } -+ -+ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; -+ if (copy_to_user(user, buf, size)) -+ ret = -EFAULT; -+ -+ kfree(buf); -+ -+ return ret; -+} -+ -+static int vcio_device_open(struct inode *inode, struct file *file) -+{ -+ try_module_get(THIS_MODULE); -+ -+ return 0; -+} -+ -+static int vcio_device_release(struct inode *inode, struct file *file) -+{ -+ module_put(THIS_MODULE); -+ -+ return 0; -+} -+ -+static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, -+ unsigned long ioctl_param) -+{ -+ switch (ioctl_num) { -+ case IOCTL_MBOX_PROPERTY: -+ return vcio_user_property_list((void *)ioctl_param); -+ default: -+ pr_err("unknown ioctl: %d\n", ioctl_num); -+ return -EINVAL; -+ } -+} -+ -+const struct file_operations vcio_fops = { -+ .unlocked_ioctl = vcio_device_ioctl, -+ .open = vcio_device_open, -+ .release = vcio_device_release, -+}; -+ -+static int __init vcio_init(void) -+{ -+ struct device_node *np; -+ static struct device *dev; -+ int ret; -+ -+ np = of_find_compatible_node(NULL, NULL, -+ "raspberrypi,bcm2835-firmware"); -+/* Uncomment this when we only boot with Device Tree -+ if (!of_device_is_available(np)) -+ return -ENODEV; -+*/ -+ vcio.fw = rpi_firmware_get(np); -+ if (!vcio.fw) -+ return -ENODEV; -+ -+ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); -+ if (ret) { -+ pr_err("failed to allocate device number\n"); -+ return ret; -+ } -+ -+ cdev_init(&vcio.cdev, &vcio_fops); -+ vcio.cdev.owner = THIS_MODULE; -+ ret = cdev_add(&vcio.cdev, vcio.devt, 1); -+ if (ret) { -+ pr_err("failed to register device\n"); -+ goto err_unregister_chardev; -+ } -+ -+ /* -+ * Create sysfs entries -+ * 'bcm2708_vcio' is used for backwards compatibility so we don't break -+ * userspace. Raspian has a udev rule that changes the permissions. -+ */ -+ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); -+ if (IS_ERR(vcio.class)) { -+ ret = PTR_ERR(vcio.class); -+ pr_err("failed to create class\n"); -+ goto err_cdev_del; -+ } -+ -+ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); -+ if (IS_ERR(dev)) { -+ ret = PTR_ERR(dev); -+ pr_err("failed to create device\n"); -+ goto err_class_destroy; -+ } -+ -+ return 0; -+ -+err_class_destroy: -+ class_destroy(vcio.class); -+err_cdev_del: -+ cdev_del(&vcio.cdev); -+err_unregister_chardev: -+ unregister_chrdev_region(vcio.devt, 1); -+ -+ return ret; -+} -+module_init(vcio_init); -+ -+static void __exit vcio_exit(void) -+{ -+ device_destroy(vcio.class, vcio.devt); -+ class_destroy(vcio.class); -+ cdev_del(&vcio.cdev); -+ unregister_chrdev_region(vcio.devt, 1); -+} -+module_exit(vcio_exit); -+ -+MODULE_AUTHOR("Gray Girling"); -+MODULE_AUTHOR("Noralf Trønnes"); -+MODULE_DESCRIPTION("Mailbox userspace access"); -+MODULE_LICENSE("GPL"); - -From 83532363df9ebe5f7e8cea458bcfd9b67a0e815a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 050/122] firmware: bcm2835: Support ARCH_BCM270x -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Support booting without Device Tree. -Turn on USB power. -Load driver early because of lacking support for deferred probing -in many drivers. - -Signed-off-by: Noralf Trønnes - -firmware: bcm2835: Don't turn on USB power - -The raspberrypi-power driver is now used to turn on USB power. - -This partly reverts commit: -firmware: bcm2835: Support ARCH_BCM270x - -Signed-off-by: Noralf Trønnes ---- - drivers/firmware/raspberrypi.c | 19 +++++++++++++++++-- - 1 file changed, 17 insertions(+), 2 deletions(-) - -diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c -index dd506cd3a5b874f9e1acd07efb8cd151bb6145d1..3f070bd38a91511c986e3fb114b15bd4ac32634c 100644 ---- a/drivers/firmware/raspberrypi.c -+++ b/drivers/firmware/raspberrypi.c -@@ -28,6 +28,8 @@ struct rpi_firmware { - u32 enabled; - }; - -+static struct platform_device *g_pdev; -+ - static DEFINE_MUTEX(transaction_lock); - - static void response_callback(struct mbox_client *cl, void *msg) -@@ -207,6 +209,7 @@ static int rpi_firmware_probe(struct platform_device *pdev) - init_completion(&fw->c); - - platform_set_drvdata(pdev, fw); -+ g_pdev = pdev; - - rpi_firmware_print_firmware_revision(fw); - -@@ -218,6 +221,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) - struct rpi_firmware *fw = platform_get_drvdata(pdev); - - mbox_free_channel(fw->chan); -+ g_pdev = NULL; - - return 0; - } -@@ -230,7 +234,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) - */ - struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) - { -- struct platform_device *pdev = of_find_device_by_node(firmware_node); -+ struct platform_device *pdev = g_pdev; - - if (!pdev) - return NULL; -@@ -253,7 +257,18 @@ static struct platform_driver rpi_firmware_driver = { - .probe = rpi_firmware_probe, - .remove = rpi_firmware_remove, - }; --module_platform_driver(rpi_firmware_driver); -+ -+static int __init rpi_firmware_init(void) -+{ -+ return platform_driver_register(&rpi_firmware_driver); -+} -+subsys_initcall(rpi_firmware_init); -+ -+static void __init rpi_firmware_exit(void) -+{ -+ platform_driver_unregister(&rpi_firmware_driver); -+} -+module_exit(rpi_firmware_exit); - - MODULE_AUTHOR("Eric Anholt "); - MODULE_DESCRIPTION("Raspberry Pi firmware driver"); - -From c1316c3428ecf0ef0ad3c39a6ff7e367b3483c4f Mon Sep 17 00:00:00 2001 -From: Vincent Sanders -Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 051/122] bcm2835: add v4l2 camera device - -- Supports raw YUV capture, preview, JPEG and H264. -- Uses videobuf2 for data transfer, using dma_buf. -- Uses 3.6.10 timestamping -- Camera power based on use -- Uses immutable input mode on video encoder - -Signed-off-by: Daniel Stone -Signed-off-by: Luke Diamand - -V4L2: Fixes from 6by9 - -V4L2: Fix EV values. Add manual shutter speed control - -V4L2 EV values should be in units of 1/1000. Corrected. -Add support for V4L2_CID_EXPOSURE_ABSOLUTE which should -give manual shutter control. Requires manual exposure mode -to be selected first. - -Signed-off-by: Dave Stevenson - -V4L2: Correct JPEG Q-factor range - -Should be 1-100, not 0-100 - -Signed-off-by: Dave Stevenson - -V4L2: Fix issue of driver jamming if STREAMON failed. - -Fix issue where the driver was left in a partially enabled -state if STREAMON failed, and would then reject many IOCTLs -as it thought it was streaming. - -Signed-off-by: Dave Stevenson - -V4L2: Fix ISO controls. - -Driver was passing the index to the GPU, and not the desired -ISO value. - -Signed-off-by: Dave Stevenson - -V4L2: Add flicker avoidance controls - -Add support for V4L2_CID_POWER_LINE_FREQUENCY to set flicker -avoidance frequencies. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for frame rate control. - -Add support for frame rate (or time per frame as V4L2 -inverts it) control via s_parm. - -Signed-off-by: Dave Stevenson - -V4L2: Improve G_FBUF handling so we pass conformance - -Return some sane numbers for get framebuffer so that -we pass conformance. - -Signed-off-by: Dave Stevenson - -V4L2: Fix information advertised through g_vidfmt - -Width and height were being stored based on incorrect -values. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for inline H264 headers - -Add support for V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER -to control H264 inline headers. -Requires firmware fix to work correctly, otherwise format -has to be set to H264 before this parameter is set. - -Signed-off-by: Dave Stevenson - -V4L2: Fix JPEG timestamp issue - -JPEG images were coming through from the GPU with timestamp -of 0. Detect this and give current system time instead -of some invalid value. - -Signed-off-by: Dave Stevenson - -V4L2: Fix issue when switching down JPEG resolution. - -JPEG buffer size calculation is based on input resolution. -Input resolution was being configured after output port -format. Caused failures if switching from one JPEG resolution -to a smaller one. - -Signed-off-by: Dave Stevenson - -V4L2: Enable MJPEG encoding - -Requires GPU firmware update to support MJPEG encoder. - -Signed-off-by: Dave Stevenson - -V4L2: Correct flag settings for compressed formats - -Set flags field correctly on enum_fmt_vid_cap for compressed -image formats. - -Signed-off-by: Dave Stevenson - -V4L2: H264 profile & level ctrls, FPS control and auto exp pri - -Several control handling updates. -H264 profile and level controls. -Timeperframe/FPS reworked to add V4L2_CID_EXPOSURE_AUTO_PRIORITY to -select whether AE is allowed to override the framerate specified. - -Signed-off-by: Dave Stevenson - -V4L2: Correct BGR24 to RGB24 in format table - -Signed-off-by: Dave Stevenson - -V4L2: Add additional pixel formats. Correct colourspace - -Adds the other flavours of YUYV, and NV12. -Corrects the overlay advertised colourspace. - -Signed-off-by: Dave Stevenson - -V4L2: Drop logging msg from info to debug - -Signed-off-by: Dave Stevenson - -V4L2: Initial pass at scene modes. - -Only supports exposure mode and metering modes. - -Signed-off-by: Dave Stevenson - -V4L2: Add manual white balance control. - -Adds support for V4L2_CID_RED_BALANCE and -V4L2_CID_BLUE_BALANCE. Only has an effect if -V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE has -V4L2_WHITE_BALANCE_MANUAL selected. - -Signed-off-by: Dave Stevenson - -config: Enable V4L / MMAL driver - -V4L2: Increase the MMAL timeout to 3sec - -MJPEG codec flush is now taking longer and results -in a kernel panic if the driver has stopped waiting for -the result when it finally completes. -Increase the timeout value from 1 to 3secs. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for setting H264_I_PERIOD - -Adds support for the parameter V4L2_CID_MPEG_VIDEO_H264_I_PERIOD -to set the frequency with which I frames are produced. - -Signed-off-by: Dave Stevenson - -V4L2: Enable GPU function for removing padding from images. - -GPU can now support arbitrary strides, although may require -additional processing to achieve it. Enable this feature -so that the images delivered are the size requested. - -Signed-off-by: Dave Stevenson - -V4L2: Add support for V4L2_PIX_FMT_BGR32 - -Signed-off-by: Dave Stevenson - -V4L2: Set the colourspace to avoid odd YUV-RGB conversions - -Removes the amiguity from the conversion routines and stops -them dropping back to the SD vs HD choice of coeffs. - -Signed-off-by: Dave Stevenson - -V4L2: Make video/still threshold a run-time param - -Move the define for at what resolution the driver -switches from a video mode capture to a stills mode -capture to module parameters. - -Signed-off-by: Dave Stevenson - -V4L2: Fix incorrect pool sizing - -Signed-off-by: Dave Stevenson - -V4L2: Add option to disable enum_framesizes. - -Gstreamer's handling of a driver that advertises -V4L2_FRMSIZE_TYPE_STEPWISE to define the supported -resolutions is broken. See bug -https://bugzilla.gnome.org/show_bug.cgi?id=726521 - -Optional parameter of gst_v4l2src_is_broken added. -If non-zero, the driver claims not to support that -ioctl, and gstreamer should be happy again (it -guesses a set of defaults for itself). - -Signed-off-by: Dave Stevenson - -V4L2: Add support for more image formats - -Adds YVU420 (YV12), YVU420SP (NV21), and BGR888. - -Signed-off-by: Dave Stevenson - -V4L2: Extend range for V4L2_CID_MPEG_VIDEO_H264_I_PERIOD - -Request to extend the range from the fairly arbitrary -1000 frames (33 seconds at 30fps). Extend out to the -max range supported (int32 value). -Also allow 0, which is handled by the codec as only -send an I-frame on the first frame and never again. -There may be an exception if it detects a significant -scene change, but there's no easy way around that. - -Signed-off-by: Dave Stevenson - -bcm2835-camera: stop_streaming now has a void return - -BCM2835-V4L2: Fix compliance test failures - -VIDIOC_TRY_FMT and VIDIOC_S_FMT tests were faling due -to reporting V4L2_COLORSPACE_JPEG when the colour -format wasn't V4L2_PIX_FMT_JPEG. -Now reports V4L2_COLORSPACE_SMPTE170M for YUV formats. - -bcm2835 camera planar/packed stride length - -Added a field to the mmal_fmt struct used to compute the bytes per line -when using a particular format. This results in the correct stride being -calculated even when the format is planar. - -Signed-off-by: Garrett Wilson - -bcm2835: camera: check for scene not being found - -static analysis by cppcheck detected some potential NULL pointer -dereference issues: - -[drivers/media/platform/bcm2835/controls.c:854]: (error) Possible null - pointer dereference: scene - (and lines 858, 859 too) - -it is possible that scene is not found because of an invalue ctrl->val -and is therefore NULL and hence causing a null pointer dereference. - -Signed-off-by: Colin Ian King - -bcm2835: memcpy port data to m rather than rmsg - -static analysis by cppcheck detected a memcpy to rmsg which is -not actually initialized at that point. The memcpy should be copying -to variable m instead. - -Signed-off-by: Colin Ian King - -BCM2835-V4L2: Return buffers to videobuf2 on shutdown - -https://github.com/raspberrypi/linux/issues/817 -Fixes the kernel warning from videobuf2 as buffers -are now returned as they are being flushed on -stop_streaming. - -squash: Fixup bcm2835-camera for changes in kernel 4.4 api - -v4l2: Fix up driver to upstream timestamp changes - -bcm2835-camera: fix a bug in computation of frame timestamp - -Fixes #1318 - -V4L2 driver updates (#1393) - -* BCM2835-V4L2: Correct ISO control and add V4L2_CID_ISO_SENSITIVITY_AUTO - -https://github.com/raspberrypi/linux/issues/1251 - -V4L2_CID_ISO_SENSITIVITY was not advertising ISO*1000 as it should. -V4L2_CID_ISO_SENSITIVITY_AUTO was not implemented, so was taking -V4L2_CID_ISO_SENSITIVITY as 0 for auto mode. -Still accepts 0 for auto, but also abides by the new parameter. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Add a video_nr parameter. - -Adds a kernel parameter "video_nr" to specify the preferred -/dev/videoX device node. -https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=136120&p=905545 - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Add support for multiple cameras - -Ask GPU on load how many cameras have been detected, and -enumerate that number of devices. -Only applicable on the Compute Module as no other device -exposes multiple CSI2 interfaces. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Add control of the overlay location and alpha. - -Actually do something useful in vidioc_s_fmt_vid_overlay and -vidioc_try_fmt_vid_overlay, rather than effectively having -read-only fields. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: V4L2-Compliance failure fix - -VIDIOC_TRY_FMT was failing due to bytesperline not -being set correctly by default. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -* BCM2835-V4L2: Make all module parameters static - -Clean up to correct variable scope - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -V4L2: Request maximum resolution from GPU - -Get resolution information about the sensors from the GPU -and advertise it correctly. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -BCM2835-V4L2: Increase minimum resolution to 32x32 - -https://github.com/raspberrypi/linux/issues/1498 showed -up that 16x16 is failing to work on the GPU for some reason. - -GPU bug being tracked on -https://github.com/raspberrypi/firmware/issues/607 -Workaround here by increasing minimum resolution via V4L2 -to 32x32. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -[media]: bcm2835-camera: fix compilation error - -There is an error when compiling rpi-4.6.y branch: - CC [M] drivers/media/platform/bcm2835/bcm2835-camera.o -drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] - .queue_setup = queue_setup, - ^ -drivers/media/platform/bcm2835/bcm2835-camera.c:639:17: note: (near initialization for 'bm2835_mmal_video_qops.queue_setup') - -The const void *parg in setup_queue callback is not needed since commit: -df9ecb0cad14b952a2865f8b3af86b2bbadfab45. -This commit removes it. - -Signed-off-by: Slawomir Stepien - -bcm2835-camera: Fix max/min error when looping over cameras/resolutions - -See: https://github.com/raspberrypi/linux/issues/1447#issuecomment-221303506 - -BCM2835-V4L2: Correct handling for BGR24 vs RGB24. - -There was a bug in the GPU firmware that had reversed these -two formats. -Detect the old firmware, and reverse the formats if necessary. - -Signed-off-by: Dave Stevenson <6by9@users.noreply.github.com> - -BCM2835-v4l2: Fix a conformance test failure - -Format ioctls: - test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK - warn: v4l2-test-formats.cpp(1195): S_PARM is supported but - doesn't report V4L2_CAP_TIMEPERFRAME. - fail: v4l2-test-formats.cpp(1118): node->has_frmintervals - && !cap->capability ---- - Documentation/video4linux/bcm2835-v4l2.txt | 60 + - drivers/media/platform/Kconfig | 2 + - drivers/media/platform/Makefile | 2 + - drivers/media/platform/bcm2835/Kconfig | 25 + - drivers/media/platform/bcm2835/Makefile | 5 + - drivers/media/platform/bcm2835/bcm2835-camera.c | 2016 ++++++++++++++++++++++ - drivers/media/platform/bcm2835/bcm2835-camera.h | 145 ++ - drivers/media/platform/bcm2835/controls.c | 1345 +++++++++++++++ - drivers/media/platform/bcm2835/mmal-common.h | 53 + - drivers/media/platform/bcm2835/mmal-encodings.h | 127 ++ - drivers/media/platform/bcm2835/mmal-msg-common.h | 50 + - drivers/media/platform/bcm2835/mmal-msg-format.h | 81 + - drivers/media/platform/bcm2835/mmal-msg-port.h | 107 ++ - drivers/media/platform/bcm2835/mmal-msg.h | 404 +++++ - drivers/media/platform/bcm2835/mmal-parameters.h | 689 ++++++++ - drivers/media/platform/bcm2835/mmal-vchiq.c | 1916 ++++++++++++++++++++ - drivers/media/platform/bcm2835/mmal-vchiq.h | 178 ++ - 17 files changed, 7205 insertions(+) - create mode 100644 Documentation/video4linux/bcm2835-v4l2.txt - create mode 100644 drivers/media/platform/bcm2835/Kconfig - create mode 100644 drivers/media/platform/bcm2835/Makefile - create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.c - create mode 100644 drivers/media/platform/bcm2835/bcm2835-camera.h - create mode 100644 drivers/media/platform/bcm2835/controls.c - create mode 100644 drivers/media/platform/bcm2835/mmal-common.h - create mode 100644 drivers/media/platform/bcm2835/mmal-encodings.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg-common.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg-format.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg-port.h - create mode 100644 drivers/media/platform/bcm2835/mmal-msg.h - create mode 100644 drivers/media/platform/bcm2835/mmal-parameters.h - create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.c - create mode 100644 drivers/media/platform/bcm2835/mmal-vchiq.h - -diff --git a/Documentation/video4linux/bcm2835-v4l2.txt b/Documentation/video4linux/bcm2835-v4l2.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..c585a8fadf91c5a04453e442fc29ed893c65bf99 ---- /dev/null -+++ b/Documentation/video4linux/bcm2835-v4l2.txt -@@ -0,0 +1,60 @@ -+ -+BCM2835 (aka Raspberry Pi) V4L2 driver -+====================================== -+ -+1. Copyright -+============ -+ -+Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ -+2. License -+========== -+ -+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. -+ -+This program 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. -+ -+You should have received a copy of the GNU General Public License -+along with this program; if not, write to the Free Software -+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ -+3. Quick Start -+============== -+ -+You need a version 1.0 or later of v4l2-ctl, available from: -+ git://git.linuxtv.org/v4l-utils.git -+ -+$ sudo modprobe bcm2835-v4l2 -+ -+Turn on the overlay: -+ -+$ v4l2-ctl --overlay=1 -+ -+Turn off the overlay: -+ -+$ v4l2-ctl --overlay=0 -+ -+Set the capture format for video: -+ -+$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4 -+ -+(Note: 1088 not 1080). -+ -+Capture: -+ -+$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264 -+ -+Stills capture: -+ -+$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3 -+$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg -+ -+List of available formats: -+ -+$ v4l2-ctl --list-formats -diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig -index ce4a96fccc433c69269a14455ba94e053b515d91..0ea7ea95d824bf95747678e83ee7a61dea6f55cd 100644 ---- a/drivers/media/platform/Kconfig -+++ b/drivers/media/platform/Kconfig -@@ -11,6 +11,8 @@ menuconfig V4L_PLATFORM_DRIVERS - - if V4L_PLATFORM_DRIVERS - -+source "drivers/media/platform/bcm2835/Kconfig" -+ - source "drivers/media/platform/marvell-ccic/Kconfig" - - config VIDEO_VIA_CAMERA -diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile -index 40b18d12726ec52d0acfd15894337366eb420e89..b9f01f61c500a9b502d976b4c595be5013610aec 100644 ---- a/drivers/media/platform/Makefile -+++ b/drivers/media/platform/Makefile -@@ -2,6 +2,8 @@ - # Makefile for the video capture/playback device drivers. - # - -+obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/ -+ - obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o - - obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o -diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..58d5f9600d726cb20e6d04c54c58c53ac3a586d2 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/Kconfig -@@ -0,0 +1,25 @@ -+# Broadcom VideoCore IV v4l2 camera support -+ -+config VIDEO_BCM2835 -+ bool "Broadcom BCM2835 camera interface driver" -+ depends on VIDEO_V4L2 && ARCH_BCM2835 -+ ---help--- -+ Say Y here to enable camera host interface devices for -+ Broadcom BCM2835 SoC. This operates over the VCHIQ interface -+ to a service running on VideoCore. -+ -+ -+if VIDEO_BCM2835 -+ -+config VIDEO_BCM2835_MMAL -+ tristate "Broadcom BM2835 MMAL camera interface driver" -+ depends on BCM2708_VCHIQ -+ select VIDEOBUF2_VMALLOC -+ ---help--- -+ This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface -+ -+ To compile this driver as a module, choose M here: the -+ module will be called bcm2835-v4l2.o -+ -+ -+endif # VIDEO_BM2835 -diff --git a/drivers/media/platform/bcm2835/Makefile b/drivers/media/platform/bcm2835/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..b14ea91ac79c60f83bc63156436ef8cbcc893e9b ---- /dev/null -+++ b/drivers/media/platform/bcm2835/Makefile -@@ -0,0 +1,5 @@ -+bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o -+ -+obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o -+ -+ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 -diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4f03949aecf3afbf2e04df38289447195a8847a6 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/bcm2835-camera.c -@@ -0,0 +1,2016 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mmal-common.h" -+#include "mmal-encodings.h" -+#include "mmal-vchiq.h" -+#include "mmal-msg.h" -+#include "mmal-parameters.h" -+#include "bcm2835-camera.h" -+ -+#define BM2835_MMAL_VERSION "0.0.2" -+#define BM2835_MMAL_MODULE_NAME "bcm2835-v4l2" -+#define MIN_WIDTH 32 -+#define MIN_HEIGHT 32 -+#define MIN_BUFFER_SIZE (80*1024) -+ -+#define MAX_VIDEO_MODE_WIDTH 1280 -+#define MAX_VIDEO_MODE_HEIGHT 720 -+ -+#define MAX_BCM2835_CAMERAS 2 -+ -+MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); -+MODULE_AUTHOR("Vincent Sanders"); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION(BM2835_MMAL_VERSION); -+ -+int bcm2835_v4l2_debug; -+module_param_named(debug, bcm2835_v4l2_debug, int, 0644); -+MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2"); -+ -+#define UNSET (-1) -+static int video_nr[] = {[0 ... (MAX_BCM2835_CAMERAS - 1)] = UNSET }; -+module_param_array(video_nr, int, NULL, 0644); -+MODULE_PARM_DESC(video_nr, "videoX start numbers, -1 is autodetect"); -+ -+static int max_video_width = MAX_VIDEO_MODE_WIDTH; -+static int max_video_height = MAX_VIDEO_MODE_HEIGHT; -+module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -+MODULE_PARM_DESC(max_video_width, "Threshold for video mode"); -+module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -+MODULE_PARM_DESC(max_video_height, "Threshold for video mode"); -+ -+/* Gstreamer bug https://bugzilla.gnome.org/show_bug.cgi?id=726521 -+ * v4l2src does bad (and actually wrong) things when the vidioc_enum_framesizes -+ * function says type V4L2_FRMSIZE_TYPE_STEPWISE, which we do by default. -+ * It's happier if we just don't say anything at all, when it then -+ * sets up a load of defaults that it thinks might work. -+ * If gst_v4l2src_is_broken is non-zero, then we remove the function from -+ * our function table list (actually switch to an alternate set, but same -+ * result). -+ */ -+static int gst_v4l2src_is_broken; -+module_param(gst_v4l2src_is_broken, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -+MODULE_PARM_DESC(gst_v4l2src_is_broken, "If non-zero, enable workaround for Gstreamer"); -+ -+/* global device data array */ -+static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; -+ -+#define FPS_MIN 1 -+#define FPS_MAX 90 -+ -+/* timeperframe: min/max and default */ -+static const struct v4l2_fract -+ tpf_min = {.numerator = 1, .denominator = FPS_MAX}, -+ tpf_max = {.numerator = 1, .denominator = FPS_MIN}, -+ tpf_default = {.numerator = 1000, .denominator = 30000}; -+ -+/* video formats */ -+static struct mmal_fmt formats[] = { -+ { -+ .name = "4:2:0, planar, YUV", -+ .fourcc = V4L2_PIX_FMT_YUV420, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_I420, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "4:2:2, packed, YUYV", -+ .fourcc = V4L2_PIX_FMT_YUYV, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_YUYV, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "RGB24 (LE)", -+ .fourcc = V4L2_PIX_FMT_RGB24, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_RGB24, -+ .depth = 24, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 3, -+ }, -+ { -+ .name = "JPEG", -+ .fourcc = V4L2_PIX_FMT_JPEG, -+ .flags = V4L2_FMT_FLAG_COMPRESSED, -+ .mmal = MMAL_ENCODING_JPEG, -+ .depth = 8, -+ .mmal_component = MMAL_COMPONENT_IMAGE_ENCODE, -+ .ybbp = 0, -+ }, -+ { -+ .name = "H264", -+ .fourcc = V4L2_PIX_FMT_H264, -+ .flags = V4L2_FMT_FLAG_COMPRESSED, -+ .mmal = MMAL_ENCODING_H264, -+ .depth = 8, -+ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, -+ .ybbp = 0, -+ }, -+ { -+ .name = "MJPEG", -+ .fourcc = V4L2_PIX_FMT_MJPEG, -+ .flags = V4L2_FMT_FLAG_COMPRESSED, -+ .mmal = MMAL_ENCODING_MJPEG, -+ .depth = 8, -+ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE, -+ .ybbp = 0, -+ }, -+ { -+ .name = "4:2:2, packed, YVYU", -+ .fourcc = V4L2_PIX_FMT_YVYU, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_YVYU, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "4:2:2, packed, VYUY", -+ .fourcc = V4L2_PIX_FMT_VYUY, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_VYUY, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "4:2:2, packed, UYVY", -+ .fourcc = V4L2_PIX_FMT_UYVY, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_UYVY, -+ .depth = 16, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 2, -+ }, -+ { -+ .name = "4:2:0, planar, NV12", -+ .fourcc = V4L2_PIX_FMT_NV12, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_NV12, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "RGB24 (BE)", -+ .fourcc = V4L2_PIX_FMT_BGR24, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_BGR24, -+ .depth = 24, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 3, -+ }, -+ { -+ .name = "4:2:0, planar, YVU", -+ .fourcc = V4L2_PIX_FMT_YVU420, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_YV12, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "4:2:0, planar, NV21", -+ .fourcc = V4L2_PIX_FMT_NV21, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_NV21, -+ .depth = 12, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 1, -+ }, -+ { -+ .name = "RGB32 (BE)", -+ .fourcc = V4L2_PIX_FMT_BGR32, -+ .flags = 0, -+ .mmal = MMAL_ENCODING_BGRA, -+ .depth = 32, -+ .mmal_component = MMAL_COMPONENT_CAMERA, -+ .ybbp = 4, -+ }, -+}; -+ -+static struct mmal_fmt *get_format(struct v4l2_format *f) -+{ -+ struct mmal_fmt *fmt; -+ unsigned int k; -+ -+ for (k = 0; k < ARRAY_SIZE(formats); k++) { -+ fmt = &formats[k]; -+ if (fmt->fourcc == f->fmt.pix.pixelformat) -+ break; -+ } -+ -+ if (k == ARRAY_SIZE(formats)) -+ return NULL; -+ -+ return &formats[k]; -+} -+ -+/* ------------------------------------------------------------------ -+ Videobuf queue operations -+ ------------------------------------------------------------------*/ -+ -+static int queue_setup(struct vb2_queue *vq, -+ unsigned int *nbuffers, unsigned int *nplanes, -+ unsigned int sizes[], struct device *alloc_ctxs[]) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ unsigned long size; -+ -+ /* refuse queue setup if port is not configured */ -+ if (dev->capture.port == NULL) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: capture port not configured\n", __func__); -+ return -EINVAL; -+ } -+ -+ size = dev->capture.port->current_buffer.size; -+ if (size == 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: capture port buffer size is zero\n", __func__); -+ return -EINVAL; -+ } -+ -+ if (*nbuffers < (dev->capture.port->current_buffer.num + 2)) -+ *nbuffers = (dev->capture.port->current_buffer.num + 2); -+ -+ *nplanes = 1; -+ -+ sizes[0] = size; -+ -+ /* -+ * videobuf2-vmalloc allocator is context-less so no need to set -+ * alloc_ctxs array. -+ */ -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ return 0; -+} -+ -+static int buffer_prepare(struct vb2_buffer *vb) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); -+ unsigned long size; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ BUG_ON(dev->capture.port == NULL); -+ BUG_ON(dev->capture.fmt == NULL); -+ -+ size = dev->capture.stride * dev->capture.height; -+ if (vb2_plane_size(vb, 0) < size) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s data will not fit into plane (%lu < %lu)\n", -+ __func__, vb2_plane_size(vb, 0), size); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static inline bool is_capturing(struct bm2835_mmal_dev *dev) -+{ -+ return dev->capture.camera_port == -+ &dev-> -+ component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; -+} -+ -+static void buffer_cb(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ int status, -+ struct mmal_buffer *buf, -+ unsigned long length, u32 mmal_flags, s64 dts, s64 pts) -+{ -+ struct bm2835_mmal_dev *dev = port->cb_ctx; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", -+ __func__, status, buf, length, mmal_flags, pts); -+ -+ if (status != 0) { -+ /* error in transfer */ -+ if (buf != NULL) { -+ /* there was a buffer with the error so return it */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -+ } -+ return; -+ } else if (length == 0) { -+ /* stream ended */ -+ if (buf != NULL) { -+ /* this should only ever happen if the port is -+ * disabled and there are buffers still queued -+ */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -+ pr_debug("Empty buffer"); -+ } else if (dev->capture.frame_count) { -+ /* grab another frame */ -+ if (is_capturing(dev)) { -+ pr_debug("Grab another frame"); -+ vchiq_mmal_port_parameter_set( -+ instance, -+ dev->capture. -+ camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture. -+ frame_count, -+ sizeof(dev->capture.frame_count)); -+ } -+ } else { -+ /* signal frame completion */ -+ complete(&dev->capture.frame_cmplt); -+ } -+ } else { -+ if (dev->capture.frame_count) { -+ if (dev->capture.vc_start_timestamp != -1 && -+ pts != 0) { -+ struct timeval timestamp; -+ s64 runtime_us = pts - -+ dev->capture.vc_start_timestamp; -+ u32 div = 0; -+ u32 rem = 0; -+ -+ div = -+ div_u64_rem(runtime_us, USEC_PER_SEC, &rem); -+ timestamp.tv_sec = -+ dev->capture.kernel_start_ts.tv_sec + div; -+ timestamp.tv_usec = -+ dev->capture.kernel_start_ts.tv_usec + rem; -+ -+ if (timestamp.tv_usec >= -+ USEC_PER_SEC) { -+ timestamp.tv_sec++; -+ timestamp.tv_usec -= -+ USEC_PER_SEC; -+ } -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Convert start time %d.%06d and %llu " -+ "with offset %llu to %d.%06d\n", -+ (int)dev->capture.kernel_start_ts. -+ tv_sec, -+ (int)dev->capture.kernel_start_ts. -+ tv_usec, -+ dev->capture.vc_start_timestamp, pts, -+ (int)timestamp.tv_sec, -+ (int)timestamp.tv_usec); -+ buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + -+ timestamp.tv_usec * 1000ULL; -+ } else { -+ buf->vb.vb2_buf.timestamp = ktime_get_ns(); -+ } -+ -+ vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); -+ -+ if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && -+ is_capturing(dev)) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Grab another frame as buffer has EOS"); -+ vchiq_mmal_port_parameter_set( -+ instance, -+ dev->capture. -+ camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture. -+ frame_count, -+ sizeof(dev->capture.frame_count)); -+ } -+ } else { -+ /* signal frame completion */ -+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); -+ complete(&dev->capture.frame_cmplt); -+ } -+ } -+} -+ -+static int enable_camera(struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ if (!dev->camera_use_count) { -+ ret = vchiq_mmal_port_parameter_set( -+ dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]->control, -+ MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, -+ sizeof(dev->camera_num)); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed setting camera num, ret %d\n", ret); -+ return -EINVAL; -+ } -+ -+ ret = vchiq_mmal_component_enable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed enabling camera, ret %d\n", ret); -+ return -EINVAL; -+ } -+ } -+ dev->camera_use_count++; -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, "enabled camera (refcount %d)\n", -+ dev->camera_use_count); -+ return 0; -+} -+ -+static int disable_camera(struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ if (!dev->camera_use_count) { -+ v4l2_err(&dev->v4l2_dev, -+ "Disabled the camera when already disabled\n"); -+ return -EINVAL; -+ } -+ dev->camera_use_count--; -+ if (!dev->camera_use_count) { -+ unsigned int i = 0xFFFFFFFF; -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Disabling camera\n"); -+ ret = -+ vchiq_mmal_component_disable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed disabling camera, ret %d\n", ret); -+ return -EINVAL; -+ } -+ vchiq_mmal_port_parameter_set( -+ dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]->control, -+ MMAL_PARAMETER_CAMERA_NUM, &i, -+ sizeof(i)); -+ } -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Camera refcount now %d\n", dev->camera_use_count); -+ return 0; -+} -+ -+static void buffer_queue(struct vb2_buffer *vb) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); -+ struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); -+ struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); -+ int ret; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: dev:%p buf:%p\n", __func__, dev, buf); -+ -+ buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); -+ buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); -+ -+ ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, buf); -+ if (ret < 0) -+ v4l2_err(&dev->v4l2_dev, "%s: error submitting buffer\n", -+ __func__); -+} -+ -+static int start_streaming(struct vb2_queue *vq, unsigned int count) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ int ret; -+ int parameter_size; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ /* ensure a format has actually been set */ -+ if (dev->capture.port == NULL) -+ return -EINVAL; -+ -+ if (enable_camera(dev) < 0) { -+ v4l2_err(&dev->v4l2_dev, "Failed to enable camera\n"); -+ return -EINVAL; -+ } -+ -+ /*init_completion(&dev->capture.frame_cmplt); */ -+ -+ /* enable frame capture */ -+ dev->capture.frame_count = 1; -+ -+ /* if the preview is not already running, wait for a few frames for AGC -+ * to settle down. -+ */ -+ if (!dev->component[MMAL_COMPONENT_PREVIEW]->enabled) -+ msleep(300); -+ -+ /* enable the connection from camera to encoder (if applicable) */ -+ if (dev->capture.camera_port != dev->capture.port -+ && dev->capture.camera_port) { -+ ret = vchiq_mmal_port_enable(dev->instance, -+ dev->capture.camera_port, NULL); -+ if (ret) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to enable encode tunnel - error %d\n", -+ ret); -+ return -1; -+ } -+ } -+ -+ /* Get VC timestamp at this point in time */ -+ parameter_size = sizeof(dev->capture.vc_start_timestamp); -+ if (vchiq_mmal_port_parameter_get(dev->instance, -+ dev->capture.camera_port, -+ MMAL_PARAMETER_SYSTEM_TIME, -+ &dev->capture.vc_start_timestamp, -+ ¶meter_size)) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to get VC start time - update your VC f/w\n"); -+ -+ /* Flag to indicate just to rely on kernel timestamps */ -+ dev->capture.vc_start_timestamp = -1; -+ } else -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Start time %lld size %d\n", -+ dev->capture.vc_start_timestamp, parameter_size); -+ -+ v4l2_get_timestamp(&dev->capture.kernel_start_ts); -+ -+ /* enable the camera port */ -+ dev->capture.port->cb_ctx = dev; -+ ret = -+ vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb); -+ if (ret) { -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to enable capture port - error %d. " -+ "Disabling camera port again\n", ret); -+ -+ vchiq_mmal_port_disable(dev->instance, -+ dev->capture.camera_port); -+ if (disable_camera(dev) < 0) { -+ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); -+ return -EINVAL; -+ } -+ return -1; -+ } -+ -+ /* capture the first frame */ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ dev->capture.camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture.frame_count, -+ sizeof(dev->capture.frame_count)); -+ return 0; -+} -+ -+/* abort streaming and wait for last buffer */ -+static void stop_streaming(struct vb2_queue *vq) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n", -+ __func__, dev); -+ -+ init_completion(&dev->capture.frame_cmplt); -+ dev->capture.frame_count = 0; -+ -+ /* ensure a format has actually been set */ -+ if (dev->capture.port == NULL) { -+ v4l2_err(&dev->v4l2_dev, -+ "no capture port - stream not started?\n"); -+ return; -+ } -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "stopping capturing\n"); -+ -+ /* stop capturing frames */ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ dev->capture.camera_port, -+ MMAL_PARAMETER_CAPTURE, -+ &dev->capture.frame_count, -+ sizeof(dev->capture.frame_count)); -+ -+ /* wait for last frame to complete */ -+ ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ); -+ if (ret <= 0) -+ v4l2_err(&dev->v4l2_dev, -+ "error %d waiting for frame completion\n", ret); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "disabling connection\n"); -+ -+ /* disable the connection from camera to encoder */ -+ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.camera_port); -+ if (!ret && dev->capture.camera_port != dev->capture.port) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "disabling port\n"); -+ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.port); -+ } else if (dev->capture.camera_port != dev->capture.port) { -+ v4l2_err(&dev->v4l2_dev, "port_disable failed, error %d\n", -+ ret); -+ } -+ -+ if (disable_camera(dev) < 0) -+ v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n"); -+} -+ -+static void bm2835_mmal_lock(struct vb2_queue *vq) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ mutex_lock(&dev->mutex); -+} -+ -+static void bm2835_mmal_unlock(struct vb2_queue *vq) -+{ -+ struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq); -+ mutex_unlock(&dev->mutex); -+} -+ -+static struct vb2_ops bm2835_mmal_video_qops = { -+ .queue_setup = queue_setup, -+ .buf_prepare = buffer_prepare, -+ .buf_queue = buffer_queue, -+ .start_streaming = start_streaming, -+ .stop_streaming = stop_streaming, -+ .wait_prepare = bm2835_mmal_unlock, -+ .wait_finish = bm2835_mmal_lock, -+}; -+ -+/* ------------------------------------------------------------------ -+ IOCTL operations -+ ------------------------------------------------------------------*/ -+ -+static int set_overlay_params(struct bm2835_mmal_dev *dev, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_parameter_displayregion prev_config = { -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_ALPHA | -+ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_FULLSCREEN, -+ .layer = PREVIEW_LAYER, -+ .alpha = dev->overlay.global_alpha, -+ .fullscreen = 0, -+ .dest_rect = { -+ .x = dev->overlay.w.left, -+ .y = dev->overlay.w.top, -+ .width = dev->overlay.w.width, -+ .height = dev->overlay.w.height, -+ }, -+ }; -+ ret = vchiq_mmal_port_parameter_set(dev->instance, port, -+ MMAL_PARAMETER_DISPLAYREGION, -+ &prev_config, sizeof(prev_config)); -+ -+ return ret; -+} -+ -+/* overlay ioctl */ -+static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_fmtdesc *f) -+{ -+ struct mmal_fmt *fmt; -+ -+ if (f->index >= ARRAY_SIZE(formats)) -+ return -EINVAL; -+ -+ fmt = &formats[f->index]; -+ -+ strlcpy(f->description, fmt->name, sizeof(f->description)); -+ f->pixelformat = fmt->fourcc; -+ f->flags = fmt->flags; -+ -+ return 0; -+} -+ -+static int vidioc_g_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ f->fmt.win = dev->overlay; -+ -+ return 0; -+} -+ -+static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ f->fmt.win.field = V4L2_FIELD_NONE; -+ f->fmt.win.chromakey = 0; -+ f->fmt.win.clips = NULL; -+ f->fmt.win.clipcount = 0; -+ f->fmt.win.bitmap = NULL; -+ -+ v4l_bound_align_image(&f->fmt.win.w.width, MIN_WIDTH, dev->max_width, 1, -+ &f->fmt.win.w.height, MIN_HEIGHT, dev->max_height, -+ 1, 0); -+ v4l_bound_align_image(&f->fmt.win.w.left, MIN_WIDTH, dev->max_width, 1, -+ &f->fmt.win.w.top, MIN_HEIGHT, dev->max_height, -+ 1, 0); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Overlay: Now w/h %dx%d l/t %dx%d\n", -+ f->fmt.win.w.width, f->fmt.win.w.height, -+ f->fmt.win.w.left, f->fmt.win.w.top); -+ -+ v4l2_dump_win_format(1, -+ bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ &f->fmt.win, -+ __func__); -+ return 0; -+} -+ -+static int vidioc_s_fmt_vid_overlay(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ vidioc_try_fmt_vid_overlay(file, priv, f); -+ -+ dev->overlay = f->fmt.win; -+ if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) { -+ set_overlay_params(dev, -+ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); -+ } -+ -+ return 0; -+} -+ -+static int vidioc_overlay(struct file *file, void *f, unsigned int on) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct vchiq_mmal_port *src; -+ struct vchiq_mmal_port *dst; -+ if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) || -+ (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled)) -+ return 0; /* already in requested state */ -+ -+ src = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW]; -+ -+ if (!on) { -+ /* disconnect preview ports and disable component */ -+ ret = vchiq_mmal_port_disable(dev->instance, src); -+ if (!ret) -+ ret = -+ vchiq_mmal_port_connect_tunnel(dev->instance, src, -+ NULL); -+ if (ret >= 0) -+ ret = vchiq_mmal_component_disable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ -+ disable_camera(dev); -+ return ret; -+ } -+ -+ /* set preview port format and connect it to output */ -+ dst = &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]; -+ -+ ret = vchiq_mmal_port_set_format(dev->instance, src); -+ if (ret < 0) -+ goto error; -+ -+ ret = set_overlay_params(dev, dst); -+ if (ret < 0) -+ goto error; -+ -+ if (enable_camera(dev) < 0) -+ goto error; -+ -+ ret = vchiq_mmal_component_enable( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ if (ret < 0) -+ goto error; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "connecting %p to %p\n", -+ src, dst); -+ ret = vchiq_mmal_port_connect_tunnel(dev->instance, src, dst); -+ if (!ret) -+ ret = vchiq_mmal_port_enable(dev->instance, src, NULL); -+error: -+ return ret; -+} -+ -+static int vidioc_g_fbuf(struct file *file, void *fh, -+ struct v4l2_framebuffer *a) -+{ -+ /* The video overlay must stay within the framebuffer and can't be -+ positioned independently. */ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct vchiq_mmal_port *preview_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW]; -+ -+ a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | -+ V4L2_FBUF_CAP_GLOBAL_ALPHA; -+ a->flags = V4L2_FBUF_FLAG_OVERLAY; -+ a->fmt.width = preview_port->es.video.width; -+ a->fmt.height = preview_port->es.video.height; -+ a->fmt.pixelformat = V4L2_PIX_FMT_YUV420; -+ a->fmt.bytesperline = preview_port->es.video.width; -+ a->fmt.sizeimage = (preview_port->es.video.width * -+ preview_port->es.video.height * 3)>>1; -+ a->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M; -+ -+ return 0; -+} -+ -+/* input ioctls */ -+static int vidioc_enum_input(struct file *file, void *priv, -+ struct v4l2_input *inp) -+{ -+ /* only a single camera input */ -+ if (inp->index != 0) -+ return -EINVAL; -+ -+ inp->type = V4L2_INPUT_TYPE_CAMERA; -+ sprintf(inp->name, "Camera %u", inp->index); -+ return 0; -+} -+ -+static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) -+{ -+ *i = 0; -+ return 0; -+} -+ -+static int vidioc_s_input(struct file *file, void *priv, unsigned int i) -+{ -+ if (i != 0) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+/* capture ioctls */ -+static int vidioc_querycap(struct file *file, void *priv, -+ struct v4l2_capability *cap) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ u32 major; -+ u32 minor; -+ -+ vchiq_mmal_version(dev->instance, &major, &minor); -+ -+ strcpy(cap->driver, "bm2835 mmal"); -+ snprintf(cap->card, sizeof(cap->card), "mmal service %d.%d", -+ major, minor); -+ -+ snprintf(cap->bus_info, sizeof(cap->bus_info), -+ "platform:%s", dev->v4l2_dev.name); -+ cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | -+ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; -+ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; -+ -+ return 0; -+} -+ -+static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_fmtdesc *f) -+{ -+ struct mmal_fmt *fmt; -+ -+ if (f->index >= ARRAY_SIZE(formats)) -+ return -EINVAL; -+ -+ fmt = &formats[f->index]; -+ -+ strlcpy(f->description, fmt->name, sizeof(f->description)); -+ f->pixelformat = fmt->fourcc; -+ f->flags = fmt->flags; -+ -+ return 0; -+} -+ -+static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ f->fmt.pix.width = dev->capture.width; -+ f->fmt.pix.height = dev->capture.height; -+ f->fmt.pix.field = V4L2_FIELD_NONE; -+ f->fmt.pix.pixelformat = dev->capture.fmt->fourcc; -+ f->fmt.pix.bytesperline = dev->capture.stride; -+ f->fmt.pix.sizeimage = dev->capture.buffersize; -+ -+ if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_RGB24) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; -+ else if (dev->capture.fmt->fourcc == V4L2_PIX_FMT_JPEG) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; -+ else -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; -+ f->fmt.pix.priv = 0; -+ -+ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, -+ __func__); -+ return 0; -+} -+ -+static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct mmal_fmt *mfmt; -+ -+ mfmt = get_format(f); -+ if (!mfmt) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Fourcc format (0x%08x) unknown.\n", -+ f->fmt.pix.pixelformat); -+ f->fmt.pix.pixelformat = formats[0].fourcc; -+ mfmt = get_format(f); -+ } -+ -+ f->fmt.pix.field = V4L2_FIELD_NONE; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Clipping/aligning %dx%d format %08X\n", -+ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); -+ -+ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, dev->max_width, 1, -+ &f->fmt.pix.height, MIN_HEIGHT, dev->max_height, -+ 1, 0); -+ f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp; -+ -+ /* Image buffer has to be padded to allow for alignment, even though -+ * we then remove that padding before delivering the buffer. -+ */ -+ f->fmt.pix.sizeimage = ((f->fmt.pix.height+15)&~15) * -+ (((f->fmt.pix.width+31)&~31) * mfmt->depth) >> 3; -+ -+ if ((mfmt->flags & V4L2_FMT_FLAG_COMPRESSED) && -+ f->fmt.pix.sizeimage < MIN_BUFFER_SIZE) -+ f->fmt.pix.sizeimage = MIN_BUFFER_SIZE; -+ -+ if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB24) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; -+ else if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG) -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; -+ else -+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; -+ f->fmt.pix.priv = 0; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Now %dx%d format %08X\n", -+ f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.pixelformat); -+ -+ v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix, -+ __func__); -+ return 0; -+} -+ -+static int mmal_setup_components(struct bm2835_mmal_dev *dev, -+ struct v4l2_format *f) -+{ -+ int ret; -+ struct vchiq_mmal_port *port = NULL, *camera_port = NULL; -+ struct vchiq_mmal_component *encode_component = NULL; -+ struct mmal_fmt *mfmt = get_format(f); -+ -+ BUG_ON(!mfmt); -+ -+ if (dev->capture.encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "vid_cap - disconnect previous tunnel\n"); -+ -+ /* Disconnect any previous connection */ -+ vchiq_mmal_port_connect_tunnel(dev->instance, -+ dev->capture.camera_port, NULL); -+ dev->capture.camera_port = NULL; -+ ret = vchiq_mmal_component_disable(dev->instance, -+ dev->capture. -+ encode_component); -+ if (ret) -+ v4l2_err(&dev->v4l2_dev, -+ "Failed to disable encode component %d\n", -+ ret); -+ -+ dev->capture.encode_component = NULL; -+ } -+ /* format dependant port setup */ -+ switch (mfmt->mmal_component) { -+ case MMAL_COMPONENT_CAMERA: -+ /* Make a further decision on port based on resolution */ -+ if (f->fmt.pix.width <= max_video_width -+ && f->fmt.pix.height <= max_video_height) -+ camera_port = port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO]; -+ else -+ camera_port = port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_CAPTURE]; -+ break; -+ case MMAL_COMPONENT_IMAGE_ENCODE: -+ encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE]; -+ port = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; -+ camera_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_CAPTURE]; -+ break; -+ case MMAL_COMPONENT_VIDEO_ENCODE: -+ encode_component = dev->component[MMAL_COMPONENT_VIDEO_ENCODE]; -+ port = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ camera_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO]; -+ break; -+ default: -+ break; -+ } -+ -+ if (!port) -+ return -EINVAL; -+ -+ if (encode_component) -+ camera_port->format.encoding = MMAL_ENCODING_OPAQUE; -+ else -+ camera_port->format.encoding = mfmt->mmal; -+ -+ if (dev->rgb_bgr_swapped) { -+ if (camera_port->format.encoding == MMAL_ENCODING_RGB24) -+ camera_port->format.encoding = MMAL_ENCODING_BGR24; -+ else if (camera_port->format.encoding == MMAL_ENCODING_BGR24) -+ camera_port->format.encoding = MMAL_ENCODING_RGB24; -+ } -+ -+ camera_port->format.encoding_variant = 0; -+ camera_port->es.video.width = f->fmt.pix.width; -+ camera_port->es.video.height = f->fmt.pix.height; -+ camera_port->es.video.crop.x = 0; -+ camera_port->es.video.crop.y = 0; -+ camera_port->es.video.crop.width = f->fmt.pix.width; -+ camera_port->es.video.crop.height = f->fmt.pix.height; -+ camera_port->es.video.frame_rate.num = 0; -+ camera_port->es.video.frame_rate.den = 1; -+ camera_port->es.video.color_space = MMAL_COLOR_SPACE_JPEG_JFIF; -+ -+ ret = vchiq_mmal_port_set_format(dev->instance, camera_port); -+ -+ if (!ret -+ && camera_port == -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO]) { -+ bool overlay_enabled = -+ !!dev->component[MMAL_COMPONENT_PREVIEW]->enabled; -+ struct vchiq_mmal_port *preview_port = -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW]; -+ /* Preview and encode ports need to match on resolution */ -+ if (overlay_enabled) { -+ /* Need to disable the overlay before we can update -+ * the resolution -+ */ -+ ret = -+ vchiq_mmal_port_disable(dev->instance, -+ preview_port); -+ if (!ret) -+ ret = -+ vchiq_mmal_port_connect_tunnel( -+ dev->instance, -+ preview_port, -+ NULL); -+ } -+ preview_port->es.video.width = f->fmt.pix.width; -+ preview_port->es.video.height = f->fmt.pix.height; -+ preview_port->es.video.crop.x = 0; -+ preview_port->es.video.crop.y = 0; -+ preview_port->es.video.crop.width = f->fmt.pix.width; -+ preview_port->es.video.crop.height = f->fmt.pix.height; -+ preview_port->es.video.frame_rate.num = -+ dev->capture.timeperframe.denominator; -+ preview_port->es.video.frame_rate.den = -+ dev->capture.timeperframe.numerator; -+ ret = vchiq_mmal_port_set_format(dev->instance, preview_port); -+ if (overlay_enabled) { -+ ret = vchiq_mmal_port_connect_tunnel( -+ dev->instance, -+ preview_port, -+ &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]); -+ if (!ret) -+ ret = vchiq_mmal_port_enable(dev->instance, -+ preview_port, -+ NULL); -+ } -+ } -+ -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s failed to set format %dx%d %08X\n", __func__, -+ f->fmt.pix.width, f->fmt.pix.height, -+ f->fmt.pix.pixelformat); -+ /* ensure capture is not going to be tried */ -+ dev->capture.port = NULL; -+ } else { -+ if (encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "vid_cap - set up encode comp\n"); -+ -+ /* configure buffering */ -+ camera_port->current_buffer.size = -+ camera_port->recommended_buffer.size; -+ camera_port->current_buffer.num = -+ camera_port->recommended_buffer.num; -+ -+ ret = -+ vchiq_mmal_port_connect_tunnel( -+ dev->instance, -+ camera_port, -+ &encode_component->input[0]); -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "%s failed to create connection\n", -+ __func__); -+ /* ensure capture is not going to be tried */ -+ dev->capture.port = NULL; -+ } else { -+ port->es.video.width = f->fmt.pix.width; -+ port->es.video.height = f->fmt.pix.height; -+ port->es.video.crop.x = 0; -+ port->es.video.crop.y = 0; -+ port->es.video.crop.width = f->fmt.pix.width; -+ port->es.video.crop.height = f->fmt.pix.height; -+ port->es.video.frame_rate.num = -+ dev->capture.timeperframe.denominator; -+ port->es.video.frame_rate.den = -+ dev->capture.timeperframe.numerator; -+ -+ port->format.encoding = mfmt->mmal; -+ port->format.encoding_variant = 0; -+ /* Set any encoding specific parameters */ -+ switch (mfmt->mmal_component) { -+ case MMAL_COMPONENT_VIDEO_ENCODE: -+ port->format.bitrate = -+ dev->capture.encode_bitrate; -+ break; -+ case MMAL_COMPONENT_IMAGE_ENCODE: -+ /* Could set EXIF parameters here */ -+ break; -+ default: -+ break; -+ } -+ ret = vchiq_mmal_port_set_format(dev->instance, -+ port); -+ if (ret) -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "%s failed to set format %dx%d fmt %08X\n", -+ __func__, -+ f->fmt.pix.width, -+ f->fmt.pix.height, -+ f->fmt.pix.pixelformat -+ ); -+ } -+ -+ if (!ret) { -+ ret = vchiq_mmal_component_enable( -+ dev->instance, -+ encode_component); -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "%s Failed to enable encode components\n", -+ __func__); -+ } -+ } -+ if (!ret) { -+ /* configure buffering */ -+ port->current_buffer.num = 1; -+ port->current_buffer.size = -+ f->fmt.pix.sizeimage; -+ if (port->format.encoding == -+ MMAL_ENCODING_JPEG) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "JPG - buf size now %d was %d\n", -+ f->fmt.pix.sizeimage, -+ port->current_buffer.size); -+ port->current_buffer.size = -+ (f->fmt.pix.sizeimage < -+ (100 << 10)) -+ ? (100 << 10) : f->fmt.pix. -+ sizeimage; -+ } -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "vid_cap - cur_buf.size set to %d\n", -+ f->fmt.pix.sizeimage); -+ port->current_buffer.alignment = 0; -+ } -+ } else { -+ /* configure buffering */ -+ camera_port->current_buffer.num = 1; -+ camera_port->current_buffer.size = f->fmt.pix.sizeimage; -+ camera_port->current_buffer.alignment = 0; -+ } -+ -+ if (!ret) { -+ dev->capture.fmt = mfmt; -+ dev->capture.stride = f->fmt.pix.bytesperline; -+ dev->capture.width = camera_port->es.video.crop.width; -+ dev->capture.height = camera_port->es.video.crop.height; -+ dev->capture.buffersize = port->current_buffer.size; -+ -+ /* select port for capture */ -+ dev->capture.port = port; -+ dev->capture.camera_port = camera_port; -+ dev->capture.encode_component = encode_component; -+ v4l2_dbg(1, bcm2835_v4l2_debug, -+ &dev->v4l2_dev, -+ "Set dev->capture.fmt %08X, %dx%d, stride %d, size %d", -+ port->format.encoding, -+ dev->capture.width, dev->capture.height, -+ dev->capture.stride, dev->capture.buffersize); -+ } -+ } -+ -+ /* todo: Need to convert the vchiq/mmal error into a v4l2 error. */ -+ return ret; -+} -+ -+static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, -+ struct v4l2_format *f) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct mmal_fmt *mfmt; -+ -+ /* try the format to set valid parameters */ -+ ret = vidioc_try_fmt_vid_cap(file, priv, f); -+ if (ret) { -+ v4l2_err(&dev->v4l2_dev, -+ "vid_cap - vidioc_try_fmt_vid_cap failed\n"); -+ return ret; -+ } -+ -+ /* if a capture is running refuse to set format */ -+ if (vb2_is_busy(&dev->capture.vb_vidq)) { -+ v4l2_info(&dev->v4l2_dev, "%s device busy\n", __func__); -+ return -EBUSY; -+ } -+ -+ /* If the format is unsupported v4l2 says we should switch to -+ * a supported one and not return an error. */ -+ mfmt = get_format(f); -+ if (!mfmt) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Fourcc format (0x%08x) unknown.\n", -+ f->fmt.pix.pixelformat); -+ f->fmt.pix.pixelformat = formats[0].fourcc; -+ mfmt = get_format(f); -+ } -+ -+ ret = mmal_setup_components(dev, f); -+ if (ret != 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: failed to setup mmal components: %d\n", -+ __func__, ret); -+ ret = -EINVAL; -+ } -+ -+ return ret; -+} -+ -+int vidioc_enum_framesizes(struct file *file, void *fh, -+ struct v4l2_frmsizeenum *fsize) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ static const struct v4l2_frmsize_stepwise sizes = { -+ MIN_WIDTH, 0, 2, -+ MIN_HEIGHT, 0, 2 -+ }; -+ int i; -+ -+ if (fsize->index) -+ return -EINVAL; -+ for (i = 0; i < ARRAY_SIZE(formats); i++) -+ if (formats[i].fourcc == fsize->pixel_format) -+ break; -+ if (i == ARRAY_SIZE(formats)) -+ return -EINVAL; -+ fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; -+ fsize->stepwise = sizes; -+ fsize->stepwise.max_width = dev->max_width; -+ fsize->stepwise.max_height = dev->max_height; -+ return 0; -+} -+ -+/* timeperframe is arbitrary and continous */ -+static int vidioc_enum_frameintervals(struct file *file, void *priv, -+ struct v4l2_frmivalenum *fival) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ int i; -+ -+ if (fival->index) -+ return -EINVAL; -+ -+ for (i = 0; i < ARRAY_SIZE(formats); i++) -+ if (formats[i].fourcc == fival->pixel_format) -+ break; -+ if (i == ARRAY_SIZE(formats)) -+ return -EINVAL; -+ -+ /* regarding width & height - we support any within range */ -+ if (fival->width < MIN_WIDTH || fival->width > dev->max_width || -+ fival->height < MIN_HEIGHT || fival->height > dev->max_height) -+ return -EINVAL; -+ -+ fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; -+ -+ /* fill in stepwise (step=1.0 is requred by V4L2 spec) */ -+ fival->stepwise.min = tpf_min; -+ fival->stepwise.max = tpf_max; -+ fival->stepwise.step = (struct v4l2_fract) {1, 1}; -+ -+ return 0; -+} -+ -+static int vidioc_g_parm(struct file *file, void *priv, -+ struct v4l2_streamparm *parm) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ -+ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; -+ parm->parm.capture.timeperframe = dev->capture.timeperframe; -+ parm->parm.capture.readbuffers = 1; -+ return 0; -+} -+ -+#define FRACT_CMP(a, OP, b) \ -+ ((u64)(a).numerator * (b).denominator OP \ -+ (u64)(b).numerator * (a).denominator) -+ -+static int vidioc_s_parm(struct file *file, void *priv, -+ struct v4l2_streamparm *parm) -+{ -+ struct bm2835_mmal_dev *dev = video_drvdata(file); -+ struct v4l2_fract tpf; -+ struct mmal_parameter_rational fps_param; -+ -+ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ tpf = parm->parm.capture.timeperframe; -+ -+ /* tpf: {*, 0} resets timing; clip to [min, max]*/ -+ tpf = tpf.denominator ? tpf : tpf_default; -+ tpf = FRACT_CMP(tpf, <, tpf_min) ? tpf_min : tpf; -+ tpf = FRACT_CMP(tpf, >, tpf_max) ? tpf_max : tpf; -+ -+ dev->capture.timeperframe = tpf; -+ parm->parm.capture.timeperframe = tpf; -+ parm->parm.capture.readbuffers = 1; -+ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; -+ -+ fps_param.num = 0; /* Select variable fps, and then use -+ * FPS_RANGE to select the actual limits. -+ */ -+ fps_param.den = 1; -+ set_framerate_params(dev); -+ -+ return 0; -+} -+ -+static const struct v4l2_ioctl_ops camera0_ioctl_ops = { -+ /* overlay */ -+ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, -+ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, -+ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, -+ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, -+ .vidioc_overlay = vidioc_overlay, -+ .vidioc_g_fbuf = vidioc_g_fbuf, -+ -+ /* inputs */ -+ .vidioc_enum_input = vidioc_enum_input, -+ .vidioc_g_input = vidioc_g_input, -+ .vidioc_s_input = vidioc_s_input, -+ -+ /* capture */ -+ .vidioc_querycap = vidioc_querycap, -+ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, -+ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, -+ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, -+ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, -+ -+ /* buffer management */ -+ .vidioc_reqbufs = vb2_ioctl_reqbufs, -+ .vidioc_create_bufs = vb2_ioctl_create_bufs, -+ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, -+ .vidioc_querybuf = vb2_ioctl_querybuf, -+ .vidioc_qbuf = vb2_ioctl_qbuf, -+ .vidioc_dqbuf = vb2_ioctl_dqbuf, -+ .vidioc_enum_framesizes = vidioc_enum_framesizes, -+ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, -+ .vidioc_g_parm = vidioc_g_parm, -+ .vidioc_s_parm = vidioc_s_parm, -+ .vidioc_streamon = vb2_ioctl_streamon, -+ .vidioc_streamoff = vb2_ioctl_streamoff, -+ -+ .vidioc_log_status = v4l2_ctrl_log_status, -+ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, -+ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -+}; -+ -+static const struct v4l2_ioctl_ops camera0_ioctl_ops_gstreamer = { -+ /* overlay */ -+ .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, -+ .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_vid_overlay, -+ .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_vid_overlay, -+ .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_vid_overlay, -+ .vidioc_overlay = vidioc_overlay, -+ .vidioc_g_fbuf = vidioc_g_fbuf, -+ -+ /* inputs */ -+ .vidioc_enum_input = vidioc_enum_input, -+ .vidioc_g_input = vidioc_g_input, -+ .vidioc_s_input = vidioc_s_input, -+ -+ /* capture */ -+ .vidioc_querycap = vidioc_querycap, -+ .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, -+ .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, -+ .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, -+ .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, -+ -+ /* buffer management */ -+ .vidioc_reqbufs = vb2_ioctl_reqbufs, -+ .vidioc_create_bufs = vb2_ioctl_create_bufs, -+ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, -+ .vidioc_querybuf = vb2_ioctl_querybuf, -+ .vidioc_qbuf = vb2_ioctl_qbuf, -+ .vidioc_dqbuf = vb2_ioctl_dqbuf, -+ /* Remove this function ptr to fix gstreamer bug -+ .vidioc_enum_framesizes = vidioc_enum_framesizes, */ -+ .vidioc_enum_frameintervals = vidioc_enum_frameintervals, -+ .vidioc_g_parm = vidioc_g_parm, -+ .vidioc_s_parm = vidioc_s_parm, -+ .vidioc_streamon = vb2_ioctl_streamon, -+ .vidioc_streamoff = vb2_ioctl_streamoff, -+ -+ .vidioc_log_status = v4l2_ctrl_log_status, -+ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, -+ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -+}; -+ -+/* ------------------------------------------------------------------ -+ Driver init/finalise -+ ------------------------------------------------------------------*/ -+ -+static const struct v4l2_file_operations camera0_fops = { -+ .owner = THIS_MODULE, -+ .open = v4l2_fh_open, -+ .release = vb2_fop_release, -+ .read = vb2_fop_read, -+ .poll = vb2_fop_poll, -+ .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ -+ .mmap = vb2_fop_mmap, -+}; -+ -+static struct video_device vdev_template = { -+ .name = "camera0", -+ .fops = &camera0_fops, -+ .ioctl_ops = &camera0_ioctl_ops, -+ .release = video_device_release_empty, -+}; -+ -+/* Returns the number of cameras, and also the max resolution supported -+ * by those cameras. -+ */ -+static int get_num_cameras(struct vchiq_mmal_instance *instance, -+ unsigned int resolutions[][2], int num_resolutions) -+{ -+ int ret; -+ struct vchiq_mmal_component *cam_info_component; -+ struct mmal_parameter_camera_info_t cam_info = {0}; -+ int param_size = sizeof(cam_info); -+ int i; -+ -+ /* create a camera_info component */ -+ ret = vchiq_mmal_component_init(instance, "camera_info", -+ &cam_info_component); -+ if (ret < 0) -+ /* Unusual failure - let's guess one camera. */ -+ return 1; -+ -+ if (vchiq_mmal_port_parameter_get(instance, -+ &cam_info_component->control, -+ MMAL_PARAMETER_CAMERA_INFO, -+ &cam_info, -+ ¶m_size)) { -+ pr_info("Failed to get camera info\n"); -+ } -+ for (i = 0; -+ i < (cam_info.num_cameras > num_resolutions ? -+ num_resolutions : -+ cam_info.num_cameras); -+ i++) { -+ resolutions[i][0] = cam_info.cameras[i].max_width; -+ resolutions[i][1] = cam_info.cameras[i].max_height; -+ } -+ -+ vchiq_mmal_component_finalise(instance, -+ cam_info_component); -+ -+ return cam_info.num_cameras; -+} -+ -+static int set_camera_parameters(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *camera, -+ struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ struct mmal_parameter_camera_config cam_config = { -+ .max_stills_w = dev->max_width, -+ .max_stills_h = dev->max_height, -+ .stills_yuv422 = 1, -+ .one_shot_stills = 1, -+ .max_preview_video_w = (max_video_width > 1920) ? -+ max_video_width : 1920, -+ .max_preview_video_h = (max_video_height > 1088) ? -+ max_video_height : 1088, -+ .num_preview_video_frames = 3, -+ .stills_capture_circular_buffer_height = 0, -+ .fast_preview_resume = 0, -+ .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC -+ }; -+ -+ ret = vchiq_mmal_port_parameter_set(instance, &camera->control, -+ MMAL_PARAMETER_CAMERA_CONFIG, -+ &cam_config, sizeof(cam_config)); -+ return ret; -+} -+ -+#define MAX_SUPPORTED_ENCODINGS 20 -+ -+/* MMAL instance and component init */ -+static int __init mmal_init(struct bm2835_mmal_dev *dev) -+{ -+ int ret; -+ struct mmal_es_format *format; -+ u32 bool_true = 1; -+ u32 supported_encodings[MAX_SUPPORTED_ENCODINGS]; -+ int param_size; -+ struct vchiq_mmal_component *camera; -+ -+ ret = vchiq_mmal_init(&dev->instance); -+ if (ret < 0) -+ return ret; -+ -+ /* get the camera component ready */ -+ ret = vchiq_mmal_component_init(dev->instance, "ril.camera", -+ &dev->component[MMAL_COMPONENT_CAMERA]); -+ if (ret < 0) -+ goto unreg_mmal; -+ -+ camera = dev->component[MMAL_COMPONENT_CAMERA]; -+ if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { -+ ret = -EINVAL; -+ goto unreg_camera; -+ } -+ -+ ret = set_camera_parameters(dev->instance, -+ camera, -+ dev); -+ if (ret < 0) -+ goto unreg_camera; -+ -+ /* There was an error in the firmware that meant the camera component -+ * produced BGR instead of RGB. -+ * This is now fixed, but in order to support the old firmwares, we -+ * have to check. -+ */ -+ dev->rgb_bgr_swapped = true; -+ param_size = sizeof(supported_encodings); -+ ret = vchiq_mmal_port_parameter_get(dev->instance, -+ &camera->output[MMAL_CAMERA_PORT_CAPTURE], -+ MMAL_PARAMETER_SUPPORTED_ENCODINGS, -+ &supported_encodings, -+ ¶m_size); -+ if (ret == 0) { -+ int i; -+ -+ for (i = 0; i < param_size/sizeof(u32); i++) { -+ if (supported_encodings[i] == MMAL_ENCODING_BGR24) { -+ /* Found BGR24 first - old firmware. */ -+ break; -+ } -+ if (supported_encodings[i] == MMAL_ENCODING_RGB24) { -+ /* Found RGB24 first -+ * new firmware, so use RGB24. -+ */ -+ dev->rgb_bgr_swapped = false; -+ break; -+ } -+ } -+ } -+ format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format; -+ -+ format->encoding = MMAL_ENCODING_OPAQUE; -+ format->encoding_variant = MMAL_ENCODING_I420; -+ -+ format->es->video.width = 1024; -+ format->es->video.height = 768; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = 1024; -+ format->es->video.crop.height = 768; -+ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ -+ format->es->video.frame_rate.den = 1; -+ -+ format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format; -+ -+ format->encoding = MMAL_ENCODING_OPAQUE; -+ format->encoding_variant = MMAL_ENCODING_I420; -+ -+ format->es->video.width = 1024; -+ format->es->video.height = 768; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = 1024; -+ format->es->video.crop.height = 768; -+ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ -+ format->es->video.frame_rate.den = 1; -+ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ &camera->output[MMAL_CAMERA_PORT_VIDEO], -+ MMAL_PARAMETER_NO_IMAGE_PADDING, -+ &bool_true, sizeof(bool_true)); -+ -+ format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format; -+ -+ format->encoding = MMAL_ENCODING_OPAQUE; -+ -+ format->es->video.width = 2592; -+ format->es->video.height = 1944; -+ format->es->video.crop.x = 0; -+ format->es->video.crop.y = 0; -+ format->es->video.crop.width = 2592; -+ format->es->video.crop.height = 1944; -+ format->es->video.frame_rate.num = 0; /* Rely on fps_range */ -+ format->es->video.frame_rate.den = 1; -+ -+ dev->capture.width = format->es->video.width; -+ dev->capture.height = format->es->video.height; -+ dev->capture.fmt = &formats[0]; -+ dev->capture.encode_component = NULL; -+ dev->capture.timeperframe = tpf_default; -+ dev->capture.enc_profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH; -+ dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; -+ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ &camera->output[MMAL_CAMERA_PORT_CAPTURE], -+ MMAL_PARAMETER_NO_IMAGE_PADDING, -+ &bool_true, sizeof(bool_true)); -+ -+ /* get the preview component ready */ -+ ret = vchiq_mmal_component_init( -+ dev->instance, "ril.video_render", -+ &dev->component[MMAL_COMPONENT_PREVIEW]); -+ if (ret < 0) -+ goto unreg_camera; -+ -+ if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) { -+ ret = -EINVAL; -+ pr_debug("too few input ports %d needed %d\n", -+ dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1); -+ goto unreg_preview; -+ } -+ -+ /* get the image encoder component ready */ -+ ret = vchiq_mmal_component_init( -+ dev->instance, "ril.image_encode", -+ &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ if (ret < 0) -+ goto unreg_preview; -+ -+ if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) { -+ ret = -EINVAL; -+ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", -+ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs, -+ 1); -+ goto unreg_image_encoder; -+ } -+ -+ /* get the video encoder component ready */ -+ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", -+ &dev-> -+ component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ if (ret < 0) -+ goto unreg_image_encoder; -+ -+ if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) { -+ ret = -EINVAL; -+ v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", -+ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs, -+ 1); -+ goto unreg_vid_encoder; -+ } -+ -+ { -+ struct vchiq_mmal_port *encoder_port = -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ encoder_port->format.encoding = MMAL_ENCODING_H264; -+ ret = vchiq_mmal_port_set_format(dev->instance, -+ encoder_port); -+ } -+ -+ { -+ unsigned int enable = 1; -+ vchiq_mmal_port_parameter_set( -+ dev->instance, -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, -+ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, -+ &enable, sizeof(enable)); -+ -+ vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control, -+ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, -+ &enable, -+ sizeof(enable)); -+ } -+ ret = bm2835_mmal_set_all_camera_controls(dev); -+ if (ret < 0) -+ goto unreg_vid_encoder; -+ -+ return 0; -+ -+unreg_vid_encoder: -+ pr_err("Cleanup: Destroy video encoder\n"); -+ vchiq_mmal_component_finalise( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ -+unreg_image_encoder: -+ pr_err("Cleanup: Destroy image encoder\n"); -+ vchiq_mmal_component_finalise( -+ dev->instance, -+ dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ -+unreg_preview: -+ pr_err("Cleanup: Destroy video render\n"); -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ -+unreg_camera: -+ pr_err("Cleanup: Destroy camera\n"); -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ -+unreg_mmal: -+ vchiq_mmal_finalise(dev->instance); -+ return ret; -+} -+ -+static int __init bm2835_mmal_init_device(struct bm2835_mmal_dev *dev, -+ struct video_device *vfd) -+{ -+ int ret; -+ -+ *vfd = vdev_template; -+ if (gst_v4l2src_is_broken) { -+ v4l2_info(&dev->v4l2_dev, -+ "Work-around for gstreamer issue is active.\n"); -+ vfd->ioctl_ops = &camera0_ioctl_ops_gstreamer; -+ } -+ -+ vfd->v4l2_dev = &dev->v4l2_dev; -+ -+ vfd->lock = &dev->mutex; -+ -+ vfd->queue = &dev->capture.vb_vidq; -+ -+ /* video device needs to be able to access instance data */ -+ video_set_drvdata(vfd, dev); -+ -+ ret = video_register_device(vfd, -+ VFL_TYPE_GRABBER, -+ video_nr[dev->camera_num]); -+ if (ret < 0) -+ return ret; -+ -+ v4l2_info(vfd->v4l2_dev, -+ "V4L2 device registered as %s - stills mode > %dx%d\n", -+ video_device_node_name(vfd), max_video_width, max_video_height); -+ -+ return 0; -+} -+ -+void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) -+{ -+ if (!dev) -+ return; -+ -+ v4l2_info(&dev->v4l2_dev, "unregistering %s\n", -+ video_device_node_name(&dev->vdev)); -+ -+ video_unregister_device(&dev->vdev); -+ -+ if (dev->capture.encode_component) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "mmal_exit - disconnect tunnel\n"); -+ vchiq_mmal_port_connect_tunnel(dev->instance, -+ dev->capture.camera_port, NULL); -+ vchiq_mmal_component_disable(dev->instance, -+ dev->capture.encode_component); -+ } -+ vchiq_mmal_component_disable(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev-> -+ component[MMAL_COMPONENT_VIDEO_ENCODE]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev-> -+ component[MMAL_COMPONENT_IMAGE_ENCODE]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_PREVIEW]); -+ -+ vchiq_mmal_component_finalise(dev->instance, -+ dev->component[MMAL_COMPONENT_CAMERA]); -+ -+ v4l2_ctrl_handler_free(&dev->ctrl_handler); -+ -+ v4l2_device_unregister(&dev->v4l2_dev); -+ -+ kfree(dev); -+} -+ -+static struct v4l2_format default_v4l2_format = { -+ .fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG, -+ .fmt.pix.width = 1024, -+ .fmt.pix.bytesperline = 0, -+ .fmt.pix.height = 768, -+ .fmt.pix.sizeimage = 1024*768, -+}; -+ -+static int __init bm2835_mmal_init(void) -+{ -+ int ret; -+ struct bm2835_mmal_dev *dev; -+ struct vb2_queue *q; -+ int camera; -+ unsigned int num_cameras; -+ struct vchiq_mmal_instance *instance; -+ unsigned int resolutions[MAX_BCM2835_CAMERAS][2]; -+ -+ ret = vchiq_mmal_init(&instance); -+ if (ret < 0) -+ return ret; -+ -+ num_cameras = get_num_cameras(instance, -+ resolutions, -+ MAX_BCM2835_CAMERAS); -+ if (num_cameras > MAX_BCM2835_CAMERAS) -+ num_cameras = MAX_BCM2835_CAMERAS; -+ -+ for (camera = 0; camera < num_cameras; camera++) { -+ dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL); -+ if (!dev) -+ return -ENOMEM; -+ -+ dev->camera_num = camera; -+ dev->max_width = resolutions[camera][0]; -+ dev->max_height = resolutions[camera][1]; -+ -+ /* setup device defaults */ -+ dev->overlay.w.left = 150; -+ dev->overlay.w.top = 50; -+ dev->overlay.w.width = 1024; -+ dev->overlay.w.height = 768; -+ dev->overlay.clipcount = 0; -+ dev->overlay.field = V4L2_FIELD_NONE; -+ dev->overlay.global_alpha = 255; -+ -+ dev->capture.fmt = &formats[3]; /* JPEG */ -+ -+ /* v4l device registration */ -+ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), -+ "%s", BM2835_MMAL_MODULE_NAME); -+ ret = v4l2_device_register(NULL, &dev->v4l2_dev); -+ if (ret) -+ goto free_dev; -+ -+ /* setup v4l controls */ -+ ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); -+ if (ret < 0) -+ goto unreg_dev; -+ dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; -+ -+ /* mmal init */ -+ dev->instance = instance; -+ ret = mmal_init(dev); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* initialize queue */ -+ q = &dev->capture.vb_vidq; -+ memset(q, 0, sizeof(*q)); -+ q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; -+ q->drv_priv = dev; -+ q->buf_struct_size = sizeof(struct mmal_buffer); -+ q->ops = &bm2835_mmal_video_qops; -+ q->mem_ops = &vb2_vmalloc_memops; -+ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; -+ ret = vb2_queue_init(q); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ -+ mutex_init(&dev->mutex); -+ -+ /* initialise video devices */ -+ ret = bm2835_mmal_init_device(dev, &dev->vdev); -+ if (ret < 0) -+ goto unreg_dev; -+ -+ /* Really want to call vidioc_s_fmt_vid_cap with the default -+ * format, but currently the APIs don't join up. -+ */ -+ ret = mmal_setup_components(dev, &default_v4l2_format); -+ if (ret < 0) { -+ v4l2_err(&dev->v4l2_dev, -+ "%s: could not setup components\n", __func__); -+ goto unreg_dev; -+ } -+ -+ v4l2_info(&dev->v4l2_dev, -+ "Broadcom 2835 MMAL video capture ver %s loaded.\n", -+ BM2835_MMAL_VERSION); -+ -+ gdev[camera] = dev; -+ } -+ return 0; -+ -+unreg_dev: -+ v4l2_ctrl_handler_free(&dev->ctrl_handler); -+ v4l2_device_unregister(&dev->v4l2_dev); -+ -+free_dev: -+ kfree(dev); -+ -+ for ( ; camera > 0; camera--) { -+ bcm2835_cleanup_instance(gdev[camera]); -+ gdev[camera] = NULL; -+ } -+ pr_info("%s: error %d while loading driver\n", -+ BM2835_MMAL_MODULE_NAME, ret); -+ -+ return ret; -+} -+ -+static void __exit bm2835_mmal_exit(void) -+{ -+ int camera; -+ struct vchiq_mmal_instance *instance = gdev[0]->instance; -+ -+ for (camera = 0; camera < MAX_BCM2835_CAMERAS; camera++) { -+ bcm2835_cleanup_instance(gdev[camera]); -+ gdev[camera] = NULL; -+ } -+ vchiq_mmal_finalise(instance); -+} -+ -+module_init(bm2835_mmal_init); -+module_exit(bm2835_mmal_exit); -diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h -new file mode 100644 -index 0000000000000000000000000000000000000000..e6aeb7e7e381de65d6c6586205069a4c5cd33274 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/bcm2835-camera.h -@@ -0,0 +1,145 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * core driver device -+ */ -+ -+#define V4L2_CTRL_COUNT 29 /* number of v4l controls */ -+ -+enum { -+ MMAL_COMPONENT_CAMERA = 0, -+ MMAL_COMPONENT_PREVIEW, -+ MMAL_COMPONENT_IMAGE_ENCODE, -+ MMAL_COMPONENT_VIDEO_ENCODE, -+ MMAL_COMPONENT_COUNT -+}; -+ -+enum { -+ MMAL_CAMERA_PORT_PREVIEW = 0, -+ MMAL_CAMERA_PORT_VIDEO, -+ MMAL_CAMERA_PORT_CAPTURE, -+ MMAL_CAMERA_PORT_COUNT -+}; -+ -+#define PREVIEW_LAYER 2 -+ -+extern int bcm2835_v4l2_debug; -+ -+struct bm2835_mmal_dev { -+ /* v4l2 devices */ -+ struct v4l2_device v4l2_dev; -+ struct video_device vdev; -+ struct mutex mutex; -+ -+ /* controls */ -+ struct v4l2_ctrl_handler ctrl_handler; -+ struct v4l2_ctrl *ctrls[V4L2_CTRL_COUNT]; -+ enum v4l2_scene_mode scene_mode; -+ struct mmal_colourfx colourfx; -+ int hflip; -+ int vflip; -+ int red_gain; -+ int blue_gain; -+ enum mmal_parameter_exposuremode exposure_mode_user; -+ enum v4l2_exposure_auto_type exposure_mode_v4l2_user; -+ /* active exposure mode may differ if selected via a scene mode */ -+ enum mmal_parameter_exposuremode exposure_mode_active; -+ enum mmal_parameter_exposuremeteringmode metering_mode; -+ unsigned int manual_shutter_speed; -+ bool exp_auto_priority; -+ bool manual_iso_enabled; -+ uint32_t iso; -+ -+ /* allocated mmal instance and components */ -+ struct vchiq_mmal_instance *instance; -+ struct vchiq_mmal_component *component[MMAL_COMPONENT_COUNT]; -+ int camera_use_count; -+ -+ struct v4l2_window overlay; -+ -+ struct { -+ unsigned int width; /* width */ -+ unsigned int height; /* height */ -+ unsigned int stride; /* stride */ -+ unsigned int buffersize; /* buffer size with padding */ -+ struct mmal_fmt *fmt; -+ struct v4l2_fract timeperframe; -+ -+ /* H264 encode bitrate */ -+ int encode_bitrate; -+ /* H264 bitrate mode. CBR/VBR */ -+ int encode_bitrate_mode; -+ /* H264 profile */ -+ enum v4l2_mpeg_video_h264_profile enc_profile; -+ /* H264 level */ -+ enum v4l2_mpeg_video_h264_level enc_level; -+ /* JPEG Q-factor */ -+ int q_factor; -+ -+ struct vb2_queue vb_vidq; -+ -+ /* VC start timestamp for streaming */ -+ s64 vc_start_timestamp; -+ /* Kernel start timestamp for streaming */ -+ struct timeval kernel_start_ts; -+ -+ struct vchiq_mmal_port *port; /* port being used for capture */ -+ /* camera port being used for capture */ -+ struct vchiq_mmal_port *camera_port; -+ /* component being used for encode */ -+ struct vchiq_mmal_component *encode_component; -+ /* number of frames remaining which driver should capture */ -+ unsigned int frame_count; -+ /* last frame completion */ -+ struct completion frame_cmplt; -+ -+ } capture; -+ -+ unsigned int camera_num; -+ unsigned int max_width; -+ unsigned int max_height; -+ unsigned int rgb_bgr_swapped; -+}; -+ -+int bm2835_mmal_init_controls( -+ struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl_handler *hdl); -+ -+int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev); -+int set_framerate_params(struct bm2835_mmal_dev *dev); -+ -+/* Debug helpers */ -+ -+#define v4l2_dump_pix_format(level, debug, dev, pix_fmt, desc) \ -+{ \ -+ v4l2_dbg(level, debug, dev, \ -+"%s: w %u h %u field %u pfmt 0x%x bpl %u sz_img %u colorspace 0x%x priv %u\n", \ -+ desc == NULL ? "" : desc, \ -+ (pix_fmt)->width, (pix_fmt)->height, (pix_fmt)->field, \ -+ (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \ -+ (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \ -+} -+#define v4l2_dump_win_format(level, debug, dev, win_fmt, desc) \ -+{ \ -+ v4l2_dbg(level, debug, dev, \ -+"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \ -+"clipcount %u bitmap %p\n", \ -+ desc == NULL ? "" : desc, \ -+ (win_fmt)->w.width, (win_fmt)->w.height, \ -+ (win_fmt)->w.left, (win_fmt)->w.top, \ -+ (win_fmt)->field, \ -+ (win_fmt)->chromakey, \ -+ (win_fmt)->clips, (win_fmt)->clipcount, \ -+ (win_fmt)->bitmap); \ -+} -diff --git a/drivers/media/platform/bcm2835/controls.c b/drivers/media/platform/bcm2835/controls.c -new file mode 100644 -index 0000000000000000000000000000000000000000..fe61330ba2a64f850ff3e4930ff813f648889804 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/controls.c -@@ -0,0 +1,1345 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mmal-common.h" -+#include "mmal-vchiq.h" -+#include "mmal-parameters.h" -+#include "bcm2835-camera.h" -+ -+/* The supported V4L2_CID_AUTO_EXPOSURE_BIAS values are from -4.0 to +4.0. -+ * MMAL values are in 1/6th increments so the MMAL range is -24 to +24. -+ * V4L2 docs say value "is expressed in terms of EV, drivers should interpret -+ * the values as 0.001 EV units, where the value 1000 stands for +1 EV." -+ * V4L2 is limited to a max of 32 values in a menu, so count in 1/3rds from -+ * -4 to +4 -+ */ -+static const s64 ev_bias_qmenu[] = { -+ -4000, -3667, -3333, -+ -3000, -2667, -2333, -+ -2000, -1667, -1333, -+ -1000, -667, -333, -+ 0, 333, 667, -+ 1000, 1333, 1667, -+ 2000, 2333, 2667, -+ 3000, 3333, 3667, -+ 4000 -+}; -+ -+/* Supported ISO values (*1000) -+ * ISOO = auto ISO -+ */ -+static const s64 iso_qmenu[] = { -+ 0, 100000, 200000, 400000, 800000, -+}; -+static const uint32_t iso_values[] = { -+ 0, 100, 200, 400, 800, -+}; -+ -+static const s64 mains_freq_qmenu[] = { -+ V4L2_CID_POWER_LINE_FREQUENCY_DISABLED, -+ V4L2_CID_POWER_LINE_FREQUENCY_50HZ, -+ V4L2_CID_POWER_LINE_FREQUENCY_60HZ, -+ V4L2_CID_POWER_LINE_FREQUENCY_AUTO -+}; -+ -+/* Supported video encode modes */ -+static const s64 bitrate_mode_qmenu[] = { -+ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, -+ (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, -+}; -+ -+enum bm2835_mmal_ctrl_type { -+ MMAL_CONTROL_TYPE_STD, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ MMAL_CONTROL_TYPE_INT_MENU, -+ MMAL_CONTROL_TYPE_CLUSTER, /* special cluster entry */ -+}; -+ -+struct bm2835_mmal_v4l2_ctrl; -+ -+typedef int(bm2835_mmal_v4l2_ctrl_cb)( -+ struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl); -+ -+struct bm2835_mmal_v4l2_ctrl { -+ u32 id; /* v4l2 control identifier */ -+ enum bm2835_mmal_ctrl_type type; -+ /* control minimum value or -+ * mask for MMAL_CONTROL_TYPE_STD_MENU */ -+ s32 min; -+ s32 max; /* maximum value of control */ -+ s32 def; /* default value of control */ -+ s32 step; /* step size of the control */ -+ const s64 *imenu; /* integer menu array */ -+ u32 mmal_id; /* mmal parameter id */ -+ bm2835_mmal_v4l2_ctrl_cb *setter; -+ bool ignore_errors; -+}; -+ -+struct v4l2_to_mmal_effects_setting { -+ u32 v4l2_effect; -+ u32 mmal_effect; -+ s32 col_fx_enable; -+ s32 col_fx_fixed_cbcr; -+ u32 u; -+ u32 v; -+ u32 num_effect_params; -+ u32 effect_params[MMAL_MAX_IMAGEFX_PARAMETERS]; -+}; -+ -+static const struct v4l2_to_mmal_effects_setting -+ v4l2_to_mmal_effects_values[] = { -+ { V4L2_COLORFX_NONE, MMAL_PARAM_IMAGEFX_NONE, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_BW, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 0, 128, 128, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SEPIA, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 0, 87, 151, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_NEGATIVE, MMAL_PARAM_IMAGEFX_NEGATIVE, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_EMBOSS, MMAL_PARAM_IMAGEFX_EMBOSS, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SKETCH, MMAL_PARAM_IMAGEFX_SKETCH, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SKY_BLUE, MMAL_PARAM_IMAGEFX_PASTEL, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_GRASS_GREEN, MMAL_PARAM_IMAGEFX_WATERCOLOUR, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SKIN_WHITEN, MMAL_PARAM_IMAGEFX_WASHEDOUT, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_VIVID, MMAL_PARAM_IMAGEFX_SATURATION, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_AQUA, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 0, 171, 121, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_ART_FREEZE, MMAL_PARAM_IMAGEFX_HATCH, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SILHOUETTE, MMAL_PARAM_IMAGEFX_FILM, -+ 0, 0, 0, 0, 0, {0, 0, 0, 0, 0} }, -+ { V4L2_COLORFX_SOLARIZATION, MMAL_PARAM_IMAGEFX_SOLARIZE, -+ 0, 0, 0, 0, 5, {1, 128, 160, 160, 48} }, -+ { V4L2_COLORFX_ANTIQUE, MMAL_PARAM_IMAGEFX_COLOURBALANCE, -+ 0, 0, 0, 0, 3, {108, 274, 238, 0, 0} }, -+ { V4L2_COLORFX_SET_CBCR, MMAL_PARAM_IMAGEFX_NONE, -+ 1, 1, 0, 0, 0, {0, 0, 0, 0, 0} } -+}; -+ -+struct v4l2_mmal_scene_config { -+ enum v4l2_scene_mode v4l2_scene; -+ enum mmal_parameter_exposuremode exposure_mode; -+ enum mmal_parameter_exposuremeteringmode metering_mode; -+}; -+ -+static const struct v4l2_mmal_scene_config scene_configs[] = { -+ /* V4L2_SCENE_MODE_NONE automatically added */ -+ { -+ V4L2_SCENE_MODE_NIGHT, -+ MMAL_PARAM_EXPOSUREMODE_NIGHT, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE -+ }, -+ { -+ V4L2_SCENE_MODE_SPORTS, -+ MMAL_PARAM_EXPOSUREMODE_SPORTS, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE -+ }, -+}; -+ -+/* control handlers*/ -+ -+static int ctrl_set_rational(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ struct mmal_parameter_rational rational_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ rational_value.num = ctrl->val; -+ rational_value.den = 100; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &rational_value, -+ sizeof(rational_value)); -+} -+ -+static int ctrl_set_value(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ u32_value = ctrl->val; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_iso(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ if (ctrl->val > mmal_ctrl->max || ctrl->val < mmal_ctrl->min) -+ return 1; -+ -+ if (ctrl->id == V4L2_CID_ISO_SENSITIVITY) -+ dev->iso = iso_values[ctrl->val]; -+ else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO) -+ dev->manual_iso_enabled = -+ (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ? -+ true : -+ false); -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (dev->manual_iso_enabled) -+ u32_value = dev->iso; -+ else -+ u32_value = 0; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_ISO, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_value_ev(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ s32 s32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ s32_value = (ctrl->val-12)*2; /* Convert from index to 1/6ths */ -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &s32_value, sizeof(s32_value)); -+} -+ -+static int ctrl_set_rotate(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret; -+ u32 u32_value; -+ struct vchiq_mmal_component *camera; -+ -+ camera = dev->component[MMAL_COMPONENT_CAMERA]; -+ -+ u32_value = ((ctrl->val % 360) / 90) * 90; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ -+ return ret; -+} -+ -+static int ctrl_set_flip(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret; -+ u32 u32_value; -+ struct vchiq_mmal_component *camera; -+ -+ if (ctrl->id == V4L2_CID_HFLIP) -+ dev->hflip = ctrl->val; -+ else -+ dev->vflip = ctrl->val; -+ -+ camera = dev->component[MMAL_COMPONENT_CAMERA]; -+ -+ if (dev->hflip && dev->vflip) -+ u32_value = MMAL_PARAM_MIRROR_BOTH; -+ else if (dev->hflip) -+ u32_value = MMAL_PARAM_MIRROR_HORIZONTAL; -+ else if (dev->vflip) -+ u32_value = MMAL_PARAM_MIRROR_VERTICAL; -+ else -+ u32_value = MMAL_PARAM_MIRROR_NONE; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[0], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[1], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ if (ret < 0) -+ return ret; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, &camera->output[2], -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ -+ return ret; -+ -+} -+ -+static int ctrl_set_exposure(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ enum mmal_parameter_exposuremode exp_mode = dev->exposure_mode_user; -+ u32 shutter_speed = 0; -+ struct vchiq_mmal_port *control; -+ int ret = 0; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (mmal_ctrl->mmal_id == MMAL_PARAMETER_SHUTTER_SPEED) { -+ /* V4L2 is in 100usec increments. -+ * MMAL is 1usec. -+ */ -+ dev->manual_shutter_speed = ctrl->val * 100; -+ } else if (mmal_ctrl->mmal_id == MMAL_PARAMETER_EXPOSURE_MODE) { -+ switch (ctrl->val) { -+ case V4L2_EXPOSURE_AUTO: -+ exp_mode = MMAL_PARAM_EXPOSUREMODE_AUTO; -+ break; -+ -+ case V4L2_EXPOSURE_MANUAL: -+ exp_mode = MMAL_PARAM_EXPOSUREMODE_OFF; -+ break; -+ } -+ dev->exposure_mode_user = exp_mode; -+ dev->exposure_mode_v4l2_user = ctrl->val; -+ } else if (mmal_ctrl->id == V4L2_CID_EXPOSURE_AUTO_PRIORITY) { -+ dev->exp_auto_priority = ctrl->val; -+ } -+ -+ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { -+ if (exp_mode == MMAL_PARAM_EXPOSUREMODE_OFF) -+ shutter_speed = dev->manual_shutter_speed; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &shutter_speed, -+ sizeof(shutter_speed)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &exp_mode, -+ sizeof(u32)); -+ dev->exposure_mode_active = exp_mode; -+ } -+ /* exposure_dynamic_framerate (V4L2_CID_EXPOSURE_AUTO_PRIORITY) should -+ * always apply irrespective of scene mode. -+ */ -+ ret += set_framerate_params(dev); -+ -+ return ret; -+} -+ -+static int ctrl_set_metering_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ switch (ctrl->val) { -+ case V4L2_EXPOSURE_METERING_AVERAGE: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE; -+ break; -+ -+ case V4L2_EXPOSURE_METERING_CENTER_WEIGHTED: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT; -+ break; -+ -+ case V4L2_EXPOSURE_METERING_SPOT: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT; -+ break; -+ -+ /* todo matrix weighting not added to Linux API till 3.9 -+ case V4L2_EXPOSURE_METERING_MATRIX: -+ dev->metering_mode = MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX; -+ break; -+ */ -+ -+ } -+ -+ if (dev->scene_mode == V4L2_SCENE_MODE_NONE) { -+ struct vchiq_mmal_port *control; -+ u32 u32_value = dev->metering_mode; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+ } else -+ return 0; -+} -+ -+static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ switch (ctrl->val) { -+ case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED: -+ u32_value = MMAL_PARAM_FLICKERAVOID_OFF; -+ break; -+ case V4L2_CID_POWER_LINE_FREQUENCY_50HZ: -+ u32_value = MMAL_PARAM_FLICKERAVOID_50HZ; -+ break; -+ case V4L2_CID_POWER_LINE_FREQUENCY_60HZ: -+ u32_value = MMAL_PARAM_FLICKERAVOID_60HZ; -+ break; -+ case V4L2_CID_POWER_LINE_FREQUENCY_AUTO: -+ u32_value = MMAL_PARAM_FLICKERAVOID_AUTO; -+ break; -+ } -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_awb_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ switch (ctrl->val) { -+ case V4L2_WHITE_BALANCE_MANUAL: -+ u32_value = MMAL_PARAM_AWBMODE_OFF; -+ break; -+ -+ case V4L2_WHITE_BALANCE_AUTO: -+ u32_value = MMAL_PARAM_AWBMODE_AUTO; -+ break; -+ -+ case V4L2_WHITE_BALANCE_INCANDESCENT: -+ u32_value = MMAL_PARAM_AWBMODE_INCANDESCENT; -+ break; -+ -+ case V4L2_WHITE_BALANCE_FLUORESCENT: -+ u32_value = MMAL_PARAM_AWBMODE_FLUORESCENT; -+ break; -+ -+ case V4L2_WHITE_BALANCE_FLUORESCENT_H: -+ u32_value = MMAL_PARAM_AWBMODE_TUNGSTEN; -+ break; -+ -+ case V4L2_WHITE_BALANCE_HORIZON: -+ u32_value = MMAL_PARAM_AWBMODE_HORIZON; -+ break; -+ -+ case V4L2_WHITE_BALANCE_DAYLIGHT: -+ u32_value = MMAL_PARAM_AWBMODE_SUNLIGHT; -+ break; -+ -+ case V4L2_WHITE_BALANCE_FLASH: -+ u32_value = MMAL_PARAM_AWBMODE_FLASH; -+ break; -+ -+ case V4L2_WHITE_BALANCE_CLOUDY: -+ u32_value = MMAL_PARAM_AWBMODE_CLOUDY; -+ break; -+ -+ case V4L2_WHITE_BALANCE_SHADE: -+ u32_value = MMAL_PARAM_AWBMODE_SHADE; -+ break; -+ -+ } -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_awb_gains(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ struct vchiq_mmal_port *control; -+ struct mmal_parameter_awbgains gains; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (ctrl->id == V4L2_CID_RED_BALANCE) -+ dev->red_gain = ctrl->val; -+ else if (ctrl->id == V4L2_CID_BLUE_BALANCE) -+ dev->blue_gain = ctrl->val; -+ -+ gains.r_gain.num = dev->red_gain; -+ gains.b_gain.num = dev->blue_gain; -+ gains.r_gain.den = gains.b_gain.den = 1000; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, control, -+ mmal_ctrl->mmal_id, -+ &gains, sizeof(gains)); -+} -+ -+static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret = -EINVAL; -+ int i, j; -+ struct vchiq_mmal_port *control; -+ struct mmal_parameter_imagefx_parameters imagefx; -+ -+ for (i = 0; i < ARRAY_SIZE(v4l2_to_mmal_effects_values); i++) { -+ if (ctrl->val == v4l2_to_mmal_effects_values[i].v4l2_effect) { -+ -+ imagefx.effect = -+ v4l2_to_mmal_effects_values[i].mmal_effect; -+ imagefx.num_effect_params = -+ v4l2_to_mmal_effects_values[i].num_effect_params; -+ -+ if (imagefx.num_effect_params > MMAL_MAX_IMAGEFX_PARAMETERS) -+ imagefx.num_effect_params = MMAL_MAX_IMAGEFX_PARAMETERS; -+ -+ for (j = 0; j < imagefx.num_effect_params; j++) -+ imagefx.effect_parameter[j] = -+ v4l2_to_mmal_effects_values[i].effect_params[j]; -+ -+ dev->colourfx.enable = -+ v4l2_to_mmal_effects_values[i].col_fx_enable; -+ if (!v4l2_to_mmal_effects_values[i].col_fx_fixed_cbcr) { -+ dev->colourfx.u = -+ v4l2_to_mmal_effects_values[i].u; -+ dev->colourfx.v = -+ v4l2_to_mmal_effects_values[i].v; -+ } -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ ret = vchiq_mmal_port_parameter_set( -+ dev->instance, control, -+ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, -+ &imagefx, sizeof(imagefx)); -+ if (ret) -+ goto exit; -+ -+ ret = vchiq_mmal_port_parameter_set( -+ dev->instance, control, -+ MMAL_PARAMETER_COLOUR_EFFECT, -+ &dev->colourfx, sizeof(dev->colourfx)); -+ } -+ } -+ -+exit: -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "mmal_ctrl:%p ctrl id:0x%x ctrl val:%d imagefx:0x%x color_effect:%s u:%d v:%d ret %d(%d)\n", -+ mmal_ctrl, ctrl->id, ctrl->val, imagefx.effect, -+ dev->colourfx.enable ? "true" : "false", -+ dev->colourfx.u, dev->colourfx.v, -+ ret, (ret == 0 ? 0 : -EINVAL)); -+ return (ret == 0 ? 0 : EINVAL); -+} -+ -+static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret = -EINVAL; -+ struct vchiq_mmal_port *control; -+ -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ dev->colourfx.enable = (ctrl->val & 0xff00) >> 8; -+ dev->colourfx.enable = ctrl->val & 0xff; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_COLOUR_EFFECT, -+ &dev->colourfx, sizeof(dev->colourfx)); -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", -+ __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, -+ (ret == 0 ? 0 : -EINVAL)); -+ return (ret == 0 ? 0 : EINVAL); -+} -+ -+static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret; -+ struct vchiq_mmal_port *encoder_out; -+ -+ dev->capture.encode_bitrate = ctrl->val; -+ -+ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out, -+ mmal_ctrl->mmal_id, -+ &ctrl->val, sizeof(ctrl->val)); -+ ret = 0; -+ return ret; -+} -+ -+static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 bitrate_mode; -+ struct vchiq_mmal_port *encoder_out; -+ -+ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ -+ dev->capture.encode_bitrate_mode = ctrl->val; -+ switch (ctrl->val) { -+ default: -+ case V4L2_MPEG_VIDEO_BITRATE_MODE_VBR: -+ bitrate_mode = MMAL_VIDEO_RATECONTROL_VARIABLE; -+ break; -+ case V4L2_MPEG_VIDEO_BITRATE_MODE_CBR: -+ bitrate_mode = MMAL_VIDEO_RATECONTROL_CONSTANT; -+ break; -+ } -+ -+ vchiq_mmal_port_parameter_set(dev->instance, encoder_out, -+ mmal_ctrl->mmal_id, -+ &bitrate_mode, -+ sizeof(bitrate_mode)); -+ return 0; -+} -+ -+static int ctrl_set_image_encode_output(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *jpeg_out; -+ -+ jpeg_out = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; -+ -+ u32_value = ctrl->val; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, jpeg_out, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_video_encode_param_output(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ u32 u32_value; -+ struct vchiq_mmal_port *vid_enc_ctl; -+ -+ vid_enc_ctl = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; -+ -+ u32_value = ctrl->val; -+ -+ return vchiq_mmal_port_parameter_set(dev->instance, vid_enc_ctl, -+ mmal_ctrl->mmal_id, -+ &u32_value, sizeof(u32_value)); -+} -+ -+static int ctrl_set_video_encode_profile_level(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ struct mmal_parameter_video_profile param; -+ int ret = 0; -+ -+ if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_PROFILE) { -+ switch (ctrl->val) { -+ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: -+ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: -+ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: -+ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: -+ dev->capture.enc_profile = ctrl->val; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_LEVEL) { -+ switch (ctrl->val) { -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: -+ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: -+ dev->capture.enc_level = ctrl->val; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ } -+ -+ if (!ret) { -+ switch (dev->capture.enc_profile) { -+ case V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE: -+ param.profile = MMAL_VIDEO_PROFILE_H264_BASELINE; -+ break; -+ case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: -+ param.profile = -+ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE; -+ break; -+ case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN: -+ param.profile = MMAL_VIDEO_PROFILE_H264_MAIN; -+ break; -+ case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH: -+ param.profile = MMAL_VIDEO_PROFILE_H264_HIGH; -+ break; -+ default: -+ /* Should never get here */ -+ break; -+ } -+ -+ switch (dev->capture.enc_level) { -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_1; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1B: -+ param.level = MMAL_VIDEO_LEVEL_H264_1b; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_1: -+ param.level = MMAL_VIDEO_LEVEL_H264_11; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_2: -+ param.level = MMAL_VIDEO_LEVEL_H264_12; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_1_3: -+ param.level = MMAL_VIDEO_LEVEL_H264_13; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_2; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_1: -+ param.level = MMAL_VIDEO_LEVEL_H264_21; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_2_2: -+ param.level = MMAL_VIDEO_LEVEL_H264_22; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_3; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_1: -+ param.level = MMAL_VIDEO_LEVEL_H264_31; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_3_2: -+ param.level = MMAL_VIDEO_LEVEL_H264_32; -+ break; -+ case V4L2_MPEG_VIDEO_H264_LEVEL_4_0: -+ param.level = MMAL_VIDEO_LEVEL_H264_4; -+ break; -+ default: -+ /* Should never get here */ -+ break; -+ } -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0], -+ mmal_ctrl->mmal_id, -+ ¶m, sizeof(param)); -+ } -+ return ret; -+} -+ -+static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl *ctrl, -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) -+{ -+ int ret = 0; -+ int shutter_speed; -+ struct vchiq_mmal_port *control; -+ -+ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "scene mode selected %d, was %d\n", ctrl->val, -+ dev->scene_mode); -+ control = &dev->component[MMAL_COMPONENT_CAMERA]->control; -+ -+ if (ctrl->val == dev->scene_mode) -+ return 0; -+ -+ if (ctrl->val == V4L2_SCENE_MODE_NONE) { -+ /* Restore all user selections */ -+ dev->scene_mode = V4L2_SCENE_MODE_NONE; -+ -+ if (dev->exposure_mode_user == MMAL_PARAM_EXPOSUREMODE_OFF) -+ shutter_speed = dev->manual_shutter_speed; -+ else -+ shutter_speed = 0; -+ -+ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", -+ __func__, shutter_speed, dev->exposure_mode_user, -+ dev->metering_mode); -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &shutter_speed, -+ sizeof(shutter_speed)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &dev->exposure_mode_user, -+ sizeof(u32)); -+ dev->exposure_mode_active = dev->exposure_mode_user; -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXP_METERING_MODE, -+ &dev->metering_mode, -+ sizeof(u32)); -+ ret += set_framerate_params(dev); -+ } else { -+ /* Set up scene mode */ -+ int i; -+ const struct v4l2_mmal_scene_config *scene = NULL; -+ int shutter_speed; -+ enum mmal_parameter_exposuremode exposure_mode; -+ enum mmal_parameter_exposuremeteringmode metering_mode; -+ -+ for (i = 0; i < ARRAY_SIZE(scene_configs); i++) { -+ if (scene_configs[i].v4l2_scene == -+ ctrl->val) { -+ scene = &scene_configs[i]; -+ break; -+ } -+ } -+ if (!scene) -+ return -EINVAL; -+ if (i >= ARRAY_SIZE(scene_configs)) -+ return -EINVAL; -+ -+ /* Set all the values */ -+ dev->scene_mode = ctrl->val; -+ -+ if (scene->exposure_mode == MMAL_PARAM_EXPOSUREMODE_OFF) -+ shutter_speed = dev->manual_shutter_speed; -+ else -+ shutter_speed = 0; -+ exposure_mode = scene->exposure_mode; -+ metering_mode = scene->metering_mode; -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: scene mode none: shut_speed %d, exp_mode %d, metering %d\n", -+ __func__, shutter_speed, exposure_mode, metering_mode); -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &shutter_speed, -+ sizeof(shutter_speed)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &exposure_mode, -+ sizeof(u32)); -+ dev->exposure_mode_active = exposure_mode; -+ ret += vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &exposure_mode, -+ sizeof(u32)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, control, -+ MMAL_PARAMETER_EXP_METERING_MODE, -+ &metering_mode, -+ sizeof(u32)); -+ ret += set_framerate_params(dev); -+ } -+ if (ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "%s: Setting scene to %d, ret=%d\n", -+ __func__, ctrl->val, ret); -+ ret = -EINVAL; -+ } -+ return 0; -+} -+ -+static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl) -+{ -+ struct bm2835_mmal_dev *dev = -+ container_of(ctrl->handler, struct bm2835_mmal_dev, -+ ctrl_handler); -+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv; -+ int ret; -+ -+ if ((mmal_ctrl == NULL) || -+ (mmal_ctrl->id != ctrl->id) || -+ (mmal_ctrl->setter == NULL)) { -+ pr_warn("mmal_ctrl:%p ctrl id:%d\n", mmal_ctrl, ctrl->id); -+ return -EINVAL; -+ } -+ -+ ret = mmal_ctrl->setter(dev, ctrl, mmal_ctrl); -+ if (ret) -+ pr_warn("ctrl id:%d/MMAL param %08X- returned ret %d\n", -+ ctrl->id, mmal_ctrl->mmal_id, ret); -+ if (mmal_ctrl->ignore_errors) -+ ret = 0; -+ return ret; -+} -+ -+static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = { -+ .s_ctrl = bm2835_mmal_s_ctrl, -+}; -+ -+ -+ -+static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { -+ { -+ V4L2_CID_SATURATION, MMAL_CONTROL_TYPE_STD, -+ -100, 100, 0, 1, NULL, -+ MMAL_PARAMETER_SATURATION, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_SHARPNESS, MMAL_CONTROL_TYPE_STD, -+ -100, 100, 0, 1, NULL, -+ MMAL_PARAMETER_SHARPNESS, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_CONTRAST, MMAL_CONTROL_TYPE_STD, -+ -100, 100, 0, 1, NULL, -+ MMAL_PARAMETER_CONTRAST, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_BRIGHTNESS, MMAL_CONTROL_TYPE_STD, -+ 0, 100, 50, 1, NULL, -+ MMAL_PARAMETER_BRIGHTNESS, -+ &ctrl_set_rational, -+ false -+ }, -+ { -+ V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, -+ 0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, -+ MMAL_PARAMETER_ISO, -+ &ctrl_set_iso, -+ false -+ }, -+ { -+ V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, -+ MMAL_PARAMETER_ISO, -+ &ctrl_set_iso, -+ false -+ }, -+ { -+ V4L2_CID_IMAGE_STABILIZATION, MMAL_CONTROL_TYPE_STD, -+ 0, 1, 0, 1, NULL, -+ MMAL_PARAMETER_VIDEO_STABILISATION, -+ &ctrl_set_value, -+ false -+ }, -+/* { -+ 0, MMAL_CONTROL_TYPE_CLUSTER, 3, 1, 0, NULL, 0, NULL -+ }, */ -+ { -+ V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU, -+ ~0x03, 3, V4L2_EXPOSURE_AUTO, 0, NULL, -+ MMAL_PARAMETER_EXPOSURE_MODE, -+ &ctrl_set_exposure, -+ false -+ }, -+/* todo this needs mixing in with set exposure -+ { -+ V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, -+ }, -+ */ -+ { -+ V4L2_CID_EXPOSURE_ABSOLUTE, MMAL_CONTROL_TYPE_STD, -+ /* Units of 100usecs */ -+ 1, 1*1000*10, 100*10, 1, NULL, -+ MMAL_PARAMETER_SHUTTER_SPEED, -+ &ctrl_set_exposure, -+ false -+ }, -+ { -+ V4L2_CID_AUTO_EXPOSURE_BIAS, MMAL_CONTROL_TYPE_INT_MENU, -+ 0, ARRAY_SIZE(ev_bias_qmenu) - 1, -+ (ARRAY_SIZE(ev_bias_qmenu)+1)/2 - 1, 0, ev_bias_qmenu, -+ MMAL_PARAMETER_EXPOSURE_COMP, -+ &ctrl_set_value_ev, -+ false -+ }, -+ { -+ V4L2_CID_EXPOSURE_AUTO_PRIORITY, MMAL_CONTROL_TYPE_STD, -+ 0, 1, -+ 0, 1, NULL, -+ 0, /* Dummy MMAL ID as it gets mapped into FPS range*/ -+ &ctrl_set_exposure, -+ false -+ }, -+ { -+ V4L2_CID_EXPOSURE_METERING, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ ~0x7, 2, V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, -+ MMAL_PARAMETER_EXP_METERING_MODE, -+ &ctrl_set_metering_mode, -+ false -+ }, -+ { -+ V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ ~0x3ff, 9, V4L2_WHITE_BALANCE_AUTO, 0, NULL, -+ MMAL_PARAMETER_AWB_MODE, -+ &ctrl_set_awb_mode, -+ false -+ }, -+ { -+ V4L2_CID_RED_BALANCE, MMAL_CONTROL_TYPE_STD, -+ 1, 7999, 1000, 1, NULL, -+ MMAL_PARAMETER_CUSTOM_AWB_GAINS, -+ &ctrl_set_awb_gains, -+ false -+ }, -+ { -+ V4L2_CID_BLUE_BALANCE, MMAL_CONTROL_TYPE_STD, -+ 1, 7999, 1000, 1, NULL, -+ MMAL_PARAMETER_CUSTOM_AWB_GAINS, -+ &ctrl_set_awb_gains, -+ false -+ }, -+ { -+ V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, 15, V4L2_COLORFX_NONE, 0, NULL, -+ MMAL_PARAMETER_IMAGE_EFFECT, -+ &ctrl_set_image_effect, -+ false -+ }, -+ { -+ V4L2_CID_COLORFX_CBCR, MMAL_CONTROL_TYPE_STD, -+ 0, 0xffff, 0x8080, 1, NULL, -+ MMAL_PARAMETER_COLOUR_EFFECT, -+ &ctrl_set_colfx, -+ false -+ }, -+ { -+ V4L2_CID_ROTATE, MMAL_CONTROL_TYPE_STD, -+ 0, 360, 0, 90, NULL, -+ MMAL_PARAMETER_ROTATION, -+ &ctrl_set_rotate, -+ false -+ }, -+ { -+ V4L2_CID_HFLIP, MMAL_CONTROL_TYPE_STD, -+ 0, 1, 0, 1, NULL, -+ MMAL_PARAMETER_MIRROR, -+ &ctrl_set_flip, -+ false -+ }, -+ { -+ V4L2_CID_VFLIP, MMAL_CONTROL_TYPE_STD, -+ 0, 1, 0, 1, NULL, -+ MMAL_PARAMETER_MIRROR, -+ &ctrl_set_flip, -+ false -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, ARRAY_SIZE(bitrate_mode_qmenu) - 1, -+ 0, 0, bitrate_mode_qmenu, -+ MMAL_PARAMETER_RATECONTROL, -+ &ctrl_set_bitrate_mode, -+ false -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_BITRATE, MMAL_CONTROL_TYPE_STD, -+ 25*1000, 25*1000*1000, 10*1000*1000, 25*1000, NULL, -+ MMAL_PARAMETER_VIDEO_BIT_RATE, -+ &ctrl_set_bitrate, -+ false -+ }, -+ { -+ V4L2_CID_JPEG_COMPRESSION_QUALITY, MMAL_CONTROL_TYPE_STD, -+ 1, 100, -+ 30, 1, NULL, -+ MMAL_PARAMETER_JPEG_Q_FACTOR, -+ &ctrl_set_image_encode_output, -+ false -+ }, -+ { -+ V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU, -+ 0, ARRAY_SIZE(mains_freq_qmenu) - 1, -+ 1, 1, NULL, -+ MMAL_PARAMETER_FLICKER_AVOID, -+ &ctrl_set_flicker_avoidance, -+ false -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER, MMAL_CONTROL_TYPE_STD, -+ 0, 1, -+ 0, 1, NULL, -+ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER, -+ &ctrl_set_video_encode_param_output, -+ true /* Errors ignored as requires latest firmware to work */ -+ }, -+ { -+ V4L2_CID_MPEG_VIDEO_H264_PROFILE, -+ MMAL_CONTROL_TYPE_STD_MENU, -+ ~((1<ctrls[c]) && (v4l2_ctrls[c].setter)) { -+ ret = v4l2_ctrls[c].setter(dev, dev->ctrls[c], -+ &v4l2_ctrls[c]); -+ if (!v4l2_ctrls[c].ignore_errors && ret) { -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Failed when setting default values for ctrl %d\n", -+ c); -+ break; -+ } -+ } -+ } -+ return ret; -+} -+ -+int set_framerate_params(struct bm2835_mmal_dev *dev) -+{ -+ struct mmal_parameter_fps_range fps_range; -+ int ret; -+ -+ if ((dev->exposure_mode_active != MMAL_PARAM_EXPOSUREMODE_OFF) && -+ (dev->exp_auto_priority)) { -+ /* Variable FPS. Define min FPS as 1fps. -+ * Max as max defined FPS. -+ */ -+ fps_range.fps_low.num = 1; -+ fps_range.fps_low.den = 1; -+ fps_range.fps_high.num = dev->capture.timeperframe.denominator; -+ fps_range.fps_high.den = dev->capture.timeperframe.numerator; -+ } else { -+ /* Fixed FPS - set min and max to be the same */ -+ fps_range.fps_low.num = fps_range.fps_high.num = -+ dev->capture.timeperframe.denominator; -+ fps_range.fps_low.den = fps_range.fps_high.den = -+ dev->capture.timeperframe.numerator; -+ } -+ -+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Set fps range to %d/%d to %d/%d\n", -+ fps_range.fps_low.num, -+ fps_range.fps_low.den, -+ fps_range.fps_high.num, -+ fps_range.fps_high.den -+ ); -+ -+ ret = vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_PREVIEW], -+ MMAL_PARAMETER_FPS_RANGE, -+ &fps_range, sizeof(fps_range)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_VIDEO], -+ MMAL_PARAMETER_FPS_RANGE, -+ &fps_range, sizeof(fps_range)); -+ ret += vchiq_mmal_port_parameter_set(dev->instance, -+ &dev->component[MMAL_COMPONENT_CAMERA]-> -+ output[MMAL_CAMERA_PORT_CAPTURE], -+ MMAL_PARAMETER_FPS_RANGE, -+ &fps_range, sizeof(fps_range)); -+ if (ret) -+ v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev, -+ "Failed to set fps ret %d\n", -+ ret); -+ -+ return ret; -+ -+} -+ -+int bm2835_mmal_init_controls(struct bm2835_mmal_dev *dev, -+ struct v4l2_ctrl_handler *hdl) -+{ -+ int c; -+ const struct bm2835_mmal_v4l2_ctrl *ctrl; -+ -+ v4l2_ctrl_handler_init(hdl, V4L2_CTRL_COUNT); -+ -+ for (c = 0; c < V4L2_CTRL_COUNT; c++) { -+ ctrl = &v4l2_ctrls[c]; -+ -+ switch (ctrl->type) { -+ case MMAL_CONTROL_TYPE_STD: -+ dev->ctrls[c] = v4l2_ctrl_new_std(hdl, -+ &bm2835_mmal_ctrl_ops, ctrl->id, -+ ctrl->min, ctrl->max, ctrl->step, ctrl->def); -+ break; -+ -+ case MMAL_CONTROL_TYPE_STD_MENU: -+ { -+ int mask = ctrl->min; -+ -+ if (ctrl->id == V4L2_CID_SCENE_MODE) { -+ /* Special handling to work out the mask -+ * value based on the scene_configs array -+ * at runtime. Reduces the chance of -+ * mismatches. -+ */ -+ int i; -+ mask = 1<ctrls[c] = v4l2_ctrl_new_std_menu(hdl, -+ &bm2835_mmal_ctrl_ops, ctrl->id, -+ ctrl->max, mask, ctrl->def); -+ break; -+ } -+ -+ case MMAL_CONTROL_TYPE_INT_MENU: -+ dev->ctrls[c] = v4l2_ctrl_new_int_menu(hdl, -+ &bm2835_mmal_ctrl_ops, ctrl->id, -+ ctrl->max, ctrl->def, ctrl->imenu); -+ break; -+ -+ case MMAL_CONTROL_TYPE_CLUSTER: -+ /* skip this entry when constructing controls */ -+ continue; -+ } -+ -+ if (hdl->error) -+ break; -+ -+ dev->ctrls[c]->priv = (void *)ctrl; -+ } -+ -+ if (hdl->error) { -+ pr_err("error adding control %d/%d id 0x%x\n", c, -+ V4L2_CTRL_COUNT, ctrl->id); -+ return hdl->error; -+ } -+ -+ for (c = 0; c < V4L2_CTRL_COUNT; c++) { -+ ctrl = &v4l2_ctrls[c]; -+ -+ switch (ctrl->type) { -+ case MMAL_CONTROL_TYPE_CLUSTER: -+ v4l2_ctrl_auto_cluster(ctrl->min, -+ &dev->ctrls[c+1], -+ ctrl->max, -+ ctrl->def); -+ break; -+ -+ case MMAL_CONTROL_TYPE_STD: -+ case MMAL_CONTROL_TYPE_STD_MENU: -+ case MMAL_CONTROL_TYPE_INT_MENU: -+ break; -+ } -+ -+ } -+ -+ return 0; -+} -diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h -new file mode 100644 -index 0000000000000000000000000000000000000000..840fd139e03315b5d9ac2d5742ab589bc6b17ade ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-common.h -@@ -0,0 +1,53 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * MMAL structures -+ * -+ */ -+ -+#define MMAL_FOURCC(a, b, c, d) ((a) | (b << 8) | (c << 16) | (d << 24)) -+#define MMAL_MAGIC MMAL_FOURCC('m', 'm', 'a', 'l') -+ -+/** Special value signalling that time is not known */ -+#define MMAL_TIME_UNKNOWN (1LL<<63) -+ -+/* mapping between v4l and mmal video modes */ -+struct mmal_fmt { -+ char *name; -+ u32 fourcc; /* v4l2 format id */ -+ int flags; /* v4l2 flags field */ -+ u32 mmal; -+ int depth; -+ u32 mmal_component; /* MMAL component index to be used to encode */ -+ u32 ybbp; /* depth of first Y plane for planar formats */ -+}; -+ -+/* buffer for one video frame */ -+struct mmal_buffer { -+ /* v4l buffer data -- must be first */ -+ struct vb2_v4l2_buffer vb; -+ -+ /* list of buffers available */ -+ struct list_head list; -+ -+ void *buffer; /* buffer pointer */ -+ unsigned long buffer_size; /* size of allocated buffer */ -+}; -+ -+/* */ -+struct mmal_colourfx { -+ s32 enable; -+ u32 u; -+ u32 v; -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-encodings.h b/drivers/media/platform/bcm2835/mmal-encodings.h -new file mode 100644 -index 0000000000000000000000000000000000000000..024d620dc1dfda006a9d36dffeeec691faf24ac5 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-encodings.h -@@ -0,0 +1,127 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+#ifndef MMAL_ENCODINGS_H -+#define MMAL_ENCODINGS_H -+ -+#define MMAL_ENCODING_H264 MMAL_FOURCC('H', '2', '6', '4') -+#define MMAL_ENCODING_H263 MMAL_FOURCC('H', '2', '6', '3') -+#define MMAL_ENCODING_MP4V MMAL_FOURCC('M', 'P', '4', 'V') -+#define MMAL_ENCODING_MP2V MMAL_FOURCC('M', 'P', '2', 'V') -+#define MMAL_ENCODING_MP1V MMAL_FOURCC('M', 'P', '1', 'V') -+#define MMAL_ENCODING_WMV3 MMAL_FOURCC('W', 'M', 'V', '3') -+#define MMAL_ENCODING_WMV2 MMAL_FOURCC('W', 'M', 'V', '2') -+#define MMAL_ENCODING_WMV1 MMAL_FOURCC('W', 'M', 'V', '1') -+#define MMAL_ENCODING_WVC1 MMAL_FOURCC('W', 'V', 'C', '1') -+#define MMAL_ENCODING_VP8 MMAL_FOURCC('V', 'P', '8', ' ') -+#define MMAL_ENCODING_VP7 MMAL_FOURCC('V', 'P', '7', ' ') -+#define MMAL_ENCODING_VP6 MMAL_FOURCC('V', 'P', '6', ' ') -+#define MMAL_ENCODING_THEORA MMAL_FOURCC('T', 'H', 'E', 'O') -+#define MMAL_ENCODING_SPARK MMAL_FOURCC('S', 'P', 'R', 'K') -+#define MMAL_ENCODING_MJPEG MMAL_FOURCC('M', 'J', 'P', 'G') -+ -+#define MMAL_ENCODING_JPEG MMAL_FOURCC('J', 'P', 'E', 'G') -+#define MMAL_ENCODING_GIF MMAL_FOURCC('G', 'I', 'F', ' ') -+#define MMAL_ENCODING_PNG MMAL_FOURCC('P', 'N', 'G', ' ') -+#define MMAL_ENCODING_PPM MMAL_FOURCC('P', 'P', 'M', ' ') -+#define MMAL_ENCODING_TGA MMAL_FOURCC('T', 'G', 'A', ' ') -+#define MMAL_ENCODING_BMP MMAL_FOURCC('B', 'M', 'P', ' ') -+ -+#define MMAL_ENCODING_I420 MMAL_FOURCC('I', '4', '2', '0') -+#define MMAL_ENCODING_I420_SLICE MMAL_FOURCC('S', '4', '2', '0') -+#define MMAL_ENCODING_YV12 MMAL_FOURCC('Y', 'V', '1', '2') -+#define MMAL_ENCODING_I422 MMAL_FOURCC('I', '4', '2', '2') -+#define MMAL_ENCODING_I422_SLICE MMAL_FOURCC('S', '4', '2', '2') -+#define MMAL_ENCODING_YUYV MMAL_FOURCC('Y', 'U', 'Y', 'V') -+#define MMAL_ENCODING_YVYU MMAL_FOURCC('Y', 'V', 'Y', 'U') -+#define MMAL_ENCODING_UYVY MMAL_FOURCC('U', 'Y', 'V', 'Y') -+#define MMAL_ENCODING_VYUY MMAL_FOURCC('V', 'Y', 'U', 'Y') -+#define MMAL_ENCODING_NV12 MMAL_FOURCC('N', 'V', '1', '2') -+#define MMAL_ENCODING_NV21 MMAL_FOURCC('N', 'V', '2', '1') -+#define MMAL_ENCODING_ARGB MMAL_FOURCC('A', 'R', 'G', 'B') -+#define MMAL_ENCODING_RGBA MMAL_FOURCC('R', 'G', 'B', 'A') -+#define MMAL_ENCODING_ABGR MMAL_FOURCC('A', 'B', 'G', 'R') -+#define MMAL_ENCODING_BGRA MMAL_FOURCC('B', 'G', 'R', 'A') -+#define MMAL_ENCODING_RGB16 MMAL_FOURCC('R', 'G', 'B', '2') -+#define MMAL_ENCODING_RGB24 MMAL_FOURCC('R', 'G', 'B', '3') -+#define MMAL_ENCODING_RGB32 MMAL_FOURCC('R', 'G', 'B', '4') -+#define MMAL_ENCODING_BGR16 MMAL_FOURCC('B', 'G', 'R', '2') -+#define MMAL_ENCODING_BGR24 MMAL_FOURCC('B', 'G', 'R', '3') -+#define MMAL_ENCODING_BGR32 MMAL_FOURCC('B', 'G', 'R', '4') -+ -+/** SAND Video (YUVUV128) format, native format understood by VideoCore. -+ * This format is *not* opaque - if requested you will receive full frames -+ * of YUV_UV video. -+ */ -+#define MMAL_ENCODING_YUVUV128 MMAL_FOURCC('S', 'A', 'N', 'D') -+ -+/** VideoCore opaque image format, image handles are returned to -+ * the host but not the actual image data. -+ */ -+#define MMAL_ENCODING_OPAQUE MMAL_FOURCC('O', 'P', 'Q', 'V') -+ -+/** An EGL image handle -+ */ -+#define MMAL_ENCODING_EGL_IMAGE MMAL_FOURCC('E', 'G', 'L', 'I') -+ -+/* }@ */ -+ -+/** \name Pre-defined audio encodings */ -+/* @{ */ -+#define MMAL_ENCODING_PCM_UNSIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'U') -+#define MMAL_ENCODING_PCM_UNSIGNED_LE MMAL_FOURCC('p', 'c', 'm', 'u') -+#define MMAL_ENCODING_PCM_SIGNED_BE MMAL_FOURCC('P', 'C', 'M', 'S') -+#define MMAL_ENCODING_PCM_SIGNED_LE MMAL_FOURCC('p', 'c', 'm', 's') -+#define MMAL_ENCODING_PCM_FLOAT_BE MMAL_FOURCC('P', 'C', 'M', 'F') -+#define MMAL_ENCODING_PCM_FLOAT_LE MMAL_FOURCC('p', 'c', 'm', 'f') -+ -+/* Pre-defined H264 encoding variants */ -+ -+/** ISO 14496-10 Annex B byte stream format */ -+#define MMAL_ENCODING_VARIANT_H264_DEFAULT 0 -+/** ISO 14496-15 AVC stream format */ -+#define MMAL_ENCODING_VARIANT_H264_AVC1 MMAL_FOURCC('A', 'V', 'C', '1') -+/** Implicitly delineated NAL units without emulation prevention */ -+#define MMAL_ENCODING_VARIANT_H264_RAW MMAL_FOURCC('R', 'A', 'W', ' ') -+ -+ -+/** \defgroup MmalColorSpace List of pre-defined video color spaces -+ * This defines a list of common color spaces. This list isn't exhaustive and -+ * is only provided as a convenience to avoid clients having to use FourCC -+ * codes directly. However components are allowed to define and use their own -+ * FourCC codes. -+ */ -+/* @{ */ -+ -+/** Unknown color space */ -+#define MMAL_COLOR_SPACE_UNKNOWN 0 -+/** ITU-R BT.601-5 [SDTV] */ -+#define MMAL_COLOR_SPACE_ITUR_BT601 MMAL_FOURCC('Y', '6', '0', '1') -+/** ITU-R BT.709-3 [HDTV] */ -+#define MMAL_COLOR_SPACE_ITUR_BT709 MMAL_FOURCC('Y', '7', '0', '9') -+/** JPEG JFIF */ -+#define MMAL_COLOR_SPACE_JPEG_JFIF MMAL_FOURCC('Y', 'J', 'F', 'I') -+/** Title 47 Code of Federal Regulations (2003) 73.682 (a) (20) */ -+#define MMAL_COLOR_SPACE_FCC MMAL_FOURCC('Y', 'F', 'C', 'C') -+/** Society of Motion Picture and Television Engineers 240M (1999) */ -+#define MMAL_COLOR_SPACE_SMPTE240M MMAL_FOURCC('Y', '2', '4', '0') -+/** ITU-R BT.470-2 System M */ -+#define MMAL_COLOR_SPACE_BT470_2_M MMAL_FOURCC('Y', '_', '_', 'M') -+/** ITU-R BT.470-2 System BG */ -+#define MMAL_COLOR_SPACE_BT470_2_BG MMAL_FOURCC('Y', '_', 'B', 'G') -+/** JPEG JFIF, but with 16..255 luma */ -+#define MMAL_COLOR_SPACE_JFIF_Y16_255 MMAL_FOURCC('Y', 'Y', '1', '6') -+/* @} MmalColorSpace List */ -+ -+#endif /* MMAL_ENCODINGS_H */ -diff --git a/drivers/media/platform/bcm2835/mmal-msg-common.h b/drivers/media/platform/bcm2835/mmal-msg-common.h -new file mode 100644 -index 0000000000000000000000000000000000000000..66e8a6edf628565aeb487662b0b503c0c562ac8a ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg-common.h -@@ -0,0 +1,50 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#ifndef MMAL_MSG_COMMON_H -+#define MMAL_MSG_COMMON_H -+ -+enum mmal_msg_status { -+ MMAL_MSG_STATUS_SUCCESS = 0, /**< Success */ -+ MMAL_MSG_STATUS_ENOMEM, /**< Out of memory */ -+ MMAL_MSG_STATUS_ENOSPC, /**< Out of resources other than memory */ -+ MMAL_MSG_STATUS_EINVAL, /**< Argument is invalid */ -+ MMAL_MSG_STATUS_ENOSYS, /**< Function not implemented */ -+ MMAL_MSG_STATUS_ENOENT, /**< No such file or directory */ -+ MMAL_MSG_STATUS_ENXIO, /**< No such device or address */ -+ MMAL_MSG_STATUS_EIO, /**< I/O error */ -+ MMAL_MSG_STATUS_ESPIPE, /**< Illegal seek */ -+ MMAL_MSG_STATUS_ECORRUPT, /**< Data is corrupt \attention */ -+ MMAL_MSG_STATUS_ENOTREADY, /**< Component is not ready */ -+ MMAL_MSG_STATUS_ECONFIG, /**< Component is not configured */ -+ MMAL_MSG_STATUS_EISCONN, /**< Port is already connected */ -+ MMAL_MSG_STATUS_ENOTCONN, /**< Port is disconnected */ -+ MMAL_MSG_STATUS_EAGAIN, /**< Resource temporarily unavailable. */ -+ MMAL_MSG_STATUS_EFAULT, /**< Bad address */ -+}; -+ -+struct mmal_rect { -+ s32 x; /**< x coordinate (from left) */ -+ s32 y; /**< y coordinate (from top) */ -+ s32 width; /**< width */ -+ s32 height; /**< height */ -+}; -+ -+struct mmal_rational { -+ s32 num; /**< Numerator */ -+ s32 den; /**< Denominator */ -+}; -+ -+#endif /* MMAL_MSG_COMMON_H */ -diff --git a/drivers/media/platform/bcm2835/mmal-msg-format.h b/drivers/media/platform/bcm2835/mmal-msg-format.h -new file mode 100644 -index 0000000000000000000000000000000000000000..123d86ef582b0d059d1d5d14ba9add56b7365419 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg-format.h -@@ -0,0 +1,81 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+#ifndef MMAL_MSG_FORMAT_H -+#define MMAL_MSG_FORMAT_H -+ -+#include "mmal-msg-common.h" -+ -+/* MMAL_ES_FORMAT_T */ -+ -+ -+struct mmal_audio_format { -+ u32 channels; /**< Number of audio channels */ -+ u32 sample_rate; /**< Sample rate */ -+ -+ u32 bits_per_sample; /**< Bits per sample */ -+ u32 block_align; /**< Size of a block of data */ -+}; -+ -+struct mmal_video_format { -+ u32 width; /**< Width of frame in pixels */ -+ u32 height; /**< Height of frame in rows of pixels */ -+ struct mmal_rect crop; /**< Visible region of the frame */ -+ struct mmal_rational frame_rate; /**< Frame rate */ -+ struct mmal_rational par; /**< Pixel aspect ratio */ -+ -+ /* FourCC specifying the color space of the video stream. See the -+ * \ref MmalColorSpace "pre-defined color spaces" for some examples. -+ */ -+ u32 color_space; -+}; -+ -+struct mmal_subpicture_format { -+ u32 x_offset; -+ u32 y_offset; -+}; -+ -+union mmal_es_specific_format { -+ struct mmal_audio_format audio; -+ struct mmal_video_format video; -+ struct mmal_subpicture_format subpicture; -+}; -+ -+/** Definition of an elementary stream format (MMAL_ES_FORMAT_T) */ -+struct mmal_es_format { -+ u32 type; /* enum mmal_es_type */ -+ -+ u32 encoding; /* FourCC specifying encoding of the elementary stream.*/ -+ u32 encoding_variant; /* FourCC specifying the specific -+ * encoding variant of the elementary -+ * stream. -+ */ -+ -+ union mmal_es_specific_format *es; /* TODO: pointers in -+ * message serialisation?!? -+ */ -+ /* Type specific -+ * information for the -+ * elementary stream -+ */ -+ -+ u32 bitrate; /**< Bitrate in bits per second */ -+ u32 flags; /**< Flags describing properties of the elementary stream. */ -+ -+ u32 extradata_size; /**< Size of the codec specific data */ -+ u8 *extradata; /**< Codec specific data */ -+}; -+ -+#endif /* MMAL_MSG_FORMAT_H */ -diff --git a/drivers/media/platform/bcm2835/mmal-msg-port.h b/drivers/media/platform/bcm2835/mmal-msg-port.h -new file mode 100644 -index 0000000000000000000000000000000000000000..a55c1ea2eceb190689910a6a84370f126b1e9cbb ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg-port.h -@@ -0,0 +1,107 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+/* MMAL_PORT_TYPE_T */ -+enum mmal_port_type { -+ MMAL_PORT_TYPE_UNKNOWN = 0, /**< Unknown port type */ -+ MMAL_PORT_TYPE_CONTROL, /**< Control port */ -+ MMAL_PORT_TYPE_INPUT, /**< Input port */ -+ MMAL_PORT_TYPE_OUTPUT, /**< Output port */ -+ MMAL_PORT_TYPE_CLOCK, /**< Clock port */ -+}; -+ -+/** The port is pass-through and doesn't need buffer headers allocated */ -+#define MMAL_PORT_CAPABILITY_PASSTHROUGH 0x01 -+/** The port wants to allocate the buffer payloads. -+ * This signals a preference that payload allocation should be done -+ * on this port for efficiency reasons. */ -+#define MMAL_PORT_CAPABILITY_ALLOCATION 0x02 -+/** The port supports format change events. -+ * This applies to input ports and is used to let the client know -+ * whether the port supports being reconfigured via a format -+ * change event (i.e. without having to disable the port). */ -+#define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE 0x04 -+ -+/* mmal port structure (MMAL_PORT_T) -+ * -+ * most elements are informational only, the pointer values for -+ * interogation messages are generally provided as additional -+ * strucures within the message. When used to set values only teh -+ * buffer_num, buffer_size and userdata parameters are writable. -+ */ -+struct mmal_port { -+ void *priv; /* Private member used by the framework */ -+ const char *name; /* Port name. Used for debugging purposes (RO) */ -+ -+ u32 type; /* Type of the port (RO) enum mmal_port_type */ -+ u16 index; /* Index of the port in its type list (RO) */ -+ u16 index_all; /* Index of the port in the list of all ports (RO) */ -+ -+ u32 is_enabled; /* Indicates whether the port is enabled or not (RO) */ -+ struct mmal_es_format *format; /* Format of the elementary stream */ -+ -+ u32 buffer_num_min; /* Minimum number of buffers the port -+ * requires (RO). This is set by the -+ * component. -+ */ -+ -+ u32 buffer_size_min; /* Minimum size of buffers the port -+ * requires (RO). This is set by the -+ * component. -+ */ -+ -+ u32 buffer_alignment_min; /* Minimum alignment requirement for -+ * the buffers (RO). A value of -+ * zero means no special alignment -+ * requirements. This is set by the -+ * component. -+ */ -+ -+ u32 buffer_num_recommended; /* Number of buffers the port -+ * recommends for optimal -+ * performance (RO). A value of -+ * zero means no special -+ * recommendation. This is set -+ * by the component. -+ */ -+ -+ u32 buffer_size_recommended; /* Size of buffers the port -+ * recommends for optimal -+ * performance (RO). A value of -+ * zero means no special -+ * recommendation. This is set -+ * by the component. -+ */ -+ -+ u32 buffer_num; /* Actual number of buffers the port will use. -+ * This is set by the client. -+ */ -+ -+ u32 buffer_size; /* Actual maximum size of the buffers that -+ * will be sent to the port. This is set by -+ * the client. -+ */ -+ -+ void *component; /* Component this port belongs to (Read Only) */ -+ -+ void *userdata; /* Field reserved for use by the client */ -+ -+ u32 capabilities; /* Flags describing the capabilities of a -+ * port (RO). Bitwise combination of \ref -+ * portcapabilities "Port capabilities" -+ * values. -+ */ -+ -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-msg.h b/drivers/media/platform/bcm2835/mmal-msg.h -new file mode 100644 -index 0000000000000000000000000000000000000000..67b1076015a54646eb0a3b956afdc97e75d2a39c ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-msg.h -@@ -0,0 +1,404 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+/* all the data structures which serialise the MMAL protocol. note -+ * these are directly mapped onto the recived message data. -+ * -+ * BEWARE: They seem to *assume* pointers are u32 and that there is no -+ * structure padding! -+ * -+ * NOTE: this implementation uses kernel types to ensure sizes. Rather -+ * than assigning values to enums to force their size the -+ * implementation uses fixed size types and not the enums (though the -+ * comments have the actual enum type -+ */ -+ -+#define VC_MMAL_VER 15 -+#define VC_MMAL_MIN_VER 10 -+#define VC_MMAL_SERVER_NAME MAKE_FOURCC("mmal") -+ -+/* max total message size is 512 bytes */ -+#define MMAL_MSG_MAX_SIZE 512 -+/* with six 32bit header elements max payload is therefore 488 bytes */ -+#define MMAL_MSG_MAX_PAYLOAD 488 -+ -+#include "mmal-msg-common.h" -+#include "mmal-msg-format.h" -+#include "mmal-msg-port.h" -+ -+enum mmal_msg_type { -+ MMAL_MSG_TYPE_QUIT = 1, -+ MMAL_MSG_TYPE_SERVICE_CLOSED, -+ MMAL_MSG_TYPE_GET_VERSION, -+ MMAL_MSG_TYPE_COMPONENT_CREATE, -+ MMAL_MSG_TYPE_COMPONENT_DESTROY, /* 5 */ -+ MMAL_MSG_TYPE_COMPONENT_ENABLE, -+ MMAL_MSG_TYPE_COMPONENT_DISABLE, -+ MMAL_MSG_TYPE_PORT_INFO_GET, -+ MMAL_MSG_TYPE_PORT_INFO_SET, -+ MMAL_MSG_TYPE_PORT_ACTION, /* 10 */ -+ MMAL_MSG_TYPE_BUFFER_FROM_HOST, -+ MMAL_MSG_TYPE_BUFFER_TO_HOST, -+ MMAL_MSG_TYPE_GET_STATS, -+ MMAL_MSG_TYPE_PORT_PARAMETER_SET, -+ MMAL_MSG_TYPE_PORT_PARAMETER_GET, /* 15 */ -+ MMAL_MSG_TYPE_EVENT_TO_HOST, -+ MMAL_MSG_TYPE_GET_CORE_STATS_FOR_PORT, -+ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR, -+ MMAL_MSG_TYPE_CONSUME_MEM, -+ MMAL_MSG_TYPE_LMK, /* 20 */ -+ MMAL_MSG_TYPE_OPAQUE_ALLOCATOR_DESC, -+ MMAL_MSG_TYPE_DRM_GET_LHS32, -+ MMAL_MSG_TYPE_DRM_GET_TIME, -+ MMAL_MSG_TYPE_BUFFER_FROM_HOST_ZEROLEN, -+ MMAL_MSG_TYPE_PORT_FLUSH, /* 25 */ -+ MMAL_MSG_TYPE_HOST_LOG, -+ MMAL_MSG_TYPE_MSG_LAST -+}; -+ -+/* port action request messages differ depending on the action type */ -+enum mmal_msg_port_action_type { -+ MMAL_MSG_PORT_ACTION_TYPE_UNKNOWN = 0, /* Unkown action */ -+ MMAL_MSG_PORT_ACTION_TYPE_ENABLE, /* Enable a port */ -+ MMAL_MSG_PORT_ACTION_TYPE_DISABLE, /* Disable a port */ -+ MMAL_MSG_PORT_ACTION_TYPE_FLUSH, /* Flush a port */ -+ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, /* Connect ports */ -+ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, /* Disconnect ports */ -+ MMAL_MSG_PORT_ACTION_TYPE_SET_REQUIREMENTS, /* Set buffer requirements*/ -+}; -+ -+struct mmal_msg_header { -+ u32 magic; -+ u32 type; /** enum mmal_msg_type */ -+ -+ /* Opaque handle to the control service */ -+ struct mmal_control_service *control_service; -+ -+ struct mmal_msg_context *context; /** a u32 per message context */ -+ u32 status; /** The status of the vchiq operation */ -+ u32 padding; -+}; -+ -+/* Send from VC to host to report version */ -+struct mmal_msg_version { -+ u32 flags; -+ u32 major; -+ u32 minor; -+ u32 minimum; -+}; -+ -+/* request to VC to create component */ -+struct mmal_msg_component_create { -+ void *client_component; /* component context */ -+ char name[128]; -+ u32 pid; /* For debug */ -+}; -+ -+/* reply from VC to component creation request */ -+struct mmal_msg_component_create_reply { -+ u32 status; /** enum mmal_msg_status - how does this differ to -+ * the one in the header? -+ */ -+ u32 component_handle; /* VideoCore handle for component */ -+ u32 input_num; /* Number of input ports */ -+ u32 output_num; /* Number of output ports */ -+ u32 clock_num; /* Number of clock ports */ -+}; -+ -+/* request to VC to destroy a component */ -+struct mmal_msg_component_destroy { -+ u32 component_handle; -+}; -+ -+struct mmal_msg_component_destroy_reply { -+ u32 status; /** The component destruction status */ -+}; -+ -+ -+/* request and reply to VC to enable a component */ -+struct mmal_msg_component_enable { -+ u32 component_handle; -+}; -+ -+struct mmal_msg_component_enable_reply { -+ u32 status; /** The component enable status */ -+}; -+ -+ -+/* request and reply to VC to disable a component */ -+struct mmal_msg_component_disable { -+ u32 component_handle; -+}; -+ -+struct mmal_msg_component_disable_reply { -+ u32 status; /** The component disable status */ -+}; -+ -+/* request to VC to get port information */ -+struct mmal_msg_port_info_get { -+ u32 component_handle; /* component handle port is associated with */ -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 index; /* port index to query */ -+}; -+ -+/* reply from VC to get port info request */ -+struct mmal_msg_port_info_get_reply { -+ u32 status; /** enum mmal_msg_status */ -+ u32 component_handle; /* component handle port is associated with */ -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 port_index; /* port indexed in query */ -+ s32 found; /* unused */ -+ u32 port_handle; /**< Handle to use for this port */ -+ struct mmal_port port; -+ struct mmal_es_format format; /* elementry stream format */ -+ union mmal_es_specific_format es; /* es type specific data */ -+ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; /* es extra data */ -+}; -+ -+/* request to VC to set port information */ -+struct mmal_msg_port_info_set { -+ u32 component_handle; -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 port_index; /* port indexed in query */ -+ struct mmal_port port; -+ struct mmal_es_format format; -+ union mmal_es_specific_format es; -+ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; -+}; -+ -+/* reply from VC to port info set request */ -+struct mmal_msg_port_info_set_reply { -+ u32 status; -+ u32 component_handle; /* component handle port is associated with */ -+ u32 port_type; /* enum mmal_msg_port_type */ -+ u32 index; /* port indexed in query */ -+ s32 found; /* unused */ -+ u32 port_handle; /**< Handle to use for this port */ -+ struct mmal_port port; -+ struct mmal_es_format format; -+ union mmal_es_specific_format es; -+ u8 extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE]; -+}; -+ -+ -+/* port action requests that take a mmal_port as a parameter */ -+struct mmal_msg_port_action_port { -+ u32 component_handle; -+ u32 port_handle; -+ u32 action; /* enum mmal_msg_port_action_type */ -+ struct mmal_port port; -+}; -+ -+/* port action requests that take handles as a parameter */ -+struct mmal_msg_port_action_handle { -+ u32 component_handle; -+ u32 port_handle; -+ u32 action; /* enum mmal_msg_port_action_type */ -+ u32 connect_component_handle; -+ u32 connect_port_handle; -+}; -+ -+struct mmal_msg_port_action_reply { -+ u32 status; /** The port action operation status */ -+}; -+ -+ -+ -+ -+/* MMAL buffer transfer */ -+ -+/** Size of space reserved in a buffer message for short messages. */ -+#define MMAL_VC_SHORT_DATA 128 -+ -+/** Signals that the current payload is the end of the stream of data */ -+#define MMAL_BUFFER_HEADER_FLAG_EOS (1<<0) -+/** Signals that the start of the current payload starts a frame */ -+#define MMAL_BUFFER_HEADER_FLAG_FRAME_START (1<<1) -+/** Signals that the end of the current payload ends a frame */ -+#define MMAL_BUFFER_HEADER_FLAG_FRAME_END (1<<2) -+/** Signals that the current payload contains only complete frames (>1) */ -+#define MMAL_BUFFER_HEADER_FLAG_FRAME \ -+ (MMAL_BUFFER_HEADER_FLAG_FRAME_START|MMAL_BUFFER_HEADER_FLAG_FRAME_END) -+/** Signals that the current payload is a keyframe (i.e. self decodable) */ -+#define MMAL_BUFFER_HEADER_FLAG_KEYFRAME (1<<3) -+/** Signals a discontinuity in the stream of data (e.g. after a seek). -+ * Can be used for instance by a decoder to reset its state */ -+#define MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY (1<<4) -+/** Signals a buffer containing some kind of config data for the component -+ * (e.g. codec config data) */ -+#define MMAL_BUFFER_HEADER_FLAG_CONFIG (1<<5) -+/** Signals an encrypted payload */ -+#define MMAL_BUFFER_HEADER_FLAG_ENCRYPTED (1<<6) -+/** Signals a buffer containing side information */ -+#define MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO (1<<7) -+/** Signals a buffer which is the snapshot/postview image from a stills -+ * capture -+ */ -+#define MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT (1<<8) -+/** Signals a buffer which contains data known to be corrupted */ -+#define MMAL_BUFFER_HEADER_FLAG_CORRUPTED (1<<9) -+/** Signals that a buffer failed to be transmitted */ -+#define MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED (1<<10) -+ -+struct mmal_driver_buffer { -+ u32 magic; -+ u32 component_handle; -+ u32 port_handle; -+ void *client_context; -+}; -+ -+/* buffer header */ -+struct mmal_buffer_header { -+ struct mmal_buffer_header *next; /* next header */ -+ void *priv; /* framework private data */ -+ u32 cmd; -+ void *data; -+ u32 alloc_size; -+ u32 length; -+ u32 offset; -+ u32 flags; -+ s64 pts; -+ s64 dts; -+ void *type; -+ void *user_data; -+}; -+ -+struct mmal_buffer_header_type_specific { -+ union { -+ struct { -+ u32 planes; -+ u32 offset[4]; -+ u32 pitch[4]; -+ u32 flags; -+ } video; -+ } u; -+}; -+ -+struct mmal_msg_buffer_from_host { -+ /* The front 32 bytes of the buffer header are copied -+ * back to us in the reply to allow for context. This -+ * area is used to store two mmal_driver_buffer structures to -+ * allow for multiple concurrent service users. -+ */ -+ /* control data */ -+ struct mmal_driver_buffer drvbuf; -+ -+ /* referenced control data for passthrough buffer management */ -+ struct mmal_driver_buffer drvbuf_ref; -+ struct mmal_buffer_header buffer_header; /* buffer header itself */ -+ struct mmal_buffer_header_type_specific buffer_header_type_specific; -+ s32 is_zero_copy; -+ s32 has_reference; -+ -+ /** allows short data to be xfered in control message */ -+ u32 payload_in_message; -+ u8 short_data[MMAL_VC_SHORT_DATA]; -+}; -+ -+ -+/* port parameter setting */ -+ -+#define MMAL_WORKER_PORT_PARAMETER_SPACE 96 -+ -+struct mmal_msg_port_parameter_set { -+ u32 component_handle; /* component */ -+ u32 port_handle; /* port */ -+ u32 id; /* Parameter ID */ -+ u32 size; /* Parameter size */ -+ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; -+}; -+ -+struct mmal_msg_port_parameter_set_reply { -+ u32 status; /** enum mmal_msg_status todo: how does this -+ * differ to the one in the header? -+ */ -+}; -+ -+/* port parameter getting */ -+ -+struct mmal_msg_port_parameter_get { -+ u32 component_handle; /* component */ -+ u32 port_handle; /* port */ -+ u32 id; /* Parameter ID */ -+ u32 size; /* Parameter size */ -+}; -+ -+struct mmal_msg_port_parameter_get_reply { -+ u32 status; /* Status of mmal_port_parameter_get call */ -+ u32 id; /* Parameter ID */ -+ u32 size; /* Parameter size */ -+ uint32_t value[MMAL_WORKER_PORT_PARAMETER_SPACE]; -+}; -+ -+/* event messages */ -+#define MMAL_WORKER_EVENT_SPACE 256 -+ -+struct mmal_msg_event_to_host { -+ void *client_component; /* component context */ -+ -+ u32 port_type; -+ u32 port_num; -+ -+ u32 cmd; -+ u32 length; -+ u8 data[MMAL_WORKER_EVENT_SPACE]; -+ struct mmal_buffer_header *delayed_buffer; -+}; -+ -+/* all mmal messages are serialised through this structure */ -+struct mmal_msg { -+ /* header */ -+ struct mmal_msg_header h; -+ /* payload */ -+ union { -+ struct mmal_msg_version version; -+ -+ struct mmal_msg_component_create component_create; -+ struct mmal_msg_component_create_reply component_create_reply; -+ -+ struct mmal_msg_component_destroy component_destroy; -+ struct mmal_msg_component_destroy_reply component_destroy_reply; -+ -+ struct mmal_msg_component_enable component_enable; -+ struct mmal_msg_component_enable_reply component_enable_reply; -+ -+ struct mmal_msg_component_disable component_disable; -+ struct mmal_msg_component_disable_reply component_disable_reply; -+ -+ struct mmal_msg_port_info_get port_info_get; -+ struct mmal_msg_port_info_get_reply port_info_get_reply; -+ -+ struct mmal_msg_port_info_set port_info_set; -+ struct mmal_msg_port_info_set_reply port_info_set_reply; -+ -+ struct mmal_msg_port_action_port port_action_port; -+ struct mmal_msg_port_action_handle port_action_handle; -+ struct mmal_msg_port_action_reply port_action_reply; -+ -+ struct mmal_msg_buffer_from_host buffer_from_host; -+ -+ struct mmal_msg_port_parameter_set port_parameter_set; -+ struct mmal_msg_port_parameter_set_reply -+ port_parameter_set_reply; -+ struct mmal_msg_port_parameter_get -+ port_parameter_get; -+ struct mmal_msg_port_parameter_get_reply -+ port_parameter_get_reply; -+ -+ struct mmal_msg_event_to_host event_to_host; -+ -+ u8 payload[MMAL_MSG_MAX_PAYLOAD]; -+ } u; -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-parameters.h b/drivers/media/platform/bcm2835/mmal-parameters.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f6abb5cfa49d58277fddfb40b7ad329518bd397f ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-parameters.h -@@ -0,0 +1,689 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ */ -+ -+/* common parameters */ -+ -+/** @name Parameter groups -+ * Parameters are divided into groups, and then allocated sequentially within -+ * a group using an enum. -+ * @{ -+ */ -+ -+/** Common parameter ID group, used with many types of component. */ -+#define MMAL_PARAMETER_GROUP_COMMON (0<<16) -+/** Camera-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_CAMERA (1<<16) -+/** Video-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_VIDEO (2<<16) -+/** Audio-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_AUDIO (3<<16) -+/** Clock-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_CLOCK (4<<16) -+/** Miracast-specific parameter ID group. */ -+#define MMAL_PARAMETER_GROUP_MIRACAST (5<<16) -+ -+/* Common parameters */ -+enum mmal_parameter_common_type { -+ MMAL_PARAMETER_UNUSED /**< Never a valid parameter ID */ -+ = MMAL_PARAMETER_GROUP_COMMON, -+ MMAL_PARAMETER_SUPPORTED_ENCODINGS, /**< MMAL_PARAMETER_ENCODING_T */ -+ MMAL_PARAMETER_URI, /**< MMAL_PARAMETER_URI_T */ -+ -+ /** MMAL_PARAMETER_CHANGE_EVENT_REQUEST_T */ -+ MMAL_PARAMETER_CHANGE_EVENT_REQUEST, -+ -+ /** MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_ZERO_COPY, -+ -+ /**< MMAL_PARAMETER_BUFFER_REQUIREMENTS_T */ -+ MMAL_PARAMETER_BUFFER_REQUIREMENTS, -+ -+ MMAL_PARAMETER_STATISTICS, /**< MMAL_PARAMETER_STATISTICS_T */ -+ MMAL_PARAMETER_CORE_STATISTICS, /**< MMAL_PARAMETER_CORE_STATISTICS_T */ -+ MMAL_PARAMETER_MEM_USAGE, /**< MMAL_PARAMETER_MEM_USAGE_T */ -+ MMAL_PARAMETER_BUFFER_FLAG_FILTER, /**< MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_SEEK, /**< MMAL_PARAMETER_SEEK_T */ -+ MMAL_PARAMETER_POWERMON_ENABLE, /**< MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_LOGGING, /**< MMAL_PARAMETER_LOGGING_T */ -+ MMAL_PARAMETER_SYSTEM_TIME, /**< MMAL_PARAMETER_UINT64_T */ -+ MMAL_PARAMETER_NO_IMAGE_PADDING /**< MMAL_PARAMETER_BOOLEAN_T */ -+}; -+ -+/* camera parameters */ -+ -+enum mmal_parameter_camera_type { -+ /* 0 */ -+ /** @ref MMAL_PARAMETER_THUMBNAIL_CONFIG_T */ -+ MMAL_PARAMETER_THUMBNAIL_CONFIGURATION -+ = MMAL_PARAMETER_GROUP_CAMERA, -+ MMAL_PARAMETER_CAPTURE_QUALITY, /**< Unused? */ -+ MMAL_PARAMETER_ROTATION, /**< @ref MMAL_PARAMETER_INT32_T */ -+ MMAL_PARAMETER_EXIF_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_EXIF, /**< @ref MMAL_PARAMETER_EXIF_T */ -+ MMAL_PARAMETER_AWB_MODE, /**< @ref MMAL_PARAM_AWBMODE_T */ -+ MMAL_PARAMETER_IMAGE_EFFECT, /**< @ref MMAL_PARAMETER_IMAGEFX_T */ -+ MMAL_PARAMETER_COLOUR_EFFECT, /**< @ref MMAL_PARAMETER_COLOURFX_T */ -+ MMAL_PARAMETER_FLICKER_AVOID, /**< @ref MMAL_PARAMETER_FLICKERAVOID_T */ -+ MMAL_PARAMETER_FLASH, /**< @ref MMAL_PARAMETER_FLASH_T */ -+ MMAL_PARAMETER_REDEYE, /**< @ref MMAL_PARAMETER_REDEYE_T */ -+ MMAL_PARAMETER_FOCUS, /**< @ref MMAL_PARAMETER_FOCUS_T */ -+ MMAL_PARAMETER_FOCAL_LENGTHS, /**< Unused? */ -+ MMAL_PARAMETER_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ -+ MMAL_PARAMETER_ZOOM, /**< @ref MMAL_PARAMETER_SCALEFACTOR_T */ -+ MMAL_PARAMETER_MIRROR, /**< @ref MMAL_PARAMETER_MIRROR_T */ -+ -+ /* 0x10 */ -+ MMAL_PARAMETER_CAMERA_NUM, /**< @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_EXPOSURE_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMODE_T */ -+ MMAL_PARAMETER_EXP_METERING_MODE, /**< @ref MMAL_PARAMETER_EXPOSUREMETERINGMODE_T */ -+ MMAL_PARAMETER_FOCUS_STATUS, /**< @ref MMAL_PARAMETER_FOCUS_STATUS_T */ -+ MMAL_PARAMETER_CAMERA_CONFIG, /**< @ref MMAL_PARAMETER_CAMERA_CONFIG_T */ -+ MMAL_PARAMETER_CAPTURE_STATUS, /**< @ref MMAL_PARAMETER_CAPTURE_STATUS_T */ -+ MMAL_PARAMETER_FACE_TRACK, /**< @ref MMAL_PARAMETER_FACE_TRACK_T */ -+ MMAL_PARAMETER_DRAW_BOX_FACES_AND_FOCUS, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_JPEG_Q_FACTOR, /**< @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_FRAME_RATE, /**< @ref MMAL_PARAMETER_FRAME_RATE_T */ -+ MMAL_PARAMETER_USE_STC, /**< @ref MMAL_PARAMETER_CAMERA_STC_MODE_T */ -+ MMAL_PARAMETER_CAMERA_INFO, /**< @ref MMAL_PARAMETER_CAMERA_INFO_T */ -+ MMAL_PARAMETER_VIDEO_STABILISATION, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_FACE_TRACK_RESULTS, /**< @ref MMAL_PARAMETER_FACE_TRACK_RESULTS_T */ -+ MMAL_PARAMETER_ENABLE_RAW_CAPTURE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ -+ /* 0x20 */ -+ MMAL_PARAMETER_DPF_FILE, /**< @ref MMAL_PARAMETER_URI_T */ -+ MMAL_PARAMETER_ENABLE_DPF_FILE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_DPF_FAIL_IS_FATAL, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_CAPTURE_MODE, /**< @ref MMAL_PARAMETER_CAPTUREMODE_T */ -+ MMAL_PARAMETER_FOCUS_REGIONS, /**< @ref MMAL_PARAMETER_FOCUS_REGIONS_T */ -+ MMAL_PARAMETER_INPUT_CROP, /**< @ref MMAL_PARAMETER_INPUT_CROP_T */ -+ MMAL_PARAMETER_SENSOR_INFORMATION, /**< @ref MMAL_PARAMETER_SENSOR_INFORMATION_T */ -+ MMAL_PARAMETER_FLASH_SELECT, /**< @ref MMAL_PARAMETER_FLASH_SELECT_T */ -+ MMAL_PARAMETER_FIELD_OF_VIEW, /**< @ref MMAL_PARAMETER_FIELD_OF_VIEW_T */ -+ MMAL_PARAMETER_HIGH_DYNAMIC_RANGE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_DYNAMIC_RANGE_COMPRESSION, /**< @ref MMAL_PARAMETER_DRC_T */ -+ MMAL_PARAMETER_ALGORITHM_CONTROL, /**< @ref MMAL_PARAMETER_ALGORITHM_CONTROL_T */ -+ MMAL_PARAMETER_SHARPNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ MMAL_PARAMETER_CONTRAST, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ MMAL_PARAMETER_BRIGHTNESS, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ MMAL_PARAMETER_SATURATION, /**< @ref MMAL_PARAMETER_RATIONAL_T */ -+ -+ /* 0x30 */ -+ MMAL_PARAMETER_ISO, /**< @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_ANTISHAKE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ -+ /** @ref MMAL_PARAMETER_IMAGEFX_PARAMETERS_T */ -+ MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_CAMERA_BURST_CAPTURE, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CAMERA_MIN_ISO, -+ -+ /** @ref MMAL_PARAMETER_CAMERA_USE_CASE_T */ -+ MMAL_PARAMETER_CAMERA_USE_CASE, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_CAPTURE_STATS_PASS, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CAMERA_CUSTOM_SENSOR_CONFIG, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_ENABLE_REGISTER_FILE, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_REGISTER_FAIL_IS_FATAL, -+ -+ /** @ref MMAL_PARAMETER_CONFIGFILE_T */ -+ MMAL_PARAMETER_CONFIGFILE_REGISTERS, -+ -+ /** @ref MMAL_PARAMETER_CONFIGFILE_CHUNK_T */ -+ MMAL_PARAMETER_CONFIGFILE_CHUNK_REGISTERS, -+ MMAL_PARAMETER_JPEG_ATTACH_LOG, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_ZERO_SHUTTER_LAG, /**< @ref MMAL_PARAMETER_ZEROSHUTTERLAG_T */ -+ MMAL_PARAMETER_FPS_RANGE, /**< @ref MMAL_PARAMETER_FPS_RANGE_T */ -+ MMAL_PARAMETER_CAPTURE_EXPOSURE_COMP, /**< @ref MMAL_PARAMETER_INT32_T */ -+ -+ /* 0x40 */ -+ MMAL_PARAMETER_SW_SHARPEN_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_FLASH_REQUIRED, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_SW_SATURATION_DISABLE, /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_SHUTTER_SPEED, /**< Takes a @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_CUSTOM_AWB_GAINS, /**< Takes a @ref MMAL_PARAMETER_AWB_GAINS_T */ -+}; -+ -+struct mmal_parameter_rational { -+ s32 num; /**< Numerator */ -+ s32 den; /**< Denominator */ -+}; -+ -+enum mmal_parameter_camera_config_timestamp_mode { -+ MMAL_PARAM_TIMESTAMP_MODE_ZERO = 0, /* Always timestamp frames as 0 */ -+ MMAL_PARAM_TIMESTAMP_MODE_RAW_STC, /* Use the raw STC value -+ * for the frame timestamp -+ */ -+ MMAL_PARAM_TIMESTAMP_MODE_RESET_STC, /* Use the STC timestamp -+ * but subtract the -+ * timestamp of the first -+ * frame sent to give a -+ * zero based timestamp. -+ */ -+}; -+ -+struct mmal_parameter_fps_range { -+ /**< Low end of the permitted framerate range */ -+ struct mmal_parameter_rational fps_low; -+ /**< High end of the permitted framerate range */ -+ struct mmal_parameter_rational fps_high; -+}; -+ -+ -+/* camera configuration parameter */ -+struct mmal_parameter_camera_config { -+ /* Parameters for setting up the image pools */ -+ u32 max_stills_w; /* Max size of stills capture */ -+ u32 max_stills_h; -+ u32 stills_yuv422; /* Allow YUV422 stills capture */ -+ u32 one_shot_stills; /* Continuous or one shot stills captures. */ -+ -+ u32 max_preview_video_w; /* Max size of the preview or video -+ * capture frames -+ */ -+ u32 max_preview_video_h; -+ u32 num_preview_video_frames; -+ -+ /** Sets the height of the circular buffer for stills capture. */ -+ u32 stills_capture_circular_buffer_height; -+ -+ /** Allows preview/encode to resume as fast as possible after the stills -+ * input frame has been received, and then processes the still frame in -+ * the background whilst preview/encode has resumed. -+ * Actual mode is controlled by MMAL_PARAMETER_CAPTURE_MODE. -+ */ -+ u32 fast_preview_resume; -+ -+ /** Selects algorithm for timestamping frames if -+ * there is no clock component connected. -+ * enum mmal_parameter_camera_config_timestamp_mode -+ */ -+ s32 use_stc_timestamp; -+}; -+ -+ -+enum mmal_parameter_exposuremode { -+ MMAL_PARAM_EXPOSUREMODE_OFF, -+ MMAL_PARAM_EXPOSUREMODE_AUTO, -+ MMAL_PARAM_EXPOSUREMODE_NIGHT, -+ MMAL_PARAM_EXPOSUREMODE_NIGHTPREVIEW, -+ MMAL_PARAM_EXPOSUREMODE_BACKLIGHT, -+ MMAL_PARAM_EXPOSUREMODE_SPOTLIGHT, -+ MMAL_PARAM_EXPOSUREMODE_SPORTS, -+ MMAL_PARAM_EXPOSUREMODE_SNOW, -+ MMAL_PARAM_EXPOSUREMODE_BEACH, -+ MMAL_PARAM_EXPOSUREMODE_VERYLONG, -+ MMAL_PARAM_EXPOSUREMODE_FIXEDFPS, -+ MMAL_PARAM_EXPOSUREMODE_ANTISHAKE, -+ MMAL_PARAM_EXPOSUREMODE_FIREWORKS, -+}; -+ -+enum mmal_parameter_exposuremeteringmode { -+ MMAL_PARAM_EXPOSUREMETERINGMODE_AVERAGE, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_SPOT, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_BACKLIT, -+ MMAL_PARAM_EXPOSUREMETERINGMODE_MATRIX, -+}; -+ -+enum mmal_parameter_awbmode { -+ MMAL_PARAM_AWBMODE_OFF, -+ MMAL_PARAM_AWBMODE_AUTO, -+ MMAL_PARAM_AWBMODE_SUNLIGHT, -+ MMAL_PARAM_AWBMODE_CLOUDY, -+ MMAL_PARAM_AWBMODE_SHADE, -+ MMAL_PARAM_AWBMODE_TUNGSTEN, -+ MMAL_PARAM_AWBMODE_FLUORESCENT, -+ MMAL_PARAM_AWBMODE_INCANDESCENT, -+ MMAL_PARAM_AWBMODE_FLASH, -+ MMAL_PARAM_AWBMODE_HORIZON, -+}; -+ -+enum mmal_parameter_imagefx { -+ MMAL_PARAM_IMAGEFX_NONE, -+ MMAL_PARAM_IMAGEFX_NEGATIVE, -+ MMAL_PARAM_IMAGEFX_SOLARIZE, -+ MMAL_PARAM_IMAGEFX_POSTERIZE, -+ MMAL_PARAM_IMAGEFX_WHITEBOARD, -+ MMAL_PARAM_IMAGEFX_BLACKBOARD, -+ MMAL_PARAM_IMAGEFX_SKETCH, -+ MMAL_PARAM_IMAGEFX_DENOISE, -+ MMAL_PARAM_IMAGEFX_EMBOSS, -+ MMAL_PARAM_IMAGEFX_OILPAINT, -+ MMAL_PARAM_IMAGEFX_HATCH, -+ MMAL_PARAM_IMAGEFX_GPEN, -+ MMAL_PARAM_IMAGEFX_PASTEL, -+ MMAL_PARAM_IMAGEFX_WATERCOLOUR, -+ MMAL_PARAM_IMAGEFX_FILM, -+ MMAL_PARAM_IMAGEFX_BLUR, -+ MMAL_PARAM_IMAGEFX_SATURATION, -+ MMAL_PARAM_IMAGEFX_COLOURSWAP, -+ MMAL_PARAM_IMAGEFX_WASHEDOUT, -+ MMAL_PARAM_IMAGEFX_POSTERISE, -+ MMAL_PARAM_IMAGEFX_COLOURPOINT, -+ MMAL_PARAM_IMAGEFX_COLOURBALANCE, -+ MMAL_PARAM_IMAGEFX_CARTOON, -+}; -+ -+enum MMAL_PARAM_FLICKERAVOID_T { -+ MMAL_PARAM_FLICKERAVOID_OFF, -+ MMAL_PARAM_FLICKERAVOID_AUTO, -+ MMAL_PARAM_FLICKERAVOID_50HZ, -+ MMAL_PARAM_FLICKERAVOID_60HZ, -+ MMAL_PARAM_FLICKERAVOID_MAX = 0x7FFFFFFF -+}; -+ -+struct mmal_parameter_awbgains { -+ struct mmal_parameter_rational r_gain; /**< Red gain */ -+ struct mmal_parameter_rational b_gain; /**< Blue gain */ -+}; -+ -+/** Manner of video rate control */ -+enum mmal_parameter_rate_control_mode { -+ MMAL_VIDEO_RATECONTROL_DEFAULT, -+ MMAL_VIDEO_RATECONTROL_VARIABLE, -+ MMAL_VIDEO_RATECONTROL_CONSTANT, -+ MMAL_VIDEO_RATECONTROL_VARIABLE_SKIP_FRAMES, -+ MMAL_VIDEO_RATECONTROL_CONSTANT_SKIP_FRAMES -+}; -+ -+enum mmal_video_profile { -+ MMAL_VIDEO_PROFILE_H263_BASELINE, -+ MMAL_VIDEO_PROFILE_H263_H320CODING, -+ MMAL_VIDEO_PROFILE_H263_BACKWARDCOMPATIBLE, -+ MMAL_VIDEO_PROFILE_H263_ISWV2, -+ MMAL_VIDEO_PROFILE_H263_ISWV3, -+ MMAL_VIDEO_PROFILE_H263_HIGHCOMPRESSION, -+ MMAL_VIDEO_PROFILE_H263_INTERNET, -+ MMAL_VIDEO_PROFILE_H263_INTERLACE, -+ MMAL_VIDEO_PROFILE_H263_HIGHLATENCY, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLE, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLESCALABLE, -+ MMAL_VIDEO_PROFILE_MP4V_CORE, -+ MMAL_VIDEO_PROFILE_MP4V_MAIN, -+ MMAL_VIDEO_PROFILE_MP4V_NBIT, -+ MMAL_VIDEO_PROFILE_MP4V_SCALABLETEXTURE, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFACE, -+ MMAL_VIDEO_PROFILE_MP4V_SIMPLEFBA, -+ MMAL_VIDEO_PROFILE_MP4V_BASICANIMATED, -+ MMAL_VIDEO_PROFILE_MP4V_HYBRID, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDREALTIME, -+ MMAL_VIDEO_PROFILE_MP4V_CORESCALABLE, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCODING, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDCORE, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSCALABLE, -+ MMAL_VIDEO_PROFILE_MP4V_ADVANCEDSIMPLE, -+ MMAL_VIDEO_PROFILE_H264_BASELINE, -+ MMAL_VIDEO_PROFILE_H264_MAIN, -+ MMAL_VIDEO_PROFILE_H264_EXTENDED, -+ MMAL_VIDEO_PROFILE_H264_HIGH, -+ MMAL_VIDEO_PROFILE_H264_HIGH10, -+ MMAL_VIDEO_PROFILE_H264_HIGH422, -+ MMAL_VIDEO_PROFILE_H264_HIGH444, -+ MMAL_VIDEO_PROFILE_H264_CONSTRAINED_BASELINE, -+ MMAL_VIDEO_PROFILE_DUMMY = 0x7FFFFFFF -+}; -+ -+enum mmal_video_level { -+ MMAL_VIDEO_LEVEL_H263_10, -+ MMAL_VIDEO_LEVEL_H263_20, -+ MMAL_VIDEO_LEVEL_H263_30, -+ MMAL_VIDEO_LEVEL_H263_40, -+ MMAL_VIDEO_LEVEL_H263_45, -+ MMAL_VIDEO_LEVEL_H263_50, -+ MMAL_VIDEO_LEVEL_H263_60, -+ MMAL_VIDEO_LEVEL_H263_70, -+ MMAL_VIDEO_LEVEL_MP4V_0, -+ MMAL_VIDEO_LEVEL_MP4V_0b, -+ MMAL_VIDEO_LEVEL_MP4V_1, -+ MMAL_VIDEO_LEVEL_MP4V_2, -+ MMAL_VIDEO_LEVEL_MP4V_3, -+ MMAL_VIDEO_LEVEL_MP4V_4, -+ MMAL_VIDEO_LEVEL_MP4V_4a, -+ MMAL_VIDEO_LEVEL_MP4V_5, -+ MMAL_VIDEO_LEVEL_MP4V_6, -+ MMAL_VIDEO_LEVEL_H264_1, -+ MMAL_VIDEO_LEVEL_H264_1b, -+ MMAL_VIDEO_LEVEL_H264_11, -+ MMAL_VIDEO_LEVEL_H264_12, -+ MMAL_VIDEO_LEVEL_H264_13, -+ MMAL_VIDEO_LEVEL_H264_2, -+ MMAL_VIDEO_LEVEL_H264_21, -+ MMAL_VIDEO_LEVEL_H264_22, -+ MMAL_VIDEO_LEVEL_H264_3, -+ MMAL_VIDEO_LEVEL_H264_31, -+ MMAL_VIDEO_LEVEL_H264_32, -+ MMAL_VIDEO_LEVEL_H264_4, -+ MMAL_VIDEO_LEVEL_H264_41, -+ MMAL_VIDEO_LEVEL_H264_42, -+ MMAL_VIDEO_LEVEL_H264_5, -+ MMAL_VIDEO_LEVEL_H264_51, -+ MMAL_VIDEO_LEVEL_DUMMY = 0x7FFFFFFF -+}; -+ -+struct mmal_parameter_video_profile { -+ enum mmal_video_profile profile; -+ enum mmal_video_level level; -+}; -+ -+/* video parameters */ -+ -+enum mmal_parameter_video_type { -+ /** @ref MMAL_DISPLAYREGION_T */ -+ MMAL_PARAMETER_DISPLAYREGION = MMAL_PARAMETER_GROUP_VIDEO, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ -+ MMAL_PARAMETER_SUPPORTED_PROFILES, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_PROFILE_T */ -+ MMAL_PARAMETER_PROFILE, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_INTRAPERIOD, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_RATECONTROL_T */ -+ MMAL_PARAMETER_RATECONTROL, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_NALUNITFORMAT_T */ -+ MMAL_PARAMETER_NALUNITFORMAT, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_MINIMISE_FRAGMENTATION, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. -+ * Setting the value to zero resets to the default (one slice per frame). -+ */ -+ MMAL_PARAMETER_MB_ROWS_PER_SLICE, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION_T */ -+ MMAL_PARAMETER_VIDEO_LEVEL_EXTENSION, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_EEDE_ENABLE_T */ -+ MMAL_PARAMETER_VIDEO_EEDE_ENABLE, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE_T */ -+ MMAL_PARAMETER_VIDEO_EEDE_LOSSRATE, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. Request an I-frame. */ -+ MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME, -+ /** @ref MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T */ -+ MMAL_PARAMETER_VIDEO_INTRA_REFRESH, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. Run-time bit rate control */ -+ MMAL_PARAMETER_VIDEO_BIT_RATE, -+ -+ /** @ref MMAL_PARAMETER_FRAME_RATE_T */ -+ MMAL_PARAMETER_VIDEO_FRAME_RATE, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_MIN_QUANT, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_MAX_QUANT, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_RC_MODEL, -+ -+ MMAL_PARAMETER_EXTRA_BUFFERS, /**< @ref MMAL_PARAMETER_UINT32_T. */ -+ /** @ref MMAL_PARAMETER_UINT32_T. -+ * Changing this parameter from the default can reduce frame rate -+ * because image buffers need to be re-pitched. -+ */ -+ MMAL_PARAMETER_VIDEO_ALIGN_HORIZ, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. -+ * Changing this parameter from the default can reduce frame rate -+ * because image buffers need to be re-pitched. -+ */ -+ MMAL_PARAMETER_VIDEO_ALIGN_VERT, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_DROPPABLE_PFRAMES, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_INITIAL_QUANT, -+ -+ /**< @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_QP_P, -+ -+ /**< @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_RC_SLICE_DQUANT, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_FRAME_LIMIT_BITS, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_PEAK_RATE, -+ -+ /* H264 specific parameters */ -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_DISABLE_CABAC, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_LATENCY, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_AU_DELIMITERS, -+ -+ /** @ref MMAL_PARAMETER_UINT32_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_DEBLOCK_IDC, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_ENCODER_H264_MB_INTRA_MODES_T. */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_MB_INTRA_MODE, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_HEADER_ON_OPEN, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_PRECODE_FOR_QP, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_DRM_INIT_INFO_T. */ -+ MMAL_PARAMETER_VIDEO_DRM_INIT_INFO, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_TIMESTAMP_FIFO, -+ -+ /** @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT, -+ -+ /** @ref MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER_T. */ -+ MMAL_PARAMETER_VIDEO_DRM_PROTECT_BUFFER, -+ -+ /** @ref MMAL_PARAMETER_BYTES_T */ -+ MMAL_PARAMETER_VIDEO_DECODE_CONFIG_VD3, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_VCL_HRD_PARAMETERS, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_H264_LOW_DELAY_HRD_FLAG, -+ -+ /**< @ref MMAL_PARAMETER_BOOLEAN_T */ -+ MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER -+}; -+ -+/** Valid mirror modes */ -+enum mmal_parameter_mirror { -+ MMAL_PARAM_MIRROR_NONE, -+ MMAL_PARAM_MIRROR_VERTICAL, -+ MMAL_PARAM_MIRROR_HORIZONTAL, -+ MMAL_PARAM_MIRROR_BOTH, -+}; -+ -+enum mmal_parameter_displaytransform { -+ MMAL_DISPLAY_ROT0 = 0, -+ MMAL_DISPLAY_MIRROR_ROT0 = 1, -+ MMAL_DISPLAY_MIRROR_ROT180 = 2, -+ MMAL_DISPLAY_ROT180 = 3, -+ MMAL_DISPLAY_MIRROR_ROT90 = 4, -+ MMAL_DISPLAY_ROT270 = 5, -+ MMAL_DISPLAY_ROT90 = 6, -+ MMAL_DISPLAY_MIRROR_ROT270 = 7, -+}; -+ -+enum mmal_parameter_displaymode { -+ MMAL_DISPLAY_MODE_FILL = 0, -+ MMAL_DISPLAY_MODE_LETTERBOX = 1, -+}; -+ -+enum mmal_parameter_displayset { -+ MMAL_DISPLAY_SET_NONE = 0, -+ MMAL_DISPLAY_SET_NUM = 1, -+ MMAL_DISPLAY_SET_FULLSCREEN = 2, -+ MMAL_DISPLAY_SET_TRANSFORM = 4, -+ MMAL_DISPLAY_SET_DEST_RECT = 8, -+ MMAL_DISPLAY_SET_SRC_RECT = 0x10, -+ MMAL_DISPLAY_SET_MODE = 0x20, -+ MMAL_DISPLAY_SET_PIXEL = 0x40, -+ MMAL_DISPLAY_SET_NOASPECT = 0x80, -+ MMAL_DISPLAY_SET_LAYER = 0x100, -+ MMAL_DISPLAY_SET_COPYPROTECT = 0x200, -+ MMAL_DISPLAY_SET_ALPHA = 0x400, -+}; -+ -+struct mmal_parameter_displayregion { -+ /** Bitfield that indicates which fields are set and should be -+ * used. All other fields will maintain their current value. -+ * \ref MMAL_DISPLAYSET_T defines the bits that can be -+ * combined. -+ */ -+ u32 set; -+ -+ /** Describes the display output device, with 0 typically -+ * being a directly connected LCD display. The actual values -+ * will depend on the hardware. Code using hard-wired numbers -+ * (e.g. 2) is certain to fail. -+ */ -+ -+ u32 display_num; -+ /** Indicates that we are using the full device screen area, -+ * rather than a window of the display. If zero, then -+ * dest_rect is used to specify a region of the display to -+ * use. -+ */ -+ -+ s32 fullscreen; -+ /** Indicates any rotation or flipping used to map frames onto -+ * the natural display orientation. -+ */ -+ u32 transform; /* enum mmal_parameter_displaytransform */ -+ -+ /** Where to display the frame within the screen, if -+ * fullscreen is zero. -+ */ -+ struct vchiq_mmal_rect dest_rect; -+ -+ /** Indicates which area of the frame to display. If all -+ * values are zero, the whole frame will be used. -+ */ -+ struct vchiq_mmal_rect src_rect; -+ -+ /** If set to non-zero, indicates that any display scaling -+ * should disregard the aspect ratio of the frame region being -+ * displayed. -+ */ -+ s32 noaspect; -+ -+ /** Indicates how the image should be scaled to fit the -+ * display. \code MMAL_DISPLAY_MODE_FILL \endcode indicates -+ * that the image should fill the screen by potentially -+ * cropping the frames. Setting \code mode \endcode to \code -+ * MMAL_DISPLAY_MODE_LETTERBOX \endcode indicates that all the -+ * source region should be displayed and black bars added if -+ * necessary. -+ */ -+ u32 mode; /* enum mmal_parameter_displaymode */ -+ -+ /** If non-zero, defines the width of a source pixel relative -+ * to \code pixel_y \endcode. If zero, then pixels default to -+ * being square. -+ */ -+ u32 pixel_x; -+ -+ /** If non-zero, defines the height of a source pixel relative -+ * to \code pixel_x \endcode. If zero, then pixels default to -+ * being square. -+ */ -+ u32 pixel_y; -+ -+ /** Sets the relative depth of the images, with greater values -+ * being in front of smaller values. -+ */ -+ u32 layer; -+ -+ /** Set to non-zero to ensure copy protection is used on -+ * output. -+ */ -+ s32 copyprotect_required; -+ -+ /** Level of opacity of the layer, where zero is fully -+ * transparent and 255 is fully opaque. -+ */ -+ u32 alpha; -+}; -+ -+#define MMAL_MAX_IMAGEFX_PARAMETERS 5 -+ -+struct mmal_parameter_imagefx_parameters { -+ enum mmal_parameter_imagefx effect; -+ u32 num_effect_params; -+ u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS]; -+}; -+ -+#define MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS 4 -+#define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 -+#define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 -+ -+struct mmal_parameter_camera_info_camera_t { -+ u32 port_id; -+ u32 max_width; -+ u32 max_height; -+ u32 lens_present; -+ u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; -+}; -+ -+enum mmal_parameter_camera_info_flash_type_t { -+ /* Make values explicit to ensure they match values in config ini */ -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_OTHER = 2, -+ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF -+}; -+ -+struct mmal_parameter_camera_info_flash_t { -+ enum mmal_parameter_camera_info_flash_type_t flash_type; -+}; -+ -+struct mmal_parameter_camera_info_t { -+ u32 num_cameras; -+ u32 num_flashes; -+ struct mmal_parameter_camera_info_camera_t -+ cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; -+ struct mmal_parameter_camera_info_flash_t -+ flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; -+}; -diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c -new file mode 100644 -index 0000000000000000000000000000000000000000..781322542d5a8295f3d7d5a3eaaf0cac29930c30 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-vchiq.c -@@ -0,0 +1,1916 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * V4L2 driver MMAL vchiq interface code -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mmal-common.h" -+#include "mmal-vchiq.h" -+#include "mmal-msg.h" -+ -+#define USE_VCHIQ_ARM -+#include "interface/vchi/vchi.h" -+ -+/* maximum number of components supported */ -+#define VCHIQ_MMAL_MAX_COMPONENTS 4 -+ -+/*#define FULL_MSG_DUMP 1*/ -+ -+#ifdef DEBUG -+static const char *const msg_type_names[] = { -+ "UNKNOWN", -+ "QUIT", -+ "SERVICE_CLOSED", -+ "GET_VERSION", -+ "COMPONENT_CREATE", -+ "COMPONENT_DESTROY", -+ "COMPONENT_ENABLE", -+ "COMPONENT_DISABLE", -+ "PORT_INFO_GET", -+ "PORT_INFO_SET", -+ "PORT_ACTION", -+ "BUFFER_FROM_HOST", -+ "BUFFER_TO_HOST", -+ "GET_STATS", -+ "PORT_PARAMETER_SET", -+ "PORT_PARAMETER_GET", -+ "EVENT_TO_HOST", -+ "GET_CORE_STATS_FOR_PORT", -+ "OPAQUE_ALLOCATOR", -+ "CONSUME_MEM", -+ "LMK", -+ "OPAQUE_ALLOCATOR_DESC", -+ "DRM_GET_LHS32", -+ "DRM_GET_TIME", -+ "BUFFER_FROM_HOST_ZEROLEN", -+ "PORT_FLUSH", -+ "HOST_LOG", -+}; -+#endif -+ -+static const char *const port_action_type_names[] = { -+ "UNKNOWN", -+ "ENABLE", -+ "DISABLE", -+ "FLUSH", -+ "CONNECT", -+ "DISCONNECT", -+ "SET_REQUIREMENTS", -+}; -+ -+#if defined(DEBUG) -+#if defined(FULL_MSG_DUMP) -+#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \ -+ do { \ -+ pr_debug(TITLE" type:%s(%d) length:%d\n", \ -+ msg_type_names[(MSG)->h.type], \ -+ (MSG)->h.type, (MSG_LEN)); \ -+ print_hex_dump(KERN_DEBUG, "<h.type], \ -+ (MSG)->h.type, (MSG_LEN)); \ -+ } -+#endif -+#else -+#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) -+#endif -+ -+/* normal message context */ -+struct mmal_msg_context { -+ union { -+ struct { -+ /* work struct for defered callback - must come first */ -+ struct work_struct work; -+ /* mmal instance */ -+ struct vchiq_mmal_instance *instance; -+ /* mmal port */ -+ struct vchiq_mmal_port *port; -+ /* actual buffer used to store bulk reply */ -+ struct mmal_buffer *buffer; -+ /* amount of buffer used */ -+ unsigned long buffer_used; -+ /* MMAL buffer flags */ -+ u32 mmal_flags; -+ /* Presentation and Decode timestamps */ -+ s64 pts; -+ s64 dts; -+ -+ int status; /* context status */ -+ -+ } bulk; /* bulk data */ -+ -+ struct { -+ /* message handle to release */ -+ VCHI_HELD_MSG_T msg_handle; -+ /* pointer to received message */ -+ struct mmal_msg *msg; -+ /* received message length */ -+ u32 msg_len; -+ /* completion upon reply */ -+ struct completion cmplt; -+ } sync; /* synchronous response */ -+ } u; -+ -+}; -+ -+struct vchiq_mmal_instance { -+ VCHI_SERVICE_HANDLE_T handle; -+ -+ /* ensure serialised access to service */ -+ struct mutex vchiq_mutex; -+ -+ /* ensure serialised access to bulk operations */ -+ struct mutex bulk_mutex; -+ -+ /* vmalloc page to receive scratch bulk xfers into */ -+ void *bulk_scratch; -+ -+ /* component to use next */ -+ int component_idx; -+ struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; -+}; -+ -+static struct mmal_msg_context *get_msg_context(struct vchiq_mmal_instance -+ *instance) -+{ -+ struct mmal_msg_context *msg_context; -+ -+ /* todo: should this be allocated from a pool to avoid kmalloc */ -+ msg_context = kmalloc(sizeof(*msg_context), GFP_KERNEL); -+ memset(msg_context, 0, sizeof(*msg_context)); -+ -+ return msg_context; -+} -+ -+static void release_msg_context(struct mmal_msg_context *msg_context) -+{ -+ kfree(msg_context); -+} -+ -+/* deals with receipt of event to host message */ -+static void event_to_host_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, u32 msg_len) -+{ -+ pr_debug("unhandled event\n"); -+ pr_debug("component:%p port type:%d num:%d cmd:0x%x length:%d\n", -+ msg->u.event_to_host.client_component, -+ msg->u.event_to_host.port_type, -+ msg->u.event_to_host.port_num, -+ msg->u.event_to_host.cmd, msg->u.event_to_host.length); -+} -+ -+/* workqueue scheduled callback -+ * -+ * we do this because it is important we do not call any other vchiq -+ * sync calls from witin the message delivery thread -+ */ -+static void buffer_work_cb(struct work_struct *work) -+{ -+ struct mmal_msg_context *msg_context = (struct mmal_msg_context *)work; -+ -+ msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, -+ msg_context->u.bulk.port, -+ msg_context->u.bulk.status, -+ msg_context->u.bulk.buffer, -+ msg_context->u.bulk.buffer_used, -+ msg_context->u.bulk.mmal_flags, -+ msg_context->u.bulk.dts, -+ msg_context->u.bulk.pts); -+ -+ /* release message context */ -+ release_msg_context(msg_context); -+} -+ -+/* enqueue a bulk receive for a given message context */ -+static int bulk_receive(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, -+ struct mmal_msg_context *msg_context) -+{ -+ unsigned long rd_len; -+ unsigned long flags = 0; -+ int ret; -+ -+ /* bulk mutex stops other bulk operations while we have a -+ * receive in progress - released in callback -+ */ -+ ret = mutex_lock_interruptible(&instance->bulk_mutex); -+ if (ret != 0) -+ return ret; -+ -+ rd_len = msg->u.buffer_from_host.buffer_header.length; -+ -+ /* take buffer from queue */ -+ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); -+ if (list_empty(&msg_context->u.bulk.port->buffers)) { -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ pr_err("buffer list empty trying to submit bulk receive\n"); -+ -+ /* todo: this is a serious error, we should never have -+ * commited a buffer_to_host operation to the mmal -+ * port without the buffer to back it up (underflow -+ * handling) and there is no obvious way to deal with -+ * this - how is the mmal servie going to react when -+ * we fail to do the xfer and reschedule a buffer when -+ * it arrives? perhaps a starved flag to indicate a -+ * waiting bulk receive? -+ */ -+ -+ mutex_unlock(&instance->bulk_mutex); -+ -+ return -EINVAL; -+ } -+ -+ msg_context->u.bulk.buffer = -+ list_entry(msg_context->u.bulk.port->buffers.next, -+ struct mmal_buffer, list); -+ list_del(&msg_context->u.bulk.buffer->list); -+ -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ -+ /* ensure we do not overrun the available buffer */ -+ if (rd_len > msg_context->u.bulk.buffer->buffer_size) { -+ rd_len = msg_context->u.bulk.buffer->buffer_size; -+ pr_warn("short read as not enough receive buffer space\n"); -+ /* todo: is this the correct response, what happens to -+ * the rest of the message data? -+ */ -+ } -+ -+ /* store length */ -+ msg_context->u.bulk.buffer_used = rd_len; -+ msg_context->u.bulk.mmal_flags = -+ msg->u.buffer_from_host.buffer_header.flags; -+ msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; -+ msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; -+ -+ // only need to flush L1 cache here, as VCHIQ takes care of the L2 -+ // cache. -+ __cpuc_flush_dcache_area(msg_context->u.bulk.buffer->buffer, rd_len); -+ -+ /* queue the bulk submission */ -+ vchi_service_use(instance->handle); -+ ret = vchi_bulk_queue_receive(instance->handle, -+ msg_context->u.bulk.buffer->buffer, -+ /* Actual receive needs to be a multiple -+ * of 4 bytes -+ */ -+ (rd_len + 3) & ~3, -+ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, -+ msg_context); -+ -+ vchi_service_release(instance->handle); -+ -+ if (ret != 0) { -+ /* callback will not be clearing the mutex */ -+ mutex_unlock(&instance->bulk_mutex); -+ } -+ -+ return ret; -+} -+ -+/* enque a dummy bulk receive for a given message context */ -+static int dummy_bulk_receive(struct vchiq_mmal_instance *instance, -+ struct mmal_msg_context *msg_context) -+{ -+ int ret; -+ -+ /* bulk mutex stops other bulk operations while we have a -+ * receive in progress - released in callback -+ */ -+ ret = mutex_lock_interruptible(&instance->bulk_mutex); -+ if (ret != 0) -+ return ret; -+ -+ /* zero length indicates this was a dummy transfer */ -+ msg_context->u.bulk.buffer_used = 0; -+ -+ /* queue the bulk submission */ -+ vchi_service_use(instance->handle); -+ -+ ret = vchi_bulk_queue_receive(instance->handle, -+ instance->bulk_scratch, -+ 8, -+ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, -+ msg_context); -+ -+ vchi_service_release(instance->handle); -+ -+ if (ret != 0) { -+ /* callback will not be clearing the mutex */ -+ mutex_unlock(&instance->bulk_mutex); -+ } -+ -+ return ret; -+} -+ -+/* data in message, memcpy from packet into output buffer */ -+static int inline_receive(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, -+ struct mmal_msg_context *msg_context) -+{ -+ unsigned long flags = 0; -+ -+ /* take buffer from queue */ -+ spin_lock_irqsave(&msg_context->u.bulk.port->slock, flags); -+ if (list_empty(&msg_context->u.bulk.port->buffers)) { -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ pr_err("buffer list empty trying to receive inline\n"); -+ -+ /* todo: this is a serious error, we should never have -+ * commited a buffer_to_host operation to the mmal -+ * port without the buffer to back it up (with -+ * underflow handling) and there is no obvious way to -+ * deal with this. Less bad than the bulk case as we -+ * can just drop this on the floor but...unhelpful -+ */ -+ return -EINVAL; -+ } -+ -+ msg_context->u.bulk.buffer = -+ list_entry(msg_context->u.bulk.port->buffers.next, -+ struct mmal_buffer, list); -+ list_del(&msg_context->u.bulk.buffer->list); -+ -+ spin_unlock_irqrestore(&msg_context->u.bulk.port->slock, flags); -+ -+ memcpy(msg_context->u.bulk.buffer->buffer, -+ msg->u.buffer_from_host.short_data, -+ msg->u.buffer_from_host.payload_in_message); -+ -+ msg_context->u.bulk.buffer_used = -+ msg->u.buffer_from_host.payload_in_message; -+ -+ return 0; -+} -+ -+/* queue the buffer availability with MMAL_MSG_TYPE_BUFFER_FROM_HOST */ -+static int -+buffer_from_host(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, struct mmal_buffer *buf) -+{ -+ struct mmal_msg_context *msg_context; -+ struct mmal_msg m; -+ int ret; -+ -+ pr_debug("instance:%p buffer:%p\n", instance->handle, buf); -+ -+ /* bulk mutex stops other bulk operations while we -+ * have a receive in progress -+ */ -+ if (mutex_lock_interruptible(&instance->bulk_mutex)) -+ return -EINTR; -+ -+ /* get context */ -+ msg_context = get_msg_context(instance); -+ if (msg_context == NULL) -+ return -ENOMEM; -+ -+ /* store bulk message context for when data arrives */ -+ msg_context->u.bulk.instance = instance; -+ msg_context->u.bulk.port = port; -+ msg_context->u.bulk.buffer = NULL; /* not valid until bulk xfer */ -+ msg_context->u.bulk.buffer_used = 0; -+ -+ /* initialise work structure ready to schedule callback */ -+ INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); -+ -+ /* prep the buffer from host message */ -+ memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ -+ -+ m.h.type = MMAL_MSG_TYPE_BUFFER_FROM_HOST; -+ m.h.magic = MMAL_MAGIC; -+ m.h.context = msg_context; -+ m.h.status = 0; -+ -+ /* drvbuf is our private data passed back */ -+ m.u.buffer_from_host.drvbuf.magic = MMAL_MAGIC; -+ m.u.buffer_from_host.drvbuf.component_handle = port->component->handle; -+ m.u.buffer_from_host.drvbuf.port_handle = port->handle; -+ m.u.buffer_from_host.drvbuf.client_context = msg_context; -+ -+ /* buffer header */ -+ m.u.buffer_from_host.buffer_header.cmd = 0; -+ m.u.buffer_from_host.buffer_header.data = buf->buffer; -+ m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size; -+ m.u.buffer_from_host.buffer_header.length = 0; /* nothing used yet */ -+ m.u.buffer_from_host.buffer_header.offset = 0; /* no offset */ -+ m.u.buffer_from_host.buffer_header.flags = 0; /* no flags */ -+ m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN; -+ m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN; -+ -+ /* clear buffer type sepecific data */ -+ memset(&m.u.buffer_from_host.buffer_header_type_specific, 0, -+ sizeof(m.u.buffer_from_host.buffer_header_type_specific)); -+ -+ /* no payload in message */ -+ m.u.buffer_from_host.payload_in_message = 0; -+ -+ vchi_service_use(instance->handle); -+ -+ ret = vchi_msg_queue(instance->handle, &m, -+ sizeof(struct mmal_msg_header) + -+ sizeof(m.u.buffer_from_host), -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ if (ret != 0) { -+ release_msg_context(msg_context); -+ /* todo: is this correct error value? */ -+ } -+ -+ vchi_service_release(instance->handle); -+ -+ mutex_unlock(&instance->bulk_mutex); -+ -+ return ret; -+} -+ -+/* submit a buffer to the mmal sevice -+ * -+ * the buffer_from_host uses size data from the ports next available -+ * mmal_buffer and deals with there being no buffer available by -+ * incrementing the underflow for later -+ */ -+static int port_buffer_from_host(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_buffer *buf; -+ unsigned long flags = 0; -+ -+ if (!port->enabled) -+ return -EINVAL; -+ -+ /* peek buffer from queue */ -+ spin_lock_irqsave(&port->slock, flags); -+ if (list_empty(&port->buffers)) { -+ port->buffer_underflow++; -+ spin_unlock_irqrestore(&port->slock, flags); -+ return -ENOSPC; -+ } -+ -+ buf = list_entry(port->buffers.next, struct mmal_buffer, list); -+ -+ spin_unlock_irqrestore(&port->slock, flags); -+ -+ /* issue buffer to mmal service */ -+ ret = buffer_from_host(instance, port, buf); -+ if (ret) { -+ pr_err("adding buffer header failed\n"); -+ /* todo: how should this be dealt with */ -+ } -+ -+ return ret; -+} -+ -+/* deals with receipt of buffer to host message */ -+static void buffer_to_host_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, u32 msg_len) -+{ -+ struct mmal_msg_context *msg_context; -+ -+ pr_debug("buffer_to_host_cb: instance:%p msg:%p msg_len:%d\n", -+ instance, msg, msg_len); -+ -+ if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) { -+ msg_context = msg->u.buffer_from_host.drvbuf.client_context; -+ } else { -+ pr_err("MMAL_MSG_TYPE_BUFFER_TO_HOST with bad magic\n"); -+ return; -+ } -+ -+ if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) { -+ /* message reception had an error */ -+ pr_warn("error %d in reply\n", msg->h.status); -+ -+ msg_context->u.bulk.status = msg->h.status; -+ -+ } else if (msg->u.buffer_from_host.buffer_header.length == 0) { -+ /* empty buffer */ -+ if (msg->u.buffer_from_host.buffer_header.flags & -+ MMAL_BUFFER_HEADER_FLAG_EOS) { -+ msg_context->u.bulk.status = -+ dummy_bulk_receive(instance, msg_context); -+ if (msg_context->u.bulk.status == 0) -+ return; /* successful bulk submission, bulk -+ * completion will trigger callback -+ */ -+ } else { -+ /* do callback with empty buffer - not EOS though */ -+ msg_context->u.bulk.status = 0; -+ msg_context->u.bulk.buffer_used = 0; -+ } -+ } else if (msg->u.buffer_from_host.payload_in_message == 0) { -+ /* data is not in message, queue a bulk receive */ -+ msg_context->u.bulk.status = -+ bulk_receive(instance, msg, msg_context); -+ if (msg_context->u.bulk.status == 0) -+ return; /* successful bulk submission, bulk -+ * completion will trigger callback -+ */ -+ -+ /* failed to submit buffer, this will end badly */ -+ pr_err("error %d on bulk submission\n", -+ msg_context->u.bulk.status); -+ -+ } else if (msg->u.buffer_from_host.payload_in_message <= -+ MMAL_VC_SHORT_DATA) { -+ /* data payload within message */ -+ msg_context->u.bulk.status = inline_receive(instance, msg, -+ msg_context); -+ } else { -+ pr_err("message with invalid short payload\n"); -+ -+ /* signal error */ -+ msg_context->u.bulk.status = -EINVAL; -+ msg_context->u.bulk.buffer_used = -+ msg->u.buffer_from_host.payload_in_message; -+ } -+ -+ /* replace the buffer header */ -+ port_buffer_from_host(instance, msg_context->u.bulk.port); -+ -+ /* schedule the port callback */ -+ schedule_work(&msg_context->u.bulk.work); -+} -+ -+static void bulk_receive_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg_context *msg_context) -+{ -+ /* bulk receive operation complete */ -+ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); -+ -+ /* replace the buffer header */ -+ port_buffer_from_host(msg_context->u.bulk.instance, -+ msg_context->u.bulk.port); -+ -+ msg_context->u.bulk.status = 0; -+ -+ /* schedule the port callback */ -+ schedule_work(&msg_context->u.bulk.work); -+} -+ -+static void bulk_abort_cb(struct vchiq_mmal_instance *instance, -+ struct mmal_msg_context *msg_context) -+{ -+ pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context); -+ -+ /* bulk receive operation complete */ -+ mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex); -+ -+ /* replace the buffer header */ -+ port_buffer_from_host(msg_context->u.bulk.instance, -+ msg_context->u.bulk.port); -+ -+ msg_context->u.bulk.status = -EINTR; -+ -+ schedule_work(&msg_context->u.bulk.work); -+} -+ -+/* incoming event service callback */ -+static void service_callback(void *param, -+ const VCHI_CALLBACK_REASON_T reason, -+ void *bulk_ctx) -+{ -+ struct vchiq_mmal_instance *instance = param; -+ int status; -+ u32 msg_len; -+ struct mmal_msg *msg; -+ VCHI_HELD_MSG_T msg_handle; -+ -+ if (!instance) { -+ pr_err("Message callback passed NULL instance\n"); -+ return; -+ } -+ -+ switch (reason) { -+ case VCHI_CALLBACK_MSG_AVAILABLE: -+ status = vchi_msg_hold(instance->handle, (void **)&msg, -+ &msg_len, VCHI_FLAGS_NONE, &msg_handle); -+ if (status) { -+ pr_err("Unable to dequeue a message (%d)\n", status); -+ break; -+ } -+ -+ DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); -+ -+ /* handling is different for buffer messages */ -+ switch (msg->h.type) { -+ -+ case MMAL_MSG_TYPE_BUFFER_FROM_HOST: -+ vchi_held_msg_release(&msg_handle); -+ break; -+ -+ case MMAL_MSG_TYPE_EVENT_TO_HOST: -+ event_to_host_cb(instance, msg, msg_len); -+ vchi_held_msg_release(&msg_handle); -+ -+ break; -+ -+ case MMAL_MSG_TYPE_BUFFER_TO_HOST: -+ buffer_to_host_cb(instance, msg, msg_len); -+ vchi_held_msg_release(&msg_handle); -+ break; -+ -+ default: -+ /* messages dependant on header context to complete */ -+ -+ /* todo: the msg.context really ought to be sanity -+ * checked before we just use it, afaict it comes back -+ * and is used raw from the videocore. Perhaps it -+ * should be verified the address lies in the kernel -+ * address space. -+ */ -+ if (msg->h.context == NULL) { -+ pr_err("received message context was null!\n"); -+ vchi_held_msg_release(&msg_handle); -+ break; -+ } -+ -+ /* fill in context values */ -+ msg->h.context->u.sync.msg_handle = msg_handle; -+ msg->h.context->u.sync.msg = msg; -+ msg->h.context->u.sync.msg_len = msg_len; -+ -+ /* todo: should this check (completion_done() -+ * == 1) for no one waiting? or do we need a -+ * flag to tell us the completion has been -+ * interrupted so we can free the message and -+ * its context. This probably also solves the -+ * message arriving after interruption todo -+ * below -+ */ -+ -+ /* complete message so caller knows it happened */ -+ complete(&msg->h.context->u.sync.cmplt); -+ break; -+ } -+ -+ break; -+ -+ case VCHI_CALLBACK_BULK_RECEIVED: -+ bulk_receive_cb(instance, bulk_ctx); -+ break; -+ -+ case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: -+ bulk_abort_cb(instance, bulk_ctx); -+ break; -+ -+ case VCHI_CALLBACK_SERVICE_CLOSED: -+ /* TODO: consider if this requires action if received when -+ * driver is not explicitly closing the service -+ */ -+ break; -+ -+ default: -+ pr_err("Received unhandled message reason %d\n", reason); -+ break; -+ } -+} -+ -+static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, -+ struct mmal_msg *msg, -+ unsigned int payload_len, -+ struct mmal_msg **msg_out, -+ VCHI_HELD_MSG_T *msg_handle_out) -+{ -+ struct mmal_msg_context msg_context; -+ int ret; -+ -+ /* payload size must not cause message to exceed max size */ -+ if (payload_len > -+ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) { -+ pr_err("payload length %d exceeds max:%d\n", payload_len, -+ (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))); -+ return -EINVAL; -+ } -+ -+ init_completion(&msg_context.u.sync.cmplt); -+ -+ msg->h.magic = MMAL_MAGIC; -+ msg->h.context = &msg_context; -+ msg->h.status = 0; -+ -+ DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), -+ ">>> sync message"); -+ -+ vchi_service_use(instance->handle); -+ -+ ret = vchi_msg_queue(instance->handle, -+ msg, -+ sizeof(struct mmal_msg_header) + payload_len, -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); -+ -+ vchi_service_release(instance->handle); -+ -+ if (ret) { -+ pr_err("error %d queuing message\n", ret); -+ return ret; -+ } -+ -+ ret = wait_for_completion_timeout(&msg_context.u.sync.cmplt, 3*HZ); -+ if (ret <= 0) { -+ pr_err("error %d waiting for sync completion\n", ret); -+ if (ret == 0) -+ ret = -ETIME; -+ /* todo: what happens if the message arrives after aborting */ -+ return ret; -+ } -+ -+ *msg_out = msg_context.u.sync.msg; -+ *msg_handle_out = msg_context.u.sync.msg_handle; -+ -+ return 0; -+} -+ -+static void dump_port_info(struct vchiq_mmal_port *port) -+{ -+ pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled); -+ -+ pr_debug("buffer minimum num:%d size:%d align:%d\n", -+ port->minimum_buffer.num, -+ port->minimum_buffer.size, port->minimum_buffer.alignment); -+ -+ pr_debug("buffer recommended num:%d size:%d align:%d\n", -+ port->recommended_buffer.num, -+ port->recommended_buffer.size, -+ port->recommended_buffer.alignment); -+ -+ pr_debug("buffer current values num:%d size:%d align:%d\n", -+ port->current_buffer.num, -+ port->current_buffer.size, port->current_buffer.alignment); -+ -+ pr_debug("elementry stream: type:%d encoding:0x%x varient:0x%x\n", -+ port->format.type, -+ port->format.encoding, port->format.encoding_variant); -+ -+ pr_debug(" bitrate:%d flags:0x%x\n", -+ port->format.bitrate, port->format.flags); -+ -+ if (port->format.type == MMAL_ES_TYPE_VIDEO) { -+ pr_debug -+ ("es video format: width:%d height:%d colourspace:0x%x\n", -+ port->es.video.width, port->es.video.height, -+ port->es.video.color_space); -+ -+ pr_debug(" : crop xywh %d,%d,%d,%d\n", -+ port->es.video.crop.x, -+ port->es.video.crop.y, -+ port->es.video.crop.width, port->es.video.crop.height); -+ pr_debug(" : framerate %d/%d aspect %d/%d\n", -+ port->es.video.frame_rate.num, -+ port->es.video.frame_rate.den, -+ port->es.video.par.num, port->es.video.par.den); -+ } -+} -+ -+static void port_to_mmal_msg(struct vchiq_mmal_port *port, struct mmal_port *p) -+{ -+ -+ /* todo do readonly fields need setting at all? */ -+ p->type = port->type; -+ p->index = port->index; -+ p->index_all = 0; -+ p->is_enabled = port->enabled; -+ p->buffer_num_min = port->minimum_buffer.num; -+ p->buffer_size_min = port->minimum_buffer.size; -+ p->buffer_alignment_min = port->minimum_buffer.alignment; -+ p->buffer_num_recommended = port->recommended_buffer.num; -+ p->buffer_size_recommended = port->recommended_buffer.size; -+ -+ /* only three writable fields in a port */ -+ p->buffer_num = port->current_buffer.num; -+ p->buffer_size = port->current_buffer.size; -+ p->userdata = port; -+} -+ -+static int port_info_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ pr_debug("setting port info port %p\n", port); -+ if (!port) -+ return -1; -+ dump_port_info(port); -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_INFO_SET; -+ -+ m.u.port_info_set.component_handle = port->component->handle; -+ m.u.port_info_set.port_type = port->type; -+ m.u.port_info_set.port_index = port->index; -+ -+ port_to_mmal_msg(port, &m.u.port_info_set.port); -+ -+ /* elementry stream format setup */ -+ m.u.port_info_set.format.type = port->format.type; -+ m.u.port_info_set.format.encoding = port->format.encoding; -+ m.u.port_info_set.format.encoding_variant = -+ port->format.encoding_variant; -+ m.u.port_info_set.format.bitrate = port->format.bitrate; -+ m.u.port_info_set.format.flags = port->format.flags; -+ -+ memcpy(&m.u.port_info_set.es, &port->es, -+ sizeof(union mmal_es_specific_format)); -+ -+ m.u.port_info_set.format.extradata_size = port->format.extradata_size; -+ memcpy(&m.u.port_info_set.extradata, port->format.extradata, -+ port->format.extradata_size); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_info_set), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_SET) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ /* return operation status */ -+ ret = -rmsg->u.port_info_get_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, -+ port->component->handle, port->handle); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+ -+} -+ -+/* use port info get message to retrive port information */ -+static int port_info_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ /* port info time */ -+ m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; -+ m.u.port_info_get.component_handle = port->component->handle; -+ m.u.port_info_get.port_type = port->type; -+ m.u.port_info_get.index = port->index; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_info_get), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_GET) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ /* return operation status */ -+ ret = -rmsg->u.port_info_get_reply.status; -+ if (ret != MMAL_MSG_STATUS_SUCCESS) -+ goto release_msg; -+ -+ if (rmsg->u.port_info_get_reply.port.is_enabled == 0) -+ port->enabled = false; -+ else -+ port->enabled = true; -+ -+ /* copy the values out of the message */ -+ port->handle = rmsg->u.port_info_get_reply.port_handle; -+ -+ /* port type and index cached to use on port info set becuase -+ * it does not use a port handle -+ */ -+ port->type = rmsg->u.port_info_get_reply.port_type; -+ port->index = rmsg->u.port_info_get_reply.port_index; -+ -+ port->minimum_buffer.num = -+ rmsg->u.port_info_get_reply.port.buffer_num_min; -+ port->minimum_buffer.size = -+ rmsg->u.port_info_get_reply.port.buffer_size_min; -+ port->minimum_buffer.alignment = -+ rmsg->u.port_info_get_reply.port.buffer_alignment_min; -+ -+ port->recommended_buffer.alignment = -+ rmsg->u.port_info_get_reply.port.buffer_alignment_min; -+ port->recommended_buffer.num = -+ rmsg->u.port_info_get_reply.port.buffer_num_recommended; -+ -+ port->current_buffer.num = rmsg->u.port_info_get_reply.port.buffer_num; -+ port->current_buffer.size = -+ rmsg->u.port_info_get_reply.port.buffer_size; -+ -+ /* stream format */ -+ port->format.type = rmsg->u.port_info_get_reply.format.type; -+ port->format.encoding = rmsg->u.port_info_get_reply.format.encoding; -+ port->format.encoding_variant = -+ rmsg->u.port_info_get_reply.format.encoding_variant; -+ port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate; -+ port->format.flags = rmsg->u.port_info_get_reply.format.flags; -+ -+ /* elementry stream format */ -+ memcpy(&port->es, -+ &rmsg->u.port_info_get_reply.es, -+ sizeof(union mmal_es_specific_format)); -+ port->format.es = &port->es; -+ -+ port->format.extradata_size = -+ rmsg->u.port_info_get_reply.format.extradata_size; -+ memcpy(port->format.extradata, -+ rmsg->u.port_info_get_reply.extradata, -+ port->format.extradata_size); -+ -+ pr_debug("received port info\n"); -+ dump_port_info(port); -+ -+release_msg: -+ -+ pr_debug("%s:result:%d component:0x%x port:%d\n", -+ __func__, ret, port->component->handle, port->handle); -+ -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* create comonent on vc */ -+static int create_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component, -+ const char *name) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ /* build component create message */ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; -+ m.u.component_create.client_component = component; -+ strncpy(m.u.component_create.name, name, -+ sizeof(m.u.component_create.name)); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_create), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_create_reply.status; -+ if (ret != MMAL_MSG_STATUS_SUCCESS) -+ goto release_msg; -+ -+ /* a valid component response received */ -+ component->handle = rmsg->u.component_create_reply.component_handle; -+ component->inputs = rmsg->u.component_create_reply.input_num; -+ component->outputs = rmsg->u.component_create_reply.output_num; -+ component->clocks = rmsg->u.component_create_reply.clock_num; -+ -+ pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n", -+ component->handle, -+ component->inputs, component->outputs, component->clocks); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* destroys a component on vc */ -+static int destroy_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; -+ m.u.component_destroy.component_handle = component->handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_destroy), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_destroy_reply.status; -+ -+release_msg: -+ -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* enable a component on vc */ -+static int enable_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; -+ m.u.component_enable.component_handle = component->handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_enable), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_enable_reply.status; -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* disable a component on vc */ -+static int disable_component(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; -+ m.u.component_disable.component_handle = component->handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.component_disable), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.component_disable_reply.status; -+ -+release_msg: -+ -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* get version of mmal implementation */ -+static int get_version(struct vchiq_mmal_instance *instance, -+ u32 *major_out, u32 *minor_out) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_GET_VERSION; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.version), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != m.h.type) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ *major_out = rmsg->u.version.major; -+ *minor_out = rmsg->u.version.minor; -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* do a port action with a port as a parameter */ -+static int port_action_port(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ enum mmal_msg_port_action_type action_type) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; -+ m.u.port_action_port.component_handle = port->component->handle; -+ m.u.port_action_port.port_handle = port->handle; -+ m.u.port_action_port.action = action_type; -+ -+ port_to_mmal_msg(port, &m.u.port_action_port.port); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_action_port), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_action_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n", -+ __func__, -+ ret, port->component->handle, port->handle, -+ port_action_type_names[action_type], action_type); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* do a port action with handles as parameters */ -+static int port_action_handle(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ enum mmal_msg_port_action_type action_type, -+ u32 connect_component_handle, -+ u32 connect_port_handle) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_ACTION; -+ -+ m.u.port_action_handle.component_handle = port->component->handle; -+ m.u.port_action_handle.port_handle = port->handle; -+ m.u.port_action_handle.action = action_type; -+ -+ m.u.port_action_handle.connect_component_handle = -+ connect_component_handle; -+ m.u.port_action_handle.connect_port_handle = connect_port_handle; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(m.u.port_action_handle), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_action_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)" \ -+ " connect component:0x%x connect port:%d\n", -+ __func__, -+ ret, port->component->handle, port->handle, -+ port_action_type_names[action_type], -+ action_type, connect_component_handle, connect_port_handle); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+static int port_parameter_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter_id, void *value, u32 value_size) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; -+ -+ m.u.port_parameter_set.component_handle = port->component->handle; -+ m.u.port_parameter_set.port_handle = port->handle; -+ m.u.port_parameter_set.id = parameter_id; -+ m.u.port_parameter_set.size = (2 * sizeof(u32)) + value_size; -+ memcpy(&m.u.port_parameter_set.value, value, value_size); -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ (4 * sizeof(u32)) + value_size, -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_SET) { -+ /* got an unexpected message type in reply */ -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_parameter_set_reply.status; -+ -+ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", -+ __func__, -+ ret, port->component->handle, port->handle, parameter_id); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+static int port_parameter_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter_id, void *value, u32 *value_size) -+{ -+ int ret; -+ struct mmal_msg m; -+ struct mmal_msg *rmsg; -+ VCHI_HELD_MSG_T rmsg_handle; -+ -+ m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; -+ -+ m.u.port_parameter_get.component_handle = port->component->handle; -+ m.u.port_parameter_get.port_handle = port->handle; -+ m.u.port_parameter_get.id = parameter_id; -+ m.u.port_parameter_get.size = (2 * sizeof(u32)) + *value_size; -+ -+ ret = send_synchronous_mmal_msg(instance, &m, -+ sizeof(struct -+ mmal_msg_port_parameter_get), -+ &rmsg, &rmsg_handle); -+ if (ret) -+ return ret; -+ -+ if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_GET) { -+ /* got an unexpected message type in reply */ -+ pr_err("Incorrect reply type %d\n", rmsg->h.type); -+ ret = -EINVAL; -+ goto release_msg; -+ } -+ -+ ret = -rmsg->u.port_parameter_get_reply.status; -+ if (ret) { -+ /* Copy only as much as we have space for -+ * but report true size of parameter -+ */ -+ memcpy(value, &rmsg->u.port_parameter_get_reply.value, -+ *value_size); -+ *value_size = rmsg->u.port_parameter_get_reply.size; -+ } else -+ memcpy(value, &rmsg->u.port_parameter_get_reply.value, -+ rmsg->u.port_parameter_get_reply.size); -+ -+ pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, -+ ret, port->component->handle, port->handle, parameter_id); -+ -+release_msg: -+ vchi_held_msg_release(&rmsg_handle); -+ -+ return ret; -+} -+ -+/* disables a port and drains buffers from it */ -+static int port_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ struct list_head *q, *buf_head; -+ unsigned long flags = 0; -+ -+ if (!port->enabled) -+ return 0; -+ -+ port->enabled = false; -+ -+ ret = port_action_port(instance, port, -+ MMAL_MSG_PORT_ACTION_TYPE_DISABLE); -+ if (ret == 0) { -+ -+ /* drain all queued buffers on port */ -+ spin_lock_irqsave(&port->slock, flags); -+ -+ list_for_each_safe(buf_head, q, &port->buffers) { -+ struct mmal_buffer *mmalbuf; -+ mmalbuf = list_entry(buf_head, struct mmal_buffer, -+ list); -+ list_del(buf_head); -+ if (port->buffer_cb) -+ port->buffer_cb(instance, -+ port, 0, mmalbuf, 0, 0, -+ MMAL_TIME_UNKNOWN, -+ MMAL_TIME_UNKNOWN); -+ } -+ -+ spin_unlock_irqrestore(&port->slock, flags); -+ -+ ret = port_info_get(instance, port); -+ } -+ -+ return ret; -+} -+ -+/* enable a port */ -+static int port_enable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ unsigned int hdr_count; -+ struct list_head *buf_head; -+ int ret; -+ -+ if (port->enabled) -+ return 0; -+ -+ /* ensure there are enough buffers queued to cover the buffer headers */ -+ if (port->buffer_cb != NULL) { -+ hdr_count = 0; -+ list_for_each(buf_head, &port->buffers) { -+ hdr_count++; -+ } -+ if (hdr_count < port->current_buffer.num) -+ return -ENOSPC; -+ } -+ -+ ret = port_action_port(instance, port, -+ MMAL_MSG_PORT_ACTION_TYPE_ENABLE); -+ if (ret) -+ goto done; -+ -+ port->enabled = true; -+ -+ if (port->buffer_cb) { -+ /* send buffer headers to videocore */ -+ hdr_count = 1; -+ list_for_each(buf_head, &port->buffers) { -+ struct mmal_buffer *mmalbuf; -+ mmalbuf = list_entry(buf_head, struct mmal_buffer, -+ list); -+ ret = buffer_from_host(instance, port, mmalbuf); -+ if (ret) -+ goto done; -+ -+ hdr_count++; -+ if (hdr_count > port->current_buffer.num) -+ break; -+ } -+ } -+ -+ ret = port_info_get(instance, port); -+ -+done: -+ return ret; -+} -+ -+/* ------------------------------------------------------------------ -+ * Exported API -+ *------------------------------------------------------------------*/ -+ -+int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = port_info_set(instance, port); -+ if (ret) -+ goto release_unlock; -+ -+ /* read what has actually been set */ -+ ret = port_info_get(instance, port); -+ -+release_unlock: -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+ -+} -+ -+int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, void *value, u32 value_size) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = port_parameter_set(instance, port, parameter, value, value_size); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, void *value, u32 *value_size) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = port_parameter_get(instance, port, parameter, value, value_size); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* enable a port -+ * -+ * enables a port and queues buffers for satisfying callbacks if we -+ * provide a callback handler -+ */ -+int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ vchiq_mmal_buffer_cb buffer_cb) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ /* already enabled - noop */ -+ if (port->enabled) { -+ ret = 0; -+ goto unlock; -+ } -+ -+ port->buffer_cb = buffer_cb; -+ -+ ret = port_enable(instance, port); -+ -+unlock: -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (!port->enabled) { -+ mutex_unlock(&instance->vchiq_mutex); -+ return 0; -+ } -+ -+ ret = port_disable(instance, port); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* ports will be connected in a tunneled manner so data buffers -+ * are not handled by client. -+ */ -+int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *src, -+ struct vchiq_mmal_port *dst) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ /* disconnect ports if connected */ -+ if (src->connected != NULL) { -+ ret = port_disable(instance, src); -+ if (ret) { -+ pr_err("failed disabling src port(%d)\n", ret); -+ goto release_unlock; -+ } -+ -+ /* do not need to disable the destination port as they -+ * are connected and it is done automatically -+ */ -+ -+ ret = port_action_handle(instance, src, -+ MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT, -+ src->connected->component->handle, -+ src->connected->handle); -+ if (ret < 0) { -+ pr_err("failed disconnecting src port\n"); -+ goto release_unlock; -+ } -+ src->connected->enabled = false; -+ src->connected = NULL; -+ } -+ -+ if (dst == NULL) { -+ /* do not make new connection */ -+ ret = 0; -+ pr_debug("not making new connection\n"); -+ goto release_unlock; -+ } -+ -+ /* copy src port format to dst */ -+ dst->format.encoding = src->format.encoding; -+ dst->es.video.width = src->es.video.width; -+ dst->es.video.height = src->es.video.height; -+ dst->es.video.crop.x = src->es.video.crop.x; -+ dst->es.video.crop.y = src->es.video.crop.y; -+ dst->es.video.crop.width = src->es.video.crop.width; -+ dst->es.video.crop.height = src->es.video.crop.height; -+ dst->es.video.frame_rate.num = src->es.video.frame_rate.num; -+ dst->es.video.frame_rate.den = src->es.video.frame_rate.den; -+ -+ /* set new format */ -+ ret = port_info_set(instance, dst); -+ if (ret) { -+ pr_debug("setting port info failed\n"); -+ goto release_unlock; -+ } -+ -+ /* read what has actually been set */ -+ ret = port_info_get(instance, dst); -+ if (ret) { -+ pr_debug("read back port info failed\n"); -+ goto release_unlock; -+ } -+ -+ /* connect two ports together */ -+ ret = port_action_handle(instance, src, -+ MMAL_MSG_PORT_ACTION_TYPE_CONNECT, -+ dst->component->handle, dst->handle); -+ if (ret < 0) { -+ pr_debug("connecting port %d:%d to %d:%d failed\n", -+ src->component->handle, src->handle, -+ dst->component->handle, dst->handle); -+ goto release_unlock; -+ } -+ src->connected = dst; -+ -+release_unlock: -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ struct mmal_buffer *buffer) -+{ -+ unsigned long flags = 0; -+ -+ spin_lock_irqsave(&port->slock, flags); -+ list_add_tail(&buffer->list, &port->buffers); -+ spin_unlock_irqrestore(&port->slock, flags); -+ -+ /* the port previously underflowed because it was missing a -+ * mmal_buffer which has just been added, submit that buffer -+ * to the mmal service. -+ */ -+ if (port->buffer_underflow) { -+ port_buffer_from_host(instance, port); -+ port->buffer_underflow--; -+ } -+ -+ return 0; -+} -+ -+/* Initialise a mmal component and its ports -+ * -+ */ -+int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, -+ const char *name, -+ struct vchiq_mmal_component **component_out) -+{ -+ int ret; -+ int idx; /* port index */ -+ struct vchiq_mmal_component *component; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { -+ ret = -EINVAL; /* todo is this correct error? */ -+ goto unlock; -+ } -+ -+ component = &instance->component[instance->component_idx]; -+ -+ ret = create_component(instance, component, name); -+ if (ret < 0) -+ goto unlock; -+ -+ /* ports info needs gathering */ -+ component->control.type = MMAL_PORT_TYPE_CONTROL; -+ component->control.index = 0; -+ component->control.component = component; -+ spin_lock_init(&component->control.slock); -+ INIT_LIST_HEAD(&component->control.buffers); -+ ret = port_info_get(instance, &component->control); -+ if (ret < 0) -+ goto release_component; -+ -+ for (idx = 0; idx < component->inputs; idx++) { -+ component->input[idx].type = MMAL_PORT_TYPE_INPUT; -+ component->input[idx].index = idx; -+ component->input[idx].component = component; -+ spin_lock_init(&component->input[idx].slock); -+ INIT_LIST_HEAD(&component->input[idx].buffers); -+ ret = port_info_get(instance, &component->input[idx]); -+ if (ret < 0) -+ goto release_component; -+ } -+ -+ for (idx = 0; idx < component->outputs; idx++) { -+ component->output[idx].type = MMAL_PORT_TYPE_OUTPUT; -+ component->output[idx].index = idx; -+ component->output[idx].component = component; -+ spin_lock_init(&component->output[idx].slock); -+ INIT_LIST_HEAD(&component->output[idx].buffers); -+ ret = port_info_get(instance, &component->output[idx]); -+ if (ret < 0) -+ goto release_component; -+ } -+ -+ for (idx = 0; idx < component->clocks; idx++) { -+ component->clock[idx].type = MMAL_PORT_TYPE_CLOCK; -+ component->clock[idx].index = idx; -+ component->clock[idx].component = component; -+ spin_lock_init(&component->clock[idx].slock); -+ INIT_LIST_HEAD(&component->clock[idx].buffers); -+ ret = port_info_get(instance, &component->clock[idx]); -+ if (ret < 0) -+ goto release_component; -+ } -+ -+ instance->component_idx++; -+ -+ *component_out = component; -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return 0; -+ -+release_component: -+ destroy_component(instance, component); -+unlock: -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* -+ * cause a mmal component to be destroyed -+ */ -+int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (component->enabled) -+ ret = disable_component(instance, component); -+ -+ ret = destroy_component(instance, component); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* -+ * cause a mmal component to be enabled -+ */ -+int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (component->enabled) { -+ mutex_unlock(&instance->vchiq_mutex); -+ return 0; -+ } -+ -+ ret = enable_component(instance, component); -+ if (ret == 0) -+ component->enabled = true; -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+/* -+ * cause a mmal component to be enabled -+ */ -+int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ if (!component->enabled) { -+ mutex_unlock(&instance->vchiq_mutex); -+ return 0; -+ } -+ -+ ret = disable_component(instance, component); -+ if (ret == 0) -+ component->enabled = false; -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_version(struct vchiq_mmal_instance *instance, -+ u32 *major_out, u32 *minor_out) -+{ -+ int ret; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ ret = get_version(instance, major_out, minor_out); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ return ret; -+} -+ -+int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) -+{ -+ int status = 0; -+ -+ if (instance == NULL) -+ return -EINVAL; -+ -+ if (mutex_lock_interruptible(&instance->vchiq_mutex)) -+ return -EINTR; -+ -+ vchi_service_use(instance->handle); -+ -+ status = vchi_service_close(instance->handle); -+ if (status != 0) -+ pr_err("mmal-vchiq: VCHIQ close failed"); -+ -+ mutex_unlock(&instance->vchiq_mutex); -+ -+ vfree(instance->bulk_scratch); -+ -+ kfree(instance); -+ -+ return status; -+} -+ -+int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) -+{ -+ int status; -+ struct vchiq_mmal_instance *instance; -+ static VCHI_CONNECTION_T *vchi_connection; -+ static VCHI_INSTANCE_T vchi_instance; -+ SERVICE_CREATION_T params = { -+ VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), -+ VC_MMAL_SERVER_NAME, -+ vchi_connection, -+ 0, /* rx fifo size (unused) */ -+ 0, /* tx fifo size (unused) */ -+ service_callback, -+ NULL, /* service callback parameter */ -+ 1, /* unaligned bulk receives */ -+ 1, /* unaligned bulk transmits */ -+ 0 /* want crc check on bulk transfers */ -+ }; -+ -+ /* compile time checks to ensure structure size as they are -+ * directly (de)serialised from memory. -+ */ -+ -+ /* ensure the header structure has packed to the correct size */ -+ BUILD_BUG_ON(sizeof(struct mmal_msg_header) != 24); -+ -+ /* ensure message structure does not exceed maximum length */ -+ BUILD_BUG_ON(sizeof(struct mmal_msg) > MMAL_MSG_MAX_SIZE); -+ -+ /* mmal port struct is correct size */ -+ BUILD_BUG_ON(sizeof(struct mmal_port) != 64); -+ -+ /* create a vchi instance */ -+ status = vchi_initialise(&vchi_instance); -+ if (status) { -+ pr_err("Failed to initialise VCHI instance (status=%d)\n", -+ status); -+ return -EIO; -+ } -+ -+ status = vchi_connect(NULL, 0, vchi_instance); -+ if (status) { -+ pr_err("Failed to connect VCHI instance (status=%d)\n", status); -+ return -EIO; -+ } -+ -+ instance = kmalloc(sizeof(*instance), GFP_KERNEL); -+ memset(instance, 0, sizeof(*instance)); -+ -+ mutex_init(&instance->vchiq_mutex); -+ mutex_init(&instance->bulk_mutex); -+ -+ instance->bulk_scratch = vmalloc(PAGE_SIZE); -+ -+ params.callback_param = instance; -+ -+ status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); -+ if (status) { -+ pr_err("Failed to open VCHI service connection (status=%d)\n", -+ status); -+ goto err_close_services; -+ } -+ -+ vchi_service_release(instance->handle); -+ -+ *out_instance = instance; -+ -+ return 0; -+ -+err_close_services: -+ -+ vchi_service_close(instance->handle); -+ vfree(instance->bulk_scratch); -+ kfree(instance); -+ return -ENODEV; -+} -diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.h b/drivers/media/platform/bcm2835/mmal-vchiq.h -new file mode 100644 -index 0000000000000000000000000000000000000000..9d1d11e4a53e510c04a416d92d195a7df15012d5 ---- /dev/null -+++ b/drivers/media/platform/bcm2835/mmal-vchiq.h -@@ -0,0 +1,178 @@ -+/* -+ * Broadcom BM2835 V4L2 driver -+ * -+ * Copyright © 2013 Raspberry Pi (Trading) Ltd. -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file COPYING in the main directory of this archive -+ * for more details. -+ * -+ * Authors: Vincent Sanders -+ * Dave Stevenson -+ * Simon Mellor -+ * Luke Diamand -+ * -+ * MMAL interface to VCHIQ message passing -+ */ -+ -+#ifndef MMAL_VCHIQ_H -+#define MMAL_VCHIQ_H -+ -+#include "mmal-msg-format.h" -+ -+#define MAX_PORT_COUNT 4 -+ -+/* Maximum size of the format extradata. */ -+#define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128 -+ -+struct vchiq_mmal_instance; -+ -+enum vchiq_mmal_es_type { -+ MMAL_ES_TYPE_UNKNOWN, /**< Unknown elementary stream type */ -+ MMAL_ES_TYPE_CONTROL, /**< Elementary stream of control commands */ -+ MMAL_ES_TYPE_AUDIO, /**< Audio elementary stream */ -+ MMAL_ES_TYPE_VIDEO, /**< Video elementary stream */ -+ MMAL_ES_TYPE_SUBPICTURE /**< Sub-picture elementary stream */ -+}; -+ -+/* rectangle, used lots so it gets its own struct */ -+struct vchiq_mmal_rect { -+ s32 x; -+ s32 y; -+ s32 width; -+ s32 height; -+}; -+ -+struct vchiq_mmal_port_buffer { -+ unsigned int num; /* number of buffers */ -+ u32 size; /* size of buffers */ -+ u32 alignment; /* alignment of buffers */ -+}; -+ -+struct vchiq_mmal_port; -+ -+typedef void (*vchiq_mmal_buffer_cb)( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ int status, struct mmal_buffer *buffer, -+ unsigned long length, u32 mmal_flags, s64 dts, s64 pts); -+ -+struct vchiq_mmal_port { -+ bool enabled; -+ u32 handle; -+ u32 type; /* port type, cached to use on port info set */ -+ u32 index; /* port index, cached to use on port info set */ -+ -+ /* component port belongs to, allows simple deref */ -+ struct vchiq_mmal_component *component; -+ -+ struct vchiq_mmal_port *connected; /* port conencted to */ -+ -+ /* buffer info */ -+ struct vchiq_mmal_port_buffer minimum_buffer; -+ struct vchiq_mmal_port_buffer recommended_buffer; -+ struct vchiq_mmal_port_buffer current_buffer; -+ -+ /* stream format */ -+ struct mmal_es_format format; -+ /* elementry stream format */ -+ union mmal_es_specific_format es; -+ -+ /* data buffers to fill */ -+ struct list_head buffers; -+ /* lock to serialise adding and removing buffers from list */ -+ spinlock_t slock; -+ /* count of how many buffer header refils have failed because -+ * there was no buffer to satisfy them -+ */ -+ int buffer_underflow; -+ /* callback on buffer completion */ -+ vchiq_mmal_buffer_cb buffer_cb; -+ /* callback context */ -+ void *cb_ctx; -+}; -+ -+struct vchiq_mmal_component { -+ bool enabled; -+ u32 handle; /* VideoCore handle for component */ -+ u32 inputs; /* Number of input ports */ -+ u32 outputs; /* Number of output ports */ -+ u32 clocks; /* Number of clock ports */ -+ struct vchiq_mmal_port control; /* control port */ -+ struct vchiq_mmal_port input[MAX_PORT_COUNT]; /* input ports */ -+ struct vchiq_mmal_port output[MAX_PORT_COUNT]; /* output ports */ -+ struct vchiq_mmal_port clock[MAX_PORT_COUNT]; /* clock ports */ -+}; -+ -+ -+int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance); -+int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance); -+ -+/* Initialise a mmal component and its ports -+* -+*/ -+int vchiq_mmal_component_init( -+ struct vchiq_mmal_instance *instance, -+ const char *name, -+ struct vchiq_mmal_component **component_out); -+ -+int vchiq_mmal_component_finalise( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component); -+ -+int vchiq_mmal_component_enable( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component); -+ -+int vchiq_mmal_component_disable( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_component *component); -+ -+ -+ -+/* enable a mmal port -+ * -+ * enables a port and if a buffer callback provided enque buffer -+ * headers as apropriate for the port. -+ */ -+int vchiq_mmal_port_enable( -+ struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ vchiq_mmal_buffer_cb buffer_cb); -+ -+/* disable a port -+ * -+ * disable a port will dequeue any pending buffers -+ */ -+int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port); -+ -+ -+int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, -+ void *value, -+ u32 value_size); -+ -+int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ u32 parameter, -+ void *value, -+ u32 *value_size); -+ -+int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port); -+ -+int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *src, -+ struct vchiq_mmal_port *dst); -+ -+int vchiq_mmal_version(struct vchiq_mmal_instance *instance, -+ u32 *major_out, -+ u32 *minor_out); -+ -+int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, -+ struct vchiq_mmal_port *port, -+ struct mmal_buffer *buf); -+ -+#endif /* MMAL_VCHIQ_H */ - -From 6b480eb543d3fb86623e58d6d0f884f67f5ba804 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 052/122] scripts: Add mkknlimg and knlinfo scripts from tools - repo - -The Raspberry Pi firmware looks for a trailer on the kernel image to -determine whether it was compiled with Device Tree support enabled. -If the firmware finds a kernel without this trailer, or which has a -trailer indicating that it isn't DT-capable, it disables DT support -and reverts to using ATAGs. - -The mkknlimg utility adds that trailer, having first analysed the -image to look for signs of DT support and the kernel version string. - -knlinfo displays the contents of the trailer in the given kernel image. - -scripts/mkknlimg: Add support for ARCH_BCM2835 - -Add a new trailer field indicating whether this is an ARCH_BCM2835 -build, as opposed to MACH_BCM2708/9. If the loader finds this flag -is set it changes the default base dtb file name from bcm270x... -to bcm283y... - -Also update knlinfo to show the status of the field. - -scripts/mkknlimg: Improve ARCH_BCM2835 detection - -The board support code contains sufficient strings to be able to -distinguish 2708 vs. 2835 builds, so remove the check for -bcm2835-pm-wdt which could exist in either. - -Also, since the canned configuration is no longer built in (it's -a module), remove the config string checking. - -See: https://github.com/raspberrypi/linux/issues/1157 - -scripts: Multi-platform support for mkknlimg and knlinfo - -The firmware uses tags in the kernel trailer to choose which dtb file -to load. Current firmware loads bcm2835-*.dtb if the '283x' tag is true, -otherwise it loads bcm270*.dtb. This scheme breaks if an image supports -multiple platforms. - -This patch adds '270X' and '283X' tags to indicate support for RPi and -upstream platforms, respectively. '283x' (note lower case 'x') is left -for old firmware, and is only set if the image only supports upstream -builds. - -scripts/mkknlimg: Append a trailer for all input - -Now that the firmware assumes an unsigned kernel is DT-capable, it is -helpful to be able to mark a kernel as being non-DT-capable. - -Signed-off-by: Phil Elwell - -scripts/knlinfo: Decode DDTK atom - -Show the DDTK atom as being a boolean. - -Signed-off-by: Phil Elwell - -mkknlimg: Retain downstream-kernel detection - -With the death of ARCH_BCM2708 and ARCH_BCM2709, a new way is needed to -determine if this is a "downstream" build that wants the firmware to -load a bcm27xx .dtb. The vc_cma driver is used downstream but not -upstream, making vc_cma_init a suitable predicate symbol. ---- - scripts/knlinfo | 171 +++++++++++++++++++++++++++++++++++ - scripts/mkknlimg | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 435 insertions(+) - create mode 100755 scripts/knlinfo - create mode 100755 scripts/mkknlimg - -diff --git a/scripts/knlinfo b/scripts/knlinfo -new file mode 100755 -index 0000000000000000000000000000000000000000..263ec937eaa70b4fd00bff18599db7f22671753c ---- /dev/null -+++ b/scripts/knlinfo -@@ -0,0 +1,171 @@ -+#!/usr/bin/env perl -+# ---------------------------------------------------------------------- -+# knlinfo by Phil Elwell for Raspberry Pi -+# -+# (c) 2014,2015 Raspberry Pi (Trading) Limited -+# -+# Licensed under the terms of the GNU General Public License. -+# ---------------------------------------------------------------------- -+ -+use strict; -+use integer; -+ -+use Fcntl ":seek"; -+ -+my $trailer_magic = 'RPTL'; -+ -+my %atom_formats = -+( -+ 'DDTK' => \&format_bool, -+ 'DTOK' => \&format_bool, -+ 'KVer' => \&format_string, -+ '270X' => \&format_bool, -+ '283X' => \&format_bool, -+ '283x' => \&format_bool, -+); -+ -+if (@ARGV != 1) -+{ -+ print ("Usage: knlinfo \n"); -+ exit(1); -+} -+ -+my $kernel_file = $ARGV[0]; -+ -+ -+my ($atoms, $pos) = read_trailer($kernel_file); -+ -+exit(1) if (!$atoms); -+ -+printf("Kernel trailer found at %d/0x%x:\n", $pos, $pos); -+ -+foreach my $atom (@$atoms) -+{ -+ printf(" %s: %s\n", $atom->[0], format_atom($atom)); -+} -+ -+exit(0); -+ -+sub read_trailer -+{ -+ my ($kernel_file) = @_; -+ my $fh; -+ -+ if (!open($fh, '<', $kernel_file)) -+ { -+ print ("* Failed to open '$kernel_file'\n"); -+ return undef; -+ } -+ -+ if (!seek($fh, -12, SEEK_END)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ -+ my $last_bytes; -+ sysread($fh, $last_bytes, 12); -+ -+ my ($trailer_len, $data_len, $magic) = unpack('VVa4', $last_bytes); -+ -+ if (($magic ne $trailer_magic) || ($data_len != 4)) -+ { -+ print ("* no trailer\n"); -+ return undef; -+ } -+ if (!seek($fh, -12, SEEK_END)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ -+ $trailer_len -= 12; -+ -+ while ($trailer_len > 0) -+ { -+ if ($trailer_len < 8) -+ { -+ print ("* truncated atom header in trailer\n"); -+ return undef; -+ } -+ if (!seek($fh, -8, SEEK_CUR)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ $trailer_len -= 8; -+ -+ my $atom_hdr; -+ sysread($fh, $atom_hdr, 8); -+ my ($atom_len, $atom_type) = unpack('Va4', $atom_hdr); -+ -+ if ($trailer_len < $atom_len) -+ { -+ print ("* truncated atom data in trailer\n"); -+ return undef; -+ } -+ -+ my $rounded_len = (($atom_len + 3) & ~3); -+ if (!seek($fh, -(8 + $rounded_len), SEEK_CUR)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ $trailer_len -= $rounded_len; -+ -+ my $atom_data; -+ sysread($fh, $atom_data, $atom_len); -+ -+ if (!seek($fh, -$atom_len, SEEK_CUR)) -+ { -+ print ("* seek error in '$kernel_file'\n"); -+ return undef; -+ } -+ -+ push @$atoms, [ $atom_type, $atom_data ]; -+ } -+ -+ if (($$atoms[-1][0] eq "\x00\x00\x00\x00") && -+ ($$atoms[-1][1] eq "")) -+ { -+ pop @$atoms; -+ } -+ else -+ { -+ print ("* end marker missing from trailer\n"); -+ } -+ -+ return ($atoms, tell($fh)); -+} -+ -+sub format_atom -+{ -+ my ($atom) = @_; -+ -+ my $format_func = $atom_formats{$atom->[0]} || \&format_hex; -+ return $format_func->($atom->[1]); -+} -+ -+sub format_bool -+{ -+ my ($data) = @_; -+ return unpack('V', $data) ? 'y' : 'n'; -+} -+ -+sub format_int -+{ -+ my ($data) = @_; -+ return unpack('V', $data); -+} -+ -+sub format_string -+{ -+ my ($data) = @_; -+ return '"'.$data.'"'; -+} -+ -+sub format_hex -+{ -+ my ($data) = @_; -+ return unpack('H*', $data); -+} -diff --git a/scripts/mkknlimg b/scripts/mkknlimg -new file mode 100755 -index 0000000000000000000000000000000000000000..60206de7fa9a49bd027c635306674a29a568652f ---- /dev/null -+++ b/scripts/mkknlimg -@@ -0,0 +1,264 @@ -+#!/usr/bin/env perl -+# ---------------------------------------------------------------------- -+# mkknlimg by Phil Elwell for Raspberry Pi -+# based on extract-ikconfig by Dick Streefland -+# -+# (c) 2009,2010 Dick Streefland -+# (c) 2014,2015 Raspberry Pi (Trading) Limited -+# -+# Licensed under the terms of the GNU General Public License. -+# ---------------------------------------------------------------------- -+ -+use strict; -+use warnings; -+use integer; -+ -+use constant FLAG_PI => 0x01; -+use constant FLAG_DTOK => 0x02; -+use constant FLAG_DDTK => 0x04; -+use constant FLAG_270X => 0x08; -+use constant FLAG_283X => 0x10; -+ -+my $trailer_magic = 'RPTL'; -+ -+my $tmpfile1 = "/tmp/mkknlimg_$$.1"; -+my $tmpfile2 = "/tmp/mkknlimg_$$.2"; -+ -+my $dtok = 0; -+my $ddtk = 0; -+my $is_270x = 0; -+my $is_283x = 0; -+ -+while (@ARGV && ($ARGV[0] =~ /^-/)) -+{ -+ my $arg = shift(@ARGV); -+ if ($arg eq '--dtok') -+ { -+ $dtok = 1; -+ } -+ elsif ($arg eq '--ddtk') -+ { -+ $ddtk = 1; -+ } -+ elsif ($arg eq '--270x') -+ { -+ $is_270x = 1; -+ } -+ elsif ($arg eq '--283x') -+ { -+ $is_283x = 1; -+ } -+ else -+ { -+ print ("* Unknown option '$arg'\n"); -+ usage(); -+ } -+} -+ -+usage() if (@ARGV != 2); -+ -+my $kernel_file = $ARGV[0]; -+my $out_file = $ARGV[1]; -+ -+if (! -r $kernel_file) -+{ -+ print ("* File '$kernel_file' not found\n"); -+ usage(); -+} -+ -+my $wanted_strings = -+{ -+ 'bcm2708_fb' => FLAG_PI, -+ 'brcm,bcm2835-mmc' => FLAG_PI, -+ 'brcm,bcm2835-sdhost' => FLAG_PI, -+ 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, -+ 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, -+ 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, -+ 'of_cfs_init' => FLAG_DTOK | FLAG_DDTK, -+ 'vc_cma_init' => FLAG_PI | FLAG_270X, -+}; -+ -+my $res = try_extract($kernel_file, $tmpfile1); -+$res ||= try_decompress('\037\213\010', 'xy', 'gunzip', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('BZh', 'xy', 'bunzip2', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\211\114\132', 'xy', 'lzop -d', 0, -+ $kernel_file, $tmpfile1, $tmpfile2); -+$res ||= try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, -+ $kernel_file, $tmpfile1, $tmpfile2); -+ -+my $append_trailer; -+my $trailer; -+my $kver = '?'; -+ -+$append_trailer = 1; -+ -+if ($res) -+{ -+ $kver = $res->{'kver'} || '?'; -+ my $flags = $res->{'flags'}; -+ print("Version: $kver\n"); -+ -+ if ($flags & FLAG_PI) -+ { -+ $dtok ||= ($flags & FLAG_DTOK) != 0; -+ $is_270x ||= ($flags & FLAG_270X) != 0; -+ $is_283x ||= ($flags & FLAG_283X) != 0; -+ $ddtk ||= ($flags & FLAG_DDTK) != 0; -+ } -+ else -+ { -+ print ("* This doesn't look like a Raspberry Pi kernel.\n"); -+ } -+} -+elsif (!$dtok) -+{ -+ print ("* Is this a valid kernel?\n"); -+} -+ -+if ($append_trailer) -+{ -+ printf("DT: %s\n", $dtok ? "y" : "n"); -+ printf("DDT: %s\n", $ddtk ? "y" : "n"); -+ printf("270x: %s\n", $is_270x ? "y" : "n"); -+ printf("283x: %s\n", $is_283x ? "y" : "n"); -+ -+ my @atoms; -+ -+ push @atoms, [ $trailer_magic, pack('V', 0) ]; -+ push @atoms, [ 'KVer', $kver ]; -+ push @atoms, [ 'DTOK', pack('V', $dtok) ]; -+ push @atoms, [ 'DDTK', pack('V', $ddtk) ]; -+ push @atoms, [ '270X', pack('V', $is_270x) ]; -+ push @atoms, [ '283X', pack('V', $is_283x) ]; -+ push @atoms, [ '283x', pack('V', $is_283x && !$is_270x) ]; -+ -+ $trailer = pack_trailer(\@atoms); -+ $atoms[0]->[1] = pack('V', length($trailer)); -+ -+ $trailer = pack_trailer(\@atoms); -+} -+ -+my $ofh; -+my $total_len = 0; -+ -+if ($out_file eq $kernel_file) -+{ -+ die "* Failed to open '$out_file' for append\n" -+ if (!open($ofh, '>>', $out_file)); -+ $total_len = tell($ofh); -+} -+else -+{ -+ die "* Failed to open '$kernel_file'\n" -+ if (!open(my $ifh, '<', $kernel_file)); -+ die "* Failed to create '$out_file'\n" -+ if (!open($ofh, '>', $out_file)); -+ -+ my $copybuf; -+ while (1) -+ { -+ my $bytes = sysread($ifh, $copybuf, 64*1024); -+ last if (!$bytes); -+ syswrite($ofh, $copybuf, $bytes); -+ $total_len += $bytes; -+ } -+ close($ifh); -+} -+ -+if ($trailer) -+{ -+ # Pad to word-alignment -+ syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); -+ syswrite($ofh, $trailer); -+} -+ -+close($ofh); -+ -+exit($trailer ? 0 : 1); -+ -+END { -+ unlink($tmpfile1) if ($tmpfile1); -+ unlink($tmpfile2) if ($tmpfile2); -+} -+ -+ -+sub usage -+{ -+ print ("Usage: mkknlimg [--dtok] [--270x] [--283x] \n"); -+ exit(1); -+} -+ -+sub try_extract -+{ -+ my ($knl, $tmp) = @_; -+ -+ my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; -+ -+ return undef if (!$ver); -+ -+ chomp($ver); -+ -+ my $res = { 'kver'=>$ver }; -+ $res->{'flags'} = strings_to_flags($knl, $wanted_strings); -+ -+ return $res; -+} -+ -+ -+sub try_decompress -+{ -+ my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; -+ -+ my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; -+ if ($pos) -+ { -+ chomp($pos); -+ $pos = (split(/[\r\n]+/, $pos))[$idx]; -+ return undef if (!defined($pos)); -+ $pos =~ s/:.*[\r\n]*$//s; -+ my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; -+ my $err = (system($cmd) >> 8); -+ return undef if (($err != 0) && ($err != 2)); -+ -+ return try_extract($tmp2, $tmp1); -+ } -+ -+ return undef; -+} -+ -+sub strings_to_flags -+{ -+ my ($knl, $strings) = @_; -+ my $string_pattern = '^('.join('|', keys(%$strings)).')$'; -+ my $flags = 0; -+ -+ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; -+ foreach my $match (@matches) -+ { -+ chomp($match); -+ $flags |= $strings->{$match}; -+ } -+ -+ return $flags; -+} -+ -+sub pack_trailer -+{ -+ my ($atoms) = @_; -+ my $trailer = pack('VV', 0, 0); -+ for (my $i = $#$atoms; $i>=0; $i--) -+ { -+ my $atom = $atoms->[$i]; -+ $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); -+ } -+ return $trailer; -+} - -From 94cbd8ee19d8f0e25c4af4598b07b0c22c5083ae Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 10 Aug 2015 09:49:15 +0100 -Subject: [PATCH 053/122] scripts/dtc: Update to upstream version 1.4.1 - -Includes the new localfixups format. - -Signed-off-by: Phil Elwell - -scripts/dtc: Fix UMR causing corrupt dtbo overlay files - -struct fixup_entry is allocated from the heap but it's member -local_fixup_generated was never initialized. This lead to -corrupted dtbo files. - -Fix this by initializing local_fixup_generated to false. - -Signed-off-by: Matthias Reichl - -scripts/dtc: Only emit local fixups for overlays - -Signed-off-by: Phil Elwell ---- - scripts/dtc/checks.c | 106 +++++- - scripts/dtc/dtc-lexer.l | 5 + - scripts/dtc/dtc-lexer.lex.c_shipped | 537 +++++++++++++------------- - scripts/dtc/dtc-parser.tab.c_shipped | 714 ++++++++++++++++++----------------- - scripts/dtc/dtc-parser.tab.h_shipped | 46 +-- - scripts/dtc/dtc-parser.y | 22 +- - scripts/dtc/dtc.c | 9 +- - scripts/dtc/dtc.h | 40 ++ - scripts/dtc/flattree.c | 202 ++++++++++ - scripts/dtc/version_gen.h | 2 +- - 10 files changed, 1029 insertions(+), 654 deletions(-) - -diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c -index 386f9563313f713f896236814de35811d145d121..2164d8fe5f98f123bbf74aa25e69891b31bd8c64 100644 ---- a/scripts/dtc/checks.c -+++ b/scripts/dtc/checks.c -@@ -482,6 +482,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - struct node *node, struct property *prop) - { - struct marker *m = prop->val.markers; -+ struct fixup *f, **fp; -+ struct fixup_entry *fe, **fep; - struct node *refnode; - cell_t phandle; - -@@ -490,11 +492,70 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - - refnode = get_node_by_ref(dt, m->ref); - if (! refnode) { -- FAIL(c, "Reference to non-existent node or label \"%s\"\n", -- m->ref); -+ if (!dt->is_plugin) { -+ FAIL(c, "Reference to non-existent node or label \"%s\"\n", -+ m->ref); -+ continue; -+ } -+ -+ /* allocate fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ -+ /* search for an already existing fixup */ -+ for_each_fixup(dt, f) -+ if (strcmp(f->ref, m->ref) == 0) -+ break; -+ -+ /* no fixup found, add new */ -+ if (f == NULL) { -+ f = xmalloc(sizeof(*f)); -+ f->ref = m->ref; -+ f->entries = NULL; -+ f->next = NULL; -+ -+ /* add it to the tree */ -+ fp = &dt->fixups; -+ while (*fp) -+ fp = &(*fp)->next; -+ *fp = f; -+ } -+ -+ /* and now append fixup entry */ -+ fep = &f->entries; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ -+ /* mark the entry as unresolved */ -+ *((cell_t *)(prop->val.val + m->offset)) = -+ cpu_to_fdt32(0xdeadbeef); - continue; - } - -+ /* if it's a local reference, we need to record it */ -+ if (symbol_fixup_support && dt->is_plugin) { -+ -+ /* allocate a new local fixup entry */ -+ fe = xmalloc(sizeof(*fe)); -+ -+ fe->node = node; -+ fe->prop = prop; -+ fe->offset = m->offset; -+ fe->next = NULL; -+ fe->local_fixup_generated = false; -+ -+ /* append it to the local fixups */ -+ fep = &dt->local_fixups; -+ while (*fep) -+ fep = &(*fep)->next; -+ *fep = fe; -+ } -+ - phandle = get_node_phandle(dt, refnode); - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); - } -@@ -676,6 +737,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, - } - TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); - -+static void check_auto_label_phandles(struct check *c, struct node *dt, -+ struct node *node) -+{ -+ struct label *l; -+ struct symbol *s, **sp; -+ int has_label; -+ -+ if (!symbol_fixup_support) -+ return; -+ -+ has_label = 0; -+ for_each_label(node->labels, l) { -+ has_label = 1; -+ break; -+ } -+ -+ if (!has_label) -+ return; -+ -+ /* force allocation of a phandle for this node */ -+ (void)get_node_phandle(dt, node); -+ -+ /* add the symbol */ -+ for_each_label(node->labels, l) { -+ -+ s = xmalloc(sizeof(*s)); -+ s->label = l; -+ s->node = node; -+ s->next = NULL; -+ -+ /* add it to the symbols list */ -+ sp = &dt->symbols; -+ while (*sp) -+ sp = &((*sp)->next); -+ *sp = s; -+ } -+} -+NODE_WARNING(auto_label_phandles, NULL); -+ - static struct check *check_table[] = { - &duplicate_node_names, &duplicate_property_names, - &node_name_chars, &node_name_format, &property_name_chars, -@@ -696,6 +796,8 @@ static struct check *check_table[] = { - &avoid_default_addr_size, - &obsolete_chosen_interrupt_controller, - -+ &auto_label_phandles, -+ - &always_fail, - }; - -diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 790fbf6cf2d75349780a5c849cdb9cdb697f5019..40bbc87d0f1dcaafd7275670cc678b970397f232 100644 ---- a/scripts/dtc/dtc-lexer.l -+++ b/scripts/dtc/dtc-lexer.l -@@ -121,6 +121,11 @@ static void lexical_error(const char *fmt, ...); - return DT_V1; - } - -+<*>"/plugin/" { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ - <*>"/memreserve/" { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); -diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped -index ba525c2f9fc28f596452999eaa2a66116446dc58..15185255fafdbebf805ad2bb2c63f0fdef4c8776 100644 ---- a/scripts/dtc/dtc-lexer.lex.c_shipped -+++ b/scripts/dtc/dtc-lexer.lex.c_shipped -@@ -9,7 +9,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 39 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; - typedef struct yy_buffer_state *YY_BUFFER_STATE; - #endif - --#ifndef YY_TYPEDEF_YY_SIZE_T --#define YY_TYPEDEF_YY_SIZE_T --typedef size_t yy_size_t; --#endif -- --extern yy_size_t yyleng; -+extern int yyleng; - - extern FILE *yyin, *yyout; - -@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; - #define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) -- #define YY_LINENO_REWIND_TO(ptr) - - /* Return all but the first "n" matched characters back to the input stream. */ - #define yyless(n) \ -@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - -+#ifndef YY_TYPEDEF_YY_SIZE_T -+#define YY_TYPEDEF_YY_SIZE_T -+typedef size_t yy_size_t; -+#endif -+ - #ifndef YY_STRUCT_YY_BUFFER_STATE - #define YY_STRUCT_YY_BUFFER_STATE - struct yy_buffer_state -@@ -211,7 +210,7 @@ struct yy_buffer_state - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ -- yy_size_t yy_n_chars; -+ int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to -@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - - /* yy_hold_char holds the character lost when yytext is formed. */ - static char yy_hold_char; --static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ --yy_size_t yyleng; -+static int yy_n_chars; /* number of characters read into yy_ch_buf */ -+int yyleng; - - /* Points to current character in buffer. */ - static char *yy_c_buf_p = (char *) 0; -@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - - YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); - YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); --YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); -+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - - void *yyalloc (yy_size_t ); - void *yyrealloc (void *,yy_size_t ); -@@ -342,7 +341,7 @@ void yyfree (void * ); - - /* Begin user sect3 */ - --#define yywrap() 1 -+#define yywrap(n) 1 - #define YY_SKIP_YYWRAP - - typedef unsigned char YY_CHAR; -@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - --#define YY_NUM_RULES 30 --#define YY_END_OF_BUFFER 31 -+#define YY_NUM_RULES 31 -+#define YY_END_OF_BUFFER 32 - /* This struct is not used in this scanner, - but its presence is necessary. */ - struct yy_trans_info -@@ -382,25 +381,26 @@ struct yy_trans_info - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; --static yyconst flex_int16_t yy_accept[159] = -+static yyconst flex_int16_t yy_accept[166] = - { 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, -- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, -- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, -- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, -- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, -- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, -- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, -- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, -- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, -- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, -- -- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, -- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, -- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -- 5, 8, 0, 0, 0, 0, 7, 0 -+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, -+ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, -+ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, -+ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, -+ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, -+ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, -+ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, -+ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, -+ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, -+ -+ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, -+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, -+ 0, 0, 0, 8, 0 - } ; - - static yyconst flex_int32_t yy_ec[256] = -@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = - 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, - 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, - -- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, -- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, -- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, -+ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, -+ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, -+ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = - 1, 1, 1, 1, 1 - } ; - --static yyconst flex_int32_t yy_meta[47] = -+static yyconst flex_int32_t yy_meta[48] = - { 0, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, - 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, - 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, -- 8, 8, 8, 3, 1, 4 -+ 8, 8, 8, 8, 3, 1, 4 - } ; - --static yyconst flex_int16_t yy_base[173] = -+static yyconst flex_int16_t yy_base[180] = - { 0, -- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, -- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, -- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, -- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, -- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, -- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, -- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, -- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, -- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, -- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, -- -- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, -- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, -- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, -- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, -- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, -- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, -- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, -- 318, 326 -+ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, -+ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, -+ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, -+ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, -+ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, -+ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, -+ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, -+ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, -+ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, -+ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, -+ -+ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, -+ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, -+ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, -+ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, -+ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, -+ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, -+ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, -+ 281, 288, 292, 300, 308, 312, 318, 326, 334 - } ; - --static yyconst flex_int16_t yy_def[173] = -+static yyconst flex_int16_t yy_def[180] = - { 0, -- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, -- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, -- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, -- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, -- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, -- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, -- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, -- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, -- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158 -+ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, -+ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, -+ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, -+ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, -+ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, -+ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, -+ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, -+ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, -+ -+ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, -+ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_nxt[438] = -+static yyconst flex_int16_t yy_nxt[449] = - { 0, - 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, - 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, - 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, -- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, -- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, -- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, -- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, -- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, -- -- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, -- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, -- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, -- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, -- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, -- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, -- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, -- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, -- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, -- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, -- -- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, -- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, -- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, -- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, -- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, -- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, -- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, -- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, -- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, -- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, -- -- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, -- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, -- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, -- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, -- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, -- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, -- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, -- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, -- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, -- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, -+ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, -+ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, -+ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, -+ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, -+ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, -+ -+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -+ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, -+ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, -+ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, -+ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, -+ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, -+ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, -+ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, -+ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, -+ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, -+ -+ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, -+ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, -+ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, -+ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, -+ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, -+ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, -+ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, -+ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, -+ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, -+ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, -+ -+ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, -+ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, -+ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, -+ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, -+ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, -+ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, -+ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, -+ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, -+ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, -+ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, -+ -+ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_chk[438] = -+static yyconst flex_int16_t yy_chk[449] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, -- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, -- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, -+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, -+ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, -+ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, -- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, -- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, -- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, -- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, -- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, -- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, -- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, -- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, -- -- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, -- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, -- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, -- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, -- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, -- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, -- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, -- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, -- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, -- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, -- -- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, -- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, -- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, -- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, -- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, -- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, -- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, -- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, -+ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, -+ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, -+ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, -+ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, -+ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, -+ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, -+ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, -+ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, -+ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, -+ -+ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, -+ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, -+ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, -+ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, -+ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, -+ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, -+ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, -+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, -+ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, -+ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, -+ -+ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, -+ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, -+ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, -+ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, -+ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, -+ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, -+ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, -+ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, -+ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, - 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - - static yy_state_type yy_last_accepting_state; -@@ -662,7 +664,7 @@ static int dts_version = 1; - static void push_input_file(const char *filename); - static bool pop_input_file(void); - static void lexical_error(const char *fmt, ...); --#line 666 "dtc-lexer.lex.c" -+#line 668 "dtc-lexer.lex.c" - - #define INITIAL 0 - #define BYTESTRING 1 -@@ -704,7 +706,7 @@ FILE *yyget_out (void ); - - void yyset_out (FILE * out_str ); - --yy_size_t yyget_leng (void ); -+int yyget_leng (void ); - - char *yyget_text (void ); - -@@ -853,6 +855,10 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - -+#line 68 "dtc-lexer.l" -+ -+#line 861 "dtc-lexer.lex.c" -+ - if ( !(yy_init) ) - { - (yy_init) = 1; -@@ -879,11 +885,6 @@ YY_DECL - yy_load_buffer_state( ); - } - -- { --#line 68 "dtc-lexer.l" -- --#line 886 "dtc-lexer.lex.c" -- - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); -@@ -901,7 +902,7 @@ YY_DECL - yy_match: - do - { -- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; -+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; -@@ -910,13 +911,13 @@ yy_match: - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } -- while ( yy_current_state != 158 ); -+ while ( yy_current_state != 165 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - -@@ -951,39 +952,31 @@ case 2: - YY_RULE_SETUP - #line 75 "dtc-lexer.l" - { -- char *line, *fnstart, *fnend; -- struct data fn; -+ char *line, *tmp, *fn; - /* skip text before line # */ - line = yytext; - while (!isdigit((unsigned char)*line)) - line++; -- -- /* regexp ensures that first and list " -- * in the whole yytext are those at -- * beginning and end of the filename string */ -- fnstart = memchr(yytext, '"', yyleng); -- for (fnend = yytext + yyleng - 1; -- *fnend != '"'; fnend--) -- ; -- assert(fnstart && fnend && (fnend > fnstart)); -- -- fn = data_copy_escape_string(fnstart + 1, -- fnend - fnstart - 1); -- -- /* Don't allow nuls in filenames */ -- if (memchr(fn.val, '\0', fn.len - 1)) -- lexical_error("nul in line number directive"); -- -+ /* skip digits in line # */ -+ tmp = line; -+ while (!isspace((unsigned char)*tmp)) -+ tmp++; -+ /* "NULL"-terminate line # */ -+ *tmp = '\0'; -+ /* start of filename */ -+ fn = strchr(tmp + 1, '"') + 1; -+ /* strip trailing " from filename */ -+ tmp = strchr(fn, '"'); -+ *tmp = 0; - /* -1 since #line is the number of the next line */ -- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); -- data_free(fn); -+ srcpos_set_line(xstrdup(fn), atoi(line) - 1); - } - YY_BREAK - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(BYTESTRING): - case YY_STATE_EOF(PROPNODENAME): - case YY_STATE_EOF(V1): --#line 104 "dtc-lexer.l" -+#line 96 "dtc-lexer.l" - { - if (!pop_input_file()) { - yyterminate(); -@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): - case 3: - /* rule 3 can match eol */ - YY_RULE_SETUP --#line 110 "dtc-lexer.l" -+#line 102 "dtc-lexer.l" - { - DPRINT("String: %s\n", yytext); - yylval.data = data_copy_escape_string(yytext+1, -@@ -1003,7 +996,7 @@ YY_RULE_SETUP - YY_BREAK - case 4: - YY_RULE_SETUP --#line 117 "dtc-lexer.l" -+#line 109 "dtc-lexer.l" - { - DPRINT("Keyword: /dts-v1/\n"); - dts_version = 1; -@@ -1013,25 +1006,33 @@ YY_RULE_SETUP - YY_BREAK - case 5: - YY_RULE_SETUP --#line 124 "dtc-lexer.l" -+#line 116 "dtc-lexer.l" -+{ -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ YY_BREAK -+case 6: -+YY_RULE_SETUP -+#line 121 "dtc-lexer.l" - { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); - return DT_MEMRESERVE; - } - YY_BREAK --case 6: -+case 7: - YY_RULE_SETUP --#line 130 "dtc-lexer.l" -+#line 127 "dtc-lexer.l" - { - DPRINT("Keyword: /bits/\n"); - BEGIN_DEFAULT(); - return DT_BITS; - } - YY_BREAK --case 7: -+case 8: - YY_RULE_SETUP --#line 136 "dtc-lexer.l" -+#line 133 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-property/\n"); - DPRINT("\n"); -@@ -1039,9 +1040,9 @@ YY_RULE_SETUP - return DT_DEL_PROP; - } - YY_BREAK --case 8: -+case 9: - YY_RULE_SETUP --#line 143 "dtc-lexer.l" -+#line 140 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-node/\n"); - DPRINT("\n"); -@@ -1049,9 +1050,9 @@ YY_RULE_SETUP - return DT_DEL_NODE; - } - YY_BREAK --case 9: -+case 10: - YY_RULE_SETUP --#line 150 "dtc-lexer.l" -+#line 147 "dtc-lexer.l" - { - DPRINT("Label: %s\n", yytext); - yylval.labelref = xstrdup(yytext); -@@ -1059,9 +1060,9 @@ YY_RULE_SETUP - return DT_LABEL; - } - YY_BREAK --case 10: -+case 11: - YY_RULE_SETUP --#line 157 "dtc-lexer.l" -+#line 154 "dtc-lexer.l" - { - char *e; - DPRINT("Integer Literal: '%s'\n", yytext); -@@ -1069,10 +1070,7 @@ YY_RULE_SETUP - errno = 0; - yylval.integer = strtoull(yytext, &e, 0); - -- if (*e && e[strspn(e, "UL")]) { -- lexical_error("Bad integer literal '%s'", -- yytext); -- } -+ assert(!(*e) || !e[strspn(e, "UL")]); - - if (errno == ERANGE) - lexical_error("Integer literal '%s' out of range", -@@ -1084,10 +1082,10 @@ YY_RULE_SETUP - return DT_LITERAL; - } - YY_BREAK --case 11: --/* rule 11 can match eol */ -+case 12: -+/* rule 12 can match eol */ - YY_RULE_SETUP --#line 179 "dtc-lexer.l" -+#line 173 "dtc-lexer.l" - { - struct data d; - DPRINT("Character literal: %s\n", yytext); -@@ -1109,18 +1107,18 @@ YY_RULE_SETUP - return DT_CHAR_LITERAL; - } - YY_BREAK --case 12: -+case 13: - YY_RULE_SETUP --#line 200 "dtc-lexer.l" -+#line 194 "dtc-lexer.l" - { /* label reference */ - DPRINT("Ref: %s\n", yytext+1); - yylval.labelref = xstrdup(yytext+1); - return DT_REF; - } - YY_BREAK --case 13: -+case 14: - YY_RULE_SETUP --#line 206 "dtc-lexer.l" -+#line 200 "dtc-lexer.l" - { /* new-style path reference */ - yytext[yyleng-1] = '\0'; - DPRINT("Ref: %s\n", yytext+2); -@@ -1128,27 +1126,27 @@ YY_RULE_SETUP - return DT_REF; - } - YY_BREAK --case 14: -+case 15: - YY_RULE_SETUP --#line 213 "dtc-lexer.l" -+#line 207 "dtc-lexer.l" - { - yylval.byte = strtol(yytext, NULL, 16); - DPRINT("Byte: %02x\n", (int)yylval.byte); - return DT_BYTE; - } - YY_BREAK --case 15: -+case 16: - YY_RULE_SETUP --#line 219 "dtc-lexer.l" -+#line 213 "dtc-lexer.l" - { - DPRINT("/BYTESTRING\n"); - BEGIN_DEFAULT(); - return ']'; - } - YY_BREAK --case 16: -+case 17: - YY_RULE_SETUP --#line 225 "dtc-lexer.l" -+#line 219 "dtc-lexer.l" - { - DPRINT("PropNodeName: %s\n", yytext); - yylval.propnodename = xstrdup((yytext[0] == '\\') ? -@@ -1157,75 +1155,75 @@ YY_RULE_SETUP - return DT_PROPNODENAME; - } - YY_BREAK --case 17: -+case 18: - YY_RULE_SETUP --#line 233 "dtc-lexer.l" -+#line 227 "dtc-lexer.l" - { - DPRINT("Binary Include\n"); - return DT_INCBIN; - } - YY_BREAK --case 18: --/* rule 18 can match eol */ --YY_RULE_SETUP --#line 238 "dtc-lexer.l" --/* eat whitespace */ -- YY_BREAK - case 19: - /* rule 19 can match eol */ - YY_RULE_SETUP --#line 239 "dtc-lexer.l" --/* eat C-style comments */ -+#line 232 "dtc-lexer.l" -+/* eat whitespace */ - YY_BREAK - case 20: - /* rule 20 can match eol */ - YY_RULE_SETUP --#line 240 "dtc-lexer.l" --/* eat C++-style comments */ -+#line 233 "dtc-lexer.l" -+/* eat C-style comments */ - YY_BREAK - case 21: -+/* rule 21 can match eol */ - YY_RULE_SETUP --#line 242 "dtc-lexer.l" --{ return DT_LSHIFT; }; -+#line 234 "dtc-lexer.l" -+/* eat C++-style comments */ - YY_BREAK - case 22: - YY_RULE_SETUP --#line 243 "dtc-lexer.l" --{ return DT_RSHIFT; }; -+#line 236 "dtc-lexer.l" -+{ return DT_LSHIFT; }; - YY_BREAK - case 23: - YY_RULE_SETUP --#line 244 "dtc-lexer.l" --{ return DT_LE; }; -+#line 237 "dtc-lexer.l" -+{ return DT_RSHIFT; }; - YY_BREAK - case 24: - YY_RULE_SETUP --#line 245 "dtc-lexer.l" --{ return DT_GE; }; -+#line 238 "dtc-lexer.l" -+{ return DT_LE; }; - YY_BREAK - case 25: - YY_RULE_SETUP --#line 246 "dtc-lexer.l" --{ return DT_EQ; }; -+#line 239 "dtc-lexer.l" -+{ return DT_GE; }; - YY_BREAK - case 26: - YY_RULE_SETUP --#line 247 "dtc-lexer.l" --{ return DT_NE; }; -+#line 240 "dtc-lexer.l" -+{ return DT_EQ; }; - YY_BREAK - case 27: - YY_RULE_SETUP --#line 248 "dtc-lexer.l" --{ return DT_AND; }; -+#line 241 "dtc-lexer.l" -+{ return DT_NE; }; - YY_BREAK - case 28: - YY_RULE_SETUP --#line 249 "dtc-lexer.l" --{ return DT_OR; }; -+#line 242 "dtc-lexer.l" -+{ return DT_AND; }; - YY_BREAK - case 29: - YY_RULE_SETUP --#line 251 "dtc-lexer.l" -+#line 243 "dtc-lexer.l" -+{ return DT_OR; }; -+ YY_BREAK -+case 30: -+YY_RULE_SETUP -+#line 245 "dtc-lexer.l" - { - DPRINT("Char: %c (\\x%02x)\n", yytext[0], - (unsigned)yytext[0]); -@@ -1241,12 +1239,12 @@ YY_RULE_SETUP - return yytext[0]; - } - YY_BREAK --case 30: -+case 31: - YY_RULE_SETUP --#line 266 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - ECHO; - YY_BREAK --#line 1250 "dtc-lexer.lex.c" -+#line 1248 "dtc-lexer.lex.c" - - case YY_END_OF_BUFFER: - { -@@ -1376,7 +1374,6 @@ ECHO; - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -- } /* end of user's declarations */ - } /* end of yylex */ - - /* yy_get_next_buffer - try to read in a new buffer -@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) - - else - { -- yy_size_t num_to_read = -+ int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ -- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; -+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { -- yy_size_t new_size = b->yy_buf_size * 2; -+ int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; -@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), -- (yy_n_chars), num_to_read ); -+ (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } -@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -- yy_is_jam = (yy_current_state == 158); -+ yy_is_jam = (yy_current_state == 165); - -- return yy_is_jam ? 0 : yy_current_state; -+ return yy_is_jam ? 0 : yy_current_state; - } - - #ifndef YY_NO_INPUT -@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) - - else - { /* need more input */ -- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); -+ int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) -@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) - */ - static void yyensure_buffer_stack (void) - { -- yy_size_t num_to_alloc; -+ int num_to_alloc; - - if (!(yy_buffer_stack)) { - -@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) - * - * @return the newly allocated buffer state object. - */ --YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; -- yy_size_t i; -+ int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; -@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) - /** Get the length of the current token. - * - */ --yy_size_t yyget_leng (void) -+int yyget_leng (void) - { - return yyleng; - } -@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 265 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - - - -diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped -index 31cec50a12650a254a639a6a291ce74f07a0e2c2..844c4628962d0e3e2860edf1315bec4e21b7a810 100644 ---- a/scripts/dtc/dtc-parser.tab.c_shipped -+++ b/scripts/dtc/dtc-parser.tab.c_shipped -@@ -65,6 +65,7 @@ - #line 20 "dtc-parser.y" /* yacc.c:339 */ - - #include -+#include - - #include "dtc.h" - #include "srcpos.h" -@@ -80,7 +81,7 @@ extern void yyerror(char const *s); - extern struct boot_info *the_boot_info; - extern bool treesource_error; - --#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ -+#line 85 "dtc-parser.tab.c" /* yacc.c:339 */ - - # ifndef YY_NULLPTR - # if defined __cplusplus && 201103L <= __cplusplus -@@ -116,26 +117,27 @@ extern int yydebug; - enum yytokentype - { - DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 - }; - #endif - -@@ -144,7 +146,7 @@ extern int yydebug; - typedef union YYSTYPE YYSTYPE; - union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:355 */ -+#line 39 "dtc-parser.y" /* yacc.c:355 */ - - char *propnodename; - char *labelref; -@@ -162,8 +164,9 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - --#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ -+#line 170 "dtc-parser.tab.c" /* yacc.c:355 */ - }; - # define YYSTYPE_IS_TRIVIAL 1 - # define YYSTYPE_IS_DECLARED 1 -@@ -192,7 +195,7 @@ int yyparse (void); - - /* Copy the second part of user declarations. */ - --#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ -+#line 199 "dtc-parser.tab.c" /* yacc.c:358 */ - - #ifdef short - # undef short -@@ -439,18 +442,18 @@ union yyalloc - #define YYLAST 136 - - /* YYNTOKENS -- Number of terminals. */ --#define YYNTOKENS 47 -+#define YYNTOKENS 48 - /* YYNNTS -- Number of nonterminals. */ --#define YYNNTS 28 -+#define YYNNTS 29 - /* YYNRULES -- Number of rules. */ --#define YYNRULES 80 -+#define YYNRULES 82 - /* YYNSTATES -- Number of states. */ --#define YYNSTATES 144 -+#define YYNSTATES 147 - - /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ - #define YYUNDEFTOK 2 --#define YYMAXUTOK 278 -+#define YYMAXUTOK 279 - - #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -@@ -462,16 +465,16 @@ static const yytype_uint8 yytranslate[] = - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, -- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, -- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, -- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, -+ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, -+ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, -+ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, -+ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, -+ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, -+ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -@@ -486,22 +489,22 @@ static const yytype_uint8 yytranslate[] = - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -- 15, 16, 17, 18, 19, 20, 21, 22, 23 -+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - }; - - #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ - static const yytype_uint16 yyrline[] = - { -- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, -- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, -- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, -- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, -- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, -- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, -- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, -- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, -- 481 -+ 0, 108, 108, 118, 121, 129, 132, 139, 143, 151, -+ 155, 160, 171, 181, 196, 204, 207, 214, 218, 222, -+ 226, 234, 238, 242, 246, 250, 266, 276, 284, 287, -+ 291, 298, 314, 319, 338, 352, 359, 360, 361, 368, -+ 372, 373, 377, 378, 382, 383, 387, 388, 392, 393, -+ 397, 398, 402, 403, 404, 408, 409, 410, 411, 412, -+ 416, 417, 418, 422, 423, 424, 428, 429, 430, 431, -+ 435, 436, 437, 438, 443, 446, 450, 458, 461, 465, -+ 473, 477, 481 - }; - #endif - -@@ -510,19 +513,19 @@ static const yytype_uint16 yyrline[] = - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ - static const char *const yytname[] = - { -- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", -- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", -- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", -- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", -- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", -- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", -- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", -- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", -- "integer_expr", "integer_trinary", "integer_or", "integer_and", -- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", -- "integer_rela", "integer_shift", "integer_add", "integer_mul", -- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR -+ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", -+ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", -+ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", -+ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", -+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", -+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", -+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -+ "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef", -+ "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix", -+ "integer_prim", "integer_expr", "integer_trinary", "integer_or", -+ "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", -+ "integer_eq", "integer_rela", "integer_shift", "integer_add", -+ "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR - }; - #endif - -@@ -533,16 +536,16 @@ static const yytype_uint16 yytoknum[] = - { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, -- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, -- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, -- 38, 43, 45, 42, 37, 126, 33 -+ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, -+ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, -+ 94, 38, 43, 45, 42, 37, 126, 33 - }; - # endif - --#define YYPACT_NINF -81 -+#define YYPACT_NINF -84 - - #define yypact_value_is_default(Yystate) \ -- (!!((Yystate) == (-81))) -+ (!!((Yystate) == (-84))) - - #define YYTABLE_NINF -1 - -@@ -553,21 +556,21 @@ static const yytype_uint16 yytoknum[] = - STATE-NUM. */ - static const yytype_int8 yypact[] = - { -- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, -- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, -- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, -- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, -- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, -- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, -- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, -- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, -- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, -- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, -- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, -- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, -- 74, 25, 75, -81 -+ 15, -12, 35, 42, -84, 27, 9, -84, 24, 9, -+ 43, 9, -84, -84, -10, 24, -84, 60, 44, -84, -+ -10, -10, -10, -84, 55, -84, -7, 52, 53, 51, -+ 54, 10, 2, 38, 37, -4, -84, 68, -84, -84, -+ 71, 73, 60, 60, -84, -84, -84, -84, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -+ -10, -10, -10, -10, -10, -10, -10, -84, 56, 72, -+ 60, -84, -84, 52, 61, 53, 51, 54, 10, 2, -+ 2, 38, 38, 38, 38, 37, 37, -4, -4, -84, -+ -84, -84, 81, 83, 34, 56, -84, 74, 56, -84, -+ -84, -10, 76, 78, -84, -84, -84, -84, -84, 79, -+ -84, -84, -84, -84, -84, -6, 3, -84, -84, -84, -+ -84, 87, -84, -84, -84, 75, -84, -84, 32, 70, -+ 86, 36, -84, -84, -84, -84, -84, 47, -84, -84, -+ -84, 24, -84, 77, 24, 80, -84 - }; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. -@@ -575,37 +578,37 @@ static const yytype_int8 yypact[] = - means the default is an error. */ - static const yytype_uint8 yydefact[] = - { -- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, -- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, -- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, -- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, -- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, -+ 0, 0, 0, 3, 1, 0, 5, 4, 0, 0, -+ 0, 5, 36, 37, 0, 0, 8, 0, 2, 6, -+ 0, 0, 0, 70, 0, 39, 40, 42, 44, 46, -+ 48, 50, 52, 55, 62, 65, 69, 0, 15, 9, -+ 0, 0, 0, 0, 71, 72, 73, 38, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, -- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, -- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, -- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, -- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, -- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, -- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, -- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, -- 0, 0, 0, 23 -+ 0, 0, 0, 0, 0, 0, 0, 7, 77, 0, -+ 0, 12, 10, 43, 0, 45, 47, 49, 51, 53, -+ 54, 58, 59, 57, 56, 60, 61, 63, 64, 67, -+ 66, 68, 0, 0, 0, 0, 16, 0, 77, 13, -+ 11, 0, 0, 0, 18, 28, 80, 20, 82, 0, -+ 79, 78, 41, 19, 81, 0, 0, 14, 27, 17, -+ 29, 0, 21, 30, 24, 0, 74, 32, 0, 0, -+ 0, 0, 35, 34, 22, 33, 31, 0, 75, 76, -+ 23, 0, 26, 0, 0, 0, 25 - }; - - /* YYPGOTO[NTERM-NUM]. */ - static const yytype_int8 yypgoto[] = - { -- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, -- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, -- 37, 27, 34, 38, -14, -81, 22, 24 -+ -84, -84, -84, 98, 101, -84, -41, -84, -83, -84, -+ -84, -84, -8, 63, 12, -84, 66, 67, 65, 69, -+ 82, 29, 18, 25, 26, -17, -84, 20, 28 - }; - - /* YYDEFGOTO[NTERM-NUM]. */ - static const yytype_int16 yydefgoto[] = - { -- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, -- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, -- 29, 30, 31, 32, 33, 128, 94, 95 -+ -1, 2, 6, 10, 11, 18, 39, 68, 96, 115, -+ 116, 128, 23, 24, 25, 26, 27, 28, 29, 30, -+ 31, 32, 33, 34, 35, 36, 131, 97, 98 - }; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If -@@ -613,87 +616,87 @@ static const yytype_int16 yydefgoto[] = - number is the opposite. If YYTABLE_NINF, syntax error. */ - static const yytype_uint8 yytable[] = - { -- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, -- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, -- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, -- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, -- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, -- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, -- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, -- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, -- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, -- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, -- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, -- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, -- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, -- 0, 0, 75, 140, 0, 0, 142 -+ 15, 71, 72, 44, 45, 46, 48, 37, 12, 13, -+ 56, 57, 107, 3, 8, 110, 118, 121, 1, 119, -+ 54, 55, 64, 14, 122, 123, 124, 125, 120, 100, -+ 49, 9, 58, 20, 126, 4, 21, 22, 59, 127, -+ 65, 66, 12, 13, 60, 61, 5, 89, 90, 91, -+ 12, 13, 7, 106, 132, 133, 138, 14, 139, 104, -+ 40, 38, 134, 105, 50, 14, 41, 42, 140, 17, -+ 43, 92, 93, 94, 81, 82, 83, 84, 95, 62, -+ 63, 141, 142, 79, 80, 85, 86, 38, 87, 88, -+ 47, 52, 51, 67, 69, 53, 70, 99, 102, 101, -+ 103, 113, 109, 114, 117, 129, 136, 137, 130, 19, -+ 16, 144, 74, 112, 73, 146, 76, 75, 111, 0, -+ 135, 77, 0, 108, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 143, 0, 78, 145 - }; - - static const yytype_int16 yycheck[] = - { -- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, -- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, -- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, -- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, -- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, -- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, -- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, -- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, -- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, -- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, -- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, -- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, -- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, -- -1, -1, 50, 138, -1, -1, 141 -+ 8, 42, 43, 20, 21, 22, 13, 15, 18, 19, -+ 8, 9, 95, 25, 5, 98, 22, 14, 3, 25, -+ 10, 11, 26, 33, 21, 22, 23, 24, 34, 70, -+ 37, 22, 30, 43, 31, 0, 46, 47, 36, 36, -+ 44, 45, 18, 19, 6, 7, 4, 64, 65, 66, -+ 18, 19, 25, 94, 22, 23, 20, 33, 22, 25, -+ 16, 27, 30, 29, 12, 33, 22, 23, 32, 26, -+ 26, 15, 16, 17, 56, 57, 58, 59, 22, 42, -+ 43, 34, 35, 54, 55, 60, 61, 27, 62, 63, -+ 35, 40, 39, 25, 23, 41, 23, 25, 17, 38, -+ 17, 25, 28, 25, 25, 18, 36, 21, 33, 11, -+ 9, 34, 49, 101, 48, 35, 51, 50, 98, -1, -+ 128, 52, -1, 95, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, 141, -1, 53, 144 - }; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ - static const yytype_uint8 yystos[] = - { -- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, -- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, -- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, -- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, -- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, -- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, -- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, -- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, -- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, -- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, -- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, -- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, -- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, -- 58, 33, 58, 34 -+ 0, 3, 49, 25, 0, 4, 50, 25, 5, 22, -+ 51, 52, 18, 19, 33, 60, 52, 26, 53, 51, -+ 43, 46, 47, 60, 61, 62, 63, 64, 65, 66, -+ 67, 68, 69, 70, 71, 72, 73, 60, 27, 54, -+ 16, 22, 23, 26, 73, 73, 73, 35, 13, 37, -+ 12, 39, 40, 41, 10, 11, 8, 9, 30, 36, -+ 6, 7, 42, 43, 26, 44, 45, 25, 55, 23, -+ 23, 54, 54, 64, 61, 65, 66, 67, 68, 69, -+ 69, 70, 70, 70, 70, 71, 71, 72, 72, 73, -+ 73, 73, 15, 16, 17, 22, 56, 75, 76, 25, -+ 54, 38, 17, 17, 25, 29, 54, 56, 76, 28, -+ 56, 75, 62, 25, 25, 57, 58, 25, 22, 25, -+ 34, 14, 21, 22, 23, 24, 31, 36, 59, 18, -+ 33, 74, 22, 23, 30, 60, 36, 21, 20, 22, -+ 32, 34, 35, 60, 34, 60, 35 - }; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ - static const yytype_uint8 yyr1[] = - { -- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, -- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, -- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, -- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, -- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, -- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, -- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, -- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, -- 74 -+ 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, -+ 53, 53, 53, 53, 54, 55, 55, 56, 56, 56, -+ 56, 57, 57, 57, 57, 57, 57, 57, 58, 58, -+ 58, 59, 59, 59, 59, 59, 60, 60, 60, 61, -+ 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, -+ 67, 67, 68, 68, 68, 69, 69, 69, 69, 69, -+ 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, -+ 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, -+ 76, 76, 76 - }; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ - static const yytype_uint8 yyr2[] = - { -- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, -- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, -- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, -- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, -- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, -- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, -- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, -- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, -- 2 -+ 0, 2, 5, 0, 2, 0, 2, 4, 2, 2, -+ 3, 4, 3, 4, 5, 0, 2, 4, 2, 3, -+ 2, 2, 3, 4, 2, 9, 5, 2, 0, 2, -+ 2, 3, 1, 2, 2, 2, 1, 1, 3, 1, -+ 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, -+ 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, -+ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, -+ 1, 2, 2, 2, 0, 2, 2, 0, 2, 2, -+ 2, 3, 2 - }; - - -@@ -1463,65 +1466,82 @@ yyreduce: - switch (yyn) - { - case 2: --#line 105 "dtc-parser.y" /* yacc.c:1646 */ -+#line 109 "dtc-parser.y" /* yacc.c:1646 */ - { -+ (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin); - the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), - guess_boot_cpuid((yyvsp[0].node))); - } --#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1476 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 3: --#line 113 "dtc-parser.y" /* yacc.c:1646 */ -+#line 118 "dtc-parser.y" /* yacc.c:1646 */ - { -- (yyval.re) = NULL; -+ (yyval.is_plugin) = false; - } --#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1484 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 4: --#line 117 "dtc-parser.y" /* yacc.c:1646 */ -+#line 122 "dtc-parser.y" /* yacc.c:1646 */ - { -- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -+ (yyval.is_plugin) = true; - } --#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1492 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 5: --#line 124 "dtc-parser.y" /* yacc.c:1646 */ -+#line 129 "dtc-parser.y" /* yacc.c:1646 */ - { -- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -+ (yyval.re) = NULL; - } --#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1500 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - case 6: --#line 128 "dtc-parser.y" /* yacc.c:1646 */ -+#line 133 "dtc-parser.y" /* yacc.c:1646 */ -+ { -+ (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -+ } -+#line 1508 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ break; -+ -+ case 7: -+#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ { -+ (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -+ } -+#line 1516 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ break; -+ -+ case 8: -+#line 144 "dtc-parser.y" /* yacc.c:1646 */ - { - add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); - (yyval.re) = (yyvsp[0].re); - } --#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1525 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 7: --#line 136 "dtc-parser.y" /* yacc.c:1646 */ -+ case 9: -+#line 152 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = name_node((yyvsp[0].node), ""); - } --#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1533 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 8: --#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ case 10: -+#line 156 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); - } --#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1541 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 9: --#line 145 "dtc-parser.y" /* yacc.c:1646 */ -+ case 11: -+#line 161 "dtc-parser.y" /* yacc.c:1646 */ - { - struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -@@ -1532,11 +1552,11 @@ yyreduce: - ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); - (yyval.node) = (yyvsp[-3].node); - } --#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 10: --#line 156 "dtc-parser.y" /* yacc.c:1646 */ -+ case 12: -+#line 172 "dtc-parser.y" /* yacc.c:1646 */ - { - struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); - -@@ -1546,11 +1566,11 @@ yyreduce: - ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); - (yyval.node) = (yyvsp[-2].node); - } --#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1570 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 11: --#line 166 "dtc-parser.y" /* yacc.c:1646 */ -+ case 13: -+#line 182 "dtc-parser.y" /* yacc.c:1646 */ - { - struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -@@ -1562,100 +1582,100 @@ yyreduce: - - (yyval.node) = (yyvsp[-3].node); - } --#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1586 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 12: --#line 181 "dtc-parser.y" /* yacc.c:1646 */ -+ case 14: -+#line 197 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); - } --#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1594 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 13: --#line 188 "dtc-parser.y" /* yacc.c:1646 */ -+ case 15: -+#line 204 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.proplist) = NULL; - } --#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1602 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 14: --#line 192 "dtc-parser.y" /* yacc.c:1646 */ -+ case 16: -+#line 208 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); - } --#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1610 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 15: --#line 199 "dtc-parser.y" /* yacc.c:1646 */ -+ case 17: -+#line 215 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); - } --#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1618 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 16: --#line 203 "dtc-parser.y" /* yacc.c:1646 */ -+ case 18: -+#line 219 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); - } --#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1626 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 17: --#line 207 "dtc-parser.y" /* yacc.c:1646 */ -+ case 19: -+#line 223 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); - } --#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1634 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 18: --#line 211 "dtc-parser.y" /* yacc.c:1646 */ -+ case 20: -+#line 227 "dtc-parser.y" /* yacc.c:1646 */ - { - add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); - (yyval.prop) = (yyvsp[0].prop); - } --#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1643 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 19: --#line 219 "dtc-parser.y" /* yacc.c:1646 */ -+ case 21: -+#line 235 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); - } --#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1651 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 20: --#line 223 "dtc-parser.y" /* yacc.c:1646 */ -+ case 22: -+#line 239 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); - } --#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1659 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 21: --#line 227 "dtc-parser.y" /* yacc.c:1646 */ -+ case 23: -+#line 243 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); - } --#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1667 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 22: --#line 231 "dtc-parser.y" /* yacc.c:1646 */ -+ case 24: -+#line 247 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); - } --#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 23: --#line 235 "dtc-parser.y" /* yacc.c:1646 */ -+ case 25: -+#line 251 "dtc-parser.y" /* yacc.c:1646 */ - { - FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); - struct data d; -@@ -1671,11 +1691,11 @@ yyreduce: - (yyval.data) = data_merge((yyvsp[-8].data), d); - fclose(f); - } --#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 24: --#line 251 "dtc-parser.y" /* yacc.c:1646 */ -+ case 26: -+#line 267 "dtc-parser.y" /* yacc.c:1646 */ - { - FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); - struct data d = empty_data; -@@ -1685,43 +1705,43 @@ yyreduce: - (yyval.data) = data_merge((yyvsp[-4].data), d); - fclose(f); - } --#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1709 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 25: --#line 261 "dtc-parser.y" /* yacc.c:1646 */ -+ case 27: -+#line 277 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); - } --#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1717 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 26: --#line 268 "dtc-parser.y" /* yacc.c:1646 */ -+ case 28: -+#line 284 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = empty_data; - } --#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 27: --#line 272 "dtc-parser.y" /* yacc.c:1646 */ -+ case 29: -+#line 288 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = (yyvsp[-1].data); - } --#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1733 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 28: --#line 276 "dtc-parser.y" /* yacc.c:1646 */ -+ case 30: -+#line 292 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); - } --#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 29: --#line 283 "dtc-parser.y" /* yacc.c:1646 */ -+ case 31: -+#line 299 "dtc-parser.y" /* yacc.c:1646 */ - { - unsigned long long bits; - -@@ -1737,20 +1757,20 @@ yyreduce: - (yyval.array).data = empty_data; - (yyval.array).bits = bits; - } --#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1761 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 30: --#line 299 "dtc-parser.y" /* yacc.c:1646 */ -+ case 32: -+#line 315 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.array).data = empty_data; - (yyval.array).bits = 32; - } --#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1770 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 31: --#line 304 "dtc-parser.y" /* yacc.c:1646 */ -+ case 33: -+#line 320 "dtc-parser.y" /* yacc.c:1646 */ - { - if ((yyvsp[-1].array).bits < 64) { - uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; -@@ -1769,11 +1789,11 @@ yyreduce: - - (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); - } --#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1793 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 32: --#line 323 "dtc-parser.y" /* yacc.c:1646 */ -+ case 34: -+#line 339 "dtc-parser.y" /* yacc.c:1646 */ - { - uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); - -@@ -1787,247 +1807,233 @@ yyreduce: - - (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); - } --#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1811 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 33: --#line 337 "dtc-parser.y" /* yacc.c:1646 */ -+ case 35: -+#line 353 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); - } --#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 36: --#line 346 "dtc-parser.y" /* yacc.c:1646 */ -+ case 38: -+#line 362 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.integer) = (yyvsp[-1].integer); - } --#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1827 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 39: --#line 357 "dtc-parser.y" /* yacc.c:1646 */ -+ case 41: -+#line 373 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } --#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1833 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 41: --#line 362 "dtc-parser.y" /* yacc.c:1646 */ -+ case 43: -+#line 378 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } --#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1839 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 43: --#line 367 "dtc-parser.y" /* yacc.c:1646 */ -+ case 45: -+#line 383 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } --#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1845 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 45: --#line 372 "dtc-parser.y" /* yacc.c:1646 */ -+ case 47: -+#line 388 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } --#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1851 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 47: --#line 377 "dtc-parser.y" /* yacc.c:1646 */ -+ case 49: -+#line 393 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } --#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 49: --#line 382 "dtc-parser.y" /* yacc.c:1646 */ -+ case 51: -+#line 398 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } --#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 51: --#line 387 "dtc-parser.y" /* yacc.c:1646 */ -+ case 53: -+#line 403 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } --#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 52: --#line 388 "dtc-parser.y" /* yacc.c:1646 */ -+ case 54: -+#line 404 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } --#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 54: --#line 393 "dtc-parser.y" /* yacc.c:1646 */ -+ case 56: -+#line 409 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } --#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 55: --#line 394 "dtc-parser.y" /* yacc.c:1646 */ -+ case 57: -+#line 410 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } --#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 56: --#line 395 "dtc-parser.y" /* yacc.c:1646 */ -+ case 58: -+#line 411 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } --#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 57: --#line 396 "dtc-parser.y" /* yacc.c:1646 */ -+ case 59: -+#line 412 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } --#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 58: --#line 400 "dtc-parser.y" /* yacc.c:1646 */ -+ case 60: -+#line 416 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } --#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 59: --#line 401 "dtc-parser.y" /* yacc.c:1646 */ -+ case 61: -+#line 417 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } --#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 61: --#line 406 "dtc-parser.y" /* yacc.c:1646 */ -+ case 63: -+#line 422 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } --#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 62: --#line 407 "dtc-parser.y" /* yacc.c:1646 */ -+ case 64: -+#line 423 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } --#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 64: --#line 412 "dtc-parser.y" /* yacc.c:1646 */ -+ case 66: -+#line 428 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } --#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 65: --#line 414 "dtc-parser.y" /* yacc.c:1646 */ -- { -- if ((yyvsp[0].integer) != 0) { -- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); -- } else { -- ERROR(&(yyloc), "Division by zero"); -- (yyval.integer) = 0; -- } -- } --#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 67: -+#line 429 "dtc-parser.y" /* yacc.c:1646 */ -+ { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } -+#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 66: --#line 423 "dtc-parser.y" /* yacc.c:1646 */ -- { -- if ((yyvsp[0].integer) != 0) { -- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); -- } else { -- ERROR(&(yyloc), "Division by zero"); -- (yyval.integer) = 0; -- } -- } --#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 68: -+#line 430 "dtc-parser.y" /* yacc.c:1646 */ -+ { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } -+#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 69: -+ case 71: - #line 436 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = -(yyvsp[0].integer); } --#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 70: -+ case 72: - #line 437 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = ~(yyvsp[0].integer); } --#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 71: -+ case 73: - #line 438 "dtc-parser.y" /* yacc.c:1646 */ - { (yyval.integer) = !(yyvsp[0].integer); } --#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 72: -+ case 74: - #line 443 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = empty_data; - } --#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1967 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 73: -+ case 75: - #line 447 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); - } --#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1975 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 74: -+ case 76: - #line 451 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); - } --#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1983 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 75: -+ case 77: - #line 458 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.nodelist) = NULL; - } --#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 76: -+ case 78: - #line 462 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); - } --#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 1999 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 77: -+ case 79: - #line 466 "dtc-parser.y" /* yacc.c:1646 */ - { - ERROR(&(yylsp[0]), "Properties must precede subnodes"); - YYERROR; - } --#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2008 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 78: -+ case 80: - #line 474 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); - } --#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2016 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 79: -+ case 81: - #line 478 "dtc-parser.y" /* yacc.c:1646 */ - { - (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); - } --#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2024 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - -- case 80: -+ case 82: - #line 482 "dtc-parser.y" /* yacc.c:1646 */ - { - add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); - (yyval.node) = (yyvsp[0].node); - } --#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2033 "dtc-parser.tab.c" /* yacc.c:1646 */ - break; - - --#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ -+#line 2037 "dtc-parser.tab.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires -diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped -index 30867c688300e38333877360e3b05475d5b4a2a3..276d0788f8581bf1970ec8ef9c29b1981b4fe252 100644 ---- a/scripts/dtc/dtc-parser.tab.h_shipped -+++ b/scripts/dtc/dtc-parser.tab.h_shipped -@@ -46,26 +46,27 @@ extern int yydebug; - enum yytokentype - { - DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 - }; - #endif - -@@ -74,7 +75,7 @@ extern int yydebug; - typedef union YYSTYPE YYSTYPE; - union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:1909 */ -+#line 39 "dtc-parser.y" /* yacc.c:1909 */ - - char *propnodename; - char *labelref; -@@ -92,8 +93,9 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - --#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ -+#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ - }; - # define YYSTYPE_IS_TRIVIAL 1 - # define YYSTYPE_IS_DECLARED 1 -diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y -index 000873f070fdcf3e4a11618cbfefdccb0d8e6cf9..bd67bacd543db130cc547ce7b6238ee168a62f19 100644 ---- a/scripts/dtc/dtc-parser.y -+++ b/scripts/dtc/dtc-parser.y -@@ -19,6 +19,7 @@ - */ - %{ - #include -+#include - - #include "dtc.h" - #include "srcpos.h" -@@ -52,9 +53,11 @@ extern bool treesource_error; - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - } - - %token DT_V1 -+%token DT_PLUGIN - %token DT_MEMRESERVE - %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR - %token DT_BITS -@@ -71,6 +74,7 @@ extern bool treesource_error; - - %type propdata - %type propdataprefix -+%type plugindecl - %type memreserve - %type memreserves - %type arrayprefix -@@ -101,10 +105,22 @@ extern bool treesource_error; - %% - - sourcefile: -- DT_V1 ';' memreserves devicetree -+ DT_V1 ';' plugindecl memreserves devicetree - { -- the_boot_info = build_boot_info($3, $4, -- guess_boot_cpuid($4)); -+ $5->is_plugin = $3; -+ the_boot_info = build_boot_info($4, $5, -+ guess_boot_cpuid($5)); -+ } -+ ; -+ -+plugindecl: -+ /* empty */ -+ { -+ $$ = false; -+ } -+ | DT_PLUGIN ';' -+ { -+ $$ = true; - } - ; - -diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c -index 5fa23c406266e1ec58b9184cc81d381233f8f967..1f8c2852bf14ddad4b1312d7a81eceac947acdfe 100644 ---- a/scripts/dtc/dtc.c -+++ b/scripts/dtc/dtc.c -@@ -31,6 +31,7 @@ int reservenum; /* Number of memory reservation slots */ - int minsize; /* Minimum blob size */ - int padsize; /* Additional padding to blob */ - int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ -+int symbol_fixup_support = 0; - - static void fill_fullpaths(struct node *tree, const char *prefix) - { -@@ -53,7 +54,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) - #define FDT_VERSION(version) _FDT_VERSION(version) - #define _FDT_VERSION(version) #version - static const char usage_synopsis[] = "dtc [options] "; --static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; -+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@hv"; - static struct option const usage_long_opts[] = { - {"quiet", no_argument, NULL, 'q'}, - {"in-format", a_argument, NULL, 'I'}, -@@ -71,6 +72,7 @@ static struct option const usage_long_opts[] = { - {"phandle", a_argument, NULL, 'H'}, - {"warning", a_argument, NULL, 'W'}, - {"error", a_argument, NULL, 'E'}, -+ {"symbols", no_argument, NULL, '@'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'v'}, - {NULL, no_argument, NULL, 0x0}, -@@ -101,6 +103,7 @@ static const char * const usage_opts_help[] = { - "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", - "\n\tEnable/disable warnings (prefix with \"no-\")", - "\n\tEnable/disable errors (prefix with \"no-\")", -+ "\n\tEnable symbols/fixup support", - "\n\tPrint this help and exit", - "\n\tPrint version and exit", - NULL, -@@ -233,7 +236,9 @@ int main(int argc, char *argv[]) - case 'E': - parse_checks_option(false, true, optarg); - break; -- -+ case '@': -+ symbol_fixup_support = 1; -+ break; - case 'h': - usage(NULL); - default: -diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h -index 56212c8df660396b1d9bf6752e1121990e0789ab..f163b22b14b806b637c9fe996efd02762d182e1d 100644 ---- a/scripts/dtc/dtc.h -+++ b/scripts/dtc/dtc.h -@@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */ - extern int minsize; /* Minimum blob size */ - extern int padsize; /* Additional padding to blob */ - extern int phandle_format; /* Use linux,phandle or phandle properties */ -+extern int symbol_fixup_support;/* enable symbols & fixup support */ - - #define PHANDLE_LEGACY 0x1 - #define PHANDLE_EPAPR 0x2 -@@ -132,6 +133,26 @@ struct label { - struct label *next; - }; - -+struct fixup_entry { -+ int offset; -+ struct node *node; -+ struct property *prop; -+ struct fixup_entry *next; -+ bool local_fixup_generated; -+}; -+ -+struct fixup { -+ char *ref; -+ struct fixup_entry *entries; -+ struct fixup *next; -+}; -+ -+struct symbol { -+ struct label *label; -+ struct node *node; -+ struct symbol *next; -+}; -+ - struct property { - bool deleted; - char *name; -@@ -158,6 +179,13 @@ struct node { - int addr_cells, size_cells; - - struct label *labels; -+ -+ struct symbol *symbols; -+ struct fixup_entry *local_fixups; -+ bool emit_local_fixup_node; -+ -+ bool is_plugin; -+ struct fixup *fixups; - }; - - #define for_each_label_withdel(l0, l) \ -@@ -181,6 +209,18 @@ struct node { - for_each_child_withdel(n, c) \ - if (!(c)->deleted) - -+#define for_each_fixup(n, f) \ -+ for ((f) = (n)->fixups; (f); (f) = (f)->next) -+ -+#define for_each_fixup_entry(f, fe) \ -+ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next) -+ -+#define for_each_symbol(n, s) \ -+ for ((s) = (n)->symbols; (s); (s) = (s)->next) -+ -+#define for_each_local_fixup_entry(n, fe) \ -+ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next) -+ - void add_label(struct label **labels, char *label); - void delete_labels(struct label **labels); - -diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c -index ec14954f5810de3ad7262d5ee60e21b23565c155..f8f1e34b781f8c85d36a3d03f84ea5fe39f2e4b2 100644 ---- a/scripts/dtc/flattree.c -+++ b/scripts/dtc/flattree.c -@@ -255,6 +255,204 @@ static int stringtable_insert(struct data *d, const char *str) - return i; - } - -+static void emit_local_fixups(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, struct version_info *vi, -+ struct node *node) -+{ -+ struct fixup_entry *fe, *fen; -+ struct node *child; -+ int nameoff, count; -+ cell_t *buf; -+ struct data d; -+ -+ if (node->emit_local_fixup_node) { -+ -+ /* emit the external fixups (do not emit /) */ -+ if (node != tree) { -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, node->name, 0); -+ emit->align(etarget, sizeof(cell_t)); -+ } -+ -+ for_each_local_fixup_entry(tree, fe) { -+ if (fe->node != node || fe->local_fixup_generated) -+ continue; -+ -+ /* count the number of fixup entries */ -+ count = 0; -+ for_each_local_fixup_entry(tree, fen) { -+ if (fen->prop != fe->prop) -+ continue; -+ fen->local_fixup_generated = true; -+ count++; -+ } -+ -+ /* allocate buffer */ -+ buf = xmalloc(count * sizeof(cell_t)); -+ -+ /* collect all the offsets in buffer */ -+ count = 0; -+ for_each_local_fixup_entry(tree, fen) { -+ if (fen->prop != fe->prop) -+ continue; -+ fen->local_fixup_generated = true; -+ buf[count++] = cpu_to_fdt32(fen->offset); -+ } -+ d = empty_data; -+ d.len = count * sizeof(cell_t); -+ d.val = (char *)buf; -+ -+ nameoff = stringtable_insert(strbuf, fe->prop->name); -+ emit->property(etarget, fe->prop->labels); -+ emit->cell(etarget, count * sizeof(cell_t)); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && -+ (count * sizeof(cell_t)) >= 8) -+ emit->align(etarget, 8); -+ -+ emit->data(etarget, d); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(buf); -+ } -+ } -+ -+ for_each_child(node, child) -+ emit_local_fixups(tree, emit, etarget, strbuf, vi, child); -+ -+ if (node->emit_local_fixup_node && node != tree) -+ emit->endnode(etarget, tree->labels); -+} -+ -+static void emit_symbols_node(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, -+ struct version_info *vi) -+{ -+ struct symbol *sym; -+ int nameoff, vallen; -+ -+ /* do nothing if no symbols */ -+ if (!tree->symbols) -+ return; -+ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__symbols__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_symbol(tree, sym) { -+ -+ vallen = strlen(sym->node->fullpath); -+ -+ nameoff = stringtable_insert(strbuf, sym->label->label); -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, sym->node->fullpath, -+ strlen(sym->node->fullpath)); -+ emit->align(etarget, sizeof(cell_t)); -+ } -+ -+ emit->endnode(etarget, NULL); -+} -+ -+static void emit_local_fixups_node(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, -+ struct version_info *vi) -+{ -+ struct fixup_entry *fe; -+ struct node *node; -+ -+ /* do nothing if no local fixups */ -+ if (!tree->local_fixups) -+ return; -+ -+ /* mark all nodes that need a local fixup generated (and parents) */ -+ for_each_local_fixup_entry(tree, fe) { -+ node = fe->node; -+ while (node != NULL && !node->emit_local_fixup_node) { -+ node->emit_local_fixup_node = true; -+ node = node->parent; -+ } -+ } -+ -+ /* emit the local fixups node now */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__local_fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ emit_local_fixups(tree, emit, etarget, strbuf, vi, tree); -+ -+ emit->endnode(etarget, tree->labels); -+} -+ -+static void emit_fixups_node(struct node *tree, struct emitter *emit, -+ void *etarget, struct data *strbuf, -+ struct version_info *vi) -+{ -+ struct fixup *f; -+ struct fixup_entry *fe; -+ char *name, *s; -+ const char *fullpath; -+ int namesz, nameoff, vallen; -+ -+ /* do nothing if no fixups */ -+ if (!tree->fixups) -+ return; -+ -+ /* emit the external fixups */ -+ emit->beginnode(etarget, NULL); -+ emit->string(etarget, "__fixups__", 0); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ for_each_fixup(tree, f) { -+ -+ namesz = 0; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ namesz += strlen(fullpath) + 1; -+ namesz += strlen(fe->prop->name) + 1; -+ namesz += 32; /* space for : + '\0' */ -+ } -+ -+ name = xmalloc(namesz); -+ -+ s = name; -+ for_each_fixup_entry(f, fe) { -+ fullpath = fe->node->fullpath; -+ if (fullpath[0] == '\0') -+ fullpath = "/"; -+ snprintf(s, name + namesz - s, "%s:%s:%d", fullpath, -+ fe->prop->name, fe->offset); -+ s += strlen(s) + 1; -+ } -+ -+ nameoff = stringtable_insert(strbuf, f->ref); -+ vallen = s - name - 1; -+ -+ emit->property(etarget, NULL); -+ emit->cell(etarget, vallen + 1); -+ emit->cell(etarget, nameoff); -+ -+ if ((vi->flags & FTF_VARALIGN) && vallen >= 8) -+ emit->align(etarget, 8); -+ -+ emit->string(etarget, name, vallen); -+ emit->align(etarget, sizeof(cell_t)); -+ -+ free(name); -+ } -+ -+ emit->endnode(etarget, tree->labels); -+} -+ - static void flatten_tree(struct node *tree, struct emitter *emit, - void *etarget, struct data *strbuf, - struct version_info *vi) -@@ -310,6 +508,10 @@ static void flatten_tree(struct node *tree, struct emitter *emit, - flatten_tree(child, emit, etarget, strbuf, vi); - } - -+ emit_symbols_node(tree, emit, etarget, strbuf, vi); -+ emit_local_fixups_node(tree, emit, etarget, strbuf, vi); -+ emit_fixups_node(tree, emit, etarget, strbuf, vi); -+ - emit->endnode(etarget, tree->labels); - } - -diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h -index ad9b05ae698b0495ecbda42ffcf4743555313a27..2595dfda020fd9e03f0beff5006f229d5e393151 100644 ---- a/scripts/dtc/version_gen.h -+++ b/scripts/dtc/version_gen.h -@@ -1 +1 @@ --#define DTC_VERSION "DTC 1.4.1-g53bf130b" -+#define DTC_VERSION "DTC 1.4.1-g25efc119" - -From ef3f51080fa0d993456fa3635e442b845051b70a Mon Sep 17 00:00:00 2001 -From: notro -Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 054/122] BCM2708: Add core Device Tree support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add the bare minimum needed to boot BCM2708 from a Device Tree. - -Signed-off-by: Noralf Tronnes - -BCM2708: DT: change 'axi' nodename to 'soc' - -Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835. -The VC4 bootloader fills in certain properties in the 'axi' subtree, -but since this is part of an upstreaming effort, the name is changed. - -Signed-off-by: Noralf Tronnes notro@tronnes.org - -BCM2708_DT: Correct length of the peripheral space - -Use dts-dirs feature for overlays. - -The kernel makefiles have a dts-dirs target that is for vendor subdirectories. - -Using this fixes the install_dtbs target, which previously did not install the overlays. - -BCM270X_DT: configure I2S DMA channels - -Signed-off-by: Matthias Reichl - -BCM270X_DT: switch to bcm2835-i2s - -I2S soundcard drivers with proper devicetree support (i.e. not linking -to the cpu_dai/platform via name but to cpu/platform via of_node) -will work out of the box without any modifications. - -When the kernel is compiled without devicetree support the platform -code will instantiate the bcm2708-i2s driver and I2S soundcard drivers -will link to it via name, as before. - -Signed-off-by: Matthias Reichl - -SDIO-overlay: add poll_once-boolean parameter - -Add paramter to toggle sdio-device-polling -done every second or once at boot-time. - -Signed-off-by: Patrick Boettcher - -BCM270X_DT: Make mmc overlay compatible with current firmware - -The original DT overlay logic followed a merge-then-patch procedure, -i.e. parameters are applied to the loaded overlay before the overlay -is merged into the base DTB. This sequence has been changed to -patch-then-merge, in order to support parameterised node names, and -to protect against bad overlays. As a result, overrides (parameters) -must only target labels in the overlay, but the overlay can obviously target nodes in the base DTB. - -mmc-overlay.dts (that switches back to the original mmc sdcard -driver) is the only overlay violating that rule, and this patch -fixes it. - -bcm270x_dt: Use the sdhost MMC controller by default - -The "mmc" overlay reverts to using the other controller. - -squash: Add cprman to dt - -BCM270X_DT: Use clk_core for I2C interfaces - -BCM270X_DT: Use bcm283x.dtsi, bcm2835.dtsi and bcm2836.dtsi - -The mainline Device Tree files are quite close to downstream now. -Let's use bcm283x.dtsi, bcm2835.dtsi and bcm2836.dtsi as base files -for our dts files. - -Mainline dts files are based on these files: - - bcm2835-rpi.dtsi - bcm2835.dtsi bcm2836.dtsi - bcm283x.dtsi - -Current downstream are based on these: - - bcm2708.dtsi bcm2709.dtsi bcm2710.dtsi - bcm2708_common.dtsi - -This patch introduces this dependency: - - bcm2708.dtsi bcm2709.dtsi - bcm2708-rpi.dtsi - bcm270x.dtsi - bcm2835.dtsi bcm2836.dtsi - bcm283x.dtsi - -And: - bcm2710.dtsi - bcm2708-rpi.dtsi - bcm270x.dtsi - bcm283x.dtsi - -bcm270x.dtsi contains the downstream bcm283x.dtsi diff. -bcm2708-rpi.dtsi is the downstream version of bcm2835-rpi.dtsi. - -Other changes: -- The led node has moved from /soc/leds to /leds. This is not a problem - since the label is used to reference it. -- The clk_osc reg property changes from 6 to 3. -- The gpu nodes has their interrupt property set in the base file. -- the clocks label does not point to the /clocks node anymore, but - points to the cprman node. This is not a problem since the overlays - that use the clock node refer to it directly: target-path = "/clocks"; -- some nodes now have 2 labels since mainline and downstream differs in - this respect: cprman/clocks, spi0/spi, gpu/vc4. -- some nodes doesn't have an explicit status = "okay" since they're not - disabled in the base file: watchdog and random. -- gpiomem doesn't need an explicit status = "okay". -- bcm2708-rpi-cm.dts got the hpd-gpios property from bcm2708_common.dtsi, - it's now set directly in that file. -- bcm2709-rpi-2-b.dts has the timer node moved from /soc/timer to /timer. -- Removed clock-frequency property on the bcm{2709,2710}.dtsi timer nodes. - -Signed-off-by: Noralf Trønnes - -BCM270X_DT: Use raspberrypi-power to turn on USB power - -Use the raspberrypi-power driver to turn on USB power. - -Signed-off-by: Noralf Trønnes - -BCM270X_DT: Add a .dtbo target, use for overlays - -Change the filenames and extensions to keep the pre-DDT style of -overlay (-overlay.dtb) distinct from new ones that use a -different style of local fixups (.dtbo), and to match other -platforms. - -The RPi firmware uses the DDTK trailer atom to choose which type of -overlay to use for each kernel. - -Signed-off-by: Phil Elwell - -BCM270X_DT: Don't generate "linux,phandle" props - -The EPAPR standard says to use "phandle" properties to store phandles, -rather than the deprecated "linux,phandle" version. By default, dtc -generates both, but adding "-H epapr" causes it to only generate -"phandle"s, saving some space and clutter. - -Signed-off-by: Phil Elwell - -BCM270X_DT: Add overlay for enc28j60 on SPI2 - -Works on SPI2 for compute module - -BCM270X_DT: Add midi-uart0 overlay - -MIDI requires 31.25kbaud, a baudrate unsupported by Linux. The -midi-uart0 overlay configures uart0 (ttyAMA0) to use a fake clock -so that requesting 38.4kbaud actually gets 31.25kbaud. - -Signed-off-by: Phil Elwell - -BCM270X_DT: Add i2c-sensor overlay - -The i2c-sensor overlay is a container for various pressure and -temperature sensors, currently bmp085 and bmp280. The standalone -bmp085_i2c-sensor overlay is now deprecated. - -Signed-off-by: Phil Elwell - -BCM270X_DT: overlays/*-overlay.dtb -> overlays/*.dtbo (#1752) - -We now create overlays as .dtbo files. - -build: support for .dtbo files for dtb overlays - -Kernel 4.4.6+ on RaspberryPi support .dtbo files for overlays, instead of .dtb. -Patch the kernel, which has faulty rules to generate .dtbo the way yocto does - -Signed-off-by: Herve Jourdain -Signed-off-by: Khem Raj ---- - arch/arm/Makefile | 2 + - arch/arm/boot/.gitignore | 2 +- - arch/arm/boot/dts/Makefile | 19 + - arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 156 +++ - arch/arm/boot/dts/bcm2708-rpi-b.dts | 146 +++ - arch/arm/boot/dts/bcm2708-rpi-cm.dts | 105 ++ - arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 50 + - arch/arm/boot/dts/bcm2708-rpi.dtsi | 109 ++ - arch/arm/boot/dts/bcm2708.dtsi | 16 + - arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 156 +++ - arch/arm/boot/dts/bcm2709.dtsi | 22 + - arch/arm/boot/dts/bcm270x.dtsi | 141 ++ - arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 203 +++ - arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 155 +++ - arch/arm/boot/dts/bcm2710.dtsi | 155 +++ - arch/arm/boot/dts/overlays/Makefile | 105 ++ - arch/arm/boot/dts/overlays/README | 1368 ++++++++++++++++++++ - .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 53 + - arch/arm/boot/dts/overlays/ads1015-overlay.dts | 98 ++ - arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ - .../dts/overlays/akkordion-iqdacplus-overlay.dts | 46 + - .../allo-piano-dac-pcm512x-audio-overlay.dts | 54 + - arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + - .../audioinjector-wm8731-audio-overlay.dts | 39 + - arch/arm/boot/dts/overlays/audremap-overlay.dts | 19 + - .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + - arch/arm/boot/dts/overlays/dht11-overlay.dts | 39 + - .../boot/dts/overlays/dionaudio-loco-overlay.dts | 39 + - arch/arm/boot/dts/overlays/dpi18-overlay.dts | 31 + - arch/arm/boot/dts/overlays/dpi24-overlay.dts | 31 + - arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 + - arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 + - arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + - .../boot/dts/overlays/enc28j60-spi2-overlay.dts | 47 + - arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 44 + - .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + - .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + - .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + - .../dts/overlays/hifiberry-dacplus-overlay.dts | 56 + - .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 + - .../dts/overlays/hifiberry-digi-pro-overlay.dts | 41 + - arch/arm/boot/dts/overlays/hy28a-overlay.dts | 93 ++ - arch/arm/boot/dts/overlays/hy28b-overlay.dts | 148 +++ - arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts | 13 + - arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 43 + - arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 ++ - .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + - arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 83 ++ - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 34 + - .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + - .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + - .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + - arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 43 + - .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 46 + - .../overlays/iqaudio-digi-wm8804-audio-overlay.dts | 47 + - .../arm/boot/dts/overlays/justboom-dac-overlay.dts | 43 + - .../boot/dts/overlays/justboom-digi-overlay.dts | 39 + - arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + - arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + - arch/arm/boot/dts/overlays/mcp23s17-overlay.dts | 732 +++++++++++ - .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 ++ - .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 ++ - arch/arm/boot/dts/overlays/midi-uart0-overlay.dts | 36 + - arch/arm/boot/dts/overlays/mmc-overlay.dts | 38 + - arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ - arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + - .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + - .../boot/dts/overlays/pi3-miniuart-bt-overlay.dts | 64 + - arch/arm/boot/dts/overlays/piscreen-overlay.dts | 102 ++ - arch/arm/boot/dts/overlays/piscreen2r-overlay.dts | 106 ++ - arch/arm/boot/dts/overlays/pisound-overlay.dts | 114 ++ - arch/arm/boot/dts/overlays/pitft22-overlay.dts | 69 + - .../dts/overlays/pitft28-capacitive-overlay.dts | 91 ++ - .../dts/overlays/pitft28-resistive-overlay.dts | 121 ++ - .../dts/overlays/pitft35-resistive-overlay.dts | 121 ++ - arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 35 + - arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts | 47 + - arch/arm/boot/dts/overlays/pwm-overlay.dts | 43 + - arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + - arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 45 + - .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + - arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + - arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 89 ++ - arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 17 + - arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 + - arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 + - .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 81 ++ - .../boot/dts/overlays/sc16is750-i2c-overlay.dts | 37 + - .../boot/dts/overlays/sc16is752-spi1-overlay.dts | 61 + - arch/arm/boot/dts/overlays/sdhost-overlay.dts | 32 + - arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts | 36 + - arch/arm/boot/dts/overlays/sdio-overlay.dts | 36 + - arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 23 + - arch/arm/boot/dts/overlays/smi-dev-overlay.dts | 18 + - arch/arm/boot/dts/overlays/smi-nand-overlay.dts | 69 + - arch/arm/boot/dts/overlays/smi-overlay.dts | 37 + - .../boot/dts/overlays/spi-gpio35-39-overlay.dts | 31 + - arch/arm/boot/dts/overlays/spi-rtc-overlay.dts | 33 + - arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts | 26 + - arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + - arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 + - arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ - arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + - arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 + - arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ - arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 ++++ - arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + - .../arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts | 89 ++ - arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 136 ++ - arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 + - arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 + - .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 + - arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + - scripts/Makefile.dtbinst | 10 +- - scripts/Makefile.lib | 11 + - 115 files changed, 8979 insertions(+), 4 deletions(-) - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dts - create mode 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708-rpi.dtsi - create mode 100644 arch/arm/boot/dts/bcm2708.dtsi - create mode 100644 arch/arm/boot/dts/bcm2709-rpi-2-b.dts - create mode 100644 arch/arm/boot/dts/bcm2709.dtsi - create mode 100644 arch/arm/boot/dts/bcm270x.dtsi - create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts - create mode 100644 arch/arm/boot/dts/bcm2710-rpi-cm3.dts - create mode 100644 arch/arm/boot/dts/bcm2710.dtsi - create mode 100644 arch/arm/boot/dts/overlays/Makefile - create mode 100644 arch/arm/boot/dts/overlays/README - create mode 100644 arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/ads1015-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/audremap-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dht11-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dpi18-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dpi24-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/justboom-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/justboom-digi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp23017-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp23s17-overlay.dts - create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/midi-uart0-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/piscreen2r-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pisound-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft22-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-dev-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-nand-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/smi-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi-rtc-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/uart1-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts - create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts - -diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 6be9ee148b78b964004392045199ec8d1540134e..b1c49e2a0c5f5ef2939102625171b26cd5372016 100644 ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -334,6 +334,8 @@ $(INSTALL_TARGETS): - - %.dtb: | scripts - $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ -+%.dtbo: | scripts -+ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ - - PHONY += dtbs dtbs_install - -diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore -index 3c79f85975aaa26c7c2e353fefc54d71d89bc5bf..eaaeb17e5986e5f7178b2851169444ac7e45be8d 100644 ---- a/arch/arm/boot/.gitignore -+++ b/arch/arm/boot/.gitignore -@@ -3,4 +3,4 @@ zImage - xipImage - bootpImage - uImage --*.dtb -+*.dtb* -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index c558ba75cbccf909063e0f4f131f7efdfd28867b..ec218dcb67019acacd4a6c73c74d12ef4f4204d8 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -1,5 +1,13 @@ - ifeq ($(CONFIG_OF),y) - -+dtb-$(CONFIG_ARCH_BCM2835) += \ -+ bcm2708-rpi-b.dtb \ -+ bcm2708-rpi-b-plus.dtb \ -+ bcm2708-rpi-cm.dtb \ -+ bcm2709-rpi-2-b.dtb \ -+ bcm2710-rpi-3-b.dtb \ -+ bcm2710-rpi-cm3.dtb -+ - dtb-$(CONFIG_ARCH_ALPINE) += \ - alpine-db.dtb - dtb-$(CONFIG_MACH_ARTPEC6) += \ -@@ -954,10 +962,21 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ - dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb - dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \ - aspeed-ast2500-evb.dtb -+ -+targets += dtbs dtbs_install -+targets += $(dtb-y) -+ - endif - - dtstree := $(srctree)/$(src) - dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) - - always := $(dtb-y) -+subdir-y := overlays - clean-files := *.dtb -+ -+# Enable fixups to support overlays on BCM2835 platforms -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+ DTC_FLAGS ?= -@ -H epapr -+ dts-dirs += overlays -+endif -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..360da5c928dc5599b0d2a9055728087604c6b189 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts -@@ -0,0 +1,156 @@ -+/dts-v1/; -+ -+#include "bcm2708.dtsi" -+ -+/ { -+ model = "Raspberry Pi Model B+"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 45>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+ -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9c49659ab246bce0656f3514f3b924bc4826b421 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts -@@ -0,0 +1,146 @@ -+/dts-v1/; -+ -+#include "bcm2708.dtsi" -+ -+/ { -+ model = "Raspberry Pi Model B"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 45>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 16 1>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..eb8662f0d222b4c0a9a2bcb8bccb13e86a0006b3 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts -@@ -0,0 +1,105 @@ -+/dts-v1/; -+ -+#include "bcm2708-rpi-cm.dtsi" -+ -+/ { -+ model = "Raspberry Pi Compute Module"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&gpio { -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins; -+ brcm,function; -+ }; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..d33d462b4090e4a4f967a37212918b9cf500bf76 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi -@@ -0,0 +1,50 @@ -+#include "bcm2708.dtsi" -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+}; -+ -+&gpio { -+ mmc_pins: mmc_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <7>; /* alt3 */ -+ }; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+}; -+ -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+ brcm,overclock-50 = <0>; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+/ { -+ __overrides__ { -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&mmc>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..46cf8602c3b96e477b05b57dbfe5e349930c9d9a ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi -@@ -0,0 +1,109 @@ -+/* Downstream version of bcm2835-rpi.dtsi */ -+ -+#include -+ -+/ { -+ memory { -+ device_type = "memory"; -+ reg = <0x0 0x0>; -+ }; -+ -+ aliases { -+ audio = &audio; -+ aux = &aux; -+ sound = &sound; -+ soc = &soc; -+ dma = &dma; -+ intc = &intc; -+ watchdog = &watchdog; -+ random = &random; -+ mailbox = &mailbox; -+ gpio = &gpio; -+ uart0 = &uart0; -+ sdhost = &sdhost; -+ i2s = &i2s; -+ spi0 = &spi0; -+ i2c0 = &i2c0; -+ uart1 = &uart1; -+ spi1 = &spi1; -+ spi2 = &spi2; -+ mmc = &mmc; -+ i2c1 = &i2c1; -+ i2c2 = &i2c2; -+ usb = &usb; -+ leds = &leds; -+ fb = &fb; -+ vchiq = &vchiq; -+ thermal = &thermal; -+ }; -+ -+ leds: leds { -+ compatible = "gpio-leds"; -+ }; -+ -+ soc { -+ gpiomem { -+ compatible = "brcm,bcm2835-gpiomem"; -+ reg = <0x7e200000 0x1000>; -+ }; -+ -+ firmware: firmware { -+ compatible = "raspberrypi,bcm2835-firmware"; -+ mboxes = <&mailbox>; -+ }; -+ -+ power: power { -+ compatible = "raspberrypi,bcm2835-power"; -+ firmware = <&firmware>; -+ #power-domain-cells = <1>; -+ }; -+ -+ fb: fb { -+ compatible = "brcm,bcm2708-fb"; -+ firmware = <&firmware>; -+ status = "disabled"; -+ }; -+ -+ vchiq: vchiq { -+ compatible = "brcm,bcm2835-vchiq"; -+ reg = <0x7e00b840 0xf>; -+ interrupts = <0 2>; -+ cache-line-size = <32>; -+ firmware = <&firmware>; -+ }; -+ -+ thermal: thermal { -+ compatible = "brcm,bcm2835-thermal"; -+ firmware = <&firmware>; -+ }; -+ -+ /* Onboard audio */ -+ audio: audio { -+ compatible = "brcm,bcm2835-audio"; -+ brcm,pwm-channels = <8>; -+ status = "disabled"; -+ }; -+ -+ /* External sound card */ -+ sound: sound { -+ status = "disabled"; -+ }; -+ -+ }; -+ -+ __overrides__ { -+ cache_line_size = <&vchiq>, "cache-line-size:0"; -+ }; -+}; -+ -+&dma { -+ brcm,dma-channel-mask = <0x7f34>; -+}; -+ -+&hdmi { -+ power-domains = <&power RPI_POWER_DOMAIN_HDMI>; -+}; -+ -+&usb { -+ power-domains = <&power RPI_POWER_DOMAIN_USB>; -+}; -diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..0f72bd90c591a2e8752d7437fa7e8c6308bd8c3f ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2708.dtsi -@@ -0,0 +1,16 @@ -+#include "bcm2835.dtsi" -+#include "bcm270x.dtsi" -+#include "bcm2708-rpi.dtsi" -+ -+/ { -+ soc { -+ timer@7e003000 { -+ compatible = "brcm,bcm2835-system-timer"; -+ reg = <0x7e003000 0x1000>; -+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>; -+ clock-frequency = <1000000>; -+ }; -+ }; -+ -+ /delete-node/ cpus; -+}; -diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..19c83823420fc3cc20a01d07091100cb8720ff4d ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts -@@ -0,0 +1,156 @@ -+/dts-v1/; -+ -+#include "bcm2709.dtsi" -+ -+/ { -+ model = "Raspberry Pi 2 Model B"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 45>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&gpio 47 0>; -+ }; -+ -+ pwr_led: pwr { -+ label = "led1"; -+ linux,default-trigger = "input"; -+ gpios = <&gpio 35 0>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ pwr_led_gpio = <&pwr_led>,"gpios:4"; -+ pwr_led_activelow = <&pwr_led>,"gpios:8"; -+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..343437db94820bb75a9b81e8bc6ecf6f31d9f04c ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2709.dtsi -@@ -0,0 +1,22 @@ -+#include "bcm2836.dtsi" -+#include "bcm270x.dtsi" -+#include "bcm2708-rpi.dtsi" -+ -+/ { -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; -+ -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; -+ }; -+ -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm270x.dtsi b/arch/arm/boot/dts/bcm270x.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..a46cb4a8b1419edd95e0e07c18b0f373222dc2bf ---- /dev/null -+++ b/arch/arm/boot/dts/bcm270x.dtsi -@@ -0,0 +1,141 @@ -+/* Downstream bcm283x.dtsi diff */ -+#include "dt-bindings/power/raspberrypi-power.h" -+ -+/ { -+ chosen { -+ bootargs = ""; -+ }; -+ -+ soc: soc { -+ -+ /delete-node/ timer@7e003000; -+ -+ watchdog: watchdog@7e100000 { -+ /* Add alias */ -+ }; -+ -+ cprman: cprman@7e101000 { -+ /* Add alias */ -+ }; -+ -+ random: rng@7e104000 { -+ /* Add alias */ -+ }; -+ -+ gpio@7e200000 { /* gpio */ -+ interrupts = <2 17>, <2 18>; -+ }; -+ -+ sdhost: sdhost@7e202000 { -+ compatible = "brcm,bcm2835-sdhost"; -+ reg = <0x7e202000 0x100>; -+ interrupts = <2 24>; -+ clocks = <&clocks BCM2835_CLOCK_VPU>; -+ dmas = <&dma 13>; -+ dma-names = "rx-tx"; -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ status = "disabled"; -+ }; -+ -+ i2s@7e203000 { /* i2s */ -+ #sound-dai-cells = <0>; -+ reg = <0x7e203000 0x24>; -+ clocks = <&clocks BCM2835_CLOCK_PCM>; -+ }; -+ -+ spi0: spi@7e204000 { -+ /* Add alias */ -+ dmas = <&dma 6>, <&dma 7>; -+ dma-names = "tx", "rx"; -+ }; -+ -+ pixelvalve0: pixelvalve@7e206000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ pixelvalve1: pixelvalve@7e207000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ dpi: dpi@7e208000 { -+ compatible = "brcm,bcm2835-dpi"; -+ reg = <0x7e208000 0x8c>; -+ clocks = <&clocks BCM2835_CLOCK_VPU>, -+ <&clocks BCM2835_CLOCK_DPI>; -+ clock-names = "core", "pixel"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "disabled"; -+ }; -+ -+ /delete-node/ sdhci@7e300000; -+ -+ mmc: mmc@7e300000 { -+ compatible = "brcm,bcm2835-mmc"; -+ reg = <0x7e300000 0x100>; -+ interrupts = <2 30>; -+ clocks = <&clocks BCM2835_CLOCK_EMMC>; -+ dmas = <&dma 11>; -+ dma-names = "rx-tx"; -+ brcm,overclock-50 = <0>; -+ status = "disabled"; -+ }; -+ -+ hvs: hvs@7e400000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ firmwarekms: firmwarekms@7e600000 { -+ compatible = "raspberrypi,rpi-firmware-kms"; -+ /* SMI interrupt reg */ -+ reg = <0x7e600000 0x100>; -+ interrupts = <2 16>; -+ brcm,firmware = <&firmware>; -+ status = "disabled"; -+ }; -+ -+ smi: smi@7e600000 { -+ compatible = "brcm,bcm2835-smi"; -+ reg = <0x7e600000 0x100>; -+ interrupts = <2 16>; -+ clocks = <&clocks BCM2835_CLOCK_SMI>; -+ assigned-clocks = <&cprman BCM2835_CLOCK_SMI>; -+ assigned-clock-rates = <125000000>; -+ dmas = <&dma 4>; -+ dma-names = "rx-tx"; -+ status = "disabled"; -+ }; -+ -+ pixelvalve2: pixelvalve@7e807000 { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ -+ hdmi@7e902000 { /* hdmi */ -+ status = "disabled"; -+ }; -+ -+ usb@7e980000 { /* usb */ -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ }; -+ -+ v3d@7ec00000 { /* vd3 */ -+ compatible = "brcm,vc4-v3d"; -+ power-domains = <&power RPI_POWER_DOMAIN_V3D>; -+ status = "disabled"; -+ }; -+ -+ gpu: gpu { -+ /* Add alias */ -+ status = "disabled"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..12764a3495b2372ffaf47e32ea0d21326ca83686 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts -@@ -0,0 +1,203 @@ -+/dts-v1/; -+ -+#ifdef RPI364 -+/memreserve/ 0x00000000 0x00001000; -+#endif -+ -+#include "bcm2710.dtsi" -+ -+/ { -+ model = "Raspberry Pi 3 Model B"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ sdio_pins: sdio_pins { -+ brcm,pins = <34 35 36 37 38 39>; -+ brcm,function = <7>; // alt3 = SD1 -+ brcm,pull = <0 2 2 2 2 2>; -+ }; -+ -+ bt_pins: bt_pins { -+ brcm,pins = <43>; -+ brcm,function = <4>; /* alt0:GPCLK2 */ -+ brcm,pull = <0>; -+ }; -+ -+ uart0_pins: uart0_pins { -+ brcm,pins = <32 33>; -+ brcm,function = <7>; /* alt3=UART0 */ -+ brcm,pull = <0 2>; -+ }; -+ -+ uart1_pins: uart1_pins { -+ brcm,pins; -+ brcm,function; -+ brcm,pull; -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins = <40 41>; -+ brcm,function = <4>; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ bus-width = <4>; -+ status = "okay"; -+}; -+ -+&mmc { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+ brcm,overclock-50 = <0>; -+}; -+ -+&soc { -+ virtgpio: virtgpio { -+ compatible = "brcm,bcm2835-virtgpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins &bt_pins>; -+ status = "okay"; -+}; -+ -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&virtgpio 0 0>; -+ }; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ chosen { -+ bootargs = "8250.nr_uarts=1"; -+ }; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..41874c25a84226c0e4af92ec4059e0a571fe6123 ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts -@@ -0,0 +1,155 @@ -+/dts-v1/; -+ -+#include "bcm2710.dtsi" -+ -+/ { -+ model = "Raspberry Pi Compute Module 3"; -+}; -+ -+&gpio { -+ sdhost_pins: sdhost_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <4>; /* alt0 */ -+ brcm,pull = <0 2 2 2 2 2>; -+ }; -+ -+ spi0_pins: spi0_pins { -+ brcm,pins = <9 10 11>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ spi0_cs_pins: spi0_cs_pins { -+ brcm,pins = <8 7>; -+ brcm,function = <1>; /* output */ -+ }; -+ -+ i2c0_pins: i2c0 { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; -+ }; -+ -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; -+ }; -+ -+ i2s_pins: i2s { -+ brcm,pins = <18 19 20 21>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ -+ audio_pins: audio_pins { -+ brcm,pins; -+ brcm,function; -+ }; -+}; -+ -+&sdhost { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdhost_pins>; -+ non-removable; -+ bus-width = <4>; -+ status = "okay"; -+ brcm,overclock-50 = <0>; -+}; -+ -+&soc { -+ virtgpio: virtgpio { -+ compatible = "brcm,bcm2835-virtgpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+}; -+ -+&fb { -+ status = "okay"; -+}; -+ -+&spi0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; -+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; -+ -+ spidev0: spidev@0{ -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+ -+ spidev1: spidev@1{ -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ }; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c1_pins>; -+ clock-frequency = <100000>; -+}; -+ -+&i2c2 { -+ clock-frequency = <100000>; -+}; -+ -+&i2s { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s_pins>; -+}; -+ -+&leds { -+ act_led: act { -+ label = "led0"; -+ linux,default-trigger = "mmc0"; -+ gpios = <&virtgpio 0 0>; -+ }; -+}; -+ -+&hdmi { -+ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>; -+}; -+ -+&audio { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&audio_pins>; -+}; -+ -+/ { -+ __overrides__ { -+ uart0 = <&uart0>,"status"; -+ uart1 = <&uart1>,"status"; -+ i2s = <&i2s>,"status"; -+ spi = <&spi0>,"status"; -+ i2c0 = <&i2c0>,"status"; -+ i2c1 = <&i2c1>,"status"; -+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; -+ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; -+ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; -+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; -+ -+ act_led_gpio = <&act_led>,"gpios:4"; -+ act_led_activelow = <&act_led>,"gpios:8"; -+ act_led_trigger = <&act_led>,"linux,default-trigger"; -+ -+ audio = <&audio>,"status"; -+ watchdog = <&watchdog>,"status"; -+ random = <&random>,"status"; -+ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; -+ sd_force_pio = <&sdhost>,"brcm,force-pio?"; -+ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; -+ sd_debug = <&sdhost>,"brcm,debug"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi -new file mode 100644 -index 0000000000000000000000000000000000000000..f6def5d7e5d622cf09e8f87332c7374fe28da08b ---- /dev/null -+++ b/arch/arm/boot/dts/bcm2710.dtsi -@@ -0,0 +1,155 @@ -+#include "bcm283x.dtsi" -+#include "bcm270x.dtsi" -+#include "bcm2708-rpi.dtsi" -+ -+/ { -+ compatible = "brcm,bcm2837", "brcm,bcm2836"; -+ model = "BCM2837"; -+ -+ soc { -+ ranges = <0x7e000000 0x3f000000 0x01000000>, -+ <0x40000000 0x40000000 0x00040000>; -+ dma-ranges = <0xc0000000 0x00000000 0x3f000000>; -+ -+ local_intc: local_intc { -+ compatible = "brcm,bcm2836-l1-intc"; -+ reg = <0x40000000 0x100>; -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ interrupt-parent = <&local_intc>; -+ }; -+ -+ arm-pmu { -+#ifdef RPI364 -+ compatible = "arm,armv8-pmuv3", "arm,cortex-a7-pmu"; -+#else -+ compatible = "arm,cortex-a7-pmu"; -+#endif -+ interrupt-parent = <&local_intc>; -+ interrupts = <9>; -+ }; -+ -+ timer { -+#ifdef RPI364 -+ compatible = "arm,armv8-timer", "arm,armv7-timer"; -+#else -+ compatible = "arm,armv7-timer"; -+#endif -+ interrupt-parent = <&local_intc>; -+ interrupts = <0>, // PHYS_SECURE_PPI -+ <1>, // PHYS_NONSECURE_PPI -+ <3>, // VIRT_PPI -+ <2>; // HYP_PPI -+ always-on; -+ }; -+ -+ syscon@40000000 { -+ compatible = "brcm,bcm2836-arm-local", "syscon"; -+ reg = <0x40000000 0x100>; -+ }; -+ }; -+ -+#ifdef RPI364 -+ cpus: cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ v8_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x0>; -+ clock-frequency = <1200000000>; -+ }; -+ -+ v8_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x1>; -+ clock-frequency = <1200000000>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0x000000e0>; -+ }; -+ -+ v8_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x2>; -+ clock-frequency = <1200000000>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0x000000e8>; -+ }; -+ -+ v8_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a53", "arm,armv8"; -+ reg = <0x3>; -+ clock-frequency = <1200000000>; -+ enable-method = "spin-table"; -+ cpu-release-addr = <0x0 0x000000f0>; -+ }; -+ }; -+ -+ __overrides__ { -+ arm_freq = <&v8_cpu0>, "clock-frequency:0", -+ <&v8_cpu1>, "clock-frequency:0", -+ <&v8_cpu2>, "clock-frequency:0", -+ <&v8_cpu3>, "clock-frequency:0"; -+ }; -+ -+#else -+ cpus: cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ v7_cpu0: cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x000>; -+ clock-frequency = <800000000>; -+ }; -+ -+ v7_cpu1: cpu@1 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x001>; -+ clock-frequency = <800000000>; -+ }; -+ -+ v7_cpu2: cpu@2 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x002>; -+ clock-frequency = <800000000>; -+ }; -+ -+ v7_cpu3: cpu@3 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a7"; -+ reg = <0x003>; -+ clock-frequency = <800000000>; -+ }; -+ }; -+ -+ __overrides__ { -+ arm_freq = <&v7_cpu0>, "clock-frequency:0", -+ <&v7_cpu1>, "clock-frequency:0", -+ <&v7_cpu2>, "clock-frequency:0", -+ <&v7_cpu3>, "clock-frequency:0"; -+ }; -+#endif -+}; -+ -+&intc { -+ compatible = "brcm,bcm2836-armctrl-ic"; -+ reg = <0x7e00b200 0x200>; -+ interrupt-parent = <&local_intc>; -+ interrupts = <8>; -+}; -+ -+#ifdef RPI364 -+&usb { -+ compatible = "brcm,bcm2835-usb"; -+ reg = <0x7e980000 0x10000>; -+ interrupts = <1 9>; -+}; -+#endif -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -new file mode 100644 -index 0000000000000000000000000000000000000000..11dba31712840a9e4b91acd4565c2d6266315273 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -0,0 +1,105 @@ -+# Overlays for the Raspberry Pi platform -+ -+dtbo-$(CONFIG_ARCH_BCM2835) += \ -+ adau1977-adc.dtbo \ -+ ads1015.dtbo \ -+ ads7846.dtbo \ -+ akkordion-iqdacplus.dtbo \ -+ allo-piano-dac-pcm512x-audio.dtbo \ -+ at86rf233.dtbo \ -+ audioinjector-wm8731-audio.dtbo \ -+ audremap.dtbo \ -+ bmp085_i2c-sensor.dtbo \ -+ dht11.dtbo \ -+ dionaudio-loco.dtbo \ -+ dpi18.dtbo \ -+ dpi24.dtbo \ -+ dwc-otg.dtbo \ -+ dwc2.dtbo \ -+ enc28j60.dtbo \ -+ enc28j60-spi2.dtbo \ -+ gpio-ir.dtbo \ -+ gpio-poweroff.dtbo \ -+ hifiberry-amp.dtbo \ -+ hifiberry-dac.dtbo \ -+ hifiberry-dacplus.dtbo \ -+ hifiberry-digi.dtbo \ -+ hifiberry-digi-pro.dtbo \ -+ hy28a.dtbo \ -+ hy28b.dtbo \ -+ i2c-bcm2708.dtbo \ -+ i2c-gpio.dtbo \ -+ i2c-mux.dtbo \ -+ i2c-pwm-pca9685a.dtbo \ -+ i2c-rtc.dtbo \ -+ i2c-sensor.dtbo \ -+ i2c0-bcm2708.dtbo \ -+ i2c1-bcm2708.dtbo \ -+ i2s-gpio28-31.dtbo \ -+ iqaudio-dac.dtbo \ -+ iqaudio-dacplus.dtbo \ -+ iqaudio-digi-wm8804-audio.dtbo \ -+ justboom-dac.dtbo \ -+ justboom-digi.dtbo \ -+ lirc-rpi.dtbo \ -+ mcp23017.dtbo \ -+ mcp23s17.dtbo \ -+ mcp2515-can0.dtbo \ -+ mcp2515-can1.dtbo \ -+ midi-uart0.dtbo \ -+ mmc.dtbo \ -+ mz61581.dtbo \ -+ pi3-act-led.dtbo \ -+ pi3-disable-bt.dtbo \ -+ pi3-miniuart-bt.dtbo \ -+ piscreen.dtbo \ -+ piscreen2r.dtbo \ -+ pisound.dtbo \ -+ pitft22.dtbo \ -+ pitft28-capacitive.dtbo \ -+ pitft28-resistive.dtbo \ -+ pitft35-resistive.dtbo \ -+ pps-gpio.dtbo \ -+ pwm.dtbo \ -+ pwm-2chan.dtbo \ -+ qca7000.dtbo \ -+ raspidac3.dtbo \ -+ rpi-backlight.dtbo \ -+ rpi-dac.dtbo \ -+ rpi-display.dtbo \ -+ rpi-ft5406.dtbo \ -+ rpi-proto.dtbo \ -+ rpi-sense.dtbo \ -+ rra-digidac1-wm8741-audio.dtbo \ -+ sc16is750-i2c.dtbo \ -+ sc16is752-spi1.dtbo \ -+ sdhost.dtbo \ -+ sdio.dtbo \ -+ sdio-1bit.dtbo \ -+ sdtweak.dtbo \ -+ smi.dtbo \ -+ smi-dev.dtbo \ -+ smi-nand.dtbo \ -+ spi-gpio35-39.dtbo \ -+ spi-rtc.dtbo \ -+ spi0-hw-cs.dtbo \ -+ spi1-1cs.dtbo \ -+ spi1-2cs.dtbo \ -+ spi1-3cs.dtbo \ -+ spi2-1cs.dtbo \ -+ spi2-2cs.dtbo \ -+ spi2-3cs.dtbo \ -+ tinylcd35.dtbo \ -+ uart1.dtbo \ -+ vc4-fkms-v3d.dtbo \ -+ vc4-kms-v3d.dtbo \ -+ vga666.dtbo \ -+ w1-gpio.dtbo \ -+ w1-gpio-pullup.dtbo \ -+ wittypi.dtbo -+ -+targets += dtbs dtbs_install -+targets += $(dtbo-y) -+ -+always := $(dtbo-y) -+clean-files := *.dtbo -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -new file mode 100644 -index 0000000000000000000000000000000000000000..81d991803be335e5a1bc3bb0a8c7a2c9f5c392bd ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/README -@@ -0,0 +1,1368 @@ -+Introduction -+============ -+ -+This directory contains Device Tree overlays. Device Tree makes it possible -+to support many hardware configurations with a single kernel and without the -+need to explicitly load or blacklist kernel modules. Note that this isn't a -+"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices -+are still configured by the board support code, but the intention is to -+eventually reach that goal. -+ -+On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By -+default, the Raspberry Pi kernel boots with device tree enabled. You can -+completely disable DT usage (for now) by adding: -+ -+ device_tree= -+ -+to your config.txt, which should cause your Pi to revert to the old way of -+doing things after a reboot. -+ -+In /boot you will find a .dtb for each base platform. This describes the -+hardware that is part of the Raspberry Pi board. The loader (start.elf and its -+siblings) selects the .dtb file appropriate for the platform by name, and reads -+it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) -+are disabled, but they can be enabled using Device Tree parameters: -+ -+ dtparam=i2c=on,i2s=on,spi=on -+ -+However, this shouldn't be necessary in many use cases because loading an -+overlay that requires one of those interfaces will cause it to be enabled -+automatically, and it is advisable to only enable interfaces if they are -+needed. -+ -+Configuring additional, optional hardware is done using Device Tree overlays -+(see below). -+ -+raspi-config -+============ -+ -+The Advanced Options section of the raspi-config utility can enable and disable -+Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it -+is possible to both enable an interface and blacklist the driver, if for some -+reason you should want to defer the loading. -+ -+Modules -+======= -+ -+As well as describing the hardware, Device Tree also gives enough information -+to allow suitable driver modules to be located and loaded, with the corollary -+that unneeded modules are not loaded. As a result it should be possible to -+remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can -+have its contents deleted (or commented out). -+ -+Using Overlays -+============== -+ -+Overlays are loaded using the "dtoverlay" directive. As an example, consider -+the popular lirc-rpi module, the Linux Infrared Remote Control driver. In the -+pre-DT world this would be loaded from /etc/modules, with an explicit -+"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, -+this becomes a line in config.txt: -+ -+ dtoverlay=lirc-rpi -+ -+This causes the file /boot/overlays/lirc-rpi.dtbo to be loaded. By -+default it will use GPIOs 17 (out) and 18 (in), but this can be modified using -+DT parameters: -+ -+ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 -+ -+Parameters always have default values, although in some cases (e.g. "w1-gpio") -+it is necessary to provided multiple overlays in order to get the desired -+behaviour. See the list of overlays below for a description of the parameters -+and their defaults. -+ -+The Overlay and Parameter Reference -+=================================== -+ -+N.B. When editing this file, please preserve the indentation levels to make it -+simple to parse programmatically. NO HARD TABS. -+ -+ -+Name: -+Info: Configures the base Raspberry Pi hardware -+Load: -+Params: -+ audio Set to "on" to enable the onboard ALSA audio -+ interface (default "off") -+ -+ i2c_arm Set to "on" to enable the ARM's i2c interface -+ (default "off") -+ -+ i2c_vc Set to "on" to enable the i2c interface -+ usually reserved for the VideoCore processor -+ (default "off") -+ -+ i2c An alias for i2c_arm -+ -+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface -+ (default "100000") -+ -+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface -+ (default "100000") -+ -+ i2c_baudrate An alias for i2c_arm_baudrate -+ -+ i2s Set to "on" to enable the i2s interface -+ (default "off") -+ -+ spi Set to "on" to enable the spi interfaces -+ (default "off") -+ -+ random Set to "on" to enable the hardware random -+ number generator (default "on") -+ -+ sd_overclock Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sd_force_pio Disable DMA support for SD driver (default off) -+ -+ sd_pio_limit Number of blocks above which to use DMA for -+ SD card (default 1) -+ -+ sd_debug Enable debug output from SD driver (default off) -+ -+ uart0 Set to "off" to disable uart0 (default "on") -+ -+ uart1 Set to "on" or "off" to enable or disable uart1 -+ (default varies) -+ -+ watchdog Set to "on" to enable the hardware watchdog -+ (default "off") -+ -+ act_led_trigger Choose which activity the LED tracks. -+ Use "heartbeat" for a nice load indicator. -+ (default "mmc") -+ -+ act_led_activelow Set to "on" to invert the sense of the LED -+ (default "off") -+ N.B. For Pi3 see pi3-act-led overlay. -+ -+ act_led_gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ (default "16" on a non-Plus board, "47" on a -+ Plus or Pi 2) -+ N.B. For Pi3 see pi3-act-led overlay. -+ -+ pwr_led_trigger -+ pwr_led_activelow -+ pwr_led_gpio -+ As for act_led_*, but using the PWR LED. -+ Not available on Model A/B boards. -+ -+ N.B. It is recommended to only enable those interfaces that are needed. -+ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc -+ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) -+ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical -+ interfaces i2c0 and i2c1. Use of the numeric variants is still possible -+ but deprecated because the ARM/VC assignments differ between board -+ revisions. The same board-specific mapping applies to i2c_baudrate, -+ and the other i2c baudrate parameters. -+ -+ -+Name: adau1977-adc -+Info: Overlay for activation of ADAU1977 ADC codec over I2C for control -+ and I2S for data. -+Load: dtoverlay=adau1977-adc -+Params: -+ -+ -+Name: ads1015 -+Info: Overlay for activation of Texas Instruments ADS1015 ADC over I2C -+Load: dtoverlay=ads1015,= -+Params: addr I2C bus address of device. Set based on how the -+ addr pin is wired. (default=0x48 assumes addr -+ is pulled to GND) -+ cha_enable Enable virtual channel a. (default=true) -+ cha_cfg Set the configuration for virtual channel a. -+ (default=4 configures this channel for the -+ voltage at A0 with respect to GND) -+ cha_datarate Set the datarate (samples/sec) for this channel. -+ (default=4 sets 1600 sps) -+ cha_gain Set the gain of the Programmable Gain -+ Amplifier for this channel. (default=2 sets the -+ full scale of the channel to 2.048 Volts) -+ -+ Channel (ch) parameters can be set for each enabled channel. -+ A maximum of 4 channels can be enabled (letters a thru d). -+ For more information refer to the device datasheet at: -+ http://www.ti.com/lit/ds/symlink/ads1015.pdf -+ -+ -+Name: ads7846 -+Info: ADS7846 Touch controller -+Load: dtoverlay=ads7846,= -+Params: cs SPI bus Chip Select (default 1) -+ speed SPI bus speed (default 2MHz, max 3.25MHz) -+ penirq GPIO used for PENIRQ. REQUIRED -+ penirq_pull Set GPIO pull (default 0=none, 2=pullup) -+ swapxy Swap x and y axis -+ xmin Minimum value on the X axis (default 0) -+ ymin Minimum value on the Y axis (default 0) -+ xmax Maximum value on the X axis (default 4095) -+ ymax Maximum value on the Y axis (default 4095) -+ pmin Minimum reported pressure value (default 0) -+ pmax Maximum reported pressure value (default 65535) -+ xohms Touchpanel sensitivity (X-plate resistance) -+ (default 400) -+ -+ penirq is required and usually xohms (60-100) has to be set as well. -+ Apart from that, pmax (255) and swapxy are also common. -+ The rest of the calibration can be done with xinput-calibrator. -+ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian -+ Device Tree binding document: -+ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt -+ -+ -+Name: akkordion-iqdacplus -+Info: Configures the Digital Dreamtime Akkordion Music Player (based on the -+ OEM IQAudIO DAC+ or DAC Zero module). -+Load: dtoverlay=akkordion-iqdacplus,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ dtoverlay=akkordion-iqdacplus,24db_digital_gain -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: allo-piano-dac-pcm512x-audio -+Info: Configures the Allo Piano DAC (2.0/2.1) audio cards. -+ (NB. This initial support is for 2.0 channel audio ONLY! ie. stereo. -+ The subwoofer outputs on the Piano 2.1 are not currently supported!) -+Load: dtoverlay=allo-piano-dac-pcm512x-audio, -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: at86rf233 -+Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, -+ connected to spi0.0 -+Load: dtoverlay=at86rf233,= -+Params: interrupt GPIO used for INT (default 23) -+ reset GPIO used for Reset (default 24) -+ sleep GPIO used for Sleep (default 25) -+ speed SPI bus speed in Hz (default 3000000) -+ trim Fine tuning of the internal capacitance -+ arrays (0=+0pF, 15=+4.5pF, default 15) -+ -+ -+Name: audioinjector-wm8731-audio -+Info: Configures the audioinjector.net audio add on soundcard -+Load: dtoverlay=audioinjector-wm8731-audio -+Params: -+ -+ -+Name: audremap -+Info: Switches PWM sound output to pins 12 (Right) & 13 (Left) -+Load: dtoverlay=audremap,= -+Params: swap_lr Reverse the channel allocation, which will also -+ swap the audio jack outputs (default off) -+ enable_jack Don't switch off the audio jack output -+ (default off) -+ -+ -+Name: bmp085_i2c-sensor -+Info: This overlay is now deprecated - see i2c-sensor -+Load: dtoverlay=bmp085_i2c-sensor -+Params: -+ -+ -+Name: dht11 -+Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors -+ Also sometimes found with the part number(s) AM230x. -+Load: dtoverlay=dht11,= -+Params: gpiopin GPIO connected to the sensor's DATA output. -+ (default 4) -+ -+ -+Name: dionaudio-loco -+Info: Configures the Dion Audio LOCO DAC-AMP -+Load: dtoverlay=dionaudio-loco -+Params: -+ -+ -+Name: dpi18 -+Info: Overlay for a generic 18-bit DPI display -+ This uses GPIOs 0-21 (so no I2C, uart etc.), and activates the output -+ 2-3 seconds after the kernel has started. -+Load: dtoverlay=dpi18 -+Params: -+ -+ -+Name: dpi24 -+Info: Overlay for a generic 24-bit DPI display -+ This uses GPIOs 0-27 (so no I2C, uart etc.), and activates the output -+ 2-3 seconds after the kernel has started. -+Load: dtoverlay=dpi24 -+Params: -+ -+ -+Name: dwc-otg -+Info: Selects the dwc_otg USB controller driver which has fiq support. This -+ is the default on all except the Pi Zero which defaults to dwc2. -+Load: dtoverlay=dwc-otg -+Params: -+ -+ -+Name: dwc2 -+Info: Selects the dwc2 USB controller driver -+Load: dtoverlay=dwc2,= -+Params: dr_mode Dual role mode: "host", "peripheral" or "otg" -+ -+ g-rx-fifo-size Size of rx fifo size in gadget mode -+ -+ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget -+ mode -+ -+ g-tx-fifo-size Size of periodic tx fifo per endpoint -+ (except ep0) in gadget mode -+ -+ -+[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+Name: enc28j60 -+Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI0 -+Load: dtoverlay=enc28j60,= -+Params: int_pin GPIO used for INT (default 25) -+ -+ speed SPI bus speed (default 12000000) -+ -+ -+Name: enc28j60-spi2 -+Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI2 -+Load: dtoverlay=enc28j60-spi2,= -+Params: int_pin GPIO used for INT (default 39) -+ -+ speed SPI bus speed (default 12000000) -+ -+ -+Name: gpio-ir -+Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- -+ based gpio_ir_recv driver maps received keys directly to a -+ /dev/input/event* device, all decoding is done by the kernel - LIRC is -+ not required! The key mapping and other decoding parameters can be -+ configured by "ir-keytable" tool. -+Load: dtoverlay=gpio-ir,= -+Params: gpio_pin Input pin number. Default is 18. -+ -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "down". -+ -+ rc-map-name Default rc keymap (can also be changed by -+ ir-keytable), defaults to "rc-rc6-mce" -+ -+ -+Name: gpio-poweroff -+Info: Drives a GPIO high or low on poweroff (including halt) -+Load: dtoverlay=gpio-poweroff,= -+Params: gpiopin GPIO for signalling (default 26) -+ -+ active_low Set if the power control device requires a -+ high->low transition to trigger a power-down. -+ Note that this will require the support of a -+ custom dt-blob.bin to prevent a power-down -+ during the boot process, and that a reboot -+ will also cause the pin to go low. -+ -+ -+Name: hifiberry-amp -+Info: Configures the HifiBerry Amp and Amp+ audio cards -+Load: dtoverlay=hifiberry-amp -+Params: -+ -+ -+Name: hifiberry-dac -+Info: Configures the HifiBerry DAC audio card -+Load: dtoverlay=hifiberry-dac -+Params: -+ -+ -+Name: hifiberry-dacplus -+Info: Configures the HifiBerry DAC+ audio card -+Load: dtoverlay=hifiberry-dacplus,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=hifiberry-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24dB_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ slave Force DAC+ Pro into slave mode, using Pi as -+ master for bit clock and frame clock. -+ -+ -+Name: hifiberry-digi -+Info: Configures the HifiBerry Digi and Digi+ audio card -+Load: dtoverlay=hifiberry-digi -+Params: -+ -+ -+Name: hifiberry-digi-pro -+Info: Configures the HifiBerry Digi+ Pro audio card -+Load: dtoverlay=hifiberry-digi-pro -+Params: -+ -+ -+Name: hy28a -+Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28a,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ resetgpio GPIO used to reset controller -+ -+ ledgpio GPIO used to control backlight -+ -+ -+Name: hy28b -+Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics -+ Default values match Texy's display shield -+Load: dtoverlay=hy28b,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ resetgpio GPIO used to reset controller -+ -+ ledgpio GPIO used to control backlight -+ -+ -+Name: i2c-bcm2708 -+Info: Fall back to the i2c_bcm2708 driver for the i2c_arm bus. -+Load: dtoverlay=i2c-bcm2708 -+Params: -+ -+ -+Name: i2c-gpio -+Info: Adds support for software i2c controller on gpio pins -+Load: dtoverlay=i2c-gpio,= -+Params: i2c_gpio_sda GPIO used for I2C data (default "23") -+ -+ i2c_gpio_scl GPIO used for I2C clock (default "24") -+ -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) -+ -+ -+Name: i2c-mux -+Info: Adds support for a number of I2C bus multiplexers on i2c_arm -+Load: dtoverlay=i2c-mux,= -+Params: pca9542 Select the NXP PCA9542 device -+ -+ pca9545 Select the NXP PCA9545 device -+ -+ pca9548 Select the NXP PCA9548 device -+ -+ addr Change I2C address of the device (default 0x70) -+ -+ -+[ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ] -+ -+ -+Name: i2c-pwm-pca9685a -+Info: Adds support for an NXP PCA9685A I2C PWM controller on i2c_arm -+Load: dtoverlay=i2c-pwm-pca9685a,= -+Params: addr I2C address of PCA9685A (default 0x40) -+ -+ -+Name: i2c-rtc -+Info: Adds support for a number of I2C Real Time Clock devices -+Load: dtoverlay=i2c-rtc,= -+Params: abx80x Select one of the ABx80x family: -+ AB0801, AB0803, AB0804, AB0805, -+ AB1801, AB1803, AB1804, AB1805 -+ -+ ds1307 Select the DS1307 device -+ -+ ds1339 Select the DS1339 device -+ -+ ds3231 Select the DS3231 device -+ -+ mcp7940x Select the MCP7940x device -+ -+ mcp7941x Select the MCP7941x device -+ -+ pcf2127 Select the PCF2127 device -+ -+ pcf8523 Select the PCF8523 device -+ -+ pcf8563 Select the PCF8563 device -+ -+ trickle-diode-type Diode type for trickle charge - "standard" or -+ "schottky" (ABx80x only) -+ -+ trickle-resistor-ohms Resistor value for trickle charge (DS1339, -+ ABx80x) -+ -+ wakeup-source Specify that the RTC can be used as a wakeup -+ source -+ -+ -+Name: i2c-sensor -+Info: Adds support for a number of I2C barometric pressure and temperature -+ sensors on i2c_arm -+Load: dtoverlay=i2c-sensor,= -+Params: bmp085 Select the Bosch sensortronic BMP085 -+ -+ bmp280 Select the Bosch sensortronic BMP280 -+ -+ -+Name: i2c0-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations -+ are usable on all platforms. -+Load: dtoverlay=i2c0-bcm2708,= -+Params: sda0_pin GPIO pin for SDA0 (deprecated - use pins_*) -+ scl0_pin GPIO pin for SCL0 (deprecated - use pins_*) -+ pins_0_1 Use pins 0 and 1 (default) -+ pins_28_29 Use pins 28 and 29 -+ pins_44_45 Use pins 44 and 45 -+ pins_46_47 Use pins 46 and 47 -+ -+ -+Name: i2c1-bcm2708 -+Info: Enable the i2c_bcm2708 driver for the i2c1 bus -+Load: dtoverlay=i2c1-bcm2708,= -+Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) -+ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) -+ pin_func Alternative pin function (4 (alt0), 6 (alt2) - -+ default 4) -+ -+ -+Name: i2s-gpio28-31 -+Info: move I2S function block to GPIO 28 to 31 -+Load: dtoverlay=i2s-gpio28-31 -+Params: -+ -+ -+Name: iqaudio-dac -+Info: Configures the IQaudio DAC audio card -+Load: dtoverlay=iqaudio-dac, -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=iqaudio-dac,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: iqaudio-dacplus -+Info: Configures the IQaudio DAC+ audio card -+Load: dtoverlay=iqaudio-dacplus,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=iqaudio-dacplus,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24db_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ auto_mute_amp If specified, unmute/mute the IQaudIO amp when -+ starting/stopping audio playback. -+ unmute_amp If specified, unmute the IQaudIO amp once when -+ the DAC driver module loads. -+ -+ -+Name: iqaudio-digi-wm8804-audio -+Info: Configures the IQAudIO Digi WM8804 audio card -+Load: dtoverlay=iqaudio-digi-wm8804-audio,= -+Params: card_name Override the default, "IQAudIODigi", card name. -+ dai_name Override the default, "IQAudIO Digi", dai name. -+ dai_stream_name Override the default, "IQAudIO Digi HiFi", -+ dai stream name. -+ -+ -+Name: justboom-dac -+Info: Configures the JustBoom DAC HAT, Amp HAT, DAC Zero and Amp Zero audio -+ cards -+Load: dtoverlay=justboom-dac,= -+Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec -+ Digital volume control. Enable with -+ "dtoverlay=justboom-dac,24db_digital_gain" -+ (The default behaviour is that the Digital -+ volume control is limited to a maximum of -+ 0dB. ie. it can attenuate but not provide -+ gain. For most users, this will be desired -+ as it will prevent clipping. By appending -+ the 24dB_digital_gain parameter, the Digital -+ volume control will allow up to 24dB of -+ gain. If this parameter is enabled, it is the -+ responsibility of the user to ensure that -+ the Digital volume control is set to a value -+ that does not result in clipping/distortion!) -+ -+ -+Name: justboom-digi -+Info: Configures the JustBoom Digi HAT and Digi Zero audio cards -+Load: dtoverlay=justboom-digi -+Params: -+ -+ -+Name: lirc-rpi -+Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) -+ Consult the module documentation for more details. -+Load: dtoverlay=lirc-rpi,= -+Params: gpio_out_pin GPIO for output (default "17") -+ -+ gpio_in_pin GPIO for input (default "18") -+ -+ gpio_in_pull Pull up/down/off on the input pin -+ (default "down") -+ -+ sense Override the IR receive auto-detection logic: -+ "0" = force active-high -+ "1" = force active-low -+ "-1" = use auto-detection -+ (default "-1") -+ -+ softcarrier Turn the software carrier "on" or "off" -+ (default "on") -+ -+ invert "on" = invert the output pin (default "off") -+ -+ debug "on" = enable additional debug messages -+ (default "off") -+ -+ -+Name: mcp23017 -+Info: Configures the MCP23017 I2C GPIO expander -+Load: dtoverlay=mcp23017,= -+Params: gpiopin Gpio pin connected to the INTA output of the -+ MCP23017 (default: 4) -+ -+ addr I2C address of the MCP23017 (default: 0x20) -+ -+ -+Name: mcp23s17 -+Info: Configures the MCP23S08/17 SPI GPIO expanders. -+ If devices are present on SPI1 or SPI2, those interfaces must be enabled -+ with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays. -+ If interrupts are enabled for a device on a given CS# on a SPI bus, that -+ device must be the only one present on that SPI bus/CS#. -+Load: dtoverlay=mcp23s17,= -+Params: s08-spi--present 4-bit integer, bitmap indicating MCP23S08 -+ devices present on SPI, CS# -+ -+ s17-spi--present 8-bit integer, bitmap indicating MCP23S17 -+ devices present on SPI, CS# -+ -+ s08-spi--int-gpio integer, enables interrupts on a single -+ MCP23S08 device on SPI, CS#, specifies -+ the GPIO pin to which INT output of MCP23S08 -+ is connected. -+ -+ s17-spi--int-gpio integer, enables mirrored interrupts on a -+ single MCP23S17 device on SPI, CS#, -+ specifies the GPIO pin to which either INTA -+ or INTB output of MCP23S17 is connected. -+ -+ -+Name: mcp2515-can0 -+Info: Configures the MCP2515 CAN controller on spi0.0 -+Load: dtoverlay=mcp2515-can0,= -+Params: oscillator Clock frequency for the CAN controller (Hz) -+ -+ spimaxfrequency Maximum SPI frequence (Hz) -+ -+ interrupt GPIO for interrupt signal -+ -+ -+Name: mcp2515-can1 -+Info: Configures the MCP2515 CAN controller on spi0.1 -+Load: dtoverlay=mcp2515-can1,= -+Params: oscillator Clock frequency for the CAN controller (Hz) -+ -+ spimaxfrequency Maximum SPI frequence (Hz) -+ -+ interrupt GPIO for interrupt signal -+ -+ -+Name: midi-uart0 -+Info: Configures UART0 (ttyAMA0) so that a requested 38.4kbaud actually gets -+ 31.25kbaud, the frequency required for MIDI -+Load: dtoverlay=midi-uart0 -+Params: -+ -+ -+Name: mmc -+Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock -+Load: dtoverlay=mmc,= -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ -+Name: mz61581 -+Info: MZ61581 display by Tontec -+Load: dtoverlay=mz61581,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ txbuflen Transmit buffer length (default 32768) -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ -+[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] -+ -+ -+Name: pi3-act-led -+Info: Pi3 uses a GPIO expander to drive the LEDs which can only be accessed -+ from the VPU. There is a special driver for this with a separate DT -+ node, which has the unfortunate consequence of breaking the -+ act_led_gpio and act_led_activelow dtparams. -+ This overlay changes the GPIO controller back to the standard one and -+ restores the dtparams. -+Load: dtoverlay=pi3-act-led,= -+Params: activelow Set to "on" to invert the sense of the LED -+ (default "off") -+ -+ gpio Set which GPIO to use for the activity LED -+ (in case you want to connect it to an external -+ device) -+ REQUIRED -+ -+ -+Name: pi3-disable-bt -+Info: Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15 -+ N.B. To disable the systemd service that initialises the modem so it -+ doesn't use the UART, use 'sudo systemctl disable hciuart'. -+Load: dtoverlay=pi3-disable-bt -+Params: -+ -+ -+Name: pi3-miniuart-bt -+Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore -+ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum -+ usable baudrate. -+ N.B. It is also necessary to edit /lib/systemd/system/hciuart.service -+ and replace ttyAMA0 with ttyS0, unless you have a system with udev rules -+ that create /dev/serial0 and /dev/serial1, in which case use -+ /dev/serial1 instead because it will always be correct. Furthermore, -+ you must also set core_freq=250 in config.txt or the miniuart will not -+ work. -+Load: dtoverlay=pi3-miniuart-bt -+Params: -+ -+ -+Name: piscreen -+Info: PiScreen display by OzzMaker.com -+Load: dtoverlay=piscreen,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ -+Name: piscreen2r -+Info: PiScreen 2 with resistive TP display by OzzMaker.com -+Load: dtoverlay=piscreen2r,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ xohms Touchpanel sensitivity (X-plate resistance) -+ -+ -+Name: pisound -+Info: Configures the Blokas Labs pisound card -+Load: dtoverlay=pisound -+Params: -+ -+ -+Name: pitft22 -+Info: Adafruit PiTFT 2.2" screen -+Load: dtoverlay=pitft22,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ -+Name: pitft28-capacitive -+Info: Adafruit PiTFT 2.8" capacitive touch screen -+Load: dtoverlay=pitft28-capacitive,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ touch-sizex Touchscreen size x (default 240) -+ -+ touch-sizey Touchscreen size y (default 320) -+ -+ touch-invx Touchscreen inverted x axis -+ -+ touch-invy Touchscreen inverted y axis -+ -+ touch-swapxy Touchscreen swapped x y axis -+ -+ -+Name: pitft28-resistive -+Info: Adafruit PiTFT 2.8" resistive touch screen -+Load: dtoverlay=pitft28-resistive,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ -+Name: pitft35-resistive -+Info: Adafruit PiTFT 3.5" resistive touch screen -+Load: dtoverlay=pitft35-resistive,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ -+Name: pps-gpio -+Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). -+Load: dtoverlay=pps-gpio,= -+Params: gpiopin Input GPIO (default "18") -+ assert_falling_edge When present, assert is indicated by a falling -+ edge, rather than by a rising edge -+ -+ -+Name: pwm -+Info: Configures a single PWM channel -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm,= -+Params: pin Output pin (default 18) - see table -+ func Pin function (default 2 = Alt5) - see above -+ clock PWM clock frequency (informational) -+ -+ -+Name: pwm-2chan -+Info: Configures both PWM channels -+ Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+ 4) Currently the clock must have been enabled and configured -+ by other means. -+Load: dtoverlay=pwm-2chan,= -+Params: pin Output pin (default 18) - see table -+ pin2 Output pin for other channel (default 19) -+ func Pin function (default 2 = Alt5) - see above -+ func2 Function for pin2 (default 2 = Alt5) -+ clock PWM clock frequency (informational) -+ -+ -+Name: qca7000 -+Info: I2SE's Evaluation Board for PLC Stamp micro -+Load: dtoverlay=qca7000,= -+Params: int_pin GPIO pin for interrupt signal (default 23) -+ -+ speed SPI bus speed (default 12 MHz) -+ -+ -+Name: raspidac3 -+Info: Configures the RaspiDAV Rev.3x audio card -+Load: dtoverlay=raspidac3 -+Params: -+ -+ -+Name: rpi-backlight -+Info: Raspberry Pi official display backlight driver -+Load: dtoverlay=rpi-backlight -+Params: -+ -+ -+Name: rpi-dac -+Info: Configures the RPi DAC audio card -+Load: dtoverlay=rpi-dac -+Params: -+ -+ -+Name: rpi-display -+Info: RPi-Display - 2.8" Touch Display by Watterott -+Load: dtoverlay=rpi-display,= -+Params: speed Display SPI bus speed -+ rotate Display rotation {0,90,180,270} -+ fps Delay between frame updates -+ debug Debug output level {0-7} -+ xohms Touchpanel sensitivity (X-plate resistance) -+ swapxy Swap x and y axis -+ -+ -+Name: rpi-ft5406 -+Info: Official Raspberry Pi display touchscreen -+Load: dtoverlay=rpi-ft5406 -+Params: -+ -+ -+Name: rpi-proto -+Info: Configures the RPi Proto audio card -+Load: dtoverlay=rpi-proto -+Params: -+ -+ -+Name: rpi-sense -+Info: Raspberry Pi Sense HAT -+Load: dtoverlay=rpi-sense -+Params: -+ -+ -+Name: rra-digidac1-wm8741-audio -+Info: Configures the Red Rocks Audio DigiDAC1 soundcard -+Load: dtoverlay=rra-digidac1-wm8741-audio -+Params: -+ -+ -+Name: sc16is750-i2c -+Info: Overlay for the NXP SC16IS750 UART with I2C Interface -+ Enables the chip on I2C1 at 0x48. To select another address, -+ please refer to table 10 in reference manual. -+ -+Load: dtoverlay=sc16is750-i2c,= -+Params: int_pin GPIO used for IRQ (default 24) -+ addr Address (default 0x48) -+ -+ -+Name: sc16is752-spi1 -+Info: Overlay for the NXP SC16IS752 Dual UART with SPI Interface -+ Enables the chip on SPI1. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+ -+Load: dtoverlay=sc16is752-spi1,= -+Params: int_pin GPIO used for IRQ (default 24) -+ -+ -+Name: sdhost -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock. -+ N.B. This overlay is designed for situations where the mmc driver is -+ the default, so it disables the other (mmc) interface - this will kill -+ WiFi on a Pi3. If this isn't what you want, either use the sdtweak -+ overlay or the new sd_* dtparams of the base DTBs. -+Load: dtoverlay=sdhost,= -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ -+Name: sdio -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, -+ and enables SDIO via GPIOs 22-27. -+Load: dtoverlay=sdio,= -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) -+ -+ bus_width Set the SDIO host bus width (default 4 bits) -+ -+ -+Name: sdio-1bit -+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, -+ and enables 1-bit SDIO via GPIOs 22-25. -+Load: dtoverlay=sdio-1bit,= -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC -+ framework requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ poll_once Disable SDIO-device polling every second -+ (default on: polling once at boot-time) -+ -+ -+Name: sdtweak -+Info: Tunes the bcm2835-sdhost SD/MMC driver -+ N.B. This functionality is now available via the sd_* dtparams in the -+ base DTB. -+Load: dtoverlay=sdtweak,= -+Params: overclock_50 Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ -+ -+Name: smi -+Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! -+Load: dtoverlay=smi -+Params: -+ -+ -+Name: smi-dev -+Info: Enables the userspace interface for the SMI driver -+Load: dtoverlay=smi-dev -+Params: -+ -+ -+Name: smi-nand -+Info: Enables access to NAND flash via the SMI interface -+Load: dtoverlay=smi-nand -+Params: -+ -+ -+Name: spi-gpio35-39 -+Info: move SPI function block to GPIO 35 to 39 -+Load: dtoverlay=spi-gpio35-39 -+Params: -+ -+ -+Name: spi-rtc -+Info: Adds support for a number of SPI Real Time Clock devices -+Load: dtoverlay=spi-rtc,= -+Params: pcf2123 Select the PCF2123 device -+ -+ -+Name: spi0-hw-cs -+Info: Re-enables hardware CS/CE (chip selects) for SPI0 -+Load: dtoverlay=spi0-hw-cs -+Params: -+ -+ -+Name: spi1-1cs -+Info: Enables spi1 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-1cs,= -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-2cs -+Info: Enables spi1 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-2cs,= -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi1-3cs -+Info: Enables spi1 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi1 is only accessible on devices with a 40pin header, eg: -+ A+, B+, Zero and PI2 B; as well as the Compute Module. -+Load: dtoverlay=spi1-3cs,= -+Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). -+ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). -+ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev1.2 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-1cs -+Info: Enables spi2 with a single chip select (CS) line and associated spidev -+ dev node. The gpio pin number for the CS line and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-1cs,= -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-2cs -+Info: Enables spi2 with two chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-2cs,= -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ -+ -+Name: spi2-3cs -+Info: Enables spi2 with three chip select (CS) lines and associated spidev -+ dev nodes. The gpio pin numbers for the CS lines and spidev device node -+ creation are configurable. -+ N.B.: spi2 is only accessible with the Compute Module. -+Load: dtoverlay=spi2-3cs,= -+Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). -+ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). -+ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). -+ cs0_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.0 (default -+ is 'okay' or enabled). -+ cs1_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.1 (default -+ is 'okay' or enabled). -+ cs2_spidev Set to 'disabled' to stop the creation of a -+ userspace device node /dev/spidev2.2 (default -+ is 'okay' or enabled). -+ -+ -+Name: tinylcd35 -+Info: 3.5" Color TFT Display by www.tinylcd.com -+ Options: Touch, RTC, keypad -+Load: dtoverlay=tinylcd35,= -+Params: speed Display SPI bus speed -+ -+ rotate Display rotation {0,90,180,270} -+ -+ fps Delay between frame updates -+ -+ debug Debug output level {0-7} -+ -+ touch Enable touch panel -+ -+ touchgpio Touch controller IRQ GPIO -+ -+ xohms Touchpanel: Resistance of X-plate in ohms -+ -+ rtc-pcf PCF8563 Real Time Clock -+ -+ rtc-ds DS1307 Real Time Clock -+ -+ keypad Enable keypad -+ -+ Examples: -+ Display with touchpanel, PCF8563 RTC and keypad: -+ dtoverlay=tinylcd35,touch,rtc-pcf,keypad -+ Old touch display: -+ dtoverlay=tinylcd35,touch,touchgpio=3 -+ -+ -+Name: uart1 -+Info: Enable uart1 in place of uart0 -+Load: dtoverlay=uart1,= -+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) -+ -+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) -+ -+ -+Name: vc4-fkms-v3d -+Info: Enable Eric Anholt's DRM VC4 V3D driver on top of the dispmanx -+ display stack. -+Load: dtoverlay=vc4-fkms-v3d, -+Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) -+ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) -+ cma-128 CMA is 128MB, 128MB-aligned -+ cma-96 CMA is 96MB, 128MB-aligned -+ cma-64 CMA is 64MB, 64MB-aligned -+ -+ -+Name: vc4-kms-v3d -+Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or -+ booting to GUI while this overlay is in use will cause interesting -+ lockups. -+Load: dtoverlay=vc4-kms-v3d, -+Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB) -+ cma-192 CMA is 192MB, 256MB-aligned (needs 1GB) -+ cma-128 CMA is 128MB, 128MB-aligned -+ cma-96 CMA is 96MB, 128MB-aligned -+ cma-64 CMA is 64MB, 64MB-aligned -+ -+ -+Name: vga666 -+Info: Overlay for the Fen Logic VGA666 board -+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds -+ after the kernel has started. -+Load: dtoverlay=vga666 -+Params: -+ -+ -+Name: w1-gpio -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *don't* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio,= -+Params: gpiopin GPIO for I/O (default "4") -+ -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature -+ -+ -+Name: w1-gpio-pullup -+Info: Configures the w1-gpio Onewire interface module. -+ Use this overlay if you *do* need a GPIO to drive an external pullup. -+Load: dtoverlay=w1-gpio-pullup,= -+Params: gpiopin GPIO for I/O (default "4") -+ -+ pullup Non-zero, "on", or "y" to enable the parasitic -+ power (2-wire, power-on-data) feature -+ -+ extpullup GPIO for external pullup (default "5") -+ -+ -+Name: wittypi -+Info: Configures the wittypi RTC module. -+Load: dtoverlay=wittypi,= -+Params: led_gpio GPIO for LED (default "17") -+ led_trigger Choose which activity the LED tracks (default -+ "default-on") -+ -+ -+Troubleshooting -+=============== -+ -+If you are experiencing problems that you think are DT-related, enable DT -+diagnostic output by adding this to /boot/config.txt: -+ -+ dtdebug=on -+ -+and rebooting. Then run: -+ -+ sudo vcdbg log msg -+ -+and look for relevant messages. -+ -+Further reading -+=============== -+ -+This is only meant to be a quick introduction to the subject of Device Tree on -+Raspberry Pi. There is a more complete explanation here: -+ -+http://www.raspberrypi.org/documentation/configuration/device-tree.md -diff --git a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..24fcd58fd1dc61d97a77def3d5d1f7c65130dde6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts -@@ -0,0 +1,53 @@ -+// Definitions for ADAU1977 ADC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&soc>; -+ -+ __overlay__ { -+ codec_supply: fixedregulator@0 { -+ compatible = "regulator-fixed"; -+ regulator-name = "AVDD"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c>; -+ -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ adau1977: codec@11 { -+ compatible = "adi,adau1977"; -+ reg = <0x11>; -+ reset-gpios = <&gpio 5 0>; -+ AVDD-supply = <&codec_supply>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "adi,adau1977-adc"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/ads1015-overlay.dts b/arch/arm/boot/dts/overlays/ads1015-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..02b9de46299bae8f22e1a665a482c0cb99cd30c9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/ads1015-overlay.dts -@@ -0,0 +1,98 @@ -+/* -+ * 2016 - Erik Sejr -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ /* ----------- ADS1015 ------------ */ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ ads1015: ads1015 { -+ compatible = "ti,ads1015"; -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0x48>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "i2c_arm/ads1015"; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_a: channel_a { -+ reg = <4>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "i2c_arm/ads1015"; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_b: channel_b { -+ reg = <5>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "i2c_arm/ads1015"; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_c: channel_c { -+ reg = <6>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "i2c_arm/ads1015"; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ channel_d: channel_d { -+ reg = <7>; -+ ti,gain = <2>; -+ ti,datarate = <4>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ addr = <&ads1015>,"reg:0"; -+ cha_enable = <0>,"=1"; -+ cha_cfg = <&channel_a>,"reg:0"; -+ cha_gain = <&channel_a>,"ti,gain:0"; -+ cha_datarate = <&channel_a>,"ti,datarate:0"; -+ chb_enable = <0>,"=2"; -+ chb_cfg = <&channel_b>,"reg:0"; -+ chb_gain = <&channel_b>,"ti,gain:0"; -+ chb_datarate = <&channel_b>,"ti,datarate:0"; -+ chc_enable = <0>,"=3"; -+ chc_cfg = <&channel_c>,"reg:0"; -+ chc_gain = <&channel_c>,"ti,gain:0"; -+ chc_datarate = <&channel_c>,"ti,datarate:0"; -+ chd_enable = <0>,"=4"; -+ chd_cfg = <&channel_d>,"reg:0"; -+ chd_gain = <&channel_d>,"ti,gain:0"; -+ chd_datarate = <&channel_d>,"ti,datarate:0"; -+ }; -+ -+}; -diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..edf2dc9d5d5f6830508edabf2d04c42d27ba9b41 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts -@@ -0,0 +1,89 @@ -+/* -+ * Generic Device Tree overlay for the ADS7846 touch controller -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ ads7846_pins: ads7846_pins { -+ brcm,pins = <255>; /* illegal default value */ -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ads7846: ads7846@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&ads7846_pins>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <255 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 255 0>; -+ -+ /* driver defaults */ -+ ti,x-min = /bits/ 16 <0>; -+ ti,y-min = /bits/ 16 <0>; -+ ti,x-max = /bits/ 16 <0x0FFF>; -+ ti,y-max = /bits/ 16 <0x0FFF>; -+ ti,pressure-min = /bits/ 16 <0>; -+ ti,pressure-max = /bits/ 16 <0xFFFF>; -+ ti,x-plate-ohms = /bits/ 16 <400>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ cs = <&ads7846>,"reg:0"; -+ speed = <&ads7846>,"spi-max-frequency:0"; -+ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ -+ <&ads7846>,"interrupts:0", -+ <&ads7846>,"pendown-gpio:4"; -+ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; -+ swapxy = <&ads7846>,"ti,swap-xy?"; -+ xmin = <&ads7846>,"ti,x-min;0"; -+ ymin = <&ads7846>,"ti,y-min;0"; -+ xmax = <&ads7846>,"ti,x-max;0"; -+ ymax = <&ads7846>,"ti,y-max;0"; -+ pmin = <&ads7846>,"ti,pressure-min;0"; -+ pmax = <&ads7846>,"ti,pressure-max;0"; -+ xohms = <&ads7846>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..208849d5c39274ed0aa557f63a19430a451a95f5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts -@@ -0,0 +1,46 @@ -+// Definitions for Digital Dreamtime Akkordion using IQaudIO DAC+ or DACZero -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ frag2: __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ card_name = "Akkordion"; -+ dai_name = "IQaudIO DAC"; -+ dai_stream_name = "IQaudIO DAC HiFi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts b/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..a5468d850a911cd509365cf25f8ffa6ad071b90a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts -@@ -0,0 +1,54 @@ -+/* -+ * Definitions for Allo Piano DAC (2.0/2.1) boards -+ * -+ * NB. The Piano DAC 2.1 board contains 2x TI PCM5142 DAC's. One DAC is stereo -+ * (left/right) and the other provides a subwoofer output, using DSP on the -+ * chip for digital high/low pass crossover. -+ * The initial support for this hardware, that doesn't require any codec driver -+ * modifications, uses only one DAC chip for stereo (left/right) output, the -+ * chip with 0x4c slave address. The other chip at 0x4d is currently ignored! -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5142@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5142"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ piano_dac: __overlay__ { -+ compatible = "allo,piano-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = -+ <&piano_dac>,"allo,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..880c7539d496fb10672ee573f7c51b8a213cecf7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Overlay for Atmel AT86RF233 IEEE 802.15.4 WPAN transceiver on spi0.0 */ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ lowpan0: at86rf233@0 { -+ compatible = "atmel,at86rf233"; -+ reg = <0>; -+ interrupt-parent = <&gpio>; -+ interrupts = <23 4>; /* active high */ -+ reset-gpio = <&gpio 24 1>; -+ sleep-gpio = <&gpio 25 1>; -+ spi-max-frequency = <3000000>; -+ xtal-trim = /bits/ 8 <0xf>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ lowpan0_pins: lowpan0_pins { -+ brcm,pins = <23 24 25>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ interrupt = <&lowpan0>, "interrupts:0", -+ <&lowpan0_pins>, "brcm,pins:0"; -+ reset = <&lowpan0>, "reset-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:4"; -+ sleep = <&lowpan0>, "sleep-gpio:4", -+ <&lowpan0_pins>, "brcm,pins:8"; -+ speed = <&lowpan0>, "spi-max-frequency:0"; -+ trim = <&lowpan0>, "xtal-trim.0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..4ed66577fa1d59e7b167ffdfd5a3f0de066cded2 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/audioinjector-wm8731-audio-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for audioinjector.net audio add on soundcard -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8731@1a { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8731"; -+ reg = <0x1a>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "ai,audioinjector-pi-soundcard"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/audremap-overlay.dts b/arch/arm/boot/dts/overlays/audremap-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9582d6ab31218b4ed7b1d42a9190ca6efe9bd531 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/audremap-overlay.dts -@@ -0,0 +1,19 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&audio_pins>; -+ frag0: __overlay__ { -+ brcm,pins = < 12 13 >; -+ brcm,function = < 4 >; /* alt0 alt0 */ -+ }; -+ }; -+ -+ __overrides__ { -+ swap_lr = <&frag0>, "swap_lr?"; -+ enable_jack = <&frag0>, "enable_jack?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..782b1715467e943c18fe936cc76448f3db960fbc ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts -@@ -0,0 +1,23 @@ -+// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dht11-overlay.dts b/arch/arm/boot/dts/overlays/dht11-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9bf67fd57bada3c3e06c09744fb184767bab5d14 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dht11-overlay.dts -@@ -0,0 +1,39 @@ -+/* -+ * Overlay for the DHT11/21/22 humidity/temperature sensor modules. -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ -+ dht11: dht11@0 { -+ compatible = "dht11"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dht11_pins>; -+ gpios = <&gpio 4 0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dht11_pins: dht11_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&dht11_pins>,"brcm,pins:0", -+ <&dht11>,"gpios:4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts b/arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..3930f412bca4454c6673fb19859e607b360bc6c3 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dionaudio-loco-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for Dion Audio LOCO DAC-AMP -+ -+/* -+ * PCM5242 DAC (in hardware mode) and TPA3118 AMP. -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "dionaudio,loco-pcm5242-tpa3118"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dpi18-overlay.dts b/arch/arm/boot/dts/overlays/dpi18-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8098d5e28a71ffbc717db5c6b88305d2ba6e3175 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dpi18-overlay.dts -@@ -0,0 +1,31 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ // There is no DPI driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dpi18_pins>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dpi18_pins: dpi18_pins { -+ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 -+ 12 13 14 15 16 17 18 19 20 -+ 21>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dpi24-overlay.dts b/arch/arm/boot/dts/overlays/dpi24-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e4dbe40218a008ef4028c1214740c3d6bc574724 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dpi24-overlay.dts -@@ -0,0 +1,31 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ // There is no DPI driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&dpi24_pins>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ dpi24_pins: dpi24_pins { -+ brcm,pins = <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>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..fc48bd1eac605115c3b89fddfe39f5ea6181459f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts -@@ -0,0 +1,20 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ __overlay__ { -+ compatible = "brcm,bcm2708-usb"; -+ reg = <0x7e980000 0x10000>, -+ <0x7e006000 0x1000>; -+ interrupts = <2 0>, -+ <1 9>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..527abc9f0ddf71f4dc7d58336d87684c931cc2f3 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts -@@ -0,0 +1,29 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&usb>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ dwc2_usb: __overlay__ { -+ compatible = "brcm,bcm2835-usb"; -+ reg = <0x7e980000 0x10000>; -+ interrupts = <1 9>; -+ dr_mode = "otg"; -+ g-np-tx-fifo-size = <32>; -+ g-rx-fifo-size = <256>; -+ g-tx-fifo-size = <256 128 128 64 64 64 32>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ dr_mode = <&dwc2_usb>, "dr_mode"; -+ g-np-tx-fifo-size = <&dwc2_usb>,"g-np-tx-fifo-size:0"; -+ g-rx-fifo-size = <&dwc2_usb>,"g-rx-fifo-size:0"; -+ g-tx-fifo-size = <&dwc2_usb>,"g-tx-fifo-size:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..db8a8feed94c010e368065fdd88b028622303b6f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts -@@ -0,0 +1,53 @@ -+// Overlay for the Microchip ENC28J60 Ethernet Controller -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ eth1: enc28j60@0{ -+ compatible = "microchip,enc28j60"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; /* falling edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <ð1>, "interrupts:0", -+ <ð1_pins>, "brcm,pins:0"; -+ speed = <ð1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..946c9d2107a83335b11f094e75945a509595ab7c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts -@@ -0,0 +1,47 @@ -+// Overlay for the Microchip ENC28J60 Ethernet Controller - SPI2 Compute Module -+// Interrupt pin: 39 -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spi2>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ eth1: enc28j60@0{ -+ compatible = "microchip,enc28j60"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <39 0x2>; /* falling edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <39>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <ð1>, "interrupts:0", -+ <ð1_pins>, "brcm,pins:0"; -+ speed = <ð1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..af5baf7ddc92be7a59ad3d5f9a9fefba915bed05 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-ir-overlay.dts -@@ -0,0 +1,44 @@ -+// Definitions for ir-gpio module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ gpio_ir: ir-receiver { -+ compatible = "gpio-ir-receiver"; -+ -+ // pin number, high or low -+ gpios = <&gpio 18 1>; -+ -+ // parameter for keymap name -+ linux,rc-map-name = "rc-rc6-mce"; -+ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ gpio_ir_pins: gpio_ir_pins { -+ brcm,pins = <18>; // pin 18 -+ brcm,function = <0>; // in -+ brcm,pull = <1>; // down -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ // parameters -+ gpio_pin = <&gpio_ir>,"gpios:4", -+ <&gpio_ir_pins>,"brcm,pins:0"; // pin number -+ gpio_pull = <&gpio_ir_pins>,"brcm,pull:0"; // pull-up/down state -+ -+ rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ff8cb36d94d4940d5151ace24afc4ad1a9aa9fb6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for gpio-poweroff module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ power_ctrl: power_ctrl { -+ compatible = "gpio-poweroff"; -+ gpios = <&gpio 26 0>; -+ force; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ power_ctrl_pins: power_ctrl_pins { -+ brcm,pins = <26>; -+ brcm,function = <1>; // out -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&power_ctrl>,"gpios:4", -+ <&power_ctrl_pins>,"brcm,pins:0"; -+ active_low = <&power_ctrl>,"gpios:8"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..5f5785534fd3d9a97309796f842c8881e2d6979a ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Amp/Amp+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ tas5713@1b { -+ #sound-dai-cells = <0>; -+ compatible = "ti,tas5713"; -+ reg = <0x1b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-amp"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..0b74fdc6e0f640967a5681b28360e33b8d4b7cfa ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for HiFiBerry DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2f078d4747ccfdc5172e24b18ce65454f1219b9d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -@@ -0,0 +1,56 @@ -+// Definitions for HiFiBerry DAC+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ dacpro_osc: dacpro_osc { -+ compatible = "hifiberry,dacpro-clk"; -+ #clock-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4d { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4d>; -+ clocks = <&dacpro_osc>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&sound>; -+ hifiberry_dacplus: __overlay__ { -+ compatible = "hifiberry,hifiberry-dacplus"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = -+ <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; -+ slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..f5e41f48ba4fed92194ff5a63d13c70bb2d1c091 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for HiFiBerry Digi -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2a26d9cfffb0f3d7958eb3756ca7c4ba28400e1c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts -@@ -0,0 +1,41 @@ -+// Definitions for HiFiBerry Digi Pro -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "hifiberry,hifiberry-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ clock44-gpio = <&gpio 5 0>; -+ clock48-gpio = <&gpio 6 0>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ac0f3c28ea855a620dc6a3385d9d15009f26358d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts -@@ -0,0 +1,93 @@ -+/* -+ * Device Tree overlay for HY28A display -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28a_pins: hy28a_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hy28a: hy28a@0{ -+ compatible = "ilitek,ili9320"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28a_pins>; -+ -+ spi-max-frequency = <32000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ hy28a_ts: hy28a-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28a>,"spi-max-frequency:0"; -+ rotate = <&hy28a>,"rotate:0"; -+ fps = <&hy28a>,"fps:0"; -+ debug = <&hy28a>,"debug:0"; -+ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28a>,"reset-gpios:4", -+ <&hy28a_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28a>,"led-gpios:4", -+ <&hy28a_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8018aebde8e557f45ffd63eb86f6c7a1048fe3cb ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts -@@ -0,0 +1,148 @@ -+/* -+ * Device Tree overlay for HY28b display shield by Texy -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28b_pins: hy28b_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hy28b: hy28b@0{ -+ compatible = "ilitek,ili9325"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28b_pins>; -+ -+ spi-max-frequency = <48000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ -+ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; -+ -+ init = <0x10000e7 0x0010 -+ 0x1000000 0x0001 -+ 0x1000001 0x0100 -+ 0x1000002 0x0700 -+ 0x1000003 0x1030 -+ 0x1000004 0x0000 -+ 0x1000008 0x0207 -+ 0x1000009 0x0000 -+ 0x100000a 0x0000 -+ 0x100000c 0x0001 -+ 0x100000d 0x0000 -+ 0x100000f 0x0000 -+ 0x1000010 0x0000 -+ 0x1000011 0x0007 -+ 0x1000012 0x0000 -+ 0x1000013 0x0000 -+ 0x2000032 -+ 0x1000010 0x1590 -+ 0x1000011 0x0227 -+ 0x2000032 -+ 0x1000012 0x009c -+ 0x2000032 -+ 0x1000013 0x1900 -+ 0x1000029 0x0023 -+ 0x100002b 0x000e -+ 0x2000032 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000032 -+ 0x1000050 0x0000 -+ 0x1000051 0x00ef -+ 0x1000052 0x0000 -+ 0x1000053 0x013f -+ 0x1000060 0xa700 -+ 0x1000061 0x0001 -+ 0x100006a 0x0000 -+ 0x1000080 0x0000 -+ 0x1000081 0x0000 -+ 0x1000082 0x0000 -+ 0x1000083 0x0000 -+ 0x1000084 0x0000 -+ 0x1000085 0x0000 -+ 0x1000090 0x0010 -+ 0x1000092 0x0000 -+ 0x1000093 0x0003 -+ 0x1000095 0x0110 -+ 0x1000097 0x0000 -+ 0x1000098 0x0000 -+ 0x1000007 0x0133 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000064>; -+ debug = <0>; -+ }; -+ -+ hy28b_ts: hy28b-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28b>,"spi-max-frequency:0"; -+ rotate = <&hy28b>,"rotate:0"; -+ fps = <&hy28b>,"fps:0"; -+ debug = <&hy28b>,"debug:0"; -+ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28b>,"reset-gpios:4", -+ <&hy28b_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28b>,"led-gpios:4", -+ <&hy28b_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..0afc6b405414c97428278dd3e8836759092aedb5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-bcm2708-overlay.dts -@@ -0,0 +1,13 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ compatible = "brcm,bcm2708-i2c"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..b72b32e936774d901bc253b06e025c2dd48bdb1b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts -@@ -0,0 +1,43 @@ -+// Overlay for i2c_gpio bitbanging host bus. -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ i2c_gpio: i2c@0 { -+ compatible = "i2c-gpio"; -+ gpios = <&gpio 23 0 /* sda */ -+ &gpio 24 0 /* scl */ -+ >; -+ i2c-gpio,delay-us = <2>; /* ~100 kHz */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/aliases"; -+ __overlay__ { -+ i2c_gpio = "/i2c@0"; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/__symbols__"; -+ __overlay__ { -+ i2c_gpio = "/i2c@0"; -+ }; -+ }; -+ -+ __overrides__ { -+ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; -+ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; -+ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..976d38e781539093e91fe641497d8a6701dd6035 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts -@@ -0,0 +1,139 @@ -+// Umbrella I2C Mux overlay -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca9542: mux@70 { -+ compatible = "nxp,pca9542"; -+ reg = <0x70>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ i2c@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0>; -+ }; -+ i2c@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca9545: mux@70 { -+ compatible = "nxp,pca9545"; -+ reg = <0x70>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ i2c@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0>; -+ }; -+ i2c@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ }; -+ i2c@2 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <2>; -+ }; -+ i2c@3 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <3>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca9548: mux@70 { -+ compatible = "nxp,pca9548"; -+ reg = <0x70>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ i2c@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0>; -+ }; -+ i2c@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ }; -+ i2c@2 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <2>; -+ }; -+ i2c@3 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <3>; -+ }; -+ i2c@4 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <4>; -+ }; -+ i2c@5 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <5>; -+ }; -+ i2c@6 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <6>; -+ }; -+ i2c@7 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <7>; -+ }; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ pca9542 = <0>, "+0"; -+ pca9545 = <0>, "+1"; -+ pca9548 = <0>, "+2"; -+ -+ addr = <&pca9542>,"reg:0", -+ <&pca9545>,"reg:0", -+ <&pca9548>,"reg:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d1ffd2326669e46ad68939f94713cc992dee57e0 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts -@@ -0,0 +1,26 @@ -+// Definitions for NXP PCA9685A I2C PWM controller on ARM I2C bus. -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pca: pca@40 { -+ compatible = "nxp,pca9685"; -+ #pwm-cells = <2>; -+ reg = <0x40>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ __overrides__ { -+ addr = <&pca>,"reg:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..1efcf0b712c9c5c19210545002ac1f0931db58f5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -@@ -0,0 +1,83 @@ -+// Definitions for several I2C based Real Time Clocks -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ abx80x: abx80x@69 { -+ compatible = "abracon,abx80x"; -+ reg = <0x69>; -+ abracon,tc-diode = "standard"; -+ abracon,tc-resistor = <0>; -+ status = "disable"; -+ }; -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ ds1339: ds1339@68 { -+ compatible = "dallas,ds1339"; -+ trickle-resistor-ohms = <0>; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ mcp7940x: mcp7940x@6f { -+ compatible = "microchip,mcp7940x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ mcp7941x: mcp7941x@6f { -+ compatible = "microchip,mcp7941x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf2127: pcf2127@51 { -+ compatible = "nxp,pcf2127"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ pcf8523: pcf8523@68 { -+ compatible = "nxp,pcf8523"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ }; -+ }; -+ __overrides__ { -+ abx80x = <&abx80x>,"status"; -+ ds1307 = <&ds1307>,"status"; -+ ds1339 = <&ds1339>,"status"; -+ ds3231 = <&ds3231>,"status"; -+ mcp7940x = <&mcp7940x>,"status"; -+ mcp7941x = <&mcp7941x>,"status"; -+ pcf2127 = <&pcf2127>,"status"; -+ pcf8523 = <&pcf8523>,"status"; -+ pcf8563 = <&pcf8563>,"status"; -+ trickle-diode-type = <&abx80x>,"abracon,tc-diode"; -+ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0", -+ <&abx80x>,"abracon,tc-resistor"; -+ wakeup-source = <&ds1339>,"wakeup-source?", -+ <&ds3231>,"wakeup-source?", -+ <&mcp7940x>,"wakeup-source?", -+ <&mcp7941x>,"wakeup-source?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..f6d134c095af2398fc55ae7d2b0e86456c30627c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for a few digital barometric pressure and temperature sensors -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ bmp085: bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "disable"; -+ }; -+ -+ bmp280: bmp280@76 { -+ compatible = "bosch,bmp280"; -+ reg = <0x76>; -+ status = "disable"; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ bmp085 = <&bmp085>,"status"; -+ bmp280 = <&bmp280>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..1f4fc7b570604a50ff6d3f6d676c3c4642d66b17 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts -@@ -0,0 +1,61 @@ -+/* -+ * Device tree overlay for i2c_bcm2708, i2c0 bus -+ * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c0_pins>; -+ frag1: __overlay__ { -+ brcm,pins = <0 1>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c0_pins>; -+ __dormant__ { -+ brcm,pins = <28 29>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c0_pins>; -+ __dormant__ { -+ brcm,pins = <44 45>; -+ brcm,function = <5>; /* alt1 */ -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c0_pins>; -+ __dormant__ { -+ brcm,pins = <46 47>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ -+ __overrides__ { -+ sda0_pin = <&frag1>,"brcm,pins:0"; -+ scl0_pin = <&frag1>,"brcm,pins:4"; -+ pins_0_1 = <0>,"+1-2-3-4"; -+ pins_28_29 = <0>,"-1+2-3-4"; -+ pins_44_45 = <0>,"-1-2+3-4"; -+ pins_46_47 = <0>,"-1-2-3+4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e303b9c61c82a28eab7b48f6b085661574d5a849 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -@@ -0,0 +1,37 @@ -+/* -+ * Device tree overlay for i2c_bcm2708, i2c1 bus -+ * -+ * Compile: -+ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ pinctrl-0 = <&i2c1_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; -+ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; -+ pin_func = <&i2c1_pins>,"brcm,function:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..30c356d6070cc3b1dfd1d5a07dc1021339bf5bd2 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts -@@ -0,0 +1,18 @@ -+/* -+ * Device tree overlay to move i2s to gpio 28 to 31 on CM -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2s_pins>; -+ __overlay__ { -+ brcm,pins = <28 29 30 31>; -+ brcm,function = <6>; /* alt2 */ -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..0d35c85382bb5766b3eeb9de1bd4a94621229e4b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts -@@ -0,0 +1,43 @@ -+// Definitions for IQaudIO DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ frag2: __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&frag2>,"iqaudio,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d4bad8742a985e2f15eed19ca52ef283a74fefb9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts -@@ -0,0 +1,46 @@ -+// Definitions for IQaudIO DAC+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ iqaudio_dac: __overlay__ { -+ compatible = "iqaudio,iqaudio-dac"; -+ i2s-controller = <&i2s>; -+ mute-gpios = <&gpio 22 0>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&iqaudio_dac>,"iqaudio,24db_digital_gain?"; -+ auto_mute_amp = <&iqaudio_dac>,"iqaudio-dac,auto-mute-amp?"; -+ unmute_amp = <&iqaudio_dac>,"iqaudio-dac,unmute-amp?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..da4fbfdfdbbbcf2505b9eb4789ddb779ec72cea8 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts -@@ -0,0 +1,47 @@ -+// Definitions for IQAudIO Digi WM8804 audio board -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ // DVDD-supply = <®_3v3>; -+ // PVDD-supply = <®_3v3>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ wm8804_digi: __overlay__ { -+ compatible = "iqaudio,wm8804-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ card_name = <&wm8804_digi>,"wm8804-digi,card-name"; -+ dai_name = <&wm8804_digi>,"wm8804-digi,dai-name"; -+ dai_stream_name = <&wm8804_digi>,"wm8804-digi,dai-stream-name"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..312632ad376d5b8c8ff1dbf31fa03d0d18181d94 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts -@@ -0,0 +1,43 @@ -+// Definitions for JustBoom DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4d { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4d>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ frag2: __overlay__ { -+ compatible = "justboom,justboom-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ 24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..cbbede9a541166ba257122918081982016e0b7eb ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for JustBoom Digi -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "justboom,justboom-digi"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7d5d82bdf4c41cfbafada51a6d23cbd57822828f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts -@@ -0,0 +1,57 @@ -+// Definitions for lirc-rpi module -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ lirc_rpi: lirc_rpi { -+ compatible = "rpi,lirc-rpi"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lirc_pins>; -+ status = "okay"; -+ -+ // Override autodetection of IR receiver circuit -+ // (0 = active high, 1 = active low, -1 = no override ) -+ rpi,sense = <0xffffffff>; -+ -+ // Software carrier -+ // (0 = off, 1 = on) -+ rpi,softcarrier = <1>; -+ -+ // Invert output -+ // (0 = off, 1 = on) -+ rpi,invert = <0>; -+ -+ // Enable debugging messages -+ // (0 = off, 1 = on) -+ rpi,debug = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ lirc_pins: lirc_pins { -+ brcm,pins = <17 18>; -+ brcm,function = <1 0>; // out in -+ brcm,pull = <0 1>; // off down -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; -+ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; -+ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; -+ -+ sense = <&lirc_rpi>,"rpi,sense:0"; -+ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; -+ invert = <&lirc_rpi>,"rpi,invert:0"; -+ debug = <&lirc_rpi>,"rpi,debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp23017-overlay.dts b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..412f966a3cc0a312771b7182310a7045fb923224 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp23017-overlay.dts -@@ -0,0 +1,54 @@ -+// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ mcp23017_pins: mcp23017_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ mcp23017: mcp@20 { -+ compatible = "microchip,mcp23017"; -+ reg = <0x20>; -+ gpio-controller; -+ #gpio-cells = <2>; -+ #interrupt-cells=<2>; -+ interrupt-parent = <&gpio>; -+ interrupts = <4 2>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&mcp23017_pins>,"brcm,pins:0", -+ <&mcp23017>,"interrupts:0"; -+ addr = <&mcp23017>,"reg:0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/mcp23s17-overlay.dts b/arch/arm/boot/dts/overlays/mcp23s17-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7dcbacb3cd007eb15b2b0f165fd8adc7a7b7c580 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp23s17-overlay.dts -@@ -0,0 +1,732 @@ -+// Overlay for MCP23S08/17 GPIO Extenders from Microchip Semiconductor -+ -+// dtparams: -+// s08-spi--present - 4-bit integer, bitmap indicating MCP23S08 devices present on SPI, CS#. -+// s17-spi--present - 8-bit integer, bitmap indicating MCP23S17 devices present on SPI, CS#. -+// s08-spi--int-gpio - integer, enables interrupts on a single MCP23S08 device on SPI, CS#, specifies the GPIO pin to which INT output is connected. -+// s17-spi--int-gpio - integer, enables mirrored interrupts on a single MCP23S17 device on SPI, CS#, specifies the GPIO pin to which either INTA or INTB output is connected. -+// -+// If devices are present on SPI1 or SPI2, those interfaces must be enabled with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays. -+// If interrupts are enabled for a device on a given CS# on a SPI bus, that device must be the only one present on that SPI bus/CS#. -+// -+// Example 1: A single MCP23S17 device on SPI0, CS#0 with its SPI addr set to 0 and INTA output connected to GPIO25: -+// dtoverlay=mcp23s17:s17-spi0-0-present=1,s17-spi0-0-int-gpio=25 -+// -+// Example 2: Two MCP23S08 devices on SPI1, CS#0 with their addrs set to 2 and 3. Three MCP23S17 devices on SPI1, CS#1 with their addrs set to 0, 1 and 7: -+// dtoverlay=spi1-2cs -+// dtoverlay=mcp23s17:s08-spi1-0-present=12,s17-spi1-1-present=131 -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ // disable spi-dev on spi0.0 -+ fragment@0 { -+ target = <&spidev0>; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi0.1 -+ fragment@1 { -+ target = <&spidev1>; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi1.0 -+ fragment@2 { -+ target-path = "spi1/spidev@0"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi1.1 -+ fragment@3 { -+ target-path = "spi1/spidev@1"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi1.2 -+ fragment@4 { -+ target-path = "spi1/spidev@2"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi2.0 -+ fragment@5 { -+ target-path = "spi2/spidev@0"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi2.1 -+ fragment@6 { -+ target-path = "spi2/spidev@1"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // disable spi-dev on spi2.2 -+ fragment@7 { -+ target-path = "spi2/spidev@2"; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi0.0 -+ fragment@8 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_00: mcp23s08@0 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi0-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi0-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi0.1 -+ fragment@9 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_01: mcp23s08@1 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi0-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi0-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi1.0 -+ fragment@10 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_10: mcp23s08@0 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi1-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi1-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi1.1 -+ fragment@11 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_11: mcp23s08@1 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi1-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi1-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi1.2 -+ fragment@12 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_12: mcp23s08@2 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi1-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi1-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi2.0 -+ fragment@13 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_20: mcp23s08@0 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi2-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi2-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi2.1 -+ fragment@14 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_21: mcp23s08@1 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi2-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi2-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s08s on spi2.2 -+ fragment@15 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s08_22: mcp23s08@2 { -+ compatible = "microchip,mcp23s08"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s08-spi2-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s08-spi2-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi0.0 -+ fragment@16 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_00: mcp23s17@0 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi0-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi0-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi0.1 -+ fragment@17 { -+ target = <&spi0>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_01: mcp23s17@1 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi0-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi0-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi1.0 -+ fragment@18 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_10: mcp23s17@0 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi1-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi1-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi1.1 -+ fragment@19 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_11: mcp23s17@1 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi1-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi1-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi1.2 -+ fragment@20 { -+ target = <&spi1>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_12: mcp23s17@2 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi1-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi1-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi2.0 -+ fragment@21 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_20: mcp23s17@0 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi2-0-present parameter */ -+ reg = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi2-0-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi2.1 -+ fragment@22 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_21: mcp23s17@1 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi2-1-present parameter */ -+ reg = <1>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi2-1-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // enable one or more mcp23s17s on spi2.2 -+ fragment@23 { -+ target = <&spi2>; -+ __dormant__ { -+ status = "okay"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ mcp23s17_22: mcp23s17@2 { -+ compatible = "microchip,mcp23s17"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ microchip,spi-present-mask = <0x00>; /* overwritten by mcp23s17-spi2-2-present parameter */ -+ reg = <2>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ #interrupt-cells=<2>; -+ interrupts = <0 2>; /* 1st word overwritten by mcp23s17-spi2-2-int-gpio parameter */ -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi0.0 as a input with no pull-up/down -+ fragment@24 { -+ target = <&gpio>; -+ __dormant__ { -+ spi0_0_int_pins: spi0_0_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi0-0-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi0.1 as a input with no pull-up/down -+ fragment@25 { -+ target = <&gpio>; -+ __dormant__ { -+ spi0_1_int_pins: spi0_1_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi0-1-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi1.0 as a input with no pull-up/down -+ fragment@26 { -+ target = <&gpio>; -+ __dormant__ { -+ spi1_0_int_pins: spi1_0_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi1-0-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi1.1 as a input with no pull-up/down -+ fragment@27 { -+ target = <&gpio>; -+ __dormant__ { -+ spi1_1_int_pins: spi1_1_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi1-1-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi1.2 as a input with no pull-up/down -+ fragment@28 { -+ target = <&gpio>; -+ __dormant__ { -+ spi1_2_int_pins: spi1_2_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi1-2-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi2.0 as a input with no pull-up/down -+ fragment@29 { -+ target = <&gpio>; -+ __dormant__ { -+ spi2_0_int_pins: spi2_0_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi2-0-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi2.1 as a input with no pull-up/down -+ fragment@30 { -+ target = <&gpio>; -+ __dormant__ { -+ spi2_1_int_pins: spi2_1_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi2-1-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Configure GPIO pin connected to INT(A/B) output of mcp23s08/17 on spi2.2 as a input with no pull-up/down -+ fragment@31 { -+ target = <&gpio>; -+ __dormant__ { -+ spi2_2_int_pins: spi2_2_int_pins { -+ brcm,pins = <0>; /* overwritten by mcp23s08/17-spi2-2-int-gpio parameter */ -+ brcm,function = <0>; -+ brcm,pull = <0>; -+ }; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi0.0. -+ // Use default active low interrupt signalling. -+ fragment@32 { -+ target = <&mcp23s08_00>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi0.1. -+ // Use default active low interrupt signalling. -+ fragment@33 { -+ target = <&mcp23s08_01>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi1.0. -+ // Use default active low interrupt signalling. -+ fragment@34 { -+ target = <&mcp23s08_10>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi1.1. -+ // Use default active low interrupt signalling. -+ fragment@35 { -+ target = <&mcp23s08_11>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi1.2. -+ // Use default active low interrupt signalling. -+ fragment@36 { -+ target = <&mcp23s08_12>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi2.0. -+ // Use default active low interrupt signalling. -+ fragment@37 { -+ target = <&mcp23s08_20>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi2.1. -+ // Use default active low interrupt signalling. -+ fragment@38 { -+ target = <&mcp23s08_21>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s08 on spi2.2. -+ // Use default active low interrupt signalling. -+ fragment@39 { -+ target = <&mcp23s08_22>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi0.0. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Use default active low interrupt signalling. -+ fragment@40 { -+ target = <&mcp23s17_00>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi0.1. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@41 { -+ target = <&mcp23s17_01>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi1.0. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@42 { -+ target = <&mcp23s17_10>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi1.1. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@43 { -+ target = <&mcp23s17_11>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi1.2. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@44 { -+ target = <&mcp23s17_12>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi2.0. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@45 { -+ target = <&mcp23s17_20>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi2.1. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@46 { -+ target = <&mcp23s17_21>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ // Enable interrupts for a mcp23s17 on spi2.2. -+ // Enable mirroring so that either INTA or INTB output of mcp23s17 can be connected to the GPIO pin. -+ // Configure INTA/B outputs of mcp23s08/17 as active low. -+ fragment@47 { -+ target = <&mcp23s17_22>; -+ __dormant__ { -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ microchip,irq-mirror; -+ }; -+ }; -+ -+ __overrides__ { -+ s08-spi0-0-present = <0>,"+0+8", <&mcp23s08_00>,"microchip,spi-present-mask:0"; -+ s08-spi0-1-present = <0>,"+1+9", <&mcp23s08_01>,"microchip,spi-present-mask:0"; -+ s08-spi1-0-present = <0>,"+2+10", <&mcp23s08_10>,"microchip,spi-present-mask:0"; -+ s08-spi1-1-present = <0>,"+3+11", <&mcp23s08_11>,"microchip,spi-present-mask:0"; -+ s08-spi1-2-present = <0>,"+4+12", <&mcp23s08_12>,"microchip,spi-present-mask:0"; -+ s08-spi2-0-present = <0>,"+5+13", <&mcp23s08_20>,"microchip,spi-present-mask:0"; -+ s08-spi2-1-present = <0>,"+6+14", <&mcp23s08_21>,"microchip,spi-present-mask:0"; -+ s08-spi2-2-present = <0>,"+7+15", <&mcp23s08_22>,"microchip,spi-present-mask:0"; -+ s17-spi0-0-present = <0>,"+0+16", <&mcp23s17_00>,"microchip,spi-present-mask:0"; -+ s17-spi0-1-present = <0>,"+1+17", <&mcp23s17_01>,"microchip,spi-present-mask:0"; -+ s17-spi1-0-present = <0>,"+2+18", <&mcp23s17_10>,"microchip,spi-present-mask:0"; -+ s17-spi1-1-present = <0>,"+3+19", <&mcp23s17_11>,"microchip,spi-present-mask:0"; -+ s17-spi1-2-present = <0>,"+4+20", <&mcp23s17_12>,"microchip,spi-present-mask:0"; -+ s17-spi2-0-present = <0>,"+5+21", <&mcp23s17_20>,"microchip,spi-present-mask:0"; -+ s17-spi2-1-present = <0>,"+6+22", <&mcp23s17_21>,"microchip,spi-present-mask:0"; -+ s17-spi2-2-present = <0>,"+7+23", <&mcp23s17_22>,"microchip,spi-present-mask:0"; -+ s08-spi0-0-int-gpio = <0>,"+24+32", <&spi0_0_int_pins>,"brcm,pins:0", <&mcp23s08_00>,"interrupts:0"; -+ s08-spi0-1-int-gpio = <0>,"+25+33", <&spi0_1_int_pins>,"brcm,pins:0", <&mcp23s08_01>,"interrupts:0"; -+ s08-spi1-0-int-gpio = <0>,"+26+34", <&spi1_0_int_pins>,"brcm,pins:0", <&mcp23s08_10>,"interrupts:0"; -+ s08-spi1-1-int-gpio = <0>,"+27+35", <&spi1_1_int_pins>,"brcm,pins:0", <&mcp23s08_11>,"interrupts:0"; -+ s08-spi1-2-int-gpio = <0>,"+28+36", <&spi1_2_int_pins>,"brcm,pins:0", <&mcp23s08_12>,"interrupts:0"; -+ s08-spi2-0-int-gpio = <0>,"+29+37", <&spi2_0_int_pins>,"brcm,pins:0", <&mcp23s08_20>,"interrupts:0"; -+ s08-spi2-1-int-gpio = <0>,"+30+38", <&spi2_1_int_pins>,"brcm,pins:0", <&mcp23s08_21>,"interrupts:0"; -+ s08-spi2-2-int-gpio = <0>,"+31+39", <&spi2_2_int_pins>,"brcm,pins:0", <&mcp23s08_22>,"interrupts:0"; -+ s17-spi0-0-int-gpio = <0>,"+24+40", <&spi0_0_int_pins>,"brcm,pins:0", <&mcp23s17_00>,"interrupts:0"; -+ s17-spi0-1-int-gpio = <0>,"+25+41", <&spi0_1_int_pins>,"brcm,pins:0", <&mcp23s17_01>,"interrupts:0"; -+ s17-spi1-0-int-gpio = <0>,"+26+42", <&spi1_0_int_pins>,"brcm,pins:0", <&mcp23s17_10>,"interrupts:0"; -+ s17-spi1-1-int-gpio = <0>,"+27+43", <&spi1_1_int_pins>,"brcm,pins:0", <&mcp23s17_11>,"interrupts:0"; -+ s17-spi1-2-int-gpio = <0>,"+28+44", <&spi1_2_int_pins>,"brcm,pins:0", <&mcp23s17_12>,"interrupts:0"; -+ s17-spi2-0-int-gpio = <0>,"+29+45", <&spi2_0_int_pins>,"brcm,pins:0", <&mcp23s17_20>,"interrupts:0"; -+ s17-spi2-1-int-gpio = <0>,"+30+46", <&spi2_1_int_pins>,"brcm,pins:0", <&mcp23s17_21>,"interrupts:0"; -+ s17-spi2-2-int-gpio = <0>,"+31+47", <&spi2_2_int_pins>,"brcm,pins:0", <&mcp23s17_22>,"interrupts:0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -new file mode 100755 -index 0000000000000000000000000000000000000000..c96cdae27fb15055c4a6ec55d1ee45644768c392 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts -@@ -0,0 +1,73 @@ -+/* -+ * Device tree overlay for mcp251x/can0 on spi0.0 -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.0 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ /* the interrupt pin of the can-controller */ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ can0_pins: can0_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; -+ -+ /* the clock/oscillator of the can-controller */ -+ fragment@3 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on SPI0.0 */ -+ can0_osc: can0_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; -+ -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can0: mcp2515@0 { -+ reg = <0>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can0_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can0_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can0_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can0>,"spi-max-frequency:0"; -+ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..67bd0d9bdaa2ff767d284010a69ecfe3f2aa1fd1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts -@@ -0,0 +1,73 @@ -+/* -+ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ /* disable spi-dev for spi0.1 */ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ /* the interrupt pin of the can-controller */ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ can1_pins: can1_pins { -+ brcm,pins = <25>; -+ brcm,function = <0>; /* input */ -+ }; -+ }; -+ }; -+ -+ /* the clock/oscillator of the can-controller */ -+ fragment@3 { -+ target-path = "/clocks"; -+ __overlay__ { -+ /* external oscillator of mcp2515 on spi0.1 */ -+ can1_osc: can1_osc { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <16000000>; -+ }; -+ }; -+ }; -+ -+ /* the spi config of the can-controller itself binding everything together */ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ can1: mcp2515@1 { -+ reg = <1>; -+ compatible = "microchip,mcp2515"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&can1_pins>; -+ spi-max-frequency = <10000000>; -+ interrupt-parent = <&gpio>; -+ interrupts = <25 0x2>; -+ clocks = <&can1_osc>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ oscillator = <&can1_osc>,"clock-frequency:0"; -+ spimaxfrequency = <&can1>,"spi-max-frequency:0"; -+ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/midi-uart0-overlay.dts b/arch/arm/boot/dts/overlays/midi-uart0-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..565af7cf79d761877be3bd06191f31aabf9e1e9b ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/midi-uart0-overlay.dts -@@ -0,0 +1,36 @@ -+/dts-v1/; -+/plugin/; -+ -+#include -+ -+/* -+ * Fake a higher clock rate to get a larger divisor, and thereby a lower -+ * baudrate. The real clock is 48MHz, which we scale so that requesting -+ * 38.4kHz results in an actual 31.25kHz. -+ * -+ * 48000000*38400/31250 = 58982400 -+ */ -+ -+/{ -+ compatible = "brcm,bcm2835"; -+ -+ fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ midi_clk: midi_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-output-names = "uart0_pclk"; -+ clock-frequency = <58982400>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart0>; -+ __overlay__ { -+ clocks = <&midi_clk>, -+ <&clocks BCM2835_CLOCK_VPU>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d32b02ca01ced5ab3de00d66d5412c8fda4bc510 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts -@@ -0,0 +1,38 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&mmc>; -+ frag0: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc_pins>; -+ bus-width = <4>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ mmc_pins: mmc_pins { -+ brcm,pins = <48 49 50 51 52 53>; -+ brcm,function = <7>; /* alt3 */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sdhost>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2c29aaed44c5959d7f0df2a3baf2af052b24b6b4 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts -@@ -0,0 +1,117 @@ -+/* -+ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ mz61581_pins: mz61581_pins { -+ brcm,pins = <4 15 18 25>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ mz61581: mz61581@0{ -+ compatible = "samsung,s6d02a1"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mz61581_pins>; -+ -+ spi-max-frequency = <128000000>; -+ spi-cpol; -+ spi-cpha; -+ -+ width = <320>; -+ height = <480>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ txbuflen = <32768>; -+ -+ reset-gpios = <&gpio 15 0>; -+ dc-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 0>; -+ -+ init = <0x10000b0 00 -+ 0x1000011 -+ 0x20000ff -+ 0x10000b3 0x02 0x00 0x00 0x00 -+ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 -+ 0x10000c1 0x08 0x16 0x08 0x08 -+ 0x10000c4 0x11 0x07 0x03 0x03 -+ 0x10000c6 0x00 -+ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 -+ 0x1000035 0x00 -+ 0x1000036 0xa0 -+ 0x100003a 0x55 -+ 0x1000044 0x00 0x01 -+ 0x10000d0 0x07 0x07 0x1d 0x03 -+ 0x10000d1 0x03 0x30 0x10 -+ 0x10000d2 0x03 0x14 0x04 -+ 0x1000029 -+ 0x100002c>; -+ -+ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ -+ debug = <3>; -+ }; -+ -+ mz61581_ts: mz61581_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <4 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 4 0>; -+ -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&mz61581>, "spi-max-frequency:0"; -+ rotate = <&mz61581>, "rotate:0"; -+ fps = <&mz61581>, "fps:0"; -+ txbuflen = <&mz61581>, "txbuflen:0"; -+ debug = <&mz61581>, "debug:0"; -+ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..14a59dcf13ca64eb0bdbd34d70690a11abe83cfa ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts -@@ -0,0 +1,27 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed -+ from the VPU. There is a special driver for this with a separate DT node, -+ which has the unfortunate consequence of breaking the act_led_gpio and -+ act_led_activelow dtparams. -+ -+ This overlay changes the GPIO controller back to the standard one and -+ restores the dtparams. -+*/ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&act_led>; -+ frag0: __overlay__ { -+ gpios = <&gpio 0 0>; -+ }; -+ }; -+ -+ __overrides__ { -+ gpio = <&frag0>,"gpios:4"; -+ activelow = <&frag0>,"gpios:8"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..87cf345f9641e62c5ed496c238333716cc5b27e6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts -@@ -0,0 +1,46 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. -+ To disable the systemd service that initialises the modem so it doesn't use -+ the UART: -+ -+ sudo systemctl disable hciuart -+*/ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&uart1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart0>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&uart0_pins>; -+ __overlay__ { -+ brcm,pins; -+ brcm,function; -+ brcm,pull; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/aliases"; -+ __overlay__ { -+ serial0 = "/soc/serial@7e201000"; -+ serial1 = "/soc/serial@7e215040"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..18f77453c38dbbf33f3726a5b4cce15b9f20f390 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts -@@ -0,0 +1,64 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore -+ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum -+ usable baudrate. -+ -+ It is also necessary to edit /lib/systemd/system/hciuart.service and -+ replace ttyAMA0 with ttyS0, unless you have a system with udev rules -+ that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1 -+ instead because it will always be correct. -+ -+ If cmdline.txt uses the alias serial0 to refer to the user-accessable port -+ then the firmware will replace with the appropriate port whether or not -+ this overlay is used. -+*/ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&uart0>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart1>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins &bt_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&uart0_pins>; -+ __overlay__ { -+ brcm,pins; -+ brcm,function; -+ brcm,pull; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&uart1_pins>; -+ __overlay__ { -+ brcm,pins = <32 33>; -+ brcm,function = <2>; /* alt5=UART1 */ -+ brcm,pull = <0 2>; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/aliases"; -+ __overlay__ { -+ serial0 = "/soc/serial@7e201000"; -+ serial1 = "/soc/serial@7e215040"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..40a1f295346e39130a9d5a97844163c434b19e82 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts -@@ -0,0 +1,102 @@ -+/* -+ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen_pins: piscreen_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen: piscreen@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen_pins>; -+ -+ spi-max-frequency = <24000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c2 0x44 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 -+ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x1000011 -+ 0x1000029>; -+ }; -+ -+ piscreen_ts: piscreen-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen>,"spi-max-frequency:0"; -+ rotate = <&piscreen>,"rotate:0"; -+ fps = <&piscreen>,"fps:0"; -+ debug = <&piscreen>,"debug:0"; -+ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..9c0bed893057b9129c8f16b0b695b85b1f634597 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/piscreen2r-overlay.dts -@@ -0,0 +1,106 @@ -+ /* -+ * Device Tree overlay for PiScreen2 3.5" TFT with resistive touch by Ozzmaker.com -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen2_pins: piscreen2_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen2: piscreen2@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen2_pins>; -+ bgr; -+ spi-max-frequency = <64000000>; -+ rotate = <90>; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ txbuflen = <32768>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c0 0x11 0x09 -+ 0x10000c1 0x41 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000b6 0x00 0x02 -+ 0x10000f7 0xa9 0x51 0x2c 0x2 -+ 0x10000be 0x00 0x04 -+ 0x10000e9 0x00 -+ 0x1000011 -+ 0x1000029>; -+ -+ }; -+ -+ piscreen2_ts: piscreen2-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,swap-xy; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen2>,"spi-max-frequency:0"; -+ rotate = <&piscreen2>,"rotate:0"; -+ fps = <&piscreen2>,"fps:0"; -+ debug = <&piscreen2>,"debug:0"; -+ xohms = <&piscreen2_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -+ -diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7cdfc29ba4fbffd3216376677922e7ae26019055 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts -@@ -0,0 +1,114 @@ -+/* -+ * pisound Linux kernel module. -+ * Copyright (C) 2016 Vilniaus Blokas UAB, http://blokas.io/pisound -+ * -+ * 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; version 2 of the -+ * License. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+#include -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "blokaslabs,pisound"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ -+ pinctrl-0 = <&pisound_button_pins>; -+ -+ osr-gpios = -+ <&gpio 13 GPIO_ACTIVE_HIGH>, -+ <&gpio 26 GPIO_ACTIVE_HIGH>, -+ <&gpio 16 GPIO_ACTIVE_HIGH>; -+ -+ reset-gpios = -+ <&gpio 12 GPIO_ACTIVE_HIGH>, -+ <&gpio 24 GPIO_ACTIVE_HIGH>; -+ -+ data_available-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; -+ -+ button-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pisound_button_pins>; -+ -+ pisound_button_pins: pisound_button_pins { -+ brcm,pins = <17>; -+ brcm,function = <0>; // Input -+ brcm,pull = <2>; // Pull-Up -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pisound_spi: pisound_spi@0{ -+ compatible = "blokaslabs,pisound-spi"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; -+ spi-max-frequency = <1000000>; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft22-overlay.dts b/arch/arm/boot/dts/overlays/pitft22-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..894ba2292f6be76356f3ab39376d84ebd72fa29d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft22-overlay.dts -@@ -0,0 +1,69 @@ -+/* -+ * Device Tree overlay for pitft by Adafruit -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <25>; -+ brcm,function = <1>; /* out */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..5c0752655c70692e1c63f2f662e5b541c4be3617 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-capacitive-overlay.dts -@@ -0,0 +1,91 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" capacitive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c1>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ ft6236: ft6236@38 { -+ compatible = "focaltech,ft6236"; -+ reg = <0x38>; -+ -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; -+ touchscreen-size-x = <240>; -+ touchscreen-size-y = <320>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ touch-sizex = <&ft6236>,"touchscreen-size-x?"; -+ touch-sizey = <&ft6236>,"touchscreen-size-y?"; -+ touch-invx = <&ft6236>,"touchscreen-inverted-x?"; -+ touch-invy = <&ft6236>,"touchscreen-inverted-y?"; -+ touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ed2afc2f7fd6528f4e6d75bb2d534307ed020720 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts -@@ -0,0 +1,121 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; -+ -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target-path = "/soc"; -+ __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..25cb5cc9576dadc3539f4ea3c9507c592ccac9d6 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts -@@ -0,0 +1,121 @@ -+/* -+ * Device Tree overlay for Adafruit PiTFT 3.5" resistive touch screen -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "himax,hx8357d"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; -+ -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target-path = "/soc"; -+ __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..50143a4bb215807ba0a0d0562f5827fa29a04de4 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts -@@ -0,0 +1,35 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ pps: pps { -+ compatible = "pps-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pps_pins>; -+ gpios = <&gpio 18 0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pps_pins: pps_pins { -+ brcm,pins = <18>; -+ brcm,function = <0>; // in -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&pps>,"gpios:4", -+ <&pps_pins>,"brcm,pins:0"; -+ assert_falling_edge = <&pps>,"assert-falling-edge?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..abdeddd0f2c873e2b1fffcf6f2b838ee0123768f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts -@@ -0,0 +1,47 @@ -+/dts-v1/; -+/plugin/; -+ -+/* -+This is the 2-channel overlay - only use it if you need both channels. -+ -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ -+ -+/ { -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18 19>; -+ brcm,function = <2 2>; /* Alt5 */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&pwm>; -+ frag1: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ assigned-clock-rates = <100000000>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ pin2 = <&pwm_pins>,"brcm,pins:4"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ func2 = <&pwm_pins>,"brcm,function:4"; -+ clock = <&frag1>,"assigned-clock-rates:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/pwm-overlay.dts b/arch/arm/boot/dts/overlays/pwm-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..27809e8dc74660a8e922a1aff1bb2ca7186e411c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pwm-overlay.dts -@@ -0,0 +1,43 @@ -+/dts-v1/; -+/plugin/; -+ -+/* -+Legal pin,function combinations for each channel: -+ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1) -+ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1) -+ -+N.B.: -+ 1) Pin 18 is the only one available on all platforms, and -+ it is the one used by the I2S audio interface. -+ Pins 12 and 13 might be better choices on an A+, B+ or Pi2. -+ 2) The onboard analogue audio output uses both PWM channels. -+ 3) So be careful mixing audio and PWM. -+*/ -+ -+/ { -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ pwm_pins: pwm_pins { -+ brcm,pins = <18>; -+ brcm,function = <2>; /* Alt5 */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&pwm>; -+ frag1: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm_pins>; -+ assigned-clock-rates = <100000000>; -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ pin = <&pwm_pins>,"brcm,pins:0"; -+ func = <&pwm_pins>,"brcm,function:0"; -+ clock = <&frag1>,"assigned-clock-rates:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/qca7000-overlay.dts b/arch/arm/boot/dts/overlays/qca7000-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..b4e601396c4955b9e5de3a639d9afd74d051e3fd ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/qca7000-overlay.dts -@@ -0,0 +1,52 @@ -+// Overlay for the Qualcomm Atheros QCA7000 on I2SE's PLC Stamp micro EVK -+// Visit: https://www.i2se.com/product/plc-stamp-micro-evk for details -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ spidev@0 { -+ status = "disabled"; -+ }; -+ -+ eth1: qca7000@0 { -+ compatible = "qca,qca7000"; -+ reg = <0>; /* CE0 */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <ð1_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <23 0x1>; /* rising edge */ -+ spi-max-frequency = <12000000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ eth1_pins: eth1_pins { -+ brcm,pins = <23>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <0>; /* none */ -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <ð1>, "interrupts:0", -+ <ð1_pins>, "brcm,pins:0"; -+ speed = <ð1>, "spi-max-frequency:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2fac57ca179fcf114655ea91dbef419c16aceb79 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts -@@ -0,0 +1,45 @@ -+// Definitions for RaspiDACv3 -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcm5122@4c { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5122"; -+ reg = <0x4c>; -+ status = "okay"; -+ }; -+ -+ tpa6130a2: tpa6130a2@60 { -+ compatible = "ti,tpa6130a2"; -+ reg = <0x60>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "jg,raspidacv3"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..c021d02bb75ff5ceb5c5066d00e4bca942554032 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts -@@ -0,0 +1,21 @@ -+/* -+ * Devicetree overlay for mailbox-driven Raspberry Pi DSI Display -+ * backlight controller -+ */ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ rpi_backlight: rpi_backlight { -+ compatible = "raspberrypi,rpi-backlight"; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..a442c8f0ec01b7503f32e070683a984e895f5668 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts -@@ -0,0 +1,34 @@ -+// Definitions for RPi DAC -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ pcm1794a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm1794a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rpi,rpi-dac"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d7e72eef594e08b309ffbaa04f43c68909c08f36 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts -@@ -0,0 +1,89 @@ -+/* -+ * Device Tree overlay for rpi-display by Watterott -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ rpi_display_pins: rpi_display_pins { -+ brcm,pins = <18 23 24 25>; -+ brcm,function = <1 1 1 0>; /* out out out in */ -+ brcm,pull = <0 0 0 2>; /* - - - up */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ rpidisplay: rpi-display@0{ -+ compatible = "ilitek,ili9341"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rpi_display_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 23 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ rpidisplay_ts: rpi-display-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <25 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 25 0>; -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&rpidisplay>,"spi-max-frequency:0"; -+ rotate = <&rpidisplay>,"rotate:0"; -+ fps = <&rpidisplay>,"fps:0"; -+ debug = <&rpidisplay>,"debug:0"; -+ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; -+ swapxy = <&rpidisplay_ts>,"ti,swap-xy?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2e53a17491706bdb6245426b548a54960a40966f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts -@@ -0,0 +1,17 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ rpi_ft5406: rpi_ft5406 { -+ compatible = "rpi,rpi-ft5406"; -+ firmware = <&firmware>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8332d0159a45b29952d0ad1a8fda339d4fdbee3e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for Rpi-Proto -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8731@1a { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8731"; -+ reg = <0x1a>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rpi,rpi-proto"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..27153240e1be595ae07c7ec74db1615532904140 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts -@@ -0,0 +1,47 @@ -+// rpi-sense HAT -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ rpi-sense@46 { -+ compatible = "rpi,rpi-sense"; -+ reg = <0x46>; -+ keys-int-gpios = <&gpio 23 1>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-magn@1c { -+ compatible = "st,lsm9ds1-magn"; -+ reg = <0x1c>; -+ status = "okay"; -+ }; -+ -+ lsm9ds1-accel6a { -+ compatible = "st,lsm9ds1-accel"; -+ reg = <0x6a>; -+ status = "okay"; -+ }; -+ -+ lps25h-press@5c { -+ compatible = "st,lps25h-press"; -+ reg = <0x5c>; -+ status = "okay"; -+ }; -+ -+ hts221-humid@5f { -+ compatible = "st,hts221-humid"; -+ reg = <0x5f>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..16b1247bfa618ff85936ddf78c3aea58075eaa67 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts -@@ -0,0 +1,81 @@ -+// Definitions for RRA DigiDAC1 Audio card -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ aliases { -+ ldo0 = &ldo0; -+ ldo1 = &ldo1; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/soc"; -+ __overlay__ { -+ -+ ldo1: ldo1 { -+ compatible = "regulator-fixed"; -+ regulator-name = "DC_5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-always-on; -+ }; -+ -+ ldo0: ldo0 { -+ compatible = "regulator-fixed"; -+ regulator-name = "DC_3V3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ status = "okay"; -+ PVDD-supply = <&ldo0>; -+ DVDD-supply = <&ldo0>; -+ }; -+ -+ wm8742: wm8741@1a { -+ compatible = "wlf,wm8741"; -+ reg = <0x1a>; -+ status = "okay"; -+ AVDD-supply = <&ldo1>; -+ DVDD-supply = <&ldo0>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "rra,digidac1-soundcard"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..339d0d17c01ff182edd0871de9dc4ea744917ad4 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sc16is750-i2c-overlay.dts -@@ -0,0 +1,37 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ sc16is750: sc16is750@48 { -+ compatible = "nxp,sc16is750"; -+ reg = <0x48>; /* address */ -+ clocks = <&sc16is750_clk>; -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; /* IRQ_TYPE_EDGE_FALLING */ -+ #gpio-cells = <2>; -+ -+ sc16is750_clk: sc16is750_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <14745600>; -+ }; -+ }; -+ }; -+ }; -+ -+ -+ __overrides__ { -+ int_pin = <&sc16is750>,"interrupts:0"; -+ addr = <&sc16is750>,"reg:0"; -+ }; -+ -+}; -diff --git a/arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts b/arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d0a9e82dbea143e80249064873d8b9f0b56b2eaa ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sc16is752-spi1-overlay.dts -@@ -0,0 +1,61 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>; -+ status = "okay"; -+ -+ sc16is752: sc16is752@0 { -+ compatible = "nxp,sc16is752"; -+ reg = <0>; /* CE0 */ -+ clocks = <&sc16is752_clk>; -+ interrupt-parent = <&gpio>; -+ interrupts = <24 2>; /* IRQ_TYPE_EDGE_FALLING */ -+ #gpio-controller; -+ #gpio-cells = <2>; -+ spi-max-frequency = <4000000>; -+ -+ sc16is752_clk: sc16is752_clk { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <14745600>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ int_pin = <&sc16is752>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..a431177a1c9d320d5432ea448ad4d0f696c34525 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts -@@ -0,0 +1,32 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&sdhost>; -+ frag0: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ brcm,debug-flags = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&mmc>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..46d453859b31f5c700a8a2e39a2c209330bc108f ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdio-1bit-overlay.dts -@@ -0,0 +1,36 @@ -+/* Enable 1-bit SDIO from MMC interface via GPIOs 22-25. Includes sdhost overlay. */ -+ -+/include/ "sdhost-overlay.dts" -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@3 { -+ target = <&mmc>; -+ sdio_mmc: __overlay__ { -+ compatible = "brcm,bcm2835-mmc"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <1>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&gpio>; -+ __overlay__ { -+ sdio_pins: sdio_pins { -+ brcm,pins = <22 23 24 25>; -+ brcm,function = <7 7 7 7>; /* ALT3 = SD1 */ -+ brcm,pull = <0 2 2 2>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ poll_once = <&sdio_mmc>,"non-removable?"; -+ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..398bd812c716c9e472fbac5aba4fe882114c65d1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts -@@ -0,0 +1,36 @@ -+/* Enable SDIO from MMC interface via GPIOs 22-27. Includes sdhost overlay. */ -+ -+/include/ "sdhost-overlay.dts" -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@3 { -+ target = <&mmc>; -+ sdio_mmc: __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio_pins>; -+ non-removable; -+ bus-width = <4>; -+ brcm,overclock-50 = <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&gpio>; -+ __overlay__ { -+ sdio_pins: sdio_pins { -+ brcm,pins = <22 23 24 25 26 27>; -+ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */ -+ brcm,pull = <0 2 2 2 2 2>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ poll_once = <&sdio_mmc>,"non-removable?"; -+ bus_width = <&sdio_mmc>,"bus-width:0"; -+ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e4a4677f6b20da6b51751e9675c1c276ca4d2051 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts -@@ -0,0 +1,23 @@ -+/dts-v1/; -+/plugin/; -+ -+/* Provide backwards compatible aliases for the old sdhost dtparams. */ -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&sdhost>; -+ frag0: __overlay__ { -+ brcm,overclock-50 = <0>; -+ brcm,pio-limit = <1>; -+ }; -+ }; -+ -+ __overrides__ { -+ overclock_50 = <&frag0>,"brcm,overclock-50:0"; -+ force_pio = <&frag0>,"brcm,force-pio?"; -+ pio_limit = <&frag0>,"brcm,pio-limit:0"; -+ debug = <&frag0>,"brcm,debug?"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-dev-overlay.dts b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..b610d828360810e80133850adf7b459c66b3ed5d ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-dev-overlay.dts -@@ -0,0 +1,18 @@ -+// Description: Overlay to enable character device interface for SMI. -+// Author: Luke Wren -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ fragment@0 { -+ target = <&soc>; -+ __overlay__ { -+ smi_dev { -+ compatible = "brcm,bcm2835-smi-dev"; -+ smi_handle = <&smi>; -+ status = "okay"; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-nand-overlay.dts b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..13ce0b7cfb242df1019f91ed2fc03f514927c3e7 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-nand-overlay.dts -@@ -0,0 +1,69 @@ -+// Description: Overlay to enable NAND flash through -+// the secondary memory interface -+// Author: Luke Wren -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&smi>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&soc>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ -+ nand: flash@0 { -+ compatible = "brcm,bcm2835-smi-nand"; -+ smi_handle = <&smi>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ status = "okay"; -+ -+ partition@0 { -+ label = "stage2"; -+ // 128k -+ reg = <0 0x20000>; -+ read-only; -+ }; -+ partition@1 { -+ label = "firmware"; -+ // 16M -+ reg = <0x20000 0x1000000>; -+ read-only; -+ }; -+ partition@2 { -+ label = "root"; -+ // 2G (will need to use 64 bit for >=4G) -+ reg = <0x1020000 0x80000000>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&gpio>; -+ __overlay__ { -+ smi_pins: smi_pins { -+ brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 -+ 12 13 14 15>; -+ /* Alt 1: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0>; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/smi-overlay.dts b/arch/arm/boot/dts/overlays/smi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..095f52c355fd6382233d8a471c3590a4275d6c75 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/smi-overlay.dts -@@ -0,0 +1,37 @@ -+// Description: Overlay to enable the secondary memory interface peripheral -+// Author: Luke Wren -+ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&smi>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&smi_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ smi_pins: smi_pins { -+ /* Don't configure the top two address bits, as -+ these are already used as ID_SD and ID_SC */ -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 13 14 15 -+ 16 17 18 19 20 21 22 23 24 25>; -+ /* Alt 0: SMI */ -+ brcm,function = <5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 -+ 5 5 5 5 5 5 5 5 5>; -+ /* /CS, /WE and /OE are pulled high, as they are -+ generally active low signals */ -+ brcm,pull = <2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 -+ 0 0 0 0 0 0 0>; -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..49803b309f8643385a3c97f6cdd2015f863d2d34 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi-gpio35-39-overlay.dts -@@ -0,0 +1,31 @@ -+/* -+ * Device tree overlay to move spi0 to gpio 35 to 39 on CM -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ cs-gpios = <&gpio 36 1>, <&gpio 35 1>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi0_cs_pins>; -+ __overlay__ { -+ brcm,pins = <36 35>; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0_pins>; -+ __overlay__ { -+ brcm,pins = <37 38 39>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi-rtc-overlay.dts b/arch/arm/boot/dts/overlays/spi-rtc-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..88d1800d63c9f6727b46d4e590c8e96c671c3755 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi-rtc-overlay.dts -@@ -0,0 +1,33 @@ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&spidev0>; -+ __dormant__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi0>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ rtc-pcf2123@0 { -+ compatible = "nxp,rtc-pcf2123"; -+ spi-max-frequency = <5000000>; -+ spi-cs-high = <1>; -+ reg = <0>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ pcf2123 = <0>, "=0=1"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts b/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ef9845f7184ee1ea90e8bdc23493b1cbbdc21896 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts -@@ -0,0 +1,26 @@ -+/* -+ * Device tree overlay to re-enable hardware CS for SPI0 -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ cs-gpios = <0>, <0>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi0_cs_pins>; -+ __overlay__ { -+ brcm,pins = <8 7>; -+ brcm,function = <4>; /* alt0 */ -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..71c243947004fa887998065df9c259b50edfa428 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..2ae0885cf1e7fb7420f65e538310ab1addafbece ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8f79044cd8f47ea055394822cc380497c985c7e5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi1_pins: spi1_pins { -+ brcm,pins = <19 20 21>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi1_cs_pins: spi1_cs_pins { -+ brcm,pins = <18 17 16>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi1>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; -+ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; -+ status = "okay"; -+ -+ spidev1_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev1_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev1_0>,"status"; -+ cs1_spidev = <&spidev1_1>,"status"; -+ cs2_spidev = <&spidev1_2>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..6f57bc710fe123028a5a216063733f0cea9bbd54 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts -@@ -0,0 +1,57 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..d090631d36821b0c89833b9f217216f0b134a8f3 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts -@@ -0,0 +1,69 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e2586728c311829462f6a4b3b348e35603f033ce ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts -@@ -0,0 +1,81 @@ -+/dts-v1/; -+/plugin/; -+ -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ spi2_pins: spi2_pins { -+ brcm,pins = <40 41 42>; -+ brcm,function = <3>; /* alt4 */ -+ }; -+ -+ spi2_cs_pins: spi2_cs_pins { -+ brcm,pins = <43 44 45>; -+ brcm,function = <1>; /* output */ -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spi2>; -+ frag1: __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; -+ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; -+ status = "okay"; -+ -+ spidev2_0: spidev@0 { -+ compatible = "spidev"; -+ reg = <0>; /* CE0 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_1: spidev@1 { -+ compatible = "spidev"; -+ reg = <1>; /* CE1 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ -+ spidev2_2: spidev@2 { -+ compatible = "spidev"; -+ reg = <2>; /* CE2 */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ spi-max-frequency = <500000>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ __overrides__ { -+ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", -+ <&frag1>,"cs-gpios:4"; -+ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", -+ <&frag1>,"cs-gpios:16"; -+ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", -+ <&frag1>,"cs-gpios:28"; -+ cs0_spidev = <&spidev2_0>,"status"; -+ cs1_spidev = <&spidev2_1>,"status"; -+ cs2_spidev = <&spidev2_2>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..ed2b053aef23e0b1b34d8d3cb888b2b196758f59 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts -@@ -0,0 +1,224 @@ -+/* -+ * tinylcd35-overlay.dts -+ * -+ * ------------------------------------------------- -+ * www.tinlylcd.com -+ * ------------------------------------------------- -+ * Device---Driver-----BUS GPIO's -+ * display tinylcd35 spi0.0 25 24 18 -+ * touch ads7846 spi0.1 5 -+ * rtc ds1307 i2c1-0068 -+ * rtc pcf8563 i2c1-0051 -+ * keypad gpio-keys --------- 17 22 27 23 28 -+ * -+ * -+ * TinyLCD.com 3.5 inch TFT -+ * -+ * Version 001 -+ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework -+ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&gpio>; -+ __overlay__ { -+ tinylcd35_pins: tinylcd35_pins { -+ brcm,pins = <25 24 18>; -+ brcm,function = <1>; /* out */ -+ }; -+ tinylcd35_ts_pins: tinylcd35_ts_pins { -+ brcm,pins = <5>; -+ brcm,function = <0>; /* in */ -+ }; -+ keypad_pins: keypad_pins { -+ brcm,pins = <4 17 22 23 27>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <1>; /* down */ -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ tinylcd35: tinylcd35@0{ -+ compatible = "neosec,tinylcd"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&tinylcd35_pins>, -+ <&tinylcd35_ts_pins>; -+ -+ spi-max-frequency = <48000000>; -+ rotate = <270>; -+ fps = <20>; -+ bgr; -+ buswidth = <8>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ -+ init = <0x10000B0 0x80 -+ 0x10000C0 0x0A 0x0A -+ 0x10000C1 0x01 0x01 -+ 0x10000C2 0x33 -+ 0x10000C5 0x00 0x42 0x80 -+ 0x10000B1 0xD0 0x11 -+ 0x10000B4 0x02 -+ 0x10000B6 0x00 0x22 0x3B -+ 0x10000B7 0x07 -+ 0x1000036 0x58 -+ 0x10000F0 0x36 0xA5 0xD3 -+ 0x10000E5 0x80 -+ 0x10000E5 0x01 -+ 0x10000B3 0x00 -+ 0x10000E5 0x00 -+ 0x10000F0 0x36 0xA5 0x53 -+ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 -+ 0x100003A 0x55 -+ 0x1000011 -+ 0x2000001 -+ 0x1000029>; -+ }; -+ -+ tinylcd35_ts: tinylcd35_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <5 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 5 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ -+ /* RTC */ -+ -+ fragment@5 { -+ target = <&i2c1>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&i2c1>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ status = "okay"; -+ -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ /* -+ * Values for input event code is found under the -+ * 'Keys and buttons' heading in include/uapi/linux/input.h -+ */ -+ fragment@7 { -+ target-path = "/soc"; -+ __overlay__ { -+ keypad: keypad { -+ compatible = "gpio-keys"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&keypad_pins>; -+ status = "disabled"; -+ autorepeat; -+ -+ button@17 { -+ label = "GPIO KEY_UP"; -+ linux,code = <103>; -+ gpios = <&gpio 17 0>; -+ }; -+ button@22 { -+ label = "GPIO KEY_DOWN"; -+ linux,code = <108>; -+ gpios = <&gpio 22 0>; -+ }; -+ button@27 { -+ label = "GPIO KEY_LEFT"; -+ linux,code = <105>; -+ gpios = <&gpio 27 0>; -+ }; -+ button@23 { -+ label = "GPIO KEY_RIGHT"; -+ linux,code = <106>; -+ gpios = <&gpio 23 0>; -+ }; -+ button@4 { -+ label = "GPIO KEY_ENTER"; -+ linux,code = <28>; -+ gpios = <&gpio 4 0>; -+ }; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&tinylcd35>,"spi-max-frequency:0"; -+ rotate = <&tinylcd35>,"rotate:0"; -+ fps = <&tinylcd35>,"fps:0"; -+ debug = <&tinylcd35>,"debug:0"; -+ touch = <&tinylcd35_ts>,"status"; -+ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", -+ <&tinylcd35_ts>,"interrupts:0", -+ <&tinylcd35_ts>,"pendown-gpio:4"; -+ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; -+ rtc-pcf = <0>,"=5"; -+ rtc-ds = <0>,"=6"; -+ keypad = <&keypad>,"status"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/uart1-overlay.dts b/arch/arm/boot/dts/overlays/uart1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..fa73e1feaeb1bf53a6755e81a998e71cd8c7eda9 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/uart1-overlay.dts -@@ -0,0 +1,38 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&uart1>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1_pins>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ uart1_pins: uart1_pins { -+ brcm,pins = <14 15>; -+ brcm,function = <2>; /* alt5 */ -+ brcm,pull = <0 2>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "8250.nr_uarts=1"; -+ }; -+ }; -+ -+ __overrides__ { -+ txd1_pin = <&uart1_pins>,"brcm,pins:0"; -+ rxd1_pin = <&uart1_pins>,"brcm,pins:4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..95a595a35cb4fbb707bf4b18161f6a46860aa4ae ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -@@ -0,0 +1,89 @@ -+/* -+ * vc4-fkms-v3d-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "cma=256M@256M"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=192M@256M"; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=128M@128M"; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=96M@128M"; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=64M@64M"; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&fb>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&firmwarekms>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@7 { -+ target = <&v3d>; -+ __overlay__ { -+ interrupts = <1 10>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@8 { -+ target = <&gpu>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@9 { -+ target-path = "/soc/dma"; -+ __overlay__ { -+ brcm,dma-channel-mask = <0x7f35>; -+ }; -+ }; -+ -+ __overrides__ { -+ cma-256 = <0>,"+0-1-2-3-4"; -+ cma-192 = <0>,"-0+1-2-3-4"; -+ cma-128 = <0>,"-0-1+2-3-4"; -+ cma-96 = <0>,"-0-1-2+3-4"; -+ cma-64 = <0>,"-0-1-2-3+4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..4f1cc20f90dc6780f74e08ebee00e5a1a6062c85 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts -@@ -0,0 +1,136 @@ -+/* -+ * vc4-kms-v3d-overlay.dts -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target-path = "/chosen"; -+ __overlay__ { -+ bootargs = "cma=256M@256M"; -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=192M@256M"; -+ }; -+ }; -+ -+ fragment@2 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=128M@128M"; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=96M@128M"; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/chosen"; -+ __dormant__ { -+ bootargs = "cma=64M@64M"; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&i2c2>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&cprman>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@7 { -+ target = <&fb>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@8 { -+ target = <&pixelvalve0>; -+ __overlay__ { -+ interrupts = <2 13>; /* pwa0 */ -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@9 { -+ target = <&pixelvalve1>; -+ __overlay__ { -+ interrupts = <2 14>; /* pwa1 */ -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@10 { -+ target = <&pixelvalve2>; -+ __overlay__ { -+ interrupts = <2 10>; /* pixelvalve */ -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@11 { -+ target = <&hvs>; -+ __overlay__ { -+ interrupts = <2 1>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@12 { -+ target = <&hdmi>; -+ __overlay__ { -+ interrupts = <2 8>, <2 9>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@13 { -+ target = <&v3d>; -+ __overlay__ { -+ interrupts = <1 10>; -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@14 { -+ target = <&gpu>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@15 { -+ target-path = "/soc/dma"; -+ __overlay__ { -+ brcm,dma-channel-mask = <0x7f35>; -+ }; -+ }; -+ -+ __overrides__ { -+ cma-256 = <0>,"+0-1-2-3-4"; -+ cma-192 = <0>,"-0+1-2-3-4"; -+ cma-128 = <0>,"-0-1+2-3-4"; -+ cma-96 = <0>,"-0-1-2+3-4"; -+ cma-64 = <0>,"-0-1-2-3+4"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..7fcab963eb4aed4b9edea94c9e60deb7650e0eb5 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts -@@ -0,0 +1,30 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ // There is no VGA driver module, but we need a platform device -+ // node (that doesn't already use pinctrl) to hang the pinctrl -+ // reference on - leds will do -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vga666_pins>; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ vga666_pins: vga666_pins { -+ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 -+ 13 14 15 16 17 18 19 20 21>; -+ brcm,function = <6>; /* alt2 */ -+ brcm,pull = <0>; /* no pull */ -+ }; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..29a3b48d19ab36b814c09e4cc4eef6d9e2022da1 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts -@@ -0,0 +1,39 @@ -+// Definitions for w1-gpio module (without external pullup) -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ -+ w1: onewire@0 { -+ compatible = "w1-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>; -+ rpi,parasitic-power = <0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4>; -+ brcm,function = <0>; // in (initially) -+ brcm,pull = <0>; // off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..66a98f6c9601f51483f27803995bec772bb3350e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts -@@ -0,0 +1,41 @@ -+// Definitions for w1-gpio module (with external pullup) -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ -+ w1: onewire@0 { -+ compatible = "w1-gpio"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&w1_pins>; -+ gpios = <&gpio 4 0>, <&gpio 5 1>; -+ rpi,parasitic-power = <0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ w1_pins: w1_pins { -+ brcm,pins = <4 5>; -+ brcm,function = <0 1>; // in out -+ brcm,pull = <0 0>; // off off -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ gpiopin = <&w1>,"gpios:4", -+ <&w1_pins>,"brcm,pins:0"; -+ extpullup = <&w1>,"gpios:16", -+ <&w1_pins>,"brcm,pins:4"; -+ pullup = <&w1>,"rpi,parasitic-power:0"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8498134fdbb3912e9ce18282b53084d871a82370 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts -@@ -0,0 +1,44 @@ -+/* -+ * Device Tree overlay for Witty Pi extension board by UUGear -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&leds>; -+ __overlay__ { -+ compatible = "gpio-leds"; -+ wittypi_led: wittypi_led { -+ label = "wittypi_led"; -+ linux,default-trigger = "default-on"; -+ gpios = <&gpio 17 0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ rtc: ds1337@68 { -+ compatible = "dallas,ds1337"; -+ reg = <0x68>; -+ wakeup-source; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ led_gpio = <&wittypi_led>,"gpios:4"; -+ led_trigger = <&wittypi_led>,"linux,default-trigger"; -+ }; -+ -+}; -diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst -index a1be75d0a5fd3fbf4742e555046896ea6fa6fe65..ad8dc1c93d04bc929b551c5a47f67d244116c7e7 100644 ---- a/scripts/Makefile.dtbinst -+++ b/scripts/Makefile.dtbinst -@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") - endif - - dtbinst-files := $(dtb-y) -+dtboinst-files := $(dtbo-y) - dtbinst-dirs := $(dts-dirs) - - # Helper targets for Installing DTBs into the boot directory -@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< - - install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) - --$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep -+$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep - - $(dtbinst-files): %.dtb: $(obj)/%.dtb - $(call cmd,dtb_install,$(install-dir)) - -+$(dtboinst-files): %.dtbo: $(obj)/%.dtbo -+ $(call cmd,dtb_install,$(install-dir)) -+ - $(dtbinst-dirs): - $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ - --PHONY += $(dtbinst-files) $(dtbinst-dirs) --__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) -+PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) -+__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) - - .PHONY: $(PHONY) -diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib -index 0a07f9014944ed92a8e2e42983ae43be60b3e471..1967878a843461c3ff1f473b9a030eb01b7c726e 100644 ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -312,6 +312,17 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ - $(obj)/%.dtb: $(src)/%.dts FORCE - $(call if_changed_dep,dtc) - -+quiet_cmd_dtco = DTCO $@ -+cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ -+ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ -+ $(DTC) -@ -H epapr -O dtb -o $@ -b 0 \ -+ -i $(dir $<) $(DTC_FLAGS) \ -+ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ -+ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) -+ -+$(obj)/%.dtbo: $(src)/%-overlay.dts FORCE -+ $(call if_changed_dep,dtco) -+ - dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) - - # Bzip2 - -From 52e8a3802aa8428a69561607209bfe9b98cabde6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 055/122] BCM270x_DT: Add pwr_led, and the required "input" - trigger - -The "input" trigger makes the associated GPIO an input. This is to support -the Raspberry Pi PWR LED, which is driven by external hardware in normal use. - -N.B. pwr_led is not available on Model A or B boards. - -leds-gpio: Implement the brightness_get method - -The power LED uses some clever logic that means it is driven -by a voltage measuring circuit when configured as input, otherwise -it is driven by the GPIO output value. This patch wires up the -brightness_get method for leds-gpio so that user-space can monitor -the LED value via /sys/class/gpio/led1/brightness. Using the input -trigger this returns an indication of the system power health, -otherwise it is just whatever value the trigger has written most -recently. - -See: https://github.com/raspberrypi/linux/issues/1064 ---- - drivers/leds/leds-gpio.c | 18 +++++++++++- - drivers/leds/trigger/Kconfig | 7 +++++ - drivers/leds/trigger/Makefile | 1 + - drivers/leds/trigger/ledtrig-input.c | 54 ++++++++++++++++++++++++++++++++++++ - include/linux/leds.h | 3 ++ - 5 files changed, 82 insertions(+), 1 deletion(-) - create mode 100644 drivers/leds/trigger/ledtrig-input.c - -diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c -index d400dcaf4d296444967065e98812c210c48a192d..6a27a693034825de2897bb7b338b60cc10c9e59f 100644 ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -50,8 +50,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, - led_dat->platform_gpio_blink_set(led_dat->gpiod, level, - NULL, NULL); - led_dat->blinking = 0; -+ } else if (led_dat->cdev.flags & SET_GPIO_INPUT) { -+ gpiod_direction_input(led_dat->gpiod); -+ led_dat->cdev.flags &= ~SET_GPIO_INPUT; -+ } else if (led_dat->cdev.flags & SET_GPIO_OUTPUT) { -+ gpiod_direction_output(led_dat->gpiod, level); -+ led_dat->cdev.flags &= ~SET_GPIO_OUTPUT; - } else { -- if (led_dat->can_sleep) -+ if (led_dat->can_sleep || -+ (led_dat->cdev.flags & (SET_GPIO_INPUT | SET_GPIO_OUTPUT) )) - gpiod_set_value_cansleep(led_dat->gpiod, level); - else - gpiod_set_value(led_dat->gpiod, level); -@@ -65,6 +72,13 @@ static int gpio_led_set_blocking(struct led_classdev *led_cdev, - return 0; - } - -+static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) -+{ -+ struct gpio_led_data *led_dat = -+ container_of(led_cdev, struct gpio_led_data, cdev); -+ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; -+} -+ - static int gpio_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, unsigned long *delay_off) - { -@@ -122,6 +136,8 @@ static int create_gpio_led(const struct gpio_led *template, - led_dat->platform_gpio_blink_set = blink_set; - led_dat->cdev.blink_set = gpio_blink_set; - } -+ led_dat->cdev.brightness_set = gpio_led_set; -+ led_dat->cdev.brightness_get = gpio_led_get; - if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) { - state = gpiod_get_value_cansleep(led_dat->gpiod); - if (state < 0) -diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig -index 3f9ddb9fafa77f1f1fe5535c5e947838761e4f35..c1b6c83f3b63f993452893f136c5da54d0ada8e7 100644 ---- a/drivers/leds/trigger/Kconfig -+++ b/drivers/leds/trigger/Kconfig -@@ -116,6 +116,13 @@ config LEDS_TRIGGER_CAMERA - This enables direct flash/torch on/off by the driver, kernel space. - If unsure, say Y. - -+config LEDS_TRIGGER_INPUT -+ tristate "LED Input Trigger" -+ depends on LEDS_TRIGGERS -+ help -+ This allows the GPIOs assigned to be LEDs to be initialised to inputs. -+ If unsure, say Y. -+ - config LEDS_TRIGGER_PANIC - bool "LED Panic Trigger" - depends on LEDS_TRIGGERS -diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile -index a72c43cffebf43bc7ebfd1eb1103b9ccff73d075..51b90c46890872fd1b148ec748edce0e0ce8fee1 100644 ---- a/drivers/leds/trigger/Makefile -+++ b/drivers/leds/trigger/Makefile -@@ -9,4 +9,5 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o - obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o - obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o - obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o -+obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o - obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o -diff --git a/drivers/leds/trigger/ledtrig-input.c b/drivers/leds/trigger/ledtrig-input.c -new file mode 100644 -index 0000000000000000000000000000000000000000..27f8ebea43d86fc51c98db5c953da05bae063e3b ---- /dev/null -+++ b/drivers/leds/trigger/ledtrig-input.c -@@ -0,0 +1,54 @@ -+/* -+ * Set LED GPIO to Input "Trigger" -+ * -+ * Copyright 2015 Phil Elwell -+ * -+ * Based on Nick Forbes's ledtrig-default-on.c. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include "../leds.h" -+ -+static void input_trig_activate(struct led_classdev *led_cdev) -+{ -+ led_cdev->flags |= SET_GPIO_INPUT; -+ led_set_brightness(led_cdev, 0); -+} -+ -+static void input_trig_deactivate(struct led_classdev *led_cdev) -+{ -+ led_cdev->flags |= SET_GPIO_OUTPUT; -+ led_set_brightness(led_cdev, 0); -+} -+ -+static struct led_trigger input_led_trigger = { -+ .name = "input", -+ .activate = input_trig_activate, -+ .deactivate = input_trig_deactivate, -+}; -+ -+static int __init input_trig_init(void) -+{ -+ return led_trigger_register(&input_led_trigger); -+} -+ -+static void __exit input_trig_exit(void) -+{ -+ led_trigger_unregister(&input_led_trigger); -+} -+ -+module_init(input_trig_init); -+module_exit(input_trig_exit); -+ -+MODULE_AUTHOR("Phil Elwell "); -+MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); -+MODULE_LICENSE("GPL"); -diff --git a/include/linux/leds.h b/include/linux/leds.h -index ddfcb2df3656cf0ab6aebd1fa3d624a6ec2e94e9..271563eb835f9018712e2076a88f341d2d6db7db 100644 ---- a/include/linux/leds.h -+++ b/include/linux/leds.h -@@ -52,6 +52,9 @@ struct led_classdev { - #define LED_DEV_CAP_FLASH (1 << 24) - #define LED_HW_PLUGGABLE (1 << 25) - #define LED_PANIC_INDICATOR (1 << 26) -+ /* Additions for Raspberry Pi PWR LED */ -+#define SET_GPIO_INPUT (1 << 30) -+#define SET_GPIO_OUTPUT (1 << 31) - - /* Set LED brightness level - * Must not sleep. Use brightness_set_blocking for drivers - -From e958cbc43c1add6076ea3ed0aa17365335774024 Mon Sep 17 00:00:00 2001 -From: Siarhei Siamashka -Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 056/122] fbdev: add FBIOCOPYAREA ioctl - -Based on the patch authored by Ali Gholami Rudi at - https://lkml.org/lkml/2009/7/13/153 - -Provide an ioctl for userspace applications, but only if this operation -is hardware accelerated (otherwide it does not make any sense). - -Signed-off-by: Siarhei Siamashka - -bcm2708_fb: Add ioctl for reading gpu memory through dma ---- - drivers/video/fbdev/bcm2708_fb.c | 109 +++++++++++++++++++++++++++++++++++++++ - drivers/video/fbdev/core/fbmem.c | 36 +++++++++++++ - include/uapi/linux/fb.h | 12 +++++ - 3 files changed, 157 insertions(+) - -diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c -index 37f60813fe1dd95d9f5f725c07ec2e75c09857bf..53c5a0bdadb4be9251affdabed66305842a08e72 100644 ---- a/drivers/video/fbdev/bcm2708_fb.c -+++ b/drivers/video/fbdev/bcm2708_fb.c -@@ -31,8 +31,10 @@ - #include - #include - #include -+#include - #include - #include -+#include - #include - - //#define BCM2708_FB_DEBUG -@@ -426,6 +428,110 @@ static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info - return result; - } - -+static void dma_memcpy(struct bcm2708_fb *fb, dma_addr_t dst, dma_addr_t src, int size) -+{ -+ int burst_size = (fb->dma_chan == 0) ? 8 : 2; -+ struct bcm2708_dma_cb *cb = fb->cb_base; -+ -+ cb->info = BCM2708_DMA_BURST(burst_size) | BCM2708_DMA_S_WIDTH | -+ BCM2708_DMA_S_INC | BCM2708_DMA_D_WIDTH | -+ BCM2708_DMA_D_INC; -+ cb->dst = dst; -+ cb->src = src; -+ cb->length = size; -+ cb->stride = 0; -+ cb->pad[0] = 0; -+ cb->pad[1] = 0; -+ cb->next = 0; -+ -+ if (size < dma_busy_wait_threshold) { -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ bcm_dma_wait_idle(fb->dma_chan_base); -+ } else { -+ void __iomem *dma_chan = fb->dma_chan_base; -+ cb->info |= BCM2708_DMA_INT_EN; -+ bcm_dma_start(fb->dma_chan_base, fb->cb_handle); -+ while (bcm_dma_is_busy(dma_chan)) { -+ wait_event_interruptible( -+ fb->dma_waitq, -+ !bcm_dma_is_busy(dma_chan)); -+ } -+ fb->stats.dma_irqs++; -+ } -+ fb->stats.dma_copies++; -+} -+ -+#define INTALIAS_NORMAL(x) ((x)&~0xc0000000) // address with no aliases -+#define INTALIAS_L1L2_NONALLOCATING(x) (((x)&~0xc0000000)|0x80000000) // cache coherent but non-allocating in L1 and L2 -+ -+static long vc_mem_copy(struct bcm2708_fb *fb, unsigned long arg) -+{ -+ struct fb_dmacopy ioparam; -+ size_t size = PAGE_SIZE; -+ u32 *buf = NULL; -+ dma_addr_t bus_addr; -+ long rc = 0; -+ size_t offset; -+ struct { u32 base, length; } gpu = {}; -+ -+ /* restrict this to root user */ -+ if (!uid_eq(current_euid(), GLOBAL_ROOT_UID)) -+ { -+ rc = -EFAULT; -+ goto out; -+ } -+ -+ /* Get the parameter data. -+ */ -+ if (copy_from_user -+ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { -+ pr_err("[%s]: failed to copy-from-user\n", -+ __func__); -+ rc = -EFAULT; -+ goto out; -+ } -+ -+ rc = rpi_firmware_property(fb->fw, -+ RPI_FIRMWARE_GET_VC_MEMORY, -+ &gpu, sizeof(gpu)); -+ if (rc != 0 || gpu.base == 0 || gpu.length == 0) { -+ pr_err("[%s]: Unable to determine gpu memory %ld,%x,%x)\n", __func__, rc, gpu.base, gpu.length); -+ return -EFAULT; -+ } -+ -+ if (INTALIAS_NORMAL(ioparam.src) < gpu.base || INTALIAS_NORMAL(ioparam.src) >= gpu.base + gpu.length) { -+ pr_err("[%s]: Invalid memory access %x (%x-%x)", __func__, INTALIAS_NORMAL(ioparam.src), gpu.base, gpu.base + gpu.length); -+ return -EFAULT; -+ } -+ -+ buf = dma_alloc_coherent(fb->fb.device, PAGE_ALIGN(size), &bus_addr, -+ GFP_ATOMIC); -+ if (!buf) { -+ pr_err("[%s]: failed to dma_alloc_coherent(%d)\n", -+ __func__, size); -+ rc = -ENOMEM; -+ goto out; -+ } -+ -+ for (offset = 0; offset < ioparam.length; offset += size) { -+ size_t remaining = ioparam.length - offset; -+ size_t s = min(size, remaining); -+ unsigned char *p = (unsigned char *)ioparam.src + offset; -+ unsigned char *q = (unsigned char *)ioparam.dst + offset; -+ dma_memcpy(fb, bus_addr, INTALIAS_L1L2_NONALLOCATING((dma_addr_t)p), size); -+ if (copy_to_user(q, buf, s) != 0) { -+ pr_err("[%s]: failed to copy-to-user\n", -+ __func__); -+ rc = -EFAULT; -+ goto out; -+ } -+ } -+out: -+ if (buf) -+ dma_free_coherent(fb->fb.device, PAGE_ALIGN(size), buf, bus_addr); -+ return rc; -+} -+ - static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) - { - struct bcm2708_fb *fb = to_bcm2708(info); -@@ -438,6 +544,9 @@ static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long a - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, - &dummy, sizeof(dummy)); - break; -+ case FBIODMACOPY: -+ ret = vc_mem_copy(fb, arg); -+ break; - default: - dev_dbg(info->device, "Unknown ioctl 0x%x\n", cmd); - return -ENOTTY; -diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c -index 76c1ad96fb37d4f07bbde6462f54825f566acbac..7bf48e478c056fcd745026902961506d5826615d 100644 ---- a/drivers/video/fbdev/core/fbmem.c -+++ b/drivers/video/fbdev/core/fbmem.c -@@ -1084,6 +1084,31 @@ fb_blank(struct fb_info *info, int blank) - } - EXPORT_SYMBOL(fb_blank); - -+static int fb_copyarea_user(struct fb_info *info, -+ struct fb_copyarea *copy) -+{ -+ int ret = 0; -+ if (!lock_fb_info(info)) -+ return -ENODEV; -+ if (copy->dx >= info->var.xres || -+ copy->sx >= info->var.xres || -+ copy->width > info->var.xres || -+ copy->dy >= info->var.yres || -+ copy->sy >= info->var.yres || -+ copy->height > info->var.yres || -+ copy->dx + copy->width > info->var.xres || -+ copy->sx + copy->width > info->var.xres || -+ copy->dy + copy->height > info->var.yres || -+ copy->sy + copy->height > info->var.yres) { -+ ret = -EINVAL; -+ goto out; -+ } -+ info->fbops->fb_copyarea(info, copy); -+out: -+ unlock_fb_info(info); -+ return ret; -+} -+ - static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unsigned long arg) - { -@@ -1094,6 +1119,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - struct fb_cmap cmap_from; - struct fb_cmap_user cmap; - struct fb_event event; -+ struct fb_copyarea copy; - void __user *argp = (void __user *)arg; - long ret = 0; - -@@ -1211,6 +1237,15 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, - unlock_fb_info(info); - console_unlock(); - break; -+ case FBIOCOPYAREA: -+ if (info->flags & FBINFO_HWACCEL_COPYAREA) { -+ /* only provide this ioctl if it is accelerated */ -+ if (copy_from_user(©, argp, sizeof(copy))) -+ return -EFAULT; -+ ret = fb_copyarea_user(info, ©); -+ break; -+ } -+ /* fall through */ - default: - if (!lock_fb_info(info)) - return -ENODEV; -@@ -1365,6 +1400,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, - case FBIOPAN_DISPLAY: - case FBIOGET_CON2FBMAP: - case FBIOPUT_CON2FBMAP: -+ case FBIOCOPYAREA: - arg = (unsigned long) compat_ptr(arg); - case FBIOBLANK: - ret = do_fb_ioctl(info, cmd, arg); -diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h -index fb795c3b3c178ad3cd7c9e9e4547ffd492bac181..703fa8a70574323abe2fb32599254582cd5d891f 100644 ---- a/include/uapi/linux/fb.h -+++ b/include/uapi/linux/fb.h -@@ -34,6 +34,12 @@ - #define FBIOPUT_MODEINFO 0x4617 - #define FBIOGET_DISPINFO 0x4618 - #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) -+/* -+ * HACK: use 'z' in order not to clash with any other ioctl numbers which might -+ * be concurrently added to the mainline kernel -+ */ -+#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea) -+#define FBIODMACOPY _IOW('z', 0x22, struct fb_dmacopy) - - #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ - #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -@@ -346,6 +352,12 @@ struct fb_copyarea { - __u32 sy; - }; - -+struct fb_dmacopy { -+ void *dst; -+ __u32 src; -+ __u32 length; -+}; -+ - struct fb_fillrect { - __u32 dx; /* screen-relative */ - __u32 dy; - -From cf7188188aabe5b8ae10cf449ea6c9b0c6c29c90 Mon Sep 17 00:00:00 2001 -From: Harm Hanemaaijer -Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 057/122] Speed up console framebuffer imageblit function - -Especially on platforms with a slower CPU but a relatively high -framebuffer fill bandwidth, like current ARM devices, the existing -console monochrome imageblit function used to draw console text is -suboptimal for common pixel depths such as 16bpp and 32bpp. The existing -code is quite general and can deal with several pixel depths. By creating -special case functions for 16bpp and 32bpp, by far the most common pixel -formats used on modern systems, a significant speed-up is attained -which can be readily felt on ARM-based devices like the Raspberry Pi -and the Allwinner platform, but should help any platform using the -fb layer. - -The special case functions allow constant folding, eliminating a number -of instructions including divide operations, and allow the use of an -unrolled loop, eliminating instructions with a variable shift size, -reducing source memory access instructions, and eliminating excessive -branching. These unrolled loops also allow much better code optimization -by the C compiler. The code that selects which optimized variant is used -is also simplified, eliminating integer divide instructions. - -The speed-up, measured by timing 'cat file.txt' in the console, varies -between 40% and 70%, when testing on the Raspberry Pi and Allwinner -ARM-based platforms, depending on font size and the pixel depth, with -the greater benefit for 32bpp. - -Signed-off-by: Harm Hanemaaijer ---- - drivers/video/fbdev/core/cfbimgblt.c | 152 +++++++++++++++++++++++++++++++++-- - 1 file changed, 147 insertions(+), 5 deletions(-) - -diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c -index a2bb276a8b2463eee98eb237c4647bc00cd93601..436494fba15abecb400ef28688466fafb10feb95 100644 ---- a/drivers/video/fbdev/core/cfbimgblt.c -+++ b/drivers/video/fbdev/core/cfbimgblt.c -@@ -28,6 +28,11 @@ - * - * Also need to add code to deal with cards endians that are different than - * the native cpu endians. I also need to deal with MSB position in the word. -+ * Modified by Harm Hanemaaijer (fgenfb@yahoo.com) 2013: -+ * - Provide optimized versions of fast_imageblit for 16 and 32bpp that are -+ * significantly faster than the previous implementation. -+ * - Simplify the fast/slow_imageblit selection code, avoiding integer -+ * divides. - */ - #include - #include -@@ -262,6 +267,133 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info * - } - } - -+/* -+ * Optimized fast_imageblit for bpp == 16. ppw = 2, bit_mask = 3 folded -+ * into the code, main loop unrolled. -+ */ -+ -+static inline void fast_imageblit16(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; -+ -+ tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le; -+ -+ fgx <<= 16; -+ bgx <<= 16; -+ fgx |= fgcolor; -+ bgx |= bgcolor; -+ -+ eorx = fgx ^ bgx; -+ k = image->width / 2; -+ -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; -+ -+ j = k; -+ while (j >= 4) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 4; -+ } -+ if (j != 0) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 6) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j >= 2) { -+ end_mask = tab[(bits >> 4) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ if (j == 3) { -+ end_mask = tab[(bits >> 2) & 3]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ } -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} -+ -+/* -+ * Optimized fast_imageblit for bpp == 32. ppw = 1, bit_mask = 1 folded -+ * into the code, main loop unrolled. -+ */ -+ -+static inline void fast_imageblit32(const struct fb_image *image, -+ struct fb_info *p, u8 __iomem * dst1, -+ u32 fgcolor, u32 bgcolor) -+{ -+ u32 fgx = fgcolor, bgx = bgcolor; -+ u32 spitch = (image->width + 7) / 8; -+ u32 end_mask, eorx; -+ const char *s = image->data, *src; -+ u32 __iomem *dst; -+ const u32 *tab = NULL; -+ int i, j, k; -+ -+ tab = cfb_tab32; -+ -+ eorx = fgx ^ bgx; -+ k = image->width; -+ -+ for (i = image->height; i--;) { -+ dst = (u32 __iomem *) dst1; -+ src = s; -+ -+ j = k; -+ while (j >= 8) { -+ u8 bits = *src; -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 6) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 5) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 4) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 3) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 2) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[(bits >> 1) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ end_mask = tab[bits & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ src++; -+ j -= 8; -+ } -+ if (j != 0) { -+ u32 bits = (u32) * src; -+ while (j > 1) { -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst++); -+ bits <<= 1; -+ j--; -+ } -+ end_mask = tab[(bits >> 7) & 1]; -+ FB_WRITEL((end_mask & eorx) ^ bgx, dst); -+ } -+ dst1 += p->fix.line_length; -+ s += spitch; -+ } -+} -+ - void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - { - u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; -@@ -294,11 +426,21 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image) - bgcolor = image->bg_color; - } - -- if (32 % bpp == 0 && !start_index && !pitch_index && -- ((width & (32/bpp-1)) == 0) && -- bpp >= 8 && bpp <= 32) -- fast_imageblit(image, p, dst1, fgcolor, bgcolor); -- else -+ if (!start_index && !pitch_index) { -+ if (bpp == 32) -+ fast_imageblit32(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 16 && (width & 1) == 0) -+ fast_imageblit16(image, p, dst1, fgcolor, -+ bgcolor); -+ else if (bpp == 8 && (width & 3) == 0) -+ fast_imageblit(image, p, dst1, fgcolor, -+ bgcolor); -+ else -+ slow_imageblit(image, p, dst1, fgcolor, -+ bgcolor, -+ start_index, pitch_index); -+ } else - slow_imageblit(image, p, dst1, fgcolor, bgcolor, - start_index, pitch_index); - } else - -From 132a1f15dea64eef7dbf9cc5b98e1668cedb2eea Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 058/122] enabling the realtime clock 1-wire chip DS1307 and - 1-wire on GPIO4 (as a module) - -1-wire: Add support for configuring pin for w1-gpio kernel module -See: https://github.com/raspberrypi/linux/pull/457 - -Add bitbanging pullups, use them for w1-gpio - -Allows parasite power to work, uses module option pullup=1 - -bcm2708: Ensure 1-wire pullup is disabled by default, and expose as module parameter - -Signed-off-by: Alex J Lennon - -w1-gpio: Add gpiopin module parameter and correctly free up gpio pull-up pin, if set - -Signed-off-by: Alex J Lennon - -w1-gpio: Sort out the pullup/parasitic power tangle ---- - drivers/w1/masters/w1-gpio.c | 69 ++++++++++++++++++++++++++++++++++++++++---- - drivers/w1/w1.h | 6 ++++ - drivers/w1/w1_int.c | 14 +++++++++ - drivers/w1/w1_io.c | 18 ++++++++++-- - include/linux/w1-gpio.h | 1 + - 5 files changed, 99 insertions(+), 9 deletions(-) - -diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c -index a373ae69d9f6ef8a5925dbd5004cd5e9b8fc5c05..080e5976e2a6b75965ed753ddf29648cb0b2f000 100644 ---- a/drivers/w1/masters/w1-gpio.c -+++ b/drivers/w1/masters/w1-gpio.c -@@ -23,6 +23,19 @@ - #include "../w1.h" - #include "../w1_int.h" - -+static int w1_gpio_pullup = 0; -+static int w1_gpio_pullup_orig = 0; -+module_param_named(pullup, w1_gpio_pullup, int, 0); -+MODULE_PARM_DESC(pullup, "Enable parasitic power (power on data) mode"); -+static int w1_gpio_pullup_pin = -1; -+static int w1_gpio_pullup_pin_orig = -1; -+module_param_named(extpullup, w1_gpio_pullup_pin, int, 0); -+MODULE_PARM_DESC(extpullup, "GPIO external pullup pin number"); -+static int w1_gpio_pin = -1; -+static int w1_gpio_pin_orig = -1; -+module_param_named(gpiopin, w1_gpio_pin, int, 0); -+MODULE_PARM_DESC(gpiopin, "GPIO pin number"); -+ - static u8 w1_gpio_set_pullup(void *data, int delay) - { - struct w1_gpio_platform_data *pdata = data; -@@ -67,6 +80,16 @@ static u8 w1_gpio_read_bit(void *data) - return gpio_get_value(pdata->pin) ? 1 : 0; - } - -+static void w1_gpio_bitbang_pullup(void *data, u8 on) -+{ -+ struct w1_gpio_platform_data *pdata = data; -+ -+ if (on) -+ gpio_direction_output(pdata->pin, 1); -+ else -+ gpio_direction_input(pdata->pin); -+} -+ - #if defined(CONFIG_OF) - static const struct of_device_id w1_gpio_dt_ids[] = { - { .compatible = "w1-gpio" }, -@@ -80,6 +103,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct device_node *np = pdev->dev.of_node; - int gpio; -+ u32 value; - - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) -@@ -88,6 +112,9 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (of_get_property(np, "linux,open-drain", NULL)) - pdata->is_open_drain = 1; - -+ if (of_property_read_u32(np, "rpi,parasitic-power", &value) == 0) -+ pdata->parasitic_power = (value != 0); -+ - gpio = of_get_gpio(np, 0); - if (gpio < 0) { - if (gpio != -EPROBE_DEFER) -@@ -103,7 +130,7 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - if (gpio == -EPROBE_DEFER) - return gpio; - /* ignore other errors as the pullup gpio is optional */ -- pdata->ext_pullup_enable_pin = gpio; -+ pdata->ext_pullup_enable_pin = (gpio >= 0) ? gpio : -1; - - pdev->dev.platform_data = pdata; - -@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) - static int w1_gpio_probe(struct platform_device *pdev) - { - struct w1_bus_master *master; -- struct w1_gpio_platform_data *pdata; -+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; - int err; - -- if (of_have_populated_dt()) { -- err = w1_gpio_probe_dt(pdev); -- if (err < 0) -- return err; -+ if(pdata == NULL) { -+ if (of_have_populated_dt()) { -+ err = w1_gpio_probe_dt(pdev); -+ if (err < 0) -+ return err; -+ } - } - - pdata = dev_get_platdata(&pdev->dev); -@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform_device *pdev) - return -ENOMEM; - } - -+ w1_gpio_pin_orig = pdata->pin; -+ w1_gpio_pullup_pin_orig = pdata->ext_pullup_enable_pin; -+ w1_gpio_pullup_orig = pdata->parasitic_power; -+ -+ if(gpio_is_valid(w1_gpio_pin)) { -+ pdata->pin = w1_gpio_pin; -+ pdata->ext_pullup_enable_pin = -1; -+ pdata->parasitic_power = -1; -+ } -+ pdata->parasitic_power |= w1_gpio_pullup; -+ if(gpio_is_valid(w1_gpio_pullup_pin)) { -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin; -+ } -+ -+ dev_info(&pdev->dev, "gpio pin %d, external pullup pin %d, parasitic power %d\n", pdata->pin, pdata->ext_pullup_enable_pin, pdata->parasitic_power); -+ - err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); - if (err) { - dev_err(&pdev->dev, "gpio_request (pin) failed\n"); -@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform_device *pdev) - master->set_pullup = w1_gpio_set_pullup; - } - -+ if (pdata->parasitic_power) { -+ if (pdata->is_open_drain) -+ printk(KERN_ERR "w1-gpio 'pullup'(parasitic power) " -+ "option doesn't work with open drain GPIO\n"); -+ else -+ master->bitbang_pullup = w1_gpio_bitbang_pullup; -+ } -+ - err = w1_add_master_device(master); - if (err) { - dev_err(&pdev->dev, "w1_add_master device failed\n"); -@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platform_device *pdev) - - w1_remove_master_device(master); - -+ pdata->pin = w1_gpio_pin_orig; -+ pdata->ext_pullup_enable_pin = w1_gpio_pullup_pin_orig; -+ pdata->parasitic_power = w1_gpio_pullup_orig; -+ - return 0; - } - -diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h -index 129895f562b06630b464f2579dc9e5bdc105f35e..737a75b594c69716eae8d37479a40031b3045494 100644 ---- a/drivers/w1/w1.h -+++ b/drivers/w1/w1.h -@@ -173,6 +173,12 @@ struct w1_bus_master - - u8 (*set_pullup)(void *, int); - -+ /** -+ * Turns the pullup on/off in bitbanging mode, takes an on/off argument. -+ * @return -1=Error, 0=completed -+ */ -+ void (*bitbang_pullup) (void *, u8); -+ - void (*search)(void *, struct w1_master *, - u8, w1_slave_found_callback); - }; -diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c -index 20f766afa4c7d7b8116565687541f84184fe61f4..c4fbdb1f25e961f9f7bacbac7b52a6d74cabaf12 100644 ---- a/drivers/w1/w1_int.c -+++ b/drivers/w1/w1_int.c -@@ -122,6 +122,20 @@ int w1_add_master_device(struct w1_bus_master *master) - return(-EINVAL); - } - -+ /* bitbanging hardware uses bitbang_pullup, other hardware uses set_pullup -+ * and takes care of timing itself */ -+ if (!master->write_byte && !master->touch_bit && master->set_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup requires " -+ "write_byte or touch_bit, disabling\n"); -+ master->set_pullup = NULL; -+ } -+ -+ if (master->set_pullup && master->bitbang_pullup) { -+ printk(KERN_ERR "w1_add_master_device: set_pullup should not " -+ "be set when bitbang_pullup is used, disabling\n"); -+ master->set_pullup = NULL; -+ } -+ - /* Lock until the device is added (or not) to w1_masters. */ - mutex_lock(&w1_mlock); - /* Search for the first available id (starting at 1). */ -diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c -index f4bc8c100a01b1f04a62ebca2528c51c05f40520..77527e37c7e749754cd3dc2241cdcb64f178166c 100644 ---- a/drivers/w1/w1_io.c -+++ b/drivers/w1/w1_io.c -@@ -134,10 +134,22 @@ static void w1_pre_write(struct w1_master *dev) - static void w1_post_write(struct w1_master *dev) - { - if (dev->pullup_duration) { -- if (dev->enable_pullup && dev->bus_master->set_pullup) -- dev->bus_master->set_pullup(dev->bus_master->data, 0); -- else -+ if (dev->enable_pullup) { -+ if (dev->bus_master->set_pullup) { -+ dev->bus_master->set_pullup(dev-> -+ bus_master->data, -+ 0); -+ } else if (dev->bus_master->bitbang_pullup) { -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 1); -+ msleep(dev->pullup_duration); -+ dev->bus_master-> -+ bitbang_pullup(dev->bus_master->data, 0); -+ } -+ } else { - msleep(dev->pullup_duration); -+ } -+ - dev->pullup_duration = 0; - } - } -diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h -index d58594a3232492e33f1dd4babd3798b03e0f0203..feae94256256316fd9d850c3d83325af803fb2ce 100644 ---- a/include/linux/w1-gpio.h -+++ b/include/linux/w1-gpio.h -@@ -18,6 +18,7 @@ - struct w1_gpio_platform_data { - unsigned int pin; - unsigned int is_open_drain:1; -+ unsigned int parasitic_power:1; - void (*enable_external_pullup)(int enable); - unsigned int ext_pullup_enable_pin; - unsigned int pullup_duration; - -From 3a29fd5c4e71ff439e60097ca14a4d97c8c63f5f Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 059/122] config: Enable CONFIG_MEMCG, but leave it disabled - (due to memory cost). Enable with cgroup_enable=memory. - ---- - kernel/cgroup.c | 24 +++++++++++++++++++++++- - 1 file changed, 23 insertions(+), 1 deletion(-) - -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 85bc9beb046d9a6deda2e3564f4d5bd01d6fc27b..4acdbef46a8f0556469b5580a39c18ce0496c69d 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -5629,7 +5629,7 @@ int __init cgroup_init_early(void) - return 0; - } - --static u16 cgroup_disable_mask __initdata; -+static u16 cgroup_disable_mask __initdata = 1<<0; - - /** - * cgroup_init - cgroup initialization -@@ -6166,6 +6166,28 @@ static int __init cgroup_no_v1(char *str) - } - __setup("cgroup_no_v1=", cgroup_no_v1); - -+static int __init cgroup_enable(char *str) -+{ -+ struct cgroup_subsys *ss; -+ char *token; -+ int i; -+ -+ while ((token = strsep(&str, ",")) != NULL) { -+ if (!*token) -+ continue; -+ -+ for_each_subsys(ss, i) { -+ if (strcmp(token, ss->name) && -+ strcmp(token, ss->legacy_name)) -+ continue; -+ -+ cgroup_disable_mask &= ~(1 << i); -+ } -+ } -+ return 1; -+} -+__setup("cgroup_enable=", cgroup_enable); -+ - /** - * css_tryget_online_from_dir - get corresponding css from a cgroup dentry - * @dentry: directory dentry of interest - -From 7a094c94cc5e4275d62f541780238f86b7e1a944 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 060/122] hid: Reduce default mouse polling interval to 60Hz - -Reduces overhead when using X ---- - drivers/hid/usbhid/hid-core.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400dfd5834f3 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -49,7 +49,7 @@ - * Module parameters. - */ - --static unsigned int hid_mousepoll_interval; -+static unsigned int hid_mousepoll_interval = ~0; - module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); - MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); - -@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) - } - - /* Change the polling interval of mice. */ -- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) -- interval = hid_mousepoll_interval; -+ if (hid->collection->usage == HID_GD_MOUSE) { -+ if (hid_mousepoll_interval == ~0 && interval < 16) -+ interval = 16; -+ else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0) -+ interval = hid_mousepoll_interval; -+ } - - ret = -ENOMEM; - if (usb_endpoint_dir_in(endpoint)) { - -From 844a5a997e65b9ba913904f020f88893087ba2b2 Mon Sep 17 00:00:00 2001 -From: Gordon Hollingworth -Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 061/122] rpi-ft5406: Add touchscreen driver for pi LCD display - -Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected - -rpi-ft5406: Use firmware API - -RPI-FT5406: Enable aarch64 support through explicit iomem interface - -Signed-off-by: Gerhard de Clercq ---- - drivers/input/touchscreen/Kconfig | 7 + - drivers/input/touchscreen/Makefile | 1 + - drivers/input/touchscreen/rpi-ft5406.c | 292 +++++++++++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 4 files changed, 301 insertions(+) - create mode 100644 drivers/input/touchscreen/rpi-ft5406.c - -diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig -index efca0133e266b84439bed072f86b6d4c3e147ece..0bf78ff1ae888a1afe3825aab5316f365ef96bfe 100644 ---- a/drivers/input/touchscreen/Kconfig -+++ b/drivers/input/touchscreen/Kconfig -@@ -638,6 +638,13 @@ config TOUCHSCREEN_EDT_FT5X06 - To compile this driver as a module, choose M here: the - module will be called edt-ft5x06. - -+config TOUCHSCREEN_RPI_FT5406 -+ tristate "Raspberry Pi FT5406 driver" -+ depends on RASPBERRYPI_FIRMWARE -+ help -+ Say Y here to enable the Raspberry Pi memory based FT5406 device -+ -+ - config TOUCHSCREEN_MIGOR - tristate "Renesas MIGO-R touchscreen" - depends on (SH_MIGOR || COMPILE_TEST) && I2C -diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile -index 81b86451782d4479147fbb1a8c70cdc0f6f08eac..f720bc30ada9c2b5907228e852e3955ce9f48c12 100644 ---- a/drivers/input/touchscreen/Makefile -+++ b/drivers/input/touchscreen/Makefile -@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o - obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o - obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o - obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o -+obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o - obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o - obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o - obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o -diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9d7d05482355d168c5c0c42508cd978979ee5f14 ---- /dev/null -+++ b/drivers/input/touchscreen/rpi-ft5406.c -@@ -0,0 +1,292 @@ -+/* -+ * Driver for memory based ft5406 touchscreen -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define MAXIMUM_SUPPORTED_POINTS 10 -+struct ft5406_regs { -+ uint8_t device_mode; -+ uint8_t gesture_id; -+ uint8_t num_points; -+ struct ft5406_touch { -+ uint8_t xh; -+ uint8_t xl; -+ uint8_t yh; -+ uint8_t yl; -+ uint8_t res1; -+ uint8_t res2; -+ } point[MAXIMUM_SUPPORTED_POINTS]; -+}; -+ -+#define SCREEN_WIDTH 800 -+#define SCREEN_HEIGHT 480 -+ -+struct ft5406 { -+ struct platform_device * pdev; -+ struct input_dev * input_dev; -+ void __iomem * ts_base; -+ dma_addr_t bus_addr; -+ struct task_struct * thread; -+}; -+ -+/* Thread to poll for touchscreen events -+ * -+ * This thread polls the memory based register copy of the ft5406 registers -+ * using the number of points register to know whether the copy has been -+ * updated (we write 99 to the memory copy, the GPU will write between -+ * 0 - 10 points) -+ */ -+static int ft5406_thread(void *arg) -+{ -+ struct ft5406 *ts = (struct ft5406 *) arg; -+ struct ft5406_regs regs; -+ int known_ids = 0; -+ -+ while(!kthread_should_stop()) -+ { -+ // 60fps polling -+ msleep_interruptible(17); -+ memcpy_fromio(®s, ts->ts_base, sizeof(struct ft5406_regs)); -+ iowrite8(99, ts->ts_base + offsetof(struct ft5406_regs, num_points)); -+ // Do not output if theres no new information (num_points is 99) -+ // or we have no touch points and don't need to release any -+ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) -+ { -+ int i; -+ int modified_ids = 0, released_ids; -+ for(i = 0; i < regs.num_points; i++) -+ { -+ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; -+ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; -+ int touchid = (regs.point[i].yh >> 4) & 0xf; -+ -+ modified_ids |= 1 << touchid; -+ -+ if(!((1 << touchid) & known_ids)) -+ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); -+ -+ input_mt_slot(ts->input_dev, touchid); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); -+ -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); -+ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); -+ -+ } -+ -+ released_ids = known_ids & ~modified_ids; -+ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) -+ { -+ if(released_ids & (1<pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); -+ input_mt_slot(ts->input_dev, i); -+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); -+ modified_ids &= ~(1 << i); -+ } -+ } -+ known_ids = modified_ids; -+ -+ input_mt_report_pointer_emulation(ts->input_dev, true); -+ input_sync(ts->input_dev); -+ } -+ -+ } -+ -+ return 0; -+} -+ -+static int ft5406_probe(struct platform_device *pdev) -+{ -+ int err = 0; -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct ft5406 * ts; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ u32 touchbuf; -+ -+ dev_info(dev, "Probing device\n"); -+ -+ fw_node = of_parse_phandle(np, "firmware", 0); -+ if (!fw_node) { -+ dev_err(dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ ts = devm_kzalloc(dev, sizeof(struct ft5406), GFP_KERNEL); -+ if (!ts) { -+ dev_err(dev, "Failed to allocate memory\n"); -+ return -ENOMEM; -+ } -+ -+ ts->input_dev = input_allocate_device(); -+ if (!ts->input_dev) { -+ dev_err(dev, "Failed to allocate input device\n"); -+ return -ENOMEM; -+ } -+ -+ ts->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->bus_addr, GFP_KERNEL); -+ if (!ts->ts_base) { -+ pr_err("[%s]: failed to dma_alloc_coherent(%ld)\n", -+ __func__, PAGE_SIZE); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ touchbuf = (u32)ts->bus_addr; -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF, -+ &touchbuf, sizeof(touchbuf)); -+ -+ if (err || touchbuf != 0) { -+ dev_warn(dev, "Failed to set touchbuf, trying to get err:%x\n", err); -+ dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr); -+ ts->ts_base = 0; -+ ts->bus_addr = 0; -+ } -+ -+ if (!ts->ts_base) { -+ dev_warn(dev, "set failed, trying get (err:%d touchbuf:%x virt:%p bus:%x)\n", err, touchbuf, ts->ts_base, ts->bus_addr); -+ -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, -+ &touchbuf, sizeof(touchbuf)); -+ if (err) { -+ dev_err(dev, "Failed to get touch buffer\n"); -+ goto out; -+ } -+ -+ if (!touchbuf) { -+ dev_err(dev, "Touchscreen not detected\n"); -+ err = -ENODEV; -+ goto out; -+ } -+ -+ dev_dbg(dev, "Got TS buffer 0x%x\n", touchbuf); -+ -+ // mmap the physical memory -+ touchbuf &= ~0xc0000000; -+ ts->ts_base = ioremap(touchbuf, sizeof(struct ft5406_regs)); -+ if (ts->ts_base == NULL) -+ { -+ dev_err(dev, "Failed to map physical address\n"); -+ err = -ENOMEM; -+ goto out; -+ } -+ } -+ platform_set_drvdata(pdev, ts); -+ ts->pdev = pdev; -+ -+ ts->input_dev->name = "FT5406 memory based driver"; -+ -+ __set_bit(EV_KEY, ts->input_dev->evbit); -+ __set_bit(EV_SYN, ts->input_dev->evbit); -+ __set_bit(EV_ABS, ts->input_dev->evbit); -+ -+ input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, -+ SCREEN_WIDTH, 0, 0); -+ input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, -+ SCREEN_HEIGHT, 0, 0); -+ -+ input_mt_init_slots(ts->input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); -+ -+ input_set_drvdata(ts->input_dev, ts); -+ -+ err = input_register_device(ts->input_dev); -+ if (err) { -+ dev_err(dev, "could not register input device, %d\n", -+ err); -+ goto out; -+ } -+ -+ // create thread to poll the touch events -+ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); -+ if(ts->thread == NULL) -+ { -+ dev_err(dev, "Failed to create kernel thread"); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ return 0; -+ -+out: -+ if (ts->bus_addr) { -+ dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr); -+ ts->bus_addr = 0; -+ ts->ts_base = NULL; -+ } else if (ts->ts_base) { -+ iounmap(ts->ts_base); -+ ts->ts_base = NULL; -+ } -+ if (ts->input_dev) { -+ input_unregister_device(ts->input_dev); -+ ts->input_dev = NULL; -+ } -+ return err; -+} -+ -+static int ft5406_remove(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); -+ -+ dev_info(dev, "Removing rpi-ft5406\n"); -+ -+ kthread_stop(ts->thread); -+ -+ if (ts->bus_addr) -+ dma_free_coherent(dev, PAGE_SIZE, ts->ts_base, ts->bus_addr); -+ else if (ts->ts_base) -+ iounmap(ts->ts_base); -+ if (ts->input_dev) -+ input_unregister_device(ts->input_dev); -+ -+ return 0; -+} -+ -+static const struct of_device_id ft5406_match[] = { -+ { .compatible = "rpi,rpi-ft5406", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ft5406_match); -+ -+static struct platform_driver ft5406_driver = { -+ .driver = { -+ .name = "rpi-ft5406", -+ .owner = THIS_MODULE, -+ .of_match_table = ft5406_match, -+ }, -+ .probe = ft5406_probe, -+ .remove = ft5406_remove, -+}; -+ -+module_platform_driver(ft5406_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth"); -+MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 227a107214a02deadcca3db202da265eba1fdd21..b0f6e33bd30c35664ceee057f4c3ad32b914291d 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -115,6 +115,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF = 0x0004801f, - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, - RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, - - -From 3b84c6d542a8066b50fc3efdd916c8a7b88b9d1f Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 28 Nov 2016 16:50:04 +0000 -Subject: [PATCH 062/122] Improve __copy_to_user and __copy_from_user - performance - -Provide a __copy_from_user that uses memcpy. On BCM2708, use -optimised memcpy/memmove/memcmp/memset implementations. - -arch/arm: Add mmiocpy/set aliases for memcpy/set - -See: https://github.com/raspberrypi/linux/issues/1082 - -copy_from_user: CPU_SW_DOMAIN_PAN compatibility - -The downstream copy_from_user acceleration must also play nice with -CONFIG_CPU_SW_DOMAIN_PAN. - -See: https://github.com/raspberrypi/linux/issues/1381 - -Signed-off-by: Phil Elwell ---- - arch/arm/include/asm/string.h | 5 + - arch/arm/include/asm/uaccess.h | 3 + - arch/arm/lib/Makefile | 15 +- - arch/arm/lib/arm-mem.h | 159 ++++++++++++ - arch/arm/lib/copy_from_user.S | 4 +- - arch/arm/lib/exports_rpi.c | 37 +++ - arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ - arch/arm/lib/memcpy_rpi.S | 61 +++++ - arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ - arch/arm/lib/memmove_rpi.S | 61 +++++ - arch/arm/lib/memset_rpi.S | 123 +++++++++ - arch/arm/lib/uaccess_with_memcpy.c | 120 ++++++++- - arch/arm/mach-bcm/Kconfig | 7 + - 13 files changed, 1380 insertions(+), 6 deletions(-) - create mode 100644 arch/arm/lib/arm-mem.h - create mode 100644 arch/arm/lib/exports_rpi.c - create mode 100644 arch/arm/lib/memcmp_rpi.S - create mode 100644 arch/arm/lib/memcpy_rpi.S - create mode 100644 arch/arm/lib/memcpymove.h - create mode 100644 arch/arm/lib/memmove_rpi.S - create mode 100644 arch/arm/lib/memset_rpi.S - -diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h -index cf4f3aad0fc1c2154c6cf3839ff21bb1c46d6499..d69b70a6007dfc647ad164d1ee90d253c0686dee 100644 ---- a/arch/arm/include/asm/string.h -+++ b/arch/arm/include/asm/string.h -@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); - #define __HAVE_ARCH_MEMSET - extern void * memset(void *, int, __kernel_size_t); - -+#ifdef CONFIG_BCM2835_FAST_MEMCPY -+#define __HAVE_ARCH_MEMCMP -+extern int memcmp(const void *, const void *, size_t); -+#endif -+ - extern void __memzero(void *ptr, __kernel_size_t n); - - #define memset(p,v,n) \ -diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h -index 1f59ea051bab814132074b09f55d3a57c800a471..028d151b80a3dfb4253e94b87cc391bdb0b16c49 100644 ---- a/arch/arm/include/asm/uaccess.h -+++ b/arch/arm/include/asm/uaccess.h -@@ -477,6 +477,9 @@ do { \ - extern unsigned long __must_check - arm_copy_from_user(void *to, const void __user *from, unsigned long n); - -+extern unsigned long __must_check -+__copy_from_user_std(void *to, const void __user *from, unsigned long n); -+ - static inline unsigned long __must_check - __copy_from_user(void *to, const void __user *from, unsigned long n) - { -diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile -index 27f4d96258a2e66193d6a3701bb4cf9a44399aad..96b390c9301f816d5c83c6ddb76ac74ba7a3b99d 100644 ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -6,9 +6,8 @@ - - lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ -- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ -- memmove.o memset.o memzero.o setbit.o \ -- strchr.o strrchr.o \ -+ delay.o delay-loop.o findbit.o memchr.o memzero.o \ -+ setbit.o strchr.o strrchr.o \ - testchangebit.o testclearbit.o testsetbit.o \ - ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ - ucmpdi2.o lib1funcs.o div64.o \ -@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ - mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ - copy_from_user.o copy_to_user.o - -+# Choose optimised implementations for Raspberry Pi -+ifeq ($(CONFIG_BCM2835_FAST_MEMCPY),y) -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 -+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 -+ obj-$(CONFIG_MODULES) += exports_rpi.o -+ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o -+else -+ lib-y += memcpy.o memmove.o memset.o -+endif -+ - # using lib_ here won't override already available weak symbols - obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o - -diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h -new file mode 100644 -index 0000000000000000000000000000000000000000..5d4bda19ad207c65e7b7c6d6d733087faa96a8cc ---- /dev/null -+++ b/arch/arm/lib/arm-mem.h -@@ -0,0 +1,159 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+.macro myfunc fname -+ .func fname -+ .global fname -+fname: -+.endm -+ -+.macro preload_leading_step1 backwards, ptr, base -+/* If the destination is already 16-byte aligned, then we need to preload -+ * between 0 and prefetch_distance (inclusive) cache lines ahead so there -+ * are no gaps when the inner loop starts. -+ */ -+ .if backwards -+ sub ptr, base, #1 -+ bic ptr, ptr, #31 -+ .else -+ bic ptr, base, #31 -+ .endif -+ .set OFFSET, 0 -+ .rept prefetch_distance+1 -+ pld [ptr, #OFFSET] -+ .if backwards -+ .set OFFSET, OFFSET-32 -+ .else -+ .set OFFSET, OFFSET+32 -+ .endif -+ .endr -+.endm -+ -+.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp -+/* However, if the destination is not 16-byte aligned, we may need to -+ * preload one more cache line than that. The question we need to ask is: -+ * are the leading bytes more than the amount by which the source -+ * pointer will be rounded down for preloading, and if so, by how many -+ * cache lines? -+ */ -+ .if backwards -+/* Here we compare against how many bytes we are into the -+ * cache line, counting down from the highest such address. -+ * Effectively, we want to calculate -+ * leading_bytes = dst&15 -+ * cacheline_offset = 31-((src-leading_bytes-1)&31) -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0, or rearranging: -+ * leading_bytes + (src-leading_bytes-1)&31 <= 31 -+ */ -+ mov tmp, base, lsl #32-5 -+ sbc tmp, tmp, leading_bytes, lsl #32-5 -+ adds tmp, tmp, leading_bytes, lsl #32-5 -+ bcc 61f -+ pld [ptr, #-32*(prefetch_distance+1)] -+ .else -+/* Effectively, we want to calculate -+ * leading_bytes = (-dst)&15 -+ * cacheline_offset = (src+leading_bytes)&31 -+ * extra_needed = leading_bytes - cacheline_offset -+ * and test if extra_needed is <= 0. -+ */ -+ mov tmp, base, lsl #32-5 -+ add tmp, tmp, leading_bytes, lsl #32-5 -+ rsbs tmp, tmp, leading_bytes, lsl #32-5 -+ bls 61f -+ pld [ptr, #32*(prefetch_distance+1)] -+ .endif -+61: -+.endm -+ -+.macro preload_trailing backwards, base, remain, tmp -+ /* We need either 0, 1 or 2 extra preloads */ -+ .if backwards -+ rsb tmp, base, #0 -+ mov tmp, tmp, lsl #32-5 -+ .else -+ mov tmp, base, lsl #32-5 -+ .endif -+ adds tmp, tmp, remain, lsl #32-5 -+ adceqs tmp, tmp, #0 -+ /* The instruction above has two effects: ensures Z is only -+ * set if C was clear (so Z indicates that both shifted quantities -+ * were 0), and clears C if Z was set (so C indicates that the sum -+ * of the shifted quantities was greater and not equal to 32) */ -+ beq 82f -+ .if backwards -+ sub tmp, base, #1 -+ bic tmp, tmp, #31 -+ .else -+ bic tmp, base, #31 -+ .endif -+ bcc 81f -+ .if backwards -+ pld [tmp, #-32*(prefetch_distance+1)] -+81: -+ pld [tmp, #-32*prefetch_distance] -+ .else -+ pld [tmp, #32*(prefetch_distance+2)] -+81: -+ pld [tmp, #32*(prefetch_distance+1)] -+ .endif -+82: -+.endm -+ -+.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 -+ .if backwards -+ sub tmp0, base, #1 -+ bic tmp0, tmp0, #31 -+ pld [tmp0] -+ sub tmp1, base, remain, lsl #shift -+ .else -+ bic tmp0, base, #31 -+ pld [tmp0] -+ add tmp1, base, remain, lsl #shift -+ sub tmp1, tmp1, #1 -+ .endif -+ bic tmp1, tmp1, #31 -+ cmp tmp1, tmp0 -+ beq 92f -+ .if narrow_case -+ /* In this case, all the data fits in either 1 or 2 cache lines */ -+ pld [tmp1] -+ .else -+91: -+ .if backwards -+ sub tmp0, tmp0, #32 -+ .else -+ add tmp0, tmp0, #32 -+ .endif -+ cmp tmp0, tmp1 -+ pld [tmp0] -+ bne 91b -+ .endif -+92: -+.endm -diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S -index 7a4b060490012dd29f8a6d9fb8e24dfa58896bd1..fb40a1b3a5b7d42f93ae362e3326b7a72dc290dc 100644 ---- a/arch/arm/lib/copy_from_user.S -+++ b/arch/arm/lib/copy_from_user.S -@@ -89,11 +89,13 @@ - - .text - --ENTRY(arm_copy_from_user) -+ENTRY(__copy_from_user_std) -+WEAK(arm_copy_from_user) - - #include "copy_template.S" - - ENDPROC(arm_copy_from_user) -+ENDPROC(__copy_from_user_std) - - .pushsection .fixup,"ax" - .align 0 -diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..1f826047db754ffde0077ac291b9605e201abd07 ---- /dev/null -+++ b/arch/arm/lib/exports_rpi.c -@@ -0,0 +1,37 @@ -+/** -+ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions, and the following disclaimer, -+ * without modification. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. The names of the above-listed copyright holders may not be used -+ * to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * ALTERNATIVELY, this software may be distributed under the terms of the -+ * GNU General Public License ("GPL") version 2, as published by the Free -+ * Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include -+#include -+ -+EXPORT_SYMBOL(memcmp); -diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..bf6e4edfc9d3b9882b72edada681b79ce37850df ---- /dev/null -+++ b/arch/arm/lib/memcmp_rpi.S -@@ -0,0 +1,285 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+.macro memcmp_process_head unaligned -+ .if unaligned -+ ldr DAT0, [S_1], #4 -+ ldr DAT1, [S_1], #4 -+ ldr DAT2, [S_1], #4 -+ ldr DAT3, [S_1], #4 -+ .else -+ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} -+ .endif -+ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} -+.endm -+ -+.macro memcmp_process_tail -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ cmpeq DAT3, DAT7 -+ bne 200f -+.endm -+ -+.macro memcmp_leading_31bytes -+ movs DAT0, OFF, lsl #31 -+ ldrmib DAT0, [S_1], #1 -+ ldrcsh DAT1, [S_1], #2 -+ ldrmib DAT4, [S_2], #1 -+ ldrcsh DAT5, [S_2], #2 -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ submi N, N, #1 -+ subcs N, N, #2 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+ movs DAT0, OFF, lsl #29 -+ ldrmi DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ ldrcs DAT2, [S_1], #4 -+ ldrmi DAT4, [S_2], #4 -+ ldmcsia S_2!, {DAT5, DAT6} -+ movpl DAT0, #0 -+ movcc DAT1, #0 -+ movcc DAT2, #0 -+ movpl DAT4, #0 -+ movcc DAT5, #0 -+ movcc DAT6, #0 -+ submi N, N, #4 -+ subcs N, N, #8 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ tst OFF, #16 -+ beq 105f -+ memcmp_process_head 1 -+ sub N, N, #16 -+ memcmp_process_tail -+105: -+.endm -+ -+.macro memcmp_trailing_15bytes unaligned -+ movs N, N, lsl #29 -+ .if unaligned -+ ldrcs DAT0, [S_1], #4 -+ ldrcs DAT1, [S_1], #4 -+ .else -+ ldmcsia S_1!, {DAT0, DAT1} -+ .endif -+ ldrmi DAT2, [S_1], #4 -+ ldmcsia S_2!, {DAT4, DAT5} -+ ldrmi DAT6, [S_2], #4 -+ movcc DAT0, #0 -+ movcc DAT1, #0 -+ movpl DAT2, #0 -+ movcc DAT4, #0 -+ movcc DAT5, #0 -+ movpl DAT6, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ cmpeq DAT2, DAT6 -+ bne 200f -+ movs N, N, lsl #2 -+ ldrcsh DAT0, [S_1], #2 -+ ldrmib DAT1, [S_1] -+ ldrcsh DAT4, [S_2], #2 -+ ldrmib DAT5, [S_2] -+ movcc DAT0, #0 -+ movpl DAT1, #0 -+ movcc DAT4, #0 -+ movpl DAT5, #0 -+ cmp DAT0, DAT4 -+ cmpeq DAT1, DAT5 -+ bne 200f -+.endm -+ -+.macro memcmp_long_inner_loop unaligned -+110: -+ memcmp_process_head unaligned -+ pld [S_2, #prefetch_distance*32 + 16] -+ memcmp_process_tail -+ memcmp_process_head unaligned -+ pld [S_1, OFF] -+ memcmp_process_tail -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, -+ * deal with final preloads */ -+ preload_trailing 0, S_1, N, DAT0 -+ preload_trailing 0, S_2, N, DAT0 -+ add N, N, #(prefetch_distance+2)*32 - 16 -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+.macro memcmp_short_inner_loop unaligned -+ subs N, N, #16 /* simplifies inner loop termination */ -+ blo 122f -+120: -+ memcmp_process_head unaligned -+ memcmp_process_tail -+ subs N, N, #16 -+ bhs 120b -+122: /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcmp_trailing_15bytes unaligned -+199: /* Reached end without detecting a difference */ -+ mov a1, #0 -+ setend le -+ pop {DAT1-DAT6, pc} -+.endm -+ -+/* -+ * int memcmp(const void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to buffer 1 -+ * a2 = pointer to buffer 2 -+ * a3 = number of bytes to compare (as unsigned chars) -+ * On exit: -+ * a1 = >0/=0/<0 if s1 >/=/< s2 -+ */ -+ -+.set prefetch_distance, 2 -+ -+ENTRY(memcmp) -+ S_1 .req a1 -+ S_2 .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req ip -+ OFF .req lr -+ -+ push {DAT1-DAT6, lr} -+ setend be /* lowest-addressed bytes are most significant */ -+ -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 170f -+ -+ /* Long case */ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 0, DAT0, S_1 -+ preload_leading_step1 0, DAT1, S_2 -+ tst S_2, #31 -+ beq 154f -+ rsb OFF, S_2, #0 /* no need to AND with 15 here */ -+ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 -+ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 -+ memcmp_leading_31bytes -+154: /* Second source now cacheline (32-byte) aligned; we have at -+ * least one prefetch to go. */ -+ /* Prefetch offset is best selected such that it lies in the -+ * first 8 of each 32 bytes - but it's just as easy to aim for -+ * the first one */ -+ and OFF, S_1, #31 -+ rsb OFF, OFF, #32*prefetch_distance -+ tst S_1, #3 -+ bne 140f -+ memcmp_long_inner_loop 0 -+140: memcmp_long_inner_loop 1 -+ -+170: /* Short case */ -+ teq N, #0 -+ beq 199f -+ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 -+ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 -+ tst S_2, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ ldrb DAT0, [S_1], #1 -+ ldrb DAT4, [S_2], #1 -+ cmp DAT0, DAT4 -+ bne 200f -+ tst S_2, #3 -+ bne 172b -+174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ -+ tst S_1, #3 -+ bne 140f -+ memcmp_short_inner_loop 0 -+140: memcmp_short_inner_loop 1 -+ -+200: /* Difference found: determine sign. */ -+ movhi a1, #1 -+ movlo a1, #-1 -+ setend le -+ pop {DAT1-DAT6, pc} -+ -+ .unreq S_1 -+ .unreq S_2 -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq OFF -+ENDPROC(memcmp) -diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..30f8a9089a835ff265ce5aaf98f066258608eb92 ---- /dev/null -+++ b/arch/arm/lib/memcpy_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(mmiocpy) -+ENTRY(memcpy) -+ memcpy 0 -+ENDPROC(memcpy) -+ENDPROC(mmiocpy) -diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h -new file mode 100644 -index 0000000000000000000000000000000000000000..d8be5849c8609f4ead85527ec527184614a77371 ---- /dev/null -+++ b/arch/arm/lib/memcpymove.h -@@ -0,0 +1,506 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 -+ .if words == 1 -+ .if backwards -+ mov r1, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r1, r1, r0, lsr #align*8 -+ str r1, [D, #-4]! -+ .else -+ mov r0, r1, lsr #align*8 -+ ldr r1, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ str r0, [D], #4 -+ .endif -+ .elseif words == 2 -+ .if backwards -+ ldr r1, [S, #-4]! -+ mov r2, r0, lsl #32-align*8 -+ ldr r0, [S, #-4]! -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2} -+ .else -+ ldr r1, [S, #4]! -+ mov r0, r2, lsr #align*8 -+ ldr r2, [S, #4]! -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ stmia D!, {r0, r1} -+ .endif -+ .elseif words == 4 -+ .if backwards -+ ldmdb S!, {r2, r3} -+ mov r4, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1} -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2} -+ mov r0, r4, lsr #align*8 -+ ldmib S!, {r3, r4} -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ .endif -+ .elseif words == 8 -+ .if backwards -+ ldmdb S!, {r4, r5, r6, r7} -+ mov r8, r0, lsl #32-align*8 -+ ldmdb S!, {r0, r1, r2, r3} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r8, r8, r7, lsr #align*8 -+ mov r7, r7, lsl #32-align*8 -+ orr r7, r7, r6, lsr #align*8 -+ mov r6, r6, lsl #32-align*8 -+ orr r6, r6, r5, lsr #align*8 -+ mov r5, r5, lsl #32-align*8 -+ orr r5, r5, r4, lsr #align*8 -+ mov r4, r4, lsl #32-align*8 -+ orr r4, r4, r3, lsr #align*8 -+ mov r3, r3, lsl #32-align*8 -+ orr r3, r3, r2, lsr #align*8 -+ mov r2, r2, lsl #32-align*8 -+ orr r2, r2, r1, lsr #align*8 -+ mov r1, r1, lsl #32-align*8 -+ orr r1, r1, r0, lsr #align*8 -+ stmdb D!, {r5, r6, r7, r8} -+ stmdb D!, {r1, r2, r3, r4} -+ .else -+ ldmib S!, {r1, r2, r3, r4} -+ mov r0, r8, lsr #align*8 -+ ldmib S!, {r5, r6, r7, r8} -+ .if use_pld -+ pld [S, OFF] -+ .endif -+ orr r0, r0, r1, lsl #32-align*8 -+ mov r1, r1, lsr #align*8 -+ orr r1, r1, r2, lsl #32-align*8 -+ mov r2, r2, lsr #align*8 -+ orr r2, r2, r3, lsl #32-align*8 -+ mov r3, r3, lsr #align*8 -+ orr r3, r3, r4, lsl #32-align*8 -+ mov r4, r4, lsr #align*8 -+ orr r4, r4, r5, lsl #32-align*8 -+ mov r5, r5, lsr #align*8 -+ orr r5, r5, r6, lsl #32-align*8 -+ mov r6, r6, lsr #align*8 -+ orr r6, r6, r7, lsl #32-align*8 -+ mov r7, r7, lsr #align*8 -+ orr r7, r7, r8, lsl #32-align*8 -+ stmia D!, {r0, r1, r2, r3} -+ stmia D!, {r4, r5, r6, r7} -+ .endif -+ .endif -+.endm -+ -+.macro memcpy_leading_15bytes backwards, align -+ movs DAT1, DAT2, lsl #31 -+ sub N, N, DAT2 -+ .if backwards -+ ldrmib DAT0, [S, #-1]! -+ ldrcsh DAT1, [S, #-2]! -+ strmib DAT0, [D, #-1]! -+ strcsh DAT1, [D, #-2]! -+ .else -+ ldrmib DAT0, [S], #1 -+ ldrcsh DAT1, [S], #2 -+ strmib DAT0, [D], #1 -+ strcsh DAT1, [D], #2 -+ .endif -+ movs DAT1, DAT2, lsl #29 -+ .if backwards -+ ldrmi DAT0, [S, #-4]! -+ .if align == 0 -+ ldmcsdb S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT2, [S, #-4]! -+ ldrcs DAT1, [S, #-4]! -+ .endif -+ strmi DAT0, [D, #-4]! -+ stmcsdb D!, {DAT1, DAT2} -+ .else -+ ldrmi DAT0, [S], #4 -+ .if align == 0 -+ ldmcsia S!, {DAT1, DAT2} -+ .else -+ ldrcs DAT1, [S], #4 -+ ldrcs DAT2, [S], #4 -+ .endif -+ strmi DAT0, [D], #4 -+ stmcsia D!, {DAT1, DAT2} -+ .endif -+.endm -+ -+.macro memcpy_trailing_15bytes backwards, align -+ movs N, N, lsl #29 -+ .if backwards -+ .if align == 0 -+ ldmcsdb S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT1, [S, #-4]! -+ ldrcs DAT0, [S, #-4]! -+ .endif -+ ldrmi DAT2, [S, #-4]! -+ stmcsdb D!, {DAT0, DAT1} -+ strmi DAT2, [D, #-4]! -+ .else -+ .if align == 0 -+ ldmcsia S!, {DAT0, DAT1} -+ .else -+ ldrcs DAT0, [S], #4 -+ ldrcs DAT1, [S], #4 -+ .endif -+ ldrmi DAT2, [S], #4 -+ stmcsia D!, {DAT0, DAT1} -+ strmi DAT2, [D], #4 -+ .endif -+ movs N, N, lsl #2 -+ .if backwards -+ ldrcsh DAT0, [S, #-2]! -+ ldrmib DAT1, [S, #-1] -+ strcsh DAT0, [D, #-2]! -+ strmib DAT1, [D, #-1] -+ .else -+ ldrcsh DAT0, [S], #2 -+ ldrmib DAT1, [S] -+ strcsh DAT0, [D], #2 -+ strmib DAT1, [D] -+ .endif -+.endm -+ -+.macro memcpy_long_inner_loop backwards, align -+ .if align != 0 -+ .if backwards -+ ldr DAT0, [S, #-align]! -+ .else -+ ldr LAST, [S, #-align]! -+ .endif -+ .endif -+110: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ pld [S, OFF] -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 110b -+ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ -+ preload_trailing backwards, S, N, OFF -+ add N, N, #(prefetch_distance+2)*32 - 32 -+120: -+ .if align == 0 -+ .if backwards -+ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT4, DAT5, DAT6, LAST} -+ stmdb D!, {DAT0, DAT1, DAT2, DAT3} -+ .else -+ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} -+ stmia D!, {DAT0, DAT1, DAT2, DAT3} -+ stmia D!, {DAT4, DAT5, DAT6, LAST} -+ .endif -+ .else -+ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST -+ .endif -+ subs N, N, #32 -+ bhs 120b -+ tst N, #16 -+ .if align == 0 -+ .if backwards -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ .else -+ beq 130f -+ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST -+130: -+ .endif -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ .if align != 0 -+ add S, S, #align -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {DAT3, DAT4, DAT5, DAT6, DAT7} -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_medium_inner_loop backwards, align -+120: -+ .if backwards -+ .if align == 0 -+ ldmdb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr LAST, [S, #-4]! -+ ldr DAT2, [S, #-4]! -+ ldr DAT1, [S, #-4]! -+ ldr DAT0, [S, #-4]! -+ .endif -+ stmdb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldr DAT0, [S], #4 -+ ldr DAT1, [S], #4 -+ ldr DAT2, [S], #4 -+ ldr LAST, [S], #4 -+ .endif -+ stmia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ subs N, N, #16 -+ bhs 120b -+ /* Trailing words and bytes */ -+ tst N, #15 -+ beq 199f -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy_short_inner_loop backwards, align -+ tst N, #16 -+ .if backwards -+ .if align == 0 -+ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne LAST, [S, #-4]! -+ ldrne DAT2, [S, #-4]! -+ ldrne DAT1, [S, #-4]! -+ ldrne DAT0, [S, #-4]! -+ .endif -+ stmnedb D!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ .if align == 0 -+ ldmneia S!, {DAT0, DAT1, DAT2, LAST} -+ .else -+ ldrne DAT0, [S], #4 -+ ldrne DAT1, [S], #4 -+ ldrne DAT2, [S], #4 -+ ldrne LAST, [S], #4 -+ .endif -+ stmneia D!, {DAT0, DAT1, DAT2, LAST} -+ .endif -+ memcpy_trailing_15bytes backwards, align -+199: -+ pop {D, DAT1, DAT2, pc} -+.endm -+ -+.macro memcpy backwards -+ D .req a1 -+ S .req a2 -+ N .req a3 -+ DAT0 .req a4 -+ DAT1 .req v1 -+ DAT2 .req v2 -+ DAT3 .req v3 -+ DAT4 .req v4 -+ DAT5 .req v5 -+ DAT6 .req v6 -+ DAT7 .req sl -+ LAST .req ip -+ OFF .req lr -+ -+ .cfi_startproc -+ -+ push {D, DAT1, DAT2, lr} -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_undefined S -+ .cfi_undefined N -+ .cfi_undefined DAT0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_undefined LAST -+ .cfi_rel_offset lr, 12 -+ -+ .if backwards -+ add D, D, N -+ add S, S, N -+ .endif -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ -+ cmp N, #(prefetch_distance+3)*32 - 1 -+ blo 160f -+ -+ /* Long case */ -+ push {DAT3, DAT4, DAT5, DAT6, DAT7} -+ -+ .cfi_def_cfa_offset 36 -+ .cfi_rel_offset D, 20 -+ .cfi_rel_offset DAT1, 24 -+ .cfi_rel_offset DAT2, 28 -+ .cfi_rel_offset DAT3, 0 -+ .cfi_rel_offset DAT4, 4 -+ .cfi_rel_offset DAT5, 8 -+ .cfi_rel_offset DAT6, 12 -+ .cfi_rel_offset DAT7, 16 -+ .cfi_rel_offset lr, 32 -+ -+ /* Adjust N so that the decrement instruction can also test for -+ * inner loop termination. We want it to stop when there are -+ * (prefetch_distance+1) complete blocks to go. */ -+ sub N, N, #(prefetch_distance+2)*32 -+ preload_leading_step1 backwards, DAT0, S -+ .if backwards -+ /* Bug in GAS: it accepts, but mis-assembles the instruction -+ * ands DAT2, D, #60, 2 -+ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) -+ */ -+ .word 0xE210513C -+ beq 154f -+ .else -+ ands DAT2, D, #15 -+ beq 154f -+ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ -+ .endif -+ preload_leading_step2 backwards, DAT0, S, DAT2, OFF -+ memcpy_leading_15bytes backwards, 1 -+154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ -+ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ -+ .if backwards -+ rsb OFF, S, #3 -+ and OFF, OFF, #28 -+ sub OFF, OFF, #32*(prefetch_distance+1) -+ .else -+ and OFF, S, #28 -+ rsb OFF, OFF, #32*prefetch_distance -+ .endif -+ movs DAT0, S, lsl #31 -+ bhi 157f -+ bcs 156f -+ bmi 155f -+ memcpy_long_inner_loop backwards, 0 -+155: memcpy_long_inner_loop backwards, 1 -+156: memcpy_long_inner_loop backwards, 2 -+157: memcpy_long_inner_loop backwards, 3 -+ -+ .cfi_def_cfa_offset 16 -+ .cfi_rel_offset D, 0 -+ .cfi_rel_offset DAT1, 4 -+ .cfi_rel_offset DAT2, 8 -+ .cfi_same_value DAT3 -+ .cfi_same_value DAT4 -+ .cfi_same_value DAT5 -+ .cfi_same_value DAT6 -+ .cfi_same_value DAT7 -+ .cfi_rel_offset lr, 12 -+ -+160: /* Medium case */ -+ preload_all backwards, 0, 0, S, N, DAT2, OFF -+ sub N, N, #16 /* simplifies inner loop termination */ -+ .if backwards -+ ands DAT2, D, #15 -+ beq 164f -+ .else -+ ands DAT2, D, #15 -+ beq 164f -+ rsb DAT2, DAT2, #16 -+ .endif -+ memcpy_leading_15bytes backwards, align -+164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ -+ tst S, #3 -+ bne 140f -+ memcpy_medium_inner_loop backwards, 0 -+140: memcpy_medium_inner_loop backwards, 1 -+ -+170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ -+ teq N, #0 -+ beq 199f -+ preload_all backwards, 1, 0, S, N, DAT2, LAST -+ tst D, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199f -+ .if backwards -+ ldrb DAT0, [S, #-1]! -+ strb DAT0, [D, #-1]! -+ .else -+ ldrb DAT0, [S], #1 -+ strb DAT0, [D], #1 -+ .endif -+ tst D, #3 -+ bne 172b -+174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ -+ tst S, #3 -+ bne 140f -+ memcpy_short_inner_loop backwards, 0 -+140: memcpy_short_inner_loop backwards, 1 -+ -+ .cfi_endproc -+ -+ .unreq D -+ .unreq S -+ .unreq N -+ .unreq DAT0 -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ .unreq DAT4 -+ .unreq DAT5 -+ .unreq DAT6 -+ .unreq DAT7 -+ .unreq LAST -+ .unreq OFF -+.endm -diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..8b0760c0904c51ef205e56d238b5df8a5226d7cf ---- /dev/null -+++ b/arch/arm/lib/memmove_rpi.S -@@ -0,0 +1,61 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+#include "memcpymove.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memmove(void *s1, const void *s2, size_t n); -+ * On entry: -+ * a1 = pointer to destination -+ * a2 = pointer to source -+ * a3 = number of bytes to copy -+ * On exit: -+ * a1 preserved -+ */ -+ -+.set prefetch_distance, 3 -+ -+ENTRY(memmove) -+ cmp a2, a1 -+ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ -+ memcpy 1 -+ENDPROC(memmove) -diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S -new file mode 100644 -index 0000000000000000000000000000000000000000..70674158d76cd38d8d70c987aa54a6b477e4fa91 ---- /dev/null -+++ b/arch/arm/lib/memset_rpi.S -@@ -0,0 +1,123 @@ -+/* -+Copyright (c) 2013, Raspberry Pi Foundation -+Copyright (c) 2013, RISC OS Open Ltd -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include "arm-mem.h" -+ -+/* Prevent the stack from becoming executable */ -+#if defined(__linux__) && defined(__ELF__) -+.section .note.GNU-stack,"",%progbits -+#endif -+ -+ .text -+ .arch armv6 -+ .object_arch armv4 -+ .arm -+ .altmacro -+ .p2align 2 -+ -+/* -+ * void *memset(void *s, int c, size_t n); -+ * On entry: -+ * a1 = pointer to buffer to fill -+ * a2 = byte pattern to fill with (caller-narrowed) -+ * a3 = number of bytes to fill -+ * On exit: -+ * a1 preserved -+ */ -+ENTRY(mmioset) -+ENTRY(memset) -+ S .req a1 -+ DAT0 .req a2 -+ N .req a3 -+ DAT1 .req a4 -+ DAT2 .req ip -+ DAT3 .req lr -+ -+ orr DAT0, DAT0, lsl #8 -+ push {S, lr} -+ orr DAT0, DAT0, lsl #16 -+ mov DAT1, DAT0 -+ -+ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ -+ cmp N, #31 -+ blo 170f -+ -+161: sub N, N, #16 /* simplifies inner loop termination */ -+ /* Leading words and bytes */ -+ tst S, #15 -+ beq 164f -+ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ -+ movs DAT2, DAT3, lsl #31 -+ submi N, N, #1 -+ strmib DAT0, [S], #1 -+ subcs N, N, #2 -+ strcsh DAT0, [S], #2 -+ movs DAT2, DAT3, lsl #29 -+ submi N, N, #4 -+ strmi DAT0, [S], #4 -+ subcs N, N, #8 -+ stmcsia S!, {DAT0, DAT1} -+164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ /* Now the inner loop of 16-byte stores */ -+165: stmia S!, {DAT0, DAT1, DAT2, DAT3} -+ subs N, N, #16 -+ bhs 165b -+166: /* Trailing words and bytes */ -+ movs N, N, lsl #29 -+ stmcsia S!, {DAT0, DAT1} -+ strmi DAT0, [S], #4 -+ movs N, N, lsl #2 -+ strcsh DAT0, [S], #2 -+ strmib DAT0, [S] -+199: pop {S, pc} -+ -+170: /* Short case */ -+ mov DAT2, DAT0 -+ mov DAT3, DAT0 -+ tst S, #3 -+ beq 174f -+172: subs N, N, #1 -+ blo 199b -+ strb DAT0, [S], #1 -+ tst S, #3 -+ bne 172b -+174: tst N, #16 -+ stmneia S!, {DAT0, DAT1, DAT2, DAT3} -+ b 166b -+ -+ .unreq S -+ .unreq DAT0 -+ .unreq N -+ .unreq DAT1 -+ .unreq DAT2 -+ .unreq DAT3 -+ENDPROC(memset) -+ENDPROC(mmioset) -diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c -index 6bd1089b07e0960830ed6bd6a8345202b7efd8b0..cd17dd11ebe7bbe00089e70cd2ccea74e0400200 100644 ---- a/arch/arm/lib/uaccess_with_memcpy.c -+++ b/arch/arm/lib/uaccess_with_memcpy.c -@@ -22,6 +22,14 @@ - #include - #include - -+#ifndef COPY_FROM_USER_THRESHOLD -+#define COPY_FROM_USER_THRESHOLD 64 -+#endif -+ -+#ifndef COPY_TO_USER_THRESHOLD -+#define COPY_TO_USER_THRESHOLD 64 -+#endif -+ - static int - pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - { -@@ -84,7 +92,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) - return 1; - } - --static unsigned long noinline -+static int -+pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) -+{ -+ unsigned long addr = (unsigned long)_addr; -+ pgd_t *pgd; -+ pmd_t *pmd; -+ pte_t *pte; -+ pud_t *pud; -+ spinlock_t *ptl; -+ -+ pgd = pgd_offset(current->mm, addr); -+ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) -+ { -+ return 0; -+ } -+ pud = pud_offset(pgd, addr); -+ if (unlikely(pud_none(*pud) || pud_bad(*pud))) -+ { -+ return 0; -+ } -+ -+ pmd = pmd_offset(pud, addr); -+ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) -+ return 0; -+ -+ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); -+ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { -+ pte_unmap_unlock(pte, ptl); -+ return 0; -+ } -+ -+ *ptep = pte; -+ *ptlp = ptl; -+ -+ return 1; -+} -+ -+unsigned long noinline - __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - { - unsigned long ua_flags; -@@ -137,6 +182,57 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) - return n; - } - -+unsigned long noinline -+__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) -+{ -+ unsigned long ua_flags; -+ int atomic; -+ -+ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { -+ memcpy(to, (const void *)from, n); -+ return 0; -+ } -+ -+ /* the mmap semaphore is taken only if not in an atomic context */ -+ atomic = in_atomic(); -+ -+ if (!atomic) -+ down_read(¤t->mm->mmap_sem); -+ while (n) { -+ pte_t *pte; -+ spinlock_t *ptl; -+ int tocopy; -+ -+ while (!pin_page_for_read(from, &pte, &ptl)) { -+ char temp; -+ if (!atomic) -+ up_read(¤t->mm->mmap_sem); -+ if (__get_user(temp, (char __user *)from)) -+ goto out; -+ if (!atomic) -+ down_read(¤t->mm->mmap_sem); -+ } -+ -+ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; -+ if (tocopy > n) -+ tocopy = n; -+ -+ ua_flags = uaccess_save_and_enable(); -+ memcpy(to, (const void *)from, tocopy); -+ uaccess_restore(ua_flags); -+ to += tocopy; -+ from += tocopy; -+ n -= tocopy; -+ -+ pte_unmap_unlock(pte, ptl); -+ } -+ if (!atomic) -+ up_read(¤t->mm->mmap_sem); -+ -+out: -+ return n; -+} -+ - unsigned long - arm_copy_to_user(void __user *to, const void *from, unsigned long n) - { -@@ -147,7 +243,7 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - * With frame pointer disabled, tail call optimization kicks in - * as well making this test almost invisible. - */ -- if (n < 64) { -+ if (n < COPY_TO_USER_THRESHOLD) { - unsigned long ua_flags = uaccess_save_and_enable(); - n = __copy_to_user_std(to, from, n); - uaccess_restore(ua_flags); -@@ -156,6 +252,26 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) - } - return n; - } -+ -+unsigned long __must_check -+arm_copy_from_user(void *to, const void __user *from, unsigned long n) -+{ -+ /* -+ * This test is stubbed out of the main function above to keep -+ * the overhead for small copies low by avoiding a large -+ * register dump on the stack just to reload them right away. -+ * With frame pointer disabled, tail call optimization kicks in -+ * as well making this test almost invisible. -+ */ -+ if (n < COPY_TO_USER_THRESHOLD) { -+ unsigned long ua_flags = uaccess_save_and_enable(); -+ n = __copy_from_user_std(to, from, n); -+ uaccess_restore(ua_flags); -+ } else { -+ n = __copy_from_user_memcpy(to, from, n); -+ } -+ return n; -+} - - static unsigned long noinline - __clear_user_memset(void __user *addr, unsigned long n) -diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 333dc3c2e5ffbb2c5ab8fcfb6115b6162643cf20..46b787a6474ffa857da9b663948863ecfb46e862 100644 ---- a/arch/arm/mach-bcm/Kconfig -+++ b/arch/arm/mach-bcm/Kconfig -@@ -174,6 +174,13 @@ config ARCH_BCM_53573 - The base chip is BCM53573 and there are some packaging modifications - like BCM47189 and BCM47452. - -+config BCM2835_FAST_MEMCPY -+ bool "Enable optimized __copy_to_user and __copy_from_user" -+ depends on ARCH_BCM2835 && ARCH_MULTI_V6 -+ default y -+ help -+ Optimized versions of __copy_to_user and __copy_from_user for Pi1. -+ - config ARCH_BCM_63XX - bool "Broadcom BCM63xx DSL SoC" - depends on ARCH_MULTI_V7 - -From d5dc9d3eb0f7177be235596e3009f8b53b4e25b5 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 063/122] gpio-poweroff: Allow it to work on Raspberry Pi - -The Raspberry Pi firmware manages the power-down and reboot -process. To do this it installs a pm_power_off handler, causing -the gpio-poweroff module to abort the probe function. - -This patch introduces a "force" DT property that overrides that -behaviour, and also adds a DT overlay to enable and control it. - -Note that running in an active-low configuration (DT parameter -"active_low") requires a custom dt-blob.bin and probably won't -allow a reboot without switching off, so an external inversion -of the trigger signal may be preferable. ---- - drivers/power/reset/gpio-poweroff.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c -index be3d81ff51cc3f510d85e4eed7a52960e51e7bc1..a030ae9fb1fca325061c093696e821869eedd320 100644 ---- a/drivers/power/reset/gpio-poweroff.c -+++ b/drivers/power/reset/gpio-poweroff.c -@@ -49,9 +49,11 @@ static int gpio_poweroff_probe(struct platform_device *pdev) - { - bool input = false; - enum gpiod_flags flags; -+ bool force = false; - - /* If a pm_power_off function has already been added, leave it alone */ -- if (pm_power_off != NULL) { -+ force = of_property_read_bool(pdev->dev.of_node, "force"); -+ if (!force && (pm_power_off != NULL)) { - dev_err(&pdev->dev, - "%s: pm_power_off function already registered", - __func__); - -From 78515e0aa6204095c519dce39d811d796cb9dc18 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 064/122] mfd: Add Raspberry Pi Sense HAT core driver - ---- - drivers/input/joystick/Kconfig | 8 + - drivers/input/joystick/Makefile | 1 + - drivers/input/joystick/rpisense-js.c | 153 ++++++++++++++++ - drivers/mfd/Kconfig | 8 + - drivers/mfd/Makefile | 1 + - drivers/mfd/rpisense-core.c | 157 +++++++++++++++++ - drivers/video/fbdev/Kconfig | 13 ++ - drivers/video/fbdev/Makefile | 1 + - drivers/video/fbdev/rpisense-fb.c | 293 +++++++++++++++++++++++++++++++ - include/linux/mfd/rpisense/core.h | 47 +++++ - include/linux/mfd/rpisense/framebuffer.h | 32 ++++ - include/linux/mfd/rpisense/joystick.h | 35 ++++ - 12 files changed, 749 insertions(+) - create mode 100644 drivers/input/joystick/rpisense-js.c - create mode 100644 drivers/mfd/rpisense-core.c - create mode 100644 drivers/video/fbdev/rpisense-fb.c - create mode 100644 include/linux/mfd/rpisense/core.h - create mode 100644 include/linux/mfd/rpisense/framebuffer.h - create mode 100644 include/linux/mfd/rpisense/joystick.h - -diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig -index 4215b5382092c15d693e62de6e029626e9fa551d..4364d7c85543b4537c839df95cf5b524948a06c2 100644 ---- a/drivers/input/joystick/Kconfig -+++ b/drivers/input/joystick/Kconfig -@@ -330,4 +330,12 @@ config JOYSTICK_MAPLE - To compile this as a module choose M here: the module will be called - maplecontrol. - -+config JOYSTICK_RPISENSE -+ tristate "Raspberry Pi Sense HAT joystick" -+ depends on GPIOLIB && INPUT -+ select MFD_RPISENSE_CORE -+ -+ help -+ This is the joystick driver for the Raspberry Pi Sense HAT -+ - endif -diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile -index 92dc0de9dfeda43171a901f96c40bebe0e7a5ae2..1758160374938dd150b8a380797b6decc00a64aa 100644 ---- a/drivers/input/joystick/Makefile -+++ b/drivers/input/joystick/Makefile -@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o - obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o - obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o - obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o -+obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o - -diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c -new file mode 100644 -index 0000000000000000000000000000000000000000..6a416769065d2198344792eb02d8e38da1d03fd4 ---- /dev/null -+++ b/drivers/input/joystick/rpisense-js.c -@@ -0,0 +1,153 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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 -+ -+static struct rpisense *rpisense; -+static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; -+ -+static void keys_work_fn(struct work_struct *work) -+{ -+ int i; -+ static s32 prev_keys; -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); -+ s32 changes = keys ^ prev_keys; -+ -+ prev_keys = keys; -+ for (i = 0; i < 5; i++) { -+ if (changes & 1) { -+ input_report_key(rpisense_js->keys_dev, -+ keymap[i], keys & 1); -+ } -+ changes >>= 1; -+ keys >>= 1; -+ } -+ input_sync(rpisense_js->keys_dev); -+} -+ -+static irqreturn_t keys_irq_handler(int irq, void *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ schedule_work(&rpisense_js->keys_work_s); -+ return IRQ_HANDLED; -+} -+ -+static int rpisense_js_probe(struct platform_device *pdev) -+{ -+ int ret; -+ int i; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_js = &rpisense->joystick; -+ -+ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); -+ -+ rpisense_js->keys_dev = input_allocate_device(); -+ if (!rpisense_js->keys_dev) { -+ dev_err(&pdev->dev, "Could not allocate input device.\n"); -+ return -ENOMEM; -+ } -+ -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); -+ for (i = 0; i < ARRAY_SIZE(keymap); i++) { -+ set_bit(keymap[i], -+ rpisense_js->keys_dev->keybit); -+ } -+ -+ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; -+ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; -+ rpisense_js->keys_dev->id.bustype = BUS_I2C; -+ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); -+ rpisense_js->keys_dev->keycode = keymap; -+ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); -+ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); -+ -+ ret = input_register_device(rpisense_js->keys_dev); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not register input device.\n"); -+ goto err_keys_alloc; -+ } -+ -+ ret = gpiod_direction_input(rpisense_js->keys_desc); -+ if (ret) { -+ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); -+ goto err_keys_reg; -+ } -+ -+ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); -+ if (rpisense_js->keys_irq < 0) { -+ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); -+ ret = rpisense_js->keys_irq; -+ goto err_keys_reg; -+ } -+ -+ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, -+ keys_irq_handler, IRQF_TRIGGER_RISING, -+ "keys", &pdev->dev); -+ if (ret) { -+ dev_err(&pdev->dev, "IRQ request failed.\n"); -+ goto err_keys_reg; -+ } -+ return 0; -+err_keys_reg: -+ input_unregister_device(rpisense_js->keys_dev); -+err_keys_alloc: -+ input_free_device(rpisense_js->keys_dev); -+ return ret; -+} -+ -+static int rpisense_js_remove(struct platform_device *pdev) -+{ -+ struct rpisense_js *rpisense_js = &rpisense->joystick; -+ -+ input_unregister_device(rpisense_js->keys_dev); -+ input_free_device(rpisense_js->keys_dev); -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_js_id[] = { -+ { .compatible = "rpi,rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_js_id); -+#endif -+ -+static struct platform_device_id rpisense_js_device_id[] = { -+ { .name = "rpi-sense-js" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); -+ -+static struct platform_driver rpisense_js_driver = { -+ .probe = rpisense_js_probe, -+ .remove = rpisense_js_remove, -+ .driver = { -+ .name = "rpi-sense-js", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_js_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); -+MODULE_AUTHOR("Serge Schneider "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig -index c6df6442ba2b1b378386db03cb530fa6b6e3e723..b220064bd5feba3f9bb5ec198bcf8e5c4b930533 100644 ---- a/drivers/mfd/Kconfig -+++ b/drivers/mfd/Kconfig -@@ -10,6 +10,14 @@ config MFD_CORE - select IRQ_DOMAIN - default n - -+config MFD_RPISENSE_CORE -+ tristate "Raspberry Pi Sense HAT core functions" -+ depends on I2C -+ select MFD_CORE -+ help -+ This is the core driver for the Raspberry Pi Sense HAT. This provides -+ the necessary functions to communicate with the hardware. -+ - config MFD_CS5535 - tristate "AMD CS5535 and CS5536 southbridge core functions" - select MFD_CORE -diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile -index 9834e669d98573ce8c0b0a15b3f167dbf3485d87..1d8d58fe173c27bdf00daa646f4970e3aeb3ac08 100644 ---- a/drivers/mfd/Makefile -+++ b/drivers/mfd/Makefile -@@ -211,3 +211,4 @@ obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o - obj-$(CONFIG_MFD_MT6397) += mt6397-core.o - - obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o -+obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o -diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c -new file mode 100644 -index 0000000000000000000000000000000000000000..eea9312dc96a496ce846b0c5a83e6e4f3be5ee1e ---- /dev/null -+++ b/drivers/mfd/rpisense-core.c -@@ -0,0 +1,157 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ * This driver is based on wm8350 implementation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static struct rpisense *rpisense; -+ -+static void rpisense_client_dev_register(struct rpisense *rpisense, -+ const char *name, -+ struct platform_device **pdev) -+{ -+ int ret; -+ -+ *pdev = platform_device_alloc(name, -1); -+ if (*pdev == NULL) { -+ dev_err(rpisense->dev, "Failed to allocate %s\n", name); -+ return; -+ } -+ -+ (*pdev)->dev.parent = rpisense->dev; -+ platform_set_drvdata(*pdev, rpisense); -+ ret = platform_device_add(*pdev); -+ if (ret != 0) { -+ dev_err(rpisense->dev, "Failed to register %s: %d\n", -+ name, ret); -+ platform_device_put(*pdev); -+ *pdev = NULL; -+ } -+} -+ -+static int rpisense_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ struct rpisense_js *rpisense_js; -+ -+ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); -+ if (rpisense == NULL) -+ return -ENOMEM; -+ -+ i2c_set_clientdata(i2c, rpisense); -+ rpisense->dev = &i2c->dev; -+ rpisense->i2c_client = i2c; -+ -+ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); -+ if (ret > 0) { -+ if (ret != 's') -+ return -EINVAL; -+ } else { -+ return ret; -+ } -+ ret = rpisense_reg_read(rpisense, RPISENSE_VER); -+ if (ret < 0) -+ return ret; -+ -+ dev_info(rpisense->dev, -+ "Raspberry Pi Sense HAT firmware version %i\n", ret); -+ -+ rpisense_js = &rpisense->joystick; -+ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, -+ "keys-int", GPIOD_IN); -+ if (IS_ERR(rpisense_js->keys_desc)) { -+ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); -+ rpisense_js->keys_desc = gpio_to_desc(23); -+ if (rpisense_js->keys_desc == NULL) { -+ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); -+ return PTR_ERR(rpisense_js->keys_desc); -+ } -+ } -+ rpisense_client_dev_register(rpisense, "rpi-sense-js", -+ &(rpisense->joystick.pdev)); -+ rpisense_client_dev_register(rpisense, "rpi-sense-fb", -+ &(rpisense->framebuffer.pdev)); -+ -+ return 0; -+} -+ -+static int rpisense_remove(struct i2c_client *i2c) -+{ -+ struct rpisense *rpisense = i2c_get_clientdata(i2c); -+ -+ platform_device_unregister(rpisense->joystick.pdev); -+ return 0; -+} -+ -+struct rpisense *rpisense_get_dev(void) -+{ -+ return rpisense; -+} -+EXPORT_SYMBOL_GPL(rpisense_get_dev); -+ -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg) -+{ -+ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); -+ /* Due to the BCM270x I2C clock stretching bug, some values -+ * may have MSB set. Clear it to avoid incorrect values. -+ * */ -+ return ret & 0x7F; -+} -+EXPORT_SYMBOL_GPL(rpisense_reg_read); -+ -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) -+{ -+ int ret = i2c_master_send(rpisense->i2c_client, buf, count); -+ -+ if (ret < 0) -+ dev_err(rpisense->dev, "Block write failed\n"); -+ return ret; -+} -+EXPORT_SYMBOL_GPL(rpisense_block_write); -+ -+static const struct i2c_device_id rpisense_i2c_id[] = { -+ { "rpi-sense", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); -+ -+ -+static struct i2c_driver rpisense_driver = { -+ .driver = { -+ .name = "rpi-sense", -+ .owner = THIS_MODULE, -+ }, -+ .probe = rpisense_probe, -+ .remove = rpisense_remove, -+ .id_table = rpisense_i2c_id, -+}; -+ -+module_i2c_driver(rpisense_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); -+MODULE_AUTHOR("Serge Schneider "); -+MODULE_LICENSE("GPL"); -+ -diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig -index 0ff4f80531e013f028ca4d05559c5464f8cfa5ef..2cd45bce38120d076d6a19804443557862978d4b 100644 ---- a/drivers/video/fbdev/Kconfig -+++ b/drivers/video/fbdev/Kconfig -@@ -2504,3 +2504,16 @@ config FB_SM712 - This driver is also available as a module. The module will be - called sm712fb. If you want to compile it as a module, say M - here and read . -+ -+config FB_RPISENSE -+ tristate "Raspberry Pi Sense HAT framebuffer" -+ depends on FB -+ select MFD_RPISENSE_CORE -+ select FB_SYS_FOPS -+ select FB_SYS_FILLRECT -+ select FB_SYS_COPYAREA -+ select FB_SYS_IMAGEBLIT -+ select FB_DEFERRED_IO -+ -+ help -+ This is the framebuffer driver for the Raspberry Pi Sense HAT -diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile -index 8cd1193b98690b9c4f49098ab14389504d65af3a..c9f1754bf2a6796bf5555fabb9e80f8991cb83bc 100644 ---- a/drivers/video/fbdev/Makefile -+++ b/drivers/video/fbdev/Makefile -@@ -147,6 +147,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o - obj-$(CONFIG_FB_MXS) += mxsfb.o - obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o - obj-$(CONFIG_FB_SIMPLE) += simplefb.o -+obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o - - # the test framebuffer is last - obj-$(CONFIG_FB_VIRTUAL) += vfb.o -diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c -new file mode 100644 -index 0000000000000000000000000000000000000000..26432a5a0b4b4a5198768eceb1e34da99fe1efb2 ---- /dev/null -+++ b/drivers/video/fbdev/rpisense-fb.c -@@ -0,0 +1,293 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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 -+ -+static bool lowlight; -+module_param(lowlight, bool, 0); -+MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); -+ -+static struct rpisense *rpisense; -+ -+struct rpisense_fb_param { -+ char __iomem *vmem; -+ u8 *vmem_work; -+ u32 vmemsize; -+ u8 *gamma; -+}; -+ -+static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -+ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, -+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, -+ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}; -+ -+static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, -+ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, -+ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,}; -+ -+static u8 gamma_user[32]; -+ -+static struct rpisense_fb_param rpisense_fb_param = { -+ .vmem = NULL, -+ .vmemsize = 128, -+ .gamma = gamma_default, -+}; -+ -+static struct fb_deferred_io rpisense_fb_defio; -+ -+static struct fb_fix_screeninfo rpisense_fb_fix = { -+ .id = "RPi-Sense FB", -+ .type = FB_TYPE_PACKED_PIXELS, -+ .visual = FB_VISUAL_TRUECOLOR, -+ .xpanstep = 0, -+ .ypanstep = 0, -+ .ywrapstep = 0, -+ .accel = FB_ACCEL_NONE, -+ .line_length = 16, -+}; -+ -+static struct fb_var_screeninfo rpisense_fb_var = { -+ .xres = 8, -+ .yres = 8, -+ .xres_virtual = 8, -+ .yres_virtual = 8, -+ .bits_per_pixel = 16, -+ .red = {11, 5, 0}, -+ .green = {5, 6, 0}, -+ .blue = {0, 5, 0}, -+}; -+ -+static ssize_t rpisense_fb_write(struct fb_info *info, -+ const char __user *buf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t res = fb_sys_write(info, buf, count, ppos); -+ -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return res; -+} -+ -+static void rpisense_fb_fillrect(struct fb_info *info, -+ const struct fb_fillrect *rect) -+{ -+ sys_fillrect(info, rect); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_copyarea(struct fb_info *info, -+ const struct fb_copyarea *area) -+{ -+ sys_copyarea(info, area); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_imageblit(struct fb_info *info, -+ const struct fb_image *image) -+{ -+ sys_imageblit(info, image); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+} -+ -+static void rpisense_fb_deferred_io(struct fb_info *info, -+ struct list_head *pagelist) -+{ -+ int i; -+ int j; -+ u8 *vmem_work = rpisense_fb_param.vmem_work; -+ u16 *mem = (u16 *)rpisense_fb_param.vmem; -+ u8 *gamma = rpisense_fb_param.gamma; -+ -+ vmem_work[0] = 0; -+ for (j = 0; j < 8; j++) { -+ for (i = 0; i < 8; i++) { -+ vmem_work[(j * 24) + i + 1] = -+ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; -+ vmem_work[(j * 24) + (i + 8) + 1] = -+ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; -+ vmem_work[(j * 24) + (i + 16) + 1] = -+ gamma[(mem[(j * 8) + i]) & 0x1F]; -+ } -+ } -+ rpisense_block_write(rpisense, vmem_work, 193); -+} -+ -+static struct fb_deferred_io rpisense_fb_defio = { -+ .delay = HZ/100, -+ .deferred_io = rpisense_fb_deferred_io, -+}; -+ -+static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd, -+ unsigned long arg) -+{ -+ switch (cmd) { -+ case SENSEFB_FBIOGET_GAMMA: -+ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ return 0; -+ case SENSEFB_FBIOSET_GAMMA: -+ if (copy_from_user(gamma_user, (void __user *)arg, -+ sizeof(u8[32]))) -+ return -EFAULT; -+ rpisense_fb_param.gamma = gamma_user; -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ return 0; -+ case SENSEFB_FBIORESET_GAMMA: -+ switch (arg) { -+ case 0: -+ rpisense_fb_param.gamma = gamma_default; -+ break; -+ case 1: -+ rpisense_fb_param.gamma = gamma_low; -+ break; -+ case 2: -+ rpisense_fb_param.gamma = gamma_user; -+ break; -+ default: -+ return -EINVAL; -+ } -+ schedule_delayed_work(&info->deferred_work, -+ rpisense_fb_defio.delay); -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static struct fb_ops rpisense_fb_ops = { -+ .owner = THIS_MODULE, -+ .fb_read = fb_sys_read, -+ .fb_write = rpisense_fb_write, -+ .fb_fillrect = rpisense_fb_fillrect, -+ .fb_copyarea = rpisense_fb_copyarea, -+ .fb_imageblit = rpisense_fb_imageblit, -+ .fb_ioctl = rpisense_fb_ioctl, -+}; -+ -+static int rpisense_fb_probe(struct platform_device *pdev) -+{ -+ struct fb_info *info; -+ int ret = -ENOMEM; -+ struct rpisense_fb *rpisense_fb; -+ -+ rpisense = rpisense_get_dev(); -+ rpisense_fb = &rpisense->framebuffer; -+ -+ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); -+ if (!rpisense_fb_param.vmem) -+ return ret; -+ -+ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); -+ if (!rpisense_fb_param.vmem_work) -+ goto err_malloc; -+ -+ info = framebuffer_alloc(0, &pdev->dev); -+ if (!info) { -+ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); -+ goto err_malloc; -+ } -+ rpisense_fb->info = info; -+ -+ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; -+ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; -+ -+ info->fbops = &rpisense_fb_ops; -+ info->fix = rpisense_fb_fix; -+ info->var = rpisense_fb_var; -+ info->fbdefio = &rpisense_fb_defio; -+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; -+ info->screen_base = rpisense_fb_param.vmem; -+ info->screen_size = rpisense_fb_param.vmemsize; -+ -+ if (lowlight) -+ rpisense_fb_param.gamma = gamma_low; -+ -+ fb_deferred_io_init(info); -+ -+ ret = register_framebuffer(info); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "Could not register framebuffer.\n"); -+ goto err_fballoc; -+ } -+ -+ fb_info(info, "%s frame buffer device\n", info->fix.id); -+ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); -+ return 0; -+err_fballoc: -+ framebuffer_release(info); -+err_malloc: -+ vfree(rpisense_fb_param.vmem); -+ return ret; -+} -+ -+static int rpisense_fb_remove(struct platform_device *pdev) -+{ -+ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; -+ struct fb_info *info = rpisense_fb->info; -+ -+ if (info) { -+ unregister_framebuffer(info); -+ fb_deferred_io_cleanup(info); -+ framebuffer_release(info); -+ vfree(rpisense_fb_param.vmem); -+ } -+ -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static const struct of_device_id rpisense_fb_id[] = { -+ { .compatible = "rpi,rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, rpisense_fb_id); -+#endif -+ -+static struct platform_device_id rpisense_fb_device_id[] = { -+ { .name = "rpi-sense-fb" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); -+ -+static struct platform_driver rpisense_fb_driver = { -+ .probe = rpisense_fb_probe, -+ .remove = rpisense_fb_remove, -+ .driver = { -+ .name = "rpi-sense-fb", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(rpisense_fb_driver); -+ -+MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); -+MODULE_AUTHOR("Serge Schneider "); -+MODULE_LICENSE("GPL"); -+ -diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4856aa3c8b0661647ec1b5466d3a8743c02b1ddb ---- /dev/null -+++ b/include/linux/mfd/rpisense/core.h -@@ -0,0 +1,47 @@ -+/* -+ * Raspberry Pi Sense HAT core driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __LINUX_MFD_RPISENSE_CORE_H_ -+#define __LINUX_MFD_RPISENSE_CORE_H_ -+ -+#include -+#include -+ -+/* -+ * Register values. -+ */ -+#define RPISENSE_FB 0x00 -+#define RPISENSE_WAI 0xF0 -+#define RPISENSE_VER 0xF1 -+#define RPISENSE_KEYS 0xF2 -+#define RPISENSE_EE_WP 0xF3 -+ -+#define RPISENSE_ID 's' -+ -+struct rpisense { -+ struct device *dev; -+ struct i2c_client *i2c_client; -+ -+ /* Client devices */ -+ struct rpisense_js joystick; -+ struct rpisense_fb framebuffer; -+}; -+ -+struct rpisense *rpisense_get_dev(void); -+s32 rpisense_reg_read(struct rpisense *rpisense, int reg); -+int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); -+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); -+ -+#endif -diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h -new file mode 100644 -index 0000000000000000000000000000000000000000..2ba95d7eebaf9ccce910b43835286df94cb7d075 ---- /dev/null -+++ b/include/linux/mfd/rpisense/framebuffer.h -@@ -0,0 +1,32 @@ -+/* -+ * Raspberry Pi Sense HAT framebuffer driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_FB_H_ -+#define __LINUX_RPISENSE_FB_H_ -+ -+#define SENSEFB_FBIO_IOC_MAGIC 0xF1 -+ -+#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) -+#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) -+#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) -+ -+struct rpisense; -+ -+struct rpisense_fb { -+ struct platform_device *pdev; -+ struct fb_info *info; -+}; -+ -+#endif -diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h -new file mode 100644 -index 0000000000000000000000000000000000000000..56196dc2af10e464a1e3f98b028dca1c9c9cff39 ---- /dev/null -+++ b/include/linux/mfd/rpisense/joystick.h -@@ -0,0 +1,35 @@ -+/* -+ * Raspberry Pi Sense HAT joystick driver -+ * http://raspberrypi.org -+ * -+ * Copyright (C) 2015 Raspberry Pi -+ * -+ * Author: Serge Schneider -+ * -+ * 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. -+ * -+ */ -+ -+#ifndef __LINUX_RPISENSE_JOYSTICK_H_ -+#define __LINUX_RPISENSE_JOYSTICK_H_ -+ -+#include -+#include -+#include -+#include -+ -+struct rpisense; -+ -+struct rpisense_js { -+ struct platform_device *pdev; -+ struct input_dev *keys_dev; -+ struct gpio_desc *keys_desc; -+ struct work_struct keys_work_s; -+ int keys_irq; -+}; -+ -+ -+#endif - -From 92261bb1ae13c929b053aab7db4cc660d4565511 Mon Sep 17 00:00:00 2001 -From: Florian Meier -Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 065/122] ASoC: Add support for HifiBerry DAC - -This adds a machine driver for the HifiBerry DAC. -It is a sound card that can -be stacked onto the Raspberry Pi. - -Signed-off-by: Florian Meier ---- - sound/soc/bcm/Kconfig | 9 ++- - sound/soc/bcm/Makefile | 4 ++ - sound/soc/bcm/hifiberry_dac.c | 124 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 136 insertions(+), 1 deletion(-) - create mode 100644 sound/soc/bcm/hifiberry_dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index d528aaceaad95bc6bae2147ebe66249629d2512e..ad4817f44072bbc0a92d8a5ebd1b6b365fb4ed82 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -15,4 +15,11 @@ config SND_SOC_CYGNUS - Say Y if you want to add support for ASoC audio on Broadcom - Cygnus chips (bcm958300, bcm958305, bcm911360) - -- If you don't know what to do here, say N. -\ No newline at end of file -+ If you don't know what to do here, say N. -+ -+config SND_BCM2708_SOC_HIFIBERRY_DAC -+ tristate "Support for HifiBerry DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM5102A -+ help -+ Say Y or M if you want to add support for HifiBerry DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index fc739d0078842680802389500dea19334da8fb7b..be80079de3cefbd52f4b78db20ee9a5d554b04c6 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -8,3 +8,7 @@ snd-soc-cygnus-objs := cygnus-pcm.o cygnus-ssp.o - - obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - -+# BCM2708 Machine Support -+snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+ -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..45f2b770ad9e67728ca599a7445d6ae9a01c0c29 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_dac.c -@@ -0,0 +1,124 @@ -+/* -+ * ASoC Driver for HifiBerry DAC -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_hifiberry_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dac_ops = { -+ .hw_params = snd_rpi_hifiberry_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { -+{ -+ .name = "HifiBerry DAC", -+ .stream_name = "HifiBerry DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm5102a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm5102a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dac_ops, -+ .init = snd_rpi_hifiberry_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dac = { -+ .name = "snd_rpi_hifiberry_dac", -+ .driver_name = "HifiberryDac", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), -+}; -+ -+static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); -+} -+ -+static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); -+ -+static struct platform_driver snd_rpi_hifiberry_dac_driver = { -+ .driver = { -+ .name = "snd-hifiberry-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dac_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dac_probe, -+ .remove = snd_rpi_hifiberry_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_hifiberry_dac_driver); -+ -+MODULE_AUTHOR("Florian Meier "); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); -+MODULE_LICENSE("GPL v2"); - -From b6df383dd105286109669674cf79c61b5f88bba9 Mon Sep 17 00:00:00 2001 -From: Florian Meier -Date: Mon, 25 Jan 2016 15:48:59 +0000 -Subject: [PATCH 066/122] ASoC: Add support for Rpi-DAC - ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-dac.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/Kconfig | 5 ++ - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++ - 6 files changed, 204 insertions(+) - create mode 100644 sound/soc/bcm/rpi-dac.c - create mode 100644 sound/soc/codecs/pcm1794a.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index ad4817f44072bbc0a92d8a5ebd1b6b365fb4ed82..8209fffdc0be3136a99cbab4e5152759aa95594b 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -23,3 +23,10 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - select SND_SOC_PCM5102A - help - Say Y or M if you want to add support for HifiBerry DAC. -+ -+config SND_BCM2708_SOC_RPI_DAC -+ tristate "Support for RPi-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM1794A -+ help -+ Say Y or M if you want to add support for RPi-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index be80079de3cefbd52f4b78db20ee9a5d554b04c6..09501910f8152b8d516e098433339b5fc2640d0f 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,5 +10,7 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..59dc89ecabc082c0a1ed8adacdc4f0f1337a1c73 ---- /dev/null -+++ b/sound/soc/bcm/rpi-dac.c -@@ -0,0 +1,119 @@ -+/* -+ * ASoC Driver for RPi-DAC. -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_rpi_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return 0; -+} -+ -+static int snd_rpi_rpi_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_rpi_dac_ops = { -+ .hw_params = snd_rpi_rpi_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { -+{ -+ .name = "RPi-DAC", -+ .stream_name = "RPi-DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm1794a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm1794a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_rpi_dac_ops, -+ .init = snd_rpi_rpi_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_rpi_dac = { -+ .name = "snd_rpi_rpi_dac", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_rpi_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), -+}; -+ -+static int snd_rpi_rpi_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_rpi_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_rpi_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_rpi_dac); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_rpi_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_rpi_dac); -+} -+ -+static const struct of_device_id snd_rpi_rpi_dac_of_match[] = { -+ { .compatible = "rpi,rpi-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match); -+ -+static struct platform_driver snd_rpi_rpi_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_rpi_dac_of_match, -+ }, -+ .probe = snd_rpi_rpi_dac_probe, -+ .remove = snd_rpi_rpi_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_rpi_dac_driver); -+ -+MODULE_AUTHOR("Florian Meier "); -+MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index c67667bb970f1729db65b027dd8e963b9ee95b7b..74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -98,6 +98,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_PCM1681 if I2C - select SND_SOC_PCM179X_I2C if I2C - select SND_SOC_PCM179X_SPI if SPI_MASTER -+ select SND_SOC_PCM1794A if I2C - select SND_SOC_PCM3008 - select SND_SOC_PCM3168A_I2C if I2C - select SND_SOC_PCM3168A_SPI if SPI_MASTER -@@ -689,6 +690,10 @@ config SND_SOC_RT5616 - tristate "Realtek RT5616 CODEC" - depends on I2C - -+config SND_SOC_PCM1794A -+ tristate -+ depends on I2C -+ - config SND_SOC_RT5631 - tristate "Realtek ALC5631/RT5631 CODEC" - depends on I2C -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 958cd4912fbc9820f965c0d2f38692857f410d3a..77786e7f44a7fa22d9b5beed3eb687e2b7a28526 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -93,6 +93,7 @@ snd-soc-pcm1681-objs := pcm1681.o - snd-soc-pcm179x-codec-objs := pcm179x.o - snd-soc-pcm179x-i2c-objs := pcm179x-i2c.o - snd-soc-pcm179x-spi-objs := pcm179x-spi.o -+snd-soc-pcm1794a-objs := pcm1794a.o - snd-soc-pcm3008-objs := pcm3008.o - snd-soc-pcm3168a-objs := pcm3168a.o - snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o -@@ -325,6 +326,7 @@ obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o - 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_PCM1794A) += snd-soc-pcm1794a.o - obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o - obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o - obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o -diff --git a/sound/soc/codecs/pcm1794a.c b/sound/soc/codecs/pcm1794a.c -new file mode 100644 -index 0000000000000000000000000000000000000000..afe1b419582aa40c4b2729d242bb13cd843e17f4 ---- /dev/null -+++ b/sound/soc/codecs/pcm1794a.c -@@ -0,0 +1,69 @@ -+/* -+ * Driver for the PCM1794A codec -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+ -+#include -+#include -+#include -+ -+#include -+ -+static struct snd_soc_dai_driver pcm1794a_dai = { -+ .name = "pcm1794a-hifi", -+ .playback = { -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_192000, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE -+ }, -+}; -+ -+static struct snd_soc_codec_driver soc_codec_dev_pcm1794a; -+ -+static int pcm1794a_probe(struct platform_device *pdev) -+{ -+ return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm1794a, -+ &pcm1794a_dai, 1); -+} -+ -+static int pcm1794a_remove(struct platform_device *pdev) -+{ -+ snd_soc_unregister_codec(&pdev->dev); -+ return 0; -+} -+ -+static const struct of_device_id pcm1794a_of_match[] = { -+ { .compatible = "ti,pcm1794a", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, pcm1794a_of_match); -+ -+static struct platform_driver pcm1794a_codec_driver = { -+ .probe = pcm1794a_probe, -+ .remove = pcm1794a_remove, -+ .driver = { -+ .name = "pcm1794a-codec", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(pcm1794a_of_match), -+ }, -+}; -+ -+module_platform_driver(pcm1794a_codec_driver); -+ -+MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); -+MODULE_AUTHOR("Florian Meier "); -+MODULE_LICENSE("GPL v2"); - -From 32447fa52c6b39d4447c53b0a7ae8a2096ee901e Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 067/122] ASoC: wm8804: Implement MCLK configuration options, - add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs - for most sample rates. At 192kHz only 128xfs is supported. The existing - driver selects 128xfs automatically for some lower samples rates. By using an - additional mclk_div divider, it is now possible to control the behaviour. - This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It - should allow lower jitter and better signal quality. The behavior has to be - controlled by the sound card driver, because some sample frequency share the - same setting. e.g. 192kHz and 96kHz use 24.576MHz master clock. The only - difference is the MCLK divider. - -This also added support for 32bit data. - -Signed-off-by: Daniel Matuschek ---- - sound/soc/codecs/wm8804.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c -index af95d648265b3e92e345101542b332aee35191d4..513f56ba132929662802d15cdc653af3d059a39c 100644 ---- a/sound/soc/codecs/wm8804.c -+++ b/sound/soc/codecs/wm8804.c -@@ -304,6 +304,7 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, - blen = 0x1; - break; - case 24: -+ case 32: - blen = 0x2; - break; - default: -@@ -515,7 +516,7 @@ static const struct snd_soc_dai_ops wm8804_dai_ops = { - }; - - #define WM8804_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ -- SNDRV_PCM_FMTBIT_S24_LE) -+ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) - - #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -@@ -543,7 +544,7 @@ static struct snd_soc_dai_driver wm8804_dai = { - }; - - static const struct snd_soc_codec_driver soc_codec_dev_wm8804 = { -- .idle_bias_off = true, -+ .idle_bias_off = false, - - .component_driver = { - .dapm_widgets = wm8804_dapm_widgets, - -From cd919b3554a2544cf2600822593b6057d4297316 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 068/122] ASoC: BCM:Add support for HiFiBerry Digi. Driver is - based on the patched WM8804 driver. - -Signed-off-by: Daniel Matuschek - -Add a parameter to turn off SPDIF output if no audio is playing - -This patch adds the paramater auto_shutdown_output to the kernel module. -Default behaviour of the module is the same, but when auto_shutdown_output -is set to 1, the SPDIF oputput will shutdown if no stream is playing. - -bugfix for 32kHz sample rate, was missing - -HiFiBerry Digi: set SPDIF status bits for sample rate - -The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. -While this is optional, some DACs and receivers do not accept this signal. This patch -adds the sample rate bits in the SPDIF status block. - -Added HiFiBerry Digi+ Pro driver - -Signed-off-by: Daniel Matuschek ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_digi.c | 276 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 285 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8209fffdc0be3136a99cbab4e5152759aa95594b..3cd4288a1e1c535210b01cd9561128fd4ea3e87f 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -24,6 +24,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DIGI -+ tristate "Support for HifiBerry Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. -+ - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 09501910f8152b8d516e098433339b5fc2640d0f..862f00fb43bfb0b8dc75d577df47ea4e8336d00a 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,7 +10,9 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..19dc953b7227ba86123fc7a2ba654499e0c581c5 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_digi.c -@@ -0,0 +1,276 @@ -+/* -+ * ASoC Driver for HifiBerry Digi -+ * -+ * Author: Daniel Matuschek -+ * based on the HifiBerry DAC driver by Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static short int auto_shutdown_output = 0; -+module_param(auto_shutdown_output, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); -+ -+#define CLK_44EN_RATE 22579200UL -+#define CLK_48EN_RATE 24576000UL -+ -+static bool snd_rpi_hifiberry_is_digipro; -+static struct gpio_desc *snd_rpi_hifiberry_clk44gpio; -+static struct gpio_desc *snd_rpi_hifiberry_clk48gpio; -+ -+static int samplerate=44100; -+ -+static uint32_t snd_rpi_hifiberry_digi_enable_clock(int sample_rate) -+{ -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk44gpio, 1); -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk48gpio, 0); -+ return CLK_44EN_RATE; -+ default: -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk48gpio, 1); -+ gpiod_set_value_cansleep(snd_rpi_hifiberry_clk44gpio, 0); -+ return CLK_48EN_RATE; -+ } -+} -+ -+ -+static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Initialize Digi+ Pro hardware */ -+ if (snd_rpi_hifiberry_is_digipro) { -+ struct snd_soc_dai_link *dai = rtd->dai_link; -+ -+ dai->name = "HiFiBerry Digi+ Pro"; -+ dai->stream_name = "HiFiBerry Digi+ Pro HiFi"; -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) { -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} -+ -+static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream) { -+ /* turn off output */ -+ if (auto_shutdown_output) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} -+ -+ -+static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq=0; -+ int mclk_div=1; -+ int sampling_freq=1; -+ -+ int ret; -+ -+ samplerate = params_rate(params); -+ -+ if (samplerate<=96000) { -+ mclk_freq=samplerate*256; -+ mclk_div=WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq=samplerate*128; -+ mclk_div=WM8804_MCLKDIV_128FS; -+ } -+ -+ if (snd_rpi_hifiberry_is_digipro) -+ sysclk = snd_rpi_hifiberry_digi_enable_clock(samplerate); -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_digi_ops = { -+ .hw_params = snd_rpi_hifiberry_digi_hw_params, -+ .startup = snd_rpi_hifiberry_digi_startup, -+ .shutdown = snd_rpi_hifiberry_digi_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { -+{ -+ .name = "HifiBerry Digi", -+ .stream_name = "HifiBerry Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_hifiberry_digi_ops, -+ .init = snd_rpi_hifiberry_digi_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_digi = { -+ .name = "snd_rpi_hifiberry_digi", -+ .driver_name = "HifiberryDigi", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), -+}; -+ -+static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_digi.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ snd_rpi_hifiberry_is_digipro = 1; -+ -+ snd_rpi_hifiberry_clk44gpio = -+ devm_gpiod_get(&pdev->dev, "clock44", GPIOD_OUT_LOW); -+ if (IS_ERR(snd_rpi_hifiberry_clk44gpio)) -+ snd_rpi_hifiberry_is_digipro = 0; -+ -+ snd_rpi_hifiberry_clk48gpio = -+ devm_gpiod_get(&pdev->dev, "clock48", GPIOD_OUT_LOW); -+ if (IS_ERR(snd_rpi_hifiberry_clk48gpio)) -+ snd_rpi_hifiberry_is_digipro = 0; -+ -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); -+} -+ -+static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); -+ -+static struct platform_driver snd_rpi_hifiberry_digi_driver = { -+ .driver = { -+ .name = "snd-hifiberry-digi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_digi_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_digi_probe, -+ .remove = snd_rpi_hifiberry_digi_remove, -+}; -+ -+module_platform_driver(snd_rpi_hifiberry_digi_driver); -+ -+MODULE_AUTHOR("Daniel Matuschek "); -+MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); -+MODULE_LICENSE("GPL v2"); - -From 9c1f52bc905674a484e6b9c5e91fbef279890c68 Mon Sep 17 00:00:00 2001 -From: Gordon Garrity -Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 069/122] Add IQaudIO Sound Card support for Raspberry Pi - -Set a limit of 0dB on Digital Volume Control - -The main volume control in the PCM512x DAC has a range up to -+24dB. This is dangerously loud and can potentially cause massive -clipping in the output stages. Therefore this sets a sensible -limit of 0dB for this control. - -Allow up to 24dB digital gain to be applied when using IQAudIO DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. - -Modify IQAudIO DAC+ ASoC driver to set card/dai config from dt - -Add the ability to set the card name, dai name and dai stream name, from -dt config. - -Signed-off-by: DigitalDreamtime - -IQaudIO: auto-mute for AMP+ and DigiAMP+ - -IQAudIO amplifier mute via GPIO22. Add dt params for "one-shot" unmute -and auto mute. - -Revision 2, auto mute implementing HiassofT suggestion to mute/unmute -using set_bias_level, rather than startup/shutdown.... -"By default DAPM waits 5 seconds (pmdown_time) before shutting down -playback streams so a close/stop immediately followed by open/start -doesn't trigger an amp mute+unmute." - -Tested on both AMP+ (via DAC+) and DigiAMP+, with both options... - -dtoverlay=iqaudio-dacplus,unmute_amp - "one-shot" unmute when kernel module loads. - -dtoverlay=iqaudio-dacplus,auto_mute_amp - Unmute amp when ALSA device opened by a client. Mute, with 5 second delay - when ALSA device closed. (Re-opening the device within the 5 second close - window, will cancel mute.) - -Revision 4, using gpiod. - -Revision 5, clean-up formatting before adding mute code. - - Convert tab plus 4 space formatting to 2x tab - - Remove '// NOT USED' commented code - -Revision 6, don't attempt to "one-shot" unmute amp, unless card is -successfully registered. - -Signed-off-by: DigitalDreamtime ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/iqaudio-dac.c | 234 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 243 insertions(+) - create mode 100644 sound/soc/bcm/iqaudio-dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 3cd4288a1e1c535210b01cd9561128fd4ea3e87f..8272ba5302b1ddbd9c21ee50891d3cb0f0303c58 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -37,3 +37,10 @@ config SND_BCM2708_SOC_RPI_DAC - select SND_SOC_PCM1794A - help - Say Y or M if you want to add support for RPi-DAC. -+ -+config SND_BCM2708_SOC_IQAUDIO_DAC -+ tristate "Support for IQaudIO-DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for IQaudIO-DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 862f00fb43bfb0b8dc75d577df47ea4e8336d00a..fcac518ca9b46ab2074fc859b8d2f1ff850ebc19 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,7 +12,9 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4e8e6dec14bcf4a1ff286c43742d4097249d6777 ---- /dev/null -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -0,0 +1,234 @@ -+/* -+ * ASoC Driver for IQaudIO DAC -+ * -+ * Author: Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static bool digital_gain_0db_limit = true; -+ -+static struct gpio_desc *mute_gpio; -+ -+static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+static void snd_rpi_iqaudio_gpio_mute(struct snd_soc_card *card) -+{ -+ if (mute_gpio) { -+ dev_info(card->dev, "%s: muting amp using GPIO22\n", -+ __func__); -+ gpiod_set_value_cansleep(mute_gpio, 0); -+ } -+} -+ -+static void snd_rpi_iqaudio_gpio_unmute(struct snd_soc_card *card) -+{ -+ if (mute_gpio) { -+ dev_info(card->dev, "%s: un-muting amp using GPIO22\n", -+ __func__); -+ gpiod_set_value_cansleep(mute_gpio, 1); -+ } -+} -+ -+static int snd_rpi_iqaudio_set_bias_level(struct snd_soc_card *card, -+ struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) -+{ -+ struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; -+ -+ if (dapm->dev != codec_dai->dev) -+ return 0; -+ -+ switch (level) { -+ case SND_SOC_BIAS_PREPARE: -+ if (dapm->bias_level != SND_SOC_BIAS_STANDBY) -+ break; -+ -+ /* UNMUTE AMP */ -+ snd_rpi_iqaudio_gpio_unmute(card); -+ -+ break; -+ case SND_SOC_BIAS_STANDBY: -+ if (dapm->bias_level != SND_SOC_BIAS_PREPARE) -+ break; -+ -+ /* MUTE AMP */ -+ snd_rpi_iqaudio_gpio_mute(card); -+ -+ break; -+ default: -+ break; -+ } -+ -+ return 0; -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = { -+ .hw_params = snd_rpi_iqaudio_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { -+{ -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_iqaudio_dac_ops, -+ .init = snd_rpi_iqaudio_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_iqaudio_dac = { -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_iqaudio_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), -+}; -+ -+static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ bool gpio_unmute = false; -+ -+ snd_rpi_iqaudio_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_card *card = &snd_rpi_iqaudio_dac; -+ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; -+ bool auto_gpio_mute = false; -+ -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "iqaudio,24db_digital_gain"); -+ -+ if (of_property_read_string(pdev->dev.of_node, "card_name", -+ &card->name)) -+ card->name = "IQaudIODAC"; -+ -+ if (of_property_read_string(pdev->dev.of_node, "dai_name", -+ &dai->name)) -+ dai->name = "IQaudIO DAC"; -+ -+ if (of_property_read_string(pdev->dev.of_node, -+ "dai_stream_name", &dai->stream_name)) -+ dai->stream_name = "IQaudIO DAC HiFi"; -+ -+ /* gpio_unmute - one time unmute amp using GPIO */ -+ gpio_unmute = of_property_read_bool(pdev->dev.of_node, -+ "iqaudio-dac,unmute-amp"); -+ -+ /* auto_gpio_mute - mute/unmute amp using GPIO */ -+ auto_gpio_mute = of_property_read_bool(pdev->dev.of_node, -+ "iqaudio-dac,auto-mute-amp"); -+ -+ if (auto_gpio_mute || gpio_unmute) { -+ mute_gpio = devm_gpiod_get_optional(&pdev->dev, "mute", -+ GPIOD_OUT_LOW); -+ if (IS_ERR(mute_gpio)) { -+ ret = PTR_ERR(mute_gpio); -+ dev_err(&pdev->dev, -+ "Failed to get mute gpio: %d\n", ret); -+ return ret; -+ } -+ -+ if (auto_gpio_mute && mute_gpio) -+ snd_rpi_iqaudio_dac.set_bias_level = -+ snd_rpi_iqaudio_set_bias_level; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ return ret; -+ } -+ -+ if (gpio_unmute && mute_gpio) -+ snd_rpi_iqaudio_gpio_unmute(&snd_rpi_iqaudio_dac); -+ -+ return 0; -+} -+ -+static int snd_rpi_iqaudio_dac_remove(struct platform_device *pdev) -+{ -+ snd_rpi_iqaudio_gpio_mute(&snd_rpi_iqaudio_dac); -+ -+ return snd_soc_unregister_card(&snd_rpi_iqaudio_dac); -+} -+ -+static const struct of_device_id iqaudio_of_match[] = { -+ { .compatible = "iqaudio,iqaudio-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, iqaudio_of_match); -+ -+static struct platform_driver snd_rpi_iqaudio_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-iqaudio-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = iqaudio_of_match, -+ }, -+ .probe = snd_rpi_iqaudio_dac_probe, -+ .remove = snd_rpi_iqaudio_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_iqaudio_dac_driver); -+ -+MODULE_AUTHOR("Florian Meier "); -+MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); -+MODULE_LICENSE("GPL v2"); - -From fef54ca8d87499607d6cb086210e44126b304f6d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 25 Jul 2016 17:06:50 +0100 -Subject: [PATCH 070/122] iqaudio-dac: Compile fix - untested - ---- - sound/soc/bcm/iqaudio-dac.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c -index 4e8e6dec14bcf4a1ff286c43742d4097249d6777..aa15bc4b49ca95edec905fddd8fd0a6d839ca627 100644 ---- a/sound/soc/bcm/iqaudio-dac.c -+++ b/sound/soc/bcm/iqaudio-dac.c -@@ -76,7 +76,11 @@ static void snd_rpi_iqaudio_gpio_unmute(struct snd_soc_card *card) - static int snd_rpi_iqaudio_set_bias_level(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) - { -- struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; -+ struct snd_soc_pcm_runtime *rtd; -+ struct snd_soc_dai *codec_dai; -+ -+ rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); -+ codec_dai = rtd->codec_dai; - - if (dapm->dev != codec_dai->dev) - return 0; - -From 31bee6011867bb7a1846d35901b080a208669515 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 071/122] Added support for HiFiBerry DAC+ - -The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses -a different codec chip (PCM5122), therefore a new driver is necessary. - -Add support for the HiFiBerry DAC+ Pro. - -The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. - -An addition bug fix is included for the PCM512x codec where by the physical size of the sample frame is used in the calculation of the LRCK divisor as it was found to be wrong when using 24-bit depth sample contained in a little endian 4-byte sample frame. - -Limit PCM512x "Digital" gain to 0dB by default with HiFiBerry DAC+ - -24db_digital_gain DT param can be used to specify that PCM512x -codec "Digital" volume control should not be limited to 0dB gain, -and if specified will allow the full 24dB gain. - -Add dt param to force HiFiBerry DAC+ Pro into slave mode - -"dtoverlay=hifiberry-dacplus,slave" - -Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode, -with Pi as master for bit and frame clock. - -Signed-off-by: DigitalDreamtime ---- - drivers/clk/Makefile | 1 + - drivers/clk/clk-hifiberry-dacpro.c | 160 +++++++++++++++++ - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_dacplus.c | 359 +++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/pcm512x.c | 3 +- - 6 files changed, 531 insertions(+), 1 deletion(-) - create mode 100644 drivers/clk/clk-hifiberry-dacpro.c - create mode 100644 sound/soc/bcm/hifiberry_dacplus.c - -diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile -index 925081ec14c04935e1eb17bf2709640c7ae3ae10..2b6fcd8abf79da77aa85fdc53512aafd09f836cb 100644 ---- a/drivers/clk/Makefile -+++ b/drivers/clk/Makefile -@@ -26,6 +26,7 @@ obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o - obj-$(CONFIG_COMMON_CLK_CS2000_CP) += clk-cs2000-cp.o - obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o - obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += clk-hifiberry-dacpro.o - obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o - obj-$(CONFIG_ARCH_MB86S7X) += clk-mb86s7x.o - obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o -diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c -new file mode 100644 -index 0000000000000000000000000000000000000000..99cee2b1706c43170b4fc35c0023349b9019606c ---- /dev/null -+++ b/drivers/clk/clk-hifiberry-dacpro.c -@@ -0,0 +1,160 @@ -+/* -+ * Clock Driver for HiFiBerry DAC Pro -+ * -+ * Author: Stuart MacLean -+ * Copyright 2015 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL -+ -+/** -+ * struct hifiberry_dacpro_clk - Common struct to the HiFiBerry DAC Pro -+ * @hw: clk_hw for the common clk framework -+ * @mode: 0 => CLK44EN, 1 => CLK48EN -+ */ -+struct clk_hifiberry_hw { -+ struct clk_hw hw; -+ uint8_t mode; -+}; -+ -+#define to_hifiberry_clk(_hw) container_of(_hw, struct clk_hifiberry_hw, hw) -+ -+static const struct of_device_id clk_hifiberry_dacpro_dt_ids[] = { -+ { .compatible = "hifiberry,dacpro-clk",}, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, clk_hifiberry_dacpro_dt_ids); -+ -+static unsigned long clk_hifiberry_dacpro_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ return (to_hifiberry_clk(hw)->mode == 0) ? CLK_44EN_RATE : -+ CLK_48EN_RATE; -+} -+ -+static long clk_hifiberry_dacpro_round_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long *parent_rate) -+{ -+ long actual_rate; -+ -+ if (rate <= CLK_44EN_RATE) { -+ actual_rate = (long)CLK_44EN_RATE; -+ } else if (rate >= CLK_48EN_RATE) { -+ actual_rate = (long)CLK_48EN_RATE; -+ } else { -+ long diff44Rate = (long)(rate - CLK_44EN_RATE); -+ long diff48Rate = (long)(CLK_48EN_RATE - rate); -+ -+ if (diff44Rate < diff48Rate) -+ actual_rate = (long)CLK_44EN_RATE; -+ else -+ actual_rate = (long)CLK_48EN_RATE; -+ } -+ return actual_rate; -+} -+ -+ -+static int clk_hifiberry_dacpro_set_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long parent_rate) -+{ -+ unsigned long actual_rate; -+ struct clk_hifiberry_hw *clk = to_hifiberry_clk(hw); -+ -+ actual_rate = (unsigned long)clk_hifiberry_dacpro_round_rate(hw, rate, -+ &parent_rate); -+ clk->mode = (actual_rate == CLK_44EN_RATE) ? 0 : 1; -+ return 0; -+} -+ -+ -+const struct clk_ops clk_hifiberry_dacpro_rate_ops = { -+ .recalc_rate = clk_hifiberry_dacpro_recalc_rate, -+ .round_rate = clk_hifiberry_dacpro_round_rate, -+ .set_rate = clk_hifiberry_dacpro_set_rate, -+}; -+ -+static int clk_hifiberry_dacpro_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct clk_hifiberry_hw *proclk; -+ struct clk *clk; -+ struct device *dev; -+ struct clk_init_data init; -+ -+ dev = &pdev->dev; -+ -+ proclk = kzalloc(sizeof(struct clk_hifiberry_hw), GFP_KERNEL); -+ if (!proclk) -+ return -ENOMEM; -+ -+ init.name = "clk-hifiberry-dacpro"; -+ init.ops = &clk_hifiberry_dacpro_rate_ops; -+ init.flags = CLK_IS_BASIC; -+ init.parent_names = NULL; -+ init.num_parents = 0; -+ -+ proclk->mode = 0; -+ proclk->hw.init = &init; -+ -+ clk = devm_clk_register(dev, &proclk->hw); -+ if (!IS_ERR(clk)) { -+ ret = of_clk_add_provider(dev->of_node, of_clk_src_simple_get, -+ clk); -+ } else { -+ dev_err(dev, "Fail to register clock driver\n"); -+ kfree(proclk); -+ ret = PTR_ERR(clk); -+ } -+ return ret; -+} -+ -+static int clk_hifiberry_dacpro_remove(struct platform_device *pdev) -+{ -+ of_clk_del_provider(pdev->dev.of_node); -+ return 0; -+} -+ -+static struct platform_driver clk_hifiberry_dacpro_driver = { -+ .probe = clk_hifiberry_dacpro_probe, -+ .remove = clk_hifiberry_dacpro_remove, -+ .driver = { -+ .name = "clk-hifiberry-dacpro", -+ .of_match_table = clk_hifiberry_dacpro_dt_ids, -+ }, -+}; -+ -+static int __init clk_hifiberry_dacpro_init(void) -+{ -+ return platform_driver_register(&clk_hifiberry_dacpro_driver); -+} -+core_initcall(clk_hifiberry_dacpro_init); -+ -+static void __exit clk_hifiberry_dacpro_exit(void) -+{ -+ platform_driver_unregister(&clk_hifiberry_dacpro_driver); -+} -+module_exit(clk_hifiberry_dacpro_exit); -+ -+MODULE_DESCRIPTION("HiFiBerry DAC Pro clock driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:clk-hifiberry-dacpro"); -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 8272ba5302b1ddbd9c21ee50891d3cb0f0303c58..4473cc728097bda0ce9fe68d4a9da348ec41f8b3 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -24,6 +24,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DAC - help - Say Y or M if you want to add support for HifiBerry DAC. - -+config SND_BCM2708_SOC_HIFIBERRY_DACPLUS -+ tristate "Support for HifiBerry DAC+" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x -+ help -+ Say Y or M if you want to add support for HifiBerry DAC+. -+ - config SND_BCM2708_SOC_HIFIBERRY_DIGI - tristate "Support for HifiBerry Digi" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index fcac518ca9b46ab2074fc859b8d2f1ff850ebc19..203afc03167acbcad15e836209956bc5ab151157 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,11 +10,13 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-hifiberry-dac-objs := hifiberry_dac.o -+snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c -new file mode 100644 -index 0000000000000000000000000000000000000000..bdc35e7e6bc12dc1cf04f5ffad8f9ab49a0b0266 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_dacplus.c -@@ -0,0 +1,359 @@ -+/* -+ * ASoC Driver for HiFiBerry DAC+ / DAC Pro -+ * -+ * Author: Daniel Matuschek, Stuart MacLean -+ * Copyright 2014-2015 -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/pcm512x.h" -+ -+#define HIFIBERRY_DACPRO_NOCLOCK 0 -+#define HIFIBERRY_DACPRO_CLK44EN 1 -+#define HIFIBERRY_DACPRO_CLK48EN 2 -+ -+struct pcm512x_priv { -+ struct regmap *regmap; -+ struct clk *sclk; -+}; -+ -+/* Clock rate of CLK44EN attached to GPIO6 pin */ -+#define CLK_44EN_RATE 22579200UL -+/* Clock rate of CLK48EN attached to GPIO3 pin */ -+#define CLK_48EN_RATE 24576000UL -+ -+static bool slave; -+static bool snd_rpi_hifiberry_is_dacpro; -+static bool digital_gain_0db_limit = true; -+ -+static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, -+ int clk_id) -+{ -+ switch (clk_id) { -+ case HIFIBERRY_DACPRO_NOCLOCK: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x00); -+ break; -+ case HIFIBERRY_DACPRO_CLK44EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x20); -+ break; -+ case HIFIBERRY_DACPRO_CLK48EN: -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x24, 0x04); -+ break; -+ } -+} -+ -+static void snd_rpi_hifiberry_dacplus_clk_gpio(struct snd_soc_codec *codec) -+{ -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x24, 0x24); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_3, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_6, 0x0f, 0x02); -+} -+ -+static bool snd_rpi_hifiberry_dacplus_is_sclk(struct snd_soc_codec *codec) -+{ -+ int sck; -+ -+ sck = snd_soc_read(codec, PCM512x_RATE_DET_4); -+ return (!(sck & 0x40)); -+} -+ -+static bool snd_rpi_hifiberry_dacplus_is_sclk_sleep( -+ struct snd_soc_codec *codec) -+{ -+ msleep(2); -+ return snd_rpi_hifiberry_dacplus_is_sclk(codec); -+} -+ -+static bool snd_rpi_hifiberry_dacplus_is_pro_card(struct snd_soc_codec *codec) -+{ -+ bool isClk44EN, isClk48En, isNoClk; -+ -+ snd_rpi_hifiberry_dacplus_clk_gpio(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK44EN); -+ isClk44EN = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_NOCLOCK); -+ isNoClk = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ snd_rpi_hifiberry_dacplus_select_clk(codec, HIFIBERRY_DACPRO_CLK48EN); -+ isClk48En = snd_rpi_hifiberry_dacplus_is_sclk_sleep(codec); -+ -+ return (isClk44EN && isClk48En && !isNoClk); -+} -+ -+static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) -+{ -+ int type; -+ -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ type = HIFIBERRY_DACPRO_CLK44EN; -+ break; -+ default: -+ type = HIFIBERRY_DACPRO_CLK48EN; -+ break; -+ } -+ return type; -+} -+ -+static void snd_rpi_hifiberry_dacplus_set_sclk(struct snd_soc_codec *codec, -+ int sample_rate) -+{ -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); -+ -+ if (!IS_ERR(pcm512x->sclk)) { -+ int ctype; -+ -+ ctype = snd_rpi_hifiberry_dacplus_clk_for_rate(sample_rate); -+ clk_set_rate(pcm512x->sclk, (ctype == HIFIBERRY_DACPRO_CLK44EN) -+ ? CLK_44EN_RATE : CLK_48EN_RATE); -+ snd_rpi_hifiberry_dacplus_select_clk(codec, ctype); -+ } -+} -+ -+static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *priv; -+ -+ if (slave) -+ snd_rpi_hifiberry_is_dacpro = false; -+ else -+ snd_rpi_hifiberry_is_dacpro = -+ snd_rpi_hifiberry_dacplus_is_pro_card(codec); -+ -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_dai_link *dai = rtd->dai_link; -+ -+ dai->name = "HiFiBerry DAC+ Pro"; -+ dai->stream_name = "HiFiBerry DAC+ Pro HiFi"; -+ dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM; -+ -+ snd_soc_update_bits(codec, PCM512x_BCLK_LRCLK_CFG, 0x31, 0x11); -+ snd_soc_update_bits(codec, PCM512x_MASTER_MODE, 0x03, 0x03); -+ snd_soc_update_bits(codec, PCM512x_MASTER_CLKDIV_2, 0x7f, 63); -+ } else { -+ priv = snd_soc_codec_get_drvdata(codec); -+ priv->sclk = ERR_PTR(-ENOENT); -+ } -+ -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); -+ -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dacplus_update_rate_den( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); -+ struct snd_ratnum *rats_no_pll; -+ unsigned int num = 0, den = 0; -+ int err; -+ -+ rats_no_pll = devm_kzalloc(rtd->dev, sizeof(*rats_no_pll), GFP_KERNEL); -+ if (!rats_no_pll) -+ return -ENOMEM; -+ -+ rats_no_pll->num = clk_get_rate(pcm512x->sclk) / 64; -+ rats_no_pll->den_min = 1; -+ rats_no_pll->den_max = 128; -+ rats_no_pll->den_step = 1; -+ -+ err = snd_interval_ratnum(hw_param_interval(params, -+ SNDRV_PCM_HW_PARAM_RATE), 1, rats_no_pll, &num, &den); -+ if (err >= 0 && den) { -+ params->rate_num = num; -+ params->rate_den = den; -+ } -+ -+ devm_kfree(rtd->dev, rats_no_pll); -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro( -+ struct snd_soc_dai *cpu_dai, struct snd_pcm_hw_params *params) -+{ -+ int bratio = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, bratio); -+} -+ -+static int snd_rpi_hifiberry_dacplus_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ int ret; -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ if (snd_rpi_hifiberry_is_dacpro) { -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_rpi_hifiberry_dacplus_set_sclk(codec, -+ params_rate(params)); -+ -+ ret = snd_rpi_hifiberry_dacplus_set_bclk_ratio_pro(cpu_dai, -+ params); -+ if (!ret) -+ ret = snd_rpi_hifiberry_dacplus_update_rate_den( -+ substream, params); -+ } else { -+ ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+ } -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_dacplus_startup( -+ struct snd_pcm_substream *substream) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); -+ return 0; -+} -+ -+static void snd_rpi_hifiberry_dacplus_shutdown( -+ struct snd_pcm_substream *substream) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x00); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_hifiberry_dacplus_ops = { -+ .hw_params = snd_rpi_hifiberry_dacplus_hw_params, -+ .startup = snd_rpi_hifiberry_dacplus_startup, -+ .shutdown = snd_rpi_hifiberry_dacplus_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { -+{ -+ .name = "HiFiBerry DAC+", -+ .stream_name = "HiFiBerry DAC+ HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004d", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_dacplus_ops, -+ .init = snd_rpi_hifiberry_dacplus_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_hifiberry_dacplus = { -+ .name = "snd_rpi_hifiberry_dacplus", -+ .driver_name = "HifiberryDacp", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_dacplus_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), -+}; -+ -+static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_dacplus.dev = &pdev->dev; -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai; -+ -+ dai = &snd_rpi_hifiberry_dacplus_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "hifiberry,24db_digital_gain"); -+ slave = of_property_read_bool(pdev->dev.of_node, -+ "hifiberry-dacplus,slave"); -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); -+} -+ -+static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-dacplus", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); -+ -+static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { -+ .driver = { -+ .name = "snd-rpi-hifiberry-dacplus", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_dacplus_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_dacplus_probe, -+ .remove = snd_rpi_hifiberry_dacplus_remove, -+}; -+ -+module_platform_driver(snd_rpi_hifiberry_dacplus_driver); -+ -+MODULE_AUTHOR("Daniel Matuschek "); -+MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c -index 72b19e62f6267698aea45d2410d616d91c1825cb..c6839ef6e16754ed9de2698507b8986addd822fe 100644 ---- a/sound/soc/codecs/pcm512x.c -+++ b/sound/soc/codecs/pcm512x.c -@@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, - int fssp; - int gpio; - -- lrclk_div = snd_soc_params_to_frame_size(params); -+ lrclk_div = snd_pcm_format_physical_width(params_format(params)) -+ * params_channels(params); - if (lrclk_div == 0) { - dev_err(dev, "No LRCLK?\n"); - return -EINVAL; - -From f11ffc75b1a5ba748f160765164337eabea0b6e1 Mon Sep 17 00:00:00 2001 -From: Daniel Matuschek -Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 072/122] Added driver for HiFiBerry Amp amplifier add-on board - -The driver contains a low-level hardware driver for the TAS5713 and the -drivers for the Raspberry Pi I2S subsystem. - -TAS5713: return error if initialisation fails - -Existing TAS5713 driver logs errors during initialisation, but does not return -an error code. Therefore even if initialisation fails, the driver will still be -loaded, but won't work. This patch fixes this. I2C communication error will now -reported correctly by a non-zero return code. - -HiFiBerry Amp: fix device-tree problems - -Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. ---- - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_amp.c | 129 +++++++++++++++ - sound/soc/codecs/Kconfig | 4 + - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ - 7 files changed, 723 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_amp.c - create mode 100644 sound/soc/codecs/tas5713.c - create mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 4473cc728097bda0ce9fe68d4a9da348ec41f8b3..b1d877407dd69c9bd6b2787b0a559f4113bc21f2 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -38,6 +38,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - -+config SND_BCM2708_SOC_HIFIBERRY_AMP -+ tristate "Support for the HifiBerry Amp" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_TAS5713 -+ help -+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. -+ - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 203afc03167acbcad15e836209956bc5ab151157..a4838e2cf8e93c9285836f95f4151daea33e1bd1 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,11 +12,13 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -+snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d17c29780507dc31c50f1d567ff5cea7c8241ff5 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -0,0 +1,129 @@ -+/* -+ * ASoC Driver for HifiBerry AMP -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ // ToDo: init of the dsp-registers. -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params ) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -+ .hw_params = snd_rpi_hifiberry_amp_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -+ { -+ .name = "HifiBerry AMP", -+ .stream_name = "HifiBerry AMP HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "tas5713-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "tas5713.1-001b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_amp_ops, -+ .init = snd_rpi_hifiberry_amp_init, -+ }, -+}; -+ -+ -+static struct snd_soc_card snd_rpi_hifiberry_amp = { -+ .name = "snd_rpi_hifiberry_amp", -+ .driver_name = "HifiberryAmp", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_amp_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), -+}; -+ -+static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-amp", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); -+ -+ -+static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_amp.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); -+ -+ if (ret != 0) { -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); -+} -+ -+ -+static struct platform_driver snd_rpi_hifiberry_amp_driver = { -+ .driver = { -+ .name = "snd-hifiberry-amp", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_amp_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_amp_probe, -+ .remove = snd_rpi_hifiberry_amp_remove, -+}; -+ -+ -+module_platform_driver(snd_rpi_hifiberry_amp_driver); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b..9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -139,6 +139,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -+ select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4_I2C if I2C -@@ -821,6 +822,9 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - -+config SND_SOC_TAS5713 -+ tristate -+ - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 77786e7f44a7fa22d9b5beed3eb687e2b7a28526..5a2db0d2fe2f49920eeccfecef62c969ae2e99a1 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -144,6 +144,7 @@ snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tas5720-objs := tas5720.o - snd-soc-tfa9879-objs := tfa9879.o -+snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -366,6 +367,7 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o -+obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9b2713861dcbed751842ca29c88eb1eae5867411 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.c -@@ -0,0 +1,369 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "tas5713.h" -+ -+ -+static struct i2c_client *i2c; -+ -+struct tas5713_priv { -+ struct regmap *regmap; -+ int mclk_div; -+ struct snd_soc_codec *codec; -+}; -+ -+static struct tas5713_priv *priv_data; -+ -+ -+ -+ -+/* -+ * _ _ ___ _ ___ _ _ -+ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -+ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -+ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ -+ * -+ */ -+ -+static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); -+ -+ -+static const struct snd_kcontrol_new tas5713_snd_controls[] = { -+ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -+ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) -+}; -+ -+ -+ -+ -+/* -+ * __ __ _ _ ___ _ -+ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -+ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -+ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ u16 blen = 0x00; -+ -+ struct snd_soc_codec *codec; -+ codec = dai->codec; -+ priv_data->codec = dai->codec; -+ -+ switch (params_format(params)) { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ blen = 0x03; -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ blen = 0x1; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ blen = 0x04; -+ break; -+ case SNDRV_PCM_FORMAT_S32_LE: -+ blen = 0x05; -+ break; -+ default: -+ dev_err(dai->dev, "Unsupported word length: %u\n", -+ params_format(params)); -+ return -EINVAL; -+ } -+ -+ // set word length -+ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); -+ -+ return 0; -+} -+ -+ -+static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) -+{ -+ unsigned int val = 0; -+ -+ struct tas5713_priv *tas5713; -+ struct snd_soc_codec *codec = dai->codec; -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ if (mute) { -+ val = TAS5713_SOFT_MUTE_ALL; -+ } -+ -+ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); -+} -+ -+ -+static const struct snd_soc_dai_ops tas5713_dai_ops = { -+ .hw_params = tas5713_hw_params, -+ .mute_stream = tas5713_mute_stream, -+}; -+ -+ -+static struct snd_soc_dai_driver tas5713_dai = { -+ .name = "tas5713-hifi", -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_48000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -+ }, -+ .ops = &tas5713_dai_ops, -+}; -+ -+ -+ -+ -+/* -+ * ___ _ ___ _ -+ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -+ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -+ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_remove(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ return 0; -+} -+ -+ -+static int tas5713_probe(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ int i, ret; -+ -+ i2c = container_of(codec->dev, struct i2c_client, dev); -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Trim oscillator -+ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -+ if (ret < 0) return ret; -+ msleep(1000); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Clock mode: 44/48kHz, MCLK=64xfs -+ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -+ if (ret < 0) return ret; -+ -+ // I2S 24bit -+ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -+ if (ret < 0) return ret; -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -+ if (ret < 0) return ret; -+ -+ // Set volume to 0db -+ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -+ if (ret < 0) return ret; -+ -+ // Now start programming the default initialization sequence -+ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -+ ret = i2c_master_send(i2c, -+ tas5713_init_sequence[i].data, -+ tas5713_init_sequence[i].size); -+ if (ret < 0) { -+ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -+ } -+ } -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ -+ return 0; -+} -+ -+ -+static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -+ .probe = tas5713_probe, -+ .remove = tas5713_remove, -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+}; -+ -+ -+ -+ -+/* -+ * ___ ___ ___ ___ _ -+ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -+ * | | / / (__ | |) | '_| \ V / -_) '_| -+ * |___/___\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static const struct reg_default tas5713_reg_defaults[] = { -+ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -+ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -+ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -+ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB -+}; -+ -+ -+static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case TAS5713_DEVICE_ID: -+ case TAS5713_ERROR_STATUS: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+ -+static const struct of_device_id tas5713_of_match[] = { -+ { .compatible = "ti,tas5713", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, tas5713_of_match); -+ -+ -+static struct regmap_config tas5713_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, -+ -+ .max_register = TAS5713_MAX_REGISTER, -+ .volatile_reg = tas5713_reg_volatile, -+ -+ .cache_type = REGCACHE_RBTREE, -+ .reg_defaults = tas5713_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), -+}; -+ -+ -+static int tas5713_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ -+ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -+ if (!priv_data) -+ return -ENOMEM; -+ -+ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -+ if (IS_ERR(priv_data->regmap)) { -+ ret = PTR_ERR(priv_data->regmap); -+ return ret; -+ } -+ -+ i2c_set_clientdata(i2c, priv_data); -+ -+ ret = snd_soc_register_codec(&i2c->dev, -+ &soc_codec_dev_tas5713, &tas5713_dai, 1); -+ -+ return ret; -+} -+ -+ -+static int tas5713_i2c_remove(struct i2c_client *i2c) -+{ -+ snd_soc_unregister_codec(&i2c->dev); -+ i2c_set_clientdata(i2c, NULL); -+ -+ kfree(priv_data); -+ -+ return 0; -+} -+ -+ -+static const struct i2c_device_id tas5713_i2c_id[] = { -+ { "tas5713", 0 }, -+ { } -+}; -+ -+MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); -+ -+ -+static struct i2c_driver tas5713_i2c_driver = { -+ .driver = { -+ .name = "tas5713", -+ .owner = THIS_MODULE, -+ .of_match_table = tas5713_of_match, -+ }, -+ .probe = tas5713_i2c_probe, -+ .remove = tas5713_i2c_remove, -+ .id_table = tas5713_i2c_id -+}; -+ -+ -+static int __init tas5713_modinit(void) -+{ -+ int ret = 0; -+ -+ ret = i2c_add_driver(&tas5713_i2c_driver); -+ if (ret) { -+ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -+ ret); -+ } -+ -+ return ret; -+} -+module_init(tas5713_modinit); -+ -+ -+static void __exit tas5713_exit(void) -+{ -+ i2c_del_driver(&tas5713_i2c_driver); -+} -+module_exit(tas5713_exit); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for TAS5713"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h -new file mode 100644 -index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8f612a342 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.h -@@ -0,0 +1,210 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#ifndef _TAS5713_H -+#define _TAS5713_H -+ -+ -+// TAS5713 I2C-bus register addresses -+ -+#define TAS5713_CLOCK_CTRL 0x00 -+#define TAS5713_DEVICE_ID 0x01 -+#define TAS5713_ERROR_STATUS 0x02 -+#define TAS5713_SYSTEM_CTRL1 0x03 -+#define TAS5713_SERIAL_DATA_INTERFACE 0x04 -+#define TAS5713_SYSTEM_CTRL2 0x05 -+#define TAS5713_SOFT_MUTE 0x06 -+#define TAS5713_VOL_MASTER 0x07 -+#define TAS5713_VOL_CH1 0x08 -+#define TAS5713_VOL_CH2 0x09 -+#define TAS5713_VOL_HEADPHONE 0x0A -+#define TAS5713_VOL_CONFIG 0x0E -+#define TAS5713_MODULATION_LIMIT 0x10 -+#define TAS5713_IC_DLY_CH1 0x11 -+#define TAS5713_IC_DLY_CH2 0x12 -+#define TAS5713_IC_DLY_CH3 0x13 -+#define TAS5713_IC_DLY_CH4 0x14 -+ -+#define TAS5713_START_STOP_PERIOD 0x1A -+#define TAS5713_OSC_TRIM 0x1B -+#define TAS5713_BKND_ERR 0x1C -+ -+#define TAS5713_INPUT_MUX 0x20 -+#define TAS5713_SRC_SELECT_CH4 0x21 -+#define TAS5713_PWM_MUX 0x25 -+ -+#define TAS5713_CH1_BQ0 0x29 -+#define TAS5713_CH1_BQ1 0x2A -+#define TAS5713_CH1_BQ2 0x2B -+#define TAS5713_CH1_BQ3 0x2C -+#define TAS5713_CH1_BQ4 0x2D -+#define TAS5713_CH1_BQ5 0x2E -+#define TAS5713_CH1_BQ6 0x2F -+#define TAS5713_CH1_BQ7 0x58 -+#define TAS5713_CH1_BQ8 0x59 -+ -+#define TAS5713_CH2_BQ0 0x30 -+#define TAS5713_CH2_BQ1 0x31 -+#define TAS5713_CH2_BQ2 0x32 -+#define TAS5713_CH2_BQ3 0x33 -+#define TAS5713_CH2_BQ4 0x34 -+#define TAS5713_CH2_BQ5 0x35 -+#define TAS5713_CH2_BQ6 0x36 -+#define TAS5713_CH2_BQ7 0x5C -+#define TAS5713_CH2_BQ8 0x5D -+ -+#define TAS5713_CH4_BQ0 0x5A -+#define TAS5713_CH4_BQ1 0x5B -+#define TAS5713_CH3_BQ0 0x5E -+#define TAS5713_CH3_BQ1 0x5F -+ -+#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B -+#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C -+#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E -+#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F -+#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 -+#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 -+#define TAS5713_DRC_CTRL 0x46 -+ -+#define TAS5713_BANK_SW_CTRL 0x50 -+#define TAS5713_CH1_OUTPUT_MIXER 0x51 -+#define TAS5713_CH2_OUTPUT_MIXER 0x52 -+#define TAS5713_CH1_INPUT_MIXER 0x53 -+#define TAS5713_CH2_INPUT_MIXER 0x54 -+#define TAS5713_OUTPUT_POST_SCALE 0x56 -+#define TAS5713_OUTPUT_PRESCALE 0x57 -+ -+#define TAS5713_IDF_POST_SCALE 0x62 -+ -+#define TAS5713_CH1_INLINE_MIXER 0x70 -+#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 -+#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 -+#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 -+#define TAS5713_CH2_INLINE_MIXER 0x74 -+#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 -+#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 -+#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 -+ -+#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 -+#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 -+ -+#define TAS5713_REGISTER_COUNT 0x46 -+#define TAS5713_MAX_REGISTER 0xF9 -+ -+ -+// Bitmasks for registers -+#define TAS5713_SOFT_MUTE_ALL 0x07 -+ -+ -+ -+struct tas5713_init_command { -+ const int size; -+ const char *const data; -+}; -+ -+static const struct tas5713_init_command tas5713_init_sequence[] = { -+ -+ // Trim oscillator -+ { .size = 2, .data = "\x1B\x00" }, -+ // System control register 1 (0x03): block DC -+ { .size = 2, .data = "\x03\x80" }, -+ // Mute everything -+ { .size = 2, .data = "\x05\x40" }, -+ // Modulation limit register (0x10): 97.7% -+ { .size = 2, .data = "\x10\x02" }, -+ // Interchannel delay registers -+ // (0x11, 0x12, 0x13, and 0x14): BD mode -+ { .size = 2, .data = "\x11\xB8" }, -+ { .size = 2, .data = "\x12\x60" }, -+ { .size = 2, .data = "\x13\xA0" }, -+ { .size = 2, .data = "\x14\x48" }, -+ // PWM shutdown group register (0x19): no shutdown -+ { .size = 2, .data = "\x19\x00" }, -+ // Input multiplexer register (0x20): BD mode -+ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -+ // PWM output mux register (0x25) -+ // Channel 1 --> OUTA, channel 1 neg --> OUTB -+ // Channel 2 --> OUTC, channel 2 neg --> OUTD -+ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -+ // DRC control (0x46): DRC off -+ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -+ // BKND_ERR register (0x1C): 299ms reset period -+ { .size = 2, .data = "\x1C\x07" }, -+ // Mute channel 3 -+ { .size = 2, .data = "\x0A\xFF" }, -+ // Volume configuration register (0x0E): volume slew 512 steps -+ { .size = 2, .data = "\x0E\x90" }, -+ // Clock control register (0x00): 44/48kHz, MCLK=64xfs -+ { .size = 2, .data = "\x00\x60" }, -+ // Bank switch and eq control (0x50): no bank switching -+ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -+ // Volume registers (0x07, 0x08, 0x09, 0x0A) -+ { .size = 2, .data = "\x07\x20" }, -+ { .size = 2, .data = "\x08\x30" }, -+ { .size = 2, .data = "\x09\x30" }, -+ { .size = 2, .data = "\x0A\xFF" }, -+ // 0x72, 0x73, 0x76, 0x77 input mixer: -+ // no intermix between channels -+ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -+ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -+ // no inline DRC inmix -+ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -+ // 0x56, 0x57 Output scale -+ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -+ // 0x3B, 0x3c -+ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ // 0x51, 0x52: output mixer -+ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ // PEQ defaults -+ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+}; -+ -+ -+#endif /* _TAS5713_H */ - -From e06a867b4795e7c7e8dd9d13257a77494ea5f610 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 12 Dec 2016 16:26:54 +0000 -Subject: [PATCH 073/122] Revert "Added driver for HiFiBerry Amp amplifier - add-on board" - -This reverts commit 3e6b00833d92a50cbcc9922deb6e1bc8fcdbb587. ---- - sound/soc/bcm/Kconfig | 7 - - sound/soc/bcm/Makefile | 2 - - sound/soc/bcm/hifiberry_amp.c | 129 --------------- - sound/soc/codecs/Kconfig | 4 - - sound/soc/codecs/Makefile | 2 - - sound/soc/codecs/tas5713.c | 369 ------------------------------------------ - sound/soc/codecs/tas5713.h | 210 ------------------------ - 7 files changed, 723 deletions(-) - delete mode 100644 sound/soc/bcm/hifiberry_amp.c - delete mode 100644 sound/soc/codecs/tas5713.c - delete mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index b1d877407dd69c9bd6b2787b0a559f4113bc21f2..4473cc728097bda0ce9fe68d4a9da348ec41f8b3 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -38,13 +38,6 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - --config SND_BCM2708_SOC_HIFIBERRY_AMP -- tristate "Support for the HifiBerry Amp" -- depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -- select SND_SOC_TAS5713 -- help -- Say Y or M if you want to add support for the HifiBerry Amp amplifier board. -- - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a4838e2cf8e93c9285836f95f4151daea33e1bd1..203afc03167acbcad15e836209956bc5ab151157 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,13 +12,11 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o --snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o --obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -deleted file mode 100644 -index d17c29780507dc31c50f1d567ff5cea7c8241ff5..0000000000000000000000000000000000000000 ---- a/sound/soc/bcm/hifiberry_amp.c -+++ /dev/null -@@ -1,129 +0,0 @@ --/* -- * ASoC Driver for HifiBerry AMP -- * -- * Author: Sebastian Eickhoff -- * Copyright 2014 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * version 2 as published by the Free Software Foundation. -- * -- * This program 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. -- */ -- --#include --#include -- --#include --#include --#include --#include --#include -- --static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) --{ -- // ToDo: init of the dsp-registers. -- return 0; --} -- --static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params ) --{ -- struct snd_soc_pcm_runtime *rtd = substream->private_data; -- struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -- -- return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); --} -- --static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -- .hw_params = snd_rpi_hifiberry_amp_hw_params, --}; -- --static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -- { -- .name = "HifiBerry AMP", -- .stream_name = "HifiBerry AMP HiFi", -- .cpu_dai_name = "bcm2708-i2s.0", -- .codec_dai_name = "tas5713-hifi", -- .platform_name = "bcm2708-i2s.0", -- .codec_name = "tas5713.1-001b", -- .dai_fmt = SND_SOC_DAIFMT_I2S | -- SND_SOC_DAIFMT_NB_NF | -- SND_SOC_DAIFMT_CBS_CFS, -- .ops = &snd_rpi_hifiberry_amp_ops, -- .init = snd_rpi_hifiberry_amp_init, -- }, --}; -- -- --static struct snd_soc_card snd_rpi_hifiberry_amp = { -- .name = "snd_rpi_hifiberry_amp", -- .driver_name = "HifiberryAmp", -- .owner = THIS_MODULE, -- .dai_link = snd_rpi_hifiberry_amp_dai, -- .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), --}; -- --static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -- { .compatible = "hifiberry,hifiberry-amp", }, -- {}, --}; --MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); -- -- --static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) --{ -- int ret = 0; -- -- snd_rpi_hifiberry_amp.dev = &pdev->dev; -- -- if (pdev->dev.of_node) { -- struct device_node *i2s_node; -- struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -- i2s_node = of_parse_phandle(pdev->dev.of_node, -- "i2s-controller", 0); -- -- if (i2s_node) { -- dai->cpu_dai_name = NULL; -- dai->cpu_of_node = i2s_node; -- dai->platform_name = NULL; -- dai->platform_of_node = i2s_node; -- } -- } -- -- ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); -- -- if (ret != 0) { -- dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -- } -- -- return ret; --} -- -- --static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) --{ -- return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); --} -- -- --static struct platform_driver snd_rpi_hifiberry_amp_driver = { -- .driver = { -- .name = "snd-hifiberry-amp", -- .owner = THIS_MODULE, -- .of_match_table = snd_rpi_hifiberry_amp_of_match, -- }, -- .probe = snd_rpi_hifiberry_amp_probe, -- .remove = snd_rpi_hifiberry_amp_remove, --}; -- -- --module_platform_driver(snd_rpi_hifiberry_amp_driver); -- -- --MODULE_AUTHOR("Sebastian Eickhoff "); --MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); --MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4..74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -139,7 +139,6 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -- select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4_I2C if I2C -@@ -822,9 +821,6 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - --config SND_SOC_TAS5713 -- tristate -- - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 5a2db0d2fe2f49920eeccfecef62c969ae2e99a1..77786e7f44a7fa22d9b5beed3eb687e2b7a28526 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -144,7 +144,6 @@ snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tas5720-objs := tas5720.o - snd-soc-tfa9879-objs := tfa9879.o --snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -367,7 +366,6 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o --obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -deleted file mode 100644 -index 9b2713861dcbed751842ca29c88eb1eae5867411..0000000000000000000000000000000000000000 ---- a/sound/soc/codecs/tas5713.c -+++ /dev/null -@@ -1,369 +0,0 @@ --/* -- * ASoC Driver for TAS5713 -- * -- * Author: Sebastian Eickhoff -- * Copyright 2014 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * version 2 as published by the Free Software Foundation. -- * -- * This program 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. -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include --#include --#include --#include -- --#include "tas5713.h" -- -- --static struct i2c_client *i2c; -- --struct tas5713_priv { -- struct regmap *regmap; -- int mclk_div; -- struct snd_soc_codec *codec; --}; -- --static struct tas5713_priv *priv_data; -- -- -- -- --/* -- * _ _ ___ _ ___ _ _ -- * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -- * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -- * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ -- * -- */ -- --static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); -- -- --static const struct snd_kcontrol_new tas5713_snd_controls[] = { -- SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -- SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) --}; -- -- -- -- --/* -- * __ __ _ _ ___ _ -- * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -- * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -- * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -- * -- */ -- --static int tas5713_hw_params(struct snd_pcm_substream *substream, -- struct snd_pcm_hw_params *params, -- struct snd_soc_dai *dai) --{ -- u16 blen = 0x00; -- -- struct snd_soc_codec *codec; -- codec = dai->codec; -- priv_data->codec = dai->codec; -- -- switch (params_format(params)) { -- case SNDRV_PCM_FORMAT_S16_LE: -- blen = 0x03; -- break; -- case SNDRV_PCM_FORMAT_S20_3LE: -- blen = 0x1; -- break; -- case SNDRV_PCM_FORMAT_S24_LE: -- blen = 0x04; -- break; -- case SNDRV_PCM_FORMAT_S32_LE: -- blen = 0x05; -- break; -- default: -- dev_err(dai->dev, "Unsupported word length: %u\n", -- params_format(params)); -- return -EINVAL; -- } -- -- // set word length -- snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); -- -- return 0; --} -- -- --static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) --{ -- unsigned int val = 0; -- -- struct tas5713_priv *tas5713; -- struct snd_soc_codec *codec = dai->codec; -- tas5713 = snd_soc_codec_get_drvdata(codec); -- -- if (mute) { -- val = TAS5713_SOFT_MUTE_ALL; -- } -- -- return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); --} -- -- --static const struct snd_soc_dai_ops tas5713_dai_ops = { -- .hw_params = tas5713_hw_params, -- .mute_stream = tas5713_mute_stream, --}; -- -- --static struct snd_soc_dai_driver tas5713_dai = { -- .name = "tas5713-hifi", -- .playback = { -- .stream_name = "Playback", -- .channels_min = 2, -- .channels_max = 2, -- .rates = SNDRV_PCM_RATE_8000_48000, -- .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -- }, -- .ops = &tas5713_dai_ops, --}; -- -- -- -- --/* -- * ___ _ ___ _ -- * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -- * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -- * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -- * -- */ -- --static int tas5713_remove(struct snd_soc_codec *codec) --{ -- struct tas5713_priv *tas5713; -- -- tas5713 = snd_soc_codec_get_drvdata(codec); -- -- return 0; --} -- -- --static int tas5713_probe(struct snd_soc_codec *codec) --{ -- struct tas5713_priv *tas5713; -- int i, ret; -- -- i2c = container_of(codec->dev, struct i2c_client, dev); -- -- tas5713 = snd_soc_codec_get_drvdata(codec); -- -- // Reset error -- ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -- if (ret < 0) return ret; -- -- // Trim oscillator -- ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -- if (ret < 0) return ret; -- msleep(1000); -- -- // Reset error -- ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -- if (ret < 0) return ret; -- -- // Clock mode: 44/48kHz, MCLK=64xfs -- ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -- if (ret < 0) return ret; -- -- // I2S 24bit -- ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -- if (ret < 0) return ret; -- -- // Unmute -- ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -- if (ret < 0) return ret; -- ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -- if (ret < 0) return ret; -- -- // Set volume to 0db -- ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -- if (ret < 0) return ret; -- -- // Now start programming the default initialization sequence -- for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -- ret = i2c_master_send(i2c, -- tas5713_init_sequence[i].data, -- tas5713_init_sequence[i].size); -- if (ret < 0) { -- printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -- } -- } -- -- // Unmute -- ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -- if (ret < 0) return ret; -- -- return 0; --} -- -- --static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -- .probe = tas5713_probe, -- .remove = tas5713_remove, -- .controls = tas5713_snd_controls, -- .num_controls = ARRAY_SIZE(tas5713_snd_controls), --}; -- -- -- -- --/* -- * ___ ___ ___ ___ _ -- * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -- * | | / / (__ | |) | '_| \ V / -_) '_| -- * |___/___\___| |___/|_| |_|\_/\___|_| -- * -- */ -- --static const struct reg_default tas5713_reg_defaults[] = { -- { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -- { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -- { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -- { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB --}; -- -- --static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) --{ -- switch (reg) { -- case TAS5713_DEVICE_ID: -- case TAS5713_ERROR_STATUS: -- return true; -- default: -- return false; -- } --} -- -- --static const struct of_device_id tas5713_of_match[] = { -- { .compatible = "ti,tas5713", }, -- { } --}; --MODULE_DEVICE_TABLE(of, tas5713_of_match); -- -- --static struct regmap_config tas5713_regmap_config = { -- .reg_bits = 8, -- .val_bits = 8, -- -- .max_register = TAS5713_MAX_REGISTER, -- .volatile_reg = tas5713_reg_volatile, -- -- .cache_type = REGCACHE_RBTREE, -- .reg_defaults = tas5713_reg_defaults, -- .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), --}; -- -- --static int tas5713_i2c_probe(struct i2c_client *i2c, -- const struct i2c_device_id *id) --{ -- int ret; -- -- priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -- if (!priv_data) -- return -ENOMEM; -- -- priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -- if (IS_ERR(priv_data->regmap)) { -- ret = PTR_ERR(priv_data->regmap); -- return ret; -- } -- -- i2c_set_clientdata(i2c, priv_data); -- -- ret = snd_soc_register_codec(&i2c->dev, -- &soc_codec_dev_tas5713, &tas5713_dai, 1); -- -- return ret; --} -- -- --static int tas5713_i2c_remove(struct i2c_client *i2c) --{ -- snd_soc_unregister_codec(&i2c->dev); -- i2c_set_clientdata(i2c, NULL); -- -- kfree(priv_data); -- -- return 0; --} -- -- --static const struct i2c_device_id tas5713_i2c_id[] = { -- { "tas5713", 0 }, -- { } --}; -- --MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); -- -- --static struct i2c_driver tas5713_i2c_driver = { -- .driver = { -- .name = "tas5713", -- .owner = THIS_MODULE, -- .of_match_table = tas5713_of_match, -- }, -- .probe = tas5713_i2c_probe, -- .remove = tas5713_i2c_remove, -- .id_table = tas5713_i2c_id --}; -- -- --static int __init tas5713_modinit(void) --{ -- int ret = 0; -- -- ret = i2c_add_driver(&tas5713_i2c_driver); -- if (ret) { -- printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -- ret); -- } -- -- return ret; --} --module_init(tas5713_modinit); -- -- --static void __exit tas5713_exit(void) --{ -- i2c_del_driver(&tas5713_i2c_driver); --} --module_exit(tas5713_exit); -- -- --MODULE_AUTHOR("Sebastian Eickhoff "); --MODULE_DESCRIPTION("ASoC driver for TAS5713"); --MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h -deleted file mode 100644 -index 8f019e04898754d2f87e9630137be9e8f612a342..0000000000000000000000000000000000000000 ---- a/sound/soc/codecs/tas5713.h -+++ /dev/null -@@ -1,210 +0,0 @@ --/* -- * ASoC Driver for TAS5713 -- * -- * Author: Sebastian Eickhoff -- * Copyright 2014 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * version 2 as published by the Free Software Foundation. -- * -- * This program 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. -- */ -- --#ifndef _TAS5713_H --#define _TAS5713_H -- -- --// TAS5713 I2C-bus register addresses -- --#define TAS5713_CLOCK_CTRL 0x00 --#define TAS5713_DEVICE_ID 0x01 --#define TAS5713_ERROR_STATUS 0x02 --#define TAS5713_SYSTEM_CTRL1 0x03 --#define TAS5713_SERIAL_DATA_INTERFACE 0x04 --#define TAS5713_SYSTEM_CTRL2 0x05 --#define TAS5713_SOFT_MUTE 0x06 --#define TAS5713_VOL_MASTER 0x07 --#define TAS5713_VOL_CH1 0x08 --#define TAS5713_VOL_CH2 0x09 --#define TAS5713_VOL_HEADPHONE 0x0A --#define TAS5713_VOL_CONFIG 0x0E --#define TAS5713_MODULATION_LIMIT 0x10 --#define TAS5713_IC_DLY_CH1 0x11 --#define TAS5713_IC_DLY_CH2 0x12 --#define TAS5713_IC_DLY_CH3 0x13 --#define TAS5713_IC_DLY_CH4 0x14 -- --#define TAS5713_START_STOP_PERIOD 0x1A --#define TAS5713_OSC_TRIM 0x1B --#define TAS5713_BKND_ERR 0x1C -- --#define TAS5713_INPUT_MUX 0x20 --#define TAS5713_SRC_SELECT_CH4 0x21 --#define TAS5713_PWM_MUX 0x25 -- --#define TAS5713_CH1_BQ0 0x29 --#define TAS5713_CH1_BQ1 0x2A --#define TAS5713_CH1_BQ2 0x2B --#define TAS5713_CH1_BQ3 0x2C --#define TAS5713_CH1_BQ4 0x2D --#define TAS5713_CH1_BQ5 0x2E --#define TAS5713_CH1_BQ6 0x2F --#define TAS5713_CH1_BQ7 0x58 --#define TAS5713_CH1_BQ8 0x59 -- --#define TAS5713_CH2_BQ0 0x30 --#define TAS5713_CH2_BQ1 0x31 --#define TAS5713_CH2_BQ2 0x32 --#define TAS5713_CH2_BQ3 0x33 --#define TAS5713_CH2_BQ4 0x34 --#define TAS5713_CH2_BQ5 0x35 --#define TAS5713_CH2_BQ6 0x36 --#define TAS5713_CH2_BQ7 0x5C --#define TAS5713_CH2_BQ8 0x5D -- --#define TAS5713_CH4_BQ0 0x5A --#define TAS5713_CH4_BQ1 0x5B --#define TAS5713_CH3_BQ0 0x5E --#define TAS5713_CH3_BQ1 0x5F -- --#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B --#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C --#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E --#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F --#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 --#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 --#define TAS5713_DRC_CTRL 0x46 -- --#define TAS5713_BANK_SW_CTRL 0x50 --#define TAS5713_CH1_OUTPUT_MIXER 0x51 --#define TAS5713_CH2_OUTPUT_MIXER 0x52 --#define TAS5713_CH1_INPUT_MIXER 0x53 --#define TAS5713_CH2_INPUT_MIXER 0x54 --#define TAS5713_OUTPUT_POST_SCALE 0x56 --#define TAS5713_OUTPUT_PRESCALE 0x57 -- --#define TAS5713_IDF_POST_SCALE 0x62 -- --#define TAS5713_CH1_INLINE_MIXER 0x70 --#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 --#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 --#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 --#define TAS5713_CH2_INLINE_MIXER 0x74 --#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 --#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 --#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 -- --#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 --#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 -- --#define TAS5713_REGISTER_COUNT 0x46 --#define TAS5713_MAX_REGISTER 0xF9 -- -- --// Bitmasks for registers --#define TAS5713_SOFT_MUTE_ALL 0x07 -- -- -- --struct tas5713_init_command { -- const int size; -- const char *const data; --}; -- --static const struct tas5713_init_command tas5713_init_sequence[] = { -- -- // Trim oscillator -- { .size = 2, .data = "\x1B\x00" }, -- // System control register 1 (0x03): block DC -- { .size = 2, .data = "\x03\x80" }, -- // Mute everything -- { .size = 2, .data = "\x05\x40" }, -- // Modulation limit register (0x10): 97.7% -- { .size = 2, .data = "\x10\x02" }, -- // Interchannel delay registers -- // (0x11, 0x12, 0x13, and 0x14): BD mode -- { .size = 2, .data = "\x11\xB8" }, -- { .size = 2, .data = "\x12\x60" }, -- { .size = 2, .data = "\x13\xA0" }, -- { .size = 2, .data = "\x14\x48" }, -- // PWM shutdown group register (0x19): no shutdown -- { .size = 2, .data = "\x19\x00" }, -- // Input multiplexer register (0x20): BD mode -- { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -- // PWM output mux register (0x25) -- // Channel 1 --> OUTA, channel 1 neg --> OUTB -- // Channel 2 --> OUTC, channel 2 neg --> OUTD -- { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -- // DRC control (0x46): DRC off -- { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -- // BKND_ERR register (0x1C): 299ms reset period -- { .size = 2, .data = "\x1C\x07" }, -- // Mute channel 3 -- { .size = 2, .data = "\x0A\xFF" }, -- // Volume configuration register (0x0E): volume slew 512 steps -- { .size = 2, .data = "\x0E\x90" }, -- // Clock control register (0x00): 44/48kHz, MCLK=64xfs -- { .size = 2, .data = "\x00\x60" }, -- // Bank switch and eq control (0x50): no bank switching -- { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -- // Volume registers (0x07, 0x08, 0x09, 0x0A) -- { .size = 2, .data = "\x07\x20" }, -- { .size = 2, .data = "\x08\x30" }, -- { .size = 2, .data = "\x09\x30" }, -- { .size = 2, .data = "\x0A\xFF" }, -- // 0x72, 0x73, 0x76, 0x77 input mixer: -- // no intermix between channels -- { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -- { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -- { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -- // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -- // no inline DRC inmix -- { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -- { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -- // 0x56, 0x57 Output scale -- { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -- { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -- // 0x3B, 0x3c -- { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -- { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -- { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -- // 0x51, 0x52: output mixer -- { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -- { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -- // PEQ defaults -- { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -- { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, --}; -- -- --#endif /* _TAS5713_H */ - -From adf38c2875a20b75d2870d9e9897f711835811ea Mon Sep 17 00:00:00 2001 -From: Ryan Coe -Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 074/122] Update ds1307 driver for device-tree support - -Signed-off-by: Ryan Coe ---- - drivers/rtc/rtc-ds1307.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c -index 4e31036ee2596dec93accd26f627c5b95591ae9f..b92044cf03e750afa521a93519500e9d128486f4 100644 ---- a/drivers/rtc/rtc-ds1307.c -+++ b/drivers/rtc/rtc-ds1307.c -@@ -1675,6 +1675,14 @@ static int ds1307_remove(struct i2c_client *client) - return 0; - } - -+#ifdef CONFIG_OF -+static const struct of_device_id ds1307_of_match[] = { -+ { .compatible = "maxim,ds1307" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, ds1307_of_match); -+#endif -+ - static struct i2c_driver ds1307_driver = { - .driver = { - .name = "rtc-ds1307", - -From 23122064c9a8be975b07aad67e74213cf9fdc7d8 Mon Sep 17 00:00:00 2001 -From: Waldemar Brodkorb -Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 075/122] Add driver for rpi-proto - -Forward port of 3.10.x driver from https://github.com/koalo -We are using a custom board and would like to use rpi 3.18.x -kernel. Patch works fine for our embedded system. - -URL to the audio chip: -http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/ - -Playback tested with devicetree enabled. - -Signed-off-by: Waldemar Brodkorb ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/rpi-proto.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 163 insertions(+) - create mode 100644 sound/soc/bcm/rpi-proto.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 4473cc728097bda0ce9fe68d4a9da348ec41f8b3..ac0dbaf29b821c4b21855f22104a986f6e0849ec 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -45,6 +45,13 @@ config SND_BCM2708_SOC_RPI_DAC - help - Say Y or M if you want to add support for RPi-DAC. - -+config SND_BCM2708_SOC_RPI_PROTO -+ tristate "Support for Rpi-PROTO" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8731 -+ help -+ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). -+ - config SND_BCM2708_SOC_IQAUDIO_DAC - tristate "Support for IQaudIO-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 203afc03167acbcad15e836209956bc5ab151157..3badc43cbe1fcb6972829a6d5eb3143cfa812da9 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -13,10 +13,12 @@ snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o -+snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9db678e885efd63d84d60a098a84ed6772b19a2d ---- /dev/null -+++ b/sound/soc/bcm/rpi-proto.c -@@ -0,0 +1,154 @@ -+/* -+ * ASoC driver for PROTO AudioCODEC (with a WM8731) -+ * connected to a Raspberry Pi -+ * -+ * Author: Florian Meier, -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8731.h" -+ -+static const unsigned int wm8731_rates_12288000[] = { -+ 8000, 32000, 48000, 96000, -+}; -+ -+static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { -+ .list = wm8731_rates_12288000, -+ .count = ARRAY_SIZE(wm8731_rates_12288000), -+}; -+ -+static int snd_rpi_proto_startup(struct snd_pcm_substream *substream) -+{ -+ /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &wm8731_constraints_12288000); -+ return 0; -+} -+ -+static int snd_rpi_proto_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ int sysclk = 12288000; /* This is fixed on this board */ -+ -+ /* Set proto bclk */ -+ int ret = snd_soc_dai_set_bclk_ratio(cpu_dai,32*2); -+ if (ret < 0){ -+ dev_err(codec->dev, -+ "Failed to set BCLK ratio %d\n", ret); -+ return ret; -+ } -+ -+ /* Set proto sysclk */ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, -+ sysclk, SND_SOC_CLOCK_IN); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8731 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_proto_ops = { -+ .startup = snd_rpi_proto_startup, -+ .hw_params = snd_rpi_proto_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_proto_dai[] = { -+{ -+ .name = "WM8731", -+ .stream_name = "WM8731 HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8731-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8731.1-001a", -+ .dai_fmt = SND_SOC_DAIFMT_I2S -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_proto_ops, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_proto = { -+ .name = "snd_rpi_proto", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_proto_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_proto_dai), -+}; -+ -+static int snd_rpi_proto_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_proto.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_proto_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_proto); -+ if (ret) { -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_proto_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_proto); -+} -+ -+static const struct of_device_id snd_rpi_proto_of_match[] = { -+ { .compatible = "rpi,rpi-proto", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_proto_of_match); -+ -+static struct platform_driver snd_rpi_proto_driver = { -+ .driver = { -+ .name = "snd-rpi-proto", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_proto_of_match, -+ }, -+ .probe = snd_rpi_proto_probe, -+ .remove = snd_rpi_proto_remove, -+}; -+ -+module_platform_driver(snd_rpi_proto_driver); -+ -+MODULE_AUTHOR("Florian Meier"); -+MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); -+MODULE_LICENSE("GPL"); - -From 23e17d37207fc0039b141c8988644c24885ba10a Mon Sep 17 00:00:00 2001 -From: Jan Grulich -Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 076/122] RaspiDAC3 support - -Signed-off-by: Jan Grulich - -config: fix RaspiDAC Rev.3x dependencies - -Change depends to SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -like the other I2S soundcard drivers. - -Signed-off-by: Matthias Reichl ---- - sound/soc/bcm/Kconfig | 8 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/raspidac3.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 196 insertions(+) - create mode 100644 sound/soc/bcm/raspidac3.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index ac0dbaf29b821c4b21855f22104a986f6e0849ec..c59c835757a51aa8ad72933d35a83b73a889477c 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -58,3 +58,11 @@ config SND_BCM2708_SOC_IQAUDIO_DAC - select SND_SOC_PCM512x_I2C - help - Say Y or M if you want to add support for IQaudIO-DAC. -+ -+config SND_BCM2708_SOC_RASPIDAC3 -+ tristate "Support for RaspiDAC Rev.3x" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ select SND_SOC_TPA6130A2 -+ help -+ Say Y or M if you want to add support for RaspiDAC Rev.3x. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 3badc43cbe1fcb6972829a6d5eb3143cfa812da9..07d2b52376b1d16e427cf6f51cbf4779d6219ce0 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -15,6 +15,7 @@ snd-soc-hifiberry-digi-objs := hifiberry_digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -+snd-soc-raspidac3-objs := raspidac3.o - - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o -@@ -22,3 +23,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o -diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c -new file mode 100644 -index 0000000000000000000000000000000000000000..dd9eeea2af0382307f437e6db09d15468c1a470a ---- /dev/null -+++ b/sound/soc/bcm/raspidac3.c -@@ -0,0 +1,186 @@ -+/* -+ * ASoC Driver for RaspiDAC v3 -+ * -+ * Author: Jan Grulich -+ * Copyright 2015 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/pcm512x.h" -+#include "../codecs/tpa6130a2.h" -+ -+/* sound card init */ -+static int snd_rpi_raspidac3_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ else { -+ struct snd_kcontrol *kctl; -+ -+ ret = snd_soc_limit_volume(card, -+ "TPA6130A2 Headphone Playback Volume", -+ 54); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set TPA6130A2 volume limit: %d\n", -+ ret); -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Volume"); -+ if (kctl) { -+ strcpy(kctl->id.name, "Headphones Playback Volume"); -+ /* disable the volume dB scale so alsamixer works */ -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ } -+ -+ kctl = snd_soc_card_get_kcontrol(card, -+ "TPA6130A2 Headphone Playback Switch"); -+ if (kctl) -+ strcpy(kctl->id.name, "Headphones Playback Switch"); -+ } -+ -+ return 0; -+} -+ -+/* set hw parameters */ -+static int snd_rpi_raspidac3_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* startup */ -+static int snd_rpi_raspidac3_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} -+ -+/* shutdown */ -+static void snd_rpi_raspidac3_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_raspidac3_ops = { -+ .hw_params = snd_rpi_raspidac3_hw_params, -+ .startup = snd_rpi_raspidac3_startup, -+ .shutdown = snd_rpi_raspidac3_shutdown, -+}; -+ -+/* interface setup */ -+static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { -+{ -+ .name = "RaspiDAC Rev.3x", -+ .stream_name = "RaspiDAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_raspidac3_ops, -+ .init = snd_rpi_raspidac3_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_raspidac3 = { -+ .name = "RaspiDAC Rev.3x HiFi Audio Card", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_raspidac3_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), -+}; -+ -+/* sound card test */ -+static int snd_rpi_raspidac3_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_raspidac3.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_raspidac3_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_raspidac3); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+/* sound card disconnect */ -+static int snd_rpi_raspidac3_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_raspidac3); -+} -+ -+static const struct of_device_id raspidac3_of_match[] = { -+ { .compatible = "jg,raspidacv3", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, raspidac3_of_match); -+ -+/* sound card platform driver */ -+static struct platform_driver snd_rpi_raspidac3_driver = { -+ .driver = { -+ .name = "snd-rpi-raspidac3", -+ .owner = THIS_MODULE, -+ .of_match_table = raspidac3_of_match, -+ }, -+ .probe = snd_rpi_raspidac3_probe, -+ .remove = snd_rpi_raspidac3_remove, -+}; -+ -+module_platform_driver(snd_rpi_raspidac3_driver); -+ -+MODULE_AUTHOR("Jan Grulich "); -+MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); -+MODULE_LICENSE("GPL v2"); - -From 328c723f04e73cc2484ae7d5d6f317fc22fbd386 Mon Sep 17 00:00:00 2001 -From: Aaron Shaw -Date: Thu, 7 Apr 2016 21:26:21 +0100 -Subject: [PATCH 077/122] Add Support for JustBoom Audio boards - -justboom-dac: Adjust for ALSA API change - -As of 4.4, snd_soc_limit_volume now takes a struct snd_soc_card * -rather than a struct snd_soc_codec *. - -Signed-off-by: Phil Elwell ---- - sound/soc/bcm/Kconfig | 14 +++ - sound/soc/bcm/Makefile | 4 + - sound/soc/bcm/justboom-dac.c | 162 +++++++++++++++++++++++++++++++ - sound/soc/bcm/justboom-digi.c | 215 ++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 395 insertions(+) - create mode 100644 sound/soc/bcm/justboom-dac.c - create mode 100644 sound/soc/bcm/justboom-digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index c59c835757a51aa8ad72933d35a83b73a889477c..b2f6339c318cdfe3516d73952a5be1fd32bc1156 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -52,6 +52,20 @@ config SND_BCM2708_SOC_RPI_PROTO - help - Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). - -+config SND_BCM2708_SOC_JUSTBOOM_DAC -+ tristate "Support for JustBoom DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x -+ help -+ Say Y or M if you want to add support for JustBoom DAC. -+ -+config SND_BCM2708_SOC_JUSTBOOM_DIGI -+ tristate "Support for JustBoom Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for JustBoom Digi. -+ - config SND_BCM2708_SOC_IQAUDIO_DAC - tristate "Support for IQaudIO-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 07d2b52376b1d16e427cf6f51cbf4779d6219ce0..cb8ab1901b172bdee0bd9cddd2f2e7ab2f36c16a 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -12,6 +12,8 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -+snd-soc-justboom-dac-objs := justboom-dac.o -+snd-soc-justboom-digi-objs := justboom-digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -@@ -20,6 +22,8 @@ snd-soc-raspidac3-objs := raspidac3.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -+obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8fd50dbe681508a2cfe8fdde1c9fedbe9a507fa7 ---- /dev/null -+++ b/sound/soc/bcm/justboom-dac.c -@@ -0,0 +1,162 @@ -+/* -+ * ASoC Driver for JustBoom DAC Raspberry Pi HAT Sound Card -+ * -+ * Author: Milan Neskovic -+ * Copyright 2016 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/pcm512x.h" -+ -+static bool digital_gain_0db_limit = true; -+ -+static int snd_rpi_justboom_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08); -+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0xf, 0x02); -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ -+ if (digital_gain_0db_limit) -+ { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_rpi_justboom_dac_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ /*return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);*/ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+static int snd_rpi_justboom_dac_startup(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x08); -+ return 0; -+} -+ -+static void snd_rpi_justboom_dac_shutdown(struct snd_pcm_substream *substream) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08,0x00); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_justboom_dac_ops = { -+ .hw_params = snd_rpi_justboom_dac_hw_params, -+ .startup = snd_rpi_justboom_dac_startup, -+ .shutdown = snd_rpi_justboom_dac_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { -+{ -+ .name = "JustBoom DAC", -+ .stream_name = "JustBoom DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004d", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_justboom_dac_ops, -+ .init = snd_rpi_justboom_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_justboom_dac = { -+ .name = "snd_rpi_justboom_dac", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_justboom_dac_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), -+}; -+ -+static int snd_rpi_justboom_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_justboom_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_justboom_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "justboom,24db_digital_gain"); -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_justboom_dac); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_justboom_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_justboom_dac); -+} -+ -+static const struct of_device_id snd_rpi_justboom_dac_of_match[] = { -+ { .compatible = "justboom,justboom-dac", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_justboom_dac_of_match); -+ -+static struct platform_driver snd_rpi_justboom_dac_driver = { -+ .driver = { -+ .name = "snd-rpi-justboom-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_justboom_dac_of_match, -+ }, -+ .probe = snd_rpi_justboom_dac_probe, -+ .remove = snd_rpi_justboom_dac_remove, -+}; -+ -+module_platform_driver(snd_rpi_justboom_dac_driver); -+ -+MODULE_AUTHOR("Milan Neskovic "); -+MODULE_DESCRIPTION("ASoC Driver for JustBoom PI DAC HAT Sound Card"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..91acb666380faa3c0deb2230f8a0f8bbec59417b ---- /dev/null -+++ b/sound/soc/bcm/justboom-digi.c -@@ -0,0 +1,215 @@ -+/* -+ * ASoC Driver for JustBoom Raspberry Pi Digi HAT Sound Card -+ * -+ * Author: Milan Neskovic -+ * Copyright 2016 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static int snd_rpi_justboom_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ return 0; -+} -+ -+static int snd_rpi_justboom_digi_startup(struct snd_pcm_substream *substream) { -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} -+ -+static void snd_rpi_justboom_digi_shutdown(struct snd_pcm_substream *substream) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+} -+ -+static int snd_rpi_justboom_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq=0; -+ int mclk_div=1; -+ int sampling_freq=1; -+ -+ int ret; -+ -+ int samplerate = params_rate(params); -+ -+ if (samplerate<=96000) { -+ mclk_freq=samplerate*256; -+ mclk_div=WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq=samplerate*128; -+ mclk_div=WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai,64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_justboom_digi_ops = { -+ .hw_params = snd_rpi_justboom_digi_hw_params, -+ .startup = snd_rpi_justboom_digi_startup, -+ .shutdown = snd_rpi_justboom_digi_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { -+{ -+ .name = "JustBoom Digi", -+ .stream_name = "JustBoom Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_justboom_digi_ops, -+ .init = snd_rpi_justboom_digi_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_justboom_digi = { -+ .name = "snd_rpi_justboom_digi", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_justboom_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), -+}; -+ -+static int snd_rpi_justboom_digi_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_justboom_digi.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_justboom_digi_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_justboom_digi); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_justboom_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_justboom_digi); -+} -+ -+static const struct of_device_id snd_rpi_justboom_digi_of_match[] = { -+ { .compatible = "justboom,justboom-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_justboom_digi_of_match); -+ -+static struct platform_driver snd_rpi_justboom_digi_driver = { -+ .driver = { -+ .name = "snd-rpi-justboom-digi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_justboom_digi_of_match, -+ }, -+ .probe = snd_rpi_justboom_digi_probe, -+ .remove = snd_rpi_justboom_digi_remove, -+}; -+ -+module_platform_driver(snd_rpi_justboom_digi_driver); -+ -+MODULE_AUTHOR("Milan Neskovic "); -+MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); -+MODULE_LICENSE("GPL v2"); - -From 070a41a6ef5eb0427354b758ce45fee7476e8e84 Mon Sep 17 00:00:00 2001 -From: Andrey Grodzovsky -Date: Tue, 3 May 2016 22:10:59 -0400 -Subject: [PATCH 078/122] ARM: adau1977-adc: Add basic machine driver for - adau1977 codec driver. - -This commit adds basic support for the codec usage including: Device tree overlay, -binding I2S bus and setting I2S mode, clock source and frequency setting according -to spec. - -Signed-off-by: Andrey Grodzovsky ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/adau1977-adc.c | 125 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 134 insertions(+) - create mode 100644 sound/soc/bcm/adau1977-adc.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index b2f6339c318cdfe3516d73952a5be1fd32bc1156..190a79dffa53a34c2df9b2c9b5160065c759de65 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -80,3 +80,10 @@ config SND_BCM2708_SOC_RASPIDAC3 - select SND_SOC_TPA6130A2 - help - Say Y or M if you want to add support for RaspiDAC Rev.3x. -+ -+config SND_BCM2708_SOC_ADAU1977_ADC -+ tristate "Support for ADAU1977 ADC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_ADAU1977_I2C -+ help -+ Say Y or M if you want to add support for ADAU1977 ADC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index cb8ab1901b172bdee0bd9cddd2f2e7ab2f36c16a..9dd0785532aae24f3366cc2910d4dbc558cb0e5d 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -9,6 +9,7 @@ snd-soc-cygnus-objs := cygnus-pcm.o cygnus-ssp.o - obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support -+snd-soc-adau1977-adc-objs := adau1977-adc.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -@@ -19,6 +20,7 @@ snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - snd-soc-raspidac3-objs := raspidac3.o - -+obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -diff --git a/sound/soc/bcm/adau1977-adc.c b/sound/soc/bcm/adau1977-adc.c -new file mode 100644 -index 0000000000000000000000000000000000000000..6e2ee027926ee63c89222f75ceb89e3d2434b0e1 ---- /dev/null -+++ b/sound/soc/bcm/adau1977-adc.c -@@ -0,0 +1,125 @@ -+/* -+ * ASoC Driver for ADAU1977 ADC -+ * -+ * Author: Andrey Grodzovsky -+ * Copyright 2016 -+ * -+ * This file is based on hifibery_dac driver by Florian Meier. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+enum adau1977_clk_id { -+ ADAU1977_SYSCLK, -+}; -+ -+enum adau1977_sysclk_src { -+ ADAU1977_SYSCLK_SRC_MCLK, -+ ADAU1977_SYSCLK_SRC_LRCLK, -+}; -+ -+static int eval_adau1977_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ int ret; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 0, 0); -+ if (ret < 0) -+ return ret; -+ -+ return snd_soc_codec_set_sysclk(rtd->codec, ADAU1977_SYSCLK, -+ ADAU1977_SYSCLK_SRC_MCLK, 11289600, SND_SOC_CLOCK_IN); -+} -+ -+static struct snd_soc_dai_link snd_rpi_adau1977_dai[] = { -+ { -+ .name = "adau1977", -+ .stream_name = "ADAU1977", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "adau1977-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "adau1977.1-0011", -+ .init = eval_adau1977_init, -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ }, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_adau1977_adc = { -+ .name = "snd_rpi_adau1977_adc", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_adau1977_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_adau1977_dai), -+}; -+ -+static int snd_adau1977_adc_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_adau1977_adc.dev = &pdev->dev; -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_adau1977_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_adau1977_adc); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_adau1977_adc_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_adau1977_adc); -+} -+ -+static const struct of_device_id snd_adau1977_adc_of_match[] = { -+ { .compatible = "adi,adau1977-adc", }, -+ {}, -+}; -+ -+MODULE_DEVICE_TABLE(of, snd_adau1977_adc_of_match); -+ -+static struct platform_driver snd_adau1977_adc_driver = { -+ .driver = { -+ .name = "snd-adau1977-adc", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_adau1977_adc_of_match, -+ }, -+ .probe = snd_adau1977_adc_probe, -+ .remove = snd_adau1977_adc_remove, -+}; -+ -+module_platform_driver(snd_adau1977_adc_driver); -+ -+MODULE_AUTHOR("Andrey Grodzovsky "); -+MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); -+MODULE_LICENSE("GPL v2"); - -From d3f05a999f9f646a4fad423073c2bfd16ac8cdb7 Mon Sep 17 00:00:00 2001 -From: Matt Flax -Date: Mon, 16 May 2016 21:36:31 +1000 -Subject: [PATCH 079/122] New AudioInjector.net Pi soundcard with low jitter - audio in and out. - -Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. -Adds the dts overlay and updates the Makefile and README. -Updates the relevant defconfig files to enable building for the Raspberry Pi. -Thanks to Phil Elwell (pelwell) for the review, simple-card concepts and discussion. Thanks to Clive Messer for overlay naming suggestions. - -Added support for headphones, microphone and bclk_ratio settings. - -This patch adds headphone and microphone capability to the Audio Injector sound card. The patch also sets the bit clock ratio for use in the bcm2835-i2s driver. The bcm2835-i2s can't handle an 8 kHz sample rate when the bit clock is at 12 MHz because its register is only 10 bits wide which can't represent the ch2 offset of 1508. For that reason, the rate constraint is added. ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 3 + - sound/soc/bcm/audioinjector-pi-soundcard.c | 193 +++++++++++++++++++++++++++++ - 3 files changed, 203 insertions(+) - create mode 100644 sound/soc/bcm/audioinjector-pi-soundcard.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 190a79dffa53a34c2df9b2c9b5160065c759de65..eb16c3a7fb316eb5938a54dfa864f66f9b167eb0 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -87,3 +87,10 @@ config SND_BCM2708_SOC_ADAU1977_ADC - select SND_SOC_ADAU1977_I2C - help - Say Y or M if you want to add support for ADAU1977 ADC. -+ -+config SND_AUDIOINJECTOR_PI_SOUNDCARD -+ tristate "Support for audioinjector.net Pi add on soundcard" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8731 -+ help -+ Say Y or M if you want to add support for audioinjector.net Pi Hat -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 9dd0785532aae24f3366cc2910d4dbc558cb0e5d..a68469644535a38305bb5b0f3780e03e0ca4f519 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -19,6 +19,7 @@ snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o - snd-soc-raspidac3-objs := raspidac3.o -+snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -30,3 +31,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o -+obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o -+ -diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c -new file mode 100644 -index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fdc998e469 ---- /dev/null -+++ b/sound/soc/bcm/audioinjector-pi-soundcard.c -@@ -0,0 +1,193 @@ -+/* -+ * ASoC Driver for AudioInjector Pi add on soundcard -+ * -+ * Created on: 13-May-2016 -+ * Author: flatmax@flatmax.org -+ * based on code by Cliff Cai for the ssm2602 machine blackfin. -+ * with help from Lars-Peter Clausen for simplifying the original code to use the dai_fmt field. -+ * i2s_node code taken from the other sound/soc/bcm machine drivers. -+ * -+ * Copyright (C) 2016 Flatmax Pty. Ltd. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8731.h" -+ -+static const unsigned int bcm2835_rates_12000000[] = { -+ 8000, 16000, 32000, 44100, 48000, 96000, 88200, -+}; -+ -+static struct snd_pcm_hw_constraint_list bcm2835_constraints_12000000 = { -+ .list = bcm2835_rates_12000000, -+ .count = ARRAY_SIZE(bcm2835_rates_12000000), -+}; -+ -+static int snd_audioinjector_pi_soundcard_startup(struct snd_pcm_substream *substream) -+{ -+ /* Setup constraints, because there is a 12 MHz XTAL on the board */ -+ snd_pcm_hw_constraint_list(substream->runtime, 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &bcm2835_constraints_12000000); -+ return 0; -+} -+ -+static int snd_audioinjector_pi_soundcard_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ switch (params_rate(params)){ -+ case 8000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 1); -+ case 16000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 750); -+ case 32000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 375); -+ case 44100: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 272); -+ case 48000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 250); -+ case 88200: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 136); -+ case 96000: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 125); -+ default: -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 125); -+ } -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_audioinjector_pi_soundcard_ops = { -+ .startup = snd_audioinjector_pi_soundcard_startup, -+ .hw_params = snd_audioinjector_pi_soundcard_hw_params, -+}; -+ -+static int audioinjector_pi_soundcard_dai_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ return snd_soc_dai_set_sysclk(rtd->codec_dai, WM8731_SYSCLK_XTAL, 12000000, SND_SOC_CLOCK_IN); -+} -+ -+static struct snd_soc_dai_link audioinjector_pi_soundcard_dai[] = { -+ { -+ .name = "AudioInjector audio", -+ .stream_name = "AudioInjector audio", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8731-hifi", -+ .platform_name = "bcm2835-i2s.0", -+ .codec_name = "wm8731.1-001a", -+ .ops = &snd_audioinjector_pi_soundcard_ops, -+ .init = audioinjector_pi_soundcard_dai_init, -+ .dai_fmt = SND_SOC_DAIFMT_CBM_CFM|SND_SOC_DAIFMT_I2S|SND_SOC_DAIFMT_NB_NF, -+ }, -+}; -+ -+static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { -+ SND_SOC_DAPM_HP("Headphone Jack", NULL), -+ SND_SOC_DAPM_SPK("Ext Spk", NULL), -+ SND_SOC_DAPM_LINE("Line In Jacks", NULL), -+ SND_SOC_DAPM_MIC("Microphone", NULL), -+}; -+ -+static const struct snd_soc_dapm_route audioinjector_audio_map[] = { -+ /* headphone connected to LHPOUT, RHPOUT */ -+ {"Headphone Jack", NULL, "LHPOUT"}, -+ {"Headphone Jack", NULL, "RHPOUT"}, -+ -+ /* speaker connected to LOUT, ROUT */ -+ {"Ext Spk", NULL, "ROUT"}, -+ {"Ext Spk", NULL, "LOUT"}, -+ -+ /* line inputs */ -+ {"Line In Jacks", NULL, "Line Input"}, -+ -+ /* mic is connected to Mic Jack, with WM8731 Mic Bias */ -+ {"Microphone", NULL, "Mic Bias"}, -+}; -+ -+static struct snd_soc_card snd_soc_audioinjector = { -+ .name = "audioinjector-pi-soundcard", -+ .dai_link = audioinjector_pi_soundcard_dai, -+ .num_links = ARRAY_SIZE(audioinjector_pi_soundcard_dai), -+ -+ .dapm_widgets = wm8731_dapm_widgets, -+ .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), -+ .dapm_routes = audioinjector_audio_map, -+ .num_dapm_routes = ARRAY_SIZE(audioinjector_audio_map), -+}; -+ -+static int audioinjector_pi_soundcard_probe(struct platform_device *pdev) -+{ -+ struct snd_soc_card *card = &snd_soc_audioinjector; -+ int ret; -+ -+ card->dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct snd_soc_dai_link *dai = &audioinjector_pi_soundcard_dai[0]; -+ struct device_node *i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } else -+ if (!dai->cpu_of_node) { -+ dev_err(&pdev->dev, "Property 'i2s-controller' missing or invalid\n"); -+ return -EINVAL; -+ } -+ } -+ -+ if ((ret = snd_soc_register_card(card))) { -+ dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); -+ } -+ return ret; -+} -+ -+static int audioinjector_pi_soundcard_remove(struct platform_device *pdev) -+{ -+ struct snd_soc_card *card = platform_get_drvdata(pdev); -+ return snd_soc_unregister_card(card); -+ -+} -+ -+static const struct of_device_id audioinjector_pi_soundcard_of_match[] = { -+ { .compatible = "ai,audioinjector-pi-soundcard", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); -+ -+static struct platform_driver audioinjector_pi_soundcard_driver = { -+ .driver = { -+ .name = "audioinjector-audio", -+ .owner = THIS_MODULE, -+ .of_match_table = audioinjector_pi_soundcard_of_match, -+ }, -+ .probe = audioinjector_pi_soundcard_probe, -+ .remove = audioinjector_pi_soundcard_remove, -+}; -+ -+module_platform_driver(audioinjector_pi_soundcard_driver); -+MODULE_AUTHOR("Matt Flax "); -+MODULE_DESCRIPTION("AudioInjector.net Pi Soundcard"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:audioinjector-pi-soundcard"); -+ - -From 6cdf489fe02f677a7a5312dd53f5b5dfa1632487 Mon Sep 17 00:00:00 2001 -From: DigitalDreamtime -Date: Thu, 30 Jun 2016 18:38:42 +0100 -Subject: [PATCH 080/122] Add IQAudIO Digi WM8804 board support - -Support IQAudIO Digi board with iqaudio_digi machine driver and - iqaudio-digi-wm8804-audio overlay. - -NB. Machine driver is a cut and paste of hifiberry_digi code, with format - and general cleanup to comply with kernel coding standards. - -Signed-off-by: DigitalDreamtime ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/iqaudio_digi.c | 239 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 248 insertions(+) - create mode 100644 sound/soc/bcm/iqaudio_digi.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index eb16c3a7fb316eb5938a54dfa864f66f9b167eb0..9cba69ab877ef73beb2dff2f4f82d1d243f7c604 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -73,6 +73,13 @@ config SND_BCM2708_SOC_IQAUDIO_DAC - help - Say Y or M if you want to add support for IQaudIO-DAC. - -+config SND_BCM2708_SOC_IQAUDIO_DIGI -+ tristate "Support for IQAudIO Digi" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ help -+ Say Y or M if you want to add support for IQAudIO Digital IO board. -+ - config SND_BCM2708_SOC_RASPIDAC3 - tristate "Support for RaspiDAC Rev.3x" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a68469644535a38305bb5b0f3780e03e0ca4f519..fa2739206b79a9f9d2e1173b2099e1156e4e08c8 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -18,6 +18,7 @@ snd-soc-justboom-digi-objs := justboom-digi.o - snd-soc-rpi-dac-objs := rpi-dac.o - snd-soc-rpi-proto-objs := rpi-proto.o - snd-soc-iqaudio-dac-objs := iqaudio-dac.o -+snd-soc-iqaudio-digi-objs := iqaudio_digi.o - snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - -@@ -30,6 +31,7 @@ obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI) += snd-soc-justboom-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o -+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI) += snd-soc-iqaudio-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o - -diff --git a/sound/soc/bcm/iqaudio_digi.c b/sound/soc/bcm/iqaudio_digi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9b6e829bcb5b1762a853775e7816319639e39d65 ---- /dev/null -+++ b/sound/soc/bcm/iqaudio_digi.c -@@ -0,0 +1,239 @@ -+/* -+ * ASoC Driver for IQAudIO WM8804 Digi -+ * -+ * Author: Daniel Matuschek -+ * based on the HifiBerry DAC driver by Florian Meier -+ * Copyright 2013 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static short int auto_shutdown_output; -+module_param(auto_shutdown_output, short, -+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); -+ -+static int snd_rpi_iqaudio_digi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ return 0; -+} -+ -+static int snd_rpi_iqaudio_digi_startup(struct snd_pcm_substream *substream) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* turn on digital output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ -+ return 0; -+} -+ -+static void snd_rpi_iqaudio_digi_shutdown(struct snd_pcm_substream *substream) -+{ -+ if (auto_shutdown_output) { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* turn off digital output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} -+ -+ -+static int snd_rpi_iqaudio_digi_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq = 0; -+ int mclk_div = 1; -+ int sampling_freq = 1; -+ -+ int ret; -+ -+ int samplerate = params_rate(params); -+ -+ if (samplerate <= 96000) { -+ mclk_freq = samplerate * 256; -+ mclk_div = WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq = samplerate * 128; -+ mclk_div = WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq = 0x03; -+ break; -+ case 44100: -+ sampling_freq = 0x00; -+ break; -+ case 48000: -+ sampling_freq = 0x02; -+ break; -+ case 88200: -+ sampling_freq = 0x08; -+ break; -+ case 96000: -+ sampling_freq = 0x0a; -+ break; -+ case 176400: -+ sampling_freq = 0x0c; -+ break; -+ case 192000: -+ sampling_freq = 0x0e; -+ break; -+ default: -+ dev_err(codec->dev, "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_iqaudio_digi_ops = { -+ .hw_params = snd_rpi_iqaudio_digi_hw_params, -+ .startup = snd_rpi_iqaudio_digi_startup, -+ .shutdown = snd_rpi_iqaudio_digi_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_iqaudio_digi_dai[] = { -+{ -+ .name = "IQAudIO Digi", -+ .stream_name = "IQAudIO Digi HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_rpi_iqaudio_digi_ops, -+ .init = snd_rpi_iqaudio_digi_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_iqaudio_digi = { -+ .name = "IQAudIODigi", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_iqaudio_digi_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_iqaudio_digi_dai), -+}; -+ -+static int snd_rpi_iqaudio_digi_probe(struct platform_device *pdev) -+{ -+ struct snd_soc_card *card = &snd_rpi_iqaudio_digi; -+ char *prefix = "wm8804-digi,"; -+ char prop[128]; -+ struct device_node *np; -+ int ret = 0; -+ -+ snd_rpi_iqaudio_digi.dev = &pdev->dev; -+ -+ np = pdev->dev.of_node; -+ if (np) { -+ struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_digi_dai[0]; -+ struct device_node *i2s_node; -+ -+ i2s_node = of_parse_phandle(np, "i2s-controller", 0); -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ snprintf(prop, sizeof(prop), "%scard-name", prefix); -+ of_property_read_string(np, prop, &card->name); -+ -+ snprintf(prop, sizeof(prop), "%sdai-name", prefix); -+ of_property_read_string(np, prop, &dai->name); -+ -+ snprintf(prop, sizeof(prop), "%sdai-stream-name", prefix); -+ of_property_read_string(np, prop, &dai->stream_name); -+ } -+ -+ ret = snd_soc_register_card(card); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_iqaudio_digi_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_iqaudio_digi); -+} -+ -+static const struct of_device_id snd_rpi_iqaudio_digi_of_match[] = { -+ { .compatible = "iqaudio,wm8804-digi", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_iqaudio_digi_of_match); -+ -+static struct platform_driver snd_rpi_iqaudio_digi_driver = { -+ .driver = { -+ .name = "IQAudIODigi", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_iqaudio_digi_of_match, -+ }, -+ .probe = snd_rpi_iqaudio_digi_probe, -+ .remove = snd_rpi_iqaudio_digi_remove, -+}; -+ -+module_platform_driver(snd_rpi_iqaudio_digi_driver); -+ -+MODULE_AUTHOR("Daniel Matuschek "); -+MODULE_DESCRIPTION("ASoC Driver for IQAudIO WM8804 Digi"); -+MODULE_LICENSE("GPL v2"); - -From 922b72225da0a94bdc3a2c7a52ac04431e67a6a8 Mon Sep 17 00:00:00 2001 -From: escalator2015 -Date: Tue, 24 May 2016 16:20:09 +0100 -Subject: [PATCH 081/122] New driver for RRA DigiDAC1 soundcard using WM8741 + - WM8804 - ---- - sound/soc/bcm/Kconfig | 8 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/digidac1-soundcard.c | 422 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 432 insertions(+) - create mode 100644 sound/soc/bcm/digidac1-soundcard.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 9cba69ab877ef73beb2dff2f4f82d1d243f7c604..2be5b64fb0d5dcad0d5747626015a6886c3c273b 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -101,3 +101,11 @@ config SND_AUDIOINJECTOR_PI_SOUNDCARD - select SND_SOC_WM8731 - help - Say Y or M if you want to add support for audioinjector.net Pi Hat -+ -+config SND_DIGIDAC1_SOUNDCARD -+ tristate "Support for Red Rocks Audio DigiDAC1" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_WM8804 -+ select SND_SOC_WM8741 -+ help -+ Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index fa2739206b79a9f9d2e1173b2099e1156e4e08c8..a5c30c0bdacafb2bd09b6ac2f8a3bdc6a85a8404 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -21,6 +21,7 @@ snd-soc-iqaudio-dac-objs := iqaudio-dac.o - snd-soc-iqaudio-digi-objs := iqaudio_digi.o - snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o -+snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -34,4 +35,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI) += snd-soc-iqaudio-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o -+obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o - -diff --git a/sound/soc/bcm/digidac1-soundcard.c b/sound/soc/bcm/digidac1-soundcard.c -new file mode 100644 -index 0000000000000000000000000000000000000000..446796e7e4c14a7d95b2f2a01211d9a0b151f1f3 ---- /dev/null -+++ b/sound/soc/bcm/digidac1-soundcard.c -@@ -0,0 +1,422 @@ -+/* -+ * ASoC Driver for RRA DigiDAC1 -+ * Copyright 2016 -+ * Author: José M. Tasende -+ * based on the HifiBerry DAC driver by Florian Meier -+ * and the Wolfson card driver by Nikesh Oswal, -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+#include "../codecs/wm8741.h" -+ -+#define WM8741_NUM_SUPPLIES 2 -+ -+/* codec private data */ -+struct wm8741_priv { -+ struct wm8741_platform_data pdata; -+ struct regmap *regmap; -+ struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; -+ unsigned int sysclk; -+ const struct snd_pcm_hw_constraint_list *sysclk_constraints; -+}; -+ -+static int samplerate = 44100; -+ -+/* New Alsa Controls not exposed by original wm8741 codec driver */ -+/* in actual driver the att. adjustment is wrong because */ -+/* this DAC has a coarse attenuation register with 4dB steps */ -+/* and a fine level register with 0.125dB steps */ -+/* each register has 32 steps so combining both we have 1024 steps */ -+/* of 0.125 dB. */ -+/* The original level controls from driver are removed at startup */ -+/* and replaced by the corrected ones. */ -+/* The same wm8741 driver can be used for wm8741 and wm8742 devices */ -+ -+static const DECLARE_TLV_DB_SCALE(dac_tlv_fine, 0, 13, 0); -+static const DECLARE_TLV_DB_SCALE(dac_tlv_coarse, -12700, 400, 1); -+static const char *w8741_dither[4] = {"Off", "RPDF", "TPDF", "HPDF"}; -+static const char *w8741_filter[5] = { -+ "Type 1", "Type 2", "Type 3", "Type 4", "Type 5"}; -+static const char *w8741_switch[2] = {"Off", "On"}; -+static const struct soc_enum w8741_enum[] = { -+SOC_ENUM_SINGLE(WM8741_MODE_CONTROL_2, 0, 4, w8741_dither),/* dithering type */ -+SOC_ENUM_SINGLE(WM8741_FILTER_CONTROL, 0, 5, w8741_filter),/* filter type */ -+SOC_ENUM_SINGLE(WM8741_FORMAT_CONTROL, 6, 2, w8741_switch),/* phase invert */ -+SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 0, 2, w8741_switch),/* volume ramp */ -+SOC_ENUM_SINGLE(WM8741_VOLUME_CONTROL, 3, 2, w8741_switch),/* soft mute */ -+}; -+ -+static const struct snd_kcontrol_new w8741_snd_controls_stereo[] = { -+SOC_DOUBLE_R_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, -+ WM8741_DACRLSB_ATTENUATION, 0, 31, 1, dac_tlv_fine), -+SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, -+ WM8741_DACRMSB_ATTENUATION, 0, 31, 1, dac_tlv_coarse), -+SOC_ENUM("DAC Dither", w8741_enum[0]), -+SOC_ENUM("DAC Digital Filter", w8741_enum[1]), -+SOC_ENUM("DAC Phase Invert", w8741_enum[2]), -+SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), -+SOC_ENUM("DAC Soft Mute", w8741_enum[4]), -+}; -+ -+static const struct snd_kcontrol_new w8741_snd_controls_mono_left[] = { -+SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACLLSB_ATTENUATION, -+ 0, 31, 0, dac_tlv_fine), -+SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACLMSB_ATTENUATION, -+ 0, 31, 1, dac_tlv_coarse), -+SOC_ENUM("DAC Dither", w8741_enum[0]), -+SOC_ENUM("DAC Digital Filter", w8741_enum[1]), -+SOC_ENUM("DAC Phase Invert", w8741_enum[2]), -+SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), -+SOC_ENUM("DAC Soft Mute", w8741_enum[4]), -+}; -+ -+static const struct snd_kcontrol_new w8741_snd_controls_mono_right[] = { -+SOC_SINGLE_TLV("DAC Fine Playback Volume", WM8741_DACRLSB_ATTENUATION, -+ 0, 31, 0, dac_tlv_fine), -+SOC_SINGLE_TLV("Digital Playback Volume", WM8741_DACRMSB_ATTENUATION, -+ 0, 31, 1, dac_tlv_coarse), -+SOC_ENUM("DAC Dither", w8741_enum[0]), -+SOC_ENUM("DAC Digital Filter", w8741_enum[1]), -+SOC_ENUM("DAC Phase Invert", w8741_enum[2]), -+SOC_ENUM("DAC Volume Ramp", w8741_enum[3]), -+SOC_ENUM("DAC Soft Mute", w8741_enum[4]), -+}; -+ -+static int w8741_add_controls(struct snd_soc_codec *codec) -+{ -+ struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); -+ -+ switch (wm8741->pdata.diff_mode) { -+ case WM8741_DIFF_MODE_STEREO: -+ case WM8741_DIFF_MODE_STEREO_REVERSED: -+ snd_soc_add_codec_controls(codec, -+ w8741_snd_controls_stereo, -+ ARRAY_SIZE(w8741_snd_controls_stereo)); -+ break; -+ case WM8741_DIFF_MODE_MONO_LEFT: -+ snd_soc_add_codec_controls(codec, -+ w8741_snd_controls_mono_left, -+ ARRAY_SIZE(w8741_snd_controls_mono_left)); -+ break; -+ case WM8741_DIFF_MODE_MONO_RIGHT: -+ snd_soc_add_codec_controls(codec, -+ w8741_snd_controls_mono_right, -+ ARRAY_SIZE(w8741_snd_controls_mono_right)); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int digidac1_soundcard_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_pcm_runtime *wm8741_rtd; -+ struct snd_soc_codec *wm8741_codec; -+ struct snd_card *sound_card = card->snd_card; -+ struct snd_kcontrol *kctl; -+ int ret; -+ -+ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); -+ if (!wm8741_rtd) { -+ dev_warn(card->dev, "digidac1_soundcard_init: couldn't get wm8741 rtd\n"); -+ return -EFAULT; -+ } -+ wm8741_codec = wm8741_rtd->codec; -+ ret = w8741_add_controls(wm8741_codec); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to add new wm8741 controls: %d\n", -+ ret); -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ kctl = snd_soc_card_get_kcontrol(card, -+ "Playback Volume"); -+ if (kctl) { -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ snd_ctl_remove(sound_card, kctl); -+ } -+ kctl = snd_soc_card_get_kcontrol(card, -+ "Fine Playback Volume"); -+ if (kctl) { -+ kctl->vd[0].access = SNDRV_CTL_ELEM_ACCESS_READWRITE; -+ snd_ctl_remove(sound_card, kctl); -+ } -+ return 0; -+} -+ -+static int digidac1_soundcard_startup(struct snd_pcm_substream *substream) -+{ -+ /* turn on wm8804 digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_pcm_runtime *wm8741_rtd; -+ struct snd_soc_codec *wm8741_codec; -+ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); -+ if (!wm8741_rtd) { -+ dev_warn(card->dev, "digidac1_soundcard_startup: couldn't get WM8741 rtd\n"); -+ return -EFAULT; -+ } -+ wm8741_codec = wm8741_rtd->codec; -+ -+ /* latch wm8741 level */ -+ snd_soc_update_bits(wm8741_codec, WM8741_DACLLSB_ATTENUATION, -+ WM8741_UPDATELL, WM8741_UPDATELL); -+ snd_soc_update_bits(wm8741_codec, WM8741_DACLMSB_ATTENUATION, -+ WM8741_UPDATELM, WM8741_UPDATELM); -+ snd_soc_update_bits(wm8741_codec, WM8741_DACRLSB_ATTENUATION, -+ WM8741_UPDATERL, WM8741_UPDATERL); -+ snd_soc_update_bits(wm8741_codec, WM8741_DACRMSB_ATTENUATION, -+ WM8741_UPDATERM, WM8741_UPDATERM); -+ -+ return 0; -+} -+ -+static void digidac1_soundcard_shutdown(struct snd_pcm_substream *substream) -+{ -+ /* turn off wm8804 digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+} -+ -+static int digidac1_soundcard_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ struct snd_soc_card *card = rtd->card; -+ struct snd_soc_pcm_runtime *wm8741_rtd; -+ struct snd_soc_codec *wm8741_codec; -+ -+ int sysclk = 27000000; -+ long mclk_freq = 0; -+ int mclk_div = 1; -+ int sampling_freq = 1; -+ int ret; -+ -+ wm8741_rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name); -+ if (!wm8741_rtd) { -+ dev_warn(card->dev, "digidac1_soundcard_hw_params: couldn't get WM8741 rtd\n"); -+ return -EFAULT; -+ } -+ wm8741_codec = wm8741_rtd->codec; -+ samplerate = params_rate(params); -+ -+ if (samplerate <= 96000) { -+ mclk_freq = samplerate*256; -+ mclk_div = WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq = samplerate*128; -+ mclk_div = WM8804_MCLKDIV_128FS; -+ } -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq = 0x03; -+ break; -+ case 44100: -+ sampling_freq = 0x00; -+ break; -+ case 48000: -+ sampling_freq = 0x02; -+ break; -+ case 88200: -+ sampling_freq = 0x08; -+ break; -+ case 96000: -+ sampling_freq = 0x0a; -+ break; -+ case 176400: -+ sampling_freq = 0x0c; -+ break; -+ case 192000: -+ sampling_freq = 0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ /* Enable wm8804 TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* wm8804 Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* wm8804 set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ /* Now update wm8741 registers for the correct oversampling */ -+ if (samplerate <= 48000) -+ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, -+ WM8741_OSR_MASK, 0x00); -+ else if (samplerate <= 96000) -+ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, -+ WM8741_OSR_MASK, 0x20); -+ else -+ snd_soc_update_bits(wm8741_codec, WM8741_MODE_CONTROL_1, -+ WM8741_OSR_MASK, 0x40); -+ -+ /* wm8741 bit size */ -+ switch (params_width(params)) { -+ case 16: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x00); -+ break; -+ case 20: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x01); -+ break; -+ case 24: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x02); -+ break; -+ case 32: -+ snd_soc_update_bits(wm8741_codec, WM8741_FORMAT_CONTROL, -+ WM8741_IWL_MASK, 0x03); -+ break; -+ default: -+ dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", -+ params_width(params)); -+ return -EINVAL; -+ } -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+/* machine stream operations */ -+static struct snd_soc_ops digidac1_soundcard_ops = { -+ .hw_params = digidac1_soundcard_hw_params, -+ .startup = digidac1_soundcard_startup, -+ .shutdown = digidac1_soundcard_shutdown, -+}; -+ -+static struct snd_soc_dai_link digidac1_soundcard_dai[] = { -+ { -+ .name = "RRA DigiDAC1", -+ .stream_name = "RRA DigiDAC1 HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &digidac1_soundcard_ops, -+ .init = digidac1_soundcard_init, -+ }, -+ { -+ .name = "RRA DigiDAC11", -+ .stream_name = "RRA DigiDAC11 HiFi", -+ .cpu_dai_name = "wm8804-spdif", -+ .codec_dai_name = "wm8741", -+ .codec_name = "wm8741.1-001a", -+ .dai_fmt = SND_SOC_DAIFMT_I2S -+ | SND_SOC_DAIFMT_NB_NF -+ | SND_SOC_DAIFMT_CBS_CFS, -+ }, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card digidac1_soundcard = { -+ .name = "digidac1-soundcard", -+ .owner = THIS_MODULE, -+ .dai_link = digidac1_soundcard_dai, -+ .num_links = ARRAY_SIZE(digidac1_soundcard_dai), -+}; -+ -+static int digidac1_soundcard_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ digidac1_soundcard.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &digidac1_soundcard_dai[0]; -+ -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&digidac1_soundcard); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int digidac1_soundcard_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&digidac1_soundcard); -+} -+ -+static const struct of_device_id digidac1_soundcard_of_match[] = { -+ { .compatible = "rra,digidac1-soundcard", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, digidac1_soundcard_of_match); -+ -+static struct platform_driver digidac1_soundcard_driver = { -+ .driver = { -+ .name = "digidac1-audio", -+ .owner = THIS_MODULE, -+ .of_match_table = digidac1_soundcard_of_match, -+ }, -+ .probe = digidac1_soundcard_probe, -+ .remove = digidac1_soundcard_remove, -+}; -+ -+module_platform_driver(digidac1_soundcard_driver); -+ -+MODULE_AUTHOR("José M. Tasende "); -+MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); -+MODULE_LICENSE("GPL v2"); - -From 1a76a9a2ca9445123234adc7b30e448216da6017 Mon Sep 17 00:00:00 2001 -From: DigitalDreamtime -Date: Sat, 2 Jul 2016 16:26:19 +0100 -Subject: [PATCH 082/122] Add support for Dion Audio LOCO DAC-AMP HAT - -Using dedicated machine driver and pcm5102a codec driver. - -Signed-off-by: DigitalDreamtime ---- - sound/soc/bcm/Kconfig | 7 +++ - sound/soc/bcm/Makefile | 3 +- - sound/soc/bcm/dionaudio_loco.c | 121 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 130 insertions(+), 1 deletion(-) - create mode 100644 sound/soc/bcm/dionaudio_loco.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 2be5b64fb0d5dcad0d5747626015a6886c3c273b..b8cb5eb7af9b3e6d8d100926e04bfef629641d1d 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -109,3 +109,10 @@ config SND_DIGIDAC1_SOUNDCARD - select SND_SOC_WM8741 - help - Say Y or M if you want to add support for Red Rocks Audio DigiDAC1 board. -+ -+config SND_BCM2708_SOC_DIONAUDIO_LOCO -+ tristate "Support for Dion Audio LOCO DAC-AMP" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM5102a -+ help -+ Say Y or M if you want to add support for Dion Audio LOCO. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index a5c30c0bdacafb2bd09b6ac2f8a3bdc6a85a8404..28cdf019dbc7aafda194c83817d260ad1a477666 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -22,6 +22,7 @@ snd-soc-iqaudio-digi-objs := iqaudio_digi.o - snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o -+snd-soc-dionaudio-loco-objs := dionaudio_loco.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -36,4 +37,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI) += snd-soc-iqaudio-digi.o - obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o - obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o -- -+obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO) += snd-soc-dionaudio-loco.o -diff --git a/sound/soc/bcm/dionaudio_loco.c b/sound/soc/bcm/dionaudio_loco.c -new file mode 100644 -index 0000000000000000000000000000000000000000..89e65317512bc774453ac8d0d5b0ff98aacb740a ---- /dev/null -+++ b/sound/soc/bcm/dionaudio_loco.c -@@ -0,0 +1,121 @@ -+/* -+ * ASoC Driver for Dion Audio LOCO DAC-AMP -+ * -+ * Author: Miquel Blauw -+ * Copyright 2016 -+ * -+ * Based on the software of the RPi-DAC writen by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_dionaudio_loco_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_rpi_dionaudio_loco_ops = { -+ .hw_params = snd_rpi_dionaudio_loco_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_dionaudio_loco_dai[] = { -+{ -+ .name = "DionAudio LOCO", -+ .stream_name = "DionAudio LOCO DAC-AMP", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm5102a-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm5102a-codec", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_dionaudio_loco_ops, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_rpi_dionaudio_loco = { -+ .name = "snd_rpi_dionaudio_loco", -+ .dai_link = snd_rpi_dionaudio_loco_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_dionaudio_loco_dai), -+}; -+ -+static int snd_rpi_dionaudio_loco_probe(struct platform_device *pdev) -+{ -+ struct device_node *np; -+ int ret = 0; -+ -+ snd_rpi_dionaudio_loco.dev = &pdev->dev; -+ -+ np = pdev->dev.of_node; -+ if (np) { -+ struct snd_soc_dai_link *dai = &snd_rpi_dionaudio_loco_dai[0]; -+ struct device_node *i2s_np; -+ -+ i2s_np = of_parse_phandle(np, "i2s-controller", 0); -+ if (i2s_np) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_np; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_np; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_dionaudio_loco); -+ if (ret) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int snd_rpi_dionaudio_loco_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_dionaudio_loco); -+} -+ -+static const struct of_device_id snd_rpi_dionaudio_loco_of_match[] = { -+ { .compatible = "dionaudio,loco-pcm5242-tpa3118", }, -+ { /* sentinel */ }, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_dionaudio_loco_of_match); -+ -+static struct platform_driver snd_rpi_dionaudio_loco_driver = { -+ .driver = { -+ .name = "snd-dionaudio-loco", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_dionaudio_loco_of_match, -+ }, -+ .probe = snd_rpi_dionaudio_loco_probe, -+ .remove = snd_rpi_dionaudio_loco_remove, -+}; -+ -+module_platform_driver(snd_rpi_dionaudio_loco_driver); -+ -+MODULE_AUTHOR("Miquel Blauw "); -+MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO"); -+MODULE_LICENSE("GPL v2"); - -From 38964afabad4b0ae7e3d50153daf97dd98277597 Mon Sep 17 00:00:00 2001 -From: Clive Messer -Date: Mon, 19 Sep 2016 14:01:04 +0100 -Subject: [PATCH 083/122] Allo Piano DAC boards: Initial 2 channel (stereo) - support (#1645) - -Add initial 2 channel (stereo) support for Allo Piano DAC (2.0/2.1) boards, -using allo-piano-dac-pcm512x-audio overlay and allo-piano-dac ALSA ASoC -machine driver. - -NB. The initial support is 2 channel (stereo) ONLY! -(The Piano DAC 2.1 will only support 2 channel (stereo) left/right output, - pending an update to the upstream pcm512x codec driver, which will have - to be submitted via upstream. With the initial downstream support, - provided by this patch, the Piano DAC 2.1 subwoofer outputs will - not function.) - -Signed-off-by: Baswaraj K -Signed-off-by: Clive Messer -Tested-by: Clive Messer ---- - sound/soc/bcm/Kconfig | 7 ++ - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/allo-piano-dac.c | 144 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 153 insertions(+) - create mode 100644 sound/soc/bcm/allo-piano-dac.c - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index b8cb5eb7af9b3e6d8d100926e04bfef629641d1d..4f0330a6c06115f077938cba3dc744d4ae10f056 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -116,3 +116,10 @@ config SND_BCM2708_SOC_DIONAUDIO_LOCO - select SND_SOC_PCM5102a - help - Say Y or M if you want to add support for Dion Audio LOCO. -+ -+config SND_BCM2708_SOC_ALLO_PIANO_DAC -+ tristate "Support for Allo Piano DAC" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for Allo Piano DAC. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 28cdf019dbc7aafda194c83817d260ad1a477666..4b94a42efecaee41df37f3c59fddefa5fe78521c 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -23,6 +23,7 @@ snd-soc-raspidac3-objs := raspidac3.o - snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o - snd-soc-dionaudio-loco-objs := dionaudio_loco.o -+snd-soc-allo-piano-dac-objs := allo-piano-dac.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -38,3 +39,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_RASPIDAC3) += snd-soc-raspidac3.o - obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundcard.o - obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o - obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO) += snd-soc-dionaudio-loco.o -+obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o -diff --git a/sound/soc/bcm/allo-piano-dac.c b/sound/soc/bcm/allo-piano-dac.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8e8e62e5a36a279b425ed4655cfbac99ecd7e4cf ---- /dev/null -+++ b/sound/soc/bcm/allo-piano-dac.c -@@ -0,0 +1,144 @@ -+/* -+ * ALSA ASoC Machine Driver for Allo Piano DAC -+ * -+ * Author: Baswaraj K -+ * Copyright 2016 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+static bool digital_gain_0db_limit = true; -+ -+static int snd_allo_piano_dac_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ if (digital_gain_0db_limit) { -+ int ret; -+ struct snd_soc_card *card = rtd->card; -+ -+ ret = snd_soc_limit_volume(card, "Digital Playback Volume", -+ 207); -+ if (ret < 0) -+ dev_warn(card->dev, "Failed to set volume limit: %d\n", -+ ret); -+ } -+ -+ return 0; -+} -+ -+static int snd_allo_piano_dac_hw_params( -+ struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ unsigned int sample_bits = -+ snd_pcm_format_physical_width(params_format(params)); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_allo_piano_dac_ops = { -+ .hw_params = snd_allo_piano_dac_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_allo_piano_dac_dai[] = { -+{ -+ .name = "Piano DAC", -+ .stream_name = "Piano DAC HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "pcm512x-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "pcm512x.1-004c", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_allo_piano_dac_ops, -+ .init = snd_allo_piano_dac_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_allo_piano_dac = { -+ .name = "PianoDAC", -+ .owner = THIS_MODULE, -+ .dai_link = snd_allo_piano_dac_dai, -+ .num_links = ARRAY_SIZE(snd_allo_piano_dac_dai), -+}; -+ -+static int snd_allo_piano_dac_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_allo_piano_dac.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai; -+ -+ dai = &snd_allo_piano_dac_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ digital_gain_0db_limit = !of_property_read_bool( -+ pdev->dev.of_node, "allo,24db_digital_gain"); -+ } -+ -+ ret = snd_soc_register_card(&snd_allo_piano_dac); -+ if (ret) -+ dev_err(&pdev->dev, -+ "snd_soc_register_card() failed: %d\n", ret); -+ -+ return ret; -+} -+ -+static int snd_allo_piano_dac_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_allo_piano_dac); -+} -+ -+static const struct of_device_id snd_allo_piano_dac_of_match[] = { -+ { .compatible = "allo,piano-dac", }, -+ { /* sentinel */ }, -+}; -+MODULE_DEVICE_TABLE(of, snd_allo_piano_dac_of_match); -+ -+static struct platform_driver snd_allo_piano_dac_driver = { -+ .driver = { -+ .name = "snd-allo-piano-dac", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_allo_piano_dac_of_match, -+ }, -+ .probe = snd_allo_piano_dac_probe, -+ .remove = snd_allo_piano_dac_remove, -+}; -+ -+module_platform_driver(snd_allo_piano_dac_driver); -+ -+MODULE_AUTHOR("Baswaraj K "); -+MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC"); -+MODULE_LICENSE("GPL v2"); - -From 32c97c8263ee9440ac09cf4c117a00563ba86748 Mon Sep 17 00:00:00 2001 -From: gtrainavicius -Date: Sun, 23 Oct 2016 12:06:53 +0300 -Subject: [PATCH 084/122] Support for Blokas Labs pisound board - -Pisound dynamic overlay (#1760) - -Restructuring pisound-overlay.dts, so it can be loaded and unloaded dynamically using dtoverlay. - -Print a logline when the kernel module is removed. ---- - .../devicetree/bindings/vendor-prefixes.txt | 1 + - arch/arm/boot/dts/overlays/pisound-overlay.dts | 94 +- - sound/soc/bcm/Kconfig | 6 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/pisound.c | 989 +++++++++++++++++++++ - 5 files changed, 1048 insertions(+), 44 deletions(-) - create mode 100644 sound/soc/bcm/pisound.c - -diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt -index f0a48ea78659c933839554ca879babb1b621b264..779c19033acad30ed8fd71f015ee76caef1a0568 100644 ---- a/Documentation/devicetree/bindings/vendor-prefixes.txt -+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt -@@ -40,6 +40,7 @@ auvidea Auvidea GmbH - avago Avago Technologies - avic Shanghai AVIC Optoelectronics Co., Ltd. - axis Axis Communications AB -+blokaslabs Vilniaus Blokas UAB - boe BOE Technology Group Co., Ltd. - bosch Bosch Sensortec GmbH - boundary Boundary Devices Inc. -diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts -index 7cdfc29ba4fbffd3216376677922e7ae26019055..5197e656a3d741d14bd9dd6c812b4b93be1419a2 100644 ---- a/arch/arm/boot/dts/overlays/pisound-overlay.dts -+++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts -@@ -26,6 +26,54 @@ - compatible = "brcm,bcm2708"; - - fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&spidev0>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spidev1>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&spi0>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pisound_spi: pisound_spi@0{ -+ compatible = "blokaslabs,pisound-spi"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi0_pins>; -+ spi-max-frequency = <1000000>; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target-path = "/"; -+ __overlay__ { -+ pcm5102a-codec { -+ #sound-dai-cells = <0>; -+ compatible = "ti,pcm5102a"; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@5 { - target = <&sound>; - __overlay__ { - compatible = "blokaslabs,pisound"; -@@ -49,7 +97,7 @@ - }; - }; - -- fragment@1 { -+ fragment@6 { - target = <&gpio>; - __overlay__ { - pinctrl-names = "default"; -@@ -63,52 +111,10 @@ - }; - }; - -- fragment@2 { -+ fragment@7 { - target = <&i2s>; - __overlay__ { - status = "okay"; - }; - }; -- -- fragment@3 { -- target-path = "/"; -- __overlay__ { -- pcm5102a-codec { -- #sound-dai-cells = <0>; -- compatible = "ti,pcm5102a"; -- status = "okay"; -- }; -- }; -- }; -- -- fragment@4 { -- target = <&spi0>; -- __overlay__ { -- status = "okay"; -- -- spidev@0{ -- status = "disabled"; -- }; -- -- spidev@1{ -- status = "okay"; -- }; -- }; -- }; -- -- fragment@5 { -- target = <&spi0>; -- __overlay__ { -- #address-cells = <1>; -- #size-cells = <0>; -- -- pisound_spi: pisound_spi@0{ -- compatible = "blokaslabs,pisound-spi"; -- reg = <0>; -- pinctrl-names = "default"; -- pinctrl-0 = <&spi0_pins>; -- spi-max-frequency = <1000000>; -- }; -- }; -- }; - }; -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 4f0330a6c06115f077938cba3dc744d4ae10f056..a0ef6a028136beb27ed13a4136712a70a60f2966 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -123,3 +123,9 @@ config SND_BCM2708_SOC_ALLO_PIANO_DAC - select SND_SOC_PCM512x_I2C - help - Say Y or M if you want to add support for Allo Piano DAC. -+ -+config SND_PISOUND -+ tristate "Support for Blokas Labs pisound" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ help -+ Say Y or M if you want to add support for Blokas Labs pisound. -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 4b94a42efecaee41df37f3c59fddefa5fe78521c..f720a3d3b5832844ee6d0558317c728f00c40b65 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -24,6 +24,7 @@ snd-soc-audioinjector-pi-soundcard-objs := audioinjector-pi-soundcard.o - snd-soc-digidac1-soundcard-objs := digidac1-soundcard.o - snd-soc-dionaudio-loco-objs := dionaudio_loco.o - snd-soc-allo-piano-dac-objs := allo-piano-dac.o -+snd-soc-pisound-objs := pisound.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o -@@ -40,3 +41,4 @@ obj-$(CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD) += snd-soc-audioinjector-pi-soundca - obj-$(CONFIG_SND_DIGIDAC1_SOUNDCARD) += snd-soc-digidac1-soundcard.o - obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO) += snd-soc-dionaudio-loco.o - obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o -+obj-$(CONFIG_SND_PISOUND) += snd-soc-pisound.o -diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c -new file mode 100644 -index 0000000000000000000000000000000000000000..4b8545487d06e4ea70073a5d063fb2310b3b94d0 ---- /dev/null -+++ b/sound/soc/bcm/pisound.c -@@ -0,0 +1,989 @@ -+/* -+ * pisound Linux kernel module. -+ * Copyright (C) 2016 Vilniaus Blokas UAB, http://blokas.io/pisound -+ * -+ * 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; version 2 of the -+ * License. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -+ * MA 02110-1301, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int pisnd_spi_init(struct device *dev); -+static void pisnd_spi_uninit(void); -+ -+static void pisnd_spi_send(uint8_t val); -+static uint8_t pisnd_spi_recv(uint8_t *buffer, uint8_t length); -+ -+typedef void (*pisnd_spi_recv_cb)(void *data); -+static void pisnd_spi_set_callback(pisnd_spi_recv_cb cb, void *data); -+ -+static const char *pisnd_spi_get_serial(void); -+static const char *pisnd_spi_get_id(void); -+static const char *pisnd_spi_get_version(void); -+ -+static int pisnd_midi_init(struct snd_card *card); -+static void pisnd_midi_uninit(void); -+ -+#define PISOUND_LOG_PREFIX "pisound: " -+ -+#ifdef DEBUG -+# define printd(...) pr_alert(PISOUND_LOG_PREFIX __VA_ARGS__) -+#else -+# define printd(...) do {} while (0) -+#endif -+ -+#define printe(...) pr_err(PISOUND_LOG_PREFIX __VA_ARGS__) -+#define printi(...) pr_info(PISOUND_LOG_PREFIX __VA_ARGS__) -+ -+static int pisnd_output_open(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static int pisnd_output_close(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static void pisnd_output_trigger( -+ struct snd_rawmidi_substream *substream, -+ int up -+ ) -+{ -+ uint8_t data; -+ -+ if (!up) -+ return; -+ -+ while (snd_rawmidi_transmit_peek(substream, &data, 1)) { -+ pisnd_spi_send(data); -+ snd_rawmidi_transmit_ack(substream, 1); -+ } -+} -+ -+static void pisnd_output_drain(struct snd_rawmidi_substream *substream) -+{ -+ uint8_t data; -+ -+ while (snd_rawmidi_transmit_peek(substream, &data, 1)) { -+ pisnd_spi_send(data); -+ -+ snd_rawmidi_transmit_ack(substream, 1); -+ } -+} -+ -+static int pisnd_input_open(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static int pisnd_input_close(struct snd_rawmidi_substream *substream) -+{ -+ return 0; -+} -+ -+static void pisnd_midi_recv_callback(void *substream) -+{ -+ uint8_t data[128]; -+ uint8_t n = 0; -+ -+ while ((n = pisnd_spi_recv(data, sizeof(data)))) { -+ int res = snd_rawmidi_receive(substream, data, n); -+ (void)res; -+ printd("midi recv 0x%02x, res = %d\n", data, res); -+ } -+} -+ -+static void pisnd_input_trigger(struct snd_rawmidi_substream *substream, int up) -+{ -+ if (up) { -+ pisnd_spi_set_callback(pisnd_midi_recv_callback, substream); -+ pisnd_midi_recv_callback(substream); -+ } else { -+ pisnd_spi_set_callback(NULL, NULL); -+ } -+} -+ -+static struct snd_rawmidi *g_rmidi; -+ -+static struct snd_rawmidi_ops pisnd_output_ops = { -+ .open = pisnd_output_open, -+ .close = pisnd_output_close, -+ .trigger = pisnd_output_trigger, -+ .drain = pisnd_output_drain, -+}; -+ -+static struct snd_rawmidi_ops pisnd_input_ops = { -+ .open = pisnd_input_open, -+ .close = pisnd_input_close, -+ .trigger = pisnd_input_trigger, -+}; -+ -+static void pisnd_get_port_info( -+ struct snd_rawmidi *rmidi, -+ int number, -+ struct snd_seq_port_info *seq_port_info -+ ) -+{ -+ seq_port_info->type = -+ SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | -+ SNDRV_SEQ_PORT_TYPE_HARDWARE | -+ SNDRV_SEQ_PORT_TYPE_PORT; -+ seq_port_info->midi_voices = 0; -+} -+ -+static struct snd_rawmidi_global_ops pisnd_global_ops = { -+ .get_port_info = pisnd_get_port_info, -+}; -+ -+static int pisnd_midi_init(struct snd_card *card) -+{ -+ int err = snd_rawmidi_new(card, "pisound MIDI", 0, 1, 1, &g_rmidi); -+ -+ if (err < 0) { -+ printe("snd_rawmidi_new failed: %d\n", err); -+ return err; -+ } -+ -+ strcpy(g_rmidi->name, "pisound MIDI "); -+ strcat(g_rmidi->name, pisnd_spi_get_serial()); -+ -+ g_rmidi->info_flags = -+ SNDRV_RAWMIDI_INFO_OUTPUT | -+ SNDRV_RAWMIDI_INFO_INPUT | -+ SNDRV_RAWMIDI_INFO_DUPLEX; -+ -+ g_rmidi->ops = &pisnd_global_ops; -+ -+ g_rmidi->private_data = (void *)0; -+ -+ snd_rawmidi_set_ops( -+ g_rmidi, -+ SNDRV_RAWMIDI_STREAM_OUTPUT, -+ &pisnd_output_ops -+ ); -+ -+ snd_rawmidi_set_ops( -+ g_rmidi, -+ SNDRV_RAWMIDI_STREAM_INPUT, -+ &pisnd_input_ops -+ ); -+ -+ return 0; -+} -+ -+static void pisnd_midi_uninit(void) -+{ -+} -+ -+static void *g_recvData; -+static pisnd_spi_recv_cb g_recvCallback; -+ -+#define FIFO_SIZE 512 -+ -+static char g_serial_num[11]; -+static char g_id[25]; -+static char g_version[5]; -+ -+DEFINE_KFIFO(spi_fifo_in, uint8_t, FIFO_SIZE); -+DEFINE_KFIFO(spi_fifo_out, uint8_t, FIFO_SIZE); -+ -+static struct gpio_desc *data_available; -+static struct gpio_desc *spi_reset; -+ -+static struct spi_device *pisnd_spi_device; -+ -+static struct workqueue_struct *pisnd_workqueue; -+static struct work_struct pisnd_work_process; -+ -+static void pisnd_work_handler(struct work_struct *work); -+ -+static uint16_t spi_transfer16(uint16_t val); -+ -+static int pisnd_init_workqueues(void) -+{ -+ pisnd_workqueue = create_singlethread_workqueue("pisnd_workqueue"); -+ INIT_WORK(&pisnd_work_process, pisnd_work_handler); -+ -+ return 0; -+} -+ -+static void pisnd_uninit_workqueues(void) -+{ -+ flush_workqueue(pisnd_workqueue); -+ destroy_workqueue(pisnd_workqueue); -+ -+ pisnd_workqueue = NULL; -+} -+ -+static bool pisnd_spi_has_more(void) -+{ -+ return gpiod_get_value(data_available); -+} -+ -+enum task_e { -+ TASK_PROCESS = 0, -+}; -+ -+static void pisnd_schedule_process(enum task_e task) -+{ -+ if (pisnd_spi_device != NULL && -+ pisnd_workqueue != NULL && -+ !work_pending(&pisnd_work_process) -+ ) { -+ printd("schedule: has more = %d\n", pisnd_spi_has_more()); -+ if (task == TASK_PROCESS) -+ queue_work(pisnd_workqueue, &pisnd_work_process); -+ } -+} -+ -+static irqreturn_t data_available_interrupt_handler(int irq, void *dev_id) -+{ -+ if (irq == gpiod_to_irq(data_available) && pisnd_spi_has_more()) { -+ printd("schedule from irq\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+static DEFINE_SPINLOCK(spilock); -+static unsigned long spilockflags; -+ -+static uint16_t spi_transfer16(uint16_t val) -+{ -+ int err; -+ struct spi_transfer transfer; -+ struct spi_message msg; -+ uint8_t txbuf[2]; -+ uint8_t rxbuf[2]; -+ -+ if (!pisnd_spi_device) { -+ printe("pisnd_spi_device null, returning\n"); -+ return 0; -+ } -+ -+ spi_message_init(&msg); -+ -+ memset(&transfer, 0, sizeof(transfer)); -+ memset(&rxbuf, 0, sizeof(rxbuf)); -+ -+ txbuf[0] = val >> 8; -+ txbuf[1] = val & 0xff; -+ -+ transfer.tx_buf = &txbuf; -+ transfer.rx_buf = &rxbuf; -+ transfer.len = sizeof(txbuf); -+ transfer.speed_hz = 125000; -+ transfer.delay_usecs = 100; -+ spi_message_add_tail(&transfer, &msg); -+ -+ spin_lock_irqsave(&spilock, spilockflags); -+ err = spi_sync(pisnd_spi_device, &msg); -+ spin_unlock_irqrestore(&spilock, spilockflags); -+ -+ if (err < 0) { -+ printe("spi_sync error %d\n", err); -+ return 0; -+ } -+ -+ printd("received: %02x%02x\n", rxbuf[0], rxbuf[1]); -+ printd("hasMore %d\n", pisnd_spi_has_more()); -+ -+ return (rxbuf[0] << 8) | rxbuf[1]; -+} -+ -+static int spi_read_bytes(char *dst, size_t length, uint8_t *bytesRead) -+{ -+ uint16_t rx; -+ uint8_t size; -+ uint8_t i; -+ -+ memset(dst, 0, length); -+ *bytesRead = 0; -+ -+ rx = spi_transfer16(0); -+ if (!(rx >> 8)) -+ return -EINVAL; -+ -+ size = rx & 0xff; -+ -+ if (size > length) -+ return -EINVAL; -+ -+ for (i = 0; i < size; ++i) { -+ rx = spi_transfer16(0); -+ if (!(rx >> 8)) -+ return -EINVAL; -+ -+ dst[i] = rx & 0xff; -+ } -+ -+ *bytesRead = i; -+ -+ return 0; -+} -+ -+static int spi_device_match(struct device *dev, void *data) -+{ -+ struct spi_device *spi = container_of(dev, struct spi_device, dev); -+ -+ printd(" %s %s %dkHz %d bits mode=0x%02X\n", -+ spi->modalias, dev_name(dev), spi->max_speed_hz/1000, -+ spi->bits_per_word, spi->mode); -+ -+ if (strcmp("pisound-spi", spi->modalias) == 0) { -+ printi("\tFound!\n"); -+ return 1; -+ } -+ -+ printe("\tNot found!\n"); -+ return 0; -+} -+ -+static struct spi_device *pisnd_spi_find_device(void) -+{ -+ struct device *dev; -+ -+ printi("Searching for spi device...\n"); -+ dev = bus_find_device(&spi_bus_type, NULL, NULL, spi_device_match); -+ if (dev != NULL) -+ return container_of(dev, struct spi_device, dev); -+ else -+ return NULL; -+} -+ -+static void pisnd_work_handler(struct work_struct *work) -+{ -+ uint16_t rx; -+ uint16_t tx; -+ uint8_t val; -+ -+ if (work == &pisnd_work_process) { -+ if (pisnd_spi_device == NULL) -+ return; -+ -+ do { -+ val = 0; -+ tx = 0; -+ -+ if (kfifo_get(&spi_fifo_out, &val)) -+ tx = 0x0f00 | val; -+ -+ rx = spi_transfer16(tx); -+ -+ if (rx & 0xff00) { -+ kfifo_put(&spi_fifo_in, rx & 0xff); -+ if (kfifo_len(&spi_fifo_in) > 16 -+ && g_recvCallback) -+ g_recvCallback(g_recvData); -+ } -+ } while (rx != 0 -+ || !kfifo_is_empty(&spi_fifo_out) -+ || pisnd_spi_has_more() -+ ); -+ -+ if (!kfifo_is_empty(&spi_fifo_in) && g_recvCallback) -+ g_recvCallback(g_recvData); -+ } -+} -+ -+static int pisnd_spi_gpio_init(struct device *dev) -+{ -+ spi_reset = gpiod_get_index(dev, "reset", 1, GPIOD_ASIS); -+ data_available = gpiod_get_index(dev, "data_available", 0, GPIOD_ASIS); -+ -+ gpiod_direction_output(spi_reset, 1); -+ gpiod_direction_input(data_available); -+ -+ /* Reset the slave. */ -+ gpiod_set_value(spi_reset, false); -+ mdelay(1); -+ gpiod_set_value(spi_reset, true); -+ -+ /* Give time for spi slave to start. */ -+ mdelay(64); -+ -+ return 0; -+} -+ -+static void pisnd_spi_gpio_uninit(void) -+{ -+ gpiod_set_value(spi_reset, false); -+ gpiod_put(spi_reset); -+ spi_reset = NULL; -+ -+ gpiod_put(data_available); -+ data_available = NULL; -+} -+ -+static int pisnd_spi_gpio_irq_init(struct device *dev) -+{ -+ return request_irq( -+ gpiod_to_irq(data_available), -+ data_available_interrupt_handler, -+ IRQF_TIMER | IRQF_TRIGGER_RISING, -+ "data_available_int", -+ NULL -+ ); -+} -+ -+static void pisnd_spi_gpio_irq_uninit(void) -+{ -+ free_irq(gpiod_to_irq(data_available), NULL); -+} -+ -+static int spi_read_info(void) -+{ -+ uint16_t tmp; -+ uint8_t count; -+ uint8_t n; -+ uint8_t i; -+ uint8_t j; -+ char buffer[257]; -+ int ret; -+ char *p; -+ -+ memset(g_serial_num, 0, sizeof(g_serial_num)); -+ memset(g_version, 0, sizeof(g_version)); -+ memset(g_id, 0, sizeof(g_id)); -+ -+ tmp = spi_transfer16(0); -+ -+ if (!(tmp >> 8)) -+ return -EINVAL; -+ -+ count = tmp & 0xff; -+ -+ for (i = 0; i < count; ++i) { -+ memset(buffer, 0, sizeof(buffer)); -+ ret = spi_read_bytes(buffer, sizeof(buffer)-1, &n); -+ -+ if (ret < 0) -+ return ret; -+ -+ switch (i) { -+ case 0: -+ if (n != 2) -+ return -EINVAL; -+ -+ snprintf( -+ g_version, -+ sizeof(g_version), -+ "%x.%02x", -+ buffer[0], -+ buffer[1] -+ ); -+ break; -+ case 1: -+ if (n >= sizeof(g_serial_num)) -+ return -EINVAL; -+ -+ memcpy(g_serial_num, buffer, sizeof(g_serial_num)); -+ break; -+ case 2: -+ { -+ if (n >= sizeof(g_id)) -+ return -EINVAL; -+ -+ p = g_id; -+ for (j = 0; j < n; ++j) -+ p += sprintf(p, "%02x", buffer[j]); -+ } -+ break; -+ default: -+ break; -+ } -+ } -+ -+ return 0; -+} -+ -+static int pisnd_spi_init(struct device *dev) -+{ -+ int ret; -+ struct spi_device *spi; -+ -+ memset(g_serial_num, 0, sizeof(g_serial_num)); -+ memset(g_id, 0, sizeof(g_id)); -+ memset(g_version, 0, sizeof(g_version)); -+ -+ spi = pisnd_spi_find_device(); -+ -+ if (spi != NULL) { -+ printd("initializing spi!\n"); -+ pisnd_spi_device = spi; -+ ret = spi_setup(pisnd_spi_device); -+ } else { -+ printe("SPI device not found, deferring!\n"); -+ return -EPROBE_DEFER; -+ } -+ -+ ret = pisnd_spi_gpio_init(dev); -+ -+ if (ret < 0) { -+ printe("SPI GPIO init failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_uninit(); -+ return ret; -+ } -+ -+ ret = spi_read_info(); -+ -+ if (ret < 0) { -+ printe("Reading card info failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_uninit(); -+ return ret; -+ } -+ -+ /* Flash the LEDs. */ -+ spi_transfer16(0xf000); -+ -+ ret = pisnd_spi_gpio_irq_init(dev); -+ if (ret < 0) { -+ printe("SPI irq request failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_irq_uninit(); -+ pisnd_spi_gpio_uninit(); -+ } -+ -+ ret = pisnd_init_workqueues(); -+ if (ret != 0) { -+ printe("Workqueue initialization failed: %d\n", ret); -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ pisnd_spi_gpio_irq_uninit(); -+ pisnd_spi_gpio_uninit(); -+ pisnd_uninit_workqueues(); -+ return ret; -+ } -+ -+ if (pisnd_spi_has_more()) { -+ printd("data is available, scheduling from init\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+ } -+ -+ return 0; -+} -+ -+static void pisnd_spi_uninit(void) -+{ -+ pisnd_uninit_workqueues(); -+ -+ spi_dev_put(pisnd_spi_device); -+ pisnd_spi_device = NULL; -+ -+ pisnd_spi_gpio_irq_uninit(); -+ pisnd_spi_gpio_uninit(); -+} -+ -+static void pisnd_spi_send(uint8_t val) -+{ -+ kfifo_put(&spi_fifo_out, val); -+ printd("schedule from spi_send\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+} -+ -+static uint8_t pisnd_spi_recv(uint8_t *buffer, uint8_t length) -+{ -+ return kfifo_out(&spi_fifo_in, buffer, length); -+} -+ -+static void pisnd_spi_set_callback(pisnd_spi_recv_cb cb, void *data) -+{ -+ g_recvData = data; -+ g_recvCallback = cb; -+} -+ -+static const char *pisnd_spi_get_serial(void) -+{ -+ if (strlen(g_serial_num)) -+ return g_serial_num; -+ -+ return ""; -+} -+ -+static const char *pisnd_spi_get_id(void) -+{ -+ if (strlen(g_id)) -+ return g_id; -+ -+ return ""; -+} -+ -+static const char *pisnd_spi_get_version(void) -+{ -+ if (strlen(g_version)) -+ return g_version; -+ -+ return ""; -+} -+ -+static const struct of_device_id pisound_of_match[] = { -+ { .compatible = "blokaslabs,pisound", }, -+ { .compatible = "blokaslabs,pisound-spi", }, -+ {}, -+}; -+ -+static struct gpio_desc *osr0, *osr1, *osr2; -+static struct gpio_desc *reset; -+static struct gpio_desc *button; -+ -+static int pisnd_hw_params( -+ struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params -+ ) -+{ -+ printd("rate = %d\n", params_rate(params)); -+ printd("ch = %d\n", params_channels(params)); -+ printd("bits = %u\n", -+ snd_pcm_format_physical_width(params_format(params))); -+ printd("format = %d\n", params_format(params)); -+ -+ gpiod_set_value(reset, false); -+ -+ switch (params_rate(params)) { -+ case 48000: -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, false); -+ gpiod_set_value(osr2, false); -+ break; -+ case 96000: -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, true); -+ gpiod_set_value(osr2, false); -+ break; -+ case 192000: -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, true); -+ gpiod_set_value(osr2, true); -+ break; -+ default: -+ printe("Unsupported rate %u!\n", params_rate(params)); -+ return -EINVAL; -+ } -+ -+ gpiod_set_value(reset, true); -+ -+ return 0; -+} -+ -+static unsigned int rates[3] = { -+ 48000, 96000, 192000 -+}; -+ -+static struct snd_pcm_hw_constraint_list constraints_rates = { -+ .count = ARRAY_SIZE(rates), -+ .list = rates, -+ .mask = 0, -+}; -+ -+static unsigned int sample_bits[] = { -+ 24, 32 -+}; -+ -+static struct snd_pcm_hw_constraint_list constraints_sample_bits = { -+ .count = ARRAY_SIZE(sample_bits), -+ .list = sample_bits, -+ .mask = 0, -+}; -+ -+static int pisnd_startup(struct snd_pcm_substream *substream) -+{ -+ int err = snd_pcm_hw_constraint_list( -+ substream->runtime, -+ 0, -+ SNDRV_PCM_HW_PARAM_RATE, -+ &constraints_rates -+ ); -+ -+ if (err < 0) -+ return err; -+ -+ err = snd_pcm_hw_constraint_list( -+ substream->runtime, -+ 0, -+ SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -+ &constraints_sample_bits -+ ); -+ -+ if (err < 0) -+ return err; -+ -+ return 0; -+} -+ -+static struct snd_soc_ops pisnd_ops = { -+ .startup = pisnd_startup, -+ .hw_params = pisnd_hw_params, -+}; -+ -+static struct snd_soc_dai_link pisnd_dai[] = { -+ { -+ .name = "pisound", -+ .stream_name = "pisound", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "snd-soc-dummy-dai", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "snd-soc-dummy", -+ .dai_fmt = -+ SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &pisnd_ops, -+ }, -+}; -+ -+static int pisnd_card_probe(struct snd_soc_card *card) -+{ -+ int err = pisnd_midi_init(card->snd_card); -+ -+ if (err < 0) -+ printe("pisnd_midi_init failed: %d\n", err); -+ -+ return err; -+} -+ -+static int pisnd_card_remove(struct snd_soc_card *card) -+{ -+ pisnd_midi_uninit(); -+ return 0; -+} -+ -+static struct snd_soc_card pisnd_card = { -+ .name = "pisound", -+ .owner = THIS_MODULE, -+ .dai_link = pisnd_dai, -+ .num_links = ARRAY_SIZE(pisnd_dai), -+ .probe = pisnd_card_probe, -+ .remove = pisnd_card_remove, -+}; -+ -+static int pisnd_init_gpio(struct device *dev) -+{ -+ osr0 = gpiod_get_index(dev, "osr", 0, GPIOD_ASIS); -+ osr1 = gpiod_get_index(dev, "osr", 1, GPIOD_ASIS); -+ osr2 = gpiod_get_index(dev, "osr", 2, GPIOD_ASIS); -+ -+ reset = gpiod_get_index(dev, "reset", 0, GPIOD_ASIS); -+ -+ button = gpiod_get_index(dev, "button", 0, GPIOD_ASIS); -+ -+ gpiod_direction_output(osr0, 1); -+ gpiod_direction_output(osr1, 1); -+ gpiod_direction_output(osr2, 1); -+ gpiod_direction_output(reset, 1); -+ -+ gpiod_set_value(reset, false); -+ gpiod_set_value(osr0, true); -+ gpiod_set_value(osr1, false); -+ gpiod_set_value(osr2, false); -+ gpiod_set_value(reset, true); -+ -+ gpiod_export(button, false); -+ -+ return 0; -+} -+ -+static int pisnd_uninit_gpio(void) -+{ -+ int i; -+ -+ struct gpio_desc **gpios[] = { -+ &osr0, &osr1, &osr2, &reset, &button, -+ }; -+ -+ gpiod_unexport(button); -+ -+ for (i = 0; i < ARRAY_SIZE(gpios); ++i) { -+ if (*gpios[i] == NULL) { -+ printd("weird, GPIO[%d] is NULL already\n", i); -+ continue; -+ } -+ -+ gpiod_put(*gpios[i]); -+ *gpios[i] = NULL; -+ } -+ -+ return 0; -+} -+ -+static struct kobject *pisnd_kobj; -+ -+static ssize_t pisnd_serial_show( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ char *buf -+ ) -+{ -+ return sprintf(buf, "%s\n", pisnd_spi_get_serial()); -+} -+ -+static ssize_t pisnd_id_show( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ char *buf -+ ) -+{ -+ return sprintf(buf, "%s\n", pisnd_spi_get_id()); -+} -+ -+static ssize_t pisnd_version_show( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ char *buf -+ ) -+{ -+ return sprintf(buf, "%s\n", pisnd_spi_get_version()); -+} -+ -+static struct kobj_attribute pisnd_serial_attribute = -+ __ATTR(serial, 0644, pisnd_serial_show, NULL); -+static struct kobj_attribute pisnd_id_attribute = -+ __ATTR(id, 0644, pisnd_id_show, NULL); -+static struct kobj_attribute pisnd_version_attribute = -+ __ATTR(version, 0644, pisnd_version_show, NULL); -+ -+static struct attribute *attrs[] = { -+ &pisnd_serial_attribute.attr, -+ &pisnd_id_attribute.attr, -+ &pisnd_version_attribute.attr, -+ NULL -+}; -+ -+static struct attribute_group attr_group = { .attrs = attrs }; -+ -+static int pisnd_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ int i; -+ -+ ret = pisnd_spi_init(&pdev->dev); -+ if (ret < 0) { -+ printe("pisnd_spi_init failed: %d\n", ret); -+ return ret; -+ } -+ -+ printi("Detected pisound card:\n"); -+ printi("\tSerial: %s\n", pisnd_spi_get_serial()); -+ printi("\tVersion: %s\n", pisnd_spi_get_version()); -+ printi("\tId: %s\n", pisnd_spi_get_id()); -+ -+ pisnd_kobj = kobject_create_and_add("pisound", kernel_kobj); -+ if (!pisnd_kobj) { -+ pisnd_spi_uninit(); -+ return -ENOMEM; -+ } -+ -+ ret = sysfs_create_group(pisnd_kobj, &attr_group); -+ if (ret < 0) { -+ pisnd_spi_uninit(); -+ kobject_put(pisnd_kobj); -+ return -ENOMEM; -+ } -+ -+ pisnd_init_gpio(&pdev->dev); -+ pisnd_card.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ -+ i2s_node = of_parse_phandle( -+ pdev->dev.of_node, -+ "i2s-controller", -+ 0 -+ ); -+ -+ for (i = 0; i < pisnd_card.num_links; ++i) { -+ struct snd_soc_dai_link *dai = &pisnd_dai[i]; -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ dai->stream_name = pisnd_spi_get_serial(); -+ } -+ } -+ } -+ -+ ret = snd_soc_register_card(&pisnd_card); -+ -+ if (ret < 0) { -+ printe("snd_soc_register_card() failed: %d\n", ret); -+ pisnd_uninit_gpio(); -+ kobject_put(pisnd_kobj); -+ pisnd_spi_uninit(); -+ } -+ -+ return ret; -+} -+ -+static int pisnd_remove(struct platform_device *pdev) -+{ -+ printi("Unloading.\n"); -+ -+ if (pisnd_kobj) { -+ kobject_put(pisnd_kobj); -+ pisnd_kobj = NULL; -+ } -+ -+ pisnd_spi_uninit(); -+ -+ /* Turn off */ -+ gpiod_set_value(reset, false); -+ pisnd_uninit_gpio(); -+ -+ return snd_soc_unregister_card(&pisnd_card); -+} -+ -+MODULE_DEVICE_TABLE(of, pisound_of_match); -+ -+static struct platform_driver pisnd_driver = { -+ .driver = { -+ .name = "snd-rpi-pisound", -+ .owner = THIS_MODULE, -+ .of_match_table = pisound_of_match, -+ }, -+ .probe = pisnd_probe, -+ .remove = pisnd_remove, -+}; -+ -+module_platform_driver(pisnd_driver); -+ -+MODULE_AUTHOR("Giedrius Trainavicius "); -+MODULE_DESCRIPTION("ASoC Driver for pisound, http://blokas.io/pisound"); -+MODULE_LICENSE("GPL v2"); - -From 96f367ff7d360c52f563775dd1e9cee71aa63c6d Mon Sep 17 00:00:00 2001 -From: P33M -Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 085/122] rpi_display: add backlight driver and overlay - -Add a mailbox-driven backlight controller for the Raspberry Pi DSI -touchscreen display. Requires updated GPU firmware to recognise the -mailbox request. - -Signed-off-by: Gordon Hollingworth ---- - drivers/video/backlight/Kconfig | 6 ++ - drivers/video/backlight/Makefile | 1 + - drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++++++++++ - 3 files changed, 126 insertions(+) - create mode 100644 drivers/video/backlight/rpi_backlight.c - -diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig -index 5ffa4b4e26c0e874d3f63068456b3d72d8b4beb5..c3023ab052b477dde522a262a360ec312e94de22 100644 ---- a/drivers/video/backlight/Kconfig -+++ b/drivers/video/backlight/Kconfig -@@ -265,6 +265,12 @@ config BACKLIGHT_PWM - If you have a LCD backlight adjustable by PWM, say Y to enable - this driver. - -+config BACKLIGHT_RPI -+ tristate "Raspberry Pi display firmware driven backlight" -+ help -+ If you have the Raspberry Pi DSI touchscreen display, say Y to -+ enable the mailbox-controlled backlight driver. -+ - config BACKLIGHT_DA903X - tristate "Backlight Driver for DA9030/DA9034 using WLED" - depends on PMIC_DA903X -diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile -index 16ec534cff3044209adbae3495c19d97fee3ef73..00eff87fb3391300e78f055fa05d3b9647fa053d 100644 ---- a/drivers/video/backlight/Makefile -+++ b/drivers/video/backlight/Makefile -@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o - obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o - obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o - obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o -+obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o - obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o - obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o - obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o -diff --git a/drivers/video/backlight/rpi_backlight.c b/drivers/video/backlight/rpi_backlight.c -new file mode 100644 -index 0000000000000000000000000000000000000000..14a0d9b037395497c1fdae2961feccd509fcbaad ---- /dev/null -+++ b/drivers/video/backlight/rpi_backlight.c -@@ -0,0 +1,119 @@ -+/* -+ * rpi_bl.c - Backlight controller through VPU -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct rpi_backlight { -+ struct device *dev; -+ struct device *fbdev; -+ struct rpi_firmware *fw; -+}; -+ -+static int rpi_backlight_update_status(struct backlight_device *bl) -+{ -+ struct rpi_backlight *gbl = bl_get_data(bl); -+ int brightness = bl->props.brightness; -+ int ret; -+ -+ if (bl->props.power != FB_BLANK_UNBLANK || -+ bl->props.fb_blank != FB_BLANK_UNBLANK || -+ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) -+ brightness = 0; -+ -+ ret = rpi_firmware_property(gbl->fw, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT, -+ &brightness, sizeof(brightness)); -+ if (ret) { -+ dev_err(gbl->dev, "Failed to set brightness\n"); -+ return ret; -+ } -+ -+ if (brightness < 0) { -+ dev_err(gbl->dev, "Backlight change failed\n"); -+ return -EAGAIN; -+ } -+ -+ return 0; -+} -+ -+static const struct backlight_ops rpi_backlight_ops = { -+ .options = BL_CORE_SUSPENDRESUME, -+ .update_status = rpi_backlight_update_status, -+}; -+ -+static int rpi_backlight_probe(struct platform_device *pdev) -+{ -+ struct backlight_properties props; -+ struct backlight_device *bl; -+ struct rpi_backlight *gbl; -+ struct device_node *fw_node; -+ -+ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); -+ if (gbl == NULL) -+ return -ENOMEM; -+ -+ gbl->dev = &pdev->dev; -+ -+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); -+ if (!fw_node) { -+ dev_err(&pdev->dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ gbl->fw = rpi_firmware_get(fw_node); -+ if (!gbl->fw) -+ return -EPROBE_DEFER; -+ -+ memset(&props, 0, sizeof(props)); -+ props.type = BACKLIGHT_RAW; -+ props.max_brightness = 255; -+ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), -+ &pdev->dev, gbl, &rpi_backlight_ops, -+ &props); -+ if (IS_ERR(bl)) { -+ dev_err(&pdev->dev, "failed to register backlight\n"); -+ return PTR_ERR(bl); -+ } -+ -+ bl->props.brightness = 255; -+ backlight_update_status(bl); -+ -+ platform_set_drvdata(pdev, bl); -+ return 0; -+} -+ -+static const struct of_device_id rpi_backlight_of_match[] = { -+ { .compatible = "raspberrypi,rpi-backlight" }, -+ { /* sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, rpi_backlight_of_match); -+ -+static struct platform_driver rpi_backlight_driver = { -+ .driver = { -+ .name = "rpi-backlight", -+ .of_match_table = of_match_ptr(rpi_backlight_of_match), -+ }, -+ .probe = rpi_backlight_probe, -+}; -+ -+module_platform_driver(rpi_backlight_driver); -+ -+MODULE_AUTHOR("Gordon Hollingworth "); -+MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); -+MODULE_LICENSE("GPL"); - -From 859fe9e43315cc5f8ec150814ac4d841c9bfdcf1 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 086/122] bcm2835-virtgpio: Virtual GPIO driver - -Add a virtual GPIO driver that uses the firmware mailbox interface to -request that the VPU toggles LEDs. ---- - drivers/gpio/Kconfig | 6 + - drivers/gpio/Makefile | 1 + - drivers/gpio/gpio-bcm-virt.c | 214 +++++++++++++++++++++++++++++ - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 4 files changed, 222 insertions(+) - create mode 100644 drivers/gpio/gpio-bcm-virt.c - -diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig -index ed37e5908b910cd51cb378ffc171fe2a9104c082..edcb49f9051b703ce35fd1687a6cef8a31bf3627 100644 ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -134,6 +134,12 @@ config GPIO_BCM_KONA - help - Turn on GPIO support for Broadcom "Kona" chips. - -+config GPIO_BCM_VIRT -+ bool "Broadcom Virt GPIO" -+ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || COMPILE_TEST) -+ help -+ Turn on virtual GPIO support for Broadcom BCM283X chips. -+ - config GPIO_BRCMSTB - tristate "BRCMSTB GPIO support" - default y if (ARCH_BRCMSTB || BMIPS_GENERIC) -diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile -index d074c2299393dc9cef3456b0068ff2d229677c27..cfb8d4bad6b0b20bed56643b0870fcff311c12c5 100644 ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -31,6 +31,7 @@ obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o - obj-$(CONFIG_GPIO_AXP209) += gpio-axp209.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o -+obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o - obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o - obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o - obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o -diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c -new file mode 100644 -index 0000000000000000000000000000000000000000..c3725546def9d4a6264fbb1f6b9814d02b50e34e ---- /dev/null -+++ b/drivers/gpio/gpio-bcm-virt.c -@@ -0,0 +1,214 @@ -+/* -+ * brcmvirt GPIO driver -+ * -+ * Copyright (C) 2012,2013 Dom Cobley -+ * Based on gpio-clps711x.c by Alexander Shiyan -+ * -+ * 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 -+ -+#define MODULE_NAME "brcmvirt-gpio" -+#define NUM_GPIO 2 -+ -+struct brcmvirt_gpio { -+ struct gpio_chip gc; -+ u32 __iomem *ts_base; -+ /* two packed 16-bit counts of enabled and disables -+ Allows host to detect a brief enable that was missed */ -+ u32 enables_disables[NUM_GPIO]; -+ dma_addr_t bus_addr; -+}; -+ -+static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) -+{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ return -EINVAL; -+} -+ -+static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ return 0; -+} -+ -+static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) -+{ -+ struct brcmvirt_gpio *gpio; -+ unsigned v; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ v = readl(gpio->ts_base + off); -+ return (v >> off) & 1; -+} -+ -+static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) -+{ -+ struct brcmvirt_gpio *gpio; -+ u16 enables, disables; -+ s16 diff; -+ bool lit; -+ gpio = container_of(gc, struct brcmvirt_gpio, gc); -+ enables = gpio->enables_disables[off] >> 16; -+ disables = gpio->enables_disables[off] >> 0; -+ diff = (s16)(enables - disables); -+ lit = diff > 0; -+ if ((val && lit) || (!val && !lit)) -+ return; -+ if (val) -+ enables++; -+ else -+ disables++; -+ diff = (s16)(enables - disables); -+ BUG_ON(diff != 0 && diff != 1); -+ gpio->enables_disables[off] = (enables << 16) | (disables << 0); -+ writel(gpio->enables_disables[off], gpio->ts_base + off); -+} -+ -+static int brcmvirt_gpio_probe(struct platform_device *pdev) -+{ -+ int err = 0; -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct device_node *fw_node; -+ struct rpi_firmware *fw; -+ struct brcmvirt_gpio *ucb; -+ u32 gpiovirtbuf; -+ -+ fw_node = of_parse_phandle(np, "firmware", 0); -+ if (!fw_node) { -+ dev_err(dev, "Missing firmware node\n"); -+ return -ENOENT; -+ } -+ -+ fw = rpi_firmware_get(fw_node); -+ if (!fw) -+ return -EPROBE_DEFER; -+ -+ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); -+ if (!ucb) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ ucb->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ucb->bus_addr, GFP_KERNEL); -+ if (!ucb->ts_base) { -+ pr_err("[%s]: failed to dma_alloc_coherent(%ld)\n", -+ __func__, PAGE_SIZE); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ gpiovirtbuf = (u32)ucb->bus_addr; -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_SET_GPIOVIRTBUF, -+ &gpiovirtbuf, sizeof(gpiovirtbuf)); -+ -+ if (err || gpiovirtbuf != 0) { -+ dev_warn(dev, "Failed to set gpiovirtbuf, trying to get err:%x\n", err); -+ dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr); -+ ucb->ts_base = 0; -+ ucb->bus_addr = 0; -+ } -+ -+ if (!ucb->ts_base) { -+ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, -+ &gpiovirtbuf, sizeof(gpiovirtbuf)); -+ -+ if (err) { -+ dev_err(dev, "Failed to get gpiovirtbuf\n"); -+ goto out; -+ } -+ -+ if (!gpiovirtbuf) { -+ dev_err(dev, "No virtgpio buffer\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ -+ // mmap the physical memory -+ gpiovirtbuf &= ~0xc0000000; -+ ucb->ts_base = ioremap(gpiovirtbuf, 4096); -+ if (ucb->ts_base == NULL) { -+ dev_err(dev, "Failed to map physical address\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ ucb->bus_addr = 0; -+ } -+ ucb->gc.label = MODULE_NAME; -+ ucb->gc.owner = THIS_MODULE; -+ //ucb->gc.dev = dev; -+ ucb->gc.of_node = np; -+ ucb->gc.base = 100; -+ ucb->gc.ngpio = NUM_GPIO; -+ -+ ucb->gc.direction_input = brcmvirt_gpio_dir_in; -+ ucb->gc.direction_output = brcmvirt_gpio_dir_out; -+ ucb->gc.get = brcmvirt_gpio_get; -+ ucb->gc.set = brcmvirt_gpio_set; -+ ucb->gc.can_sleep = true; -+ -+ err = gpiochip_add(&ucb->gc); -+ if (err) -+ goto out; -+ -+ platform_set_drvdata(pdev, ucb); -+ -+ return 0; -+out: -+ if (ucb->bus_addr) { -+ dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr); -+ ucb->bus_addr = 0; -+ ucb->ts_base = NULL; -+ } else if (ucb->ts_base) { -+ iounmap(ucb->ts_base); -+ ucb->ts_base = NULL; -+ } -+ return err; -+} -+ -+static int brcmvirt_gpio_remove(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ int err = 0; -+ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); -+ -+ gpiochip_remove(&ucb->gc); -+ if (ucb->bus_addr) -+ dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr); -+ else if (ucb->ts_base) -+ iounmap(ucb->ts_base); -+ return err; -+} -+ -+static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { -+ { .compatible = "brcm,bcm2835-virtgpio" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); -+ -+static struct platform_driver brcmvirt_gpio_driver = { -+ .driver = { -+ .name = MODULE_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), -+ }, -+ .probe = brcmvirt_gpio_probe, -+ .remove = brcmvirt_gpio_remove, -+}; -+module_platform_driver(brcmvirt_gpio_driver); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Dom Cobley "); -+MODULE_DESCRIPTION("brcmvirt GPIO driver"); -+MODULE_ALIAS("platform:brcmvirt-gpio"); -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index b0f6e33bd30c35664ceee057f4c3ad32b914291d..e92278968b2b979db2a1f855f70e7aafb224fa98 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -116,6 +116,7 @@ enum rpi_firmware_property_tag { - RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, - RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, - RPI_FIRMWARE_FRAMEBUFFER_SET_TOUCHBUF = 0x0004801f, -+ RPI_FIRMWARE_FRAMEBUFFER_SET_GPIOVIRTBUF = 0x00048020, - RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, - RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, - - -From 7968227bc3b1b0b1297b304fbfd4a76de6a1f40e Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 087/122] amba_pl011: Don't use DT aliases for numbering - -The pl011 driver looks for DT aliases of the form "serial", -and if found uses as the device ID. This can cause -/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the -other serial port is provided by the 8250 driver which doesn't -use the same logic. ---- - drivers/tty/serial/amba-pl011.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index e2c33b9528d82ed7a2c27d083d7b1d222da68178..5a11ff833e1fd112ba04df3a427cd94bf6793ec5 100644 ---- a/drivers/tty/serial/amba-pl011.c -+++ b/drivers/tty/serial/amba-pl011.c -@@ -2441,7 +2441,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, - if (IS_ERR(base)) - return PTR_ERR(base); - -+ /* Don't use DT serial aliases - it causes the device to -+ be renumbered to ttyAMA1 if it is the second serial port in the -+ system, even though the other one is ttyS0. The 8250 driver -+ doesn't use this logic, so always remains ttyS0. - index = pl011_probe_dt_alias(index, dev); -+ */ - - uap->old_cr = 0; - uap->port.dev = dev; - -From 0dba8271302e1c9a96f1ead8f5a7b9a0ffc7325e Mon Sep 17 00:00:00 2001 -From: Pantelis Antoniou -Date: Wed, 3 Dec 2014 13:23:28 +0200 -Subject: [PATCH 088/122] 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 ---- - Documentation/devicetree/configfs-overlays.txt | 31 +++ - drivers/of/Kconfig | 7 + - drivers/of/Makefile | 1 + - drivers/of/configfs.c | 311 +++++++++++++++++++++++++ - 4 files changed, 350 insertions(+) - create mode 100644 Documentation/devicetree/configfs-overlays.txt - create mode 100644 drivers/of/configfs.c - -diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..5fa43e0643072c7963daddc18cec7772910378ad ---- /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 ba7b034b2b91c94afb1b7135cdee7fc3d6955828..de0da10d66e6cdc6eedc4d36cf247370627f83f4 100644 ---- a/drivers/of/Kconfig -+++ b/drivers/of/Kconfig -@@ -112,4 +112,11 @@ config OF_OVERLAY - config OF_NUMA - bool - -+config OF_CONFIGFS -+ bool "Device Tree Overlay ConfigFS interface" -+ select CONFIGFS_FS -+ select OF_OVERLAY -+ help -+ Enable a simple user-space driven DT overlay interface. -+ - endif # OF -diff --git a/drivers/of/Makefile b/drivers/of/Makefile -index d7efd9d458aab4554139e93c72a1688aa0eeef6a..aa5ef9dd1fedc14d4ae2d363818fc160df51bad9 100644 ---- a/drivers/of/Makefile -+++ b/drivers/of/Makefile -@@ -1,4 +1,5 @@ - obj-y = base.o device.o platform.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 0000000000000000000000000000000000000000..0037e6868a6cda8706c88194c6a4454b6ea6cad7 ---- /dev/null -+++ b/drivers/of/configfs.c -@@ -0,0 +1,311 @@ -+/* -+ * 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 int create_overlay(struct cfs_overlay_item *overlay, void *blob) -+{ -+ int err; -+ -+ /* unflatten the tree */ -+ of_fdt_unflatten_tree(blob, NULL, &overlay->overlay); -+ if (overlay->overlay == NULL) { -+ pr_err("%s: failed to unflatten tree\n", __func__); -+ err = -EINVAL; -+ goto out_err; -+ } -+ pr_debug("%s: unflattened OK\n", __func__); -+ -+ /* mark it as detached */ -+ of_node_set_flag(overlay->overlay, OF_DETACHED); -+ -+ /* perform resolution */ -+ err = of_resolve_phandles(overlay->overlay); -+ if (err != 0) { -+ pr_err("%s: Failed to resolve tree\n", __func__); -+ goto out_err; -+ } -+ pr_debug("%s: resolved OK\n", __func__); -+ -+ err = of_overlay_create(overlay->overlay); -+ if (err < 0) { -+ pr_err("%s: Failed to create overlay (err=%d)\n", -+ __func__, err); -+ goto out_err; -+ } -+ overlay->ov_id = err; -+ -+out_err: -+ return err; -+} -+ -+static inline struct cfs_overlay_item *to_cfs_overlay_item( -+ struct config_item *item) -+{ -+ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; -+} -+ -+static ssize_t cfs_overlay_item_path_show(struct config_item *item, -+ char *page) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ return sprintf(page, "%s\n", overlay->path); -+} -+ -+static ssize_t cfs_overlay_item_path_store(struct config_item *item, -+ const char *page, size_t count) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ const char *p = page; -+ char *s; -+ int err; -+ -+ /* if it's set do not allow changes */ -+ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) -+ return -EPERM; -+ -+ /* copy to path buffer (and make sure it's always zero terminated */ -+ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); -+ overlay->path[sizeof(overlay->path) - 1] = '\0'; -+ -+ /* strip trailing newlines */ -+ s = overlay->path + strlen(overlay->path); -+ while (s > overlay->path && *--s == '\n') -+ *s = '\0'; -+ -+ pr_debug("%s: path is '%s'\n", __func__, overlay->path); -+ -+ err = request_firmware(&overlay->fw, overlay->path, NULL); -+ if (err != 0) -+ goto out_err; -+ -+ err = create_overlay(overlay, (void *)overlay->fw->data); -+ if (err != 0) -+ goto out_err; -+ -+ return count; -+ -+out_err: -+ -+ release_firmware(overlay->fw); -+ overlay->fw = NULL; -+ -+ overlay->path[0] = '\0'; -+ return err; -+} -+ -+static ssize_t cfs_overlay_item_status_show(struct config_item *item, -+ char *page) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ return sprintf(page, "%s\n", -+ overlay->ov_id >= 0 ? "applied" : "unapplied"); -+} -+ -+CONFIGFS_ATTR(cfs_overlay_item_, path); -+CONFIGFS_ATTR_RO(cfs_overlay_item_, status); -+ -+static struct configfs_attribute *cfs_overlay_attrs[] = { -+ &cfs_overlay_item_attr_path, -+ &cfs_overlay_item_attr_status, -+ NULL, -+}; -+ -+ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, -+ void *buf, size_t max_count) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ pr_debug("%s: buf=%p max_count=%zu\n", __func__, -+ buf, max_count); -+ -+ if (overlay->dtbo == NULL) -+ return 0; -+ -+ /* copy if buffer provided */ -+ if (buf != NULL) { -+ /* the buffer must be large enough */ -+ if (overlay->dtbo_size > max_count) -+ return -ENOSPC; -+ -+ memcpy(buf, overlay->dtbo, overlay->dtbo_size); -+ } -+ -+ return overlay->dtbo_size; -+} -+ -+ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, -+ const void *buf, size_t count) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ int err; -+ -+ /* if it's set do not allow changes */ -+ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) -+ return -EPERM; -+ -+ /* copy the contents */ -+ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); -+ if (overlay->dtbo == NULL) -+ return -ENOMEM; -+ -+ overlay->dtbo_size = count; -+ -+ err = create_overlay(overlay, overlay->dtbo); -+ if (err != 0) -+ goto out_err; -+ -+ return count; -+ -+out_err: -+ kfree(overlay->dtbo); -+ overlay->dtbo = NULL; -+ overlay->dtbo_size = 0; -+ -+ return err; -+} -+ -+CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); -+ -+static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { -+ &cfs_overlay_item_attr_dtbo, -+ NULL, -+}; -+ -+static void cfs_overlay_release(struct config_item *item) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ if (overlay->ov_id >= 0) -+ of_overlay_destroy(overlay->ov_id); -+ if (overlay->fw) -+ release_firmware(overlay->fw); -+ /* kfree with NULL is safe */ -+ kfree(overlay->dtbo); -+ kfree(overlay); -+} -+ -+static struct configfs_item_operations cfs_overlay_item_ops = { -+ .release = cfs_overlay_release, -+}; -+ -+static struct config_item_type cfs_overlay_type = { -+ .ct_item_ops = &cfs_overlay_item_ops, -+ .ct_attrs = cfs_overlay_attrs, -+ .ct_bin_attrs = cfs_overlay_bin_attrs, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct config_item *cfs_overlay_group_make_item( -+ struct config_group *group, const char *name) -+{ -+ struct cfs_overlay_item *overlay; -+ -+ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); -+ if (!overlay) -+ return ERR_PTR(-ENOMEM); -+ overlay->ov_id = -1; -+ -+ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); -+ return &overlay->item; -+} -+ -+static void cfs_overlay_group_drop_item(struct config_group *group, -+ struct config_item *item) -+{ -+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); -+ -+ config_item_put(&overlay->item); -+} -+ -+static struct configfs_group_operations overlays_ops = { -+ .make_item = cfs_overlay_group_make_item, -+ .drop_item = cfs_overlay_group_drop_item, -+}; -+ -+static struct config_item_type overlays_type = { -+ .ct_group_ops = &overlays_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct configfs_group_operations of_cfs_ops = { -+ /* empty - we don't allow anything to be created */ -+}; -+ -+static struct config_item_type of_cfs_type = { -+ .ct_group_ops = &of_cfs_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+struct config_group of_cfs_overlay_group; -+ -+static struct configfs_subsystem of_cfs_subsys = { -+ .su_group = { -+ .cg_item = { -+ .ci_namebuf = "device-tree", -+ .ci_type = &of_cfs_type, -+ }, -+ }, -+ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), -+}; -+ -+static int __init of_cfs_init(void) -+{ -+ int ret; -+ -+ pr_info("%s\n", __func__); -+ -+ config_group_init(&of_cfs_subsys.su_group); -+ config_group_init_type_name(&of_cfs_overlay_group, "overlays", -+ &overlays_type); -+ configfs_add_default_group(&of_cfs_overlay_group, -+ &of_cfs_subsys.su_group); -+ -+ ret = configfs_register_subsystem(&of_cfs_subsys); -+ if (ret != 0) { -+ pr_err("%s: failed to register subsys\n", __func__); -+ goto out; -+ } -+ pr_info("%s: OK\n", __func__); -+out: -+ return ret; -+} -+late_initcall(of_cfs_init); - -From 7599baf5d2f2a063d430fce4de57db739ac1d05c Mon Sep 17 00:00:00 2001 -From: Cheong2K -Date: Fri, 26 Feb 2016 18:20:10 +0800 -Subject: [PATCH 089/122] brcm: adds support for BCM43341 wifi - -brcmfmac: Disable power management - -Disable wireless power saving in the brcmfmac WLAN driver. This is a -temporary measure until the connectivity loss resulting from power -saving is resolved. - -Signed-off-by: Phil Elwell - -brcmfmac: Use original country code as a fallback - -Commit 73345fd212980d2e28a5c6d83801c903bd773680: - - brcmfmac: Configure country code using device specific settings - -prevents region codes from working on devices that lack a region code -translation table. In the event of an absent table, preserve the old -behaviour of using the provided code as-is. - -Signed-off-by: Phil Elwell - -brcmfmac: Plug memory leak in brcmf_fill_bss_param - -See: https://github.com/raspberrypi/linux/issues/1471 - -Signed-off-by: Phil Elwell - -brcmfmac: do not use internal roaming engine by default - -Some evidence of curing disconnects with this disabled, so make it a default. -Can be overridden with module parameter roamoff=0 -See: http://projectable.me/optimize-my-pi-wi-fi/ - -brcmfmac: Change stop_ap sequence - -Patch from Broadcom/Cypress to resolve a customer error - -Signed-off-by: Phil Elwell ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 31 ++++++++++++++++------ - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ - .../broadcom/brcm80211/include/brcm_hw_ids.h | 1 + - 4 files changed, 27 insertions(+), 9 deletions(-) - -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 78d9966a3957b2b934fe6b21de5cade494ec2839..3fcb1887b2d312e050c02e9fe66ea20f48f0abcb 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2756,6 +2756,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, - * preference in cfg struct to apply this to - * FW later while initializing the dongle - */ -+ pr_info("power management disabled\n"); -+ enabled = false; - cfg->pwr_save = enabled; - if (!check_vif_up(ifp->vif)) { - -@@ -4750,12 +4752,15 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); - if (err < 0) - brcmf_err("BRCMF_C_DOWN error %d\n", err); -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); -- if (err < 0) -- brcmf_err("setting AP mode failed %d\n", err); -+ - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 0); - if (err < 0) - brcmf_err("setting INFRA mode failed %d\n", err); -+ -+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); -+ if (err < 0) -+ brcmf_err("setting AP mode failed %d\n", err); -+ - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) - brcmf_fil_iovar_int_set(ifp, "mbss", 0); - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, -@@ -6737,12 +6742,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], - struct brcmfmac_pd_cc *country_codes; - struct brcmfmac_pd_cc_entry *cc; - s32 found_index; -+ char ccode[BRCMF_COUNTRY_BUF_SZ]; -+ int rev; - int i; - -+ memcpy(ccode, alpha2, sizeof(ccode)); -+ rev = -1; -+ - country_codes = drvr->settings->country_codes; - if (!country_codes) { -- brcmf_dbg(TRACE, "No country codes configured for device\n"); -- return -EINVAL; -+ brcmf_dbg(TRACE, "No country codes configured for device" -+ " - use requested value\n"); -+ goto use_input_value; - } - - if ((alpha2[0] == ccreq->country_abbrev[0]) && -@@ -6766,10 +6777,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], - brcmf_dbg(TRACE, "No country code match found\n"); - return -EINVAL; - } -- memset(ccreq, 0, sizeof(*ccreq)); -- ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); -- memcpy(ccreq->ccode, country_codes->table[found_index].cc, -+ rev = country_codes->table[found_index].rev; -+ memcpy(ccode, country_codes->table[found_index].cc, - BRCMF_COUNTRY_BUF_SZ); -+ -+use_input_value: -+ memset(ccreq, 0, sizeof(*ccreq)); -+ ccreq->rev = cpu_to_le32(rev); -+ memcpy(ccreq->ccode, ccode, sizeof(ccode)); - ccreq->country_abbrev[0] = alpha2[0]; - ccreq->country_abbrev[1] = alpha2[1]; - ccreq->country_abbrev[2] = 0; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -index 3e15d64c64813513bc22202dd9e468588699abb0..4051780f64f44a5ce522babe6c371a1beb79a824 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -69,7 +69,7 @@ static int brcmf_fcmode; - module_param_named(fcmode, brcmf_fcmode, int, 0); - MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control"); - --static int brcmf_roamoff; -+static int brcmf_roamoff = 1; - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR); - MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); - -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -index b892dac70f4b02f76e01a7ccb580c6d8aed4bfe4..db5f8b70b407879f1c006ca4b7ab78d12974609d 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -604,6 +604,7 @@ BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); - BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); -+BRCMF_FW_NVRAM_DEF(43341, "brcmfmac43341-sdio.bin", "brcmfmac43341-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); - BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); - BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); -@@ -621,6 +622,7 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43341), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), -diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -index d0407d9ad7827cd756b6311410ffe2d9a7cacc78..f1fb8a3c7a3211e8429585861f2f42e014878654 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -@@ -36,6 +36,7 @@ - #define BRCM_CC_4330_CHIP_ID 0x4330 - #define BRCM_CC_4334_CHIP_ID 0x4334 - #define BRCM_CC_43340_CHIP_ID 43340 -+#define BRCM_CC_43341_CHIP_ID 43341 - #define BRCM_CC_43362_CHIP_ID 43362 - #define BRCM_CC_4335_CHIP_ID 0x4335 - #define BRCM_CC_4339_CHIP_ID 0x4339 - -From 409e8d08947ff33556f6bcb8eb6bfdc47613ce6b Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 090/122] hci_h5: Don't send conf_req when ACTIVE - -Without this patch, a modem and kernel can continuously bombard each -other with conf_req and conf_rsp messages, in a demented game of tag. ---- - drivers/bluetooth/hci_h5.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c -index 0879d64b1caf58afb6e5d494c07d9ab7e7cdf983..5161ab30fd533d50f516bb93d5b9f402422e2974 100644 ---- a/drivers/bluetooth/hci_h5.c -+++ b/drivers/bluetooth/hci_h5.c -@@ -310,7 +310,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) - h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_req, 2) == 0) { - h5_link_control(hu, conf_rsp, 2); -- h5_link_control(hu, conf_req, 3); -+ if (h5->state != H5_ACTIVE) -+ h5_link_control(hu, conf_req, 3); - } else if (memcmp(data, conf_rsp, 2) == 0) { - if (H5_HDR_LEN(hdr) > 2) - h5->tx_win = (data[2] & 0x07); - -From 5fd6ff953ace9d64a39412f410b4a6eb09dd4711 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 091/122] config: Add default configs - ---- - arch/arm/configs/bcm2709_defconfig | 1297 +++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1308 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 2605 insertions(+) - create mode 100644 arch/arm/configs/bcm2709_defconfig - create mode 100644 arch/arm/configs/bcmrpi_defconfig - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..12e8155c175deaecea6fcf1f81ec3f6c1ddf5f7c ---- /dev/null -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1297 @@ -+CONFIG_LOCALVERSION="-v7" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_NMI_LOG_BUF_SHIFT=12 -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_NAMESPACES=y -+CONFIG_USER_NS=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM=y -+CONFIG_ARCH_BCM2835=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_SMP=y -+CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y -+CONFIG_VFP=y -+CONFIG_NEON=y -+CONFIG_KERNEL_MODE_NEON=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_DIAG=m -+CONFIG_IPV6=m -+CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_SUBTREES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_RPFILTER=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RPFILTER=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_CFG80211=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_OF_CONFIGFS=y -+CONFIG_ZRAM=m -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_VXLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_QCA7000=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_AT76C50X_USB=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_MT7601U=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_RTL8187=m -+CONFIG_RTL8192CU=m -+CONFIG_USB_ZD1201=m -+CONFIG_ZD1211RW=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_XPAD_LEDS=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_EKTF2127=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_8250_EXTENDED=y -+CONFIG_SERIAL_8250_SHARE_IRQ=y -+CONFIG_SERIAL_8250_BCM2835AUX=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_SC16IS7XX=m -+CONFIG_SERIAL_SC16IS7XX_SPI=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_MUX_PCA954x=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m -+CONFIG_I2C_GPIO=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_VIRT=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_GPIO_MCP23S08=m -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_BATTERY_DS2760=m -+CONFIG_HWMON=m -+CONFIG_SENSORS_LM75=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_SENSORS_INA2XX=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_LOAD_EDID_FIRMWARE=y -+CONFIG_DRM_UDL=m -+CONFIG_DRM_VC4=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -+CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -+CONFIG_SND_DIGIDAC1_SOUNDCARD=m -+CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -+CONFIG_SND_PISOUND=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_AK4554=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_BETOP_FF=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_GEMBIRD=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_LOGITECH_DJ=m -+CONFIG_LOGITECH_FF=y -+CONFIG_LOGIRUMBLEPAD2_FF=y -+CONFIG_LOGIG940_FF=y -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_LEDS_TRIGGER_PANIC=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_ABX80X=m -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1302=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_HX8357D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_RASPBERRYPI_POWER=y -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_MCP3422=m -+CONFIG_DHT11=m -+CONFIG_HTU21=m -+CONFIG_PWM_BCM2835=m -+CONFIG_PWM_PCA9685=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM_NEON=m -+CONFIG_CRYPTO_AES_ARM_BS=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..8acee9f31202ec14f2933d92dd70831cda8d7b51 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1308 @@ -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_NMI_LOG_BUF_SHIFT=12 -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_NAMESPACES=y -+CONFIG_USER_NS=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_MULTI_V6=y -+# CONFIG_ARCH_MULTI_V7 is not set -+CONFIG_ARCH_BCM=y -+CONFIG_ARCH_BCM2835=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_VFP=y -+CONFIG_BINFMT_MISC=m -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_DIAG=m -+CONFIG_IPV6=m -+CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_SUBTREES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_RPFILTER=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RPFILTER=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_CFG80211=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_OF_CONFIGFS=y -+CONFIG_ZRAM=m -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_VXLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_QCA7000=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_AT76C50X_USB=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_MT7601U=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_RTL8187=m -+CONFIG_RTL8192CU=m -+CONFIG_USB_ZD1201=m -+CONFIG_ZD1211RW=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_XPAD_LEDS=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VC_CMA=y -+CONFIG_BCM_VCIO=y -+CONFIG_BCM_VC_SM=y -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_8250_EXTENDED=y -+CONFIG_SERIAL_8250_SHARE_IRQ=y -+CONFIG_SERIAL_8250_BCM2835AUX=y -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_SC16IS7XX=m -+CONFIG_SERIAL_SC16IS7XX_SPI=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_MUX_PCA954x=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m -+CONFIG_I2C_GPIO=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_GPIO_MCP23S08=m -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_BATTERY_DS2760=m -+CONFIG_HWMON=m -+CONFIG_SENSORS_LM75=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_SENSORS_INA2XX=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=y -+CONFIG_VIDEO_BCM2835_MMAL=m -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_LOAD_EDID_FIRMWARE=y -+CONFIG_DRM_UDL=m -+CONFIG_DRM_VC4=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_BCM2835=m -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -+CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -+CONFIG_SND_DIGIDAC1_SOUNDCARD=m -+CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -+CONFIG_SND_PISOUND=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_AK4554=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_BETOP_FF=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_GEMBIRD=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_LOGITECH_DJ=m -+CONFIG_LOGITECH_FF=y -+CONFIG_LOGIRUMBLEPAD2_FF=y -+CONFIG_LOGIG940_FF=y -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_USB_GADGET=m -+CONFIG_USB_ZERO=m -+CONFIG_USB_AUDIO=m -+CONFIG_USB_ETH=m -+CONFIG_USB_GADGETFS=m -+CONFIG_USB_MASS_STORAGE=m -+CONFIG_USB_G_SERIAL=m -+CONFIG_USB_MIDI_GADGET=m -+CONFIG_USB_G_PRINTER=m -+CONFIG_USB_CDC_COMPOSITE=m -+CONFIG_USB_G_ACM_MS=m -+CONFIG_USB_G_MULTI=m -+CONFIG_USB_G_HID=m -+CONFIG_USB_G_WEBCAM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_LEDS_TRIGGER_PANIC=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_ABX80X=m -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1302=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_HX8357D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_RASPBERRYPI_POWER=y -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_MCP3422=m -+CONFIG_DHT11=m -+CONFIG_HTU21=m -+CONFIG_PWM_BCM2835=m -+CONFIG_PWM_PCA9685=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CRYPTD=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_SHA512=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+# CONFIG_CRYPTO_HW is not set -+CONFIG_ARM_CRYPTO=y -+CONFIG_CRYPTO_SHA1_ARM=m -+CONFIG_CRYPTO_AES_ARM=m -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y - -From 7452484b501a3dd0ca66226de11cf4fb9a576390 Mon Sep 17 00:00:00 2001 -From: Michael Zoran -Date: Wed, 24 Aug 2016 03:35:56 -0700 -Subject: [PATCH 092/122] Add arm64 configuration and device tree differences. - Disable MMC_BCM2835_SDHOST and MMC_BCM2835 since these drivers are crashing - at the moment. - -ARM64: Modify default config to get raspbian to boot (#1686) - -1. Enable emulation of deprecated instructions. -2. Enable ARM 8.1 and 8.2 features which are not detected at runtime. -3. Switch the default governer to powersave. -4. Include the watchdog timer driver in the kernel image rather then a module. - -Tested with raspbian-jessie 2016-09-23. ---- - arch/arm64/Kconfig.platforms | 22 + - arch/arm64/boot/dts/broadcom/Makefile | 1 + - arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts | 3 + - arch/arm64/configs/bcmrpi3_defconfig | 1334 ++++++++++++++++++++++ - 4 files changed, 1360 insertions(+) - create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts - create mode 100644 arch/arm64/configs/bcmrpi3_defconfig - -diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms -index 101794f5ce1008b7ff007fbfc7fa23d9e63bae67..7d213c2c904271c7a4622b83cd55a750d237bc2e 100644 ---- a/arch/arm64/Kconfig.platforms -+++ b/arch/arm64/Kconfig.platforms -@@ -1,5 +1,27 @@ - menu "Platform selection" - -+config MACH_BCM2709 -+ bool -+ -+config ARCH_BCM2709 -+ bool "Broadcom BCM2709 family" -+ select MACH_BCM2709 -+ select HAVE_SMP -+ select ARM_AMBA -+ select COMMON_CLK -+ select ARCH_HAS_CPUFREQ -+ select GENERIC_CLOCKEVENTS -+ select MULTI_IRQ_HANDLER -+ select SPARSE_IRQ -+ select MFD_SYSCON -+ select VC4 -+ select USE_OF -+ select ARCH_REQUIRE_GPIOLIB -+ select PINCTRL -+ select PINCTRL_BCM2835 -+ help -+ This enables support for Broadcom BCM2709 boards. -+ - config ARCH_SUNXI - bool "Allwinner sunxi 64-bit SoC Family" - select GENERIC_IRQ_CHIP -diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index 05faf2a8a35ca5ba9049b9038dedb9be88eeb7c5..2152448c8cf5b22c573642d7ce45e85793f5fc9a 100644 ---- a/arch/arm64/boot/dts/broadcom/Makefile -+++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -1,6 +1,7 @@ - dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb - dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb - dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb -+dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb - - always := $(dtb-y) - subdir-y := $(dts-dirs) -diff --git a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..deb33441da95220db0ed672e41639626fba682a5 ---- /dev/null -+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts -@@ -0,0 +1,3 @@ -+#define RPI364 -+ -+#include "../../../../arm/boot/dts/bcm2710-rpi-3-b.dts" -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -new file mode 100644 -index 0000000000000000000000000000000000000000..d7406f5a4620151044b8f716b4d10bb818648e06 ---- /dev/null -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -0,0 +1,1334 @@ -+# CONFIG_ARM_PATCH_PHYS_VIRT is not set -+CONFIG_PHYS_OFFSET=0 -+CONFIG_LOCALVERSION="-v8" -+# CONFIG_LOCALVERSION_AUTO is not set -+CONFIG_64BIT=y -+CONFIG_SYSVIPC=y -+CONFIG_POSIX_MQUEUE=y -+CONFIG_NO_HZ=y -+CONFIG_HIGH_RES_TIMERS=y -+ -+# -+# ARM errata workarounds via the alternatives framework -+# -+CONFIG_ARM64_ERRATUM_826319=n -+CONFIG_ARM64_ERRATUM_827319=n -+CONFIG_ARM64_ERRATUM_824069=n -+CONFIG_ARM64_ERRATUM_819472=n -+CONFIG_ARM64_ERRATUM_832075=n -+CONFIG_ARM64_ERRATUM_845719=n -+CONFIG_ARM64_ERRATUM_843419=n -+CONFIG_CAVIUM_ERRATUM_22375=n -+CONFIG_CAVIUM_ERRATUM_23154=n -+CONFIG_CAVIUM_ERRATUM_27456=n -+CONFIG_ARM64_4K_PAGES=y -+CONFIG_ARM64_VA_BITS_39=y -+CONFIG_ARM64_VA_BITS=39 -+CONFIG_SCHED_MC=y -+CONFIG_NR_CPUS=4 -+CONFIG_HOTPLUG_CPU=y -+CONFIG_ARMV8_DEPRECATED=y -+CONFIG_SWP_EMULATION=y -+CONFIG_CP15_BARRIER_EMULATION=y -+CONFIG_SETEND_EMULATION=y -+ -+# -+# ARMv8.1 architectural features -+# -+CONFIG_ARM64_HW_AFDBM=y -+CONFIG_ARM64_PAN=y -+CONFIG_ARM64_LSE_ATOMICS=y -+CONFIG_ARM64_VHE=y -+ -+# -+# ARMv8.2 architectural features -+# -+CONFIG_ARM64_UAO=y -+CONFIG_ARM64_MODULE_CMODEL_LARGE=n -+CONFIG_RANDOMIZE_BASE=n -+ -+CONFIG_BSD_PROCESS_ACCT=y -+CONFIG_BSD_PROCESS_ACCT_V3=y -+CONFIG_TASKSTATS=y -+CONFIG_TASK_DELAY_ACCT=y -+CONFIG_TASK_XACCT=y -+CONFIG_TASK_IO_ACCOUNTING=y -+CONFIG_IKCONFIG=m -+CONFIG_IKCONFIG_PROC=y -+CONFIG_NMI_LOG_BUF_SHIFT=12 -+CONFIG_MEMCG=y -+CONFIG_BLK_CGROUP=y -+CONFIG_CGROUP_FREEZER=y -+CONFIG_CPUSETS=y -+CONFIG_CGROUP_DEVICE=y -+CONFIG_CGROUP_CPUACCT=y -+CONFIG_NAMESPACES=y -+CONFIG_USER_NS=y -+CONFIG_SCHED_AUTOGROUP=y -+CONFIG_BLK_DEV_INITRD=y -+CONFIG_EMBEDDED=y -+# CONFIG_COMPAT_BRK is not set -+CONFIG_PROFILING=y -+CONFIG_OPROFILE=m -+CONFIG_KPROBES=y -+CONFIG_JUMP_LABEL=y -+CONFIG_MODULES=y -+CONFIG_MODULE_UNLOAD=y -+CONFIG_MODVERSIONS=y -+CONFIG_MODULE_SRCVERSION_ALL=y -+CONFIG_TRIM_UNUSED_KSYMS=y -+CONFIG_BLK_DEV_THROTTLING=y -+CONFIG_PARTITION_ADVANCED=y -+CONFIG_MAC_PARTITION=y -+CONFIG_CFQ_GROUP_IOSCHED=y -+CONFIG_ARCH_BCM2709=y -+# CONFIG_CACHE_L2X0 is not set -+CONFIG_SMP=y -+CONFIG_HAVE_ARM_ARCH_TIMER=y -+CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT_VOLUNTARY=y -+CONFIG_AEABI=y -+CONFIG_OABI_COMPAT=y -+# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_CLEANCACHE=y -+CONFIG_FRONTSWAP=y -+CONFIG_CMA=y -+CONFIG_ZSMALLOC=m -+CONFIG_PGTABLE_MAPPING=y -+CONFIG_UACCESS_WITH_MEMCPY=y -+CONFIG_SECCOMP=y -+# CONFIG_ATAGS is not set -+CONFIG_ZBOOT_ROM_TEXT=0x0 -+CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y -+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -+CONFIG_CPU_FREQ_GOV_USERSPACE=y -+CONFIG_CPU_FREQ_GOV_ONDEMAND=y -+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y -+CONFIG_VFP=y -+CONFIG_NEON=y -+CONFIG_KERNEL_MODE_NEON=y -+CONFIG_BINFMT_MISC=m -+CONFIG_COMPAT=y -+CONFIG_SYSVIPC_COMPAT=y -+ -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_NET=y -+CONFIG_PACKET=y -+CONFIG_UNIX=y -+CONFIG_XFRM_USER=y -+CONFIG_NET_KEY=m -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+CONFIG_IP_ADVANCED_ROUTER=y -+CONFIG_IP_MULTIPLE_TABLES=y -+CONFIG_IP_ROUTE_MULTIPATH=y -+CONFIG_IP_ROUTE_VERBOSE=y -+CONFIG_IP_PNP=y -+CONFIG_IP_PNP_DHCP=y -+CONFIG_IP_PNP_RARP=y -+CONFIG_NET_IPIP=m -+CONFIG_NET_IPGRE_DEMUX=m -+CONFIG_NET_IPGRE=m -+CONFIG_IP_MROUTE=y -+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IP_PIMSM_V1=y -+CONFIG_IP_PIMSM_V2=y -+CONFIG_SYN_COOKIES=y -+CONFIG_INET_AH=m -+CONFIG_INET_ESP=m -+CONFIG_INET_IPCOMP=m -+CONFIG_INET_XFRM_MODE_TRANSPORT=m -+CONFIG_INET_XFRM_MODE_TUNNEL=m -+CONFIG_INET_XFRM_MODE_BEET=m -+CONFIG_INET_DIAG=m -+CONFIG_IPV6=m -+CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_INET6_AH=m -+CONFIG_INET6_ESP=m -+CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_TUNNEL=m -+CONFIG_IPV6_MULTIPLE_TABLES=y -+CONFIG_IPV6_SUBTREES=y -+CONFIG_IPV6_MROUTE=y -+CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -+CONFIG_IPV6_PIMSM_V2=y -+CONFIG_NETFILTER=y -+CONFIG_NF_CONNTRACK=m -+CONFIG_NF_CONNTRACK_ZONES=y -+CONFIG_NF_CONNTRACK_EVENTS=y -+CONFIG_NF_CONNTRACK_TIMESTAMP=y -+CONFIG_NF_CT_PROTO_DCCP=m -+CONFIG_NF_CT_PROTO_UDPLITE=m -+CONFIG_NF_CONNTRACK_AMANDA=m -+CONFIG_NF_CONNTRACK_FTP=m -+CONFIG_NF_CONNTRACK_H323=m -+CONFIG_NF_CONNTRACK_IRC=m -+CONFIG_NF_CONNTRACK_NETBIOS_NS=m -+CONFIG_NF_CONNTRACK_SNMP=m -+CONFIG_NF_CONNTRACK_PPTP=m -+CONFIG_NF_CONNTRACK_SANE=m -+CONFIG_NF_CONNTRACK_SIP=m -+CONFIG_NF_CONNTRACK_TFTP=m -+CONFIG_NF_CT_NETLINK=m -+CONFIG_NETFILTER_XT_SET=m -+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -+CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -+CONFIG_NETFILTER_XT_TARGET_DSCP=m -+CONFIG_NETFILTER_XT_TARGET_HMARK=m -+CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -+CONFIG_NETFILTER_XT_TARGET_LED=m -+CONFIG_NETFILTER_XT_TARGET_LOG=m -+CONFIG_NETFILTER_XT_TARGET_MARK=m -+CONFIG_NETFILTER_XT_TARGET_NFLOG=m -+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -+CONFIG_NETFILTER_XT_TARGET_TEE=m -+CONFIG_NETFILTER_XT_TARGET_TPROXY=m -+CONFIG_NETFILTER_XT_TARGET_TRACE=m -+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -+CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -+CONFIG_NETFILTER_XT_MATCH_BPF=m -+CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -+CONFIG_NETFILTER_XT_MATCH_COMMENT=m -+CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -+CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -+CONFIG_NETFILTER_XT_MATCH_CPU=m -+CONFIG_NETFILTER_XT_MATCH_DCCP=m -+CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -+CONFIG_NETFILTER_XT_MATCH_DSCP=m -+CONFIG_NETFILTER_XT_MATCH_ESP=m -+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -+CONFIG_NETFILTER_XT_MATCH_HELPER=m -+CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -+CONFIG_NETFILTER_XT_MATCH_IPVS=m -+CONFIG_NETFILTER_XT_MATCH_LENGTH=m -+CONFIG_NETFILTER_XT_MATCH_LIMIT=m -+CONFIG_NETFILTER_XT_MATCH_MAC=m -+CONFIG_NETFILTER_XT_MATCH_MARK=m -+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -+CONFIG_NETFILTER_XT_MATCH_NFACCT=m -+CONFIG_NETFILTER_XT_MATCH_OSF=m -+CONFIG_NETFILTER_XT_MATCH_OWNER=m -+CONFIG_NETFILTER_XT_MATCH_POLICY=m -+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -+CONFIG_NETFILTER_XT_MATCH_QUOTA=m -+CONFIG_NETFILTER_XT_MATCH_RATEEST=m -+CONFIG_NETFILTER_XT_MATCH_REALM=m -+CONFIG_NETFILTER_XT_MATCH_RECENT=m -+CONFIG_NETFILTER_XT_MATCH_SOCKET=m -+CONFIG_NETFILTER_XT_MATCH_STATE=m -+CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -+CONFIG_NETFILTER_XT_MATCH_STRING=m -+CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -+CONFIG_NETFILTER_XT_MATCH_TIME=m -+CONFIG_NETFILTER_XT_MATCH_U32=m -+CONFIG_IP_SET=m -+CONFIG_IP_SET_BITMAP_IP=m -+CONFIG_IP_SET_BITMAP_IPMAC=m -+CONFIG_IP_SET_BITMAP_PORT=m -+CONFIG_IP_SET_HASH_IP=m -+CONFIG_IP_SET_HASH_IPPORT=m -+CONFIG_IP_SET_HASH_IPPORTIP=m -+CONFIG_IP_SET_HASH_IPPORTNET=m -+CONFIG_IP_SET_HASH_NET=m -+CONFIG_IP_SET_HASH_NETPORT=m -+CONFIG_IP_SET_HASH_NETIFACE=m -+CONFIG_IP_SET_LIST_SET=m -+CONFIG_IP_VS=m -+CONFIG_IP_VS_PROTO_TCP=y -+CONFIG_IP_VS_PROTO_UDP=y -+CONFIG_IP_VS_PROTO_ESP=y -+CONFIG_IP_VS_PROTO_AH=y -+CONFIG_IP_VS_PROTO_SCTP=y -+CONFIG_IP_VS_RR=m -+CONFIG_IP_VS_WRR=m -+CONFIG_IP_VS_LC=m -+CONFIG_IP_VS_WLC=m -+CONFIG_IP_VS_LBLC=m -+CONFIG_IP_VS_LBLCR=m -+CONFIG_IP_VS_DH=m -+CONFIG_IP_VS_SH=m -+CONFIG_IP_VS_SED=m -+CONFIG_IP_VS_NQ=m -+CONFIG_IP_VS_FTP=m -+CONFIG_IP_VS_PE_SIP=m -+CONFIG_NF_CONNTRACK_IPV4=m -+CONFIG_IP_NF_IPTABLES=m -+CONFIG_IP_NF_MATCH_AH=m -+CONFIG_IP_NF_MATCH_ECN=m -+CONFIG_IP_NF_MATCH_RPFILTER=m -+CONFIG_IP_NF_MATCH_TTL=m -+CONFIG_IP_NF_FILTER=m -+CONFIG_IP_NF_TARGET_REJECT=m -+CONFIG_IP_NF_NAT=m -+CONFIG_IP_NF_TARGET_MASQUERADE=m -+CONFIG_IP_NF_TARGET_NETMAP=m -+CONFIG_IP_NF_TARGET_REDIRECT=m -+CONFIG_IP_NF_MANGLE=m -+CONFIG_IP_NF_TARGET_CLUSTERIP=m -+CONFIG_IP_NF_TARGET_ECN=m -+CONFIG_IP_NF_TARGET_TTL=m -+CONFIG_IP_NF_RAW=m -+CONFIG_IP_NF_ARPTABLES=m -+CONFIG_IP_NF_ARPFILTER=m -+CONFIG_IP_NF_ARP_MANGLE=m -+CONFIG_NF_CONNTRACK_IPV6=m -+CONFIG_IP6_NF_IPTABLES=m -+CONFIG_IP6_NF_MATCH_AH=m -+CONFIG_IP6_NF_MATCH_EUI64=m -+CONFIG_IP6_NF_MATCH_FRAG=m -+CONFIG_IP6_NF_MATCH_OPTS=m -+CONFIG_IP6_NF_MATCH_HL=m -+CONFIG_IP6_NF_MATCH_IPV6HEADER=m -+CONFIG_IP6_NF_MATCH_MH=m -+CONFIG_IP6_NF_MATCH_RPFILTER=m -+CONFIG_IP6_NF_MATCH_RT=m -+CONFIG_IP6_NF_TARGET_HL=m -+CONFIG_IP6_NF_FILTER=m -+CONFIG_IP6_NF_TARGET_REJECT=m -+CONFIG_IP6_NF_MANGLE=m -+CONFIG_IP6_NF_RAW=m -+CONFIG_IP6_NF_NAT=m -+CONFIG_IP6_NF_TARGET_MASQUERADE=m -+CONFIG_IP6_NF_TARGET_NPT=m -+CONFIG_BRIDGE_NF_EBTABLES=m -+CONFIG_BRIDGE_EBT_BROUTE=m -+CONFIG_BRIDGE_EBT_T_FILTER=m -+CONFIG_BRIDGE_EBT_T_NAT=m -+CONFIG_BRIDGE_EBT_802_3=m -+CONFIG_BRIDGE_EBT_AMONG=m -+CONFIG_BRIDGE_EBT_ARP=m -+CONFIG_BRIDGE_EBT_IP=m -+CONFIG_BRIDGE_EBT_IP6=m -+CONFIG_BRIDGE_EBT_LIMIT=m -+CONFIG_BRIDGE_EBT_MARK=m -+CONFIG_BRIDGE_EBT_PKTTYPE=m -+CONFIG_BRIDGE_EBT_STP=m -+CONFIG_BRIDGE_EBT_VLAN=m -+CONFIG_BRIDGE_EBT_ARPREPLY=m -+CONFIG_BRIDGE_EBT_DNAT=m -+CONFIG_BRIDGE_EBT_MARK_T=m -+CONFIG_BRIDGE_EBT_REDIRECT=m -+CONFIG_BRIDGE_EBT_SNAT=m -+CONFIG_BRIDGE_EBT_LOG=m -+CONFIG_BRIDGE_EBT_NFLOG=m -+CONFIG_SCTP_COOKIE_HMAC_SHA1=y -+CONFIG_ATM=m -+CONFIG_L2TP=m -+CONFIG_L2TP_V3=y -+CONFIG_L2TP_IP=m -+CONFIG_L2TP_ETH=m -+CONFIG_BRIDGE=m -+CONFIG_VLAN_8021Q=m -+CONFIG_VLAN_8021Q_GVRP=y -+CONFIG_ATALK=m -+CONFIG_6LOWPAN=m -+CONFIG_IEEE802154=m -+CONFIG_IEEE802154_6LOWPAN=m -+CONFIG_MAC802154=m -+CONFIG_NET_SCHED=y -+CONFIG_NET_SCH_CBQ=m -+CONFIG_NET_SCH_HTB=m -+CONFIG_NET_SCH_HFSC=m -+CONFIG_NET_SCH_PRIO=m -+CONFIG_NET_SCH_MULTIQ=m -+CONFIG_NET_SCH_RED=m -+CONFIG_NET_SCH_SFB=m -+CONFIG_NET_SCH_SFQ=m -+CONFIG_NET_SCH_TEQL=m -+CONFIG_NET_SCH_TBF=m -+CONFIG_NET_SCH_GRED=m -+CONFIG_NET_SCH_DSMARK=m -+CONFIG_NET_SCH_NETEM=m -+CONFIG_NET_SCH_DRR=m -+CONFIG_NET_SCH_MQPRIO=m -+CONFIG_NET_SCH_CHOKE=m -+CONFIG_NET_SCH_QFQ=m -+CONFIG_NET_SCH_CODEL=m -+CONFIG_NET_SCH_FQ_CODEL=m -+CONFIG_NET_SCH_INGRESS=m -+CONFIG_NET_SCH_PLUG=m -+CONFIG_NET_CLS_BASIC=m -+CONFIG_NET_CLS_TCINDEX=m -+CONFIG_NET_CLS_ROUTE4=m -+CONFIG_NET_CLS_FW=m -+CONFIG_NET_CLS_U32=m -+CONFIG_CLS_U32_MARK=y -+CONFIG_NET_CLS_RSVP=m -+CONFIG_NET_CLS_RSVP6=m -+CONFIG_NET_CLS_FLOW=m -+CONFIG_NET_CLS_CGROUP=m -+CONFIG_NET_EMATCH=y -+CONFIG_NET_EMATCH_CMP=m -+CONFIG_NET_EMATCH_NBYTE=m -+CONFIG_NET_EMATCH_U32=m -+CONFIG_NET_EMATCH_META=m -+CONFIG_NET_EMATCH_TEXT=m -+CONFIG_NET_EMATCH_IPSET=m -+CONFIG_NET_CLS_ACT=y -+CONFIG_NET_ACT_POLICE=m -+CONFIG_NET_ACT_GACT=m -+CONFIG_GACT_PROB=y -+CONFIG_NET_ACT_MIRRED=m -+CONFIG_NET_ACT_IPT=m -+CONFIG_NET_ACT_NAT=m -+CONFIG_NET_ACT_PEDIT=m -+CONFIG_NET_ACT_SIMP=m -+CONFIG_NET_ACT_SKBEDIT=m -+CONFIG_NET_ACT_CSUM=m -+CONFIG_BATMAN_ADV=m -+CONFIG_OPENVSWITCH=m -+CONFIG_NET_PKTGEN=m -+CONFIG_HAMRADIO=y -+CONFIG_AX25=m -+CONFIG_NETROM=m -+CONFIG_ROSE=m -+CONFIG_MKISS=m -+CONFIG_6PACK=m -+CONFIG_BPQETHER=m -+CONFIG_BAYCOM_SER_FDX=m -+CONFIG_BAYCOM_SER_HDX=m -+CONFIG_YAM=m -+CONFIG_CAN=m -+CONFIG_CAN_VCAN=m -+CONFIG_CAN_MCP251X=m -+CONFIG_IRDA=m -+CONFIG_IRLAN=m -+CONFIG_IRNET=m -+CONFIG_IRCOMM=m -+CONFIG_IRDA_ULTRA=y -+CONFIG_IRDA_CACHE_LAST_LSAP=y -+CONFIG_IRDA_FAST_RR=y -+CONFIG_IRTTY_SIR=m -+CONFIG_KINGSUN_DONGLE=m -+CONFIG_KSDAZZLE_DONGLE=m -+CONFIG_KS959_DONGLE=m -+CONFIG_USB_IRDA=m -+CONFIG_SIGMATEL_FIR=m -+CONFIG_MCS_FIR=m -+CONFIG_BT=m -+CONFIG_BT_RFCOMM=m -+CONFIG_BT_RFCOMM_TTY=y -+CONFIG_BT_BNEP=m -+CONFIG_BT_BNEP_MC_FILTER=y -+CONFIG_BT_BNEP_PROTO_FILTER=y -+CONFIG_BT_HIDP=m -+CONFIG_BT_6LOWPAN=m -+CONFIG_BT_HCIBTUSB=m -+CONFIG_BT_HCIUART=m -+CONFIG_BT_HCIUART_3WIRE=y -+CONFIG_BT_HCIUART_BCM=y -+CONFIG_BT_HCIBCM203X=m -+CONFIG_BT_HCIBPA10X=m -+CONFIG_BT_HCIBFUSB=m -+CONFIG_BT_HCIVHCI=m -+CONFIG_BT_MRVL=m -+CONFIG_BT_MRVL_SDIO=m -+CONFIG_BT_ATH3K=m -+CONFIG_BT_WILINK=m -+CONFIG_MAC80211=m -+CONFIG_MAC80211_MESH=y -+CONFIG_WIMAX=m -+CONFIG_RFKILL=m -+CONFIG_RFKILL_INPUT=y -+CONFIG_NET_9P=m -+CONFIG_NFC=m -+CONFIG_DEVTMPFS=y -+CONFIG_DEVTMPFS_MOUNT=y -+CONFIG_DMA_CMA=y -+CONFIG_CMA_SIZE_MBYTES=5 -+CONFIG_MTD=m -+CONFIG_MTD_BLOCK=m -+CONFIG_MTD_NAND=m -+CONFIG_MTD_UBI=m -+CONFIG_OF_CONFIGFS=y -+CONFIG_ZRAM=m -+CONFIG_BLK_DEV_LOOP=y -+CONFIG_BLK_DEV_CRYPTOLOOP=m -+CONFIG_BLK_DEV_DRBD=m -+CONFIG_BLK_DEV_NBD=m -+CONFIG_BLK_DEV_RAM=y -+CONFIG_CDROM_PKTCDVD=m -+CONFIG_ATA_OVER_ETH=m -+CONFIG_EEPROM_AT24=m -+CONFIG_TI_ST=m -+CONFIG_SCSI=y -+# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=y -+CONFIG_CHR_DEV_ST=m -+CONFIG_CHR_DEV_OSST=m -+CONFIG_BLK_DEV_SR=m -+CONFIG_CHR_DEV_SG=m -+CONFIG_SCSI_ISCSI_ATTRS=y -+CONFIG_ISCSI_TCP=m -+CONFIG_ISCSI_BOOT_SYSFS=m -+CONFIG_MD=y -+CONFIG_MD_LINEAR=m -+CONFIG_MD_RAID0=m -+CONFIG_BLK_DEV_DM=m -+CONFIG_DM_CRYPT=m -+CONFIG_DM_SNAPSHOT=m -+CONFIG_DM_THIN_PROVISIONING=m -+CONFIG_DM_MIRROR=m -+CONFIG_DM_LOG_USERSPACE=m -+CONFIG_DM_RAID=m -+CONFIG_DM_ZERO=m -+CONFIG_DM_DELAY=m -+CONFIG_NETDEVICES=y -+CONFIG_BONDING=m -+CONFIG_DUMMY=m -+CONFIG_IFB=m -+CONFIG_MACVLAN=m -+CONFIG_IPVLAN=m -+CONFIG_VXLAN=m -+CONFIG_NETCONSOLE=m -+CONFIG_TUN=m -+CONFIG_VETH=m -+CONFIG_ENC28J60=m -+CONFIG_QCA7000=m -+CONFIG_MDIO_BITBANG=m -+CONFIG_PPP=m -+CONFIG_PPP_BSDCOMP=m -+CONFIG_PPP_DEFLATE=m -+CONFIG_PPP_FILTER=y -+CONFIG_PPP_MPPE=m -+CONFIG_PPP_MULTILINK=y -+CONFIG_PPPOATM=m -+CONFIG_PPPOE=m -+CONFIG_PPPOL2TP=m -+CONFIG_PPP_ASYNC=m -+CONFIG_PPP_SYNC_TTY=m -+CONFIG_SLIP=m -+CONFIG_SLIP_COMPRESSED=y -+CONFIG_SLIP_SMART=y -+CONFIG_USB_CATC=m -+CONFIG_USB_KAWETH=m -+CONFIG_USB_PEGASUS=m -+CONFIG_USB_RTL8150=m -+CONFIG_USB_RTL8152=m -+CONFIG_USB_USBNET=y -+CONFIG_USB_NET_AX8817X=m -+CONFIG_USB_NET_AX88179_178A=m -+CONFIG_USB_NET_CDCETHER=m -+CONFIG_USB_NET_CDC_EEM=m -+CONFIG_USB_NET_CDC_NCM=m -+CONFIG_USB_NET_HUAWEI_CDC_NCM=m -+CONFIG_USB_NET_CDC_MBIM=m -+CONFIG_USB_NET_DM9601=m -+CONFIG_USB_NET_SR9700=m -+CONFIG_USB_NET_SR9800=m -+CONFIG_USB_NET_SMSC75XX=m -+CONFIG_USB_NET_SMSC95XX=y -+CONFIG_USB_NET_GL620A=m -+CONFIG_USB_NET_NET1080=m -+CONFIG_USB_NET_PLUSB=m -+CONFIG_USB_NET_MCS7830=m -+CONFIG_USB_NET_CDC_SUBSET=m -+CONFIG_USB_ALI_M5632=y -+CONFIG_USB_AN2720=y -+CONFIG_USB_EPSON2888=y -+CONFIG_USB_KC2190=y -+CONFIG_USB_NET_ZAURUS=m -+CONFIG_USB_NET_CX82310_ETH=m -+CONFIG_USB_NET_KALMIA=m -+CONFIG_USB_NET_QMI_WWAN=m -+CONFIG_USB_HSO=m -+CONFIG_USB_NET_INT51X1=m -+CONFIG_USB_IPHETH=m -+CONFIG_USB_SIERRA_NET=m -+CONFIG_USB_VL600=m -+CONFIG_ATH9K=m -+CONFIG_ATH9K_HTC=m -+CONFIG_CARL9170=m -+CONFIG_ATH6KL=m -+CONFIG_ATH6KL_USB=m -+CONFIG_AR5523=m -+CONFIG_AT76C50X_USB=m -+CONFIG_B43=m -+# CONFIG_B43_PHY_N is not set -+CONFIG_B43LEGACY=m -+CONFIG_BRCMFMAC=m -+CONFIG_BRCMFMAC_USB=y -+CONFIG_HOSTAP=m -+CONFIG_P54_COMMON=m -+CONFIG_P54_USB=m -+CONFIG_LIBERTAS=m -+CONFIG_LIBERTAS_USB=m -+CONFIG_LIBERTAS_SDIO=m -+CONFIG_LIBERTAS_THINFIRM=m -+CONFIG_LIBERTAS_THINFIRM_USB=m -+CONFIG_MWIFIEX=m -+CONFIG_MWIFIEX_SDIO=m -+CONFIG_MT7601U=m -+CONFIG_RT2X00=m -+CONFIG_RT2500USB=m -+CONFIG_RT73USB=m -+CONFIG_RT2800USB=m -+CONFIG_RT2800USB_RT3573=y -+CONFIG_RT2800USB_RT53XX=y -+CONFIG_RT2800USB_RT55XX=y -+CONFIG_RT2800USB_UNKNOWN=y -+CONFIG_RTL8187=m -+CONFIG_RTL8192CU=n -+CONFIG_USB_ZD1201=m -+CONFIG_ZD1211RW=m -+CONFIG_MAC80211_HWSIM=m -+CONFIG_USB_NET_RNDIS_WLAN=m -+CONFIG_WIMAX_I2400M_USB=m -+CONFIG_IEEE802154_AT86RF230=m -+CONFIG_IEEE802154_MRF24J40=m -+CONFIG_IEEE802154_CC2520=m -+CONFIG_INPUT_POLLDEV=m -+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -+CONFIG_INPUT_JOYDEV=m -+CONFIG_INPUT_EVDEV=m -+# CONFIG_KEYBOARD_ATKBD is not set -+CONFIG_KEYBOARD_GPIO=m -+# CONFIG_INPUT_MOUSE is not set -+CONFIG_INPUT_JOYSTICK=y -+CONFIG_JOYSTICK_IFORCE=m -+CONFIG_JOYSTICK_IFORCE_USB=y -+CONFIG_JOYSTICK_XPAD=m -+CONFIG_JOYSTICK_XPAD_FF=y -+CONFIG_JOYSTICK_XPAD_LEDS=y -+CONFIG_JOYSTICK_RPISENSE=m -+CONFIG_INPUT_TOUCHSCREEN=y -+CONFIG_TOUCHSCREEN_ADS7846=m -+CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_RPI_FT5406=m -+CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -+CONFIG_TOUCHSCREEN_STMPE=m -+CONFIG_INPUT_MISC=y -+CONFIG_INPUT_AD714X=m -+CONFIG_INPUT_ATI_REMOTE2=m -+CONFIG_INPUT_KEYSPAN_REMOTE=m -+CONFIG_INPUT_POWERMATE=m -+CONFIG_INPUT_YEALINK=m -+CONFIG_INPUT_CM109=m -+CONFIG_INPUT_UINPUT=m -+CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -+CONFIG_INPUT_ADXL34X=m -+CONFIG_INPUT_CMA3000=m -+CONFIG_SERIO=m -+CONFIG_SERIO_RAW=m -+CONFIG_GAMEPORT=m -+CONFIG_GAMEPORT_NS558=m -+CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=n -+CONFIG_BCM_VC_CMA=n -+CONFIG_BCM_VCIO=n -+CONFIG_BCM_VC_SM=n -+# CONFIG_LEGACY_PTYS is not set -+# CONFIG_DEVKMEM is not set -+CONFIG_SERIAL_8250=y -+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -+CONFIG_SERIAL_8250_CONSOLE=y -+# CONFIG_SERIAL_8250_DMA is not set -+CONFIG_SERIAL_8250_NR_UARTS=1 -+CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_OF_PLATFORM=y -+CONFIG_SERIAL_AMBA_PL011=y -+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -+CONFIG_SERIAL_SC16IS7XX=m -+CONFIG_SERIAL_SC16IS7XX_SPI=y -+CONFIG_TTY_PRINTK=y -+CONFIG_HW_RANDOM=y -+CONFIG_RAW_DRIVER=y -+CONFIG_I2C=y -+CONFIG_I2C_CHARDEV=m -+CONFIG_I2C_MUX_PCA954x=m -+CONFIG_I2C_BCM2708=m -+CONFIG_I2C_GPIO=m -+CONFIG_SPI=y -+CONFIG_SPI_BCM2835=m -+CONFIG_SPI_BCM2835AUX=m -+CONFIG_SPI_SPIDEV=y -+CONFIG_PPS=m -+CONFIG_PPS_CLIENT_LDISC=m -+CONFIG_PPS_CLIENT_GPIO=m -+CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_VIRT=y -+CONFIG_GPIO_ARIZONA=m -+CONFIG_GPIO_STMPE=y -+CONFIG_GPIO_MCP23S08=m -+CONFIG_W1=m -+CONFIG_W1_MASTER_DS2490=m -+CONFIG_W1_MASTER_DS2482=m -+CONFIG_W1_MASTER_DS1WM=m -+CONFIG_W1_MASTER_GPIO=m -+CONFIG_W1_SLAVE_THERM=m -+CONFIG_W1_SLAVE_SMEM=m -+CONFIG_W1_SLAVE_DS2408=m -+CONFIG_W1_SLAVE_DS2413=m -+CONFIG_W1_SLAVE_DS2406=m -+CONFIG_W1_SLAVE_DS2423=m -+CONFIG_W1_SLAVE_DS2431=m -+CONFIG_W1_SLAVE_DS2433=m -+CONFIG_W1_SLAVE_DS2760=m -+CONFIG_W1_SLAVE_DS2780=m -+CONFIG_W1_SLAVE_DS2781=m -+CONFIG_W1_SLAVE_DS28E04=m -+CONFIG_W1_SLAVE_BQ27000=m -+CONFIG_BATTERY_DS2760=m -+CONFIG_POWER_RESET=y -+CONFIG_POWER_RESET_GPIO=y -+CONFIG_HWMON=m -+CONFIG_SENSORS_LM75=m -+CONFIG_SENSORS_SHT21=m -+CONFIG_SENSORS_SHTC1=m -+CONFIG_THERMAL=y -+CONFIG_THERMAL_BCM2835=y -+CONFIG_WATCHDOG=y -+CONFIG_BCM2835_WDT=y -+CONFIG_UCB1400_CORE=m -+CONFIG_MFD_STMPE=y -+CONFIG_STMPE_SPI=y -+CONFIG_MFD_ARIZONA_I2C=m -+CONFIG_MFD_ARIZONA_SPI=m -+CONFIG_MFD_WM5102=y -+CONFIG_MEDIA_SUPPORT=m -+CONFIG_MEDIA_CAMERA_SUPPORT=y -+CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -+CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -+CONFIG_MEDIA_RADIO_SUPPORT=y -+CONFIG_MEDIA_RC_SUPPORT=y -+CONFIG_MEDIA_CONTROLLER=y -+CONFIG_LIRC=m -+CONFIG_RC_DEVICES=y -+CONFIG_RC_ATI_REMOTE=m -+CONFIG_IR_IMON=m -+CONFIG_IR_MCEUSB=m -+CONFIG_IR_REDRAT3=m -+CONFIG_IR_STREAMZAP=m -+CONFIG_IR_IGUANA=m -+CONFIG_IR_TTUSBIR=m -+CONFIG_RC_LOOPBACK=m -+CONFIG_IR_GPIO_CIR=m -+CONFIG_MEDIA_USB_SUPPORT=y -+CONFIG_USB_VIDEO_CLASS=m -+CONFIG_USB_M5602=m -+CONFIG_USB_STV06XX=m -+CONFIG_USB_GL860=m -+CONFIG_USB_GSPCA_BENQ=m -+CONFIG_USB_GSPCA_CONEX=m -+CONFIG_USB_GSPCA_CPIA1=m -+CONFIG_USB_GSPCA_DTCS033=m -+CONFIG_USB_GSPCA_ETOMS=m -+CONFIG_USB_GSPCA_FINEPIX=m -+CONFIG_USB_GSPCA_JEILINJ=m -+CONFIG_USB_GSPCA_JL2005BCD=m -+CONFIG_USB_GSPCA_KINECT=m -+CONFIG_USB_GSPCA_KONICA=m -+CONFIG_USB_GSPCA_MARS=m -+CONFIG_USB_GSPCA_MR97310A=m -+CONFIG_USB_GSPCA_NW80X=m -+CONFIG_USB_GSPCA_OV519=m -+CONFIG_USB_GSPCA_OV534=m -+CONFIG_USB_GSPCA_OV534_9=m -+CONFIG_USB_GSPCA_PAC207=m -+CONFIG_USB_GSPCA_PAC7302=m -+CONFIG_USB_GSPCA_PAC7311=m -+CONFIG_USB_GSPCA_SE401=m -+CONFIG_USB_GSPCA_SN9C2028=m -+CONFIG_USB_GSPCA_SN9C20X=m -+CONFIG_USB_GSPCA_SONIXB=m -+CONFIG_USB_GSPCA_SONIXJ=m -+CONFIG_USB_GSPCA_SPCA500=m -+CONFIG_USB_GSPCA_SPCA501=m -+CONFIG_USB_GSPCA_SPCA505=m -+CONFIG_USB_GSPCA_SPCA506=m -+CONFIG_USB_GSPCA_SPCA508=m -+CONFIG_USB_GSPCA_SPCA561=m -+CONFIG_USB_GSPCA_SPCA1528=m -+CONFIG_USB_GSPCA_SQ905=m -+CONFIG_USB_GSPCA_SQ905C=m -+CONFIG_USB_GSPCA_SQ930X=m -+CONFIG_USB_GSPCA_STK014=m -+CONFIG_USB_GSPCA_STK1135=m -+CONFIG_USB_GSPCA_STV0680=m -+CONFIG_USB_GSPCA_SUNPLUS=m -+CONFIG_USB_GSPCA_T613=m -+CONFIG_USB_GSPCA_TOPRO=m -+CONFIG_USB_GSPCA_TV8532=m -+CONFIG_USB_GSPCA_VC032X=m -+CONFIG_USB_GSPCA_VICAM=m -+CONFIG_USB_GSPCA_XIRLINK_CIT=m -+CONFIG_USB_GSPCA_ZC3XX=m -+CONFIG_USB_PWC=m -+CONFIG_VIDEO_CPIA2=m -+CONFIG_USB_ZR364XX=m -+CONFIG_USB_STKWEBCAM=m -+CONFIG_USB_S2255=m -+CONFIG_VIDEO_USBTV=m -+CONFIG_VIDEO_PVRUSB2=m -+CONFIG_VIDEO_HDPVR=m -+CONFIG_VIDEO_USBVISION=m -+CONFIG_VIDEO_STK1160_COMMON=m -+CONFIG_VIDEO_STK1160_AC97=y -+CONFIG_VIDEO_GO7007=m -+CONFIG_VIDEO_GO7007_USB=m -+CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m -+CONFIG_VIDEO_AU0828=m -+CONFIG_VIDEO_AU0828_RC=y -+CONFIG_VIDEO_CX231XX=m -+CONFIG_VIDEO_CX231XX_ALSA=m -+CONFIG_VIDEO_CX231XX_DVB=m -+CONFIG_VIDEO_TM6000=m -+CONFIG_VIDEO_TM6000_ALSA=m -+CONFIG_VIDEO_TM6000_DVB=m -+CONFIG_DVB_USB=m -+CONFIG_DVB_USB_A800=m -+CONFIG_DVB_USB_DIBUSB_MB=m -+CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -+CONFIG_DVB_USB_DIBUSB_MC=m -+CONFIG_DVB_USB_DIB0700=m -+CONFIG_DVB_USB_UMT_010=m -+CONFIG_DVB_USB_CXUSB=m -+CONFIG_DVB_USB_M920X=m -+CONFIG_DVB_USB_DIGITV=m -+CONFIG_DVB_USB_VP7045=m -+CONFIG_DVB_USB_VP702X=m -+CONFIG_DVB_USB_GP8PSK=m -+CONFIG_DVB_USB_NOVA_T_USB2=m -+CONFIG_DVB_USB_TTUSB2=m -+CONFIG_DVB_USB_DTT200U=m -+CONFIG_DVB_USB_OPERA1=m -+CONFIG_DVB_USB_AF9005=m -+CONFIG_DVB_USB_AF9005_REMOTE=m -+CONFIG_DVB_USB_PCTV452E=m -+CONFIG_DVB_USB_DW2102=m -+CONFIG_DVB_USB_CINERGY_T2=m -+CONFIG_DVB_USB_DTV5100=m -+CONFIG_DVB_USB_FRIIO=m -+CONFIG_DVB_USB_AZ6027=m -+CONFIG_DVB_USB_TECHNISAT_USB2=m -+CONFIG_DVB_USB_V2=m -+CONFIG_DVB_USB_AF9015=m -+CONFIG_DVB_USB_AF9035=m -+CONFIG_DVB_USB_ANYSEE=m -+CONFIG_DVB_USB_AU6610=m -+CONFIG_DVB_USB_AZ6007=m -+CONFIG_DVB_USB_CE6230=m -+CONFIG_DVB_USB_EC168=m -+CONFIG_DVB_USB_GL861=m -+CONFIG_DVB_USB_LME2510=m -+CONFIG_DVB_USB_MXL111SF=m -+CONFIG_DVB_USB_RTL28XXU=m -+CONFIG_DVB_USB_DVBSKY=m -+CONFIG_SMS_USB_DRV=m -+CONFIG_DVB_B2C2_FLEXCOP_USB=m -+CONFIG_DVB_AS102=m -+CONFIG_VIDEO_EM28XX=m -+CONFIG_VIDEO_EM28XX_V4L2=m -+CONFIG_VIDEO_EM28XX_ALSA=m -+CONFIG_VIDEO_EM28XX_DVB=m -+CONFIG_V4L_PLATFORM_DRIVERS=y -+CONFIG_VIDEO_BCM2835=n -+CONFIG_VIDEO_BCM2835_MMAL=n -+CONFIG_RADIO_SI470X=y -+CONFIG_USB_SI470X=m -+CONFIG_I2C_SI470X=m -+CONFIG_RADIO_SI4713=m -+CONFIG_I2C_SI4713=m -+CONFIG_USB_MR800=m -+CONFIG_USB_DSBR=m -+CONFIG_RADIO_SHARK=m -+CONFIG_RADIO_SHARK2=m -+CONFIG_USB_KEENE=m -+CONFIG_USB_MA901=m -+CONFIG_RADIO_TEA5764=m -+CONFIG_RADIO_SAA7706H=m -+CONFIG_RADIO_TEF6862=m -+CONFIG_RADIO_WL1273=m -+CONFIG_RADIO_WL128X=m -+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -+CONFIG_VIDEO_UDA1342=m -+CONFIG_VIDEO_SONY_BTF_MPX=m -+CONFIG_VIDEO_TVP5150=m -+CONFIG_VIDEO_TW2804=m -+CONFIG_VIDEO_TW9903=m -+CONFIG_VIDEO_TW9906=m -+CONFIG_VIDEO_OV7640=m -+CONFIG_VIDEO_MT9V011=m -+CONFIG_DRM=m -+CONFIG_DRM_LOAD_EDID_FIRMWARE=y -+CONFIG_DRM_UDL=m -+CONFIG_DRM_VC4=m -+CONFIG_FB=y -+CONFIG_FB_BCM2708=y -+CONFIG_FB_UDL=m -+CONFIG_FB_SSD1307=m -+CONFIG_FB_RPISENSE=m -+# CONFIG_BACKLIGHT_GENERIC is not set -+CONFIG_BACKLIGHT_RPI=m -+CONFIG_BACKLIGHT_GPIO=m -+CONFIG_FRAMEBUFFER_CONSOLE=y -+CONFIG_LOGO=y -+# CONFIG_LOGO_LINUX_MONO is not set -+# CONFIG_LOGO_LINUX_VGA16 is not set -+CONFIG_SOUND=y -+CONFIG_SND=m -+CONFIG_SND_SEQUENCER=m -+CONFIG_SND_SEQ_DUMMY=m -+CONFIG_SND_MIXER_OSS=m -+CONFIG_SND_PCM_OSS=m -+CONFIG_SND_SEQUENCER_OSS=y -+CONFIG_SND_HRTIMER=m -+CONFIG_SND_DUMMY=m -+CONFIG_SND_ALOOP=m -+CONFIG_SND_VIRMIDI=m -+CONFIG_SND_MTPAV=m -+CONFIG_SND_SERIAL_U16550=m -+CONFIG_SND_MPU401=m -+CONFIG_SND_ARM=n -+CONFIG_SND_BCM2835=n -+CONFIG_SND_USB_AUDIO=m -+CONFIG_SND_USB_UA101=m -+CONFIG_SND_USB_CAIAQ=m -+CONFIG_SND_USB_CAIAQ_INPUT=y -+CONFIG_SND_USB_6FIRE=m -+CONFIG_SND_SOC=m -+CONFIG_SND_BCM2835_SOC_I2S=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m -+CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m -+CONFIG_SND_BCM2708_SOC_RPI_DAC=m -+CONFIG_SND_BCM2708_SOC_RPI_PROTO=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -+CONFIG_SND_BCM2708_SOC_JUSTBOOM_DIGI=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m -+CONFIG_SND_BCM2708_SOC_IQAUDIO_DIGI=m -+CONFIG_SND_BCM2708_SOC_RASPIDAC3=m -+CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m -+CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m -+CONFIG_SND_DIGIDAC1_SOUNDCARD=m -+CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_WM8804_I2C=m -+CONFIG_SND_SIMPLE_CARD=m -+CONFIG_SOUND_PRIME=m -+CONFIG_HIDRAW=y -+CONFIG_UHID=m -+CONFIG_HID_A4TECH=m -+CONFIG_HID_ACRUX=m -+CONFIG_HID_APPLE=m -+CONFIG_HID_BELKIN=m -+CONFIG_HID_BETOP_FF=m -+CONFIG_HID_CHERRY=m -+CONFIG_HID_CHICONY=m -+CONFIG_HID_CYPRESS=m -+CONFIG_HID_DRAGONRISE=m -+CONFIG_HID_EMS_FF=m -+CONFIG_HID_ELECOM=m -+CONFIG_HID_ELO=m -+CONFIG_HID_EZKEY=m -+CONFIG_HID_GEMBIRD=m -+CONFIG_HID_HOLTEK=m -+CONFIG_HID_KEYTOUCH=m -+CONFIG_HID_KYE=m -+CONFIG_HID_UCLOGIC=m -+CONFIG_HID_WALTOP=m -+CONFIG_HID_GYRATION=m -+CONFIG_HID_TWINHAN=m -+CONFIG_HID_KENSINGTON=m -+CONFIG_HID_LCPOWER=m -+CONFIG_HID_LOGITECH=m -+CONFIG_HID_LOGITECH_DJ=m -+CONFIG_LOGITECH_FF=y -+CONFIG_LOGIRUMBLEPAD2_FF=y -+CONFIG_LOGIG940_FF=y -+CONFIG_HID_MAGICMOUSE=m -+CONFIG_HID_MICROSOFT=m -+CONFIG_HID_MONTEREY=m -+CONFIG_HID_MULTITOUCH=m -+CONFIG_HID_NTRIG=m -+CONFIG_HID_ORTEK=m -+CONFIG_HID_PANTHERLORD=m -+CONFIG_HID_PETALYNX=m -+CONFIG_HID_PICOLCD=m -+CONFIG_HID_ROCCAT=m -+CONFIG_HID_SAMSUNG=m -+CONFIG_HID_SONY=m -+CONFIG_HID_SPEEDLINK=m -+CONFIG_HID_SUNPLUS=m -+CONFIG_HID_GREENASIA=m -+CONFIG_HID_SMARTJOYPLUS=m -+CONFIG_HID_TOPSEED=m -+CONFIG_HID_THINGM=m -+CONFIG_HID_THRUSTMASTER=m -+CONFIG_HID_WACOM=m -+CONFIG_HID_WIIMOTE=m -+CONFIG_HID_XINMO=m -+CONFIG_HID_ZEROPLUS=m -+CONFIG_HID_ZYDACRON=m -+CONFIG_HID_PID=y -+CONFIG_USB_HIDDEV=y -+CONFIG_USB=y -+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y -+CONFIG_USB_MON=m -+CONFIG_USB_DWCOTG=n -+CONFIG_USB_DWC2=y -+CONFIG_USB_PRINTER=m -+CONFIG_USB_STORAGE=y -+CONFIG_USB_STORAGE_REALTEK=m -+CONFIG_USB_STORAGE_DATAFAB=m -+CONFIG_USB_STORAGE_FREECOM=m -+CONFIG_USB_STORAGE_ISD200=m -+CONFIG_USB_STORAGE_USBAT=m -+CONFIG_USB_STORAGE_SDDR09=m -+CONFIG_USB_STORAGE_SDDR55=m -+CONFIG_USB_STORAGE_JUMPSHOT=m -+CONFIG_USB_STORAGE_ALAUDA=m -+CONFIG_USB_STORAGE_ONETOUCH=m -+CONFIG_USB_STORAGE_KARMA=m -+CONFIG_USB_STORAGE_CYPRESS_ATACB=m -+CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_MDC800=m -+CONFIG_USB_MICROTEK=m -+CONFIG_USBIP_CORE=m -+CONFIG_USBIP_VHCI_HCD=m -+CONFIG_USBIP_HOST=m -+CONFIG_USB_SERIAL=m -+CONFIG_USB_SERIAL_GENERIC=y -+CONFIG_USB_SERIAL_AIRCABLE=m -+CONFIG_USB_SERIAL_ARK3116=m -+CONFIG_USB_SERIAL_BELKIN=m -+CONFIG_USB_SERIAL_CH341=m -+CONFIG_USB_SERIAL_WHITEHEAT=m -+CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -+CONFIG_USB_SERIAL_CP210X=m -+CONFIG_USB_SERIAL_CYPRESS_M8=m -+CONFIG_USB_SERIAL_EMPEG=m -+CONFIG_USB_SERIAL_FTDI_SIO=m -+CONFIG_USB_SERIAL_VISOR=m -+CONFIG_USB_SERIAL_IPAQ=m -+CONFIG_USB_SERIAL_IR=m -+CONFIG_USB_SERIAL_EDGEPORT=m -+CONFIG_USB_SERIAL_EDGEPORT_TI=m -+CONFIG_USB_SERIAL_F81232=m -+CONFIG_USB_SERIAL_GARMIN=m -+CONFIG_USB_SERIAL_IPW=m -+CONFIG_USB_SERIAL_IUU=m -+CONFIG_USB_SERIAL_KEYSPAN_PDA=m -+CONFIG_USB_SERIAL_KEYSPAN=m -+CONFIG_USB_SERIAL_KLSI=m -+CONFIG_USB_SERIAL_KOBIL_SCT=m -+CONFIG_USB_SERIAL_MCT_U232=m -+CONFIG_USB_SERIAL_METRO=m -+CONFIG_USB_SERIAL_MOS7720=m -+CONFIG_USB_SERIAL_MOS7840=m -+CONFIG_USB_SERIAL_NAVMAN=m -+CONFIG_USB_SERIAL_PL2303=m -+CONFIG_USB_SERIAL_OTI6858=m -+CONFIG_USB_SERIAL_QCAUX=m -+CONFIG_USB_SERIAL_QUALCOMM=m -+CONFIG_USB_SERIAL_SPCP8X5=m -+CONFIG_USB_SERIAL_SAFE=m -+CONFIG_USB_SERIAL_SIERRAWIRELESS=m -+CONFIG_USB_SERIAL_SYMBOL=m -+CONFIG_USB_SERIAL_TI=m -+CONFIG_USB_SERIAL_CYBERJACK=m -+CONFIG_USB_SERIAL_XIRCOM=m -+CONFIG_USB_SERIAL_OPTION=m -+CONFIG_USB_SERIAL_OMNINET=m -+CONFIG_USB_SERIAL_OPTICON=m -+CONFIG_USB_SERIAL_XSENS_MT=m -+CONFIG_USB_SERIAL_WISHBONE=m -+CONFIG_USB_SERIAL_SSU100=m -+CONFIG_USB_SERIAL_QT2=m -+CONFIG_USB_SERIAL_DEBUG=m -+CONFIG_USB_EMI62=m -+CONFIG_USB_EMI26=m -+CONFIG_USB_ADUTUX=m -+CONFIG_USB_SEVSEG=m -+CONFIG_USB_RIO500=m -+CONFIG_USB_LEGOTOWER=m -+CONFIG_USB_LCD=m -+CONFIG_USB_CYPRESS_CY7C63=m -+CONFIG_USB_CYTHERM=m -+CONFIG_USB_IDMOUSE=m -+CONFIG_USB_FTDI_ELAN=m -+CONFIG_USB_APPLEDISPLAY=m -+CONFIG_USB_LD=m -+CONFIG_USB_TRANCEVIBRATOR=m -+CONFIG_USB_IOWARRIOR=m -+CONFIG_USB_TEST=m -+CONFIG_USB_ISIGHTFW=m -+CONFIG_USB_YUREX=m -+CONFIG_USB_ATM=m -+CONFIG_USB_SPEEDTOUCH=m -+CONFIG_USB_CXACRU=m -+CONFIG_USB_UEAGLEATM=m -+CONFIG_USB_XUSBATM=m -+CONFIG_MMC=y -+CONFIG_MMC_BLOCK_MINORS=32 -+CONFIG_MMC_BCM2835=y -+CONFIG_MMC_BCM2835_DMA=y -+CONFIG_MMC_BCM2835_SDHOST=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_PLTFM=y -+CONFIG_MMC_SPI=m -+CONFIG_LEDS_CLASS=y -+CONFIG_LEDS_GPIO=y -+CONFIG_LEDS_TRIGGER_TIMER=y -+CONFIG_LEDS_TRIGGER_ONESHOT=y -+CONFIG_LEDS_TRIGGER_HEARTBEAT=y -+CONFIG_LEDS_TRIGGER_BACKLIGHT=y -+CONFIG_LEDS_TRIGGER_CPU=y -+CONFIG_LEDS_TRIGGER_GPIO=y -+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -+CONFIG_LEDS_TRIGGER_TRANSIENT=m -+CONFIG_LEDS_TRIGGER_CAMERA=m -+CONFIG_LEDS_TRIGGER_INPUT=y -+CONFIG_LEDS_TRIGGER_PANIC=y -+CONFIG_RTC_CLASS=y -+# CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_DS1307=m -+CONFIG_RTC_DRV_DS1374=m -+CONFIG_RTC_DRV_DS1672=m -+CONFIG_RTC_DRV_MAX6900=m -+CONFIG_RTC_DRV_RS5C372=m -+CONFIG_RTC_DRV_ISL1208=m -+CONFIG_RTC_DRV_ISL12022=m -+CONFIG_RTC_DRV_ISL12057=m -+CONFIG_RTC_DRV_X1205=m -+CONFIG_RTC_DRV_PCF8523=m -+CONFIG_RTC_DRV_PCF8563=m -+CONFIG_RTC_DRV_PCF8583=m -+CONFIG_RTC_DRV_M41T80=m -+CONFIG_RTC_DRV_BQ32K=m -+CONFIG_RTC_DRV_S35390A=m -+CONFIG_RTC_DRV_FM3130=m -+CONFIG_RTC_DRV_RX8581=m -+CONFIG_RTC_DRV_RX8025=m -+CONFIG_RTC_DRV_EM3027=m -+CONFIG_RTC_DRV_M41T93=m -+CONFIG_RTC_DRV_M41T94=m -+CONFIG_RTC_DRV_DS1302=m -+CONFIG_RTC_DRV_DS1305=m -+CONFIG_RTC_DRV_DS1390=m -+CONFIG_RTC_DRV_R9701=m -+CONFIG_RTC_DRV_RX4581=m -+CONFIG_RTC_DRV_RS5C348=m -+CONFIG_RTC_DRV_MAX6902=m -+CONFIG_RTC_DRV_PCF2123=m -+CONFIG_RTC_DRV_DS3232=m -+CONFIG_RTC_DRV_PCF2127=m -+CONFIG_RTC_DRV_RV3029C2=m -+CONFIG_DMADEVICES=y -+CONFIG_DMA_BCM2835=y -+CONFIG_DMA_BCM2708=y -+CONFIG_UIO=m -+CONFIG_UIO_PDRV_GENIRQ=m -+CONFIG_STAGING=y -+CONFIG_PRISM2_USB=m -+CONFIG_R8712U=m -+CONFIG_R8188EU=m -+CONFIG_R8723AU=m -+CONFIG_VT6656=m -+CONFIG_SPEAKUP=m -+CONFIG_SPEAKUP_SYNTH_SOFT=m -+CONFIG_STAGING_MEDIA=y -+CONFIG_LIRC_STAGING=y -+CONFIG_LIRC_IMON=m -+CONFIG_LIRC_RPI=m -+CONFIG_LIRC_SASEM=m -+CONFIG_LIRC_SERIAL=m -+CONFIG_FB_TFT=m -+CONFIG_FB_TFT_AGM1264K_FL=m -+CONFIG_FB_TFT_BD663474=m -+CONFIG_FB_TFT_HX8340BN=m -+CONFIG_FB_TFT_HX8347D=m -+CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_ILI9163=m -+CONFIG_FB_TFT_ILI9320=m -+CONFIG_FB_TFT_ILI9325=m -+CONFIG_FB_TFT_ILI9340=m -+CONFIG_FB_TFT_ILI9341=m -+CONFIG_FB_TFT_ILI9481=m -+CONFIG_FB_TFT_ILI9486=m -+CONFIG_FB_TFT_PCD8544=m -+CONFIG_FB_TFT_RA8875=m -+CONFIG_FB_TFT_S6D02A1=m -+CONFIG_FB_TFT_S6D1121=m -+CONFIG_FB_TFT_SSD1289=m -+CONFIG_FB_TFT_SSD1306=m -+CONFIG_FB_TFT_SSD1331=m -+CONFIG_FB_TFT_SSD1351=m -+CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_TINYLCD=m -+CONFIG_FB_TFT_TLS8204=m -+CONFIG_FB_TFT_UC1701=m -+CONFIG_FB_TFT_UPD161704=m -+CONFIG_FB_TFT_WATTEROTT=m -+CONFIG_FB_FLEX=m -+CONFIG_FB_TFT_FBTFT_DEVICE=m -+CONFIG_MAILBOX=y -+CONFIG_BCM2835_MBOX=y -+# CONFIG_IOMMU_SUPPORT is not set -+CONFIG_RASPBERRYPI_POWER=y -+CONFIG_EXTCON=m -+CONFIG_EXTCON_ARIZONA=m -+CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m -+CONFIG_MCP320X=m -+CONFIG_MCP3422=m -+CONFIG_DHT11=m -+CONFIG_PWM_BCM2835=m -+CONFIG_PWM_PCA9685=m -+CONFIG_RASPBERRYPI_FIRMWARE=y -+CONFIG_EXT4_FS=y -+CONFIG_EXT4_FS_POSIX_ACL=y -+CONFIG_EXT4_FS_SECURITY=y -+CONFIG_REISERFS_FS=m -+CONFIG_REISERFS_FS_XATTR=y -+CONFIG_REISERFS_FS_POSIX_ACL=y -+CONFIG_REISERFS_FS_SECURITY=y -+CONFIG_JFS_FS=m -+CONFIG_JFS_POSIX_ACL=y -+CONFIG_JFS_SECURITY=y -+CONFIG_JFS_STATISTICS=y -+CONFIG_XFS_FS=m -+CONFIG_XFS_QUOTA=y -+CONFIG_XFS_POSIX_ACL=y -+CONFIG_XFS_RT=y -+CONFIG_GFS2_FS=m -+CONFIG_OCFS2_FS=m -+CONFIG_BTRFS_FS=m -+CONFIG_BTRFS_FS_POSIX_ACL=y -+CONFIG_NILFS2_FS=m -+CONFIG_F2FS_FS=y -+CONFIG_FANOTIFY=y -+CONFIG_QFMT_V1=m -+CONFIG_QFMT_V2=m -+CONFIG_AUTOFS4_FS=y -+CONFIG_FUSE_FS=m -+CONFIG_CUSE=m -+CONFIG_OVERLAY_FS=m -+CONFIG_FSCACHE=y -+CONFIG_FSCACHE_STATS=y -+CONFIG_FSCACHE_HISTOGRAM=y -+CONFIG_CACHEFILES=y -+CONFIG_ISO9660_FS=m -+CONFIG_JOLIET=y -+CONFIG_ZISOFS=y -+CONFIG_UDF_FS=m -+CONFIG_MSDOS_FS=y -+CONFIG_VFAT_FS=y -+CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -+CONFIG_NTFS_FS=m -+CONFIG_NTFS_RW=y -+CONFIG_TMPFS=y -+CONFIG_TMPFS_POSIX_ACL=y -+CONFIG_ECRYPT_FS=m -+CONFIG_HFS_FS=m -+CONFIG_HFSPLUS_FS=m -+CONFIG_JFFS2_FS=m -+CONFIG_JFFS2_SUMMARY=y -+CONFIG_UBIFS_FS=m -+CONFIG_SQUASHFS=m -+CONFIG_SQUASHFS_XATTR=y -+CONFIG_SQUASHFS_LZO=y -+CONFIG_SQUASHFS_XZ=y -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3_ACL=y -+CONFIG_NFS_V4=y -+CONFIG_NFS_SWAP=y -+CONFIG_ROOT_NFS=y -+CONFIG_NFS_FSCACHE=y -+CONFIG_NFSD=m -+CONFIG_NFSD_V3_ACL=y -+CONFIG_NFSD_V4=y -+CONFIG_CIFS=m -+CONFIG_CIFS_WEAK_PW_HASH=y -+CONFIG_CIFS_UPCALL=y -+CONFIG_CIFS_XATTR=y -+CONFIG_CIFS_POSIX=y -+CONFIG_CIFS_ACL=y -+CONFIG_CIFS_DFS_UPCALL=y -+CONFIG_CIFS_SMB2=y -+CONFIG_CIFS_FSCACHE=y -+CONFIG_9P_FS=m -+CONFIG_9P_FS_POSIX_ACL=y -+CONFIG_NLS_DEFAULT="utf8" -+CONFIG_NLS_CODEPAGE_437=y -+CONFIG_NLS_CODEPAGE_737=m -+CONFIG_NLS_CODEPAGE_775=m -+CONFIG_NLS_CODEPAGE_850=m -+CONFIG_NLS_CODEPAGE_852=m -+CONFIG_NLS_CODEPAGE_855=m -+CONFIG_NLS_CODEPAGE_857=m -+CONFIG_NLS_CODEPAGE_860=m -+CONFIG_NLS_CODEPAGE_861=m -+CONFIG_NLS_CODEPAGE_862=m -+CONFIG_NLS_CODEPAGE_863=m -+CONFIG_NLS_CODEPAGE_864=m -+CONFIG_NLS_CODEPAGE_865=m -+CONFIG_NLS_CODEPAGE_866=m -+CONFIG_NLS_CODEPAGE_869=m -+CONFIG_NLS_CODEPAGE_936=m -+CONFIG_NLS_CODEPAGE_950=m -+CONFIG_NLS_CODEPAGE_932=m -+CONFIG_NLS_CODEPAGE_949=m -+CONFIG_NLS_CODEPAGE_874=m -+CONFIG_NLS_ISO8859_8=m -+CONFIG_NLS_CODEPAGE_1250=m -+CONFIG_NLS_CODEPAGE_1251=m -+CONFIG_NLS_ASCII=y -+CONFIG_NLS_ISO8859_1=m -+CONFIG_NLS_ISO8859_2=m -+CONFIG_NLS_ISO8859_3=m -+CONFIG_NLS_ISO8859_4=m -+CONFIG_NLS_ISO8859_5=m -+CONFIG_NLS_ISO8859_6=m -+CONFIG_NLS_ISO8859_7=m -+CONFIG_NLS_ISO8859_9=m -+CONFIG_NLS_ISO8859_13=m -+CONFIG_NLS_ISO8859_14=m -+CONFIG_NLS_ISO8859_15=m -+CONFIG_NLS_KOI8_R=m -+CONFIG_NLS_KOI8_U=m -+CONFIG_DLM=m -+CONFIG_PRINTK_TIME=y -+CONFIG_BOOT_PRINTK_DELAY=y -+CONFIG_DEBUG_MEMORY_INIT=y -+CONFIG_DETECT_HUNG_TASK=y -+CONFIG_TIMER_STATS=y -+CONFIG_IRQSOFF_TRACER=y -+CONFIG_SCHED_TRACER=y -+CONFIG_STACK_TRACER=y -+CONFIG_BLK_DEV_IO_TRACE=y -+# CONFIG_KPROBE_EVENT is not set -+CONFIG_FUNCTION_PROFILER=y -+CONFIG_KGDB=y -+CONFIG_KGDB_KDB=y -+CONFIG_KDB_KEYBOARD=y -+CONFIG_CRYPTO_USER=m -+CONFIG_CRYPTO_CBC=y -+CONFIG_CRYPTO_CTS=m -+CONFIG_CRYPTO_XTS=m -+CONFIG_CRYPTO_XCBC=m -+CONFIG_CRYPTO_TGR192=m -+CONFIG_CRYPTO_WP512=m -+CONFIG_CRYPTO_CAST5=m -+CONFIG_CRYPTO_DES=y -+CONFIG_CRYPTO_USER_API_SKCIPHER=m -+CONFIG_ARM64_CRYPTO=y -+CONFIG_CRC_ITU_T=y -+CONFIG_LIBCRC32C=y -+CONFIG_BCM2708_VCHIQ=n - -From d5f278b5d66aaae13361aa90bf4a06a9babf5746 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 7 Mar 2016 15:05:11 +0000 -Subject: [PATCH 093/122] vchiq_arm: Tweak the logging output - -Signed-off-by: Phil Elwell ---- - .../vc04_services/interface/vchiq_arm/vchiq_core.c | 31 +++++++++------------- - 1 file changed, 13 insertions(+), 18 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -index 2c98da4307dff994a00dc246574ef0aaee05d5da..160db24aeea33a8296923501009c1f02bc41e599 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -@@ -891,16 +891,14 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - error_count); - return VCHIQ_ERROR; - } -- if (i == 0) { -- if (SRVTRACE_ENABLED(service, -- VCHIQ_LOG_INFO)) -- vchiq_log_dump_mem("Sent", 0, -- header->data + pos, -- min(64u, -- elements[0].size)); -- } - } - -+ if (SRVTRACE_ENABLED(service, -+ VCHIQ_LOG_INFO)) -+ vchiq_log_dump_mem("Sent", 0, -+ header->data, -+ min(16, pos)); -+ - spin_lock("a_spinlock); - service_quota->message_use_count++; - -@@ -1039,16 +1037,13 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, - error_count); - return VCHIQ_ERROR; - } -- if (i == 0) { -- if (vchiq_sync_log_level >= -- VCHIQ_LOG_TRACE) -- vchiq_log_dump_mem("Sent Sync", -- 0, header->data + pos, -- min(64u, -- elements[0].size)); -- } - } - -+ if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) -+ vchiq_log_dump_mem("Sent Sync", -+ 0, header->data, -+ min(16, pos)); -+ - VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); - VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); - } else { -@@ -1720,7 +1715,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) - remoteport, localport, size); - if (size > 0) - vchiq_log_dump_mem("Rcvd", 0, header->data, -- min(64, size)); -+ min(16, size)); - } - - if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) -@@ -2187,7 +2182,7 @@ sync_func(void *v) - remoteport, localport, size); - if (size > 0) - vchiq_log_dump_mem("Rcvd", 0, header->data, -- min(64, size)); -+ min(16, size)); - } - - switch (type) { - -From b65b8cb1ff93d43d24558076bb81f19b1ab5ea50 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 23 Mar 2016 14:16:25 +0000 -Subject: [PATCH 094/122] vchiq_arm: Access the dequeue_pending flag locked - -Reading through this code looking for another problem (now found in userland) -the use of dequeue_pending outside a lock didn't seem safe. - -Signed-off-by: Phil Elwell ---- - .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 17 ++++++++++++----- - 1 file changed, 12 insertions(+), 5 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index 7b6cd4d80621e38ff6d47fcd87b45fbe9cd4259b..d8669fa7f39b077877eca1829ba9538bf2e21a82 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -279,6 +279,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, - USER_SERVICE_T *user_service; - VCHIQ_SERVICE_T *service; - VCHIQ_INSTANCE_T instance; -+ int skip_completion = 0; - DEBUG_INITIALISE(g_state.local) - - DEBUG_TRACE(SERVICE_CALLBACK_LINE); -@@ -345,9 +346,6 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, - user_service->msg_queue[user_service->msg_insert & - (MSG_QUEUE_SIZE - 1)] = header; - user_service->msg_insert++; -- spin_unlock(&msg_queue_spinlock); -- -- up(&user_service->insert_event); - - /* If there is a thread waiting in DEQUEUE_MESSAGE, or if - ** there is a MESSAGE_AVAILABLE in the completion queue then -@@ -356,13 +354,22 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header, - if (((user_service->message_available_pos - - instance->completion_remove) >= 0) || - user_service->dequeue_pending) { -- DEBUG_TRACE(SERVICE_CALLBACK_LINE); - user_service->dequeue_pending = 0; -- return VCHIQ_SUCCESS; -+ skip_completion = 1; - } - -+ spin_unlock(&msg_queue_spinlock); -+ -+ up(&user_service->insert_event); -+ - header = NULL; - } -+ -+ if (skip_completion) { -+ DEBUG_TRACE(SERVICE_CALLBACK_LINE); -+ return VCHIQ_SUCCESS; -+ } -+ - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - - return add_completion(instance, reason, header, user_service, - -From 1236ef13699c7ce7cb486c13c244be0038419918 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 23 Mar 2016 20:53:47 +0000 -Subject: [PATCH 095/122] vchiq_arm: Service callbacks must not fail - -Service callbacks are not allowed to return an error. The internal callback -that delivers events and messages to user tasks does not enqueue them if -the service is closing, but this is not an error and should not be -reported as such. - -Signed-off-by: Phil Elwell ---- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index d8669fa7f39b077877eca1829ba9538bf2e21a82..54552c6ce54f413c9781ba279b936f98be4f47b0 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -224,7 +224,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - } else if (instance->closing) { - vchiq_log_info(vchiq_arm_log_level, - "service_callback closing"); -- return VCHIQ_ERROR; -+ return VCHIQ_SUCCESS; - } - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - } - -From 42c9df04946a82e2e84ce093e9fe8e0e00183e05 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 21 Apr 2016 13:49:32 +0100 -Subject: [PATCH 096/122] vchiq_arm: Add completion records under the mutex - -An issue was observed when flushing openmax components -which generate a large number of messages returning -buffers to host. - -We occasionally found a duplicate message from 16 -messages prior, resulting in a buffer returned twice. - -While only one thread adds completions, without the -mutex you don't get the protection of the automatic -memory barrier you get with synchronisation objects. - -Signed-off-by: Phil Elwell ---- - .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index 54552c6ce54f413c9781ba279b936f98be4f47b0..bde8955b7d8505d73579b77b5b3921549cb9d2fb 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -210,6 +210,8 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - VCHIQ_COMPLETION_DATA_T *completion; - DEBUG_INITIALISE(g_state.local) - -+ mutex_lock(&instance->completion_mutex); -+ - while (instance->completion_insert == - (instance->completion_remove + MAX_COMPLETIONS)) { - /* Out of space - wait for the client */ -@@ -217,11 +219,17 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - vchiq_log_trace(vchiq_arm_log_level, - "add_completion - completion queue full"); - DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); -+ -+ mutex_unlock(&instance->completion_mutex); - if (down_interruptible(&instance->remove_event) != 0) { - vchiq_log_info(vchiq_arm_log_level, - "service_callback interrupted"); - return VCHIQ_RETRY; -- } else if (instance->closing) { -+ } -+ -+ mutex_lock(&instance->completion_mutex); -+ if (instance->closing) { -+ mutex_unlock(&instance->completion_mutex); - vchiq_log_info(vchiq_arm_log_level, - "service_callback closing"); - return VCHIQ_SUCCESS; -@@ -254,8 +262,11 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - if (reason == VCHIQ_MESSAGE_AVAILABLE) - user_service->message_available_pos = - instance->completion_insert; -+ - instance->completion_insert++; - -+ mutex_unlock(&instance->completion_mutex); -+ - up(&instance->insert_event); - - return VCHIQ_SUCCESS; - -From e027b929fb8e3c2ca6ee3b9c26104cd88a6ad4b6 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 20 Jun 2016 13:51:44 +0100 -Subject: [PATCH 097/122] vchiq_arm: Avoid use of mutex in add_completion - -Claiming the completion_mutex within add_completion did prevent some -messages appearing twice, but provokes a deadlock caused by vcsm using -vchiq within a page fault handler. - -Revert the use of completion_mutex, and instead fix the original -problem using more memory barriers. - -Signed-off-by: Phil Elwell ---- - .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 55 +++++++++++----------- - .../vc04_services/interface/vchiq_arm/vchiq_core.c | 14 ++++-- - 2 files changed, 37 insertions(+), 32 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index bde8955b7d8505d73579b77b5b3921549cb9d2fb..e5cdda12c7e5c35c69eb96991cfdb8326def167f 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -64,10 +64,10 @@ - #define VCHIQ_MINOR 0 - - /* Some per-instance constants */ --#define MAX_COMPLETIONS 16 -+#define MAX_COMPLETIONS 128 - #define MAX_SERVICES 64 - #define MAX_ELEMENTS 8 --#define MSG_QUEUE_SIZE 64 -+#define MSG_QUEUE_SIZE 128 - - #define KEEPALIVE_VER 1 - #define KEEPALIVE_VER_MIN KEEPALIVE_VER -@@ -208,28 +208,24 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - void *bulk_userdata) - { - VCHIQ_COMPLETION_DATA_T *completion; -+ int insert; - DEBUG_INITIALISE(g_state.local) - -- mutex_lock(&instance->completion_mutex); -- -- while (instance->completion_insert == -- (instance->completion_remove + MAX_COMPLETIONS)) { -+ insert = instance->completion_insert; -+ while ((insert - instance->completion_remove) >= MAX_COMPLETIONS) { - /* Out of space - wait for the client */ - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - vchiq_log_trace(vchiq_arm_log_level, - "add_completion - completion queue full"); - DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); - -- mutex_unlock(&instance->completion_mutex); - if (down_interruptible(&instance->remove_event) != 0) { - vchiq_log_info(vchiq_arm_log_level, - "service_callback interrupted"); - return VCHIQ_RETRY; - } - -- mutex_lock(&instance->completion_mutex); - if (instance->closing) { -- mutex_unlock(&instance->completion_mutex); - vchiq_log_info(vchiq_arm_log_level, - "service_callback closing"); - return VCHIQ_SUCCESS; -@@ -237,9 +233,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - DEBUG_TRACE(SERVICE_CALLBACK_LINE); - } - -- completion = -- &instance->completions[instance->completion_insert & -- (MAX_COMPLETIONS - 1)]; -+ completion = &instance->completions[insert & (MAX_COMPLETIONS - 1)]; - - completion->header = header; - completion->reason = reason; -@@ -260,12 +254,9 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, - wmb(); - - if (reason == VCHIQ_MESSAGE_AVAILABLE) -- user_service->message_available_pos = -- instance->completion_insert; -+ user_service->message_available_pos = insert; - -- instance->completion_insert++; -- -- mutex_unlock(&instance->completion_mutex); -+ instance->completion_insert = ++insert; - - up(&instance->insert_event); - -@@ -795,6 +786,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - instance->completion_insert) - && !instance->closing) { - int rc; -+ - DEBUG_TRACE(AWAIT_COMPLETION_LINE); - mutex_unlock(&instance->completion_mutex); - rc = down_interruptible(&instance->insert_event); -@@ -809,24 +801,29 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - } - DEBUG_TRACE(AWAIT_COMPLETION_LINE); - -- /* A read memory barrier is needed to stop prefetch of a stale -- ** completion record -- */ -- rmb(); -- - if (ret == 0) { - int msgbufcount = args.msgbufcount; -+ int remove; -+ -+ remove = instance->completion_remove; -+ - for (ret = 0; ret < args.count; ret++) { - VCHIQ_COMPLETION_DATA_T *completion; - VCHIQ_SERVICE_T *service; - USER_SERVICE_T *user_service; - VCHIQ_HEADER_T *header; -- if (instance->completion_remove == -- instance->completion_insert) -+ -+ if (remove == instance->completion_insert) - break; -+ - completion = &instance->completions[ -- instance->completion_remove & -- (MAX_COMPLETIONS - 1)]; -+ remove & (MAX_COMPLETIONS - 1)]; -+ -+ -+ /* A read memory barrier is needed to prevent -+ ** the prefetch of a stale completion record -+ */ -+ rmb(); - - service = completion->service_userdata; - user_service = service->base.userdata; -@@ -903,7 +900,11 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - break; - } - -- instance->completion_remove++; -+ /* Ensure that the above copy has completed -+ ** before advancing the remove pointer. */ -+ mb(); -+ -+ instance->completion_remove = ++remove; - } - - if (msgbufcount != args.msgbufcount) { -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -index 160db24aeea33a8296923501009c1f02bc41e599..71a3bedc55314f3b22dbff40c05dedf03b5e7169 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c -@@ -610,15 +610,15 @@ process_free_queue(VCHIQ_STATE_T *state) - BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; - int slot_queue_available; - -- /* Use a read memory barrier to ensure that any state that may have -- ** been modified by another thread is not masked by stale prefetched -- ** values. */ -- rmb(); -- - /* Find slots which have been freed by the other side, and return them - ** to the available queue. */ - slot_queue_available = state->slot_queue_available; - -+ /* Use a memory barrier to ensure that any state that may have been -+ ** modified by another thread is not masked by stale prefetched -+ ** values. */ -+ mb(); -+ - while (slot_queue_available != local->slot_queue_recycle) { - unsigned int pos; - int slot_index = local->slot_queue[slot_queue_available++ & -@@ -626,6 +626,8 @@ process_free_queue(VCHIQ_STATE_T *state) - char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index); - int data_found = 0; - -+ rmb(); -+ - vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x", - state->id, slot_index, (unsigned int)data, - local->slot_queue_recycle, slot_queue_available); -@@ -741,6 +743,8 @@ process_free_queue(VCHIQ_STATE_T *state) - up(&state->data_quota_event); - } - -+ mb(); -+ - state->slot_queue_available = slot_queue_available; - up(&state->slot_available_event); - } - -From 36afbf3ec01bb2c073b99d9f8e09e72d3aba6b08 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 3 Oct 2016 10:14:10 -0700 -Subject: [PATCH 098/122] staging/vchi: Convert to current get_user_pages() - arguments. - -Signed-off-by: Eric Anholt ---- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- - 2 files changed, 2 insertions(+), 3 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 1091b9f1dd070e3d27c269402b43b0a09d96bcdc..8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -420,7 +420,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, - *need_release = 0; /* do not try and release vmalloc pages */ - } else { - down_read(&task->mm->mmap_sem); -- actual_pages = get_user_pages(task, task->mm, -+ actual_pages = get_user_pages( - (unsigned long)buf & ~(PAGE_SIZE - 1), - num_pages, - (type == PAGELIST_READ) ? FOLL_WRITE : 0, -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index e5cdda12c7e5c35c69eb96991cfdb8326def167f..085d37588c59198b4e5f00b9249bb8421695854f 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1492,8 +1492,7 @@ dump_phys_mem(void *virt_addr, uint32_t num_bytes) - } - - down_read(¤t->mm->mmap_sem); -- rc = get_user_pages(current, /* task */ -- current->mm, /* mm */ -+ rc = get_user_pages( - (unsigned long)virt_addr, /* start */ - num_pages, /* len */ - 0, /* gup_flags */ - -From 78c3ef34645364c0313d5322eed35c608e75ed32 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 3 Oct 2016 10:16:03 -0700 -Subject: [PATCH 099/122] staging/vchi: Update for rename of - page_cache_release() to put_page(). - -Signed-off-by: Eric Anholt ---- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 4 ++-- - drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0..862fabf5682c7dededc8d7ca6773d5b227b72f3c 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -438,7 +438,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, - while (actual_pages > 0) - { - actual_pages--; -- page_cache_release(pages[actual_pages]); -+ put_page(pages[actual_pages]); - } - kfree(pagelist); - if (actual_pages == 0) -@@ -577,7 +577,7 @@ free_pagelist(PAGELIST_T *pagelist, int actual) - offset = 0; - set_page_dirty(pg); - } -- page_cache_release(pg); -+ put_page(pg); - } - } - -diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -index 085d37588c59198b4e5f00b9249bb8421695854f..5a2b8fb459ebe086ec229f37b6381bdbe6f808ca 100644 ---- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c -@@ -1530,7 +1530,7 @@ dump_phys_mem(void *virt_addr, uint32_t num_bytes) - kunmap(page); - - for (page_idx = 0; page_idx < num_pages; page_idx++) -- page_cache_release(pages[page_idx]); -+ put_page(pages[page_idx]); - - kfree(pages); - } - -From 7bc3755fca9fc00495e6ad3857bbf75756a0ad74 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 3 Oct 2016 10:21:17 -0700 -Subject: [PATCH 100/122] drivers/vchi: Remove dependency on CONFIG_BROKEN. - -The driver builds now. - -Signed-off-by: Eric Anholt ---- - drivers/staging/vc04_services/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig -index 9676fb29075a457109e4d4235f086987aec74868..db8e1beb89f9f8c48ea5964016c8285ea82497d8 100644 ---- a/drivers/staging/vc04_services/Kconfig -+++ b/drivers/staging/vc04_services/Kconfig -@@ -1,6 +1,6 @@ - config BCM2708_VCHIQ - tristate "Videocore VCHIQ" -- depends on RASPBERRYPI_FIRMWARE && BROKEN -+ depends on RASPBERRYPI_FIRMWARE - default y - help - Kernel to VideoCore communication interface for the - -From 47fc16ef621f8b834e809715c77f601e104caa3e Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 14 Sep 2016 09:16:19 +0100 -Subject: [PATCH 101/122] raspberrypi-firmware: Export the general transaction - function. - -The vc4-firmware-kms module is going to be doing the MBOX FB call. - -Signed-off-by: Eric Anholt ---- - drivers/firmware/raspberrypi.c | 3 ++- - include/soc/bcm2835/raspberrypi-firmware.h | 1 + - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c -index 3f070bd38a91511c986e3fb114b15bd4ac32634c..f261b64d1657c02290904d841e1f087c34e27ded 100644 ---- a/drivers/firmware/raspberrypi.c -+++ b/drivers/firmware/raspberrypi.c -@@ -42,7 +42,7 @@ static void response_callback(struct mbox_client *cl, void *msg) - * Sends a request to the firmware through the BCM2835 mailbox driver, - * and synchronously waits for the reply. - */ --static int -+int - rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) - { - u32 message = MBOX_MSG(chan, data); -@@ -63,6 +63,7 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) - - return ret; - } -+EXPORT_SYMBOL_GPL(rpi_firmware_transaction); - - /** - * rpi_firmware_property_list - Submit firmware property list -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index e92278968b2b979db2a1f855f70e7aafb224fa98..09e3d871d110eb0762ebdb5ea329353738d58661 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -131,5 +131,6 @@ int rpi_firmware_property(struct rpi_firmware *fw, - int rpi_firmware_property_list(struct rpi_firmware *fw, - void *data, size_t tag_size); - struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); -+int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); - - #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ - -From 9ae6d3437ea35dacb0bc1353d7c6646dd2b7913d Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 14 Sep 2016 09:18:09 +0100 -Subject: [PATCH 102/122] raspberrypi-firmware: Define the MBOX channel in the - header. - -Signed-off-by: Eric Anholt ---- - include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h -index 09e3d871d110eb0762ebdb5ea329353738d58661..2859db09e25bb945251e85edb39bc43430857168 100644 ---- a/include/soc/bcm2835/raspberrypi-firmware.h -+++ b/include/soc/bcm2835/raspberrypi-firmware.h -@@ -12,6 +12,8 @@ - #include - #include - -+#define RPI_FIRMWARE_CHAN_FB 1 -+ - struct rpi_firmware; - - enum rpi_firmware_property_status { - -From 23c8fb1fa456520a1abe7a50484eee18e94f09bc Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 14 Sep 2016 08:39:33 +0100 -Subject: [PATCH 103/122] drm/vc4: Add a mode for using the closed firmware for - display. - -Signed-off-by: Eric Anholt ---- - drivers/gpu/drm/vc4/Makefile | 1 + - drivers/gpu/drm/vc4/vc4_crtc.c | 13 + - drivers/gpu/drm/vc4/vc4_drv.c | 1 + - drivers/gpu/drm/vc4/vc4_drv.h | 7 + - drivers/gpu/drm/vc4/vc4_firmware_kms.c | 660 +++++++++++++++++++++++++++++++++ - 5 files changed, 682 insertions(+) - create mode 100644 drivers/gpu/drm/vc4/vc4_firmware_kms.c - -diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile -index fb77db755e0a29d8589860da82186c7a1f394c72..c6dd06cca9830018c39b3b16afe4045e44d1ddf4 100644 ---- a/drivers/gpu/drm/vc4/Makefile -+++ b/drivers/gpu/drm/vc4/Makefile -@@ -8,6 +8,7 @@ vc4-y := \ - vc4_crtc.o \ - vc4_drv.o \ - vc4_dpi.o \ -+ vc4_firmware_kms.o \ - vc4_kms.o \ - vc4_gem.o \ - vc4_hdmi.o \ -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index 7f08d681a74b4e37529f6c09ae1d2c1a944dcabd..7366e76c38346f7c700534b28d1eff4eca2ec2fa 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -163,6 +163,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, - int vblank_lines; - int ret = 0; - -+ if (vc4->firmware_kms) -+ return 0; -+ - /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ - - /* Get optional system timestamp before query. */ -@@ -656,6 +659,11 @@ int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id) - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id]; - -+ if (vc4->firmware_kms) { -+ /* XXX: Can we mask the SMI interrupt? */ -+ return 0; -+ } -+ - CRTC_WRITE(PV_INTEN, PV_INT_VFP_START); - - return 0; -@@ -666,6 +674,11 @@ void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id) - struct vc4_dev *vc4 = to_vc4_dev(dev); - struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id]; - -+ if (vc4->firmware_kms) { -+ /* XXX: Can we mask the SMI interrupt? */ -+ return; -+ } -+ - CRTC_WRITE(PV_INTEN, 0); - } - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c -index 8703f56b794774ac4130a7b487472e293ebe7cdf..6c4a4fbc86d0a30a6977b2081bca4372e693b817 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.c -+++ b/drivers/gpu/drm/vc4/vc4_drv.c -@@ -292,6 +292,7 @@ static struct platform_driver *const component_drivers[] = { - &vc4_dpi_driver, - &vc4_hvs_driver, - &vc4_crtc_driver, -+ &vc4_firmware_kms_driver, - &vc4_v3d_driver, - }; - -diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 7c1e4d97486fb57d9ce7002c30a23138519761ae..e1f6ab747f36dd412e00a1e7ea772f13c2fc32d5 100644 ---- a/drivers/gpu/drm/vc4/vc4_drv.h -+++ b/drivers/gpu/drm/vc4/vc4_drv.h -@@ -12,6 +12,9 @@ - struct vc4_dev { - struct drm_device *dev; - -+ bool firmware_kms; -+ struct rpi_firmware *firmware; -+ - struct vc4_hdmi *hdmi; - struct vc4_hvs *hvs; - struct vc4_crtc *crtc[3]; -@@ -460,6 +463,10 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); - extern struct platform_driver vc4_dpi_driver; - int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused); - -+/* vc4_firmware_kms.c */ -+extern struct platform_driver vc4_firmware_kms_driver; -+void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file); -+ - /* vc4_gem.c */ - void vc4_gem_init(struct drm_device *dev); - void vc4_gem_destroy(struct drm_device *dev); -diff --git a/drivers/gpu/drm/vc4/vc4_firmware_kms.c b/drivers/gpu/drm/vc4/vc4_firmware_kms.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d18a1dae51a2275846c9826b5bf1ba57ae97b55c ---- /dev/null -+++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c -@@ -0,0 +1,660 @@ -+/* -+ * Copyright (C) 2016 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+/** -+ * DOC: VC4 firmware KMS module. -+ * -+ * As a hack to get us from the current closed source driver world -+ * toward a totally open stack, implement KMS on top of the Raspberry -+ * Pi's firmware display stack. -+ */ -+ -+#include "drm_atomic.h" -+#include "drm_atomic_helper.h" -+#include "drm_plane_helper.h" -+#include "drm_crtc_helper.h" -+#include "linux/clk.h" -+#include "linux/debugfs.h" -+#include "drm_fb_cma_helper.h" -+#include "linux/component.h" -+#include "linux/of_device.h" -+#include "vc4_drv.h" -+#include "vc4_regs.h" -+#include -+ -+/* The firmware delivers a vblank interrupt to us through the SMI -+ * hardware, which has only this one register. -+ */ -+#define SMICS 0x0 -+#define SMICS_INTERRUPTS (BIT(9) | BIT(10) | BIT(11)) -+ -+struct vc4_crtc { -+ struct drm_crtc base; -+ struct drm_encoder *encoder; -+ struct drm_connector *connector; -+ void __iomem *regs; -+ -+ struct drm_pending_vblank_event *event; -+}; -+ -+static inline struct vc4_crtc *to_vc4_crtc(struct drm_crtc *crtc) -+{ -+ return container_of(crtc, struct vc4_crtc, base); -+} -+ -+struct vc4_fkms_encoder { -+ struct drm_encoder base; -+}; -+ -+static inline struct vc4_fkms_encoder * -+to_vc4_fkms_encoder(struct drm_encoder *encoder) -+{ -+ return container_of(encoder, struct vc4_fkms_encoder, base); -+} -+ -+/* VC4 FKMS connector KMS struct */ -+struct vc4_fkms_connector { -+ struct drm_connector base; -+ -+ /* Since the connector is attached to just the one encoder, -+ * this is the reference to it so we can do the best_encoder() -+ * hook. -+ */ -+ struct drm_encoder *encoder; -+}; -+ -+static inline struct vc4_fkms_connector * -+to_vc4_fkms_connector(struct drm_connector *connector) -+{ -+ return container_of(connector, struct vc4_fkms_connector, base); -+} -+ -+/* Firmware's structure for making an FB mbox call. */ -+struct fbinfo_s { -+ u32 xres, yres, xres_virtual, yres_virtual; -+ u32 pitch, bpp; -+ u32 xoffset, yoffset; -+ u32 base; -+ u32 screen_size; -+ u16 cmap[256]; -+}; -+ -+struct vc4_fkms_plane { -+ struct drm_plane base; -+ struct fbinfo_s *fbinfo; -+ dma_addr_t fbinfo_bus_addr; -+ u32 pitch; -+}; -+ -+static inline struct vc4_fkms_plane *to_vc4_fkms_plane(struct drm_plane *plane) -+{ -+ return (struct vc4_fkms_plane *)plane; -+} -+ -+/* Turns the display on/off. */ -+static int vc4_plane_set_primary_blank(struct drm_plane *plane, bool blank) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ -+ u32 packet = blank; -+ return rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_FRAMEBUFFER_BLANK, -+ &packet, sizeof(packet)); -+} -+ -+static void vc4_primary_plane_atomic_update(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ struct vc4_fkms_plane *vc4_plane = to_vc4_fkms_plane(plane); -+ struct drm_plane_state *state = plane->state; -+ struct drm_framebuffer *fb = state->fb; -+ struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -+ volatile struct fbinfo_s *fbinfo = vc4_plane->fbinfo; -+ u32 bpp = 32; -+ int ret; -+ -+ vc4_plane_set_primary_blank(plane, false); -+ -+ fbinfo->xres = state->crtc_w; -+ fbinfo->yres = state->crtc_h; -+ fbinfo->xres_virtual = state->crtc_w; -+ fbinfo->yres_virtual = state->crtc_h; -+ fbinfo->bpp = bpp; -+ fbinfo->xoffset = state->crtc_x; -+ fbinfo->yoffset = state->crtc_y; -+ fbinfo->base = bo->paddr + fb->offsets[0]; -+ fbinfo->pitch = fb->pitches[0]; -+ /* A bug in the firmware makes it so that if the fb->base is -+ * set to nonzero, the configured pitch gets overwritten with -+ * the previous pitch. So, to get the configured pitch -+ * recomputed, we have to make it allocate itself a new buffer -+ * in VC memory, first. -+ */ -+ if (vc4_plane->pitch != fb->pitches[0]) { -+ u32 saved_base = fbinfo->base; -+ fbinfo->base = 0; -+ -+ ret = rpi_firmware_transaction(vc4->firmware, -+ RPI_FIRMWARE_CHAN_FB, -+ vc4_plane->fbinfo_bus_addr); -+ fbinfo->base = saved_base; -+ -+ vc4_plane->pitch = fbinfo->pitch; -+ WARN_ON_ONCE(vc4_plane->pitch != fb->pitches[0]); -+ } -+ -+ ret = rpi_firmware_transaction(vc4->firmware, -+ RPI_FIRMWARE_CHAN_FB, -+ vc4_plane->fbinfo_bus_addr); -+ WARN_ON_ONCE(fbinfo->pitch != fb->pitches[0]); -+ WARN_ON_ONCE(fbinfo->base != bo->paddr + fb->offsets[0]); -+} -+ -+static void vc4_primary_plane_atomic_disable(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ vc4_plane_set_primary_blank(plane, true); -+} -+ -+static void vc4_cursor_plane_atomic_update(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ struct drm_plane_state *state = plane->state; -+ struct drm_framebuffer *fb = state->fb; -+ struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); -+ int ret; -+ u32 packet_state[] = { true, state->crtc_x, state->crtc_y, 0 }; -+ u32 packet_info[] = { state->crtc_w, state->crtc_h, -+ 0, /* unused */ -+ bo->paddr + fb->offsets[0], -+ 0, 0, /* hotx, hoty */}; -+ WARN_ON_ONCE(fb->pitches[0] != state->crtc_w * 4); -+ WARN_ON_ONCE(fb->bits_per_pixel != 32); -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_CURSOR_STATE, -+ &packet_state, -+ sizeof(packet_state)); -+ if (ret || packet_state[0] != 0) -+ DRM_ERROR("Failed to set cursor state: 0x%08x\n", packet_state[0]); -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_CURSOR_INFO, -+ &packet_info, -+ sizeof(packet_info)); -+ if (ret || packet_info[0] != 0) -+ DRM_ERROR("Failed to set cursor info: 0x%08x\n", packet_info[0]); -+} -+ -+static void vc4_cursor_plane_atomic_disable(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct vc4_dev *vc4 = to_vc4_dev(plane->dev); -+ u32 packet_state[] = { false, 0, 0, 0 }; -+ int ret; -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_SET_CURSOR_STATE, -+ &packet_state, -+ sizeof(packet_state)); -+ if (ret || packet_state[0] != 0) -+ DRM_ERROR("Failed to set cursor state: 0x%08x\n", packet_state[0]); -+} -+ -+static int vc4_plane_atomic_check(struct drm_plane *plane, -+ struct drm_plane_state *state) -+{ -+ return 0; -+} -+ -+static void vc4_plane_destroy(struct drm_plane *plane) -+{ -+ drm_plane_helper_disable(plane); -+ drm_plane_cleanup(plane); -+} -+ -+static const struct drm_plane_funcs vc4_plane_funcs = { -+ .update_plane = drm_atomic_helper_update_plane, -+ .disable_plane = drm_atomic_helper_disable_plane, -+ .destroy = vc4_plane_destroy, -+ .set_property = NULL, -+ .reset = drm_atomic_helper_plane_reset, -+ .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, -+ .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, -+}; -+ -+static const struct drm_plane_helper_funcs vc4_primary_plane_helper_funcs = { -+ .prepare_fb = NULL, -+ .cleanup_fb = NULL, -+ .atomic_check = vc4_plane_atomic_check, -+ .atomic_update = vc4_primary_plane_atomic_update, -+ .atomic_disable = vc4_primary_plane_atomic_disable, -+}; -+ -+static const struct drm_plane_helper_funcs vc4_cursor_plane_helper_funcs = { -+ .prepare_fb = NULL, -+ .cleanup_fb = NULL, -+ .atomic_check = vc4_plane_atomic_check, -+ .atomic_update = vc4_cursor_plane_atomic_update, -+ .atomic_disable = vc4_cursor_plane_atomic_disable, -+}; -+ -+static struct drm_plane *vc4_fkms_plane_init(struct drm_device *dev, -+ enum drm_plane_type type) -+{ -+ struct drm_plane *plane = NULL; -+ struct vc4_fkms_plane *vc4_plane; -+ u32 xrgb8888 = DRM_FORMAT_XRGB8888; -+ u32 argb8888 = DRM_FORMAT_ARGB8888; -+ int ret = 0; -+ bool primary = (type == DRM_PLANE_TYPE_PRIMARY); -+ -+ vc4_plane = devm_kzalloc(dev->dev, sizeof(*vc4_plane), -+ GFP_KERNEL); -+ if (!vc4_plane) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ plane = &vc4_plane->base; -+ ret = drm_universal_plane_init(dev, plane, 0xff, -+ &vc4_plane_funcs, -+ primary ? &xrgb8888 : &argb8888, 1, -+ type, NULL); -+ -+ if (type == DRM_PLANE_TYPE_PRIMARY) { -+ vc4_plane->fbinfo = -+ dma_alloc_coherent(dev->dev, -+ sizeof(*vc4_plane->fbinfo), -+ &vc4_plane->fbinfo_bus_addr, -+ GFP_KERNEL); -+ memset(vc4_plane->fbinfo, 0, sizeof(*vc4_plane->fbinfo)); -+ -+ drm_plane_helper_add(plane, &vc4_primary_plane_helper_funcs); -+ } else { -+ drm_plane_helper_add(plane, &vc4_cursor_plane_helper_funcs); -+ } -+ -+ return plane; -+fail: -+ if (plane) -+ vc4_plane_destroy(plane); -+ -+ return ERR_PTR(ret); -+} -+ -+static void vc4_crtc_mode_set_nofb(struct drm_crtc *crtc) -+{ -+ /* Everyting is handled in the planes. */ -+} -+ -+static void vc4_crtc_disable(struct drm_crtc *crtc) -+{ -+} -+ -+static void vc4_crtc_enable(struct drm_crtc *crtc) -+{ -+} -+ -+static int vc4_crtc_atomic_check(struct drm_crtc *crtc, -+ struct drm_crtc_state *state) -+{ -+ return 0; -+} -+ -+static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, -+ struct drm_crtc_state *old_state) -+{ -+} -+ -+static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) -+{ -+ struct drm_crtc *crtc = &vc4_crtc->base; -+ struct drm_device *dev = crtc->dev; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&dev->event_lock, flags); -+ if (vc4_crtc->event) { -+ drm_crtc_send_vblank_event(crtc, vc4_crtc->event); -+ vc4_crtc->event = NULL; -+ drm_crtc_vblank_put(crtc); -+ } -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+} -+ -+static irqreturn_t vc4_crtc_irq_handler(int irq, void *data) -+{ -+ struct vc4_crtc *vc4_crtc = data; -+ u32 stat = readl(vc4_crtc->regs + SMICS); -+ irqreturn_t ret = IRQ_NONE; -+ -+ if (stat & SMICS_INTERRUPTS) { -+ writel(0, vc4_crtc->regs + SMICS); -+ drm_crtc_handle_vblank(&vc4_crtc->base); -+ vc4_crtc_handle_page_flip(vc4_crtc); -+ ret = IRQ_HANDLED; -+ } -+ -+ return ret; -+} -+ -+static int vc4_page_flip(struct drm_crtc *crtc, -+ struct drm_framebuffer *fb, -+ struct drm_pending_vblank_event *event, -+ uint32_t flags) -+{ -+ if (flags & DRM_MODE_PAGE_FLIP_ASYNC) { -+ DRM_ERROR("Async flips aren't allowed\n"); -+ return -EINVAL; -+ } -+ -+ return drm_atomic_helper_page_flip(crtc, fb, event, flags); -+} -+ -+static const struct drm_crtc_funcs vc4_crtc_funcs = { -+ .set_config = drm_atomic_helper_set_config, -+ .destroy = drm_crtc_cleanup, -+ .page_flip = vc4_page_flip, -+ .set_property = NULL, -+ .cursor_set = NULL, /* handled by drm_mode_cursor_universal */ -+ .cursor_move = NULL, /* handled by drm_mode_cursor_universal */ -+ .reset = drm_atomic_helper_crtc_reset, -+ .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, -+ .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, -+}; -+ -+static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { -+ .mode_set_nofb = vc4_crtc_mode_set_nofb, -+ .disable = vc4_crtc_disable, -+ .enable = vc4_crtc_enable, -+ .atomic_check = vc4_crtc_atomic_check, -+ .atomic_flush = vc4_crtc_atomic_flush, -+}; -+ -+/* Frees the page flip event when the DRM device is closed with the -+ * event still outstanding. -+ */ -+void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file) -+{ -+ struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); -+ struct drm_device *dev = crtc->dev; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&dev->event_lock, flags); -+ -+ if (vc4_crtc->event && vc4_crtc->event->base.file_priv == file) { -+ kfree(&vc4_crtc->event->base); -+ drm_crtc_vblank_put(crtc); -+ vc4_crtc->event = NULL; -+ } -+ -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+} -+ -+static const struct of_device_id vc4_firmware_kms_dt_match[] = { -+ { .compatible = "raspberrypi,rpi-firmware-kms" }, -+ {} -+}; -+ -+static enum drm_connector_status -+vc4_fkms_connector_detect(struct drm_connector *connector, bool force) -+{ -+ return connector_status_connected; -+} -+ -+static int vc4_fkms_connector_get_modes(struct drm_connector *connector) -+{ -+ struct drm_device *dev = connector->dev; -+ struct vc4_dev *vc4 = to_vc4_dev(dev); -+ u32 wh[2] = {0, 0}; -+ int ret; -+ struct drm_display_mode *mode; -+ -+ ret = rpi_firmware_property(vc4->firmware, -+ RPI_FIRMWARE_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT, -+ &wh, sizeof(wh)); -+ if (ret) { -+ DRM_ERROR("Failed to get screen size: %d (0x%08x 0x%08x)\n", -+ ret, wh[0], wh[1]); -+ return 0; -+ } -+ -+ mode = drm_cvt_mode(dev, wh[0], wh[1], 60 /* vrefresh */, -+ 0, 0, false); -+ drm_mode_probed_add(connector, mode); -+ -+ return 1; -+} -+ -+static struct drm_encoder * -+vc4_fkms_connector_best_encoder(struct drm_connector *connector) -+{ -+ struct vc4_fkms_connector *fkms_connector = -+ to_vc4_fkms_connector(connector); -+ return fkms_connector->encoder; -+} -+ -+static void vc4_fkms_connector_destroy(struct drm_connector *connector) -+{ -+ drm_connector_unregister(connector); -+ drm_connector_cleanup(connector); -+} -+ -+static const struct drm_connector_funcs vc4_fkms_connector_funcs = { -+ .dpms = drm_atomic_helper_connector_dpms, -+ .detect = vc4_fkms_connector_detect, -+ .fill_modes = drm_helper_probe_single_connector_modes, -+ .destroy = vc4_fkms_connector_destroy, -+ .reset = drm_atomic_helper_connector_reset, -+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, -+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -+}; -+ -+static const struct drm_connector_helper_funcs vc4_fkms_connector_helper_funcs = { -+ .get_modes = vc4_fkms_connector_get_modes, -+ .best_encoder = vc4_fkms_connector_best_encoder, -+}; -+ -+static struct drm_connector *vc4_fkms_connector_init(struct drm_device *dev, -+ struct drm_encoder *encoder) -+{ -+ struct drm_connector *connector = NULL; -+ struct vc4_fkms_connector *fkms_connector; -+ int ret = 0; -+ -+ fkms_connector = devm_kzalloc(dev->dev, sizeof(*fkms_connector), -+ GFP_KERNEL); -+ if (!fkms_connector) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ connector = &fkms_connector->base; -+ -+ fkms_connector->encoder = encoder; -+ -+ drm_connector_init(dev, connector, &vc4_fkms_connector_funcs, -+ DRM_MODE_CONNECTOR_HDMIA); -+ drm_connector_helper_add(connector, &vc4_fkms_connector_helper_funcs); -+ -+ connector->polled = (DRM_CONNECTOR_POLL_CONNECT | -+ DRM_CONNECTOR_POLL_DISCONNECT); -+ -+ connector->interlace_allowed = 0; -+ connector->doublescan_allowed = 0; -+ -+ drm_mode_connector_attach_encoder(connector, encoder); -+ -+ return connector; -+ -+ fail: -+ if (connector) -+ vc4_fkms_connector_destroy(connector); -+ -+ return ERR_PTR(ret); -+} -+ -+static void vc4_fkms_encoder_destroy(struct drm_encoder *encoder) -+{ -+ drm_encoder_cleanup(encoder); -+} -+ -+static const struct drm_encoder_funcs vc4_fkms_encoder_funcs = { -+ .destroy = vc4_fkms_encoder_destroy, -+}; -+ -+static void vc4_fkms_encoder_enable(struct drm_encoder *encoder) -+{ -+} -+ -+static void vc4_fkms_encoder_disable(struct drm_encoder *encoder) -+{ -+} -+ -+static const struct drm_encoder_helper_funcs vc4_fkms_encoder_helper_funcs = { -+ .enable = vc4_fkms_encoder_enable, -+ .disable = vc4_fkms_encoder_disable, -+}; -+ -+static int vc4_fkms_bind(struct device *dev, struct device *master, void *data) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct drm_device *drm = dev_get_drvdata(master); -+ struct vc4_dev *vc4 = to_vc4_dev(drm); -+ struct vc4_crtc *vc4_crtc; -+ struct vc4_fkms_encoder *vc4_encoder; -+ struct drm_crtc *crtc; -+ struct drm_plane *primary_plane, *cursor_plane, *destroy_plane, *temp; -+ struct device_node *firmware_node; -+ int ret; -+ -+ vc4->firmware_kms = true; -+ -+ vc4_crtc = devm_kzalloc(dev, sizeof(*vc4_crtc), GFP_KERNEL); -+ if (!vc4_crtc) -+ return -ENOMEM; -+ crtc = &vc4_crtc->base; -+ -+ firmware_node = of_parse_phandle(dev->of_node, "brcm,firmware", 0); -+ vc4->firmware = rpi_firmware_get(firmware_node); -+ if (!vc4->firmware) { -+ DRM_DEBUG("Failed to get Raspberry Pi firmware reference.\n"); -+ return -EPROBE_DEFER; -+ } -+ of_node_put(firmware_node); -+ -+ /* Map the SMI interrupt reg */ -+ vc4_crtc->regs = vc4_ioremap_regs(pdev, 0); -+ if (IS_ERR(vc4_crtc->regs)) -+ return PTR_ERR(vc4_crtc->regs); -+ -+ /* For now, we create just the primary and the legacy cursor -+ * planes. We should be able to stack more planes on easily, -+ * but to do that we would need to compute the bandwidth -+ * requirement of the plane configuration, and reject ones -+ * that will take too much. -+ */ -+ primary_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_PRIMARY); -+ if (IS_ERR(primary_plane)) { -+ dev_err(dev, "failed to construct primary plane\n"); -+ ret = PTR_ERR(primary_plane); -+ goto err; -+ } -+ -+ cursor_plane = vc4_fkms_plane_init(drm, DRM_PLANE_TYPE_CURSOR); -+ if (IS_ERR(cursor_plane)) { -+ dev_err(dev, "failed to construct cursor plane\n"); -+ ret = PTR_ERR(cursor_plane); -+ goto err; -+ } -+ -+ drm_crtc_init_with_planes(drm, crtc, primary_plane, cursor_plane, -+ &vc4_crtc_funcs, NULL); -+ drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs); -+ primary_plane->crtc = crtc; -+ cursor_plane->crtc = crtc; -+ vc4->crtc[drm_crtc_index(crtc)] = vc4_crtc; -+ -+ vc4_encoder = devm_kzalloc(dev, sizeof(*vc4_encoder), GFP_KERNEL); -+ if (!vc4_encoder) -+ return -ENOMEM; -+ vc4_crtc->encoder = &vc4_encoder->base; -+ vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ; -+ drm_encoder_init(drm, &vc4_encoder->base, &vc4_fkms_encoder_funcs, -+ DRM_MODE_ENCODER_TMDS, NULL); -+ drm_encoder_helper_add(&vc4_encoder->base, -+ &vc4_fkms_encoder_helper_funcs); -+ -+ vc4_crtc->connector = vc4_fkms_connector_init(drm, &vc4_encoder->base); -+ if (IS_ERR(vc4_crtc->connector)) { -+ ret = PTR_ERR(vc4_crtc->connector); -+ goto err_destroy_encoder; -+ } -+ -+ writel(0, vc4_crtc->regs + SMICS); -+ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), -+ vc4_crtc_irq_handler, 0, "vc4 firmware kms", -+ vc4_crtc); -+ if (ret) -+ goto err_destroy_connector; -+ -+ platform_set_drvdata(pdev, vc4_crtc); -+ -+ return 0; -+ -+err_destroy_connector: -+ vc4_fkms_connector_destroy(vc4_crtc->connector); -+err_destroy_encoder: -+ vc4_fkms_encoder_destroy(vc4_crtc->encoder); -+ list_for_each_entry_safe(destroy_plane, temp, -+ &drm->mode_config.plane_list, head) { -+ if (destroy_plane->possible_crtcs == 1 << drm_crtc_index(crtc)) -+ destroy_plane->funcs->destroy(destroy_plane); -+ } -+err: -+ return ret; -+} -+ -+static void vc4_fkms_unbind(struct device *dev, struct device *master, -+ void *data) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct vc4_crtc *vc4_crtc = dev_get_drvdata(dev); -+ -+ vc4_fkms_connector_destroy(vc4_crtc->connector); -+ vc4_fkms_encoder_destroy(vc4_crtc->encoder); -+ drm_crtc_cleanup(&vc4_crtc->base); -+ -+ platform_set_drvdata(pdev, NULL); -+} -+ -+static const struct component_ops vc4_fkms_ops = { -+ .bind = vc4_fkms_bind, -+ .unbind = vc4_fkms_unbind, -+}; -+ -+static int vc4_fkms_probe(struct platform_device *pdev) -+{ -+ return component_add(&pdev->dev, &vc4_fkms_ops); -+} -+ -+static int vc4_fkms_remove(struct platform_device *pdev) -+{ -+ component_del(&pdev->dev, &vc4_fkms_ops); -+ return 0; -+} -+ -+struct platform_driver vc4_firmware_kms_driver = { -+ .probe = vc4_fkms_probe, -+ .remove = vc4_fkms_remove, -+ .driver = { -+ .name = "vc4_firmware_kms", -+ .of_match_table = vc4_firmware_kms_dt_match, -+ }, -+}; - -From 26a8008c3e11309384b26b46cfc4c6499c2fe676 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Sat, 17 Sep 2016 15:07:10 +0200 -Subject: [PATCH 104/122] i2c: bcm2835: Fix hang for writing messages larger - than 16 bytes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Writing messages larger than the FIFO size results in a hang, rendering -the machine unusable. This is because the RXD status flag is set on the -first interrupt which results in bcm2835_drain_rxfifo() stealing bytes -from the buffer. The controller continues to trigger interrupts waiting -for the missing bytes, but bcm2835_fill_txfifo() has none to give. -In this situation wait_for_completion_timeout() apparently is unable to -stop the madness. - -The BCM2835 ARM Peripherals datasheet has this to say about the flags: - TXD: is set when the FIFO has space for at least one byte of data. - RXD: is set when the FIFO contains at least one byte of data. - TXW: is set during a write transfer and the FIFO is less than full. - RXR: is set during a read transfer and the FIFO is or more full. - -Implementing the logic from the downstream i2c-bcm2708 driver solved -the hang problem. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt -Reviewed-by: Martin Sperl ---- - drivers/i2c/busses/i2c-bcm2835.c | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index d4f3239b56865919e1b781b20a7c5ebcd76b4eb9..f283b714aa79e2e4685ed95b04b6b289f7e9eee7 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -64,6 +64,7 @@ struct bcm2835_i2c_dev { - int irq; - struct i2c_adapter adapter; - struct completion completion; -+ struct i2c_msg *curr_msg; - u32 msg_err; - u8 *msg_buf; - size_t msg_buf_remaining; -@@ -126,14 +127,13 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - return IRQ_HANDLED; - } - -- if (val & BCM2835_I2C_S_RXD) { -- bcm2835_drain_rxfifo(i2c_dev); -- if (!(val & BCM2835_I2C_S_DONE)) -- return IRQ_HANDLED; -- } -- - if (val & BCM2835_I2C_S_DONE) { -- if (i2c_dev->msg_buf_remaining) -+ if (i2c_dev->curr_msg->flags & I2C_M_RD) { -+ bcm2835_drain_rxfifo(i2c_dev); -+ val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); -+ } -+ -+ if ((val & BCM2835_I2C_S_RXD) || i2c_dev->msg_buf_remaining) - i2c_dev->msg_err = BCM2835_I2C_S_LEN; - else - i2c_dev->msg_err = 0; -@@ -141,11 +141,16 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - return IRQ_HANDLED; - } - -- if (val & BCM2835_I2C_S_TXD) { -+ if (val & BCM2835_I2C_S_TXW) { - bcm2835_fill_txfifo(i2c_dev); - return IRQ_HANDLED; - } - -+ if (val & BCM2835_I2C_S_RXR) { -+ bcm2835_drain_rxfifo(i2c_dev); -+ return IRQ_HANDLED; -+ } -+ - return IRQ_NONE; - } - -@@ -155,6 +160,7 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - u32 c; - unsigned long time_left; - -+ i2c_dev->curr_msg = msg; - i2c_dev->msg_buf = msg->buf; - i2c_dev->msg_buf_remaining = msg->len; - reinit_completion(&i2c_dev->completion); - -From c91628e1f62406194456f78889477efa6ebe1592 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Sep 2016 18:24:38 +0200 -Subject: [PATCH 105/122] i2c: bcm2835: Protect against unexpected TXW/RXR - interrupts -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If an unexpected TXW or RXR interrupt occurs (msg_buf_remaining == 0), -the driver has no way to fill/drain the FIFO to stop the interrupts. -In this case the controller has to be disabled and the transfer -completed to avoid hang. - -(CLKT | ERR) and DONE interrupts are completed in their own paths, and -the controller is disabled in the transfer function after completion. -Unite the code paths and do disabling inside the interrupt routine. - -Clear interrupt status bits in the united completion path instead of -trying to do it on every interrupt which isn't necessary. -Only CLKT, ERR and DONE can be cleared that way. - -Add the status value to the error value in case of TXW/RXR errors to -distinguish them from the other S_LEN error. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 40 +++++++++++++++++++++++++++++++--------- - 1 file changed, 31 insertions(+), 9 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index f283b714aa79e2e4685ed95b04b6b289f7e9eee7..d2ba1a4de36af512e8e3c97251bd3537ae61591a 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -50,8 +50,6 @@ - #define BCM2835_I2C_S_CLKT BIT(9) - #define BCM2835_I2C_S_LEN BIT(10) /* Fake bit for SW error reporting */ - --#define BCM2835_I2C_BITMSK_S 0x03FF -- - #define BCM2835_I2C_CDIV_MIN 0x0002 - #define BCM2835_I2C_CDIV_MAX 0xFFFE - -@@ -111,20 +109,26 @@ static void bcm2835_drain_rxfifo(struct bcm2835_i2c_dev *i2c_dev) - } - } - -+/* -+ * Note about I2C_C_CLEAR on error: -+ * The I2C_C_CLEAR on errors will take some time to resolve -- if you were in -+ * non-idle state and I2C_C_READ, it sets an abort_rx flag and runs through -+ * the state machine to send a NACK and a STOP. Since we're setting CLEAR -+ * without I2CEN, that NACK will be hanging around queued up for next time -+ * we start the engine. -+ */ -+ - static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - { - struct bcm2835_i2c_dev *i2c_dev = data; - u32 val, err; - - val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); -- val &= BCM2835_I2C_BITMSK_S; -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S, val); - - err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR); - if (err) { - i2c_dev->msg_err = err; -- complete(&i2c_dev->completion); -- return IRQ_HANDLED; -+ goto complete; - } - - if (val & BCM2835_I2C_S_DONE) { -@@ -137,21 +141,38 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - i2c_dev->msg_err = BCM2835_I2C_S_LEN; - else - i2c_dev->msg_err = 0; -- complete(&i2c_dev->completion); -- return IRQ_HANDLED; -+ goto complete; - } - - if (val & BCM2835_I2C_S_TXW) { -+ if (!i2c_dev->msg_buf_remaining) { -+ i2c_dev->msg_err = val | BCM2835_I2C_S_LEN; -+ goto complete; -+ } -+ - bcm2835_fill_txfifo(i2c_dev); - return IRQ_HANDLED; - } - - if (val & BCM2835_I2C_S_RXR) { -+ if (!i2c_dev->msg_buf_remaining) { -+ i2c_dev->msg_err = val | BCM2835_I2C_S_LEN; -+ goto complete; -+ } -+ - bcm2835_drain_rxfifo(i2c_dev); - return IRQ_HANDLED; - } - - return IRQ_NONE; -+ -+complete: -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_S, BCM2835_I2C_S_CLKT | -+ BCM2835_I2C_S_ERR | BCM2835_I2C_S_DONE); -+ complete(&i2c_dev->completion); -+ -+ return IRQ_HANDLED; - } - - static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, -@@ -181,8 +202,9 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - - time_left = wait_for_completion_timeout(&i2c_dev->completion, - BCM2835_I2C_TIMEOUT); -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); - if (!time_left) { -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, -+ BCM2835_I2C_C_CLEAR); - dev_err(i2c_dev->dev, "i2c transfer timed out\n"); - return -ETIMEDOUT; - } - -From 878f3d3cb001a41cefc17e11e5b527b576478959 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Mon, 19 Sep 2016 17:19:41 +0200 -Subject: [PATCH 106/122] i2c: bcm2835: Use dev_dbg logging on transfer errors -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Writing to an AT24C32 generates on average 2x i2c transfer errors per -32-byte page write. Which amounts to a lot for a 4k write. This is due -to the fact that the chip doesn't respond during it's internal write -cycle when the at24 driver tries and retries the next write. -Only a handful drivers use dev_err() on transfer error, so switch to -dev_dbg() instead. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index d2ba1a4de36af512e8e3c97251bd3537ae61591a..54d510abd46a117c9238fc6d7edec84019d1f60d 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -216,7 +216,7 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - (msg->flags & I2C_M_IGNORE_NAK)) - return 0; - -- dev_err(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); -+ dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - return -EREMOTEIO; - -From dd301c9f8456669afa77139328d78bac9f2fcb48 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Thu, 22 Sep 2016 22:05:50 +0200 -Subject: [PATCH 107/122] i2c: bcm2835: Can't support I2C_M_IGNORE_NAK -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The controller can't support this flag, so remove it. - -Documentation/i2c/i2c-protocol states that all of the message is sent: - -I2C_M_IGNORE_NAK: - Normally message is interrupted immediately if there is [NA] from the - client. Setting this flag treats any [NA] as [A], and all of - message is sent. - -From the BCM2835 ARM Peripherals datasheet: - - The ERR field is set when the slave fails to acknowledge either - its address or a data byte written to it. - -So when the controller doesn't receive an ack, it sets ERR and raises -an interrupt. In other words, the whole message is not sent. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index 54d510abd46a117c9238fc6d7edec84019d1f60d..565ef69ce61423544dc0558c85ef318b0ae9c324 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -212,10 +212,6 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - if (likely(!i2c_dev->msg_err)) - return 0; - -- if ((i2c_dev->msg_err & BCM2835_I2C_S_ERR) && -- (msg->flags & I2C_M_IGNORE_NAK)) -- return 0; -- - dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - -From 17019eef014c360549b56b67f8f6448e718b9496 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Sep 2016 04:54:27 +0200 -Subject: [PATCH 108/122] i2c: bcm2835: Add support for Repeated Start - Condition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Documentation/i2c/i2c-protocol states that Combined transactions should -separate messages with a Start bit and end the whole transaction with a -Stop bit. This patch adds support for issuing only a Start between -messages instead of a Stop followed by a Start. - -This implementation differs from downstream i2c-bcm2708 in 2 respects: -- it uses an interrupt to detect that the transfer is active instead - of using polling. There is no interrupt for Transfer Active, but by - not prefilling the FIFO it's possible to use the TXW interrupt. -- when resetting/disabling the controller between transfers it writes - CLEAR to the control register instead of just zero. - Using just zero gave many errors. This might be the reason why - downstream had to disable this feature and make it available with a - module parameter. - -I have run thousands of transfers to a DS1307 (rtc), MMA8451 (accel) -and AT24C32 (eeprom) in parallel without problems. - -Signed-off-by: Noralf Trønnes -Acked-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 101 ++++++++++++++++++++++++--------------- - 1 file changed, 63 insertions(+), 38 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index 565ef69ce61423544dc0558c85ef318b0ae9c324..241e08ae7c27cec23fad3c1bf3ebad3a4d2a8e6f 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -63,6 +63,7 @@ struct bcm2835_i2c_dev { - struct i2c_adapter adapter; - struct completion completion; - struct i2c_msg *curr_msg; -+ int num_msgs; - u32 msg_err; - u8 *msg_buf; - size_t msg_buf_remaining; -@@ -110,6 +111,45 @@ static void bcm2835_drain_rxfifo(struct bcm2835_i2c_dev *i2c_dev) - } - - /* -+ * Repeated Start Condition (Sr) -+ * The BCM2835 ARM Peripherals datasheet mentions a way to trigger a Sr when it -+ * talks about reading from a slave with 10 bit address. This is achieved by -+ * issuing a write, poll the I2CS.TA flag and wait for it to be set, and then -+ * issue a read. -+ * A comment in https://github.com/raspberrypi/linux/issues/254 shows how the -+ * firmware actually does it using polling and says that it's a workaround for -+ * a problem in the state machine. -+ * It turns out that it is possible to use the TXW interrupt to know when the -+ * transfer is active, provided the FIFO has not been prefilled. -+ */ -+ -+static void bcm2835_i2c_start_transfer(struct bcm2835_i2c_dev *i2c_dev) -+{ -+ u32 c = BCM2835_I2C_C_ST | BCM2835_I2C_C_I2CEN; -+ struct i2c_msg *msg = i2c_dev->curr_msg; -+ bool last_msg = (i2c_dev->num_msgs == 1); -+ -+ if (!i2c_dev->num_msgs) -+ return; -+ -+ i2c_dev->num_msgs--; -+ i2c_dev->msg_buf = msg->buf; -+ i2c_dev->msg_buf_remaining = msg->len; -+ -+ if (msg->flags & I2C_M_RD) -+ c |= BCM2835_I2C_C_READ | BCM2835_I2C_C_INTR; -+ else -+ c |= BCM2835_I2C_C_INTT; -+ -+ if (last_msg) -+ c |= BCM2835_I2C_C_INTD; -+ -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); -+} -+ -+/* - * Note about I2C_C_CLEAR on error: - * The I2C_C_CLEAR on errors will take some time to resolve -- if you were in - * non-idle state and I2C_C_READ, it sets an abort_rx flag and runs through -@@ -151,6 +191,12 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - } - - bcm2835_fill_txfifo(i2c_dev); -+ -+ if (i2c_dev->num_msgs && !i2c_dev->msg_buf_remaining) { -+ i2c_dev->curr_msg++; -+ bcm2835_i2c_start_transfer(i2c_dev); -+ } -+ - return IRQ_HANDLED; - } - -@@ -175,30 +221,25 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - return IRQ_HANDLED; - } - --static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, -- struct i2c_msg *msg) -+static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], -+ int num) - { -- u32 c; -+ struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); - unsigned long time_left; -+ int i; - -- i2c_dev->curr_msg = msg; -- i2c_dev->msg_buf = msg->buf; -- i2c_dev->msg_buf_remaining = msg->len; -- reinit_completion(&i2c_dev->completion); -- -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -+ for (i = 0; i < (num - 1); i++) -+ if (msgs[i].flags & I2C_M_RD) { -+ dev_warn_once(i2c_dev->dev, -+ "only one read message supported, has to be last\n"); -+ return -EOPNOTSUPP; -+ } - -- if (msg->flags & I2C_M_RD) { -- c = BCM2835_I2C_C_READ | BCM2835_I2C_C_INTR; -- } else { -- c = BCM2835_I2C_C_INTT; -- bcm2835_fill_txfifo(i2c_dev); -- } -- c |= BCM2835_I2C_C_ST | BCM2835_I2C_C_INTD | BCM2835_I2C_C_I2CEN; -+ i2c_dev->curr_msg = msgs; -+ i2c_dev->num_msgs = num; -+ reinit_completion(&i2c_dev->completion); - -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); -+ bcm2835_i2c_start_transfer(i2c_dev); - - time_left = wait_for_completion_timeout(&i2c_dev->completion, - BCM2835_I2C_TIMEOUT); -@@ -209,31 +250,15 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, - return -ETIMEDOUT; - } - -- if (likely(!i2c_dev->msg_err)) -- return 0; -+ if (!i2c_dev->msg_err) -+ return num; - - dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - return -EREMOTEIO; -- else -- return -EIO; --} -- --static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], -- int num) --{ -- struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); -- int i; -- int ret = 0; -- -- for (i = 0; i < num; i++) { -- ret = bcm2835_i2c_xfer_msg(i2c_dev, &msgs[i]); -- if (ret) -- break; -- } - -- return ret ?: i; -+ return -EIO; - } - - static u32 bcm2835_i2c_func(struct i2c_adapter *adap) - -From 90f2d2d5fb2aa94eafd361372b6a55fa3ad1b029 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Fri, 23 Sep 2016 04:57:17 +0200 -Subject: [PATCH 109/122] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use i2c_adapter->timeout for the completion timeout value. The core -default is 1 second. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Eric Anholt ---- - drivers/i2c/busses/i2c-bcm2835.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index 241e08ae7c27cec23fad3c1bf3ebad3a4d2a8e6f..d2085dd3742eabebc537621968088261f8dc7ea8 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -53,8 +53,6 @@ - #define BCM2835_I2C_CDIV_MIN 0x0002 - #define BCM2835_I2C_CDIV_MAX 0xFFFE - --#define BCM2835_I2C_TIMEOUT (msecs_to_jiffies(1000)) -- - struct bcm2835_i2c_dev { - struct device *dev; - void __iomem *regs; -@@ -242,7 +240,7 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - bcm2835_i2c_start_transfer(i2c_dev); - - time_left = wait_for_completion_timeout(&i2c_dev->completion, -- BCM2835_I2C_TIMEOUT); -+ adap->timeout); - if (!time_left) { - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, - BCM2835_I2C_C_CLEAR); - -From d0724c34a0fc6d93228c19bede299e63afe0c036 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Tue, 27 Sep 2016 01:00:08 +0200 -Subject: [PATCH 110/122] i2c: bcm2835: Add support for dynamic clock -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Support a dynamic clock by reading the frequency and setting the -divisor in the transfer function instead of during probe. - -Signed-off-by: Noralf Trønnes -Reviewed-by: Martin Sperl ---- - drivers/i2c/busses/i2c-bcm2835.c | 51 +++++++++++++++++++++++++--------------- - 1 file changed, 32 insertions(+), 19 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index d2085dd3742eabebc537621968088261f8dc7ea8..c3436f627028477f7e21b47e079fd5ab06ec188a 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -58,6 +58,7 @@ struct bcm2835_i2c_dev { - void __iomem *regs; - struct clk *clk; - int irq; -+ u32 bus_clk_rate; - struct i2c_adapter adapter; - struct completion completion; - struct i2c_msg *curr_msg; -@@ -78,6 +79,30 @@ static inline u32 bcm2835_i2c_readl(struct bcm2835_i2c_dev *i2c_dev, u32 reg) - return readl(i2c_dev->regs + reg); - } - -+static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev) -+{ -+ u32 divider; -+ -+ divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk), -+ i2c_dev->bus_clk_rate); -+ /* -+ * Per the datasheet, the register is always interpreted as an even -+ * number, by rounding down. In other words, the LSB is ignored. So, -+ * if the LSB is set, increment the divider to avoid any issue. -+ */ -+ if (divider & 1) -+ divider++; -+ if ((divider < BCM2835_I2C_CDIV_MIN) || -+ (divider > BCM2835_I2C_CDIV_MAX)) { -+ dev_err_ratelimited(i2c_dev->dev, "Invalid clock-frequency\n"); -+ return -EINVAL; -+ } -+ -+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider); -+ -+ return 0; -+} -+ - static void bcm2835_fill_txfifo(struct bcm2835_i2c_dev *i2c_dev) - { - u32 val; -@@ -224,7 +249,7 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - { - struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); - unsigned long time_left; -- int i; -+ int i, ret; - - for (i = 0; i < (num - 1); i++) - if (msgs[i].flags & I2C_M_RD) { -@@ -233,6 +258,10 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - return -EOPNOTSUPP; - } - -+ ret = bcm2835_i2c_set_divider(i2c_dev); -+ if (ret) -+ return ret; -+ - i2c_dev->curr_msg = msgs; - i2c_dev->num_msgs = num; - reinit_completion(&i2c_dev->completion); -@@ -282,7 +311,6 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) - { - struct bcm2835_i2c_dev *i2c_dev; - struct resource *mem, *irq; -- u32 bus_clk_rate, divider; - int ret; - struct i2c_adapter *adap; - -@@ -306,27 +334,12 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) - } - - ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", -- &bus_clk_rate); -+ &i2c_dev->bus_clk_rate); - if (ret < 0) { - dev_warn(&pdev->dev, - "Could not read clock-frequency property\n"); -- bus_clk_rate = 100000; -- } -- -- divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk), bus_clk_rate); -- /* -- * Per the datasheet, the register is always interpreted as an even -- * number, by rounding down. In other words, the LSB is ignored. So, -- * if the LSB is set, increment the divider to avoid any issue. -- */ -- if (divider & 1) -- divider++; -- if ((divider < BCM2835_I2C_CDIV_MIN) || -- (divider > BCM2835_I2C_CDIV_MAX)) { -- dev_err(&pdev->dev, "Invalid clock-frequency\n"); -- return -ENODEV; -+ i2c_dev->bus_clk_rate = 100000; - } -- bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider); - - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq) { - -From 0cc815d16e01c81698ecb53c57222ffb003377bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= -Date: Tue, 1 Nov 2016 15:15:41 +0100 -Subject: [PATCH 111/122] i2c: bcm2835: Add debug support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This adds a debug module parameter to aid in debugging transfer issues -by printing info to the kernel log. When enabled, status values are -collected in the interrupt routine and msg info in -bcm2835_i2c_start_transfer(). This is done in a way that tries to avoid -affecting timing. Having printk in the isr can mask issues. - -debug values (additive): -1: Print info on error -2: Print info on all transfers -3: Print messages before transfer is started - -The value can be changed at runtime: -/sys/module/i2c_bcm2835/parameters/debug - -Example output, debug=3: -[ 747.114448] bcm2835_i2c_xfer: msg(1/2) write addr=0x54, len=2 flags= [i2c1] -[ 747.114463] bcm2835_i2c_xfer: msg(2/2) read addr=0x54, len=32 flags= [i2c1] -[ 747.117809] start_transfer: msg(1/2) write addr=0x54, len=2 flags= [i2c1] -[ 747.117825] isr: remain=2, status=0x30000055 : TA TXW TXD TXE [i2c1] -[ 747.117839] start_transfer: msg(2/2) read addr=0x54, len=32 flags= [i2c1] -[ 747.117849] isr: remain=32, status=0xd0000039 : TA RXR TXD RXD [i2c1] -[ 747.117861] isr: remain=20, status=0xd0000039 : TA RXR TXD RXD [i2c1] -[ 747.117870] isr: remain=8, status=0x32 : DONE TXD RXD [i2c1] - -Signed-off-by: Noralf Trønnes ---- - drivers/i2c/busses/i2c-bcm2835.c | 99 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 98 insertions(+), 1 deletion(-) - -diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c -index c3436f627028477f7e21b47e079fd5ab06ec188a..8642f580ce41803bd22c76a0fa80d083d0747be1 100644 ---- a/drivers/i2c/busses/i2c-bcm2835.c -+++ b/drivers/i2c/busses/i2c-bcm2835.c -@@ -53,6 +53,18 @@ - #define BCM2835_I2C_CDIV_MIN 0x0002 - #define BCM2835_I2C_CDIV_MAX 0xFFFE - -+static unsigned int debug; -+module_param(debug, uint, 0644); -+MODULE_PARM_DESC(debug, "1=err, 2=isr, 3=xfer"); -+ -+#define BCM2835_DEBUG_MAX 512 -+struct bcm2835_debug { -+ struct i2c_msg *msg; -+ int msg_idx; -+ size_t remain; -+ u32 status; -+}; -+ - struct bcm2835_i2c_dev { - struct device *dev; - void __iomem *regs; -@@ -66,8 +78,78 @@ struct bcm2835_i2c_dev { - u32 msg_err; - u8 *msg_buf; - size_t msg_buf_remaining; -+ struct bcm2835_debug debug[BCM2835_DEBUG_MAX]; -+ unsigned int debug_num; -+ unsigned int debug_num_msgs; - }; - -+static inline void bcm2835_debug_add(struct bcm2835_i2c_dev *i2c_dev, u32 s) -+{ -+ if (!i2c_dev->debug_num_msgs || i2c_dev->debug_num >= BCM2835_DEBUG_MAX) -+ return; -+ -+ i2c_dev->debug[i2c_dev->debug_num].msg = i2c_dev->curr_msg; -+ i2c_dev->debug[i2c_dev->debug_num].msg_idx = -+ i2c_dev->debug_num_msgs - i2c_dev->num_msgs; -+ i2c_dev->debug[i2c_dev->debug_num].remain = i2c_dev->msg_buf_remaining; -+ i2c_dev->debug[i2c_dev->debug_num].status = s; -+ i2c_dev->debug_num++; -+} -+ -+static void bcm2835_debug_print_status(struct bcm2835_i2c_dev *i2c_dev, -+ struct bcm2835_debug *d) -+{ -+ u32 s = d->status; -+ -+ pr_info("isr: remain=%zu, status=0x%x : %s%s%s%s%s%s%s%s%s%s [i2c%d]\n", -+ d->remain, s, -+ s & BCM2835_I2C_S_TA ? "TA " : "", -+ s & BCM2835_I2C_S_DONE ? "DONE " : "", -+ s & BCM2835_I2C_S_TXW ? "TXW " : "", -+ s & BCM2835_I2C_S_RXR ? "RXR " : "", -+ s & BCM2835_I2C_S_TXD ? "TXD " : "", -+ s & BCM2835_I2C_S_RXD ? "RXD " : "", -+ s & BCM2835_I2C_S_TXE ? "TXE " : "", -+ s & BCM2835_I2C_S_RXF ? "RXF " : "", -+ s & BCM2835_I2C_S_ERR ? "ERR " : "", -+ s & BCM2835_I2C_S_CLKT ? "CLKT " : "", -+ i2c_dev->adapter.nr); -+} -+ -+static void bcm2835_debug_print_msg(struct bcm2835_i2c_dev *i2c_dev, -+ struct i2c_msg *msg, int i, int total, -+ const char *fname) -+{ -+ pr_info("%s: msg(%d/%d) %s addr=0x%02x, len=%u flags=%s%s%s%s%s%s%s [i2c%d]\n", -+ fname, i, total, -+ msg->flags & I2C_M_RD ? "read" : "write", msg->addr, msg->len, -+ msg->flags & I2C_M_TEN ? "TEN" : "", -+ msg->flags & I2C_M_RECV_LEN ? "RECV_LEN" : "", -+ msg->flags & I2C_M_NO_RD_ACK ? "NO_RD_ACK" : "", -+ msg->flags & I2C_M_IGNORE_NAK ? "IGNORE_NAK" : "", -+ msg->flags & I2C_M_REV_DIR_ADDR ? "REV_DIR_ADDR" : "", -+ msg->flags & I2C_M_NOSTART ? "NOSTART" : "", -+ msg->flags & I2C_M_STOP ? "STOP" : "", -+ i2c_dev->adapter.nr); -+} -+ -+static void bcm2835_debug_print(struct bcm2835_i2c_dev *i2c_dev) -+{ -+ struct bcm2835_debug *d; -+ unsigned int i; -+ -+ for (i = 0; i < i2c_dev->debug_num; i++) { -+ d = &i2c_dev->debug[i]; -+ if (d->status == ~0) -+ bcm2835_debug_print_msg(i2c_dev, d->msg, d->msg_idx, -+ i2c_dev->debug_num_msgs, "start_transfer"); -+ else -+ bcm2835_debug_print_status(i2c_dev, d); -+ } -+ if (i2c_dev->debug_num >= BCM2835_DEBUG_MAX) -+ pr_info("BCM2835_DEBUG_MAX reached\n"); -+} -+ - static inline void bcm2835_i2c_writel(struct bcm2835_i2c_dev *i2c_dev, - u32 reg, u32 val) - { -@@ -170,6 +252,7 @@ static void bcm2835_i2c_start_transfer(struct bcm2835_i2c_dev *i2c_dev) - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_A, msg->addr); - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DLEN, msg->len); - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, c); -+ bcm2835_debug_add(i2c_dev, ~0); - } - - /* -@@ -187,6 +270,7 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) - u32 val, err; - - val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); -+ bcm2835_debug_add(i2c_dev, val); - - err = val & (BCM2835_I2C_S_CLKT | BCM2835_I2C_S_ERR); - if (err) { -@@ -251,6 +335,13 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - unsigned long time_left; - int i, ret; - -+ if (debug) -+ i2c_dev->debug_num_msgs = num; -+ -+ if (debug > 2) -+ for (i = 0; i < num; i++) -+ bcm2835_debug_print_msg(i2c_dev, &msgs[i], i + 1, num, __func__); -+ - for (i = 0; i < (num - 1); i++) - if (msgs[i].flags & I2C_M_RD) { - dev_warn_once(i2c_dev->dev, -@@ -270,6 +361,10 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - - time_left = wait_for_completion_timeout(&i2c_dev->completion, - adap->timeout); -+ if (debug > 1 || (debug && (!time_left || i2c_dev->msg_err))) -+ bcm2835_debug_print(i2c_dev); -+ i2c_dev->debug_num_msgs = 0; -+ i2c_dev->debug_num = 0; - if (!time_left) { - bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, - BCM2835_I2C_C_CLEAR); -@@ -280,7 +375,9 @@ static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], - if (!i2c_dev->msg_err) - return num; - -- dev_dbg(i2c_dev->dev, "i2c transfer failed: %x\n", i2c_dev->msg_err); -+ if (debug) -+ dev_err(i2c_dev->dev, "i2c transfer failed: %x\n", -+ i2c_dev->msg_err); - - if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) - return -EREMOTEIO; - -From 683eb2a626bdf358dd1d447bfe3b0e7d112d8024 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 31 Dec 2016 14:15:50 +0000 -Subject: [PATCH 112/122] arm64: Add CONFIG_ARCH_BCM2835 - ---- - arch/arm64/configs/bcmrpi3_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -index d7406f5a4620151044b8f716b4d10bb818648e06..53da5c7a33e5898a66e549fb0c39fe3da555ca87 100644 ---- a/arch/arm64/configs/bcmrpi3_defconfig -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -1332,3 +1332,4 @@ CONFIG_ARM64_CRYPTO=y - CONFIG_CRC_ITU_T=y - CONFIG_LIBCRC32C=y - CONFIG_BCM2708_VCHIQ=n -+CONFIG_ARCH_BCM2835=y - -From 8ec76aa6373a8c90eac7d8c8e980fa333ff69464 Mon Sep 17 00:00:00 2001 -From: Alex Tucker -Date: Tue, 13 Dec 2016 19:50:18 +0000 -Subject: [PATCH 113/122] Add support for Silicon Labs Si7013/20/21 - humidity/temperature sensor. - ---- - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 49 +++++++++++++---------- - 1 file changed, 28 insertions(+), 21 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -index f6d134c095af2398fc55ae7d2b0e86456c30627c..31bda8da4cb6a56bfe493a81b918900995fb0589 100644 ---- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -1,34 +1,41 @@ --// Definitions for a few digital barometric pressure and temperature sensors -+// Definitions for I2C based sensors using the Industrial IO interface. - /dts-v1/; - /plugin/; - - / { -- compatible = "brcm,bcm2708"; -+ compatible = "brcm,bcm2708"; - -- fragment@0 { -- target = <&i2c_arm>; -- __overlay__ { -- #address-cells = <1>; -- #size-cells = <0>; -- status = "okay"; -+ fragment@0 { -+ target = <&i2c_arm>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - -- bmp085: bmp085@77 { -- compatible = "bosch,bmp085"; -- reg = <0x77>; -- default-oversampling = <3>; -- status = "disable"; -- }; -+ bmp085: bmp085@77 { -+ compatible = "bosch,bmp085"; -+ reg = <0x77>; -+ default-oversampling = <3>; -+ status = "disable"; -+ }; - -- bmp280: bmp280@76 { -- compatible = "bosch,bmp280"; -- reg = <0x76>; -- status = "disable"; -- }; -- }; -- }; -+ bmp280: bmp280@76 { -+ compatible = "bosch,bmp280"; -+ reg = <0x76>; -+ status = "disable"; -+ }; -+ -+ si7020: si7020@40 { -+ compatible = "si7020"; -+ reg = <0x40>; -+ status = "disable"; -+ }; -+ }; -+ }; - - __overrides__ { - bmp085 = <&bmp085>,"status"; - bmp280 = <&bmp280>,"status"; -+ si7020 = <&si7020>,"status"; - }; - }; - -From 3b6760e6f2f03b620e4e88d67d3b640c56ce7fd3 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 3 Jan 2017 21:27:46 +0000 -Subject: [PATCH 114/122] Document the si7020 option - ---- - arch/arm/boot/dts/overlays/README | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 81d991803be335e5a1bc3bb0a8c7a2c9f5c392bd..e8fa4ccb44c34a20485c4e6155467af99179153a 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -549,6 +549,9 @@ Params: bmp085 Select the Bosch sensortronic BMP085 - - bmp280 Select the Bosch sensortronic BMP280 - -+ si7020 Select the Silicon Labs Si7013/20/21 humidity/ -+ temperature sensor -+ - - Name: i2c0-bcm2708 - Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations - -From 4ef541bea608cd9f84bc76c8092fafaad1702e3f Mon Sep 17 00:00:00 2001 -From: Giedrius Trainavicius -Date: Thu, 5 Jan 2017 02:38:16 +0200 -Subject: [PATCH 115/122] pisound improvements: - -* Added a writable sysfs object to enable scripts / user space software -to blink MIDI activity LEDs for variable duration. -* Improved hw_param constraints setting. -* Added compatibility with S16_LE sample format. -* Exposed some simple placeholder volume controls, so the card appears -in volumealsa widget. - -Signed-off-by: Giedrius Trainavicius ---- - sound/soc/bcm/pisound.c | 175 ++++++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 154 insertions(+), 21 deletions(-) - -diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c -index 4b8545487d06e4ea70073a5d063fb2310b3b94d0..ba70734b89e61a11201657406223f0b37d54f74a 100644 ---- a/sound/soc/bcm/pisound.c -+++ b/sound/soc/bcm/pisound.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - static int pisnd_spi_init(struct device *dev); - static void pisnd_spi_uninit(void); -@@ -214,6 +215,9 @@ static char g_serial_num[11]; - static char g_id[25]; - static char g_version[5]; - -+static uint8_t g_ledFlashDuration; -+static bool g_ledFlashDurationChanged; -+ - DEFINE_KFIFO(spi_fifo_in, uint8_t, FIFO_SIZE); - DEFINE_KFIFO(spi_fifo_out, uint8_t, FIFO_SIZE); - -@@ -396,8 +400,13 @@ static void pisnd_work_handler(struct work_struct *work) - val = 0; - tx = 0; - -- if (kfifo_get(&spi_fifo_out, &val)) -+ if (g_ledFlashDurationChanged) { -+ tx = 0xf000 | g_ledFlashDuration; -+ g_ledFlashDuration = 0; -+ g_ledFlashDurationChanged = false; -+ } else if (kfifo_get(&spi_fifo_out, &val)) { - tx = 0x0f00 | val; -+ } - - rx = spi_transfer16(tx); - -@@ -410,6 +419,7 @@ static void pisnd_work_handler(struct work_struct *work) - } while (rx != 0 - || !kfifo_is_empty(&spi_fifo_out) - || pisnd_spi_has_more() -+ || g_ledFlashDurationChanged - ); - - if (!kfifo_is_empty(&spi_fifo_in) && g_recvCallback) -@@ -569,7 +579,7 @@ static int pisnd_spi_init(struct device *dev) - } - - /* Flash the LEDs. */ -- spi_transfer16(0xf000); -+ spi_transfer16(0xf008); - - ret = pisnd_spi_gpio_irq_init(dev); - if (ret < 0) { -@@ -610,6 +620,14 @@ static void pisnd_spi_uninit(void) - pisnd_spi_gpio_uninit(); - } - -+static void pisnd_spi_flash_leds(uint8_t duration) -+{ -+ g_ledFlashDuration = duration; -+ g_ledFlashDurationChanged = true; -+ printd("schedule from spi_flash_leds\n"); -+ pisnd_schedule_process(TASK_PROCESS); -+} -+ - static void pisnd_spi_send(uint8_t val) - { - kfifo_put(&spi_fifo_out, val); -@@ -658,6 +676,83 @@ static const struct of_device_id pisound_of_match[] = { - {}, - }; - -+enum { -+ SWITCH = 0, -+ VOLUME = 1, -+}; -+ -+static int pisnd_ctl_info(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_info *uinfo) -+{ -+ if (kcontrol->private_value == SWITCH) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = 1; -+ return 0; -+ } else if (kcontrol->private_value == VOLUME) { -+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; -+ uinfo->count = 1; -+ uinfo->value.integer.min = 0; -+ uinfo->value.integer.max = 100; -+ return 0; -+ } -+ return -EINVAL; -+} -+ -+static int pisnd_ctl_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ if (kcontrol->private_value == SWITCH) { -+ ucontrol->value.integer.value[0] = 1; -+ return 0; -+ } else if (kcontrol->private_value == VOLUME) { -+ ucontrol->value.integer.value[0] = 100; -+ return 0; -+ } -+ -+ return -EINVAL; -+} -+ -+static struct snd_kcontrol_new pisnd_ctl[] = { -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Switch", -+ .index = 0, -+ .private_value = SWITCH, -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .info = pisnd_ctl_info, -+ .get = pisnd_ctl_get, -+ }, -+ { -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, -+ .name = "PCM Playback Volume", -+ .index = 0, -+ .private_value = VOLUME, -+ .access = SNDRV_CTL_ELEM_ACCESS_READ, -+ .info = pisnd_ctl_info, -+ .get = pisnd_ctl_get, -+ }, -+}; -+ -+static int pisnd_ctl_init(struct snd_card *card) -+{ -+ int err, i; -+ -+ for (i = 0; i < ARRAY_SIZE(pisnd_ctl); ++i) { -+ err = snd_ctl_add(card, snd_ctl_new1(&pisnd_ctl[i], NULL)); -+ if (err < 0) -+ return err; -+ } -+ -+ return 0; -+} -+ -+static int pisnd_ctl_uninit(void) -+{ -+ return 0; -+} -+ - static struct gpio_desc *osr0, *osr1, *osr2; - static struct gpio_desc *reset; - static struct gpio_desc *button; -@@ -667,6 +762,14 @@ static int pisnd_hw_params( - struct snd_pcm_hw_params *params - ) - { -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ /* pisound runs on fixed 32 clock counts per channel, -+ * as generated by the master ADC. -+ */ -+ snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2); -+ - printd("rate = %d\n", params_rate(params)); - printd("ch = %d\n", params_channels(params)); - printd("bits = %u\n", -@@ -711,16 +814,6 @@ static struct snd_pcm_hw_constraint_list constraints_rates = { - .mask = 0, - }; - --static unsigned int sample_bits[] = { -- 24, 32 --}; -- --static struct snd_pcm_hw_constraint_list constraints_sample_bits = { -- .count = ARRAY_SIZE(sample_bits), -- .list = sample_bits, -- .mask = 0, --}; -- - static int pisnd_startup(struct snd_pcm_substream *substream) - { - int err = snd_pcm_hw_constraint_list( -@@ -733,11 +826,21 @@ static int pisnd_startup(struct snd_pcm_substream *substream) - if (err < 0) - return err; - -- err = snd_pcm_hw_constraint_list( -+ err = snd_pcm_hw_constraint_single( - substream->runtime, -- 0, -- SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -- &constraints_sample_bits -+ SNDRV_PCM_HW_PARAM_CHANNELS, -+ 2 -+ ); -+ -+ if (err < 0) -+ return err; -+ -+ err = snd_pcm_hw_constraint_mask64( -+ substream->runtime, -+ SNDRV_PCM_HW_PARAM_FORMAT, -+ SNDRV_PCM_FMTBIT_S16_LE | -+ SNDRV_PCM_FMTBIT_S24_LE | -+ SNDRV_PCM_FMTBIT_S32_LE - ); - - if (err < 0) -@@ -771,14 +874,23 @@ static int pisnd_card_probe(struct snd_soc_card *card) - { - int err = pisnd_midi_init(card->snd_card); - -- if (err < 0) -+ if (err < 0) { - printe("pisnd_midi_init failed: %d\n", err); -+ return err; -+ } - -- return err; -+ err = pisnd_ctl_init(card->snd_card); -+ if (err < 0) { -+ printe("pisnd_ctl_init failed: %d\n", err); -+ return err; -+ } -+ -+ return 0; - } - - static int pisnd_card_remove(struct snd_soc_card *card) - { -+ pisnd_ctl_uninit(); - pisnd_midi_uninit(); - return 0; - } -@@ -870,17 +982,38 @@ static ssize_t pisnd_version_show( - return sprintf(buf, "%s\n", pisnd_spi_get_version()); - } - -+static ssize_t pisnd_led_store( -+ struct kobject *kobj, -+ struct kobj_attribute *attr, -+ const char *buf, -+ size_t length -+ ) -+{ -+ uint32_t timeout; -+ int err; -+ -+ err = kstrtou32(buf, 10, &timeout); -+ -+ if (err == 0 && timeout <= 255) -+ pisnd_spi_flash_leds(timeout); -+ -+ return length; -+} -+ - static struct kobj_attribute pisnd_serial_attribute = -- __ATTR(serial, 0644, pisnd_serial_show, NULL); -+ __ATTR(serial, 0444, pisnd_serial_show, NULL); - static struct kobj_attribute pisnd_id_attribute = -- __ATTR(id, 0644, pisnd_id_show, NULL); -+ __ATTR(id, 0444, pisnd_id_show, NULL); - static struct kobj_attribute pisnd_version_attribute = -- __ATTR(version, 0644, pisnd_version_show, NULL); -+ __ATTR(version, 0444, pisnd_version_show, NULL); -+static struct kobj_attribute pisnd_led_attribute = -+ __ATTR(led, 0644, NULL, pisnd_led_store); - - static struct attribute *attrs[] = { - &pisnd_serial_attribute.attr, - &pisnd_id_attribute.attr, - &pisnd_version_attribute.attr, -+ &pisnd_led_attribute.attr, - NULL - }; - - -From 425e9111b1dfad787b1f787ec5086fdf1893584e Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 9 Jan 2017 09:23:06 +0000 -Subject: [PATCH 116/122] Revert "Revert "Added driver for HiFiBerry Amp - amplifier add-on board"" - -This reverts commit bf84babd8fffcb79c60f1342c2416f8e1e4b7af9. ---- - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/hifiberry_amp.c | 129 +++++++++++++++ - sound/soc/codecs/Kconfig | 4 + - sound/soc/codecs/Makefile | 2 + - sound/soc/codecs/tas5713.c | 369 ++++++++++++++++++++++++++++++++++++++++++ - sound/soc/codecs/tas5713.h | 210 ++++++++++++++++++++++++ - 7 files changed, 723 insertions(+) - create mode 100644 sound/soc/bcm/hifiberry_amp.c - create mode 100644 sound/soc/codecs/tas5713.c - create mode 100644 sound/soc/codecs/tas5713.h - -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index a0ef6a028136beb27ed13a4136712a70a60f2966..d024377e8450fb5402dcb5ea27161f774b04a8ec 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -38,6 +38,13 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI - help - Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. - -+config SND_BCM2708_SOC_HIFIBERRY_AMP -+ tristate "Support for the HifiBerry Amp" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_TAS5713 -+ help -+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board. -+ - config SND_BCM2708_SOC_RPI_DAC - tristate "Support for RPi-DAC" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index f720a3d3b5832844ee6d0558317c728f00c40b65..bb1df438540193652ec5464e8bc51f636a1b844e 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -10,6 +10,7 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-cygnus.o - - # BCM2708 Machine Support - snd-soc-adau1977-adc-objs := adau1977-adc.o -+snd-soc-hifiberry-amp-objs := hifiberry_amp.o - snd-soc-hifiberry-dac-objs := hifiberry_dac.o - snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o - snd-soc-hifiberry-digi-objs := hifiberry_digi.o -@@ -27,6 +28,7 @@ snd-soc-allo-piano-dac-objs := allo-piano-dac.o - snd-soc-pisound-objs := pisound.o - - obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o -+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o - obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o -diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d17c29780507dc31c50f1d567ff5cea7c8241ff5 ---- /dev/null -+++ b/sound/soc/bcm/hifiberry_amp.c -@@ -0,0 +1,129 @@ -+/* -+ * ASoC Driver for HifiBerry AMP -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ // ToDo: init of the dsp-registers. -+ return 0; -+} -+ -+static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params ) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = { -+ .hw_params = snd_rpi_hifiberry_amp_hw_params, -+}; -+ -+static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { -+ { -+ .name = "HifiBerry AMP", -+ .stream_name = "HifiBerry AMP HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "tas5713-hifi", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "tas5713.1-001b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBS_CFS, -+ .ops = &snd_rpi_hifiberry_amp_ops, -+ .init = snd_rpi_hifiberry_amp_init, -+ }, -+}; -+ -+ -+static struct snd_soc_card snd_rpi_hifiberry_amp = { -+ .name = "snd_rpi_hifiberry_amp", -+ .driver_name = "HifiberryAmp", -+ .owner = THIS_MODULE, -+ .dai_link = snd_rpi_hifiberry_amp_dai, -+ .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), -+}; -+ -+static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = { -+ { .compatible = "hifiberry,hifiberry-amp", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match); -+ -+ -+static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_rpi_hifiberry_amp.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ } -+ -+ ret = snd_soc_register_card(&snd_rpi_hifiberry_amp); -+ -+ if (ret != 0) { -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); -+ } -+ -+ return ret; -+} -+ -+ -+static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_rpi_hifiberry_amp); -+} -+ -+ -+static struct platform_driver snd_rpi_hifiberry_amp_driver = { -+ .driver = { -+ .name = "snd-hifiberry-amp", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_rpi_hifiberry_amp_of_match, -+ }, -+ .probe = snd_rpi_hifiberry_amp_probe, -+ .remove = snd_rpi_hifiberry_amp_remove, -+}; -+ -+ -+module_platform_driver(snd_rpi_hifiberry_amp_driver); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 74a93e52bdc8116df3db08aaf98fffa1e6f6cc1b..9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -139,6 +139,7 @@ config SND_SOC_ALL_CODECS - select SND_SOC_TFA9879 if I2C - select SND_SOC_TLV320AIC23_I2C if I2C - select SND_SOC_TLV320AIC23_SPI if SPI_MASTER -+ select SND_SOC_TAS5713 if I2C - select SND_SOC_TLV320AIC26 if SPI_MASTER - select SND_SOC_TLV320AIC31XX if I2C - select SND_SOC_TLV320AIC32X4_I2C if I2C -@@ -821,6 +822,9 @@ config SND_SOC_TFA9879 - tristate "NXP Semiconductors TFA9879 amplifier" - depends on I2C - -+config SND_SOC_TAS5713 -+ tristate -+ - config SND_SOC_TLV320AIC23 - tristate - -diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile -index 77786e7f44a7fa22d9b5beed3eb687e2b7a28526..5a2db0d2fe2f49920eeccfecef62c969ae2e99a1 100644 ---- a/sound/soc/codecs/Makefile -+++ b/sound/soc/codecs/Makefile -@@ -144,6 +144,7 @@ snd-soc-tas5086-objs := tas5086.o - snd-soc-tas571x-objs := tas571x.o - snd-soc-tas5720-objs := tas5720.o - snd-soc-tfa9879-objs := tfa9879.o -+snd-soc-tas5713-objs := tas5713.o - snd-soc-tlv320aic23-objs := tlv320aic23.o - snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o - snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o -@@ -366,6 +367,7 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o - obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o - obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o - obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o -+obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o - obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o - obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -new file mode 100644 -index 0000000000000000000000000000000000000000..9b2713861dcbed751842ca29c88eb1eae5867411 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.c -@@ -0,0 +1,369 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "tas5713.h" -+ -+ -+static struct i2c_client *i2c; -+ -+struct tas5713_priv { -+ struct regmap *regmap; -+ int mclk_div; -+ struct snd_soc_codec *codec; -+}; -+ -+static struct tas5713_priv *priv_data; -+ -+ -+ -+ -+/* -+ * _ _ ___ _ ___ _ _ -+ * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___ -+ * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-< -+ * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/ -+ * -+ */ -+ -+static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1); -+ -+ -+static const struct snd_kcontrol_new tas5713_snd_controls[] = { -+ SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv), -+ SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv) -+}; -+ -+ -+ -+ -+/* -+ * __ __ _ _ ___ _ -+ * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _ -+ * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_| -+ * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params, -+ struct snd_soc_dai *dai) -+{ -+ u16 blen = 0x00; -+ -+ struct snd_soc_codec *codec; -+ codec = dai->codec; -+ priv_data->codec = dai->codec; -+ -+ switch (params_format(params)) { -+ case SNDRV_PCM_FORMAT_S16_LE: -+ blen = 0x03; -+ break; -+ case SNDRV_PCM_FORMAT_S20_3LE: -+ blen = 0x1; -+ break; -+ case SNDRV_PCM_FORMAT_S24_LE: -+ blen = 0x04; -+ break; -+ case SNDRV_PCM_FORMAT_S32_LE: -+ blen = 0x05; -+ break; -+ default: -+ dev_err(dai->dev, "Unsupported word length: %u\n", -+ params_format(params)); -+ return -EINVAL; -+ } -+ -+ // set word length -+ snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen); -+ -+ return 0; -+} -+ -+ -+static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream) -+{ -+ unsigned int val = 0; -+ -+ struct tas5713_priv *tas5713; -+ struct snd_soc_codec *codec = dai->codec; -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ if (mute) { -+ val = TAS5713_SOFT_MUTE_ALL; -+ } -+ -+ return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val); -+} -+ -+ -+static const struct snd_soc_dai_ops tas5713_dai_ops = { -+ .hw_params = tas5713_hw_params, -+ .mute_stream = tas5713_mute_stream, -+}; -+ -+ -+static struct snd_soc_dai_driver tas5713_dai = { -+ .name = "tas5713-hifi", -+ .playback = { -+ .stream_name = "Playback", -+ .channels_min = 2, -+ .channels_max = 2, -+ .rates = SNDRV_PCM_RATE_8000_48000, -+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ), -+ }, -+ .ops = &tas5713_dai_ops, -+}; -+ -+ -+ -+ -+/* -+ * ___ _ ___ _ -+ * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _ -+ * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_| -+ * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static int tas5713_remove(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ return 0; -+} -+ -+ -+static int tas5713_probe(struct snd_soc_codec *codec) -+{ -+ struct tas5713_priv *tas5713; -+ int i, ret; -+ -+ i2c = container_of(codec->dev, struct i2c_client, dev); -+ -+ tas5713 = snd_soc_codec_get_drvdata(codec); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Trim oscillator -+ ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00); -+ if (ret < 0) return ret; -+ msleep(1000); -+ -+ // Reset error -+ ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00); -+ if (ret < 0) return ret; -+ -+ // Clock mode: 44/48kHz, MCLK=64xfs -+ ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60); -+ if (ret < 0) return ret; -+ -+ // I2S 24bit -+ ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05); -+ if (ret < 0) return ret; -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00); -+ if (ret < 0) return ret; -+ -+ // Set volume to 0db -+ ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00); -+ if (ret < 0) return ret; -+ -+ // Now start programming the default initialization sequence -+ for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) { -+ ret = i2c_master_send(i2c, -+ tas5713_init_sequence[i].data, -+ tas5713_init_sequence[i].size); -+ if (ret < 0) { -+ printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret); -+ } -+ } -+ -+ // Unmute -+ ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00); -+ if (ret < 0) return ret; -+ -+ return 0; -+} -+ -+ -+static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { -+ .probe = tas5713_probe, -+ .remove = tas5713_remove, -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+}; -+ -+ -+ -+ -+/* -+ * ___ ___ ___ ___ _ -+ * |_ _|_ ) __| | \ _ _(_)_ _____ _ _ -+ * | | / / (__ | |) | '_| \ V / -_) '_| -+ * |___/___\___| |___/|_| |_|\_/\___|_| -+ * -+ */ -+ -+static const struct reg_default tas5713_reg_defaults[] = { -+ { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB -+ { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB -+ { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB -+ { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB -+}; -+ -+ -+static bool tas5713_reg_volatile(struct device *dev, unsigned int reg) -+{ -+ switch (reg) { -+ case TAS5713_DEVICE_ID: -+ case TAS5713_ERROR_STATUS: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+ -+static const struct of_device_id tas5713_of_match[] = { -+ { .compatible = "ti,tas5713", }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, tas5713_of_match); -+ -+ -+static struct regmap_config tas5713_regmap_config = { -+ .reg_bits = 8, -+ .val_bits = 8, -+ -+ .max_register = TAS5713_MAX_REGISTER, -+ .volatile_reg = tas5713_reg_volatile, -+ -+ .cache_type = REGCACHE_RBTREE, -+ .reg_defaults = tas5713_reg_defaults, -+ .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults), -+}; -+ -+ -+static int tas5713_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) -+{ -+ int ret; -+ -+ priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL); -+ if (!priv_data) -+ return -ENOMEM; -+ -+ priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config); -+ if (IS_ERR(priv_data->regmap)) { -+ ret = PTR_ERR(priv_data->regmap); -+ return ret; -+ } -+ -+ i2c_set_clientdata(i2c, priv_data); -+ -+ ret = snd_soc_register_codec(&i2c->dev, -+ &soc_codec_dev_tas5713, &tas5713_dai, 1); -+ -+ return ret; -+} -+ -+ -+static int tas5713_i2c_remove(struct i2c_client *i2c) -+{ -+ snd_soc_unregister_codec(&i2c->dev); -+ i2c_set_clientdata(i2c, NULL); -+ -+ kfree(priv_data); -+ -+ return 0; -+} -+ -+ -+static const struct i2c_device_id tas5713_i2c_id[] = { -+ { "tas5713", 0 }, -+ { } -+}; -+ -+MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id); -+ -+ -+static struct i2c_driver tas5713_i2c_driver = { -+ .driver = { -+ .name = "tas5713", -+ .owner = THIS_MODULE, -+ .of_match_table = tas5713_of_match, -+ }, -+ .probe = tas5713_i2c_probe, -+ .remove = tas5713_i2c_remove, -+ .id_table = tas5713_i2c_id -+}; -+ -+ -+static int __init tas5713_modinit(void) -+{ -+ int ret = 0; -+ -+ ret = i2c_add_driver(&tas5713_i2c_driver); -+ if (ret) { -+ printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n", -+ ret); -+ } -+ -+ return ret; -+} -+module_init(tas5713_modinit); -+ -+ -+static void __exit tas5713_exit(void) -+{ -+ i2c_del_driver(&tas5713_i2c_driver); -+} -+module_exit(tas5713_exit); -+ -+ -+MODULE_AUTHOR("Sebastian Eickhoff "); -+MODULE_DESCRIPTION("ASoC driver for TAS5713"); -+MODULE_LICENSE("GPL v2"); -diff --git a/sound/soc/codecs/tas5713.h b/sound/soc/codecs/tas5713.h -new file mode 100644 -index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8f612a342 ---- /dev/null -+++ b/sound/soc/codecs/tas5713.h -@@ -0,0 +1,210 @@ -+/* -+ * ASoC Driver for TAS5713 -+ * -+ * Author: Sebastian Eickhoff -+ * Copyright 2014 -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program 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. -+ */ -+ -+#ifndef _TAS5713_H -+#define _TAS5713_H -+ -+ -+// TAS5713 I2C-bus register addresses -+ -+#define TAS5713_CLOCK_CTRL 0x00 -+#define TAS5713_DEVICE_ID 0x01 -+#define TAS5713_ERROR_STATUS 0x02 -+#define TAS5713_SYSTEM_CTRL1 0x03 -+#define TAS5713_SERIAL_DATA_INTERFACE 0x04 -+#define TAS5713_SYSTEM_CTRL2 0x05 -+#define TAS5713_SOFT_MUTE 0x06 -+#define TAS5713_VOL_MASTER 0x07 -+#define TAS5713_VOL_CH1 0x08 -+#define TAS5713_VOL_CH2 0x09 -+#define TAS5713_VOL_HEADPHONE 0x0A -+#define TAS5713_VOL_CONFIG 0x0E -+#define TAS5713_MODULATION_LIMIT 0x10 -+#define TAS5713_IC_DLY_CH1 0x11 -+#define TAS5713_IC_DLY_CH2 0x12 -+#define TAS5713_IC_DLY_CH3 0x13 -+#define TAS5713_IC_DLY_CH4 0x14 -+ -+#define TAS5713_START_STOP_PERIOD 0x1A -+#define TAS5713_OSC_TRIM 0x1B -+#define TAS5713_BKND_ERR 0x1C -+ -+#define TAS5713_INPUT_MUX 0x20 -+#define TAS5713_SRC_SELECT_CH4 0x21 -+#define TAS5713_PWM_MUX 0x25 -+ -+#define TAS5713_CH1_BQ0 0x29 -+#define TAS5713_CH1_BQ1 0x2A -+#define TAS5713_CH1_BQ2 0x2B -+#define TAS5713_CH1_BQ3 0x2C -+#define TAS5713_CH1_BQ4 0x2D -+#define TAS5713_CH1_BQ5 0x2E -+#define TAS5713_CH1_BQ6 0x2F -+#define TAS5713_CH1_BQ7 0x58 -+#define TAS5713_CH1_BQ8 0x59 -+ -+#define TAS5713_CH2_BQ0 0x30 -+#define TAS5713_CH2_BQ1 0x31 -+#define TAS5713_CH2_BQ2 0x32 -+#define TAS5713_CH2_BQ3 0x33 -+#define TAS5713_CH2_BQ4 0x34 -+#define TAS5713_CH2_BQ5 0x35 -+#define TAS5713_CH2_BQ6 0x36 -+#define TAS5713_CH2_BQ7 0x5C -+#define TAS5713_CH2_BQ8 0x5D -+ -+#define TAS5713_CH4_BQ0 0x5A -+#define TAS5713_CH4_BQ1 0x5B -+#define TAS5713_CH3_BQ0 0x5E -+#define TAS5713_CH3_BQ1 0x5F -+ -+#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B -+#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C -+#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E -+#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F -+#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40 -+#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43 -+#define TAS5713_DRC_CTRL 0x46 -+ -+#define TAS5713_BANK_SW_CTRL 0x50 -+#define TAS5713_CH1_OUTPUT_MIXER 0x51 -+#define TAS5713_CH2_OUTPUT_MIXER 0x52 -+#define TAS5713_CH1_INPUT_MIXER 0x53 -+#define TAS5713_CH2_INPUT_MIXER 0x54 -+#define TAS5713_OUTPUT_POST_SCALE 0x56 -+#define TAS5713_OUTPUT_PRESCALE 0x57 -+ -+#define TAS5713_IDF_POST_SCALE 0x62 -+ -+#define TAS5713_CH1_INLINE_MIXER 0x70 -+#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71 -+#define TAS5713_CH1_R_CHANNEL_MIXER 0x72 -+#define TAS5713_CH1_L_CHANNEL_MIXER 0x73 -+#define TAS5713_CH2_INLINE_MIXER 0x74 -+#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75 -+#define TAS5713_CH2_L_CHANNEL_MIXER 0x76 -+#define TAS5713_CH2_R_CHANNEL_MIXER 0x77 -+ -+#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8 -+#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9 -+ -+#define TAS5713_REGISTER_COUNT 0x46 -+#define TAS5713_MAX_REGISTER 0xF9 -+ -+ -+// Bitmasks for registers -+#define TAS5713_SOFT_MUTE_ALL 0x07 -+ -+ -+ -+struct tas5713_init_command { -+ const int size; -+ const char *const data; -+}; -+ -+static const struct tas5713_init_command tas5713_init_sequence[] = { -+ -+ // Trim oscillator -+ { .size = 2, .data = "\x1B\x00" }, -+ // System control register 1 (0x03): block DC -+ { .size = 2, .data = "\x03\x80" }, -+ // Mute everything -+ { .size = 2, .data = "\x05\x40" }, -+ // Modulation limit register (0x10): 97.7% -+ { .size = 2, .data = "\x10\x02" }, -+ // Interchannel delay registers -+ // (0x11, 0x12, 0x13, and 0x14): BD mode -+ { .size = 2, .data = "\x11\xB8" }, -+ { .size = 2, .data = "\x12\x60" }, -+ { .size = 2, .data = "\x13\xA0" }, -+ { .size = 2, .data = "\x14\x48" }, -+ // PWM shutdown group register (0x19): no shutdown -+ { .size = 2, .data = "\x19\x00" }, -+ // Input multiplexer register (0x20): BD mode -+ { .size = 2, .data = "\x20\x00\x89\x77\x72" }, -+ // PWM output mux register (0x25) -+ // Channel 1 --> OUTA, channel 1 neg --> OUTB -+ // Channel 2 --> OUTC, channel 2 neg --> OUTD -+ { .size = 5, .data = "\x25\x01\x02\x13\x45" }, -+ // DRC control (0x46): DRC off -+ { .size = 5, .data = "\x46\x00\x00\x00\x00" }, -+ // BKND_ERR register (0x1C): 299ms reset period -+ { .size = 2, .data = "\x1C\x07" }, -+ // Mute channel 3 -+ { .size = 2, .data = "\x0A\xFF" }, -+ // Volume configuration register (0x0E): volume slew 512 steps -+ { .size = 2, .data = "\x0E\x90" }, -+ // Clock control register (0x00): 44/48kHz, MCLK=64xfs -+ { .size = 2, .data = "\x00\x60" }, -+ // Bank switch and eq control (0x50): no bank switching -+ { .size = 5, .data = "\x50\x00\x00\x00\x00" }, -+ // Volume registers (0x07, 0x08, 0x09, 0x0A) -+ { .size = 2, .data = "\x07\x20" }, -+ { .size = 2, .data = "\x08\x30" }, -+ { .size = 2, .data = "\x09\x30" }, -+ { .size = 2, .data = "\x0A\xFF" }, -+ // 0x72, 0x73, 0x76, 0x77 input mixer: -+ // no intermix between channels -+ { .size = 5, .data = "\x72\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x73\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x76\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x77\x00\x80\x00\x00" }, -+ // 0x70, 0x71, 0x74, 0x75 inline DRC mixer: -+ // no inline DRC inmix -+ { .size = 5, .data = "\x70\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x71\x00\x00\x00\x00" }, -+ { .size = 5, .data = "\x74\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x75\x00\x00\x00\x00" }, -+ // 0x56, 0x57 Output scale -+ { .size = 5, .data = "\x56\x00\x80\x00\x00" }, -+ { .size = 5, .data = "\x57\x00\x02\x00\x00" }, -+ // 0x3B, 0x3c -+ { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" }, -+ { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" }, -+ // 0x51, 0x52: output mixer -+ { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" }, -+ // PEQ defaults -+ { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+ { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }, -+}; -+ -+ -+#endif /* _TAS5713_H */ - -From 15550aafac107a499180a103bcaceed80f37dacd Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 9 Jan 2017 09:42:09 +0000 -Subject: [PATCH 117/122] hifiberry-amp: Adjust for ALSA object refactoring - -See: https://github.com/raspberrypi/linux/issues/1775 ---- - sound/soc/codecs/tas5713.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c -index 9b2713861dcbed751842ca29c88eb1eae5867411..560234d58a6b0a6e7fd3a63e8de73339ee002b1c 100644 ---- a/sound/soc/codecs/tas5713.c -+++ b/sound/soc/codecs/tas5713.c -@@ -232,8 +232,10 @@ static int tas5713_probe(struct snd_soc_codec *codec) - static struct snd_soc_codec_driver soc_codec_dev_tas5713 = { - .probe = tas5713_probe, - .remove = tas5713_remove, -- .controls = tas5713_snd_controls, -- .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+ .component_driver = { -+ .controls = tas5713_snd_controls, -+ .num_controls = ARRAY_SIZE(tas5713_snd_controls), -+ }, - }; - - - -From d3a7daff54ea1d57654aa2be744d6173441b5e35 Mon Sep 17 00:00:00 2001 -From: Giedrius Trainavicius -Date: Sun, 8 Jan 2017 15:58:54 +0200 -Subject: [PATCH 118/122] bcm2835-i2s: Changes for allowing asymmetric sample - formats. - -This is achieved by making changes only to the requested -stream direction format, keeping the other stream direction -configuration intact. - -Signed-off-by: Giedrius Trainavicius ---- - sound/soc/bcm/bcm2835-i2s.c | 54 +++++++++++++++++++++++++++++++-------------- - 1 file changed, 38 insertions(+), 16 deletions(-) - -diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c -index 6ba20498202ed36906b52096893a88867a79269f..171c2401dfe192740fca3356268aff6432f284ea 100644 ---- a/sound/soc/bcm/bcm2835-i2s.c -+++ b/sound/soc/bcm/bcm2835-i2s.c -@@ -237,7 +237,9 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - unsigned int sampling_rate = params_rate(params); - unsigned int data_length, data_delay, bclk_ratio; - unsigned int ch1pos, ch2pos, mode, format; -+ unsigned int previous_ftxp, previous_frxp; - uint32_t csreg; -+ bool packed; - - /* - * If a stream is already enabled, -@@ -320,26 +322,46 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, - return -EINVAL; - } - -- /* -- * Set format for both streams. -- * We cannot set another frame length -- * (and therefore word length) anyway, -- * so the format will be the same. -- */ -- regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format); -- regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format); -+ /* Set the format for the matching stream direction. */ -+ switch (substream->stream) { -+ case SNDRV_PCM_STREAM_PLAYBACK: -+ regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format); -+ break; -+ case SNDRV_PCM_STREAM_CAPTURE: -+ regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format); -+ break; -+ default: -+ return -EINVAL; -+ } - - /* Setup the I2S mode */ -+ /* Keep existing FTXP and FRXP values. */ -+ regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode); -+ -+ previous_ftxp = mode & BCM2835_I2S_FTXP; -+ previous_frxp = mode & BCM2835_I2S_FRXP; -+ - mode = 0; - -- if (data_length <= 16) { -- /* -- * Use frame packed mode (2 channels per 32 bit word) -- * We cannot set another frame length in the second stream -- * (and therefore word length) anyway, -- * so the format will be the same. -- */ -- mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP; -+ /* -+ * Retain the frame packed mode (2 channels per 32 bit word) -+ * of the other direction stream intact. The formats of each -+ * direction can be different as long as the frame length is -+ * shared for both. -+ */ -+ packed = data_length <= 16; -+ -+ switch (substream->stream) { -+ case SNDRV_PCM_STREAM_PLAYBACK: -+ mode |= previous_frxp; -+ mode |= packed ? BCM2835_I2S_FTXP : 0; -+ break; -+ case SNDRV_PCM_STREAM_CAPTURE: -+ mode |= previous_ftxp; -+ mode |= packed ? BCM2835_I2S_FRXP : 0; -+ break; -+ default: -+ return -EINVAL; - } - - mode |= BCM2835_I2S_FLEN(bclk_ratio - 1); - -From a268f59a304d04349f3a0358db1f434e47cda8b6 Mon Sep 17 00:00:00 2001 -From: Aaron Shaw -Date: Tue, 10 Jan 2017 16:05:41 +0000 -Subject: [PATCH 119/122] Add driver_name property - -Add driver name property for use with 5.1 passthrough audio in LibreElec and other Kodi based OSs ---- - sound/soc/bcm/justboom-dac.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c -index 8fd50dbe681508a2cfe8fdde1c9fedbe9a507fa7..05a224ec712d06b8b7587ab6b8bb562d19956d47 100644 ---- a/sound/soc/bcm/justboom-dac.c -+++ b/sound/soc/bcm/justboom-dac.c -@@ -98,6 +98,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_justboom_dac = { - .name = "snd_rpi_justboom_dac", -+ .driver_name = "JustBoomDac", - .owner = THIS_MODULE, - .dai_link = snd_rpi_justboom_dac_dai, - .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), - -From ad475b3f75da457818fa6fab1c1e2f89f453dc07 Mon Sep 17 00:00:00 2001 -From: Aaron Shaw -Date: Tue, 10 Jan 2017 16:11:04 +0000 -Subject: [PATCH 120/122] Add driver_name paramater - -Add driver_name parameter for use with 5.1 passthrough audio in LibreElec and other Kodi OSs ---- - sound/soc/bcm/justboom-digi.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c -index 91acb666380faa3c0deb2230f8a0f8bbec59417b..abfdc5c4dd5811e6847bddda4921abe33fa02812 100644 ---- a/sound/soc/bcm/justboom-digi.c -+++ b/sound/soc/bcm/justboom-digi.c -@@ -154,6 +154,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = { - /* audio machine driver */ - static struct snd_soc_card snd_rpi_justboom_digi = { - .name = "snd_rpi_justboom_digi", -+ .driver_name = "JustBoomDigi", - .owner = THIS_MODULE, - .dai_link = snd_rpi_justboom_digi_dai, - .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), - -From 987aadab51987bac29470f3ee200fa8bfa2eae6b Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 11 Jan 2017 13:01:21 +0000 -Subject: [PATCH 121/122] BCM270X_DT: Add pi3-disable-wifi overlay - -pi3-disable-wifi is a minimal overlay to disable the onboard WiFi. - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 6 ++++++ - arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts | 13 +++++++++++++ - 3 files changed, 20 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 11dba31712840a9e4b91acd4565c2d6266315273..f1191c1ded82490be5f793ab6483bc5af5891db2 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -51,6 +51,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - mz61581.dtbo \ - pi3-act-led.dtbo \ - pi3-disable-bt.dtbo \ -+ pi3-disable-wifi.dtbo \ - pi3-miniuart-bt.dtbo \ - piscreen.dtbo \ - piscreen2r.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index e8fa4ccb44c34a20485c4e6155467af99179153a..34109c69416c1caf28910895320a2b9cd539588e 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -800,6 +800,12 @@ Load: dtoverlay=pi3-disable-bt - Params: - - -+Name: pi3-disable-wifi -+Info: Disable Pi3 onboard WiFi -+Load: dtoverlay=pi3-disable-wifi -+Params: -+ -+ - Name: pi3-miniuart-bt - Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore - UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum -diff --git a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..017199554bf2f4e381efcc7bb71e750c210343e0 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts -@@ -0,0 +1,13 @@ -+/dts-v1/; -+/plugin/; -+ -+/{ -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&mmc>; -+ __overlay__ { -+ status = "disabled"; -+ }; -+ }; -+}; - -From 5c94b3839b261c3c73893677ab6e2355a1177b74 Mon Sep 17 00:00:00 2001 -From: Electron752 -Date: Thu, 12 Jan 2017 07:07:08 -0800 -Subject: [PATCH 122/122] ARM64: Make it work again on 4.9 (#1790) - -* Invoke the dtc compiler with the same options used in arm mode. -* ARM64 now uses the bcm2835 platform just like ARM32. -* ARM64: Update bcmrpi3_defconfig - -Signed-off-by: Michael Zoran ---- - arch/arm64/Kconfig.platforms | 22 ------ - arch/arm64/boot/dts/broadcom/Makefile | 10 ++- - arch/arm64/boot/dts/overlays | 1 + - arch/arm64/configs/bcmrpi3_defconfig | 126 ++++++++++------------------------ - 4 files changed, 48 insertions(+), 111 deletions(-) - create mode 120000 arch/arm64/boot/dts/overlays - -diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms -index 7d213c2c904271c7a4622b83cd55a750d237bc2e..101794f5ce1008b7ff007fbfc7fa23d9e63bae67 100644 ---- a/arch/arm64/Kconfig.platforms -+++ b/arch/arm64/Kconfig.platforms -@@ -1,27 +1,5 @@ - menu "Platform selection" - --config MACH_BCM2709 -- bool -- --config ARCH_BCM2709 -- bool "Broadcom BCM2709 family" -- select MACH_BCM2709 -- select HAVE_SMP -- select ARM_AMBA -- select COMMON_CLK -- select ARCH_HAS_CPUFREQ -- select GENERIC_CLOCKEVENTS -- select MULTI_IRQ_HANDLER -- select SPARSE_IRQ -- select MFD_SYSCON -- select VC4 -- select USE_OF -- select ARCH_REQUIRE_GPIOLIB -- select PINCTRL -- select PINCTRL_BCM2835 -- help -- This enables support for Broadcom BCM2709 boards. -- - config ARCH_SUNXI - bool "Allwinner sunxi 64-bit SoC Family" - select GENERIC_IRQ_CHIP -diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index 2152448c8cf5b22c573642d7ce45e85793f5fc9a..7aa03be73fda08d555a13323f483e9b95398f234 100644 ---- a/arch/arm64/boot/dts/broadcom/Makefile -+++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -1,7 +1,15 @@ -+# Enable fixups to support overlays on BCM2835 platforms -+ -+ifeq ($(CONFIG_ARCH_BCM2835),y) -+DTC_FLAGS ?= -@ -H epapr -+endif -+ - dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb - dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb - dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb --dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb -+dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb -+ -+dts-dirs += ../overlays - - always := $(dtb-y) - subdir-y := $(dts-dirs) -diff --git a/arch/arm64/boot/dts/overlays b/arch/arm64/boot/dts/overlays -new file mode 120000 -index 0000000000000000000000000000000000000000..ded08646b6f66cdf734f8bf9c1be3a2e3a7103d7 ---- /dev/null -+++ b/arch/arm64/boot/dts/overlays -@@ -0,0 +1 @@ -+../../../arm/boot/dts/overlays -\ No newline at end of file -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -index 53da5c7a33e5898a66e549fb0c39fe3da555ca87..c7e891d72969a388d9b135a36dbfc9c9cb609bf8 100644 ---- a/arch/arm64/configs/bcmrpi3_defconfig -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -1,52 +1,9 @@ --# CONFIG_ARM_PATCH_PHYS_VIRT is not set --CONFIG_PHYS_OFFSET=0 - CONFIG_LOCALVERSION="-v8" - # CONFIG_LOCALVERSION_AUTO is not set --CONFIG_64BIT=y - CONFIG_SYSVIPC=y - CONFIG_POSIX_MQUEUE=y - CONFIG_NO_HZ=y - CONFIG_HIGH_RES_TIMERS=y -- --# --# ARM errata workarounds via the alternatives framework --# --CONFIG_ARM64_ERRATUM_826319=n --CONFIG_ARM64_ERRATUM_827319=n --CONFIG_ARM64_ERRATUM_824069=n --CONFIG_ARM64_ERRATUM_819472=n --CONFIG_ARM64_ERRATUM_832075=n --CONFIG_ARM64_ERRATUM_845719=n --CONFIG_ARM64_ERRATUM_843419=n --CONFIG_CAVIUM_ERRATUM_22375=n --CONFIG_CAVIUM_ERRATUM_23154=n --CONFIG_CAVIUM_ERRATUM_27456=n --CONFIG_ARM64_4K_PAGES=y --CONFIG_ARM64_VA_BITS_39=y --CONFIG_ARM64_VA_BITS=39 --CONFIG_SCHED_MC=y --CONFIG_NR_CPUS=4 --CONFIG_HOTPLUG_CPU=y --CONFIG_ARMV8_DEPRECATED=y --CONFIG_SWP_EMULATION=y --CONFIG_CP15_BARRIER_EMULATION=y --CONFIG_SETEND_EMULATION=y -- --# --# ARMv8.1 architectural features --# --CONFIG_ARM64_HW_AFDBM=y --CONFIG_ARM64_PAN=y --CONFIG_ARM64_LSE_ATOMICS=y --CONFIG_ARM64_VHE=y -- --# --# ARMv8.2 architectural features --# --CONFIG_ARM64_UAO=y --CONFIG_ARM64_MODULE_CMODEL_LARGE=n --CONFIG_RANDOMIZE_BASE=n -- - CONFIG_BSD_PROCESS_ACCT=y - CONFIG_BSD_PROCESS_ACCT_V3=y - CONFIG_TASKSTATS=y -@@ -55,7 +12,6 @@ CONFIG_TASK_XACCT=y - CONFIG_TASK_IO_ACCOUNTING=y - CONFIG_IKCONFIG=m - CONFIG_IKCONFIG_PROC=y --CONFIG_NMI_LOG_BUF_SHIFT=12 - CONFIG_MEMCG=y - CONFIG_BLK_CGROUP=y - CONFIG_CGROUP_FREEZER=y -@@ -69,54 +25,49 @@ CONFIG_BLK_DEV_INITRD=y - CONFIG_EMBEDDED=y - # CONFIG_COMPAT_BRK is not set - CONFIG_PROFILING=y --CONFIG_OPROFILE=m - CONFIG_KPROBES=y - CONFIG_JUMP_LABEL=y - CONFIG_MODULES=y - CONFIG_MODULE_UNLOAD=y - CONFIG_MODVERSIONS=y - CONFIG_MODULE_SRCVERSION_ALL=y --CONFIG_TRIM_UNUSED_KSYMS=y - CONFIG_BLK_DEV_THROTTLING=y - CONFIG_PARTITION_ADVANCED=y - CONFIG_MAC_PARTITION=y - CONFIG_CFQ_GROUP_IOSCHED=y --CONFIG_ARCH_BCM2709=y --# CONFIG_CACHE_L2X0 is not set --CONFIG_SMP=y --CONFIG_HAVE_ARM_ARCH_TIMER=y --CONFIG_VMSPLIT_2G=y --CONFIG_PREEMPT_VOLUNTARY=y --CONFIG_AEABI=y --CONFIG_OABI_COMPAT=y --# CONFIG_CPU_SW_DOMAIN_PAN is not set -+CONFIG_ARCH_BCM2835=y -+# CONFIG_CAVIUM_ERRATUM_22375 is not set -+# CONFIG_CAVIUM_ERRATUM_23154 is not set -+# CONFIG_CAVIUM_ERRATUM_27456 is not set -+CONFIG_SCHED_MC=y -+CONFIG_NR_CPUS=4 -+CONFIG_PREEMPT=y -+CONFIG_HZ_1000=y - CONFIG_CLEANCACHE=y - CONFIG_FRONTSWAP=y - CONFIG_CMA=y - CONFIG_ZSMALLOC=m - CONFIG_PGTABLE_MAPPING=y --CONFIG_UACCESS_WITH_MEMCPY=y - CONFIG_SECCOMP=y --# CONFIG_ATAGS is not set --CONFIG_ZBOOT_ROM_TEXT=0x0 --CONFIG_ZBOOT_ROM_BSS=0x0 -+CONFIG_ARMV8_DEPRECATED=y -+CONFIG_SWP_EMULATION=y -+CONFIG_CP15_BARRIER_EMULATION=y -+CONFIG_SETEND_EMULATION=y - CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -+CONFIG_BINFMT_MISC=y -+CONFIG_COMPAT=y -+# CONFIG_SUSPEND is not set -+CONFIG_PM=y -+CONFIG_CPU_IDLE=y -+CONFIG_ARM_CPUIDLE=y - CONFIG_CPU_FREQ=y -+CONFIG_CPU_FREQ_STAT=y - CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y - CONFIG_CPU_FREQ_GOV_PERFORMANCE=y - CONFIG_CPU_FREQ_GOV_USERSPACE=y - CONFIG_CPU_FREQ_GOV_ONDEMAND=y - CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y - CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y --CONFIG_VFP=y --CONFIG_NEON=y --CONFIG_KERNEL_MODE_NEON=y --CONFIG_BINFMT_MISC=m --CONFIG_COMPAT=y --CONFIG_SYSVIPC_COMPAT=y -- --# CONFIG_SUSPEND is not set --CONFIG_PM=y - CONFIG_NET=y - CONFIG_PACKET=y - CONFIG_UNIX=y -@@ -437,6 +388,7 @@ CONFIG_BT_MRVL=m - CONFIG_BT_MRVL_SDIO=m - CONFIG_BT_ATH3K=m - CONFIG_BT_WILINK=m -+CONFIG_CFG80211=m - CONFIG_MAC80211=m - CONFIG_MAC80211_MESH=y - CONFIG_WIMAX=m -@@ -490,7 +442,6 @@ CONFIG_BONDING=m - CONFIG_DUMMY=m - CONFIG_IFB=m - CONFIG_MACVLAN=m --CONFIG_IPVLAN=m - CONFIG_VXLAN=m - CONFIG_NETCONSOLE=m - CONFIG_TUN=m -@@ -579,8 +530,6 @@ CONFIG_RT2800USB_RT3573=y - CONFIG_RT2800USB_RT53XX=y - CONFIG_RT2800USB_RT55XX=y - CONFIG_RT2800USB_UNKNOWN=y --CONFIG_RTL8187=m --CONFIG_RTL8192CU=n - CONFIG_USB_ZD1201=m - CONFIG_ZD1211RW=m - CONFIG_MAC80211_HWSIM=m -@@ -606,7 +555,7 @@ CONFIG_JOYSTICK_RPISENSE=m - CONFIG_INPUT_TOUCHSCREEN=y - CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m --CONFIG_TOUCHSCREEN_FT6236=m -+CONFIG_TOUCHSCREEN_EKTF2127=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m - CONFIG_TOUCHSCREEN_USB_COMPOSITE=m - CONFIG_TOUCHSCREEN_STMPE=m -@@ -626,10 +575,8 @@ CONFIG_SERIO_RAW=m - CONFIG_GAMEPORT=m - CONFIG_GAMEPORT_NS558=m - CONFIG_GAMEPORT_L4=m --CONFIG_BRCM_CHAR_DRIVERS=n --CONFIG_BCM_VC_CMA=n --CONFIG_BCM_VCIO=n --CONFIG_BCM_VC_SM=n -+# CONFIG_BCM2835_DEVGPIOMEM is not set -+# CONFIG_BCM2835_SMI_DEV is not set - # CONFIG_LEGACY_PTYS is not set - # CONFIG_DEVKMEM is not set - CONFIG_SERIAL_8250=y -@@ -638,6 +585,9 @@ CONFIG_SERIAL_8250_CONSOLE=y - # CONFIG_SERIAL_8250_DMA is not set - CONFIG_SERIAL_8250_NR_UARTS=1 - CONFIG_SERIAL_8250_RUNTIME_UARTS=0 -+CONFIG_SERIAL_8250_EXTENDED=y -+CONFIG_SERIAL_8250_SHARE_IRQ=y -+CONFIG_SERIAL_8250_BCM2835AUX=y - CONFIG_SERIAL_OF_PLATFORM=y - CONFIG_SERIAL_AMBA_PL011=y - CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -@@ -650,6 +600,7 @@ CONFIG_I2C=y - CONFIG_I2C_CHARDEV=m - CONFIG_I2C_MUX_PCA954x=m - CONFIG_I2C_BCM2708=m -+CONFIG_I2C_BCM2835=m - CONFIG_I2C_GPIO=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m -@@ -681,13 +632,13 @@ CONFIG_W1_SLAVE_DS2780=m - CONFIG_W1_SLAVE_DS2781=m - CONFIG_W1_SLAVE_DS28E04=m - CONFIG_W1_SLAVE_BQ27000=m --CONFIG_BATTERY_DS2760=m --CONFIG_POWER_RESET=y - CONFIG_POWER_RESET_GPIO=y -+CONFIG_BATTERY_DS2760=m - CONFIG_HWMON=m - CONFIG_SENSORS_LM75=m - CONFIG_SENSORS_SHT21=m - CONFIG_SENSORS_SHTC1=m -+CONFIG_SENSORS_INA2XX=m - CONFIG_THERMAL=y - CONFIG_THERMAL_BCM2835=y - CONFIG_WATCHDOG=y -@@ -835,8 +786,6 @@ CONFIG_VIDEO_EM28XX_V4L2=m - CONFIG_VIDEO_EM28XX_ALSA=m - CONFIG_VIDEO_EM28XX_DVB=m - CONFIG_V4L_PLATFORM_DRIVERS=y --CONFIG_VIDEO_BCM2835=n --CONFIG_VIDEO_BCM2835_MMAL=n - CONFIG_RADIO_SI470X=y - CONFIG_USB_SI470X=m - CONFIG_I2C_SI470X=m -@@ -892,8 +841,6 @@ CONFIG_SND_VIRMIDI=m - CONFIG_SND_MTPAV=m - CONFIG_SND_SERIAL_U16550=m - CONFIG_SND_MPU401=m --CONFIG_SND_ARM=n --CONFIG_SND_BCM2835=n - CONFIG_SND_USB_AUDIO=m - CONFIG_SND_USB_UA101=m - CONFIG_SND_USB_CAIAQ=m -@@ -916,7 +863,10 @@ CONFIG_SND_BCM2708_SOC_ADAU1977_ADC=m - CONFIG_SND_AUDIOINJECTOR_PI_SOUNDCARD=m - CONFIG_SND_DIGIDAC1_SOUNDCARD=m - CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO=m -+CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m -+CONFIG_SND_PISOUND=m - CONFIG_SND_SOC_ADAU1701=m -+CONFIG_SND_SOC_AK4554=m - CONFIG_SND_SOC_WM8804_I2C=m - CONFIG_SND_SIMPLE_CARD=m - CONFIG_SOUND_PRIME=m -@@ -979,8 +929,6 @@ CONFIG_USB_HIDDEV=y - CONFIG_USB=y - CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - CONFIG_USB_MON=m --CONFIG_USB_DWCOTG=n --CONFIG_USB_DWC2=y - CONFIG_USB_PRINTER=m - CONFIG_USB_STORAGE=y - CONFIG_USB_STORAGE_REALTEK=m -@@ -1001,6 +949,7 @@ CONFIG_USB_MICROTEK=m - CONFIG_USBIP_CORE=m - CONFIG_USBIP_VHCI_HCD=m - CONFIG_USBIP_HOST=m -+CONFIG_USB_DWC2=y - CONFIG_USB_SERIAL=m - CONFIG_USB_SERIAL_GENERIC=y - CONFIG_USB_SERIAL_AIRCABLE=m -@@ -1096,6 +1045,7 @@ CONFIG_LEDS_TRIGGER_INPUT=y - CONFIG_LEDS_TRIGGER_PANIC=y - CONFIG_RTC_CLASS=y - # CONFIG_RTC_HCTOSYS is not set -+CONFIG_RTC_DRV_ABX80X=m - CONFIG_RTC_DRV_DS1307=m - CONFIG_RTC_DRV_DS1374=m - CONFIG_RTC_DRV_DS1672=m -@@ -1103,7 +1053,6 @@ CONFIG_RTC_DRV_MAX6900=m - CONFIG_RTC_DRV_RS5C372=m - CONFIG_RTC_DRV_ISL1208=m - CONFIG_RTC_DRV_ISL12022=m --CONFIG_RTC_DRV_ISL12057=m - CONFIG_RTC_DRV_X1205=m - CONFIG_RTC_DRV_PCF8523=m - CONFIG_RTC_DRV_PCF8563=m -@@ -1137,7 +1086,6 @@ CONFIG_STAGING=y - CONFIG_PRISM2_USB=m - CONFIG_R8712U=m - CONFIG_R8188EU=m --CONFIG_R8723AU=m - CONFIG_VT6656=m - CONFIG_SPEAKUP=m - CONFIG_SPEAKUP_SYNTH_SOFT=m -@@ -1153,6 +1101,7 @@ CONFIG_FB_TFT_BD663474=m - CONFIG_FB_TFT_HX8340BN=m - CONFIG_FB_TFT_HX8347D=m - CONFIG_FB_TFT_HX8353D=m -+CONFIG_FB_TFT_HX8357D=m - CONFIG_FB_TFT_ILI9163=m - CONFIG_FB_TFT_ILI9320=m - CONFIG_FB_TFT_ILI9325=m -@@ -1176,6 +1125,7 @@ CONFIG_FB_TFT_UPD161704=m - CONFIG_FB_TFT_WATTEROTT=m - CONFIG_FB_FLEX=m - CONFIG_FB_TFT_FBTFT_DEVICE=m -+# CONFIG_BCM2708_VCHIQ is not set - CONFIG_MAILBOX=y - CONFIG_BCM2835_MBOX=y - # CONFIG_IOMMU_SUPPORT is not set -@@ -1189,6 +1139,7 @@ CONFIG_IIO_KFIFO_BUF=m - CONFIG_MCP320X=m - CONFIG_MCP3422=m - CONFIG_DHT11=m -+CONFIG_HTU21=m - CONFIG_PWM_BCM2835=m - CONFIG_PWM_PCA9685=m - CONFIG_RASPBERRYPI_FIRMWARE=y -@@ -1309,6 +1260,7 @@ CONFIG_BOOT_PRINTK_DELAY=y - CONFIG_DEBUG_MEMORY_INIT=y - CONFIG_DETECT_HUNG_TASK=y - CONFIG_TIMER_STATS=y -+CONFIG_LATENCYTOP=y - CONFIG_IRQSOFF_TRACER=y - CONFIG_SCHED_TRACER=y - CONFIG_STACK_TRACER=y -@@ -1331,5 +1283,3 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m - CONFIG_ARM64_CRYPTO=y - CONFIG_CRC_ITU_T=y - CONFIG_LIBCRC32C=y --CONFIG_BCM2708_VCHIQ=n --CONFIG_ARCH_BCM2835=y diff --git a/projects/RPi2/patches/plexht/plexht-0001-RasPlex.patch b/projects/RPi2/patches/plexht/plexht-0001-RasPlex.patch new file mode 100644 index 0000000000..0dc581d011 --- /dev/null +++ b/projects/RPi2/patches/plexht/plexht-0001-RasPlex.patch @@ -0,0 +1,60 @@ +From f1e8e10b7cfba5a9241637749e855d0024c8c6d8 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 19 Feb 2017 23:42:45 +0100 +Subject: [PATCH] RasPlex + +--- + addons/skin.plex/language/English/strings.po | 2 +- + plex/Resources/system/peripherals.xml | 12 +++++------- + 2 files changed, 6 insertions(+), 8 deletions(-) + +diff --git a/addons/skin.plex/language/English/strings.po b/addons/skin.plex/language/English/strings.po +index 4ef852d290..7aa14ea4b8 100644 +--- a/addons/skin.plex/language/English/strings.po ++++ b/addons/skin.plex/language/English/strings.po +@@ -1055,7 +1055,7 @@ msgid "Show all media flags in details view" + msgstr "" + + msgctxt "#32118" +-msgid "Hide Quit and Shut Down from Home menu" ++msgid "Hide Shut Down from Home menu" + msgstr "" + + msgctxt "#32119" +diff --git a/plex/Resources/system/peripherals.xml b/plex/Resources/system/peripherals.xml +index aad95c524d..cae19b8cb5 100644 +--- a/plex/Resources/system/peripherals.xml ++++ b/plex/Resources/system/peripherals.xml +@@ -2,11 +2,9 @@ + + + +- +- +- +- +- ++ ++ ++ + + + +@@ -17,7 +15,7 @@ + + + +- ++ + + + +@@ -28,7 +26,7 @@ + + + +- ++ + + + diff --git a/projects/RPi2/plexht/advancedsettings.xml b/projects/RPi2/plexht/advancedsettings.xml new file mode 100644 index 0000000000..87b0c9473e --- /dev/null +++ b/projects/RPi2/plexht/advancedsettings.xml @@ -0,0 +1,27 @@ + + + false + 1 + + false + + + + + 30 + + + + 52428800 + 30 + 4.0 + + + + 3 + 0 + + + diff --git a/projects/Rockchip/README.md b/projects/Rockchip/README.md new file mode 100644 index 0000000000..135b3e1f17 --- /dev/null +++ b/projects/Rockchip/README.md @@ -0,0 +1,42 @@ +# Rockchip + +This project is for Rockchip SoC devices + +## Devices + +**RK3288** +* [ASUS Tinker Board](devices/TinkerBoard) +* [mqmaker MiQi](devices/MiQi) + +**RK3328** +* [PINE64 ROCK64](devices/RK3328) +* [Popcorn Hour RockBox](devices/RK3328) +* [Popcorn Hour Transformer](devices/RK3328) +* [Firefly ROC-RK3328-CC](devices/RK3328) + +**RK3399** +* [96rocks ROCK960](devices/RK3399) +* [Khadas Edge](devices/RK3399) +* [PINE64 RockPro64](devices/RK3399) +* [Radxa ROCK Pi 4](devices/RK3399) +* [Rockchip Sapphire Board](devices/RK3399) + +**My single-board computer is not listed, will it be added in the future?**
+If your single-board computer uses a current generation SoC listed on http://opensource.rock-chips.com/wiki_Main_Page the odds are in your favor. + +**My Android device is not listed, will it be added in the future?**
+You may have luck if your device vendor is open source friendly, otherwise keep using Android for best support. + +## Links + +* https://github.com/rockchip-linux +* http://opensource.rock-chips.com + +## Useful debug commands + +* `cat /sys/kernel/debug/dri/0/summary` +* `cat /sys/kernel/debug/dw-hdmi/status` +* `cat /sys/kernel/debug/clk/clk_summary` +* `hexdump -C /sys/class/drm/card0-HDMI-A-1/edid` +* `edid-decode /sys/class/drm/card0-HDMI-A-1/edid` +* `cat /sys/kernel/debug/dma_buf/bufinfo` diff --git a/projects/Rockchip/bootloader/canupdate.sh b/projects/Rockchip/bootloader/canupdate.sh new file mode 100644 index 0000000000..5383b7fd6b --- /dev/null +++ b/projects/Rockchip/bootloader/canupdate.sh @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +# Allow upgrades between arm and aarch64 +if [ "$1" = "@PROJECT@.arm" -o "$1" = "@PROJECT@.aarch64" ]; then + exit 0 +else + exit 1 +fi diff --git a/projects/Rockchip/bootloader/install b/projects/Rockchip/bootloader/install new file mode 100644 index 0000000000..5f5e6731d4 --- /dev/null +++ b/projects/Rockchip/bootloader/install @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +PKG_RKBIN="$(get_build_dir rkbin)" +PKG_SOC=$UBOOT_SYSTEM + +if [ "$DEVICE" = "RK3328" -o "$DEVICE" = "RK3399" ]; then + PKG_SOC="${DEVICE/RK/rk}" +fi + +case "$PKG_SOC" in + rk3036) + PKG_DATAFILE="spl/u-boot-spl-nodtb.bin" + PKG_LOADER="u-boot-dtb.bin" + ;; + rk3288) + PKG_DATAFILE="$PKG_RKBIN/rk32/rk3288_ddr_400MHz_v1.06.bin" + PKG_LOADER="$PKG_RKBIN/rk32/rk3288_miniloader_v2.36.bin" + PKG_LOAD_ADDR="0x0" + ;; + rk3328) + PKG_DATAFILE="$PKG_RKBIN/rk33/rk3328_ddr_786MHz_v1.13.bin" + PKG_LOADER="$PKG_RKBIN/rk33/rk3328_miniloader_v2.49.bin" + PKG_BL31="$PKG_RKBIN/rk33/rk3328_bl31_v1.40.elf" + PKG_LOAD_ADDR="0x200000" + ;; + rk3399) + PKG_DATAFILE="$PKG_RKBIN/rk33/rk3399_ddr_800MHz_v1.17.bin" + PKG_LOADER="$PKG_RKBIN/rk33/rk3399_miniloader_v1.15.bin" + PKG_BL31="$PKG_RKBIN/rk33/rk3399_bl31_v1.24.elf" + PKG_LOAD_ADDR="0x200000" + ;; + *) + PKG_DATAFILE="spl/u-boot-spl-dtb.bin" + PKG_LOADER="u-boot-dtb.bin" + ;; +esac + +if [ -n "$PKG_DATAFILE" -a -n "$PKG_LOADER" ]; then + tools/mkimage -n $PKG_SOC -T rksd -d "$PKG_DATAFILE" idbloader.img + cat "$PKG_LOADER" >> idbloader.img + cp -av idbloader.img $INSTALL/usr/share/bootloader +fi + +if [ -n "$PKG_LOAD_ADDR" ]; then + $PKG_RKBIN/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img $PKG_LOAD_ADDR + cp -av uboot.img $INSTALL/usr/share/bootloader +fi + +if [ -n "$PKG_BL31" ]; then + cat >trust.ini <"$SAVE_ERROR" 2>&1 || show_error +fi +if [ -f "$RELEASE_DIR/3rdparty/bootloader/uboot.img" ]; then + echo "image: burn uboot.img to image..." + dd if="$RELEASE_DIR/3rdparty/bootloader/uboot.img" of="$DISK" bs=64k seek=128 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error +fi +if [ -f "$RELEASE_DIR/3rdparty/bootloader/trust.img" ]; then + echo "image: burn trust.img to image..." + dd if="$RELEASE_DIR/3rdparty/bootloader/trust.img" of="$DISK" bs=64k seek=192 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error +fi diff --git a/projects/Rockchip/bootloader/release b/projects/Rockchip/bootloader/release new file mode 100644 index 0000000000..7c98cef515 --- /dev/null +++ b/projects/Rockchip/bootloader/release @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +mkdir -p $RELEASE_DIR/3rdparty/bootloader + if [ -n "$UBOOT_SYSTEM" ]; then + BOOTLOADER_DIR=$(get_build_dir $BOOTLOADER) + if [ -f $BOOTLOADER_DIR/idbloader.img ]; then + cp -a $BOOTLOADER_DIR/idbloader.img $RELEASE_DIR/3rdparty/bootloader + fi + if [ -f $BOOTLOADER_DIR/uboot.img ]; then + cp -a $BOOTLOADER_DIR/uboot.img $RELEASE_DIR/3rdparty/bootloader + fi + if [ -f $BOOTLOADER_DIR/trust.img ]; then + cp -a $BOOTLOADER_DIR/trust.img $RELEASE_DIR/3rdparty/bootloader + fi + fi + + LINUX_DTS_DIR=$(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts + for dtb in $LINUX_DTS_DIR/*.dtb $LINUX_DTS_DIR/*/*.dtb; do + if [ -f $dtb ]; then + cp -a $dtb $RELEASE_DIR/3rdparty/bootloader + fi + done diff --git a/projects/Rockchip/bootloader/update.sh b/projects/Rockchip/bootloader/update.sh new file mode 100644 index 0000000000..f2c817c429 --- /dev/null +++ b/projects/Rockchip/bootloader/update.sh @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) + +[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" +[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" +[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) +if [ -z "$BOOT_DISK" ]; then + case $BOOT_PART in + /dev/sd[a-z][0-9]*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") + ;; + /dev/mmcblk*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") + ;; + esac +fi + +# mount $BOOT_ROOT r/w + mount -o remount,rw $BOOT_ROOT + +# update device tree + for all_dtb in $BOOT_ROOT/*.dtb; do + dtb=$(basename $all_dtb) + if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then + echo -n "Updating $dtb... " + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT + echo "done" + fi + done + +# update bootloader + if [ -f $SYSTEM_ROOT/usr/share/bootloader/idbloader.img ]; then + echo -n "Updating idbloader.img... " + dd if=$SYSTEM_ROOT/usr/share/bootloader/idbloader.img of=$BOOT_DISK bs=32k seek=1 conv=fsync &>/dev/null + echo "done" + fi + if [ -f $SYSTEM_ROOT/usr/share/bootloader/uboot.img ]; then + echo -n "Updating uboot.img... " + dd if=$SYSTEM_ROOT/usr/share/bootloader/uboot.img of=$BOOT_DISK bs=64k seek=128 conv=fsync &>/dev/null + echo "done" + fi + if [ -f $SYSTEM_ROOT/usr/share/bootloader/trust.img ]; then + echo -n "Updating trust.img... " + dd if=$SYSTEM_ROOT/usr/share/bootloader/trust.img of=$BOOT_DISK bs=64k seek=192 conv=fsync &>/dev/null + echo "done" + fi + +# mount $BOOT_ROOT r/o + sync + mount -o remount,ro $BOOT_ROOT diff --git a/projects/Rockchip/devices/MiQi/kodi/appliance.xml b/projects/Rockchip/devices/MiQi/kodi/appliance.xml new file mode 100644 index 0000000000..f549479d40 --- /dev/null +++ b/projects/Rockchip/devices/MiQi/kodi/appliance.xml @@ -0,0 +1,12 @@ + + +

+ + + + 0 + + + +
+ diff --git a/projects/Rockchip/devices/MiQi/linux/rockchip-4.4/linux.arm.conf b/projects/Rockchip/devices/MiQi/linux/rockchip-4.4/linux.arm.conf new file mode 100644 index 0000000000..1803108843 --- /dev/null +++ b/projects/Rockchip/devices/MiQi/linux/rockchip-4.4/linux.arm.conf @@ -0,0 +1,4937 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.4.154 Kernel Configuration +# +CONFIG_ARM=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_ARM_DMA_USE_IOMMU=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +CONFIG_USELIB=y +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_SCHED_WALT is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +# CONFIG_MEMCG_KMEM is not set +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SCHED_TUNE is not set +# CONFIG_DEFAULT_USE_ENERGY_AWARE is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +CONFIG_RD_XZ=y +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +CONFIG_UID16=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y +# CONFIG_OPROFILE is not set +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +# CONFIG_JUMP_LABEL is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_HAVE_EXIT_THREAD=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=16 +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +CONFIG_BLK_DEV_THROTTLING=y +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_RK_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +CONFIG_CFQ_GROUP_IOSCHED=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_ASN1=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Multiple platform selection +# + +# +# CPU Core family selection +# +# CONFIG_ARCH_MULTI_V6 is not set +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_MULTI_V6_V7=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +# CONFIG_ARCH_VIRT is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_DIGICOLOR is not set +# CONFIG_ARCH_HIGHBANK is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEYSTONE is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_MEDIATEK is not set + +# +# TI OMAP/AM/DM/DRA Family +# +# CONFIG_ARCH_OMAP3 is not set +# CONFIG_ARCH_OMAP4 is not set +# CONFIG_SOC_OMAP5 is not set +# CONFIG_SOC_AM33XX is not set +# CONFIG_SOC_AM43XX is not set +# CONFIG_SOC_DRA7XX is not set +# CONFIG_ARCH_QCOM is not set +CONFIG_ARCH_ROCKCHIP=y +# CONFIG_ARCH_SOCFPGA is not set +# CONFIG_PLAT_SPEAR is not set +# CONFIG_ARCH_STI is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SHMOBILE_MULTI is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_SIRF is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_U8500 is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_WM8850 is not set +# CONFIG_ARCH_ZX is not set +# CONFIG_ARCH_ZYNQ is not set + +# +# Processor Type +# +CONFIG_CPU_V7=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARM_LPAE is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARM_THUMB=y +CONFIG_ARM_THUMBEE=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_SWP_EMULATE=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +CONFIG_VDSO=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_CACHE_L2X0=y +# CONFIG_PL310_ERRATA_588369 is not set +# CONFIG_PL310_ERRATA_727915 is not set +# CONFIG_PL310_ERRATA_753970 is not set +# CONFIG_PL310_ERRATA_769419 is not set +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_ARM_HEAVY_MB=y +CONFIG_ARM_KERNMEM_PERMS=y +CONFIG_DEBUG_RODATA=y +CONFIG_MULTI_IRQ_HANDLER=y +# CONFIG_ARM_ERRATA_430973 is not set +# CONFIG_ARM_ERRATA_643719 is not set +# CONFIG_ARM_ERRATA_720789 is not set +# CONFIG_ARM_ERRATA_754322 is not set +# CONFIG_ARM_ERRATA_754327 is not set +# CONFIG_ARM_ERRATA_764369 is not set +# CONFIG_ARM_ERRATA_775420 is not set +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_ERRATA_773022 is not set + +# +# Bus support +# +# CONFIG_PCI is not set +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_HAVE_SMP=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_ARM_CPU_TOPOLOGY=y +# CONFIG_SCHED_MC is not set +# CONFIG_SCHED_SMT is not set +CONFIG_HAVE_ARM_SCU=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +# CONFIG_MCPM is not set +# CONFIG_BIG_LITTLE is not set +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_NR_CPUS=4 +CONFIG_HOTPLUG_CPU=y +# CONFIG_ARM_PSCI is not set +CONFIG_ARCH_NR_GPIO=288 +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_CPU_SW_DOMAIN_PAN=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_COMPACTION is not set +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_BOUNCE=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_DEBUGFS=y +CONFIG_CMA_AREAS=7 +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +CONFIG_ZSMALLOC=m +CONFIG_PGTABLE_MAPPING=y +# CONFIG_ZSMALLOC_STAT is not set +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_UACCESS_WITH_MEMCPY is not set +CONFIG_SECCOMP=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_XEN is not set +# CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +# CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_AUTO_ZRELADDR=y + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_TIMES=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y + +# +# CPU frequency scaling drivers +# +CONFIG_CPUFREQ_DT=y +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARM_ROCKCHIP_CPUFREQ=y +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_NEON=y +# CONFIG_KERNEL_MODE_NEON is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +CONFIG_HAS_WAKELOCK=y +CONFIG_WAKELOCK=y +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_ADVANCED_DEBUG=y +# CONFIG_PM_TEST_SUSPEND is not set +CONFIG_PM_SLEEP_DEBUG=y +# CONFIG_APM_EMULATION is not set +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +CONFIG_NET_UDP_TUNNEL=m +# CONFIG_NET_FOU is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_IPV6_SIT is not set +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_ANDROID_PARANOID_NETWORK is not set +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +CONFIG_NF_LOG_COMMON=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +# CONFIG_NF_CONNTRACK_IRC is not set +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CT_NETLINK is not set +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +# CONFIG_NF_NAT_IRC is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_DEFRAG_IPV6 is not set +# CONFIG_NF_CONNTRACK_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +# CONFIG_NF_REJECT_IPV6 is not set +CONFIG_NF_LOG_IPV6=m +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=y +# CONFIG_BT_RFCOMM_TTY is not set +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_SELFTEST is not set +CONFIG_BT_DEBUGFS=y + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=y +CONFIG_BT_BCM=y +CONFIG_BT_RTL=y +# CONFIG_BT_RTKBTUSB is not set +CONFIG_BT_HCIBTUSB=y +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +CONFIG_BT_HCIBTSDIO=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +# CONFIG_BT_HCIUART_BCM is not set +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=y +CONFIG_BT_HCIVHCI=y +CONFIG_BT_MRVL=y +CONFIG_BT_MRVL_SDIO=y +# CONFIG_BT_ATH3K is not set +# CONFIG_AF_RXRPC is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=y +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=y +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +CONFIG_MAC80211_DEBUGFS=y +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_PM=y +CONFIG_RFKILL_LEDS=y +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL_REGULATOR is not set +CONFIG_RFKILL_GPIO=y +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y +# CONFIG_TEGRA_AHB is not set + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_WANT_DEV_COREDUMP=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +CONFIG_DEBUG_DEVRES=y +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=64 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_ARM_CCI400_PMU is not set +# CONFIG_ARM_CCI500_PMU is not set +# CONFIG_ARM_CCN is not set +# CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_VEXPRESS_CONFIG is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +CONFIG_ZRAM=m +CONFIG_ZRAM_LZ4_COMPRESS=y +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=1 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_MG_DISK is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +CONFIG_ROCKCHIP_SCR=y +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +# CONFIG_MEMORY_STATE_TIME is not set +# CONFIG_USB_CAM_GPIO is not set +# CONFIG_GPIO_DET is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +CONFIG_EEPROM_AT24=y +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_ATA is not set +CONFIG_MD=y +# CONFIG_BLK_DEV_MD is not set +# CONFIG_BCACHE is not set +CONFIG_BLK_DEV_DM_BUILTIN=y +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_MQ_DEFAULT is not set +# CONFIG_DM_DEBUG is not set +CONFIG_DM_BUFIO=m +CONFIG_DM_BIO_PRISON=m +CONFIG_DM_PERSISTENT_DATA=m +# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set +# CONFIG_DM_CRYPT is not set +# CONFIG_DM_SNAPSHOT is not set +CONFIG_DM_THIN_PROVISIONING=m +# CONFIG_DM_CACHE is not set +# CONFIG_DM_ERA is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_RAID is not set +# CONFIG_DM_ZERO is not set +# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_DELAY is not set +# CONFIG_DM_UEVENT is not set +# CONFIG_DM_FLAKEY is not set +# CONFIG_DM_VERITY is not set +# CONFIG_DM_VERITY_HASH_PREFETCH_MIN_SIZE_128 is not set +# CONFIG_DM_SWITCH is not set +# CONFIG_DM_LOG_WRITES is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +CONFIG_DUMMY=m +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +CONFIG_VXLAN=m +# CONFIG_GENEVE is not set +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=m +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +CONFIG_ETHERNET=y +# CONFIG_ALTERA_TSE is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_AURORA is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +CONFIG_NET_VENDOR_CIRRUS=y +# CONFIG_CS89x0 is not set +# CONFIG_DM9000 is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +CONFIG_NET_VENDOR_FARADAY=y +# CONFIG_FTMAC100 is not set +# CONFIG_FTGMAC100 is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_ETHOC is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_DWMAC_GENERIC=y +# CONFIG_DWMAC_IPQ806X is not set +# CONFIG_DWMAC_LPC18XX is not set +# CONFIG_DWMAC_MESON is not set +CONFIG_DWMAC_ROCKCHIP=y +# CONFIG_DWMAC_SOCFPGA is not set +# CONFIG_DWMAC_STI is not set +# CONFIG_DWMAC_SUNXI is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +CONFIG_ROCKCHIP_PHY=y +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MICREL_KS8995MA is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=y +CONFIG_USB_NET_AX88179_178A=y +CONFIG_USB_NET_CDCETHER=y +# CONFIG_USB_NET_CDC_EEM is not set +CONFIG_USB_NET_CDC_NCM=y +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +CONFIG_USB_NET_CDC_MBIM=y +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +# CONFIG_USB_NET_SMSC75XX is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_MCS7830 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_LIBERTAS_THINFIRM=y +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +# CONFIG_LIBERTAS_THINFIRM_USB is not set +# CONFIG_AT76C50X_USB is not set +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=y +CONFIG_RTL8187=m +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_ATH_CARDS is not set +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +# CONFIG_HOSTAP is not set +# CONFIG_LIBERTAS is not set +# CONFIG_P54_COMMON is not set +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_LIB_DEBUGFS is not set +# CONFIG_RT2X00_DEBUG is not set +# CONFIG_WL_MEDIATEK is not set +# CONFIG_RTL_CARDS is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WL_ROCKCHIP=y +CONFIG_WIFI_BUILD_MODULE=y +# CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP is not set +# CONFIG_WIFI_GENERATE_RANDOM_MAC_ADDR is not set +# CONFIG_AP6XXX is not set +# CONFIG_CYW_BCMDHD is not set +CONFIG_RTL_WIRELESS_SOLUTION=y +# CONFIG_RTL8188EU is not set +# CONFIG_RTL8188FU is not set +# CONFIG_RTL8189ES is not set +# CONFIG_RTL8189FS is not set +CONFIG_RTL8723BS=m +# CONFIG_RTL8723BU is not set +# CONFIG_RTL8723CS is not set +# CONFIG_RTL8723DS is not set +# CONFIG_MVL88W8977 is not set + +# +# SouthSV 6XXX WLAN support +# +# CONFIG_SSV6051 is not set +# CONFIG_WL_TI is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MWIFIEX is not set +# CONFIG_CW1200 is not set +# CONFIG_RSI_91X is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_INPUT_SPARSEKMAP is not set +CONFIG_INPUT_MATRIXKMAP=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KEYRESET is not set +# CONFIG_INPUT_KEYCOMBO is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADC is not set +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_ROCKCHIP is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_KEYBOARD_CROS_EC=y +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +# CONFIG_MOUSE_PS2 is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +CONFIG_MOUSE_CYAPA=y +CONFIG_MOUSE_ELAN_I2C=y +CONFIG_MOUSE_ELAN_I2C_I2C=y +# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +CONFIG_JOYSTICK_IFORCE=y +CONFIG_JOYSTICK_IFORCE_USB=y +# CONFIG_JOYSTICK_IFORCE_232 is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_INPUT_TABLET=y +# CONFIG_TABLET_USB_ACECAD is not set +# CONFIG_TABLET_USB_AIPTEK is not set +# CONFIG_TABLET_USB_GTCO is not set +# CONFIG_TABLET_USB_HANWANG is not set +# CONFIG_TABLET_USB_KBTAB is not set +# CONFIG_TABLET_SERIAL_WACOM4 is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +CONFIG_TOUCHSCREEN_ATMEL_MXT=y +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8C40XX is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX is not set +# CONFIG_TOUCHSCREEN_FT6236 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_GSLX680A is not set +# CONFIG_TOUCHSCREEN_GSLX680_D708 is not set +# CONFIG_TOUCHSCREEN_GSLX680_PAD is not set +# CONFIG_TOUCHSCREEN_GSLX680_VR is not set +# CONFIG_TOUCHSCREEN_GSLX680_FIREFLY is not set +# CONFIG_TOUCHSCREEN_GSL3673 is not set +# CONFIG_TOUCHSCREEN_GSL3673_800X1280 is not set +# CONFIG_TOUCHSCREEN_GT9XX is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +CONFIG_TOUCHSCREEN_ELAN=y +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=y +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_ST1232 is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +# CONFIG_TOUCHSCREEN_VTL_CT36X is not set +# CONFIG_TOUCHSCREEN_GT1X is not set +# CONFIG_ROCKCHIP_REMOTECTL is not set + +# +# handle all sensors +# +# CONFIG_SENSOR_DEVICE is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYCHORD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_RK8XX_PWRKEY=y +CONFIG_INPUT_UINPUT=y +CONFIG_INPUT_GPIO=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_RAW=y +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_NR_UARTS=5 +CONFIG_SERIAL_8250_RUNTIME_UARTS=5 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +# CONFIG_SERIAL_8250_SHARE_IRQ is not set +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_INGENIC is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_STM32 is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_TPM=y +# CONFIG_HW_RANDOM_ROCKCHIP is not set +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +CONFIG_TCG_TPM=y +# CONFIG_TCG_TIS_I2C_ATMEL is not set +CONFIG_TCG_TIS_I2C_INFINEON=y +# CONFIG_TCG_TIS_I2C_NUVOTON is not set +# CONFIG_TCG_ATMEL is not set +# CONFIG_TCG_TIS_ST33ZP24 is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +CONFIG_I2C_RK3X=y +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +CONFIG_I2C_CROS_EC_TUNNEL=y +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +CONFIG_SPI_ROCKCHIP=y +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PINCTRL_RK805 is not set +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +CONFIG_DEBUG_GPIO=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set + +# +# MFD GPIO expanders +# +# CONFIG_GPIO_RK8XX is not set +# CONFIG_GPIO_TPS6586X is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +CONFIG_BATTERY_SBS=y +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +CONFIG_CHARGER_GPIO=y +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +CONFIG_CHARGER_BQ24735=y +# CONFIG_CHARGER_BQ25700 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_BATTERY_EC is not set +# CONFIG_BATTERY_CW2015 is not set +# CONFIG_BATTERY_RK816 is not set +# CONFIG_BATTERY_RK817 is not set +# CONFIG_CHARGER_RK817 is not set +# CONFIG_BATTERY_RK818 is not set +# CONFIG_CHARGER_RK818 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMSTB is not set +# CONFIG_POWER_RESET_GPIO is not set +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +# CONFIG_POWER_RESET_RESTART is not set +# CONFIG_POWER_RESET_VERSATILE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +CONFIG_REBOOT_MODE=y +CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_POWER_AVS=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +CONFIG_CPU_THERMAL=y +# CONFIG_CLOCK_THERMAL is not set +CONFIG_DEVFREQ_THERMAL=y +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_IMX_THERMAL is not set +CONFIG_ROCKCHIP_THERMAL=y +CONFIG_RK_VIRTUAL_THERMAL=y +# CONFIG_RK3368_THERMAL is not set +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_CORE is not set +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +CONFIG_DW_WATCHDOG=y +# CONFIG_MAX63XX_WATCHDOG is not set +# CONFIG_BCM7038_WDT is not set +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X is not set +CONFIG_MFD_CROS_EC=y +# CONFIG_MFD_CROS_EC_I2C is not set +CONFIG_MFD_CROS_EC_SPI=y +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK618 is not set +CONFIG_MFD_RK808=y +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +CONFIG_MFD_TPS6586X=y +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_RK1000 is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_FUSB_30X is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +CONFIG_REGULATOR_ACT8865=y +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +CONFIG_REGULATOR_FAN53555=y +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8752 is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_MP8865 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_RK808=y +# CONFIG_REGULATOR_RK818 is not set +# CONFIG_REGULATOR_SYR82X is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS549B22 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +CONFIG_REGULATOR_TPS6586X=y +# CONFIG_REGULATOR_XZ3216 is not set +CONFIG_CEC_CORE=y +CONFIG_CEC_NOTIFIER=y +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=32 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_HIX5HD2=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_FRIIO=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# USB HDMI CEC adapters +# +CONFIG_USB_PULSE8_CEC=m +CONFIG_USB_RAINSHADOW_CEC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set +# CONFIG_ROCKCHIP_TSP is not set + +# +# Supported MMC/SDIO adapters +# +# CONFIG_SMS_SDIO_DRV is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Camera lens devices +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set +# CONFIG_CAMSYS_DRV is not set +# CONFIG_ROCK_CHIP_SOC_CAMERA is not set + +# +# Graphics support +# +# CONFIG_IMX_IPUV3_CORE is not set +CONFIG_DRM=y +CONFIG_DRM_IGNORE_IOTCL_PERMIT=y +CONFIG_DRM_MIPI_DSI=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_FBDEV_EMULATION=y +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set +# CONFIG_DRM_SCDC_HELPER is not set +# CONFIG_DRM_DMA_SYNC is not set + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_EXYNOS is not set +CONFIG_DRM_ROCKCHIP=y +# CONFIG_ROCKCHIP_DRM_DEBUG is not set +# CONFIG_ROCKCHIP_CDN_DP is not set +CONFIG_ROCKCHIP_DW_HDMI=y +CONFIG_ROCKCHIP_DW_MIPI_DSI=y +CONFIG_ROCKCHIP_MIPI_CSI_TX=y +CONFIG_ROCKCHIP_ANALOGIX_DP=y +CONFIG_ROCKCHIP_INNO_HDMI=y +CONFIG_ROCKCHIP_LVDS=y +CONFIG_ROCKCHIP_DRM_TVE=y +# CONFIG_ROCKCHIP_RGB is not set +# CONFIG_ROCKCHIP_DRM_BACKLIGHT is not set +# CONFIG_ROCKCHIP_RK3066_HDMI is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_ARMADA is not set +# CONFIG_DRM_TILCDC is not set +# CONFIG_DRM_FSL_DCU is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +CONFIG_DRM_PANEL_SIMPLE=y +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +CONFIG_DRM_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_RK1000 is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LONTIUM_LT8912 is not set +CONFIG_DRM_ANALOGIX_DP=y +CONFIG_DRM_DW_HDMI=y +# CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set +CONFIG_DRM_DW_HDMI_I2S_AUDIO=y +CONFIG_DRM_DW_HDMI_CEC=y +# CONFIG_DRM_STI is not set +# CONFIG_POWERVR_ROGUE_M is not set +# CONFIG_MALI400 is not set +CONFIG_MALI_DEVFREQ=y +CONFIG_MALI_MIDGARD=m +# CONFIG_MALI_GATOR_SUPPORT is not set +# CONFIG_MALI_MIDGARD_ENABLE_TRACE is not set +# CONFIG_MALI_DMA_FENCE is not set +CONFIG_MALI_EXPERT=y +# CONFIG_MALI_CORESTACK is not set +# CONFIG_MALI_PRFCNT_SET_SECONDARY is not set +# CONFIG_MALI_PLATFORM_FAKE is not set +# CONFIG_MALI_PLATFORM_DEVICETREE is not set +CONFIG_MALI_PLATFORM_THIRDPARTY=y +CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="rk" +# CONFIG_MALI_DEBUG is not set +# CONFIG_MALI_NO_MALI is not set +# CONFIG_MALI_TRACE_TIMELINE is not set +# CONFIG_MALI_SYSTEM_TRACE is not set +# CONFIG_MALI_GPU_MMU_AARCH64 is not set +CONFIG_MALI_PWRSOFT_765=y +# CONFIG_MALI_KUTF is not set +# CONFIG_MALI_BIFROST_FOR_ANDROID is not set +CONFIG_MALI_BIFROST_FOR_LINUX=y +# CONFIG_MALI_BIFROST is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +CONFIG_BACKLIGHT_PWM=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set + +# +# Rockchip Misc Video driver +# +# CONFIG_FB_ROCKCHIP is not set +# CONFIG_LCDC_RK3188 is not set +# CONFIG_LCDC_RK3288 is not set +# CONFIG_LCDC_RK3036 is not set +# CONFIG_LCDC_RK312X is not set +CONFIG_LCD_GENERAL=y +# CONFIG_LCD_MIPI is not set +# CONFIG_RK_TRSM is not set +# CONFIG_RK_HDMI is not set + +# +# RGA +# +# CONFIG_ROCKCHIP_RGA is not set + +# +# RGA2 +# +# CONFIG_ROCKCHIP_RGA2 is not set + +# +# VCODEC +# +CONFIG_RK_VCODEC=y + +# +# IEP +# +CONFIG_IEP=y +# CONFIG_IEP_MMU is not set + +# +# DP +# + +# +# ROCKCHIP_MPP +# +CONFIG_ROCKCHIP_MPP_SERVICE=y +CONFIG_ROCKCHIP_MPP_DEVICE=y +# CONFIG_VGASTATE is not set +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_HDMI=y +CONFIG_HDMI_NOTIFIERS=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_PCM_ELD=y +CONFIG_SND_PCM_IEC958=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +CONFIG_SND_SEQUENCER=y +CONFIG_SND_SEQ_DUMMY=y +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_SEQUENCER_OSS is not set +CONFIG_SND_HRTIMER=y +CONFIG_SND_SEQ_HRTIMER_DEFAULT=y +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_PROC_FS is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +CONFIG_SND_RAWMIDI_SEQ=m +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_VIRMIDI is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_AC97_POWER_SAVE is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +# CONFIG_SND_ARM is not set +# CONFIG_SND_SPI is not set +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_USB_UA101 is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_6FIRE is not set +# CONFIG_SND_USB_HIFACE is not set +# CONFIG_SND_BCD2000 is not set +# CONFIG_SND_USB_POD is not set +# CONFIG_SND_USB_PODHD is not set +# CONFIG_SND_USB_TONEPORT is not set +# CONFIG_SND_USB_VARIAX is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +CONFIG_SND_SOC_ROCKCHIP=y +# CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM is not set +CONFIG_SND_SOC_ROCKCHIP_I2S=y +# CONFIG_SND_SOC_ROCKCHIP_I2S_TDM is not set +# CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS is not set +# CONFIG_SND_SOC_ROCKCHIP_PDM is not set +CONFIG_SND_SOC_ROCKCHIP_SPDIF=y +# CONFIG_SND_SOC_ROCKCHIP_SPDIFRX is not set +# CONFIG_SND_SOC_ROCKCHIP_VAD is not set +# CONFIG_SND_SOC_ROCKCHIP_DA7219 is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_DP is not set +CONFIG_SND_SOC_ROCKCHIP_MAX98090=y +# CONFIG_SND_SOC_ROCKCHIP_MULTICODECS is not set +CONFIG_SND_SOC_ROCKCHIP_RT5645=y +# CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749 is not set +# CONFIG_SND_SOC_ROCKCHIP_CDNDP is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CX2072X is not set +# CONFIG_SND_SOC_CX20810 is not set +# CONFIG_SND_SOC_DUMMY_CODEC is not set +# CONFIG_SND_SOC_BT_SCO is not set +# CONFIG_SND_SOC_ES8316 is not set +CONFIG_SND_SOC_ES8323=y +CONFIG_SND_SOC_HDMI_CODEC=y +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8396 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_GVA_CODEC is not set +# CONFIG_SND_SOC_FM1288 is not set +CONFIG_SND_SOC_MAX98090=y +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RK312X is not set +# CONFIG_SND_SOC_RK3228 is not set +# CONFIG_SND_SOC_RK3308 is not set +# CONFIG_SND_SOC_RK3328 is not set +# CONFIG_SND_SOC_RK817 is not set +CONFIG_SND_SOC_RL6231=y +CONFIG_SND_SOC_RT5616=y +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_RT5640=y +CONFIG_SND_SOC_RT5645=y +# CONFIG_SND_SOC_RT5651 is not set +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=y +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TC358749X is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +CONFIG_SND_SOC_TS3A227E=y +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +CONFIG_SND_SIMPLE_CARD=y +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_RKVR is not set +# CONFIG_HID_ALPS is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +CONFIG_I2C_HID=y +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +# CONFIG_USB_DEFAULT_PERSIST is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +CONFIG_USB_OTG=y +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=y +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=y +# CONFIG_USB_PRINTER is not set +CONFIG_USB_WDM=y +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +# CONFIG_USB_UAS is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +CONFIG_USB_DWC2=y +# CONFIG_USB_DWC2_HOST is not set + +# +# Gadget/Dual-role mode requires USB Gadget support to be enabled +# +# CONFIG_USB_DWC2_PERIPHERAL is not set +CONFIG_USB_DWC2_DUAL_ROLE=y +# CONFIG_USB_DWC2_DEBUG is not set +# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +# CONFIG_USB_SERIAL_CONSOLE is not set +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=y +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=y +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +CONFIG_USB_SERIAL_KEYSPAN=y +# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=y +CONFIG_USB_SERIAL_OTI6858=y +# CONFIG_USB_SERIAL_QCAUX is not set +CONFIG_USB_SERIAL_QUALCOMM=y +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +CONFIG_USB_SERIAL_WWAN=y +CONFIG_USB_SERIAL_OPTION=y +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +CONFIG_USB_EZUSB_FX2=y +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_USB_PHY is not set +# CONFIG_USB_OTG_WAKELOCK is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +CONFIG_USB_GADGET_DEBUG_FILES=y +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FUSB300 is not set +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_BDC_UDC is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_DUMMY_HCD is not set +CONFIG_USB_LIBCOMPOSITE=m +CONFIG_USB_F_ACM=m +CONFIG_USB_U_SERIAL=m +CONFIG_USB_F_MASS_STORAGE=m +CONFIG_USB_F_FS=m +CONFIG_USB_CONFIGFS=m +# CONFIG_USB_CONFIGFS_SERIAL is not set +CONFIG_USB_CONFIGFS_ACM=y +# CONFIG_USB_CONFIGFS_OBEX is not set +# CONFIG_USB_CONFIGFS_NCM is not set +# CONFIG_USB_CONFIGFS_ECM is not set +# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set +# CONFIG_USB_CONFIGFS_RNDIS is not set +# CONFIG_USB_CONFIGFS_EEM is not set +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +# CONFIG_USB_CONFIGFS_F_LB_SS is not set +CONFIG_USB_CONFIGFS_F_FS=y +# CONFIG_USB_CONFIGFS_F_MTP is not set +# CONFIG_USB_CONFIGFS_F_ACC is not set +CONFIG_USB_CONFIGFS_UEVENT=y +# CONFIG_USB_CONFIGFS_F_UAC1 is not set +# CONFIG_USB_CONFIGFS_F_UAC2 is not set +# CONFIG_USB_CONFIGFS_F_MIDI is not set +# CONFIG_USB_CONFIGFS_F_HID is not set +# CONFIG_USB_CONFIGFS_F_UVC is not set +# CONFIG_USB_CONFIGFS_F_PRINTER is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set + +# +# ROCKCHIP USB Support +# +# CONFIG_USB20_HOST is not set +# CONFIG_USB20_OTG is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_EMBEDDED_SDIO is not set +# CONFIG_MMC_PARANOID_SD_INIT is not set +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=16 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +CONFIG_MMC_TEST=y +# CONFIG_MMC_SIMULATE_MAX_SPEED is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +CONFIG_MMC_DW=y +CONFIG_MMC_DW_PLTFM=y +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_K3 is not set +CONFIG_MMC_DW_ROCKCHIP=y +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_CLASS_FLASH is not set + +# +# LED drivers +# +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_LEDS_TRIGGER_MULTI_CTRL is not set +# CONFIG_SWITCH is not set +# CONFIG_ACCESSIBILITY is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_FAKE is not set +CONFIG_RTC_DRV_HYM8563=y +# CONFIG_RTC_DRV_MAX6900 is not set +CONFIG_RTC_DRV_RK808=y +# CONFIG_RTC_DRV_RK_TIMER is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_TPS6586X is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_MCP795 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +# CONFIG_AMBA_PL08X is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_NBPFAXI_DMA is not set +CONFIG_PL330_DMA=y +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VFIO is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +# CONFIG_R8712U is not set +# CONFIG_R8188EU is not set +# CONFIG_R8723AU is not set +# CONFIG_VT6656 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16204 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16220 is not set +# CONFIG_ADIS16240 is not set +# CONFIG_LIS3L02DQ is not set +# CONFIG_SCA3000 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7606 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7746 is not set + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16060 is not set + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set +# CONFIG_INV_MPU_IIO is not set + +# +# Light sensors +# +CONFIG_SENSORS_ISL29018=y +# CONFIG_SENSORS_ISL29028 is not set +CONFIG_TSL2583=y +# CONFIG_TSL2x7x is not set + +# +# Magnetometer sensors +# +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set + +# +# Active energy metering IC +# +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set + +# +# Triggers - standalone +# +# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set +# CONFIG_IIO_SIMPLE_DUMMY is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_STAGING_MEDIA is not set + +# +# Android +# +# CONFIG_ASHMEM is not set +# CONFIG_ANDROID_TIMED_OUTPUT is not set +# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set +# CONFIG_SYNC is not set +# CONFIG_ION is not set +# CONFIG_FIQ_DEBUGGER is not set +# CONFIG_FIQ_WATCHDOG is not set +# CONFIG_RK_CONSOLE_THREAD is not set +# CONFIG_STAGING_BOARD is not set +# CONFIG_WIMAX_GDM72XX is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_DGAP is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_DRIVER is not set +# CONFIG_MOST is not set +# CONFIG_POWERVR_ROGUE_N is not set +# CONFIG_GOLDFISH is not set +CONFIG_CHROME_PLATFORMS=y +# CONFIG_CROS_EC_CHARDEV is not set +CONFIG_CROS_EC_PROTO=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +CONFIG_COMMON_CLK_RK808=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_CDCE706 is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_ROCKCHIP_TIMER=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_ARCH_TIMER_VCT_ACCESS=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +# CONFIG_MAILBOX is not set +CONFIG_IOMMU_API=y +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_IOVA=y +CONFIG_OF_IOMMU=y +CONFIG_IOMMU_DMA=y +CONFIG_ROCKCHIP_IOMMU=y +# CONFIG_RK_IOMMU is not set +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SOC_BRCMSTB is not set + +# +# CPU selection +# +# CONFIG_CPU_RK312X is not set +# CONFIG_CPU_RK3036 is not set +# CONFIG_CPU_RK30XX is not set +# CONFIG_CPU_RK3188 is not set +CONFIG_CPU_RK3288=y +# CONFIG_CPU_RK322X is not set +# CONFIG_CPU_RV110X is not set +# CONFIG_CPU_PX30 is not set +# CONFIG_CPU_RK1808 is not set +# CONFIG_CPU_RK3308 is not set +# CONFIG_CPU_RK3328 is not set +# CONFIG_CPU_RK3366 is not set +# CONFIG_CPU_RK3368 is not set +# CONFIG_CPU_RK3399 is not set +CONFIG_ANDROID_VERSION=0x07010000 +CONFIG_ROCKCHIP_CPUINFO=y +# CONFIG_ROCKCHIP_DEVICEINFO is not set +CONFIG_ROCKCHIP_OPP=y +# CONFIG_ROCKCHIP_PM_TEST is not set +CONFIG_ROCKCHIP_GRF=y +CONFIG_ROCKCHIP_PM_DOMAINS=y +CONFIG_ROCKCHIP_PVTM=y +CONFIG_ROCKCHIP_SUSPEND_MODE=y +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y + +# +# DEVFREQ Drivers +# +CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y +# CONFIG_EXTCON is not set +CONFIG_MEMORY=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 + +# +# Accelerometers +# +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_HI8435 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_NAU7802 is not set +CONFIG_ROCKCHIP_SARADC=y +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_VF610_ADC is not set + +# +# Amplifiers +# +# CONFIG_AD8366 is not set + +# +# Chemical Sensors +# +# CONFIG_VZ89X is not set + +# +# Hid Sensor IIO Common +# + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set + +# +# Digital to analog converters +# +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +# CONFIG_AD9523 is not set + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set + +# +# Humidity sensors +# +# CONFIG_DHT11 is not set +# CONFIG_HDC100X is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_IIO is not set + +# +# Light sensors +# +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_ISL29125 is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_STK3310 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +CONFIG_SENSORS_TSL2563=y +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VL6180 is not set + +# +# Magnetometer sensors +# +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN is not set +# CONFIG_MAG3110 is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set + +# +# Inclinometer sensors +# + +# +# Triggers - standalone +# +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +CONFIG_IIO_SYSFS_TRIGGER=y + +# +# Digital potentiometers +# +# CONFIG_MCP4531 is not set + +# +# Pressure sensors +# +# CONFIG_BMP280 is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set + +# +# Proximity sensors +# +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_SX9500 is not set + +# +# Temperature sensors +# +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_CROS_EC is not set +# CONFIG_PWM_FSL_FTM is not set +CONFIG_PWM_GPIO=y +# CONFIG_PWM_PCA9685 is not set +CONFIG_PWM_ROCKCHIP=y +# CONFIG_PWM_ROCKCHIP_I2S is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +# CONFIG_IPACK_BUS is not set +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set +CONFIG_PHY_ROCKCHIP_USB=y +# CONFIG_PHY_ROCKCHIP_INNO_USB2 is not set +# CONFIG_PHY_ROCKCHIP_INNO_USB3 is not set +CONFIG_PHY_ROCKCHIP_EMMC=y +CONFIG_PHY_ROCKCHIP_DP=y +# CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY is not set +# CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY is not set +# CONFIG_PHY_ROCKCHIP_TYPEC is not set +# CONFIG_PHY_ROCKCHIP_PCIE is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_PMU=y +CONFIG_RAS=y + +# +# Android +# +CONFIG_ANDROID=y +# CONFIG_ANDROID_BINDER_IPC is not set +CONFIG_NVMEM=y +CONFIG_ROCKCHIP_EFUSE=y +CONFIG_ROCKCHIP_OTP=y +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set +# CONFIG_TEE is not set +# CONFIG_RK_FLASH is not set +# CONFIG_RK_NAND is not set + +# +# Headset device support +# +# CONFIG_RK_HEADSET is not set + +# +# Firmware Drivers +# +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_HAVE_ARM_SMCCC=y +CONFIG_ROCKCHIP_SIP=y + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_PROC_UID=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +# CONFIG_SDCARD_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_BLOCK=m +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_SMB311=y +CONFIG_CIFS_FSCACHE=y +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +# CONFIG_PRINTK_PROCESS is not set +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +# CONFIG_GDB_SCRIPTS is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=2048 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_HIGHMEM is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +CONFIG_HARDLOCKUP_DETECTOR_OTHER_CPU=y +CONFIG_HARDLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1 +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=1 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_INFO=y +# CONFIG_PANIC_ON_RT_THROTTLING is not set +CONFIG_SCHEDSTATS=y +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +CONFIG_TIMER_STATS=y + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +CONFIG_DEBUG_SPINLOCK=y +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +CONFIG_DEBUG_CREDENTIALS=y + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_GPU_TRACEPOINTS=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +CONFIG_BLK_DEV_IO_TRACE=y +# CONFIG_UPROBE_EVENT is not set +# CONFIG_PROBE_EVENTS is not set +CONFIG_DYNAMIC_FTRACE=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_TRACE_ENUM_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y + +# +# Runtime Testing +# +CONFIG_LKDTM=y +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_ARM_PTDUMP is not set +CONFIG_STRICT_DEVMEM=y +CONFIG_ARM_UNWIND=y +CONFIG_OLD_MCOUNT=y +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_PID_IN_CONTEXTIDR is not set +CONFIG_DEBUG_SET_MODULE_RONX=y +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_TRUSTED_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY_PERF_EVENTS_RESTRICT is not set +# CONFIG_SECURITY is not set +CONFIG_SECURITYFS=y +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_TEE_SUPPORT is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=y +# CONFIG_CRYPTO_ECHAINIV is not set + +# +# Block modes +# +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_HEH is not set +CONFIG_CRYPTO_CTR=y +# CONFIG_CRYPTO_CTS is not set +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_GHASH=y +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SPECK is not set +# CONFIG_CRYPTO_TEA is not set +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_TWOFISH_COMMON=y + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_ZLIB is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_USER_API=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_ROCKCHIP is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_PUBLIC_KEY_ALGO_RSA=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +# CONFIG_ARM_CRYPTO is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +CONFIG_CRC7=y +CONFIG_LIBCRC32C=y +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=m +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=m +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +# CONFIG_XZ_DEC_SPARC is not set +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_CLZ_TAB=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_MPILIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y +# CONFIG_VIRTUALIZATION is not set diff --git a/projects/Rockchip/devices/MiQi/options b/projects/Rockchip/devices/MiQi/options new file mode 100644 index 0000000000..7e3c0d849c --- /dev/null +++ b/projects/Rockchip/devices/MiQi/options @@ -0,0 +1,31 @@ +################################################################################ +# setup device defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + arm) + TARGET_FLOAT="hard" + TARGET_CPU="cortex-a17" + TARGET_FPU="neon-vfpv4" + TARGET_FEATURES="32bit" + KERNEL_LINARO_TOOLCHAIN="arm-linux-gnueabihf" + ;; + esac + + # Configuration for u-boot + UBOOT_SYSTEM="rk3288" + + # Kernel target + KERNEL_TARGET="zImage" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="rk3288-miqi.dtb" + + # Mali GPU family + MALI_FAMILY="t760" + MALI_REVISION="r1p0" + + # kernel serial console + EXTRA_CMDLINE="console=uart8250,mmio32,0xff690000 console=tty0" diff --git a/projects/Rockchip/devices/RK3328/README.md b/projects/Rockchip/devices/RK3328/README.md new file mode 100644 index 0000000000..685eca9b81 --- /dev/null +++ b/projects/Rockchip/devices/RK3328/README.md @@ -0,0 +1,18 @@ +# RK3328 + +This is a SoC device for RK3328 + +**Build** + +* `PROJECT=Rockchip DEVICE=RK3328 ARCH=arm UBOOT_SYSTEM=box make image` +* `PROJECT=Rockchip DEVICE=RK3328 ARCH=arm UBOOT_SYSTEM=box-trn9 make image` +* `PROJECT=Rockchip DEVICE=RK3328 ARCH=arm UBOOT_SYSTEM=box-z28 make image` +* `PROJECT=Rockchip DEVICE=RK3328 ARCH=arm UBOOT_SYSTEM=roc-cc make image` +* `PROJECT=Rockchip DEVICE=RK3328 ARCH=arm UBOOT_SYSTEM=rock64 make image` +* `PROJECT=Rockchip DEVICE=RK3328 ARCH=arm UBOOT_SYSTEM=rockbox make image` + +**How to use on an Android device** +- Flash image to a sd-card +- Insert sd-card into the device +- Plug in power and LibreELEC should boot instead of Android +- Remove sd-card from device to boot into Android diff --git a/projects/Rockchip/devices/RK3328/linux/rockchip-4.4/linux.aarch64.conf b/projects/Rockchip/devices/RK3328/linux/rockchip-4.4/linux.aarch64.conf new file mode 100644 index 0000000000..f68101b00a --- /dev/null +++ b/projects/Rockchip/devices/RK3328/linux/rockchip-4.4/linux.aarch64.conf @@ -0,0 +1,4912 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm64 4.4.154 Kernel Configuration +# +CONFIG_ARM64=y +CONFIG_64BIT=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_ARM64_PAGE_SHIFT=12 +CONFIG_ARM64_CONT_SHIFT=4 +CONFIG_NO_IOPORT_MAP=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ZONE_DMA=y +CONFIG_HAVE_GENERIC_RCU_GUP=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_SMP=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +CONFIG_KERNEL_MODE_NEON=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_PGTABLE_LEVELS=3 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y +CONFIG_THREAD_INFO_IN_TASK=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +CONFIG_USELIB=y +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_SCHED_WALT is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +# CONFIG_MEMCG_KMEM is not set +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SCHED_TUNE is not set +# CONFIG_DEFAULT_USE_ENERGY_AWARE is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +CONFIG_RD_XZ=y +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_BPF=y +CONFIG_EXPERT=y +CONFIG_UID16=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y +# CONFIG_KPROBES is not set +# CONFIG_JUMP_LABEL is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_RCU_TABLE_FREE=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_ARCH_HUGE_VMAP=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +CONFIG_BLK_DEV_THROTTLING=y +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_RK_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set +CONFIG_BLOCK_COMPAT=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +CONFIG_CFQ_GROUP_IOSCHED=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_ASN1=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# Platform selection +# +# CONFIG_ARCH_BCM_IPROC is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_EXYNOS7 is not set +# CONFIG_ARCH_LAYERSCAPE is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_MEDIATEK is not set +# CONFIG_ARCH_QCOM is not set +CONFIG_ARCH_ROCKCHIP=y +# CONFIG_ARCH_SEATTLE is not set +# CONFIG_ARCH_STRATIX10 is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_SPRD is not set +# CONFIG_ARCH_THUNDER is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_XGENE is not set +# CONFIG_ARCH_ZYNQMP is not set + +# +# Bus support +# +# CONFIG_PCI is not set +# CONFIG_PCI_DOMAINS is not set +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set + +# +# Kernel Features +# + +# +# ARM errata workarounds via the alternatives framework +# +CONFIG_ARM64_ERRATUM_826319=y +CONFIG_ARM64_ERRATUM_827319=y +CONFIG_ARM64_ERRATUM_824069=y +CONFIG_ARM64_ERRATUM_819472=y +# CONFIG_ARM64_ERRATUM_832075 is not set +CONFIG_ARM64_ERRATUM_845719=y +CONFIG_ARM64_ERRATUM_843419=y +# CONFIG_ARM64_ERRATUM_1024718 is not set +# CONFIG_CAVIUM_ERRATUM_22375 is not set +# CONFIG_CAVIUM_ERRATUM_23154 is not set +# CONFIG_CAVIUM_ERRATUM_27456 is not set +CONFIG_ARM64_4K_PAGES=y +# CONFIG_ARM64_16K_PAGES is not set +# CONFIG_ARM64_64K_PAGES is not set +CONFIG_ARM64_VA_BITS_39=y +# CONFIG_ARM64_VA_BITS_48 is not set +CONFIG_ARM64_VA_BITS=39 +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_SCHED_MC=y +# CONFIG_SCHED_SMT is not set +CONFIG_NR_CPUS=4 +CONFIG_HOTPLUG_CPU=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +# CONFIG_HZ_100 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_COMPACTION is not set +CONFIG_MIGRATION=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_BOUNCE=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +# CONFIG_TRANSPARENT_HUGEPAGE is not set +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_DEBUGFS=y +CONFIG_CMA_AREAS=7 +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +CONFIG_ZSMALLOC=m +CONFIG_PGTABLE_MAPPING=y +# CONFIG_ZSMALLOC_STAT is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_SECCOMP=y +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +# CONFIG_XEN is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_UNMAP_KERNEL_AT_EL0=y +# CONFIG_ARMV8_DEPRECATED is not set +# CONFIG_ARM64_SW_TTBR0_PAN is not set + +# +# ARMv8.1 architectural features +# +CONFIG_ARM64_HW_AFDBM=y +CONFIG_ARM64_PAN=y +# CONFIG_ARM64_LSE_ATOMICS is not set +CONFIG_ARM64_UAO=y +CONFIG_ARM64_MODULE_CMODEL_LARGE=y +# CONFIG_RANDOMIZE_BASE is not set + +# +# Boot options +# +CONFIG_CMDLINE="usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_EFI is not set +# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y +CONFIG_COMPAT=y +CONFIG_SYSVIPC_COMPAT=y +CONFIG_KEYS_COMPAT=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +CONFIG_HAS_WAKELOCK=y +CONFIG_WAKELOCK=y +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_ADVANCED_DEBUG=y +# CONFIG_PM_TEST_SUSPEND is not set +CONFIG_PM_SLEEP_DEBUG=y +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y + +# +# CPU Power Management +# + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_DT_IDLE_STATES=y + +# +# ARM CPU Idle Drivers +# +CONFIG_ARM_CPUIDLE=y +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_TIMES=y +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y + +# +# CPU frequency scaling drivers +# +CONFIG_CPUFREQ_DT=y +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARM_ROCKCHIP_CPUFREQ=y +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +CONFIG_NET_UDP_TUNNEL=m +# CONFIG_NET_FOU is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_IPV6_SIT is not set +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_ANDROID_PARANOID_NETWORK is not set +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +CONFIG_NF_LOG_COMMON=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +# CONFIG_NF_CONNTRACK_IRC is not set +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CT_NETLINK is not set +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +# CONFIG_NF_NAT_IRC is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_DEFRAG_IPV6 is not set +# CONFIG_NF_CONNTRACK_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +# CONFIG_NF_REJECT_IPV6 is not set +CONFIG_NF_LOG_IPV6=m +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=y +# CONFIG_BT_RFCOMM_TTY is not set +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_SELFTEST is not set +CONFIG_BT_DEBUGFS=y + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=y +CONFIG_BT_BCM=y +CONFIG_BT_RTL=y +# CONFIG_BT_RTKBTUSB is not set +CONFIG_BT_HCIBTUSB=y +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +CONFIG_BT_HCIBTSDIO=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +# CONFIG_BT_HCIUART_BCM is not set +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=y +CONFIG_BT_HCIVHCI=y +CONFIG_BT_MRVL=y +CONFIG_BT_MRVL_SDIO=y +# CONFIG_BT_ATH3K is not set +# CONFIG_AF_RXRPC is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=y +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=y +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +CONFIG_MAC80211_DEBUGFS=y +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_PM=y +CONFIG_RFKILL_LEDS=y +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL_REGULATOR is not set +CONFIG_RFKILL_GPIO=y +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_EBPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y +# CONFIG_TEGRA_AHB is not set + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_WANT_DEV_COREDUMP=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +CONFIG_DEBUG_DEVRES=y +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=64 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_ARM_CCI400_PMU is not set +# CONFIG_ARM_CCI500_PMU is not set +# CONFIG_ARM_CCN is not set +# CONFIG_VEXPRESS_CONFIG is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +# CONFIG_MTD_BLOCK is not set +# CONFIG_MTD_BLOCK_RO is not set +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_SWAP is not set +# CONFIG_MTD_PARTITIONED_MASTER is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_DATAFLASH is not set +CONFIG_MTD_M25P80=y +# CONFIG_MTD_SST25L is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +# CONFIG_MTD_NAND_IDS is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR & LPDDR2 PCM memory drivers +# +# CONFIG_MTD_LPDDR is not set +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +# CONFIG_MTD_UBI is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_MTD=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +CONFIG_ZRAM=m +CONFIG_ZRAM_LZ4_COMPRESS=y +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=1 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +CONFIG_ROCKCHIP_SCR=y +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +CONFIG_SRAM=y +# CONFIG_MEMORY_STATE_TIME is not set +# CONFIG_USB_CAM_GPIO is not set +# CONFIG_GPIO_DET is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_HAVE_PATA_PLATFORM=y +# CONFIG_ATA is not set +CONFIG_MD=y +# CONFIG_BLK_DEV_MD is not set +# CONFIG_BCACHE is not set +CONFIG_BLK_DEV_DM_BUILTIN=y +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_MQ_DEFAULT is not set +# CONFIG_DM_DEBUG is not set +CONFIG_DM_BUFIO=m +CONFIG_DM_BIO_PRISON=m +CONFIG_DM_PERSISTENT_DATA=m +# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set +# CONFIG_DM_CRYPT is not set +# CONFIG_DM_SNAPSHOT is not set +CONFIG_DM_THIN_PROVISIONING=m +# CONFIG_DM_CACHE is not set +# CONFIG_DM_ERA is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_RAID is not set +# CONFIG_DM_ZERO is not set +# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_DELAY is not set +# CONFIG_DM_UEVENT is not set +# CONFIG_DM_FLAKEY is not set +# CONFIG_DM_VERITY is not set +# CONFIG_DM_VERITY_HASH_PREFETCH_MIN_SIZE_128 is not set +# CONFIG_DM_SWITCH is not set +# CONFIG_DM_LOG_WRITES is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +CONFIG_DUMMY=m +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +CONFIG_VXLAN=m +# CONFIG_GENEVE is not set +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=m +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +CONFIG_ETHERNET=y +# CONFIG_ALTERA_TSE is not set +# CONFIG_NET_VENDOR_AMD is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_AURORA is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_ETHOC is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_DWMAC_GENERIC=y +# CONFIG_DWMAC_IPQ806X is not set +# CONFIG_DWMAC_LPC18XX is not set +# CONFIG_DWMAC_MESON is not set +CONFIG_DWMAC_ROCKCHIP=y +# CONFIG_DWMAC_SOCFPGA is not set +# CONFIG_DWMAC_STI is not set +# CONFIG_DWMAC_SUNXI is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +CONFIG_ROCKCHIP_PHY=y +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_OCTEON is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MICREL_KS8995MA is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=y +CONFIG_USB_NET_AX88179_178A=y +CONFIG_USB_NET_CDCETHER=y +# CONFIG_USB_NET_CDC_EEM is not set +CONFIG_USB_NET_CDC_NCM=y +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +CONFIG_USB_NET_CDC_MBIM=y +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +# CONFIG_USB_NET_SMSC75XX is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_MCS7830 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_LIBERTAS_THINFIRM=y +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +# CONFIG_LIBERTAS_THINFIRM_USB is not set +# CONFIG_AT76C50X_USB is not set +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=y +CONFIG_RTL8187=m +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_ATH_CARDS is not set +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +# CONFIG_HOSTAP is not set +# CONFIG_LIBERTAS is not set +# CONFIG_P54_COMMON is not set +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_LIB_DEBUGFS is not set +# CONFIG_RT2X00_DEBUG is not set +# CONFIG_WL_MEDIATEK is not set +# CONFIG_RTL_CARDS is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WL_ROCKCHIP=y +CONFIG_WIFI_BUILD_MODULE=y +# CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP is not set +# CONFIG_WIFI_GENERATE_RANDOM_MAC_ADDR is not set +CONFIG_AP6XXX=m +# CONFIG_CYW_BCMDHD is not set +CONFIG_RTL_WIRELESS_SOLUTION=y +# CONFIG_RTL8188EU is not set +# CONFIG_RTL8188FU is not set +# CONFIG_RTL8189ES is not set +CONFIG_RTL8189FS=m +CONFIG_RTL8723BS=m +# CONFIG_RTL8723BU is not set +# CONFIG_RTL8723CS is not set +# CONFIG_RTL8723DS is not set +# CONFIG_MVL88W8977 is not set + +# +# SouthSV 6XXX WLAN support +# +# CONFIG_SSV6051 is not set +# CONFIG_WL_TI is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MWIFIEX is not set +# CONFIG_CW1200 is not set +# CONFIG_RSI_91X is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_INPUT_SPARSEKMAP is not set +CONFIG_INPUT_MATRIXKMAP=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KEYRESET is not set +# CONFIG_INPUT_KEYCOMBO is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADC is not set +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_ROCKCHIP is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_KEYBOARD_CROS_EC=y +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +# CONFIG_MOUSE_PS2 is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +CONFIG_MOUSE_CYAPA=y +CONFIG_MOUSE_ELAN_I2C=y +CONFIG_MOUSE_ELAN_I2C_I2C=y +# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +CONFIG_JOYSTICK_IFORCE=y +CONFIG_JOYSTICK_IFORCE_USB=y +# CONFIG_JOYSTICK_IFORCE_232 is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_INPUT_TABLET=y +# CONFIG_TABLET_USB_ACECAD is not set +# CONFIG_TABLET_USB_AIPTEK is not set +# CONFIG_TABLET_USB_GTCO is not set +# CONFIG_TABLET_USB_HANWANG is not set +# CONFIG_TABLET_USB_KBTAB is not set +# CONFIG_TABLET_SERIAL_WACOM4 is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +CONFIG_TOUCHSCREEN_ATMEL_MXT=y +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8C40XX is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX is not set +# CONFIG_TOUCHSCREEN_FT6236 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_GSLX680A is not set +# CONFIG_TOUCHSCREEN_GSLX680_D708 is not set +# CONFIG_TOUCHSCREEN_GSLX680_PAD is not set +# CONFIG_TOUCHSCREEN_GSLX680_VR is not set +# CONFIG_TOUCHSCREEN_GSLX680_FIREFLY is not set +# CONFIG_TOUCHSCREEN_GSL3673 is not set +# CONFIG_TOUCHSCREEN_GSL3673_800X1280 is not set +# CONFIG_TOUCHSCREEN_GT9XX is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +CONFIG_TOUCHSCREEN_ELAN=y +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=y +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_ST1232 is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +# CONFIG_TOUCHSCREEN_VTL_CT36X is not set +# CONFIG_TOUCHSCREEN_GT1X is not set +# CONFIG_ROCKCHIP_REMOTECTL is not set + +# +# handle all sensors +# +# CONFIG_SENSOR_DEVICE is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYCHORD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_RK8XX_PWRKEY=y +CONFIG_INPUT_UINPUT=y +CONFIG_INPUT_GPIO=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_RAW=y +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_NR_UARTS=5 +CONFIG_SERIAL_8250_RUNTIME_UARTS=5 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +# CONFIG_SERIAL_8250_SHARE_IRQ is not set +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_INGENIC is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_TPM=y +# CONFIG_HW_RANDOM_ROCKCHIP is not set +# CONFIG_R3964 is not set + +# +# PCMCIA character devices +# +# CONFIG_RAW_DRIVER is not set +CONFIG_TCG_TPM=y +# CONFIG_TCG_TIS_I2C_ATMEL is not set +CONFIG_TCG_TIS_I2C_INFINEON=y +# CONFIG_TCG_TIS_I2C_NUVOTON is not set +# CONFIG_TCG_TIS_ST33ZP24 is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CADENCE is not set +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +CONFIG_I2C_RK3X=y +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +CONFIG_I2C_CROS_EC_TUNNEL=y +CONFIG_I2C_STUB=m +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +CONFIG_SPI_ROCKCHIP=y +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_RK805=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +CONFIG_DEBUG_GPIO=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_DWAPB is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_XGENE is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set + +# +# MFD GPIO expanders +# +CONFIG_GPIO_RK8XX=y +# CONFIG_GPIO_TPS6586X is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +CONFIG_BATTERY_SBS=y +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +CONFIG_CHARGER_GPIO=y +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +CONFIG_CHARGER_BQ24735=y +# CONFIG_CHARGER_BQ25700 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_CHARGER_SY6982C is not set +# CONFIG_CHARGER_UNIVERSAL is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_BATTERY_EC is not set +# CONFIG_BATTERY_CW2015 is not set +# CONFIG_BATTERY_RK816 is not set +# CONFIG_BATTERY_RK817 is not set +# CONFIG_CHARGER_RK817 is not set +# CONFIG_BATTERY_RK818 is not set +# CONFIG_CHARGER_RK818 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +# CONFIG_POWER_RESET_RESTART is not set +# CONFIG_POWER_RESET_XGENE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +CONFIG_REBOOT_MODE=y +CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_POWER_AVS=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y +CONFIG_CPU_THERMAL=y +# CONFIG_CLOCK_THERMAL is not set +CONFIG_DEVFREQ_THERMAL=y +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_IMX_THERMAL is not set +CONFIG_ROCKCHIP_THERMAL=y +CONFIG_RK_VIRTUAL_THERMAL=y +# CONFIG_RK3368_THERMAL is not set +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_CORE is not set +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +CONFIG_DW_WATCHDOG=y +# CONFIG_MAX63XX_WATCHDOG is not set +# CONFIG_BCM7038_WDT is not set +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X is not set +CONFIG_MFD_CROS_EC=y +# CONFIG_MFD_CROS_EC_I2C is not set +CONFIG_MFD_CROS_EC_SPI=y +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK618 is not set +CONFIG_MFD_RK808=y +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +CONFIG_MFD_TPS6586X=y +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_RK1000 is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_FUSB_30X is not set +CONFIG_REGULATOR=y +CONFIG_REGULATOR_DEBUG=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +CONFIG_REGULATOR_ACT8865=y +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +CONFIG_REGULATOR_FAN53555=y +CONFIG_REGULATOR_GPIO=y +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +CONFIG_REGULATOR_LP8752=y +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +CONFIG_REGULATOR_MP8865=y +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_RK808=y +CONFIG_REGULATOR_RK818=y +# CONFIG_REGULATOR_SYR82X is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS549B22 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +CONFIG_REGULATOR_TPS6586X=y +CONFIG_REGULATOR_XZ3216=y +CONFIG_CEC_CORE=y +CONFIG_CEC_NOTIFIER=y +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=32 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_HIX5HD2=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_FRIIO=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# USB HDMI CEC adapters +# +CONFIG_USB_PULSE8_CEC=m +CONFIG_USB_RAINSHADOW_CEC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set +# CONFIG_ROCKCHIP_TSP is not set + +# +# Supported MMC/SDIO adapters +# +# CONFIG_SMS_SDIO_DRV is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Camera lens devices +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set +# CONFIG_CAMSYS_DRV is not set +# CONFIG_ROCK_CHIP_SOC_CAMERA is not set + +# +# Graphics support +# +CONFIG_DRM=y +CONFIG_DRM_IGNORE_IOTCL_PERMIT=y +CONFIG_DRM_MIPI_DSI=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_FBDEV_EMULATION=y +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set +# CONFIG_DRM_SCDC_HELPER is not set +# CONFIG_DRM_DMA_SYNC is not set + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_VGEM is not set +CONFIG_DRM_ROCKCHIP=y +# CONFIG_ROCKCHIP_DRM_DEBUG is not set +# CONFIG_ROCKCHIP_CDN_DP is not set +CONFIG_ROCKCHIP_DW_HDMI=y +CONFIG_ROCKCHIP_DW_MIPI_DSI=y +CONFIG_ROCKCHIP_MIPI_CSI_TX=y +CONFIG_ROCKCHIP_ANALOGIX_DP=y +CONFIG_ROCKCHIP_INNO_HDMI=y +CONFIG_ROCKCHIP_LVDS=y +CONFIG_ROCKCHIP_DRM_TVE=y +# CONFIG_ROCKCHIP_RGB is not set +# CONFIG_ROCKCHIP_DRM_BACKLIGHT is not set +# CONFIG_ROCKCHIP_RK3066_HDMI is not set +# CONFIG_DRM_UDL is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +CONFIG_DRM_PANEL_SIMPLE=y +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +CONFIG_DRM_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_RK1000 is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LONTIUM_LT8912 is not set +CONFIG_DRM_ANALOGIX_DP=y +CONFIG_DRM_DW_HDMI=y +# CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set +CONFIG_DRM_DW_HDMI_I2S_AUDIO=y +CONFIG_DRM_DW_HDMI_CEC=y +# CONFIG_POWERVR_ROGUE_M is not set +CONFIG_MALI400=m +CONFIG_MALI450=y +# CONFIG_MALI470 is not set +# CONFIG_MALI400_DEBUG is not set +# CONFIG_MALI400_PROFILING is not set +# CONFIG_MALI400_UMP is not set +CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y +# CONFIG_MALI_SHARED_INTERRUPTS is not set +# CONFIG_MALI_PMU_PARALLEL_POWER_UP is not set +CONFIG_MALI_DT=y +CONFIG_MALI_DEVFREQ=y +# CONFIG_MALI_QUIET is not set +# CONFIG_MALI_MIDGARD is not set +# CONFIG_MALI_KUTF is not set +# CONFIG_MALI_BIFROST_FOR_ANDROID is not set +CONFIG_MALI_BIFROST_FOR_LINUX=y +# CONFIG_MALI_BIFROST is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +CONFIG_BACKLIGHT_PWM=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set + +# +# Rockchip Misc Video driver +# +# CONFIG_FB_ROCKCHIP is not set +# CONFIG_LCDC_RK3368 is not set +CONFIG_LCD_GENERAL=y +# CONFIG_LCD_MIPI is not set +# CONFIG_RK_TRSM is not set +# CONFIG_RK_HDMI is not set + +# +# RGA +# +# CONFIG_ROCKCHIP_RGA is not set + +# +# RGA2 +# +# CONFIG_ROCKCHIP_RGA2 is not set + +# +# VCODEC +# +CONFIG_RK_VCODEC=y + +# +# IEP +# +CONFIG_IEP=y +# CONFIG_IEP_MMU is not set + +# +# DP +# + +# +# ROCKCHIP_MPP +# +CONFIG_ROCKCHIP_MPP_SERVICE=y +CONFIG_ROCKCHIP_MPP_DEVICE=y +# CONFIG_VGASTATE is not set +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_HDMI=y +CONFIG_HDMI_NOTIFIERS=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_PCM_ELD=y +CONFIG_SND_PCM_IEC958=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +CONFIG_SND_SEQUENCER=y +CONFIG_SND_SEQ_DUMMY=y +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_SEQUENCER_OSS is not set +CONFIG_SND_HRTIMER=y +CONFIG_SND_SEQ_HRTIMER_DEFAULT=y +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_PROC_FS is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +CONFIG_SND_RAWMIDI_SEQ=m +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_VIRMIDI is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_AC97_POWER_SAVE is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +# CONFIG_SND_SPI is not set +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_USB_UA101 is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_6FIRE is not set +# CONFIG_SND_USB_HIFACE is not set +# CONFIG_SND_BCD2000 is not set +# CONFIG_SND_USB_POD is not set +# CONFIG_SND_USB_PODHD is not set +# CONFIG_SND_USB_TONEPORT is not set +# CONFIG_SND_USB_VARIAX is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +CONFIG_SND_SOC_ROCKCHIP=y +# CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM is not set +CONFIG_SND_SOC_ROCKCHIP_I2S=y +# CONFIG_SND_SOC_ROCKCHIP_I2S_TDM is not set +# CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS is not set +# CONFIG_SND_SOC_ROCKCHIP_PDM is not set +CONFIG_SND_SOC_ROCKCHIP_SPDIF=y +# CONFIG_SND_SOC_ROCKCHIP_SPDIFRX is not set +# CONFIG_SND_SOC_ROCKCHIP_VAD is not set +# CONFIG_SND_SOC_ROCKCHIP_DA7219 is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_DP is not set +CONFIG_SND_SOC_ROCKCHIP_MAX98090=y +# CONFIG_SND_SOC_ROCKCHIP_MULTICODECS is not set +CONFIG_SND_SOC_ROCKCHIP_RT5645=y +# CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749 is not set +# CONFIG_SND_SOC_ROCKCHIP_CDNDP is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CX2072X is not set +# CONFIG_SND_SOC_CX20810 is not set +# CONFIG_SND_SOC_DUMMY_CODEC is not set +# CONFIG_SND_SOC_BT_SCO is not set +CONFIG_SND_SOC_ES8316=y +# CONFIG_SND_SOC_ES8323 is not set +CONFIG_SND_SOC_HDMI_CODEC=y +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8396 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_GVA_CODEC is not set +# CONFIG_SND_SOC_FM1288 is not set +CONFIG_SND_SOC_MAX98090=y +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RK312X is not set +# CONFIG_SND_SOC_RK3228 is not set +# CONFIG_SND_SOC_RK3308 is not set +CONFIG_SND_SOC_RK3328=y +# CONFIG_SND_SOC_RK817 is not set +CONFIG_SND_SOC_RL6231=y +CONFIG_SND_SOC_RT5616=y +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_RT5640=y +CONFIG_SND_SOC_RT5645=y +CONFIG_SND_SOC_RT5651=y +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=y +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TC358749X is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +CONFIG_SND_SOC_TS3A227E=y +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +CONFIG_SND_SIMPLE_CARD=y +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_RKVR is not set +# CONFIG_HID_ALPS is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +CONFIG_I2C_HID=y +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +# CONFIG_USB_DEFAULT_PERSIST is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +CONFIG_USB_OTG=y +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=y +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PLATFORM=y +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=y +# CONFIG_USB_PRINTER is not set +CONFIG_USB_WDM=y +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +CONFIG_USB_UAS=y + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_HOST is not set +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_DWC3_DUAL_ROLE=y + +# +# Platform Glue Driver Support +# +CONFIG_USB_DWC3_OF_SIMPLE=y +CONFIG_USB_DWC3_ROCKCHIP=y +CONFIG_USB_DWC3_ROCKCHIP_INNO=y +CONFIG_USB_DWC2=y +# CONFIG_USB_DWC2_HOST is not set + +# +# Gadget/Dual-role mode requires USB Gadget support to be enabled +# +# CONFIG_USB_DWC2_PERIPHERAL is not set +CONFIG_USB_DWC2_DUAL_ROLE=y +# CONFIG_USB_DWC2_DEBUG is not set +# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +# CONFIG_USB_SERIAL_CONSOLE is not set +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=y +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=y +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +CONFIG_USB_SERIAL_KEYSPAN=y +# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=y +CONFIG_USB_SERIAL_OTI6858=y +# CONFIG_USB_SERIAL_QCAUX is not set +CONFIG_USB_SERIAL_QUALCOMM=y +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +CONFIG_USB_SERIAL_WWAN=y +CONFIG_USB_SERIAL_OPTION=y +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +CONFIG_USB_EZUSB_FX2=y +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +# CONFIG_USB_OTG_WAKELOCK is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_DUAL_ROLE_USB_INTF is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +CONFIG_USB_GADGET_DEBUG_FILES=y +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_BDC_UDC is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_DUMMY_HCD is not set +CONFIG_USB_LIBCOMPOSITE=m +CONFIG_USB_F_ACM=m +CONFIG_USB_U_SERIAL=m +CONFIG_USB_F_MASS_STORAGE=m +CONFIG_USB_F_FS=m +CONFIG_USB_CONFIGFS=m +# CONFIG_USB_CONFIGFS_SERIAL is not set +CONFIG_USB_CONFIGFS_ACM=y +# CONFIG_USB_CONFIGFS_OBEX is not set +# CONFIG_USB_CONFIGFS_NCM is not set +# CONFIG_USB_CONFIGFS_ECM is not set +# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set +# CONFIG_USB_CONFIGFS_RNDIS is not set +# CONFIG_USB_CONFIGFS_EEM is not set +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +# CONFIG_USB_CONFIGFS_F_LB_SS is not set +CONFIG_USB_CONFIGFS_F_FS=y +# CONFIG_USB_CONFIGFS_F_MTP is not set +# CONFIG_USB_CONFIGFS_F_ACC is not set +CONFIG_USB_CONFIGFS_UEVENT=y +# CONFIG_USB_CONFIGFS_F_UAC1 is not set +# CONFIG_USB_CONFIGFS_F_UAC2 is not set +# CONFIG_USB_CONFIGFS_F_MIDI is not set +# CONFIG_USB_CONFIGFS_F_HID is not set +# CONFIG_USB_CONFIGFS_F_UVC is not set +# CONFIG_USB_CONFIGFS_F_PRINTER is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set + +# +# ROCKCHIP USB Support +# +# CONFIG_USB20_HOST is not set +# CONFIG_USB20_OTG is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_EMBEDDED_SDIO is not set +# CONFIG_MMC_PARANOID_SD_INIT is not set +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +CONFIG_MMC_TEST=y +# CONFIG_MMC_SIMULATE_MAX_SPEED is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_SPI is not set +CONFIG_MMC_DW=y +CONFIG_MMC_DW_PLTFM=y +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_K3 is not set +CONFIG_MMC_DW_ROCKCHIP=y +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_CLASS_FLASH is not set + +# +# LED drivers +# +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_LEDS_TRIGGER_MULTI_CTRL is not set +# CONFIG_SWITCH is not set +# CONFIG_ACCESSIBILITY is not set +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_FAKE is not set +CONFIG_RTC_DRV_HYM8563=y +# CONFIG_RTC_DRV_MAX6900 is not set +CONFIG_RTC_DRV_RK808=y +# CONFIG_RTC_DRV_RK_TIMER is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_TPS6586X is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_MCP795 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +# CONFIG_AMBA_PL08X is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +CONFIG_PL330_DMA=y +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VFIO is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +# CONFIG_R8712U is not set +# CONFIG_R8188EU is not set +# CONFIG_R8723AU is not set +# CONFIG_VT6656 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16204 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16220 is not set +# CONFIG_ADIS16240 is not set +# CONFIG_LIS3L02DQ is not set +# CONFIG_SCA3000 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7606 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7746 is not set + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16060 is not set + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set +# CONFIG_INV_MPU_IIO is not set + +# +# Light sensors +# +CONFIG_SENSORS_ISL29018=y +# CONFIG_SENSORS_ISL29028 is not set +CONFIG_TSL2583=y +# CONFIG_TSL2x7x is not set + +# +# Magnetometer sensors +# +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set + +# +# Active energy metering IC +# +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set + +# +# Triggers - standalone +# +# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set +# CONFIG_IIO_SIMPLE_DUMMY is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_STAGING_MEDIA is not set + +# +# Android +# +# CONFIG_ASHMEM is not set +# CONFIG_ANDROID_TIMED_OUTPUT is not set +# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set +# CONFIG_SYNC is not set +# CONFIG_ION is not set +# CONFIG_FIQ_DEBUGGER is not set +# CONFIG_FIQ_WATCHDOG is not set +# CONFIG_RK_CONSOLE_THREAD is not set +# CONFIG_STAGING_BOARD is not set +# CONFIG_WIMAX_GDM72XX is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_DGAP is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_FSL_MC_BUS is not set +# CONFIG_WILC1000_DRIVER is not set +# CONFIG_MOST is not set +# CONFIG_POWERVR_ROGUE_N is not set +# CONFIG_GOLDFISH is not set +CONFIG_CHROME_PLATFORMS=y +# CONFIG_CROS_EC_CHARDEV is not set +CONFIG_CROS_EC_PROTO=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_COMMON_CLK_VERSATILE is not set +CONFIG_COMMON_CLK_RK808=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_XGENE is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_CDCE706 is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_ROCKCHIP_TIMER=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_ARCH_TIMER_VCT_ACCESS=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_MAILBOX=y +# CONFIG_ARM_MHU is not set +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set +# CONFIG_MAILBOX_TEST is not set +# CONFIG_RK3368_MBOX is not set +CONFIG_IOMMU_API=y +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_IOVA=y +CONFIG_OF_IOMMU=y +CONFIG_IOMMU_DMA=y +CONFIG_ROCKCHIP_IOMMU=y +# CONFIG_RK_IOMMU is not set +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# + +# +# CPU selection +# +# CONFIG_CPU_PX30 is not set +# CONFIG_CPU_RK1808 is not set +# CONFIG_CPU_RK3308 is not set +CONFIG_CPU_RK3328=y +# CONFIG_CPU_RK3366 is not set +# CONFIG_CPU_RK3368 is not set +# CONFIG_CPU_RK3399 is not set +CONFIG_ANDROID_VERSION=0x07010000 +CONFIG_ROCKCHIP_CPUINFO=y +# CONFIG_ROCKCHIP_DEVICEINFO is not set +CONFIG_ROCKCHIP_OPP=y +# CONFIG_ROCKCHIP_PM_TEST is not set +CONFIG_ROCKCHIP_GRF=y +CONFIG_ROCKCHIP_PM_DOMAINS=y +CONFIG_ROCKCHIP_PVTM=y +CONFIG_ROCKCHIP_SUSPEND_MODE=y +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y + +# +# DEVFREQ Drivers +# +CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y +CONFIG_EXTCON=y + +# +# Extcon Device Drivers +# +# CONFIG_EXTCON_ADC_JACK is not set +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +CONFIG_MEMORY=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 + +# +# Accelerometers +# +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_HI8435 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_NAU7802 is not set +CONFIG_ROCKCHIP_SARADC=y +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_VF610_ADC is not set + +# +# Amplifiers +# +# CONFIG_AD8366 is not set + +# +# Chemical Sensors +# +# CONFIG_VZ89X is not set + +# +# Hid Sensor IIO Common +# + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set + +# +# Digital to analog converters +# +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +# CONFIG_AD9523 is not set + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set + +# +# Humidity sensors +# +# CONFIG_DHT11 is not set +# CONFIG_HDC100X is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_IIO is not set + +# +# Light sensors +# +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_ISL29125 is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_STK3310 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +CONFIG_SENSORS_TSL2563=y +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VL6180 is not set + +# +# Magnetometer sensors +# +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN is not set +# CONFIG_MAG3110 is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set + +# +# Inclinometer sensors +# + +# +# Triggers - standalone +# +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +CONFIG_IIO_SYSFS_TRIGGER=y + +# +# Digital potentiometers +# +# CONFIG_MCP4531 is not set + +# +# Pressure sensors +# +# CONFIG_BMP280 is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set + +# +# Proximity sensors +# +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_SX9500 is not set + +# +# Temperature sensors +# +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_CROS_EC is not set +# CONFIG_PWM_FSL_FTM is not set +CONFIG_PWM_GPIO=y +# CONFIG_PWM_PCA9685 is not set +CONFIG_PWM_ROCKCHIP=y +# CONFIG_PWM_ROCKCHIP_I2S is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V3=y +CONFIG_PARTITION_PERCPU=y +# CONFIG_IPACK_BUS is not set +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set +# CONFIG_PHY_XGENE is not set +CONFIG_PHY_ROCKCHIP_USB=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_INNO_USB3=y +CONFIG_PHY_ROCKCHIP_EMMC=y +CONFIG_PHY_ROCKCHIP_DP=y +# CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY is not set +CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY=y +CONFIG_PHY_ROCKCHIP_TYPEC=y +# CONFIG_PHY_ROCKCHIP_PCIE is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_PMU=y +CONFIG_RAS=y + +# +# Android +# +CONFIG_ANDROID=y +# CONFIG_ANDROID_BINDER_IPC is not set +# CONFIG_LIBNVDIMM is not set +CONFIG_NVMEM=y +CONFIG_ROCKCHIP_EFUSE=y +CONFIG_ROCKCHIP_OTP=y +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set +# CONFIG_TEE is not set +# CONFIG_RK_FLASH is not set +# CONFIG_RK_NAND is not set + +# +# Headset device support +# +# CONFIG_RK_HEADSET is not set + +# +# Firmware Drivers +# +CONFIG_ARM_PSCI_FW=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_HAVE_ARM_SMCCC=y +CONFIG_ROCKCHIP_SIP=y + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +# CONFIG_FS_DAX is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_PROC_UID=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +# CONFIG_SDCARD_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS2_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_BLOCK=m +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_SMB311=y +CONFIG_CIFS_FSCACHE=y +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set +# CONFIG_VIRTUALIZATION is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +# CONFIG_PRINTK_PROCESS is not set +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +# CONFIG_GDB_SCRIPTS is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=2048 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_HAVE_ARCH_KASAN=y +# CONFIG_KASAN is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +CONFIG_HARDLOCKUP_DETECTOR_OTHER_CPU=y +CONFIG_HARDLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1 +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=1 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_INFO=y +# CONFIG_PANIC_ON_RT_THROTTLING is not set +CONFIG_SCHEDSTATS=y +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +CONFIG_TIMER_STATS=y + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +CONFIG_DEBUG_SPINLOCK=y +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_HAVE_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +CONFIG_DEBUG_CREDENTIALS=y + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +CONFIG_BLK_DEV_IO_TRACE=y +# CONFIG_PROBE_EVENTS is not set +CONFIG_DYNAMIC_FTRACE=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_TRACE_ENUM_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y + +# +# Runtime Testing +# +CONFIG_LKDTM=y +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_ARM64_PTDUMP is not set +CONFIG_STRICT_DEVMEM=y +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_DEBUG_SET_MODULE_RONX=y +CONFIG_DEBUG_RODATA=y +# CONFIG_DEBUG_ALIGN_RODATA is not set +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_TRUSTED_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY_PERF_EVENTS_RESTRICT is not set +# CONFIG_SECURITY is not set +CONFIG_SECURITYFS=y +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_TEE_SUPPORT is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set +CONFIG_CRYPTO_ABLK_HELPER=y + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=y +# CONFIG_CRYPTO_ECHAINIV is not set + +# +# Block modes +# +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_HEH is not set +CONFIG_CRYPTO_CTR=y +# CONFIG_CRYPTO_CTS is not set +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_GHASH=y +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SPECK is not set +# CONFIG_CRYPTO_TEA is not set +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_TWOFISH_COMMON=y + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_ZLIB is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_USER_API=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_CCP is not set +# CONFIG_CRYPTO_DEV_ROCKCHIP is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_PUBLIC_KEY_ALGO_RSA=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +CONFIG_ARM64_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_CRYPTO_SHA2_ARM64_CE=y +CONFIG_CRYPTO_GHASH_ARM64_CE=y +# CONFIG_CRYPTO_POLY_HASH_ARM64_CE is not set +CONFIG_CRYPTO_AES_ARM64_CE=y +CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AES_ARM64_CE_BLK=y +# CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set +# CONFIG_CRYPTO_CRC32_ARM64 is not set +# CONFIG_CRYPTO_SPECK_NEON is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +CONFIG_CRC7=y +CONFIG_LIBCRC32C=y +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=m +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=m +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +# CONFIG_XZ_DEC_SPARC is not set +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_CLZ_TAB=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_MPILIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y diff --git a/projects/Rockchip/devices/RK3328/options b/projects/Rockchip/devices/RK3328/options new file mode 100644 index 0000000000..0587e4da82 --- /dev/null +++ b/projects/Rockchip/devices/RK3328/options @@ -0,0 +1,44 @@ +################################################################################ +# setup device defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + aarch64) + TARGET_CPU="cortex-a53" + TARGET_CPU_FLAGS="+crc+crypto" + TARGET_FEATURES="64bit" + ;; + arm) + TARGET_KERNEL_ARCH="arm64" + TARGET_PATCH_ARCH="aarch64" + TARGET_FLOAT="hard" + TARGET_CPU="cortex-a53" + TARGET_CPU_FLAGS="+crc" + TARGET_FPU="crypto-neon-fp-armv8" + TARGET_FEATURES="32bit" + ;; + esac + + # Kernel target + KERNEL_TARGET="Image" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3328-box.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3328-box-trn9.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3328-box-z28.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3328-roc-cc.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3328-rock64.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3328-rockbox.dtb" + + # Mali GPU family + MALI_FAMILY="450" + + # kernel serial console + if [ "$UBOOT_SYSTEM" = "box-trn9" ]; then + EXTRA_CMDLINE="console=tty0" + else + EXTRA_CMDLINE="console=uart8250,mmio32,0xff130000 console=tty0" + fi diff --git a/projects/Rockchip/devices/RK3399/README.md b/projects/Rockchip/devices/RK3399/README.md new file mode 100644 index 0000000000..844c2948c9 --- /dev/null +++ b/projects/Rockchip/devices/RK3399/README.md @@ -0,0 +1,11 @@ +# RK3399 + +This is a SoC device for RK3399 + +**Build** + +* `PROJECT=Rockchip DEVICE=RK3399 ARCH=arm UBOOT_SYSTEM=khadas-edge make image` +* `PROJECT=Rockchip DEVICE=RK3399 ARCH=arm UBOOT_SYSTEM=rock960 make image` +* `PROJECT=Rockchip DEVICE=RK3399 ARCH=arm UBOOT_SYSTEM=rock-pi-4 make image` +* `PROJECT=Rockchip DEVICE=RK3399 ARCH=arm UBOOT_SYSTEM=rockpro64 make image` +* `PROJECT=Rockchip DEVICE=RK3399 ARCH=arm UBOOT_SYSTEM=sapphire make image` diff --git a/projects/Rockchip/devices/RK3399/linux/rockchip-4.4/linux.aarch64.conf b/projects/Rockchip/devices/RK3399/linux/rockchip-4.4/linux.aarch64.conf new file mode 100644 index 0000000000..af126d0491 --- /dev/null +++ b/projects/Rockchip/devices/RK3399/linux/rockchip-4.4/linux.aarch64.conf @@ -0,0 +1,5296 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm64 4.4.154 Kernel Configuration +# +CONFIG_ARM64=y +CONFIG_64BIT=y +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_MMU=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_ARM64_PAGE_SHIFT=12 +CONFIG_ARM64_CONT_SHIFT=4 +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_ZONE_DMA=y +CONFIG_HAVE_GENERIC_RCU_GUP=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_SMP=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +CONFIG_KERNEL_MODE_NEON=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_PGTABLE_LEVELS=3 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y +CONFIG_THREAD_INFO_IN_TASK=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +CONFIG_USELIB=y +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_SCHED_WALT is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +# CONFIG_MEMCG_KMEM is not set +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SCHED_TUNE is not set +# CONFIG_DEFAULT_USE_ENERGY_AWARE is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +CONFIG_RD_XZ=y +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_BPF=y +CONFIG_EXPERT=y +CONFIG_UID16=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_PCI_QUIRKS=y +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y +# CONFIG_KPROBES is not set +# CONFIG_JUMP_LABEL is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_RCU_TABLE_FREE=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_ARCH_HUGE_VMAP=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +CONFIG_BLK_DEV_THROTTLING=y +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_RK_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set +CONFIG_BLOCK_COMPAT=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +CONFIG_CFQ_GROUP_IOSCHED=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_ASN1=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# Platform selection +# +# CONFIG_ARCH_BCM_IPROC is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_EXYNOS7 is not set +# CONFIG_ARCH_LAYERSCAPE is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_MEDIATEK is not set +# CONFIG_ARCH_QCOM is not set +CONFIG_ARCH_ROCKCHIP=y +# CONFIG_ARCH_SEATTLE is not set +# CONFIG_ARCH_STRATIX10 is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_SPRD is not set +# CONFIG_ARCH_THUNDER is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_XGENE is not set +# CONFIG_ARCH_ZYNQMP is not set + +# +# Bus support +# +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_SYSCALL=y +CONFIG_PCI_BUS_ADDR_T_64BIT=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +# CONFIG_PCI_DEBUG is not set +# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set +# CONFIG_PCI_STUB is not set +# CONFIG_PCI_IOV is not set +# CONFIG_PCI_PRI is not set +# CONFIG_PCI_PASID is not set + +# +# PCI host controller drivers +# +# CONFIG_PCI_HOST_GENERIC is not set +# CONFIG_PCIE_IPROC is not set +# CONFIG_PCI_HISI is not set +CONFIG_PCIE_ROCKCHIP=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIEAER=y +# CONFIG_PCIE_ECRC is not set +# CONFIG_PCIEAER_INJECT is not set +CONFIG_PCIEASPM=y +# CONFIG_PCIEASPM_DEBUG is not set +# CONFIG_PCIEASPM_DEFAULT is not set +CONFIG_PCIEASPM_POWERSAVE=y +# CONFIG_PCIEASPM_PERFORMANCE is not set +CONFIG_PCIE_PME=y +# CONFIG_HOTPLUG_PCI is not set + +# +# Kernel Features +# + +# +# ARM errata workarounds via the alternatives framework +# +CONFIG_ARM64_ERRATUM_826319=y +CONFIG_ARM64_ERRATUM_827319=y +CONFIG_ARM64_ERRATUM_824069=y +CONFIG_ARM64_ERRATUM_819472=y +# CONFIG_ARM64_ERRATUM_832075 is not set +CONFIG_ARM64_ERRATUM_845719=y +CONFIG_ARM64_ERRATUM_843419=y +# CONFIG_ARM64_ERRATUM_1024718 is not set +# CONFIG_CAVIUM_ERRATUM_22375 is not set +# CONFIG_CAVIUM_ERRATUM_23154 is not set +# CONFIG_CAVIUM_ERRATUM_27456 is not set +CONFIG_ARM64_4K_PAGES=y +# CONFIG_ARM64_16K_PAGES is not set +# CONFIG_ARM64_64K_PAGES is not set +CONFIG_ARM64_VA_BITS_39=y +# CONFIG_ARM64_VA_BITS_48 is not set +CONFIG_ARM64_VA_BITS=39 +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_SCHED_MC=y +# CONFIG_SCHED_SMT is not set +CONFIG_NR_CPUS=6 +CONFIG_HOTPLUG_CPU=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +# CONFIG_HZ_100 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_COMPACTION is not set +CONFIG_MIGRATION=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_BOUNCE=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +# CONFIG_TRANSPARENT_HUGEPAGE is not set +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_DEBUGFS=y +CONFIG_CMA_AREAS=7 +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +CONFIG_ZSMALLOC=m +CONFIG_PGTABLE_MAPPING=y +# CONFIG_ZSMALLOC_STAT is not set +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_SECCOMP=y +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +# CONFIG_XEN is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_UNMAP_KERNEL_AT_EL0=y +# CONFIG_ARMV8_DEPRECATED is not set +# CONFIG_ARM64_SW_TTBR0_PAN is not set + +# +# ARMv8.1 architectural features +# +CONFIG_ARM64_HW_AFDBM=y +CONFIG_ARM64_PAN=y +# CONFIG_ARM64_LSE_ATOMICS is not set +CONFIG_ARM64_UAO=y +CONFIG_ARM64_MODULE_CMODEL_LARGE=y +# CONFIG_RANDOMIZE_BASE is not set + +# +# Boot options +# +CONFIG_CMDLINE="usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_EFI is not set +# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y +CONFIG_COMPAT=y +CONFIG_SYSVIPC_COMPAT=y +CONFIG_KEYS_COMPAT=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +CONFIG_HAS_WAKELOCK=y +CONFIG_WAKELOCK=y +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_ADVANCED_DEBUG=y +# CONFIG_PM_TEST_SUSPEND is not set +CONFIG_PM_SLEEP_DEBUG=y +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y + +# +# CPU Power Management +# + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_DT_IDLE_STATES=y + +# +# ARM CPU Idle Drivers +# +CONFIG_ARM_CPUIDLE=y +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_TIMES=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y + +# +# CPU frequency scaling drivers +# +CONFIG_CPUFREQ_DT=y +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARM_ROCKCHIP_CPUFREQ=y +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +CONFIG_NET_UDP_TUNNEL=m +# CONFIG_NET_FOU is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_IPV6_SIT is not set +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_ANDROID_PARANOID_NETWORK is not set +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +CONFIG_NF_LOG_COMMON=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +# CONFIG_NF_CONNTRACK_IRC is not set +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CT_NETLINK is not set +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +# CONFIG_NF_NAT_IRC is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_DEFRAG_IPV6 is not set +# CONFIG_NF_CONNTRACK_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +# CONFIG_NF_REJECT_IPV6 is not set +CONFIG_NF_LOG_IPV6=m +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=y +# CONFIG_BT_RFCOMM_TTY is not set +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_SELFTEST is not set +CONFIG_BT_DEBUGFS=y + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=y +CONFIG_BT_BCM=y +CONFIG_BT_RTL=y +# CONFIG_BT_RTKBTUSB is not set +CONFIG_BT_HCIBTUSB=y +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +CONFIG_BT_HCIBTSDIO=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +# CONFIG_BT_HCIUART_BCM is not set +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=y +CONFIG_BT_HCIVHCI=y +CONFIG_BT_MRVL=y +CONFIG_BT_MRVL_SDIO=y +# CONFIG_BT_ATH3K is not set +# CONFIG_AF_RXRPC is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=y +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=y +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +CONFIG_MAC80211_DEBUGFS=y +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_PM=y +CONFIG_RFKILL_LEDS=y +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL_REGULATOR is not set +CONFIG_RFKILL_GPIO=y +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_EBPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y +# CONFIG_TEGRA_AHB is not set + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_WANT_DEV_COREDUMP=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +CONFIG_DEBUG_DEVRES=y +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=64 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_ARM_CCI400_PMU is not set +# CONFIG_ARM_CCI500_PMU is not set +# CONFIG_ARM_CCN is not set +# CONFIG_VEXPRESS_CONFIG is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +# CONFIG_MTD_BLOCK is not set +# CONFIG_MTD_BLOCK_RO is not set +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_SWAP is not set +# CONFIG_MTD_PARTITIONED_MASTER is not set + +# +# RAM/ROM/Flash chip drivers +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_INTEL_VR_NOR is not set +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_DATAFLASH is not set +CONFIG_MTD_M25P80=y +# CONFIG_MTD_SST25L is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +# CONFIG_MTD_NAND_IDS is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR & LPDDR2 PCM memory drivers +# +# CONFIG_MTD_LPDDR is not set +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +# CONFIG_MTD_UBI is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set +CONFIG_ZRAM=m +CONFIG_ZRAM_LZ4_COMPRESS=y +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_SKD is not set +# CONFIG_BLK_DEV_SX8 is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=1 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_BLK_DEV_RBD is not set +# CONFIG_BLK_DEV_RSXX is not set +CONFIG_BLK_DEV_NVME=y + +# +# Misc devices +# +CONFIG_ROCKCHIP_SCR=y +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_PHANTOM is not set +# CONFIG_SGI_IOC4 is not set +# CONFIG_TIFM_CORE is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_HP_ILO is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +CONFIG_SRAM=y +# CONFIG_MEMORY_STATE_TIME is not set +# CONFIG_USB_CAM_GPIO is not set +# CONFIG_GPIO_DET is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_CB710_CORE is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +CONFIG_ALTERA_STAPL=m + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# +# CONFIG_GENWQE is not set +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_CXGB4_ISCSI is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +# CONFIG_BE2ISCSI is not set +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_SCSI_HPSA is not set +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_3W_SAS is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC94XX is not set +# CONFIG_SCSI_MVSAS is not set +# CONFIG_SCSI_MVUMI is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_ESAS2R is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_LEGACY is not set +# CONFIG_MEGARAID_SAS is not set +# CONFIG_SCSI_MPT3SAS is not set +# CONFIG_SCSI_MPT2SAS is not set +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_HPTIOP is not set +# CONFIG_SCSI_SNIC is not set +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_IPS is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_STEX is not set +# CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_QLA_ISCSI is not set +# CONFIG_SCSI_DC395x is not set +# CONFIG_SCSI_AM53C974 is not set +# CONFIG_SCSI_WD719X is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_PMCRAID is not set +# CONFIG_SCSI_PM8001 is not set +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_HAVE_PATA_PLATFORM=y +# CONFIG_ATA is not set +CONFIG_MD=y +# CONFIG_BLK_DEV_MD is not set +# CONFIG_BCACHE is not set +CONFIG_BLK_DEV_DM_BUILTIN=y +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_MQ_DEFAULT is not set +# CONFIG_DM_DEBUG is not set +CONFIG_DM_BUFIO=m +CONFIG_DM_BIO_PRISON=m +CONFIG_DM_PERSISTENT_DATA=m +# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set +# CONFIG_DM_CRYPT is not set +# CONFIG_DM_SNAPSHOT is not set +CONFIG_DM_THIN_PROVISIONING=m +# CONFIG_DM_CACHE is not set +# CONFIG_DM_ERA is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_RAID is not set +# CONFIG_DM_ZERO is not set +# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_DELAY is not set +# CONFIG_DM_UEVENT is not set +# CONFIG_DM_FLAKEY is not set +# CONFIG_DM_VERITY is not set +# CONFIG_DM_VERITY_HASH_PREFETCH_MIN_SIZE_128 is not set +# CONFIG_DM_SWITCH is not set +# CONFIG_DM_LOG_WRITES is not set +# CONFIG_TARGET_CORE is not set +# CONFIG_FUSION is not set + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_FIREWIRE is not set +# CONFIG_FIREWIRE_NOSY is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +CONFIG_DUMMY=m +# CONFIG_EQUALIZER is not set +# CONFIG_NET_FC is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +CONFIG_VXLAN=m +# CONFIG_GENEVE is not set +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=m +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set +# CONFIG_ARCNET is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +CONFIG_ETHERNET=y +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_NET_VENDOR_ADAPTEC is not set +# CONFIG_NET_VENDOR_AGERE is not set +# CONFIG_NET_VENDOR_ALTEON is not set +# CONFIG_ALTERA_TSE is not set +# CONFIG_NET_VENDOR_AMD is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_ATHEROS is not set +# CONFIG_NET_VENDOR_AURORA is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_BROCADE is not set +# CONFIG_NET_VENDOR_CAVIUM is not set +# CONFIG_NET_VENDOR_CHELSIO is not set +# CONFIG_NET_VENDOR_CISCO is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_DEC is not set +# CONFIG_NET_VENDOR_DLINK is not set +# CONFIG_NET_VENDOR_EMULEX is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_EXAR is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_HP is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_JME is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MELLANOX is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_MYRI is not set +# CONFIG_FEALNX is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NVIDIA is not set +# CONFIG_NET_VENDOR_OKI is not set +# CONFIG_ETHOC is not set +# CONFIG_NET_PACKET_ENGINE is not set +# CONFIG_NET_VENDOR_QLOGIC is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_REALTEK is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_RDC is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SILAN is not set +# CONFIG_NET_VENDOR_SIS is not set +# CONFIG_SFC is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_DWMAC_GENERIC=y +# CONFIG_DWMAC_IPQ806X is not set +# CONFIG_DWMAC_LPC18XX is not set +# CONFIG_DWMAC_MESON is not set +CONFIG_DWMAC_ROCKCHIP=y +# CONFIG_DWMAC_SOCFPGA is not set +# CONFIG_DWMAC_STI is not set +# CONFIG_DWMAC_SUNXI is not set +# CONFIG_STMMAC_PCI is not set +# CONFIG_NET_VENDOR_SUN is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_TEHUTI is not set +# CONFIG_NET_VENDOR_TI is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +CONFIG_ROCKCHIP_PHY=y +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_OCTEON is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MICREL_KS8995MA is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=y +CONFIG_USB_NET_AX88179_178A=y +CONFIG_USB_NET_CDCETHER=y +# CONFIG_USB_NET_CDC_EEM is not set +CONFIG_USB_NET_CDC_NCM=y +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +CONFIG_USB_NET_CDC_MBIM=y +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +# CONFIG_USB_NET_SMSC75XX is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_MCS7830 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_LIBERTAS_THINFIRM=y +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +# CONFIG_LIBERTAS_THINFIRM_USB is not set +# CONFIG_ATMEL is not set +# CONFIG_AT76C50X_USB is not set +# CONFIG_PRISM54 is not set +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=y +# CONFIG_ADM8211 is not set +# CONFIG_RTL8180 is not set +CONFIG_RTL8187=m +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_MWL8K is not set +# CONFIG_ATH_CARDS is not set +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCMFMAC_PCIE is not set +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +# CONFIG_HOSTAP is not set +# CONFIG_IPW2100 is not set +# CONFIG_IPW2200 is not set +# CONFIG_IWLWIFI is not set +# CONFIG_IWL4965 is not set +# CONFIG_IWL3945 is not set +# CONFIG_LIBERTAS is not set +# CONFIG_HERMES is not set +# CONFIG_P54_COMMON is not set +CONFIG_RT2X00=m +# CONFIG_RT2400PCI is not set +# CONFIG_RT2500PCI is not set +# CONFIG_RT61PCI is not set +# CONFIG_RT2800PCI is not set +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_LIB_DEBUGFS is not set +# CONFIG_RT2X00_DEBUG is not set +# CONFIG_WL_MEDIATEK is not set +# CONFIG_RTL_CARDS is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WL_ROCKCHIP=y +CONFIG_WIFI_BUILD_MODULE=y +# CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP is not set +# CONFIG_WIFI_GENERATE_RANDOM_MAC_ADDR is not set +CONFIG_AP6XXX=m +# CONFIG_CYW_BCMDHD is not set +CONFIG_RTL_WIRELESS_SOLUTION=y +# CONFIG_RTL8188EU is not set +# CONFIG_RTL8188FU is not set +# CONFIG_RTL8189ES is not set +# CONFIG_RTL8189FS is not set +CONFIG_RTL8723BS=m +# CONFIG_RTL8723BU is not set +# CONFIG_RTL8723CS is not set +# CONFIG_RTL8723DS is not set +# CONFIG_RTL8822BE is not set +# CONFIG_MVL88W8977 is not set + +# +# SouthSV 6XXX WLAN support +# +# CONFIG_SSV6051 is not set +# CONFIG_WL_TI is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MWIFIEX is not set +# CONFIG_CW1200 is not set +# CONFIG_RSI_91X is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_VMXNET3 is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_INPUT_SPARSEKMAP is not set +CONFIG_INPUT_MATRIXKMAP=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KEYRESET is not set +# CONFIG_INPUT_KEYCOMBO is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADC is not set +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_ROCKCHIP is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_KEYBOARD_CROS_EC=y +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +# CONFIG_MOUSE_PS2 is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +CONFIG_MOUSE_CYAPA=y +CONFIG_MOUSE_ELAN_I2C=y +CONFIG_MOUSE_ELAN_I2C_I2C=y +# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +CONFIG_JOYSTICK_IFORCE=y +CONFIG_JOYSTICK_IFORCE_USB=y +# CONFIG_JOYSTICK_IFORCE_232 is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_INPUT_TABLET=y +# CONFIG_TABLET_USB_ACECAD is not set +# CONFIG_TABLET_USB_AIPTEK is not set +# CONFIG_TABLET_USB_GTCO is not set +# CONFIG_TABLET_USB_HANWANG is not set +# CONFIG_TABLET_USB_KBTAB is not set +# CONFIG_TABLET_SERIAL_WACOM4 is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +CONFIG_TOUCHSCREEN_ATMEL_MXT=y +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8C40XX is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX is not set +# CONFIG_TOUCHSCREEN_FT6236 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_GSLX680A is not set +# CONFIG_TOUCHSCREEN_GSLX680_D708 is not set +# CONFIG_TOUCHSCREEN_GSLX680_PAD is not set +# CONFIG_TOUCHSCREEN_GSLX680_VR is not set +# CONFIG_TOUCHSCREEN_GSLX680_FIREFLY is not set +# CONFIG_TOUCHSCREEN_GSL3673 is not set +# CONFIG_TOUCHSCREEN_GSL3673_800X1280 is not set +# CONFIG_TOUCHSCREEN_GT9XX is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +CONFIG_TOUCHSCREEN_ELAN=y +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=y +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_ST1232 is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +# CONFIG_TOUCHSCREEN_VTL_CT36X is not set +# CONFIG_TOUCHSCREEN_GT1X is not set +# CONFIG_ROCKCHIP_REMOTECTL is not set + +# +# handle all sensors +# +# CONFIG_SENSOR_DEVICE is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYCHORD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_RK8XX_PWRKEY=y +CONFIG_INPUT_UINPUT=y +CONFIG_INPUT_GPIO=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +# CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_RAW=y +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_NOZOMI is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +# CONFIG_SERIAL_8250_PCI is not set +CONFIG_SERIAL_8250_NR_UARTS=5 +CONFIG_SERIAL_8250_RUNTIME_UARTS=5 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +# CONFIG_SERIAL_8250_SHARE_IRQ is not set +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_INGENIC is not set +# CONFIG_SERIAL_8250_MID is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_JSM is not set +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_RP2 is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_TPM=y +# CONFIG_HW_RANDOM_ROCKCHIP is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# PCMCIA character devices +# +# CONFIG_RAW_DRIVER is not set +CONFIG_TCG_TPM=y +# CONFIG_TCG_TIS_I2C_ATMEL is not set +CONFIG_TCG_TIS_I2C_INFINEON=y +# CONFIG_TCG_TIS_I2C_NUVOTON is not set +# CONFIG_TCG_ATMEL is not set +# CONFIG_TCG_TIS_ST33ZP24 is not set +CONFIG_DEVPORT=y +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# PC SMBus host controller drivers +# +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_ISCH is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CADENCE is not set +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_DESIGNWARE_PCI is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +CONFIG_I2C_RK3X=y +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +CONFIG_I2C_CROS_EC_TUNNEL=y +CONFIG_I2C_STUB=m +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX is not set +# CONFIG_SPI_PXA2XX_PCI is not set +CONFIG_SPI_ROCKCHIP=y +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PINCTRL_RK805 is not set +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +CONFIG_DEBUG_GPIO=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_DWAPB is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_VX855 is not set +# CONFIG_GPIO_XGENE is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set + +# +# MFD GPIO expanders +# +CONFIG_GPIO_RK8XX=y +# CONFIG_GPIO_TPS6586X is not set + +# +# PCI GPIO expanders +# +# CONFIG_GPIO_AMD8111 is not set +# CONFIG_GPIO_BT8XX is not set +# CONFIG_GPIO_ML_IOH is not set +# CONFIG_GPIO_RDC321X is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +CONFIG_BATTERY_SBS=y +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_ISP1704 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +CONFIG_CHARGER_GPIO=y +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +CONFIG_CHARGER_BQ24735=y +# CONFIG_CHARGER_BQ25700 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_CHARGER_SY6982C is not set +# CONFIG_CHARGER_UNIVERSAL is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_BATTERY_EC is not set +# CONFIG_BATTERY_CW2015 is not set +# CONFIG_BATTERY_RK816 is not set +# CONFIG_BATTERY_RK817 is not set +# CONFIG_CHARGER_RK817 is not set +# CONFIG_BATTERY_RK818 is not set +# CONFIG_CHARGER_RK818 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +# CONFIG_POWER_RESET_RESTART is not set +# CONFIG_POWER_RESET_XGENE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +CONFIG_REBOOT_MODE=y +CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_POWER_AVS=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_I5K_AMB is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y +CONFIG_CPU_THERMAL=y +# CONFIG_CLOCK_THERMAL is not set +CONFIG_DEVFREQ_THERMAL=y +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_IMX_THERMAL is not set +CONFIG_ROCKCHIP_THERMAL=y +CONFIG_RK_VIRTUAL_THERMAL=y +# CONFIG_RK3368_THERMAL is not set +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_CORE is not set +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +CONFIG_DW_WATCHDOG=y +# CONFIG_MAX63XX_WATCHDOG is not set +# CONFIG_ALIM7101_WDT is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_BCM7038_WDT is not set +# CONFIG_MEN_A21_WDT is not set + +# +# PCI-based Watchdog Cards +# +# CONFIG_PCIPCWATCHDOG is not set +# CONFIG_WDTPCI is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X is not set +CONFIG_MFD_CROS_EC=y +# CONFIG_MFD_CROS_EC_I2C is not set +CONFIG_MFD_CROS_EC_SPI=y +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_LPC_ICH is not set +# CONFIG_LPC_SCH is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_JANZ_CMODIO is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_RDC321X is not set +# CONFIG_MFD_RTSX_PCI is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK618 is not set +CONFIG_MFD_RK808=y +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +CONFIG_MFD_TPS6586X=y +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_VX855 is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_RK1000 is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +CONFIG_FUSB_30X=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_DEBUG=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +CONFIG_REGULATOR_ACT8865=y +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +CONFIG_REGULATOR_FAN53555=y +CONFIG_REGULATOR_GPIO=y +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +CONFIG_REGULATOR_LP8752=y +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +CONFIG_REGULATOR_MP8865=y +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_RK808=y +CONFIG_REGULATOR_RK818=y +# CONFIG_REGULATOR_SYR82X is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS549B22 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +CONFIG_REGULATOR_TPS6586X=y +CONFIG_REGULATOR_XZ3216=y +CONFIG_CEC_CORE=y +CONFIG_CEC_NOTIFIER=y +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_DMA_SG=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_VIDEOBUF2_DMA_SG=m +CONFIG_VIDEOBUF2_DVB=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=32 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_HIX5HD2=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_FRIIO=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_DVB_TTUSB_BUDGET=m +CONFIG_DVB_TTUSB_DEC=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# USB HDMI CEC adapters +# +CONFIG_USB_PULSE8_CEC=m +CONFIG_USB_RAINSHADOW_CEC=m +CONFIG_MEDIA_PCI_SUPPORT=y + +# +# Media capture support +# +# CONFIG_VIDEO_SOLO6X10 is not set +# CONFIG_VIDEO_TW68 is not set + +# +# Media capture/analog TV support +# +# CONFIG_VIDEO_IVTV is not set +# CONFIG_VIDEO_HEXIUM_GEMINI is not set +# CONFIG_VIDEO_HEXIUM_ORION is not set +# CONFIG_VIDEO_MXB is not set +# CONFIG_VIDEO_DT3155 is not set + +# +# Media capture/analog/hybrid TV support +# +CONFIG_VIDEO_CX18=m +# CONFIG_VIDEO_CX18_ALSA is not set +CONFIG_VIDEO_CX23885=m +CONFIG_MEDIA_ALTERA_CI=m +CONFIG_VIDEO_CX25821=m +# CONFIG_VIDEO_CX25821_ALSA is not set +CONFIG_VIDEO_CX88=m +# CONFIG_VIDEO_CX88_ALSA is not set +# CONFIG_VIDEO_CX88_BLACKBIRD is not set +CONFIG_VIDEO_CX88_DVB=m +CONFIG_VIDEO_CX88_ENABLE_VP3054=y +CONFIG_VIDEO_CX88_VP3054=m +CONFIG_VIDEO_CX88_MPEG=m +CONFIG_VIDEO_SAA7134=m +# CONFIG_VIDEO_SAA7134_ALSA is not set +CONFIG_VIDEO_SAA7134_RC=y +CONFIG_VIDEO_SAA7134_DVB=m +CONFIG_VIDEO_SAA7164=m + +# +# Media digital TV PCI Adapters +# +CONFIG_DVB_AV7110_IR=y +CONFIG_DVB_AV7110=m +CONFIG_DVB_AV7110_OSD=y +CONFIG_DVB_BUDGET_CORE=m +CONFIG_DVB_BUDGET=m +CONFIG_DVB_BUDGET_CI=m +CONFIG_DVB_BUDGET_AV=m +CONFIG_DVB_BUDGET_PATCH=m +CONFIG_DVB_B2C2_FLEXCOP_PCI=m +# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set +# CONFIG_DVB_PLUTO2 is not set +CONFIG_DVB_DM1105=m +CONFIG_DVB_PT1=m +CONFIG_DVB_PT3=m +CONFIG_MANTIS_CORE=m +CONFIG_DVB_MANTIS=m +CONFIG_DVB_HOPPER=m +CONFIG_DVB_NGENE=m +CONFIG_DVB_DDBRIDGE=m +CONFIG_DVB_SMIPCIE=m +CONFIG_DVB_NETUP_UNIDVB=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set +# CONFIG_ROCKCHIP_TSP is not set + +# +# Supported MMC/SDIO adapters +# +# CONFIG_SMS_SDIO_DRV is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_VIDEO_SAA7146=m +CONFIG_VIDEO_SAA7146_VV=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS5345=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# +CONFIG_VIDEO_SAA6588=m + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Camera lens devices +# + +# +# Audio/Video compression chips +# +CONFIG_VIDEO_SAA6752HS=m + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_MT2131=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_M88RS6000T=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_MXL301RF=m +CONFIG_MEDIA_TUNER_QM1D1C0042=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10036=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA8083=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TDA8261=m +CONFIG_DVB_VES1X93=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_TUA6100=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24117=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_MB86A16=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_SP8870=m +CONFIG_DVB_CX22700=m +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_L64781=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_STV0367=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_CXD2841ER=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_VES1820=m +CONFIG_DVB_TDA10021=m +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_OR51132=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# +CONFIG_DVB_TC90522=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBH25=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6405=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_TDA665x=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m +CONFIG_DVB_HORUS3A=m +CONFIG_DVB_ASCOT2E=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set +# CONFIG_CAMSYS_DRV is not set +# CONFIG_ROCK_CHIP_SOC_CAMERA is not set + +# +# Graphics support +# +# CONFIG_VGA_ARB is not set +CONFIG_DRM=y +CONFIG_DRM_IGNORE_IOTCL_PERMIT=y +CONFIG_DRM_MIPI_DSI=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_FBDEV_EMULATION=y +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set +# CONFIG_DRM_SCDC_HELPER is not set +# CONFIG_DRM_DMA_SYNC is not set + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_TDFX is not set +# CONFIG_DRM_R128 is not set +# CONFIG_DRM_RADEON is not set +# CONFIG_DRM_AMDGPU is not set +# CONFIG_DRM_NOUVEAU is not set +# CONFIG_DRM_MGA is not set +# CONFIG_DRM_VIA is not set +# CONFIG_DRM_SAVAGE is not set +# CONFIG_DRM_VGEM is not set +CONFIG_DRM_ROCKCHIP=y +# CONFIG_ROCKCHIP_DRM_DEBUG is not set +CONFIG_ROCKCHIP_CDN_DP=y +CONFIG_ROCKCHIP_DW_HDMI=y +CONFIG_ROCKCHIP_DW_MIPI_DSI=y +CONFIG_ROCKCHIP_MIPI_CSI_TX=y +CONFIG_ROCKCHIP_ANALOGIX_DP=y +CONFIG_ROCKCHIP_INNO_HDMI=y +CONFIG_ROCKCHIP_LVDS=y +CONFIG_ROCKCHIP_DRM_TVE=y +# CONFIG_ROCKCHIP_RGB is not set +# CONFIG_ROCKCHIP_DRM_BACKLIGHT is not set +# CONFIG_ROCKCHIP_RK3066_HDMI is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_AST is not set +# CONFIG_DRM_MGAG200 is not set +# CONFIG_DRM_CIRRUS_QEMU is not set +# CONFIG_DRM_QXL is not set +# CONFIG_DRM_BOCHS is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +CONFIG_DRM_PANEL_SIMPLE=y +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +CONFIG_DRM_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_RK1000 is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LONTIUM_LT8912 is not set +CONFIG_DRM_ANALOGIX_DP=y +CONFIG_DRM_DW_HDMI=y +# CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set +CONFIG_DRM_DW_HDMI_I2S_AUDIO=y +CONFIG_DRM_DW_HDMI_CEC=y +# CONFIG_POWERVR_ROGUE_M is not set +# CONFIG_MALI400 is not set +CONFIG_MALI_DEVFREQ=y +CONFIG_MALI_MIDGARD=m +# CONFIG_MALI_GATOR_SUPPORT is not set +# CONFIG_MALI_MIDGARD_ENABLE_TRACE is not set +# CONFIG_MALI_DMA_FENCE is not set +CONFIG_MALI_EXPERT=y +# CONFIG_MALI_CORESTACK is not set +# CONFIG_MALI_PRFCNT_SET_SECONDARY is not set +# CONFIG_MALI_PLATFORM_FAKE is not set +# CONFIG_MALI_PLATFORM_DEVICETREE is not set +CONFIG_MALI_PLATFORM_THIRDPARTY=y +CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="rk" +# CONFIG_MALI_DEBUG is not set +# CONFIG_MALI_NO_MALI is not set +# CONFIG_MALI_TRACE_TIMELINE is not set +# CONFIG_MALI_SYSTEM_TRACE is not set +# CONFIG_MALI_GPU_MMU_AARCH64 is not set +CONFIG_MALI_PWRSOFT_765=y +# CONFIG_MALI_KUTF is not set +# CONFIG_MALI_BIFROST_FOR_ANDROID is not set +CONFIG_MALI_BIFROST_FOR_LINUX=y +# CONFIG_MALI_BIFROST is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_I740 is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_FB_SM712 is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +CONFIG_BACKLIGHT_PWM=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set + +# +# Rockchip Misc Video driver +# +# CONFIG_FB_ROCKCHIP is not set +# CONFIG_LCDC_RK3368 is not set +CONFIG_LCD_GENERAL=y +# CONFIG_LCD_MIPI is not set +# CONFIG_RK_TRSM is not set +# CONFIG_RK_HDMI is not set + +# +# RGA +# +# CONFIG_ROCKCHIP_RGA is not set + +# +# RGA2 +# +# CONFIG_ROCKCHIP_RGA2 is not set + +# +# VCODEC +# +CONFIG_RK_VCODEC=y + +# +# IEP +# +CONFIG_IEP=y +# CONFIG_IEP_MMU is not set + +# +# DP +# + +# +# ROCKCHIP_MPP +# +CONFIG_ROCKCHIP_MPP_SERVICE=y +CONFIG_ROCKCHIP_MPP_DEVICE=y +# CONFIG_VGASTATE is not set +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_HDMI=y +CONFIG_HDMI_NOTIFIERS=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_PCM_ELD=y +CONFIG_SND_PCM_IEC958=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +CONFIG_SND_SEQUENCER=y +CONFIG_SND_SEQ_DUMMY=y +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_SEQUENCER_OSS is not set +CONFIG_SND_HRTIMER=y +CONFIG_SND_SEQ_HRTIMER_DEFAULT=y +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_PROC_FS is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +CONFIG_SND_RAWMIDI_SEQ=m +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_VIRMIDI is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_AC97_POWER_SAVE is not set +# CONFIG_SND_PCI is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +# CONFIG_SND_SPI is not set +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_USB_UA101 is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_6FIRE is not set +# CONFIG_SND_USB_HIFACE is not set +# CONFIG_SND_BCD2000 is not set +# CONFIG_SND_USB_POD is not set +# CONFIG_SND_USB_PODHD is not set +# CONFIG_SND_USB_TONEPORT is not set +# CONFIG_SND_USB_VARIAX is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +CONFIG_SND_SOC_ROCKCHIP=y +# CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM is not set +CONFIG_SND_SOC_ROCKCHIP_I2S=y +# CONFIG_SND_SOC_ROCKCHIP_I2S_TDM is not set +# CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS is not set +# CONFIG_SND_SOC_ROCKCHIP_PDM is not set +CONFIG_SND_SOC_ROCKCHIP_SPDIF=y +# CONFIG_SND_SOC_ROCKCHIP_SPDIFRX is not set +# CONFIG_SND_SOC_ROCKCHIP_VAD is not set +# CONFIG_SND_SOC_ROCKCHIP_DA7219 is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_DP is not set +CONFIG_SND_SOC_ROCKCHIP_MAX98090=y +# CONFIG_SND_SOC_ROCKCHIP_MULTICODECS is not set +CONFIG_SND_SOC_ROCKCHIP_RT5645=y +# CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749 is not set +# CONFIG_SND_SOC_ROCKCHIP_CDNDP is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CX2072X is not set +# CONFIG_SND_SOC_CX20810 is not set +# CONFIG_SND_SOC_DUMMY_CODEC is not set +# CONFIG_SND_SOC_BT_SCO is not set +CONFIG_SND_SOC_ES8316=y +# CONFIG_SND_SOC_ES8323 is not set +CONFIG_SND_SOC_HDMI_CODEC=y +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8396 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_GVA_CODEC is not set +# CONFIG_SND_SOC_FM1288 is not set +CONFIG_SND_SOC_MAX98090=y +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RK312X is not set +# CONFIG_SND_SOC_RK3228 is not set +# CONFIG_SND_SOC_RK3308 is not set +# CONFIG_SND_SOC_RK3328 is not set +# CONFIG_SND_SOC_RK817 is not set +CONFIG_SND_SOC_RL6231=y +CONFIG_SND_SOC_RT5616=y +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_RT5640=y +CONFIG_SND_SOC_RT5645=y +CONFIG_SND_SOC_RT5651=y +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=y +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TC358749X is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +CONFIG_SND_SOC_TS3A227E=y +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +CONFIG_SND_SIMPLE_CARD=y +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_RKVR is not set +# CONFIG_HID_ALPS is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +CONFIG_I2C_HID=y +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +# CONFIG_USB_DEFAULT_PERSIST is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +CONFIG_USB_OTG=y +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=y +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_PCI=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +CONFIG_USB_OHCI_HCD=y +# CONFIG_USB_OHCI_HCD_PCI is not set +CONFIG_USB_OHCI_HCD_PLATFORM=y +# CONFIG_USB_UHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=y +# CONFIG_USB_PRINTER is not set +CONFIG_USB_WDM=y +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +CONFIG_USB_UAS=y + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_HOST is not set +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_DWC3_DUAL_ROLE=y + +# +# Platform Glue Driver Support +# +# CONFIG_USB_DWC3_PCI is not set +CONFIG_USB_DWC3_OF_SIMPLE=y +CONFIG_USB_DWC3_ROCKCHIP=y +CONFIG_USB_DWC3_ROCKCHIP_INNO=y +CONFIG_USB_DWC2=y +# CONFIG_USB_DWC2_HOST is not set + +# +# Gadget/Dual-role mode requires USB Gadget support to be enabled +# +# CONFIG_USB_DWC2_PERIPHERAL is not set +CONFIG_USB_DWC2_DUAL_ROLE=y +# CONFIG_USB_DWC2_PCI is not set +# CONFIG_USB_DWC2_DEBUG is not set +# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +# CONFIG_USB_SERIAL_CONSOLE is not set +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=y +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=y +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +CONFIG_USB_SERIAL_KEYSPAN=y +# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=y +CONFIG_USB_SERIAL_OTI6858=y +# CONFIG_USB_SERIAL_QCAUX is not set +CONFIG_USB_SERIAL_QUALCOMM=y +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +CONFIG_USB_SERIAL_WWAN=y +CONFIG_USB_SERIAL_OPTION=y +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +CONFIG_USB_EZUSB_FX2=y +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +# CONFIG_USB_OTG_WAKELOCK is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_DUAL_ROLE_USB_INTF is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +CONFIG_USB_GADGET_DEBUG_FILES=y +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_BDC_UDC is not set +# CONFIG_USB_AMD5536UDC is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_NET2280 is not set +# CONFIG_USB_GOKU is not set +# CONFIG_USB_EG20T is not set +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_DUMMY_HCD is not set +CONFIG_USB_LIBCOMPOSITE=m +CONFIG_USB_F_ACM=m +CONFIG_USB_U_SERIAL=m +CONFIG_USB_F_MASS_STORAGE=m +CONFIG_USB_F_FS=m +CONFIG_USB_CONFIGFS=m +# CONFIG_USB_CONFIGFS_SERIAL is not set +CONFIG_USB_CONFIGFS_ACM=y +# CONFIG_USB_CONFIGFS_OBEX is not set +# CONFIG_USB_CONFIGFS_NCM is not set +# CONFIG_USB_CONFIGFS_ECM is not set +# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set +# CONFIG_USB_CONFIGFS_RNDIS is not set +# CONFIG_USB_CONFIGFS_EEM is not set +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +# CONFIG_USB_CONFIGFS_F_LB_SS is not set +CONFIG_USB_CONFIGFS_F_FS=y +# CONFIG_USB_CONFIGFS_F_MTP is not set +# CONFIG_USB_CONFIGFS_F_ACC is not set +CONFIG_USB_CONFIGFS_UEVENT=y +# CONFIG_USB_CONFIGFS_F_UAC1 is not set +# CONFIG_USB_CONFIGFS_F_UAC2 is not set +# CONFIG_USB_CONFIGFS_F_MIDI is not set +# CONFIG_USB_CONFIGFS_F_HID is not set +# CONFIG_USB_CONFIGFS_F_UVC is not set +# CONFIG_USB_CONFIGFS_F_PRINTER is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set + +# +# ROCKCHIP USB Support +# +# CONFIG_USB20_HOST is not set +# CONFIG_USB20_OTG is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_EMBEDDED_SDIO is not set +# CONFIG_MMC_PARANOID_SD_INIT is not set +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +CONFIG_MMC_TEST=y +# CONFIG_MMC_SIMULATE_MAX_SPEED is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +# CONFIG_MMC_TIFM_SD is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_CB710 is not set +# CONFIG_MMC_VIA_SDMMC is not set +CONFIG_MMC_DW=y +CONFIG_MMC_DW_PLTFM=y +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_K3 is not set +# CONFIG_MMC_DW_PCI is not set +CONFIG_MMC_DW_ROCKCHIP=y +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_TOSHIBA_PCI is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_CLASS_FLASH is not set + +# +# LED drivers +# +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_LEDS_TRIGGER_MULTI_CTRL is not set +# CONFIG_SWITCH is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_FAKE is not set +CONFIG_RTC_DRV_HYM8563=y +# CONFIG_RTC_DRV_MAX6900 is not set +CONFIG_RTC_DRV_RK808=y +# CONFIG_RTC_DRV_RK_TIMER is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_TPS6586X is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_MCP795 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +# CONFIG_AMBA_PL08X is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +CONFIG_PL330_DMA=y +# CONFIG_DW_DMAC is not set +# CONFIG_DW_DMAC_PCI is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VFIO is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_PCI is not set +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTL8192U is not set +# CONFIG_RTLLIB is not set +# CONFIG_R8712U is not set +# CONFIG_R8188EU is not set +# CONFIG_R8723AU is not set +# CONFIG_RTS5208 is not set +# CONFIG_VT6655 is not set +# CONFIG_VT6656 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16204 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16220 is not set +# CONFIG_ADIS16240 is not set +# CONFIG_LIS3L02DQ is not set +# CONFIG_SCA3000 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7606 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7746 is not set + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16060 is not set + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set +# CONFIG_INV_MPU_IIO is not set + +# +# Light sensors +# +CONFIG_SENSORS_ISL29018=y +# CONFIG_SENSORS_ISL29028 is not set +CONFIG_TSL2583=y +# CONFIG_TSL2x7x is not set + +# +# Magnetometer sensors +# +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set + +# +# Active energy metering IC +# +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set + +# +# Triggers - standalone +# +# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set +# CONFIG_IIO_SIMPLE_DUMMY is not set +# CONFIG_FB_SM750 is not set +# CONFIG_FB_XGI is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_STAGING_MEDIA is not set + +# +# Android +# +# CONFIG_ASHMEM is not set +# CONFIG_ANDROID_TIMED_OUTPUT is not set +# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set +# CONFIG_SYNC is not set +# CONFIG_ANDROID_VSOC is not set +# CONFIG_ION is not set +# CONFIG_FIQ_DEBUGGER is not set +# CONFIG_FIQ_WATCHDOG is not set +# CONFIG_RK_CONSOLE_THREAD is not set +# CONFIG_STAGING_BOARD is not set +# CONFIG_WIMAX_GDM72XX is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_DGNC is not set +# CONFIG_DGAP is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_FSL_MC_BUS is not set +# CONFIG_WILC1000_DRIVER is not set +# CONFIG_MOST is not set +# CONFIG_POWERVR_ROGUE_N is not set +# CONFIG_GOLDFISH is not set +CONFIG_CHROME_PLATFORMS=y +# CONFIG_CROS_EC_CHARDEV is not set +CONFIG_CROS_EC_PROTO=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +# CONFIG_COMMON_CLK_VERSATILE is not set +CONFIG_COMMON_CLK_RK808=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_XGENE is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_CDCE706 is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_ROCKCHIP_TIMER=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_ARCH_TIMER_VCT_ACCESS=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_MAILBOX=y +# CONFIG_ARM_MHU is not set +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set +# CONFIG_MAILBOX_TEST is not set +# CONFIG_RK3368_MBOX is not set +CONFIG_IOMMU_API=y +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_IOVA=y +CONFIG_OF_IOMMU=y +CONFIG_IOMMU_DMA=y +CONFIG_ROCKCHIP_IOMMU=y +# CONFIG_RK_IOMMU is not set +# CONFIG_ARM_SMMU is not set +# CONFIG_ARM_SMMU_V3 is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# + +# +# CPU selection +# +# CONFIG_CPU_PX30 is not set +# CONFIG_CPU_RK1808 is not set +# CONFIG_CPU_RK3308 is not set +# CONFIG_CPU_RK3328 is not set +# CONFIG_CPU_RK3366 is not set +# CONFIG_CPU_RK3368 is not set +CONFIG_CPU_RK3399=y +CONFIG_ANDROID_VERSION=0x07010000 +CONFIG_ROCKCHIP_CPUINFO=y +# CONFIG_ROCKCHIP_DEVICEINFO is not set +CONFIG_ROCKCHIP_OPP=y +# CONFIG_ROCKCHIP_PM_TEST is not set +CONFIG_ROCKCHIP_GRF=y +CONFIG_ROCKCHIP_PM_DOMAINS=y +CONFIG_ROCKCHIP_PVTM=y +CONFIG_ROCKCHIP_SUSPEND_MODE=y +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y + +# +# DEVFREQ Drivers +# +CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y +CONFIG_EXTCON=y + +# +# Extcon Device Drivers +# +# CONFIG_EXTCON_ADC_JACK is not set +# CONFIG_EXTCON_GPIO is not set +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +# CONFIG_EXTCON_USB_GPIO is not set +CONFIG_MEMORY=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 + +# +# Accelerometers +# +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_HI8435 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_NAU7802 is not set +CONFIG_ROCKCHIP_SARADC=y +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_VF610_ADC is not set + +# +# Amplifiers +# +# CONFIG_AD8366 is not set + +# +# Chemical Sensors +# +# CONFIG_VZ89X is not set + +# +# Hid Sensor IIO Common +# + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set + +# +# Digital to analog converters +# +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +# CONFIG_AD9523 is not set + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set + +# +# Humidity sensors +# +# CONFIG_DHT11 is not set +# CONFIG_HDC100X is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_IIO is not set + +# +# Light sensors +# +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_ISL29125 is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_STK3310 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +CONFIG_SENSORS_TSL2563=y +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VL6180 is not set + +# +# Magnetometer sensors +# +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN is not set +# CONFIG_MAG3110 is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set + +# +# Inclinometer sensors +# + +# +# Triggers - standalone +# +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +CONFIG_IIO_SYSFS_TRIGGER=y + +# +# Digital potentiometers +# +# CONFIG_MCP4531 is not set + +# +# Pressure sensors +# +# CONFIG_BMP280 is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set + +# +# Proximity sensors +# +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_SX9500 is not set + +# +# Temperature sensors +# +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set +# CONFIG_NTB is not set +# CONFIG_VME_BUS is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_CROS_EC is not set +# CONFIG_PWM_FSL_FTM is not set +CONFIG_PWM_GPIO=y +# CONFIG_PWM_PCA9685 is not set +CONFIG_PWM_ROCKCHIP=y +# CONFIG_PWM_ROCKCHIP_I2S is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V2M=y +CONFIG_ARM_GIC_V3=y +CONFIG_ARM_GIC_V3_ITS=y +CONFIG_PARTITION_PERCPU=y +# CONFIG_IPACK_BUS is not set +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set +# CONFIG_PHY_XGENE is not set +CONFIG_PHY_ROCKCHIP_USB=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_INNO_USB3=y +CONFIG_PHY_ROCKCHIP_EMMC=y +CONFIG_PHY_ROCKCHIP_DP=y +# CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY is not set +CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY=y +CONFIG_PHY_ROCKCHIP_TYPEC=y +CONFIG_PHY_ROCKCHIP_PCIE=y +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_PMU=y +CONFIG_RAS=y +# CONFIG_THUNDERBOLT is not set + +# +# Android +# +CONFIG_ANDROID=y +# CONFIG_ANDROID_BINDER_IPC is not set +# CONFIG_LIBNVDIMM is not set +CONFIG_NVMEM=y +CONFIG_ROCKCHIP_EFUSE=y +CONFIG_ROCKCHIP_OTP=y +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set +# CONFIG_TEE is not set +# CONFIG_RK_FLASH is not set +# CONFIG_RK_NAND is not set + +# +# Headset device support +# +# CONFIG_RK_HEADSET is not set + +# +# Firmware Drivers +# +CONFIG_ARM_PSCI_FW=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_HAVE_ARM_SMCCC=y +CONFIG_ROCKCHIP_SIP=y +# CONFIG_ACPI is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +# CONFIG_FS_DAX is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_PROC_UID=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +# CONFIG_SDCARD_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS2_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_BLOCK=m +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_SMB311=y +CONFIG_CIFS_FSCACHE=y +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set +# CONFIG_VIRTUALIZATION is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +# CONFIG_PRINTK_PROCESS is not set +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +# CONFIG_GDB_SCRIPTS is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=2048 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +CONFIG_HAVE_ARCH_KASAN=y +# CONFIG_KASAN is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +CONFIG_HARDLOCKUP_DETECTOR_OTHER_CPU=y +CONFIG_HARDLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1 +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=1 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_INFO=y +# CONFIG_PANIC_ON_RT_THROTTLING is not set +CONFIG_SCHEDSTATS=y +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +CONFIG_TIMER_STATS=y + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +CONFIG_DEBUG_SPINLOCK=y +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_HAVE_DEBUG_BUGVERBOSE=y +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +CONFIG_DEBUG_CREDENTIALS=y + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_GPU_TRACEPOINTS=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +CONFIG_BLK_DEV_IO_TRACE=y +# CONFIG_PROBE_EVENTS is not set +CONFIG_DYNAMIC_FTRACE=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_TRACE_ENUM_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y + +# +# Runtime Testing +# +CONFIG_LKDTM=y +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_ARM64_PTDUMP is not set +CONFIG_STRICT_DEVMEM=y +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_DEBUG_SET_MODULE_RONX=y +CONFIG_DEBUG_RODATA=y +# CONFIG_DEBUG_ALIGN_RODATA is not set +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_TRUSTED_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY_PERF_EVENTS_RESTRICT is not set +# CONFIG_SECURITY is not set +CONFIG_SECURITYFS=y +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_TEE_SUPPORT is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set +CONFIG_CRYPTO_ABLK_HELPER=y + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=y +# CONFIG_CRYPTO_ECHAINIV is not set + +# +# Block modes +# +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_HEH is not set +CONFIG_CRYPTO_CTR=y +# CONFIG_CRYPTO_CTS is not set +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_GHASH=y +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SPECK is not set +# CONFIG_CRYPTO_TEA is not set +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_TWOFISH_COMMON=y + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_ZLIB is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_USER_API=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_CCP is not set +# CONFIG_CRYPTO_DEV_ROCKCHIP is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_PUBLIC_KEY_ALGO_RSA=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +CONFIG_ARM64_CRYPTO=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_CRYPTO_SHA2_ARM64_CE=y +CONFIG_CRYPTO_GHASH_ARM64_CE=y +# CONFIG_CRYPTO_POLY_HASH_ARM64_CE is not set +CONFIG_CRYPTO_AES_ARM64_CE=y +CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AES_ARM64_CE_BLK=y +# CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set +# CONFIG_CRYPTO_CRC32_ARM64 is not set +# CONFIG_CRYPTO_SPECK_NEON is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +CONFIG_CRC7=y +CONFIG_LIBCRC32C=y +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=m +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=m +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +# CONFIG_XZ_DEC_SPARC is not set +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_CLZ_TAB=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_MPILIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y diff --git a/projects/Rockchip/devices/RK3399/options b/projects/Rockchip/devices/RK3399/options new file mode 100644 index 0000000000..c432f4571b --- /dev/null +++ b/projects/Rockchip/devices/RK3399/options @@ -0,0 +1,39 @@ +################################################################################ +# setup device defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + aarch64) + TARGET_CPU="cortex-a72.cortex-a53" + TARGET_CPU_FLAGS="+crc+crypto" + TARGET_FEATURES="64bit" + ;; + arm) + TARGET_KERNEL_ARCH="arm64" + TARGET_PATCH_ARCH="aarch64" + TARGET_FLOAT="hard" + TARGET_CPU="cortex-a72.cortex-a53" + TARGET_CPU_FLAGS="+crc" + TARGET_FPU="crypto-neon-fp-armv8" + TARGET_FEATURES="32bit" + ;; + esac + + # Kernel target + KERNEL_TARGET="Image" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3399-khadas-edge.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3399-rock960.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3399-rock-pi-4.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3399-rockpro64.dtb" + KERNEL_MAKE_EXTRACMD+=" rockchip/rk3399-sapphire.dtb" + + # Mali GPU family + MALI_FAMILY="t860" + + # kernel serial console + EXTRA_CMDLINE="console=uart8250,mmio32,0xff1a0000 console=tty0" diff --git a/projects/Rockchip/devices/TinkerBoard/README.md b/projects/Rockchip/devices/TinkerBoard/README.md new file mode 100644 index 0000000000..3760099d9a --- /dev/null +++ b/projects/Rockchip/devices/TinkerBoard/README.md @@ -0,0 +1,15 @@ +# ASUS Tinker Board + +This is a device for the ASUS Tinker Board / Tinker Board S + +**Serial Console** + +* UART2 on GPIO pin 32/33 with baud rate 115200 + +**Build** + +* `PROJECT=Rockchip DEVICE=TinkerBoard ARCH=arm make image` + +## Links + +* Community Forum: https://tinkerboarding.co.uk/forum/ diff --git a/projects/Rockchip/devices/TinkerBoard/filesystem/usr/share/alsa/cards/USB-Audio.conf b/projects/Rockchip/devices/TinkerBoard/filesystem/usr/share/alsa/cards/USB-Audio.conf new file mode 100644 index 0000000000..66367c7323 --- /dev/null +++ b/projects/Rockchip/devices/TinkerBoard/filesystem/usr/share/alsa/cards/USB-Audio.conf @@ -0,0 +1,21 @@ +# +# Configuration for ALC4040 +# + +USB-Audio.pcm.default { + @args [ CARD ] + @args.CARD { type string } + type hw + card $CARD + device 2 +} + + + +USB-Audio.pcm.front.0 { + @args [ CARD ] + @args.CARD { type string } + type hw + card $CARD + device 2 +} diff --git a/projects/Rockchip/devices/TinkerBoard/kodi/appliance.xml b/projects/Rockchip/devices/TinkerBoard/kodi/appliance.xml new file mode 100644 index 0000000000..f549479d40 --- /dev/null +++ b/projects/Rockchip/devices/TinkerBoard/kodi/appliance.xml @@ -0,0 +1,12 @@ + + +
+ + + + 0 + + + +
+
diff --git a/projects/Rockchip/devices/TinkerBoard/linux/rockchip-4.4/linux.arm.conf b/projects/Rockchip/devices/TinkerBoard/linux/rockchip-4.4/linux.arm.conf new file mode 100644 index 0000000000..1803108843 --- /dev/null +++ b/projects/Rockchip/devices/TinkerBoard/linux/rockchip-4.4/linux.arm.conf @@ -0,0 +1,4937 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.4.154 Kernel Configuration +# +CONFIG_ARM=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_ARM_DMA_USE_IOMMU=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_FHANDLE=y +CONFIG_USELIB=y +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_SCHED_WALT is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +# CONFIG_MEMCG_SWAP is not set +# CONFIG_MEMCG_KMEM is not set +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SCHED_TUNE is not set +# CONFIG_DEFAULT_USE_ENERGY_AWARE is not set +# CONFIG_SYSFS_DEPRECATED is not set +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +# CONFIG_RD_BZIP2 is not set +# CONFIG_RD_LZMA is not set +CONFIG_RD_XZ=y +# CONFIG_RD_LZO is not set +# CONFIG_RD_LZ4 is not set +# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +CONFIG_EXPERT=y +CONFIG_UID16=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_MEMBARRIER=y +CONFIG_EMBEDDED=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y +# CONFIG_OPROFILE is not set +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +# CONFIG_JUMP_LABEL is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_HAVE_EXIT_THREAD=y +CONFIG_ARCH_MMAP_RND_BITS_MIN=8 +CONFIG_ARCH_MMAP_RND_BITS_MAX=16 +CONFIG_ARCH_MMAP_RND_BITS=8 +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_LBDAF=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_DEV_BSGLIB=y +# CONFIG_BLK_DEV_INTEGRITY is not set +CONFIG_BLK_DEV_THROTTLING=y +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_RK_PARTITION is not set +# CONFIG_CMDLINE_PARTITION is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +CONFIG_CFQ_GROUP_IOSCHED=y +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_ASN1=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Multiple platform selection +# + +# +# CPU Core family selection +# +# CONFIG_ARCH_MULTI_V6 is not set +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_MULTI_V6_V7=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +# CONFIG_ARCH_VIRT is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_DIGICOLOR is not set +# CONFIG_ARCH_HIGHBANK is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEYSTONE is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_MEDIATEK is not set + +# +# TI OMAP/AM/DM/DRA Family +# +# CONFIG_ARCH_OMAP3 is not set +# CONFIG_ARCH_OMAP4 is not set +# CONFIG_SOC_OMAP5 is not set +# CONFIG_SOC_AM33XX is not set +# CONFIG_SOC_AM43XX is not set +# CONFIG_SOC_DRA7XX is not set +# CONFIG_ARCH_QCOM is not set +CONFIG_ARCH_ROCKCHIP=y +# CONFIG_ARCH_SOCFPGA is not set +# CONFIG_PLAT_SPEAR is not set +# CONFIG_ARCH_STI is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SHMOBILE_MULTI is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_SIRF is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_U8500 is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_WM8850 is not set +# CONFIG_ARCH_ZX is not set +# CONFIG_ARCH_ZYNQ is not set + +# +# Processor Type +# +CONFIG_CPU_V7=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARM_LPAE is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARM_THUMB=y +CONFIG_ARM_THUMBEE=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_SWP_EMULATE=y +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +CONFIG_VDSO=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_CACHE_L2X0=y +# CONFIG_PL310_ERRATA_588369 is not set +# CONFIG_PL310_ERRATA_727915 is not set +# CONFIG_PL310_ERRATA_753970 is not set +# CONFIG_PL310_ERRATA_769419 is not set +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_ARM_HEAVY_MB=y +CONFIG_ARM_KERNMEM_PERMS=y +CONFIG_DEBUG_RODATA=y +CONFIG_MULTI_IRQ_HANDLER=y +# CONFIG_ARM_ERRATA_430973 is not set +# CONFIG_ARM_ERRATA_643719 is not set +# CONFIG_ARM_ERRATA_720789 is not set +# CONFIG_ARM_ERRATA_754322 is not set +# CONFIG_ARM_ERRATA_754327 is not set +# CONFIG_ARM_ERRATA_764369 is not set +# CONFIG_ARM_ERRATA_775420 is not set +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_ERRATA_773022 is not set + +# +# Bus support +# +# CONFIG_PCI is not set +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_HAVE_SMP=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_ARM_CPU_TOPOLOGY=y +# CONFIG_SCHED_MC is not set +# CONFIG_SCHED_SMT is not set +CONFIG_HAVE_ARM_SCU=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +# CONFIG_MCPM is not set +# CONFIG_BIG_LITTLE is not set +CONFIG_VMSPLIT_3G=y +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_NR_CPUS=4 +CONFIG_HOTPLUG_CPU=y +# CONFIG_ARM_PSCI is not set +CONFIG_ARCH_NR_GPIO=288 +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_HZ_FIXED=0 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +# CONFIG_THUMB2_KERNEL is not set +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HIGHMEM=y +# CONFIG_HIGHPTE is not set +CONFIG_CPU_SW_DOMAIN_PAN=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_COMPACTION is not set +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_BOUNCE=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +CONFIG_CMA_DEBUGFS=y +CONFIG_CMA_AREAS=7 +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +CONFIG_ZSMALLOC=m +CONFIG_PGTABLE_MAPPING=y +# CONFIG_ZSMALLOC_STAT is not set +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FRAME_VECTOR=y +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_UACCESS_WITH_MEMCPY is not set +CONFIG_SECCOMP=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_XEN is not set +# CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +# CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="usbcore.autosuspend=-1" +# CONFIG_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_CMDLINE_EXTEND=y +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_AUTO_ZRELADDR=y + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_TIMES=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y + +# +# CPU frequency scaling drivers +# +CONFIG_CPUFREQ_DT=y +# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set +# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set +CONFIG_ARM_ROCKCHIP_CPUFREQ=y +# CONFIG_QORIQ_CPUFREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_NEON=y +# CONFIG_KERNEL_MODE_NEON is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +CONFIG_HAS_WAKELOCK=y +CONFIG_WAKELOCK=y +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_ADVANCED_DEBUG=y +# CONFIG_PM_TEST_SUSPEND is not set +CONFIG_PM_SLEEP_DEBUG=y +# CONFIG_APM_EMULATION is not set +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_XFRM_USER is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +CONFIG_IP_MROUTE=y +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_SYN_COOKIES is not set +CONFIG_NET_UDP_TUNNEL=m +# CONFIG_NET_FOU is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_IPV6_SIT is not set +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_ANDROID_PARANOID_NETWORK is not set +# CONFIG_NETWORK_SECMARK is not set +CONFIG_NET_PTP_CLASSIFY=y +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +# CONFIG_NETFILTER_INGRESS is not set +CONFIG_NETFILTER_NETLINK=m +# CONFIG_NETFILTER_NETLINK_ACCT is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=m +CONFIG_NF_LOG_COMMON=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_PROCFS is not set +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_TIMEOUT is not set +# CONFIG_NF_CONNTRACK_TIMESTAMP is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_FTP=m +# CONFIG_NF_CONNTRACK_H323 is not set +# CONFIG_NF_CONNTRACK_IRC is not set +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_SNMP is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CT_NETLINK is not set +# CONFIG_NF_CT_NETLINK_TIMEOUT is not set +CONFIG_NF_NAT=m +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_AMANDA is not set +CONFIG_NF_NAT_FTP=m +# CONFIG_NF_NAT_IRC is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NF_NAT_REDIRECT is not set +# CONFIG_NF_TABLES is not set +CONFIG_NETFILTER_XTABLES=m + +# +# Xtables combined modules +# +# CONFIG_NETFILTER_XT_MARK is not set +# CONFIG_NETFILTER_XT_CONNMARK is not set + +# +# Xtables targets +# +# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_HMARK is not set +# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_LOG is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +CONFIG_NETFILTER_XT_NAT=m +# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set +# CONFIG_NETFILTER_XT_TARGET_TEE is not set +# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +# CONFIG_NETFILTER_XT_MATCH_BPF is not set +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +# CONFIG_NETFILTER_XT_MATCH_CPU is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ECN is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +# CONFIG_NETFILTER_XT_MATCH_L2TP is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set +CONFIG_NETFILTER_XT_MATCH_STATE=m +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_IP_SET is not set +# CONFIG_IP_VS is not set + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_NF_CONNTRACK_IPV4=m +# CONFIG_NF_DUP_IPV4 is not set +# CONFIG_NF_LOG_ARP is not set +# CONFIG_NF_LOG_IPV4 is not set +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_IPV4=m +CONFIG_NF_NAT_MASQUERADE_IPV4=m +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_H323 is not set +CONFIG_IP_NF_IPTABLES=m +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_RPFILTER is not set +# CONFIG_IP_NF_MATCH_TTL is not set +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +# CONFIG_IP_NF_TARGET_SYNPROXY is not set +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +CONFIG_IP_NF_MANGLE=m +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_ARPTABLES is not set + +# +# IPv6: Netfilter Configuration +# +# CONFIG_NF_DEFRAG_IPV6 is not set +# CONFIG_NF_CONNTRACK_IPV6 is not set +# CONFIG_NF_DUP_IPV6 is not set +# CONFIG_NF_REJECT_IPV6 is not set +CONFIG_NF_LOG_IPV6=m +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=m +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_HAVE_NET_DSA=y +# CONFIG_NET_DSA is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +CONFIG_LLC=m +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +CONFIG_DNS_RESOLVER=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +CONFIG_BT=y +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=y +# CONFIG_BT_RFCOMM_TTY is not set +# CONFIG_BT_BNEP is not set +CONFIG_BT_HIDP=y +CONFIG_BT_HS=y +CONFIG_BT_LE=y +# CONFIG_BT_SELFTEST is not set +CONFIG_BT_DEBUGFS=y + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=y +CONFIG_BT_BCM=y +CONFIG_BT_RTL=y +# CONFIG_BT_RTKBTUSB is not set +CONFIG_BT_HCIBTUSB=y +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y +CONFIG_BT_HCIBTSDIO=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y +# CONFIG_BT_HCIUART_INTEL is not set +# CONFIG_BT_HCIUART_BCM is not set +# CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIBFUSB=y +CONFIG_BT_HCIVHCI=y +CONFIG_BT_MRVL=y +CONFIG_BT_MRVL_SDIO=y +# CONFIG_BT_ATH3K is not set +# CONFIG_AF_RXRPC is not set +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=y +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_DEFAULT_PS=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_INTERNAL_REGDB=y +# CONFIG_CFG80211_CRDA_SUPPORT is not set +CONFIG_CFG80211_WEXT=y +# CONFIG_LIB80211 is not set +CONFIG_MAC80211=y +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_MINSTREL_HT=y +CONFIG_MAC80211_RC_MINSTREL_VHT=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_LEDS=y +CONFIG_MAC80211_DEBUGFS=y +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +# CONFIG_WIMAX is not set +CONFIG_RFKILL=y +CONFIG_RFKILL_PM=y +CONFIG_RFKILL_LEDS=y +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL_REGULATOR is not set +CONFIG_RFKILL_GPIO=y +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_DST_CACHE=y +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y +# CONFIG_TEGRA_AHB is not set + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_WANT_DEV_COREDUMP=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +CONFIG_DEBUG_DEVRES=y +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_FENCE_TRACE is not set +CONFIG_DMA_CMA=y + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=64 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 + +# +# Bus devices +# +# CONFIG_ARM_CCI400_PMU is not set +# CONFIG_ARM_CCI500_PMU is not set +# CONFIG_ARM_CCN is not set +# CONFIG_BRCMSTB_GISB_ARB is not set +# CONFIG_VEXPRESS_CONFIG is not set +CONFIG_CONNECTOR=y +CONFIG_PROC_EVENTS=y +# CONFIG_MTD is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +CONFIG_ZRAM=m +CONFIG_ZRAM_LZ4_COMPRESS=y +# CONFIG_BLK_DEV_COW_COMMON is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=1 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_MG_DISK is not set +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +CONFIG_ROCKCHIP_SCR=y +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_TI_DAC7512 is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_BMP085_SPI is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +# CONFIG_SRAM is not set +# CONFIG_MEMORY_STATE_TIME is not set +# CONFIG_USB_CAM_GPIO is not set +# CONFIG_GPIO_DET is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +CONFIG_EEPROM_AT24=y +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EEPROM_93XX46 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +CONFIG_SCSI_PROC_FS=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +CONFIG_BLK_DEV_SR=y +# CONFIG_BLK_DEV_SR_VENDOR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_FC_ATTRS is not set +CONFIG_SCSI_ISCSI_ATTRS=y +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=y +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_ATA is not set +CONFIG_MD=y +# CONFIG_BLK_DEV_MD is not set +# CONFIG_BCACHE is not set +CONFIG_BLK_DEV_DM_BUILTIN=y +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_MQ_DEFAULT is not set +# CONFIG_DM_DEBUG is not set +CONFIG_DM_BUFIO=m +CONFIG_DM_BIO_PRISON=m +CONFIG_DM_PERSISTENT_DATA=m +# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set +# CONFIG_DM_CRYPT is not set +# CONFIG_DM_SNAPSHOT is not set +CONFIG_DM_THIN_PROVISIONING=m +# CONFIG_DM_CACHE is not set +# CONFIG_DM_ERA is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_RAID is not set +# CONFIG_DM_ZERO is not set +# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_DELAY is not set +# CONFIG_DM_UEVENT is not set +# CONFIG_DM_FLAKEY is not set +# CONFIG_DM_VERITY is not set +# CONFIG_DM_VERITY_HASH_PREFETCH_MIN_SIZE_128 is not set +# CONFIG_DM_SWITCH is not set +# CONFIG_DM_LOG_WRITES is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +CONFIG_DUMMY=m +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set +# CONFIG_IPVLAN is not set +CONFIG_VXLAN=m +# CONFIG_GENEVE is not set +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=m +# CONFIG_TUN_VNET_CROSS_LE is not set +CONFIG_VETH=m +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +CONFIG_ETHERNET=y +# CONFIG_ALTERA_TSE is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_AURORA is not set +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +CONFIG_NET_VENDOR_CIRRUS=y +# CONFIG_CS89x0 is not set +# CONFIG_DM9000 is not set +# CONFIG_DNET is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +CONFIG_NET_VENDOR_FARADAY=y +# CONFIG_FTMAC100 is not set +# CONFIG_FTGMAC100 is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_ETHOC is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_DWMAC_GENERIC=y +# CONFIG_DWMAC_IPQ806X is not set +# CONFIG_DWMAC_LPC18XX is not set +# CONFIG_DWMAC_MESON is not set +CONFIG_DWMAC_ROCKCHIP=y +# CONFIG_DWMAC_SOCFPGA is not set +# CONFIG_DWMAC_STI is not set +# CONFIG_DWMAC_SUNXI is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +CONFIG_ROCKCHIP_PHY=y +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_MICREL_KS8995MA is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +CONFIG_USB_RTL8150=y +CONFIG_USB_RTL8152=y +# CONFIG_USB_LAN78XX is not set +CONFIG_USB_USBNET=y +CONFIG_USB_NET_AX8817X=y +CONFIG_USB_NET_AX88179_178A=y +CONFIG_USB_NET_CDCETHER=y +# CONFIG_USB_NET_CDC_EEM is not set +CONFIG_USB_NET_CDC_NCM=y +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +CONFIG_USB_NET_CDC_MBIM=y +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +# CONFIG_USB_NET_SMSC75XX is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_MCS7830 is not set +CONFIG_USB_NET_RNDIS_HOST=y +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set +# CONFIG_USB_NET_CH9200 is not set +CONFIG_WLAN=y +CONFIG_LIBERTAS_THINFIRM=y +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +# CONFIG_LIBERTAS_THINFIRM_USB is not set +# CONFIG_AT76C50X_USB is not set +CONFIG_USB_ZD1201=m +CONFIG_USB_NET_RNDIS_WLAN=y +CONFIG_RTL8187=m +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_ATH_CARDS is not set +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +CONFIG_BRCMUTIL=m +# CONFIG_BRCMSMAC is not set +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +# CONFIG_BRCMFMAC_SDIO is not set +CONFIG_BRCMFMAC_USB=y +# CONFIG_BRCM_TRACING is not set +# CONFIG_BRCMDBG is not set +# CONFIG_HOSTAP is not set +# CONFIG_LIBERTAS is not set +# CONFIG_P54_COMMON is not set +CONFIG_RT2X00=m +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_LIB_DEBUGFS is not set +# CONFIG_RT2X00_DEBUG is not set +# CONFIG_WL_MEDIATEK is not set +# CONFIG_RTL_CARDS is not set +# CONFIG_RTL8XXXU is not set +CONFIG_WL_ROCKCHIP=y +CONFIG_WIFI_BUILD_MODULE=y +# CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP is not set +# CONFIG_WIFI_GENERATE_RANDOM_MAC_ADDR is not set +# CONFIG_AP6XXX is not set +# CONFIG_CYW_BCMDHD is not set +CONFIG_RTL_WIRELESS_SOLUTION=y +# CONFIG_RTL8188EU is not set +# CONFIG_RTL8188FU is not set +# CONFIG_RTL8189ES is not set +# CONFIG_RTL8189FS is not set +CONFIG_RTL8723BS=m +# CONFIG_RTL8723BU is not set +# CONFIG_RTL8723CS is not set +# CONFIG_RTL8723DS is not set +# CONFIG_MVL88W8977 is not set + +# +# SouthSV 6XXX WLAN support +# +# CONFIG_SSV6051 is not set +# CONFIG_WL_TI is not set +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_MWIFIEX is not set +# CONFIG_CW1200 is not set +# CONFIG_RSI_91X is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_INPUT_SPARSEKMAP is not set +CONFIG_INPUT_MATRIXKMAP=y + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_JOYDEV=y +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KEYRESET is not set +# CONFIG_INPUT_KEYCOMBO is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADC is not set +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=y +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_ROCKCHIP is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_KEYBOARD_CROS_EC=y +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +# CONFIG_MOUSE_PS2 is not set +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +CONFIG_MOUSE_CYAPA=y +CONFIG_MOUSE_ELAN_I2C=y +CONFIG_MOUSE_ELAN_I2C_I2C=y +# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +CONFIG_INPUT_JOYSTICK=y +# CONFIG_JOYSTICK_ANALOG is not set +# CONFIG_JOYSTICK_A3D is not set +# CONFIG_JOYSTICK_ADI is not set +# CONFIG_JOYSTICK_COBRA is not set +# CONFIG_JOYSTICK_GF2K is not set +# CONFIG_JOYSTICK_GRIP is not set +# CONFIG_JOYSTICK_GRIP_MP is not set +# CONFIG_JOYSTICK_GUILLEMOT is not set +# CONFIG_JOYSTICK_INTERACT is not set +# CONFIG_JOYSTICK_SIDEWINDER is not set +# CONFIG_JOYSTICK_TMDC is not set +CONFIG_JOYSTICK_IFORCE=y +CONFIG_JOYSTICK_IFORCE_USB=y +# CONFIG_JOYSTICK_IFORCE_232 is not set +# CONFIG_JOYSTICK_WARRIOR is not set +# CONFIG_JOYSTICK_MAGELLAN is not set +# CONFIG_JOYSTICK_SPACEORB is not set +# CONFIG_JOYSTICK_SPACEBALL is not set +# CONFIG_JOYSTICK_STINGER is not set +# CONFIG_JOYSTICK_TWIDJOY is not set +# CONFIG_JOYSTICK_ZHENHUA is not set +# CONFIG_JOYSTICK_AS5011 is not set +# CONFIG_JOYSTICK_JOYDUMP is not set +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_INPUT_TABLET=y +# CONFIG_TABLET_USB_ACECAD is not set +# CONFIG_TABLET_USB_AIPTEK is not set +# CONFIG_TABLET_USB_GTCO is not set +# CONFIG_TABLET_USB_HANWANG is not set +# CONFIG_TABLET_USB_KBTAB is not set +# CONFIG_TABLET_SERIAL_WACOM4 is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AR1021_I2C is not set +CONFIG_TOUCHSCREEN_ATMEL_MXT=y +# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set +# CONFIG_TOUCHSCREEN_BU21013 is not set +# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set +# CONFIG_TOUCHSCREEN_CY8C40XX is not set +# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set +# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set +# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set +# CONFIG_TOUCHSCREEN_DYNAPRO is not set +# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_EGALAX is not set +# CONFIG_TOUCHSCREEN_FT6236 is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GOODIX is not set +# CONFIG_TOUCHSCREEN_GSLX680A is not set +# CONFIG_TOUCHSCREEN_GSLX680_D708 is not set +# CONFIG_TOUCHSCREEN_GSLX680_PAD is not set +# CONFIG_TOUCHSCREEN_GSLX680_VR is not set +# CONFIG_TOUCHSCREEN_GSLX680_FIREFLY is not set +# CONFIG_TOUCHSCREEN_GSL3673 is not set +# CONFIG_TOUCHSCREEN_GSL3673_800X1280 is not set +# CONFIG_TOUCHSCREEN_GT9XX is not set +# CONFIG_TOUCHSCREEN_ILI210X is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +CONFIG_TOUCHSCREEN_ELAN=y +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TOUCHSCREEN_WACOM_I2C is not set +# CONFIG_TOUCHSCREEN_MAX11801 is not set +# CONFIG_TOUCHSCREEN_MCS5000 is not set +# CONFIG_TOUCHSCREEN_MMS114 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_PIXCIR is not set +# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set +CONFIG_TOUCHSCREEN_USB_COMPOSITE=y +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TSC_SERIO is not set +# CONFIG_TOUCHSCREEN_TSC2004 is not set +# CONFIG_TOUCHSCREEN_TSC2005 is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_ST1232 is not set +# CONFIG_TOUCHSCREEN_SUR40 is not set +# CONFIG_TOUCHSCREEN_SX8654 is not set +# CONFIG_TOUCHSCREEN_TPS6507X is not set +# CONFIG_TOUCHSCREEN_ZFORCE is not set +# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set +# CONFIG_TOUCHSCREEN_VTL_CT36X is not set +# CONFIG_TOUCHSCREEN_GT1X is not set +# CONFIG_ROCKCHIP_REMOTECTL is not set + +# +# handle all sensors +# +# CONFIG_SENSOR_DEVICE is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +# CONFIG_INPUT_MPU3050 is not set +# CONFIG_INPUT_GP2A is not set +# CONFIG_INPUT_GPIO_BEEPER is not set +# CONFIG_INPUT_GPIO_TILT_POLLED is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_KEYCHORD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_RK8XX_PWRKEY=y +CONFIG_INPUT_UINPUT=y +CONFIG_INPUT_GPIO=y +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_CMA3000 is not set +# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +# CONFIG_SERIO_AMBAKMI is not set +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_RAW=y +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_NR_UARTS=5 +CONFIG_SERIAL_8250_RUNTIME_UARTS=5 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +# CONFIG_SERIAL_8250_SHARE_IRQ is not set +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_EM is not set +# CONFIG_SERIAL_8250_RT288X is not set +# CONFIG_SERIAL_8250_INGENIC is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_IFX6X60 is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_STM32 is not set +# CONFIG_TTY_PRINTK is not set +# CONFIG_HVC_DCC is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_TPM=y +# CONFIG_HW_RANDOM_ROCKCHIP is not set +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +CONFIG_TCG_TPM=y +# CONFIG_TCG_TIS_I2C_ATMEL is not set +CONFIG_TCG_TIS_I2C_INFINEON=y +# CONFIG_TCG_TIS_I2C_NUVOTON is not set +# CONFIG_TCG_ATMEL is not set +# CONFIG_TCG_TIS_ST33ZP24 is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set +# CONFIG_I2C_MUX_REG is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +CONFIG_I2C_RK3X=y +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +CONFIG_I2C_CROS_EC_TUNNEL=y +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y + +# +# SPI Master Controller Drivers +# +# CONFIG_SPI_ALTERA is not set +CONFIG_SPI_BITBANG=y +# CONFIG_SPI_CADENCE is not set +# CONFIG_SPI_GPIO is not set +# CONFIG_SPI_FSL_SPI is not set +# CONFIG_SPI_OC_TINY is not set +# CONFIG_SPI_PL022 is not set +# CONFIG_SPI_PXA2XX_PCI is not set +CONFIG_SPI_ROCKCHIP=y +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set +# CONFIG_SPI_DESIGNWARE is not set + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=y +# CONFIG_SPI_TLE62X0 is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +# CONFIG_PPS_CLIENT_LDISC is not set +# CONFIG_PPS_CLIENT_GPIO is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_PINCTRL=y + +# +# Pin controllers +# +CONFIG_PINMUX=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SINGLE is not set +# CONFIG_PINCTRL_RK805 is not set +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +CONFIG_DEBUG_GPIO=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set + +# +# MFD GPIO expanders +# +# CONFIG_GPIO_RK8XX is not set +# CONFIG_GPIO_TPS6586X is not set + +# +# SPI GPIO expanders +# +# CONFIG_GPIO_74X164 is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MC33880 is not set + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_GENERIC_ADC_BATTERY is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +CONFIG_BATTERY_SBS=y +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +CONFIG_CHARGER_GPIO=y +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +CONFIG_CHARGER_BQ24735=y +# CONFIG_CHARGER_BQ25700 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_BATTERY_EC is not set +# CONFIG_BATTERY_CW2015 is not set +# CONFIG_BATTERY_RK816 is not set +# CONFIG_BATTERY_RK817 is not set +# CONFIG_CHARGER_RK817 is not set +# CONFIG_BATTERY_RK818 is not set +# CONFIG_CHARGER_RK818 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMSTB is not set +# CONFIG_POWER_RESET_GPIO is not set +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +# CONFIG_POWER_RESET_RESTART is not set +# CONFIG_POWER_RESET_VERSATILE is not set +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +CONFIG_REBOOT_MODE=y +CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_POWER_AVS=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7314 is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7310 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IIO_HWMON is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_PWM_FAN is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SCH5627 is not set +# CONFIG_SENSORS_SCH5636 is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADS7871 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +CONFIG_THERMAL=y +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +# CONFIG_THERMAL_WRITABLE_TRIPS is not set +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_GOV_FAIR_SHARE is not set +CONFIG_THERMAL_GOV_STEP_WISE=y +# CONFIG_THERMAL_GOV_BANG_BANG is not set +# CONFIG_THERMAL_GOV_USER_SPACE is not set +# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +CONFIG_CPU_THERMAL=y +# CONFIG_CLOCK_THERMAL is not set +CONFIG_DEVFREQ_THERMAL=y +# CONFIG_THERMAL_EMULATION is not set +# CONFIG_IMX_THERMAL is not set +CONFIG_ROCKCHIP_THERMAL=y +CONFIG_RK_VIRTUAL_THERMAL=y +# CONFIG_RK3368_THERMAL is not set +CONFIG_WATCHDOG=y +# CONFIG_WATCHDOG_CORE is not set +# CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_GPIO_WATCHDOG is not set +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_ARM_SP805_WATCHDOG is not set +# CONFIG_CADENCE_WATCHDOG is not set +CONFIG_DW_WATCHDOG=y +# CONFIG_MAX63XX_WATCHDOG is not set +# CONFIG_BCM7038_WDT is not set +# CONFIG_MEN_A21_WDT is not set + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X is not set +CONFIG_MFD_CROS_EC=y +# CONFIG_MFD_CROS_EC_I2C is not set +CONFIG_MFD_CROS_EC_SPI=y +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK618 is not set +CONFIG_MFD_RK808=y +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +CONFIG_MFD_TPS6586X=y +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_RK1000 is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_FUSB_30X is not set +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +CONFIG_REGULATOR_ACT8865=y +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +CONFIG_REGULATOR_FAN53555=y +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8752 is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_MP8865 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_RK808=y +# CONFIG_REGULATOR_RK818 is not set +# CONFIG_REGULATOR_SYR82X is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS549B22 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS6524X is not set +CONFIG_REGULATOR_TPS6586X=y +# CONFIG_REGULATOR_XZ3216 is not set +CONFIG_CEC_CORE=y +CONFIG_CEC_NOTIFIER=y +CONFIG_MEDIA_SUPPORT=m + +# +# Multimedia core support +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +# CONFIG_MEDIA_RADIO_SUPPORT is not set +# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CEC_SUPPORT=y +# CONFIG_MEDIA_CONTROLLER is not set +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m +CONFIG_VIDEOBUF_DVB=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_DVB_CORE=m +CONFIG_DVB_NET=y +CONFIG_TTPCI_EEPROM=m +CONFIG_DVB_MAX_ADAPTERS=32 +# CONFIG_DVB_DYNAMIC_MINORS is not set + +# +# Media drivers +# +CONFIG_RC_CORE=m +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_LIRC=m +CONFIG_IR_LIRC_CODEC=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_RC_ATI_REMOTE=m +CONFIG_IR_HIX5HD2=m +CONFIG_IR_IMON=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_TTUSBIR=m +# CONFIG_RC_LOOPBACK is not set +CONFIG_IR_GPIO_CIR=m +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +# CONFIG_VIDEO_STK1160_AC97 is not set +CONFIG_VIDEO_STK1160=m +# CONFIG_VIDEO_GO7007 is not set + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +# CONFIG_VIDEO_TM6000_ALSA is not set +CONFIG_VIDEO_TM6000_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_FRIIO=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +# CONFIG_VIDEO_EM28XX_V4L2 is not set +# CONFIG_VIDEO_EM28XX_ALSA is not set +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# USB HDMI CEC adapters +# +CONFIG_USB_PULSE8_CEC=m +CONFIG_USB_RAINSHADOW_CEC=m +# CONFIG_V4L_PLATFORM_DRIVERS is not set +# CONFIG_V4L_MEM2MEM_DRIVERS is not set +# CONFIG_V4L_TEST_DRIVERS is not set +# CONFIG_DVB_PLATFORM_DRIVERS is not set +# CONFIG_ROCKCHIP_TSP is not set + +# +# Supported MMC/SDIO adapters +# +# CONFIG_SMS_SDIO_DRV is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y + +# +# Media ancillary drivers (tuners, sensors, i2c, frontends) +# +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y +CONFIG_MEDIA_ATTACH=y +CONFIG_VIDEO_IR_I2C=m + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_WM8775=m + +# +# RDS decoders +# + +# +# Video decoders +# +CONFIG_VIDEO_SAA711X=m + +# +# Video and audio decoders +# +CONFIG_VIDEO_CX25840=m + +# +# Video encoders +# + +# +# Camera sensor devices +# + +# +# Flash devices +# + +# +# Video improvement chips +# + +# +# Camera lens devices +# + +# +# Audio/Video compression chips +# + +# +# Miscellaneous helper chips +# + +# +# Sensors used on soc_camera driver +# +CONFIG_MEDIA_TUNER=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC5000=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_SP2=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m + +# +# Tools to develop new frontends +# +# CONFIG_DVB_DUMMY_FE is not set +# CONFIG_CAMSYS_DRV is not set +# CONFIG_ROCK_CHIP_SOC_CAMERA is not set + +# +# Graphics support +# +# CONFIG_IMX_IPUV3_CORE is not set +CONFIG_DRM=y +CONFIG_DRM_IGNORE_IOTCL_PERMIT=y +CONFIG_DRM_MIPI_DSI=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_KMS_FB_HELPER=y +CONFIG_DRM_FBDEV_EMULATION=y +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set +# CONFIG_DRM_SCDC_HELPER is not set +# CONFIG_DRM_DMA_SYNC is not set + +# +# I2C encoder or helper chips +# +# CONFIG_DRM_I2C_ADV7511 is not set +# CONFIG_DRM_I2C_CH7006 is not set +# CONFIG_DRM_I2C_SIL164 is not set +# CONFIG_DRM_I2C_NXP_TDA998X is not set +# CONFIG_DRM_VGEM is not set +# CONFIG_DRM_EXYNOS is not set +CONFIG_DRM_ROCKCHIP=y +# CONFIG_ROCKCHIP_DRM_DEBUG is not set +# CONFIG_ROCKCHIP_CDN_DP is not set +CONFIG_ROCKCHIP_DW_HDMI=y +CONFIG_ROCKCHIP_DW_MIPI_DSI=y +CONFIG_ROCKCHIP_MIPI_CSI_TX=y +CONFIG_ROCKCHIP_ANALOGIX_DP=y +CONFIG_ROCKCHIP_INNO_HDMI=y +CONFIG_ROCKCHIP_LVDS=y +CONFIG_ROCKCHIP_DRM_TVE=y +# CONFIG_ROCKCHIP_RGB is not set +# CONFIG_ROCKCHIP_DRM_BACKLIGHT is not set +# CONFIG_ROCKCHIP_RK3066_HDMI is not set +# CONFIG_DRM_UDL is not set +# CONFIG_DRM_ARMADA is not set +# CONFIG_DRM_TILCDC is not set +# CONFIG_DRM_FSL_DCU is not set +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +CONFIG_DRM_PANEL_SIMPLE=y +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set +CONFIG_DRM_BRIDGE=y + +# +# Display Interface Bridges +# +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +# CONFIG_DRM_RK1000 is not set +# CONFIG_DRM_DUMB_VGA_DAC is not set +# CONFIG_DRM_LONTIUM_LT8912 is not set +CONFIG_DRM_ANALOGIX_DP=y +CONFIG_DRM_DW_HDMI=y +# CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set +CONFIG_DRM_DW_HDMI_I2S_AUDIO=y +CONFIG_DRM_DW_HDMI_CEC=y +# CONFIG_DRM_STI is not set +# CONFIG_POWERVR_ROGUE_M is not set +# CONFIG_MALI400 is not set +CONFIG_MALI_DEVFREQ=y +CONFIG_MALI_MIDGARD=m +# CONFIG_MALI_GATOR_SUPPORT is not set +# CONFIG_MALI_MIDGARD_ENABLE_TRACE is not set +# CONFIG_MALI_DMA_FENCE is not set +CONFIG_MALI_EXPERT=y +# CONFIG_MALI_CORESTACK is not set +# CONFIG_MALI_PRFCNT_SET_SECONDARY is not set +# CONFIG_MALI_PLATFORM_FAKE is not set +# CONFIG_MALI_PLATFORM_DEVICETREE is not set +CONFIG_MALI_PLATFORM_THIRDPARTY=y +CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="rk" +# CONFIG_MALI_DEBUG is not set +# CONFIG_MALI_NO_MALI is not set +# CONFIG_MALI_TRACE_TIMELINE is not set +# CONFIG_MALI_SYSTEM_TRACE is not set +# CONFIG_MALI_GPU_MMU_AARCH64 is not set +CONFIG_MALI_PWRSOFT_765=y +# CONFIG_MALI_KUTF is not set +# CONFIG_MALI_BIFROST_FOR_ANDROID is not set +CONFIG_MALI_BIFROST_FOR_LINUX=y +# CONFIG_MALI_BIFROST is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARMCLCD is not set +# CONFIG_FB_UVESA is not set +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +CONFIG_BACKLIGHT_PWM=y +# CONFIG_BACKLIGHT_PM8941_WLED is not set +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +# CONFIG_BACKLIGHT_LP855X is not set +# CONFIG_BACKLIGHT_GPIO is not set +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set + +# +# Rockchip Misc Video driver +# +# CONFIG_FB_ROCKCHIP is not set +# CONFIG_LCDC_RK3188 is not set +# CONFIG_LCDC_RK3288 is not set +# CONFIG_LCDC_RK3036 is not set +# CONFIG_LCDC_RK312X is not set +CONFIG_LCD_GENERAL=y +# CONFIG_LCD_MIPI is not set +# CONFIG_RK_TRSM is not set +# CONFIG_RK_HDMI is not set + +# +# RGA +# +# CONFIG_ROCKCHIP_RGA is not set + +# +# RGA2 +# +# CONFIG_ROCKCHIP_RGA2 is not set + +# +# VCODEC +# +CONFIG_RK_VCODEC=y + +# +# IEP +# +CONFIG_IEP=y +# CONFIG_IEP_MMU is not set + +# +# DP +# + +# +# ROCKCHIP_MPP +# +CONFIG_ROCKCHIP_MPP_SERVICE=y +CONFIG_ROCKCHIP_MPP_DEVICE=y +# CONFIG_VGASTATE is not set +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_HDMI=y +CONFIG_HDMI_NOTIFIERS=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_LOGO is not set +CONFIG_SOUND=y +# CONFIG_SOUND_OSS_CORE is not set +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_PCM_ELD=y +CONFIG_SND_PCM_IEC958=y +CONFIG_SND_DMAENGINE_PCM=y +CONFIG_SND_HWDEP=m +CONFIG_SND_RAWMIDI=m +CONFIG_SND_JACK=y +CONFIG_SND_SEQUENCER=y +CONFIG_SND_SEQ_DUMMY=y +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_SEQUENCER_OSS is not set +CONFIG_SND_HRTIMER=y +CONFIG_SND_SEQ_HRTIMER_DEFAULT=y +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_PROC_FS is not set +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +CONFIG_SND_RAWMIDI_SEQ=m +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_VIRMIDI is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_AC97_POWER_SAVE is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=2048 +# CONFIG_SND_ARM is not set +# CONFIG_SND_SPI is not set +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_USB_UA101 is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_6FIRE is not set +# CONFIG_SND_USB_HIFACE is not set +# CONFIG_SND_BCD2000 is not set +# CONFIG_SND_USB_POD is not set +# CONFIG_SND_USB_PODHD is not set +# CONFIG_SND_USB_TONEPORT is not set +# CONFIG_SND_USB_VARIAX is not set +CONFIG_SND_SOC=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +# CONFIG_SND_ATMEL_SOC is not set +# CONFIG_SND_DESIGNWARE_I2S is not set + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +# CONFIG_SND_SOC_FSL_ASRC is not set +# CONFIG_SND_SOC_FSL_SAI is not set +# CONFIG_SND_SOC_FSL_SSI is not set +# CONFIG_SND_SOC_FSL_SPDIF is not set +# CONFIG_SND_SOC_FSL_ESAI is not set +# CONFIG_SND_SOC_IMX_AUDMUX is not set +CONFIG_SND_SOC_ROCKCHIP=y +# CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM is not set +CONFIG_SND_SOC_ROCKCHIP_I2S=y +# CONFIG_SND_SOC_ROCKCHIP_I2S_TDM is not set +# CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS is not set +# CONFIG_SND_SOC_ROCKCHIP_PDM is not set +CONFIG_SND_SOC_ROCKCHIP_SPDIF=y +# CONFIG_SND_SOC_ROCKCHIP_SPDIFRX is not set +# CONFIG_SND_SOC_ROCKCHIP_VAD is not set +# CONFIG_SND_SOC_ROCKCHIP_DA7219 is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG is not set +# CONFIG_SND_SOC_ROCKCHIP_HDMI_DP is not set +CONFIG_SND_SOC_ROCKCHIP_MAX98090=y +# CONFIG_SND_SOC_ROCKCHIP_MULTICODECS is not set +CONFIG_SND_SOC_ROCKCHIP_RT5645=y +# CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749 is not set +# CONFIG_SND_SOC_ROCKCHIP_CDNDP is not set + +# +# Allwinner SoC Audio support +# +# CONFIG_SND_SUN4I_CODEC is not set +# CONFIG_SND_SOC_XTFPGA_I2S is not set +CONFIG_SND_SOC_I2C_AND_SPI=y + +# +# CODEC drivers +# +# CONFIG_SND_SOC_AC97_CODEC is not set +# CONFIG_SND_SOC_ADAU1701 is not set +# CONFIG_SND_SOC_AK4104 is not set +# CONFIG_SND_SOC_AK4554 is not set +# CONFIG_SND_SOC_AK4613 is not set +# CONFIG_SND_SOC_AK4642 is not set +# CONFIG_SND_SOC_AK5386 is not set +# CONFIG_SND_SOC_ALC5623 is not set +# CONFIG_SND_SOC_CS35L32 is not set +# CONFIG_SND_SOC_CS42L51_I2C is not set +# CONFIG_SND_SOC_CS42L52 is not set +# CONFIG_SND_SOC_CS42L56 is not set +# CONFIG_SND_SOC_CS42L73 is not set +# CONFIG_SND_SOC_CS4265 is not set +# CONFIG_SND_SOC_CS4270 is not set +# CONFIG_SND_SOC_CS4271_I2C is not set +# CONFIG_SND_SOC_CS4271_SPI is not set +# CONFIG_SND_SOC_CS42XX8_I2C is not set +# CONFIG_SND_SOC_CS4349 is not set +# CONFIG_SND_SOC_CX2072X is not set +# CONFIG_SND_SOC_CX20810 is not set +# CONFIG_SND_SOC_DUMMY_CODEC is not set +# CONFIG_SND_SOC_BT_SCO is not set +# CONFIG_SND_SOC_ES8316 is not set +CONFIG_SND_SOC_ES8323=y +CONFIG_SND_SOC_HDMI_CODEC=y +# CONFIG_SND_SOC_ES8328 is not set +# CONFIG_SND_SOC_ES8328_I2C is not set +# CONFIG_SND_SOC_ES8396 is not set +# CONFIG_SND_SOC_GTM601 is not set +# CONFIG_SND_SOC_GVA_CODEC is not set +# CONFIG_SND_SOC_FM1288 is not set +CONFIG_SND_SOC_MAX98090=y +# CONFIG_SND_SOC_PCM1681 is not set +# CONFIG_SND_SOC_PCM1792A is not set +# CONFIG_SND_SOC_PCM512x_I2C is not set +# CONFIG_SND_SOC_PCM512x_SPI is not set +# CONFIG_SND_SOC_RK312X is not set +# CONFIG_SND_SOC_RK3228 is not set +# CONFIG_SND_SOC_RK3308 is not set +# CONFIG_SND_SOC_RK3328 is not set +# CONFIG_SND_SOC_RK817 is not set +CONFIG_SND_SOC_RL6231=y +CONFIG_SND_SOC_RT5616=y +# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_RT5640=y +CONFIG_SND_SOC_RT5645=y +# CONFIG_SND_SOC_RT5651 is not set +# CONFIG_SND_SOC_RT5677_SPI is not set +# CONFIG_SND_SOC_SGTL5000 is not set +# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SPDIF=y +# CONFIG_SND_SOC_SSM2602_SPI is not set +# CONFIG_SND_SOC_SSM2602_I2C is not set +# CONFIG_SND_SOC_SSM4567 is not set +# CONFIG_SND_SOC_STA32X is not set +# CONFIG_SND_SOC_STA350 is not set +# CONFIG_SND_SOC_STI_SAS is not set +# CONFIG_SND_SOC_TAS2552 is not set +# CONFIG_SND_SOC_TAS5086 is not set +# CONFIG_SND_SOC_TAS571X is not set +# CONFIG_SND_SOC_TC358749X is not set +# CONFIG_SND_SOC_TFA9879 is not set +# CONFIG_SND_SOC_TLV320AIC23_I2C is not set +# CONFIG_SND_SOC_TLV320AIC23_SPI is not set +# CONFIG_SND_SOC_TLV320AIC31XX is not set +# CONFIG_SND_SOC_TLV320AIC3X is not set +CONFIG_SND_SOC_TS3A227E=y +# CONFIG_SND_SOC_WM8510 is not set +# CONFIG_SND_SOC_WM8523 is not set +# CONFIG_SND_SOC_WM8580 is not set +# CONFIG_SND_SOC_WM8711 is not set +# CONFIG_SND_SOC_WM8728 is not set +# CONFIG_SND_SOC_WM8731 is not set +# CONFIG_SND_SOC_WM8737 is not set +# CONFIG_SND_SOC_WM8741 is not set +# CONFIG_SND_SOC_WM8750 is not set +# CONFIG_SND_SOC_WM8753 is not set +# CONFIG_SND_SOC_WM8770 is not set +# CONFIG_SND_SOC_WM8776 is not set +# CONFIG_SND_SOC_WM8804_I2C is not set +# CONFIG_SND_SOC_WM8804_SPI is not set +# CONFIG_SND_SOC_WM8903 is not set +# CONFIG_SND_SOC_WM8962 is not set +# CONFIG_SND_SOC_WM8978 is not set +# CONFIG_SND_SOC_TPA6130A2 is not set +CONFIG_SND_SIMPLE_CARD=y +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m + +# +# HID support +# +CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=y +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +CONFIG_HID_AUREAL=y +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +CONFIG_HID_KYE=y +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LENOVO=y +CONFIG_HID_LOGITECH=y +CONFIG_HID_LOGITECH_DJ=y +CONFIG_HID_LOGITECH_HIDPP=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=m +# CONFIG_HID_NTRIG is not set +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=y +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_SONY_FF=y +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +CONFIG_HID_RMI=y +# CONFIG_HID_GREENASIA is not set +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=y +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +# CONFIG_HID_THRUSTMASTER is not set +# CONFIG_HID_WACOM is not set +CONFIG_HID_WIIMOTE=m +CONFIG_HID_XINMO=y +# CONFIG_HID_ZEROPLUS is not set +CONFIG_HID_ZYDACRON=y +# CONFIG_HID_SENSOR_HUB is not set +# CONFIG_HID_RKVR is not set +# CONFIG_HID_ALPS is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +CONFIG_USB_HIDDEV=y + +# +# I2C HID support +# +CONFIG_I2C_HID=y +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +# CONFIG_USB_DEFAULT_PERSIST is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +CONFIG_USB_OTG=y +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG_FSM is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=y +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_MAX3421_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=y +# CONFIG_USB_PRINTER is not set +CONFIG_USB_WDM=y +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +# CONFIG_USB_UAS is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +CONFIG_USB_DWC2=y +# CONFIG_USB_DWC2_HOST is not set + +# +# Gadget/Dual-role mode requires USB Gadget support to be enabled +# +# CONFIG_USB_DWC2_PERIPHERAL is not set +CONFIG_USB_DWC2_DUAL_ROLE=y +# CONFIG_USB_DWC2_DEBUG is not set +# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +# CONFIG_USB_CHIPIDEA is not set +# CONFIG_USB_ISP1760 is not set + +# +# USB port drivers +# +CONFIG_USB_SERIAL=y +# CONFIG_USB_SERIAL_CONSOLE is not set +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_SIMPLE is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +CONFIG_USB_SERIAL_CP210X=y +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_EMPEG is not set +CONFIG_USB_SERIAL_FTDI_SIO=y +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_F81232 is not set +# CONFIG_USB_SERIAL_GARMIN is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +CONFIG_USB_SERIAL_KEYSPAN=y +# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set +# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_METRO is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MXUPORT is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +CONFIG_USB_SERIAL_PL2303=y +CONFIG_USB_SERIAL_OTI6858=y +# CONFIG_USB_SERIAL_QCAUX is not set +CONFIG_USB_SERIAL_QUALCOMM=y +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SAFE is not set +CONFIG_USB_SERIAL_SIERRAWIRELESS=y +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +CONFIG_USB_SERIAL_WWAN=y +CONFIG_USB_SERIAL_OPTION=y +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_XSENS_MT is not set +# CONFIG_USB_SERIAL_WISHBONE is not set +# CONFIG_USB_SERIAL_SSU100 is not set +# CONFIG_USB_SERIAL_QT2 is not set +# CONFIG_USB_SERIAL_DEBUG is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +CONFIG_USB_EZUSB_FX2=y +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_USB_PHY is not set +# CONFIG_USB_OTG_WAKELOCK is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +CONFIG_USB_GADGET_DEBUG_FILES=y +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +# +# USB Peripheral Controller +# +# CONFIG_USB_FUSB300 is not set +# CONFIG_USB_FOTG210_UDC is not set +# CONFIG_USB_GR_UDC is not set +# CONFIG_USB_R8A66597 is not set +# CONFIG_USB_PXA27X is not set +# CONFIG_USB_MV_UDC is not set +# CONFIG_USB_MV_U3D is not set +# CONFIG_USB_M66592 is not set +# CONFIG_USB_BDC_UDC is not set +# CONFIG_USB_NET2272 is not set +# CONFIG_USB_GADGET_XILINX is not set +# CONFIG_USB_DUMMY_HCD is not set +CONFIG_USB_LIBCOMPOSITE=m +CONFIG_USB_F_ACM=m +CONFIG_USB_U_SERIAL=m +CONFIG_USB_F_MASS_STORAGE=m +CONFIG_USB_F_FS=m +CONFIG_USB_CONFIGFS=m +# CONFIG_USB_CONFIGFS_SERIAL is not set +CONFIG_USB_CONFIGFS_ACM=y +# CONFIG_USB_CONFIGFS_OBEX is not set +# CONFIG_USB_CONFIGFS_NCM is not set +# CONFIG_USB_CONFIGFS_ECM is not set +# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set +# CONFIG_USB_CONFIGFS_RNDIS is not set +# CONFIG_USB_CONFIGFS_EEM is not set +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +# CONFIG_USB_CONFIGFS_F_LB_SS is not set +CONFIG_USB_CONFIGFS_F_FS=y +# CONFIG_USB_CONFIGFS_F_MTP is not set +# CONFIG_USB_CONFIGFS_F_ACC is not set +CONFIG_USB_CONFIGFS_UEVENT=y +# CONFIG_USB_CONFIGFS_F_UAC1 is not set +# CONFIG_USB_CONFIGFS_F_UAC2 is not set +# CONFIG_USB_CONFIGFS_F_MIDI is not set +# CONFIG_USB_CONFIGFS_F_HID is not set +# CONFIG_USB_CONFIGFS_F_UVC is not set +# CONFIG_USB_CONFIGFS_F_PRINTER is not set +# CONFIG_USB_ZERO is not set +# CONFIG_USB_AUDIO is not set +# CONFIG_USB_ETH is not set +# CONFIG_USB_G_NCM is not set +# CONFIG_USB_GADGETFS is not set +# CONFIG_USB_FUNCTIONFS is not set +# CONFIG_USB_MASS_STORAGE is not set +# CONFIG_USB_G_SERIAL is not set +# CONFIG_USB_MIDI_GADGET is not set +# CONFIG_USB_G_PRINTER is not set +# CONFIG_USB_CDC_COMPOSITE is not set +# CONFIG_USB_G_ACM_MS is not set +# CONFIG_USB_G_MULTI is not set +# CONFIG_USB_G_HID is not set +# CONFIG_USB_G_DBGP is not set +# CONFIG_USB_G_WEBCAM is not set + +# +# ROCKCHIP USB Support +# +# CONFIG_USB20_HOST is not set +# CONFIG_USB20_OTG is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC_EMBEDDED_SDIO is not set +# CONFIG_MMC_PARANOID_SD_INIT is not set +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=16 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +CONFIG_MMC_TEST=y +# CONFIG_MMC_SIMULATE_MAX_SPEED is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_OF_ARASAN is not set +# CONFIG_MMC_SDHCI_OF_AT91 is not set +# CONFIG_MMC_SDHCI_F_SDH30 is not set +CONFIG_MMC_DW=y +CONFIG_MMC_DW_PLTFM=y +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_K3 is not set +CONFIG_MMC_DW_ROCKCHIP=y +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_CLASS_FLASH is not set + +# +# LED drivers +# +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_DAC124S085 is not set +# CONFIG_LEDS_PWM is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_LEDS_TRIGGER_MULTI_CTRL is not set +# CONFIG_SWITCH is not set +# CONFIG_ACCESSIBILITY is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_FAKE is not set +CONFIG_RTC_DRV_HYM8563=y +# CONFIG_RTC_DRV_MAX6900 is not set +CONFIG_RTC_DRV_RK808=y +# CONFIG_RTC_DRV_RK_TIMER is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_TPS6586X is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_MCP795 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +# CONFIG_AMBA_PL08X is not set +# CONFIG_FSL_EDMA is not set +# CONFIG_INTEL_IDMA64 is not set +# CONFIG_NBPFAXI_DMA is not set +CONFIG_PL330_DMA=y +# CONFIG_DW_DMAC is not set + +# +# DMA Clients +# +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_DMATEST is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VFIO is not set +# CONFIG_VIRT_DRIVERS is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_MMIO is not set + +# +# Microsoft Hyper-V guest support +# +CONFIG_STAGING=y +# CONFIG_PRISM2_USB is not set +# CONFIG_COMEDI is not set +# CONFIG_RTLLIB is not set +# CONFIG_R8712U is not set +# CONFIG_R8188EU is not set +# CONFIG_R8723AU is not set +# CONFIG_VT6656 is not set + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16201 is not set +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16204 is not set +# CONFIG_ADIS16209 is not set +# CONFIG_ADIS16220 is not set +# CONFIG_ADIS16240 is not set +# CONFIG_LIS3L02DQ is not set +# CONFIG_SCA3000 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7606 is not set +# CONFIG_AD7780 is not set +# CONFIG_AD7816 is not set +# CONFIG_AD7192 is not set +# CONFIG_AD7280 is not set + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7152 is not set +# CONFIG_AD7746 is not set + +# +# Direct Digital Synthesis +# +# CONFIG_AD9832 is not set +# CONFIG_AD9834 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16060 is not set + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set +# CONFIG_INV_MPU_IIO is not set + +# +# Light sensors +# +CONFIG_SENSORS_ISL29018=y +# CONFIG_SENSORS_ISL29028 is not set +CONFIG_TSL2583=y +# CONFIG_TSL2x7x is not set + +# +# Magnetometer sensors +# +# CONFIG_SENSORS_HMC5843_I2C is not set +# CONFIG_SENSORS_HMC5843_SPI is not set + +# +# Active energy metering IC +# +# CONFIG_ADE7753 is not set +# CONFIG_ADE7754 is not set +# CONFIG_ADE7758 is not set +# CONFIG_ADE7759 is not set +# CONFIG_ADE7854 is not set + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set + +# +# Triggers - standalone +# +# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set +# CONFIG_IIO_SIMPLE_DUMMY is not set + +# +# Speakup console speech +# +# CONFIG_SPEAKUP is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set +# CONFIG_STAGING_MEDIA is not set + +# +# Android +# +# CONFIG_ASHMEM is not set +# CONFIG_ANDROID_TIMED_OUTPUT is not set +# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set +# CONFIG_SYNC is not set +# CONFIG_ION is not set +# CONFIG_FIQ_DEBUGGER is not set +# CONFIG_FIQ_WATCHDOG is not set +# CONFIG_RK_CONSOLE_THREAD is not set +# CONFIG_STAGING_BOARD is not set +# CONFIG_WIMAX_GDM72XX is not set +# CONFIG_LTE_GDM724X is not set +# CONFIG_LUSTRE_FS is not set +# CONFIG_DGAP is not set +# CONFIG_GS_FPGABOOT is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_FB_TFT is not set +# CONFIG_WILC1000_DRIVER is not set +# CONFIG_MOST is not set +# CONFIG_POWERVR_ROGUE_N is not set +# CONFIG_GOLDFISH is not set +CONFIG_CHROME_PLATFORMS=y +# CONFIG_CROS_EC_CHARDEV is not set +CONFIG_CROS_EC_PROTO=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +CONFIG_COMMON_CLK_RK808=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_PWM is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_CDCE706 is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_ROCKCHIP_TIMER=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_ARCH_TIMER_VCT_ACCESS=y +# CONFIG_ARM_TIMER_SP804 is not set +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +# CONFIG_MAILBOX is not set +CONFIG_IOMMU_API=y +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_IOVA=y +CONFIG_OF_IOMMU=y +CONFIG_IOMMU_DMA=y +CONFIG_ROCKCHIP_IOMMU=y +# CONFIG_RK_IOMMU is not set +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SOC_BRCMSTB is not set + +# +# CPU selection +# +# CONFIG_CPU_RK312X is not set +# CONFIG_CPU_RK3036 is not set +# CONFIG_CPU_RK30XX is not set +# CONFIG_CPU_RK3188 is not set +CONFIG_CPU_RK3288=y +# CONFIG_CPU_RK322X is not set +# CONFIG_CPU_RV110X is not set +# CONFIG_CPU_PX30 is not set +# CONFIG_CPU_RK1808 is not set +# CONFIG_CPU_RK3308 is not set +# CONFIG_CPU_RK3328 is not set +# CONFIG_CPU_RK3366 is not set +# CONFIG_CPU_RK3368 is not set +# CONFIG_CPU_RK3399 is not set +CONFIG_ANDROID_VERSION=0x07010000 +CONFIG_ROCKCHIP_CPUINFO=y +# CONFIG_ROCKCHIP_DEVICEINFO is not set +CONFIG_ROCKCHIP_OPP=y +# CONFIG_ROCKCHIP_PM_TEST is not set +CONFIG_ROCKCHIP_GRF=y +CONFIG_ROCKCHIP_PM_DOMAINS=y +CONFIG_ROCKCHIP_PVTM=y +CONFIG_ROCKCHIP_SUSPEND_MODE=y +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y + +# +# DEVFREQ Drivers +# +CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y +CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y +# CONFIG_EXTCON is not set +CONFIG_MEMORY=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +# CONFIG_IIO_BUFFER_CB is not set +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 + +# +# Accelerometers +# +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set + +# +# Analog to digital converters +# +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_HI8435 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_NAU7802 is not set +CONFIG_ROCKCHIP_SARADC=y +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_VF610_ADC is not set + +# +# Amplifiers +# +# CONFIG_AD8366 is not set + +# +# Chemical Sensors +# +# CONFIG_VZ89X is not set + +# +# Hid Sensor IIO Common +# + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set + +# +# Digital to analog converters +# +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +# CONFIG_AD9523 is not set + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set + +# +# Digital gyroscope sensors +# +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set + +# +# Humidity sensors +# +# CONFIG_DHT11 is not set +# CONFIG_HDC100X is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_IIO is not set + +# +# Light sensors +# +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_ISL29125 is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_STK3310 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set +CONFIG_SENSORS_TSL2563=y +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VL6180 is not set + +# +# Magnetometer sensors +# +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN is not set +# CONFIG_MAG3110 is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set + +# +# Inclinometer sensors +# + +# +# Triggers - standalone +# +# CONFIG_IIO_INTERRUPT_TRIGGER is not set +CONFIG_IIO_SYSFS_TRIGGER=y + +# +# Digital potentiometers +# +# CONFIG_MCP4531 is not set + +# +# Pressure sensors +# +# CONFIG_BMP280 is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set + +# +# Proximity sensors +# +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_SX9500 is not set + +# +# Temperature sensors +# +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_CROS_EC is not set +# CONFIG_PWM_FSL_FTM is not set +CONFIG_PWM_GPIO=y +# CONFIG_PWM_PCA9685 is not set +CONFIG_PWM_ROCKCHIP=y +# CONFIG_PWM_ROCKCHIP_I2S is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +# CONFIG_IPACK_BUS is not set +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_RESET_CONTROLLER=y +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set +CONFIG_PHY_ROCKCHIP_USB=y +# CONFIG_PHY_ROCKCHIP_INNO_USB2 is not set +# CONFIG_PHY_ROCKCHIP_INNO_USB3 is not set +CONFIG_PHY_ROCKCHIP_EMMC=y +CONFIG_PHY_ROCKCHIP_DP=y +# CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY is not set +# CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY is not set +# CONFIG_PHY_ROCKCHIP_TYPEC is not set +# CONFIG_PHY_ROCKCHIP_PCIE is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_PMU=y +CONFIG_RAS=y + +# +# Android +# +CONFIG_ANDROID=y +# CONFIG_ANDROID_BINDER_IPC is not set +CONFIG_NVMEM=y +CONFIG_ROCKCHIP_EFUSE=y +CONFIG_ROCKCHIP_OTP=y +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set +# CONFIG_TEE is not set +# CONFIG_RK_FLASH is not set +# CONFIG_RK_NAND is not set + +# +# Headset device support +# +# CONFIG_RK_HEADSET is not set + +# +# Firmware Drivers +# +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_HAVE_ARM_SMCCC=y +CONFIG_ROCKCHIP_SIP=y + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +CONFIG_EXT4_FS=y +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set +CONFIG_JFS_FS=m +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_STATISTICS is not set +CONFIG_XFS_FS=m +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +# CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set +CONFIG_BTRFS_FS=m +# CONFIG_BTRFS_FS_POSIX_ACL is not set +# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_NILFS2_FS is not set +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +# CONFIG_F2FS_FS_XATTR is not set +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_IO_TRACE is not set +# CONFIG_F2FS_FAULT_INJECTION is not set +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_FILE_LOCKING=y +# CONFIG_FS_ENCRYPTION is not set +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=m +# CONFIG_CUSE is not set +CONFIG_OVERLAY_FS=m + +# +# Caches +# +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_UDF_NLS=y + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_PROC_UID=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_HUGETLB_PAGE is not set +CONFIG_CONFIGFS_FS=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_ECRYPT_FS is not set +# CONFIG_SDCARD_FS is not set +CONFIG_HFS_FS=y +CONFIG_HFSPLUS_FS=y +# CONFIG_HFSPLUS_FS_POSIX_ACL is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_LOGFS is not set +# CONFIG_CRAMFS is not set +CONFIG_SQUASHFS=y +# CONFIG_SQUASHFS_DECOMP_SINGLE is not set +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V4=y +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_BLOCK=m +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +CONFIG_CIFS=y +CONFIG_CIFS_STATS=y +CONFIG_CIFS_STATS2=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_UPCALL is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_DEBUG is not set +# CONFIG_CIFS_DFS_UPCALL is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_SMB311=y +CONFIG_CIFS_FSCACHE=y +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +# CONFIG_PRINTK_PROCESS is not set +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +# CONFIG_GDB_SCRIPTS is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=2048 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +CONFIG_FRAME_POINTER=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_HIGHMEM is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +CONFIG_LOCKUP_DETECTOR=y +CONFIG_HARDLOCKUP_DETECTOR_OTHER_CPU=y +CONFIG_HARDLOCKUP_DETECTOR=y +# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1 +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=1 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_INFO=y +# CONFIG_PANIC_ON_RT_THROTTLING is not set +CONFIG_SCHEDSTATS=y +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +CONFIG_TIMER_STATS=y + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +CONFIG_DEBUG_SPINLOCK=y +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +CONFIG_DEBUG_CREDENTIALS=y + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_GPU_TRACEPOINTS=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y +# CONFIG_PREEMPTIRQ_EVENTS is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +CONFIG_BLK_DEV_IO_TRACE=y +# CONFIG_UPROBE_EVENT is not set +# CONFIG_PROBE_EVENTS is not set +CONFIG_DYNAMIC_FTRACE=y +# CONFIG_FUNCTION_PROFILER is not set +CONFIG_FTRACE_MCOUNT_RECORD=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_TRACE_ENUM_MAP_FILE is not set +CONFIG_TRACING_EVENTS_GPIO=y + +# +# Runtime Testing +# +CONFIG_LKDTM=y +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_ARM_PTDUMP is not set +CONFIG_STRICT_DEVMEM=y +CONFIG_ARM_UNWIND=y +CONFIG_OLD_MCOUNT=y +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_PID_IN_CONTEXTIDR is not set +CONFIG_DEBUG_SET_MODULE_RONX=y +# CONFIG_CORESIGHT is not set + +# +# Security options +# +CONFIG_KEYS=y +# CONFIG_PERSISTENT_KEYRINGS is not set +# CONFIG_BIG_KEYS is not set +# CONFIG_TRUSTED_KEYS is not set +# CONFIG_ENCRYPTED_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY_PERF_EVENTS_RESTRICT is not set +# CONFIG_SECURITY is not set +CONFIG_SECURITYFS=y +CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y +CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y +# CONFIG_HARDENED_USERCOPY is not set +# CONFIG_TEE_SUPPORT is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_XOR_BLOCKS=m +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +CONFIG_CRYPTO_SEQIV=y +# CONFIG_CRYPTO_ECHAINIV is not set + +# +# Block modes +# +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_HEH is not set +CONFIG_CRYPTO_CTR=y +# CONFIG_CRYPTO_CTS is not set +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_HMAC=y +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_GHASH=y +# CONFIG_CRYPTO_POLY1305 is not set +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +CONFIG_CRYPTO_ARC4=y +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +CONFIG_CRYPTO_DES=y +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SPECK is not set +# CONFIG_CRYPTO_TEA is not set +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_TWOFISH_COMMON=y + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_ZLIB is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_USER_API=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_HW=y +# CONFIG_CRYPTO_DEV_ROCKCHIP is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_PUBLIC_KEY_ALGO_RSA=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +# CONFIG_PKCS7_TEST_KEY is not set +# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set + +# +# Certificates for signature checking +# +# CONFIG_SYSTEM_TRUSTED_KEYRING is not set +# CONFIG_ARM_CRYPTO is not set +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=m +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +CONFIG_CRC7=y +CONFIG_LIBCRC32C=y +# CONFIG_CRC8 is not set +CONFIG_XXHASH=y +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=m +CONFIG_LZO_COMPRESS=m +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=m +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +# CONFIG_XZ_DEC_X86 is not set +# CONFIG_XZ_DEC_POWERPC is not set +# CONFIG_XZ_DEC_IA64 is not set +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +# CONFIG_XZ_DEC_SPARC is not set +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_CLZ_TAB=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_MPILIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y +# CONFIG_VIRTUALIZATION is not set diff --git a/projects/Rockchip/devices/TinkerBoard/options b/projects/Rockchip/devices/TinkerBoard/options new file mode 100644 index 0000000000..76a8e4fd34 --- /dev/null +++ b/projects/Rockchip/devices/TinkerBoard/options @@ -0,0 +1,30 @@ +################################################################################ +# setup device defaults +################################################################################ + + # The TARGET_CPU variable controls which processor should be targeted for + # generated code. + case $TARGET_ARCH in + arm) + TARGET_FLOAT="hard" + TARGET_CPU="cortex-a17" + TARGET_FPU="neon-vfpv4" + TARGET_FEATURES="32bit" + KERNEL_LINARO_TOOLCHAIN="arm-linux-gnueabihf" + ;; + esac + + # Configuration for u-boot + UBOOT_SYSTEM="rk3288" + + # Kernel target + KERNEL_TARGET="zImage" + + # Additional kernel make parameters (for example to specify the u-boot loadaddress) + KERNEL_MAKE_EXTRACMD="rk3288-miniarm.dtb" + + # Mali GPU family + MALI_FAMILY="t760" + + # kernel serial console + EXTRA_CMDLINE="console=uart8250,mmio32,0xff690000 console=tty0" diff --git a/projects/Rockchip/filesystem/usr/bin/cputemp b/projects/Rockchip/filesystem/usr/bin/cputemp new file mode 100755 index 0000000000..11535271c5 --- /dev/null +++ b/projects/Rockchip/filesystem/usr/bin/cputemp @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" +echo "$(( $TEMP / 1000 )) C" diff --git a/projects/Rockchip/filesystem/usr/bin/gputemp b/projects/Rockchip/filesystem/usr/bin/gputemp new file mode 120000 index 0000000000..6476b954d2 --- /dev/null +++ b/projects/Rockchip/filesystem/usr/bin/gputemp @@ -0,0 +1 @@ +cputemp \ No newline at end of file diff --git a/projects/Rockchip/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf b/projects/Rockchip/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf new file mode 100644 index 0000000000..4ca7168beb --- /dev/null +++ b/projects/Rockchip/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf @@ -0,0 +1,3 @@ +[Sleep] +SuspendMode=false +HibernateMode=false diff --git a/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service new file mode 100644 index 0000000000..80d27f78c0 --- /dev/null +++ b/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service @@ -0,0 +1,24 @@ +[Unit] +Description=Debug Shell on /dev/ttyS2 +DefaultDependencies=no +ConditionKernelCommandLine=|console=ttyS2 +ConditionKernelCommandLine=|console=uart8250,mmio32,0xff130000 +ConditionKernelCommandLine=|console=uart8250,mmio32,0xff1a0000 +ConditionKernelCommandLine=|console=uart8250,mmio32,0xff690000 + +[Service] +WorkingDirectory=/storage +Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' +ExecStart=/bin/sh +Restart=always +RestartSec=0 +StandardInput=tty +TTYPath=/dev/ttyS2 +KillMode=process +IgnoreSIGPIPE=no +# bash ignores SIGTERM +KillSignal=SIGHUP + +[Install] +WantedBy=sysinit.target diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf new file mode 100644 index 0000000000..a79abf8d3e --- /dev/null +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf @@ -0,0 +1,34 @@ +# +# Configuration for HDMI +# + + + +HDMI.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf new file mode 100644 index 0000000000..0a21710eaa --- /dev/null +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf @@ -0,0 +1,12 @@ +# +# Configuration for I2S +# + + + +I2S.pcm.front.0 { + @args [ CARD ] + @args.CARD { type string } + type hw + card $CARD +} diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf new file mode 100644 index 0000000000..1618b55161 --- /dev/null +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf @@ -0,0 +1,34 @@ +# +# Configuration for SPDIF +# + + + +SPDIF.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Rockchip/kodi/appliance.xml b/projects/Rockchip/kodi/appliance.xml new file mode 100644 index 0000000000..349df96ec0 --- /dev/null +++ b/projects/Rockchip/kodi/appliance.xml @@ -0,0 +1,60 @@ + + +
+ + + + 0384002160060.00000pstd,0384002160059.94006pstd,0384002160050.00000pstd,0384002160030.00000pstd,0384002160029.97003pstd,0384002160025.00000pstd,0384002160024.00000pstd,0384002160023.97602pstd,0192001080060.00000pstd,0192001080059.94006pstd,0192001080050.00000pstd,0192001080030.00000pstd,0192001080029.97003pstd,0192001080024.00000pstd,0192001080023.97602pstd,0128000720060.00000pstd,0128000720059.94006pstd,0128000720050.00000pstd + + + false + + + false + + + 3 + true + + + true + + + + + 2 + false + + + + + + + ALSA:hdmi:CARD=HDMI,DEV=0 + + + + + + + false + + + +
+
+ + + + 2 + + + + + 2 + true + + + +
+
diff --git a/projects/Rockchip/options b/projects/Rockchip/options new file mode 100644 index 0000000000..4d9e18fab6 --- /dev/null +++ b/projects/Rockchip/options @@ -0,0 +1,87 @@ +################################################################################ +# setup system defaults +################################################################################ + + # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) + BOOTLOADER="u-boot" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="${LINUX:-rockchip-4.4}" + +################################################################################ +# setup build defaults +################################################################################ + + # Project CFLAGS + PROJECT_CFLAGS="" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="lzo" + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / mesa) + OPENGL="no" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) + OPENGLES="libmali" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="no" + + # Displayserver to use (weston / no) + DISPLAYSERVER="no" + + # Windowmanager to use (fluxbox / none) + WINDOWMANAGER="none" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="" + + # Use a vendor specific KODI repo + KODI_VENDOR="rockchip" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) + KODIPLAYER_DRIVER="$OPENGLES" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware rockchip-firmware" + + # additional packages to install + ADDITIONAL_PACKAGES="dtc" + + # build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="no" + + # build and install CEC framework support (yes / no) + CEC_FRAMEWORK_SUPPORT="yes" + + # build with installer (yes / no) + INSTALLER_SUPPORT="no" + + # Start boot partition at 16MiB, same as https://github.com/rockchip-linux/build images + SYSTEM_PART_START=32768 + + # build and install driver addons (yes / no) + DRIVER_ADDONS_SUPPORT="yes" + + # driver addons to install: + # for a list of additinoal drivers see packages/linux-driver-addons + # Space separated list is supported, + DRIVER_ADDONS="crazycat dvb-latest" diff --git a/projects/Rockchip/patches/libdrm/libdrm-0001-add-rochchip-10bits-formats.patch b/projects/Rockchip/patches/libdrm/libdrm-0001-add-rochchip-10bits-formats.patch new file mode 100644 index 0000000000..a31a510622 --- /dev/null +++ b/projects/Rockchip/patches/libdrm/libdrm-0001-add-rochchip-10bits-formats.patch @@ -0,0 +1,16 @@ +--- ./include/drm/drm_fourcc.h 2017-09-04 10:45:05.812784940 -0700 ++++ ./include/drm/drm_fourcc.h 2017-09-04 10:45:27.831516420 -0700 +@@ -116,6 +116,13 @@ + #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ + #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ + ++#define DRM_FORMAT_NV12_10 fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */ ++#define DRM_FORMAT_NV21_10 fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */ ++#define DRM_FORMAT_NV16_10 fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */ ++#define DRM_FORMAT_NV61_10 fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */ ++#define DRM_FORMAT_NV24_10 fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */ ++#define DRM_FORMAT_NV42_10 fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */ ++ + /* + * 3 plane YCbCr + * index 0: Y plane, [7:0] Y diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0000-Revert-rk-add-gcc-wrapper.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0000-Revert-rk-add-gcc-wrapper.patch new file mode 100644 index 0000000000..b5d30ff740 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0000-Revert-rk-add-gcc-wrapper.patch @@ -0,0 +1,27 @@ +From a968000cae7b5d0c3c10b4e5a94fd187c891ee08 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 27 Dec 2017 22:01:06 +0100 +Subject: [PATCH] Revert "rk: add gcc-wrapper" + +This reverts part of commit 7a51384d24fe4da183fc15b2d17aa3c153b822e7. +--- + Makefile | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/Makefile b/Makefile +index a785aeed4674..d34c20a89fb7 100644 +--- a/Makefile ++++ b/Makefile +@@ -372,12 +372,6 @@ PERL = perl + PYTHON = python + CHECK = sparse + +-# Use the wrapper for the compiler. This wrapper scans for new +-# warnings and causes the build to stop upon encountering them. +-ifneq ($(wildcard $(srctree)/scripts/gcc-wrapper.py),) +-CC = $(srctree)/scripts/gcc-wrapper.py $(CROSS_COMPILE)gcc +-endif +- + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ + -Wbitwise -Wno-return-void $(CF) + CFLAGS_MODULE = diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0001-rockchip.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0001-rockchip.patch new file mode 100644 index 0000000000..3bd8ea1067 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0001-rockchip.patch @@ -0,0 +1,24310 @@ +From 92b97663794c1ad57aaf7e66ee418bfce635a494 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 17 Apr 2017 13:09:16 +0200 +Subject: [PATCH] sound/usb/quirks-table: add Realtek ALC4040 + +--- + sound/usb/quirks-table.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 69bf5cf1e91e..00672a818145 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -3324,4 +3324,13 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), + } + }, + ++{ ++ USB_DEVICE(0x0bda, 0x481a), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "Realtek", ++ .product_name = "ALC4040", ++ .ifnum = QUIRK_NO_INTERFACE ++ } ++}, ++ + #undef USB_DEVICE_VENDOR_SPEC + +From 61382c4e328df487f69b2095865c2e9e2c9e4121 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 28 May 2017 09:08:50 +0200 +Subject: [PATCH] gpu/arm/mali400: default to performance gpu governor + +--- + drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c b/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c +index c9b8652f100d..6c97c530a2ae 100644 +--- a/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c ++++ b/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c +@@ -259,7 +259,7 @@ int mali_devfreq_init(struct mali_device *mdev) + return -EFAULT; + + mdev->devfreq = devfreq_add_device(mdev->dev, dp, +- "simple_ondemand", NULL); ++ "performance", NULL); + if (IS_ERR(mdev->devfreq)) { + mali_devfreq_term_freq_table(mdev); + return PTR_ERR(mdev->devfreq); + +From 0fcd82216c0161c9dd6b54ee505988c539df91fb Mon Sep 17 00:00:00 2001 +From: LongChair +Date: Fri, 21 Apr 2017 13:39:12 +0200 +Subject: [PATCH] drm/rockchip: remove unsupported 4K freqs + +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index a58edabe600c..7273561fe6b1 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -510,9 +510,15 @@ dw_hdmi_rockchip_mode_valid(struct drm_connector *connector, + return MODE_BAD; + + hdmi = to_rockchip_hdmi(encoder); +- if (hdmi->dev_type == RK3368_HDMI && mode->clock > 340000 && ++ if ((hdmi->dev_type == RK3368_HDMI || hdmi->dev_type == RK3328_HDMI) && ++ mode->clock > 340000 && + !drm_mode_is_420(&connector->display_info, mode)) + return MODE_BAD; ++ ++ /* Skip bad clocks for RK3288 */ ++ if (hdmi->dev_type == RK3288_HDMI && (mode->clock < 27500 || mode->clock > 340000)) ++ return MODE_CLOCK_RANGE; ++ + /* + * ensure all drm display mode can work, if someone want support more + * resolutions, please limit the possible_crtc, only connect to + +From 28e3e0508d53dd697fc3dd75588bba08adee1bb0 Mon Sep 17 00:00:00 2001 +From: xuhuicong +Date: Fri, 23 Jun 2017 18:56:17 +0800 +Subject: [PATCH] drm/rockchip: hdmi: fix no sound some time + +Change-Id: Ic9f931d9a5b7bca954363293a20ca242eb0bfa6f +Signed-off-by: xuhuicong +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 8cb2cb4e61a6..30b6bd979eb8 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1991,10 +1991,6 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, + HDMI_FC_INVIDCONF_IN_I_P_INTERLACED : + HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE; + +- inv_val |= hdmi->sink_is_hdmi ? +- HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE : +- HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE; +- + hdmi_writeb(hdmi, inv_val, HDMI_FC_INVIDCONF); + + hdisplay = mode->hdisplay; +@@ -2292,6 +2288,9 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + /* not for DVI mode */ + if (hdmi->sink_is_hdmi) { + dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); ++ hdmi_modb(hdmi, HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE, ++ HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE, ++ HDMI_FC_INVIDCONF); + + /* HDMI Initialization Step F - Configure AVI InfoFrame */ + hdmi_config_AVI(hdmi, mode); + +From 16f51adab10ab06bfecbd0ed9e444329debb426d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 18 Nov 2017 11:09:39 +0100 +Subject: [PATCH] rockchip: vop: force skip lines if image too big + +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 76610608c723..1418402c2668 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1653,6 +1653,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + int ymirror, xmirror; + uint32_t val; + bool rb_swap, global_alpha_en; ++ int skip_lines = 0; + + #if defined(CONFIG_ROCKCHIP_DRM_DEBUG) + bool AFBC_flag = false; +@@ -1689,8 +1690,14 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + } + + mode = &crtc->state->adjusted_mode; ++ ++ /* ++ * force skip lines if image too big. ++ */ + actual_w = drm_rect_width(src) >> 16; +- actual_h = drm_rect_height(src) >> 16; ++ if (actual_w == 3840 && is_yuv_support(fb->pixel_format)) ++ skip_lines = 1; ++ actual_h = drm_rect_height(src) >> (16 + skip_lines); + act_info = (actual_h - 1) << 16 | ((actual_w - 1) & 0xffff); + + dsp_info = (drm_rect_height(dest) - 1) << 16; +@@ -1727,12 +1734,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + VOP_WIN_SET(vop, win, xmirror, xmirror); + VOP_WIN_SET(vop, win, ymirror, ymirror); + VOP_WIN_SET(vop, win, format, vop_plane_state->format); +- VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> 2); ++ VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> (2 - skip_lines)); + VOP_WIN_SET(vop, win, yrgb_mst, vop_plane_state->yrgb_mst); + VOP_WIN_SET(vop, win, yrgb_mst1, vop_plane_state->yrgb_mst); + + if (is_yuv_support(fb->pixel_format)) { +- VOP_WIN_SET(vop, win, uv_vir, fb->pitches[1] >> 2); ++ VOP_WIN_SET(vop, win, uv_vir, fb->pitches[1] >> (2 - skip_lines)); + VOP_WIN_SET(vop, win, uv_mst, vop_plane_state->uv_mst); + } + VOP_WIN_SET(vop, win, fmt_10, is_yuv_10bit(fb->pixel_format)); + +From d56d2c8dcd6dc828693bed0cf965d68e90431019 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 18 Nov 2017 23:17:24 +0100 +Subject: [PATCH] gpu/arm/midgard: default to performance gpu governor + +--- + drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c | 5 ++--- + drivers/gpu/arm/midgard/mali_kbase_config_defaults.h | 3 +-- + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c +index 1495f06cd9b9..a6d2e0121015 100644 +--- a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c ++++ b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c +@@ -348,8 +348,7 @@ int kbase_devfreq_init(struct kbase_device *kbdev) + dp = &kbdev->devfreq_profile; + + dp->initial_freq = kbdev->current_freq; +- /* .KP : set devfreq_dvfs_interval_in_ms */ +- dp->polling_ms = 20; ++ dp->polling_ms = 100; + dp->target = kbase_devfreq_target; + dp->get_dev_status = kbase_devfreq_status; + dp->get_cur_freq = kbase_devfreq_cur_freq; +@@ -363,7 +362,7 @@ int kbase_devfreq_init(struct kbase_device *kbdev) + return err; + + kbdev->devfreq = devfreq_add_device(kbdev->dev, dp, +- "simple_ondemand", NULL); ++ "performance", NULL); + if (IS_ERR(kbdev->devfreq)) { + kbase_devfreq_term_freq_table(kbdev); + return PTR_ERR(kbdev->devfreq); +diff --git a/drivers/gpu/arm/midgard/mali_kbase_config_defaults.h b/drivers/gpu/arm/midgard/mali_kbase_config_defaults.h +index 1cf44b3500cf..a6a1a52f0463 100644 +--- a/drivers/gpu/arm/midgard/mali_kbase_config_defaults.h ++++ b/drivers/gpu/arm/midgard/mali_kbase_config_defaults.h +@@ -109,8 +109,7 @@ enum { + /* + * Default period for DVFS sampling + */ +-// #define DEFAULT_PM_DVFS_PERIOD 100 /* 100ms */ +-#define DEFAULT_PM_DVFS_PERIOD 20 /* 20 ms */ ++#define DEFAULT_PM_DVFS_PERIOD 100 /* 100ms */ + + /* + * Power Management poweroff tick granuality. This is in nanoseconds to + +From 955a2a87c8fa737d78c022afef1ed32fd6f06760 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 10 Dec 2017 14:16:09 +0100 +Subject: [PATCH] uapi: install rockchip_drm header + +--- + include/uapi/drm/Kbuild | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild +index 38d437096c35..b7ae9969d41e 100644 +--- a/include/uapi/drm/Kbuild ++++ b/include/uapi/drm/Kbuild +@@ -11,6 +11,7 @@ header-y += nouveau_drm.h + header-y += qxl_drm.h + header-y += r128_drm.h + header-y += radeon_drm.h ++header-y += rockchip_drm.h + header-y += savage_drm.h + header-y += sis_drm.h + header-y += tegra_drm.h + +From b4da8f58954748a2d459d5e480156ee2703ea169 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 10 Dec 2017 18:03:53 +0100 +Subject: [PATCH] phy: rockchip-inno-hdmi-phy: add vesa dmt pixel clocks + +--- + drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c | 64 +++++++++++++++++++++++ + 1 file changed, 64 insertions(+) + +diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c +index 0161f80ab964..6cf391405ad6 100644 +--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c +@@ -278,6 +278,70 @@ static const struct pre_pll_config pre_pll_cfg_table[] = { + {594000000, 371250000, 4, 495, 1, 2, 0, 1, 3, 1, 1, 1, 0}, + {593407000, 593407000, 1, 98, 0, 2, 0, 1, 0, 1, 1, 0, 0xE6AE6B}, + {594000000, 594000000, 1, 99, 0, 2, 0, 1, 0, 1, 1, 0, 0}, ++ { 25175000, 25175000, 30, 1007, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ { 31500000, 31500000, 1, 21, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ { 33750000, 33750000, 1, 45, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ { 35500000, 35500000, 3, 71, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ { 36000000, 36000000, 1, 12, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ { 49500000, 49500000, 1, 33, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ { 50000000, 50000000, 3, 50, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ { 56250000, 56250000, 1, 75, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ { 68250000, 68250000, 1, 91, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ { 72000000, 72000000, 1, 24, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ { 73250000, 73250000, 3, 293, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ { 75000000, 75000000, 1, 25, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ { 78750000, 78750000, 1, 105, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ { 79500000, 79500000, 1, 53, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ { 85500000, 85500000, 1, 57, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ { 94500000, 94500000, 1, 63, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {101000000, 101000000, 3, 101, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {102250000, 102250000, 3, 409, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {106500000, 106500000, 1, 71, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {115500000, 115500000, 1, 77, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {117500000, 117500000, 3, 235, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {121750000, 121750000, 3, 487, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {122500000, 122500000, 3, 245, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {135000000, 135000000, 1, 45, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {136750000, 136750000, 3, 547, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {140250000, 140250000, 1, 187, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {146250000, 146250000, 1, 195, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {148250000, 148250000, 3, 593, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {154000000, 154000000, 3, 154, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {156000000, 156000000, 1, 52, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {156750000, 156750000, 1, 209, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {157000000, 157000000, 3, 157, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {157500000, 157500000, 1, 105, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {175500000, 175500000, 1, 117, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {179500000, 179500000, 3, 359, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {182750000, 182750000, 3, 731, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {187000000, 187000000, 3, 187, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {187250000, 187250000, 3, 749, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {189000000, 189000000, 1, 63, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {193250000, 193250000, 3, 773, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {202500000, 202500000, 1, 135, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {204750000, 204750000, 1, 273, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {208000000, 208000000, 3, 208, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {214750000, 214750000, 3, 859, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {218250000, 218250000, 1, 291, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {229500000, 229500000, 1, 153, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {234000000, 234000000, 1, 78, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {241500000, 241500000, 1, 161, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {245250000, 245250000, 1, 327, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {245500000, 245500000, 3, 491, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {261000000, 261000000, 1, 87, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {268250000, 268250000, 3, 1073, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {268500000, 268500000, 1, 179, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {281250000, 281250000, 1, 375, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {288000000, 288000000, 1, 96, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {312250000, 312250000, 3, 1249, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {317000000, 317000000, 3, 317, 0, 1, 1, 1, 0, 2, 2, 0, 0}, ++ {333250000, 333250000, 3, 1333, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {348500000, 348500000, 3, 697, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {356500000, 356500000, 3, 713, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {380500000, 380500000, 3, 761, 1, 1, 1, 1, 2, 2, 2, 0, 0}, ++ {443250000, 443250000, 1, 591, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {505250000, 505250000, 3, 2021, 1, 2, 2, 1, 2, 3, 4, 0, 0}, ++ {552750000, 552750000, 1, 737, 1, 2, 2, 1, 2, 3, 4, 0, 0}, + { ~0UL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + + +From f3f9dc1c2c697f0c9fefd501731a07ef64a026b1 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 12 Dec 2017 00:37:27 +0100 +Subject: [PATCH] clk: rockchip: fix round rate + +--- + drivers/clk/rockchip/clk-pll.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c +index 0a9f31f2dd27..183114d824a7 100644 +--- a/drivers/clk/rockchip/clk-pll.c ++++ b/drivers/clk/rockchip/clk-pll.c +@@ -364,6 +364,17 @@ static const struct rockchip_pll_rate_table *rockchip_get_pll_settings( + static long rockchip_pll_round_rate(struct clk_hw *hw, + unsigned long drate, unsigned long *prate) + { ++ struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw); ++ const struct rockchip_pll_rate_table *rate; ++ ++ /* Get required rate settings from table */ ++ rate = rockchip_get_pll_settings(pll, drate); ++ if (!rate) { ++ pr_debug("%s: Invalid rate : %lu for pll clk %s\n", __func__, ++ drate, __clk_get_name(hw->clk)); ++ return -EINVAL; ++ } ++ + return drate; + } + + +From 5a5f5ea8edcc75ca49961a458ac0380e60f30a4d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 21 Jan 2018 17:20:00 +0100 +Subject: [PATCH] drm: fix HDR metadata infoframe length + +HDR metadata infoframe length is 26 bytes (not 30) according to [1] +(CTA-861-G: 6.9 Dynamic Range and Mastering InfoFrame) + +Fixes activation of HDR mode on my LG OLED + +[1] https://standards.cta.tech/kwspub/published_docs/CTA-861-G_FINAL_revised_2017.pdf +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- + drivers/gpu/drm/drm_edid.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 30b6bd979eb8..ec002a4a7a7d 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1857,7 +1857,7 @@ static void hdmi_config_hdr_infoframe(struct dw_hdmi *hdmi) + return; + } + +- hdmi_writeb(hdmi, 1, HDMI_FC_DRM_HB0); ++ hdmi_writeb(hdmi, frame.version, HDMI_FC_DRM_HB0); + hdmi_writeb(hdmi, frame.length, HDMI_FC_DRM_HB1); + hdmi_writeb(hdmi, frame.eotf, HDMI_FC_DRM_PB0); + hdmi_writeb(hdmi, frame.metadata_type, HDMI_FC_DRM_PB1); +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c +index bfe671071d9f..e3a0f561e8f0 100644 +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -4735,10 +4735,10 @@ drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame, + + hdr_source_metadata = (struct hdr_static_metadata *)hdr_metadata; + +- frame->length = sizeof(struct hdr_static_metadata); ++ frame->length = 26; + + frame->eotf = hdr_source_metadata->eotf; +- frame->type = hdr_source_metadata->type; ++ frame->metadata_type = hdr_source_metadata->type; + + for (i = 0; i < 3; i++) { + frame->display_primaries_x[i] = + +From 939878193c4447665bb3b1249e322a5840fbc2d2 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 27 Jan 2018 09:39:09 +0100 +Subject: [PATCH] drm: add edid detection for Hybrid Log-Gamma EOTF + +--- + drivers/gpu/drm/drm_edid.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c +index e3a0f561e8f0..f7d41950614e 100644 +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -2740,7 +2740,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, + #define TRADITIONAL_GAMMA_SDR (0x1 << 0) + #define TRADITIONAL_GAMMA_HDR (0x1 << 1) + #define SMPTE_ST2084 (0x1 << 2) +-#define FUTURE_EOTF (0x1 << 3) ++#define HYBRID_LOG_GAMMA (0x1 << 3) + #define RESERVED_EOTF (0x3 << 4) + + #define STATIC_METADATA_TYPE1 (0x1 << 0) +@@ -3710,6 +3710,8 @@ static uint16_t eotf_supported(const u8 *edid_ext) + val |= TRADITIONAL_GAMMA_HDR; + if (edid_ext[2] & SMPTE_ST2084) + val |= SMPTE_ST2084; ++ if (edid_ext[2] & HYBRID_LOG_GAMMA) ++ val |= HYBRID_LOG_GAMMA; + + return val; + } + +From 19e9d690fe47e5e4b47760d060b11707bb44194b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 11 Feb 2018 19:21:41 +0100 +Subject: [PATCH] drm: bridge: dw-hdmi: default to underscan mode + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index ec002a4a7a7d..393bd5b28f07 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1691,7 +1691,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + break; + } + +- frame.scan_mode = HDMI_SCAN_MODE_NONE; ++ frame.scan_mode = HDMI_SCAN_MODE_UNDERSCAN; + + /* + * The Designware IP uses a different byte format from standard + +From b492ddc8ae2777350db224d39346966080a140d6 Mon Sep 17 00:00:00 2001 +From: David Carrillo-Cisneros +Date: Tue, 18 Jul 2017 18:18:37 -0700 +Subject: [PATCH] UPSTREAM: perf tools: Add EXCLUDE_EXTLIBS and EXTRA_PERFLIBS + to makefile + +The goal is to allow users to override linking of libraries that +were automatically added to PERFLIBS. + +EXCLUDE_EXTLIBS contains linker flags to be removed from LIBS +while EXTRA_PERFLIBS contains linker flags to be added. + +My use case is to force certain library to be build statically, +e.g. for libelf: + + EXCLUDE_EXTLIBS=-lelf EXTRA_PERFLIBS=path/libelf.a + +Signed-off-by: David Carrillo-Cisneros +Acked-by: Jiri Olsa +Cc: Alexander Shishkin +Cc: Elena Reshetova +Cc: Kees Kook +Cc: Paul Turner +Cc: Stephane Eranian +Cc: Sudeep Holla +Cc: Wang Nan +Link: http://lkml.kernel.org/r/20170719011839.99399-3-davidcc@google.com +Signed-off-by: Arnaldo Carvalho de Melo +(cherry picked from commit cb281fea4b0a326d2a2104f8ffae2b6895c561fd) +--- + tools/perf/Makefile.perf | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf +index fb1c9ddc3478..9b3b9bd50d54 100644 +--- a/tools/perf/Makefile.perf ++++ b/tools/perf/Makefile.perf +@@ -33,6 +33,11 @@ include config/utilities.mak + # + # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. + # ++# Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated ++# EXTLIBS. ++# ++# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS. ++# + # Define NO_DWARF if you do not want debug-info analysis feature at all. + # + # Define WERROR=0 to disable treating any warnings as errors. +@@ -289,7 +294,8 @@ ifdef ASCIIDOC8 + export ASCIIDOC8 + endif + +-LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group ++EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS)) ++LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group + + export INSTALL SHELL_PATH + + +From 163448e6d6d5d0bbc9486d43a2d06c5d86e28d34 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 27 Feb 2018 20:49:00 +0100 +Subject: [PATCH] net: wireless: rockchip_wlan: rtl8723bs: do not accept all + sdio wlan id + +--- + drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile | 2 +- + .../net/wireless/rockchip_wlan/rtl8723bs/os_dep/linux/sdio_intf.c | 8 ++++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile b/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile +index fe9d5638a128..e8653b070efb 100644 +--- a/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile ++++ b/drivers/net/wireless/rockchip_wlan/rtl8723bs/Makefile +@@ -1347,7 +1347,7 @@ EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFO + EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT + EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE + # default setting for Power control +-EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC ++#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC + EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN + EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE + # default setting for Special function +diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723bs/os_dep/linux/sdio_intf.c b/drivers/net/wireless/rockchip_wlan/rtl8723bs/os_dep/linux/sdio_intf.c +index b4654d229634..e49e5cb8f21a 100644 +--- a/drivers/net/wireless/rockchip_wlan/rtl8723bs/os_dep/linux/sdio_intf.c ++++ b/drivers/net/wireless/rockchip_wlan/rtl8723bs/os_dep/linux/sdio_intf.c +@@ -45,6 +45,14 @@ static struct mmc_host *mmc_host = NULL; + + static const struct sdio_device_id sdio_ids[] = { + #ifdef CONFIG_RTL8723B ++ { SDIO_DEVICE(0x024c, 0x0240), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x0241), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x0523), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x0524), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x0623), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x0624), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x0626), .driver_data = RTL8723B}, ++ { SDIO_DEVICE(0x024c, 0x8753), .driver_data = RTL8723B}, + { SDIO_DEVICE(0x024c, 0xB723), .driver_data = RTL8723B}, + #endif + #ifdef CONFIG_RTL8188E + +From ba7c1fb0efcf29265c0c88d98f52919a21078e5b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 2 Mar 2018 20:53:32 +0100 +Subject: [PATCH] net: wireless: rockchip_wlan: bcmdhd: detect broadcom sdio + device id + +--- + drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c +index 8864582b1706..b5a388cc3cbe 100755 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c +@@ -225,7 +225,7 @@ static const struct sdio_device_id bcmsdh_sdmmc_ids[] = { + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4334) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4324) }, + { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43239) }, +- { SDIO_DEVICE_CLASS(SDIO_CLASS_NONE) }, ++ { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_ANY_ID) }, + { 0, 0, 0, 0 /* end: all zeroes */ + }, + }; + +From 922cc477bd191cbfddae005b27a2c89cb9c9623a Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 1 Jul 2018 23:17:47 +0200 +Subject: [PATCH] drm/rockchip: clip yuv + +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 ++ + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 2 ++ + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 3 +++ + 3 files changed, 7 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 1418402c2668..0916b4284f88 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1731,6 +1731,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + s = to_rockchip_crtc_state(crtc->state); + + spin_lock(&vop->reg_lock); ++ VOP_WIN_SET(vop, win, yuv_clip, 0); + VOP_WIN_SET(vop, win, xmirror, xmirror); + VOP_WIN_SET(vop, win, ymirror, ymirror); + VOP_WIN_SET(vop, win, format, vop_plane_state->format); +@@ -2544,6 +2545,7 @@ static void vop_update_csc(struct drm_crtc *crtc) + VOP_CTRL_SET(vop, dsp_data_swap, 0); + + VOP_CTRL_SET(vop, out_mode, s->output_mode); ++ VOP_CTRL_SET(vop, yuv_clip, 0); + + switch (s->bus_format) { + case MEDIA_BUS_FMT_RGB565_1X16: +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +index 618de17e608a..391998c7aa50 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +@@ -178,6 +178,7 @@ struct vop_ctrl { + struct vop_reg dsp_lut_en; + + struct vop_reg out_mode; ++ struct vop_reg yuv_clip; + + struct vop_reg xmirror; + struct vop_reg ymirror; +@@ -409,6 +410,7 @@ struct vop_win_phy { + struct vop_reg format; + struct vop_reg fmt_10; + struct vop_reg csc_mode; ++ struct vop_reg yuv_clip; + struct vop_reg xmirror; + struct vop_reg ymirror; + struct vop_reg rb_swap; +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index 9c96d5614e54..aeb1c7644bc9 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -119,6 +119,7 @@ static const struct vop_win_phy rk3288_win01_data = { + .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 4), + .csc_mode = VOP_REG_VER(RK3288_WIN0_CTRL0, 0x3, 10, 3, 2, -1), + .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), ++ .yuv_clip = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 20), + .xmirror = VOP_REG_VER(RK3368_WIN0_CTRL0, 0x1, 21, 3, 2, -1), + .ymirror = VOP_REG_VER(RK3368_WIN0_CTRL0, 0x1, 22, 3, 2, -1), + .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), +@@ -286,6 +287,7 @@ static const struct vop_ctrl rk3288_ctrl_data = { + .bcsh_color_bar = VOP_REG(RK3288_BCSH_COLOR_BAR, 0xffffff, 8), + .bcsh_en = VOP_REG(RK3288_BCSH_COLOR_BAR, 0x1, 0), + ++ .yuv_clip = VOP_REG(RK3288_DSP_CTRL0, 0x1, 21), + .xmirror = VOP_REG(RK3288_DSP_CTRL0, 0x1, 22), + .ymirror = VOP_REG(RK3288_DSP_CTRL0, 0x1, 23), + +@@ -964,6 +966,7 @@ static const struct vop_ctrl rk3328_ctrl_data = { + .dsp_lut_en = VOP_REG(RK3328_DSP_CTRL1, 0x1, 0), + .out_mode = VOP_REG(RK3328_DSP_CTRL0, 0xf, 0), + ++ .yuv_clip = VOP_REG(RK3328_DSP_CTRL0, 0x1, 21), + .xmirror = VOP_REG(RK3328_DSP_CTRL0, 0x1, 22), + .ymirror = VOP_REG(RK3328_DSP_CTRL0, 0x1, 23), + + +From 991811443d72d7915afdee23c30843669a347d7c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 8 Jul 2018 12:38:00 +0200 +Subject: [PATCH] drm/atomic: use active_only flag for connector atomic + begin/flush + +--- + drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c +index f77d4aa1e58b..4da489b54dc5 100644 +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -1563,15 +1563,15 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, + for_each_connector_in_state(old_state, connector, old_conn_state, i) { + const struct drm_connector_helper_funcs *funcs; + +- if (!connector->state->crtc) +- continue; ++ funcs = connector->helper_private; + +- if (!connector->state->crtc->state->active) ++ if (!funcs || !funcs->atomic_begin) + continue; + +- funcs = connector->helper_private; ++ if (!connector->state->crtc) ++ continue; + +- if (!funcs || !funcs->atomic_begin) ++ if (active_only && !connector->state->crtc->state->active) + continue; + + DRM_DEBUG_ATOMIC("flush beginning [CONNECTOR:%d:%s]\n", +@@ -1645,15 +1645,15 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, + for_each_connector_in_state(old_state, connector, old_conn_state, i) { + const struct drm_connector_helper_funcs *funcs; + +- if (!connector->state->crtc) +- continue; ++ funcs = connector->helper_private; + +- if (!connector->state->crtc->state->active) ++ if (!funcs || !funcs->atomic_flush) + continue; + +- funcs = connector->helper_private; ++ if (!connector->state->crtc) ++ continue; + +- if (!funcs || !funcs->atomic_flush) ++ if (active_only && !connector->state->crtc->state->active) + continue; + + DRM_DEBUG_ATOMIC("flushing [CONNECTOR:%d:%s]\n", + +From 8d514d5127fbb4d49247f893ac6b803cbdd3304d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 22 Jul 2018 14:51:58 +0200 +Subject: [PATCH] drm: rockchip: dw-hdmi: only force YCbCr422 when max tmds is + up to 340Mhz + +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 7273561fe6b1..e2aad6e2149b 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -728,7 +728,9 @@ dw_hdmi_rockchip_select_output(struct drm_connector_state *conn_state, + /* BT2020 require color depth at lest 10bit */ + *color_depth = 10; + /* We prefer use YCbCr422 to send 10bit */ +- if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422) ++ if (info->color_formats & DRM_COLOR_FORMAT_YCRCB422 && ++ info->max_tmds_clock <= 340000 && ++ hdmi->dev_type != RK3288_HDMI) + *color_format = DRM_HDMI_OUTPUT_YCBCR422; + } + + +From 9d6de32c2e992b71e6634a284dc99ab1b3bd43e2 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 22 Jul 2018 15:09:16 +0200 +Subject: [PATCH] drm: bridge: dw-hdmi: signal full range for rgb output + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 393bd5b28f07..91c5b8fc8fa0 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1693,6 +1693,14 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + + frame.scan_mode = HDMI_SCAN_MODE_UNDERSCAN; + ++ if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { ++ frame.quantization_range = HDMI_QUANTIZATION_RANGE_FULL; ++ frame.ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_FULL; ++ } else { ++ frame.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED; ++ frame.ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_LIMITED; ++ } ++ + /* + * The Designware IP uses a different byte format from standard + * AVI info frames, though generally the bits are in the correct + +From 35c0ac957d5fcec21d807e801efed57a37c41d9d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 28 Jul 2018 10:41:40 +0200 +Subject: [PATCH] WIP: mm: dma-mapping: increase dma pool size + +--- + arch/arm/mm/dma-mapping.c | 2 +- + arch/arm64/mm/dma-mapping.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c +index d539dee3c78d..689961153d71 100644 +--- a/arch/arm/mm/dma-mapping.c ++++ b/arch/arm/mm/dma-mapping.c +@@ -301,7 +301,7 @@ static void __dma_free_remap(void *cpu_addr, size_t size) + VM_ARM_DMA_CONSISTENT | VM_USERMAP); + } + +-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K ++#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M + static struct gen_pool *atomic_pool; + + static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE; +diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c +index 2b05653e8156..2ad8515cd4da 100644 +--- a/arch/arm64/mm/dma-mapping.c ++++ b/arch/arm64/mm/dma-mapping.c +@@ -32,7 +32,7 @@ + + static struct gen_pool *atomic_pool; + +-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K ++#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M + static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE; + + static int __init early_coherent_pool(char *p) + +From 24a070f21767a8d381b81ab5fc5f39c2b9729b24 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 4 Aug 2018 15:19:39 +0200 +Subject: [PATCH] drm: add picture_aspect_ratio to hdmi 1.4 4k modes + +--- + drivers/gpu/drm/drm_edid.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c +index f7d41950614e..69a1eb4ee382 100644 +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -1233,25 +1233,25 @@ static const struct drm_display_mode edid_4k_modes[] = { + 3840, 4016, 4104, 4400, 0, + 2160, 2168, 2178, 2250, 0, + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), +- .vrefresh = 30, }, ++ .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, + /* 2 - 3840x2160@25Hz */ + { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, + 3840, 4896, 4984, 5280, 0, + 2160, 2168, 2178, 2250, 0, + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), +- .vrefresh = 25, }, ++ .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, + /* 3 - 3840x2160@24Hz */ + { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, + 3840, 5116, 5204, 5500, 0, + 2160, 2168, 2178, 2250, 0, + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), +- .vrefresh = 24, }, ++ .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, + /* 4 - 4096x2160@24Hz (SMPTE) */ + { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, + 4096, 5116, 5204, 5500, 0, + 2160, 2168, 2178, 2250, 0, + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), +- .vrefresh = 24, }, ++ .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135, }, + }; + + /*** DDC fetch and block validation ***/ + +From daadd2b2e1bf5419694ebae5243e61e462885b03 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 4 Aug 2018 16:26:47 +0200 +Subject: [PATCH] drm: bridge: dw-hdmi: signal none colorimetry for rgb output + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 91c5b8fc8fa0..8261ba15f98e 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1694,6 +1694,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + frame.scan_mode = HDMI_SCAN_MODE_UNDERSCAN; + + if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { ++ frame.colorimetry = HDMI_COLORIMETRY_NONE; ++ frame.extended_colorimetry = 0; + frame.quantization_range = HDMI_QUANTIZATION_RANGE_FULL; + frame.ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_FULL; + } else { + +From 88c6dbd7a37b01d4029102c6fdad2b1fc24098e0 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 4 Aug 2018 16:27:08 +0200 +Subject: [PATCH] drm: bridge: dw-hdmi: signal it content and content type + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 8261ba15f98e..cdfa295fc323 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1692,6 +1692,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + } + + frame.scan_mode = HDMI_SCAN_MODE_UNDERSCAN; ++ frame.content_type = HDMI_CONTENT_TYPE_GRAPHICS; ++ frame.itc = true; + + if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { + frame.colorimetry = HDMI_COLORIMETRY_NONE; + +From 5d069752d8885584beaac3905a21c34a0bfa5f22 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 4 Aug 2018 16:27:40 +0200 +Subject: [PATCH] drm: bridge: dw-hdmi: log infoframes + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index cdfa295fc323..25546a4471fb 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1705,6 +1705,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + frame.ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_LIMITED; + } + ++ hdmi_infoframe_log(KERN_INFO, hdmi->dev, &frame); ++ + /* + * The Designware IP uses a different byte format from standard + * AVI info frames, though generally the bits are in the correct +@@ -1798,6 +1800,8 @@ static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi, + return; + } + ++ hdmi_infoframe_log(KERN_INFO, hdmi->dev, &frame); ++ + /* Set the length of HDMI vendor specific InfoFrame payload */ + hdmi_writeb(hdmi, buffer[2], HDMI_FC_VSDSIZE); + +@@ -1838,7 +1842,7 @@ static void hdmi_config_hdr_infoframe(struct dw_hdmi *hdmi) + + /* Dynamic Range and Mastering Infoframe is introduced in v2.11a. */ + if (hdmi->version < 0x211a) { +- DRM_ERROR("Not support DRM Infoframe\n"); ++ DRM_DEBUG("Not support DRM Infoframe\n"); + return; + } + +@@ -1869,6 +1873,8 @@ static void hdmi_config_hdr_infoframe(struct dw_hdmi *hdmi) + return; + } + ++ hdmi_infoframe_log(KERN_INFO, hdmi->dev, &frame); ++ + hdmi_writeb(hdmi, frame.version, HDMI_FC_DRM_HB0); + hdmi_writeb(hdmi, frame.length, HDMI_FC_DRM_HB1); + hdmi_writeb(hdmi, frame.eotf, HDMI_FC_DRM_PB0); + +From 3f61791c437d217b760d9f64d38f69e7c2ac6987 Mon Sep 17 00:00:00 2001 +From: Nickey Yang +Date: Mon, 17 Jul 2017 16:35:34 +0800 +Subject: [PATCH] MINIARM: set npll be used for hdmi only + +Change-Id: I8bebfb2cfb68e3dad172e5547d3886526ad5e912 +Signed-off-by: Nickey Yang +--- + arch/arm/boot/dts/rk3288.dtsi | 2 ++ + drivers/clk/rockchip/clk-rk3288.c | 4 ++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi +index 1b7602f25f34..7e536c939cc0 100644 +--- a/arch/arm/boot/dts/rk3288.dtsi ++++ b/arch/arm/boot/dts/rk3288.dtsi +@@ -1303,6 +1303,8 @@ + resets = <&cru SRST_LCDC0_AXI>, <&cru SRST_LCDC0_AHB>, <&cru SRST_LCDC0_DCLK>; + reset-names = "axi", "ahb", "dclk"; + iommus = <&vopb_mmu>; ++ assigned-clocks = <&cru DCLK_VOP0>; ++ assigned-clock-parents = <&cru PLL_NPLL>; + status = "disabled"; + + vopb_out: port { +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index ca6c2ad3de96..415df387a5d6 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -214,7 +214,7 @@ static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = { + [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12), + RK3288_MODE_CON, 12, 8, 0, rk3288_pll_rates), + [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16), +- RK3288_MODE_CON, 14, 9, ROCKCHIP_PLL_SYNC_RATE, rk3288_pll_rates), ++ RK3288_MODE_CON, 14, 9, 0, rk3288_pll_rates), + }; + + static struct clk_div_table div_hclk_cpu_t[] = { +@@ -429,7 +429,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + RK3288_CLKSEL_CON(30), 14, 2, MFLAGS, 8, 5, DFLAGS, + RK3288_CLKGATE_CON(3), 4, GFLAGS), + +- COMPOSITE(DCLK_VOP0, "dclk_vop0", mux_pll_src_cpll_gpll_npll_p, 0, ++ COMPOSITE(DCLK_VOP0, "dclk_vop0", mux_pll_src_cpll_gpll_npll_p, CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(27), 0, 2, MFLAGS, 8, 8, DFLAGS, + RK3288_CLKGATE_CON(3), 1, GFLAGS), + COMPOSITE(DCLK_VOP1, "dclk_vop1", mux_pll_src_cpll_gpll_npll_p, 0, + +From 23a9cfafd5b8c641c2e9d2fdd1c299f19947c548 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 4 Aug 2018 14:51:14 +0200 +Subject: [PATCH] clk: rockchip: rk3288: use npll table to to improve HDMI + compatibility + +Based on https://github.com/TinkerBoard/debian_kernel/commit/3d90870530b8a2901681f7b7fa598ee7381e49f3 +--- + drivers/clk/rockchip/clk-rk3288.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index 415df387a5d6..f748a292b7f4 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -105,6 +105,27 @@ static struct rockchip_pll_rate_table rk3288_pll_rates[] = { + { /* sentinel */ }, + }; + ++static struct rockchip_pll_rate_table rk3288_npll_rates[] = { ++ RK3066_PLL_RATE_NB(594000000, 1, 99, 4, 32), ++ RK3066_PLL_RATE_NB(585000000, 6, 585, 4, 32), ++ RK3066_PLL_RATE_NB(432000000, 3, 216, 4, 32), ++ RK3066_PLL_RATE_NB(426000000, 3, 213, 4, 32), ++ RK3066_PLL_RATE_NB(400000000, 1, 100, 6, 32), ++ RK3066_PLL_RATE_NB(342000000, 3, 171, 4, 32), ++ RK3066_PLL_RATE_NB(297000000, 2, 198, 8, 16), ++ RK3066_PLL_RATE_NB(270000000, 1, 135, 12, 32), ++ RK3066_PLL_RATE_NB(260000000, 1, 130, 12, 32), ++ RK3066_PLL_RATE_NB(148500000, 1, 99, 16, 32), ++ RK3066_PLL_RATE(148352000, 13, 1125, 14), ++ RK3066_PLL_RATE_NB(146250000, 6, 585, 16, 32), ++ RK3066_PLL_RATE_NB(108000000, 1, 54, 12, 32), ++ RK3066_PLL_RATE_NB(106500000, 4, 213, 12, 32), ++ RK3066_PLL_RATE_NB(85500000, 4, 171, 12, 32), ++ RK3066_PLL_RATE_NB(74250000, 4, 198, 16, 32), ++ RK3066_PLL_RATE(74176000, 26, 1125, 14), ++ { /* sentinel */ }, ++}; ++ + #define RK3288_DIV_ACLK_CORE_M0_MASK 0xf + #define RK3288_DIV_ACLK_CORE_M0_SHIFT 0 + #define RK3288_DIV_ACLK_CORE_MP_MASK 0xf +@@ -214,7 +235,7 @@ static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = { + [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12), + RK3288_MODE_CON, 12, 8, 0, rk3288_pll_rates), + [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16), +- RK3288_MODE_CON, 14, 9, 0, rk3288_pll_rates), ++ RK3288_MODE_CON, 14, 9, 0, rk3288_npll_rates), + }; + + static struct clk_div_table div_hclk_cpu_t[] = { + +From ba1e5834eef028ca22c2089a2bff453c9bee38af Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= +Date: Wed, 30 May 2018 13:06:14 +0200 +Subject: [PATCH] ayufan: fan53555: support syr83x found in rockpro64 + +Change-Id: I7115081286692f4cbfbe5d11a05d40be112c3037 +--- + drivers/regulator/fan53555.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c +index 74e5ae2bc0d2..6b0854a3cae3 100644 +--- a/drivers/regulator/fan53555.c ++++ b/drivers/regulator/fan53555.c +@@ -78,6 +78,7 @@ enum { + + enum { + SILERGY_SYR82X = 8, ++ SILERGY_SYR83X = 9, + }; + + struct fan53555_device_info { +@@ -323,6 +324,7 @@ static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di) + /* Init voltage range and step */ + switch (di->chip_id) { + case SILERGY_SYR82X: ++ case SILERGY_SYR83X: + di->vsel_min = 712500; + di->vsel_step = 12500; + break; + +From 99674f3279042bd694019c26309e4f2a44b6fe81 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 9 Sep 2018 12:33:23 +0200 +Subject: [PATCH] WIP: video: rockchip: iep: fix compile issue + +--- + drivers/video/rockchip/iep/Makefile | 2 +- + include/linux/rockchip-iovmm.h | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/video/rockchip/iep/Makefile b/drivers/video/rockchip/iep/Makefile +index 37760fbf42b7..c6f7ae87a544 100644 +--- a/drivers/video/rockchip/iep/Makefile ++++ b/drivers/video/rockchip/iep/Makefile +@@ -1,2 +1,2 @@ + # SPDX-License-Identifier: GPL-2.0 +-obj-$(CONFIG_IEP) += hw_iep_reg.o iep_drv.o iep_iommu_drm.o iep_iommu_ion.o iep_iommu_ops.o ++obj-$(CONFIG_IEP) += hw_iep_reg.o iep_drv.o iep_iommu_drm.o iep_iommu_ops.o +diff --git a/include/linux/rockchip-iovmm.h b/include/linux/rockchip-iovmm.h +index 73e2ff159e86..d87b8d2c9904 100644 +--- a/include/linux/rockchip-iovmm.h ++++ b/include/linux/rockchip-iovmm.h +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #define IEP_IOMMU_COMPATIBLE_NAME "rockchip,iep_mmu" + #define VIP_IOMMU_COMPATIBLE_NAME "rockchip,vip_mmu" + +From 7405c1596ae36388bc2d32dd8b72f0b1f22ffb41 Mon Sep 17 00:00:00 2001 +From: Randy Li +Date: Thu, 20 Sep 2018 10:59:11 +0800 +Subject: [PATCH] Mali: midgard: fix the memory translation for aarch32 + +When the clients are 32 bits while the kernel is 64 bits, +we need to translate the memory address before accessing. + +Change-Id: I7f47ab94da258e9d170613252aae9b396623cf48 +Signed-off-by: Randy Li +--- + drivers/gpu/arm/midgard/mali_kbase_core_linux.c | 88 +++++++++++++++++++------ + 1 file changed, 69 insertions(+), 19 deletions(-) + +diff --git a/drivers/gpu/arm/midgard/mali_kbase_core_linux.c b/drivers/gpu/arm/midgard/mali_kbase_core_linux.c +index 24bafe2bf32c..65bc5ad2a7c2 100644 +--- a/drivers/gpu/arm/midgard/mali_kbase_core_linux.c ++++ b/drivers/gpu/arm/midgard/mali_kbase_core_linux.c +@@ -515,14 +515,20 @@ copy_failed: + case KBASE_FUNC_JOB_SUBMIT: + { + struct kbase_uk_job_submit *job = args; ++ void __user *user_addr = NULL; + + if (sizeof(*job) != args_size) + goto bad_size; + +- if (kbase_jd_submit(kctx, job->addr.value, +- job->nr_atoms, +- job->stride, +- false) != 0) ++#ifdef CONFIG_COMPAT ++ if (kbase_ctx_flag(kctx, KCTX_COMPAT)) ++ user_addr = compat_ptr(job->addr.compat_value); ++ else ++#endif ++ user_addr = job->addr.value; ++ ++ if (kbase_jd_submit(kctx, user_addr, job->nr_atoms, ++ job->stride, false) != 0) + ukh->ret = MALI_ERROR_FUNCTION_FAILED; + break; + } +@@ -531,14 +537,20 @@ copy_failed: + case KBASE_FUNC_JOB_SUBMIT_UK6: + { + struct kbase_uk_job_submit *job = args; ++ void __user *user_addr = NULL; + + if (sizeof(*job) != args_size) + goto bad_size; + +- if (kbase_jd_submit(kctx, job->addr.value, +- job->nr_atoms, +- job->stride, +- true) != 0) ++#ifdef CONFIG_COMPAT ++ if (kbase_ctx_flag(kctx, KCTX_COMPAT)) ++ user_addr = compat_ptr(job->addr.compat_value); ++ else ++#endif ++ user_addr = job->addr.value; ++ ++ if (kbase_jd_submit(kctx, user_addr, job->nr_atoms, ++ job->stride, true) != 0) + ukh->ret = MALI_ERROR_FUNCTION_FAILED; + break; + } +@@ -646,7 +658,8 @@ copy_failed: + goto bad_size; + + if (find->gpu_addr & ~PAGE_MASK) { +- dev_warn(kbdev->dev, "kbase_legacy_dispatch case KBASE_FUNC_FIND_CPU_OFFSET: find->gpu_addr: passed parameter is invalid"); ++ dev_warn(kbdev->dev, ++ "kbase_legacy_dispatch case KBASE_FUNC_FIND_CPU_OFFSET: find->gpu_addr: passed parameter is invalid"); + goto out_bad; + } + +@@ -674,8 +687,11 @@ copy_failed: + goto bad_size; + + /* version buffer size check is made in compile time assert */ +- memcpy(get_version->version_buffer, KERNEL_SIDE_DDK_VERSION_STRING, sizeof(KERNEL_SIDE_DDK_VERSION_STRING)); +- get_version->version_string_size = sizeof(KERNEL_SIDE_DDK_VERSION_STRING); ++ memcpy(get_version->version_buffer, ++ KERNEL_SIDE_DDK_VERSION_STRING, ++ sizeof(KERNEL_SIDE_DDK_VERSION_STRING)); ++ get_version->version_string_size = ++ sizeof(KERNEL_SIDE_DDK_VERSION_STRING); + get_version->rk_version = ROCKCHIP_VERSION; + break; + } +@@ -828,7 +844,8 @@ copy_failed: + + #ifdef CONFIG_COMPAT + if (kbase_ctx_flag(kctx, KCTX_COMPAT)) +- user_buf = compat_ptr(add_data->buf.compat_value); ++ user_buf = ++ compat_ptr(add_data->buf.compat_value); + else + #endif + user_buf = add_data->buf.value; +@@ -977,9 +994,9 @@ copy_failed: + + return ret; + +- bad_size: ++bad_size: + dev_err(kbdev->dev, "Wrong syscall size (%d) for %08x\n", args_size, id); +- out_bad: ++out_bad: + return -EINVAL; + } + +@@ -1317,7 +1334,16 @@ static int kbase_api_set_flags(struct kbase_context *kctx, + static int kbase_api_job_submit(struct kbase_context *kctx, + struct kbase_ioctl_job_submit *submit) + { +- return kbase_jd_submit(kctx, submit->addr.value, submit->nr_atoms, ++ void __user *user_addr = NULL; ++ ++#ifdef CONFIG_COMPAT ++ if (kbase_ctx_flag(kctx, KCTX_COMPAT)) ++ user_addr = compat_ptr(submit->addr.compat_value); ++ else ++#endif ++ user_addr = submit->addr.value; ++ ++ return kbase_jd_submit(kctx, user_addr, submit->nr_atoms, + submit->stride, false); + } + +@@ -1548,6 +1574,7 @@ static int kbase_api_mem_alias(struct kbase_context *kctx, + union kbase_ioctl_mem_alias *alias) + { + struct base_mem_aliasing_info *ai; ++ void __user *user_addr = NULL; + u64 flags; + int err; + +@@ -1558,8 +1585,15 @@ static int kbase_api_mem_alias(struct kbase_context *kctx, + if (!ai) + return -ENOMEM; + +- err = copy_from_user(ai, alias->in.aliasing_info.value, +- sizeof(*ai) * alias->in.nents); ++#ifdef CONFIG_COMPAT ++ if (kbase_ctx_flag(kctx, KCTX_COMPAT)) ++ user_addr = ++ compat_ptr(alias->in.aliasing_info.compat_value); ++ else ++#endif ++ user_addr = alias->in.aliasing_info.value; ++ ++ err = copy_from_user(ai, user_addr, sizeof(*ai) * alias->in.nents); + if (err) { + vfree(ai); + return err; +@@ -1586,10 +1620,18 @@ static int kbase_api_mem_import(struct kbase_context *kctx, + { + int ret; + u64 flags = import->in.flags; ++ void __user *phandle; ++ ++#ifdef CONFIG_COMPAT ++ if (kbase_ctx_flag(kctx, KCTX_COMPAT)) ++ phandle = compat_ptr(import->in.phandle.compat_value); ++ else ++#endif ++ phandle = import->in.phandle.value; + + ret = kbase_mem_import(kctx, + import->in.type, +- import->in.phandle.value, ++ phandle, + import->in.padding, + &import->out.gpu_va, + &import->out.va_pages, +@@ -1654,6 +1696,7 @@ static int kbase_api_get_profiling_controls(struct kbase_context *kctx, + static int kbase_api_mem_profile_add(struct kbase_context *kctx, + struct kbase_ioctl_mem_profile_add *data) + { ++ char __user *user_buf; + char *buf; + int err; + +@@ -1666,7 +1709,14 @@ static int kbase_api_mem_profile_add(struct kbase_context *kctx, + if (ZERO_OR_NULL_PTR(buf)) + return -ENOMEM; + +- err = copy_from_user(buf, data->buffer.value, data->len); ++#ifdef CONFIG_COMPAT ++ if (kbase_ctx_flag(kctx, KCTX_COMPAT)) ++ user_buf = compat_ptr(data->buffer.compat_value); ++ else ++#endif ++ user_buf = data->buffer.value; ++ ++ err = copy_from_user(buf, user_buf, data->len); + if (err) { + kfree(buf); + return err; + +From 6de4ce0e92be7b66429efe88c406e30703639661 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 28 Oct 2018 21:43:01 +0100 +Subject: [PATCH] clk: rockchip: rk3288: add more npll clocks + +Fixes 2560x1440@60Hz, 1600x1200@60Hz, 1920x1200@60Hz, 1680x1050@60Hz and 1440x900@60Hz modes on my monitor +--- + drivers/clk/rockchip/clk-rk3288.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index f748a292b7f4..d72c02afeb76 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -111,18 +111,34 @@ static struct rockchip_pll_rate_table rk3288_npll_rates[] = { + RK3066_PLL_RATE_NB(432000000, 3, 216, 4, 32), + RK3066_PLL_RATE_NB(426000000, 3, 213, 4, 32), + RK3066_PLL_RATE_NB(400000000, 1, 100, 6, 32), ++ RK3066_PLL_RATE(348500000, 8, 697, 6), + RK3066_PLL_RATE_NB(342000000, 3, 171, 4, 32), + RK3066_PLL_RATE_NB(297000000, 2, 198, 8, 16), + RK3066_PLL_RATE_NB(270000000, 1, 135, 12, 32), + RK3066_PLL_RATE_NB(260000000, 1, 130, 12, 32), ++ RK3066_PLL_RATE(241500000, 2, 161, 8), ++ RK3066_PLL_RATE(162000000, 1, 81, 12), ++ RK3066_PLL_RATE(154000000, 6, 539, 14), + RK3066_PLL_RATE_NB(148500000, 1, 99, 16, 32), + RK3066_PLL_RATE(148352000, 13, 1125, 14), + RK3066_PLL_RATE_NB(146250000, 6, 585, 16, 32), ++ RK3066_PLL_RATE(121750000, 6, 487, 16), ++ RK3066_PLL_RATE(119000000, 3, 238, 16), + RK3066_PLL_RATE_NB(108000000, 1, 54, 12, 32), + RK3066_PLL_RATE_NB(106500000, 4, 213, 12, 32), ++ RK3066_PLL_RATE(101000000, 3, 202, 16), ++ RK3066_PLL_RATE(88750000, 6, 355, 16), + RK3066_PLL_RATE_NB(85500000, 4, 171, 12, 32), ++ RK3066_PLL_RATE(83500000, 3, 167, 16), ++ RK3066_PLL_RATE(79500000, 1, 53, 16), + RK3066_PLL_RATE_NB(74250000, 4, 198, 16, 32), + RK3066_PLL_RATE(74176000, 26, 1125, 14), ++ RK3066_PLL_RATE(72000000, 1, 48, 16), ++ RK3066_PLL_RATE(71000000, 3, 142, 16), ++ RK3066_PLL_RATE(68250000, 2, 91, 16), ++ RK3066_PLL_RATE(65000000, 3, 130, 16), ++ RK3066_PLL_RATE(40000000, 3, 80, 16), ++ RK3066_PLL_RATE(33750000, 2, 45, 16), + { /* sentinel */ }, + }; + + +From 06d1099d7f4cece7af7793ff68fabc08eb55935d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 14 Nov 2018 06:08:01 +0100 +Subject: [PATCH] drm: workaround for crash when trying to open render node + +--- + drivers/gpu/drm/drm_ioctl.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c +index 34757168ffaa..0914c886277f 100644 +--- a/drivers/gpu/drm/drm_ioctl.c ++++ b/drivers/gpu/drm/drm_ioctl.c +@@ -57,6 +57,9 @@ static int drm_getunique(struct drm_device *dev, void *data, + struct drm_unique *u = data; + struct drm_master *master = file_priv->master; + ++ if (!master) ++ return -EINVAL; ++ + if (u->unique_len >= master->unique_len) { + if (copy_to_user(u->unique, master->unique, master->unique_len)) + return -EFAULT; + +From 309a27eaf2f4e429ef102e3eef70a2f908360c44 Mon Sep 17 00:00:00 2001 +From: Nick +Date: Wed, 19 Sep 2018 22:14:58 +0800 +Subject: [PATCH] bump PD voltage & current for board without charge IC + +--- + drivers/mfd/fusb302.c | 28 ++++++++++++++++++++++++++-- + 1 file changed, 26 insertions(+), 2 deletions(-) + +diff --git a/drivers/mfd/fusb302.c b/drivers/mfd/fusb302.c +index 240cecac65b5..8fe4163214e0 100644 +--- a/drivers/mfd/fusb302.c ++++ b/drivers/mfd/fusb302.c +@@ -217,8 +217,32 @@ static int fusb302_set_pos_power_by_charge_ic(struct fusb30x_chip *chip) + max_vol = 0; + max_cur = 0; + psy = power_supply_get_by_phandle(chip->dev->of_node, "charge-dev"); +- if (!psy || IS_ERR(psy)) +- return -1; ++ if (!psy || IS_ERR(psy)) { ++ int ret; ++ u32 value; ++ ++ ret = of_property_read_u32(chip->dev->of_node, "max-input-voltage", &value); ++ if (ret) { ++ dev_err(chip->dev, "'max-input-voltage' not found!\n"); ++ return -1; ++ } ++ ++ max_vol = value / 1000; ++ ++ ret = of_property_read_u32(chip->dev->of_node, "max-input-current", &value); ++ ++ if (ret) { ++ dev_err(chip->dev, "'max-input-current' not found!\n"); ++ return -1; ++ } ++ ++ max_cur = value / 1000; ++ ++ if (max_vol > 0 && max_cur > 0) ++ fusb_set_pos_power(chip, max_vol, max_cur); ++ ++ return 0; ++ } + + psp = POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX; + if (power_supply_get_property(psy, psp, &val) == 0) + +From 21d2c1a5736234ee156e40e7fbaa9f48f9868ea3 Mon Sep 17 00:00:00 2001 +From: Finley Xiao +Date: Fri, 28 Sep 2018 11:42:38 +0800 +Subject: [PATCH] drm/rockchip: vop: Use Use pm_runtime_put_sync() in + vop_crtc_disable() + +The procedure of rpm_idle() is as follows. +rpm_idle +->rpm_suspend + ->pm_genpd_runtime_suspend + ->pm_clk_suspend + ->clk_disable + ->genpd_poweroff + +Pm_runtime_put(dev) causes rpm_idle() to be queued up, when +pm_clk_suspend() is executed, the rockchip dmcfreq lock is +released, vop clocks may be closed while changing ddr frequency. +Use pm_runtime_put_sync() instead of pm_runtime_put(), so that +rpm_idle can be executed before the lock is released. + +Change-Id: Ibf4ff70b65782427eaf0fe9f7566ebff602d3757 +Signed-off-by: Finley Xiao +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 0916b4284f88..b3f7a8ebcb5d 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1429,7 +1429,7 @@ static void vop_crtc_disable(struct drm_crtc *crtc) + vop->is_iommu_enabled = false; + } + +- pm_runtime_put(vop->dev); ++ pm_runtime_put_sync(vop->dev); + clk_disable_unprepare(vop->dclk); + clk_disable_unprepare(vop->aclk); + clk_disable_unprepare(vop->hclk); + +From fabe40745dfd1b53b48fcb246300722ff71562c8 Mon Sep 17 00:00:00 2001 +From: William Wu +Date: Fri, 19 Oct 2018 10:46:27 +0800 +Subject: [PATCH] usb: dwc3: rockchip: fix usb reenumerated upon pm resume + +On rk3399 platforms, Type-c1 can be simplified to Type-A +port and support USB 3.0 Host only mode. It has a problem +that the dwc3_rockchip_resume() will reset the controller +upon pm resume, and this may cause usb device(e.g. usb 4G +modem) to be reenumerated. This patch sets the flag of +connected to true and avoid to do the reset operation upon +pm resume. + +Change-Id: I57f92d0277a19ce1c7b881fe2da6470fd3a70b73 +Signed-off-by: William Wu +--- + drivers/usb/dwc3/dwc3-rockchip.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/usb/dwc3/dwc3-rockchip.c b/drivers/usb/dwc3/dwc3-rockchip.c +index db482d37df56..3d3b5774b9bb 100644 +--- a/drivers/usb/dwc3/dwc3-rockchip.c ++++ b/drivers/usb/dwc3/dwc3-rockchip.c +@@ -836,6 +836,15 @@ static int dwc3_rockchip_probe(struct platform_device *pdev) + (extcon_get_cable_state_(rockchip->edev, + EXTCON_USB_HOST) > 0)) + schedule_work(&rockchip->otg_work); ++ } else { ++ /* ++ * DWC3 work as Host only mode or Peripheral ++ * only mode, set connected flag to true, it ++ * can avoid to reset the DWC3 controller when ++ * resume from PM suspend which may cause the ++ * usb device to be reenumerated. ++ */ ++ rockchip->connected = true; + } + + dwc3_rockchip_debugfs_init(rockchip); + +From 3b7090b60c9690eca1556c1ede27a089ddb674c3 Mon Sep 17 00:00:00 2001 +From: Yao Xiao +Date: Tue, 4 Sep 2018 09:09:18 +0800 +Subject: [PATCH] net: wireless: update bcmdhd driver to "1.579.77.41.9 (r)" + +Change-Id: I5b5a30393157192fd8c1c033169931e7d5b03df0 +Signed-off-by: Yao Xiao +--- + .../wireless/rockchip_wlan/rkwifi/bcmdhd/Kconfig | 3 + + .../wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile | 171 +- + .../rockchip_wlan/rkwifi/bcmdhd/bcmsdh_linux.c | 12 +- + .../rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c | 5 +- + .../rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c | 8 +- + .../wireless/rockchip_wlan/rkwifi/bcmdhd/dbus.c | 2929 ++++++++++ + .../rockchip_wlan/rkwifi/bcmdhd/dbus_usb.c | 1173 ++++ + .../rockchip_wlan/rkwifi/bcmdhd/dbus_usb_linux.c | 3404 ++++++++++++ + .../net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd.h | 71 +- + .../wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_bus.h | 4 + + .../wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c | 117 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_cfg80211.c | 2 + + .../rockchip_wlan/rkwifi/bcmdhd/dhd_common.c | 38 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_config.c | 1198 ++-- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_config.h | 91 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c | 36 +- + .../wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_ip.c | 16 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c | 569 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_linux.h | 18 + + .../rkwifi/bcmdhd/dhd_linux_platdev.c | 118 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_linux_wq.h | 3 + + .../rockchip_wlan/rkwifi/bcmdhd/dhd_msgbuf.c | 23 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c | 73 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.h | 1 + + .../rockchip_wlan/rkwifi/bcmdhd/dhd_pcie_linux.c | 90 +- + .../wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c | 5 + + .../rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c | 199 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c | 26 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.c | 28 +- + .../rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.h | 5 + + .../rockchip_wlan/rkwifi/bcmdhd/include/bcmdevs.h | 5 + + .../rockchip_wlan/rkwifi/bcmdhd/include/dbus.h | 41 +- + .../rockchip_wlan/rkwifi/bcmdhd/include/epivers.h | 2 +- + .../rkwifi/bcmdhd/include/linux_osl.h | 2 + + .../rockchip_wlan/rkwifi/bcmdhd/include/sbchipc.h | 1 + + .../rockchip_wlan/rkwifi/bcmdhd/include/usbrdl.h | 135 + + .../rockchip_wlan/rkwifi/bcmdhd/include/wlioctl.h | 15 + + .../rockchip_wlan/rkwifi/bcmdhd/linux_osl.c | 11 + + .../wireless/rockchip_wlan/rkwifi/bcmdhd/siutils.c | 3 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_android.c | 192 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_android.h | 93 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c | 5736 +++++++++++++------- + .../rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c | 615 ++- + .../rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.h | 31 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_cfg_btcoex.c | 16 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.c | 20 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.h | 20 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_cfgvendor.c | 7 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_escan.c | 155 +- + .../rockchip_wlan/rkwifi/bcmdhd/wl_escan.h | 16 +- + .../wireless/rockchip_wlan/rkwifi/bcmdhd/wl_iw.c | 54 +- + .../rockchip_wlan/rkwifi/bcmdhd/wldev_common.c | 12 +- + 52 files changed, 14258 insertions(+), 3360 deletions(-) + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c + create mode 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus.c + create mode 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb.c + create mode 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb_linux.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cfg80211.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_ip.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_platdev.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_wq.h + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_msgbuf.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.h + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie_linux.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.h + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/bcmdevs.h + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/linux_osl.h + create mode 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/usbrdl.h + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/linux_osl.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.h + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg_btcoex.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.c + mode change 100755 => 100644 drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.h + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Kconfig b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Kconfig +index 303e009bf4a1..10c06951a65d 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Kconfig ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Kconfig +@@ -38,6 +38,9 @@ config BCMDHD_SDIO + config BCMDHD_PCIE + bool "PCIe bus interface support" + depends on BCMDHD && PCI ++config BCMDHD_USB ++ bool "USB bus interface support" ++ depends on BCMDHD && USB + endchoice + + choice +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile +index a24a0826fd71..c49feed9d913 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile +@@ -6,122 +6,165 @@ + MODULE_NAME = bcmdhd + CONFIG_BCMDHD_SDIO := y + #CONFIG_BCMDHD_PCIE := y ++#CONFIG_BCMDHD_USB := y + CONFIG_BCMDHD_OOB := y + CONFIG_BCMDHD_PROPTXSTATUS := y + CONFIG_BCMDHD_AG := y + #CONFIG_DHD_USE_STATIC_BUF := y + CONFIG_VTS_SUPPORT := y ++#CONFIG_LOGTRACE := y + +-DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER -DSDTEST \ ++CONFIG_MACH_PLATFORM := y ++#CONFIG_BCMDHD_DTS := y ++ ++DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \ + -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \ + -DDHDTHREAD -DDHD_DEBUG -DSHOW_EVENTS -DBCMDBG -DGET_OTP_MAC_ENABLE \ + -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT -DSUPPORT_PM2_ONLY \ + -DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DPNO_SUPPORT -DDHDTCPACK_SUPPRESS \ +- -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DRXFRAME_THREAD \ +- -DTSQ_MULTIPLIER -DMFP -DWL_EXT_IAPSTA \ ++ -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT \ ++ -DMULTIPLE_SUPPLICANT -DTSQ_MULTIPLIER -DMFP \ ++ -DWL_EXT_IAPSTA \ + -DENABLE_INSMOD_NO_FW_LOAD -DDHD_UNSUPPORT_IF_CNTS \ + -Idrivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd \ + -Idrivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include + +-DHDOFILES = aiutils.o siutils.o sbutils.o bcmutils.o bcmwifi_channels.o \ +- dhd_linux.o dhd_linux_platdev.o dhd_linux_sched.o dhd_pno.o \ +- dhd_common.o dhd_ip.o dhd_linux_wq.o dhd_custom_gpio.o \ +- bcmevent.o hndpmu.o linux_osl.o wldev_common.o wl_android.o \ ++DHDOFILES = aiutils.o siutils.o sbutils.o bcmutils.o bcmwifi_channels.o \ ++ dhd_linux.o dhd_linux_platdev.o dhd_linux_sched.o dhd_pno.o \ ++ dhd_common.o dhd_ip.o dhd_linux_wq.o dhd_custom_gpio.o \ ++ bcmevent.o hndpmu.o linux_osl.o wldev_common.o wl_android.o \ + hnd_pktq.o hnd_pktpool.o dhd_config.o wl_android_ext.o + ++#BCMDHD_SDIO + ifneq ($(CONFIG_BCMDHD_SDIO),) +-DHDCFLAGS += \ +- -DBCMSDIO -DMMC_SDIO_ABORT -DBCMLXSDMMC -DUSE_SDIOFIFO_IOVAR \ +- -DBDC -DDHD_USE_IDLECOUNT -DBCMSDIOH_TXGLOM -DBCMSDIOH_TXGLOM_EXT \ +- -DCUSTOM_SDIO_F2_BLKSIZE=256 +- +-DHDOFILES += bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \ +- dhd_sdio.o dhd_cdc.o dhd_wlfc.o +- ++DHDCFLAGS += -DBCMSDIO -DMMC_SDIO_ABORT -DBCMLXSDMMC -DUSE_SDIOFIFO_IOVAR \ ++ -DSDTEST -DBDC -DDHD_USE_IDLECOUNT -DCUSTOM_SDIO_F2_BLKSIZE=256 \ ++ -DBCMSDIOH_TXGLOM -DBCMSDIOH_TXGLOM_EXT -DRXFRAME_THREAD + ifeq ($(CONFIG_BCMDHD_OOB),y) +-DHDCFLAGS += -DOOB_INTR_ONLY -DCUSTOMER_OOB -DHW_OOB ++ DHDCFLAGS += -DOOB_INTR_ONLY -DCUSTOMER_OOB -DHW_OOB + ifeq ($(CONFIG_BCMDHD_DISABLE_WOWLAN),y) +-DHDCFLAGS += -DDISABLE_WOWLAN ++ DHDCFLAGS += -DDISABLE_WOWLAN + endif + else +-DHDCFLAGS += -DSDIO_ISR_THREAD +-endif ++ DHDCFLAGS += -DSDIO_ISR_THREAD + endif + +-ifeq ($(CONFIG_BCMDHD_PROPTXSTATUS),y) +-ifneq ($(CONFIG_BCMDHD_SDIO),) +-DHDCFLAGS += -DPROP_TXSTATUS +-endif +-ifneq ($(CONFIG_CFG80211),) +-DHDCFLAGS += -DPROP_TXSTATUS_VSDB +-endif ++DHDOFILES += bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \ ++ dhd_sdio.o dhd_cdc.o dhd_wlfc.o + endif + ++#BCMDHD_PCIE + ifneq ($(CONFIG_BCMDHD_PCIE),) +-DHDCFLAGS += \ +- -DPCIE_FULL_DONGLE -DBCMPCIE -DCUSTOM_DPC_PRIO_SETTING=-1 ++DHDCFLAGS += -DPCIE_FULL_DONGLE -DBCMPCIE -DCUSTOM_DPC_PRIO_SETTING=-1 \ ++ -DDONGLE_ENABLE_ISOLATION ++ifneq ($(CONFIG_PCI_MSI),) ++ DHDCFLAGS += -DDHD_USE_MSI ++endif + ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y) +-DHDCFLAGS += -DDHD_USE_STATIC_CTRLBUF ++ DHDCFLAGS += -DDHD_USE_STATIC_CTRLBUF + endif + +-DHDOFILES += dhd_pcie.o dhd_pcie_linux.o pcie_core.o dhd_flowring.o \ ++DHDOFILES += dhd_pcie.o dhd_pcie_linux.o pcie_core.o dhd_flowring.o \ + dhd_msgbuf.o + endif + ++#BCMDHD_USB ++ifneq ($(CONFIG_BCMDHD_USB),) ++DHDCFLAGS += -DUSBOS_TX_THREAD -DBCMDBUS -DBCMTRXV2 -DDBUS_USB_LOOPBACK \ ++ -DBDC ++DHDCFLAGS += -DBCM_REQUEST_FW -DEXTERNAL_FW_PATH ++#DHDCFLAGS :=$(filter-out -DENABLE_INSMOD_NO_FW_LOAD,$(DHDCFLAGS)) ++ ++DHDOFILES += dbus.o dbus_usb.o dbus_usb_linux.o dhd_cdc.o dhd_wlfc.o ++endif ++ ++ifeq ($(CONFIG_BCMDHD_PROPTXSTATUS),y) ++ifneq ($(CONFIG_BCMDHD_USB),) ++ DHDCFLAGS += -DPROP_TXSTATUS ++endif ++ifneq ($(CONFIG_BCMDHD_SDIO),) ++ DHDCFLAGS += -DPROP_TXSTATUS ++endif ++ifneq ($(CONFIG_CFG80211),) ++ DHDCFLAGS += -DPROP_TXSTATUS_VSDB ++endif ++endif ++ ++#VTS_SUPPORT + ifeq ($(CONFIG_VTS_SUPPORT),y) +-DHDCFLAGS += \ +- -DGSCAN_SUPPORT -DRTT_SUPPORT -DCUSTOM_FORCE_NODFS_FLAG \ +- -DLINKSTAT_SUPPORT -DDEBUGABILITY -DDBG_PKT_MON -DKEEP_ALIVE -DPKT_FILTER_SUPPORT \ +- -DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHDTCPACK_SUPPRESS -DDHD_WAKE_STATUS \ ++ifneq ($(CONFIG_CFG80211),) ++DHDCFLAGS += -DGSCAN_SUPPORT -DRTT_SUPPORT -DCUSTOM_FORCE_NODFS_FLAG \ ++ -DLINKSTAT_SUPPORT -DDEBUGABILITY -DDBG_PKT_MON -DPKT_FILTER_SUPPORT \ ++ -DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHD_WAKE_STATUS \ + -DCUSTOM_COUNTRY_CODE -DDHD_FW_COREDUMP -DEXPLICIT_DISCIF_CLEANUP + +-DHDOFILES += dhd_debug_linux.o dhd_debug.o bcmxtlv.o \ +- dhd_rtt.o bcm_app_utils.o ++DHDOFILES += bcmxtlv.o dhd_rtt.o bcm_app_utils.o ++CONFIG_LOGTRACE := y ++endif ++endif ++ ++#LOGTRACE ++ifeq ($(CONFIG_LOGTRACE),y) ++ DHDCFLAGS += -DSHOW_LOGTRACE ++ DHDOFILES += dhd_debug_linux.o dhd_debug.o dhd_mschdbg.o + endif + ++# MESH support for kernel 3.10 later ++ifeq ($(CONFIG_WL_MESH),y) ++ DHDCFLAGS += -DWLMESH ++ifneq ($(CONFIG_BCMDHD_PCIE),) ++ DHDCFLAGS += -DBCM_HOST_BUF -DDMA_HOST_BUFFER_LEN=0x80000 ++endif ++ DHDCFLAGS += -DDHD_UPDATE_INTF_MAC ++ DHDCFLAGS :=$(filter-out -DDHD_FW_COREDUMP,$(DHDCFLAGS)) ++ DHDCFLAGS :=$(filter-out -DSET_RANDOM_MAC_SOFTAP,$(DHDCFLAGS)) ++endif ++ ++#obj-$(CONFIG_RKWIFI) += bcmdhd.o + obj-$(CONFIG_AP6XXX) += bcmdhd.o + bcmdhd-objs += $(DHDOFILES) + +-#ifeq ($(CONFIG_MACH_PLATFORM),y) +-DHDOFILES += dhd_gpio.o +-DHDCFLAGS += -DCUSTOMER_HW -DDHD_OF_SUPPORT +-#DHDCFLAGS += -DBCMWAPI_WPI -DBCMWAPI_WAI +-#endif ++ifeq ($(CONFIG_MACH_PLATFORM),y) ++ DHDOFILES += dhd_gpio.o ++ifeq ($(CONFIG_BCMDHD_DTS),y) ++ DHDCFLAGS += -DCONFIG_DTS ++else ++ DHDCFLAGS += -DCUSTOMER_HW -DDHD_OF_SUPPORT ++endif ++# DHDCFLAGS += -DBCMWAPI_WPI -DBCMWAPI_WAI ++endif + + ifeq ($(CONFIG_BCMDHD_AG),y) +-DHDCFLAGS += -DBAND_AG ++ DHDCFLAGS += -DBAND_AG + endif + + ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y) +-obj-m += dhd_static_buf.o +-DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT -DENHANCED_STATIC_BUF +-DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP -DCONFIG_DHD_USE_STATIC_BUF ++ obj-m += dhd_static_buf.o ++ DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT -DENHANCED_STATIC_BUF ++ DHDCFLAGS += -DDHD_USE_STATIC_MEMDUMP -DCONFIG_DHD_USE_STATIC_BUF + endif + + ifneq ($(CONFIG_WIRELESS_EXT),) +-DHDOFILES += wl_iw.o wl_escan.o +-DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW -DWL_ESCAN ++ DHDOFILES += wl_iw.o wl_escan.o ++ DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW -DWL_ESCAN + endif + ifneq ($(CONFIG_CFG80211),) +-DHDOFILES += wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o wl_cfg_btcoex.o wl_cfgvendor.o +-DHDOFILES += dhd_cfg80211.o +-DHDCFLAGS += -DWL_CFG80211 -DWLP2P -DWL_CFG80211_STA_EVENT -DWL_ENABLE_P2P_IF +-#DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS +-DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65 +-DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15 +-DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000 +-DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7 +-DHDCFLAGS += -DWL_SUPPORT_AUTO_CHANNEL +-DHDCFLAGS += -DWL_SUPPORT_BACKPORTED_KPATCHES +-DHDCFLAGS += -DESCAN_RESULT_PATCH +-DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST +-DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8 +-DHDCFLAGS += -DWL_VIRTUAL_APSTA ++ DHDOFILES += wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o wl_cfg_btcoex.o wl_cfgvendor.o ++ DHDOFILES += dhd_cfg80211.o ++ DHDCFLAGS += -DWL_CFG80211 -DWLP2P -DWL_CFG80211_STA_EVENT -DWL_ENABLE_P2P_IF ++# DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS ++ DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65 ++ DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15 ++ DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000 ++ DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7 ++ DHDCFLAGS += -DWL_SUPPORT_AUTO_CHANNEL ++ DHDCFLAGS += -DWL_SUPPORT_BACKPORTED_KPATCHES ++ DHDCFLAGS += -DESCAN_RESULT_PATCH -DESCAN_BUF_OVERFLOW_MGMT ++ DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST ++ DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8 ++ DHDCFLAGS += -DWL_VIRTUAL_APSTA + endif + EXTRA_CFLAGS = $(DHDCFLAGS) + ifeq ($(CONFIG_BCMDHD),m) +-DHDCFLAGS += -DMULTIPLE_SUPPLICANT + EXTRA_LDFLAGS += --strip-debug +-else +-DHDCFLAGS += -DBUILD_IN_KERNEL + endif +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_linux.c +index 9e3f641bf038..41462a37e6e6 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_linux.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_linux.c +@@ -52,7 +52,6 @@ extern void dhdsdio_isr(void * args); + #endif /* defined(CONFIG_ARCH_ODIN) */ + #include + +- + /* driver info, initialized when bcmsdh_register is called */ + static bcmsdh_driver_t drvinfo = {NULL, NULL, NULL, NULL}; + +@@ -363,13 +362,13 @@ int bcmsdh_oob_intr_register(bcmsdh_info_t *bcmsdh, bcmsdh_cb_fn_t oob_irq_handl + SDLX_MSG(("%s: irq is already registered\n", __FUNCTION__)); + return -EBUSY; + } +- SDLX_MSG(("%s %s irq=%d flags=0x%X\n", __FUNCTION__, + #ifdef HW_OOB +- "HW_OOB", ++ printf("%s: HW_OOB irq=%d flags=0x%X\n", __FUNCTION__, ++ (int)bcmsdh_osinfo->oob_irq_num, (int)bcmsdh_osinfo->oob_irq_flags); + #else +- "SW_OOB", ++ printf("%s: SW_OOB irq=%d flags=0x%X\n", __FUNCTION__, ++ (int)bcmsdh_osinfo->oob_irq_num, (int)bcmsdh_osinfo->oob_irq_flags); + #endif +- (int)bcmsdh_osinfo->oob_irq_num, (int)bcmsdh_osinfo->oob_irq_flags)); + bcmsdh_osinfo->oob_irq_handler = oob_irq_handler; + bcmsdh_osinfo->oob_irq_handler_context = oob_irq_handler_context; + bcmsdh_osinfo->oob_irq_enabled = TRUE; +@@ -398,6 +397,7 @@ int bcmsdh_oob_intr_register(bcmsdh_info_t *bcmsdh, bcmsdh_cb_fn_t oob_irq_handl + else + bcmsdh_osinfo->oob_irq_wake_enabled = TRUE; + #endif ++ + return 0; + } + +@@ -423,7 +423,7 @@ void bcmsdh_oob_intr_unregister(bcmsdh_info_t *bcmsdh) + free_irq(bcmsdh_osinfo->oob_irq_num, bcmsdh); + bcmsdh_osinfo->oob_irq_registered = FALSE; + } +-#endif ++#endif + + /* Module parameters specific to each host-controller driver */ + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c +index ccfcce2c66ca..31b05ce71b72 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc.c +@@ -995,7 +995,6 @@ sdioh_set_mode(sdioh_info_t *sd, uint mode) + sd->txglom_mode = mode; + else if (mode == SDPCM_TXGLOM_MDESC) + sd->txglom_mode = mode; +- printf("%s: set txglom_mode to %s\n", __FUNCTION__, mode==SDPCM_TXGLOM_MDESC?"multi-desc":"copy"); + + return (sd->txglom_mode); + } +@@ -1288,8 +1287,8 @@ txglomfail: + + if (sd_msglevel & SDH_COST_VAL) { + getnstimeofday(&now); +- sd_cost(("%s: rw=%d, cost=%lds %luus\n", __FUNCTION__, +- write, now.tv_sec-before.tv_sec, now.tv_nsec/1000-before.tv_nsec/1000)); ++ sd_cost(("%s: rw=%d, ttl_len=%d, cost=%lds %luus\n", __FUNCTION__, ++ write, ttl_len, now.tv_sec-before.tv_sec, now.tv_nsec/1000-before.tv_nsec/1000)); + } + + sd_trace(("%s: Exit\n", __FUNCTION__)); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c +old mode 100755 +new mode 100644 +index b5a388cc3cbe..35b91ff7fc27 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmsdh_sdmmc_linux.c +@@ -232,7 +232,7 @@ static const struct sdio_device_id bcmsdh_sdmmc_ids[] = { + + MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) + static int bcmsdh_sdmmc_suspend(struct device *pdev) + { + int err; +@@ -275,9 +275,7 @@ static int bcmsdh_sdmmc_suspend(struct device *pdev) + + static int bcmsdh_sdmmc_resume(struct device *pdev) + { +-#if defined(OOB_INTR_ONLY) + sdioh_info_t *sdioh; +-#endif + struct sdio_func *func = dev_to_sdio_func(pdev); + + printf("%s Enter func->num=%d\n", __FUNCTION__, func->num); +@@ -285,10 +283,8 @@ static int bcmsdh_sdmmc_resume(struct device *pdev) + return 0; + + dhd_mmc_suspend = FALSE; +-#if defined(OOB_INTR_ONLY) + sdioh = sdio_get_drvdata(func); + bcmsdh_resume(sdioh->bcmsdh); +-#endif + + smp_mb(); + printf("%s Exit\n", __FUNCTION__); +@@ -346,7 +342,7 @@ static struct sdio_driver bcmsdh_sdmmc_driver = { + .remove = bcmsdh_sdmmc_remove, + .name = "bcmsdh_sdmmc", + .id_table = bcmsdh_sdmmc_ids, +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM_SLEEP) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) && defined(CONFIG_PM) + .drv = { + .pm = &bcmsdh_sdmmc_pm_ops, + }, +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus.c +new file mode 100644 +index 000000000000..aeec7761fdc3 +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus.c +@@ -0,0 +1,2929 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/** @file dbus.c ++ * ++ * Hides details of USB / SDIO / SPI interfaces and OS details. It is intended to shield details and ++ * provide the caller with one common bus interface for all dongle devices. In practice, it is only ++ * used for USB interfaces. DBUS is not a protocol, but an abstraction layer. ++ * ++ * Copyright (C) 1999-2016, Broadcom Corporation ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2 (the "GPL"), ++ * available at http://www.broadcom.com/licenses/GPLv2.php, with the ++ * following added to such license: ++ * ++ * As a special exception, the copyright holders of this software give you ++ * permission to link this software with independent modules, and to copy and ++ * distribute the resulting executable under terms of your choice, provided that ++ * you also meet, for each linked independent module, the terms and conditions of ++ * the license of that module. An independent module is a module which is not ++ * derived from this software. The special exception does not apply to any ++ * modifications of the software. ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a license ++ * other than the GPL, without Broadcom's express prior written consent. ++ * ++ * ++ * <> ++ * ++ * $Id: dbus.c 553311 2015-04-29 10:23:08Z $ ++ */ ++ ++ ++#include "osl.h" ++#include "dbus.h" ++#include ++#include ++#include ++#include ++#ifdef PROP_TXSTATUS /* a form of flow control between host and dongle */ ++#include ++#endif ++#include ++ ++#if defined(BCM_REQUEST_FW) ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#endif ++ ++ ++ ++#if defined(BCM_REQUEST_FW) ++#ifndef VARS_MAX ++#define VARS_MAX 8192 ++#endif ++#endif ++ ++#ifdef DBUS_USB_LOOPBACK ++extern bool is_loopback_pkt(void *buf); ++extern int matches_loopback_pkt(void *buf); ++#endif ++ ++/** General info for all BUS types */ ++typedef struct dbus_irbq { ++ dbus_irb_t *head; ++ dbus_irb_t *tail; ++ int cnt; ++} dbus_irbq_t; ++ ++/** ++ * This private structure dhd_bus_t is also declared in dbus_usb_linux.c. ++ * All the fields must be consistent in both declarations. ++ */ ++typedef struct dhd_bus { ++ dbus_pub_t pub; /* MUST BE FIRST */ ++ dhd_pub_t *dhd; ++ ++ void *cbarg; ++ dbus_callbacks_t *cbs; /* callbacks to higher level, e.g. dhd_linux.c */ ++ void *bus_info; ++ dbus_intf_t *drvintf; /* callbacks to lower level, e.g. dbus_usb.c or dbus_usb_linux.c */ ++ uint8 *fw; ++ int fwlen; ++ uint32 errmask; ++ int rx_low_watermark; /* avoid rx overflow by filling rx with free IRBs */ ++ int tx_low_watermark; ++ bool txoff; ++ bool txoverride; /* flow control related */ ++ bool rxoff; ++ bool tx_timer_ticking; ++ ++ ++ dbus_irbq_t *rx_q; ++ dbus_irbq_t *tx_q; ++ ++ uint8 *nvram; ++ int nvram_len; ++ uint8 *image; /* buffer for combine fw and nvram */ ++ int image_len; ++ uint8 *orig_fw; ++ int origfw_len; ++ int decomp_memsize; ++ dbus_extdl_t extdl; ++ int nvram_nontxt; ++#if defined(BCM_REQUEST_FW) ++ void *firmware; ++ void *nvfile; ++#endif ++ char *fw_path; /* module_param: path to firmware image */ ++ char *nv_path; /* module_param: path to nvram vars file */ ++} dhd_bus_t; ++ ++struct exec_parms { ++ union { ++ /* Can consolidate same params, if need be, but this shows ++ * group of parameters per function ++ */ ++ struct { ++ dbus_irbq_t *q; ++ dbus_irb_t *b; ++ } qenq; ++ ++ struct { ++ dbus_irbq_t *q; ++ } qdeq; ++ }; ++}; ++ ++#define EXEC_RXLOCK(info, fn, a) \ ++ info->drvintf->exec_rxlock(dhd_bus->bus_info, ((exec_cb_t)fn), ((struct exec_parms *) a)) ++ ++#define EXEC_TXLOCK(info, fn, a) \ ++ info->drvintf->exec_txlock(dhd_bus->bus_info, ((exec_cb_t)fn), ((struct exec_parms *) a)) ++ ++/* ++ * Callbacks common for all BUS ++ */ ++static void dbus_if_send_irb_timeout(void *handle, dbus_irb_tx_t *txirb); ++static void dbus_if_send_irb_complete(void *handle, dbus_irb_tx_t *txirb, int status); ++static void dbus_if_recv_irb_complete(void *handle, dbus_irb_rx_t *rxirb, int status); ++static void dbus_if_errhandler(void *handle, int err); ++static void dbus_if_ctl_complete(void *handle, int type, int status); ++static void dbus_if_state_change(void *handle, int state); ++static void *dbus_if_pktget(void *handle, uint len, bool send); ++static void dbus_if_pktfree(void *handle, void *p, bool send); ++static struct dbus_irb *dbus_if_getirb(void *cbarg, bool send); ++static void dbus_if_rxerr_indicate(void *handle, bool on); ++ ++void * dhd_dbus_probe_cb(void *arg, const char *desc, uint32 bustype, ++ uint16 bus_no, uint16 slot, uint32 hdrlen); ++void dhd_dbus_disconnect_cb(void *arg); ++void dbus_detach(dhd_bus_t *pub); ++ ++/** functions in this file that are called by lower DBUS levels, e.g. dbus_usb.c */ ++static dbus_intf_callbacks_t dbus_intf_cbs = { ++ dbus_if_send_irb_timeout, ++ dbus_if_send_irb_complete, ++ dbus_if_recv_irb_complete, ++ dbus_if_errhandler, ++ dbus_if_ctl_complete, ++ dbus_if_state_change, ++ NULL, /* isr */ ++ NULL, /* dpc */ ++ NULL, /* watchdog */ ++ dbus_if_pktget, ++ dbus_if_pktfree, ++ dbus_if_getirb, ++ dbus_if_rxerr_indicate ++}; ++ ++/* ++ * Need global for probe() and disconnect() since ++ * attach() is not called at probe and detach() ++ * can be called inside disconnect() ++ */ ++static dbus_intf_t *g_busintf = NULL; ++static probe_cb_t probe_cb = NULL; ++static disconnect_cb_t disconnect_cb = NULL; ++static void *probe_arg = NULL; ++static void *disc_arg = NULL; ++ ++#if defined(BCM_REQUEST_FW) ++int8 *nonfwnvram = NULL; /* stand-alone multi-nvram given with driver load */ ++int nonfwnvramlen = 0; ++#endif /* #if defined(BCM_REQUEST_FW) */ ++ ++static void* q_enq(dbus_irbq_t *q, dbus_irb_t *b); ++static void* q_enq_exec(struct exec_parms *args); ++static dbus_irb_t*q_deq(dbus_irbq_t *q); ++static void* q_deq_exec(struct exec_parms *args); ++static int dbus_tx_timer_init(dhd_bus_t *dhd_bus); ++static int dbus_tx_timer_start(dhd_bus_t *dhd_bus, uint timeout); ++static int dbus_tx_timer_stop(dhd_bus_t *dhd_bus); ++static int dbus_irbq_init(dhd_bus_t *dhd_bus, dbus_irbq_t *q, int nq, int size_irb); ++static int dbus_irbq_deinit(dhd_bus_t *dhd_bus, dbus_irbq_t *q, int size_irb); ++static int dbus_rxirbs_fill(dhd_bus_t *dhd_bus); ++static int dbus_send_irb(dbus_pub_t *pub, uint8 *buf, int len, void *pkt, void *info); ++static void dbus_disconnect(void *handle); ++static void *dbus_probe(void *arg, const char *desc, uint32 bustype, ++ uint16 bus_no, uint16 slot, uint32 hdrlen); ++ ++#if defined(BCM_REQUEST_FW) ++extern char * dngl_firmware; ++extern unsigned int dngl_fwlen; ++#ifndef EXTERNAL_FW_PATH ++static int dbus_get_nvram(dhd_bus_t *dhd_bus); ++static int dbus_jumbo_nvram(dhd_bus_t *dhd_bus); ++static int dbus_otp(dhd_bus_t *dhd_bus, uint16 *boardtype, uint16 *boardrev); ++static int dbus_select_nvram(dhd_bus_t *dhd_bus, int8 *jumbonvram, int jumbolen, ++uint16 boardtype, uint16 boardrev, int8 **nvram, int *nvram_len); ++#endif /* !EXTERNAL_FW_PATH */ ++extern int dbus_zlib_decomp(dhd_bus_t *dhd_bus); ++extern void *dbus_zlib_calloc(int num, int size); ++extern void dbus_zlib_free(void *ptr); ++#endif ++ ++/* function */ ++void ++dbus_flowctrl_tx(void *dbi, bool on) ++{ ++ dhd_bus_t *dhd_bus = dbi; ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ DBUSTRACE(("%s on %d\n", __FUNCTION__, on)); ++ ++ if (dhd_bus->txoff == on) ++ return; ++ ++ dhd_bus->txoff = on; ++ ++ if (dhd_bus->cbs && dhd_bus->cbs->txflowcontrol) ++ dhd_bus->cbs->txflowcontrol(dhd_bus->cbarg, on); ++} ++ ++/** ++ * if lower level DBUS signaled a rx error, more free rx IRBs should be allocated or flow control ++ * should kick in to make more free rx IRBs available. ++ */ ++static void ++dbus_if_rxerr_indicate(void *handle, bool on) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ ++ DBUSTRACE(("%s, on %d\n", __FUNCTION__, on)); ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ if (dhd_bus->txoverride == on) ++ return; ++ ++ dhd_bus->txoverride = on; /* flow control */ ++ ++ if (!on) ++ dbus_rxirbs_fill(dhd_bus); ++ ++} ++ ++/** q_enq()/q_deq() are executed with protection via exec_rxlock()/exec_txlock() */ ++static void* ++q_enq(dbus_irbq_t *q, dbus_irb_t *b) ++{ ++ ASSERT(q->tail != b); ++ ASSERT(b->next == NULL); ++ b->next = NULL; ++ if (q->tail) { ++ q->tail->next = b; ++ q->tail = b; ++ } else ++ q->head = q->tail = b; ++ ++ q->cnt++; ++ ++ return b; ++} ++ ++static void* ++q_enq_exec(struct exec_parms *args) ++{ ++ return q_enq(args->qenq.q, args->qenq.b); ++} ++ ++static dbus_irb_t* ++q_deq(dbus_irbq_t *q) ++{ ++ dbus_irb_t *b; ++ ++ b = q->head; ++ if (b) { ++ q->head = q->head->next; ++ b->next = NULL; ++ ++ if (q->head == NULL) ++ q->tail = q->head; ++ ++ q->cnt--; ++ } ++ return b; ++} ++ ++static void* ++q_deq_exec(struct exec_parms *args) ++{ ++ return q_deq(args->qdeq.q); ++} ++ ++/** ++ * called during attach phase. Status @ Dec 2012: this function does nothing since for all of the ++ * lower DBUS levels dhd_bus->drvintf->tx_timer_init is NULL. ++ */ ++static int ++dbus_tx_timer_init(dhd_bus_t *dhd_bus) ++{ ++ if (dhd_bus && dhd_bus->drvintf && dhd_bus->drvintf->tx_timer_init) ++ return dhd_bus->drvintf->tx_timer_init(dhd_bus->bus_info); ++ else ++ return DBUS_ERR; ++} ++ ++static int ++dbus_tx_timer_start(dhd_bus_t *dhd_bus, uint timeout) ++{ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (dhd_bus->tx_timer_ticking) ++ return DBUS_OK; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->tx_timer_start) { ++ if (dhd_bus->drvintf->tx_timer_start(dhd_bus->bus_info, timeout) == DBUS_OK) { ++ dhd_bus->tx_timer_ticking = TRUE; ++ return DBUS_OK; ++ } ++ } ++ ++ return DBUS_ERR; ++} ++ ++static int ++dbus_tx_timer_stop(dhd_bus_t *dhd_bus) ++{ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (!dhd_bus->tx_timer_ticking) ++ return DBUS_OK; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->tx_timer_stop) { ++ if (dhd_bus->drvintf->tx_timer_stop(dhd_bus->bus_info) == DBUS_OK) { ++ dhd_bus->tx_timer_ticking = FALSE; ++ return DBUS_OK; ++ } ++ } ++ ++ return DBUS_ERR; ++} ++ ++/** called during attach phase. */ ++static int ++dbus_irbq_init(dhd_bus_t *dhd_bus, dbus_irbq_t *q, int nq, int size_irb) ++{ ++ int i; ++ dbus_irb_t *irb; ++ ++ ASSERT(q); ++ ASSERT(dhd_bus); ++ ++ for (i = 0; i < nq; i++) { ++ /* MALLOC dbus_irb_tx or dbus_irb_rx, but cast to simple dbus_irb_t linkedlist */ ++ irb = (dbus_irb_t *) MALLOC(dhd_bus->pub.osh, size_irb); ++ if (irb == NULL) { ++ ASSERT(irb); ++ return DBUS_ERR; ++ } ++ bzero(irb, size_irb); ++ ++ /* q_enq() does not need to go through EXEC_xxLOCK() during init() */ ++ q_enq(q, irb); ++ } ++ ++ return DBUS_OK; ++} ++ ++/** called during detach phase or when attach failed */ ++static int ++dbus_irbq_deinit(dhd_bus_t *dhd_bus, dbus_irbq_t *q, int size_irb) ++{ ++ dbus_irb_t *irb; ++ ++ ASSERT(q); ++ ASSERT(dhd_bus); ++ ++ /* q_deq() does not need to go through EXEC_xxLOCK() ++ * during deinit(); all callbacks are stopped by this time ++ */ ++ while ((irb = q_deq(q)) != NULL) { ++ MFREE(dhd_bus->pub.osh, irb, size_irb); ++ } ++ ++ if (q->cnt) ++ DBUSERR(("deinit: q->cnt=%d > 0\n", q->cnt)); ++ return DBUS_OK; ++} ++ ++/** multiple code paths require the rx queue to be filled with more free IRBs */ ++static int ++dbus_rxirbs_fill(dhd_bus_t *dhd_bus) ++{ ++ int err = DBUS_OK; ++ ++ ++ dbus_irb_rx_t *rxirb; ++ struct exec_parms args; ++ ++ ASSERT(dhd_bus); ++ if (dhd_bus->pub.busstate != DBUS_STATE_UP) { ++ DBUSERR(("dbus_rxirbs_fill: DBUS not up \n")); ++ return DBUS_ERR; ++ } else if (!dhd_bus->drvintf || (dhd_bus->drvintf->recv_irb == NULL)) { ++ /* Lower edge bus interface does not support recv_irb(). ++ * No need to pre-submit IRBs in this case. ++ */ ++ return DBUS_ERR; ++ } ++ ++ /* The dongle recv callback is freerunning without lock. So multiple callbacks(and this ++ * refill) can run in parallel. While the rxoff condition is triggered outside, ++ * below while loop has to check and abort posting more to avoid RPC rxq overflow. ++ */ ++ args.qdeq.q = dhd_bus->rx_q; ++ while ((!dhd_bus->rxoff) && ++ (rxirb = (EXEC_RXLOCK(dhd_bus, q_deq_exec, &args))) != NULL) { ++ err = dhd_bus->drvintf->recv_irb(dhd_bus->bus_info, rxirb); ++ if (err == DBUS_ERR_RXDROP || err == DBUS_ERR_RXFAIL) { ++ /* Add the the free rxirb back to the queue ++ * and wait till later ++ */ ++ bzero(rxirb, sizeof(dbus_irb_rx_t)); ++ args.qenq.q = dhd_bus->rx_q; ++ args.qenq.b = (dbus_irb_t *) rxirb; ++ EXEC_RXLOCK(dhd_bus, q_enq_exec, &args); ++ break; ++ } else if (err != DBUS_OK) { ++ int i = 0; ++ while (i++ < 100) { ++ DBUSERR(("%s :: memory leak for rxirb note?\n", __FUNCTION__)); ++ } ++ } ++ } ++ return err; ++} /* dbus_rxirbs_fill */ ++ ++/** called when the DBUS interface state changed. */ ++void ++dbus_flowctrl_rx(dbus_pub_t *pub, bool on) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus->rxoff == on) ++ return; ++ ++ dhd_bus->rxoff = on; ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP) { ++ if (!on) { ++ /* post more irbs, resume rx if necessary */ ++ dbus_rxirbs_fill(dhd_bus); ++ if (dhd_bus && dhd_bus->drvintf->recv_resume) { ++ dhd_bus->drvintf->recv_resume(dhd_bus->bus_info); ++ } ++ } else { ++ /* ??? cancell posted irbs first */ ++ ++ if (dhd_bus && dhd_bus->drvintf->recv_stop) { ++ dhd_bus->drvintf->recv_stop(dhd_bus->bus_info); ++ } ++ } ++ } ++} ++ ++/** ++ * Several code paths in this file want to send a buffer to the dongle. This function handles both ++ * sending of a buffer or a pkt. ++ */ ++static int ++dbus_send_irb(dbus_pub_t *pub, uint8 *buf, int len, void *pkt, void *info) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_OK; ++ dbus_irb_tx_t *txirb = NULL; ++ int txirb_pending; ++ struct exec_parms args; ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP || ++ dhd_bus->pub.busstate == DBUS_STATE_SLEEP) { ++ args.qdeq.q = dhd_bus->tx_q; ++ if (dhd_bus->drvintf) ++ txirb = EXEC_TXLOCK(dhd_bus, q_deq_exec, &args); ++ ++ if (txirb == NULL) { ++ DBUSERR(("Out of tx dbus_bufs\n")); ++ return DBUS_ERR; ++ } ++ ++ if (pkt != NULL) { ++ txirb->pkt = pkt; ++ txirb->buf = NULL; ++ txirb->len = 0; ++ } else if (buf != NULL) { ++ txirb->pkt = NULL; ++ txirb->buf = buf; ++ txirb->len = len; ++ } else { ++ ASSERT(0); /* Should not happen */ ++ } ++ txirb->info = info; ++ txirb->arg = NULL; ++ txirb->retry_count = 0; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->send_irb) { ++ /* call lower DBUS level send_irb function */ ++ err = dhd_bus->drvintf->send_irb(dhd_bus->bus_info, txirb); ++ if (err == DBUS_ERR_TXDROP) { ++ /* tx fail and no completion routine to clean up, reclaim irb NOW */ ++ DBUSERR(("%s: send_irb failed, status = %d\n", __FUNCTION__, err)); ++ bzero(txirb, sizeof(dbus_irb_tx_t)); ++ args.qenq.q = dhd_bus->tx_q; ++ args.qenq.b = (dbus_irb_t *) txirb; ++ EXEC_TXLOCK(dhd_bus, q_enq_exec, &args); ++ } else { ++ dbus_tx_timer_start(dhd_bus, DBUS_TX_TIMEOUT_INTERVAL); ++ txirb_pending = dhd_bus->pub.ntxq - dhd_bus->tx_q->cnt; ++ if (txirb_pending > (dhd_bus->tx_low_watermark * 3)) { ++ dbus_flowctrl_tx(dhd_bus, TRUE); ++ } ++ } ++ } ++ } else { ++ err = DBUS_ERR_TXFAIL; ++ DBUSTRACE(("%s: bus down, send_irb failed\n", __FUNCTION__)); ++ } ++ ++ return err; ++} /* dbus_send_irb */ ++ ++#if defined(BCM_REQUEST_FW) ++ ++/** ++ * Before downloading a firmware image into the dongle, the validity of the image must be checked. ++ */ ++static int ++check_file(osl_t *osh, unsigned char *headers) ++{ ++ struct trx_header *trx; ++ int actual_len = -1; ++ ++ /* Extract trx header */ ++ trx = (struct trx_header *)headers; ++ if (ltoh32(trx->magic) != TRX_MAGIC) { ++ printf("Error: trx bad hdr %x\n", ltoh32(trx->magic)); ++ return -1; ++ } ++ ++ headers += SIZEOF_TRX(trx); ++ ++ /* TRX V1: get firmware len */ ++ /* TRX V2: get firmware len and DSG/CFG lengths */ ++ if (ltoh32(trx->flag_version) & TRX_UNCOMP_IMAGE) { ++ actual_len = ltoh32(trx->offsets[TRX_OFFSETS_DLFWLEN_IDX]) + ++ SIZEOF_TRX(trx); ++#ifdef BCMTRXV2 ++ if (ISTRX_V2(trx)) { ++ actual_len += ltoh32(trx->offsets[TRX_OFFSETS_DSG_LEN_IDX]) + ++ ltoh32(trx->offsets[TRX_OFFSETS_CFG_LEN_IDX]); ++ } ++#endif ++ return actual_len; ++ } else { ++ printf("compressed image\n"); ++ } ++ ++ return -1; ++} ++ ++#ifdef EXTERNAL_FW_PATH ++static int ++dbus_get_fw_nvram(dhd_bus_t *dhd_bus, char *pfw_path, char *pnv_path) ++{ ++ int bcmerror = -1, i; ++ uint len, total_len; ++ void *nv_image = NULL, *fw_image = NULL; ++ char *nv_memblock = NULL, *fw_memblock = NULL; ++ char *bufp; ++ bool file_exists; ++ uint8 nvram_words_pad = 0; ++ uint memblock_size = 2048; ++ uint8 *memptr; ++ int actual_fwlen; ++ struct trx_header *hdr; ++ uint32 img_offset = 0; ++ int offset = 0; ++ ++ /* For Get nvram */ ++ file_exists = ((pnv_path != NULL) && (pnv_path[0] != '\0')); ++ if (file_exists) { ++ nv_image = dhd_os_open_image(pnv_path); ++ if (nv_image == NULL) { ++ printf("%s: Open nvram file failed %s\n", __FUNCTION__, pnv_path); ++ goto err; ++ } ++ } ++ nv_memblock = MALLOC(dhd_bus->pub.osh, MAX_NVRAMBUF_SIZE); ++ if (nv_memblock == NULL) { ++ DBUSERR(("%s: Failed to allocate memory %d bytes\n", ++ __FUNCTION__, MAX_NVRAMBUF_SIZE)); ++ goto err; ++ } ++ len = dhd_os_get_image_block(nv_memblock, MAX_NVRAMBUF_SIZE, nv_image); ++ if (len > 0 && len < MAX_NVRAMBUF_SIZE) { ++ bufp = (char *)nv_memblock; ++ bufp[len] = 0; ++ dhd_bus->nvram_len = process_nvram_vars(bufp, len); ++ if (dhd_bus->nvram_len % 4) ++ nvram_words_pad = 4 - dhd_bus->nvram_len % 4; ++ } else { ++ DBUSERR(("%s: error reading nvram file: %d\n", __FUNCTION__, len)); ++ bcmerror = DBUS_ERR_NVRAM; ++ goto err; ++ } ++ if (nv_image) ++ dhd_os_close_image(nv_image); ++ ++ /* For Get first block of fw to calculate total_len */ ++ file_exists = ((pfw_path != NULL) && (pfw_path[0] != '\0')); ++ if (file_exists) { ++ fw_image = dhd_os_open_image(pfw_path); ++ if (fw_image == NULL) { ++ printf("%s: Open fw file failed %s\n", __FUNCTION__, pfw_path); ++ goto err; ++ } ++ } ++ memptr = fw_memblock = MALLOC(dhd_bus->pub.osh, memblock_size); ++ if (fw_memblock == NULL) { ++ DBUSERR(("%s: Failed to allocate memory %d bytes\n", __FUNCTION__, ++ memblock_size)); ++ goto err; ++ } ++ len = dhd_os_get_image_block((char*)memptr, memblock_size, fw_image); ++ if ((actual_fwlen = check_file(dhd_bus->pub.osh, memptr)) <= 0) { ++ DBUSERR(("%s: bad firmware format!\n", __FUNCTION__)); ++ goto err; ++ } ++ ++ total_len = actual_fwlen + dhd_bus->nvram_len + nvram_words_pad; ++ dhd_bus->image = MALLOC(dhd_bus->pub.osh, total_len); ++ dhd_bus->image_len = total_len; ++ if (dhd_bus->image == NULL) { ++ DBUSERR(("%s: malloc failed!\n", __FUNCTION__)); ++ goto err; ++ } ++ ++ /* Step1: Copy trx header + firmwre */ ++ memptr = fw_memblock; ++ do { ++ if (len < 0) { ++ DBUSERR(("%s: dhd_os_get_image_block failed (%d)\n", __FUNCTION__, len)); ++ bcmerror = BCME_ERROR; ++ goto err; ++ } ++ bcopy(memptr, dhd_bus->image+offset, len); ++ offset += len; ++ } while ((len = dhd_os_get_image_block((char*)memptr, memblock_size, fw_image))); ++ /* Step2: Copy NVRAM + pad */ ++ hdr = (struct trx_header *)dhd_bus->image; ++ img_offset = SIZEOF_TRX(hdr) + hdr->offsets[TRX_OFFSETS_DLFWLEN_IDX]; ++ bcopy(nv_memblock, (uint8 *)(dhd_bus->image + img_offset), ++ dhd_bus->nvram_len); ++ img_offset += dhd_bus->nvram_len; ++ if (nvram_words_pad) { ++ bzero(&dhd_bus->image[img_offset], nvram_words_pad); ++ img_offset += nvram_words_pad; ++ } ++#ifdef BCMTRXV2 ++ /* Step3: Copy DSG/CFG for V2 */ ++ if (ISTRX_V2(hdr) && ++ (hdr->offsets[TRX_OFFSETS_DSG_LEN_IDX] || ++ hdr->offsets[TRX_OFFSETS_CFG_LEN_IDX])) { ++ DBUSERR(("%s: fix me\n", __FUNCTION__)); ++ } ++#endif /* BCMTRXV2 */ ++ /* Step4: update TRX header for nvram size */ ++ hdr = (struct trx_header *)dhd_bus->image; ++ hdr->len = htol32(total_len); ++ /* Pass the actual fw len */ ++ hdr->offsets[TRX_OFFSETS_NVM_LEN_IDX] = ++ htol32(dhd_bus->nvram_len + nvram_words_pad); ++ /* Calculate CRC over header */ ++ hdr->crc32 = hndcrc32((uint8 *)&hdr->flag_version, ++ SIZEOF_TRX(hdr) - OFFSETOF(struct trx_header, flag_version), ++ CRC32_INIT_VALUE); ++ ++ /* Calculate CRC over data */ ++ for (i = SIZEOF_TRX(hdr); i < total_len; ++i) ++ hdr->crc32 = hndcrc32((uint8 *)&dhd_bus->image[i], 1, hdr->crc32); ++ hdr->crc32 = htol32(hdr->crc32); ++ ++ bcmerror = DBUS_OK; ++ ++err: ++ if (fw_memblock) ++ MFREE(dhd_bus->pub.osh, fw_memblock, MAX_NVRAMBUF_SIZE); ++ if (fw_image) ++ dhd_os_close_image(fw_image); ++ if (nv_memblock) ++ MFREE(dhd_bus->pub.osh, nv_memblock, MAX_NVRAMBUF_SIZE); ++ if (nv_image) ++ dhd_os_close_image(nv_image); ++ ++ return bcmerror; ++} ++ ++/** ++ * during driver initialization ('attach') or after PnP 'resume', firmware needs to be loaded into ++ * the dongle ++ */ ++static int ++dbus_do_download(dhd_bus_t *dhd_bus, char *pfw_path, char *pnv_path) ++{ ++ int err = DBUS_OK; ++ ++ err = dbus_get_fw_nvram(dhd_bus, pfw_path, pnv_path); ++ if (err) { ++ DBUSERR(("dbus_do_download: fail to get nvram %d\n", err)); ++ return err; ++ } ++ ++ if (dhd_bus->drvintf->dlstart && dhd_bus->drvintf->dlrun) { ++ err = dhd_bus->drvintf->dlstart(dhd_bus->bus_info, ++ dhd_bus->image, dhd_bus->image_len); ++ if (err == DBUS_OK) { ++ err = dhd_bus->drvintf->dlrun(dhd_bus->bus_info); ++ } ++ } else ++ err = DBUS_ERR; ++ ++ if (dhd_bus->image) { ++ MFREE(dhd_bus->pub.osh, dhd_bus->image, dhd_bus->image_len); ++ dhd_bus->image = NULL; ++ dhd_bus->image_len = 0; ++ } ++ ++ return err; ++} /* dbus_do_download */ ++#else ++ ++/** ++ * It is easy for the user to pass one jumbo nvram file to the driver than a set of smaller files. ++ * The 'jumbo nvram' file format is essentially a set of nvram files. Before commencing firmware ++ * download, the dongle needs to be probed so that the correct nvram contents within the jumbo nvram ++ * file is selected. ++ */ ++static int ++dbus_jumbo_nvram(dhd_bus_t *dhd_bus) ++{ ++ int8 *nvram = NULL; ++ int nvram_len = 0; ++ int ret = DBUS_OK; ++ uint16 boardrev = 0xFFFF; ++ uint16 boardtype = 0xFFFF; ++ ++ /* read the otp for boardrev & boardtype ++ * if boardtype/rev are present in otp ++ * select nvram data for that boardtype/rev ++ */ ++ dbus_otp(dhd_bus, &boardtype, &boardrev); ++ ++ ret = dbus_select_nvram(dhd_bus, dhd_bus->extdl.vars, dhd_bus->extdl.varslen, ++ boardtype, boardrev, &nvram, &nvram_len); ++ ++ if (ret == DBUS_JUMBO_BAD_FORMAT) ++ return DBUS_ERR_NVRAM; ++ else if (ret == DBUS_JUMBO_NOMATCH && ++ (boardtype != 0xFFFF || boardrev != 0xFFFF)) { ++ DBUSERR(("No matching NVRAM for boardtype 0x%02x boardrev 0x%02x\n", ++ boardtype, boardrev)); ++ return DBUS_ERR_NVRAM; ++ } ++ dhd_bus->nvram = nvram; ++ dhd_bus->nvram_len = nvram_len; ++ ++ return DBUS_OK; ++} ++ ++/** before commencing fw download, the correct NVRAM image to download has to be picked */ ++static int ++dbus_get_nvram(dhd_bus_t *dhd_bus) ++{ ++ int len, i; ++ struct trx_header *hdr; ++ int actual_fwlen; ++ uint32 img_offset = 0; ++ ++ dhd_bus->nvram_len = 0; ++ if (dhd_bus->extdl.varslen) { ++ if (DBUS_OK != dbus_jumbo_nvram(dhd_bus)) ++ return DBUS_ERR_NVRAM; ++ DBUSERR(("NVRAM %d bytes downloaded\n", dhd_bus->nvram_len)); ++ } ++#if defined(BCM_REQUEST_FW) ++ else if (nonfwnvram) { ++ dhd_bus->nvram = nonfwnvram; ++ dhd_bus->nvram_len = nonfwnvramlen; ++ DBUSERR(("NVRAM %d bytes downloaded\n", dhd_bus->nvram_len)); ++ } ++#endif ++ if (dhd_bus->nvram) { ++ uint8 nvram_words_pad = 0; ++ /* Validate the format/length etc of the file */ ++ if ((actual_fwlen = check_file(dhd_bus->pub.osh, dhd_bus->fw)) <= 0) { ++ DBUSERR(("%s: bad firmware format!\n", __FUNCTION__)); ++ return DBUS_ERR_NVRAM; ++ } ++ ++ if (!dhd_bus->nvram_nontxt) { ++ /* host supplied nvram could be in .txt format ++ * with all the comments etc... ++ */ ++ dhd_bus->nvram_len = process_nvram_vars(dhd_bus->nvram, ++ dhd_bus->nvram_len); ++ } ++ if (dhd_bus->nvram_len % 4) ++ nvram_words_pad = 4 - dhd_bus->nvram_len % 4; ++ ++ len = actual_fwlen + dhd_bus->nvram_len + nvram_words_pad; ++ dhd_bus->image = MALLOC(dhd_bus->pub.osh, len); ++ dhd_bus->image_len = len; ++ if (dhd_bus->image == NULL) { ++ DBUSERR(("%s: malloc failed!\n", __FUNCTION__)); ++ return DBUS_ERR_NVRAM; ++ } ++ hdr = (struct trx_header *)dhd_bus->fw; ++ /* Step1: Copy trx header + firmwre */ ++ img_offset = SIZEOF_TRX(hdr) + hdr->offsets[TRX_OFFSETS_DLFWLEN_IDX]; ++ bcopy(dhd_bus->fw, dhd_bus->image, img_offset); ++ /* Step2: Copy NVRAM + pad */ ++ bcopy(dhd_bus->nvram, (uint8 *)(dhd_bus->image + img_offset), ++ dhd_bus->nvram_len); ++ img_offset += dhd_bus->nvram_len; ++ if (nvram_words_pad) { ++ bzero(&dhd_bus->image[img_offset], ++ nvram_words_pad); ++ img_offset += nvram_words_pad; ++ } ++#ifdef BCMTRXV2 ++ /* Step3: Copy DSG/CFG for V2 */ ++ if (ISTRX_V2(hdr) && ++ (hdr->offsets[TRX_OFFSETS_DSG_LEN_IDX] || ++ hdr->offsets[TRX_OFFSETS_CFG_LEN_IDX])) { ++ ++ bcopy(dhd_bus->fw + SIZEOF_TRX(hdr) + ++ hdr->offsets[TRX_OFFSETS_DLFWLEN_IDX] + ++ hdr->offsets[TRX_OFFSETS_NVM_LEN_IDX], ++ dhd_bus->image + img_offset, ++ hdr->offsets[TRX_OFFSETS_DSG_LEN_IDX] + ++ hdr->offsets[TRX_OFFSETS_CFG_LEN_IDX]); ++ ++ img_offset += hdr->offsets[TRX_OFFSETS_DSG_LEN_IDX] + ++ hdr->offsets[TRX_OFFSETS_CFG_LEN_IDX]; ++ } ++#endif /* BCMTRXV2 */ ++ /* Step4: update TRX header for nvram size */ ++ hdr = (struct trx_header *)dhd_bus->image; ++ hdr->len = htol32(len); ++ /* Pass the actual fw len */ ++ hdr->offsets[TRX_OFFSETS_NVM_LEN_IDX] = ++ htol32(dhd_bus->nvram_len + nvram_words_pad); ++ /* Calculate CRC over header */ ++ hdr->crc32 = hndcrc32((uint8 *)&hdr->flag_version, ++ SIZEOF_TRX(hdr) - OFFSETOF(struct trx_header, flag_version), ++ CRC32_INIT_VALUE); ++ ++ /* Calculate CRC over data */ ++ for (i = SIZEOF_TRX(hdr); i < len; ++i) ++ hdr->crc32 = hndcrc32((uint8 *)&dhd_bus->image[i], 1, hdr->crc32); ++ hdr->crc32 = htol32(hdr->crc32); ++ } else { ++ dhd_bus->image = dhd_bus->fw; ++ dhd_bus->image_len = (uint32)dhd_bus->fwlen; ++ } ++ ++ return DBUS_OK; ++} /* dbus_get_nvram */ ++ ++/** ++ * during driver initialization ('attach') or after PnP 'resume', firmware needs to be loaded into ++ * the dongle ++ */ ++static int ++dbus_do_download(dhd_bus_t *dhd_bus) ++{ ++ int err = DBUS_OK; ++#ifndef BCM_REQUEST_FW ++ int decomp_override = 0; ++#endif ++#ifdef BCM_REQUEST_FW ++ uint16 boardrev = 0xFFFF, boardtype = 0xFFFF; ++ int8 *temp_nvram; ++ int temp_len; ++#endif ++ ++#if defined(BCM_REQUEST_FW) ++ dhd_bus->firmware = dbus_get_fw_nvfile(dhd_bus->pub.attrib.devid, ++ dhd_bus->pub.attrib.chiprev, &dhd_bus->fw, &dhd_bus->fwlen, ++ DBUS_FIRMWARE, 0, 0); ++ if (!dhd_bus->firmware) ++ return DBUS_ERR; ++#endif ++ ++ dhd_bus->image = dhd_bus->fw; ++ dhd_bus->image_len = (uint32)dhd_bus->fwlen; ++ ++#ifndef BCM_REQUEST_FW ++ if (UNZIP_ENAB(dhd_bus) && !decomp_override) { ++ err = dbus_zlib_decomp(dhd_bus); ++ if (err) { ++ DBUSERR(("dbus_attach: fw decompress fail %d\n", err)); ++ return err; ++ } ++ } ++#endif ++ ++#if defined(BCM_REQUEST_FW) ++ /* check if firmware is appended with nvram file */ ++ err = dbus_otp(dhd_bus, &boardtype, &boardrev); ++ /* check if nvram is provided as separte file */ ++ nonfwnvram = NULL; ++ nonfwnvramlen = 0; ++ dhd_bus->nvfile = dbus_get_fw_nvfile(dhd_bus->pub.attrib.devid, ++ dhd_bus->pub.attrib.chiprev, (void *)&temp_nvram, &temp_len, ++ DBUS_NVFILE, boardtype, boardrev); ++ if (dhd_bus->nvfile) { ++ int8 *tmp = MALLOC(dhd_bus->pub.osh, temp_len); ++ if (tmp) { ++ bcopy(temp_nvram, tmp, temp_len); ++ nonfwnvram = tmp; ++ nonfwnvramlen = temp_len; ++ } else { ++ err = DBUS_ERR; ++ goto fail; ++ } ++ } ++#endif /* defined(BCM_REQUEST_FW) */ ++ ++ err = dbus_get_nvram(dhd_bus); ++ if (err) { ++ DBUSERR(("dbus_do_download: fail to get nvram %d\n", err)); ++ return err; ++ } ++ ++ ++ if (dhd_bus->drvintf->dlstart && dhd_bus->drvintf->dlrun) { ++ err = dhd_bus->drvintf->dlstart(dhd_bus->bus_info, ++ dhd_bus->image, dhd_bus->image_len); ++ ++ if (err == DBUS_OK) ++ err = dhd_bus->drvintf->dlrun(dhd_bus->bus_info); ++ } else ++ err = DBUS_ERR; ++ ++ if (dhd_bus->nvram) { ++ MFREE(dhd_bus->pub.osh, dhd_bus->image, dhd_bus->image_len); ++ dhd_bus->image = dhd_bus->fw; ++ dhd_bus->image_len = (uint32)dhd_bus->fwlen; ++ } ++ ++#ifndef BCM_REQUEST_FW ++ if (UNZIP_ENAB(dhd_bus) && (!decomp_override) && dhd_bus->orig_fw) { ++ MFREE(dhd_bus->pub.osh, dhd_bus->fw, dhd_bus->decomp_memsize); ++ dhd_bus->image = dhd_bus->fw = dhd_bus->orig_fw; ++ dhd_bus->image_len = dhd_bus->fwlen = dhd_bus->origfw_len; ++ } ++#endif ++ ++#if defined(BCM_REQUEST_FW) ++fail: ++ if (dhd_bus->firmware) { ++ dbus_release_fw_nvfile(dhd_bus->firmware); ++ dhd_bus->firmware = NULL; ++ } ++ if (dhd_bus->nvfile) { ++ dbus_release_fw_nvfile(dhd_bus->nvfile); ++ dhd_bus->nvfile = NULL; ++ } ++ if (nonfwnvram) { ++ MFREE(dhd_bus->pub.osh, nonfwnvram, nonfwnvramlen); ++ nonfwnvram = NULL; ++ nonfwnvramlen = 0; ++ } ++#endif ++ return err; ++} /* dbus_do_download */ ++#endif /* EXTERNAL_FW_PATH */ ++#endif ++ ++/** required for DBUS deregistration */ ++static void ++dbus_disconnect(void *handle) ++{ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (disconnect_cb) ++ disconnect_cb(disc_arg); ++} ++ ++/** ++ * This function is called when the sent irb times out without a tx response status. ++ * DBUS adds reliability by resending timed out IRBs DBUS_TX_RETRY_LIMIT times. ++ */ ++static void ++dbus_if_send_irb_timeout(void *handle, dbus_irb_tx_t *txirb) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ ++ if ((dhd_bus == NULL) || (dhd_bus->drvintf == NULL) || (txirb == NULL)) { ++ return; ++ } ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ return; ++ ++} /* dbus_if_send_irb_timeout */ ++ ++/** ++ * When lower DBUS level signals that a send IRB completed, either successful or not, the higher ++ * level (e.g. dhd_linux.c) has to be notified, and transmit flow control has to be evaluated. ++ */ ++static void BCMFASTPATH ++dbus_if_send_irb_complete(void *handle, dbus_irb_tx_t *txirb, int status) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ int txirb_pending; ++ struct exec_parms args; ++ void *pktinfo; ++ ++ if ((dhd_bus == NULL) || (txirb == NULL)) { ++ return; ++ } ++ ++ DBUSTRACE(("%s: status = %d\n", __FUNCTION__, status)); ++ ++ dbus_tx_timer_stop(dhd_bus); ++ ++ /* re-queue BEFORE calling send_complete which will assume that this irb ++ is now available. ++ */ ++ pktinfo = txirb->info; ++ bzero(txirb, sizeof(dbus_irb_tx_t)); ++ args.qenq.q = dhd_bus->tx_q; ++ args.qenq.b = (dbus_irb_t *) txirb; ++ EXEC_TXLOCK(dhd_bus, q_enq_exec, &args); ++ ++ if (dhd_bus->pub.busstate != DBUS_STATE_DOWN) { ++ if ((status == DBUS_OK) || (status == DBUS_ERR_NODEVICE)) { ++ if (dhd_bus->cbs && dhd_bus->cbs->send_complete) ++ dhd_bus->cbs->send_complete(dhd_bus->cbarg, pktinfo, ++ status); ++ ++ if (status == DBUS_OK) { ++ txirb_pending = dhd_bus->pub.ntxq - dhd_bus->tx_q->cnt; ++ if (txirb_pending) ++ dbus_tx_timer_start(dhd_bus, DBUS_TX_TIMEOUT_INTERVAL); ++ if ((txirb_pending < dhd_bus->tx_low_watermark) && ++ dhd_bus->txoff && !dhd_bus->txoverride) { ++ dbus_flowctrl_tx(dhd_bus, OFF); ++ } ++ } ++ } else { ++ DBUSERR(("%s: %d WARNING freeing orphan pkt %p\n", __FUNCTION__, __LINE__, ++ pktinfo)); ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_TXNOCOPY) || defined(BCM_RPC_TOC) ++ if (pktinfo) ++ if (dhd_bus->cbs && dhd_bus->cbs->send_complete) ++ dhd_bus->cbs->send_complete(dhd_bus->cbarg, pktinfo, ++ status); ++#else ++ dbus_if_pktfree(dhd_bus, (void*)pktinfo, TRUE); ++#endif /* defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_TXNOCOPY) || defined(BCM_RPC_TOC) */ ++ } ++ } else { ++ DBUSERR(("%s: %d WARNING freeing orphan pkt %p\n", __FUNCTION__, __LINE__, ++ pktinfo)); ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_TXNOCOPY) || defined(BCM_RPC_TOC) ++ if (pktinfo) ++ if (dhd_bus->cbs && dhd_bus->cbs->send_complete) ++ dhd_bus->cbs->send_complete(dhd_bus->cbarg, pktinfo, ++ status); ++#else ++ dbus_if_pktfree(dhd_bus, (void*)pktinfo, TRUE); ++#endif /* defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_TXNOCOPY) defined(BCM_RPC_TOC) */ ++ } ++} /* dbus_if_send_irb_complete */ ++ ++/** ++ * When lower DBUS level signals that a receive IRB completed, either successful or not, the higher ++ * level (e.g. dhd_linux.c) has to be notified, and fresh free receive IRBs may have to be given ++ * to lower levels. ++ */ ++static void BCMFASTPATH ++dbus_if_recv_irb_complete(void *handle, dbus_irb_rx_t *rxirb, int status) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ int rxirb_pending; ++ struct exec_parms args; ++ ++ if ((dhd_bus == NULL) || (rxirb == NULL)) { ++ return; ++ } ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ if (dhd_bus->pub.busstate != DBUS_STATE_DOWN && ++ dhd_bus->pub.busstate != DBUS_STATE_SLEEP) { ++ if (status == DBUS_OK) { ++ if ((rxirb->buf != NULL) && (rxirb->actual_len > 0)) { ++#ifdef DBUS_USB_LOOPBACK ++ if (is_loopback_pkt(rxirb->buf)) { ++ matches_loopback_pkt(rxirb->buf); ++ } else ++#endif ++ if (dhd_bus->cbs && dhd_bus->cbs->recv_buf) { ++ dhd_bus->cbs->recv_buf(dhd_bus->cbarg, rxirb->buf, ++ rxirb->actual_len); ++ } ++ } else if (rxirb->pkt != NULL) { ++ if (dhd_bus->cbs && dhd_bus->cbs->recv_pkt) ++ dhd_bus->cbs->recv_pkt(dhd_bus->cbarg, rxirb->pkt); ++ } else { ++ ASSERT(0); /* Should not happen */ ++ } ++ ++ rxirb_pending = dhd_bus->pub.nrxq - dhd_bus->rx_q->cnt - 1; ++ if ((rxirb_pending <= dhd_bus->rx_low_watermark) && ++ !dhd_bus->rxoff) { ++ DBUSTRACE(("Low watermark so submit more %d <= %d \n", ++ dhd_bus->rx_low_watermark, rxirb_pending)); ++ dbus_rxirbs_fill(dhd_bus); ++ } else if (dhd_bus->rxoff) ++ DBUSTRACE(("rx flow controlled. not filling more. cut_rxq=%d\n", ++ dhd_bus->rx_q->cnt)); ++ } else if (status == DBUS_ERR_NODEVICE) { ++ DBUSERR(("%s: %d status = %d, buf %p\n", __FUNCTION__, __LINE__, status, ++ rxirb->buf)); ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ if (rxirb->buf) { ++ PKTFRMNATIVE(dhd_bus->pub.osh, rxirb->buf); ++ PKTFREE(dhd_bus->pub.osh, rxirb->buf, FALSE); ++ } ++#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY || BCM_RPC_TOC */ ++ } else { ++ if (status != DBUS_ERR_RXZLP) ++ DBUSERR(("%s: %d status = %d, buf %p\n", __FUNCTION__, __LINE__, ++ status, rxirb->buf)); ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ if (rxirb->buf) { ++ PKTFRMNATIVE(dhd_bus->pub.osh, rxirb->buf); ++ PKTFREE(dhd_bus->pub.osh, rxirb->buf, FALSE); ++ } ++#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY || BCM_RPC_TOC */ ++ } ++ } else { ++ DBUSTRACE(("%s: DBUS down, ignoring recv callback. buf %p\n", __FUNCTION__, ++ rxirb->buf)); ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ if (rxirb->buf) { ++ PKTFRMNATIVE(dhd_bus->pub.osh, rxirb->buf); ++ PKTFREE(dhd_bus->pub.osh, rxirb->buf, FALSE); ++ } ++#endif /* BCM_RPC_NOCOPY || BCM_RPC_TXNOCOPY || BCM_RPC_TOC */ ++ } ++ if (dhd_bus->rx_q != NULL) { ++ bzero(rxirb, sizeof(dbus_irb_rx_t)); ++ args.qenq.q = dhd_bus->rx_q; ++ args.qenq.b = (dbus_irb_t *) rxirb; ++ EXEC_RXLOCK(dhd_bus, q_enq_exec, &args); ++ } else ++ MFREE(dhd_bus->pub.osh, rxirb, sizeof(dbus_irb_tx_t)); ++} /* dbus_if_recv_irb_complete */ ++ ++/** ++ * Accumulate errors signaled by lower DBUS levels and signal them to higher (e.g. dhd_linux.c) ++ * level. ++ */ ++static void ++dbus_if_errhandler(void *handle, int err) ++{ ++ dhd_bus_t *dhd_bus = handle; ++ uint32 mask = 0; ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ switch (err) { ++ case DBUS_ERR_TXFAIL: ++ dhd_bus->pub.stats.tx_errors++; ++ mask |= ERR_CBMASK_TXFAIL; ++ break; ++ case DBUS_ERR_TXDROP: ++ dhd_bus->pub.stats.tx_dropped++; ++ mask |= ERR_CBMASK_TXFAIL; ++ break; ++ case DBUS_ERR_RXFAIL: ++ dhd_bus->pub.stats.rx_errors++; ++ mask |= ERR_CBMASK_RXFAIL; ++ break; ++ case DBUS_ERR_RXDROP: ++ dhd_bus->pub.stats.rx_dropped++; ++ mask |= ERR_CBMASK_RXFAIL; ++ break; ++ default: ++ break; ++ } ++ ++ if (dhd_bus->cbs && dhd_bus->cbs->errhandler && (dhd_bus->errmask & mask)) ++ dhd_bus->cbs->errhandler(dhd_bus->cbarg, err); ++} ++ ++/** ++ * When lower DBUS level signals control IRB completed, higher level (e.g. dhd_linux.c) has to be ++ * notified. ++ */ ++static void ++dbus_if_ctl_complete(void *handle, int type, int status) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) { ++ DBUSERR(("%s: dhd_bus is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ if (dhd_bus->pub.busstate != DBUS_STATE_DOWN) { ++ if (dhd_bus->cbs && dhd_bus->cbs->ctl_complete) ++ dhd_bus->cbs->ctl_complete(dhd_bus->cbarg, type, status); ++ } ++} ++ ++/** ++ * Rx related functionality (flow control, posting of free IRBs to rx queue) is dependent upon the ++ * bus state. When lower DBUS level signals a change in the interface state, take appropriate action ++ * and forward the signaling to the higher (e.g. dhd_linux.c) level. ++ */ ++static void ++dbus_if_state_change(void *handle, int state) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ int old_state; ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ if (dhd_bus->pub.busstate == state) ++ return; ++ old_state = dhd_bus->pub.busstate; ++ if (state == DBUS_STATE_DISCONNECT) { ++ DBUSERR(("DBUS disconnected\n")); ++ } ++ ++ /* Ignore USB SUSPEND while not up yet */ ++ if (state == DBUS_STATE_SLEEP && old_state != DBUS_STATE_UP) ++ return; ++ ++ DBUSTRACE(("dbus state change from %d to to %d\n", old_state, state)); ++ ++ /* Don't update state if it's PnP firmware re-download */ ++ if (state != DBUS_STATE_PNP_FWDL) ++ dhd_bus->pub.busstate = state; ++ else ++ dbus_flowctrl_rx(handle, FALSE); ++ if (state == DBUS_STATE_SLEEP) ++ dbus_flowctrl_rx(handle, TRUE); ++ if (state == DBUS_STATE_UP) { ++ dbus_rxirbs_fill(dhd_bus); ++ dbus_flowctrl_rx(handle, FALSE); ++ } ++ ++ if (dhd_bus->cbs && dhd_bus->cbs->state_change) ++ dhd_bus->cbs->state_change(dhd_bus->cbarg, state); ++} ++ ++/** Forward request for packet from lower DBUS layer to higher layer (e.g. dhd_linux.c) */ ++static void * ++dbus_if_pktget(void *handle, uint len, bool send) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ void *p = NULL; ++ ++ if (dhd_bus == NULL) ++ return NULL; ++ ++ if (dhd_bus->cbs && dhd_bus->cbs->pktget) ++ p = dhd_bus->cbs->pktget(dhd_bus->cbarg, len, send); ++ else ++ ASSERT(0); ++ ++ return p; ++} ++ ++/** Forward request to free packet from lower DBUS layer to higher layer (e.g. dhd_linux.c) */ ++static void ++dbus_if_pktfree(void *handle, void *p, bool send) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) handle; ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ if (dhd_bus->cbs && dhd_bus->cbs->pktfree) ++ dhd_bus->cbs->pktfree(dhd_bus->cbarg, p, send); ++ else ++ ASSERT(0); ++} ++ ++/** Lower DBUS level requests either a send or receive IRB */ ++static struct dbus_irb* ++dbus_if_getirb(void *cbarg, bool send) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) cbarg; ++ struct exec_parms args; ++ struct dbus_irb *irb; ++ ++ if ((dhd_bus == NULL) || (dhd_bus->pub.busstate != DBUS_STATE_UP)) ++ return NULL; ++ ++ if (send == TRUE) { ++ args.qdeq.q = dhd_bus->tx_q; ++ irb = EXEC_TXLOCK(dhd_bus, q_deq_exec, &args); ++ } else { ++ args.qdeq.q = dhd_bus->rx_q; ++ irb = EXEC_RXLOCK(dhd_bus, q_deq_exec, &args); ++ } ++ ++ return irb; ++} ++ ++/** ++ * Called as part of DBUS bus registration. Calls back into higher level (e.g. dhd_linux.c) probe ++ * function. ++ */ ++static void * ++dbus_probe(void *arg, const char *desc, uint32 bustype, uint16 bus_no, ++ uint16 slot, uint32 hdrlen) ++{ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ if (probe_cb) { ++ disc_arg = probe_cb(probe_arg, desc, bustype, bus_no, slot, hdrlen); ++ return disc_arg; ++ } ++ ++ return (void *)DBUS_ERR; ++} ++ ++/** ++ * As part of initialization, higher level (e.g. dhd_linux.c) requests DBUS to prepare for ++ * action. ++ */ ++int ++dhd_bus_register(void) ++{ ++ int err; ++ ++ DBUSTRACE(("%s: Enter\n", __FUNCTION__)); ++ ++ probe_cb = dhd_dbus_probe_cb; ++ disconnect_cb = dhd_dbus_disconnect_cb; ++ probe_arg = NULL; ++ ++ err = dbus_bus_register(0xa5c, 0x48f, dbus_probe, /* call lower DBUS level register function */ ++ dbus_disconnect, NULL, &g_busintf, NULL, NULL); ++ ++ /* Device not detected */ ++ if (err == DBUS_ERR_NODEVICE) ++ err = DBUS_OK; ++ ++ return err; ++} ++ ++dhd_pub_t *g_pub = NULL; ++void ++dhd_bus_unregister(void) ++{ ++ int ret; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ DHD_MUTEX_LOCK(); ++ if (g_pub) { ++ g_pub->dhd_remove = TRUE; ++ if (!g_pub->bus) { ++ dhd_dbus_disconnect_cb(g_pub->bus); ++ } ++ } ++ probe_cb = NULL; ++ DHD_MUTEX_UNLOCK(); ++ ret = dbus_bus_deregister(); ++ disconnect_cb = NULL; ++ probe_arg = NULL; ++} ++ ++/** As part of initialization, data structures have to be allocated and initialized */ ++dhd_bus_t * ++dbus_attach(osl_t *osh, int rxsize, int nrxq, int ntxq, dhd_pub_t *pub, ++ dbus_callbacks_t *cbs, dbus_extdl_t *extdl, struct shared_info *sh) ++{ ++ dhd_bus_t *dhd_bus; ++ int err; ++ ++ if ((g_busintf == NULL) || (g_busintf->attach == NULL) || (cbs == NULL)) ++ return NULL; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if ((nrxq <= 0) || (ntxq <= 0)) ++ return NULL; ++ ++ dhd_bus = MALLOC(osh, sizeof(dhd_bus_t)); ++ if (dhd_bus == NULL) { ++ DBUSERR(("%s: malloc failed %d\n", __FUNCTION__, sizeof(dhd_bus_t))); ++ return NULL; ++ } ++ ++ bzero(dhd_bus, sizeof(dhd_bus_t)); ++ ++ /* BUS-specific driver interface (at a lower DBUS level) */ ++ dhd_bus->drvintf = g_busintf; ++ dhd_bus->cbarg = pub; ++ dhd_bus->cbs = cbs; ++ ++ dhd_bus->pub.sh = sh; ++ dhd_bus->pub.osh = osh; ++ dhd_bus->pub.rxsize = rxsize; ++ ++ dhd_bus->pub.nrxq = nrxq; ++ dhd_bus->rx_low_watermark = nrxq / 2; /* keep enough posted rx urbs */ ++ dhd_bus->pub.ntxq = ntxq; ++ dhd_bus->tx_low_watermark = ntxq / 4; /* flow control when too many tx urbs posted */ ++ ++ dhd_bus->tx_q = MALLOC(osh, sizeof(dbus_irbq_t)); ++ if (dhd_bus->tx_q == NULL) ++ goto error; ++ else { ++ bzero(dhd_bus->tx_q, sizeof(dbus_irbq_t)); ++ err = dbus_irbq_init(dhd_bus, dhd_bus->tx_q, ntxq, sizeof(dbus_irb_tx_t)); ++ if (err != DBUS_OK) ++ goto error; ++ } ++ ++ dhd_bus->rx_q = MALLOC(osh, sizeof(dbus_irbq_t)); ++ if (dhd_bus->rx_q == NULL) ++ goto error; ++ else { ++ bzero(dhd_bus->rx_q, sizeof(dbus_irbq_t)); ++ err = dbus_irbq_init(dhd_bus, dhd_bus->rx_q, nrxq, sizeof(dbus_irb_rx_t)); ++ if (err != DBUS_OK) ++ goto error; ++ } ++ ++ ++ dhd_bus->bus_info = (void *)g_busintf->attach(&dhd_bus->pub, ++ dhd_bus, &dbus_intf_cbs); ++ if (dhd_bus->bus_info == NULL) ++ goto error; ++ ++ dbus_tx_timer_init(dhd_bus); ++ ++#if defined(BCM_REQUEST_FW) ++ /* Need to copy external image for re-download */ ++ if (extdl && extdl->fw && (extdl->fwlen > 0)) { ++ dhd_bus->extdl.fw = MALLOC(osh, extdl->fwlen); ++ if (dhd_bus->extdl.fw) { ++ bcopy(extdl->fw, dhd_bus->extdl.fw, extdl->fwlen); ++ dhd_bus->extdl.fwlen = extdl->fwlen; ++ } ++ } ++ ++ if (extdl && extdl->vars && (extdl->varslen > 0)) { ++ dhd_bus->extdl.vars = MALLOC(osh, extdl->varslen); ++ if (dhd_bus->extdl.vars) { ++ bcopy(extdl->vars, dhd_bus->extdl.vars, extdl->varslen); ++ dhd_bus->extdl.varslen = extdl->varslen; ++ } ++ } ++#endif ++ ++ return (dhd_bus_t *)dhd_bus; ++ ++error: ++ DBUSERR(("%s: Failed\n", __FUNCTION__)); ++ dbus_detach(dhd_bus); ++ return NULL; ++} /* dbus_attach */ ++ ++void ++dbus_detach(dhd_bus_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ osl_t *osh; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return; ++ ++ dbus_tx_timer_stop(dhd_bus); ++ ++ osh = pub->pub.osh; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->detach) ++ dhd_bus->drvintf->detach((dbus_pub_t *)dhd_bus, dhd_bus->bus_info); ++ ++ if (dhd_bus->tx_q) { ++ dbus_irbq_deinit(dhd_bus, dhd_bus->tx_q, sizeof(dbus_irb_tx_t)); ++ MFREE(osh, dhd_bus->tx_q, sizeof(dbus_irbq_t)); ++ dhd_bus->tx_q = NULL; ++ } ++ ++ if (dhd_bus->rx_q) { ++ dbus_irbq_deinit(dhd_bus, dhd_bus->rx_q, sizeof(dbus_irb_rx_t)); ++ MFREE(osh, dhd_bus->rx_q, sizeof(dbus_irbq_t)); ++ dhd_bus->rx_q = NULL; ++ } ++ ++ ++ if (dhd_bus->extdl.fw && (dhd_bus->extdl.fwlen > 0)) { ++ MFREE(osh, dhd_bus->extdl.fw, dhd_bus->extdl.fwlen); ++ dhd_bus->extdl.fw = NULL; ++ dhd_bus->extdl.fwlen = 0; ++ } ++ ++ if (dhd_bus->extdl.vars && (dhd_bus->extdl.varslen > 0)) { ++ MFREE(osh, dhd_bus->extdl.vars, dhd_bus->extdl.varslen); ++ dhd_bus->extdl.vars = NULL; ++ dhd_bus->extdl.varslen = 0; ++ } ++ ++ MFREE(osh, dhd_bus, sizeof(dhd_bus_t)); ++} /* dbus_detach */ ++ ++int dbus_dlneeded(dhd_bus_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int dlneeded = DBUS_ERR; ++ ++ if (!dhd_bus) { ++ DBUSERR(("%s: dhd_bus is NULL\n", __FUNCTION__)); ++ return DBUS_ERR; ++ } ++ ++ DBUSTRACE(("%s: state %d\n", __FUNCTION__, dhd_bus->pub.busstate)); ++ ++ if (dhd_bus->drvintf->dlneeded) { ++ dlneeded = dhd_bus->drvintf->dlneeded(dhd_bus->bus_info); ++ } ++ printf("%s: dlneeded=%d\n", __FUNCTION__, dlneeded); ++ ++ /* dlneeded > 0: need to download ++ * dlneeded = 0: downloaded ++ * dlneeded < 0: bus error*/ ++ return dlneeded; ++} ++ ++#if defined(BCM_REQUEST_FW) ++int dbus_download_firmware(dhd_bus_t *pub, char *pfw_path, char *pnv_path) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_OK; ++ ++ if (!dhd_bus) { ++ DBUSERR(("%s: dhd_bus is NULL\n", __FUNCTION__)); ++ return DBUS_ERR; ++ } ++ ++ DBUSTRACE(("%s: state %d\n", __FUNCTION__, dhd_bus->pub.busstate)); ++ ++ dhd_bus->pub.busstate = DBUS_STATE_DL_PENDING; ++#ifdef EXTERNAL_FW_PATH ++ err = dbus_do_download(dhd_bus, pfw_path, pnv_path); ++#else ++ err = dbus_do_download(dhd_bus); ++#endif /* EXTERNAL_FW_PATH */ ++ if (err == DBUS_OK) { ++ dhd_bus->pub.busstate = DBUS_STATE_DL_DONE; ++ } else { ++ DBUSERR(("%s: download failed (%d)\n", __FUNCTION__, err)); ++ } ++ ++ return err; ++} ++#endif ++ ++/** ++ * higher layer requests us to 'up' the interface to the dongle. Prerequisite is that firmware (not ++ * bootloader) must be active in the dongle. ++ */ ++int ++dbus_up(struct dhd_bus *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_OK; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) { ++ DBUSERR(("%s: dhd_bus is NULL\n", __FUNCTION__)); ++ return DBUS_ERR; ++ } ++ ++ if ((dhd_bus->pub.busstate == DBUS_STATE_DL_DONE) || ++ (dhd_bus->pub.busstate == DBUS_STATE_DOWN) || ++ (dhd_bus->pub.busstate == DBUS_STATE_SLEEP)) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->up) { ++ err = dhd_bus->drvintf->up(dhd_bus->bus_info); ++ ++ if (err == DBUS_OK) { ++ dbus_rxirbs_fill(dhd_bus); ++ } ++ } ++ } else ++ err = DBUS_ERR; ++ ++ return err; ++} ++ ++/** higher layer requests us to 'down' the interface to the dongle. */ ++int ++dbus_down(dbus_pub_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ dbus_tx_timer_stop(dhd_bus); ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP || ++ dhd_bus->pub.busstate == DBUS_STATE_SLEEP) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->down) ++ return dhd_bus->drvintf->down(dhd_bus->bus_info); ++ } ++ ++ return DBUS_ERR; ++} ++ ++int ++dbus_shutdown(dbus_pub_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->shutdown) ++ return dhd_bus->drvintf->shutdown(dhd_bus->bus_info); ++ ++ return DBUS_OK; ++} ++ ++int ++dbus_stop(struct dhd_bus *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP || ++ dhd_bus->pub.busstate == DBUS_STATE_SLEEP) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->stop) ++ return dhd_bus->drvintf->stop(dhd_bus->bus_info); ++ } ++ ++ return DBUS_ERR; ++} ++ ++int dbus_send_txdata(dbus_pub_t *dbus, void *pktbuf) ++{ ++ return dbus_send_pkt(dbus, pktbuf, pktbuf /* pktinfo */); ++} ++ ++int ++dbus_send_buf(dbus_pub_t *pub, uint8 *buf, int len, void *info) ++{ ++ return dbus_send_irb(pub, buf, len, NULL, info); ++} ++ ++int ++dbus_send_pkt(dbus_pub_t *pub, void *pkt, void *info) ++{ ++ return dbus_send_irb(pub, NULL, 0, pkt, info); ++} ++ ++int ++dbus_send_ctl(struct dhd_bus *pub, uint8 *buf, int len) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if (dhd_bus == NULL) { ++ DBUSERR(("%s: dhd_bus is NULL\n", __FUNCTION__)); ++ return DBUS_ERR; ++ } ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP || ++ dhd_bus->pub.busstate == DBUS_STATE_SLEEP) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->send_ctl) ++ return dhd_bus->drvintf->send_ctl(dhd_bus->bus_info, buf, len); ++ } else { ++ DBUSERR(("%s: bustate=%d\n", __FUNCTION__, dhd_bus->pub.busstate)); ++ } ++ ++ return DBUS_ERR; ++} ++ ++int ++dbus_recv_ctl(struct dhd_bus *pub, uint8 *buf, int len) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if ((dhd_bus == NULL) || (buf == NULL)) ++ return DBUS_ERR; ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP || ++ dhd_bus->pub.busstate == DBUS_STATE_SLEEP) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->recv_ctl) ++ return dhd_bus->drvintf->recv_ctl(dhd_bus->bus_info, buf, len); ++ } ++ ++ return DBUS_ERR; ++} ++ ++/** Only called via RPC (Dec 2012) */ ++int ++dbus_recv_bulk(dbus_pub_t *pub, uint32 ep_idx) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ dbus_irb_rx_t *rxirb; ++ struct exec_parms args; ++ int status; ++ ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ args.qdeq.q = dhd_bus->rx_q; ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->recv_irb_from_ep) { ++ if ((rxirb = (EXEC_RXLOCK(dhd_bus, q_deq_exec, &args))) != NULL) { ++ status = dhd_bus->drvintf->recv_irb_from_ep(dhd_bus->bus_info, ++ rxirb, ep_idx); ++ if (status == DBUS_ERR_RXDROP) { ++ bzero(rxirb, sizeof(dbus_irb_rx_t)); ++ args.qenq.q = dhd_bus->rx_q; ++ args.qenq.b = (dbus_irb_t *) rxirb; ++ EXEC_RXLOCK(dhd_bus, q_enq_exec, &args); ++ } ++ } ++ } ++ } ++ ++ return DBUS_ERR; ++} ++ ++/** only called by dhd_cdc.c (Dec 2012) */ ++int ++dbus_poll_intr(dbus_pub_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ int status = DBUS_ERR; ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP) { ++ if (dhd_bus->drvintf && dhd_bus->drvintf->recv_irb_from_ep) { ++ status = dhd_bus->drvintf->recv_irb_from_ep(dhd_bus->bus_info, ++ NULL, 0xff); ++ } ++ } ++ return status; ++} ++ ++/** called by nobody (Dec 2012) */ ++void * ++dbus_pktget(dbus_pub_t *pub, int len) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if ((dhd_bus == NULL) || (len < 0)) ++ return NULL; ++ ++ return PKTGET(dhd_bus->pub.osh, len, TRUE); ++} ++ ++/** called by nobody (Dec 2012) */ ++void ++dbus_pktfree(dbus_pub_t *pub, void* pkt) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if ((dhd_bus == NULL) || (pkt == NULL)) ++ return; ++ ++ PKTFREE(dhd_bus->pub.osh, pkt, TRUE); ++} ++ ++/** called by nobody (Dec 2012) */ ++int ++dbus_get_stats(dbus_pub_t *pub, dbus_stats_t *stats) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if ((dhd_bus == NULL) || (stats == NULL)) ++ return DBUS_ERR; ++ ++ bcopy(&dhd_bus->pub.stats, stats, sizeof(dbus_stats_t)); ++ ++ return DBUS_OK; ++} ++ ++int ++dbus_get_attrib(dhd_bus_t *pub, dbus_attrib_t *attrib) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_ERR; ++ ++ if ((dhd_bus == NULL) || (attrib == NULL)) ++ return DBUS_ERR; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->get_attrib) { ++ err = dhd_bus->drvintf->get_attrib(dhd_bus->bus_info, ++ &dhd_bus->pub.attrib); ++ } ++ ++ bcopy(&dhd_bus->pub.attrib, attrib, sizeof(dbus_attrib_t)); ++ return err; ++} ++ ++int ++dbus_get_device_speed(dbus_pub_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ ++ if (dhd_bus == NULL) ++ return INVALID_SPEED; ++ ++ return (dhd_bus->pub.device_speed); ++} ++ ++int ++dbus_set_config(dbus_pub_t *pub, dbus_config_t *config) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_ERR; ++ ++ if ((dhd_bus == NULL) || (config == NULL)) ++ return DBUS_ERR; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->set_config) { ++ err = dhd_bus->drvintf->set_config(dhd_bus->bus_info, ++ config); ++ ++ if ((config->config_id == DBUS_CONFIG_ID_AGGR_LIMIT) && ++ (!err) && ++ (dhd_bus->pub.busstate == DBUS_STATE_UP)) { ++ dbus_rxirbs_fill(dhd_bus); ++ } ++ } ++ ++ return err; ++} ++ ++int ++dbus_get_config(dbus_pub_t *pub, dbus_config_t *config) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_ERR; ++ ++ if ((dhd_bus == NULL) || (config == NULL)) ++ return DBUS_ERR; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->get_config) { ++ err = dhd_bus->drvintf->get_config(dhd_bus->bus_info, ++ config); ++ } ++ ++ return err; ++} ++ ++int ++dbus_set_errmask(dbus_pub_t *pub, uint32 mask) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_OK; ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ dhd_bus->errmask = mask; ++ return err; ++} ++ ++int ++dbus_pnp_resume(dbus_pub_t *pub, int *fw_reload) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_ERR; ++ bool fwdl = FALSE; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (dhd_bus->pub.busstate == DBUS_STATE_UP) { ++ return DBUS_OK; ++ } ++ ++ ++ ++ if (dhd_bus->drvintf->pnp) { ++ err = dhd_bus->drvintf->pnp(dhd_bus->bus_info, ++ DBUS_PNP_RESUME); ++ } ++ ++ if (dhd_bus->drvintf->recv_needed) { ++ if (dhd_bus->drvintf->recv_needed(dhd_bus->bus_info)) { ++ /* Refill after sleep/hibernate */ ++ dbus_rxirbs_fill(dhd_bus); ++ } ++ } ++ ++ ++ if (fw_reload) ++ *fw_reload = fwdl; ++ ++ return err; ++} /* dbus_pnp_resume */ ++ ++int ++dbus_pnp_sleep(dbus_pub_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_ERR; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ dbus_tx_timer_stop(dhd_bus); ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->pnp) { ++ err = dhd_bus->drvintf->pnp(dhd_bus->bus_info, ++ DBUS_PNP_SLEEP); ++ } ++ ++ return err; ++} ++ ++int ++dbus_pnp_disconnect(dbus_pub_t *pub) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) pub; ++ int err = DBUS_ERR; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ dbus_tx_timer_stop(dhd_bus); ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->pnp) { ++ err = dhd_bus->drvintf->pnp(dhd_bus->bus_info, ++ DBUS_PNP_DISCONNECT); ++ } ++ ++ return err; ++} ++ ++int ++dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, ++ void *params, int plen, void *arg, int len, bool set) ++{ ++ dhd_bus_t *dhd_bus = (dhd_bus_t *) dhdp->bus; ++ int err = DBUS_ERR; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (dhd_bus == NULL) ++ return DBUS_ERR; ++ ++ if (dhd_bus->drvintf && dhd_bus->drvintf->iovar_op) { ++ err = dhd_bus->drvintf->iovar_op(dhd_bus->bus_info, ++ name, params, plen, arg, len, set); ++ } ++ ++ return err; ++} ++ ++ ++void * ++dhd_dbus_txq(const dbus_pub_t *pub) ++{ ++ return NULL; ++} ++ ++uint ++dhd_dbus_hdrlen(const dbus_pub_t *pub) ++{ ++ return 0; ++} ++ ++void * ++dbus_get_devinfo(dbus_pub_t *pub) ++{ ++ return pub->dev_info; ++} ++ ++#if defined(BCM_REQUEST_FW) && !defined(EXTERNAL_FW_PATH) ++static int ++dbus_otp(dhd_bus_t *dhd_bus, uint16 *boardtype, uint16 *boardrev) ++{ ++ uint32 value = 0; ++ uint8 *cis; ++ uint16 *otpinfo; ++ uint32 i; ++ bool standard_cis = TRUE; ++ uint8 tup, tlen; ++ bool btype_present = FALSE; ++ bool brev_present = FALSE; ++ int ret; ++ int devid; ++ uint16 btype = 0; ++ uint16 brev = 0; ++ uint32 otp_size = 0, otp_addr = 0, otp_sw_rgn = 0; ++ ++ if (dhd_bus == NULL || dhd_bus->drvintf == NULL || ++ dhd_bus->drvintf->readreg == NULL) ++ return DBUS_ERR; ++ ++ devid = dhd_bus->pub.attrib.devid; ++ ++ if ((devid == BCM43234_CHIP_ID) || (devid == BCM43235_CHIP_ID) || ++ (devid == BCM43236_CHIP_ID)) { ++ ++ otp_size = BCM_OTP_SIZE_43236; ++ otp_sw_rgn = BCM_OTP_SW_RGN_43236; ++ otp_addr = BCM_OTP_ADDR_43236; ++ ++ } else { ++ return DBUS_ERR_NVRAM; ++ } ++ ++ cis = MALLOC(dhd_bus->pub.osh, otp_size * 2); ++ if (cis == NULL) ++ return DBUS_ERR; ++ ++ otpinfo = (uint16 *) cis; ++ ++ for (i = 0; i < otp_size; i++) { ++ ++ ret = dhd_bus->drvintf->readreg(dhd_bus->bus_info, ++ otp_addr + ((otp_sw_rgn + i) << 1), 2, &value); ++ ++ if (ret != DBUS_OK) { ++ MFREE(dhd_bus->pub.osh, cis, otp_size * 2); ++ return ret; ++ } ++ otpinfo[i] = (uint16) value; ++ } ++ ++ for (i = 0; i < (otp_size << 1); ) { ++ ++ if (standard_cis) { ++ tup = cis[i++]; ++ if (tup == CISTPL_NULL || tup == CISTPL_END) ++ tlen = 0; ++ else ++ tlen = cis[i++]; ++ } else { ++ if (cis[i] == CISTPL_NULL || cis[i] == CISTPL_END) { ++ tlen = 0; ++ tup = cis[i]; ++ } else { ++ tlen = cis[i]; ++ tup = CISTPL_BRCM_HNBU; ++ } ++ ++i; ++ } ++ ++ if (tup == CISTPL_END || (i + tlen) >= (otp_size << 1)) { ++ break; ++ } ++ ++ switch (tup) { ++ ++ case CISTPL_BRCM_HNBU: ++ ++ switch (cis[i]) { ++ ++ case HNBU_BOARDTYPE: ++ ++ btype = (uint16) ((cis[i + 2] << 8) + cis[i + 1]); ++ btype_present = TRUE; ++ DBUSTRACE(("%s: HNBU_BOARDTYPE = 0x%2x\n", __FUNCTION__, ++ (uint32)btype)); ++ break; ++ ++ case HNBU_BOARDREV: ++ ++ if (tlen == 2) ++ brev = (uint16) cis[i + 1]; ++ else ++ brev = (uint16) ((cis[i + 2] << 8) + cis[i + 1]); ++ brev_present = TRUE; ++ DBUSTRACE(("%s: HNBU_BOARDREV = 0x%2x\n", __FUNCTION__, ++ (uint32)*boardrev)); ++ break; ++ ++ case HNBU_HNBUCIS: ++ DBUSTRACE(("%s: HNBU_HNBUCIS\n", __FUNCTION__)); ++ tlen++; ++ standard_cis = FALSE; ++ break; ++ } ++ break; ++ } ++ ++ i += tlen; ++ } ++ ++ MFREE(dhd_bus->pub.osh, cis, otp_size * 2); ++ ++ if (btype_present == TRUE && brev_present == TRUE) { ++ *boardtype = btype; ++ *boardrev = brev; ++ DBUSERR(("otp boardtype = 0x%2x boardrev = 0x%2x\n", ++ *boardtype, *boardrev)); ++ ++ return DBUS_OK; ++ } ++ else ++ return DBUS_ERR; ++} /* dbus_otp */ ++ ++static int ++dbus_select_nvram(dhd_bus_t *dhd_bus, int8 *jumbonvram, int jumbolen, ++uint16 boardtype, uint16 boardrev, int8 **nvram, int *nvram_len) ++{ ++ /* Multi board nvram file format is contenation of nvram info with \r ++ * The file format for two contatenated set is ++ * \nBroadcom Jumbo Nvram file\nfirst_set\nsecond_set\nthird_set\n ++ */ ++ uint8 *nvram_start = NULL, *nvram_end = NULL; ++ uint8 *nvram_start_prev = NULL, *nvram_end_prev = NULL; ++ uint16 btype = 0, brev = 0; ++ int len = 0; ++ char *field; ++ ++ *nvram = NULL; ++ *nvram_len = 0; ++ ++ if (strncmp(BCM_JUMBO_START, jumbonvram, strlen(BCM_JUMBO_START))) { ++ /* single nvram file in the native format */ ++ DBUSTRACE(("%s: Non-Jumbo NVRAM File \n", __FUNCTION__)); ++ *nvram = jumbonvram; ++ *nvram_len = jumbolen; ++ return DBUS_OK; ++ } else { ++ DBUSTRACE(("%s: Jumbo NVRAM File \n", __FUNCTION__)); ++ } ++ ++ /* sanity test the end of the config sets for proper ending */ ++ if (jumbonvram[jumbolen - 1] != BCM_JUMBO_NVRAM_DELIMIT || ++ jumbonvram[jumbolen - 2] != '\0') { ++ DBUSERR(("%s: Bad Jumbo NVRAM file format\n", __FUNCTION__)); ++ return DBUS_JUMBO_BAD_FORMAT; ++ } ++ ++ dhd_bus->nvram_nontxt = DBUS_NVRAM_NONTXT; ++ ++ nvram_start = jumbonvram; ++ ++ while (*nvram_start != BCM_JUMBO_NVRAM_DELIMIT && len < jumbolen) { ++ ++ /* consume the first file info line ++ * \nBroadcom Jumbo Nvram file\nfile1\n ... ++ */ ++ len ++; ++ nvram_start ++; ++ } ++ ++ nvram_end = nvram_start; ++ ++ /* search for "boardrev=0xabcd" and "boardtype=0x1234" information in ++ * the concatenated nvram config files /sets ++ */ ++ ++ while (len < jumbolen) { ++ ++ if (*nvram_end == '\0') { ++ /* end of a config set is marked by multiple null characters */ ++ len ++; ++ nvram_end ++; ++ DBUSTRACE(("%s: NULL chr len = %d char = 0x%x\n", __FUNCTION__, ++ len, *nvram_end)); ++ continue; ++ ++ } else if (*nvram_end == BCM_JUMBO_NVRAM_DELIMIT) { ++ ++ /* config set delimiter is reached */ ++ /* check if next config set is present or not ++ * return if next config is not present ++ */ ++ ++ /* start search the next config set */ ++ nvram_start_prev = nvram_start; ++ nvram_end_prev = nvram_end; ++ ++ nvram_end ++; ++ nvram_start = nvram_end; ++ btype = brev = 0; ++ DBUSTRACE(("%s: going to next record len = %d " ++ "char = 0x%x \n", __FUNCTION__, len, *nvram_end)); ++ len ++; ++ if (len >= jumbolen) { ++ ++ *nvram = nvram_start_prev; ++ *nvram_len = (int)(nvram_end_prev - nvram_start_prev); ++ ++ DBUSTRACE(("%s: no more len = %d nvram_end = 0x%p", ++ __FUNCTION__, len, nvram_end)); ++ ++ return DBUS_JUMBO_NOMATCH; ++ ++ } else { ++ continue; ++ } ++ ++ } else { ++ ++ DBUSTRACE(("%s: config str = %s\n", __FUNCTION__, nvram_end)); ++ ++ if (bcmp(nvram_end, "boardtype", strlen("boardtype")) == 0) { ++ ++ field = strchr(nvram_end, '='); ++ field++; ++ btype = (uint16)bcm_strtoul(field, NULL, 0); ++ ++ DBUSTRACE(("%s: btype = 0x%x boardtype = 0x%x \n", __FUNCTION__, ++ btype, boardtype)); ++ } ++ ++ if (bcmp(nvram_end, "boardrev", strlen("boardrev")) == 0) { ++ ++ field = strchr(nvram_end, '='); ++ field++; ++ brev = (uint16)bcm_strtoul(field, NULL, 0); ++ ++ DBUSTRACE(("%s: brev = 0x%x boardrev = 0x%x \n", __FUNCTION__, ++ brev, boardrev)); ++ } ++ if (btype == boardtype && brev == boardrev) { ++ /* locate nvram config set end - ie.find '\r' char */ ++ while (*nvram_end != BCM_JUMBO_NVRAM_DELIMIT) ++ nvram_end ++; ++ *nvram = nvram_start; ++ *nvram_len = (int) (nvram_end - nvram_start); ++ DBUSTRACE(("found len = %d nvram_start = 0x%p " ++ "nvram_end = 0x%p\n", *nvram_len, nvram_start, nvram_end)); ++ return DBUS_OK; ++ } ++ ++ len += (strlen(nvram_end) + 1); ++ nvram_end += (strlen(nvram_end) + 1); ++ } ++ } ++ return DBUS_JUMBO_NOMATCH; ++} /* dbus_select_nvram */ ++ ++#endif ++ ++#define DBUS_NRXQ 50 ++#define DBUS_NTXQ 100 ++ ++static void ++dhd_dbus_send_complete(void *handle, void *info, int status) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ void *pkt = info; ++ ++ if ((dhd == NULL) || (pkt == NULL)) { ++ DBUSERR(("dhd or pkt is NULL\n")); ++ return; ++ } ++ ++ if (status == DBUS_OK) { ++ dhd->dstats.tx_packets++; ++ } else { ++ DBUSERR(("TX error=%d\n", status)); ++ dhd->dstats.tx_errors++; ++ } ++#ifdef PROP_TXSTATUS ++ if (DHD_PKTTAG_WLFCPKT(PKTTAG(pkt)) && ++ (dhd_wlfc_txcomplete(dhd, pkt, status == 0) != WLFC_UNSUPPORTED)) { ++ return; ++ } ++#endif /* PROP_TXSTATUS */ ++ PKTFREE(dhd->osh, pkt, TRUE); ++} ++ ++static void ++dhd_dbus_recv_pkt(void *handle, void *pkt) ++{ ++ uchar reorder_info_buf[WLHOST_REORDERDATA_TOTLEN]; ++ uint reorder_info_len; ++ uint pkt_count; ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ int ifidx = 0; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ /* If the protocol uses a data header, check and remove it */ ++ if (dhd_prot_hdrpull(dhd, &ifidx, pkt, reorder_info_buf, ++ &reorder_info_len) != 0) { ++ DBUSERR(("rx protocol error\n")); ++ PKTFREE(dhd->osh, pkt, FALSE); ++ dhd->rx_errors++; ++ return; ++ } ++ ++ if (reorder_info_len) { ++ /* Reordering info from the firmware */ ++ dhd_process_pkt_reorder_info(dhd, reorder_info_buf, reorder_info_len, ++ &pkt, &pkt_count); ++ if (pkt_count == 0) ++ return; ++ } ++ else { ++ pkt_count = 1; ++ } ++ dhd_rx_frame(dhd, ifidx, pkt, pkt_count, 0); ++} ++ ++static void ++dhd_dbus_recv_buf(void *handle, uint8 *buf, int len) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ void *pkt; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ if ((pkt = PKTGET(dhd->osh, len, FALSE)) == NULL) { ++ DBUSERR(("PKTGET (rx) failed=%d\n", len)); ++ return; ++ } ++ ++ bcopy(buf, PKTDATA(dhd->osh, pkt), len); ++ dhd_dbus_recv_pkt(dhd, pkt); ++} ++ ++static void ++dhd_dbus_txflowcontrol(void *handle, bool onoff) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ bool wlfc_enabled = FALSE; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++#ifdef PROP_TXSTATUS ++ wlfc_enabled = (dhd_wlfc_flowcontrol(dhd, onoff, !onoff) != WLFC_UNSUPPORTED); ++#endif ++ ++ if (!wlfc_enabled) { ++ dhd_txflowcontrol(dhd, ALL_INTERFACES, onoff); ++ } ++} ++ ++static void ++dhd_dbus_errhandler(void *handle, int err) ++{ ++} ++ ++static void ++dhd_dbus_ctl_complete(void *handle, int type, int status) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ if (type == DBUS_CBCTL_READ) { ++ if (status == DBUS_OK) ++ dhd->rx_ctlpkts++; ++ else ++ dhd->rx_ctlerrs++; ++ } else if (type == DBUS_CBCTL_WRITE) { ++ if (status == DBUS_OK) ++ dhd->tx_ctlpkts++; ++ else ++ dhd->tx_ctlerrs++; ++ } ++ ++ dhd_prot_ctl_complete(dhd); ++} ++ ++static void ++dhd_dbus_state_change(void *handle, int state) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ switch (state) { ++ ++ case DBUS_STATE_DL_NEEDED: ++ DBUSERR(("%s: firmware request cannot be handled\n", __FUNCTION__)); ++ break; ++ case DBUS_STATE_DOWN: ++ DBUSTRACE(("%s: DBUS is down\n", __FUNCTION__)); ++ dhd->busstate = DHD_BUS_DOWN; ++ break; ++ case DBUS_STATE_UP: ++ DBUSTRACE(("%s: DBUS is up\n", __FUNCTION__)); ++ dhd->busstate = DHD_BUS_DATA; ++ break; ++ default: ++ break; ++ } ++ ++ DBUSERR(("%s: DBUS current state=%d\n", __FUNCTION__, state)); ++} ++ ++static void * ++dhd_dbus_pktget(void *handle, uint len, bool send) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ void *p = NULL; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return NULL; ++ } ++ ++ if (send == TRUE) { ++ dhd_os_sdlock_txq(dhd); ++ p = PKTGET(dhd->osh, len, TRUE); ++ dhd_os_sdunlock_txq(dhd); ++ } else { ++ dhd_os_sdlock_rxq(dhd); ++ p = PKTGET(dhd->osh, len, FALSE); ++ dhd_os_sdunlock_rxq(dhd); ++ } ++ ++ return p; ++} ++ ++static void ++dhd_dbus_pktfree(void *handle, void *p, bool send) ++{ ++ dhd_pub_t *dhd = (dhd_pub_t *)handle; ++ ++ if (dhd == NULL) { ++ DBUSERR(("%s: dhd is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ if (send == TRUE) { ++#ifdef PROP_TXSTATUS ++ if (DHD_PKTTAG_WLFCPKT(PKTTAG(p)) && ++ (dhd_wlfc_txcomplete(dhd, p, FALSE) != WLFC_UNSUPPORTED)) { ++ return; ++ } ++#endif /* PROP_TXSTATUS */ ++ ++ dhd_os_sdlock_txq(dhd); ++ PKTFREE(dhd->osh, p, TRUE); ++ dhd_os_sdunlock_txq(dhd); ++ } else { ++ dhd_os_sdlock_rxq(dhd); ++ PKTFREE(dhd->osh, p, FALSE); ++ dhd_os_sdunlock_rxq(dhd); ++ } ++} ++ ++ ++static dbus_callbacks_t dhd_dbus_cbs = { ++ dhd_dbus_send_complete, ++ dhd_dbus_recv_buf, ++ dhd_dbus_recv_pkt, ++ dhd_dbus_txflowcontrol, ++ dhd_dbus_errhandler, ++ dhd_dbus_ctl_complete, ++ dhd_dbus_state_change, ++ dhd_dbus_pktget, ++ dhd_dbus_pktfree ++}; ++ ++uint ++dhd_bus_chip(struct dhd_bus *bus) ++{ ++ ASSERT(bus != NULL); ++ return bus->pub.attrib.devid; ++} ++ ++uint ++dhd_bus_chiprev(struct dhd_bus *bus) ++{ ++ ASSERT(bus); ++ ASSERT(bus != NULL); ++ return bus->pub.attrib.chiprev; ++} ++ ++void ++dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) ++{ ++ bcm_bprintf(strbuf, "Bus USB\n"); ++} ++ ++void ++dhd_bus_clearcounts(dhd_pub_t *dhdp) ++{ ++} ++ ++int ++dhd_bus_txdata(struct dhd_bus *bus, void *pktbuf) ++{ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ if (bus->txoff) { ++ DBUSTRACE(("txoff\n")); ++ return BCME_EPERM; ++ } ++ return dbus_send_txdata(&bus->pub, pktbuf); ++} ++ ++static void ++dhd_dbus_advertise_bus_cleanup(dhd_pub_t *dhdp) ++{ ++ unsigned long flags; ++ int timeleft; ++ ++ DHD_LINUX_GENERAL_LOCK(dhdp, flags); ++ dhdp->busstate = DHD_BUS_DOWN_IN_PROGRESS; ++ DHD_LINUX_GENERAL_UNLOCK(dhdp, flags); ++ ++ timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state); ++ if ((timeleft == 0) || (timeleft == 1)) { ++ DBUSERR(("%s : Timeout due to dhd_bus_busy_state=0x%x\n", ++ __FUNCTION__, dhdp->dhd_bus_busy_state)); ++ ASSERT(0); ++ } ++ ++ return; ++} ++ ++static void ++dhd_dbus_advertise_bus_remove(dhd_pub_t *dhdp) ++{ ++ unsigned long flags; ++ int timeleft; ++ ++ DHD_LINUX_GENERAL_LOCK(dhdp, flags); ++ dhdp->busstate = DHD_BUS_REMOVE; ++ DHD_LINUX_GENERAL_UNLOCK(dhdp, flags); ++ ++ timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state); ++ if ((timeleft == 0) || (timeleft == 1)) { ++ DBUSERR(("%s : Timeout due to dhd_bus_busy_state=0x%x\n", ++ __FUNCTION__, dhdp->dhd_bus_busy_state)); ++ ASSERT(0); ++ } ++ ++ return; ++} ++ ++int ++dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag) ++{ ++ int bcmerror = 0; ++ unsigned long flags; ++ wifi_adapter_info_t *adapter = (wifi_adapter_info_t *)dhdp->adapter; ++ ++ if (flag == TRUE) { ++ if (!dhdp->dongle_reset) { ++ DBUSERR(("%s: == Power OFF ==\n", __FUNCTION__)); ++ dhd_dbus_advertise_bus_cleanup(dhdp); ++ dhd_os_wd_timer(dhdp, 0); ++#if !defined(IGNORE_ETH0_DOWN) ++ /* Force flow control as protection when stop come before ifconfig_down */ ++ dhd_txflowcontrol(dhdp, ALL_INTERFACES, ON); ++#endif /* !defined(IGNORE_ETH0_DOWN) */ ++ dbus_stop(dhdp->bus); ++ ++ dhdp->dongle_reset = TRUE; ++ dhdp->up = FALSE; ++ ++ DHD_LINUX_GENERAL_LOCK(dhdp, flags); ++ dhdp->busstate = DHD_BUS_DOWN; ++ DHD_LINUX_GENERAL_UNLOCK(dhdp, flags); ++ wifi_clr_adapter_status(adapter, WIFI_STATUS_FW_READY); ++ ++ printf("%s: WLAN OFF DONE\n", __FUNCTION__); ++ /* App can now remove power from device */ ++ } else ++ bcmerror = BCME_ERROR; ++ } else { ++ /* App must have restored power to device before calling */ ++ printf("\n\n%s: == WLAN ON ==\n", __FUNCTION__); ++ if (dhdp->dongle_reset) { ++ /* Turn on WLAN */ ++ DHD_MUTEX_UNLOCK(); ++ wait_event_interruptible_timeout(adapter->status_event, ++ wifi_get_adapter_status(adapter, WIFI_STATUS_FW_READY), ++ msecs_to_jiffies(DHD_FW_READY_TIMEOUT)); ++ DHD_MUTEX_LOCK(); ++ bcmerror = dbus_up(dhdp->bus); ++ if (bcmerror == BCME_OK) { ++ dhdp->dongle_reset = FALSE; ++ dhdp->up = TRUE; ++#if !defined(IGNORE_ETH0_DOWN) ++ /* Restore flow control */ ++ dhd_txflowcontrol(dhdp, ALL_INTERFACES, OFF); ++#endif ++ dhd_os_wd_timer(dhdp, dhd_watchdog_ms); ++ ++ DBUSTRACE(("%s: WLAN ON DONE\n", __FUNCTION__)); ++ } else { ++ DBUSERR(("%s: failed to dbus_up with code %d\n", __FUNCTION__, bcmerror)); ++ } ++ } ++ } ++ ++#ifdef PKT_STATICS ++ memset((uint8*) &tx_statics, 0, sizeof(pkt_statics_t)); ++#endif ++ return bcmerror; ++} ++ ++void ++dhd_set_path_params(struct dhd_bus *bus) ++{ ++ /* External conf takes precedence if specified */ ++ dhd_conf_preinit(bus->dhd); ++ ++ if (bus->dhd->conf_path[0] == '\0') { ++ dhd_conf_set_path(bus->dhd, "config.txt", bus->dhd->conf_path, bus->nv_path); ++ } ++ if (bus->dhd->clm_path[0] == '\0') { ++ dhd_conf_set_path(bus->dhd, "clm.blob", bus->dhd->clm_path, bus->fw_path); ++ } ++#ifdef CONFIG_PATH_AUTO_SELECT ++ dhd_conf_set_conf_name_by_chip(bus->dhd, bus->dhd->conf_path); ++#endif ++ ++ dhd_conf_read_config(bus->dhd, bus->dhd->conf_path); ++ ++ dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path); ++ dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path); ++ dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path); ++ ++ printf("Final fw_path=%s\n", bus->fw_path); ++ printf("Final nv_path=%s\n", bus->nv_path); ++ printf("Final clm_path=%s\n", bus->dhd->clm_path); ++ printf("Final conf_path=%s\n", bus->dhd->conf_path); ++ ++} ++ ++void ++dhd_bus_update_fw_nv_path(struct dhd_bus *bus, char *pfw_path, ++ char *pnv_path, char *pclm_path, char *pconf_path) ++{ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (bus == NULL) { ++ DBUSERR(("%s: bus is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ bus->fw_path = pfw_path; ++ bus->nv_path = pnv_path; ++ bus->dhd->clm_path = pclm_path; ++ bus->dhd->conf_path = pconf_path; ++ ++ dhd_set_path_params(bus); ++ ++} ++ ++/* ++ * hdrlen is space to reserve in pkt headroom for DBUS ++ */ ++void * ++dhd_dbus_probe_cb(void *arg, const char *desc, uint32 bustype, ++ uint16 bus_no, uint16 slot, uint32 hdrlen) ++{ ++ osl_t *osh = NULL; ++ dhd_bus_t *bus = NULL; ++ dhd_pub_t *pub = NULL; ++ uint rxsz; ++ int dlneeded = 0; ++ wifi_adapter_info_t *adapter = NULL; ++ ++ DBUSTRACE(("%s: Enter\n", __FUNCTION__)); ++ ++ adapter = dhd_wifi_platform_get_adapter(bustype, bus_no, slot); ++ ++ if (!g_pub) { ++ /* Ask the OS interface part for an OSL handle */ ++ if (!(osh = osl_attach(NULL, bustype, TRUE))) { ++ DBUSERR(("%s: OSL attach failed\n", __FUNCTION__)); ++ goto fail; ++ } ++ ++ /* Attach to the dhd/OS interface */ ++ if (!(pub = dhd_attach(osh, bus, hdrlen, adapter))) { ++ DBUSERR(("%s: dhd_attach failed\n", __FUNCTION__)); ++ goto fail; ++ } ++ } else { ++ pub = g_pub; ++ } ++ ++ if (pub->bus) { ++ DBUSERR(("%s: wrong probe\n", __FUNCTION__)); ++ goto fail; ++ } ++ ++ rxsz = dhd_get_rxsz(pub); ++ bus = dbus_attach(osh, rxsz, DBUS_NRXQ, DBUS_NTXQ, pub, &dhd_dbus_cbs, NULL, NULL); ++ if (bus) { ++ pub->bus = bus; ++ bus->dhd = pub; ++ ++ dlneeded = dbus_dlneeded(bus); ++ if (dlneeded >= 0) { ++ if (!g_pub) { ++ dhd_conf_reset(pub); ++ dhd_conf_set_chiprev(pub, bus->pub.attrib.devid, bus->pub.attrib.chiprev); ++ dhd_conf_preinit(pub); ++ } ++ } ++ ++ if (g_pub || dhd_download_fw_on_driverload) { ++ if (dlneeded == 0) { ++ wifi_set_adapter_status(adapter, WIFI_STATUS_FW_READY); ++#ifdef BCM_REQUEST_FW ++ } else if (dlneeded > 0) { ++ dhd_set_path(bus->dhd); ++ if (dbus_download_firmware(bus, bus->fw_path, bus->nv_path) != DBUS_OK) ++ goto fail; ++#endif ++ } ++ } ++ } else { ++ DBUSERR(("%s: dbus_attach failed\n", __FUNCTION__)); ++ } ++ ++ if (!g_pub) { ++ /* Ok, finish the attach to the OS network interface */ ++ if (dhd_register_if(pub, 0, TRUE) != 0) { ++ DBUSERR(("%s: dhd_register_if failed\n", __FUNCTION__)); ++ goto fail; ++ } ++ pub->hang_report = TRUE; ++#if defined(MULTIPLE_SUPPLICANT) ++ wl_android_post_init(); // terence 20120530: fix critical section in dhd_open and dhdsdio_probe ++#endif ++ g_pub = pub; ++ } ++ ++ DBUSTRACE(("%s: Exit\n", __FUNCTION__)); ++ wifi_clr_adapter_status(adapter, WIFI_STATUS_DETTACH); ++ wifi_set_adapter_status(adapter, WIFI_STATUS_ATTACH); ++ wake_up_interruptible(&adapter->status_event); ++ /* This is passed to dhd_dbus_disconnect_cb */ ++ return bus; ++ ++fail: ++ if (pub && pub->bus) { ++ dbus_detach(pub->bus); ++ pub->bus = NULL; ++ } ++ /* Release resources in reverse order */ ++ if (!g_pub) { ++ if (pub) { ++ dhd_detach(pub); ++ dhd_free(pub); ++ } ++ if (osh) { ++ osl_detach(osh); ++ } ++ } ++ ++ printf("%s: Failed\n", __FUNCTION__); ++ return NULL; ++} ++ ++void ++dhd_dbus_disconnect_cb(void *arg) ++{ ++ dhd_bus_t *bus = (dhd_bus_t *)arg; ++ dhd_pub_t *pub = g_pub; ++ osl_t *osh; ++ wifi_adapter_info_t *adapter = NULL; ++ ++ adapter = (wifi_adapter_info_t *)pub->adapter; ++ ++ if (pub && !pub->dhd_remove && bus == NULL) { ++ DBUSERR(("%s: bus is NULL\n", __FUNCTION__)); ++ return; ++ } ++ if (!adapter) { ++ DBUSERR(("%s: adapter is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ printf("%s: Enter dhd_remove=%d on %s\n", __FUNCTION__, ++ pub->dhd_remove, adapter->name); ++ if (!pub->dhd_remove) { ++ /* Advertise bus remove during rmmod */ ++ dhd_dbus_advertise_bus_remove(bus->dhd); ++ dbus_detach(pub->bus); ++ pub->bus = NULL; ++ wifi_clr_adapter_status(adapter, WIFI_STATUS_ATTACH); ++ wifi_set_adapter_status(adapter, WIFI_STATUS_DETTACH); ++ wake_up_interruptible(&adapter->status_event); ++ } else { ++ osh = pub->osh; ++ dhd_detach(pub); ++ if (pub->bus) { ++ dbus_detach(pub->bus); ++ pub->bus = NULL; ++ } ++ dhd_free(pub); ++ g_pub = NULL; ++ if (MALLOCED(osh)) { ++ DBUSERR(("%s: MEMORY LEAK %d bytes\n", __FUNCTION__, MALLOCED(osh))); ++ } ++ osl_detach(osh); ++ } ++ ++ DBUSTRACE(("%s: Exit\n", __FUNCTION__)); ++} ++ ++#ifdef LINUX_EXTERNAL_MODULE_DBUS ++ ++static int __init ++bcm_dbus_module_init(void) ++{ ++ printf("Inserting bcm_dbus module \n"); ++ return 0; ++} ++ ++static void __exit ++bcm_dbus_module_exit(void) ++{ ++ printf("Removing bcm_dbus module \n"); ++ return; ++} ++ ++EXPORT_SYMBOL(dbus_pnp_sleep); ++EXPORT_SYMBOL(dbus_get_devinfo); ++EXPORT_SYMBOL(dbus_detach); ++EXPORT_SYMBOL(dbus_get_attrib); ++EXPORT_SYMBOL(dbus_down); ++EXPORT_SYMBOL(dbus_pnp_resume); ++EXPORT_SYMBOL(dbus_set_config); ++EXPORT_SYMBOL(dbus_flowctrl_rx); ++EXPORT_SYMBOL(dbus_up); ++EXPORT_SYMBOL(dbus_get_device_speed); ++EXPORT_SYMBOL(dbus_send_pkt); ++EXPORT_SYMBOL(dbus_recv_ctl); ++EXPORT_SYMBOL(dbus_attach); ++ ++MODULE_LICENSE("GPL"); ++ ++module_init(bcm_dbus_module_init); ++module_exit(bcm_dbus_module_exit); ++ ++#endif /* #ifdef LINUX_EXTERNAL_MODULE_DBUS */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb.c +new file mode 100644 +index 000000000000..3be28b2da9d4 +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb.c +@@ -0,0 +1,1173 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Dongle BUS interface for USB, OS independent ++ * ++ * Copyright (C) 1999-2016, Broadcom Corporation ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2 (the "GPL"), ++ * available at http://www.broadcom.com/licenses/GPLv2.php, with the ++ * following added to such license: ++ * ++ * As a special exception, the copyright holders of this software give you ++ * permission to link this software with independent modules, and to copy and ++ * distribute the resulting executable under terms of your choice, provided that ++ * you also meet, for each linked independent module, the terms and conditions of ++ * the license of that module. An independent module is a module which is not ++ * derived from this software. The special exception does not apply to any ++ * modifications of the software. ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a license ++ * other than the GPL, without Broadcom's express prior written consent. ++ * ++ * ++ * <> ++ * ++ * $Id: dbus_usb.c 565557 2015-06-22 19:29:44Z $ ++ */ ++ ++/** ++ * @file @brief ++ * This file contains DBUS code that is USB, but not OS specific. DBUS is a Broadcom proprietary ++ * host specific abstraction layer. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++uint dbus_msglevel = DBUS_ERROR_VAL; ++module_param(dbus_msglevel, int, 0); ++ ++ ++#define USB_DLIMAGE_RETRY_TIMEOUT 3000 /* retry Timeout */ ++#define USB_SFLASH_DLIMAGE_SPINWAIT 150 /* in unit of ms */ ++#define USB_SFLASH_DLIMAGE_LIMIT 2000 /* spinwait limit (ms) */ ++#define POSTBOOT_ID 0xA123 /* ID to detect if dongle has boot up */ ++#define USB_RESETCFG_SPINWAIT 1 /* wait after resetcfg (ms) */ ++#define USB_DEV_ISBAD(u) (u->pub->attrib.devid == 0xDEAD) ++#define USB_DLGO_SPINWAIT 100 /* wait after DL_GO (ms) */ ++#define TEST_CHIP 0x4328 ++ ++typedef struct { ++ dbus_pub_t *pub; ++ ++ void *cbarg; ++ dbus_intf_callbacks_t *cbs; /** callbacks into higher DBUS level (dbus.c) */ ++ dbus_intf_t *drvintf; ++ void *usbosl_info; ++ uint32 rdlram_base_addr; ++ uint32 rdlram_size; ++} usb_info_t; ++ ++/* ++ * Callbacks common to all USB ++ */ ++static void dbus_usb_disconnect(void *handle); ++static void dbus_usb_send_irb_timeout(void *handle, dbus_irb_tx_t *txirb); ++static void dbus_usb_send_irb_complete(void *handle, dbus_irb_tx_t *txirb, int status); ++static void dbus_usb_recv_irb_complete(void *handle, dbus_irb_rx_t *rxirb, int status); ++static void dbus_usb_errhandler(void *handle, int err); ++static void dbus_usb_ctl_complete(void *handle, int type, int status); ++static void dbus_usb_state_change(void *handle, int state); ++static struct dbus_irb* dbus_usb_getirb(void *handle, bool send); ++static void dbus_usb_rxerr_indicate(void *handle, bool on); ++#if !defined(BCM_REQUEST_FW) ++static int dbus_usb_resetcfg(usb_info_t *usbinfo); ++#endif ++static int dbus_usb_iovar_op(void *bus, const char *name, ++ void *params, int plen, void *arg, int len, bool set); ++static int dbus_iovar_process(usb_info_t* usbinfo, const char *name, ++ void *params, int plen, void *arg, int len, bool set); ++static int dbus_usb_doiovar(usb_info_t *bus, const bcm_iovar_t *vi, uint32 actionid, ++ const char *name, void *params, int plen, void *arg, int len, int val_size); ++static int dhdusb_downloadvars(usb_info_t *bus, void *arg, int len); ++ ++static int dbus_usb_dl_writeimage(usb_info_t *usbinfo, uint8 *fw, int fwlen); ++static int dbus_usb_dlstart(void *bus, uint8 *fw, int len); ++static int dbus_usb_dlneeded(void *bus); ++static int dbus_usb_dlrun(void *bus); ++static int dbus_usb_rdl_dwnld_state(usb_info_t *usbinfo); ++ ++ ++/* OS specific */ ++extern bool dbus_usbos_dl_cmd(void *info, uint8 cmd, void *buffer, int buflen); ++extern int dbus_usbos_wait(void *info, uint16 ms); ++extern int dbus_write_membytes(usb_info_t *usbinfo, bool set, uint32 address, ++ uint8 *data, uint size); ++extern bool dbus_usbos_dl_send_bulk(void *info, void *buffer, int len); ++extern int dbus_usbos_loopback_tx(void *usbos_info_ptr, int cnt, int size); ++ ++/** ++ * These functions are called by the lower DBUS level (dbus_usb_os.c) to notify this DBUS level ++ * (dbus_usb.c) of an event. ++ */ ++static dbus_intf_callbacks_t dbus_usb_intf_cbs = { ++ dbus_usb_send_irb_timeout, ++ dbus_usb_send_irb_complete, ++ dbus_usb_recv_irb_complete, ++ dbus_usb_errhandler, ++ dbus_usb_ctl_complete, ++ dbus_usb_state_change, ++ NULL, /* isr */ ++ NULL, /* dpc */ ++ NULL, /* watchdog */ ++ NULL, /* dbus_if_pktget */ ++ NULL, /* dbus_if_pktfree */ ++ dbus_usb_getirb, ++ dbus_usb_rxerr_indicate ++}; ++ ++/* IOVar table */ ++enum { ++ IOV_SET_DOWNLOAD_STATE = 1, ++ IOV_DBUS_MSGLEVEL, ++ IOV_MEMBYTES, ++ IOV_VARS, ++ IOV_LOOPBACK_TX ++}; ++ ++const bcm_iovar_t dhdusb_iovars[] = { ++ {"vars", IOV_VARS, 0, IOVT_BUFFER, 0 }, ++ {"dbus_msglevel", IOV_DBUS_MSGLEVEL, 0, IOVT_UINT32, 0 }, ++ {"dwnldstate", IOV_SET_DOWNLOAD_STATE, 0, IOVT_BOOL, 0 }, ++ {"membytes", IOV_MEMBYTES, 0, IOVT_BUFFER, 2 * sizeof(int) }, ++ {"usb_lb_txfer", IOV_LOOPBACK_TX, 0, IOVT_BUFFER, 2 * sizeof(int) }, ++ {NULL, 0, 0, 0, 0 } ++}; ++ ++/* ++ * Need global for probe() and disconnect() since ++ * attach() is not called at probe and detach() ++ * can be called inside disconnect() ++ */ ++static probe_cb_t probe_cb = NULL; ++static disconnect_cb_t disconnect_cb = NULL; ++static void *probe_arg = NULL; ++static void *disc_arg = NULL; ++static dbus_intf_t *g_dbusintf = NULL; ++static dbus_intf_t dbus_usb_intf; /** functions called by higher layer DBUS into lower layer */ ++ ++/* ++ * dbus_intf_t common to all USB ++ * These functions override dbus_usb_.c. ++ */ ++static void *dbus_usb_attach(dbus_pub_t *pub, void *cbarg, dbus_intf_callbacks_t *cbs); ++static void dbus_usb_detach(dbus_pub_t *pub, void *info); ++static void * dbus_usb_probe(void *arg, const char *desc, uint32 bustype, ++ uint16 bus_no, uint16 slot, uint32 hdrlen); ++ ++/* functions */ ++ ++/** ++ * As part of DBUS initialization/registration, the higher level DBUS (dbus.c) needs to know what ++ * lower level DBUS functions to call (in both dbus_usb.c and dbus_usb_os.c). ++ */ ++static void * ++dbus_usb_probe(void *arg, const char *desc, uint32 bustype, uint16 bus_no, ++ uint16 slot, uint32 hdrlen) ++{ ++ DBUSTRACE(("%s(): \n", __FUNCTION__)); ++ if (probe_cb) { ++ ++ if (g_dbusintf != NULL) { ++ /* First, initialize all lower-level functions as default ++ * so that dbus.c simply calls directly to dbus_usb_os.c. ++ */ ++ bcopy(g_dbusintf, &dbus_usb_intf, sizeof(dbus_intf_t)); ++ ++ /* Second, selectively override functions we need, if any. */ ++ dbus_usb_intf.attach = dbus_usb_attach; ++ dbus_usb_intf.detach = dbus_usb_detach; ++ dbus_usb_intf.iovar_op = dbus_usb_iovar_op; ++ dbus_usb_intf.dlstart = dbus_usb_dlstart; ++ dbus_usb_intf.dlneeded = dbus_usb_dlneeded; ++ dbus_usb_intf.dlrun = dbus_usb_dlrun; ++ } ++ ++ disc_arg = probe_cb(probe_arg, "DBUS USB", USB_BUS, bus_no, slot, hdrlen); ++ return disc_arg; ++ } ++ ++ return NULL; ++} ++ ++/** ++ * On return, *intf contains this or lower-level DBUS functions to be called by higher ++ * level (dbus.c) ++ */ ++int ++dbus_bus_register(int vid, int pid, probe_cb_t prcb, ++ disconnect_cb_t discb, void *prarg, dbus_intf_t **intf, void *param1, void *param2) ++{ ++ int err; ++ ++ DBUSTRACE(("%s(): \n", __FUNCTION__)); ++ probe_cb = prcb; ++ disconnect_cb = discb; ++ probe_arg = prarg; ++ ++ *intf = &dbus_usb_intf; ++ ++ err = dbus_bus_osl_register(vid, pid, dbus_usb_probe, ++ dbus_usb_disconnect, NULL, &g_dbusintf, param1, param2); ++ ++ ASSERT(g_dbusintf); ++ return err; ++} ++ ++int ++dbus_bus_deregister() ++{ ++ DBUSTRACE(("%s(): \n", __FUNCTION__)); ++ return dbus_bus_osl_deregister(); ++} ++ ++/** initialization consists of registration followed by 'attach'. */ ++void * ++dbus_usb_attach(dbus_pub_t *pub, void *cbarg, dbus_intf_callbacks_t *cbs) ++{ ++ usb_info_t *usb_info; ++ ++ DBUSTRACE(("%s(): \n", __FUNCTION__)); ++ ++ if ((g_dbusintf == NULL) || (g_dbusintf->attach == NULL)) ++ return NULL; ++ ++ /* Sanity check for BUS_INFO() */ ++ ASSERT(OFFSETOF(usb_info_t, pub) == 0); ++ ++ usb_info = MALLOC(pub->osh, sizeof(usb_info_t)); ++ if (usb_info == NULL) ++ return NULL; ++ ++ bzero(usb_info, sizeof(usb_info_t)); ++ ++ usb_info->pub = pub; ++ usb_info->cbarg = cbarg; ++ usb_info->cbs = cbs; ++ ++ usb_info->usbosl_info = (dbus_pub_t *)g_dbusintf->attach(pub, ++ usb_info, &dbus_usb_intf_cbs); ++ if (usb_info->usbosl_info == NULL) { ++ MFREE(pub->osh, usb_info, sizeof(usb_info_t)); ++ return NULL; ++ } ++ ++ /* Save USB OS-specific driver entry points */ ++ usb_info->drvintf = g_dbusintf; ++ ++ pub->bus = usb_info; ++#if !defined(BCM_REQUEST_FW) ++ if (!dbus_usb_resetcfg(usb_info)) { ++ usb_info->pub->busstate = DBUS_STATE_DL_DONE; ++ } ++#endif ++ /* Return Lower layer info */ ++ return (void *) usb_info->usbosl_info; ++} ++ ++void ++dbus_usb_detach(dbus_pub_t *pub, void *info) ++{ ++ usb_info_t *usb_info = (usb_info_t *) pub->bus; ++ osl_t *osh = pub->osh; ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->drvintf && usb_info->drvintf->detach) ++ usb_info->drvintf->detach(pub, usb_info->usbosl_info); ++ ++ MFREE(osh, usb_info, sizeof(usb_info_t)); ++} ++ ++void ++dbus_usb_disconnect(void *handle) ++{ ++ DBUSTRACE(("%s(): \n", __FUNCTION__)); ++ if (disconnect_cb) ++ disconnect_cb(disc_arg); ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_send_irb_timeout(void *handle, dbus_irb_tx_t *txirb) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->cbs && usb_info->cbs->send_irb_timeout) ++ usb_info->cbs->send_irb_timeout(usb_info->cbarg, txirb); ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_send_irb_complete(void *handle, dbus_irb_tx_t *txirb, int status) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->cbs && usb_info->cbs->send_irb_complete) ++ usb_info->cbs->send_irb_complete(usb_info->cbarg, txirb, status); ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_recv_irb_complete(void *handle, dbus_irb_rx_t *rxirb, int status) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->cbs && usb_info->cbs->recv_irb_complete) ++ usb_info->cbs->recv_irb_complete(usb_info->cbarg, rxirb, status); ++} ++ ++/** Lower DBUS level (dbus_usb_os.c) requests a free IRB. Pass this on to the higher DBUS level. */ ++static struct dbus_irb* ++dbus_usb_getirb(void *handle, bool send) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ if (usb_info == NULL) ++ return NULL; ++ ++ if (usb_info->cbs && usb_info->cbs->getirb) ++ return usb_info->cbs->getirb(usb_info->cbarg, send); ++ ++ return NULL; ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_rxerr_indicate(void *handle, bool on) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->cbs && usb_info->cbs->rxerr_indicate) ++ usb_info->cbs->rxerr_indicate(usb_info->cbarg, on); ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_errhandler(void *handle, int err) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->cbs && usb_info->cbs->errhandler) ++ usb_info->cbs->errhandler(usb_info->cbarg, err); ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_ctl_complete(void *handle, int type, int status) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (usb_info == NULL) { ++ DBUSERR(("%s: usb_info is NULL\n", __FUNCTION__)); ++ return; ++ } ++ ++ if (usb_info->cbs && usb_info->cbs->ctl_complete) ++ usb_info->cbs->ctl_complete(usb_info->cbarg, type, status); ++} ++ ++/** ++ * When the lower DBUS level (dbus_usb_os.c) signals this event, the higher DBUS level has to be ++ * notified. ++ */ ++static void ++dbus_usb_state_change(void *handle, int state) ++{ ++ usb_info_t *usb_info = (usb_info_t *) handle; ++ ++ if (usb_info == NULL) ++ return; ++ ++ if (usb_info->cbs && usb_info->cbs->state_change) ++ usb_info->cbs->state_change(usb_info->cbarg, state); ++} ++ ++/** called by higher DBUS level (dbus.c) */ ++static int ++dbus_usb_iovar_op(void *bus, const char *name, ++ void *params, int plen, void *arg, int len, bool set) ++{ ++ int err = DBUS_OK; ++ ++ err = dbus_iovar_process((usb_info_t*)bus, name, params, plen, arg, len, set); ++ return err; ++} ++ ++/** process iovar request from higher DBUS level */ ++static int ++dbus_iovar_process(usb_info_t* usbinfo, const char *name, ++ void *params, int plen, void *arg, int len, bool set) ++{ ++ const bcm_iovar_t *vi = NULL; ++ int bcmerror = 0; ++ int val_size; ++ uint32 actionid; ++ ++ DBUSTRACE(("%s: Enter\n", __FUNCTION__)); ++ ++ ASSERT(name); ++ ASSERT(len >= 0); ++ ++ /* Get MUST have return space */ ++ ASSERT(set || (arg && len)); ++ ++ /* Set does NOT take qualifiers */ ++ ASSERT(!set || (!params && !plen)); ++ ++ /* Look up var locally; if not found pass to host driver */ ++ if ((vi = bcm_iovar_lookup(dhdusb_iovars, name)) == NULL) { ++ /* Not Supported */ ++ bcmerror = BCME_UNSUPPORTED; ++ DBUSTRACE(("%s: IOVAR %s is not supported\n", name, __FUNCTION__)); ++ goto exit; ++ ++ } ++ ++ DBUSTRACE(("%s: %s %s, len %d plen %d\n", __FUNCTION__, ++ name, (set ? "set" : "get"), len, plen)); ++ ++ /* set up 'params' pointer in case this is a set command so that ++ * the convenience int and bool code can be common to set and get ++ */ ++ if (params == NULL) { ++ params = arg; ++ plen = len; ++ } ++ ++ if (vi->type == IOVT_VOID) ++ val_size = 0; ++ else if (vi->type == IOVT_BUFFER) ++ val_size = len; ++ else ++ /* all other types are integer sized */ ++ val_size = sizeof(int); ++ ++ actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); ++ bcmerror = dbus_usb_doiovar(usbinfo, vi, actionid, ++ name, params, plen, arg, len, val_size); ++ ++exit: ++ return bcmerror; ++} /* dbus_iovar_process */ ++ ++static int ++dbus_usb_doiovar(usb_info_t *bus, const bcm_iovar_t *vi, uint32 actionid, const char *name, ++ void *params, int plen, void *arg, int len, int val_size) ++{ ++ int bcmerror = 0; ++ int32 int_val = 0; ++ int32 int_val2 = 0; ++ bool bool_val = 0; ++ ++ DBUSTRACE(("%s: Enter, action %d name %s params %p plen %d arg %p len %d val_size %d\n", ++ __FUNCTION__, actionid, name, params, plen, arg, len, val_size)); ++ ++ if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid))) != 0) ++ goto exit; ++ ++ if (plen >= (int)sizeof(int_val)) ++ bcopy(params, &int_val, sizeof(int_val)); ++ ++ if (plen >= (int)sizeof(int_val) * 2) ++ bcopy((void*)((uintptr)params + sizeof(int_val)), &int_val2, sizeof(int_val2)); ++ ++ bool_val = (int_val != 0) ? TRUE : FALSE; ++ ++ switch (actionid) { ++ ++ case IOV_SVAL(IOV_MEMBYTES): ++ case IOV_GVAL(IOV_MEMBYTES): ++ { ++ uint32 address; ++ uint size, dsize; ++ uint8 *data; ++ ++ bool set = (actionid == IOV_SVAL(IOV_MEMBYTES)); ++ ++ ASSERT(plen >= 2*sizeof(int)); ++ ++ address = (uint32)int_val; ++ BCM_REFERENCE(address); ++ bcopy((char *)params + sizeof(int_val), &int_val, sizeof(int_val)); ++ size = (uint)int_val; ++ ++ /* Do some validation */ ++ dsize = set ? plen - (2 * sizeof(int)) : len; ++ if (dsize < size) { ++ DBUSTRACE(("%s: error on %s membytes, addr 0x%08x size %d dsize %d\n", ++ __FUNCTION__, (set ? "set" : "get"), address, size, dsize)); ++ bcmerror = BCME_BADARG; ++ break; ++ } ++ DBUSTRACE(("%s: Request to %s %d bytes at address 0x%08x\n", __FUNCTION__, ++ (set ? "write" : "read"), size, address)); ++ ++ /* Generate the actual data pointer */ ++ data = set ? (uint8*)params + 2 * sizeof(int): (uint8*)arg; ++ ++ /* Call to do the transfer */ ++ bcmerror = dbus_usb_dl_writeimage(BUS_INFO(bus, usb_info_t), data, size); ++ } ++ break; ++ ++ ++ case IOV_SVAL(IOV_SET_DOWNLOAD_STATE): ++ ++ if (bool_val == TRUE) { ++ bcmerror = dbus_usb_dlneeded(bus); ++ dbus_usb_rdl_dwnld_state(BUS_INFO(bus, usb_info_t)); ++ } else { ++ usb_info_t *usbinfo = BUS_INFO(bus, usb_info_t); ++ bcmerror = dbus_usb_dlrun(bus); ++ usbinfo->pub->busstate = DBUS_STATE_DL_DONE; ++ } ++ break; ++ ++ case IOV_SVAL(IOV_VARS): ++ bcmerror = dhdusb_downloadvars(BUS_INFO(bus, usb_info_t), arg, len); ++ break; ++ ++ case IOV_GVAL(IOV_DBUS_MSGLEVEL): ++ int_val = (int32)dbus_msglevel; ++ bcopy(&int_val, arg, val_size); ++ break; ++ ++ case IOV_SVAL(IOV_DBUS_MSGLEVEL): ++ dbus_msglevel = int_val; ++ break; ++ ++#ifdef DBUS_USB_LOOPBACK ++ case IOV_SVAL(IOV_LOOPBACK_TX): ++ bcmerror = dbus_usbos_loopback_tx(BUS_INFO(bus, usb_info_t), int_val, ++ int_val2); ++ break; ++#endif ++ default: ++ bcmerror = BCME_UNSUPPORTED; ++ break; ++ } ++ ++exit: ++ return bcmerror; ++} /* dbus_usb_doiovar */ ++ ++/** higher DBUS level (dbus.c) wants to set NVRAM variables in dongle */ ++static int ++dhdusb_downloadvars(usb_info_t *bus, void *arg, int len) ++{ ++ int bcmerror = 0; ++ uint32 varsize; ++ uint32 varaddr; ++ uint32 varsizew; ++ ++ if (!len) { ++ bcmerror = BCME_BUFTOOSHORT; ++ goto err; ++ } ++ ++ /* RAM size is not set. Set it at dbus_usb_dlneeded */ ++ if (!bus->rdlram_size) ++ bcmerror = BCME_ERROR; ++ ++ /* Even if there are no vars are to be written, we still need to set the ramsize. */ ++ varsize = len ? ROUNDUP(len, 4) : 0; ++ varaddr = (bus->rdlram_size - 4) - varsize; ++ ++ /* Write the vars list */ ++ DBUSTRACE(("WriteVars: @%x varsize=%d\n", varaddr, varsize)); ++ bcmerror = dbus_write_membytes(bus->usbosl_info, TRUE, (varaddr + bus->rdlram_base_addr), ++ arg, varsize); ++ ++ /* adjust to the user specified RAM */ ++ DBUSTRACE(("Usable memory size: %d\n", bus->rdlram_size)); ++ DBUSTRACE(("Vars are at %d, orig varsize is %d\n", varaddr, varsize)); ++ ++ varsize = ((bus->rdlram_size - 4) - varaddr); ++ ++ /* ++ * Determine the length token: ++ * Varsize, converted to words, in lower 16-bits, checksum in upper 16-bits. ++ */ ++ if (bcmerror) { ++ varsizew = 0; ++ } else { ++ varsizew = varsize / 4; ++ varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF); ++ varsizew = htol32(varsizew); ++ } ++ ++ DBUSTRACE(("New varsize is %d, length token=0x%08x\n", varsize, varsizew)); ++ ++ /* Write the length token to the last word */ ++ bcmerror = dbus_write_membytes(bus->usbosl_info, TRUE, ((bus->rdlram_size - 4) + ++ bus->rdlram_base_addr), (uint8*)&varsizew, 4); ++err: ++ return bcmerror; ++} /* dbus_usb_doiovar */ ++ ++#if !defined(BCM_REQUEST_FW) ++/** ++ * After downloading firmware into dongle and starting it, we need to know if the firmware is ++ * indeed up and running. ++ */ ++static int ++dbus_usb_resetcfg(usb_info_t *usbinfo) ++{ ++ void *osinfo; ++ bootrom_id_t id; ++ uint16 waittime = 0; ++ ++ uint32 starttime = 0; ++ uint32 endtime = 0; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ osinfo = usbinfo->usbosl_info; ++ ASSERT(osinfo); ++ ++ /* Give dongle chance to boot */ ++ dbus_usbos_wait(osinfo, USB_SFLASH_DLIMAGE_SPINWAIT); ++ waittime = USB_SFLASH_DLIMAGE_SPINWAIT; ++ while (waittime < USB_DLIMAGE_RETRY_TIMEOUT) { ++ ++ starttime = OSL_SYSUPTIME(); ++ ++ id.chip = 0xDEAD; /* Get the ID */ ++ dbus_usbos_dl_cmd(osinfo, DL_GETVER, &id, sizeof(bootrom_id_t)); ++ id.chip = ltoh32(id.chip); ++ ++ endtime = OSL_SYSUPTIME(); ++ waittime += (endtime - starttime); ++ ++ if (id.chip == POSTBOOT_ID) ++ break; ++ } ++ ++ if (id.chip == POSTBOOT_ID) { ++ DBUSERR(("%s: download done. Bootup time = %d ms postboot chip 0x%x/rev 0x%x\n", ++ __FUNCTION__, waittime, id.chip, id.chiprev)); ++ ++ dbus_usbos_dl_cmd(osinfo, DL_RESETCFG, &id, sizeof(bootrom_id_t)); ++ ++ dbus_usbos_wait(osinfo, USB_RESETCFG_SPINWAIT); ++ return DBUS_OK; ++ } else { ++ DBUSERR(("%s: Cannot talk to Dongle. Wait time = %d ms. Firmware is not UP \n", ++ __FUNCTION__, waittime)); ++ return DBUS_ERR; ++ } ++ ++ return DBUS_OK; ++} ++#endif ++ ++/** before firmware download, the dongle has to be prepared to receive the fw image */ ++static int ++dbus_usb_rdl_dwnld_state(usb_info_t *usbinfo) ++{ ++ void *osinfo = usbinfo->usbosl_info; ++ rdl_state_t state; ++ int err = DBUS_OK; ++ ++ /* 1) Prepare USB boot loader for runtime image */ ++ dbus_usbos_dl_cmd(osinfo, DL_START, &state, sizeof(rdl_state_t)); ++ ++ state.state = ltoh32(state.state); ++ state.bytes = ltoh32(state.bytes); ++ ++ /* 2) Check we are in the Waiting state */ ++ if (state.state != DL_WAITING) { ++ DBUSERR(("%s: Failed to DL_START\n", __FUNCTION__)); ++ err = DBUS_ERR; ++ goto fail; ++ } ++ ++fail: ++ return err; ++} ++ ++/** ++ * Dongle contains bootcode in ROM but firmware is (partially) contained in dongle RAM. Therefore, ++ * firmware has to be downloaded into dongle RAM. ++ */ ++static int ++dbus_usb_dl_writeimage(usb_info_t *usbinfo, uint8 *fw, int fwlen) ++{ ++ osl_t *osh = usbinfo->pub->osh; ++ void *osinfo = usbinfo->usbosl_info; ++ unsigned int sendlen, sent, dllen; ++ char *bulkchunk = NULL, *dlpos; ++ rdl_state_t state; ++ int err = DBUS_OK; ++ bootrom_id_t id; ++ uint16 wait, wait_time; ++ uint32 dl_trunk_size = RDL_CHUNK; ++ ++ if (BCM4350_CHIP(usbinfo->pub->attrib.devid)) ++ dl_trunk_size = RDL_CHUNK_MAX; ++ ++ while (!bulkchunk) { ++ bulkchunk = MALLOC(osh, dl_trunk_size); ++ if (dl_trunk_size == RDL_CHUNK) ++ break; ++ if (!bulkchunk) { ++ dl_trunk_size /= 2; ++ if (dl_trunk_size < RDL_CHUNK) ++ dl_trunk_size = RDL_CHUNK; ++ } ++ } ++ ++ if (bulkchunk == NULL) { ++ err = DBUS_ERR; ++ goto fail; ++ } ++ ++ sent = 0; ++ dlpos = fw; ++ dllen = fwlen; ++ ++ /* Get chip id and rev */ ++ id.chip = usbinfo->pub->attrib.devid; ++ id.chiprev = usbinfo->pub->attrib.chiprev; ++ ++ DBUSTRACE(("enter %s: fwlen=%d\n", __FUNCTION__, fwlen)); ++ ++ dbus_usbos_dl_cmd(osinfo, DL_GETSTATE, &state, sizeof(rdl_state_t)); ++ ++ /* 3) Load the image */ ++ while ((sent < dllen)) { ++ /* Wait until the usb device reports it received all the bytes we sent */ ++ ++ if (sent < dllen) { ++ if ((dllen-sent) < dl_trunk_size) ++ sendlen = dllen-sent; ++ else ++ sendlen = dl_trunk_size; ++ ++ /* simply avoid having to send a ZLP by ensuring we never have an even ++ * multiple of 64 ++ */ ++ if (!(sendlen % 64)) ++ sendlen -= 4; ++ ++ /* send data */ ++ memcpy(bulkchunk, dlpos, sendlen); ++ if (!dbus_usbos_dl_send_bulk(osinfo, bulkchunk, sendlen)) { ++ err = DBUS_ERR; ++ goto fail; ++ } ++ ++ dlpos += sendlen; ++ sent += sendlen; ++ DBUSTRACE(("%s: sendlen %d\n", __FUNCTION__, sendlen)); ++ } ++ ++ wait = 0; ++ wait_time = USB_SFLASH_DLIMAGE_SPINWAIT; ++ while (!dbus_usbos_dl_cmd(osinfo, DL_GETSTATE, &state, ++ sizeof(rdl_state_t))) { ++ if ((id.chip == 43236) && (id.chiprev == 0)) { ++ DBUSERR(("%s: 43236a0 SFlash delay, waiting for dongle crc check " ++ "completion!!!\n", __FUNCTION__)); ++ dbus_usbos_wait(osinfo, wait_time); ++ wait += wait_time; ++ if (wait >= USB_SFLASH_DLIMAGE_LIMIT) { ++ DBUSERR(("%s: DL_GETSTATE Failed xxxx\n", __FUNCTION__)); ++ err = DBUS_ERR; ++ goto fail; ++ break; ++ } ++ } else { ++ DBUSERR(("%s: DL_GETSTATE Failed xxxx\n", __FUNCTION__)); ++ err = DBUS_ERR; ++ goto fail; ++ } ++ } ++ ++ state.state = ltoh32(state.state); ++ state.bytes = ltoh32(state.bytes); ++ ++ /* restart if an error is reported */ ++ if ((state.state == DL_BAD_HDR) || (state.state == DL_BAD_CRC)) { ++ DBUSERR(("%s: Bad Hdr or Bad CRC\n", __FUNCTION__)); ++ err = DBUS_ERR; ++ goto fail; ++ } ++ ++ } ++fail: ++ if (bulkchunk) ++ MFREE(osh, bulkchunk, dl_trunk_size); ++ ++ return err; ++} /* dbus_usb_dl_writeimage */ ++ ++/** Higher level DBUS layer (dbus.c) requests this layer to download image into dongle */ ++static int ++dbus_usb_dlstart(void *bus, uint8 *fw, int len) ++{ ++ usb_info_t *usbinfo = BUS_INFO(bus, usb_info_t); ++ int err; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ if (USB_DEV_ISBAD(usbinfo)) ++ return DBUS_ERR; ++ ++ err = dbus_usb_rdl_dwnld_state(usbinfo); ++ ++ if (DBUS_OK == err) { ++ err = dbus_usb_dl_writeimage(usbinfo, fw, len); ++ if (err == DBUS_OK) ++ usbinfo->pub->busstate = DBUS_STATE_DL_DONE; ++ else ++ usbinfo->pub->busstate = DBUS_STATE_DL_PENDING; ++ } else ++ usbinfo->pub->busstate = DBUS_STATE_DL_PENDING; ++ ++ return err; ++} ++ ++static bool ++dbus_usb_update_chipinfo(usb_info_t *usbinfo, uint32 chip) ++{ ++ bool retval = TRUE; ++ /* based on the CHIP Id, store the ram size which is needed for NVRAM download. */ ++ switch (chip) { ++ ++ case 0x4319: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_4319; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_4319; ++ break; ++ ++ case 0x4329: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_4329; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_4329; ++ break; ++ ++ case 43234: ++ case 43235: ++ case 43236: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_43236; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_43236; ++ break; ++ ++ case 0x4328: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_4328; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_4328; ++ break; ++ ++ case 0x4322: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_4322; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_4322; ++ break; ++ ++ case 0x4360: ++ case 0xAA06: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_4360; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_4360; ++ break; ++ ++ case 43242: ++ case 43243: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_43242; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_43242; ++ break; ++ ++ case 43143: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_43143; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_43143; ++ break; ++ ++ case 0x4350: ++ case 43556: ++ case 43558: ++ case 43569: ++ usbinfo->rdlram_size = RDL_RAM_SIZE_4350; ++ usbinfo->rdlram_base_addr = RDL_RAM_BASE_4350; ++ break; ++ ++ case POSTBOOT_ID: ++ break; ++ ++ default: ++ DBUSERR(("%s: Chip 0x%x Ram size is not known\n", __FUNCTION__, chip)); ++ retval = FALSE; ++ break; ++ ++ } ++ ++ return retval; ++} /* dbus_usb_update_chipinfo */ ++ ++/** higher DBUS level (dbus.c) wants to know if firmware download is required. */ ++static int ++dbus_usb_dlneeded(void *bus) ++{ ++ usb_info_t *usbinfo = BUS_INFO(bus, usb_info_t); ++ void *osinfo; ++ bootrom_id_t id; ++ int dl_needed = 1; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ osinfo = usbinfo->usbosl_info; ++ ASSERT(osinfo); ++ ++ /* Check if firmware downloaded already by querying runtime ID */ ++ id.chip = 0xDEAD; ++ dbus_usbos_dl_cmd(osinfo, DL_GETVER, &id, sizeof(bootrom_id_t)); ++ ++ id.chip = ltoh32(id.chip); ++ id.chiprev = ltoh32(id.chiprev); ++ ++ if (FALSE == dbus_usb_update_chipinfo(usbinfo, id.chip)) { ++ dl_needed = DBUS_ERR; ++ goto exit; ++ } ++ ++ DBUSERR(("%s: chip 0x%x rev 0x%x\n", __FUNCTION__, id.chip, id.chiprev)); ++ if (id.chip == POSTBOOT_ID) { ++ /* This code is needed to support two enumerations on USB1.1 scenario */ ++ DBUSERR(("%s: Firmware already downloaded\n", __FUNCTION__)); ++ ++ dbus_usbos_dl_cmd(osinfo, DL_RESETCFG, &id, sizeof(bootrom_id_t)); ++ dl_needed = DBUS_OK; ++ if (usbinfo->pub->busstate == DBUS_STATE_DL_PENDING) ++ usbinfo->pub->busstate = DBUS_STATE_DL_DONE; ++ } else { ++ usbinfo->pub->attrib.devid = id.chip; ++ usbinfo->pub->attrib.chiprev = id.chiprev; ++ } ++ ++exit: ++ return dl_needed; ++} ++ ++/** After issuing firmware download, higher DBUS level (dbus.c) wants to start the firmware. */ ++static int ++dbus_usb_dlrun(void *bus) ++{ ++ usb_info_t *usbinfo = BUS_INFO(bus, usb_info_t); ++ void *osinfo; ++ rdl_state_t state; ++ int err = DBUS_OK; ++ ++ DBUSTRACE(("%s\n", __FUNCTION__)); ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ if (USB_DEV_ISBAD(usbinfo)) ++ return DBUS_ERR; ++ ++ osinfo = usbinfo->usbosl_info; ++ ASSERT(osinfo); ++ ++ /* Check we are runnable */ ++ dbus_usbos_dl_cmd(osinfo, DL_GETSTATE, &state, sizeof(rdl_state_t)); ++ ++ state.state = ltoh32(state.state); ++ state.bytes = ltoh32(state.bytes); ++ ++ /* Start the image */ ++ if (state.state == DL_RUNNABLE) { ++ DBUSTRACE(("%s: Issue DL_GO\n", __FUNCTION__)); ++ dbus_usbos_dl_cmd(osinfo, DL_GO, &state, sizeof(rdl_state_t)); ++ ++ if (usbinfo->pub->attrib.devid == TEST_CHIP) ++ dbus_usbos_wait(osinfo, USB_DLGO_SPINWAIT); ++ ++// dbus_usb_resetcfg(usbinfo); ++ /* The Donlge may go for re-enumeration. */ ++ } else { ++ DBUSERR(("%s: Dongle not runnable\n", __FUNCTION__)); ++ err = DBUS_ERR; ++ } ++ ++ return err; ++} ++ ++/** ++ * As preparation for firmware download, higher DBUS level (dbus.c) requests the firmware image ++ * to be used for the type of dongle detected. Directly called by dbus.c (so not via a callback ++ * construction) ++ */ ++void ++dbus_bus_fw_get(void *bus, uint8 **fw, int *fwlen, int *decomp) ++{ ++ usb_info_t *usbinfo = BUS_INFO(bus, usb_info_t); ++ unsigned int devid; ++ unsigned int crev; ++ ++ devid = usbinfo->pub->attrib.devid; ++ crev = usbinfo->pub->attrib.chiprev; ++ ++ *fw = NULL; ++ *fwlen = 0; ++ ++ switch (devid) { ++ case BCM43236_CHIP_ID: ++ case BCM43235_CHIP_ID: ++ case BCM43234_CHIP_ID: ++ case BCM43238_CHIP_ID: { ++ if (crev == 3 || crev == 2 || crev == 1) { ++#ifdef EMBED_IMAGE_43236b ++ *fw = (uint8 *)dlarray_43236b; ++ *fwlen = sizeof(dlarray_43236b); ++ ++#endif ++ } ++ } break; ++ case BCM4360_CHIP_ID: ++ case BCM4352_CHIP_ID: ++ case BCM43526_CHIP_ID: ++#ifdef EMBED_IMAGE_43526a ++ if (crev <= 2) { ++ *fw = (uint8 *)dlarray_43526a; ++ *fwlen = sizeof(dlarray_43526a); ++ } ++#endif ++#ifdef EMBED_IMAGE_43526b ++ if (crev > 2) { ++ *fw = (uint8 *)dlarray_43526b; ++ *fwlen = sizeof(dlarray_43526b); ++ } ++#endif ++ break; ++ ++ case BCM43242_CHIP_ID: ++#ifdef EMBED_IMAGE_43242a0 ++ *fw = (uint8 *)dlarray_43242a0; ++ *fwlen = sizeof(dlarray_43242a0); ++#endif ++ break; ++ ++ case BCM43143_CHIP_ID: ++#ifdef EMBED_IMAGE_43143a0 ++ *fw = (uint8 *)dlarray_43143a0; ++ *fwlen = sizeof(dlarray_43143a0); ++#endif ++#ifdef EMBED_IMAGE_43143b0 ++ *fw = (uint8 *)dlarray_43143b0; ++ *fwlen = sizeof(dlarray_43143b0); ++#endif ++ break; ++ ++ case BCM4350_CHIP_ID: ++ case BCM4354_CHIP_ID: ++ case BCM43556_CHIP_ID: ++ case BCM43558_CHIP_ID: ++ case BCM43566_CHIP_ID: ++ case BCM43568_CHIP_ID: ++ case BCM43570_CHIP_ID: ++ case BCM4358_CHIP_ID: ++#ifdef EMBED_IMAGE_4350a0 ++ if (crev == 0) { ++ *fw = (uint8 *)dlarray_4350a0; ++ *fwlen = sizeof(dlarray_4350a0); ++ } ++#endif ++#ifdef EMBED_IMAGE_4350b0 ++ if (crev == 1) { ++ *fw = (uint8 *)dlarray_4350b0; ++ *fwlen = sizeof(dlarray_4350b0); ++ } ++#endif ++#ifdef EMBED_IMAGE_4350b1 ++ if (crev == 2) { ++ *fw = (uint8 *)dlarray_4350b1; ++ *fwlen = sizeof(dlarray_4350b1); ++ } ++#endif ++#ifdef EMBED_IMAGE_43556b1 ++ if (crev == 2) { ++ *fw = (uint8 *)dlarray_43556b1; ++ *fwlen = sizeof(dlarray_43556b1); ++ } ++#endif ++#ifdef EMBED_IMAGE_4350c0 ++ if (crev == 3) { ++ *fw = (uint8 *)dlarray_4350c0; ++ *fwlen = sizeof(dlarray_4350c0); ++ } ++#endif /* EMBED_IMAGE_4350c0 */ ++#ifdef EMBED_IMAGE_4350c1 ++ if (crev == 4) { ++ *fw = (uint8 *)dlarray_4350c1; ++ *fwlen = sizeof(dlarray_4350c1); ++ } ++#endif /* EMBED_IMAGE_4350c1 */ ++ break; ++ case BCM43569_CHIP_ID: ++#ifdef EMBED_IMAGE_43569a0 ++ if (crev == 0) { ++ *fw = (uint8 *)dlarray_43569a0; ++ *fwlen = sizeof(dlarray_43569a0); ++ } ++#endif /* EMBED_IMAGE_43569a0 */ ++ break; ++ default: ++#ifdef EMBED_IMAGE_GENERIC ++ *fw = (uint8 *)dlarray; ++ *fwlen = sizeof(dlarray); ++#endif ++ break; ++ } ++} /* dbus_bus_fw_get */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb_linux.c +new file mode 100644 +index 000000000000..8aa9646c8822 +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dbus_usb_linux.c +@@ -0,0 +1,3404 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Dongle BUS interface ++ * USB Linux Implementation ++ * ++ * Copyright (C) 1999-2016, Broadcom Corporation ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2 (the "GPL"), ++ * available at http://www.broadcom.com/licenses/GPLv2.php, with the ++ * following added to such license: ++ * ++ * As a special exception, the copyright holders of this software give you ++ * permission to link this software with independent modules, and to copy and ++ * distribute the resulting executable under terms of your choice, provided that ++ * you also meet, for each linked independent module, the terms and conditions of ++ * the license of that module. An independent module is a module which is not ++ * derived from this software. The special exception does not apply to any ++ * modifications of the software. ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a license ++ * other than the GPL, without Broadcom's express prior written consent. ++ * ++ * ++ * <> ++ * ++ * $Id: dbus_usb_linux.c 564663 2015-06-18 02:34:42Z $ ++ */ ++ ++/** ++ * @file @brief ++ * This file contains DBUS code that is USB *and* OS (Linux) specific. DBUS is a Broadcom ++ * proprietary host specific abstraction layer. ++ */ ++ ++#include ++#include ++ ++/** ++ * DBUS_LINUX_RXDPC is created for router platform performance tuning. A separate thread is created ++ * to handle USB RX and avoid the call chain getting too long and enhance cache hit rate. ++ * ++ * DBUS_LINUX_RXDPC setting is in wlconfig file. ++ */ ++ ++/* ++ * If DBUS_LINUX_RXDPC is off, spin_lock_bh() for CTFPOOL in ++ * linux_osl.c has to be changed to spin_lock_irqsave() because ++ * PKTGET/PKTFREE are no longer in bottom half. ++ * ++ * Right now we have another queue rpcq in wl_linux.c. Maybe we ++ * can eliminate that one to reduce the overhead. ++ * ++ * Enabling 2nd EP and DBUS_LINUX_RXDPC causing traffic from ++ * both EP's to be queued in the same rx queue. If we want ++ * RXDPC to work with 2nd EP. The EP for RPC call return ++ * should bypass the dpc and go directly up. ++ */ ++ ++/* #define DBUS_LINUX_RXDPC */ ++ ++/* Dbus histogram for ntxq, nrxq, dpc parameter tuning */ ++/* #define DBUS_LINUX_HIST */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#if defined(USBOS_THREAD) || defined(USBOS_TX_THREAD) ++ ++/** ++ * The usb-thread is designed to provide currency on multiprocessors and SMP linux kernels. On the ++ * dual cores platform, the WLAN driver, without threads, executed only on CPU0. The driver consumed ++ * almost of 100% on CPU0, while CPU1 remained idle. The behavior was observed on Broadcom's STB. ++ * ++ * The WLAN driver consumed most of CPU0 and not CPU1 because tasklets/queues, software irq, and ++ * hardware irq are executing from CPU0, only. CPU0 became the system's bottle-neck. TPUT is lower ++ * and system's responsiveness is slower. ++ * ++ * To improve system responsiveness and TPUT usb-thread was implemented. The system's threads could ++ * be scheduled to run on any core. One core could be processing data in the usb-layer and the other ++ * core could be processing data in the wl-layer. ++ * ++ * For further info see [WlThreadAndUsbThread] Twiki. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#endif /* USBOS_THREAD || USBOS_TX_THREAD */ ++ ++ ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) ++#define KERNEL26 ++#endif ++ ++/** ++ * Starting with the 3.10 kernel release, dynamic PM support for USB is present whenever ++ * the kernel was built with CONFIG_PM_RUNTIME enabled. The CONFIG_USB_SUSPEND option has ++ * been eliminated. ++ */ ++#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 21)) && defined(CONFIG_USB_SUSPEND)) \ ++ || ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && defined(CONFIG_PM_RUNTIME)) ++/* For USB power management support, see Linux kernel: Documentation/usb/power-management.txt */ ++#define USB_SUSPEND_AVAILABLE ++#endif ++ ++/* Define alternate fw/nvram paths used in Android */ ++#ifdef OEM_ANDROID ++#define CONFIG_ANDROID_BCMDHD_FW_PATH "broadcom/dhd/firmware/fw.bin.trx" ++#define CONFIG_ANDROID_BCMDHD_NVRAM_PATH "broadcom/dhd/nvrams/nvm.txt" ++#endif /* OEM_ANDROID */ ++ ++static inline int usb_submit_urb_linux(struct urb *urb) ++{ ++ ++#ifdef BCM_MAX_URB_LEN ++ if (urb && (urb->transfer_buffer_length > BCM_MAX_URB_LEN)) { ++ DBUSERR(("URB transfer length=%d exceeded %d ra=%p\n", urb->transfer_buffer_length, ++ BCM_MAX_URB_LEN, __builtin_return_address(0))); ++ return DBUS_ERR; ++ } ++#endif ++ ++#ifdef KERNEL26 ++ return usb_submit_urb(urb, GFP_ATOMIC); ++#else ++ return usb_submit_urb(urb); ++#endif ++ ++} ++ ++#define USB_SUBMIT_URB(urb) usb_submit_urb_linux(urb) ++ ++#ifdef KERNEL26 ++ ++#define USB_ALLOC_URB() usb_alloc_urb(0, GFP_ATOMIC) ++#define USB_UNLINK_URB(urb) (usb_kill_urb(urb)) ++#define USB_FREE_URB(urb) (usb_free_urb(urb)) ++#define USB_REGISTER() usb_register(&dbus_usbdev) ++#define USB_DEREGISTER() usb_deregister(&dbus_usbdev) ++ ++#ifdef USB_SUSPEND_AVAILABLE ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)) ++#define USB_AUTOPM_SET_INTERFACE(intf) usb_autopm_set_interface(intf) ++#else ++#define USB_ENABLE_AUTOSUSPEND(udev) usb_enable_autosuspend(udev) ++#define USB_DISABLE_AUTOSUSPEND(udev) usb_disable_autosuspend(udev) ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)) */ ++ ++#define USB_AUTOPM_GET_INTERFACE(intf) usb_autopm_get_interface(intf) ++#define USB_AUTOPM_PUT_INTERFACE(intf) usb_autopm_put_interface(intf) ++#define USB_AUTOPM_GET_INTERFACE_ASYNC(intf) usb_autopm_get_interface_async(intf) ++#define USB_AUTOPM_PUT_INTERFACE_ASYNC(intf) usb_autopm_put_interface_async(intf) ++#define USB_MARK_LAST_BUSY(dev) usb_mark_last_busy(dev) ++ ++#else /* USB_SUSPEND_AVAILABLE */ ++ ++#define USB_AUTOPM_GET_INTERFACE(intf) do {} while (0) ++#define USB_AUTOPM_PUT_INTERFACE(intf) do {} while (0) ++#define USB_AUTOPM_GET_INTERFACE_ASYNC(intf) do {} while (0) ++#define USB_AUTOPM_PUT_INTERFACE_ASYNC(intf) do {} while (0) ++#define USB_MARK_LAST_BUSY(dev) do {} while (0) ++#endif /* USB_SUSPEND_AVAILABLE */ ++ ++#define USB_CONTROL_MSG(dev, pipe, request, requesttype, value, index, data, size, timeout) \ ++ usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), \ ++ (data), (size), (timeout)) ++#define USB_BULK_MSG(dev, pipe, data, len, actual_length, timeout) \ ++ usb_bulk_msg((dev), (pipe), (data), (len), (actual_length), (timeout)) ++#define USB_BUFFER_ALLOC(dev, size, mem, dma) usb_buffer_alloc(dev, size, mem, dma) ++#define USB_BUFFER_FREE(dev, size, data, dma) usb_buffer_free(dev, size, data, dma) ++ ++#ifdef WL_URB_ZPKT ++#define URB_QUEUE_BULK URB_ZERO_PACKET ++#else ++#define URB_QUEUE_BULK 0 ++#endif /* WL_URB_ZPKT */ ++ ++#define CALLBACK_ARGS struct urb *urb, struct pt_regs *regs ++#define CALLBACK_ARGS_DATA urb, regs ++#define CONFIGDESC(usb) (&((usb)->actconfig)->desc) ++#define IFPTR(usb, idx) ((usb)->actconfig->interface[idx]) ++#define IFALTS(usb, idx) (IFPTR((usb), (idx))->altsetting[0]) ++#define IFDESC(usb, idx) IFALTS((usb), (idx)).desc ++#define IFEPDESC(usb, idx, ep) (IFALTS((usb), (idx)).endpoint[ep]).desc ++ ++#else /* KERNEL26 */ ++ ++#define USB_ALLOC_URB() usb_alloc_urb(0) ++#define USB_UNLINK_URB(urb) usb_unlink_urb(urb) ++#define USB_FREE_URB(urb) (usb_free_urb(urb)) ++#define USB_REGISTER() usb_register(&dbus_usbdev) ++#define USB_DEREGISTER() usb_deregister(&dbus_usbdev) ++#define USB_AUTOPM_GET_INTERFACE(intf) do {} while (0) ++#define USB_AUTOPM_GET_INTERFACE_ASYNC(intf) do {} while (0) ++#define USB_AUTOPM_PUT_INTERFACE_ASYNC(intf) do {} while (0) ++#define USB_MARK_LAST_BUSY(dev) do {} while (0) ++ ++#define USB_CONTROL_MSG(dev, pipe, request, requesttype, value, index, data, size, timeout) \ ++ usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), \ ++ (data), (size), (timeout)) ++#define USB_BUFFER_ALLOC(dev, size, mem, dma) kmalloc(size, mem) ++#define USB_BUFFER_FREE(dev, size, data, dma) kfree(data) ++ ++#ifdef WL_URB_ZPKT ++#define URB_QUEUE_BULK USB_QUEUE_BULK|URB_ZERO_PACKET ++#else ++#define URB_QUEUE_BULK 0 ++#endif /* WL_URB_ZPKT */ ++ ++#define CALLBACK_ARGS struct urb *urb ++#define CALLBACK_ARGS_DATA urb ++#define CONFIGDESC(usb) ((usb)->actconfig) ++#define IFPTR(usb, idx) (&(usb)->actconfig->interface[idx]) ++#define IFALTS(usb, idx) ((usb)->actconfig->interface[idx].altsetting[0]) ++#define IFDESC(usb, idx) IFALTS((usb), (idx)) ++#define IFEPDESC(usb, idx, ep) (IFALTS((usb), (idx)).endpoint[ep]) ++ ++ ++#endif /* KERNEL26 */ ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) ++#define USB_SPEED_SUPER 5 ++#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) */ ++ ++#define CONTROL_IF 0 ++#define BULK_IF 0 ++ ++#ifdef BCMUSBDEV_COMPOSITE ++#define USB_COMPIF_MAX 4 ++ ++#define USB_CLASS_WIRELESS 0xe0 ++#define USB_CLASS_MISC 0xef ++#define USB_SUBCLASS_COMMON 0x02 ++#define USB_PROTO_IAD 0x01 ++#define USB_PROTO_VENDOR 0xff ++ ++#define USB_QUIRK_NO_SET_INTF 0x04 /* device does not support set_interface */ ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ++#define USB_SYNC_WAIT_TIMEOUT 300 /* ms */ ++ ++/* Private data kept in skb */ ++#define SKB_PRIV(skb, idx) (&((void **)skb->cb)[idx]) ++#define SKB_PRIV_URB(skb) (*(struct urb **)SKB_PRIV(skb, 0)) ++ ++#ifndef DBUS_USB_RXQUEUE_BATCH_ADD ++/* items to add each time within limit */ ++#define DBUS_USB_RXQUEUE_BATCH_ADD 8 ++#endif ++ ++#ifndef DBUS_USB_RXQUEUE_LOWER_WATERMARK ++/* add a new batch req to rx queue when waiting item count reduce to this number */ ++#define DBUS_USB_RXQUEUE_LOWER_WATERMARK 4 ++#endif ++ ++enum usbos_suspend_state { ++ USBOS_SUSPEND_STATE_DEVICE_ACTIVE = 0, /* Device is busy, won't allow suspend */ ++ USBOS_SUSPEND_STATE_SUSPEND_PENDING, /* Device is idle, can be suspended */ ++ /* Wating PM to suspend */ ++ USBOS_SUSPEND_STATE_SUSPENDED /* Device suspended */ ++}; ++ ++enum usbos_request_state { ++ USBOS_REQUEST_STATE_UNSCHEDULED = 0, /* USB TX request not scheduled */ ++ USBOS_REQUEST_STATE_SCHEDULED, /* USB TX request given to TX thread */ ++ USBOS_REQUEST_STATE_SUBMITTED /* USB TX request submitted */ ++}; ++ ++typedef struct { ++ uint32 notification; ++ uint32 reserved; ++} intr_t; ++ ++typedef struct { ++ dbus_pub_t *pub; ++ ++ void *cbarg; ++ dbus_intf_callbacks_t *cbs; ++ ++ /* Imported */ ++ struct usb_device *usb; /* USB device pointer from OS */ ++ struct urb *intr_urb; /* URB for interrupt endpoint */ ++ struct list_head req_rxfreeq; ++ struct list_head req_txfreeq; ++ struct list_head req_rxpostedq; /* Posted down to USB driver for RX */ ++ struct list_head req_txpostedq; /* Posted down to USB driver for TX */ ++ spinlock_t rxfree_lock; /* Lock for rx free list */ ++ spinlock_t txfree_lock; /* Lock for tx free list */ ++ spinlock_t rxposted_lock; /* Lock for rx posted list */ ++ spinlock_t txposted_lock; /* Lock for tx posted list */ ++ uint rx_pipe, tx_pipe, intr_pipe, rx_pipe2; /* Pipe numbers for USB I/O */ ++ uint rxbuf_len; ++ ++ struct list_head req_rxpendingq; /* RXDPC: Pending for dpc to send up */ ++ spinlock_t rxpending_lock; /* RXDPC: Lock for rx pending list */ ++ long dpc_pid; ++ struct semaphore dpc_sem; ++ struct completion dpc_exited; ++ int rxpending; ++ ++ struct urb *ctl_urb; ++ int ctl_in_pipe, ctl_out_pipe; ++ struct usb_ctrlrequest ctl_write; ++ struct usb_ctrlrequest ctl_read; ++ struct semaphore ctl_lock; /* Lock for CTRL transfers via tx_thread */ ++#ifdef USBOS_TX_THREAD ++ enum usbos_request_state ctl_state; ++#endif /* USBOS_TX_THREAD */ ++ ++ spinlock_t rxlock; /* Lock for rxq management */ ++ spinlock_t txlock; /* Lock for txq management */ ++ ++ int intr_size; /* Size of interrupt message */ ++ int interval; /* Interrupt polling interval */ ++ intr_t intr; /* Data buffer for interrupt endpoint */ ++ ++ int maxps; ++ atomic_t txposted; ++ atomic_t rxposted; ++ atomic_t txallocated; ++ atomic_t rxallocated; ++ bool rxctl_deferrespok; /* Get a response for setup from dongle */ ++ ++ wait_queue_head_t wait; ++ bool waitdone; ++ int sync_urb_status; ++ ++ struct urb *blk_urb; /* Used for downloading embedded image */ ++ ++#ifdef USBOS_THREAD ++ spinlock_t ctrl_lock; ++ spinlock_t usbos_list_lock; ++ struct list_head usbos_list; ++ struct list_head usbos_free_list; ++ atomic_t usbos_list_cnt; ++ wait_queue_head_t usbos_queue_head; ++ struct task_struct *usbos_kt; ++#endif /* USBOS_THREAD */ ++ ++#ifdef USBOS_TX_THREAD ++ spinlock_t usbos_tx_list_lock; ++ struct list_head usbos_tx_list; ++ wait_queue_head_t usbos_tx_queue_head; ++ struct task_struct *usbos_tx_kt; ++#endif /* USBOS_TX_THREAD */ ++ ++ struct dma_pool *qtd_pool; /* QTD pool for USB optimization only */ ++ int tx_ep, rx_ep, rx2_ep; /* EPs for USB optimization */ ++ struct usb_device *usb_device; /* USB device for optimization */ ++} usbos_info_t; ++ ++typedef struct urb_req { ++ void *pkt; ++ int buf_len; ++ struct urb *urb; ++ void *arg; ++ usbos_info_t *usbinfo; ++ struct list_head urb_list; ++} urb_req_t; ++ ++#ifdef USBOS_THREAD ++typedef struct usbos_list_entry { ++ struct list_head list; /* must be first */ ++ void *urb_context; ++ int urb_length; ++ int urb_status; ++} usbos_list_entry_t; ++ ++static void* dbus_usbos_thread_init(usbos_info_t *usbos_info); ++static void dbus_usbos_thread_deinit(usbos_info_t *usbos_info); ++static void dbus_usbos_dispatch_schedule(CALLBACK_ARGS); ++static int dbus_usbos_thread_func(void *data); ++#endif /* USBOS_THREAD */ ++ ++#ifdef USBOS_TX_THREAD ++void* dbus_usbos_tx_thread_init(usbos_info_t *usbos_info); ++void dbus_usbos_tx_thread_deinit(usbos_info_t *usbos_info); ++int dbus_usbos_tx_thread_func(void *data); ++#endif /* USBOS_TX_THREAD */ ++ ++/* Shared Function prototypes */ ++bool dbus_usbos_dl_cmd(usbos_info_t *usbinfo, uint8 cmd, void *buffer, int buflen); ++int dbus_usbos_wait(usbos_info_t *usbinfo, uint16 ms); ++bool dbus_usbos_dl_send_bulk(usbos_info_t *usbinfo, void *buffer, int len); ++int dbus_write_membytes(usbos_info_t *usbinfo, bool set, uint32 address, uint8 *data, uint size); ++ ++/* Local function prototypes */ ++static void dbus_usbos_send_complete(CALLBACK_ARGS); ++static void dbus_usbos_recv_complete(CALLBACK_ARGS); ++static int dbus_usbos_errhandler(void *bus, int err); ++static int dbus_usbos_state_change(void *bus, int state); ++static void dbusos_stop(usbos_info_t *usbos_info); ++ ++#ifdef KERNEL26 ++static int dbus_usbos_probe(struct usb_interface *intf, const struct usb_device_id *id); ++static void dbus_usbos_disconnect(struct usb_interface *intf); ++#if defined(USB_SUSPEND_AVAILABLE) ++static int dbus_usbos_resume(struct usb_interface *intf); ++static int dbus_usbos_suspend(struct usb_interface *intf, pm_message_t message); ++/* at the moment, used for full dongle host driver only */ ++static int dbus_usbos_reset_resume(struct usb_interface *intf); ++#endif /* USB_SUSPEND_AVAILABLE */ ++#else /* KERNEL26 */ ++static void *dbus_usbos_probe(struct usb_device *usb, unsigned int ifnum, ++ const struct usb_device_id *id); ++static void dbus_usbos_disconnect(struct usb_device *usb, void *ptr); ++#endif /* KERNEL26 */ ++ ++ ++/** ++ * have to disable missing-field-initializers warning as last element {} triggers it ++ * and different versions of kernel have different number of members so it is impossible ++ * to specify the initializer. BTW issuing the warning here is bug og GCC as universal ++ * zero {0} specified in C99 standard as correct way of initialization of struct to all zeros ++ */ ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \ ++ 4 && __GNUC_MINOR__ >= 6)) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wmissing-field-initializers" ++#endif ++ ++static struct usb_device_id devid_table[] = { ++ { USB_DEVICE(BCM_DNGL_VID, 0x0000) }, /* Configurable via register() */ ++#if defined(BCM_REQUEST_FW) ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_4328) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_4322) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_4319) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_43236) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_43143) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_43242) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_4360) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_4350) }, ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BL_PID_43569) }, ++#endif ++#ifdef EXTENDED_VID_PID ++ EXTENDED_VID_PID, ++#endif /* EXTENDED_VID_PID */ ++ { USB_DEVICE(BCM_DNGL_VID, BCM_DNGL_BDC_PID) }, /* Default BDC */ ++ { } ++}; ++ ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \ ++ 4 && __GNUC_MINOR__ >= 6)) ++#pragma GCC diagnostic pop ++#endif ++ ++MODULE_DEVICE_TABLE(usb, devid_table); ++ ++/** functions called by the Linux kernel USB subsystem */ ++static struct usb_driver dbus_usbdev = { ++ name: "dbus_usbdev", ++ probe: dbus_usbos_probe, ++ disconnect: dbus_usbos_disconnect, ++ id_table: devid_table, ++#if defined(USB_SUSPEND_AVAILABLE) ++ suspend: dbus_usbos_suspend, ++ resume: dbus_usbos_resume, ++ reset_resume: dbus_usbos_reset_resume, ++ /* Linux USB core will allow autosuspend for devices bound to this driver */ ++ supports_autosuspend: 1 ++#endif /* USB_SUSPEND_AVAILABLE */ ++}; ++ ++/** ++ * This stores USB info during Linux probe callback since attach() is not called yet at this point ++ */ ++typedef struct { ++ void *usbos_info; ++ struct usb_device *usb; /* USB device pointer from OS */ ++ uint rx_pipe; /* Pipe numbers for USB I/O */ ++ uint tx_pipe; /* Pipe numbers for USB I/O */ ++ uint intr_pipe; /* Pipe numbers for USB I/O */ ++ uint rx_pipe2; /* Pipe numbers for USB I/O */ ++ int intr_size; /* Size of interrupt message */ ++ int interval; /* Interrupt polling interval */ ++ bool dldone; ++ int vid; ++ int pid; ++ bool dereged; ++ bool disc_cb_done; ++ DEVICE_SPEED device_speed; ++ enum usbos_suspend_state suspend_state; ++ struct usb_interface *intf; ++} probe_info_t; ++ ++/* ++ * USB Linux dbus_intf_t ++ */ ++static void *dbus_usbos_intf_attach(dbus_pub_t *pub, void *cbarg, dbus_intf_callbacks_t *cbs); ++static void dbus_usbos_intf_detach(dbus_pub_t *pub, void *info); ++static int dbus_usbos_intf_send_irb(void *bus, dbus_irb_tx_t *txirb); ++static int dbus_usbos_intf_recv_irb(void *bus, dbus_irb_rx_t *rxirb); ++static int dbus_usbos_intf_recv_irb_from_ep(void *bus, dbus_irb_rx_t *rxirb, uint32 ep_idx); ++static int dbus_usbos_intf_cancel_irb(void *bus, dbus_irb_tx_t *txirb); ++static int dbus_usbos_intf_send_ctl(void *bus, uint8 *buf, int len); ++static int dbus_usbos_intf_recv_ctl(void *bus, uint8 *buf, int len); ++static int dbus_usbos_intf_get_attrib(void *bus, dbus_attrib_t *attrib); ++static int dbus_usbos_intf_up(void *bus); ++static int dbus_usbos_intf_down(void *bus); ++static int dbus_usbos_intf_stop(void *bus); ++static int dbus_usbos_readreg(void *bus, uint32 regaddr, int datalen, uint32 *value); ++extern int dbus_usbos_loopback_tx(void *usbos_info_ptr, int cnt, int size); ++int dbus_usbos_writereg(void *bus, uint32 regaddr, int datalen, uint32 data); ++static int dbus_usbos_intf_set_config(void *bus, dbus_config_t *config); ++static bool dbus_usbos_intf_recv_needed(void *bus); ++static void *dbus_usbos_intf_exec_rxlock(void *bus, exec_cb_t cb, struct exec_parms *args); ++static void *dbus_usbos_intf_exec_txlock(void *bus, exec_cb_t cb, struct exec_parms *args); ++#ifdef BCMUSBDEV_COMPOSITE ++static int dbus_usbos_intf_wlan(struct usb_device *usb); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ++/** functions called by dbus_usb.c */ ++static dbus_intf_t dbus_usbos_intf = { ++ .attach = dbus_usbos_intf_attach, ++ .detach = dbus_usbos_intf_detach, ++ .up = dbus_usbos_intf_up, ++ .down = dbus_usbos_intf_down, ++ .send_irb = dbus_usbos_intf_send_irb, ++ .recv_irb = dbus_usbos_intf_recv_irb, ++ .cancel_irb = dbus_usbos_intf_cancel_irb, ++ .send_ctl = dbus_usbos_intf_send_ctl, ++ .recv_ctl = dbus_usbos_intf_recv_ctl, ++ .get_stats = NULL, ++ .get_attrib = dbus_usbos_intf_get_attrib, ++ .remove = NULL, ++ .resume = NULL, ++ .suspend = NULL, ++ .stop = dbus_usbos_intf_stop, ++ .reset = NULL, ++ .pktget = NULL, ++ .pktfree = NULL, ++ .iovar_op = NULL, ++ .dump = NULL, ++ .set_config = dbus_usbos_intf_set_config, ++ .get_config = NULL, ++ .device_exists = NULL, ++ .dlneeded = NULL, ++ .dlstart = NULL, ++ .dlrun = NULL, ++ .recv_needed = dbus_usbos_intf_recv_needed, ++ .exec_rxlock = dbus_usbos_intf_exec_rxlock, ++ .exec_txlock = dbus_usbos_intf_exec_txlock, ++ ++ .tx_timer_init = NULL, ++ .tx_timer_start = NULL, ++ .tx_timer_stop = NULL, ++ ++ .sched_dpc = NULL, ++ .lock = NULL, ++ .unlock = NULL, ++ .sched_probe_cb = NULL, ++ ++ .shutdown = NULL, ++ ++ .recv_stop = NULL, ++ .recv_resume = NULL, ++ ++ .recv_irb_from_ep = dbus_usbos_intf_recv_irb_from_ep, ++ .readreg = dbus_usbos_readreg ++}; ++ ++static probe_info_t g_probe_info; ++static probe_cb_t probe_cb = NULL; ++static disconnect_cb_t disconnect_cb = NULL; ++static void *probe_arg = NULL; ++static void *disc_arg = NULL; ++ ++ ++ ++static volatile int loopback_rx_cnt, loopback_tx_cnt; ++int loopback_size; ++bool is_loopback_pkt(void *buf); ++int matches_loopback_pkt(void *buf); ++ ++/** ++ * multiple code paths in this file dequeue a URB request, this function makes sure that it happens ++ * in a concurrency save manner. Don't call this from a sleepable process context. ++ */ ++static urb_req_t * BCMFASTPATH ++dbus_usbos_qdeq(struct list_head *urbreq_q, spinlock_t *lock) ++{ ++ unsigned long flags; ++ urb_req_t *req; ++ ++ ASSERT(urbreq_q != NULL); ++ ++ spin_lock_irqsave(lock, flags); ++ ++ if (list_empty(urbreq_q)) { ++ req = NULL; ++ } else { ++ ASSERT(urbreq_q->next != NULL); ++ ASSERT(urbreq_q->next != urbreq_q); ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wcast-qual" ++#endif ++ req = list_entry(urbreq_q->next, urb_req_t, urb_list); ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic pop ++#endif ++ list_del_init(&req->urb_list); ++ } ++ ++ spin_unlock_irqrestore(lock, flags); ++ ++ return req; ++} ++ ++static void BCMFASTPATH ++dbus_usbos_qenq(struct list_head *urbreq_q, urb_req_t *req, spinlock_t *lock) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(lock, flags); ++ ++ list_add_tail(&req->urb_list, urbreq_q); ++ ++ spin_unlock_irqrestore(lock, flags); ++} ++ ++/** ++ * multiple code paths in this file remove a URB request from a list, this function makes sure that ++ * it happens in a concurrency save manner. Don't call this from a sleepable process context. ++ * Is quite similar to dbus_usbos_qdeq(), I wonder why this function is needed. ++ */ ++static void ++dbus_usbos_req_del(urb_req_t *req, spinlock_t *lock) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(lock, flags); ++ ++ list_del_init(&req->urb_list); ++ ++ spin_unlock_irqrestore(lock, flags); ++} ++ ++ ++/** ++ * Driver requires a pool of URBs to operate. This function is called during ++ * initialization (attach phase), allocates a number of URBs, and puts them ++ * on the free (req_rxfreeq and req_txfreeq) queue ++ */ ++static int ++dbus_usbos_urbreqs_alloc(usbos_info_t *usbos_info, uint32 count, bool is_rx) ++{ ++ int i; ++ int allocated = 0; ++ int err = DBUS_OK; ++ ++ for (i = 0; i < count; i++) { ++ urb_req_t *req; ++ ++ req = MALLOC(usbos_info->pub->osh, sizeof(urb_req_t)); ++ if (req == NULL) { ++ DBUSERR(("%s: MALLOC req failed\n", __FUNCTION__)); ++ err = DBUS_ERR_NOMEM; ++ goto fail; ++ } ++ bzero(req, sizeof(urb_req_t)); ++ ++ req->urb = USB_ALLOC_URB(); ++ if (req->urb == NULL) { ++ DBUSERR(("%s: USB_ALLOC_URB req->urb failed\n", __FUNCTION__)); ++ err = DBUS_ERR_NOMEM; ++ goto fail; ++ } ++ ++ INIT_LIST_HEAD(&req->urb_list); ++ ++ if (is_rx) { ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ /* don't allocate now. Do it on demand */ ++ req->pkt = NULL; ++#else ++ /* pre-allocate buffers never to be released */ ++ req->pkt = MALLOC(usbos_info->pub->osh, usbos_info->rxbuf_len); ++ if (req->pkt == NULL) { ++ DBUSERR(("%s: MALLOC req->pkt failed\n", __FUNCTION__)); ++ err = DBUS_ERR_NOMEM; ++ goto fail; ++ } ++#endif ++ req->buf_len = usbos_info->rxbuf_len; ++ dbus_usbos_qenq(&usbos_info->req_rxfreeq, req, &usbos_info->rxfree_lock); ++ } else { ++ req->buf_len = 0; ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req, &usbos_info->txfree_lock); ++ } ++ allocated++; ++ continue; ++ ++fail: ++ if (req) { ++ if (is_rx && req->pkt) { ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ /* req->pkt is NULL in "NOCOPY" mode */ ++#else ++ MFREE(usbos_info->pub->osh, req->pkt, req->buf_len); ++#endif ++ } ++ if (req->urb) { ++ USB_FREE_URB(req->urb); ++ } ++ MFREE(usbos_info->pub->osh, req, sizeof(urb_req_t)); ++ } ++ break; ++ } ++ ++ atomic_add(allocated, is_rx ? &usbos_info->rxallocated : &usbos_info->txallocated); ++ ++ if (is_rx) { ++ DBUSTRACE(("%s: add %d (total %d) rx buf, each has %d bytes\n", __FUNCTION__, ++ allocated, atomic_read(&usbos_info->rxallocated), usbos_info->rxbuf_len)); ++ } else { ++ DBUSTRACE(("%s: add %d (total %d) tx req\n", __FUNCTION__, ++ allocated, atomic_read(&usbos_info->txallocated))); ++ } ++ ++ return err; ++} /* dbus_usbos_urbreqs_alloc */ ++ ++/** Typically called during detach or when attach failed. Don't call until all URBs unlinked */ ++static int ++dbus_usbos_urbreqs_free(usbos_info_t *usbos_info, bool is_rx) ++{ ++ int rtn = 0; ++ urb_req_t *req; ++ struct list_head *req_q; ++ spinlock_t *lock; ++ ++ if (is_rx) { ++ req_q = &usbos_info->req_rxfreeq; ++ lock = &usbos_info->rxfree_lock; ++ } else { ++ req_q = &usbos_info->req_txfreeq; ++ lock = &usbos_info->txfree_lock; ++ } ++ while ((req = dbus_usbos_qdeq(req_q, lock)) != NULL) { ++ ++ if (is_rx) { ++ if (req->pkt) { ++ /* We do MFREE instead of PKTFREE because the pkt has been ++ * converted to native already ++ */ ++ MFREE(usbos_info->pub->osh, req->pkt, req->buf_len); ++ req->pkt = NULL; ++ req->buf_len = 0; ++ } ++ } else { ++ /* sending req should not be assigned pkt buffer */ ++ ASSERT(req->pkt == NULL); ++ } ++ ++ if (req->urb) { ++ USB_FREE_URB(req->urb); ++ req->urb = NULL; ++ } ++ MFREE(usbos_info->pub->osh, req, sizeof(urb_req_t)); ++ ++ rtn++; ++ } ++ return rtn; ++} /* dbus_usbos_urbreqs_free */ ++ ++/** ++ * called by Linux kernel on URB completion. Upper DBUS layer (dbus_usb.c) has to be notified of ++ * send completion. ++ */ ++void ++dbus_usbos_send_complete(CALLBACK_ARGS) ++{ ++ urb_req_t *req = urb->context; ++ dbus_irb_tx_t *txirb = req->arg; ++ usbos_info_t *usbos_info = req->usbinfo; ++ unsigned long flags; ++ int status = DBUS_OK; ++ int txposted; ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++ ++ spin_lock_irqsave(&usbos_info->txlock, flags); ++ ++ dbus_usbos_req_del(req, &usbos_info->txposted_lock); ++ txposted = atomic_dec_return(&usbos_info->txposted); ++ if (unlikely (txposted < 0)) { ++ DBUSERR(("%s ERROR: txposted is negative (%d)!!\n", __FUNCTION__, txposted)); ++ } ++ spin_unlock_irqrestore(&usbos_info->txlock, flags); ++ ++ if (unlikely (urb->status)) { ++ status = DBUS_ERR_TXFAIL; ++ DBUSTRACE(("txfail status %d\n", urb->status)); ++ } ++ ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ /* sending req should not be assigned pkt buffer */ ++ ASSERT(req->pkt == NULL); ++#endif ++ /* txirb should always be set, except for ZLP. ZLP is reusing this callback function. */ ++ if (txirb != NULL) { ++ if (txirb->send_buf != NULL) { ++ MFREE(usbos_info->pub->osh, txirb->send_buf, req->buf_len); ++ txirb->send_buf = NULL; ++ req->buf_len = 0; ++ } ++ if (likely (usbos_info->cbarg && usbos_info->cbs)) { ++ if (likely (usbos_info->cbs->send_irb_complete != NULL)) ++ usbos_info->cbs->send_irb_complete(usbos_info->cbarg, txirb, status); ++ } ++ } ++ ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req, &usbos_info->txfree_lock); ++} /* dbus_usbos_send_complete */ ++ ++/** ++ * In order to receive USB traffic from the dongle, we need to supply the Linux kernel with a free ++ * URB that is going to contain received data. ++ */ ++static int BCMFASTPATH ++dbus_usbos_recv_urb_submit(usbos_info_t *usbos_info, dbus_irb_rx_t *rxirb, uint32 ep_idx) ++{ ++ urb_req_t *req; ++ int ret = DBUS_OK; ++ unsigned long flags; ++ void *p; ++ uint rx_pipe; ++ int rxposted; ++ ++ BCM_REFERENCE(rxposted); ++ ++ if (!(req = dbus_usbos_qdeq(&usbos_info->req_rxfreeq, &usbos_info->rxfree_lock))) { ++ DBUSTRACE(("%s No free URB!\n", __FUNCTION__)); ++ return DBUS_ERR_RXDROP; ++ } ++ ++ spin_lock_irqsave(&usbos_info->rxlock, flags); ++ ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ req->pkt = rxirb->pkt = PKTGET(usbos_info->pub->osh, req->buf_len, FALSE); ++ if (!rxirb->pkt) { ++ DBUSERR(("%s: PKTGET failed\n", __FUNCTION__)); ++ dbus_usbos_qenq(&usbos_info->req_rxfreeq, req, &usbos_info->rxfree_lock); ++ ret = DBUS_ERR_RXDROP; ++ goto fail; ++ } ++ /* consider the packet "native" so we don't count it as MALLOCED in the osl */ ++ PKTTONATIVE(usbos_info->pub->osh, req->pkt); ++ rxirb->buf = NULL; ++ p = PKTDATA(usbos_info->pub->osh, req->pkt); ++#else ++ if (req->buf_len != usbos_info->rxbuf_len) { ++ ASSERT(req->pkt); ++ MFREE(usbos_info->pub->osh, req->pkt, req->buf_len); ++ DBUSTRACE(("%s: replace rx buff: old len %d, new len %d\n", __FUNCTION__, ++ req->buf_len, usbos_info->rxbuf_len)); ++ req->buf_len = 0; ++ req->pkt = MALLOC(usbos_info->pub->osh, usbos_info->rxbuf_len); ++ if (req->pkt == NULL) { ++ DBUSERR(("%s: MALLOC req->pkt failed\n", __FUNCTION__)); ++ ret = DBUS_ERR_NOMEM; ++ goto fail; ++ } ++ req->buf_len = usbos_info->rxbuf_len; ++ } ++ rxirb->buf = req->pkt; ++ p = rxirb->buf; ++#endif /* defined(BCM_RPC_NOCOPY) */ ++ rxirb->buf_len = req->buf_len; ++ req->usbinfo = usbos_info; ++ req->arg = rxirb; ++ if (ep_idx == 0) { ++ rx_pipe = usbos_info->rx_pipe; ++ } else { ++ rx_pipe = usbos_info->rx_pipe2; ++ ASSERT(usbos_info->rx_pipe2); ++ } ++ /* Prepare the URB */ ++ usb_fill_bulk_urb(req->urb, usbos_info->usb, rx_pipe, ++ p, ++ rxirb->buf_len, ++ (usb_complete_t)dbus_usbos_recv_complete, req); ++ req->urb->transfer_flags |= URB_QUEUE_BULK; ++ ++ if ((ret = USB_SUBMIT_URB(req->urb))) { ++ DBUSERR(("%s USB_SUBMIT_URB failed. status %d\n", __FUNCTION__, ret)); ++ dbus_usbos_qenq(&usbos_info->req_rxfreeq, req, &usbos_info->rxfree_lock); ++ ret = DBUS_ERR_RXFAIL; ++ goto fail; ++ } ++ rxposted = atomic_inc_return(&usbos_info->rxposted); ++ ++ dbus_usbos_qenq(&usbos_info->req_rxpostedq, req, &usbos_info->rxposted_lock); ++fail: ++ spin_unlock_irqrestore(&usbos_info->rxlock, flags); ++ return ret; ++} /* dbus_usbos_recv_urb_submit */ ++ ++ ++/** ++ * Called by worked thread when a 'receive URB' completed or Linux kernel when it returns a URB to ++ * this driver. ++ */ ++static void BCMFASTPATH ++dbus_usbos_recv_complete_handle(urb_req_t *req, int len, int status) ++{ ++ dbus_irb_rx_t *rxirb = req->arg; ++ usbos_info_t *usbos_info = req->usbinfo; ++ unsigned long flags; ++ int rxallocated, rxposted; ++ int dbus_status = DBUS_OK; ++ bool killed = (g_probe_info.suspend_state == USBOS_SUSPEND_STATE_SUSPEND_PENDING) ? 1 : 0; ++ ++ spin_lock_irqsave(&usbos_info->rxlock, flags); ++ dbus_usbos_req_del(req, &usbos_info->rxposted_lock); ++ rxposted = atomic_dec_return(&usbos_info->rxposted); ++ rxallocated = atomic_read(&usbos_info->rxallocated); ++ spin_unlock_irqrestore(&usbos_info->rxlock, flags); ++ ++ if ((rxallocated < usbos_info->pub->nrxq) && (!status) && ++ (rxposted == DBUS_USB_RXQUEUE_LOWER_WATERMARK)) { ++ DBUSTRACE(("%s: need more rx buf: rxallocated %d rxposted %d!\n", ++ __FUNCTION__, rxallocated, rxposted)); ++ dbus_usbos_urbreqs_alloc(usbos_info, ++ MIN(DBUS_USB_RXQUEUE_BATCH_ADD, ++ usbos_info->pub->nrxq - rxallocated), TRUE); ++ } ++ ++ /* Handle errors */ ++ if (status) { ++ /* ++ * Linux 2.4 disconnect: -ENOENT or -EILSEQ for CRC error; rmmod: -ENOENT ++ * Linux 2.6 disconnect: -EPROTO, rmmod: -ESHUTDOWN ++ */ ++ if ((status == -ENOENT && (!killed))|| status == -ESHUTDOWN) { ++ /* NOTE: unlink() can not be called from URB callback(). ++ * Do not call dbusos_stop() here. ++ */ ++ DBUSTRACE(("%s rx error %d\n", __FUNCTION__, status)); ++ dbus_usbos_state_change(usbos_info, DBUS_STATE_DOWN); ++ } else if (status == -EPROTO) { ++ DBUSTRACE(("%s rx error %d\n", __FUNCTION__, status)); ++ } else if (killed && (status == -EHOSTUNREACH || status == -ENOENT)) { ++ /* Device is suspended */ ++ } else { ++ DBUSTRACE(("%s rx error %d\n", __FUNCTION__, status)); ++ dbus_usbos_errhandler(usbos_info, DBUS_ERR_RXFAIL); ++ } ++ ++ /* On error, don't submit more URBs yet */ ++ rxirb->buf = NULL; ++ rxirb->actual_len = 0; ++ dbus_status = DBUS_ERR_RXFAIL; ++ goto fail; ++ } ++ ++ /* Make the skb represent the received urb */ ++ rxirb->actual_len = len; ++ ++ if (rxirb->actual_len < sizeof(uint32)) { ++ DBUSTRACE(("small pkt len %d, process as ZLP\n", rxirb->actual_len)); ++ dbus_status = DBUS_ERR_RXZLP; ++ } ++ ++fail: ++#if defined(BCM_RPC_NOCOPY) || defined(BCM_RPC_RXNOCOPY) ++ /* detach the packet from the queue */ ++ req->pkt = NULL; ++#endif /* BCM_RPC_NOCOPY || BCM_RPC_RXNOCOPY */ ++ ++ if (usbos_info->cbarg && usbos_info->cbs) { ++ if (usbos_info->cbs->recv_irb_complete) { ++ usbos_info->cbs->recv_irb_complete(usbos_info->cbarg, rxirb, dbus_status); ++ } ++ } ++ ++ dbus_usbos_qenq(&usbos_info->req_rxfreeq, req, &usbos_info->rxfree_lock); ++ ++ /* Mark the interface as busy to reset USB autosuspend timer */ ++ USB_MARK_LAST_BUSY(usbos_info->usb); ++} /* dbus_usbos_recv_complete_handle */ ++ ++/** called by Linux kernel when it returns a URB to this driver */ ++static void ++dbus_usbos_recv_complete(CALLBACK_ARGS) ++{ ++#ifdef USBOS_THREAD ++ dbus_usbos_dispatch_schedule(CALLBACK_ARGS_DATA); ++#else /* !USBOS_THREAD */ ++ dbus_usbos_recv_complete_handle(urb->context, urb->actual_length, urb->status); ++#endif /* USBOS_THREAD */ ++} ++ ++ ++/** ++ * If Linux notifies our driver that a control read or write URB has completed, we should notify ++ * the DBUS layer above us (dbus_usb.c in this case). ++ */ ++static void ++dbus_usbos_ctl_complete(usbos_info_t *usbos_info, int type, int urbstatus) ++{ ++ int status = DBUS_ERR; ++ ++ if (usbos_info == NULL) ++ return; ++ ++ switch (urbstatus) { ++ case 0: ++ status = DBUS_OK; ++ break; ++ case -EINPROGRESS: ++ case -ENOENT: ++ default: ++#ifdef INTR_EP_ENABLE ++ DBUSERR(("%s:%d fail status %d bus:%d susp:%d intr:%d ctli:%d ctlo:%d\n", ++ __FUNCTION__, type, urbstatus, ++ usbos_info->pub->busstate, g_probe_info.suspend_state, ++ usbos_info->intr_urb_submitted, usbos_info->ctlin_urb_submitted, ++ usbos_info->ctlout_urb_submitted)); ++#else ++ DBUSERR(("%s: failed with status %d\n", __FUNCTION__, urbstatus)); ++ status = DBUS_ERR; ++ break; ++#endif /* INTR_EP_ENABLE */ ++ } ++ ++ if (usbos_info->cbarg && usbos_info->cbs) { ++ if (usbos_info->cbs->ctl_complete) ++ usbos_info->cbs->ctl_complete(usbos_info->cbarg, type, status); ++ } ++} ++ ++/** called by Linux */ ++static void ++dbus_usbos_ctlread_complete(CALLBACK_ARGS) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *)urb->context; ++ ++ ASSERT(urb); ++ usbos_info = (usbos_info_t *)urb->context; ++ ++ dbus_usbos_ctl_complete(usbos_info, DBUS_CBCTL_READ, urb->status); ++ ++#ifdef USBOS_THREAD ++ if (usbos_info->rxctl_deferrespok) { ++ usbos_info->ctl_read.bRequestType = USB_DIR_IN | USB_TYPE_CLASS | ++ USB_RECIP_INTERFACE; ++ usbos_info->ctl_read.bRequest = 1; ++ } ++#endif ++ ++ up(&usbos_info->ctl_lock); ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++} ++ ++/** called by Linux */ ++static void ++dbus_usbos_ctlwrite_complete(CALLBACK_ARGS) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *)urb->context; ++ ++ ASSERT(urb); ++ usbos_info = (usbos_info_t *)urb->context; ++ ++ dbus_usbos_ctl_complete(usbos_info, DBUS_CBCTL_WRITE, urb->status); ++ ++#ifdef USBOS_TX_THREAD ++ usbos_info->ctl_state = USBOS_REQUEST_STATE_UNSCHEDULED; ++#endif /* USBOS_TX_THREAD */ ++ ++ up(&usbos_info->ctl_lock); ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++} ++ ++#ifdef INTR_EP_ENABLE ++/** called by Linux */ ++static void ++dbus_usbos_intr_complete(CALLBACK_ARGS) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *)urb->context; ++ bool killed = (g_probe_info.suspend_state == USBOS_SUSPEND_STATE_SUSPEND_PENDING) ? 1 : 0; ++ ++ if (usbos_info == NULL || usbos_info->pub == NULL) ++ return; ++ if ((urb->status == -ENOENT && (!killed)) || urb->status == -ESHUTDOWN || ++ urb->status == -ENODEV) { ++ dbus_usbos_state_change(usbos_info, DBUS_STATE_DOWN); ++ } ++ ++ if (usbos_info->pub->busstate == DBUS_STATE_DOWN) { ++ DBUSERR(("%s: intr cb when DBUS down, ignoring\n", __FUNCTION__)); ++ return; ++ } ++ dbus_usbos_ctl_complete(usbos_info, DBUS_CBINTR_POLL, urb->status); ++} ++#endif /* INTR_EP_ENABLE */ ++ ++/** ++ * when the bus is going to sleep or halt, the Linux kernel requires us to take ownership of our ++ * URBs again. Multiple code paths in this file require a list of URBs to be cancelled in a ++ * concurrency save manner. ++ */ ++static void ++dbus_usbos_unlink(struct list_head *urbreq_q, spinlock_t *lock) ++{ ++ urb_req_t *req; ++ ++ /* dbus_usbos_recv_complete() adds req back to req_freeq */ ++ while ((req = dbus_usbos_qdeq(urbreq_q, lock)) != NULL) { ++ ASSERT(req->urb != NULL); ++ USB_UNLINK_URB(req->urb); ++ } ++} ++ ++/** multiple code paths in this file require the bus to stop */ ++static void ++dbus_usbos_cancel_all_urbs(usbos_info_t *usbos_info) ++{ ++ int rxposted, txposted; ++ ++ DBUSTRACE(("%s: unlink all URBs\n", __FUNCTION__)); ++ ++#ifdef USBOS_TX_THREAD ++ usbos_info->ctl_state = USBOS_REQUEST_STATE_UNSCHEDULED; ++ ++ /* Yield the CPU to TX thread so all pending requests are submitted */ ++ while (!list_empty(&usbos_info->usbos_tx_list)) { ++ wake_up_interruptible(&usbos_info->usbos_tx_queue_head); ++ OSL_SLEEP(10); ++ } ++#endif /* USBOS_TX_THREAD */ ++ ++ /* tell Linux kernel to cancel a single intr, ctl and blk URB */ ++ if (usbos_info->intr_urb) ++ USB_UNLINK_URB(usbos_info->intr_urb); ++ if (usbos_info->ctl_urb) ++ USB_UNLINK_URB(usbos_info->ctl_urb); ++ if (usbos_info->blk_urb) ++ USB_UNLINK_URB(usbos_info->blk_urb); ++ ++ dbus_usbos_unlink(&usbos_info->req_txpostedq, &usbos_info->txposted_lock); ++ dbus_usbos_unlink(&usbos_info->req_rxpostedq, &usbos_info->rxposted_lock); ++ ++ /* Wait until the callbacks for all submitted URBs have been called, because the ++ * handler needs to know is an USB suspend is in progress. ++ */ ++ SPINWAIT((atomic_read(&usbos_info->txposted) != 0 || ++ atomic_read(&usbos_info->rxposted) != 0), 10000); ++ ++ txposted = atomic_read(&usbos_info->txposted); ++ rxposted = atomic_read(&usbos_info->rxposted); ++ if (txposted != 0 || rxposted != 0) { ++ DBUSERR(("%s ERROR: REQs posted, rx=%d tx=%d!\n", ++ __FUNCTION__, rxposted, txposted)); ++ } ++} /* dbus_usbos_cancel_all_urbs */ ++ ++/** multiple code paths require the bus to stop */ ++static void ++dbusos_stop(usbos_info_t *usbos_info) ++{ ++ urb_req_t *req; ++ int rxposted; ++ req = NULL; ++ BCM_REFERENCE(req); ++ ++ ASSERT(usbos_info); ++ ++ dbus_usbos_state_change(usbos_info, DBUS_STATE_DOWN); ++ ++ dbus_usbos_cancel_all_urbs(usbos_info); ++ ++#ifdef USBOS_THREAD ++ /* yield the CPU to rx packet thread */ ++ while (1) { ++ if (atomic_read(&usbos_info->usbos_list_cnt) <= 0) break; ++ wake_up_interruptible(&usbos_info->usbos_queue_head); ++ OSL_SLEEP(3); ++ } ++#endif /* USBOS_THREAD */ ++ ++ rxposted = atomic_read(&usbos_info->rxposted); ++ if (rxposted > 0) { ++ DBUSERR(("%s ERROR: rx REQs posted=%d in stop!\n", __FUNCTION__, ++ rxposted)); ++ } ++ ++ ASSERT(atomic_read(&usbos_info->txposted) == 0 && rxposted == 0); ++ ++} /* dbusos_stop */ ++ ++#if defined(USB_SUSPEND_AVAILABLE) ++ ++/** ++ * Linux kernel sports a 'USB auto suspend' feature. See: http://lwn.net/Articles/373550/ ++ * The suspend method is called by the Linux kernel to warn the driver that the device is going to ++ * be suspended. If the driver returns a negative error code, the suspend will be aborted. If the ++ * driver returns 0, it must cancel all outstanding URBs (usb_kill_urb()) and not submit any more. ++ */ ++static int ++dbus_usbos_suspend(struct usb_interface *intf, ++ pm_message_t message) ++{ ++ DBUSERR(("%s suspend state: %d\n", __FUNCTION__, g_probe_info.suspend_state)); ++ /* DHD for full dongle model */ ++ g_probe_info.suspend_state = USBOS_SUSPEND_STATE_SUSPEND_PENDING; ++ dbus_usbos_state_change((usbos_info_t*)g_probe_info.usbos_info, DBUS_STATE_SLEEP); ++ dbus_usbos_cancel_all_urbs((usbos_info_t*)g_probe_info.usbos_info); ++ g_probe_info.suspend_state = USBOS_SUSPEND_STATE_SUSPENDED; ++ ++ return 0; ++} ++ ++/** ++ * The resume method is called to tell the driver that the device has been resumed and the driver ++ * can return to normal operation. URBs may once more be submitted. ++ */ ++static int dbus_usbos_resume(struct usb_interface *intf) ++{ ++ DBUSERR(("%s Device resumed\n", __FUNCTION__)); ++ ++ dbus_usbos_state_change((usbos_info_t*)g_probe_info.usbos_info, DBUS_STATE_UP); ++ g_probe_info.suspend_state = USBOS_SUSPEND_STATE_DEVICE_ACTIVE; ++ return 0; ++} ++ ++/** ++* This function is directly called by the Linux kernel, when the suspended device has been reset ++* instead of being resumed ++*/ ++static int dbus_usbos_reset_resume(struct usb_interface *intf) ++{ ++ DBUSERR(("%s Device reset resumed\n", __FUNCTION__)); ++ ++ /* The device may have lost power, so a firmware download may be required */ ++ dbus_usbos_state_change((usbos_info_t*)g_probe_info.usbos_info, DBUS_STATE_DL_NEEDED); ++ g_probe_info.suspend_state = USBOS_SUSPEND_STATE_DEVICE_ACTIVE; ++ return 0; ++} ++ ++#endif /* USB_SUSPEND_AVAILABLE */ ++ ++/** ++ * Called by Linux kernel at initialization time, kernel wants to know if our driver will accept the ++ * caller supplied USB interface. Note that USB drivers are bound to interfaces, and not to USB ++ * devices. ++ */ ++#ifdef KERNEL26 ++#define DBUS_USBOS_PROBE() static int dbus_usbos_probe(struct usb_interface *intf, const struct usb_device_id *id) ++#define DBUS_USBOS_DISCONNECT() static void dbus_usbos_disconnect(struct usb_interface *intf) ++#else ++#define DBUS_USBOS_PROBE() static void * dbus_usbos_probe(struct usb_device *usb, unsigned int ifnum, const struct usb_device_id *id) ++#define DBUS_USBOS_DISCONNECT() static void dbus_usbos_disconnect(struct usb_device *usb, void *ptr) ++#endif /* KERNEL26 */ ++ ++DBUS_USBOS_PROBE() ++{ ++ int ep; ++ struct usb_endpoint_descriptor *endpoint; ++ int ret = 0; ++#ifdef KERNEL26 ++ struct usb_device *usb = interface_to_usbdev(intf); ++#else ++ int claimed = 0; ++#endif ++ int num_of_eps; ++#ifdef BCMUSBDEV_COMPOSITE ++ int wlan_if = -1; ++ bool intr_ep = FALSE; ++#endif /* BCMUSBDEV_COMPOSITE */ ++ wifi_adapter_info_t *adapter; ++ ++ DHD_MUTEX_LOCK(); ++ ++ DBUSERR(("%s: bus num(busnum)=%d, slot num (portnum)=%d\n", __FUNCTION__, ++ usb->bus->busnum, usb->portnum)); ++ adapter = dhd_wifi_platform_attach_adapter(USB_BUS, usb->bus->busnum, ++ usb->portnum, WIFI_STATUS_POWER_ON); ++ if (adapter == NULL) { ++ DBUSERR(("%s: can't find adapter info for this chip\n", __FUNCTION__)); ++ goto fail; ++ } ++ ++#ifdef BCMUSBDEV_COMPOSITE ++ wlan_if = dbus_usbos_intf_wlan(usb); ++#ifdef KERNEL26 ++ if ((wlan_if >= 0) && (IFPTR(usb, wlan_if) == intf)) ++#else ++ if (wlan_if == ifnum) ++#endif /* KERNEL26 */ ++ { ++#endif /* BCMUSBDEV_COMPOSITE */ ++ g_probe_info.usb = usb; ++ g_probe_info.dldone = TRUE; ++#ifdef BCMUSBDEV_COMPOSITE ++ } else { ++ DBUSTRACE(("dbus_usbos_probe: skip probe for non WLAN interface\n")); ++ ret = BCME_UNSUPPORTED; ++ goto fail; ++ } ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ++#ifdef KERNEL26 ++ g_probe_info.intf = intf; ++#endif /* KERNEL26 */ ++ ++#ifdef BCMUSBDEV_COMPOSITE ++ if (IFDESC(usb, wlan_if).bInterfaceNumber > USB_COMPIF_MAX) ++#else ++ if (IFDESC(usb, CONTROL_IF).bInterfaceNumber) ++#endif /* BCMUSBDEV_COMPOSITE */ ++ { ++ ret = -1; ++ goto fail; ++ } ++ if (id != NULL) { ++ g_probe_info.vid = id->idVendor; ++ g_probe_info.pid = id->idProduct; ++ } ++ ++#ifdef KERNEL26 ++ usb_set_intfdata(intf, &g_probe_info); ++#endif ++ ++ /* Check that the device supports only one configuration */ ++ if (usb->descriptor.bNumConfigurations != 1) { ++ ret = -1; ++ goto fail; ++ } ++ ++ if (usb->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) { ++#ifdef BCMUSBDEV_COMPOSITE ++ if ((usb->descriptor.bDeviceClass != USB_CLASS_MISC) && ++ (usb->descriptor.bDeviceClass != USB_CLASS_WIRELESS)) { ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ret = -1; ++ goto fail; ++#ifdef BCMUSBDEV_COMPOSITE ++ } ++#endif /* BCMUSBDEV_COMPOSITE */ ++ } ++ ++ /* ++ * Only the BDC interface configuration is supported: ++ * Device class: USB_CLASS_VENDOR_SPEC ++ * if0 class: USB_CLASS_VENDOR_SPEC ++ * if0/ep0: control ++ * if0/ep1: bulk in ++ * if0/ep2: bulk out (ok if swapped with bulk in) ++ */ ++ if (CONFIGDESC(usb)->bNumInterfaces != 1) { ++#ifdef BCMUSBDEV_COMPOSITE ++ if (CONFIGDESC(usb)->bNumInterfaces > USB_COMPIF_MAX) { ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ret = -1; ++ goto fail; ++#ifdef BCMUSBDEV_COMPOSITE ++ } ++#endif /* BCMUSBDEV_COMPOSITE */ ++ } ++ ++ /* Check interface */ ++#ifndef KERNEL26 ++#ifdef BCMUSBDEV_COMPOSITE ++ if (usb_interface_claimed(IFPTR(usb, wlan_if))) ++#else ++ if (usb_interface_claimed(IFPTR(usb, CONTROL_IF))) ++#endif /* BCMUSBDEV_COMPOSITE */ ++ { ++ ret = -1; ++ goto fail; ++ } ++#endif /* !KERNEL26 */ ++ ++#ifdef BCMUSBDEV_COMPOSITE ++ if ((IFDESC(usb, wlan_if).bInterfaceClass != USB_CLASS_VENDOR_SPEC || ++ IFDESC(usb, wlan_if).bInterfaceSubClass != 2 || ++ IFDESC(usb, wlan_if).bInterfaceProtocol != 0xff) && ++ (IFDESC(usb, wlan_if).bInterfaceClass != USB_CLASS_MISC || ++ IFDESC(usb, wlan_if).bInterfaceSubClass != USB_SUBCLASS_COMMON || ++ IFDESC(usb, wlan_if).bInterfaceProtocol != USB_PROTO_IAD)) ++#else ++ if (IFDESC(usb, CONTROL_IF).bInterfaceClass != USB_CLASS_VENDOR_SPEC || ++ IFDESC(usb, CONTROL_IF).bInterfaceSubClass != 2 || ++ IFDESC(usb, CONTROL_IF).bInterfaceProtocol != 0xff) ++#endif /* BCMUSBDEV_COMPOSITE */ ++ { ++#ifdef BCMUSBDEV_COMPOSITE ++ DBUSERR(("%s: invalid control interface: class %d, subclass %d, proto %d\n", ++ __FUNCTION__, ++ IFDESC(usb, wlan_if).bInterfaceClass, ++ IFDESC(usb, wlan_if).bInterfaceSubClass, ++ IFDESC(usb, wlan_if).bInterfaceProtocol)); ++#else ++ DBUSERR(("%s: invalid control interface: class %d, subclass %d, proto %d\n", ++ __FUNCTION__, ++ IFDESC(usb, CONTROL_IF).bInterfaceClass, ++ IFDESC(usb, CONTROL_IF).bInterfaceSubClass, ++ IFDESC(usb, CONTROL_IF).bInterfaceProtocol)); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ret = -1; ++ goto fail; ++ } ++ ++ /* Check control endpoint */ ++#ifdef BCMUSBDEV_COMPOSITE ++ endpoint = &IFEPDESC(usb, wlan_if, 0); ++#else ++ endpoint = &IFEPDESC(usb, CONTROL_IF, 0); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) { ++#ifdef BCMUSBDEV_COMPOSITE ++ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != ++ USB_ENDPOINT_XFER_BULK) { ++#endif /* BCMUSBDEV_COMPOSITE */ ++ DBUSERR(("%s: invalid control endpoint %d\n", ++ __FUNCTION__, endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)); ++ ret = -1; ++ goto fail; ++#ifdef BCMUSBDEV_COMPOSITE ++ } ++#endif /* BCMUSBDEV_COMPOSITE */ ++ } ++ ++#ifdef BCMUSBDEV_COMPOSITE ++ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) { ++#endif /* BCMUSBDEV_COMPOSITE */ ++ g_probe_info.intr_pipe = ++ usb_rcvintpipe(usb, endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); ++#ifdef BCMUSBDEV_COMPOSITE ++ intr_ep = TRUE; ++ } ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ++#ifndef KERNEL26 ++ /* Claim interface */ ++#ifdef BCMUSBDEV_COMPOSITE ++ usb_driver_claim_interface(&dbus_usbdev, IFPTR(usb, wlan_if), &g_probe_info); ++#else ++ usb_driver_claim_interface(&dbus_usbdev, IFPTR(usb, CONTROL_IF), &g_probe_info); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ claimed = 1; ++#endif /* !KERNEL26 */ ++ g_probe_info.rx_pipe = 0; ++ g_probe_info.rx_pipe2 = 0; ++ g_probe_info.tx_pipe = 0; ++#ifdef BCMUSBDEV_COMPOSITE ++ if (intr_ep) ++ ep = 1; ++ else ++ ep = 0; ++ num_of_eps = IFDESC(usb, wlan_if).bNumEndpoints - 1; ++#else ++ num_of_eps = IFDESC(usb, BULK_IF).bNumEndpoints - 1; ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ++ if ((num_of_eps != 2) && (num_of_eps != 3)) { ++#ifdef BCMUSBDEV_COMPOSITE ++ if (num_of_eps > 7) ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ASSERT(0); ++ } ++ /* Check data endpoints and get pipes */ ++#ifdef BCMUSBDEV_COMPOSITE ++ for (; ep <= num_of_eps; ep++) ++#else ++ for (ep = 1; ep <= num_of_eps; ep++) ++#endif /* BCMUSBDEV_COMPOSITE */ ++ { ++#ifdef BCMUSBDEV_COMPOSITE ++ endpoint = &IFEPDESC(usb, wlan_if, ep); ++#else ++ endpoint = &IFEPDESC(usb, BULK_IF, ep); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != ++ USB_ENDPOINT_XFER_BULK) { ++ DBUSERR(("%s: invalid data endpoint %d\n", ++ __FUNCTION__, ep)); ++ ret = -1; ++ goto fail; ++ } ++ ++ if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) { ++ /* direction: dongle->host */ ++ if (!g_probe_info.rx_pipe) { ++ g_probe_info.rx_pipe = usb_rcvbulkpipe(usb, ++ (endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK)); ++ } else { ++ g_probe_info.rx_pipe2 = usb_rcvbulkpipe(usb, ++ (endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK)); ++ } ++ ++ } else ++ g_probe_info.tx_pipe = usb_sndbulkpipe(usb, (endpoint->bEndpointAddress & ++ USB_ENDPOINT_NUMBER_MASK)); ++ } ++ ++ /* Allocate interrupt URB and data buffer */ ++ /* RNDIS says 8-byte intr, our old drivers used 4-byte */ ++#ifdef BCMUSBDEV_COMPOSITE ++ g_probe_info.intr_size = (IFEPDESC(usb, wlan_if, 0).wMaxPacketSize == 16) ? 8 : 4; ++ g_probe_info.interval = IFEPDESC(usb, wlan_if, 0).bInterval; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 21)) ++ usb->quirks |= USB_QUIRK_NO_SET_INTF; ++#endif ++#else ++ g_probe_info.intr_size = (IFEPDESC(usb, CONTROL_IF, 0).wMaxPacketSize == 16) ? 8 : 4; ++ g_probe_info.interval = IFEPDESC(usb, CONTROL_IF, 0).bInterval; ++#endif /* BCMUSBDEV_COMPOSITE */ ++ ++#ifndef KERNEL26 ++ /* usb_fill_int_urb does the interval decoding in 2.6 */ ++ if (usb->speed == USB_SPEED_HIGH) ++ g_probe_info.interval = 1 << (g_probe_info.interval - 1); ++#endif ++ if (usb->speed == USB_SPEED_SUPER) { ++ g_probe_info.device_speed = SUPER_SPEED; ++ DBUSERR(("super speed device detected\n")); ++ } else if (usb->speed == USB_SPEED_HIGH) { ++ g_probe_info.device_speed = HIGH_SPEED; ++ DBUSERR(("high speed device detected\n")); ++ } else { ++ g_probe_info.device_speed = FULL_SPEED; ++ DBUSERR(("full speed device detected\n")); ++ } ++ if (g_probe_info.dereged == FALSE && probe_cb) { ++ disc_arg = probe_cb(probe_arg, "", USB_BUS, usb->bus->busnum, usb->portnum, 0); ++ } ++ ++ g_probe_info.disc_cb_done = FALSE; ++ ++#ifdef KERNEL26 ++ intf->needs_remote_wakeup = 1; ++#endif /* KERNEL26 */ ++ DHD_MUTEX_UNLOCK(); ++ ++ /* Success */ ++#ifdef KERNEL26 ++ return DBUS_OK; ++#else ++ usb_inc_dev_use(usb); ++ return &g_probe_info; ++#endif ++ ++fail: ++ printf("%s: Exit ret=%d\n", __FUNCTION__, ret); ++#ifdef BCMUSBDEV_COMPOSITE ++ if (ret != BCME_UNSUPPORTED) ++#endif /* BCMUSBDEV_COMPOSITE */ ++ DBUSERR(("%s: failed with errno %d\n", __FUNCTION__, ret)); ++#ifndef KERNEL26 ++ if (claimed) ++#ifdef BCMUSBDEV_COMPOSITE ++ usb_driver_release_interface(&dbus_usbdev, IFPTR(usb, wlan_if)); ++#else ++ usb_driver_release_interface(&dbus_usbdev, IFPTR(usb, CONTROL_IF)); ++#endif /* BCMUSBDEV_COMPOSITE */ ++#endif /* !KERNEL26 */ ++ ++ DHD_MUTEX_UNLOCK(); ++#ifdef KERNEL26 ++ usb_set_intfdata(intf, NULL); ++ return ret; ++#else ++ return NULL; ++#endif ++} /* dbus_usbos_probe */ ++ ++/** Called by Linux kernel, is the counter part of dbus_usbos_probe() */ ++DBUS_USBOS_DISCONNECT() ++{ ++#ifdef KERNEL26 ++ struct usb_device *usb = interface_to_usbdev(intf); ++ probe_info_t *probe_usb_init_data = usb_get_intfdata(intf); ++#else ++ probe_info_t *probe_usb_init_data = (probe_info_t *) ptr; ++#endif ++ usbos_info_t *usbos_info; ++ ++ DHD_MUTEX_LOCK(); ++ ++ DBUSERR(("%s: bus num(busnum)=%d, slot num (portnum)=%d\n", __FUNCTION__, ++ usb->bus->busnum, usb->portnum)); ++ ++ if (probe_usb_init_data) { ++ usbos_info = (usbos_info_t *) probe_usb_init_data->usbos_info; ++ if (usbos_info) { ++ if ((probe_usb_init_data->dereged == FALSE) && disconnect_cb && disc_arg) { ++ disconnect_cb(disc_arg); ++ disc_arg = NULL; ++ probe_usb_init_data->disc_cb_done = TRUE; ++ } ++ } ++ } ++ ++ if (usb) { ++#ifndef KERNEL26 ++#ifdef BCMUSBDEV_COMPOSITE ++ usb_driver_release_interface(&dbus_usbdev, IFPTR(usb, wlan_if)); ++#else ++ usb_driver_release_interface(&dbus_usbdev, IFPTR(usb, CONTROL_IF)); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ usb_dec_dev_use(usb); ++#endif /* !KERNEL26 */ ++ } ++ DHD_MUTEX_UNLOCK(); ++} /* dbus_usbos_disconnect */ ++ ++#define LOOPBACK_PKT_START 0xBABE1234 ++ ++bool is_loopback_pkt(void *buf) ++{ ++ ++ uint32 *buf_ptr = (uint32 *) buf; ++ ++ if (*buf_ptr == LOOPBACK_PKT_START) ++ return TRUE; ++ return FALSE; ++ ++} ++ ++int matches_loopback_pkt(void *buf) ++{ ++ int i, j; ++ unsigned char *cbuf = (unsigned char *) buf; ++ ++ for (i = 4; i < loopback_size; i++) { ++ if (cbuf[i] != (i % 256)) { ++ printf("%s: mismatch at i=%d %d : ", __FUNCTION__, i, cbuf[i]); ++ for (j = i; ((j < i+ 16) && (j < loopback_size)); j++) { ++ printf("%d ", cbuf[j]); ++ } ++ printf("\n"); ++ return 0; ++ } ++ } ++ loopback_rx_cnt++; ++ return 1; ++} ++ ++int dbus_usbos_loopback_tx(void *usbos_info_ptr, int cnt, int size) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) usbos_info_ptr; ++ unsigned char *buf; ++ int j; ++ void* p = NULL; ++ int rc, last_rx_cnt; ++ int tx_failed_cnt; ++ int max_size = 1650; ++ int usb_packet_size = 512; ++ int min_packet_size = 10; ++ ++ if (size % usb_packet_size == 0) { ++ size = size - 1; ++ DBUSERR(("%s: overriding size=%d \n", __FUNCTION__, size)); ++ } ++ ++ if (size < min_packet_size) { ++ size = min_packet_size; ++ DBUSERR(("%s: overriding size=%d\n", __FUNCTION__, min_packet_size)); ++ } ++ if (size > max_size) { ++ size = max_size; ++ DBUSERR(("%s: overriding size=%d\n", __FUNCTION__, max_size)); ++ } ++ ++ loopback_tx_cnt = 0; ++ loopback_rx_cnt = 0; ++ tx_failed_cnt = 0; ++ loopback_size = size; ++ ++ while (loopback_tx_cnt < cnt) { ++ uint32 *x; ++ int pkt_size = loopback_size; ++ ++ p = PKTGET(usbos_info->pub->osh, pkt_size, TRUE); ++ if (p == NULL) { ++ DBUSERR(("%s:%d Failed to allocate packet sz=%d\n", ++ __FUNCTION__, __LINE__, pkt_size)); ++ return BCME_ERROR; ++ } ++ x = (uint32*) PKTDATA(usbos_info->pub->osh, p); ++ *x = LOOPBACK_PKT_START; ++ buf = (unsigned char*) x; ++ for (j = 4; j < pkt_size; j++) { ++ buf[j] = j % 256; ++ } ++ rc = dbus_send_buf(usbos_info->pub, buf, pkt_size, p); ++ if (rc != BCME_OK) { ++ DBUSERR(("%s:%d Freeing packet \n", __FUNCTION__, __LINE__)); ++ PKTFREE(usbos_info->pub->osh, p, TRUE); ++ dbus_usbos_wait(usbos_info, 1); ++ tx_failed_cnt++; ++ } else { ++ loopback_tx_cnt++; ++ tx_failed_cnt = 0; ++ } ++ if (tx_failed_cnt == 5) { ++ DBUSERR(("%s : Failed to send loopback packets cnt=%d loopback_tx_cnt=%d\n", ++ __FUNCTION__, cnt, loopback_tx_cnt)); ++ break; ++ } ++ } ++ printf("Transmitted %d loopback packets of size %d\n", loopback_tx_cnt, loopback_size); ++ ++ last_rx_cnt = loopback_rx_cnt; ++ while (loopback_rx_cnt < loopback_tx_cnt) { ++ dbus_usbos_wait(usbos_info, 1); ++ if (loopback_rx_cnt <= last_rx_cnt) { ++ DBUSERR(("%s: Matched rx cnt stuck at %d \n", __FUNCTION__, last_rx_cnt)); ++ return BCME_ERROR; ++ } ++ last_rx_cnt = loopback_rx_cnt; ++ } ++ printf("Received %d loopback packets of size %d\n", loopback_tx_cnt, loopback_size); ++ ++ return BCME_OK; ++} /* dbus_usbos_loopback_tx */ ++ ++/** ++ * Higher layer (dbus_usb.c) wants to transmit an I/O Request Block ++ * @param[in] txirb txirb->pkt, if non-zero, contains a single or a chain of packets ++ */ ++static int ++dbus_usbos_intf_send_irb(void *bus, dbus_irb_tx_t *txirb) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ urb_req_t *req, *req_zlp = NULL; ++ int ret = DBUS_OK; ++ unsigned long flags; ++ void *pkt; ++ uint32 buffer_length; ++ uint8 *buf; ++ ++ if ((usbos_info == NULL) || !usbos_info->tx_pipe) { ++ return DBUS_ERR; ++ } ++ ++ if (txirb->pkt != NULL) { ++ buffer_length = pkttotlen(usbos_info->pub->osh, txirb->pkt); ++ /* In case of multiple packets the values below may be overwritten */ ++ txirb->send_buf = NULL; ++ buf = PKTDATA(usbos_info->pub->osh, txirb->pkt); ++ } else { /* txirb->buf != NULL */ ++ ASSERT(txirb->buf != NULL); ++ ASSERT(txirb->send_buf == NULL); ++ buffer_length = txirb->len; ++ buf = txirb->buf; ++ } ++ ++ if (!(req = dbus_usbos_qdeq(&usbos_info->req_txfreeq, &usbos_info->txfree_lock))) { ++ DBUSERR(("%s No free URB!\n", __FUNCTION__)); ++ return DBUS_ERR_TXDROP; ++ } ++ ++ /* If not using standard Linux kernel functionality for handling Zero Length Packet(ZLP), ++ * the dbus needs to generate ZLP when length is multiple of MaxPacketSize. ++ */ ++#ifndef WL_URB_ZPKT ++ if (!(buffer_length % usbos_info->maxps)) { ++ if (!(req_zlp = ++ dbus_usbos_qdeq(&usbos_info->req_txfreeq, &usbos_info->txfree_lock))) { ++ DBUSERR(("%s No free URB for ZLP!\n", __FUNCTION__)); ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req, &usbos_info->txfree_lock); ++ return DBUS_ERR_TXDROP; ++ } ++ ++ /* No txirb, so that dbus_usbos_send_complete can differentiate between ++ * DATA and ZLP. ++ */ ++ req_zlp->arg = NULL; ++ req_zlp->usbinfo = usbos_info; ++ req_zlp->buf_len = 0; ++ ++ usb_fill_bulk_urb(req_zlp->urb, usbos_info->usb, usbos_info->tx_pipe, NULL, ++ 0, (usb_complete_t)dbus_usbos_send_complete, req_zlp); ++ ++ req_zlp->urb->transfer_flags |= URB_QUEUE_BULK; ++ } ++#endif /* !WL_URB_ZPKT */ ++ ++#ifndef USBOS_TX_THREAD ++ /* Disable USB autosuspend until this request completes, request USB resume if needed. ++ * Because this call runs asynchronously, there is no guarantee the bus is resumed before ++ * the URB is submitted, and the URB might be dropped. Use USBOS_TX_THREAD to avoid ++ * this. ++ */ ++ USB_AUTOPM_GET_INTERFACE_ASYNC(g_probe_info.intf); ++#endif /* !USBOS_TX_THREAD */ ++ ++ spin_lock_irqsave(&usbos_info->txlock, flags); ++ ++ req->arg = txirb; ++ req->usbinfo = usbos_info; ++ req->buf_len = 0; ++ ++ /* Prepare the URB */ ++ if (txirb->pkt != NULL) { ++ uint32 pktlen; ++ uint8 *transfer_buf; ++ ++ /* For multiple packets, allocate contiguous buffer and copy packet data to it */ ++ if (PKTNEXT(usbos_info->pub->osh, txirb->pkt)) { ++ transfer_buf = MALLOC(usbos_info->pub->osh, buffer_length); ++ if (!transfer_buf) { ++ ret = DBUS_ERR_TXDROP; ++ DBUSERR(("fail to alloc to usb buffer\n")); ++ goto fail; ++ } ++ ++ pkt = txirb->pkt; ++ txirb->send_buf = transfer_buf; ++ req->buf_len = buffer_length; ++ ++ while (pkt) { ++ pktlen = PKTLEN(usbos_info->pub->osh, pkt); ++ bcopy(PKTDATA(usbos_info->pub->osh, pkt), transfer_buf, pktlen); ++ transfer_buf += pktlen; ++ pkt = PKTNEXT(usbos_info->pub->osh, pkt); ++ } ++ ++ ASSERT(((uint8 *) txirb->send_buf + buffer_length) == transfer_buf); ++ ++ /* Overwrite buf pointer with pointer to allocated contiguous transfer_buf ++ */ ++ buf = txirb->send_buf; ++ } ++ } ++ ++ usb_fill_bulk_urb(req->urb, usbos_info->usb, usbos_info->tx_pipe, buf, ++ buffer_length, (usb_complete_t)dbus_usbos_send_complete, req); ++ ++ req->urb->transfer_flags |= URB_QUEUE_BULK; ++ ++#ifdef USBOS_TX_THREAD ++ /* Enqueue TX request, the TX thread will resume the bus if needed and submit ++ * it asynchronously ++ */ ++ dbus_usbos_qenq(&usbos_info->usbos_tx_list, req, &usbos_info->usbos_tx_list_lock); ++ if (req_zlp != NULL) { ++ dbus_usbos_qenq(&usbos_info->usbos_tx_list, req_zlp, ++ &usbos_info->usbos_tx_list_lock); ++ } ++ spin_unlock_irqrestore(&usbos_info->txlock, flags); ++ ++ wake_up_interruptible(&usbos_info->usbos_tx_queue_head); ++ return DBUS_OK; ++#else ++ if ((ret = USB_SUBMIT_URB(req->urb))) { ++ ret = DBUS_ERR_TXDROP; ++ goto fail; ++ } ++ ++ dbus_usbos_qenq(&usbos_info->req_txpostedq, req, &usbos_info->txposted_lock); ++ atomic_inc(&usbos_info->txposted); ++ ++ if (req_zlp != NULL) { ++ if ((ret = USB_SUBMIT_URB(req_zlp->urb))) { ++ DBUSERR(("failed to submit ZLP URB!\n")); ++ ASSERT(0); ++ ret = DBUS_ERR_TXDROP; ++ goto fail2; ++ } ++ ++ dbus_usbos_qenq(&usbos_info->req_txpostedq, req_zlp, &usbos_info->txposted_lock); ++ /* Also increment txposted for zlp packet, as it will be decremented in ++ * dbus_usbos_send_complete() ++ */ ++ atomic_inc(&usbos_info->txposted); ++ } ++ ++ spin_unlock_irqrestore(&usbos_info->txlock, flags); ++ return DBUS_OK; ++#endif /* USBOS_TX_THREAD */ ++ ++fail: ++ if (txirb->send_buf != NULL) { ++ MFREE(usbos_info->pub->osh, txirb->send_buf, req->buf_len); ++ txirb->send_buf = NULL; ++ req->buf_len = 0; ++ } ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req, &usbos_info->txfree_lock); ++#ifndef USBOS_TX_THREAD ++fail2: ++#endif ++ if (req_zlp != NULL) { ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req_zlp, &usbos_info->txfree_lock); ++ } ++ ++ spin_unlock_irqrestore(&usbos_info->txlock, flags); ++ ++#ifndef USBOS_TX_THREAD ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++#endif /* !USBOS_TX_THREAD */ ++ ++ return ret; ++} /* dbus_usbos_intf_send_irb */ ++ ++/** Higher layer (dbus_usb.c) recycles a received (and used) packet. */ ++static int ++dbus_usbos_intf_recv_irb(void *bus, dbus_irb_rx_t *rxirb) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ int ret = DBUS_OK; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ ret = dbus_usbos_recv_urb_submit(usbos_info, rxirb, 0); ++ return ret; ++} ++ ++static int ++dbus_usbos_intf_recv_irb_from_ep(void *bus, dbus_irb_rx_t *rxirb, uint32 ep_idx) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ int ret = DBUS_OK; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++#ifdef INTR_EP_ENABLE ++ /* By specifying the ep_idx value of 0xff, the cdc layer is asking to ++ * submit an interrupt URB ++ */ ++ if (rxirb == NULL && ep_idx == 0xff) { ++ /* submit intr URB */ ++ if ((ret = USB_SUBMIT_URB(usbos_info->intr_urb)) < 0) { ++ DBUSERR(("%s intr USB_SUBMIT_URB failed, status %d\n", ++ __FUNCTION__, ret)); ++ } ++ return ret; ++ } ++#else ++ if (rxirb == NULL) { ++ return DBUS_ERR; ++ } ++#endif /* INTR_EP_ENABLE */ ++ ++ ret = dbus_usbos_recv_urb_submit(usbos_info, rxirb, ep_idx); ++ return ret; ++} ++ ++/** Higher layer (dbus_usb.c) want to cancel an IRB */ ++static int ++dbus_usbos_intf_cancel_irb(void *bus, dbus_irb_tx_t *txirb) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ return DBUS_ERR; ++} ++ ++/** Only one CTL transfer can be pending at any time. This function may block. */ ++static int ++dbus_usbos_intf_send_ctl(void *bus, uint8 *buf, int len) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ uint16 size; ++#ifndef USBOS_TX_THREAD ++ int status; ++#endif /* USBOS_TX_THREAD */ ++ ++ if ((usbos_info == NULL) || (buf == NULL) || (len == 0)) ++ return DBUS_ERR; ++ ++ if (usbos_info->ctl_urb == NULL) ++ return DBUS_ERR; ++ ++ /* Block until a pending CTL transfer has completed */ ++ if (down_interruptible(&usbos_info->ctl_lock) != 0) { ++ return DBUS_ERR_TXCTLFAIL; ++ } ++ ++#ifdef USBOS_TX_THREAD ++ ASSERT(usbos_info->ctl_state == USBOS_REQUEST_STATE_UNSCHEDULED); ++#else ++ /* Disable USB autosuspend until this request completes, request USB resume if needed. ++ * Because this call runs asynchronously, there is no guarantee the bus is resumed before ++ * the URB is submitted, and the URB might be dropped. Use USBOS_TX_THREAD to avoid ++ * this. ++ */ ++ USB_AUTOPM_GET_INTERFACE_ASYNC(g_probe_info.intf); ++#endif /* USBOS_TX_THREAD */ ++ ++ size = len; ++ usbos_info->ctl_write.wLength = cpu_to_le16p(&size); ++ usbos_info->ctl_urb->transfer_buffer_length = size; ++ ++ usb_fill_control_urb(usbos_info->ctl_urb, ++ usbos_info->usb, ++ usb_sndctrlpipe(usbos_info->usb, 0), ++ (unsigned char *) &usbos_info->ctl_write, ++ buf, size, (usb_complete_t)dbus_usbos_ctlwrite_complete, usbos_info); ++ ++#ifdef USBOS_TX_THREAD ++ /* Enqueue CTRL request for transmission by the TX thread. The ++ * USB bus will first be resumed if needed. ++ */ ++ usbos_info->ctl_state = USBOS_REQUEST_STATE_SCHEDULED; ++ wake_up_interruptible(&usbos_info->usbos_tx_queue_head); ++#else ++ status = USB_SUBMIT_URB(usbos_info->ctl_urb); ++ if (status < 0) { ++ DBUSERR(("%s: usb_submit_urb failed %d\n", __FUNCTION__, status)); ++ up(&usbos_info->ctl_lock); ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++ ++ return DBUS_ERR_TXCTLFAIL; ++ } ++#endif /* USBOS_TX_THREAD */ ++ ++ return DBUS_OK; ++} /* dbus_usbos_intf_send_ctl */ ++ ++/** This function does not seem to be called by anyone, including dbus_usb.c */ ++static int ++dbus_usbos_intf_recv_ctl(void *bus, uint8 *buf, int len) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ int status; ++ uint16 size; ++ ++ if ((usbos_info == NULL) || (buf == NULL) || (len == 0)) ++ return DBUS_ERR; ++ ++ if (usbos_info->ctl_urb == NULL) ++ return DBUS_ERR; ++ ++ /* Block until a pending CTRL transfer has completed */ ++ if (down_interruptible(&usbos_info->ctl_lock) != 0) { ++ return DBUS_ERR_TXCTLFAIL; ++ } ++ ++ /* Disable USB autosuspend until this request completes, request USB resume if needed. */ ++ USB_AUTOPM_GET_INTERFACE_ASYNC(g_probe_info.intf); ++ ++ size = len; ++ usbos_info->ctl_read.wLength = cpu_to_le16p(&size); ++ usbos_info->ctl_urb->transfer_buffer_length = size; ++ ++ if (usbos_info->rxctl_deferrespok) { ++ /* BMAC model */ ++ usbos_info->ctl_read.bRequestType = USB_DIR_IN | USB_TYPE_VENDOR | ++ USB_RECIP_INTERFACE; ++ usbos_info->ctl_read.bRequest = DL_DEFER_RESP_OK; ++ } else { ++ /* full dongle model */ ++ usbos_info->ctl_read.bRequestType = USB_DIR_IN | USB_TYPE_CLASS | ++ USB_RECIP_INTERFACE; ++ usbos_info->ctl_read.bRequest = 1; ++ } ++ ++ usb_fill_control_urb(usbos_info->ctl_urb, ++ usbos_info->usb, ++ usb_rcvctrlpipe(usbos_info->usb, 0), ++ (unsigned char *) &usbos_info->ctl_read, ++ buf, size, (usb_complete_t)dbus_usbos_ctlread_complete, usbos_info); ++ ++ status = USB_SUBMIT_URB(usbos_info->ctl_urb); ++ if (status < 0) { ++ DBUSERR(("%s: usb_submit_urb failed %d\n", __FUNCTION__, status)); ++ up(&usbos_info->ctl_lock); ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++ ++ return DBUS_ERR_RXCTLFAIL; ++ } ++ ++ return DBUS_OK; ++} ++ ++static int ++dbus_usbos_intf_get_attrib(void *bus, dbus_attrib_t *attrib) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ ++ if ((usbos_info == NULL) || (attrib == NULL)) ++ return DBUS_ERR; ++ ++ attrib->bustype = DBUS_USB; ++ attrib->vid = g_probe_info.vid; ++ attrib->pid = g_probe_info.pid; ++ attrib->devid = 0x4322; ++ ++ attrib->nchan = 1; ++ ++ /* MaxPacketSize for USB hi-speed bulk out is 512 bytes ++ * and 64-bytes for full-speed. ++ * When sending pkt > MaxPacketSize, Host SW breaks it ++ * up into multiple packets. ++ */ ++ attrib->mtu = usbos_info->maxps; ++ ++ return DBUS_OK; ++} ++ ++/** Called by higher layer (dbus_usb.c) when it wants to 'up' the USB interface to the dongle */ ++static int ++dbus_usbos_intf_up(void *bus) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ uint16 ifnum; ++#ifdef BCMUSBDEV_COMPOSITE ++ int wlan_if = 0; ++#endif ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ if (usbos_info->usb == NULL) ++ return DBUS_ERR; ++ ++#if defined(INTR_EP_ENABLE) ++ /* full dongle use intr EP, bmac doesn't use it */ ++ if (usbos_info->intr_urb) { ++ int ret; ++ ++ usb_fill_int_urb(usbos_info->intr_urb, usbos_info->usb, ++ usbos_info->intr_pipe, &usbos_info->intr, ++ usbos_info->intr_size, (usb_complete_t)dbus_usbos_intr_complete, ++ usbos_info, usbos_info->interval); ++ ++ if ((ret = USB_SUBMIT_URB(usbos_info->intr_urb))) { ++ DBUSERR(("%s USB_SUBMIT_URB failed with status %d\n", __FUNCTION__, ret)); ++ return DBUS_ERR; ++ } ++ } ++#endif ++ ++ if (usbos_info->ctl_urb) { ++ usbos_info->ctl_in_pipe = usb_rcvctrlpipe(usbos_info->usb, 0); ++ usbos_info->ctl_out_pipe = usb_sndctrlpipe(usbos_info->usb, 0); ++ ++#ifdef BCMUSBDEV_COMPOSITE ++ wlan_if = dbus_usbos_intf_wlan(usbos_info->usb); ++ ifnum = cpu_to_le16(IFDESC(usbos_info->usb, wlan_if).bInterfaceNumber); ++#else ++ ifnum = cpu_to_le16(IFDESC(usbos_info->usb, CONTROL_IF).bInterfaceNumber); ++#endif /* BCMUSBDEV_COMPOSITE */ ++ /* CTL Write */ ++ usbos_info->ctl_write.bRequestType = ++ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE; ++ usbos_info->ctl_write.bRequest = 0; ++ usbos_info->ctl_write.wValue = cpu_to_le16(0); ++ usbos_info->ctl_write.wIndex = cpu_to_le16p(&ifnum); ++ ++ /* CTL Read */ ++ usbos_info->ctl_read.bRequestType = ++ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; ++ usbos_info->ctl_read.bRequest = 1; ++ usbos_info->ctl_read.wValue = cpu_to_le16(0); ++ usbos_info->ctl_read.wIndex = cpu_to_le16p(&ifnum); ++ } ++ ++ /* Success, indicate usbos_info is fully up */ ++ dbus_usbos_state_change(usbos_info, DBUS_STATE_UP); ++ ++ return DBUS_OK; ++} /* dbus_usbos_intf_up */ ++ ++static int ++dbus_usbos_intf_down(void *bus) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ dbusos_stop(usbos_info); ++ return DBUS_OK; ++} ++ ++static int ++dbus_usbos_intf_stop(void *bus) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ dbusos_stop(usbos_info); ++ return DBUS_OK; ++} ++ ++ ++/** Called by higher layer (dbus_usb.c) */ ++static int ++dbus_usbos_intf_set_config(void *bus, dbus_config_t *config) ++{ ++ int err = DBUS_ERR; ++ usbos_info_t* usbos_info = bus; ++ ++ if (config->config_id == DBUS_CONFIG_ID_RXCTL_DEFERRES) { ++ usbos_info->rxctl_deferrespok = config->rxctl_deferrespok; ++ err = DBUS_OK; ++ } else if (config->config_id == DBUS_CONFIG_ID_AGGR_LIMIT) { ++ /* DBUS_CONFIG_ID_AGGR_LIMIT shouldn't be called after probe stage */ ++ ASSERT(disc_arg == NULL); ++ ASSERT(config->aggr_param.maxrxsf > 0); ++ ASSERT(config->aggr_param.maxrxsize > 0); ++ if (config->aggr_param.maxrxsize > usbos_info->rxbuf_len) { ++ int state = usbos_info->pub->busstate; ++ dbus_usbos_unlink(&usbos_info->req_rxpostedq, &usbos_info->rxposted_lock); ++ while (atomic_read(&usbos_info->rxposted)) { ++ DBUSTRACE(("%s rxposted is %d, delay 1 ms\n", __FUNCTION__, ++ atomic_read(&usbos_info->rxposted))); ++ dbus_usbos_wait(usbos_info, 1); ++ } ++ usbos_info->rxbuf_len = config->aggr_param.maxrxsize; ++ dbus_usbos_state_change(usbos_info, state); ++ } ++ err = DBUS_OK; ++ } ++ ++ return err; ++} ++ ++ ++/** Called by dbus_usb.c when it wants to download firmware into the dongle */ ++bool ++dbus_usbos_dl_cmd(usbos_info_t *usbinfo, uint8 cmd, void *buffer, int buflen) ++{ ++ int transferred; ++ int index = 0; ++ char *tmpbuf; ++ ++ if ((usbinfo == NULL) || (buffer == NULL) || (buflen == 0)) ++ return FALSE; ++ ++ tmpbuf = (char *) MALLOC(usbinfo->pub->osh, buflen); ++ if (!tmpbuf) { ++ DBUSERR(("%s: Unable to allocate memory \n", __FUNCTION__)); ++ return FALSE; ++ } ++ ++#ifdef BCM_REQUEST_FW ++ if (cmd == DL_GO) { ++ index = 1; ++ } ++#endif ++ ++ /* Disable USB autosuspend until this request completes, request USB resume if needed. */ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ transferred = USB_CONTROL_MSG(usbinfo->usb, usb_rcvctrlpipe(usbinfo->usb, 0), ++ cmd, (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE), ++ 0, index, ++ (void*) tmpbuf, buflen, USB_CTRL_EP_TIMEOUT); ++ if (transferred == buflen) { ++ memcpy(buffer, tmpbuf, buflen); ++ } else { ++ DBUSERR(("%s: usb_control_msg failed %d\n", __FUNCTION__, transferred)); ++ } ++ ++ USB_AUTOPM_PUT_INTERFACE(g_probe_info.intf); ++ ++ MFREE(usbinfo->pub->osh, tmpbuf, buflen); ++ return (transferred == buflen); ++} ++ ++/** ++ * Called by dbus_usb.c when it wants to download a buffer into the dongle (e.g. as part of the ++ * download process, when writing nvram variables). ++ */ ++int ++dbus_write_membytes(usbos_info_t* usbinfo, bool set, uint32 address, uint8 *data, uint size) ++{ ++ hwacc_t hwacc; ++ int write_bytes = 4; ++ int status; ++ int retval = 0; ++ ++ DBUSTRACE(("Enter:%s\n", __FUNCTION__)); ++ ++ /* Read is not supported */ ++ if (set == 0) { ++ DBUSERR(("Currently read is not supported!!\n")); ++ return -1; ++ } ++ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ hwacc.cmd = DL_CMD_WRHW; ++ hwacc.addr = address; ++ ++ DBUSTRACE(("Address:%x size:%d", hwacc.addr, size)); ++ do { ++ if (size >= 4) { ++ write_bytes = 4; ++ } else if (size >= 2) { ++ write_bytes = 2; ++ } else { ++ write_bytes = 1; ++ } ++ ++ hwacc.len = write_bytes; ++ ++ while (size >= write_bytes) { ++ hwacc.data = *((unsigned int*)data); ++ ++ status = USB_CONTROL_MSG(usbinfo->usb, usb_sndctrlpipe(usbinfo->usb, 0), ++ DL_WRHW, (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE), ++ 1, 0, (char *)&hwacc, sizeof(hwacc_t), USB_CTRL_EP_TIMEOUT); ++ ++ if (status < 0) { ++ retval = -1; ++ DBUSERR((" Ctrl write hwacc failed w/status %d @ address:%x \n", ++ status, hwacc.addr)); ++ goto err; ++ } ++ ++ hwacc.addr += write_bytes; ++ data += write_bytes; ++ size -= write_bytes; ++ } ++ } while (size > 0); ++ ++err: ++ USB_AUTOPM_PUT_INTERFACE(g_probe_info.intf); ++ ++ return retval; ++} ++ ++int ++dbus_usbos_readreg(void *bus, uint32 regaddr, int datalen, uint32 *value) ++{ ++ usbos_info_t *usbinfo = (usbos_info_t *) bus; ++ int ret = DBUS_OK; ++ int transferred; ++ uint32 cmd; ++ hwacc_t hwacc; ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ if (datalen == 1) ++ cmd = DL_RDHW8; ++ else if (datalen == 2) ++ cmd = DL_RDHW16; ++ else ++ cmd = DL_RDHW32; ++ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ transferred = USB_CONTROL_MSG(usbinfo->usb, usb_rcvctrlpipe(usbinfo->usb, 0), ++ cmd, (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE), ++ (uint16)(regaddr), (uint16)(regaddr >> 16), ++ (void *) &hwacc, sizeof(hwacc_t), USB_CTRL_EP_TIMEOUT); ++ ++ if (transferred >= sizeof(hwacc_t)) { ++ *value = hwacc.data; ++ } else { ++ DBUSERR(("%s: usb_control_msg failed %d\n", __FUNCTION__, transferred)); ++ ret = DBUS_ERR; ++ } ++ ++ USB_AUTOPM_PUT_INTERFACE(g_probe_info.intf); ++ ++ return ret; ++} ++ ++int ++dbus_usbos_writereg(void *bus, uint32 regaddr, int datalen, uint32 data) ++{ ++ usbos_info_t *usbinfo = (usbos_info_t *) bus; ++ int ret = DBUS_OK; ++ int transferred; ++ uint32 cmd = DL_WRHW; ++ hwacc_t hwacc; ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ hwacc.cmd = DL_WRHW; ++ hwacc.addr = regaddr; ++ hwacc.data = data; ++ hwacc.len = datalen; ++ ++ transferred = USB_CONTROL_MSG(usbinfo->usb, usb_sndctrlpipe(usbinfo->usb, 0), ++ cmd, (USB_DIR_OUT| USB_TYPE_VENDOR | USB_RECIP_INTERFACE), ++ 1, 0, ++ (void *) &hwacc, sizeof(hwacc_t), USB_CTRL_EP_TIMEOUT); ++ ++ if (transferred != sizeof(hwacc_t)) { ++ DBUSERR(("%s: usb_control_msg failed %d\n", __FUNCTION__, transferred)); ++ ret = DBUS_ERR; ++ } ++ ++ USB_AUTOPM_PUT_INTERFACE(g_probe_info.intf); ++ ++ return ret; ++} ++ ++int ++dbus_usbos_wait(usbos_info_t *usbinfo, uint16 ms) ++{ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) ++ if (in_interrupt()) ++ mdelay(ms); ++ else ++ msleep_interruptible(ms); ++#else ++ wait_ms(ms); ++#endif ++ return DBUS_OK; ++} ++ ++/** Called by dbus_usb.c as part of the firmware download process */ ++bool ++dbus_usbos_dl_send_bulk(usbos_info_t *usbinfo, void *buffer, int len) ++{ ++ bool ret = TRUE; ++ int status; ++ int transferred = 0; ++ ++ if (usbinfo == NULL) ++ return DBUS_ERR; ++ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ status = USB_BULK_MSG(usbinfo->usb, usbinfo->tx_pipe, ++ buffer, len, ++ &transferred, USB_BULK_EP_TIMEOUT); ++ ++ if (status < 0) { ++ DBUSERR(("%s: usb_bulk_msg failed %d\n", __FUNCTION__, status)); ++ ret = FALSE; ++ } ++ ++ USB_AUTOPM_PUT_INTERFACE(g_probe_info.intf); ++ ++ return ret; ++} ++ ++static bool ++dbus_usbos_intf_recv_needed(void *bus) ++{ ++ return FALSE; ++} ++ ++/** ++ * Higher layer (dbus_usb.c) wants to execute a function on the condition that the rx spin lock has ++ * been acquired. ++ */ ++static void* ++dbus_usbos_intf_exec_rxlock(void *bus, exec_cb_t cb, struct exec_parms *args) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ void *ret; ++ unsigned long flags; ++ ++ if (usbos_info == NULL) ++ return NULL; ++ ++ spin_lock_irqsave(&usbos_info->rxlock, flags); ++ ret = cb(args); ++ spin_unlock_irqrestore(&usbos_info->rxlock, flags); ++ ++ return ret; ++} ++ ++static void* ++dbus_usbos_intf_exec_txlock(void *bus, exec_cb_t cb, struct exec_parms *args) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ void *ret; ++ unsigned long flags; ++ ++ if (usbos_info == NULL) ++ return NULL; ++ ++ spin_lock_irqsave(&usbos_info->txlock, flags); ++ ret = cb(args); ++ spin_unlock_irqrestore(&usbos_info->txlock, flags); ++ ++ return ret; ++} ++ ++/** ++ * if an error condition was detected in this module, the higher DBUS layer (dbus_usb.c) has to ++ * be notified. ++ */ ++int ++dbus_usbos_errhandler(void *bus, int err) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ if (usbos_info->cbarg && usbos_info->cbs) { ++ if (usbos_info->cbs->errhandler) ++ usbos_info->cbs->errhandler(usbos_info->cbarg, err); ++ } ++ ++ return DBUS_OK; ++} ++ ++/** ++ * if a change in bus state was detected in this module, the higher DBUS layer (dbus_usb.c) has to ++ * be notified. ++ */ ++int ++dbus_usbos_state_change(void *bus, int state) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) bus; ++ ++ if (usbos_info == NULL) ++ return DBUS_ERR; ++ ++ if (usbos_info->cbarg && usbos_info->cbs) { ++ if (usbos_info->cbs->state_change) ++ usbos_info->cbs->state_change(usbos_info->cbarg, state); ++ } ++ ++ usbos_info->pub->busstate = state; ++ return DBUS_OK; ++} ++ ++int ++dbus_bus_osl_register(int vid, int pid, probe_cb_t prcb, ++ disconnect_cb_t discb, void *prarg, dbus_intf_t **intf, void *param1, void *param2) ++{ ++ bzero(&g_probe_info, sizeof(probe_info_t)); ++ ++ probe_cb = prcb; ++ disconnect_cb = discb; ++ probe_arg = prarg; ++ ++ devid_table[0].idVendor = vid; ++ devid_table[0].idProduct = pid; ++ ++ *intf = &dbus_usbos_intf; ++ ++ USB_REGISTER(); ++ ++ return DBUS_ERR_NODEVICE; ++} ++ ++int ++dbus_bus_osl_deregister() ++{ ++ g_probe_info.dereged = TRUE; ++ ++ DHD_MUTEX_LOCK(); ++ if (disconnect_cb && disc_arg && (g_probe_info.disc_cb_done == FALSE)) { ++ disconnect_cb(disc_arg); ++ disc_arg = NULL; ++ } ++ DHD_MUTEX_UNLOCK(); ++ ++ USB_DEREGISTER(); ++ ++ return DBUS_OK; ++} ++ ++void * ++dbus_usbos_intf_attach(dbus_pub_t *pub, void *cbarg, dbus_intf_callbacks_t *cbs) ++{ ++ usbos_info_t *usbos_info; ++ ++ if (g_probe_info.dldone == FALSE) { ++ DBUSERR(("%s: err device not downloaded!\n", __FUNCTION__)); ++ return NULL; ++ } ++ ++ /* Sanity check for BUS_INFO() */ ++ ASSERT(OFFSETOF(usbos_info_t, pub) == 0); ++ ++ usbos_info = MALLOC(pub->osh, sizeof(usbos_info_t)); ++ if (usbos_info == NULL) ++ return NULL; ++ ++ bzero(usbos_info, sizeof(usbos_info_t)); ++ ++ usbos_info->pub = pub; ++ usbos_info->cbarg = cbarg; ++ usbos_info->cbs = cbs; ++ ++ /* Needed for disconnect() */ ++ g_probe_info.usbos_info = usbos_info; ++ ++ /* Update USB Info */ ++ usbos_info->usb = g_probe_info.usb; ++ usbos_info->rx_pipe = g_probe_info.rx_pipe; ++ usbos_info->rx_pipe2 = g_probe_info.rx_pipe2; ++ usbos_info->tx_pipe = g_probe_info.tx_pipe; ++ usbos_info->intr_pipe = g_probe_info.intr_pipe; ++ usbos_info->intr_size = g_probe_info.intr_size; ++ usbos_info->interval = g_probe_info.interval; ++ usbos_info->pub->device_speed = g_probe_info.device_speed; ++ if (usbos_info->rx_pipe2) { ++ usbos_info->pub->attrib.has_2nd_bulk_in_ep = 1; ++ } else { ++ usbos_info->pub->attrib.has_2nd_bulk_in_ep = 0; ++ } ++ ++ if (usbos_info->tx_pipe) ++ usbos_info->maxps = usb_maxpacket(usbos_info->usb, ++ usbos_info->tx_pipe, usb_pipeout(usbos_info->tx_pipe)); ++ ++ INIT_LIST_HEAD(&usbos_info->req_rxfreeq); ++ INIT_LIST_HEAD(&usbos_info->req_txfreeq); ++ INIT_LIST_HEAD(&usbos_info->req_rxpostedq); ++ INIT_LIST_HEAD(&usbos_info->req_txpostedq); ++ spin_lock_init(&usbos_info->rxfree_lock); ++ spin_lock_init(&usbos_info->txfree_lock); ++ spin_lock_init(&usbos_info->rxposted_lock); ++ spin_lock_init(&usbos_info->txposted_lock); ++ spin_lock_init(&usbos_info->rxlock); ++ spin_lock_init(&usbos_info->txlock); ++ ++ atomic_set(&usbos_info->rxposted, 0); ++ atomic_set(&usbos_info->txposted, 0); ++ ++ ++#ifdef USB_DISABLE_INT_EP ++ usbos_info->intr_urb = NULL; ++#else ++ if (!(usbos_info->intr_urb = USB_ALLOC_URB())) { ++ DBUSERR(("%s: usb_alloc_urb (tx) failed\n", __FUNCTION__)); ++ goto fail; ++ } ++#endif ++ ++ if (!(usbos_info->ctl_urb = USB_ALLOC_URB())) { ++ DBUSERR(("%s: usb_alloc_urb (tx) failed\n", __FUNCTION__)); ++ goto fail; ++ } ++ ++ init_waitqueue_head(&usbos_info->wait); ++ ++ if (!(usbos_info->blk_urb = USB_ALLOC_URB())) { /* for embedded image downloading */ ++ DBUSERR(("%s: usb_alloc_urb (tx) failed\n", __FUNCTION__)); ++ goto fail; ++ } ++ ++ usbos_info->rxbuf_len = (uint)usbos_info->pub->rxsize; ++ ++ ++ ++ atomic_set(&usbos_info->txallocated, 0); ++ if (DBUS_OK != dbus_usbos_urbreqs_alloc(usbos_info, ++ usbos_info->pub->ntxq, FALSE)) { ++ goto fail; ++ } ++ ++ atomic_set(&usbos_info->rxallocated, 0); ++ if (DBUS_OK != dbus_usbos_urbreqs_alloc(usbos_info, ++ MIN(DBUS_USB_RXQUEUE_BATCH_ADD, usbos_info->pub->nrxq), ++ TRUE)) { ++ goto fail; ++ } ++ ++ sema_init(&usbos_info->ctl_lock, 1); ++ ++#ifdef USBOS_THREAD ++ if (dbus_usbos_thread_init(usbos_info) == NULL) ++ goto fail; ++#endif /* USBOS_THREAD */ ++ ++#ifdef USBOS_TX_THREAD ++ if (dbus_usbos_tx_thread_init(usbos_info) == NULL) ++ goto fail; ++#endif /* USBOS_TX_THREAD */ ++ ++ pub->dev_info = g_probe_info.usb; ++ ++ ++ return (void *) usbos_info; ++fail: ++ if (usbos_info->intr_urb) { ++ USB_FREE_URB(usbos_info->intr_urb); ++ usbos_info->intr_urb = NULL; ++ } ++ ++ if (usbos_info->ctl_urb) { ++ USB_FREE_URB(usbos_info->ctl_urb); ++ usbos_info->ctl_urb = NULL; ++ } ++ ++#if defined(BCM_REQUEST_FW) ++ if (usbos_info->blk_urb) { ++ USB_FREE_URB(usbos_info->blk_urb); ++ usbos_info->blk_urb = NULL; ++ } ++#endif ++ ++ dbus_usbos_urbreqs_free(usbos_info, TRUE); ++ atomic_set(&usbos_info->rxallocated, 0); ++ dbus_usbos_urbreqs_free(usbos_info, FALSE); ++ atomic_set(&usbos_info->txallocated, 0); ++ ++ g_probe_info.usbos_info = NULL; ++ ++ MFREE(pub->osh, usbos_info, sizeof(usbos_info_t)); ++ return NULL; ++} /* dbus_usbos_intf_attach */ ++ ++void ++dbus_usbos_intf_detach(dbus_pub_t *pub, void *info) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *) info; ++ osl_t *osh = pub->osh; ++ ++ if (usbos_info == NULL) { ++ return; ++ } ++ ++#ifdef USBOS_TX_THREAD ++ dbus_usbos_tx_thread_deinit(usbos_info); ++#endif /* USBOS_TX_THREAD */ ++ ++ /* Must unlink all URBs prior to driver unload; ++ * otherwise an URB callback can occur after driver ++ * has been de-allocated and rmmod'd ++ */ ++ dbusos_stop(usbos_info); ++ ++ if (usbos_info->intr_urb) { ++ USB_FREE_URB(usbos_info->intr_urb); ++ usbos_info->intr_urb = NULL; ++ } ++ ++ if (usbos_info->ctl_urb) { ++ USB_FREE_URB(usbos_info->ctl_urb); ++ usbos_info->ctl_urb = NULL; ++ } ++ ++ if (usbos_info->blk_urb) { ++ USB_FREE_URB(usbos_info->blk_urb); ++ usbos_info->blk_urb = NULL; ++ } ++ ++ dbus_usbos_urbreqs_free(usbos_info, TRUE); ++ atomic_set(&usbos_info->rxallocated, 0); ++ dbus_usbos_urbreqs_free(usbos_info, FALSE); ++ atomic_set(&usbos_info->txallocated, 0); ++ ++#ifdef USBOS_THREAD ++ dbus_usbos_thread_deinit(usbos_info); ++#endif /* USBOS_THREAD */ ++ ++ g_probe_info.usbos_info = NULL; ++ MFREE(osh, usbos_info, sizeof(usbos_info_t)); ++} /* dbus_usbos_intf_detach */ ++ ++ ++#ifdef USBOS_TX_THREAD ++ ++void* ++dbus_usbos_tx_thread_init(usbos_info_t *usbos_info) ++{ ++ spin_lock_init(&usbos_info->usbos_tx_list_lock); ++ INIT_LIST_HEAD(&usbos_info->usbos_tx_list); ++ init_waitqueue_head(&usbos_info->usbos_tx_queue_head); ++ ++ usbos_info->usbos_tx_kt = kthread_create(dbus_usbos_tx_thread_func, ++ usbos_info, "usb-tx-thread"); ++ ++ if (IS_ERR(usbos_info->usbos_tx_kt)) { ++ DBUSERR(("Thread Creation failed\n")); ++ return (NULL); ++ } ++ ++ usbos_info->ctl_state = USBOS_REQUEST_STATE_UNSCHEDULED; ++ wake_up_process(usbos_info->usbos_tx_kt); ++ ++ return (usbos_info->usbos_tx_kt); ++} ++ ++void ++dbus_usbos_tx_thread_deinit(usbos_info_t *usbos_info) ++{ ++ urb_req_t *req; ++ ++ if (usbos_info->usbos_tx_kt) { ++ wake_up_interruptible(&usbos_info->usbos_tx_queue_head); ++ kthread_stop(usbos_info->usbos_tx_kt); ++ } ++ ++ /* Move pending requests to free queue so they can be freed */ ++ while ((req = dbus_usbos_qdeq( ++ &usbos_info->usbos_tx_list, &usbos_info->usbos_tx_list_lock)) != NULL) { ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req, &usbos_info->txfree_lock); ++ } ++} ++ ++/** ++ * Allow USB in-band resume to block by submitting CTRL and DATA URBs on a separate thread. ++ */ ++int ++dbus_usbos_tx_thread_func(void *data) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *)data; ++ urb_req_t *req; ++ dbus_irb_tx_t *txirb; ++ int ret; ++ unsigned long flags; ++ ++#ifdef WL_THREADNICE ++ set_user_nice(current, WL_THREADNICE); ++#endif ++ ++ while (1) { ++ /* Wait until there are URBs to submit */ ++ wait_event_interruptible_timeout( ++ usbos_info->usbos_tx_queue_head, ++ !list_empty(&usbos_info->usbos_tx_list) || ++ usbos_info->ctl_state == USBOS_REQUEST_STATE_SCHEDULED, ++ 100); ++ ++ if (kthread_should_stop()) ++ break; ++ ++ /* Submit CTRL URB if needed */ ++ if (usbos_info->ctl_state == USBOS_REQUEST_STATE_SCHEDULED) { ++ ++ /* Disable USB autosuspend until this request completes. If the ++ * interface was suspended, this call blocks until it has been resumed. ++ */ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ usbos_info->ctl_state = USBOS_REQUEST_STATE_SUBMITTED; ++ ++ ret = USB_SUBMIT_URB(usbos_info->ctl_urb); ++ if (ret != 0) { ++ DBUSERR(("%s CTRL USB_SUBMIT_URB failed, status %d\n", ++ __FUNCTION__, ret)); ++ ++ usbos_info->ctl_state = USBOS_REQUEST_STATE_UNSCHEDULED; ++ up(&usbos_info->ctl_lock); ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++ } ++ } ++ ++ /* Submit all available TX URBs */ ++ while ((req = dbus_usbos_qdeq(&usbos_info->usbos_tx_list, ++ &usbos_info->usbos_tx_list_lock)) != NULL) { ++ ++ /* Disable USB autosuspend until this request completes. If the ++ * interface was suspended, this call blocks until it has been resumed. ++ */ ++ USB_AUTOPM_GET_INTERFACE(g_probe_info.intf); ++ ++ spin_lock_irqsave(&usbos_info->txlock, flags); ++ ++ ret = USB_SUBMIT_URB(req->urb); ++ if (ret == 0) { ++ /* URB submitted successfully */ ++ dbus_usbos_qenq(&usbos_info->req_txpostedq, req, ++ &usbos_info->txposted_lock); ++ atomic_inc(&usbos_info->txposted); ++ } else { ++ /* Submitting the URB failed. */ ++ DBUSERR(("%s TX USB_SUBMIT_URB failed, status %d\n", ++ __FUNCTION__, ret)); ++ ++ USB_AUTOPM_PUT_INTERFACE_ASYNC(g_probe_info.intf); ++ } ++ ++ spin_unlock_irqrestore(&usbos_info->txlock, flags); ++ ++ if (ret != 0) { ++ /* Cleanup and notify higher layers */ ++ dbus_usbos_qenq(&usbos_info->req_txfreeq, req, ++ &usbos_info->txfree_lock); ++ ++ txirb = req->arg; ++ if (txirb->send_buf) { ++ MFREE(usbos_info->pub->osh, txirb->send_buf, req->buf_len); ++ txirb->send_buf = NULL; ++ req->buf_len = 0; ++ } ++ ++ if (likely (usbos_info->cbarg && usbos_info->cbs)) { ++ if (likely (usbos_info->cbs->send_irb_complete != NULL)) ++ usbos_info->cbs->send_irb_complete( ++ usbos_info->cbarg, txirb, DBUS_ERR_TXDROP); ++ } ++ } ++ } ++ } ++ ++ return 0; ++} /* dbus_usbos_tx_thread_func */ ++ ++#endif /* USBOS_TX_THREAD */ ++ ++#ifdef USBOS_THREAD ++ ++/** ++ * Increase system performance by creating a USB thread that runs parallel to other system ++ * activity. ++ */ ++static void* ++dbus_usbos_thread_init(usbos_info_t *usbos_info) ++{ ++ usbos_list_entry_t *entry; ++ unsigned long flags, ii; ++ ++ spin_lock_init(&usbos_info->usbos_list_lock); ++ spin_lock_init(&usbos_info->ctrl_lock); ++ INIT_LIST_HEAD(&usbos_info->usbos_list); ++ INIT_LIST_HEAD(&usbos_info->usbos_free_list); ++ init_waitqueue_head(&usbos_info->usbos_queue_head); ++ atomic_set(&usbos_info->usbos_list_cnt, 0); ++ ++ ++ for (ii = 0; ii < (usbos_info->pub->nrxq + usbos_info->pub->ntxq); ii++) { ++ entry = MALLOC(usbos_info->pub->osh, sizeof(usbos_list_entry_t)); ++ if (entry) { ++ spin_lock_irqsave(&usbos_info->usbos_list_lock, flags); ++ list_add_tail((struct list_head*) entry, &usbos_info->usbos_free_list); ++ spin_unlock_irqrestore(&usbos_info->usbos_list_lock, flags); ++ } else { ++ DBUSERR(("Failed to create list\n")); ++ } ++ } ++ ++ usbos_info->usbos_kt = kthread_create(dbus_usbos_thread_func, ++ usbos_info, "usb-thread"); ++ ++ if (IS_ERR(usbos_info->usbos_kt)) { ++ DBUSERR(("Thread Creation failed\n")); ++ return (NULL); ++ } ++ ++ wake_up_process(usbos_info->usbos_kt); ++ ++ return (usbos_info->usbos_kt); ++} ++ ++static void ++dbus_usbos_thread_deinit(usbos_info_t *usbos_info) ++{ ++ struct list_head *cur, *next; ++ usbos_list_entry_t *entry; ++ unsigned long flags; ++ ++ if (usbos_info->usbos_kt) { ++ wake_up_interruptible(&usbos_info->usbos_queue_head); ++ kthread_stop(usbos_info->usbos_kt); ++ } ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wcast-qual" ++#endif ++ list_for_each_safe(cur, next, &usbos_info->usbos_list) ++ { ++ entry = list_entry(cur, struct usbos_list_entry, list); ++ /* detach this entry from the list and then free the entry */ ++ spin_lock_irqsave(&usbos_info->usbos_list_lock, flags); ++ list_del(cur); ++ MFREE(usbos_info->pub->osh, entry, sizeof(usbos_list_entry_t)); ++ spin_unlock_irqrestore(&usbos_info->usbos_list_lock, flags); ++ } ++ ++ list_for_each_safe(cur, next, &usbos_info->usbos_free_list) ++ { ++ entry = list_entry(cur, struct usbos_list_entry, list); ++ /* detach this entry from the list and then free the entry */ ++ spin_lock_irqsave(&usbos_info->usbos_list_lock, flags); ++ list_del(cur); ++ MFREE(usbos_info->pub->osh, entry, sizeof(usbos_list_entry_t)); ++ spin_unlock_irqrestore(&usbos_info->usbos_list_lock, flags); ++ } ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic pop ++#endif ++} ++ ++/** Process completed URBs in a worker thread */ ++static int ++dbus_usbos_thread_func(void *data) ++{ ++ usbos_info_t *usbos_info = (usbos_info_t *)data; ++ usbos_list_entry_t *entry; ++ struct list_head *cur, *next; ++ unsigned long flags; ++ ++#ifdef WL_THREADNICE ++ set_user_nice(current, WL_THREADNICE); ++#endif ++ ++ while (1) { ++ /* If the list is empty, then go to sleep */ ++ wait_event_interruptible_timeout ++ (usbos_info->usbos_queue_head, ++ atomic_read(&usbos_info->usbos_list_cnt) > 0, ++ 100); ++ ++ if (kthread_should_stop()) ++ break; ++ ++ spin_lock_irqsave(&usbos_info->usbos_list_lock, flags); ++ ++ /* For each entry on the list, process it. Remove the entry from ++ * the list when done. ++ */ ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wcast-qual" ++#endif ++ list_for_each_safe(cur, next, &usbos_info->usbos_list) ++ { ++ urb_req_t *req; ++ int len; ++ int stat; ++ usbos_info_t *usbos_info_local; ++ ++ entry = list_entry(cur, struct usbos_list_entry, list); ++ if (entry == NULL) ++ break; ++ ++ req = entry->urb_context; ++ len = entry->urb_length; ++ stat = entry->urb_status; ++ usbos_info_local = req->usbinfo; ++ ++ /* detach this entry from the list and attach it to the free list */ ++ list_del_init(cur); ++ spin_unlock_irqrestore(&usbos_info_local->usbos_list_lock, flags); ++ ++ dbus_usbos_recv_complete_handle(req, len, stat); ++ ++ spin_lock_irqsave(&usbos_info_local->usbos_list_lock, flags); ++ ++ list_add_tail(cur, &usbos_info_local->usbos_free_list); ++ ++ atomic_dec(&usbos_info_local->usbos_list_cnt); ++ } ++ ++ spin_unlock_irqrestore(&usbos_info->usbos_list_lock, flags); ++ ++ } ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic pop ++#endif ++ ++ return 0; ++} /* dbus_usbos_thread_func */ ++ ++/** Called on Linux calling URB callback, see dbus_usbos_recv_complete() */ ++static void ++dbus_usbos_dispatch_schedule(CALLBACK_ARGS) ++{ ++ urb_req_t *req = urb->context; ++ usbos_info_t *usbos_info = req->usbinfo; ++ usbos_list_entry_t *entry; ++ unsigned long flags; ++ struct list_head *cur; ++ ++ spin_lock_irqsave(&usbos_info->usbos_list_lock, flags); ++ ++ cur = usbos_info->usbos_free_list.next; ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wcast-qual" ++#endif ++ entry = list_entry(cur, struct usbos_list_entry, list); ++#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) ++#pragma GCC diagnostic pop ++#endif ++ ++ /* detach this entry from the free list and prepare it insert it to use list */ ++ list_del_init(cur); ++ ++ if (entry) { ++ entry->urb_context = urb->context; ++ entry->urb_length = urb->actual_length; ++ entry->urb_status = urb->status; ++ ++ atomic_inc(&usbos_info->usbos_list_cnt); ++ list_add_tail(cur, &usbos_info->usbos_list); ++ } else { ++ DBUSERR(("!!!!!!OUT OF MEMORY!!!!!!!\n")); ++ } ++ ++ spin_unlock_irqrestore(&usbos_info->usbos_list_lock, flags); ++ ++ /* thread */ ++ wake_up_interruptible(&usbos_info->usbos_queue_head); ++} /* dbus_usbos_dispatch_schedule */ ++ ++#endif /* USBOS_THREAD */ ++ ++ ++ ++ ++#ifdef BCM_REQUEST_FW ++ ++struct request_fw_context { ++ const struct firmware *firmware; ++ struct semaphore lock; ++}; ++ ++/* ++ * Callback for dbus_request_firmware(). ++ */ ++static void ++dbus_request_firmware_done(const struct firmware *firmware, void *ctx) ++{ ++ struct request_fw_context *context = (struct request_fw_context*)ctx; ++ ++ /* Store the received firmware handle in the context and wake requester */ ++ context->firmware = firmware; ++ up(&context->lock); ++} ++ ++/* ++ * Send a firmware request and wait for completion. ++ * ++ * The use of the asynchronous version of request_firmware() is needed to avoid ++ * kernel oopses when we just come out of system hibernate. ++ */ ++static int ++dbus_request_firmware(const char *name, const struct firmware **firmware) ++{ ++ struct request_fw_context *context; ++ int ret; ++ ++ context = kzalloc(sizeof(*context), GFP_KERNEL); ++ if (!context) ++ return -ENOMEM; ++ ++ sema_init(&context->lock, 0); ++ ++ ret = request_firmware_nowait(THIS_MODULE, true, name, &g_probe_info.usb->dev, ++ GFP_KERNEL, context, dbus_request_firmware_done); ++ if (ret) { ++ kfree(context); ++ return ret; ++ } ++ ++ /* Wait for completion */ ++ if (down_interruptible(&context->lock) != 0) { ++ kfree(context); ++ return -ERESTARTSYS; ++ } ++ ++ *firmware = context->firmware; ++ kfree(context); ++ ++ return *firmware != NULL ? 0 : -ENOENT; ++} ++ ++static void * ++dbus_get_fwfile(int devid, int chiprev, uint8 **fw, int *fwlen, uint16 boardtype, uint16 boardrev) ++{ ++ const struct firmware *firmware = NULL; ++#ifndef OEM_ANDROID ++ s8 *device_id = NULL; ++ s8 *chip_rev = ""; ++#endif /* OEM_ANDROID */ ++ s8 file_name[64]; ++ int ret; ++ ++#ifndef OEM_ANDROID ++ switch (devid) { ++ case BCM4350_CHIP_ID: ++ case BCM4354_CHIP_ID: ++ case BCM43556_CHIP_ID: ++ case BCM43558_CHIP_ID: ++ case BCM43566_CHIP_ID: ++ case BCM43568_CHIP_ID: ++ case BCM43570_CHIP_ID: ++ case BCM4358_CHIP_ID: ++ device_id = "4350"; ++ break; ++ case BCM43143_CHIP_ID: ++ device_id = "43143"; ++ break; ++ case BCM43234_CHIP_ID: ++ case BCM43235_CHIP_ID: ++ case BCM43236_CHIP_ID: ++ device_id = "43236"; ++ break; ++ case BCM43242_CHIP_ID: ++ device_id = "43242"; ++ break; ++ case BCM43238_CHIP_ID: ++ device_id = "43238"; ++ break; ++ case BCM43526_CHIP_ID: ++ device_id = "43526"; ++ break; ++ case BCM43569_CHIP_ID: ++ device_id = "43569"; ++ switch (chiprev) { ++ case 0: ++ chip_rev = "a0"; ++ break; ++ case 2: ++ chip_rev = "a2"; ++ break; ++ default: ++ break; ++ } ++ break; ++ default: ++ DBUSERR(("unsupported device %x\n", devid)); ++ return NULL; ++ } ++ ++ /* Load firmware */ ++ snprintf(file_name, sizeof(file_name), "brcm/bcm%s%s-firmware.bin", device_id, chip_rev); ++#else ++ snprintf(file_name, sizeof(file_name), "%s", CONFIG_ANDROID_BCMDHD_FW_PATH); ++#endif /* OEM_ANDROID */ ++ ++ ret = dbus_request_firmware(file_name, &firmware); ++ if (ret) { ++ DBUSERR(("fail to request firmware %s\n", file_name)); ++ return NULL; ++ } ++ ++ *fwlen = firmware->size; ++ *fw = (uint8 *)firmware->data; ++ return (void *)firmware; ++ ++} ++ ++static void * ++dbus_get_nvfile(int devid, int chiprev, uint8 **fw, int *fwlen, uint16 boardtype, uint16 boardrev) ++{ ++ const struct firmware *firmware = NULL; ++#ifndef OEM_ANDROID ++ s8 *device_id = NULL; ++ s8 *chip_rev = ""; ++#endif /* OEM_ANDROID */ ++ s8 file_name[64]; ++ int ret; ++ ++#ifndef OEM_ANDROID ++ switch (devid) { ++ case BCM4350_CHIP_ID: ++ case BCM4354_CHIP_ID: ++ case BCM43556_CHIP_ID: ++ case BCM43558_CHIP_ID: ++ case BCM43566_CHIP_ID: ++ case BCM43568_CHIP_ID: ++ case BCM43570_CHIP_ID: ++ case BCM4358_CHIP_ID: ++ device_id = "4350"; ++ break; ++ case BCM43143_CHIP_ID: ++ device_id = "43143"; ++ break; ++ case BCM43234_CHIP_ID: ++ device_id = "43234"; ++ break; ++ case BCM43235_CHIP_ID: ++ device_id = "43235"; ++ break; ++ case BCM43236_CHIP_ID: ++ device_id = "43236"; ++ break; ++ case BCM43238_CHIP_ID: ++ device_id = "43238"; ++ break; ++ case BCM43242_CHIP_ID: ++ device_id = "43242"; ++ break; ++ case BCM43526_CHIP_ID: ++ device_id = "43526"; ++ break; ++ case BCM43569_CHIP_ID: ++ device_id = "43569"; ++ switch (chiprev) { ++ case 0: ++ chip_rev = "a0"; ++ break; ++ case 2: ++ chip_rev = "a2"; ++ break; ++ default: ++ break; ++ } ++ break; ++ default: ++ DBUSERR(("unsupported device %x\n", devid)); ++ return NULL; ++ } ++ ++ /* Load board specific nvram file */ ++ snprintf(file_name, sizeof(file_name), "brcm/bcm%s%s-%2x-%2x.nvm", ++ device_id, chip_rev, boardtype, boardrev); ++#else ++ snprintf(file_name, sizeof(file_name), "%s", CONFIG_ANDROID_BCMDHD_NVRAM_PATH); ++#endif /* OEM_ANDROID */ ++ ++ ret = dbus_request_firmware(file_name, &firmware); ++ if (ret) { ++ DBUSERR(("fail to request nvram %s\n", file_name)); ++ ++#ifndef OEM_ANDROID ++ /* Load generic nvram file */ ++ snprintf(file_name, sizeof(file_name), "brcm/bcm%s%s.nvm", ++ device_id, chip_rev); ++ ++ ret = dbus_request_firmware(file_name, &firmware); ++#endif /* OEM_ANDROID */ ++ ++ if (ret) { ++ DBUSERR(("fail to request nvram %s\n", file_name)); ++ return NULL; ++ } ++ } ++ ++ *fwlen = firmware->size; ++ *fw = (uint8 *)firmware->data; ++ return (void *)firmware; ++} ++ ++void * ++dbus_get_fw_nvfile(int devid, int chiprev, uint8 **fw, int *fwlen, int type, uint16 boardtype, ++ uint16 boardrev) ++{ ++ switch (type) { ++ case DBUS_FIRMWARE: ++ return dbus_get_fwfile(devid, chiprev, fw, fwlen, boardtype, boardrev); ++ case DBUS_NVFILE: ++ return dbus_get_nvfile(devid, chiprev, fw, fwlen, boardtype, boardrev); ++ default: ++ return NULL; ++ } ++} ++ ++void ++dbus_release_fw_nvfile(void *firmware) ++{ ++ release_firmware((struct firmware *)firmware); ++} ++#endif /* BCM_REQUEST_FW */ ++ ++#ifdef BCMUSBDEV_COMPOSITE ++/** ++ * For a composite device the interface order is not guaranteed, scan the device struct for the WLAN ++ * interface. ++ */ ++static int ++dbus_usbos_intf_wlan(struct usb_device *usb) ++{ ++ int i, num_of_eps, ep, intf_wlan = -1; ++ int num_intf = CONFIGDESC(usb)->bNumInterfaces; ++ struct usb_endpoint_descriptor *endpoint; ++ ++ for (i = 0; i < num_intf; i++) { ++ if (IFDESC(usb, i).bInterfaceClass != USB_CLASS_VENDOR_SPEC) ++ continue; ++ num_of_eps = IFDESC(usb, i).bNumEndpoints; ++ ++ for (ep = 0; ep < num_of_eps; ep++) { ++ endpoint = &IFEPDESC(usb, i, ep); ++ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == ++ USB_ENDPOINT_XFER_BULK) { ++ intf_wlan = i; ++ break; ++ } ++ } ++ if (ep < num_of_eps) ++ break; ++ } ++ ++ return intf_wlan; ++} ++#endif /* BCMUSBDEV_COMPOSITE */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd.h +index 6b413b5727a7..eb6edcb9b3ea 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd.h +@@ -51,6 +51,9 @@ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) + #include + #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#include ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) */ + /* The kernel threading is sdio-specific */ + struct task_struct; + struct sched_param; +@@ -106,6 +109,7 @@ enum dhd_bus_state { + DHD_BUS_DATA, /* Ready for frame transfers */ + DHD_BUS_SUSPEND, /* Bus has been suspended */ + DHD_BUS_DOWN_IN_PROGRESS, /* Bus going Down */ ++ DHD_BUS_REMOVE, /* Bus has been removed */ + }; + + /* +@@ -217,7 +221,11 @@ enum dhd_bus_state { + DHD_BUS_BUSY_CHECK_RPM_SUSPEND_IN_PROGRESS(dhdp)) + + #define DHD_BUS_CHECK_DOWN_OR_DOWN_IN_PROGRESS(dhdp) \ +- ((dhdp)->busstate == DHD_BUS_DOWN || (dhdp)->busstate == DHD_BUS_DOWN_IN_PROGRESS) ++ ((dhdp)->busstate == DHD_BUS_DOWN || (dhdp)->busstate == DHD_BUS_DOWN_IN_PROGRESS || \ ++ (dhdp)->busstate == DHD_BUS_REMOVE) ++ ++#define DHD_BUS_CHECK_REMOVE(dhdp) \ ++ ((dhdp)->busstate == DHD_BUS_REMOVE) + + /* Macro to print Ethernet Address as String + * expects both arguements as (char *) +@@ -667,6 +675,9 @@ typedef struct dhd_pub { + * please do NOT merge it back from other branches !!! + */ + ++#ifdef BCMDBUS ++ struct dbus_pub *dbus; ++#endif /* BCMDBUS */ + + /* Internal dhd items */ + bool up; /* Driver up/down (to OS) */ +@@ -1028,6 +1039,10 @@ typedef struct dhd_pub { + char *clm_path; /* module_param: path to clm vars file */ + char *conf_path; /* module_param: path to config vars file */ + struct dhd_conf *conf; /* Bus module handle */ ++ void *adapter; /* adapter information, interrupt, fw path etc. */ ++#ifdef BCMDBUS ++ bool dhd_remove; ++#endif /* BCMDBUS */ + } dhd_pub_t; + + typedef struct { +@@ -1347,12 +1362,36 @@ typedef enum dhd_ioctl_recieved_status + */ + void dhd_net_if_lock(struct net_device *dev); + void dhd_net_if_unlock(struct net_device *dev); +- + #if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 +-extern struct mutex _dhd_sdio_mutex_lock_; ++extern void wl_android_post_init(void); // terence 20120530: fix critical section in dhd_open and dhdsdio_probe ++#endif ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && defined(MULTIPLE_SUPPLICANT) ++extern struct mutex _dhd_mutex_lock_; ++#define DHD_MUTEX_IS_LOCK_RETURN() \ ++ if (mutex_is_locked(&_dhd_mutex_lock_) != 0) { \ ++ printf("%s : probe is already running! return.\n", __FUNCTION__); \ ++ return 0; \ ++ } ++#define DHD_MUTEX_LOCK() \ ++ do { \ ++ if (mutex_is_locked(&_dhd_mutex_lock_) == 0) { \ ++ printf("%s : no mutex held. set lock\n", __FUNCTION__); \ ++ } else { \ ++ printf("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__); \ ++ } \ ++ mutex_lock(&_dhd_mutex_lock_); \ ++ } while (0) ++#define DHD_MUTEX_UNLOCK() \ ++ do { \ ++ mutex_unlock(&_dhd_mutex_lock_); \ ++ printf("%s : the lock is released.\n", __FUNCTION__); \ ++ } while (0) ++#else ++#define DHD_MUTEX_IS_LOCK_RETURN(a) do {} while (0) ++#define DHD_MUTEX_LOCK(a) do {} while (0) ++#define DHD_MUTEX_UNLOCK(a) do {} while (0) + #endif +-#endif /* MULTIPLE_SUPPLICANT */ + + typedef enum dhd_attach_states + { +@@ -1386,7 +1425,11 @@ typedef enum dhd_attach_states + * Returned structure should have bus and prot pointers filled in. + * bus_hdrlen specifies required headroom for bus module header. + */ +-extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen); ++extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen ++#ifdef BCMDBUS ++ , void *adapter ++#endif ++); + #if defined(WLP2P) && defined(WL_CFG80211) + /* To allow attach/detach calls corresponding to p2p0 interface */ + extern int dhd_attach_p2p(dhd_pub_t *); +@@ -1482,7 +1525,7 @@ extern void dhd_os_dhdiovar_lock(dhd_pub_t *pub); + extern void dhd_os_dhdiovar_unlock(dhd_pub_t *pub); + extern int dhd_os_proto_block(dhd_pub_t * pub); + extern int dhd_os_proto_unblock(dhd_pub_t * pub); +-extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition); ++extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition, bool resched); + extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub); + extern unsigned int dhd_os_get_ioctl_resp_timeout(void); + extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec); +@@ -1700,6 +1743,9 @@ extern int dhd_event_ifdel(struct dhd_info *dhd, struct wl_event_data_if *ifeven + char *name, uint8 *mac); + extern int dhd_event_ifchange(struct dhd_info *dhd, struct wl_event_data_if *ifevent, + char *name, uint8 *mac); ++#ifdef DHD_UPDATE_INTF_MAC ++extern int dhd_op_if_update(dhd_pub_t *dhdpub, int ifidx); ++#endif /* DHD_UPDATE_INTF_MAC */ + extern struct net_device* dhd_allocate_if(dhd_pub_t *dhdpub, int ifidx, const char *name, + uint8 *mac, uint8 bssidx, bool need_rtnl_lock, const char *dngl_name); + extern int dhd_remove_if(dhd_pub_t *dhdpub, int ifidx, bool need_rtnl_lock); +@@ -1821,6 +1867,9 @@ extern uint dhd_console_ms; + extern uint android_msg_level; + extern uint config_msg_level; + extern uint sd_msglevel; ++#ifdef BCMDBUS ++extern uint dbus_msglevel; ++#endif /* BCMDBUS */ + #ifdef WL_WIRELESS_EXT + extern uint iw_msg_level; + #endif +@@ -2031,7 +2080,9 @@ extern char fw_path2[MOD_PARAM_PATHLEN]; + + /* Flag to indicate if we should download firmware on driver load */ + extern uint dhd_download_fw_on_driverload; ++#ifndef BCMDBUS + extern int allow_delay_fwdl; ++#endif /* !BCMDBUS */ + + extern int dhd_process_cid_mac(dhd_pub_t *dhdp, bool prepost); + extern int dhd_write_file(const char *filepath, char *buf, int buf_len); +@@ -2226,6 +2277,12 @@ extern void dhd_os_general_spin_unlock(dhd_pub_t *pub, unsigned long flags); + + extern void dhd_dump_to_kernelog(dhd_pub_t *dhdp); + ++#ifdef BCMDBUS ++extern uint dhd_get_rxsz(dhd_pub_t *pub); ++extern void dhd_set_path(dhd_pub_t *pub); ++extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); ++extern void dhd_bus_clearcounts(dhd_pub_t *dhdp); ++#endif /* BCMDBUS */ + + #ifdef DHD_L2_FILTER + extern int dhd_get_parp_status(dhd_pub_t *dhdp, uint32 idx); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_bus.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_bus.h +index c785f1210997..e0f048333077 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_bus.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_bus.h +@@ -33,6 +33,10 @@ + #ifndef _dhd_bus_h_ + #define _dhd_bus_h_ + ++extern int dbus_up(struct dhd_bus *pub); ++extern int dbus_stop(struct dhd_bus *pub); ++extern int dbus_send_ctl(struct dhd_bus *pub, uint8 *buf, int len); ++extern int dbus_recv_ctl(struct dhd_bus *pub, uint8 *buf, int len); + /* + * Exported from dhd bus module (dhd_usb, dhd_sdio) + */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c +old mode 100755 +new mode 100644 +index 11344de2a068..3fb5e457040a +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cdc.c +@@ -49,6 +49,9 @@ + #include + #include + #endif ++#ifdef BCMDBUS ++#include ++#endif /* BCMDBUS */ + + #ifdef DHD_ULP + #include +@@ -68,15 +71,20 @@ typedef struct dhd_prot { + uint16 reqid; + uint8 pending; + uint32 lastcmd; ++#ifdef BCMDBUS ++ uint ctl_completed; ++#endif /* BCMDBUS */ + uint8 bus_header[BUS_HEADER_LEN]; + cdc_ioctl_t msg; + unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN]; + } dhd_prot_t; + +- + static int + dhdcdc_msg(dhd_pub_t *dhd) + { ++#ifdef BCMDBUS ++ int timeout = 0; ++#endif /* BCMDBUS */ + int err = 0; + dhd_prot_t *prot = dhd->prot; + int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t); +@@ -93,8 +101,51 @@ dhdcdc_msg(dhd_pub_t *dhd) + len = CDC_MAX_MSG_SIZE; + + /* Send request */ ++#ifdef BCMDBUS ++ DHD_OS_IOCTL_RESP_LOCK(dhd); ++ prot->ctl_completed = FALSE; ++ err = dbus_send_ctl(dhd->bus, (void *)&prot->msg, len); ++ if (err) { ++ DHD_ERROR(("dbus_send_ctl error=%d\n", err)); ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++ DHD_OS_WAKE_UNLOCK(dhd); ++ return err; ++ } ++#else + err = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len); +- ++#endif /* BCMDBUS */ ++ ++#ifdef BCMDBUS ++ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false); ++ if ((!timeout) || (!prot->ctl_completed)) { ++ DHD_ERROR(("Txctl timeout %d ctl_completed %d\n", ++ timeout, prot->ctl_completed)); ++ DHD_ERROR(("Txctl wait timed out\n")); ++ err = -1; ++ } ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++#endif /* BCMDBUS */ ++#if defined(BCMDBUS) && defined(INTR_EP_ENABLE) ++ /* If the ctl write is successfully completed, wait for an acknowledgement ++ * that indicates that it is now ok to do ctl read from the dongle ++ */ ++ if (err != -1) { ++ DHD_OS_IOCTL_RESP_LOCK(dhd); ++ prot->ctl_completed = FALSE; ++ if (dbus_poll_intr(dhd->dbus)) { ++ DHD_ERROR(("dbus_poll_intr not submitted\n")); ++ } else { ++ /* interrupt polling is sucessfully submitted. Wait for dongle to send ++ * interrupt ++ */ ++ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false); ++ if (!timeout) { ++ DHD_ERROR(("intr poll wait timed out\n")); ++ } ++ } ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++ } ++#endif /* defined(BCMDBUS) && defined(INTR_EP_ENABLE) */ + DHD_OS_WAKE_UNLOCK(dhd); + return err; + } +@@ -102,6 +153,9 @@ dhdcdc_msg(dhd_pub_t *dhd) + static int + dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len) + { ++#ifdef BCMDBUS ++ int timeout = 0; ++#endif /* BCMDBUS */ + int ret; + int cdc_len = len + sizeof(cdc_ioctl_t); + dhd_prot_t *prot = dhd->prot; +@@ -109,11 +163,37 @@ dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len) + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + + do { ++#ifdef BCMDBUS ++ DHD_OS_IOCTL_RESP_LOCK(dhd); ++ prot->ctl_completed = FALSE; ++ ret = dbus_recv_ctl(dhd->bus, (uchar*)&prot->msg, cdc_len); ++ if (ret) { ++ DHD_ERROR(("dbus_recv_ctl error=0x%x(%d)\n", ret, ret)); ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++ goto done; ++ } ++ timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false); ++ if ((!timeout) || (!prot->ctl_completed)) { ++ DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n", ++ timeout, prot->ctl_completed)); ++ ret = -1; ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++ ++ goto done; ++ } ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++ ++ ret = cdc_len; ++#else + ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, cdc_len); ++#endif /* BCMDBUS */ + if (ret < 0) + break; + } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id); + ++#ifdef BCMDBUS ++done: ++#endif /* BCMDBUS */ + return ret; + } + +@@ -286,6 +366,25 @@ done: + return ret; + } + ++#ifdef BCMDBUS ++int ++dhd_prot_ctl_complete(dhd_pub_t *dhd) ++{ ++ dhd_prot_t *prot; ++ ++ if (dhd == NULL) ++ return BCME_ERROR; ++ ++ prot = dhd->prot; ++ ++ ASSERT(prot); ++ DHD_OS_IOCTL_RESP_LOCK(dhd); ++ prot->ctl_completed = TRUE; ++ dhd_os_ioctl_resp_wake(dhd); ++ DHD_OS_IOCTL_RESP_UNLOCK(dhd); ++ return 0; ++} ++#endif /* BCMDBUS */ + + int + dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len) +@@ -487,6 +586,12 @@ dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf, uchar *reorder_buf_in + dhd_wlfc_parse_header_info(dhd, pktbuf, (data_offset << 2), + reorder_buf_info, reorder_info_len); + ++#ifdef BCMDBUS ++#ifndef DHD_WLFC_THREAD ++ dhd_wlfc_commit_packets(dhd, ++ (f_commitpkt_t)dhd_bus_txdata, dhd->bus, NULL, FALSE); ++#endif /* DHD_WLFC_THREAD */ ++#endif /* BCMDBUS */ + } + #endif /* PROP_TXSTATUS */ + +@@ -572,6 +677,14 @@ dhd_sync_with_dongle(dhd_pub_t *dhd) + ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_REVINFO, &revinfo, sizeof(revinfo), FALSE, 0); + if (ret < 0) + goto done; ++#if defined(BCMDBUS) ++ if (dhd_download_fw_on_driverload) { ++ dhd_conf_reset(dhd); ++ dhd_conf_set_chiprev(dhd, revinfo.chipnum, revinfo.chiprev); ++ dhd_conf_preinit(dhd); ++ dhd_conf_read_config(dhd, dhd->conf_path); ++ } ++#endif /* BCMDBUS */ + + + DHD_SSSR_DUMP_INIT(dhd); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cfg80211.c +old mode 100755 +new mode 100644 +index d01e7680142d..b98fcd36f599 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cfg80211.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_cfg80211.c +@@ -161,8 +161,10 @@ void dhd_netdev_free(struct net_device *ndev) + #ifdef WL_CFG80211 + ndev = dhd_cfg80211_netdev_free(ndev); + #endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + if (ndev) + free_netdev(ndev); ++#endif + } + + static s32 +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_common.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_common.c +index 485594e9c308..bbab84aebdc6 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_common.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_common.c +@@ -650,7 +650,11 @@ void* dhd_get_fwdump_buf(dhd_pub_t *dhd_pub, uint32 length) + int + dhd_common_socram_dump(dhd_pub_t *dhdp) + { ++#ifdef BCMDBUS ++ return 0; ++#else + return dhd_socram_dump(dhdp->bus); ++#endif /* BCMDBUS */ + } + + static int +@@ -1038,7 +1042,7 @@ dhd_iovar_parse_bssidx(dhd_pub_t *dhd_pub, const char *params, uint32 *idx, cons + return BCME_OK; + } + +-#if defined(DHD_DEBUG) && defined(BCMDHDUSB) ++#if defined(DHD_DEBUG) && defined(BCMDBUS) + /* USB Device console input function */ + int dhd_bus_console_in(dhd_pub_t *dhd, uchar *msg, uint msglen) + { +@@ -1047,7 +1051,7 @@ int dhd_bus_console_in(dhd_pub_t *dhd, uchar *msg, uint msglen) + return dhd_iovar(dhd, 0, "cons", msg, msglen, NULL, 0, TRUE); + + } +-#endif /* DHD_DEBUG && BCMDHDUSB */ ++#endif /* DHD_DEBUG && BCMDBUS */ + + #ifdef DHD_DEBUG + int +@@ -1263,10 +1267,12 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch + bcopy(&int_val, arg, val_size); + break; + ++#ifndef BCMDBUS + case IOV_GVAL(IOV_WDTICK): + int_val = (int32)dhd_watchdog_ms; + bcopy(&int_val, arg, val_size); + break; ++#endif /* !BCMDBUS */ + + case IOV_SVAL(IOV_WDTICK): + if (!dhd_pub->up) { +@@ -1285,6 +1291,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch + bcmerror = dhd_dump(dhd_pub, arg, len); + break; + ++#ifndef BCMDBUS + case IOV_GVAL(IOV_DCONSOLE_POLL): + int_val = (int32)dhd_console_ms; + bcopy(&int_val, arg, val_size); +@@ -1298,6 +1305,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch + if (len > 0) + bcmerror = dhd_bus_console_in(dhd_pub, arg, len - 1); + break; ++#endif /* !BCMDBUS */ + + case IOV_SVAL(IOV_CLEARCOUNTS): + dhd_pub->tx_packets = dhd_pub->rx_packets = 0; +@@ -1423,9 +1431,9 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch + + case IOV_GVAL(IOV_BUS_TYPE): + /* The dhd application queries the driver to check if its usb or sdio. */ +-#ifdef BCMDHDUSB ++#ifdef BCMDBUS + int_val = BUS_TYPE_USB; +-#endif ++#endif /* BCMDBUS */ + #ifdef BCMSDIO + int_val = BUS_TYPE_SDIO; + #endif +@@ -1952,6 +1960,8 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch + break; + } + #endif /* REPORT_FATAL_TIMEOUTS */ ++#ifdef DHD_DEBUG ++#if defined(BCMSDIO) || defined(BCMPCIE) + case IOV_GVAL(IOV_DONGLE_TRAP_TYPE): + if (dhd_pub->dongle_trap_occured) + int_val = ltoh32(dhd_pub->last_trap_info.type); +@@ -1971,8 +1981,6 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch + dhd_bus_dump_trap_info(dhd_pub->bus, &strbuf); + break; + } +-#ifdef DHD_DEBUG +-#if defined(BCMSDIO) || defined(BCMPCIE) + + case IOV_GVAL(IOV_BPADDR): + { +@@ -2820,12 +2828,14 @@ dngl_host_event_process(dhd_pub_t *dhdp, bcm_dngl_event_t *event, + #ifdef DHD_FW_COREDUMP + dhdp->memdump_type = DUMP_TYPE_DONGLE_HOST_EVENT; + #endif /* DHD_FW_COREDUMP */ ++#ifndef BCMDBUS + if (dhd_socram_dump(dhdp->bus)) { + DHD_ERROR(("%s: socram dump failed\n", __FUNCTION__)); + } else { + /* Notify framework */ + dhd_dbg_send_urgent_evt(dhdp, p, datalen); + } ++#endif /* !BCMDBUS */ + } + #endif /* DNGL_EVENT_SUPPORT */ + +@@ -3113,6 +3123,7 @@ wl_process_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata, uint pktlen + dhd_ifname2idx(dhd_pub->info, event->ifname), + &event->addr.octet); + break; ++#ifndef BCMDBUS + #if defined(DHD_FW_COREDUMP) + case WLC_E_PSM_WATCHDOG: + DHD_ERROR(("%s: WLC_E_PSM_WATCHDOG event received : \n", __FUNCTION__)); +@@ -3121,6 +3132,7 @@ wl_process_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata, uint pktlen + } + break; + #endif ++#endif /* !BCMDBUS */ + #ifdef DHD_WMF + case WLC_E_PSTA_PRIMARY_INTF_IND: + dhd_update_psta_interface_for_sta(dhd_pub, event->ifname, +@@ -3187,6 +3199,14 @@ wl_process_host_event(dhd_pub_t *dhd_pub, int *ifidx, void *pktdata, uint pktlen + + default: + *ifidx = dhd_ifname2idx(dhd_pub->info, event->ifname); ++#ifdef DHD_UPDATE_INTF_MAC ++ if ((WLC_E_LINK==type)&&(WLC_EVENT_MSG_LINK&flags)) { ++ dhd_event_ifchange(dhd_pub->info, ++ (struct wl_event_data_if *)event, ++ event->ifname, ++ event->addr.octet); ++ } ++#endif /* DHD_UPDATE_INTF_MAC */ + /* push up to external supp/auth */ + dhd_event(dhd_pub->info, (char *)pvt_data, evlen, *ifidx); + DHD_TRACE(("%s: MAC event %d, flags %x, status %x\n", +@@ -3580,7 +3600,7 @@ dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg) + htod16(WL_PKT_FILTER_MFLAG_NEG); + (argv[i])++; + } +- if (strlen(argv[i]) == 0) { ++ if (*argv[i] == '\0') { + printf("Pattern not provided\n"); + goto fail; + } +@@ -4271,6 +4291,8 @@ dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd) + } + } + ++ if (dhd->conf->suspend_bcn_li_dtim >= 0) ++ bcn_li_dtim = dhd->conf->suspend_bcn_li_dtim; + DHD_ERROR(("%s beacon=%d bcn_li_dtim=%d DTIM=%d Listen=%d\n", + __FUNCTION__, ap_beacon, bcn_li_dtim, dtim_period, CUSTOM_LISTEN_INTERVAL)); + +@@ -4865,7 +4887,7 @@ dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path) + char iovbuf[WLC_IOCTL_SMLEN] = {0}; + int status = FALSE; + +- if (clm_path[0] != '\0') { ++ if (clm_path && clm_path[0] != '\0') { + if (strlen(clm_path) > MOD_PARAM_PATHLEN) { + DHD_ERROR(("clm path exceeds max len\n")); + return BCME_ERROR; +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c +index 47480b261dd1..4f333a464fda 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c +@@ -1,5 +1,4 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ +- ++/* SPDX-License-Identifier: GPL-2.0 */ + #include + #include + +@@ -40,66 +39,6 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; + #define MAXSZ_BUF 1000 + #define MAXSZ_CONFIG 4096 + +-#define FW_TYPE_STA 0 +-#define FW_TYPE_APSTA 1 +-#define FW_TYPE_P2P 2 +-#define FW_TYPE_ES 3 +-#define FW_TYPE_MFG 4 +-#define FW_TYPE_G 0 +-#define FW_TYPE_AG 1 +- +-#ifdef CONFIG_PATH_AUTO_SELECT +-#ifdef BCMSDIO +-#define CONFIG_BCM4330B2 "config_40183b2.txt" +-#define CONFIG_BCM43362A0 "config_40181a0.txt" +-#define CONFIG_BCM43362A2 "config_40181a2.txt" +-#define CONFIG_BCM43438A0 "config_43438a0.txt" +-#define CONFIG_BCM43438A1 "config_43438a1.txt" +-#define CONFIG_BCM43436B0 "config_43436b0.txt" +-#define CONFIG_BCM4334B1 "config_4334b1.txt" +-#define CONFIG_BCM43341B0 "config_43341b0.txt" +-#define CONFIG_BCM43241B4 "config_43241b4.txt" +-#define CONFIG_BCM4339A0 "config_4339a0.txt" +-#define CONFIG_BCM43454C0 "config_43454c0.txt" +-#define CONFIG_BCM43455C0 "config_43455c0.txt" +-#define CONFIG_BCM43456C5 "config_43456c5.txt" +-#define CONFIG_BCM4354A1 "config_4354a1.txt" +-#endif +-#define CONFIG_BCM4356A2 "config_4356a2.txt" +-#define CONFIG_BCM4358A3 "config_4358a3.txt" +-#define CONFIG_BCM4359B1 "config_4359b1.txt" +-#define CONFIG_BCM4359C0 "config_4359c0.txt" +-#endif +- +-#ifdef BCMSDIO +-#define SBSDIO_CIS_SIZE_LIMIT 0x200 +- +-#define FW_BCM4330B2 "fw_RK903b2" +-#define FW_BCM4330B2_AG "fw_RK903_ag" +-#define FW_BCM43362A0 "fw_RK901a0" +-#define FW_BCM43362A2 "fw_RK901a2" +-#define FW_BCM4334B1 "fw_bcm4334b1_ag" +-#define FW_BCM43438A0 "fw_bcm43438a0" +-#define FW_BCM43438A1 "fw_bcm43438a1" +-#define FW_BCM43436B0 "fw_bcm43436b0" +-#define FW_BCM43012B0 "fw_bcm43012b0" +-#define FW_BCM43341B1 "fw_bcm43341b0_ag" +-#define FW_BCM43241B4 "fw_bcm43241b4_ag" +-#define FW_BCM4339A0 "fw_bcm4339a0_ag" +-#define FW_BCM43455C0 "fw_bcm43455c0_ag" +-#define FW_BCM43456C5 "fw_bcm43456c5_ag" +-#define FW_BCM4354A1 "fw_bcm4354a1_ag" +-#define FW_BCM4356A2 "fw_bcm4356a2_ag" +-#define FW_BCM4358A3 "fw_bcm4358a3_ag" +-#define FW_BCM4359B1 "fw_bcm4359b1_ag" +-#define FW_BCM4359C0 "fw_bcm4359c0_ag" +- +-#define CLM_BCM43012B0 "clm_bcm43012b0" +-#endif +-#ifdef BCMPCIE +-#define FW_BCM4356A2 "fw_bcm4356a2_pcie_ag" +-#endif +- + #define htod32(i) i + #define htod16(i) i + #define dtoh32(i) i +@@ -107,6 +46,61 @@ uint config_msg_level = CONFIG_ERROR_LEVEL; + #define htodchanspec(i) i + #define dtohchanspec(i) i + ++typedef struct cihp_name_map_t { ++ uint chip; ++ uint chiprev; ++ uint ag_type; ++ bool clm; ++ char *chip_name; ++ char *module_name; ++} cihp_name_map_t; ++ ++/* Map of WLC_E events to connection failure strings */ ++#define DONT_CARE 9999 ++const cihp_name_map_t chip_name_map [] = { ++ /* ChipID Chiprev AG CLM ChipName ModuleName */ ++#ifdef BCMSDIO ++ {BCM43362_CHIP_ID, 0, DONT_CARE, FALSE, "RK901a0", ""}, ++ //{BCM43362_CHIP_ID, 1, DONT_CARE, FALSE, "RK901a2", "nvram_AP6210.txt"}, ++ {BCM43362_CHIP_ID, 1, DONT_CARE, FALSE, "bcm40181a2", "nvram_ap6181.txt"}, ++ {BCM4330_CHIP_ID, 4, FW_TYPE_G, FALSE, "RK903b2", ""}, ++ {BCM4330_CHIP_ID, 4, FW_TYPE_AG, FALSE, "RK903_ag", "nvram_AP6330.txt"}, ++ {BCM43430_CHIP_ID, 0, DONT_CARE, FALSE, "bcm43438a0", "nvram_ap6212.txt"}, ++ {BCM43430_CHIP_ID, 1, DONT_CARE, FALSE, "bcm43438a1", "nvram_ap6212a.txt"}, ++ {BCM43430_CHIP_ID, 2, DONT_CARE, FALSE, "bcm43436b0", "nvram_ap6236.txt"}, ++ {BCM43012_CHIP_ID, 1, DONT_CARE, TRUE, "bcm43013b0", ""}, ++ {BCM4334_CHIP_ID, 3, DONT_CARE, FALSE, "bcm4334b1_ag", ""}, ++ {BCM43340_CHIP_ID, 2, DONT_CARE, FALSE, "bcm43341b0_ag", ""}, ++ {BCM43341_CHIP_ID, 2, DONT_CARE, FALSE, "bcm43341b0_ag", ""}, ++ {BCM4324_CHIP_ID, 5, DONT_CARE, FALSE, "bcm43241b4_ag", "nvram_ap62x2.txt"}, ++ {BCM4335_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4339a0_ag", "nvram_AP6335.txt"}, ++ {BCM4339_CHIP_ID, 1, DONT_CARE, FALSE, "bcm4339a0_ag", "nvram_AP6335.txt"}, ++ {BCM4345_CHIP_ID, 6, DONT_CARE, FALSE, "bcm43455c0_ag", "nvram_ap6255.txt"}, ++ {BCM43454_CHIP_ID, 6, DONT_CARE, FALSE, "bcm43455c0_ag", ""}, ++ {BCM4345_CHIP_ID, 9, DONT_CARE, FALSE, "bcm43456c5_ag", "nvram_ap6256.txt"}, ++ {BCM43454_CHIP_ID, 9, DONT_CARE, FALSE, "bcm43456c5_ag", ""}, ++ {BCM4354_CHIP_ID, 1, DONT_CARE, FALSE, "bcm4354a1_ag", "nvram_ap6354.txt"}, ++ {BCM4354_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4356a2_ag", "nvram_ap6356.txt"}, ++ {BCM4356_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4356a2_ag", "nvram_ap6356.txt"}, ++ {BCM4371_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4356a2_ag", ""}, ++ {BCM43569_CHIP_ID, 3, DONT_CARE, FALSE, "bcm4358a3_ag", ""}, ++ {BCM4359_CHIP_ID, 5, DONT_CARE, FALSE, "bcm4359b1_ag", ""}, ++ {BCM4359_CHIP_ID, 9, DONT_CARE, FALSE, "bcm4359c0_ag", "nvram_ap6398s.txt"}, ++ {BCM4362_CHIP_ID, 0, DONT_CARE, TRUE, "bcm43752a0_ag", ""}, ++#endif ++#ifdef BCMPCIE ++ {BCM4354_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4356a2_pcie_ag", ""}, ++ {BCM4356_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4356a2_pcie_ag", ""}, ++ {BCM4359_CHIP_ID, 9, DONT_CARE, FALSE, "bcm4359c0_pcie_ag", ""}, ++ {BCM4362_CHIP_ID, 0, DONT_CARE, TRUE, "bcm43752a0_pcie_ag", ""}, ++#endif ++#ifdef BCMDBUS ++ {BCM43143_CHIP_ID, 2, DONT_CARE, FALSE, "bcm43143b0", ""}, ++ {BCM43242_CHIP_ID, 1, DONT_CARE, FALSE, "bcm43242a1_ag", ""}, ++ {BCM43569_CHIP_ID, 2, DONT_CARE, FALSE, "bcm4358u_ag", ""}, ++#endif ++}; ++ + #ifdef BCMSDIO + void + dhd_conf_free_mac_list(wl_mac_list_ctrl_t *mac_list) +@@ -158,6 +152,7 @@ dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, uint chip) + } + #endif + ++#define SBSDIO_CIS_SIZE_LIMIT 0x200 + #define F0_BLOCK_SIZE 32 + int + dhd_conf_set_blksize(bcmsdh_info_t *sdh) +@@ -168,7 +163,7 @@ dhd_conf_set_blksize(bcmsdh_info_t *sdh) + uint8 cisd; + + numfn = bcmsdh_query_iofnum(sdh); +- ++ + for (fn = 0; fn <= numfn; fn++) { + if (!fn) + blksize = F0_BLOCK_SIZE; +@@ -290,8 +285,8 @@ dhd_conf_set_fw_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *fw_path) + uint32 oui, nic; + wl_mac_list_t *mac_list; + wl_mac_range_t *mac_range; +- char *pfw_name; + int fw_type, fw_type_new; ++ char *name_ptr; + + mac_list = dhd->conf->fw_by_mac.m_mac_list_head; + fw_num = dhd->conf->fw_by_mac.count; +@@ -308,22 +303,42 @@ dhd_conf_set_fw_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *fw_path) + /* find out the last '/' */ + i = strlen(fw_path); + while (i > 0) { +- if (fw_path[i] == '/') break; ++ if (fw_path[i] == '/') { ++ i++; ++ break; ++ } + i--; + } +- pfw_name = &fw_path[i+1]; +- fw_type = (strstr(pfw_name, "_mfg") ? +- FW_TYPE_MFG : (strstr(pfw_name, "_apsta") ? +- FW_TYPE_APSTA : (strstr(pfw_name, "_p2p") ? +- FW_TYPE_P2P : FW_TYPE_STA))); ++ name_ptr = &fw_path[i]; ++ ++ if (strstr(name_ptr, "_apsta")) ++ fw_type = FW_TYPE_APSTA; ++ else if (strstr(name_ptr, "_p2p")) ++ fw_type = FW_TYPE_P2P; ++ else if (strstr(name_ptr, "_mesh")) ++ fw_type = FW_TYPE_MESH; ++ else if (strstr(name_ptr, "_es")) ++ fw_type = FW_TYPE_ES; ++ else if (strstr(name_ptr, "_mfg")) ++ fw_type = FW_TYPE_MFG; ++ else ++ fw_type = FW_TYPE_STA; + + for (i=0; i= mac_range[j].nic_start && nic <= mac_range[j].nic_end) { +- strcpy(pfw_name, mac_list[i].name); ++ strcpy(name_ptr, mac_list[i].name); + printf("%s: matched oui=0x%06X, nic=0x%06X\n", + __FUNCTION__, oui, nic); + printf("%s: fw_path=%s\n", __FUNCTION__, fw_path); +@@ -392,12 +407,27 @@ dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *nv_path) + #endif + + void +-dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path, char *nv_path) ++dhd_conf_free_country_list(conf_country_list_t *country_list) ++{ ++ int i; ++ ++ CONFIG_TRACE(("%s called\n", __FUNCTION__)); ++ for (i=0; icount; i++) { ++ if (country_list->cspec[i]) { ++ CONFIG_TRACE(("%s Free cspec %p\n", __FUNCTION__, country_list->cspec[i])); ++ kfree(country_list->cspec[i]); ++ } ++ } ++ country_list->count = 0; ++} ++ ++void ++dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) + { + int fw_type, ag_type; + uint chip, chiprev; +- int i, j; +- char fw_tail[20]; ++ int i; ++ char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; +@@ -419,143 +449,53 @@ dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path, char *nv_path) + /* find out the last '/' */ + i = strlen(fw_path); + while (i > 0) { +- if (fw_path[i] == '/') break; +- i--; +- } +- j = strlen(nv_path); +- while (j > 0) { +- if (nv_path[j] == '/') ++ if (fw_path[i] == '/') { ++ i++; + break; +- j--; ++ } ++ i--; + } ++ name_ptr = &fw_path[i]; + #ifdef BAND_AG + ag_type = FW_TYPE_AG; + #else +- ag_type = strstr(&fw_path[i], "_ag") ? FW_TYPE_AG : FW_TYPE_G; ++ ag_type = strstr(name_ptr, "_ag") ? FW_TYPE_AG : FW_TYPE_G; + #endif +- fw_type = (strstr(&fw_path[i], "_mfg") ? FW_TYPE_MFG : +- (strstr(&fw_path[i], "_apsta") ? FW_TYPE_APSTA : +- (strstr(&fw_path[i], "_p2p") ? FW_TYPE_P2P : +- (strstr(&fw_path[i], "_es") ? FW_TYPE_ES : +- FW_TYPE_STA)))); +- +- if (fw_type == FW_TYPE_STA) +- strcpy(fw_tail, ".bin"); +- else if (fw_type == FW_TYPE_APSTA) +- strcpy(fw_tail, "_apsta.bin"); +- else if (fw_type == FW_TYPE_P2P) +- strcpy(fw_tail, "_p2p.bin"); +- else if (fw_type == FW_TYPE_ES) +- strcpy(fw_tail, "_es.bin"); +- else if (fw_type == FW_TYPE_MFG) +- strcpy(fw_tail, "_mfg.bin"); +- +- switch (chip) { +-#ifdef BCMSDIO +- case BCM4330_CHIP_ID: +- if (ag_type == FW_TYPE_G) { +- if (chiprev == BCM4330B2_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4330B2); +- } else { +- if (chiprev == BCM4330B2_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4330B2_AG); +- strcpy(&nv_path[j + 1], "nvram_AP6330.txt"); +- } +- break; +- case BCM43362_CHIP_ID: +- if (chiprev == BCM43362A0_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM43362A0); ++ if (strstr(name_ptr, "_apsta")) ++ fw_type = FW_TYPE_APSTA; ++ else if (strstr(name_ptr, "_p2p")) ++ fw_type = FW_TYPE_P2P; ++ else if (strstr(name_ptr, "_mesh")) ++ fw_type = FW_TYPE_MESH; ++ else if (strstr(name_ptr, "_es")) ++ fw_type = FW_TYPE_ES; ++ else if (strstr(name_ptr, "_mfg")) ++ fw_type = FW_TYPE_MFG; ++ else ++ fw_type = FW_TYPE_STA; ++ ++ for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { ++ const cihp_name_map_t* row = &chip_name_map[i]; ++ if (row->chip == chip && row->chiprev == chiprev && ++ (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { ++ strcpy(name_ptr, "fw_"); ++ strcat(fw_path, row->chip_name); ++ if (fw_type == FW_TYPE_APSTA) ++ strcat(fw_path, "_apsta.bin"); ++ else if (fw_type == FW_TYPE_P2P) ++ strcat(fw_path, "_p2p.bin"); ++ else if (fw_type == FW_TYPE_MESH) ++ strcat(fw_path, "_mesh.bin"); ++ else if (fw_type == FW_TYPE_ES) ++ strcat(fw_path, "_es.bin"); ++ else if (fw_type == FW_TYPE_MFG) ++ strcat(fw_path, "_mfg.bin"); + else +- strcpy(&fw_path[i+1], FW_BCM43362A2); +- if (!strstr(nv_path, "6476")) +- strcpy(&nv_path[j + 1], "nvram_AP6210.txt"); +- break; +- case BCM43430_CHIP_ID: +- if (chiprev == BCM43430A0_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM43438A0); +- strcpy(&nv_path[j + 1], "nvram_ap6212.txt"); +- } else if (chiprev == BCM43430A1_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM43438A1); +- strcpy(&nv_path[j + 1], "nvram_ap6212a.txt"); +- } else if (chiprev == BCM43430A2_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM43436B0); +- strcpy(&nv_path[j + 1], "nvram_ap6236.txt"); +- } +- break; +- case BCM43012_CHIP_ID: +- if (chiprev == BCM43012B0_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM43012B0); +- break; +- case BCM4334_CHIP_ID: +- if (chiprev == BCM4334B1_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4334B1); +- break; +- case BCM43340_CHIP_ID: +- case BCM43341_CHIP_ID: +- if (chiprev == BCM43341B0_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM43341B1); +- break; +- case BCM4324_CHIP_ID: +- if (chiprev == BCM43241B4_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM43241B4); +- strcpy(&nv_path[j + 1], "nvram_ap62x2.txt"); +- break; +- case BCM4335_CHIP_ID: +- if (chiprev == BCM4335A0_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4339A0); +- strcpy(&nv_path[j + 1], "nvram_AP6335.txt"); +- break; +- case BCM4339_CHIP_ID: +- if (chiprev == BCM4339A0_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4339A0); +- strcpy(&nv_path[j + 1], "nvram_AP6335.txt"); +- break; +- case BCM4345_CHIP_ID: +- case BCM43454_CHIP_ID: +- if (chiprev == BCM43455C0_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM43455C0); +- strcpy(&nv_path[j + 1], "nvram_ap6255.txt"); +- } else if (chiprev == BCM43456C5_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM43456C5); +- } +- break; +- case BCM4354_CHIP_ID: +- if (chiprev == BCM4354A1_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM4354A1); +- strcpy(&nv_path[j + 1], "nvram_ap6354.txt"); +- } else if (chiprev == BCM4356A2_CHIP_REV) { +- strcpy(&fw_path[i+1], FW_BCM4356A2); +- strcpy(&nv_path[j + 1], "nvram_ap6356.txt"); +- } +- break; +- case BCM4356_CHIP_ID: +- case BCM4371_CHIP_ID: +- if (chiprev == BCM4356A2_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4356A2); +- strcpy(&nv_path[j + 1], "nvram_ap6356.txt"); +- break; +- case BCM43569_CHIP_ID: +- if (chiprev == BCM4358A3_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4358A3); +- break; +- case BCM4359_CHIP_ID: +- if (chiprev == BCM4359B1_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4359B1); +- else if (chiprev == BCM4359C0_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4359C0); +- break; +-#endif +-#ifdef BCMPCIE +- case BCM4354_CHIP_ID: +- case BCM4356_CHIP_ID: +- if (chiprev == BCM4356A2_CHIP_REV) +- strcpy(&fw_path[i+1], FW_BCM4356A2); +- break; +-#endif +- default: +- strcpy(&fw_path[i+1], "fw_bcmdhd"); ++ strcat(fw_path, ".bin"); ++ } + } +- strcat(fw_path, fw_tail); ++ ++ dhd->conf->fw_type = fw_type; + + CONFIG_TRACE(("%s: firmware_path=%s\n", __FUNCTION__, fw_path)); + } +@@ -565,7 +505,7 @@ dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path) + { + uint chip, chiprev; + int i; +- char fw_tail[20]; ++ char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; +@@ -578,23 +518,22 @@ dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path) + /* find out the last '/' */ + i = strlen(clm_path); + while (i > 0) { +- if (clm_path[i] == '/') break; ++ if (clm_path[i] == '/') { ++ i++; ++ break; ++ } + i--; + } ++ name_ptr = &clm_path[i]; + +- strcpy(fw_tail, ".blob"); +- +- switch (chip) { +-#ifdef BCMSDIO +- case BCM43012_CHIP_ID: +- if (chiprev == BCM43012B0_CHIP_REV) +- strcpy(&clm_path[i+1], CLM_BCM43012B0); +- break; +-#endif +- default: +- strcpy(&clm_path[i+1], "clm_bcmdhd"); ++ for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { ++ const cihp_name_map_t* row = &chip_name_map[i]; ++ if (row->chip == chip && row->chiprev == chiprev && row->clm) { ++ strcpy(name_ptr, "clm_"); ++ strcat(clm_path, row->chip_name); ++ strcat(clm_path, ".blob"); ++ } + } +- strcat(clm_path, fw_tail); + + CONFIG_TRACE(("%s: clm_path=%s\n", __FUNCTION__, clm_path)); + } +@@ -602,23 +541,13 @@ dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path) + void + dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path) + { +- int matched=-1; + uint chip, chiprev; + int i; ++ char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; + +- for (i=0; iconf->nv_by_chip.count; i++) { +- if (chip==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chip && +- chiprev==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chiprev) { +- matched = i; +- break; +- } +- } +- if (matched < 0) +- return; +- + if (nv_path[0] == '\0') { + #ifdef CONFIG_BCMDHD_NVRAM_PATH + bcm_strncpy_s(nv_path, MOD_PARAM_PATHLEN-1, CONFIG_BCMDHD_NVRAM_PATH, MOD_PARAM_PATHLEN-1); +@@ -633,11 +562,28 @@ dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path) + /* find out the last '/' */ + i = strlen(nv_path); + while (i > 0) { +- if (nv_path[i] == '/') break; ++ if (nv_path[i] == '/') { ++ i++; ++ break; ++ } + i--; + } ++ name_ptr = &nv_path[i]; ++ ++ for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { ++ const cihp_name_map_t* row = &chip_name_map[i]; ++ if (row->chip == chip && row->chiprev == chiprev && strlen(row->module_name)) { ++ strcpy(name_ptr, row->module_name); ++ } ++ } + +- strcpy(&nv_path[i+1], dhd->conf->nv_by_chip.m_chip_nv_path_head[matched].name); ++ for (i=0; iconf->nv_by_chip.count; i++) { ++ if (chip==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chip && ++ chiprev==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chiprev) { ++ strcpy(name_ptr, dhd->conf->nv_by_chip.m_chip_nv_path_head[i].name); ++ break; ++ } ++ } + + CONFIG_TRACE(("%s: nvram_path=%s\n", __FUNCTION__, nv_path)); + } +@@ -656,10 +602,13 @@ dhd_conf_set_path(dhd_pub_t *dhd, char *dst_name, char *dst_path, char *src_path + /* find out the last '/' */ + i = strlen(dst_path); + while (i > 0) { +- if (dst_path[i] == '/') break; ++ if (dst_path[i] == '/') { ++ i++; ++ break; ++ } + i--; + } +- strcpy(&dst_path[i+1], dst_name); ++ strcpy(&dst_path[i], dst_name); + + CONFIG_TRACE(("%s: dst_path=%s\n", __FUNCTION__, dst_path)); + } +@@ -670,6 +619,7 @@ dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) + { + uint chip, chiprev; + int i; ++ char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; +@@ -682,90 +632,21 @@ dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) + /* find out the last '/' */ + i = strlen(conf_path); + while (i > 0) { +- if (conf_path[i] == '/') break; ++ if (conf_path[i] == '/') { ++ i++; ++ break; ++ } + i--; + } ++ name_ptr = conf_path[i]; + +- switch (chip) { +-#ifdef BCMSDIO +- case BCM4330_CHIP_ID: +- if (chiprev == BCM4330B2_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4330B2); +- break; +- case BCM43362_CHIP_ID: +- if (chiprev == BCM43362A0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43362A0); +- else +- strcpy(&conf_path[i+1], CONFIG_BCM43362A2); +- break; +- case BCM43430_CHIP_ID: +- if (chiprev == BCM43430A0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43438A0); +- else if (chiprev == BCM43430A1_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43438A1); +- else if (chiprev == BCM43430A2_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43436B0); +- break; +- case BCM4334_CHIP_ID: +- if (chiprev == BCM4334B1_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4334B1); +- break; +- case BCM43340_CHIP_ID: +- case BCM43341_CHIP_ID: +- if (chiprev == BCM43341B0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43341B0); +- break; +- case BCM4324_CHIP_ID: +- if (chiprev == BCM43241B4_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43241B4); +- break; +- case BCM4335_CHIP_ID: +- if (chiprev == BCM4335A0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4339A0); +- break; +- case BCM43454_CHIP_ID: +- if (chiprev == BCM43455C0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43454C0); +- break; +- case BCM4345_CHIP_ID: +- if (chiprev == BCM43455C0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43455C0); +- else if (chiprev == BCM43456C5_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM43456C5); +- break; +- case BCM4339_CHIP_ID: +- if (chiprev == BCM4339A0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4339A0); +- break; +- case BCM4354_CHIP_ID: +- if (chiprev == BCM4354A1_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4354A1); +- else if (chiprev == BCM4356A2_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4356A2); +- break; +- case BCM4356_CHIP_ID: +- case BCM4371_CHIP_ID: +- if (chiprev == BCM4356A2_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4356A2); +- break; +- case BCM43569_CHIP_ID: +- if (chiprev == BCM4358A3_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4358A3); +- break; +- case BCM4359_CHIP_ID: +- if (chiprev == BCM4359B1_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4359B1); +- else if (chiprev == BCM4359C0_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4359C0); +- break; +-#endif +-#ifdef BCMPCIE +- case BCM4354_CHIP_ID: +- case BCM4356_CHIP_ID: +- if (chiprev == BCM4356A2_CHIP_REV) +- strcpy(&conf_path[i+1], CONFIG_BCM4356A2); +- break; +-#endif ++ for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { ++ const cihp_name_map_t* row = &chip_name_map[i]; ++ if (row->chip == chip && row->chiprev == chiprev) { ++ strcpy(name_ptr, "config_"); ++ strcat(conf_path, row->chip_name); ++ strcat(conf_path, ".txt"); ++ } + } + + CONFIG_TRACE(("%s: config_path=%s\n", __FUNCTION__, conf_path)); +@@ -785,12 +666,12 @@ dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val, + CONFIG_ERROR(("%s: WLC_DOWN setting failed %d\n", __FUNCTION__, ret)); + } + if (cmd == WLC_SET_VAR) { +- printf("%s: set %s %d\n", __FUNCTION__, name, val); ++ CONFIG_TRACE(("%s: set %s %d\n", __FUNCTION__, name, val)); + bcm_mkiovar(name, (char *)&val, sizeof(val), iovbuf, sizeof(iovbuf)); + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) + CONFIG_ERROR(("%s: %s setting failed %d\n", __FUNCTION__, name, ret)); + } else { +- printf("%s: set %s %d %d\n", __FUNCTION__, name, cmd, val); ++ CONFIG_TRACE(("%s: set %s %d %d\n", __FUNCTION__, name, cmd, val)); + if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, 0)) < 0) + CONFIG_ERROR(("%s: %s setting failed %d\n", __FUNCTION__, name, ret)); + } +@@ -852,7 +733,7 @@ dhd_conf_get_iovar(dhd_pub_t *dhd, int cmd, char *name, char *buf, int len, int + uint + dhd_conf_get_band(dhd_pub_t *dhd) + { +- uint band = WLC_BAND_AUTO; ++ int band = -1; + + if (dhd && dhd->conf) + band = dhd->conf->band; +@@ -862,19 +743,6 @@ dhd_conf_get_band(dhd_pub_t *dhd) + return band; + } + +-int +-dhd_conf_set_country(dhd_pub_t *dhd) +-{ +- int bcmerror = -1; +- +- memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); +- printf("%s: set country %s, revision %d\n", __FUNCTION__, +- dhd->conf->cspec.ccode, dhd->conf->cspec.rev); +- dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "country", (char *)&dhd->conf->cspec, sizeof(wl_country_t), FALSE); +- +- return bcmerror; +-} +- + int + dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) + { +@@ -884,23 +752,28 @@ dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) + bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), FALSE, 0)) < 0) + CONFIG_ERROR(("%s: country code getting failed %d\n", __FUNCTION__, bcmerror)); +- else +- printf("Country code: %s (%s/%d)\n", cspec->country_abbrev, cspec->ccode, cspec->rev); + + return bcmerror; + } + + int +-dhd_conf_get_country_from_config(dhd_pub_t *dhd, wl_country_t *cspec) ++dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec, int nodfs) + { + int bcmerror = -1, i; + struct dhd_conf *conf = dhd->conf; ++ conf_country_list_t *country_list; + +- for (i = 0; i < conf->country_list.count; i++) { +- if (!strncmp(cspec->country_abbrev, conf->country_list.cspec[i].country_abbrev, 2)) { +- memcpy(cspec->ccode, +- conf->country_list.cspec[i].ccode, WLC_CNTRY_BUF_SZ); +- cspec->rev = conf->country_list.cspec[i].rev; ++ if ((nodfs > 0 || dhd->op_mode & DHD_FLAG_HOSTAP_MODE) && ++ conf->country_list_nodfs.count > 0) { ++ country_list = &conf->country_list_nodfs; ++ } else { ++ country_list = &conf->country_list; ++ } ++ ++ for (i = 0; i < country_list->count; i++) { ++ if (!strncmp(cspec->country_abbrev, country_list->cspec[i]->country_abbrev, 2)) { ++ memcpy(cspec->ccode, country_list->cspec[i]->ccode, WLC_CNTRY_BUF_SZ); ++ cspec->rev = country_list->cspec[i]->rev; + printf("%s: %s/%d\n", __FUNCTION__, cspec->ccode, cspec->rev); + return 0; + } +@@ -909,6 +782,21 @@ dhd_conf_get_country_from_config(dhd_pub_t *dhd, wl_country_t *cspec) + return bcmerror; + } + ++int ++dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) ++{ ++ int bcmerror = -1; ++ ++ memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); ++ ++ printf("%s: set country %s, revision %d\n", __FUNCTION__, cspec->ccode, cspec->rev); ++ dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "country", (char *)cspec, sizeof(wl_country_t), FALSE); ++ dhd_conf_get_country(dhd, cspec); ++ printf("Country code: %s (%s/%d)\n", cspec->country_abbrev, cspec->ccode, cspec->rev); ++ ++ return bcmerror; ++} ++ + int + dhd_conf_fix_country(dhd_pub_t *dhd) + { +@@ -916,6 +804,7 @@ dhd_conf_fix_country(dhd_pub_t *dhd) + uint band; + wl_uint32_list_t *list; + u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; ++ wl_country_t cspec; + + if (!(dhd && dhd->conf)) { + return bcmerror; +@@ -934,11 +823,13 @@ dhd_conf_fix_country(dhd_pub_t *dhd) + dtoh32(list->count)<11)) { + CONFIG_ERROR(("%s: bcmerror=%d, # of channels %d\n", + __FUNCTION__, bcmerror, dtoh32(list->count))); +- if ((bcmerror = dhd_conf_set_country(dhd)) < 0) { +- strcpy(dhd->conf->cspec.country_abbrev, "US"); +- dhd->conf->cspec.rev = 0; +- strcpy(dhd->conf->cspec.ccode, "US"); +- dhd_conf_set_country(dhd); ++ dhd_conf_map_country_list(dhd, &dhd->conf->cspec, 0); ++ if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { ++ strcpy(cspec.country_abbrev, "US"); ++ cspec.rev = 0; ++ strcpy(cspec.ccode, "US"); ++ dhd_conf_map_country_list(dhd, &cspec, 0); ++ dhd_conf_set_country(dhd, &cspec); + } + } + +@@ -1002,17 +893,19 @@ dhd_conf_set_bw_cap(dhd_pub_t *dhd) + u32 bw_cap; + } param = {0, 0}; + +- if (dhd->conf->bw_cap_2g >= 0) { ++ if (dhd->conf->bw_cap[0] >= 0) { ++ memset(¶m, 0, sizeof(param)); + param.band = WLC_BAND_2G; +- param.bw_cap = (uint)dhd->conf->bw_cap_2g; +- printf("%s: set bw_cap 2g %d\n", __FUNCTION__, param.bw_cap); ++ param.bw_cap = (uint)dhd->conf->bw_cap[0]; ++ printf("%s: set bw_cap 2g 0x%x\n", __FUNCTION__, param.bw_cap); + dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "bw_cap", (char *)¶m, sizeof(param), TRUE); + } + +- if (dhd->conf->bw_cap_5g >= 0) { ++ if (dhd->conf->bw_cap[1] >= 0) { ++ memset(¶m, 0, sizeof(param)); + param.band = WLC_BAND_5G; +- param.bw_cap = (uint)dhd->conf->bw_cap_5g; +- printf("%s: set bw_cap 5g %d\n", __FUNCTION__, param.bw_cap); ++ param.bw_cap = (uint)dhd->conf->bw_cap[1]; ++ printf("%s: set bw_cap 5g 0x%x\n", __FUNCTION__, param.bw_cap); + dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "bw_cap", (char *)¶m, sizeof(param), TRUE); + } + } +@@ -1155,6 +1048,26 @@ dhd_conf_set_wme(dhd_pub_t *dhd, int mode) + return; + } + ++void ++dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int p2p_mode, int miracast_mode) ++{ ++ int i; ++ struct dhd_conf *conf = dhd->conf; ++ bool set = true; ++ ++ for (i=0; imchan[i].bw >= 0); ++ set &= ((conf->mchan[i].p2p_mode == -1) | (conf->mchan[i].p2p_mode == p2p_mode)); ++ set &= ((conf->mchan[i].miracast_mode == -1) | (conf->mchan[i].miracast_mode == miracast_mode)); ++ if (set) { ++ dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "mchan_bw", conf->mchan[i].bw, 0, FALSE); ++ } ++ } ++ ++ return; ++} ++ + #ifdef PKT_FILTER_SUPPORT + void + dhd_conf_add_pkt_filter(dhd_pub_t *dhd) +@@ -1164,16 +1077,11 @@ dhd_conf_add_pkt_filter(dhd_pub_t *dhd) + #define MACS "%02x%02x%02x%02x%02x%02x" + + /* +- * 1. Filter out all pkt: actually not to enable this since 4-way handshake will be filter out as well. +- * 1) dhd_master_mode=0 +- * 2) pkt_filter_add=99 0 0 0 0x000000000000 0x000000000000 +- * 2. Filter in less pkt: ARP(0x0806, ID is 105), BRCM(0x886C), 802.1X(0x888E) ++ * Filter in less pkt: ARP(0x0806, ID is 105), BRCM(0x886C), 802.1X(0x888E) + * 1) dhd_master_mode=1 + * 2) pkt_filter_del=100, 102, 103, 104, 105 + * 3) pkt_filter_add=131 0 0 12 0xFFFF 0x886C, 132 0 0 12 0xFFFF 0x888E +- * 3. magic pkt: magic_pkt_filter_add=141 0 1 12 +- * 4. Filter out netbios pkt: +- * Netbios: 121 0 0 12 0xFFFF000000000000000000FF000000000000000000000000FFFF 0x0800000000000000000000110000000000000000000000000089 ++ * 4) magic_pkt_filter_add=141 0 1 12 + */ + for(i=0; iconf->pkt_filter_add.count; i++) { + dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->pkt_filter_add.filter[i]; +@@ -1244,8 +1152,9 @@ dhd_conf_discard_pkt_filter(dhd_pub_t *dhd) + int + dhd_conf_get_pm(dhd_pub_t *dhd) + { +- if (dhd && dhd->conf) ++ if (dhd && dhd->conf) { + return dhd->conf->pm; ++ } + return -1; + } + +@@ -1408,8 +1317,6 @@ pick_config_vars(char *varbuf, uint len, uint start_pos, char *pickbuf) + if (pick) { + if (varbuf[n] == 0x9) + continue; +- if (pick_column>0 && pickbuf[pick_column-1]==' ' && varbuf[n]==' ') +- continue; + pickbuf[pick_column] = varbuf[n]; + pick_column++; + } +@@ -1432,6 +1339,12 @@ dhd_conf_read_log_level(dhd_pub_t *dhd, char *full_param, uint len_param) + sd_msglevel = (int)simple_strtol(data, NULL, 0); + printf("%s: sd_msglevel = 0x%X\n", __FUNCTION__, sd_msglevel); + } ++#endif ++#ifdef BCMDBUS ++ else if (!strncmp("dbus_msglevel=", full_param, len_param)) { ++ dbus_msglevel = (int)simple_strtol(data, NULL, 0); ++ printf("%s: dbus_msglevel = 0x%X\n", __FUNCTION__, dbus_msglevel); ++ } + #endif + else if (!strncmp("android_msg_level=", full_param, len_param)) { + android_msg_level = (int)simple_strtol(data, NULL, 0); +@@ -1751,9 +1664,11 @@ bool + dhd_conf_read_country_list(dhd_pub_t *dhd, char *full_param, uint len_param) + { + int i; +- char *pch, *pick_tmp; ++ char *pch, *pick_tmp, *pick_tmp2; + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; ++ wl_country_t *cspec; ++ conf_country_list_t *country_list = NULL; + + /* Process country_list: + * country_list=[country1]:[ccode1]/[regrev1], +@@ -1761,28 +1676,115 @@ dhd_conf_read_country_list(dhd_pub_t *dhd, char *full_param, uint len_param) + * Ex: country_list=US:US/0, TW:TW/1 + */ + if (!strncmp("country_list=", full_param, len_param)) { ++ country_list = &dhd->conf->country_list; ++ } else if (!strncmp("country_list_nodfs=", full_param, len_param)) { ++ country_list = &dhd->conf->country_list_nodfs; ++ } ++ if (country_list) { + pick_tmp = data; + for (i=0; icountry_list.cspec[i].country_abbrev, pch); +- pch = bcmstrtok(&pick_tmp, "/", 0); ++ pch = bcmstrtok(&pick_tmp2, ":", 0); + if (!pch) + break; +- memcpy(conf->country_list.cspec[i].ccode, pch, 2); +- pch = bcmstrtok(&pick_tmp, ", ", 0); +- if (!pch) ++ cspec = NULL; ++ if (!(cspec = kmalloc(sizeof(wl_country_t), GFP_KERNEL))) { ++ CONFIG_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); + break; +- conf->country_list.cspec[i].rev = (int32)simple_strtol(pch, NULL, 10); +- conf->country_list.count ++; ++ } ++ memset(cspec, 0, sizeof(wl_country_t)); ++ ++ strcpy(cspec->country_abbrev, pch); ++ pch = bcmstrtok(&pick_tmp2, "/", 0); ++ if (!pch) { ++ kfree(cspec); ++ break; ++ } ++ memcpy(cspec->ccode, pch, 2); ++ pch = bcmstrtok(&pick_tmp2, "/", 0); ++ if (!pch) { ++ kfree(cspec); ++ break; ++ } ++ cspec->rev = (int32)simple_strtol(pch, NULL, 10); ++ country_list->count++; ++ country_list->cspec[i] = cspec; + CONFIG_TRACE(("%s: country_list abbrev=%s, ccode=%s, regrev=%d\n", __FUNCTION__, +- conf->country_list.cspec[i].country_abbrev, +- conf->country_list.cspec[i].ccode, +- conf->country_list.cspec[i].rev)); ++ cspec->country_abbrev, cspec->ccode, cspec->rev)); ++ } ++ if (!strncmp("country_list=", full_param, len_param)) { ++ printf("%s: %d country in list\n", __FUNCTION__, conf->country_list.count); ++ } else if (!strncmp("country_list_nodfs=", full_param, len_param)) { ++ printf("%s: %d nodfs country in list\n", __FUNCTION__, conf->country_list.count); ++ } ++ } ++ else ++ return false; ++ ++ return true; ++} ++ ++bool ++dhd_conf_read_mchan_params(dhd_pub_t *dhd, char *full_param, uint len_param) ++{ ++ int i; ++ char *pch, *pick_tmp, *pick_tmp2; ++ struct dhd_conf *conf = dhd->conf; ++ char *data = full_param+len_param; ++ ++ /* Process mchan_bw: ++ * mchan_bw=[val]/[any/go/gc]/[any/source/sink] ++ * Ex: mchan_bw=80/go/source, 30/gc/sink ++ */ ++ if (!strncmp("mchan_bw=", full_param, len_param)) { ++ pick_tmp = data; ++ for (i=0; imchan[i].bw = (int)simple_strtol(pch, NULL, 0); ++ if (conf->mchan[i].bw < 0 || conf->mchan[i].bw > 100) { ++ CONFIG_ERROR(("%s: wrong bw %d\n", __FUNCTION__, conf->mchan[i].bw)); ++ conf->mchan[i].bw = 0; ++ break; ++ } ++ } ++ pch = bcmstrtok(&pick_tmp2, "/", 0); ++ if (!pch) { ++ break; ++ } else { ++ if (bcmstrstr(pch, "any")) { ++ conf->mchan[i].p2p_mode = -1; ++ } else if (bcmstrstr(pch, "go")) { ++ conf->mchan[i].p2p_mode = WL_P2P_IF_GO; ++ } else if (bcmstrstr(pch, "gc")) { ++ conf->mchan[i].p2p_mode = WL_P2P_IF_CLIENT; ++ } ++ } ++ pch = bcmstrtok(&pick_tmp2, "/", 0); ++ if (!pch) { ++ break; ++ } else { ++ if (bcmstrstr(pch, "any")) { ++ conf->mchan[i].miracast_mode = -1; ++ } else if (bcmstrstr(pch, "source")) { ++ conf->mchan[i].miracast_mode = MIRACAST_SOURCE; ++ } else if (bcmstrstr(pch, "sink")) { ++ conf->mchan[i].miracast_mode = MIRACAST_SINK; ++ } ++ } ++ } ++ for (i=0; imchan[i].bw >= 0) ++ printf("%s: mchan_bw=%d/%d/%d\n", __FUNCTION__, ++ conf->mchan[i].bw, conf->mchan[i].p2p_mode, conf->mchan[i].miracast_mode); + } +- printf("%s: %d country in list\n", __FUNCTION__, conf->country_list.count); + } + else + return false; +@@ -1842,6 +1844,7 @@ dhd_conf_read_pkt_filter(dhd_pub_t *dhd, char *full_param, uint len_param) + if (!(conf->magic_pkt_filter_add = kmalloc(MAGIC_PKT_FILTER_LEN, GFP_KERNEL))) { + CONFIG_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); + } else { ++ memset(conf->magic_pkt_filter_add, 0, MAGIC_PKT_FILTER_LEN); + strcpy(conf->magic_pkt_filter_add, data); + printf("%s: magic_pkt_filter_add = %s\n", __FUNCTION__, conf->magic_pkt_filter_add); + } +@@ -1853,33 +1856,33 @@ dhd_conf_read_pkt_filter(dhd_pub_t *dhd, char *full_param, uint len_param) + } + #endif + +-#ifdef IAPSTA_PREINIT ++#ifdef ISAM_PREINIT + /* +- * iapsta_init=mode [sta|ap|apsta|dualap] vifname [wlan1] +- * iapsta_config=ifname [wlan0|wlan1] ssid [xxx] chan [x] ++ * isam_init=mode [sta|ap|apsta|dualap] vifname [wlan1] ++ * isam_config=ifname [wlan0|wlan1] ssid [xxx] chan [x] + hidden [y|n] maxassoc [x] + amode [open|shared|wpapsk|wpa2psk|wpawpa2psk] + emode [none|wep|tkip|aes|tkipaes] + key [xxxxx] +- * iapsta_enable=ifname [wlan0|wlan1] ++ * isam_enable=ifname [wlan0|wlan1] + */ + bool +-dhd_conf_read_iapsta(dhd_pub_t *dhd, char *full_param, uint len_param) ++dhd_conf_read_isam(dhd_pub_t *dhd, char *full_param, uint len_param) + { + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + +- if (!strncmp("iapsta_init=", full_param, len_param)) { +- sprintf(conf->iapsta_init, "iapsta_init %s", data); +- printf("%s: iapsta_init=%s\n", __FUNCTION__, conf->iapsta_init); ++ if (!strncmp("isam_init=", full_param, len_param)) { ++ sprintf(conf->isam_init, "isam_init %s", data); ++ printf("%s: isam_init=%s\n", __FUNCTION__, conf->isam_init); + } +- else if (!strncmp("iapsta_config=", full_param, len_param)) { +- sprintf(conf->iapsta_config, "iapsta_config %s", data); +- printf("%s: iapsta_config=%s\n", __FUNCTION__, conf->iapsta_config); ++ else if (!strncmp("isam_config=", full_param, len_param)) { ++ sprintf(conf->isam_config, "isam_config %s", data); ++ printf("%s: isam_config=%s\n", __FUNCTION__, conf->isam_config); + } +- else if (!strncmp("iapsta_enable=", full_param, len_param)) { +- sprintf(conf->iapsta_enable, "iapsta_enable %s", data); +- printf("%s: iapsta_enable=%s\n", __FUNCTION__, conf->iapsta_enable); ++ else if (!strncmp("isam_enable=", full_param, len_param)) { ++ sprintf(conf->isam_enable, "isam_enable %s", data); ++ printf("%s: isam_enable=%s\n", __FUNCTION__, conf->isam_enable); + } + else + return false; +@@ -1949,24 +1952,14 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) + dhd_doflow = TRUE; + printf("%s: dhd_doflow = %d\n", __FUNCTION__, dhd_doflow); + } +- else if (!strncmp("dhd_slpauto=", full_param, len_param)) { +- if (!strncmp(data, "0", 1)) +- dhd_slpauto = FALSE; +- else +- dhd_slpauto = TRUE; +- printf("%s: dhd_slpauto = %d\n", __FUNCTION__, dhd_slpauto); +- } +- else if (!strncmp("kso_enable=", full_param, len_param)) { ++ else if (!strncmp("dhd_slpauto=", full_param, len_param) || ++ !strncmp("kso_enable=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + dhd_slpauto = FALSE; + else + dhd_slpauto = TRUE; + printf("%s: dhd_slpauto = %d\n", __FUNCTION__, dhd_slpauto); + } +- else if (!strncmp("bus:txglom=", full_param, len_param)) { +- conf->bus_txglom = (int)simple_strtol(data, NULL, 10); +- printf("%s: bus:txglom = %d\n", __FUNCTION__, conf->bus_txglom); +- } + else if (!strncmp("use_rxchain=", full_param, len_param)) { + conf->use_rxchain = (int)simple_strtol(data, NULL, 10); + printf("%s: use_rxchain = %d\n", __FUNCTION__, conf->use_rxchain); +@@ -1998,6 +1991,10 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->rxf_cpucore = (int)simple_strtol(data, NULL, 10); + printf("%s: rxf_cpucore = %d\n", __FUNCTION__, conf->rxf_cpucore); + } ++ else if (!strncmp("orphan_move=", full_param, len_param)) { ++ conf->orphan_move = (int)simple_strtol(data, NULL, 10); ++ printf("%s: orphan_move = %d\n", __FUNCTION__, conf->orphan_move); ++ } + #if defined(BCMSDIOH_TXGLOM) + else if (!strncmp("txglomsize=", full_param, len_param)) { + conf->txglomsize = (uint)simple_strtol(data, NULL, 10); +@@ -2027,13 +2024,6 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->bus_rxglom = TRUE; + printf("%s: bus:rxglom = %d\n", __FUNCTION__, conf->bus_rxglom); + } +- else if (!strncmp("dhd_poll=", full_param, len_param)) { +- if (!strncmp(data, "0", 1)) +- conf->dhd_poll = 0; +- else +- conf->dhd_poll = 1; +- printf("%s: dhd_poll = %d\n", __FUNCTION__, conf->dhd_poll); +- } + else if (!strncmp("deferred_tx_len=", full_param, len_param)) { + conf->deferred_tx_len = (int)simple_strtol(data, NULL, 10); + printf("%s: deferred_tx_len = %d\n", __FUNCTION__, conf->deferred_tx_len); +@@ -2068,17 +2058,34 @@ dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) + } + #endif + ++#ifdef BCMPCIE + bool +-dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) ++dhd_conf_read_pcie_params(dhd_pub_t *dhd, char *full_param, uint len_param) + { + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + +- if (!strncmp("lpc=", full_param, len_param)) { +- conf->lpc = (int)simple_strtol(data, NULL, 10); +- printf("%s: lpc = %d\n", __FUNCTION__, conf->lpc); ++ if (!strncmp("bus:deepsleep_disable=", full_param, len_param)) { ++ if (!strncmp(data, "0", 1)) ++ conf->bus_deepsleep_disable = 0; ++ else ++ conf->bus_deepsleep_disable = 1; ++ printf("%s: bus:deepsleep_disable = %d\n", __FUNCTION__, conf->bus_deepsleep_disable); + } +- else if (!strncmp("deepsleep=", full_param, len_param)) { ++ else ++ return false; ++ ++ return true; ++} ++#endif ++ ++bool ++dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) ++{ ++ struct dhd_conf *conf = dhd->conf; ++ char *data = full_param+len_param; ++ ++ if (!strncmp("deepsleep=", full_param, len_param)) { + if (!strncmp(data, "1", 1)) + conf->deepsleep = TRUE; + else +@@ -2093,9 +2100,9 @@ dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->pm_in_suspend = (int)simple_strtol(data, NULL, 10); + printf("%s: pm_in_suspend = %d\n", __FUNCTION__, conf->pm_in_suspend); + } +- else if (!strncmp("pm2_sleep_ret=", full_param, len_param)) { +- conf->pm2_sleep_ret = (int)simple_strtol(data, NULL, 10); +- printf("%s: pm2_sleep_ret = %d\n", __FUNCTION__, conf->pm2_sleep_ret); ++ else if (!strncmp("suspend_bcn_li_dtim=", full_param, len_param)) { ++ conf->suspend_bcn_li_dtim = (int)simple_strtol(data, NULL, 10); ++ printf("%s: suspend_bcn_li_dtim = %d\n", __FUNCTION__, conf->suspend_bcn_li_dtim); + } + else if (!strncmp("xmit_in_suspend=", full_param, len_param)) { + if (!strncmp(data, "1", 1)) +@@ -2108,6 +2115,15 @@ dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->ap_in_suspend = (int)simple_strtol(data, NULL, 10); + printf("%s: ap_in_suspend = %d\n", __FUNCTION__, conf->ap_in_suspend); + } ++#ifdef SUSPEND_EVENT ++ else if (!strncmp("suspend_eventmask_enable=", full_param, len_param)) { ++ if (!strncmp(data, "1", 1)) ++ conf->suspend_eventmask_enable = TRUE; ++ else ++ conf->suspend_eventmask_enable = FALSE; ++ printf("%s: suspend_eventmask_enable = %d\n", __FUNCTION__, conf->suspend_eventmask_enable); ++ } ++#endif + else + return false; + +@@ -2123,7 +2139,18 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) + char *pch, *pick_tmp; + int i; + +- if (!strncmp("band=", full_param, len_param)) { ++ if (!strncmp("dhd_poll=", full_param, len_param)) { ++ if (!strncmp(data, "0", 1)) ++ conf->dhd_poll = 0; ++ else ++ conf->dhd_poll = 1; ++ printf("%s: dhd_poll = %d\n", __FUNCTION__, conf->dhd_poll); ++ } ++ else if (!strncmp("dhd_watchdog_ms=", full_param, len_param)) { ++ dhd_watchdog_ms = (int)simple_strtol(data, NULL, 10); ++ printf("%s: dhd_watchdog_ms = %d\n", __FUNCTION__, dhd_watchdog_ms); ++ } ++ else if (!strncmp("band=", full_param, len_param)) { + /* Process band: + * band=a for 5GHz only and band=b for 2.4GHz only + */ +@@ -2135,17 +2162,26 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->band = WLC_BAND_AUTO; + printf("%s: band = %d\n", __FUNCTION__, conf->band); + } +- else if (!strncmp("mimo_bw_cap=", full_param, len_param)) { +- conf->mimo_bw_cap = (uint)simple_strtol(data, NULL, 10); +- printf("%s: mimo_bw_cap = %d\n", __FUNCTION__, conf->mimo_bw_cap); +- } + else if (!strncmp("bw_cap_2g=", full_param, len_param)) { +- conf->bw_cap_2g = (uint)simple_strtol(data, NULL, 0); +- printf("%s: bw_cap_2g = %d\n", __FUNCTION__, conf->bw_cap_2g); ++ conf->bw_cap[0] = (uint)simple_strtol(data, NULL, 0); ++ printf("%s: bw_cap_2g = %d\n", __FUNCTION__, conf->bw_cap[0]); + } + else if (!strncmp("bw_cap_5g=", full_param, len_param)) { +- conf->bw_cap_5g = (uint)simple_strtol(data, NULL, 0); +- printf("%s: bw_cap_2g = %d\n", __FUNCTION__, conf->bw_cap_5g); ++ conf->bw_cap[1] = (uint)simple_strtol(data, NULL, 0); ++ printf("%s: bw_cap_5g = %d\n", __FUNCTION__, conf->bw_cap[1]); ++ } ++ else if (!strncmp("bw_cap=", full_param, len_param)) { ++ pick_tmp = data; ++ pch = bcmstrtok(&pick_tmp, " ,.-", 0); ++ if (pch != NULL) { ++ conf->bw_cap[0] = (uint32)simple_strtol(pch, NULL, 0); ++ printf("%s: bw_cap 2g = %d\n", __FUNCTION__, conf->bw_cap[0]); ++ } ++ pch = bcmstrtok(&pick_tmp, " ,.-", 0); ++ if (pch != NULL) { ++ conf->bw_cap[1] = (uint32)simple_strtol(pch, NULL, 0); ++ printf("%s: bw_cap 5g = %d\n", __FUNCTION__, conf->bw_cap[1]); ++ } + } + else if (!strncmp("ccode=", full_param, len_param)) { + memset(&conf->cspec, 0, sizeof(wl_country_t)); +@@ -2177,10 +2213,6 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) + printf("%s: keep_alive_period = %d\n", __FUNCTION__, + conf->keep_alive_period); + } +- else if (!strncmp("stbc=", full_param, len_param)) { +- conf->stbc = (int)simple_strtol(data, NULL, 10); +- printf("%s: stbc = %d\n", __FUNCTION__, conf->stbc); +- } + else if (!strncmp("phy_oclscdenable=", full_param, len_param)) { + conf->phy_oclscdenable = (int)simple_strtol(data, NULL, 10); + printf("%s: phy_oclscdenable = %d\n", __FUNCTION__, conf->phy_oclscdenable); +@@ -2197,18 +2229,6 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->bcn_timeout= (uint)simple_strtol(data, NULL, 10); + printf("%s: bcn_timeout = %d\n", __FUNCTION__, conf->bcn_timeout); + } +- else if (!strncmp("ampdu_ba_wsize=", full_param, len_param)) { +- conf->ampdu_ba_wsize = (int)simple_strtol(data, NULL, 10); +- printf("%s: ampdu_ba_wsize = %d\n", __FUNCTION__, conf->ampdu_ba_wsize); +- } +- else if (!strncmp("ampdu_hostreorder=", full_param, len_param)) { +- conf->ampdu_hostreorder = (int)simple_strtol(data, NULL, 10); +- printf("%s: ampdu_hostreorder = %d\n", __FUNCTION__, conf->ampdu_hostreorder); +- } +- else if (!strncmp("spect=", full_param, len_param)) { +- conf->spect = (int)simple_strtol(data, NULL, 10); +- printf("%s: spect = %d\n", __FUNCTION__, conf->spect); +- } + else if (!strncmp("txbf=", full_param, len_param)) { + conf->txbf = (int)simple_strtol(data, NULL, 10); + printf("%s: txbf = %d\n", __FUNCTION__, conf->txbf); +@@ -2231,6 +2251,7 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) + conf->pktprio8021x = (int)simple_strtol(data, NULL, 10); + printf("%s: pktprio8021x = %d\n", __FUNCTION__, conf->pktprio8021x); + } ++#if defined(BCMSDIO) || defined(BCMPCIE) + else if (!strncmp("dhd_txbound=", full_param, len_param)) { + dhd_txbound = (uint)simple_strtol(data, NULL, 10); + printf("%s: dhd_txbound = %d\n", __FUNCTION__, dhd_txbound); +@@ -2239,29 +2260,32 @@ dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) + dhd_rxbound = (uint)simple_strtol(data, NULL, 10); + printf("%s: dhd_rxbound = %d\n", __FUNCTION__, dhd_rxbound); + } +- else if (!strncmp("rsdb_mode=", full_param, len_param)) { +- conf->rsdb_mode = (int)simple_strtol(data, NULL, 10); +- printf("%s: rsdb_mode = %d\n", __FUNCTION__, conf->rsdb_mode); +- } +- else if (!strncmp("vhtmode=", full_param, len_param)) { +- if (!strncmp(data, "0", 1)) +- conf->vhtmode = 0; +- else +- conf->vhtmode = 1; +- printf("%s: vhtmode = %d\n", __FUNCTION__, conf->vhtmode); +- } ++#endif + else if (!strncmp("num_different_channels=", full_param, len_param)) { + conf->num_different_channels = (int)simple_strtol(data, NULL, 10); + printf("%s: num_different_channels = %d\n", __FUNCTION__, conf->num_different_channels); + } +- else if (!strncmp("autocountry=", full_param, len_param)) { +- conf->autocountry = (int)simple_strtol(data, NULL, 10); +- printf("%s: autocountry = %d\n", __FUNCTION__, conf->autocountry); +- } + else if (!strncmp("tsq=", full_param, len_param)) { + conf->tsq = (int)simple_strtol(data, NULL, 10); + printf("%s: tsq = %d\n", __FUNCTION__, conf->tsq); + } ++ else if (!strncmp("ctrl_resched=", full_param, len_param)) { ++ conf->ctrl_resched = (int)simple_strtol(data, NULL, 10); ++ printf("%s: ctrl_resched = %d\n", __FUNCTION__, conf->ctrl_resched); ++ } ++ else if (!strncmp("dhd_ioctl_timeout_msec=", full_param, len_param)) { ++ conf->dhd_ioctl_timeout_msec = (int)simple_strtol(data, NULL, 10); ++ printf("%s: dhd_ioctl_timeout_msec = %d\n", __FUNCTION__, conf->dhd_ioctl_timeout_msec); ++ } ++ else if (!strncmp("wl_preinit=", full_param, len_param)) { ++ if (!(conf->wl_preinit = kmalloc(len_param+1, GFP_KERNEL))) { ++ CONFIG_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); ++ } else { ++ memset(conf->wl_preinit, 0, len_param+1); ++ strcpy(conf->wl_preinit, data); ++ printf("%s: wl_preinit = %s\n", __FUNCTION__, conf->wl_preinit); ++ } ++ } + else + return false; + +@@ -2272,7 +2296,7 @@ int + dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) + { + int bcmerror = -1; +- uint len, start_pos=0; ++ uint len = 0, start_pos=0; + void * image = NULL; + char * memblock = NULL; + char *bufp, *pick = NULL, *pch; +@@ -2344,14 +2368,16 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) + continue; + else if (dhd_conf_read_country_list(dhd, pick, len_param)) + continue; ++ else if (dhd_conf_read_mchan_params(dhd, pick, len_param)) ++ continue; + #ifdef PKT_FILTER_SUPPORT + else if (dhd_conf_read_pkt_filter(dhd, pick, len_param)) + continue; + #endif /* PKT_FILTER_SUPPORT */ +-#ifdef IAPSTA_PREINIT +- else if (dhd_conf_read_iapsta(dhd, pick, len_param)) ++#ifdef ISAM_PREINIT ++ else if (dhd_conf_read_isam(dhd, pick, len_param)) + continue; +-#endif /* IAPSTA_PREINIT */ ++#endif /* ISAM_PREINIT */ + #ifdef IDHCP + else if (dhd_conf_read_dhcp_params(dhd, pick, len_param)) + continue; +@@ -2360,6 +2386,10 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) + else if (dhd_conf_read_sdio_params(dhd, pick, len_param)) + continue; + #endif /* BCMSDIO */ ++#ifdef BCMPCIE ++ else if (dhd_conf_read_pcie_params(dhd, pick, len_param)) ++ continue; ++#endif /* BCMPCIE */ + else if (dhd_conf_read_pm_params(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_others(dhd, pick, len_param)) +@@ -2432,7 +2462,7 @@ dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable) + #endif + // other parameters set in preinit or config.txt + } else { +- // clear txglom parameters, but don't change swtxglom since it's possible enabled in config.txt ++ // clear txglom parameters + conf->txglom_ext = FALSE; + conf->txglom_bucket_size = 0; + conf->txglomsize = 0; +@@ -2441,8 +2471,10 @@ dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable) + if (conf->txglom_ext) + printf("%s: txglom_ext=%d, txglom_bucket_size=%d\n", __FUNCTION__, + conf->txglom_ext, conf->txglom_bucket_size); +- printf("%s: txglomsize=%d, deferred_tx_len=%d, bus_txglom=%d\n", __FUNCTION__, +- conf->txglomsize, conf->deferred_tx_len, conf->bus_txglom); ++ printf("%s: txglom_mode=%s\n", __FUNCTION__, ++ conf->txglom_mode==SDPCM_TXGLOM_MDESC?"multi-desc":"copy"); ++ printf("%s: txglomsize=%d, deferred_tx_len=%d\n", __FUNCTION__, ++ conf->txglomsize, conf->deferred_tx_len); + printf("%s: tx_in_rx=%d, txinrx_thres=%d, dhd_txminmax=%d\n", __FUNCTION__, + conf->tx_in_rx, conf->txinrx_thres, conf->dhd_txminmax); + printf("%s: tx_max_offset=%d, txctl_tmo_fix=%d\n", __FUNCTION__, +@@ -2451,10 +2483,151 @@ dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable) + } + #endif + ++static int ++dhd_conf_rsdb_mode(dhd_pub_t *dhd, char *buf) ++{ ++ char *pch; ++ wl_config_t rsdb_mode_cfg = {1, 0}; ++ ++ pch = buf; ++ rsdb_mode_cfg.config = (int)simple_strtol(pch, NULL, 0); ++ ++ if (pch) { ++ dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "rsdb_mode", (char *)&rsdb_mode_cfg, ++ sizeof(rsdb_mode_cfg), TRUE); ++ printf("%s: rsdb_mode %d\n", __FUNCTION__, rsdb_mode_cfg.config); ++ } ++ ++ return 0; ++} ++ ++typedef int (tpl_parse_t)(dhd_pub_t *dhd, char *buf); ++ ++typedef struct iovar_tpl_t { ++ int cmd; ++ char *name; ++ tpl_parse_t *parse; ++} iovar_tpl_t; ++ ++const iovar_tpl_t iovar_tpl_list[] = { ++ {WLC_SET_VAR, "rsdb_mode", dhd_conf_rsdb_mode}, ++}; ++ ++static int iovar_tpl_parse(const iovar_tpl_t *tpl, int tpl_count, ++ dhd_pub_t *dhd, int cmd, char *name, char *buf) ++{ ++ int i, ret = 0; ++ ++ /* look for a matching code in the table */ ++ for (i = 0; i < tpl_count; i++, tpl++) { ++ if (tpl->cmd == cmd && !strcmp(tpl->name, name)) ++ break; ++ } ++ if (i < tpl_count && tpl->parse) { ++ ret = tpl->parse(dhd, buf); ++ } else { ++ ret = -1; ++ } ++ ++ return ret; ++} ++ ++bool ++dhd_conf_set_wl_preinit(dhd_pub_t *dhd, char *data) ++{ ++ int cmd, val, ret = 0; ++ char name[32], *pch, *pick_tmp, *pick_tmp2; ++ ++ /* Process wl_preinit: ++ * wl_preinit=[cmd]/[val], [cmd]/[val] \ ++ * Ex: wl_preinit=86/0, mpc/0 ++ */ ++ pick_tmp = data; ++ while (pick_tmp && (pick_tmp2 = bcmstrtok(&pick_tmp, ",", 0)) != NULL) { ++ pch = bcmstrtok(&pick_tmp2, "=", 0); ++ if (!pch) ++ break; ++ if (*pch == ' ') { ++ pch++; ++ } ++ memset(name, 0 , sizeof (name)); ++ cmd = (int)simple_strtol(pch, NULL, 0); ++ if (cmd == 0) { ++ cmd = WLC_SET_VAR; ++ strcpy(name, pch); ++ } ++ pch = bcmstrtok(&pick_tmp2, ",", 0); ++ if (!pch) { ++ break; ++ } ++ ret = iovar_tpl_parse(iovar_tpl_list, ARRAY_SIZE(iovar_tpl_list), ++ dhd, cmd, name, pch); ++ if (ret) { ++ val = (int)simple_strtol(pch, NULL, 0); ++ dhd_conf_set_intiovar(dhd, cmd, name, val, -1, TRUE); ++ } ++ } ++ ++ return true; ++} ++ ++void ++dhd_conf_postinit_ioctls(dhd_pub_t *dhd) ++{ ++ struct dhd_conf *conf = dhd->conf; ++ ++ dhd_conf_set_intiovar(dhd, WLC_UP, "up", 0, 0, FALSE); ++ dhd_conf_map_country_list(dhd, &conf->cspec, 0); ++ dhd_conf_set_country(dhd, &conf->cspec); ++ dhd_conf_fix_country(dhd); ++ dhd_conf_get_country(dhd, &dhd->dhd_cspec); ++ ++ dhd_conf_set_intiovar(dhd, WLC_SET_BAND, "WLC_SET_BAND", conf->band, 0, FALSE); ++ dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); ++ if (conf->fw_type == FW_TYPE_MESH) ++ conf->pm = PM_OFF; ++ dhd_conf_set_intiovar(dhd, WLC_SET_PM, "PM", conf->pm, 0, FALSE); ++ dhd_conf_set_intiovar(dhd, WLC_SET_SRL, "WLC_SET_SRL", conf->srl, 0, TRUE); ++ dhd_conf_set_intiovar(dhd, WLC_SET_LRL, "WLC_SET_LRL", conf->lrl, 0, FALSE); ++ dhd_conf_set_bw_cap(dhd); ++ dhd_conf_set_roam(dhd); ++ ++#if defined(BCMPCIE) ++ dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:deepsleep_disable", ++ conf->bus_deepsleep_disable, 0, FALSE); ++#endif /* defined(BCMPCIE) */ ++ ++#ifdef IDHCP ++ dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpc_enable", conf->dhcpc_enable, 0, FALSE); ++ if (dhd->conf->dhcpd_enable >= 0) { ++ dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_addr", ++ (char *)&conf->dhcpd_ip_addr, sizeof(conf->dhcpd_ip_addr), FALSE); ++ dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_mask", ++ (char *)&conf->dhcpd_ip_mask, sizeof(conf->dhcpd_ip_mask), FALSE); ++ dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_start", ++ (char *)&conf->dhcpd_ip_start, sizeof(conf->dhcpd_ip_start), FALSE); ++ dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_end", ++ (char *)&conf->dhcpd_ip_end, sizeof(conf->dhcpd_ip_end), FALSE); ++ dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpd_enable", ++ conf->dhcpd_enable, 0, FALSE); ++ } ++#endif ++ dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "txbf", conf->txbf, 0, FALSE); ++ dhd_conf_set_intiovar(dhd, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG", conf->frameburst, 0, FALSE); ++ ++ dhd_conf_set_wl_preinit(dhd, conf->wl_preinit); ++ ++#ifndef WL_CFG80211 ++ dhd_conf_set_intiovar(dhd, WLC_UP, "up", 0, 0, FALSE); ++#endif ++ ++} ++ + int + dhd_conf_preinit(dhd_pub_t *dhd) + { + struct dhd_conf *conf = dhd->conf; ++ int i; + + CONFIG_TRACE(("%s: Enter\n", __FUNCTION__)); + +@@ -2463,13 +2636,19 @@ dhd_conf_preinit(dhd_pub_t *dhd) + dhd_conf_free_mac_list(&conf->nv_by_mac); + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + #endif +- if (conf->magic_pkt_filter_add) ++ dhd_conf_free_country_list(&conf->country_list); ++ dhd_conf_free_country_list(&conf->country_list_nodfs); ++ if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); ++ conf->magic_pkt_filter_add = NULL; ++ } ++ if (conf->wl_preinit) { ++ kfree(conf->wl_preinit); ++ conf->wl_preinit = NULL; ++ } + memset(&conf->country_list, 0, sizeof(conf_country_list_t)); + conf->band = -1; +- conf->mimo_bw_cap = -1; +- conf->bw_cap_2g = -1; +- conf->bw_cap_5g = -1; ++ memset(&conf->bw_cap, -1, sizeof(conf->bw_cap)); + if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { + strcpy(conf->cspec.country_abbrev, "ALL"); + strcpy(conf->cspec.ccode, "ALL"); +@@ -2477,7 +2656,8 @@ dhd_conf_preinit(dhd_pub_t *dhd) + } else if (conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || + conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || +- conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID) { ++ conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID || ++ conf->chip == BCM4362_CHIP_ID) { + strcpy(conf->cspec.country_abbrev, "CN"); + strcpy(conf->cspec.ccode, "CN"); + conf->cspec.rev = 38; +@@ -2516,7 +2696,6 @@ dhd_conf_preinit(dhd_pub_t *dhd) + conf->force_wme_ac = 0; + memset(&conf->wme_sta, 0, sizeof(wme_param_t)); + memset(&conf->wme_ap, 0, sizeof(wme_param_t)); +- conf->stbc = -1; + conf->phy_oclscdenable = -1; + #ifdef PKT_FILTER_SUPPORT + memset(&conf->pkt_filter_add, 0, sizeof(conf_pkt_filter_add_t)); +@@ -2525,19 +2704,16 @@ dhd_conf_preinit(dhd_pub_t *dhd) + conf->srl = -1; + conf->lrl = -1; + conf->bcn_timeout = 16; +- conf->spect = -1; + conf->txbf = -1; +- conf->lpc = -1; + conf->disable_proptx = -1; ++ conf->dhd_poll = -1; + #ifdef BCMSDIO +- conf->bus_txglom = -1; + conf->use_rxchain = 0; + conf->bus_rxglom = TRUE; + conf->txglom_ext = FALSE; + conf->tx_max_offset = 0; + conf->txglomsize = SDPCM_DEFGLOM_SIZE; +- conf->dhd_poll = -1; +- conf->txctl_tmo_fix = 5; ++ conf->txctl_tmo_fix = 300; + conf->tx_in_rx = TRUE; + conf->txglom_mode = SDPCM_TXGLOM_CPY; + conf->deferred_tx_len = 0; +@@ -2545,19 +2721,26 @@ dhd_conf_preinit(dhd_pub_t *dhd) + conf->txinrx_thres = -1; + conf->sd_f2_blocksize = 0; + conf->oob_enabled_later = FALSE; ++ conf->orphan_move = 0; ++#endif ++#ifdef BCMPCIE ++ conf->bus_deepsleep_disable = 1; + #endif +- conf->ampdu_ba_wsize = 0; +- conf->ampdu_hostreorder = -1; + conf->dpc_cpucore = -1; + conf->rxf_cpucore = -1; + conf->frameburst = -1; + conf->deepsleep = FALSE; + conf->pm = -1; + conf->pm_in_suspend = -1; +- conf->pm2_sleep_ret = -1; ++ conf->suspend_bcn_li_dtim = -1; + conf->num_different_channels = -1; + conf->xmit_in_suspend = TRUE; + conf->ap_in_suspend = 0; ++#ifdef SUSPEND_EVENT ++ conf->suspend_eventmask_enable = FALSE; ++ memset(&conf->suspend_eventmask, 0, sizeof(conf->suspend_eventmask)); ++ memset(&conf->resume_eventmask, 0, sizeof(conf->resume_eventmask)); ++#endif + #ifdef IDHCP + conf->dhcpc_enable = -1; + conf->dhcpd_enable = -1; +@@ -2568,25 +2751,35 @@ dhd_conf_preinit(dhd_pub_t *dhd) + conf->tsq = 0; + #endif + #ifdef DHDTCPACK_SUPPRESS ++#ifdef BCMPCIE ++ conf->tcpack_sup_mode = TCPACK_SUP_DEFAULT; ++#else + conf->tcpack_sup_mode = TCPACK_SUP_OFF; ++#endif + #endif + conf->pktprio8021x = -1; +- conf->rsdb_mode = -2; +- conf->vhtmode = -1; +- conf->autocountry = -1; +-#ifdef IAPSTA_PREINIT +- memset(conf->iapsta_init, 0, sizeof(conf->iapsta_init)); +- memset(conf->iapsta_config, 0, sizeof(conf->iapsta_config)); +- memset(conf->iapsta_enable, 0, sizeof(conf->iapsta_enable)); ++ conf->ctrl_resched = 2; ++ conf->dhd_ioctl_timeout_msec = 0; ++#ifdef ISAM_PREINIT ++ memset(conf->isam_init, 0, sizeof(conf->isam_init)); ++ memset(conf->isam_config, 0, sizeof(conf->isam_config)); ++ memset(conf->isam_enable, 0, sizeof(conf->isam_enable)); + #endif ++ for (i=0; imchan[i], -1, sizeof(mchan_params_t)); ++ } + if (conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4371_CHIP_ID || conf->chip == BCM43569_CHIP_ID || +- conf->chip == BCM4359_CHIP_ID) { ++ conf->chip == BCM4359_CHIP_ID || conf->chip == BCM4362_CHIP_ID) { + #ifdef DHDTCPACK_SUPPRESS ++#ifdef BCMSDIO + conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; + #endif ++#endif ++#if defined(BCMSDIO) || defined(BCMPCIE) + dhd_rxbound = 128; + dhd_txbound = 64; ++#endif + conf->txbf = 1; + conf->frameburst = 1; + #ifdef BCMSDIO +@@ -2594,6 +2787,11 @@ dhd_conf_preinit(dhd_pub_t *dhd) + conf->txinrx_thres = 128; + conf->sd_f2_blocksize = CUSTOM_SDIO_F2_BLKSIZE; + conf->oob_enabled_later = TRUE; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) ++ conf->orphan_move = 1; ++#else ++ conf->orphan_move = 0; ++#endif + #endif + } + +@@ -2603,9 +2801,6 @@ dhd_conf_preinit(dhd_pub_t *dhd) + conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || + conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { + conf->txglom_ext = TRUE; +- conf->use_rxchain = 0; +- conf->tx_in_rx = TRUE; +- conf->tx_max_offset = 1; + } else { + conf->txglom_ext = FALSE; + } +@@ -2621,10 +2816,7 @@ dhd_conf_preinit(dhd_pub_t *dhd) + #endif + if (conf->txglomsize > SDPCM_MAXGLOM_SIZE) + conf->txglomsize = SDPCM_MAXGLOM_SIZE; +- conf->deferred_tx_len = conf->txglomsize; + #endif +- if (conf->chip == BCM4354_CHIP_ID && conf->chiprev == 1) +- dhd_slpauto = 0; + + return 0; + } +@@ -2637,8 +2829,16 @@ dhd_conf_reset(dhd_pub_t *dhd) + dhd_conf_free_mac_list(&dhd->conf->nv_by_mac); + dhd_conf_free_chip_nv_path_list(&dhd->conf->nv_by_chip); + #endif +- if (dhd->conf->magic_pkt_filter_add) ++ dhd_conf_free_country_list(&dhd->conf->country_list); ++ dhd_conf_free_country_list(&dhd->conf->country_list_nodfs); ++ if (dhd->conf->magic_pkt_filter_add) { + kfree(dhd->conf->magic_pkt_filter_add); ++ dhd->conf->magic_pkt_filter_add = NULL; ++ } ++ if (dhd->conf->wl_preinit) { ++ kfree(dhd->conf->wl_preinit); ++ dhd->conf->wl_preinit = NULL; ++ } + memset(dhd->conf, 0, sizeof(dhd_conf_t)); + return 0; + } +@@ -2682,8 +2882,16 @@ dhd_conf_detach(dhd_pub_t *dhd) + dhd_conf_free_mac_list(&dhd->conf->nv_by_mac); + dhd_conf_free_chip_nv_path_list(&dhd->conf->nv_by_chip); + #endif +- if (dhd->conf->magic_pkt_filter_add) ++ dhd_conf_free_country_list(&dhd->conf->country_list); ++ dhd_conf_free_country_list(&dhd->conf->country_list_nodfs); ++ if (dhd->conf->magic_pkt_filter_add) { + kfree(dhd->conf->magic_pkt_filter_add); ++ dhd->conf->magic_pkt_filter_add = NULL; ++ } ++ if (dhd->conf->wl_preinit) { ++ kfree(dhd->conf->wl_preinit); ++ dhd->conf->wl_preinit = NULL; ++ } + MFREE(dhd->osh, dhd->conf, sizeof(dhd_conf_t)); + } + dhd->conf = NULL; +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.h +index bfa6a3ea31e6..6adf2d070750 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.h +@@ -1,5 +1,4 @@ + /* SPDX-License-Identifier: GPL-2.0 */ +- + #ifndef _dhd_config_ + #define _dhd_config_ + +@@ -9,36 +8,27 @@ + #include + #include <802.11.h> + ++#define FW_TYPE_STA 0 ++#define FW_TYPE_APSTA 1 ++#define FW_TYPE_P2P 2 ++#define FW_TYPE_MESH 3 ++#define FW_TYPE_ES 4 ++#define FW_TYPE_MFG 5 ++#define FW_TYPE_G 0 ++#define FW_TYPE_AG 1 ++ + #define FW_PATH_AUTO_SELECT 1 + //#define CONFIG_PATH_AUTO_SELECT + extern char firmware_path[MOD_PARAM_PATHLEN]; ++#if defined(BCMSDIO) || defined(BCMPCIE) + extern uint dhd_rxbound; + extern uint dhd_txbound; ++#endif + #ifdef BCMSDIO + #define TXGLOM_RECV_OFFSET 8 + extern uint dhd_doflow; + extern uint dhd_slpauto; +- +-#define BCM43362A0_CHIP_REV 0 +-#define BCM43362A2_CHIP_REV 1 +-#define BCM43430A0_CHIP_REV 0 +-#define BCM43430A1_CHIP_REV 1 +-#define BCM43430A2_CHIP_REV 2 +-#define BCM43012B0_CHIP_REV 1 +-#define BCM4330B2_CHIP_REV 4 +-#define BCM4334B1_CHIP_REV 3 +-#define BCM43341B0_CHIP_REV 2 +-#define BCM43241B4_CHIP_REV 5 +-#define BCM4335A0_CHIP_REV 2 +-#define BCM4339A0_CHIP_REV 1 +-#define BCM43455C0_CHIP_REV 6 +-#define BCM43456C5_CHIP_REV 9 +-#define BCM4354A1_CHIP_REV 1 +-#define BCM4359B1_CHIP_REV 5 +-#define BCM4359C0_CHIP_REV 9 + #endif +-#define BCM4356A2_CHIP_REV 2 +-#define BCM4358A3_CHIP_REV 3 + + typedef struct wl_mac_range { + uint32 oui; +@@ -98,25 +88,35 @@ typedef struct conf_pkt_filter_del { + #define CONFIG_COUNTRY_LIST_SIZE 100 + typedef struct conf_country_list { + uint32 count; +- wl_country_t cspec[CONFIG_COUNTRY_LIST_SIZE]; ++ wl_country_t *cspec[CONFIG_COUNTRY_LIST_SIZE]; + } conf_country_list_t; + ++/* mchan_params */ ++#define MCHAN_MAX_NUM 4 ++#define MIRACAST_SOURCE 1 ++#define MIRACAST_SINK 2 ++typedef struct mchan_params { ++ int bw; ++ int p2p_mode; ++ int miracast_mode; ++} mchan_params_t; ++ + typedef struct dhd_conf { + uint chip; + uint chiprev; ++ int fw_type; + wl_mac_list_ctrl_t fw_by_mac; + wl_mac_list_ctrl_t nv_by_mac; + wl_chip_nv_path_list_ctrl_t nv_by_chip; + conf_country_list_t country_list; ++ conf_country_list_t country_list_nodfs; + int band; +- int mimo_bw_cap; +- int bw_cap_2g; +- int bw_cap_5g; ++ int bw_cap[2]; + wl_country_t cspec; + wl_channel_list_t channels; + uint roam_off; + uint roam_off_suspend; +- int roam_trigger[2]; ++ int roam_trigger[2]; + int roam_scan_period[2]; + int roam_delta[2]; + int fullroamperiod; +@@ -124,7 +124,6 @@ typedef struct dhd_conf { + int force_wme_ac; + wme_param_t wme_sta; + wme_param_t wme_ap; +- int stbc; + int phy_oclscdenable; + #ifdef PKT_FILTER_SUPPORT + conf_pkt_filter_add_t pkt_filter_add; +@@ -134,12 +133,10 @@ typedef struct dhd_conf { + int srl; + int lrl; + uint bcn_timeout; +- int spect; + int txbf; +- int lpc; + int disable_proptx; ++ int dhd_poll; + #ifdef BCMSDIO +- int bus_txglom; + int use_rxchain; + bool bus_rxglom; + bool txglom_ext; /* Only for 43362/4330/43340/43341/43241 */ +@@ -150,7 +147,6 @@ typedef struct dhd_conf { + */ + int tx_max_offset; + uint txglomsize; +- int dhd_poll; + int txctl_tmo_fix; + bool tx_in_rx; + bool txglom_mode; +@@ -164,22 +160,22 @@ typedef struct dhd_conf { + int dhd_txminmax; // -1=DATABUFCNT(bus) + uint sd_f2_blocksize; + bool oob_enabled_later; ++ int orphan_move; ++#endif ++#ifdef BCMPCIE ++ int bus_deepsleep_disable; + #endif +- int ampdu_ba_wsize; +- int ampdu_hostreorder; + int dpc_cpucore; + int rxf_cpucore; + int frameburst; + bool deepsleep; + int pm; + int pm_in_suspend; +- int pm2_sleep_ret; ++ int suspend_bcn_li_dtim; + #ifdef DHDTCPACK_SUPPRESS + uint8 tcpack_sup_mode; + #endif + int pktprio8021x; +- int rsdb_mode; +- int vhtmode; + int num_different_channels; + int xmit_in_suspend; + int ap_in_suspend; +@@ -196,12 +192,15 @@ typedef struct dhd_conf { + struct ipv4_addr dhcpd_ip_start; + struct ipv4_addr dhcpd_ip_end; + #endif +-#ifdef IAPSTA_PREINIT +- char iapsta_init[50]; +- char iapsta_config[300]; +- char iapsta_enable[50]; ++#ifdef ISAM_PREINIT ++ char isam_init[50]; ++ char isam_config[300]; ++ char isam_enable[50]; + #endif +- int autocountry; ++ int ctrl_resched; ++ int dhd_ioctl_timeout_msec; ++ struct mchan_params mchan[MCHAN_MAX_NUM]; ++ char *wl_preinit; + int tsq; + } dhd_conf_t; + +@@ -215,7 +214,7 @@ void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, uint chip); + void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable); + int dhd_conf_set_blksize(bcmsdh_info_t *sdh); + #endif +-void dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path, char *nv_path); ++void dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path); + void dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path); + void dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path); + void dhd_conf_set_path(dhd_pub_t *dhd, char *dst_name, char *dst_path, char *src_path); +@@ -226,14 +225,13 @@ int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val, int def + int dhd_conf_get_iovar(dhd_pub_t *dhd, int cmd, char *name, char *buf, int len, int ifidx); + int dhd_conf_set_bufiovar(dhd_pub_t *dhd, uint cmd, char *name, char *buf, int len, bool down); + uint dhd_conf_get_band(dhd_pub_t *dhd); +-int dhd_conf_set_country(dhd_pub_t *dhd); ++int dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec); + int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec); +-int dhd_conf_get_country_from_config(dhd_pub_t *dhd, wl_country_t *cspec); ++int dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec, int nodfs); + int dhd_conf_fix_country(dhd_pub_t *dhd); + bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel); +-int dhd_conf_set_roam(dhd_pub_t *dhd); +-void dhd_conf_set_bw_cap(dhd_pub_t *dhd); + void dhd_conf_set_wme(dhd_pub_t *dhd, int mode); ++void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source); + void dhd_conf_add_pkt_filter(dhd_pub_t *dhd); + bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id); + void dhd_conf_discard_pkt_filter(dhd_pub_t *dhd); +@@ -247,6 +245,7 @@ int dhd_conf_get_disable_proptx(dhd_pub_t *dhd); + #endif + int dhd_conf_get_ap_mode_in_suspend(dhd_pub_t *dhd); + int dhd_conf_set_ap_in_suspend(dhd_pub_t *dhd, int suspend); ++void dhd_conf_postinit_ioctls(dhd_pub_t *dhd); + int dhd_conf_preinit(dhd_pub_t *dhd); + int dhd_conf_reset(dhd_pub_t *dhd); + int dhd_conf_attach(dhd_pub_t *dhd); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c +index a7ef7c84b18b..7291322edc4f 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c +@@ -1,5 +1,4 @@ + /* SPDX-License-Identifier: GPL-2.0 */ +- + #include + #include + #include +@@ -148,10 +147,10 @@ static int dhd_wlan_get_mac_addr(unsigned char *buf) + bcopy((char *)&ea_example, buf, sizeof(struct ether_addr)); + } + #endif /* EXAMPLE_GET_MAC */ ++ err = rockchip_wifi_mac_addr(buf); + #ifdef EXAMPLE_GET_MAC_VER2 + /* EXAMPLE code */ + { +- char mac[6] = {0x00,0x11,0x22,0x33,0x44,0xFF}; + char macpad[56]= { + 0x00,0xaa,0x9c,0x84,0xc7,0xbc,0x9b,0xf6, + 0x02,0x33,0xa9,0x4d,0x5c,0xb4,0x0a,0x5d, +@@ -160,11 +159,9 @@ static int dhd_wlan_get_mac_addr(unsigned char *buf) + 0x4a,0xeb,0xf6,0xe6,0x3c,0xe7,0x5f,0xfc, + 0x0e,0xa7,0xb3,0x0f,0x00,0xe4,0x4a,0xaf, + 0x87,0x08,0x16,0x6d,0x3a,0xe3,0xc7,0x80}; +- bcopy(mac, buf, sizeof(mac)); + bcopy(macpad, buf+6, sizeof(macpad)); + } + #endif /* EXAMPLE_GET_MAC_VER2 */ +- err = rockchip_wifi_mac_addr(buf); + + return err; + } +@@ -244,7 +241,6 @@ int dhd_wlan_init_gpio(void) + #ifdef CUSTOMER_OOB + int host_oob_irq = -1; + uint host_oob_irq_flags = 0; +- int irq_flags = -1; + #endif + + /* Please check your schematic and fill right GPIO number which connected to +@@ -255,56 +251,54 @@ int dhd_wlan_init_gpio(void) + gpio_wl_host_wake = -1; + #endif + +- printf("%s: GPIO(WL_REG_ON) = %d\n", __FUNCTION__, gpio_wl_reg_on); + if (gpio_wl_reg_on >= 0) { + err = gpio_request(gpio_wl_reg_on, "WL_REG_ON"); + if (err < 0) { +- printf("%s: Faiiled to request gpio %d for WL_REG_ON\n", ++ printf("%s: gpio_request(%d) for WL_REG_ON failed\n", + __FUNCTION__, gpio_wl_reg_on); + gpio_wl_reg_on = -1; + } + } + + #ifdef CUSTOMER_OOB +- printf("%s: GPIO(WL_HOST_WAKE) = %d\n", __FUNCTION__, gpio_wl_host_wake); + if (gpio_wl_host_wake >= 0) { + err = gpio_request(gpio_wl_host_wake, "bcmdhd"); + if (err < 0) { +- printf("%s: gpio_request failed\n", __FUNCTION__); ++ printf("%s: gpio_request(%d) for WL_HOST_WAKE failed\n", ++ __FUNCTION__, gpio_wl_host_wake); + return -1; + } + err = gpio_direction_input(gpio_wl_host_wake); + if (err < 0) { +- printf("%s: gpio_direction_input failed\n", __FUNCTION__); ++ printf("%s: gpio_direction_input(%d) for WL_HOST_WAKE failed\n", ++ __FUNCTION__, gpio_wl_host_wake); + gpio_free(gpio_wl_host_wake); + return -1; + } + host_oob_irq = gpio_to_irq(gpio_wl_host_wake); + if (host_oob_irq < 0) { +- printf("%s: gpio_to_irq failed\n", __FUNCTION__); ++ printf("%s: gpio_to_irq(%d) for WL_HOST_WAKE failed\n", ++ __FUNCTION__, gpio_wl_host_wake); + gpio_free(gpio_wl_host_wake); + return -1; + } + } + host_oob_irq = rockchip_wifi_get_oob_irq(); +- printf("%s: host_oob_irq: %d\n", __FUNCTION__, host_oob_irq); + + #ifdef HW_OOB +- host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE; +- irq_flags = rockchip_wifi_get_oob_irq_flag(); +- if (irq_flags == 1) +- host_oob_irq_flags |= IORESOURCE_IRQ_HIGHLEVEL; +- else if (irq_flags == 0) +- host_oob_irq_flags |= IORESOURCE_IRQ_LOWLEVEL; +- else +- pr_warn("%s: unknown oob irqflags !\n", __func__); ++#ifdef HW_OOB_LOW_LEVEL ++ host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_SHAREABLE; ++#else ++ host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE; ++#endif + #else + host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_SHAREABLE; + #endif + + dhd_wlan_resources[0].start = dhd_wlan_resources[0].end = host_oob_irq; + dhd_wlan_resources[0].flags = host_oob_irq_flags; +- printf("%s: host_oob_irq_flags=0x%x\n", __FUNCTION__, host_oob_irq_flags); ++ printf("%s: WL_REG_ON=%d, WL_HOST_WAKE=%d\n", __FUNCTION__, gpio_wl_reg_on, gpio_wl_host_wake); ++ printf("%s: oob_irq=%d, oob_irq_flags=0x%x\n", __FUNCTION__, host_oob_irq, host_oob_irq_flags); + #endif /* CUSTOMER_OOB */ + + return 0; +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_ip.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_ip.c +old mode 100755 +new mode 100644 +index ee7d105d2317..d8be26cd8cef +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_ip.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_ip.c +@@ -287,10 +287,20 @@ static void _tdata_psh_info_pool_deinit(dhd_pub_t *dhdp, + return; + } + +-static void dhd_tcpack_send(ulong data) ++static void dhd_tcpack_send( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ ulong data ++#endif ++) + { + tcpack_sup_module_t *tcpack_sup_mod; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ tcpack_info_t *cur_tbl = from_timer(cur_tbl, t, timer); ++#else + tcpack_info_t *cur_tbl = (tcpack_info_t *)data; ++#endif + dhd_pub_t *dhdp; + int ifidx; + void* pkt; +@@ -464,9 +474,13 @@ int dhd_tcpack_suppress_set(dhd_pub_t *dhdp, uint8 mode) + tcpack_info_t *tcpack_info_tbl = + &tcpack_sup_module->tcpack_info_tbl[i]; + tcpack_info_tbl->dhdp = dhdp; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&tcpack_info_tbl->timer, dhd_tcpack_send, 0); ++#else + init_timer(&tcpack_info_tbl->timer); + tcpack_info_tbl->timer.data = (ulong)tcpack_info_tbl; + tcpack_info_tbl->timer.function = dhd_tcpack_send; ++#endif + } + break; + } +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c +index 233c1f77c122..87c5df2a8a0f 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.c +@@ -345,6 +345,12 @@ static void dhd_hang_process(void *dhd_info, void *event_data, u8 event); + MODULE_LICENSE("GPL and additional rights"); + #endif /* LinuxVer */ + ++#if defined(MULTIPLE_SUPPLICANT) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) ++DEFINE_MUTEX(_dhd_mutex_lock_); ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ ++#endif ++ + #ifdef CONFIG_BCM_DETECT_CONSECUTIVE_HANG + #define MAX_CONSECUTIVE_HANG_COUNTS 5 + #endif /* CONFIG_BCM_DETECT_CONSECUTIVE_HANG */ +@@ -600,7 +606,7 @@ typedef struct dhd_info { + dhd_pub_t pub; + dhd_if_t *iflist[DHD_MAX_IFS]; /* for supporting multiple interfaces */ + +- void *adapter; /* adapter information, interrupt, fw path etc. */ ++ wifi_adapter_info_t *adapter; /* adapter information, interrupt, fw path etc. */ + char fw_path[PATH_MAX]; /* path to firmware image */ + char nv_path[PATH_MAX]; /* path to nvram vars file */ + char clm_path[PATH_MAX]; /* path to clm vars file */ +@@ -616,6 +622,10 @@ typedef struct dhd_info { + #ifdef PROP_TXSTATUS + spinlock_t wlfc_spinlock; + ++#ifdef BCMDBUS ++ ulong wlfc_lock_flags; ++ ulong wlfc_pub_lock_flags; ++#endif /* BCMDBUS */ + #endif /* PROP_TXSTATUS */ + #ifdef WLMEDIA_HTSF + htsf_t htsf; +@@ -637,10 +647,14 @@ typedef struct dhd_info { + spinlock_t txqlock; + spinlock_t rxqlock; + spinlock_t dhd_lock; ++#ifdef BCMDBUS ++ ulong txqlock_flags; ++#else + + struct semaphore sdsem; + tsk_ctl_t thr_dpc_ctl; + tsk_ctl_t thr_wdt_ctl; ++#endif /* BCMDBUS */ + + tsk_ctl_t thr_rxf_ctl; + spinlock_t rxf_lock; +@@ -940,7 +954,7 @@ int op_mode = 0; + int disable_proptx = 0; + module_param(op_mode, int, 0644); + extern int wl_control_wl_start(struct net_device *dev); +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(BCMLXSDMMC) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (defined(BCMLXSDMMC) || defined(BCMDBUS)) + struct semaphore dhd_registration_sem; + #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ + +@@ -950,6 +964,9 @@ static void dhd_ifdel_event_handler(void *handle, void *event_info, u8 event); + static void dhd_set_mac_addr_handler(void *handle, void *event_info, u8 event); + static void dhd_set_mcast_list_handler(void *handle, void *event_info, u8 event); + ++#ifdef DHD_UPDATE_INTF_MAC ++static void dhd_ifupdate_event_handler(void *handle, void *event_info, u8 event); ++#endif /* DHD_UPDATE_INTF_MAC */ + #if defined(CONFIG_IPV6) && defined(IPV6_NDO_SUPPORT) + static void dhd_inet6_work_handler(void *dhd_info, void *event_data, u8 event); + #endif /* CONFIG_IPV6 && IPV6_NDO_SUPPORT */ +@@ -1054,10 +1071,10 @@ module_param(dhd_dpc_prio, int, 0); + int dhd_rxf_prio = CUSTOM_RXF_PRIO_SETTING; + module_param(dhd_rxf_prio, int, 0); + +-#if !defined(BCMDHDUSB) ++#if !defined(BCMDBUS) + extern int dhd_dongle_ramsize; + module_param(dhd_dongle_ramsize, int, 0); +-#endif /* BCMDHDUSB */ ++#endif /* !BCMDBUS */ + + #ifdef WL_CFG80211 + int passive_channel_skip = 0; +@@ -1903,9 +1920,11 @@ module_param(dhd_pktgen_len, uint, 0); + + + ++#ifndef BCMDBUS + /* Allow delayed firmware download for debug purpose */ + int allow_delay_fwdl = FALSE; + module_param(allow_delay_fwdl, int, 0); ++#endif /* !BCMDBUS */ + + extern char dhd_version[]; + extern char fw_version[]; +@@ -1938,7 +1957,9 @@ int dhd_monitor_uninit(void); + struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev); + #endif /* defined(WL_WIRELESS_EXT) */ + ++#ifndef BCMDBUS + static void dhd_dpc(ulong data); ++#endif /* !BCMDBUS */ + /* forward decl */ + extern int dhd_wait_pend8021x(struct net_device *dev); + void dhd_os_wd_timer_extend(void *bus, bool extend); +@@ -3208,8 +3229,8 @@ int dhd_process_cid_mac(dhd_pub_t *dhdp, bool prepost) + } + + // terence 20160615: fix building error if ARP_OFFLOAD_SUPPORT removed +-#if defined(PKT_FILTER_SUPPORT) && defined(ARP_OFFLOAD_SUPPORT) +-#ifndef GAN_LITE_NAT_KEEPALIVE_FILTER ++#if defined(PKT_FILTER_SUPPORT) ++#if defined(ARP_OFFLOAD_SUPPORT) && !defined(GAN_LITE_NAT_KEEPALIVE_FILTER) + static bool + _turn_on_arp_filter(dhd_pub_t *dhd, int op_mode_param) + { +@@ -4354,6 +4375,87 @@ done: + dhd_net_if_unlock_local(dhd); + } + ++#ifdef DHD_UPDATE_INTF_MAC ++static void ++dhd_ifupdate_event_handler(void *handle, void *event_info, u8 event) ++{ ++ dhd_info_t *dhd = handle; ++ int ifidx; ++ dhd_if_event_t *if_event = event_info; ++ ++ if (event != DHD_WQ_WORK_IF_UPDATE) { ++ DHD_ERROR(("%s: unexpected event \n", __FUNCTION__)); ++ return; ++ } ++ ++ if (!dhd) { ++ DHD_ERROR(("%s: dhd info not available \n", __FUNCTION__)); ++ return; ++ } ++ ++ if (!if_event) { ++ DHD_ERROR(("%s: event data is null \n", __FUNCTION__)); ++ return; ++ } ++ ++ dhd_net_if_lock_local(dhd); ++ DHD_OS_WAKE_LOCK(&dhd->pub); ++ ++ ifidx = if_event->event.ifidx; ++ DHD_TRACE(("%s: Update interface with idx %d\n", __FUNCTION__, ifidx)); ++ ++ dhd_op_if_update(&dhd->pub, ifidx); ++ ++ MFREE(dhd->pub.osh, if_event, sizeof(dhd_if_event_t)); ++ ++ DHD_OS_WAKE_UNLOCK(&dhd->pub); ++ dhd_net_if_unlock_local(dhd); ++} ++ ++int dhd_op_if_update(dhd_pub_t *dhdpub, int ifidx) ++{ ++ dhd_info_t * dhdinfo = NULL; ++ dhd_if_t * ifp = NULL; ++ int ret = 0; ++ char buf[128]; ++ ++ if ((NULL==dhdpub)||(NULL==dhdpub->info)) { ++ DHD_ERROR(("%s: *** DHD handler is NULL!\n", __FUNCTION__)); ++ return -1; ++ } else { ++ dhdinfo = (dhd_info_t *)dhdpub->info; ++ ifp = dhdinfo->iflist[ifidx]; ++ if (NULL==ifp) { ++ DHD_ERROR(("%s: *** ifp handler is NULL!\n", __FUNCTION__)); ++ return -2; ++ } ++ } ++ ++ DHD_TRACE(("%s: idx %d\n", __FUNCTION__, ifidx)); ++ // Get MAC address ++ strcpy(buf, "cur_etheraddr"); ++ ret = dhd_wl_ioctl_cmd(&dhdinfo->pub, WLC_GET_VAR, buf, sizeof(buf), FALSE, ifp->idx); ++ if (0>ret) { ++ DHD_ERROR(("Failed to upudate the MAC address for itf=%s, ret=%d\n", ifp->name, ret)); ++ // avoid collision ++ dhdinfo->iflist[ifp->idx]->mac_addr[5] += 1; ++ // force locally administrate address ++ ETHER_SET_LOCALADDR(&dhdinfo->iflist[ifp->idx]->mac_addr); ++ } else { ++ DHD_EVENT(("Got mac for itf %s, idx %d, MAC=%02X:%02X:%02X:%02X:%02X:%02X\n", ++ ifp->name, ifp->idx, ++ (unsigned char)buf[0], (unsigned char)buf[1], (unsigned char)buf[2], ++ (unsigned char)buf[3], (unsigned char)buf[4], (unsigned char)buf[5])); ++ memcpy(dhdinfo->iflist[ifp->idx]->mac_addr, buf, ETHER_ADDR_LEN); ++ if (dhdinfo->iflist[ifp->idx]->net) { ++ memcpy(dhdinfo->iflist[ifp->idx]->net->dev_addr, buf, ETHER_ADDR_LEN); ++ } ++ } ++ ++ return ret; ++} ++#endif /* DHD_UPDATE_INTF_MAC */ ++ + static void + dhd_set_mac_addr_handler(void *handle, void *event_info, u8 event) + { +@@ -4536,7 +4638,11 @@ dhd_os_wlfc_block(dhd_pub_t *pub) + /* terence 20161229: don't do spin lock if proptx not enabled */ + if (disable_proptx) + return 1; ++#ifdef BCMDBUS ++ spin_lock_irqsave(&di->wlfc_spinlock, di->wlfc_lock_flags); ++#else + spin_lock_bh(&di->wlfc_spinlock); ++#endif /* BCMDBUS */ + return 1; + } + +@@ -4549,7 +4655,11 @@ dhd_os_wlfc_unblock(dhd_pub_t *pub) + /* terence 20161229: don't do spin lock if proptx not enabled */ + if (disable_proptx) + return 1; ++#ifdef BCMDBUS ++ spin_unlock_irqrestore(&di->wlfc_spinlock, di->wlfc_lock_flags); ++#else + spin_unlock_bh(&di->wlfc_spinlock); ++#endif /* BCMDBUS */ + return 1; + } + +@@ -4885,6 +4995,10 @@ __dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf) + ret = dhd_bus_txdata(dhdp->bus, pktbuf); + #endif /* BCMPCIE */ + #endif /* PROP_TXSTATUS */ ++#ifdef BCMDBUS ++ if (ret) ++ PKTCFREE(dhdp->osh, pktbuf, TRUE); ++#endif /* BCMDBUS */ + + return ret; + } +@@ -5054,6 +5168,7 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net) + __FUNCTION__, dhd->pub.busstate, dhd->pub.dhd_bus_busy_state)); + } + #endif ++ + DHD_OS_WAKE_LOCK(&dhd->pub); + DHD_PERIM_LOCK_TRY(DHD_FWDER_UNIT(dhd), lock_taken); + +@@ -5070,7 +5185,7 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net) + __FUNCTION__, dhd->pub.up, dhd->pub.busstate)); + netif_stop_queue(net); + /* Send Event when bus down detected during data session */ +- if (dhd->pub.up && !dhd->pub.hang_was_sent) { ++ if (dhd->pub.up && !dhd->pub.hang_was_sent && !DHD_BUS_CHECK_REMOVE(&dhd->pub)) { + DHD_ERROR(("%s: Event HANG sent up\n", __FUNCTION__)); + dhd->pub.hang_reason = HANG_REASON_BUS_DOWN; + net_os_send_hang_message(net); +@@ -5656,8 +5771,12 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan) + continue; + } + #ifdef DHD_WAKE_STATUS ++#ifdef BCMDBUS ++ wcp = NULL; ++#else + pkt_wake = dhd_bus_get_bus_wake(dhdp); + wcp = dhd_bus_get_wakecount(dhdp); ++#endif /* BCMDBUS */ + if (wcp == NULL) { + /* If wakeinfo count buffer is null do not update wake count values */ + pkt_wake = 0; +@@ -6099,8 +6218,10 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan) + #endif /* DHD_WAKE_STATUS */ + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + if (ifp->net) + ifp->net->last_rx = jiffies; ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) */ + + if (ntoh16(skb->protocol) != ETHER_TYPE_BRCM) { + dhdp->dstats.rx_bytes += skb->len; +@@ -6247,6 +6368,7 @@ error: + return &net->stats; + } + ++#ifndef BCMDBUS + static int + dhd_watchdog_thread(void *data) + { +@@ -6309,9 +6431,19 @@ dhd_watchdog_thread(void *data) + complete_and_exit(&tsk->completed, 0); + } + +-static void dhd_watchdog(ulong data) ++static void dhd_watchdog( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ ulong data ++#endif ++) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ dhd_info_t *dhd = from_timer(dhd, t, timer); ++#else + dhd_info_t *dhd = (dhd_info_t *)data; ++#endif + unsigned long flags; + + if (dhd->pub.dongle_reset) { +@@ -6391,9 +6523,19 @@ dhd_rpm_state_thread(void *data) + complete_and_exit(&tsk->completed, 0); + } + +-static void dhd_runtimepm(ulong data) ++static void dhd_runtimepm( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ ulong data ++#endif ++) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ dhd_info_t *dhd = from_timer(dhd, t, rpm_timer); ++#else + dhd_info_t *dhd = (dhd_info_t *)data; ++#endif + + if (dhd->pub.dongle_reset) { + return; +@@ -6457,6 +6599,7 @@ exit: + return 0; + } + #endif /* DEBUG_CPU_FREQ */ ++ + static int + dhd_dpc_thread(void *data) + { +@@ -6738,6 +6881,7 @@ dhd_sched_dpc(dhd_pub_t *dhdp) + tasklet_schedule(&dhd->tasklet); + } + } ++#endif /* BCMDBUS */ + + static void + dhd_sched_rxf(dhd_pub_t *dhdp, void *skb) +@@ -7008,12 +7152,12 @@ static bool dhd_check_hang(struct net_device *net, dhd_pub_t *dhdp, int error) + if (!dhdp->up) + return FALSE; + +-#if !defined(BCMPCIE) ++#if !defined(BCMPCIE) && !defined(BCMDBUS) + if (dhdp->info->thr_dpc_ctl.thr_pid < 0) { + DHD_ERROR(("%s : skipped due to negative pid - unloading?\n", __FUNCTION__)); + return FALSE; + } +-#endif ++#endif /* !BCMPCIE && !BCMDBUS */ + + if ((error == -ETIMEDOUT) || (error == -EREMOTEIO) || + ((dhdp->busstate == DHD_BUS_DOWN) && (!dhdp->dongle_reset))) { +@@ -7387,6 +7531,7 @@ int dhd_ioctl_process(dhd_pub_t *pub, int ifidx, dhd_ioctl_t *ioc, void *data_bu + if (data_buf) + buflen = MIN(ioc->len, WLC_IOCTL_MAXLEN); + ++#ifndef BCMDBUS + /* send to dongle (must be up, and wl). */ + if (pub->busstate == DHD_BUS_DOWN || pub->busstate == DHD_BUS_LOAD) { + if ((!pub->dongle_trap_occured) && allow_delay_fwdl) { +@@ -7412,6 +7557,7 @@ int dhd_ioctl_process(dhd_pub_t *pub, int ifidx, dhd_ioctl_t *ioc, void *data_bu + bcmerror = BCME_DONGLE_DOWN; + goto done; + } ++#endif /* !BCMDBUS */ + + /* + * Flush the TX queue if required for proper message serialization: +@@ -8230,7 +8376,7 @@ exit: + #else + wl_android_wifi_off(net, TRUE); + #ifdef WL_EXT_IAPSTA +- wl_android_ext_dettach_netdev(); ++ wl_ext_iapsta_dettach_netdev(); + #endif + } else { + if (dhd->pub.conf->deepsleep) +@@ -8304,6 +8450,10 @@ dhd_open(struct net_device *net) + uint32 slot_num = -1; + wifi_adapter_info_t *adapter = NULL; + #endif ++#if defined(WL_EXT_IAPSTA) && defined(ISAM_PREINIT) ++ int bytes_written = 0; ++ struct dhd_conf *conf; ++#endif + + if (!dhd_download_fw_on_driverload) { + if (!dhd_driver_init_done) { +@@ -8313,14 +8463,7 @@ dhd_open(struct net_device *net) + } + + printf("%s: Enter %p\n", __FUNCTION__, net); +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 +- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) { +- DHD_ERROR(("%s : dhd_open: call dev open before insmod complete!\n", __FUNCTION__)); +- } +- mutex_lock(&_dhd_sdio_mutex_lock_); +-#endif +-#endif /* MULTIPLE_SUPPLICANT */ ++ DHD_MUTEX_LOCK(); + /* Init wakelock */ + if (!dhd_download_fw_on_driverload) { + if (!(dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { +@@ -8406,6 +8549,9 @@ dhd_open(struct net_device *net) + atomic_set(&dhd->pend_8021x_cnt, 0); + if (!dhd_download_fw_on_driverload) { + DHD_ERROR(("\n%s\n", dhd_version)); ++#ifdef WL_EXT_IAPSTA ++ wl_ext_iapsta_attach_netdev(net, ifidx); ++#endif + #if defined(USE_INITIAL_SHORT_DWELL_TIME) + g_first_broadcast_scan = TRUE; + #endif +@@ -8421,6 +8567,14 @@ dhd_open(struct net_device *net) + ret = -1; + goto exit; + } ++#if defined(WL_EXT_IAPSTA) && defined(ISAM_PREINIT) ++ conf = dhd_get_conf(net); ++ if (conf) { ++ wl_android_ext_priv_cmd(net, conf->isam_init, 0, &bytes_written); ++ wl_android_ext_priv_cmd(net, conf->isam_config, 0, &bytes_written); ++ wl_android_ext_priv_cmd(net, conf->isam_enable, 0, &bytes_written); ++ } ++#endif + } + #ifdef FIX_CPU_MIN_CLOCK + if (dhd_get_fw_mode(dhd) == DHD_FLAG_HOSTAP_MODE) { +@@ -8440,7 +8594,24 @@ dhd_open(struct net_device *net) + #endif + + if (dhd->pub.busstate != DHD_BUS_DATA) { +- ++#ifdef BCMDBUS ++ dhd_set_path(&dhd->pub); ++ DHD_MUTEX_UNLOCK(); ++ wait_event_interruptible_timeout(dhd->adapter->status_event, ++ wifi_get_adapter_status(dhd->adapter, WIFI_STATUS_FW_READY), ++ msecs_to_jiffies(DHD_FW_READY_TIMEOUT)); ++ DHD_MUTEX_LOCK(); ++ if ((ret = dbus_up(dhd->pub.bus)) != 0) { ++ DHD_ERROR(("%s: failed to dbus_up with code %d\n", __FUNCTION__, ret)); ++ goto exit; ++ } else { ++ dhd->pub.busstate = DHD_BUS_DATA; ++ } ++ if ((ret = dhd_sync_with_dongle(&dhd->pub)) < 0) { ++ DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret)); ++ goto exit; ++ } ++#else + /* try to bring up bus */ + DHD_PERIM_UNLOCK(&dhd->pub); + ret = dhd_bus_start(&dhd->pub); +@@ -8450,8 +8621,12 @@ dhd_open(struct net_device *net) + ret = -1; + goto exit; + } ++#endif /* !BCMDBUS */ + + } ++#ifdef WL_EXT_IAPSTA ++ wl_ext_iapsta_attach_name(net, ifidx); ++#endif + if (dhd_download_fw_on_driverload) { + if (dhd->pub.conf->deepsleep) + dhd_deepsleep(dhd, 0); +@@ -8560,9 +8735,6 @@ dhd_open(struct net_device *net) + } + + argos_register_notifier_init(net); +-#if defined(DHDTCPACK_SUPPRESS) +- dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_DEFAULT); +-#endif /* DHDTCPACK_SUPPRESS */ + #if defined(NUM_SCB_MAX_PROBE) + dhd_set_scb_probe(&dhd->pub); + #endif /* NUM_SCB_MAX_PROBE */ +@@ -8586,12 +8758,7 @@ exit: + + DHD_PERIM_UNLOCK(&dhd->pub); + DHD_OS_WAKE_UNLOCK(&dhd->pub); +- +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 +- mutex_unlock(&_dhd_sdio_mutex_lock_); +-#endif +-#endif /* MULTIPLE_SUPPLICANT */ ++ DHD_MUTEX_UNLOCK(); + + printf("%s: Exit ret=%d\n", __FUNCTION__, ret); + return ret; +@@ -8606,14 +8773,7 @@ int dhd_do_driver_init(struct net_device *net) + return -EINVAL; + } + +-#ifdef MULTIPLE_SUPPLICANT +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1 && defined(BCMSDIO) +- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) { +- DHD_ERROR(("%s : dhdsdio_probe is already running!\n", __FUNCTION__)); +- return 0; +- } +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif /* MULTIPLE_SUPPLICANT */ ++ DHD_MUTEX_IS_LOCK_RETURN(); + + /* && defined(OEM_ANDROID) && defined(BCMSDIO) */ + dhd = DHD_DEV_INFO(net); +@@ -8700,10 +8860,36 @@ dhd_event_ifdel(dhd_info_t *dhdinfo, wl_event_data_if_t *ifevent, char *name, ui + int + dhd_event_ifchange(dhd_info_t *dhdinfo, wl_event_data_if_t *ifevent, char *name, uint8 *mac) + { ++#ifdef DHD_UPDATE_INTF_MAC ++ dhd_if_event_t *if_event; ++#endif /* DHD_UPDATE_INTF_MAC */ ++ + #ifdef WL_CFG80211 + wl_cfg80211_notify_ifchange(dhd_linux_get_primary_netdev(&dhdinfo->pub), + ifevent->ifidx, name, mac, ifevent->bssidx); + #endif /* WL_CFG80211 */ ++ ++#ifdef DHD_UPDATE_INTF_MAC ++ /* handle IF event caused by wl commands, SoftAP, WEXT, MBSS and ++ * anything else ++ */ ++ if_event = MALLOC(dhdinfo->pub.osh, sizeof(dhd_if_event_t)); ++ if (if_event == NULL) { ++ DHD_ERROR(("dhd_event_ifdel: malloc failed for if_event, malloced %d bytes", ++ MALLOCED(dhdinfo->pub.osh))); ++ return BCME_NOMEM; ++ } ++ memcpy(&if_event->event, ifevent, sizeof(if_event->event)); ++ // construct a change event ++ if_event->event.ifidx = dhd_ifname2idx(dhdinfo, name); ++ if_event->event.opcode = WLC_E_IF_CHANGE; ++ memcpy(if_event->mac, mac, ETHER_ADDR_LEN); ++ strncpy(if_event->name, name, IFNAMSIZ); ++ if_event->name[IFNAMSIZ - 1] = '\0'; ++ dhd_deferred_schedule_work(dhdinfo->dhd_deferred_wq, (void *)if_event, DHD_WQ_WORK_IF_UPDATE, ++ dhd_ifupdate_event_handler, DHD_WQ_WORK_PRIORITY_LOW); ++#endif /* DHD_UPDATE_INTF_MAC */ ++ + return BCME_OK; + } + +@@ -8788,12 +8974,26 @@ dhd_allocate_if(dhd_pub_t *dhdpub, int ifidx, const char *name, + } + + #ifdef WL_CFG80211 +- if (ifidx == 0) ++ if (ifidx == 0) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + ifp->net->destructor = free_netdev; +- else ++#else ++ ifp->net->needs_free_netdev = true; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) */ ++ } else { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + ifp->net->destructor = dhd_netdev_free; + #else ++ ifp->net->needs_free_netdev = true; ++ ifp->net->priv_destructor = dhd_netdev_free; ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) */ ++ } ++#else ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + ifp->net->destructor = free_netdev; ++#else ++ ifp->net->needs_free_netdev = true; ++#endif + #endif /* WL_CFG80211 */ + strncpy(ifp->name, ifp->net->name, IFNAMSIZ); + ifp->name[IFNAMSIZ - 1] = '\0'; +@@ -9173,20 +9373,61 @@ fail1: + + #endif /* SHOW_LOGTRACE */ + ++#ifdef BCMDBUS ++uint ++dhd_get_rxsz(dhd_pub_t *pub) ++{ ++ struct net_device *net = NULL; ++ dhd_info_t *dhd = NULL; ++ uint rxsz; ++ ++ /* Assign rxsz for dbus_attach */ ++ dhd = pub->info; ++ net = dhd->iflist[0]->net; ++ net->hard_header_len = ETH_HLEN + pub->hdrlen; ++ rxsz = DBUS_RX_BUFFER_SIZE_DHD(net); ++ ++ return rxsz; ++} ++ ++void ++dhd_set_path(dhd_pub_t *pub) ++{ ++ dhd_info_t *dhd = NULL; ++ ++ dhd = pub->info; ++ ++ /* try to download image and nvram to the dongle */ ++ if (dhd_update_fw_nv_path(dhd) && dhd->pub.bus) { ++ DHD_INFO(("%s: fw %s, nv %s, conf %s\n", ++ __FUNCTION__, dhd->fw_path, dhd->nv_path, dhd->conf_path)); ++ dhd_bus_update_fw_nv_path(dhd->pub.bus, ++ dhd->fw_path, dhd->nv_path, dhd->clm_path, dhd->conf_path); ++ } ++} ++#endif + + dhd_pub_t * +-dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) ++dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen ++#ifdef BCMDBUS ++ , void *data ++#endif ++) + { + dhd_info_t *dhd = NULL; + struct net_device *net = NULL; + char if_name[IFNAMSIZ] = {'\0'}; +- uint32 bus_type = -1; +- uint32 bus_num = -1; +- uint32 slot_num = -1; + #ifdef SHOW_LOGTRACE + int ret; + #endif /* SHOW_LOGTRACE */ ++#if defined(BCMSDIO) || defined(BCMPCIE) ++ uint32 bus_type = -1; ++ uint32 bus_num = -1; ++ uint32 slot_num = -1; + wifi_adapter_info_t *adapter = NULL; ++#elif defined(BCMDBUS) ++ wifi_adapter_info_t *adapter = data; ++#endif + + dhd_attach_states_t dhd_state = DHD_ATTACH_STATE_INIT; + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); +@@ -9198,7 +9439,9 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + #if defined(BCMSDIO) + dhd_bus_get_ids(bus, &bus_type, &bus_num, &slot_num); + #endif ++#if defined(BCMSDIO) || defined(BCMPCIE) + adapter = dhd_wifi_platform_get_adapter(bus_type, bus_num, slot_num); ++#endif + + /* Allocate primary dhd_info */ + dhd = wifi_platform_prealloc(adapter, DHD_PREALLOC_DHD_INFO, sizeof(dhd_info_t)); +@@ -9219,6 +9462,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + dll_init(&(dhd->pub.dump_iovlist_head)); + #endif /* DUMP_IOCTL_IOV_LIST */ + dhd->adapter = adapter; ++ dhd->pub.adapter = (void *)adapter; + #ifdef DHD_DEBUG + dll_init(&(dhd->pub.mw_list_head)); + #endif /* DHD_DEBUG */ +@@ -9239,6 +9483,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + dhd->pub.dhd_cspec.country_abbrev, &dhd->pub.dhd_cspec, + dhd->pub.dhd_cflags); + #endif /* CUSTOM_COUNTRY_CODE */ ++#ifndef BCMDBUS + dhd->thr_dpc_ctl.thr_pid = DHD_PID_KT_TL_INVALID; + dhd->thr_wdt_ctl.thr_pid = DHD_PID_KT_INVALID; + #ifdef DHD_WET +@@ -9246,6 +9491,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + #endif /* DHD_WET */ + /* Initialize thread based operation and lock */ + sema_init(&dhd->sdsem, 1); ++#endif /* !BCMDBUS */ + + /* Link to info module */ + dhd->pub.info = dhd; +@@ -9262,9 +9508,11 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + DHD_ERROR(("dhd_conf_attach failed\n")); + goto fail; + } ++#ifndef BCMDBUS + dhd_conf_reset(&dhd->pub); + dhd_conf_set_chiprev(&dhd->pub, dhd_bus_chip(bus), dhd_bus_chiprev(bus)); + dhd_conf_preinit(&dhd->pub); ++#endif /* !BCMDBUS */ + + /* Some DHD modules (e.g. cfg80211) configures operation mode based on firmware name. + * This is indeed a hack but we have to make it work properly before we have a better +@@ -9458,10 +9706,15 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + + + ++#ifndef BCMDBUS + /* Set up the watchdog timer */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&dhd->timer, dhd_watchdog, 0); ++#else + init_timer(&dhd->timer); + dhd->timer.data = (ulong)dhd; + dhd->timer.function = dhd_watchdog; ++#endif + dhd->default_wd_interval = dhd_watchdog_ms; + + if (dhd_watchdog_prio >= 0) { +@@ -9477,9 +9730,13 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + + #ifdef DHD_PCIE_RUNTIMEPM + /* Setup up the runtime PM Idlecount timer */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&dhd->rpm_timer, dhd_runtimepm, 0); ++#else + init_timer(&dhd->rpm_timer); + dhd->rpm_timer.data = (ulong)dhd; + dhd->rpm_timer.function = dhd_runtimepm; ++#endif + dhd->rpm_timer_valid = FALSE; + + dhd->thr_rpm_ctl.thr_pid = DHD_PID_KT_INVALID; +@@ -9492,9 +9749,6 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + #ifdef DEBUGGER + debugger_init((void *) bus); + #endif +-#ifdef SHOW_LOGTRACE +- skb_queue_head_init(&dhd->evt_trace_queue); +-#endif /* SHOW_LOGTRACE */ + + /* Set up the bottom half handler */ + if (dhd_dpc_prio >= 0) { +@@ -9517,6 +9771,10 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) + goto fail; + } + } ++#endif /* !BCMDBUS */ ++#ifdef SHOW_LOGTRACE ++ skb_queue_head_init(&dhd->evt_trace_queue); ++#endif /* SHOW_LOGTRACE */ + + dhd_state |= DHD_ATTACH_STATE_THREADS_CREATED; + +@@ -10046,6 +10304,7 @@ int dhd_download_btfw(wlan_bt_handle_t handle, char* btfw_path) + } EXPORT_SYMBOL(dhd_download_btfw); + #endif /* defined (BT_OVER_SDIO) */ + ++#ifndef BCMDBUS + int + dhd_bus_start(dhd_pub_t *dhdp) + { +@@ -10227,6 +10486,7 @@ dhd_bus_start(dhd_pub_t *dhdp) + DHD_PERIM_UNLOCK(dhdp); + return 0; + } ++#endif /* !BCMDBUS */ + + #ifdef WLTDLS + int _dhd_tdls_enable(dhd_pub_t *dhd, bool tdls_on, bool auto_on, struct ether_addr *mac) +@@ -10582,9 +10842,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + char eventmask[WL_EVENTING_MASK_LEN]; + char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ + uint32 buf_key_b4_m4 = 1; +-#ifndef WL_CFG80211 +- u32 up = 0; +-#endif + uint8 msglen; + eventmsgs_ext_t *eventmask_msg = NULL; + char* iov_buf = NULL; +@@ -10604,7 +10861,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + #endif + shub_control_t shub_ctl; + +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + #ifdef PROP_TXSTATUS + int wlfc_enable = TRUE; + #ifndef DISABLE_11N +@@ -10612,7 +10869,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + uint wl_down = 1; + #endif /* DISABLE_11N */ + #endif /* PROP_TXSTATUS */ +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #ifndef PCIE_FULL_DONGLE + uint32 wl_ap_isolate; + #endif /* PCIE_FULL_DONGLE */ +@@ -10632,7 +10889,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + #if defined(CUSTOMER_HW2) && defined(USE_WL_CREDALL) + uint32 credall = 1; + #endif +- uint bcn_timeout = dhd->conf->bcn_timeout; ++ uint bcn_timeout = CUSTOM_BCN_TIMEOUT; + uint scancache_enab = TRUE; + #ifdef ENABLE_BCN_LI_BCN_WAKEUP + uint32 bcn_li_bcn = 1; +@@ -10744,7 +11001,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + #endif /* CUSTOM_SET_OCLOFF */ + DHD_TRACE(("Enter %s\n", __FUNCTION__)); + +- dhd_conf_set_intiovar(dhd, WLC_SET_BAND, "WLC_SET_BAND", dhd->conf->band, 0, FALSE); + #ifdef DHDTCPACK_SUPPRESS + printf("%s: Set tcpack_sup_mode %d\n", __FUNCTION__, dhd->conf->tcpack_sup_mode); + dhd_tcpack_suppress_set(dhd, dhd->conf->tcpack_sup_mode); +@@ -11021,17 +11277,11 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + #endif + /* Set Country code */ + if (dhd->dhd_cspec.ccode[0] != 0) { +- printf("Set country %s, revision %d\n", dhd->dhd_cspec.ccode, dhd->dhd_cspec.rev); + ret = dhd_iovar(dhd, 0, "country", (char *)&dhd->dhd_cspec, sizeof(wl_country_t), + NULL, 0, TRUE); + if (ret < 0) +- printf("%s: country code setting failed %d\n", __FUNCTION__, ret); +- } else { +- dhd_conf_set_country(dhd); +- dhd_conf_fix_country(dhd); ++ DHD_ERROR(("%s: country code setting failed\n", __FUNCTION__)); + } +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "autocountry", dhd->conf->autocountry, 0, FALSE); +- dhd_conf_get_country(dhd, &dhd->dhd_cspec); + + + /* Set Listen Interval */ +@@ -11068,7 +11318,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + if (ret < 0) + DHD_ERROR(("%s: roam fullscan period set failed %d\n", __FUNCTION__, ret)); + #endif /* ROAM_ENABLE */ +- dhd_conf_set_roam(dhd); + + #ifdef CUSTOM_EVENT_PM_WAKE + ret = dhd_iovar(dhd, 0, "const_awake_thresh", (char *)&pm_awake_thresh, +@@ -11104,7 +11353,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + } + } + #endif /* DHD_ENABLE_LPC */ +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "lpc", dhd->conf->lpc, 0, TRUE); + + #ifdef WLADPS + #ifdef WLADPS_SEAK_AP_WAR +@@ -11123,10 +11371,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + #endif /* WLADPS */ + + /* Set PowerSave mode */ +- if (dhd->conf->pm >= 0) +- power_mode = dhd->conf->pm; + (void) dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode, sizeof(power_mode), TRUE, 0); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "pm2_sleep_ret", dhd->conf->pm2_sleep_ret, 0, FALSE); + + #if defined(BCMSDIO) + /* Match Host and Dongle rx alignment */ +@@ -11159,27 +11404,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + dhd_iovar(dhd, 0, "apsta", (char *)&apsta, sizeof(apsta), NULL, 0, TRUE); + + #endif /* defined(AP) && !defined(WLP2P) */ +- /* 0:HT20 in ALL, 1:HT40 in ALL, 2: HT20 in 2G HT40 in 5G */ +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "mimo_bw_cap", dhd->conf->mimo_bw_cap, 0, TRUE); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "force_wme_ac", dhd->conf->force_wme_ac, 1, FALSE); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "stbc_tx", dhd->conf->stbc, 0, FALSE); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "stbc_rx", dhd->conf->stbc, 0, FALSE); +- dhd_conf_set_intiovar(dhd, WLC_SET_SRL, "WLC_SET_SRL", dhd->conf->srl, 0, TRUE); +- dhd_conf_set_intiovar(dhd, WLC_SET_LRL, "WLC_SET_LRL", dhd->conf->lrl, 0, FALSE); +- dhd_conf_set_intiovar(dhd, WLC_SET_SPECT_MANAGMENT, "WLC_SET_SPECT_MANAGMENT", dhd->conf->spect, 0, FALSE); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "rsdb_mode", dhd->conf->rsdb_mode, -1, TRUE); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "vhtmode", dhd->conf->vhtmode, 0, TRUE); +-#ifdef IDHCP +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpc_enable", dhd->conf->dhcpc_enable, 0, FALSE); +- if(dhd->conf->dhcpd_enable >= 0){ +- dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_addr", (char *)&dhd->conf->dhcpd_ip_addr, sizeof(dhd->conf->dhcpd_ip_addr), FALSE); +- dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_mask", (char *)&dhd->conf->dhcpd_ip_mask, sizeof(dhd->conf->dhcpd_ip_mask), FALSE); +- dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_start", (char *)&dhd->conf->dhcpd_ip_start, sizeof(dhd->conf->dhcpd_ip_start), FALSE); +- dhd_conf_set_bufiovar(dhd, WLC_SET_VAR, "dhcpd_ip_end", (char *)&dhd->conf->dhcpd_ip_end, sizeof(dhd->conf->dhcpd_ip_end), FALSE); +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpd_enable", dhd->conf->dhcpd_enable, 0, FALSE); +- } +-#endif +- dhd_conf_set_bw_cap(dhd); + + #ifdef MIMO_ANT_SETTING + dhd_sel_ant_from_file(dhd); +@@ -11214,7 +11438,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + DHD_ERROR(("%s Set txbf failed %d\n", __FUNCTION__, ret)); + + #endif /* USE_WL_TXBF */ +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "txbf", dhd->conf->txbf, 0, FALSE); + + ret = dhd_iovar(dhd, 0, "scancache", (char *)&scancache_enab, sizeof(scancache_enab), NULL, + 0, TRUE); +@@ -11251,7 +11474,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + sizeof(frameburst), TRUE, 0)) < 0) { + DHD_INFO(("%s frameburst not supported %d\n", __FUNCTION__, ret)); + } +- dhd_conf_set_intiovar(dhd, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG", dhd->conf->frameburst, 0, FALSE); + + iov_buf = (char*)kmalloc(WLC_IOCTL_SMLEN, GFP_KERNEL); + if (iov_buf == NULL) { +@@ -11275,7 +11497,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + } + } + #endif +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "ampdu_ba_wsize", dhd->conf->ampdu_ba_wsize, 1, FALSE); + + #ifdef ENABLE_TEMP_THROTTLING + if (dhd->op_mode & DHD_FLAG_STA_MODE) { +@@ -11694,9 +11915,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + bcmstrtok(&ptr, "\n", 0); + strncpy(fw_version, buf, FW_VER_STR_LEN); + fw_version[FW_VER_STR_LEN-1] = '\0'; +-#if defined(BCMSDIO) || defined(BCMPCIE) + dhd_set_version_info(dhd, buf); +-#endif /* BCMSDIO || BCMPCIE */ + #ifdef WRITE_WLANINFO + sec_save_wlinfo(buf, EPI_VERSION_STR, dhd->info->nv_path, clm_version); + #endif /* WRITE_WLANINFO */ +@@ -11707,11 +11926,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + + #if defined(BCMSDIO) + dhd_txglom_enable(dhd, dhd->conf->bus_rxglom); +- // terence 20151210: set bus:txglom after dhd_txglom_enable since it's possible changed in dhd_conf_set_txglom_params +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:txglom", dhd->conf->bus_txglom, 0, FALSE); + #endif /* defined(BCMSDIO) */ + +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + #ifdef PROP_TXSTATUS + if (disable_proptx || + #ifdef PROP_TXSTATUS_VSDB +@@ -11784,8 +12001,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + printf("%s: not define PROP_TXSTATUS\n", __FUNCTION__); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "ampdu_hostreorder", 0, 0, TRUE); + #endif /* PROP_TXSTATUS */ +- dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "ampdu_hostreorder", dhd->conf->ampdu_hostreorder, 0, TRUE); +-#endif /* BCMSDIO || BCMBUS */ ++#endif /* BCMSDIO || BCMDBUS */ + #ifndef PCIE_FULL_DONGLE + /* For FD we need all the packets at DHD to handle intra-BSS forwarding */ + if (FW_SUPPORTED(dhd, ap)) { +@@ -11812,9 +12028,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + #ifdef WL11U + dhd_interworking_enable(dhd); + #endif /* WL11U */ +-#ifndef WL_CFG80211 +- dhd_wl_ioctl_cmd(dhd, WLC_UP, (char *)&up, sizeof(up), TRUE, 0); +-#endif + + #ifdef SUPPORT_SENSORHUB + DHD_ERROR(("%s: SensorHub enabled %d\n", +@@ -11897,6 +12110,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) + DHD_ERROR(("failed to set WNM capabilities\n")); + } + ++ dhd_conf_postinit_ioctls(dhd); + done: + + if (eventmask_msg) +@@ -12448,13 +12662,27 @@ dhd_register_if(dhd_pub_t *dhdp, int ifidx, bool need_rtnl_lock) + + dhd->pub.rxsz = DBUS_RX_BUFFER_SIZE_DHD(net); + ++#ifdef WLMESH ++ if (ifidx >= 2 && dhdp->conf->fw_type == FW_TYPE_MESH) { ++ temp_addr[4] ^= 0x80; ++ temp_addr[4] += ifidx; ++ temp_addr[5] += ifidx; ++ } ++#endif + memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN); + + if (ifidx == 0) + printf("%s\n", dhd_version); + #ifdef WL_EXT_IAPSTA +- else if (!strncmp(net->name, "wl0.", strlen("wl0."))) { +- wl_android_ext_attach_netdev(net, ifidx); ++ else ++ wl_ext_iapsta_attach_netdev(net, ifidx); ++#endif ++#ifdef WLMESH ++ if (ifidx != 0 && dhdp->conf->fw_type == FW_TYPE_MESH) { ++ if (_dhd_set_mac_address(dhd, ifidx, temp_addr) == 0) ++ DHD_INFO(("%s: MACID is overwritten\n", __FUNCTION__)); ++ else ++ DHD_ERROR(("%s: _dhd_set_mac_address() failed\n", __FUNCTION__)); + } + #endif + +@@ -12467,6 +12695,11 @@ dhd_register_if(dhd_pub_t *dhdp, int ifidx, bool need_rtnl_lock) + DHD_ERROR(("couldn't register the net device [%s], err %d\n", net->name, err)); + goto fail; + } ++#ifdef WL_EXT_IAPSTA ++ if (ifidx == 0) ++ wl_ext_iapsta_attach_netdev(net, ifidx); ++ wl_ext_iapsta_attach_name(net, ifidx); ++#endif + + + +@@ -12482,7 +12715,7 @@ dhd_register_if(dhd_pub_t *dhdp, int ifidx, bool need_rtnl_lock) + #endif + + #if (defined(BCMPCIE) || (defined(BCMLXSDMMC) && (LINUX_VERSION_CODE >= \ +- KERNEL_VERSION(2, 6, 27)))) ++ KERNEL_VERSION(2, 6, 27))) || defined(BCMDBUS)) + if (ifidx == 0) { + #if defined(BCMLXSDMMC) && !defined(DHD_PRELOAD) + up(&dhd_registration_sem); +@@ -12549,7 +12782,16 @@ dhd_bus_detach(dhd_pub_t *dhdp) + dhd_prot_stop(&dhd->pub); + + /* Stop the bus module */ ++#ifdef BCMDBUS ++ /* Force Dongle terminated */ ++ if (dhd_wl_ioctl_cmd(dhdp, WLC_TERMINATED, NULL, 0, TRUE, 0) < 0) ++ DHD_ERROR(("%s Setting WLC_TERMINATED failed\n", ++ __FUNCTION__)); ++ dbus_stop(dhd->pub.bus); ++ dhd->pub.busstate = DHD_BUS_DOWN; ++#else + dhd_bus_stop(dhd->pub.bus, TRUE); ++#endif /* BCMDBUS */ + } + + #if defined(OOB_INTR_ONLY) || defined(BCMPCIE_OOB_HOST_WAKE) +@@ -12702,9 +12944,6 @@ void dhd_detach(dhd_pub_t *dhdp) + ASSERT(ifp); + ASSERT(ifp->net); + if (ifp && ifp->net) { +- +- +- + #ifdef WL_CFG80211 + cfg = wl_get_cfg(ifp->net); + #endif +@@ -12754,6 +12993,9 @@ void dhd_detach(dhd_pub_t *dhdp) + del_timer_sync(&dhd->timer); + DHD_DISABLE_RUNTIME_PM(&dhd->pub); + ++#ifdef BCMDBUS ++ tasklet_kill(&dhd->tasklet); ++#else + if (dhd->dhd_state & DHD_ATTACH_STATE_THREADS_CREATED) { + #ifdef DHD_PCIE_RUNTIMEPM + if (dhd->thr_rpm_ctl.thr_pid >= 0) { +@@ -12775,6 +13017,7 @@ void dhd_detach(dhd_pub_t *dhdp) + tasklet_kill(&dhd->tasklet); + } + } ++#endif /* BCMDBUS */ + + #ifdef DHD_LB + if (dhd->dhd_state & DHD_ATTACH_STATE_LB_ATTACH_DONE) { +@@ -12893,14 +13136,14 @@ void dhd_detach(dhd_pub_t *dhdp) + dhd->new_freq = NULL; + cpufreq_unregister_notifier(&dhd->freq_trans, CPUFREQ_TRANSITION_NOTIFIER); + #endif ++ DHD_TRACE(("wd wakelock count:%d\n", dhd->wakelock_wd_counter)); + #ifdef CONFIG_HAS_WAKELOCK + dhd->wakelock_wd_counter = 0; + wake_lock_destroy(&dhd->wl_wdwake); +- // terence 20161023: can not destroy wl_wifi when wlan down, it will happen null pointer in dhd_ioctl_entry +- wake_lock_destroy(&dhd->wl_wifi); ++ // terence 20161023: can not destroy wl_wifi when wlan down, it will happen null pointer in dhd_ioctl_entry ++ wake_lock_destroy(&dhd->wl_wifi); + #endif /* CONFIG_HAS_WAKELOCK */ + if (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) { +- DHD_TRACE(("wd wakelock count:%d\n", dhd->wakelock_wd_counter)); + DHD_OS_WAKE_LOCK_DESTROY(dhd); + } + +@@ -13264,10 +13507,15 @@ dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec) + } + + int +-dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition) ++dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool resched) + { + dhd_info_t * dhd = (dhd_info_t *)(pub->info); +- int timeout; ++ int timeout, timeout_tmp = dhd_ioctl_timeout_msec; ++ ++ if (!resched && pub->conf->ctrl_resched>0 && pub->conf->dhd_ioctl_timeout_msec>0) { ++ timeout_tmp = dhd_ioctl_timeout_msec; ++ dhd_ioctl_timeout_msec = pub->conf->dhd_ioctl_timeout_msec; ++ } + + /* Convert timeout in millsecond to jiffies */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) +@@ -13280,6 +13528,10 @@ dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition) + + timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout); + ++ if (!resched && pub->conf->ctrl_resched>0 && pub->conf->dhd_ioctl_timeout_msec>0) { ++ dhd_ioctl_timeout_msec = timeout_tmp; ++ } ++ + DHD_PERIM_LOCK(pub); + + return timeout; +@@ -13422,6 +13674,7 @@ dhd_os_busbusy_wake(dhd_pub_t *pub) + void + dhd_os_wd_timer_extend(void *bus, bool extend) + { ++#ifndef BCMDBUS + dhd_pub_t *pub = bus; + dhd_info_t *dhd = (dhd_info_t *)pub->info; + +@@ -13429,12 +13682,14 @@ dhd_os_wd_timer_extend(void *bus, bool extend) + dhd_os_wd_timer(bus, WATCHDOG_EXTEND_INTERVAL); + else + dhd_os_wd_timer(bus, dhd->default_wd_interval); ++#endif /* !BCMDBUS */ + } + + + void + dhd_os_wd_timer(void *bus, uint wdtick) + { ++#ifndef BCMDBUS + dhd_pub_t *pub = bus; + dhd_info_t *dhd = (dhd_info_t *)pub->info; + unsigned long flags; +@@ -13469,6 +13724,7 @@ dhd_os_wd_timer(void *bus, uint wdtick) + dhd->wd_timer_valid = TRUE; + } + DHD_GENERAL_UNLOCK(pub, flags); ++#endif /* !BCMDBUS */ + } + + #ifdef DHD_PCIE_RUNTIMEPM +@@ -13570,15 +13826,21 @@ dhd_os_get_image_block(char *buf, int len, void *image) + } + + size = i_size_read(file_inode(fp)); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ rdlen = kernel_read(fp, buf, MIN(len, size), &fp->f_pos); ++#else + rdlen = kernel_read(fp, fp->f_pos, buf, MIN(len, size)); ++#endif + + if (len >= size && size != rdlen) { + return -EIO; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) + if (rdlen > 0) { + fp->f_pos += rdlen; + } ++#endif + + return rdlen; + } +@@ -13609,7 +13871,11 @@ dhd_os_gets_image(dhd_pub_t *pub, char *str, int len, void *image) + if (!image) + return 0; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ rd_len = kernel_read(fp, str, len, &fp->f_pos); ++#else + rd_len = kernel_read(fp, fp->f_pos, str, len); ++#endif + str_end = strnchr(str, len, '\n'); + if (str_end == NULL) { + goto err; +@@ -13640,10 +13906,14 @@ dhd_os_sdlock(dhd_pub_t *pub) + + dhd = (dhd_info_t *)(pub->info); + ++#ifdef BCMDBUS ++ spin_lock_bh(&dhd->sdlock); ++#else + if (dhd_dpc_prio >= 0) + down(&dhd->sdsem); + else + spin_lock_bh(&dhd->sdlock); ++#endif /* !BCMDBUS */ + } + + void +@@ -13653,10 +13923,14 @@ dhd_os_sdunlock(dhd_pub_t *pub) + + dhd = (dhd_info_t *)(pub->info); + ++#ifdef BCMDBUS ++ spin_unlock_bh(&dhd->sdlock); ++#else + if (dhd_dpc_prio >= 0) + up(&dhd->sdsem); + else + spin_unlock_bh(&dhd->sdlock); ++#endif /* !BCMDBUS */ + } + + void +@@ -13665,7 +13939,11 @@ dhd_os_sdlock_txq(dhd_pub_t *pub) + dhd_info_t *dhd; + + dhd = (dhd_info_t *)(pub->info); ++#ifdef BCMDBUS ++ spin_lock_irqsave(&dhd->txqlock, dhd->txqlock_flags); ++#else + spin_lock_bh(&dhd->txqlock); ++#endif /* BCMDBUS */ + } + + void +@@ -13674,17 +13952,33 @@ dhd_os_sdunlock_txq(dhd_pub_t *pub) + dhd_info_t *dhd; + + dhd = (dhd_info_t *)(pub->info); ++#ifdef BCMDBUS ++ spin_unlock_irqrestore(&dhd->txqlock, dhd->txqlock_flags); ++#else + spin_unlock_bh(&dhd->txqlock); ++#endif /* BCMDBUS */ + } + + void + dhd_os_sdlock_rxq(dhd_pub_t *pub) + { ++#if 0 ++ dhd_info_t *dhd; ++ ++ dhd = (dhd_info_t *)(pub->info); ++ spin_lock_bh(&dhd->rxqlock); ++#endif + } + + void + dhd_os_sdunlock_rxq(dhd_pub_t *pub) + { ++#if 0 ++ dhd_info_t *dhd; ++ ++ dhd = (dhd_info_t *)(pub->info); ++ spin_unlock_bh(&dhd->rxqlock); ++#endif + } + + static void +@@ -13804,6 +14098,9 @@ dhd_wl_host_event(dhd_info_t *dhd, int ifidx, void *pktdata, uint16 pktlen, + if (bcmerror != BCME_OK) + return (bcmerror); + ++#if defined(WL_EXT_IAPSTA) ++ wl_ext_iapsta_event(dhd->iflist[ifidx]->net, event, *data); ++#endif /* defined(WL_EXT_IAPSTA) */ + #if defined(WL_WIRELESS_EXT) + if (event->bsscfgidx == 0) { + /* +@@ -13929,7 +14226,7 @@ void dhd_wait_event_wakeup(dhd_pub_t *dhd) + return; + } + +-#if defined(BCMSDIO) || defined(BCMPCIE) ++#if defined(BCMSDIO) || defined(BCMPCIE) || defined(BCMDBUS) + int + dhd_net_bus_devreset(struct net_device *dev, uint8 flag) + { +@@ -13997,7 +14294,7 @@ dhd_net_bus_resume(struct net_device *dev, uint8 stage) + } + + #endif /* BCMSDIO */ +-#endif /* BCMSDIO || BCMPCIE */ ++#endif /* BCMSDIO || BCMPCIE || BCMDBUS */ + + int net_os_set_suspend_disable(struct net_device *dev, int val) + { +@@ -14167,6 +14464,9 @@ dhd_dev_get_feature_set(struct net_device *dev) + if (dhd_is_pno_supported(dhd)) { + feature_set |= WIFI_FEATURE_PNO; + #ifdef GSCAN_SUPPORT ++ /* terence 20171115: remove to get GTS PASS ++ * com.google.android.gts.wifi.WifiHostTest#testWifiScannerBatchTimestamp ++ */ + // feature_set |= WIFI_FEATURE_GSCAN; + // feature_set |= WIFI_FEATURE_HAL_EPNO; + #endif /* GSCAN_SUPPORT */ +@@ -15718,6 +16018,7 @@ void dhd_get_customized_country_code(struct net_device *dev, char *country_iso_c + + BCM_REFERENCE(dhd); + } ++ + void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec, bool notify) + { + dhd_info_t *dhd = DHD_DEV_INFO(dev); +@@ -15923,7 +16224,11 @@ int write_file(const char * file_name, uint32 flags, uint8 *buf, int size) + } + + /* Write buf to file */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_write(fp, buf, size, &pos); ++#else + ret = vfs_write(fp, buf, size, &pos); ++#endif + if (ret < 0) { + DHD_ERROR(("write file error, err = %d\n", ret)); + goto exit; +@@ -16848,7 +17153,6 @@ bool dhd_os_check_if_up(dhd_pub_t *pub) + return pub->up; + } + +-#if defined(BCMSDIO) || defined(BCMPCIE) + /* function to collect firmware, chip id and chip version info */ + void dhd_set_version_info(dhd_pub_t *dhdp, char *fw) + { +@@ -16862,10 +17166,9 @@ void dhd_set_version_info(dhd_pub_t *dhdp, char *fw) + return; + + i = snprintf(&info_string[i], sizeof(info_string) - i, +- "\n Chip: %x Rev %x Pkg %x", dhd_bus_chip_id(dhdp), +- dhd_bus_chiprev_id(dhdp), dhd_bus_chippkg_id(dhdp)); ++ "\n Chip: %x Rev %x", dhd_conf_get_chip(dhdp), ++ dhd_conf_get_chiprev(dhdp)); + } +-#endif /* BCMSDIO || BCMPCIE */ + + int dhd_ioctl_entry_local(struct net_device *net, wl_ioctl_t *ioc, int cmd) + { +@@ -17571,7 +17874,11 @@ void dhd_get_memdump_info(dhd_pub_t *dhd) + } + + /* Handle success case */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_read(fp, (char *)&mem_val, 4, NULL); ++#else + ret = kernel_read(fp, 0, (char *)&mem_val, 4); ++#endif + if (ret < 0) { + DHD_ERROR(("%s: File read error, ret=%d\n", __FUNCTION__, ret)); + filp_close(fp, NULL); +@@ -17810,7 +18117,11 @@ do_dhd_log_dump(dhd_pub_t *dhdp) + goto exit; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_write(fp, pre_strs, strlen(pre_strs), &pos); ++#else + ret = vfs_write(fp, pre_strs, strlen(pre_strs), &pos); ++#endif + if (ret < 0) { + DHD_ERROR(("write file error, err = %d\n", ret)); + goto exit; +@@ -17828,7 +18139,11 @@ do_dhd_log_dump(dhd_pub_t *dhdp) + wr_size = (unsigned int)(dld_buf->present - dld_buf->front); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_write(fp, dld_buf->buffer, wr_size, &pos); ++#else + ret = vfs_write(fp, dld_buf->buffer, wr_size, &pos); ++#endif + if (ret < 0) { + DHD_ERROR(("write file error, err = %d\n", ret)); + goto exit; +@@ -17849,7 +18164,11 @@ do_dhd_log_dump(dhd_pub_t *dhdp) + break; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_write(fp, post_strs, strlen(post_strs), &pos); ++#else + ret = vfs_write(fp, post_strs, strlen(post_strs), &pos); ++#endif + if (ret < 0) { + DHD_ERROR(("write file error, err = %d\n", ret)); + goto exit; +@@ -17898,7 +18217,11 @@ void dhd_get_assert_info(dhd_pub_t *dhd) + if (IS_ERR(fp)) { + DHD_ERROR(("%s: File [%s] doesn't exist\n", __FUNCTION__, filepath)); + } else { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ssize_t ret = kernel_read(fp, (char *)&mem_val, 4, NULL); ++#else + int ret = kernel_read(fp, 0, (char *)&mem_val, 4); ++#endif + if (ret < 0) { + DHD_ERROR(("%s: File read error, ret=%d\n", __FUNCTION__, ret)); + } else { +@@ -18809,7 +19132,11 @@ dhd_write_file(const char *filepath, char *buf, int buf_len) + ret = BCME_ERROR; + } else { + if (fp->f_mode & FMODE_WRITE) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_write(fp, buf, buf_len, &fp->f_pos); ++#else + ret = vfs_write(fp, buf, buf_len, &fp->f_pos); ++#endif + if (ret < 0) { + DHD_ERROR(("%s: Couldn't write file '%s'\n", + __FUNCTION__, filepath)); +@@ -18845,7 +19172,11 @@ dhd_read_file(const char *filepath, char *buf, int buf_len) + return BCME_ERROR; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = kernel_read(fp, buf, buf_len, NULL); ++#else + ret = kernel_read(fp, 0, buf, buf_len); ++#endif + filp_close(fp, NULL); + + /* restore previous address limit */ +@@ -19444,7 +19775,11 @@ dhd_make_hang_with_reason(struct net_device *dev, const char *string_num) + wake_counts_t* + dhd_get_wakecount(dhd_pub_t *dhdp) + { ++#ifdef BCMDBUS ++ return NULL; ++#else + return dhd_bus_get_wakecount(dhdp); ++#endif /* BCMDBUS */ + } + #endif /* DHD_WAKE_STATUS */ + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.h +index 4651dc51f69a..248f5271da0b 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux.h +@@ -51,7 +51,21 @@ + #include + #endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */ + ++/* dongle status */ ++enum wifi_adapter_status { ++ WIFI_STATUS_POWER_ON = 0, ++ WIFI_STATUS_ATTACH, ++ WIFI_STATUS_FW_READY, ++ WIFI_STATUS_DETTACH ++}; ++#define wifi_chk_adapter_status(adapter, stat) (test_bit(stat, &(adapter)->status)) ++#define wifi_get_adapter_status(adapter, stat) (test_bit(stat, &(adapter)->status)) ++#define wifi_set_adapter_status(adapter, stat) (set_bit(stat, &(adapter)->status)) ++#define wifi_clr_adapter_status(adapter, stat) (clear_bit(stat, &(adapter)->status)) ++#define wifi_chg_adapter_status(adapter, stat) (change_bit(stat, &(adapter)->status)) ++ + #define DHD_REGISTRATION_TIMEOUT 12000 /* msec : allowed time to finished dhd registration */ ++#define DHD_FW_READY_TIMEOUT 5000 /* msec : allowed time to finished fw download */ + + typedef struct wifi_adapter_info { + const char *name; +@@ -65,6 +79,8 @@ typedef struct wifi_adapter_info { + uint bus_type; + uint bus_num; + uint slot_num; ++ wait_queue_head_t status_event; ++ unsigned long status; + #if defined(BT_OVER_SDIO) + const char *btfw_path; + #endif /* defined (BT_OVER_SDIO) */ +@@ -120,6 +136,8 @@ typedef dhd_sta_t dhd_sta_pool_t; + + int dhd_wifi_platform_register_drv(void); + void dhd_wifi_platform_unregister_drv(void); ++wifi_adapter_info_t* dhd_wifi_platform_attach_adapter(uint32 bus_type, ++ uint32 bus_num, uint32 slot_num, unsigned long status); + wifi_adapter_info_t* dhd_wifi_platform_get_adapter(uint32 bus_type, uint32 bus_num, + uint32 slot_num); + int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_platdev.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_platdev.c +old mode 100755 +new mode 100644 +index 7be2fa30d1eb..98592283e728 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_platdev.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_platdev.c +@@ -58,6 +58,7 @@ extern void dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter); + + #ifdef CONFIG_DTS + struct regulator *wifi_regulator = NULL; ++extern struct wifi_platform_data dhd_wlan_control; + #endif /* CONFIG_DTS */ + + bool cfg_multichip = FALSE; +@@ -93,6 +94,30 @@ extern void bcm_bt_unlock(int cookie); + static int lock_cookie_wifi = 'W' | 'i'<<8 | 'F'<<16 | 'i'<<24; /* cookie is "WiFi" */ + #endif /* ENABLE_4335BT_WAR */ + ++wifi_adapter_info_t* dhd_wifi_platform_attach_adapter(uint32 bus_type, ++ uint32 bus_num, uint32 slot_num, unsigned long status) ++{ ++ int i; ++ ++ if (dhd_wifi_platdata == NULL) ++ return NULL; ++ ++ for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) { ++ wifi_adapter_info_t *adapter = &dhd_wifi_platdata->adapters[i]; ++ if ((adapter->bus_type == -1 || adapter->bus_type == bus_type) && ++ (adapter->bus_num == -1 || adapter->bus_num == bus_num) && ++ (adapter->slot_num == -1 || adapter->slot_num == slot_num) ++#if defined(ENABLE_INSMOD_NO_FW_LOAD) ++ && (wifi_chk_adapter_status(adapter, status)) ++#endif ++ ) { ++ DHD_ERROR(("attach adapter info '%s'\n", adapter->name)); ++ return adapter; ++ } ++ } ++ return NULL; ++} ++ + wifi_adapter_info_t* dhd_wifi_platform_get_adapter(uint32 bus_type, uint32 bus_num, uint32 slot_num) + { + int i; +@@ -165,20 +190,31 @@ int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long + return -EINVAL; + } + #endif /* BT_OVER_SDIO */ ++ if (on) { ++ wifi_set_adapter_status(adapter, WIFI_STATUS_POWER_ON); ++ } else { ++ wifi_clr_adapter_status(adapter, WIFI_STATUS_POWER_ON); ++ } + #ifdef CONFIG_DTS + if (on) { ++ printf("======== PULL WL_REG_ON HIGH! ========\n"); + err = regulator_enable(wifi_regulator); + is_power_on = TRUE; + } + else { ++ printf("======== PULL WL_REG_ON LOW! ========\n"); + err = regulator_disable(wifi_regulator); + is_power_on = FALSE; + } +- if (err < 0) ++ if (err < 0) { + DHD_ERROR(("%s: regulator enable/disable failed", __FUNCTION__)); ++ goto fail; ++ } + #else +- if (!adapter || !adapter->wifi_plat_data) +- return -EINVAL; ++ if (!adapter || !adapter->wifi_plat_data) { ++ err = -EINVAL; ++ goto fail; ++ } + plat_data = adapter->wifi_plat_data; + + DHD_ERROR(("%s = %d\n", __FUNCTION__, on)); +@@ -213,6 +249,13 @@ int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long + + #endif /* CONFIG_DTS */ + ++ return err; ++fail: ++ if (on) { ++ wifi_clr_adapter_status(adapter, WIFI_STATUS_POWER_ON); ++ } else { ++ wifi_set_adapter_status(adapter, WIFI_STATUS_POWER_ON); ++ } + return err; + } + +@@ -280,7 +323,7 @@ static int wifi_plat_dev_drv_probe(struct platform_device *pdev) + { + struct resource *resource; + wifi_adapter_info_t *adapter; +-#ifdef CONFIG_DTS ++#if defined(CONFIG_DTS) && defined(CUSTOMER_OOB) + int irq, gpio; + #endif /* CONFIG_DTS */ + +@@ -290,7 +333,8 @@ static int wifi_plat_dev_drv_probe(struct platform_device *pdev) + ASSERT(dhd_wifi_platdata != NULL); + ASSERT(dhd_wifi_platdata->num_adapters == 1); + adapter = &dhd_wifi_platdata->adapters[0]; +- adapter->wifi_plat_data = (struct wifi_platform_data *)(pdev->dev.platform_data); ++ adapter->wifi_plat_data = (void *)&dhd_wlan_control; ++// adapter->wifi_plat_data = (struct wifi_platform_data *)(pdev->dev.platform_data); + + resource = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq"); + if (resource == NULL) +@@ -310,6 +354,7 @@ static int wifi_plat_dev_drv_probe(struct platform_device *pdev) + return -1; + } + ++#if defined(CUSTOMER_OOB) + /* This is to get the irq for the OOB */ + gpio = of_get_gpio(pdev->dev.of_node, 0); + +@@ -327,6 +372,7 @@ static int wifi_plat_dev_drv_probe(struct platform_device *pdev) + /* need to change the flags according to our requirement */ + adapter->intr_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | + IORESOURCE_IRQ_SHAREABLE; ++#endif + #endif /* CONFIG_DTS */ + + wifi_plat_dev_probe_ret = dhd_wifi_platform_load(); +@@ -469,6 +515,7 @@ static int wifi_ctrlfunc_register_drv(void) + dhd_wifi_platdata = kzalloc(sizeof(bcmdhd_wifi_platdata_t), GFP_KERNEL); + dhd_wifi_platdata->num_adapters = 1; + dhd_wifi_platdata->adapters = adapter; ++ init_waitqueue_head(&adapter->status_event); + + #ifndef CUSTOMER_HW + if (dev1) { +@@ -519,7 +566,9 @@ static int wifi_ctrlfunc_register_drv(void) + + void wifi_ctrlfunc_unregister_drv(void) + { ++#ifndef CONFIG_DTS + wifi_adapter_info_t *adapter; ++#endif + + #if defined(CONFIG_DTS) && !defined(CUSTOMER_HW) + DHD_ERROR(("unregister wifi platform drivers\n")); +@@ -730,7 +779,7 @@ void dhd_wifi_platform_unregister_drv(void) + extern int dhd_watchdog_prio; + extern int dhd_dpc_prio; + extern uint dhd_deferred_tx; +-#if defined(BCMLXSDMMC) ++#if defined(BCMLXSDMMC) || defined(BCMDBUS) + extern struct semaphore dhd_registration_sem; + #endif + +@@ -854,10 +903,67 @@ static int dhd_wifi_platform_load_sdio(void) + } + #endif /* BCMSDIO */ + ++#ifdef BCMDBUS ++static int dhd_wifi_platform_load_usb(void) ++{ ++ wifi_adapter_info_t *adapter; ++ s32 timeout = -1; ++ int i; ++ int err = 0; ++ enum wifi_adapter_status wait_status; ++ ++ err = dhd_bus_register(); ++ if (err) { ++ DHD_ERROR(("%s: usb_register failed\n", __FUNCTION__)); ++ goto exit; ++ } ++ ++ /* power up all adapters */ ++ for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) { ++ adapter = &dhd_wifi_platdata->adapters[i]; ++ DHD_ERROR(("Power-up adapter '%s'\n", adapter->name)); ++ DHD_INFO((" - irq %d [flags %d], firmware: %s, nvram: %s\n", ++ adapter->irq_num, adapter->intr_flags, adapter->fw_path, adapter->nv_path)); ++ DHD_INFO((" - bus type %d, bus num %d, slot num %d\n\n", ++ adapter->bus_type, adapter->bus_num, adapter->slot_num)); ++ err = wifi_platform_set_power(adapter, TRUE, WIFI_TURNON_DELAY); ++ if (err) { ++ DHD_ERROR(("failed to wifi_platform_set_power on %s\n", adapter->name)); ++ goto fail; ++ } ++ if (dhd_download_fw_on_driverload) ++ wait_status = WIFI_STATUS_ATTACH; ++ else ++ wait_status = WIFI_STATUS_DETTACH; ++ timeout = wait_event_interruptible_timeout(adapter->status_event, ++ wifi_get_adapter_status(adapter, wait_status), ++ msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)); ++ if (timeout <= 0) { ++ err = -1; ++ DHD_ERROR(("%s: usb_register_driver timeout\n", __FUNCTION__)); ++ goto fail; ++ } ++ } ++ ++exit: ++ return err; ++ ++fail: ++ dhd_bus_unregister(); ++ /* power down all adapters */ ++ for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) { ++ adapter = &dhd_wifi_platdata->adapters[i]; ++ wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY); ++ } ++ ++ return err; ++} ++#else /* BCMDBUS */ + static int dhd_wifi_platform_load_usb(void) + { + return 0; + } ++#endif /* BCMDBUS */ + + static int dhd_wifi_platform_load() + { +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_wq.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_wq.h +old mode 100755 +new mode 100644 +index 6dc41a5dc3a3..9c51d0665b27 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_wq.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_wq.h +@@ -47,6 +47,9 @@ enum _wq_event { + DHD_WQ_WORK_DEBUG_UART_DUMP, + DHD_WQ_WORK_SSSR_DUMP, + DHD_WQ_WORK_PKTLOG_DUMP, ++#ifdef DHD_UPDATE_INTF_MAC ++ DHD_WQ_WORK_IF_UPDATE, ++#endif /* DHD_UPDATE_INTF_MAC */ + DHD_MAX_WQ_EVENTS + }; + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_msgbuf.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_msgbuf.c +old mode 100755 +new mode 100644 +index e602d24f2e6a..455f125a9687 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_msgbuf.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_msgbuf.c +@@ -52,6 +52,7 @@ + #include + #include + #include ++#include + #ifdef DHD_TIMESYNC + #include + #endif /* DHD_TIMESYNC */ +@@ -6013,6 +6014,7 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) + int timeleft; + unsigned long flags; + int ret = 0; ++ static uint cnt = 0; + + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + +@@ -6021,7 +6023,7 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) + goto out; + } + +- timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received); ++ timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received, false); + + #ifdef DHD_RECOVER_TIMEOUT + if (prot->ioctl_received == 0) { +@@ -6053,6 +6055,25 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf) + } + #endif /* DHD_RECOVER_TIMEOUT */ + ++ if (dhd->conf->ctrl_resched > 0 && timeleft == 0 && (!dhd_query_bus_erros(dhd))) { ++ cnt++; ++ if (cnt <= dhd->conf->ctrl_resched) { ++ uint32 intstatus = 0, intmask = 0; ++ intstatus = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx, PCIMailBoxInt, 0, 0); ++ intmask = si_corereg(dhd->bus->sih, dhd->bus->sih->buscoreidx, PCIMailBoxMask, 0, 0); ++ if (intstatus) { ++ DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, intstatus=0x%x, intmask=0x%x\n", ++ __FUNCTION__, cnt, intstatus, intmask)); ++ dhd->bus->ipend = TRUE; ++ dhd->bus->dpc_sched = TRUE; ++ dhd_sched_dpc(dhd); ++ timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received, true); ++ } ++ } ++ } else { ++ cnt = 0; ++ } ++ + if (timeleft == 0 && (!dhd_query_bus_erros(dhd))) { + uint32 intstatus; + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c +index 91a1203ebc65..a785fe52be96 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.c +@@ -497,7 +497,9 @@ uint32 + dhdpcie_bus_intstatus(dhd_bus_t *bus) + { + uint32 intstatus = 0; ++#ifndef DHD_READ_INTSTATUS_IN_DPC + uint32 intmask = 0; ++#endif /* DHD_READ_INTSTATUS_IN_DPC */ + + if ((bus->dhd->busstate == DHD_BUS_SUSPEND || bus->d3_suspend_pending) && + bus->wait_for_d3_ack) { +@@ -521,10 +523,12 @@ dhdpcie_bus_intstatus(dhd_bus_t *bus) + /* this is a PCIE core register..not a config register... */ + intstatus = si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxInt, 0, 0); + ++#ifndef DHD_READ_INTSTATUS_IN_DPC + /* this is a PCIE core register..not a config register... */ + intmask = si_corereg(bus->sih, bus->sih->buscoreidx, PCIMailBoxMask, 0, 0); + + intstatus &= intmask; ++#endif /* DHD_READ_INTSTATUS_IN_DPC */ + /* Is device removed. intstatus & intmask read 0xffffffff */ + if (intstatus == (uint32)-1) { + DHD_ERROR(("%s: Device is removed or Link is down.\n", __FUNCTION__)); +@@ -600,6 +604,7 @@ dhdpcie_bus_isr(dhd_bus_t *bus) + } + } + ++#ifndef DHD_READ_INTSTATUS_IN_DPC + intstatus = dhdpcie_bus_intstatus(bus); + + /* Check if the interrupt is ours or not */ +@@ -627,6 +632,7 @@ dhdpcie_bus_isr(dhd_bus_t *bus) + + /* Count the interrupt call */ + bus->intrcount++; ++#endif /* DHD_READ_INTSTATUS_IN_DPC */ + + bus->ipend = TRUE; + +@@ -988,6 +994,9 @@ dhdpcie_dongle_attach(dhd_bus_t *bus) + case BCM4347_CHIP_GRPID: + bus->dongle_ram_base = CR4_4347_RAM_BASE; + break; ++ case BCM4362_CHIP_ID: ++ bus->dongle_ram_base = CR4_4362_RAM_BASE; ++ break; + default: + bus->dongle_ram_base = 0; + DHD_ERROR(("%s: WARNING: Using default ram base at 0x%x\n", +@@ -1008,6 +1017,8 @@ dhdpcie_dongle_attach(dhd_bus_t *bus) + + /* Set the poll and/or interrupt flags */ + bus->intr = (bool)dhd_intr; ++ if ((bus->poll = (bool)dhd_poll)) ++ bus->pollrate = 1; + + bus->wait_for_d3_ack = 1; + #ifdef PCIE_OOB +@@ -1116,6 +1127,27 @@ dhdpcie_advertise_bus_cleanup(dhd_pub_t *dhdp) + return; + } + ++static void ++dhdpcie_advertise_bus_remove(dhd_pub_t *dhdp) ++{ ++ unsigned long flags; ++ int timeleft; ++ ++ DHD_GENERAL_LOCK(dhdp, flags); ++ dhdp->busstate = DHD_BUS_REMOVE; ++ DHD_GENERAL_UNLOCK(dhdp, flags); ++ ++ timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state); ++ if ((timeleft == 0) || (timeleft == 1)) { ++ DHD_ERROR(("%s : Timeout due to dhd_bus_busy_state=0x%x\n", ++ __FUNCTION__, dhdp->dhd_bus_busy_state)); ++ ASSERT(0); ++ } ++ ++ return; ++} ++ ++ + static void + dhdpcie_bus_remove_prep(dhd_bus_t *bus) + { +@@ -1169,7 +1201,7 @@ dhdpcie_bus_release(dhd_bus_t *bus) + ASSERT(osh); + + if (bus->dhd) { +- dhdpcie_advertise_bus_cleanup(bus->dhd); ++ dhdpcie_advertise_bus_remove(bus->dhd); + dongle_isolation = bus->dhd->dongle_isolation; + bus->dhd->is_pcie_watchdog_reset = FALSE; + dhdpcie_bus_remove_prep(bus); +@@ -1509,6 +1541,14 @@ bool dhd_bus_watchdog(dhd_pub_t *dhd) + } + } + ++#ifdef DHD_READ_INTSTATUS_IN_DPC ++ if (bus->poll) { ++ bus->ipend = TRUE; ++ bus->dpc_sched = TRUE; ++ dhd_sched_dpc(bus->dhd); /* queue DPC now!! */ ++ } ++#endif /* DHD_READ_INTSTATUS_IN_DPC */ ++ + #if defined(PCIE_OOB) || defined(PCIE_INB_DW) + /* If haven't communicated with device for a while, deassert the Device_Wake GPIO */ + if (dhd_doorbell_timeout != 0 && dhd->busstate == DHD_BUS_DATA && +@@ -1618,6 +1658,17 @@ dhd_set_path_params(struct dhd_bus *bus) + + } + ++void ++dhd_set_bus_params(struct dhd_bus *bus) ++{ ++ if (bus->dhd->conf->dhd_poll >= 0) { ++ bus->poll = bus->dhd->conf->dhd_poll; ++ if (!bus->pollrate) ++ bus->pollrate = 1; ++ printf("%s: set polling mode %d\n", __FUNCTION__, bus->dhd->conf->dhd_poll); ++ } ++} ++ + static int + dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh) + { +@@ -1659,6 +1710,7 @@ dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh) + DHD_OS_WAKE_LOCK(bus->dhd); + + dhd_set_path_params(bus); ++ dhd_set_bus_params(bus); + + ret = _dhdpcie_download_firmware(bus); + +@@ -6045,10 +6097,24 @@ dhd_bus_dpc(struct dhd_bus *bus) + DHD_BUS_BUSY_SET_IN_DPC(bus->dhd); + DHD_GENERAL_UNLOCK(bus->dhd, flags); + ++#ifdef DHD_READ_INTSTATUS_IN_DPC ++ if (bus->ipend) { ++ bus->ipend = FALSE; ++ bus->intstatus = dhdpcie_bus_intstatus(bus); ++ /* Check if the interrupt is ours or not */ ++ if (bus->intstatus == 0) { ++ goto INTR_ON; ++ } ++ bus->intrcount++; ++ } ++#endif /* DHD_READ_INTSTATUS_IN_DPC */ + + resched = dhdpcie_bus_process_mailbox_intr(bus, bus->intstatus); + if (!resched) { + bus->intstatus = 0; ++#ifdef DHD_READ_INTSTATUS_IN_DPC ++INTR_ON: ++#endif /* DHD_READ_INTSTATUS_IN_DPC */ + bus->dpc_intr_enable_count++; + dhdpcie_bus_intr_enable(bus); /* Enable back interrupt using Intmask!! */ + } +@@ -7025,6 +7091,11 @@ dhdpcie_chipmatch(uint16 vendor, uint16 device) + if ((device == BCM4361_D11AC_ID) || (device == BCM4361_D11AC2G_ID) || + (device == BCM4361_D11AC5G_ID) || (device == BCM4361_CHIP_ID)) + return 0; ++ ++ if ((device == BCM4362_D11AX_ID) || (device == BCM4362_D11AX2G_ID) || ++ (device == BCM4362_D11AX5G_ID) || (device == BCM4362_CHIP_ID)) { ++ return 0; ++ } + + if ((device == BCM4365_D11AC_ID) || (device == BCM4365_D11AC2G_ID) || + (device == BCM4365_D11AC5G_ID) || (device == BCM4365_CHIP_ID)) +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.h +old mode 100755 +new mode 100644 +index eb8de62956bf..92b07c6e4bc7 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie.h +@@ -259,6 +259,7 @@ typedef struct dhd_bus { + struct pktq txq; /* Queue length used for flow-control */ + + bool intr; /* Use interrupts */ ++ bool poll; /* Use polling */ + bool ipend; /* Device interrupt is pending */ + bool intdis; /* Interrupts disabled by isr */ + uint intrcount; /* Count of device interrupt callbacks */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie_linux.c +old mode 100755 +new mode 100644 +index 51664a7e217b..ecaed3e93558 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie_linux.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pcie_linux.c +@@ -178,12 +178,6 @@ static int dhdpcie_init(struct pci_dev *pdev); + static irqreturn_t dhdpcie_isr(int irq, void *arg); + /* OS Routine functions for PCI suspend/resume */ + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +-DEFINE_MUTEX(_dhd_sdio_mutex_lock_); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif +- + static int dhdpcie_set_suspend_resume(dhd_bus_t *bus, bool state); + static int dhdpcie_resume_host_dev(dhd_bus_t *bus); + static int dhdpcie_suspend_host_dev(dhd_bus_t *bus); +@@ -890,9 +884,7 @@ dhdpcie_bus_unregister(void) + int __devinit + dhdpcie_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + { +-#ifdef BUS_POWER_RESTORE +- wifi_adapter_info_t *adapter = NULL; +-#endif ++ DHD_MUTEX_LOCK(); + + if (dhdpcie_chipmatch (pdev->vendor, pdev->device)) { + DHD_ERROR(("%s: chipmatch failed!!\n", __FUNCTION__)); +@@ -912,15 +904,8 @@ dhdpcie_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + device_disable_async_suspend(&pdev->dev); + #endif /* BCMPCIE_DISABLE_ASYNC_SUSPEND */ + +-#ifdef BUS_POWER_RESTORE +- adapter = dhd_wifi_platform_get_adapter(PCI_BUS, pdev->bus->number, +- PCI_SLOT(pdev->devfn)); +- +- if (adapter != NULL) +- adapter->pci_dev = pdev; +-#endif +- + DHD_TRACE(("%s: PCIe Enumeration done!!\n", __FUNCTION__)); ++ DHD_MUTEX_UNLOCK(); + return 0; + } + +@@ -948,17 +933,7 @@ dhdpcie_pci_remove(struct pci_dev *pdev) + + DHD_TRACE(("%s Enter\n", __FUNCTION__)); + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) == 0) { +- DHD_ERROR(("%s : no mutex held. set lock\n", __FUNCTION__)); +- } +- else { +- DHD_ERROR(("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__)); +- } +- mutex_lock(&_dhd_sdio_mutex_lock_); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif ++ DHD_MUTEX_LOCK(); + + pch = pci_get_drvdata(pdev); + bus = pch->bus; +@@ -1006,12 +981,7 @@ dhdpcie_pci_remove(struct pci_dev *pdev) + + dhdpcie_init_succeeded = FALSE; + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- mutex_unlock(&_dhd_sdio_mutex_lock_); +- DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif /* LINUX */ ++ DHD_MUTEX_UNLOCK(); + + DHD_TRACE(("%s Exit\n", __FUNCTION__)); + +@@ -1029,10 +999,22 @@ dhdpcie_request_irq(dhdpcie_info_t *dhdpcie_info) + if (!bus->irq_registered) { + snprintf(dhdpcie_info->pciname, sizeof(dhdpcie_info->pciname), + "dhdpcie:%s", pci_name(pdev)); ++#ifdef DHD_USE_MSI ++ printf("%s: MSI enabled\n", __FUNCTION__); ++ err = pci_enable_msi(pdev); ++ if (err < 0) { ++ DHD_ERROR(("%s: pci_enable_msi() failed, %d, fall back to INTx\n", __FUNCTION__, err)); ++ } ++#else ++ printf("%s: MSI not enabled\n", __FUNCTION__); ++#endif /* DHD_USE_MSI */ + err = request_irq(pdev->irq, dhdpcie_isr, IRQF_SHARED, + dhdpcie_info->pciname, bus); + if (err) { + DHD_ERROR(("%s: request_irq() failed\n", __FUNCTION__)); ++#ifdef DHD_USE_MSI ++ pci_disable_msi(pdev); ++#endif /* DHD_USE_MSI */ + return -1; + } else { + bus->irq_registered = TRUE; +@@ -1226,10 +1208,6 @@ void dhdpcie_linkdown_cb(struct_pcie_notify *noti) + */ + #endif /* SUPPORT_LINKDOWN_RECOVERY */ + +-#if defined(MULTIPLE_SUPPLICANT) +-extern void wl_android_post_init(void); // terence 20120530: fix critical section in dhd_open and dhdsdio_probe +-#endif +- + int dhdpcie_init(struct pci_dev *pdev) + { + +@@ -1244,18 +1222,6 @@ int dhdpcie_init(struct pci_dev *pdev) + dhdpcie_smmu_info_t *dhdpcie_smmu_info = NULL; + #endif /* USE_SMMU_ARCH_MSM */ + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) == 0) { +- DHD_ERROR(("%s : no mutex held. set lock\n", __FUNCTION__)); +- } +- else { +- DHD_ERROR(("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__)); +- } +- mutex_lock(&_dhd_sdio_mutex_lock_); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif +- + do { + /* osl attach */ + if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) { +@@ -1266,9 +1232,12 @@ int dhdpcie_init(struct pci_dev *pdev) + /* initialize static buffer */ + adapter = dhd_wifi_platform_get_adapter(PCI_BUS, pdev->bus->number, + PCI_SLOT(pdev->devfn)); +- if (adapter != NULL) ++ if (adapter != NULL) { + DHD_ERROR(("%s: found adapter info '%s'\n", __FUNCTION__, adapter->name)); +- else ++#ifdef BUS_POWER_RESTORE ++ adapter->pci_dev = pdev; ++#endif ++ } else + DHD_ERROR(("%s: can't find adapter info for this chip\n", __FUNCTION__)); + osl_static_mem_init(osh, adapter); + +@@ -1438,11 +1407,7 @@ int dhdpcie_init(struct pci_dev *pdev) + + #if defined(MULTIPLE_SUPPLICANT) + wl_android_post_init(); // terence 20120530: fix critical section in dhd_open and dhdsdio_probe +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- mutex_unlock(&_dhd_sdio_mutex_lock_); +- DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ +-#endif ++#endif /* MULTIPLE_SUPPLICANT */ + + DHD_TRACE(("%s:Exit - SUCCESS \n", __FUNCTION__)); + return 0; /* return SUCCESS */ +@@ -1473,12 +1438,6 @@ int dhdpcie_init(struct pci_dev *pdev) + osl_detach(osh); + + dhdpcie_init_succeeded = FALSE; +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- mutex_unlock(&_dhd_sdio_mutex_lock_); +- DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ +-#endif + + DHD_TRACE(("%s:Exit - FAILURE \n", __FUNCTION__)); + +@@ -1497,6 +1456,9 @@ dhdpcie_free_irq(dhd_bus_t *bus) + if (bus->irq_registered) { + free_irq(pdev->irq, bus); + bus->irq_registered = FALSE; ++#ifdef DHD_USE_MSI ++ pci_disable_msi(pdev); ++#endif /* DHD_USE_MSI */ + } else { + DHD_ERROR(("%s: PCIe IRQ is not registered\n", __FUNCTION__)); + } +@@ -2296,6 +2258,7 @@ bool dhdpcie_is_resume_done(dhd_pub_t *dhdp) + return bus->runtime_resume_done; + } + #endif /* DHD_PCIE_RUNTIMEPM */ ++ + struct device * dhd_bus_to_dev(dhd_bus_t *bus) + { + struct pci_dev *pdev; +@@ -2306,6 +2269,7 @@ struct device * dhd_bus_to_dev(dhd_bus_t *bus) + else + return NULL; + } ++ + #ifdef HOFFLOAD_MODULES + void + dhd_free_module_memory(struct dhd_bus *bus, struct module_metadata *hmem) +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c +old mode 100755 +new mode 100644 +index c553733f682e..570e75ec8167 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_pno.c +@@ -910,6 +910,7 @@ exit: + bytes_written = (int32)(bp - buf); + return bytes_written; + } ++ + static int + _dhd_pno_clear_all_batch_results(dhd_pub_t *dhd, struct list_head *head, bool only_last) + { +@@ -992,6 +993,7 @@ _dhd_pno_cfg(dhd_pub_t *dhd, uint16 *channel_list, int nchan) + exit: + return err; + } ++ + static int + _dhd_pno_reinitialize_prof(dhd_pub_t *dhd, dhd_pno_params_t *params, dhd_pno_mode_t mode) + { +@@ -1084,6 +1086,7 @@ _dhd_pno_reinitialize_prof(dhd_pub_t *dhd, dhd_pno_params_t *params, dhd_pno_mod + mutex_unlock(&_pno_state->pno_mutex); + return err; + } ++ + static int + _dhd_pno_add_bssid(dhd_pub_t *dhd, wl_pfn_bssid_t *p_pfn_bssid, int nbssid) + { +@@ -2763,6 +2766,7 @@ exit: + return err; + } + #endif /* GSCAN_SUPPORT */ ++ + #if defined(GSCAN_SUPPORT) || defined(DHD_GET_VALID_CHANNELS) + void * + dhd_pno_get_gscan(dhd_pub_t *dhd, dhd_pno_gscan_cmd_cfg_t type, +@@ -4007,6 +4011,7 @@ exit: + kfree(buf); + return err; + } ++ + int dhd_pno_deinit(dhd_pub_t *dhd) + { + int err = BCME_OK; +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c +index a4b20b94ee9d..3e035df90f9b 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c +@@ -68,10 +68,6 @@ + #include + #include + +-#include +-#include +-#include "bcmsdh_sdmmc.h" +- + #ifdef PROP_TXSTATUS + #include + #endif +@@ -186,12 +182,6 @@ DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep); + pkt_statics_t tx_statics = {0}; + #endif + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +-DEFINE_MUTEX(_dhd_sdio_mutex_lock_); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif +- + #ifdef SUPPORT_MULTIPLE_BOARD_REV_FROM_HW + extern unsigned int system_hw_rev; + #endif /* SUPPORT_MULTIPLE_BOARD_REV_FROM_HW */ +@@ -345,6 +335,8 @@ typedef struct dhd_bus { + #if defined(SUPPORT_P2P_GO_PS) + wait_queue_head_t bus_sleep; + #endif /* LINUX && SUPPORT_P2P_GO_PS */ ++ bool ctrl_wait; ++ wait_queue_head_t ctrl_tx_wait; + uint rxflow_mode; /* Rx flow control mode */ + bool rxflow; /* Is rx flow control on */ + uint prev_rxlim_hit; /* Is prev rx limit exceeded (per dpc schedule) */ +@@ -700,7 +692,7 @@ static int dhdsdio_txpkt_preprocess(dhd_bus_t *bus, void *pkt, int chan, int txs + int prev_chain_total_len, bool last_chained_pkt, + int *pad_pkt_len, void **new_pkt + #if defined(BCMSDIOH_TXGLOM_EXT) +- , int frist_frame ++ , int first_frame + #endif + ); + static int dhdsdio_txpkt_postprocess(dhd_bus_t *bus, void *pkt); +@@ -724,6 +716,7 @@ static int dhd_bcmsdh_send_buffer(void *bus, uint8 *frame, uint16 len); + static int dhdsdio_set_sdmode(dhd_bus_t *bus, int32 sd_mode); + static int dhdsdio_sdclk(dhd_bus_t *bus, bool on); + static void dhdsdio_advertise_bus_cleanup(dhd_pub_t *dhdp); ++static void dhdsdio_advertise_bus_remove(dhd_pub_t *dhdp); + #ifdef SUPPORT_MULTIPLE_BOARD_REV_FROM_DT + int dhd_get_system_rev(void); + #endif /* SUPPORT_MULTIPLE_BOARD_REV_FROM_DT */ +@@ -884,7 +877,8 @@ dhdsdio_sr_cap(dhd_bus_t *bus) + (bus->sih->chip == BCM4371_CHIP_ID) || + (BCM4349_CHIP(bus->sih->chip)) || + (bus->sih->chip == BCM4350_CHIP_ID) || +- (bus->sih->chip == BCM43012_CHIP_ID)) { ++ (bus->sih->chip == BCM43012_CHIP_ID) || ++ (bus->sih->chip == BCM4362_CHIP_ID)) { + core_capext = TRUE; + } else { + core_capext = bcmsdh_reg_read(bus->sdh, +@@ -980,7 +974,8 @@ dhdsdio_sr_init(dhd_bus_t *bus) + if (CHIPID(bus->sih->chip) == BCM43430_CHIP_ID || + CHIPID(bus->sih->chip) == BCM43018_CHIP_ID || + CHIPID(bus->sih->chip) == BCM4339_CHIP_ID || +- CHIPID(bus->sih->chip) == BCM43012_CHIP_ID) ++ CHIPID(bus->sih->chip) == BCM43012_CHIP_ID || ++ CHIPID(bus->sih->chip) == BCM4362_CHIP_ID) + dhdsdio_devcap_set(bus, SDIOD_CCCR_BRCM_CARDCAP_CMD_NODEC); + + if (bus->sih->chip == BCM43012_CHIP_ID) { +@@ -1048,18 +1043,8 @@ dhdsdio_clk_kso_enab(dhd_bus_t *bus, bool on) + + wr_val |= (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); + +- { +- struct mmc_host *host; +- struct sdioh_info *sd = (struct sdioh_info *)(bus->sdh->sdioh); +- struct sdio_func *func = sd->func[SDIO_FUNC_0]; +- +- host = func->card->host; ++ bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err); + +- mmc_retune_disable(host); +- bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SLEEPCSR, +- wr_val, &err); +- mmc_retune_enable(host); +- } + + /* In case of 43012 chip, the chip could go down immediately after KSO bit is cleared. + * So the further reads of KSO register could fail. Thereby just bailing out immediately +@@ -1994,12 +1979,16 @@ dhd_bus_txdata(struct dhd_bus *bus, void *pkt) + + prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK)); + ++ /* move from dhdsdio_sendfromq(), try to orphan skb early */ ++ if (bus->dhd->conf->orphan_move) ++ PKTORPHAN(pkt, bus->dhd->conf->tsq); ++ + /* Check for existing queue, current flow-control, pending event, or pending clock */ + if (dhd_deferred_tx || bus->fcstate || pktq_len(&bus->txq) || bus->dpc_sched || + (!DATAOK(bus)) || (bus->flowcontrol & NBITVAL(prec)) || + (bus->clkstate != CLK_AVAIL)) { + bool deq_ret; +- int pkq_len; ++ int pkq_len = 0; + + DHD_TRACE(("%s: deferring pktq len %d\n", __FUNCTION__, pktq_len(&bus->txq))); + bus->fcqueued++; +@@ -2028,10 +2017,12 @@ dhd_bus_txdata(struct dhd_bus *bus, void *pkt) + } else + ret = BCME_OK; + +- dhd_os_sdlock_txq(bus->dhd); +- pkq_len = pktq_len(&bus->txq); +- dhd_os_sdunlock_txq(bus->dhd); +- if (pkq_len >= FCHI) { ++ if (dhd_doflow) { ++ dhd_os_sdlock_txq(bus->dhd); ++ pkq_len = pktq_len(&bus->txq); ++ dhd_os_sdunlock_txq(bus->dhd); ++ } ++ if (dhd_doflow && pkq_len >= FCHI) { + bool wlfc_enabled = FALSE; + #ifdef PROP_TXSTATUS + wlfc_enabled = (dhd_wlfc_flowcontrol(bus->dhd, ON, FALSE) != +@@ -2635,7 +2626,8 @@ dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) + } + } + #endif /* DHD_LOSSLESS_ROAMING */ +- PKTORPHAN(pkts[i], bus->dhd->conf->tsq); ++ if (!bus->dhd->conf->orphan_move) ++ PKTORPHAN(pkts[i], bus->dhd->conf->tsq); + datalen += PKTLEN(osh, pkts[i]); + } + dhd_os_sdunlock_txq(bus->dhd); +@@ -2672,9 +2664,11 @@ dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) + + } + +- dhd_os_sdlock_txq(bus->dhd); +- txpktqlen = pktq_len(&bus->txq); +- dhd_os_sdunlock_txq(bus->dhd); ++ if (dhd_doflow) { ++ dhd_os_sdlock_txq(bus->dhd); ++ txpktqlen = pktq_len(&bus->txq); ++ dhd_os_sdunlock_txq(bus->dhd); ++ } + + /* Do flow-control if needed */ + if (dhd->up && (dhd->busstate == DHD_BUS_DATA) && (txpktqlen < FCLOW)) { +@@ -2727,7 +2721,6 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen) + uint8 doff = 0; + int ret = -1; + uint8 sdpcm_hdrlen = bus->txglom_enable ? SDPCM_HDRLEN_TXGLOM : SDPCM_HDRLEN; +- int cnt = 0; + + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + +@@ -2767,17 +2760,13 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen) + + + /* Need to lock here to protect txseq and SDIO tx calls */ +-retry: +- dhd_os_sdlock(bus->dhd); +- if (cnt < bus->dhd->conf->txctl_tmo_fix && !TXCTLOK(bus)) { +- cnt++; +- dhd_os_sdunlock(bus->dhd); +- OSL_SLEEP(1); +- if (cnt >= (bus->dhd->conf->txctl_tmo_fix)) +- DHD_ERROR(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d, last retry cnt %d\n", +- __FUNCTION__, bus->tx_max, bus->tx_seq, cnt)); +- goto retry; ++ if (bus->dhd->conf->txctl_tmo_fix > 0 && !TXCTLOK(bus)) { ++ bus->ctrl_wait = TRUE; ++ wait_event_interruptible_timeout(bus->ctrl_tx_wait, TXCTLOK(bus), ++ msecs_to_jiffies(bus->dhd->conf->txctl_tmo_fix)); ++ bus->ctrl_wait = FALSE; + } ++ dhd_os_sdlock(bus->dhd); + + BUS_WAKE(bus); + +@@ -2923,6 +2912,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) + { + int timeleft; + uint rxlen = 0; ++ static uint cnt = 0; + + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + +@@ -2930,7 +2920,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) + return -EIO; + + /* Wait until control frame is available */ +- timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen); ++ timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, false); + + dhd_os_sdlock(bus->dhd); + rxlen = bus->rxlen; +@@ -2938,6 +2928,32 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) + bus->rxlen = 0; + dhd_os_sdunlock(bus->dhd); + ++ if (bus->dhd->conf->ctrl_resched > 0 && !rxlen && timeleft == 0) { ++ cnt++; ++ if (cnt <= bus->dhd->conf->ctrl_resched) { ++ uint32 status, retry = 0; ++ R_SDREG(status, &bus->regs->intstatus, retry); ++ if ((status & I_HMB_HOST_INT) || PKT_AVAILABLE(bus, status)) { ++ DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, status=0x%x\n", ++ __FUNCTION__, cnt, status)); ++ bus->ipend = TRUE; ++ bus->dpc_sched = TRUE; ++ dhd_sched_dpc(bus->dhd); ++ ++ /* Wait until control frame is available */ ++ timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, true); ++ ++ dhd_os_sdlock(bus->dhd); ++ rxlen = bus->rxlen; ++ bcopy(bus->rxctl, msg, MIN(msglen, rxlen)); ++ bus->rxlen = 0; ++ dhd_os_sdunlock(bus->dhd); ++ } ++ } ++ } else { ++ cnt = 0; ++ } ++ + if (rxlen) { + DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n", + __FUNCTION__, rxlen, msglen)); +@@ -6832,6 +6848,8 @@ exit: + } + } + ++ if (bus->ctrl_wait && TXCTLOK(bus)) ++ wake_up_interruptible(&bus->ctrl_tx_wait); + dhd_os_sdunlock(bus->dhd); + #ifdef DEBUG_DPC_THREAD_WATCHDOG + if (bus->dhd->dhd_bug_on) { +@@ -7631,14 +7649,12 @@ dhdsdio_chipmatch(uint16 chipid) + + if (chipid == BCM43012_CHIP_ID) + return TRUE; ++ if (chipid == BCM4362_CHIP_ID) ++ return TRUE; + + return FALSE; + } + +-#if defined(MULTIPLE_SUPPLICANT) +-extern void wl_android_post_init(void); // terence 20120530: fix critical section in dhd_open and dhdsdio_probe +-#endif +- + static void * + dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, + uint16 func, uint bustype, void *regsva, osl_t * osh, void *sdh) +@@ -7649,17 +7665,7 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, + struct ether_addr ea_addr; + #endif + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) == 0) { +- DHD_ERROR(("%s : no mutex held. set lock\n", __FUNCTION__)); +- } +- else { +- DHD_ERROR(("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__)); +- } +- mutex_lock(&_dhd_sdio_mutex_lock_); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif ++ DHD_MUTEX_LOCK(); + + /* Init global variables at run-time, not as part of the declaration. + * This is required to support init/de-init of the driver. Initialization +@@ -7741,6 +7747,7 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, + #if defined(SUPPORT_P2P_GO_PS) + init_waitqueue_head(&bus->bus_sleep); + #endif /* LINUX && SUPPORT_P2P_GO_PS */ ++ init_waitqueue_head(&bus->ctrl_tx_wait); + + /* attempt to attach to the dongle */ + if (!(dhdsdio_probe_attach(bus, osh, sdh, regsva, devid))) { +@@ -7839,11 +7846,8 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, + + #if defined(MULTIPLE_SUPPLICANT) + wl_android_post_init(); // terence 20120530: fix critical section in dhd_open and dhdsdio_probe +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- mutex_unlock(&_dhd_sdio_mutex_lock_); +- DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ +-#endif ++#endif /* MULTIPLE_SUPPLICANT */ ++ DHD_MUTEX_UNLOCK(); + + return bus; + +@@ -7851,12 +7855,7 @@ fail: + dhdsdio_release(bus, osh); + + forcereturn: +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- mutex_unlock(&_dhd_sdio_mutex_lock_); +- DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ +-#endif ++ DHD_MUTEX_UNLOCK(); + + return NULL; + } +@@ -7910,7 +7909,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva, + bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, + DHD_INIT_CLKCTL2, &err); + OSL_DELAY(200); +- ++ + if (DHD_INFO_ON()) { + for (fn = 0; fn <= numfn; fn++) { + if (!(cis[fn] = MALLOC(osh, SBSDIO_CIS_SIZE_LIMIT))) { +@@ -8051,6 +8050,9 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva, + case BCM4347_CHIP_GRPID: + bus->dongle_ram_base = CR4_4347_RAM_BASE; + break; ++ case BCM4362_CHIP_ID: ++ bus->dongle_ram_base = CR4_4362_RAM_BASE; ++ break; + default: + bus->dongle_ram_base = 0; + DHD_ERROR(("%s: WARNING: Using default ram base at 0x%x\n", +@@ -8284,7 +8286,7 @@ dhd_set_path_params(struct dhd_bus *bus) + + dhd_conf_read_config(bus->dhd, bus->dhd->conf_path); + +- dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path, bus->nv_path); ++ dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path); + dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path); + dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path); + +@@ -8309,15 +8311,12 @@ dhd_set_bus_params(struct dhd_bus *bus) + } + if (bus->dhd->conf->use_rxchain >= 0) { + bus->use_rxchain = (bool)bus->dhd->conf->use_rxchain; +- printf("%s: set use_rxchain %d\n", __FUNCTION__, bus->dhd->conf->use_rxchain); + } + if (bus->dhd->conf->txinrx_thres >= 0) { + bus->txinrx_thres = bus->dhd->conf->txinrx_thres; +- printf("%s: set txinrx_thres %d\n", __FUNCTION__, bus->txinrx_thres); + } + if (bus->dhd->conf->txglomsize >= 0) { + bus->txglomsize = bus->dhd->conf->txglomsize; +- printf("%s: set txglomsize %d\n", __FUNCTION__, bus->dhd->conf->txglomsize); + } + } + +@@ -8462,33 +8461,14 @@ dhdsdio_disconnect(void *ptr) + + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- if (mutex_is_locked(&_dhd_sdio_mutex_lock_) == 0) { +- DHD_ERROR(("%s : no mutex held. set lock\n", __FUNCTION__)); +- } +- else { +- DHD_ERROR(("%s : mutex is locked!. wait for unlocking\n", __FUNCTION__)); +- } +- mutex_lock(&_dhd_sdio_mutex_lock_); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif +- +- ++ DHD_MUTEX_LOCK(); + if (bus) { + ASSERT(bus->dhd); +- /* Advertise bus cleanup during rmmod */ +- dhdsdio_advertise_bus_cleanup(bus->dhd); ++ /* Advertise bus remove during rmmod */ ++ dhdsdio_advertise_bus_remove(bus->dhd); + dhdsdio_release(bus, bus->dhd->osh); + } +- +-#if defined(MULTIPLE_SUPPLICANT) +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) +- mutex_unlock(&_dhd_sdio_mutex_lock_); +- DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); +-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ +-#endif /* LINUX */ +- ++ DHD_MUTEX_UNLOCK(); + + DHD_TRACE(("%s: Disconnected\n", __FUNCTION__)); + } +@@ -9262,6 +9242,27 @@ dhdsdio_advertise_bus_cleanup(dhd_pub_t *dhdp) + return; + } + ++static void ++dhdsdio_advertise_bus_remove(dhd_pub_t *dhdp) ++{ ++ unsigned long flags; ++ int timeleft; ++ ++ DHD_LINUX_GENERAL_LOCK(dhdp, flags); ++ dhdp->busstate = DHD_BUS_REMOVE; ++ DHD_LINUX_GENERAL_UNLOCK(dhdp, flags); ++ ++ timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state); ++ if ((timeleft == 0) || (timeleft == 1)) { ++ DHD_ERROR(("%s : Timeout due to dhd_bus_busy_state=0x%x\n", ++ __FUNCTION__, dhdp->dhd_bus_busy_state)); ++ ASSERT(0); ++ } ++ ++ return; ++} ++ ++ + int + dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag) + { +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c +index c615ba041829..188a0ac00dc8 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c +@@ -1,4 +1,4 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ ++/* SPDX-License-Identifier: GPL-2.0 */ + #include + #include + #include +@@ -7,7 +7,7 @@ + #include + #include + +-#define DHD_STATIC_VERSION_STR "1.579.77.41.1" ++#define DHD_STATIC_VERSION_STR "1.579.77.41.9" + + #define BCMDHD_SDIO + #define BCMDHD_PCIE +@@ -53,7 +53,7 @@ enum dhd_prealloc_index { + #define DHD_PREALLOC_OSL_BUF_SIZE (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE) + #define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024) + #define DHD_PREALLOC_DHD_INFO_SIZE (30 * 1024) +-#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (770 * 1024) ++#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (810 * 1024) + #define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE (73 * 1024) + #define DHD_PREALLOC_WL_ESCAN_INFO_SIZE (66 * 1024) + #ifdef CONFIG_64BIT +@@ -327,6 +327,8 @@ static int dhd_init_wlan_mem(void) + wlan_static_if_flow_lkup = kmalloc(DHD_PREALLOC_IF_FLOW_LKUP_SIZE, GFP_KERNEL); + if (!wlan_static_if_flow_lkup) + goto err_mem_alloc; ++ pr_err("%s: sectoin %d, size=%d\n", __func__, ++ DHD_PREALLOC_IF_FLOW_LKUP, DHD_PREALLOC_IF_FLOW_LKUP_SIZE); + #endif /* BCMDHD_PCIE */ + + wlan_static_dhd_memdump_ram_buf = kmalloc(DHD_PREALLOC_MEMDUMP_RAM_SIZE, GFP_KERNEL); +@@ -347,31 +349,29 @@ static int dhd_init_wlan_mem(void) + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_WL_ESCAN_INFO, DHD_PREALLOC_WL_ESCAN_INFO_SIZE); + +- wlan_static_fw_verbose_ring_buf = kmalloc( +- DHD_PREALLOC_WIPHY_ESCAN0_SIZE, +- GFP_KERNEL); ++ wlan_static_fw_verbose_ring_buf = kmalloc(FW_VERBOSE_RING_SIZE, GFP_KERNEL); + if (!wlan_static_fw_verbose_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, +- DHD_PREALLOC_FW_VERBOSE_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE); ++ DHD_PREALLOC_FW_VERBOSE_RING, FW_VERBOSE_RING_SIZE); + +- wlan_static_fw_event_ring_buf = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL); ++ wlan_static_fw_event_ring_buf = kmalloc(FW_EVENT_RING_SIZE, GFP_KERNEL); + if (!wlan_static_fw_event_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, +- DHD_PREALLOC_FW_EVENT_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE); ++ DHD_PREALLOC_FW_EVENT_RING, FW_EVENT_RING_SIZE); + +- wlan_static_dhd_event_ring_buf = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL); ++ wlan_static_dhd_event_ring_buf = kmalloc(DHD_EVENT_RING_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_event_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, +- DHD_PREALLOC_DHD_EVENT_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE); ++ DHD_PREALLOC_DHD_EVENT_RING, DHD_EVENT_RING_SIZE); + +- wlan_static_nan_event_ring_buf = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL); ++ wlan_static_nan_event_ring_buf = kmalloc(NAN_EVENT_RING_SIZE, GFP_KERNEL); + if (!wlan_static_nan_event_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, +- DHD_PREALLOC_NAN_EVENT_RING, DHD_PREALLOC_WL_ESCAN_INFO_SIZE); ++ DHD_PREALLOC_NAN_EVENT_RING, NAN_EVENT_RING_SIZE); + + return 0; + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.c +index 678dbc387f6d..442af325a677 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.c +@@ -1617,7 +1617,7 @@ _dhd_wlfc_pktq_flush(athost_wl_status_info_t* ctx, struct pktq *pq, + ASSERT(pq->len == 0); + } /* _dhd_wlfc_pktq_flush */ + +- ++#ifndef BCMDBUS + /** !BCMDBUS specific function. Dequeues a packet from the caller supplied queue. */ + static void* + _dhd_wlfc_pktq_pdeq_with_fn(struct pktq *pq, int prec, f_processpkt_t fn, void *arg) +@@ -1723,6 +1723,7 @@ _dhd_wlfc_cleanup_txq(dhd_pub_t *dhd, f_processpkt_t fn, void *arg) + PKTFREE(wlfc->osh, pkt, TRUE); + } + } /* _dhd_wlfc_cleanup_txq */ ++#endif /* !BCMDBUS */ + + /** called during eg detach */ + void +@@ -1741,8 +1742,10 @@ _dhd_wlfc_cleanup(dhd_pub_t *dhd, f_processpkt_t fn, void *arg) + /* + * flush sequence should be txq -> psq -> hanger/afq, hanger has to be last one + */ ++#ifndef BCMDBUS + /* flush bus->txq */ + _dhd_wlfc_cleanup_txq(dhd, fn, arg); ++#endif /* !BCMDBUS */ + + /* flush psq, search all entries, include nodes as well as interfaces */ + total_entries = sizeof(wlfc->destination_entries)/sizeof(wlfc_mac_descriptor_t); +@@ -2465,7 +2468,7 @@ _dhd_wlfc_fifocreditback_indicate(dhd_pub_t *dhd, uint8* credits) + return BCME_OK; + } /* _dhd_wlfc_fifocreditback_indicate */ + +- ++#ifndef BCMDBUS + /** !BCMDBUS specific function */ + static void + _dhd_wlfc_suppress_txq(dhd_pub_t *dhd, f_processpkt_t fn, void *arg) +@@ -2544,6 +2547,7 @@ _dhd_wlfc_suppress_txq(dhd_pub_t *dhd, f_processpkt_t fn, void *arg) + _dhd_wlfc_fifocreditback_indicate(dhd, credits); + } + } /* _dhd_wlfc_suppress_txq */ ++#endif /* !BCMDBUS */ + + static int + _dhd_wlfc_dbg_senum_check(dhd_pub_t *dhd, uint8 *value) +@@ -3072,10 +3076,12 @@ dhd_wlfc_parse_header_info(dhd_pub_t *dhd, void* pktbuf, int tlv_hdr_len, uchar + _dhd_wlfc_interface_update(dhd, value, type); + } + ++#ifndef BCMDBUS + if (entry && WLFC_GET_REORDERSUPP(dhd->wlfc_mode)) { + /* suppress all packets for this mac entry from bus->txq */ + _dhd_wlfc_suppress_txq(dhd, _dhd_wlfc_entrypkt_fn, entry); + } ++#endif /* !BCMDBUS */ + } /* while */ + + if (remainder != 0 && wlfc) { +@@ -3407,6 +3413,15 @@ dhd_wlfc_commit_packets(dhd_pub_t *dhdp, f_commitpkt_t fcommit, void* commit_ctx + + ctx = (athost_wl_status_info_t*)dhdp->wlfc_state; + ++#ifdef BCMDBUS ++ if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN)) { ++ if (pktbuf) { ++ PKTFREE(ctx->osh, pktbuf, TRUE); ++ rc = BCME_OK; ++ } ++ goto exit; ++ } ++#endif /* BCMDBUS */ + + if (dhdp->proptxstatus_module_ignore) { + if (pktbuf) { +@@ -3593,10 +3608,17 @@ dhd_wlfc_init(dhd_pub_t *dhd) + DHD_ERROR(("%s: query wlfc_mode succeed, fw_caps=0x%x\n", __FUNCTION__, fw_caps)); + + if (WLFC_IS_OLD_DEF(fw_caps)) { ++#ifdef BCMDBUS ++ mode = WLFC_MODE_HANGER; ++#else + /* enable proptxtstatus v2 by default */ + mode = WLFC_MODE_AFQ; ++#endif /* BCMDBUS */ + } else { + WLFC_SET_AFQ(mode, WLFC_GET_AFQ(fw_caps)); ++#ifdef BCMDBUS ++ WLFC_SET_AFQ(mode, 0); ++#endif /* BCMDBUS */ + WLFC_SET_REUSESEQ(mode, WLFC_GET_REUSESEQ(fw_caps)); + WLFC_SET_REORDERSUPP(mode, WLFC_GET_REORDERSUPP(fw_caps)); + } +@@ -3679,7 +3701,9 @@ dhd_wlfc_cleanup_txq(dhd_pub_t *dhd, f_processpkt_t fn, void *arg) + return WLFC_UNSUPPORTED; + } + ++#ifndef BCMDBUS + _dhd_wlfc_cleanup_txq(dhd, fn, arg); ++#endif /* !BCMDBUS */ + + dhd_os_wlfc_unblock(dhd); + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.h +old mode 100755 +new mode 100644 +index 1e8b01f97a44..54c6b3b4bceb +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_wlfc.h +@@ -111,8 +111,13 @@ typedef struct wlfc_hanger { + + #define WLFC_PSQ_LEN (4096 * 8) + ++#ifdef BCMDBUS ++#define WLFC_FLOWCONTROL_HIWATER 512 ++#define WLFC_FLOWCONTROL_LOWATER (WLFC_FLOWCONTROL_HIWATER / 4) ++#else + #define WLFC_FLOWCONTROL_HIWATER ((4096 * 8) - 256) + #define WLFC_FLOWCONTROL_LOWATER 256 ++#endif + + #if (WLFC_FLOWCONTROL_HIWATER >= (WLFC_PSQ_LEN - 256)) + #undef WLFC_FLOWCONTROL_HIWATER +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/bcmdevs.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/bcmdevs.h +old mode 100755 +new mode 100644 +index 70ef46788483..5437c8f2a1db +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/bcmdevs.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/bcmdevs.h +@@ -280,6 +280,10 @@ + #define BCM4361_D11AC2G_ID 0x4420 /* 4361 802.11ac 2.4G device */ + #define BCM4361_D11AC5G_ID 0x4421 /* 4361 802.11ac 5G device */ + ++#define BCM4362_D11AX_ID 0x4490 /* 4362 802.11ax dualband device */ ++#define BCM4362_D11AX2G_ID 0x4491 /* 4362 802.11ax 2.4G device */ ++#define BCM4362_D11AX5G_ID 0x4492 /* 4362 802.11ax 5G device */ ++ + #define BCM4364_D11AC_ID 0x4464 /* 4364 802.11ac dualband device */ + #define BCM4364_D11AC2G_ID 0x446a /* 4364 802.11ac 2.4G device */ + #define BCM4364_D11AC5G_ID 0x446b /* 4364 802.11ac 5G device */ +@@ -501,6 +505,7 @@ + #define BCM4347_CHIP_ID 0x4347 /* 4347 chipcommon chipid */ + #define BCM4357_CHIP_ID 0x4357 /* 4357 chipcommon chipid */ + #define BCM4361_CHIP_ID 0x4361 /* 4361 chipcommon chipid */ ++#define BCM4362_CHIP_ID 0x4362 /* 4362 chipcommon chipid */ + #define BCM4347_CHIP(chipid) ((CHIPID(chipid) == BCM4347_CHIP_ID) || \ + (CHIPID(chipid) == BCM4357_CHIP_ID) || \ + (CHIPID(chipid) == BCM4361_CHIP_ID)) +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/dbus.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/dbus.h +index c926ba77e673..f4dec0d9ef36 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/dbus.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/dbus.h +@@ -32,11 +32,22 @@ + #define __DBUS_H__ + + #include "typedefs.h" +- +-#define DBUSTRACE(args) ++#include ++ ++extern uint dbus_msglevel; ++#define DBUS_ERROR_VAL 0x0001 ++#define DBUS_TRACE_VAL 0x0002 ++#define DBUS_INFO_VAL 0x0004 ++ ++#if defined(DHD_DEBUG) ++#define DBUSERR(args) do {if (dbus_msglevel & DBUS_ERROR_VAL) printf args;} while (0) ++#define DBUSTRACE(args) do {if (dbus_msglevel & DBUS_TRACE_VAL) printf args;} while (0) ++#define DBUSINFO(args) do {if (dbus_msglevel & DBUS_INFO_VAL) printf args;} while (0) ++#else /* defined(DHD_DEBUG) */ + #define DBUSERR(args) ++#define DBUSTRACE(args) + #define DBUSINFO(args) +-#define DBUSDBGLOCK(args) ++#endif + + enum { + DBUS_OK = 0, +@@ -181,7 +192,8 @@ typedef struct dbus_extdl { + struct dbus_callbacks; + struct exec_parms; + +-typedef void *(*probe_cb_t)(void *arg, const char *desc, uint32 bustype, uint32 hdrlen); ++typedef void *(*probe_cb_t)(void *arg, const char *desc, uint32 bustype, ++ uint16 bus_no, uint16 slot, uint32 hdrlen); + typedef void (*disconnect_cb_t)(void *arg); + typedef void *(*exec_cb_t)(struct exec_parms *args); + +@@ -237,7 +249,7 @@ typedef struct { + int (*get_config)(void *bus, dbus_config_t *config); + + bool (*device_exists)(void *bus); +- bool (*dlneeded)(void *bus); ++ int (*dlneeded)(void *bus); + int (*dlstart)(void *bus, uint8 *fw, int len); + int (*dlrun)(void *bus); + bool (*recv_needed)(void *bus); +@@ -299,26 +311,21 @@ extern int dbus_register(int vid, int pid, probe_cb_t prcb, disconnect_cb_t disc + void *param1, void *param2); + extern int dbus_deregister(void); + +-extern dbus_pub_t *dbus_attach(struct osl_info *osh, int rxsize, int nrxq, int ntxq, +- void *cbarg, dbus_callbacks_t *cbs, dbus_extdl_t *extdl, struct shared_info *sh); +-extern void dbus_detach(dbus_pub_t *pub); +- +-extern int dbus_download_firmware(dbus_pub_t *pub); +-extern int dbus_up(dbus_pub_t *pub); ++//extern int dbus_download_firmware(dbus_pub_t *pub); ++//extern int dbus_up(struct dhd_bus *pub); + extern int dbus_down(dbus_pub_t *pub); +-extern int dbus_stop(dbus_pub_t *pub); ++//extern int dbus_stop(struct dhd_bus *pub); + extern int dbus_shutdown(dbus_pub_t *pub); + extern void dbus_flowctrl_rx(dbus_pub_t *pub, bool on); + + extern int dbus_send_txdata(dbus_pub_t *dbus, void *pktbuf); + extern int dbus_send_buf(dbus_pub_t *pub, uint8 *buf, int len, void *info); + extern int dbus_send_pkt(dbus_pub_t *pub, void *pkt, void *info); +-extern int dbus_send_ctl(dbus_pub_t *pub, uint8 *buf, int len); +-extern int dbus_recv_ctl(dbus_pub_t *pub, uint8 *buf, int len); ++//extern int dbus_send_ctl(struct dhd_bus *pub, uint8 *buf, int len); ++//extern int dbus_recv_ctl(struct dhd_bus *pub, uint8 *buf, int len); + extern int dbus_recv_bulk(dbus_pub_t *pub, uint32 ep_idx); + extern int dbus_poll_intr(dbus_pub_t *pub); + extern int dbus_get_stats(dbus_pub_t *pub, dbus_stats_t *stats); +-extern int dbus_get_attrib(dbus_pub_t *pub, dbus_attrib_t *attrib); + extern int dbus_get_device_speed(dbus_pub_t *pub); + extern int dbus_set_config(dbus_pub_t *pub, dbus_config_t *config); + extern int dbus_get_config(dbus_pub_t *pub, dbus_config_t *config); +@@ -332,8 +339,8 @@ extern int dbus_pnp_sleep(dbus_pub_t *pub); + extern int dbus_pnp_resume(dbus_pub_t *pub, int *fw_reload); + extern int dbus_pnp_disconnect(dbus_pub_t *pub); + +-extern int dbus_iovar_op(dbus_pub_t *pub, const char *name, +- void *params, int plen, void *arg, int len, bool set); ++//extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, ++// void *params, int plen, void *arg, int len, bool set); + + extern void *dhd_dbus_txq(const dbus_pub_t *pub); + extern uint dhd_dbus_hdrlen(const dbus_pub_t *pub); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/epivers.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/epivers.h +index 4cf4c70348c8..c014bb62f540 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/epivers.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/epivers.h +@@ -46,6 +46,6 @@ + #define EPI_VERSION_DEV 1.579.77.41 + + /* Driver Version String, ASCII, 32 chars max */ +-#define EPI_VERSION_STR "1.579.77.41.2 (r)" ++#define EPI_VERSION_STR "1.579.77.41.9 (r)" + + #endif /* _epivers_h_ */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/linux_osl.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/linux_osl.h +old mode 100755 +new mode 100644 +index 3dd51bc372e5..b40ec111c08b +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/linux_osl.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/linux_osl.h +@@ -1145,6 +1145,7 @@ typedef struct sk_buff_head PKT_LIST; + #define PKTLIST_UNLINK(x, y) skb_unlink((struct sk_buff *)(y), (struct sk_buff_head *)(x)) + #define PKTLIST_FINI(x) skb_queue_purge((struct sk_buff_head *)(x)) + ++#ifdef REPORT_FATAL_TIMEOUTS + typedef struct osl_timer { + struct timer_list *timer; + bool set; +@@ -1156,5 +1157,6 @@ extern osl_timer_t * osl_timer_init(osl_t *osh, const char *name, void (*fn)(voi + extern void osl_timer_add(osl_t *osh, osl_timer_t *t, uint32 ms, bool periodic); + extern void osl_timer_update(osl_t *osh, osl_timer_t *t, uint32 ms, bool periodic); + extern bool osl_timer_del(osl_t *osh, osl_timer_t *t); ++#endif + + #endif /* _linux_osl_h_ */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/sbchipc.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/sbchipc.h +index ffec624c53dc..cbc75b2f58e0 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/sbchipc.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/sbchipc.h +@@ -3343,6 +3343,7 @@ typedef volatile struct { + #define CA7_4365_RAM_BASE (0x200000) + + #define CR4_4347_RAM_BASE (0x170000) ++#define CR4_4362_RAM_BASE (0x170000) + + /* 4335 chip OTP present & OTP select bits. */ + #define SPROM4335_OTP_SELECT 0x00000010 +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/usbrdl.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/usbrdl.h +new file mode 100644 +index 000000000000..f15fbd697cea +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/usbrdl.h +@@ -0,0 +1,135 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Broadcom USB remote download definitions ++ * ++ * Copyright (C) 1999-2016, Broadcom Corporation ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2 (the "GPL"), ++ * available at http://www.broadcom.com/licenses/GPLv2.php, with the ++ * following added to such license: ++ * ++ * As a special exception, the copyright holders of this software give you ++ * permission to link this software with independent modules, and to copy and ++ * distribute the resulting executable under terms of your choice, provided that ++ * you also meet, for each linked independent module, the terms and conditions of ++ * the license of that module. An independent module is a module which is not ++ * derived from this software. The special exception does not apply to any ++ * modifications of the software. ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a license ++ * other than the GPL, without Broadcom's express prior written consent. ++ * ++ * ++ * <> ++ * ++ * $Id: usbrdl.h 597933 2015-11-06 18:52:06Z $ ++ */ ++ ++#ifndef _USB_RDL_H ++#define _USB_RDL_H ++ ++/* Control messages: bRequest values */ ++#define DL_GETSTATE 0 /* returns the rdl_state_t struct */ ++#define DL_CHECK_CRC 1 /* currently unused */ ++#define DL_GO 2 /* execute downloaded image */ ++#define DL_START 3 /* initialize dl state */ ++#define DL_REBOOT 4 /* reboot the device in 2 seconds */ ++#define DL_GETVER 5 /* returns the bootrom_id_t struct */ ++#define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset event ++ * to occur in 2 seconds. It is the responsibility ++ * of the downloaded code to clear this event ++ */ ++#define DL_EXEC 7 /* jump to a supplied address */ ++#define DL_RESETCFG 8 /* To support single enum on dongle ++ * - Not used by bootloader ++ */ ++#define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup ++ * if resp unavailable ++ */ ++#define DL_CHGSPD 0x0A ++ ++#define DL_HWCMD_MASK 0xfc /* Mask for hardware read commands: */ ++#define DL_RDHW 0x10 /* Read a hardware address (Ctl-in) */ ++#define DL_RDHW32 0x10 /* Read a 32 bit word */ ++#define DL_RDHW16 0x11 /* Read 16 bits */ ++#define DL_RDHW8 0x12 /* Read an 8 bit byte */ ++#define DL_WRHW 0x14 /* Write a hardware address (Ctl-out) */ ++#define DL_WRHW_BLK 0x13 /* Block write to hardware access */ ++ ++#define DL_CMD_WRHW 2 ++ ++ ++/* states */ ++#define DL_WAITING 0 /* waiting to rx first pkt that includes the hdr info */ ++#define DL_READY 1 /* hdr was good, waiting for more of the compressed image */ ++#define DL_BAD_HDR 2 /* hdr was corrupted */ ++#define DL_BAD_CRC 3 /* compressed image was corrupted */ ++#define DL_RUNNABLE 4 /* download was successful, waiting for go cmd */ ++#define DL_START_FAIL 5 /* failed to initialize correctly */ ++#define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM value */ ++#define DL_IMAGE_TOOBIG 7 /* download image too big (exceeds DATA_START for rdl) */ ++ ++#define TIMEOUT 5000 /* Timeout for usb commands */ ++ ++struct bcm_device_id { ++ char *name; ++ uint32 vend; ++ uint32 prod; ++}; ++ ++typedef struct { ++ uint32 state; ++ uint32 bytes; ++} rdl_state_t; ++ ++typedef struct { ++ uint32 chip; /* Chip id */ ++ uint32 chiprev; /* Chip rev */ ++ uint32 ramsize; /* Size of RAM */ ++ uint32 remapbase; /* Current remap base address */ ++ uint32 boardtype; /* Type of board */ ++ uint32 boardrev; /* Board revision */ ++} bootrom_id_t; ++ ++/* struct for backplane & jtag accesses */ ++typedef struct { ++ uint32 cmd; /* tag to identify the cmd */ ++ uint32 addr; /* backplane address for write */ ++ uint32 len; /* length of data: 1, 2, 4 bytes */ ++ uint32 data; /* data to write */ ++} hwacc_t; ++ ++ ++/* struct for querying nvram params from bootloader */ ++#define QUERY_STRING_MAX 32 ++typedef struct { ++ uint32 cmd; /* tag to identify the cmd */ ++ char var[QUERY_STRING_MAX]; /* param name */ ++} nvparam_t; ++ ++typedef void (*exec_fn_t)(void *sih); ++ ++#define USB_CTRL_IN (USB_TYPE_VENDOR | 0x80 | USB_RECIP_INTERFACE) ++#define USB_CTRL_OUT (USB_TYPE_VENDOR | 0 | USB_RECIP_INTERFACE) ++ ++#define USB_CTRL_EP_TIMEOUT 500 /* Timeout used in USB control_msg transactions. */ ++#define USB_BULK_EP_TIMEOUT 500 /* Timeout used in USB bulk transactions. */ ++ ++#define RDL_CHUNK_MAX (64 * 1024) /* max size of each dl transfer */ ++#define RDL_CHUNK 1500 /* size of each dl transfer */ ++ ++/* bootloader makes special use of trx header "offsets" array */ ++#define TRX_OFFSETS_DLFWLEN_IDX 0 /* Size of the fw; used in uncompressed case */ ++#define TRX_OFFSETS_JUMPTO_IDX 1 /* RAM address for jumpto after download */ ++#define TRX_OFFSETS_NVM_LEN_IDX 2 /* Length of appended NVRAM data */ ++#ifdef BCMTRXV2 ++#define TRX_OFFSETS_DSG_LEN_IDX 3 /* Length of digital signature for the first image */ ++#define TRX_OFFSETS_CFG_LEN_IDX 4 /* Length of config region, which is not digitally signed */ ++#endif /* BCMTRXV2 */ ++ ++#define TRX_OFFSETS_DLBASE_IDX 0 /* RAM start address for download */ ++ ++#endif /* _USB_RDL_H */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/wlioctl.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/wlioctl.h +index 1e6a3a280e08..812182af77b0 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/wlioctl.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include/wlioctl.h +@@ -11548,6 +11548,15 @@ typedef enum wl_interface_type { + */ + #define WL_INTERFACE_BSSID_INDEX_USE (1 << 4) + ++#ifdef WLMESH ++typedef struct wl_interface_info { ++ uint16 ver; /* version of this struct */ ++ struct ether_addr mac_addr; /* MAC address of the interface */ ++ char ifname[BCM_MSG_IFNAME_MAX]; /* name of interface */ ++ uint8 bsscfgidx; /* source bsscfg index */ ++} wl_interface_info_t; ++#endif ++ + typedef struct wl_interface_create { + uint16 ver; /* version of this struct */ + uint32 flags; /* flags that defines the operation */ +@@ -12462,6 +12471,12 @@ enum wl_mesh_cmd_xtlv_id { + }; + /* endif WLMESH */ + ++#ifdef WLMESH ++#ifndef SAE_MAX_PASSWD_LEN ++#define SAE_MAX_PASSWD_LEN 32 ++#endif ++#endif ++ + /* Fast BSS Transition parameter configuration */ + #define FBT_PARAM_CURRENT_VERSION 0 + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/linux_osl.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/linux_osl.c +old mode 100755 +new mode 100644 +index efbcf36ecc10..ee07bd325532 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/linux_osl.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/linux_osl.c +@@ -2148,9 +2148,13 @@ osl_os_get_image_block(char *buf, int len, void *image) + if (!image) + return 0; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ rdlen = kernel_read(fp, buf, len, &fp->f_pos); ++#else + rdlen = kernel_read(fp, fp->f_pos, buf, len); + if (rdlen > 0) + fp->f_pos += rdlen; ++#endif + + return rdlen; + } +@@ -2677,13 +2681,19 @@ osl_pkt_orphan_partial(struct sk_buff *skb, int tsq) + */ + fraction = skb->truesize * (tsq - 1) / tsq; + skb->truesize -= fraction; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ atomic_sub(fraction, &skb->sk->sk_wmem_alloc.refs); ++#else + atomic_sub(fraction, &skb->sk->sk_wmem_alloc); ++#endif /* LINUX_VERSION >= 4.13.0 */ ++ skb_orphan(skb); + } + #endif /* LINUX_VERSION >= 3.6.0 && TSQ_MULTIPLIER */ + + /* timer apis */ + /* Note: All timer api's are thread unsafe and should be protected with locks by caller */ + ++#ifdef REPORT_FATAL_TIMEOUTS + osl_timer_t * + osl_timer_init(osl_t *osh, const char *name, void (*fn)(void *arg), void *arg) + { +@@ -2768,3 +2778,4 @@ osl_timer_del(osl_t *osh, osl_timer_t *t) + } + return (TRUE); + } ++#endif +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/siutils.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/siutils.c +index 00ae5869a316..74cdcfafb32c 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/siutils.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/siutils.c +@@ -604,7 +604,6 @@ si_doattach(si_info_t *sii, uint devid, osl_t *osh, volatile void *regs, + } + + sih->bustype = bustype; +- + #ifdef BCMBUSTYPE + if (bustype != BUSTYPE(bustype)) { + SI_ERROR(("si_doattach: bus type %d does not match configured bus type %d\n", +@@ -636,7 +635,7 @@ si_doattach(si_info_t *sii, uint devid, osl_t *osh, volatile void *regs, + sih->chiprev = (w & CID_REV_MASK) >> CID_REV_SHIFT; + sih->chippkg = (w & CID_PKG_MASK) >> CID_PKG_SHIFT; + +-#if defined(HW_OOB) || defined(FORCE_WOWLAN) ++#if defined(BCMSDIO) && (defined(HW_OOB) || defined(FORCE_WOWLAN)) + dhd_conf_set_hw_oob_intr(sdh, sih->chip); + #endif + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.c +index 42afe36f8834..a73c28df22b9 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.c +@@ -104,6 +104,10 @@ uint android_msg_level = ANDROID_ERROR_LEVEL; + #define CMD_SETBAND "SETBAND" + #define CMD_GETBAND "GETBAND" + #define CMD_COUNTRY "COUNTRY" ++#ifdef WLMESH ++#define CMD_SAE_SET_PASSWORD "SAE_SET_PASSWORD" ++#define CMD_SET_RSDB_MODE "RSDB_MODE" ++#endif + #define CMD_P2P_SET_NOA "P2P_SET_NOA" + #if !defined WL_ENABLE_P2P_IF + #define CMD_P2P_GET_NOA "P2P_GET_NOA" +@@ -1068,7 +1072,7 @@ wl_cfg80211_get_sta_info(struct net_device *dev, char* command, int total_len) + error: + return bytes_written; + } +-#endif /* CUSTOMER_HW4_PRIVATE_CMD */ ++#endif + + #ifdef WBTEXT + static int wl_android_wbtext(struct net_device *dev, char *command, int total_len) +@@ -1179,6 +1183,7 @@ static int wl_cfg80211_wbtext_btm_delta(struct net_device *dev, + #define PNO_PARAM_SIZE 50 + #define VALUE_SIZE 50 + #define LIMIT_STR_FMT ("%50s %50s") ++ + static int + wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len) + { +@@ -1187,7 +1192,8 @@ wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len) + char *pos, *pos2, *token, *token2, *delim; + char param[PNO_PARAM_SIZE+1], value[VALUE_SIZE+1]; + struct dhd_pno_batch_params batch_params; +- DHD_PNO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); ++ ++ ANDROID_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); + if (total_len < strlen(CMD_WLS_BATCHING)) { + ANDROID_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len)); + err = BCME_ERROR; +@@ -1212,13 +1218,13 @@ wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len) + tokens = sscanf(token, LIMIT_STR_FMT, param, value); + if (!strncmp(param, PNO_PARAM_SCANFREQ, strlen(PNO_PARAM_SCANFREQ))) { + batch_params.scan_fr = simple_strtol(value, NULL, 0); +- DHD_PNO(("scan_freq : %d\n", batch_params.scan_fr)); ++ ANDROID_INFO(("scan_freq : %d\n", batch_params.scan_fr)); + } else if (!strncmp(param, PNO_PARAM_BESTN, strlen(PNO_PARAM_BESTN))) { + batch_params.bestn = simple_strtol(value, NULL, 0); +- DHD_PNO(("bestn : %d\n", batch_params.bestn)); ++ ANDROID_INFO(("bestn : %d\n", batch_params.bestn)); + } else if (!strncmp(param, PNO_PARAM_MSCAN, strlen(PNO_PARAM_MSCAN))) { + batch_params.mscan = simple_strtol(value, NULL, 0); +- DHD_PNO(("mscan : %d\n", batch_params.mscan)); ++ ANDROID_INFO(("mscan : %d\n", batch_params.mscan)); + } else if (!strncmp(param, PNO_PARAM_CHANNEL, strlen(PNO_PARAM_CHANNEL))) { + i = 0; + pos2 = value; +@@ -1238,7 +1244,7 @@ wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len) + if (*token2 == 'A' || *token2 == 'B') { + batch_params.band = (*token2 == 'A')? + WLC_BAND_5G : WLC_BAND_2G; +- DHD_PNO(("band : %s\n", ++ ANDROID_INFO(("band : %s\n", + (*token2 == 'A')? "A" : "B")); + } else { + if ((batch_params.nchan >= WL_NUMCHANNELS) || +@@ -1251,13 +1257,13 @@ wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len) + batch_params.chan_list[i++] = + simple_strtol(token2, NULL, 0); + batch_params.nchan++; +- DHD_PNO(("channel :%d\n", ++ ANDROID_INFO(("channel :%d\n", + batch_params.chan_list[i-1])); + } + } + } else if (!strncmp(param, PNO_PARAM_RTT, strlen(PNO_PARAM_RTT))) { + batch_params.rtt = simple_strtol(value, NULL, 0); +- DHD_PNO(("rtt : %d\n", batch_params.rtt)); ++ ANDROID_INFO(("rtt : %d\n", batch_params.rtt)); + } else { + ANDROID_ERROR(("%s : unknown param: %s\n", __FUNCTION__, param)); + err = BCME_ERROR; +@@ -1294,6 +1300,7 @@ wls_parse_batching_cmd(struct net_device *dev, char *command, int total_len) + exit: + return err; + } ++ + #ifndef WL_SCHED_SCAN + static int wl_android_set_pno_setup(struct net_device *dev, char *command, int total_len) + { +@@ -1327,7 +1334,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t + 0x00 + }; + #endif /* PNO_SET_DEBUG */ +- DHD_PNO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); ++ ANDROID_INFO(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); + + if (total_len < (strlen(CMD_PNOSETUP_SET) + sizeof(cmd_tlv_t))) { + ANDROID_ERROR(("%s argument=%d less min size\n", __FUNCTION__, total_len)); +@@ -1362,7 +1369,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t + } + str_ptr++; + pno_time = simple_strtoul(str_ptr, &str_ptr, 16); +- DHD_PNO(("%s: pno_time=%d\n", __FUNCTION__, pno_time)); ++ ANDROID_INFO(("%s: pno_time=%d\n", __FUNCTION__, pno_time)); + + if (str_ptr[0] != 0) { + if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) { +@@ -1372,7 +1379,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t + } + str_ptr++; + pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16); +- DHD_PNO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat)); ++ ANDROID_INFO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat)); + if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) { + ANDROID_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n", + __FUNCTION__)); +@@ -1380,7 +1387,7 @@ static int wl_android_set_pno_setup(struct net_device *dev, char *command, int t + } + str_ptr++; + pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16); +- DHD_PNO(("%s: pno_freq_expo_max=%d\n", ++ ANDROID_INFO(("%s: pno_freq_expo_max=%d\n", + __FUNCTION__, pno_freq_expo_max)); + } + } +@@ -1552,10 +1559,6 @@ int wl_android_wifi_on(struct net_device *dev) + { + int ret = 0; + int retry = POWERUP_MAX_RETRY; +-#ifdef IAPSTA_PREINIT +- int bytes_written = 0; +- struct dhd_conf *conf; +-#endif + + if (!dev) { + ANDROID_ERROR(("%s: dev is null\n", __FUNCTION__)); +@@ -1589,30 +1592,22 @@ int wl_android_wifi_on(struct net_device *dev) + ANDROID_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n")); + goto exit; + } +-#ifdef BCMSDIO ++#if defined(BCMSDIO) || defined(BCMDBUS) + ret = dhd_net_bus_devreset(dev, FALSE); + if (ret) + goto err; ++#ifdef BCMSDIO + dhd_net_bus_resume(dev, 1); + #endif /* BCMSDIO */ +- +-#ifndef BCMPCIE ++#endif /* BCMSDIO || BCMDBUS */ ++#if defined(BCMSDIO) || defined(BCMDBUS) + if (!ret) { + if (dhd_dev_init_ioctl(dev) < 0) { + ret = -EFAULT; + goto err; + } + } +-#endif /* !BCMPCIE */ +- +-#ifdef IAPSTA_PREINIT +- conf = dhd_get_conf(dev); +- if (conf) { +- wl_android_ext_priv_cmd(dev, conf->iapsta_init, 0, &bytes_written); +- wl_android_ext_priv_cmd(dev, conf->iapsta_config, 0, &bytes_written); +- wl_android_ext_priv_cmd(dev, conf->iapsta_enable, 0, &bytes_written); +- } +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + g_wifi_on = TRUE; + } + +@@ -1621,15 +1616,17 @@ exit: + dhd_net_if_unlock(dev); + return ret; + +-#ifdef BCMSDIO ++#if defined(BCMSDIO) || defined(BCMDBUS) + err: + dhd_net_bus_devreset(dev, TRUE); ++#ifdef BCMSDIO + dhd_net_bus_suspend(dev); ++#endif /* BCMSDIO */ + dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY); + printf("%s: Failed\n", __FUNCTION__); + dhd_net_if_unlock(dev); + return ret; +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + } + + int wl_android_wifi_off(struct net_device *dev, bool on_failure) +@@ -1652,12 +1649,12 @@ int wl_android_wifi_off(struct net_device *dev, bool on_failure) + dhd_net_if_lock(dev); + printf("%s in 2: g_wifi_on=%d, on_failure=%d\n", __FUNCTION__, g_wifi_on, on_failure); + if (g_wifi_on || on_failure) { +-#if defined(BCMSDIO) || defined(BCMPCIE) ++#if defined(BCMSDIO) || defined(BCMPCIE) || defined(BCMDBUS) + ret = dhd_net_bus_devreset(dev, TRUE); + #if defined(BCMSDIO) + dhd_net_bus_suspend(dev); + #endif /* BCMSDIO */ +-#endif /* BCMSDIO || BCMPCIE */ ++#endif /* BCMSDIO || BCMPCIE || BCMDBUS */ + dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY); + g_wifi_on = FALSE; + } +@@ -2497,6 +2494,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + uint32 band = WLC_BAND_2G; + uint32 buf_size; + char *pos = command; ++ int band_new, band_cur; + + if (cmd_str) { + ANDROID_INFO(("Command: %s len:%d \n", cmd_str, (int)strlen(cmd_str))); +@@ -2516,20 +2514,22 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + (channel == APCS_BAND_2G_LEGACY2)) { + band = WLC_BAND_2G; + } else { +- ANDROID_ERROR(("Invalid argument\n")); ++ ANDROID_ERROR(("%s: Invalid argument\n", __FUNCTION__)); + return -EINVAL; + } + } + } else { + /* If no argument is provided, default to 2G */ +- ANDROID_ERROR(("No argument given default to 2.4G scan\n")); ++ ANDROID_ERROR(("%s: No argument given default to 2.4G scan\n", __FUNCTION__)); + band = WLC_BAND_2G; + } +- ANDROID_INFO(("HAPD_AUTO_CHANNEL = %d, band=%d \n", channel, band)); ++ ANDROID_INFO(("%s : HAPD_AUTO_CHANNEL = %d, band=%d \n", __FUNCTION__, channel, band)); ++ ++ ret = wldev_ioctl_set(dev, WLC_GET_BAND, &band_cur, sizeof(band_cur)); + + if ((ret = + wldev_ioctl_get(dev, WLC_GET_SPECT_MANAGMENT, &spect, sizeof(spect))) < 0) { +- ANDROID_ERROR(("ACS: error getting the spect\n")); ++ ANDROID_ERROR(("%s: ACS: error getting the spect\n", __FUNCTION__)); + goto done; + } + +@@ -2551,15 +2551,19 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + + reqbuf = kzalloc(CHANSPEC_BUF_SIZE, GFP_KERNEL); + if (reqbuf == NULL) { +- ANDROID_ERROR(("failed to allocate chanspec buffer\n")); ++ ANDROID_ERROR(("%s: failed to allocate chanspec buffer\n", __FUNCTION__)); + return -ENOMEM; + } + + if (band == WLC_BAND_AUTO) { +- ANDROID_INFO(("ACS full channel scan \n")); ++ ANDROID_INFO(("%s: ACS full channel scan \n", __func__)); + reqbuf[0] = htod32(0); + } else if (band == WLC_BAND_5G) { +- ANDROID_INFO(("ACS 5G band scan \n")); ++ band_new = band_cur==WLC_BAND_2G ? band_cur : WLC_BAND_5G; ++ ret = wldev_ioctl_set(dev, WLC_SET_BAND, &band_new, sizeof(band_new)); ++ if (ret < 0) ++ WL_ERR(("WLC_SET_BAND error %d\n", ret)); ++ ANDROID_INFO(("%s: ACS 5G band scan \n", __func__)); + if ((ret = wl_cfg80211_get_chanspecs_5g(dev, reqbuf, CHANSPEC_BUF_SIZE)) < 0) { + ANDROID_ERROR(("ACS 5g chanspec retreival failed! \n")); + goto done; +@@ -2569,7 +2573,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + * If channel argument is not provided/ argument 20 is provided, + * Restrict channel to 2GHz, 20MHz BW, No SB + */ +- ANDROID_INFO(("ACS 2G band scan \n")); ++ ANDROID_INFO(("%s: ACS 2G band scan \n", __func__)); + if ((ret = wl_cfg80211_get_chanspecs_2g(dev, reqbuf, CHANSPEC_BUF_SIZE)) < 0) { + ANDROID_ERROR(("ACS 2g chanspec retreival failed! \n")); + goto done; +@@ -2579,11 +2583,12 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + goto done2; + } + +- buf_size = (band == WLC_BAND_AUTO) ? sizeof(int) : CHANSPEC_BUF_SIZE; ++ buf_size = CHANSPEC_BUF_SIZE; + ret = wldev_ioctl_set(dev, WLC_START_CHANNEL_SEL, (void *)reqbuf, + buf_size); + if (ret < 0) { +- ANDROID_ERROR(("can't start auto channel scan, err = %d\n", ret)); ++ ANDROID_ERROR(("%s: can't start auto channel scan, err = %d\n", ++ __FUNCTION__, ret)); + channel = 0; + goto done; + } +@@ -2609,6 +2614,18 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + chosen = dtoh32(chosen); + } + ++ if ((ret == 0) && (dtoh32(chosen) != 0)) { ++ uint chip; ++ chip = dhd_conf_get_chip(dhd_get_pub(dev)); ++ if (chip != BCM43143_CHIP_ID) { ++ u32 chanspec = 0; ++ chanspec = wl_chspec_driver_to_host(chosen); ++ ANDROID_INFO(("%s: selected chanspec = 0x%x\n", __FUNCTION__, chanspec)); ++ chosen = wf_chspec_ctlchan(chanspec); ++ ANDROID_INFO(("%s: selected chosen = 0x%x\n", __FUNCTION__, chosen)); ++ } ++ } ++ + if (chosen) { + int chosen_band; + int apcs_band; +@@ -2623,12 +2640,15 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, + #endif /* D11AC_IOTYPES */ + apcs_band = (band == WLC_BAND_AUTO) ? WLC_BAND_2G : band; + chosen_band = (channel <= CH_MAX_2G_CHANNEL) ? WLC_BAND_2G : WLC_BAND_5G; +- if (apcs_band == chosen_band) { ++ if (band == WLC_BAND_AUTO) { ++ printf("%s: selected channel = %d\n", __FUNCTION__, channel); ++ break; ++ } else if (apcs_band == chosen_band) { + printf("%s: selected channel = %d\n", __FUNCTION__, channel); + break; + } + } +- ANDROID_INFO(("%d tried, ret = %d, chosen = 0x%x\n", ++ ANDROID_INFO(("%s: %d tried, ret = %d, chosen = 0x%x\n", __FUNCTION__, + (APCS_MAX_RETRY - retry), ret, chosen)); + OSL_SLEEP(250); + } +@@ -2641,12 +2661,16 @@ done: + } else { + channel = APCS_DEFAULT_2G_CH; + } +- ANDROID_ERROR(("ACS failed. Fall back to default channel (%d) \n", channel)); ++ ANDROID_ERROR(("%s: ACS failed." ++ " Fall back to default channel (%d) \n", __FUNCTION__, channel)); + } + done2: ++ ret = wldev_ioctl_set(dev, WLC_SET_BAND, &band_cur, sizeof(band_cur)); ++ if (ret < 0) ++ WL_ERR(("WLC_SET_BAND error %d\n", ret)); + if (spect > 0) { + if ((ret = wl_cfg80211_set_spect(dev, spect) < 0)) { +- ANDROID_ERROR(("ACS: error while setting spect\n")); ++ ANDROID_ERROR(("%s: ACS: error while setting spect\n", __FUNCTION__)); + } + } + +@@ -2660,7 +2684,7 @@ done2: + else + pos += snprintf(pos, total_len, "5g="); + pos += snprintf(pos, total_len, "%d", channel); +- ANDROID_INFO(("command result is %s \n", command)); ++ ANDROID_INFO(("%s: command result is %s \n", __FUNCTION__, command)); + return strlen(command); + } else { + return ret; +@@ -3754,8 +3778,7 @@ wl_cfg80211_p2plo_offload(struct net_device *dev, char *cmd, char* buf, int len) + } + #endif /* P2P_LISTEN_OFFLOADING */ + +-#ifdef WL_CFG80211 +-#ifdef BCM4359_CHIP ++#if defined(BCM4359_CHIP) && defined(WL_CFG80211) + int + wl_android_murx_bfe_cap(struct net_device *dev, int val) + { +@@ -3797,7 +3820,6 @@ wl_android_murx_bfe_cap(struct net_device *dev, int val) + return err; + } + #endif /* BCM4359_CHIP */ +-#endif + + #ifdef SUPPORT_AP_HIGHER_BEACONRATE + int +@@ -4203,6 +4225,40 @@ wl_android_make_hang_with_reason(struct net_device *dev, const char *string_num) + } + #endif /* DHD_HANG_SEND_UP_TEST */ + ++#ifdef WL_CFG80211 ++#ifdef WLMESH ++static int ++wl_android_set_rsdb_mode(struct net_device *dev, char *command, int total_len) ++{ ++ int ret; ++ wl_config_t rsdb_mode_cfg = {-1, 0}; ++ char smbuf[WLC_IOCTL_SMLEN]; ++ s32 val = 1; ++ ++ if (sscanf(command, "%*s %d", &rsdb_mode_cfg.config) != 1) { ++ DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__)); ++ return -1; ++ } ++ DHD_INFO(("%s : RSDB_MODE = %d\n", __FUNCTION__, rsdb_mode_cfg.config)); ++ ++ ret = wldev_ioctl_set(dev, WLC_DOWN, &val, sizeof(s32)); ++ if (ret < 0) ++ DHD_ERROR(("WLC_DOWN error %d\n", ret)); ++ ++ ret = wldev_iovar_setbuf(dev, "rsdb_mode", &rsdb_mode_cfg, sizeof(rsdb_mode_cfg), ++ smbuf, sizeof(smbuf), NULL); ++ if (ret < 0) ++ DHD_ERROR(("%s : set rsdb_mode error=%d\n", __FUNCTION__, ret)); ++ ++ ret = wldev_ioctl_set(dev, WLC_UP, &val, sizeof(s32)); ++ if (ret < 0) ++ DHD_ERROR(("WLC_UP error %d\n", ret)); ++ ++ return ret; ++} ++#endif /* WLMESH */ ++#endif /* WL_CFG80211 */ ++ + #ifdef SUPPORT_LQCM + static int + wl_android_lqcm_enable(struct net_device *net, int lqcm_enable) +@@ -4813,7 +4869,7 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len) + bytes_written = BCME_DISABLED; + #else /* DISABLE_SETBAND */ + uint band = *(command + strlen(CMD_SETBAND) + 1) - '0'; +- if (dhd_conf_get_band(dhd_get_pub(net)) != WLC_BAND_AUTO) { ++ if (dhd_conf_get_band(dhd_get_pub(net)) >= WLC_BAND_AUTO) { + printf("%s: Band is fixed in config.txt\n", __FUNCTION__); + } else + bytes_written = wl_cfg80211_set_if_band(net, band); +@@ -4824,6 +4880,14 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len) + bytes_written = wl_android_get_band(net, command, priv_cmd.total_len); + } + #ifdef WL_CFG80211 ++ else if (strnicmp(command, CMD_SET_CSA, strlen(CMD_SET_CSA)) == 0) { ++ bytes_written = wl_android_set_csa(net, command, priv_cmd.total_len); ++ } else if (strnicmp(command, CMD_80211_MODE, strlen(CMD_80211_MODE)) == 0) { ++ bytes_written = wl_android_get_80211_mode(net, command, priv_cmd.total_len); ++ } else if (strnicmp(command, CMD_CHANSPEC, strlen(CMD_CHANSPEC)) == 0) { ++ bytes_written = wl_android_get_chanspec(net, command, priv_cmd.total_len); ++ } ++#endif /* WL_CFG80211 */ + /* CUSTOMER_SET_COUNTRY feature is define for only GGSM model */ + else if (strnicmp(command, CMD_COUNTRY, strlen(CMD_COUNTRY)) == 0) { + /* +@@ -4858,14 +4922,6 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len) + #endif /* FCC_PWR_LIMIT_2G */ + #endif /* CUSTOMER_HW4_PRIVATE_CMD */ + } +- else if (strnicmp(command, CMD_SET_CSA, strlen(CMD_SET_CSA)) == 0) { +- bytes_written = wl_android_set_csa(net, command, priv_cmd.total_len); +- } else if (strnicmp(command, CMD_80211_MODE, strlen(CMD_80211_MODE)) == 0) { +- bytes_written = wl_android_get_80211_mode(net, command, priv_cmd.total_len); +- } else if (strnicmp(command, CMD_CHANSPEC, strlen(CMD_CHANSPEC)) == 0) { +- bytes_written = wl_android_get_chanspec(net, command, priv_cmd.total_len); +- } +-#endif /* WL_CFG80211 */ + else if (strnicmp(command, CMD_DATARATE, strlen(CMD_DATARATE)) == 0) { + bytes_written = wl_android_get_datarate(net, command, priv_cmd.total_len); + } else if (strnicmp(command, CMD_ASSOC_CLIENTS, strlen(CMD_ASSOC_CLIENTS)) == 0) { +@@ -4900,6 +4956,18 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len) + else if (strnicmp(command, CMD_P2P_DEV_ADDR, strlen(CMD_P2P_DEV_ADDR)) == 0) { + bytes_written = wl_android_get_p2p_dev_addr(net, command, priv_cmd.total_len); + } ++#ifdef WL_CFG80211 ++#ifdef WLMESH ++ else if (strnicmp(command, CMD_SAE_SET_PASSWORD, strlen(CMD_SAE_SET_PASSWORD)) == 0) { ++ int skip = strlen(CMD_SAE_SET_PASSWORD) + 1; ++ bytes_written = wl_cfg80211_set_sae_password(net, command + skip, ++ priv_cmd.total_len - skip); ++ } ++ else if (strnicmp(command, CMD_SET_RSDB_MODE, strlen(CMD_SET_RSDB_MODE)) == 0) { ++ bytes_written = wl_android_set_rsdb_mode(net, command, priv_cmd.total_len); ++ } ++#endif ++#endif /* WL_CFG80211 */ + else if (strnicmp(command, CMD_P2P_SET_NOA, strlen(CMD_P2P_SET_NOA)) == 0) { + int skip = strlen(CMD_P2P_SET_NOA) + 1; + bytes_written = wl_cfg80211_set_p2p_noa(net, command + skip, +@@ -5165,17 +5233,15 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len) + bytes_written = wl_cfg80211_get_sta_info(net, command, priv_cmd.total_len); + } + #endif /* CUSTOMER_HW4_PRIVATE_CMD */ +-#ifdef WL_CFG80211 + else if (strnicmp(command, CMD_MURX_BFE_CAP, + strlen(CMD_MURX_BFE_CAP)) == 0) { +-#ifdef BCM4359_CHIP ++#if defined(BCM4359_CHIP) && defined(WL_CFG80211) + uint val = *(command + strlen(CMD_MURX_BFE_CAP) + 1) - '0'; + bytes_written = wl_android_murx_bfe_cap(net, val); + #else + return BCME_UNSUPPORTED; + #endif /* BCM4359_CHIP */ + } +-#endif + #ifdef SUPPORT_AP_HIGHER_BEACONRATE + else if (strnicmp(command, CMD_GET_AP_BASICRATE, strlen(CMD_GET_AP_BASICRATE)) == 0) { + bytes_written = wl_android_get_ap_basicrate(net, command, priv_cmd.total_len); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.h +index fe3330406134..39fd6ff86efb 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android.h +@@ -104,9 +104,14 @@ int wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len); + + s32 wl_netlink_send_msg(int pid, int type, int seq, const void *data, size_t size); + #ifdef WL_EXT_IAPSTA +-int wl_android_ext_attach_netdev(struct net_device *net, uint8 bssidx); +-int wl_android_ext_dettach_netdev(void); +-void wl_android_ext_iapsta_disconnect_sta(struct net_device *dev, u32 channel); ++int wl_ext_iapsta_attach_netdev(struct net_device *net, uint8 bssidx); ++int wl_ext_iapsta_attach_name(struct net_device *net, uint8 bssidx); ++int wl_ext_iapsta_dettach_netdev(void); ++u32 wl_ext_iapsta_disconnect_sta(struct net_device *dev, u32 channel); ++int wl_ext_iapsta_alive_preinit(struct net_device *dev); ++int wl_ext_iapsta_alive_postinit(struct net_device *dev); ++int wl_ext_iapsta_event(struct net_device *dev, wl_event_msg_t *e, void* data); ++extern int op_mode; + #endif + int wl_android_ext_priv_cmd(struct net_device *net, char *command, int total_len, + int *bytes_written); +@@ -114,76 +119,6 @@ int wl_android_ext_priv_cmd(struct net_device *net, char *command, int total_len + #define strnicmp(str1, str2, len) strncasecmp((str1), (str2), (len)) + #endif + +-typedef enum IF_STATE { +- IF_STATE_INIT = 1, +- IF_STATE_DISALBE, +- IF_STATE_ENABLE +-} if_state_t; +- +-typedef enum APSTAMODE { +- ISTAONLY_MODE = 1, +- IAPONLY_MODE, +- IAPSTA_MODE, +- IDUALAP_MODE, +- IGOSTA_MODE, +- IGCSTA_MODE +-} apstamode_t; +- +-typedef enum IFMODE { +- ISTA_MODE = 1, +- IAP_MODE +-} ifmode_t; +- +-typedef enum BGNMODE { +- IEEE80211B = 1, +- IEEE80211G, +- IEEE80211BG, +- IEEE80211BGN, +- IEEE80211BGNAC +-} bgnmode_t; +- +-typedef enum AUTHMODE { +- AUTH_OPEN, +- AUTH_SHARED, +- AUTH_WPAPSK, +- AUTH_WPA2PSK, +- AUTH_WPAWPA2PSK +-} authmode_t; +- +-typedef enum ENCMODE { +- ENC_NONE, +- ENC_WEP, +- ENC_TKIP, +- ENC_AES, +- ENC_TKIPAES +-} encmode_t; +- +-/* i/f query */ +-typedef struct wl_if_info { +- struct net_device *dev; +- if_state_t ifstate; +- ifmode_t ifmode; +- uint bssidx; +- char ifname[IFNAMSIZ+1]; +- char ssid[DOT11_MAX_SSID_LEN]; +- struct ether_addr bssid; +- bgnmode_t bgnmode; +- int hidden; +- int maxassoc; +- uint16 channel; +- authmode_t amode; +- encmode_t emode; +- char key[100]; +-} wl_apsta_if_t; +- +-typedef struct wl_apsta_params { +- struct wl_if_info pif; // primary device +- struct wl_if_info vif; // virtual device +- int ioctl_ver; +- bool init; +- apstamode_t apstamode; +-} wl_apsta_params_t; +- + /* hostap mac mode */ + #define MACLIST_MODE_DISABLED 0 + #define MACLIST_MODE_DENY 1 +@@ -224,6 +159,10 @@ int wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct macli + #define REPEATED_SCAN_RESULT_CNT 1 + #endif + ++#if defined(RSSIAVG) || defined(RSSIOFFSET) ++extern int g_wifi_on; ++#endif ++ + #if defined(RSSIAVG) + #define RSSIAVG_LEN (4*REPEATED_SCAN_RESULT_CNT) + #define RSSICACHE_TIMEOUT 15 +@@ -286,4 +225,12 @@ void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, + wl_scan_results_t *ss_list); + void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl); + #endif ++int wl_ext_get_best_channel(struct net_device *net, ++#if defined(BSSCACHE) ++ wl_bss_cache_ctrl_t *bss_cache_ctrl, ++#else ++ struct wl_scan_results *bss_list, ++#endif ++ int *best_2g_ch, int *best_5g_ch ++); + #endif /* _wl_android_ */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c +index e510c241f536..6e7ad34812dc 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c +@@ -1,151 +1,279 @@ + /* SPDX-License-Identifier: GPL-2.0 */ +- +- +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define htod32(i) i +-#define htod16(i) i +-#define dtoh32(i) i +-#define dtoh16(i) i +-#define htodchanspec(i) i +-#define dtohchanspec(i) i +-#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) +- +-#define CMD_CHANNEL "CHANNEL" +-#define CMD_CHANNELS "CHANNELS" +-#define CMD_ROAM_TRIGGER "ROAM_TRIGGER" +-#define CMD_KEEP_ALIVE "KEEP_ALIVE" +-#define CMD_PM "PM" +-#define CMD_MONITOR "MONITOR" +-#define CMD_SET_SUSPEND_BCN_LI_DTIM "SET_SUSPEND_BCN_LI_DTIM" +- +-#ifdef WL_EXT_IAPSTA +-#define CMD_IAPSTA_INIT "IAPSTA_INIT" +-#define CMD_IAPSTA_CONFIG "IAPSTA_CONFIG" +-#define CMD_IAPSTA_ENABLE "IAPSTA_ENABLE" +-#define CMD_IAPSTA_DISABLE "IAPSTA_DISABLE" +-#ifdef PROP_TXSTATUS +-#ifdef PROP_TXSTATUS_VSDB +-#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#ifdef WL_CFG80211 ++#include ++#endif ++#ifdef WL_ESCAN ++#include ++#endif ++ ++#ifndef WL_CFG80211 ++#define htod32(i) i ++#define htod16(i) i ++#define dtoh32(i) i ++#define dtoh16(i) i ++#define htodchanspec(i) i ++#define dtohchanspec(i) i ++#define IEEE80211_BAND_2GHZ 0 ++#define IEEE80211_BAND_5GHZ 1 ++#define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20 ++#define WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS 320 ++#define WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400 ++#endif ++#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) ++ ++#ifndef IW_CUSTOM_MAX ++#define IW_CUSTOM_MAX 256 /* size of extra buffer used for translation of events */ ++#endif /* IW_CUSTOM_MAX */ ++ ++#define CMD_CHANNEL "CHANNEL" ++#define CMD_CHANNELS "CHANNELS" ++#define CMD_ROAM_TRIGGER "ROAM_TRIGGER" ++#define CMD_KEEP_ALIVE "KEEP_ALIVE" ++#define CMD_PM "PM" ++#define CMD_MONITOR "MONITOR" ++#define CMD_SET_SUSPEND_BCN_LI_DTIM "SET_SUSPEND_BCN_LI_DTIM" ++ ++#ifdef WL_EXT_IAPSTA ++#include ++#define CMD_IAPSTA_INIT "IAPSTA_INIT" ++#define CMD_IAPSTA_CONFIG "IAPSTA_CONFIG" ++#define CMD_IAPSTA_ENABLE "IAPSTA_ENABLE" ++#define CMD_IAPSTA_DISABLE "IAPSTA_DISABLE" ++#define CMD_ISAM_INIT "ISAM_INIT" ++#define CMD_ISAM_CONFIG "ISAM_CONFIG" ++#define CMD_ISAM_ENABLE "ISAM_ENABLE" ++#define CMD_ISAM_DISABLE "ISAM_DISABLE" ++#define CMD_ISAM_DUMP "ISAM_DUMP" ++#ifdef PROP_TXSTATUS ++#ifdef PROP_TXSTATUS_VSDB ++#include + extern int disable_proptx; +-#endif /* PROP_TXSTATUS_VSDB */ +-#endif +-#endif +-#ifdef IDHCP +-#define CMD_DHCPC_ENABLE "DHCPC_ENABLE" +-#define CMD_DHCPC_DUMP "DHCPC_DUMP" +-#endif +-#define CMD_WL "WL" +- +-#define IEEE80211_BAND_2GHZ 0 +-#define IEEE80211_BAND_5GHZ 1 +- +-int wl_ext_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len, u32 set) +-{ +- int ret; +- +- ret = wldev_ioctl(dev, cmd, arg, len, set); +- if (ret) +- ANDROID_ERROR(("%s: cmd=%d ret=%d\n", __FUNCTION__, cmd, ret)); +- return ret; +-} +- +-int wl_ext_iovar_getint(struct net_device *dev, s8 *iovar, s32 *val) +-{ +- int ret; +- +- ret = wldev_iovar_getint(dev, iovar, val); +- if (ret) +- ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar, ret)); +- +- return ret; +-} +- +-int wl_ext_iovar_setint(struct net_device *dev, s8 *iovar, s32 val) +-{ +- int ret; +- +- ret = wldev_iovar_setint(dev, iovar, val); +- if (ret) +- ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar, ret)); +- +- return ret; +-} +- +-int wl_ext_iovar_getbuf(struct net_device *dev, s8 *iovar_name, +- void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync) +-{ +- int ret; +- +- ret = wldev_iovar_getbuf(dev, iovar_name, param, paramlen, buf, buflen, buf_sync); +- if (ret != 0) +- ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar_name, ret)); +- +- return ret; +-} +- +-int wl_ext_iovar_setbuf(struct net_device *dev, s8 *iovar_name, +- void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync) +-{ +- int ret; +- +- ret = wldev_iovar_setbuf(dev, iovar_name, param, paramlen, buf, buflen, buf_sync); +- if (ret != 0) +- ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar_name, ret)); +- +- return ret; +-} +- +-#ifdef WL_EXT_IAPSTA +-int wl_ext_iovar_setbuf_bsscfg(struct net_device *dev, s8 *iovar_name, +- void *param, s32 paramlen, void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync) +-{ +- int ret; +- +- ret = wldev_iovar_setbuf_bsscfg(dev, iovar_name, param, paramlen, +- buf, buflen, bsscfg_idx, buf_sync); +- if (ret < 0) +- ANDROID_ERROR(("%s: iovar_name=%s ret=%d\n", __FUNCTION__, iovar_name, ret)); +- +- return ret; +-} +- +-int wl_ext_iovar_getbuf_bsscfg(struct net_device *dev, s8 *iovar_name, +- void *param, s32 paramlen, void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync) +-{ +- int ret; +- +- ret = wldev_iovar_getbuf_bsscfg(dev, iovar_name, param, paramlen, +- buf, buflen, bsscfg_idx, buf_sync); +- if (ret < 0) +- ANDROID_ERROR(("%s: iovar_name=%s ret=%d\n", __FUNCTION__, iovar_name, ret)); +- +- return ret; +-} +-#endif ++#endif /* PROP_TXSTATUS_VSDB */ ++#endif ++#endif ++#ifdef IDHCP ++#define CMD_DHCPC_ENABLE "DHCPC_ENABLE" ++#define CMD_DHCPC_DUMP "DHCPC_DUMP" ++#endif ++#define CMD_AUTOCHANNEL "AUTOCHANNEL" ++#define CMD_WL "WL" ++ ++int wl_ext_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len, u32 set) ++{ ++ int ret; ++ ++ ret = wldev_ioctl(dev, cmd, arg, len, set); ++ if (ret) ++ ANDROID_ERROR(("%s: cmd=%d ret=%d\n", __FUNCTION__, cmd, ret)); ++ return ret; ++} ++ ++int wl_ext_iovar_getint(struct net_device *dev, s8 *iovar, s32 *val) ++{ ++ int ret; ++ ++ ret = wldev_iovar_getint(dev, iovar, val); ++ if (ret) ++ ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar, ret)); ++ ++ return ret; ++} ++ ++int wl_ext_iovar_setint(struct net_device *dev, s8 *iovar, s32 val) ++{ ++ int ret; ++ ++ ret = wldev_iovar_setint(dev, iovar, val); ++ if (ret) ++ ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar, ret)); ++ ++ return ret; ++} ++ ++int wl_ext_iovar_getbuf(struct net_device *dev, s8 *iovar_name, ++ void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync) ++{ ++ int ret; ++ ++ ret = wldev_iovar_getbuf(dev, iovar_name, param, paramlen, buf, buflen, buf_sync); ++ if (ret != 0) ++ ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar_name, ret)); ++ ++ return ret; ++} ++ ++int wl_ext_iovar_setbuf(struct net_device *dev, s8 *iovar_name, ++ void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync) ++{ ++ int ret; ++ ++ ret = wldev_iovar_setbuf(dev, iovar_name, param, paramlen, buf, buflen, buf_sync); ++ if (ret != 0) ++ ANDROID_ERROR(("%s: iovar=%s, ret=%d\n", __FUNCTION__, iovar_name, ret)); ++ ++ return ret; ++} ++ ++#ifdef WL_EXT_IAPSTA ++typedef enum IF_STATE { ++ IF_STATE_INIT = 1, ++ IF_STATE_DISALBE, ++ IF_STATE_ENABLE ++} if_state_t; ++ ++typedef enum APSTAMODE { ++ ISTAONLY_MODE = 1, ++ IAPONLY_MODE, ++ IAPSTA_MODE, ++ IDUALAP_MODE, ++ IMESHONLY_MODE, ++ IMESHSTA_MODE, ++ IMESHAP_MODE, ++ IMESHAPSTA_MODE, ++ IMESHAPAP_MODE, ++ IGOSTA_MODE ++} apstamode_t; ++ ++typedef enum IFMODE { ++ ISTA_MODE = 1, ++ IAP_MODE, ++ IMESH_MODE ++} ifmode_t; ++ ++typedef enum BGNMODE { ++ IEEE80211B = 1, ++ IEEE80211G, ++ IEEE80211BG, ++ IEEE80211BGN, ++ IEEE80211BGNAC ++} bgnmode_t; ++ ++typedef enum AUTHMODE { ++ AUTH_OPEN, ++ AUTH_SHARED, ++ AUTH_WPAPSK, ++ AUTH_WPA2PSK, ++ AUTH_WPAWPA2PSK, ++ AUTH_SAE ++} authmode_t; ++ ++typedef enum ENCMODE { ++ ENC_NONE, ++ ENC_WEP, ++ ENC_TKIP, ++ ENC_AES, ++ ENC_TKIPAES ++} encmode_t; ++ ++enum wl_if_list { ++ IF_PIF, ++ IF_VIF, ++ IF_VIF2, ++ MAX_IF_NUM ++}; ++ ++typedef enum WL_PRIO { ++ PRIO_AP, ++ PRIO_MESH, ++ PRIO_STA ++}wl_prio_t; ++ ++typedef struct wl_if_info { ++ struct net_device *dev; ++ if_state_t ifstate; ++ ifmode_t ifmode; ++ char prefix; ++ wl_prio_t prio; ++ uint bssidx; ++ char ifname[IFNAMSIZ+1]; ++ char ssid[DOT11_MAX_SSID_LEN]; ++ struct ether_addr bssid; ++ bgnmode_t bgnmode; ++ int hidden; ++ int maxassoc; ++ uint16 channel; ++ authmode_t amode; ++ encmode_t emode; ++ char key[100]; ++} wl_if_info_t; ++ ++#define CSA_FW_BIT (1<<0) ++#define CSA_DRV_BIT (1<<1) ++ ++typedef struct wl_apsta_params { ++ struct wl_if_info if_info[MAX_IF_NUM]; ++ int ioctl_ver; ++ bool init; ++ bool rsdb; ++ bool vsdb; ++ uint csa; ++ apstamode_t apstamode; ++ bool netif_change; ++ wait_queue_head_t netif_change_event; ++} wl_apsta_params_t; ++ ++static int wl_ext_iapsta_enable(struct net_device *dev, char *command, int total_len); ++int wl_ext_iovar_setbuf_bsscfg(struct net_device *dev, s8 *iovar_name, ++ void *param, s32 paramlen, void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync) ++{ ++ int ret; ++ ++ ret = wldev_iovar_setbuf_bsscfg(dev, iovar_name, param, paramlen, ++ buf, buflen, bsscfg_idx, buf_sync); ++ if (ret < 0) ++ ANDROID_ERROR(("%s: iovar_name=%s ret=%d\n", __FUNCTION__, iovar_name, ret)); ++ ++ return ret; ++} ++ ++int wl_ext_iovar_getbuf_bsscfg(struct net_device *dev, s8 *iovar_name, ++ void *param, s32 paramlen, void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync) ++{ ++ int ret; ++ ++ ret = wldev_iovar_getbuf_bsscfg(dev, iovar_name, param, paramlen, ++ buf, buflen, bsscfg_idx, buf_sync); ++ if (ret < 0) ++ ANDROID_ERROR(("%s: iovar_name=%s ret=%d\n", __FUNCTION__, iovar_name, ret)); ++ ++ return ret; ++} ++#endif + + /* Return a legacy chanspec given a new chanspec + * Returns INVCHANSPEC on error + */ + static chanspec_t +-wl_ext_chspec_to_legacy(chanspec_t chspec) ++wl_ext_chspec_to_legacy(chanspec_t chspec) + { + chanspec_t lchspec; + + if (wf_chspec_malformed(chspec)) { +- ANDROID_ERROR(("wl_ext_chspec_to_legacy: input chanspec (0x%04X) malformed\n", ++ ANDROID_ERROR(("wl_ext_chspec_to_legacy: input chanspec (0x%04X) malformed\n", + chspec)); + return INVCHANSPEC; + } +@@ -174,25 +302,25 @@ wl_ext_chspec_to_legacy(chanspec_t chspec) + } else { + /* cannot express the bandwidth */ + char chanbuf[CHANSPEC_STR_LEN]; +- ANDROID_ERROR(( +- "wl_ext_chspec_to_legacy: unable to convert chanspec %s (0x%04X) " ++ ANDROID_ERROR(( ++ "wl_ext_chspec_to_legacy: unable to convert chanspec %s (0x%04X) " + "to pre-11ac format\n", + wf_chspec_ntoa(chspec, chanbuf), chspec)); + return INVCHANSPEC; + } + + return lchspec; +-} ++} + + /* given a chanspec value, do the endian and chanspec version conversion to + * a chanspec_t value + * Returns INVCHANSPEC on error + */ + static chanspec_t +-wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec) ++wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec) + { +- if (ioctl_ver == 1) { +- chanspec = wl_ext_chspec_to_legacy(chanspec); ++ if (ioctl_ver == 1) { ++ chanspec = wl_ext_chspec_to_legacy(chanspec); + if (chanspec == INVCHANSPEC) { + return chanspec; + } +@@ -200,99 +328,148 @@ wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec) + chanspec = htodchanspec(chanspec); + + return chanspec; +-} +- +-static int +-wl_ext_get_ioctl_ver(struct net_device *dev, int *ioctl_ver) +-{ +- int ret = 0; +- s32 val = 0; +- +- val = 1; +- ret = wl_ext_ioctl(dev, WLC_GET_VERSION, &val, sizeof(val), 0); +- if (ret) { +- ANDROID_ERROR(("WLC_GET_VERSION failed, err=%d\n", ret)); +- return ret; +- } +- val = dtoh32(val); +- if (val != WLC_IOCTL_VERSION && val != 1) { +- ANDROID_ERROR(("Version mismatch, please upgrade. Got %d, expected %d or 1\n", +- val, WLC_IOCTL_VERSION)); +- return BCME_VERSION; +- } +- *ioctl_ver = val; +- +- return ret; +-} +- +-static int +-wl_ext_set_chanspec(struct net_device *dev, uint16 channel) +-{ +- s32 _chan = channel; ++} ++ ++#if defined(WL_EXT_IAPSTA) || defined(WL_CFG80211) || defined(WL_ESCAN) ++static chanspec_t ++wl_ext_chspec_from_legacy(chanspec_t legacy_chspec) ++{ ++ chanspec_t chspec; ++ ++ /* get the channel number */ ++ chspec = LCHSPEC_CHANNEL(legacy_chspec); ++ ++ /* convert the band */ ++ if (LCHSPEC_IS2G(legacy_chspec)) { ++ chspec |= WL_CHANSPEC_BAND_2G; ++ } else { ++ chspec |= WL_CHANSPEC_BAND_5G; ++ } ++ ++ /* convert the bw and sideband */ ++ if (LCHSPEC_IS20(legacy_chspec)) { ++ chspec |= WL_CHANSPEC_BW_20; ++ } else { ++ chspec |= WL_CHANSPEC_BW_40; ++ if (LCHSPEC_CTL_SB(legacy_chspec) == WL_LCHANSPEC_CTL_SB_LOWER) { ++ chspec |= WL_CHANSPEC_CTL_SB_L; ++ } else { ++ chspec |= WL_CHANSPEC_CTL_SB_U; ++ } ++ } ++ ++ if (wf_chspec_malformed(chspec)) { ++ ANDROID_ERROR(("wl_ext_chspec_from_legacy: output chanspec (0x%04X) malformed\n", ++ chspec)); ++ return INVCHANSPEC; ++ } ++ ++ return chspec; ++} ++ ++static chanspec_t ++wl_ext_chspec_driver_to_host(int ioctl_ver, chanspec_t chanspec) ++{ ++ chanspec = dtohchanspec(chanspec); ++ if (ioctl_ver == 1) { ++ chanspec = wl_ext_chspec_from_legacy(chanspec); ++ } ++ ++ return chanspec; ++} ++#endif ++ ++static int ++wl_ext_get_ioctl_ver(struct net_device *dev, int *ioctl_ver) ++{ ++ int ret = 0; ++ s32 val = 0; ++ ++ val = 1; ++ ret = wl_ext_ioctl(dev, WLC_GET_VERSION, &val, sizeof(val), 0); ++ if (ret) { ++ ANDROID_ERROR(("WLC_GET_VERSION failed, err=%d\n", ret)); ++ return ret; ++ } ++ val = dtoh32(val); ++ if (val != WLC_IOCTL_VERSION && val != 1) { ++ ANDROID_ERROR(("Version mismatch, please upgrade. Got %d, expected %d or 1\n", ++ val, WLC_IOCTL_VERSION)); ++ return BCME_VERSION; ++ } ++ *ioctl_ver = val; ++ ++ return ret; ++} ++ ++static int ++wl_ext_set_chanspec(struct net_device *dev, uint16 channel, chanspec_t *ret_chspec) ++{ ++ s32 _chan = channel; + chanspec_t chspec = 0; +- chanspec_t fw_chspec = 0; +- u32 bw = WL_CHANSPEC_BW_20; ++ chanspec_t fw_chspec = 0; ++ u32 bw = WL_CHANSPEC_BW_20; + s32 err = BCME_OK; +- s32 bw_cap = 0; +- s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ s32 bw_cap = 0; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; + struct { + u32 band; + u32 bw_cap; +- } param = {0, 0}; +- uint band; +- int ioctl_ver = 0; +- +- if (_chan <= CH_MAX_2G_CHANNEL) +- band = IEEE80211_BAND_2GHZ; +- else +- band = IEEE80211_BAND_5GHZ; +- wl_ext_get_ioctl_ver(dev, &ioctl_ver); +- +- if (band == IEEE80211_BAND_5GHZ) { ++ } param = {0, 0}; ++ uint band; ++ int ioctl_ver = 0; ++ ++ if (_chan <= CH_MAX_2G_CHANNEL) ++ band = IEEE80211_BAND_2GHZ; ++ else ++ band = IEEE80211_BAND_5GHZ; ++ wl_ext_get_ioctl_ver(dev, &ioctl_ver); ++ ++ if (band == IEEE80211_BAND_5GHZ) { + param.band = WLC_BAND_5G; + err = wldev_iovar_getbuf(dev, "bw_cap", ¶m, sizeof(param), +- iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); + if (err) { + if (err != BCME_UNSUPPORTED) { +- ANDROID_ERROR(("bw_cap failed, %d\n", err)); ++ ANDROID_ERROR(("bw_cap failed, %d\n", err)); + return err; + } else { + err = wldev_iovar_getint(dev, "mimo_bw_cap", &bw_cap); + if (err) { +- ANDROID_ERROR(("error get mimo_bw_cap (%d)\n", err)); ++ ANDROID_ERROR(("error get mimo_bw_cap (%d)\n", err)); + } + if (bw_cap != WLC_N_BW_20ALL) + bw = WL_CHANSPEC_BW_40; + } + } else { +- if (WL_BW_CAP_80MHZ(iovar_buf[0])) ++ if (WL_BW_CAP_80MHZ(iovar_buf[0])) + bw = WL_CHANSPEC_BW_80; +- else if (WL_BW_CAP_40MHZ(iovar_buf[0])) ++ else if (WL_BW_CAP_40MHZ(iovar_buf[0])) + bw = WL_CHANSPEC_BW_40; + else + bw = WL_CHANSPEC_BW_20; + +- } +- } +- else if (band == IEEE80211_BAND_2GHZ) +- bw = WL_CHANSPEC_BW_20; +- ++ } ++ } ++ else if (band == IEEE80211_BAND_2GHZ) ++ bw = WL_CHANSPEC_BW_20; ++ + set_channel: + chspec = wf_channel2chspec(_chan, bw); + if (wf_chspec_valid(chspec)) { +- fw_chspec = wl_ext_chspec_host_to_driver(ioctl_ver, chspec); ++ fw_chspec = wl_ext_chspec_host_to_driver(ioctl_ver, chspec); + if (fw_chspec != INVCHANSPEC) { +- if ((err = wldev_iovar_setint(dev, "chanspec", fw_chspec)) == BCME_BADCHAN) { ++ if ((err = wldev_iovar_setint(dev, "chanspec", fw_chspec)) == BCME_BADCHAN) { + if (bw == WL_CHANSPEC_BW_80) +- goto change_bw; +- wl_ext_ioctl(dev, WLC_SET_CHANNEL, &_chan, sizeof(_chan), 1); +- printf("%s: channel %d\n", __FUNCTION__, _chan); ++ goto change_bw; ++ wl_ext_ioctl(dev, WLC_SET_CHANNEL, &_chan, sizeof(_chan), 1); ++ printf("%s: channel %d\n", __FUNCTION__, _chan); + } else if (err) { +- ANDROID_ERROR(("%s: failed to set chanspec error %d\n", __FUNCTION__, err)); +- } else +- printf("%s: channel %d, 0x%x\n", __FUNCTION__, channel, chspec); ++ ANDROID_ERROR(("%s: failed to set chanspec error %d\n", __FUNCTION__, err)); ++ } else ++ printf("%s: channel %d, 0x%x\n", __FUNCTION__, channel, chspec); + } else { +- ANDROID_ERROR(("%s: failed to convert host chanspec to fw chanspec\n", __FUNCTION__)); ++ ANDROID_ERROR(("%s: failed to convert host chanspec to fw chanspec\n", __FUNCTION__)); + err = BCME_ERROR; + } + } else { +@@ -305,1875 +482,3280 @@ change_bw: + bw = 0; + if (bw) + goto set_channel; +- ANDROID_ERROR(("%s: Invalid chanspec 0x%x\n", __FUNCTION__, chspec)); ++ ANDROID_ERROR(("%s: Invalid chanspec 0x%x\n", __FUNCTION__, chspec)); + err = BCME_ERROR; +- } +- +- return err; +-} +- +-int +-wl_ext_channel(struct net_device *dev, char* command, int total_len) +-{ +- int ret; +- int channel=0; +- channel_info_t ci; +- int bytes_written = 0; +- +- ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); +- +- sscanf(command, "%*s %d", &channel); +- +- if (channel > 0) { +- ret = wl_ext_set_chanspec(dev, channel); +- } else { +- if (!(ret = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(channel_info_t), FALSE))) { +- ANDROID_TRACE(("hw_channel %d\n", ci.hw_channel)); +- ANDROID_TRACE(("target_channel %d\n", ci.target_channel)); +- ANDROID_TRACE(("scan_channel %d\n", ci.scan_channel)); +- bytes_written = snprintf(command, sizeof(channel_info_t)+2, "channel %d", ci.hw_channel); +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- } +- +- return ret; +-} +- +-int +-wl_ext_channels(struct net_device *dev, char* command, int total_len) +-{ +- int ret, i; +- int bytes_written = -1; +- u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; +- wl_uint32_list_t *list; +- +- ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); +- +- memset(valid_chan_list, 0, sizeof(valid_chan_list)); +- list = (wl_uint32_list_t *)(void *) valid_chan_list; +- list->count = htod32(WL_NUMCHANNELS); +- ret = wldev_ioctl(dev, WLC_GET_VALID_CHANNELS, valid_chan_list, sizeof(valid_chan_list), 0); +- if (ret<0) { +- ANDROID_ERROR(("%s: get channels failed with %d\n", __FUNCTION__, ret)); +- } else { +- bytes_written = snprintf(command, total_len, "channels"); +- for (i = 0; i < dtoh32(list->count); i++) { +- bytes_written += snprintf(command+bytes_written, total_len, " %d", dtoh32(list->element[i])); +- printf("%d ", dtoh32(list->element[i])); +- } +- printf("\n"); +- ret = bytes_written; +- } +- +- return ret; +-} +- +-int +-wl_ext_roam_trigger(struct net_device *dev, char* command, int total_len) +-{ +- int ret = 0; +- int roam_trigger[2] = {0, 0}; +- int trigger[2]= {0, 0}; +- int bytes_written=-1; +- +- sscanf(command, "%*s %10d", &roam_trigger[0]); +- +- if (roam_trigger[0]) { +- roam_trigger[1] = WLC_BAND_ALL; +- ret = wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 1); +- if (ret) +- ANDROID_ERROR(("WLC_SET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret)); +- } else { +- roam_trigger[1] = WLC_BAND_2G; +- ret = wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 0); +- if (!ret) +- trigger[0] = roam_trigger[0]; +- else +- ANDROID_ERROR(("2G WLC_GET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret)); +- +- roam_trigger[1] = WLC_BAND_5G; +- ret = wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 0); +- if (!ret) +- trigger[1] = roam_trigger[0]; +- else +- ANDROID_ERROR(("5G WLC_GET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret)); +- +- ANDROID_TRACE(("roam_trigger %d %d\n", trigger[0], trigger[1])); +- bytes_written = snprintf(command, total_len, "%d %d", trigger[0], trigger[1]); +- ret = bytes_written; +- } +- +- return ret; +-} +- +-static int +-wl_ext_pattern_atoh(char *src, char *dst) +-{ +- int i; +- if (strncmp(src, "0x", 2) != 0 && +- strncmp(src, "0X", 2) != 0) { +- ANDROID_ERROR(("Mask invalid format. Needs to start with 0x\n")); +- return -1; +- } +- src = src + 2; /* Skip past 0x */ +- if (strlen(src) % 2 != 0) { +- DHD_ERROR(("Mask invalid format. Needs to be of even length\n")); +- return -1; +- } +- for (i = 0; *src != '\0'; i++) { +- char num[3]; +- bcm_strncpy_s(num, sizeof(num), src, 2); +- num[2] = '\0'; +- dst[i] = (uint8)strtoul(num, NULL, 16); +- src += 2; +- } +- return i; +-} +- +-int +-wl_ext_keep_alive(struct net_device *dev, char *command, int total_len) +-{ +- wl_mkeep_alive_pkt_t *mkeep_alive_pktp; +- int ret = -1, i; +- int id, period=-1, len_bytes=0, buf_len=0; +- char data[200]="\0"; +- char buf[WLC_IOCTL_SMLEN]="\0", iovar_buf[WLC_IOCTL_SMLEN]="\0"; +- int bytes_written = -1; +- +- ANDROID_TRACE(("%s: command = %s\n", __FUNCTION__, command)); +- sscanf(command, "%*s %d %d %s", &id, &period, data); +- ANDROID_TRACE(("%s: id=%d, period=%d, data=%s\n", __FUNCTION__, id, period, data)); +- +- if (period >= 0) { +- mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *)buf; +- mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION); +- mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN); +- mkeep_alive_pktp->keep_alive_id = id; +- buf_len += WL_MKEEP_ALIVE_FIXED_LEN; +- mkeep_alive_pktp->period_msec = period; +- if (strlen(data)) { +- len_bytes = wl_ext_pattern_atoh(data, (char *) mkeep_alive_pktp->data); +- buf_len += len_bytes; +- } +- mkeep_alive_pktp->len_bytes = htod16(len_bytes); +- +- ret = wl_ext_iovar_setbuf(dev, "mkeep_alive", buf, buf_len, +- iovar_buf, sizeof(iovar_buf), NULL); +- } else { +- if (id < 0) +- id = 0; +- ret = wl_ext_iovar_getbuf(dev, "mkeep_alive", &id, sizeof(id), buf, sizeof(buf), NULL); +- if (ret) { +- goto exit; +- } else { +- mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) buf; +- printf("Id :%d\n" +- "Period (msec) :%d\n" +- "Length :%d\n" +- "Packet :0x", +- mkeep_alive_pktp->keep_alive_id, +- dtoh32(mkeep_alive_pktp->period_msec), +- dtoh16(mkeep_alive_pktp->len_bytes)); +- for (i=0; ilen_bytes; i++) { +- printf("%02x", mkeep_alive_pktp->data[i]); +- } +- printf("\n"); +- } +- bytes_written = snprintf(command, total_len, "mkeep_alive_period_msec %d ", dtoh32(mkeep_alive_pktp->period_msec)); +- bytes_written += snprintf(command+bytes_written, total_len, "0x"); +- for (i=0; ilen_bytes; i++) { +- bytes_written += snprintf(command+bytes_written, total_len, "%x", mkeep_alive_pktp->data[i]); +- } +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- +-exit: +- return ret; +-} +- +-int +-wl_ext_pm(struct net_device *dev, char *command, int total_len) +-{ +- int pm=-1, ret = -1; +- char *pm_local; +- int bytes_written=-1; +- +- ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); +- +- sscanf(command, "%*s %d", &pm); +- +- if (pm >= 0) { +- ret = wldev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm), FALSE); +- if (ret) +- ANDROID_ERROR(("WLC_SET_PM ERROR %d ret=%d\n", pm, ret)); +- } else { +- ret = wldev_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm), FALSE); +- if (!ret) { +- ANDROID_TRACE(("%s: PM = %d\n", __func__, pm)); +- if (pm == PM_OFF) +- pm_local = "PM_OFF"; +- else if(pm == PM_MAX) +- pm_local = "PM_MAX"; +- else if(pm == PM_FAST) +- pm_local = "PM_FAST"; +- else { +- pm = 0; +- pm_local = "Invalid"; +- } +- bytes_written = snprintf(command, total_len, "PM %s", pm_local); +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- } +- +- return ret; +-} +- +-static int +-wl_ext_monitor(struct net_device *dev, char *command, int total_len) +-{ +- int val, ret = -1; +- int bytes_written=-1; +- +- sscanf(command, "%*s %d", &val); +- +- if (val >=0) { +- ret = wldev_ioctl(dev, WLC_SET_MONITOR, &val, sizeof(int), 1); +- if (ret) +- ANDROID_ERROR(("WLC_SET_MONITOR ERROR %d ret=%d\n", val, ret)); +- } else { +- ret = wldev_ioctl(dev, WLC_GET_MONITOR, &val, sizeof(val), FALSE); +- if (!ret) { +- ANDROID_TRACE(("%s: monitor = %d\n", __FUNCTION__, val)); +- bytes_written = snprintf(command, total_len, "monitor %d", val); +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- } +- +- return ret; +-} +- +-#ifdef WL_EXT_IAPSTA +-struct wl_apsta_params g_apsta_params; +-static int +-wl_ext_parse_wep(char *key, struct wl_wsec_key *wsec_key) +-{ +- char hex[] = "XX"; +- unsigned char *data = wsec_key->data; +- char *keystr = key; +- +- switch (strlen(keystr)) { +- case 5: +- case 13: +- case 16: +- wsec_key->len = strlen(keystr); +- memcpy(data, keystr, wsec_key->len + 1); +- break; +- case 12: +- case 28: +- case 34: +- case 66: +- /* strip leading 0x */ +- if (!strnicmp(keystr, "0x", 2)) +- keystr += 2; +- else +- return -1; +- /* fall through */ +- case 10: +- case 26: +- case 32: +- case 64: +- wsec_key->len = strlen(keystr) / 2; +- while (*keystr) { +- strncpy(hex, keystr, 2); +- *data++ = (char) strtoul(hex, NULL, 16); +- keystr += 2; +- } +- break; +- default: +- return -1; +- } +- +- switch (wsec_key->len) { +- case 5: +- wsec_key->algo = CRYPTO_ALGO_WEP1; +- break; +- case 13: +- wsec_key->algo = CRYPTO_ALGO_WEP128; +- break; +- case 16: +- /* default to AES-CCM */ +- wsec_key->algo = CRYPTO_ALGO_AES_CCM; +- break; +- case 32: +- wsec_key->algo = CRYPTO_ALGO_TKIP; +- break; +- default: +- return -1; +- } +- +- /* Set as primary wsec_key by default */ +- wsec_key->flags |= WL_PRIMARY_KEY; +- +- return 0; +-} +- +-static int +-wl_ext_set_bgnmode(struct wl_if_info *cur_if) +-{ +- struct net_device *dev = cur_if->dev; +- bgnmode_t bgnmode = cur_if->bgnmode; +- int val; +- +- if (bgnmode == 0) +- return 0; +- +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- if (bgnmode == IEEE80211B) { +- wl_ext_iovar_setint(dev, "nmode", 0); +- val = 0; +- wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); +- ANDROID_TRACE(("%s: Network mode: B only\n", __FUNCTION__)); +- } else if (bgnmode == IEEE80211G) { +- wl_ext_iovar_setint(dev, "nmode", 0); +- val = 2; +- wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); +- ANDROID_TRACE(("%s: Network mode: G only\n", __FUNCTION__)); +- } else if (bgnmode == IEEE80211BG) { +- wl_ext_iovar_setint(dev, "nmode", 0); +- val = 1; +- wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); +- ANDROID_TRACE(("%s: Network mode: : B/G mixed\n", __FUNCTION__)); +- } else if (bgnmode == IEEE80211BGN) { +- wl_ext_iovar_setint(dev, "nmode", 0); +- wl_ext_iovar_setint(dev, "nmode", 1); +- wl_ext_iovar_setint(dev, "vhtmode", 0); +- val = 1; +- wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); +- ANDROID_TRACE(("%s: Network mode: : B/G/N mixed\n", __FUNCTION__)); +- } else if (bgnmode == IEEE80211BGNAC) { +- wl_ext_iovar_setint(dev, "nmode", 0); +- wl_ext_iovar_setint(dev, "nmode", 1); +- wl_ext_iovar_setint(dev, "vhtmode", 1); +- val = 1; +- wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); +- ANDROID_TRACE(("%s: Network mode: : B/G/N/AC mixed\n", __FUNCTION__)); +- } +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- +- return 0; +-} +- +-static int +-wl_ext_set_amode(struct wl_if_info *cur_if, struct wl_apsta_params *apsta_params) +-{ +- struct net_device *dev = cur_if->dev; +- authmode_t amode = cur_if->amode; +- int auth=0, wpa_auth=0; +- +- if (amode == AUTH_OPEN) { +- auth = 0; +- wpa_auth = 0; +- ANDROID_TRACE(("%s: Authentication: Open System\n", __FUNCTION__)); +- } else if (amode == AUTH_SHARED) { +- auth = 1; +- wpa_auth = 0; +- ANDROID_TRACE(("%s: Authentication: Shared Key\n", __FUNCTION__)); +- } else if (amode == AUTH_WPAPSK) { +- auth = 0; +- wpa_auth = 4; +- ANDROID_TRACE(("%s: Authentication: WPA-PSK\n", __FUNCTION__)); +- } else if (amode == AUTH_WPA2PSK) { +- auth = 0; +- wpa_auth = 128; +- ANDROID_TRACE(("%s: Authentication: WPA2-PSK\n", __FUNCTION__)); +- } else if (amode == AUTH_WPAWPA2PSK) { +- auth = 0; +- wpa_auth = 132; +- ANDROID_TRACE(("%s: Authentication: WPA/WPA2-PSK\n", __FUNCTION__)); +- } +- wl_ext_iovar_setint(dev, "auth", auth); +- +- wl_ext_iovar_setint(dev, "wpa_auth", wpa_auth); +- +- return 0; +-} +- +-static int +-wl_ext_set_emode(struct wl_if_info *cur_if, struct wl_apsta_params *apsta_params) +-{ +- struct net_device *dev = cur_if->dev; +- int wsec=0; +- struct wl_wsec_key wsec_key; +- wsec_pmk_t psk; +- encmode_t emode = cur_if->emode; +- char *key = cur_if->key; +- +- memset(&wsec_key, 0, sizeof(wsec_key)); +- memset(&psk, 0, sizeof(psk)); +- if (emode == ENC_NONE) { +- wsec = 0; +- ANDROID_TRACE(("%s: Encryption: No securiy\n", __FUNCTION__)); +- } else if (emode == ENC_WEP) { +- wsec = 1; +- wl_ext_parse_wep(key, &wsec_key); +- ANDROID_TRACE(("%s: Encryption: WEP\n", __FUNCTION__)); +- ANDROID_TRACE(("%s: Key: %s\n", __FUNCTION__, wsec_key.data)); +- } else if (emode == ENC_TKIP) { +- wsec = 2; +- psk.key_len = strlen(key); +- psk.flags = WSEC_PASSPHRASE; +- memcpy(psk.key, key, strlen(key)); +- ANDROID_TRACE(("%s: Encryption: TKIP\n", __FUNCTION__)); +- ANDROID_TRACE(("%s: Key: %s\n", __FUNCTION__, psk.key)); +- } else if (emode == ENC_AES) { +- wsec = 4; +- psk.key_len = strlen(key); +- psk.flags = WSEC_PASSPHRASE; +- memcpy(psk.key, key, strlen(key)); +- ANDROID_TRACE(("%s: Encryption: AES\n", __FUNCTION__)); +- ANDROID_TRACE(("%s: Key: %s\n", __FUNCTION__, psk.key)); +- } else if (emode == ENC_TKIPAES) { +- wsec = 6; +- psk.key_len = strlen(key); +- psk.flags = WSEC_PASSPHRASE; +- memcpy(psk.key, key, strlen(key)); +- ANDROID_TRACE(("%s: Encryption: TKIP/AES\n", __FUNCTION__)); +- ANDROID_TRACE(("%s: Key: %s\n", __FUNCTION__, psk.key)); +- } +- +- wl_ext_iovar_setint(dev, "wsec", wsec); +- +- if (wsec == 1) { +- wl_ext_ioctl(dev, WLC_SET_KEY, &wsec_key, sizeof(wsec_key), 1); +- } else if (emode == ENC_TKIP || emode == ENC_AES || emode == ENC_TKIPAES) { +- if (dev) { +- if (cur_if->ifmode == ISTA_MODE) +- wl_ext_iovar_setint(dev, "sup_wpa", 1); +- wl_ext_ioctl(dev, WLC_SET_WSEC_PMK, &psk, sizeof(psk), 1); +- } else { +- ANDROID_ERROR(("%s: apdev is null\n", __FUNCTION__)); +- } +- } +- +- return 0; +-} +- +-static int +-wl_ext_iapsta_init(struct net_device *dev, char *command, int total_len) +-{ +- s32 val = 0; +- char *pch, *pick_tmp, *param; +- wlc_ssid_t ssid = { 0, {0} }; +- s8 iovar_buf[WLC_IOCTL_SMLEN]; +- struct wl_apsta_params *apsta_params = &g_apsta_params; +- wl_interface_create_t iface; +- struct dhd_pub *dhd; +- wl_p2p_if_t ifreq; +- +- if (apsta_params->init) { +- ANDROID_ERROR(("%s: don't init twice\n", __FUNCTION__)); +- return -1; +- } +- +- dhd = dhd_get_pub(dev); +- memset(apsta_params, 0, sizeof(struct wl_apsta_params)); +- +- ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); +- +- pick_tmp = command; +- param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_init +- param = bcmstrtok(&pick_tmp, " ", 0); +- while (param != NULL) { +- if (!strcmp(param, "mode")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) { +- if (!strcmp(pch, "sta")) { +- apsta_params->apstamode = ISTAONLY_MODE; +- } else if (!strcmp(pch, "ap")) { +- apsta_params->apstamode = IAPONLY_MODE; +- } else if (!strcmp(pch, "apsta")) { +- apsta_params->apstamode = IAPSTA_MODE; +- } else if (!strcmp(pch, "dualap")) { +- apsta_params->apstamode = IDUALAP_MODE; +- } else if (!strcmp(pch, "gosta")) { +- if (!FW_SUPPORTED(dhd, p2p)) { +- return -1; +- } +- apsta_params->apstamode = IGOSTA_MODE; +- } else if (!strcmp(pch, "gcsta")) { +- if (!FW_SUPPORTED(dhd, p2p)) { +- return -1; +- } +- apsta_params->apstamode = IGCSTA_MODE; +- } else { +- ANDROID_ERROR(("%s: mode [sta|ap|apsta|dualap]\n", __FUNCTION__)); +- return -1; +- } +- } +- } else if (!strcmp(param, "vifname")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- strcpy(apsta_params->vif.ifname, pch); +- else { +- ANDROID_ERROR(("%s: vifname [wlan1]\n", __FUNCTION__)); +- return -1; +- } +- } +- param = bcmstrtok(&pick_tmp, " ", 0); +- } +- +- if (apsta_params->apstamode == 0) { +- ANDROID_ERROR(("%s: mode [sta|ap|apsta|dualap]\n", __FUNCTION__)); +- return -1; +- } +- +- apsta_params->pif.dev = dev; +- apsta_params->pif.bssidx = 0; +- strcpy(apsta_params->pif.ifname, dev->name); +- strcpy(apsta_params->pif.ssid, "tttp"); +- apsta_params->pif.maxassoc = -1; +- apsta_params->pif.channel = 1; +- +- if (!strlen(apsta_params->vif.ifname)) +- strcpy(apsta_params->vif.ifname, "wlan1"); +- strcpy(apsta_params->vif.ssid, "tttv"); +- apsta_params->vif.maxassoc = -1; +- apsta_params->vif.channel = 1; +- +- if (apsta_params->apstamode == ISTAONLY_MODE) { +- apsta_params->pif.ifmode = ISTA_MODE; +- apsta_params->pif.ifstate = IF_STATE_INIT; +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- wl_ext_iovar_setint(dev, "apsta", 1); // keep 1 as we set in dhd_preinit_ioctls +- // don't set WLC_SET_AP to 0, some parameters will be reset, such as bcn_timeout and roam_off +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- } else if (apsta_params->apstamode == IAPONLY_MODE) { +- apsta_params->pif.ifmode = IAP_MODE; +- apsta_params->pif.ifstate = IF_STATE_INIT; +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +-#ifdef ARP_OFFLOAD_SUPPORT +- /* IF SoftAP is enabled, disable arpoe */ +- dhd_arp_offload_set(dhd, 0); +- dhd_arp_offload_enable(dhd, FALSE); +-#endif /* ARP_OFFLOAD_SUPPORT */ +- wl_ext_iovar_setint(dev, "mpc", 0); +- wl_ext_iovar_setint(dev, "apsta", 0); +- val = 1; +- wl_ext_ioctl(dev, WLC_SET_AP, &val, sizeof(val), 1); +- } else if (apsta_params->apstamode == IAPSTA_MODE) { +- apsta_params->pif.ifmode = ISTA_MODE; +- apsta_params->pif.ifstate = IF_STATE_INIT; +- apsta_params->vif.ifmode = IAP_MODE; +- apsta_params->vif.ifstate = IF_STATE_INIT; +- wl_ext_iovar_setint(dev, "mpc", 0); +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- wl_ext_iovar_setint(dev, "apsta", 1); +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- if (FW_SUPPORTED(dhd, rsdb)) { +- bzero(&iface, sizeof(wl_interface_create_t)); +- iface.ver = WL_INTERFACE_CREATE_VER; +- iface.flags = WL_INTERFACE_CREATE_AP; +- wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), iovar_buf, +- WLC_IOCTL_SMLEN, 1, NULL); +- } else { +- wl_ext_iovar_setbuf_bsscfg(dev, "ssid", &ssid, sizeof(ssid), iovar_buf, +- WLC_IOCTL_SMLEN, 1, NULL); +- } +- } +- else if (apsta_params->apstamode == IDUALAP_MODE) { +- apsta_params->pif.ifmode = IAP_MODE; +- apsta_params->pif.ifstate = IF_STATE_INIT; +- apsta_params->vif.ifmode = IAP_MODE; +- apsta_params->vif.ifstate = IF_STATE_INIT; +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- wl_ext_iovar_setint(dev, "apsta", 0); +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- val = 1; +- wl_ext_ioctl(dev, WLC_SET_AP, &val, sizeof(val), 1); +- /* IF SoftAP is enabled, disable arpoe or wlan1 will ping fail */ +-#ifdef ARP_OFFLOAD_SUPPORT +- /* IF SoftAP is enabled, disable arpoe */ +- dhd_arp_offload_set(dhd, 0); +- dhd_arp_offload_enable(dhd, FALSE); +-#endif /* ARP_OFFLOAD_SUPPORT */ +- bzero(&iface, sizeof(wl_interface_create_t)); +- iface.ver = WL_INTERFACE_CREATE_VER; +- iface.flags = WL_INTERFACE_CREATE_AP; +- wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), iovar_buf, +- WLC_IOCTL_SMLEN, 1, NULL); +- } +- else if (apsta_params->apstamode == IGOSTA_MODE) { +- apsta_params->pif.ifmode = ISTA_MODE; +- apsta_params->pif.ifstate = IF_STATE_INIT; +- apsta_params->vif.ifmode = IAP_MODE; +- apsta_params->vif.ifstate = IF_STATE_INIT; +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- wl_ext_iovar_setint(dev, "apsta", 1); +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- bzero(&ifreq, sizeof(wl_p2p_if_t)); +- ifreq.type = htod32(WL_P2P_IF_GO); +- wl_ext_iovar_setbuf(dev, "p2p_ifadd", &ifreq, sizeof(ifreq), +- iovar_buf, WLC_IOCTL_SMLEN, NULL); +- } +- else if (apsta_params->apstamode == IGCSTA_MODE) { +- apsta_params->pif.ifmode = ISTA_MODE; +- apsta_params->pif.ifstate = IF_STATE_INIT; +- apsta_params->vif.ifmode = ISTA_MODE; +- apsta_params->vif.ifstate = IF_STATE_INIT; +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- wl_ext_iovar_setint(dev, "apsta", 1); +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- bzero(&ifreq, sizeof(wl_p2p_if_t)); +- ifreq.type = htod32(WL_P2P_IF_CLIENT); +- wl_ext_iovar_setbuf(dev, "p2p_ifadd", &ifreq, sizeof(ifreq), +- iovar_buf, WLC_IOCTL_SMLEN, NULL); +- } +- +- wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver); +- printf("%s: apstamode=%d\n", __FUNCTION__, apsta_params->apstamode); +- +- apsta_params->init = TRUE; +- +- return 0; +-} +- +-static int +-wl_ext_iapsta_config(struct net_device *dev, char *command, int total_len) +-{ +- int i; +- char *pch, *pick_tmp, *param; +- struct wl_apsta_params *apsta_params = &g_apsta_params; +- char ifname[IFNAMSIZ+1]; +- struct wl_if_info *cur_if = &apsta_params->pif; +- +- if (!apsta_params->init) { +- ANDROID_ERROR(("%s: please init first\n", __FUNCTION__)); +- return -1; +- } +- +- ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); +- +- pick_tmp = command; +- param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_config +- param = bcmstrtok(&pick_tmp, " ", 0); +- +- if (param != NULL) { +- if (strcmp(param, "ifname")) { +- ANDROID_ERROR(("%s: first arg must be ifname\n", __FUNCTION__)); +- return -1; +- } +- } +- +- while (param != NULL) { +- if (!strcmp(param, "ifname")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- strcpy(ifname, pch); +- else { +- ANDROID_ERROR(("%s: ifname [wlanX]\n", __FUNCTION__)); +- return -1; +- } +- if (!strcmp(apsta_params->pif.dev->name, ifname)) { +- cur_if = &apsta_params->pif; +- } else if (!strcmp(apsta_params->vif.ifname, ifname)) { +- cur_if = &apsta_params->vif; +- } else { +- ANDROID_ERROR(("%s: wrong ifname=%s in apstamode=%d\n", __FUNCTION__, +- ifname, apsta_params->apstamode)); +- return -1; +- } +- } else if (!strcmp(param, "ssid")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- strcpy(cur_if->ssid, pch); +- } else if (!strcmp(param, "bssid")) { +- pch = bcmstrtok(&pick_tmp, ": ", 0); +- for (i=0; i<6 && pch; i++) { +- ((u8 *)&cur_if->bssid)[i] = (int)simple_strtol(pch, NULL, 16); +- pch = bcmstrtok(&pick_tmp, ": ", 0); +- } +- } else if (!strcmp(param, "bgnmode")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) { +- if (!strcmp(pch, "b")) +- cur_if->bgnmode = IEEE80211B; +- else if (!strcmp(pch, "g")) +- cur_if->bgnmode = IEEE80211G; +- else if (!strcmp(pch, "bg")) +- cur_if->bgnmode = IEEE80211BG; +- else if (!strcmp(pch, "bgn")) +- cur_if->bgnmode = IEEE80211BGN; +- else if (!strcmp(pch, "bgnac")) +- cur_if->bgnmode = IEEE80211BGNAC; +- else { +- ANDROID_ERROR(("%s: bgnmode [b|g|bg|bgn|bgnac]\n", __FUNCTION__)); +- return -1; +- } +- } +- } else if (!strcmp(param, "hidden")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) { +- if (!strcmp(pch, "n")) +- cur_if->hidden = 0; +- else if (!strcmp(pch, "y")) +- cur_if->hidden = 1; +- else { +- ANDROID_ERROR(("%s: hidden [y|n]\n", __FUNCTION__)); +- return -1; +- } +- } +- } else if (!strcmp(param, "maxassoc")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- cur_if->maxassoc = (int)simple_strtol(pch, NULL, 10); +- } else if (!strcmp(param, "chan")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- cur_if->channel = (int)simple_strtol(pch, NULL, 10); +- } else if (!strcmp(param, "amode")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) { +- if (!strcmp(pch, "open")) +- cur_if->amode = AUTH_OPEN; +- else if (!strcmp(pch, "shared")) +- cur_if->amode = AUTH_SHARED; +- else if (!strcmp(pch, "wpapsk")) +- cur_if->amode = AUTH_WPAPSK; +- else if (!strcmp(pch, "wpa2psk")) +- cur_if->amode = AUTH_WPA2PSK; +- else if (!strcmp(pch, "wpawpa2psk")) +- cur_if->amode = AUTH_WPAWPA2PSK; +- else { +- ANDROID_ERROR(("%s: amode [open|shared|wpapsk|wpa2psk|wpawpa2psk]\n", +- __FUNCTION__)); +- return -1; +- } +- } +- } else if (!strcmp(param, "emode")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) { +- if (!strcmp(pch, "none")) +- cur_if->emode = ENC_NONE; +- else if (!strcmp(pch, "wep")) +- cur_if->emode = ENC_WEP; +- else if (!strcmp(pch, "tkip")) +- cur_if->emode = ENC_TKIP; +- else if (!strcmp(pch, "aes")) +- cur_if->emode = ENC_AES; +- else if (!strcmp(pch, "tkipaes")) +- cur_if->emode = ENC_TKIPAES; +- else { +- ANDROID_ERROR(("%s: emode [none|wep|tkip|aes|tkipaes]\n", +- __FUNCTION__)); +- return -1; +- } +- } +- } else if (!strcmp(param, "key")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) { +- strcpy(cur_if->key, pch); +- } +- } +- param = bcmstrtok(&pick_tmp, " ", 0); +- } +- +- return 0; +-} +- +-static int +-wl_ext_iapsta_disable(struct net_device *dev, char *command, int total_len) +-{ +- char *pch, *pick_tmp, *param; +- s8 iovar_buf[WLC_IOCTL_SMLEN]; +- wlc_ssid_t ssid = { 0, {0} }; +- scb_val_t scbval; +- struct { +- s32 tmp; +- s32 cfg; +- s32 val; +- } bss_setbuf; +- struct wl_apsta_params *apsta_params = &g_apsta_params; +- apstamode_t apstamode = apsta_params->apstamode; +- char ifname[IFNAMSIZ+1]; +- struct wl_if_info *cur_if; +- struct dhd_pub *dhd; +- +- if (!apsta_params->init) { +- ANDROID_ERROR(("%s: please init first\n", __FUNCTION__)); +- return -1; +- } +- +- ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); +- dhd = dhd_get_pub(dev); +- +- pick_tmp = command; +- param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_disable +- param = bcmstrtok(&pick_tmp, " ", 0); +- while (param != NULL) { +- if (!strcmp(param, "ifname")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- strcpy(ifname, pch); +- else { +- ANDROID_ERROR(("%s: ifname [wlanX]\n", __FUNCTION__)); +- return -1; +- } +- } +- param = bcmstrtok(&pick_tmp, " ", 0); +- } +- if (!strcmp(apsta_params->pif.dev->name, ifname)) { +- cur_if = &apsta_params->pif; +- } else if (!strcmp(apsta_params->vif.ifname, ifname)) { +- cur_if = &apsta_params->vif; +- } else { +- ANDROID_ERROR(("%s: wrong ifname=%s\n", __FUNCTION__, ifname)); +- return -1; +- } +- if (!cur_if->dev) { +- ANDROID_ERROR(("%s: %s is not ready\n", __FUNCTION__, ifname)); +- return -1; +- } +- +- if (cur_if->ifmode == ISTA_MODE) { +- wl_ext_ioctl(cur_if->dev, WLC_DISASSOC, NULL, 0, 1); +- } else if (cur_if->ifmode == IAP_MODE) { +- // deauthenticate all STA first +- memcpy(scbval.ea.octet, ðer_bcast, ETHER_ADDR_LEN); +- wl_ext_ioctl(cur_if->dev, WLC_SCB_DEAUTHENTICATE, &scbval.ea, ETHER_ADDR_LEN, 1); +- } +- +- if (apstamode == IAPONLY_MODE) { +- wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); +- wl_ext_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); // reset ssid +- wl_ext_iovar_setint(dev, "mpc", 1); +- } else if ((apstamode==IAPSTA_MODE || apstamode==IGOSTA_MODE) && +- cur_if->ifmode == IAP_MODE) { +- // vif is AP mode +- bss_setbuf.tmp = 0xffffffff; +- bss_setbuf.cfg = 0; // must be 0, or wlan1 can not be down +- bss_setbuf.val = htod32(0); +- wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, sizeof(bss_setbuf), +- iovar_buf, WLC_IOCTL_SMLEN, NULL); +- wl_ext_iovar_setint(dev, "mpc", 1); +-#ifdef ARP_OFFLOAD_SUPPORT +- /* IF SoftAP is disabled, enable arpoe back for STA mode. */ +- dhd_arp_offload_set(dhd, dhd_arp_mode); +- dhd_arp_offload_enable(dhd, TRUE); +-#endif /* ARP_OFFLOAD_SUPPORT */ +- } else if (apstamode == IDUALAP_MODE) { +- bss_setbuf.tmp = 0xffffffff; +- bss_setbuf.cfg = 0; // must be 0, or wlan1 can not be down +- bss_setbuf.val = htod32(0); +- wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, sizeof(bss_setbuf), +- iovar_buf, WLC_IOCTL_SMLEN, NULL); +- } +- +-#ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) +- if (cur_if==&apsta_params->vif && dhd->conf->disable_proptx!=0) { +- bool enabled; +- dhd_wlfc_get_enable(dhd, &enabled); +- if (enabled) { +- dhd_wlfc_deinit(dhd); +- } +- } +-#endif +-#endif /* PROP_TXSTATUS_VSDB */ +- +- cur_if->ifstate = IF_STATE_DISALBE; +- printf("%s: apstamode=%d, ifname=%s\n", __FUNCTION__, apstamode, ifname); +- +- return 0; +-} +- +-static int +-wl_ext_iapsta_enable(struct net_device *dev, char *command, int total_len) +-{ +- int ret = 0; +- s32 val = 0; +- char *pch, *pick_tmp, *param; +- s8 iovar_buf[WLC_IOCTL_SMLEN]; +- wlc_ssid_t ssid = { 0, {0} }; +- struct { +- s32 cfg; +- s32 val; +- } bss_setbuf; +- struct wl_apsta_params *apsta_params = &g_apsta_params; +- apstamode_t apstamode = apsta_params->apstamode; +- char ifname[IFNAMSIZ+1]; +- struct wl_if_info *cur_if; +- char cmd[128] = "iapsta_stop ifname "; +- struct dhd_pub *dhd; +- +- if (!apsta_params->init) { +- ANDROID_ERROR(("%s: please init first\n", __FUNCTION__)); +- return -1; +- } +- +- ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); +- dhd = dhd_get_pub(dev); +- +- pick_tmp = command; +- param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_enable +- param = bcmstrtok(&pick_tmp, " ", 0); +- while (param != NULL) { +- if (!strcmp(param, "ifname")) { +- pch = bcmstrtok(&pick_tmp, " ", 0); +- if (pch) +- strcpy(ifname, pch); +- else { +- ANDROID_ERROR(("%s: ifname [wlanX]\n", __FUNCTION__)); +- return -1; +- } +- } +- param = bcmstrtok(&pick_tmp, " ", 0); +- } +- if (!strcmp(apsta_params->pif.dev->name, ifname)) { +- cur_if = &apsta_params->pif; +- } else if (!strcmp(apsta_params->vif.ifname, ifname)) { +- cur_if = &apsta_params->vif; +- } else { +- ANDROID_ERROR(("%s: wrong ifname=%s\n", __FUNCTION__, ifname)); +- return -1; +- } +- if (!cur_if->dev) { +- ANDROID_ERROR(("%s: %s is not ready\n", __FUNCTION__, ifname)); +- return -1; +- } +- ssid.SSID_len = strlen(cur_if->ssid); +- memcpy(ssid.SSID, cur_if->ssid, ssid.SSID_len); +- ANDROID_TRACE(("%s: apstamode=%d, bssidx=%d\n", __FUNCTION__, apstamode, cur_if->bssidx)); +- +- snprintf(cmd, 128, "iapsta_stop ifname %s", cur_if->ifname); +- ret = wl_ext_iapsta_disable(dev, cmd, strlen(cmd)); +- if (ret) +- goto exit; +- +- if (cur_if == &apsta_params->vif) { +- wl_ext_iovar_setbuf(cur_if->dev, "cur_etheraddr", (u8 *)cur_if->dev->dev_addr, +- ETHER_ADDR_LEN, iovar_buf, WLC_IOCTL_SMLEN, NULL); +- } +- +- // set ssid for AP +- if (cur_if->ifmode == IAP_MODE) { +- wl_ext_iovar_setint(dev, "mpc", 0); +- if (apstamode == IAPONLY_MODE) { +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- } else if (apstamode==IAPSTA_MODE || apstamode==IGOSTA_MODE) { +- wl_ext_iovar_setbuf_bsscfg(cur_if->dev, "ssid", &ssid, sizeof(ssid), +- iovar_buf, WLC_IOCTL_SMLEN, cur_if->bssidx, NULL); +- } +- } +- +- if (cur_if->ifmode == IAP_MODE) { +- wl_ext_set_bgnmode(cur_if); +- wl_ext_set_chanspec(cur_if->dev, cur_if->channel); +- } +- wl_ext_set_amode(cur_if, apsta_params); +- wl_ext_set_emode(cur_if, apsta_params); +- +- if (apstamode == ISTAONLY_MODE || apstamode == IGCSTA_MODE) { +- if (!ETHER_ISBCAST(&cur_if->bssid) && !ETHER_ISNULLADDR(&cur_if->bssid)) { +- printf("%s: BSSID: %pM\n", __FUNCTION__, &cur_if->bssid); +- wl_ext_ioctl(cur_if->dev, WLC_SET_BSSID, &cur_if->bssid, ETHER_ADDR_LEN, 1); +- } +- val = 1; +- wl_ext_ioctl(dev, WLC_SET_INFRA, &val, sizeof(val), 1); +- } +- if (cur_if->ifmode == IAP_MODE) { +- if (cur_if->maxassoc >= 0) +- wl_ext_iovar_setint(dev, "maxassoc", cur_if->maxassoc); +- printf("%s: Broadcast SSID: %s\n", __FUNCTION__, cur_if->hidden ? "OFF":"ON"); +- // terence: fix me, hidden does not work in dualAP mode +- wl_ext_ioctl(cur_if->dev, WLC_SET_CLOSED, &cur_if->hidden, sizeof(cur_if->hidden), 1); +- } +- +- if (apstamode == ISTAONLY_MODE || apstamode == IGCSTA_MODE) { +- wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); +- } else if (apstamode == IAPONLY_MODE) { +- wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- } else if (apstamode == IAPSTA_MODE || apstamode == IGOSTA_MODE) { +- if (cur_if->ifmode == ISTA_MODE) { +- wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); +- } else { +- if (FW_SUPPORTED(dhd, rsdb)) { +- wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); +- } else { +- bss_setbuf.cfg = htod32(cur_if->bssidx); +- bss_setbuf.val = htod32(1); +- wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, sizeof(bss_setbuf), +- iovar_buf, WLC_IOCTL_SMLEN, NULL); +- } +-#ifdef ARP_OFFLOAD_SUPPORT +- /* IF SoftAP is enabled, disable arpoe */ +- dhd_arp_offload_set(dhd, 0); +- dhd_arp_offload_enable(dhd, FALSE); +-#endif /* ARP_OFFLOAD_SUPPORT */ +- } +- } +- else if (apstamode == IDUALAP_MODE) { +- wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); +- } +- +-#ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) +- if (cur_if==&apsta_params->vif && !disable_proptx) { +- bool enabled; +- dhd_wlfc_get_enable(dhd, &enabled); +- if (!enabled) { +- dhd_wlfc_init(dhd); +- wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); +- } +- } +-#endif +-#endif /* PROP_TXSTATUS_VSDB */ +- +- printf("%s: ifname=%s, SSID: %s\n", __FUNCTION__, ifname, cur_if->ssid); +- +- cur_if->ifstate = IF_STATE_ENABLE; +- +-exit: +- return ret; +-} +- +-void +-wl_android_ext_iapsta_disconnect_sta(struct net_device *dev, u32 channel) +-{ +- struct wl_apsta_params *apsta_params = &g_apsta_params; +- struct wl_if_info *cur_if = &apsta_params->vif; +- scb_val_t scbval; +- int ret; +- channel_info_t ci; +- struct dhd_pub *dhd; +- +- if (apsta_params->apstamode==IAPSTA_MODE && cur_if->ifstate==IF_STATE_ENABLE) { +- dhd = dhd_get_pub(dev); +- if (!FW_SUPPORTED(dhd, vsdb)) { +- if (!(ret = wldev_ioctl(cur_if->dev, WLC_GET_CHANNEL, &ci, sizeof(channel_info_t), FALSE))) { +- if (channel != ci.target_channel) { +- printf("%s: deauthenticate all STA on vif\n", __FUNCTION__); +- memcpy(scbval.ea.octet, ðer_bcast, ETHER_ADDR_LEN); +- wl_ext_ioctl(cur_if->dev, WLC_SCB_DEAUTHENTICATE, &scbval.ea, ETHER_ADDR_LEN, 1); +- } +- } +- } +- } +-} +- +-int wl_android_ext_attach_netdev(struct net_device *net, uint8 bssidx) +-{ +- g_apsta_params.vif.dev = net; +- g_apsta_params.vif.bssidx = bssidx; +- if (strlen(g_apsta_params.vif.ifname)) { +- memset(net->name, 0, sizeof(IFNAMSIZ)); +- strcpy(net->name, g_apsta_params.vif.ifname); +- net->name[IFNAMSIZ - 1] = '\0'; +- } +- if (g_apsta_params.pif.dev) { +- memcpy(net->dev_addr, g_apsta_params.pif.dev->dev_addr, ETHER_ADDR_LEN); +- net->dev_addr[0] |= 0x02; +- } +- +- return 0; +-} +- +-int wl_android_ext_dettach_netdev(void) +-{ +- struct wl_apsta_params *apsta_params = &g_apsta_params; +- +- ANDROID_TRACE(("%s: Enter\n", __FUNCTION__)); +- memset(apsta_params, 0, sizeof(struct wl_apsta_params)); +- +- return 0; +-} +-#endif +- +-#ifdef IDHCP +-int wl_ext_ip_dump(int ip, char *buf) +-{ +- unsigned char bytes[4]; +- int bytes_written=-1; +- +- bytes[0] = ip & 0xFF; +- bytes[1] = (ip >> 8) & 0xFF; +- bytes[2] = (ip >> 16) & 0xFF; +- bytes[3] = (ip >> 24) & 0xFF; +- bytes_written = sprintf(buf, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]); +- +- return bytes_written; +-} +- +-/* +-terence 20170215: +-dhd_priv dhcpc_dump ifname [wlan0|wlan1] +-dhd_priv dhcpc_enable [0|1] +-*/ +-int +-wl_ext_dhcpc_enable(struct net_device *dev, char *command, int total_len) +-{ +- int enable = -1, ret = -1; +- int bytes_written = -1; +- +- ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); +- +- sscanf(command, "%*s %d", &enable); +- +- if (enable >= 0) +- ret = wl_ext_iovar_setint(dev, "dhcpc_enable", enable); +- else { +- ret = wl_ext_iovar_getint(dev, "dhcpc_enable", &enable); +- if (!ret) { +- bytes_written = snprintf(command, total_len, "%d", enable); +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- } +- +- return ret; +-} +- +-int +-wl_ext_dhcpc_dump(struct net_device *dev, char *command, int total_len) +-{ +- +- int ret = 0; +- int bytes_written = 0; +- uint32 ip_addr; +- char buf[20]=""; +- +- ret = wl_ext_iovar_getint(dev, "dhcpc_ip_addr", &ip_addr); +- if (!ret) { +- wl_ext_ip_dump(ip_addr, buf); +- bytes_written += snprintf(command+bytes_written, total_len, "ipaddr %s ", buf); +- } +- +- ret = wl_ext_iovar_getint(dev, "dhcpc_ip_mask", &ip_addr); +- if (!ret) { +- wl_ext_ip_dump(ip_addr, buf); +- bytes_written += snprintf(command+bytes_written, total_len, "mask %s ", buf); +- } +- +- ret = wl_ext_iovar_getint(dev, "dhcpc_ip_gateway", &ip_addr); +- if (!ret) { +- wl_ext_ip_dump(ip_addr, buf); +- bytes_written += snprintf(command+bytes_written, total_len, "gw %s ", buf); +- } +- +- ret = wl_ext_iovar_getint(dev, "dhcpc_ip_dnsserv", &ip_addr); +- if (!ret) { +- wl_ext_ip_dump(ip_addr, buf); +- bytes_written += snprintf(command+bytes_written, total_len, "dnsserv %s ", buf); +- } +- +- if (!bytes_written) +- bytes_written = -1; +- +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- +- return bytes_written; +-} +-#endif +- +-/* +-dhd_priv dhd [string] ==> Not ready +-1. Get dhd val: +- Ex: dhd_priv dhd bussleep +-2. Set dhd val: +- Ex: dhd_priv dhd bussleep 1 +- +-dhd_priv wl [WLC_GET_PM] ==> Ready to get int val +-dhd_priv wl [WLC_SET_PM] [int] ==> Ready to set int val +-dhd_priv wl [string] ==> Ready to get int val +-dhd_priv wl [string] [int] ==> Ready to set int val +-Ex: get/set WLC_PM +- dhd_priv wl 85 +- dhd_priv wl 86 1 +-Ex: get/set mpc +- dhd_priv wl mpc +- dhd_priv wl mpc 1 +-*/ +-int +-wl_ext_iovar(struct net_device *dev, char *command, int total_len) +-{ +- int ret = 0; +- char wl[3]="\0", arg[20]="\0", cmd_str[20]="\0", val_str[20]="\0"; +- int cmd=-1, val=0; +- int bytes_written=-1; +- +- ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); +- +- sscanf(command, "%s %d %s", wl, &cmd, arg); +- if (cmd < 0) +- sscanf(command, "%s %s %s", wl, cmd_str, val_str); +- +- if (!strcmp(wl, "wl")) { +- if (cmd>=0 && cmd!=WLC_GET_VAR && cmd!=WLC_SET_VAR) { +- ret = sscanf(arg, "%d", &val); +- if (ret > 0) { // set +- ret = wl_ext_ioctl(dev, cmd, &val, sizeof(val), TRUE); +- } else { // get +- ret = wl_ext_ioctl(dev, cmd, &val, sizeof(val), FALSE); +- if (!ret) { +- bytes_written = snprintf(command, total_len, "%d", val); +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- } +- } else if (strlen(cmd_str)) { +- ret = sscanf(val_str, "%d", &val); +- if (ret > 0) { // set +- ret = wl_ext_iovar_setint(dev, cmd_str, val); +- } else { // get +- ret = wl_ext_iovar_getint(dev, cmd_str, &val); +- if (!ret) { +- bytes_written = snprintf(command, total_len, "%d", val); +- ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); +- ret = bytes_written; +- } +- } +- } +- } +- +- return ret; +-} +- +-int wl_android_ext_priv_cmd(struct net_device *net, char *command, int total_len, +- int *bytes_written) +-{ +- int ret = 0; +- +- if (strnicmp(command, CMD_CHANNELS, strlen(CMD_CHANNELS)) == 0) { +- *bytes_written = wl_ext_channels(net, command, total_len); +- } +- else if (strnicmp(command, CMD_CHANNEL, strlen(CMD_CHANNEL)) == 0) { +- *bytes_written = wl_ext_channel(net, command, total_len); +- } +- else if (strnicmp(command, CMD_ROAM_TRIGGER, strlen(CMD_ROAM_TRIGGER)) == 0) { +- *bytes_written = wl_ext_roam_trigger(net, command, total_len); +- } +- else if (strnicmp(command, CMD_KEEP_ALIVE, strlen(CMD_KEEP_ALIVE)) == 0) { +- *bytes_written = wl_ext_keep_alive(net, command, total_len); +- } +- else if (strnicmp(command, CMD_PM, strlen(CMD_PM)) == 0) { +- *bytes_written = wl_ext_pm(net, command, total_len); +- } +- else if (strnicmp(command, CMD_MONITOR, strlen(CMD_MONITOR)) == 0) { +- *bytes_written = wl_ext_monitor(net, command, total_len); +- } +- else if (strnicmp(command, CMD_SET_SUSPEND_BCN_LI_DTIM, strlen(CMD_SET_SUSPEND_BCN_LI_DTIM)) == 0) { +- int bcn_li_dtim; +- bcn_li_dtim = (int)simple_strtol((command + strlen(CMD_SET_SUSPEND_BCN_LI_DTIM) + 1), NULL, 10); +- *bytes_written = net_os_set_suspend_bcn_li_dtim(net, bcn_li_dtim); +- } +-#ifdef WL_EXT_IAPSTA +- else if (strnicmp(command, CMD_IAPSTA_INIT, strlen(CMD_IAPSTA_INIT)) == 0) { +- *bytes_written = wl_ext_iapsta_init(net, command, total_len); +- } +- else if (strnicmp(command, CMD_IAPSTA_CONFIG, strlen(CMD_IAPSTA_CONFIG)) == 0) { +- *bytes_written = wl_ext_iapsta_config(net, command, total_len); +- } +- else if (strnicmp(command, CMD_IAPSTA_ENABLE, strlen(CMD_IAPSTA_ENABLE)) == 0) { +- *bytes_written = wl_ext_iapsta_enable(net, command, total_len); +- } +- else if (strnicmp(command, CMD_IAPSTA_DISABLE, strlen(CMD_IAPSTA_DISABLE)) == 0) { +- *bytes_written = wl_ext_iapsta_disable(net, command, total_len); +- } +-#endif +-#ifdef IDHCP +- else if (strnicmp(command, CMD_DHCPC_ENABLE, strlen(CMD_DHCPC_ENABLE)) == 0) { +- *bytes_written = wl_ext_dhcpc_enable(net, command, total_len); +- } +- else if (strnicmp(command, CMD_DHCPC_DUMP, strlen(CMD_DHCPC_DUMP)) == 0) { +- *bytes_written = wl_ext_dhcpc_dump(net, command, total_len); +- } +-#endif +- else if (strnicmp(command, CMD_WL, strlen(CMD_WL)) == 0) { +- *bytes_written = wl_ext_iovar(net, command, total_len); +- } +- else +- ret = -1; +- +- return ret; +-} +- +-#if defined(RSSIAVG) +-void +-wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl) +-{ +- wl_rssi_cache_t *node, *cur, **rssi_head; +- int i=0; +- +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- node = *rssi_head; +- +- for (;node;) { +- ANDROID_INFO(("%s: Free %d with BSSID %pM\n", +- __FUNCTION__, i, &node->BSSID)); +- cur = node; +- node = cur->next; +- kfree(cur); +- i++; +- } +- *rssi_head = NULL; +-} +- +-void +-wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl) +-{ +- wl_rssi_cache_t *node, *prev, **rssi_head; +- int i = -1, tmp = 0; +- struct timeval now; +- +- do_gettimeofday(&now); +- +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- node = *rssi_head; +- prev = node; +- for (;node;) { +- i++; +- if (now.tv_sec > node->tv.tv_sec) { +- if (node == *rssi_head) { +- tmp = 1; +- *rssi_head = node->next; +- } else { +- tmp = 0; +- prev->next = node->next; +- } +- ANDROID_INFO(("%s: Del %d with BSSID %pM\n", +- __FUNCTION__, i, &node->BSSID)); +- kfree(node); +- if (tmp == 1) { +- node = *rssi_head; +- prev = node; +- } else { +- node = prev->next; +- } +- continue; +- } +- prev = node; +- node = node->next; +- } +-} +- +-void +-wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, u8 *bssid) +-{ +- wl_rssi_cache_t *node, *prev, **rssi_head; +- int i = -1, tmp = 0; +- +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- node = *rssi_head; +- prev = node; +- for (;node;) { +- i++; +- if (!memcmp(&node->BSSID, bssid, ETHER_ADDR_LEN)) { +- if (node == *rssi_head) { +- tmp = 1; +- *rssi_head = node->next; +- } else { +- tmp = 0; +- prev->next = node->next; +- } +- ANDROID_INFO(("%s: Del %d with BSSID %pM\n", +- __FUNCTION__, i, &node->BSSID)); +- kfree(node); +- if (tmp == 1) { +- node = *rssi_head; +- prev = node; +- } else { +- node = prev->next; +- } +- continue; +- } +- prev = node; +- node = node->next; +- } +-} +- +-void +-wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl) +-{ +- wl_rssi_cache_t *node, **rssi_head; +- +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- +- /* reset dirty */ +- node = *rssi_head; +- for (;node;) { +- node->dirty += 1; +- node = node->next; +- } +-} +- +-int +-wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rssi_cache_ctrl, int *rssi_avg) +-{ +- wl_rssi_cache_t *node, *prev, *leaf, **rssi_head; +- int j, k=0; +- int rssi, error=0; +- struct ether_addr bssid; +- struct timeval now, timeout; +- +- if (!g_wifi_on) +- return 0; +- +- error = wldev_ioctl(net, WLC_GET_BSSID, &bssid, sizeof(bssid), false); +- if (error == BCME_NOTASSOCIATED) { +- ANDROID_INFO(("%s: Not Associated! res:%d\n", __FUNCTION__, error)); +- return 0; +- } +- if (error) { +- ANDROID_ERROR(("Could not get bssid (%d)\n", error)); +- } +- error = wldev_get_rssi(net, &rssi); +- if (error) { +- ANDROID_ERROR(("Could not get rssi (%d)\n", error)); +- return error; +- } +- +- do_gettimeofday(&now); +- timeout.tv_sec = now.tv_sec + RSSICACHE_TIMEOUT; +- if (timeout.tv_sec < now.tv_sec) { +- /* +- * Integer overflow - assume long enough timeout to be assumed +- * to be infinite, i.e., the timeout would never happen. +- */ +- ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu", +- __FUNCTION__, RSSICACHE_TIMEOUT, now.tv_sec, timeout.tv_sec)); +- } +- +- /* update RSSI */ +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- node = *rssi_head; +- prev = NULL; +- for (;node;) { +- if (!memcmp(&node->BSSID, &bssid, ETHER_ADDR_LEN)) { +- ANDROID_INFO(("%s: Update %d with BSSID %pM, RSSI=%d\n", +- __FUNCTION__, k, &bssid, rssi)); +- for (j=0; jRSSI[j] = node->RSSI[j+1]; +- node->RSSI[j] = rssi; +- node->dirty = 0; +- node->tv = timeout; +- goto exit; +- } +- prev = node; +- node = node->next; +- k++; +- } +- +- leaf = kmalloc(sizeof(wl_rssi_cache_t), GFP_KERNEL); +- if (!leaf) { +- ANDROID_ERROR(("%s: Memory alloc failure %d\n", +- __FUNCTION__, (int)sizeof(wl_rssi_cache_t))); +- return 0; +- } +- ANDROID_INFO(("%s: Add %d with cached BSSID %pM, RSSI=%3d in the leaf\n", +- __FUNCTION__, k, &bssid, rssi)); +- +- leaf->next = NULL; +- leaf->dirty = 0; +- leaf->tv = timeout; +- memcpy(&leaf->BSSID, &bssid, ETHER_ADDR_LEN); +- for (j=0; jRSSI[j] = rssi; +- +- if (!prev) +- *rssi_head = leaf; +- else +- prev->next = leaf; +- +-exit: +- *rssi_avg = (int)wl_get_avg_rssi(rssi_cache_ctrl, &bssid); +- +- return error; +-} +- +-void +-wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list) +-{ +- wl_rssi_cache_t *node, *prev, *leaf, **rssi_head; +- wl_bss_info_t *bi = NULL; +- int i, j, k; +- struct timeval now, timeout; +- +- if (!ss_list->count) +- return; +- +- do_gettimeofday(&now); +- timeout.tv_sec = now.tv_sec + RSSICACHE_TIMEOUT; +- if (timeout.tv_sec < now.tv_sec) { +- /* +- * Integer overflow - assume long enough timeout to be assumed +- * to be infinite, i.e., the timeout would never happen. +- */ +- ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu", +- __FUNCTION__, RSSICACHE_TIMEOUT, now.tv_sec, timeout.tv_sec)); +- } +- +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- +- /* update RSSI */ +- for (i = 0; i < ss_list->count; i++) { +- node = *rssi_head; +- prev = NULL; +- k = 0; +- bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; +- for (;node;) { +- if (!memcmp(&node->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { +- ANDROID_INFO(("%s: Update %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", +- __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); +- for (j=0; jRSSI[j] = node->RSSI[j+1]; +- node->RSSI[j] = dtoh16(bi->RSSI); +- node->dirty = 0; +- node->tv = timeout; +- break; +- } +- prev = node; +- node = node->next; +- k++; +- } +- +- if (node) +- continue; +- +- leaf = kmalloc(sizeof(wl_rssi_cache_t), GFP_KERNEL); +- if (!leaf) { +- ANDROID_ERROR(("%s: Memory alloc failure %d\n", +- __FUNCTION__, (int)sizeof(wl_rssi_cache_t))); +- return; +- } +- ANDROID_INFO(("%s: Add %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\" in the leaf\n", +- __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); +- +- leaf->next = NULL; +- leaf->dirty = 0; +- leaf->tv = timeout; +- memcpy(&leaf->BSSID, &bi->BSSID, ETHER_ADDR_LEN); +- for (j=0; jRSSI[j] = dtoh16(bi->RSSI); +- +- if (!prev) +- *rssi_head = leaf; +- else +- prev->next = leaf; +- } +-} +- +-int16 +-wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr) +-{ +- wl_rssi_cache_t *node, **rssi_head; +- int j, rssi_sum, rssi=RSSI_MINVAL; +- +- rssi_head = &rssi_cache_ctrl->m_cache_head; +- +- node = *rssi_head; +- for (;node;) { +- if (!memcmp(&node->BSSID, addr, ETHER_ADDR_LEN)) { +- rssi_sum = 0; +- rssi = 0; +- for (j=0; jRSSI[RSSIAVG_LEN-j-1]; +- rssi = rssi_sum / j; +- break; +- } +- node = node->next; +- } +- rssi = MIN(rssi, RSSI_MAXVAL); +- if (rssi == RSSI_MINVAL) { +- ANDROID_ERROR(("%s: BSSID %pM does not in RSSI cache\n", +- __FUNCTION__, addr)); +- } +- return (int16)rssi; +-} +-#endif +- +-#if defined(RSSIOFFSET) +-int +-wl_update_rssi_offset(struct net_device *net, int rssi) +-{ +-#if defined(RSSIOFFSET_NEW) +- int j; +-#endif +- +- if (!g_wifi_on) +- return rssi; +- +-#if defined(RSSIOFFSET_NEW) +- for (j=0; jm_cache_head; +- node = *bss_head; +- +- for (;node;) { +- ANDROID_TRACE(("%s: Free %d with BSSID %pM\n", +- __FUNCTION__, i, &node->results.bss_info->BSSID)); +- cur = node; +- node = cur->next; +- kfree(cur); +- i++; +- } +- *bss_head = NULL; +-} +- +-void +-wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl) +-{ +- wl_bss_cache_t *node, *prev, **bss_head; +- int i = -1, tmp = 0; +- struct timeval now; +- +- do_gettimeofday(&now); +- +- bss_head = &bss_cache_ctrl->m_cache_head; +- node = *bss_head; +- prev = node; +- for (;node;) { +- i++; +- if (now.tv_sec > node->tv.tv_sec) { +- if (node == *bss_head) { +- tmp = 1; +- *bss_head = node->next; +- } else { +- tmp = 0; +- prev->next = node->next; +- } +- ANDROID_TRACE(("%s: Del %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", +- __FUNCTION__, i, &node->results.bss_info->BSSID, +- dtoh16(node->results.bss_info->RSSI), node->results.bss_info->SSID)); +- kfree(node); +- if (tmp == 1) { +- node = *bss_head; +- prev = node; +- } else { +- node = prev->next; +- } +- continue; +- } +- prev = node; +- node = node->next; +- } +-} +- +-void +-wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, u8 *bssid) +-{ +- wl_bss_cache_t *node, *prev, **bss_head; +- int i = -1, tmp = 0; +- +- bss_head = &bss_cache_ctrl->m_cache_head; +- node = *bss_head; +- prev = node; +- for (;node;) { +- i++; +- if (!memcmp(&node->results.bss_info->BSSID, bssid, ETHER_ADDR_LEN)) { +- if (node == *bss_head) { +- tmp = 1; +- *bss_head = node->next; +- } else { +- tmp = 0; +- prev->next = node->next; +- } +- ANDROID_TRACE(("%s: Del %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", +- __FUNCTION__, i, &node->results.bss_info->BSSID, +- dtoh16(node->results.bss_info->RSSI), node->results.bss_info->SSID)); +- kfree(node); +- if (tmp == 1) { +- node = *bss_head; +- prev = node; +- } else { +- node = prev->next; +- } +- continue; +- } +- prev = node; +- node = node->next; +- } +-} +- +-void +-wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl) +-{ +- wl_bss_cache_t *node, **bss_head; +- +- bss_head = &bss_cache_ctrl->m_cache_head; +- +- /* reset dirty */ +- node = *bss_head; +- for (;node;) { +- node->dirty += 1; +- node = node->next; +- } +-} +- +-void dump_bss_cache( +-#if defined(RSSIAVG) +- wl_rssi_cache_ctrl_t *rssi_cache_ctrl, +-#endif +- wl_bss_cache_t *node) +-{ +- int k = 0; +- int16 rssi; +- +- for (;node;) { +-#if defined(RSSIAVG) +- rssi = wl_get_avg_rssi(rssi_cache_ctrl, &node->results.bss_info->BSSID); +-#else +- rssi = dtoh16(node->results.bss_info->RSSI); +-#endif +- ANDROID_TRACE(("%s: dump %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\"\n", +- __FUNCTION__, k, &node->results.bss_info->BSSID, rssi, node->results.bss_info->SSID)); +- k++; +- node = node->next; +- } +-} +- +-void +-wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, +-#if defined(RSSIAVG) +- wl_rssi_cache_ctrl_t *rssi_cache_ctrl, +-#endif +- wl_scan_results_t *ss_list) +-{ +- wl_bss_cache_t *node, *prev, *leaf, **bss_head; +- wl_bss_info_t *bi = NULL; +- int i, k=0; +-#if defined(SORT_BSS_BY_RSSI) +- int16 rssi, rssi_node; +-#endif +- struct timeval now, timeout; +- +- if (!ss_list->count) +- return; +- +- do_gettimeofday(&now); +- timeout.tv_sec = now.tv_sec + BSSCACHE_TIMEOUT; +- if (timeout.tv_sec < now.tv_sec) { +- /* +- * Integer overflow - assume long enough timeout to be assumed +- * to be infinite, i.e., the timeout would never happen. +- */ +- ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu", +- __FUNCTION__, BSSCACHE_TIMEOUT, now.tv_sec, timeout.tv_sec)); +- } +- +- bss_head = &bss_cache_ctrl->m_cache_head; +- +- for (i=0; i < ss_list->count; i++) { +- node = *bss_head; +- prev = NULL; +- bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; +- +- for (;node;) { +- if (!memcmp(&node->results.bss_info->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { +- if (node == *bss_head) +- *bss_head = node->next; +- else { +- prev->next = node->next; +- } +- break; +- } +- prev = node; +- node = node->next; +- } +- +- leaf = kmalloc(dtoh32(bi->length) + sizeof(wl_bss_cache_t), GFP_KERNEL); +- if (!leaf) { +- ANDROID_ERROR(("%s: Memory alloc failure %d\n", __FUNCTION__, +- dtoh32(bi->length) + (int)sizeof(wl_bss_cache_t))); +- return; +- } +- if (node) { +- kfree(node); +- node = NULL; +- ANDROID_TRACE(("%s: Update %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\"\n", +- __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); +- } else +- ANDROID_TRACE(("%s: Add %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\"\n", +- __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); +- +- memcpy(leaf->results.bss_info, bi, dtoh32(bi->length)); +- leaf->next = NULL; +- leaf->dirty = 0; +- leaf->tv = timeout; +- leaf->results.count = 1; +- leaf->results.version = ss_list->version; +- k++; +- +- if (*bss_head == NULL) +- *bss_head = leaf; +- else { +-#if defined(SORT_BSS_BY_RSSI) +- node = *bss_head; +-#if defined(RSSIAVG) +- rssi = wl_get_avg_rssi(rssi_cache_ctrl, &leaf->results.bss_info->BSSID); +-#else +- rssi = dtoh16(leaf->results.bss_info->RSSI); +-#endif +- for (;node;) { +-#if defined(RSSIAVG) +- rssi_node = wl_get_avg_rssi(rssi_cache_ctrl, &node->results.bss_info->BSSID); +-#else +- rssi_node = dtoh16(node->results.bss_info->RSSI); +-#endif +- if (rssi > rssi_node) { +- leaf->next = node; +- if (node == *bss_head) +- *bss_head = leaf; +- else +- prev->next = leaf; +- break; +- } +- prev = node; +- node = node->next; +- } +- if (node == NULL) +- prev->next = leaf; +-#else +- leaf->next = *bss_head; +- *bss_head = leaf; +-#endif +- } +- } +- dump_bss_cache( +-#if defined(RSSIAVG) +- rssi_cache_ctrl, +-#endif +- *bss_head); +-} +- +-void +-wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl) +-{ +- ANDROID_TRACE(("%s:\n", __FUNCTION__)); +- wl_free_bss_cache(bss_cache_ctrl); +-} +-#endif +- +- ++ } ++ *ret_chspec = fw_chspec; ++ ++ return err; ++} ++ ++int ++wl_ext_channel(struct net_device *dev, char* command, int total_len) ++{ ++ int ret; ++ int channel=0; ++ channel_info_t ci; ++ int bytes_written = 0; ++ chanspec_t fw_chspec; ++ ++ ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); ++ ++ sscanf(command, "%*s %d", &channel); ++ ++ if (channel > 0) { ++ ret = wl_ext_set_chanspec(dev, channel, &fw_chspec); ++ } else { ++ if (!(ret = wldev_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(channel_info_t), FALSE))) { ++ ANDROID_TRACE(("hw_channel %d\n", ci.hw_channel)); ++ ANDROID_TRACE(("target_channel %d\n", ci.target_channel)); ++ ANDROID_TRACE(("scan_channel %d\n", ci.scan_channel)); ++ bytes_written = snprintf(command, sizeof(channel_info_t)+2, "channel %d", ci.hw_channel); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ } ++ ++ return ret; ++} ++ ++int ++wl_ext_channels(struct net_device *dev, char* command, int total_len) ++{ ++ int ret, i; ++ int bytes_written = -1; ++ u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; ++ wl_uint32_list_t *list; ++ ++ ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); ++ ++ memset(valid_chan_list, 0, sizeof(valid_chan_list)); ++ list = (wl_uint32_list_t *)(void *) valid_chan_list; ++ list->count = htod32(WL_NUMCHANNELS); ++ ret = wldev_ioctl(dev, WLC_GET_VALID_CHANNELS, valid_chan_list, sizeof(valid_chan_list), 0); ++ if (ret<0) { ++ ANDROID_ERROR(("%s: get channels failed with %d\n", __FUNCTION__, ret)); ++ } else { ++ bytes_written = snprintf(command, total_len, "channels"); ++ for (i = 0; i < dtoh32(list->count); i++) { ++ bytes_written += snprintf(command+bytes_written, total_len, " %d", dtoh32(list->element[i])); ++ printf("%d ", dtoh32(list->element[i])); ++ } ++ printf("\n"); ++ ret = bytes_written; ++ } ++ ++ return ret; ++} ++ ++int ++wl_ext_roam_trigger(struct net_device *dev, char* command, int total_len) ++{ ++ int ret = 0; ++ int roam_trigger[2] = {0, 0}; ++ int trigger[2]= {0, 0}; ++ int bytes_written=-1; ++ ++ sscanf(command, "%*s %10d", &roam_trigger[0]); ++ ++ if (roam_trigger[0]) { ++ roam_trigger[1] = WLC_BAND_ALL; ++ ret = wldev_ioctl(dev, WLC_SET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 1); ++ if (ret) ++ ANDROID_ERROR(("WLC_SET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret)); ++ } else { ++ roam_trigger[1] = WLC_BAND_2G; ++ ret = wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 0); ++ if (!ret) ++ trigger[0] = roam_trigger[0]; ++ else ++ ANDROID_ERROR(("2G WLC_GET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret)); ++ ++ roam_trigger[1] = WLC_BAND_5G; ++ ret = wldev_ioctl(dev, WLC_GET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), 0); ++ if (!ret) ++ trigger[1] = roam_trigger[0]; ++ else ++ ANDROID_ERROR(("5G WLC_GET_ROAM_TRIGGER ERROR %d ret=%d\n", roam_trigger[0], ret)); ++ ++ ANDROID_TRACE(("roam_trigger %d %d\n", trigger[0], trigger[1])); ++ bytes_written = snprintf(command, total_len, "%d %d", trigger[0], trigger[1]); ++ ret = bytes_written; ++ } ++ ++ return ret; ++} ++ ++static int ++wl_ext_pattern_atoh(char *src, char *dst) ++{ ++ int i; ++ if (strncmp(src, "0x", 2) != 0 && ++ strncmp(src, "0X", 2) != 0) { ++ ANDROID_ERROR(("Mask invalid format. Needs to start with 0x\n")); ++ return -1; ++ } ++ src = src + 2; /* Skip past 0x */ ++ if (strlen(src) % 2 != 0) { ++ DHD_ERROR(("Mask invalid format. Needs to be of even length\n")); ++ return -1; ++ } ++ for (i = 0; *src != '\0'; i++) { ++ char num[3]; ++ bcm_strncpy_s(num, sizeof(num), src, 2); ++ num[2] = '\0'; ++ dst[i] = (uint8)strtoul(num, NULL, 16); ++ src += 2; ++ } ++ return i; ++} ++ ++int ++wl_ext_keep_alive(struct net_device *dev, char *command, int total_len) ++{ ++ wl_mkeep_alive_pkt_t *mkeep_alive_pktp; ++ int ret = -1, i; ++ int id, period=-1, len_bytes=0, buf_len=0; ++ char data[200]="\0"; ++ char buf[WLC_IOCTL_SMLEN]="\0", iovar_buf[WLC_IOCTL_SMLEN]="\0"; ++ int bytes_written = -1; ++ ++ ANDROID_TRACE(("%s: command = %s\n", __FUNCTION__, command)); ++ sscanf(command, "%*s %d %d %s", &id, &period, data); ++ ANDROID_TRACE(("%s: id=%d, period=%d, data=%s\n", __FUNCTION__, id, period, data)); ++ ++ if (period >= 0) { ++ mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *)buf; ++ mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION); ++ mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN); ++ mkeep_alive_pktp->keep_alive_id = id; ++ buf_len += WL_MKEEP_ALIVE_FIXED_LEN; ++ mkeep_alive_pktp->period_msec = period; ++ if (strlen(data)) { ++ len_bytes = wl_ext_pattern_atoh(data, (char *) mkeep_alive_pktp->data); ++ buf_len += len_bytes; ++ } ++ mkeep_alive_pktp->len_bytes = htod16(len_bytes); ++ ++ ret = wl_ext_iovar_setbuf(dev, "mkeep_alive", buf, buf_len, ++ iovar_buf, sizeof(iovar_buf), NULL); ++ } else { ++ if (id < 0) ++ id = 0; ++ ret = wl_ext_iovar_getbuf(dev, "mkeep_alive", &id, sizeof(id), buf, sizeof(buf), NULL); ++ if (ret) { ++ goto exit; ++ } else { ++ mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) buf; ++ printf("Id :%d\n" ++ "Period (msec) :%d\n" ++ "Length :%d\n" ++ "Packet :0x", ++ mkeep_alive_pktp->keep_alive_id, ++ dtoh32(mkeep_alive_pktp->period_msec), ++ dtoh16(mkeep_alive_pktp->len_bytes)); ++ for (i=0; ilen_bytes; i++) { ++ printf("%02x", mkeep_alive_pktp->data[i]); ++ } ++ printf("\n"); ++ } ++ bytes_written = snprintf(command, total_len, "mkeep_alive_period_msec %d ", dtoh32(mkeep_alive_pktp->period_msec)); ++ bytes_written += snprintf(command+bytes_written, total_len, "0x"); ++ for (i=0; ilen_bytes; i++) { ++ bytes_written += snprintf(command+bytes_written, total_len, "%x", mkeep_alive_pktp->data[i]); ++ } ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ ++exit: ++ return ret; ++} ++ ++int ++wl_ext_pm(struct net_device *dev, char *command, int total_len) ++{ ++ int pm=-1, ret = -1; ++ char *pm_local; ++ int bytes_written=-1; ++ ++ ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); ++ ++ sscanf(command, "%*s %d", &pm); ++ ++ if (pm >= 0) { ++ ret = wldev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm), FALSE); ++ if (ret) ++ ANDROID_ERROR(("WLC_SET_PM ERROR %d ret=%d\n", pm, ret)); ++ } else { ++ ret = wldev_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm), FALSE); ++ if (!ret) { ++ ANDROID_TRACE(("%s: PM = %d\n", __func__, pm)); ++ if (pm == PM_OFF) ++ pm_local = "PM_OFF"; ++ else if(pm == PM_MAX) ++ pm_local = "PM_MAX"; ++ else if(pm == PM_FAST) ++ pm_local = "PM_FAST"; ++ else { ++ pm = 0; ++ pm_local = "Invalid"; ++ } ++ bytes_written = snprintf(command, total_len, "PM %s", pm_local); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ } ++ ++ return ret; ++} ++ ++static int ++wl_ext_monitor(struct net_device *dev, char *command, int total_len) ++{ ++ int val, ret = -1; ++ int bytes_written=-1; ++ ++ sscanf(command, "%*s %d", &val); ++ ++ if (val >=0) { ++ ret = wldev_ioctl(dev, WLC_SET_MONITOR, &val, sizeof(int), 1); ++ if (ret) ++ ANDROID_ERROR(("WLC_SET_MONITOR ERROR %d ret=%d\n", val, ret)); ++ } else { ++ ret = wldev_ioctl(dev, WLC_GET_MONITOR, &val, sizeof(val), FALSE); ++ if (!ret) { ++ ANDROID_TRACE(("%s: monitor = %d\n", __FUNCTION__, val)); ++ bytes_written = snprintf(command, total_len, "monitor %d", val); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ } ++ ++ return ret; ++} ++ ++#ifdef WL_EXT_IAPSTA ++struct wl_apsta_params g_apsta_params; ++static int ++wl_ext_parse_wep(char *key, struct wl_wsec_key *wsec_key) ++{ ++ char hex[] = "XX"; ++ unsigned char *data = wsec_key->data; ++ char *keystr = key; ++ ++ switch (strlen(keystr)) { ++ case 5: ++ case 13: ++ case 16: ++ wsec_key->len = strlen(keystr); ++ memcpy(data, keystr, wsec_key->len + 1); ++ break; ++ case 12: ++ case 28: ++ case 34: ++ case 66: ++ /* strip leading 0x */ ++ if (!strnicmp(keystr, "0x", 2)) ++ keystr += 2; ++ else ++ return -1; ++ /* fall through */ ++ case 10: ++ case 26: ++ case 32: ++ case 64: ++ wsec_key->len = strlen(keystr) / 2; ++ while (*keystr) { ++ strncpy(hex, keystr, 2); ++ *data++ = (char) strtoul(hex, NULL, 16); ++ keystr += 2; ++ } ++ break; ++ default: ++ return -1; ++ } ++ ++ switch (wsec_key->len) { ++ case 5: ++ wsec_key->algo = CRYPTO_ALGO_WEP1; ++ break; ++ case 13: ++ wsec_key->algo = CRYPTO_ALGO_WEP128; ++ break; ++ case 16: ++ /* default to AES-CCM */ ++ wsec_key->algo = CRYPTO_ALGO_AES_CCM; ++ break; ++ case 32: ++ wsec_key->algo = CRYPTO_ALGO_TKIP; ++ break; ++ default: ++ return -1; ++ } ++ ++ /* Set as primary wsec_key by default */ ++ wsec_key->flags |= WL_PRIMARY_KEY; ++ ++ return 0; ++} ++ ++static int ++wl_ext_set_bgnmode(struct wl_if_info *cur_if) ++{ ++ struct net_device *dev = cur_if->dev; ++ bgnmode_t bgnmode = cur_if->bgnmode; ++ int val; ++ ++ if (bgnmode == 0) ++ return 0; ++ ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ if (bgnmode == IEEE80211B) { ++ wl_ext_iovar_setint(dev, "nmode", 0); ++ val = 0; ++ wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); ++ ANDROID_TRACE(("%s: Network mode: B only\n", __FUNCTION__)); ++ } else if (bgnmode == IEEE80211G) { ++ wl_ext_iovar_setint(dev, "nmode", 0); ++ val = 2; ++ wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); ++ ANDROID_TRACE(("%s: Network mode: G only\n", __FUNCTION__)); ++ } else if (bgnmode == IEEE80211BG) { ++ wl_ext_iovar_setint(dev, "nmode", 0); ++ val = 1; ++ wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); ++ ANDROID_TRACE(("%s: Network mode: B/G mixed\n", __FUNCTION__)); ++ } else if (bgnmode == IEEE80211BGN) { ++ wl_ext_iovar_setint(dev, "nmode", 0); ++ wl_ext_iovar_setint(dev, "nmode", 1); ++ wl_ext_iovar_setint(dev, "vhtmode", 0); ++ val = 1; ++ wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); ++ ANDROID_TRACE(("%s: Network mode: B/G/N mixed\n", __FUNCTION__)); ++ } else if (bgnmode == IEEE80211BGNAC) { ++ wl_ext_iovar_setint(dev, "nmode", 0); ++ wl_ext_iovar_setint(dev, "nmode", 1); ++ wl_ext_iovar_setint(dev, "vhtmode", 1); ++ val = 1; ++ wl_ext_ioctl(dev, WLC_SET_GMODE, &val, sizeof(val), 1); ++ ANDROID_TRACE(("%s: Network mode: B/G/N/AC mixed\n", __FUNCTION__)); ++ } ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ ++ return 0; ++} ++ ++static void ++wl_ext_get_amode(struct wl_if_info *cur_if, char *amode) ++{ ++ struct net_device *dev = cur_if->dev; ++ int auth=-1, wpa_auth=-1; ++ ++ wl_ext_iovar_getint(dev, "auth", &auth); ++ wl_ext_iovar_getint(dev, "wpa_auth", &wpa_auth); ++ ++ if (cur_if->ifmode == IMESH_MODE) { ++ if (auth == 0 && wpa_auth == 0) { ++ strcpy(amode, "open"); ++ } else if (auth == 0 && wpa_auth == 128) { ++ strcpy(amode, "sae"); ++ } ++ } else if (auth == 0 && wpa_auth == 0) { ++ strcpy(amode, "open"); ++ } else if (auth == 1 && wpa_auth == 0) { ++ strcpy(amode, "shared"); ++ } else if (auth == 0 && wpa_auth == 4) { ++ strcpy(amode, "wpapsk"); ++ } else if (auth == 0 && wpa_auth == 128) { ++ strcpy(amode, "wpa2psk"); ++ } else if (auth == 0 && wpa_auth == 132) { ++ strcpy(amode, "wpawpa2psk"); ++ } ++} ++ ++static void ++wl_ext_get_emode(struct wl_if_info *cur_if, char *emode) ++{ ++ struct net_device *dev = cur_if->dev; ++ int wsec=0; ++ ++ wl_ext_iovar_getint(dev, "wsec", &wsec); ++ ++ if (cur_if->ifmode == IMESH_MODE) { ++ if (wsec == 0) { ++ strcpy(emode, "none"); ++ } else { ++ strcpy(emode, "sae"); ++ } ++ } else if (wsec == 0) { ++ strcpy(emode, "none"); ++ } else if (wsec == 1) { ++ strcpy(emode, "wep"); ++ } else if (wsec == 2 || wsec == 10) { ++ strcpy(emode, "tkip"); ++ } else if (wsec == 4 || wsec == 12) { ++ strcpy(emode, "aes"); ++ } else if (wsec == 6 || wsec == 14) { ++ strcpy(emode, "tkipaes"); ++ } ++} ++ ++static int ++wl_ext_set_amode(struct wl_if_info *cur_if) ++{ ++ struct net_device *dev = cur_if->dev; ++ authmode_t amode = cur_if->amode; ++ int auth=0, wpa_auth=0; ++ ++ if (cur_if->ifmode == IMESH_MODE) { ++ if (amode == AUTH_SAE) { ++ auth = 0; ++ wpa_auth = 128; ++ ANDROID_INFO(("%s: Authentication: SAE\n", __FUNCTION__)); ++ } else { ++ auth = 0; ++ wpa_auth = 0; ++ ANDROID_INFO(("%s: Authentication: Open System\n", __FUNCTION__)); ++ } ++ } else if (amode == AUTH_OPEN) { ++ auth = 0; ++ wpa_auth = 0; ++ ANDROID_INFO(("%s: Authentication: Open System\n", __FUNCTION__)); ++ } else if (amode == AUTH_SHARED) { ++ auth = 1; ++ wpa_auth = 0; ++ ANDROID_INFO(("%s: Authentication: Shared Key\n", __FUNCTION__)); ++ } else if (amode == AUTH_WPAPSK) { ++ auth = 0; ++ wpa_auth = 4; ++ ANDROID_INFO(("%s: Authentication: WPA-PSK\n", __FUNCTION__)); ++ } else if (amode == AUTH_WPA2PSK) { ++ auth = 0; ++ wpa_auth = 128; ++ ANDROID_INFO(("%s: Authentication: WPA2-PSK\n", __FUNCTION__)); ++ } else if (amode == AUTH_WPAWPA2PSK) { ++ auth = 0; ++ wpa_auth = 132; ++ ANDROID_INFO(("%s: Authentication: WPA/WPA2-PSK\n", __FUNCTION__)); ++ } ++ if (cur_if->ifmode == IMESH_MODE) { ++ s32 val = WL_BSSTYPE_MESH; ++ wl_ext_ioctl(dev, WLC_SET_INFRA, &val, sizeof(val), 1); ++ } else if (cur_if->ifmode == ISTA_MODE) { ++ s32 val = WL_BSSTYPE_INFRA; ++ wl_ext_ioctl(dev, WLC_SET_INFRA, &val, sizeof(val), 1); ++ } ++ wl_ext_iovar_setint(dev, "auth", auth); ++ ++ wl_ext_iovar_setint(dev, "wpa_auth", wpa_auth); ++ ++ return 0; ++} ++ ++static int ++wl_ext_set_emode(struct wl_if_info *cur_if, struct wl_apsta_params *apsta_params) ++{ ++ struct net_device *dev = cur_if->dev; ++ int wsec=0; ++ struct wl_wsec_key wsec_key; ++ wsec_pmk_t psk; ++ authmode_t amode = cur_if->amode; ++ encmode_t emode = cur_if->emode; ++ char *key = cur_if->key; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ struct dhd_pub *dhd = dhd_get_pub(dev); ++ ++ memset(&wsec_key, 0, sizeof(wsec_key)); ++ memset(&psk, 0, sizeof(psk)); ++ ++ if (cur_if->ifmode == IMESH_MODE) { ++ if (amode == AUTH_SAE) { ++ wsec = 4; ++ ANDROID_INFO(("%s: Encryption: AES\n", __FUNCTION__)); ++ } else { ++ wsec = 0; ++ ANDROID_INFO(("%s: Encryption: No securiy\n", __FUNCTION__)); ++ } ++ } else if (emode == ENC_NONE) { ++ wsec = 0; ++ ANDROID_INFO(("%s: Encryption: No securiy\n", __FUNCTION__)); ++ } else if (emode == ENC_WEP) { ++ wsec = 1; ++ wl_ext_parse_wep(key, &wsec_key); ++ ANDROID_INFO(("%s: Encryption: WEP\n", __FUNCTION__)); ++ ANDROID_INFO(("%s: Key: \"%s\"\n", __FUNCTION__, wsec_key.data)); ++ } else if (emode == ENC_TKIP) { ++ wsec = 2; ++ psk.key_len = strlen(key); ++ psk.flags = WSEC_PASSPHRASE; ++ memcpy(psk.key, key, strlen(key)); ++ ANDROID_INFO(("%s: Encryption: TKIP\n", __FUNCTION__)); ++ ANDROID_INFO(("%s: Key: \"%s\"\n", __FUNCTION__, psk.key)); ++ } else if (emode == ENC_AES || amode == AUTH_SAE) { ++ wsec = 4; ++ psk.key_len = strlen(key); ++ psk.flags = WSEC_PASSPHRASE; ++ memcpy(psk.key, key, strlen(key)); ++ ANDROID_INFO(("%s: Encryption: AES\n", __FUNCTION__)); ++ ANDROID_INFO(("%s: Key: \"%s\"\n", __FUNCTION__, psk.key)); ++ } else if (emode == ENC_TKIPAES) { ++ wsec = 6; ++ psk.key_len = strlen(key); ++ psk.flags = WSEC_PASSPHRASE; ++ memcpy(psk.key, key, strlen(key)); ++ ANDROID_INFO(("%s: Encryption: TKIP/AES\n", __FUNCTION__)); ++ ANDROID_INFO(("%s: Key: \"%s\"\n", __FUNCTION__, psk.key)); ++ } ++ if (dhd->conf->chip == BCM43430_CHIP_ID && cur_if->bssidx > 0 && wsec >= 2 && ++ apsta_params->apstamode == IAPSTA_MODE) { ++ wsec |= 0x8; // terence 20180628: fix me, this is a workaround ++ } ++ ++ wl_ext_iovar_setint(dev, "wsec", wsec); ++ ++ if (cur_if->ifmode == IMESH_MODE) { ++ if (amode == AUTH_SAE) { ++ ANDROID_INFO(("%s: Key: \"%s\"\n", __FUNCTION__, key)); ++ wl_ext_iovar_setint(dev, "mesh_auth_proto", 1); ++ wl_ext_iovar_setint(dev, "mfp", WL_MFP_REQUIRED); ++ wl_ext_iovar_setbuf(dev, "sae_password", key, strlen(key), ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ } else { ++ wl_ext_iovar_setint(dev, "mesh_auth_proto", 0); ++ wl_ext_iovar_setint(dev, "mfp", WL_MFP_NONE); ++ } ++ } else if (emode == ENC_WEP) { ++ wl_ext_ioctl(dev, WLC_SET_KEY, &wsec_key, sizeof(wsec_key), 1); ++ } else if (emode == ENC_TKIP || emode == ENC_AES || emode == ENC_TKIPAES) { ++ if (dev) { ++ if (cur_if->ifmode == ISTA_MODE) ++ wl_ext_iovar_setint(dev, "sup_wpa", 1); ++ wl_ext_ioctl(dev, WLC_SET_WSEC_PMK, &psk, sizeof(psk), 1); ++ } else { ++ ANDROID_ERROR(("%s: apdev is null\n", __FUNCTION__)); ++ } ++ } ++ ++ return 0; ++} ++ ++static chanspec_t ++wl_ext_get_chanspec(struct net_device *dev, uint16 channel) ++{ ++ s32 _chan = channel; ++ chanspec_t chspec = 0; ++ chanspec_t fw_chspec = 0; ++ u32 bw = WL_CHANSPEC_BW_20; ++ s32 err = BCME_OK; ++ s32 bw_cap = 0; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ struct { ++ u32 band; ++ u32 bw_cap; ++ } param = {0, 0}; ++ uint band; ++ int ioctl_ver = 0; ++ ++ if (_chan <= CH_MAX_2G_CHANNEL) ++ band = IEEE80211_BAND_2GHZ; ++ else ++ band = IEEE80211_BAND_5GHZ; ++ wl_ext_get_ioctl_ver(dev, &ioctl_ver); ++ ++ if (band == IEEE80211_BAND_5GHZ) { ++ param.band = WLC_BAND_5G; ++ err = wldev_iovar_getbuf(dev, "bw_cap", ¶m, sizeof(param), ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ if (err) { ++ if (err != BCME_UNSUPPORTED) { ++ ANDROID_ERROR(("bw_cap failed, %d\n", err)); ++ return err; ++ } else { ++ err = wldev_iovar_getint(dev, "mimo_bw_cap", &bw_cap); ++ if (err) { ++ ANDROID_ERROR(("error get mimo_bw_cap (%d)\n", err)); ++ } ++ if (bw_cap != WLC_N_BW_20ALL) ++ bw = WL_CHANSPEC_BW_40; ++ } ++ } else { ++ if (WL_BW_CAP_80MHZ(iovar_buf[0])) ++ bw = WL_CHANSPEC_BW_80; ++ else if (WL_BW_CAP_40MHZ(iovar_buf[0])) ++ bw = WL_CHANSPEC_BW_40; ++ else ++ bw = WL_CHANSPEC_BW_20; ++ ++ } ++ } ++ else if (band == IEEE80211_BAND_2GHZ) ++ bw = WL_CHANSPEC_BW_20; ++ ++ chspec = wf_channel2chspec(_chan, bw); ++ if (wf_chspec_valid(chspec)) { ++ fw_chspec = wl_ext_chspec_host_to_driver(ioctl_ver, chspec); ++ if (fw_chspec == INVCHANSPEC) { ++ ANDROID_ERROR(("%s: failed to convert host chanspec to fw chanspec\n", ++ __FUNCTION__)); ++ fw_chspec = 0; ++ } ++ } ++ ++ return fw_chspec; ++} ++ ++static void ++wl_ext_ch_to_chanspec(int ch, struct wl_join_params *join_params, ++ size_t *join_params_size) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ chanspec_t chanspec = 0; ++ ++ if (ch != 0) { ++ join_params->params.chanspec_num = 1; ++ join_params->params.chanspec_list[0] = ch; ++ ++ if (join_params->params.chanspec_list[0] <= CH_MAX_2G_CHANNEL) ++ chanspec |= WL_CHANSPEC_BAND_2G; ++ else ++ chanspec |= WL_CHANSPEC_BAND_5G; ++ ++ chanspec |= WL_CHANSPEC_BW_20; ++ chanspec |= WL_CHANSPEC_CTL_SB_NONE; ++ ++ *join_params_size += WL_ASSOC_PARAMS_FIXED_SIZE + ++ join_params->params.chanspec_num * sizeof(chanspec_t); ++ ++ join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; ++ join_params->params.chanspec_list[0] |= chanspec; ++ join_params->params.chanspec_list[0] = ++ wl_ext_chspec_host_to_driver(apsta_params->ioctl_ver, ++ join_params->params.chanspec_list[0]); ++ ++ join_params->params.chanspec_num = ++ htod32(join_params->params.chanspec_num); ++ ANDROID_TRACE(("join_params->params.chanspec_list[0]= %X, %d channels\n", ++ join_params->params.chanspec_list[0], ++ join_params->params.chanspec_num)); ++ } ++} ++ ++static s32 ++wl_ext_connect(struct wl_if_info *cur_if) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ wl_extjoin_params_t *ext_join_params; ++ struct wl_join_params join_params; ++ size_t join_params_size; ++ s32 err = 0; ++ u32 chan_cnt = 0; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ ++ if (cur_if->channel) { ++ chan_cnt = 1; ++ } ++ ++ /* ++ * Join with specific BSSID and cached SSID ++ * If SSID is zero join based on BSSID only ++ */ ++ join_params_size = WL_EXTJOIN_PARAMS_FIXED_SIZE + ++ chan_cnt * sizeof(chanspec_t); ++ ext_join_params = (wl_extjoin_params_t*)kzalloc(join_params_size, GFP_KERNEL); ++ if (ext_join_params == NULL) { ++ err = -ENOMEM; ++ goto exit; ++ } ++ ext_join_params->ssid.SSID_len = min(sizeof(ext_join_params->ssid.SSID), ++ strlen(cur_if->ssid)); ++ memcpy(&ext_join_params->ssid.SSID, cur_if->ssid, ext_join_params->ssid.SSID_len); ++ ext_join_params->ssid.SSID_len = htod32(ext_join_params->ssid.SSID_len); ++ /* increate dwell time to receive probe response or detect Beacon ++ * from target AP at a noisy air only during connect command ++ */ ++ ext_join_params->scan.active_time = chan_cnt ? WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS : -1; ++ ext_join_params->scan.passive_time = chan_cnt ? WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS : -1; ++ /* Set up join scan parameters */ ++ ext_join_params->scan.scan_type = -1; ++ ext_join_params->scan.nprobes = chan_cnt ? ++ (ext_join_params->scan.active_time/WL_SCAN_JOIN_PROBE_INTERVAL_MS) : -1; ++ ext_join_params->scan.home_time = -1; ++ ++ if (memcmp(ðer_null, &cur_if->bssid, ETHER_ADDR_LEN)) ++ memcpy(&ext_join_params->assoc.bssid, &cur_if->bssid, ETH_ALEN); ++ else ++ memcpy(&ext_join_params->assoc.bssid, ðer_bcast, ETH_ALEN); ++ ext_join_params->assoc.chanspec_num = chan_cnt; ++ if (chan_cnt) { ++ u16 channel, band, bw, ctl_sb; ++ chanspec_t chspec; ++ channel = cur_if->channel; ++ band = (channel <= CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G ++ : WL_CHANSPEC_BAND_5G; ++ bw = WL_CHANSPEC_BW_20; ++ ctl_sb = WL_CHANSPEC_CTL_SB_NONE; ++ chspec = (channel | band | bw | ctl_sb); ++ ext_join_params->assoc.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; ++ ext_join_params->assoc.chanspec_list[0] |= chspec; ++ ext_join_params->assoc.chanspec_list[0] = ++ wl_ext_chspec_host_to_driver(apsta_params->ioctl_ver, ++ ext_join_params->assoc.chanspec_list[0]); ++ } ++ ext_join_params->assoc.chanspec_num = htod32(ext_join_params->assoc.chanspec_num); ++ if (ext_join_params->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { ++ ANDROID_INFO(("ssid \"%s\", len (%d)\n", ext_join_params->ssid.SSID, ++ ext_join_params->ssid.SSID_len)); ++ } ++ ++ err = wl_ext_iovar_setbuf_bsscfg(cur_if->dev, "join", ext_join_params, ++ join_params_size, iovar_buf, WLC_IOCTL_SMLEN, cur_if->bssidx, NULL); ++ ++ printf("Connecting with " MACDBG " channel (%d) ssid \"%s\", len (%d)\n\n", ++ MAC2STRDBG((u8*)(&ext_join_params->assoc.bssid)), cur_if->channel, ++ ext_join_params->ssid.SSID, ext_join_params->ssid.SSID_len); ++ ++ kfree(ext_join_params); ++ if (err) { ++ if (err == BCME_UNSUPPORTED) { ++ ANDROID_TRACE(("join iovar is not supported\n")); ++ goto set_ssid; ++ } else { ++ ANDROID_ERROR(("error (%d)\n", err)); ++ goto exit; ++ } ++ } else ++ goto exit; ++ ++set_ssid: ++ memset(&join_params, 0, sizeof(join_params)); ++ join_params_size = sizeof(join_params.ssid); ++ ++ join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), strlen(cur_if->ssid)); ++ memcpy(&join_params.ssid.SSID, cur_if->ssid, join_params.ssid.SSID_len); ++ join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len); ++ if (memcmp(ðer_null, &cur_if->bssid, ETHER_ADDR_LEN)) ++ memcpy(&join_params.params.bssid, &cur_if->bssid, ETH_ALEN); ++ else ++ memcpy(&join_params.params.bssid, ðer_bcast, ETH_ALEN); ++ ++ wl_ext_ch_to_chanspec(cur_if->channel, &join_params, &join_params_size); ++ ANDROID_TRACE(("join_param_size %zu\n", join_params_size)); ++ ++ if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { ++ ANDROID_INFO(("ssid \"%s\", len (%d)\n", join_params.ssid.SSID, ++ join_params.ssid.SSID_len)); ++ } ++ err = wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &join_params,join_params_size, 1); ++ if (err) { ++ ANDROID_ERROR(("error (%d)\n", err)); ++ } ++ ++exit: ++ return err; ++ ++} ++ ++static void ++wl_ext_wait_netif_change(struct wl_apsta_params *apsta_params, ++ bool need_rtnl_unlock) ++{ ++ if (need_rtnl_unlock) ++ rtnl_unlock(); ++ wait_event_interruptible_timeout(apsta_params->netif_change_event, ++ apsta_params->netif_change, msecs_to_jiffies(1500)); ++ if (need_rtnl_unlock) ++ rtnl_lock(); ++} ++ ++static void ++wl_ext_iapsta_preinit(struct net_device *dev, struct wl_apsta_params *apsta_params) ++{ ++ struct dhd_pub *dhd; ++ apstamode_t apstamode = apsta_params->apstamode; ++ wl_interface_create_t iface; ++ struct wl_if_info *cur_if; ++ wlc_ssid_t ssid = { 0, {0} }; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ wl_country_t cspec = {{0}, 0, {0}}; ++ wl_p2p_if_t ifreq; ++ s32 val = 0; ++ int i, dfs = 1; ++ ++ dhd = dhd_get_pub(dev); ++ ++ for (i=0; iif_info[i]; ++ if (i == 1 && !strlen(cur_if->ifname)) ++ strcpy(cur_if->ifname, "wlan1"); ++ if (i == 2 && !strlen(cur_if->ifname)) ++ strcpy(cur_if->ifname, "wlan2"); ++ if (cur_if->ifmode == ISTA_MODE) { ++ cur_if->channel = 0; ++ cur_if->maxassoc = -1; ++ cur_if->ifstate = IF_STATE_INIT; ++ cur_if->prio = PRIO_STA; ++ cur_if->prefix = 'S'; ++ snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_sta"); ++ } else if (cur_if->ifmode == IAP_MODE) { ++ cur_if->channel = 1; ++ cur_if->maxassoc = -1; ++ cur_if->ifstate = IF_STATE_INIT; ++ cur_if->prio = PRIO_AP; ++ cur_if->prefix = 'A'; ++ snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_ap"); ++ dfs = 0; ++ } else if (cur_if->ifmode == IMESH_MODE) { ++ cur_if->channel = 1; ++ cur_if->maxassoc = -1; ++ cur_if->ifstate = IF_STATE_INIT; ++ cur_if->prio = PRIO_MESH; ++ cur_if->prefix = 'M'; ++ snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_mesh"); ++ dfs = 0; ++ } ++ } ++ if (dfs == 0) { ++ dhd_conf_get_country(dhd, &cspec); ++ if (!dhd_conf_map_country_list(dhd, &cspec, 1)) { ++ dhd_conf_set_country(dhd, &cspec); ++ dhd_bus_country_set(dev, &cspec, TRUE); ++ } ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "dfs_chan_disable", 1); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } ++ ++ if (apstamode == IMESHONLY_MODE || apstamode == IMESHSTA_MODE || ++ apstamode == IMESHAP_MODE || apstamode == IMESHAPSTA_MODE || ++ apstamode == IMESHAPAP_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ if (FW_SUPPORTED(dhd, rsdb)) { ++ wl_config_t rsdb_mode_cfg = {1, 0}; ++ if (apsta_params->rsdb == 0) { ++ rsdb_mode_cfg.config = 0; ++ } ++ // mesh-ap must set rsdb_mode=1 in same channel or AP mode not easy to be found ++ printf("%s: set rsdb_mode %d\n", __FUNCTION__, rsdb_mode_cfg.config); ++ wl_ext_iovar_setbuf(dev, "rsdb_mode", &rsdb_mode_cfg, ++ sizeof(rsdb_mode_cfg), iovar_buf, sizeof(iovar_buf), NULL); ++ } ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } ++ ++ if (apstamode == ISTAONLY_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "apsta", 1); // keep 1 as we set in dhd_preinit_ioctls ++ // don't set WLC_SET_AP to 0, some parameters will be reset, such as bcn_timeout and roam_off ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } else if (apstamode == IAPONLY_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++#ifdef ARP_OFFLOAD_SUPPORT ++ /* IF SoftAP is enabled, disable arpoe */ ++ dhd_arp_offload_set(dhd, 0); ++ dhd_arp_offload_enable(dhd, FALSE); ++#endif /* ARP_OFFLOAD_SUPPORT */ ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "apsta", 0); ++ val = 1; ++ wl_ext_ioctl(dev, WLC_SET_AP, &val, sizeof(val), 1); ++#ifdef PROP_TXSTATUS_VSDB ++#if defined(BCMSDIO) ++ if (!FW_SUPPORTED(dhd, rsdb) && !disable_proptx) { ++ bool enabled; ++ dhd_wlfc_get_enable(dhd, &enabled); ++ if (!enabled) { ++ dhd_wlfc_init(dhd); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } ++ } ++#endif ++#endif /* PROP_TXSTATUS_VSDB */ ++ } ++ else if (apstamode == IAPSTA_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "apsta", 1); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ apsta_params->netif_change = FALSE; ++ if (FW_SUPPORTED(dhd, rsdb)) { ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, ++ sizeof(iface), iovar_buf, WLC_IOCTL_SMLEN, 1, NULL); ++ } else { ++ wl_ext_iovar_setbuf_bsscfg(dev, "ssid", &ssid, sizeof(ssid), ++ iovar_buf, WLC_IOCTL_SMLEN, 1, NULL); ++ } ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ else if (apstamode == IDUALAP_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ /* IF SoftAP is enabled, disable arpoe or wlan1 will ping fail */ ++#ifdef ARP_OFFLOAD_SUPPORT ++ /* IF SoftAP is enabled, disable arpoe */ ++ dhd_arp_offload_set(dhd, 0); ++ dhd_arp_offload_enable(dhd, FALSE); ++#endif /* ARP_OFFLOAD_SUPPORT */ ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "mbcn", 1); ++ wl_ext_iovar_setint(dev, "apsta", 0); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ val = 1; ++ wl_ext_ioctl(dev, WLC_SET_AP, &val, sizeof(val), 1); ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 1, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ else if (apstamode == IMESHONLY_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "apsta", 1); // keep 1 as we set in dhd_preinit_ioctls ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ // don't set WLC_SET_AP to 0, some parameters will be reset, such as bcn_timeout and roam_off ++ } ++ else if (apstamode == IMESHSTA_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "mbcn", 1); ++ wl_ext_iovar_setint(dev, "apsta", 1); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_STA; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 0, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ else if (apstamode == IMESHAP_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "mbcn", 1); ++ wl_ext_iovar_setint(dev, "apsta", 1); // keep 1 as we set in dhd_preinit_ioctls ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ // don't set WLC_SET_AP to 0, some parameters will be reset, such as bcn_timeout and roam_off ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 0, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ else if (apstamode == IMESHAPSTA_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "mbcn", 1); ++ wl_ext_iovar_setint(dev, "apsta", 1); // keep 1 as we set in dhd_preinit_ioctls ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ // don't set WLC_SET_AP to 0, some parameters will be reset, such as bcn_timeout and roam_off ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 0, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_STA; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 0, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ else if (apstamode == IMESHAPAP_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ wl_ext_iovar_setint(dev, "mbcn", 1); ++ wl_ext_iovar_setint(dev, "apsta", 1); // keep 1 as we set in dhd_preinit_ioctls ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ // don't set WLC_SET_AP to 0, some parameters will be reset, such as bcn_timeout and roam_off ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 0, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_getbuf_bsscfg(dev, "interface_create", &iface, sizeof(iface), ++ iovar_buf, WLC_IOCTL_SMLEN, 0, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ else if (apstamode == IGOSTA_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_iovar_setint(dev, "apsta", 1); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ bzero(&ifreq, sizeof(wl_p2p_if_t)); ++ ifreq.type = htod32(WL_P2P_IF_GO); ++ apsta_params->netif_change = FALSE; ++ wl_ext_iovar_setbuf(dev, "p2p_ifadd", &ifreq, sizeof(ifreq), ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ wl_ext_wait_netif_change(apsta_params, TRUE); ++ } ++ ++ wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver); ++ apsta_params->init = TRUE; ++ ++ printf("%s: apstamode=%d\n", __FUNCTION__, apstamode); ++} ++ ++static int ++wl_ext_isam_init(struct net_device *dev, char *command, int total_len) ++{ ++ char *pch, *pick_tmp, *pick_tmp2, *param; ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct dhd_pub *dhd; ++ int i; ++ ++ if (apsta_params->init) { ++ ANDROID_ERROR(("%s: don't init twice\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ dhd = dhd_get_pub(dev); ++ ++ ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); ++ ++ pick_tmp = command; ++ param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_init ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ while (param != NULL) { ++ if (!strcmp(param, "mode")) { ++ pch = NULL; ++ pick_tmp2 = bcmstrtok(&pick_tmp, " ", 0); ++ if (pick_tmp2) { ++ if (!strcmp(pick_tmp2, "sta")) { ++ apsta_params->apstamode = ISTAONLY_MODE; ++ } else if (!strcmp(pick_tmp2, "ap")) { ++ apsta_params->apstamode = IAPONLY_MODE; ++ } else if (!strcmp(pick_tmp2, "sta-ap")) { ++ apsta_params->apstamode = IAPSTA_MODE; ++ } else if (!strcmp(pick_tmp2, "ap-ap")) { ++ apsta_params->apstamode = IDUALAP_MODE; ++ } else if (!strcmp(pick_tmp2, "mesh")) { ++ apsta_params->apstamode = IMESHONLY_MODE; ++ } else if (!strcmp(pick_tmp2, "mesh-sta") || ++ !strcmp(pick_tmp2, "sta-mesh")) { ++ apsta_params->apstamode = IMESHSTA_MODE; ++ } else if (!strcmp(pick_tmp2, "mesh-ap") || ++ !strcmp(pick_tmp2, "ap-mesh")) { ++ apsta_params->apstamode = IMESHAP_MODE; ++ } else if (!strcmp(pick_tmp2, "mesh-ap-sta") || ++ !strcmp(pick_tmp2, "sta-ap-mesh") || ++ !strcmp(pick_tmp2, "sta-mesh-ap")) { ++ apsta_params->apstamode = IMESHAPSTA_MODE; ++ } else if (!strcmp(pick_tmp2, "mesh-ap-ap") || ++ !strcmp(pick_tmp2, "ap-ap-mesh")) { ++ apsta_params->apstamode = IMESHAPAP_MODE; ++ } else if (!strcmp(pick_tmp2, "apsta")) { ++ apsta_params->apstamode = IAPSTA_MODE; ++ apsta_params->if_info[IF_PIF].ifmode = ISTA_MODE; ++ apsta_params->if_info[IF_VIF].ifmode = IAP_MODE; ++ } else if (!strcmp(pick_tmp2, "dualap")) { ++ apsta_params->apstamode = IDUALAP_MODE; ++ apsta_params->if_info[IF_PIF].ifmode = IAP_MODE; ++ apsta_params->if_info[IF_VIF].ifmode = IAP_MODE; ++ } else if (!strcmp(pick_tmp2, "gosta")) { ++ if (!FW_SUPPORTED(dhd, p2p)) { ++ return -1; ++ } ++ apsta_params->apstamode = IGOSTA_MODE; ++ apsta_params->if_info[IF_PIF].ifmode = ISTA_MODE; ++ apsta_params->if_info[IF_VIF].ifmode = IAP_MODE; ++ } else { ++ ANDROID_ERROR(("%s: mode [sta|ap|sta-ap|ap-ap]\n", __FUNCTION__)); ++ return -1; ++ } ++ pch = bcmstrtok(&pick_tmp2, " -", 0); ++ for (i=0; iif_info[i].ifmode = ISTA_MODE; ++ else if (!strcmp(pch, "ap")) ++ apsta_params->if_info[i].ifmode = IAP_MODE; ++ else if (!strcmp(pch, "mesh")) { ++ if (dhd->conf->fw_type != FW_TYPE_MESH) { ++ ANDROID_ERROR(("%s: wrong fw type\n", __FUNCTION__)); ++ return -1; ++ } ++ apsta_params->if_info[i].ifmode = IMESH_MODE; ++ } ++ pch = bcmstrtok(&pick_tmp2, " -", 0); ++ } ++ } ++ } ++ else if (!strcmp(param, "rsdb")) { ++ pch = bcmstrtok(&pick_tmp, " ", 0); ++ if (pch) { ++ if (!strcmp(pch, "y")) { ++ apsta_params->rsdb = TRUE; ++ } else if (!strcmp(pch, "n")) { ++ apsta_params->rsdb = FALSE; ++ } else { ++ ANDROID_ERROR(("%s: rsdb [y|n]\n", __FUNCTION__)); ++ return -1; ++ } ++ } ++ } else if (!strcmp(param, "vsdb")) { ++ pch = bcmstrtok(&pick_tmp, " ", 0); ++ if (pch) { ++ if (!strcmp(pch, "y")) { ++ apsta_params->vsdb = TRUE; ++ } else if (!strcmp(pch, "n")) { ++ apsta_params->vsdb = FALSE; ++ } else { ++ ANDROID_ERROR(("%s: vsdb [y|n]\n", __FUNCTION__)); ++ return -1; ++ } ++ } ++ } else if (!strcmp(param, "csa")) { ++ pch = bcmstrtok(&pick_tmp, " ", 0); ++ if (pch) { ++ apsta_params->csa = (int)simple_strtol(pch, NULL, 0); ++ } ++ } else if (!strcmp(param, "ifname")) { ++ pch = NULL; ++ pick_tmp2 = bcmstrtok(&pick_tmp, " ", 0); ++ if (pick_tmp2) ++ pch = bcmstrtok(&pick_tmp2, " -", 0); ++ for (i=0; iif_info[i].ifname, pch); ++ pch = bcmstrtok(&pick_tmp2, " -", 0); ++ } ++ } else if (!strcmp(param, "vifname")) { ++ pch = bcmstrtok(&pick_tmp, " ", 0); ++ if (pch) ++ strcpy(apsta_params->if_info[IF_VIF].ifname, pch); ++ else { ++ ANDROID_ERROR(("%s: vifname [wlan1]\n", __FUNCTION__)); ++ return -1; ++ } ++ } ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ } ++ ++ if (apsta_params->apstamode == 0) { ++ ANDROID_ERROR(("%s: mode [sta|ap|sta-ap|ap-ap]\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ wl_ext_iapsta_preinit(dev, apsta_params); ++ ++ return 0; ++} ++ ++static int ++wl_ext_parse_config(struct wl_if_info *cur_if, char *command, char **pick_next) ++{ ++ char *pch, *pick_tmp; ++ char name[20], data[100]; ++ int i, j, len; ++ char *ifname_head = NULL; ++ ++ typedef struct config_map_t { ++ char name[20]; ++ char *head; ++ char *tail; ++ } config_map_t; ++ ++ config_map_t config_map [] = { ++ {" ifname ", NULL, NULL}, ++ {" ssid ", NULL, NULL}, ++ {" bssid ", NULL, NULL}, ++ {" bgnmode ", NULL, NULL}, ++ {" hidden ", NULL, NULL}, ++ {" maxassoc ", NULL, NULL}, ++ {" chan ", NULL, NULL}, ++ {" amode ", NULL, NULL}, ++ {" emode ", NULL, NULL}, ++ {" key ", NULL, NULL}, ++ }; ++ config_map_t *row, *row_prev; ++ ++ pick_tmp = command; ++ ++ // reset head and tail ++ for (i = 0; i < sizeof(config_map)/sizeof(config_map[0]); i++) { ++ row = &config_map[i]; ++ row->head = NULL; ++ row->tail = pick_tmp + strlen(pick_tmp); ++ } ++ ++ // pick head ++ for (i = 0; i < sizeof(config_map)/sizeof(config_map[0]); i++) { ++ row = &config_map[i]; ++ pch = strstr(pick_tmp, row->name); ++ if (pch) { ++ row->head = pch; ++ } ++ } ++ ++ // sort by head ++ for (i = 0; i < sizeof(config_map)/sizeof(config_map[0]) - 1; i++) { ++ row_prev = &config_map[i]; ++ for (j = i+1; j < sizeof(config_map)/sizeof(config_map[0]); j++) { ++ row = &config_map[j]; ++ if (row->head < row_prev->head) { ++ strcpy(name, row_prev->name); ++ strcpy(row_prev->name, row->name); ++ strcpy(row->name, name); ++ pch = row_prev->head; ++ row_prev->head = row->head; ++ row->head = pch; ++ } ++ } ++ } ++ ++ // pick tail ++ for (i = 0; i < sizeof(config_map)/sizeof(config_map[0]) - 1; i++) { ++ row_prev = &config_map[i]; ++ row = &config_map[i+1]; ++ if (row_prev->head) { ++ row_prev->tail = row->head; ++ } ++ } ++ ++ // remove name from head ++ for (i = 0; i < sizeof(config_map)/sizeof(config_map[0]); i++) { ++ row = &config_map[i]; ++ if (row->head) { ++ if (!strcmp(row->name, " ifname ")) { ++ ifname_head = row->head + 1; ++ break; ++ } ++ row->head += strlen(row->name); ++ } ++ } ++ ++ for (i = 0; i < sizeof(config_map)/sizeof(config_map[0]); i++) { ++ row = &config_map[i]; ++ if (row->head) { ++ memset(data, 0, sizeof(data)); ++ if (row->tail && row->tail > row->head) { ++ strncpy(data, row->head, row->tail-row->head); ++ } else { ++ strcpy(data, row->head); ++ } ++ pick_tmp = data; ++ ++ if (!strcmp(row->name, " ifname ")) { ++ break; ++ } else if (!strcmp(row->name, " ssid ")) { ++ len = strlen(pick_tmp); ++ memset(cur_if->ssid, 0, sizeof(cur_if->ssid)); ++ if (pick_tmp[0] == '"' && pick_tmp[len-1] == '"') ++ strncpy(cur_if->ssid, &pick_tmp[1], len-2); ++ else ++ strcpy(cur_if->ssid, pick_tmp); ++ } else if (!strcmp(row->name, " bssid ")) { ++ pch = bcmstrtok(&pick_tmp, ": ", 0); ++ for (j=0; j<6 && pch; j++) { ++ ((u8 *)&cur_if->bssid)[j] = (int)simple_strtol(pch, NULL, 16); ++ pch = bcmstrtok(&pick_tmp, ": ", 0); ++ } ++ } else if (!strcmp(row->name, " bgnmode ")) { ++ if (!strcmp(pick_tmp, "b")) ++ cur_if->bgnmode = IEEE80211B; ++ else if (!strcmp(pick_tmp, "g")) ++ cur_if->bgnmode = IEEE80211G; ++ else if (!strcmp(pick_tmp, "bg")) ++ cur_if->bgnmode = IEEE80211BG; ++ else if (!strcmp(pick_tmp, "bgn")) ++ cur_if->bgnmode = IEEE80211BGN; ++ else if (!strcmp(pick_tmp, "bgnac")) ++ cur_if->bgnmode = IEEE80211BGNAC; ++ else { ++ ANDROID_ERROR(("%s: bgnmode [b|g|bg|bgn|bgnac]\n", __FUNCTION__)); ++ return -1; ++ } ++ } else if (!strcmp(row->name, " hidden ")) { ++ if (!strcmp(pick_tmp, "n")) ++ cur_if->hidden = 0; ++ else if (!strcmp(pick_tmp, "y")) ++ cur_if->hidden = 1; ++ else { ++ ANDROID_ERROR(("%s: hidden [y|n]\n", __FUNCTION__)); ++ return -1; ++ } ++ } else if (!strcmp(row->name, " maxassoc ")) { ++ cur_if->maxassoc = (int)simple_strtol(pick_tmp, NULL, 10); ++ } else if (!strcmp(row->name, " chan ")) { ++ cur_if->channel = (int)simple_strtol(pick_tmp, NULL, 10); ++ } else if (!strcmp(row->name, " amode ")) { ++ if (!strcmp(pick_tmp, "open")) ++ cur_if->amode = AUTH_OPEN; ++ else if (!strcmp(pick_tmp, "shared")) ++ cur_if->amode = AUTH_SHARED; ++ else if (!strcmp(pick_tmp, "wpapsk")) ++ cur_if->amode = AUTH_WPAPSK; ++ else if (!strcmp(pick_tmp, "wpa2psk")) ++ cur_if->amode = AUTH_WPA2PSK; ++ else if (!strcmp(pick_tmp, "wpawpa2psk")) ++ cur_if->amode = AUTH_WPAWPA2PSK; ++ else if (!strcmp(pick_tmp, "sae")) ++ cur_if->amode = AUTH_SAE; ++ else { ++ ANDROID_ERROR(("%s: amode [open|shared|wpapsk|wpa2psk|wpawpa2psk]\n", ++ __FUNCTION__)); ++ return -1; ++ } ++ } else if (!strcmp(row->name, " emode ")) { ++ if (!strcmp(pick_tmp, "none")) ++ cur_if->emode = ENC_NONE; ++ else if (!strcmp(pick_tmp, "wep")) ++ cur_if->emode = ENC_WEP; ++ else if (!strcmp(pick_tmp, "tkip")) ++ cur_if->emode = ENC_TKIP; ++ else if (!strcmp(pick_tmp, "aes")) ++ cur_if->emode = ENC_AES; ++ else if (!strcmp(pick_tmp, "tkipaes")) ++ cur_if->emode = ENC_TKIPAES; ++ else { ++ ANDROID_ERROR(("%s: emode [none|wep|tkip|aes|tkipaes]\n", ++ __FUNCTION__)); ++ return -1; ++ } ++ } else if (!strcmp(row->name, " key ")) { ++ len = strlen(pick_tmp); ++ memset(cur_if->key, 0, sizeof(cur_if->key)); ++ if (pick_tmp[0] == '"' && pick_tmp[len-1] == '"') ++ strncpy(cur_if->key, &pick_tmp[1], len-2); ++ else ++ strcpy(cur_if->key, pick_tmp); ++ } ++ } ++ } ++ ++ *pick_next = ifname_head; ++ return 0; ++} ++ ++static int ++wl_ext_iapsta_config(struct net_device *dev, char *command, int total_len) ++{ ++ int ret=0, i; ++ char *pch, *pch2, *pick_tmp, *pick_next=NULL, *param; ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ char ifname[IFNAMSIZ+1]; ++ struct wl_if_info *cur_if = NULL; ++ ++ if (!apsta_params->init) { ++ ANDROID_ERROR(("%s: please init first\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); ++ ++ pick_tmp = command; ++ param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_config ++ ++ while (pick_tmp != NULL) { ++ memset(ifname, 0, IFNAMSIZ+1); ++ if (!strncmp(pick_tmp, "ifname ", strlen("ifname "))) { ++ pch = pick_tmp + strlen("ifname "); ++ pch2 = strchr(pch, ' '); ++ if (pch && pch2) { ++ strncpy(ifname, pch, pch2-pch); ++ } else { ++ ANDROID_ERROR(("%s: ifname [wlanX]\n", __FUNCTION__)); ++ return -1; ++ } ++ for (i=0; iif_info[i].dev && ++ !strcmp(apsta_params->if_info[i].dev->name, ifname)) { ++ cur_if = &apsta_params->if_info[i]; ++ break; ++ } ++ } ++ if (!cur_if) { ++ ANDROID_ERROR(("%s: wrong ifname=%s in apstamode=%d\n", __FUNCTION__, ++ ifname, apsta_params->apstamode)); ++ return -1; ++ } ++ ret = wl_ext_parse_config(cur_if, pick_tmp, &pick_next); ++ if (ret) ++ return -1; ++ pick_tmp = pick_next; ++ } else { ++ ANDROID_ERROR(("%s: first arg must be ifname\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ } ++ ++ return 0; ++} ++ ++static int ++wl_ext_iapsta_disable(struct net_device *dev, char *command, int total_len) ++{ ++ char *pch, *pick_tmp, *param; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ wlc_ssid_t ssid = { 0, {0} }; ++ scb_val_t scbval; ++ struct { ++ s32 tmp; ++ s32 cfg; ++ s32 val; ++ } bss_setbuf; ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ apstamode_t apstamode = apsta_params->apstamode; ++ char ifname[IFNAMSIZ+1]; ++ struct wl_if_info *cur_if = NULL; ++ struct dhd_pub *dhd; ++ int i; ++ ++ if (!apsta_params->init) { ++ ANDROID_ERROR(("%s: please init first\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); ++ dhd = dhd_get_pub(dev); ++ ++ pick_tmp = command; ++ param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_disable ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ while (param != NULL) { ++ if (!strcmp(param, "ifname")) { ++ pch = bcmstrtok(&pick_tmp, " ", 0); ++ if (pch) ++ strcpy(ifname, pch); ++ else { ++ ANDROID_ERROR(("%s: ifname [wlanX]\n", __FUNCTION__)); ++ return -1; ++ } ++ } ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ } ++ ++ for (i=0; iif_info[i].dev && ++ !strcmp(apsta_params->if_info[i].dev->name, ifname)) { ++ cur_if = &apsta_params->if_info[i]; ++ break; ++ } ++ } ++ if (!cur_if) { ++ ANDROID_ERROR(("%s: wrong ifname=%s or dev not ready\n", __FUNCTION__, ifname)); ++ return -1; ++ } ++ ++ printf("%s: Disabling %s\n", __FUNCTION__, ifname); ++ ++ if (cur_if->ifmode == ISTA_MODE) { ++ wl_ext_ioctl(cur_if->dev, WLC_DISASSOC, NULL, 0, 1); ++ } else if (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IMESH_MODE) { ++ // deauthenticate all STA first ++ memcpy(scbval.ea.octet, ðer_bcast, ETHER_ADDR_LEN); ++ wl_ext_ioctl(cur_if->dev, WLC_SCB_DEAUTHENTICATE, &scbval.ea, ETHER_ADDR_LEN, 1); ++ } ++ ++ if (apstamode == IAPONLY_MODE || apstamode == IMESHONLY_MODE) { ++ wl_ext_ioctl(dev, WLC_DOWN, NULL, 0, 1); ++ wl_ext_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); // reset ssid ++ wl_ext_iovar_setint(dev, "mpc", 1); ++ } else if ((apstamode==IAPSTA_MODE || apstamode==IGOSTA_MODE) && ++ cur_if->ifmode == IAP_MODE) { ++ bss_setbuf.tmp = 0xffffffff; ++ bss_setbuf.cfg = 0; // must be 0, or wlan1 can not be down ++ bss_setbuf.val = htod32(0); ++ wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, sizeof(bss_setbuf), ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ wl_ext_iovar_setint(dev, "mpc", 1); ++#ifdef ARP_OFFLOAD_SUPPORT ++ /* IF SoftAP is disabled, enable arpoe back for STA mode. */ ++ dhd_arp_offload_set(dhd, dhd_arp_mode); ++ dhd_arp_offload_enable(dhd, TRUE); ++#endif /* ARP_OFFLOAD_SUPPORT */ ++#ifdef PROP_TXSTATUS_VSDB ++#if defined(BCMSDIO) ++ if (dhd->conf->disable_proptx!=0) { ++ bool enabled; ++ dhd_wlfc_get_enable(dhd, &enabled); ++ if (enabled) { ++ dhd_wlfc_deinit(dhd); ++ } ++ } ++#endif ++#endif /* PROP_TXSTATUS_VSDB */ ++ } else if (apstamode == IDUALAP_MODE) { ++ bss_setbuf.tmp = 0xffffffff; ++ bss_setbuf.cfg = 0; // must be 0, or wlan1 can not be down ++ bss_setbuf.val = htod32(0); ++ wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, sizeof(bss_setbuf), ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ } else if (apstamode == IMESHSTA_MODE || apstamode == IMESHAP_MODE || ++ apstamode == IMESHAPSTA_MODE || apstamode == IMESHAPAP_MODE) { ++ bss_setbuf.tmp = 0xffffffff; ++ bss_setbuf.cfg = 0; // must be 0, or wlan1 can not be down ++ bss_setbuf.val = htod32(0); ++ wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, sizeof(bss_setbuf), ++ iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ } ++ ++ cur_if->ifstate = IF_STATE_DISALBE; ++ ++ printf("%s: disabled %s SSID: \"%s\"\n", __FUNCTION__, ifname, cur_if->ssid); ++ ++ return 0; ++} ++ ++static uint16 ++wl_ext_get_chan(struct net_device *dev) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ int ret = 0; ++ uint16 chan = 0, ctl_chan; ++ struct ether_addr bssid; ++ u32 chanspec = 0; ++ ++ ret = wldev_ioctl(dev, WLC_GET_BSSID, &bssid, sizeof(bssid), 0); ++ if (ret != BCME_NOTASSOCIATED && memcmp(ðer_null, &bssid, ETHER_ADDR_LEN)) { ++ if (wldev_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK) { ++ chanspec = wl_ext_chspec_driver_to_host(apsta_params->ioctl_ver, chanspec); ++ ctl_chan = wf_chspec_ctlchan(chanspec); ++ chan = (u16)(ctl_chan & 0x00FF); ++ ANDROID_INFO(("%s: cur_chan=%d(0x%x)\n", __FUNCTION__, ++ chan, chanspec)); ++ return chan; ++ } ++ } ++ ++ return 0; ++} ++ ++static uint16 ++wl_ext_get_vsdb_chan(struct net_device *dev, ++ struct wl_if_info *cur_if, struct wl_if_info *another_if) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ uint16 another_chan = 0, cur_chan = cur_if->channel; ++ struct dhd_pub *dhd; ++ ++ dhd = dhd_get_pub(dev); ++ ++ another_chan = wl_ext_get_chan(another_if->dev); ++ if (another_chan) { ++ ANDROID_INFO(("%s: cur_chan=%d, another_chan=%d\n", ++ __FUNCTION__, cur_chan, another_chan)); ++ if ((cur_chan <= CH_MAX_2G_CHANNEL && another_chan > CH_MAX_2G_CHANNEL) || ++ (cur_chan > CH_MAX_2G_CHANNEL && another_chan <= CH_MAX_2G_CHANNEL)) { ++ // different band ++ if (!FW_SUPPORTED(dhd, rsdb) || !apsta_params->rsdb) ++ return another_chan; ++ } else { ++ // same band ++ if (another_chan != cur_chan) ++ return another_chan; ++ } ++ } ++ ++ return 0; ++} ++ ++static int ++wl_ext_triger_csa(struct wl_if_info *cur_if) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ ++ if (apsta_params->csa & CSA_DRV_BIT && ++ (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IMESH_MODE)) { ++ wl_chan_switch_t csa_arg; ++ memset(&csa_arg, 0, sizeof(csa_arg)); ++ csa_arg.mode = 1; ++ csa_arg.count = 3; ++ csa_arg.chspec = wl_ext_get_chanspec(cur_if->dev, cur_if->channel); ++ printf("%s: Trigger CSA to channel %d\n", __FUNCTION__, cur_if->channel); ++ wl_ext_iovar_setbuf(cur_if->dev, "csa", &csa_arg, sizeof(csa_arg), ++ iovar_buf, sizeof(iovar_buf), NULL); ++ OSL_SLEEP(500); ++ } ++ ++ return 0; ++} ++ ++static void ++wl_ext_move_channel(struct wl_if_info *cur_if, uint16 chan) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ ++ if (chan) { ++ char cmd[32] = ""; ++ cur_if->channel = chan; ++ if (apsta_params->csa == 0) { ++ printf("%s: %s deauthenticate all STA and move to channel %d\n", ++ __FUNCTION__, cur_if->ifname, chan); ++ snprintf(cmd, 32, "%s %s", "isam_disable ifname", cur_if->ifname); ++ wl_ext_iapsta_disable(cur_if->dev, cmd, strlen(cmd)); ++ ++ snprintf(cmd, 32, "%s %s", "isam_enable ifname", cur_if->ifname); ++ wl_ext_iapsta_enable(cur_if->dev, cmd, strlen(cmd)); ++ } else { ++ wl_ext_triger_csa(cur_if); ++ } ++ } ++} ++ ++static uint16 ++wl_ext_move_cur_channel(struct net_device *dev, ++ struct wl_if_info *cur_if) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct wl_if_info *another_if, *final_if = NULL; ++ uint16 new_chan = 0; ++ wl_prio_t cur_prio; ++ int i; ++ ++ if (apsta_params->vsdb) { ++ return cur_if->channel; ++ } ++ ++ // find the max prio ++ cur_prio = cur_if->prio; ++ for (i=0; iif_info[i]; ++ if (another_if->ifstate >= IF_STATE_INIT && cur_if != another_if && ++ another_if->prio > cur_prio) { ++ new_chan = wl_ext_get_vsdb_chan(dev, cur_if, another_if); ++ if (new_chan) { ++ final_if = another_if; ++ cur_prio = another_if->prio; ++ } ++ } ++ } ++ ++ if (new_chan) { ++ printf("%s: %s channel=%d => %s channel=%d\n", __FUNCTION__, ++ cur_if->ifname, cur_if->channel, final_if->ifname, new_chan); ++ cur_if->channel = new_chan; ++ } ++ ++ return cur_if->channel; ++} ++ ++static void ++wl_ext_move_other_channel(struct net_device *dev, ++ struct wl_if_info *cur_if) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct wl_if_info *another_if, *final_if=NULL; ++ uint16 new_chan = 0; ++ wl_prio_t prio = 0, cur_prio; ++ int i; ++ ++ if (apsta_params->vsdb) { ++ return; ++ } ++ ++ // find the max prio, but lower than cur_if ++ cur_prio = cur_if->prio; ++ for (i=0; iif_info[i]; ++ if (another_if->ifstate >= IF_STATE_INIT && cur_if != another_if && ++ another_if->prio >= prio && another_if->prio < cur_prio) { ++ new_chan = wl_ext_get_vsdb_chan(dev, cur_if, another_if); ++ if (new_chan) { ++ final_if = another_if; ++ prio = another_if->prio; ++ } ++ } ++ } ++ ++ if (new_chan) { ++ printf("%s: %s channel=%d => %s channel=%d\n", __FUNCTION__, ++ final_if->ifname, final_if->channel, cur_if->ifname, cur_if->channel); ++ wl_ext_move_channel(final_if, cur_if->channel); ++ } ++ ++} ++ ++static int ++wl_ext_isam_dump_status(struct net_device *dev) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ int i; ++ bool now_if; ++ struct wl_if_info *tmp_if; ++ uint16 chan = 0; ++ wlc_ssid_t ssid = { 0, {0} }; ++ char amode[16], emode[16]; ++ ++ if (apsta_params->init == FALSE) { ++ return 0; ++ } ++ ++ printf("****************************\n"); ++ printf("%s: apstamode=%d\n", __FUNCTION__, apsta_params->apstamode); ++ for (i=0; iif_info[i]; ++ if (dev == tmp_if->dev) ++ now_if = TRUE; ++ if (tmp_if->dev) { ++ chan = wl_ext_get_chan(tmp_if->dev); ++ if (chan) { ++ wl_ext_ioctl(tmp_if->dev, WLC_GET_SSID, &ssid, sizeof(ssid), 0); ++ wl_ext_get_amode(tmp_if, amode); ++ wl_ext_get_emode(tmp_if, emode); ++ } ++ if (chan) { ++ printf("%s[%c-%c%s]: chan %3d, amode %s, emode %s, SSID \"%s\"\n", ++ tmp_if->ifname, tmp_if->prefix, chan?'E':'D', ++ now_if?"*":" ", chan, amode, emode, ssid.SSID); ++ } else { ++ printf("%s[%c-%c%s]:\n", ++ tmp_if->ifname, tmp_if->prefix, chan?'E':'D', ++ now_if?"*":" "); ++ } ++ } ++ } ++ printf("****************************\n"); ++ ++ return 0; ++} ++ ++static int ++wl_ext_enable_iface(struct net_device *dev, char *ifname) ++{ ++ int i; ++ s8 iovar_buf[WLC_IOCTL_SMLEN]; ++ wlc_ssid_t ssid = { 0, {0} }; ++ chanspec_t fw_chspec; ++ struct wl_join_params join_params; ++ size_t join_params_size; ++ struct { ++ s32 cfg; ++ s32 val; ++ } bss_setbuf; ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ apstamode_t apstamode = apsta_params->apstamode; ++ struct wl_if_info *cur_if = NULL; ++ struct dhd_pub *dhd; ++ uint16 cur_chan; ++ ++ dhd = dhd_get_pub(dev); ++ ++ for (i=0; iif_info[i].dev && ++ !strcmp(apsta_params->if_info[i].dev->name, ifname)) { ++ cur_if = &apsta_params->if_info[i]; ++ break; ++ } ++ } ++ if (!cur_if) { ++ ANDROID_ERROR(("%s: wrong ifname=%s or dev not ready\n", __FUNCTION__, ifname)); ++ return -1; ++ } ++ ++ printf("%s: Enabling %s\n", __FUNCTION__, ifname); ++ ++ wl_ext_isam_dump_status(cur_if->dev); ++ ++ wl_ext_move_cur_channel(dev, cur_if); ++ ++ cur_chan = wl_ext_get_chan(cur_if->dev); ++ if (cur_chan) { ++ ANDROID_INFO(("%s: Associated!\n", __FUNCTION__)); ++ if (cur_chan != cur_if->channel) ++ wl_ext_triger_csa(cur_if); ++ return 0; ++ } ++ ++ wl_ext_move_other_channel(dev, cur_if); ++ ++ if (cur_if->bssidx > 0) { ++ wl_ext_iovar_setbuf(cur_if->dev, "cur_etheraddr", (u8 *)cur_if->dev->dev_addr, ++ ETHER_ADDR_LEN, iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ } ++ ++ // set ssid for AP ++ ssid.SSID_len = strlen(cur_if->ssid); ++ memcpy(ssid.SSID, cur_if->ssid, ssid.SSID_len); ++ if (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IMESH_MODE) { ++ wl_ext_iovar_setint(dev, "mpc", 0); ++ if (apstamode == IAPONLY_MODE) { ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } else if (apstamode==IAPSTA_MODE || apstamode==IGOSTA_MODE) { ++ wl_ext_iovar_setbuf_bsscfg(cur_if->dev, "ssid", &ssid, sizeof(ssid), ++ iovar_buf, WLC_IOCTL_SMLEN, cur_if->bssidx, NULL); ++ } ++ } ++ ++ if (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IMESH_MODE) { ++ wl_ext_set_bgnmode(cur_if); ++ if (!cur_if->channel) { ++#ifdef WL_CFG80211 ++ char *pick_tmp, *param; ++ char cmd[128]; ++ uint16 cur_chan; ++ cur_chan = 1; ++ snprintf(cmd, 128, "get_best_channels"); ++ wl_cfg80211_get_best_channels(dev, cmd, strlen(cmd)); ++ pick_tmp = cmd; ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ while (param != NULL) { ++ if (!strnicmp(param, "2g=", strlen("2g="))) { ++ cur_chan = (int)simple_strtol(param+strlen("2g="), NULL, 10); ++ } else if (!strnicmp(param, "5g=", strlen("5g="))) { ++ cur_chan = (int)simple_strtol(param+strlen("5g="), NULL, 10); ++ } ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ } ++ cur_if->channel = cur_chan; ++#else ++ cur_if->channel = 1; ++#endif ++ } ++ wl_ext_set_chanspec(cur_if->dev, cur_if->channel, &fw_chspec); ++ } ++ ++ wl_ext_set_amode(cur_if); ++ wl_ext_set_emode(cur_if, apsta_params); ++ ++ if (cur_if->ifmode == IAP_MODE) { ++ if (cur_if->maxassoc >= 0) ++ wl_ext_iovar_setint(dev, "maxassoc", cur_if->maxassoc); ++ // terence: fix me, hidden does not work in dualAP mode ++ if (cur_if->hidden > 0) { ++ wl_ext_ioctl(cur_if->dev, WLC_SET_CLOSED, &cur_if->hidden, ++ sizeof(cur_if->hidden), 1); ++ printf("%s: Broadcast SSID: %s\n", __FUNCTION__, ++ cur_if->hidden ? "OFF":"ON"); ++ } ++ } ++ ++ if (apstamode == ISTAONLY_MODE) { ++ wl_ext_connect(cur_if); ++ } else if (apstamode == IAPONLY_MODE) { ++ wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } else if (apstamode == IAPSTA_MODE || apstamode == IGOSTA_MODE) { ++ if (cur_if->ifmode == ISTA_MODE) { ++ wl_ext_connect(cur_if); ++ } else { ++ if (FW_SUPPORTED(dhd, rsdb)) { ++ wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); ++ } else { ++ bss_setbuf.cfg = htod32(cur_if->bssidx); ++ bss_setbuf.val = htod32(1); ++ wl_ext_iovar_setbuf(cur_if->dev, "bss", &bss_setbuf, ++ sizeof(bss_setbuf), iovar_buf, WLC_IOCTL_SMLEN, NULL); ++ } ++#ifdef ARP_OFFLOAD_SUPPORT ++ /* IF SoftAP is enabled, disable arpoe */ ++ dhd_arp_offload_set(dhd, 0); ++ dhd_arp_offload_enable(dhd, FALSE); ++#endif /* ARP_OFFLOAD_SUPPORT */ ++#ifdef PROP_TXSTATUS_VSDB ++#if defined(BCMSDIO) ++ if (!FW_SUPPORTED(dhd, rsdb) && !disable_proptx) { ++ bool enabled; ++ dhd_wlfc_get_enable(dhd, &enabled); ++ if (!enabled) { ++ dhd_wlfc_init(dhd); ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ } ++ } ++#endif ++#endif /* PROP_TXSTATUS_VSDB */ ++ } ++ } ++ else if (apstamode == IDUALAP_MODE) { ++ wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); ++ } else if (apstamode == IMESHONLY_MODE || ++ apstamode == IMESHSTA_MODE || apstamode == IMESHAP_MODE || ++ apstamode == IMESHAPSTA_MODE || apstamode == IMESHAPAP_MODE) { ++ if (cur_if->ifmode == ISTA_MODE) { ++ wl_ext_connect(cur_if); ++ } else if (cur_if->ifmode == IAP_MODE) { ++ wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &ssid, sizeof(ssid), 1); ++ } else if (cur_if->ifmode == IMESH_MODE) { ++ // need to up before setting ssid ++ wl_ext_ioctl(dev, WLC_UP, NULL, 0, 1); ++ memset(&join_params, 0, sizeof(join_params)); ++ join_params.ssid.SSID_len = strlen(cur_if->ssid); ++ memcpy((void *)join_params.ssid.SSID, cur_if->ssid, ssid.SSID_len); ++ join_params.params.chanspec_list[0] = fw_chspec; ++ join_params.params.chanspec_num = 1; ++ join_params_size = sizeof(join_params); ++ wl_ext_ioctl(cur_if->dev, WLC_SET_SSID, &join_params, join_params_size, 1); ++ } else { ++ printf("%s: wrong ifmode %d\n", __FUNCTION__, cur_if->ifmode); ++ } ++ } ++ ++ OSL_SLEEP(1000); ++ printf("%s: enabled %s SSID: \"%s\"\n", __FUNCTION__, ifname, cur_if->ssid); ++ ++ cur_if->ifstate = IF_STATE_ENABLE; ++ ++ return 0; ++} ++ ++static int ++wl_ext_iapsta_enable(struct net_device *dev, char *command, int total_len) ++{ ++ int ret = 0; ++ char *pch, *pick_tmp, *param; ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ char ifname[IFNAMSIZ+1]; ++ ++ if (!apsta_params->init) { ++ ANDROID_ERROR(("%s: please init first\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ ANDROID_TRACE(("%s: command=%s, len=%d\n", __FUNCTION__, command, total_len)); ++ ++ pick_tmp = command; ++ param = bcmstrtok(&pick_tmp, " ", 0); // skip iapsta_enable ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ while (param != NULL) { ++ if (!strcmp(param, "ifname")) { ++ pch = bcmstrtok(&pick_tmp, " ", 0); ++ if (pch) { ++ strcpy(ifname, pch); ++ ret = wl_ext_enable_iface(dev, ifname); ++ if (ret) ++ return ret; ++ } else { ++ ANDROID_ERROR(("%s: ifname [wlanX]\n", __FUNCTION__)); ++ return -1; ++ } ++ } ++ param = bcmstrtok(&pick_tmp, " ", 0); ++ } ++ ++ return ret; ++} ++ ++int ++wl_ext_iapsta_alive_preinit(struct net_device *dev) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct wl_if_info *cur_if; ++ int i; ++ ++ if (apsta_params->init == TRUE) { ++ ANDROID_ERROR(("%s: don't init twice\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ ANDROID_TRACE(("%s: Enter\n", __FUNCTION__)); ++ ++ for (i=0; iif_info[i]; ++ if (i == 1 && !strlen(cur_if->ifname)) ++ strcpy(cur_if->ifname, "wlan1"); ++ if (i == 2 && !strlen(cur_if->ifname)) ++ strcpy(cur_if->ifname, "wlan2"); ++ if (cur_if->ifmode == ISTA_MODE) { ++ cur_if->channel = 0; ++ cur_if->maxassoc = -1; ++ cur_if->ifstate = IF_STATE_INIT; ++ cur_if->prio = PRIO_STA; ++ cur_if->prefix = 'S'; ++ snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_sta"); ++ } else if (cur_if->ifmode == IAP_MODE) { ++ cur_if->channel = 1; ++ cur_if->maxassoc = -1; ++ cur_if->ifstate = IF_STATE_INIT; ++ cur_if->prio = PRIO_AP; ++ cur_if->prefix = 'A'; ++ snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_ap"); ++ } else if (cur_if->ifmode == IMESH_MODE) { ++ cur_if->channel = 1; ++ cur_if->maxassoc = -1; ++ cur_if->ifstate = IF_STATE_INIT; ++ cur_if->prio = PRIO_MESH; ++ cur_if->prefix = 'M'; ++ snprintf(cur_if->ssid, DOT11_MAX_SSID_LEN, "ttt_mesh"); ++ } ++ } ++ ++ apsta_params->init = TRUE; ++ ++ return 0; ++} ++ ++int ++wl_ext_iapsta_alive_postinit(struct net_device *dev) ++{ ++ s32 apsta = 0; ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ ++ wl_ext_iovar_getint(dev, "apsta", &apsta); ++ if (apsta == 1) { ++ apsta_params->apstamode = ISTAONLY_MODE; ++ apsta_params->if_info[IF_PIF].ifmode = ISTA_MODE; ++ op_mode = DHD_FLAG_STA_MODE; ++ } else { ++ apsta_params->apstamode = IAPONLY_MODE; ++ apsta_params->if_info[IF_PIF].ifmode = IAP_MODE; ++ op_mode = DHD_FLAG_HOSTAP_MODE; ++ } ++ // fix me: how to check it's IAPSTA_MODE or IDUALAP_MODE? ++ ++ wl_ext_get_ioctl_ver(dev, &apsta_params->ioctl_ver); ++ printf("%s: apstamode=%d\n", __FUNCTION__, apsta_params->apstamode); ++ ++ return op_mode; ++} ++ ++#if defined(WL_WIRELESS_EXT) ++static bool ++wl_ext_conn_status_str(uint32 event_type, ++ uint32 status, uint32 reason, char* stringBuf, uint buflen) ++{ ++ int i; ++ ++ typedef struct conn_fail_event_map_t { ++ uint32 inEvent; /* input: event type to match */ ++ uint32 inStatus; /* input: event status code to match */ ++ uint32 inReason; /* input: event reason code to match */ ++ } conn_fail_event_map_t; ++ ++ /* Map of WLC_E events to connection failure strings */ ++# define WL_IW_DONT_CARE 9999 ++ const conn_fail_event_map_t event_map [] = { ++ /* inEvent inStatus inReason */ ++ {WLC_E_LINK, WL_IW_DONT_CARE, WL_IW_DONT_CARE}, ++ {WLC_E_DEAUTH, WL_IW_DONT_CARE, WL_IW_DONT_CARE}, ++ {WLC_E_DEAUTH_IND, WL_IW_DONT_CARE, WL_IW_DONT_CARE}, ++ {WLC_E_DISASSOC, WL_IW_DONT_CARE, WL_IW_DONT_CARE}, ++ {WLC_E_DISASSOC_IND, WL_IW_DONT_CARE, WL_IW_DONT_CARE}, ++ {WLC_E_OVERLAY_REQ, WL_IW_DONT_CARE, WL_IW_DONT_CARE}, ++ {WLC_E_ASSOC_IND, WL_IW_DONT_CARE, DOT11_SC_SUCCESS}, ++ {WLC_E_REASSOC_IND, WL_IW_DONT_CARE, DOT11_SC_SUCCESS}, ++ }; ++ ++ /* Search the event map table for a matching event */ ++ for (i = 0; i < sizeof(event_map)/sizeof(event_map[0]); i++) { ++ const conn_fail_event_map_t* row = &event_map[i]; ++ if (row->inEvent == event_type && ++ (row->inStatus == status || row->inStatus == WL_IW_DONT_CARE) && ++ (row->inReason == reason || row->inReason == WL_IW_DONT_CARE)) { ++ memset(stringBuf, 0, buflen); ++ snprintf(stringBuf, buflen, "isam_event event=%d reason=%d", ++ event_type, reason); ++ return TRUE; ++ } ++ } ++ ++ return FALSE; ++} ++#endif /* WL_WIRELESS_EXT */ ++ ++int ++wl_ext_iapsta_event(struct net_device *dev, wl_event_msg_t *e, void* data) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct wl_if_info *cur_if = NULL; ++ int i; ++#if defined(WL_WIRELESS_EXT) ++ char extra[IW_CUSTOM_MAX + 1]; ++ union iwreq_data wrqu; ++#endif ++ uint32 event_type = ntoh32(e->event_type); ++ uint32 status = ntoh32(e->status); ++ uint32 reason = ntoh32(e->reason); ++ uint16 flags = ntoh16(e->flags); ++ ++ if (!apsta_params->init) { ++ ANDROID_TRACE(("%s: please init first\n", __FUNCTION__)); ++ return -1; ++ } ++ ++ for (i=0; iif_info[i].bssidx == e->ifidx) { ++ cur_if = &apsta_params->if_info[i]; ++ break; ++ } ++ } ++ if (!cur_if || !cur_if->dev) { ++ ANDROID_ERROR(("%s: %s ifidx %d is not ready\n", __FUNCTION__, ++ dev->name, e->ifidx)); ++ return -1; ++ } ++ ++ if (cur_if->ifmode == ISTA_MODE) { ++ if (event_type == WLC_E_LINK) { ++ if (!(flags & WLC_EVENT_MSG_LINK)) { ++ printf("%s: %s[%c] Link Down with "MACSTR"\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix, MAC2STR((u8 *)&e->addr)); ++ } else { ++ printf("%s: %s[%c] Link UP with "MACSTR"\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix, MAC2STR((u8 *)&e->addr)); ++ } ++ } ++ } ++ else if (cur_if->ifmode == IAP_MODE || cur_if->ifmode == IMESH_MODE) { ++ if ((event_type == WLC_E_SET_SSID && status == WLC_E_STATUS_SUCCESS) || ++ (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS && ++ reason == WLC_E_REASON_INITIAL_ASSOC)) { ++ printf("%s: %s[%c] Link up\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix); ++ } else if ((event_type == WLC_E_LINK && reason == WLC_E_LINK_BSSCFG_DIS) || ++ (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS && ++ reason == WLC_E_REASON_DEAUTH)) { ++ printf("%s: %s[%c] Link down\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix); ++ } ++ else if ((event_type == WLC_E_ASSOC_IND || event_type == WLC_E_REASSOC_IND) && ++ reason == DOT11_SC_SUCCESS) { ++ printf("%s: %s[%c] connected device "MACDBG"\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix, MAC2STRDBG(e->addr.octet)); ++ } else if (event_type == WLC_E_DISASSOC_IND) { ++ printf("%s: %s[%c] disassociated device "MACDBG"\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix, MAC2STRDBG(e->addr.octet)); ++ } else if (event_type == WLC_E_DEAUTH_IND || ++ (event_type == WLC_E_DEAUTH && reason != DOT11_RC_RESERVED)) { ++ printf("%s: %s[%c] deauthenticated device "MACDBG"\n", __FUNCTION__, ++ cur_if->ifname, cur_if->prefix, MAC2STRDBG(e->addr.octet)); ++ } ++ } ++ ++#if defined(WL_WIRELESS_EXT) ++ memset(extra, 0, sizeof(extra)); ++ memset(&wrqu, 0, sizeof(wrqu)); ++ memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); ++ wrqu.addr.sa_family = ARPHRD_ETHER; ++ if (wl_ext_conn_status_str(event_type, status, reason, extra, sizeof(extra))) { ++ wrqu.data.length = strlen(extra); ++ wireless_send_event(cur_if->dev, IWEVCUSTOM, &wrqu, extra); ++ ANDROID_INFO(("%s: %s[%c] event=%d, status=%d, reason=%d, flags=%d sent up\n", ++ __FUNCTION__, cur_if->ifname, cur_if->prefix, event_type, status, ++ reason, flags)); ++ } else ++#endif /* WL_WIRELESS_EXT */ ++ { ++ ANDROID_INFO(("%s: %s[%c] event=%d, status=%d, reason=%d, flags=%d\n", ++ __FUNCTION__, cur_if->ifname, cur_if->prefix, event_type, status, ++ reason, flags)); ++ } ++ ++ return 0; ++} ++ ++u32 ++wl_ext_iapsta_disconnect_sta(struct net_device *dev, u32 channel) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct wl_if_info *cur_if = NULL; ++ int i; ++ ++ wl_ext_isam_dump_status(dev); ++ for (i=0; iif_info[i]; ++ if (cur_if->dev == dev) { ++ cur_if->channel = channel; ++ channel = wl_ext_move_cur_channel(apsta_params->if_info[IF_PIF].dev, cur_if); ++ wl_ext_move_other_channel(apsta_params->if_info[IF_PIF].dev, cur_if); ++ break; ++ } ++ } ++ return channel; ++} ++ ++int ++wl_ext_iapsta_attach_name(struct net_device *net, uint8 bssidx) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct dhd_pub *dhd; ++ struct wl_if_info *cur_if = NULL; ++ ++ dhd = dhd_get_pub(net); ++ ++ ANDROID_TRACE(("%s: bssidx=%d, %s\n", __FUNCTION__, bssidx, net->name)); ++ if (bssidx < MAX_IF_NUM) { ++ cur_if = &apsta_params->if_info[bssidx]; ++ } ++ if (bssidx == 0) { ++ if (dhd->conf->fw_type == FW_TYPE_MESH) { ++ apsta_params->rsdb = TRUE; ++ apsta_params->csa = CSA_FW_BIT | CSA_DRV_BIT; ++ } ++ strcpy(cur_if->ifname, net->name); ++ } else if (cur_if && cur_if->ifstate == IF_STATE_INIT) { ++ strcpy(cur_if->ifname, net->name); ++ apsta_params->netif_change = TRUE; ++ wake_up_interruptible(&apsta_params->netif_change_event); ++ } ++ ++ return 0; ++} ++ ++int ++wl_ext_iapsta_attach_netdev(struct net_device *net, uint8 bssidx) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ struct dhd_pub *dhd; ++ struct wl_if_info *cur_if = NULL, *primary_if; ++ ++ dhd = dhd_get_pub(net); ++ ++ printf("%s: bssidx=%d\n", __FUNCTION__, bssidx); ++ if (bssidx < MAX_IF_NUM) { ++ cur_if = &apsta_params->if_info[bssidx]; ++ } ++ if (bssidx == 0) { ++ memset(apsta_params, 0, sizeof(struct wl_apsta_params)); ++ apsta_params->vsdb = FALSE; ++ cur_if->dev = net; ++ cur_if->bssidx = bssidx; ++ strcpy(cur_if->ifname, net->name); ++ init_waitqueue_head(&apsta_params->netif_change_event); ++ } else if (cur_if && cur_if->ifstate == IF_STATE_INIT) { ++ primary_if = &apsta_params->if_info[IF_PIF]; ++ cur_if->dev = net; ++ cur_if->bssidx = bssidx; ++ if (strlen(cur_if->ifname)) { ++ memset(net->name, 0, sizeof(IFNAMSIZ)); ++ strcpy(net->name, cur_if->ifname); ++ net->name[IFNAMSIZ-1] = '\0'; ++ } ++ memcpy(net->dev_addr, primary_if->dev->dev_addr, ETHER_ADDR_LEN); ++ net->dev_addr[0] |= 0x02; ++ if (bssidx >= 2) { ++ net->dev_addr[4] ^= 0x80; ++ net->dev_addr[4] += bssidx; ++ net->dev_addr[5] += bssidx; ++ } ++ if (cur_if->ifmode == ISTA_MODE) { ++ wl_ext_iovar_setint(net, "roam_off", dhd->conf->roam_off); ++ wl_ext_iovar_setint(net, "bcn_timeout", dhd->conf->bcn_timeout); ++ } ++ } ++ ++ return 0; ++} ++ ++int ++wl_ext_iapsta_dettach_netdev(void) ++{ ++ struct wl_apsta_params *apsta_params = &g_apsta_params; ++ ++ printf("%s: Enter\n", __FUNCTION__); ++ memset(apsta_params, 0, sizeof(struct wl_apsta_params)); ++ ++ return 0; ++} ++#endif ++ ++#ifdef IDHCP ++int ++wl_ext_ip_dump(int ip, char *buf) ++{ ++ unsigned char bytes[4]; ++ int bytes_written=-1; ++ ++ bytes[0] = ip & 0xFF; ++ bytes[1] = (ip >> 8) & 0xFF; ++ bytes[2] = (ip >> 16) & 0xFF; ++ bytes[3] = (ip >> 24) & 0xFF; ++ bytes_written = sprintf(buf, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]); ++ ++ return bytes_written; ++} ++ ++/* ++terence 20170215: ++dhd_priv dhcpc_dump ifname [wlan0|wlan1] ++dhd_priv dhcpc_enable [0|1] ++*/ ++int ++wl_ext_dhcpc_enable(struct net_device *dev, char *command, int total_len) ++{ ++ int enable = -1, ret = -1; ++ int bytes_written = -1; ++ ++ ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); ++ ++ sscanf(command, "%*s %d", &enable); ++ ++ if (enable >= 0) ++ ret = wl_ext_iovar_setint(dev, "dhcpc_enable", enable); ++ else { ++ ret = wl_ext_iovar_getint(dev, "dhcpc_enable", &enable); ++ if (!ret) { ++ bytes_written = snprintf(command, total_len, "%d", enable); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ } ++ ++ return ret; ++} ++ ++int ++wl_ext_dhcpc_dump(struct net_device *dev, char *command, int total_len) ++{ ++ int ret = 0; ++ int bytes_written = 0; ++ uint32 ip_addr; ++ char buf[20]=""; ++ ++ ret = wl_ext_iovar_getint(dev, "dhcpc_ip_addr", &ip_addr); ++ if (!ret) { ++ wl_ext_ip_dump(ip_addr, buf); ++ bytes_written += snprintf(command+bytes_written, total_len, "ipaddr %s ", buf); ++ } ++ ++ ret = wl_ext_iovar_getint(dev, "dhcpc_ip_mask", &ip_addr); ++ if (!ret) { ++ wl_ext_ip_dump(ip_addr, buf); ++ bytes_written += snprintf(command+bytes_written, total_len, "mask %s ", buf); ++ } ++ ++ ret = wl_ext_iovar_getint(dev, "dhcpc_ip_gateway", &ip_addr); ++ if (!ret) { ++ wl_ext_ip_dump(ip_addr, buf); ++ bytes_written += snprintf(command+bytes_written, total_len, "gw %s ", buf); ++ } ++ ++ ret = wl_ext_iovar_getint(dev, "dhcpc_ip_dnsserv", &ip_addr); ++ if (!ret) { ++ wl_ext_ip_dump(ip_addr, buf); ++ bytes_written += snprintf(command+bytes_written, total_len, "dnsserv %s ", buf); ++ } ++ ++ if (!bytes_written) ++ bytes_written = -1; ++ ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ++ return bytes_written; ++} ++#endif ++ ++/* ++dhd_priv dhd [string] ==> Not ready ++1. Get dhd val: ++ Ex: dhd_priv dhd bussleep ++2. Set dhd val: ++ Ex: dhd_priv dhd bussleep 1 ++ ++dhd_priv wl [WLC_GET_PM] ==> Ready to get int val ++dhd_priv wl [WLC_SET_PM] [int] ==> Ready to set int val ++dhd_priv wl [string] ==> Ready to get int val ++dhd_priv wl [string] [int] ==> Ready to set int val ++Ex: get/set WLC_PM ++ dhd_priv wl 85 ++ dhd_priv wl 86 1 ++Ex: get/set mpc ++ dhd_priv wl mpc ++ dhd_priv wl mpc 1 ++*/ ++int ++wl_ext_iovar(struct net_device *dev, char *command, int total_len) ++{ ++ int ret = 0; ++ char wl[3]="\0", arg[20]="\0", cmd_str[20]="\0", val_str[20]="\0"; ++ int cmd=-1, val=0; ++ int bytes_written=-1; ++ ++ ANDROID_TRACE(("%s: cmd %s\n", __FUNCTION__, command)); ++ ++ sscanf(command, "%s %d %s", wl, &cmd, arg); ++ if (cmd < 0) ++ sscanf(command, "%s %s %s", wl, cmd_str, val_str); ++ ++ if (!strcmp(wl, "wl")) { ++ if (cmd>=0 && cmd!=WLC_GET_VAR && cmd!=WLC_SET_VAR) { ++ ret = sscanf(arg, "%d", &val); ++ if (ret > 0) { // set ++ ret = wl_ext_ioctl(dev, cmd, &val, sizeof(val), TRUE); ++ } else { // get ++ ret = wl_ext_ioctl(dev, cmd, &val, sizeof(val), FALSE); ++ if (!ret) { ++ bytes_written = snprintf(command, total_len, "%d", val); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ } ++ } else if (strlen(cmd_str)) { ++ ret = sscanf(val_str, "%d", &val); ++ if (ret > 0) { // set ++ ret = wl_ext_iovar_setint(dev, cmd_str, val); ++ } else { // get ++ ret = wl_ext_iovar_getint(dev, cmd_str, &val); ++ if (!ret) { ++ bytes_written = snprintf(command, total_len, "%d", val); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ } ++ } ++ } ++ ++ return ret; ++} ++ ++int wl_android_ext_priv_cmd(struct net_device *net, char *command, int total_len, ++ int *bytes_written) ++{ ++ int ret = 0; ++ ++ if (strnicmp(command, CMD_CHANNELS, strlen(CMD_CHANNELS)) == 0) { ++ *bytes_written = wl_ext_channels(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_CHANNEL, strlen(CMD_CHANNEL)) == 0) { ++ *bytes_written = wl_ext_channel(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_ROAM_TRIGGER, strlen(CMD_ROAM_TRIGGER)) == 0) { ++ *bytes_written = wl_ext_roam_trigger(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_KEEP_ALIVE, strlen(CMD_KEEP_ALIVE)) == 0) { ++ *bytes_written = wl_ext_keep_alive(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_PM, strlen(CMD_PM)) == 0) { ++ *bytes_written = wl_ext_pm(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_MONITOR, strlen(CMD_MONITOR)) == 0) { ++ *bytes_written = wl_ext_monitor(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_SET_SUSPEND_BCN_LI_DTIM, strlen(CMD_SET_SUSPEND_BCN_LI_DTIM)) == 0) { ++ int bcn_li_dtim; ++ bcn_li_dtim = (int)simple_strtol((command + strlen(CMD_SET_SUSPEND_BCN_LI_DTIM) + 1), NULL, 10); ++ *bytes_written = net_os_set_suspend_bcn_li_dtim(net, bcn_li_dtim); ++ } ++#ifdef WL_EXT_IAPSTA ++ else if (strnicmp(command, CMD_IAPSTA_INIT, strlen(CMD_IAPSTA_INIT)) == 0) { ++ *bytes_written = wl_ext_isam_init(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_ISAM_INIT, strlen(CMD_ISAM_INIT)) == 0) { ++ *bytes_written = wl_ext_isam_init(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_IAPSTA_CONFIG, strlen(CMD_IAPSTA_CONFIG)) == 0) { ++ *bytes_written = wl_ext_iapsta_config(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_ISAM_CONFIG, strlen(CMD_ISAM_CONFIG)) == 0) { ++ *bytes_written = wl_ext_iapsta_config(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_IAPSTA_ENABLE, strlen(CMD_IAPSTA_ENABLE)) == 0) { ++ *bytes_written = wl_ext_iapsta_enable(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_ISAM_ENABLE, strlen(CMD_ISAM_ENABLE)) == 0) { ++ *bytes_written = wl_ext_iapsta_enable(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_IAPSTA_DISABLE, strlen(CMD_IAPSTA_DISABLE)) == 0) { ++ *bytes_written = wl_ext_iapsta_disable(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_ISAM_DISABLE, strlen(CMD_ISAM_DISABLE)) == 0) { ++ *bytes_written = wl_ext_iapsta_disable(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_ISAM_DUMP, strlen(CMD_ISAM_DUMP)) == 0) { ++ *bytes_written = wl_ext_isam_dump_status(net); ++ } ++#endif ++#ifdef IDHCP ++ else if (strnicmp(command, CMD_DHCPC_ENABLE, strlen(CMD_DHCPC_ENABLE)) == 0) { ++ *bytes_written = wl_ext_dhcpc_enable(net, command, total_len); ++ } ++ else if (strnicmp(command, CMD_DHCPC_DUMP, strlen(CMD_DHCPC_DUMP)) == 0) { ++ *bytes_written = wl_ext_dhcpc_dump(net, command, total_len); ++ } ++#endif ++#ifdef WL_CFG80211 ++ else if (strnicmp(command, CMD_AUTOCHANNEL, strlen(CMD_AUTOCHANNEL)) == 0) { ++ *bytes_written = wl_cfg80211_autochannel(net, command, total_len); ++ } ++#endif ++#ifdef WL_ESCAN ++ else if (strnicmp(command, CMD_AUTOCHANNEL, strlen(CMD_AUTOCHANNEL)) == 0) { ++ *bytes_written = wl_escan_autochannel(net, command, total_len); ++ } ++#endif ++ else if (strnicmp(command, CMD_WL, strlen(CMD_WL)) == 0) { ++ *bytes_written = wl_ext_iovar(net, command, total_len); ++ } ++ else ++ ret = -1; ++ ++ return ret; ++} ++ ++#if defined(WL_CFG80211) || defined(WL_ESCAN) ++int ++wl_ext_get_distance(struct net_device *net, u32 band) ++{ ++ u32 bw = WL_CHANSPEC_BW_20; ++ s32 bw_cap = 0, distance = 0; ++ struct { ++ u32 band; ++ u32 bw_cap; ++ } param = {0, 0}; ++ char buf[WLC_IOCTL_SMLEN]="\0"; ++ s32 err = BCME_OK; ++ ++ param.band = band; ++ err = wldev_iovar_getbuf(net, "bw_cap", ¶m, sizeof(param), buf, sizeof(buf), NULL); ++ if (err) { ++ if (err != BCME_UNSUPPORTED) { ++ ANDROID_ERROR(("bw_cap failed, %d\n", err)); ++ return err; ++ } else { ++ err = wl_ext_iovar_getint(net, "mimo_bw_cap", &bw_cap); ++ if (err) { ++ ANDROID_ERROR(("error get mimo_bw_cap (%d)\n", err)); ++ } ++ if (bw_cap != WLC_N_BW_20ALL) ++ bw = WL_CHANSPEC_BW_40; ++ } ++ } else { ++ if (WL_BW_CAP_80MHZ(buf[0])) ++ bw = WL_CHANSPEC_BW_80; ++ else if (WL_BW_CAP_40MHZ(buf[0])) ++ bw = WL_CHANSPEC_BW_40; ++ else ++ bw = WL_CHANSPEC_BW_20; ++ } ++ ++ if (bw == WL_CHANSPEC_BW_20) ++ distance = 2; ++ else if (bw == WL_CHANSPEC_BW_40) ++ distance = 4; ++ else if (bw == WL_CHANSPEC_BW_80) ++ distance = 8; ++ else ++ distance = 16; ++ ANDROID_INFO(("%s: bw=0x%x, distance=%d\n", __FUNCTION__, bw, distance)); ++ ++ return distance; ++} ++ ++int ++wl_ext_get_best_channel(struct net_device *net, ++#if defined(BSSCACHE) ++ wl_bss_cache_ctrl_t *bss_cache_ctrl, ++#else ++ struct wl_scan_results *bss_list, ++#endif ++ int *best_2g_ch, int *best_5g_ch ++) ++{ ++ struct wl_bss_info *bi = NULL; /* must be initialized */ ++ s32 i, j; ++#if defined(BSSCACHE) ++ wl_bss_cache_t *node; ++#endif ++ int b_band[CH_MAX_2G_CHANNEL]={0}, a_band1[4]={0}, a_band4[5]={0}; ++ s32 cen_ch, distance, distance_2g, distance_5g, ch, min_ap=999; ++ u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; ++ wl_uint32_list_t *list; ++ int ret; ++ int ioctl_ver = 0; ++ chanspec_t chanspec; ++ ++ memset(b_band, -1, sizeof(b_band)); ++ memset(a_band1, -1, sizeof(a_band1)); ++ memset(a_band4, -1, sizeof(a_band4)); ++ ++ memset(valid_chan_list, 0, sizeof(valid_chan_list)); ++ list = (wl_uint32_list_t *)(void *) valid_chan_list; ++ list->count = htod32(WL_NUMCHANNELS); ++ ret = wldev_ioctl(net, WLC_GET_VALID_CHANNELS, valid_chan_list, sizeof(valid_chan_list), 0); ++ if (ret<0) { ++ ANDROID_ERROR(("%s: get channels failed with %d\n", __FUNCTION__, ret)); ++ return 0; ++ } else { ++ for (i = 0; i < dtoh32(list->count); i++) { ++ ch = dtoh32(list->element[i]); ++ if (ch < CH_MAX_2G_CHANNEL) ++ b_band[ch-1] = 0; ++ else if (ch <= 48) ++ a_band1[(ch-36)/4] = 0; ++ else if (ch >= 149 && ch <= 161) ++ a_band4[(ch-149)/4] = 0; ++ } ++ } ++ wl_ext_get_ioctl_ver(net, &ioctl_ver); ++ ++ distance_2g = wl_ext_get_distance(net, WLC_BAND_2G); ++ distance_5g = wl_ext_get_distance(net, WLC_BAND_5G); ++ ++#if defined(BSSCACHE) ++ node = bss_cache_ctrl->m_cache_head; ++ for (i=0; node && i<256; i++) ++#else ++ for (i=0; i < bss_list->count; i++) ++#endif ++ { ++#if defined(BSSCACHE) ++ bi = node->results.bss_info; ++#else ++ bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : bss_list->bss_info; ++#endif ++ chanspec = wl_ext_chspec_driver_to_host(ioctl_ver, bi->chanspec); ++ cen_ch = CHSPEC_CHANNEL(bi->chanspec); ++ distance = 0; ++ if (CHSPEC_IS20(chanspec)) ++ distance += 2; ++ else if (CHSPEC_IS40(chanspec)) ++ distance += 4; ++ else if (CHSPEC_IS80(chanspec)) ++ distance += 8; ++ else ++ distance += 16; ++ ++ if (CHSPEC_IS2G(chanspec)) { ++ distance += distance_2g; ++ for (j=0; j= 0 && abs(cen_ch-(1+j)) <= distance) ++ b_band[j] += 1; ++ } ++ } else { ++ distance += distance_5g; ++ if (cen_ch <= 48) { ++ for (j=0; j= 0 && abs(cen_ch-(36+j*4)) <= distance) ++ a_band1[j] += 1; ++ } ++ } else if (cen_ch >= 149) { ++ for (j=0; j= 0 && abs(cen_ch-(149+j*4)) <= distance) ++ a_band4[j] += 1; ++ } ++ } ++ } ++#if defined(BSSCACHE) ++ node = node->next; ++#endif ++ } ++ ++ *best_2g_ch = 0; ++ min_ap = 999; ++ for (i=0; i= 0) { ++ min_ap = b_band[i]; ++ *best_2g_ch = i+1; ++ } ++ } ++ *best_5g_ch = 0; ++ min_ap = 999; ++ for (i=0; i= 0) { ++ min_ap = a_band1[i]; ++ *best_5g_ch = i*4 + 36; ++ } ++ } ++ for (i=0; i= 0) { ++ min_ap = a_band4[i]; ++ *best_5g_ch = i*4 + 149; ++ } ++ } ++ ++ if (android_msg_level&ANDROID_INFO_LEVEL) { ++ printf("%s: b_band: ", __FUNCTION__); ++ for (j=0; jm_cache_head; ++ node = *rssi_head; ++ ++ for (;node;) { ++ ANDROID_INFO(("%s: Free %d with BSSID %pM\n", ++ __FUNCTION__, i, &node->BSSID)); ++ cur = node; ++ node = cur->next; ++ kfree(cur); ++ i++; ++ } ++ *rssi_head = NULL; ++} ++ ++void ++wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl) ++{ ++ wl_rssi_cache_t *node, *prev, **rssi_head; ++ int i = -1, tmp = 0; ++ struct timeval now; ++ ++ do_gettimeofday(&now); ++ ++ rssi_head = &rssi_cache_ctrl->m_cache_head; ++ node = *rssi_head; ++ prev = node; ++ for (;node;) { ++ i++; ++ if (now.tv_sec > node->tv.tv_sec) { ++ if (node == *rssi_head) { ++ tmp = 1; ++ *rssi_head = node->next; ++ } else { ++ tmp = 0; ++ prev->next = node->next; ++ } ++ ANDROID_INFO(("%s: Del %d with BSSID %pM\n", ++ __FUNCTION__, i, &node->BSSID)); ++ kfree(node); ++ if (tmp == 1) { ++ node = *rssi_head; ++ prev = node; ++ } else { ++ node = prev->next; ++ } ++ continue; ++ } ++ prev = node; ++ node = node->next; ++ } ++} ++ ++void ++wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, u8 *bssid) ++{ ++ wl_rssi_cache_t *node, *prev, **rssi_head; ++ int i = -1, tmp = 0; ++ ++ rssi_head = &rssi_cache_ctrl->m_cache_head; ++ node = *rssi_head; ++ prev = node; ++ for (;node;) { ++ i++; ++ if (!memcmp(&node->BSSID, bssid, ETHER_ADDR_LEN)) { ++ if (node == *rssi_head) { ++ tmp = 1; ++ *rssi_head = node->next; ++ } else { ++ tmp = 0; ++ prev->next = node->next; ++ } ++ ANDROID_INFO(("%s: Del %d with BSSID %pM\n", ++ __FUNCTION__, i, &node->BSSID)); ++ kfree(node); ++ if (tmp == 1) { ++ node = *rssi_head; ++ prev = node; ++ } else { ++ node = prev->next; ++ } ++ continue; ++ } ++ prev = node; ++ node = node->next; ++ } ++} ++ ++void ++wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl) ++{ ++ wl_rssi_cache_t *node, **rssi_head; ++ ++ rssi_head = &rssi_cache_ctrl->m_cache_head; ++ ++ /* reset dirty */ ++ node = *rssi_head; ++ for (;node;) { ++ node->dirty += 1; ++ node = node->next; ++ } ++} ++ ++int ++wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rssi_cache_ctrl, int *rssi_avg) ++{ ++ wl_rssi_cache_t *node, *prev, *leaf, **rssi_head; ++ int j, k=0; ++ int rssi, error=0; ++ struct ether_addr bssid; ++ struct timeval now, timeout; ++ scb_val_t scbval; ++ ++ if (!g_wifi_on) ++ return 0; ++ ++ error = wldev_ioctl(net, WLC_GET_BSSID, &bssid, sizeof(bssid), false); ++ if (error == BCME_NOTASSOCIATED) { ++ ANDROID_INFO(("%s: Not Associated! res:%d\n", __FUNCTION__, error)); ++ return 0; ++ } ++ if (error) { ++ ANDROID_ERROR(("Could not get bssid (%d)\n", error)); ++ } ++ error = wldev_get_rssi(net, &scbval); ++ if (error) { ++ ANDROID_ERROR(("Could not get rssi (%d)\n", error)); ++ return error; ++ } ++ rssi = scbval.val; ++ ++ do_gettimeofday(&now); ++ timeout.tv_sec = now.tv_sec + RSSICACHE_TIMEOUT; ++ if (timeout.tv_sec < now.tv_sec) { ++ /* ++ * Integer overflow - assume long enough timeout to be assumed ++ * to be infinite, i.e., the timeout would never happen. ++ */ ++ ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu", ++ __FUNCTION__, RSSICACHE_TIMEOUT, now.tv_sec, timeout.tv_sec)); ++ } ++ ++ /* update RSSI */ ++ rssi_head = &rssi_cache_ctrl->m_cache_head; ++ node = *rssi_head; ++ prev = NULL; ++ for (;node;) { ++ if (!memcmp(&node->BSSID, &bssid, ETHER_ADDR_LEN)) { ++ ANDROID_INFO(("%s: Update %d with BSSID %pM, RSSI=%d\n", ++ __FUNCTION__, k, &bssid, rssi)); ++ for (j=0; jRSSI[j] = node->RSSI[j+1]; ++ node->RSSI[j] = rssi; ++ node->dirty = 0; ++ node->tv = timeout; ++ goto exit; ++ } ++ prev = node; ++ node = node->next; ++ k++; ++ } ++ ++ leaf = kmalloc(sizeof(wl_rssi_cache_t), GFP_KERNEL); ++ if (!leaf) { ++ ANDROID_ERROR(("%s: Memory alloc failure %d\n", ++ __FUNCTION__, (int)sizeof(wl_rssi_cache_t))); ++ return 0; ++ } ++ ANDROID_INFO(("%s: Add %d with cached BSSID %pM, RSSI=%3d in the leaf\n", ++ __FUNCTION__, k, &bssid, rssi)); ++ ++ leaf->next = NULL; ++ leaf->dirty = 0; ++ leaf->tv = timeout; ++ memcpy(&leaf->BSSID, &bssid, ETHER_ADDR_LEN); ++ for (j=0; jRSSI[j] = rssi; ++ ++ if (!prev) ++ *rssi_head = leaf; ++ else ++ prev->next = leaf; ++ ++exit: ++ *rssi_avg = (int)wl_get_avg_rssi(rssi_cache_ctrl, &bssid); ++ ++ return error; ++} ++ ++void ++wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list) ++{ ++ wl_rssi_cache_t *node, *prev, *leaf, **rssi_head; ++ wl_bss_info_t *bi = NULL; ++ int i, j, k; ++ struct timeval now, timeout; ++ ++ if (!ss_list->count) ++ return; ++ ++ do_gettimeofday(&now); ++ timeout.tv_sec = now.tv_sec + RSSICACHE_TIMEOUT; ++ if (timeout.tv_sec < now.tv_sec) { ++ /* ++ * Integer overflow - assume long enough timeout to be assumed ++ * to be infinite, i.e., the timeout would never happen. ++ */ ++ ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu", ++ __FUNCTION__, RSSICACHE_TIMEOUT, now.tv_sec, timeout.tv_sec)); ++ } ++ ++ rssi_head = &rssi_cache_ctrl->m_cache_head; ++ ++ /* update RSSI */ ++ for (i = 0; i < ss_list->count; i++) { ++ node = *rssi_head; ++ prev = NULL; ++ k = 0; ++ bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; ++ for (;node;) { ++ if (!memcmp(&node->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { ++ ANDROID_INFO(("%s: Update %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", ++ __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); ++ for (j=0; jRSSI[j] = node->RSSI[j+1]; ++ node->RSSI[j] = dtoh16(bi->RSSI); ++ node->dirty = 0; ++ node->tv = timeout; ++ break; ++ } ++ prev = node; ++ node = node->next; ++ k++; ++ } ++ ++ if (node) ++ continue; ++ ++ leaf = kmalloc(sizeof(wl_rssi_cache_t), GFP_KERNEL); ++ if (!leaf) { ++ ANDROID_ERROR(("%s: Memory alloc failure %d\n", ++ __FUNCTION__, (int)sizeof(wl_rssi_cache_t))); ++ return; ++ } ++ ANDROID_INFO(("%s: Add %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\" in the leaf\n", ++ __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); ++ ++ leaf->next = NULL; ++ leaf->dirty = 0; ++ leaf->tv = timeout; ++ memcpy(&leaf->BSSID, &bi->BSSID, ETHER_ADDR_LEN); ++ for (j=0; jRSSI[j] = dtoh16(bi->RSSI); ++ ++ if (!prev) ++ *rssi_head = leaf; ++ else ++ prev->next = leaf; ++ } ++} ++ ++int16 ++wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr) ++{ ++ wl_rssi_cache_t *node, **rssi_head; ++ int j, rssi_sum, rssi=RSSI_MINVAL; ++ ++ rssi_head = &rssi_cache_ctrl->m_cache_head; ++ ++ node = *rssi_head; ++ for (;node;) { ++ if (!memcmp(&node->BSSID, addr, ETHER_ADDR_LEN)) { ++ rssi_sum = 0; ++ rssi = 0; ++ for (j=0; jRSSI[RSSIAVG_LEN-j-1]; ++ rssi = rssi_sum / j; ++ break; ++ } ++ node = node->next; ++ } ++ rssi = MIN(rssi, RSSI_MAXVAL); ++ if (rssi == RSSI_MINVAL) { ++ ANDROID_ERROR(("%s: BSSID %pM does not in RSSI cache\n", ++ __FUNCTION__, addr)); ++ } ++ return (int16)rssi; ++} ++#endif ++ ++#if defined(RSSIOFFSET) ++int ++wl_update_rssi_offset(struct net_device *net, int rssi) ++{ ++#if defined(RSSIOFFSET_NEW) ++ int j; ++#endif ++ ++ if (!g_wifi_on) ++ return rssi; ++ ++#if defined(RSSIOFFSET_NEW) ++ for (j=0; jm_cache_head; ++ node = *bss_head; ++ ++ for (;node;) { ++ ANDROID_TRACE(("%s: Free %d with BSSID %pM\n", ++ __FUNCTION__, i, &node->results.bss_info->BSSID)); ++ cur = node; ++ node = cur->next; ++ kfree(cur); ++ i++; ++ } ++ *bss_head = NULL; ++} ++ ++void ++wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl) ++{ ++ wl_bss_cache_t *node, *prev, **bss_head; ++ int i = -1, tmp = 0; ++ struct timeval now; ++ ++ do_gettimeofday(&now); ++ ++ bss_head = &bss_cache_ctrl->m_cache_head; ++ node = *bss_head; ++ prev = node; ++ for (;node;) { ++ i++; ++ if (now.tv_sec > node->tv.tv_sec) { ++ if (node == *bss_head) { ++ tmp = 1; ++ *bss_head = node->next; ++ } else { ++ tmp = 0; ++ prev->next = node->next; ++ } ++ ANDROID_TRACE(("%s: Del %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", ++ __FUNCTION__, i, &node->results.bss_info->BSSID, ++ dtoh16(node->results.bss_info->RSSI), node->results.bss_info->SSID)); ++ kfree(node); ++ if (tmp == 1) { ++ node = *bss_head; ++ prev = node; ++ } else { ++ node = prev->next; ++ } ++ continue; ++ } ++ prev = node; ++ node = node->next; ++ } ++} ++ ++void ++wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, u8 *bssid) ++{ ++ wl_bss_cache_t *node, *prev, **bss_head; ++ int i = -1, tmp = 0; ++ ++ bss_head = &bss_cache_ctrl->m_cache_head; ++ node = *bss_head; ++ prev = node; ++ for (;node;) { ++ i++; ++ if (!memcmp(&node->results.bss_info->BSSID, bssid, ETHER_ADDR_LEN)) { ++ if (node == *bss_head) { ++ tmp = 1; ++ *bss_head = node->next; ++ } else { ++ tmp = 0; ++ prev->next = node->next; ++ } ++ ANDROID_TRACE(("%s: Del %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", ++ __FUNCTION__, i, &node->results.bss_info->BSSID, ++ dtoh16(node->results.bss_info->RSSI), node->results.bss_info->SSID)); ++ kfree(node); ++ if (tmp == 1) { ++ node = *bss_head; ++ prev = node; ++ } else { ++ node = prev->next; ++ } ++ continue; ++ } ++ prev = node; ++ node = node->next; ++ } ++} ++ ++void ++wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl) ++{ ++ wl_bss_cache_t *node, **bss_head; ++ ++ bss_head = &bss_cache_ctrl->m_cache_head; ++ ++ /* reset dirty */ ++ node = *bss_head; ++ for (;node;) { ++ node->dirty += 1; ++ node = node->next; ++ } ++} ++ ++void dump_bss_cache( ++#if defined(RSSIAVG) ++ wl_rssi_cache_ctrl_t *rssi_cache_ctrl, ++#endif ++ wl_bss_cache_t *node) ++{ ++ int k = 0; ++ int16 rssi; ++ ++ for (;node;) { ++#if defined(RSSIAVG) ++ rssi = wl_get_avg_rssi(rssi_cache_ctrl, &node->results.bss_info->BSSID); ++#else ++ rssi = dtoh16(node->results.bss_info->RSSI); ++#endif ++ ANDROID_TRACE(("%s: dump %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\"\n", ++ __FUNCTION__, k, &node->results.bss_info->BSSID, rssi, node->results.bss_info->SSID)); ++ k++; ++ node = node->next; ++ } ++} ++ ++void ++wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, ++#if defined(RSSIAVG) ++ wl_rssi_cache_ctrl_t *rssi_cache_ctrl, ++#endif ++ wl_scan_results_t *ss_list) ++{ ++ wl_bss_cache_t *node, *prev, *leaf, **bss_head; ++ wl_bss_info_t *bi = NULL; ++ int i, k=0; ++#if defined(SORT_BSS_BY_RSSI) ++ int16 rssi, rssi_node; ++#endif ++ struct timeval now, timeout; ++ ++ if (!ss_list->count) ++ return; ++ ++ do_gettimeofday(&now); ++ timeout.tv_sec = now.tv_sec + BSSCACHE_TIMEOUT; ++ if (timeout.tv_sec < now.tv_sec) { ++ /* ++ * Integer overflow - assume long enough timeout to be assumed ++ * to be infinite, i.e., the timeout would never happen. ++ */ ++ ANDROID_TRACE(("%s: Too long timeout (secs=%d) to ever happen - now=%lu, timeout=%lu", ++ __FUNCTION__, BSSCACHE_TIMEOUT, now.tv_sec, timeout.tv_sec)); ++ } ++ ++ bss_head = &bss_cache_ctrl->m_cache_head; ++ ++ for (i=0; i < ss_list->count; i++) { ++ node = *bss_head; ++ prev = NULL; ++ bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; ++ ++ for (;node;) { ++ if (!memcmp(&node->results.bss_info->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { ++ if (node == *bss_head) ++ *bss_head = node->next; ++ else { ++ prev->next = node->next; ++ } ++ break; ++ } ++ prev = node; ++ node = node->next; ++ } ++ ++ leaf = kmalloc(dtoh32(bi->length) + sizeof(wl_bss_cache_t), GFP_KERNEL); ++ if (!leaf) { ++ ANDROID_ERROR(("%s: Memory alloc failure %d\n", __FUNCTION__, ++ dtoh32(bi->length) + (int)sizeof(wl_bss_cache_t))); ++ return; ++ } ++ if (node) { ++ kfree(node); ++ node = NULL; ++ ANDROID_TRACE(("%s: Update %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\"\n", ++ __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); ++ } else ++ ANDROID_TRACE(("%s: Add %d with cached BSSID %pM, RSSI=%3d, SSID \"%s\"\n", ++ __FUNCTION__, k, &bi->BSSID, dtoh16(bi->RSSI), bi->SSID)); ++ ++ memcpy(leaf->results.bss_info, bi, dtoh32(bi->length)); ++ leaf->next = NULL; ++ leaf->dirty = 0; ++ leaf->tv = timeout; ++ leaf->results.count = 1; ++ leaf->results.version = ss_list->version; ++ k++; ++ ++ if (*bss_head == NULL) ++ *bss_head = leaf; ++ else { ++#if defined(SORT_BSS_BY_RSSI) ++ node = *bss_head; ++#if defined(RSSIAVG) ++ rssi = wl_get_avg_rssi(rssi_cache_ctrl, &leaf->results.bss_info->BSSID); ++#else ++ rssi = dtoh16(leaf->results.bss_info->RSSI); ++#endif ++ for (;node;) { ++#if defined(RSSIAVG) ++ rssi_node = wl_get_avg_rssi(rssi_cache_ctrl, &node->results.bss_info->BSSID); ++#else ++ rssi_node = dtoh16(node->results.bss_info->RSSI); ++#endif ++ if (rssi > rssi_node) { ++ leaf->next = node; ++ if (node == *bss_head) ++ *bss_head = leaf; ++ else ++ prev->next = leaf; ++ break; ++ } ++ prev = node; ++ node = node->next; ++ } ++ if (node == NULL) ++ prev->next = leaf; ++#else ++ leaf->next = *bss_head; ++ *bss_head = leaf; ++#endif ++ } ++ } ++ dump_bss_cache( ++#if defined(RSSIAVG) ++ rssi_cache_ctrl, ++#endif ++ *bss_head); ++} ++ ++void ++wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl) ++{ ++ ANDROID_TRACE(("%s:\n", __FUNCTION__)); ++ wl_free_bss_cache(bss_cache_ctrl); ++} ++#endif ++ ++ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c +index aad697d70b09..1123b86f9406 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c +@@ -513,6 +513,14 @@ static s32 wl_cfg80211_del_station(struct wiphy *wiphy, + static s32 wl_cfg80211_del_station(struct wiphy *wiphy, + struct net_device *ndev, u8* mac_addr); + #endif ++#ifdef WLMESH ++static s32 wl_cfg80211_join_mesh( ++ struct wiphy *wiphy, struct net_device *dev, ++ const struct mesh_config *conf, ++ const struct mesh_setup *setup); ++static s32 wl_cfg80211_leave_mesh(struct wiphy *wiphy, ++ struct net_device *dev); ++#endif /* WLMESH */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) + static s32 wl_cfg80211_change_station(struct wiphy *wiphy, + struct net_device *dev, const u8 *mac, struct station_parameters *params); +@@ -565,7 +573,11 @@ static s32 wl_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, + #endif + #endif + #ifdef WL_SCHED_SCAN +-static int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev); ++static int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ , u64 reqid ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ ++); + #endif + static s32 wl_cfg80211_set_ap_role(struct bcm_cfg80211 *cfg, struct net_device *dev); + #if defined(WL_VIRTUAL_APSTA) || defined(DUAL_STA_STATIC_IF) +@@ -1312,6 +1324,13 @@ wl_cfg80211_ether_atoe(const char *a, struct ether_addr *n) + /* There isn't a lot of sense in it, but you can transmit anything you like */ + static const struct ieee80211_txrx_stypes + wl_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { ++#ifdef WLMESH ++ [NL80211_IFTYPE_MESH_POINT] = { ++ .tx = 0xffff, ++ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | ++ BIT(IEEE80211_STYPE_AUTH >> 4) ++ }, ++#endif /* WLMESH */ + [NL80211_IFTYPE_ADHOC] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) +@@ -1611,7 +1630,10 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + unsigned char name_assign_type, + #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) */ +- enum nl80211_iftype type, u32 *flags, ++ enum nl80211_iftype type, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) ++ u32 *flags, ++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) */ + struct vif_params *params) + { + s32 err = -ENODEV; +@@ -1628,10 +1650,10 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, + struct ether_addr primary_mac; + bcm_struct_cfgdev *new_cfgdev; + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + s32 up = 1; + bool enabled; +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + dhd_pub_t *dhd; + bool hang_required = false; +@@ -1771,7 +1793,7 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, + + wl_cfg80211_scan_abort(cfg); + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + if (!cfg->wlfc_on && !disable_proptx) { + dhd_wlfc_get_enable(dhd, &enabled); + if (!enabled && dhd->op_mode != DHD_FLAG_HOSTAP_MODE && +@@ -1783,7 +1805,7 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, + } + cfg->wlfc_on = true; + } +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + + /* Dual p2p doesn't support multiple P2PGO interfaces, +@@ -1971,14 +1993,14 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, + memset(cfg->p2p->vir_ifname, '\0', IFNAMSIZ); + wl_to_p2p_bss_bssidx(cfg, cfg_type) = -1; + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + dhd_wlfc_get_enable(dhd, &enabled); + if (enabled && cfg->wlfc_on && dhd->op_mode != DHD_FLAG_HOSTAP_MODE && + dhd->op_mode != DHD_FLAG_IBSS_MODE && dhd->conf->disable_proptx!=0) { + dhd_wlfc_deinit(dhd); + cfg->wlfc_on = false; + } +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + } + } +@@ -2185,7 +2207,10 @@ done: + + static s32 + wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev, +- enum nl80211_iftype type, u32 *flags, ++ enum nl80211_iftype type, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) ++ u32 *flags, ++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) */ + struct vif_params *params) + { + s32 ap = 0; +@@ -2204,11 +2229,18 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev, + switch (type) { + case NL80211_IFTYPE_MONITOR: + case NL80211_IFTYPE_WDS: ++#ifndef WLMESH + case NL80211_IFTYPE_MESH_POINT: ++#endif /* WLMESH */ + ap = 1; + WL_ERR(("type (%d) : currently we do not support this type\n", + type)); + break; ++#ifdef WLMESH ++ case NL80211_IFTYPE_MESH_POINT: ++ infra_ibss = WL_BSSTYPE_MESH; ++ break; ++#endif /* WLMESH */ + case NL80211_IFTYPE_ADHOC: + mode = WL_MODE_IBSS; + infra_ibss = 0; +@@ -2433,10 +2465,10 @@ static s32 wl_cfg80211_handle_ifdel(struct bcm_cfg80211 *cfg, wl_if_event_info * + s32 type = -1; + s32 bssidx = -1; + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub); + bool enabled; +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + + bssidx = if_event_info->bssidx; +@@ -2466,14 +2498,14 @@ static s32 wl_cfg80211_handle_ifdel(struct bcm_cfg80211 *cfg, wl_if_event_info * + } + + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + dhd_wlfc_get_enable(dhd, &enabled); + if (enabled && cfg->wlfc_on && dhd->op_mode != DHD_FLAG_HOSTAP_MODE && + dhd->op_mode != DHD_FLAG_IBSS_MODE && dhd->conf->disable_proptx!=0) { + dhd_wlfc_deinit(dhd); + cfg->wlfc_on = false; + } +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + } + +@@ -2789,9 +2821,7 @@ wl_run_escan(struct bcm_cfg80211 *cfg, struct net_device *ndev, + + err = wldev_iovar_setbuf(ndev, "escan", params, params_size, + cfg->escan_ioctl_buf, WLC_IOCTL_MEDLEN, NULL); +- WL_DBG(("LEGACY_SCAN sync ID: %d, bssidx: %d\n", +- params->sync_id, bssidx)); +- ++ printf("%s: LEGACY_SCAN sync ID: %d, bssidx: %d\n", __FUNCTION__, params->sync_id, bssidx); + if (unlikely(err)) { + if (err == BCME_EPERM) + /* Scan Not permitted at this point of time */ +@@ -3664,6 +3694,51 @@ fail: + } + #endif /* WLAIBSS_MCHAN */ + ++#ifdef WLMESH ++s32 ++wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg, ++ struct net_device *ndev, s32 bsscfg_idx, ++ enum nl80211_iftype iface_type, s32 del, u8 *addr) ++{ ++ wl_interface_create_t iface; ++ s32 ret; ++ wl_interface_info_t *info; ++ ++ bzero(&iface, sizeof(wl_interface_create_t)); ++ ++ iface.ver = WL_INTERFACE_CREATE_VER; ++ ++ if (iface_type == NL80211_IFTYPE_AP) ++ iface.flags = WL_INTERFACE_CREATE_AP; ++ else ++ iface.flags = WL_INTERFACE_CREATE_STA; ++ ++ if (del) { ++ ret = wldev_iovar_setbuf(ndev, "interface_remove", ++ NULL, 0, cfg->ioctl_buf, WLC_IOCTL_MEDLEN, NULL); ++ } else { ++ if (addr) { ++ memcpy(&iface.mac_addr.octet, addr, ETH_ALEN); ++ iface.flags |= WL_INTERFACE_MAC_USE; ++ } ++ ret = wldev_iovar_getbuf(ndev, "interface_create", ++ &iface, sizeof(wl_interface_create_t), ++ cfg->ioctl_buf, WLC_IOCTL_MAXLEN, &cfg->ioctl_buf_sync); ++ if (ret == 0) { ++ /* success */ ++ info = (wl_interface_info_t *)cfg->ioctl_buf; ++ WL_DBG(("wl interface create success!! bssidx:%d \n", ++ info->bsscfgidx)); ++ } ++ } ++ ++ if (ret < 0) ++ WL_ERR(("Interface %s failed!! ret %d\n", ++ del ? "remove" : "create", ret)); ++ ++ return ret; ++} ++#else + s32 + wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg, + struct net_device *ndev, s32 bsscfg_idx, +@@ -3758,6 +3833,7 @@ wl_cfg80211_interface_ops(struct bcm_cfg80211 *cfg, + WL_DBG(("wl interface create success!! bssidx:%d \n", ret)); + return ret; + } ++#endif + + bool + wl_customer6_legacy_chip_check(struct bcm_cfg80211 *cfg, +@@ -3792,7 +3868,27 @@ void + wl_bss_iovar_war(struct bcm_cfg80211 *cfg, + struct net_device *ndev, s32 *val) + { +- if (wl_customer6_legacy_chip_check(cfg, ndev)) { ++ u32 chipnum; ++ wlc_rev_info_t revinfo; ++ int ret; ++ bool need_war = false; ++ ++ /* Get the device rev info */ ++ memset(&revinfo, 0, sizeof(revinfo)); ++ ret = wldev_ioctl_get(ndev, WLC_GET_REVINFO, &revinfo, sizeof(revinfo)); ++ if (ret < 0) { ++ WL_ERR(("%s: GET revinfo FAILED. ret:%d\n", __FUNCTION__, ret)); ++ } else { ++ WL_DBG(("%s: GET_REVINFO device 0x%x, vendor 0x%x, chipnum 0x%x\n", __FUNCTION__, ++ dtoh32(revinfo.deviceid), dtoh32(revinfo.vendorid), dtoh32(revinfo.chipnum))); ++ chipnum = revinfo.chipnum; ++ if ((chipnum == BCM4359_CHIP_ID) || (chipnum == BCM43596_CHIP_ID)) { ++ /* WAR required */ ++ need_war = true; ++ } ++ } ++ ++ if (wl_customer6_legacy_chip_check(cfg, ndev) || need_war) { + /* Few firmware branches have issues in bss iovar handling and + * that can't be changed since they are in production. + */ +@@ -4182,6 +4278,9 @@ wl_cfg80211_create_iface(struct wiphy *wiphy, + wl_if_event_info *event = NULL; + u8 addr[ETH_ALEN]; + struct net_info *iter, *next; ++#ifdef WLMESH ++ u16 role = 0, mode = 0; ++#endif + + WL_DBG(("Enter\n")); + if (!name) { +@@ -4283,6 +4382,11 @@ wl_cfg80211_create_iface(struct wiphy *wiphy, + } + + event = &cfg->if_event_info; ++#ifdef WLMESH ++ cfg80211_to_wl_iftype(iface_type, &role, &mode); ++ event->role = role; ++#endif ++ + /* + * Since FW operation is successful,we can go ahead with the + * the host interface creation. +@@ -4359,6 +4463,157 @@ exit: + } + #endif /* defined(WL_VIRTUAL_APSTA) || defined(DUAL_STA_STATIC_IF) */ + ++#ifdef WLMESH ++s32 wl_cfg80211_set_sae_password(struct net_device *dev, char* buf, int len) ++{ ++ struct bcm_cfg80211 *cfg = wl_get_cfg(dev); ++ ++ sscanf(buf, "%s %d", cfg->sae_password, &cfg->sae_password_len); ++ return 0; ++} ++ ++static s32 wl_cfg80211_join_mesh( ++ struct wiphy *wiphy, struct net_device *dev, ++ const struct mesh_config *conf, ++ const struct mesh_setup *setup) ++{ ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) ++ struct ieee80211_channel *chan = setup->chandef.chan; ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0)) ++ struct ieee80211_channel *chan = setup->channel; ++#endif ++ u32 param[2] = {0, 0}; ++ s32 err = 0; ++ u32 bw_cap = 0; ++ u32 beacon_interval = setup->beacon_interval; ++ u32 dtim_period = setup->dtim_period; ++ size_t join_params_size; ++ struct wl_join_params join_params; ++ chanspec_t chanspec = 0; ++ ++ cfg->channel = ieee80211_frequency_to_channel(chan->center_freq); ++ ++ if (wl_get_drv_status(cfg, CONNECTED, dev)) { ++ struct wlc_ssid *lssid = (struct wlc_ssid *)wl_read_prof(cfg, dev, WL_PROF_SSID); ++ u8 *bssid = (u8 *)wl_read_prof(cfg, dev, WL_PROF_BSSID); ++ u32 *channel = (u32 *)wl_read_prof(cfg, dev, WL_PROF_CHAN); ++ if ((memcmp(setup->mesh_id, lssid->SSID, lssid->SSID_len) == 0) && ++ (*channel == cfg->channel)) { ++ WL_ERR(("MESH connection already existed to " MACDBG "\n", ++ MAC2STRDBG((u8 *)wl_read_prof(cfg, dev, WL_PROF_BSSID)))); ++ return -EISCONN; ++ } ++ WL_ERR(("Previous connecton existed, please disconnect mesh %s (" MACDBG ") first\n", ++ lssid->SSID, MAC2STRDBG(bssid))); ++ return -EISCONN; ++ } ++ ++ if (chan) { ++ if (chan->band == IEEE80211_BAND_5GHZ) ++ param[0] = WLC_BAND_5G; ++ else if (chan->band == IEEE80211_BAND_2GHZ) ++ param[0] = WLC_BAND_2G; ++ err = wldev_iovar_getint(dev, "bw_cap", param); ++ if (unlikely(err)) { ++ WL_ERR(("Get bw_cap Failed (%d)\n", err)); ++ return err; ++ } ++ bw_cap = param[0]; ++ chanspec = channel_to_chanspec(wiphy, dev, cfg->channel, bw_cap); ++ } ++ ++ memset(&join_params, 0, sizeof(join_params)); ++ memcpy((void *)join_params.ssid.SSID, (void *)setup->mesh_id, ++ setup->mesh_id_len); ++ ++ join_params.ssid.SSID_len = htod32(setup->mesh_id_len); ++ join_params.params.chanspec_list[0] = chanspec; ++ join_params.params.chanspec_num = 1; ++ wldev_iovar_setint(dev, "chanspec", chanspec); ++ join_params_size = sizeof(join_params); ++ ++ wldev_iovar_setint(dev, "wpa_auth", WPA_AUTH_DISABLED); ++ wldev_iovar_setint(dev, "wsec", 0); ++ ++ if (cfg->sae_password_len > 0) { ++ wldev_iovar_setint(dev, "mesh_auth_proto", 1); ++ wldev_iovar_setint(dev, "wpa_auth", WPA2_AUTH_PSK); ++ wldev_iovar_setint(dev, "wsec", AES_ENABLED); ++ wldev_iovar_setint(dev, "mfp", WL_MFP_REQUIRED); ++ printf("%s: password=%s, len=%d\n", __FUNCTION__, ++ cfg->sae_password, cfg->sae_password_len); ++ wldev_iovar_setbuf(dev, "sae_password", cfg->sae_password, cfg->sae_password_len, ++ cfg->ioctl_buf, WLC_IOCTL_MAXLEN, NULL); ++ } else { ++ wldev_iovar_setint(dev, "mesh_auth_proto", 0); ++ wldev_iovar_setint(dev, "mfp", WL_MFP_NONE); ++ } ++ ++ if (beacon_interval) { ++ if ((err = wldev_ioctl_set(dev, WLC_SET_BCNPRD, ++ &beacon_interval, sizeof(s32))) < 0) { ++ WL_ERR(("Beacon Interval Set Error, %d\n", err)); ++ return err; ++ } ++ } ++ ++ if (dtim_period) { ++ if ((err = wldev_ioctl_set(dev, WLC_SET_DTIMPRD, ++ &dtim_period, sizeof(s32))) < 0) { ++ WL_ERR(("DTIM Interval Set Error, %d\n", err)); ++ return err; ++ } ++ } ++ wldev_iovar_setint(dev, "mpc", 0); ++ ++ WL_ERR(("JOIN %s on channel %d with chanspec 0x%4x\n", ++ join_params.ssid.SSID, cfg->channel, chanspec)); ++ ++ err = wldev_ioctl_set(dev, WLC_SET_SSID, &join_params, ++ join_params_size); ++ ++ if (unlikely(err)) { ++ WL_ERR(("Error (%d)\n", err)); ++ return err; ++ } ++ ++ wl_update_prof(cfg, dev, NULL, &join_params.ssid, WL_PROF_SSID); ++ wl_update_prof(cfg, dev, NULL, &cfg->channel, WL_PROF_CHAN); ++ return err; ++} ++ ++ ++static s32 wl_cfg80211_leave_mesh( ++ struct wiphy *wiphy, struct net_device *dev) ++{ ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ s32 err = 0; ++ scb_val_t scbval; ++ u8 *curbssid; ++ ++ RETURN_EIO_IF_NOT_UP(cfg); ++ wl_link_down(cfg); ++ ++ WL_ERR(("Leave MESH\n")); ++ curbssid = wl_read_prof(cfg, dev, WL_PROF_BSSID); ++ wl_set_drv_status(cfg, DISCONNECTING, dev); ++ scbval.val = 0; ++ memcpy(&scbval.ea, curbssid, ETHER_ADDR_LEN); ++ err = wldev_ioctl_set(dev, WLC_DISASSOC, &scbval, ++ sizeof(scb_val_t)); ++ if (unlikely(err)) { ++ wl_clr_drv_status(cfg, DISCONNECTING, dev); ++ WL_ERR(("error(%d)\n", err)); ++ return err; ++ } ++ memset(cfg->sae_password, 0, SAE_MAX_PASSWD_LEN); ++ cfg->sae_password_len = 0; ++ ++ return err; ++} ++#endif /* WLMESH */ ++ + static s32 + wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ibss_params *params) +@@ -4824,7 +5079,7 @@ wl_cfg80211_set_mfp(struct bcm_cfg80211 *cfg, + /* if mfp > 0, mfp capability set in wpa ie, but + * FW indicated error for mfp. Propagate the error up. + */ +- WL_ERR(("mfp capability found in wpaie. But fw doesn't" ++ WL_ERR(("mfp capability found in wpaie. But fw doesn't " + "seem to support MFP\n")); + return -EINVAL; + } else { +@@ -5123,6 +5378,9 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, + WL_DBG(("In\n")); + BCM_REFERENCE(dhdp); + ++#ifdef WLMESH ++ wl_config_ifmode(cfg, dev, dev->ieee80211_ptr->iftype); ++#endif + #if defined(SUPPORT_RANDOM_MAC_SCAN) + wl_cfg80211_set_random_mac(dev, FALSE); + #endif /* SUPPORT_RANDOM_MAC_SCAN */ +@@ -5181,7 +5439,11 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, + * A start scan occuring during connect is unlikely + */ + if (cfg->sched_scan_req) { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ wl_cfg80211_sched_scan_stop(wiphy, bcmcfg_to_prmry_ndev(cfg), 0); ++#else + wl_cfg80211_sched_scan_stop(wiphy, bcmcfg_to_prmry_ndev(cfg)); ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ + } + #endif + #if defined(ESCAN_RESULT_PATCH) +@@ -5391,7 +5653,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, + DHD_DISABLE_RUNTIME_PM((dhd_pub_t *)cfg->pub); + #endif /* BCMDONGLEHOST && CUSTOMER_HW2 */ + #ifdef WL_EXT_IAPSTA +- wl_android_ext_iapsta_disconnect_sta(dev, cfg->channel); ++ wl_ext_iapsta_disconnect_sta(dev, cfg->channel); + #endif + err = wldev_iovar_setbuf_bsscfg(dev, "join", ext_join_params, join_params_size, + cfg->ioctl_buf, WLC_IOCTL_MAXLEN, bssidx, &cfg->ioctl_buf_sync); +@@ -5783,9 +6045,18 @@ wl_cfg80211_interface_create(struct net_device *dev, char *name) + { + struct bcm_cfg80211 *cfg = wl_get_cfg(dev); + bcm_struct_cfgdev *new_cfgdev; ++ char ifname[IFNAMSIZ]; ++ char iftype[IFNAMSIZ]; ++ enum nl80211_iftype iface_type = NL80211_IFTYPE_STATION; ++ ++ sscanf(name, "%s %s", ifname, iftype); ++ ++ if (strnicmp(iftype, "AP", strlen("AP")) == 0) { ++ iface_type = NL80211_IFTYPE_AP; ++ } + + new_cfgdev = wl_cfg80211_create_iface(cfg->wdev->wiphy, +- NL80211_IFTYPE_STATION, NULL, name); ++ iface_type, NULL, ifname); + if (!new_cfgdev) { + return BCME_ERROR; + } +@@ -6116,14 +6387,6 @@ wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, + #endif /* MFP */ + } + +-#if defined(RSSIAVG) +-static wl_rssi_cache_ctrl_t g_rssi_cache_ctrl; +-static wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl; +-#endif +-#if defined(BSSCACHE) +-static wl_bss_cache_ctrl_t g_bss_cache_ctrl; +-#endif +- + static s32 + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) + wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, +@@ -6281,13 +6544,13 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, + } + rssi = dtoh32(scb_val.val); + #if defined(RSSIAVG) +- err = wl_update_connected_rssi_cache(dev, &g_connected_rssi_cache_ctrl, &rssi); ++ err = wl_update_connected_rssi_cache(dev, &cfg->g_connected_rssi_cache_ctrl, &rssi); + if (err) { + WL_ERR(("Could not get rssi (%d)\n", err)); + goto get_station_err; + } +- wl_delete_dirty_rssi_cache(&g_connected_rssi_cache_ctrl); +- wl_reset_rssi_cache(&g_connected_rssi_cache_ctrl); ++ wl_delete_dirty_rssi_cache(&cfg->g_connected_rssi_cache_ctrl); ++ wl_reset_rssi_cache(&cfg->g_connected_rssi_cache_ctrl); + #endif + #if defined(RSSIOFFSET) + rssi = wl_update_rssi_offset(dev, rssi); +@@ -7788,6 +8051,9 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, + + dev = ndev_to_wlc_ndev(dev, cfg); + _chan = ieee80211_frequency_to_channel(chan->center_freq); ++#ifdef WL_EXT_IAPSTA ++ _chan = wl_ext_iapsta_disconnect_sta(dev, _chan); ++#endif + printf("%s: netdev_ifidx(%d), chan_type(%d) target channel(%d) \n", + __FUNCTION__, dev->ifindex, channel_type, _chan); + +@@ -8824,6 +9090,9 @@ wl_cfg80211_bcn_bringup_ap( + s32 join_params_size = 0; + s32 ap = 1; + s32 wsec; ++#ifdef WLMESH ++ bool retried = false; ++#endif + #ifdef SOFTAP_UAPSD_OFF + uint32 wme_apsd = 0; + #endif /* SOFTAP_UAPSD_OFF */ +@@ -8960,6 +9229,9 @@ wl_cfg80211_bcn_bringup_ap( + } + #endif /* MFP */ + ++#ifdef WLMESH ++ssid_retry: ++#endif + memset(&join_params, 0, sizeof(join_params)); + /* join parameters starts with ssid */ + join_params_size = sizeof(join_params.ssid); +@@ -8992,6 +9264,13 @@ wl_cfg80211_bcn_bringup_ap( + timeout = wait_event_interruptible_timeout(cfg->netif_change_event, + wl_get_drv_status(cfg, AP_CREATED, dev), msecs_to_jiffies(MAX_AP_LINK_WAIT_TIME)); + if (timeout <= 0 || !wl_get_drv_status(cfg, AP_CREATED, dev)) { ++#ifdef WLMESH ++ if (!retried) { ++ retried = true; ++ WL_ERR(("Link up didn't come for AP interface. Try to set ssid again to recover it! \n")); ++ goto ssid_retry; ++ } ++#endif + WL_ERR(("Link up didn't come for AP interface. AP/GO creation failed! \n")); + if (timeout == -ERESTARTSYS) { + WL_ERR(("waitqueue was interrupted by a signal, returns -ERESTARTSYS\n")); +@@ -9275,7 +9554,9 @@ wl_cfg80211_del_station( + } else { + #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) */ + #endif /* CUSTOM_BLOCK_DEAUTH_AT_EAP_FAILURE */ ++#ifndef BCMDBUS + dhd_wait_pend8021x(dev); ++#endif /* !BCMDBUS */ + scb_val.val = DOT11_RC_DEAUTH_LEAVING; + err = wldev_ioctl_set(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scb_val, + sizeof(scb_val_t)); +@@ -9403,6 +9684,10 @@ wl_cfg80211_start_ap( + s32 bssidx = 0; + u32 dev_role = 0; + dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub); ++#ifdef WLMESH ++ struct wl_join_params join_params; ++ s32 join_params_size = 0; ++#endif + + WL_DBG(("Enter \n")); + +@@ -9503,6 +9788,35 @@ wl_cfg80211_start_ap( + // goto fail; + } + ++#ifdef WLMESH ++ OSL_SLEEP(1000); ++ if ((dev_role == NL80211_IFTYPE_P2P_GO) || (dev_role == NL80211_IFTYPE_AP)) { ++ memset(&join_params, 0, sizeof(join_params)); ++ /* join parameters starts with ssid */ ++ join_params_size = sizeof(join_params.ssid); ++ if (dev_role == NL80211_IFTYPE_P2P_GO) { ++ join_params.ssid.SSID_len = min(cfg->p2p->ssid.SSID_len, ++ (uint32)DOT11_MAX_SSID_LEN); ++ memcpy(join_params.ssid.SSID, cfg->p2p->ssid.SSID, ++ join_params.ssid.SSID_len); ++ } else if (dev_role == NL80211_IFTYPE_AP) { ++ join_params.ssid.SSID_len = min(cfg->hostapd_ssid.SSID_len, ++ (uint32)DOT11_MAX_SSID_LEN); ++ memcpy(join_params.ssid.SSID, cfg->hostapd_ssid.SSID, ++ join_params.ssid.SSID_len); ++ } ++ join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len); ++ /* create softap */ ++ if ((err = wldev_ioctl_set(dev, WLC_SET_SSID, &join_params, ++ join_params_size)) != 0) { ++ WL_ERR(("SoftAP/GO set ssid failed! \n")); ++ goto fail; ++ } else { ++ WL_DBG((" SoftAP SSID \"%s\" \n", join_params.ssid.SSID)); ++ } ++ } ++#endif ++ + WL_DBG(("** AP/GO Created **\n")); + + #ifdef WL_CFG80211_ACL +@@ -10126,7 +10440,11 @@ exit: + } + + static int +-wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) ++wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ , u64 reqid ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ ++) + { + struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); + dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub); +@@ -10412,6 +10730,10 @@ static struct cfg80211_ops wl_cfg80211_ops = { + .change_station = wl_cfg80211_change_station, + .mgmt_tx_cancel_wait = wl_cfg80211_mgmt_tx_cancel_wait, + #endif /* WL_SUPPORT_BACKPORTED_KPATCHES || KERNEL_VERSION >= (3,2,0) */ ++#ifdef WLMESH ++ .join_mesh = wl_cfg80211_join_mesh, ++ .leave_mesh = wl_cfg80211_leave_mesh, ++#endif /* WLMESH */ + #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) + .tdls_mgmt = wl_cfg80211_tdls_mgmt, + .tdls_oper = wl_cfg80211_tdls_oper, +@@ -10440,6 +10762,10 @@ s32 wl_mode_to_nl80211_iftype(s32 mode) + return NL80211_IFTYPE_ADHOC; + case WL_MODE_AP: + return NL80211_IFTYPE_AP; ++#ifdef WLMESH ++ case WL_MODE_MESH: ++ return NL80211_IFTYPE_MESH_POINT; ++#endif + default: + return NL80211_IFTYPE_UNSPECIFIED; + } +@@ -10552,8 +10878,15 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev + wdev->wiphy->max_sched_scan_ssids = MAX_PFN_LIST_COUNT; + wdev->wiphy->max_match_sets = MAX_PFN_LIST_COUNT; + wdev->wiphy->max_sched_scan_ie_len = WL_SCAN_IE_LEN_MAX; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ wdev->wiphy->max_sched_scan_plan_interval = PNO_SCAN_MAX_FW_SEC; ++#else + wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ + #endif /* WL_SCHED_SCAN */ ++#ifdef WLMESH ++ wdev->wiphy->flags |= WIPHY_FLAG_MESH_AUTH; ++#endif + wdev->wiphy->interface_modes = + BIT(NL80211_IFTYPE_STATION) + | BIT(NL80211_IFTYPE_ADHOC) +@@ -10567,13 +10900,18 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev + #if defined(WL_CFG80211_P2P_DEV_IF) + | BIT(NL80211_IFTYPE_P2P_DEVICE) + #endif /* WL_CFG80211_P2P_DEV_IF */ ++#ifdef WLMESH ++ | BIT(NL80211_IFTYPE_MESH_POINT) ++#endif /* WLMESH */ + | BIT(NL80211_IFTYPE_AP); + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) && \ + (defined(WL_IFACE_COMB_NUM_CHANNELS) || defined(WL_CFG80211_P2P_DEV_IF)) + WL_DBG(("Setting interface combinations for common mode\n")); ++#ifndef BCMDBUS + if (dhd->conf->num_different_channels >= 0) + common_iface_combinations[0].num_different_channels = dhd->conf->num_different_channels; ++#endif /* !BCMDBUS */ + wdev->wiphy->iface_combinations = common_iface_combinations; + wdev->wiphy->n_iface_combinations = + ARRAY_SIZE(common_iface_combinations); +@@ -10761,8 +11099,8 @@ static s32 wl_inform_bss(struct bcm_cfg80211 *cfg) + struct wl_bss_info *bi = NULL; /* must be initialized */ + s32 err = 0; + s32 i; +-#if defined(RSSIAVG) + struct net_device *ndev = bcmcfg_to_prmry_ndev(cfg); ++#if defined(RSSIAVG) + int rssi; + #endif + #if defined(BSSCACHE) +@@ -10774,18 +11112,18 @@ static s32 wl_inform_bss(struct bcm_cfg80211 *cfg) + /* Free cache in p2p scanning*/ + if (p2p_is_on(cfg) && p2p_scan(cfg)) { + #if defined(RSSIAVG) +- wl_free_rssi_cache(&g_rssi_cache_ctrl); ++ wl_free_rssi_cache(&cfg->g_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_free_bss_cache(&g_bss_cache_ctrl); ++ wl_free_bss_cache(&cfg->g_bss_cache_ctrl); + #endif + } + + /* Delete disconnected cache */ + #if defined(BSSCACHE) +- wl_delete_disconnected_bss_cache(&g_bss_cache_ctrl, (u8*)&cfg->disconnected_bssid); ++ wl_delete_disconnected_bss_cache(&cfg->g_bss_cache_ctrl, (u8*)&cfg->disconnected_bssid); + #if defined(RSSIAVG) +- wl_delete_disconnected_rssi_cache(&g_rssi_cache_ctrl, (u8*)&cfg->disconnected_bssid); ++ wl_delete_disconnected_rssi_cache(&cfg->g_rssi_cache_ctrl, (u8*)&cfg->disconnected_bssid); + #endif + if (cfg->p2p_disconnected == 0) + memset(&cfg->disconnected_bssid, 0, ETHER_ADDR_LEN); +@@ -10793,43 +11131,45 @@ static s32 wl_inform_bss(struct bcm_cfg80211 *cfg) + + /* Update cache */ + #if defined(RSSIAVG) +- wl_update_rssi_cache(&g_rssi_cache_ctrl, bss_list); ++ wl_update_rssi_cache(&cfg->g_rssi_cache_ctrl, bss_list); + if (!in_atomic()) +- wl_update_connected_rssi_cache(ndev, &g_rssi_cache_ctrl, &rssi); ++ wl_update_connected_rssi_cache(ndev, &cfg->g_rssi_cache_ctrl, &rssi); + #endif + #if defined(BSSCACHE) +- wl_update_bss_cache(&g_bss_cache_ctrl, ++ wl_update_bss_cache(&cfg->g_bss_cache_ctrl, + #if defined(RSSIAVG) +- &g_rssi_cache_ctrl, ++ &cfg->g_rssi_cache_ctrl, + #endif + bss_list); + #endif + + /* delete dirty cache */ + #if defined(RSSIAVG) +- wl_delete_dirty_rssi_cache(&g_rssi_cache_ctrl); +- wl_reset_rssi_cache(&g_rssi_cache_ctrl); ++ wl_delete_dirty_rssi_cache(&cfg->g_rssi_cache_ctrl); ++ wl_reset_rssi_cache(&cfg->g_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_delete_dirty_bss_cache(&g_bss_cache_ctrl); +- wl_reset_bss_cache(&g_bss_cache_ctrl); ++ wl_delete_dirty_bss_cache(&cfg->g_bss_cache_ctrl); ++ wl_reset_bss_cache(&cfg->g_bss_cache_ctrl); + #endif + + #if defined(BSSCACHE) + if (cfg->p2p_disconnected > 0) { + // terence 20130703: Fix for wrong group_capab (timing issue) +- wl_delete_disconnected_bss_cache(&g_bss_cache_ctrl, (u8*)&cfg->disconnected_bssid); ++ wl_delete_disconnected_bss_cache(&cfg->g_bss_cache_ctrl, (u8*)&cfg->disconnected_bssid); + #if defined(RSSIAVG) +- wl_delete_disconnected_rssi_cache(&g_rssi_cache_ctrl, (u8*)&cfg->disconnected_bssid); ++ wl_delete_disconnected_rssi_cache(&cfg->g_rssi_cache_ctrl, (u8*)&cfg->disconnected_bssid); + #endif + } + WL_SCAN(("scanned AP count (%d)\n", bss_list->count)); +- node = g_bss_cache_ctrl.m_cache_head; ++ node = cfg->g_bss_cache_ctrl.m_cache_head; + for (i=0; node && iresults.bss_info; + err = wl_inform_single_bss(cfg, bi, false); + node = node->next; + } ++ if (cfg->autochannel) ++ wl_ext_get_best_channel(ndev, &cfg->g_bss_cache_ctrl, &cfg->best_2g_ch, &cfg->best_5g_ch); + #else + WL_SCAN(("scanned AP count (%d)\n", bss_list->count)); + preempt_disable(); +@@ -10840,6 +11180,8 @@ static s32 wl_inform_bss(struct bcm_cfg80211 *cfg) + err = wl_inform_single_bss(cfg, bi, false); + } + preempt_enable(); ++ if (cfg->autochannel) ++ wl_ext_get_best_channel(ndev, bss_list, &cfg->best_2g_ch, &cfg->best_5g_ch); + #endif + + if (cfg->p2p_disconnected > 0) { +@@ -10874,6 +11216,7 @@ static s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, struct wl_bss_info *bi + u32 freq; + s32 err = 0; + gfp_t aflags; ++ chanspec_t chanspec; + + if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) { + WL_DBG(("Beacon is larger than buffer. Discarding\n")); +@@ -10887,8 +11230,8 @@ static s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, struct wl_bss_info *bi + return -ENOMEM; + } + mgmt = (struct ieee80211_mgmt *)notif_bss_info->frame_buf; +- notif_bss_info->channel = +- wf_chspec_ctlchan(wl_chspec_driver_to_host(bi->chanspec)); ++ chanspec = wl_chspec_driver_to_host(bi->chanspec); ++ notif_bss_info->channel = wf_chspec_ctlchan(chanspec); + + if (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) + band = wiphy->bands[IEEE80211_BAND_2GHZ]; +@@ -10901,7 +11244,7 @@ static s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, struct wl_bss_info *bi + } + notif_bss_info->rssi = dtoh16(bi->RSSI); + #if defined(RSSIAVG) +- notif_bss_info->rssi = wl_get_avg_rssi(&g_rssi_cache_ctrl, &bi->BSSID); ++ notif_bss_info->rssi = wl_get_avg_rssi(&cfg->g_rssi_cache_ctrl, &bi->BSSID); + if (notif_bss_info->rssi == RSSI_MINVAL) + notif_bss_info->rssi = MIN(dtoh16(bi->RSSI), RSSI_MAXVAL); + #endif +@@ -10943,8 +11286,12 @@ static s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, struct wl_bss_info *bi + return -EINVAL; + } + channel = ieee80211_get_channel(wiphy, freq); +- WL_SCAN(("BSSID %pM, channel %2d, rssi %3d, capa 0x04%x, mgmt_type %d, " +- "frame_len %d, SSID \"%s\"\n", &bi->BSSID, notif_bss_info->channel, ++ WL_SCAN(("BSSID %pM, channel %2d(%2d %sMHz), rssi %3d, capa 0x04%x, mgmt_type %d, " ++ "frame_len %d, SSID \"%s\"\n", ++ &bi->BSSID, notif_bss_info->channel, CHSPEC_CHANNEL(chanspec), ++ CHSPEC_IS20(chanspec)?"20": ++ CHSPEC_IS40(chanspec)?"40": ++ CHSPEC_IS80(chanspec)?"80":"160", + notif_bss_info->rssi, mgmt->u.beacon.capab_info, mgmt_type, + notif_bss_info->frame_len, bi->SSID)); + if (unlikely(!channel)) { +@@ -11209,6 +11556,9 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev, + printf("%s: ** AP/GO Link up event **\n", __FUNCTION__); + wl_set_drv_status(cfg, AP_CREATED, ndev); + wake_up_interruptible(&cfg->netif_change_event); ++ if (!memcmp(ndev->name, WL_P2P_INTERFACE_PREFIX, strlen(WL_P2P_INTERFACE_PREFIX))) { ++ dhd_conf_set_mchan_bw(cfg->pub, WL_P2P_IF_GO, -1); ++ } + return 0; + } + } +@@ -11863,6 +12213,9 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + wl_update_prof(cfg, ndev, e, &act, WL_PROF_ACT); + wl_update_prof(cfg, ndev, NULL, (const void *)&e->addr, WL_PROF_BSSID); + dhd_conf_set_wme(cfg->pub, 0); ++ if (!memcmp(ndev->name, WL_P2P_INTERFACE_PREFIX, strlen(WL_P2P_INTERFACE_PREFIX))) { ++ dhd_conf_set_mchan_bw(cfg->pub, WL_P2P_IF_CLIENT, -1); ++ } + } else if (WL_IS_LINKDOWN(cfg, e, data) || + ((event == WLC_E_SET_SSID) && + (ntoh32(e->status) != WLC_E_STATUS_SUCCESS) && +@@ -11907,6 +12260,27 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + wl_get_bss_info(cfg, ndev, (u8*)(&e->addr)); + } + #endif /* DHD_ENABLE_BIGDATA_LOGGING */ ++ if (wl_get_drv_status(cfg, CONNECTED, ndev)) { ++ u8 *curbssid = wl_read_prof(cfg, ndev, WL_PROF_BSSID); ++ if (memcmp(curbssid, &e->addr, ETHER_ADDR_LEN) != 0) { ++ bool fw_assoc_state = TRUE; ++ dhd_pub_t *dhd = (dhd_pub_t *)cfg->pub; ++ fw_assoc_state = dhd_is_associated(dhd, e->ifidx, &err); ++ if (!fw_assoc_state) { ++ WL_ERR(("Event sends up even different BSSID" ++ " cur: " MACDBG " event: " MACDBG"\n", ++ MAC2STRDBG(curbssid), ++ MAC2STRDBG((const u8*)(&e->addr)))); ++ } else { ++ WL_ERR(("BSSID of event is not the connected BSSID" ++ "(ignore it) cur: " MACDBG ++ " event: " MACDBG"\n", ++ MAC2STRDBG(curbssid), ++ MAC2STRDBG((const u8*)(&e->addr)))); ++ return 0; ++ } ++ } ++ } + /* Explicitly calling unlink to remove BSS in CFG */ + wiphy = bcmcfg_to_wiphy(cfg); + ssid = (struct wlc_ssid *)wl_read_prof(cfg, ndev, WL_PROF_SSID); +@@ -12096,8 +12470,10 @@ wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + } + DHD_ENABLE_RUNTIME_PM((dhd_pub_t *)cfg->pub); + } +- else { +- WL_ERR(("Invalid ndev status %d\n", wl_get_mode_by_netdev(cfg, ndev))); ++ else { ++ printf("wl_notify_connect_status : Invalid %s mode %d event %d status %d\n", ++ ndev->name, wl_get_mode_by_netdev(cfg, ndev), ntoh32(e->event_type), ++ ntoh32(e->status)); + } + return err; + } +@@ -12694,6 +13070,9 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev, + #if defined(WLADPS_SEAK_AP_WAR) || defined(WBTEXT) + dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub); + #endif /* WLADPS_SEAK_AP_WAR || WBTEXT */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ struct cfg80211_roam_info roam_info = {}; ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ + + #ifdef WLADPS_SEAK_AP_WAR + BCM_REFERENCE(dhdp); +@@ -12758,6 +13137,18 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev, + MAC2STRDBG((const u8*)(&e->addr)), *channel); + dhd_conf_set_wme(cfg->pub, 0); + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ roam_info.channel = notify_channel; ++ roam_info.bssid = curbssid; ++ roam_info.req_ie = conn_info->req_ie; ++ roam_info.req_ie_len = conn_info->req_ie_len; ++ roam_info.resp_ie = conn_info->resp_ie; ++ roam_info.resp_ie_len = conn_info->resp_ie_len; ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ cfg80211_roamed(ndev, &roam_info, GFP_KERNEL); ++#else + cfg80211_roamed(ndev, + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) + notify_channel, +@@ -12765,6 +13156,7 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev, + curbssid, + conn_info->req_ie, conn_info->req_ie_len, + conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ + WL_DBG(("Report roaming result\n")); + + memcpy(&cfg->last_roamed_addr, &e->addr, ETHER_ADDR_LEN); +@@ -14077,10 +14469,20 @@ void wl_terminate_event_handler(struct net_device *dev) + } + } + +-static void wl_scan_timeout(unsigned long data) ++static void wl_scan_timeout( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ unsigned long data ++#endif ++) + { + wl_event_msg_t msg; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct bcm_cfg80211 *cfg = from_timer(cfg, t, scan_timeout); ++#else + struct bcm_cfg80211 *cfg = (struct bcm_cfg80211 *)data; ++#endif + struct wireless_dev *wdev = NULL; + struct net_device *ndev = NULL; + struct wl_scan_results *bss_list; +@@ -14161,9 +14563,19 @@ static void wl_del_roam_timeout(struct bcm_cfg80211 *cfg) + + } + +-static void wl_roam_timeout(unsigned long data) ++static void wl_roam_timeout( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ unsigned long data ++#endif ++) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct bcm_cfg80211 *cfg = from_timer(cfg, t, roam_timeout); ++#else + struct bcm_cfg80211 *cfg = (struct bcm_cfg80211 *)data; ++#endif + dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub); + + WL_ERR(("roam timer expired\n")); +@@ -14371,8 +14783,13 @@ static s32 wl_notify_escan_complete(struct bcm_cfg80211 *cfg, + #ifdef WL_SCHED_SCAN + if (cfg->sched_scan_req && !cfg->scan_request) { + WL_PNO((">>> REPORTING SCHED SCAN RESULTS \n")); +- if (!aborted) ++ if (!aborted) { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ cfg80211_sched_scan_results(cfg->sched_scan_req->wiphy, 0); ++#else + cfg80211_sched_scan_results(cfg->sched_scan_req->wiphy); ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) */ ++ } + + DBG_EVENT_LOG(dhdp, WIFI_EVENT_DRIVER_PNO_SCAN_COMPLETE); + cfg->sched_scan_running = FALSE; +@@ -15197,9 +15614,13 @@ static s32 wl_init_scan(struct bcm_cfg80211 *cfg) + wl_escan_init_sync_id(cfg); + + /* Init scan_timeout timer */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&cfg->scan_timeout, wl_scan_timeout, 0); ++#else + init_timer(&cfg->scan_timeout); + cfg->scan_timeout.data = (unsigned long) cfg; + cfg->scan_timeout.function = wl_scan_timeout; ++#endif + + return err; + } +@@ -15210,9 +15631,13 @@ static s32 wl_init_roam_timeout(struct bcm_cfg80211 *cfg) + int err = 0; + + /* Init roam timer */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&cfg->roam_timeout, wl_roam_timeout, 0); ++#else + init_timer(&cfg->roam_timeout); + cfg->roam_timeout.data = (unsigned long) cfg; + cfg->roam_timeout.function = wl_roam_timeout; ++#endif + + return err; + } +@@ -15234,9 +15659,9 @@ static s32 wl_init_priv(struct bcm_cfg80211 *cfg) + cfg->active_scan = true; + cfg->rf_blocked = false; + cfg->vsdb_mode = false; +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + cfg->wlfc_on = false; +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + cfg->roam_flags |= WL_ROAM_OFF_ON_CONCURRENT; + cfg->disable_roam_event = false; + /* register interested state */ +@@ -15433,7 +15858,11 @@ s32 wl_cfg80211_attach(struct net_device *ndev, void *context) + kfree(wdev); + return -ENOMEM; + } ++#ifdef WLMESH ++ wdev->iftype = wl_mode_to_nl80211_iftype(WL_MODE_MESH); ++#else + wdev->iftype = wl_mode_to_nl80211_iftype(WL_MODE_BSS); ++#endif + cfg = wiphy_priv(wdev->wiphy); + cfg->wdev = wdev; + cfg->pub = context; +@@ -15560,14 +15989,14 @@ void wl_cfg80211_detach(struct bcm_cfg80211 *cfg) + wl_cfg80211_clear_mgmt_vndr_ies(cfg); + wl_deinit_priv(cfg); + wl_cfg80211_clear_parent_dev(); +- wl_free_wdev(cfg); + #if defined(RSSIAVG) +- wl_free_rssi_cache(&g_rssi_cache_ctrl); +- wl_free_rssi_cache(&g_connected_rssi_cache_ctrl); ++ wl_free_rssi_cache(&cfg->g_rssi_cache_ctrl); ++ wl_free_rssi_cache(&cfg->g_connected_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_release_bss_cache_ctrl(&g_bss_cache_ctrl); ++ wl_release_bss_cache_ctrl(&cfg->g_bss_cache_ctrl); + #endif ++ wl_free_wdev(cfg); + /* PLEASE do NOT call any function after wl_free_wdev, the driver's private + * structure "cfg", which is the private part of wiphy, has been freed in + * wl_free_wdev !!!!!!!!!!! +@@ -15761,6 +16190,12 @@ static s32 wl_config_ifmode(struct bcm_cfg80211 *cfg, struct net_device *ndev, s + mode = WL_MODE_BSS; + infra = 1; + break; ++#ifdef WLMESH ++ case NL80211_IFTYPE_MESH_POINT: ++ mode = WL_MODE_MESH; ++ infra = WL_BSSTYPE_MESH; ++ break; ++#endif /* WLMESH */ + case NL80211_IFTYPE_AP: + case NL80211_IFTYPE_P2P_GO: + mode = WL_MODE_AP; +@@ -16375,9 +16810,9 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg) + struct net_device *p2p_net = cfg->p2p_net; + #endif + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub); +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) + struct cfg80211_scan_info info; +@@ -16405,7 +16840,7 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg) + if (cfg->p2p_supported) { + wl_clr_p2p_status(cfg, GO_NEG_PHASE); + #ifdef PROP_TXSTATUS_VSDB +-#if defined(BCMSDIO) ++#if defined(BCMSDIO) || defined(BCMDBUS) + if (wl_cfgp2p_vif_created(cfg)) { + bool enabled = false; + dhd_wlfc_get_enable(dhd, &enabled); +@@ -16415,7 +16850,7 @@ static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg) + cfg->wlfc_on = false; + } + } +-#endif ++#endif /* BCMSDIO || BCMDBUS */ + #endif /* PROP_TXSTATUS_VSDB */ + } + +@@ -16583,6 +17018,10 @@ s32 wl_cfg80211_up(struct net_device *net) + return err; + } + } ++#ifdef WLMESH ++ cfg->wdev->wiphy->features |= NL80211_FEATURE_USERSPACE_MPM; ++#endif /* WLMESH */ ++ + err = __wl_cfg80211_up(cfg); + if (unlikely(err)) + WL_ERR(("__wl_cfg80211_up failed\n")); +@@ -16658,10 +17097,10 @@ int wl_cfg80211_hang(struct net_device *dev, u16 reason) + CFG80211_DISCONNECTED(dev, reason, NULL, 0, false, GFP_KERNEL); + } + #if defined(RSSIAVG) +- wl_free_rssi_cache(&g_rssi_cache_ctrl); ++ wl_free_rssi_cache(&cfg->g_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_free_bss_cache(&g_bss_cache_ctrl); ++ wl_free_bss_cache(&cfg->g_bss_cache_ctrl); + #endif + if (cfg != NULL) { + wl_link_down(cfg); +@@ -16679,10 +17118,10 @@ s32 wl_cfg80211_down(struct net_device *dev) + return err; + mutex_lock(&cfg->usr_sync); + #if defined(RSSIAVG) +- wl_free_rssi_cache(&g_rssi_cache_ctrl); ++ wl_free_rssi_cache(&cfg->g_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_free_bss_cache(&g_bss_cache_ctrl); ++ wl_free_bss_cache(&cfg->g_bss_cache_ctrl); + #endif + err = __wl_cfg80211_down(cfg); + mutex_unlock(&cfg->usr_sync); +@@ -17489,13 +17928,14 @@ wl_cfg80211_get_best_channel(struct net_device *ndev, void *buf, int buflen, + ret = wldev_ioctl_get(ndev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen)); + if ((ret == 0) && (dtoh32(chosen) != 0)) { + chip = dhd_conf_get_chip(dhd_get_pub(ndev)); +- if (chip != BCM43362_CHIP_ID && chip != BCM4330_CHIP_ID) { ++ if (chip != BCM43362_CHIP_ID && chip != BCM4330_CHIP_ID && ++ chip != BCM43143_CHIP_ID) { + u32 chanspec = 0; + int ctl_chan; + chanspec = wl_chspec_driver_to_host(chosen); +- printf("selected chanspec = 0x%x\n", chanspec); ++ WL_INFORM(("selected chanspec = 0x%x\n", chanspec)); + ctl_chan = wf_chspec_ctlchan(chanspec); +- printf("selected ctl_chan = %d\n", ctl_chan); ++ WL_INFORM(("selected ctl_chan = %d\n", ctl_chan)); + *channel = (u16)(ctl_chan & 0x00FF); + } else + *channel = (u16)(chosen & 0x00FF); +@@ -17597,8 +18037,10 @@ wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len) + // terence 20140120: fix for some chipsets only return 2.4GHz channel (4330b2/43341b0/4339a0) + band = band_cur==WLC_BAND_2G ? band_cur : WLC_BAND_5G; + ret = wldev_ioctl(dev, WLC_SET_BAND, &band, sizeof(band), true); +- if (ret < 0) ++ if (ret < 0) { + WL_ERR(("WLC_SET_BAND error %d\n", ret)); ++ goto done; ++ } + + /* Best channel selection in 5GHz band. */ + ret = wl_cfg80211_get_chanspecs_5g(ndev, (void *)buf, CHANSPEC_BUF_SIZE); +@@ -21233,3 +21675,24 @@ wl_set_rssi_logging(struct net_device *dev, void *param) + return err; + } + #endif /* SUPPORT_RSSI_LOGGING */ ++ ++s32 wl_cfg80211_autochannel(struct net_device *dev, char* command, int total_len) ++{ ++ struct bcm_cfg80211 *cfg = wl_get_cfg(dev); ++ int ret = 0; ++ int bytes_written = -1; ++ ++ sscanf(command, "%*s %d", &cfg->autochannel); ++ ++ if (cfg->autochannel == 0) { ++ cfg->best_2g_ch = 0; ++ cfg->best_5g_ch = 0; ++ } else if (cfg->autochannel == 2) { ++ bytes_written = snprintf(command, total_len, "2g=%d 5g=%d", ++ cfg->best_2g_ch, cfg->best_5g_ch); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ ++ return ret; ++} +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.h +old mode 100755 +new mode 100644 +index 9d06534db7cd..395dfd5ae7f4 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.h +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + struct wl_conf; + struct wl_iface; + struct bcm_cfg80211; +@@ -205,6 +206,11 @@ do { \ + #define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ + #define IEEE80211_NUM_BANDS NUM_NL80211_BANDS + #endif ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)) ++#ifdef WLMESH ++#undef WLMESH ++#endif ++#endif + + #define WL_SCAN_RETRY_MAX 3 + #define WL_NUM_PMKIDS_MAX MAXPMKID +@@ -339,7 +345,10 @@ enum wl_status { + enum wl_mode { + WL_MODE_BSS, + WL_MODE_IBSS, +- WL_MODE_AP ++ WL_MODE_AP, ++#ifdef WLMESH ++ WL_MODE_MESH ++#endif + }; + + /* driver profile list */ +@@ -735,7 +744,7 @@ struct bcm_cfg80211 { + bool pwr_save; + bool roam_on; /* on/off switch for self-roaming */ + bool scan_tried; /* indicates if first scan attempted */ +-#if defined(BCMSDIO) || defined(BCMPCIE) ++#if defined(BCMSDIO) || defined(BCMDBUS) + bool wlfc_on; + #endif + bool vsdb_mode; +@@ -845,9 +854,23 @@ struct bcm_cfg80211 { + + #ifdef STAT_REPORT + void *stat_report_info; ++#endif ++#ifdef WLMESH ++ char sae_password[SAE_MAX_PASSWD_LEN]; ++ uint sae_password_len; ++#endif /* WLMESH */ ++#if defined(RSSIAVG) ++ wl_rssi_cache_ctrl_t g_rssi_cache_ctrl; ++ wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl; ++#endif ++#if defined(BSSCACHE) ++ wl_bss_cache_ctrl_t g_bss_cache_ctrl; + #endif + int p2p_disconnected; // terence 20130703: Fix for wrong group_capab (timing issue) + struct ether_addr disconnected_bssid; ++ int autochannel; ++ int best_2g_ch; ++ int best_5g_ch; + }; + + #if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \ +@@ -1462,6 +1485,9 @@ extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len + extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len); + extern s32 wl_cfg80211_set_p2p_ecsa(struct net_device *net, char* buf, int len); + extern s32 wl_cfg80211_increase_p2p_bw(struct net_device *net, char* buf, int len); ++#ifdef WLMESH ++extern s32 wl_cfg80211_set_sae_password(struct net_device *net, char* buf, int len); ++#endif + #ifdef WL11ULB + extern s32 wl_cfg80211_set_ulb_mode(struct net_device *dev, int mode); + extern s32 wl_cfg80211_set_ulb_bw(struct net_device *dev, +@@ -1652,4 +1678,5 @@ int wl_cfg80211_iface_count(struct net_device *dev); + struct net_device* wl_get_ap_netdev(struct bcm_cfg80211 *cfg, char *ifname); + struct net_device* wl_get_netdev_by_name(struct bcm_cfg80211 *cfg, char *ifname); + int wl_cfg80211_get_vndr_ouilist(struct bcm_cfg80211 *cfg, uint8 *buf, int max_cnt); ++s32 wl_cfg80211_autochannel(struct net_device *dev, char* command, int total_len); + #endif /* _wl_cfg80211_h_ */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg_btcoex.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg_btcoex.c +old mode 100755 +new mode 100644 +index 4fd40fd779fc..6d62b3a40f09 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg_btcoex.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg_btcoex.c +@@ -294,9 +294,19 @@ wl_cfg80211_bt_setflag(struct net_device *dev, bool set) + #endif + } + +-static void wl_cfg80211_bt_timerfunc(ulong data) ++static void wl_cfg80211_bt_timerfunc( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ unsigned long data ++#endif ++) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct btcoex_info *bt_local = from_timer(bt_local, t, timer); ++#else + struct btcoex_info *bt_local = (struct btcoex_info *)data; ++#endif + WL_TRACE(("Enter\n")); + bt_local->timer_on = 0; + schedule_work(&bt_local->work); +@@ -393,9 +403,13 @@ void* wl_cfg80211_btcoex_init(struct net_device *ndev) + btco_inf->ts_dhcp_ok = 0; + /* Set up timer for BT */ + btco_inf->timer_ms = 10; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&btco_inf->timer, wl_cfg80211_bt_timerfunc, 0); ++#else + init_timer(&btco_inf->timer); + btco_inf->timer.data = (ulong)btco_inf; + btco_inf->timer.function = wl_cfg80211_bt_timerfunc; ++#endif + + btco_inf->dev = ndev; + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.c +old mode 100755 +new mode 100644 +index f0cf56e35bad..69f7a050cd14 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.c +@@ -56,6 +56,7 @@ + #include + #include + #include ++#include + + #if defined(BCMPCIE) && defined(DHD_FW_COREDUMP) + extern int dhd_bus_mem_dump(dhd_pub_t *dhd); +@@ -333,6 +334,9 @@ wl_cfgp2p_init_priv(struct bcm_cfg80211 *cfg) + return -ENOMEM; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ cfg->p2p->cfg = cfg; ++#endif + wl_to_p2p_bss_ndev(cfg, P2PAPI_BSSCFG_PRIMARY) = bcmcfg_to_prmry_ndev(cfg); + wl_to_p2p_bss_bssidx(cfg, P2PAPI_BSSCFG_PRIMARY) = 0; + wl_to_p2p_bss_ndev(cfg, P2PAPI_BSSCFG_DEVICE) = NULL; +@@ -1385,10 +1389,21 @@ wl_cfgp2p_listen_complete(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + * so lets do it from thread context. + */ + void +-wl_cfgp2p_listen_expired(unsigned long data) ++wl_cfgp2p_listen_expired( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ ulong data ++#endif ++) + { + wl_event_msg_t msg; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct p2p_info *p2p = from_timer(p2p, t, listen_timer); ++ struct bcm_cfg80211 *cfg = p2p->cfg; ++#else + struct bcm_cfg80211 *cfg = (struct bcm_cfg80211 *) data; ++#endif + struct net_device *ndev; + CFGP2P_DBG((" Enter\n")); + +@@ -1742,6 +1757,8 @@ wl_cfgp2p_supported(struct bcm_cfg80211 *cfg, struct net_device *ndev) + return ret; + } + } ++ if (cfg->pub->conf->fw_type == FW_TYPE_MESH) ++ p2p_supported = 0; + if (p2p_supported == 1) { + CFGP2P_INFO(("p2p is supported\n")); + } else { +@@ -1750,6 +1767,7 @@ wl_cfgp2p_supported(struct bcm_cfg80211 *cfg, struct net_device *ndev) + } + return p2p_supported; + } ++ + /* Cleanup P2P resources */ + s32 + wl_cfgp2p_down(struct bcm_cfg80211 *cfg) +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.h +old mode 100755 +new mode 100644 +index dba6b4783fba..ca930acc6553 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgp2p.h +@@ -71,6 +71,9 @@ struct p2p_bss { + }; + + struct p2p_info { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct bcm_cfg80211 *cfg; ++#endif + bool on; /**< p2p on/off switch */ + bool scan; + int16 search_state; +@@ -183,6 +186,14 @@ enum wl_cfgp2p_status { + printk args; \ + } \ + } while (0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++#define INIT_TIMER(timer, func, duration, extra_delay) \ ++ do { \ ++ timer_setup(timer, func, 0); \ ++ timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \ ++ add_timer(timer); \ ++ } while (0); ++#else + #define INIT_TIMER(timer, func, duration, extra_delay) \ + do { \ + init_timer(timer); \ +@@ -191,6 +202,7 @@ enum wl_cfgp2p_status { + timer->data = (unsigned long) cfg; \ + add_timer(timer); \ + } while (0); ++#endif + + #if (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 0, 8)) + #ifdef WL_SUPPORT_BACKPORTED_KPATCHES +@@ -245,7 +257,13 @@ enum wl_cfgp2p_status { + #define P2P_ECSA_CNT 50 + + extern void +-wl_cfgp2p_listen_expired(unsigned long data); ++wl_cfgp2p_listen_expired( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ ulong data ++#endif ++); + extern bool + wl_cfgp2p_is_pub_action(void *frame, u32 frame_len); + extern bool +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvendor.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvendor.c +index bd918e6583de..c5b4b2b05620 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvendor.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvendor.c +@@ -2322,10 +2322,15 @@ static int wl_cfgvendor_lstats_get_info(struct wiphy *wiphy, + ((wl_cnt_info_t *)iovar_buf)->datalen, + WL_CNT_XTLV_CNTV_LE10_UCODE, NULL, + BCM_XTLV_OPTION_ALIGN32)) == NULL) { +- macstat_cnt = bcm_get_data_from_xtlv_buf(((wl_cnt_info_t *)iovar_buf)->data, ++ if ((macstat_cnt = bcm_get_data_from_xtlv_buf(((wl_cnt_info_t *)iovar_buf)->data, + ((wl_cnt_info_t *)iovar_buf)->datalen, + WL_CNT_XTLV_GE40_UCODE_V1, NULL, ++ BCM_XTLV_OPTION_ALIGN32)) == NULL) { ++ macstat_cnt = bcm_get_data_from_xtlv_buf(((wl_cnt_info_t *)iovar_buf)->data, ++ ((wl_cnt_info_t *)iovar_buf)->datalen, ++ WL_CNT_XTLV_LT40_UCODE_V1, NULL, + BCM_XTLV_OPTION_ALIGN32); ++ } + } + + if (macstat_cnt == NULL) { +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c +index a5aa76bad90c..3778d4977b78 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c +@@ -1,5 +1,4 @@ + /* SPDX-License-Identifier: GPL-2.0 */ +- + #if defined(WL_ESCAN) + + #include +@@ -29,21 +28,21 @@ + #define ESCAN_ERROR(x) \ + do { \ + if (iw_msg_level & ESCAN_ERROR_LEVEL) { \ +- printf(KERN_ERR "ESCAN-ERROR) "); \ ++ printf(KERN_ERR "ESCAN-ERROR) %s : ", __func__); \ + printf x; \ + } \ + } while (0) + #define ESCAN_SCAN(x) \ + do { \ + if (iw_msg_level & ESCAN_SCAN_LEVEL) { \ +- printf(KERN_ERR "ESCAN-SCAN) "); \ ++ printf(KERN_ERR "ESCAN-SCAN) %s : ", __func__); \ + printf x; \ + } \ + } while (0) + #define ESCAN_TRACE(x) \ + do { \ + if (iw_msg_level & ESCAN_TRACE_LEVEL) { \ +- printf(KERN_ERR "ESCAN-TRACE) "); \ ++ printf(KERN_ERR "ESCAN-TRACE) %s : ", __func__); \ + printf x; \ + } \ + } while (0) +@@ -73,15 +72,6 @@ typedef struct { + #endif /* ESCAN_BUF_OVERFLOW_MGMT */ + + struct wl_escan_info *g_escan = NULL; +- +-#if defined(RSSIAVG) +-static wl_rssi_cache_ctrl_t g_rssi_cache_ctrl; +-static wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl; +-#endif +-#if defined(BSSCACHE) +-static wl_bss_cache_ctrl_t g_bss_cache_ctrl; +-#endif +- + /* Return a new chanspec given a legacy chanspec + * Returns INVCHANSPEC on error + */ +@@ -416,7 +406,7 @@ fail: + } + + void +-wl_escan_event(struct net_device *ndev, const wl_event_msg_t * e, void *data) ++wl_escan_event(struct net_device *dev, const wl_event_msg_t * e, void *data) + { + u32 event_type = ntoh32(e->event_type); + struct wl_escan_info *escan = g_escan; +@@ -443,7 +433,7 @@ wl_escan_event(struct net_device *ndev, const wl_event_msg_t * e, void *data) + } + + DHD_EVENT_WAKE_LOCK(escan->pub); +- if (likely(!wl_enq_event(escan, ndev, event_type, e, data))) { ++ if (likely(!wl_enq_event(escan, dev, event_type, e, data))) { + wl_wakeup_event(escan); + } else { + DHD_EVENT_WAKE_UNLOCK(escan->pub); +@@ -462,34 +452,39 @@ static s32 wl_escan_inform_bss(struct wl_escan_info *escan) + + /* Delete disconnected cache */ + #if defined(BSSCACHE) +- wl_delete_disconnected_bss_cache(&g_bss_cache_ctrl, (u8*)&escan->disconnected_bssid); ++ wl_delete_disconnected_bss_cache(&escan->g_bss_cache_ctrl, (u8*)&escan->disconnected_bssid); + #if defined(RSSIAVG) +- wl_delete_disconnected_rssi_cache(&g_rssi_cache_ctrl, (u8*)&escan->disconnected_bssid); ++ wl_delete_disconnected_rssi_cache(&escan->g_rssi_cache_ctrl, (u8*)&escan->disconnected_bssid); + #endif + #endif + + /* Update cache */ + #if defined(RSSIAVG) +- wl_update_rssi_cache(&g_rssi_cache_ctrl, bss_list); ++ wl_update_rssi_cache(&escan->g_rssi_cache_ctrl, bss_list); + if (!in_atomic()) +- wl_update_connected_rssi_cache(escan->dev, &g_rssi_cache_ctrl, &rssi); ++ wl_update_connected_rssi_cache(escan->dev, &escan->g_rssi_cache_ctrl, &rssi); + #endif + #if defined(BSSCACHE) +- wl_update_bss_cache(&g_bss_cache_ctrl, ++ wl_update_bss_cache(&escan->g_bss_cache_ctrl, + #if defined(RSSIAVG) +- &g_rssi_cache_ctrl, ++ &escan->g_rssi_cache_ctrl, + #endif + bss_list); + #endif + + /* delete dirty cache */ + #if defined(RSSIAVG) +- wl_delete_dirty_rssi_cache(&g_rssi_cache_ctrl); +- wl_reset_rssi_cache(&g_rssi_cache_ctrl); ++ wl_delete_dirty_rssi_cache(&escan->g_rssi_cache_ctrl); ++ wl_reset_rssi_cache(&escan->g_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_delete_dirty_bss_cache(&g_bss_cache_ctrl); +- wl_reset_bss_cache(&g_bss_cache_ctrl); ++ wl_delete_dirty_bss_cache(&escan->g_bss_cache_ctrl); ++ wl_reset_bss_cache(&escan->g_bss_cache_ctrl); ++ if (escan->autochannel) ++ wl_ext_get_best_channel(escan->dev, &escan->g_bss_cache_ctrl, &escan->best_2g_ch, &escan->best_5g_ch); ++#else ++ if (escan->autochannel) ++ wl_ext_get_best_channel(escan->dev, bss_list, &escan->best_2g_ch, &escan->best_5g_ch); + #endif + + ESCAN_TRACE(("scanned AP count (%d)\n", bss_list->count)); +@@ -849,20 +844,21 @@ static s32 wl_escan_handler(struct wl_escan_info *escan, + } + else if (status == WLC_E_STATUS_SUCCESS) { + escan->escan_state = ESCAN_STATE_IDLE; +- +- ESCAN_TRACE(("ESCAN COMPLETED\n")); +- escan->bss_list = wl_escan_get_buf(escan); +- ESCAN_TRACE(("SCAN COMPLETED: scanned AP count=%d\n", +- escan->bss_list->count)); +- wl_escan_inform_bss(escan); +- wl_notify_escan_complete(escan, false); +- ++ ESCAN_TRACE(("ESCAN COMPLETED\n")); ++ escan->bss_list = wl_escan_get_buf(escan); ++ ESCAN_TRACE(("SCAN COMPLETED: scanned AP count=%d\n", ++ escan->bss_list->count)); ++ wl_escan_inform_bss(escan); ++ wl_notify_escan_complete(escan, false); + } else if ((status == WLC_E_STATUS_ABORT) || (status == WLC_E_STATUS_NEWSCAN) || + (status == WLC_E_STATUS_11HQUIET) || (status == WLC_E_STATUS_CS_ABORT) || + (status == WLC_E_STATUS_NEWASSOC)) { + /* Handle all cases of scan abort */ + escan->escan_state = ESCAN_STATE_IDLE; + ESCAN_TRACE(("ESCAN ABORT reason: %d\n", status)); ++ escan->bss_list = wl_escan_get_buf(escan); ++ ESCAN_TRACE(("SCAN ABORT: scanned AP count=%d\n", ++ escan->bss_list->count)); + wl_escan_inform_bss(escan); + wl_notify_escan_complete(escan, false); + } else if (status == WLC_E_STATUS_TIMEOUT) { +@@ -871,6 +867,7 @@ static s32 wl_escan_handler(struct wl_escan_info *escan, + if (e->reason == 0xFFFFFFFF) { + wl_notify_escan_complete(escan, true); + } ++ escan->escan_state = ESCAN_STATE_IDLE; + } else { + ESCAN_ERROR(("unexpected Escan Event %d : abort\n", status)); + escan->escan_state = ESCAN_STATE_IDLE; +@@ -983,9 +980,8 @@ wl_escan_prep(struct wl_escan_info *escan, wl_uint32_list_t *list, + return err; + } + +-static int wl_escan_reset(void) { +- struct wl_escan_info *escan = g_escan; +- ++static int wl_escan_reset(struct wl_escan_info *escan) ++{ + if (timer_pending(&escan->scan_timeout)) + del_timer_sync(&escan->scan_timeout); + escan->escan_state = ESCAN_STATE_IDLE; +@@ -993,10 +989,20 @@ static int wl_escan_reset(void) { + return 0; + } + +-static void wl_escan_timeout(unsigned long data) ++static void wl_escan_timeout( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ unsigned long data ++#endif ++) + { + wl_event_msg_t msg; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct wl_escan_info *escan = from_timer(escan, t, scan_timeout); ++#else + struct wl_escan_info *escan = (struct wl_escan_info *)data; ++#endif + struct wl_scan_results *bss_list; + struct wl_bss_info *bi = NULL; + s32 i; +@@ -1047,7 +1053,7 @@ wl_escan_set_scan( + wl_escan_params_t *params = NULL; + scb_val_t scbval; + static int cnt = 0; +- struct wl_escan_info *escan = NULL; ++ struct wl_escan_info *escan = g_escan; + wlc_ssid_t ssid; + u32 n_channels = 0; + wl_uint32_list_t *list; +@@ -1056,9 +1062,8 @@ wl_escan_set_scan( + + ESCAN_TRACE(("Enter \n")); + +- escan = g_escan; + if (!escan) { +- ESCAN_ERROR(("device is not ready\n")); \ ++ ESCAN_ERROR(("device is not ready\n")); + return -EIO; + } + mutex_lock(&escan->usr_sync); +@@ -1145,7 +1150,7 @@ wl_escan_set_scan( + ESCAN_TRACE(("Escan not permitted at this time (%d)\n", err)); + else + ESCAN_ERROR(("Escan set error (%d)\n", err)); +- wl_escan_reset(); ++ wl_escan_reset(escan); + } + kfree(params); + +@@ -1206,10 +1211,15 @@ wl_escan_get_scan( + err = -EAGAIN; + goto exit; + } ++ if (!escan->bss_list) { ++ ESCAN_ERROR(("%s: scan not ready\n", dev->name)); ++ err = -EAGAIN; ++ goto exit; ++ } + + #if defined(BSSCACHE) +- bss_list = &g_bss_cache_ctrl.m_cache_head->results; +- node = g_bss_cache_ctrl.m_cache_head; ++ bss_list = &escan->g_bss_cache_ctrl.m_cache_head->results; ++ node = escan->g_bss_cache_ctrl.m_cache_head; + for (i=0; node && ibss_list; +@@ -1228,7 +1238,7 @@ wl_escan_get_scan( + } + + #if defined(RSSIAVG) +- rssi = wl_get_avg_rssi(&g_rssi_cache_ctrl, &bi->BSSID); ++ rssi = wl_get_avg_rssi(&escan->g_rssi_cache_ctrl, &bi->BSSID); + if (rssi == RSSI_MINVAL) + rssi = MIN(dtoh16(bi->RSSI), RSSI_MAXVAL); + #else +@@ -1236,8 +1246,8 @@ wl_escan_get_scan( + rssi = MIN(dtoh16(bi->RSSI), RSSI_MAXVAL); + #endif + channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(escan->ioctl_ver, bi->chanspec)); +- ESCAN_SCAN(("%s: BSSID="MACSTR", channel=%d, RSSI=%d, SSID=\"%s\"\n", +- __FUNCTION__, MAC2STR(bi->BSSID.octet), channel, rssi, bi->SSID)); ++ ESCAN_SCAN(("BSSID="MACSTR", channel=%d, RSSI=%d, SSID=\"%s\"\n", ++ MAC2STR(bi->BSSID.octet), channel, rssi, bi->SSID)); + + /* First entry must be the BSSID */ + iwe.cmd = SIOCGIWAP; +@@ -1323,6 +1333,27 @@ exit: + return err; + } + ++s32 wl_escan_autochannel(struct net_device *dev, char* command, int total_len) ++{ ++ struct wl_escan_info *escan = g_escan; ++ int ret = 0; ++ int bytes_written = -1; ++ ++ sscanf(command, "%*s %d", &escan->autochannel); ++ ++ if (escan->autochannel == 0) { ++ escan->best_2g_ch = 0; ++ escan->best_5g_ch = 0; ++ } else if (escan->autochannel == 2) { ++ bytes_written = snprintf(command, total_len, "2g=%d 5g=%d", ++ escan->best_2g_ch, escan->best_5g_ch); ++ ANDROID_TRACE(("%s: command result is %s\n", __FUNCTION__, command)); ++ ret = bytes_written; ++ } ++ ++ return ret; ++} ++ + static s32 wl_create_event_handler(struct wl_escan_info *escan) + { + int ret = 0; +@@ -1343,42 +1374,44 @@ static void wl_destroy_event_handler(struct wl_escan_info *escan) + PROC_STOP(&escan->event_tsk); + } + +-static void wl_escan_deinit(void) ++static void wl_escan_deinit(struct wl_escan_info *escan) + { +- struct wl_escan_info *escan = g_escan; +- + printf("%s: Enter\n", __FUNCTION__); + if (!escan) { +- ESCAN_ERROR(("device is not ready\n")); \ ++ ESCAN_ERROR(("device is not ready\n")); + return; + } + wl_destroy_event_handler(escan); + wl_flush_eq(escan); + del_timer_sync(&escan->scan_timeout); ++ escan->escan_state = ESCAN_STATE_IDLE; + + #if defined(RSSIAVG) +- wl_free_rssi_cache(&g_rssi_cache_ctrl); ++ wl_free_rssi_cache(&escan->g_rssi_cache_ctrl); + #endif + #if defined(BSSCACHE) +- wl_free_bss_cache(&g_bss_cache_ctrl); ++ wl_free_bss_cache(&escan->g_bss_cache_ctrl); + #endif + } + +-static s32 wl_escan_init(void) ++static s32 wl_escan_init(struct wl_escan_info *escan) + { +- struct wl_escan_info *escan = g_escan; + int err = 0; + + printf("%s: Enter\n", __FUNCTION__); + if (!escan) { +- ESCAN_ERROR(("device is not ready\n")); \ ++ ESCAN_ERROR(("device is not ready\n")); + return -EIO; + } + + /* Init scan_timeout timer */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&escan->scan_timeout, wl_escan_timeout, 0); ++#else + init_timer(&escan->scan_timeout); + escan->scan_timeout.data = (unsigned long) escan; + escan->scan_timeout.function = wl_escan_timeout; ++#endif + + if (wl_create_event_handler(escan)) { + err = -ENOMEM; +@@ -1393,7 +1426,7 @@ static s32 wl_escan_init(void) + + return 0; + err: +- wl_escan_deinit(); ++ wl_escan_deinit(escan); + return err; + } + +@@ -1404,11 +1437,11 @@ void wl_escan_detach(dhd_pub_t *dhdp) + printf("%s: Enter\n", __FUNCTION__); + + if (!escan) { +- ESCAN_ERROR(("device is not ready\n")); \ ++ ESCAN_ERROR(("device is not ready\n")); + return; + } + +- wl_escan_deinit(); ++ wl_escan_deinit(escan); + + if (escan->escan_ioctl_buf) { + kfree(escan->escan_ioctl_buf); +@@ -1430,10 +1463,10 @@ wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp) + escan = (wl_escan_info_t *)DHD_OS_PREALLOC(dhdp, DHD_PREALLOC_WL_ESCAN_INFO, sizeof(struct wl_escan_info)); + if (!escan) + return -ENOMEM; ++ g_escan = escan; + memset(escan, 0, sizeof(struct wl_escan_info)); + + /* we only care about main interface so save a global here */ +- g_escan = escan; + escan->dev = dev; + escan->pub = dhdp; + escan->escan_state = ESCAN_STATE_IDLE; +@@ -1444,9 +1477,7 @@ wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp) + goto err ; + } + wl_init_eq(escan); +-#ifdef WL_ESCAN +- wl_escan_init(); +-#endif ++ wl_escan_init(escan); + + return 0; + err: +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.h +index 62bc0d28b0e8..6d84ce56c547 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.h ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.h +@@ -1,5 +1,4 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ +- ++/* SPDX-License-Identifier: GPL-2.0 */ + #ifndef _wl_escan_ + #define _wl_escan_ + +@@ -57,9 +56,19 @@ typedef struct wl_escan_info { + tsk_ctl_t event_tsk; /* task of main event handler thread */ + ESCAN_EVENT_HANDLER evt_handler[WLC_E_LAST]; + struct mutex usr_sync; /* maily for up/down synchronization */ ++ int autochannel; ++ int best_2g_ch; ++ int best_5g_ch; ++#if defined(RSSIAVG) ++ wl_rssi_cache_ctrl_t g_rssi_cache_ctrl; ++ wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl; ++#endif ++#if defined(BSSCACHE) ++ wl_bss_cache_ctrl_t g_bss_cache_ctrl; ++#endif + } wl_escan_info_t; + +-void wl_escan_event(struct net_device *ndev, const wl_event_msg_t * e, void *data); ++void wl_escan_event(struct net_device *dev, const wl_event_msg_t * e, void *data); + + int wl_escan_set_scan( + struct net_device *dev, +@@ -69,6 +78,7 @@ int wl_escan_set_scan( + ); + int wl_escan_get_scan(struct net_device *dev, struct iw_request_info *info, + struct iw_point *dwrq, char *extra); ++s32 wl_escan_autochannel(struct net_device *dev, char* command, int total_len); + int wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp); + void wl_escan_detach(dhd_pub_t *dhdp); + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_iw.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_iw.c +index c2883471ee1e..4713882c27ae 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_iw.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_iw.c +@@ -627,16 +627,18 @@ wl_iw_get_freq( + char *extra + ) + { +- channel_info_t ci; + int error; ++ u32 chanspec = 0; ++ int ctl_chan; + + WL_TRACE(("%s: SIOCGIWFREQ\n", dev->name)); + +- if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)))) ++ if ((error = dev_wlc_intvar_get(dev, "chanspec", &chanspec))) + return error; ++ ctl_chan = wf_chspec_ctlchan(chanspec); + + /* Return radio channel in channel form */ +- fwrq->m = dtoh32(ci.hw_channel); ++ fwrq->m = ctl_chan; + fwrq->e = dtoh32(0); + return 0; + } +@@ -1779,15 +1781,14 @@ wl_iw_get_essid( + /* Max SSID length check */ + if (ssid.SSID_len > IW_ESSID_MAX_SIZE) { + ssid.SSID_len = IW_ESSID_MAX_SIZE; +- /* Get the current SSID */ +- memcpy(extra, ssid.SSID, ssid.SSID_len); +- /* NULL terminating as length of extra buffer is IW_ESSID_MAX_SIZE ie 32 */ +- extra[IW_ESSID_MAX_SIZE - 1] = '\0'; +- } else { +- /* Get the current SSID */ +- memcpy(extra, ssid.SSID, ssid.SSID_len); + } + ++ /* Get the current SSID */ ++ memcpy(extra, ssid.SSID, ssid.SSID_len); ++ ++ /* NULL terminating as length of extra buffer is IW_ESSID_MAX_SIZE ie 32 */ ++ extra[IW_ESSID_MAX_SIZE] = '\0'; ++ + dwrq->length = ssid.SSID_len; + + dwrq->flags = 1; /* active */ +@@ -3304,6 +3305,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) + uint16 flags = ntoh16(e->flags); + uint32 datalen = ntoh32(e->datalen); + uint32 status = ntoh32(e->status); ++ uint32 reason = ntoh32(e->reason); + + memset(&wrqu, 0, sizeof(wrqu)); + memset(extra, 0, sizeof(extra)); +@@ -3333,12 +3335,12 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) + cmd = SIOCGIWAP; + wrqu.data.length = strlen(extra); + if (!(flags & WLC_EVENT_MSG_LINK)) { +- printf("%s: Link Down with BSSID="MACSTR"\n", __FUNCTION__, +- MAC2STR((u8 *)wrqu.addr.sa_data)); ++ printf("%s: Link Down with "MACSTR", reason=%d\n", __FUNCTION__, ++ MAC2STR((u8 *)wrqu.addr.sa_data), reason); + bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); + bzero(&extra, ETHER_ADDR_LEN); + } else { +- printf("%s: Link UP with BSSID="MACSTR"\n", __FUNCTION__, ++ printf("%s: Link UP with "MACSTR"\n", __FUNCTION__, + MAC2STR((u8 *)wrqu.addr.sa_data)); + } + break; +@@ -3545,15 +3547,19 @@ int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstat + #endif /* WIRELESS_EXT > 11 */ + + phy_noise = 0; +- if ((res = dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise, sizeof(phy_noise)))) ++ if ((res = dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise, sizeof(phy_noise)))) { ++ WL_ERROR(("%s: WLC_GET_PHY_NOISE error=%d\n", __FUNCTION__, res)); + goto done; ++ } + + phy_noise = dtoh32(phy_noise); + WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n *****", phy_noise)); + +- scb_val.val = 0; +- if ((res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) ++ memset(&scb_val, 0, sizeof(scb_val)); ++ if ((res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) { ++ WL_ERROR(("%s: WLC_GET_RSSI error=%d\n", __FUNCTION__, res)); + goto done; ++ } + + rssi = dtoh32(scb_val.val); + rssi = MIN(rssi, RSSI_MAXVAL); +@@ -3647,9 +3653,19 @@ done: + + #ifndef WL_ESCAN + static void +-wl_iw_timerfunc(ulong data) ++wl_iw_timerfunc( ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ struct timer_list *t ++#else ++ unsigned long data ++#endif ++) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ iscan_info_t *iscan = from_timer(iscan, t, timer); ++#else + iscan_info_t *iscan = (iscan_info_t *)data; ++#endif + iscan->timer_on = 0; + if (iscan->iscan_state != ISCAN_STATE_IDLE) { + WL_TRACE(("timer trigger\n")); +@@ -3887,9 +3903,13 @@ wl_iw_attach(struct net_device *dev, void * dhdp) + + /* Set up the timer */ + iscan->timer_ms = 2000; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) ++ timer_setup(&iscan->timer, wl_iw_timerfunc, 0); ++#else + init_timer(&iscan->timer); + iscan->timer.data = (ulong)iscan; + iscan->timer.function = wl_iw_timerfunc; ++#endif + + sema_init(&iscan->sysioc_sem, 0); + init_completion(&iscan->sysioc_exited); +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wldev_common.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wldev_common.c +index 1b985b090880..8be455fc777e 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wldev_common.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wldev_common.c +@@ -34,7 +34,9 @@ + + #include + #include ++#ifdef WL_CFG80211 + #include ++#endif + #include + + #define htod32(i) (i) +@@ -478,9 +480,11 @@ int wldev_set_country( + wl_country_t cur_cspec = {{0}, 0, {0}}; /* current ccode */ + scb_val_t scbval; + char smbuf[WLC_IOCTL_SMLEN]; ++#ifdef WL_CFG80211 + struct wireless_dev *wdev = ndev_to_wdev(dev); + struct wiphy *wiphy = wdev->wiphy; + struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++#endif + + if (!country_code) + return error; +@@ -495,7 +499,7 @@ int wldev_set_country( + cspec.rev = revinfo; + memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ); + memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ); +- error = dhd_conf_get_country_from_config(dhd_get_pub(dev), &cspec); ++ error = dhd_conf_map_country_list(dhd_get_pub(dev), &cspec, 0); + if (error) + dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec); + +@@ -506,7 +510,11 @@ int wldev_set_country( + dhd_force_country_change(dev) || + (strncmp(cspec.ccode, cur_cspec.ccode, WLC_CNTRY_BUF_SZ) != 0)) { + +- if ((user_enforced) && (wl_get_drv_status(cfg, CONNECTED, dev))) { ++ if ((user_enforced) ++#ifdef WL_CFG80211 ++ && (wl_get_drv_status(cfg, CONNECTED, dev)) ++#endif ++ ) { + bzero(&scbval, sizeof(scb_val_t)); + error = wldev_ioctl_set(dev, WLC_DISASSOC, + &scbval, sizeof(scb_val_t)); + +From 8f71cec481e88d3292f72ffa20f4422736593142 Mon Sep 17 00:00:00 2001 +From: Yao Xiao +Date: Fri, 28 Sep 2018 11:59:22 +0800 +Subject: [PATCH] net: wireless: bcmdhd: fix some issues for driver + "1.579.77.41.9 (r)" + +1. disable tuning during sdio sleep +2. add get_oob_irq_flags interface for request_irq(flags) + +Change-Id: Ic77fd82fc3f93a813512ecceaed2c75fe204b750 +Signed-off-by: Yao Xiao +--- + .../net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c | 14 +++++++++----- + .../net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c | 13 +++++++++++++ + 2 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c +index 7291322edc4f..dbdcbfa77f0d 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c +@@ -241,6 +241,7 @@ int dhd_wlan_init_gpio(void) + #ifdef CUSTOMER_OOB + int host_oob_irq = -1; + uint host_oob_irq_flags = 0; ++ int irq_flags = -1; + #endif + + /* Please check your schematic and fill right GPIO number which connected to +@@ -286,11 +287,14 @@ int dhd_wlan_init_gpio(void) + host_oob_irq = rockchip_wifi_get_oob_irq(); + + #ifdef HW_OOB +-#ifdef HW_OOB_LOW_LEVEL +- host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_SHAREABLE; +-#else +- host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE; +-#endif ++ host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE; ++ irq_flags = rockchip_wifi_get_oob_irq_flag(); ++ if (irq_flags == 1) ++ host_oob_irq_flags |= IORESOURCE_IRQ_HIGHLEVEL; ++ else if (irq_flags == 0) ++ host_oob_irq_flags |= IORESOURCE_IRQ_LOWLEVEL; ++ else ++ pr_warn("%s: unknown oob irqflags !\n", __func__); + #else + host_oob_irq_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_SHAREABLE; + #endif +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c +index 3e035df90f9b..342a53a4eb5e 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_sdio.c +@@ -79,6 +79,10 @@ + #include + #endif /* BT_OVER_SDIO */ + ++#include ++#include ++#include "bcmsdh_sdmmc.h" ++ + bool dhd_mp_halting(dhd_pub_t *dhdp); + extern void bcmsdh_waitfor_iodrain(void *sdh); + extern void bcmsdh_reject_ioreqs(void *sdh, bool reject); +@@ -1038,6 +1042,12 @@ dhdsdio_clk_kso_enab(dhd_bus_t *bus, bool on) + uint8 wr_val = 0, rd_val, cmp_val, bmask; + int err = 0; + int try_cnt = 0; ++ struct mmc_host *host; ++ struct sdioh_info *sd = (struct sdioh_info *)(bus->sdh->sdioh); ++ struct sdio_func *func = sd->func[SDIO_FUNC_0]; ++ ++ host = func->card->host; ++ mmc_retune_disable(host); + + KSO_DBG(("%s> op:%s\n", __FUNCTION__, (on ? "KSO_SET" : "KSO_CLR"))); + +@@ -1051,6 +1061,7 @@ dhdsdio_clk_kso_enab(dhd_bus_t *bus, bool on) + * after clearing KSO bit, to avoid polling of KSO bit. + */ + if ((!on) && (bus->sih->chip == BCM43012_CHIP_ID)) { ++ mmc_retune_enable(host); + return err; + } + +@@ -1091,6 +1102,8 @@ dhdsdio_clk_kso_enab(dhd_bus_t *bus, bool on) + __FUNCTION__, (on ? "KSO_SET" : "KSO_CLR"), try_cnt, rd_val, err)); + } + ++ mmc_retune_enable(host); ++ + return err; + } + + +From 14174aa36436283cd3c51df73ed45c41f05e74ff Mon Sep 17 00:00:00 2001 +From: Yao Xiao +Date: Wed, 10 Oct 2018 16:12:08 +0800 +Subject: [PATCH] net: wireless: rkwifi: add SUPPORT_P2P_GO_PS to fix suspend + issue + +Change-Id: I23f563c1de9527f2a17ccbe90a61516b4f76b2a8 +Signed-off-by: Yao Xiao +--- + drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile +index c49feed9d913..5588178bfce2 100644 +--- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/Makefile +@@ -24,7 +24,7 @@ DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \ + -DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DPNO_SUPPORT -DDHDTCPACK_SUPPRESS \ + -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT \ + -DMULTIPLE_SUPPLICANT -DTSQ_MULTIPLIER -DMFP \ +- -DWL_EXT_IAPSTA \ ++ -DWL_EXT_IAPSTA -DSUPPORT_P2P_GO_PS \ + -DENABLE_INSMOD_NO_FW_LOAD -DDHD_UNSUPPORT_IF_CNTS \ + -Idrivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd \ + -Idrivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include + +From dc1f78d0fd4d359bcf7ba89b7c3e8fe747ef0bef Mon Sep 17 00:00:00 2001 +From: Huibin Hong +Date: Fri, 31 Aug 2018 17:16:16 +0800 +Subject: [PATCH] serial: 8250: fix cpu and dmac access uart fifo at the same + time + +If cpu frequency was 1.0 GHz, bluetooth music is unstable. But it +is stable when cpu frequency is 400 MHz. Although I had test the +uart dma driver many days on rk3088, maybe the cpu frequency was low, +and I couldn't produce the issue. In one word, the code is unlogical. +The new logic is that increase the fifo water level, if dmac bursts +before it, wait until dmac finishes and read the rest data. +If dmac doesn't burst after it, then read data from fifo directly. + +Change-Id: I6fec42a0895df8a0faeba97d05fd36b761744fa2 +Signed-off-by: Huibin Hong +--- + drivers/tty/serial/8250/8250_dma.c | 37 +++++++++++++++++-------------------- + 1 file changed, 17 insertions(+), 20 deletions(-) + +diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c +index cbac385b01c6..f0b3a84565dd 100644 +--- a/drivers/tty/serial/8250/8250_dma.c ++++ b/drivers/tty/serial/8250/8250_dma.c +@@ -160,37 +160,34 @@ err: + + int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir) + { +- unsigned int rfl, i = 0, fcr = 0; ++ unsigned int rfl, i = 0, fcr = 0, cur_index = 0; + unsigned char buf[MAX_FIFO_SIZE]; + struct uart_port *port = &p->port; + struct tty_port *tty_port = &p->port.state->port; ++ struct dma_tx_state state; ++ struct uart_8250_dma *dma = p->dma; ++ + + if ((iir & 0xf) != UART_IIR_RX_TIMEOUT) + return 0; + +- rfl = serial_port_in(port, UART_RFL_16550A); ++ fcr = UART_FCR_ENABLE_FIFO | UART_FCR_T_TRIG_10 | UART_FCR_R_TRIG_11; ++ serial_port_out(port, UART_FCR, fcr); + +- if (rfl > (p->port.fifosize / 2 - 4)) { +- fcr = UART_FCR_ENABLE_FIFO | UART_FCR_T_TRIG_10 | UART_FCR_R_TRIG_01; +- serial_port_out(port, UART_FCR, fcr); +- } else { +- while (i < rfl) +- buf[i++] = serial_port_in(port, UART_RX); +- } ++ do { ++ dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); ++ cur_index = dma->rx_size - state.residue; ++ } while (cur_index % dma->rxconf.src_maxburst); ++ ++ rfl = serial_port_in(port, UART_RFL_16550A); ++ while (i < rfl) ++ buf[i++] = serial_port_in(port, UART_RX); + + __dma_rx_complete(p); + +- if (i == 0) { +- rfl = serial_port_in(port, UART_RFL_16550A); +- if (rfl == 0) { +- __dma_rx_complete(p); +- tty_flip_buffer_push(tty_port); +- } +- } else { +- tty_insert_flip_string(tty_port, buf, i); +- p->port.icount.rx += i; +- tty_flip_buffer_push(tty_port); +- } ++ tty_insert_flip_string(tty_port, buf, i); ++ p->port.icount.rx += i; ++ tty_flip_buffer_push(tty_port); + + if (fcr) + serial_port_out(port, UART_FCR, p->fcr); + +From 9c03219fa35b6b5186df6b6defd2782a29e7967e Mon Sep 17 00:00:00 2001 +From: Huibin Hong +Date: Wed, 12 Sep 2018 16:24:05 +0800 +Subject: [PATCH] serial: 8250: add line error log + +Change-Id: I69fe6f0c0857ade25e777be388fcab6261f1a533 +Signed-off-by: Huibin Hong +--- + drivers/tty/serial/8250/8250_port.c | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c +index 14665c09d2ba..5650b1551c44 100644 +--- a/drivers/tty/serial/8250/8250_port.c ++++ b/drivers/tty/serial/8250/8250_port.c +@@ -1551,7 +1551,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) + unsigned char status; + unsigned long flags; + struct uart_8250_port *up = up_to_u8250p(port); +- int dma_err = 0; ++ int dma_err = 0, idx; + + if (iir & UART_IIR_NO_INT) + return 0; +@@ -1573,7 +1573,24 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) + if ((!up->dma || (up->dma && up->dma->tx_err)) && + (status & UART_LSR_THRE)) + serial8250_tx_chars(up); ++#ifdef CONFIG_ARCH_ROCKCHIP ++ if (status & UART_LSR_BRK_ERROR_BITS) { ++ ++ idx = serial_index(port); ++ ++ if (status & UART_LSR_OE) ++ pr_err("ttyS%d: Overrun error!\n", idx); ++ if (status & UART_LSR_PE) ++ pr_err("ttyS%d: Parity error!\n", idx); ++ if (status & UART_LSR_FE) ++ pr_err("ttyS%d: Frame error!\n", idx); ++ if (status & UART_LSR_BI) ++ pr_err("ttyS%d: Break interrupt!\n", idx); + ++ pr_err("ttyS%d: maybe rx pin is low or baudrate is not correct!\n", ++ idx); ++ } ++#endif + spin_unlock_irqrestore(&port->lock, flags); + return 1; + } + +From 5bf471cff7903b03216bdb1c6c834071780db709 Mon Sep 17 00:00:00 2001 +From: Caesar Wang +Date: Mon, 19 Nov 2018 16:46:31 +0800 +Subject: [PATCH] net/rfkill: bt: improve to set the bt power + +There is a bt power issue on Debian OS, the blueman app +will callback to enable the bluetooth power during the bringup. + +As below log the system bringup about 10s. +[BT_RFKILL]: rfkill_rk_set_power: set bt wake_host pin output high! +[BT_RFKILL]: rfkill_rk_set_power: enable bt reset pin! +[BT_RFKILL]: ENABLE UART_RTS +[BT_RFKILL]: DISABLE UART_RTS +[BT_RFKILL]: bt turn on power +... + +So the rfkill-bt driver should judge the power status, otherwise the +blueman app will cause the bluetoolth timeout error. e.g: +root@linaro-alip:/# bluetoothctl +[NEW] Controller 3B:A0:90:48:46:40 linaro-alip [default] +[bluetooth]# scan on +Discovery started +[ 33.076522] Bluetooth: hci0 command 0x2005 tx timeout +[ 35.080473] Bluetooth: hci0 command 0x200b tx timeout +[ 37.084505] Bluetooth: hci0 command 0x200c tx timeout + +Change-Id: Ib0dd99a83c64dbaf469c3eb7a9226a2d83c53e6f +Signed-off-by: Caesar Wang +--- + net/rfkill/rfkill-bt.c | 54 ++++++++++++++++++++++++++++---------------------- + 1 file changed, 30 insertions(+), 24 deletions(-) + +diff --git a/net/rfkill/rfkill-bt.c b/net/rfkill/rfkill-bt.c +index b19e0fb9ce82..29d88313e4a8 100644 +--- a/net/rfkill/rfkill-bt.c ++++ b/net/rfkill/rfkill-bt.c +@@ -296,20 +296,23 @@ static int rfkill_rk_set_power(void *data, bool blocked) + msleep(20); + } + +- if (gpio_is_valid(poweron->io) && gpio_is_valid(wake_host->io)) +- { +- gpio_direction_output(poweron->io, !poweron->enable); +- msleep(20); +- gpio_direction_output(poweron->io, poweron->enable); +- msleep(20); +- gpio_direction_input(wake_host->io); +- LOG("%s: set bt wake_host pin input!\n", __func__); ++ if (gpio_is_valid(poweron->io) && gpio_is_valid(wake_host->io)) { ++ if (gpio_get_value(poweron->io) == !poweron->enable) { ++ gpio_direction_output(poweron->io, !poweron->enable); ++ msleep(20); ++ gpio_direction_output(poweron->io, poweron->enable); ++ msleep(20); ++ gpio_direction_input(wake_host->io); ++ LOG("%s: set bt wake_host pin input!\n", __func__); ++ } + } +- if (gpio_is_valid(reset->io)) +- { ++ ++ if (gpio_is_valid(reset->io)) { ++ if (gpio_get_value(reset->io) == !reset->enable) { + gpio_direction_output(reset->io, !reset->enable); +- msleep(20); ++ msleep(20); + gpio_direction_output(reset->io, reset->enable); ++ } + } + + if (pinctrl != NULL && gpio_is_valid(rts->io)) +@@ -326,20 +329,23 @@ static int rfkill_rk_set_power(void *data, bool blocked) + bt_power_state = 1; + LOG("bt turn on power\n"); + } else { +- if (gpio_is_valid(poweron->io)) +- { +- gpio_direction_output(poweron->io, !poweron->enable); +- msleep(20); +- } +- +- bt_power_state = 0; +- LOG("bt shut off power\n"); +- if (gpio_is_valid(reset->io)) +- { +- gpio_direction_output(reset->io, !reset->enable);/* bt reset active*/ +- msleep(20); +- } ++ if (gpio_is_valid(poweron->io)) { ++ if (gpio_get_value(poweron->io) == poweron->enable) { ++ gpio_direction_output(poweron->io, ++ !poweron->enable); ++ msleep(20); ++ } ++ } + ++ bt_power_state = 0; ++ LOG("bt shut off power\n"); ++ if (gpio_is_valid(reset->io)) { ++ if (gpio_get_value(reset->io) == reset->enable) { ++ gpio_direction_output(reset->io, ++ !reset->enable); ++ msleep(20); ++ } ++ } + } + + return 0; diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0002-ir.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0002-ir.patch new file mode 100644 index 0000000000..4e1d6e84e8 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0002-ir.patch @@ -0,0 +1,743 @@ +From 2031709371a600b1b803ec928cc1adb2e9b5a4c1 Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Thu, 19 Nov 2015 11:41:36 -0200 +Subject: [PATCH] UPSTREAM: smsir.h: remove a now duplicated definition + (IR_DEFAULT_TIMEOUT) + +This macro is now part of the core. Remove from Siano driver. + +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 850c8a7d68a761b5f11d5b443b5ece185e8068f4) +--- + drivers/media/common/siano/smsir.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/media/common/siano/smsir.h b/drivers/media/common/siano/smsir.h +index fc8b7925c532..d9abd96ef48b 100644 +--- a/drivers/media/common/siano/smsir.h ++++ b/drivers/media/common/siano/smsir.h +@@ -30,8 +30,6 @@ along with this program. If not, see . + #include + #include + +-#define IR_DEFAULT_TIMEOUT 100 +- + struct smscore_device_t; + + struct ir_t { + +From 3b533a5c5f7880759fcad51e9400851a80295764 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 6 Sep 2017 18:39:09 +0200 +Subject: [PATCH] [media] rc/keymaps: add keytable for Pine64 IR Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-pine64.c | 65 ++++++++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 67 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-pine64.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index fbbd3bbcd252..8816520600f7 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -66,6 +66,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-norwood.o \ + rc-npgtech.o \ + rc-pctv-sedna.o \ ++ rc-pine64.o \ + rc-pinnacle-color.o \ + rc-pinnacle-grey.o \ + rc-pinnacle-pctv-hd.o \ +diff --git a/drivers/media/rc/keymaps/rc-pine64.c b/drivers/media/rc/keymaps/rc-pine64.c +new file mode 100644 +index 000000000000..bdf3975e7445 +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-pine64.c +@@ -0,0 +1,65 @@ ++/* Keytable for Pine64 IR Remote Controller ++ * ++ * Copyright (c) 2017 PINE64 ++ * ++ * 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 ++ ++static struct rc_map_table pine64[] = { ++ { 0x404000, KEY_NUMERIC_0 }, ++ { 0x404001, KEY_NUMERIC_1 }, ++ { 0x404002, KEY_NUMERIC_2 }, ++ { 0x404003, KEY_NUMERIC_3 }, ++ { 0x404004, KEY_NUMERIC_4 }, ++ { 0x404005, KEY_NUMERIC_5 }, ++ { 0x404006, KEY_NUMERIC_6 }, ++ { 0x404007, KEY_NUMERIC_7 }, ++ { 0x404008, KEY_NUMERIC_8 }, ++ { 0x404009, KEY_NUMERIC_9 }, ++ { 0x40400a, KEY_MUTE }, ++ { 0x40400b, KEY_UP }, ++ { 0x40400c, KEY_BACKSPACE }, ++ { 0x40400d, KEY_OK }, ++ { 0x40400e, KEY_DOWN }, ++ { 0x404010, KEY_LEFT }, ++ { 0x404011, KEY_RIGHT }, ++ { 0x404017, KEY_VOLUMEDOWN }, ++ { 0x404018, KEY_VOLUMEUP }, ++ { 0x40401a, KEY_HOME }, ++ { 0x40401d, KEY_MENU }, ++ { 0x40401f, KEY_WWW }, ++ { 0x404045, KEY_BACK }, ++ { 0x404047, KEY_INFO }, ++ { 0x40404d, KEY_POWER }, ++}; ++ ++static struct rc_map_list pine64_map = { ++ .map = { ++ .scan = pine64, ++ .size = ARRAY_SIZE(pine64), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_PINE64, ++ } ++}; ++ ++static int __init init_rc_map_pine64(void) ++{ ++ return rc_map_register(&pine64_map); ++} ++ ++static void __exit exit_rc_map_pine64(void) ++{ ++ rc_map_unregister(&pine64_map); ++} ++ ++module_init(init_rc_map_pine64) ++module_exit(exit_rc_map_pine64) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("PINE64"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 7c4bbc4dfab4..3a34a9631dd1 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -173,6 +173,7 @@ void rc_map_init(void); + #define RC_MAP_NORWOOD "rc-norwood" + #define RC_MAP_NPGTECH "rc-npgtech" + #define RC_MAP_PCTV_SEDNA "rc-pctv-sedna" ++#define RC_MAP_PINE64 "rc-pine64" + #define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color" + #define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey" + #define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd" + +From 21e2e6f847c6e1d0f98ce3770e6d380b20af3064 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 6 Sep 2017 18:39:09 +0200 +Subject: [PATCH] [media] rc/keymaps: add keytable for ODROID IR Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-odroid.c | 52 ++++++++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 54 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-odroid.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index 8816520600f7..f4321cfbbc79 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -65,6 +65,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-nec-terratec-cinergy-xs.o \ + rc-norwood.o \ + rc-npgtech.o \ ++ rc-odroid.o \ + rc-pctv-sedna.o \ + rc-pine64.o \ + rc-pinnacle-color.o \ +diff --git a/drivers/media/rc/keymaps/rc-odroid.c b/drivers/media/rc/keymaps/rc-odroid.c +new file mode 100644 +index 000000000000..52089f0b7c1d +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-odroid.c +@@ -0,0 +1,52 @@ ++/* Keytable for ODROID IR Remote Controller ++ * ++ * Copyright (c) 2017 Hardkernel co., Ltd. ++ * ++ * 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 ++ ++static struct rc_map_table odroid[] = { ++ { 0xb2dc, KEY_POWER }, ++ { 0xb288, KEY_MUTE }, ++ { 0xb282, KEY_HOME }, ++ { 0xb2ce, KEY_OK }, ++ { 0xb2ca, KEY_UP }, ++ { 0xb299, KEY_LEFT }, ++ { 0xb2c1, KEY_RIGHT }, ++ { 0xb2d2, KEY_DOWN }, ++ { 0xb2c5, KEY_MENU }, ++ { 0xb29a, KEY_BACK }, ++ { 0xb281, KEY_VOLUMEDOWN }, ++ { 0xb280, KEY_VOLUMEUP }, ++}; ++ ++static struct rc_map_list odroid_map = { ++ .map = { ++ .scan = odroid, ++ .size = ARRAY_SIZE(odroid), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_ODROID, ++ } ++}; ++ ++static int __init init_rc_map_odroid(void) ++{ ++ return rc_map_register(&odroid_map); ++} ++ ++static void __exit exit_rc_map_odroid(void) ++{ ++ rc_map_unregister(&odroid_map); ++} ++ ++module_init(init_rc_map_odroid) ++module_exit(exit_rc_map_odroid) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Hardkernel co., Ltd."); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 3a34a9631dd1..f1badbfbca90 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -172,6 +172,7 @@ void rc_map_init(void); + #define RC_MAP_NEC_TERRATEC_CINERGY_XS "rc-nec-terratec-cinergy-xs" + #define RC_MAP_NORWOOD "rc-norwood" + #define RC_MAP_NPGTECH "rc-npgtech" ++#define RC_MAP_ODROID "rc-odroid" + #define RC_MAP_PCTV_SEDNA "rc-pctv-sedna" + #define RC_MAP_PINE64 "rc-pine64" + #define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color" + +From 0cb159b68f91fb352861a23241a24611201e0d05 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 6 Sep 2017 18:39:09 +0200 +Subject: [PATCH] [media] rc/keymaps: add keytable for WeTek Hub Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-wetek-hub.c | 52 +++++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 54 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-wetek-hub.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index f4321cfbbc79..e8e6434cbc13 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -101,6 +101,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-tt-1500.o \ + rc-twinhan-dtv-cab-ci.o \ + rc-twinhan1027.o \ ++ rc-wetek-hub.o \ + rc-videomate-m1f.o \ + rc-videomate-s350.o \ + rc-videomate-tv-pvr.o \ +diff --git a/drivers/media/rc/keymaps/rc-wetek-hub.c b/drivers/media/rc/keymaps/rc-wetek-hub.c +new file mode 100644 +index 000000000000..0955ecfcb77c +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-wetek-hub.c +@@ -0,0 +1,52 @@ ++/* Keytable for WeTek Hub Remote Controller ++ * ++ * Copyright (c) 2017 WeTek ++ * ++ * 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 ++ ++static struct rc_map_table wetek_hub[] = { ++ { 0x77f1, KEY_POWER }, ++ { 0x77f2, KEY_HOME }, ++ { 0x77f3, KEY_MUTE }, ++ { 0x77f4, KEY_UP }, ++ { 0x77f5, KEY_DOWN }, ++ { 0x77f6, KEY_LEFT }, ++ { 0x77f7, KEY_RIGHT }, ++ { 0x77f8, KEY_OK }, ++ { 0x77f9, KEY_BACK }, ++ { 0x77fa, KEY_MENU }, ++ { 0x77fb, KEY_VOLUMEUP }, ++ { 0x77fc, KEY_VOLUMEDOWN }, ++}; ++ ++static struct rc_map_list wetek_hub_map = { ++ .map = { ++ .scan = wetek_hub, ++ .size = ARRAY_SIZE(wetek_hub), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_WETEK_HUB, ++ } ++}; ++ ++static int __init init_rc_map_wetek_hub(void) ++{ ++ return rc_map_register(&wetek_hub_map); ++} ++ ++static void __exit exit_rc_map_wetek_hub(void) ++{ ++ rc_map_unregister(&wetek_hub_map); ++} ++ ++module_init(init_rc_map_wetek_hub) ++module_exit(exit_rc_map_wetek_hub) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("WeTek"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index f1badbfbca90..cd8590c99e22 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -209,6 +209,7 @@ void rc_map_init(void); + #define RC_MAP_TT_1500 "rc-tt-1500" + #define RC_MAP_TWINHAN_DTV_CAB_CI "rc-twinhan-dtv-cab-ci" + #define RC_MAP_TWINHAN_VP1027_DVBS "rc-twinhan1027" ++#define RC_MAP_WETEK_HUB "rc-wetek-hub" + #define RC_MAP_VIDEOMATE_K100 "rc-videomate-k100" + #define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" + #define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" + +From d81bc903c323311f09eb3f8a298c10d99c62f601 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 6 Sep 2017 18:39:09 +0200 +Subject: [PATCH] [media] rc/keymaps: add keytable for WeTek Play 2 Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-wetek-play-2.c | 83 ++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 85 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-wetek-play-2.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index e8e6434cbc13..650481039f00 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -102,6 +102,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-twinhan-dtv-cab-ci.o \ + rc-twinhan1027.o \ + rc-wetek-hub.o \ ++ rc-wetek-play-2.o \ + rc-videomate-m1f.o \ + rc-videomate-s350.o \ + rc-videomate-tv-pvr.o \ +diff --git a/drivers/media/rc/keymaps/rc-wetek-play-2.c b/drivers/media/rc/keymaps/rc-wetek-play-2.c +new file mode 100644 +index 000000000000..37586cedbb8a +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-wetek-play-2.c +@@ -0,0 +1,83 @@ ++/* Keytable for WeTek Play 2 Remote Controller ++ * ++ * Copyright (c) 2017 WeTek ++ * ++ * 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 ++ ++static struct rc_map_table wetek_play_2[] = { ++ { 0x5e5f02, KEY_POWER }, ++ { 0x5e5f46, KEY_POWER2 }, ++ { 0x5e5f10, KEY_MUTE }, ++ { 0x5e5f22, KEY_NUMERIC_1 }, ++ { 0x5e5f23, KEY_NUMERIC_2 }, ++ { 0x5e5f24, KEY_NUMERIC_3 }, ++ { 0x5e5f25, KEY_NUMERIC_4 }, ++ { 0x5e5f26, KEY_NUMERIC_5 }, ++ { 0x5e5f27, KEY_NUMERIC_6 }, ++ { 0x5e5f28, KEY_NUMERIC_7 }, ++ { 0x5e5f29, KEY_NUMERIC_8 }, ++ { 0x5e5f30, KEY_NUMERIC_9 }, ++ { 0x5e5f71, KEY_BACKSPACE }, ++ { 0x5e5f21, KEY_NUMERIC_0 }, ++ { 0x5e5f72, KEY_CAPSLOCK }, ++ { 0x5e5f03, KEY_HOME }, ++ { 0x5e5f48, KEY_MENU }, ++ { 0x5e5f61, KEY_BACK }, ++ { 0x5e5f83, KEY_INFO }, ++ { 0x5e5f84, KEY_COMPOSE }, ++ { 0x5e5f77, KEY_HELP }, ++ { 0x5e5f50, KEY_UP }, ++ { 0x5e5f4b, KEY_DOWN }, ++ { 0x5e5f4c, KEY_LEFT }, ++ { 0x5e5f4d, KEY_RIGHT }, ++ { 0x5e5f47, KEY_OK }, ++ { 0x5e5f44, KEY_VOLUMEUP }, ++ { 0x5e5f43, KEY_VOLUMEDOWN }, ++ { 0x5e5f41, KEY_CHANNELUP }, ++ { 0x5e5f42, KEY_CHANNELDOWN }, ++ { 0x5e5f4f, KEY_ZENKAKUHANKAKU }, ++ { 0x5e5f82, KEY_TEXT }, ++ { 0x5e5f73, KEY_RED }, ++ { 0x5e5f74, KEY_GREEN }, ++ { 0x5e5f75, KEY_YELLOW }, ++ { 0x5e5f76, KEY_BLUE }, ++ { 0x5e5f67, KEY_PREVIOUS }, ++ { 0x5e5f79, KEY_REWIND }, ++ { 0x5e5f80, KEY_FASTFORWARD }, ++ { 0x5e5f81, KEY_NEXT }, ++ { 0x5e5f04, KEY_RECORD }, ++ { 0x5e5f2c, KEY_PLAYPAUSE }, ++ { 0x5e5f2b, KEY_STOP }, ++}; ++ ++static struct rc_map_list wetek_play_2_map = { ++ .map = { ++ .scan = wetek_play_2, ++ .size = ARRAY_SIZE(wetek_play_2), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_WETEK_PLAY_2, ++ } ++}; ++ ++static int __init init_rc_map_wetek_play_2(void) ++{ ++ return rc_map_register(&wetek_play_2_map); ++} ++ ++static void __exit exit_rc_map_wetek_play_2(void) ++{ ++ rc_map_unregister(&wetek_play_2_map); ++} ++ ++module_init(init_rc_map_wetek_play_2) ++module_exit(exit_rc_map_wetek_play_2) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("WeTek"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index cd8590c99e22..93cac05a5170 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -210,6 +210,7 @@ void rc_map_init(void); + #define RC_MAP_TWINHAN_DTV_CAB_CI "rc-twinhan-dtv-cab-ci" + #define RC_MAP_TWINHAN_VP1027_DVBS "rc-twinhan1027" + #define RC_MAP_WETEK_HUB "rc-wetek-hub" ++#define RC_MAP_WETEK_PLAY_2 "rc-wetek-play-2" + #define RC_MAP_VIDEOMATE_K100 "rc-videomate-k100" + #define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" + #define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" + +From 6518b8acbe53a153740bad1e93c9d361fed136fd Mon Sep 17 00:00:00 2001 +From: hzq +Date: Mon, 19 Mar 2018 16:47:24 +0800 +Subject: [PATCH] [media] rc/keymaps: add keytable for ROC-RK3328-CC Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-roc-cc.c | 52 ++++++++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 54 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-roc-cc.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index 650481039f00..b743914487a5 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -83,6 +83,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-rc6-mce.o \ + rc-real-audio-220-32-keys.o \ + rc-reddo.o \ ++ rc-roc-cc.o \ + rc-snapstream-firefly.o \ + rc-streamzap.o \ + rc-tbs-nec.o \ +diff --git a/drivers/media/rc/keymaps/rc-roc-cc.c b/drivers/media/rc/keymaps/rc-roc-cc.c +new file mode 100644 +index 000000000000..3a2a255d5723 +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-roc-cc.c +@@ -0,0 +1,52 @@ ++/* Keytable for ROC-RK3328-CC IR Remote Controller ++ * ++ * Copyright (c) 2017 ROC-RK3328-CC ++ * ++ * 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 ++ ++static struct rc_map_table roc_cc[] = { ++ { 0x28d7, KEY_POWER }, ++ { 0xc837, KEY_MUTE }, ++ { 0xe01f, KEY_ENTER}, ++ { 0xc03f, KEY_UP }, ++ { 0x40bf, KEY_DOWN }, ++ { 0x708f, KEY_LEFT }, ++ { 0x58a7, KEY_RIGHT }, ++ { 0x1ae5, KEY_VOLUMEDOWN }, ++ { 0xd02f, KEY_VOLUMEUP }, ++ { 0x3ac5, KEY_WWW }, ++ { 0x807f, KEY_BACK }, ++ { 0x12ed, KEY_HOME }, ++}; ++ ++static struct rc_map_list roc_cc_map = { ++ .map = { ++ .scan = roc_cc, ++ .size = ARRAY_SIZE(roc_cc), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_ROC_CC, ++ } ++}; ++ ++static int __init init_rc_map_roc_cc(void) ++{ ++ return rc_map_register(&roc_cc_map); ++} ++ ++static void __exit exit_rc_map_roc_cc(void) ++{ ++ rc_map_unregister(&roc_cc_map); ++} ++ ++module_init(init_rc_map_roc_cc) ++module_exit(exit_rc_map_roc_cc) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("ROC-RK3328-CC"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 93cac05a5170..8bbe335e650c 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -191,6 +191,7 @@ void rc_map_init(void); + #define RC_MAP_RC6_MCE "rc-rc6-mce" + #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" + #define RC_MAP_REDDO "rc-reddo" ++#define RC_MAP_ROC_CC "rc-roc-cc" + #define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly" + #define RC_MAP_STREAMZAP "rc-streamzap" + #define RC_MAP_TBS_NEC "rc-tbs-nec" + +From c0220800efec28f6a59eae563f4f083ceedff6cc Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 3 Jul 2018 21:55:56 +0200 +Subject: [PATCH] [media] rc/keymaps: add keytable for T-Chip TRN9 IR Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-trn9.c | 52 ++++++++++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 54 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-trn9.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index b743914487a5..2aaa1b33ddca 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -102,6 +102,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-tt-1500.o \ + rc-twinhan-dtv-cab-ci.o \ + rc-twinhan1027.o \ ++ rc-trn9.o \ + rc-wetek-hub.o \ + rc-wetek-play-2.o \ + rc-videomate-m1f.o \ +diff --git a/drivers/media/rc/keymaps/rc-trn9.c b/drivers/media/rc/keymaps/rc-trn9.c +new file mode 100644 +index 000000000000..f81bc3a419b3 +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-trn9.c +@@ -0,0 +1,52 @@ ++/* Keytable for T-Chip TRN9 IR Remote Controller ++ * ++ * Copyright (c) 2018 Omegamoon ++ * ++ * 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 ++ ++static struct rc_map_table trn9[] = { ++ { 0x0014, KEY_POWER }, ++ { 0x0013, KEY_MENU }, ++ { 0x0003, KEY_UP }, ++ { 0x0002, KEY_DOWN }, ++ { 0x000e, KEY_LEFT }, ++ { 0x001a, KEY_RIGHT }, ++ { 0x0007, KEY_OK }, ++ { 0x0058, KEY_VOLUMEDOWN }, ++ { 0x005c, KEY_MUTE }, ++ { 0x000b, KEY_VOLUMEUP }, ++ { 0x0001, KEY_BACK }, ++ { 0x0048, KEY_HOME }, ++}; ++ ++static struct rc_map_list trn9_map = { ++ .map = { ++ .scan = trn9, ++ .size = ARRAY_SIZE(trn9), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_TRN9, ++ } ++}; ++ ++static int __init init_rc_map_trn9(void) ++{ ++ return rc_map_register(&trn9_map); ++} ++ ++static void __exit exit_rc_map_trn9(void) ++{ ++ rc_map_unregister(&trn9_map); ++} ++ ++module_init(init_rc_map_trn9) ++module_exit(exit_rc_map_trn9) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Omegamoon"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 8bbe335e650c..66e1c50b38fc 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -210,6 +210,7 @@ void rc_map_init(void); + #define RC_MAP_TT_1500 "rc-tt-1500" + #define RC_MAP_TWINHAN_DTV_CAB_CI "rc-twinhan-dtv-cab-ci" + #define RC_MAP_TWINHAN_VP1027_DVBS "rc-twinhan1027" ++#define RC_MAP_TRN9 "rc-trn9" + #define RC_MAP_WETEK_HUB "rc-wetek-hub" + #define RC_MAP_WETEK_PLAY_2 "rc-wetek-play-2" + #define RC_MAP_VIDEOMATE_K100 "rc-videomate-k100" + +From 312b78202feca8f3966343b0362466e9c6ff2297 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 17 Dec 2018 07:41:16 +0100 +Subject: [PATCH] [media] rc/keymaps: add keytable for Khadas IR Remote + Controller + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-khadas.c | 52 ++++++++++++++++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 54 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-khadas.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index 2aaa1b33ddca..fc0207d322a0 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -47,6 +47,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-it913x-v1.o \ + rc-it913x-v2.o \ + rc-kaiomy.o \ ++ rc-khadas.o \ + rc-kworld-315u.o \ + rc-kworld-pc150u.o \ + rc-kworld-plus-tv-analog.o \ +diff --git a/drivers/media/rc/keymaps/rc-khadas.c b/drivers/media/rc/keymaps/rc-khadas.c +new file mode 100644 +index 000000000000..492368db75d9 +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-khadas.c +@@ -0,0 +1,52 @@ ++/* Keytable for Khadas IR Remote Controller ++ * ++ * Copyright (c) 2018 Shenzhen Wesion Technology Co., Ltd ++ * ++ * 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 ++ ++static struct rc_map_table khadas[] = { ++ { 0x14, KEY_POWER }, ++ { 0x07, KEY_OK }, ++ { 0x03, KEY_UP }, ++ { 0x02, KEY_DOWN }, ++ { 0x0e, KEY_LEFT }, ++ { 0x1a, KEY_RIGHT }, ++ { 0x13, KEY_MENU }, ++ { 0x01, KEY_BACK }, ++ { 0x0b, KEY_VOLUMEUP }, ++ { 0x58, KEY_VOLUMEDOWN }, ++ { 0x48, KEY_HOME }, ++ { 0x5b, KEY_CONTEXT_MENU }, ++}; ++ ++static struct rc_map_list khadas_map = { ++ .map = { ++ .scan = khadas, ++ .size = ARRAY_SIZE(khadas), ++ .rc_type = RC_TYPE_NEC, ++ .name = RC_MAP_KHADAS, ++ } ++}; ++ ++static int __init init_rc_map_khadas(void) ++{ ++ return rc_map_register(&khadas_map); ++} ++ ++static void __exit exit_rc_map_khadas(void) ++{ ++ rc_map_unregister(&khadas_map); ++} ++ ++module_init(init_rc_map_khadas) ++module_exit(exit_rc_map_khadas) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Khadas"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 66e1c50b38fc..6b2db526fac0 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -154,6 +154,7 @@ void rc_map_init(void); + #define RC_MAP_IT913X_V1 "rc-it913x-v1" + #define RC_MAP_IT913X_V2 "rc-it913x-v2" + #define RC_MAP_KAIOMY "rc-kaiomy" ++#define RC_MAP_KHADAS "rc-khadas" + #define RC_MAP_KWORLD_315U "rc-kworld-315u" + #define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u" + #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0003-cec.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0003-cec.patch new file mode 100644 index 0000000000..d4e508ce72 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0003-cec.patch @@ -0,0 +1,4509 @@ +From 0dcc2992b7f03fbe5bf9bd9f65edaf5479bf975a Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 4 Sep 2017 22:34:19 +0200 +Subject: [PATCH] BACKPORT: HDMI CEC support from v4.15 + +Skipped changes: +857313e51006ff51524579bcd8808b70f9a80812 "media: utilize new cdev_device_add helper function" +0f7499fddb153a333dff3c1dc4280c178b9b5a80 "[media] rc-main: assign driver type during allocation" +--- + Documentation/devicetree/bindings/media/cec.txt | 8 + + Documentation/media/kapi/cec-core.rst | 381 +++++++++++++++++++++ + Documentation/media/uapi/cec/cec-api.rst | 46 +++ + Documentation/media/uapi/cec/cec-func-close.rst | 47 +++ + Documentation/media/uapi/cec/cec-func-ioctl.rst | 66 ++++ + Documentation/media/uapi/cec/cec-func-open.rst | 78 +++++ + Documentation/media/uapi/cec/cec-func-poll.rst | 77 +++++ + Documentation/media/uapi/cec/cec-funcs.rst | 20 ++ + Documentation/media/uapi/cec/cec-header.rst | 10 + + Documentation/media/uapi/cec/cec-intro.rst | 40 +++ + .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 139 ++++++++ + .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | 371 ++++++++++++++++++++ + .../media/uapi/cec/cec-ioc-adap-g-phys-addr.rst | 93 +++++ + Documentation/media/uapi/cec/cec-ioc-dqevent.rst | 226 ++++++++++++ + Documentation/media/uapi/cec/cec-ioc-g-mode.rst | 293 ++++++++++++++++ + Documentation/media/uapi/cec/cec-ioc-receive.rst | 344 +++++++++++++++++++ + MAINTAINERS | 16 + + drivers/media/cec/cec-adap.c | 61 +++- + drivers/media/cec/cec-core.c | 15 +- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-cec.c | 182 ++++++++++ + drivers/media/rc/rc-main.c | 1 + + fs/compat_ioctl.c | 12 + + include/media/cec-notifier.h | 22 ++ + include/media/cec.h | 32 +- + include/media/rc-map.h | 5 +- + include/uapi/linux/cec-funcs.h | 1 + + include/uapi/linux/cec.h | 2 +- + include/uapi/linux/input-event-codes.h | 31 ++ + include/uapi/linux/input.h | 1 + + 30 files changed, 2606 insertions(+), 15 deletions(-) + create mode 100644 Documentation/devicetree/bindings/media/cec.txt + create mode 100644 Documentation/media/kapi/cec-core.rst + create mode 100644 Documentation/media/uapi/cec/cec-api.rst + create mode 100644 Documentation/media/uapi/cec/cec-func-close.rst + create mode 100644 Documentation/media/uapi/cec/cec-func-ioctl.rst + create mode 100644 Documentation/media/uapi/cec/cec-func-open.rst + create mode 100644 Documentation/media/uapi/cec/cec-func-poll.rst + create mode 100644 Documentation/media/uapi/cec/cec-funcs.rst + create mode 100644 Documentation/media/uapi/cec/cec-header.rst + create mode 100644 Documentation/media/uapi/cec/cec-intro.rst + create mode 100644 Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst + create mode 100644 Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst + create mode 100644 Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst + create mode 100644 Documentation/media/uapi/cec/cec-ioc-dqevent.rst + create mode 100644 Documentation/media/uapi/cec/cec-ioc-g-mode.rst + create mode 100644 Documentation/media/uapi/cec/cec-ioc-receive.rst + create mode 100644 drivers/media/rc/keymaps/rc-cec.c + +diff --git a/Documentation/devicetree/bindings/media/cec.txt b/Documentation/devicetree/bindings/media/cec.txt +new file mode 100644 +index 000000000000..22d7aae3d3d7 +--- /dev/null ++++ b/Documentation/devicetree/bindings/media/cec.txt +@@ -0,0 +1,8 @@ ++Common bindings for HDMI CEC adapters ++ ++- hdmi-phandle: phandle to the HDMI controller. ++ ++- needs-hpd: if present the CEC support is only available when the HPD ++ is high. Some boards only let the CEC pin through if the HPD is high, ++ for example if there is a level converter that uses the HPD to power ++ up or down. +diff --git a/Documentation/media/kapi/cec-core.rst b/Documentation/media/kapi/cec-core.rst +new file mode 100644 +index 000000000000..d37e107f2fde +--- /dev/null ++++ b/Documentation/media/kapi/cec-core.rst +@@ -0,0 +1,381 @@ ++CEC Kernel Support ++================== ++ ++The CEC framework provides a unified kernel interface for use with HDMI CEC ++hardware. It is designed to handle a multiple types of hardware (receivers, ++transmitters, USB dongles). The framework also gives the option to decide ++what to do in the kernel driver and what should be handled by userspace ++applications. In addition it integrates the remote control passthrough ++feature into the kernel's remote control framework. ++ ++ ++The CEC Protocol ++---------------- ++ ++The CEC protocol enables consumer electronic devices to communicate with each ++other through the HDMI connection. The protocol uses logical addresses in the ++communication. The logical address is strictly connected with the functionality ++provided by the device. The TV acting as the communication hub is always ++assigned address 0. The physical address is determined by the physical ++connection between devices. ++ ++The CEC framework described here is up to date with the CEC 2.0 specification. ++It is documented in the HDMI 1.4 specification with the new 2.0 bits documented ++in the HDMI 2.0 specification. But for most of the features the freely available ++HDMI 1.3a specification is sufficient: ++ ++http://www.microprocessor.org/HDMISpecification13a.pdf ++ ++ ++CEC Adapter Interface ++--------------------- ++ ++The struct cec_adapter represents the CEC adapter hardware. It is created by ++calling cec_allocate_adapter() and deleted by calling cec_delete_adapter(): ++ ++.. c:function:: ++ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, void *priv, ++ const char *name, u32 caps, u8 available_las); ++ ++.. c:function:: ++ void cec_delete_adapter(struct cec_adapter *adap); ++ ++To create an adapter you need to pass the following information: ++ ++ops: ++ adapter operations which are called by the CEC framework and that you ++ have to implement. ++ ++priv: ++ will be stored in adap->priv and can be used by the adapter ops. ++ Use cec_get_drvdata(adap) to get the priv pointer. ++ ++name: ++ the name of the CEC adapter. Note: this name will be copied. ++ ++caps: ++ capabilities of the CEC adapter. These capabilities determine the ++ capabilities of the hardware and which parts are to be handled ++ by userspace and which parts are handled by kernelspace. The ++ capabilities are returned by CEC_ADAP_G_CAPS. ++ ++available_las: ++ the number of simultaneous logical addresses that this ++ adapter can handle. Must be 1 <= available_las <= CEC_MAX_LOG_ADDRS. ++ ++To obtain the priv pointer use this helper function: ++ ++.. c:function:: ++ void *cec_get_drvdata(const struct cec_adapter *adap); ++ ++To register the /dev/cecX device node and the remote control device (if ++CEC_CAP_RC is set) you call: ++ ++.. c:function:: ++ int cec_register_adapter(struct cec_adapter *adap, struct device *parent); ++ ++where parent is the parent device. ++ ++To unregister the devices call: ++ ++.. c:function:: ++ void cec_unregister_adapter(struct cec_adapter *adap); ++ ++Note: if cec_register_adapter() fails, then call cec_delete_adapter() to ++clean up. But if cec_register_adapter() succeeded, then only call ++cec_unregister_adapter() to clean up, never cec_delete_adapter(). The ++unregister function will delete the adapter automatically once the last user ++of that /dev/cecX device has closed its file handle. ++ ++ ++Implementing the Low-Level CEC Adapter ++-------------------------------------- ++ ++The following low-level adapter operations have to be implemented in ++your driver: ++ ++.. c:type:: struct cec_adap_ops ++ ++.. code-block:: none ++ ++ struct cec_adap_ops ++ { ++ /* Low-level callbacks */ ++ int (*adap_enable)(struct cec_adapter *adap, bool enable); ++ int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); ++ int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); ++ int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, ++ u32 signal_free_time, struct cec_msg *msg); ++ void (*adap_status)(struct cec_adapter *adap, struct seq_file *file); ++ void (*adap_free)(struct cec_adapter *adap); ++ ++ /* High-level callbacks */ ++ ... ++ }; ++ ++The five low-level ops deal with various aspects of controlling the CEC adapter ++hardware: ++ ++ ++To enable/disable the hardware: ++ ++.. c:function:: ++ int (*adap_enable)(struct cec_adapter *adap, bool enable); ++ ++This callback enables or disables the CEC hardware. Enabling the CEC hardware ++means powering it up in a state where no logical addresses are claimed. This ++op assumes that the physical address (adap->phys_addr) is valid when enable is ++true and will not change while the CEC adapter remains enabled. The initial ++state of the CEC adapter after calling cec_allocate_adapter() is disabled. ++ ++Note that adap_enable must return 0 if enable is false. ++ ++ ++To enable/disable the 'monitor all' mode: ++ ++.. c:function:: ++ int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); ++ ++If enabled, then the adapter should be put in a mode to also monitor messages ++that not for us. Not all hardware supports this and this function is only ++called if the CEC_CAP_MONITOR_ALL capability is set. This callback is optional ++(some hardware may always be in 'monitor all' mode). ++ ++Note that adap_monitor_all_enable must return 0 if enable is false. ++ ++ ++To program a new logical address: ++ ++.. c:function:: ++ int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); ++ ++If logical_addr == CEC_LOG_ADDR_INVALID then all programmed logical addresses ++are to be erased. Otherwise the given logical address should be programmed. ++If the maximum number of available logical addresses is exceeded, then it ++should return -ENXIO. Once a logical address is programmed the CEC hardware ++can receive directed messages to that address. ++ ++Note that adap_log_addr must return 0 if logical_addr is CEC_LOG_ADDR_INVALID. ++ ++ ++To transmit a new message: ++ ++.. c:function:: ++ int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, ++ u32 signal_free_time, struct cec_msg *msg); ++ ++This transmits a new message. The attempts argument is the suggested number of ++attempts for the transmit. ++ ++The signal_free_time is the number of data bit periods that the adapter should ++wait when the line is free before attempting to send a message. This value ++depends on whether this transmit is a retry, a message from a new initiator or ++a new message for the same initiator. Most hardware will handle this ++automatically, but in some cases this information is needed. ++ ++The CEC_FREE_TIME_TO_USEC macro can be used to convert signal_free_time to ++microseconds (one data bit period is 2.4 ms). ++ ++ ++To log the current CEC hardware status: ++ ++.. c:function:: ++ void (*adap_status)(struct cec_adapter *adap, struct seq_file *file); ++ ++This optional callback can be used to show the status of the CEC hardware. ++The status is available through debugfs: cat /sys/kernel/debug/cec/cecX/status ++ ++To free any resources when the adapter is deleted: ++ ++.. c:function:: ++ void (*adap_free)(struct cec_adapter *adap); ++ ++This optional callback can be used to free any resources that might have been ++allocated by the driver. It's called from cec_delete_adapter. ++ ++ ++Your adapter driver will also have to react to events (typically interrupt ++driven) by calling into the framework in the following situations: ++ ++When a transmit finished (successfully or otherwise): ++ ++.. c:function:: ++ void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt, ++ u8 nack_cnt, u8 low_drive_cnt, u8 error_cnt); ++ ++or: ++ ++.. c:function:: ++ void cec_transmit_attempt_done(struct cec_adapter *adap, u8 status); ++ ++The status can be one of: ++ ++CEC_TX_STATUS_OK: ++ the transmit was successful. ++ ++CEC_TX_STATUS_ARB_LOST: ++ arbitration was lost: another CEC initiator ++ took control of the CEC line and you lost the arbitration. ++ ++CEC_TX_STATUS_NACK: ++ the message was nacked (for a directed message) or ++ acked (for a broadcast message). A retransmission is needed. ++ ++CEC_TX_STATUS_LOW_DRIVE: ++ low drive was detected on the CEC bus. This indicates that ++ a follower detected an error on the bus and requested a ++ retransmission. ++ ++CEC_TX_STATUS_ERROR: ++ some unspecified error occurred: this can be one of ARB_LOST ++ or LOW_DRIVE if the hardware cannot differentiate or something ++ else entirely. ++ ++CEC_TX_STATUS_MAX_RETRIES: ++ could not transmit the message after trying multiple times. ++ Should only be set by the driver if it has hardware support for ++ retrying messages. If set, then the framework assumes that it ++ doesn't have to make another attempt to transmit the message ++ since the hardware did that already. ++ ++The hardware must be able to differentiate between OK, NACK and 'something ++else'. ++ ++The \*_cnt arguments are the number of error conditions that were seen. ++This may be 0 if no information is available. Drivers that do not support ++hardware retry can just set the counter corresponding to the transmit error ++to 1, if the hardware does support retry then either set these counters to ++0 if the hardware provides no feedback of which errors occurred and how many ++times, or fill in the correct values as reported by the hardware. ++ ++The cec_transmit_attempt_done() function is a helper for cases where the ++hardware never retries, so the transmit is always for just a single ++attempt. It will call cec_transmit_done() in turn, filling in 1 for the ++count argument corresponding to the status. Or all 0 if the status was OK. ++ ++When a CEC message was received: ++ ++.. c:function:: ++ void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg); ++ ++Speaks for itself. ++ ++Implementing the interrupt handler ++---------------------------------- ++ ++Typically the CEC hardware provides interrupts that signal when a transmit ++finished and whether it was successful or not, and it provides and interrupt ++when a CEC message was received. ++ ++The CEC driver should always process the transmit interrupts first before ++handling the receive interrupt. The framework expects to see the cec_transmit_done ++call before the cec_received_msg call, otherwise it can get confused if the ++received message was in reply to the transmitted message. ++ ++Implementing the High-Level CEC Adapter ++--------------------------------------- ++ ++The low-level operations drive the hardware, the high-level operations are ++CEC protocol driven. The following high-level callbacks are available: ++ ++.. code-block:: none ++ ++ struct cec_adap_ops { ++ /* Low-level callbacks */ ++ ... ++ ++ /* High-level CEC message callback */ ++ int (*received)(struct cec_adapter *adap, struct cec_msg *msg); ++ }; ++ ++The received() callback allows the driver to optionally handle a newly ++received CEC message ++ ++.. c:function:: ++ int (*received)(struct cec_adapter *adap, struct cec_msg *msg); ++ ++If the driver wants to process a CEC message, then it can implement this ++callback. If it doesn't want to handle this message, then it should return ++-ENOMSG, otherwise the CEC framework assumes it processed this message and ++it will not do anything with it. ++ ++ ++CEC framework functions ++----------------------- ++ ++CEC Adapter drivers can call the following CEC framework functions: ++ ++.. c:function:: ++ int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, ++ bool block); ++ ++Transmit a CEC message. If block is true, then wait until the message has been ++transmitted, otherwise just queue it and return. ++ ++.. c:function:: ++ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, ++ bool block); ++ ++Change the physical address. This function will set adap->phys_addr and ++send an event if it has changed. If cec_s_log_addrs() has been called and ++the physical address has become valid, then the CEC framework will start ++claiming the logical addresses. If block is true, then this function won't ++return until this process has finished. ++ ++When the physical address is set to a valid value the CEC adapter will ++be enabled (see the adap_enable op). When it is set to CEC_PHYS_ADDR_INVALID, ++then the CEC adapter will be disabled. If you change a valid physical address ++to another valid physical address, then this function will first set the ++address to CEC_PHYS_ADDR_INVALID before enabling the new physical address. ++ ++.. c:function:: ++ void cec_s_phys_addr_from_edid(struct cec_adapter *adap, ++ const struct edid *edid); ++ ++A helper function that extracts the physical address from the edid struct ++and calls cec_s_phys_addr() with that address, or CEC_PHYS_ADDR_INVALID ++if the EDID did not contain a physical address or edid was a NULL pointer. ++ ++.. c:function:: ++ int cec_s_log_addrs(struct cec_adapter *adap, ++ struct cec_log_addrs *log_addrs, bool block); ++ ++Claim the CEC logical addresses. Should never be called if CEC_CAP_LOG_ADDRS ++is set. If block is true, then wait until the logical addresses have been ++claimed, otherwise just queue it and return. To unconfigure all logical ++addresses call this function with log_addrs set to NULL or with ++log_addrs->num_log_addrs set to 0. The block argument is ignored when ++unconfiguring. This function will just return if the physical address is ++invalid. Once the physical address becomes valid, then the framework will ++attempt to claim these logical addresses. ++ ++CEC Pin framework ++----------------- ++ ++Most CEC hardware operates on full CEC messages where the software provides ++the message and the hardware handles the low-level CEC protocol. But some ++hardware only drives the CEC pin and software has to handle the low-level ++CEC protocol. The CEC pin framework was created to handle such devices. ++ ++Note that due to the close-to-realtime requirements it can never be guaranteed ++to work 100%. This framework uses highres timers internally, but if a ++timer goes off too late by more than 300 microseconds wrong results can ++occur. In reality it appears to be fairly reliable. ++ ++One advantage of this low-level implementation is that it can be used as ++a cheap CEC analyser, especially if interrupts can be used to detect ++CEC pin transitions from low to high or vice versa. ++ ++.. kernel-doc:: include/media/cec-pin.h ++ ++CEC Notifier framework ++---------------------- ++ ++Most drm HDMI implementations have an integrated CEC implementation and no ++notifier support is needed. But some have independent CEC implementations ++that have their own driver. This could be an IP block for an SoC or a ++completely separate chip that deals with the CEC pin. For those cases a ++drm driver can install a notifier and use the notifier to inform the ++CEC driver about changes in the physical address. ++ ++.. kernel-doc:: include/media/cec-notifier.h +diff --git a/Documentation/media/uapi/cec/cec-api.rst b/Documentation/media/uapi/cec/cec-api.rst +new file mode 100644 +index 000000000000..b68ca9c1d2e0 +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-api.rst +@@ -0,0 +1,46 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. include:: ++ ++.. _cec: ++ ++######################################### ++Part V - Consumer Electronics Control API ++######################################### ++ ++This part describes the CEC: Consumer Electronics Control ++ ++ ++.. only:: html ++ ++ .. class:: toc-title ++ ++ Table of Contents ++ ++.. toctree:: ++ :maxdepth: 5 ++ :numbered: ++ ++ cec-intro ++ cec-funcs ++ cec-header ++ ++ ++********************** ++Revision and Copyright ++********************** ++Authors: ++ ++- Verkuil, Hans ++ ++ - Initial version. ++ ++**Copyright** |copy| 2016 : Hans Verkuil ++ ++**************** ++Revision History ++**************** ++ ++:revision: 1.0.0 / 2016-03-17 (*hv*) ++ ++Initial revision +diff --git a/Documentation/media/uapi/cec/cec-func-close.rst b/Documentation/media/uapi/cec/cec-func-close.rst +new file mode 100644 +index 000000000000..334358dfa72e +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-func-close.rst +@@ -0,0 +1,47 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _cec-func-close: ++ ++*********** ++cec close() ++*********** ++ ++Name ++==== ++ ++cec-close - Close a cec device ++ ++ ++Synopsis ++======== ++ ++.. code-block:: c ++ ++ #include ++ ++ ++.. c:function:: int close( int fd ) ++ :name: cec-close ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++ ++Description ++=========== ++ ++Closes the cec device. Resources associated with the file descriptor are ++freed. The device configuration remain unchanged. ++ ++ ++Return Value ++============ ++ ++:c:func:`close() ` returns 0 on success. On error, -1 is returned, and ++``errno`` is set appropriately. Possible error codes are: ++ ++``EBADF`` ++ ``fd`` is not a valid open file descriptor. +diff --git a/Documentation/media/uapi/cec/cec-func-ioctl.rst b/Documentation/media/uapi/cec/cec-func-ioctl.rst +new file mode 100644 +index 000000000000..e2b6260b0086 +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-func-ioctl.rst +@@ -0,0 +1,66 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _cec-func-ioctl: ++ ++*********** ++cec ioctl() ++*********** ++ ++Name ++==== ++ ++cec-ioctl - Control a cec device ++ ++Synopsis ++======== ++ ++.. code-block:: c ++ ++ #include ++ ++ ++.. c:function:: int ioctl( int fd, int request, void *argp ) ++ :name: cec-ioctl ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``request`` ++ CEC ioctl request code as defined in the cec.h header file, for ++ example :ref:`CEC_ADAP_G_CAPS `. ++ ++``argp`` ++ Pointer to a request-specific structure. ++ ++ ++Description ++=========== ++ ++The :c:func:`ioctl() ` function manipulates cec device parameters. The ++argument ``fd`` must be an open file descriptor. ++ ++The ioctl ``request`` code specifies the cec function to be called. It ++has encoded in it whether the argument is an input, output or read/write ++parameter, and the size of the argument ``argp`` in bytes. ++ ++Macros and structures definitions specifying cec ioctl requests and ++their parameters are located in the cec.h header file. All cec ioctl ++requests, their respective function and parameters are specified in ++:ref:`cec-user-func`. ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. ++ ++Request-specific error codes are listed in the individual requests ++descriptions. ++ ++When an ioctl that takes an output or read/write parameter fails, the ++parameter remains unmodified. +diff --git a/Documentation/media/uapi/cec/cec-func-open.rst b/Documentation/media/uapi/cec/cec-func-open.rst +new file mode 100644 +index 000000000000..5d6663a649bd +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-func-open.rst +@@ -0,0 +1,78 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _cec-func-open: ++ ++********** ++cec open() ++********** ++ ++Name ++==== ++ ++cec-open - Open a cec device ++ ++Synopsis ++======== ++ ++.. code-block:: c ++ ++ #include ++ ++ ++.. c:function:: int open( const char *device_name, int flags ) ++ :name: cec-open ++ ++ ++Arguments ++========= ++ ++``device_name`` ++ Device to be opened. ++ ++``flags`` ++ Open flags. Access mode must be ``O_RDWR``. ++ ++ When the ``O_NONBLOCK`` flag is given, the ++ :ref:`CEC_RECEIVE ` and :ref:`CEC_DQEVENT ` ioctls ++ will return the ``EAGAIN`` error code when no message or event is available, and ++ ioctls :ref:`CEC_TRANSMIT `, ++ :ref:`CEC_ADAP_S_PHYS_ADDR ` and ++ :ref:`CEC_ADAP_S_LOG_ADDRS ` ++ all return 0. ++ ++ Other flags have no effect. ++ ++ ++Description ++=========== ++ ++To open a cec device applications call :c:func:`open() ` with the ++desired device name. The function has no side effects; the device ++configuration remain unchanged. ++ ++When the device is opened in read-only mode, attempts to modify its ++configuration will result in an error, and ``errno`` will be set to ++EBADF. ++ ++ ++Return Value ++============ ++ ++:c:func:`open() ` returns the new file descriptor on success. On error, ++-1 is returned, and ``errno`` is set appropriately. Possible error codes ++include: ++ ++``EACCES`` ++ The requested access to the file is not allowed. ++ ++``EMFILE`` ++ The process already has the maximum number of files open. ++ ++``ENFILE`` ++ The system limit on the total number of open files has been reached. ++ ++``ENOMEM`` ++ Insufficient kernel memory was available. ++ ++``ENXIO`` ++ No device corresponding to this device special file exists. +diff --git a/Documentation/media/uapi/cec/cec-func-poll.rst b/Documentation/media/uapi/cec/cec-func-poll.rst +new file mode 100644 +index 000000000000..d49f1ee0742d +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-func-poll.rst +@@ -0,0 +1,77 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _cec-func-poll: ++ ++********** ++cec poll() ++********** ++ ++Name ++==== ++ ++cec-poll - Wait for some event on a file descriptor ++ ++ ++Synopsis ++======== ++ ++.. code-block:: c ++ ++ #include ++ ++ ++.. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) ++ :name: cec-poll ++ ++Arguments ++========= ++ ++``ufds`` ++ List of FD events to be watched ++ ++``nfds`` ++ Number of FD events at the \*ufds array ++ ++``timeout`` ++ Timeout to wait for events ++ ++ ++Description ++=========== ++ ++With the :c:func:`poll() ` function applications can wait for CEC ++events. ++ ++On success :c:func:`poll() ` returns the number of file descriptors ++that have been selected (that is, file descriptors for which the ++``revents`` field of the respective struct :c:type:`pollfd` ++is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in ++the ``revents`` field if there are messages in the receive queue. If the ++transmit queue has room for new messages, the ``POLLOUT`` and ++``POLLWRNORM`` flags are set. If there are events in the event queue, ++then the ``POLLPRI`` flag is set. When the function times out it returns ++a value of zero, on failure it returns -1 and the ``errno`` variable is ++set appropriately. ++ ++For more details see the :c:func:`poll() ` manual page. ++ ++ ++Return Value ++============ ++ ++On success, :c:func:`poll() ` returns the number structures which have ++non-zero ``revents`` fields, or zero if the call timed out. On error -1 ++is returned, and the ``errno`` variable is set appropriately: ++ ++``EBADF`` ++ One or more of the ``ufds`` members specify an invalid file ++ descriptor. ++ ++``EFAULT`` ++ ``ufds`` references an inaccessible memory area. ++ ++``EINTR`` ++ The call was interrupted by a signal. ++ ++``EINVAL`` ++ The ``nfds`` argument is greater than ``OPEN_MAX``. +diff --git a/Documentation/media/uapi/cec/cec-funcs.rst b/Documentation/media/uapi/cec/cec-funcs.rst +new file mode 100644 +index 000000000000..6d696cead5cb +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-funcs.rst +@@ -0,0 +1,20 @@ ++.. _cec-user-func: ++ ++****************** ++Function Reference ++****************** ++ ++ ++.. toctree:: ++ :maxdepth: 1 ++ ++ cec-func-open ++ cec-func-close ++ cec-func-ioctl ++ cec-func-poll ++ cec-ioc-adap-g-caps ++ cec-ioc-adap-g-log-addrs ++ cec-ioc-adap-g-phys-addr ++ cec-ioc-dqevent ++ cec-ioc-g-mode ++ cec-ioc-receive +diff --git a/Documentation/media/uapi/cec/cec-header.rst b/Documentation/media/uapi/cec/cec-header.rst +new file mode 100644 +index 000000000000..d5a9a2828274 +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-header.rst +@@ -0,0 +1,10 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _cec_header: ++ ++*************** ++CEC Header File ++*************** ++ ++.. kernel-include:: $BUILDDIR/cec.h.rst ++ +diff --git a/Documentation/media/uapi/cec/cec-intro.rst b/Documentation/media/uapi/cec/cec-intro.rst +new file mode 100644 +index 000000000000..07ee2b8f89d6 +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-intro.rst +@@ -0,0 +1,40 @@ ++.. _cec-intro: ++ ++Introduction ++============ ++ ++HDMI connectors provide a single pin for use by the Consumer Electronics ++Control protocol. This protocol allows different devices connected by an ++HDMI cable to communicate. The protocol for CEC version 1.4 is defined ++in supplements 1 (CEC) and 2 (HEAC or HDMI Ethernet and Audio Return ++Channel) of the HDMI 1.4a (:ref:`hdmi`) specification and the ++extensions added to CEC version 2.0 are defined in chapter 11 of the ++HDMI 2.0 (:ref:`hdmi2`) specification. ++ ++The bitrate is very slow (effectively no more than 36 bytes per second) ++and is based on the ancient AV.link protocol used in old SCART ++connectors. The protocol closely resembles a crazy Rube Goldberg ++contraption and is an unholy mix of low and high level messages. Some ++messages, especially those part of the HEAC protocol layered on top of ++CEC, need to be handled by the kernel, others can be handled either by ++the kernel or by userspace. ++ ++In addition, CEC can be implemented in HDMI receivers, transmitters and ++in USB devices that have an HDMI input and an HDMI output and that ++control just the CEC pin. ++ ++Drivers that support CEC will create a CEC device node (/dev/cecX) to ++give userspace access to the CEC adapter. The ++:ref:`CEC_ADAP_G_CAPS` ioctl will tell userspace what it is allowed to do. ++ ++In order to check the support and test it, it is suggested to download ++the `v4l-utils `_ package. It ++provides three tools to handle CEC: ++ ++- cec-ctl: the Swiss army knife of CEC. Allows you to configure, transmit ++ and monitor CEC messages. ++ ++- cec-compliance: does a CEC compliance test of a remote CEC device to ++ determine how compliant the CEC implementation is. ++ ++- cec-follower: emulates a CEC follower. +diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +new file mode 100644 +index 000000000000..6c1f6efb822e +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +@@ -0,0 +1,139 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _CEC_ADAP_G_CAPS: ++ ++********************* ++ioctl CEC_ADAP_G_CAPS ++********************* ++ ++Name ++==== ++ ++CEC_ADAP_G_CAPS - Query device capabilities ++ ++Synopsis ++======== ++ ++.. c:function:: int ioctl( int fd, CEC_ADAP_G_CAPS, struct cec_caps *argp ) ++ :name: CEC_ADAP_G_CAPS ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``argp`` ++ ++ ++Description ++=========== ++ ++All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS `. To query ++device information, applications call the ioctl with a pointer to a ++struct :c:type:`cec_caps`. The driver fills the structure and ++returns the information to the application. The ioctl never fails. ++ ++.. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.8cm}| ++ ++.. c:type:: cec_caps ++ ++.. flat-table:: struct cec_caps ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 16 ++ ++ * - char ++ - ``driver[32]`` ++ - The name of the cec adapter driver. ++ * - char ++ - ``name[32]`` ++ - The name of this CEC adapter. The combination ``driver`` and ++ ``name`` must be unique. ++ * - __u32 ++ - ``capabilities`` ++ - The capabilities of the CEC adapter, see ++ :ref:`cec-capabilities`. ++ * - __u32 ++ - ``version`` ++ - CEC Framework API version, formatted with the ``KERNEL_VERSION()`` ++ macro. ++ ++ ++.. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.6cm}| ++ ++.. _cec-capabilities: ++ ++.. flat-table:: CEC Capabilities Flags ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 8 ++ ++ * .. _`CEC-CAP-PHYS-ADDR`: ++ ++ - ``CEC_CAP_PHYS_ADDR`` ++ - 0x00000001 ++ - Userspace has to configure the physical address by calling ++ :ref:`ioctl CEC_ADAP_S_PHYS_ADDR `. If ++ this capability isn't set, then setting the physical address is ++ handled by the kernel whenever the EDID is set (for an HDMI ++ receiver) or read (for an HDMI transmitter). ++ * .. _`CEC-CAP-LOG-ADDRS`: ++ ++ - ``CEC_CAP_LOG_ADDRS`` ++ - 0x00000002 ++ - Userspace has to configure the logical addresses by calling ++ :ref:`ioctl CEC_ADAP_S_LOG_ADDRS `. If ++ this capability isn't set, then the kernel will have configured ++ this. ++ * .. _`CEC-CAP-TRANSMIT`: ++ ++ - ``CEC_CAP_TRANSMIT`` ++ - 0x00000004 ++ - Userspace can transmit CEC messages by calling ++ :ref:`ioctl CEC_TRANSMIT `. This implies that ++ userspace can be a follower as well, since being able to transmit ++ messages is a prerequisite of becoming a follower. If this ++ capability isn't set, then the kernel will handle all CEC ++ transmits and process all CEC messages it receives. ++ * .. _`CEC-CAP-PASSTHROUGH`: ++ ++ - ``CEC_CAP_PASSTHROUGH`` ++ - 0x00000008 ++ - Userspace can use the passthrough mode by calling ++ :ref:`ioctl CEC_S_MODE `. ++ * .. _`CEC-CAP-RC`: ++ ++ - ``CEC_CAP_RC`` ++ - 0x00000010 ++ - This adapter supports the remote control protocol. ++ * .. _`CEC-CAP-MONITOR-ALL`: ++ ++ - ``CEC_CAP_MONITOR_ALL`` ++ - 0x00000020 ++ - The CEC hardware can monitor all messages, not just directed and ++ broadcast messages. ++ * .. _`CEC-CAP-NEEDS-HPD`: ++ ++ - ``CEC_CAP_NEEDS_HPD`` ++ - 0x00000040 ++ - The CEC hardware is only active if the HDMI Hotplug Detect pin is ++ high. This makes it impossible to use CEC to wake up displays that ++ set the HPD pin low when in standby mode, but keep the CEC bus ++ alive. ++ * .. _`CEC-CAP-MONITOR-PIN`: ++ ++ - ``CEC_CAP_MONITOR_PIN`` ++ - 0x00000080 ++ - The CEC hardware can monitor CEC pin changes from low to high voltage ++ and vice versa. When in pin monitoring mode the application will ++ receive ``CEC_EVENT_PIN_CEC_LOW`` and ``CEC_EVENT_PIN_CEC_HIGH`` events. ++ ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. +diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +new file mode 100644 +index 000000000000..84f431a022ad +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +@@ -0,0 +1,371 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _CEC_ADAP_LOG_ADDRS: ++.. _CEC_ADAP_G_LOG_ADDRS: ++.. _CEC_ADAP_S_LOG_ADDRS: ++ ++**************************************************** ++ioctls CEC_ADAP_G_LOG_ADDRS and CEC_ADAP_S_LOG_ADDRS ++**************************************************** ++ ++Name ++==== ++ ++CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses ++ ++ ++Synopsis ++======== ++ ++.. c:function:: int ioctl( int fd, CEC_ADAP_G_LOG_ADDRS, struct cec_log_addrs *argp ) ++ :name: CEC_ADAP_G_LOG_ADDRS ++ ++.. c:function:: int ioctl( int fd, CEC_ADAP_S_LOG_ADDRS, struct cec_log_addrs *argp ) ++ :name: CEC_ADAP_S_LOG_ADDRS ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``argp`` ++ Pointer to struct :c:type:`cec_log_addrs`. ++ ++Description ++=========== ++ ++To query the current CEC logical addresses, applications call ++:ref:`ioctl CEC_ADAP_G_LOG_ADDRS ` with a pointer to a ++struct :c:type:`cec_log_addrs` where the driver stores the logical addresses. ++ ++To set new logical addresses, applications fill in ++struct :c:type:`cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` ++with a pointer to this struct. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` ++is only available if ``CEC_CAP_LOG_ADDRS`` is set (the ``ENOTTY`` error code is ++returned otherwise). The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` ++can only be called by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not ++the ``EBUSY`` error code will be returned. ++ ++To clear existing logical addresses set ``num_log_addrs`` to 0. All other fields ++will be ignored in that case. The adapter will go to the unconfigured state and the ++``cec_version``, ``vendor_id`` and ``osd_name`` fields are all reset to their default ++values (CEC version 2.0, no vendor ID and an empty OSD name). ++ ++If the physical address is valid (see :ref:`ioctl CEC_ADAP_S_PHYS_ADDR `), ++then this ioctl will block until all requested logical ++addresses have been claimed. If the file descriptor is in non-blocking mode then it will ++not wait for the logical addresses to be claimed, instead it just returns 0. ++ ++A :ref:`CEC_EVENT_STATE_CHANGE ` event is sent when the ++logical addresses are claimed or cleared. ++ ++Attempting to call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` when ++logical address types are already defined will return with error ``EBUSY``. ++ ++.. c:type:: cec_log_addrs ++ ++.. tabularcolumns:: |p{1.0cm}|p{8.0cm}|p{7.5cm}| ++ ++.. cssclass:: longtable ++ ++.. flat-table:: struct cec_log_addrs ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 16 ++ ++ * - __u8 ++ - ``log_addr[CEC_MAX_LOG_ADDRS]`` ++ - The actual logical addresses that were claimed. This is set by the ++ driver. If no logical address could be claimed, then it is set to ++ ``CEC_LOG_ADDR_INVALID``. If this adapter is Unregistered, then ++ ``log_addr[0]`` is set to 0xf and all others to ++ ``CEC_LOG_ADDR_INVALID``. ++ * - __u16 ++ - ``log_addr_mask`` ++ - The bitmask of all logical addresses this adapter has claimed. If ++ this adapter is Unregistered then ``log_addr_mask`` sets bit 15 ++ and clears all other bits. If this adapter is not configured at ++ all, then ``log_addr_mask`` is set to 0. Set by the driver. ++ * - __u8 ++ - ``cec_version`` ++ - The CEC version that this adapter shall use. See ++ :ref:`cec-versions`. Used to implement the ++ ``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages. ++ Note that :ref:`CEC_OP_CEC_VERSION_1_3A ` is not allowed by the CEC ++ framework. ++ * - __u8 ++ - ``num_log_addrs`` ++ - Number of logical addresses to set up. Must be ≤ ++ ``available_log_addrs`` as returned by ++ :ref:`CEC_ADAP_G_CAPS`. All arrays in ++ this structure are only filled up to index ++ ``available_log_addrs``-1. The remaining array elements will be ++ ignored. Note that the CEC 2.0 standard allows for a maximum of 2 ++ logical addresses, although some hardware has support for more. ++ ``CEC_MAX_LOG_ADDRS`` is 4. The driver will return the actual ++ number of logical addresses it could claim, which may be less than ++ what was requested. If this field is set to 0, then the CEC ++ adapter shall clear all claimed logical addresses and all other ++ fields will be ignored. ++ * - __u32 ++ - ``vendor_id`` ++ - The vendor ID is a 24-bit number that identifies the specific ++ vendor or entity. Based on this ID vendor specific commands may be ++ defined. If you do not want a vendor ID then set it to ++ ``CEC_VENDOR_ID_NONE``. ++ * - __u32 ++ - ``flags`` ++ - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags. ++ * - char ++ - ``osd_name[15]`` ++ - The On-Screen Display name as is returned by the ++ ``CEC_MSG_SET_OSD_NAME`` message. ++ * - __u8 ++ - ``primary_device_type[CEC_MAX_LOG_ADDRS]`` ++ - Primary device type for each logical address. See ++ :ref:`cec-prim-dev-types` for possible types. ++ * - __u8 ++ - ``log_addr_type[CEC_MAX_LOG_ADDRS]`` ++ - Logical address types. See :ref:`cec-log-addr-types` for ++ possible types. The driver will update this with the actual ++ logical address type that it claimed (e.g. it may have to fallback ++ to :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED `). ++ * - __u8 ++ - ``all_device_types[CEC_MAX_LOG_ADDRS]`` ++ - CEC 2.0 specific: the bit mask of all device types. See ++ :ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0 ++ ``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave ++ this field to 0, or fill it in according to the CEC 2.0 guidelines to ++ give the CEC framework more information about the device type, even ++ though the framework won't use it directly in the CEC message. ++ * - __u8 ++ - ``features[CEC_MAX_LOG_ADDRS][12]`` ++ - Features for each logical address. It is used in the CEC 2.0 ++ ``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the ++ RC Profile and the Device Features. For CEC 1.4 you can either leave ++ this field to all 0, or fill it in according to the CEC 2.0 guidelines to ++ give the CEC framework more information about the device type, even ++ though the framework won't use it directly in the CEC message. ++ ++ ++.. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.7cm}| ++ ++.. _cec-log-addrs-flags: ++ ++.. flat-table:: Flags for struct cec_log_addrs ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 4 ++ ++ * .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`: ++ ++ - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK`` ++ - 1 ++ - By default if no logical address of the requested type can be claimed, then ++ it will go back to the unconfigured state. If this flag is set, then it will ++ fallback to the Unregistered logical address. Note that if the Unregistered ++ logical address was explicitly requested, then this flag has no effect. ++ * .. _`CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU`: ++ ++ - ``CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU`` ++ - 2 ++ - By default the ``CEC_MSG_USER_CONTROL_PRESSED`` and ``CEC_MSG_USER_CONTROL_RELEASED`` ++ messages are only passed on to the follower(s), if any. If this flag is set, ++ then these messages are also passed on to the remote control input subsystem ++ and will appear as keystrokes. This features needs to be enabled explicitly. ++ If CEC is used to enter e.g. passwords, then you may not want to enable this ++ to avoid trivial snooping of the keystrokes. ++ * .. _`CEC-LOG-ADDRS-FL-CDC-ONLY`: ++ ++ - ``CEC_LOG_ADDRS_FL_CDC_ONLY`` ++ - 4 ++ - If this flag is set, then the device is CDC-Only. CDC-Only CEC devices ++ are CEC devices that can only handle CDC messages. ++ ++ All other messages are ignored. ++ ++ ++.. tabularcolumns:: |p{7.8cm}|p{1.0cm}|p{8.7cm}| ++ ++.. _cec-versions: ++ ++.. flat-table:: CEC Versions ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 4 ++ ++ * .. _`CEC-OP-CEC-VERSION-1-3A`: ++ ++ - ``CEC_OP_CEC_VERSION_1_3A`` ++ - 4 ++ - CEC version according to the HDMI 1.3a standard. ++ * .. _`CEC-OP-CEC-VERSION-1-4B`: ++ ++ - ``CEC_OP_CEC_VERSION_1_4B`` ++ - 5 ++ - CEC version according to the HDMI 1.4b standard. ++ * .. _`CEC-OP-CEC-VERSION-2-0`: ++ ++ - ``CEC_OP_CEC_VERSION_2_0`` ++ - 6 ++ - CEC version according to the HDMI 2.0 standard. ++ ++ ++.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| ++ ++.. _cec-prim-dev-types: ++ ++.. flat-table:: CEC Primary Device Types ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 4 ++ ++ * .. _`CEC-OP-PRIM-DEVTYPE-TV`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_TV`` ++ - 0 ++ - Use for a TV. ++ * .. _`CEC-OP-PRIM-DEVTYPE-RECORD`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_RECORD`` ++ - 1 ++ - Use for a recording device. ++ * .. _`CEC-OP-PRIM-DEVTYPE-TUNER`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_TUNER`` ++ - 3 ++ - Use for a device with a tuner. ++ * .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_PLAYBACK`` ++ - 4 ++ - Use for a playback device. ++ * .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM`` ++ - 5 ++ - Use for an audio system (e.g. an audio/video receiver). ++ * .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_SWITCH`` ++ - 6 ++ - Use for a CEC switch. ++ * .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`: ++ ++ - ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC`` ++ - 7 ++ - Use for a video processor device. ++ ++ ++.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| ++ ++.. _cec-log-addr-types: ++ ++.. flat-table:: CEC Logical Address Types ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 16 ++ ++ * .. _`CEC-LOG-ADDR-TYPE-TV`: ++ ++ - ``CEC_LOG_ADDR_TYPE_TV`` ++ - 0 ++ - Use for a TV. ++ * .. _`CEC-LOG-ADDR-TYPE-RECORD`: ++ ++ - ``CEC_LOG_ADDR_TYPE_RECORD`` ++ - 1 ++ - Use for a recording device. ++ * .. _`CEC-LOG-ADDR-TYPE-TUNER`: ++ ++ - ``CEC_LOG_ADDR_TYPE_TUNER`` ++ - 2 ++ - Use for a tuner device. ++ * .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`: ++ ++ - ``CEC_LOG_ADDR_TYPE_PLAYBACK`` ++ - 3 ++ - Use for a playback device. ++ * .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`: ++ ++ - ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM`` ++ - 4 ++ - Use for an audio system device. ++ * .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`: ++ ++ - ``CEC_LOG_ADDR_TYPE_SPECIFIC`` ++ - 5 ++ - Use for a second TV or for a video processor device. ++ * .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`: ++ ++ - ``CEC_LOG_ADDR_TYPE_UNREGISTERED`` ++ - 6 ++ - Use this if you just want to remain unregistered. Used for pure ++ CEC switches or CDC-only devices (CDC: Capability Discovery and ++ Control). ++ ++ ++ ++.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| ++ ++.. _cec-all-dev-types-flags: ++ ++.. flat-table:: CEC All Device Types Flags ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 4 ++ ++ * .. _`CEC-OP-ALL-DEVTYPE-TV`: ++ ++ - ``CEC_OP_ALL_DEVTYPE_TV`` ++ - 0x80 ++ - This supports the TV type. ++ * .. _`CEC-OP-ALL-DEVTYPE-RECORD`: ++ ++ - ``CEC_OP_ALL_DEVTYPE_RECORD`` ++ - 0x40 ++ - This supports the Recording type. ++ * .. _`CEC-OP-ALL-DEVTYPE-TUNER`: ++ ++ - ``CEC_OP_ALL_DEVTYPE_TUNER`` ++ - 0x20 ++ - This supports the Tuner type. ++ * .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`: ++ ++ - ``CEC_OP_ALL_DEVTYPE_PLAYBACK`` ++ - 0x10 ++ - This supports the Playback type. ++ * .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`: ++ ++ - ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM`` ++ - 0x08 ++ - This supports the Audio System type. ++ * .. _`CEC-OP-ALL-DEVTYPE-SWITCH`: ++ ++ - ``CEC_OP_ALL_DEVTYPE_SWITCH`` ++ - 0x04 ++ - This supports the CEC Switch or Video Processing type. ++ ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. ++ ++The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` can return the following ++error codes: ++ ++ENOTTY ++ The ``CEC_CAP_LOG_ADDRS`` capability wasn't set, so this ioctl is not supported. ++ ++EBUSY ++ The CEC adapter is currently configuring itself, or it is already configured and ++ ``num_log_addrs`` is non-zero, or another filehandle is in exclusive follower or ++ initiator mode, or the filehandle is in mode ``CEC_MODE_NO_INITIATOR``. ++ ++EINVAL ++ The contents of struct :c:type:`cec_log_addrs` is invalid. +diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +new file mode 100644 +index 000000000000..9e49d4be35d5 +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +@@ -0,0 +1,93 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _CEC_ADAP_PHYS_ADDR: ++.. _CEC_ADAP_G_PHYS_ADDR: ++.. _CEC_ADAP_S_PHYS_ADDR: ++ ++**************************************************** ++ioctls CEC_ADAP_G_PHYS_ADDR and CEC_ADAP_S_PHYS_ADDR ++**************************************************** ++ ++Name ++==== ++ ++CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address ++ ++ ++Synopsis ++======== ++ ++.. c:function:: int ioctl( int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp ) ++ :name: CEC_ADAP_G_PHYS_ADDR ++ ++.. c:function:: int ioctl( int fd, CEC_ADAP_S_PHYS_ADDR, __u16 *argp ) ++ :name: CEC_ADAP_S_PHYS_ADDR ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``argp`` ++ Pointer to the CEC address. ++ ++Description ++=========== ++ ++To query the current physical address applications call ++:ref:`ioctl CEC_ADAP_G_PHYS_ADDR ` with a pointer to a __u16 where the ++driver stores the physical address. ++ ++To set a new physical address applications store the physical address in ++a __u16 and call :ref:`ioctl CEC_ADAP_S_PHYS_ADDR ` with a pointer to ++this integer. The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR ` is only available if ++``CEC_CAP_PHYS_ADDR`` is set (the ``ENOTTY`` error code will be returned ++otherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR ` can only be called ++by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not ++the ``EBUSY`` error code will be returned. ++ ++To clear an existing physical address use ``CEC_PHYS_ADDR_INVALID``. ++The adapter will go to the unconfigured state. ++ ++If logical address types have been defined (see :ref:`ioctl CEC_ADAP_S_LOG_ADDRS `), ++then this ioctl will block until all ++requested logical addresses have been claimed. If the file descriptor is in non-blocking mode ++then it will not wait for the logical addresses to be claimed, instead it just returns 0. ++ ++A :ref:`CEC_EVENT_STATE_CHANGE ` event is sent when the physical address ++changes. ++ ++The physical address is a 16-bit number where each group of 4 bits ++represent a digit of the physical address a.b.c.d where the most ++significant 4 bits represent 'a'. The CEC root device (usually the TV) ++has address 0.0.0.0. Every device that is hooked up to an input of the ++TV has address a.0.0.0 (where 'a' is ≥ 1), devices hooked up to those in ++turn have addresses a.b.0.0, etc. So a topology of up to 5 devices deep ++is supported. The physical address a device shall use is stored in the ++EDID of the sink. ++ ++For example, the EDID for each HDMI input of the TV will have a ++different physical address of the form a.0.0.0 that the sources will ++read out and use as their physical address. ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. ++ ++The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR ` can return the following ++error codes: ++ ++ENOTTY ++ The ``CEC_CAP_PHYS_ADDR`` capability wasn't set, so this ioctl is not supported. ++ ++EBUSY ++ Another filehandle is in exclusive follower or initiator mode, or the filehandle ++ is in mode ``CEC_MODE_NO_INITIATOR``. ++ ++EINVAL ++ The physical address is malformed. +diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +new file mode 100644 +index 000000000000..b6fd86424fbb +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +@@ -0,0 +1,226 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _CEC_DQEVENT: ++ ++***************** ++ioctl CEC_DQEVENT ++***************** ++ ++Name ++==== ++ ++CEC_DQEVENT - Dequeue a CEC event ++ ++ ++Synopsis ++======== ++ ++.. c:function:: int ioctl( int fd, CEC_DQEVENT, struct cec_event *argp ) ++ :name: CEC_DQEVENT ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``argp`` ++ ++ ++Description ++=========== ++ ++CEC devices can send asynchronous events. These can be retrieved by ++calling :c:func:`CEC_DQEVENT`. If the file descriptor is in ++non-blocking mode and no event is pending, then it will return -1 and ++set errno to the ``EAGAIN`` error code. ++ ++The internal event queues are per-filehandle and per-event type. If ++there is no more room in a queue then the last event is overwritten with ++the new one. This means that intermediate results can be thrown away but ++that the latest event is always available. This also means that is it ++possible to read two successive events that have the same value (e.g. ++two :ref:`CEC_EVENT_STATE_CHANGE ` events with ++the same state). In that case the intermediate state changes were lost but ++it is guaranteed that the state did change in between the two events. ++ ++.. tabularcolumns:: |p{1.2cm}|p{2.9cm}|p{13.4cm}| ++ ++.. c:type:: cec_event_state_change ++ ++.. flat-table:: struct cec_event_state_change ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 8 ++ ++ * - __u16 ++ - ``phys_addr`` ++ - The current physical address. This is ``CEC_PHYS_ADDR_INVALID`` if no ++ valid physical address is set. ++ * - __u16 ++ - ``log_addr_mask`` ++ - The current set of claimed logical addresses. This is 0 if no logical ++ addresses are claimed or if ``phys_addr`` is ``CEC_PHYS_ADDR_INVALID``. ++ If bit 15 is set (``1 << CEC_LOG_ADDR_UNREGISTERED``) then this device ++ has the unregistered logical address. In that case all other bits are 0. ++ ++ ++.. c:type:: cec_event_lost_msgs ++ ++.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.5cm}| ++ ++.. flat-table:: struct cec_event_lost_msgs ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 16 ++ ++ * - __u32 ++ - ``lost_msgs`` ++ - Set to the number of lost messages since the filehandle was opened ++ or since the last time this event was dequeued for this ++ filehandle. The messages lost are the oldest messages. So when a ++ new message arrives and there is no more room, then the oldest ++ message is discarded to make room for the new one. The internal ++ size of the message queue guarantees that all messages received in ++ the last two seconds will be stored. Since messages should be ++ replied to within a second according to the CEC specification, ++ this is more than enough. ++ ++ ++.. tabularcolumns:: |p{1.0cm}|p{4.4cm}|p{2.5cm}|p{9.6cm}| ++ ++.. c:type:: cec_event ++ ++.. flat-table:: struct cec_event ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 1 8 ++ ++ * - __u64 ++ - ``ts`` ++ - :cspan:`1`\ Timestamp of the event in ns. ++ ++ The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. ++ ++ To access the same clock from userspace use :c:func:`clock_gettime`. ++ * - __u32 ++ - ``event`` ++ - :cspan:`1` The CEC event type, see :ref:`cec-events`. ++ * - __u32 ++ - ``flags`` ++ - :cspan:`1` Event flags, see :ref:`cec-event-flags`. ++ * - union ++ - (anonymous) ++ - ++ - ++ * - ++ - struct cec_event_state_change ++ - ``state_change`` ++ - The new adapter state as sent by the :ref:`CEC_EVENT_STATE_CHANGE ` ++ event. ++ * - ++ - struct cec_event_lost_msgs ++ - ``lost_msgs`` ++ - The number of lost messages as sent by the :ref:`CEC_EVENT_LOST_MSGS ` ++ event. ++ ++ ++.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| ++ ++.. _cec-events: ++ ++.. flat-table:: CEC Events Types ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 16 ++ ++ * .. _`CEC-EVENT-STATE-CHANGE`: ++ ++ - ``CEC_EVENT_STATE_CHANGE`` ++ - 1 ++ - Generated when the CEC Adapter's state changes. When open() is ++ called an initial event will be generated for that filehandle with ++ the CEC Adapter's state at that time. ++ * .. _`CEC-EVENT-LOST-MSGS`: ++ ++ - ``CEC_EVENT_LOST_MSGS`` ++ - 2 ++ - Generated if one or more CEC messages were lost because the ++ application didn't dequeue CEC messages fast enough. ++ * .. _`CEC-EVENT-PIN-CEC-LOW`: ++ ++ - ``CEC_EVENT_PIN_CEC_LOW`` ++ - 3 ++ - Generated if the CEC pin goes from a high voltage to a low voltage. ++ Only applies to adapters that have the ``CEC_CAP_MONITOR_PIN`` ++ capability set. ++ * .. _`CEC-EVENT-PIN-CEC-HIGH`: ++ ++ - ``CEC_EVENT_PIN_CEC_HIGH`` ++ - 4 ++ - Generated if the CEC pin goes from a low voltage to a high voltage. ++ Only applies to adapters that have the ``CEC_CAP_MONITOR_PIN`` ++ capability set. ++ * .. _`CEC-EVENT-PIN-HPD-LOW`: ++ ++ - ``CEC_EVENT_PIN_HPD_LOW`` ++ - 5 ++ - Generated if the HPD pin goes from a high voltage to a low voltage. ++ Only applies to adapters that have the ``CEC_CAP_MONITOR_PIN`` ++ capability set. When open() is called, the HPD pin can be read and ++ if the HPD is low, then an initial event will be generated for that ++ filehandle. ++ * .. _`CEC-EVENT-PIN-HPD-HIGH`: ++ ++ - ``CEC_EVENT_PIN_HPD_HIGH`` ++ - 6 ++ - Generated if the HPD pin goes from a low voltage to a high voltage. ++ Only applies to adapters that have the ``CEC_CAP_MONITOR_PIN`` ++ capability set. When open() is called, the HPD pin can be read and ++ if the HPD is high, then an initial event will be generated for that ++ filehandle. ++ ++ ++.. tabularcolumns:: |p{6.0cm}|p{0.6cm}|p{10.9cm}| ++ ++.. _cec-event-flags: ++ ++.. flat-table:: CEC Event Flags ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 8 ++ ++ * .. _`CEC-EVENT-FL-INITIAL-STATE`: ++ ++ - ``CEC_EVENT_FL_INITIAL_STATE`` ++ - 1 ++ - Set for the initial events that are generated when the device is ++ opened. See the table above for which events do this. This allows ++ applications to learn the initial state of the CEC adapter at ++ open() time. ++ * .. _`CEC-EVENT-FL-DROPPED-EVENTS`: ++ ++ - ``CEC_EVENT_FL_DROPPED_EVENTS`` ++ - 2 ++ - Set if one or more events of the given event type have been dropped. ++ This is an indication that the application cannot keep up. ++ ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. ++ ++The :ref:`ioctl CEC_DQEVENT ` can return the following ++error codes: ++ ++EAGAIN ++ This is returned when the filehandle is in non-blocking mode and there ++ are no pending events. ++ ++ERESTARTSYS ++ An interrupt (e.g. Ctrl-C) arrived while in blocking mode waiting for ++ events to arrive. +diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +new file mode 100644 +index 000000000000..508e2e325683 +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +@@ -0,0 +1,293 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _CEC_MODE: ++.. _CEC_G_MODE: ++.. _CEC_S_MODE: ++ ++******************************** ++ioctls CEC_G_MODE and CEC_S_MODE ++******************************** ++ ++CEC_G_MODE, CEC_S_MODE - Get or set exclusive use of the CEC adapter ++ ++Synopsis ++======== ++ ++.. c:function:: int ioctl( int fd, CEC_G_MODE, __u32 *argp ) ++ :name: CEC_G_MODE ++ ++.. c:function:: int ioctl( int fd, CEC_S_MODE, __u32 *argp ) ++ :name: CEC_S_MODE ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``argp`` ++ Pointer to CEC mode. ++ ++Description ++=========== ++ ++By default any filehandle can use :ref:`CEC_TRANSMIT`, but in order to prevent ++applications from stepping on each others toes it must be possible to ++obtain exclusive access to the CEC adapter. This ioctl sets the ++filehandle to initiator and/or follower mode which can be exclusive ++depending on the chosen mode. The initiator is the filehandle that is ++used to initiate messages, i.e. it commands other CEC devices. The ++follower is the filehandle that receives messages sent to the CEC ++adapter and processes them. The same filehandle can be both initiator ++and follower, or this role can be taken by two different filehandles. ++ ++When a CEC message is received, then the CEC framework will decide how ++it will be processed. If the message is a reply to an earlier ++transmitted message, then the reply is sent back to the filehandle that ++is waiting for it. In addition the CEC framework will process it. ++ ++If the message is not a reply, then the CEC framework will process it ++first. If there is no follower, then the message is just discarded and a ++feature abort is sent back to the initiator if the framework couldn't ++process it. If there is a follower, then the message is passed on to the ++follower who will use :ref:`ioctl CEC_RECEIVE ` to dequeue ++the new message. The framework expects the follower to make the right ++decisions. ++ ++The CEC framework will process core messages unless requested otherwise ++by the follower. The follower can enable the passthrough mode. In that ++case, the CEC framework will pass on most core messages without ++processing them and the follower will have to implement those messages. ++There are some messages that the core will always process, regardless of ++the passthrough mode. See :ref:`cec-core-processing` for details. ++ ++If there is no initiator, then any CEC filehandle can use ++:ref:`ioctl CEC_TRANSMIT `. If there is an exclusive ++initiator then only that initiator can call ++:ref:`CEC_TRANSMIT`. The follower can of course ++always call :ref:`ioctl CEC_TRANSMIT `. ++ ++Available initiator modes are: ++ ++.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| ++ ++.. _cec-mode-initiator_e: ++ ++.. flat-table:: Initiator Modes ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 16 ++ ++ * .. _`CEC-MODE-NO-INITIATOR`: ++ ++ - ``CEC_MODE_NO_INITIATOR`` ++ - 0x0 ++ - This is not an initiator, i.e. it cannot transmit CEC messages or ++ make any other changes to the CEC adapter. ++ * .. _`CEC-MODE-INITIATOR`: ++ ++ - ``CEC_MODE_INITIATOR`` ++ - 0x1 ++ - This is an initiator (the default when the device is opened) and ++ it can transmit CEC messages and make changes to the CEC adapter, ++ unless there is an exclusive initiator. ++ * .. _`CEC-MODE-EXCL-INITIATOR`: ++ ++ - ``CEC_MODE_EXCL_INITIATOR`` ++ - 0x2 ++ - This is an exclusive initiator and this file descriptor is the ++ only one that can transmit CEC messages and make changes to the ++ CEC adapter. If someone else is already the exclusive initiator ++ then an attempt to become one will return the ``EBUSY`` error code ++ error. ++ ++ ++Available follower modes are: ++ ++.. tabularcolumns:: |p{6.6cm}|p{0.9cm}|p{10.0cm}| ++ ++.. _cec-mode-follower_e: ++ ++.. cssclass:: longtable ++ ++.. flat-table:: Follower Modes ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 16 ++ ++ * .. _`CEC-MODE-NO-FOLLOWER`: ++ ++ - ``CEC_MODE_NO_FOLLOWER`` ++ - 0x00 ++ - This is not a follower (the default when the device is opened). ++ * .. _`CEC-MODE-FOLLOWER`: ++ ++ - ``CEC_MODE_FOLLOWER`` ++ - 0x10 ++ - This is a follower and it will receive CEC messages unless there ++ is an exclusive follower. You cannot become a follower if ++ :ref:`CEC_CAP_TRANSMIT ` is not set or if :ref:`CEC_MODE_NO_INITIATOR ` ++ was specified, the ``EINVAL`` error code is returned in that case. ++ * .. _`CEC-MODE-EXCL-FOLLOWER`: ++ ++ - ``CEC_MODE_EXCL_FOLLOWER`` ++ - 0x20 ++ - This is an exclusive follower and only this file descriptor will ++ receive CEC messages for processing. If someone else is already ++ the exclusive follower then an attempt to become one will return ++ the ``EBUSY`` error code. You cannot become a follower if ++ :ref:`CEC_CAP_TRANSMIT ` is not set or if :ref:`CEC_MODE_NO_INITIATOR ` ++ was specified, the ``EINVAL`` error code is returned in that case. ++ * .. _`CEC-MODE-EXCL-FOLLOWER-PASSTHRU`: ++ ++ - ``CEC_MODE_EXCL_FOLLOWER_PASSTHRU`` ++ - 0x30 ++ - This is an exclusive follower and only this file descriptor will ++ receive CEC messages for processing. In addition it will put the ++ CEC device into passthrough mode, allowing the exclusive follower ++ to handle most core messages instead of relying on the CEC ++ framework for that. If someone else is already the exclusive ++ follower then an attempt to become one will return the ``EBUSY`` error ++ code. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT ` ++ is not set or if :ref:`CEC_MODE_NO_INITIATOR ` was specified, ++ the ``EINVAL`` error code is returned in that case. ++ * .. _`CEC-MODE-MONITOR-PIN`: ++ ++ - ``CEC_MODE_MONITOR_PIN`` ++ - 0xd0 ++ - Put the file descriptor into pin monitoring mode. Can only be used in ++ combination with :ref:`CEC_MODE_NO_INITIATOR `, ++ otherwise the ``EINVAL`` error code will be returned. ++ This mode requires that the :ref:`CEC_CAP_MONITOR_PIN ` ++ capability is set, otherwise the ``EINVAL`` error code is returned. ++ While in pin monitoring mode this file descriptor can receive the ++ ``CEC_EVENT_PIN_CEC_LOW`` and ``CEC_EVENT_PIN_CEC_HIGH`` events to see the ++ low-level CEC pin transitions. This is very useful for debugging. ++ This mode is only allowed if the process has the ``CAP_NET_ADMIN`` ++ capability. If that is not set, then the ``EPERM`` error code is returned. ++ * .. _`CEC-MODE-MONITOR`: ++ ++ - ``CEC_MODE_MONITOR`` ++ - 0xe0 ++ - Put the file descriptor into monitor mode. Can only be used in ++ combination with :ref:`CEC_MODE_NO_INITIATOR `,i ++ otherwise the ``EINVAL`` error code will be returned. ++ In monitor mode all messages this CEC ++ device transmits and all messages it receives (both broadcast ++ messages and directed messages for one its logical addresses) will ++ be reported. This is very useful for debugging. This is only ++ allowed if the process has the ``CAP_NET_ADMIN`` capability. If ++ that is not set, then the ``EPERM`` error code is returned. ++ * .. _`CEC-MODE-MONITOR-ALL`: ++ ++ - ``CEC_MODE_MONITOR_ALL`` ++ - 0xf0 ++ - Put the file descriptor into 'monitor all' mode. Can only be used ++ in combination with :ref:`CEC_MODE_NO_INITIATOR `, otherwise ++ the ``EINVAL`` error code will be returned. In 'monitor all' mode all messages ++ this CEC device transmits and all messages it receives, including ++ directed messages for other CEC devices will be reported. This is ++ very useful for debugging, but not all devices support this. This ++ mode requires that the :ref:`CEC_CAP_MONITOR_ALL ` capability is set, ++ otherwise the ``EINVAL`` error code is returned. This is only allowed if ++ the process has the ``CAP_NET_ADMIN`` capability. If that is not ++ set, then the ``EPERM`` error code is returned. ++ ++ ++Core message processing details: ++ ++.. tabularcolumns:: |p{6.6cm}|p{10.9cm}| ++ ++.. _cec-core-processing: ++ ++.. flat-table:: Core Message Processing ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 8 ++ ++ * .. _`CEC-MSG-GET-CEC-VERSION`: ++ ++ - ``CEC_MSG_GET_CEC_VERSION`` ++ - The core will return the CEC version that was set with ++ :ref:`ioctl CEC_ADAP_S_LOG_ADDRS `, ++ except when in passthrough mode. In passthrough mode the core ++ does nothing and this message has to be handled by a follower ++ instead. ++ * .. _`CEC-MSG-GIVE-DEVICE-VENDOR-ID`: ++ ++ - ``CEC_MSG_GIVE_DEVICE_VENDOR_ID`` ++ - The core will return the vendor ID that was set with ++ :ref:`ioctl CEC_ADAP_S_LOG_ADDRS `, ++ except when in passthrough mode. In passthrough mode the core ++ does nothing and this message has to be handled by a follower ++ instead. ++ * .. _`CEC-MSG-ABORT`: ++ ++ - ``CEC_MSG_ABORT`` ++ - The core will return a Feature Abort message with reason ++ 'Feature Refused' as per the specification, except when in ++ passthrough mode. In passthrough mode the core does nothing ++ and this message has to be handled by a follower instead. ++ * .. _`CEC-MSG-GIVE-PHYSICAL-ADDR`: ++ ++ - ``CEC_MSG_GIVE_PHYSICAL_ADDR`` ++ - The core will report the current physical address, except when ++ in passthrough mode. In passthrough mode the core does nothing ++ and this message has to be handled by a follower instead. ++ * .. _`CEC-MSG-GIVE-OSD-NAME`: ++ ++ - ``CEC_MSG_GIVE_OSD_NAME`` ++ - The core will report the current OSD name that was set with ++ :ref:`ioctl CEC_ADAP_S_LOG_ADDRS `, ++ except when in passthrough mode. In passthrough mode the core ++ does nothing and this message has to be handled by a follower ++ instead. ++ * .. _`CEC-MSG-GIVE-FEATURES`: ++ ++ - ``CEC_MSG_GIVE_FEATURES`` ++ - The core will do nothing if the CEC version is older than 2.0, ++ otherwise it will report the current features that were set with ++ :ref:`ioctl CEC_ADAP_S_LOG_ADDRS `, ++ except when in passthrough mode. In passthrough mode the core ++ does nothing (for any CEC version) and this message has to be handled ++ by a follower instead. ++ * .. _`CEC-MSG-USER-CONTROL-PRESSED`: ++ ++ - ``CEC_MSG_USER_CONTROL_PRESSED`` ++ - If :ref:`CEC_CAP_RC ` is set and if ++ :ref:`CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU ` ++ is set, then generate a remote control key ++ press. This message is always passed on to the follower(s). ++ * .. _`CEC-MSG-USER-CONTROL-RELEASED`: ++ ++ - ``CEC_MSG_USER_CONTROL_RELEASED`` ++ - If :ref:`CEC_CAP_RC ` is set and if ++ :ref:`CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU ` ++ is set, then generate a remote control key ++ release. This message is always passed on to the follower(s). ++ * .. _`CEC-MSG-REPORT-PHYSICAL-ADDR`: ++ ++ - ``CEC_MSG_REPORT_PHYSICAL_ADDR`` ++ - The CEC framework will make note of the reported physical address ++ and then just pass the message on to the follower(s). ++ ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. ++ ++The :ref:`ioctl CEC_S_MODE ` can return the following ++error codes: ++ ++EINVAL ++ The requested mode is invalid. ++ ++EPERM ++ Monitor mode is requested without having root permissions ++ ++EBUSY ++ Someone else is already an exclusive follower or initiator. +diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst +new file mode 100644 +index 000000000000..bdad4b197bcd +--- /dev/null ++++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst +@@ -0,0 +1,344 @@ ++.. -*- coding: utf-8; mode: rst -*- ++ ++.. _CEC_TRANSMIT: ++.. _CEC_RECEIVE: ++ ++*********************************** ++ioctls CEC_RECEIVE and CEC_TRANSMIT ++*********************************** ++ ++Name ++==== ++ ++CEC_RECEIVE, CEC_TRANSMIT - Receive or transmit a CEC message ++ ++ ++Synopsis ++======== ++ ++.. c:function:: int ioctl( int fd, CEC_RECEIVE, struct cec_msg *argp ) ++ :name: CEC_RECEIVE ++ ++.. c:function:: int ioctl( int fd, CEC_TRANSMIT, struct cec_msg *argp ) ++ :name: CEC_TRANSMIT ++ ++Arguments ++========= ++ ++``fd`` ++ File descriptor returned by :c:func:`open() `. ++ ++``argp`` ++ Pointer to struct cec_msg. ++ ++Description ++=========== ++ ++To receive a CEC message the application has to fill in the ++``timeout`` field of struct :c:type:`cec_msg` and pass it to ++:ref:`ioctl CEC_RECEIVE `. ++If the file descriptor is in non-blocking mode and there are no received ++messages pending, then it will return -1 and set errno to the ``EAGAIN`` ++error code. If the file descriptor is in blocking mode and ``timeout`` ++is non-zero and no message arrived within ``timeout`` milliseconds, then ++it will return -1 and set errno to the ``ETIMEDOUT`` error code. ++ ++A received message can be: ++ ++1. a message received from another CEC device (the ``sequence`` field will ++ be 0). ++2. the result of an earlier non-blocking transmit (the ``sequence`` field will ++ be non-zero). ++ ++To send a CEC message the application has to fill in the struct ++:c:type:`cec_msg` and pass it to :ref:`ioctl CEC_TRANSMIT `. ++The :ref:`ioctl CEC_TRANSMIT ` is only available if ++``CEC_CAP_TRANSMIT`` is set. If there is no more room in the transmit ++queue, then it will return -1 and set errno to the ``EBUSY`` error code. ++The transmit queue has enough room for 18 messages (about 1 second worth ++of 2-byte messages). Note that the CEC kernel framework will also reply ++to core messages (see :ref:`cec-core-processing`), so it is not a good ++idea to fully fill up the transmit queue. ++ ++If the file descriptor is in non-blocking mode then the transmit will ++return 0 and the result of the transmit will be available via ++:ref:`ioctl CEC_RECEIVE ` once the transmit has finished ++(including waiting for a reply, if requested). ++ ++The ``sequence`` field is filled in for every transmit and this can be ++checked against the received messages to find the corresponding transmit ++result. ++ ++Normally calling :ref:`ioctl CEC_TRANSMIT ` when the physical ++address is invalid (due to e.g. a disconnect) will return ``ENONET``. ++ ++However, the CEC specification allows sending messages from 'Unregistered' to ++'TV' when the physical address is invalid since some TVs pull the hotplug detect ++pin of the HDMI connector low when they go into standby, or when switching to ++another input. ++ ++When the hotplug detect pin goes low the EDID disappears, and thus the ++physical address, but the cable is still connected and CEC still works. ++In order to detect/wake up the device it is allowed to send poll and 'Image/Text ++View On' messages from initiator 0xf ('Unregistered') to destination 0 ('TV'). ++ ++.. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{13.0cm}| ++ ++.. c:type:: cec_msg ++ ++.. cssclass:: longtable ++ ++.. flat-table:: struct cec_msg ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 1 1 16 ++ ++ * - __u64 ++ - ``tx_ts`` ++ - Timestamp in ns of when the last byte of the message was transmitted. ++ The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access ++ the same clock from userspace use :c:func:`clock_gettime`. ++ * - __u64 ++ - ``rx_ts`` ++ - Timestamp in ns of when the last byte of the message was received. ++ The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access ++ the same clock from userspace use :c:func:`clock_gettime`. ++ * - __u32 ++ - ``len`` ++ - The length of the message. For :ref:`ioctl CEC_TRANSMIT ` this is filled in ++ by the application. The driver will fill this in for ++ :ref:`ioctl CEC_RECEIVE `. For :ref:`ioctl CEC_TRANSMIT ` it will be ++ filled in by the driver with the length of the reply message if ``reply`` was set. ++ * - __u32 ++ - ``timeout`` ++ - The timeout in milliseconds. This is the time the device will wait ++ for a message to be received before timing out. If it is set to 0, ++ then it will wait indefinitely when it is called by :ref:`ioctl CEC_RECEIVE `. ++ If it is 0 and it is called by :ref:`ioctl CEC_TRANSMIT `, ++ then it will be replaced by 1000 if the ``reply`` is non-zero or ++ ignored if ``reply`` is 0. ++ * - __u32 ++ - ``sequence`` ++ - A non-zero sequence number is automatically assigned by the CEC framework ++ for all transmitted messages. It is used by the CEC framework when it queues ++ the transmit result (when transmit was called in non-blocking mode). This ++ allows the application to associate the received message with the original ++ transmit. ++ * - __u32 ++ - ``flags`` ++ - Flags. See :ref:`cec-msg-flags` for a list of available flags. ++ * - __u8 ++ - ``tx_status`` ++ - The status bits of the transmitted message. See ++ :ref:`cec-tx-status` for the possible status values. It is 0 if ++ this message was received, not transmitted. ++ * - __u8 ++ - ``msg[16]`` ++ - The message payload. For :ref:`ioctl CEC_TRANSMIT ` this is filled in by the ++ application. The driver will fill this in for :ref:`ioctl CEC_RECEIVE `. ++ For :ref:`ioctl CEC_TRANSMIT ` it will be filled in by the driver with ++ the payload of the reply message if ``timeout`` was set. ++ * - __u8 ++ - ``reply`` ++ - Wait until this message is replied. If ``reply`` is 0 and the ++ ``timeout`` is 0, then don't wait for a reply but return after ++ transmitting the message. Ignored by :ref:`ioctl CEC_RECEIVE `. ++ The case where ``reply`` is 0 (this is the opcode for the Feature Abort ++ message) and ``timeout`` is non-zero is specifically allowed to make it ++ possible to send a message and wait up to ``timeout`` milliseconds for a ++ Feature Abort reply. In this case ``rx_status`` will either be set ++ to :ref:`CEC_RX_STATUS_TIMEOUT ` or ++ :ref:`CEC_RX_STATUS_FEATURE_ABORT `. ++ ++ If the transmitter message is ``CEC_MSG_INITIATE_ARC`` then the ``reply`` ++ values ``CEC_MSG_REPORT_ARC_INITIATED`` and ``CEC_MSG_REPORT_ARC_TERMINATED`` ++ are processed differently: either value will match both possible replies. ++ The reason is that the ``CEC_MSG_INITIATE_ARC`` message is the only CEC ++ message that has two possible replies other than Feature Abort. The ++ ``reply`` field will be updated with the actual reply so that it is ++ synchronized with the contents of the received message. ++ * - __u8 ++ - ``rx_status`` ++ - The status bits of the received message. See ++ :ref:`cec-rx-status` for the possible status values. It is 0 if ++ this message was transmitted, not received, unless this is the ++ reply to a transmitted message. In that case both ``rx_status`` ++ and ``tx_status`` are set. ++ * - __u8 ++ - ``tx_status`` ++ - The status bits of the transmitted message. See ++ :ref:`cec-tx-status` for the possible status values. It is 0 if ++ this message was received, not transmitted. ++ * - __u8 ++ - ``tx_arb_lost_cnt`` ++ - A counter of the number of transmit attempts that resulted in the ++ Arbitration Lost error. This is only set if the hardware supports ++ this, otherwise it is always 0. This counter is only valid if the ++ :ref:`CEC_TX_STATUS_ARB_LOST ` status bit is set. ++ * - __u8 ++ - ``tx_nack_cnt`` ++ - A counter of the number of transmit attempts that resulted in the ++ Not Acknowledged error. This is only set if the hardware supports ++ this, otherwise it is always 0. This counter is only valid if the ++ :ref:`CEC_TX_STATUS_NACK ` status bit is set. ++ * - __u8 ++ - ``tx_low_drive_cnt`` ++ - A counter of the number of transmit attempts that resulted in the ++ Arbitration Lost error. This is only set if the hardware supports ++ this, otherwise it is always 0. This counter is only valid if the ++ :ref:`CEC_TX_STATUS_LOW_DRIVE ` status bit is set. ++ * - __u8 ++ - ``tx_error_cnt`` ++ - A counter of the number of transmit errors other than Arbitration ++ Lost or Not Acknowledged. This is only set if the hardware ++ supports this, otherwise it is always 0. This counter is only ++ valid if the :ref:`CEC_TX_STATUS_ERROR ` status bit is set. ++ ++ ++.. tabularcolumns:: |p{6.2cm}|p{1.0cm}|p{10.3cm}| ++ ++.. _cec-msg-flags: ++ ++.. flat-table:: Flags for struct cec_msg ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 4 ++ ++ * .. _`CEC-MSG-FL-REPLY-TO-FOLLOWERS`: ++ ++ - ``CEC_MSG_FL_REPLY_TO_FOLLOWERS`` ++ - 1 ++ - If a CEC transmit expects a reply, then by default that reply is only sent to ++ the filehandle that called :ref:`ioctl CEC_TRANSMIT `. If this ++ flag is set, then the reply is also sent to all followers, if any. If the ++ filehandle that called :ref:`ioctl CEC_TRANSMIT ` is also a ++ follower, then that filehandle will receive the reply twice: once as the ++ result of the :ref:`ioctl CEC_TRANSMIT `, and once via ++ :ref:`ioctl CEC_RECEIVE `. ++ ++ ++.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| ++ ++.. _cec-tx-status: ++ ++.. flat-table:: CEC Transmit Status ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 16 ++ ++ * .. _`CEC-TX-STATUS-OK`: ++ ++ - ``CEC_TX_STATUS_OK`` ++ - 0x01 ++ - The message was transmitted successfully. This is mutually ++ exclusive with :ref:`CEC_TX_STATUS_MAX_RETRIES `. Other bits can still ++ be set if earlier attempts met with failure before the transmit ++ was eventually successful. ++ * .. _`CEC-TX-STATUS-ARB-LOST`: ++ ++ - ``CEC_TX_STATUS_ARB_LOST`` ++ - 0x02 ++ - CEC line arbitration was lost. ++ * .. _`CEC-TX-STATUS-NACK`: ++ ++ - ``CEC_TX_STATUS_NACK`` ++ - 0x04 ++ - Message was not acknowledged. ++ * .. _`CEC-TX-STATUS-LOW-DRIVE`: ++ ++ - ``CEC_TX_STATUS_LOW_DRIVE`` ++ - 0x08 ++ - Low drive was detected on the CEC bus. This indicates that a ++ follower detected an error on the bus and requests a ++ retransmission. ++ * .. _`CEC-TX-STATUS-ERROR`: ++ ++ - ``CEC_TX_STATUS_ERROR`` ++ - 0x10 ++ - Some error occurred. This is used for any errors that do not fit ++ ``CEC_TX_STATUS_ARB_LOST`` or ``CEC_TX_STATUS_LOW_DRIVE``, either because ++ the hardware could not tell which error occurred, or because the hardware ++ tested for other conditions besides those two. ++ * .. _`CEC-TX-STATUS-MAX-RETRIES`: ++ ++ - ``CEC_TX_STATUS_MAX_RETRIES`` ++ - 0x20 ++ - The transmit failed after one or more retries. This status bit is ++ mutually exclusive with :ref:`CEC_TX_STATUS_OK `. Other bits can still ++ be set to explain which failures were seen. ++ ++ ++.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| ++ ++.. _cec-rx-status: ++ ++.. flat-table:: CEC Receive Status ++ :header-rows: 0 ++ :stub-columns: 0 ++ :widths: 3 1 16 ++ ++ * .. _`CEC-RX-STATUS-OK`: ++ ++ - ``CEC_RX_STATUS_OK`` ++ - 0x01 ++ - The message was received successfully. ++ * .. _`CEC-RX-STATUS-TIMEOUT`: ++ ++ - ``CEC_RX_STATUS_TIMEOUT`` ++ - 0x02 ++ - The reply to an earlier transmitted message timed out. ++ * .. _`CEC-RX-STATUS-FEATURE-ABORT`: ++ ++ - ``CEC_RX_STATUS_FEATURE_ABORT`` ++ - 0x04 ++ - The message was received successfully but the reply was ++ ``CEC_MSG_FEATURE_ABORT``. This status is only set if this message ++ was the reply to an earlier transmitted message. ++ ++ ++ ++Return Value ++============ ++ ++On success 0 is returned, on error -1 and the ``errno`` variable is set ++appropriately. The generic error codes are described at the ++:ref:`Generic Error Codes ` chapter. ++ ++The :ref:`ioctl CEC_RECEIVE ` can return the following ++error codes: ++ ++EAGAIN ++ No messages are in the receive queue, and the filehandle is in non-blocking mode. ++ ++ETIMEDOUT ++ The ``timeout`` was reached while waiting for a message. ++ ++ERESTARTSYS ++ The wait for a message was interrupted (e.g. by Ctrl-C). ++ ++The :ref:`ioctl CEC_TRANSMIT ` can return the following ++error codes: ++ ++ENOTTY ++ The ``CEC_CAP_TRANSMIT`` capability wasn't set, so this ioctl is not supported. ++ ++EPERM ++ The CEC adapter is not configured, i.e. :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` ++ has never been called. ++ ++ENONET ++ The CEC adapter is not configured, i.e. :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` ++ was called, but the physical address is invalid so no logical address was claimed. ++ An exception is made in this case for transmits from initiator 0xf ('Unregistered') ++ to destination 0 ('TV'). In that case the transmit will proceed as usual. ++ ++EBUSY ++ Another filehandle is in exclusive follower or initiator mode, or the filehandle ++ is in mode ``CEC_MODE_NO_INITIATOR``. This is also returned if the transmit ++ queue is full. ++ ++EINVAL ++ The contents of struct :c:type:`cec_msg` is invalid. ++ ++ERESTARTSYS ++ The wait for a successful transmit was interrupted (e.g. by Ctrl-C). +diff --git a/MAINTAINERS b/MAINTAINERS +index 443bc975b562..225ab2c1d35b 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -2674,6 +2674,22 @@ F: drivers/net/ieee802154/cc2520.c + F: include/linux/spi/cc2520.h + F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt + ++CEC FRAMEWORK ++M: Hans Verkuil ++L: linux-media@vger.kernel.org ++T: git git://linuxtv.org/media_tree.git ++W: http://linuxtv.org ++S: Supported ++F: Documentation/media/kapi/cec-core.rst ++F: Documentation/media/uapi/cec ++F: drivers/media/cec/ ++F: drivers/media/rc/keymaps/rc-cec.c ++F: include/media/cec.h ++F: include/media/cec-notifier.h ++F: include/uapi/linux/cec.h ++F: include/uapi/linux/cec-funcs.h ++F: Documentation/devicetree/bindings/media/cec.txt ++ + CELL BROADBAND ENGINE ARCHITECTURE + M: Arnd Bergmann + L: linuxppc-dev@lists.ozlabs.org +diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c +index 8c75a51333b2..4f5d382268f7 100644 +--- a/drivers/media/cec/cec-adap.c ++++ b/drivers/media/cec/cec-adap.c +@@ -202,7 +202,10 @@ static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) + { + static const struct cec_event ev_lost_msgs = { + .event = CEC_EVENT_LOST_MSGS, +- .lost_msgs.lost_msgs = 1, ++ .flags = 0, ++ { ++ .lost_msgs = { 1 }, ++ }, + }; + struct cec_msg_entry *entry; + +@@ -1793,6 +1796,9 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, + int la_idx = cec_log_addr2idx(adap, dest_laddr); + bool from_unregistered = init_laddr == 0xf; + struct cec_msg tx_cec_msg = { }; ++#ifdef CONFIG_MEDIA_CEC_RC ++ int scancode; ++#endif + + dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg); + +@@ -1888,11 +1894,9 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, + */ + case 0x60: + if (msg->len == 2) +- rc_keydown(adap->rc, RC_TYPE_CEC, +- msg->msg[2], 0); ++ scancode = msg->msg[2]; + else +- rc_keydown(adap->rc, RC_TYPE_CEC, +- msg->msg[2] << 8 | msg->msg[3], 0); ++ scancode = msg->msg[2] << 8 | msg->msg[3]; + break; + /* + * Other function messages that are not handled. +@@ -1905,11 +1909,54 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, + */ + case 0x56: case 0x57: + case 0x67: case 0x68: case 0x69: case 0x6a: ++ scancode = -1; + break; + default: +- rc_keydown(adap->rc, RC_TYPE_CEC, msg->msg[2], 0); ++ scancode = msg->msg[2]; ++ break; ++ } ++ ++ /* Was repeating, but keypress timed out */ ++ if (adap->rc_repeating && !adap->rc->keypressed) { ++ adap->rc_repeating = false; ++ adap->rc_last_scancode = -1; ++ } ++ /* Different keypress from last time, ends repeat mode */ ++ if (adap->rc_last_scancode != scancode) { ++ rc_keyup(adap->rc); ++ adap->rc_repeating = false; ++ } ++ /* We can't handle this scancode */ ++ if (scancode < 0) { ++ adap->rc_last_scancode = scancode; ++ break; ++ } ++ ++ /* Send key press */ ++ rc_keydown(adap->rc, RC_TYPE_CEC, scancode, 0); ++ ++ /* When in repeating mode, we're done */ ++ if (adap->rc_repeating) ++ break; ++ ++ /* ++ * We are not repeating, but the new scancode is ++ * the same as the last one, and this second key press is ++ * within 550 ms (the 'Follower Safety Timeout') from the ++ * previous key press, so we now enable the repeating mode. ++ */ ++ if (adap->rc_last_scancode == scancode && ++ msg->rx_ts - adap->rc_last_keypress < 550 * NSEC_PER_MSEC) { ++ adap->rc_repeating = true; + break; + } ++ /* ++ * Not in repeating mode, so avoid triggering repeat mode ++ * by calling keyup. ++ */ ++ rc_keyup(adap->rc); ++ adap->rc_last_scancode = scancode; ++ adap->rc_last_keypress = msg->rx_ts; + #endif + break; + +@@ -1919,6 +1966,8 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, + break; + #ifdef CONFIG_MEDIA_CEC_RC + rc_keyup(adap->rc); ++ adap->rc_repeating = false; ++ adap->rc_last_scancode = -1; + #endif + break; + +diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c +index 969f770acf77..65d763be4385 100644 +--- a/drivers/media/cec/cec-core.c ++++ b/drivers/media/cec/cec-core.c +@@ -263,7 +263,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, + return adap; + + /* Prepare the RC input device */ +- adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE); ++ adap->rc = rc_allocate_device(); + if (!adap->rc) { + pr_err("cec-%s: failed to allocate memory for rc_dev\n", + name); +@@ -283,11 +283,13 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, + adap->rc->input_id.vendor = 0; + adap->rc->input_id.product = 0; + adap->rc->input_id.version = 1; ++ adap->rc->driver_type = RC_DRIVER_SCANCODE; + adap->rc->driver_name = CEC_NAME; + adap->rc->allowed_protocols = RC_BIT_CEC; + adap->rc->priv = adap; + adap->rc->map_name = RC_MAP_CEC; + adap->rc->timeout = MS_TO_NS(100); ++ adap->rc_last_scancode = -1; + #endif + return adap; + } +@@ -319,6 +321,17 @@ int cec_register_adapter(struct cec_adapter *adap, + adap->rc = NULL; + return res; + } ++ /* ++ * The REP_DELAY for CEC is really the time between the initial ++ * 'User Control Pressed' message and the second. The first ++ * keypress is always seen as non-repeating, the second ++ * (provided it has the same UI Command) will start the 'Press ++ * and Hold' (aka repeat) behavior. By setting REP_DELAY to the ++ * same value as REP_PERIOD the expected CEC behavior is ++ * reproduced. ++ */ ++ adap->rc->input_dev->rep[REP_DELAY] = ++ adap->rc->input_dev->rep[REP_PERIOD]; + } + #endif + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index fbbd3bbcd252..9cffcc61fdca 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-behold.o \ + rc-behold-columbus.o \ + rc-budget-ci-old.o \ ++ rc-cec.o \ + rc-cinergy-1400.o \ + rc-cinergy.o \ + rc-delock-61959.o \ +diff --git a/drivers/media/rc/keymaps/rc-cec.c b/drivers/media/rc/keymaps/rc-cec.c +new file mode 100644 +index 000000000000..354c8e724b8e +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-cec.c +@@ -0,0 +1,182 @@ ++/* Keytable for the CEC remote control ++ * ++ * Copyright (c) 2015 by Kamil Debski ++ * ++ * 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 ++ ++/* ++ * CEC Spec "High-Definition Multimedia Interface Specification" can be obtained ++ * here: http://xtreamerdev.googlecode.com/files/CEC_Specs.pdf ++ * The list of control codes is listed in Table 27: User Control Codes p. 95 ++ */ ++ ++static struct rc_map_table cec[] = { ++ { 0x00, KEY_OK }, ++ { 0x01, KEY_UP }, ++ { 0x02, KEY_DOWN }, ++ { 0x03, KEY_LEFT }, ++ { 0x04, KEY_RIGHT }, ++ { 0x05, KEY_RIGHT_UP }, ++ { 0x06, KEY_RIGHT_DOWN }, ++ { 0x07, KEY_LEFT_UP }, ++ { 0x08, KEY_LEFT_DOWN }, ++ { 0x09, KEY_ROOT_MENU }, /* CEC Spec: Device Root Menu - see Note 2 */ ++ /* ++ * Note 2: This is the initial display that a device shows. It is ++ * device-dependent and can be, for example, a contents menu, setup ++ * menu, favorite menu or other menu. The actual menu displayed ++ * may also depend on the device's current state. ++ */ ++ { 0x0a, KEY_SETUP }, ++ { 0x0b, KEY_MENU }, /* CEC Spec: Contents Menu */ ++ { 0x0c, KEY_FAVORITES }, /* CEC Spec: Favorite Menu */ ++ { 0x0d, KEY_EXIT }, ++ /* 0x0e-0x0f: Reserved */ ++ { 0x10, KEY_MEDIA_TOP_MENU }, ++ { 0x11, KEY_CONTEXT_MENU }, ++ /* 0x12-0x1c: Reserved */ ++ { 0x1d, KEY_DIGITS }, /* CEC Spec: select/toggle a Number Entry Mode */ ++ { 0x1e, KEY_NUMERIC_11 }, ++ { 0x1f, KEY_NUMERIC_12 }, ++ /* 0x20-0x29: Keys 0 to 9 */ ++ { 0x20, KEY_NUMERIC_0 }, ++ { 0x21, KEY_NUMERIC_1 }, ++ { 0x22, KEY_NUMERIC_2 }, ++ { 0x23, KEY_NUMERIC_3 }, ++ { 0x24, KEY_NUMERIC_4 }, ++ { 0x25, KEY_NUMERIC_5 }, ++ { 0x26, KEY_NUMERIC_6 }, ++ { 0x27, KEY_NUMERIC_7 }, ++ { 0x28, KEY_NUMERIC_8 }, ++ { 0x29, KEY_NUMERIC_9 }, ++ { 0x2a, KEY_DOT }, ++ { 0x2b, KEY_ENTER }, ++ { 0x2c, KEY_CLEAR }, ++ /* 0x2d-0x2e: Reserved */ ++ { 0x2f, KEY_NEXT_FAVORITE }, /* CEC Spec: Next Favorite */ ++ { 0x30, KEY_CHANNELUP }, ++ { 0x31, KEY_CHANNELDOWN }, ++ { 0x32, KEY_PREVIOUS }, /* CEC Spec: Previous Channel */ ++ { 0x33, KEY_SOUND }, /* CEC Spec: Sound Select */ ++ { 0x34, KEY_VIDEO }, /* 0x34: CEC Spec: Input Select */ ++ { 0x35, KEY_INFO }, /* CEC Spec: Display Information */ ++ { 0x36, KEY_HELP }, ++ { 0x37, KEY_PAGEUP }, ++ { 0x38, KEY_PAGEDOWN }, ++ /* 0x39-0x3f: Reserved */ ++ { 0x40, KEY_POWER }, ++ { 0x41, KEY_VOLUMEUP }, ++ { 0x42, KEY_VOLUMEDOWN }, ++ { 0x43, KEY_MUTE }, ++ { 0x44, KEY_PLAYCD }, ++ { 0x45, KEY_STOPCD }, ++ { 0x46, KEY_PAUSECD }, ++ { 0x47, KEY_RECORD }, ++ { 0x48, KEY_REWIND }, ++ { 0x49, KEY_FASTFORWARD }, ++ { 0x4a, KEY_EJECTCD }, /* CEC Spec: Eject */ ++ { 0x4b, KEY_FORWARD }, ++ { 0x4c, KEY_BACK }, ++ { 0x4d, KEY_STOP_RECORD }, /* CEC Spec: Stop-Record */ ++ { 0x4e, KEY_PAUSE_RECORD }, /* CEC Spec: Pause-Record */ ++ /* 0x4f: Reserved */ ++ { 0x50, KEY_ANGLE }, ++ { 0x51, KEY_TV2 }, ++ { 0x52, KEY_VOD }, /* CEC Spec: Video on Demand */ ++ { 0x53, KEY_EPG }, ++ { 0x54, KEY_TIME }, /* CEC Spec: Timer */ ++ { 0x55, KEY_CONFIG }, ++ /* ++ * The following codes are hard to implement at this moment, as they ++ * carry an additional additional argument. Most likely changes to RC ++ * framework are necessary. ++ * For now they are interpreted by the CEC framework as non keycodes ++ * and are passed as messages enabling user application to parse them. ++ */ ++ /* 0x56: CEC Spec: Select Broadcast Type */ ++ /* 0x57: CEC Spec: Select Sound presentation */ ++ { 0x58, KEY_AUDIO_DESC }, /* CEC 2.0 and up */ ++ { 0x59, KEY_WWW }, /* CEC 2.0 and up */ ++ { 0x5a, KEY_3D_MODE }, /* CEC 2.0 and up */ ++ /* 0x5b-0x5f: Reserved */ ++ { 0x60, KEY_PLAYCD }, /* CEC Spec: Play Function */ ++ { 0x6005, KEY_FASTFORWARD }, ++ { 0x6006, KEY_FASTFORWARD }, ++ { 0x6007, KEY_FASTFORWARD }, ++ { 0x6015, KEY_SLOW }, ++ { 0x6016, KEY_SLOW }, ++ { 0x6017, KEY_SLOW }, ++ { 0x6009, KEY_FASTREVERSE }, ++ { 0x600a, KEY_FASTREVERSE }, ++ { 0x600b, KEY_FASTREVERSE }, ++ { 0x6019, KEY_SLOWREVERSE }, ++ { 0x601a, KEY_SLOWREVERSE }, ++ { 0x601b, KEY_SLOWREVERSE }, ++ { 0x6020, KEY_REWIND }, ++ { 0x6024, KEY_PLAYCD }, ++ { 0x6025, KEY_PAUSECD }, ++ { 0x61, KEY_PLAYPAUSE }, /* CEC Spec: Pause-Play Function */ ++ { 0x62, KEY_RECORD }, /* Spec: Record Function */ ++ { 0x63, KEY_PAUSE_RECORD }, /* CEC Spec: Pause-Record Function */ ++ { 0x64, KEY_STOPCD }, /* CEC Spec: Stop Function */ ++ { 0x65, KEY_MUTE }, /* CEC Spec: Mute Function */ ++ { 0x66, KEY_UNMUTE }, /* CEC Spec: Restore the volume */ ++ /* ++ * The following codes are hard to implement at this moment, as they ++ * carry an additional additional argument. Most likely changes to RC ++ * framework are necessary. ++ * For now they are interpreted by the CEC framework as non keycodes ++ * and are passed as messages enabling user application to parse them. ++ */ ++ /* 0x67: CEC Spec: Tune Function */ ++ /* 0x68: CEC Spec: Seleect Media Function */ ++ /* 0x69: CEC Spec: Select A/V Input Function */ ++ /* 0x6a: CEC Spec: Select Audio Input Function */ ++ { 0x6b, KEY_POWER }, /* CEC Spec: Power Toggle Function */ ++ { 0x6c, KEY_SLEEP }, /* CEC Spec: Power Off Function */ ++ { 0x6d, KEY_WAKEUP }, /* CEC Spec: Power On Function */ ++ /* 0x6e-0x70: Reserved */ ++ { 0x71, KEY_BLUE }, /* CEC Spec: F1 (Blue) */ ++ { 0x72, KEY_RED }, /* CEC Spec: F2 (Red) */ ++ { 0x73, KEY_GREEN }, /* CEC Spec: F3 (Green) */ ++ { 0x74, KEY_YELLOW }, /* CEC Spec: F4 (Yellow) */ ++ { 0x75, KEY_F5 }, ++ { 0x76, KEY_DATA }, /* CEC Spec: Data - see Note 3 */ ++ /* ++ * Note 3: This is used, for example, to enter or leave a digital TV ++ * data broadcast application. ++ */ ++ /* 0x77-0xff: Reserved */ ++}; ++ ++static struct rc_map_list cec_map = { ++ .map = { ++ .scan = cec, ++ .size = ARRAY_SIZE(cec), ++ .rc_type = RC_TYPE_CEC, ++ .name = RC_MAP_CEC, ++ } ++}; ++ ++static int __init init_rc_map_cec(void) ++{ ++ return rc_map_register(&cec_map); ++} ++ ++static void __exit exit_rc_map_cec(void) ++{ ++ rc_map_unregister(&cec_map); ++} ++ ++module_init(init_rc_map_cec); ++module_exit(exit_rc_map_cec); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Kamil Debski"); +diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c +index 3f0f71adabb4..a639ea653c7e 100644 +--- a/drivers/media/rc/rc-main.c ++++ b/drivers/media/rc/rc-main.c +@@ -801,6 +801,7 @@ static struct { + { RC_BIT_SHARP, "sharp" }, + { RC_BIT_MCE_KBD, "mce_kbd" }, + { RC_BIT_XMP, "xmp" }, ++ { RC_BIT_CEC, "cec" }, + }; + + /** +diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c +index a52ca5cba015..b0b96fc01da3 100644 +--- a/fs/compat_ioctl.c ++++ b/fs/compat_ioctl.c +@@ -57,6 +57,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -1381,6 +1382,17 @@ COMPATIBLE_IOCTL(VIDEO_GET_NAVI) + COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES) + COMPATIBLE_IOCTL(VIDEO_GET_SIZE) + COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE) ++/* cec */ ++COMPATIBLE_IOCTL(CEC_ADAP_G_CAPS) ++COMPATIBLE_IOCTL(CEC_ADAP_G_LOG_ADDRS) ++COMPATIBLE_IOCTL(CEC_ADAP_S_LOG_ADDRS) ++COMPATIBLE_IOCTL(CEC_ADAP_G_PHYS_ADDR) ++COMPATIBLE_IOCTL(CEC_ADAP_S_PHYS_ADDR) ++COMPATIBLE_IOCTL(CEC_G_MODE) ++COMPATIBLE_IOCTL(CEC_S_MODE) ++COMPATIBLE_IOCTL(CEC_TRANSMIT) ++COMPATIBLE_IOCTL(CEC_RECEIVE) ++COMPATIBLE_IOCTL(CEC_DQEVENT) + + /* joystick */ + COMPATIBLE_IOCTL(JSIOCGVERSION) +diff --git a/include/media/cec-notifier.h b/include/media/cec-notifier.h +index ca19a9305782..8bb169ac7afd 100644 +--- a/include/media/cec-notifier.h ++++ b/include/media/cec-notifier.h +@@ -91,6 +91,14 @@ void cec_notifier_register(struct cec_notifier *n, + */ + void cec_notifier_unregister(struct cec_notifier *n); + ++/** ++ * cec_register_cec_notifier - register the notifier with the cec adapter. ++ * @adap: the CEC adapter ++ * @notifier: the CEC notifier ++ */ ++void cec_register_cec_notifier(struct cec_adapter *adap, ++ struct cec_notifier *notifier); ++ + #else + static inline struct cec_notifier *cec_notifier_get(struct device *dev) + { +@@ -111,6 +119,20 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, + { + } + ++static inline void cec_notifier_register(struct cec_notifier *n, ++ struct cec_adapter *adap, ++ void (*callback)(struct cec_adapter *adap, u16 pa)) ++{ ++} ++ ++static inline void cec_notifier_unregister(struct cec_notifier *n) ++{ ++} ++ ++static inline void cec_register_cec_notifier(struct cec_adapter *adap, ++ struct cec_notifier *notifier) ++{ ++} + #endif + + /** +diff --git a/include/media/cec.h b/include/media/cec.h +index df3c94f05aa5..f64807a78064 100644 +--- a/include/media/cec.h ++++ b/include/media/cec.h +@@ -31,6 +31,9 @@ + #include + #include + ++#define CEC_CAP_DEFAULTS (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | \ ++ CEC_CAP_PASSTHROUGH | CEC_CAP_RC) ++ + /** + * struct cec_devnode - cec device node + * @dev: cec device +@@ -188,6 +191,11 @@ struct cec_adapter { + + u32 tx_timeouts; + ++#ifdef CONFIG_MEDIA_CEC_RC ++ bool rc_repeating; ++ int rc_last_scancode; ++ u64 rc_last_keypress; ++#endif + #ifdef CONFIG_CEC_NOTIFIER + struct cec_notifier *notifier; + #endif +@@ -226,7 +234,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap) + + struct edid; + +-#if IS_ENABLED(CONFIG_CEC_CORE) ++#if IS_REACHABLE(CONFIG_CEC_CORE) + struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, + void *priv, const char *name, u32 caps, u8 available_las); + int cec_register_adapter(struct cec_adapter *adap, struct device *parent); +@@ -373,11 +381,6 @@ u16 cec_phys_addr_for_input(u16 phys_addr, u8 input); + */ + int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port); + +-#ifdef CONFIG_CEC_NOTIFIER +-void cec_register_cec_notifier(struct cec_adapter *adap, +- struct cec_notifier *notifier); +-#endif +- + #else + + static inline int cec_register_adapter(struct cec_adapter *adap, +@@ -424,9 +427,26 @@ static inline u16 cec_phys_addr_for_input(u16 phys_addr, u8 input) + + static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port) + { ++ if (parent) ++ *parent = phys_addr; ++ if (port) ++ *port = 0; + return 0; + } + + #endif + ++/** ++ * cec_phys_addr_invalidate() - set the physical address to INVALID ++ * ++ * @adap: the CEC adapter ++ * ++ * This is a simple helper function to invalidate the physical ++ * address. ++ */ ++static inline void cec_phys_addr_invalidate(struct cec_adapter *adap) ++{ ++ cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false); ++} ++ + #endif /* _MEDIA_CEC_H */ +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 7c4bbc4dfab4..d9f87d5b4468 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -31,6 +31,7 @@ enum rc_type { + RC_TYPE_RC6_MCE = 16, /* MCE (Philips RC6-6A-32 subtype) protocol */ + RC_TYPE_SHARP = 17, /* Sharp protocol */ + RC_TYPE_XMP = 18, /* XMP protocol */ ++ RC_TYPE_CEC = 19, /* CEC protocol */ + }; + + #define RC_BIT_NONE 0 +@@ -53,6 +54,7 @@ enum rc_type { + #define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE) + #define RC_BIT_SHARP (1 << RC_TYPE_SHARP) + #define RC_BIT_XMP (1 << RC_TYPE_XMP) ++#define RC_BIT_CEC (1 << RC_TYPE_CEC) + + #define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | \ + RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ +@@ -61,7 +63,7 @@ enum rc_type { + RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \ + RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ + RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ +- RC_BIT_XMP) ++ RC_BIT_XMP | RC_BIT_CEC) + + + #define RC_SCANCODE_UNKNOWN(x) (x) +@@ -123,6 +125,7 @@ void rc_map_init(void); + #define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus" + #define RC_MAP_BEHOLD "rc-behold" + #define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" ++#define RC_MAP_CEC "rc-cec" + #define RC_MAP_CINERGY_1400 "rc-cinergy-1400" + #define RC_MAP_CINERGY "rc-cinergy" + #define RC_MAP_DELOCK_61959 "rc-delock-61959" +diff --git a/include/uapi/linux/cec-funcs.h b/include/uapi/linux/cec-funcs.h +index c451eec42a83..270b251a3d9b 100644 +--- a/include/uapi/linux/cec-funcs.h ++++ b/include/uapi/linux/cec-funcs.h +@@ -895,6 +895,7 @@ static inline void cec_ops_report_features(const struct cec_msg *msg, + *cec_version = msg->msg[2]; + *all_device_types = msg->msg[3]; + *rc_profile = p; ++ *dev_features = NULL; + while (p < &msg->msg[14] && (*p & CEC_OP_FEAT_EXT)) + p++; + if (!(*p & CEC_OP_FEAT_EXT)) { +diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h +index af6682f5ea85..b9f8df3a0477 100644 +--- a/include/uapi/linux/cec.h ++++ b/include/uapi/linux/cec.h +@@ -223,7 +223,7 @@ static inline int cec_msg_status_is_ok(const struct cec_msg *msg) + #define CEC_LOG_ADDR_BACKUP_2 13 + #define CEC_LOG_ADDR_SPECIFIC 14 + #define CEC_LOG_ADDR_UNREGISTERED 15 /* as initiator address */ +-#define CEC_LOG_ADDR_BROADCAST 15 /* ad destination address */ ++#define CEC_LOG_ADDR_BROADCAST 15 /* as destination address */ + + /* The logical address types that the CEC device wants to claim */ + #define CEC_LOG_ADDR_TYPE_TV 0 +diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h +index 87cf351bab03..b0c5c4888a4b 100644 +--- a/include/uapi/linux/input-event-codes.h ++++ b/include/uapi/linux/input-event-codes.h +@@ -611,6 +611,37 @@ + #define KEY_KBDINPUTASSIST_ACCEPT 0x264 + #define KEY_KBDINPUTASSIST_CANCEL 0x265 + ++/* Diagonal movement keys */ ++#define KEY_RIGHT_UP 0x266 ++#define KEY_RIGHT_DOWN 0x267 ++#define KEY_LEFT_UP 0x268 ++#define KEY_LEFT_DOWN 0x269 ++ ++#define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */ ++/* Show Top Menu of the Media (e.g. DVD) */ ++#define KEY_MEDIA_TOP_MENU 0x26b ++#define KEY_NUMERIC_11 0x26c ++#define KEY_NUMERIC_12 0x26d ++/* ++ * Toggle Audio Description: refers to an audio service that helps blind and ++ * visually impaired consumers understand the action in a program. Note: in ++ * some countries this is referred to as "Video Description". ++ */ ++#define KEY_AUDIO_DESC 0x26e ++#define KEY_3D_MODE 0x26f ++#define KEY_NEXT_FAVORITE 0x270 ++#define KEY_STOP_RECORD 0x271 ++#define KEY_PAUSE_RECORD 0x272 ++#define KEY_VOD 0x273 /* Video on Demand */ ++#define KEY_UNMUTE 0x274 ++#define KEY_FASTREVERSE 0x275 ++#define KEY_SLOWREVERSE 0x276 ++/* ++ * Control a data application associated with the currently viewed channel, ++ * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) ++ */ ++#define KEY_DATA 0x277 ++ + #define BTN_TRIGGER_HAPPY 0x2c0 + #define BTN_TRIGGER_HAPPY1 0x2c0 + #define BTN_TRIGGER_HAPPY2 0x2c1 +diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h +index 2758687300b4..41e8dff588e1 100644 +--- a/include/uapi/linux/input.h ++++ b/include/uapi/linux/input.h +@@ -246,6 +246,7 @@ struct input_mask { + #define BUS_GSC 0x1A + #define BUS_ATARI 0x1B + #define BUS_SPI 0x1C ++#define BUS_CEC 0x1E + + /* + * MT_TOOL types + +From 8e3b262321c2121f8ceed952be3619039aebea9d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 4 Sep 2017 22:34:22 +0200 +Subject: [PATCH] BACKPORT: Pulse Eight HDMI CEC from v4.15 + +--- + MAINTAINERS | 7 + + drivers/input/serio/serport.c | 17 +- + drivers/media/usb/Kconfig | 5 + + drivers/media/usb/Makefile | 1 + + drivers/media/usb/pulse8-cec/Kconfig | 11 + + drivers/media/usb/pulse8-cec/Makefile | 1 + + drivers/media/usb/pulse8-cec/pulse8-cec.c | 757 ++++++++++++++++++++++++++++++ + include/uapi/linux/serio.h | 1 + + 8 files changed, 797 insertions(+), 3 deletions(-) + create mode 100644 drivers/media/usb/pulse8-cec/Kconfig + create mode 100644 drivers/media/usb/pulse8-cec/Makefile + create mode 100644 drivers/media/usb/pulse8-cec/pulse8-cec.c + +diff --git a/MAINTAINERS b/MAINTAINERS +index 225ab2c1d35b..0c1232c326a5 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -8673,6 +8673,13 @@ F: include/linux/tracehook.h + F: include/uapi/linux/ptrace.h + F: kernel/ptrace.c + ++PULSE8-CEC DRIVER ++M: Hans Verkuil ++L: linux-media@vger.kernel.org ++T: git git://linuxtv.org/media_tree.git ++S: Maintained ++F: drivers/media/usb/pulse8-cec/* ++ + PVRUSB2 VIDEO4LINUX DRIVER + M: Mike Isely + L: pvrusb2@isely.net (subscribers-only) +diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c +index 9c927d35c1f5..d189843f3727 100644 +--- a/drivers/input/serio/serport.c ++++ b/drivers/input/serio/serport.c +@@ -71,10 +71,7 @@ static void serport_serio_close(struct serio *serio) + + spin_lock_irqsave(&serport->lock, flags); + clear_bit(SERPORT_ACTIVE, &serport->flags); +- set_bit(SERPORT_DEAD, &serport->flags); + spin_unlock_irqrestore(&serport->lock, flags); +- +- wake_up_interruptible(&serport->wait); + } + + /* +@@ -248,6 +245,19 @@ static long serport_ldisc_compat_ioctl(struct tty_struct *tty, + } + #endif + ++static int serport_ldisc_hangup(struct tty_struct *tty) ++{ ++ struct serport *serport = (struct serport *) tty->disc_data; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&serport->lock, flags); ++ set_bit(SERPORT_DEAD, &serport->flags); ++ spin_unlock_irqrestore(&serport->lock, flags); ++ ++ wake_up_interruptible(&serport->wait); ++ return 0; ++} ++ + static void serport_ldisc_write_wakeup(struct tty_struct * tty) + { + struct serport *serport = (struct serport *) tty->disc_data; +@@ -274,6 +284,7 @@ static struct tty_ldisc_ops serport_ldisc = { + .compat_ioctl = serport_ldisc_compat_ioctl, + #endif + .receive_buf = serport_ldisc_receive, ++ .hangup = serport_ldisc_hangup, + .write_wakeup = serport_ldisc_write_wakeup + }; + +diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig +index 7496f332f3f5..c9644b62f91a 100644 +--- a/drivers/media/usb/Kconfig ++++ b/drivers/media/usb/Kconfig +@@ -60,5 +60,10 @@ source "drivers/media/usb/hackrf/Kconfig" + source "drivers/media/usb/msi2500/Kconfig" + endif + ++if MEDIA_CEC_SUPPORT ++ comment "USB HDMI CEC adapters" ++source "drivers/media/usb/pulse8-cec/Kconfig" ++endif ++ + endif #MEDIA_USB_SUPPORT + endif #USB +diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile +index 8874ba774a34..0f15e3351ddc 100644 +--- a/drivers/media/usb/Makefile ++++ b/drivers/media/usb/Makefile +@@ -24,3 +24,4 @@ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ + obj-$(CONFIG_VIDEO_USBTV) += usbtv/ + obj-$(CONFIG_VIDEO_GO7007) += go7007/ + obj-$(CONFIG_DVB_AS102) += as102/ ++obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/ +diff --git a/drivers/media/usb/pulse8-cec/Kconfig b/drivers/media/usb/pulse8-cec/Kconfig +new file mode 100644 +index 000000000000..18ead44824ba +--- /dev/null ++++ b/drivers/media/usb/pulse8-cec/Kconfig +@@ -0,0 +1,11 @@ ++config USB_PULSE8_CEC ++ tristate "Pulse Eight HDMI CEC" ++ depends on USB_ACM ++ select CEC_CORE ++ select SERIO ++ select SERIO_SERPORT ++ ---help--- ++ This is a cec driver for the Pulse Eight HDMI CEC device. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called pulse8-cec. +diff --git a/drivers/media/usb/pulse8-cec/Makefile b/drivers/media/usb/pulse8-cec/Makefile +new file mode 100644 +index 000000000000..9800690bc25a +--- /dev/null ++++ b/drivers/media/usb/pulse8-cec/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec.o +diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c +new file mode 100644 +index 000000000000..50146f263d90 +--- /dev/null ++++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c +@@ -0,0 +1,757 @@ ++/* ++ * Pulse Eight HDMI CEC driver ++ * ++ * Copyright 2016 Hans Verkuil ["Power On"], ["Power] or ["Power Toggle"], or if it ++ * receives with its own physical address. It also does this ++ * if it receives [0x03 0x00] from an LG TV. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++MODULE_AUTHOR("Hans Verkuil "); ++MODULE_DESCRIPTION("Pulse Eight HDMI CEC driver"); ++MODULE_LICENSE("GPL"); ++ ++static int debug; ++static int persistent_config; ++module_param(debug, int, 0644); ++module_param(persistent_config, int, 0644); ++MODULE_PARM_DESC(debug, "debug level (0-1)"); ++MODULE_PARM_DESC(persistent_config, "read config from persistent memory (0-1)"); ++ ++enum pulse8_msgcodes { ++ MSGCODE_NOTHING = 0, ++ MSGCODE_PING, ++ MSGCODE_TIMEOUT_ERROR, ++ MSGCODE_HIGH_ERROR, ++ MSGCODE_LOW_ERROR, ++ MSGCODE_FRAME_START, ++ MSGCODE_FRAME_DATA, ++ MSGCODE_RECEIVE_FAILED, ++ MSGCODE_COMMAND_ACCEPTED, /* 0x08 */ ++ MSGCODE_COMMAND_REJECTED, ++ MSGCODE_SET_ACK_MASK, ++ MSGCODE_TRANSMIT, ++ MSGCODE_TRANSMIT_EOM, ++ MSGCODE_TRANSMIT_IDLETIME, ++ MSGCODE_TRANSMIT_ACK_POLARITY, ++ MSGCODE_TRANSMIT_LINE_TIMEOUT, ++ MSGCODE_TRANSMIT_SUCCEEDED, /* 0x10 */ ++ MSGCODE_TRANSMIT_FAILED_LINE, ++ MSGCODE_TRANSMIT_FAILED_ACK, ++ MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA, ++ MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE, ++ MSGCODE_FIRMWARE_VERSION, ++ MSGCODE_START_BOOTLOADER, ++ MSGCODE_GET_BUILDDATE, ++ MSGCODE_SET_CONTROLLED, /* 0x18 */ ++ MSGCODE_GET_AUTO_ENABLED, ++ MSGCODE_SET_AUTO_ENABLED, ++ MSGCODE_GET_DEFAULT_LOGICAL_ADDRESS, ++ MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS, ++ MSGCODE_GET_LOGICAL_ADDRESS_MASK, ++ MSGCODE_SET_LOGICAL_ADDRESS_MASK, ++ MSGCODE_GET_PHYSICAL_ADDRESS, ++ MSGCODE_SET_PHYSICAL_ADDRESS, /* 0x20 */ ++ MSGCODE_GET_DEVICE_TYPE, ++ MSGCODE_SET_DEVICE_TYPE, ++ MSGCODE_GET_HDMI_VERSION, ++ MSGCODE_SET_HDMI_VERSION, ++ MSGCODE_GET_OSD_NAME, ++ MSGCODE_SET_OSD_NAME, ++ MSGCODE_WRITE_EEPROM, ++ MSGCODE_GET_ADAPTER_TYPE, /* 0x28 */ ++ MSGCODE_SET_ACTIVE_SOURCE, ++ ++ MSGCODE_FRAME_EOM = 0x80, ++ MSGCODE_FRAME_ACK = 0x40, ++}; ++ ++#define MSGSTART 0xff ++#define MSGEND 0xfe ++#define MSGESC 0xfd ++#define MSGOFFSET 3 ++ ++#define DATA_SIZE 256 ++ ++#define PING_PERIOD (15 * HZ) ++ ++struct pulse8 { ++ struct device *dev; ++ struct serio *serio; ++ struct cec_adapter *adap; ++ unsigned int vers; ++ struct completion cmd_done; ++ struct work_struct work; ++ struct delayed_work ping_eeprom_work; ++ struct cec_msg rx_msg; ++ u8 data[DATA_SIZE]; ++ unsigned int len; ++ u8 buf[DATA_SIZE]; ++ unsigned int idx; ++ bool escape; ++ bool started; ++ struct mutex config_lock; ++ struct mutex write_lock; ++ bool config_pending; ++ bool restoring_config; ++ bool autonomous; ++}; ++ ++static void pulse8_ping_eeprom_work_handler(struct work_struct *work); ++ ++static void pulse8_irq_work_handler(struct work_struct *work) ++{ ++ struct pulse8 *pulse8 = ++ container_of(work, struct pulse8, work); ++ ++ switch (pulse8->data[0] & 0x3f) { ++ case MSGCODE_FRAME_DATA: ++ cec_received_msg(pulse8->adap, &pulse8->rx_msg); ++ break; ++ case MSGCODE_TRANSMIT_SUCCEEDED: ++ cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_OK); ++ break; ++ case MSGCODE_TRANSMIT_FAILED_ACK: ++ cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_NACK); ++ break; ++ case MSGCODE_TRANSMIT_FAILED_LINE: ++ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: ++ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: ++ cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_ERROR); ++ break; ++ } ++} ++ ++static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, ++ unsigned int flags) ++{ ++ struct pulse8 *pulse8 = serio_get_drvdata(serio); ++ ++ if (!pulse8->started && data != MSGSTART) ++ return IRQ_HANDLED; ++ if (data == MSGESC) { ++ pulse8->escape = true; ++ return IRQ_HANDLED; ++ } ++ if (pulse8->escape) { ++ data += MSGOFFSET; ++ pulse8->escape = false; ++ } else if (data == MSGEND) { ++ struct cec_msg *msg = &pulse8->rx_msg; ++ ++ if (debug) ++ dev_info(pulse8->dev, "received: %*ph\n", ++ pulse8->idx, pulse8->buf); ++ pulse8->data[0] = pulse8->buf[0]; ++ switch (pulse8->buf[0] & 0x3f) { ++ case MSGCODE_FRAME_START: ++ msg->len = 1; ++ msg->msg[0] = pulse8->buf[1]; ++ break; ++ case MSGCODE_FRAME_DATA: ++ if (msg->len == CEC_MAX_MSG_SIZE) ++ break; ++ msg->msg[msg->len++] = pulse8->buf[1]; ++ if (pulse8->buf[0] & MSGCODE_FRAME_EOM) ++ schedule_work(&pulse8->work); ++ break; ++ case MSGCODE_TRANSMIT_SUCCEEDED: ++ case MSGCODE_TRANSMIT_FAILED_LINE: ++ case MSGCODE_TRANSMIT_FAILED_ACK: ++ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: ++ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: ++ schedule_work(&pulse8->work); ++ break; ++ case MSGCODE_HIGH_ERROR: ++ case MSGCODE_LOW_ERROR: ++ case MSGCODE_RECEIVE_FAILED: ++ case MSGCODE_TIMEOUT_ERROR: ++ break; ++ case MSGCODE_COMMAND_ACCEPTED: ++ case MSGCODE_COMMAND_REJECTED: ++ default: ++ if (pulse8->idx == 0) ++ break; ++ memcpy(pulse8->data, pulse8->buf, pulse8->idx); ++ pulse8->len = pulse8->idx; ++ complete(&pulse8->cmd_done); ++ break; ++ } ++ pulse8->idx = 0; ++ pulse8->started = false; ++ return IRQ_HANDLED; ++ } else if (data == MSGSTART) { ++ pulse8->idx = 0; ++ pulse8->started = true; ++ return IRQ_HANDLED; ++ } ++ ++ if (pulse8->idx >= DATA_SIZE) { ++ dev_dbg(pulse8->dev, ++ "throwing away %d bytes of garbage\n", pulse8->idx); ++ pulse8->idx = 0; ++ } ++ pulse8->buf[pulse8->idx++] = data; ++ return IRQ_HANDLED; ++} ++ ++static void pulse8_disconnect(struct serio *serio) ++{ ++ struct pulse8 *pulse8 = serio_get_drvdata(serio); ++ ++ cec_unregister_adapter(pulse8->adap); ++ cancel_delayed_work_sync(&pulse8->ping_eeprom_work); ++ dev_info(&serio->dev, "disconnected\n"); ++ serio_close(serio); ++ serio_set_drvdata(serio, NULL); ++ kfree(pulse8); ++} ++ ++static int pulse8_send(struct serio *serio, const u8 *command, u8 cmd_len) ++{ ++ int err = 0; ++ ++ err = serio_write(serio, MSGSTART); ++ if (err) ++ return err; ++ for (; !err && cmd_len; command++, cmd_len--) { ++ if (*command >= MSGESC) { ++ err = serio_write(serio, MSGESC); ++ if (!err) ++ err = serio_write(serio, *command - MSGOFFSET); ++ } else { ++ err = serio_write(serio, *command); ++ } ++ } ++ if (!err) ++ err = serio_write(serio, MSGEND); ++ ++ return err; ++} ++ ++static int pulse8_send_and_wait_once(struct pulse8 *pulse8, ++ const u8 *cmd, u8 cmd_len, ++ u8 response, u8 size) ++{ ++ int err; ++ ++ /*dev_info(pulse8->dev, "transmit: %*ph\n", cmd_len, cmd);*/ ++ init_completion(&pulse8->cmd_done); ++ ++ err = pulse8_send(pulse8->serio, cmd, cmd_len); ++ if (err) ++ return err; ++ ++ if (!wait_for_completion_timeout(&pulse8->cmd_done, HZ)) ++ return -ETIMEDOUT; ++ if ((pulse8->data[0] & 0x3f) == MSGCODE_COMMAND_REJECTED && ++ cmd[0] != MSGCODE_SET_CONTROLLED && ++ cmd[0] != MSGCODE_SET_AUTO_ENABLED && ++ cmd[0] != MSGCODE_GET_BUILDDATE) ++ return -ENOTTY; ++ if (response && ++ ((pulse8->data[0] & 0x3f) != response || pulse8->len < size + 1)) { ++ dev_info(pulse8->dev, "transmit: failed %02x\n", ++ pulse8->data[0] & 0x3f); ++ return -EIO; ++ } ++ return 0; ++} ++ ++static int pulse8_send_and_wait(struct pulse8 *pulse8, ++ const u8 *cmd, u8 cmd_len, u8 response, u8 size) ++{ ++ u8 cmd_sc[2]; ++ int err; ++ ++ mutex_lock(&pulse8->write_lock); ++ err = pulse8_send_and_wait_once(pulse8, cmd, cmd_len, response, size); ++ ++ if (err == -ENOTTY) { ++ cmd_sc[0] = MSGCODE_SET_CONTROLLED; ++ cmd_sc[1] = 1; ++ err = pulse8_send_and_wait_once(pulse8, cmd_sc, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ if (err) ++ goto unlock; ++ err = pulse8_send_and_wait_once(pulse8, cmd, cmd_len, ++ response, size); ++ } ++ ++unlock: ++ mutex_unlock(&pulse8->write_lock); ++ return err == -ENOTTY ? -EIO : err; ++} ++ ++static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, ++ struct cec_log_addrs *log_addrs, u16 *pa) ++{ ++ u8 *data = pulse8->data + 1; ++ u8 cmd[2]; ++ int err; ++ struct tm tm; ++ time_t date; ++ ++ pulse8->vers = 0; ++ ++ cmd[0] = MSGCODE_FIRMWARE_VERSION; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); ++ if (err) ++ return err; ++ pulse8->vers = (data[0] << 8) | data[1]; ++ dev_info(pulse8->dev, "Firmware version %04x\n", pulse8->vers); ++ if (pulse8->vers < 2) { ++ *pa = CEC_PHYS_ADDR_INVALID; ++ return 0; ++ } ++ ++ cmd[0] = MSGCODE_GET_BUILDDATE; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 4); ++ if (err) ++ return err; ++ date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; ++ time_to_tm(date, 0, &tm); ++ dev_info(pulse8->dev, "Firmware build date %04ld.%02d.%02d %02d:%02d:%02d\n", ++ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, ++ tm.tm_hour, tm.tm_min, tm.tm_sec); ++ ++ dev_dbg(pulse8->dev, "Persistent config:\n"); ++ cmd[0] = MSGCODE_GET_AUTO_ENABLED; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); ++ if (err) ++ return err; ++ pulse8->autonomous = data[0]; ++ dev_dbg(pulse8->dev, "Autonomous mode: %s", ++ data[0] ? "on" : "off"); ++ ++ cmd[0] = MSGCODE_GET_DEVICE_TYPE; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); ++ if (err) ++ return err; ++ log_addrs->primary_device_type[0] = data[0]; ++ dev_dbg(pulse8->dev, "Primary device type: %d\n", data[0]); ++ switch (log_addrs->primary_device_type[0]) { ++ case CEC_OP_PRIM_DEVTYPE_TV: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TV; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_TV; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_RECORD: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_RECORD; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_RECORD; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_TUNER: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TUNER; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_TUNER; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_PLAYBACK: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_PLAYBACK; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_SWITCH: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_PROCESSOR: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_SPECIFIC; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; ++ break; ++ default: ++ log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; ++ log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; ++ dev_info(pulse8->dev, "Unknown Primary Device Type: %d\n", ++ log_addrs->primary_device_type[0]); ++ break; ++ } ++ ++ cmd[0] = MSGCODE_GET_LOGICAL_ADDRESS_MASK; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); ++ if (err) ++ return err; ++ log_addrs->log_addr_mask = (data[0] << 8) | data[1]; ++ dev_dbg(pulse8->dev, "Logical address ACK mask: %x\n", ++ log_addrs->log_addr_mask); ++ if (log_addrs->log_addr_mask) ++ log_addrs->num_log_addrs = 1; ++ ++ cmd[0] = MSGCODE_GET_PHYSICAL_ADDRESS; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); ++ if (err) ++ return err; ++ *pa = (data[0] << 8) | data[1]; ++ dev_dbg(pulse8->dev, "Physical address: %x.%x.%x.%x\n", ++ cec_phys_addr_exp(*pa)); ++ ++ cmd[0] = MSGCODE_GET_HDMI_VERSION; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); ++ if (err) ++ return err; ++ log_addrs->cec_version = data[0]; ++ dev_dbg(pulse8->dev, "CEC version: %d\n", log_addrs->cec_version); ++ ++ cmd[0] = MSGCODE_GET_OSD_NAME; ++ err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 0); ++ if (err) ++ return err; ++ strncpy(log_addrs->osd_name, data, 13); ++ dev_dbg(pulse8->dev, "OSD name: %s\n", log_addrs->osd_name); ++ ++ return 0; ++} ++ ++static int pulse8_apply_persistent_config(struct pulse8 *pulse8, ++ struct cec_log_addrs *log_addrs, ++ u16 pa) ++{ ++ int err; ++ ++ err = cec_s_log_addrs(pulse8->adap, log_addrs, false); ++ if (err) ++ return err; ++ ++ cec_s_phys_addr(pulse8->adap, pa, false); ++ ++ return 0; ++} ++ ++static int pulse8_cec_adap_enable(struct cec_adapter *adap, bool enable) ++{ ++ struct pulse8 *pulse8 = cec_get_drvdata(adap); ++ u8 cmd[16]; ++ int err; ++ ++ cmd[0] = MSGCODE_SET_CONTROLLED; ++ cmd[1] = enable; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ return enable ? err : 0; ++} ++ ++static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) ++{ ++ struct pulse8 *pulse8 = cec_get_drvdata(adap); ++ u16 mask = 0; ++ u16 pa = adap->phys_addr; ++ u8 cmd[16]; ++ int err = 0; ++ ++ mutex_lock(&pulse8->config_lock); ++ if (log_addr != CEC_LOG_ADDR_INVALID) ++ mask = 1 << log_addr; ++ cmd[0] = MSGCODE_SET_ACK_MASK; ++ cmd[1] = mask >> 8; ++ cmd[2] = mask & 0xff; ++ err = pulse8_send_and_wait(pulse8, cmd, 3, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if ((err && mask != 0) || pulse8->restoring_config) ++ goto unlock; ++ ++ cmd[0] = MSGCODE_SET_AUTO_ENABLED; ++ cmd[1] = log_addr == CEC_LOG_ADDR_INVALID ? 0 : 1; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ pulse8->autonomous = cmd[1]; ++ if (log_addr == CEC_LOG_ADDR_INVALID) ++ goto unlock; ++ ++ cmd[0] = MSGCODE_SET_DEVICE_TYPE; ++ cmd[1] = adap->log_addrs.primary_device_type[0]; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ ++ switch (adap->log_addrs.primary_device_type[0]) { ++ case CEC_OP_PRIM_DEVTYPE_TV: ++ mask = CEC_LOG_ADDR_MASK_TV; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_RECORD: ++ mask = CEC_LOG_ADDR_MASK_RECORD; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_TUNER: ++ mask = CEC_LOG_ADDR_MASK_TUNER; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_PLAYBACK: ++ mask = CEC_LOG_ADDR_MASK_PLAYBACK; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM: ++ mask = CEC_LOG_ADDR_MASK_AUDIOSYSTEM; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_SWITCH: ++ mask = CEC_LOG_ADDR_MASK_UNREGISTERED; ++ break; ++ case CEC_OP_PRIM_DEVTYPE_PROCESSOR: ++ mask = CEC_LOG_ADDR_MASK_SPECIFIC; ++ break; ++ default: ++ mask = 0; ++ break; ++ } ++ cmd[0] = MSGCODE_SET_LOGICAL_ADDRESS_MASK; ++ cmd[1] = mask >> 8; ++ cmd[2] = mask & 0xff; ++ err = pulse8_send_and_wait(pulse8, cmd, 3, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ ++ cmd[0] = MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS; ++ cmd[1] = log_addr; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ ++ cmd[0] = MSGCODE_SET_PHYSICAL_ADDRESS; ++ cmd[1] = pa >> 8; ++ cmd[2] = pa & 0xff; ++ err = pulse8_send_and_wait(pulse8, cmd, 3, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ ++ cmd[0] = MSGCODE_SET_HDMI_VERSION; ++ cmd[1] = adap->log_addrs.cec_version; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ ++ if (adap->log_addrs.osd_name[0]) { ++ size_t osd_len = strlen(adap->log_addrs.osd_name); ++ char *osd_str = cmd + 1; ++ ++ cmd[0] = MSGCODE_SET_OSD_NAME; ++ strncpy(cmd + 1, adap->log_addrs.osd_name, 13); ++ if (osd_len < 4) { ++ memset(osd_str + osd_len, ' ', 4 - osd_len); ++ osd_len = 4; ++ osd_str[osd_len] = '\0'; ++ strcpy(adap->log_addrs.osd_name, osd_str); ++ } ++ err = pulse8_send_and_wait(pulse8, cmd, 1 + osd_len, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ if (err) ++ goto unlock; ++ } ++ ++unlock: ++ if (pulse8->restoring_config) ++ pulse8->restoring_config = false; ++ else ++ pulse8->config_pending = true; ++ mutex_unlock(&pulse8->config_lock); ++ return err; ++} ++ ++static int pulse8_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, ++ u32 signal_free_time, struct cec_msg *msg) ++{ ++ struct pulse8 *pulse8 = cec_get_drvdata(adap); ++ u8 cmd[2]; ++ unsigned int i; ++ int err; ++ ++ cmd[0] = MSGCODE_TRANSMIT_IDLETIME; ++ cmd[1] = signal_free_time; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ cmd[0] = MSGCODE_TRANSMIT_ACK_POLARITY; ++ cmd[1] = cec_msg_is_broadcast(msg); ++ if (!err) ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ cmd[0] = msg->len == 1 ? MSGCODE_TRANSMIT_EOM : MSGCODE_TRANSMIT; ++ cmd[1] = msg->msg[0]; ++ if (!err) ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ if (!err && msg->len > 1) { ++ cmd[0] = msg->len == 2 ? MSGCODE_TRANSMIT_EOM : ++ MSGCODE_TRANSMIT; ++ cmd[1] = msg->msg[1]; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ for (i = 0; !err && i + 2 < msg->len; i++) { ++ cmd[0] = (i + 2 == msg->len - 1) ? ++ MSGCODE_TRANSMIT_EOM : MSGCODE_TRANSMIT; ++ cmd[1] = msg->msg[i + 2]; ++ err = pulse8_send_and_wait(pulse8, cmd, 2, ++ MSGCODE_COMMAND_ACCEPTED, 1); ++ } ++ } ++ ++ return err; ++} ++ ++static int pulse8_received(struct cec_adapter *adap, struct cec_msg *msg) ++{ ++ return -ENOMSG; ++} ++ ++static const struct cec_adap_ops pulse8_cec_adap_ops = { ++ .adap_enable = pulse8_cec_adap_enable, ++ .adap_log_addr = pulse8_cec_adap_log_addr, ++ .adap_transmit = pulse8_cec_adap_transmit, ++ .received = pulse8_received, ++}; ++ ++static int pulse8_connect(struct serio *serio, struct serio_driver *drv) ++{ ++ u32 caps = CEC_CAP_DEFAULTS | CEC_CAP_PHYS_ADDR | CEC_CAP_MONITOR_ALL; ++ struct pulse8 *pulse8; ++ int err = -ENOMEM; ++ struct cec_log_addrs log_addrs = {}; ++ u16 pa = CEC_PHYS_ADDR_INVALID; ++ ++ pulse8 = kzalloc(sizeof(*pulse8), GFP_KERNEL); ++ ++ if (!pulse8) ++ return -ENOMEM; ++ ++ pulse8->serio = serio; ++ pulse8->adap = cec_allocate_adapter(&pulse8_cec_adap_ops, pulse8, ++ dev_name(&serio->dev), caps, 1); ++ err = PTR_ERR_OR_ZERO(pulse8->adap); ++ if (err < 0) ++ goto free_device; ++ ++ pulse8->dev = &serio->dev; ++ serio_set_drvdata(serio, pulse8); ++ INIT_WORK(&pulse8->work, pulse8_irq_work_handler); ++ mutex_init(&pulse8->write_lock); ++ mutex_init(&pulse8->config_lock); ++ pulse8->config_pending = false; ++ ++ err = serio_open(serio, drv); ++ if (err) ++ goto delete_adap; ++ ++ err = pulse8_setup(pulse8, serio, &log_addrs, &pa); ++ if (err) ++ goto close_serio; ++ ++ err = cec_register_adapter(pulse8->adap, &serio->dev); ++ if (err < 0) ++ goto close_serio; ++ ++ pulse8->dev = &pulse8->adap->devnode.dev; ++ ++ if (persistent_config && pulse8->autonomous) { ++ err = pulse8_apply_persistent_config(pulse8, &log_addrs, pa); ++ if (err) ++ goto close_serio; ++ pulse8->restoring_config = true; ++ } ++ ++ INIT_DELAYED_WORK(&pulse8->ping_eeprom_work, ++ pulse8_ping_eeprom_work_handler); ++ schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD); ++ ++ return 0; ++ ++close_serio: ++ serio_close(serio); ++delete_adap: ++ cec_delete_adapter(pulse8->adap); ++ serio_set_drvdata(serio, NULL); ++free_device: ++ kfree(pulse8); ++ return err; ++} ++ ++static void pulse8_ping_eeprom_work_handler(struct work_struct *work) ++{ ++ struct pulse8 *pulse8 = ++ container_of(work, struct pulse8, ping_eeprom_work.work); ++ u8 cmd; ++ ++ schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD); ++ cmd = MSGCODE_PING; ++ pulse8_send_and_wait(pulse8, &cmd, 1, ++ MSGCODE_COMMAND_ACCEPTED, 0); ++ ++ if (pulse8->vers < 2) ++ return; ++ ++ mutex_lock(&pulse8->config_lock); ++ if (pulse8->config_pending && persistent_config) { ++ dev_dbg(pulse8->dev, "writing pending config to EEPROM\n"); ++ cmd = MSGCODE_WRITE_EEPROM; ++ if (pulse8_send_and_wait(pulse8, &cmd, 1, ++ MSGCODE_COMMAND_ACCEPTED, 0)) ++ dev_info(pulse8->dev, "failed to write pending config to EEPROM\n"); ++ else ++ pulse8->config_pending = false; ++ } ++ mutex_unlock(&pulse8->config_lock); ++} ++ ++static const struct serio_device_id pulse8_serio_ids[] = { ++ { ++ .type = SERIO_RS232, ++ .proto = SERIO_PULSE8_CEC, ++ .id = SERIO_ANY, ++ .extra = SERIO_ANY, ++ }, ++ { 0 } ++}; ++ ++MODULE_DEVICE_TABLE(serio, pulse8_serio_ids); ++ ++static struct serio_driver pulse8_drv = { ++ .driver = { ++ .name = "pulse8-cec", ++ }, ++ .description = "Pulse Eight HDMI CEC driver", ++ .id_table = pulse8_serio_ids, ++ .interrupt = pulse8_interrupt, ++ .connect = pulse8_connect, ++ .disconnect = pulse8_disconnect, ++}; ++ ++module_serio_driver(pulse8_drv); +diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h +index becdd78295cc..4588c66a8df0 100644 +--- a/include/uapi/linux/serio.h ++++ b/include/uapi/linux/serio.h +@@ -77,5 +77,6 @@ + #define SERIO_PS2MULT 0x3c + #define SERIO_TSC40 0x3d + #define SERIO_WACOM_IV 0x3e ++#define SERIO_PULSE8_CEC 0x40 + + #endif /* _UAPI_SERIO_H */ + +From 7f6dbf0df7f833b1d9e8da72365eebffd046e7c7 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 4 Sep 2017 22:34:24 +0200 +Subject: [PATCH] BACKPORT: RainShadow Tech HDMI CEC from v4.15 + +--- + MAINTAINERS | 7 + + drivers/media/usb/Kconfig | 1 + + drivers/media/usb/Makefile | 1 + + drivers/media/usb/rainshadow-cec/Kconfig | 11 + + drivers/media/usb/rainshadow-cec/Makefile | 1 + + drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 384 ++++++++++++++++++++++ + include/uapi/linux/serio.h | 1 + + 7 files changed, 406 insertions(+) + create mode 100644 drivers/media/usb/rainshadow-cec/Kconfig + create mode 100644 drivers/media/usb/rainshadow-cec/Makefile + create mode 100644 drivers/media/usb/rainshadow-cec/rainshadow-cec.c + +diff --git a/MAINTAINERS b/MAINTAINERS +index 0c1232c326a5..551555a162c3 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -8912,6 +8912,13 @@ L: linux-fbdev@vger.kernel.org + S: Maintained + F: drivers/video/fbdev/aty/aty128fb.c + ++RAINSHADOW-CEC DRIVER ++M: Hans Verkuil ++L: linux-media@vger.kernel.org ++T: git git://linuxtv.org/media_tree.git ++S: Maintained ++F: drivers/media/usb/rainshadow-cec/* ++ + RALINK RT2X00 WIRELESS LAN DRIVER + P: rt2x00 project + M: Stanislaw Gruszka +diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig +index c9644b62f91a..b24e753c4766 100644 +--- a/drivers/media/usb/Kconfig ++++ b/drivers/media/usb/Kconfig +@@ -63,6 +63,7 @@ endif + if MEDIA_CEC_SUPPORT + comment "USB HDMI CEC adapters" + source "drivers/media/usb/pulse8-cec/Kconfig" ++source "drivers/media/usb/rainshadow-cec/Kconfig" + endif + + endif #MEDIA_USB_SUPPORT +diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile +index 0f15e3351ddc..738b993ec8b0 100644 +--- a/drivers/media/usb/Makefile ++++ b/drivers/media/usb/Makefile +@@ -25,3 +25,4 @@ obj-$(CONFIG_VIDEO_USBTV) += usbtv/ + obj-$(CONFIG_VIDEO_GO7007) += go7007/ + obj-$(CONFIG_DVB_AS102) += as102/ + obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/ ++obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/ +diff --git a/drivers/media/usb/rainshadow-cec/Kconfig b/drivers/media/usb/rainshadow-cec/Kconfig +new file mode 100644 +index 000000000000..030ef01b1ff0 +--- /dev/null ++++ b/drivers/media/usb/rainshadow-cec/Kconfig +@@ -0,0 +1,11 @@ ++config USB_RAINSHADOW_CEC ++ tristate "RainShadow Tech HDMI CEC" ++ depends on USB_ACM ++ select CEC_CORE ++ select SERIO ++ select SERIO_SERPORT ++ ---help--- ++ This is a cec driver for the RainShadow Tech HDMI CEC device. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called rainshadow-cec. +diff --git a/drivers/media/usb/rainshadow-cec/Makefile b/drivers/media/usb/rainshadow-cec/Makefile +new file mode 100644 +index 000000000000..a79fbc77e1f7 +--- /dev/null ++++ b/drivers/media/usb/rainshadow-cec/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o +diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c +new file mode 100644 +index 000000000000..cecdcbcd400c +--- /dev/null ++++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c +@@ -0,0 +1,384 @@ ++/* ++ * RainShadow Tech HDMI CEC driver ++ * ++ * Copyright 2016 Hans Verkuil ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++MODULE_AUTHOR("Hans Verkuil "); ++MODULE_DESCRIPTION("RainShadow Tech HDMI CEC driver"); ++MODULE_LICENSE("GPL"); ++ ++#define DATA_SIZE 256 ++ ++struct rain { ++ struct device *dev; ++ struct serio *serio; ++ struct cec_adapter *adap; ++ struct completion cmd_done; ++ struct work_struct work; ++ ++ /* Low-level ringbuffer, collecting incoming characters */ ++ char buf[DATA_SIZE]; ++ unsigned int buf_rd_idx; ++ unsigned int buf_wr_idx; ++ unsigned int buf_len; ++ spinlock_t buf_lock; ++ ++ /* command buffer */ ++ char cmd[DATA_SIZE]; ++ unsigned int cmd_idx; ++ bool cmd_started; ++ ++ /* reply to a command, only used to store the firmware version */ ++ char cmd_reply[DATA_SIZE]; ++ ++ struct mutex write_lock; ++}; ++ ++static void rain_process_msg(struct rain *rain) ++{ ++ struct cec_msg msg = {}; ++ const char *cmd = rain->cmd + 3; ++ int stat = -1; ++ ++ for (; *cmd; cmd++) { ++ if (!isxdigit(*cmd)) ++ continue; ++ if (isxdigit(cmd[0]) && isxdigit(cmd[1])) { ++ if (msg.len == CEC_MAX_MSG_SIZE) ++ break; ++ if (hex2bin(msg.msg + msg.len, cmd, 1)) ++ continue; ++ msg.len++; ++ cmd++; ++ continue; ++ } ++ if (!cmd[1]) ++ stat = hex_to_bin(cmd[0]); ++ break; ++ } ++ ++ if (rain->cmd[0] == 'R') { ++ if (stat == 1 || stat == 2) ++ cec_received_msg(rain->adap, &msg); ++ return; ++ } ++ ++ switch (stat) { ++ case 1: ++ cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_OK); ++ break; ++ case 2: ++ cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_NACK); ++ break; ++ default: ++ cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_LOW_DRIVE); ++ break; ++ } ++} ++ ++static void rain_irq_work_handler(struct work_struct *work) ++{ ++ struct rain *rain = ++ container_of(work, struct rain, work); ++ ++ while (true) { ++ unsigned long flags; ++ char data; ++ ++ spin_lock_irqsave(&rain->buf_lock, flags); ++ if (!rain->buf_len) { ++ spin_unlock_irqrestore(&rain->buf_lock, flags); ++ break; ++ } ++ ++ data = rain->buf[rain->buf_rd_idx]; ++ rain->buf_len--; ++ rain->buf_rd_idx = (rain->buf_rd_idx + 1) & 0xff; ++ ++ spin_unlock_irqrestore(&rain->buf_lock, flags); ++ ++ if (!rain->cmd_started && data != '?') ++ continue; ++ ++ switch (data) { ++ case '\r': ++ rain->cmd[rain->cmd_idx] = '\0'; ++ dev_dbg(rain->dev, "received: %s\n", rain->cmd); ++ if (!memcmp(rain->cmd, "REC", 3) || ++ !memcmp(rain->cmd, "STA", 3)) { ++ rain_process_msg(rain); ++ } else { ++ strcpy(rain->cmd_reply, rain->cmd); ++ complete(&rain->cmd_done); ++ } ++ rain->cmd_idx = 0; ++ rain->cmd_started = false; ++ break; ++ ++ case '\n': ++ rain->cmd_idx = 0; ++ rain->cmd_started = false; ++ break; ++ ++ case '?': ++ rain->cmd_idx = 0; ++ rain->cmd_started = true; ++ break; ++ ++ default: ++ if (rain->cmd_idx >= DATA_SIZE - 1) { ++ dev_dbg(rain->dev, ++ "throwing away %d bytes of garbage\n", rain->cmd_idx); ++ rain->cmd_idx = 0; ++ } ++ rain->cmd[rain->cmd_idx++] = data; ++ break; ++ } ++ } ++} ++ ++static irqreturn_t rain_interrupt(struct serio *serio, unsigned char data, ++ unsigned int flags) ++{ ++ struct rain *rain = serio_get_drvdata(serio); ++ ++ if (rain->buf_len == DATA_SIZE) { ++ dev_warn_once(rain->dev, "buffer overflow\n"); ++ return IRQ_HANDLED; ++ } ++ spin_lock(&rain->buf_lock); ++ rain->buf_len++; ++ rain->buf[rain->buf_wr_idx] = data; ++ rain->buf_wr_idx = (rain->buf_wr_idx + 1) & 0xff; ++ spin_unlock(&rain->buf_lock); ++ schedule_work(&rain->work); ++ return IRQ_HANDLED; ++} ++ ++static void rain_disconnect(struct serio *serio) ++{ ++ struct rain *rain = serio_get_drvdata(serio); ++ ++ cancel_work_sync(&rain->work); ++ cec_unregister_adapter(rain->adap); ++ dev_info(&serio->dev, "disconnected\n"); ++ serio_close(serio); ++ serio_set_drvdata(serio, NULL); ++ kfree(rain); ++} ++ ++static int rain_send(struct rain *rain, const char *command) ++{ ++ int err = serio_write(rain->serio, '!'); ++ ++ dev_dbg(rain->dev, "send: %s\n", command); ++ while (!err && *command) ++ err = serio_write(rain->serio, *command++); ++ if (!err) ++ err = serio_write(rain->serio, '~'); ++ ++ return err; ++} ++ ++static int rain_send_and_wait(struct rain *rain, ++ const char *cmd, const char *reply) ++{ ++ int err; ++ ++ init_completion(&rain->cmd_done); ++ ++ mutex_lock(&rain->write_lock); ++ err = rain_send(rain, cmd); ++ if (err) ++ goto err; ++ ++ if (!wait_for_completion_timeout(&rain->cmd_done, HZ)) { ++ err = -ETIMEDOUT; ++ goto err; ++ } ++ if (reply && strncmp(rain->cmd_reply, reply, strlen(reply))) { ++ dev_dbg(rain->dev, ++ "transmit of '%s': received '%s' instead of '%s'\n", ++ cmd, rain->cmd_reply, reply); ++ err = -EIO; ++ } ++err: ++ mutex_unlock(&rain->write_lock); ++ return err; ++} ++ ++static int rain_setup(struct rain *rain, struct serio *serio, ++ struct cec_log_addrs *log_addrs, u16 *pa) ++{ ++ int err; ++ ++ err = rain_send_and_wait(rain, "R", "REV"); ++ if (err) ++ return err; ++ dev_info(rain->dev, "Firmware version %s\n", rain->cmd_reply + 4); ++ ++ err = rain_send_and_wait(rain, "Q 1", "QTY"); ++ if (err) ++ return err; ++ err = rain_send_and_wait(rain, "c0000", "CFG"); ++ if (err) ++ return err; ++ return rain_send_and_wait(rain, "A F 0000", "ADR"); ++} ++ ++static int rain_cec_adap_enable(struct cec_adapter *adap, bool enable) ++{ ++ return 0; ++} ++ ++static int rain_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) ++{ ++ struct rain *rain = cec_get_drvdata(adap); ++ u8 cmd[16]; ++ ++ if (log_addr == CEC_LOG_ADDR_INVALID) ++ log_addr = CEC_LOG_ADDR_UNREGISTERED; ++ snprintf(cmd, sizeof(cmd), "A %x", log_addr); ++ return rain_send_and_wait(rain, cmd, "ADR"); ++} ++ ++static int rain_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, ++ u32 signal_free_time, struct cec_msg *msg) ++{ ++ struct rain *rain = cec_get_drvdata(adap); ++ char cmd[2 * CEC_MAX_MSG_SIZE + 16]; ++ unsigned int i; ++ int err; ++ ++ if (msg->len == 1) { ++ snprintf(cmd, sizeof(cmd), "x%x", cec_msg_destination(msg)); ++ } else { ++ char hex[3]; ++ ++ snprintf(cmd, sizeof(cmd), "x%x %02x ", ++ cec_msg_destination(msg), msg->msg[1]); ++ for (i = 2; i < msg->len; i++) { ++ snprintf(hex, sizeof(hex), "%02x", msg->msg[i]); ++ strlcat(cmd, hex, sizeof(cmd)); ++ } ++ } ++ mutex_lock(&rain->write_lock); ++ err = rain_send(rain, cmd); ++ mutex_unlock(&rain->write_lock); ++ return err; ++} ++ ++static const struct cec_adap_ops rain_cec_adap_ops = { ++ .adap_enable = rain_cec_adap_enable, ++ .adap_log_addr = rain_cec_adap_log_addr, ++ .adap_transmit = rain_cec_adap_transmit, ++}; ++ ++static int rain_connect(struct serio *serio, struct serio_driver *drv) ++{ ++ u32 caps = CEC_CAP_DEFAULTS | CEC_CAP_PHYS_ADDR | CEC_CAP_MONITOR_ALL; ++ struct rain *rain; ++ int err = -ENOMEM; ++ struct cec_log_addrs log_addrs = {}; ++ u16 pa = CEC_PHYS_ADDR_INVALID; ++ ++ rain = kzalloc(sizeof(*rain), GFP_KERNEL); ++ ++ if (!rain) ++ return -ENOMEM; ++ ++ rain->serio = serio; ++ rain->adap = cec_allocate_adapter(&rain_cec_adap_ops, rain, ++ dev_name(&serio->dev), caps, 1); ++ err = PTR_ERR_OR_ZERO(rain->adap); ++ if (err < 0) ++ goto free_device; ++ ++ rain->dev = &serio->dev; ++ serio_set_drvdata(serio, rain); ++ INIT_WORK(&rain->work, rain_irq_work_handler); ++ mutex_init(&rain->write_lock); ++ spin_lock_init(&rain->buf_lock); ++ ++ err = serio_open(serio, drv); ++ if (err) ++ goto delete_adap; ++ ++ err = rain_setup(rain, serio, &log_addrs, &pa); ++ if (err) ++ goto close_serio; ++ ++ err = cec_register_adapter(rain->adap, &serio->dev); ++ if (err < 0) ++ goto close_serio; ++ ++ rain->dev = &rain->adap->devnode.dev; ++ return 0; ++ ++close_serio: ++ serio_close(serio); ++delete_adap: ++ cec_delete_adapter(rain->adap); ++ serio_set_drvdata(serio, NULL); ++free_device: ++ kfree(rain); ++ return err; ++} ++ ++static const struct serio_device_id rain_serio_ids[] = { ++ { ++ .type = SERIO_RS232, ++ .proto = SERIO_RAINSHADOW_CEC, ++ .id = SERIO_ANY, ++ .extra = SERIO_ANY, ++ }, ++ { 0 } ++}; ++ ++MODULE_DEVICE_TABLE(serio, rain_serio_ids); ++ ++static struct serio_driver rain_drv = { ++ .driver = { ++ .name = "rainshadow-cec", ++ }, ++ .description = "RainShadow Tech HDMI CEC driver", ++ .id_table = rain_serio_ids, ++ .interrupt = rain_interrupt, ++ .connect = rain_connect, ++ .disconnect = rain_disconnect, ++}; ++ ++module_serio_driver(rain_drv); +diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h +index 4588c66a8df0..89b72003fb68 100644 +--- a/include/uapi/linux/serio.h ++++ b/include/uapi/linux/serio.h +@@ -78,5 +78,6 @@ + #define SERIO_TSC40 0x3d + #define SERIO_WACOM_IV 0x3e + #define SERIO_PULSE8_CEC 0x40 ++#define SERIO_RAINSHADOW_CEC 0x41 + + #endif /* _UAPI_SERIO_H */ + +From f532f514ca373430332f2733be987335af7ae75c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 2 Sep 2017 16:23:11 +0200 +Subject: [PATCH] [media] rc/keymaps: initialize rc-cec early + +--- + drivers/media/rc/keymaps/rc-cec.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/rc/keymaps/rc-cec.c b/drivers/media/rc/keymaps/rc-cec.c +index 354c8e724b8e..fb0c2b1f3814 100644 +--- a/drivers/media/rc/keymaps/rc-cec.c ++++ b/drivers/media/rc/keymaps/rc-cec.c +@@ -175,7 +175,7 @@ static void __exit exit_rc_map_cec(void) + rc_map_unregister(&cec_map); + } + +-module_init(init_rc_map_cec); ++subsys_initcall(init_rc_map_cec); + module_exit(exit_rc_map_cec); + + MODULE_LICENSE("GPL"); + +From 54c779a399fb852e06f11a03bf03c31090c4b722 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 2 Sep 2017 16:23:11 +0200 +Subject: [PATCH] drm/bridge: dw-hdmi: read edid on hpd event + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 8cb2cb4e61a6..c045cc0717cd 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -2479,6 +2479,7 @@ static void dw_hdmi_bridge_nop(struct drm_bridge *bridge) + static enum drm_connector_status + dw_hdmi_connector_detect(struct drm_connector *connector, bool force) + { ++ enum drm_connector_status status; + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, + connector); + +@@ -2488,7 +2489,24 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) + dw_hdmi_update_phy_mask(hdmi); + mutex_unlock(&hdmi->mutex); + +- return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); ++ status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); ++ ++ if (status == connector_status_connected && hdmi->ddc) { ++ struct edid *edid = drm_get_edid(connector, hdmi->ddc); ++ if (edid) { ++ dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", ++ edid->width_cm, edid->height_cm); ++ ++ hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); ++ hdmi->sink_has_audio = drm_detect_monitor_audio(edid); ++ drm_mode_connector_update_edid_property(connector, edid); ++ cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); ++ drm_edid_to_eld(connector, edid); ++ kfree(edid); ++ } ++ } ++ ++ return status; + } + + static int dw_hdmi_connector_get_modes(struct drm_connector *connector) +@@ -2891,9 +2909,6 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) + dw_hdmi_update_phy_mask(hdmi); + } + mutex_unlock(&hdmi->mutex); +- if (!(phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD))) +- cec_notifier_set_phys_addr(hdmi->cec_notifier, +- CEC_PHYS_ADDR_INVALID); + } + + check_hdmi_irq(hdmi, intr_stat, phy_int_pol); diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0004-audio.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0004-audio.patch new file mode 100644 index 0000000000..cdd56a3b65 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0004-audio.patch @@ -0,0 +1,1597 @@ +From fa2bd9cdc869b32ba00f0bba79b63e1fd53f8cdb Mon Sep 17 00:00:00 2001 +From: Chris Zhong +Date: Mon, 18 Jul 2016 22:34:34 +0800 +Subject: [PATCH] UPSTREAM: ASoC: rockchip: correct the spdif clk + +The spdif mclk should be 128 times of sample rate, and there is a +internal divider, the real rate of spdif mclk is mclk / (div + 1). +Hence, the original driver always get the good frequency for +48000/96000/44100/192000. But for 32000, the mclk is incorrect, +it should be 32000*128, but get 48000*128. Do not use the internal +divider here, just set all mclk to 128 * sample rate directly. + +Signed-off-by: Chris Zhong +Signed-off-by: Mark Brown +(cherry picked from commit 46dd2e28a90e48fbf1b7e253933fa3b7242e9b1b) +--- + sound/soc/rockchip/rockchip_spdif.c | 17 +---------------- + 1 file changed, 1 insertion(+), 16 deletions(-) + +diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c +index c211750b54ee..784941ca2408 100644 +--- a/sound/soc/rockchip/rockchip_spdif.c ++++ b/sound/soc/rockchip/rockchip_spdif.c +@@ -105,21 +105,7 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream, + int ret; + + srate = params_rate(params); +- switch (srate) { +- case 32000: +- case 48000: +- case 96000: +- mclk = 96000 * 128; /* 12288000 hz */ +- break; +- case 44100: +- mclk = 44100 * 256; /* 11289600 hz */ +- break; +- case 192000: +- mclk = 192000 * 128; /* 24576000 hz */ +- break; +- default: +- return -EINVAL; +- } ++ mclk = srate * 128; + + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: +@@ -143,7 +129,6 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream, + return ret; + } + +- val |= SPDIF_CFGR_CLK_DIV(mclk/(srate * 256)); + ret = regmap_update_bits(spdif->regmap, SPDIF_CFGR, + SPDIF_CFGR_CLK_DIV_MASK | SPDIF_CFGR_HALFWORD_ENABLE | + SDPIF_CFGR_VDW_MASK, + +From 46e3e82a547b78ca5db11a8444f787fd15f8e8ce Mon Sep 17 00:00:00 2001 +From: Sugar Zhang +Date: Wed, 7 Sep 2016 14:30:21 +0800 +Subject: [PATCH] UPSTREAM: ASoC: rockchip: spdif: restore register during + runtime_suspend/resume cycle + +when step into runtime_suspend, spdif pd will be disabled and loss state. +so need to restore register when runtime_resume. + +Signed-off-by: Sugar Zhang +Signed-off-by: Mark Brown +(cherry picked from commit 3628c6987fb45d719cd963805bbba9f15017290e) +--- + sound/soc/rockchip/rockchip_spdif.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c +index 784941ca2408..831e4caf29d3 100644 +--- a/sound/soc/rockchip/rockchip_spdif.c ++++ b/sound/soc/rockchip/rockchip_spdif.c +@@ -69,6 +69,7 @@ static int __maybe_unused rk_spdif_runtime_suspend(struct device *dev) + { + struct rk_spdif_dev *spdif = dev_get_drvdata(dev); + ++ regcache_cache_only(spdif->regmap, true); + clk_disable_unprepare(spdif->mclk); + clk_disable_unprepare(spdif->hclk); + +@@ -92,7 +93,16 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev) + return ret; + } + +- return 0; ++ regcache_cache_only(spdif->regmap, false); ++ regcache_mark_dirty(spdif->regmap); ++ ++ ret = regcache_sync(spdif->regmap); ++ if (ret) { ++ clk_disable_unprepare(spdif->mclk); ++ clk_disable_unprepare(spdif->hclk); ++ } ++ ++ return ret; + } + + static int rk_spdif_hw_params(struct snd_pcm_substream *substream, + +From d8a8c9964022565ecf7b5ea7249262c3ac381a1b Mon Sep 17 00:00:00 2001 +From: Arnaud Pouliquen +Date: Tue, 3 Jan 2017 16:52:50 +0100 +Subject: [PATCH] UPSTREAM: DRM: add help to get ELD speaker allocation + +Add helper to allow users to retrieve the speaker allocations without +knowledge of the ELD structure. + +Signed-off-by: Arnaud Pouliquen +Reviewed-by: Jani Nikula +Signed-off-by: Mark Brown +(cherry picked from commit c82dbe5c055e4d246bd07c4d7b24801c9445c241) +--- + include/drm/drm_edid.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h +index 85861b63e77a..55201e7e2ede 100644 +--- a/include/drm/drm_edid.h ++++ b/include/drm/drm_edid.h +@@ -254,6 +254,7 @@ struct detailed_timing { + # define DRM_ELD_AUD_SYNCH_DELAY_MAX 0xfa /* 500 ms */ + + #define DRM_ELD_SPEAKER 7 ++# define DRM_ELD_SPEAKER_MASK 0x7f + # define DRM_ELD_SPEAKER_RLRC (1 << 6) + # define DRM_ELD_SPEAKER_FLRC (1 << 5) + # define DRM_ELD_SPEAKER_RC (1 << 4) +@@ -417,6 +418,18 @@ static inline int drm_eld_size(const uint8_t *eld) + return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4; + } + ++/** ++ * drm_eld_get_spk_alloc - Get speaker allocation ++ * @eld: pointer to an ELD memory structure ++ * ++ * The returned value is the speakers mask. User has to use %DRM_ELD_SPEAKER ++ * field definitions to identify speakers. ++ */ ++static inline u8 drm_eld_get_spk_alloc(const uint8_t *eld) ++{ ++ return eld[DRM_ELD_SPEAKER] & DRM_ELD_SPEAKER_MASK; ++} ++ + struct edid *drm_do_get_edid(struct drm_connector *connector, + int (*get_edid_block)(void *data, u8 *buf, unsigned int block, + size_t len), + +From e622344ce58345eda1ce7372bf7e91e4e90ece5f Mon Sep 17 00:00:00 2001 +From: Arnaud Pouliquen +Date: Tue, 3 Jan 2017 16:52:51 +0100 +Subject: [PATCH] UPSTREAM: ASoC: core: add optional pcm_new callback for DAI + driver + +During probe, DAIs can need to perform some actions that requests +the knowledge of the pcm runtime handle. +The callback is called during DAIs linking, after PCM device creation. +For instance this can be used to add relationship between a DAI pcm +control and the pcm device. + +Signed-off-by: Arnaud Pouliquen +Signed-off-by: Mark Brown +(cherry picked from commit 25f7b701c20db3e9ae09e28dd652949bd977e5cd) +--- + include/sound/soc-dai.h | 3 +++ + sound/soc/soc-core.c | 28 ++++++++++++++++++++++++++++ + 2 files changed, 31 insertions(+) + +diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h +index 212eaaf172ed..345e4f8ee93f 100644 +--- a/include/sound/soc-dai.h ++++ b/include/sound/soc-dai.h +@@ -230,6 +230,9 @@ struct snd_soc_dai_driver { + int (*resume)(struct snd_soc_dai *dai); + /* compress dai */ + int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num); ++ /* Optional Callback used at pcm creation*/ ++ int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, ++ struct snd_soc_dai *dai); + /* DAI is also used for the control bus */ + bool bus_control; + +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index 3c6713da3ad9..e46e80c0e07d 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -1289,6 +1289,27 @@ static int soc_probe_dai(struct snd_soc_dai *dai, int order) + return 0; + } + ++static int soc_link_dai_pcm_new(struct snd_soc_dai **dais, int num_dais, ++ struct snd_soc_pcm_runtime *rtd) ++{ ++ int i, ret = 0; ++ ++ for (i = 0; i < num_dais; ++i) { ++ struct snd_soc_dai_driver *drv = dais[i]->driver; ++ ++ if (!rtd->dai_link->no_pcm && drv->pcm_new) ++ ret = drv->pcm_new(rtd, dais[i]); ++ if (ret < 0) { ++ dev_err(dais[i]->dev, ++ "ASoC: Failed to bind %s with pcm device\n", ++ dais[i]->name); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ + static int soc_link_dai_widgets(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_link, + struct snd_soc_pcm_runtime *rtd) +@@ -1400,6 +1421,13 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) + dai_link->stream_name, ret); + return ret; + } ++ ret = soc_link_dai_pcm_new(&cpu_dai, 1, rtd); ++ if (ret < 0) ++ return ret; ++ ret = soc_link_dai_pcm_new(rtd->codec_dais, ++ rtd->num_codecs, rtd); ++ if (ret < 0) ++ return ret; + } else { + INIT_DELAYED_WORK(&rtd->delayed_work, + codec2codec_close_delayed_work); + +From 3877e4beac5a5efc2898185fe75555e21cf6b090 Mon Sep 17 00:00:00 2001 +From: Arnaud Pouliquen +Date: Tue, 3 Jan 2017 16:52:52 +0100 +Subject: [PATCH] UPSTREAM: ASoC: hdmi-codec: add channel mapping control + +Add user interface to provide channel mapping. +In a first step this control is read only. + +As TLV type, the control provides all configuration available for +HDMI sink(ELD), and provides current channel mapping selected by codec +based on ELD and number of channels specified by user on open. +When control is called before the number of the channel is specified +(i.e. hw_params is set), it returns all channels set to UNKNOWN. + +Signed-off-by: Arnaud Pouliquen +Signed-off-by: Mark Brown +(cherry picked from commit cd6111b26280a2f38a9fb8e6630c63a96477e4bf) +--- + sound/soc/codecs/hdmi-codec.c | 377 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 376 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c +index 028d60c196ae..cb78d8971b41 100644 +--- a/sound/soc/codecs/hdmi-codec.c ++++ b/sound/soc/codecs/hdmi-codec.c +@@ -21,12 +21,264 @@ + #include + #include + #include ++#include + #include + #include + #include + + #include /* This is only to get MAX_ELD_BYTES */ + ++#define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1 ++ ++struct hdmi_codec_channel_map_table { ++ unsigned char map; /* ALSA API channel map position */ ++ unsigned long spk_mask; /* speaker position bit mask */ ++}; ++ ++/* ++ * CEA speaker placement for HDMI 1.4: ++ * ++ * FL FLC FC FRC FR FRW ++ * ++ * LFE ++ * ++ * RL RLC RC RRC RR ++ * ++ * Speaker placement has to be extended to support HDMI 2.0 ++ */ ++enum hdmi_codec_cea_spk_placement { ++ FL = BIT(0), /* Front Left */ ++ FC = BIT(1), /* Front Center */ ++ FR = BIT(2), /* Front Right */ ++ FLC = BIT(3), /* Front Left Center */ ++ FRC = BIT(4), /* Front Right Center */ ++ RL = BIT(5), /* Rear Left */ ++ RC = BIT(6), /* Rear Center */ ++ RR = BIT(7), /* Rear Right */ ++ RLC = BIT(8), /* Rear Left Center */ ++ RRC = BIT(9), /* Rear Right Center */ ++ LFE = BIT(10), /* Low Frequency Effect */ ++}; ++ ++/* ++ * cea Speaker allocation structure ++ */ ++struct hdmi_codec_cea_spk_alloc { ++ const int ca_id; ++ unsigned int n_ch; ++ unsigned long mask; ++}; ++ ++/* Channel maps stereo HDMI */ ++const struct snd_pcm_chmap_elem hdmi_codec_stereo_chmaps[] = { ++ { .channels = 2, ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, ++ { } ++}; ++ ++/* Channel maps for multi-channel playbacks, up to 8 n_ch */ ++const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { ++ { .channels = 2, /* CA_ID 0x00 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, ++ { .channels = 4, /* CA_ID 0x01 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA } }, ++ { .channels = 4, /* CA_ID 0x02 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC } }, ++ { .channels = 4, /* CA_ID 0x03 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC } }, ++ { .channels = 6, /* CA_ID 0x04 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 6, /* CA_ID 0x05 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 6, /* CA_ID 0x06 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 6, /* CA_ID 0x07 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 6, /* CA_ID 0x08 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, ++ { .channels = 6, /* CA_ID 0x09 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, ++ { .channels = 6, /* CA_ID 0x0A */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, ++ { .channels = 6, /* CA_ID 0x0B */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, ++ { .channels = 8, /* CA_ID 0x0C */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 8, /* CA_ID 0x0D */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 8, /* CA_ID 0x0E */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 8, /* CA_ID 0x0F */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } }, ++ { .channels = 8, /* CA_ID 0x10 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } }, ++ { .channels = 8, /* CA_ID 0x11 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } }, ++ { .channels = 8, /* CA_ID 0x12 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } }, ++ { .channels = 8, /* CA_ID 0x13 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, ++ SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } }, ++ { .channels = 8, /* CA_ID 0x14 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x15 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x16 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x17 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x18 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x19 */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x1A */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x1B */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x1C */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x1D */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x1E */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { .channels = 8, /* CA_ID 0x1F */ ++ .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE, ++ SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, ++ SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } }, ++ { } ++}; ++ ++/* ++ * hdmi_codec_channel_alloc: speaker configuration available for CEA ++ * ++ * This is an ordered list that must match with hdmi_codec_8ch_chmaps struct ++ * The preceding ones have better chances to be selected by ++ * hdmi_codec_get_ch_alloc_table_idx(). ++ */ ++static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { ++ { .ca_id = 0x00, .n_ch = 2, ++ .mask = FL | FR}, ++ /* 2.1 */ ++ { .ca_id = 0x01, .n_ch = 4, ++ .mask = FL | FR | LFE}, ++ /* Dolby Surround */ ++ { .ca_id = 0x02, .n_ch = 4, ++ .mask = FL | FR | FC }, ++ /* surround51 */ ++ { .ca_id = 0x0b, .n_ch = 6, ++ .mask = FL | FR | LFE | FC | RL | RR}, ++ /* surround40 */ ++ { .ca_id = 0x08, .n_ch = 6, ++ .mask = FL | FR | RL | RR }, ++ /* surround41 */ ++ { .ca_id = 0x09, .n_ch = 6, ++ .mask = FL | FR | LFE | RL | RR }, ++ /* surround50 */ ++ { .ca_id = 0x0a, .n_ch = 6, ++ .mask = FL | FR | FC | RL | RR }, ++ /* 6.1 */ ++ { .ca_id = 0x0f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | RC }, ++ /* surround71 */ ++ { .ca_id = 0x13, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC }, ++ /* others */ ++ { .ca_id = 0x03, .n_ch = 8, ++ .mask = FL | FR | LFE | FC }, ++ { .ca_id = 0x04, .n_ch = 8, ++ .mask = FL | FR | RC}, ++ { .ca_id = 0x05, .n_ch = 8, ++ .mask = FL | FR | LFE | RC }, ++ { .ca_id = 0x06, .n_ch = 8, ++ .mask = FL | FR | FC | RC }, ++ { .ca_id = 0x07, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RC }, ++ { .ca_id = 0x0c, .n_ch = 8, ++ .mask = FL | FR | RC | RL | RR }, ++ { .ca_id = 0x0d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RC }, ++ { .ca_id = 0x0e, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR | RC }, ++ { .ca_id = 0x10, .n_ch = 8, ++ .mask = FL | FR | RL | RR | RLC | RRC }, ++ { .ca_id = 0x11, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x12, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR | RLC | RRC }, ++ { .ca_id = 0x14, .n_ch = 8, ++ .mask = FL | FR | FLC | FRC }, ++ { .ca_id = 0x15, .n_ch = 8, ++ .mask = FL | FR | LFE | FLC | FRC }, ++ { .ca_id = 0x16, .n_ch = 8, ++ .mask = FL | FR | FC | FLC | FRC }, ++ { .ca_id = 0x17, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | FLC | FRC }, ++ { .ca_id = 0x18, .n_ch = 8, ++ .mask = FL | FR | RC | FLC | FRC }, ++ { .ca_id = 0x19, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FLC | FRC }, ++ { .ca_id = 0x1a, .n_ch = 8, ++ .mask = FL | FR | RC | FC | FLC | FRC }, ++ { .ca_id = 0x1b, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FC | FLC | FRC }, ++ { .ca_id = 0x1c, .n_ch = 8, ++ .mask = FL | FR | RL | RR | FLC | FRC }, ++ { .ca_id = 0x1d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | FLC | FRC }, ++ { .ca_id = 0x1e, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR | FLC | FRC }, ++ { .ca_id = 0x1f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, ++}; ++ + struct hdmi_codec_priv { + struct hdmi_codec_pdata hcd; + struct snd_soc_dai_driver *daidrv; +@@ -41,6 +293,8 @@ struct hdmi_codec_priv { + struct notifier_block nb; + unsigned int jack_status; + unsigned int mode; ++ struct snd_pcm_chmap *chmap_info; ++ unsigned int chmap_idx; + }; + + static const struct snd_soc_dapm_widget hdmi_widgets[] = { +@@ -109,6 +363,83 @@ static int hdmi_audio_mode_put(struct snd_kcontrol *kcontrol, + return 0; + } + ++static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc) ++{ ++ int i; ++ const unsigned long hdmi_codec_eld_spk_alloc_bits[] = { ++ [0] = FL | FR, [1] = LFE, [2] = FC, [3] = RL | RR, ++ [4] = RC, [5] = FLC | FRC, [6] = RLC | RRC, ++ }; ++ unsigned long spk_mask = 0; ++ ++ for (i = 0; i < ARRAY_SIZE(hdmi_codec_eld_spk_alloc_bits); i++) { ++ if (spk_alloc & (1 << i)) ++ spk_mask |= hdmi_codec_eld_spk_alloc_bits[i]; ++ } ++ ++ return spk_mask; ++} ++ ++void hdmi_codec_eld_chmap(struct hdmi_codec_priv *hcp) ++{ ++ u8 spk_alloc; ++ unsigned long spk_mask; ++ ++ spk_alloc = drm_eld_get_spk_alloc(hcp->eld); ++ spk_mask = hdmi_codec_spk_mask_from_alloc(spk_alloc); ++ ++ /* Detect if only stereo supported, else return 8 channels mappings */ ++ if ((spk_mask & ~(FL | FR)) && hcp->chmap_info->max_channels > 2) ++ hcp->chmap_info->chmap = hdmi_codec_8ch_chmaps; ++ else ++ hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; ++} ++ ++static int hdmi_codec_get_ch_alloc_table_idx(struct hdmi_codec_priv *hcp, ++ unsigned char channels) ++{ ++ int i; ++ u8 spk_alloc; ++ unsigned long spk_mask; ++ const struct hdmi_codec_cea_spk_alloc *cap = hdmi_codec_channel_alloc; ++ ++ spk_alloc = drm_eld_get_spk_alloc(hcp->eld); ++ spk_mask = hdmi_codec_spk_mask_from_alloc(spk_alloc); ++ ++ for (i = 0; i < ARRAY_SIZE(hdmi_codec_channel_alloc); i++, cap++) { ++ /* If spk_alloc == 0, HDMI is unplugged return stereo config*/ ++ if (!spk_alloc && cap->ca_id == 0) ++ return i; ++ if (cap->n_ch != channels) ++ continue; ++ if (!(cap->mask == (spk_mask & cap->mask))) ++ continue; ++ return i; ++ } ++ ++ return -EINVAL; ++} ++static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ unsigned const char *map; ++ unsigned int i; ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ struct hdmi_codec_priv *hcp = info->private_data; ++ ++ map = info->chmap[hcp->chmap_idx].map; ++ ++ for (i = 0; i < info->max_channels; i++) { ++ if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN) ++ ucontrol->value.integer.value[i] = 0; ++ else ++ ucontrol->value.integer.value[i] = map[i]; ++ } ++ ++ return 0; ++} ++ ++ + static const struct snd_kcontrol_new hdmi_controls[] = { + { + .access = SNDRV_CTL_ELEM_ACCESS_READ | +@@ -184,6 +515,9 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, + ret = snd_pcm_hw_constraint_eld(substream->runtime, + hcp->eld); + mutex_unlock(&hcp->eld_lock); ++ ++ /* Select chmap supported */ ++ hdmi_codec_eld_chmap(hcp); + } + return ret; + } +@@ -201,6 +535,7 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream, + + WARN_ON(hcp->current_stream != substream); + ++ hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; + hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); + + mutex_lock(&hcp->current_stream_lock); +@@ -221,7 +556,7 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, + .dig_subframe = { 0 }, + } + }; +- int ret; ++ int ret, idx; + + dev_dbg(dai->dev, "%s() width %d rate %d channels %d\n", __func__, + params_width(params), params_rate(params), +@@ -248,6 +583,17 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, + hp.cea.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM; + hp.cea.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM; + ++ /* Select a channel allocation that matches with ELD and pcm channels */ ++ idx = hdmi_codec_get_ch_alloc_table_idx(hcp, hp.cea.channels); ++ if (idx < 0) { ++ dev_err(dai->dev, "Not able to map channels to speakers (%d)\n", ++ idx); ++ hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; ++ return idx; ++ } ++ hp.cea.channel_allocation = hdmi_codec_channel_alloc[idx].ca_id; ++ hcp->chmap_idx = hdmi_codec_channel_alloc[idx].ca_id; ++ + hp.sample_width = params_width(params); + hp.sample_rate = params_rate(params); + hp.channels = params_channels(params); +@@ -377,6 +723,32 @@ static const struct snd_soc_dai_ops hdmi_dai_ops = { + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE |\ + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE) + ++static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_dai_driver *drv = dai->driver; ++ struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); ++ int ret; ++ ++ dev_dbg(dai->dev, "%s()\n", __func__); ++ ++ ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK, ++ NULL, drv->playback.channels_max, 0, ++ &hcp->chmap_info); ++ if (ret < 0) ++ return ret; ++ ++ /* override handlers */ ++ hcp->chmap_info->private_data = hcp; ++ hcp->chmap_info->kctl->get = hdmi_codec_chmap_ctl_get; ++ ++ /* default chmap supported is stereo */ ++ hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; ++ hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; ++ ++ return 0; ++} ++ + static struct snd_soc_dai_driver hdmi_i2s_dai = { + .name = "i2s-hifi", + .id = DAI_ID_I2S, +@@ -389,6 +761,7 @@ static struct snd_soc_dai_driver hdmi_i2s_dai = { + .sig_bits = 24, + }, + .ops = &hdmi_dai_ops, ++ .pcm_new = hdmi_codec_pcm_new, + }; + + static const struct snd_soc_dai_driver hdmi_spdif_dai = { +@@ -402,6 +775,7 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { + .formats = SPDIF_FORMATS, + }, + .ops = &hdmi_dai_ops, ++ .pcm_new = hdmi_codec_pcm_new, + }; + + static struct snd_soc_codec_driver hdmi_codec = { +@@ -534,6 +908,7 @@ static int hdmi_codec_remove(struct platform_device *pdev) + { + struct hdmi_codec_priv *hcp = platform_get_drvdata(pdev); + ++ kfree(hcp->chmap_info); + hdmi_unregister_notifier(&hcp->nb); + snd_soc_unregister_codec(&pdev->dev); + return 0; + +From 52c48ffd0956821dd3f1315b9ec3fd2a677b2b63 Mon Sep 17 00:00:00 2001 +From: Christophe Jaillet +Date: Thu, 15 Jun 2017 07:53:11 +0200 +Subject: [PATCH] UPSTREAM: ASoC: rockchip: Fix an error handling in + 'rockchip_i2s_probe' + +If this memory allocation fail, we must disable what has been enabled. +Do not return immediately but go thrue the error handling path instead. + +Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code. + +Signed-off-by: Christophe JAILLET +Signed-off-by: Mark Brown +(cherry picked from commit c3a3d3c41b74b05267bab6173f2a8224a1443ba6) +--- + sound/soc/rockchip/rockchip_i2s.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c +index b359639c1038..02ff642499bf 100644 +--- a/sound/soc/rockchip/rockchip_i2s.c ++++ b/sound/soc/rockchip/rockchip_i2s.c +@@ -658,12 +658,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev) + goto err_pm_disable; + } + +- soc_dai = devm_kzalloc(&pdev->dev, ++ soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai, + sizeof(*soc_dai), GFP_KERNEL); +- if (!soc_dai) +- return -ENOMEM; ++ if (!soc_dai) { ++ ret = -ENOMEM; ++ goto err_pm_disable; ++ } + +- memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai)); + if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) { + if (val >= 2 && val <= 8) + soc_dai->playback.channels_max = val; + +From 7b9368e1f2d50d7ca5b07ea50240fd8f45d884fe Mon Sep 17 00:00:00 2001 +From: Markus Elfring +Date: Thu, 10 Aug 2017 18:38:09 +0200 +Subject: [PATCH] UPSTREAM: ASoC: rockchip: Delete an error message for a + failed memory allocation in rockchip_i2s_probe() + +Omit an extra message for a memory allocation failure in this function. + +This issue was detected by using the Coccinelle software. + +Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf +Signed-off-by: Markus Elfring +Signed-off-by: Mark Brown +(cherry picked from commit b48b2710913d583ff93c365413532e1a7cd60d84) +--- + sound/soc/rockchip/rockchip_i2s.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c +index 02ff642499bf..16ff8d5e0033 100644 +--- a/sound/soc/rockchip/rockchip_i2s.c ++++ b/sound/soc/rockchip/rockchip_i2s.c +@@ -594,10 +594,8 @@ static int rockchip_i2s_probe(struct platform_device *pdev) + int val; + + i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); +- if (!i2s) { +- dev_err(&pdev->dev, "Can't allocate rk_i2s_dev\n"); ++ if (!i2s) + return -ENOMEM; +- } + + i2s->dev = &pdev->dev; + + +From f217d206adafde4eb886ffbd5ecd7779c37438ef Mon Sep 17 00:00:00 2001 +From: John Keeping +Date: Thu, 14 Sep 2017 16:58:55 +0100 +Subject: [PATCH] UPSTREAM: ASoC: rockchip: i2s: fix unbalanced clk_disable + +mclk is enabled and disabled only in i2s_runtime_{resume,suspend}() and +we ensure that the device is runtime suspended before reaching this +clk_disable_unprepare() call, so it is wrong to call it again here. + +Signed-off-by: John Keeping +Signed-off-by: Mark Brown +(cherry picked from commit 32debfcd3ff0939c93238ddde03ffcc96cca5c60) +--- + sound/soc/rockchip/rockchip_i2s.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c +index 16ff8d5e0033..986ad2efc8e9 100644 +--- a/sound/soc/rockchip/rockchip_i2s.c ++++ b/sound/soc/rockchip/rockchip_i2s.c +@@ -727,7 +727,6 @@ static int rockchip_i2s_remove(struct platform_device *pdev) + if (!pm_runtime_status_suspended(&pdev->dev)) + i2s_runtime_suspend(&pdev->dev); + +- clk_disable_unprepare(i2s->mclk); + clk_disable_unprepare(i2s->hclk); + + return 0; + +From 9cca8ff3584aedce10d3099b504e66737c9c9e44 Mon Sep 17 00:00:00 2001 +From: John Keeping +Date: Mon, 8 Jan 2018 16:01:04 +0000 +Subject: [PATCH] UPSTREAM: ASoC: rockchip: i2s: fix playback after runtime + resume + +When restoring registers during runtime resume, we must not write to +I2S_TXDR which is the transmit FIFO as this queues up a sample to be +output and pushes all of the output channels down by one. + +This can be demonstrated with the speaker-test utility: + + for i in a b c; do speaker-test -c 2 -s 1; done + +which should play a test through the left speaker three times but if the +I2S hardware starts runtime suspended the first sample will be played +through the right speaker. + +Fix this by marking I2S_TXDR as volatile (which also requires marking it +as readble, even though it technically isn't). This seems to be the +most robust fix, the alternative of giving I2S_TXDR a default value is +more fragile since it does not prevent regcache writing to the register +in all circumstances. + +While here, also fix the configuration of I2S_RXDR and I2S_FIFOLR; these +are not writable so they do not suffer from the same problem as I2S_TXDR +but reading from I2S_RXDR does suffer from a similar problem. + +Fixes: f0447f6cbb20 ("ASoC: rockchip: i2s: restore register during runtime_suspend/resume cycle", 2016-09-07) +Signed-off-by: John Keeping +(cherry picked from commit c66234cfedfc3e6e3b62563a5f2c1562be09a35d) +--- + sound/soc/rockchip/rockchip_i2s.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c +index 986ad2efc8e9..5297373fe6c4 100644 +--- a/sound/soc/rockchip/rockchip_i2s.c ++++ b/sound/soc/rockchip/rockchip_i2s.c +@@ -514,6 +514,7 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg) + case I2S_INTCR: + case I2S_XFER: + case I2S_CLR: ++ case I2S_TXDR: + case I2S_RXDR: + case I2S_FIFOLR: + case I2S_INTSR: +@@ -528,6 +529,9 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) + switch (reg) { + case I2S_INTSR: + case I2S_CLR: ++ case I2S_FIFOLR: ++ case I2S_TXDR: ++ case I2S_RXDR: + return true; + default: + return false; +@@ -537,6 +541,8 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) + static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) + { + switch (reg) { ++ case I2S_RXDR: ++ return true; + default: + return false; + } + +From 7c877ceaa52d81023ebda69e3d90f54ab8403798 Mon Sep 17 00:00:00 2001 +From: Romain Perier +Date: Fri, 14 Apr 2017 10:31:12 +0200 +Subject: [PATCH] UPSTREAM: drm: dw-hdmi: add specific I2S and AHB functions + for stream handling + +Currently, CTS+N is forced to zero as a workaround of the IP block for +i.MX platforms. This is requested in the datasheet of the corresponding +IP for AHB mode only. However, we have seen that it introduces glitches +or delays when playing a sound on HDMI for I2S mode. This proves that we +cannot keep the current functions for handling audio stream as-is if +these contain workaround that are specific to a mode. + +This commit introduces two callbacks, one for each variant. +dw_hdmi_setup defines the right function depending on the detected +variant. Then, the exported functions dw_hdmi_audio_enable and +dw_hdmi_audio_disable calls the corresponding callbacks + +Reviewed-by: Neil Armstrong +Signed-off-by: Romain Perier +Signed-off-by: Archit Taneja +Link: http://patchwork.freedesktop.org/patch/msgid/20170414083113.4255-2-romain.perier@collabora.com +(cherry picked from commit a7d555d2f2bd675d641e742a202a5e4b37d4d019) +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 8cb2cb4e61a6..8726498e9f73 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -263,6 +263,9 @@ struct dw_hdmi { + u8 (*read)(struct dw_hdmi *hdmi, int offset); + + bool initialized; /* hdmi is enabled before bind */ ++ ++ void (*enable_audio)(struct dw_hdmi *hdmi); ++ void (*disable_audio)(struct dw_hdmi *hdmi); + }; + + #define HDMI_IH_PHY_STAT0_RX_SENSE \ +@@ -821,13 +824,29 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) + } + EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate); + ++static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) ++{ ++ hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); ++} ++ ++static void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi) ++{ ++ hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); ++} ++ ++static void dw_hdmi_i2s_audio_enable(struct dw_hdmi *hdmi) ++{ ++ hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); ++} ++ + void dw_hdmi_audio_enable(struct dw_hdmi *hdmi) + { + unsigned long flags; + + spin_lock_irqsave(&hdmi->audio_lock, flags); + hdmi->audio_enable = true; +- hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); ++ if (hdmi->enable_audio) ++ hdmi->enable_audio(hdmi); + spin_unlock_irqrestore(&hdmi->audio_lock, flags); + } + EXPORT_SYMBOL_GPL(dw_hdmi_audio_enable); +@@ -838,7 +857,8 @@ void dw_hdmi_audio_disable(struct dw_hdmi *hdmi) + + spin_lock_irqsave(&hdmi->audio_lock, flags); + hdmi->audio_enable = false; +- hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); ++ if (hdmi->disable_audio) ++ hdmi->disable_audio(hdmi); + spin_unlock_irqrestore(&hdmi->audio_lock, flags); + } + EXPORT_SYMBOL_GPL(dw_hdmi_audio_disable); +@@ -3706,6 +3726,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master, + audio.irq = irq; + audio.hdmi = hdmi; + audio.eld = hdmi->connector.eld; ++ hdmi->enable_audio = dw_hdmi_ahb_audio_enable; ++ hdmi->disable_audio = dw_hdmi_ahb_audio_disable; + + pdevinfo.name = "dw-hdmi-ahb-audio"; + pdevinfo.data = &audio; +@@ -3719,6 +3741,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master, + audio.write = hdmi_writeb; + audio.read = hdmi_readb; + audio.mod = hdmi_modb; ++ hdmi->enable_audio = dw_hdmi_i2s_audio_enable; + + pdevinfo.name = "dw-hdmi-i2s-audio"; + pdevinfo.data = &audio; + +From 8b1551df18617eba99d59f89724191954a7213a4 Mon Sep 17 00:00:00 2001 +From: Romain Perier +Date: Thu, 20 Apr 2017 14:34:34 +0530 +Subject: [PATCH] UPSTREAM: drm: dw-hdmi: gate audio clock from the I2S + enablement callbacks + +Currently, the audio sampler clock is enabled from dw_hdmi_setup() at +step E. and is kept enabled for later use. This clock should be enabled +and disabled along with the actual audio stream and not always on (that +is bad for PM). Furthermore, as described by the datasheet, the I2S +variant needs to gate/ungate the clock when the stream is +enabled/disabled. + +This commit adds a parameter to hdmi_audio_enable_clk() that controls +when the audio sample clock must be enabled or disabled. Then, it adds +the call to this function from dw_hdmi_i2s_audio_enable() and +dw_hdmi_i2s_audio_disable(). + +Reviewed-by: Neil Armstrong +Signed-off-by: Romain Perier +Link: http://patchwork.freedesktop.org/patch/msgid/20170414083113.4255-3-romain.perier@collabora.com +Signed-off-by: Archit Taneja +(cherry picked from commit 57fbc05585a9c841c910677228f1e3f8a3a62801) +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 8726498e9f73..17c182cb07b5 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -824,6 +824,15 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) + } + EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate); + ++static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) ++{ ++ if (enable) ++ hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE; ++ else ++ hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE; ++ hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); ++} ++ + static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) + { + hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); +@@ -837,6 +846,12 @@ static void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi) + static void dw_hdmi_i2s_audio_enable(struct dw_hdmi *hdmi) + { + hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); ++ hdmi_enable_audio_clk(hdmi, true); ++} ++ ++static void dw_hdmi_i2s_audio_disable(struct dw_hdmi *hdmi) ++{ ++ hdmi_enable_audio_clk(hdmi, false); + } + + void dw_hdmi_audio_enable(struct dw_hdmi *hdmi) +@@ -2149,12 +2164,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) + HDMI_MC_FLOWCTRL); + } + +-static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi) +-{ +- hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE; +- hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); +-} +- + /* Workaround to clear the overflow condition */ + static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) + { +@@ -2306,7 +2315,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + + /* HDMI Initialization Step E - Configure audio */ + hdmi_clk_regenerator_update_pixel_clock(hdmi); +- hdmi_enable_audio_clk(hdmi); ++ hdmi_enable_audio_clk(hdmi, true); + } + + /* not for DVI mode */ +@@ -3742,6 +3751,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master, + audio.read = hdmi_readb; + audio.mod = hdmi_modb; + hdmi->enable_audio = dw_hdmi_i2s_audio_enable; ++ hdmi->disable_audio = dw_hdmi_i2s_audio_disable; + + pdevinfo.name = "dw-hdmi-i2s-audio"; + pdevinfo.data = &audio; + +From 442b913082d21de7a8364344feb520946413da5b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 7 Aug 2017 22:24:15 +0200 +Subject: [PATCH] drm: dw-hdmi-i2s: sync with upstream + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 1 - + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 20 +++++++++++++------- + 2 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +index 3930ba04977b..af7f39c85ba4 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +@@ -14,7 +14,6 @@ struct dw_hdmi_audio_data { + + struct dw_hdmi_i2s_audio_data { + struct dw_hdmi *hdmi; +- struct platform_device *pdev; + + void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); + u8 (*read)(struct dw_hdmi *hdmi, int offset); +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index f1f62d8c1d16..5ff993a35ab6 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -16,7 +16,8 @@ + + #define DRIVER_NAME "dw-hdmi-i2s-audio" + +-static inline void hdmi_write(struct dw_hdmi_i2s_audio_data *audio, u8 val, int offset) ++static inline void hdmi_write(struct dw_hdmi_i2s_audio_data *audio, ++ u8 val, int offset) + { + struct dw_hdmi *hdmi = audio->hdmi; + +@@ -220,6 +221,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) + struct dw_hdmi_i2s_audio_data *audio = pdev->dev.platform_data; + struct platform_device_info pdevinfo; + struct hdmi_codec_pdata pdata; ++ struct platform_device *platform; + + pdata.ops = &dw_hdmi_i2s_ops; + pdata.i2s = 1; +@@ -234,23 +236,27 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) + pdevinfo.size_data = sizeof(pdata); + pdevinfo.dma_mask = DMA_BIT_MASK(32); + +- audio->pdev = platform_device_register_full(&pdevinfo); +- return IS_ERR_OR_NULL(audio->pdev); ++ platform = platform_device_register_full(&pdevinfo); ++ if (IS_ERR(platform)) ++ return PTR_ERR(platform); ++ ++ dev_set_drvdata(&pdev->dev, platform); ++ ++ return 0; + } + + static int snd_dw_hdmi_remove(struct platform_device *pdev) + { +- struct dw_hdmi_i2s_audio_data *audio = pdev->dev.platform_data; ++ struct platform_device *platform = dev_get_drvdata(&pdev->dev); + +- if (!IS_ERR_OR_NULL(audio->pdev)) +- platform_device_unregister(audio->pdev); ++ platform_device_unregister(platform); + + return 0; + } + + static struct platform_driver snd_dw_hdmi_driver = { + .probe = snd_dw_hdmi_probe, +- .remove = snd_dw_hdmi_remove, ++ .remove = snd_dw_hdmi_remove, + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + +From 1d3de24bd61e0bfba1a9e042e040fa65346ccd9d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 2 Apr 2017 11:33:39 +0200 +Subject: [PATCH] drm: dw-hdmi-i2s: implement get_eld + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 1 + + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 12 ++++++++++++ + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 1 + + 3 files changed, 14 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +index af7f39c85ba4..c5ace7808fdf 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +@@ -14,6 +14,7 @@ struct dw_hdmi_audio_data { + + struct dw_hdmi_i2s_audio_data { + struct dw_hdmi *hdmi; ++ u8 *eld; + + void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); + u8 (*read)(struct dw_hdmi *hdmi, int offset); +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index 5ff993a35ab6..e7312571e2cb 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -11,6 +11,8 @@ + + #include + ++#include /* This is only to get MAX_ELD_BYTES */ ++ + #include "dw-hdmi.h" + #include "dw-hdmi-audio.h" + +@@ -211,9 +213,19 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) + hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); + } + ++static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, u8 *buf, size_t len) ++{ ++ struct dw_hdmi_i2s_audio_data *audio = data; ++ ++ memcpy(buf, audio->eld, min(len, (size_t)MAX_ELD_BYTES)); ++ ++ return 0; ++} ++ + static struct hdmi_codec_ops dw_hdmi_i2s_ops = { + .hw_params = dw_hdmi_i2s_hw_params, + .audio_shutdown = dw_hdmi_i2s_audio_shutdown, ++ .get_eld = dw_hdmi_i2s_get_eld, + }; + + static int snd_dw_hdmi_probe(struct platform_device *pdev) +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 17c182cb07b5..df1ea752ac3d 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -3750,6 +3750,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master, + audio.write = hdmi_writeb; + audio.read = hdmi_readb; + audio.mod = hdmi_modb; ++ audio.eld = hdmi->connector.eld; + hdmi->enable_audio = dw_hdmi_i2s_audio_enable; + hdmi->disable_audio = dw_hdmi_i2s_audio_disable; + + +From 1e16f2f6b861a7273d922c9251665acec542eed9 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 17 Apr 2017 13:09:16 +0200 +Subject: [PATCH] drm: dw-hdmi-i2s: configure channel allocation + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index e7312571e2cb..1d4570e3fbed 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -188,7 +188,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, + hdmi_write(audio, 0x00, HDMI_FC_AUDICONF1); + + /* Set Channel Allocation */ +- hdmi_write(audio, 0x00, HDMI_FC_AUDICONF2); ++ hdmi_write(audio, hparms->cea.channel_allocation, HDMI_FC_AUDICONF2); + + /* Set LFEPBLDOWN-MIX INH and LSV */ + hdmi_write(audio, 0x00, HDMI_FC_AUDICONF3); + +From 747742580e282f4374100909906f6957c997c4a3 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 14 Aug 2017 00:14:05 +0200 +Subject: [PATCH] ASoC: hdmi-codec: reorder channel map + +--- + sound/soc/codecs/hdmi-codec.c | 113 +++++++++++++++++++----------------------- + 1 file changed, 52 insertions(+), 61 deletions(-) + +diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c +index cb78d8971b41..b74659bc3bbc 100644 +--- a/sound/soc/codecs/hdmi-codec.c ++++ b/sound/soc/codecs/hdmi-codec.c +@@ -205,78 +205,69 @@ const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { + */ + static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { + { .ca_id = 0x00, .n_ch = 2, +- .mask = FL | FR}, +- /* 2.1 */ +- { .ca_id = 0x01, .n_ch = 4, +- .mask = FL | FR | LFE}, +- /* Dolby Surround */ ++ .mask = FL | FR }, ++ { .ca_id = 0x03, .n_ch = 4, ++ .mask = FL | FR | LFE | FC }, + { .ca_id = 0x02, .n_ch = 4, + .mask = FL | FR | FC }, +- /* surround51 */ ++ { .ca_id = 0x01, .n_ch = 4, ++ .mask = FL | FR | LFE }, + { .ca_id = 0x0b, .n_ch = 6, +- .mask = FL | FR | LFE | FC | RL | RR}, +- /* surround40 */ +- { .ca_id = 0x08, .n_ch = 6, +- .mask = FL | FR | RL | RR }, +- /* surround41 */ +- { .ca_id = 0x09, .n_ch = 6, +- .mask = FL | FR | LFE | RL | RR }, +- /* surround50 */ ++ .mask = FL | FR | LFE | FC | RL | RR }, + { .ca_id = 0x0a, .n_ch = 6, + .mask = FL | FR | FC | RL | RR }, +- /* 6.1 */ +- { .ca_id = 0x0f, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RL | RR | RC }, +- /* surround71 */ ++ { .ca_id = 0x09, .n_ch = 6, ++ .mask = FL | FR | LFE | RL | RR }, ++ { .ca_id = 0x08, .n_ch = 6, ++ .mask = FL | FR | RL | RR }, ++ { .ca_id = 0x07, .n_ch = 6, ++ .mask = FL | FR | LFE | FC | RC }, ++ { .ca_id = 0x06, .n_ch = 6, ++ .mask = FL | FR | FC | RC }, ++ { .ca_id = 0x05, .n_ch = 6, ++ .mask = FL | FR | LFE | RC }, ++ { .ca_id = 0x04, .n_ch = 6, ++ .mask = FL | FR | RC }, + { .ca_id = 0x13, .n_ch = 8, + .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC }, +- /* others */ +- { .ca_id = 0x03, .n_ch = 8, +- .mask = FL | FR | LFE | FC }, +- { .ca_id = 0x04, .n_ch = 8, +- .mask = FL | FR | RC}, +- { .ca_id = 0x05, .n_ch = 8, +- .mask = FL | FR | LFE | RC }, +- { .ca_id = 0x06, .n_ch = 8, +- .mask = FL | FR | FC | RC }, +- { .ca_id = 0x07, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RC }, +- { .ca_id = 0x0c, .n_ch = 8, +- .mask = FL | FR | RC | RL | RR }, +- { .ca_id = 0x0d, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | RC }, +- { .ca_id = 0x0e, .n_ch = 8, +- .mask = FL | FR | FC | RL | RR | RC }, +- { .ca_id = 0x10, .n_ch = 8, +- .mask = FL | FR | RL | RR | RLC | RRC }, +- { .ca_id = 0x11, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, + { .ca_id = 0x12, .n_ch = 8, + .mask = FL | FR | FC | RL | RR | RLC | RRC }, +- { .ca_id = 0x14, .n_ch = 8, +- .mask = FL | FR | FLC | FRC }, +- { .ca_id = 0x15, .n_ch = 8, +- .mask = FL | FR | LFE | FLC | FRC }, +- { .ca_id = 0x16, .n_ch = 8, +- .mask = FL | FR | FC | FLC | FRC }, +- { .ca_id = 0x17, .n_ch = 8, +- .mask = FL | FR | LFE | FC | FLC | FRC }, +- { .ca_id = 0x18, .n_ch = 8, +- .mask = FL | FR | RC | FLC | FRC }, +- { .ca_id = 0x19, .n_ch = 8, +- .mask = FL | FR | LFE | RC | FLC | FRC }, +- { .ca_id = 0x1a, .n_ch = 8, +- .mask = FL | FR | RC | FC | FLC | FRC }, +- { .ca_id = 0x1b, .n_ch = 8, +- .mask = FL | FR | LFE | RC | FC | FLC | FRC }, +- { .ca_id = 0x1c, .n_ch = 8, +- .mask = FL | FR | RL | RR | FLC | FRC }, +- { .ca_id = 0x1d, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | FLC | FRC }, + { .ca_id = 0x1e, .n_ch = 8, + .mask = FL | FR | FC | RL | RR | FLC | FRC }, +- { .ca_id = 0x1f, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, ++ { .ca_id = 0x11, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | FLC | FRC }, ++ { .ca_id = 0x10, .n_ch = 8, ++ .mask = FL | FR | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1c, .n_ch = 8, ++ .mask = FL | FR | RL | RR | FLC | FRC }, ++ { .ca_id = 0x0f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | RC }, ++ { .ca_id = 0x1b, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FC | FLC | FRC }, ++ { .ca_id = 0x0e, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR | RC }, ++ { .ca_id = 0x1a, .n_ch = 8, ++ .mask = FL | FR | RC | FC | FLC | FRC }, ++ { .ca_id = 0x0d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RC }, ++ { .ca_id = 0x19, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FLC | FRC }, ++ { .ca_id = 0x0c, .n_ch = 8, ++ .mask = FL | FR | RC | RL | RR }, ++ { .ca_id = 0x18, .n_ch = 8, ++ .mask = FL | FR | RC | FLC | FRC }, ++ { .ca_id = 0x17, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | FLC | FRC }, ++ { .ca_id = 0x16, .n_ch = 8, ++ .mask = FL | FR | FC | FLC | FRC }, ++ { .ca_id = 0x15, .n_ch = 8, ++ .mask = FL | FR | LFE | FLC | FRC }, ++ { .ca_id = 0x14, .n_ch = 8, ++ .mask = FL | FR | FLC | FRC }, + }; + + struct hdmi_codec_priv { + +From 1cdb1f115b4bc9781c90d01d914dd4bbac6d0977 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 27 Aug 2017 23:32:40 +0200 +Subject: [PATCH] ASoC: codecs: rk3328: limit to working rates + +--- + sound/soc/codecs/rk3328_codec.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c +index af1b7429b6d4..d0b4578ffa0e 100644 +--- a/sound/soc/codecs/rk3328_codec.c ++++ b/sound/soc/codecs/rk3328_codec.c +@@ -354,7 +354,12 @@ static struct snd_soc_dai_driver rk3328_dai[] = { + .stream_name = "HIFI Playback", + .channels_min = 1, + .channels_max = 2, +- .rates = SNDRV_PCM_RATE_8000_96000, ++ .rates = (SNDRV_PCM_RATE_8000 | ++ SNDRV_PCM_RATE_16000 | ++ SNDRV_PCM_RATE_32000 | ++ SNDRV_PCM_RATE_48000 | ++ SNDRV_PCM_RATE_64000 | ++ SNDRV_PCM_RATE_96000), + .formats = (SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S20_3LE | + SNDRV_PCM_FMTBIT_S24_LE | + +From 878d789ff5faa02f0da5e68126e2276124611eeb Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 8 Jul 2018 12:34:43 +0200 +Subject: [PATCH] drm: dw-hdmi: change audio config + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 ++------- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 15 ++++++++++++--- + 2 files changed, 14 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index 1d4570e3fbed..d0904f6b7a82 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -110,8 +110,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, + HDMI_AUD_INT_FIFO_FULL_MSK, HDMI_AUD_INT); + hdmi_update_bits(audio, HDMI_AUD_CONF0_SW_RESET, + HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); +- hdmi_update_bits(audio, HDMI_MC_SWRSTZ_I2S_RESET_MSK, +- HDMI_MC_SWRSTZ_I2S_RESET_MSK, HDMI_MC_SWRSTZ); ++ hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2S_RESET_MSK, HDMI_MC_SWRSTZ); + + switch (hparms->mode) { + case NLPCM: +@@ -193,11 +192,6 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, + /* Set LFEPBLDOWN-MIX INH and LSV */ + hdmi_write(audio, 0x00, HDMI_FC_AUDICONF3); + +- hdmi_update_bits(audio, HDMI_AUD_CONF0_SW_RESET, +- HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); +- hdmi_update_bits(audio, HDMI_MC_SWRSTZ_I2S_RESET_MSK, +- HDMI_MC_SWRSTZ_I2S_RESET_MSK, HDMI_MC_SWRSTZ); +- + dw_hdmi_audio_enable(hdmi); + + return 0; +@@ -211,6 +205,7 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) + dw_hdmi_audio_disable(hdmi); + + hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); ++ hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2S_RESET_MSK, HDMI_MC_SWRSTZ); + } + + static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, u8 *buf, size_t len) +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index df1ea752ac3d..4bf4ff0fd741 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -89,6 +89,7 @@ static const struct dw_hdmi_audio_tmds_n common_tmds_n_table[] = { + { .tmds = 71000000, .n_32k = 4096, .n_44k1 = 7056, .n_48k = 6144, }, + { .tmds = 72000000, .n_32k = 4096, .n_44k1 = 5635, .n_48k = 6144, }, + { .tmds = 73250000, .n_32k = 4096, .n_44k1 = 14112, .n_48k = 6144, }, ++ { .tmds = 74176000, .n_32k = 11648, .n_44k1 = 17836, .n_48k = 11648, }, + { .tmds = 74250000, .n_32k = 4096, .n_44k1 = 6272, .n_48k = 6144, }, + { .tmds = 75000000, .n_32k = 4096, .n_44k1 = 5880, .n_48k = 6144, }, + { .tmds = 78750000, .n_32k = 4096, .n_44k1 = 5600, .n_48k = 6144, }, +@@ -105,13 +106,16 @@ static const struct dw_hdmi_audio_tmds_n common_tmds_n_table[] = { + { .tmds = 119000000, .n_32k = 4096, .n_44k1 = 5544, .n_48k = 6144, }, + { .tmds = 135000000, .n_32k = 4096, .n_44k1 = 5488, .n_48k = 6144, }, + { .tmds = 146250000, .n_32k = 4096, .n_44k1 = 6272, .n_48k = 6144, }, +- { .tmds = 148500000, .n_32k = 4096, .n_44k1 = 5488, .n_48k = 6144, }, ++ { .tmds = 148352000, .n_32k = 11648, .n_44k1 = 8918, .n_48k = 5824, }, ++ { .tmds = 148500000, .n_32k = 4096, .n_44k1 = 6272, .n_48k = 6144, }, + { .tmds = 154000000, .n_32k = 4096, .n_44k1 = 5544, .n_48k = 6144, }, + { .tmds = 162000000, .n_32k = 4096, .n_44k1 = 5684, .n_48k = 6144, }, + + /* For 297 MHz+ HDMI spec have some other rule for setting N */ +- { .tmds = 297000000, .n_32k = 3073, .n_44k1 = 4704, .n_48k = 5120, }, +- { .tmds = 594000000, .n_32k = 3073, .n_44k1 = 9408, .n_48k = 10240, }, ++ { .tmds = 296703000, .n_32k = 5824, .n_44k1 = 4459, .n_48k = 5824, }, ++ { .tmds = 297000000, .n_32k = 3072, .n_44k1 = 4704, .n_48k = 5120, }, ++ { .tmds = 593407000, .n_32k = 5824, .n_44k1 = 8918, .n_48k = 5824, }, ++ { .tmds = 594000000, .n_32k = 3072, .n_44k1 = 9408, .n_48k = 6144, }, + + /* End of table */ + { .tmds = 0, .n_32k = 0, .n_44k1 = 0, .n_48k = 0, }, +@@ -831,6 +835,11 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) + else + hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE; + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); ++ ++ if (enable) { ++ hdmi_set_cts_n(hdmi, 0, 0); ++ hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); ++ } + } + + static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) + +From 6bf23972f26fde1abad52cd1a65d1223d51d47c2 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 8 Jul 2018 12:56:51 +0200 +Subject: [PATCH] WIP: drm: dw-hdmi: use Auto CTS mode + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 52 ++++++++++++++++++------------- + 1 file changed, 31 insertions(+), 21 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 4bf4ff0fd741..2583320f3289 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -643,14 +643,18 @@ static struct i2c_adapter *dw_hdmi_i2c_adapter(struct dw_hdmi *hdmi) + static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts, + unsigned int n) + { +- /* Must be set/cleared first */ +- hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); +- +- /* nshift factor = 0 */ +- hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3); +- +- hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) | +- HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); ++ /* Use Auto CTS mode with CTS is unknown */ ++ if (cts) { ++ /* Must be set/cleared first */ ++ hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); ++ ++ /* nshift factor = 0 */ ++ hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3); ++ ++ hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) | ++ HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); ++ } else ++ hdmi_writeb(hdmi, 0, HDMI_AUD_CTS3); + hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2); + hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1); + +@@ -777,24 +781,30 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi, + { + unsigned long ftdms = pixel_clk; + unsigned int n, cts; ++ u8 config3; + u64 tmp; + + n = hdmi_find_n(hdmi, pixel_clk, sample_rate); + +- /* +- * Compute the CTS value from the N value. Note that CTS and N +- * can be up to 20 bits in total, so we need 64-bit math. Also +- * note that our TDMS clock is not fully accurate; it is accurate +- * to kHz. This can introduce an unnecessary remainder in the +- * calculation below, so we don't try to warn about that. +- */ +- tmp = (u64)ftdms * n; +- do_div(tmp, 128 * sample_rate); +- cts = tmp; ++ config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID); + +- dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n", +- __func__, sample_rate, ftdms / 1000000, (ftdms / 1000) % 1000, +- n, cts); ++ if (config3 & HDMI_CONFIG3_AHBAUDDMA) { ++ /* ++ * Compute the CTS value from the N value. Note that CTS and N ++ * can be up to 20 bits in total, so we need 64-bit math. Also ++ * note that our TDMS clock is not fully accurate; it is accurate ++ * to kHz. This can introduce an unnecessary remainder in the ++ * calculation below, so we don't try to warn about that. ++ */ ++ tmp = (u64)ftdms * n; ++ do_div(tmp, 128 * sample_rate); ++ cts = tmp; ++ ++ dev_dbg(hdmi->dev, "%s: fs=%uHz ftdms=%lu.%03luMHz N=%d cts=%d\n", ++ __func__, sample_rate, ftdms / 1000000, (ftdms / 1000) % 1000, ++ n, cts); ++ } else ++ cts = 0; + + spin_lock_irq(&hdmi->audio_lock); + hdmi->audio_n = n; diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0005-dts.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0005-dts.patch new file mode 100644 index 0000000000..fa68eb7ccc --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0005-dts.patch @@ -0,0 +1,9113 @@ +From 65a89294e3434d03640530a5dda6314dd588f01f Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 1 Jul 2018 23:22:32 +0200 +Subject: [PATCH] arm: dts: rockchip: rk3288: update dtsi + +--- + arch/arm/boot/dts/rk3288.dtsi | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi +index 1b7602f25f34..9cca69f9f5ba 100644 +--- a/arch/arm/boot/dts/rk3288.dtsi ++++ b/arch/arm/boot/dts/rk3288.dtsi +@@ -352,49 +352,57 @@ + + sdmmc: dwmmc@ff0c0000 { + compatible = "rockchip,rk3288-dw-mshc"; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, + <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; + reg = <0x0 0xff0c0000 0x0 0x4000>; ++ resets = <&cru SRST_MMC0>; ++ reset-names = "reset"; + status = "disabled"; + }; + + sdio0: dwmmc@ff0d0000 { + compatible = "rockchip,rk3288-dw-mshc"; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_SDIO0>, <&cru SCLK_SDIO0>, + <&cru SCLK_SDIO0_DRV>, <&cru SCLK_SDIO0_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; + reg = <0x0 0xff0d0000 0x0 0x4000>; ++ resets = <&cru SRST_SDIO0>; ++ reset-names = "reset"; + status = "disabled"; + }; + + sdio1: dwmmc@ff0e0000 { + compatible = "rockchip,rk3288-dw-mshc"; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_SDIO1>, <&cru SCLK_SDIO1>, + <&cru SCLK_SDIO1_DRV>, <&cru SCLK_SDIO1_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; + reg = <0x0 0xff0e0000 0x0 0x4000>; ++ resets = <&cru SRST_SDIO1>; ++ reset-names = "reset"; + status = "disabled"; + }; + + emmc: dwmmc@ff0f0000 { + compatible = "rockchip,rk3288-dw-mshc"; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, + <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; + reg = <0x0 0xff0f0000 0x0 0x4000>; ++ resets = <&cru SRST_EMMC>; ++ reset-names = "reset"; + status = "disabled"; + supports-emmc; + }; +@@ -638,6 +646,7 @@ + compatible = "rockchip,rk3288-tsadc"; + reg = <0x0 0xff280000 0x0 0x100>; + interrupts = ; ++ rockchip,grf = <&grf>; + clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; + clock-names = "tsadc", "apb_pclk"; + assigned-clocks = <&cru SCLK_TSADC>; +@@ -646,7 +655,7 @@ + reset-names = "tsadc-apb"; + pinctrl-names = "init", "default", "sleep"; + pinctrl-0 = <&otp_gpio>; +- pinctrl-1 = <&otp_gpio>; ++ pinctrl-1 = <&otp_out>; + pinctrl-2 = <&otp_gpio>; + #thermal-sensor-cells = <1>; + rockchip,hw-tshut-temp = <120000>; +@@ -1699,6 +1708,7 @@ + operating-points-v2 = <&gpu_opp_table>; + #cooling-cells = <2>; /* min followed by max */ + power-domains = <&power RK3288_PD_GPU>; ++ power-off-delay-ms = <200>; + status = "disabled"; + + upthreshold = <75>; + +From 4cea1d3405885efca9c1d7e80b6eeb52e40d990f Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 13 Aug 2017 10:24:19 +0200 +Subject: [PATCH] arm: dts: rk3288-miniarm: update dts + +--- + arch/arm/boot/dts/rk3288-miniarm.dts | 64 +++++++++++++++++++++++++++++------- + 1 file changed, 53 insertions(+), 11 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288-miniarm.dts b/arch/arm/boot/dts/rk3288-miniarm.dts +index a5c5300797ab..eac9b1501878 100644 +--- a/arch/arm/boot/dts/rk3288-miniarm.dts ++++ b/arch/arm/boot/dts/rk3288-miniarm.dts +@@ -42,11 +42,22 @@ + #include + #include "rk3288.dtsi" + #include "rk3288-rkisp1.dtsi" +-#include "rk3288-linux.dtsi" ++#include "rk3288cg-opp.dtsi" + + / { ++ model = "ASUS Tinker Board"; + compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; + ++ chosen { ++ bootargs = "earlyprintk=uart8250-32bit,0xff690000"; ++ }; ++ ++ cpuinfo { ++ compatible = "rockchip,cpuinfo"; ++ nvmem-cells = <&efuse_id>; ++ nvmem-cell-names = "id"; ++ }; ++ + memory { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x80000000>; +@@ -67,7 +78,7 @@ + wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; +- wifi_chip_type = "ap6212"; ++ wifi_chip_type = "rtl8723bs"; + sdio_vref = <1800>; + WIFI,host_wake_irq = <&gpio4 30 GPIO_ACTIVE_HIGH>; + status = "okay"; +@@ -129,16 +140,16 @@ + linux,default-trigger="mmc0"; + }; + +- led1-led { ++ heartbeat-led { + gpios=<&gpio1 25 GPIO_ACTIVE_HIGH>; +- linux,default-trigger="default-off"; ++ linux,default-trigger="heartbeat"; + }; + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; +- simple-audio-card,name = "rockchip,miniarm-codec"; ++ simple-audio-card,name = "HDMI"; + simple-audio-card,mclk-fs = <512>; + simple-audio-card,cpu { + sound-dai = <&i2s>; +@@ -204,20 +215,34 @@ + cpu0-supply = <&vdd_cpu>; + }; + ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ disable-wp; ++ mmc-ddr-1_8v; ++ mmc-hs200-1_8v; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>; ++ status = "okay"; ++}; ++ + &gmac { + phy-supply = <&vcc33_lan>; + phy-mode = "rgmii"; + clock_in_out = "input"; ++ snps,force_thresh_dma_mode; + snps,reset-gpio = <&gpio4 7 0>; + snps,reset-active-low; +- snps,reset-delays-us = <0 10000 1000000>; ++ snps,reset-delays-us = <0 10000 50000>; + assigned-clocks = <&cru SCLK_MAC>; + assigned-clock-parents = <&ext_gmac>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + &dsi0 { +@@ -238,6 +263,11 @@ + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <0>; ++ rockchip,phy-table = ++ <74250000 0x8009 0x0004 0x0272>, ++ <165000000 0x802b 0x0004 0x0209>, ++ <371250000 0x802d 0x0001 0x0149>, ++ <0 0x0000 0x0000 0x0000>; + status = "okay"; + /* Don't use vopl for HDMI */ + ports { +@@ -545,6 +575,15 @@ + + &i2s { + #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { + status = "okay"; + }; + +@@ -558,7 +597,7 @@ + &sdio0 { + status = "okay"; + clock-frequency = <50000000>; +- clock-freq-min-max = <200000 50000000>; ++ max-frequency = <50000000>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; +@@ -579,7 +618,7 @@ + + &saradc { + vref-supply = <&vcc18_ldo1>; +- status ="okay"; ++ status = "okay"; + }; + + &sdmmc { +@@ -604,7 +643,6 @@ + &tsadc { + rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */ +- pinctrl-1 = <&otp_out>; + status = "okay"; + }; + +@@ -615,6 +653,8 @@ + }; + + &uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_xfer>, <&uart1_cts>, <&uart1_rts>; + status = "okay"; + }; + +@@ -627,6 +667,8 @@ + }; + + &uart4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart4_xfer>, <&uart4_cts>, <&uart4_rts>; + status = "okay"; + }; + +@@ -644,7 +686,7 @@ + }; + + &usb_otg { +- status= "okay"; ++ status = "okay"; + }; + + &vopb { + +From 3da8fccb1f5b73ef313d320925e81bd1b5cacbfa Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Thu, 2 Nov 2017 23:17:46 +0100 +Subject: [PATCH] arm: dts: rk3288-miqi: update dts + +--- + arch/arm/boot/dts/rk3288-miqi.dts | 75 ++++++++++++++++++++++++++------------- + 1 file changed, 50 insertions(+), 25 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288-miqi.dts b/arch/arm/boot/dts/rk3288-miqi.dts +index a2862c6a17f1..9655365db416 100644 +--- a/arch/arm/boot/dts/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rk3288-miqi.dts +@@ -43,11 +43,22 @@ + /dts-v1/; + #include + #include "rk3288.dtsi" +-#include "rk3288-linux.dtsi" ++#include "rk3288cg-opp.dtsi" + + / { ++ model = "mqmaker MiQi"; + compatible = "rockchip,rk3288-miqi", "rockchip,rk3288"; + ++ chosen { ++ bootargs = "earlyprintk=uart8250-32bit,0xff690000"; ++ }; ++ ++ cpuinfo { ++ compatible = "rockchip,cpuinfo"; ++ nvmem-cells = <&efuse_id>; ++ nvmem-cell-names = "id"; ++ }; ++ + memory { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x80000000>; +@@ -56,29 +67,14 @@ + sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; +- simple-audio-card,name = "DW-HDMI"; ++ simple-audio-card,name = "HDMI"; + simple-audio-card,mclk-fs = <512>; +- +- simple-audio-card,dai-link@0 { /* I2S - S/PDIF */ +- format = "i2s"; +- cpu { +- sound-dai = <&i2s>; +- }; +- codec { +- sound-dai = <&hdmi>; +- }; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; + }; +- +- /* +- * If you want to support more cards, +- * you can add more dai-link node, +- * such as +- * +- * simple-audio-card,dai-link@1 { +- * ...... +- * } +- */ +- + }; + + ext_gmac: external-gmac-clock { +@@ -204,6 +200,12 @@ + #size-cells = <0>; + #sound-dai-cells = <0>; + status = "okay"; ++ /* Don't use vopl for HDMI */ ++ ports { ++ hdmi_in: port { ++ /delete-node/ endpoint@1; ++ }; ++ }; + }; + + &hevc_service { +@@ -235,14 +237,14 @@ + clock_in_out = "input"; + snps,reset-gpio = <&gpio4 7 0>; + snps,reset-active-low; +- snps,reset-delays-us = <0 10000 1000000>; ++ snps,reset-delays-us = <0 10000 50000>; + assigned-clocks = <&cru SCLK_MAC>; + assigned-clock-parents = <&ext_gmac>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x30>; + rx_delay = <0x10>; +- status = "ok"; ++ status = "okay"; + }; + + /* ---------------------------------------------------------------------------------- +@@ -414,6 +416,15 @@ I2C + + &i2s { + #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { + status = "okay"; + }; + +@@ -439,6 +450,17 @@ I2C + status = "okay"; + }; + ++&saradc { ++ vref-supply = <&vcc_18>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; ++ rockchip,hw-tshut-polarity = <0>; ++ status = "okay"; ++}; ++ + /* + * Debug Serial Port + */ +@@ -472,6 +494,10 @@ I2C + + &vopl { + status = "okay"; ++ /* Don't use vopl for HDMI */ ++ vopl_out: port { ++ /delete-node/ endpoint@0; ++ }; + }; + + &vopl_mmu { +@@ -546,4 +572,3 @@ I2C + }; + + }; +- + +From 49c65a7f1c91517d56efdbe72a046b64b687664c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 17 Jan 2018 22:17:45 +0100 +Subject: [PATCH] arm64: dts: rockchip: rk3328: update dtsi + +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 68 ++++++++++++++++++++++++++------ + 1 file changed, 56 insertions(+), 12 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 0d2251c903b1..b7b6f9304706 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -88,6 +88,8 @@ + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x1>; ++ clocks = <&cru ARMCLK>; ++ dynamic-power-coefficient = <120>; + enable-method = "psci"; + operating-points-v2 = <&cpu0_opp_table>; + }; +@@ -95,6 +97,8 @@ + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x2>; ++ clocks = <&cru ARMCLK>; ++ dynamic-power-coefficient = <120>; + enable-method = "psci"; + operating-points-v2 = <&cpu0_opp_table>; + }; +@@ -102,6 +106,8 @@ + device_type = "cpu"; + compatible = "arm,cortex-a53", "arm,armv8"; + reg = <0x0 0x3>; ++ clocks = <&cru ARMCLK>; ++ dynamic-power-coefficient = <120>; + enable-method = "psci"; + operating-points-v2 = <&cpu0_opp_table>; + }; +@@ -161,6 +167,22 @@ + opp-microvolt-L1 = <1300000 1300000 1350000>; + clock-latency-ns = <40000>; + }; ++ /* ++ opp-1392000000 { ++ opp-hz = /bits/ 64 <1392000000>; ++ opp-microvolt = <1350000 1350000 1350000>; ++ opp-microvolt-L0 = <1350000 1350000 1350000>; ++ opp-microvolt-L1 = <1325000 1325000 1350000>; ++ clock-latency-ns = <40000>; ++ }; ++ opp-1512000000 { ++ opp-hz = /bits/ 64 <1512000000>; ++ opp-microvolt = <1350000 1350000 1350000>; ++ opp-microvolt-L0 = <1350000 1350000 1350000>; ++ opp-microvolt-L1 = <1325000 1325000 1350000>; ++ clock-latency-ns = <40000>; ++ }; ++ */ + }; + + arm-pmu { +@@ -438,6 +460,7 @@ + reg-shift = <2>; + reg-io-width = <4>; + dmas = <&dmac 2>, <&dmac 3>; ++ dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "disabled"; +@@ -452,6 +475,7 @@ + reg-shift = <2>; + reg-io-width = <4>; + dmas = <&dmac 4>, <&dmac 5>; ++ dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1_xfer &uart1_cts &uart1_rts>; + status = "disabled"; +@@ -466,6 +490,7 @@ + reg-shift = <2>; + reg-io-width = <4>; + dmas = <&dmac 6>, <&dmac 7>; ++ dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart2m1_xfer>; + status = "disabled"; +@@ -704,9 +729,9 @@ + }; + opp-300000000 { + opp-hz = /bits/ 64 <300000000>; +- opp-microvolt = <975000>; +- opp-microvolt-L0 = <975000>; +- opp-microvolt-L1 = <950000>; ++ opp-microvolt = <1050000>; ++ opp-microvolt-L0 = <1050000>; ++ opp-microvolt-L1 = <1025000>; + }; + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; +@@ -720,6 +745,14 @@ + opp-microvolt-L0 = <1150000>; + opp-microvolt-L1 = <1100000>; + }; ++ /* ++ opp-600000000 { ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <1150000>; ++ opp-microvolt-L0 = <1150000>; ++ opp-microvolt-L1 = <1125000>; ++ }; ++ */ + }; + + vdpu: vpu_service@ff350000 { +@@ -843,7 +876,7 @@ + interrupts = ; + interrupt-names = "rkvdec_mmu"; + clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>; +- clock-names = "aclk_vcodec", "hclk_vcodec"; ++ clock-names = "aclk", "hclk"; + power-domains = <&power RK3328_PD_VIDEO>; + #iommu-cells = <0>; + }; +@@ -921,6 +954,8 @@ + vop: vop@ff370000 { + compatible = "rockchip,rk3328-vop"; + reg = <0x0 0xff370000 0x0 0x3efc>; ++ reg-names = "regs", "gamma_lut"; ++ rockchip,grf = <&grf>; + interrupts = ; + clocks = <&cru ACLK_VOP>, <&cru DCLK_LCDC>, <&cru HCLK_VOP>; + clock-names = "aclk_vop", "dclk_vop", "hclk_vop"; +@@ -1226,36 +1261,42 @@ + sdmmc: dwmmc@ff500000 { + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff500000 0x0 0x4000>; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, + <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; +- clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; ++ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; ++ resets = <&cru SRST_MMC0>; ++ reset-names = "reset"; + status = "disabled"; + }; + + sdio: dwmmc@ff510000 { + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff510000 0x0 0x4000>; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>, + <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>; +- clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; ++ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; ++ resets = <&cru SRST_SDIO>; ++ reset-names = "reset"; + status = "disabled"; + }; + + emmc: dwmmc@ff520000 { + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff520000 0x0 0x4000>; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, + <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; +- clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; ++ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; ++ resets = <&cru SRST_EMMC>; ++ reset-names = "reset"; + status = "disabled"; + }; + +@@ -1275,6 +1316,7 @@ + "pclk_mac"; + resets = <&cru SRST_GMAC2IO_A>; + reset-names = "stmmaceth"; ++ snps,force_thresh_dma_mode; + status = "disabled"; + }; + +@@ -1345,12 +1387,14 @@ + sdmmc_ext: dwmmc@ff5f0000 { + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff5f0000 0x0 0x4000>; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <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"; ++ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = ; ++ resets = <&cru SRST_SDMMCEXT>; ++ reset-names = "reset"; + status = "disabled"; + }; + + +From bffef35a0fe1b0cd133c32569b448575ae422be5 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 17 Jan 2018 22:17:45 +0100 +Subject: [PATCH] arm64: dts: rockchip: rk3328-rock64: update dts + +--- + arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 262 ++++++++++++++++--------- + 1 file changed, 168 insertions(+), 94 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +index 4b2eef609601..ff90c5379671 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +@@ -48,20 +48,15 @@ + compatible = "pine64,rock64", "rockchip,rk3328"; + + chosen { +- bootargs = "rockchip_jtag earlyprintk=uart8250-32bit,0xff130000 swiotlb=1 kpti=0"; ++ bootargs = "earlyprintk=uart8250-32bit,0xff130000 swiotlb=1 kpti=0"; + stdout-path = "serial2:1500000n8"; + }; + +- fiq-debugger { +- compatible = "rockchip,fiq-debugger"; +- rockchip,serial-id = <2>; +- rockchip,signal-irq = <159>; +- rockchip,wake-irq = <0>; +- /* If enable uart uses irq instead of fiq */ +- rockchip,irq-mode-enable = <0>; +- rockchip,baudrate = <1500000>; /* Only 115200 and 1500000 */ +- interrupts = ; +- status = "okay"; ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; + }; + + gmac_clkin: external-gmac-clock { +@@ -71,67 +66,86 @@ + #clock-cells = <0>; + }; + ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ 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 30 GPIO_ACTIVE_LOW>; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0m1_gpio>; + regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io>; + }; + +- vcc_host_5v: vcc-host-5v-regulator { ++ vcc_host_5v: vcc_otg_5v: vcc-host-5v-regulator { + compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; +- pinctrl-0 = <&usb30_host_drv>; ++ pinctrl-0 = <&usb_host_drv>; + regulator-name = "vcc_host_5v"; +- regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + }; + +- vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { +- compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&usb20_host_drv>; +- regulator-name = "vcc_host1_5v"; +- regulator-always-on; +- vin-supply = <&vcc_sys>; +- }; ++ leds { ++ compatible = "gpio-leds"; + +- 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>; +- }; ++ standby-led { ++ gpios = <&rk805 0 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "heartbeat"; ++ }; + +- xin32k: xin32k { +- compatible = "fixed-clock"; +- clock-frequency = <32768>; +- clock-output-names = "xin32k"; +- #clock-cells = <0>; ++ power-led { ++ gpios = <&rk805 1 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "mmc0"; ++ }; + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-pine64"; + pinctrl-0 = <&ir_int>; + pinctrl-names = "default"; +- status = "okay"; ++ }; ++ ++ 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>; ++ }; + }; + + 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,name = "I2S"; + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; +@@ -140,18 +154,21 @@ + }; + }; + +- hdmi-sound { ++ spdif-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,name = "SPDIF"; + simple-audio-card,cpu { +- sound-dai = <&i2s0>; ++ sound-dai = <&spdif>; + }; + simple-audio-card,codec { +- sound-dai = <&hdmi>; ++ sound-dai = <&spdif_out>; + }; + }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; + }; + + &codec { +@@ -175,6 +192,15 @@ + cpu-supply = <&vdd_arm>; + }; + ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ status = "okay"; ++}; ++ + &display_subsystem { + status = "okay"; + }; +@@ -184,30 +210,40 @@ + cap-mmc-highspeed; + mmc-hs200-1_8v; + non-removable; +- supports-emmc; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ supports-emmc; + vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc18_emmc>; + status = "okay"; + }; + + &gmac2io { +- phy-supply = <&vcc_io>; +- phy-mode = "rgmii"; + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; + clock_in_out = "input"; +- snps,reset-gpio = <&gpio1 18 GPIO_ACTIVE_LOW>; +- snps,reset-active-low; +- snps,reset-delays-us = <0 10000 50000>; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmiim1_pins>; +- tx_delay = <0x26>; +- rx_delay = <0x11>; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x24>; ++ rx_delay = <0x18>; + status = "okay"; + }; + ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ clock_in_out = "output"; ++ status = "disabled"; ++}; ++ + &gpu { + status = "okay"; + mali-supply = <&vdd_logic>; +@@ -223,6 +259,8 @@ + + &hdmi { + #sound-dai-cells = <0>; ++ ddc-i2c-scl-high-time-ns = <9625>; ++ ddc-i2c-scl-low-time-ns = <10000>; + status = "okay"; + }; + +@@ -239,14 +277,14 @@ + reg = <0x18>; + interrupt-parent = <&gpio2>; + interrupts = <6 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "rk805-clkout1", "rk805-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + gpio-controller; +- clock-output-names = "rk805-clkout1", "rk805-clkout2"; + #gpio-cells = <2>; +- #clock-cells = <1>; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; +@@ -256,11 +294,11 @@ + vcc6-supply = <&vcc_sys>; + + rtc { +- status = "disabled"; ++ status = "okay"; + }; + + pwrkey { +- status = "disabled"; ++ status = "okay"; + }; + + gpio { +@@ -280,8 +318,8 @@ + regulator-max-microvolt = <1450000>; + regulator-initial-mode = <0x1>; + regulator-ramp-delay = <12500>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-mode = <0x2>; + regulator-on-in-suspend; +@@ -292,12 +330,13 @@ + vdd_arm: RK805_DCDC2 { + regulator-compatible = "RK805_DCDC2"; + regulator-name = "vdd_arm"; ++ regulator-init-microvolt = <1225000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-initial-mode = <0x1>; + regulator-ramp-delay = <12500>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-mode = <0x2>; + regulator-on-in-suspend; +@@ -309,8 +348,8 @@ + regulator-compatible = "RK805_DCDC3"; + regulator-name = "vcc_ddr"; + regulator-initial-mode = <0x1>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-mode = <0x2>; + regulator-on-in-suspend; +@@ -323,8 +362,8 @@ + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-initial-mode = <0x1>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-mode = <0x2>; + regulator-on-in-suspend; +@@ -332,13 +371,13 @@ + }; + }; + +- vdd_18: RK805_LDO1 { ++ vcc_18: RK805_LDO1 { + regulator-compatible = "RK805_LDO1"; +- regulator-name = "vdd_18"; ++ regulator-name = "vcc_18"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -350,8 +389,8 @@ + regulator-name = "vcc18_emmc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -363,8 +402,8 @@ + regulator-name = "vdd_10"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; +- regulator-boot-on; + regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; +@@ -381,17 +420,35 @@ + }; + + &i2s1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s1_mclk ++ &i2s1_sclk ++ &i2s1_lrcktx ++ &i2s1_lrckrx ++ &i2s1_sdo ++ &i2s1_sdi ++ &i2s1_sdio1 ++ &i2s1_sdio2 ++ &i2s1_sdio3>; + #sound-dai-cells = <0>; + status = "okay"; + }; + ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ + &io_domains { + status = "okay"; + + vccio1-supply = <&vcc_io>; + vccio2-supply = <&vcc18_emmc>; + vccio3-supply = <&vcc_io>; +- vccio4-supply = <&vdd_18>; ++ vccio4-supply = <&vcc_18>; + vccio5-supply = <&vcc_io>; + vccio6-supply = <&vcc_io>; + pmuio-supply = <&vcc_io>; +@@ -400,37 +457,26 @@ + &pinctrl { + ir { + ir_int: ir-int { +- rockchip,pins = <2 2 RK_FUNC_GPIO &pcfg_pull_none>; ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { +- rockchip,pins = <2 6 RK_FUNC_GPIO &pcfg_pull_up>; ++ rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + +- sdio-pwrseq { +- wifi_enable_h: wifi-enable-h { +- rockchip,pins = <1 18 RK_FUNC_GPIO &pcfg_pull_none>; +- }; +- }; +- +- usb2 { +- usb20_host_drv: usb20-host-drv { +- rockchip,pins = <0 27 RK_FUNC_GPIO &pcfg_pull_none>; +- }; +- }; +- +- usb3 { +- usb30_host_drv: usb30-host-drv { +- rockchip,pins = <0 0 RK_FUNC_GPIO &pcfg_pull_none>; ++ usb { ++ usb_host_drv: usb-host-drv { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + }; + + &rkvdec { + status = "okay"; ++ vcodec-supply = <&vdd_logic>; + }; + + &rkvdec_mmu { +@@ -442,11 +488,17 @@ + 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>; + supports-sd; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spdifm0_tx>; + status = "okay"; + }; + +@@ -454,19 +506,43 @@ + status = "okay"; + + flash@0 { +- compatible = "gigadevice,gd25q128", "jedec,spi-nor"; ++ compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + m25p,fast-read; + /* The max SCLK of the flash 104/80 MHZ */ + spi-max-frequency = <50000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ loader@8000 { ++ label = "loader"; ++ reg = <0x8000 0x3F0000>; ++ }; ++ }; + }; + }; + ++&threshold { ++ temperature = <80000>; /* millicelsius */ ++}; ++ ++&target { ++ temperature = <95000>; /* millicelsius */ ++}; ++ ++&soc_crit { ++ temperature = <100000>; /* millicelsius */ ++}; ++ + &tsadc { + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; ++ rockchip,hw-tshut-temp = <110000>; + status = "okay"; + }; + +@@ -476,21 +552,19 @@ + + &u2phy { + status = "okay"; +- + }; + + &u2phy_host { +- phy-supply = <&vcc_host1_5v>; + status = "okay"; + }; + + &u2phy_otg { +- phy-supply = <&vcc_otg_5v>; ++ vbus-supply = <&vcc_otg_5v>; + status = "okay"; + }; + + &u3phy { +- phy-supply = <&vcc_host_5v>; ++ vbus-supply = <&vcc_host_5v>; + status = "okay"; + }; + + +From ed7848e24407cd2a65e524c46ba8fbb92db2bdc5 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 17 Jan 2018 22:17:45 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3328-box board + +--- + arch/arm64/boot/dts/rockchip/rk3328-box.dts | 648 ++++++++++++++++++++++++++++ + 1 file changed, 648 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-box.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-box.dts b/arch/arm64/boot/dts/rockchip/rk3328-box.dts +new file mode 100644 +index 000000000000..eae652d55208 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-box.dts +@@ -0,0 +1,648 @@ ++/* ++ * 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. ++ */ ++ ++/dts-v1/; ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Rockchip RK3328 BOX"; ++ compatible = "rockchip,rk3328-box", "rockchip,rk3328"; ++ ++ chosen { ++ bootargs = "earlyprintk=uart8250-32bit,0xff130000 swiotlb=1 kpti=0"; ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ 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_gpio>; ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ 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-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb20_host_drv>; ++ regulator-name = "vcc_host1_5v"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led1 { ++ gpios = <&rk805 0 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-on"; ++ default-state = "on"; ++ }; ++ ++ led2 { ++ gpios = <&rk805 1 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "mmc0"; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ 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_gpios>; ++ 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 = "rtl8723bs"; ++ WIFI,host_wake_irq = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ supports-emmc; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; ++}; ++ ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ clock_in_out = "output"; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ ++&h265e { ++ status = "okay"; ++}; ++ ++&h265e_mmu { ++ 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"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <6 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "rk805-clkout1", "rk805-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ rtc { ++ status = "okay"; ++ }; ++ ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: RK805_DCDC1 { ++ regulator-compatible = "RK805_DCDC1"; ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: RK805_DCDC2 { ++ regulator-compatible = "RK805_DCDC2"; ++ regulator-name = "vdd_arm"; ++ regulator-init-microvolt = <1225000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: RK805_DCDC3 { ++ regulator-compatible = "RK805_DCDC3"; ++ regulator-name = "vcc_ddr"; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: RK805_DCDC4 { ++ regulator-compatible = "RK805_DCDC4"; ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: RK805_LDO1 { ++ regulator-compatible = "RK805_LDO1"; ++ regulator-name = "vcc_18"; ++ 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>; ++ }; ++ }; ++ ++ vcc18_emmc: RK805_LDO2 { ++ regulator-compatible = "RK805_LDO2"; ++ regulator-name = "vcc18_emmc"; ++ 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>; ++ }; ++ }; ++ ++ vdd_10: RK805_LDO3 { ++ regulator-compatible = "RK805_LDO3"; ++ regulator-name = "vdd_10"; ++ 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>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ 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 RK_FUNC_1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ 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-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ vcodec-supply = <&vdd_logic>; ++}; ++ ++&rkvdec_mmu { ++ status = "okay"; ++}; ++ ++&sdio { ++ 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>; ++ sd-uhs-sdr104; ++ supports-sdio; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ supports-sd; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spdifm0_tx>; ++ 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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ phy-supply = <&vcc_host1_5v>; ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ phy-supply = <&vcc_otg_5v>; ++ status = "okay"; ++}; ++ ++&u3phy { ++ status = "okay"; ++}; ++ ++&u3phy_utmi { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&u3phy_pipe { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3 { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vpu_service { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++}; ++ ++&vepu_mmu { ++ status = "okay"; ++}; ++ ++&venc_srv { ++ status = "okay"; ++}; + +From 8d1e765adaeb6d597b7cda84c9922f2aa5d34239 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 17 Jan 2018 22:17:45 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3328-rockbox board + +--- + arch/arm64/boot/dts/rockchip/rk3328-rockbox.dts | 583 ++++++++++++++++++++++++ + 1 file changed, 583 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-rockbox.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rockbox.dts b/arch/arm64/boot/dts/rockchip/rk3328-rockbox.dts +new file mode 100644 +index 000000000000..4ba9b1e78846 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rockbox.dts +@@ -0,0 +1,583 @@ ++/* ++ * 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. ++ */ ++ ++/dts-v1/; ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Pine64 RockBox"; ++ compatible = "pine64,rockbox", "rockchip,rk3328"; ++ ++ chosen { ++ bootargs = "earlyprintk=uart8250-32bit,0xff130000 swiotlb=1 kpti=0"; ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ 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_gpio>; ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vcc_host_5v: vcc_host1_5v: vcc_otg_5v: vcc-host-5v-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_host_5v"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power { ++ gpios = <&rk805 0 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ default-state = "on"; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-pine64"; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ 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-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "rtl8189fs"; ++ WIFI,host_wake_irq = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ supports-emmc; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; ++}; ++ ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ clock_in_out = "output"; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ ++&h265e { ++ status = "okay"; ++}; ++ ++&h265e_mmu { ++ 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"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <6 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "rk805-clkout1", "rk805-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ rtc { ++ status = "okay"; ++ }; ++ ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: RK805_DCDC1 { ++ regulator-compatible = "RK805_DCDC1"; ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: RK805_DCDC2 { ++ regulator-compatible = "RK805_DCDC2"; ++ regulator-name = "vdd_arm"; ++ regulator-init-microvolt = <1225000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: RK805_DCDC3 { ++ regulator-compatible = "RK805_DCDC3"; ++ regulator-name = "vcc_ddr"; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: RK805_DCDC4 { ++ regulator-compatible = "RK805_DCDC4"; ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: RK805_LDO1 { ++ regulator-compatible = "RK805_LDO1"; ++ regulator-name = "vcc_18"; ++ 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>; ++ }; ++ }; ++ ++ vcc18_emmc: RK805_LDO2 { ++ regulator-compatible = "RK805_LDO2"; ++ regulator-name = "vcc18_emmc"; ++ 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>; ++ }; ++ }; ++ ++ vdd_10: RK805_LDO3 { ++ regulator-compatible = "RK805_LDO3"; ++ regulator-name = "vdd_10"; ++ 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>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ 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_io>; ++ pmuio-supply = <&vcc_io>; ++}; ++ ++&pinctrl { ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <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>; ++ }; ++ }; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ vcodec-supply = <&vdd_logic>; ++}; ++ ++&rkvdec_mmu { ++ status = "okay"; ++}; ++ ++&sdio { ++ 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 { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ supports-sd; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spdifm0_tx>; ++ 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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ phy-supply = <&vcc_host1_5v>; ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ phy-supply = <&vcc_otg_5v>; ++ status = "okay"; ++}; ++ ++&u3phy { ++ status = "okay"; ++}; ++ ++&u3phy_utmi { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&u3phy_pipe { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3 { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vpu_service { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++}; ++ ++&vepu_mmu { ++ status = "okay"; ++}; ++ ++&venc_srv { ++ status = "okay"; ++}; + +From aa7c314431dcd5fd3dd6dd8b06859c472e93cf5d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 17 Jan 2018 22:17:45 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3328-roc-cc board + +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 576 +++++++++++++++++++++++++ + 1 file changed, 576 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +new file mode 100644 +index 000000000000..af2af859d56e +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -0,0 +1,576 @@ ++/* ++ * 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. ++ */ ++ ++/dts-v1/; ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Firefly ROC-RK3328-CC Board"; ++ compatible = "firefly,roc-rk3328-cc", "rockchip,rk3328"; ++ ++ chosen { ++ bootargs = "earlyprintk=uart8250-32bit,0xff130000 swiotlb=1 kpti=0"; ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ gmac_clkin: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clkin"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ 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_gpio>; ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vccio_sd: sdmmcio-regulator { ++ compatible = "regulator-gpio"; ++ gpios = <&gpio0 RK_PD1 GPIO_ACTIVE_HIGH>; ++ states = <1800000 0x1 ++ 3300000 0x0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sd_pwr_1800_sel>; ++ regulator-name = "vccio_sd"; ++ regulator-type = "voltage"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc_host_5v: vcc_host1_5v: vcc_otg_5v: vcc-host-5v-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb_host_drv>; ++ regulator-name = "vcc_host_5v"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power { ++ gpios = <&rk805 1 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ user { ++ gpios = <&rk805 0 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "mmc0"; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-roc-cc"; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "I2S"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ supports-emmc; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; ++}; ++ ++&gmac2io { ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmiim1_pins>; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x25>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ ++&h265e { ++ status = "okay"; ++}; ++ ++&h265e_mmu { ++ 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"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "rk805-clkout1", "rk805-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ rtc { ++ status = "okay"; ++ }; ++ ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: RK805_DCDC1 { ++ regulator-compatible = "RK805_DCDC1"; ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: RK805_DCDC2 { ++ regulator-compatible = "RK805_DCDC2"; ++ regulator-name = "vdd_arm"; ++ regulator-init-microvolt = <1225000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: RK805_DCDC3 { ++ regulator-compatible = "RK805_DCDC3"; ++ regulator-name = "vcc_ddr"; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: RK805_DCDC4 { ++ regulator-compatible = "RK805_DCDC4"; ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: RK805_LDO1 { ++ regulator-compatible = "RK805_LDO1"; ++ regulator-name = "vcc_18"; ++ 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>; ++ }; ++ }; ++ ++ vcc18_emmc: RK805_LDO2 { ++ regulator-compatible = "RK805_LDO2"; ++ regulator-name = "vcc18_emmc"; ++ 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>; ++ }; ++ }; ++ ++ vdd_10: RK805_LDO3 { ++ regulator-compatible = "RK805_LDO3"; ++ regulator-name = "vdd_10"; ++ 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>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vccio_sd>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_io>; ++ pmuio-supply = <&vcc_io>; ++}; ++ ++&pinctrl { ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ sd-pwerset { ++ sd_pwr_1800_sel: sd-pwr-1800-sel { ++ rockchip,pins = <0 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ usb { ++ usb_host_drv: usb-host-drv { ++ rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ vcodec-supply = <&vdd_logic>; ++}; ++ ++&rkvdec_mmu { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ sd-uhs-sdr104; ++ supports-sd; ++ vmmc-supply = <&vcc_sd>; ++ vqmmc-supply = <&vccio_sd>; ++ 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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ phy-supply = <&vcc_host1_5v>; ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ phy-supply = <&vcc_otg_5v>; ++ status = "okay"; ++}; ++ ++&u3phy { ++ status = "okay"; ++}; ++ ++&u3phy_utmi { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&u3phy_pipe { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3 { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vpu_service { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++}; ++ ++&vepu_mmu { ++ status = "okay"; ++}; ++ ++&venc_srv { ++ status = "okay"; ++}; + +From 1652fa888921eb14a53fd6b12b6860247d5a9d0c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 3 Sep 2017 11:19:19 +0200 +Subject: [PATCH] arm64: dts: rockchip: rk3328-rock64: use two dai-link for i2s + sound + +--- + arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 26 +++++++++++++++++++++----- + sound/soc/soc-utils.c | 10 ++++++++++ + 2 files changed, 31 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +index ff90c5379671..d47d572a6ca6 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +@@ -128,6 +128,11 @@ + pinctrl-names = "default"; + }; + ++ dummy_codec: dummy-codec { ++ compatible = "linux,snd-soc-dummy"; ++ #sound-dai-cells = <0>; ++ }; ++ + hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; +@@ -143,14 +148,25 @@ + + sound { + compatible = "simple-audio-card"; +- simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "I2S"; +- simple-audio-card,cpu { +- sound-dai = <&i2s1>; ++ simple-audio-card,dai-link@0 { ++ format = "i2s"; ++ cpu { ++ sound-dai = <&i2s1>; ++ }; ++ codec { ++ sound-dai = <&codec>; ++ }; + }; +- simple-audio-card,codec { +- sound-dai = <&codec>; ++ simple-audio-card,dai-link@1 { ++ format = "i2s"; ++ cpu { ++ sound-dai = <&i2s1>; ++ }; ++ codec { ++ sound-dai = <&dummy_codec>; ++ }; + }; + }; + +diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c +index 53dd085d3ee2..bf7ce34084a9 100644 +--- a/sound/soc/soc-utils.c ++++ b/sound/soc/soc-utils.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots) + { +@@ -160,9 +161,18 @@ static int snd_soc_dummy_remove(struct platform_device *pdev) + return 0; + } + ++#ifdef CONFIG_OF ++static const struct of_device_id soc_dummy_ids[] = { ++ { .compatible = "linux,snd-soc-dummy", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, soc_dummy_ids); ++#endif ++ + static struct platform_driver soc_dummy_driver = { + .driver = { + .name = "snd-soc-dummy", ++ .of_match_table = of_match_ptr(soc_dummy_ids), + }, + .probe = snd_soc_dummy_probe, + .remove = snd_soc_dummy_remove, + +From 3184eaf3788de374e37ba0ee24ce641d6a20f780 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 26 Jan 2018 00:03:46 +0100 +Subject: [PATCH] arm64: dts: rockchip: rk3328-roc-cc: disable sd-card voltage + select + +Voltage select should set GRF_SOC_CON10 bit 1, +vendor kernel repurpose GPIO0_D1 to signal this, +RK kernel uses GRF_SOC_CON10 bit 1 to mute avcodec. +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index af2af859d56e..e911cf265a64 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -98,8 +98,6 @@ + gpios = <&gpio0 RK_PD1 GPIO_ACTIVE_HIGH>; + states = <1800000 0x1 + 3300000 0x0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sd_pwr_1800_sel>; + regulator-name = "vccio_sd"; + regulator-type = "voltage"; + regulator-min-microvolt = <1800000>; +@@ -433,12 +431,6 @@ + }; + }; + +- sd-pwerset { +- sd_pwr_1800_sel: sd-pwr-1800-sel { +- rockchip,pins = <0 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; +- }; +- }; +- + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; +@@ -468,10 +460,8 @@ + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; +- sd-uhs-sdr104; + supports-sd; + vmmc-supply = <&vcc_sd>; +- vqmmc-supply = <&vccio_sd>; + status = "okay"; + }; + + +From 200c456121d8644da9f4ffc3ac8acf2f8f8ecb5c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 28 Jan 2018 15:17:34 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3399-sapphire board + +--- + arch/arm64/boot/dts/rockchip/rk3399-sapphire.dts | 170 +++++++++++++++++++++++ + 1 file changed, 170 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dts b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dts +new file mode 100644 +index 000000000000..8706dc7d91af +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dts +@@ -0,0 +1,170 @@ ++/* ++ * Copyright (c) 2016 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 file 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 file 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. ++ */ ++ ++/dts-v1/; ++ ++#include "rk3399-sapphire.dtsi" ++#include "rk3399-linux.dtsi" ++#include ++ ++/ { ++ model = "Rockchip RK3399 Sapphire Board"; ++ compatible = "rockchip,rk3399-sapphire", "rockchip,rk3399"; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ autorepeat; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwrbtn>; ++ ++ 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>; ++ }; ++ }; ++ ++ vccadc_ref: vccadc-ref { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++}; ++ ++&hdmi_sound { ++ simple-audio-card,name = "HDMI"; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vccadc_ref>; ++}; ++ ++&vpu { ++ status = "okay"; ++}; ++ ++&rkvdec { ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ ports = <&vopb_out>; ++ status = "okay"; ++}; ++ ++&route_hdmi { ++ status = "okay"; ++}; ++ ++&cdn_dp { ++ status = "disabled"; ++}; ++ ++&dp_in_vopb { ++ status = "disabled"; ++}; ++ ++&hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&pcie_phy { ++ status = "disabled"; ++}; ++ ++&pcie0 { ++ status = "disabled"; ++}; ++ ++&sdio0 { ++ status = "disabled"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ buttons { ++ pwrbtn: pwrbtn { ++ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; + +From 1ac825316b3a44cd22bf7904f230e725a8163f2c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 28 Jan 2018 15:17:53 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3399-rock960 board + +--- + arch/arm64/boot/dts/rockchip/rk3399-rock960.dts | 1003 +++++++++++++++++++++++ + 1 file changed, 1003 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-rock960.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +new file mode 100644 +index 000000000000..865a1da96aee +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +@@ -0,0 +1,1003 @@ ++/* ++ * Copyright (c) 2016 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 file 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 file 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. ++ */ ++ ++/dts-v1/; ++ ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-linux.dtsi" ++#include "rk3399-opp.dtsi" ++ ++ ++/ { ++ model = "ROCK960"; ++ compatible = "96rocks,rock960", "rockchip,rk3399"; ++ ++ vcc1v8_s0: vcc1v8-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s0"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ }; ++ ++ vcc_sys: vcc-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio3 11 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_drv>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-name = "vcc3v3_pcie"; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 25 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&host_vbus_drv>; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-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; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id= <2>; ++ rockchip,pwm_voltage = <900000>; ++ ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "HDMI"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-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>; ++ post-power-on-delay-ms = <200>; ++ power-off-delay-us = <10>; ++ ++ /* ++ * 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>; ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ /* wifi-bt-power-toggle; */ ++ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ /* BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; */ ++ BT,reset_gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; ++ BT,wake_gpio = <&gpio2 27 GPIO_ACTIVE_HIGH>; ++ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ test-power { ++ status = "okay"; ++ }; ++}; ++ ++&hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <100000000>; ++ max-frequency = <100000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++ clock-frequency = <100000000>; ++ max-frequency = <100000000>; ++ 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"; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ non-removable; ++ mmc-hs400-enhanced-strobe; ++ status = "okay"; ++}; ++ ++&i2s0 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&spdif { ++ pinctrl-0 = <&spdif_bus_1>; ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ regulator-initial-mode = <1>; /* 1:force PWM 2:auto */ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc6-supply = <&vcc_sys>; ++ vcc7-supply = <&vcc_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc_sys>; ++ vcc10-supply = <&vcc_sys>; ++ vcc11-supply = <&vcc_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ ++ 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-off-in-suspend; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ 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>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcca_1v8: LDO_REG3 { ++ regulator-name = "vcca_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>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v0_sd: LDO_REG5 { ++ regulator-name = "vcc3v0_sd"; ++ 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>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++}; ++ ++&i2c6 { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ status = "okay"; ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ vbus-5v-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; ++ int-n-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++}; ++ ++&i2c2 { ++ status = "okay"; ++ camera0: camera-module@10 { ++ status = "disabled"; ++ compatible = "omnivision,ov13850-v4l2-i2c-subdev"; ++ reg = < 0x10 >; ++ device_type = "v4l2-i2c-subdev"; ++ clocks = <&cru SCLK_CIF_OUT>; ++ clock-names = "clk_cif_out"; ++ pinctrl-names = "rockchip,camera_default", ++ "rockchip,camera_sleep"; ++ pinctrl-0 = <&cam0_default_pins>; ++ pinctrl-1 = <&cam0_sleep_pins>; ++ //rockchip,pd-gpio = <&gpio4 4 GPIO_ACTIVE_LOW>; ++ rockchip,pwr-gpio = <&gpio4 4 GPIO_ACTIVE_HIGH>; ++ rockchip,rst-gpio = <&gpio3 29 GPIO_ACTIVE_LOW>; ++ rockchip,camera-module-mclk-name = "clk_cif_out"; ++ rockchip,camera-module-facing = "back"; ++ rockchip,camera-module-name = "cmk-cb0695-fv1"; ++ rockchip,camera-module-len-name = "lg9569a2"; ++ rockchip,camera-module-fov-h = "66.0"; ++ rockchip,camera-module-fov-v = "50.1"; ++ rockchip,camera-module-orientation = <0>; ++ rockchip,camera-module-iq-flip = <0>; ++ rockchip,camera-module-iq-mirror = <0>; ++ rockchip,camera-module-flip = <1>; ++ rockchip,camera-module-mirror = <0>; ++ ++ rockchip,camera-module-defrect0 = <2112 1568 0 0 2112 1568>; ++ rockchip,camera-module-defrect1 = <4224 3136 0 0 4224 3136>; ++ rockchip,camera-module-defrect3 = <3264 2448 0 0 3264 2448>; ++ rockchip,camera-module-flash-support = <1>; ++ rockchip,camera-module-mipi-dphy-index = <0>; ++ }; ++ ++ camera1: camera-module@36 { ++ status = "disabled"; ++ compatible = "omnivision,ov4690-v4l2-i2c-subdev"; ++ reg = <0x36>; ++ device_type = "v4l2-i2c-subdev"; ++ clocks = <&cru SCLK_CIF_OUT>; ++ clock-names = "clk_cif_out"; ++ pinctrl-names = "rockchip,camera_default", ++ "rockchip,camera_sleep"; ++ pinctrl-0 = <&cam0_default_pins>; ++ pinctrl-1 = <&cam0_sleep_pins>; ++ rockchip,pd-gpio = <&gpio3 4 GPIO_ACTIVE_LOW>; ++ //rockchip,pwr-gpio = <&gpio3 13 0>; ++ rockchip,rst-gpio = <&gpio2 10 GPIO_ACTIVE_LOW>; ++ rockchip,camera-module-mclk-name = "clk_cif_out"; ++ rockchip,camera-module-facing = "back"; ++ rockchip,camera-module-name = "LA6111PA"; ++ rockchip,camera-module-len-name = "YM6011P"; ++ rockchip,camera-module-fov-h = "116"; ++ rockchip,camera-module-fov-v = "61"; ++ rockchip,camera-module-orientation = <0>; ++ rockchip,camera-module-iq-flip = <0>; ++ rockchip,camera-module-iq-mirror = <0>; ++ rockchip,camera-module-flip = <0>; ++ rockchip,camera-module-mirror = <1>; ++ ++ rockchip,camera-module-defrect0 = <2688 1520 0 0 2688 1520>; ++ rockchip,camera-module-flash-support = <0>; ++ rockchip,camera-module-mipi-dphy-index = <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 { ++ status = "okay"; ++ mali-supply = <&vdd_gpu>; ++}; ++ ++&threshold { ++ temperature = <85000>; ++}; ++ ++&target { ++ temperature = <100000>; ++}; ++ ++&soc_crit { ++ temperature = <105000>; ++}; ++ ++&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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ extcon = <&fusb0>; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ dmas = <&dmac_peri 0>, <&dmac_peri 1>; ++ dma-names = "tx", "rx"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&uart3 { ++ dmas = <&dmac_peri 6>, <&dmac_peri 7>; ++ dma-names = "tx", "rx"; ++ status = "okay"; ++}; ++ ++&uart4 { ++ dmas = <&dmac_peri 8>, <&dmac_peri 9>; ++ dma-names = "tx", "rx"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&rgmii_pins>; ++ pinctrl-1 = <&rgmii_sleep_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "disabled"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc1v8_s0>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcc1v8_s0>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio3 9 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ ++ sdio0 { ++ sdio0_bus1: sdio0-bus1 { ++ rockchip,pins = ++ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_bus4: sdio0-bus4 { ++ rockchip,pins = ++ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 21 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 22 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 23 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_cmd: sdio0-cmd { ++ rockchip,pins = ++ <2 24 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_clk: sdio0-clk { ++ rockchip,pins = ++ <2 25 RK_FUNC_1 &pcfg_pull_none_20ma>; ++ }; ++ }; ++ ++ sdmmc { ++ sdmmc_bus1: sdmmc-bus1 { ++ rockchip,pins = ++ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_bus4: sdmmc-bus4 { ++ rockchip,pins = ++ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 9 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 10 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 11 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_clk: sdmmc-clk { ++ rockchip,pins = ++ <4 12 RK_FUNC_1 &pcfg_pull_none_18ma>; ++ }; ++ ++ sdmmc_cmd: sdmmc-cmd { ++ rockchip,pins = ++ <4 13 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <0 9 RK_FUNC_GPIO &pcfg_pull_none>, ++ <0 10 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = ++ <2 19 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = ++ <4 25 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie { ++ pcie_drv: pcie-drv { ++ rockchip,pins = ++ <3 11 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 21 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ gmac { ++ rgmii_sleep_pins: rgmii-sleep-pins { ++ rockchip,pins = ++ <3 15 RK_FUNC_GPIO &pcfg_output_low>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = ++ <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pvtm { ++ status = "okay"; ++}; ++ ++&pmu_pvtm { ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_1v8>; ++}; ++ ++&rockchip_suspend { ++ status = "okay"; ++ rockchip,sleep-debug-en = <0>; ++ rockchip,sleep-mode-config = < ++ (0 ++ | RKPM_SLP_ARMPD ++ | RKPM_SLP_PERILPPD ++ | RKPM_SLP_DDR_RET ++ | RKPM_SLP_PLLPD ++ | RKPM_SLP_CENTER_PD ++ | RKPM_SLP_AP_PWROFF ++ ) ++ >; ++ rockchip,wakeup-config = < ++ (0 ++ | RKPM_GPIO_WKUP_EN ++ | RKPM_PWM_WKUP_EN ++ ) ++ >; ++ rockchip,pwm-regulator-config = < ++ (0 ++ | PWM2_REGULATOR_EN ++ ) ++ >; ++ rockchip,power-ctrl = ++ <&gpio1 17 GPIO_ACTIVE_HIGH>, ++ <&gpio1 14 GPIO_ACTIVE_HIGH>; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&cif_isp0 { ++ rockchip,camera-modules-attached = <&camera0>; ++ status = "okay"; ++}; ++ ++&isp0_mmu { ++ status = "okay"; ++}; ++ ++&cif_isp1 { ++ rockchip,camera-modules-attached = <&camera1>; ++ status = "disabled"; ++}; ++ ++&isp1_mmu { ++ status = "okay"; ++}; ++ ++&vpu { ++ status = "okay"; ++ /* 0 means ion, 1 means drm */ ++ //allocator = <0>; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ /* 0 means ion, 1 means drm */ ++ //allocator = <0>; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; + +From 493cb1d1e8ae9aeafe0a008039fb03fe7f441c8b Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 28 Jan 2018 15:38:32 +0100 +Subject: [PATCH] arm: dts: rk3288: add cec clock and pinctrl + +--- + arch/arm/boot/dts/rk3288.dtsi | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi +index 9cca69f9f5ba..2141eb23faa7 100644 +--- a/arch/arm/boot/dts/rk3288.dtsi ++++ b/arch/arm/boot/dts/rk3288.dtsi +@@ -981,6 +981,8 @@ + <&cru PCLK_MIPI_DSI1>, + <&cru SCLK_EDP_24M>, + <&cru SCLK_EDP>, ++ <&cru SCLK_HDMI_CEC>, ++ <&cru SCLK_HDMI_HDCP>, + <&cru SCLK_ISP_JPE>, + <&cru SCLK_ISP>, + <&cru SCLK_RGA>; +@@ -1579,10 +1581,10 @@ + reg-io-width = <4>; + rockchip,grf = <&grf>; + interrupts = ; +- clocks = <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>; +- clock-names = "iahb", "isfr"; ++ clocks = <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>, <&cru SCLK_HDMI_CEC>; ++ clock-names = "iahb", "isfr", "cec"; + pinctrl-names = "default", "sleep"; +- pinctrl-0 = <&hdmi_ddc>; ++ pinctrl-0 = <&hdmi_ddc>, <&hdmi_cec_c0>; + pinctrl-1 = <&hdmi_gpio>; + power-domains = <&power RK3288_PD_VIO>; + status = "disabled"; +@@ -1966,6 +1968,14 @@ + &pcfg_pull_none>; + }; + ++ hdmi_cec_c0: hdmi-cec-c0 { ++ rockchip,pins = <7 16 RK_FUNC_2 &pcfg_pull_none>; ++ }; ++ ++ hdmi_cec_c7: hdmi-cec-c7 { ++ rockchip,pins = <7 23 RK_FUNC_4 &pcfg_pull_none>; ++ }; ++ + hdmi_ddc: hdmi-ddc { + rockchip,pins = <7 19 RK_FUNC_2 &pcfg_pull_none>, + <7 20 RK_FUNC_2 &pcfg_pull_none>; + +From d7b647f6bb133b0ee27d759900516c1750c268fe Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 4 Mar 2018 09:08:35 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3328-box-trn9 board + +--- + arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts | 675 +++++++++++++++++++++++ + 1 file changed, 675 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts b/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts +new file mode 100644 +index 000000000000..51d471ba8cef +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts +@@ -0,0 +1,675 @@ ++/* ++ * 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. ++ */ ++ ++/dts-v1/; ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Rockchip RK3328 TRN9"; ++ compatible = "rockchip,rk3328-box-trn9", "rockchip,rk3328"; ++ ++ chosen { ++ bootargs = "swiotlb=1 kpti=0"; ++ }; ++ ++ aliases { ++ serial0 = &uart2; ++ serial2 = &uart0; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ gmac_clkin: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clkin"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ 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_gpio>; ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ 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-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb20_host_drv>; ++ regulator-name = "vcc_host1_5v"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power { ++ gpios = <&rk805 0 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-on"; ++ default-state = "on"; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-trn9"; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "I2S"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++ ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ 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 = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ BT,power_gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; ++ BT,wake_host_irq = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "rtl8723bs"; ++ WIFI,host_wake_irq = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ supports-emmc; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; ++}; ++ ++&gmac2io { ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmiim1_pins>; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x26>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ clock_in_out = "output"; ++ status = "disabled"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ ++&h265e { ++ status = "okay"; ++}; ++ ++&h265e_mmu { ++ 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"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <6 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "rk805-clkout1", "rk805-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ rtc { ++ status = "okay"; ++ }; ++ ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: RK805_DCDC1 { ++ regulator-compatible = "RK805_DCDC1"; ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: RK805_DCDC2 { ++ regulator-compatible = "RK805_DCDC2"; ++ regulator-name = "vdd_arm"; ++ regulator-init-microvolt = <1225000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: RK805_DCDC3 { ++ regulator-compatible = "RK805_DCDC3"; ++ regulator-name = "vcc_ddr"; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: RK805_DCDC4 { ++ regulator-compatible = "RK805_DCDC4"; ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: RK805_LDO1 { ++ regulator-compatible = "RK805_LDO1"; ++ regulator-name = "vcc_18"; ++ 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>; ++ }; ++ }; ++ ++ vcc18_emmc: RK805_LDO2 { ++ regulator-compatible = "RK805_LDO2"; ++ regulator-name = "vcc18_emmc"; ++ 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>; ++ }; ++ }; ++ ++ vdd_10: RK805_LDO3 { ++ regulator-compatible = "RK805_LDO3"; ++ regulator-name = "vdd_10"; ++ 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>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&i2s1 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_18>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_18>; ++ 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 RK_FUNC_1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ 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 = <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>; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ vcodec-supply = <&vdd_logic>; ++}; ++ ++&rkvdec_mmu { ++ status = "okay"; ++}; ++ ++&sdmmc_ext { ++ 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 = <&sdmmc0ext_bus4 &sdmmc0ext_cmd &sdmmc0ext_clk>; ++ sd-uhs-sdr104; ++ supports-sdio; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ supports-sd; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spdifm0_tx>; ++ 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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ phy-supply = <&vcc_host1_5v>; ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ phy-supply = <&vcc_otg_5v>; ++ status = "okay"; ++}; ++ ++&u3phy { ++ status = "okay"; ++}; ++ ++&u3phy_utmi { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&u3phy_pipe { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3 { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vpu_service { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++}; ++ ++&vepu_mmu { ++ status = "okay"; ++}; ++ ++&venc_srv { ++ status = "okay"; ++}; + +From 9c8d6637e4223718bdefacb33c32ffd1b386a343 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 4 Mar 2018 09:08:35 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3328-box-z28 board + +--- + arch/arm64/boot/dts/rockchip/rk3328-box-z28.dts | 598 ++++++++++++++++++++++++ + 1 file changed, 598 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-box-z28.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-box-z28.dts b/arch/arm64/boot/dts/rockchip/rk3328-box-z28.dts +new file mode 100644 +index 000000000000..00a3394cefcb +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-box-z28.dts +@@ -0,0 +1,598 @@ ++/* ++ * 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. ++ */ ++ ++/dts-v1/; ++#include "rk3328.dtsi" ++ ++/ { ++ model = "Rockchip RK3328 Z28"; ++ compatible = "rockchip,rk3328-box-z28", "rockchip,rk3328"; ++ ++ chosen { ++ bootargs = "earlyprintk=uart8250-32bit,0xff130000 swiotlb=1 kpti=0"; ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ 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_gpio>; ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ 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-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb20_host_drv>; ++ regulator-name = "vcc_host1_5v"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power { ++ gpios = <&rk805 0 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ default-state = "on"; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ BT,power_gpio = <&gpio2 RK_PC5 GPIO_ACTIVE_HIGH>; ++ BT,wake_host_irq = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "rtl8188eu"; ++ WIFI,poweren_gpio = <&gpio2 RK_PC3 GPIO_ACTIVE_HIGH>; ++ WIFI,reset_gpio = <&gpio2 RK_PC4 GPIO_ACTIVE_HIGH>; ++ WIFI,host_wake_irq = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu1 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu2 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&cpu3 { ++ cpu-supply = <&vdd_arm>; ++}; ++ ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ supports-emmc; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; ++}; ++ ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ clock_in_out = "output"; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ ++&h265e { ++ status = "okay"; ++}; ++ ++&h265e_mmu { ++ 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"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <6 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "rk805-clkout1", "rk805-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_sys>; ++ ++ rtc { ++ status = "okay"; ++ }; ++ ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: RK805_DCDC1 { ++ regulator-compatible = "RK805_DCDC1"; ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: RK805_DCDC2 { ++ regulator-compatible = "RK805_DCDC2"; ++ regulator-name = "vdd_arm"; ++ regulator-init-microvolt = <1225000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = <0x1>; ++ regulator-ramp-delay = <12500>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: RK805_DCDC3 { ++ regulator-compatible = "RK805_DCDC3"; ++ regulator-name = "vcc_ddr"; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: RK805_DCDC4 { ++ regulator-compatible = "RK805_DCDC4"; ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = <0x1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-mode = <0x2>; ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcc_18: RK805_LDO1 { ++ regulator-compatible = "RK805_LDO1"; ++ regulator-name = "vcc_18"; ++ 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>; ++ }; ++ }; ++ ++ vcc18_emmc: RK805_LDO2 { ++ regulator-compatible = "RK805_LDO2"; ++ regulator-name = "vcc18_emmc"; ++ 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>; ++ }; ++ }; ++ ++ vdd_10: RK805_LDO3 { ++ regulator-compatible = "RK805_LDO3"; ++ regulator-name = "vdd_10"; ++ 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>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ 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 RK_FUNC_1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ vcodec-supply = <&vdd_logic>; ++}; ++ ++&rkvdec_mmu { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ supports-sd; ++ vmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&spdif { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spdifm0_tx>; ++ 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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&u2phy { ++ status = "okay"; ++}; ++ ++&u2phy_host { ++ phy-supply = <&vcc_host1_5v>; ++ status = "okay"; ++}; ++ ++&u2phy_otg { ++ phy-supply = <&vcc_otg_5v>; ++ status = "okay"; ++}; ++ ++&u3phy { ++ status = "okay"; ++}; ++ ++&u3phy_utmi { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&u3phy_pipe { ++ phy-supply = <&vcc_host_5v>; ++ status = "okay"; ++}; ++ ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3 { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vpu_service { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++}; ++ ++&vepu_mmu { ++ status = "okay"; ++}; ++ ++&venc_srv { ++ status = "okay"; ++}; + +From 63d34d434542f4551cc12578317f7d6337918d1d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 10 Apr 2018 22:07:37 +0200 +Subject: [PATCH] arm64: dts: rockchip: rk3328-roc-cc: use 1066MHz ddr + frequency + +--- + .../dts/rockchip/rk3328-dram-box-plus-timing.dtsi | 263 +++++++++++++++++++++ + arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 33 ++- + 2 files changed, 295 insertions(+), 1 deletion(-) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-dram-box-plus-timing.dtsi + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-dram-box-plus-timing.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-dram-box-plus-timing.dtsi +new file mode 100644 +index 000000000000..ac34cc7ab1ce +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-dram-box-plus-timing.dtsi +@@ -0,0 +1,263 @@ ++/* ++ * Copyright (c) 2016 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 { ++ 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 = <1>; ++ ddr3a0_ddr4a10_de-skew = <1>; ++ ddr3a3_ddr4a6_de-skew = <0>; ++ ddr3a2_ddr4a4_de-skew = <1>; ++ ddr3a5_ddr4a8_de-skew = <0>; ++ ddr3a4_ddr4a5_de-skew = <1>; ++ ddr3a7_ddr4a11_de-skew = <1>; ++ ddr3a6_ddr4a7_de-skew = <0>; ++ ddr3a9_ddr4a0_de-skew = <1>; ++ ddr3a8_ddr4a13_de-skew = <0>; ++ ddr3a11_ddr4a3_de-skew = <2>; ++ ddr3a10_ddr4cs0_de-skew = <3>; ++ ddr3a13_ddr4a2_de-skew = <1>; ++ ddr3a12_ddr4ba1_de-skew = <0>; ++ ddr3a15_ddr4odt0_de-skew = <3>; ++ ddr3a14_ddr4a1_de-skew = <2>; ++ ddr3ba1_ddr4a15_de-skew = <1>; ++ ddr3ba0_ddr4bg0_de-skew = <1>; ++ ddr3ras_ddr4cke_de-skew = <3>; ++ ddr3ba2_ddr4ba0_de-skew = <1>; ++ ddr3we_ddr4bg1_de-skew = <3>; ++ ddr3cas_ddr4a12_de-skew = <1>; ++ ddr3ckn_ddr4ckn_de-skew = <4>; ++ ddr3ckp_ddr4ckp_de-skew = <4>; ++ ddr3cke_ddr4a16_de-skew = <1>; ++ ddr3odt0_ddr4a14_de-skew = <1>; ++ ddr3cs0_ddr4act_de-skew = <2>; ++ ddr3reset_ddr4reset_de-skew = <3>; ++ ddr3cs1_ddr4cs1_de-skew = <2>; ++ ddr3odt1_ddr4odt1_de-skew = <2>; ++ ++ /* 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 = <8>; ++ cs0_dm0_tx_de-skew = <9>; ++ cs0_dq0_rx_de-skew = <8>; ++ cs0_dq0_tx_de-skew = <9>; ++ cs0_dq1_rx_de-skew = <8>; ++ cs0_dq1_tx_de-skew = <9>; ++ cs0_dq2_rx_de-skew = <8>; ++ cs0_dq2_tx_de-skew = <9>; ++ cs0_dq3_rx_de-skew = <8>; ++ cs0_dq3_tx_de-skew = <9>; ++ cs0_dq4_rx_de-skew = <8>; ++ cs0_dq4_tx_de-skew = <9>; ++ cs0_dq5_rx_de-skew = <8>; ++ cs0_dq5_tx_de-skew = <9>; ++ cs0_dq6_rx_de-skew = <8>; ++ cs0_dq6_tx_de-skew = <9>; ++ cs0_dq7_rx_de-skew = <8>; ++ cs0_dq7_tx_de-skew = <9>; ++ cs0_dqs0_rx_de-skew = <7>; ++ cs0_dqs0p_tx_de-skew = <10>; ++ cs0_dqs0n_tx_de-skew = <10>; ++ ++ cs0_dm1_rx_de-skew = <8>; ++ cs0_dm1_tx_de-skew = <8>; ++ cs0_dq8_rx_de-skew = <8>; ++ cs0_dq8_tx_de-skew = <9>; ++ cs0_dq9_rx_de-skew = <8>; ++ cs0_dq9_tx_de-skew = <8>; ++ cs0_dq10_rx_de-skew = <8>; ++ cs0_dq10_tx_de-skew = <9>; ++ cs0_dq11_rx_de-skew = <8>; ++ cs0_dq11_tx_de-skew = <8>; ++ cs0_dq12_rx_de-skew = <8>; ++ cs0_dq12_tx_de-skew = <9>; ++ cs0_dq13_rx_de-skew = <8>; ++ cs0_dq13_tx_de-skew = <8>; ++ cs0_dq14_rx_de-skew = <8>; ++ cs0_dq14_tx_de-skew = <9>; ++ cs0_dq15_rx_de-skew = <8>; ++ cs0_dq15_tx_de-skew = <8>; ++ cs0_dqs1_rx_de-skew = <8>; ++ cs0_dqs1p_tx_de-skew = <10>; ++ cs0_dqs1n_tx_de-skew = <10>; ++ ++ cs0_dm2_rx_de-skew = <8>; ++ cs0_dm2_tx_de-skew = <9>; ++ cs0_dq16_rx_de-skew = <8>; ++ cs0_dq16_tx_de-skew = <9>; ++ cs0_dq17_rx_de-skew = <8>; ++ cs0_dq17_tx_de-skew = <9>; ++ cs0_dq18_rx_de-skew = <8>; ++ cs0_dq18_tx_de-skew = <9>; ++ cs0_dq19_rx_de-skew = <8>; ++ cs0_dq19_tx_de-skew = <9>; ++ cs0_dq20_rx_de-skew = <8>; ++ cs0_dq20_tx_de-skew = <9>; ++ cs0_dq21_rx_de-skew = <8>; ++ cs0_dq21_tx_de-skew = <9>; ++ cs0_dq22_rx_de-skew = <8>; ++ cs0_dq22_tx_de-skew = <9>; ++ cs0_dq23_rx_de-skew = <8>; ++ cs0_dq23_tx_de-skew = <9>; ++ cs0_dqs2_rx_de-skew = <7>; ++ cs0_dqs2p_tx_de-skew = <10>; ++ cs0_dqs2n_tx_de-skew = <10>; ++ ++ cs0_dm3_rx_de-skew = <8>; ++ cs0_dm3_tx_de-skew = <8>; ++ cs0_dq24_rx_de-skew = <8>; ++ cs0_dq24_tx_de-skew = <9>; ++ cs0_dq25_rx_de-skew = <8>; ++ cs0_dq25_tx_de-skew = <8>; ++ cs0_dq26_rx_de-skew = <8>; ++ cs0_dq26_tx_de-skew = <8>; ++ cs0_dq27_rx_de-skew = <8>; ++ cs0_dq27_tx_de-skew = <8>; ++ cs0_dq28_rx_de-skew = <8>; ++ cs0_dq28_tx_de-skew = <8>; ++ cs0_dq29_rx_de-skew = <8>; ++ cs0_dq29_tx_de-skew = <8>; ++ cs0_dq30_rx_de-skew = <8>; ++ cs0_dq30_tx_de-skew = <8>; ++ cs0_dq31_rx_de-skew = <8>; ++ cs0_dq31_tx_de-skew = <8>; ++ cs0_dqs3_rx_de-skew = <8>; ++ cs0_dqs3p_tx_de-skew = <10>; ++ cs0_dqs3n_tx_de-skew = <10>; ++ ++ cs1_dm0_rx_de-skew = <8>; ++ cs1_dm0_tx_de-skew = <9>; ++ cs1_dq0_rx_de-skew = <8>; ++ cs1_dq0_tx_de-skew = <9>; ++ cs1_dq1_rx_de-skew = <8>; ++ cs1_dq1_tx_de-skew = <9>; ++ cs1_dq2_rx_de-skew = <8>; ++ cs1_dq2_tx_de-skew = <9>; ++ cs1_dq3_rx_de-skew = <8>; ++ cs1_dq3_tx_de-skew = <9>; ++ cs1_dq4_rx_de-skew = <8>; ++ cs1_dq4_tx_de-skew = <9>; ++ cs1_dq5_rx_de-skew = <8>; ++ cs1_dq5_tx_de-skew = <9>; ++ cs1_dq6_rx_de-skew = <8>; ++ cs1_dq6_tx_de-skew = <9>; ++ cs1_dq7_rx_de-skew = <8>; ++ cs1_dq7_tx_de-skew = <9>; ++ cs1_dqs0_rx_de-skew = <7>; ++ cs1_dqs0p_tx_de-skew = <10>; ++ cs1_dqs0n_tx_de-skew = <10>; ++ ++ cs1_dm1_rx_de-skew = <8>; ++ cs1_dm1_tx_de-skew = <8>; ++ cs1_dq8_rx_de-skew = <8>; ++ cs1_dq8_tx_de-skew = <9>; ++ cs1_dq9_rx_de-skew = <8>; ++ cs1_dq9_tx_de-skew = <8>; ++ cs1_dq10_rx_de-skew = <8>; ++ cs1_dq10_tx_de-skew = <9>; ++ cs1_dq11_rx_de-skew = <8>; ++ cs1_dq11_tx_de-skew = <8>; ++ cs1_dq12_rx_de-skew = <8>; ++ cs1_dq12_tx_de-skew = <9>; ++ cs1_dq13_rx_de-skew = <8>; ++ cs1_dq13_tx_de-skew = <8>; ++ cs1_dq14_rx_de-skew = <8>; ++ cs1_dq14_tx_de-skew = <9>; ++ cs1_dq15_rx_de-skew = <8>; ++ cs1_dq15_tx_de-skew = <8>; ++ cs1_dqs1_rx_de-skew = <8>; ++ cs1_dqs1p_tx_de-skew = <10>; ++ cs1_dqs1n_tx_de-skew = <10>; ++ ++ cs1_dm2_rx_de-skew = <8>; ++ cs1_dm2_tx_de-skew = <9>; ++ cs1_dq16_rx_de-skew = <8>; ++ cs1_dq16_tx_de-skew = <9>; ++ cs1_dq17_rx_de-skew = <8>; ++ cs1_dq17_tx_de-skew = <9>; ++ cs1_dq18_rx_de-skew = <8>; ++ cs1_dq18_tx_de-skew = <9>; ++ cs1_dq19_rx_de-skew = <8>; ++ cs1_dq19_tx_de-skew = <9>; ++ cs1_dq20_rx_de-skew = <8>; ++ cs1_dq20_tx_de-skew = <9>; ++ cs1_dq21_rx_de-skew = <8>; ++ cs1_dq21_tx_de-skew = <9>; ++ cs1_dq22_rx_de-skew = <8>; ++ cs1_dq22_tx_de-skew = <9>; ++ cs1_dq23_rx_de-skew = <8>; ++ cs1_dq23_tx_de-skew = <9>; ++ cs1_dqs2_rx_de-skew = <7>; ++ cs1_dqs2p_tx_de-skew = <10>; ++ cs1_dqs2n_tx_de-skew = <10>; ++ ++ cs1_dm3_rx_de-skew = <8>; ++ cs1_dm3_tx_de-skew = <8>; ++ cs1_dq24_rx_de-skew = <8>; ++ cs1_dq24_tx_de-skew = <9>; ++ cs1_dq25_rx_de-skew = <8>; ++ cs1_dq25_tx_de-skew = <8>; ++ cs1_dq26_rx_de-skew = <8>; ++ cs1_dq26_tx_de-skew = <8>; ++ cs1_dq27_rx_de-skew = <8>; ++ cs1_dq27_tx_de-skew = <8>; ++ cs1_dq28_rx_de-skew = <8>; ++ cs1_dq28_tx_de-skew = <8>; ++ cs1_dq29_rx_de-skew = <8>; ++ cs1_dq29_tx_de-skew = <8>; ++ cs1_dq30_rx_de-skew = <8>; ++ cs1_dq30_tx_de-skew = <8>; ++ cs1_dq31_rx_de-skew = <8>; ++ cs1_dq31_tx_de-skew = <8>; ++ cs1_dqs3_rx_de-skew = <8>; ++ cs1_dqs3p_tx_de-skew = <10>; ++ cs1_dqs3n_tx_de-skew = <10>; ++}; +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index e911cf265a64..5df9b4976ba2 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -42,6 +42,7 @@ + + /dts-v1/; + #include "rk3328.dtsi" ++#include "rk3328-dram-box-plus-timing.dtsi" + + / { + model = "Firefly ROC-RK3328-CC Board"; +@@ -193,7 +194,37 @@ + + &dmc { + center-supply = <&vdd_logic>; +- status = "okay"; ++ system-status-freq = < ++ /*system status freq(KHz)*/ ++ SYS_STATUS_NORMAL 1066000 ++ SYS_STATUS_REBOOT 1066000 ++ SYS_STATUS_SUSPEND 1066000 ++ SYS_STATUS_VIDEO_1080P 1066000 ++ SYS_STATUS_VIDEO_4K 1066000 ++ SYS_STATUS_VIDEO_4K_10B 1066000 ++ SYS_STATUS_PERFORMANCE 1066000 ++ SYS_STATUS_BOOST 1066000 ++ >; ++ status = "okay"; ++}; ++ ++&dmc_opp_table { ++ rockchip,leakage-voltage-sel = < ++ 1 8 0 ++ 9 254 0 ++ >; ++ opp-933000000 { ++ opp-hz = /bits/ 64 <933000000>; ++ opp-microvolt = <1150000>; ++ opp-microvolt-L0 = <1150000>; ++ opp-microvolt-L1 = <1100000>; ++ }; ++ opp-1066000000 { ++ opp-hz = /bits/ 64 <1066000000>; ++ opp-microvolt = <1200000>; ++ opp-microvolt-L0 = <1200000>; ++ opp-microvolt-L1 = <1175000>; ++ }; + }; + + &display_subsystem { + +From 76d468bccff1b742965b5a8d78beb028488ee6e3 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 21 Apr 2018 13:21:24 +0200 +Subject: [PATCH] arm64: dts: rockchip: rk3328-box-trn9: use 1066MHz ddr + frequency + +--- + arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts | 29 +++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts b/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts +index 51d471ba8cef..81ec7b66e199 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-box-trn9.dts +@@ -42,6 +42,7 @@ + + /dts-v1/; + #include "rk3328.dtsi" ++#include "rk3328-dram-box-plus-timing.dtsi" + + / { + model = "Rockchip RK3328 TRN9"; +@@ -240,7 +241,33 @@ + + &dmc { + center-supply = <&vdd_logic>; +- status = "okay"; ++ system-status-freq = < ++ /*system status freq(KHz)*/ ++ SYS_STATUS_NORMAL 1066000 ++ SYS_STATUS_REBOOT 1066000 ++ SYS_STATUS_SUSPEND 1066000 ++ SYS_STATUS_VIDEO_1080P 1066000 ++ SYS_STATUS_VIDEO_4K 1066000 ++ SYS_STATUS_VIDEO_4K_10B 1066000 ++ SYS_STATUS_PERFORMANCE 1066000 ++ SYS_STATUS_BOOST 1066000 ++ >; ++ status = "okay"; ++}; ++ ++&dmc_opp_table { ++ opp-933000000 { ++ opp-hz = /bits/ 64 <933000000>; ++ opp-microvolt = <1150000>; ++ opp-microvolt-L0 = <1150000>; ++ opp-microvolt-L1 = <1100000>; ++ }; ++ opp-1066000000 { ++ opp-hz = /bits/ 64 <1066000000>; ++ opp-microvolt = <1200000>; ++ opp-microvolt-L0 = <1200000>; ++ opp-microvolt-L1 = <1175000>; ++ }; + }; + + &display_subsystem { + +From 6116b7515612fa5ce0ada65030f3cfc71eb70206 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 18 Aug 2018 20:53:04 +0200 +Subject: [PATCH] arm64: dts: rockchip: rk3399: update dtsi + +--- + arch/arm64/boot/dts/rockchip/rk3399-linux.dtsi | 14 +----------- + arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi | 17 ++++++++++++--- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 26 ++++++++++++++++++++++- + 3 files changed, 40 insertions(+), 17 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-linux.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-linux.dtsi +index 2851cd529e04..7be2af6b0ba8 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-linux.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-linux.dtsi +@@ -47,18 +47,7 @@ + compatible = "rockchip,linux", "rockchip,rk3399"; + + chosen { +- bootargs = "earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 console=ttyFIQ0 rw root=PARTUUID=614e0000-0000 rootfstype=ext4 rootwait"; +- }; +- +- reserved-memory { +- #address-cells = <2>; +- #size-cells = <2>; +- ranges; +- +- drm_logo: drm-logo@00000000 { +- compatible = "rockchip,drm-logo"; +- reg = <0x0 0x0 0x0 0x0>; +- }; ++ bootargs = "earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1"; + }; + + cif_isp0: cif_isp@ff910000 { +@@ -120,7 +109,6 @@ + status = "disabled"; + + ports = <&vopb_out>, <&vopl_out>; +- logo-memory-region = <&drm_logo>; + + route { + route_hdmi: route-hdmi { +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +index 3d76b9733665..62ba4281197e 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +@@ -536,6 +536,14 @@ + status = "okay"; + }; + ++&pvtm { ++ status = "okay"; ++}; ++ ++&pmu_pvtm { ++ status = "okay"; ++}; ++ + &pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +@@ -563,7 +571,7 @@ + + &sdio0 { + clock-frequency = <50000000>; +- clock-freq-min-max = <200000 50000000>; ++ max-frequency = <50000000>; + supports-sdio; + bus-width = <4>; + disable-wp; +@@ -581,14 +589,17 @@ + + &sdmmc { + clock-frequency = <150000000>; +- clock-freq-min-max = <100000 150000000>; ++ max-frequency = <150000000>; + supports-sd; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + num-slots = <1>; +- //sd-uhs-sdr104; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + pinctrl-names = "default"; +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 815a8c131239..fbe3d0edc961 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -646,6 +646,8 @@ + uart0: serial@ff180000 { + compatible = "rockchip,rk3399-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff180000 0x0 0x100>; ++ dmas = <&dmac_peri 0>, <&dmac_peri 1>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>; + clock-names = "baudclk", "apb_pclk"; + interrupts = ; +@@ -659,6 +661,8 @@ + uart1: serial@ff190000 { + compatible = "rockchip,rk3399-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff190000 0x0 0x100>; ++ dmas = <&dmac_peri 2>, <&dmac_peri 3>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>; + clock-names = "baudclk", "apb_pclk"; + interrupts = ; +@@ -672,6 +676,8 @@ + uart2: serial@ff1a0000 { + compatible = "rockchip,rk3399-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff1a0000 0x0 0x100>; ++ dmas = <&dmac_peri 4>, <&dmac_peri 5>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>; + clock-names = "baudclk", "apb_pclk"; + interrupts = ; +@@ -685,6 +691,8 @@ + uart3: serial@ff1b0000 { + compatible = "rockchip,rk3399-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff1b0000 0x0 0x100>; ++ dmas = <&dmac_peri 6>, <&dmac_peri 7>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>; + clock-names = "baudclk", "apb_pclk"; + interrupts = ; +@@ -698,6 +706,8 @@ + spi0: spi@ff1c0000 { + compatible = "rockchip,rk3399-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff1c0000 0x0 0x1000>; ++ dmas = <&dmac_peri 10>, <&dmac_peri 11>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>; + clock-names = "spiclk", "apb_pclk"; + interrupts = ; +@@ -711,6 +721,8 @@ + spi1: spi@ff1d0000 { + compatible = "rockchip,rk3399-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff1d0000 0x0 0x1000>; ++ dmas = <&dmac_peri 12>, <&dmac_peri 13>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>; + clock-names = "spiclk", "apb_pclk"; + interrupts = ; +@@ -724,6 +736,8 @@ + spi2: spi@ff1e0000 { + compatible = "rockchip,rk3399-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff1e0000 0x0 0x1000>; ++ dmas = <&dmac_peri 14>, <&dmac_peri 15>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>; + clock-names = "spiclk", "apb_pclk"; + interrupts = ; +@@ -737,6 +751,8 @@ + spi4: spi@ff1f0000 { + compatible = "rockchip,rk3399-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff1f0000 0x0 0x1000>; ++ dmas = <&dmac_peri 18>, <&dmac_peri 19>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_SPI4>, <&cru PCLK_SPI4>; + clock-names = "spiclk", "apb_pclk"; + interrupts = ; +@@ -750,6 +766,8 @@ + spi5: spi@ff200000 { + compatible = "rockchip,rk3399-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff200000 0x0 0x1000>; ++ dmas = <&dmac_bus 8>, <&dmac_bus 9>; ++ dma-names = "tx", "rx"; + clocks = <&cru SCLK_SPI5>, <&cru PCLK_SPI5>; + clock-names = "spiclk", "apb_pclk"; + interrupts = ; +@@ -1152,6 +1170,8 @@ + spi3: spi@ff350000 { + compatible = "rockchip,rk3399-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff350000 0x0 0x1000>; ++ dmas = <&dmac_peri 16>, <&dmac_peri 17>; ++ dma-names = "tx", "rx"; + clocks = <&pmucru SCLK_SPI3_PMU>, <&pmucru PCLK_SPI3_PMU>; + clock-names = "spiclk", "apb_pclk"; + interrupts = ; +@@ -1165,6 +1185,8 @@ + uart4: serial@ff370000 { + compatible = "rockchip,rk3399-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff370000 0x0 0x100>; ++ dmas = <&dmac_peri 8>, <&dmac_peri 9>; ++ dma-names = "tx", "rx"; + clocks = <&pmucru SCLK_UART4_PMU>, <&pmucru PCLK_UART4_PMU>; + clock-names = "baudclk", "apb_pclk"; + interrupts = ; +@@ -1790,6 +1812,7 @@ + clocks = <&cru ACLK_VOP1>, <&cru DCLK_VOP1>, <&cru HCLK_VOP1>, <&cru DCLK_VOP1_DIV>; + clock-names = "aclk_vop", "dclk_vop", "hclk_vop", "dclk_source"; + iommus = <&vopl_mmu>; ++ rockchip,grf = <&grf>; + power-domains = <&power RK3399_PD_VOPL>; + resets = <&cru SRST_A_VOP1>, <&cru SRST_H_VOP1>, <&cru SRST_D_VOP1>; + reset-names = "axi", "ahb", "dclk"; +@@ -1860,6 +1883,7 @@ + clock-names = "aclk_vop", "dclk_vop", "hclk_vop", "dclk_source"; + resets = <&cru SRST_A_VOP0>, <&cru SRST_H_VOP0>, <&cru SRST_D_VOP0>; + reset-names = "axi", "ahb", "dclk"; ++ rockchip,grf = <&grf>; + power-domains = <&power RK3399_PD_VOPB>; + iommus = <&vopb_mmu>; + status = "disabled"; +@@ -1982,7 +2006,7 @@ + compatible = "rockchip,rk3399-dw-hdmi"; + reg = <0x0 0xff940000 0x0 0x20000>; + pinctrl-names = "default"; +- pinctrl-0 = <&hdmi_i2c_xfer>; ++ pinctrl-0 = <&hdmi_i2c_xfer>, <&hdmi_cec>; + interrupts = ; + clocks = <&cru PCLK_HDMI_CTRL>, + <&cru SCLK_HDMI_SFR>, + +From caa58eaa7cec6e36cdd4e3ec91757f01504b5f2e Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 19 Aug 2018 23:10:05 +0200 +Subject: [PATCH] arm64: dts: rk3399-rockpro64: update dts + +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 421 +++++++++------------- + 1 file changed, 175 insertions(+), 246 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +index 02b8ba7dcc94..aa1aee547036 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +@@ -8,23 +8,33 @@ + #include + #include + #include "rk3399.dtsi" ++#include "rk3399-linux.dtsi" + #include "rk3399-opp.dtsi" + + / { + model = "Pine64 RockPro64"; + compatible = "pine64,rockpro64", "rockchip,rk3399"; + +- chosen { +- bootargs = "earlyprintk=uart8250,mmio32,0xff1a0000 swiotlb=1"; +- stdout-path = "serial2:1500000n8"; +- }; +- + /* first 64k(0xff8c0000~0xff8d0000) for ddr and suspend */ + iram: sram@ff8d0000 { + compatible = "mmio-sram"; + reg = <0x0 0xff8d0000 0x0 0x20000>; /* 128k */ + }; + ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ + dc_12v: dc-12v { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; +@@ -92,6 +102,7 @@ + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; ++ pwm-supply = <&vcc_sys>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; +@@ -101,56 +112,54 @@ + /* for rockchip boot on */ + rockchip,pwm_id= <2>; + rockchip,pwm_voltage = <900000>; ++ }; + +- vin-supply = <&vcc_sys>; ++ leds { ++ compatible = "gpio-leds"; ++ ++ work-led { ++ gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "mmc0"; ++ }; ++ ++ diy-led { ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ }; + }; + +- clkin_gmac: external-gmac-clock { +- compatible = "fixed-clock"; +- clock-frequency = <125000000>; +- clock-output-names = "clkin_gmac"; +- #clock-cells = <0>; ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-pine64"; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; + }; + +- spdif-sound { +- status = "disabled"; ++ hdmi-sound { + compatible = "simple-audio-card"; +- simple-audio-card,name = "ROCKCHIP,SPDIF"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "HDMI"; + simple-audio-card,cpu { +- sound-dai = <&spdif>; ++ sound-dai = <&i2s2>; + }; + simple-audio-card,codec { +- sound-dai = <&spdif_out>; ++ sound-dai = <&hdmi>; + }; + }; + +- spdif_out: spdif-out { ++ hdmi-dp-sound { ++ compatible = "rockchip,rk3399-hdmi-dp"; ++ rockchip,cpu = <&i2s2>; ++ rockchip,codec = <&hdmi>, <&cdn_dp>; + status = "disabled"; +- compatible = "linux,spdif-dit"; +- #sound-dai-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>; +- +- /* +- * 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_PB2 GPIO_ACTIVE_LOW>; + }; + + es8316-sound { +- status = "okay"; + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; +- simple-audio-card,name = "rockchip,es8316-codec"; ++ simple-audio-card,name = "ES8316"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", +@@ -168,40 +177,59 @@ + }; + }; + +- leds { +- status = "okay"; +- compatible = "gpio-leds"; +- work-led { +- gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "heartbeat"; +- default-state = "on"; ++ spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; + }; +- diy-led { +- gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "none"; +- default-state = "off"; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; + }; + }; + +- rk_key: rockchip-key { +- compatible = "rockchip,key"; +- status = "okay"; ++ spdif_out: spdif-out { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; + +- io-channels = <&saradc 1>; ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; + +- power-key { +- gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; +- linux,code = <116>; +- label = "power"; +- gpio-key,wakeup; +- }; ++ /* ++ * 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_PB2 GPIO_ACTIVE_LOW>; + }; + +- hdmi_dp_sound: hdmi-dp-sound { +- status = "okay"; +- compatible = "rockchip,rk3399-hdmi-dp"; +- rockchip,cpu = <&i2s2>; +- rockchip,codec = <&hdmi>, <&cdn_dp>; ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; ++ status = "disabled"; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ uart_rts_gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ BT,reset_gpio = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; ++ BT,wake_gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; ++ BT,wake_host_irq = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ status = "disabled"; + }; + }; + +@@ -253,30 +281,21 @@ + &dmc { + status = "okay"; + center-supply = <&vdd_center>; +- upthreshold = <40>; +- downdifferential = <20>; + system-status-freq = < + /*system status freq(KHz)*/ + SYS_STATUS_NORMAL 800000 + SYS_STATUS_REBOOT 400000 + SYS_STATUS_SUSPEND 400000 +- SYS_STATUS_VIDEO_1080P 400000 ++ SYS_STATUS_VIDEO_1080P 800000 + SYS_STATUS_VIDEO_4K 800000 + SYS_STATUS_VIDEO_4K_10B 800000 + SYS_STATUS_PERFORMANCE 800000 +- SYS_STATUS_BOOST 400000 ++ SYS_STATUS_BOOST 800000 + SYS_STATUS_DUALVIEW 800000 + SYS_STATUS_ISP 800000 + >; +- vop-bw-dmc-freq = < +- /* min_bw(MB/s) max_bw(MB/s) freq(KHz) */ +- 0 577 200000 +- 578 1701 300000 +- 1702 99999 400000 +- >; +- auto-min-freq = <400000>; ++ auto-min-freq = <800000>; + auto-freq-en = <0>; +- + }; + + &dmc_opp_table { +@@ -325,42 +344,26 @@ + &display_subsystem { + status = "okay"; + +- ports = <&vopb_out>; +- + route { + route_hdmi: route-hdmi { + status = "okay"; + connect = <&vopb_out_hdmi>; + }; + +- route_dsi: route-dsi { +- status = "disabled"; +- connect = <&vopb_out_dsi>; +- }; +- +- route_edp: route-edp { +- status = "disabled"; +- connect = <&vopb_out_edp>; ++ route_dp: route-dp { ++ connect = <&vopl_out_dp>; + }; + }; + }; + +-&dp_in_vopb { +- status = "disabled"; +-}; +- +-&edp { +- /delete-node/ pinctrl-0; +-}; +- + &emmc_phy { + status = "okay"; + }; + + &i2c0 { + status = "okay"; +- i2c-scl-rising-time-ns = <168>; +- i2c-scl-falling-time-ns = <4>; ++ i2c-scl-rising-time-ns = <180>; ++ i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + vdd_cpu_b: syr827@40 { +@@ -393,6 +396,7 @@ + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + regulator-initial-mode = <1>; /* 1:force PWM 2:auto */ +@@ -411,7 +415,7 @@ + rockchip,system-power-controller; + wakeup-source; + #clock-cells = <1>; +- clock-output-names = "xin32k", "rk808-clkout2"; ++ clock-output-names = "rk808-clkout1", "rk808-clkout2"; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; +@@ -429,8 +433,8 @@ + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; +- regulator-min-microvolt = <750000>; +- regulator-max-microvolt = <1350000>; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; +@@ -476,6 +480,7 @@ + regulator-name = "vcc1v8_dvp"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -487,6 +492,7 @@ + regulator-name = "vcc3v0_touch"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -510,6 +516,7 @@ + regulator-name = "vcc_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -586,14 +593,6 @@ + }; + }; + +-&i2s0 { +- status = "okay"; +- rockchip,i2s-broken-burst-len; +- rockchip,playback-channels = <8>; +- rockchip,capture-channels = <8>; +- #sound-dai-cells = <0>; +-}; +- + &i2c1 { + status = "okay"; + i2c-scl-rising-time-ns = <168>; +@@ -624,6 +623,14 @@ + }; + }; + ++&i2s0 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ #sound-dai-cells = <0>; ++}; ++ + &i2s1 { + status = "okay"; + rockchip,i2s-broken-burst-len; +@@ -634,6 +641,7 @@ + + &i2s2 { + #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; + status = "okay"; + }; + +@@ -641,6 +649,7 @@ + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + clock_in_out = "input"; ++ snps,force_thresh_dma_mode; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; +@@ -660,6 +669,17 @@ + }; + + &hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { + status = "okay"; + }; + +@@ -678,13 +698,17 @@ + + &sdmmc { + clock-frequency = <50000000>; +- clock-freq-min-max = <400000 150000000>; ++ max-frequency = <150000000>; + supports-sd; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + num-slots = <1>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; + vqmmc-supply = <&vcc_sd>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; +@@ -694,7 +718,7 @@ + + &sdio0 { + clock-frequency = <50000000>; +- clock-freq-min-max = <200000 50000000>; ++ max-frequency = <50000000>; + supports-sdio; + bus-width = <4>; + disable-wp; +@@ -707,35 +731,50 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; +- status = "okay"; ++ status = "disabled"; + }; + + &sdhci { + bus-width = <8>; +- mmc-hs200-1_8v; + mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ supports-emmc; ++ non-removable; + keep-power-in-suspend; + status = "okay"; + }; + + &spdif { +- status = "disabled"; ++ status = "okay"; + pinctrl-0 = <&spdif_bus_1>; + #sound-dai-cells = <0>; + }; + + &spi1 { + status = "okay"; ++ max-freq = <10000000>; ++ + flash@0 { +- compatible = "gigadevice,gd25q128", "jedec,spi-nor"; ++ compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; +- m25p,fast-read; +- spi-max-frequency = <24000000>; ++ spi-max-frequency = <10000000>; + }; + }; + ++&threshold { ++ temperature = <80000>; ++}; ++ ++&target { ++ temperature = <95000>; ++}; ++ ++&soc_crit { ++ temperature = <100000>; ++}; ++ + &tcphy0 { + extcon = <&fusb0>; + status = "okay"; +@@ -826,114 +865,15 @@ + status = "okay"; + }; + +-&pwm2 { ++&pwm1 { + status = "okay"; + pinctrl-names = "active"; +- pinctrl-0 = <&pwm2_pin_pull_down>; + }; + +-&pwm3 { ++&pwm2 { + status = "okay"; +- +- interrupts = ; +- compatible = "rockchip,remotectl-pwm"; +- remote_pwm_id = <3>; +- handle_cpu_id = <1>; +- remote_support_psci = <1>; +- +- ir_key1 { +- rockchip,usercode = <0x4040>; +- rockchip,key_table = +- <0xf2 KEY_REPLY>, +- <0xba KEY_BACK>, +- <0xf4 KEY_UP>, +- <0xf1 KEY_DOWN>, +- <0xef KEY_LEFT>, +- <0xee KEY_RIGHT>, +- <0xbd KEY_HOME>, +- <0xea KEY_VOLUMEUP>, +- <0xe3 KEY_VOLUMEDOWN>, +- <0xe2 KEY_SEARCH>, +- <0xb2 KEY_POWER>, +- <0xbc KEY_MUTE>, +- <0xec KEY_MENU>, +- <0xbf 0x190>, +- <0xe0 0x191>, +- <0xe1 0x192>, +- <0xe9 183>, +- <0xe6 248>, +- <0xe8 185>, +- <0xe7 186>, +- <0xf0 388>, +- <0xbe 0x175>; +- }; +- +- ir_key2 { +- rockchip,usercode = <0xff00>; +- rockchip,key_table = +- <0xf9 KEY_HOME>, +- <0xbf KEY_BACK>, +- <0xfb KEY_MENU>, +- <0xaa KEY_REPLY>, +- <0xb9 KEY_UP>, +- <0xe9 KEY_DOWN>, +- <0xb8 KEY_LEFT>, +- <0xea KEY_RIGHT>, +- <0xeb KEY_VOLUMEDOWN>, +- <0xef KEY_VOLUMEUP>, +- <0xf7 KEY_MUTE>, +- <0xe7 KEY_POWER>, +- <0xfc KEY_POWER>, +- <0xa9 KEY_VOLUMEDOWN>, +- <0xa8 KEY_VOLUMEDOWN>, +- <0xe0 KEY_VOLUMEDOWN>, +- <0xa5 KEY_VOLUMEDOWN>, +- <0xab 183>, +- <0xb7 388>, +- <0xe8 388>, +- <0xf8 184>, +- <0xaf 185>, +- <0xed KEY_VOLUMEDOWN>, +- <0xee 186>, +- <0xb3 KEY_VOLUMEDOWN>, +- <0xf1 KEY_VOLUMEDOWN>, +- <0xf2 KEY_VOLUMEDOWN>, +- <0xf3 KEY_SEARCH>, +- <0xb4 KEY_VOLUMEDOWN>, +- <0xbe KEY_SEARCH>; +- }; +- +- ir_key3 { +- rockchip,usercode = <0x1dcc>; +- rockchip,key_table = +- <0xee KEY_REPLY>, +- <0xf0 KEY_BACK>, +- <0xf8 KEY_UP>, +- <0xbb KEY_DOWN>, +- <0xef KEY_LEFT>, +- <0xed KEY_RIGHT>, +- <0xfc KEY_HOME>, +- <0xf1 KEY_VOLUMEUP>, +- <0xfd KEY_VOLUMEDOWN>, +- <0xb7 KEY_SEARCH>, +- <0xff KEY_POWER>, +- <0xf3 KEY_MUTE>, +- <0xbf KEY_MENU>, +- <0xf9 0x191>, +- <0xf5 0x192>, +- <0xb3 388>, +- <0xbe KEY_1>, +- <0xba KEY_2>, +- <0xb2 KEY_3>, +- <0xbd KEY_4>, +- <0xf9 KEY_5>, +- <0xb1 KEY_6>, +- <0xfc KEY_7>, +- <0xf8 KEY_8>, +- <0xb0 KEY_9>, +- <0xb6 KEY_0>, +- <0xb5 KEY_BACKSPACE>; +- }; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; + }; + + &pinctrl { +@@ -951,6 +891,13 @@ + }; + }; + ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = ++ <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ + pcie { + pcie_pwr_en: pcie-pwr-en { + rockchip,pins = +@@ -982,6 +929,7 @@ + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = ++ <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>, + <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +@@ -1085,35 +1033,6 @@ + status = "okay"; + }; + +-&rockchip_suspend { +- status = "okay"; +- rockchip,sleep-debug-en = <0>; +- rockchip,sleep-mode-config = < +- (0 +- | RKPM_SLP_ARMPD +- | RKPM_SLP_PERILPPD +- | RKPM_SLP_DDR_RET +- | RKPM_SLP_PLLPD +- | RKPM_SLP_CENTER_PD +- | RKPM_SLP_AP_PWROFF +- ) +- >; +- rockchip,wakeup-config = < +- (0 +- | RKPM_GPIO_WKUP_EN +- | RKPM_PWM_WKUP_EN +- ) +- >; +- rockchip,pwm-regulator-config = < +- (0 +- | PWM2_REGULATOR_EN +- ) +- >; +- rockchip,power-ctrl = +- <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>, +- <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; +-}; +- + &vdec_mmu { + status = "okay"; + }; +@@ -1135,3 +1054,13 @@ + &vopb_mmu { + status = "okay"; + }; ++ ++&vopl { ++ status = "disabled"; ++ assigned-clocks = <&cru DCLK_VOP1_DIV>; ++ assigned-clock-parents = <&cru PLL_CPLL>; ++}; ++ ++&vopl_mmu { ++ status = "disabled"; ++}; + +From b48757753fd87cd0dc058e439bbd586dfbd4f6fb Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 17 Dec 2018 07:41:38 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3399-khadas-edge board + +--- + .../arm64/boot/dts/rockchip/rk3399-khadas-edge.dts | 66 ++ + .../boot/dts/rockchip/rk3399-khadas-edge.dtsi | 1005 ++++++++++++++++++++ + 2 files changed, 1071 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts +new file mode 100644 +index 000000000000..1381ba09b72d +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dts +@@ -0,0 +1,66 @@ ++/* ++ * Copyright (c) 2018 Wesion 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 file 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 file 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. ++ */ ++ ++/dts-v1/; ++ ++#include "rk3399-khadas-edge.dtsi" ++ ++/ { ++ model = "Khadas Edge"; ++ compatible = "khadas,edge", "rockchip,rk3399"; ++}; ++ ++&gmac { ++ status = "okay"; ++}; ++ ++&fusb0 { ++ status = "okay"; ++ max-input-voltage = <13000000>; ++ max-input-current = <6000000>; ++}; ++ ++&fusb1 { ++ status = "okay"; ++ max-input-voltage = <13000000>; ++ max-input-current = <6000000>; ++}; +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +new file mode 100644 +index 000000000000..a7c14f6ccd92 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +@@ -0,0 +1,1005 @@ ++/* ++ * Copyright (c) 2018 Wesion 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 file 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 file 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. ++ */ ++ ++/dts-v1/; ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-linux.dtsi" ++#include "rk3399-opp.dtsi" ++ ++/ { ++ compatible = "khadas,edge", "rockchip,rk3399"; ++ ++ /* first 64k(0xff8c0000~0xff8d0000) for ddr and suspend */ ++ iram: sram@ff8d0000 { ++ compatible = "mmio-sram"; ++ reg = <0x0 0xff8d0000 0x0 0x20000>; /* 128k */ ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ autorepeat; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwrbtn>; ++ ++ 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>; ++ }; ++ }; ++ ++ vccadc_ref: vccadc-ref { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ 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>; ++ }; ++ ++ back { ++ label = "Back"; ++ linux,code = ; ++ press-threshold-microvolt = <985000>; ++ }; ++ ++ menu { ++ label = "Menu"; ++ linux,code = ; ++ press-threshold-microvolt = <1314000>; ++ }; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ dw_hdmi_audio: dw-hdmi-audio { ++ status = "disabled"; ++ compatible = "rockchip,dw-hdmi-audio"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "HDMI"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ hdmi-dp-sound { ++ compatible = "rockchip,rk3399-hdmi-dp"; ++ rockchip,cpu = <&i2s2>; ++ rockchip,codec = <&hdmi>, <&cdn_dp>; ++ status = "disabled"; ++ }; ++ ++ 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 = <&gpio2 28 GPIO_ACTIVE_LOW>; /* GPIO2_D4 */ ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */ ++ status = "okay"; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ //wifi-bt-power-toggle; ++ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; /* GPIO2_C3 */ ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ //BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; /* GPIOx_xx */ ++ BT,reset_gpio = <&gpio2 27 GPIO_ACTIVE_HIGH>; /* GPIO2_D3 */ ++ BT,wake_gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>; /* GPIO2_D2 */ ++ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; /* GPIO0_A4 */ ++ status = "okay"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ ++ sys_led { ++ gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; /* GPIO0_A6 */ ++ label = "sys_led"; ++ linux,default-trigger = "heartbeat"; ++ default-state = "on"; ++ }; ++ }; ++ ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; ++ linux,rc-map-name = "rc-khadas"; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ ++ 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 25 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&host_vbus_drv>; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-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>; ++ }; ++ ++ vcc_sd: vcc-sd { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ regulator-boot-on; ++ regulator-always-on; ++ gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_sd_h>; ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ 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-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>; ++ }; ++ ++ fan0: pwm-fan { ++ compatible = "pwm-fan"; ++ status = "okay"; ++ pwms = <&pwm0 0 40000 0>; /* 25kHz */ ++ cooling-min-state = <0>; ++ cooling-max-state = <3>; ++ #cooling-cells = <2>; ++ cooling-levels = <0 150 200 255>; ++ }; ++}; ++ ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0>; ++ phys = <&tcphy0_dp>; ++}; ++ ++&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>; ++}; ++ ++&dfi { ++ status = "okay"; ++}; ++ ++&dmac_bus { ++ iram = <&iram>; ++}; ++ ++&dmc { ++ status = "okay"; ++ center-supply = <&vdd_center>; ++ system-status-freq = < ++ /*system status freq(KHz)*/ ++ SYS_STATUS_NORMAL 800000 ++ SYS_STATUS_REBOOT 400000 ++ SYS_STATUS_SUSPEND 400000 ++ SYS_STATUS_VIDEO_1080P 800000 ++ SYS_STATUS_VIDEO_4K 800000 ++ SYS_STATUS_VIDEO_4K_10B 800000 ++ SYS_STATUS_PERFORMANCE 800000 ++ SYS_STATUS_BOOST 800000 ++ SYS_STATUS_DUALVIEW 800000 ++ SYS_STATUS_ISP 800000 ++ >; ++ auto-min-freq = <400000>; ++ auto-freq-en = <0>; ++}; ++ ++&dmc_opp_table { ++ compatible = "operating-points-v2"; ++ ++ opp-200000000 { ++ opp-hz = /bits/ 64 <200000000>; ++ opp-microvolt = <825000>; ++ status = "disabled"; ++ }; ++ opp-300000000 { ++ opp-hz = /bits/ 64 <300000000>; ++ opp-microvolt = <850000>; ++ status = "disabled"; ++ }; ++ opp-400000000 { ++ opp-hz = /bits/ 64 <400000000>; ++ opp-microvolt = <900000>; ++ }; ++ opp-528000000 { ++ opp-hz = /bits/ 64 <528000000>; ++ opp-microvolt = <900000>; ++ status = "disabled"; ++ }; ++ opp-600000000 { ++ opp-hz = /bits/ 64 <600000000>; ++ opp-microvolt = <900000>; ++ status = "disabled"; ++ }; ++ opp-800000000 { ++ opp-hz = /bits/ 64 <800000000>; ++ opp-microvolt = <900000>; ++ }; ++ opp-928000000 { ++ opp-hz = /bits/ 64 <928000000>; ++ opp-microvolt = <900000>; ++ status = "disabled"; ++ }; ++ opp-1056000000 { ++ opp-hz = /bits/ 64 <1056000000>; ++ opp-microvolt = <900000>; ++ status = "disabled"; ++ }; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++ ++ route { ++ route_hdmi: route-hdmi { ++ status = "okay"; ++ connect = <&vopb_out_hdmi>; ++ }; ++ ++ route_dp: route-dp { ++ connect = <&vopl_out_dp>; ++ }; ++ }; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; /* GPIO1_B5 */ ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ 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; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ sel-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;/* GPIO0_B5 */ ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ 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; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <22 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l &pmic_dvs2>; ++ 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-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_center"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_cpu_l"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc_ddr"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc_1v8"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_apio2: LDO_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_apio2"; ++ 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-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_pmu"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vccio_sd: LDO_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vccio_sd"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc_vldo5: LDO_REG5 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc_vldo5"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-name = "vcc_1v5"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcca1v8_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc_3v0"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s3"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s0"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++ ++ fusb1: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ //fusb302,role="ROLE_MODE_UFP"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb1_int>; ++ int-n-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ support-uboot-charge = <1>; ++ port-num = <1>; ++ status = "okay"; ++ }; ++}; ++ ++&i2c8 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <475>; ++ i2c-scl-falling-time-ns = <26>; ++ ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ int-n-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ vbus-5v-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 20000 100000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "disabled"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_gpu>; ++}; ++ ++&hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc1v8_apio2>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vccio_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <150000000>; ++ max-frequency = <150000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ vmmc-supply = <&vcc_sd>; ++ vqmmc-supply = <&vccio_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++ clock-frequency = <200000000>; ++ max-frequency = <200000000>; ++ 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"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ supports-emmc; ++ non-removable; ++ keep-power-in-suspend; ++ status = "okay"; ++}; ++ ++&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_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ 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 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; ++}; ++ ++&saradc { ++ vref-supply = <&vccadc_ref>; ++}; ++ ++&route_edp { ++ status = "disabled"; ++}; ++ ++&pinctrl { ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = ++ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 22 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ pmic_dvs2: pmic-dvs2 { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = ++ <1 13 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = ++ <0 13 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = ++ <4 25 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ vcc_sd { ++ vcc_sd_h: vcc-sd-h { ++ rockchip,pins = ++ <0 1 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ fusb1_int: fusb1-int { ++ rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_up>; /* GPIO4_D6 */ ++ }; ++ }; ++ ++ buttons { ++ pwrbtn: pwrbtn { ++ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ lcd-panel { ++ lcd_panel_reset: lcd-panel-reset { ++ rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <2 28 RK_FUNC_GPIO &pcfg_pull_none>; /* GPIO2_D4 */ ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = ++ <2 27 RK_FUNC_GPIO &pcfg_pull_none>; /* GPIO2_D3 */ ++ }; ++ }; ++}; ++ ++&pvtm { ++ status = "okay"; ++}; ++ ++&pmu_pvtm { ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_1v8>; ++}; ++ ++&rkvdec { ++ status = "okay"; ++}; ++ ++&vdec_mmu { ++ status = "okay"; ++}; ++ ++&vpu { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vopb { ++ status = "okay"; ++ assigned-clocks = <&cru DCLK_VOP0_DIV>; ++ assigned-clock-parents = <&cru PLL_VPLL>; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "disabled"; ++ assigned-clocks = <&cru DCLK_VOP1_DIV>; ++ assigned-clock-parents = <&cru PLL_CPLL>; ++}; ++ ++&vopl_mmu { ++ status = "disabled"; ++}; + +From 2de45e1b4eb4b763bf396e768e5add15433ba0f0 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 19 Jan 2019 19:31:40 +0100 +Subject: [PATCH] arm64: dts: rockchip: add rk3399-rock-pi-4 board + +--- + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts | 926 ++++++++++++++++++++++ + 1 file changed, 926 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts +new file mode 100644 +index 000000000000..7b376aee97c4 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts +@@ -0,0 +1,926 @@ ++/* ++ * Copyright (c) 2016 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 file 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 file 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. ++ */ ++ ++/dts-v1/; ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-linux.dtsi" ++#include "rk3399-opp.dtsi" ++ ++/ { ++ model = "Radxa ROCK Pi 4"; ++ compatible = "radxa,rockpi4", "rockchip,rk3399"; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc1v8_s0: vcc1v8-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s0"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ }; ++ ++ vcc_sys: vcc-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_drv>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-name = "vcc3v3_pcie"; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&host_vbus_drv>; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-on; ++ }; ++ ++ vcc5v0_otg: vcc5v0-otg-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&otg_vbus_drv>; ++ regulator-name = "vcc5v0_otg"; ++ regulator-always-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; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id= <2>; ++ rockchip,pwm_voltage = <900000>; ++ ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ user-led1 { ++ gpios=<&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "mmc0"; ++ }; ++ ++ user-led2 { ++ gpios=<&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ }; ++ }; ++ ++ hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "HDMI"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ es8316-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "ES8316"; ++ 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 = <&i2s0>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&es8316>; ++ }; ++ }; ++ ++ 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 RK_PB2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6256"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ uart_rts_gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ BT,reset_gpio = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; ++ BT,wake_gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; ++ BT,wake_host_irq = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ 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>; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++ ++ route { ++ route_hdmi: route-hdmi { ++ status = "okay"; ++ connect = <&vopb_out_hdmi>; ++ }; ++ }; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ regulator-initial-mode = <1>; /* 1:force PWM 2:auto */ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 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 = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc6-supply = <&vcc_sys>; ++ vcc7-supply = <&vcc_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc_sys>; ++ vcc10-supply = <&vcc_sys>; ++ vcc11-supply = <&vcc_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ ++ 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-off-in-suspend; ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_codec"; ++ 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>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcca_1v8: LDO_REG3 { ++ regulator-name = "vcca_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>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v0_sd: LDO_REG5 { ++ regulator-name = "vcc3v0_sd"; ++ 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>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; ++ ++ 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-on-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <300>; ++ i2c-scl-falling-time-ns = <15>; ++ ++ es8316: es8316@11 { ++ #sound-dai-cells = <0>; ++ compatible = "everest,es8316"; ++ reg = <0x11>; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ clock-names = "mclk"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_mclk>; ++ }; ++}; ++ ++&i2s0 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&rgmii_pins>; ++ pinctrl-1 = <&rgmii_sleep_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_gpu>; ++}; ++ ++&hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&iep { ++ status = "okay"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc_3v0>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcc_3v0>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <100000000>; ++ max-frequency = <100000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++ clock-frequency = <100000000>; ++ max-frequency = <100000000>; ++ 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"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ supports-emmc; ++ non-removable; ++ status = "okay"; ++}; ++ ++&threshold { ++ temperature = <85000>; ++}; ++ ++&target { ++ temperature = <100000>; ++}; ++ ++&soc_crit { ++ temperature = <105000>; ++}; ++ ++&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>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ enable-active-high; ++ /* otg-vbus-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;*/ ++ gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&uart4 { ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ extcon = <&u2phy0>; ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ gmac { ++ rgmii_sleep_pins: rgmii-sleep-pins { ++ rockchip,pins = ++ <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; ++ }; ++ }; ++ ++ i2c4 { ++ i2c4_xfer: i2c4-xfer { ++ rockchip,pins = ++ <1 12 RK_FUNC_1 &pcfg_pull_up>, ++ <1 11 RK_FUNC_1 &pcfg_pull_up>; ++ }; ++ }; ++ ++ i2s0 { ++ i2s0_8ch_bus: i2s0-8ch-bus { ++ rockchip,pins = ++ <3 28 0 &pcfg_pull_none>, ++ <3 29 0 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie { ++ pcie_drv: pcie-drv { ++ rockchip,pins = ++ <2 RK_PD2 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_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>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdio0 { ++ sdio0_bus1: sdio0-bus1 { ++ rockchip,pins = ++ <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_bus4: sdio0-bus4 { ++ rockchip,pins = ++ <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 RK_PC5 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 RK_PC6 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 RK_PC7 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_cmd: sdio0-cmd { ++ rockchip,pins = ++ <2 RK_PD0 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_clk: sdio0-clk { ++ rockchip,pins = ++ <2 RK_PD1 RK_FUNC_1 &pcfg_pull_none_20ma>; ++ }; ++ }; ++ ++ sdmmc { ++ sdmmc_bus1: sdmmc-bus1 { ++ rockchip,pins = ++ <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_bus4: sdmmc-bus4 { ++ rockchip,pins = ++ <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 RK_PB1 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 RK_PB2 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 RK_PB3 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_clk: sdmmc-clk { ++ rockchip,pins = ++ <4 RK_PB4 RK_FUNC_1 &pcfg_pull_none_18ma>; ++ }; ++ ++ sdmmc_cmd: sdmmc-cmd { ++ rockchip,pins = ++ <4 RK_PB5 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = ++ <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = ++ <1 3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = ++ <2 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&pvtm { ++ status = "okay"; ++}; ++ ++&pmu_pvtm { ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqnb_cpm>; ++ status = "okay"; ++}; ++ ++&rkvdec { ++ status = "okay"; ++}; ++ ++&vdec_mmu { ++ status = "okay"; ++}; ++ ++&vpu { ++ status = "okay"; ++}; ++ ++&vpu_mmu { ++ status = "okay"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "disabled"; ++}; ++ ++&vopl_mmu { ++ status = "disabled"; ++}; diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0006-rtl8211f.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0006-rtl8211f.patch new file mode 100644 index 0000000000..6a5e7a4e7f --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0006-rtl8211f.patch @@ -0,0 +1,870 @@ +From eec386c5e9f5067dc7fdd3c86adae7de835e090a Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 25 Nov 2016 14:12:01 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: fix enabling of the TX-delay for + RTL8211F + +The old logic always enabled the TX-delay when the phy-mode was set to +PHY_INTERFACE_MODE_RGMII. There are dedicated phy-modes which tell the +PHY driver to enable the RX and/or TX delays: +- PHY_INTERFACE_MODE_RGMII should disable the RX and TX delay in the + PHY (if required, the MAC should add the delays in this case) +- PHY_INTERFACE_MODE_RGMII_ID should enable RX and TX delay in the PHY +- PHY_INTERFACE_MODE_RGMII_TXID should enable the TX delay in the PHY +- PHY_INTERFACE_MODE_RGMII_RXID should enable the RX delay in the PHY + (currently not supported by RTL8211F) + +With this patch we enable the TX delay for PHY_INTERFACE_MODE_RGMII_ID +and PHY_INTERFACE_MODE_RGMII_TXID. +Additionally we now explicity disable the TX-delay, which seems to be +enabled automatically after a hard-reset of the PHY (by triggering it's +reset pin) to get a consistent state (as defined by the phy-mode). + +This fixes a compatibility problem with some SoCs where the TX-delay was +also added by the MAC. With the TX-delay being applied twice the TX +clock was off and TX traffic was broken or very slow (<10Mbit/s) on +1000Mbit/s links. + +Signed-off-by: Martin Blumenstingl +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +(cherry picked from commit e3230494b57ece68750e3e32d3e53d6b00917058) +--- + drivers/net/phy/realtek.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 43ab691362d4..686f3b259dc0 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -102,15 +102,19 @@ static int rtl8211f_config_init(struct phy_device *phydev) + if (ret < 0) + return ret; + +- if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { +- /* enable TXDLY */ +- phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); +- reg = phy_read(phydev, 0x11); ++ phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); ++ reg = phy_read(phydev, 0x11); ++ ++ /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ ++ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || ++ phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) + reg |= RTL8211F_TX_DELAY; +- phy_write(phydev, 0x11, reg); +- /* restore to default page 0 */ +- phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); +- } ++ else ++ reg &= ~RTL8211F_TX_DELAY; ++ ++ phy_write(phydev, 0x11, reg); ++ /* restore to default page 0 */ ++ phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); + + return 0; + } + +From e0a1654d1e79bea21f6397b6caa038c2dee25f97 Mon Sep 17 00:00:00 2001 +From: Kunihiko Hayashi +Date: Tue, 12 Sep 2017 18:54:35 +0900 +Subject: [PATCH] UPSTREAM: net: phy: realtek: rename RTL8211F_PAGE_SELECT to + RTL821x_PAGE_SELECT + +This renames the definition of page select register from +RTL8211F_PAGE_SELECT to RTL821x_PAGE_SELECT to use it across models. + +Signed-off-by: Kunihiko Hayashi +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from commit 013955a6556766a76f9f2cc31e740fc6db6ecff4) +--- + drivers/net/phy/realtek.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 686f3b259dc0..d58cc8f518ac 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -22,11 +22,11 @@ + #define RTL821x_INER 0x12 + #define RTL821x_INER_INIT 0x6400 + #define RTL821x_INSR 0x13 ++#define RTL821x_PAGE_SELECT 0x1f + #define RTL8211E_INER_LINK_STATUS 0x400 + + #define RTL8211F_INER_LINK_STATUS 0x0010 + #define RTL8211F_INSR 0x1d +-#define RTL8211F_PAGE_SELECT 0x1f + #define RTL8211F_TX_DELAY 0x100 + + MODULE_DESCRIPTION("Realtek PHY driver"); +@@ -46,10 +46,10 @@ static int rtl8211f_ack_interrupt(struct phy_device *phydev) + { + int err; + +- phy_write(phydev, RTL8211F_PAGE_SELECT, 0xa43); ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0xa43); + err = phy_read(phydev, RTL8211F_INSR); + /* restore to default page 0 */ +- phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); + + return (err < 0) ? err : 0; + } +@@ -102,7 +102,7 @@ static int rtl8211f_config_init(struct phy_device *phydev) + if (ret < 0) + return ret; + +- phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0xd08); + reg = phy_read(phydev, 0x11); + + /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ +@@ -114,7 +114,7 @@ static int rtl8211f_config_init(struct phy_device *phydev) + + phy_write(phydev, 0x11, reg); + /* restore to default page 0 */ +- phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); + + return 0; + } + +From 4ec70bc0ea714cc0129a4631dbda493ba706f40f Mon Sep 17 00:00:00 2001 +From: Jassi Brar +Date: Tue, 12 Sep 2017 18:54:36 +0900 +Subject: [PATCH] UPSTREAM: net: phy: realtek: add RTL8201F phy-id and + functions + +Add RTL8201F phy-id and the related functions to the driver. + +The original patch is as follows: +https://patchwork.kernel.org/patch/2538341/ + +Signed-off-by: Jongsung Kim +Signed-off-by: Jassi Brar +Signed-off-by: Kunihiko Hayashi +Reviewed-by: Andrew Lunn +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +(cherry picked from commit 513588dd44b09bb5fdd5066a4fbc1e7443b86d1c) +--- + drivers/net/phy/realtek.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index d58cc8f518ac..422cf1f6a60c 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -29,10 +29,22 @@ + #define RTL8211F_INSR 0x1d + #define RTL8211F_TX_DELAY 0x100 + ++#define RTL8201F_ISR 0x1e ++#define RTL8201F_IER 0x13 ++ + MODULE_DESCRIPTION("Realtek PHY driver"); + MODULE_AUTHOR("Johnson Leung"); + MODULE_LICENSE("GPL"); + ++static int rtl8201_ack_interrupt(struct phy_device *phydev) ++{ ++ int err; ++ ++ err = phy_read(phydev, RTL8201F_ISR); ++ ++ return (err < 0) ? err : 0; ++} ++ + static int rtl821x_ack_interrupt(struct phy_device *phydev) + { + int err; +@@ -54,6 +66,25 @@ static int rtl8211f_ack_interrupt(struct phy_device *phydev) + return (err < 0) ? err : 0; + } + ++static int rtl8201_config_intr(struct phy_device *phydev) ++{ ++ int err; ++ ++ /* switch to page 7 */ ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0x7); ++ ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) ++ err = phy_write(phydev, RTL8201F_IER, ++ BIT(13) | BIT(12) | BIT(11)); ++ else ++ err = phy_write(phydev, RTL8201F_IER, 0); ++ ++ /* restore to default page 0 */ ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); ++ ++ return err; ++} ++ + static int rtl8211b_config_intr(struct phy_device *phydev) + { + int err; +@@ -129,6 +160,18 @@ static struct phy_driver realtek_drvs[] = { + .config_aneg = &genphy_config_aneg, + .read_status = &genphy_read_status, + .driver = { .owner = THIS_MODULE,}, ++ }, { ++ .phy_id = 0x001cc816, ++ .name = "RTL8201F 10/100Mbps Ethernet", ++ .phy_id_mask = 0x001fffff, ++ .features = PHY_BASIC_FEATURES, ++ .flags = PHY_HAS_INTERRUPT, ++ .config_aneg = &genphy_config_aneg, ++ .read_status = &genphy_read_status, ++ .ack_interrupt = &rtl8201_ack_interrupt, ++ .config_intr = &rtl8201_config_intr, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, + }, { + .phy_id = 0x001cc912, + .name = "RTL8211B Gigabit Ethernet", +@@ -186,6 +229,7 @@ static struct phy_driver realtek_drvs[] = { + module_phy_driver(realtek_drvs); + + static struct mdio_device_id __maybe_unused realtek_tbl[] = { ++ { 0x001cc816, 0x001fffff }, + { 0x001cc912, 0x001fffff }, + { 0x001cc914, 0x001fffff }, + { 0x001cc915, 0x001fffff }, + +From cd0c207d7747ac36c446099ff018682373999764 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sun, 12 Nov 2017 16:16:04 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: fix RTL8211F interrupt mode + +After commit b94d22d94ad22 "ARM64: dts: meson-gx: add external PHY +interrupt on some platforms" ethernet stopped working on my Odroid-C2 +which has a RTL8211F phy. + +It turned out that no interrupts were triggered. Further analysis +showed the register INER can't be altered on page 0. +Because register INSR needs to be accessed via page 0xa43 I assumed +that register INER needs to be accessed via some page too. +Some brute force check resulted in page 0xa42 being the right one. + +With this patch the phy is working properly in interrupt mode. + +Fixes: 3447cf2e9a11 ("net/phy: Add support for Realtek RTL8211F") +Signed-off-by: Heiner Kallweit +Tested-by: Jerome Brunet +Signed-off-by: David S. Miller +(cherry picked from commit 3697d058b08d5b874f0253de173ef72e5d648f9a) +--- + drivers/net/phy/realtek.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 422cf1f6a60c..a30d0c08c63b 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -115,11 +115,13 @@ static int rtl8211f_config_intr(struct phy_device *phydev) + { + int err; + ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0xa42); + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + err = phy_write(phydev, RTL821x_INER, + RTL8211F_INER_LINK_STATUS); + else + err = phy_write(phydev, RTL821x_INER, 0); ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0); + + return err; + } + +From df04368281177832f4dff078f0cc735ce651ded1 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 22:51:24 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: use the BIT and GENMASK macros + +This makes it easier to compare the #defines with the datasheets. +No functional changes. + +Signed-off-by: Martin Blumenstingl +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from commit 8cc5baefbc0266b6d6c8e99cb8568f59be36a575) +--- + drivers/net/phy/realtek.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index a30d0c08c63b..f8dc29a75828 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -13,21 +13,22 @@ + * option) any later version. + * + */ ++#include + #include + #include + + #define RTL821x_PHYSR 0x11 +-#define RTL821x_PHYSR_DUPLEX 0x2000 +-#define RTL821x_PHYSR_SPEED 0xc000 ++#define RTL821x_PHYSR_DUPLEX BIT(13) ++#define RTL821x_PHYSR_SPEED GENMASK(15, 14) + #define RTL821x_INER 0x12 + #define RTL821x_INER_INIT 0x6400 + #define RTL821x_INSR 0x13 + #define RTL821x_PAGE_SELECT 0x1f +-#define RTL8211E_INER_LINK_STATUS 0x400 ++#define RTL8211E_INER_LINK_STATUS BIT(10) + +-#define RTL8211F_INER_LINK_STATUS 0x0010 ++#define RTL8211F_INER_LINK_STATUS BIT(4) + #define RTL8211F_INSR 0x1d +-#define RTL8211F_TX_DELAY 0x100 ++#define RTL8211F_TX_DELAY BIT(8) + + #define RTL8201F_ISR 0x1e + #define RTL8201F_IER 0x13 + +From c6479ba05b0013658491a86171df7e0110a0e85a Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 22:51:25 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: rename RTL821x_INER_INIT to + RTL8211B_INER_INIT + +This macro is only used by the RTL8211B code. RTL8211E and RTL8211F both +use other bits to initialize the RTL821x_INER register. +No functional changes. + +Signed-off-by: Martin Blumenstingl +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from commit 69021e32ec3ef02170482f6ed8130febaed27357) +--- + drivers/net/phy/realtek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index f8dc29a75828..89308eac4088 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -21,7 +21,7 @@ + #define RTL821x_PHYSR_DUPLEX BIT(13) + #define RTL821x_PHYSR_SPEED GENMASK(15, 14) + #define RTL821x_INER 0x12 +-#define RTL821x_INER_INIT 0x6400 ++#define RTL8211B_INER_INIT 0x6400 + #define RTL821x_INSR 0x13 + #define RTL821x_PAGE_SELECT 0x1f + #define RTL8211E_INER_LINK_STATUS BIT(10) +@@ -92,7 +92,7 @@ static int rtl8211b_config_intr(struct phy_device *phydev) + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + err = phy_write(phydev, RTL821x_INER, +- RTL821x_INER_INIT); ++ RTL8211B_INER_INIT); + else + err = phy_write(phydev, RTL821x_INER, 0); + + +From c49b1806174ac4140a3fe90c626ef694992f7db6 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 22:51:26 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: group all register bit #defines + for RTL821x_INER + +This simply moves all register bit #defines which describe the (PHY +specific) bits in the RTL821x_INER right below the RTL821x_INER register +definition. This makes it easier to spot which registers and bits belong +together. +No functional changes. + +Signed-off-by: Martin Blumenstingl +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from commit a82f266d240d87e6111878bbfe287024fb6857c1) +--- + drivers/net/phy/realtek.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 89308eac4088..df97d903d2bf 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -20,13 +20,16 @@ + #define RTL821x_PHYSR 0x11 + #define RTL821x_PHYSR_DUPLEX BIT(13) + #define RTL821x_PHYSR_SPEED GENMASK(15, 14) ++ + #define RTL821x_INER 0x12 + #define RTL8211B_INER_INIT 0x6400 ++#define RTL8211E_INER_LINK_STATUS BIT(10) ++#define RTL8211F_INER_LINK_STATUS BIT(4) ++ + #define RTL821x_INSR 0x13 ++ + #define RTL821x_PAGE_SELECT 0x1f +-#define RTL8211E_INER_LINK_STATUS BIT(10) + +-#define RTL8211F_INER_LINK_STATUS BIT(4) + #define RTL8211F_INSR 0x1d + #define RTL8211F_TX_DELAY BIT(8) + + +From 3cd6e2f5de15c4c071d9ca9f02efcbd23b8435ad Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 22:51:27 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: use the same indentation for all + #defines + +This simply makes the code easier to read. No functional changes. + +Signed-off-by: Martin Blumenstingl +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from commit f609ab0ed8e7bef2cd61d230bf9e83e1ec5b9ddb) +--- + drivers/net/phy/realtek.c | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index df97d903d2bf..701f34ad7d8d 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -17,24 +17,25 @@ + #include + #include + +-#define RTL821x_PHYSR 0x11 +-#define RTL821x_PHYSR_DUPLEX BIT(13) +-#define RTL821x_PHYSR_SPEED GENMASK(15, 14) ++#define RTL821x_PHYSR 0x11 ++#define RTL821x_PHYSR_DUPLEX BIT(13) ++#define RTL821x_PHYSR_SPEED GENMASK(15, 14) + +-#define RTL821x_INER 0x12 +-#define RTL8211B_INER_INIT 0x6400 +-#define RTL8211E_INER_LINK_STATUS BIT(10) +-#define RTL8211F_INER_LINK_STATUS BIT(4) ++#define RTL821x_INER 0x12 ++#define RTL8211B_INER_INIT 0x6400 ++#define RTL8211E_INER_LINK_STATUS BIT(10) ++#define RTL8211F_INER_LINK_STATUS BIT(4) + +-#define RTL821x_INSR 0x13 ++#define RTL821x_INSR 0x13 + +-#define RTL821x_PAGE_SELECT 0x1f ++#define RTL821x_PAGE_SELECT 0x1f + +-#define RTL8211F_INSR 0x1d +-#define RTL8211F_TX_DELAY BIT(8) ++#define RTL8211F_INSR 0x1d + +-#define RTL8201F_ISR 0x1e +-#define RTL8201F_IER 0x13 ++#define RTL8211F_TX_DELAY BIT(8) ++ ++#define RTL8201F_ISR 0x1e ++#define RTL8201F_IER 0x13 + + MODULE_DESCRIPTION("Realtek PHY driver"); + MODULE_AUTHOR("Johnson Leung"); + +From 47e40b66fdafc0ce940090626759fe8418034a0e Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 22:51:28 +0100 +Subject: [PATCH] UPSTREAM: net: phy: realtek: add utility functions to + read/write page addresses + +Realtek PHYs implement the concept of so-called "extension pages". The +reason for this is probably because these PHYs expose more registers +than available in the standard address range. +After all read/write operations on such a page are done the driver +should switch back to page 0 where the standard MII registers (such as +MII_BMCR) are available. + +When referring to such a register the datasheets of RTL8211E and +RTL8211F always specify: +- the page / "ext. page" which has to be written to RTL821x_PAGE_SELECT +- an address (sometimes also called reg) + +These new utility functions make the existing code easier to read since +it removes some duplication (switching back to page 0 is done within the +new helpers for example). + +No functional changes are intended. + +Signed-off-by: Martin Blumenstingl +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from commit 136819a6e8df374e6b9b424586ff11c9e241a1cb) +--- + drivers/net/phy/realtek.c | 83 ++++++++++++++++++++++++++++++----------------- + 1 file changed, 53 insertions(+), 30 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 701f34ad7d8d..b1d52e61d91c 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -41,6 +41,39 @@ MODULE_DESCRIPTION("Realtek PHY driver"); + MODULE_AUTHOR("Johnson Leung"); + MODULE_LICENSE("GPL"); + ++static int rtl8211x_page_read(struct phy_device *phydev, u16 page, u16 address) ++{ ++ int ret; ++ ++ ret = phy_write(phydev, RTL821x_PAGE_SELECT, page); ++ if (ret) ++ return ret; ++ ++ ret = phy_read(phydev, address); ++ ++ /* restore to default page 0 */ ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); ++ ++ return ret; ++} ++ ++static int rtl8211x_page_write(struct phy_device *phydev, u16 page, ++ u16 address, u16 val) ++{ ++ int ret; ++ ++ ret = phy_write(phydev, RTL821x_PAGE_SELECT, page); ++ if (ret) ++ return ret; ++ ++ ret = phy_write(phydev, address, val); ++ ++ /* restore to default page 0 */ ++ phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); ++ ++ return ret; ++} ++ + static int rtl8201_ack_interrupt(struct phy_device *phydev) + { + int err; +@@ -63,31 +96,21 @@ static int rtl8211f_ack_interrupt(struct phy_device *phydev) + { + int err; + +- phy_write(phydev, RTL821x_PAGE_SELECT, 0xa43); +- err = phy_read(phydev, RTL8211F_INSR); +- /* restore to default page 0 */ +- phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); ++ err = rtl8211x_page_read(phydev, 0xa43, RTL8211F_INSR); + + return (err < 0) ? err : 0; + } + + static int rtl8201_config_intr(struct phy_device *phydev) + { +- int err; +- +- /* switch to page 7 */ +- phy_write(phydev, RTL821x_PAGE_SELECT, 0x7); ++ u16 val; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) +- err = phy_write(phydev, RTL8201F_IER, +- BIT(13) | BIT(12) | BIT(11)); ++ val = BIT(13) | BIT(12) | BIT(11); + else +- err = phy_write(phydev, RTL8201F_IER, 0); ++ val = 0; + +- /* restore to default page 0 */ +- phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); +- +- return err; ++ return rtl8211x_page_write(phydev, 0x7, RTL8201F_IER, val); + } + + static int rtl8211b_config_intr(struct phy_device *phydev) +@@ -118,41 +141,41 @@ static int rtl8211e_config_intr(struct phy_device *phydev) + + static int rtl8211f_config_intr(struct phy_device *phydev) + { +- int err; ++ u16 val; + +- phy_write(phydev, RTL821x_PAGE_SELECT, 0xa42); + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) +- err = phy_write(phydev, RTL821x_INER, +- RTL8211F_INER_LINK_STATUS); ++ val = RTL8211F_INER_LINK_STATUS; + else +- err = phy_write(phydev, RTL821x_INER, 0); +- phy_write(phydev, RTL821x_PAGE_SELECT, 0); ++ val = 0; + +- return err; ++ return rtl8211x_page_write(phydev, 0xa42, RTL821x_INER, val); + } + + static int rtl8211f_config_init(struct phy_device *phydev) + { + int ret; +- u16 reg; ++ u16 val; + + ret = genphy_config_init(phydev); + if (ret < 0) + return ret; + +- phy_write(phydev, RTL821x_PAGE_SELECT, 0xd08); +- reg = phy_read(phydev, 0x11); ++ ret = rtl8211x_page_read(phydev, 0xd08, 0x11); ++ if (ret < 0) ++ return ret; ++ ++ val = ret & 0xffff; + + /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || + phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) +- reg |= RTL8211F_TX_DELAY; ++ val |= RTL8211F_TX_DELAY; + else +- reg &= ~RTL8211F_TX_DELAY; ++ val &= ~RTL8211F_TX_DELAY; + +- phy_write(phydev, 0x11, reg); +- /* restore to default page 0 */ +- phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); ++ ret = rtl8211x_page_write(phydev, 0xd08, 0x11, val); ++ if (ret) ++ return ret; + + return 0; + } + +From b747e5d48f83fd4d3b824578f666ac136bc6de49 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 23:06:48 +0100 +Subject: [PATCH] FROMLIST: net: phy: realtek: add support for configuring the + RX delay on RTL8211F + +On RTL8211F the RX delay can also be enabled/disabled. +The overall behavior of the RX delay is similar to the behavior of the +TX delay, which was already supported by the driver. + +The RX delay (similar to the TX delay) may be enabled using hardware pin +strapping. If the MAC already configures the RX delay (if required) then +the RX delay generated by the RTL8211F PHY has to be turned off. + +While here, update the comment regarding the TX delay why it has to be +enabled or disabled within the driver. +Also avoid code-duplication by extracting the code to mask/unmask bits +in a paged register into a new rtl8211x_page_mask_bits helper function. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/phy/realtek.c | 55 ++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 45 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index b1d52e61d91c..890ea9d18d27 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -32,7 +32,10 @@ + + #define RTL8211F_INSR 0x1d + +-#define RTL8211F_TX_DELAY BIT(8) ++#define RTL8211F_RX_DELAY_REG 0x15 ++#define RTL8211F_RX_DELAY_EN BIT(3) ++#define RTL8211F_TX_DELAY_REG 0x11 ++#define RTL8211F_TX_DELAY_EN BIT(8) + + #define RTL8201F_ISR 0x1e + #define RTL8201F_IER 0x13 +@@ -74,6 +77,23 @@ static int rtl8211x_page_write(struct phy_device *phydev, u16 page, + return ret; + } + ++static int rtl8211x_page_mask_bits(struct phy_device *phydev, u16 page, ++ u16 address, u16 mask, u16 set) ++{ ++ int ret; ++ u16 val; ++ ++ ret = rtl8211x_page_read(phydev, page, address); ++ if (ret < 0) ++ return ret; ++ ++ val = ret & 0xffff; ++ val &= ~mask; ++ val |= (set & mask); ++ ++ return rtl8211x_page_write(phydev, page, address, val); ++} ++ + static int rtl8201_ack_interrupt(struct phy_device *phydev) + { + int err; +@@ -160,20 +180,35 @@ static int rtl8211f_config_init(struct phy_device *phydev) + if (ret < 0) + return ret; + +- ret = rtl8211x_page_read(phydev, 0xd08, 0x11); +- if (ret < 0) +- return ret; ++ /* ++ * enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it. ++ * this is needed because it can be enabled by pin strapping and ++ * conflict with the TX-delay configured by the MAC. ++ */ ++ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || ++ phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) ++ val = RTL8211F_TX_DELAY_EN; ++ else ++ val = 0; + +- val = ret & 0xffff; ++ ret = rtl8211x_page_mask_bits(phydev, 0xd08, RTL8211F_TX_DELAY_REG, ++ RTL8211F_TX_DELAY_EN, val); ++ if (ret) ++ return ret; + +- /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ ++ /* ++ * enable RX-delay for rgmii-id and rgmii-rxid, otherwise disable it. ++ * this is needed because it can be enabled by pin strapping and ++ * conflict with the RX-delay configured by the MAC. ++ */ + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || +- phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) +- val |= RTL8211F_TX_DELAY; ++ phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ++ val = RTL8211F_RX_DELAY_EN; + else +- val &= ~RTL8211F_TX_DELAY; ++ val = 0; + +- ret = rtl8211x_page_write(phydev, 0xd08, 0x11, val); ++ ret = rtl8211x_page_mask_bits(phydev, 0xd08, RTL8211F_RX_DELAY_REG, ++ RTL8211F_RX_DELAY_EN, val); + if (ret) + return ret; + + +From 4264d7cd3670514648b2ef632097c80e210e5690 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 23:06:49 +0100 +Subject: [PATCH] FROMLIST: net: phy: realtek: configure the INTB pin on + RTL8211F + +The interrupt pin on the RTL8211F PHY can be used in two different +modes: +INTB +- the default mode of the PHY +- interrupts can be configured through page 0xa42 register RTL821x_INER +- interrupts can be ACK'ed through RTL8211F_INSR +- it acts as a level-interrupt which is active low +- Wake-on-LAN "wakeup" status is available in RTL8211F_INSR bit 7 + +PMEB: +- special mode for Wake-on-LAN +- interrupts configured through page 0xa42 register RTL821x_INER are + disabled +- it supports a "pulse low" waveform for the interrupt + +For now we simply force the pin into INTB mode since the PHY driver does +not support Wake-on-LAN yet. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/phy/realtek.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 890ea9d18d27..f307d220b49a 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -40,6 +40,9 @@ + #define RTL8201F_ISR 0x1e + #define RTL8201F_IER 0x13 + ++#define RTL8211F_INTBCR 0x16 ++#define RTL8211F_INTBCR_INTB_PMEB BIT(5) ++ + MODULE_DESCRIPTION("Realtek PHY driver"); + MODULE_AUTHOR("Johnson Leung"); + MODULE_LICENSE("GPL"); +@@ -161,12 +164,32 @@ static int rtl8211e_config_intr(struct phy_device *phydev) + + static int rtl8211f_config_intr(struct phy_device *phydev) + { ++ int err; + u16 val; + +- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) ++ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { ++ /* ++ * The interrupt pin has two functions: ++ * 0: INTB: it acts as interrupt pin which can be configured ++ * through RTL821x_INER and the status can be read through ++ * RTL8211F_INSR ++ * 1: PMEB: a special "Power Management Event" mode for ++ * Wake-on-LAN operation (with support for a "pulse low" ++ * wave format). Interrupts configured through RTL821x_INER ++ * will not work in this mode ++ * ++ * select INTB mode in the "INTB pin control" register to ++ * ensure that the interrupt pin is in the correct mode. ++ */ ++ err = rtl8211x_page_mask_bits(phydev, 0xd40, RTL8211F_INTBCR, ++ RTL8211F_INTBCR_INTB_PMEB, 0); ++ if (err) ++ return err; ++ + val = RTL8211F_INER_LINK_STATUS; +- else ++ } else { + val = 0; ++ } + + return rtl8211x_page_write(phydev, 0xa42, RTL821x_INER, val); + } + +From 5f21ae02ffa16fafd12f635e7a5965842d7d492a Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 2 Dec 2017 23:06:50 +0100 +Subject: [PATCH] FROMLIST: net: phy: realtek: add more interrupt bits for + RTL8211E and RTL8211F + +This documents a few more bits in the RTL821x_INER register for RTL8211E +and RTL8211F. These are added only to document them (as no public +datasheets are available for these PHYs), they are currently not used. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/phy/realtek.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index f307d220b49a..15d342eefd6d 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -24,7 +24,14 @@ + #define RTL821x_INER 0x12 + #define RTL8211B_INER_INIT 0x6400 + #define RTL8211E_INER_LINK_STATUS BIT(10) ++#define RTL8211E_INER_ANEG_COMPLETED BIT(11) ++#define RTL8211E_INER_PAGE_RECEIVED BIT(12) ++#define RTL8211E_INER_ANEG_ERROR BIT(15) + #define RTL8211F_INER_LINK_STATUS BIT(4) ++#define RTL8211F_INER_PHY_REGISTER_ACCESSIBLE BIT(5) ++#define RTL8211F_INER_WOL_PME BIT(7) ++#define RTL8211F_INER_ALDPS_STATE_CHANGE BIT(9) ++#define RTL8211F_INER_JABBER BIT(10) + + #define RTL821x_INSR 0x13 + diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0007-dtoverlay-configfs.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0007-dtoverlay-configfs.patch new file mode 100644 index 0000000000..eb0b391224 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0007-dtoverlay-configfs.patch @@ -0,0 +1,1120 @@ +From 062e69c83449e4f5f363bb3caf4ba411907636d5 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou +Date: Thu, 22 Oct 2015 23:30:04 +0300 +Subject: [PATCH] UPSTREAM: configfs: implement binary attributes + +ConfigFS lacked binary attributes up until now. This patch +introduces support for binary attributes in a somewhat similar +manner of sysfs binary attributes albeit with changes that +fit the configfs usage model. + +Problems that configfs binary attributes fix are everything that +requires a binary blob as part of the configuration of a resource, +such as bitstream loading for FPGAs, DTBs for dynamically created +devices etc. + +Look at Documentation/filesystems/configfs/configfs.txt for internals +and howto use them. + +This patch is against linux-next as of today that contains +Christoph's configfs rework. + +Signed-off-by: Pantelis Antoniou +[hch: folded a fix from Geert Uytterhoeven ] +[hch: a few tiny updates based on review feedback] +Signed-off-by: Christoph Hellwig +(cherry picked from commit 03607ace807b414eab46323c794b6fb8fcc2d48c) +--- + Documentation/filesystems/configfs/configfs.txt | 57 +++++- + fs/configfs/configfs_internal.h | 14 +- + fs/configfs/dir.c | 18 +- + fs/configfs/file.c | 255 +++++++++++++++++++++++- + fs/configfs/inode.c | 2 +- + include/linux/configfs.h | 50 +++++ + 6 files changed, 374 insertions(+), 22 deletions(-) + +diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt +index af68efdbbfad..e5fe521eea1d 100644 +--- a/Documentation/filesystems/configfs/configfs.txt ++++ b/Documentation/filesystems/configfs/configfs.txt +@@ -51,15 +51,27 @@ configfs tree is always there, whether mounted on /config or not. + An item is created via mkdir(2). The item's attributes will also + appear at this time. readdir(3) can determine what the attributes are, + read(2) can query their default values, and write(2) can store new +-values. Like sysfs, attributes should be ASCII text files, preferably +-with only one value per file. The same efficiency caveats from sysfs +-apply. Don't mix more than one attribute in one attribute file. +- +-Like sysfs, configfs expects write(2) to store the entire buffer at +-once. When writing to configfs attributes, userspace processes should +-first read the entire file, modify the portions they wish to change, and +-then write the entire buffer back. Attribute files have a maximum size +-of one page (PAGE_SIZE, 4096 on i386). ++values. Don't mix more than one attribute in one attribute file. ++ ++There are two types of configfs attributes: ++ ++* Normal attributes, which similar to sysfs attributes, are small ASCII text ++files, with a maximum size of one page (PAGE_SIZE, 4096 on i386). Preferably ++only one value per file should be used, and the same caveats from sysfs apply. ++Configfs expects write(2) to store the entire buffer at once. When writing to ++normal configfs attributes, userspace processes should first read the entire ++file, modify the portions they wish to change, and then write the entire ++buffer back. ++ ++* Binary attributes, which are somewhat similar to sysfs binary attributes, ++but with a few slight changes to semantics. The PAGE_SIZE limitation does not ++apply, but the whole binary item must fit in single kernel vmalloc'ed buffer. ++The write(2) calls from user space are buffered, and the attributes' ++write_bin_attribute method will be invoked on the final close, therefore it is ++imperative for user-space to check the return code of close(2) in order to ++verify that the operation finished successfully. ++To avoid a malicious user OOMing the kernel, there's a per-binary attribute ++maximum buffer value. + + When an item needs to be destroyed, remove it with rmdir(2). An + item cannot be destroyed if any other item has a link to it (via +@@ -171,6 +183,7 @@ among other things. For that, it needs a type. + struct configfs_item_operations *ct_item_ops; + struct configfs_group_operations *ct_group_ops; + struct configfs_attribute **ct_attrs; ++ struct configfs_bin_attribute **ct_bin_attrs; + }; + + The most basic function of a config_item_type is to define what +@@ -201,6 +214,32 @@ be called whenever userspace asks for a read(2) on the attribute. If an + attribute is writable and provides a ->store method, that method will be + be called whenever userspace asks for a write(2) on the attribute. + ++[struct configfs_bin_attribute] ++ ++ struct configfs_attribute { ++ struct configfs_attribute cb_attr; ++ void *cb_private; ++ size_t cb_max_size; ++ }; ++ ++The binary attribute is used when the one needs to use binary blob to ++appear as the contents of a file in the item's configfs directory. ++To do so add the binary attribute to the NULL-terminated array ++config_item_type->ct_bin_attrs, and the item appears in configfs, the ++attribute file will appear with the configfs_bin_attribute->cb_attr.ca_name ++filename. configfs_bin_attribute->cb_attr.ca_mode specifies the file ++permissions. ++The cb_private member is provided for use by the driver, while the ++cb_max_size member specifies the maximum amount of vmalloc buffer ++to be used. ++ ++If binary attribute is readable and the config_item provides a ++ct_item_ops->read_bin_attribute() method, that method will be called ++whenever userspace asks for a read(2) on the attribute. The converse ++will happen for write(2). The reads/writes are bufferred so only a ++single read/write will occur; the attributes' need not concern itself ++with it. ++ + [struct config_group] + + A config_item cannot live in a vacuum. The only way one can be created +diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h +index b65d1ef532d5..ccc31fa6f1a7 100644 +--- a/fs/configfs/configfs_internal.h ++++ b/fs/configfs/configfs_internal.h +@@ -53,13 +53,14 @@ struct configfs_dirent { + #define CONFIGFS_ROOT 0x0001 + #define CONFIGFS_DIR 0x0002 + #define CONFIGFS_ITEM_ATTR 0x0004 ++#define CONFIGFS_ITEM_BIN_ATTR 0x0008 + #define CONFIGFS_ITEM_LINK 0x0020 + #define CONFIGFS_USET_DIR 0x0040 + #define CONFIGFS_USET_DEFAULT 0x0080 + #define CONFIGFS_USET_DROPPING 0x0100 + #define CONFIGFS_USET_IN_MKDIR 0x0200 + #define CONFIGFS_USET_CREATING 0x0400 +-#define CONFIGFS_NOT_PINNED (CONFIGFS_ITEM_ATTR) ++#define CONFIGFS_NOT_PINNED (CONFIGFS_ITEM_ATTR | CONFIGFS_ITEM_BIN_ATTR) + + extern struct mutex configfs_symlink_mutex; + extern spinlock_t configfs_dirent_lock; +@@ -72,6 +73,8 @@ extern struct inode * configfs_new_inode(umode_t mode, struct configfs_dirent *, + extern int configfs_create(struct dentry *, umode_t mode, void (*init)(struct inode *)); + + extern int configfs_create_file(struct config_item *, const struct configfs_attribute *); ++extern int configfs_create_bin_file(struct config_item *, ++ const struct configfs_bin_attribute *); + extern int configfs_make_dirent(struct configfs_dirent *, + struct dentry *, void *, umode_t, int); + extern int configfs_dirent_is_ready(struct configfs_dirent *); +@@ -88,7 +91,7 @@ extern void configfs_release_fs(void); + extern struct rw_semaphore configfs_rename_sem; + extern const struct file_operations configfs_dir_operations; + extern const struct file_operations configfs_file_operations; +-extern const struct file_operations bin_fops; ++extern const struct file_operations configfs_bin_file_operations; + extern const struct inode_operations configfs_dir_inode_operations; + extern const struct inode_operations configfs_root_inode_operations; + extern const struct inode_operations configfs_symlink_inode_operations; +@@ -119,6 +122,13 @@ static inline struct configfs_attribute * to_attr(struct dentry * dentry) + return ((struct configfs_attribute *) sd->s_element); + } + ++static inline struct configfs_bin_attribute *to_bin_attr(struct dentry *dentry) ++{ ++ struct configfs_attribute *attr = to_attr(dentry); ++ ++ return container_of(attr, struct configfs_bin_attribute, cb_attr); ++} ++ + static inline struct config_item *configfs_get_config_item(struct dentry *dentry) + { + struct config_item * item = NULL; +diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c +index a7a1b218f308..7ae97e83f121 100644 +--- a/fs/configfs/dir.c ++++ b/fs/configfs/dir.c +@@ -255,6 +255,12 @@ static void configfs_init_file(struct inode * inode) + inode->i_fop = &configfs_file_operations; + } + ++static void configfs_init_bin_file(struct inode *inode) ++{ ++ inode->i_size = 0; ++ inode->i_fop = &configfs_bin_file_operations; ++} ++ + static void init_symlink(struct inode * inode) + { + inode->i_op = &configfs_symlink_inode_operations; +@@ -423,7 +429,9 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den + spin_unlock(&configfs_dirent_lock); + + error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG, +- configfs_init_file); ++ (sd->s_type & CONFIGFS_ITEM_BIN_ATTR) ? ++ configfs_init_bin_file : ++ configfs_init_file); + if (error) { + configfs_put(sd); + return error; +@@ -583,6 +591,7 @@ static int populate_attrs(struct config_item *item) + { + struct config_item_type *t = item->ci_type; + struct configfs_attribute *attr; ++ struct configfs_bin_attribute *bin_attr; + int error = 0; + int i; + +@@ -594,6 +603,13 @@ static int populate_attrs(struct config_item *item) + break; + } + } ++ if (t->ct_bin_attrs) { ++ for (i = 0; (bin_attr = t->ct_bin_attrs[i]) != NULL; i++) { ++ error = configfs_create_bin_file(item, bin_attr); ++ if (error) ++ break; ++ } ++ } + + if (error) + detach_attrs(item); +diff --git a/fs/configfs/file.c b/fs/configfs/file.c +index d39099ea7df7..3687187c8ea5 100644 +--- a/fs/configfs/file.c ++++ b/fs/configfs/file.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -48,6 +49,10 @@ struct configfs_buffer { + struct configfs_item_operations * ops; + struct mutex mutex; + int needs_read_fill; ++ bool read_in_progress; ++ bool write_in_progress; ++ char *bin_buffer; ++ int bin_buffer_size; + }; + + +@@ -123,6 +128,87 @@ out: + return retval; + } + ++/** ++ * configfs_read_bin_file - read a binary attribute. ++ * @file: file pointer. ++ * @buf: buffer to fill. ++ * @count: number of bytes to read. ++ * @ppos: starting offset in file. ++ * ++ * Userspace wants to read a binary attribute file. The attribute ++ * descriptor is in the file's ->d_fsdata. The target item is in the ++ * directory's ->d_fsdata. ++ * ++ * We check whether we need to refill the buffer. If so we will ++ * call the attributes' attr->read() twice. The first time we ++ * will pass a NULL as a buffer pointer, which the attributes' method ++ * will use to return the size of the buffer required. If no error ++ * occurs we will allocate the buffer using vmalloc and call ++ * attr->read() again passing that buffer as an argument. ++ * Then we just copy to user-space using simple_read_from_buffer. ++ */ ++ ++static ssize_t ++configfs_read_bin_file(struct file *file, char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ struct configfs_buffer *buffer = file->private_data; ++ struct dentry *dentry = file->f_path.dentry; ++ struct config_item *item = to_item(dentry->d_parent); ++ struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry); ++ ssize_t retval = 0; ++ ssize_t len = min_t(size_t, count, PAGE_SIZE); ++ ++ mutex_lock(&buffer->mutex); ++ ++ /* we don't support switching read/write modes */ ++ if (buffer->write_in_progress) { ++ retval = -ETXTBSY; ++ goto out; ++ } ++ buffer->read_in_progress = 1; ++ ++ if (buffer->needs_read_fill) { ++ /* perform first read with buf == NULL to get extent */ ++ len = bin_attr->read(item, NULL, 0); ++ if (len <= 0) { ++ retval = len; ++ goto out; ++ } ++ ++ /* do not exceed the maximum value */ ++ if (bin_attr->cb_max_size && len > bin_attr->cb_max_size) { ++ retval = -EFBIG; ++ goto out; ++ } ++ ++ buffer->bin_buffer = vmalloc(len); ++ if (buffer->bin_buffer == NULL) { ++ retval = -ENOMEM; ++ goto out; ++ } ++ buffer->bin_buffer_size = len; ++ ++ /* perform second read to fill buffer */ ++ len = bin_attr->read(item, buffer->bin_buffer, len); ++ if (len < 0) { ++ retval = len; ++ vfree(buffer->bin_buffer); ++ buffer->bin_buffer_size = 0; ++ buffer->bin_buffer = NULL; ++ goto out; ++ } ++ ++ buffer->needs_read_fill = 0; ++ } ++ ++ retval = simple_read_from_buffer(buf, count, ppos, buffer->bin_buffer, ++ buffer->bin_buffer_size); ++out: ++ mutex_unlock(&buffer->mutex); ++ return retval; ++} ++ + + /** + * fill_write_buffer - copy buffer from userspace. +@@ -209,10 +295,80 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof + return len; + } + +-static int check_perm(struct inode * inode, struct file * file) ++/** ++ * configfs_write_bin_file - write a binary attribute. ++ * @file: file pointer ++ * @buf: data to write ++ * @count: number of bytes ++ * @ppos: starting offset ++ * ++ * Writing to a binary attribute file is similar to a normal read. ++ * We buffer the consecutive writes (binary attribute files do not ++ * support lseek) in a continuously growing buffer, but we don't ++ * commit until the close of the file. ++ */ ++ ++static ssize_t ++configfs_write_bin_file(struct file *file, const char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ struct configfs_buffer *buffer = file->private_data; ++ struct dentry *dentry = file->f_path.dentry; ++ struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry); ++ void *tbuf = NULL; ++ ssize_t len; ++ ++ mutex_lock(&buffer->mutex); ++ ++ /* we don't support switching read/write modes */ ++ if (buffer->read_in_progress) { ++ len = -ETXTBSY; ++ goto out; ++ } ++ buffer->write_in_progress = 1; ++ ++ /* buffer grows? */ ++ if (*ppos + count > buffer->bin_buffer_size) { ++ ++ if (bin_attr->cb_max_size && ++ *ppos + count > bin_attr->cb_max_size) { ++ len = -EFBIG; ++ } ++ ++ tbuf = vmalloc(*ppos + count); ++ if (tbuf == NULL) { ++ len = -ENOMEM; ++ goto out; ++ } ++ ++ /* copy old contents */ ++ if (buffer->bin_buffer) { ++ memcpy(tbuf, buffer->bin_buffer, ++ buffer->bin_buffer_size); ++ vfree(buffer->bin_buffer); ++ } ++ ++ /* clear the new area */ ++ memset(tbuf + buffer->bin_buffer_size, 0, ++ *ppos + count - buffer->bin_buffer_size); ++ buffer->bin_buffer = tbuf; ++ buffer->bin_buffer_size = *ppos + count; ++ } ++ ++ len = simple_write_to_buffer(buffer->bin_buffer, ++ buffer->bin_buffer_size, ppos, buf, count); ++ if (len > 0) ++ *ppos += len; ++out: ++ mutex_unlock(&buffer->mutex); ++ return len; ++} ++ ++static int check_perm(struct inode * inode, struct file * file, int type) + { + struct config_item *item = configfs_get_config_item(file->f_path.dentry->d_parent); + struct configfs_attribute * attr = to_attr(file->f_path.dentry); ++ struct configfs_bin_attribute *bin_attr = NULL; + struct configfs_buffer * buffer; + struct configfs_item_operations * ops = NULL; + int error = 0; +@@ -220,6 +376,9 @@ static int check_perm(struct inode * inode, struct file * file) + if (!item || !attr) + goto Einval; + ++ if (type & CONFIGFS_ITEM_BIN_ATTR) ++ bin_attr = to_bin_attr(file->f_path.dentry); ++ + /* Grab the module reference for this attribute if we have one */ + if (!try_module_get(attr->ca_owner)) { + error = -ENODEV; +@@ -236,9 +395,14 @@ static int check_perm(struct inode * inode, struct file * file) + * and we must have a store method. + */ + if (file->f_mode & FMODE_WRITE) { +- if (!(inode->i_mode & S_IWUGO) || !attr->store) ++ if (!(inode->i_mode & S_IWUGO)) ++ goto Eaccess; ++ ++ if ((type & CONFIGFS_ITEM_ATTR) && !attr->store) + goto Eaccess; + ++ if ((type & CONFIGFS_ITEM_BIN_ATTR) && !bin_attr->write) ++ goto Eaccess; + } + + /* File needs read support. +@@ -246,7 +410,13 @@ static int check_perm(struct inode * inode, struct file * file) + * must be a show method for it. + */ + if (file->f_mode & FMODE_READ) { +- if (!(inode->i_mode & S_IRUGO) || !attr->show) ++ if (!(inode->i_mode & S_IRUGO)) ++ goto Eaccess; ++ ++ if ((type & CONFIGFS_ITEM_ATTR) && !attr->show) ++ goto Eaccess; ++ ++ if ((type & CONFIGFS_ITEM_BIN_ATTR) && !bin_attr->read) + goto Eaccess; + } + +@@ -260,6 +430,8 @@ static int check_perm(struct inode * inode, struct file * file) + } + mutex_init(&buffer->mutex); + buffer->needs_read_fill = 1; ++ buffer->read_in_progress = 0; ++ buffer->write_in_progress = 0; + buffer->ops = ops; + file->private_data = buffer; + goto Done; +@@ -277,12 +449,7 @@ static int check_perm(struct inode * inode, struct file * file) + return error; + } + +-static int configfs_open_file(struct inode * inode, struct file * filp) +-{ +- return check_perm(inode,filp); +-} +- +-static int configfs_release(struct inode * inode, struct file * filp) ++static int configfs_release(struct inode *inode, struct file *filp) + { + struct config_item * item = to_item(filp->f_path.dentry->d_parent); + struct configfs_attribute * attr = to_attr(filp->f_path.dentry); +@@ -303,6 +470,47 @@ static int configfs_release(struct inode * inode, struct file * filp) + return 0; + } + ++static int configfs_open_file(struct inode *inode, struct file *filp) ++{ ++ return check_perm(inode, filp, CONFIGFS_ITEM_ATTR); ++} ++ ++static int configfs_open_bin_file(struct inode *inode, struct file *filp) ++{ ++ return check_perm(inode, filp, CONFIGFS_ITEM_BIN_ATTR); ++} ++ ++static int configfs_release_bin_file(struct inode *inode, struct file *filp) ++{ ++ struct configfs_buffer *buffer = filp->private_data; ++ struct dentry *dentry = filp->f_path.dentry; ++ struct config_item *item = to_item(dentry->d_parent); ++ struct configfs_bin_attribute *bin_attr = to_bin_attr(dentry); ++ ssize_t len = 0; ++ int ret; ++ ++ buffer->read_in_progress = 0; ++ ++ if (buffer->write_in_progress) { ++ buffer->write_in_progress = 0; ++ ++ len = bin_attr->write(item, buffer->bin_buffer, ++ buffer->bin_buffer_size); ++ ++ /* vfree on NULL is safe */ ++ vfree(buffer->bin_buffer); ++ buffer->bin_buffer = NULL; ++ buffer->bin_buffer_size = 0; ++ buffer->needs_read_fill = 1; ++ } ++ ++ ret = configfs_release(inode, filp); ++ if (len < 0) ++ return len; ++ return ret; ++} ++ ++ + const struct file_operations configfs_file_operations = { + .read = configfs_read_file, + .write = configfs_write_file, +@@ -311,6 +519,14 @@ const struct file_operations configfs_file_operations = { + .release = configfs_release, + }; + ++const struct file_operations configfs_bin_file_operations = { ++ .read = configfs_read_bin_file, ++ .write = configfs_write_bin_file, ++ .llseek = NULL, /* bin file is not seekable */ ++ .open = configfs_open_bin_file, ++ .release = configfs_release_bin_file, ++}; ++ + /** + * configfs_create_file - create an attribute file for an item. + * @item: item we're creating for. +@@ -332,3 +548,24 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib + return error; + } + ++/** ++ * configfs_create_bin_file - create a binary attribute file for an item. ++ * @item: item we're creating for. ++ * @attr: atrribute descriptor. ++ */ ++ ++int configfs_create_bin_file(struct config_item *item, ++ const struct configfs_bin_attribute *bin_attr) ++{ ++ struct dentry *dir = item->ci_dentry; ++ struct configfs_dirent *parent_sd = dir->d_fsdata; ++ umode_t mode = (bin_attr->cb_attr.ca_mode & S_IALLUGO) | S_IFREG; ++ int error = 0; ++ ++ mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL); ++ error = configfs_make_dirent(parent_sd, NULL, (void *) bin_attr, mode, ++ CONFIGFS_ITEM_BIN_ATTR); ++ mutex_unlock(&dir->d_inode->i_mutex); ++ ++ return error; ++} +diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c +index eae87575e681..0cc810e9dccc 100644 +--- a/fs/configfs/inode.c ++++ b/fs/configfs/inode.c +@@ -218,7 +218,7 @@ const unsigned char * configfs_get_name(struct configfs_dirent *sd) + if (sd->s_type & (CONFIGFS_DIR | CONFIGFS_ITEM_LINK)) + return sd->s_dentry->d_name.name; + +- if (sd->s_type & CONFIGFS_ITEM_ATTR) { ++ if (sd->s_type & (CONFIGFS_ITEM_ATTR | CONFIGFS_ITEM_BIN_ATTR)) { + attr = sd->s_element; + return attr->ca_name; + } +diff --git a/include/linux/configfs.h b/include/linux/configfs.h +index 758a029011b1..f7300d023dbe 100644 +--- a/include/linux/configfs.h ++++ b/include/linux/configfs.h +@@ -51,6 +51,7 @@ struct module; + struct configfs_item_operations; + struct configfs_group_operations; + struct configfs_attribute; ++struct configfs_bin_attribute; + struct configfs_subsystem; + + struct config_item { +@@ -84,6 +85,7 @@ struct config_item_type { + struct configfs_item_operations *ct_item_ops; + struct configfs_group_operations *ct_group_ops; + struct configfs_attribute **ct_attrs; ++ struct configfs_bin_attribute **ct_bin_attrs; + }; + + /** +@@ -154,6 +156,54 @@ static struct configfs_attribute _pfx##attr_##_name = { \ + .store = _pfx##_name##_store, \ + } + ++struct file; ++struct vm_area_struct; ++ ++struct configfs_bin_attribute { ++ struct configfs_attribute cb_attr; /* std. attribute */ ++ void *cb_private; /* for user */ ++ size_t cb_max_size; /* max core size */ ++ ssize_t (*read)(struct config_item *, void *, size_t); ++ ssize_t (*write)(struct config_item *, const void *, size_t); ++}; ++ ++#define CONFIGFS_BIN_ATTR(_pfx, _name, _priv, _maxsz) \ ++static struct configfs_bin_attribute _pfx##attr_##_name = { \ ++ .cb_attr = { \ ++ .ca_name = __stringify(_name), \ ++ .ca_mode = S_IRUGO | S_IWUSR, \ ++ .ca_owner = THIS_MODULE, \ ++ }, \ ++ .cb_private = _priv, \ ++ .cb_max_size = _maxsz, \ ++ .read = _pfx##_name##_read, \ ++ .write = _pfx##_name##_write, \ ++} ++ ++#define CONFIGFS_BIN_ATTR_RO(_pfx, _name, _priv, _maxsz) \ ++static struct configfs_attribute _pfx##attr_##_name = { \ ++ .cb_attr = { \ ++ .ca_name = __stringify(_name), \ ++ .ca_mode = S_IRUGO, \ ++ .ca_owner = THIS_MODULE, \ ++ }, \ ++ .cb_private = _priv, \ ++ .cb_max_size = _maxsz, \ ++ .read = _pfx##_name##_read, \ ++} ++ ++#define CONFIGFS_BIN_ATTR_WO(_pfx, _name, _priv, _maxsz) \ ++static struct configfs_attribute _pfx##attr_##_name = { \ ++ .cb_attr = { \ ++ .ca_name = __stringify(_name), \ ++ .ca_mode = S_IWUSR, \ ++ .ca_owner = THIS_MODULE, \ ++ }, \ ++ .cb_private = _priv, \ ++ .cb_max_size = _maxsz, \ ++ .write = _pfx##_name##_write, \ ++} ++ + /* + * If allow_link() exists, the item can symlink(2) out to other + * items. If the item is a group, it may support mkdir(2). + +From 2dc994339b24321895cff69fda659e47648871be Mon Sep 17 00:00:00 2001 +From: Octavian Purdila +Date: Wed, 23 Mar 2016 14:14:48 +0200 +Subject: [PATCH] UPSTREAM: configfs: fix CONFIGFS_BIN_ATTR_[RW]O definitions + +The type should be struct configfs_bin_attribute and not struct +configfs_attribute. + +Signed-off-by: Octavian Purdila +Signed-off-by: Christoph Hellwig +(cherry picked from commit 96c22a3293512ba684e73a981196430f524689da) +--- + include/linux/configfs.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/linux/configfs.h b/include/linux/configfs.h +index f7300d023dbe..658066d63180 100644 +--- a/include/linux/configfs.h ++++ b/include/linux/configfs.h +@@ -181,7 +181,7 @@ static struct configfs_bin_attribute _pfx##attr_##_name = { \ + } + + #define CONFIGFS_BIN_ATTR_RO(_pfx, _name, _priv, _maxsz) \ +-static struct configfs_attribute _pfx##attr_##_name = { \ ++static struct configfs_bin_attribute _pfx##attr_##_name = { \ + .cb_attr = { \ + .ca_name = __stringify(_name), \ + .ca_mode = S_IRUGO, \ +@@ -193,7 +193,7 @@ static struct configfs_attribute _pfx##attr_##_name = { \ + } + + #define CONFIGFS_BIN_ATTR_WO(_pfx, _name, _priv, _maxsz) \ +-static struct configfs_attribute _pfx##attr_##_name = { \ ++static struct configfs_bin_attribute _pfx##attr_##_name = { \ + .cb_attr = { \ + .ca_name = __stringify(_name), \ + .ca_mode = S_IWUSR, \ + +From a2a707f138cf997e098a6d3aceac4b0944f7d76e Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou +Date: Wed, 4 Dec 2013 19:32:00 +0200 +Subject: [PATCH] FROMLIST: OF: DT-Overlay configfs interface (v7) + +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 v6: +- Default groups properties API changed. + +Changes since v5: +- New style configfs. + +Changes since v4: +- Loading fix for multiple overlays as found out by + Geert Uytterhoeven + +Changes since v3: +- Fixed compilation on SPARC & Xtensa + +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(). + +Signed-off-by: Pantelis Antoniou +[geert: Use %zu to format size_t] +[geert: Let OF_CONFIGFS select OF_FLATTREE to fix sparc all*config] +Signed-off-by: Geert Uytterhoeven +--- + Documentation/devicetree/configfs-overlays.txt | 31 +++ + drivers/of/Kconfig | 8 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 314 +++++++++++++++++++++++++ + 4 files changed, 354 insertions(+) + create mode 100644 Documentation/devicetree/configfs-overlays.txt + create mode 100644 drivers/of/configfs.c + +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 e2a48415d969..c112c9f2ca6b 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -112,4 +112,12 @@ config OF_OVERLAY + While this option is selected automatically when needed, you can + enable it manually to improve device tree unit test coverage. + ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_FLATTREE ++ depends on 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 478d4edcd763..732fa66b5263 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,4 +1,5 @@ + obj-y = base.o device.o platform.o property.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..908ce4960c30 +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,314 @@ ++/* ++ * 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 "of_private.h" ++ ++struct cfs_overlay_item { ++ struct config_item item; ++ ++ char path[PATH_MAX]; ++ ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static int create_overlay(struct cfs_overlay_item *overlay, void *blob) ++{ ++ int err; ++ ++ /* unflatten the tree */ ++ of_fdt_unflatten_tree(blob, &overlay->overlay); ++ if (overlay->overlay == NULL) { ++ pr_err("%s: failed to unflatten tree\n", __func__); ++ err = -EINVAL; ++ goto out_err; ++ } ++ pr_debug("%s: unflattened OK\n", __func__); ++ ++ /* mark it as detached */ ++ of_node_set_flag(overlay->overlay, OF_DETACHED); ++ ++ /* perform resolution */ ++ err = of_resolve_phandles(overlay->overlay); ++ if (err != 0) { ++ pr_err("%s: Failed to resolve tree\n", __func__); ++ goto out_err; ++ } ++ pr_debug("%s: resolved OK\n", __func__); ++ ++ err = of_overlay_create(overlay->overlay); ++ if (err < 0) { ++ pr_err("%s: Failed to create overlay (err=%d)\n", ++ __func__, err); ++ goto out_err; ++ } ++ overlay->ov_id = err; ++ ++out_err: ++ return err; ++} ++ ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) ++{ ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} ++ ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} ++ ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; ++ ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; ++ ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); ++ ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ err = create_overlay(overlay, (void *)overlay->fw->data); ++ if (err < 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; ++ ++ overlay->path[0] = '\0'; ++ return err; ++} ++ ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ return sprintf(page, "%s\n", ++ overlay->ov_id >= 0 ? "applied" : "unapplied"); ++} ++ ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); ++ ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; ++ ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); ++ ++ if (overlay->dtbo == NULL) ++ return 0; ++ ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; ++ ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } ++ ++ return overlay->dtbo_size; ++} ++ ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; ++ ++ overlay->dtbo_size = count; ++ ++ err = create_overlay(overlay, overlay->dtbo); ++ if (err < 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; ++ ++ return err; ++} ++ ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id >= 0) ++ of_overlay_destroy(overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); ++} ++ ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; ++ ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; ++ ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ overlay->ov_id = -1; ++ ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} ++ ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ config_item_put(&overlay->item); ++} ++ ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; ++ ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; ++ ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++struct config_group of_cfs_overlay_group; ++ ++struct config_group *of_cfs_def_groups[] = { ++ &of_cfs_overlay_group, ++ NULL ++}; ++ ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ .default_groups = of_cfs_def_groups, ++ }, ++ .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); ++ ++ 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); diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0008-mmc-pwrseq.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0008-mmc-pwrseq.patch new file mode 100644 index 0000000000..60860b7ba3 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0008-mmc-pwrseq.patch @@ -0,0 +1,949 @@ +From 625c86fa85aa4d18f7711d0314f2ef78a71b79c0 Mon Sep 17 00:00:00 2001 +From: Julia Lawall +Date: Sat, 14 Nov 2015 18:05:20 +0100 +Subject: [PATCH] UPSTREAM: mmc: pwrseq: constify mmc_pwrseq_ops structures + +The mmc_pwrseq_ops structures are never modified, so declare them as const. + +Done with the help of Coccinelle. + +Signed-off-by: Julia Lawall +Signed-off-by: Ulf Hansson +(cherry picked from commit ffedbd2210f2f4cba490a9205adc11fd1b89a852) +--- + drivers/mmc/core/pwrseq.h | 2 +- + drivers/mmc/core/pwrseq_emmc.c | 2 +- + drivers/mmc/core/pwrseq_simple.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h +index 096da48c6a7e..133de0426687 100644 +--- a/drivers/mmc/core/pwrseq.h ++++ b/drivers/mmc/core/pwrseq.h +@@ -16,7 +16,7 @@ struct mmc_pwrseq_ops { + }; + + struct mmc_pwrseq { +- struct mmc_pwrseq_ops *ops; ++ const struct mmc_pwrseq_ops *ops; + }; + + #ifdef CONFIG_OF +diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c +index ad4f94ec7e8d..4a82bc77fe49 100644 +--- a/drivers/mmc/core/pwrseq_emmc.c ++++ b/drivers/mmc/core/pwrseq_emmc.c +@@ -51,7 +51,7 @@ static void mmc_pwrseq_emmc_free(struct mmc_host *host) + kfree(pwrseq); + } + +-static struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = { ++static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = { + .post_power_on = mmc_pwrseq_emmc_reset, + .free = mmc_pwrseq_emmc_free, + }; +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index d10538bb5e07..2b16263458af 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -87,7 +87,7 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host) + kfree(pwrseq); + } + +-static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { ++static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { + .pre_power_on = mmc_pwrseq_simple_pre_power_on, + .post_power_on = mmc_pwrseq_simple_post_power_on, + .power_off = mmc_pwrseq_simple_power_off, + +From dda0216c4619c51bb5e560e2e9a8977ae92c2598 Mon Sep 17 00:00:00 2001 +From: Martin Fuzzey +Date: Wed, 20 Jan 2016 16:08:03 +0100 +Subject: [PATCH] UPSTREAM: mmc: pwrseq_simple: Make reset-gpios optional to + match doc + +The DT binding doc says reset-gpios is an optional property but the code +currently bails out if it is omitted. + +This is a regression since it breaks previously working device trees. +Fix it by restoring the original documented behaviour. + +Fixes: ce037275861e ("mmc: pwrseq_simple: use GPIO descriptors array API") +Tested-by: Tony Lindgren +Signed-off-by: Martin Fuzzey +Signed-off-by: Ulf Hansson +(cherry picked from commit 64a67d4762ce3ce4c9466eadd152d825fbf84967) +--- + drivers/mmc/core/pwrseq_simple.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index 2b16263458af..aba786daebca 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -29,15 +29,18 @@ struct mmc_pwrseq_simple { + static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, + int value) + { +- int i; + struct gpio_descs *reset_gpios = pwrseq->reset_gpios; +- int values[reset_gpios->ndescs]; + +- for (i = 0; i < reset_gpios->ndescs; i++) +- values[i] = value; ++ if (!IS_ERR(reset_gpios)) { ++ int i; ++ int values[reset_gpios->ndescs]; + +- gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc, +- values); ++ for (i = 0; i < reset_gpios->ndescs; i++) ++ values[i] = value; ++ ++ gpiod_set_array_value_cansleep( ++ reset_gpios->ndescs, reset_gpios->desc, values); ++ } + } + + static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) +@@ -79,7 +82,8 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host) + struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, + struct mmc_pwrseq_simple, pwrseq); + +- gpiod_put_array(pwrseq->reset_gpios); ++ if (!IS_ERR(pwrseq->reset_gpios)) ++ gpiod_put_array(pwrseq->reset_gpios); + + if (!IS_ERR(pwrseq->ext_clk)) + clk_put(pwrseq->ext_clk); +@@ -112,7 +116,9 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host, + } + + pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); +- if (IS_ERR(pwrseq->reset_gpios)) { ++ if (IS_ERR(pwrseq->reset_gpios) && ++ PTR_ERR(pwrseq->reset_gpios) != -ENOENT && ++ PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { + ret = PTR_ERR(pwrseq->reset_gpios); + goto clk_put; + } + +From 58975b7a58defa92efd5533cc731fb9a0c1cb780 Mon Sep 17 00:00:00 2001 +From: Peter Chen +Date: Wed, 6 Jan 2016 11:34:10 +0800 +Subject: [PATCH] UPSTREAM: mmc: core: pwrseq_simple: remove unused header file + +Signed-off-by: Peter Chen +Signed-off-by: Ulf Hansson +(cherry picked from commit 62c03ca3ffa1ddf55a66411be02f7e4678771fce) +--- + drivers/mmc/core/pwrseq_simple.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index aba786daebca..bc173e18b71c 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -12,7 +12,6 @@ + #include + #include + #include +-#include + #include + + #include + +From 01946788b015b9d3f7d18f5b4a43e09e6bf66623 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Thu, 14 Apr 2016 14:02:14 +0100 +Subject: [PATCH] UPSTREAM: mmc: pwrseq_simple: add to_pwrseq_simple() macro + +This patch adds to_pwrseq_simple() macro to make the code more readable. + +Signed-off-by: Srinivas Kandagatla +Signed-off-by: Ulf Hansson +(cherry picked from commit 5b96fea730ab79bdf6f8071cadf8208296bf5e8d) +--- + drivers/mmc/core/pwrseq_simple.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index bc173e18b71c..f94271bb1f6b 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -25,6 +25,8 @@ struct mmc_pwrseq_simple { + struct gpio_descs *reset_gpios; + }; + ++#define to_pwrseq_simple(p) container_of(p, struct mmc_pwrseq_simple, pwrseq) ++ + static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, + int value) + { +@@ -44,8 +46,7 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, + + static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) + { +- struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, +- struct mmc_pwrseq_simple, pwrseq); ++ struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + + if (!IS_ERR(pwrseq->ext_clk) && !pwrseq->clk_enabled) { + clk_prepare_enable(pwrseq->ext_clk); +@@ -57,16 +58,14 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) + + static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) + { +- struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, +- struct mmc_pwrseq_simple, pwrseq); ++ struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + + mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); + } + + static void mmc_pwrseq_simple_power_off(struct mmc_host *host) + { +- struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, +- struct mmc_pwrseq_simple, pwrseq); ++ struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + + mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); + +@@ -78,8 +77,7 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) + + static void mmc_pwrseq_simple_free(struct mmc_host *host) + { +- struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, +- struct mmc_pwrseq_simple, pwrseq); ++ struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + + if (!IS_ERR(pwrseq->reset_gpios)) + gpiod_put_array(pwrseq->reset_gpios); + +From b76637491013b2298cf46729767ba76544d4023b Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Thu, 14 Apr 2016 14:02:15 +0100 +Subject: [PATCH] UPSTREAM: mmc: pwrseq_emmc: add to_pwrseq_emmc() macro + +This patch adds to_pwrseq_emmc() macro to make the code more readable. + +Signed-off-by: Srinivas Kandagatla +Signed-off-by: Ulf Hansson +(cherry picked from commit f01b72d0fd53b61cafd25b16d15e18b1ef8ae065) +--- + drivers/mmc/core/pwrseq_emmc.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c +index 4a82bc77fe49..c2d732aa464c 100644 +--- a/drivers/mmc/core/pwrseq_emmc.c ++++ b/drivers/mmc/core/pwrseq_emmc.c +@@ -25,6 +25,8 @@ struct mmc_pwrseq_emmc { + struct gpio_desc *reset_gpio; + }; + ++#define to_pwrseq_emmc(p) container_of(p, struct mmc_pwrseq_emmc, pwrseq) ++ + static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) + { + gpiod_set_value(pwrseq->reset_gpio, 1); +@@ -35,16 +37,14 @@ static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) + + static void mmc_pwrseq_emmc_reset(struct mmc_host *host) + { +- struct mmc_pwrseq_emmc *pwrseq = container_of(host->pwrseq, +- struct mmc_pwrseq_emmc, pwrseq); ++ struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); + + __mmc_pwrseq_emmc_reset(pwrseq); + } + + static void mmc_pwrseq_emmc_free(struct mmc_host *host) + { +- struct mmc_pwrseq_emmc *pwrseq = container_of(host->pwrseq, +- struct mmc_pwrseq_emmc, pwrseq); ++ struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); + + unregister_restart_handler(&pwrseq->reset_nb); + gpiod_put(pwrseq->reset_gpio); + +From c1631d2cea4e5956e368c4652859a9090a509af2 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Thu, 14 Apr 2016 14:02:16 +0100 +Subject: [PATCH] UPSTREAM: mmc: pwrseq: convert to proper platform device + +simple-pwrseq and emmc-pwrseq drivers rely on platform_device +structure from of_find_device_by_node(), this works mostly. But, as there +is no driver associated with this devices, cases like default/init pinctrl +setup would never be performed by pwrseq. This becomes problem when the +gpios used in pwrseq require pinctrl setup. + +Currently most of the common pinctrl setup is done in +drivers/base/pinctrl.c by pinctrl_bind_pins(). + +There are two ways to solve this issue on either convert pwrseq drivers +to a proper platform drivers or copy the exact code from +pcintrl_bind_pins(). I prefer converting pwrseq to proper drivers so that +other cases like setting up clks/parents from dt would also be possible. + +Signed-off-by: Srinivas Kandagatla +Signed-off-by: Ulf Hansson +(cherry picked from commit d97a1e5d7cd2b5b0edc02a40fe6897b710c9e10f) +--- + drivers/mmc/core/Kconfig | 22 ++++++++ + drivers/mmc/core/Makefile | 4 +- + drivers/mmc/core/pwrseq.c | 108 ++++++++++++++++++--------------------- + drivers/mmc/core/pwrseq.h | 19 ++++--- + drivers/mmc/core/pwrseq_emmc.c | 75 +++++++++++++++++---------- + drivers/mmc/core/pwrseq_simple.c | 79 +++++++++++++++------------- + 6 files changed, 178 insertions(+), 129 deletions(-) + +diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig +index 87cc07dedd9f..00dfaea06003 100644 +--- a/drivers/mmc/core/Kconfig ++++ b/drivers/mmc/core/Kconfig +@@ -16,3 +16,25 @@ config MMC_PARANOID_SD_INIT + about re-trying SD init requests. This can be a useful + work-around for buggy controllers and hardware. Enable + if you are experiencing issues with SD detection. ++ ++config PWRSEQ_EMMC ++ tristate "HW reset support for eMMC" ++ default y ++ depends on OF ++ help ++ This selects Hardware reset support aka pwrseq-emmc for eMMC ++ devices. By default this option is set to y. ++ ++ This driver can also be built as a module. If so, the module ++ will be called pwrseq_emmc. ++ ++config PWRSEQ_SIMPLE ++ tristate "Simple HW reset support for MMC" ++ default y ++ depends on OF ++ help ++ This selects simple hardware reset support aka pwrseq-simple for MMC ++ devices. By default this option is set to y. ++ ++ This driver can also be built as a module. If so, the module ++ will be called pwrseq_simple. +diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile +index 2c25138f28b7..f007151dfdc6 100644 +--- a/drivers/mmc/core/Makefile ++++ b/drivers/mmc/core/Makefile +@@ -8,5 +8,7 @@ mmc_core-y := core.o bus.o host.o \ + sdio.o sdio_ops.o sdio_bus.o \ + sdio_cis.o sdio_io.o sdio_irq.o \ + quirks.o slot-gpio.o +-mmc_core-$(CONFIG_OF) += pwrseq.o pwrseq_simple.o pwrseq_emmc.o ++mmc_core-$(CONFIG_OF) += pwrseq.o ++obj-$(CONFIG_PWRSEQ_SIMPLE) += pwrseq_simple.o ++obj-$(CONFIG_PWRSEQ_EMMC) += pwrseq_emmc.o + mmc_core-$(CONFIG_DEBUG_FS) += debugfs.o +diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c +index 4c1d1757dbf9..9386c4771814 100644 +--- a/drivers/mmc/core/pwrseq.c ++++ b/drivers/mmc/core/pwrseq.c +@@ -8,88 +8,55 @@ + * MMC power sequence management + */ + #include +-#include + #include ++#include + #include +-#include + + #include + + #include "pwrseq.h" + +-struct mmc_pwrseq_match { +- const char *compatible; +- struct mmc_pwrseq *(*alloc)(struct mmc_host *host, struct device *dev); +-}; +- +-static struct mmc_pwrseq_match pwrseq_match[] = { +- { +- .compatible = "mmc-pwrseq-simple", +- .alloc = mmc_pwrseq_simple_alloc, +- }, { +- .compatible = "mmc-pwrseq-emmc", +- .alloc = mmc_pwrseq_emmc_alloc, +- }, +-}; +- +-static struct mmc_pwrseq_match *mmc_pwrseq_find(struct device_node *np) +-{ +- struct mmc_pwrseq_match *match = ERR_PTR(-ENODEV); +- int i; +- +- for (i = 0; i < ARRAY_SIZE(pwrseq_match); i++) { +- if (of_device_is_compatible(np, pwrseq_match[i].compatible)) { +- match = &pwrseq_match[i]; +- break; +- } +- } +- +- return match; +-} ++static DEFINE_MUTEX(pwrseq_list_mutex); ++static LIST_HEAD(pwrseq_list); + + int mmc_pwrseq_alloc(struct mmc_host *host) + { +- struct platform_device *pdev; + struct device_node *np; +- struct mmc_pwrseq_match *match; +- struct mmc_pwrseq *pwrseq; +- int ret = 0; ++ struct mmc_pwrseq *p; + + np = of_parse_phandle(host->parent->of_node, "mmc-pwrseq", 0); + if (!np) + return 0; + +- pdev = of_find_device_by_node(np); +- if (!pdev) { +- ret = -ENODEV; +- goto err; +- } ++ mutex_lock(&pwrseq_list_mutex); ++ list_for_each_entry(p, &pwrseq_list, pwrseq_node) { ++ if (p->dev->of_node == np) { ++ if (!try_module_get(p->owner)) ++ dev_err(host->parent, ++ "increasing module refcount failed\n"); ++ else ++ host->pwrseq = p; + +- match = mmc_pwrseq_find(np); +- if (IS_ERR(match)) { +- ret = PTR_ERR(match); +- goto err; ++ break; ++ } + } + +- pwrseq = match->alloc(host, &pdev->dev); +- if (IS_ERR(pwrseq)) { +- ret = PTR_ERR(pwrseq); +- goto err; +- } ++ of_node_put(np); ++ mutex_unlock(&pwrseq_list_mutex); ++ ++ if (!host->pwrseq) ++ return -EPROBE_DEFER; + +- host->pwrseq = pwrseq; + dev_info(host->parent, "allocated mmc-pwrseq\n"); + +-err: +- of_node_put(np); +- return ret; ++ return 0; + } + + void mmc_pwrseq_pre_power_on(struct mmc_host *host) + { + struct mmc_pwrseq *pwrseq = host->pwrseq; + +- if (pwrseq && pwrseq->ops && pwrseq->ops->pre_power_on) ++ if (pwrseq && pwrseq->ops->pre_power_on) + pwrseq->ops->pre_power_on(host); + } + +@@ -97,7 +64,7 @@ void mmc_pwrseq_post_power_on(struct mmc_host *host) + { + struct mmc_pwrseq *pwrseq = host->pwrseq; + +- if (pwrseq && pwrseq->ops && pwrseq->ops->post_power_on) ++ if (pwrseq && pwrseq->ops->post_power_on) + pwrseq->ops->post_power_on(host); + } + +@@ -105,7 +72,7 @@ void mmc_pwrseq_power_off(struct mmc_host *host) + { + struct mmc_pwrseq *pwrseq = host->pwrseq; + +- if (pwrseq && pwrseq->ops && pwrseq->ops->power_off) ++ if (pwrseq && pwrseq->ops->power_off) + pwrseq->ops->power_off(host); + } + +@@ -113,8 +80,31 @@ void mmc_pwrseq_free(struct mmc_host *host) + { + struct mmc_pwrseq *pwrseq = host->pwrseq; + +- if (pwrseq && pwrseq->ops && pwrseq->ops->free) +- pwrseq->ops->free(host); ++ if (pwrseq) { ++ module_put(pwrseq->owner); ++ host->pwrseq = NULL; ++ } ++} ++ ++int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) ++{ ++ if (!pwrseq || !pwrseq->ops || !pwrseq->dev) ++ return -EINVAL; + +- host->pwrseq = NULL; ++ mutex_lock(&pwrseq_list_mutex); ++ list_add(&pwrseq->pwrseq_node, &pwrseq_list); ++ mutex_unlock(&pwrseq_list_mutex); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(mmc_pwrseq_register); ++ ++void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) ++{ ++ if (pwrseq) { ++ mutex_lock(&pwrseq_list_mutex); ++ list_del(&pwrseq->pwrseq_node); ++ mutex_unlock(&pwrseq_list_mutex); ++ } + } ++EXPORT_SYMBOL_GPL(mmc_pwrseq_unregister); +diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h +index 133de0426687..d69e751f148b 100644 +--- a/drivers/mmc/core/pwrseq.h ++++ b/drivers/mmc/core/pwrseq.h +@@ -8,32 +8,39 @@ + #ifndef _MMC_CORE_PWRSEQ_H + #define _MMC_CORE_PWRSEQ_H + ++#include ++ + struct mmc_pwrseq_ops { + void (*pre_power_on)(struct mmc_host *host); + void (*post_power_on)(struct mmc_host *host); + void (*power_off)(struct mmc_host *host); +- void (*free)(struct mmc_host *host); + }; + + struct mmc_pwrseq { + const struct mmc_pwrseq_ops *ops; ++ struct device *dev; ++ struct list_head pwrseq_node; ++ struct module *owner; + }; + + #ifdef CONFIG_OF + ++int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq); ++void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); ++ + int mmc_pwrseq_alloc(struct mmc_host *host); + void mmc_pwrseq_pre_power_on(struct mmc_host *host); + void mmc_pwrseq_post_power_on(struct mmc_host *host); + void mmc_pwrseq_power_off(struct mmc_host *host); + void mmc_pwrseq_free(struct mmc_host *host); + +-struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host, +- struct device *dev); +-struct mmc_pwrseq *mmc_pwrseq_emmc_alloc(struct mmc_host *host, +- struct device *dev); +- + #else + ++static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) ++{ ++ return -ENOSYS; ++} ++static inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {} + static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } + static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} + static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} +diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c +index c2d732aa464c..adc9c0c614fb 100644 +--- a/drivers/mmc/core/pwrseq_emmc.c ++++ b/drivers/mmc/core/pwrseq_emmc.c +@@ -9,6 +9,9 @@ + */ + #include + #include ++#include ++#include ++#include + #include + #include + #include +@@ -42,20 +45,6 @@ static void mmc_pwrseq_emmc_reset(struct mmc_host *host) + __mmc_pwrseq_emmc_reset(pwrseq); + } + +-static void mmc_pwrseq_emmc_free(struct mmc_host *host) +-{ +- struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); +- +- unregister_restart_handler(&pwrseq->reset_nb); +- gpiod_put(pwrseq->reset_gpio); +- kfree(pwrseq); +-} +- +-static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = { +- .post_power_on = mmc_pwrseq_emmc_reset, +- .free = mmc_pwrseq_emmc_free, +-}; +- + static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, + unsigned long mode, void *cmd) + { +@@ -66,21 +55,22 @@ static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, + return NOTIFY_DONE; + } + +-struct mmc_pwrseq *mmc_pwrseq_emmc_alloc(struct mmc_host *host, +- struct device *dev) ++static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = { ++ .post_power_on = mmc_pwrseq_emmc_reset, ++}; ++ ++static int mmc_pwrseq_emmc_probe(struct platform_device *pdev) + { + struct mmc_pwrseq_emmc *pwrseq; +- int ret = 0; ++ struct device *dev = &pdev->dev; + +- pwrseq = kzalloc(sizeof(struct mmc_pwrseq_emmc), GFP_KERNEL); ++ pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); + if (!pwrseq) +- return ERR_PTR(-ENOMEM); ++ return -ENOMEM; + +- pwrseq->reset_gpio = gpiod_get(dev, "reset", GPIOD_OUT_LOW); +- if (IS_ERR(pwrseq->reset_gpio)) { +- ret = PTR_ERR(pwrseq->reset_gpio); +- goto free; +- } ++ pwrseq->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); ++ if (IS_ERR(pwrseq->reset_gpio)) ++ return PTR_ERR(pwrseq->reset_gpio); + + /* + * register reset handler to ensure emmc reset also from +@@ -92,9 +82,38 @@ struct mmc_pwrseq *mmc_pwrseq_emmc_alloc(struct mmc_host *host, + register_restart_handler(&pwrseq->reset_nb); + + pwrseq->pwrseq.ops = &mmc_pwrseq_emmc_ops; ++ pwrseq->pwrseq.dev = dev; ++ pwrseq->pwrseq.owner = THIS_MODULE; ++ platform_set_drvdata(pdev, pwrseq); ++ ++ return mmc_pwrseq_register(&pwrseq->pwrseq); ++} ++ ++static int mmc_pwrseq_emmc_remove(struct platform_device *pdev) ++{ ++ struct mmc_pwrseq_emmc *pwrseq = platform_get_drvdata(pdev); ++ ++ unregister_restart_handler(&pwrseq->reset_nb); ++ mmc_pwrseq_unregister(&pwrseq->pwrseq); + +- return &pwrseq->pwrseq; +-free: +- kfree(pwrseq); +- return ERR_PTR(ret); ++ return 0; + } ++ ++static const struct of_device_id mmc_pwrseq_emmc_of_match[] = { ++ { .compatible = "mmc-pwrseq-emmc",}, ++ {/* sentinel */}, ++}; ++ ++MODULE_DEVICE_TABLE(of, mmc_pwrseq_emmc_of_match); ++ ++static struct platform_driver mmc_pwrseq_emmc_driver = { ++ .probe = mmc_pwrseq_emmc_probe, ++ .remove = mmc_pwrseq_emmc_remove, ++ .driver = { ++ .name = "pwrseq_emmc", ++ .of_match_table = mmc_pwrseq_emmc_of_match, ++ }, ++}; ++ ++module_platform_driver(mmc_pwrseq_emmc_driver); ++MODULE_LICENSE("GPL v2"); +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index f94271bb1f6b..450d907c6e6c 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -8,7 +8,10 @@ + * Simple MMC power sequence management + */ + #include ++#include + #include ++#include ++#include + #include + #include + #include +@@ -75,58 +78,64 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) + } + } + +-static void mmc_pwrseq_simple_free(struct mmc_host *host) +-{ +- struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); +- +- if (!IS_ERR(pwrseq->reset_gpios)) +- gpiod_put_array(pwrseq->reset_gpios); +- +- if (!IS_ERR(pwrseq->ext_clk)) +- clk_put(pwrseq->ext_clk); +- +- kfree(pwrseq); +-} +- + static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { + .pre_power_on = mmc_pwrseq_simple_pre_power_on, + .post_power_on = mmc_pwrseq_simple_post_power_on, + .power_off = mmc_pwrseq_simple_power_off, +- .free = mmc_pwrseq_simple_free, + }; + +-struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host, +- struct device *dev) ++static const struct of_device_id mmc_pwrseq_simple_of_match[] = { ++ { .compatible = "mmc-pwrseq-simple",}, ++ {/* sentinel */}, ++}; ++MODULE_DEVICE_TABLE(of, mmc_pwrseq_simple_of_match); ++ ++static int mmc_pwrseq_simple_probe(struct platform_device *pdev) + { + struct mmc_pwrseq_simple *pwrseq; +- int ret = 0; ++ struct device *dev = &pdev->dev; + +- pwrseq = kzalloc(sizeof(*pwrseq), GFP_KERNEL); ++ pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL); + if (!pwrseq) +- return ERR_PTR(-ENOMEM); ++ return -ENOMEM; + +- pwrseq->ext_clk = clk_get(dev, "ext_clock"); +- if (IS_ERR(pwrseq->ext_clk) && +- PTR_ERR(pwrseq->ext_clk) != -ENOENT) { +- ret = PTR_ERR(pwrseq->ext_clk); +- goto free; +- } ++ pwrseq->ext_clk = devm_clk_get(dev, "ext_clock"); ++ if (IS_ERR(pwrseq->ext_clk) && PTR_ERR(pwrseq->ext_clk) != -ENOENT) ++ return PTR_ERR(pwrseq->ext_clk); + +- pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); ++ pwrseq->reset_gpios = devm_gpiod_get_array(dev, "reset", ++ GPIOD_OUT_HIGH); + if (IS_ERR(pwrseq->reset_gpios) && + PTR_ERR(pwrseq->reset_gpios) != -ENOENT && + PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { +- ret = PTR_ERR(pwrseq->reset_gpios); +- goto clk_put; ++ return PTR_ERR(pwrseq->reset_gpios); + } + ++ pwrseq->pwrseq.dev = dev; + pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops; ++ pwrseq->pwrseq.owner = THIS_MODULE; ++ platform_set_drvdata(pdev, pwrseq); + +- return &pwrseq->pwrseq; +-clk_put: +- if (!IS_ERR(pwrseq->ext_clk)) +- clk_put(pwrseq->ext_clk); +-free: +- kfree(pwrseq); +- return ERR_PTR(ret); ++ return mmc_pwrseq_register(&pwrseq->pwrseq); + } ++ ++static int mmc_pwrseq_simple_remove(struct platform_device *pdev) ++{ ++ struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev); ++ ++ mmc_pwrseq_unregister(&pwrseq->pwrseq); ++ ++ return 0; ++} ++ ++static struct platform_driver mmc_pwrseq_simple_driver = { ++ .probe = mmc_pwrseq_simple_probe, ++ .remove = mmc_pwrseq_simple_remove, ++ .driver = { ++ .name = "pwrseq_simple", ++ .of_match_table = mmc_pwrseq_simple_of_match, ++ }, ++}; ++ ++module_platform_driver(mmc_pwrseq_simple_driver); ++MODULE_LICENSE("GPL v2"); + +From 2abada2ff3999a38dc87d5803f98141a0971c06c Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Sun, 7 Aug 2016 21:02:38 +0200 +Subject: [PATCH] UPSTREAM: mmc: pwrseq-simple: Add an optional + post-power-on-delay + +Some devices need a while to boot their firmware after providing clks / +de-asserting resets before they are ready to receive sdio commands. + +This commits adds a post-power-on-delay-ms devicetree property to +mmc-pwrseq-simple for use with such devices. + +Signed-off-by: Hans de Goede +Acked-by: Rob Herring +Signed-off-by: Ulf Hansson +(cherry picked from commit 721e0497172f0fa661eed2d63367cddf479f35e8) +--- + Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt | 2 ++ + drivers/mmc/core/pwrseq_simple.c | 9 +++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt +index ce0e76749671..e25436861867 100644 +--- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt ++++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt +@@ -16,6 +16,8 @@ Optional properties: + See ../clocks/clock-bindings.txt for details. + - clock-names : Must include the following entry: + "ext_clock" (External clock provided to the card). ++- post-power-on-delay-ms : Delay in ms after powering the card and ++ de-asserting the reset-gpios (if any) + + Example: + +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index 450d907c6e6c..1304160de168 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -16,6 +16,8 @@ + #include + #include + #include ++#include ++#include + + #include + +@@ -24,6 +26,7 @@ + struct mmc_pwrseq_simple { + struct mmc_pwrseq pwrseq; + bool clk_enabled; ++ u32 post_power_on_delay_ms; + struct clk *ext_clk; + struct gpio_descs *reset_gpios; + }; +@@ -64,6 +67,9 @@ static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); + + mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); ++ ++ if (pwrseq->post_power_on_delay_ms) ++ msleep(pwrseq->post_power_on_delay_ms); + } + + static void mmc_pwrseq_simple_power_off(struct mmc_host *host) +@@ -111,6 +117,9 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev) + return PTR_ERR(pwrseq->reset_gpios); + } + ++ device_property_read_u32(dev, "post-power-on-delay-ms", ++ &pwrseq->post_power_on_delay_ms); ++ + pwrseq->pwrseq.dev = dev; + pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops; + pwrseq->pwrseq.owner = THIS_MODULE; + +From 4d0a703460821fc7541ae96916eca948e326b16c Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Sat, 6 May 2017 11:41:30 +0200 +Subject: [PATCH] UPSTREAM: mmc: dt: pwrseq-simple: Invent power-off-delay-us + +During power off, after the GPIO pin has been asserted, some devices like +the Wifi chip from TI, Wl18xx, needs a delay before the host continues with +clock gating and turning off regulators as to follow a graceful shutdown +sequence. + +Therefore invent an optional power-off-delay-us DT binding for +mmc-pwrseq-simple, to allow us to support this constraint. + +Cc: devicetree@vger.kernel.org +Cc: Rob Herring +Cc: linux-mmc@vger.kernel.org +Signed-off-by: Ulf Hansson +Acked-by: Arnd Bergmann +--- + Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt +index e25436861867..9029b45b8a22 100644 +--- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt ++++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt +@@ -18,6 +18,8 @@ Optional properties: + "ext_clock" (External clock provided to the card). + - post-power-on-delay-ms : Delay in ms after powering the card and + de-asserting the reset-gpios (if any) ++- power-off-delay-us : Delay in us after asserting the reset-gpios (if any) ++ during power off of the card. + + Example: + + +From e85294cdf12c6a6e6fb3c24cae1ad0994ae6aca2 Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Sat, 6 May 2017 11:43:05 +0200 +Subject: [PATCH] UPSTREAM: mmc: pwrseq_simple: Parse DTS for the + power-off-delay-us property + +If the optional power-off-delay-us property is found, insert the +corresponding delay after asserting the GPIO during power off. This enables +a graceful shutdown sequence for some devices. + +Cc: linux-mmc@vger.kernel.org +Signed-off-by: Ulf Hansson +Acked-by: Arnd Bergmann +(cherry picked from commit e9256e142f597edf90c68cec22db4c4aebaa27de) +--- + drivers/mmc/core/pwrseq_simple.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c +index 1304160de168..13ef162cf066 100644 +--- a/drivers/mmc/core/pwrseq_simple.c ++++ b/drivers/mmc/core/pwrseq_simple.c +@@ -27,6 +27,7 @@ struct mmc_pwrseq_simple { + struct mmc_pwrseq pwrseq; + bool clk_enabled; + u32 post_power_on_delay_ms; ++ u32 power_off_delay_us; + struct clk *ext_clk; + struct gpio_descs *reset_gpios; + }; +@@ -78,6 +79,10 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) + + mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); + ++ if (pwrseq->power_off_delay_us) ++ usleep_range(pwrseq->power_off_delay_us, ++ 2 * pwrseq->power_off_delay_us); ++ + if (!IS_ERR(pwrseq->ext_clk) && pwrseq->clk_enabled) { + clk_disable_unprepare(pwrseq->ext_clk); + pwrseq->clk_enabled = false; +@@ -119,6 +124,8 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev) + + device_property_read_u32(dev, "post-power-on-delay-ms", + &pwrseq->post_power_on_delay_ms); ++ device_property_read_u32(dev, "power-off-delay-us", ++ &pwrseq->power_off_delay_us); + + pwrseq->pwrseq.dev = dev; + pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops; diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0009-mmc.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0009-mmc.patch new file mode 100644 index 0000000000..9ce99216e5 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0009-mmc.patch @@ -0,0 +1,633 @@ +From 569de779d11ff8739e9ab4d8b4a5c505d1892e12 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 24 Jul 2018 15:49:29 +0200 +Subject: [PATCH] mmc: core: use hs400es voltage flags + +--- + drivers/mmc/core/mmc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c +index a814eb6882aa..1d950f0b3aa6 100644 +--- a/drivers/mmc/core/mmc.c ++++ b/drivers/mmc/core/mmc.c +@@ -1259,10 +1259,10 @@ static int mmc_select_hs400es(struct mmc_card *card) + goto out_err; + } + +- if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_2V) ++ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400_1_2V) + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); + +- if (err && card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_8V) ++ if (err && card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400_1_8V) + err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); + + /* If fails try again during next card power cycle */ + +From feda1a0c04130bd7391570025c5349e506ce8250 Mon Sep 17 00:00:00 2001 +From: Haibo Chen +Date: Tue, 8 Aug 2017 18:54:01 +0800 +Subject: [PATCH] UPSTREAM: mmc: mmc: correct the logic for setting HS400ES + signal voltage + +Change the default err value to -EINVAL, make sure the card only +has type EXT_CSD_CARD_TYPE_HS400_1_8V also do the signal voltage +setting when select hs400es mode. + +Fixes: commit 1720d3545b77 ("mmc: core: switch to 1V8 or 1V2 for hs400es mode") +Cc: +Signed-off-by: Haibo Chen +Reviewed-by: Shawn Lin +Signed-off-by: Ulf Hansson +(cherry picked from commit 92ddd95919466de5d34f3cb43635da9a7f9ab814) +--- + drivers/mmc/core/mmc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c +index 1d950f0b3aa6..70de514dd061 100644 +--- a/drivers/mmc/core/mmc.c ++++ b/drivers/mmc/core/mmc.c +@@ -1251,7 +1251,7 @@ out_err: + static int mmc_select_hs400es(struct mmc_card *card) + { + struct mmc_host *host = card->host; +- int err = 0; ++ int err = -EINVAL; + u8 val; + + if (!(host->caps & MMC_CAP_8_BIT_DATA)) { + +From 44476ecad8800bb8412f65c03508c68b1a0e1dbc Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Wed, 25 Jan 2017 10:12:10 +0100 +Subject: [PATCH] UPSTREAM: mmc: core: Remove redundant code in + mmc_set_signal_voltage() + +The mmc_set_signal_voltage() function is used for SD/SDIO when switching to +1.8V for UHS mode. Therefore let's remove the redundant code dealing with +MMC_SIGNAL_VOLTAGE_330. + +Signed-off-by: Ulf Hansson +Reviewed-by: Shawn Lin +Tested-by: Jan Glauber +Tested-by: Stefan Wahren +(cherry picked from commit a44efa4796249c6d4341935e90e9105d6e1a5f15) +--- + drivers/mmc/core/core.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 3e3c79feb07b..b69c96ad9486 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1598,13 +1598,6 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) + + BUG_ON(!host); + +- /* +- * Send CMD11 only if the request is to switch the card to +- * 1.8V signalling. +- */ +- if (signal_voltage == MMC_SIGNAL_VOLTAGE_330) +- return __mmc_set_signal_voltage(host, signal_voltage); +- + /* + * If we cannot switch voltages, return failure so the caller + * can continue without UHS mode + +From aeee71440b8948d2415527762a6bb9148b7d3cfa Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Wed, 25 Jan 2017 10:25:01 +0100 +Subject: [PATCH] UPSTREAM: mmc: core: Clarify usage of + mmc_set_signal_voltage() + +The mmc_set_signal_voltage() function is used for SD/SDIO when switching to +1.8V for UHS mode. To clarify this let's do the following changes. + +- We are always providing MMC_SIGNAL_VOLTAGE_180 as the signal_voltage + parameter to the function. Then, let's just remove the parameter as it + serves no purpose. +- Rename the function to mmc_set_uhs_voltage(). + +Signed-off-by: Ulf Hansson +Reviewed-by: Shawn Lin +Tested-by: Jan Glauber +Tested-by: Stefan Wahren +(cherry picked from commit 2ed573b603f78289dd1435c94597aa25a97e2b76) +--- + drivers/mmc/core/core.c | 4 ++-- + drivers/mmc/core/core.h | 2 +- + drivers/mmc/core/sd.c | 3 +-- + drivers/mmc/core/sdio.c | 3 +-- + 4 files changed, 5 insertions(+), 7 deletions(-) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index b69c96ad9486..35d19d57d2c5 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1590,7 +1590,7 @@ int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage) + + } + +-int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) ++int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr) + { + struct mmc_command cmd = {0}; + int err = 0; +@@ -1636,7 +1636,7 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) + host->ios.clock = 0; + mmc_set_ios(host); + +- if (__mmc_set_signal_voltage(host, signal_voltage)) { ++ if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) { + /* + * Voltages may not have been switched, but we've already + * sent CMD11, so a power cycle is required anyway +diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h +index ed7c3167763a..88ef50b2e0be 100644 +--- a/drivers/mmc/core/core.h ++++ b/drivers/mmc/core/core.h +@@ -43,7 +43,7 @@ void mmc_set_clock(struct mmc_host *host, unsigned int hz); + void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); + void mmc_set_bus_width(struct mmc_host *host, unsigned int width); + u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); +-int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr); ++int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr); + int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); + void mmc_set_timing(struct mmc_host *host, unsigned int timing); + void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); +diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c +index cd437d6b1843..d9943d82db95 100644 +--- a/drivers/mmc/core/sd.c ++++ b/drivers/mmc/core/sd.c +@@ -742,8 +742,7 @@ try_again: + */ + if (!mmc_host_is_spi(host) && rocr && + ((*rocr & 0x41000000) == 0x41000000)) { +- err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, +- pocr); ++ err = mmc_set_uhs_voltage(host, pocr); + if (err == -EAGAIN) { + retries--; + goto try_again; +diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c +index c586b11a40b5..f221418542e2 100644 +--- a/drivers/mmc/core/sdio.c ++++ b/drivers/mmc/core/sdio.c +@@ -648,8 +648,7 @@ try_again: + * to make sure which speed mode should work. + */ + if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) { +- err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, +- ocr_card); ++ err = mmc_set_uhs_voltage(host, ocr_card); + if (err == -EAGAIN) { + mmc_sdio_resend_if_cond(host, card); + retries--; + +From 8e6435c0331f574240c316ae2406b5fc5c9e46af Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Wed, 25 Jan 2017 11:12:34 +0100 +Subject: [PATCH] UPSTREAM: mmc: core: Rename __mmc_set_signal_voltage() to + mmc_set_signal_voltage() + +Earlier the mmc_set_signal_voltage() existed, but since it has been renamed +to mmc_set_uhs_voltage(), we can now use that name instead. + +Signed-off-by: Ulf Hansson +Reviewed-by: Shawn Lin +Tested-by: Jan Glauber +Tested-by: Stefan Wahren +(cherry picked from commit 4e74b6b3c6e9adfe6a8fdebfc56a6416a996d905) +--- + drivers/mmc/core/core.c | 10 +++++----- + drivers/mmc/core/core.h | 2 +- + drivers/mmc/core/mmc.c | 16 ++++++++-------- + 3 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 35d19d57d2c5..ba285431c2d0 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1574,7 +1574,7 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) + return ocr; + } + +-int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage) ++int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage) + { + int err = 0; + int old_signal_voltage = host->ios.signal_voltage; +@@ -1636,7 +1636,7 @@ int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr) + host->ios.clock = 0; + mmc_set_ios(host); + +- if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) { ++ if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) { + /* + * Voltages may not have been switched, but we've already + * sent CMD11, so a power cycle is required anyway +@@ -1745,11 +1745,11 @@ void mmc_power_up(struct mmc_host *host, u32 ocr) + mmc_set_initial_state(host); + + /* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */ +- if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330) == 0) ++ if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330)) + dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n"); +- else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0) ++ else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) + dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n"); +- else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120) == 0) ++ else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120)) + dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n"); + + /* +diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h +index 88ef50b2e0be..0e4bc1c7a773 100644 +--- a/drivers/mmc/core/core.h ++++ b/drivers/mmc/core/core.h +@@ -44,7 +44,7 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); + void mmc_set_bus_width(struct mmc_host *host, unsigned int width); + u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); + int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr); +-int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); ++int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); + void mmc_set_timing(struct mmc_host *host, unsigned int timing); + void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); + int mmc_select_drive_strength(struct mmc_card *card, unsigned int max_dtr, +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c +index 70de514dd061..dd0040a10c0b 100644 +--- a/drivers/mmc/core/mmc.c ++++ b/drivers/mmc/core/mmc.c +@@ -1088,14 +1088,14 @@ static int mmc_select_hs_ddr(struct mmc_card *card) + */ + err = -EINVAL; + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); + + if (err && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V)) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); + + /* make sure vccq is 3.3v after switching disaster */ + if (err) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); + + if (!err) + mmc_set_timing(host, MMC_TIMING_MMC_DDR52); +@@ -1260,10 +1260,10 @@ static int mmc_select_hs400es(struct mmc_card *card) + } + + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400_1_2V) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); + + if (err && card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400_1_8V) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); + + /* If fails try again during next card power cycle */ + if (err) +@@ -1362,10 +1362,10 @@ static int mmc_select_hs200(struct mmc_card *card) + + old_signal_voltage = host->ios.signal_voltage; + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_2V) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); + + if (err && card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_8V) +- err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); ++ err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180); + + /* If fails try again during next card power cycle */ + if (err) +@@ -1393,7 +1393,7 @@ static int mmc_select_hs200(struct mmc_card *card) + err: + if (err) { + /* fall back to the old signal voltage, if fails report error */ +- if (__mmc_set_signal_voltage(host, old_signal_voltage)) ++ if (mmc_set_signal_voltage(host, old_signal_voltage)) + err = -EIO; + + pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), + +From 4e08609c259fd79367a83f8907f5e89747007573 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Mon, 25 Sep 2017 11:29:03 +0300 +Subject: [PATCH] UPSTREAM: mmc: core: Factor out mmc_host_set_uhs_voltage() + +Factor out mmc_host_set_uhs_voltage() so it can be reused. + +Signed-off-by: Adrian Hunter +Signed-off-by: Ulf Hansson +(cherry picked from commit 3f496afb6fb361b282f37968ff7d3d80b0f1b5cb) +--- + drivers/mmc/core/core.c | 38 ++++++++++++++++++++++++-------------- + drivers/mmc/core/core.h | 1 + + 2 files changed, 25 insertions(+), 14 deletions(-) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index ba285431c2d0..dae82afcbc99 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1590,11 +1590,33 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage) + + } + ++int mmc_host_set_uhs_voltage(struct mmc_host *host) ++{ ++ u32 clock; ++ ++ /* ++ * During a signal voltage level switch, the clock must be gated ++ * for 5 ms according to the SD spec ++ */ ++ clock = host->ios.clock; ++ host->ios.clock = 0; ++ mmc_set_ios(host); ++ ++ if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) ++ return -EAGAIN; ++ ++ /* Keep clock gated for at least 10 ms, though spec only says 5 ms */ ++ mmc_delay(10); ++ host->ios.clock = clock; ++ mmc_set_ios(host); ++ ++ return 0; ++} ++ + int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr) + { + struct mmc_command cmd = {0}; + int err = 0; +- u32 clock; + + BUG_ON(!host); + +@@ -1628,15 +1650,8 @@ int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr) + err = -EAGAIN; + goto power_cycle; + } +- /* +- * During a signal voltage level switch, the clock must be gated +- * for 5 ms according to the SD spec +- */ +- clock = host->ios.clock; +- host->ios.clock = 0; +- mmc_set_ios(host); + +- if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) { ++ if (mmc_host_set_uhs_voltage(host)) { + /* + * Voltages may not have been switched, but we've already + * sent CMD11, so a power cycle is required anyway +@@ -1645,11 +1660,6 @@ int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr) + goto power_cycle; + } + +- /* Keep clock gated for at least 10 ms, though spec only says 5 ms */ +- mmc_delay(10); +- host->ios.clock = clock; +- mmc_set_ios(host); +- + /* Wait for at least 1 ms according to spec */ + mmc_delay(1); + +diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h +index 0e4bc1c7a773..11f3d2c22ecb 100644 +--- a/drivers/mmc/core/core.h ++++ b/drivers/mmc/core/core.h +@@ -44,6 +44,7 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); + void mmc_set_bus_width(struct mmc_host *host, unsigned int width); + u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); + int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr); ++int mmc_host_set_uhs_voltage(struct mmc_host *host); + int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); + void mmc_set_timing(struct mmc_host *host, unsigned int timing); + void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); + +From f875b30606e15e1b2f30982476a7de2d05682fb6 Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Mon, 25 Sep 2017 11:29:04 +0300 +Subject: [PATCH] UPSTREAM: mmc: sd: Fix signal voltage when there is no power + cycle + +Some boards have SD card connectors where the power rail cannot be switched +off by the driver. However there are various circumstances when a card +might be re-initialized, such as after system resume, warm re-boot, or +error handling. However, a UHS card will continue to use 1.8V signaling +unless it is power cycled. + +If the card has not been power cycled, it may still be using 1.8V +signaling. According to the SD spec., the Bus Speed Mode (function group 1) +bits 2 to 4 are zero if the card is initialized at 3.3V signal level. Thus +they can be used to determine if the card has already switched to 1.8V +signaling. Detect that situation and try to initialize a UHS-I (1.8V) +transfer mode. + +Tested with the following cards: + Transcend 4GB High Speed + Kingston 64GB SDR104 + Lexar by Micron HIGH-PERFORMANCE 300x 16GB DDR50 + SanDisk Ultra 8GB DDR50 + Transcend Ultimate 600x 16GB SDR104 + Transcend Premium 300x 64GB SDR104 + Lexar by Micron Professional 1000x 32GB UHS-II SDR104 + SanDisk Extreme Pro 16GB SDR104 + +Signed-off-by: Adrian Hunter +Tested-by: Zhoujie Wu +Reviewed-by: Shawn Lin +Signed-off-by: Ulf Hansson +(cherry picked from commit 6a11fc47f175c8d87018e89cb58e2d36c66534cb) +--- + drivers/mmc/core/sd.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 45 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c +index d9943d82db95..2808a281d094 100644 +--- a/drivers/mmc/core/sd.c ++++ b/drivers/mmc/core/sd.c +@@ -898,6 +898,18 @@ unsigned mmc_sd_get_max_clock(struct mmc_card *card) + return max_dtr; + } + ++static bool mmc_sd_card_using_v18(struct mmc_card *card) ++{ ++ /* ++ * According to the SD spec., the Bus Speed Mode (function group 1) bits ++ * 2 to 4 are zero if the card is initialized at 3.3V signal level. Thus ++ * they can be used to determine if the card has already switched to ++ * 1.8V signaling. ++ */ ++ return card->sw_caps.sd3_bus_mode & ++ (SD_MODE_UHS_SDR50 | SD_MODE_UHS_SDR104 | SD_MODE_UHS_DDR50); ++} ++ + /* + * Handle the detection and initialisation of a card. + * +@@ -911,10 +923,11 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, + int err; + u32 cid[4]; + u32 rocr = 0; ++ bool v18_fixup_failed = false; + + BUG_ON(!host); + WARN_ON(!host->claimed); +- ++retry: + err = mmc_sd_get_cid(host, ocr, cid, &rocr); + if (err) + return err; +@@ -980,6 +993,36 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, + if (err) + goto free_card; + ++ /* ++ * If the card has not been power cycled, it may still be using 1.8V ++ * signaling. Detect that situation and try to initialize a UHS-I (1.8V) ++ * transfer mode. ++ */ ++ if (!v18_fixup_failed && !mmc_host_is_spi(host) && mmc_host_uhs(host) && ++ mmc_sd_card_using_v18(card) && ++ host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) { ++ /* ++ * Re-read switch information in case it has changed since ++ * oldcard was initialized. ++ */ ++ if (oldcard) { ++ err = mmc_read_switch(card); ++ if (err) ++ goto free_card; ++ } ++ if (mmc_sd_card_using_v18(card)) { ++ if (mmc_host_set_uhs_voltage(host) || ++ mmc_sd_init_uhs_card(card)) { ++ v18_fixup_failed = true; ++ mmc_power_cycle(host, ocr); ++ if (!oldcard) ++ mmc_remove_card(card); ++ goto retry; ++ } ++ goto done; ++ } ++ } ++ + /* Initialization sequence for UHS-I cards */ + if (rocr & SD_ROCR_S18A && mmc_host_uhs(host)) { + err = mmc_sd_init_uhs_card(card); +@@ -1012,7 +1055,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, + mmc_set_bus_width(host, MMC_BUS_WIDTH_4); + } + } +- ++done: + host->card = card; + return 0; + + +From 9cfa1314108ecd9922ae05ff7c80effb21a92b95 Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Thu, 5 Apr 2018 21:24:15 +0200 +Subject: [PATCH] UPSTREAM: mmc: core: Share internal function to set initial + signal voltage + +Move the corresponding code for setting the initial signal voltage, from +mmc_power_up() into a new function, mmc_set_initial_signal_voltage(). + +Make the function internally available to the mmc core, as to allow the +following changes to make use of it. + +Signed-off-by: Ulf Hansson +Tested-by: Quentin Schulz +Reviewed-by: Shawn Lin +(cherry picked from commit 508c9864ccede5dd4b8a7220b3fe6998763e4407) +--- + drivers/mmc/core/core.c | 19 ++++++++++++------- + drivers/mmc/core/core.h | 1 + + 2 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index dae82afcbc99..7aa83beea957 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1590,6 +1590,17 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage) + + } + ++void mmc_set_initial_signal_voltage(struct mmc_host *host) ++{ ++ /* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */ ++ if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330)) ++ dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n"); ++ else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) ++ dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n"); ++ else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120)) ++ dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n"); ++} ++ + int mmc_host_set_uhs_voltage(struct mmc_host *host) + { + u32 clock; +@@ -1754,13 +1765,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr) + /* Set initial state and call mmc_set_ios */ + mmc_set_initial_state(host); + +- /* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */ +- if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330)) +- dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n"); +- else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) +- dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n"); +- else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120)) +- dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n"); ++ mmc_set_initial_signal_voltage(host); + + /* + * This delay should be sufficient to allow the power supply +diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h +index 11f3d2c22ecb..2634722265ad 100644 +--- a/drivers/mmc/core/core.h ++++ b/drivers/mmc/core/core.h +@@ -46,6 +46,7 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); + int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr); + int mmc_host_set_uhs_voltage(struct mmc_host *host); + int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); ++void mmc_set_initial_signal_voltage(struct mmc_host *host); + void mmc_set_timing(struct mmc_host *host, unsigned int timing); + void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); + int mmc_select_drive_strength(struct mmc_card *card, unsigned int max_dtr, + +From 102ef77480a77195821125c6c5afe0b61ac2672c Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 24 Jul 2018 15:50:06 +0200 +Subject: [PATCH] mmc: core: set initial signal voltage on power off + +--- + drivers/mmc/core/core.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 7aa83beea957..d2c59b5e04ab 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1792,6 +1792,14 @@ void mmc_power_off(struct mmc_host *host) + if (host->ios.power_mode == MMC_POWER_OFF) + return; + ++ mmc_set_initial_signal_voltage(host); ++ ++ /* ++ * This delay should be sufficient to allow the power supply ++ * to reach the minimum voltage. ++ */ ++ mmc_delay(10); ++ + mmc_pwrseq_power_off(host); + + host->ios.clock = 0; diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0010-dvb.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0010-dvb.patch new file mode 100644 index 0000000000..b311cb410b --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0010-dvb.patch @@ -0,0 +1,376 @@ +From 77d2716cf5579c4ad74df978ad58d983419cc44b Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Wed, 31 Aug 2016 12:46:44 +0100 +Subject: [PATCH] UPSTREAM: add basic register-field manipulation macros + +Common approach to accessing register fields is to define +structures or sets of macros containing mask and shift pair. +Operations on the register are then performed as follows: + + field = (reg >> shift) & mask; + + reg &= ~(mask << shift); + reg |= (field & mask) << shift; + +Defining shift and mask separately is tedious. Ivo van Doorn +came up with an idea of computing them at compilation time +based on a single shifted mask (later refined by Felix) which +can be used like this: + + #define REG_FIELD 0x000ff000 + + field = FIELD_GET(REG_FIELD, reg); + + reg &= ~REG_FIELD; + reg |= FIELD_PREP(REG_FIELD, field); + +FIELD_{GET,PREP} macros take care of finding out what the +appropriate shift is based on compilation time ffs operation. + +GENMASK can be used to define registers (which is usually +less error-prone and easier to match with datasheets). + +This approach is the most convenient I've seen so to limit code +multiplication let's move the macros to a global header file. +Attempts to use static inlines instead of macros failed due +to false positive triggering of BUILD_BUG_ON()s, especially with +GCC < 6.0. + +Signed-off-by: Jakub Kicinski +Reviewed-by: Dinan Gunawardena +Signed-off-by: Kalle Valo +(cherry picked from commit 3e9b3112ec74f192eaab976c3889e34255cae940) +--- + include/linux/bitfield.h | 93 ++++++++++++++++++++++++++++++++++++++++++++++++ + include/linux/bug.h | 3 ++ + 2 files changed, 96 insertions(+) + create mode 100644 include/linux/bitfield.h + +diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h +new file mode 100644 +index 000000000000..f6505d83069d +--- /dev/null ++++ b/include/linux/bitfield.h +@@ -0,0 +1,93 @@ ++/* ++ * Copyright (C) 2014 Felix Fietkau ++ * Copyright (C) 2004 - 2009 Ivo van Doorn ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 ++ * as published by the Free Software Foundation ++ * ++ * This program 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. ++ */ ++ ++#ifndef _LINUX_BITFIELD_H ++#define _LINUX_BITFIELD_H ++ ++#include ++ ++/* ++ * Bitfield access macros ++ * ++ * FIELD_{GET,PREP} macros take as first parameter shifted mask ++ * from which they extract the base mask and shift amount. ++ * Mask must be a compilation time constant. ++ * ++ * Example: ++ * ++ * #define REG_FIELD_A GENMASK(6, 0) ++ * #define REG_FIELD_B BIT(7) ++ * #define REG_FIELD_C GENMASK(15, 8) ++ * #define REG_FIELD_D GENMASK(31, 16) ++ * ++ * Get: ++ * a = FIELD_GET(REG_FIELD_A, reg); ++ * b = FIELD_GET(REG_FIELD_B, reg); ++ * ++ * Set: ++ * reg = FIELD_PREP(REG_FIELD_A, 1) | ++ * FIELD_PREP(REG_FIELD_B, 0) | ++ * FIELD_PREP(REG_FIELD_C, c) | ++ * FIELD_PREP(REG_FIELD_D, 0x40); ++ * ++ * Modify: ++ * reg &= ~REG_FIELD_C; ++ * reg |= FIELD_PREP(REG_FIELD_C, c); ++ */ ++ ++#define __bf_shf(x) (__builtin_ffsll(x) - 1) ++ ++#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \ ++ ({ \ ++ BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \ ++ _pfx "mask is not constant"); \ ++ BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \ ++ BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \ ++ ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \ ++ _pfx "value too large for the field"); \ ++ BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \ ++ _pfx "type of reg too small for mask"); \ ++ __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \ ++ (1ULL << __bf_shf(_mask))); \ ++ }) ++ ++/** ++ * FIELD_PREP() - prepare a bitfield element ++ * @_mask: shifted mask defining the field's length and position ++ * @_val: value to put in the field ++ * ++ * FIELD_PREP() masks and shifts up the value. The result should ++ * be combined with other fields of the bitfield using logical OR. ++ */ ++#define FIELD_PREP(_mask, _val) \ ++ ({ \ ++ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ ++ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \ ++ }) ++ ++/** ++ * FIELD_GET() - extract a bitfield element ++ * @_mask: shifted mask defining the field's length and position ++ * @_reg: 32bit value of entire bitfield ++ * ++ * FIELD_GET() extracts the field specified by @_mask from the ++ * bitfield passed in as @_reg by masking and shifting it down. ++ */ ++#define FIELD_GET(_mask, _reg) \ ++ ({ \ ++ __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \ ++ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \ ++ }) ++ ++#endif +diff --git a/include/linux/bug.h b/include/linux/bug.h +index 7f4818673c41..edd3d8d3cd90 100644 +--- a/include/linux/bug.h ++++ b/include/linux/bug.h +@@ -13,6 +13,7 @@ enum bug_trap_type { + struct pt_regs; + + #ifdef __CHECKER__ ++#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) + #define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) + #define BUILD_BUG_ON_ZERO(e) (0) + #define BUILD_BUG_ON_NULL(e) ((void*)0) +@@ -23,6 +24,8 @@ struct pt_regs; + #else /* __CHECKER__ */ + + /* Force a compilation error if a constant expression is not a power of 2 */ ++#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ ++ BUILD_BUG_ON(((n) & ((n) - 1)) != 0) + #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ + BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) + + +From 3841d053b087e87d8d3d77738452c3b14d724049 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Thu, 9 Feb 2017 09:17:27 -0800 +Subject: [PATCH] UPSTREAM: bitfield.h: add FIELD_FIT() helper + +Add a helper for checking at runtime that a value will fit inside +a specified field/mask. + +Signed-off-by: Jakub Kicinski +Signed-off-by: David S. Miller +(cherry picked from commit 1697599ee301a52cded6499a09bd609f7f63fd06) +--- + include/linux/bitfield.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h +index f6505d83069d..8b9d6fff002d 100644 +--- a/include/linux/bitfield.h ++++ b/include/linux/bitfield.h +@@ -62,6 +62,19 @@ + (1ULL << __bf_shf(_mask))); \ + }) + ++/** ++ * FIELD_FIT() - check if value fits in the field ++ * @_mask: shifted mask defining the field's length and position ++ * @_val: value to test against the field ++ * ++ * Return: true if @_val can fit inside @_mask, false if @_val is too big. ++ */ ++#define FIELD_FIT(_mask, _val) \ ++ ({ \ ++ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_FIT: "); \ ++ !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \ ++ }) ++ + /** + * FIELD_PREP() - prepare a bitfield element + * @_mask: shifted mask defining the field's length and position + +From b0dcc7c8cc60ef7877baf3639a46344d8b184fc7 Mon Sep 17 00:00:00 2001 +From: Laurent Defert +Date: Wed, 11 Oct 2017 08:46:52 +0200 +Subject: [PATCH] FROMLIST: compat_ioctl: add compat handler for + FE_SET_PROPERTY and FE_GET_PROPERTY + +https://patchwork.linuxtv.org/patch/8209/ +--- + fs/compat_ioctl.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 138 insertions(+) + +diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c +index a52ca5cba015..438ce0c6851e 100644 +--- a/fs/compat_ioctl.c ++++ b/fs/compat_ioctl.c +@@ -223,6 +223,140 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, + return err; + } + ++struct compat_dtv_property { ++ __u32 cmd; ++ __u32 reserved[3]; ++ union { ++ __u32 data; ++ struct { ++ __u8 data[32]; ++ __u32 len; ++ __u32 reserved1[3]; ++ compat_uptr_t reserved2; ++ } buffer; ++ } u; ++ int result; ++}; ++ ++struct compat_dtv_properties { ++ __u32 num; ++ compat_uptr_t props; ++}; ++ ++#define FE_SET_PROPERTY32 _IOW('o', 82, struct compat_dtv_properties) ++#define FE_GET_PROPERTY32 _IOR('o', 83, struct compat_dtv_properties) ++ ++static int do_fe_set_property(unsigned int fd, unsigned int cmd, ++ struct compat_dtv_properties __user *dtv32) ++{ ++ struct dtv_properties __user *dtv; ++ struct dtv_property __user *properties; ++ struct compat_dtv_property __user *properties32; ++ compat_uptr_t data; ++ ++ int err; ++ int i; ++ __u32 num; ++ ++ err = get_user(num, &dtv32->num); ++ err |= get_user(data, &dtv32->props); ++ ++ if(err) ++ return -EFAULT; ++ ++ dtv = compat_alloc_user_space(sizeof(struct dtv_properties) + ++ sizeof(struct dtv_property) * num); ++ properties = (struct dtv_property*)((char*)dtv + ++ sizeof(struct dtv_properties)); ++ ++ err = put_user(properties, &dtv->props); ++ err |= put_user(num, &dtv->num); ++ ++ properties32 = compat_ptr(data); ++ ++ if(err) ++ return -EFAULT; ++ ++ for(i = 0; i < num; i++) { ++ compat_uptr_t reserved2; ++ ++ err |= copy_in_user(&properties[i], &properties32[i], ++ (8 * sizeof(__u32)) + (32 * sizeof(__u8))); ++ err |= get_user(reserved2, &properties32[i].u.buffer.reserved2); ++ err |= put_user(compat_ptr(reserved2), ++ &properties[i].u.buffer.reserved2); ++ } ++ ++ if(err) ++ return -EFAULT; ++ ++ err = sys_ioctl(fd, FE_SET_PROPERTY, (unsigned long) dtv); ++ ++ for(i = 0; i < num; i++) { ++ if(copy_in_user(&properties32[i].result, &properties[i].result, ++ sizeof(int))) ++ return -EFAULT; ++ } ++ ++ return err; ++} ++ ++static int do_fe_get_property(unsigned int fd, unsigned int cmd, ++ struct compat_dtv_properties __user *dtv32) ++{ ++ struct dtv_properties __user *dtv; ++ struct dtv_property __user *properties; ++ struct compat_dtv_property __user *properties32; ++ compat_uptr_t data; ++ ++ int err; ++ int i; ++ __u32 num; ++ ++ err = get_user(num, &dtv32->num); ++ err |= get_user(data, &dtv32->props); ++ ++ if(err) ++ return -EFAULT; ++ ++ dtv = compat_alloc_user_space(sizeof(struct dtv_properties) + ++ sizeof(struct dtv_property) * num); ++ properties = (struct dtv_property*)((char*)dtv + ++ sizeof(struct dtv_properties)); ++ ++ err = put_user(properties, &dtv->props); ++ err |= put_user(num, &dtv->num); ++ ++ properties32 = compat_ptr(data); ++ ++ if(err) ++ return -EFAULT; ++ ++ for(i = 0; i < num; i++) { ++ compat_uptr_t reserved2; ++ ++ err |= copy_in_user(&properties[i], &properties32[i], ++ (8 * sizeof(__u32)) + (32 * sizeof(__u8))); ++ err |= get_user(reserved2, &properties32[i].u.buffer.reserved2); ++ err |= put_user(compat_ptr(reserved2), ++ &properties[i].u.buffer.reserved2); ++ } ++ ++ if(err) ++ return -EFAULT; ++ ++ err = sys_ioctl(fd, FE_GET_PROPERTY, (unsigned long) dtv); ++ ++ for(i = 0; i < num; i++) { ++ ++ if(copy_in_user(&properties32[i], &properties[i], ++ sizeof(properties32[i]))) ++ return -EFAULT; ++ } ++ ++ return err; ++} ++ + #ifdef CONFIG_BLOCK + typedef struct sg_io_hdr32 { + compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ +@@ -1483,6 +1617,10 @@ static long do_ioctl_trans(int fd, unsigned int cmd, + return do_video_stillpicture(fd, cmd, argp); + case VIDEO_SET_SPU_PALETTE: + return do_video_set_spu_palette(fd, cmd, argp); ++ case FE_SET_PROPERTY32: ++ return do_fe_set_property(fd, cmd, argp); ++ case FE_GET_PROPERTY32: ++ return do_fe_get_property(fd, cmd, argp); + } + + /* diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-1000-pl330.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-1000-pl330.patch new file mode 100644 index 0000000000..e55d8cb37a --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-1000-pl330.patch @@ -0,0 +1,2710 @@ +From de1d7ef4900e4083d3eb61a41ef21970cd572a59 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 8 Sep 2018 11:03:36 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: add support for interlace single + xfer" + +This reverts commit 83623425bceb4005151379cc959e41eddd2a0937. +--- + drivers/dma/pl330.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index b14f5c225401..8746c24d3cd7 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1477,12 +1477,6 @@ static inline int _setup_loops(struct pl330_dmac *pl330, + off += _emit_FLUSHP(dry_run, &buf[off], + pxs->desc->peri); + #endif +- if (pxs->desc->rqtype == DMA_DEV_TO_MEM) +- bursts = x->bytes / (BRST_SIZE(ccr) * BRST_LEN(ccr) + +- pxs->desc->dst_interlace_size); +- else if (pxs->desc->rqtype == DMA_MEM_TO_DEV) +- bursts = x->bytes / (BRST_SIZE(ccr) * BRST_LEN(ccr) + +- pxs->desc->src_interlace_size); + while (bursts) { + c = bursts; + off += _loop(pl330, dry_run, &buf[off], &c, pxs); +@@ -1507,9 +1501,7 @@ static inline int _setup_xfer(struct pl330_dmac *pl330, + /* Setup Loop(s) */ + off += _setup_loops(pl330, dry_run, &buf[off], pxs); + +- if (pxs->desc->src_interlace_size == 0 && +- pxs->desc->dst_interlace_size == 0 && +- pl330->peripherals_req_type == BURST) { ++ if (pl330->peripherals_req_type == BURST) { + unsigned int ccr = pxs->ccr; + unsigned long c = 0; + + +From 875fb88fb64f5dc61abb8c4a311de82b68792d0e Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 1 Sep 2018 07:43:58 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: _loop_cyclic: fixup loopcnt is too + large" + +This reverts commit 8ea3f97aab1b68b5aa1aece7eb83bef6d08b3c84. +--- + drivers/dma/pl330.c | 67 +++++++++++++++++------------------------------------ + 1 file changed, 21 insertions(+), 46 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 8746c24d3cd7..5893c11dd858 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1341,14 +1341,19 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], + return off; + } + +-static int _period(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], +- unsigned long bursts, const struct _xfer_spec *pxs, int ev) ++/* Returns bytes consumed */ ++static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run, ++ u8 buf[], unsigned long bursts, const struct _xfer_spec *pxs, int ev) + { +- unsigned int lcnt1, ljmp1; +- int cyc, off = 0; ++ int cyc, off; ++ unsigned lcnt0, lcnt1, ljmp0, ljmp1, ljmpfe; + struct _arg_LPEND lpend; + struct pl330_xfer *x = &pxs->desc->px; + ++ off = 0; ++ ljmpfe = off; ++ lcnt0 = pxs->desc->num_periods; ++ + if (bursts > 256) { + lcnt1 = 256; + cyc = bursts / 256; +@@ -1357,6 +1362,18 @@ static int _period(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], + cyc = 1; + } + ++ /* forever loop */ ++ off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); ++ off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); ++#ifdef CONFIG_ARCH_ROCKCHIP ++ if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) ++ off += _emit_FLUSHP(dry_run, &buf[off], ++ pxs->desc->peri); ++#endif ++ /* loop0 */ ++ off += _emit_LP(dry_run, &buf[off], 0, lcnt0); ++ ljmp0 = off; ++ + /* loop1 */ + off += _emit_LP(dry_run, &buf[off], 1, lcnt1); + ljmp1 = off; +@@ -1407,54 +1424,12 @@ static int _period(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], + + off += _emit_SEV(dry_run, &buf[off], ev); + +- return off; +-} +- +-/* Returns bytes consumed */ +-static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned int dry_run, +- u8 buf[], unsigned long bursts, const struct _xfer_spec *pxs, int ev) +-{ +- int off, periods, residue, i; +- unsigned int lcnt0, ljmp0, ljmpfe; +- struct _arg_LPEND lpend; +- struct pl330_xfer *x = &pxs->desc->px; +- +- off = 0; +- ljmpfe = off; +- lcnt0 = pxs->desc->num_periods; +- periods = 1; +- +- while (lcnt0 > 256) { +- periods++; +- lcnt0 = pxs->desc->num_periods / periods; +- } +- +- residue = pxs->desc->num_periods % periods; +- +- /* forever loop */ +- off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); +- off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); +-#ifdef CONFIG_ARCH_ROCKCHIP +- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) +- off += _emit_FLUSHP(dry_run, &buf[off], +- pxs->desc->peri); +-#endif +- /* loop0 */ +- off += _emit_LP(dry_run, &buf[off], 0, lcnt0); +- ljmp0 = off; +- +- for (i = 0; i < periods; i++) +- off += _period(pl330, dry_run, &buf[off], bursts, pxs, ev); +- + lpend.cond = ALWAYS; + lpend.forever = false; + lpend.loop = 0; + lpend.bjump = off - ljmp0; + off += _emit_LPEND(dry_run, &buf[off], &lpend); + +- for (i = 0; i < residue; i++) +- off += _period(pl330, dry_run, &buf[off], bursts, pxs, ev); +- + lpend.cond = ALWAYS; + lpend.forever = true; + lpend.loop = 1; + +From b773c238a40773bd6f717701324630a917b67567 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 3 Jun 2018 07:36:35 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: add support for interlace cyclic + xfer" + +This reverts commit 191583d95bae59c82b50f7437f2b738fcc5f8015. +--- + drivers/dma/pl330.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 5893c11dd858..b4a0d48bafa4 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1398,9 +1398,7 @@ static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run, + off += _emit_LPEND(dry_run, &buf[off], &lpend); + } + +- if (pxs->desc->src_interlace_size == 0 && +- pxs->desc->dst_interlace_size == 0 && +- pl330->peripherals_req_type == BURST) { ++ if (pl330->peripherals_req_type == BURST) { + unsigned int ccr = pxs->ccr; + unsigned long c = 0; + +@@ -1501,12 +1499,6 @@ static inline int _setup_xfer_cyclic(struct pl330_dmac *pl330, unsigned dry_run, + unsigned long bursts = BYTE_TO_BURST(x->bytes, ccr); + int off = 0; + +- if (pxs->desc->rqtype == DMA_DEV_TO_MEM) +- bursts = x->bytes / (BRST_SIZE(ccr) * BRST_LEN(ccr) +- + pxs->desc->dst_interlace_size); +- else if (pxs->desc->rqtype == DMA_MEM_TO_DEV) +- bursts = x->bytes / (BRST_SIZE(ccr) * BRST_LEN(ccr) +- + pxs->desc->src_interlace_size); + /* Setup Loop(s) */ + off += _loop_cyclic(pl330, dry_run, &buf[off], bursts, pxs, ev); + +@@ -2729,6 +2721,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + struct dma_pl330_desc *desc = NULL; + struct dma_pl330_chan *pch = to_pchan(chan); + struct pl330_dmac *pl330 = pch->dmac; ++ unsigned int size = 0; + dma_addr_t dst; + dma_addr_t src; + +@@ -2754,12 +2747,14 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + desc->rqcfg.dst_inc = 0; + src = dma_addr; + dst = pch->fifo_addr; ++ size = pch->src_interlace_size; + break; + case DMA_DEV_TO_MEM: + desc->rqcfg.src_inc = 0; + desc->rqcfg.dst_inc = 1; + src = pch->fifo_addr; + dst = dma_addr; ++ size = pch->dst_interlace_size; + break; + default: + break; +@@ -2779,8 +2774,16 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + desc->cyclic = true; + desc->num_periods = len / period_len; + desc->txd.flags = flags; ++ + desc->src_interlace_size = pch->src_interlace_size; + desc->dst_interlace_size = pch->dst_interlace_size; ++ /* refine bytes_requested if interlace_size set */ ++ if (size) { ++ size += (pch->burst_len * (1 << pch->burst_sz)); ++ size *= desc->bytes_requested; ++ size /= (pch->burst_len * (1 << pch->burst_sz)); ++ desc->bytes_requested = size; ++ } + return &desc->txd; + } + + +From b933f0eb613228472124849615f5a5e075b8b787 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 3 Jun 2018 07:36:53 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: add support for interlace size + config" + +This reverts commit ddd2e87ad41e2c9e95322a1fb7d8ca65e578aa65. +--- + drivers/dma/pl330.c | 32 -------------------------------- + include/linux/dmaengine.h | 2 -- + 2 files changed, 34 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index b4a0d48bafa4..babaeace0a8a 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -447,10 +447,6 @@ struct dma_pl330_chan { + int burst_len; /* the number of burst */ + dma_addr_t fifo_addr; + +- /* interlace size */ +- unsigned int src_interlace_size; +- unsigned int dst_interlace_size; +- + /* for runtime pm tracking */ + bool active; + }; +@@ -540,9 +536,6 @@ struct dma_pl330_desc { + /* For cyclic capability */ + bool cyclic; + size_t num_periods; +- /* interlace size */ +- unsigned int src_interlace_size; +- unsigned int dst_interlace_size; + }; + + struct _xfer_spec { +@@ -1194,10 +1187,6 @@ static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run, + if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) + off += _emit_FLUSHP(dry_run, &buf[off], + pxs->desc->peri); +- if (pxs->desc->dst_interlace_size) { +- off += _emit_ADDH(dry_run, &buf[off], DST, +- pxs->desc->dst_interlace_size); +- } + } + + return off; +@@ -1228,9 +1217,6 @@ static inline int _ldst_memtodev(struct pl330_dmac *pl330, + if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) + off += _emit_FLUSHP(dry_run, &buf[off], + pxs->desc->peri); +- if (pxs->desc->src_interlace_size) +- off += _emit_ADDH(dry_run, &buf[off], SRC, +- pxs->desc->src_interlace_size); + } + + return off; +@@ -2318,8 +2304,6 @@ static int pl330_config(struct dma_chan *chan, + pch->burst_sz = __ffs(slave_config->dst_addr_width); + if (slave_config->dst_maxburst) + pch->burst_len = slave_config->dst_maxburst; +- if (slave_config->src_interlace_size) +- pch->src_interlace_size = slave_config->src_interlace_size; + } else if (slave_config->direction == DMA_DEV_TO_MEM) { + if (slave_config->src_addr) + pch->fifo_addr = slave_config->src_addr; +@@ -2327,8 +2311,6 @@ static int pl330_config(struct dma_chan *chan, + pch->burst_sz = __ffs(slave_config->src_addr_width); + if (slave_config->src_maxburst) + pch->burst_len = slave_config->src_maxburst; +- if (slave_config->dst_interlace_size) +- pch->dst_interlace_size = slave_config->dst_interlace_size; + } + + return 0; +@@ -2721,7 +2703,6 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + struct dma_pl330_desc *desc = NULL; + struct dma_pl330_chan *pch = to_pchan(chan); + struct pl330_dmac *pl330 = pch->dmac; +- unsigned int size = 0; + dma_addr_t dst; + dma_addr_t src; + +@@ -2747,14 +2728,12 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + desc->rqcfg.dst_inc = 0; + src = dma_addr; + dst = pch->fifo_addr; +- size = pch->src_interlace_size; + break; + case DMA_DEV_TO_MEM: + desc->rqcfg.src_inc = 0; + desc->rqcfg.dst_inc = 1; + src = pch->fifo_addr; + dst = dma_addr; +- size = pch->dst_interlace_size; + break; + default: + break; +@@ -2775,15 +2754,6 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + desc->num_periods = len / period_len; + desc->txd.flags = flags; + +- desc->src_interlace_size = pch->src_interlace_size; +- desc->dst_interlace_size = pch->dst_interlace_size; +- /* refine bytes_requested if interlace_size set */ +- if (size) { +- size += (pch->burst_len * (1 << pch->burst_sz)); +- size *= desc->bytes_requested; +- size /= (pch->burst_len * (1 << pch->burst_sz)); +- desc->bytes_requested = size; +- } + return &desc->txd; + } + +@@ -2920,8 +2890,6 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, + + desc->rqtype = direction; + desc->bytes_requested = sg_dma_len(sg); +- desc->src_interlace_size = pch->src_interlace_size; +- desc->dst_interlace_size = pch->dst_interlace_size; + } + + /* Return the last desc in the chain */ +diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h +index 3050f88daf9e..948c17e409e9 100644 +--- a/include/linux/dmaengine.h ++++ b/include/linux/dmaengine.h +@@ -365,8 +365,6 @@ struct dma_slave_config { + u32 dst_maxburst; + bool device_fc; + unsigned int slave_id; +- unsigned int src_interlace_size; +- unsigned int dst_interlace_size; + }; + + /** + +From 90870281a7399dffb49ff4d631ee9df249c3d0c0 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 4 Feb 2018 10:47:28 +0100 +Subject: [PATCH] Revert "dmaengine: pl330: fix bug that chan descdone is null" + +This reverts commit 636c30b38ae6ec499735ce7621ba474944b4e9b7. +--- + drivers/dma/pl330.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index babaeace0a8a..6e375d7ec09c 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1789,17 +1789,16 @@ static int pl330_update(struct pl330_dmac *pl330) + + /* Detach the req */ + descdone = thrd->req[active].desc; +- if (descdone) { +- if (!descdone->cyclic) { +- thrd->req[active].desc = NULL; +- thrd->req_running = -1; +- /* Get going again ASAP */ +- _start(thrd); +- } + +- /* For now, just make a list of callbacks to be done */ +- list_add_tail(&descdone->rqd, &pl330->req_done); ++ if (!descdone->cyclic) { ++ thrd->req[active].desc = NULL; ++ thrd->req_running = -1; ++ /* Get going again ASAP */ ++ _start(thrd); + } ++ ++ /* For now, just make a list of callbacks to be done */ ++ list_add_tail(&descdone->rqd, &pl330->req_done); + } + } + + +From ca7c03b12f7c113e9f722a02c7acebabb2cccc27 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 4 Feb 2018 10:47:38 +0100 +Subject: [PATCH] Revert "dmaengine: pl330: flush before first loop" + +This reverts commit 34be2cf4679cadbf910de9651d54b46930166446. +--- + drivers/dma/pl330.c | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 6e375d7ec09c..9664f71dbab2 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1351,11 +1351,7 @@ static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run, + /* forever loop */ + off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); + off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); +-#ifdef CONFIG_ARCH_ROCKCHIP +- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) +- off += _emit_FLUSHP(dry_run, &buf[off], +- pxs->desc->peri); +-#endif ++ + /* loop0 */ + off += _emit_LP(dry_run, &buf[off], 0, lcnt0); + ljmp0 = off; +@@ -1431,11 +1427,7 @@ static inline int _setup_loops(struct pl330_dmac *pl330, + u32 ccr = pxs->ccr; + unsigned long c, bursts = BYTE_TO_BURST(x->bytes, ccr); + int off = 0; +-#ifdef CONFIG_ARCH_ROCKCHIP +- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) +- off += _emit_FLUSHP(dry_run, &buf[off], +- pxs->desc->peri); +-#endif ++ + while (bursts) { + c = bursts; + off += _loop(pl330, dry_run, &buf[off], &c, pxs); + +From 7e5d6f86b631c40624eb595910c23e7972783347 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 4 Feb 2018 10:47:51 +0100 +Subject: [PATCH] Revert "dmaengine: pl330: fix 2 bursts transfer when dma + flushes" + +This reverts commit 98753e172dc1d06cf4d61c48f5c3487df0247472. +--- + drivers/dma/pl330.c | 20 -------------------- + 1 file changed, 20 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 9664f71dbab2..9c3699ad2245 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1173,16 +1173,6 @@ static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run, + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); + off += _emit_LDP(dry_run, &buf[off], cond, pxs->desc->peri); + off += _emit_ST(dry_run, &buf[off], ALWAYS); +-#ifdef CONFIG_ARCH_ROCKCHIP +- /* +- * Make suree dma has finish transmission, or later flush may +- * cause dma second transmission,and fifo is overrun. +- */ +- off += _emit_WMB(dry_run, &buf[off]); +- off += _emit_NOP(dry_run, &buf[off]); +- off += _emit_WMB(dry_run, &buf[off]); +- off += _emit_NOP(dry_run, &buf[off]); +-#endif + + if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) + off += _emit_FLUSHP(dry_run, &buf[off], +@@ -1203,16 +1193,6 @@ static inline int _ldst_memtodev(struct pl330_dmac *pl330, + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); + off += _emit_LD(dry_run, &buf[off], ALWAYS); + off += _emit_STP(dry_run, &buf[off], cond, pxs->desc->peri); +-#ifdef CONFIG_ARCH_ROCKCHIP +- /* +- * Make suree dma has finish transmission, or later flush may +- * cause dma second transmission,and fifo is overrun. +- */ +- off += _emit_WMB(dry_run, &buf[off]); +- off += _emit_NOP(dry_run, &buf[off]); +- off += _emit_WMB(dry_run, &buf[off]); +- off += _emit_NOP(dry_run, &buf[off]); +-#endif + + if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) + off += _emit_FLUSHP(dry_run, &buf[off], + +From 846d1829607d8806fd932fa3f8f4f0eb9e71d241 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 21 Oct 2017 19:49:27 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: _loop_cyclic fix cycles of last + loop" + +This reverts commit d7155171cbc65e45b5b0c8db03fd16fa57a181f2. +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 9c3699ad2245..be4ea6e089ae 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1370,7 +1370,7 @@ static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run, + ccr &= ~(0xf << CC_SRCBRSTLEN_SHFT); + ccr &= ~(0xf << CC_DSTBRSTLEN_SHFT); + off += _emit_MOV(dry_run, &buf[off], CCR, ccr); +- off += _emit_LP(dry_run, &buf[off], 1, c); ++ off += _emit_LP(dry_run, &buf[off], 1, c - 1); + ljmp1 = off; + off += _bursts(pl330, dry_run, &buf[off], pxs, 1); + lpend.cond = ALWAYS; + +From f7fdbad73413294e56e632fa8353765b8e205582 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 4 Feb 2018 11:05:44 +0100 +Subject: [PATCH] Revert "dmaengine: pl330: pl330_tasklet init power_down by + pch->active" + +This reverts commit 796b13f24a158f14d540bcf7316d843f72242c0d. +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index be4ea6e089ae..2ba795d599fb 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2169,7 +2169,7 @@ static void pl330_tasklet(unsigned long data) + spin_lock(&pch->thread->dmac->lock); + _stop(pch->thread); + spin_unlock(&pch->thread->dmac->lock); +- power_down = pch->active; ++ power_down = true; + pch->active = false; + } else { + /* Make sure the PL330 Channel thread is active */ + +From 07a5172605729425390855a0b6ced66bfde22ee5 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 16 Jun 2017 23:14:54 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: _loop_cyclic supports unaligned + size" + +This reverts commit 13dbe2cccd5851540af8158b12499c33801b6ef6. +--- + drivers/dma/pl330.c | 38 ++++++++++---------------------------- + 1 file changed, 10 insertions(+), 28 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 2ba795d599fb..e5b3893d441e 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1360,28 +1360,6 @@ static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run, + off += _emit_LPEND(dry_run, &buf[off], &lpend); + } + +- if (pl330->peripherals_req_type == BURST) { +- unsigned int ccr = pxs->ccr; +- unsigned long c = 0; +- +- c = BYTE_MOD_BURST_LEN(x->bytes, pxs->ccr); +- +- if (c) { +- ccr &= ~(0xf << CC_SRCBRSTLEN_SHFT); +- ccr &= ~(0xf << CC_DSTBRSTLEN_SHFT); +- off += _emit_MOV(dry_run, &buf[off], CCR, ccr); +- off += _emit_LP(dry_run, &buf[off], 1, c - 1); +- ljmp1 = off; +- off += _bursts(pl330, dry_run, &buf[off], pxs, 1); +- lpend.cond = ALWAYS; +- lpend.forever = false; +- lpend.loop = 1; +- lpend.bjump = off - ljmp1; +- off += _emit_LPEND(dry_run, &buf[off], &lpend); +- off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr); +- } +- } +- + off += _emit_SEV(dry_run, &buf[off], ev); + + lpend.cond = ALWAYS; +@@ -1483,13 +1461,13 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + + x = &pxs->desc->px; + +- if (pl330->peripherals_req_type != BURST) { +- /* Error if xfer length is not aligned at burst size */ +- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) +- return -EINVAL; +- } +- + if (!pxs->desc->cyclic) { ++ if (pl330->peripherals_req_type != BURST) { ++ /* Error if xfer length is not aligned at burst size */ ++ if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) ++ return -EINVAL; ++ } ++ + off += _setup_xfer(pl330, dry_run, &buf[off], pxs); + + /* DMASEV peripheral/event */ +@@ -1497,6 +1475,10 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + /* DMAEND */ + off += _emit_END(dry_run, &buf[off]); + } else { ++ /* Error if xfer length is not aligned at burst size */ ++ if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) ++ return -EINVAL; ++ + off += _setup_xfer_cyclic(pl330, dry_run, &buf[off], + pxs, thrd->ev); + } + +From 5083d82f6622749e07174fe6da32e431068b59cb Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 16 Jun 2017 23:14:54 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: redefine the cyclic transfer" + +This reverts commit 5f638786e66089344c9cf594b81fbf02cd794f15. +--- + drivers/dma/pl330.c | 137 +++++++++++----------------------------------------- + 1 file changed, 29 insertions(+), 108 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index e5b3893d441e..38c46f4e0408 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1307,76 +1307,6 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], + return off; + } + +-/* Returns bytes consumed */ +-static inline int _loop_cyclic(struct pl330_dmac *pl330, unsigned dry_run, +- u8 buf[], unsigned long bursts, const struct _xfer_spec *pxs, int ev) +-{ +- int cyc, off; +- unsigned lcnt0, lcnt1, ljmp0, ljmp1, ljmpfe; +- struct _arg_LPEND lpend; +- struct pl330_xfer *x = &pxs->desc->px; +- +- off = 0; +- ljmpfe = off; +- lcnt0 = pxs->desc->num_periods; +- +- if (bursts > 256) { +- lcnt1 = 256; +- cyc = bursts / 256; +- } else { +- lcnt1 = bursts; +- cyc = 1; +- } +- +- /* forever loop */ +- off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); +- off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); +- +- /* loop0 */ +- off += _emit_LP(dry_run, &buf[off], 0, lcnt0); +- ljmp0 = off; +- +- /* loop1 */ +- off += _emit_LP(dry_run, &buf[off], 1, lcnt1); +- ljmp1 = off; +- off += _bursts(pl330, dry_run, &buf[off], pxs, cyc); +- lpend.cond = ALWAYS; +- lpend.forever = false; +- lpend.loop = 1; +- lpend.bjump = off - ljmp1; +- off += _emit_LPEND(dry_run, &buf[off], &lpend); +- +- /* remainder */ +- lcnt1 = bursts - (lcnt1 * cyc); +- +- if (lcnt1) { +- off += _emit_LP(dry_run, &buf[off], 1, lcnt1); +- ljmp1 = off; +- off += _bursts(pl330, dry_run, &buf[off], pxs, 1); +- lpend.cond = ALWAYS; +- lpend.forever = false; +- lpend.loop = 1; +- lpend.bjump = off - ljmp1; +- off += _emit_LPEND(dry_run, &buf[off], &lpend); +- } +- +- off += _emit_SEV(dry_run, &buf[off], ev); +- +- lpend.cond = ALWAYS; +- lpend.forever = false; +- lpend.loop = 0; +- lpend.bjump = off - ljmp0; +- off += _emit_LPEND(dry_run, &buf[off], &lpend); +- +- lpend.cond = ALWAYS; +- lpend.forever = true; +- lpend.loop = 1; +- lpend.bjump = off - ljmpfe; +- off += _emit_LPEND(dry_run, &buf[off], &lpend); +- +- return off; +-} +- + static inline int _setup_loops(struct pl330_dmac *pl330, + unsigned dry_run, u8 buf[], + const struct _xfer_spec *pxs) +@@ -1396,16 +1326,19 @@ static inline int _setup_loops(struct pl330_dmac *pl330, + } + + static inline int _setup_xfer(struct pl330_dmac *pl330, +- unsigned dry_run, u8 buf[], ++ unsigned dry_run, u8 buf[], u32 period, + const struct _xfer_spec *pxs) + { + struct pl330_xfer *x = &pxs->desc->px; ++ struct pl330_reqcfg *rqcfg = &pxs->desc->rqcfg; + int off = 0; + + /* DMAMOV SAR, x->src_addr */ +- off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); ++ off += _emit_MOV(dry_run, &buf[off], SAR, ++ x->src_addr + rqcfg->src_inc * period * x->bytes); + /* DMAMOV DAR, x->dst_addr */ +- off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); ++ off += _emit_MOV(dry_run, &buf[off], DAR, ++ x->dst_addr + rqcfg->dst_inc * period * x->bytes); + + /* Setup Loop(s) */ + off += _setup_loops(pl330, dry_run, &buf[off], pxs); +@@ -1427,20 +1360,6 @@ static inline int _setup_xfer(struct pl330_dmac *pl330, + return off; + } + +-static inline int _setup_xfer_cyclic(struct pl330_dmac *pl330, unsigned dry_run, +- u8 buf[], const struct _xfer_spec *pxs, int ev) +-{ +- struct pl330_xfer *x = &pxs->desc->px; +- u32 ccr = pxs->ccr; +- unsigned long bursts = BYTE_TO_BURST(x->bytes, ccr); +- int off = 0; +- +- /* Setup Loop(s) */ +- off += _loop_cyclic(pl330, dry_run, &buf[off], bursts, pxs, ev); +- +- return off; +-} +- + /* + * A req is a sequence of one or more xfer units. + * Returns the number of bytes taken to setup the MC for the req. +@@ -1453,34 +1372,42 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + struct pl330_xfer *x; + u8 *buf = req->mc_cpu; + int off = 0; ++ int period; ++ int again_off; + + PL330_DBGMC_START(req->mc_bus); + + /* DMAMOV CCR, ccr */ + off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr); ++ again_off = off; + + x = &pxs->desc->px; ++ if (pl330->peripherals_req_type != BURST) { ++ /* Error if xfer length is not aligned at burst size */ ++ if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) ++ return -EINVAL; ++ } + +- if (!pxs->desc->cyclic) { +- if (pl330->peripherals_req_type != BURST) { +- /* Error if xfer length is not aligned at burst size */ +- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) +- return -EINVAL; +- } +- +- off += _setup_xfer(pl330, dry_run, &buf[off], pxs); ++ for (period = 0; period < pxs->desc->num_periods; period++) { ++ off += _setup_xfer(pl330, dry_run, &buf[off], period, pxs); + + /* DMASEV peripheral/event */ + off += _emit_SEV(dry_run, &buf[off], thrd->ev); ++ } ++ ++ if (!pxs->desc->cyclic) { + /* DMAEND */ + off += _emit_END(dry_run, &buf[off]); + } else { +- /* Error if xfer length is not aligned at burst size */ +- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) +- return -EINVAL; +- +- off += _setup_xfer_cyclic(pl330, dry_run, &buf[off], +- pxs, thrd->ev); ++ struct _arg_LPEND lpend; ++ /* LP */ ++ off += _emit_LP(dry_run, &buf[off], 0, 255); ++ /* LPEND */ ++ lpend.cond = ALWAYS; ++ lpend.forever = false; ++ lpend.loop = 0; ++ lpend.bjump = off - again_off; ++ off += _emit_LPEND(dry_run, &buf[off], &lpend); + } + + return off; +@@ -2655,7 +2582,6 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + { + struct dma_pl330_desc *desc = NULL; + struct dma_pl330_chan *pch = to_pchan(chan); +- struct pl330_dmac *pl330 = pch->dmac; + dma_addr_t dst; + dma_addr_t src; + +@@ -2694,12 +2620,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + + desc->rqtype = direction; + desc->rqcfg.brst_size = pch->burst_sz; +- +- if (pl330->peripherals_req_type == BURST) +- desc->rqcfg.brst_len = pch->burst_len; +- else +- desc->rqcfg.brst_len = 1; +- ++ desc->rqcfg.brst_len = pch->burst_len; + desc->bytes_requested = len; + fill_px(&desc->px, dst, src, period_len); + + +From e8a5eaffda3179b78b9d1bb619ddf25dd651d134 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 16 Jun 2017 23:14:54 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: make transfer run infinitely + without CPU intervention" + +This reverts commit e8a6e5086cb82d59cae6ae029b1eb4432cc62288. +--- + drivers/dma/pl330.c | 199 +++++++++++++++++++++++++++------------------------- + 1 file changed, 105 insertions(+), 94 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 38c46f4e0408..ad9d616551f8 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -447,6 +447,9 @@ struct dma_pl330_chan { + int burst_len; /* the number of burst */ + dma_addr_t fifo_addr; + ++ /* for cyclic capability */ ++ bool cyclic; ++ + /* for runtime pm tracking */ + bool active; + }; +@@ -532,10 +535,6 @@ struct dma_pl330_desc { + unsigned peri:5; + /* Hook to attach to DMAC's list of reqs with due callback */ + struct list_head rqd; +- +- /* For cyclic capability */ +- bool cyclic; +- size_t num_periods; + }; + + struct _xfer_spec { +@@ -1326,19 +1325,16 @@ static inline int _setup_loops(struct pl330_dmac *pl330, + } + + static inline int _setup_xfer(struct pl330_dmac *pl330, +- unsigned dry_run, u8 buf[], u32 period, ++ unsigned dry_run, u8 buf[], + const struct _xfer_spec *pxs) + { + struct pl330_xfer *x = &pxs->desc->px; +- struct pl330_reqcfg *rqcfg = &pxs->desc->rqcfg; + int off = 0; + + /* DMAMOV SAR, x->src_addr */ +- off += _emit_MOV(dry_run, &buf[off], SAR, +- x->src_addr + rqcfg->src_inc * period * x->bytes); ++ off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); + /* DMAMOV DAR, x->dst_addr */ +- off += _emit_MOV(dry_run, &buf[off], DAR, +- x->dst_addr + rqcfg->dst_inc * period * x->bytes); ++ off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); + + /* Setup Loop(s) */ + off += _setup_loops(pl330, dry_run, &buf[off], pxs); +@@ -1372,14 +1368,11 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + struct pl330_xfer *x; + u8 *buf = req->mc_cpu; + int off = 0; +- int period; +- int again_off; + + PL330_DBGMC_START(req->mc_bus); + + /* DMAMOV CCR, ccr */ + off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr); +- again_off = off; + + x = &pxs->desc->px; + if (pl330->peripherals_req_type != BURST) { +@@ -1388,27 +1381,12 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + return -EINVAL; + } + +- for (period = 0; period < pxs->desc->num_periods; period++) { +- off += _setup_xfer(pl330, dry_run, &buf[off], period, pxs); +- +- /* DMASEV peripheral/event */ +- off += _emit_SEV(dry_run, &buf[off], thrd->ev); +- } ++ off += _setup_xfer(pl330, dry_run, &buf[off], pxs); + +- if (!pxs->desc->cyclic) { +- /* DMAEND */ +- off += _emit_END(dry_run, &buf[off]); +- } else { +- struct _arg_LPEND lpend; +- /* LP */ +- off += _emit_LP(dry_run, &buf[off], 0, 255); +- /* LPEND */ +- lpend.cond = ALWAYS; +- lpend.forever = false; +- lpend.loop = 0; +- lpend.bjump = off - again_off; +- off += _emit_LPEND(dry_run, &buf[off], &lpend); +- } ++ /* DMASEV peripheral/event */ ++ off += _emit_SEV(dry_run, &buf[off], thrd->ev); ++ /* DMAEND */ ++ off += _emit_END(dry_run, &buf[off]); + + return off; + } +@@ -1670,13 +1648,12 @@ static int pl330_update(struct pl330_dmac *pl330) + + /* Detach the req */ + descdone = thrd->req[active].desc; ++ thrd->req[active].desc = NULL; + +- if (!descdone->cyclic) { +- thrd->req[active].desc = NULL; +- thrd->req_running = -1; +- /* Get going again ASAP */ +- _start(thrd); +- } ++ thrd->req_running = -1; ++ ++ /* Get going again ASAP */ ++ _start(thrd); + + /* For now, just make a list of callbacks to be done */ + list_add_tail(&descdone->rqd, &pl330->req_done); +@@ -2049,27 +2026,12 @@ static void pl330_tasklet(unsigned long data) + spin_lock_irqsave(&pch->lock, flags); + + /* Pick up ripe tomatoes */ +- list_for_each_entry_safe(desc, _dt, &pch->work_list, node) { ++ list_for_each_entry_safe(desc, _dt, &pch->work_list, node) + if (desc->status == DONE) { +- if (!desc->cyclic) { ++ if (!pch->cyclic) + dma_cookie_complete(&desc->txd); +- list_move_tail(&desc->node, &pch->completed_list); +- } else { +- dma_async_tx_callback callback; +- void *callback_param; +- +- desc->status = BUSY; +- callback = desc->txd.callback; +- callback_param = desc->txd.callback_param; +- +- if (callback) { +- spin_unlock_irqrestore(&pch->lock, flags); +- callback(callback_param); +- spin_lock_irqsave(&pch->lock, flags); +- } +- } ++ list_move_tail(&desc->node, &pch->completed_list); + } +- } + + /* Try to submit a req imm. next to the last completed cookie */ + fill_queue(pch); +@@ -2097,8 +2059,20 @@ static void pl330_tasklet(unsigned long data) + callback = desc->txd.callback; + callback_param = desc->txd.callback_param; + +- desc->status = FREE; +- list_move_tail(&desc->node, &pch->dmac->desc_pool); ++ if (pch->cyclic) { ++ desc->status = PREP; ++ list_move_tail(&desc->node, &pch->work_list); ++ if (power_down) { ++ pch->active = true; ++ spin_lock(&pch->thread->dmac->lock); ++ _start(pch->thread); ++ spin_unlock(&pch->thread->dmac->lock); ++ power_down = false; ++ } ++ } else { ++ desc->status = FREE; ++ list_move_tail(&desc->node, &pch->dmac->desc_pool); ++ } + + dma_descriptor_unmap(&desc->txd); + +@@ -2158,6 +2132,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) + spin_lock_irqsave(&pl330->lock, flags); + + dma_cookie_init(chan); ++ pch->cyclic = false; + + pch->thread = pl330_request_channel(pl330); + if (!pch->thread) { +@@ -2281,7 +2256,8 @@ static void pl330_free_chan_resources(struct dma_chan *chan) + pl330_release_channel(pch->thread); + pch->thread = NULL; + +- list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool); ++ if (pch->cyclic) ++ list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool); + + spin_unlock_irqrestore(&pl330->lock, flags); + pm_runtime_mark_last_busy(pch->dmac->ddma.dev); +@@ -2335,7 +2311,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + + /* Check in pending list */ + list_for_each_entry(desc, &pch->work_list, node) { +- if (desc->status == DONE && !desc->cyclic) ++ if (desc->status == DONE) + transferred = desc->bytes_requested; + else if (running && desc == running) + transferred = +@@ -2407,8 +2383,12 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) + /* Assign cookies to all nodes */ + while (!list_empty(&last->node)) { + desc = list_entry(last->node.next, struct dma_pl330_desc, node); +- ++ if (pch->cyclic) { ++ desc->txd.callback = last->txd.callback; ++ desc->txd.callback_param = last->txd.callback_param; ++ } + desc->last = false; ++ + dma_cookie_assign(&desc->txd); + + list_move_tail(&desc->node, &pch->submitted_list); +@@ -2508,9 +2488,6 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch) + desc->peri = peri_id ? pch->chan.chan_id : 0; + desc->rqcfg.pcfg = &pch->dmac->pcfg; + +- desc->cyclic = false; +- desc->num_periods = 1; +- + dma_async_tx_descriptor_init(&desc->txd, &pch->chan); + + return desc; +@@ -2580,8 +2557,10 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + size_t period_len, enum dma_transfer_direction direction, + unsigned long flags) + { +- struct dma_pl330_desc *desc = NULL; ++ struct dma_pl330_desc *desc = NULL, *first = NULL; + struct dma_pl330_chan *pch = to_pchan(chan); ++ struct pl330_dmac *pl330 = pch->dmac; ++ unsigned int i; + dma_addr_t dst; + dma_addr_t src; + +@@ -2594,38 +2573,70 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + return NULL; + } + +- desc = pl330_get_desc(pch); +- if (!desc) { +- dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n", +- __func__, __LINE__); +- return NULL; +- } ++ for (i = 0; i < len / period_len; i++) { ++ desc = pl330_get_desc(pch); ++ if (!desc) { ++ dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n", ++ __func__, __LINE__); + +- switch (direction) { +- case DMA_MEM_TO_DEV: +- desc->rqcfg.src_inc = 1; +- desc->rqcfg.dst_inc = 0; +- src = dma_addr; +- dst = pch->fifo_addr; +- break; +- case DMA_DEV_TO_MEM: +- desc->rqcfg.src_inc = 0; +- desc->rqcfg.dst_inc = 1; +- src = pch->fifo_addr; +- dst = dma_addr; +- break; +- default: +- break; ++ if (!first) ++ return NULL; ++ ++ spin_lock_irqsave(&pl330->pool_lock, flags); ++ ++ while (!list_empty(&first->node)) { ++ desc = list_entry(first->node.next, ++ struct dma_pl330_desc, node); ++ list_move_tail(&desc->node, &pl330->desc_pool); ++ } ++ ++ list_move_tail(&first->node, &pl330->desc_pool); ++ ++ spin_unlock_irqrestore(&pl330->pool_lock, flags); ++ ++ return NULL; ++ } ++ ++ switch (direction) { ++ case DMA_MEM_TO_DEV: ++ desc->rqcfg.src_inc = 1; ++ desc->rqcfg.dst_inc = 0; ++ src = dma_addr; ++ dst = pch->fifo_addr; ++ break; ++ case DMA_DEV_TO_MEM: ++ desc->rqcfg.src_inc = 0; ++ desc->rqcfg.dst_inc = 1; ++ src = pch->fifo_addr; ++ dst = dma_addr; ++ break; ++ default: ++ break; ++ } ++ ++ desc->rqtype = direction; ++ desc->rqcfg.brst_size = pch->burst_sz; ++ ++ if (pl330->peripherals_req_type == BURST) ++ desc->rqcfg.brst_len = pch->burst_len; ++ else ++ desc->rqcfg.brst_len = 1; ++ ++ desc->bytes_requested = period_len; ++ fill_px(&desc->px, dst, src, period_len); ++ ++ if (!first) ++ first = desc; ++ else ++ list_add_tail(&desc->node, &first->node); ++ ++ dma_addr += period_len; + } + +- desc->rqtype = direction; +- desc->rqcfg.brst_size = pch->burst_sz; +- desc->rqcfg.brst_len = pch->burst_len; +- desc->bytes_requested = len; +- fill_px(&desc->px, dst, src, period_len); ++ if (!desc) ++ return NULL; + +- desc->cyclic = true; +- desc->num_periods = len / period_len; ++ pch->cyclic = true; + desc->txd.flags = flags; + + return &desc->txd; + +From 0cb8495a963957245b2196e34e404472445a9d3a Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 22 Jul 2018 16:07:46 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: fix error message to + dev_err_ratelimited" + +This reverts commit e25503f147cf665b6fc910983859d9f94eaf0d00. +--- + drivers/dma/pl330.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index ad9d616551f8..3d5d91084605 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1620,8 +1620,8 @@ static int pl330_update(struct pl330_dmac *pl330) + if (pl330->pcfg.num_events < 32 + && val & ~((1 << pl330->pcfg.num_events) - 1)) { + pl330->dmac_tbd.reset_dmac = true; +- dev_err_ratelimited(pl330->ddma.dev, "%s:%d Unexpected!\n", +- __func__, __LINE__); ++ dev_err(pl330->ddma.dev, "%s:%d Unexpected!\n", __func__, ++ __LINE__); + ret = 1; + goto updt_exit; + } + +From c32a7b1b9bac8450d9c0ff71b2256714ab32e5c3 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 16 Jun 2017 23:14:55 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: support transfer that doesn't align + with (burst len * burst size)" + +This reverts commit c66ecf19b98ffac86177c29859e683de39f44e73. +--- + drivers/dma/pl330.c | 23 +++-------------------- + 1 file changed, 3 insertions(+), 20 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 3d5d91084605..2f5f8d40147c 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -240,7 +240,6 @@ enum pl330_byteswap { + + #define BYTE_TO_BURST(b, ccr) ((b) / BRST_SIZE(ccr) / BRST_LEN(ccr)) + #define BURST_TO_BYTE(c, ccr) ((c) * BRST_SIZE(ccr) * BRST_LEN(ccr)) +-#define BYTE_MOD_BURST_LEN(b, ccr) (((b) / BRST_SIZE(ccr)) % BRST_LEN(ccr)) + + /* + * With 256 bytes, we can do more than 2.5MB and 5MB xfers per req +@@ -1339,20 +1338,6 @@ static inline int _setup_xfer(struct pl330_dmac *pl330, + /* Setup Loop(s) */ + off += _setup_loops(pl330, dry_run, &buf[off], pxs); + +- if (pl330->peripherals_req_type == BURST) { +- unsigned int ccr = pxs->ccr; +- unsigned long c = 0; +- +- c = BYTE_MOD_BURST_LEN(x->bytes, pxs->ccr); +- +- if (c) { +- ccr &= ~(0xf << CC_SRCBRSTLEN_SHFT); +- ccr &= ~(0xf << CC_DSTBRSTLEN_SHFT); +- off += _emit_MOV(dry_run, &buf[off], CCR, ccr); +- off += _loop(pl330, dry_run, &buf[off], &c, pxs); +- } +- } +- + return off; + } + +@@ -1375,11 +1360,9 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr); + + x = &pxs->desc->px; +- if (pl330->peripherals_req_type != BURST) { +- /* Error if xfer length is not aligned at burst size */ +- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) +- return -EINVAL; +- } ++ /* Error if xfer length is not aligned at burst size */ ++ if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) ++ return -EINVAL; + + off += _setup_xfer(pl330, dry_run, &buf[off], pxs); + + +From 8a5c2aac1f170e5d8a8cdce3ab147cf641e38981 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 16 Jun 2017 23:14:55 +0200 +Subject: [PATCH] Revert "dmaengine: pl330: add burst mode according to dts + config" + +This reverts commit 8e770f371cc27f8828cb9ceb0516adc23fe75995. +--- + drivers/dma/pl330.c | 36 ++++++++++++++---------------------- + 1 file changed, 14 insertions(+), 22 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 2f5f8d40147c..f7977979cbf5 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -494,8 +494,6 @@ struct pl330_dmac { + /* Peripheral channels connected to this DMAC */ + unsigned int num_peripherals; + struct dma_pl330_chan *peripherals; /* keep at end */ +- /* set peripherals request type according to soc config*/ +- enum pl330_cond peripherals_req_type; + int quirks; + }; + +@@ -1165,7 +1163,12 @@ static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run, + int cyc) + { + int off = 0; +- enum pl330_cond cond = pl330->peripherals_req_type; ++ enum pl330_cond cond; ++ ++ if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ++ cond = BURST; ++ else ++ cond = SINGLE; + + while (cyc--) { + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); +@@ -1185,7 +1188,12 @@ static inline int _ldst_memtodev(struct pl330_dmac *pl330, + const struct _xfer_spec *pxs, int cyc) + { + int off = 0; +- enum pl330_cond cond = pl330->peripherals_req_type; ++ enum pl330_cond cond; ++ ++ if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ++ cond = BURST; ++ else ++ cond = SINGLE; + + while (cyc--) { + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); +@@ -2599,12 +2607,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + + desc->rqtype = direction; + desc->rqcfg.brst_size = pch->burst_sz; +- +- if (pl330->peripherals_req_type == BURST) +- desc->rqcfg.brst_len = pch->burst_len; +- else +- desc->rqcfg.brst_len = 1; +- ++ desc->rqcfg.brst_len = 1; + desc->bytes_requested = period_len; + fill_px(&desc->px, dst, src, period_len); + +@@ -2706,7 +2709,6 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, + { + struct dma_pl330_desc *first, *desc = NULL; + struct dma_pl330_chan *pch = to_pchan(chan); +- struct pl330_dmac *pl330 = pch->dmac; + struct scatterlist *sg; + int i; + dma_addr_t addr; +@@ -2750,12 +2752,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, + } + + desc->rqcfg.brst_size = pch->burst_sz; +- +- if (pl330->peripherals_req_type == BURST) +- desc->rqcfg.brst_len = pch->burst_len; +- else +- desc->rqcfg.brst_len = 1; +- ++ desc->rqcfg.brst_len = 1; + desc->rqtype = direction; + desc->bytes_requested = sg_dma_len(sg); + } +@@ -2851,11 +2848,6 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + + pl330->mcbufsz = pdat ? pdat->mcbuf_sz : 0; + +- if (of_find_property(np, "peripherals-req-type-burst", NULL)) +- pl330->peripherals_req_type = BURST; +- else +- pl330->peripherals_req_type = SINGLE; +- + /* get quirk */ + for (i = 0; i < ARRAY_SIZE(of_quirks); i++) + if (of_property_read_bool(np, of_quirks[i].quirk)) + +From 31567aa7a43385bbc429eff72855b49c90c2ac97 Mon Sep 17 00:00:00 2001 +From: Vinod Koul +Date: Tue, 5 Jul 2016 10:02:16 +0530 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: explicitly freeup irq + +dmaengine device should explicitly call devm_free_irq() when using +devm_request_irq(). + +The irq is still ON when devices remove is executed and irq should be +quiesced before remove is completed. + +Signed-off-by: Vinod Koul +Cc: Jassi Brar +Cc: Linus Walleij +(cherry picked from commit 46cf94d6ab38420690d890d9922bfc61a7b3e2c5) +--- + drivers/dma/pl330.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index f7977979cbf5..b6793b0d53c9 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -3015,12 +3015,18 @@ static int pl330_remove(struct amba_device *adev) + { + struct pl330_dmac *pl330 = amba_get_drvdata(adev); + struct dma_pl330_chan *pch, *_p; ++ int i, irq; + + pm_runtime_get_noresume(pl330->ddma.dev); + + if (adev->dev.of_node) + of_dma_controller_free(adev->dev.of_node); + ++ for (i = 0; i < AMBA_NR_IRQS; i++) { ++ irq = adev->irq[i]; ++ devm_free_irq(&adev->dev, irq, pl330); ++ } ++ + dma_async_device_unregister(&pl330->ddma); + + /* Idle the DMAC */ + +From ba1d527ad2e0ac6b1f60f79b6e15cd2231876367 Mon Sep 17 00:00:00 2001 +From: Stephen Barber +Date: Thu, 18 Aug 2016 17:59:59 -0700 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: fix residual for non-running BUSY + descriptors + +Only one descriptor in the work list should be running at +any given time, but it's possible to have an enqueued BUSY +descriptor that has not yet transferred any data, or for +a BUSY descriptor to linger briefly before transitioning +to DONE. These cases should be handled to keep residual +calculations consistent even with the non-running BUSY +descriptors in the work list. + +Signed-off-by: Stephen Barber +Signed-off-by: Vinod Koul +(cherry picked from commit d64e9a2c750930272492952c16f3f2c95311a6c9) +--- + drivers/dma/pl330.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index b6793b0d53c9..7e05ef5ba37f 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2283,7 +2283,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + { + enum dma_status ret; + unsigned long flags; +- struct dma_pl330_desc *desc, *running = NULL; ++ struct dma_pl330_desc *desc, *running = NULL, *last_enq = NULL; + struct dma_pl330_chan *pch = to_pchan(chan); + unsigned int transferred, residual = 0; + +@@ -2300,6 +2300,8 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + if (pch->thread->req_running != -1) + running = pch->thread->req[pch->thread->req_running].desc; + ++ last_enq = pch->thread->req[pch->thread->lstenq].desc; ++ + /* Check in pending list */ + list_for_each_entry(desc, &pch->work_list, node) { + if (desc->status == DONE) +@@ -2307,6 +2309,15 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + else if (running && desc == running) + transferred = + pl330_get_current_xferred_count(pch, desc); ++ else if (desc->status == BUSY) ++ /* ++ * Busy but not running means either just enqueued, ++ * or finished and not yet marked done ++ */ ++ if (desc == last_enq) ++ transferred = 0; ++ else ++ transferred = desc->bytes_requested; + else + transferred = 0; + residual += desc->bytes_requested - transferred; + +From c6ddb1c340be89262163fc1f1ddbeff2b7adac7c Mon Sep 17 00:00:00 2001 +From: Hsin-Yu Chao +Date: Tue, 23 Aug 2016 17:16:55 +0800 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: Acquire dmac's spinlock in + pl330_tx_status + +There is a racing when accessing dmac thread in pl330_tx_status that +the pl330_update is handling active request at the same time and +changing the status of descriptors. This could cause an invalid +transferred count from BUSY descriptor added up to the residual number. +Fix the bug by using the dmac's spinlock in pl330_tx_status to protect +thread resources from changing. +Note that the nested order of holding dmac's and dma_chan's spinlock is +consistent with the rest of the driver: dma_chan first and then dmac, +so it is safe from deadlock scenario. + +Signed-off-by: Hsin-Yu Chao +Reviewed-by: Guenter Roeck +Signed-off-by: Vinod Koul +(cherry picked from commit a40235a2278a315261ee007fc433ec1cfb31666f) +--- + drivers/dma/pl330.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 7e05ef5ba37f..93efdcc54f19 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2296,6 +2296,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + goto out; + + spin_lock_irqsave(&pch->lock, flags); ++ spin_lock(&pch->thread->dmac->lock); + + if (pch->thread->req_running != -1) + running = pch->thread->req[pch->thread->req_running].desc; +@@ -2338,6 +2339,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, + if (desc->last) + residual = 0; + } ++ spin_unlock(&pch->thread->dmac->lock); + spin_unlock_irqrestore(&pch->lock, flags); + + out: + +From a2bd9dfc9421a44c86ad35c6b29fc28534917553 Mon Sep 17 00:00:00 2001 +From: Stephen Barber +Date: Tue, 1 Nov 2016 16:44:27 -0700 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: Handle xferred count if DMAMOV + hasn't finished + +After executing DMAGO it's possible that a request can come in for the +current xferred count, but if that happens too soon then DMAMOV SAR/DAR +may not have yet completed. If that happens, we should explicitly return 0 +since nothing has been transferred yet. + +Signed-off-by: Stephen Barber +Signed-off-by: Vinod Koul +(cherry picked from commit c44da03dd517c11c2b3525937b0a241fc1c69399) +--- + drivers/dma/pl330.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 93efdcc54f19..497cc048feaa 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2274,6 +2274,11 @@ static int pl330_get_current_xferred_count(struct dma_pl330_chan *pch, + } + pm_runtime_mark_last_busy(pch->dmac->ddma.dev); + pm_runtime_put_autosuspend(pl330->ddma.dev); ++ ++ /* If DMAMOV hasn't finished yet, SAR/DAR can be zero */ ++ if (!val) ++ return 0; ++ + return val - addr; + } + + +From 166204f617a83115d81ffdf34329757b4b1f9fb0 Mon Sep 17 00:00:00 2001 +From: Vladimir Murzin +Date: Wed, 7 Dec 2016 13:17:40 +0000 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: do not generate unaligned access + +When PL330 is used with !MMU the following fault is seen: + +Unhandled fault: alignment exception (0x801) at 0x8f26a002 +Internal error: : 801 [#1] ARM +Modules linked in: +CPU: 0 PID: 640 Comm: dma0chan0-copy0 Not tainted 4.8.0-6a82063-clean+ #1600 +Hardware name: ARM-Versatile Express +task: 8f1baa80 task.stack: 8e6fe000 +PC is at _setup_req+0x4c/0x350 +LR is at 0x8f2cbc00 +pc : [<801ea538>] lr : [<8f2cbc00>] psr: 60000093 +sp : 8e6ffdc0 ip : 00000000 fp : 00000000 +r10: 00000000 r9 : 8f2cba10 r8 : 8f2cbc00 +r7 : 80000013 r6 : 8f21a050 r5 : 8f21a000 r4 : 8f2ac800 +r3 : 8e6ffe18 r2 : 00944251 r1 : ffffffbc r0 : 8f26a000 +Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none +Control: 00c5387c +Process dma0chan0-copy0 (pid: 640, stack limit = 0x8e6fe210) +Stack: (0x8e6ffdc0 to 0x8e700000) +fdc0: 00000001 60000093 00000000 8f2cba10 8f26a000 00000004 8f0ae000 8f2cbc00 +fde0: 8f0ae000 8f2ac800 8f21a000 8f21a050 80000013 8f2cbc00 8f2cba10 00000000 +fe00: 60000093 801ebca0 8e6ffe18 000013ff 40000093 00000000 00944251 8f2ac800 +fe20: a0000013 8f2b1320 00001986 00000000 00000001 000013ff 8f1e4f00 8f2cba10 +fe40: 8e6fff6c 801e9044 00000003 00000000 fef98c80 002faf07 8e6ffe7c 00000000 +fe60: 00000002 00000000 00001986 8f1f158d 8f1e4f00 80568de4 00000002 00000000 +fe80: 00001986 8f1f53ff 40000001 80580500 8f1f158d 8001e00c 00000000 cfdfdfdf +fea0: fdae2a25 00000001 00000004 8e6fe000 00000008 00000010 00000000 00000005 +fec0: 8f2b1330 8f2b1334 8e6ffe80 8e6ffe8c 00001986 00000000 8f21a014 00000001 +fee0: 8e6ffe60 8e6ffe78 00000002 00000000 000013ff 00000001 80568de4 8f1e8018 +ff00: 0000158d 8055ec30 00000001 803f6b00 00001986 8f2cba10 fdae2a25 00000001 +ff20: 8f1baca8 8e6fff24 8e6fff24 00000000 8e6fff24 ac6f3037 00000000 00000000 +ff40: 00000000 8e6fe000 8f1e4f40 00000000 8f1e4f40 8f1e4f00 801e84ec 00000000 +ff60: 00000000 00000000 00000000 80031714 dfdfdfcf 00000000 dfdfdfcf 8f1e4f00 +ff80: 00000000 8e6fff84 8e6fff84 00000000 8e6fff90 8e6fff90 8e6fffac 8f1e4f40 +ffa0: 80031640 00000000 00000000 8000f548 00000000 00000000 00000000 00000000 +ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 dfdfdfcf cfdfdfdf +[<801ea538>] (_setup_req) from [<801ebca0>] (pl330_tasklet+0x41c/0x490) +[<801ebca0>] (pl330_tasklet) from [<801e9044>] (dmatest_func+0xb58/0x149c) +[<801e9044>] (dmatest_func) from [<80031714>] (kthread+0xd4/0xec) +[<80031714>] (kthread) from [<8000f548>] (ret_from_fork+0x14/0x2c) +Code: e3a03001 e3e01043 e5c03001 e59d3048 (e5802002) + +This happens because _emit_{ADDH,MOV,GO) accessing to unaligned data +while writing to buffer. Fix it with writing to buffer byte by byte. + +Reviewed-by: Robin Murphy +Tested-by: Robin Murphy +Signed-off-by: Vladimir Murzin +Signed-off-by: Vinod Koul +(cherry picked from commit d07c9e1e212c9687f9198bfeba582e86cae3f6f9) +--- + drivers/dma/pl330.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 497cc048feaa..eb274eeda0aa 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -573,7 +573,8 @@ static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[], + + buf[0] = CMD_DMAADDH; + buf[0] |= (da << 1); +- *((__le16 *)&buf[1]) = cpu_to_le16(val); ++ buf[1] = val; ++ buf[2] = val >> 8; + + PL330_DBGCMD_DUMP(SZ_DMAADDH, "\tDMAADDH %s %u\n", + da == 1 ? "DA" : "SA", val); +@@ -727,7 +728,10 @@ static inline u32 _emit_MOV(unsigned dry_run, u8 buf[], + + buf[0] = CMD_DMAMOV; + buf[1] = dst; +- *((__le32 *)&buf[2]) = cpu_to_le32(val); ++ buf[2] = val; ++ buf[3] = val >> 8; ++ buf[4] = val >> 16; ++ buf[5] = val >> 24; + + PL330_DBGCMD_DUMP(SZ_DMAMOV, "\tDMAMOV %s 0x%x\n", + dst == SAR ? "SAR" : (dst == DAR ? "DAR" : "CCR"), val); +@@ -902,10 +906,11 @@ static inline u32 _emit_GO(unsigned dry_run, u8 buf[], + + buf[0] = CMD_DMAGO; + buf[0] |= (ns << 1); +- + buf[1] = chan & 0x7; +- +- *((__le32 *)&buf[2]) = cpu_to_le32(addr); ++ buf[2] = addr; ++ buf[3] = addr >> 8; ++ buf[4] = addr >> 16; ++ buf[5] = addr >> 24; + + return SZ_DMAGO; + } + +From 50165cc7de07efd5986eeb604bbefe6328a142c4 Mon Sep 17 00:00:00 2001 +From: Vinod Koul +Date: Fri, 9 Dec 2016 15:24:12 +0530 +Subject: [PATCH] =?UTF-8?q?UPSTREAM:=20dmaengine:=20pl330:=20remove=20unus?= + =?UTF-8?q?ed=20=E2=80=98regs=E2=80=99?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In pl330_add(), variable ‘regs’ is initialized but never used, which +leads to warning with W=1. + +drivers/dma/pl330.c: In function 'pl330_add': +drivers/dma/pl330.c:1891:16: warning: variable 'regs' set but not used [-Wunused-but-set-variable] + +So remove it. + +Cc: Linus Walleij +Signed-off-by: Vinod Koul +(cherry picked from commit 920e00d62ef9a818a4af7b2f9e1dbca23f846fc1) +--- + drivers/dma/pl330.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index eb274eeda0aa..14efb0e4a6a8 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1889,11 +1889,8 @@ static int dmac_alloc_resources(struct pl330_dmac *pl330) + + static int pl330_add(struct pl330_dmac *pl330) + { +- void __iomem *regs; + int i, ret; + +- regs = pl330->base; +- + /* Check if we can handle this DMAC */ + if ((pl330->pcfg.periph_id & 0xfffff) != PERIPH_ID_VAL) { + dev_err(pl330->ddma.dev, "PERIPH_ID 0x%x !\n", + +From 9d2bcf1dd31ccb4cf3486deeda428b5e4211aff7 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Mon, 27 Mar 2017 07:31:03 +0200 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: remove pdata based initialization + +This driver is now used only on platforms which support device tree, so +it is safe to remove legacy platform data based initialization code. + +Signed-off-by: Marek Szyprowski +Reviewed-by: Ulf Hansson +Acked-by: Arnd Bergmann +For plat-samsung: +Acked-by: Krzysztof Kozlowski +Signed-off-by: Vinod Koul +(cherry picked from commit e8bb4673596ea28fab287dbc417e8100d798cd40) +--- + arch/arm/plat-samsung/devs.c | 1 - + drivers/dma/pl330.c | 42 ++++++++---------------------------------- + include/linux/amba/pl330.h | 35 ----------------------------------- + 3 files changed, 8 insertions(+), 70 deletions(-) + delete mode 100644 include/linux/amba/pl330.h + +diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c +index e212f9d804bd..2ef19ad5cb62 100644 +--- a/arch/arm/plat-samsung/devs.c ++++ b/arch/arm/plat-samsung/devs.c +@@ -10,7 +10,6 @@ + * published by the Free Software Foundation. + */ + +-#include + #include + #include + #include +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 14efb0e4a6a8..8d6c483663dc 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -2084,18 +2083,6 @@ static void pl330_tasklet(unsigned long data) + } + } + +-bool pl330_filter(struct dma_chan *chan, void *param) +-{ +- u8 *peri_id; +- +- if (chan->device->dev->driver != &pl330_driver.drv) +- return false; +- +- peri_id = chan->private; +- return *peri_id == (unsigned long)param; +-} +-EXPORT_SYMBOL(pl330_filter); +- + static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) + { +@@ -2840,7 +2827,6 @@ static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume); + static int + pl330_probe(struct amba_device *adev, const struct amba_id *id) + { +- struct dma_pl330_platdata *pdat; + struct pl330_config *pcfg; + struct pl330_dmac *pl330; + struct dma_pl330_chan *pch, *_p; +@@ -2850,8 +2836,6 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + int num_chan; + struct device_node *np = adev->dev.of_node; + +- pdat = dev_get_platdata(&adev->dev); +- + ret = dma_set_mask_and_coherent(&adev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; +@@ -2866,7 +2850,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + pd = &pl330->ddma; + pd->dev = &adev->dev; + +- pl330->mcbufsz = pdat ? pdat->mcbuf_sz : 0; ++ pl330->mcbufsz = 0; + + /* get quirk */ + for (i = 0; i < ARRAY_SIZE(of_quirks); i++) +@@ -2910,10 +2894,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + INIT_LIST_HEAD(&pd->channels); + + /* Initialize channel parameters */ +- if (pdat) +- num_chan = max_t(int, pdat->nr_valid_peri, pcfg->num_chan); +- else +- num_chan = max_t(int, pcfg->num_peri, pcfg->num_chan); ++ num_chan = max_t(int, pcfg->num_peri, pcfg->num_chan); + + pl330->num_peripherals = num_chan; + +@@ -2926,11 +2907,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + + for (i = 0; i < num_chan; i++) { + pch = &pl330->peripherals[i]; +- if (!adev->dev.of_node) +- pch->chan.private = pdat ? &pdat->peri_id[i] : NULL; +- else +- pch->chan.private = adev->dev.of_node; + ++ pch->chan.private = adev->dev.of_node; + INIT_LIST_HEAD(&pch->submitted_list); + INIT_LIST_HEAD(&pch->work_list); + INIT_LIST_HEAD(&pch->completed_list); +@@ -2943,15 +2921,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + list_add_tail(&pch->chan.device_node, &pd->channels); + } + +- if (pdat) { +- pd->cap_mask = pdat->cap_mask; +- } else { +- dma_cap_set(DMA_MEMCPY, pd->cap_mask); +- if (pcfg->num_peri) { +- dma_cap_set(DMA_SLAVE, pd->cap_mask); +- dma_cap_set(DMA_CYCLIC, pd->cap_mask); +- dma_cap_set(DMA_PRIVATE, pd->cap_mask); +- } ++ dma_cap_set(DMA_MEMCPY, pd->cap_mask); ++ if (pcfg->num_peri) { ++ dma_cap_set(DMA_SLAVE, pd->cap_mask); ++ dma_cap_set(DMA_CYCLIC, pd->cap_mask); ++ dma_cap_set(DMA_PRIVATE, pd->cap_mask); + } + + pd->device_alloc_chan_resources = pl330_alloc_chan_resources; +diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h +deleted file mode 100644 +index fe93758e8403..000000000000 +--- a/include/linux/amba/pl330.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/* linux/include/linux/amba/pl330.h +- * +- * Copyright (C) 2010 Samsung Electronics Co. Ltd. +- * Jaswinder Singh +- * +- * 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. +- */ +- +-#ifndef __AMBA_PL330_H_ +-#define __AMBA_PL330_H_ +- +-#include +- +-struct dma_pl330_platdata { +- /* +- * Number of valid peripherals connected to DMAC. +- * This may be different from the value read from +- * CR0, as the PL330 implementation might have 'holes' +- * in the peri list or the peri could also be reached +- * from another DMAC which the platform prefers. +- */ +- u8 nr_valid_peri; +- /* Array of valid peripherals */ +- u8 *peri_id; +- /* Operational capabilities */ +- dma_cap_mask_t cap_mask; +- /* Bytes to allocate for MC buffer */ +- unsigned mcbuf_sz; +-}; +- +-extern bool pl330_filter(struct dma_chan *chan, void *param); +-#endif /* __AMBA_PL330_H_ */ + +From 4ecadbeac3bbd8cd7e2377681b458a4036c33233 Mon Sep 17 00:00:00 2001 +From: Jean-Philippe Brucker +Date: Thu, 1 Jun 2017 19:22:01 +0100 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: fix warning in pl330_remove + +When removing a device with less than 9 IRQs (AMBA_NR_IRQS), we'll get a +big WARN_ON from devres.c because pl330_remove calls devm_free_irqs for +unallocated irqs. Similarly to pl330_probe, check that IRQ number is +present before calling devm_free_irq. + +Signed-off-by: Jean-Philippe Brucker +Signed-off-by: Vinod Koul +(cherry picked from commit ebcdaee4cebb3a8d0d702ab5e9392373672ec1de) +--- + drivers/dma/pl330.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 8d6c483663dc..f6a4a89ae8aa 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -3018,7 +3018,8 @@ static int pl330_remove(struct amba_device *adev) + + for (i = 0; i < AMBA_NR_IRQS; i++) { + irq = adev->irq[i]; +- devm_free_irq(&adev->dev, irq, pl330); ++ if (irq) ++ devm_free_irq(&adev->dev, irq, pl330); + } + + dma_async_device_unregister(&pl330->ddma); + +From 062d0ddfbc9c08f971870e6ce8636a06b5b6d4d7 Mon Sep 17 00:00:00 2001 +From: Matthias Kaehlcke +Date: Thu, 15 Jun 2017 16:55:57 -0700 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: Delete unused functions + +The functions _queue_empty(), _emit_ADDH(), _emit_NOP(), _emit_STZ() +and _emit_WFE() are not used. Delete them. + +Signed-off-by: Matthias Kaehlcke +Signed-off-by: Vinod Koul +(cherry picked from commit d43674ecc002b49926f216cb414cff2d230ca3fb) +--- + drivers/dma/pl330.c | 67 ----------------------------------------------------- + 1 file changed, 67 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index f6a4a89ae8aa..bd4a0c3deaf6 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -538,11 +538,6 @@ struct _xfer_spec { + struct dma_pl330_desc *desc; + }; + +-static inline bool _queue_empty(struct pl330_thread *thrd) +-{ +- return thrd->req[0].desc == NULL && thrd->req[1].desc == NULL; +-} +- + static inline bool _queue_full(struct pl330_thread *thrd) + { + return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; +@@ -564,23 +559,6 @@ static inline u32 get_revision(u32 periph_id) + return (periph_id >> PERIPH_REV_SHIFT) & PERIPH_REV_MASK; + } + +-static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[], +- enum pl330_dst da, u16 val) +-{ +- if (dry_run) +- return SZ_DMAADDH; +- +- buf[0] = CMD_DMAADDH; +- buf[0] |= (da << 1); +- buf[1] = val; +- buf[2] = val >> 8; +- +- PL330_DBGCMD_DUMP(SZ_DMAADDH, "\tDMAADDH %s %u\n", +- da == 1 ? "DA" : "SA", val); +- +- return SZ_DMAADDH; +-} +- + static inline u32 _emit_END(unsigned dry_run, u8 buf[]) + { + if (dry_run) +@@ -738,18 +716,6 @@ static inline u32 _emit_MOV(unsigned dry_run, u8 buf[], + return SZ_DMAMOV; + } + +-static inline u32 _emit_NOP(unsigned dry_run, u8 buf[]) +-{ +- if (dry_run) +- return SZ_DMANOP; +- +- buf[0] = CMD_DMANOP; +- +- PL330_DBGCMD_DUMP(SZ_DMANOP, "\tDMANOP\n"); +- +- return SZ_DMANOP; +-} +- + static inline u32 _emit_RMB(unsigned dry_run, u8 buf[]) + { + if (dry_run) +@@ -817,39 +783,6 @@ static inline u32 _emit_STP(unsigned dry_run, u8 buf[], + return SZ_DMASTP; + } + +-static inline u32 _emit_STZ(unsigned dry_run, u8 buf[]) +-{ +- if (dry_run) +- return SZ_DMASTZ; +- +- buf[0] = CMD_DMASTZ; +- +- PL330_DBGCMD_DUMP(SZ_DMASTZ, "\tDMASTZ\n"); +- +- return SZ_DMASTZ; +-} +- +-static inline u32 _emit_WFE(unsigned dry_run, u8 buf[], u8 ev, +- unsigned invalidate) +-{ +- if (dry_run) +- return SZ_DMAWFE; +- +- buf[0] = CMD_DMAWFE; +- +- ev &= 0x1f; +- ev <<= 3; +- buf[1] = ev; +- +- if (invalidate) +- buf[1] |= (1 << 1); +- +- PL330_DBGCMD_DUMP(SZ_DMAWFE, "\tDMAWFE %u%s\n", +- ev >> 3, invalidate ? ", I" : ""); +- +- return SZ_DMAWFE; +-} +- + static inline u32 _emit_WFP(unsigned dry_run, u8 buf[], + enum pl330_cond cond, u8 peri) + { + +From 5d7da5fbd04fb60500162c823056b836c78ba397 Mon Sep 17 00:00:00 2001 +From: Arvind Yadav +Date: Wed, 23 Aug 2017 21:57:31 +0530 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: constify amba_id + +amba_id are not supposed to change at runtime. All functions +working with const amba_id. So mark the non-const structs as const. + +Signed-off-by: Arvind Yadav +Signed-off-by: Vinod Koul +(cherry picked from commit b753351ec8f4c6a25c6d9b5c4eccce62e448a571) +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index bd4a0c3deaf6..63ffb8d1f885 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2976,7 +2976,7 @@ static int pl330_remove(struct amba_device *adev) + return 0; + } + +-static struct amba_id pl330_ids[] = { ++static const struct amba_id pl330_ids[] = { + { + .id = 0x00041330, + .mask = 0x000fffff, + +From 79dd0f02e59662d1f1ce0b118280356ed9e63d65 Mon Sep 17 00:00:00 2001 +From: Alexander Kochetkov +Date: Wed, 4 Oct 2017 14:37:23 +0300 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: fix descriptor allocation fail + +If two concurrent threads call pl330_get_desc() when DMAC descriptor +pool is empty it is possible that allocation for one of threads will fail +with message: + +kernel: dma-pl330 20078000.dma-controller: pl330_get_desc:2469 ALERT! + +Here how that can happen. Thread A calls pl330_get_desc() to get +descriptor. If DMAC descriptor pool is empty pl330_get_desc() allocates +new descriptor on shared pool using add_desc() and then get newly +allocated descriptor using pluck_desc(). At the same time thread B calls +pluck_desc() and take newly allocated descriptor. In that case descriptor +allocation for thread A will fail. + +Using on-stack pool for new descriptor allow avoid the issue described. +The patch modify pl330_get_desc() to use on-stack pool for allocation +new descriptors. + +Signed-off-by: Alexander Kochetkov +Tested-by: Marek Szyprowski +Signed-off-by: Vinod Koul +(cherry picked from commit e588710311ee5bece284871d613418831d56f2bd) +--- + drivers/dma/pl330.c | 39 ++++++++++++++++++++------------------- + 1 file changed, 20 insertions(+), 19 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 63ffb8d1f885..257492238cea 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2344,7 +2344,8 @@ static inline void _init_desc(struct dma_pl330_desc *desc) + } + + /* Returns the number of descriptors added to the DMAC pool */ +-static int add_desc(struct pl330_dmac *pl330, gfp_t flg, int count) ++static int add_desc(struct list_head *pool, spinlock_t *lock, ++ gfp_t flg, int count) + { + struct dma_pl330_desc *desc; + unsigned long flags; +@@ -2354,27 +2355,28 @@ static int add_desc(struct pl330_dmac *pl330, gfp_t flg, int count) + if (!desc) + return 0; + +- spin_lock_irqsave(&pl330->pool_lock, flags); ++ spin_lock_irqsave(lock, flags); + + for (i = 0; i < count; i++) { + _init_desc(&desc[i]); +- list_add_tail(&desc[i].node, &pl330->desc_pool); ++ list_add_tail(&desc[i].node, pool); + } + +- spin_unlock_irqrestore(&pl330->pool_lock, flags); ++ spin_unlock_irqrestore(lock, flags); + + return count; + } + +-static struct dma_pl330_desc *pluck_desc(struct pl330_dmac *pl330) ++static struct dma_pl330_desc *pluck_desc(struct list_head *pool, ++ spinlock_t *lock) + { + struct dma_pl330_desc *desc = NULL; + unsigned long flags; + +- spin_lock_irqsave(&pl330->pool_lock, flags); ++ spin_lock_irqsave(lock, flags); + +- if (!list_empty(&pl330->desc_pool)) { +- desc = list_entry(pl330->desc_pool.next, ++ if (!list_empty(pool)) { ++ desc = list_entry(pool->next, + struct dma_pl330_desc, node); + + list_del_init(&desc->node); +@@ -2383,7 +2385,7 @@ static struct dma_pl330_desc *pluck_desc(struct pl330_dmac *pl330) + desc->txd.callback = NULL; + } + +- spin_unlock_irqrestore(&pl330->pool_lock, flags); ++ spin_unlock_irqrestore(lock, flags); + + return desc; + } +@@ -2395,20 +2397,18 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch) + struct dma_pl330_desc *desc; + + /* Pluck one desc from the pool of DMAC */ +- desc = pluck_desc(pl330); ++ desc = pluck_desc(&pl330->desc_pool, &pl330->pool_lock); + + /* If the DMAC pool is empty, alloc new */ + if (!desc) { +- if (!add_desc(pl330, GFP_ATOMIC, 1)) +- return NULL; ++ DEFINE_SPINLOCK(lock); ++ LIST_HEAD(pool); + +- /* Try again */ +- desc = pluck_desc(pl330); +- if (!desc) { +- dev_err(pch->dmac->ddma.dev, +- "%s:%d ALERT!\n", __func__, __LINE__); ++ if (!add_desc(&pool, &lock, GFP_ATOMIC, 1)) + return NULL; +- } ++ ++ desc = pluck_desc(&pool, &lock); ++ WARN_ON(!desc || !list_empty(&pool)); + } + + /* Initialize the descriptor */ +@@ -2821,7 +2821,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + spin_lock_init(&pl330->pool_lock); + + /* Create a descriptor pool of default size */ +- if (!add_desc(pl330, GFP_KERNEL, NR_DEFAULT_DESC)) ++ if (!add_desc(&pl330->desc_pool, &pl330->pool_lock, ++ GFP_KERNEL, NR_DEFAULT_DESC)) + dev_warn(&adev->dev, "unable to allocate desc\n"); + + INIT_LIST_HEAD(&pd->channels); + +From a285cd8b8945bbe899f23e90c98d54249903e7bf Mon Sep 17 00:00:00 2001 +From: Frank Mori Hess +Date: Wed, 18 Apr 2018 20:31:06 -0400 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: flush before wait, and add dev + burst support. + +Do DMAFLUSHP _before_ the first DMAWFP to ensure controller +and peripheral are in agreement about dma request state before first +transfer. Add support for burst transfers to/from peripherals. In the new +scheme, the controller does as many burst transfers as it can then +transfers the remaining dregs with either single transfers for +peripherals, or with a reduced size burst for memory-to-memory transfers. + +Signed-off-by: Frank Mori Hess +Tested-by: Frank Mori Hess +Signed-off-by: Vinod Koul +(cherry picked from commit 1d48745b192a7a45bbdd3557b4c039609569ca41) +--- + drivers/dma/pl330.c | 209 +++++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 159 insertions(+), 50 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 257492238cea..fd48c031ead8 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include "dmaengine.h" + #define PL330_MAX_CHAN 8 +@@ -1095,51 +1096,96 @@ static inline int _ldst_memtomem(unsigned dry_run, u8 buf[], + return off; + } + +-static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run, +- u8 buf[], const struct _xfer_spec *pxs, +- int cyc) ++static u32 _emit_load(unsigned int dry_run, u8 buf[], ++ enum pl330_cond cond, enum dma_transfer_direction direction, ++ u8 peri) + { + int off = 0; +- enum pl330_cond cond; + +- if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) +- cond = BURST; +- else +- cond = SINGLE; ++ switch (direction) { ++ case DMA_MEM_TO_MEM: ++ /* fall through */ ++ case DMA_MEM_TO_DEV: ++ off += _emit_LD(dry_run, &buf[off], cond); ++ break; + +- while (cyc--) { +- off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); +- off += _emit_LDP(dry_run, &buf[off], cond, pxs->desc->peri); +- off += _emit_ST(dry_run, &buf[off], ALWAYS); ++ case DMA_DEV_TO_MEM: ++ if (cond == ALWAYS) { ++ off += _emit_LDP(dry_run, &buf[off], SINGLE, ++ peri); ++ off += _emit_LDP(dry_run, &buf[off], BURST, ++ peri); ++ } else { ++ off += _emit_LDP(dry_run, &buf[off], cond, ++ peri); ++ } ++ break; + +- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) +- off += _emit_FLUSHP(dry_run, &buf[off], +- pxs->desc->peri); ++ default: ++ /* this code should be unreachable */ ++ WARN_ON(1); ++ break; + } + + return off; + } + +-static inline int _ldst_memtodev(struct pl330_dmac *pl330, ++static inline u32 _emit_store(unsigned int dry_run, u8 buf[], ++ enum pl330_cond cond, enum dma_transfer_direction direction, ++ u8 peri) ++{ ++ int off = 0; ++ ++ switch (direction) { ++ case DMA_MEM_TO_MEM: ++ /* fall through */ ++ case DMA_DEV_TO_MEM: ++ off += _emit_ST(dry_run, &buf[off], cond); ++ break; ++ ++ case DMA_MEM_TO_DEV: ++ if (cond == ALWAYS) { ++ off += _emit_STP(dry_run, &buf[off], SINGLE, ++ peri); ++ off += _emit_STP(dry_run, &buf[off], BURST, ++ peri); ++ } else { ++ off += _emit_STP(dry_run, &buf[off], cond, ++ peri); ++ } ++ break; ++ ++ default: ++ /* this code should be unreachable */ ++ WARN_ON(1); ++ break; ++ } ++ ++ return off; ++} ++ ++static inline int _ldst_peripheral(struct pl330_dmac *pl330, + unsigned dry_run, u8 buf[], +- const struct _xfer_spec *pxs, int cyc) ++ const struct _xfer_spec *pxs, int cyc, ++ enum pl330_cond cond) + { + int off = 0; +- enum pl330_cond cond; + + if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) + cond = BURST; +- else +- cond = SINGLE; + ++ /* ++ * do FLUSHP at beginning to clear any stale dma requests before the ++ * first WFP. ++ */ ++ if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) ++ off += _emit_FLUSHP(dry_run, &buf[off], pxs->desc->peri); + while (cyc--) { + off += _emit_WFP(dry_run, &buf[off], cond, pxs->desc->peri); +- off += _emit_LD(dry_run, &buf[off], ALWAYS); +- off += _emit_STP(dry_run, &buf[off], cond, pxs->desc->peri); +- +- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)) +- off += _emit_FLUSHP(dry_run, &buf[off], +- pxs->desc->peri); ++ off += _emit_load(dry_run, &buf[off], cond, pxs->desc->rqtype, ++ pxs->desc->peri); ++ off += _emit_store(dry_run, &buf[off], cond, pxs->desc->rqtype, ++ pxs->desc->peri); + } + + return off; +@@ -1149,19 +1195,65 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], + const struct _xfer_spec *pxs, int cyc) + { + int off = 0; ++ enum pl330_cond cond = BRST_LEN(pxs->ccr) > 1 ? BURST : SINGLE; + + switch (pxs->desc->rqtype) { + case DMA_MEM_TO_DEV: +- off += _ldst_memtodev(pl330, dry_run, &buf[off], pxs, cyc); +- break; ++ /* fall through */ + case DMA_DEV_TO_MEM: +- off += _ldst_devtomem(pl330, dry_run, &buf[off], pxs, cyc); ++ off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, cyc, ++ cond); + break; ++ + case DMA_MEM_TO_MEM: + off += _ldst_memtomem(dry_run, &buf[off], pxs, cyc); + break; ++ ++ default: ++ /* this code should be unreachable */ ++ WARN_ON(1); ++ break; ++ } ++ ++ return off; ++} ++ ++/* ++ * transfer dregs with single transfers to peripheral, or a reduced size burst ++ * for mem-to-mem. ++ */ ++static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], ++ const struct _xfer_spec *pxs, int transfer_length) ++{ ++ int off = 0; ++ int dregs_ccr; ++ ++ if (transfer_length == 0) ++ return off; ++ ++ switch (pxs->desc->rqtype) { ++ case DMA_MEM_TO_DEV: ++ /* fall through */ ++ case DMA_DEV_TO_MEM: ++ off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, ++ transfer_length, SINGLE); ++ break; ++ ++ case DMA_MEM_TO_MEM: ++ dregs_ccr = pxs->ccr; ++ dregs_ccr &= ~((0xf << CC_SRCBRSTLEN_SHFT) | ++ (0xf << CC_DSTBRSTLEN_SHFT)); ++ dregs_ccr |= (((transfer_length - 1) & 0xf) << ++ CC_SRCBRSTLEN_SHFT); ++ dregs_ccr |= (((transfer_length - 1) & 0xf) << ++ CC_DSTBRSTLEN_SHFT); ++ off += _emit_MOV(dry_run, &buf[off], CCR, dregs_ccr); ++ off += _ldst_memtomem(dry_run, &buf[off], pxs, 1); ++ break; ++ + default: +- off += 0x40000000; /* Scare off the Client */ ++ /* this code should be unreachable */ ++ WARN_ON(1); + break; + } + +@@ -1257,6 +1349,8 @@ static inline int _setup_loops(struct pl330_dmac *pl330, + struct pl330_xfer *x = &pxs->desc->px; + u32 ccr = pxs->ccr; + unsigned long c, bursts = BYTE_TO_BURST(x->bytes, ccr); ++ int num_dregs = (x->bytes - BURST_TO_BYTE(bursts, ccr)) / ++ BRST_SIZE(ccr); + int off = 0; + + while (bursts) { +@@ -1264,6 +1358,7 @@ static inline int _setup_loops(struct pl330_dmac *pl330, + off += _loop(pl330, dry_run, &buf[off], &c, pxs); + bursts -= c; + } ++ off += _dregs(pl330, dry_run, &buf[off], pxs, num_dregs); + + return off; + } +@@ -1295,7 +1390,6 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + struct _xfer_spec *pxs) + { + struct _pl330_req *req = &thrd->req[index]; +- struct pl330_xfer *x; + u8 *buf = req->mc_cpu; + int off = 0; + +@@ -1304,11 +1398,6 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run, + /* DMAMOV CCR, ccr */ + off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr); + +- x = &pxs->desc->px; +- /* Error if xfer length is not aligned at burst size */ +- if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) +- return -EINVAL; +- + off += _setup_xfer(pl330, dry_run, &buf[off], pxs); + + /* DMASEV peripheral/event */ +@@ -1366,6 +1455,20 @@ static int pl330_submit_req(struct pl330_thread *thrd, + u32 ccr; + int ret = 0; + ++ switch (desc->rqtype) { ++ case DMA_MEM_TO_DEV: ++ break; ++ ++ case DMA_DEV_TO_MEM: ++ break; ++ ++ case DMA_MEM_TO_MEM: ++ break; ++ ++ default: ++ return -ENOTSUPP; ++ } ++ + if (pl330->state == DYING + || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { + dev_info(thrd->dmac->ddma.dev, "%s:%d\n", +@@ -2060,6 +2163,18 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) + return 1; + } + ++static int fixup_burst_len(int max_burst_len, int quirks) ++{ ++ if (quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ++ return 1; ++ else if (max_burst_len > PL330_MAX_BURST) ++ return PL330_MAX_BURST; ++ else if (max_burst_len < 1) ++ return 1; ++ else ++ return max_burst_len; ++} ++ + static int pl330_config(struct dma_chan *chan, + struct dma_slave_config *slave_config) + { +@@ -2070,15 +2185,15 @@ static int pl330_config(struct dma_chan *chan, + pch->fifo_addr = slave_config->dst_addr; + if (slave_config->dst_addr_width) + pch->burst_sz = __ffs(slave_config->dst_addr_width); +- if (slave_config->dst_maxburst) +- pch->burst_len = slave_config->dst_maxburst; ++ pch->burst_len = fixup_burst_len(slave_config->dst_maxburst, ++ pch->dmac->quirks); + } else if (slave_config->direction == DMA_DEV_TO_MEM) { + if (slave_config->src_addr) + pch->fifo_addr = slave_config->src_addr; + if (slave_config->src_addr_width) + pch->burst_sz = __ffs(slave_config->src_addr_width); +- if (slave_config->src_maxburst) +- pch->burst_len = slave_config->src_maxburst; ++ pch->burst_len = fixup_burst_len(slave_config->src_maxburst, ++ pch->dmac->quirks); + } + + return 0; +@@ -2471,14 +2586,8 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len) + burst_len >>= desc->rqcfg.brst_size; + + /* src/dst_burst_len can't be more than 16 */ +- if (burst_len > 16) +- burst_len = 16; +- +- while (burst_len > 1) { +- if (!(len % (burst_len << desc->rqcfg.brst_size))) +- break; +- burst_len--; +- } ++ if (burst_len > PL330_MAX_BURST) ++ burst_len = PL330_MAX_BURST; + + return burst_len; + } +@@ -2547,7 +2656,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( + + desc->rqtype = direction; + desc->rqcfg.brst_size = pch->burst_sz; +- desc->rqcfg.brst_len = 1; ++ desc->rqcfg.brst_len = pch->burst_len; + desc->bytes_requested = period_len; + fill_px(&desc->px, dst, src, period_len); + +@@ -2692,7 +2801,7 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, + } + + desc->rqcfg.brst_size = pch->burst_sz; +- desc->rqcfg.brst_len = 1; ++ desc->rqcfg.brst_len = pch->burst_len; + desc->rqtype = direction; + desc->bytes_requested = sg_dma_len(sg); + } + +From 058373c4d717d3a353bca1345ea90f8ca6531136 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Tue, 19 Jun 2018 15:20:50 +0200 +Subject: [PATCH] UPSTREAM: dmaengine: pl330: report BURST residue granularity + +The reported residue is already calculated in BURST unit granularity, so +advertise this capability properly to other devices in the system. + +Fixes: aee4d1fac887 ("dmaengine: pl330: improve pl330_tx_status() function") +Signed-off-by: Marek Szyprowski +Signed-off-by: Vinod Koul +(cherry picked from commit e3f329c600033f011a978a8bc4ddb1e2e94c4f4d) +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index fd48c031ead8..029bd0444137 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2984,7 +2984,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) + pd->src_addr_widths = PL330_DMA_BUSWIDTHS; + pd->dst_addr_widths = PL330_DMA_BUSWIDTHS; + pd->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); +- pd->residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; ++ pd->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + pd->max_burst = ((pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP) ? + 1 : PL330_MAX_BURST); + + +From 05fa0eafd6eda3e61ac5d4a9511eb4d1bb1924f9 Mon Sep 17 00:00:00 2001 +From: Vinod Koul +Date: Mon, 9 Jul 2018 17:09:58 +0530 +Subject: [PATCH] dmaengine: pl330: Mark expected switch fall-through + +In preparation to enabling -Wimplicit-fallthrough, mark switch cases +where we are expecting to fall through. + +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Vinod Koul +(cherry picked from commit bbcb87555869cb6c249bf00d13d3bc400c476c84) +--- + drivers/dma/pl330.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index 029bd0444137..c3bd238b0c22 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1047,13 +1047,16 @@ static bool _start(struct pl330_thread *thrd) + + if (_state(thrd) == PL330_STATE_KILLING) + UNTIL(thrd, PL330_STATE_STOPPED) ++ /* fall through */ + + case PL330_STATE_FAULTING: + _stop(thrd); ++ /* fall through */ + + case PL330_STATE_KILLING: + case PL330_STATE_COMPLETING: + UNTIL(thrd, PL330_STATE_STOPPED) ++ /* fall through */ + + case PL330_STATE_STOPPED: + return _trigger(thrd); + +From b654bf6ca9ee98bab1a3c55ebd359f251b9c1a61 Mon Sep 17 00:00:00 2001 +From: Vinod Koul +Date: Mon, 9 Jul 2018 20:08:48 +0530 +Subject: [PATCH] dmaengine: pl330: remove set but unused variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compiler complains (with W=1): +drivers/dma/pl330.c: In function ‘pl330_release_channel’: +drivers/dma/pl330.c:1782:21: warning: + variable ‘pl330’ set but not used [-Wunused-but-set-variable] + struct pl330_dmac *pl330; + ^~~~~ + +Remove the pl330 variable in pl330_release_channel as it is set but +never used. + +Signed-off-by: Vinod Koul +(cherry picked from commit 2f903bab92dea8dec8c93e4fa3c7c5295ef0a0fe) +--- + drivers/dma/pl330.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index c3bd238b0c22..a25ab357b87c 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -1783,8 +1783,6 @@ static inline void _free_event(struct pl330_thread *thrd, int ev) + + static void pl330_release_channel(struct pl330_thread *thrd) + { +- struct pl330_dmac *pl330; +- + if (!thrd || thrd->free) + return; + +@@ -1793,8 +1791,6 @@ static void pl330_release_channel(struct pl330_thread *thrd) + dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].desc, PL330_ERR_ABORT); + dma_pl330_rqcb(thrd->req[thrd->lstenq].desc, PL330_ERR_ABORT); + +- pl330 = thrd->dmac; +- + _free_event(thrd, thrd->ev); + thrd->free = true; + } + +From 31c885c621005218388ca68648dec38d2ea3f9a2 Mon Sep 17 00:00:00 2001 +From: John Keeping +Date: Tue, 17 Jul 2018 11:48:16 +0100 +Subject: [PATCH] dmaengine: pl330: fix irq race with terminate_all + +In pl330_update() when checking if a channel has been aborted, the +channel's lock is not taken, only the overall pl330_dmac lock. But in +pl330_terminate_all() the aborted flag (req_running==-1) is set under +the channel lock and not the pl330_dmac lock. + +With threaded interrupts, this leads to a potential race: + + pl330_terminate_all pl330_update + ------------------- ------------ + lock channel + entry + lock pl330 + _stop channel + unlock pl330 + lock pl330 + check req_running != -1 + req_running = -1 + _start channel + +Signed-off-by: John Keeping +Signed-off-by: Vinod Koul +(cherry picked from commit e49756544a21f5625b379b3871d27d8500764670) +--- + drivers/dma/pl330.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index a25ab357b87c..5b0aef7d1f80 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2209,13 +2209,14 @@ static int pl330_terminate_all(struct dma_chan *chan) + + pm_runtime_get_sync(pl330->ddma.dev); + spin_lock_irqsave(&pch->lock, flags); ++ + spin_lock(&pl330->lock); + _stop(pch->thread); +- spin_unlock(&pl330->lock); +- + pch->thread->req[0].desc = NULL; + pch->thread->req[1].desc = NULL; + pch->thread->req_running = -1; ++ spin_unlock(&pl330->lock); ++ + power_down = pch->active; + pch->active = false; + diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-1000-vcodec.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-1000-vcodec.patch new file mode 100644 index 0000000000..55a8e63dd8 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-1000-vcodec.patch @@ -0,0 +1,945 @@ +From e222e9913d3c70967bae92f1aed46de726974dc7 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Thu, 5 Jul 2018 00:14:14 +0200 +Subject: [PATCH] Revert "drm/drm-prime: cache dma_buf import context" + +This reverts commit 5a90381e5acc2cf32be03099a14d05d4362b3348. +--- + drivers/gpu/drm/drm_prime.c | 46 ++--------------------------- + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 1 + + 2 files changed, 3 insertions(+), 44 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 6f207d5946dc..6b7417a194a3 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -71,11 +71,6 @@ struct drm_prime_attachment { + enum dma_data_direction dir; + }; + +-struct drm_prime_callback_data { +- struct drm_gem_object *obj; +- struct sg_table *sgt; +-}; +- + static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, + struct dma_buf *dma_buf, uint32_t handle) + { +@@ -524,23 +519,6 @@ out_unlock: + } + EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); + +-static void drm_gem_prime_dmabuf_release_callback(void *data) +-{ +- struct drm_prime_callback_data *cb_data = data; +- +- if (cb_data && cb_data->obj && cb_data->obj->import_attach) { +- struct dma_buf_attachment *attach = cb_data->obj->import_attach; +- struct sg_table *sgt = cb_data->sgt; +- +- if (sgt) +- dma_buf_unmap_attachment(attach, sgt, +- DMA_BIDIRECTIONAL); +- dma_buf_detach(attach->dmabuf, attach); +- drm_gem_object_unreference_unlocked(cb_data->obj); +- kfree(cb_data); +- } +-} +- + /** + * drm_gem_prime_import - helper library implementation of the import callback + * @dev: drm_device to import into +@@ -555,7 +533,6 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, + struct dma_buf_attachment *attach; + struct sg_table *sgt; + struct drm_gem_object *obj; +- struct drm_prime_callback_data *cb_data; + int ret; + + if (dma_buf->ops == &drm_gem_prime_dmabuf_ops) { +@@ -570,13 +547,6 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, + } + } + +- cb_data = dma_buf_get_release_callback_data(dma_buf, +- drm_gem_prime_dmabuf_release_callback); +- if (cb_data && cb_data->obj && cb_data->obj->dev == dev) { +- drm_gem_object_reference(cb_data->obj); +- return cb_data->obj; +- } +- + if (!dev->driver->gem_prime_import_sg_table) + return ERR_PTR(-EINVAL); + +@@ -585,16 +555,11 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, + return ERR_CAST(attach); + + get_dma_buf(dma_buf); +- cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL); +- if (!cb_data) { +- ret = -ENOMEM; +- goto fail_detach; +- } + + sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); + if (IS_ERR(sgt)) { + ret = PTR_ERR(sgt); +- goto fail_free; ++ goto fail_detach; + } + + obj = dev->driver->gem_prime_import_sg_table(dev, attach, sgt); +@@ -602,20 +567,13 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, + ret = PTR_ERR(obj); + goto fail_unmap; + } ++ + obj->import_attach = attach; +- cb_data->obj = obj; +- cb_data->sgt = sgt; +- dma_buf_set_release_callback(dma_buf, +- drm_gem_prime_dmabuf_release_callback, cb_data); +- dma_buf_put(dma_buf); +- drm_gem_object_reference(obj); + + return obj; + + fail_unmap: + dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL); +-fail_free: +- kfree(cb_data); + fail_detach: + dma_buf_detach(dma_buf, attach); + dma_buf_put(dma_buf); +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +index 273a52b5eb66..85bbd19c87b0 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +@@ -649,6 +649,7 @@ void rockchip_gem_free_object(struct drm_gem_object *obj) + dma_unmap_sg(drm->dev, rk_obj->sgt->sgl, + rk_obj->sgt->nents, DMA_BIDIRECTIONAL); + } ++ drm_prime_gem_destroy(obj, rk_obj->sgt); + } else { + rockchip_gem_free_buf(rk_obj); + } + +From 0868438e92b0e9a44d6c6e711ef3be0a429ab4af Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Thu, 9 Jun 2016 15:29:19 -0400 +Subject: [PATCH] UPSTREAM: drm/prime: fix error path deadlock fail + +There were a couple messed up things about this fail path. +(1) it would drop object_name_lock twice +(2) drm_gem_handle_delete() (in drm_gem_remove_prime_handles()) + needs to grab prime_lock + +Reported-by: Alex Deucher +Signed-off-by: Rob Clark +Reviewed-by: Alex Deucher +Signed-off-by: Daniel Vetter +Link: http://patchwork.freedesktop.org/patch/msgid/1465500559-17873-1-git-send-email-robdclark@gmail.com +(cherry picked from commit bd6e2732f0e2894ce792f344c41fc32591436fe3) +--- + drivers/gpu/drm/drm_prime.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 6b7417a194a3..d8d85286764d 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -628,7 +628,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev, + get_dma_buf(dma_buf); + } + +- /* drm_gem_handle_create_tail unlocks dev->object_name_lock. */ ++ /* _handle_create_tail unconditionally unlocks dev->object_name_lock. */ + ret = drm_gem_handle_create_tail(file_priv, obj, handle); + drm_gem_object_unreference_unlocked(obj); + if (ret) +@@ -636,11 +636,10 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev, + + ret = drm_prime_add_buf_handle(&file_priv->prime, + dma_buf, *handle); ++ mutex_unlock(&file_priv->prime.lock); + if (ret) + goto fail; + +- mutex_unlock(&file_priv->prime.lock); +- + dma_buf_put(dma_buf); + + return 0; +@@ -650,11 +649,14 @@ fail: + * to detach.. which seems ok.. + */ + drm_gem_handle_delete(file_priv, *handle); ++ dma_buf_put(dma_buf); ++ return ret; ++ + out_unlock: + mutex_unlock(&dev->object_name_lock); + out_put: +- dma_buf_put(dma_buf); + mutex_unlock(&file_priv->prime.lock); ++ dma_buf_put(dma_buf); + return ret; + } + EXPORT_SYMBOL(drm_gem_prime_fd_to_handle); + +From 8e4ac090d0a814f73d719887f96f7dc44112e03e Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Mon, 26 Sep 2016 21:44:14 +0100 +Subject: [PATCH] UPSTREAM: drm: Convert prime dma-buf <-> handle to rbtree + +Currently we use a linear walk to lookup a handle and return a dma-buf, +and vice versa. A long overdue TODO task is to convert that to a +hashtable. Since the initial implementation of dma-buf/prime, we now +have resizeable hashtables we can use (and now a future task is to RCU +enable the lookup!). However, this patch opts to use an rbtree instead +to provide O(lgN) lookups (and insertion, deletion). rbtrees were chosen +over using the RCU backed resizable hashtable to firstly avoid the +reallocations (rbtrees can be embedded entirely within the parent +struct) and to favour simpler code with predictable worst case +behaviour. In simple testing, the difference between using the constant +lookup and insertion of the rhashtable and the rbtree was less than 10% +of the wall time (igt/benchmarks/prime_lookup) - both are dramatic +improvements over the existing linear lists. + +v2: Favour rbtree over rhashtable + +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94631 +Signed-off-by: Chris Wilson +Cc: Sean Paul +Cc: David Herrmann +Reviewed-by: David Herrmann +Reviewed-by: Sean Paul +Signed-off-by: Daniel Vetter +Link: http://patchwork.freedesktop.org/patch/msgid/20160926204414.23222-1-chris@chris-wilson.co.uk +(cherry picked from commit 077675c1e8a193a6355d4a7c8c7bf63be310b472) +--- + drivers/gpu/drm/drm_prime.c | 85 +++++++++++++++++++++++++++++++++++++++------ + include/drm/drmP.h | 5 +-- + 2 files changed, 77 insertions(+), 13 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index d8d85286764d..4c49e736bc9c 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -28,6 +28,7 @@ + + #include + #include ++#include + #include + #include + +@@ -61,9 +62,11 @@ + */ + + struct drm_prime_member { +- struct list_head entry; + struct dma_buf *dma_buf; + uint32_t handle; ++ ++ struct rb_node dmabuf_rb; ++ struct rb_node handle_rb; + }; + + struct drm_prime_attachment { +@@ -75,6 +78,7 @@ static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, + struct dma_buf *dma_buf, uint32_t handle) + { + struct drm_prime_member *member; ++ struct rb_node **p, *rb; + + member = kmalloc(sizeof(*member), GFP_KERNEL); + if (!member) +@@ -83,18 +87,56 @@ static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, + get_dma_buf(dma_buf); + member->dma_buf = dma_buf; + member->handle = handle; +- list_add(&member->entry, &prime_fpriv->head); ++ ++ rb = NULL; ++ p = &prime_fpriv->dmabufs.rb_node; ++ while (*p) { ++ struct drm_prime_member *pos; ++ ++ rb = *p; ++ pos = rb_entry(rb, struct drm_prime_member, dmabuf_rb); ++ if (dma_buf > pos->dma_buf) ++ p = &rb->rb_right; ++ else ++ p = &rb->rb_left; ++ } ++ rb_link_node(&member->dmabuf_rb, rb, p); ++ rb_insert_color(&member->dmabuf_rb, &prime_fpriv->dmabufs); ++ ++ rb = NULL; ++ p = &prime_fpriv->handles.rb_node; ++ while (*p) { ++ struct drm_prime_member *pos; ++ ++ rb = *p; ++ pos = rb_entry(rb, struct drm_prime_member, handle_rb); ++ if (handle > pos->handle) ++ p = &rb->rb_right; ++ else ++ p = &rb->rb_left; ++ } ++ rb_link_node(&member->handle_rb, rb, p); ++ rb_insert_color(&member->handle_rb, &prime_fpriv->handles); ++ + return 0; + } + + static struct dma_buf *drm_prime_lookup_buf_by_handle(struct drm_prime_file_private *prime_fpriv, + uint32_t handle) + { +- struct drm_prime_member *member; ++ struct rb_node *rb; ++ ++ rb = prime_fpriv->handles.rb_node; ++ while (rb) { ++ struct drm_prime_member *member; + +- list_for_each_entry(member, &prime_fpriv->head, entry) { ++ member = rb_entry(rb, struct drm_prime_member, handle_rb); + if (member->handle == handle) + return member->dma_buf; ++ else if (member->handle < handle) ++ rb = rb->rb_right; ++ else ++ rb = rb->rb_left; + } + + return NULL; +@@ -104,14 +146,23 @@ static int drm_prime_lookup_buf_handle(struct drm_prime_file_private *prime_fpri + struct dma_buf *dma_buf, + uint32_t *handle) + { +- struct drm_prime_member *member; ++ struct rb_node *rb; ++ ++ rb = prime_fpriv->dmabufs.rb_node; ++ while (rb) { ++ struct drm_prime_member *member; + +- list_for_each_entry(member, &prime_fpriv->head, entry) { ++ member = rb_entry(rb, struct drm_prime_member, dmabuf_rb); + if (member->dma_buf == dma_buf) { + *handle = member->handle; + return 0; ++ } else if (member->dma_buf < dma_buf) { ++ rb = rb->rb_right; ++ } else { ++ rb = rb->rb_left; + } + } ++ + return -ENOENT; + } + +@@ -166,13 +217,24 @@ static void drm_gem_map_detach(struct dma_buf *dma_buf, + void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, + struct dma_buf *dma_buf) + { +- struct drm_prime_member *member, *safe; ++ struct rb_node *rb; + +- list_for_each_entry_safe(member, safe, &prime_fpriv->head, entry) { ++ rb = prime_fpriv->dmabufs.rb_node; ++ while (rb) { ++ struct drm_prime_member *member; ++ ++ member = rb_entry(rb, struct drm_prime_member, dmabuf_rb); + if (member->dma_buf == dma_buf) { ++ rb_erase(&member->handle_rb, &prime_fpriv->handles); ++ rb_erase(&member->dmabuf_rb, &prime_fpriv->dmabufs); ++ + dma_buf_put(dma_buf); +- list_del(&member->entry); + kfree(member); ++ return; ++ } else if (member->dma_buf < dma_buf) { ++ rb = rb->rb_right; ++ } else { ++ rb = rb->rb_left; + } + } + } +@@ -794,12 +856,13 @@ EXPORT_SYMBOL(drm_prime_gem_destroy); + + void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv) + { +- INIT_LIST_HEAD(&prime_fpriv->head); + mutex_init(&prime_fpriv->lock); ++ prime_fpriv->dmabufs = RB_ROOT; ++ prime_fpriv->handles = RB_ROOT; + } + + void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv) + { + /* by now drm_gem_release should've made sure the list is empty */ +- WARN_ON(!list_empty(&prime_fpriv->head)); ++ WARN_ON(!RB_EMPTY_ROOT(&prime_fpriv->dmabufs)); + } +diff --git a/include/drm/drmP.h b/include/drm/drmP.h +index 04edcd32b409..93da65df2e7e 100644 +--- a/include/drm/drmP.h ++++ b/include/drm/drmP.h +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -365,10 +366,10 @@ struct drm_pending_event { + void (*destroy)(struct drm_pending_event *event); + }; + +-/* initial implementaton using a linked list - todo hashtab */ + struct drm_prime_file_private { +- struct list_head head; + struct mutex lock; ++ struct rb_root dmabufs; ++ struct rb_root handles; + }; + + /** File private data */ + +From fcb8af30f524cd437434ec6ddea0231cc37529bc Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Wed, 5 Oct 2016 13:21:44 +0100 +Subject: [PATCH] UPSTREAM: drm/prime: Take a ref on the drm_dev when exporting + a dma_buf +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +dma_buf may live a long time, longer than the last direct user of the +driver. We already hold a reference to the owner module (that prevents +the object code from disappearing), but there is no reference to the +drm_dev - so the pointers to the driver backend themselves may vanish. + +v2: Resist temptation to fix the bug in armada_gem.c not setting the +correct flags on the exported dma-buf (it should pass the flags through +and not be arbitrarily setting O_RDWR). + +Use a common wrapper for exporting the dmabuf and acquiring the +reference to the drm_device. + +Testcase: igt/vgem_basic/unload +Suggested-by: Daniel Vetter +Signed-off-by: Chris Wilson +Cc: Petri Latvala +Cc: Daniel Vetter +Cc: stable@vger.kernel.org +Tested-by: Petri Latvala +Reviewed-by: Christian König +Signed-off-by: Daniel Vetter +Link: http://patchwork.freedesktop.org/patch/msgid/20161005122145.1507-2-chris@chris-wilson.co.uk +(cherry picked from commit a4fce9cb782ad340ee5576a38e934e5e75832dc6) +--- + drivers/gpu/drm/armada/armada_gem.c | 2 +- + drivers/gpu/drm/drm_prime.c | 30 +++++++++++++++++++++++++++++- + drivers/gpu/drm/i915/i915_gem_dmabuf.c | 2 +- + drivers/gpu/drm/tegra/gem.c | 2 +- + drivers/gpu/drm/udl/udl_dmabuf.c | 2 +- + include/drm/drmP.h | 4 ++++ + 6 files changed, 37 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c +index 60a688ef81c7..cd5bb991f49a 100644 +--- a/drivers/gpu/drm/armada/armada_gem.c ++++ b/drivers/gpu/drm/armada/armada_gem.c +@@ -546,7 +546,7 @@ armada_gem_prime_export(struct drm_device *dev, struct drm_gem_object *obj, + exp_info.flags = O_RDWR; + exp_info.priv = obj; + +- return dma_buf_export(&exp_info); ++ return drm_gem_dmabuf_export(dev, &exp_info); + } + + struct drm_gem_object * +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 4c49e736bc9c..94b4872255c8 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -283,19 +283,47 @@ static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach, + /* nothing to be done here */ + } + ++/** ++ * drm_gem_dmabuf_export - dma_buf export implementation for GEM ++ * @dma_buf: buffer to be exported ++ * ++ * This wraps dma_buf_export() for use by generic GEM drivers that are using ++ * drm_gem_dmabuf_release(). In addition to calling dma_buf_export(), we take ++ * a reference to the drm_device which is released by drm_gem_dmabuf_release(). ++ * ++ * Returns the new dmabuf. ++ */ ++struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, ++ struct dma_buf_export_info *exp_info) ++{ ++ struct dma_buf *dma_buf; ++ ++ dma_buf = dma_buf_export(exp_info); ++ if (!IS_ERR(dma_buf)) ++ drm_dev_ref(dev); ++ ++ return dma_buf; ++} ++EXPORT_SYMBOL(drm_gem_dmabuf_export); ++ + /** + * drm_gem_dmabuf_release - dma_buf release implementation for GEM + * @dma_buf: buffer to be released + * + * Generic release function for dma_bufs exported as PRIME buffers. GEM drivers + * must use this in their dma_buf ops structure as the release callback. ++ * drm_gem_dmabuf_release() should be used in conjunction with ++ * drm_gem_dmabuf_export(). + */ + void drm_gem_dmabuf_release(struct dma_buf *dma_buf) + { + struct drm_gem_object *obj = dma_buf->priv; ++ struct drm_device *dev = obj->dev; + + /* drop the reference on the export fd holds */ + drm_gem_object_unreference_unlocked(obj); ++ ++ drm_dev_unref(dev); + } + EXPORT_SYMBOL(drm_gem_dmabuf_release); + +@@ -444,7 +472,7 @@ struct dma_buf *drm_gem_prime_export(struct drm_device *dev, + if (dev->driver->gem_prime_res_obj) + exp_info.resv = dev->driver->gem_prime_res_obj(obj); + +- return dma_buf_export(&exp_info); ++ return drm_gem_dmabuf_export(dev, &exp_info); + } + EXPORT_SYMBOL(drm_gem_prime_export); + +diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c +index e9c2bfd85b52..d4a021629bd6 100644 +--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c ++++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c +@@ -244,7 +244,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev, + return ERR_PTR(ret); + } + +- return dma_buf_export(&exp_info); ++ return drm_gem_dmabuf_export(dev, &exp_info); + } + + static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) +diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c +index 01e16e146bfe..da06f1c1ee0f 100644 +--- a/drivers/gpu/drm/tegra/gem.c ++++ b/drivers/gpu/drm/tegra/gem.c +@@ -625,7 +625,7 @@ struct dma_buf *tegra_gem_prime_export(struct drm_device *drm, + exp_info.flags = flags; + exp_info.priv = gem; + +- return dma_buf_export(&exp_info); ++ return drm_gem_dmabuf_export(drm, &exp_info); + } + + struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm, +diff --git a/drivers/gpu/drm/udl/udl_dmabuf.c b/drivers/gpu/drm/udl/udl_dmabuf.c +index e2243edd1ce3..ac90ffdb5912 100644 +--- a/drivers/gpu/drm/udl/udl_dmabuf.c ++++ b/drivers/gpu/drm/udl/udl_dmabuf.c +@@ -209,7 +209,7 @@ struct dma_buf *udl_gem_prime_export(struct drm_device *dev, + exp_info.flags = flags; + exp_info.priv = obj; + +- return dma_buf_export(&exp_info); ++ return drm_gem_dmabuf_export(dev, &exp_info); + } + + static int udl_prime_create(struct drm_device *dev, +diff --git a/include/drm/drmP.h b/include/drm/drmP.h +index 93da65df2e7e..4aba6478d718 100644 +--- a/include/drm/drmP.h ++++ b/include/drm/drmP.h +@@ -1124,6 +1124,8 @@ static inline int drm_debugfs_remove_files(const struct drm_info_list *files, + } + #endif + ++struct dma_buf_export_info; ++ + extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev, + struct drm_gem_object *obj, + int flags); +@@ -1134,6 +1136,8 @@ extern struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, + struct dma_buf *dma_buf); + extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, + struct drm_file *file_priv, int prime_fd, uint32_t *handle); ++struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, ++ struct dma_buf_export_info *exp_info); + extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf); + + extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, + +From 2c0a8737dd35ba259d3bbbf1b956fb43da32f117 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Wed, 7 Dec 2016 21:45:27 +0000 +Subject: [PATCH] UPSTREAM: drm: Take ownership of the dmabuf->obj when + exporting + +Currently the reference for the dmabuf->obj is incremented for the +dmabuf in drm_gem_prime_handle_to_fd() (at the high level userspace +interface), but is released in drm_gem_dmabuf_release() (the lowlevel +handler). Improve the symmetry of the dmabuf->obj ownership by acquiring +the reference in drm_gem_dmabuf_export(). This makes it easier to use +the prime functions directly. + +Signed-off-by: Chris Wilson +[danvet: Update kerneldoc.] +Signed-off-by: Daniel Vetter +Link: http://patchwork.freedesktop.org/patch/msgid/20161207214527.22533-1-chris@chris-wilson.co.uk +(cherry picked from commit 72a93e8dd52c9feea42f1258d555e6070680a347) +--- + drivers/gpu/drm/drm_prime.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 94b4872255c8..dbd34fa7f71c 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -289,7 +289,8 @@ static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach, + * + * This wraps dma_buf_export() for use by generic GEM drivers that are using + * drm_gem_dmabuf_release(). In addition to calling dma_buf_export(), we take +- * a reference to the drm_device which is released by drm_gem_dmabuf_release(). ++ * a reference to the &drm_device and the exported &drm_gem_object (stored in ++ * exp_info->priv) which is released by drm_gem_dmabuf_release(). + * + * Returns the new dmabuf. + */ +@@ -299,8 +300,11 @@ struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, + struct dma_buf *dma_buf; + + dma_buf = dma_buf_export(exp_info); +- if (!IS_ERR(dma_buf)) +- drm_dev_ref(dev); ++ if (IS_ERR(dma_buf)) ++ return dma_buf; ++ ++ drm_dev_ref(dev); ++ drm_gem_object_reference(exp_info->priv); + + return dma_buf; + } +@@ -503,8 +507,6 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev, + */ + obj->dma_buf = dmabuf; + get_dma_buf(obj->dma_buf); +- /* Grab a new ref since the callers is now used by the dma-buf */ +- drm_gem_object_reference(obj); + + return dmabuf; + } + +From 595e921b1e908458bd1ee022c9a7ee08cf203ad9 Mon Sep 17 00:00:00 2001 +From: Lucas Stach +Date: Thu, 30 Nov 2017 18:34:28 +0100 +Subject: [PATCH] UPSTREAM: drm/prime: skip CPU sync in map/unmap dma_buf + +Dma-bufs should already be device coherent, as they are only pulled in the +CPU domain via the begin/end cpu_access calls. As we cache the mapping set +up by dma_map_sg a CPU sync at this point will not actually guarantee proper +coherency on non-coherent architectures, so we can as well stop pretending. + +This is an important performance fix for architectures which need explicit +cache synchronization and userspace doing lots of dma-buf imports. +Improves Weston on Etnaviv performance 5x, where before this patch > 90% +of Weston CPU time was spent synchronizing caches for buffers which are +already device coherent. + +Signed-off-by: Lucas Stach +Reviewed-by: Chris Wilson +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20171130173428.8666-1-l.stach@pengutronix.de +(cherry picked from commit ca0e68e21aae10220eff71a297e7d794425add77) +--- + drivers/gpu/drm/drm_prime.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index dbd34fa7f71c..133362279591 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -203,9 +203,12 @@ static void drm_gem_map_detach(struct dma_buf *dma_buf, + + sgt = prime_attach->sgt; + if (sgt) { ++ DEFINE_DMA_ATTRS(attrs); ++ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs); + if (prime_attach->dir != DMA_NONE) +- dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents, +- prime_attach->dir); ++ dma_unmap_sg_attrs(attach->dev, sgt->sgl, sgt->nents, ++ prime_attach->dir, ++ &attrs); + sg_free_table(sgt); + } + +@@ -263,7 +266,9 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, + sgt = obj->dev->driver->gem_prime_get_sg_table(obj); + + if (!IS_ERR(sgt)) { +- if (!dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir)) { ++ DEFINE_DMA_ATTRS(attrs); ++ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs); ++ if (!dma_map_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir, &attrs)) { + sg_free_table(sgt); + kfree(sgt); + sgt = ERR_PTR(-ENOMEM); + +From d314fd1a48e930d034eccd49342a23340c3f1c27 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= +Date: Tue, 27 Feb 2018 12:49:56 +0100 +Subject: [PATCH] UPSTREAM: drm/prime: fix potential race in drm_gem_map_detach +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Unpin the GEM object only after freeing the sg table. + +Signed-off-by: Christian König +Reviewed-by: Daniel Vetter +Acked-by: Roger He +Signed-off-by: Alex Deucher +Link: https://patchwork.freedesktop.org/patch/msgid/20180227115000.4105-1-christian.koenig@amd.com +(cherry picked from commit 681066ec1d41e4b299146bada52cef846b323c04) +--- + drivers/gpu/drm/drm_prime.c | 36 ++++++++++++++++++------------------ + 1 file changed, 18 insertions(+), 18 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 133362279591..95ecc69d03a0 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -193,28 +193,28 @@ static void drm_gem_map_detach(struct dma_buf *dma_buf, + struct drm_prime_attachment *prime_attach = attach->priv; + struct drm_gem_object *obj = dma_buf->priv; + struct drm_device *dev = obj->dev; +- struct sg_table *sgt; +- +- if (dev->driver->gem_prime_unpin) +- dev->driver->gem_prime_unpin(obj); + +- if (!prime_attach) +- return; ++ if (prime_attach) { ++ struct sg_table *sgt = prime_attach->sgt; ++ ++ if (sgt) { ++ DEFINE_DMA_ATTRS(attrs); ++ dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs); ++ if (prime_attach->dir != DMA_NONE) ++ dma_unmap_sg_attrs(attach->dev, sgt->sgl, ++ sgt->nents, ++ prime_attach->dir, ++ &attrs); ++ sg_free_table(sgt); ++ } + +- sgt = prime_attach->sgt; +- if (sgt) { +- DEFINE_DMA_ATTRS(attrs); +- dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs); +- if (prime_attach->dir != DMA_NONE) +- dma_unmap_sg_attrs(attach->dev, sgt->sgl, sgt->nents, +- prime_attach->dir, +- &attrs); +- sg_free_table(sgt); ++ kfree(sgt); ++ kfree(prime_attach); ++ attach->priv = NULL; + } + +- kfree(sgt); +- kfree(prime_attach); +- attach->priv = NULL; ++ if (dev->driver->gem_prime_unpin) ++ dev->driver->gem_prime_unpin(obj); + } + + void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, + +From c74449bbd7e3ee3f3195ac9da48271c83c56f101 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= +Date: Tue, 27 Feb 2018 12:49:57 +0100 +Subject: [PATCH] UPSTREAM: drm/prime: make the pages array optional for + drm_prime_sg_to_page_addr_arrays +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Most of the time we only need the dma addresses. + +Signed-off-by: Christian König +Reviewed-by: Roger He +Signed-off-by: Alex Deucher +Link: https://patchwork.freedesktop.org/patch/msgid/20180227115000.4105-2-christian.koenig@amd.com +Link: https://patchwork.freedesktop.org/patch/msgid/20180227115000.4105-3-christian.koenig@amd.com +Link: https://patchwork.freedesktop.org/patch/msgid/20180227115000.4105-4-christian.koenig@amd.com +Link: https://patchwork.freedesktop.org/patch/msgid/20180227115000.4105-5-christian.koenig@amd.com +Link: https://patchwork.freedesktop.org/patch/msgid/BN6PR12MB18262C0DE9B5F07B9A42EAE7F2C60@BN6PR12MB1826.namprd12.prod.outlook.com +(cherry picked from commit 186ca446aea19e49d2e1433dd170c6e1c211a52a) +--- + drivers/gpu/drm/drm_prime.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c +index 95ecc69d03a0..7ea65c4105c1 100644 +--- a/drivers/gpu/drm/drm_prime.c ++++ b/drivers/gpu/drm/drm_prime.c +@@ -827,40 +827,40 @@ EXPORT_SYMBOL(drm_prime_pages_to_sg); + /** + * drm_prime_sg_to_page_addr_arrays - convert an sg table into a page array + * @sgt: scatter-gather table to convert +- * @pages: array of page pointers to store the page array in ++ * @pages: optional array of page pointers to store the page array in + * @addrs: optional array to store the dma bus address of each page +- * @max_pages: size of both the passed-in arrays ++ * @max_entries: size of both the passed-in arrays + * + * Exports an sg table into an array of pages and addresses. This is currently + * required by the TTM driver in order to do correct fault handling. + */ + int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, +- dma_addr_t *addrs, int max_pages) ++ dma_addr_t *addrs, int max_entries) + { + unsigned count; + struct scatterlist *sg; + struct page *page; +- u32 len; +- int pg_index; ++ u32 len, index; + dma_addr_t addr; + +- pg_index = 0; ++ index = 0; + for_each_sg(sgt->sgl, sg, sgt->nents, count) { + len = sg->length; + page = sg_page(sg); + addr = sg_dma_address(sg); + + while (len > 0) { +- if (WARN_ON(pg_index >= max_pages)) ++ if (WARN_ON(index >= max_entries)) + return -1; +- pages[pg_index] = page; ++ if (pages) ++ pages[index] = page; + if (addrs) +- addrs[pg_index] = addr; ++ addrs[index] = addr; + + page++; + addr += PAGE_SIZE; + len -= PAGE_SIZE; +- pg_index++; ++ index++; + } + } + return 0; + +From 2fc969d64eb928db78c9fd99fb68d9d2442a8919 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Sat, 19 Aug 2017 13:05:58 +0100 +Subject: [PATCH] UPSTREAM: drm: Release driver tracking before making the + object available again +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is the same bug as we fixed in commit f6cd7daecff5 ("drm: Release +driver references to handle before making it available again"), but now +the exposure is via the PRIME lookup tables. If we remove the +object/handle from the PRIME lut, then a new request for the same +object/fd will generate a new handle, thus for a short window that +object is known to userspace by two different handles. Fix this by +releasing the driver tracking before PRIME. + +Fixes: 0ff926c7d4f0 ("drm/prime: add exported buffers to current fprivs +imported buffer list (v2)") +Signed-off-by: Chris Wilson +Cc: David Airlie +Cc: Daniel Vetter +Cc: Rob Clark +Cc: Ville Syrjälä +Cc: Thierry Reding +Cc: stable@vger.kernel.org +Reviewed-by: Daniel Vetter +Signed-off-by: Joonas Lahtinen +Link: https://patchwork.freedesktop.org/patch/msgid/20170819120558.6465-1-chris@chris-wilson.co.uk +(cherry picked from commit d0a133f7f5bc3583e460ba6bb54474a50ada5201) +--- + drivers/gpu/drm/drm_gem.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c +index d7f39a03c2c9..966ea63581b1 100644 +--- a/drivers/gpu/drm/drm_gem.c ++++ b/drivers/gpu/drm/drm_gem.c +@@ -255,13 +255,13 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) + struct drm_gem_object *obj = ptr; + struct drm_device *dev = obj->dev; + ++ if (dev->driver->gem_close_object) ++ dev->driver->gem_close_object(obj, file_priv); ++ + if (drm_core_check_feature(dev, DRIVER_PRIME)) + drm_gem_remove_prime_handles(obj, file_priv); + drm_vma_node_revoke(&obj->vma_node, file_priv->filp); + +- if (dev->driver->gem_close_object) +- dev->driver->gem_close_object(obj, file_priv); +- + drm_gem_object_handle_unreference_unlocked(obj); + + return 0; + +From 1d9b65acb4e776f43408afed2b0fd7b86fdb95ce Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 17 Feb 2018 05:30:36 +0100 +Subject: [PATCH] vcodec: skip reduce freq + +--- + drivers/video/rockchip/vcodec/vcodec_service.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/video/rockchip/vcodec/vcodec_service.c b/drivers/video/rockchip/vcodec/vcodec_service.c +index c4ee73be92d3..9d5ee5c8b1f9 100644 +--- a/drivers/video/rockchip/vcodec/vcodec_service.c ++++ b/drivers/video/rockchip/vcodec/vcodec_service.c +@@ -1630,9 +1630,6 @@ static void try_set_reg(struct vpu_subdev_data *data) + reg_from_wait_to_run(pservice, reg); + reg_copy_to_hw(reg->data, reg); + } +- } else { +- if (pservice->hw_ops->reduce_freq) +- pservice->hw_ops->reduce_freq(pservice); + } + + mutex_unlock(&pservice->shutdown_lock); +@@ -2385,6 +2382,7 @@ static void vcodec_set_freq_rk3328(struct vpu_service_info *pservice, + if (curr == reg->freq) + return; + ++ atomic_set(&pservice->freq_status, reg->freq); + if (pservice->dev_id == VCODEC_DEVICE_ID_RKVDEC) { + if (reg->reg[1] & 0x00800000) { + if (rkv_dec_get_fmt(reg->reg) == FMT_H264D) diff --git a/projects/Virtual/README.unsupported b/projects/Virtual/README.unsupported deleted file mode 100644 index cbc5ff4d6a..0000000000 --- a/projects/Virtual/README.unsupported +++ /dev/null @@ -1,9 +0,0 @@ -This is a testing project ONLY for developers. - -You are free to use it but there will be no support at all. - -To be absolutely clear there will be - -=== NO SUPPORT === - -on this project. diff --git a/projects/Virtual/linux/linux.x86_64.conf b/projects/Virtual/linux/linux.x86_64.conf deleted file mode 100644 index 04bef0a7e9..0000000000 --- a/projects/Virtual/linux/linux.x86_64.conf +++ /dev/null @@ -1,5060 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/x86_64 4.9.0 Kernel Configuration -# -CONFIG_64BIT=y -CONFIG_X86_64=y -CONFIG_X86=y -CONFIG_INSTRUCTION_DECODER=y -CONFIG_OUTPUT_FORMAT="elf64-x86-64" -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=28 -CONFIG_ARCH_MMAP_RND_BITS_MAX=32 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_GENERIC_ISA_DMA=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y -CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ZONE_DMA32=y -CONFIG_AUDIT_ARCH=y -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_X86_64_SMP=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_DEBUG_RODATA=y -CONFIG_PGTABLE_LEVELS=4 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -CONFIG_THREAD_INFO_IN_TASK=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_LZ4=y -# CONFIG_KERNEL_GZIP is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_LZMA is not set -CONFIG_KERNEL_XZ=y -# CONFIG_KERNEL_LZO is not set -# CONFIG_KERNEL_LZ4 is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_FHANDLE=y -# CONFIG_USELIB is not set -# CONFIG_AUDIT is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PENDING_IRQ=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y -CONFIG_GENERIC_CMOS_UPDATE=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_RCU_EXPERT is not set -CONFIG_SRCU=y -# CONFIG_TASKS_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_BUILD_BIN2C=y -CONFIG_IKCONFIG=m -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=16 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -CONFIG_NMI_LOG_BUF_SHIFT=13 -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y -CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y -CONFIG_ARCH_SUPPORTS_INT128=y -CONFIG_NUMA_BALANCING=y -CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y -CONFIG_CGROUPS=y -CONFIG_PAGE_COUNTER=y -CONFIG_MEMCG=y -CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -CONFIG_CGROUP_WRITEBACK=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CFS_BANDWIDTH=y -CONFIG_RT_GROUP_SCHED=y -# CONFIG_CGROUP_PIDS is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_CGROUP_PERF=y -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -# CONFIG_USER_NS is not set -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SYSFS_DEPRECATED is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_LZ4 is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_HAVE_PCSPKR_PLATFORM=y -CONFIG_BPF=y -CONFIG_EXPERT=y -# CONFIG_UID16 is not set -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SYSFS_SYSCALL is not set -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y -CONFIG_KALLSYMS_BASE_RELATIVE=y -CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -# CONFIG_BPF_SYSCALL is not set -CONFIG_SHMEM=y -# CONFIG_AIO is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_USERFAULTFD is not set -CONFIG_PCI_QUIRKS=y -CONFIG_MEMBARRIER=y -# CONFIG_EMBEDDED is not set -CONFIG_HAVE_PERF_EVENTS=y - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -# CONFIG_SLAB_FREELIST_RANDOM is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -# CONFIG_PROFILING is not set -CONFIG_HAVE_OPROFILE=y -CONFIG_OPROFILE_NMI_TIMER=y -# CONFIG_KPROBES is not set -CONFIG_JUMP_LABEL=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -# CONFIG_UPROBES is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_KPROBES_ON_FTRACE=y -CONFIG_HAVE_NMI=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y -CONFIG_HAVE_USER_RETURN_NOTIFIER=y -CONFIG_HAVE_PERF_EVENTS_NMI=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP_FILTER=y -CONFIG_HAVE_GCC_PLUGINS=y -# CONFIG_GCC_PLUGINS is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_HAVE_ARCH_SOFT_DIRTY=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_ARCH_MMAP_RND_BITS=28 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8 -CONFIG_HAVE_COPY_THREAD_TLS=y -CONFIG_HAVE_STACK_VALIDATION=y -# CONFIG_HAVE_ARCH_HASH is not set -# CONFIG_ISA_BUS_API is not set -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y -# CONFIG_CPU_NO_EFFICIENT_FFS is not set -CONFIG_HAVE_ARCH_VMAP_STACK=y -# CONFIG_VMAP_STACK is not set - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -CONFIG_BLOCK_COMPAT=y -CONFIG_BLK_MQ_PCI=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -# CONFIG_IOSCHED_DEADLINE is not set -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -CONFIG_DEFAULT_CFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_FREEZER=y - -# -# Processor type and features -# -CONFIG_ZONE_DMA=y -CONFIG_SMP=y -CONFIG_X86_FEATURE_NAMES=y -CONFIG_X86_FAST_FEATURE_TESTS=y -# CONFIG_X86_X2APIC is not set -CONFIG_X86_MPPARSE=y -# CONFIG_GOLDFISH is not set -# CONFIG_X86_EXTENDED_PLATFORM is not set -CONFIG_X86_INTEL_LPSS=y -CONFIG_X86_AMD_PLATFORM_DEVICE=y -CONFIG_IOSF_MBI=y -# CONFIG_IOSF_MBI_DEBUG is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_HYPERVISOR_GUEST=y -CONFIG_PARAVIRT=y -# CONFIG_PARAVIRT_DEBUG is not set -CONFIG_PARAVIRT_SPINLOCKS=y -# CONFIG_QUEUED_LOCK_STAT is not set -# CONFIG_XEN is not set -CONFIG_KVM_GUEST=y -# CONFIG_KVM_DEBUG_FS is not set -CONFIG_PARAVIRT_TIME_ACCOUNTING=y -CONFIG_PARAVIRT_CLOCK=y -CONFIG_NO_BOOTMEM=y -# CONFIG_MK8 is not set -# CONFIG_MPSC is not set -# CONFIG_MCORE2 is not set -# CONFIG_MATOM is not set -CONFIG_GENERIC_CPU=y -CONFIG_X86_INTERNODE_CACHE_SHIFT=6 -CONFIG_X86_L1_CACHE_SHIFT=6 -CONFIG_X86_TSC=y -CONFIG_X86_CMPXCHG64=y -CONFIG_X86_CMOV=y -CONFIG_X86_MINIMUM_CPU_FAMILY=64 -CONFIG_X86_DEBUGCTLMSR=y -# CONFIG_PROCESSOR_SELECT is not set -CONFIG_CPU_SUP_INTEL=y -CONFIG_CPU_SUP_AMD=y -CONFIG_CPU_SUP_CENTAUR=y -CONFIG_HPET_TIMER=y -CONFIG_HPET_EMULATE_RTC=y -CONFIG_DMI=y -CONFIG_GART_IOMMU=y -# CONFIG_CALGARY_IOMMU is not set -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -# CONFIG_MAXSMP is not set -CONFIG_NR_CPUS=16 -CONFIG_SCHED_SMT=y -CONFIG_SCHED_MC=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -CONFIG_X86_LOCAL_APIC=y -CONFIG_X86_IO_APIC=y -# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set -# CONFIG_X86_MCE is not set - -# -# Performance monitoring -# -CONFIG_PERF_EVENTS_INTEL_UNCORE=y -CONFIG_PERF_EVENTS_INTEL_RAPL=y -CONFIG_PERF_EVENTS_INTEL_CSTATE=y -# CONFIG_PERF_EVENTS_AMD_POWER is not set -# CONFIG_VM86 is not set -CONFIG_X86_16BIT=y -CONFIG_X86_ESPFIX64=y -CONFIG_X86_VSYSCALL_EMULATION=y -# CONFIG_I8K is not set -CONFIG_MICROCODE=y -CONFIG_MICROCODE_INTEL=y -CONFIG_MICROCODE_AMD=y -CONFIG_MICROCODE_OLD_INTERFACE=y -CONFIG_X86_MSR=y -CONFIG_X86_CPUID=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_X86_DIRECT_GBPAGES=y -CONFIG_NUMA=y -# CONFIG_AMD_NUMA is not set -CONFIG_X86_64_ACPI_NUMA=y -CONFIG_NODES_SPAN_OTHER_NODES=y -# CONFIG_NUMA_EMU is not set -CONFIG_NODES_SHIFT=6 -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_NEED_MULTIPLE_NODES=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -# CONFIG_MOVABLE_NODE is not set -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -# CONFIG_MEMORY_HOTPLUG is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -CONFIG_MEMORY_BALLOON=y -CONFIG_BALLOON_COMPACTION=y -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_BOUNCE=y -CONFIG_VIRT_TO_BUS=y -CONFIG_MMU_NOTIFIER=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_TRANSPARENT_HUGEPAGE=y -# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set -CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y -CONFIG_TRANSPARENT_HUGE_PAGECACHE=y -CONFIG_CLEANCACHE=y -# CONFIG_FRONTSWAP is not set -# CONFIG_CMA is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -# CONFIG_ZSMALLOC is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y -CONFIG_ARCH_HAS_PKEYS=y -# CONFIG_X86_PMEM_LEGACY is not set -CONFIG_X86_CHECK_BIOS_CORRUPTION=y -CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y -CONFIG_X86_RESERVE_LOW=64 -CONFIG_MTRR=y -CONFIG_MTRR_SANITIZER=y -CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0 -CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1 -CONFIG_X86_PAT=y -CONFIG_ARCH_USES_PG_UNCACHED=y -CONFIG_ARCH_RANDOM=y -# CONFIG_X86_SMAP is not set -# CONFIG_X86_INTEL_MPX is not set -CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y -CONFIG_EFI=y -CONFIG_EFI_STUB=y -CONFIG_EFI_MIXED=y -CONFIG_SECCOMP=y -# CONFIG_HZ_100 is not set -# CONFIG_HZ_250 is not set -CONFIG_HZ_300=y -# CONFIG_HZ_1000 is not set -CONFIG_HZ=300 -CONFIG_SCHED_HRTICK=y -# CONFIG_KEXEC is not set -# CONFIG_KEXEC_FILE is not set -# CONFIG_CRASH_DUMP is not set -CONFIG_PHYSICAL_START=0x1000000 -CONFIG_RELOCATABLE=y -# CONFIG_RANDOMIZE_BASE is not set -CONFIG_PHYSICAL_ALIGN=0x1000000 -CONFIG_HOTPLUG_CPU=y -# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set -# CONFIG_DEBUG_HOTPLUG_CPU0 is not set -# CONFIG_COMPAT_VDSO is not set -# CONFIG_LEGACY_VSYSCALL_NATIVE is not set -CONFIG_LEGACY_VSYSCALL_EMULATE=y -# CONFIG_LEGACY_VSYSCALL_NONE is not set -CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init usbcore.autosuspend=-1" -# CONFIG_CMDLINE_OVERRIDE is not set -CONFIG_MODIFY_LDT_SYSCALL=y -CONFIG_HAVE_LIVEPATCH=y -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -CONFIG_USE_PERCPU_NUMA_NODE_ID=y - -# -# Power management and ACPI options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SUSPEND_SKIP_SYNC is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -CONFIG_PM=y -CONFIG_PM_DEBUG=y -# CONFIG_PM_ADVANCED_DEBUG is not set -CONFIG_PM_TEST_SUSPEND=y -CONFIG_PM_SLEEP_DEBUG=y -# CONFIG_PM_TRACE_RTC is not set -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_PM_GENERIC_DOMAINS_SLEEP=y -CONFIG_ACPI=y -CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y -CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y -CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y -# CONFIG_ACPI_DEBUGGER is not set -CONFIG_ACPI_SLEEP=y -# CONFIG_ACPI_PROCFS_POWER is not set -CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y -# CONFIG_ACPI_EC_DEBUGFS is not set -# CONFIG_ACPI_AC is not set -CONFIG_ACPI_BATTERY=y -CONFIG_ACPI_BUTTON=y -CONFIG_ACPI_VIDEO=y -CONFIG_ACPI_FAN=y -# CONFIG_ACPI_DOCK is not set -CONFIG_ACPI_CPU_FREQ_PSS=y -CONFIG_ACPI_PROCESSOR_CSTATE=y -CONFIG_ACPI_PROCESSOR_IDLE=y -CONFIG_ACPI_PROCESSOR=y -CONFIG_ACPI_HOTPLUG_CPU=y -CONFIG_ACPI_PROCESSOR_AGGREGATOR=y -CONFIG_ACPI_THERMAL=y -CONFIG_ACPI_NUMA=y -# CONFIG_ACPI_CUSTOM_DSDT is not set -CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y -CONFIG_ACPI_TABLE_UPGRADE=y -# CONFIG_ACPI_DEBUG is not set -# CONFIG_ACPI_PCI_SLOT is not set -CONFIG_X86_PM_TIMER=y -CONFIG_ACPI_CONTAINER=y -CONFIG_ACPI_HOTPLUG_IOAPIC=y -# CONFIG_ACPI_SBS is not set -# CONFIG_ACPI_HED is not set -# CONFIG_ACPI_CUSTOM_METHOD is not set -# CONFIG_ACPI_BGRT is not set -# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set -# CONFIG_ACPI_NFIT is not set -CONFIG_HAVE_ACPI_APEI=y -CONFIG_HAVE_ACPI_APEI_NMI=y -# CONFIG_ACPI_APEI is not set -# CONFIG_DPTF_POWER is not set -# CONFIG_PMIC_OPREGION is not set -# CONFIG_ACPI_CONFIGFS is not set -# CONFIG_SFI is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set - -# -# CPU frequency scaling drivers -# -CONFIG_X86_INTEL_PSTATE=y -CONFIG_X86_PCC_CPUFREQ=m -CONFIG_X86_ACPI_CPUFREQ=y -CONFIG_X86_ACPI_CPUFREQ_CPB=y -CONFIG_X86_POWERNOW_K8=y -CONFIG_X86_AMD_FREQ_SENSITIVITY=m -# CONFIG_X86_SPEEDSTEP_CENTRINO is not set -CONFIG_X86_P4_CLOCKMOD=y - -# -# shared options -# -CONFIG_X86_SPEEDSTEP_LIB=y - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -CONFIG_INTEL_IDLE=y - -# -# Memory power savings -# -# CONFIG_I7300_IDLE is not set - -# -# Bus options (PCI etc.) -# -CONFIG_PCI=y -CONFIG_PCI_DIRECT=y -CONFIG_PCI_MMCONFIG=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCI_CNB20LE_QUIRK is not set -CONFIG_PCIEPORTBUS=y -CONFIG_PCIEAER=y -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIEAER_INJECT is not set -CONFIG_PCIEASPM=y -# CONFIG_PCIEASPM_DEBUG is not set -CONFIG_PCIEASPM_DEFAULT=y -# CONFIG_PCIEASPM_POWERSAVE is not set -# CONFIG_PCIEASPM_PERFORMANCE is not set -CONFIG_PCIE_PME=y -# CONFIG_PCIE_DPC is not set -# CONFIG_PCIE_PTM is not set -CONFIG_PCI_BUS_ADDR_T_64BIT=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -CONFIG_HT_IRQ=y -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set -CONFIG_PCI_LABEL=y -# CONFIG_HOTPLUG_PCI is not set - -# -# PCI host controller drivers -# -# CONFIG_PCIE_DW_PLAT is not set -# CONFIG_VMD is not set -# CONFIG_ISA_BUS is not set -CONFIG_ISA_DMA_API=y -CONFIG_AMD_NB=y -# CONFIG_PCCARD is not set -# CONFIG_RAPIDIO is not set -# CONFIG_X86_SYSFB is not set - -# -# Executable file formats / Emulations -# -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_ELFCORE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_COREDUMP=y -CONFIG_IA32_EMULATION=y -# CONFIG_IA32_AOUT is not set -# CONFIG_X86_X32 is not set -CONFIG_COMPAT=y -CONFIG_COMPAT_FOR_U64_ALIGNMENT=y -CONFIG_SYSVIPC_COMPAT=y -CONFIG_KEYS_COMPAT=y -CONFIG_X86_DEV_DMA_OPS=y -CONFIG_PMC_ATOM=y -CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_NET_UDP_TUNNEL is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_ILA is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_FOU is not set -# CONFIG_IPV6_FOU_TUNNEL is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_NETWORK_SECMARK is not set -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=m - -# -# Core Netfilter Configuration -# -# CONFIG_NETFILTER_INGRESS is not set -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_NAT_REDIRECT is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -CONFIG_NETFILTER_XT_NAT=m -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -# CONFIG_NF_DUP_IPV4 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -CONFIG_NF_REJECT_IPV4=m -CONFIG_NF_NAT_IPV4=m -CONFIG_NF_NAT_MASQUERADE_IPV4=m -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -# CONFIG_NF_DUP_IPV6 is not set -CONFIG_NF_REJECT_IPV6=m -# CONFIG_NF_LOG_IPV6 is not set -CONFIG_NF_NAT_IPV6=m -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_RAW is not set -CONFIG_IP6_NF_NAT=m -# CONFIG_IP6_NF_TARGET_MASQUERADE is not set -# CONFIG_IP6_NF_TARGET_NPT is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_MPLS is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_NET_NCSI is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -# CONFIG_SOCK_CGROUP_DATA is not set -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_BREDR=y -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_HIDP=m -CONFIG_BT_HS=y -CONFIG_BT_LE=y -# CONFIG_BT_LEDS is not set -# CONFIG_BT_SELFTEST is not set -# CONFIG_BT_DEBUGFS is not set - -# -# Bluetooth device drivers -# -CONFIG_BT_INTEL=m -CONFIG_BT_BCM=m -CONFIG_BT_RTL=m -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTUSB_BCM=y -CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_MRVL is not set -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_KCM is not set -# CONFIG_STREAM_PARSER is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_INTERNAL_REGDB=y -# CONFIG_CFG80211_CRDA_SUPPORT is not set -CONFIG_CFG80211_WEXT=y -CONFIG_CFG80211_WEXT_EXPORT=y -CONFIG_LIB80211=m -CONFIG_LIB80211_CRYPT_WEP=m -CONFIG_LIB80211_CRYPT_CCMP=m -CONFIG_LIB80211_CRYPT_TKIP=m -# CONFIG_LIB80211_DEBUG is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_MINSTREL_VHT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set -CONFIG_RFKILL=m -CONFIG_RFKILL_LEDS=y -CONFIG_RFKILL_INPUT=y -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -# CONFIG_LWTUNNEL is not set -CONFIG_DST_CACHE=y -# CONFIG_NET_DEVLINK is not set -CONFIG_MAY_USE_DEVLINK=y -CONFIG_HAVE_EBPF_JIT=y - -# -# Device Drivers -# - -# -# Generic Driver Options -# -# CONFIG_UEVENT_HELPER is not set -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_FIRMWARE_DIR="external-firmware" -# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -CONFIG_WANT_DEV_COREDUMP=y -# CONFIG_ALLOW_DEV_COREDUMP is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_FENCE_TRACE is not set - -# -# Bus devices -# -CONFIG_CONNECTOR=y -CONFIG_PROC_EVENTS=y -# CONFIG_MTD is not set -# CONFIG_OF is not set -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_PARPORT is not set -CONFIG_PNP=y -# CONFIG_PNP_DEBUG_MESSAGES is not set - -# -# Protocols -# -CONFIG_PNPACPI=y -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -CONFIG_BLK_DEV_NBD=y -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=16384 -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -CONFIG_VIRTIO_BLK=y -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -CONFIG_NVME_CORE=y -CONFIG_BLK_DEV_NVME=y -# CONFIG_BLK_DEV_NVME_SCSI is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_IBM_ASM is not set -# CONFIG_PHANTOM is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -CONFIG_ALTERA_STAPL=m -# CONFIG_INTEL_MEI is not set -# CONFIG_INTEL_MEI_ME is not set -# CONFIG_INTEL_MEI_TXE is not set -# CONFIG_VMWARE_VMCI is not set - -# -# Intel MIC Bus Driver -# -# CONFIG_INTEL_MIC_BUS is not set - -# -# SCIF Bus Driver -# -# CONFIG_SCIF_BUS is not set - -# -# VOP Bus Driver -# -# CONFIG_VOP_BUS is not set - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# - -# -# VOP Driver -# -# CONFIG_GENWQE is not set -# CONFIG_ECHO is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_AFU_DRIVER_OPS is not set -CONFIG_HAVE_IDE=y -# CONFIG_IDE is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -CONFIG_CHR_DEV_SG=y -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -CONFIG_SCSI_SCAN_ASYNC=y - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -CONFIG_SCSI_SAS_ATTRS=y -CONFIG_SCSI_SAS_LIBSAS=y -CONFIG_SCSI_SAS_ATA=y -CONFIG_SCSI_SAS_HOST_SMP=y -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -CONFIG_SCSI_MVSAS=y -# CONFIG_SCSI_MVSAS_DEBUG is not set -# CONFIG_SCSI_MVSAS_TASKLET is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_DPT_I2O is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -CONFIG_MEGARAID_SAS=y -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_SMARTPQI is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_VMWARE_PVSCSI is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_ISCI is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_ATA=y -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_VERBOSE_ERROR is not set -CONFIG_ATA_ACPI=y -# CONFIG_SATA_ZPODD is not set -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -CONFIG_SATA_SIL24=y -CONFIG_ATA_SFF=y - -# -# SFF controllers with custom DMA interface -# -# CONFIG_PDC_ADMA is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SX4 is not set -CONFIG_ATA_BMDMA=y - -# -# SATA SFF controllers with BMDMA -# -CONFIG_ATA_PIIX=y -# CONFIG_SATA_DWC is not set -# CONFIG_SATA_MV is not set -CONFIG_SATA_NV=y -# CONFIG_SATA_PROMISE is not set -CONFIG_SATA_SIL=y -CONFIG_SATA_SIS=y -# CONFIG_SATA_SVW is not set -CONFIG_SATA_ULI=y -CONFIG_SATA_VIA=y -# CONFIG_SATA_VITESSE is not set - -# -# PATA SFF controllers with BMDMA -# -CONFIG_PATA_ALI=y -CONFIG_PATA_AMD=y -# CONFIG_PATA_ARTOP is not set -CONFIG_PATA_ATIIXP=y -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -CONFIG_PATA_JMICRON=y -CONFIG_PATA_MARVELL=y -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -CONFIG_PATA_SIS=y -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -CONFIG_PATA_VIA=y -# CONFIG_PATA_WINBOND is not set - -# -# PIO-only SFF controllers -# -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_RZ1000 is not set - -# -# Generic fallback / legacy drivers -# -CONFIG_PATA_ACPI=y -CONFIG_ATA_GENERIC=y -# CONFIG_PATA_LEGACY is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -CONFIG_FIREWIRE=m -CONFIG_FIREWIRE_OHCI=m -CONFIG_FIREWIRE_SBP2=m -# CONFIG_FIREWIRE_NET is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_FC is not set -# CONFIG_NET_TEAM is not set -CONFIG_MACVLAN=m -# CONFIG_MACVTAP is not set -# CONFIG_VXLAN is not set -# CONFIG_MACSEC is not set -CONFIG_NETCONSOLE=y -CONFIG_NETPOLL=y -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -# CONFIG_TUN_VNET_CROSS_LE is not set -CONFIG_VETH=m -CONFIG_VIRTIO_NET=y -# CONFIG_NLMON is not set -# CONFIG_ARCNET is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -CONFIG_ETHERNET=y -CONFIG_MDIO=y -CONFIG_NET_VENDOR_3COM=y -CONFIG_VORTEX=y -# CONFIG_TYPHOON is not set -# CONFIG_NET_VENDOR_ADAPTEC is not set -# CONFIG_NET_VENDOR_AGERE is not set -# CONFIG_NET_VENDOR_ALTEON is not set -# CONFIG_ALTERA_TSE is not set -# CONFIG_NET_VENDOR_AMAZON is not set -CONFIG_NET_VENDOR_AMD=y -# CONFIG_AMD8111_ETH is not set -CONFIG_PCNET32=y -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ATHEROS=y -CONFIG_ATL2=y -CONFIG_ATL1=y -CONFIG_ATL1E=y -CONFIG_ATL1C=y -CONFIG_ALX=y -# CONFIG_NET_VENDOR_AURORA is not set -# CONFIG_NET_CADENCE is not set -CONFIG_NET_VENDOR_BROADCOM=y -CONFIG_B44=y -CONFIG_B44_PCI_AUTOSELECT=y -CONFIG_B44_PCICORE_AUTOSELECT=y -CONFIG_B44_PCI=y -# CONFIG_BCMGENET is not set -CONFIG_BNX2=y -CONFIG_CNIC=y -CONFIG_TIGON3=y -# CONFIG_BNX2X is not set -# CONFIG_BNXT is not set -# CONFIG_NET_VENDOR_BROCADE is not set -CONFIG_NET_VENDOR_CAVIUM=y -# CONFIG_THUNDER_NIC_PF is not set -# CONFIG_THUNDER_NIC_VF is not set -# CONFIG_THUNDER_NIC_BGX is not set -# CONFIG_THUNDER_NIC_RGX is not set -# CONFIG_LIQUIDIO is not set -# CONFIG_NET_VENDOR_CHELSIO is not set -# CONFIG_NET_VENDOR_CISCO is not set -# CONFIG_CX_ECAT is not set -# CONFIG_DNET is not set -CONFIG_NET_VENDOR_DEC=y -CONFIG_NET_TULIP=y -# CONFIG_DE2104X is not set -# CONFIG_TULIP is not set -# CONFIG_DE4X5 is not set -# CONFIG_WINBOND_840 is not set -# CONFIG_DM9102 is not set -CONFIG_ULI526X=y -# CONFIG_NET_VENDOR_DLINK is not set -# CONFIG_NET_VENDOR_EMULEX is not set -CONFIG_NET_VENDOR_EZCHIP=y -# CONFIG_NET_VENDOR_EXAR is not set -# CONFIG_NET_VENDOR_HP is not set -CONFIG_NET_VENDOR_INTEL=y -CONFIG_E100=y -CONFIG_E1000=y -CONFIG_E1000E=y -CONFIG_E1000E_HWTS=y -CONFIG_IGB=y -CONFIG_IGB_HWMON=y -# CONFIG_IGBVF is not set -CONFIG_IXGB=y -CONFIG_IXGBE=y -CONFIG_IXGBE_HWMON=y -# CONFIG_IXGBEVF is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_FM10K is not set -CONFIG_NET_VENDOR_I825XX=y -CONFIG_JME=y -CONFIG_NET_VENDOR_MARVELL=y -# CONFIG_MVMDIO is not set -# CONFIG_MVNETA_BM is not set -CONFIG_SKGE=y -# CONFIG_SKGE_DEBUG is not set -CONFIG_SKGE_GENESIS=y -CONFIG_SKY2=y -# CONFIG_SKY2_DEBUG is not set -# CONFIG_NET_VENDOR_MELLANOX is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MYRI is not set -# CONFIG_FEALNX is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -CONFIG_NET_VENDOR_NETRONOME=y -# CONFIG_NFP_NETVF is not set -CONFIG_NET_VENDOR_NVIDIA=y -CONFIG_FORCEDETH=y -# CONFIG_NET_VENDOR_OKI is not set -# CONFIG_ETHOC is not set -# CONFIG_NET_PACKET_ENGINE is not set -CONFIG_NET_VENDOR_QLOGIC=y -CONFIG_QLA3XXX=y -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_QED is not set -# CONFIG_NET_VENDOR_QUALCOMM is not set -CONFIG_NET_VENDOR_REALTEK=y -# CONFIG_8139CP is not set -CONFIG_8139TOO=y -# CONFIG_8139TOO_PIO is not set -# CONFIG_8139TOO_TUNE_TWISTER is not set -# CONFIG_8139TOO_8129 is not set -# CONFIG_8139_OLD_RX_RESET is not set -CONFIG_R8169=y -CONFIG_NET_VENDOR_RENESAS=y -# CONFIG_NET_VENDOR_RDC is not set -CONFIG_NET_VENDOR_ROCKER=y -# CONFIG_NET_VENDOR_SAMSUNG is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SILAN is not set -CONFIG_NET_VENDOR_SIS=y -CONFIG_SIS900=y -CONFIG_SIS190=y -# CONFIG_SFC is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -# CONFIG_NET_VENDOR_SUN is not set -CONFIG_NET_VENDOR_SYNOPSYS=y -# CONFIG_NET_VENDOR_TEHUTI is not set -# CONFIG_NET_VENDOR_TI is not set -CONFIG_NET_VENDOR_VIA=y -CONFIG_VIA_RHINE=y -# CONFIG_VIA_RHINE_MMIO is not set -CONFIG_VIA_VELOCITY=y -# CONFIG_NET_VENDOR_WIZNET is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_NET_SB1000 is not set -CONFIG_PHYLIB=y - -# -# MDIO bus device drivers -# -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_OCTEON is not set -# CONFIG_MDIO_THUNDER is not set - -# -# MII PHY device drivers -# -CONFIG_AMD_PHY=y -# CONFIG_AQUANTIA_PHY is not set -CONFIG_AT803X_PHY=y -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -CONFIG_BCM_NET_PHYLIB=y -CONFIG_BROADCOM_PHY=y -# CONFIG_CICADA_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -# CONFIG_FIXED_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_INTEL_XWAY_PHY is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LXT_PHY is not set -CONFIG_MARVELL_PHY=y -# CONFIG_MICREL_PHY is not set -# CONFIG_MICROCHIP_PHY is not set -# CONFIG_MICROSEMI_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_QSEMI_PHY is not set -CONFIG_REALTEK_PHY=y -# CONFIG_SMSC_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_XILINX_GMII2RGMII is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=m -CONFIG_USB_NET_DRIVERS=y -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -# CONFIG_USB_LAN78XX is not set -CONFIG_USB_USBNET=m -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=m -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -CONFIG_USB_NET_SMSC75XX=m -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -CONFIG_USB_HSO=m -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -# CONFIG_USB_NET_CH9200 is not set -CONFIG_WLAN=y -CONFIG_WLAN_VENDOR_ADMTEK=y -# CONFIG_ADM8211 is not set -CONFIG_ATH_COMMON=m -CONFIG_WLAN_VENDOR_ATH=y -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH5K=m -# CONFIG_ATH5K_DEBUG is not set -CONFIG_ATH5K_PCI=y -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_PCI=y -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_DYNACK is not set -# CONFIG_ATH9K_WOW is not set -CONFIG_ATH9K_RFKILL=y -# CONFIG_ATH9K_CHANNEL_CONTEXT is not set -CONFIG_ATH9K_PCOEM=y -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_ATH9K_HWRNG=y -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -# CONFIG_CARL9170_HWRNG is not set -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -CONFIG_AR5523=m -# CONFIG_WIL6210 is not set -# CONFIG_ATH10K is not set -CONFIG_WCN36XX=m -# CONFIG_WCN36XX_DEBUGFS is not set -CONFIG_WLAN_VENDOR_ATMEL=y -CONFIG_ATMEL=m -CONFIG_PCI_ATMEL=m -# CONFIG_AT76C50X_USB is not set -CONFIG_WLAN_VENDOR_BROADCOM=y -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_PROTO_BCDC=y -CONFIG_BRCMFMAC_PROTO_MSGBUF=y -# CONFIG_BRCMFMAC_SDIO is not set -CONFIG_BRCMFMAC_USB=y -CONFIG_BRCMFMAC_PCIE=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -CONFIG_WLAN_VENDOR_CISCO=y -# CONFIG_AIRO is not set -CONFIG_WLAN_VENDOR_INTEL=y -CONFIG_IPW2100=m -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2100_DEBUG is not set -CONFIG_IPW2200=m -CONFIG_IPW2200_MONITOR=y -CONFIG_IPW2200_RADIOTAP=y -CONFIG_IPW2200_PROMISCUOUS=y -CONFIG_IPW2200_QOS=y -# CONFIG_IPW2200_DEBUG is not set -CONFIG_LIBIPW=m -# CONFIG_LIBIPW_DEBUG is not set -CONFIG_IWLEGACY=m -CONFIG_IWL4965=m -CONFIG_IWL3945=m - -# -# iwl3945 / iwl4965 Debugging Options -# -# CONFIG_IWLEGACY_DEBUG is not set -CONFIG_IWLWIFI=m -CONFIG_IWLWIFI_LEDS=y -CONFIG_IWLDVM=m -CONFIG_IWLMVM=m -CONFIG_IWLWIFI_OPMODE_MODULAR=y -# CONFIG_IWLWIFI_BCAST_FILTERING is not set -# CONFIG_IWLWIFI_PCIE_RTPM is not set - -# -# Debugging Options -# -# CONFIG_IWLWIFI_DEBUG is not set -CONFIG_WLAN_VENDOR_INTERSIL=y -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y -CONFIG_HOSTAP_FIRMWARE_NVRAM=y -# CONFIG_HOSTAP_PLX is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_HERMES is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -CONFIG_P54_PCI=m -CONFIG_P54_LEDS=y -# CONFIG_PRISM54 is not set -CONFIG_WLAN_VENDOR_MARVELL=y -CONFIG_LIBERTAS=m -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LIBERTAS_SDIO is not set -# CONFIG_LIBERTAS_DEBUG is not set -# CONFIG_LIBERTAS_MESH is not set -CONFIG_LIBERTAS_THINFIRM=m -# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set -CONFIG_LIBERTAS_THINFIRM_USB=m -# CONFIG_MWIFIEX is not set -# CONFIG_MWL8K is not set -CONFIG_WLAN_VENDOR_MEDIATEK=y -CONFIG_MT7601U=m -CONFIG_WLAN_VENDOR_RALINK=y -CONFIG_RT2X00=m -CONFIG_RT2400PCI=m -CONFIG_RT2500PCI=m -CONFIG_RT61PCI=m -CONFIG_RT2800PCI=m -CONFIG_RT2800PCI_RT33XX=y -CONFIG_RT2800PCI_RT35XX=y -CONFIG_RT2800PCI_RT53XX=y -CONFIG_RT2800PCI_RT3290=y -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2800_LIB_MMIO=m -CONFIG_RT2X00_LIB_MMIO=m -CONFIG_RT2X00_LIB_PCI=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_WLAN_VENDOR_REALTEK=y -CONFIG_RTL8180=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -CONFIG_RTL_CARDS=m -CONFIG_RTL8192CE=m -CONFIG_RTL8192SE=m -CONFIG_RTL8192DE=m -CONFIG_RTL8723AE=m -CONFIG_RTL8723BE=m -CONFIG_RTL8188EE=m -CONFIG_RTL8192EE=m -CONFIG_RTL8821AE=m -# CONFIG_RTL8192CU is not set -CONFIG_RTLWIFI=m -CONFIG_RTLWIFI_PCI=m -# CONFIG_RTLWIFI_DEBUG is not set -CONFIG_RTL8192C_COMMON=m -CONFIG_RTL8723_COMMON=m -CONFIG_RTLBTCOEXIST=m -CONFIG_RTL8XXXU=m -CONFIG_RTL8XXXU_UNTESTED=y -CONFIG_WLAN_VENDOR_RSI=y -# CONFIG_RSI_91X is not set -CONFIG_WLAN_VENDOR_ST=y -# CONFIG_CW1200 is not set -CONFIG_WLAN_VENDOR_TI=y -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -# CONFIG_WLCORE is not set -CONFIG_WLAN_VENDOR_ZYDAS=y -CONFIG_USB_ZD1201=m -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MAC80211_HWSIM is not set -CONFIG_USB_NET_RNDIS_WLAN=m - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_VMXNET3 is not set -# CONFIG_FUJITSU_ES is not set -# CONFIG_ISDN is not set -# CONFIG_NVM is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_GPIO is not set -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_MATRIX is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_BYD=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -CONFIG_MOUSE_PS2_CYPRESS=y -CONFIG_MOUSE_PS2_LIFEBOOK=y -CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -# CONFIG_MOUSE_PS2_FOCALTECH is not set -# CONFIG_MOUSE_PS2_VMMOUSE is not set -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -# CONFIG_MOUSE_ELAN_I2C is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_INPUT_TABLET is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_EKTF2127 is not set -CONFIG_TOUCHSCREEN_ELAN=y -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -CONFIG_TOUCHSCREEN_USB_EGALAX=y -# CONFIG_TOUCHSCREEN_USB_PANJIT is not set -CONFIG_TOUCHSCREEN_USB_3M=y -# CONFIG_TOUCHSCREEN_USB_ITM is not set -# CONFIG_TOUCHSCREEN_USB_ETURBO is not set -# CONFIG_TOUCHSCREEN_USB_GUNZE is not set -# CONFIG_TOUCHSCREEN_USB_DMC_TSC10 is not set -# CONFIG_TOUCHSCREEN_USB_IRTOUCH is not set -# CONFIG_TOUCHSCREEN_USB_IDEALTEK is not set -# CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH is not set -# CONFIG_TOUCHSCREEN_USB_GOTOP is not set -# CONFIG_TOUCHSCREEN_USB_JASTEC is not set -# CONFIG_TOUCHSCREEN_USB_ELO is not set -# CONFIG_TOUCHSCREEN_USB_E2I is not set -# CONFIG_TOUCHSCREEN_USB_ZYTRONIC is not set -# CONFIG_TOUCHSCREEN_USB_ETT_TC45USB is not set -# CONFIG_TOUCHSCREEN_USB_NEXIO is not set -CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_RM_TS is not set -# CONFIG_TOUCHSCREEN_SILEAD is not set -# CONFIG_TOUCHSCREEN_SIS_I2C is not set -CONFIG_TOUCHSCREEN_ST1232=m -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_APANEL is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_GPIO_DECODER is not set -# CONFIG_INPUT_ATLAS_BTNS is not set -CONFIG_INPUT_ATI_REMOTE2=m -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_RMI4_CORE is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_USERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_NOZOMI is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -# CONFIG_DEVKMEM is not set - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -CONFIG_SERIAL_8250_PNP=y -# CONFIG_SERIAL_8250_FINTEK is not set -# CONFIG_SERIAL_8250_CONSOLE is not set -CONFIG_SERIAL_8250_DMA=y -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_RT288X is not set -# CONFIG_SERIAL_8250_LPSS is not set -# CONFIG_SERIAL_8250_MID is not set -# CONFIG_SERIAL_8250_MOXA is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_TTY_PRINTK is not set -CONFIG_HVC_DRIVER=y -CONFIG_VIRTIO_CONSOLE=y -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=m -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -CONFIG_HW_RANDOM_INTEL=m -CONFIG_HW_RANDOM_AMD=m -# CONFIG_HW_RANDOM_VIA is not set -CONFIG_HW_RANDOM_VIRTIO=m -# CONFIG_NVRAM is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set -# CONFIG_MWAVE is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_HPET is not set -# CONFIG_HANGCHECK_TIMER is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TELCLOCK is not set -CONFIG_DEVPORT=y -# CONFIG_XILLYBUS is not set - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_ACPI_I2C_OPREGION=y -CONFIG_I2C_BOARDINFO=y -# CONFIG_I2C_COMPAT is not set -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=m - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MUX_REG is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_SMBUS=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -CONFIG_I2C_I801=y -CONFIG_I2C_ISCH=y -# CONFIG_I2C_ISMT is not set -CONFIG_I2C_PIIX4=y -CONFIG_I2C_NFORCE2=y -# CONFIG_I2C_NFORCE2_S4985 is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -CONFIG_I2C_VIA=y -CONFIG_I2C_VIAPRO=y - -# -# ACPI drivers -# -# CONFIG_I2C_SCMI is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -CONFIG_I2C_DESIGNWARE_CORE=y -CONFIG_I2C_DESIGNWARE_PLATFORM=y -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set -# CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_SPI is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -CONFIG_GENERIC_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -CONFIG_PINCTRL_BAYTRAIL=y -CONFIG_PINCTRL_CHERRYVIEW=y -# CONFIG_PINCTRL_BROXTON is not set -# CONFIG_PINCTRL_SUNRISEPOINT is not set -CONFIG_GPIOLIB=y -CONFIG_GPIO_ACPI=y -CONFIG_GPIOLIB_IRQCHIP=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_GPIO_SYSFS is not set - -# -# Memory mapped GPIO drivers -# -# CONFIG_GPIO_AMDPT is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_ICH is not set -# CONFIG_GPIO_LYNXPOINT is not set -# CONFIG_GPIO_MOCKUP is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_ZX is not set - -# -# Port-mapped I/O GPIO drivers -# -# CONFIG_GPIO_F7188X is not set -# CONFIG_GPIO_IT87 is not set -# CONFIG_GPIO_SCH is not set -# CONFIG_GPIO_SCH311X is not set - -# -# I2C GPIO expanders -# -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_TPIC2810 is not set -# CONFIG_GPIO_TS4900 is not set - -# -# MFD GPIO expanders -# - -# -# PCI GPIO expanders -# -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_RDC321X is not set - -# -# SPI or I2C GPIO expanders -# - -# -# USB GPIO expanders -# -# CONFIG_W1 is not set -# CONFIG_POWER_AVS is not set -# CONFIG_POWER_RESET is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_CHARGER_RT9455 is not set -CONFIG_HWMON=y -CONFIG_HWMON_VID=y -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_ABITUGURU is not set -# CONFIG_SENSORS_ABITUGURU3 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -CONFIG_SENSORS_K8TEMP=m -CONFIG_SENSORS_K10TEMP=m -CONFIG_SENSORS_FAM15H_POWER=m -# CONFIG_SENSORS_APPLESMC is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_DELL_SMM is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FSCHMD is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_I5500 is not set -CONFIG_SENSORS_CORETEMP=y -CONFIG_SENSORS_IT87=m -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VIA_CPUTEMP is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -CONFIG_SENSORS_W83627EHF=y - -# -# ACPI drivers -# -# CONFIG_SENSORS_ACPI_POWER is not set -CONFIG_SENSORS_ATK0110=m -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_EMULATION is not set -CONFIG_INTEL_POWERCLAMP=m -CONFIG_INTEL_SOC_DTS_IOSF_CORE=m -CONFIG_INTEL_SOC_DTS_THERMAL=m - -# -# ACPI INT340X thermal drivers -# -# CONFIG_INT340X_THERMAL is not set -# CONFIG_INTEL_PCH_THERMAL is not set -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=y -CONFIG_SSB_SPROM=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -# CONFIG_SSB_B43_PCI_BRIDGE is not set -CONFIG_SSB_SDIOHOST_POSSIBLE=y -CONFIG_SSB_SDIOHOST=y -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_DRIVER_PCICORE=y -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -CONFIG_BCMA=m -CONFIG_BCMA_HOST_PCI_POSSIBLE=y -CONFIG_BCMA_HOST_PCI=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCMA_DRIVER_PCI=y -CONFIG_BCMA_DRIVER_GMAC_CMN=y -# CONFIG_BCMA_DRIVER_GPIO is not set -# CONFIG_BCMA_DEBUG is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_AS3711 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_EXYNOS_LPASS is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_MFD_INTEL_QUARK_I2C_GPIO is not set -# CONFIG_LPC_ICH is not set -CONFIG_LPC_SCH=y -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_MFD_INTEL_LPSS_ACPI is not set -# CONFIG_MFD_INTEL_LPSS_PCI is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_MFD_RDC321X is not set -CONFIG_MFD_RTSX_PCI=y -# CONFIG_MFD_RT5033 is not set -CONFIG_MFD_RTSX_USB=y -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TPS65218 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_REGULATOR is not set -CONFIG_MEDIA_SUPPORT=m - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=m -CONFIG_VIDEO_V4L2=m -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=m -CONFIG_VIDEOBUF_DMA_SG=m -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=m -CONFIG_VIDEOBUF2_MEMOPS=m -CONFIG_VIDEOBUF2_VMALLOC=m -CONFIG_VIDEOBUF2_DMA_SG=m -CONFIG_VIDEOBUF2_DVB=m -CONFIG_DVB_CORE=m -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=m -CONFIG_RC_MAP=m -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_SHARP_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_IR_XMP_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -CONFIG_IR_ENE=m -# CONFIG_IR_HIX5HD2 is not set -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_ITE_CIR=m -CONFIG_IR_FINTEK=m -CONFIG_IR_NUVOTON=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_WINBOND_CIR=m -CONFIG_IR_IGORPLUGUSB=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -# CONFIG_IR_GPIO_CIR is not set -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -CONFIG_VIDEO_USBTV=m - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_USBVISION is not set -CONFIG_VIDEO_STK1160_COMMON=m -# CONFIG_VIDEO_STK1160_AC97 is not set -CONFIG_VIDEO_STK1160=m -# CONFIG_VIDEO_GO7007 is not set - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_AU0828_RC=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -CONFIG_DVB_USB_DIB3000MC=m -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -# CONFIG_DVB_USB_GL861 is not set -CONFIG_DVB_USB_LME2510=m -# CONFIG_DVB_USB_MXL111SF is not set -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_DVB_USB_DVBSKY=m -# CONFIG_DVB_TTUSB_BUDGET is not set -# CONFIG_DVB_TTUSB_DEC is not set -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set -CONFIG_DVB_AS102=m - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -# CONFIG_VIDEO_EM28XX_V4L2 is not set -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -CONFIG_MEDIA_PCI_SUPPORT=y - -# -# Media capture support -# -# CONFIG_VIDEO_SOLO6X10 is not set -# CONFIG_VIDEO_TW5864 is not set -# CONFIG_VIDEO_TW68 is not set -# CONFIG_VIDEO_TW686X is not set -# CONFIG_VIDEO_ZORAN is not set - -# -# Media capture/analog TV support -# -# CONFIG_VIDEO_IVTV is not set -# CONFIG_VIDEO_HEXIUM_GEMINI is not set -# CONFIG_VIDEO_HEXIUM_ORION is not set -# CONFIG_VIDEO_MXB is not set -# CONFIG_VIDEO_DT3155 is not set - -# -# Media capture/analog/hybrid TV support -# -CONFIG_VIDEO_CX18=m -# CONFIG_VIDEO_CX18_ALSA is not set -CONFIG_VIDEO_CX23885=m -CONFIG_MEDIA_ALTERA_CI=m -# CONFIG_VIDEO_CX25821 is not set -CONFIG_VIDEO_CX88=m -# CONFIG_VIDEO_CX88_ALSA is not set -# CONFIG_VIDEO_CX88_BLACKBIRD is not set -CONFIG_VIDEO_CX88_DVB=m -CONFIG_VIDEO_CX88_ENABLE_VP3054=y -CONFIG_VIDEO_CX88_VP3054=m -CONFIG_VIDEO_CX88_MPEG=m -CONFIG_VIDEO_SAA7134=m -# CONFIG_VIDEO_SAA7134_ALSA is not set -CONFIG_VIDEO_SAA7134_RC=y -CONFIG_VIDEO_SAA7134_DVB=m -CONFIG_VIDEO_SAA7164=m - -# -# Media digital TV PCI Adapters -# -CONFIG_DVB_AV7110_IR=y -CONFIG_DVB_AV7110=m -CONFIG_DVB_AV7110_OSD=y -CONFIG_DVB_BUDGET_CORE=m -CONFIG_DVB_BUDGET=m -CONFIG_DVB_BUDGET_CI=m -CONFIG_DVB_BUDGET_AV=m -CONFIG_DVB_BUDGET_PATCH=m -CONFIG_DVB_B2C2_FLEXCOP_PCI=m -# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set -# CONFIG_DVB_PLUTO2 is not set -CONFIG_DVB_DM1105=m -# CONFIG_DVB_PT1 is not set -# CONFIG_DVB_PT3 is not set -CONFIG_MANTIS_CORE=m -CONFIG_DVB_MANTIS=m -# CONFIG_DVB_HOPPER is not set -CONFIG_DVB_NGENE=m -CONFIG_DVB_DDBRIDGE=m -CONFIG_DVB_SMIPCIE=m -# CONFIG_V4L_PLATFORM_DRIVERS is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m - -# -# Supported FireWire (IEEE 1394) Adapters -# -CONFIG_DVB_FIREDTV=m -CONFIG_DVB_FIREDTV_INPUT=y -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_VIDEO_SAA7146=m -CONFIG_VIDEO_SAA7146_VV=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=m - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS3308=m -CONFIG_VIDEO_CS5345=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# -CONFIG_VIDEO_SAA6588=m - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# -CONFIG_VIDEO_SAA6752HS=m - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=m -CONFIG_MEDIA_TUNER_SIMPLE=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_MT20XX=m -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_MT2131=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88RS6000T=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_SI2157=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_QM1D1C0042=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m -CONFIG_DVB_SI2165=m -CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10036=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA8083=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TDA8261=m -CONFIG_DVB_VES1X93=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_TUA6100=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_CX24117=m -CONFIG_DVB_CX24120=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_MB86A16=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_SP8870=m -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_L64781=m -CONFIG_DVB_TDA1004X=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_STV0367=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m -CONFIG_DVB_SI2168=m -CONFIG_DVB_AS102_FE=m -# CONFIG_DVB_GP8PSK_FE is not set - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_VES1820=m -CONFIG_DVB_TDA10021=m -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_OR51132=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LGDT3306A=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# -CONFIG_DVB_TC90522=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_DRX39XYJ=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6405=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_SP2=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_TDA665x=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -CONFIG_AGP=y -# CONFIG_AGP_AMD64 is not set -CONFIG_AGP_INTEL=y -# CONFIG_AGP_SIS is not set -CONFIG_AGP_VIA=y -CONFIG_INTEL_GTT=y -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 -CONFIG_VGA_SWITCHEROO=y -CONFIG_DRM=y -CONFIG_DRM_MIPI_DSI=y -# CONFIG_DRM_DP_AUX_CHARDEV is not set -CONFIG_DRM_KMS_HELPER=y -CONFIG_DRM_KMS_FB_HELPER=y -CONFIG_DRM_FBDEV_EMULATION=y -CONFIG_DRM_LOAD_EDID_FIRMWARE=y -CONFIG_DRM_TTM=y - -# -# I2C encoder or helper chips -# -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -CONFIG_DRM_RADEON=y -# CONFIG_DRM_RADEON_USERPTR is not set -CONFIG_DRM_AMDGPU=y -CONFIG_DRM_AMDGPU_SI=y -CONFIG_DRM_AMDGPU_CIK=y -# CONFIG_DRM_AMDGPU_USERPTR is not set -# CONFIG_DRM_AMDGPU_GART_DEBUGFS is not set - -# -# ACP (Audio CoProcessor) Configuration -# -CONFIG_DRM_AMD_ACP=y -# CONFIG_DRM_NOUVEAU is not set -CONFIG_DRM_I915=y -# CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT is not set -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_GVT is not set - -# -# drm/i915 Debugging -# -# CONFIG_DRM_I915_WERROR is not set -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_VGEM is not set -CONFIG_DRM_VMWGFX=y -CONFIG_DRM_VMWGFX_FBCON=y -# CONFIG_DRM_GMA500 is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_BOCHS is not set -# CONFIG_DRM_VIRTIO_GPU is not set -CONFIG_DRM_PANEL=y - -# -# Display Panels -# -CONFIG_DRM_BRIDGE=y - -# -# Display Interface Bridges -# -# CONFIG_DRM_ANALOGIX_ANX78XX is not set -# CONFIG_DRM_LEGACY is not set - -# -# Frame buffer Devices -# -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_CMDLINE=y -CONFIG_FB_NOTIFY=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_IMAGEBLIT=y -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=y -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_VGA16 is not set -CONFIG_FB_UVESA=m -# CONFIG_FB_VESA is not set -CONFIG_FB_EFI=y -# CONFIG_FB_N411 is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_LE80578 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_VIA is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SM712 is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_LCD_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -# CONFIG_BACKLIGHT_APPLE is not set -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_SAHARA is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_VGASTATE is not set -CONFIG_HDMI=y - -# -# Console display driver support -# -CONFIG_VGA_CONSOLE=y -CONFIG_VGACON_SOFT_SCROLLBACK=y -CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=256 -CONFIG_DUMMY_CONSOLE=y -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -CONFIG_SND_JACK_INPUT_DEV=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_TIMER=y -CONFIG_SND_HRTIMER=y -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -CONFIG_SND_PROC_FS=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -CONFIG_SND_DMA_SGBUF=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_MPU401_UART=m -CONFIG_SND_OPL3_LIB=m -CONFIG_SND_AC97_CODEC=m -# CONFIG_SND_DRIVERS is not set -CONFIG_SND_PCI=y -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ASIHPI is not set -CONFIG_SND_ATIIXP=m -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -CONFIG_SND_CA0106=m -CONFIG_SND_CMIPCI=m -CONFIG_SND_OXYGEN_LIB=m -CONFIG_SND_OXYGEN=m -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -CONFIG_SND_CTXFI=m -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_GINA24 is not set -CONFIG_SND_LAYLA24=m -# CONFIG_SND_MONA is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INDIGODJX is not set -CONFIG_SND_EMU10K1=m -CONFIG_SND_EMU10K1X=m -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -CONFIG_SND_ICE1712=m -CONFIG_SND_ICE1724=m -CONFIG_SND_INTEL8X0=m -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -CONFIG_SND_RME9652=m -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -CONFIG_SND_VIRTUOSO=m -# CONFIG_SND_VX222 is not set -# CONFIG_SND_YMFPCI is not set - -# -# HD-Audio -# -CONFIG_SND_HDA=m -CONFIG_SND_HDA_INTEL=m -CONFIG_SND_HDA_HWDEP=y -CONFIG_SND_HDA_RECONFIG=y -CONFIG_SND_HDA_INPUT_BEEP=y -CONFIG_SND_HDA_INPUT_BEEP_MODE=1 -CONFIG_SND_HDA_PATCH_LOADER=y -CONFIG_SND_HDA_CODEC_REALTEK=m -CONFIG_SND_HDA_CODEC_ANALOG=m -CONFIG_SND_HDA_CODEC_SIGMATEL=m -CONFIG_SND_HDA_CODEC_VIA=m -CONFIG_SND_HDA_CODEC_HDMI=m -CONFIG_SND_HDA_CODEC_CIRRUS=m -CONFIG_SND_HDA_CODEC_CONEXANT=m -CONFIG_SND_HDA_CODEC_CA0110=m -CONFIG_SND_HDA_CODEC_CA0132=m -CONFIG_SND_HDA_CODEC_CA0132_DSP=y -CONFIG_SND_HDA_CODEC_CMEDIA=m -CONFIG_SND_HDA_CODEC_SI3054=m -CONFIG_SND_HDA_GENERIC=m -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 -CONFIG_SND_HDA_CORE=m -CONFIG_SND_HDA_DSP_LOADER=y -CONFIG_SND_HDA_I915=y -CONFIG_SND_HDA_PREALLOC_SIZE=2048 -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_USX2Y=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_US122L=m -CONFIG_SND_USB_6FIRE=m -CONFIG_SND_USB_HIFACE=m -CONFIG_SND_BCD2000=m -CONFIG_SND_USB_LINE6=m -CONFIG_SND_USB_POD=m -CONFIG_SND_USB_PODHD=m -CONFIG_SND_USB_TONEPORT=m -CONFIG_SND_USB_VARIAX=m -CONFIG_SND_FIREWIRE=y -# CONFIG_SND_DICE is not set -# CONFIG_SND_OXFW is not set -# CONFIG_SND_ISIGHT is not set -# CONFIG_SND_FIREWORKS is not set -# CONFIG_SND_BEBOB is not set -# CONFIG_SND_FIREWIRE_DIGI00X is not set -# CONFIG_SND_FIREWIRE_TASCAM is not set -CONFIG_SND_SOC=y -CONFIG_SND_SOC_COMPRESS=y -CONFIG_SND_SOC_AMD_ACP=m -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -# CONFIG_SND_SOC_IMG is not set -CONFIG_SND_SST_MFLD_PLATFORM=m -CONFIG_SND_SST_IPC=m -CONFIG_SND_SST_IPC_ACPI=m -CONFIG_SND_SOC_INTEL_SST=m -CONFIG_SND_SOC_INTEL_SST_ACPI=m -CONFIG_SND_SOC_INTEL_SST_MATCH=m -# CONFIG_SND_SOC_INTEL_HASWELL_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set -# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set -# CONFIG_SND_SOC_INTEL_BROADWELL_MACH is not set -CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH=m -# CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH is not set -CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m -CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m -CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH=m -# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -CONFIG_SND_SOC_I2C_AND_SPI=y - -# -# CODEC drivers -# -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_ADAU7002 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_BT_SCO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS35L33 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CS53L30 is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_INNO_RK3036 is not set -CONFIG_SND_SOC_MAX98090=m -# CONFIG_SND_SOC_MAX98504 is not set -# CONFIG_SND_SOC_MAX9860 is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM179X_I2C is not set -# CONFIG_SND_SOC_PCM3168A_I2C is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -CONFIG_SND_SOC_RL6231=m -# CONFIG_SND_SOC_RT5616 is not set -# CONFIG_SND_SOC_RT5631 is not set -CONFIG_SND_SOC_RT5640=m -CONFIG_SND_SOC_RT5645=m -CONFIG_SND_SOC_RT5670=m -# CONFIG_SND_SOC_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -CONFIG_SND_SOC_SPDIF=m -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA32X is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TAS5720 is not set -# CONFIG_SND_SOC_TFA9879 is not set -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -CONFIG_SND_SOC_TS3A227E=m -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -# CONFIG_SND_SOC_WM8731 is not set -# CONFIG_SND_SOC_WM8737 is not set -# CONFIG_SND_SOC_WM8741 is not set -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8776 is not set -# CONFIG_SND_SOC_WM8804_I2C is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8960 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8974 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_WM8985 is not set -# CONFIG_SND_SOC_NAU8810 is not set -# CONFIG_SND_SOC_TPA6130A2 is not set -CONFIG_SND_SIMPLE_CARD_UTILS=m -CONFIG_SND_SIMPLE_CARD=m -# CONFIG_SOUND_PRIME is not set -CONFIG_AC97_BUS=m - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -# CONFIG_HID_BETOP_FF is not set -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_CORSAIR is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CP2112 is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -# CONFIG_HID_LED is not set -CONFIG_HID_LENOVO=y -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_HID_LOGITECH_HIDPP=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -CONFIG_HID_MULTITOUCH=m -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_OUYA=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PENMOUNT=y -CONFIG_HID_PETALYNX=y -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -CONFIG_SONY_FF=y -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SPINELPLUS=y -CONFIG_HID_SUNPLUS=y -CONFIG_HID_RMI=y -# CONFIG_HID_GREENASIA is not set -CONFIG_HID_SMARTJOYPLUS=m -CONFIG_SMARTJOYPLUS_FF=y -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -CONFIG_HID_XINMO=y -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set - -# -# Intel ISH HID support -# -# CONFIG_INTEL_ISH_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -CONFIG_USB_MON=m -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -# CONFIG_USB_XHCI_PLATFORM is not set -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -CONFIG_USB_OHCI_HCD=y -CONFIG_USB_OHCI_HCD_PCI=y -# CONFIG_USB_OHCI_HCD_SSB is not set -# CONFIG_USB_OHCI_HCD_PLATFORM is not set -CONFIG_USB_UHCI_HCD=y -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_BCMA is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -CONFIG_USB_UAS=y - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=m -# CONFIG_USB_SERIAL_GENERIC is not set -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=m -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=m -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -CONFIG_USB_SERIAL_IUU=m -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=m -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set -# CONFIG_UCSI is not set - -# -# USB Physical Layer drivers -# -# CONFIG_USB_PHY is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_PCI=y -# CONFIG_MMC_RICOH_MMC is not set -CONFIG_MMC_SDHCI_ACPI=y -# CONFIG_MMC_SDHCI_PLTFM is not set -# CONFIG_MMC_WBSD is not set -# CONFIG_MMC_TIFM_SD is not set -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_USDHI6ROL0 is not set -CONFIG_MMC_REALTEK_PCI=m -CONFIG_MMC_REALTEK_USB=m -CONFIG_MMC_TOSHIBA_PCI=m -# CONFIG_MMC_MTK is not set -CONFIG_MEMSTICK=m -# CONFIG_MEMSTICK_DEBUG is not set - -# -# MemoryStick drivers -# -# CONFIG_MEMSTICK_UNSAFE_RESUME is not set -# CONFIG_MSPRO_BLOCK is not set -# CONFIG_MS_BLOCK is not set - -# -# MemoryStick Host Controller Drivers -# -# CONFIG_MEMSTICK_TIFM_MS is not set -CONFIG_MEMSTICK_JMICRON_38X=m -# CONFIG_MEMSTICK_R592 is not set -CONFIG_MEMSTICK_REALTEK_PCI=m -CONFIG_MEMSTICK_REALTEK_USB=m -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y -CONFIG_LEDS_CLASS_FLASH=y - -# -# LED drivers -# -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP3952 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_CLEVO_MAIL is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_INTEL_SS4200 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set -# CONFIG_LEDS_MLXCPLD is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -# CONFIG_LEDS_TRIGGER_TIMER is not set -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -# CONFIG_LEDS_TRIGGER_DISK is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_PANIC is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_MC146818_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8010 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV8803 is not set - -# -# SPI RTC drivers -# -CONFIG_RTC_I2C_AND_SPI=y - -# -# SPI and I2C RTC drivers -# -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# Platform RTC drivers -# -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set - -# -# on-CPU RTC drivers -# - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=m -CONFIG_DMA_ACPI=y -CONFIG_INTEL_IDMA64=m -CONFIG_INTEL_IOATDMA=m -# CONFIG_QCOM_HIDMA_MGMT is not set -# CONFIG_QCOM_HIDMA is not set -CONFIG_DW_DMAC_CORE=m -CONFIG_DW_DMAC=m -CONFIG_DW_DMAC_PCI=m - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set -CONFIG_DMA_ENGINE_RAID=y - -# -# DMABUF options -# -# CONFIG_SYNC_FILE is not set -CONFIG_DCA=m -# CONFIG_AUXDISPLAY is not set -CONFIG_UIO=y -# CONFIG_UIO_CIF is not set -# CONFIG_UIO_PDRV_GENIRQ is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_UIO_AEC is not set -# CONFIG_UIO_SERCOS3 is not set -# CONFIG_UIO_PCI_GENERIC is not set -# CONFIG_UIO_NETX is not set -# CONFIG_UIO_PRUSS is not set -# CONFIG_UIO_MF624 is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO=y - -# -# Virtio drivers -# -CONFIG_VIRTIO_PCI=y -CONFIG_VIRTIO_PCI_LEGACY=y -CONFIG_VIRTIO_BALLOON=y -CONFIG_VIRTIO_INPUT=y -CONFIG_VIRTIO_MMIO=y -# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set - -# -# Microsoft Hyper-V guest support -# -# CONFIG_HYPERV is not set -CONFIG_STAGING=y -# CONFIG_SLICOSS is not set -# CONFIG_PRISM2_USB is not set -# CONFIG_COMEDI is not set -CONFIG_RTL8192U=m -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -# CONFIG_R8188EU is not set -CONFIG_RTS5208=y -# CONFIG_VT6655 is not set -CONFIG_VT6656=m -# CONFIG_FB_SM750 is not set -# CONFIG_FB_XGI is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -CONFIG_STAGING_MEDIA=y -# CONFIG_MEDIA_CEC is not set -CONFIG_DVB_CXD2099=m -CONFIG_LIRC_STAGING=y -# CONFIG_LIRC_BT829 is not set -# CONFIG_LIRC_IMON is not set -# CONFIG_LIRC_SASEM is not set -CONFIG_LIRC_SERIAL=m -CONFIG_LIRC_SERIAL_TRANSMITTER=y -# CONFIG_LIRC_SIR is not set -CONFIG_LIRC_XBOX=m -# CONFIG_LIRC_ZILOG is not set - -# -# Android -# -# CONFIG_LTE_GDM724X is not set -# CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_LNET is not set -# CONFIG_DGNC is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_CRYPTO_SKEIN is not set -# CONFIG_UNISYSSPAR is not set -# CONFIG_WILC1000_SDIO is not set -# CONFIG_MOST is not set -# CONFIG_KS7010 is not set -# CONFIG_GREYBUS is not set -# CONFIG_X86_PLATFORM_DEVICES is not set -# CONFIG_CHROME_PLATFORMS is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_CDCE706 is not set -# CONFIG_COMMON_CLK_CS2000_CP is not set -# CONFIG_COMMON_CLK_NXP is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_PIC32 is not set - -# -# Hardware Spinlock drivers -# - -# -# Clock Source drivers -# -CONFIG_CLKEVT_I8253=y -CONFIG_CLKBLD_I8253=y -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -# CONFIG_MAILBOX is not set -# CONFIG_IOMMU_SUPPORT is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# - -# -# SOC (System On Chip) specific Drivers -# - -# -# Broadcom SoC drivers -# -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SOC_TI is not set -# CONFIG_PM_DEVFREQ is not set -# CONFIG_EXTCON is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_NTB is not set -# CONFIG_VME_BUS is not set -# CONFIG_PWM is not set -CONFIG_ARM_GIC_MAX_NR=1 -# CONFIG_IPACK_BUS is not set -# CONFIG_RESET_CONTROLLER is not set -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -CONFIG_POWERCAP=y -CONFIG_INTEL_RAPL=m -# CONFIG_MCB is not set - -# -# Performance monitor support -# -CONFIG_RAS=y -CONFIG_THUNDERBOLT=m - -# -# Android -# -# CONFIG_ANDROID is not set -# CONFIG_LIBNVDIMM is not set -# CONFIG_DEV_DAX is not set -# CONFIG_NVMEM is not set -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set - -# -# FPGA Configuration Support -# -# CONFIG_FPGA is not set - -# -# Firmware Drivers -# -# CONFIG_EDD is not set -CONFIG_FIRMWARE_MEMMAP=y -# CONFIG_DELL_RBU is not set -# CONFIG_DCDBAS is not set -CONFIG_DMIID=y -CONFIG_DMI_SYSFS=m -CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y -CONFIG_ISCSI_IBFT_FIND=y -CONFIG_ISCSI_IBFT=y -# CONFIG_FW_CFG_SYSFS is not set -# CONFIG_GOOGLE_FIRMWARE is not set - -# -# EFI (Extensible Firmware Interface) Support -# -CONFIG_EFI_VARS=y -CONFIG_EFI_ESRT=y -# CONFIG_EFI_FAKE_MEMMAP is not set -CONFIG_EFI_RUNTIME_WRAPPERS=y -# CONFIG_EFI_BOOTLOADER_CONTROL is not set -# CONFIG_EFI_CAPSULE_LOADER is not set -# CONFIG_EFI_TEST is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_FS_IOMAP=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -# CONFIG_EXT4_ENCRYPTION is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_REISERFS_FS_XATTR is not set -CONFIG_JFS_FS=m -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -CONFIG_BTRFS_FS=y -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -CONFIG_F2FS_CHECK_FS=y -# CONFIG_F2FS_FAULT_INJECTION is not set -# CONFIG_FS_DAX is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -CONFIG_FILE_LOCKING=y -CONFIG_MANDATORY_FILE_LOCKING=y -# CONFIG_FS_ENCRYPTION is not set -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=m - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=m -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=m -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_FAT_DEFAULT_UTF8 is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROC_CHILDREN is not set -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_ARCH_HAS_GIGANTIC_PAGE=y -# CONFIG_CONFIGFS_FS is not set -CONFIG_EFIVAR_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_HFS_FS is not set -CONFIG_HFSPLUS_FS=m -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZ4=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -CONFIG_NFS_V4_2=y -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_PNFS_FLEXFILE_LAYOUT=m -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -CONFIG_NFS_V4_1_MIGRATION=y -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_GRACE_PERIOD=y -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y - -# -# Kernel hacking -# -CONFIG_TRACE_IRQFLAGS_SUPPORT=y - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -# CONFIG_DEBUG_INFO is not set -# CONFIG_ENABLE_WARN_DEPRECATED is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_FRAME_WARN=1024 -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_PAGE_OWNER is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -# CONFIG_FRAME_POINTER is not set -# CONFIG_STACK_VALIDATION is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_VIRTUAL is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -# CONFIG_DEBUG_STACKOVERFLOW is not set -CONFIG_HAVE_ARCH_KMEMCHECK=y -# CONFIG_KMEMCHECK is not set -CONFIG_HAVE_ARCH_KASAN=y -# CONFIG_KASAN is not set -CONFIG_ARCH_HAS_KCOV=y -# CONFIG_KCOV is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -CONFIG_LOCKUP_DETECTOR=y -CONFIG_HARDLOCKUP_DETECTOR=y -# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -CONFIG_DETECT_HUNG_TASK=y -CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 -# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set -CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 -# CONFIG_WQ_WATCHDOG is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHED_INFO is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_TIMER_STATS is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_STACKTRACE is not set -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_RCU_PERF_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_LATENCYTOP is not set -CONFIG_USER_STACKTRACE_SUPPORT=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_FENTRY=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACING_SUPPORT=y -# CONFIG_FTRACE is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_MEMTEST is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y -# CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set -# CONFIG_UBSAN is not set -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -CONFIG_STRICT_DEVMEM=y -# CONFIG_IO_STRICT_DEVMEM is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -# CONFIG_EARLY_PRINTK is not set -# CONFIG_X86_PTDUMP_CORE is not set -# CONFIG_X86_PTDUMP is not set -# CONFIG_EFI_PGT_DUMP is not set -# CONFIG_DEBUG_RODATA_TEST is not set -# CONFIG_DEBUG_WX is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_NX_TEST is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_DEBUG_TLBFLUSH is not set -# CONFIG_IOMMU_DEBUG is not set -# CONFIG_IOMMU_STRESS is not set -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DEBUG_BOOT_PARAMS is not set -# CONFIG_CPA_DEBUG is not set -CONFIG_OPTIMIZE_INLINING=y -# CONFIG_DEBUG_ENTRY is not set -# CONFIG_DEBUG_NMI_SELFTEST is not set -CONFIG_X86_DEBUG_FPU=y -# CONFIG_PUNIT_ATOM_DEBUG is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEY_DH_OPERATIONS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y -# CONFIG_HARDENED_USERCOPY is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=y -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=m -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_KPP2=y -# CONFIG_CRYPTO_RSA is not set -# CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_ECDH is not set -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set -CONFIG_CRYPTO_GF128MUL=m -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_NULL2=y -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -CONFIG_CRYPTO_GCM=m -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_SEQIV=m -CONFIG_CRYPTO_ECHAINIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_KEYWRAP is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32C_INTEL is not set -CONFIG_CRYPTO_CRC32=y -# CONFIG_CRYPTO_CRC32_PCLMUL is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -CONFIG_CRYPTO_GHASH=m -# CONFIG_CRYPTO_POLY1305 is not set -# CONFIG_CRYPTO_POLY1305_X86_64 is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_MICHAEL_MIC=m -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=m -# CONFIG_CRYPTO_SHA1_SSSE3 is not set -# CONFIG_CRYPTO_SHA256_SSSE3 is not set -# CONFIG_CRYPTO_SHA512_SSSE3 is not set -# CONFIG_CRYPTO_SHA1_MB is not set -# CONFIG_CRYPTO_SHA256_MB is not set -# CONFIG_CRYPTO_SHA512_MB is not set -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_X86_64 is not set -# CONFIG_CRYPTO_AES_NI_INTEL is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_BLOWFISH_X86_64 is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAMELLIA_X86_64 is not set -# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 is not set -# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST5_AVX_X86_64 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_CAST6_AVX_X86_64 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_DES3_EDE_X86_64 is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SALSA20_X86_64 is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_CHACHA20_X86_64 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set -# CONFIG_CRYPTO_SERPENT_AVX_X86_64 is not set -# CONFIG_CRYPTO_SERPENT_AVX2_X86_64 is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_TWOFISH_X86_64 is not set -# CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set -# CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set - -# -# Compression -# -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -# CONFIG_CRYPTO_ANSI_CPRNG is not set -CONFIG_CRYPTO_DRBG_MENU=m -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=m -CONFIG_CRYPTO_JITTERENTROPY=m -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set - -# -# Certificates for signature checking -# -CONFIG_HAVE_KVM=y -# CONFIG_VIRTUALIZATION is not set -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=y -CONFIG_BITREVERSE=y -# CONFIG_HAVE_ARCH_BITREVERSE is not set -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_HAS_FAST_MULTIPLIER=y -CONFIG_CRC_CCITT=y -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -CONFIG_CRC_ITU_T=m -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m -# CONFIG_CRC8 is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_INTERVAL_TREE=y -CONFIG_RADIX_TREE_MULTIORDER=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_CHECK_SIGNATURE=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_GLOB=y -# CONFIG_GLOB_SELFTEST is not set -CONFIG_NLATTR=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -# CONFIG_IRQ_POLL is not set -CONFIG_OID_REGISTRY=y -CONFIG_UCS2_STRING=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_SG_SPLIT is not set -CONFIG_SG_POOL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_PMEM_API=y -CONFIG_ARCH_HAS_MMIO_FLUSH=y -CONFIG_SBITMAP=y diff --git a/projects/Virtual/options b/projects/Virtual/options deleted file mode 100644 index 8b70855217..0000000000 --- a/projects/Virtual/options +++ /dev/null @@ -1,97 +0,0 @@ -################################################################################ -# setup system defaults -################################################################################ - - # The TARGET_CPU variable controls which processor should be targeted for - # generated code. - case $TARGET_ARCH in - x86_64) - # (AMD CPUs) k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 - # athlon-fx amdfam10 barcelona - # (Intel CPUs) atom core2 nocona - # - TARGET_CPU="x86-64" - ;; - esac - - # Bootloader to use (syslinux / u-boot / atv-bootloader) - BOOTLOADER="syslinux" - - # u-boot version to use (default) - UBOOT_VERSION="default" - - # Configuration for u-boot - UBOOT_CONFIG="" - - # Target Configfile for u-boot - UBOOT_CONFIGFILE="" - - # Kernel target - KERNEL_TARGET="bzImage" - - # Kernel extra targets to build - KERNEL_UBOOT_EXTRA_TARGET="" - - # Additional kernel make parameters (for example to specify the u-boot loadaddress) - KERNEL_MAKE_EXTRACMD="" - - # Kernel to use. values can be: - # default: default mainline kernel - LINUX="default" - - -################################################################################ -# setup build defaults -################################################################################ - - # Project CFLAGS - PROJECT_CFLAGS="-mmmx -msse -msse2 -mfpmath=sse" - - # SquashFS compression method (gzip / lzo / xz) - SQUASHFS_COMPRESSION="gzip" - - -################################################################################ -# setup project defaults -################################################################################ - - # build and install ALSA Audio support (yes / no) - ALSA_SUPPORT="yes" - - # OpenGL(X) implementation to use (no / mesa) - OPENGL="mesa" - - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) - OPENGLES="no" - - # include uvesafb support (yes / no) - UVESAFB_SUPPORT="yes" - - # Displayserver to use (x11 / no) - DISPLAYSERVER="x11" - - # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) - KODIPLAYER_DRIVER="default" - - # Modules to install in initramfs for early boot - INITRAMFS_MODULES="" - - # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) - # Space separated list is supported, - # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware iwlwifi-firmware" - - # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers - # Space separated list is supported, - # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS bcm_sta media_build" - - # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau,vmware,virtualbox) - # Space separated list is supported, - # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" - GRAPHIC_DRIVERS="vmware" - - # set the addon dirs - ADDON_PATH="$ADDON_VERSION/Generic/$TARGET_ARCH" - ADDON_URL="$ADDON_SERVER_URL/$ADDON_PATH" diff --git a/projects/WeTek_Core/filesystem/usr/bin/cputemp b/projects/WeTek_Core/filesystem/usr/bin/cputemp new file mode 100755 index 0000000000..11535271c5 --- /dev/null +++ b/projects/WeTek_Core/filesystem/usr/bin/cputemp @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" +echo "$(( $TEMP / 1000 )) C" diff --git a/projects/WeTek_Core/filesystem/usr/bin/gputemp b/projects/WeTek_Core/filesystem/usr/bin/gputemp new file mode 120000 index 0000000000..6476b954d2 --- /dev/null +++ b/projects/WeTek_Core/filesystem/usr/bin/gputemp @@ -0,0 +1 @@ +cputemp \ No newline at end of file diff --git a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/ap6330-nvram.txt b/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/ap6330-nvram.txt deleted file mode 100644 index 197232da49..0000000000 --- a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/ap6330-nvram.txt +++ /dev/null @@ -1,82 +0,0 @@ -#AP6330_NVRAM_V1.0_20121130 -#Sample variables file for BCM94330 SD FC AGB board -manfid=0x2d0 -prodid=0x0547 -vendid=0x14e4 -devid=0x4360 -boardtype=0x05e1 -boardrev=0x1202 -boardflags=0x0080200 -nocrc=1 -xtalfreq=26000 -boardnum=22 -macaddr=00:90:4c:c5:12:38 -ag0=254 -aa2g=1 -ccode=ALL -pa0itssit=0x20 -pa0b0=5587 -pa0b1=-633 -pa0b2=-158 -rssismf2g=0xa -rssismc2g=0x3 -rssisav2g=0x7 -#rssi params for 5GHz -rssismf5g=0x4 -rssismc5g=0x3 -rssisav5g=0x7 -#PA parameters for lower a-band -pa1lob0=4748 -pa1lob1=-566 -pa1lob2=-180 -#PA parameters for midband -pa1b0=4762 -pa1b1=-593 -pa1b2=-172 -#PA parameters for high band -#pa1hib0=4596 -pa1hib0=4666 -pa1hib1=-619 -pa1hib2=-163 -rxpo5g=0 -maxp2ga0=74 -maxp5ga0=66 -maxp5gla0=66 -maxp5gha0=66 -# 2.4G Tx Power offsets -cck2gpo=0x2222 -ofdm2gpo=0x44444444 -mcs2gpo0=0x6666 -mcs2gpo1=0x6666 -# 5G Tx Power offsets -ofdm5gpo=0x44444444 -ofdm5glpo=0x44444444 -ofdm5ghpo=0x44444444 -mcs5gpo0=0x6666 -mcs5gpo1=0x6666 -mcs5glpo0=0x6666 -mcs5glpo1=0x6666 -mcs5ghpo0=0x6666 -mcs5ghpo1=0x6666 -sromrev=3 -il0macaddr=00:90:4c:c5:12:38 -wl0id=0x431b -cckPwrOffset=4 -swctrlmap_2g=0x44844484,0x42824282,0x40804484,0x18282,0x1ff -triso5g=0 -swctrlmap_5g=0x00100010,0x20202020,0x20202020,0x14202,0x0f0 -rfreg033=0x19 -rfreg033_cck=0x1f -dacrate2g=160 -dacrate5g=160 -txalpfbyp2g=1 -bphyscale=17 -cckPwrIdxCorr=-15 -pacalidx2g=50 -#pacalidx5g=20 -noise_cal_ref_2g=53 -noise_cal_po_2g=0 -noise_cal_ref_5g=52 -noise_cal_po_5g=5,0,0 -# 4330 OOB parameter: High level trigger -muxenab=0x10 diff --git a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/bcm40183b2.hcd b/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/bcm40183b2.hcd deleted file mode 100644 index 463ac80276..0000000000 Binary files a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/bcm40183b2.hcd and /dev/null differ diff --git a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2.bin b/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2.bin deleted file mode 100644 index 6309e86922..0000000000 Binary files a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2.bin and /dev/null differ diff --git a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2_apsta.bin b/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2_apsta.bin deleted file mode 100644 index ad70a4f145..0000000000 Binary files a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2_apsta.bin and /dev/null differ diff --git a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2_p2p.bin b/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2_p2p.bin deleted file mode 100644 index 6309e86922..0000000000 Binary files a/projects/WeTek_Core/filesystem/usr/lib/firmware/brcm/fw_bcm40183b2_p2p.bin and /dev/null differ diff --git a/projects/WeTek_Core/filesystem/usr/lib/modules-load.d/amlvideodri.conf b/projects/WeTek_Core/filesystem/usr/lib/modules-load.d/amlvideodri.conf new file mode 100644 index 0000000000..d46221c301 --- /dev/null +++ b/projects/WeTek_Core/filesystem/usr/lib/modules-load.d/amlvideodri.conf @@ -0,0 +1 @@ +amlvideodri diff --git a/projects/WeTek_Core/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf b/projects/WeTek_Core/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf new file mode 100644 index 0000000000..4ca7168beb --- /dev/null +++ b/projects/WeTek_Core/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf @@ -0,0 +1,3 @@ +[Sleep] +SuspendMode=false +HibernateMode=false diff --git a/projects/WeTek_Core/initramfs/platform_init b/projects/WeTek_Core/initramfs/platform_init index 9b04048a9a..604a7295a4 100755 --- a/projects/WeTek_Core/initramfs/platform_init +++ b/projects/WeTek_Core/initramfs/platform_init @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) hdmimode="720p" diff --git a/projects/WeTek_Core/install/files/bootloader.img b/projects/WeTek_Core/install/files/bootloader.img index 726eb38754..0e3cad7115 100644 Binary files a/projects/WeTek_Core/install/files/bootloader.img and b/projects/WeTek_Core/install/files/bootloader.img differ diff --git a/projects/WeTek_Core/install/files/logo.img b/projects/WeTek_Core/install/files/logo.img index c8a2c61c7b..81daf9c5d6 100644 Binary files a/projects/WeTek_Core/install/files/logo.img and b/projects/WeTek_Core/install/files/logo.img differ diff --git a/projects/WeTek_Core/install/files/recovery.img b/projects/WeTek_Core/install/files/recovery.img index c0a89ec952..841cc0d4ff 100644 Binary files a/projects/WeTek_Core/install/files/recovery.img and b/projects/WeTek_Core/install/files/recovery.img differ diff --git a/projects/WeTek_Core/install/update-binary b/projects/WeTek_Core/install/update-binary index fc885377db..fde57989ee 100644 Binary files a/projects/WeTek_Core/install/update-binary and b/projects/WeTek_Core/install/update-binary differ diff --git a/projects/WeTek_Core/kodi/advancedsettings.xml b/projects/WeTek_Core/kodi/advancedsettings.xml deleted file mode 100644 index bcca951759..0000000000 --- a/projects/WeTek_Core/kodi/advancedsettings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - false - - - 30 - - diff --git a/projects/WeTek_Core/linux/linux.arm.conf b/projects/WeTek_Core/linux/linux.arm.conf index 3c6caa516a..ea0d730152 100644 --- a/projects/WeTek_Core/linux/linux.arm.conf +++ b/projects/WeTek_Core/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.10.99 Kernel Configuration +# Linux/arm 3.10.108 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -111,9 +111,7 @@ CONFIG_CGROUPS=y # CONFIG_SYSFS_DEPRECATED is not set # CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_INITRAMFS_SOURCE="" CONFIG_RD_GZIP=y # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set @@ -142,7 +140,7 @@ CONFIG_SIGNALFD=y CONFIG_TIMERFD=y CONFIG_EVENTFD=y CONFIG_SHMEM=y -# CONFIG_AIO is not set +CONFIG_AIO=y CONFIG_EMBEDDED=y CONFIG_HAVE_PERF_EVENTS=y CONFIG_PERF_USE_VMALLOC=y @@ -151,7 +149,7 @@ CONFIG_PERF_USE_VMALLOC=y # Kernel Performance Events And Counters # # CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set +CONFIG_VM_EVENT_COUNTERS=y CONFIG_SLUB_DEBUG=y # CONFIG_COMPAT_BRK is not set # CONFIG_SLAB is not set @@ -493,9 +491,9 @@ CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG=y # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE is not set CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set @@ -580,7 +578,11 @@ CONFIG_UNIX=y # CONFIG_NET_KEY is not set CONFIG_INET=y CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +# CONFIG_IP_ROUTE_VERBOSE is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y @@ -589,6 +591,7 @@ CONFIG_IP_PNP_BOOTP=y # CONFIG_NET_IPGRE_DEMUX is not set CONFIG_NET_IP_TUNNEL=m CONFIG_IP_MROUTE=y +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set # CONFIG_IP_PIMSM_V1 is not set # CONFIG_IP_PIMSM_V2 is not set # CONFIG_ARPD is not set @@ -603,8 +606,21 @@ CONFIG_INET_TUNNEL=m # CONFIG_INET_XFRM_MODE_BEET is not set CONFIG_INET_LRO=y # CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_WESTWOOD is not set +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +# CONFIG_TCP_CONG_HYBLA is not set +CONFIG_TCP_CONG_VEGAS=m +CONFIG_TCP_CONG_SCALABLE=m +# CONFIG_TCP_CONG_LP is not set +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set CONFIG_DEFAULT_TCP_CONG="cubic" # CONFIG_TCP_MD5SIG is not set CONFIG_IPV6=y @@ -628,8 +644,6 @@ CONFIG_IPV6_NDISC_NODETYPE=y # CONFIG_IPV6_GRE is not set # CONFIG_IPV6_MULTIPLE_TABLES is not set # CONFIG_IPV6_MROUTE is not set -# CONFIG_ANDROID_PARANOID_NETWORK is not set -# CONFIG_NET_ACTIVITY_STATS is not set # CONFIG_NETWORK_SECMARK is not set # CONFIG_NETWORK_PHY_TIMESTAMPING is not set CONFIG_NETFILTER=y @@ -736,7 +750,6 @@ CONFIG_NETFILTER_XT_MATCH_IPRANGE=m CONFIG_NETFILTER_XT_MATCH_OWNER=m # CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set # CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set # CONFIG_NETFILTER_XT_MATCH_RATEEST is not set # CONFIG_NETFILTER_XT_MATCH_REALM is not set # CONFIG_NETFILTER_XT_MATCH_RECENT is not set @@ -762,7 +775,6 @@ CONFIG_IP_NF_IPTABLES=m # CONFIG_IP_NF_MATCH_TTL is not set CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_REJECT_SKERR is not set # CONFIG_IP_NF_TARGET_ULOG is not set CONFIG_NF_NAT_IPV4=m CONFIG_IP_NF_TARGET_MASQUERADE=m @@ -795,7 +807,6 @@ CONFIG_IP6_NF_IPTABLES=m # CONFIG_IP6_NF_TARGET_HL is not set CONFIG_IP6_NF_FILTER=m CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_REJECT_SKERR is not set CONFIG_IP6_NF_MANGLE=m # CONFIG_IP6_NF_RAW is not set CONFIG_NF_NAT_IPV6=m @@ -825,7 +836,47 @@ CONFIG_LLC=m # CONFIG_LAPB is not set # CONFIG_PHONET is not set # CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_PLUG is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y # CONFIG_DCB is not set CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set @@ -872,6 +923,7 @@ CONFIG_BT_MRVL=m CONFIG_BT_MRVL_SDIO=m CONFIG_BT_ATH3K=m # CONFIG_AF_RXRPC is not set +CONFIG_FIB_RULES=y CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -887,7 +939,6 @@ CONFIG_CFG80211_DEFAULT_PS=y CONFIG_CFG80211_INTERNAL_REGDB=y CONFIG_CFG80211_WEXT=y # CONFIG_LIB80211 is not set -# CONFIG_CFG80211_ALLOW_RECONNECT is not set CONFIG_MAC80211=m CONFIG_MAC80211_HAS_RC=y # CONFIG_MAC80211_RC_PID is not set @@ -1096,7 +1147,7 @@ CONFIG_AM_WIFI_USB=y # CONFIG_RTL8188EU_MP is not set CONFIG_SDIO_DHD_CDC_WIFI_40181_MODULE=m CONFIG_BCMDHD_FW_PATH="/lib/firmware/brcm/" -CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/brcm/ap6330-nvram.txt" +CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/brcm/nvram_ap6330.txt" CONFIG_BCMDHD_CONFIG_PATH="/etc/wifi/config.txt" CONFIG_BCMDHD_POWER_OFF_IN_SUSPEND=y CONFIG_BCMDHD_OOB=y @@ -1254,14 +1305,14 @@ CONFIG_POST_PROCESS_MANAGER_3D_PROCESS=y # # V4L2 Video Support # -CONFIG_V4L_AMLOGIC_VIDEO=y -CONFIG_V4L_AMLOGIC_VIDEO2=y +CONFIG_V4L_AMLOGIC_VIDEO=m +# CONFIG_V4L_AMLOGIC_VIDEO2 is not set # # Amlogic ion video support # -CONFIG_VIDEOBUF2_ION=y -CONFIG_AMLOGIC_IONVIDEO=y +# CONFIG_VIDEOBUF2_ION is not set +# CONFIG_AMLOGIC_IONVIDEO is not set # # Deinterlace driver @@ -1458,7 +1509,7 @@ CONFIG_OF=y # # Device Tree and Open Firmware support # -# CONFIG_PROC_DEVICETREE is not set +CONFIG_PROC_DEVICETREE=y # CONFIG_OF_SELFTEST is not set CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y @@ -1590,6 +1641,7 @@ CONFIG_MII=y # CONFIG_MACVLAN is not set # CONFIG_VXLAN is not set CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETPOLL=y # CONFIG_NETPOLL_TRAP is not set CONFIG_NET_POLL_CONTROLLER=y @@ -1924,7 +1976,16 @@ CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y CONFIG_I2C_CHARDEV=y -# CONFIG_I2C_MUX is not set +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set +# CONFIG_I2C_MUX_GPIO is not set +# CONFIG_I2C_MUX_PCA9541 is not set +# CONFIG_I2C_MUX_PCA954x is not set +# CONFIG_I2C_MUX_PINCTRL is not set CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_ALGOBIT=y @@ -2329,17 +2390,17 @@ CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y CONFIG_MEDIA_RADIO_SUPPORT=y CONFIG_MEDIA_RC_SUPPORT=y # CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2=y +CONFIG_VIDEO_DEV=m +CONFIG_VIDEO_V4L2=m # CONFIG_VIDEO_ADV_DEBUG is not set # CONFIG_VIDEO_FIXED_MINOR_RANGES is not set CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=y +CONFIG_VIDEOBUF_GEN=m CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_RESOURCE=y +CONFIG_VIDEOBUF_RESOURCE=m CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=y -CONFIG_VIDEOBUF2_MEMOPS=y +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_MEMOPS=m CONFIG_VIDEOBUF2_VMALLOC=m # CONFIG_VIDEO_V4L2_INT_DEVICE is not set CONFIG_DVB_CORE=m @@ -2714,7 +2775,7 @@ CONFIG_FB_DEFERRED_IO=y # # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m +# CONFIG_FB_UDL is not set # CONFIG_FB_GOLDFISH is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_METRONOME is not set @@ -3350,6 +3411,7 @@ CONFIG_XFS_FS=m # CONFIG_XFS_WARN is not set # CONFIG_XFS_DEBUG is not set # CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set CONFIG_BTRFS_FS=m # CONFIG_BTRFS_FS_POSIX_ACL is not set # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set @@ -3373,7 +3435,12 @@ CONFIG_GENERIC_ACL=y # # Caches # -# CONFIG_FSCACHE is not set +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set # # CD-ROM/DVD Filesystems @@ -3406,7 +3473,7 @@ CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y # CONFIG_HUGETLB_PAGE is not set -# CONFIG_CONFIGFS_FS is not set +CONFIG_CONFIGFS_FS=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set @@ -3455,6 +3522,7 @@ CONFIG_NFS_V4_1=y CONFIG_PNFS_FILE_LAYOUT=m CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" CONFIG_ROOT_NFS=y +CONFIG_NFS_FSCACHE=y # CONFIG_NFS_USE_LEGACY_DNS is not set CONFIG_NFS_USE_KERNEL_DNS=y # CONFIG_NFSD is not set @@ -3476,7 +3544,8 @@ CONFIG_CIFS_STATS2=y # CONFIG_CIFS_XATTR is not set # CONFIG_CIFS_DEBUG is not set # CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_FSCACHE=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set @@ -3531,6 +3600,7 @@ CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_MAC_ROMANIAN is not set # CONFIG_NLS_MAC_TURKISH is not set CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set # # Kernel hacking @@ -3625,7 +3695,7 @@ CONFIG_BRANCH_PROFILE_NONE=y # CONFIG_PROBE_EVENTS is not set # CONFIG_RBTREE_TEST is not set # CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_DYNAMIC_DEBUG is not set +CONFIG_DYNAMIC_DEBUG=y # CONFIG_DMA_API_DEBUG is not set # CONFIG_ATOMIC64_SELFTEST is not set # CONFIG_SAMPLES is not set @@ -3769,6 +3839,7 @@ CONFIG_CRYPTO_HW=y # CONFIG_RAID6_PQ=m CONFIG_BITREVERSE=y +CONFIG_RATIONAL=y CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_PCI_IOMAP=y diff --git a/projects/WeTek_Core/options b/projects/WeTek_Core/options index 23e04bde47..c7e43c455b 100644 --- a/projects/WeTek_Core/options +++ b/projects/WeTek_Core/options @@ -32,6 +32,10 @@ # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16 # neon-vfpv4. TARGET_FPU="neon-fp16" + TARGET_FEATURES="32bit" + + # Use linaro toolchain to build kernel + KERNEL_LINARO_TOOLCHAIN="arm-linux-gnueabihf" ;; esac @@ -39,7 +43,7 @@ BOOTLOADER="u-boot" # u-boot version to use (default) - UBOOT_VERSION="" + UBOOT_VERSION="vendor" # Configuration for u-boot UBOOT_CONFIG="" @@ -56,12 +60,12 @@ # Build Android kernel image using mkbootimg BUILD_ANDROID_BOOTIMG="yes" - # Additional options to be passed to Android mkbootimg - ANDROID_BOOTIMG_OPTIONS="--second arch/arm/boot/dts/amlogic/meson8m2_wetek_core.dtb" - # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="" + # Kernel to use. values can be: # default: default mainline kernel LINUX="amlogic-3.10" @@ -99,7 +103,7 @@ # Displayserver to use (x11 / no) DISPLAYSERVER="no" - # Windowmanager to use (ratpoison / fluxbox / none) + # Windowmanager to use (fluxbox / none) WINDOWMANAGER="none" # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau) @@ -122,7 +126,7 @@ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-aml" + FIRMWARE="misc-firmware wlan-firmware wlan-firmware-aml dvb-firmware brcmfmac_sdio-firmware-aml" # build and install ATV IR remote support (yes / no) ATVCLIENT_SUPPORT="no" @@ -130,21 +134,16 @@ # Amlogic IR remote support (yes / no) AMREMOTE_SUPPORT="yes" - # build with swap support (yes / no) - SWAP_SUPPORT="no" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - # build with installer (yes / no) INSTALLER_SUPPORT="no" - # extra build dependeices - EXTRA_DEPS="mkimage" - EXTRA_DEPS_PKG="u-boot-tools" - # kernel image name KERNEL_NAME="kernel.img" + + # build and install driver addons (yes / no) + DRIVER_ADDONS_SUPPORT="no" + + # driver addons to install: + # for a list of additinoal drivers see packages/linux-driver-addons + # Space separated list is supported, + DRIVER_ADDONS="crazycat" diff --git a/projects/WeTek_Core/patches/kodi/0001-aml-Fill-audio-packets-completely-when-resampling-to.patch b/projects/WeTek_Core/patches/kodi/0001-aml-Fill-audio-packets-completely-when-resampling-to.patch deleted file mode 100644 index a829e77600..0000000000 --- a/projects/WeTek_Core/patches/kodi/0001-aml-Fill-audio-packets-completely-when-resampling-to.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 58415a1c26a1d0f41bc45ff66471c2a41b705edf Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Sat, 20 Sep 2014 04:43:52 +0300 -Subject: [PATCH 1/5] [aml] Fill audio packets completely when resampling to - prevent 'audio data unaligned' kernel warnings - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -index 3ca667c..304cff8 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -162,7 +162,11 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm - m_inputFormat.m_channelLayout += AE_CH_FC; - } - m_resampler = NULL; -+#ifdef HAS_LIBAMCODEC -+ m_fillPackets = true; -+#else - m_fillPackets = false; -+#endif - m_drain = false; - m_empty = true; - m_procSample = NULL; --- -1.7.10.4 - diff --git a/projects/WeTek_Core/patches/kodi/0002-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch b/projects/WeTek_Core/patches/kodi/0002-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch deleted file mode 100644 index dbea3feb33..0000000000 --- a/projects/WeTek_Core/patches/kodi/0002-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 4b3958857f85df99dece4faffd42b15a9445e5cb Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Tue, 30 Jun 2015 11:19:57 +0200 -Subject: [PATCH 2/5] [aml] Ugly workaround to show DTS/AC3 caps - -... but don't run into multi channel issues as we can only open 2 pcm channels ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 6a9066b..7abf119 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -1301,6 +1301,12 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force) - - AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name) - { -+#ifdef HAS_LIBAMCODEC -+ // ugly workaround to show DTS / AC3 caps -+ // but don't run into multi channel issues -+ // as we can only open 2 pcm channels -+ return AE_DEVTYPE_IEC958; -+#endif - if (name.substr(0, 4) == "hdmi") - return AE_DEVTYPE_HDMI; - else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif") --- -1.7.10.4 - diff --git a/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch b/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch deleted file mode 100644 index 535c377f8b..0000000000 --- a/projects/WeTek_Core/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 46aab0b0856eeaa855c430ddd36ac97203afa43b Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Wed, 1 Jul 2015 23:37:11 +0200 -Subject: [PATCH 3/5] [aml] Add support for 4k resolutions - ---- - xbmc/utils/AMLUtils.cpp | 16 ++++++++-------- - xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 23 +++++++++++++++++++---- - xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 2 ++ - 3 files changed, 29 insertions(+), 12 deletions(-) - -diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp -index 80fb453..65286de 100644 ---- a/xbmc/utils/AMLUtils.cpp -+++ b/xbmc/utils/AMLUtils.cpp -@@ -463,8 +463,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2ksmpte") || StringUtils::EqualsNoCase(fromMode, "smpte24hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 4096; -+ res->iHeight= 2160; - res->iScreenWidth = 4096; - res->iScreenHeight= 2160; - res->fRefreshRate = 24; -@@ -481,8 +481,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2k24hz") || StringUtils::EqualsNoCase(fromMode, "2160p24hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 3840; -+ res->iHeight= 2160; - res->iScreenWidth = 3840; - res->iScreenHeight= 2160; - res->fRefreshRate = 24; -@@ -490,8 +490,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2k25hz") || StringUtils::EqualsNoCase(fromMode, "2160p25hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 3840; -+ res->iHeight= 2160; - res->iScreenWidth = 3840; - res->iScreenHeight= 2160; - res->fRefreshRate = 25; -@@ -508,8 +508,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2k30hz") || StringUtils::EqualsNoCase(fromMode, "2160p30hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 3840; -+ res->iHeight= 2160; - res->iScreenWidth = 3840; - res->iScreenHeight= 2160; - res->fRefreshRate = 30; -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -index 88cd385..3bfb0c6 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -@@ -64,7 +64,22 @@ void CEGLNativeTypeAmlogic::Initialize() - { - aml_permissions(); - DisableFreeScale(); -+ GetMaxResolution(m_maxResolution); - } -+ -+void CEGLNativeTypeAmlogic::GetMaxResolution(RESOLUTION_INFO &maxResolution) -+{ -+ std::vector resolutions; -+ ProbeResolutions(resolutions); -+ -+ maxResolution = {0}; -+ for (size_t i = 0; i < resolutions.size(); i++) -+ { -+ if (resolutions[i].iScreenWidth > maxResolution.iScreenWidth || resolutions[i].iScreenHeight > maxResolution.iScreenHeight) -+ maxResolution = resolutions[i]; -+ } -+} -+ - void CEGLNativeTypeAmlogic::Destroy() - { - return; -@@ -83,8 +98,8 @@ bool CEGLNativeTypeAmlogic::CreateNativeWindow() - if (!nativeWindow) - return false; - -- nativeWindow->width = 1920; -- nativeWindow->height = 1080; -+ nativeWindow->width = m_maxResolution.iScreenWidth; -+ nativeWindow->height = m_maxResolution.iScreenHeight; - m_nativeWindow = nativeWindow; - - SetFramebufferResolution(nativeWindow->width, nativeWindow->height); -@@ -244,8 +259,8 @@ void CEGLNativeTypeAmlogic::SetFramebufferResolution(int width, int height) cons - { - vinfo.xres = width; - vinfo.yres = height; -- vinfo.xres_virtual = 1920; -- vinfo.yres_virtual = 2160; -+ vinfo.xres_virtual = m_maxResolution.iScreenWidth; -+ vinfo.yres_virtual = m_maxResolution.iScreenHeight * 2; - vinfo.bits_per_pixel = 32; - vinfo.activate = FB_ACTIVATE_ALL; - ioctl(fd0, FBIOPUT_VSCREENINFO, &vinfo); -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -index cfb33ca..cf60134 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -@@ -58,6 +58,8 @@ protected: - private: - void SetFramebufferResolution(const RESOLUTION_INFO &res) const; - void SetFramebufferResolution(int width, int height) const; -+ void GetMaxResolution(RESOLUTION_INFO &maxResolution); - - std::string m_framebuffer_name; -+ RESOLUTION_INFO m_maxResolution; - }; --- -1.7.10.4 - diff --git a/projects/WeTek_Core/patches/kodi/0004-powermanagement-Perform-suspend-instead-of-powerdown.patch b/projects/WeTek_Core/patches/kodi/0004-powermanagement-Perform-suspend-instead-of-powerdown.patch deleted file mode 100644 index a2154837c7..0000000000 --- a/projects/WeTek_Core/patches/kodi/0004-powermanagement-Perform-suspend-instead-of-powerdown.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 5095bcfcb4bf235855f2474ff229a95c8f20fc2d Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Tue, 14 Jul 2015 16:02:35 +0300 -Subject: [PATCH 4/5] [powermanagement] Perform suspend instead of powerdown - ---- - xbmc/powermanagement/linux/LogindUPowerSyscall.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -index 4e5bcc6..ad5847d 100644 ---- a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -@@ -53,7 +53,7 @@ CLogindUPowerSyscall::CLogindUPowerSyscall() - m_canPowerdown = LogindCheckCapability("CanPowerOff"); - m_canReboot = LogindCheckCapability("CanReboot"); - m_canHibernate = LogindCheckCapability("CanHibernate"); -- m_canSuspend = LogindCheckCapability("CanSuspend"); -+ m_canSuspend = false; - - InhibitDelayLock(); - -@@ -98,7 +98,7 @@ CLogindUPowerSyscall::~CLogindUPowerSyscall() - - bool CLogindUPowerSyscall::Powerdown() - { -- return LogindSetPowerState("PowerOff"); -+ return Suspend(); - } - - bool CLogindUPowerSyscall::Reboot() --- -1.7.10.4 - diff --git a/projects/WeTek_Core/patches/kodi/kodi-100.26-hack-fix-audio.patch b/projects/WeTek_Core/patches/kodi/kodi-100.26-hack-fix-audio.patch new file mode 100644 index 0000000000..828d1ddd17 --- /dev/null +++ b/projects/WeTek_Core/patches/kodi/kodi-100.26-hack-fix-audio.patch @@ -0,0 +1,13 @@ +fixes broken audio at WP1 and WC +Fill audio packets completely when resampling to prevent 'audio data unaligned' kernel warnings + +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +@@ -143,6 +143,7 @@ + m_inputFormat.m_channelLayout.Reset(); + m_inputFormat.m_channelLayout += AE_CH_FC; + } ++ m_fillPackets = true; + m_resampleQuality = quality; + } + diff --git a/projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch b/projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch index 95c817d705..aa55668a60 100644 --- a/projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch +++ b/projects/WeTek_Core/patches/libcec/libcec-00-amlogic-support.patch @@ -1,21 +1,21 @@ -From dabfc33004b94d2f06d20ad4f8a889dd5a94e796 Mon Sep 17 00:00:00 2001 +From bd56646f065c5952266adc28ed569be29159d818 Mon Sep 17 00:00:00 2001 From: Gerald Dachs Date: Tue, 6 Dec 2016 11:06:49 +0100 Subject: [PATCH] Amlogic CEC adapter --- - include/cectypes.h | 15 +- + include/cectypes.h | 13 +- src/libcec/CMakeLists.txt | 3 + - src/libcec/adapter/AdapterFactory.cpp | 24 +- + src/libcec/adapter/AdapterFactory.cpp | 22 ++ src/libcec/adapter/Amlogic/AmlogicCEC.h | 41 +++ .../Amlogic/AmlogicCECAdapterCommunication.cpp | 306 +++++++++++++++++++++ - .../Amlogic/AmlogicCECAdapterCommunication.h | 105 +++++++ + .../Amlogic/AmlogicCECAdapterCommunication.h | 106 +++++++ .../adapter/Amlogic/AmlogicCECAdapterDetection.cpp | 50 ++++ .../adapter/Amlogic/AmlogicCECAdapterDetection.h | 46 ++++ src/libcec/cmake/CheckPlatformSupport.cmake | 13 + src/libcec/cmake/DisplayPlatformSupport.cmake | 6 + src/libcec/env.h.in | 3 + - 11 files changed, 610 insertions(+), 2 deletions(-) + 11 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 src/libcec/adapter/Amlogic/AmlogicCEC.h create mode 100644 src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp create mode 100644 src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h @@ -23,10 +23,10 @@ Subject: [PATCH] Amlogic CEC adapter create mode 100644 src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h diff --git a/include/cectypes.h b/include/cectypes.h -index 9c91842..1bc7b52 100644 +index 9c91842..3af93ca 100644 --- a/include/cectypes.h +++ b/include/cectypes.h -@@ -276,6 +276,18 @@ namespace CEC { +@@ -276,6 +276,16 @@ namespace CEC { */ #define CEC_EXYNOS_VIRTUAL_COM "Exynos" @@ -39,13 +39,11 @@ index 9c91842..1bc7b52 100644 + * the name of the virtual COM port to use for the AMLOGIC' CEC wire + */ +#define CEC_AMLOGIC_VIRTUAL_COM "Amlogic" -+ -+/*! + /** * Maximum size of a data packet */ -@@ -861,7 +873,8 @@ typedef enum cec_adapter_type +@@ -861,7 +871,8 @@ typedef enum cec_adapter_type ADAPTERTYPE_RPI = 0x100, ADAPTERTYPE_TDA995x = 0x200, ADAPTERTYPE_EXYNOS = 0x300, @@ -56,21 +54,21 @@ index 9c91842..1bc7b52 100644 /** force exporting through swig */ diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt -index d3eefa3..125512b 100644 +index 6baee69..a537825 100644 --- a/src/libcec/CMakeLists.txt +++ b/src/libcec/CMakeLists.txt -@@ -87,6 +87,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h +@@ -89,6 +89,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h adapter/Exynos/ExynosCEC.h adapter/Exynos/ExynosCECAdapterDetection.h adapter/Exynos/ExynosCECAdapterCommunication.h -+ adapter/Amlogic/AmlogicCEC.h ++ adapter/Amlogic/AmlogicCEC.h + adapter/Amlogic/AmlogicCECAdapterDetection.h + adapter/Amlogic/AmlogicCECAdapterCommunication.h adapter/AOCEC/AOCEC.h adapter/AOCEC/AOCECAdapterDetection.h adapter/AOCEC/AOCECAdapterCommunication.h diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp -index 1e946e6..a539394 100644 +index 91195ea..3344516 100644 --- a/src/libcec/adapter/AdapterFactory.cpp +++ b/src/libcec/adapter/AdapterFactory.cpp @@ -58,6 +58,11 @@ @@ -477,10 +475,10 @@ index 0000000..88d19db +#endif // HAVE_AMLOGIC_API diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h new file mode 100644 -index 0000000..0e99cf8 +index 0000000..a8e6fce --- /dev/null +++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h -@@ -0,0 +1,105 @@ +@@ -0,0 +1,106 @@ +#pragma once +/* + * This file is part of the libCEC(R) library. @@ -555,6 +553,7 @@ index 0000000..0e99cf8 + uint32_t GetFirmwareBuildDate(void) { return 0; } + bool IsRunningLatestFirmware(void) { return true; } + bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) { return false; } ++ bool SetAutoMode(bool UNUSED(automode)) override { return false; } + bool GetConfiguration(libcec_configuration & UNUSED(configuration)) { return false; } + std::string GetPortName(void) { return std::string("AMLOGIC"); } + uint16_t GetPhysicalAddress(void); @@ -695,18 +694,18 @@ index 0000000..8a7418d + }; +} diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake -index 532f213..382c39c 100644 +index b7773ee..58ba8f1 100644 --- a/src/libcec/cmake/CheckPlatformSupport.cmake +++ b/src/libcec/cmake/CheckPlatformSupport.cmake @@ -11,6 +11,7 @@ # HAVE_EXYNOS_API ON if Exynos is supported # HAVE_AOCEC_API ON if AOCEC is supported # HAVE_P8_USB ON if Pulse-Eight devices are supported -+# HAVE_AMLOGIC_API 1 if AMLOGIC is supported ++# HAVE_AMLOGIC_API ON if AMLOGIC is supported # HAVE_P8_USB_DETECT ON if Pulse-Eight devices can be auto-detected # HAVE_DRM_EDID_PARSER ON if DRM EDID parsing is supported # -@@ -137,6 +138,18 @@ else() +@@ -139,6 +140,18 @@ else() list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_EXYNOS}) endif() @@ -726,7 +725,7 @@ index 532f213..382c39c 100644 if (${HAVE_AOCEC_API}) set(LIB_INFO "${LIB_INFO}, AOCEC") diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake -index 7ec10f5..7a38d32 100644 +index 83a778a..c7088f3 100644 --- a/src/libcec/cmake/DisplayPlatformSupport.cmake +++ b/src/libcec/cmake/DisplayPlatformSupport.cmake @@ -56,5 +56,11 @@ else() @@ -742,10 +741,10 @@ index 7ec10f5..7a38d32 100644 message(STATUS "lib info: ${LIB_INFO}") diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in -index fe6c83d..09304e1 100644 +index 456a2e7..a40f931 100644 --- a/src/libcec/env.h.in +++ b/src/libcec/env.h.in -@@ -78,6 +78,9 @@ +@@ -82,6 +82,9 @@ /* Define to 1 for nVidia EDID parsing support (on selected models) */ #cmakedefine HAVE_NVIDIA_EDID_PARSER @HAVE_NVIDIA_EDID_PARSER@ @@ -755,3 +754,6 @@ index fe6c83d..09304e1 100644 /* Define to 1 for DRM EDID parsing support */ #cmakedefine HAVE_DRM_EDID_PARSER @HAVE_DRM_EDID_PARSER@ +-- +2.14.1 + diff --git a/projects/WeTek_Core/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch b/projects/WeTek_Core/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch new file mode 100644 index 0000000000..8457c54288 --- /dev/null +++ b/projects/WeTek_Core/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch @@ -0,0 +1,49 @@ +From 2b29cb0830548d4957f1d5ca86640831d224670e Mon Sep 17 00:00:00 2001 +From: Sam Nazarko +Date: Sun, 9 Apr 2017 17:34:36 +0100 +Subject: [PATCH] Make p8platform mutex mutable without changing libplatform + +Signed-off-by: Sam Nazarko +--- + src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp | 2 +- + src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +index 60813ed..798454e 100644 +--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +@@ -193,7 +193,7 @@ uint16_t CAmlogicCECAdapterCommunication::GetPhysicalAddress(void) + } + + +-cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) ++cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) const + { + CLockObject lock(m_mutex); + return m_logicalAddresses; +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +index 0e99cf8..635bb81 100644 +--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +@@ -66,7 +66,7 @@ namespace CEC + bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; } + bool StartBootloader(void) { return false; } + bool SetLogicalAddresses(const cec_logical_addresses &addresses); +- cec_logical_addresses GetLogicalAddresses(void); ++ cec_logical_addresses GetLogicalAddresses(void) const; + bool PingAdapter(void) { return IsInitialised(); } + uint16_t GetFirmwareVersion(void); + uint32_t GetFirmwareBuildDate(void) { return 0; } +@@ -98,7 +98,7 @@ namespace CEC + + bool m_bLogicalAddressChanged; + cec_logical_addresses m_logicalAddresses; +- P8PLATFORM::CMutex m_mutex; ++ mutable P8PLATFORM::CMutex m_mutex; + int m_fd; + }; + }; +-- +2.7.4 + diff --git a/projects/WeTek_Core/patches/linux/010-meson8_emulate_poweroff.patch b/projects/WeTek_Core/patches/linux/010-meson8_emulate_poweroff.patch new file mode 100644 index 0000000000..b80a77e0f7 --- /dev/null +++ b/projects/WeTek_Core/patches/linux/010-meson8_emulate_poweroff.patch @@ -0,0 +1,12 @@ +diff --git a/arch/arm/mach-meson8/pm.c b/arch/arm/mach-meson8/pm.c +index 754f7274b2e..9bda172c450 100755 +--- a/arch/arm/mach-meson8/pm.c ++++ b/arch/arm/mach-meson8/pm.c +@@ -421,6 +421,7 @@ static struct platform_driver meson_pm_driver = { + static int __init meson_pm_init(void) + { + printk("enter %s\n",__func__); ++ pm_power_off = meson_pm_suspend; + return platform_driver_probe(&meson_pm_driver, meson_pm_probe); + } + late_initcall(meson_pm_init); diff --git a/projects/WeTek_Hub/bootloader/release b/projects/WeTek_Hub/bootloader/release deleted file mode 100755 index 28c339b330..0000000000 --- a/projects/WeTek_Hub/bootloader/release +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. config/options $1 - -mkdir -p $RELEASE_DIR/3rdparty/bootloader -cp $INSTALL/usr/share/bootloader/dtb.img $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/WeTek_Hub/filesystem/etc/amremote/remote.conf b/projects/WeTek_Hub/filesystem/etc/amremote/remote.conf deleted file mode 100644 index 4995abb973..0000000000 --- a/projects/WeTek_Hub/filesystem/etc/amremote/remote.conf +++ /dev/null @@ -1,64 +0,0 @@ -#********************************************************************************************************* -#this file is configuration for each factory remote device -# work_mode 0 :software mode 1 :hardware mode -# repeat_enable 0 :disable repeat 1 :enable repeat -# -# factory_code each device has it's unique factory code. -# pattern:custom_code(16bit)+index_code(16bit) -# examble: 0xff000001 = 0xff00(custom cod) 0001 (index) -# -# release_delay unit:ms.release will report from kernel to user layer after this period of time -# from press or repeat triggered. -# -# debug_enable 0 :debug disable 1 :debug disable -# -# SW MODE: -# bit_count how many bits in each frame -# tw_leader_act time window for leader active -# tw_bit0 time window for bit0 time. -# tw_bit1 time window for bit1 time -# tw_repeat_leader time window for repeat leader -# REG -# reg_base_gen set value for PREG_IR_DEC_BASE_GEN -# reg_control set value for PREG_IR_DEC_CONTROL -# reg_leader_act set value for PREG_IR_DEC_LEADER_ACTIVE -# reg_leader_idle set value for PREG_IR_DEC_LEADER_IDLE -# reg_repeat_leader set value for PREG_IR_DEC_REPEAT_IDLE -# reg_bit0_time set value for PREG_IR_DEC_BIT0_TIME -#************************************************************************************************************* -#amlogic NEC remote -factory_code = 0x88770001 -work_mode = 0 -repeat_enable = 1 -repeat_delay = 40 -repeat_peroid = 39 -release_delay = 121 -debug_enable = 1 - -fn_key_scancode = 0xf3 -up_key_scancode = 0xf4 -down_key_scancode = 0xf5 -left_key_scancode = 0xf6 -right_key_scancode = 0xf7 -ok_key_scancode = 0xf8 - -mouse_begin - 0 0xf6 - 1 0xf7 - 2 0xf4 - 3 0xf5 -mouse_end - -key_begin - 0xf1 116 ; Power - 0xf2 102 ; Home - 0xf4 103 ; Up - 0xf5 108 ; Down - 0xf6 105 ; Left - 0xf7 106 ; Right - 0xf8 28 ; OK - 0xf9 1 ; Back - 0xfa 46 ; Menu - 0xfb 115 ; Volume Up - 0xfc 114 ; Volume Down -key_end diff --git a/projects/WeTek_Hub/filesystem/etc/lirc/lircd.conf.amremote b/projects/WeTek_Hub/filesystem/etc/lirc/lircd.conf.amremote deleted file mode 100644 index 23f81c501c..0000000000 --- a/projects/WeTek_Hub/filesystem/etc/lirc/lircd.conf.amremote +++ /dev/null @@ -1,554 +0,0 @@ -begin remote - - name wetek_hub - bits 16 - flags SPACE_ENC|CONST_LENGTH - eps 30 - aeps 100 - - header 9000 4500 - one 563 1687 - zero 563 562 - ptrail 563 - repeat 9000 2250 - pre_data_bits 16 - pre_data 0xEE11 - gap 0 - suppress_repeat 1 - - begin codes - KEY_POWER 0x8F70 - KEY_HOME 0x4FB0 - KEY_MUTE 0xCF30 - KEY_OK 0x1FE0 - KEY_LEFT 0x6F90 - KEY_RIGHT 0xEF10 - KEY_UP 0x2FD0 - KEY_DOWN 0xAF50 - KEY_BACK 0x9F60 - KEY_MENU 0x5FA0 - KEY_VOLUMEUP 0xDF20 - KEY_VOLUMEDOWN 0x3FC0 - end codes - -end remote - -# /etc/lirc/lircd.conf.rpi -# -# Lirc config for lirc_rpi (GPIO) receiver. -# Enables use of MCE Remote, Apple MacMini and XBOX remote. -# Should work with any generic receiver -# -# contributed by jenkins101 -# -######## -# -# brand: HP/Philips/Microsoft/Other -# model no. of remote control: Media Center Edition remote -# devices being controlled by this remote: myriad of devices with Media Center Edition receivers -# -# RC-6 config file -# -# source: http://home.hccnet.nl/m.majoor/projects_remote_control.htm -# http://home.hccnet.nl/m.majoor/pronto.pdf -# -# used by: Philips -# -######### -# -# Philips Media Center Edition remote control -# For use with the USB MCE ir receiver -# -# Dan Conti dconti|acm.wwu.edu -# -# Updated with codes for MCE 2005 Remote additional buttons -# *, #, Teletext, Red, Green, Yellow & Blue Buttons -# Note: TV power button transmits no code until programmed. -# Updated 12th September 2005 -# Graham Auld - mce|graham.auld.me.uk -# -# Radio, Print, RecTV are only available on the HP Media Center remote control -# -# -# Updated with codes for MCE 2007 Remote additional buttons -# Visualization, Aspect, SlideShow, Eject -# Note: -# Blue, Yellow, Green, Red, and Teletext buttons do not exist on some HP remote - -begin remote - - name mceusb - bits 16 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2667 889 - one 444 444 - zero 444 444 - pre_data_bits 21 - pre_data 0x37FF0 - gap 105000 - toggle_bit 22 - rc6_mask 0x100000000 - min_repeat 4 -# uncomment to suppress unwanted repeats - suppress_repeat 4 - - - begin codes - -#seen on HP Pavilion dv3t remote --Tim Mann, 3 Nov 2009 - KEY_VIDEO 0x00007b7f - KEY_PLAYPAUSE 0x00007b91 - - -#unused by HP remote - KEY_BLUE 0x00007ba1 - KEY_YELLOW 0x00007ba2 - KEY_GREEN 0x00007ba3 - KEY_RED 0x00007ba4 - KEY_TEXT 0x00007ba5 - -#ba6 - bae unused - BA6 0x00007ba6 - BA7 0x00007ba7 - BA8 0x00007ba8 - BA9 0x00007ba9 - BAA 0x00007baa - BAB 0x00007bab - BAC 0x00007bac - BAD 0x00007bad - BAE 0x00007bae - - KEY_RADIO 0x00007baf - Print 0x00007bb1 - -#bb2 - bb4 unused - BB2 0x00007bb2 - BB3 0x00007bb3 - BB4 0x00007bb4 - - KEY_VIDEO 0x00007bb5 - KEY_CAMERA 0x00007bb6 - KEY_PVR 0x00007bb7 - KEY_AUDIO 0x00007bb8 - KEY_TV 0x00007bb9 - -#bba - bbf unused - BBA 0x00007bba - BBB 0x00007bbb - BBC 0x00007bbc - BBD 0x00007bbd - BBE 0x00007bbe - BBF 0x00007bbf -#bc1 - bca unused - BC1 0x00007bc1 - BC2 0x00007bc2 - BC3 0x00007bc3 - BC4 0x00007bc4 - BC5 0x00007bc5 - BC6 0x00007bc6 - BC7 0x00007bc7 - BC8 0x00007bc8 - BC9 0x00007bc9 - BCA 0x00007bca - - KEY_EJECTCD 0x00007bcb - SlideShow 0x00007bcc - Visualization 0x00007bcd - -#bce - bcf unused - BCE 0x00007bce - BCF 0x00007bcf -#bd1 - bd7 unused - BD1 0x00007bd1 - BD2 0x00007bd2 - BD3 0x00007bd3 - BD4 0x00007bd4 - BD5 0x00007bd5 - BD6 0x00007bd6 - BD7 0x00007bd7 - - KEY_ANGLE 0x00007bd8 - KEY_EPG 0x00007bd9 - KEY_TV 0x00007bda - KEY_DVD 0x00007bdb -#NoGap - KEY_EXIT 0x00007bdc - KEY_OK 0x00007bdd - KEY_RIGHT 0x00007bde - KEY_LEFT 0x00007bdf - KEY_DOWN 0x00007be0 - KEY_UP 0x00007be1 -#NoGap - KEY_NUMERIC_STAR 0x00007be2 - KEY_NUMERIC_POUND 0x00007be3 -#NoGap - KEY_PREVIOUS 0x00007be4 - KEY_NEXT 0x00007be5 - KEY_STOP 0x00007be6 - KEY_PAUSE 0x00007be7 - KEY_RECORD 0x00007be8 - KEY_PLAY 0x00007be9 - KEY_REWIND 0x00007bea - KEY_FORWARD 0x00007beb -#NoGap - KEY_CHANNELDOWN 0x00007bec - KEY_CHANNELUP 0x00007bed - KEY_VOLUMEDOWN 0x00007bee - KEY_VOLUMEUP 0x00007bef -#NoGap - KEY_INFO 0x00007bf0 - KEY_MUTE 0x00007bf1 - KEY_HOME 0x00007bf2 - KEY_POWER 0x00007bf3 -#NoGap - KEY_ENTER 0x00007bf4 - KEY_CLEAR 0x00007bf5 -#NoGap - KEY_9 0x00007bf6 - KEY_8 0x00007bf7 - KEY_7 0x00007bf8 - KEY_6 0x00007bf9 - KEY_5 0x00007bfa - KEY_4 0x00007bfb - KEY_3 0x00007bfc - KEY_2 0x00007bfd - KEY_1 0x00007bfe - KEY_0 0x00007bff - end codes - -end remote - -# -# contributed by stevvie and jenkins101 -# -# brand: SIIG Vista MCE remote -# model no. of remote control: older Harmony and some vista mce remotes -# devices being controlled by this remote: -# - -begin remote - - name vista_mce - bits 16 - flags RC6 - eps 30 - aeps 100 - - header 2654 889 - one 427 427 - zero 427 427 - pre_data_bits 21 - pre_data 0x37FF0 - gap 69850 - min_repeat 4 -# increase to suppress unwanted repeats - suppress_repeat 4 - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_POWER 0xEBF3 # Power - KEY_CAMERA 0x6BB6 # Pictures - KEY_RADIO 0xEBAF # Radio - KEY_VIDEO 0x6BB5 # Videos - KEY_MUSIC 0xEBB8 # Music - KEY_RECORD 0x6BE8 # Rec - KEY_PAUSE 0xEBE7 # Pause - KEY_STOP 0x6BE6 # Stop - KEY_PREVIOUS 0xEBE4 # Skipback - KEY_PLAY 0x6BE9 # Play - KEY_NEXT 0xEBE5 # Skipfwd - KEY_REWIND 0x6BEA # Rwd - KEY_FORWARD 0xEBEB # Fwd - KEY_HOME 0x6BF2 # Start - KEY_EXIT 0xEBDC # Back - KEY_INFO 0x6BF0 # More - KEY_VOLUMEUP 0xEBEF # Volup - KEY_VOLUMEDOWN 0x6BEE # Voldown - KEY_CHANNELUP 0xEBED # Chup - KEY_CHANNELDOWN 0x6BEC # Chdown - KEY_UP 0xEBE1 # Up - KEY_DOWN 0x6BE0 # Down - KEY_LEFT 0xEBDF # Left - KEY_RIGHT 0x6BDE # Right - KEY_MUTE 0xEBF1 # Mute - KEY_PVR 0x6BB7 # Rectv - KEY_TITLE 0xEBD9 # Guide - KEY_TV 0x6BDA # Livetv - KEY_MENU 0xEBDB # Dvdmenu - KEY_1 0x6BFE # 1 - KEY_2 0xEBFD # 2 - KEY_3 0x6BFC # 3 - KEY_4 0xEBFB # 4 - KEY_5 0x6BFA # 5 - KEY_6 0xEBF9 # 6 - KEY_7 0x6BF8 # 7 - KEY_8 0xEBF7 # 8 - KEY_9 0x6BF6 # 9 - KEY_NUMERIC_STAR 0xEBE2 # * - KEY_0 0x6BFF # 0 - KEY_NUMERIC_POUND 0xEBE3 # # - KEY_CLEAR 0x6BF5 # Clear - KEY_ENTER 0xEBF4 # Enter - end codes - -end remote - -# -# this config file was automatically generated -# using lirc-0.8.2(macmini) on Tue Dec 11 11:35:26 2007 -# -# contributed by Sebastian Schaetzel -# -# brand: Apple -# model no. of remote control: A1156 -# devices being controlled by this remote: Mac mini, MacBookPro 15" -# SantaRosa (3.1), MacBook2 -# - -begin remote - - name Apple_A1156 - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - pre_data_bits 24 - pre_data 0x87EE81 - gap 211982 - toggle_bit_mask 0x0 - ignore_mask 0x0000ff01 - - begin codes - KEY_VOLUMEUP 0x0B - KEY_VOLUMEDOWN 0x0D - KEY_REWIND 0x08 - KEY_FORWARD 0x07 - KEY_PLAYPAUSE 0x04 - KEY_MENU 0x02 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.1-git(default) on Sat Jan 26 21:54:39 2013 -# -# contributed by -# -# brand: Microsoft -# model: Xbox DVD Remote -# devices being controlled by this remote: xbox - -begin remote - - name XboxDVDDongle - bits 8 - eps 30 - aeps 100 - - one 0 0 - zero 0 0 - gap 63950 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats -# toggle_bit_mask 0x72 - toggle_bit_mask 0xE1 - - begin codes - KEY_OK 0x0B - KEY_OK 0xEA - KEY_STOP 0xE0 - KEY_PAUSE 0xE6 - KEY_NEXT 0xDF - KEY_PREVIOUS 0xDD - KEY_FASTFORWARD 0xE3 - KEY_REWIND 0xE2 - KEY_MEDIA 0xD5 - KEY_EPG 0xE5 - KEY_INFO 0xC3 - KEY_UP 0xA6 - KEY_DOWN 0xA7 - KEY_LEFT 0xA9 - KEY_RIGHT 0xA8 - KEY_MENU 0xF7 - KEY_EXIT 0xD8 - KEY_0 0xCF - KEY_1 0xCE - KEY_2 0xCD - KEY_3 0xCC - KEY_4 0xCB - KEY_5 0xCA - KEY_6 0xC9 - KEY_7 0xC8 - KEY_8 0xC7 - KEY_9 0xC6 - end codes - -end remote - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.0-pre1(default) on Sat Feb 23 12:47:57 2013 -# -# contributed by DynaMight -# -# brand: Xbox 360 remote -# model no. of remote control: -# devices being controlled by this remote: -# - -begin remote - - name Xbox 360 Remote - bits 13 - flags RC6|CONST_LENGTH - eps 30 - aeps 100 - - header 2685 886 - one 457 433 - zero 457 433 - pre_data_bits 24 - pre_data 0x1BFF80 - gap 107197 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats - toggle_bit_mask 0x8000 - rc6_mask 0x100000000 - - begin codes - KEY_STOP 0x0BE6 - KEY_PLAY 0x0BE9 - KEY_VOLUMEDOWN 0x0BEE - KEY_VOLUMEUP 0x0BEF - KEY_MUTE 0x0BF1 - KEY_0 0x0BFF - KEY_1 0x0BFE - KEY_2 0x0BFD - KEY_3 0x0BFC - KEY_4 0x0BFB - KEY_5 0x0BFA - KEY_6 0x0BF9 - KEY_7 0x0BF8 - KEY_8 0x0BF7 - KEY_9 0x0BF6 - KEY_MENU 0x0BDB - KEY_YELLOW 0x0BD9 - KEY_BLUE 0x0B97 - KEY_GREEN 0x0B99 - KEY_RED 0x0BDA - KEY_REWIND 0x0BEA - KEY_PLAYPAUSE 0x0BE9 - KEY_FASTFORWARD 0x0BEB - KEY_EXIT 0x0BDC - KEY_TITLE 0x0BAE - KEY_STOP 0x0BE6 - KEY_INFO 0x0BF0 - KEY_UP 0x0BE1 - KEY_DOWN 0x0BE0 - KEY_LEFT 0x0BDF - KEY_RIGHT 0x0BDE - KEY_OK 0x0BDD - KEY_POWER 0x0BF3 - KEY_PAGEUP 0x0B93 - KEY_PAGEDOWN 0x0B92 - KEY_ENTER 0x0BF4 - KEY_RECORD 0x0BE8 - KEY_CLEAR 0x0BF5 - KEY_NEXTSONG 0x0BE5 - KEY_PREVIOUSSONG 0x0BE4 - KEY_DISPLAYTOGGLE 0x0BB0 - KEY_PAUSE 0x037FF00BE7 - end codes - -end remote - -# this config file was manually generated -# using WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Wed Feb 28 11:27:58 2007 -# -# contributed by Luca Cristoforetti -# -# brand: Dream Multimedia Dreambox 7025 -# model: URC-39930RJ0-03 -# devices being controlled by this remote: -# This is a remote with an option of a universal -# TV. Use TV CODE: 0680 -# -# (press TV, hold down shift until you got -# 2 blinks, enter the code and you get 2 -# flashes for confirmation) -# - -begin remote - - name Dream_Multimedia_URC-39930 - bits 24 - flags SPACE_ENC - eps 25 - aeps 100 - - header 3488 1710 - one 426 415 - zero 426 1287 - ptrail 426 - pre_data_bits 24 - pre_data 0xBFFBFE - gap 73939 - min_repeat 4 - suppress_repeat 4 -# uncomment to suppress unwanted repeats - toggle_bit 0 - - - begin codes - KEY_POWER 0x0000000000FF4342 - KEY_1 0x0000000000FFF7F6 - KEY_2 0x0000000000FF7776 - KEY_3 0x0000000000FFB7B6 - KEY_4 0x0000000000FF3736 - KEY_5 0x0000000000FFD7D6 - KEY_6 0x0000000000FF5756 - KEY_7 0x0000000000FF9796 - KEY_8 0x0000000000FF1716 - KEY_9 0x0000000000FFE7E6 - KEY_0 0x0000000000FF6766 - < 0x0000000000FF5F5E - > 0x0000000000FF2322 - KEY_VOLUMEUP 0x0000000000FFFBFA - KEY_VOLUMEDOWN 0x0000000000FF7B7A - KEY_MUTE 0x0000000000FFB3B2 - KEY_EXIT 0x0000000000DF84A5 - KEY_CHANNELUP 0x0000000000FFD3D2 - KEY_CHANNELDOWN 0x0000000000FF5352 - KEY_INFO 0x0000000000FF6362 - KEY_UP 0x0000000000FFADAC - KEY_LEFT 0x0000000000FF8D8C - KEY_RIGHT 0x0000000000FF0D0C - KEY_DOWN 0x0000000000FF2D2C - KEY_OK 0x0000000000FF6D6C - KEY_MENU 0x0000000000FF1E1F - KEY_AUDIO 0x0000000000FF3435 - KEY_VIDEO 0x0000000000FF1312 - KEY_BACKSPACE 0x0000000000FFF1F0 - KEY_PLAY 0x0000000000FF7170 - KEY_PAUSE 0x0000000000FFB1B0 - KEY_FORWARD 0x0000000000FF3130 - KEY_STOP 0x00000000007F6FEE - KEY_RADIO 0x0000000000FFB5B4 - KEY_TEXT 0x00000000007F3FBE - KEY_TITLE 0x00000000007FBF3E - end codes - -end remote diff --git a/projects/WeTek_Hub/filesystem/usr/lib/modules-load.d/meson-ir.conf b/projects/WeTek_Hub/filesystem/usr/lib/modules-load.d/meson-ir.conf deleted file mode 100644 index ac9cc29d2c..0000000000 --- a/projects/WeTek_Hub/filesystem/usr/lib/modules-load.d/meson-ir.conf +++ /dev/null @@ -1 +0,0 @@ -meson-ir diff --git a/projects/WeTek_Hub/filesystem/usr/share/bootloader/update.sh b/projects/WeTek_Hub/filesystem/usr/share/bootloader/update.sh deleted file mode 100755 index 81ce46dcd5..0000000000 --- a/projects/WeTek_Hub/filesystem/usr/share/bootloader/update.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" -[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" - -IMAGE_KERNEL="/flash/kernel.img" - -# parse command line arguments -for arg in $(cat /proc/cmdline); do - case $arg in - BOOT_IMAGE=*) - IMAGE_KERNEL="${arg#*=}" - ;; - esac -done - - -# mount $BOOT_ROOT r/w - mount -o remount,rw $BOOT_ROOT - -if [ -b $IMAGE_KERNEL ]; then - dd if="$SYSTEM_ROOT/usr/share/bootloader/dtb.img" of="/dev/dtb" bs=262144 2>&1 -else - cp -p $SYSTEM_ROOT/usr/share/bootloader/dtb.img $BOOT_ROOT -fi - -# mount $BOOT_ROOT r/o - sync - mount -o remount,ro $BOOT_ROOT diff --git a/projects/WeTek_Hub/initramfs/platform_init b/projects/WeTek_Hub/initramfs/platform_init deleted file mode 100755 index 2345ef3525..0000000000 --- a/projects/WeTek_Hub/initramfs/platform_init +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) -# -# OpenELEC 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. -# -# OpenELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC. If not, see . -################################################################################ - -hdmimode=1080p60hz - -# Parse command line arguments -for arg in $(cat /proc/cmdline); do - case $arg in - hdmimode=*) - hdmimode="${arg#*=}" - ;; - esac -done - -# Enable first framebuffer -echo 0 > /sys/class/graphics/fb0/blank - -# Disable second framebuffer -echo 1 > /sys/class/graphics/fb1/blank - -# Disable framebuffer scaling -echo 0 > /sys/class/graphics/fb0/free_scale -echo 0 > /sys/class/graphics/fb1/free_scale - -# set initial video state -echo 1 > /sys/class/video/disable_video - -# Set framebuffer geometry to match the resolution -case $hdmimode in - 480*) X=720 Y=480 ;; - 576*) X=720 Y=576 ;; - 720p*) X=1280 Y=720 ;; - *) X=1920 Y=1080 ;; -esac - -fbset -fb /dev/fb0 -g $X $Y 1920 2160 32 -fbset -fb /dev/fb1 -g 32 32 32 32 32 - -# Enable scaling for 4K output -case $hdmimode in - 4k*|smpte*|2160*) - echo 0 0 1919 1079 > /sys/class/graphics/fb0/free_scale_axis - echo 0 0 3839 2159 > /sys/class/graphics/fb0/window_axis - echo 1920 > /sys/class/graphics/fb0/scale_width - echo 1080 > /sys/class/graphics/fb0/scale_height - echo 0x10001 > /sys/class/graphics/fb0/free_scale - ;; -esac - -# Include deinterlacer into default VFM map -echo rm default > /sys/class/vfm/map -echo add default decoder ppmgr deinterlace amvideo > /sys/class/vfm/map diff --git a/projects/WeTek_Hub/install/updater-script b/projects/WeTek_Hub/install/updater-script deleted file mode 100644 index 06848b2499..0000000000 --- a/projects/WeTek_Hub/install/updater-script +++ /dev/null @@ -1,36 +0,0 @@ -show_progress(0.500000, 3); -set_bootloader_env("upgrade_step", "3"); - -ui_print("Wiping Userdata"); -format("ext4", "EMMC", "/dev/block/data", "0", "/data"); - -ui_print("Writing kernel image"); -assert(package_extract_file("KERNEL", "/tmp/boot.img"), - write_raw_image("/tmp/boot.img", "boot"), - delete("/tmp/boot.img")); - -ui_print("Writing device tree image"); -write_dtb_image(package_extract_file("dtb.img")); - -show_progress(0.020000, 0); - -ui_print("Wiping System"); -format("ext4", "EMMC", "/dev/block/system", "0", "/system"); -mount("ext4", "EMMC", "/dev/block/system", "/system"); -ui_print("Writing system files"); -package_extract_dir("system", "/system"); -unmount("/system"); - -show_progress(0.300000, 60); - -ui_print("Writing recovery"); -write_raw_image(package_extract_file("recovery.img"), "recovery"); - -show_progress(0.018000, 0); - -ui_print("Writing bootloader"); -write_raw_image(package_extract_file("bootloader.img"), "bootloader"); - -set_bootloader_env("upgrade_step", "1"); -show_progress(0.100000, 0); -ui_print("LibreELEC Installed Successfully"); diff --git a/projects/WeTek_Hub/kodi/advancedsettings.xml b/projects/WeTek_Hub/kodi/advancedsettings.xml deleted file mode 100644 index bcca951759..0000000000 --- a/projects/WeTek_Hub/kodi/advancedsettings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - false - - - 30 - - diff --git a/projects/WeTek_Hub/linux/linux.aarch64.conf b/projects/WeTek_Hub/linux/linux.aarch64.conf deleted file mode 100644 index 36ace205dd..0000000000 --- a/projects/WeTek_Hub/linux/linux.aarch64.conf +++ /dev/null @@ -1,3864 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm64 3.14.29 Kernel Configuration -# -CONFIG_ARM64=y -CONFIG_ARM64_HAS_SG_CHAIN=y -CONFIG_64BIT=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_NO_IOPORT=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -CONFIG_KERNEL_MODE_NEON=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_FHANDLE=y -# CONFIG_AUDIT is not set - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_SPARSE_IRQ=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_PREEMPT_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_RCU_USER_QS is not set -CONFIG_RCU_FANOUT=32 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FANOUT_EXACT is not set -# CONFIG_RCU_FAST_NO_HZ is not set -CONFIG_TREE_RCU_TRACE=y -# CONFIG_RCU_NOCB_CPU is not set -CONFIG_IKCONFIG=m -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_RESOURCE_COUNTERS=y -CONFIG_MEMCG=y -CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_MEMCG_KMEM=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -# CONFIG_CFS_BANDWIDTH is not set -# CONFIG_RT_GROUP_SCHED is not set -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -CONFIG_MM_OWNER=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_LZ4 is not set -CONFIG_INITRAMFS_COMPRESSION_NONE=y -# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_EXPERT=y -CONFIG_UID16=y -CONFIG_SYSCTL_SYSCALL=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -# CONFIG_AIO is not set -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -# CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_PROFILING is not set -CONFIG_JUMP_LABEL=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -CONFIG_STOP_MACHINE=y -CONFIG_BLOCK=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -CONFIG_BLK_DEV_THROTTLING=y -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -CONFIG_BLOCK_COMPAT=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -# CONFIG_DEFAULT_DEADLINE is not set -# CONFIG_DEFAULT_CFQ is not set -CONFIG_DEFAULT_NOOP=y -CONFIG_DEFAULT_IOSCHED="noop" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# Platform selection -# -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_MESON64_ODROIDC2 is not set - -# -# Bus support -# -CONFIG_ARM_AMBA=y - -# -# ARM errata workarounds via the alternatives framework -# -CONFIG_ARM64_ERRATUM_845719=y -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_ERRATUM_835769=y - -# -# Kernel Features -# -# CONFIG_ARM64_64K_PAGES is not set -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_SMP=y -CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set -# CONFIG_DISABLE_CPU_SCHED_DOMAIN_BALANCE is not set -CONFIG_SCHED_HMP=y -# CONFIG_SCHED_HMP_PRIO_FILTER is not set -CONFIG_HMP_FAST_CPU_MASK="" -CONFIG_HMP_SLOW_CPU_MASK="" -# CONFIG_HMP_VARIABLE_SCALE is not set -# CONFIG_SCHED_HMP_LITTLE_PACKING is not set -CONFIG_NR_CPUS=4 -CONFIG_HOTPLUG_CPU=y -CONFIG_SWP_EMULATE=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -CONFIG_HZ=100 -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_ARMV7_COMPAT=y -CONFIG_ARMV7_COMPAT_CPUINFO=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_ZONE_DMA_FLAG=0 -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 -# CONFIG_TRANSPARENT_HUGEPAGE is not set -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CLEANCACHE=y -CONFIG_FRONTSWAP=y -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZBUD is not set -# CONFIG_ZSWAP is not set -CONFIG_ZSMALLOC=y -# CONFIG_PGTABLE_MAPPING is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -# CONFIG_XEN is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -# CONFIG_SECCOMP is not set - -# -# Boot options -# -CONFIG_CMDLINE="" -# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_COREDUMP=y -CONFIG_COMPAT=y -CONFIG_SYSVIPC_COMPAT=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_HAS_WAKELOCK=y -CONFIG_HAS_EARLYSUSPEND=y -CONFIG_WAKELOCK=y -CONFIG_WAKELOCK_STAT=y -CONFIG_USER_WAKELOCK=y -CONFIG_EARLYSUSPEND=y -CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL=y -# CONFIG_CONSOLE_EARLYSUSPEND is not set -# CONFIG_FB_EARLYSUSPEND is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -CONFIG_PM_RUNTIME=y -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -CONFIG_ARCH_HAS_OPP=y -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_CPU_PM=y -# CONFIG_SUSPEND_TIME is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_HOTPLUG=y -CONFIG_CPU_FREQ_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -# CONFIG_GENERIC_CPUFREQ_CPU0 is not set - -# -# ARM CPU frequency scaling drivers -# -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARM64_CPU_SUSPEND=y - -# -# CPU Power Management -# - -# -# CPU Idle -# -# CONFIG_CPU_IDLE is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_GRE is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_ANDROID_PARANOID_NETWORK is not set -# CONFIG_NET_ACTIVITY_STATS is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=y - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -CONFIG_NF_NAT_IPV4=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_IP_NF_MANGLE is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RT is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -# CONFIG_IP6_NF_MANGLE is not set -# CONFIG_IP6_NF_RAW is not set -CONFIG_NF_NAT_IPV6=m -# CONFIG_IP6_NF_TARGET_MASQUERADE is not set -# CONFIG_IP6_NF_TARGET_NPT is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_IEEE802154 is not set -CONFIG_6LOWPAN_IPHC=m -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_HSR is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -CONFIG_CGROUP_NET_PRIO=y -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTSDIO=m -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_LL=y -# CONFIG_BT_HCIUART_3WIRE is not set -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -# CONFIG_BT_HCIVHCI is not set -CONFIG_BT_MRVL=m -CONFIG_BT_MRVL_SDIO=m -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -# CONFIG_MAC80211_RC_PID is not set -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -# CONFIG_WIMAX is not set -CONFIG_RFKILL=y -CONFIG_RFKILL_PM=y -CONFIG_RFKILL_LEDS=y -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set - -# -# Device Drivers -# - -# -# Amlogic Device Drivers -# -CONFIG_MESON_TIMER=y -# CONFIG_MESON_LOCAL_TIMER is not set -CONFIG_MESON_BC_TIMER=y -CONFIG_AM_UART=y -CONFIG_SERIAL_MESON_CONSOLE=y -# CONFIG_PRINTK_NOBLOCK_MODE is not set -CONFIG_AML_CPU_VERSION=y -CONFIG_AML_MESON64_VERSION=y -# CONFIG_AML_M8_VERSION is not set -CONFIG_AMLOGIC_IOMAP=y -CONFIG_PINCTRL_AMLOGIC=y - -# -# USB Support -# -CONFIG_AMLOGIC_USB=y -CONFIG_USB_DWC_OTG_HCD=y -CONFIG_USB_HOST_ELECT_TEST=y - -# -# I2C Hardware Bus support -# -CONFIG_I2C_AML=y -# CONFIG_I2C_SLAVE_AML is not set -# CONFIG_I2C_SW_AML is not set -# CONFIG_BCM2079X_I2C is not set -# CONFIG_AML_PWM is not set - -# -# HDMI TX Support -# -CONFIG_AML_HDMI_TX=y -CONFIG_AML_HDMI_TX_20=y -# CONFIG_AML_HDMI_TX_14 is not set -# CONFIG_AML_RTC is not set -CONFIG_AML_VRTC=y -# CONFIG_AM_IRBLASTER is not set -# CONFIG_AML_DEBUG is not set -CONFIG_AML_REG_ACCESS=y - -# -# Power Management Support -# -# CONFIG_AML_POWER_SUPPORT is not set -# CONFIG_AML_PMU_ALGORITHM_SUPPORT is not set -# CONFIG_AML_PMU4 is not set - -# -# Ethernet Support -# -# CONFIG_AM_PHY is not set -CONFIG_PHYLIB=y - -# -# MMC/SD/SDIO Host Controller Drivers -# - -# -# Multimedia Card support -# -CONFIG_MMC_AML=y -# CONFIG_MMC_AML_DEBUG is not set -# CONFIG_AML_MMC_DEBUG_FORCE_SINGLE_BLOCK_RW is not set - -# -# Amlogic VPU Drivers -# - -# -# Amlogic VPU Driver -# -CONFIG_AML_VPU=y -# CONFIG_AML_VPU_DYNAMIC_ADJ is not set - -# -# ION support -# -CONFIG_AMLOGIC_ION=y - -# -# Amlogic Display Driver -# -CONFIG_AML_DISPLAY=y - -# -# Amlogic VOUT Module -# -CONFIG_AM_VOUT=y -CONFIG_AM_TV_OUTPUT=y -CONFIG_AML_VOUT_FRAMERATE_AUTOMATION=y -# CONFIG_AML_VDAC_HW_SWITCH is not set - -# -# Amlogic OSD Module -# -CONFIG_AM_FB=y -# CONFIG_FB_OSD_SUPPORT_SYNC_FENCE is not set -CONFIG_FB_OSD_VSYNC_RDMA=y -CONFIG_FB_OSD2_ENABLE=y -# CONFIG_FB_OSD2_CURSOR is not set - -# -# Amlogic VOUT2 Module -# -# CONFIG_AM_VOUT2 is not set -# CONFIG_AM_TV_OUTPUT2 is not set - -# -# Amlogic OSD_EXT Module -# -# CONFIG_AM_FB_EXT is not set -CONFIG_AM_GE2D=y -CONFIG_AM_LOGO=y - -# -# Amlogic LCD Output Module -# -# CONFIG_AML_LCD is not set - -# -# Amlogic Backlight Support -# -# CONFIG_AML_BACKLIGHT is not set -# CONFIG_AMLOGIC_LED is not set - -# -# Canvas management driver -# -CONFIG_AML_CANVAS=y -CONFIG_AMLOGIC_CLK=y -CONFIG_AMLOGIC_SEC=y -# CONFIG_AML_SERR is not set -CONFIG_AMLOGIC_SECURITY_KEY=y -CONFIG_AM_PTSSERVER=y -# CONFIG_H264_4K2K_SINGLE_CORE is not set -CONFIG_VSYNC_RDMA=y -# CONFIG_TVIN_VIUIN is not set -CONFIG_AM_VIDEO=y -# CONFIG_AM_VIDEO2 is not set -# CONFIG_SUPPORT_VIDEO_ON_VPP2 is not set -CONFIG_GE2D_KEEP_FRAME=y - -# -# Video Decoders -# -CONFIG_AM_VDEC_MPEG12=y -CONFIG_AM_VDEC_MPEG4=y -CONFIG_AM_VDEC_VC1=y -CONFIG_AM_VDEC_H264=y -CONFIG_AM_VDEC_H264MVC=y -CONFIG_AM_VDEC_H264_4K2K=y -CONFIG_AM_VDEC_H265=y -CONFIG_AM_VDEC_VP9=y -CONFIG_AM_VDEC_MJPEG=y -CONFIG_AM_ENCODER=y -CONFIG_AM_JPEG_ENCODER=y -CONFIG_AM_PIC_DEC=y -CONFIG_AM_VDEC_REAL=y -CONFIG_AM_VDEC_AVS=y -# CONFIG_AM_JPEGDEC is not set -CONFIG_AM_TIMESYNC=y -CONFIG_AM_STREAMING=y -CONFIG_AM_SUBTITLE=y -CONFIG_AM_VIDEOCAPTURE=y -# CONFIG_AM_HEVCENC is not set - -# -# Deinterlace driver -# -CONFIG_DEINTERLACE=y -# CONFIG_AM_DEINTERLACE_SD_ONLY is not set -CONFIG_AML_VFM=y - -# -# EFUSE Support -# -CONFIG_EFUSE=y -# CONFIG_EFUSE_WRITE_VERSION_PERMIT is not set - -# -# key management Support -# -CONFIG_KEY_MANAGE=y - -# -# Audio Interface -# -CONFIG_AMAUDIO=y - -# -# Amlogic Audio Interface V2 -# -# CONFIG_AMAUDIO2 is not set - -# -# Audio dsp process -# -CONFIG_AML_AUDIO_DSP=y - -# -# Post Process Manager driver -# -CONFIG_POST_PROCESS_MANAGER=y -CONFIG_POST_PROCESS_MANAGER_PPSCALER=y -CONFIG_POST_PROCESS_MANAGER_3D_PROCESS=y - -# -# Amlogic Wifi Driver -# -CONFIG_AM_WIFI=y -# CONFIG_BCMDHD_USE_STATIC_BUF is not set -CONFIG_AML_POWER_RESET=y -# CONFIG_M8_POWER_RESET is not set -CONFIG_GXBB_POWER_RESET=y - -# -# Amlogic Bt Rfkill Driver -# -CONFIG_BT_DEVICE=y -# CONFIG_BLUESLEEP is not set - -# -# Amlogic ion video support -# -# CONFIG_VIDEOBUF2_ION is not set -# CONFIG_AMLOGIC_IONVIDEO is not set - -# -# V4L2 Video Support -# -CONFIG_V4L_AMLOGIC_VIDEO=y -# CONFIG_V4L_AMLOGIC_VIDEO2 is not set - -# -# Amlogic TVIN Drivers -# -CONFIG_TVIN=y -# CONFIG_TVIN_VDIN is not set -# CONFIG_TVIN_AFE is not set -CONFIG_TVIN_HDMI=y -# CONFIG_TVIN_HDMI_CEC is not set -# CONFIG_TVIN_BT656 is not set -# CONFIG_VIUIN is not set -# CONFIG_TVIN_ISP is not set - -# -# Amlogic VECM Drivers -# - -# -# Amlogic amvecm Driver -# -# CONFIG_AM_VECM is not set -# CONFIG_AML_NAND is not set -CONFIG_AM_INPUT=y -CONFIG_AM_SARADC=y -CONFIG_MESON_NEW_INPUT_REMOTE=y -CONFIG_NEW_AM_REMOTE=y -CONFIG_MESON_INPUT_KEYBOARD=y -# CONFIG_ADC_KEYPADS_AM is not set -CONFIG_AML_GPIO_KEY=y -# CONFIG_SENSOR_DEVICES is not set -# CONFIG_AMLOGIC_AVIN_DETECT is not set -# CONFIG_AMLOGIC_MESON_CPUFREQ is not set -CONFIG_AMLOGIC_SCPI_CPUFREQ=y -CONFIG_MESON_SUSPEND=y -# CONFIG_M8M2_SUSPEND is not set -CONFIG_GXBB_SUSPEND=y - -# -# Amlogic DVB driver -# -# CONFIG_AM_DVB is not set -# CONFIG_AM_ATVDEMOD is not set - -# -# AMLOGIC CI Driver -# -# CONFIG_AM_PCMCIA is not set -# CONFIG_AM_IOBUS is not set -# CONFIG_AML_SMARTCARD is not set - -# -# MESON MHU mailbox Support -# -CONFIG_MESON_MHU_MBOX=y -CONFIG_ARM_SCPI_PROTOCOL=y - -# -# RDMA management driver -# -CONFIG_AML_RDMA=y - -# -# Amlogic temperature sensor -# -CONFIG_AML_TEMP_SENSOR=y -# CONFIG_AUDIO_DATA is not set -# CONFIG_INSTABOOT is not set - -# -# Amlogic Camera Support -# -# CONFIG_VIDEO_AMLOGIC_CAPTURE is not set -CONFIG_AML_CODEC_MM=y -# CONFIG_AML_WDT is not set - -# -# AMLOGIC SPI Hardware bus support -# -# CONFIG_AMLOGIC_SPICC_MASTER is not set -# CONFIG_AMLOGIC_JTAG is not set -CONFIG_AMLOGIC_CPU_INFO=y - -# -# defend img file update support -# -# CONFIG_DEFEND_IMG is not set - -# -# AO CEC Support -# -CONFIG_AML_AO_CEC=y - -# -# Amlogic Crypto Support -# -# CONFIG_CRYPTO_AML is not set - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER_PATH="/sbin/mdev" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -CONFIG_FW_LOADER_USER_HELPER=y -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_HAVE_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=8 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -# CONFIG_CONNECTOR is not set -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_M25P80 is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_IDS=y -CONFIG_MTD_NAND_ECC=y -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND=y -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR flash memory drivers -# -# CONFIG_MTD_LPDDR is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_DTC=y -CONFIG_OF=y - -# -# Device Tree and Open Firmware support -# -CONFIG_PROC_DEVICETREE=y -# CONFIG_OF_SELFTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_MTD=y -CONFIG_OF_RESERVED_MEM=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -CONFIG_ZRAM=y -# CONFIG_ZRAM_DEBUG is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -CONFIG_VIRTIO_BLK=y -# CONFIG_BLK_DEV_RBD is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_UID_STAT is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_HAVE_PATA_PLATFORM=y -# CONFIG_ATA is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_TEAM is not set -CONFIG_MACVLAN=m -# CONFIG_MACVTAP is not set -CONFIG_VXLAN=m -CONFIG_NETCONSOLE=y -# CONFIG_NETCONSOLE_DYNAMIC is not set -CONFIG_NETPOLL=y -# CONFIG_NETPOLL_TRAP is not set -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -CONFIG_VETH=m -# CONFIG_VIRTIO_NET is not set -# CONFIG_NLMON is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_ARC=y -# CONFIG_ARC_EMAC is not set -# CONFIG_NET_CADENCE is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_CALXEDA_XGMAC is not set -# CONFIG_DNET is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_ETHOC is not set -# CONFIG_SH_ETH is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_STMMAC_ETH=y -CONFIG_STMMAC_PLATFORM=y -CONFIG_DWMAC_MESON=y -CONFIG_STMMAC_DEBUG_FS=y -CONFIG_STMMAC_DA=y -CONFIG_NET_VENDOR_VIA=y -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set - -# -# MII PHY device drivers -# -# CONFIG_AMLOGIC_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_AMD_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_FIXED_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPPOLAC=y -CONFIG_PPPOPNS=y -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=y - -# -# USB Network Adapters -# -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=m -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=y -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -CONFIG_WLAN=y -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_AT76C50X_USB is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_WIFI_CONTROL_FUNC is not set -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_WOW is not set -# CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set -# CONFIG_ATH9K_RFKILL is not set -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -CONFIG_CARL9170_HWRNG=y -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -CONFIG_AR5523=m -# CONFIG_ATH10K is not set -# CONFIG_WCN36XX is not set -CONFIG_B43=m -CONFIG_B43_SSB=y -# CONFIG_B43_SDIO is not set -CONFIG_B43_PIO=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -# CONFIG_BRCMFMAC_SDIO is not set -CONFIG_BRCMFMAC_USB=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -# CONFIG_HOSTAP is not set -# CONFIG_LIBERTAS is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -# CONFIG_P54_SPI is not set -CONFIG_P54_LEDS=y -CONFIG_RT2X00=m -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -# CONFIG_RT2800USB_RT3573 is not set -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_RTL_CARDS=m -# CONFIG_RTL8192CU is not set -# CONFIG_WL_TI is not set -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_KEYRESET is not set -# CONFIG_INPUT_KEYCOMBO is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYCHORD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_GPIO is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -CONFIG_DEVKMEM=y - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SUPPORT_SYSRQ is not set -CONFIG_TTY_PRINTK=y -# CONFIG_VIRTIO_CONSOLE is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=m -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_ATMEL is not set -CONFIG_HW_RANDOM_MESON=m -# CONFIG_HW_RANDOM_VIRTIO is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_R3964 is not set - -# -# PCMCIA character devices -# -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -CONFIG_I2C_GPIO=y -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_CAPRI is not set -# CONFIG_PINCTRL_MSM8X74 is not set -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_GPIO_SYSFS is not set - -# -# Memory mapped GPIO drivers: -# -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_GRGPIO is not set - -# -# I2C GPIO expanders: -# -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set - -# -# PCI GPIO expanders: -# - -# -# SPI GPIO expanders: -# -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_74X164 is not set - -# -# AC97 GPIO expanders: -# - -# -# LPC GPIO expanders: -# - -# -# MODULbus GPIO expanders: -# -# CONFIG_GPIO_BCM_KONA is not set - -# -# USB GPIO expanders: -# -# CONFIG_W1 is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27x00 is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_SMB347 is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_GPIO is not set -CONFIG_POWER_RESET_VEXPRESS=y -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_AVS is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_USER_SPACE is not set -CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y -CONFIG_CPU_THERMAL=y -# CONFIG_DEVFREQ_THERMAL is not set -CONFIG_CPUCORE_THERMAL=y -CONFIG_GPU_THERMAL=y -CONFIG_GPUCORE_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set - -# -# Texas Instruments thermal drivers -# -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -CONFIG_VEXPRESS_CONFIG=y -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_REGULATOR_VEXPRESS is not set -CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_RESOURCE=y -CONFIG_VIDEOBUF_DVB=m -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=y -CONFIG_RC_MAP=m -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_RC5_SZ_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_MESON=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -# CONFIG_VIDEO_USBTV is not set - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_TLG2300 is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_STK1160_COMMON is not set - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -CONFIG_DVB_USB_GL861=m -CONFIG_DVB_USB_IT913X=m -CONFIG_DVB_USB_LME2510=m -CONFIG_DVB_USB_MXL111SF=m -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -# CONFIG_VIDEO_EM28XX_V4L2 is not set -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -# CONFIG_V4L_PLATFORM_DRIVERS is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m -# CONFIG_RADIO_ADAPTERS is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=y - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=y -CONFIG_MEDIA_TUNER_SIMPLE=y -CONFIG_MEDIA_TUNER_TDA8290=y -CONFIG_MEDIA_TUNER_TDA827X=y -CONFIG_MEDIA_TUNER_TDA18271=y -CONFIG_MEDIA_TUNER_TDA9887=y -CONFIG_MEDIA_TUNER_TEA5761=y -CONFIG_MEDIA_TUNER_TEA5767=y -CONFIG_MEDIA_TUNER_MT20XX=y -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=y -CONFIG_MEDIA_TUNER_XC5000=y -CONFIG_MEDIA_TUNER_XC4000=y -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=y -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88TS2022=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LG2160=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_IT913X_FE=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -# CONFIG_DRM is not set -# CONFIG_VGASTATE is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -CONFIG_VEXPRESS_DVI_CONTROL=y -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_EXYNOS_VIDEO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=y -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_ADF is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -# CONFIG_FB_SSD1307 is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_HRTIMER=m -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_VERBOSE_PROCFS is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -# CONFIG_SND_DRIVERS is not set -# CONFIG_SND_SPI is not set -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_6FIRE=m -# CONFIG_SND_USB_HIFACE is not set -CONFIG_SND_SOC=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_AML_M8_SOC=y -CONFIG_SND_AML_M8=y -CONFIG_SND_AML_SPLIT_MODE=y -# CONFIG_SND_AML_SPLIT_MODE_MMAP is not set -CONFIG_SND_SOC_I2C_AND_SPI=y -CONFIG_SND_SOC_DUMMY_CODEC=y -CONFIG_SND_SOC_TAS5707=y -CONFIG_SND_SOC_TAS5717=y -CONFIG_SND_SOC_TAS5731=y -CONFIG_SND_SOC_PCM2BT=y -CONFIG_SND_SOC_AMLT9015=y -CONFIG_SND_SOC_AMLT9015S=y -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SOUND_PRIME is not set - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -# CONFIG_UHID is not set -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_DIA_REMOTE is not set -# CONFIG_HID_PRODIKEYS is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_HUION is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -CONFIG_HID_LENOVO_TPKBD=m -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PETALYNX=y -CONFIG_HID_PICOLCD=m -CONFIG_HID_PICOLCD_FB=y -CONFIG_HID_PICOLCD_BACKLIGHT=y -CONFIG_HID_PICOLCD_LCD=y -CONFIG_HID_PICOLCD_LEDS=y -# CONFIG_HID_PICOLCD_CIR is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -# CONFIG_SONY_FF is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SUNPLUS=y -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_EHCI_HCD is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FUSBH200_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_RENESAS_USBHS is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_CHIPIDEA is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=y -CONFIG_USB_SERIAL_CONSOLE=y -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=m -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=m -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -CONFIG_USB_SERIAL_IUU=m -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=y -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_ZTE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WAKELOCK is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_ULPI is not set -# CONFIG_AMLOGIC_USBPHY is not set -# CONFIG_AMLOGIC_USB2PHY is not set -# CONFIG_AMLOGIC_USB3PHY is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=2 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_AUDIO is not set -# CONFIG_USB_ETH is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_PXP_MMC=y -CONFIG_MMC_UNSAFE_RESUME=y -# CONFIG_MMC_CLKGATE is not set -# CONFIG_MMC_EMBEDDED_SDIO is not set -# CONFIG_MMC_PARANOID_SD_INIT is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_ARMMMCI=y -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y - -# -# LED drivers -# -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9685 is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_BLINKM is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -CONFIG_SWITCH=y -# CONFIG_SWITCH_GPIO is not set -# CONFIG_ACCESSIBILITY is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_DS2404 is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_MOXART is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_DMADEVICES is not set -# CONFIG_AUXDISPLAY is not set -CONFIG_UIO=y -# CONFIG_UIO_PDRV_GENIRQ is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO=y - -# -# Virtio drivers -# -# CONFIG_VIRTIO_BALLOON is not set -CONFIG_VIRTIO_MMIO=y -# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -# CONFIG_USBIP_CORE is not set -# CONFIG_W35UND is not set -# CONFIG_PRISM2_USB is not set -# CONFIG_ECHO is not set -# CONFIG_COMEDI is not set -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -# CONFIG_R8188EU is not set -# CONFIG_RTS5139 is not set -# CONFIG_TRANZPORT is not set -# CONFIG_LINE6_USB is not set -# CONFIG_USB_SERIAL_QUATECH2 is not set -CONFIG_VT6656=m -# CONFIG_USB_ENESTORAGE is not set -# CONFIG_BCM_WIMAX is not set -# CONFIG_FT1000 is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -CONFIG_STAGING_MEDIA=y -CONFIG_DVB_AS102=m -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_USB_MSI3101 is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_USB_SN9C102 is not set -CONFIG_LIRC_STAGING=y -CONFIG_LIRC_IGORPLUGUSB=m -# CONFIG_LIRC_IMON is not set -# CONFIG_LIRC_SASEM is not set -# CONFIG_LIRC_SERIAL is not set -# CONFIG_LIRC_SIR is not set -# CONFIG_LIRC_ZILOG is not set - -# -# Android -# -CONFIG_ANDROID=y -# CONFIG_ANDROID_BINDER_IPC is not set -# CONFIG_ASHMEM is not set -# CONFIG_ANDROID_LOGGER is not set -# CONFIG_ANDROID_TIMED_OUTPUT is not set -# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set -# CONFIG_ANDROID_INTF_ALARM_DEV is not set -CONFIG_SYNC=y -# CONFIG_SW_SYNC is not set -CONFIG_ION=y -# CONFIG_ION_TEST is not set -# CONFIG_ION_DUMMY is not set -# CONFIG_FIQ_DEBUGGER is not set -# CONFIG_FIQ_WATCHDOG is not set -# CONFIG_USB_WPAN_HCD is not set -# CONFIG_WIMAX_GDM72XX is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_CED1401 is not set -# CONFIG_DGRP is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_XILLYBUS is not set -# CONFIG_DGAP is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -CONFIG_COMMON_CLK_VERSATILE=y -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -CONFIG_COMMON_CLK_XGENE=y -CONFIG_COMMON_CLK_SCPI=y -# CONFIG_COMMON_CLK_QCOM is not set - -# -# Hardware Spinlock drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_MAILBOX=y -# CONFIG_PL320_MBOX is not set -CONFIG_IOMMU_SUPPORT=y -CONFIG_OF_IOMMU=y -# CONFIG_ARM_SMMU is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# -CONFIG_PM_DEVFREQ=y - -# -# DEVFREQ Governors -# -# CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND is not set -# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set -# CONFIG_DEVFREQ_GOV_POWERSAVE is not set -# CONFIG_DEVFREQ_GOV_USERSPACE is not set - -# -# DEVFREQ Drivers -# -# CONFIG_EXTCON is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_PWM is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V3=y -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_POWERCAP is not set -# CONFIG_CORESIGHT is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_REISERFS_FS_XATTR is not set -CONFIG_JFS_FS=m -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=m -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=y - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_EXFAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=y -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS2_FS is not set -CONFIG_UBIFS_FS=y -# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -CONFIG_SQUASHFS_FILE_CACHE=y -# CONFIG_SQUASHFS_FILE_DIRECT is not set -CONFIG_SQUASHFS_DECOMP_SINGLE=y -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -# CONFIG_F2FS_CHECK_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -# CONFIG_NFS_V4_2 is not set -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -# CONFIG_NFS_V4_1_MIGRATION is not set -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set -# CONFIG_VIRTUALIZATION is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -CONFIG_DEBUG_INFO=y -# CONFIG_DEBUG_INFO_REDUCED is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -# CONFIG_MAGIC_SYSRQ is not set -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHEDSTATS is not set -CONFIG_TIMER_STATS=y - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -CONFIG_STACKTRACE=y -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_CPU_STALL_INFO is not set -CONFIG_RCU_TRACE=y -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_ENABLE_DEFAULT_TRACERS is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_STACK_TRACER is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_PROBE_EVENTS is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_MODULE is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_CHECK_ISR_TIME is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_PID_IN_CONTEXTIDR is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -CONFIG_SECURITYFS=y -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_PCOMP2=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -# CONFIG_CRYPTO_GCM is not set -CONFIG_CRYPTO_SEQIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set -CONFIG_CRYPTO_CRCT10DIF=m -# CONFIG_CRYPTO_GHASH is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -# CONFIG_CRYPTO_ZLIB is not set -CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=m -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -CONFIG_CRYPTO_HW=y -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ARM64_CRYPTO is not set -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=m -CONFIG_BITREVERSE=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=m -CONFIG_CRC16=y -CONFIG_CRC_T10DIF=m -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m -# CONFIG_CRC8 is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_AVERAGE=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y diff --git a/projects/WeTek_Hub/options b/projects/WeTek_Hub/options deleted file mode 100644 index 9a8decd1d5..0000000000 --- a/projects/WeTek_Hub/options +++ /dev/null @@ -1,138 +0,0 @@ -################################################################################ -# setup system defaults -################################################################################ - - # The TARGET_CPU variable controls which processor should be targeted for - # generated code. - case $TARGET_ARCH in - aarch64) - # TARGET_CPU: - # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d - # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c - # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t - # arm720t arm740t strongarm strongarm110 strongarm1100 - # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t - # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi - # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e - # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s - # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 - # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. - # - TARGET_CPU="cortex-a53" - TARGET_CPU_FLAGS="+crc+fp+simd" - ;; - esac - - # Bootloader to use (syslinux / u-boot / atv-bootloader / bcm2835-bootloader) - BOOTLOADER="u-boot" - - # u-boot version to use (default) - UBOOT_VERSION="" - - # Configuration for u-boot - UBOOT_CONFIG="" - - # Target Configfile for u-boot - UBOOT_CONFIGFILE="" - - # Kernel target - KERNEL_TARGET="Image.lzo" - - # Kernel extra targets to build - KERNEL_UBOOT_EXTRA_TARGET="gxbb_p200_1G_wetek_hub.dtb" - - # Build Android kernel image using mkbootimg - BUILD_ANDROID_BOOTIMG="yes" - - # Additional options to be passed to Android mkbootimg - ANDROID_BOOTIMG_OPTIONS="--second arch/arm64/boot/dts/amlogic/gxbb_p200_1G_wetek_hub.dtb --base 0x0 --kernel_offset 0x1080000" - - # Additional kernel make parameters (for example to specify the u-boot loadaddress) - KERNEL_MAKE_EXTRACMD="" - - # Kernel to use. values can be: - # default: default mainline kernel - LINUX="amlogic-3.14" - - -################################################################################ -# setup build defaults -################################################################################ - - # Project CFLAGS - PROJECT_CFLAGS="" - - # SquashFS compression method (gzip / lzo / xz) - SQUASHFS_COMPRESSION="lzo" - -################################################################################ -# setup project defaults -################################################################################ - - # build and install ALSA Audio support (yes / no) - ALSA_SUPPORT="yes" - - # OpenGL(X) implementation to use (no / Mesa) - OPENGL="no" - - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson6) - OPENGLES="opengl-meson" - - # Amlogic Meson SOC family (8 / 6 / gxbb) - MESON_FAMILY="gxbb" - - # include uvesafb support (yes / no) - UVESAFB_SUPPORT="no" - - # Displayserver to use (x11 / no) - DISPLAYSERVER="no" - - # Windowmanager to use (ratpoison / fluxbox / none) - WINDOWMANAGER="none" - - # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau) - # Space separated list is supported, - # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" - GRAPHIC_DRIVERS="" - - # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap / libamcodec) - KODIPLAYER_DRIVER="libamcodec" - - # Modules to install in initramfs for early boot - INITRAMFS_MODULES="" - - # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers - # Space separated list is supported, - # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="gpu-aml brcmap6xxx-aml" - - # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) - # Space separated list is supported, - # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-aml" - - # build and install ATV IR remote support (yes / no) - ATVCLIENT_SUPPORT="no" - - # Amlogic IR remote support (yes / no) - AMREMOTE_SUPPORT="no" - - # build with swap support (yes / no) - SWAP_SUPPORT="no" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - - # build with installer (yes / no) - INSTALLER_SUPPORT="no" - - # extra build dependeices - EXTRA_DEPS="mkimage" - EXTRA_DEPS_PKG="u-boot-tools" - - # kernel image name - KERNEL_NAME="kernel.img" diff --git a/projects/WeTek_Hub/patches/linux/bt_device_on_after_probe.patch b/projects/WeTek_Hub/patches/linux/bt_device_on_after_probe.patch deleted file mode 100644 index a7c7ac24b3..0000000000 --- a/projects/WeTek_Hub/patches/linux/bt_device_on_after_probe.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/amlogic/bluetooth/bt_device.c b/drivers/amlogic/bluetooth/bt_device.c -index 6ebd7f2..87d1916 100644 ---- a/drivers/amlogic/bluetooth/bt_device.c -+++ b/drivers/amlogic/bluetooth/bt_device.c -@@ -235,6 +235,7 @@ static int bt_probe(struct platform_device *pdev) - register_early_suspend(&bt_early_suspend); - #endif - -+ bt_device_on(pdata); - return 0; - - err_rfkill: diff --git a/projects/WeTek_Hub/patches/linux/hdmi_always_connected.patch b/projects/WeTek_Hub/patches/linux/hdmi_always_connected.patch deleted file mode 100644 index 4204ed9467..0000000000 --- a/projects/WeTek_Hub/patches/linux/hdmi_always_connected.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/drivers/amlogic/display/logo/logo.c b/drivers/amlogic/display/logo/logo.c -index 9266be3..c2f10bd 100644 ---- a/drivers/amlogic/display/logo/logo.c -+++ b/drivers/amlogic/display/logo/logo.c -@@ -117,7 +117,7 @@ int set_osd_freescaler(int index, enum vmode_e new_mode) - static int refresh_mode_and_logo(bool first) - { - enum vmode_e cur_mode = VMODE_MAX; -- int hdp_state = get_hpd_state(); -+ int hdp_state = 1;//get_hpd_state(); - - if (!first && osd_get_logo_index() != logo_info.index) - return -1; diff --git a/projects/WeTek_Hub/patches/linux/temporarily_use_hdmimode_param_instead_of_vout.patch b/projects/WeTek_Hub/patches/linux/temporarily_use_hdmimode_param_instead_of_vout.patch deleted file mode 100644 index 23f6b0e9f6..0000000000 --- a/projects/WeTek_Hub/patches/linux/temporarily_use_hdmimode_param_instead_of_vout.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/drivers/amlogic/display/logo/logo.c b/drivers/amlogic/display/logo/logo.c -index 9266be3..6803f10 100644 ---- a/drivers/amlogic/display/logo/logo.c -+++ b/drivers/amlogic/display/logo/logo.c -@@ -246,6 +246,7 @@ __setup("logo=", logo_setup); - static int __init get_hdmi_mode(char *str) - { - hdmimode = vmode_name_to_mode(str); -+ set_vout_init_vmode(str); - - pr_info("get hdmimode: %s\n", str); - return 1; -diff --git a/drivers/amlogic/display/vout/vout_serve.c b/drivers/amlogic/display/vout/vout_serve.c -index fae61b3..a248367 100644 ---- a/drivers/amlogic/display/vout/vout_serve.c -+++ b/drivers/amlogic/display/vout/vout_serve.c -@@ -664,7 +664,16 @@ static int __init get_vout_init_mode(char *str) - - return 0; - } --__setup("vout=", get_vout_init_mode); -+//__setup("vout=", get_vout_init_mode); -+ -+void set_vout_init_vmode(char *str) -+{ -+ char str2[1024]; -+ strcpy(str2, str); -+ strcat(str2, ",en"); // logo was already displayed by uboot -+ get_vout_init_mode(str2); -+} -+EXPORT_SYMBOL(set_vout_init_vmode); - - MODULE_AUTHOR("Platform-BJ "); - MODULE_DESCRIPTION("VOUT Server Module"); -diff --git a/include/linux/amlogic/vout/vout_notify.h b/include/linux/amlogic/vout/vout_notify.h -index 2e4922a..659da93 100644 ---- a/include/linux/amlogic/vout/vout_notify.h -+++ b/include/linux/amlogic/vout/vout_notify.h -@@ -102,6 +102,7 @@ extern enum vmode_e validate_vmode2(char *); - extern void set_vout2_mode_internal(char *name); - extern enum vmode_e get_logo_vmode(void); - extern int set_logo_vmode(enum vmode_e); -+extern void set_vout_init_vmode(char *); - - extern int vout2_suspend(void); - extern int vout2_resume(void); diff --git a/projects/WeTek_Play/filesystem/etc/asound.conf b/projects/WeTek_Play/filesystem/etc/asound.conf deleted file mode 100644 index 85204e0479..0000000000 --- a/projects/WeTek_Play/filesystem/etc/asound.conf +++ /dev/null @@ -1,11 +0,0 @@ -pcm.!default { - type hw - card 0 - device 0 - format S16_LE -} - -ctl.!default { - type hw - card 0 -} diff --git a/projects/WeTek_Play/filesystem/usr/bin/cputemp b/projects/WeTek_Play/filesystem/usr/bin/cputemp new file mode 100755 index 0000000000..11535271c5 --- /dev/null +++ b/projects/WeTek_Play/filesystem/usr/bin/cputemp @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) + +TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" +echo "$(( $TEMP / 1000 )) C" diff --git a/projects/WeTek_Play/filesystem/usr/bin/gputemp b/projects/WeTek_Play/filesystem/usr/bin/gputemp new file mode 120000 index 0000000000..6476b954d2 --- /dev/null +++ b/projects/WeTek_Play/filesystem/usr/bin/gputemp @@ -0,0 +1 @@ +cputemp \ No newline at end of file diff --git a/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/ap6210-nvram.txt b/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/ap6210-nvram.txt deleted file mode 100644 index 6cb3fd730e..0000000000 --- a/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/ap6210-nvram.txt +++ /dev/null @@ -1,57 +0,0 @@ -#AP6210_NVRAM_V1.2_03192013 -manfid=0x2d0 -prodid=0x492 -vendid=0x14e4 -devid=0x4343 -boardtype=0x0598 - -# Board Revision is P307, same nvram file can be used for P304, P305, P306 and P307 as the tssi pa params used are same -#Please force the automatic RX PER data to the respective board directory if not using P307 board, for e.g. for P305 boards force the data into the following directory /projects/BCM43362/a1_labdata/boardtests/results/sdg_rev0305 -boardrev=0x1307 -boardnum=777 -xtalfreq=26000 -boardflags=0x80201 -boardflags2=0x80 -sromrev=3 -wl0id=0x431b -macaddr=00:90:4c:07:71:12 -aa2g=1 -ag0=2 -maxp2ga0=74 -cck2gpo=0x2222 -ofdm2gpo=0x44444444 -mcs2gpo0=0x6666 -mcs2gpo1=0x6666 -pa0maxpwr=56 - -#P207 PA params -#pa0b0=5447 -#pa0b1=-658 -#pa0b2=-175
- -#Same PA params for P304,P305, P306, P307 - -pa0b0=5447 -pa0b1=-607 -pa0b2=-160 -pa0itssit=62 -pa1itssit=62 - - -cckPwrOffset=5 -ccode=0 -rssismf2g=0xa -rssismc2g=0x3 -rssisav2g=0x7 -triso2g=0 -noise_cal_enable_2g=0 -noise_cal_po_2g=0 -swctrlmap_2g=0x04040404,0x02020202,0x02020202,0x010101,0x1ff -temp_add=29767 -temp_mult=425 - -btc_flags=0x6 -btc_params0=5000 -btc_params1=1000 -btc_params6=63 - diff --git a/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/bcm20710a1.hcd b/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/bcm20710a1.hcd deleted file mode 100644 index ebfedd9f2d..0000000000 Binary files a/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/bcm20710a1.hcd and /dev/null differ diff --git a/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/fw_bcm40181a2.bin b/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/fw_bcm40181a2.bin deleted file mode 100644 index ae76625463..0000000000 Binary files a/projects/WeTek_Play/filesystem/usr/lib/firmware/brcm/fw_bcm40181a2.bin and /dev/null differ diff --git a/projects/WeTek_Play/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf b/projects/WeTek_Play/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf new file mode 100644 index 0000000000..4ca7168beb --- /dev/null +++ b/projects/WeTek_Play/filesystem/usr/lib/systemd/sleep.conf.d/sleep.conf @@ -0,0 +1,3 @@ +[Sleep] +SuspendMode=false +HibernateMode=false diff --git a/projects/WeTek_Play/initramfs/platform_init b/projects/WeTek_Play/initramfs/platform_init index 1baf6c8a79..0debd06d0b 100755 --- a/projects/WeTek_Play/initramfs/platform_init +++ b/projects/WeTek_Play/initramfs/platform_init @@ -1,21 +1,7 @@ #!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2014 Alex Deryskyba (alex@codesnake.com) -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2014 Alex Deryskyba (alex@codesnake.com) hdmimode="720p" diff --git a/projects/WeTek_Play/kodi/advancedsettings.xml b/projects/WeTek_Play/kodi/advancedsettings.xml deleted file mode 100644 index bcca951759..0000000000 --- a/projects/WeTek_Play/kodi/advancedsettings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - false - - - 30 - - diff --git a/projects/WeTek_Play/linux/linux.arm.conf b/projects/WeTek_Play/linux/linux.arm.conf index 95d0c0b767..9f1c0ba66e 100644 --- a/projects/WeTek_Play/linux/linux.arm.conf +++ b/projects/WeTek_Play/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.10.99 Kernel Configuration +# Linux/arm 3.10.108 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -111,9 +111,7 @@ CONFIG_CGROUPS=y # CONFIG_SYSFS_DEPRECATED is not set # CONFIG_RELAY is not set CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_INITRAMFS_SOURCE="" CONFIG_RD_GZIP=y # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set @@ -142,7 +140,7 @@ CONFIG_SIGNALFD=y CONFIG_TIMERFD=y CONFIG_EVENTFD=y CONFIG_SHMEM=y -# CONFIG_AIO is not set +CONFIG_AIO=y CONFIG_EMBEDDED=y CONFIG_HAVE_PERF_EVENTS=y CONFIG_PERF_USE_VMALLOC=y @@ -151,7 +149,7 @@ CONFIG_PERF_USE_VMALLOC=y # Kernel Performance Events And Counters # # CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set +CONFIG_VM_EVENT_COUNTERS=y CONFIG_SLUB_DEBUG=y # CONFIG_COMPAT_BRK is not set # CONFIG_SLAB is not set @@ -592,7 +590,11 @@ CONFIG_UNIX=y # CONFIG_NET_KEY is not set CONFIG_INET=y CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IP_FIB_TRIE_STATS is not set +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_ROUTE_MULTIPATH is not set +# CONFIG_IP_ROUTE_VERBOSE is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y @@ -601,6 +603,7 @@ CONFIG_IP_PNP_BOOTP=y # CONFIG_NET_IPGRE_DEMUX is not set CONFIG_NET_IP_TUNNEL=m CONFIG_IP_MROUTE=y +# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set # CONFIG_IP_PIMSM_V1 is not set # CONFIG_IP_PIMSM_V2 is not set # CONFIG_ARPD is not set @@ -615,8 +618,21 @@ CONFIG_INET_TUNNEL=m # CONFIG_INET_XFRM_MODE_BEET is not set CONFIG_INET_LRO=y # CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set CONFIG_TCP_CONG_CUBIC=y +# CONFIG_TCP_CONG_WESTWOOD is not set +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +# CONFIG_TCP_CONG_HYBLA is not set +CONFIG_TCP_CONG_VEGAS=m +CONFIG_TCP_CONG_SCALABLE=m +# CONFIG_TCP_CONG_LP is not set +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +CONFIG_DEFAULT_CUBIC=y +# CONFIG_DEFAULT_RENO is not set CONFIG_DEFAULT_TCP_CONG="cubic" # CONFIG_TCP_MD5SIG is not set CONFIG_IPV6=y @@ -640,8 +656,6 @@ CONFIG_IPV6_NDISC_NODETYPE=y # CONFIG_IPV6_GRE is not set # CONFIG_IPV6_MULTIPLE_TABLES is not set # CONFIG_IPV6_MROUTE is not set -# CONFIG_ANDROID_PARANOID_NETWORK is not set -# CONFIG_NET_ACTIVITY_STATS is not set # CONFIG_NETWORK_SECMARK is not set # CONFIG_NETWORK_PHY_TIMESTAMPING is not set CONFIG_NETFILTER=y @@ -748,7 +762,6 @@ CONFIG_NETFILTER_XT_MATCH_IPRANGE=m CONFIG_NETFILTER_XT_MATCH_OWNER=m # CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set # CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set # CONFIG_NETFILTER_XT_MATCH_RATEEST is not set # CONFIG_NETFILTER_XT_MATCH_REALM is not set # CONFIG_NETFILTER_XT_MATCH_RECENT is not set @@ -774,7 +787,6 @@ CONFIG_IP_NF_IPTABLES=m # CONFIG_IP_NF_MATCH_TTL is not set CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_REJECT_SKERR is not set # CONFIG_IP_NF_TARGET_ULOG is not set CONFIG_NF_NAT_IPV4=m CONFIG_IP_NF_TARGET_MASQUERADE=m @@ -807,7 +819,6 @@ CONFIG_IP6_NF_IPTABLES=m # CONFIG_IP6_NF_TARGET_HL is not set CONFIG_IP6_NF_FILTER=m CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_REJECT_SKERR is not set CONFIG_IP6_NF_MANGLE=m # CONFIG_IP6_NF_RAW is not set CONFIG_NF_NAT_IPV6=m @@ -837,7 +848,47 @@ CONFIG_LLC=m # CONFIG_LAPB is not set # CONFIG_PHONET is not set # CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_SFB is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_DSMARK is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_MQPRIO is not set +# CONFIG_NET_SCH_CHOKE is not set +# CONFIG_NET_SCH_QFQ is not set +# CONFIG_NET_SCH_CODEL is not set +CONFIG_NET_SCH_FQ_CODEL=y +# CONFIG_NET_SCH_PLUG is not set + +# +# Classification +# +# CONFIG_NET_CLS_BASIC is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_FW is not set +# CONFIG_NET_CLS_U32 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_CGROUP is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_CLS_ACT is not set +CONFIG_NET_SCH_FIFO=y # CONFIG_DCB is not set CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set @@ -884,6 +935,7 @@ CONFIG_BT_MRVL=m CONFIG_BT_MRVL_SDIO=m CONFIG_BT_ATH3K=m # CONFIG_AF_RXRPC is not set +CONFIG_FIB_RULES=y CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y @@ -899,7 +951,6 @@ CONFIG_CFG80211_DEFAULT_PS=y CONFIG_CFG80211_INTERNAL_REGDB=y CONFIG_CFG80211_WEXT=y # CONFIG_LIB80211 is not set -# CONFIG_CFG80211_ALLOW_RECONNECT is not set CONFIG_MAC80211=m CONFIG_MAC80211_HAS_RC=y # CONFIG_MAC80211_RC_PID is not set @@ -1107,7 +1158,7 @@ CONFIG_AM_WIFI_USB=y # CONFIG_RTL8188EU_MP is not set CONFIG_SDIO_DHD_CDC_WIFI_40181_MODULE=m CONFIG_BCMDHD_FW_PATH="/lib/firmware/brcm/" -CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/brcm/ap6210-nvram.txt" +CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/brcm/nvram_ap6210.txt" CONFIG_BCMDHD_CONFIG_PATH="/etc/wifi/config.txt" CONFIG_BCMDHD_POWER_OFF_IN_SUSPEND=y CONFIG_BCMDHD_OOB=y @@ -1302,7 +1353,7 @@ CONFIG_DEINTERLACE=y # CONFIG_AM_IOBUS is not set # -# WetekPlay driver +# WeTek Play driver # CONFIG_WETEK=y @@ -1473,7 +1524,7 @@ CONFIG_OF=y # # Device Tree and Open Firmware support # -# CONFIG_PROC_DEVICETREE is not set +CONFIG_PROC_DEVICETREE=y # CONFIG_OF_SELFTEST is not set CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y @@ -1605,6 +1656,7 @@ CONFIG_MII=y # CONFIG_MACVLAN is not set # CONFIG_VXLAN is not set CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y CONFIG_NETPOLL=y # CONFIG_NETPOLL_TRAP is not set CONFIG_NET_POLL_CONTROLLER=y @@ -2752,7 +2804,7 @@ CONFIG_FB_DEFERRED_IO=y # # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m +# CONFIG_FB_UDL is not set # CONFIG_FB_GOLDFISH is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_METRONOME is not set @@ -3356,7 +3408,7 @@ CONFIG_OF_IOMMU=y CONFIG_IRQCHIP=y CONFIG_ARM_GIC=y # CONFIG_IPACK_BUS is not set -# CONFIG_RESET_CONTROLLER is not set +CONFIG_RESET_CONTROLLER=y # # File systems @@ -3388,6 +3440,7 @@ CONFIG_XFS_FS=m # CONFIG_XFS_WARN is not set # CONFIG_XFS_DEBUG is not set # CONFIG_GFS2_FS is not set +# CONFIG_OCFS2_FS is not set CONFIG_BTRFS_FS=m # CONFIG_BTRFS_FS_POSIX_ACL is not set # CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set @@ -3411,7 +3464,12 @@ CONFIG_GENERIC_ACL=y # # Caches # -# CONFIG_FSCACHE is not set +CONFIG_FSCACHE=y +# CONFIG_FSCACHE_STATS is not set +# CONFIG_FSCACHE_HISTOGRAM is not set +# CONFIG_FSCACHE_DEBUG is not set +# CONFIG_FSCACHE_OBJECT_LIST is not set +# CONFIG_CACHEFILES is not set # # CD-ROM/DVD Filesystems @@ -3444,7 +3502,7 @@ CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y # CONFIG_HUGETLB_PAGE is not set -# CONFIG_CONFIGFS_FS is not set +CONFIG_CONFIGFS_FS=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set @@ -3493,6 +3551,7 @@ CONFIG_NFS_V4_1=y CONFIG_PNFS_FILE_LAYOUT=m CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" CONFIG_ROOT_NFS=y +CONFIG_NFS_FSCACHE=y # CONFIG_NFS_USE_LEGACY_DNS is not set CONFIG_NFS_USE_KERNEL_DNS=y # CONFIG_NFSD is not set @@ -3514,7 +3573,8 @@ CONFIG_CIFS_STATS2=y # CONFIG_CIFS_XATTR is not set # CONFIG_CIFS_DEBUG is not set # CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_FSCACHE=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set @@ -3569,6 +3629,7 @@ CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_MAC_ROMANIAN is not set # CONFIG_NLS_MAC_TURKISH is not set CONFIG_NLS_UTF8=y +# CONFIG_DLM is not set # # Kernel hacking @@ -3663,7 +3724,7 @@ CONFIG_BRANCH_PROFILE_NONE=y # CONFIG_PROBE_EVENTS is not set # CONFIG_RBTREE_TEST is not set # CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_DYNAMIC_DEBUG is not set +CONFIG_DYNAMIC_DEBUG=y # CONFIG_DMA_API_DEBUG is not set # CONFIG_ATOMIC64_SELFTEST is not set # CONFIG_SAMPLES is not set @@ -3807,6 +3868,7 @@ CONFIG_CRYPTO_HW=y # CONFIG_RAID6_PQ=m CONFIG_BITREVERSE=y +CONFIG_RATIONAL=y CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_PCI_IOMAP=y diff --git a/projects/WeTek_Play/options b/projects/WeTek_Play/options index 63f11e4269..680f41382f 100644 --- a/projects/WeTek_Play/options +++ b/projects/WeTek_Play/options @@ -32,6 +32,10 @@ # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16 # neon-vfpv4. TARGET_FPU="neon-fp16" + TARGET_FEATURES="32bit" + + # Use linaro toolchain to build kernel + KERNEL_LINARO_TOOLCHAIN="arm-linux-gnueabihf" ;; esac @@ -39,7 +43,7 @@ BOOTLOADER="u-boot" # u-boot version to use (default) - UBOOT_VERSION="" + UBOOT_VERSION="vendor" # Configuration for u-boot UBOOT_CONFIG="" @@ -56,6 +60,9 @@ # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" + # additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="" + # Kernel to use. values can be: # default: default mainline kernel LINUX="amlogic-3.10" @@ -93,7 +100,7 @@ # Displayserver to use (x11 / no) DISPLAYSERVER="no" - # Windowmanager to use (ratpoison / fluxbox / none) + # Windowmanager to use (fluxbox / none) WINDOWMANAGER="none" # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) @@ -116,7 +123,7 @@ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-aml" + FIRMWARE="misc-firmware wlan-firmware wlan-firmware-aml dvb-firmware brcmfmac_sdio-firmware-aml" # build and install ATV IR remote support (yes / no) ATVCLIENT_SUPPORT="no" @@ -124,21 +131,8 @@ # Amlogic IR remote support (yes / no) AMREMOTE_SUPPORT="yes" - # build with swap support (yes / no) - SWAP_SUPPORT="no" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - # build with installer (yes / no) INSTALLER_SUPPORT="no" - # extra build dependeices - EXTRA_DEPS="mkimage" - EXTRA_DEPS_PKG="u-boot-tools" - # kernel image name KERNEL_NAME="kernel.img" diff --git a/projects/WeTek_Play/patches/kodi/0001-aml-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch b/projects/WeTek_Play/patches/kodi/0001-aml-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch deleted file mode 100644 index 0293fc38ae..0000000000 --- a/projects/WeTek_Play/patches/kodi/0001-aml-Fix-ALSA-sound-output-for-Amlogic-based-devices.patch +++ /dev/null @@ -1,55 +0,0 @@ -From d692d81a72f47fa8fcc57063b0e54336399af811 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Wed, 16 Apr 2014 22:02:01 +0300 -Subject: [PATCH 01/10] [aml] Fix ALSA sound output for Amlogic-based devices. - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 6a9066b..75f2cf0 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -88,6 +88,17 @@ static unsigned int ALSASampleRateList[] = - 0 - }; - -+static int CheckNP2(unsigned x) -+{ -+ --x; -+ x |= x >> 1; -+ x |= x >> 2; -+ x |= x >> 4; -+ x |= x >> 8; -+ x |= x >> 16; -+ return ++x; -+} -+ - CAESinkALSA::CAESinkALSA() : - m_bufferSize(0), - m_formatSampleRateMul(0.0), -@@ -752,12 +763,20 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig - */ - periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 20); - bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) sampleRate / 5); -+#if defined(HAS_LIBAMCODEC) -+ // must be pot for pivos. -+ bufferSize = CheckNP2(bufferSize); -+#endif - - /* - According to upstream we should set buffer size first - so make sure it is always at least - 4x period size to not get underruns (some systems seem to have issues with only 2 periods) - */ - periodSize = std::min(periodSize, bufferSize / 4); -+#if defined(HAS_LIBAMCODEC) -+ // must be pot for pivos. -+ periodSize = CheckNP2(periodSize); -+#endif - - CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, bufferSize %lu", periodSize, bufferSize); - --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0002-aml-Reorder-libraries-in-configure-script-to-prevent.patch b/projects/WeTek_Play/patches/kodi/0002-aml-Reorder-libraries-in-configure-script-to-prevent.patch deleted file mode 100644 index 7961307046..0000000000 --- a/projects/WeTek_Play/patches/kodi/0002-aml-Reorder-libraries-in-configure-script-to-prevent.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a1f4a5a74bb8e9fd48ec3d45bc908861dddb0296 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Mon, 8 Sep 2014 23:29:40 +0300 -Subject: [PATCH 02/10] [aml] Reorder libraries in configure script to prevent - linker errors when linking with libsmbclient - -Place libsmbclient before all other libraries to prevent linker errors when linking -with libsmbclient if the libc that is currently used doesn't contain some functions -such as dn_expand (which are often included in libc), but are actually included in -libresolv. ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 5b8c04b..7869041 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1305,7 +1305,7 @@ fi - # samba - if test "x$use_samba" != "xno"; then - PKG_CHECK_MODULES([SAMBA], [smbclient], -- [INCLUDES="$INCLUDES $SAMBA_CFLAGS"; LIBS="$LIBS $SAMBA_LIBS"], -+ [INCLUDES="$INCLUDES $SAMBA_CFLAGS"; LIBS="$SAMBA_LIBS $LIBS"], - [AC_CHECK_LIB([smbclient], [main],, - use_samba=no;AC_MSG_ERROR($missing_library)) - USE_LIBSMBCLIENT=0 --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0003-aml-Change-the-sample-rates-that-are-supported-by-AL.patch b/projects/WeTek_Play/patches/kodi/0003-aml-Change-the-sample-rates-that-are-supported-by-AL.patch deleted file mode 100644 index 74a111a4ac..0000000000 --- a/projects/WeTek_Play/patches/kodi/0003-aml-Change-the-sample-rates-that-are-supported-by-AL.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 044271ec20fb82025c59fed81baddf766e28c28d Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Fri, 19 Sep 2014 01:55:12 +0300 -Subject: [PATCH 03/10] [aml] Change the sample rates that are supported by - ALSA but unsupported by HDMI to the closest supported - value - ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 75f2cf0..08777aa 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -677,6 +677,26 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig - snd_pcm_hw_params_set_access(m_pcm, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); - - unsigned int sampleRate = inconfig.sampleRate; -+#ifdef HAS_LIBAMCODEC -+ // Change the sample rates that are supported by ALSA but unsupported by HDMI to the closest supported value -+ switch (sampleRate) -+ { -+ case 5512: -+ case 8000: -+ case 11025: -+ case 16000: -+ case 22050: -+ sampleRate = 44100; -+ break; -+ case 64000: -+ sampleRate = 88200; -+ break; -+ case 384000: -+ sampleRate = 192000; -+ break; -+ } -+#endif -+ - snd_pcm_hw_params_set_rate_near (m_pcm, hw_params, &sampleRate, NULL); - - unsigned int channelCount = inconfig.channels; --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0004-aml-Fill-audio-packets-completely-when-resampling-to.patch b/projects/WeTek_Play/patches/kodi/0004-aml-Fill-audio-packets-completely-when-resampling-to.patch deleted file mode 100644 index f684b960a4..0000000000 --- a/projects/WeTek_Play/patches/kodi/0004-aml-Fill-audio-packets-completely-when-resampling-to.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a9be548866b1f01e5f467a6f92b731fa07f9ba9e Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Sat, 20 Sep 2014 04:43:52 +0300 -Subject: [PATCH 04/10] [aml] Fill audio packets completely when resampling to - prevent 'audio data unaligned' kernel warnings - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -index 3ca667c..304cff8 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp -@@ -162,7 +162,11 @@ CActiveAEBufferPoolResample::CActiveAEBufferPoolResample(AEAudioFormat inputForm - m_inputFormat.m_channelLayout += AE_CH_FC; - } - m_resampler = NULL; -+#ifdef HAS_LIBAMCODEC -+ m_fillPackets = true; -+#else - m_fillPackets = false; -+#endif - m_drain = false; - m_empty = true; - m_procSample = NULL; --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0005-Save-settings-only-if-they-were-modified-after-the-l.patch b/projects/WeTek_Play/patches/kodi/0005-Save-settings-only-if-they-were-modified-after-the-l.patch deleted file mode 100644 index a9372ebf55..0000000000 --- a/projects/WeTek_Play/patches/kodi/0005-Save-settings-only-if-they-were-modified-after-the-l.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 9936eb795dc53b7681540c57263d175907ae45ac Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Sun, 19 Oct 2014 16:20:33 +0300 -Subject: [PATCH 05/10] Save settings only if they were modified after the - last save - -This prevents from multiple saving the same settings and helps to resolve -the issue on Amlogic G18REF TV-boxes when setiings may be lost after a poweroff. - -On G18REF When you press the red button on the remote the system receives a signal that power -is about to off. XBMC always writes guisettings.xml before exit, and the same settings -may be written several times from different places in code. But the power gets turned off -before the system completes all shutdown procedures. There may be the case that guisettings.xml -is written half-way and couldn't be read upon next boot, so the XBMC creates a new one with -default settings. - -With this fix the settings will be written at exit only once, minimizing the risk of being lost. - -note by seo: - added utils/md5.h after kodi includes cleanup. - however, this patch should not be needed at all. TODO remove ---- - xbmc/settings/Settings.cpp | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index a8114aa..e629e97 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -75,6 +75,7 @@ - #include "threads/SingleLock.h" - #include "utils/CharsetConverter.h" - #include "utils/log.h" -+#include "utils/md5.h" - #include "utils/RssManager.h" - #include "utils/StringUtils.h" - #include "utils/SystemInfo.h" -@@ -537,6 +538,17 @@ bool CSettings::Save(const std::string &file) - if (!m_settingsManager->Save(root)) - return false; - -+ // Avoid saving if the settings saved earlier are indetical to the current ones -+ if (CFile::Exists(file)) -+ { -+ std::string fileMD5 = CUtil::GetFileMD5(file); -+ TiXmlPrinter xmlPrinter; -+ xmlDoc.Accept(&xmlPrinter); -+ std::string settingsMD5 = XBMC::XBMC_MD5::GetMD5(xmlPrinter.CStr()); -+ if (fileMD5 == settingsMD5) -+ return true; -+ } -+ - return xmlDoc.SaveFile(file); - } - --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0006-aml-Disable-deinterlacing-for-HD-content-while-video.patch b/projects/WeTek_Play/patches/kodi/0006-aml-Disable-deinterlacing-for-HD-content-while-video.patch deleted file mode 100644 index caee12516e..0000000000 --- a/projects/WeTek_Play/patches/kodi/0006-aml-Disable-deinterlacing-for-HD-content-while-video.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 50833b2af0c7c9aab3593ec8abf8e237851fff61 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Tue, 3 Feb 2015 17:58:19 +0100 -Subject: [PATCH 06/10] [aml] Disable deinterlacing for HD content while video - is being played in a window - -... to prevent screen blinking in 1080p50/60hz display modes ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -index aa30474..1fb5e3e 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp -@@ -2289,6 +2289,11 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) - CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_stereo_view(%d)", m_stereo_view); - #endif - -+ if (dst_rect.Width() < display.Width() || dst_rect.Height() < display.Height()) -+ SysfsUtils::SetInt("/sys/module/di/parameters/bypass_hd", 1); -+ else -+ SysfsUtils::SetInt("/sys/module/di/parameters/bypass_hd", 0); -+ - // goofy 0/1 based difference in aml axis coordinates. - // fix them. - dst_rect.x2--; --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0007-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch b/projects/WeTek_Play/patches/kodi/0007-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch deleted file mode 100644 index 590ac2144e..0000000000 --- a/projects/WeTek_Play/patches/kodi/0007-aml-Ugly-workaround-to-show-DTS-AC3-caps.patch +++ /dev/null @@ -1,30 +0,0 @@ -From bd6b4809c2fac4ef7393e96c3c8b72a7faea2f85 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Tue, 30 Jun 2015 11:19:57 +0200 -Subject: [PATCH 07/10] [aml] Ugly workaround to show DTS/AC3 caps - -... but don't run into multi channel issues as we can only open 2 pcm channels ---- - xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 08777aa..c3f5fce 100644 ---- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -@@ -1340,6 +1340,12 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force) - - AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name) - { -+#ifdef HAS_LIBAMCODEC -+ // ugly workaround to show DTS / AC3 caps -+ // but don't run into multi channel issues -+ // as we can only open 2 pcm channels -+ return AE_DEVTYPE_IEC958; -+#endif - if (name.substr(0, 4) == "hdmi") - return AE_DEVTYPE_HDMI; - else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif") --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0008-Add-mapping-for-Browser-Home-key-on-Linux.patch b/projects/WeTek_Play/patches/kodi/0008-Add-mapping-for-Browser-Home-key-on-Linux.patch deleted file mode 100644 index b36cf9246a..0000000000 --- a/projects/WeTek_Play/patches/kodi/0008-Add-mapping-for-Browser-Home-key-on-Linux.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 56dac3c356e8419205eae251e76982be9a0da688 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Tue, 14 Jul 2015 15:55:20 +0300 -Subject: [PATCH 08/10] Add mapping for Browser Home key on Linux - ---- - xbmc/input/linux/LinuxInputDevices.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp -index 3875138..3643a96 100644 ---- a/xbmc/input/linux/LinuxInputDevices.cpp -+++ b/xbmc/input/linux/LinuxInputDevices.cpp -@@ -247,6 +247,7 @@ KeyMap keyMap[] = { - { KEY_RECORD , XBMCK_RECORD }, - { KEY_REWIND , XBMCK_REWIND }, - { KEY_PHONE , XBMCK_PHONE }, -+ { KEY_HOMEPAGE , XBMCK_BROWSER_HOME}, - { KEY_REFRESH , XBMCK_SHUFFLE }, - { KEY_SCROLLUP , XBMCK_PAGEUP }, - { KEY_SCROLLDOWN , XBMCK_PAGEDOWN }, --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/0009-powermanagement-Perform-suspend-instead-of-powerdown.patch b/projects/WeTek_Play/patches/kodi/0009-powermanagement-Perform-suspend-instead-of-powerdown.patch deleted file mode 100644 index c69c201ffa..0000000000 --- a/projects/WeTek_Play/patches/kodi/0009-powermanagement-Perform-suspend-instead-of-powerdown.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 72497ca4d29af8ac224b826a3993bfdb76a7f9f6 Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Tue, 14 Jul 2015 16:02:35 +0300 -Subject: [PATCH 09/10] [powermanagement] Perform suspend instead of powerdown - ---- - system/keymaps/keyboard.xml | 2 +- - xbmc/powermanagement/linux/LogindUPowerSyscall.cpp | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/system/keymaps/keyboard.xml b/system/keymaps/keyboard.xml -index 90517af..62cc847 100644 ---- a/system/keymaps/keyboard.xml -+++ b/system/keymaps/keyboard.xml -@@ -94,7 +94,7 @@ - ToggleFullScreen - FirstPage - LastPage -- ActivateWindow(ShutdownMenu) -+ XBMC.Powerdown() - ActivateWindow(ShutdownMenu) - - ActivateWindow(TVGuide) -diff --git a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -index 4e5bcc6..ad5847d 100644 ---- a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -@@ -53,7 +53,7 @@ CLogindUPowerSyscall::CLogindUPowerSyscall() - m_canPowerdown = LogindCheckCapability("CanPowerOff"); - m_canReboot = LogindCheckCapability("CanReboot"); - m_canHibernate = LogindCheckCapability("CanHibernate"); -- m_canSuspend = LogindCheckCapability("CanSuspend"); -+ m_canSuspend = false; - - InhibitDelayLock(); - -@@ -98,7 +98,7 @@ CLogindUPowerSyscall::~CLogindUPowerSyscall() - - bool CLogindUPowerSyscall::Powerdown() - { -- return LogindSetPowerState("PowerOff"); -+ return Suspend(); - } - - bool CLogindUPowerSyscall::Reboot() --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/kodi/kodi-100.26-hack-fix-audio.patch b/projects/WeTek_Play/patches/kodi/kodi-100.26-hack-fix-audio.patch new file mode 100644 index 0000000000..828d1ddd17 --- /dev/null +++ b/projects/WeTek_Play/patches/kodi/kodi-100.26-hack-fix-audio.patch @@ -0,0 +1,13 @@ +fixes broken audio at WP1 and WC +Fill audio packets completely when resampling to prevent 'audio data unaligned' kernel warnings + +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.cpp +@@ -143,6 +143,7 @@ + m_inputFormat.m_channelLayout.Reset(); + m_inputFormat.m_channelLayout += AE_CH_FC; + } ++ m_fillPackets = true; + m_resampleQuality = quality; + } + diff --git a/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch b/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch index 95c817d705..aa55668a60 100644 --- a/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch +++ b/projects/WeTek_Play/patches/libcec/libcec-00-amlogic-support.patch @@ -1,21 +1,21 @@ -From dabfc33004b94d2f06d20ad4f8a889dd5a94e796 Mon Sep 17 00:00:00 2001 +From bd56646f065c5952266adc28ed569be29159d818 Mon Sep 17 00:00:00 2001 From: Gerald Dachs Date: Tue, 6 Dec 2016 11:06:49 +0100 Subject: [PATCH] Amlogic CEC adapter --- - include/cectypes.h | 15 +- + include/cectypes.h | 13 +- src/libcec/CMakeLists.txt | 3 + - src/libcec/adapter/AdapterFactory.cpp | 24 +- + src/libcec/adapter/AdapterFactory.cpp | 22 ++ src/libcec/adapter/Amlogic/AmlogicCEC.h | 41 +++ .../Amlogic/AmlogicCECAdapterCommunication.cpp | 306 +++++++++++++++++++++ - .../Amlogic/AmlogicCECAdapterCommunication.h | 105 +++++++ + .../Amlogic/AmlogicCECAdapterCommunication.h | 106 +++++++ .../adapter/Amlogic/AmlogicCECAdapterDetection.cpp | 50 ++++ .../adapter/Amlogic/AmlogicCECAdapterDetection.h | 46 ++++ src/libcec/cmake/CheckPlatformSupport.cmake | 13 + src/libcec/cmake/DisplayPlatformSupport.cmake | 6 + src/libcec/env.h.in | 3 + - 11 files changed, 610 insertions(+), 2 deletions(-) + 11 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 src/libcec/adapter/Amlogic/AmlogicCEC.h create mode 100644 src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp create mode 100644 src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h @@ -23,10 +23,10 @@ Subject: [PATCH] Amlogic CEC adapter create mode 100644 src/libcec/adapter/Amlogic/AmlogicCECAdapterDetection.h diff --git a/include/cectypes.h b/include/cectypes.h -index 9c91842..1bc7b52 100644 +index 9c91842..3af93ca 100644 --- a/include/cectypes.h +++ b/include/cectypes.h -@@ -276,6 +276,18 @@ namespace CEC { +@@ -276,6 +276,16 @@ namespace CEC { */ #define CEC_EXYNOS_VIRTUAL_COM "Exynos" @@ -39,13 +39,11 @@ index 9c91842..1bc7b52 100644 + * the name of the virtual COM port to use for the AMLOGIC' CEC wire + */ +#define CEC_AMLOGIC_VIRTUAL_COM "Amlogic" -+ -+/*! + /** * Maximum size of a data packet */ -@@ -861,7 +873,8 @@ typedef enum cec_adapter_type +@@ -861,7 +871,8 @@ typedef enum cec_adapter_type ADAPTERTYPE_RPI = 0x100, ADAPTERTYPE_TDA995x = 0x200, ADAPTERTYPE_EXYNOS = 0x300, @@ -56,21 +54,21 @@ index 9c91842..1bc7b52 100644 /** force exporting through swig */ diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt -index d3eefa3..125512b 100644 +index 6baee69..a537825 100644 --- a/src/libcec/CMakeLists.txt +++ b/src/libcec/CMakeLists.txt -@@ -87,6 +87,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h +@@ -89,6 +89,9 @@ set(CEC_HEADERS devices/CECRecordingDevice.h adapter/Exynos/ExynosCEC.h adapter/Exynos/ExynosCECAdapterDetection.h adapter/Exynos/ExynosCECAdapterCommunication.h -+ adapter/Amlogic/AmlogicCEC.h ++ adapter/Amlogic/AmlogicCEC.h + adapter/Amlogic/AmlogicCECAdapterDetection.h + adapter/Amlogic/AmlogicCECAdapterCommunication.h adapter/AOCEC/AOCEC.h adapter/AOCEC/AOCECAdapterDetection.h adapter/AOCEC/AOCECAdapterCommunication.h diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp -index 1e946e6..a539394 100644 +index 91195ea..3344516 100644 --- a/src/libcec/adapter/AdapterFactory.cpp +++ b/src/libcec/adapter/AdapterFactory.cpp @@ -58,6 +58,11 @@ @@ -477,10 +475,10 @@ index 0000000..88d19db +#endif // HAVE_AMLOGIC_API diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h new file mode 100644 -index 0000000..0e99cf8 +index 0000000..a8e6fce --- /dev/null +++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h -@@ -0,0 +1,105 @@ +@@ -0,0 +1,106 @@ +#pragma once +/* + * This file is part of the libCEC(R) library. @@ -555,6 +553,7 @@ index 0000000..0e99cf8 + uint32_t GetFirmwareBuildDate(void) { return 0; } + bool IsRunningLatestFirmware(void) { return true; } + bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) { return false; } ++ bool SetAutoMode(bool UNUSED(automode)) override { return false; } + bool GetConfiguration(libcec_configuration & UNUSED(configuration)) { return false; } + std::string GetPortName(void) { return std::string("AMLOGIC"); } + uint16_t GetPhysicalAddress(void); @@ -695,18 +694,18 @@ index 0000000..8a7418d + }; +} diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake -index 532f213..382c39c 100644 +index b7773ee..58ba8f1 100644 --- a/src/libcec/cmake/CheckPlatformSupport.cmake +++ b/src/libcec/cmake/CheckPlatformSupport.cmake @@ -11,6 +11,7 @@ # HAVE_EXYNOS_API ON if Exynos is supported # HAVE_AOCEC_API ON if AOCEC is supported # HAVE_P8_USB ON if Pulse-Eight devices are supported -+# HAVE_AMLOGIC_API 1 if AMLOGIC is supported ++# HAVE_AMLOGIC_API ON if AMLOGIC is supported # HAVE_P8_USB_DETECT ON if Pulse-Eight devices can be auto-detected # HAVE_DRM_EDID_PARSER ON if DRM EDID parsing is supported # -@@ -137,6 +138,18 @@ else() +@@ -139,6 +140,18 @@ else() list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_EXYNOS}) endif() @@ -726,7 +725,7 @@ index 532f213..382c39c 100644 if (${HAVE_AOCEC_API}) set(LIB_INFO "${LIB_INFO}, AOCEC") diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake -index 7ec10f5..7a38d32 100644 +index 83a778a..c7088f3 100644 --- a/src/libcec/cmake/DisplayPlatformSupport.cmake +++ b/src/libcec/cmake/DisplayPlatformSupport.cmake @@ -56,5 +56,11 @@ else() @@ -742,10 +741,10 @@ index 7ec10f5..7a38d32 100644 message(STATUS "lib info: ${LIB_INFO}") diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in -index fe6c83d..09304e1 100644 +index 456a2e7..a40f931 100644 --- a/src/libcec/env.h.in +++ b/src/libcec/env.h.in -@@ -78,6 +78,9 @@ +@@ -82,6 +82,9 @@ /* Define to 1 for nVidia EDID parsing support (on selected models) */ #cmakedefine HAVE_NVIDIA_EDID_PARSER @HAVE_NVIDIA_EDID_PARSER@ @@ -755,3 +754,6 @@ index fe6c83d..09304e1 100644 /* Define to 1 for DRM EDID parsing support */ #cmakedefine HAVE_DRM_EDID_PARSER @HAVE_DRM_EDID_PARSER@ +-- +2.14.1 + diff --git a/projects/WeTek_Play/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch b/projects/WeTek_Play/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch new file mode 100644 index 0000000000..8457c54288 --- /dev/null +++ b/projects/WeTek_Play/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch @@ -0,0 +1,49 @@ +From 2b29cb0830548d4957f1d5ca86640831d224670e Mon Sep 17 00:00:00 2001 +From: Sam Nazarko +Date: Sun, 9 Apr 2017 17:34:36 +0100 +Subject: [PATCH] Make p8platform mutex mutable without changing libplatform + +Signed-off-by: Sam Nazarko +--- + src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp | 2 +- + src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +index 60813ed..798454e 100644 +--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp +@@ -193,7 +193,7 @@ uint16_t CAmlogicCECAdapterCommunication::GetPhysicalAddress(void) + } + + +-cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) ++cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) const + { + CLockObject lock(m_mutex); + return m_logicalAddresses; +diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +index 0e99cf8..635bb81 100644 +--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h ++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h +@@ -66,7 +66,7 @@ namespace CEC + bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; } + bool StartBootloader(void) { return false; } + bool SetLogicalAddresses(const cec_logical_addresses &addresses); +- cec_logical_addresses GetLogicalAddresses(void); ++ cec_logical_addresses GetLogicalAddresses(void) const; + bool PingAdapter(void) { return IsInitialised(); } + uint16_t GetFirmwareVersion(void); + uint32_t GetFirmwareBuildDate(void) { return 0; } +@@ -98,7 +98,7 @@ namespace CEC + + bool m_bLogicalAddressChanged; + cec_logical_addresses m_logicalAddresses; +- P8PLATFORM::CMutex m_mutex; ++ mutable P8PLATFORM::CMutex m_mutex; + int m_fd; + }; + }; +-- +2.7.4 + diff --git a/projects/WeTek_Play/patches/linux/010-wetek_dvb_code.patch b/projects/WeTek_Play/patches/linux/010-wetek_dvb_code.patch index acc984c361..8b4272469c 100644 --- a/projects/WeTek_Play/patches/linux/010-wetek_dvb_code.patch +++ b/projects/WeTek_Play/patches/linux/010-wetek_dvb_code.patch @@ -1,7 +1,8 @@ -diff -Naur a/drivers/amlogic/Kconfig b/drivers/amlogic/Kconfig ---- a/drivers/amlogic/Kconfig 2015-01-04 18:07:57.000000000 +0100 -+++ b/drivers/amlogic/Kconfig 2015-01-01 15:31:17.000000000 +0100 -@@ -76,7 +76,7 @@ +diff --git a/drivers/amlogic/Kconfig b/drivers/amlogic/Kconfig +index 68e8469..36e4c1d 100755 +--- a/drivers/amlogic/Kconfig ++++ b/drivers/amlogic/Kconfig +@@ -77,7 +77,7 @@ source "drivers/amlogic/mipi/Kconfig" source "drivers/amlogic/d2d3/Kconfig" source "drivers/amlogic/amvecm/Kconfig" source "drivers/amlogic/dvb_tv/Kconfig" @@ -10,10 +11,11 @@ diff -Naur a/drivers/amlogic/Kconfig b/drivers/amlogic/Kconfig # # GPU # -diff -Naur a/drivers/amlogic/Makefile b/drivers/amlogic/Makefile ---- a/drivers/amlogic/Makefile 2015-01-04 18:07:57.000000000 +0100 -+++ b/drivers/amlogic/Makefile 2015-01-01 15:30:50.000000000 +0100 -@@ -84,6 +84,7 @@ +diff --git a/drivers/amlogic/Makefile b/drivers/amlogic/Makefile +index c65a3e5..de6924f 100755 +--- a/drivers/amlogic/Makefile ++++ b/drivers/amlogic/Makefile +@@ -84,6 +84,7 @@ obj-$(CONFIG_AMAUDIO2) += amaudio2/ obj-y += mhl/ obj-y += hdmi/ @@ -21,10 +23,667 @@ diff -Naur a/drivers/amlogic/Makefile b/drivers/amlogic/Makefile obj-$(CONFIG_AM_DVB) += dvb_tv/ obj-$(CONFIG_AM_SMARTCARD) += smartcard/ -diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c ---- a/drivers/amlogic/wetek/avl6211.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/avl6211.c 2015-02-18 21:13:05.000000000 +0100 -@@ -0,0 +1,1979 @@ +diff --git a/drivers/amlogic/wetek/Kconfig b/drivers/amlogic/wetek/Kconfig +new file mode 100644 +index 0000000..8598b6d +--- /dev/null ++++ b/drivers/amlogic/wetek/Kconfig +@@ -0,0 +1,13 @@ ++# ++# Wetek Play driver configuration ++# ++ ++menu "WeTek Play driver" ++ ++config WETEK ++ tristate "Wetek Play driver" ++ default n ++ select DVB_CORE ++ help ++ Select to enable Wetek Play driver. ++endmenu +diff --git a/drivers/amlogic/wetek/Makefile b/drivers/amlogic/wetek/Makefile +new file mode 100644 +index 0000000..f6c59c0 +--- /dev/null ++++ b/drivers/amlogic/wetek/Makefile +@@ -0,0 +1,9 @@ ++# ++# Makefile for the Wetek Play driver. ++# ++ ++obj-$(CONFIG_WETEK) += wetekplay.o ++ ++wetekplay-objs = nimdetect.o mxl603.o avl6211.o mn88436.o cxd2837.o cxd2841er_wetek.o ascot3.o ++ ++EXTRA_CFLAGS += -Idrivers/media/dvb-core -Idrivers/media/tuners +diff --git a/drivers/amlogic/wetek/ascot3.c b/drivers/amlogic/wetek/ascot3.c +new file mode 100644 +index 0000000..0b424e8 +--- /dev/null ++++ b/drivers/amlogic/wetek/ascot3.c +@@ -0,0 +1,563 @@ ++/* ++ * ascot3.c ++ * ++ * Sony Ascot3 DVB-T/T2/C tuner driver ++ * ++ * Copyright (C) 2015 Sasa Savic ++ * ++ * Based on ascot2e driver ++ * ++ * Copyright 2012 Sony Corporation ++ * Copyright (C) 2014 NetUP Inc. ++ * Copyright (C) 2014 Sergey Kozlov ++ * Copyright (C) 2014 Abylay Ospan ++ * ++ * 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. ++ * ++ * This program 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include "ascot3.h" ++#include "dvb_frontend.h" ++ ++#define MAX_WRITE_REGSIZE 32 ++ ++enum ascot3_state { ++ STATE_UNKNOWN, ++ STATE_SLEEP, ++ STATE_ACTIVE ++}; ++ ++struct ascot3_priv { ++ u32 frequency; ++ u8 i2c_address; ++ struct i2c_adapter *i2c; ++ enum ascot3_state state; ++}; ++ ++enum ascot3_tv_system_t { ++ ASCOT3_DTV_DVBT_5, ++ ASCOT3_DTV_DVBT_6, ++ ASCOT3_DTV_DVBT_7, ++ ASCOT3_DTV_DVBT_8, ++ ASCOT3_DTV_DVBT2_1_7, ++ ASCOT3_DTV_DVBT2_5, ++ ASCOT3_DTV_DVBT2_6, ++ ASCOT3_DTV_DVBT2_7, ++ ASCOT3_DTV_DVBT2_8, ++ ASCOT3_DTV_DVBC_6, ++ ASCOT3_DTV_DVBC_8, ++ ASCOT3_DTV_DVBC2_6, ++ ASCOT3_DTV_DVBC2_8, ++ ASCOT3_DTV_UNKNOWN ++}; ++ ++struct ascot3_band_sett { ++ u8 outlmt; ++ u8 rf_gain; ++ u8 if_bpf_gc; ++ u8 rfovld_det_lv1_vl; ++ u8 rfovld_det_lv1_vh; ++ u8 rfovld_det_lv1_u; ++ u8 ifovld_det_lv_vl; ++ u8 ifovld_det_lv_vh; ++ u8 ifovld_det_lv_u; ++ u8 if_bpf_f0; ++ u8 bw; ++ u8 fif_offset; ++ u8 bw_offset; ++ u8 agc_sel; ++ u8 if_out_sel; ++ u8 is_lowerlocal; ++}; ++ ++#define ASCOT3_AUTO 0xff ++#define ASCOT3_OFFSET(ofs) ((u8)(ofs) & 0x1F) ++#define ASCOT3_BW_6 0x00 ++#define ASCOT3_BW_7 0x01 ++#define ASCOT3_BW_8 0x02 ++#define ASCOT3_BW_1_7 0x03 ++ ++static struct ascot3_band_sett ascot3_sett[] = { ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_7, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-5), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_8, ASCOT3_OFFSET(-4), ASCOT3_OFFSET(-6), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_1_7,ASCOT3_OFFSET(-10),ASCOT3_OFFSET(-10),ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_7, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-5), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_8, ASCOT3_OFFSET(-4), ASCOT3_OFFSET(-6), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x05, 0x09, 0x09, 0x09, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_6, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-4), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x05, 0x09, 0x09, 0x09, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_8, ASCOT3_OFFSET(-2), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x03, 0x0A, 0x0A, 0x0A, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_6, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-2), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, ++ { 0x00, ASCOT3_AUTO, 0x03, 0x0A, 0x0A, 0x0A, 0x02, 0x02, 0x02, 0x00, ++ ASCOT3_BW_8, ASCOT3_OFFSET(-2), ASCOT3_OFFSET(0), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 } ++}; ++ ++static int ascot3_write_regs(struct ascot3_priv *priv, ++ u8 reg, const u8 *data, u32 len) ++{ ++ int ret; ++ u8 buf[MAX_WRITE_REGSIZE + 1]; ++ struct i2c_msg msg[1] = { ++ { ++ .addr = priv->i2c_address, ++ .flags = 0, ++ .len = len + 1, ++ .buf = buf, ++ } ++ }; ++ ++ if (len + 1 >= sizeof(buf)) { ++ dev_warn(&priv->i2c->dev,"wr reg=%04x: len=%d is too big!\n", ++ reg, len + 1); ++ return -E2BIG; ++ } ++ ++ ++ buf[0] = reg; ++ memcpy(&buf[1], data, len); ++ ret = i2c_transfer(priv->i2c, msg, 1); ++ if (ret >= 0 && ret != 1) ++ ret = -EREMOTEIO; ++ if (ret < 0) { ++ dev_warn(&priv->i2c->dev, ++ "i2c wr failed=%d reg=%02x len=%d\n", ++ ret, reg, len); ++ return ret; ++ } ++ return 0; ++} ++ ++static int ascot3_write_reg(struct ascot3_priv *priv, u8 reg, u8 val) ++{ ++ return ascot3_write_regs(priv, reg, &val, 1); ++} ++ ++static int ascot3_read_regs(struct ascot3_priv *priv, ++ u8 reg, u8 *val, u32 len) ++{ ++ int ret; ++ struct i2c_msg msg[2] = { ++ { ++ .addr = priv->i2c_address, ++ .flags = 0, ++ .len = 1, ++ .buf = ®, ++ }, { ++ .addr = priv->i2c_address, ++ .flags = I2C_M_RD, ++ .len = len, ++ .buf = val, ++ } ++ }; ++ ++ ret = i2c_transfer(priv->i2c, &msg[0], 1); ++ if (ret >= 0 && ret != 1) ++ ret = -EREMOTEIO; ++ if (ret < 0) { ++ dev_warn(&priv->i2c->dev, ++ "I2C rw failed=%d addr=%02x reg=%02x\n", ++ ret, priv->i2c_address, reg); ++ return ret; ++ } ++ ret = i2c_transfer(priv->i2c, &msg[1], 1); ++ if (ret >= 0 && ret != 1) ++ ret = -EREMOTEIO; ++ if (ret < 0) { ++ dev_warn(&priv->i2c->dev, ++ "i2c rd failed=%d addr=%02x reg=%02x\n", ++ ret, priv->i2c_address, reg); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int ascot3_read_reg(struct ascot3_priv *priv, u8 reg, u8 *val) ++{ ++ return ascot3_read_regs(priv, reg, val, 1); ++} ++ ++static int ascot3_set_reg_bits(struct ascot3_priv *priv, ++ u8 reg, u8 data, u8 mask) ++{ ++ int res; ++ u8 rdata; ++ ++ if (mask != 0xff) { ++ res = ascot3_read_reg(priv, reg, &rdata); ++ if (res != 0) ++ return res; ++ data = ((data & mask) | (rdata & (mask ^ 0xFF))); ++ } ++ return ascot3_write_reg(priv, reg, data); ++} ++ ++static int ascot3_enter_power_save(struct ascot3_priv *priv) ++{ ++ u8 data[3]; ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ ++ if (priv->state == STATE_SLEEP) ++ return 0; ++ ++ /* Loop Through setting And RFIN matching in Power Save */ ++ ascot3_write_reg(priv, 0x67, 0x06); ++ /* Disable IF signal output (IF_OUT_SEL setting) */ ++ ascot3_set_reg_bits(priv, 0x74, 0x02, 0x03); ++ /* Power save setting for analog block */ ++ data[0] = 0x15; ++ data[1] = 0x00; ++ data[2] = 0x00; ++ ascot3_write_regs(priv, 0x5E, data, 3); ++ /* Standby setting for CPU */ ++ ascot3_write_reg(priv, 0x88, 0x00); ++ /* Standby setting for internal logic block */ ++ ascot3_write_reg(priv, 0x87, 0xC0); ++ priv->state = STATE_SLEEP; ++ return 0; ++} ++ ++static int ascot3_init(struct dvb_frontend *fe) ++{ ++ struct ascot3_priv *priv = fe->tuner_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ return 0; ++} ++ ++static int ascot3_release(struct dvb_frontend *fe) ++{ ++ struct ascot3_priv *priv = fe->tuner_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ kfree(fe->tuner_priv); ++ fe->tuner_priv = NULL; ++ return 0; ++} ++ ++static int ascot3_sleep(struct dvb_frontend *fe) ++{ ++ struct ascot3_priv *priv = fe->tuner_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 1); ++ ++ ascot3_enter_power_save(priv); ++ ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 0); ++ ++ return 0; ++} ++ ++static enum ascot3_tv_system_t ascot3_get_tv_system(struct dvb_frontend *fe) ++{ ++ enum ascot3_tv_system_t system = ASCOT3_DTV_UNKNOWN; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ struct ascot3_priv *priv = fe->tuner_priv; ++ ++ if (p->delivery_system == SYS_DVBT) { ++ if (p->bandwidth_hz <= 5000000) ++ system = ASCOT3_DTV_DVBT_5; ++ else if (p->bandwidth_hz <= 6000000) ++ system = ASCOT3_DTV_DVBT_6; ++ else if (p->bandwidth_hz <= 7000000) ++ system = ASCOT3_DTV_DVBT_7; ++ else if (p->bandwidth_hz <= 8000000) ++ system = ASCOT3_DTV_DVBT_8; ++ else { ++ system = ASCOT3_DTV_DVBT_8; ++ p->bandwidth_hz = 8000000; ++ } ++ } else if (p->delivery_system == SYS_DVBT2) { ++ if (p->bandwidth_hz <= 5000000) ++ system = ASCOT3_DTV_DVBT2_5; ++ else if (p->bandwidth_hz <= 6000000) ++ system = ASCOT3_DTV_DVBT2_6; ++ else if (p->bandwidth_hz <= 7000000) ++ system = ASCOT3_DTV_DVBT2_7; ++ else if (p->bandwidth_hz <= 8000000) ++ system = ASCOT3_DTV_DVBT2_8; ++ else { ++ system = ASCOT3_DTV_DVBT2_8; ++ p->bandwidth_hz = 8000000; ++ } ++ } else if (p->delivery_system == SYS_DVBC_ANNEX_A) { ++ if (p->bandwidth_hz <= 6000000) ++ system = ASCOT3_DTV_DVBC_6; ++ else if (p->bandwidth_hz <= 8000000) ++ system = ASCOT3_DTV_DVBC_8; ++ } ++ dev_dbg(&priv->i2c->dev, ++ "%s(): ASCOT2E DTV system %d (delsys %d, bandwidth %d)\n", ++ __func__, (int)system, p->delivery_system, p->bandwidth_hz); ++ return system; ++} ++ ++static int ascot3_set_params(struct dvb_frontend *fe) ++{ ++ u8 data[20]; ++ u32 frequency; ++ enum ascot3_tv_system_t tv_system; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ struct ascot3_priv *priv = fe->tuner_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s(): tune frequency %dkHz\n", ++ __func__, p->frequency / 1000); ++ tv_system = ascot3_get_tv_system(fe); ++ ++ if (tv_system == ASCOT3_DTV_UNKNOWN) { ++ dev_dbg(&priv->i2c->dev, "%s(): unknown DTV system\n", ++ __func__); ++ return -EINVAL; ++ } ++ ++ frequency = roundup(p->frequency / 1000, 25); ++ ++ /* Disable IF signal output (IF_OUT_SEL setting) */ ++ ascot3_set_reg_bits(priv, 0x74, 0x02, 0x03); ++ /* Clock enable for internal logic block, CPU wake-up */ ++ data[0] = 0xC4; ++ data[1] = 0x40; ++ ascot3_write_regs(priv, 0x87, data, 2); ++ ++ /* Initial setting for internal analog block */ ++ if (tv_system == ASCOT3_DTV_DVBC_6 || ++ tv_system == ASCOT3_DTV_DVBC_8) { ++ data[0] = 0x16; ++ data[1] = 0x26; ++ } else { ++ data[0] = 0x10; ++ data[1] = 0x20; ++ } ++ ascot3_write_regs(priv, 0x91, data, 2); ++ ++ /* Setting for analog block */ ++ data[0] = 0x00; ++ data[1] = (u8)(ascot3_sett[tv_system].is_lowerlocal & 0x01); ++ ascot3_write_regs(priv, 0x9C, data, 2); ++ ++ /* Enable for analog block */ ++ data[0] = 0xEE; ++ data[1] = 0x02; ++ data[2] = 0x1E; ++ /* Tuning setting for CPU */ ++ data[3] = 0x67; ++ /* Setting for PLL reference divider (REF_R) */ ++ data[4] = 0x02; ++ /* Tuning setting for analog block*/ ++ if (tv_system == ASCOT3_DTV_DVBC_6 || ++ tv_system == ASCOT3_DTV_DVBC_8) { ++ data[5] = 0x50; ++ data[6] = 0x78; ++ data[7] = 0x08; ++ data[8] = 0x30; ++ } else { ++ data[5] = 0xAF; ++ data[6] = 0x78; ++ data[7] = 0x08; ++ data[8] = 0x30; ++ } ++ ascot3_write_regs(priv, 0x5E, data, 9); ++ ++ /* Setting for IFOUT_LIMIT */ ++ data[0] = (u8)(ascot3_sett[tv_system].outlmt & 0x03); ++ /* Setting for IF BPF buffer gain */ ++ /* RF_GAIN setting */ ++ if (ascot3_sett[tv_system].rf_gain == ASCOT3_AUTO) ++ data[1] = 0x80; ++ else ++ data[1] = (u8)((ascot3_sett[tv_system].rf_gain << 4) & 0x70); ++ ++ /* IF_BPF_GC setting */ ++ data[1] |= (u8)(ascot3_sett[tv_system].if_bpf_gc & 0x0F); ++ ++ /* Setting for internal RFAGC */ ++ data[2] = 0x00; ++ if (frequency <= 172000) { ++ data[3] = (u8)(ascot3_sett[tv_system].rfovld_det_lv1_vl & 0x0F); ++ data[4] = (u8)(ascot3_sett[tv_system].ifovld_det_lv_vl & 0x07); ++ } else if (frequency <= 464000) { ++ data[3] = (u8)(ascot3_sett[tv_system].rfovld_det_lv1_vh & 0x0F); ++ data[4] = (u8)(ascot3_sett[tv_system].ifovld_det_lv_vh & 0x07); ++ } else { ++ data[3] = (u8)(ascot3_sett[tv_system].rfovld_det_lv1_u & 0x0F); ++ data[4] = (u8)(ascot3_sett[tv_system].ifovld_det_lv_u & 0x07); ++ } ++ data[4] |= 0x20; ++ ++ /* Setting for IF frequency and bandwidth */ ++ data[5] = (u8)((ascot3_sett[tv_system].if_bpf_f0 << 4) & 0x30); ++ data[5] |= (u8)(ascot3_sett[tv_system].bw & 0x03); ++ data[6] = (u8)(ascot3_sett[tv_system].fif_offset & 0x1F); ++ data[7] = (u8)(ascot3_sett[tv_system].bw_offset & 0x1F); ++ ++ /* RF tuning frequency setting */ ++ data[8] = (u8)(frequency & 0xFF); /* 0x10: FRF_L */ ++ data[9] = (u8)((frequency >> 8) & 0xFF); /* 0x11: FRF_M */ ++ data[10] = (u8)((frequency >> 16) & 0x0F); /* 0x12: FRF_H (bit[3:0]) */ ++ /* Tuning command */ ++ data[11] = 0xFF; ++ /* Enable IF output, AGC and IFOUT pin selection */ ++ data[12] = 0x11; ++ /* Tuning setting for analog block*/ ++ if (tv_system == ASCOT3_DTV_DVBC_6 || ++ tv_system == ASCOT3_DTV_DVBC_8) { ++ data[13] = 0xD9; ++ data[14] = 0x0F; ++ data[15] = 0x25; ++ data[16] = 0x87; ++ } else { ++ data[13] = 0x99; ++ data[14] = 0x00; ++ data[15] = 0x24; ++ data[16] = 0x87; ++ } ++ ascot3_write_regs(priv, 0x68, data, 17); ++ ++ msleep(50); ++ ++ priv->state = STATE_ACTIVE; ++ ascot3_write_reg(priv, 0x88, 0x00); ++ ascot3_write_reg(priv, 0x87, 0xC0); ++ ++ priv->frequency = frequency; ++ return 0; ++} ++ ++static int ascot3_get_frequency(struct dvb_frontend *fe, u32 *frequency) ++{ ++ struct ascot3_priv *priv = fe->tuner_priv; ++ ++ *frequency = priv->frequency * 1000; ++ return 0; ++} ++ ++static struct dvb_tuner_ops ascot3_tuner_ops = { ++ .info = { ++ .name = "Sony ASCOT3", ++ .frequency_min = 1000000, ++ .frequency_max = 1200000000, ++ .frequency_step = 25000, ++ }, ++ .init = ascot3_init, ++ .release = ascot3_release, ++ .sleep = ascot3_sleep, ++ .set_params = ascot3_set_params, ++ .get_frequency = ascot3_get_frequency, ++}; ++ ++struct dvb_frontend *ascot3_attach(struct dvb_frontend *fe, ++ const struct ascot3_config *config, ++ struct i2c_adapter *i2c) ++{ ++ u8 data[20]; ++ struct ascot3_priv *priv = NULL; ++ ++ priv = kzalloc(sizeof(struct ascot3_priv), GFP_KERNEL); ++ if (priv == NULL) ++ return NULL; ++ priv->i2c_address = config->i2c_address; ++ priv->i2c = i2c; ++ ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 1); ++ ++ /* Check if tuner is Sony ASCOT3 */ ++ data[0] = 0x00; ++ ascot3_read_reg(priv, 0x7F, data); ++ if (((data[0] & 0xF0) != 0xC0) && ((data[0] & 0xF0) != 0xD0)) { ++ kfree(priv); ++ return NULL; ++ } ++ /* Initial setting for internal logic block */ ++ data[0] = 0x7A; ++ data[1] = 0x01; ++ ascot3_write_regs(priv, 0x99, data, 2); ++ /* 16 MHz xTal frequency */ ++ data[0] = 16; ++ /* Driver current setting for crystal oscillator */ ++ /* Load capacitance setting for crystal oscillator */ ++ data[1] = 0x84; ++ data[2] = 0xB0; ++ /* Setting for REFOUT signal output */ ++ data[3] = 0x00; ++ /* GPIO0, GPIO1 port setting */ ++ data[4] = 0x00; ++ data[5] = 0x00; ++ /* Logic wake up, CPU boot */ ++ data[6] = 0xC4; ++ data[7] = 0x40; ++ /* For burst-write */ ++ data[8] = 0x10; ++ /* Setting for internal RFAGC */ ++ data[9] = 0x00; ++ data[10] = 0x45; ++ data[11] = 0x56; ++ /* Setting for analog block */ ++ data[12] = 0x07; ++ /* Initial setting for internal analog block */ ++ data[13] = 0x1C; ++ data[14] = 0x3F; ++ data[15] = 0x02; ++ data[16] = 0x10; ++ data[17] = 0x20; ++ data[18] = 0x0A; ++ data[19] = 0x00; ++ ascot3_write_regs(priv, 0x81, data, 20); ++ /* Setting for internal RFAGC */ ++ ascot3_write_reg(priv, 0x9B, 0x00); ++ msleep(10); ++ /* VCO current setting */ ++ data[0] = 0x8D; ++ data[1] = 0x06; ++ ascot3_write_regs(priv, 0x17, data, 2); ++ msleep(1); ++ ascot3_read_reg(priv, 0x19, data); ++ ascot3_write_reg(priv, 0x95, ((data[0] >> 4) & 0x0F)); ++ ascot3_enter_power_save(priv); ++ /* Load capacitance control setting for crystal oscillator */ ++ ascot3_write_reg(priv, 0x80, 0x01); ++ ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 0); ++ ++ memcpy(&fe->ops.tuner_ops, &ascot3_tuner_ops, ++ sizeof(struct dvb_tuner_ops)); ++ fe->tuner_priv = priv; ++ dev_info(&priv->i2c->dev, ++ "Sony ASCOT3 attached on addr=%x at I2C adapter %p\n", ++ priv->i2c_address, priv->i2c); ++ return fe; ++} ++EXPORT_SYMBOL(ascot3_attach); ++ ++MODULE_DESCRIPTION("Sony ASCOT3 terr/cab tuner driver"); ++MODULE_AUTHOR("sasa.savic.sr@gmail.com"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/amlogic/wetek/ascot3.h b/drivers/amlogic/wetek/ascot3.h +new file mode 100644 +index 0000000..e245539 +--- /dev/null ++++ b/drivers/amlogic/wetek/ascot3.h +@@ -0,0 +1,46 @@ ++/* ++ * ascot3.h ++ * ++ * Sony Ascot3 DVB-T/T2/C tuner driver ++ * ++ * Copyright (C) 2015 Sasa Savic ++ * ++ * Based on ascot2e driver ++ * ++ * Copyright 2012 Sony Corporation ++ * Copyright (C) 2014 NetUP Inc. ++ * Copyright (C) 2014 Sergey Kozlov ++ * Copyright (C) 2014 Abylay Ospan ++ * ++ * 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. ++ * ++ * This program 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. ++ */ ++ ++#ifndef __DVB_ASCOT3_H__ ++#define __DVB_ASCOT3_H__ ++ ++#include ++#include ++#include ++ ++/** ++ * struct ascot3_config - the configuration of Ascot2E tuner driver ++ * @i2c_address: I2C address of the tuner ++ * @xtal_freq_mhz: Oscillator frequency, MHz ++ */ ++struct ascot3_config { ++ u8 i2c_address; ++ u8 xtal_freq_mhz; ++}; ++ ++extern struct dvb_frontend *ascot3_attach(struct dvb_frontend *fe, ++ const struct ascot3_config *config, ++ struct i2c_adapter *i2c); ++#endif +diff --git a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c +new file mode 100644 +index 0000000..5a53ac7 +--- /dev/null ++++ b/drivers/amlogic/wetek/avl6211.c +@@ -0,0 +1,1981 @@ +/* + * Driver for the Availink AVL6211+AV2011 DVB-S/S2 demod+tuner + * @@ -655,7 +1314,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + BW = 40000; + BF = (BW * 127 + 21100/2) / 21100; + -+ dev_info(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); ++ dev_dbg(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); + + reg[5] = (u8)BF; + @@ -1063,7 +1722,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + return ret; +} + -+static int avl6211_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) ++static int avl6211_diseqc_send_burst(struct dvb_frontend* fe, enum fe_sec_mini_cmd burst) +{ + struct avl6211_state *state = fe->demodulator_priv; + struct avl6211_diseqc_tx_status tx_status; @@ -1174,7 +1833,8 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); + return ret; +} -+static int avl6211_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) ++ ++static int avl6211_set_tone(struct dvb_frontend* fe, enum fe_sec_tone_mode tone) +{ + struct avl6211_state *state = fe->demodulator_priv; + int ret; @@ -1218,8 +1878,9 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); + return ret; +} ++ +static int avl6211_set_voltage(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage) ++ enum fe_sec_voltage voltage) +{ + struct avl6211_state *state = fe->demodulator_priv; + int ret; @@ -1446,7 +2107,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); + return ret; +} -+static int avl6211_read_status(struct dvb_frontend* fe, fe_status_t* status) ++static int avl6211_read_status(struct dvb_frontend* fe, enum fe_status* status) +{ + struct avl6211_state *state = fe->demodulator_priv; + int ret; @@ -1605,7 +2266,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + + state->locked = 0; + -+ dev_info(&state->i2c->dev, ++ dev_dbg(&state->i2c->dev, + "%s: delivery_system=%d frequency=%d symbol_rate=%d\n", + __func__, c->delivery_system, c->frequency, c->symbol_rate); + @@ -1638,7 +2299,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + goto err; + } + -+ dev_info(&state->i2c->dev, "Tuner successfully lock!\n"); ++ dev_dbg(&state->i2c->dev, "Tuner successfully lock!\n"); + + state->flags = (CI_FLAG_IQ_NO_SWAPPED) << CI_FLAG_IQ_BIT; //Normal IQ + state->flags |= (CI_FLAG_IQ_AUTO_BIT_AUTO) << CI_FLAG_IQ_AUTO_BIT; //Enable automatic IQ swap detection @@ -1671,7 +2332,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + ret = -EAGAIN; + goto err; + } -+ dev_info(&state->i2c->dev, "Service locked!!!\n"); ++ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); + + ret = avl6211_send_op(OP_RX_RESET_BERPER, state); + if (ret) @@ -1764,10 +2425,10 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + if (ret) + goto err; + -+ dev_info(&state->i2c->dev, "Uploading demod firmware (%s)...\n", AVL6211_DEMOD_FW); ++ dev_dbg(&state->i2c->dev, "Uploading demod firmware (%s)...\n", AVL6211_DEMOD_FW); + ret = request_firmware(&fw, AVL6211_DEMOD_FW, &state->i2c->dev); + if (ret) { -+ dev_info(&state->i2c->dev, "Firmware upload failed. Timeout or file not found\n"); ++ dev_dbg(&state->i2c->dev, "Firmware upload failed. Timeout or file not found\n"); + goto err; + } + @@ -1775,7 +2436,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + if (!buffer) { + release_firmware(fw); + fw = NULL; -+ dev_info(&state->i2c->dev, "Failed to allocate tmp memory for firmware\n"); ++ dev_dbg(&state->i2c->dev, "Failed to allocate tmp memory for firmware\n"); + return -ENOMEM; + } + memcpy(buffer, fw->data, fw->size); @@ -1915,7 +2576,7 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c + + state->boot = true; + -+ dev_info(&state->i2c->dev, "AVL6211+AV2011 init OK\n"); ++ dev_dbg(&state->i2c->dev, "AVL6211+AV2011 init OK\n"); + + return 0; + @@ -2004,9 +2665,11 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c +MODULE_DESCRIPTION("Availink AVL6211+AV2011 demod+tuner driver"); +MODULE_AUTHOR("Sasa Savic "); +MODULE_LICENSE("GPL"); -diff -Naur a/drivers/amlogic/wetek/avl6211.h b/drivers/amlogic/wetek/avl6211.h ---- a/drivers/amlogic/wetek/avl6211.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/avl6211.h 2015-02-14 20:07:51.000000000 +0100 +diff --git a/drivers/amlogic/wetek/avl6211.h b/drivers/amlogic/wetek/avl6211.h +new file mode 100644 +index 0000000..6a7d633 +--- /dev/null ++++ b/drivers/amlogic/wetek/avl6211.h @@ -0,0 +1,156 @@ +/* + * Driver for the Availink AVL6211+AV2011 DVB-S/S2 demod+tuner @@ -2165,9 +2828,11 @@ diff -Naur a/drivers/amlogic/wetek/avl6211.h b/drivers/amlogic/wetek/avl6211.h + +#endif \ No newline at end of file -diff -Naur a/drivers/amlogic/wetek/avl6211_reg.h b/drivers/amlogic/wetek/avl6211_reg.h ---- a/drivers/amlogic/wetek/avl6211_reg.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/avl6211_reg.h 2015-02-18 17:14:59.000000000 +0100 +diff --git a/drivers/amlogic/wetek/avl6211_reg.h b/drivers/amlogic/wetek/avl6211_reg.h +new file mode 100644 +index 0000000..76e865f +--- /dev/null ++++ b/drivers/amlogic/wetek/avl6211_reg.h @@ -0,0 +1,101 @@ +/* + * Driver for the Availink AVL6211+AV2011 DVB-S/S2 demod+tuner @@ -2270,9 +2935,11 @@ diff -Naur a/drivers/amlogic/wetek/avl6211_reg.h b/drivers/amlogic/wetek/avl6211 +#define diseqc_tx_fifo_map_addr 0x00700080 + +#endif -diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c ---- a/drivers/amlogic/wetek/cxd2837.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/cxd2837.c 2015-02-14 23:42:26.000000000 +0100 +diff --git a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c +new file mode 100644 +index 0000000..44193a7 +--- /dev/null ++++ b/drivers/amlogic/wetek/cxd2837.c @@ -0,0 +1,1790 @@ +/* + * Sony CXD2837 DVB-T/T2/C demodulator driver @@ -2328,7 +2995,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + u8 adrx; + u8 curbankx; + -+ fe_delivery_system_t delivery_system; ++ enum fe_delivery_system delivery_system; + u32 freq; + + enum EDemodState state; @@ -2679,7 +3346,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c +} + +static int ConfigureTS(struct cxd_state *state, -+ fe_delivery_system_t delivery_system) ++ enum fe_delivery_system delivery_system) +{ + int ret = 0; + u8 serialTs; @@ -3058,7 +3725,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + ShutDown(state); + kfree(state); +} -+static int read_status(struct dvb_frontend *fe, fe_status_t *status); ++static int read_status(struct dvb_frontend *fe, enum fe_status *status); + +static int set_parameters(struct dvb_frontend *fe) +{ @@ -3068,10 +3735,10 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + u32 IF = 0; + + if (c->frequency == state->freq && c->delivery_system == state->delivery_system) { -+ fe_status_t status; ++ enum fe_status status; + ret = read_status(fe, &status); + if (!ret && status == 0x1F) { -+ dev_info(&state->i2c->dev, "Ignoring tuning to same freq, allready locked!\n"); ++ dev_dbg(&state->i2c->dev, "Ignoring tuning to same freq, allready locked!\n"); + return 0; + } + } @@ -3265,7 +3932,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + return 0; +} + -+static int read_status(struct dvb_frontend *fe, fe_status_t *status) ++static int read_status(struct dvb_frontend *fe, enum fe_status *status) +{ + struct cxd_state *state = fe->demodulator_priv; + u8 rdata; @@ -3332,7 +3999,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + unfreeze_regst(state); + + if (!(BERRegs[0] & 0x10)) { -+ dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); + return 0; + } + @@ -3369,7 +4036,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + unfreeze_regst(state); + + if (!(BERRegs[0] & 0x10)) { -+ dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); + return 0; + } + @@ -3378,7 +4045,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + n_ldpc = ((plp & 0x03) == 0 ? 16200 : 64800); + + if (bitError > ((1U << periodExp) * n_ldpc)) { -+ dev_info(&state->i2c->dev, "%s: invalid BER value\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: invalid BER value\n", __func__); + return -EINVAL; + } + @@ -3418,7 +4085,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + + + if ((BERRegs[0] & 0x80) == 0) { -+ dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); + return 0; + } + @@ -3426,7 +4093,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + periodExp = (Scale & 0x1F); + + if ((periodExp <= 11) && (bitError > (1U << periodExp) * 204 * 8)) { -+ dev_info(&state->i2c->dev, "%s: invalid BER value\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: invalid BER value\n", __func__); + return -EINVAL; + } + @@ -3499,7 +4166,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + + reg = ((u32)Data[0] << 8) | (u32)Data[1]; + if (reg == 0) { -+ dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); + return; + } + if (reg > 10876) @@ -3521,7 +4188,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + + reg = ((u32)Data[0] << 8) | (u32)Data[1]; + if (reg == 0) { -+ dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); + return; + } + if (reg > 4996) @@ -3548,7 +4215,7 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c + + reg = ((u32)(Data[0] & 0x1F) << 8) | ((u32)Data[1]); + if (reg == 0) { -+ dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); + return; + } + @@ -4064,9 +4731,11 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c +MODULE_DESCRIPTION("Sony CXD2837 DVB-T/T2/C demodulator driver"); +MODULE_AUTHOR("Ralph Metzler, Manfred Voelkel"); +MODULE_LICENSE("GPL"); -diff -Naur a/drivers/amlogic/wetek/cxd2837.h b/drivers/amlogic/wetek/cxd2837.h ---- a/drivers/amlogic/wetek/cxd2837.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/cxd2837.h 2015-01-25 00:48:17.000000000 +0100 +diff --git a/drivers/amlogic/wetek/cxd2837.h b/drivers/amlogic/wetek/cxd2837.h +new file mode 100644 +index 0000000..98300a8 +--- /dev/null ++++ b/drivers/amlogic/wetek/cxd2837.h @@ -0,0 +1,107 @@ +/* + * Driver for the Sony CXD2837ER DVB-T/T2/C demodulator. @@ -4175,87 +4844,3983 @@ diff -Naur a/drivers/amlogic/wetek/cxd2837.h b/drivers/amlogic/wetek/cxd2837.h + struct cxd2837_cfg *cfg); + +#endif -diff -Naur a/drivers/amlogic/wetek/Kconfig b/drivers/amlogic/wetek/Kconfig ---- a/drivers/amlogic/wetek/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/Kconfig 2015-01-25 00:48:17.000000000 +0100 -@@ -0,0 +1,14 @@ -+# -+# WetekPlay driver configuration -+# +diff --git a/drivers/amlogic/wetek/cxd2841er_priv_wetek.h b/drivers/amlogic/wetek/cxd2841er_priv_wetek.h +new file mode 100644 +index 0000000..5e2b8d8 +--- /dev/null ++++ b/drivers/amlogic/wetek/cxd2841er_priv_wetek.h +@@ -0,0 +1,45 @@ ++/* ++ * cxd2841er_priv.h ++ * ++ * Sony CXD2441ER digital demodulator driver internal definitions ++ * ++ * Copyright 2012 Sony Corporation ++ * Copyright (C) 2014 NetUP Inc. ++ * Copyright (C) 2014 Sergey Kozlov ++ * Copyright (C) 2014 Abylay Ospan ++ * ++ * 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. ++ * ++ * This program 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. ++ */ + -+menu "WetekPlay driver" ++#ifndef CXD2841ER_PRIV_H ++#define CXD2841ER_PRIV_H + -+config WETEK -+ tristate "WetekPlay driver" -+ default n -+ select DVB_CORE -+ help -+ Select to enable WetekPlay driver. -+endmenu ++#define I2C_SLVX 0 ++#define I2C_SLVT 1 + -diff -Naur a/drivers/amlogic/wetek/Makefile b/drivers/amlogic/wetek/Makefile ---- a/drivers/amlogic/wetek/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/Makefile 2015-01-25 00:48:17.000000000 +0100 -@@ -0,0 +1,10 @@ -+# -+# Makefile for the WetekPlay driver. -+# ++#define CXD2841ER_CHIP_ID 0xa7 ++#define CXD2854ER_CHIP_ID 0xc1 ++#define CXD2837ER_CHIP_ID 0xb1 + -+obj-$(CONFIG_WETEK) += wetekplay.o ++#define CXD2841ER_DVBS_POLLING_INVL 10 + -+wetekplay-objs = nimdetect.o mxl603.o cxd2837.o avl6211.o mn88436.o ++struct cxd2841er_cnr_data { ++ u32 value; ++ int cnr_x1000; ++}; + -+EXTRA_CFLAGS += -Idrivers/media/dvb-core -Idrivers/media/tuners -+EXTRA_CFLAGS += -I. -diff -Naur a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c ---- a/drivers/amlogic/wetek/mn88436.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/mn88436.c 2015-01-25 00:48:17.000000000 +0100 -@@ -0,0 +1,379 @@ ++enum cxd2841er_dvbt2_profile_t { ++ DVBT2_PROFILE_ANY = 0, ++ DVBT2_PROFILE_BASE = 1, ++ DVBT2_PROFILE_LITE = 2 ++}; ++ ++#endif +diff --git a/drivers/amlogic/wetek/cxd2841er_wetek.c b/drivers/amlogic/wetek/cxd2841er_wetek.c +new file mode 100644 +index 0000000..ebe3353 +--- /dev/null ++++ b/drivers/amlogic/wetek/cxd2841er_wetek.c +@@ -0,0 +1,3812 @@ +/* -+ * Driver for the Panasonic MN88436 ATSC demodulator ++ * cxd2841er.c + * -+ * Copyright (C) 2014 Sasa Savic ++ * Sony digital demodulator driver for ++ * CXD2841ER - DVB-S/S2/T/T2/C/C2 ++ * CXD2854ER - DVB-S/S2/T/T2/C/C2, ISDB-T/S + * -+ * 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. ++ * Copyright 2012 Sony Corporation ++ * Copyright (C) 2014 NetUP Inc. ++ * Copyright (C) 2014 Sergey Kozlov ++ * Copyright (C) 2014 Abylay Ospan + * -+ * This program 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. ++ * 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. + * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+#include ++ * This program 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. ++ */ ++ +#include -+#include -+#include +#include -+#include -+#include -+#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "dvb_math.h" +#include "dvb_frontend.h" -+#include "mn88436.h" ++#include "cxd2841er_wetek.h" ++#include "cxd2841er_priv_wetek.h" ++ ++#define MAX_WRITE_REGSIZE 16 ++#define LOG2_E_100X 144 ++ ++/* DVB-C constellation */ ++enum sony_dvbc_constellation_t { ++ SONY_DVBC_CONSTELLATION_16QAM, ++ SONY_DVBC_CONSTELLATION_32QAM, ++ SONY_DVBC_CONSTELLATION_64QAM, ++ SONY_DVBC_CONSTELLATION_128QAM, ++ SONY_DVBC_CONSTELLATION_256QAM ++}; + -+struct mn88436_state { -+ struct dvb_frontend frontend; -+ struct i2c_adapter *i2c; -+ fe_modulation_t current_modulation; -+ u32 current_frequency; -+ u8 mn88436_bank[DMD_REG_BANK]; -+ bool boot; ++enum cxd2841er_state { ++ STATE_SHUTDOWN = 0, ++ STATE_SLEEP_S, ++ STATE_ACTIVE_S, ++ STATE_SLEEP_TC, ++ STATE_ACTIVE_TC +}; -+static int mn88436_write_reg(struct mn88436_state *state, u8 id, u8 reg, u8 val) ++ ++struct cxd2841er_priv { ++ struct dvb_frontend frontend; ++ struct i2c_adapter *i2c; ++ u8 i2c_addr_slvx; ++ u8 i2c_addr_slvt; ++ const struct cxd2841er_config *config; ++ enum cxd2841er_state state; ++ u8 system; ++ enum cxd2841er_xtal xtal; ++ enum fe_caps caps; ++}; ++ ++static const struct cxd2841er_cnr_data s_cn_data[] = { ++ { 0x033e, 0 }, { 0x0339, 100 }, { 0x0333, 200 }, ++ { 0x032e, 300 }, { 0x0329, 400 }, { 0x0324, 500 }, ++ { 0x031e, 600 }, { 0x0319, 700 }, { 0x0314, 800 }, ++ { 0x030f, 900 }, { 0x030a, 1000 }, { 0x02ff, 1100 }, ++ { 0x02f4, 1200 }, { 0x02e9, 1300 }, { 0x02de, 1400 }, ++ { 0x02d4, 1500 }, { 0x02c9, 1600 }, { 0x02bf, 1700 }, ++ { 0x02b5, 1800 }, { 0x02ab, 1900 }, { 0x02a1, 2000 }, ++ { 0x029b, 2100 }, { 0x0295, 2200 }, { 0x0290, 2300 }, ++ { 0x028a, 2400 }, { 0x0284, 2500 }, { 0x027f, 2600 }, ++ { 0x0279, 2700 }, { 0x0274, 2800 }, { 0x026e, 2900 }, ++ { 0x0269, 3000 }, { 0x0262, 3100 }, { 0x025c, 3200 }, ++ { 0x0255, 3300 }, { 0x024f, 3400 }, { 0x0249, 3500 }, ++ { 0x0242, 3600 }, { 0x023c, 3700 }, { 0x0236, 3800 }, ++ { 0x0230, 3900 }, { 0x022a, 4000 }, { 0x0223, 4100 }, ++ { 0x021c, 4200 }, { 0x0215, 4300 }, { 0x020e, 4400 }, ++ { 0x0207, 4500 }, { 0x0201, 4600 }, { 0x01fa, 4700 }, ++ { 0x01f4, 4800 }, { 0x01ed, 4900 }, { 0x01e7, 5000 }, ++ { 0x01e0, 5100 }, { 0x01d9, 5200 }, { 0x01d2, 5300 }, ++ { 0x01cb, 5400 }, { 0x01c4, 5500 }, { 0x01be, 5600 }, ++ { 0x01b7, 5700 }, { 0x01b1, 5800 }, { 0x01aa, 5900 }, ++ { 0x01a4, 6000 }, { 0x019d, 6100 }, { 0x0196, 6200 }, ++ { 0x018f, 6300 }, { 0x0189, 6400 }, { 0x0182, 6500 }, ++ { 0x017c, 6600 }, { 0x0175, 6700 }, { 0x016f, 6800 }, ++ { 0x0169, 6900 }, { 0x0163, 7000 }, { 0x015c, 7100 }, ++ { 0x0156, 7200 }, { 0x0150, 7300 }, { 0x014a, 7400 }, ++ { 0x0144, 7500 }, { 0x013e, 7600 }, { 0x0138, 7700 }, ++ { 0x0132, 7800 }, { 0x012d, 7900 }, { 0x0127, 8000 }, ++ { 0x0121, 8100 }, { 0x011c, 8200 }, { 0x0116, 8300 }, ++ { 0x0111, 8400 }, { 0x010b, 8500 }, { 0x0106, 8600 }, ++ { 0x0101, 8700 }, { 0x00fc, 8800 }, { 0x00f7, 8900 }, ++ { 0x00f2, 9000 }, { 0x00ee, 9100 }, { 0x00ea, 9200 }, ++ { 0x00e6, 9300 }, { 0x00e2, 9400 }, { 0x00de, 9500 }, ++ { 0x00da, 9600 }, { 0x00d7, 9700 }, { 0x00d3, 9800 }, ++ { 0x00d0, 9900 }, { 0x00cc, 10000 }, { 0x00c7, 10100 }, ++ { 0x00c3, 10200 }, { 0x00bf, 10300 }, { 0x00ba, 10400 }, ++ { 0x00b6, 10500 }, { 0x00b2, 10600 }, { 0x00ae, 10700 }, ++ { 0x00aa, 10800 }, { 0x00a7, 10900 }, { 0x00a3, 11000 }, ++ { 0x009f, 11100 }, { 0x009c, 11200 }, { 0x0098, 11300 }, ++ { 0x0094, 11400 }, { 0x0091, 11500 }, { 0x008e, 11600 }, ++ { 0x008a, 11700 }, { 0x0087, 11800 }, { 0x0084, 11900 }, ++ { 0x0081, 12000 }, { 0x007e, 12100 }, { 0x007b, 12200 }, ++ { 0x0079, 12300 }, { 0x0076, 12400 }, { 0x0073, 12500 }, ++ { 0x0071, 12600 }, { 0x006e, 12700 }, { 0x006c, 12800 }, ++ { 0x0069, 12900 }, { 0x0067, 13000 }, { 0x0065, 13100 }, ++ { 0x0062, 13200 }, { 0x0060, 13300 }, { 0x005e, 13400 }, ++ { 0x005c, 13500 }, { 0x005a, 13600 }, { 0x0058, 13700 }, ++ { 0x0056, 13800 }, { 0x0054, 13900 }, { 0x0052, 14000 }, ++ { 0x0050, 14100 }, { 0x004e, 14200 }, { 0x004c, 14300 }, ++ { 0x004b, 14400 }, { 0x0049, 14500 }, { 0x0047, 14600 }, ++ { 0x0046, 14700 }, { 0x0044, 14800 }, { 0x0043, 14900 }, ++ { 0x0041, 15000 }, { 0x003f, 15100 }, { 0x003e, 15200 }, ++ { 0x003c, 15300 }, { 0x003b, 15400 }, { 0x003a, 15500 }, ++ { 0x0037, 15700 }, { 0x0036, 15800 }, { 0x0034, 15900 }, ++ { 0x0033, 16000 }, { 0x0032, 16100 }, { 0x0031, 16200 }, ++ { 0x0030, 16300 }, { 0x002f, 16400 }, { 0x002e, 16500 }, ++ { 0x002d, 16600 }, { 0x002c, 16700 }, { 0x002b, 16800 }, ++ { 0x002a, 16900 }, { 0x0029, 17000 }, { 0x0028, 17100 }, ++ { 0x0027, 17200 }, { 0x0026, 17300 }, { 0x0025, 17400 }, ++ { 0x0024, 17500 }, { 0x0023, 17600 }, { 0x0022, 17800 }, ++ { 0x0021, 17900 }, { 0x0020, 18000 }, { 0x001f, 18200 }, ++ { 0x001e, 18300 }, { 0x001d, 18500 }, { 0x001c, 18700 }, ++ { 0x001b, 18900 }, { 0x001a, 19000 }, { 0x0019, 19200 }, ++ { 0x0018, 19300 }, { 0x0017, 19500 }, { 0x0016, 19700 }, ++ { 0x0015, 19900 }, { 0x0014, 20000 }, ++}; ++ ++static const struct cxd2841er_cnr_data s2_cn_data[] = { ++ { 0x05af, 0 }, { 0x0597, 100 }, { 0x057e, 200 }, ++ { 0x0567, 300 }, { 0x0550, 400 }, { 0x0539, 500 }, ++ { 0x0522, 600 }, { 0x050c, 700 }, { 0x04f6, 800 }, ++ { 0x04e1, 900 }, { 0x04cc, 1000 }, { 0x04b6, 1100 }, ++ { 0x04a1, 1200 }, { 0x048c, 1300 }, { 0x0477, 1400 }, ++ { 0x0463, 1500 }, { 0x044f, 1600 }, { 0x043c, 1700 }, ++ { 0x0428, 1800 }, { 0x0416, 1900 }, { 0x0403, 2000 }, ++ { 0x03ef, 2100 }, { 0x03dc, 2200 }, { 0x03c9, 2300 }, ++ { 0x03b6, 2400 }, { 0x03a4, 2500 }, { 0x0392, 2600 }, ++ { 0x0381, 2700 }, { 0x036f, 2800 }, { 0x035f, 2900 }, ++ { 0x034e, 3000 }, { 0x033d, 3100 }, { 0x032d, 3200 }, ++ { 0x031d, 3300 }, { 0x030d, 3400 }, { 0x02fd, 3500 }, ++ { 0x02ee, 3600 }, { 0x02df, 3700 }, { 0x02d0, 3800 }, ++ { 0x02c2, 3900 }, { 0x02b4, 4000 }, { 0x02a6, 4100 }, ++ { 0x0299, 4200 }, { 0x028c, 4300 }, { 0x027f, 4400 }, ++ { 0x0272, 4500 }, { 0x0265, 4600 }, { 0x0259, 4700 }, ++ { 0x024d, 4800 }, { 0x0241, 4900 }, { 0x0236, 5000 }, ++ { 0x022b, 5100 }, { 0x0220, 5200 }, { 0x0215, 5300 }, ++ { 0x020a, 5400 }, { 0x0200, 5500 }, { 0x01f6, 5600 }, ++ { 0x01ec, 5700 }, { 0x01e2, 5800 }, { 0x01d8, 5900 }, ++ { 0x01cf, 6000 }, { 0x01c6, 6100 }, { 0x01bc, 6200 }, ++ { 0x01b3, 6300 }, { 0x01aa, 6400 }, { 0x01a2, 6500 }, ++ { 0x0199, 6600 }, { 0x0191, 6700 }, { 0x0189, 6800 }, ++ { 0x0181, 6900 }, { 0x0179, 7000 }, { 0x0171, 7100 }, ++ { 0x0169, 7200 }, { 0x0161, 7300 }, { 0x015a, 7400 }, ++ { 0x0153, 7500 }, { 0x014b, 7600 }, { 0x0144, 7700 }, ++ { 0x013d, 7800 }, { 0x0137, 7900 }, { 0x0130, 8000 }, ++ { 0x012a, 8100 }, { 0x0124, 8200 }, { 0x011e, 8300 }, ++ { 0x0118, 8400 }, { 0x0112, 8500 }, { 0x010c, 8600 }, ++ { 0x0107, 8700 }, { 0x0101, 8800 }, { 0x00fc, 8900 }, ++ { 0x00f7, 9000 }, { 0x00f2, 9100 }, { 0x00ec, 9200 }, ++ { 0x00e7, 9300 }, { 0x00e2, 9400 }, { 0x00dd, 9500 }, ++ { 0x00d8, 9600 }, { 0x00d4, 9700 }, { 0x00cf, 9800 }, ++ { 0x00ca, 9900 }, { 0x00c6, 10000 }, { 0x00c2, 10100 }, ++ { 0x00be, 10200 }, { 0x00b9, 10300 }, { 0x00b5, 10400 }, ++ { 0x00b1, 10500 }, { 0x00ae, 10600 }, { 0x00aa, 10700 }, ++ { 0x00a6, 10800 }, { 0x00a3, 10900 }, { 0x009f, 11000 }, ++ { 0x009b, 11100 }, { 0x0098, 11200 }, { 0x0095, 11300 }, ++ { 0x0091, 11400 }, { 0x008e, 11500 }, { 0x008b, 11600 }, ++ { 0x0088, 11700 }, { 0x0085, 11800 }, { 0x0082, 11900 }, ++ { 0x007f, 12000 }, { 0x007c, 12100 }, { 0x007a, 12200 }, ++ { 0x0077, 12300 }, { 0x0074, 12400 }, { 0x0072, 12500 }, ++ { 0x006f, 12600 }, { 0x006d, 12700 }, { 0x006b, 12800 }, ++ { 0x0068, 12900 }, { 0x0066, 13000 }, { 0x0064, 13100 }, ++ { 0x0061, 13200 }, { 0x005f, 13300 }, { 0x005d, 13400 }, ++ { 0x005b, 13500 }, { 0x0059, 13600 }, { 0x0057, 13700 }, ++ { 0x0055, 13800 }, { 0x0053, 13900 }, { 0x0051, 14000 }, ++ { 0x004f, 14100 }, { 0x004e, 14200 }, { 0x004c, 14300 }, ++ { 0x004a, 14400 }, { 0x0049, 14500 }, { 0x0047, 14600 }, ++ { 0x0045, 14700 }, { 0x0044, 14800 }, { 0x0042, 14900 }, ++ { 0x0041, 15000 }, { 0x003f, 15100 }, { 0x003e, 15200 }, ++ { 0x003c, 15300 }, { 0x003b, 15400 }, { 0x003a, 15500 }, ++ { 0x0038, 15600 }, { 0x0037, 15700 }, { 0x0036, 15800 }, ++ { 0x0034, 15900 }, { 0x0033, 16000 }, { 0x0032, 16100 }, ++ { 0x0031, 16200 }, { 0x0030, 16300 }, { 0x002f, 16400 }, ++ { 0x002e, 16500 }, { 0x002d, 16600 }, { 0x002c, 16700 }, ++ { 0x002b, 16800 }, { 0x002a, 16900 }, { 0x0029, 17000 }, ++ { 0x0028, 17100 }, { 0x0027, 17200 }, { 0x0026, 17300 }, ++ { 0x0025, 17400 }, { 0x0024, 17500 }, { 0x0023, 17600 }, ++ { 0x0022, 17800 }, { 0x0021, 17900 }, { 0x0020, 18000 }, ++ { 0x001f, 18200 }, { 0x001e, 18300 }, { 0x001d, 18500 }, ++ { 0x001c, 18700 }, { 0x001b, 18900 }, { 0x001a, 19000 }, ++ { 0x0019, 19200 }, { 0x0018, 19300 }, { 0x0017, 19500 }, ++ { 0x0016, 19700 }, { 0x0015, 19900 }, { 0x0014, 20000 }, ++}; ++ ++#define MAKE_IFFREQ_CONFIG(iffreq) ((u32)(((iffreq)/41.0)*16777216.0 + 0.5)) ++#define MAKE_IFFREQ_CONFIG_XTAL(xtal, iffreq) ((xtal == SONY_XTAL_24000) ? \ ++ (u32)(((iffreq)/48.0)*16777216.0 + 0.5) : \ ++ (u32)(((iffreq)/41.0)*16777216.0 + 0.5)) ++ ++static void cxd2841er_i2c_debug(struct cxd2841er_priv *priv, ++ u8 addr, u8 reg, u8 write, ++ const u8 *data, u32 len) ++{ ++ dev_dbg(&priv->i2c->dev, ++ "cxd2841er: I2C %s addr %02x reg 0x%02x size %d\n", ++ (write == 0 ? "read" : "write"), addr, reg, len); ++ print_hex_dump_bytes("cxd2841er: I2C data: ", ++ DUMP_PREFIX_OFFSET, data, len); ++} ++ ++static int cxd2841er_write_regs(struct cxd2841er_priv *priv, ++ u8 addr, u8 reg, const u8 *data, u32 len) +{ + int ret; -+ u8 buf[] = { reg, val }; -+ struct i2c_msg msg = { .addr = state->mn88436_bank[id], -+ .flags = 0, -+ .buf = buf, ++ u8 buf[MAX_WRITE_REGSIZE + 1]; ++ u8 i2c_addr = (addr == I2C_SLVX ? ++ priv->i2c_addr_slvx : priv->i2c_addr_slvt); ++ struct i2c_msg msg[1] = { ++ { ++ .addr = i2c_addr, ++ .flags = 0, ++ .len = len + 1, ++ .buf = buf, ++ } ++ }; ++ ++ if (len + 1 >= sizeof(buf)) { ++ dev_warn(&priv->i2c->dev, "wr reg=%04x: len=%d is too big!\n", ++ reg, len + 1); ++ return -E2BIG; ++ } ++ ++ cxd2841er_i2c_debug(priv, i2c_addr, reg, 1, data, len); ++ buf[0] = reg; ++ memcpy(&buf[1], data, len); ++ ++ ret = i2c_transfer(priv->i2c, msg, 1); ++ if (ret >= 0 && ret != 1) ++ ret = -EIO; ++ if (ret < 0) { ++ dev_warn(&priv->i2c->dev, ++ "%s: i2c wr failed=%d addr=%02x reg=%02x len=%d\n", ++ KBUILD_MODNAME, ret, i2c_addr, reg, len); ++ return ret; ++ } ++ return 0; ++} ++ ++static int cxd2841er_write_reg(struct cxd2841er_priv *priv, ++ u8 addr, u8 reg, u8 val) ++{ ++ return cxd2841er_write_regs(priv, addr, reg, &val, 1); ++} ++ ++static int cxd2841er_read_regs(struct cxd2841er_priv *priv, ++ u8 addr, u8 reg, u8 *val, u32 len) ++{ ++ int ret; ++ u8 i2c_addr = (addr == I2C_SLVX ? ++ priv->i2c_addr_slvx : priv->i2c_addr_slvt); ++ struct i2c_msg msg[2] = { ++ { ++ .addr = i2c_addr, ++ .flags = 0, ++ .len = 1, ++ .buf = ®, ++ }, { ++ .addr = i2c_addr, ++ .flags = I2C_M_RD, ++ .len = len, ++ .buf = val, ++ } ++ }; ++ ++ ret = i2c_transfer(priv->i2c, &msg[0], 1); ++ if (ret >= 0 && ret != 1) ++ ret = -EIO; ++ if (ret < 0) { ++ dev_warn(&priv->i2c->dev, ++ "%s: i2c rw failed=%d addr=%02x reg=%02x\n", ++ KBUILD_MODNAME, ret, i2c_addr, reg); ++ return ret; ++ } ++ ret = i2c_transfer(priv->i2c, &msg[1], 1); ++ if (ret >= 0 && ret != 1) ++ ret = -EIO; ++ if (ret < 0) { ++ dev_warn(&priv->i2c->dev, ++ "%s: i2c rd failed=%d addr=%02x reg=%02x\n", ++ KBUILD_MODNAME, ret, i2c_addr, reg); ++ return ret; ++ } ++ cxd2841er_i2c_debug(priv, i2c_addr, reg, 0, val, len); ++ return 0; ++} ++ ++static int cxd2841er_read_reg(struct cxd2841er_priv *priv, ++ u8 addr, u8 reg, u8 *val) ++{ ++ return cxd2841er_read_regs(priv, addr, reg, val, 1); ++} ++ ++static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv, ++ u8 addr, u8 reg, u8 data, u8 mask) ++{ ++ int res; ++ u8 rdata; ++ ++ if (mask != 0xff) { ++ res = cxd2841er_read_reg(priv, addr, reg, &rdata); ++ if (res) ++ return res; ++ data = ((data & mask) | (rdata & (mask ^ 0xFF))); ++ } ++ return cxd2841er_write_reg(priv, addr, reg, data); ++} ++ ++static int cxd2841er_dvbs2_set_symbol_rate(struct cxd2841er_priv *priv, ++ u32 symbol_rate) ++{ ++ u32 reg_value = 0; ++ u8 data[3] = {0, 0, 0}; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ /* ++ * regValue = (symbolRateKSps * 2^14 / 1000) + 0.5 ++ * = ((symbolRateKSps * 2^14) + 500) / 1000 ++ * = ((symbolRateKSps * 16384) + 500) / 1000 ++ */ ++ reg_value = DIV_ROUND_CLOSEST(symbol_rate * 16384, 1000); ++ if ((reg_value == 0) || (reg_value > 0xFFFFF)) { ++ dev_err(&priv->i2c->dev, ++ "%s(): reg_value is out of range\n", __func__); ++ return -EINVAL; ++ } ++ data[0] = (u8)((reg_value >> 16) & 0x0F); ++ data[1] = (u8)((reg_value >> 8) & 0xFF); ++ data[2] = (u8)(reg_value & 0xFF); ++ /* Set SLV-T Bank : 0xAE */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x20, data, 3); ++ return 0; ++} ++ ++static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv, ++ u8 system); ++ ++static int cxd2841er_sleep_s_to_active_s(struct cxd2841er_priv *priv, ++ u8 system, u32 symbol_rate) ++{ ++ int ret; ++ u8 data[4] = { 0, 0, 0, 0 }; ++ ++ if (priv->state != STATE_SLEEP_S) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, (int)priv->state); ++ return -EINVAL; ++ } ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_set_ts_clock_mode(priv, SYS_DVBS); ++ /* Set demod mode */ ++ if (system == SYS_DVBS) { ++ data[0] = 0x0A; ++ } else if (system == SYS_DVBS2) { ++ data[0] = 0x0B; ++ } else { ++ dev_err(&priv->i2c->dev, "%s(): invalid delsys %d\n", ++ __func__, system); ++ return -EINVAL; ++ } ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, data[0]); ++ /* DVB-S/S2 */ ++ data[0] = 0x00; ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Enable S/S2 auto detection 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, data[0]); ++ /* Set SLV-T Bank : 0xAE */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); ++ /* Enable S/S2 auto detection 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, data[0]); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Enable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); ++ /* Enable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x01); ++ /* Enable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); ++ /* Enable ADC 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x3f); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Enable ADC 3 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); ++ /* Set SLV-T Bank : 0xA3 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa3); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xac, 0x00); ++ data[0] = 0x07; ++ data[1] = 0x3B; ++ data[2] = 0x08; ++ data[3] = 0xC5; ++ /* Set SLV-T Bank : 0xAB */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xab); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x98, data, 4); ++ data[0] = 0x05; ++ data[1] = 0x80; ++ data[2] = 0x0A; ++ data[3] = 0x80; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xa8, data, 4); ++ data[0] = 0x0C; ++ data[1] = 0xCC; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xc3, data, 2); ++ /* Set demod parameter */ ++ ret = cxd2841er_dvbs2_set_symbol_rate(priv, symbol_rate); ++ if (ret != 0) ++ return ret; ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable Hi-Z setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x10); ++ /* disable Hi-Z setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); ++ priv->state = STATE_ACTIVE_S; ++ return 0; ++} ++ ++static int cxd2841er_init_tc(struct dvb_frontend *fe); ++ ++static int cxd2841er_sleep_tc_to_active_t_band(struct cxd2841er_priv *priv, ++ u32 bandwidth); ++ ++static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, ++ u32 bandwidth); ++ ++static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, ++ u32 bandwidth); ++ ++static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv, ++ u32 bandwidth); ++ ++static int cxd2841er_active_i_to_sleep_tc(struct cxd2841er_priv *priv); ++ ++static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv); ++ ++static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv); ++ ++static int cxd2841er_retune_active(struct cxd2841er_priv *priv, ++ struct dtv_frontend_properties *p) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_S && ++ priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); ++ if (priv->state == STATE_ACTIVE_S) ++ return cxd2841er_dvbs2_set_symbol_rate( ++ priv, p->symbol_rate / 1000); ++ else if (priv->state == STATE_ACTIVE_TC) { ++ switch (priv->system) { ++ case SYS_DVBT: ++ return cxd2841er_sleep_tc_to_active_t_band( ++ priv, p->bandwidth_hz); ++ case SYS_DVBT2: ++ return cxd2841er_sleep_tc_to_active_t2_band( ++ priv, p->bandwidth_hz); ++ case SYS_DVBC_ANNEX_A: ++ return cxd2841er_sleep_tc_to_active_c_band( ++ priv, p->bandwidth_hz); ++ case SYS_ISDBT: ++ cxd2841er_active_i_to_sleep_tc(priv); ++ cxd2841er_sleep_tc_to_shutdown(priv); ++ cxd2841er_shutdown_to_sleep_tc(priv); ++ return cxd2841er_sleep_tc_to_active_i( ++ priv, p->bandwidth_hz); ++ } ++ } ++ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", ++ __func__, priv->system); ++ return -EINVAL; ++} ++ ++static int cxd2841er_active_s_to_sleep_s(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_S) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); ++ /* enable Hi-Z setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1f); ++ /* enable Hi-Z setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* disable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x00); ++ /* disable ADC 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); ++ /* disable ADC 3 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); ++ /* SADC Bias ON */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); ++ /* disable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); ++ /* Set SLV-T Bank : 0xAE */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); ++ /* disable S/S2 auto detection1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable S/S2 auto detection2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, 0x00); ++ priv->state = STATE_SLEEP_S; ++ return 0; ++} ++ ++static int cxd2841er_sleep_s_to_shutdown(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_SLEEP_S) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable DSQOUT */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); ++ /* Disable DSQIN */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x9c, 0x00); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Disable oscillator */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); ++ priv->state = STATE_SHUTDOWN; ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_SLEEP_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Disable oscillator */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); ++ priv->state = STATE_SHUTDOWN; ++ return 0; ++} ++ ++static int cxd2841er_active_t_to_sleep_tc(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); ++ /* enable Hi-Z setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); ++ /* enable Hi-Z setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* disable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable ADC 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); ++ /* Disable ADC 3 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); ++ /* Disable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Disable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); ++ priv->state = STATE_SLEEP_TC; ++ return 0; ++} ++ ++static int cxd2841er_active_t2_to_sleep_tc(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); ++ /* enable Hi-Z setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); ++ /* enable Hi-Z setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); ++ /* Cancel DVB-T2 setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x40); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x21); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xfb); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x00, 0x0f); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x00, 0x3f); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* disable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable ADC 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); ++ /* Disable ADC 3 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); ++ /* Disable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Disable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); ++ priv->state = STATE_SLEEP_TC; ++ return 0; ++} ++ ++static int cxd2841er_active_c_to_sleep_tc(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); ++ /* enable Hi-Z setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); ++ /* enable Hi-Z setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); ++ /* Cancel DVB-C setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa3, 0x00, 0x1f); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* disable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable ADC 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); ++ /* Disable ADC 3 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); ++ /* Disable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Disable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); ++ priv->state = STATE_SLEEP_TC; ++ return 0; ++} ++ ++static int cxd2841er_active_i_to_sleep_tc(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* disable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); ++ /* enable Hi-Z setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); ++ /* enable Hi-Z setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); ++ ++ /* TODO: Cancel demod parameter */ ++ ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* disable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable ADC 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); ++ /* Disable ADC 3 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); ++ /* Disable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Disable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); ++ priv->state = STATE_SLEEP_TC; ++ return 0; ++} ++ ++static int cxd2841er_shutdown_to_sleep_s(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_SHUTDOWN) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Clear all demodulator registers */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); ++ usleep_range(3000, 5000); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Set demod SW reset */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); ++ ++ switch (priv->xtal) { ++ case SONY_XTAL_20500: ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x00); ++ break; ++ case SONY_XTAL_24000: ++ /* Select demod frequency */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x03); ++ break; ++ case SONY_XTAL_41000: ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x01); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid demod xtal %d\n", ++ __func__, priv->xtal); ++ return -EINVAL; ++ } ++ ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x0a); ++ /* Clear demod SW reset */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); ++ usleep_range(1000, 2000); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* enable DSQOUT */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1F); ++ /* enable DSQIN */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x9C, 0x40); ++ /* TADC Bias On */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); ++ /* SADC Bias On */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); ++ priv->state = STATE_SLEEP_S; ++ return 0; ++} ++ ++static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv) ++{ ++ u8 data = 0; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_SHUTDOWN) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Clear all demodulator registers */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); ++ usleep_range(3000, 5000); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Set demod SW reset */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); ++ /* Select ADC clock mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x13, 0x00); ++ ++ switch (priv->xtal) { ++ case SONY_XTAL_20500: ++ data = 0x0; ++ break; ++ case SONY_XTAL_24000: ++ /* Select demod frequency */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); ++ data = 0x3; ++ break; ++ case SONY_XTAL_41000: ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); ++ data = 0x1; ++ break; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, data); ++ /* Clear demod SW reset */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); ++ usleep_range(1000, 2000); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* TADC Bias On */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); ++ /* SADC Bias On */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); ++ priv->state = STATE_SLEEP_TC; ++ return 0; ++} ++ ++static int cxd2841er_tune_done(struct cxd2841er_priv *priv) ++{ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0, 0); ++ /* SW Reset */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xfe, 0x01); ++ /* Enable TS output */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x00); ++ return 0; ++} ++ ++/* Set TS parallel mode */ ++static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv, ++ u8 system) ++{ ++ u8 serial_ts, ts_rate_ctrl_off, ts_in_off; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0xc4, &serial_ts); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0xd3, &ts_rate_ctrl_off); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0xde, &ts_in_off); ++ dev_dbg(&priv->i2c->dev, "%s(): ser_ts=0x%02x rate_ctrl_off=0x%02x in_off=0x%02x\n", ++ __func__, serial_ts, ts_rate_ctrl_off, ts_in_off); ++ ++ /* ++ * slave Bank Addr Bit default Name ++ * 00h D9h [7:0] 8'h08 OTSCKPERIOD ++ */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xd9, 0x08); ++ /* ++ * Disable TS IF Clock ++ * slave Bank Addr Bit default Name ++ * 00h 32h [0] 1'b1 OREG_CK_TSIF_EN ++ */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x00, 0x01); ++ /* ++ * slave Bank Addr Bit default Name ++ * 00h 33h [1:0] 2'b01 OREG_CKSEL_TSIF ++ */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x33, 0x00, 0x03); ++ /* ++ * Enable TS IF Clock ++ * slave Bank Addr Bit default Name ++ * 00h 32h [0] 1'b1 OREG_CK_TSIF_EN ++ */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x01, 0x01); ++ ++ if (system == SYS_DVBT) { ++ /* Enable parity period for DVB-T */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); ++ } else if (system == SYS_DVBC_ANNEX_A) { ++ /* Enable parity period for DVB-C */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); ++ } ++} ++ ++static u8 cxd2841er_chip_id(struct cxd2841er_priv *priv) ++{ ++ u8 chip_id = 0; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (cxd2841er_write_reg(priv, I2C_SLVT, 0, 0) == 0) ++ cxd2841er_read_reg(priv, I2C_SLVT, 0xfd, &chip_id); ++ else if (cxd2841er_write_reg(priv, I2C_SLVX, 0, 0) == 0) ++ cxd2841er_read_reg(priv, I2C_SLVX, 0xfd, &chip_id); ++ ++ return chip_id; ++} ++ ++static int cxd2841er_read_status_s(struct dvb_frontend *fe, ++ enum fe_status *status) ++{ ++ u8 reg = 0; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ *status = 0; ++ if (priv->state != STATE_ACTIVE_S) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0xA0 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); ++ /* ++ * slave Bank Addr Bit Signal name ++ * A0h 11h [2] ITSLOCK ++ */ ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x11, ®); ++ if (reg & 0x04) { ++ *status = FE_HAS_SIGNAL ++ | FE_HAS_CARRIER ++ | FE_HAS_VITERBI ++ | FE_HAS_SYNC ++ | FE_HAS_LOCK; ++ } ++ dev_dbg(&priv->i2c->dev, "%s(): result 0x%x\n", __func__, *status); ++ return 0; ++} ++ ++static int cxd2841er_read_status_t_t2(struct cxd2841er_priv *priv, ++ u8 *sync, u8 *tslock, u8 *unlock) ++{ ++ u8 data = 0; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) ++ return -EINVAL; ++ if (priv->system == SYS_DVBT) { ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ } else { ++ /* Set SLV-T Bank : 0x20 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ } ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); ++ if ((data & 0x07) == 0x07) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid hardware state detected\n", __func__); ++ *sync = 0; ++ *tslock = 0; ++ *unlock = 0; ++ } else { ++ *sync = ((data & 0x07) == 0x6 ? 1 : 0); ++ *tslock = ((data & 0x20) ? 1 : 0); ++ *unlock = ((data & 0x10) ? 1 : 0); ++ } ++ return 0; ++} ++ ++static int cxd2841er_read_status_c(struct cxd2841er_priv *priv, u8 *tslock) ++{ ++ u8 data; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) ++ return -EINVAL; ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x88, &data); ++ if ((data & 0x01) == 0) { ++ *tslock = 0; ++ } else { ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); ++ *tslock = ((data & 0x20) ? 1 : 0); ++ } ++ return 0; ++} ++ ++static int cxd2841er_read_status_i(struct cxd2841er_priv *priv, ++ u8 *sync, u8 *tslock, u8 *unlock) ++{ ++ u8 data = 0; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) ++ return -EINVAL; ++ /* Set SLV-T Bank : 0x60 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); ++ dev_dbg(&priv->i2c->dev, ++ "%s(): lock=0x%x\n", __func__, data); ++ *sync = ((data & 0x02) ? 1 : 0); ++ *tslock = ((data & 0x01) ? 1 : 0); ++ *unlock = ((data & 0x10) ? 1 : 0); ++ return 0; ++} ++ ++static int cxd2841er_read_status_tc(struct dvb_frontend *fe, ++ enum fe_status *status) ++{ ++ int ret = 0; ++ u8 sync = 0; ++ u8 tslock = 0; ++ u8 unlock = 0; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ *status = 0; ++ if (priv->state == STATE_ACTIVE_TC) { ++ if (priv->system == SYS_DVBT || priv->system == SYS_DVBT2) { ++ ret = cxd2841er_read_status_t_t2( ++ priv, &sync, &tslock, &unlock); ++ if (ret) ++ goto done; ++ if (unlock) ++ goto done; ++ if (sync) ++ *status = FE_HAS_SIGNAL | ++ FE_HAS_CARRIER | ++ FE_HAS_VITERBI | ++ FE_HAS_SYNC; ++ if (tslock) ++ *status |= FE_HAS_LOCK; ++ } else if (priv->system == SYS_ISDBT) { ++ ret = cxd2841er_read_status_i( ++ priv, &sync, &tslock, &unlock); ++ if (ret) ++ goto done; ++ if (unlock) ++ goto done; ++ if (sync) ++ *status = FE_HAS_SIGNAL | ++ FE_HAS_CARRIER | ++ FE_HAS_VITERBI | ++ FE_HAS_SYNC; ++ if (tslock) ++ *status |= FE_HAS_LOCK; ++ } else if (priv->system == SYS_DVBC_ANNEX_A) { ++ ret = cxd2841er_read_status_c(priv, &tslock); ++ if (ret) ++ goto done; ++ if (tslock) ++ *status = FE_HAS_SIGNAL | ++ FE_HAS_CARRIER | ++ FE_HAS_VITERBI | ++ FE_HAS_SYNC | ++ FE_HAS_LOCK; ++ } ++ } ++done: ++ dev_dbg(&priv->i2c->dev, "%s(): status 0x%x\n", __func__, *status); ++ return ret; ++} ++ ++static int cxd2841er_get_carrier_offset_s_s2(struct cxd2841er_priv *priv, ++ int *offset) ++{ ++ u8 data[3]; ++ u8 is_hs_mode; ++ s32 cfrl_ctrlval; ++ s32 temp_div, temp_q, temp_r; ++ ++ if (priv->state != STATE_ACTIVE_S) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ /* ++ * Get High Sampling Rate mode ++ * slave Bank Addr Bit Signal name ++ * A0h 10h [0] ITRL_LOCK ++ */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data[0]); ++ if (data[0] & 0x01) { ++ /* ++ * slave Bank Addr Bit Signal name ++ * A0h 50h [4] IHSMODE ++ */ ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x50, &data[0]); ++ is_hs_mode = (data[0] & 0x10 ? 1 : 0); ++ } else { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): unable to detect sampling rate mode\n", ++ __func__); ++ return -EINVAL; ++ } ++ /* ++ * slave Bank Addr Bit Signal name ++ * A0h 45h [4:0] ICFRL_CTRLVAL[20:16] ++ * A0h 46h [7:0] ICFRL_CTRLVAL[15:8] ++ * A0h 47h [7:0] ICFRL_CTRLVAL[7:0] ++ */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x45, data, 3); ++ cfrl_ctrlval = sign_extend32((((u32)data[0] & 0x1F) << 16) | ++ (((u32)data[1] & 0xFF) << 8) | ++ ((u32)data[2] & 0xFF), 20); ++ temp_div = (is_hs_mode ? 1048576 : 1572864); ++ if (cfrl_ctrlval > 0) { ++ temp_q = div_s64_rem(97375LL * cfrl_ctrlval, ++ temp_div, &temp_r); ++ } else { ++ temp_q = div_s64_rem(-97375LL * cfrl_ctrlval, ++ temp_div, &temp_r); ++ } ++ if (temp_r >= temp_div / 2) ++ temp_q++; ++ if (cfrl_ctrlval > 0) ++ temp_q *= -1; ++ *offset = temp_q; ++ return 0; ++} ++ ++static int cxd2841er_get_carrier_offset_i(struct cxd2841er_priv *priv, ++ u32 bandwidth, int *offset) ++{ ++ u8 data[4]; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ if (priv->system != SYS_ISDBT) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", ++ __func__, priv->system); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); ++ *offset = -1 * sign_extend32( ++ ((u32)(data[0] & 0x1F) << 24) | ((u32)data[1] << 16) | ++ ((u32)data[2] << 8) | (u32)data[3], 29); ++ ++ switch (bandwidth) { ++ case 6000000: ++ *offset = -1 * ((*offset) * 8/264); ++ break; ++ case 7000000: ++ *offset = -1 * ((*offset) * 8/231); ++ break; ++ case 8000000: ++ *offset = -1 * ((*offset) * 8/198); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", ++ __func__, bandwidth); ++ return -EINVAL; ++ } ++ ++ dev_dbg(&priv->i2c->dev, "%s(): bandwidth %d offset %d\n", ++ __func__, bandwidth, *offset); ++ ++ return 0; ++} ++ ++static int cxd2841er_get_carrier_offset_t(struct cxd2841er_priv *priv, ++ u32 bandwidth, int *offset) ++{ ++ u8 data[4]; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ if (priv->system != SYS_DVBT) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", ++ __func__, priv->system); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); ++ *offset = -1 * sign_extend32( ++ ((u32)(data[0] & 0x1F) << 24) | ((u32)data[1] << 16) | ++ ((u32)data[2] << 8) | (u32)data[3], 29); ++ *offset *= (bandwidth / 1000000); ++ *offset /= 235; ++ return 0; ++} ++ ++static int cxd2841er_get_carrier_offset_t2(struct cxd2841er_priv *priv, ++ u32 bandwidth, int *offset) ++{ ++ u8 data[4]; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ if (priv->system != SYS_DVBT2) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", ++ __func__, priv->system); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); ++ *offset = -1 * sign_extend32( ++ ((u32)(data[0] & 0x0F) << 24) | ((u32)data[1] << 16) | ++ ((u32)data[2] << 8) | (u32)data[3], 27); ++ switch (bandwidth) { ++ case 1712000: ++ *offset /= 582; ++ break; ++ case 5000000: ++ case 6000000: ++ case 7000000: ++ case 8000000: ++ *offset *= (bandwidth / 1000000); ++ *offset /= 940; ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", ++ __func__, bandwidth); ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static int cxd2841er_get_carrier_offset_c(struct cxd2841er_priv *priv, ++ int *offset) ++{ ++ u8 data[2]; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ if (priv->system != SYS_DVBC_ANNEX_A) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", ++ __func__, priv->system); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x15, data, sizeof(data)); ++ *offset = div_s64(41000LL * sign_extend32((((u32)data[0] & 0x3f) << 8) ++ | (u32)data[1], 13), 16384); ++ return 0; ++} ++ ++static int cxd2841er_read_packet_errors_c( ++ struct cxd2841er_priv *priv, u32 *penum) ++{ ++ u8 data[3]; ++ ++ *penum = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); ++ if (data[2] & 0x01) ++ *penum = ((u32)data[0] << 8) | (u32)data[1]; ++ return 0; ++} ++ ++static int cxd2841er_read_packet_errors_t( ++ struct cxd2841er_priv *priv, u32 *penum) ++{ ++ u8 data[3]; ++ ++ *penum = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); ++ if (data[2] & 0x01) ++ *penum = ((u32)data[0] << 8) | (u32)data[1]; ++ return 0; ++} ++ ++static int cxd2841er_read_packet_errors_t2( ++ struct cxd2841er_priv *priv, u32 *penum) ++{ ++ u8 data[3]; ++ ++ *penum = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xfd, data, sizeof(data)); ++ if (data[0] & 0x01) ++ *penum = ((u32)data[1] << 8) | (u32)data[2]; ++ return 0; ++} ++ ++static int cxd2841er_read_packet_errors_i( ++ struct cxd2841er_priv *priv, u32 *penum) ++{ ++ u8 data[2]; ++ ++ *penum = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xA1, data, 1); ++ ++ if (!(data[0] & 0x01)) ++ return 0; ++ ++ /* Layer A */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xA2, data, sizeof(data)); ++ *penum = ((u32)data[0] << 8) | (u32)data[1]; ++ ++ /* Layer B */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xA4, data, sizeof(data)); ++ *penum += ((u32)data[0] << 8) | (u32)data[1]; ++ ++ /* Layer C */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0xA6, data, sizeof(data)); ++ *penum += ((u32)data[0] << 8) | (u32)data[1]; ++ ++ return 0; ++} ++ ++static int cxd2841er_read_ber_c(struct cxd2841er_priv *priv, ++ u32 *bit_error, u32 *bit_count) ++{ ++ u8 data[3]; ++ u32 bit_err, period_exp; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x62, data, sizeof(data)); ++ if (!(data[0] & 0x80)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): no valid BER data\n", __func__); ++ return -EINVAL; ++ } ++ bit_err = ((u32)(data[0] & 0x3f) << 16) | ++ ((u32)data[1] << 8) | ++ (u32)data[2]; ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x60, data); ++ period_exp = data[0] & 0x1f; ++ ++ if ((period_exp <= 11) && (bit_err > (1 << period_exp) * 204 * 8)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): period_exp(%u) or bit_err(%u) not in range. no valid BER data\n", ++ __func__, period_exp, bit_err); ++ return -EINVAL; ++ } ++ ++ dev_dbg(&priv->i2c->dev, ++ "%s(): period_exp(%u) or bit_err(%u) count=%d\n", ++ __func__, period_exp, bit_err, ++ ((1 << period_exp) * 204 * 8)); ++ ++ *bit_error = bit_err; ++ *bit_count = ((1 << period_exp) * 204 * 8); ++ ++ return 0; ++} ++ ++static int cxd2841er_mon_read_ber_s(struct cxd2841er_priv *priv, ++ u32 *bit_error, u32 *bit_count) ++{ ++ u8 data[11]; ++ ++ /* Set SLV-T Bank : 0xA0 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); ++ /* ++ * slave Bank Addr Bit Signal name ++ * A0h 35h [0] IFVBER_VALID ++ * A0h 36h [5:0] IFVBER_BITERR[21:16] ++ * A0h 37h [7:0] IFVBER_BITERR[15:8] ++ * A0h 38h [7:0] IFVBER_BITERR[7:0] ++ * A0h 3Dh [5:0] IFVBER_BITNUM[21:16] ++ * A0h 3Eh [7:0] IFVBER_BITNUM[15:8] ++ * A0h 3Fh [7:0] IFVBER_BITNUM[7:0] ++ */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x35, data, 11); ++ if (data[0] & 0x01) { ++ *bit_error = ((u32)(data[1] & 0x3F) << 16) | ++ ((u32)(data[2] & 0xFF) << 8) | ++ (u32)(data[3] & 0xFF); ++ *bit_count = ((u32)(data[8] & 0x3F) << 16) | ++ ((u32)(data[9] & 0xFF) << 8) | ++ (u32)(data[10] & 0xFF); ++ if ((*bit_count == 0) || (*bit_error > *bit_count)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid bit_error %d, bit_count %d\n", ++ __func__, *bit_error, *bit_count); ++ return -EINVAL; ++ } ++ return 0; ++ } ++ dev_dbg(&priv->i2c->dev, "%s(): no data available\n", __func__); ++ return -EINVAL; ++} ++ ++ ++static int cxd2841er_mon_read_ber_s2(struct cxd2841er_priv *priv, ++ u32 *bit_error, u32 *bit_count) ++{ ++ u8 data[5]; ++ u32 period; ++ ++ /* Set SLV-T Bank : 0xB2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xb2); ++ /* ++ * slave Bank Addr Bit Signal name ++ * B2h 30h [0] IFLBER_VALID ++ * B2h 31h [3:0] IFLBER_BITERR[27:24] ++ * B2h 32h [7:0] IFLBER_BITERR[23:16] ++ * B2h 33h [7:0] IFLBER_BITERR[15:8] ++ * B2h 34h [7:0] IFLBER_BITERR[7:0] ++ */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x30, data, 5); ++ if (data[0] & 0x01) { ++ /* Bit error count */ ++ *bit_error = ((u32)(data[1] & 0x0F) << 24) | ++ ((u32)(data[2] & 0xFF) << 16) | ++ ((u32)(data[3] & 0xFF) << 8) | ++ (u32)(data[4] & 0xFF); ++ ++ /* Set SLV-T Bank : 0xA0 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x7a, data); ++ /* Measurement period */ ++ period = (u32)(1 << (data[0] & 0x0F)); ++ if (period == 0) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): period is 0\n", __func__); ++ return -EINVAL; ++ } ++ if (*bit_error > (period * 64800)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid bit_err 0x%x period 0x%x\n", ++ __func__, *bit_error, period); ++ return -EINVAL; ++ } ++ *bit_count = period * 64800; ++ ++ return 0; ++ } else { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): no data available\n", __func__); ++ } ++ return -EINVAL; ++} ++ ++static int cxd2841er_read_ber_t2(struct cxd2841er_priv *priv, ++ u32 *bit_error, u32 *bit_count) ++{ ++ u8 data[4]; ++ u32 period_exp, n_ldpc; ++ ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid state %d\n", __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x39, data, sizeof(data)); ++ if (!(data[0] & 0x10)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): no valid BER data\n", __func__); ++ return -EINVAL; ++ } ++ *bit_error = ((u32)(data[0] & 0x0f) << 24) | ++ ((u32)data[1] << 16) | ++ ((u32)data[2] << 8) | ++ (u32)data[3]; ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); ++ period_exp = data[0] & 0x0f; ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x22); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x5e, data); ++ n_ldpc = ((data[0] & 0x03) == 0 ? 16200 : 64800); ++ if (*bit_error > ((1U << period_exp) * n_ldpc)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid BER value\n", __func__); ++ return -EINVAL; ++ } ++ ++ /* ++ * FIXME: the right thing would be to return bit_error untouched, ++ * but, as we don't know the scale returned by the counters, let's ++ * at least preserver BER = bit_error/bit_count. ++ */ ++ if (period_exp >= 4) { ++ *bit_count = (1U << (period_exp - 4)) * (n_ldpc / 200); ++ *bit_error *= 3125ULL; ++ } else { ++ *bit_count = (1U << period_exp) * (n_ldpc / 200); ++ *bit_error *= 50000ULL; ++ } ++ return 0; ++} ++ ++static int cxd2841er_read_ber_t(struct cxd2841er_priv *priv, ++ u32 *bit_error, u32 *bit_count) ++{ ++ u8 data[2]; ++ u32 period; ++ ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid state %d\n", __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x39, data); ++ if (!(data[0] & 0x01)) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): no valid BER data\n", __func__); ++ return 0; ++ } ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x22, data, sizeof(data)); ++ *bit_error = ((u32)data[0] << 8) | (u32)data[1]; ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); ++ period = ((data[0] & 0x07) == 0) ? 256 : (4096 << (data[0] & 0x07)); ++ ++ /* ++ * FIXME: the right thing would be to return bit_error untouched, ++ * but, as we don't know the scale returned by the counters, let's ++ * at least preserver BER = bit_error/bit_count. ++ */ ++ *bit_count = period / 128; ++ *bit_error *= 78125ULL; ++ return 0; ++} ++ ++static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, ++ u8 delsys, u32 *snr) ++{ ++ u8 data[3]; ++ u32 res = 0, value; ++ int min_index, max_index, index; ++ static const struct cxd2841er_cnr_data *cn_data; ++ ++ /* Set SLV-T Bank : 0xA1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa1); ++ /* ++ * slave Bank Addr Bit Signal name ++ * A1h 10h [0] ICPM_QUICKRDY ++ * A1h 11h [4:0] ICPM_QUICKCNDT[12:8] ++ * A1h 12h [7:0] ICPM_QUICKCNDT[7:0] ++ */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x10, data, 3); ++ if (data[0] & 0x01) { ++ value = ((u32)(data[1] & 0x1F) << 8) | (u32)(data[2] & 0xFF); ++ min_index = 0; ++ if (delsys == SYS_DVBS) { ++ cn_data = s_cn_data; ++ max_index = sizeof(s_cn_data) / ++ sizeof(s_cn_data[0]) - 1; ++ } else { ++ cn_data = s2_cn_data; ++ max_index = sizeof(s2_cn_data) / ++ sizeof(s2_cn_data[0]) - 1; ++ } ++ if (value >= cn_data[min_index].value) { ++ res = cn_data[min_index].cnr_x1000; ++ goto done; ++ } ++ if (value <= cn_data[max_index].value) { ++ res = cn_data[max_index].cnr_x1000; ++ goto done; ++ } ++ while ((max_index - min_index) > 1) { ++ index = (max_index + min_index) / 2; ++ if (value == cn_data[index].value) { ++ res = cn_data[index].cnr_x1000; ++ goto done; ++ } else if (value > cn_data[index].value) ++ max_index = index; ++ else ++ min_index = index; ++ if ((max_index - min_index) <= 1) { ++ if (value == cn_data[max_index].value) { ++ res = cn_data[max_index].cnr_x1000; ++ goto done; ++ } else { ++ res = cn_data[min_index].cnr_x1000; ++ goto done; ++ } ++ } ++ } ++ } else { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): no data available\n", __func__); ++ return -EINVAL; ++ } ++done: ++ *snr = res; ++ return 0; ++} ++ ++static uint32_t sony_log(uint32_t x) ++{ ++ return (((10000>>8)*(intlog2(x)>>16) + LOG2_E_100X/2)/LOG2_E_100X); ++} ++ ++static int cxd2841er_read_snr_c(struct cxd2841er_priv *priv, u32 *snr) ++{ ++ u32 reg; ++ u8 data[2]; ++ enum sony_dvbc_constellation_t qam = SONY_DVBC_CONSTELLATION_16QAM; ++ ++ *snr = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ ++ /* ++ * Freeze registers: ensure multiple separate register reads ++ * are from the same snapshot ++ */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); ++ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x19, data, 1); ++ qam = (enum sony_dvbc_constellation_t) (data[0] & 0x07); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x4C, data, 2); ++ ++ reg = ((u32)(data[0]&0x1f) << 8) | (u32)data[1]; ++ if (reg == 0) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): reg value out of range\n", __func__); ++ return 0; ++ } ++ ++ switch (qam) { ++ case SONY_DVBC_CONSTELLATION_16QAM: ++ case SONY_DVBC_CONSTELLATION_64QAM: ++ case SONY_DVBC_CONSTELLATION_256QAM: ++ /* SNR(dB) = -9.50 * ln(IREG_SNR_ESTIMATE / (24320)) */ ++ if (reg < 126) ++ reg = 126; ++ *snr = -95 * (int32_t)sony_log(reg) + 95941; ++ break; ++ case SONY_DVBC_CONSTELLATION_32QAM: ++ case SONY_DVBC_CONSTELLATION_128QAM: ++ /* SNR(dB) = -8.75 * ln(IREG_SNR_ESTIMATE / (20800)) */ ++ if (reg < 69) ++ reg = 69; ++ *snr = -88 * (int32_t)sony_log(reg) + 86999; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int cxd2841er_read_snr_t(struct cxd2841er_priv *priv, u32 *snr) ++{ ++ u32 reg; ++ u8 data[2]; ++ ++ *snr = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid state %d\n", __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); ++ reg = ((u32)data[0] << 8) | (u32)data[1]; ++ if (reg == 0) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): reg value out of range\n", __func__); ++ return 0; ++ } ++ if (reg > 4996) ++ reg = 4996; ++ *snr = 10000 * ((intlog10(reg) - intlog10(5350 - reg)) >> 24) + 28500; ++ return 0; ++} ++ ++static int cxd2841er_read_snr_t2(struct cxd2841er_priv *priv, u32 *snr) ++{ ++ u32 reg; ++ u8 data[2]; ++ ++ *snr = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid state %d\n", __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); ++ reg = ((u32)data[0] << 8) | (u32)data[1]; ++ if (reg == 0) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): reg value out of range\n", __func__); ++ return 0; ++ } ++ if (reg > 10876) ++ reg = 10876; ++ *snr = 10000 * ((intlog10(reg) - ++ intlog10(12600 - reg)) >> 24) + 32000; ++ return 0; ++} ++ ++static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) ++{ ++ u32 reg; ++ u8 data[2]; ++ ++ *snr = 0; ++ if (priv->state != STATE_ACTIVE_TC) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid state %d\n", __func__, ++ priv->state); ++ return -EINVAL; ++ } ++ ++ /* Freeze all registers */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); ++ ++ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); ++ reg = ((u32)data[0] << 8) | (u32)data[1]; ++ if (reg == 0) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): reg value out of range\n", __func__); ++ return 0; ++ } ++ if (reg > 4996) ++ reg = 4996; ++ *snr = 100 * intlog10(reg) - 9031; ++ return 0; ++} ++ ++static u16 cxd2841er_read_agc_gain_c(struct cxd2841er_priv *priv, ++ u8 delsys) ++{ ++ u8 data[2]; ++ ++ cxd2841er_write_reg( ++ priv, I2C_SLVT, 0x00, 0x40); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x49, data, 2); ++ dev_dbg(&priv->i2c->dev, ++ "%s(): AGC value=%u\n", ++ __func__, (((u16)data[0] & 0x0F) << 8) | ++ (u16)(data[1] & 0xFF)); ++ return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; ++} ++ ++static u16 cxd2841er_read_agc_gain_t_t2(struct cxd2841er_priv *priv, ++ u8 delsys) ++{ ++ u8 data[2]; ++ ++ cxd2841er_write_reg( ++ priv, I2C_SLVT, 0x00, (delsys == SYS_DVBT ? 0x10 : 0x20)); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); ++ dev_dbg(&priv->i2c->dev, ++ "%s(): AGC value=%u\n", ++ __func__, (((u16)data[0] & 0x0F) << 8) | ++ (u16)(data[1] & 0xFF)); ++ return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; ++} ++ ++static u16 cxd2841er_read_agc_gain_i(struct cxd2841er_priv *priv, ++ u8 delsys) ++{ ++ u8 data[2]; ++ ++ cxd2841er_write_reg( ++ priv, I2C_SLVT, 0x00, 0x60); ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); ++ ++ dev_dbg(&priv->i2c->dev, ++ "%s(): AGC value=%u\n", ++ __func__, (((u16)data[0] & 0x0F) << 8) | ++ (u16)(data[1] & 0xFF)); ++ return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; ++} ++ ++static u16 cxd2841er_read_agc_gain_s(struct cxd2841er_priv *priv) ++{ ++ u8 data[2]; ++ ++ /* Set SLV-T Bank : 0xA0 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); ++ /* ++ * slave Bank Addr Bit Signal name ++ * A0h 1Fh [4:0] IRFAGC_GAIN[12:8] ++ * A0h 20h [7:0] IRFAGC_GAIN[7:0] ++ */ ++ cxd2841er_read_regs(priv, I2C_SLVT, 0x1f, data, 2); ++ return ((((u16)data[0] & 0x1F) << 8) | (u16)(data[1] & 0xFF)) << 3; ++} ++ ++static void cxd2841er_read_ber(struct dvb_frontend *fe) ++{ ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ u32 ret, bit_error = 0, bit_count = 0; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ switch (p->delivery_system) { ++ case SYS_DVBC_ANNEX_A: ++ case SYS_DVBC_ANNEX_B: ++ case SYS_DVBC_ANNEX_C: ++ ret = cxd2841er_read_ber_c(priv, &bit_error, &bit_count); ++ break; ++ case SYS_DVBS: ++ ret = cxd2841er_mon_read_ber_s(priv, &bit_error, &bit_count); ++ break; ++ case SYS_DVBS2: ++ ret = cxd2841er_mon_read_ber_s2(priv, &bit_error, &bit_count); ++ break; ++ case SYS_DVBT: ++ ret = cxd2841er_read_ber_t(priv, &bit_error, &bit_count); ++ break; ++ case SYS_DVBT2: ++ ret = cxd2841er_read_ber_t2(priv, &bit_error, &bit_count); ++ break; ++ default: ++ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ return; ++ } ++ ++ if (!ret) { ++ p->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; ++ p->post_bit_error.stat[0].uvalue += bit_error; ++ p->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; ++ p->post_bit_count.stat[0].uvalue += bit_count; ++ } else { ++ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ } ++} ++ ++static void cxd2841er_read_signal_strength(struct dvb_frontend *fe) ++{ ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ s32 strength; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ switch (p->delivery_system) { ++ case SYS_DVBT: ++ case SYS_DVBT2: ++ strength = cxd2841er_read_agc_gain_t_t2(priv, ++ p->delivery_system); ++ p->strength.stat[0].scale = FE_SCALE_DECIBEL; ++ /* Formula was empirically determinated @ 410 MHz */ ++ p->strength.stat[0].uvalue = strength * 366 / 100 - 89520; ++ break; /* Code moved out of the function */ ++ case SYS_DVBC_ANNEX_A: ++ case SYS_DVBC_ANNEX_B: ++ case SYS_DVBC_ANNEX_C: ++ strength = cxd2841er_read_agc_gain_c(priv, ++ p->delivery_system); ++ p->strength.stat[0].scale = FE_SCALE_DECIBEL; ++ /* ++ * Formula was empirically determinated via linear regression, ++ * using frequencies: 175 MHz, 410 MHz and 800 MHz, and a ++ * stream modulated with QAM64 ++ */ ++ p->strength.stat[0].uvalue = strength * 4045 / 1000 - 85224; ++ break; ++ case SYS_ISDBT: ++ strength = cxd2841er_read_agc_gain_i(priv, p->delivery_system); ++ p->strength.stat[0].scale = FE_SCALE_DECIBEL; ++ /* ++ * Formula was empirically determinated via linear regression, ++ * using frequencies: 175 MHz, 410 MHz and 800 MHz. ++ */ ++ p->strength.stat[0].uvalue = strength * 3775 / 1000 - 90185; ++ break; ++ case SYS_DVBS: ++ case SYS_DVBS2: ++ strength = 65535 - cxd2841er_read_agc_gain_s(priv); ++ p->strength.stat[0].scale = FE_SCALE_RELATIVE; ++ p->strength.stat[0].uvalue = strength; ++ break; ++ default: ++ p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ break; ++ } ++} ++ ++static void cxd2841er_read_snr(struct dvb_frontend *fe) ++{ ++ u32 tmp = 0; ++ int ret = 0; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ switch (p->delivery_system) { ++ case SYS_DVBC_ANNEX_A: ++ case SYS_DVBC_ANNEX_B: ++ case SYS_DVBC_ANNEX_C: ++ ret = cxd2841er_read_snr_c(priv, &tmp); ++ break; ++ case SYS_DVBT: ++ ret = cxd2841er_read_snr_t(priv, &tmp); ++ break; ++ case SYS_DVBT2: ++ ret = cxd2841er_read_snr_t2(priv, &tmp); ++ break; ++ case SYS_ISDBT: ++ ret = cxd2841er_read_snr_i(priv, &tmp); ++ break; ++ case SYS_DVBS: ++ case SYS_DVBS2: ++ ret = cxd2841er_dvbs_read_snr(priv, p->delivery_system, &tmp); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): unknown delivery system %d\n", ++ __func__, p->delivery_system); ++ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ return; ++ } ++ ++ if (!ret) { ++ p->cnr.stat[0].scale = FE_SCALE_DECIBEL; ++ p->cnr.stat[0].svalue = tmp; ++ } else { ++ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ } ++} ++ ++static void cxd2841er_read_ucblocks(struct dvb_frontend *fe) ++{ ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ u32 ucblocks; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ switch (p->delivery_system) { ++ case SYS_DVBC_ANNEX_A: ++ case SYS_DVBC_ANNEX_B: ++ case SYS_DVBC_ANNEX_C: ++ cxd2841er_read_packet_errors_c(priv, &ucblocks); ++ break; ++ case SYS_DVBT: ++ cxd2841er_read_packet_errors_t(priv, &ucblocks); ++ break; ++ case SYS_DVBT2: ++ cxd2841er_read_packet_errors_t2(priv, &ucblocks); ++ break; ++ case SYS_ISDBT: ++ cxd2841er_read_packet_errors_i(priv, &ucblocks); ++ break; ++ default: ++ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ return; ++ } ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ ++ p->block_error.stat[0].scale = FE_SCALE_COUNTER; ++ p->block_error.stat[0].uvalue = ucblocks; ++} ++ ++static int cxd2841er_dvbt2_set_profile( ++ struct cxd2841er_priv *priv, enum cxd2841er_dvbt2_profile_t profile) ++{ ++ u8 tune_mode; ++ u8 seq_not2d_time; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ switch (profile) { ++ case DVBT2_PROFILE_BASE: ++ tune_mode = 0x01; ++ /* Set early unlock time */ ++ seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x0E:0x0C; ++ break; ++ case DVBT2_PROFILE_LITE: ++ tune_mode = 0x05; ++ /* Set early unlock time */ ++ seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x2E:0x28; ++ break; ++ case DVBT2_PROFILE_ANY: ++ tune_mode = 0x00; ++ /* Set early unlock time */ ++ seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x2E:0x28; ++ break; ++ default: ++ return -EINVAL; ++ } ++ /* Set SLV-T Bank : 0x2E */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2e); ++ /* Set profile and tune mode */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x10, tune_mode, 0x07); ++ /* Set SLV-T Bank : 0x2B */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); ++ /* Set early unlock detection time */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x9d, seq_not2d_time); ++ return 0; ++} ++ ++static int cxd2841er_dvbt2_set_plp_config(struct cxd2841er_priv *priv, ++ u8 is_auto, u8 plp_id) ++{ ++ if (is_auto) { ++ dev_dbg(&priv->i2c->dev, ++ "%s() using auto PLP selection\n", __func__); ++ } else { ++ dev_dbg(&priv->i2c->dev, ++ "%s() using manual PLP selection, ID %d\n", ++ __func__, plp_id); ++ } ++ /* Set SLV-T Bank : 0x23 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); ++ if (!is_auto) { ++ /* Manual PLP selection mode. Set the data PLP Id. */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xaf, plp_id); ++ } ++ /* Auto PLP select (Scanning mode = 0x00). Data PLP select = 0x01. */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xad, (is_auto ? 0x00 : 0x01)); ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, ++ u32 bandwidth) ++{ ++ u32 iffreq; ++ u8 data[MAX_WRITE_REGSIZE]; ++ ++ const uint8_t nominalRate8bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x11, 0xF0, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x15, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x11, 0xF0, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t nominalRate7bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x14, 0x80, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x18, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x14, 0x80, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t nominalRate6bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x17, 0xEA, 0xAA, 0xAA, 0xAA}, /* 20.5MHz XTal */ ++ {0x1C, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x17, 0xEA, 0xAA, 0xAA, 0xAA} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t nominalRate5bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x1C, 0xB3, 0x33, 0x33, 0x33}, /* 20.5MHz XTal */ ++ {0x21, 0x99, 0x99, 0x99, 0x99}, /* 24MHz XTal */ ++ {0x1C, 0xB3, 0x33, 0x33, 0x33} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t nominalRate17bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x58, 0xE2, 0xAF, 0xE0, 0xBC}, /* 20.5MHz XTal */ ++ {0x68, 0x0F, 0xA2, 0x32, 0xD0}, /* 24MHz XTal */ ++ {0x58, 0xE2, 0xAF, 0xE0, 0xBC} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t itbCoef8bw[3][14] = { ++ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, ++ 0x23, 0xA9, 0x1F, 0xA8, 0x2C, 0xC8}, /* 20.5MHz XTal */ ++ {0x2F, 0xBA, 0x28, 0x9B, 0x28, 0x9D, 0x28, 0xA1, ++ 0x29, 0xA5, 0x2A, 0xAC, 0x29, 0xB5}, /* 24MHz XTal */ ++ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, ++ 0x23, 0xA9, 0x1F, 0xA8, 0x2C, 0xC8} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t itbCoef7bw[3][14] = { ++ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, ++ 0x29, 0xB0, 0x26, 0xA9, 0x21, 0xA5}, /* 20.5MHz XTal */ ++ {0x30, 0xB1, 0x29, 0x9A, 0x28, 0x9C, 0x28, 0xA0, ++ 0x29, 0xA2, 0x2B, 0xA6, 0x2B, 0xAD}, /* 24MHz XTal */ ++ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, ++ 0x29, 0xB0, 0x26, 0xA9, 0x21, 0xA5} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t itbCoef6bw[3][14] = { ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, ++ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ ++ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, ++ 0x29, 0xA4, 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, ++ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t itbCoef5bw[3][14] = { ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, ++ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ ++ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, ++ 0x29, 0xA4, 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, ++ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ ++ }; ++ ++ const uint8_t itbCoef17bw[3][14] = { ++ {0x25, 0xA0, 0x36, 0x8D, 0x2E, 0x94, 0x28, 0x9B, ++ 0x32, 0x90, 0x2C, 0x9D, 0x29, 0x99}, /* 20.5MHz XTal */ ++ {0x33, 0x8E, 0x2B, 0x97, 0x2D, 0x95, 0x37, 0x8B, ++ 0x30, 0x97, 0x2D, 0x9A, 0x21, 0xA4}, /* 24MHz XTal */ ++ {0x25, 0xA0, 0x36, 0x8D, 0x2E, 0x94, 0x28, 0x9B, ++ 0x32, 0x90, 0x2C, 0x9D, 0x29, 0x99} /* 41MHz XTal */ ++ }; ++ ++ /* Set SLV-T Bank : 0x20 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ ++ switch (bandwidth) { ++ case 8000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate8bw[priv->xtal], 5); ++ ++ /* Set SLV-T Bank : 0x27 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, ++ 0x7a, 0x00, 0x0f); ++ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef8bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.80); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x00, 0x07); ++ break; ++ case 7000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate7bw[priv->xtal], 5); ++ ++ /* Set SLV-T Bank : 0x27 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, ++ 0x7a, 0x00, 0x0f); ++ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef7bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.20); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x02, 0x07); ++ break; ++ case 6000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate6bw[priv->xtal], 5); ++ ++ /* Set SLV-T Bank : 0x27 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, ++ 0x7a, 0x00, 0x0f); ++ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef6bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x04, 0x07); ++ break; ++ case 5000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate5bw[priv->xtal], 5); ++ ++ /* Set SLV-T Bank : 0x27 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, ++ 0x7a, 0x00, 0x0f); ++ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef5bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x06, 0x07); ++ break; ++ case 1712000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate17bw[priv->xtal], 5); ++ ++ /* Set SLV-T Bank : 0x27 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, ++ 0x7a, 0x03, 0x0f); ++ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef17bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.50); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x03, 0x07); ++ break; ++ default: ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_t_band( ++ struct cxd2841er_priv *priv, u32 bandwidth) ++{ ++ u8 data[MAX_WRITE_REGSIZE]; ++ u32 iffreq; ++ u8 nominalRate8bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x11, 0xF0, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x15, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x11, 0xF0, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ u8 nominalRate7bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x14, 0x80, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x18, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x14, 0x80, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ u8 nominalRate6bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x17, 0xEA, 0xAA, 0xAA, 0xAA}, /* 20.5MHz XTal */ ++ {0x1C, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x17, 0xEA, 0xAA, 0xAA, 0xAA} /* 41MHz XTal */ ++ }; ++ u8 nominalRate5bw[3][5] = { ++ /* TRCG Nominal Rate [37:0] */ ++ {0x1C, 0xB3, 0x33, 0x33, 0x33}, /* 20.5MHz XTal */ ++ {0x21, 0x99, 0x99, 0x99, 0x99}, /* 24MHz XTal */ ++ {0x1C, 0xB3, 0x33, 0x33, 0x33} /* 41MHz XTal */ ++ }; ++ ++ u8 itbCoef8bw[3][14] = { ++ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, 0x23, 0xA9, ++ 0x1F, 0xA8, 0x2C, 0xC8}, /* 20.5MHz XTal */ ++ {0x2F, 0xBA, 0x28, 0x9B, 0x28, 0x9D, 0x28, 0xA1, 0x29, 0xA5, ++ 0x2A, 0xAC, 0x29, 0xB5}, /* 24MHz XTal */ ++ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, 0x23, 0xA9, ++ 0x1F, 0xA8, 0x2C, 0xC8} /* 41MHz XTal */ ++ }; ++ u8 itbCoef7bw[3][14] = { ++ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, 0x29, 0xB0, ++ 0x26, 0xA9, 0x21, 0xA5}, /* 20.5MHz XTal */ ++ {0x30, 0xB1, 0x29, 0x9A, 0x28, 0x9C, 0x28, 0xA0, 0x29, 0xA2, ++ 0x2B, 0xA6, 0x2B, 0xAD}, /* 24MHz XTal */ ++ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, 0x29, 0xB0, ++ 0x26, 0xA9, 0x21, 0xA5} /* 41MHz XTal */ ++ }; ++ u8 itbCoef6bw[3][14] = { ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, ++ 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ ++ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, 0x29, 0xA4, ++ 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, ++ 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ ++ }; ++ u8 itbCoef5bw[3][14] = { ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, ++ 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ ++ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, 0x29, 0xA4, ++ 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, ++ 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ ++ }; ++ ++ /* Set SLV-T Bank : 0x13 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); ++ /* Echo performance optimization setting */ ++ data[0] = 0x01; ++ data[1] = 0x14; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x9C, data, 2); ++ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ switch (bandwidth) { ++ case 8000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate8bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef8bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.80); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x00, 0x07); ++ ++ /* Demod core latency setting */ ++ if (priv->xtal == SONY_XTAL_24000) { ++ data[0] = 0x15; ++ data[1] = 0x28; ++ } else { ++ data[0] = 0x01; ++ data[1] = 0xE0; ++ } ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Notch filter setting */ ++ data[0] = 0x01; ++ data[1] = 0x02; ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); ++ break; ++ case 7000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate7bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef7bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.20); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x02, 0x07); ++ ++ /* Demod core latency setting */ ++ if (priv->xtal == SONY_XTAL_24000) { ++ data[0] = 0x1F; ++ data[1] = 0xF8; ++ } else { ++ data[0] = 0x12; ++ data[1] = 0xF8; ++ } ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Notch filter setting */ ++ data[0] = 0x00; ++ data[1] = 0x03; ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); ++ break; ++ case 6000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate6bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef6bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x04, 0x07); ++ ++ /* Demod core latency setting */ ++ if (priv->xtal == SONY_XTAL_24000) { ++ data[0] = 0x25; ++ data[1] = 0x4C; ++ } else { ++ data[0] = 0x1F; ++ data[1] = 0xDC; ++ } ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Notch filter setting */ ++ data[0] = 0x00; ++ data[1] = 0x03; ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); ++ break; ++ case 5000000: ++ /* */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate5bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ++ * ASCOT2D, ASCOT2E and ASCOT3 tuners ++ */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef5bw[priv->xtal], 14); ++ /* */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xD7, 0x06, 0x07); ++ ++ /* Demod core latency setting */ ++ if (priv->xtal == SONY_XTAL_24000) { ++ data[0] = 0x2C; ++ data[1] = 0xC2; ++ } else { ++ data[0] = 0x26; ++ data[1] = 0x3C; ++ } ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Notch filter setting */ ++ data[0] = 0x00; ++ data[1] = 0x03; ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); ++ break; ++ } ++ ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_i_band( ++ struct cxd2841er_priv *priv, u32 bandwidth) ++{ ++ u32 iffreq; ++ u8 data[3]; ++ ++ /* TRCG Nominal Rate */ ++ u8 nominalRate8bw[3][5] = { ++ {0x00, 0x00, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x11, 0xB8, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x00, 0x00, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ ++ u8 nominalRate7bw[3][5] = { ++ {0x00, 0x00, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x14, 0x40, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x00, 0x00, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ ++ u8 nominalRate6bw[3][5] = { ++ {0x14, 0x2E, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ ++ {0x17, 0xA0, 0x00, 0x00, 0x00}, /* 24MHz XTal */ ++ {0x14, 0x2E, 0x00, 0x00, 0x00} /* 41MHz XTal */ ++ }; ++ ++ u8 itbCoef8bw[3][14] = { ++ {0x00}, /* 20.5MHz XTal */ ++ {0x2F, 0xBA, 0x28, 0x9B, 0x28, 0x9D, 0x28, 0xA1, 0x29, ++ 0xA5, 0x2A, 0xAC, 0x29, 0xB5}, /* 24MHz Xtal */ ++ {0x0}, /* 41MHz XTal */ ++ }; ++ ++ u8 itbCoef7bw[3][14] = { ++ {0x00}, /* 20.5MHz XTal */ ++ {0x30, 0xB1, 0x29, 0x9A, 0x28, 0x9C, 0x28, 0xA0, 0x29, ++ 0xA2, 0x2B, 0xA6, 0x2B, 0xAD}, /* 24MHz Xtal */ ++ {0x00}, /* 41MHz XTal */ ++ }; ++ ++ u8 itbCoef6bw[3][14] = { ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, ++ 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ ++ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, 0x29, ++ 0xA4, 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz Xtal */ ++ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, ++ 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 41MHz XTal */ ++ }; ++ ++ dev_dbg(&priv->i2c->dev, "%s() bandwidth=%u\n", __func__, bandwidth); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ ++ /* 20.5/41MHz Xtal support is not available ++ * on ISDB-T 7MHzBW and 8MHzBW ++ */ ++ if (priv->xtal != SONY_XTAL_24000 && bandwidth > 6000000) { ++ dev_err(&priv->i2c->dev, ++ "%s(): bandwidth %d supported only for 24MHz xtal\n", ++ __func__, bandwidth); ++ return -EINVAL; ++ } ++ ++ switch (bandwidth) { ++ case 8000000: ++ /* TRCG Nominal Rate */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate8bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ASCOT tuners optimized */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef8bw[priv->xtal], 14); ++ ++ /* IF freq setting */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.75); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x0, 0x7); ++ ++ /* Demod core latency setting */ ++ data[0] = 0x13; ++ data[1] = 0xFC; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Acquisition optimization setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x03, 0x07); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x03); ++ break; ++ case 7000000: ++ /* TRCG Nominal Rate */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate7bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ASCOT tuners optimized */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef7bw[priv->xtal], 14); ++ ++ /* IF freq setting */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.15); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x02, 0x7); ++ ++ /* Demod core latency setting */ ++ data[0] = 0x1A; ++ data[1] = 0xFA; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Acquisition optimization setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x03, 0x07); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x02); ++ break; ++ case 6000000: ++ /* TRCG Nominal Rate */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0x9F, nominalRate6bw[priv->xtal], 5); ++ /* Group delay equaliser settings for ASCOT tuners optimized */ ++ cxd2841er_write_regs(priv, I2C_SLVT, ++ 0xA6, itbCoef6bw[priv->xtal], 14); ++ ++ /* IF freq setting */ ++ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.55); ++ data[0] = (u8) ((iffreq >> 16) & 0xff); ++ data[1] = (u8)((iffreq >> 8) & 0xff); ++ data[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); ++ ++ /* System bandwidth setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x04, 0x7); ++ ++ /* Demod core latency setting */ ++ if (priv->xtal == SONY_XTAL_24000) { ++ data[0] = 0x1F; ++ data[1] = 0x79; ++ } else { ++ data[0] = 0x1A; ++ data[1] = 0xE2; ++ } ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Acquisition optimization setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x07, 0x07); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x02); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", ++ __func__, bandwidth); ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, ++ u32 bandwidth) ++{ ++ u8 bw7_8mhz_b10_a6[] = { ++ 0x2D, 0xC7, 0x04, 0xF4, 0x07, 0xC5, 0x2A, 0xB8, ++ 0x27, 0x9E, 0x27, 0xA4, 0x29, 0xAB }; ++ u8 bw6mhz_b10_a6[] = { ++ 0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, ++ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4 }; ++ u8 b10_b6[3]; ++ u32 iffreq; ++ ++ dev_dbg(&priv->i2c->dev, "%s() bw=%d\n", __func__, bandwidth); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ switch (bandwidth) { ++ case 8000000: ++ case 7000000: ++ cxd2841er_write_regs( ++ priv, I2C_SLVT, 0xa6, ++ bw7_8mhz_b10_a6, sizeof(bw7_8mhz_b10_a6)); ++ iffreq = MAKE_IFFREQ_CONFIG(4.9); ++ break; ++ case 6000000: ++ cxd2841er_write_regs( ++ priv, I2C_SLVT, 0xa6, ++ bw6mhz_b10_a6, sizeof(bw6mhz_b10_a6)); ++ iffreq = MAKE_IFFREQ_CONFIG(3.7); ++ break; ++ default: ++ dev_err(&priv->i2c->dev, "%s(): unsupported bandwidth %d\n", ++ __func__, bandwidth); ++ return -EINVAL; ++ } ++ /* */ ++ b10_b6[0] = (u8) ((iffreq >> 16) & 0xff); ++ b10_b6[1] = (u8)((iffreq >> 8) & 0xff); ++ b10_b6[2] = (u8)(iffreq & 0xff); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xb6, b10_b6, sizeof(b10_b6)); ++ /* Set SLV-T Bank : 0x11 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); ++ switch (bandwidth) { ++ case 8000000: ++ case 7000000: ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xa3, 0x00, 0x1f); ++ break; ++ case 6000000: ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0xa3, 0x14, 0x1f); ++ break; ++ } ++ /* Set SLV-T Bank : 0x40 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ switch (bandwidth) { ++ case 8000000: ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0x26, 0x0b, 0x0f); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x3e); ++ break; ++ case 7000000: ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0x26, 0x09, 0x0f); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0xd6); ++ break; ++ case 6000000: ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVT, 0x26, 0x08, 0x0f); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x6e); ++ break; ++ } ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_t(struct cxd2841er_priv *priv, ++ u32 bandwidth) ++{ ++ u8 data[2] = { 0x09, 0x54 }; ++ u8 data24m[3] = {0xDC, 0x6C, 0x00}; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Enable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Enable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Enable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); ++ /* Enable ADC 2 & 3 */ ++ if (priv->xtal == SONY_XTAL_41000) { ++ data[0] = 0x0A; ++ data[1] = 0xD4; ++ } ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); ++ /* Enable ADC 4 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ /* IFAGC gain settings */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); ++ /* Set SLV-T Bank : 0x11 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); ++ /* BBAGC TARGET level setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ /* ASCOT setting ON */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); ++ /* Set SLV-T Bank : 0x18 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); ++ /* Pre-RS BER moniter setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x36, 0x40, 0x07); ++ /* FEC Auto Recovery setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x01, 0x01); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* TSIF setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); ++ ++ if (priv->xtal == SONY_XTAL_24000) { ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xBF, 0x60); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x24, data24m, 3); ++ } ++ ++ cxd2841er_sleep_tc_to_active_t_band(priv, bandwidth); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable HiZ Setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); ++ /* Disable HiZ Setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); ++ priv->state = STATE_ACTIVE_TC; ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_t2(struct cxd2841er_priv *priv, ++ u32 bandwidth) ++{ ++ u8 data[MAX_WRITE_REGSIZE]; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_set_ts_clock_mode(priv, SYS_DVBT2); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x02); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Enable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x00); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Enable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Enable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); ++ ++ if (priv->xtal == SONY_XTAL_41000) { ++ data[0] = 0x0A; ++ data[1] = 0xD4; ++ } else { ++ data[0] = 0x09; ++ data[1] = 0x54; ++ } ++ ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); ++ /* Enable ADC 4 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ /* IFAGC gain settings */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); ++ /* Set SLV-T Bank : 0x11 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); ++ /* BBAGC TARGET level setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ /* ASCOT setting ON */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); ++ /* Set SLV-T Bank : 0x20 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ /* Acquisition optimization setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x8b, 0x3c); ++ /* Set SLV-T Bank : 0x2b */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x76, 0x20, 0x70); ++ /* Set SLV-T Bank : 0x23 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); ++ /* L1 Control setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xE6, 0x00, 0x03); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* TSIF setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); ++ /* DVB-T2 initial setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x10); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x34); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xd8); ++ /* Set SLV-T Bank : 0x2a */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x04, 0x0f); ++ /* Set SLV-T Bank : 0x2b */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x20, 0x3f); ++ ++ /* 24MHz Xtal setting */ ++ if (priv->xtal == SONY_XTAL_24000) { ++ /* Set SLV-T Bank : 0x11 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); ++ data[0] = 0xEB; ++ data[1] = 0x03; ++ data[2] = 0x3B; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x33, data, 3); ++ ++ /* Set SLV-T Bank : 0x20 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); ++ data[0] = 0x5E; ++ data[1] = 0x5E; ++ data[2] = 0x47; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x95, data, 3); ++ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x99, 0x18); ++ ++ data[0] = 0x3F; ++ data[1] = 0xFF; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); ++ ++ /* Set SLV-T Bank : 0x24 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); ++ data[0] = 0x0B; ++ data[1] = 0x72; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x34, data, 2); ++ ++ data[0] = 0x93; ++ data[1] = 0xF3; ++ data[2] = 0x00; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xD2, data, 3); ++ ++ data[0] = 0x05; ++ data[1] = 0xB8; ++ data[2] = 0xD8; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xDD, data, 3); ++ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xE0, 0x00); ++ ++ /* Set SLV-T Bank : 0x25 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x25); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xED, 0x60); ++ ++ /* Set SLV-T Bank : 0x27 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xFA, 0x34); ++ ++ /* Set SLV-T Bank : 0x2B */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2B); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x4B, 0x2F); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x9E, 0x0E); ++ ++ /* Set SLV-T Bank : 0x2D */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2D); ++ data[0] = 0x89; ++ data[1] = 0x89; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x24, data, 2); ++ ++ /* Set SLV-T Bank : 0x5E */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x5E); ++ data[0] = 0x24; ++ data[1] = 0x95; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x8C, data, 2); ++ } ++ ++ cxd2841er_sleep_tc_to_active_t2_band(priv, bandwidth); ++ ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable HiZ Setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); ++ /* Disable HiZ Setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); ++ priv->state = STATE_ACTIVE_TC; ++ return 0; ++} ++ ++/* ISDB-Tb part */ ++static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv, ++ u32 bandwidth) ++{ ++ u8 data[2] = { 0x09, 0x54 }; ++ u8 data24m[2] = {0x60, 0x00}; ++ u8 data24m2[3] = {0xB7, 0x1B, 0x00}; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x06); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Enable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); ++ /* Enable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x01); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x01); ++ /* Enable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Enable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); ++ /* xtal freq 20.5MHz or 24M */ ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); ++ /* Enable ADC 4 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); ++ /* ASCOT setting ON */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); ++ /* FEC Auto Recovery setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x00, 0x01); ++ /* ISDB-T initial setting */ ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x00, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x00, 0x01); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x69, 0x04, 0x07); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x6B, 0x03, 0x07); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9D, 0x50, 0xFF); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xD3, 0x06, 0x1F); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xED, 0x00, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xE2, 0xCE, 0x80); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xF2, 0x13, 0x10); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xDE, 0x2E, 0x3F); ++ /* Set SLV-T Bank : 0x15 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xDE, 0x02, 0x03); ++ /* Set SLV-T Bank : 0x1E */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x1E); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x73, 0x68, 0xFF); ++ /* Set SLV-T Bank : 0x63 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x63); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x81, 0x00, 0x01); ++ ++ /* for xtal 24MHz */ ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xBF, data24m, 2); ++ /* Set SLV-T Bank : 0x60 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); ++ cxd2841er_write_regs(priv, I2C_SLVT, 0xA8, data24m2, 3); ++ ++ cxd2841er_sleep_tc_to_active_i_band(priv, bandwidth); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable HiZ Setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); ++ /* Disable HiZ Setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); ++ priv->state = STATE_ACTIVE_TC; ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv, ++ u32 bandwidth) ++{ ++ u8 data[2] = { 0x09, 0x54 }; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_set_ts_clock_mode(priv, SYS_DVBC_ANNEX_A); ++ /* Set SLV-X Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); ++ /* Set demod mode */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x04); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Enable demod clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); ++ /* Disable RF level monitor */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); ++ /* Enable ADC clock */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); ++ /* Enable ADC 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); ++ /* xtal freq 20.5MHz */ ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); ++ /* Enable ADC 4 */ ++ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ /* IFAGC gain settings */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x09, 0x1f); ++ /* Set SLV-T Bank : 0x11 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); ++ /* BBAGC TARGET level setting */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x48); ++ /* Set SLV-T Bank : 0x10 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ /* ASCOT setting ON */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); ++ /* Set SLV-T Bank : 0x40 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); ++ /* Demod setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc3, 0x00, 0x04); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* TSIF setting */ ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); ++ ++ cxd2841er_sleep_tc_to_active_c_band(priv, bandwidth); ++ /* Set SLV-T Bank : 0x00 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ /* Disable HiZ Setting 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); ++ /* Disable HiZ Setting 2 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); ++ priv->state = STATE_ACTIVE_TC; ++ return 0; ++} ++ ++static int cxd2841er_get_frontend(struct dvb_frontend *fe, ++ struct dtv_frontend_properties *p) ++{ ++ enum fe_status status = 0; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state == STATE_ACTIVE_S) ++ cxd2841er_read_status_s(fe, &status); ++ else if (priv->state == STATE_ACTIVE_TC) ++ cxd2841er_read_status_tc(fe, &status); ++ ++ cxd2841er_read_signal_strength(fe); ++ ++ if (status & FE_HAS_LOCK) { ++ cxd2841er_read_snr(fe); ++ cxd2841er_read_ucblocks(fe); ++ ++ cxd2841er_read_ber(fe); ++ } else { ++ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ } ++ return 0; ++} ++ ++static int cxd2841er_set_frontend_s(struct dvb_frontend *fe) ++{ ++ int ret = 0, i, timeout, carr_offset; ++ enum fe_status status; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ u32 symbol_rate = p->symbol_rate/1000; ++ ++ dev_dbg(&priv->i2c->dev, "%s(): %s frequency=%d symbol_rate=%d xtal=%d\n", ++ __func__, ++ (p->delivery_system == SYS_DVBS ? "DVB-S" : "DVB-S2"), ++ p->frequency, symbol_rate, priv->xtal); ++ switch (priv->state) { ++ case STATE_SLEEP_S: ++ ret = cxd2841er_sleep_s_to_active_s( ++ priv, p->delivery_system, symbol_rate); ++ break; ++ case STATE_ACTIVE_S: ++ ret = cxd2841er_retune_active(priv, p); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ ret = -EINVAL; ++ goto done; ++ } ++ if (ret) { ++ dev_dbg(&priv->i2c->dev, "%s(): tune failed\n", __func__); ++ goto done; ++ } ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 1); ++ if (fe->ops.tuner_ops.set_params) ++ fe->ops.tuner_ops.set_params(fe); ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 0); ++ cxd2841er_tune_done(priv); ++ timeout = ((3000000 + (symbol_rate - 1)) / symbol_rate) + 150; ++ for (i = 0; i < timeout / CXD2841ER_DVBS_POLLING_INVL; i++) { ++ usleep_range(CXD2841ER_DVBS_POLLING_INVL*1000, ++ (CXD2841ER_DVBS_POLLING_INVL + 2) * 1000); ++ cxd2841er_read_status_s(fe, &status); ++ if (status & FE_HAS_LOCK) ++ break; ++ } ++ if (status & FE_HAS_LOCK) { ++ if (cxd2841er_get_carrier_offset_s_s2( ++ priv, &carr_offset)) { ++ ret = -EINVAL; ++ goto done; ++ } ++ dev_dbg(&priv->i2c->dev, "%s(): carrier_offset=%d\n", ++ __func__, carr_offset); ++ } ++done: ++ /* Reset stats */ ++ p->strength.stat[0].scale = FE_SCALE_RELATIVE; ++ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ ++ return ret; ++} ++ ++static int cxd2841er_set_frontend_tc(struct dvb_frontend *fe) ++{ ++ int ret = 0, timeout; ++ enum fe_status status; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ ++ ++ dev_dbg(&priv->i2c->dev, "%s() delivery_system=%d bandwidth_hz=%d\n", ++ __func__, p->delivery_system, p->bandwidth_hz); ++ ++ ++ cxd2841er_active_t_to_sleep_tc(priv); ++ cxd2841er_sleep_tc_to_shutdown(priv); ++ cxd2841er_init_tc(fe); ++ ++ if (p->delivery_system == SYS_DVBT) { ++ priv->system = SYS_DVBT; ++ switch (priv->state) { ++ case STATE_SLEEP_TC: ++ ret = cxd2841er_sleep_tc_to_active_t( ++ priv, p->bandwidth_hz); ++ break; ++ case STATE_ACTIVE_TC: ++ ret = cxd2841er_retune_active(priv, p); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ ret = -EINVAL; ++ } ++ } else if (p->delivery_system == SYS_DVBT2) { ++ priv->system = SYS_DVBT2; ++ cxd2841er_dvbt2_set_plp_config(priv, ++ (int)(p->stream_id > 255), p->stream_id); ++ cxd2841er_dvbt2_set_profile(priv, DVBT2_PROFILE_BASE); ++ switch (priv->state) { ++ case STATE_SLEEP_TC: ++ ret = cxd2841er_sleep_tc_to_active_t2(priv, ++ p->bandwidth_hz); ++ break; ++ case STATE_ACTIVE_TC: ++ ret = cxd2841er_retune_active(priv, p); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ ret = -EINVAL; ++ } ++ } else if (p->delivery_system == SYS_ISDBT) { ++ priv->system = SYS_ISDBT; ++ switch (priv->state) { ++ case STATE_SLEEP_TC: ++ ret = cxd2841er_sleep_tc_to_active_i( ++ priv, p->bandwidth_hz); ++ break; ++ case STATE_ACTIVE_TC: ++ ret = cxd2841er_retune_active(priv, p); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ ret = -EINVAL; ++ } ++ } else if (p->delivery_system == SYS_DVBC_ANNEX_A || ++ p->delivery_system == SYS_DVBC_ANNEX_C) { ++ priv->system = SYS_DVBC_ANNEX_A; ++ /* correct bandwidth */ ++ if (p->bandwidth_hz != 6000000 && ++ p->bandwidth_hz != 7000000 && ++ p->bandwidth_hz != 8000000) { ++ p->bandwidth_hz = 8000000; ++ dev_dbg(&priv->i2c->dev, "%s(): forcing bandwidth to %d\n", ++ __func__, p->bandwidth_hz); ++ } ++ ++ switch (priv->state) { ++ case STATE_SLEEP_TC: ++ ret = cxd2841er_sleep_tc_to_active_c( ++ priv, p->bandwidth_hz); ++ break; ++ case STATE_ACTIVE_TC: ++ ret = cxd2841er_retune_active(priv, p); ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ ret = -EINVAL; ++ } ++ } else { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid delivery system %d\n", ++ __func__, p->delivery_system); ++ ret = -EINVAL; ++ } ++ if (ret) ++ goto done; ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 1); ++ if (fe->ops.tuner_ops.set_params) ++ fe->ops.tuner_ops.set_params(fe); ++ if (fe->ops.i2c_gate_ctrl) ++ fe->ops.i2c_gate_ctrl(fe, 0); ++ cxd2841er_tune_done(priv); ++ timeout = 2500; ++ while (timeout > 0) { ++ ret = cxd2841er_read_status_tc(fe, &status); ++ if (ret) ++ goto done; ++ if (status & FE_HAS_LOCK) ++ break; ++ msleep(20); ++ timeout -= 20; ++ } ++ if (timeout < 0) ++ dev_dbg(&priv->i2c->dev, ++ "%s(): LOCK wait timeout\n", __func__); ++done: ++ return ret; ++} ++ ++static int cxd2841er_tune_s(struct dvb_frontend *fe, ++ bool re_tune, ++ unsigned int mode_flags, ++ unsigned int *delay, ++ enum fe_status *status) ++{ ++ int ret, carrier_offset; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ ++ dev_dbg(&priv->i2c->dev, "%s() re_tune=%d\n", __func__, re_tune); ++ if (re_tune) { ++ ret = cxd2841er_set_frontend_s(fe); ++ if (ret) ++ return ret; ++ cxd2841er_read_status_s(fe, status); ++ if (*status & FE_HAS_LOCK) { ++ if (cxd2841er_get_carrier_offset_s_s2( ++ priv, &carrier_offset)) ++ return -EINVAL; ++ p->frequency += carrier_offset; ++ ret = cxd2841er_set_frontend_s(fe); ++ if (ret) ++ return ret; ++ } ++ } ++ *delay = HZ / 5; ++ return cxd2841er_read_status_s(fe, status); ++} ++ ++static int cxd2841er_tune_tc(struct dvb_frontend *fe, ++ bool re_tune, ++ unsigned int mode_flags, ++ unsigned int *delay, ++ enum fe_status *status) ++{ ++ int ret, carrier_offset; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ ++ dev_dbg(&priv->i2c->dev, "%s(): re_tune %d bandwidth=%d\n", __func__, ++ re_tune, p->bandwidth_hz); ++ if (re_tune) { ++ ret = cxd2841er_set_frontend_tc(fe); ++ if (ret) ++ return ret; ++ cxd2841er_read_status_tc(fe, status); ++ if (*status & FE_HAS_LOCK) { ++ switch (priv->system) { ++ case SYS_ISDBT: ++ ret = cxd2841er_get_carrier_offset_i( ++ priv, p->bandwidth_hz, ++ &carrier_offset); ++ if (ret) ++ return ret; ++ break; ++ case SYS_DVBT: ++ ret = cxd2841er_get_carrier_offset_t( ++ priv, p->bandwidth_hz, ++ &carrier_offset); ++ if (ret) ++ return ret; ++ break; ++ case SYS_DVBT2: ++ ret = cxd2841er_get_carrier_offset_t2( ++ priv, p->bandwidth_hz, ++ &carrier_offset); ++ if (ret) ++ return ret; ++ break; ++ case SYS_DVBC_ANNEX_A: ++ ret = cxd2841er_get_carrier_offset_c( ++ priv, &carrier_offset); ++ if (ret) ++ return ret; ++ break; ++ default: ++ dev_dbg(&priv->i2c->dev, ++ "%s(): invalid delivery system %d\n", ++ __func__, priv->system); ++ return -EINVAL; ++ } ++ dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n", ++ __func__, carrier_offset); ++ p->frequency += carrier_offset; ++ ret = cxd2841er_set_frontend_tc(fe); ++ if (ret) ++ return ret; ++ } ++ } ++ *delay = HZ / 5; ++ return cxd2841er_read_status_tc(fe, status); ++} ++ ++static int cxd2841er_sleep_s(struct dvb_frontend *fe) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_active_s_to_sleep_s(fe->demodulator_priv); ++ cxd2841er_sleep_s_to_shutdown(fe->demodulator_priv); ++ return 0; ++} ++ ++static int cxd2841er_sleep_tc(struct dvb_frontend *fe) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ if (priv->state == STATE_ACTIVE_TC) { ++ switch (priv->system) { ++ case SYS_DVBT: ++ cxd2841er_active_t_to_sleep_tc(priv); ++ break; ++ case SYS_DVBT2: ++ cxd2841er_active_t2_to_sleep_tc(priv); ++ break; ++ case SYS_ISDBT: ++ cxd2841er_active_i_to_sleep_tc(priv); ++ break; ++ case SYS_DVBC_ANNEX_A: ++ cxd2841er_active_c_to_sleep_tc(priv); ++ break; ++ default: ++ dev_warn(&priv->i2c->dev, ++ "%s(): unknown delivery system %d\n", ++ __func__, priv->system); ++ } ++ } ++ if (priv->state != STATE_SLEEP_TC) { ++ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ cxd2841er_sleep_tc_to_shutdown(priv); ++ return 0; ++} ++ ++static int cxd2841er_send_burst(struct dvb_frontend *fe, ++ enum fe_sec_mini_cmd burst) ++{ ++ u8 data; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s(): burst mode %s\n", __func__, ++ (burst == SEC_MINI_A ? "A" : "B")); ++ if (priv->state != STATE_SLEEP_S && ++ priv->state != STATE_ACTIVE_S) { ++ dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ data = (burst == SEC_MINI_A ? 0 : 1); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x34, 0x01); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x35, data); ++ return 0; ++} ++ ++static int cxd2841er_set_tone(struct dvb_frontend *fe, ++ enum fe_sec_tone_mode tone) ++{ ++ u8 data; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s(): tone %s\n", __func__, ++ (tone == SEC_TONE_ON ? "On" : "Off")); ++ if (priv->state != STATE_SLEEP_S && ++ priv->state != STATE_ACTIVE_S) { ++ dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ data = (tone == SEC_TONE_ON ? 1 : 0); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x36, data); ++ return 0; ++} ++ ++static int cxd2841er_send_diseqc_msg(struct dvb_frontend *fe, ++ struct dvb_diseqc_master_cmd *cmd) ++{ ++ int i; ++ u8 data[12]; ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ if (priv->state != STATE_SLEEP_S && ++ priv->state != STATE_ACTIVE_S) { ++ dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", ++ __func__, priv->state); ++ return -EINVAL; ++ } ++ dev_dbg(&priv->i2c->dev, ++ "%s(): cmd->len %d\n", __func__, cmd->msg_len); ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); ++ /* DiDEqC enable */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x33, 0x01); ++ /* cmd1 length & data */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x3d, cmd->msg_len); ++ memset(data, 0, sizeof(data)); ++ for (i = 0; i < cmd->msg_len && i < sizeof(data); i++) ++ data[i] = cmd->msg[i]; ++ cxd2841er_write_regs(priv, I2C_SLVT, 0x3e, data, sizeof(data)); ++ /* repeat count for cmd1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x37, 1); ++ /* repeat count for cmd2: always 0 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x38, 0); ++ /* start transmit */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x32, 0x01); ++ /* wait for 1 sec timeout */ ++ for (i = 0; i < 50; i++) { ++ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, data); ++ if (!data[0]) { ++ dev_dbg(&priv->i2c->dev, ++ "%s(): DiSEqC cmd has been sent\n", __func__); ++ return 0; ++ } ++ msleep(20); ++ } ++ dev_dbg(&priv->i2c->dev, ++ "%s(): DiSEqC cmd transmit timeout\n", __func__); ++ return -ETIMEDOUT; ++} ++ ++static void cxd2841er_release(struct dvb_frontend *fe) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ kfree(priv); ++} ++ ++static int cxd2841er_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s(): enable=%d\n", __func__, enable); ++ cxd2841er_set_reg_bits( ++ priv, I2C_SLVX, 0x8, (enable ? 0x01 : 0x00), 0x01); ++ return 0; ++} ++ ++static enum dvbfe_algo cxd2841er_get_algo(struct dvb_frontend *fe) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ return DVBFE_ALGO_HW; ++} ++ ++static void cxd2841er_init_stats(struct dvb_frontend *fe) ++{ ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ ++ p->strength.len = 1; ++ p->strength.stat[0].scale = FE_SCALE_RELATIVE; ++ p->cnr.len = 1; ++ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->block_error.len = 1; ++ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_error.len = 1; ++ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++ p->post_bit_count.len = 1; ++ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; ++} ++ ++ ++static int cxd2841er_init_s(struct dvb_frontend *fe) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ ++ /* sanity. force demod to SHUTDOWN state */ ++ if (priv->state == STATE_SLEEP_S) { ++ dev_dbg(&priv->i2c->dev, "%s() forcing sleep->shutdown\n", ++ __func__); ++ cxd2841er_sleep_s_to_shutdown(priv); ++ } else if (priv->state == STATE_ACTIVE_S) { ++ dev_dbg(&priv->i2c->dev, "%s() forcing active->sleep->shutdown\n", ++ __func__); ++ cxd2841er_active_s_to_sleep_s(priv); ++ cxd2841er_sleep_s_to_shutdown(priv); ++ } ++ ++ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); ++ cxd2841er_shutdown_to_sleep_s(priv); ++ /* SONY_DEMOD_CONFIG_SAT_IFAGCNEG set to 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xb9, 0x01, 0x01); ++ ++ cxd2841er_init_stats(fe); ++ ++ return 0; ++} ++ ++static int cxd2841er_init_tc(struct dvb_frontend *fe) ++{ ++ struct cxd2841er_priv *priv = fe->demodulator_priv; ++ struct dtv_frontend_properties *p = &fe->dtv_property_cache; ++ ++ dev_dbg(&priv->i2c->dev, "%s() bandwidth_hz=%d\n", ++ __func__, p->bandwidth_hz); ++ cxd2841er_shutdown_to_sleep_tc(priv); ++ /* SONY_DEMOD_CONFIG_IFAGCNEG = 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcb, ++ priv->config->if_agc ? 0x40 : 0x00, 0x40); ++ /* SONY_DEMOD_CONFIG_IFAGC_ADC_FS = 0 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0xcd, ++ priv->config->ifagc_adc_range); ++ /* SONY_DEMOD_CONFIG_PARALLEL_SEL = 1 */ ++ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xCB, ++ priv->config->ts_error_polarity ? 0x00 : 0x01, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xC5, ++ priv->config->clock_polarity ? 0x01 : 0x00, 0x01); ++ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, 0x00, 0x80); ++ ++ cxd2841er_init_stats(fe); ++ ++ return 0; ++} ++ ++static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops; ++static struct dvb_frontend_ops cxd2841er_t_c_ops; ++ ++static struct dvb_frontend *cxd2841er_attach(struct cxd2841er_config *cfg, ++ struct i2c_adapter *i2c, ++ u8 system) ++{ ++ u8 chip_id = 0; ++ const char *type; ++ const char *name; ++ struct cxd2841er_priv *priv = NULL; ++ ++ /* allocate memory for the internal state */ ++ priv = kzalloc(sizeof(struct cxd2841er_priv), GFP_KERNEL); ++ if (!priv) ++ return NULL; ++ priv->i2c = i2c; ++ priv->config = cfg; ++ priv->i2c_addr_slvx = cfg->i2c_addr + 2; ++ priv->i2c_addr_slvt = cfg->i2c_addr; ++ priv->xtal = cfg->xtal; ++ priv->frontend.demodulator_priv = priv; ++ dev_info(&priv->i2c->dev, ++ "%s(): I2C adapter %p SLVX addr %x SLVT addr %x\n", ++ __func__, priv->i2c, ++ priv->i2c_addr_slvx, priv->i2c_addr_slvt); ++ chip_id = cxd2841er_chip_id(priv); ++ switch (chip_id) { ++ case CXD2837ER_CHIP_ID: ++ snprintf(cxd2841er_t_c_ops.info.name, 128, ++ "Sony CXD2837ER DVB-T/T2/C demodulator"); ++ name = "CXD2837ER"; ++ break; ++ case CXD2841ER_CHIP_ID: ++ snprintf(cxd2841er_t_c_ops.info.name, 128, ++ "Sony CXD2841ER DVB-T/T2/C demodulator"); ++ name = "CXD2841ER"; ++ break; ++ case CXD2854ER_CHIP_ID: ++ snprintf(cxd2841er_t_c_ops.info.name, 128, ++ "Sony CXD2854ER DVB-T/T2/C and ISDB-T demodulator"); ++ cxd2841er_t_c_ops.delsys[3] = SYS_ISDBT; ++ name = "CXD2854ER"; ++ break; ++ default: ++ dev_err(&priv->i2c->dev, "%s(): invalid chip ID 0x%02x\n", ++ __func__, chip_id); ++ priv->frontend.demodulator_priv = NULL; ++ kfree(priv); ++ return NULL; ++ } ++ ++ /* create dvb_frontend */ ++ if (system == SYS_DVBS) { ++ memcpy(&priv->frontend.ops, ++ &cxd2841er_dvbs_s2_ops, ++ sizeof(struct dvb_frontend_ops)); ++ type = "S/S2"; ++ } else { ++ memcpy(&priv->frontend.ops, ++ &cxd2841er_t_c_ops, ++ sizeof(struct dvb_frontend_ops)); ++ type = "T/T2/C/ISDB-T"; ++ } ++ ++ dev_info(&priv->i2c->dev, ++ "%s(): attaching %s DVB-%s frontend\n", ++ __func__, name, type); ++ dev_info(&priv->i2c->dev, "%s(): chip ID 0x%02x OK.\n", ++ __func__, chip_id); ++ return &priv->frontend; ++} ++ ++struct dvb_frontend *cxd2841er_attach_s(struct cxd2841er_config *cfg, ++ struct i2c_adapter *i2c) ++{ ++ return cxd2841er_attach(cfg, i2c, SYS_DVBS); ++} ++EXPORT_SYMBOL(cxd2841er_attach_s); ++ ++struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg, ++ struct i2c_adapter *i2c) ++{ ++ return cxd2841er_attach(cfg, i2c, 0); ++} ++EXPORT_SYMBOL(cxd2841er_attach_t_c); ++ ++static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { ++ .delsys = { SYS_DVBS, SYS_DVBS2 }, ++ .info = { ++ .name = "Sony CXD2841ER DVB-S/S2 demodulator", ++ .frequency_min = 500000, ++ .frequency_max = 2500000, ++ .frequency_stepsize = 0, ++ .symbol_rate_min = 1000000, ++ .symbol_rate_max = 45000000, ++ .symbol_rate_tolerance = 500, ++ .caps = FE_CAN_INVERSION_AUTO | ++ FE_CAN_FEC_AUTO | ++ FE_CAN_QPSK, ++ }, ++ .init = cxd2841er_init_s, ++ .sleep = cxd2841er_sleep_s, ++ .release = cxd2841er_release, ++ .set_frontend = cxd2841er_set_frontend_s, ++ .get_frontend = cxd2841er_get_frontend, ++ .read_status = cxd2841er_read_status_s, ++ .i2c_gate_ctrl = cxd2841er_i2c_gate_ctrl, ++ .get_frontend_algo = cxd2841er_get_algo, ++ .set_tone = cxd2841er_set_tone, ++ .diseqc_send_burst = cxd2841er_send_burst, ++ .diseqc_send_master_cmd = cxd2841er_send_diseqc_msg, ++ .tune = cxd2841er_tune_s ++}; ++ ++static struct dvb_frontend_ops cxd2841er_t_c_ops = { ++ .delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A }, ++ .info = { ++ .name = "", /* will set in attach function */ ++ .caps = FE_CAN_FEC_1_2 | ++ FE_CAN_FEC_2_3 | ++ FE_CAN_FEC_3_4 | ++ FE_CAN_FEC_5_6 | ++ FE_CAN_FEC_7_8 | ++ FE_CAN_FEC_AUTO | ++ FE_CAN_QPSK | ++ FE_CAN_QAM_16 | ++ FE_CAN_QAM_32 | ++ FE_CAN_QAM_64 | ++ FE_CAN_QAM_128 | ++ FE_CAN_QAM_256 | ++ FE_CAN_QAM_AUTO | ++ FE_CAN_TRANSMISSION_MODE_AUTO | ++ FE_CAN_GUARD_INTERVAL_AUTO | ++ FE_CAN_HIERARCHY_AUTO | ++ FE_CAN_MUTE_TS | ++ FE_CAN_2G_MODULATION, ++ .frequency_min = 42000000, ++ .frequency_max = 1002000000 ++ }, ++ .init = cxd2841er_init_tc, ++ .sleep = cxd2841er_sleep_tc, ++ .release = cxd2841er_release, ++ .set_frontend = cxd2841er_set_frontend_tc, ++ .get_frontend = cxd2841er_get_frontend, ++ .read_status = cxd2841er_read_status_tc, ++ .tune = cxd2841er_tune_tc, ++ .i2c_gate_ctrl = cxd2841er_i2c_gate_ctrl, ++ .get_frontend_algo = cxd2841er_get_algo ++}; ++ ++MODULE_DESCRIPTION("Sony CXD2841ER/CXD2854ER DVB-C/C2/T/T2/S/S2 demodulator driver"); ++MODULE_AUTHOR("Sergey Kozlov , Abylay Ospan "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/amlogic/wetek/cxd2841er_wetek.h b/drivers/amlogic/wetek/cxd2841er_wetek.h +new file mode 100644 +index 0000000..98a4682 +--- /dev/null ++++ b/drivers/amlogic/wetek/cxd2841er_wetek.h +@@ -0,0 +1,50 @@ ++/* ++ * cxd2841er.h ++ * ++ * Sony CXD2441ER digital demodulator driver public definitions ++ * ++ * Copyright 2012 Sony Corporation ++ * Copyright (C) 2014 NetUP Inc. ++ * Copyright (C) 2014 Sergey Kozlov ++ * Copyright (C) 2014 Abylay Ospan ++ * ++ * 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. ++ * ++ * This program 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. ++ */ ++ ++#ifndef CXD2841ER_H ++#define CXD2841ER_H ++ ++#include ++#include ++ ++enum cxd2841er_xtal { ++ SONY_XTAL_20500, /* 20.5 MHz */ ++ SONY_XTAL_24000, /* 24 MHz */ ++ SONY_XTAL_41000 /* 41 MHz */ ++}; ++ ++struct cxd2841er_config { ++ u8 i2c_addr; ++ u8 if_agc; ++ u8 ifagc_adc_range; ++ u8 ts_error_polarity; ++ u8 clock_polarity; ++ u8 mxl603; ++ enum cxd2841er_xtal xtal; ++}; ++ ++extern struct dvb_frontend *cxd2841er_attach_s(struct cxd2841er_config *cfg, ++ struct i2c_adapter *i2c); ++ ++extern struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg, ++ struct i2c_adapter *i2c); ++ ++#endif +diff --git a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c +new file mode 100644 +index 0000000..755e51e +--- /dev/null ++++ b/drivers/amlogic/wetek/mn88436.c +@@ -0,0 +1,380 @@ ++/* ++ * Driver for the Panasonic MN88436 ATSC demodulator ++ * ++ * Copyright (C) 2014 Sasa Savic ++ * ++ * 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. ++ * ++ * This program 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. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "dvb_frontend.h" ++#include "mn88436.h" ++ ++struct mn88436_state { ++ struct dvb_frontend frontend; ++ struct i2c_adapter *i2c; ++ enum fe_modulation current_modulation; ++ u32 current_frequency; ++ u8 mn88436_bank[DMD_REG_BANK]; ++ bool boot; ++}; ++static int mn88436_write_reg(struct mn88436_state *state, u8 id, u8 reg, u8 val) ++{ ++ int ret; ++ u8 buf[] = { reg, val }; ++ struct i2c_msg msg = { .addr = state->mn88436_bank[id], ++ .flags = 0, ++ .buf = buf, + .len = 2 + }; + @@ -4322,7 +8887,7 @@ diff -Naur a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c +} + + -+static int mn88436_read_status(struct dvb_frontend* fe, fe_status_t* status) ++static int mn88436_read_status(struct dvb_frontend* fe, enum fe_status* status) +{ + struct mn88436_state* state = fe->demodulator_priv; + int ret; @@ -4381,7 +8946,7 @@ diff -Naur a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c + goto err; + } + -+ dev_info(&state->i2c->dev, "Service locked!!!\n"); ++ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); + + state->current_frequency = p->frequency; + state->current_modulation = p->modulation; @@ -4414,11 +8979,11 @@ diff -Naur a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c + if (state->boot) + return 0; + -+ dev_info(&state->i2c->dev, "Uploading demod firmware (%s)...\n", MN88436_DEMOD_ATSC); ++ dev_dbg(&state->i2c->dev, "Uploading demod firmware (%s)...\n", MN88436_DEMOD_ATSC); + + ret = request_firmware(&fw, MN88436_DEMOD_ATSC, &state->i2c->dev); + if (ret) { -+ dev_info(&state->i2c->dev, "Firmware upload failed. Timeout or file not found\n"); ++ dev_dbg(&state->i2c->dev, "Firmware upload failed. Timeout or file not found\n"); + goto err1; + } + @@ -4437,10 +9002,10 @@ diff -Naur a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c + release_firmware(fw); + fw = NULL; + -+ dev_info(&state->i2c->dev, "Uploading demod pseq (%s)...\n", MN88436_DEMOD_PSEQ); ++ dev_dbg(&state->i2c->dev, "Uploading demod pseq (%s)...\n", MN88436_DEMOD_PSEQ); + ret = request_firmware(&fw, MN88436_DEMOD_PSEQ, &state->i2c->dev); + if (ret) { -+ dev_info(&state->i2c->dev, "Pseq upload failed. Timeout or file not found\n"); ++ dev_dbg(&state->i2c->dev, "Pseq upload failed. Timeout or file not found\n"); + goto err1; + } + @@ -4590,9 +9155,11 @@ diff -Naur a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c +MODULE_DESCRIPTION("Panasonic MN88436 ATSC demod driver"); +MODULE_AUTHOR("Sasa Savic "); +MODULE_LICENSE("GPL"); -diff -Naur a/drivers/amlogic/wetek/mn88436.h b/drivers/amlogic/wetek/mn88436.h ---- a/drivers/amlogic/wetek/mn88436.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/mn88436.h 2015-01-25 00:48:17.000000000 +0100 +diff --git a/drivers/amlogic/wetek/mn88436.h b/drivers/amlogic/wetek/mn88436.h +new file mode 100644 +index 0000000..d1194b1 +--- /dev/null ++++ b/drivers/amlogic/wetek/mn88436.h @@ -0,0 +1,47 @@ +/* + * Driver for the Panasonic MN88436 ATSC demodulator @@ -4642,10 +9209,12 @@ diff -Naur a/drivers/amlogic/wetek/mn88436.h b/drivers/amlogic/wetek/mn88436.h + +#endif \ No newline at end of file -diff -Naur a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c ---- a/drivers/amlogic/wetek/mxl603.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/mxl603.c 2015-01-26 21:44:03.000000000 +0100 -@@ -0,0 +1,1093 @@ +diff --git a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c +new file mode 100644 +index 0000000..bc7018c +--- /dev/null ++++ b/drivers/amlogic/wetek/mxl603.c +@@ -0,0 +1,1096 @@ +/* + * Driver for the MaxLinear MxL603 tuner + * @@ -5446,7 +10015,7 @@ diff -Naur a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c + if (ret) + goto err; + -+ dev_info(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", ++ dev_dbg(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", + ref_locked ? "ref locked" : ""); + + if ((rf_locked) || (ref_locked)) @@ -5475,7 +10044,7 @@ diff -Naur a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c + int ret; + u32 freq = c->frequency; + -+ dev_info(&state->i2c->dev, ++ dev_dbg(&state->i2c->dev, + "%s: delivery_system=%d frequency=%d bandwidth_hz=%d\n", + __func__, c->delivery_system, c->frequency, c->bandwidth_hz); + @@ -5656,6 +10225,9 @@ diff -Naur a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c +static struct dvb_tuner_ops mxl603_tuner_ops = { + .info = { + .name = "MaxLinear MxL603", ++ .frequency_min = 1000000, ++ .frequency_max = 1200000000, ++ .frequency_step = 25000, + }, + .init = mxl603_init, + .sleep = mxl603_sleep, @@ -5739,9 +10311,11 @@ diff -Naur a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c +MODULE_DESCRIPTION("MaxLinear MxL603 tuner driver"); +MODULE_AUTHOR("Sasa Savic "); +MODULE_LICENSE("GPL"); -diff -Naur a/drivers/amlogic/wetek/mxl603.h b/drivers/amlogic/wetek/mxl603.h ---- a/drivers/amlogic/wetek/mxl603.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/mxl603.h 2015-01-26 21:35:40.000000000 +0100 +diff --git a/drivers/amlogic/wetek/mxl603.h b/drivers/amlogic/wetek/mxl603.h +new file mode 100644 +index 0000000..ee4f9fb +--- /dev/null ++++ b/drivers/amlogic/wetek/mxl603.h @@ -0,0 +1,83 @@ +/* + * Driver for the MaxLinear MxL603 tuner @@ -5826,10 +10400,12 @@ diff -Naur a/drivers/amlogic/wetek/mxl603.h b/drivers/amlogic/wetek/mxl603.h + struct mxl603_config *cfg); + +#endif /* __MXL603_H__ */ -diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect.c ---- a/drivers/amlogic/wetek/nimdetect.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/nimdetect.c 2015-02-18 15:33:06.000000000 +0100 -@@ -0,0 +1,405 @@ +diff --git a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect.c +new file mode 100644 +index 0000000..073ddb6 +--- /dev/null ++++ b/drivers/amlogic/wetek/nimdetect.c +@@ -0,0 +1,584 @@ +/* + * Wetek NIMs/DVB detection + * @@ -5851,19 +10427,33 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + */ + + -+ ++#ifndef CONFIG_ARM64 ++#include ++#else ++#include ++#endif +#include +#include +#include "nimdetect.h" + ++#include "ascot3.h" +#include "cxd2837.h" ++#include "cxd2841er_wetek.h" +#include "mxl603.h" +#include "avl6211.h" +#include "mn88436.h" + -+ ++#ifdef CONFIG_ARM64 ++static struct reset_control *dvb_demux_reset_ctl; ++static struct reset_control *dvb_afifo_reset_ctl; ++static struct reset_control *dvb_ahbarb0_reset_ctl; ++static struct reset_control *dvb_uparsertop_reset_ctl; ++#define TOTAL_I2C 1 ++#define TOTAL_DEMODS 1 ++#else +#define TOTAL_I2C 2 +#define TOTAL_DEMODS 2 ++#endif +#define TOTAL_AML_INPUTS 3 + + @@ -5881,6 +10471,18 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + .ts_clock = SERIAL_TS_CLK_MID_FULL, +}; + ++static struct cxd2841er_config cxd2841cfg = { ++ .i2c_addr = 0x6C, ++ .if_agc = 0, ++ .ifagc_adc_range = 0x39, ++ .ts_error_polarity = 0, ++ .clock_polarity = 1, ++ .mxl603 = 0, ++ .xtal = SONY_XTAL_20500, ++}; ++struct ascot3_config ascot3cfg = { ++ .i2c_address = 0x60, ++}; +static struct mxl603_config mxl603cfg = { + .xtal_freq_hz = MXL603_XTAL_24MHz, + .if_freq_hz = MXL603_IF_5MHz, @@ -5898,7 +10500,6 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + .xtal_sharing_mode = 0, + .single_supply_3_3V = 1, +}; -+ +static struct mxl603_config mxl603cfg_atsc = { + .xtal_freq_hz = MXL603_XTAL_24MHz, + .if_freq_hz = MXL603_IF_5MHz, @@ -5916,10 +10517,13 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + .xtal_sharing_mode = 0, + .single_supply_3_3V = 1, +}; -+ +static struct avl6211_config avl6211cfg[] = { + { ++#ifndef CONFIG_ARM64 + .tuner_address = 0xC2, ++#else ++ .tuner_address = 0xC4, ++#endif + .tuner_i2c_clock = 200, + .demod_address = 0x0C, + .mpeg_pol = 1, @@ -5950,6 +10554,21 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + } +}; + ++#ifndef CONFIG_ARM64 ++ ++#define EXPORT_SYMBOL_AS(sym, name) \ ++ extern typeof(sym) sym; \ ++ __CRC_SYMBOL(sym, "") \ ++ static const char __kstrtab_##name[] \ ++ __attribute__((section("__ksymtab_strings"), aligned(1))) \ ++ = VMLINUX_SYMBOL_STR(name); \ ++ extern const struct kernel_symbol __ksymtab_##name; \ ++ __visible const struct kernel_symbol __ksymtab_##name \ ++ __used \ ++ __attribute__((section("___ksymtab" "+" #name), unused)) \ ++ = { (unsigned long)&sym, __kstrtab_##name } ++ ++ +extern struct list_head usb_bus_list; +extern struct mutex usb_bus_list_lock; +extern struct usb_device *usb_hub_find_child(struct usb_device *hdev, int port1); @@ -5957,19 +10576,26 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect +extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, + __u8 requesttype, __u16 value, __u16 index, void *data, + __u16 size, int timeout); -+extern const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; -+extern int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force); -+ -+EXPORT_SYMBOL(usb_bus_list); -+EXPORT_SYMBOL(usb_bus_list_lock); -+EXPORT_SYMBOL(usb_hub_find_child); -+EXPORT_SYMBOL(usb_get_dev); -+EXPORT_SYMBOL(usb_control_msg); -+EXPORT_SYMBOL(get_nims_infos); -+EXPORT_SYMBOL(__irq_set_affinity); + ++EXPORT_SYMBOL_AS(usb_bus_list, wtk_bus_list); ++EXPORT_SYMBOL_AS(usb_bus_list_lock, wtk_bus_list_lock); ++EXPORT_SYMBOL_AS(usb_hub_find_child, wtk_hub_find_child); ++EXPORT_SYMBOL_AS(usb_get_dev, wtk_get_dev); ++EXPORT_SYMBOL_AS(usb_control_msg, wtk_control_msg); ++ ++#endif + + ++int kc_class_register(struct class *cls) ++{ ++ return class_register(cls); ++} ++EXPORT_SYMBOL(kc_class_register); ++void kc_class_unregister(struct class *cls) ++{ ++ class_unregister(cls); ++} ++EXPORT_SYMBOL(kc_class_unregister); +const struct cpumask *aml_get_cpu_mask(unsigned int cpu) +{ + const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; @@ -5982,23 +10608,35 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect +{ + memcpy(p, &weteknims, sizeof(struct wetek_nims)); +} -+ ++EXPORT_SYMBOL(get_nims_infos); +int set_external_vol_gpio(int *demod_id, int on) +{ + if (on) { -+ if (*demod_id == 0 ) -+ amlogic_gpio_direction_output(GPIOAO_8, 1, "nimdetect"); ++ if (*demod_id == 0 ) ++#ifdef CONFIG_ARM64 ++ gpio_direction_output(weteknims.power_ctrl, 1); ++#else ++ amlogic_gpio_direction_output(GPIOAO_8, 1, "nimdetect"); ++#endif ++#ifndef CONFIG_ARM64 + else if (*demod_id == 1) + amlogic_gpio_direction_output(GPIOAO_9, 1, "nimdetect"); ++#endif + } else if (!on) { -+ if (*demod_id == 0 ) -+ amlogic_gpio_direction_output(GPIOAO_8, 0, "nimdetect"); ++ if (*demod_id == 0 ) ++#ifdef CONFIG_ARM64 ++ gpio_direction_output(weteknims.power_ctrl, 0); ++#else ++ amlogic_gpio_direction_output(GPIOAO_8, 0, "nimdetect"); ++#endif ++#ifndef CONFIG_ARM64 + else if (*demod_id == 1) -+ amlogic_gpio_direction_output(GPIOAO_9, 0, "nimdetect"); ++ amlogic_gpio_direction_output(GPIOAO_9, 0, "nimdetect"); ++#endif + } + return 0; +} -+ ++#ifndef CONFIG_ARM64 +static void nim_dvb_pinctrl_put(struct wetek_nims *p) +{ + if (p->ts[0].pinctrl) { @@ -6037,14 +10675,53 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + + return pctl; +} ++#endif ++ ++#ifndef CONFIG_ARCH_MESON6 ++#define GPIOD_8 103 ++#endif ++ ++void reset_demod(void) ++{ ++#ifdef CONFIG_ARM64 ++ gpio_direction_output(weteknims.fec_reset, 0); ++ msleep(600); ++ gpio_direction_output(weteknims.fec_reset, 1); ++ msleep(200); ++#else ++ amlogic_gpio_direction_output(GPIOD_8, 0, "nimdetect"); ++ msleep(600); ++ amlogic_gpio_direction_output(GPIOD_8, 1, "nimdetect"); ++ msleep(200); ++#endif ++ ++} +static int nim_dvb_probe(struct platform_device *pdev) +{ + int i; + int ret = 0; -+ ++#ifdef CONFIG_ARM64 ++ struct gpio_desc *desc; ++#endif + weteknims.pdev = pdev; + weteknims.dev = &pdev->dev; + ++#ifdef CONFIG_ARM64 ++ for (i = 0; i < TOTAL_I2C; i++) { ++ ++ weteknims.i2c[i] = i2c_get_adapter(1); //tuner1 on I2C_D ++ ++ if (weteknims.i2c[i] != NULL) ++ dev_info(&pdev->dev, "Found Wetek i2c-1 adapter ...\n"); ++ else { ++ dev_info(&pdev->dev, "Failed to acquire Wetek i2c-1 adapter ...\n"); ++ return 0; ++ } ++ } ++#else ++ /* tuner0 on I2C_A ++ tuner1 on I2C_B ++ */ + for (i = 0; i < TOTAL_I2C; i++) { + weteknims.i2c[i] = i2c_get_adapter(i + 1); + if (weteknims.i2c[i] != NULL) @@ -6052,9 +10729,9 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + else { + dev_info(&pdev->dev, "Failed to acquire Wetek i2c-%d adapter ...\n", i + 1); + return 0; -+ } -+ ++ } + } ++#endif + if (pdev->dev.of_node) { + for (i = 0; i < TOTAL_AML_INPUTS; i++) { + char buf[32]; @@ -6067,12 +10744,48 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + dev_info(&pdev->dev, "%s: parallel\n", buf); + snprintf(buf, sizeof(buf), "p_ts%d", i); + weteknims.ts[i].mode = 1; ++#ifdef CONFIG_ARM64 ++ weteknims.ts[i].pinctrl = devm_pinctrl_get_select(&pdev->dev, buf); ++#else + weteknims.ts[i].pinctrl = nim_dvb_pinctrl_get_select(&pdev->dev, &weteknims, buf); ++#endif + } + } + } + } ++#ifdef CONFIG_ARM64 + ++ dvb_demux_reset_ctl = devm_reset_control_get(&pdev->dev, "demux"); ++ dev_info(&pdev->dev, "dmx rst ctl = %p\n", dvb_demux_reset_ctl); ++ reset_control_deassert(dvb_demux_reset_ctl); ++ ++ dvb_afifo_reset_ctl = devm_reset_control_get(&pdev->dev, "asyncfifo"); ++ dev_info(&pdev->dev, "asyncfifo rst ctl = %p\n", dvb_afifo_reset_ctl); ++ reset_control_deassert(dvb_afifo_reset_ctl); ++ ++ dvb_ahbarb0_reset_ctl = devm_reset_control_get(&pdev->dev, "ahbarb0"); ++ dev_info(&pdev->dev, "ahbarb0 rst ctl = %p\n", dvb_ahbarb0_reset_ctl); ++ reset_control_deassert(dvb_ahbarb0_reset_ctl); ++ ++ dvb_uparsertop_reset_ctl = devm_reset_control_get(&pdev->dev, "uparsertop"); ++ dev_info(&pdev->dev, "uparsertop rst ctl = %p\n", dvb_uparsertop_reset_ctl); ++ reset_control_deassert(dvb_uparsertop_reset_ctl); ++ ++ desc = of_get_named_gpiod_flags(pdev->dev.of_node, "fec_reset_gpio-gpios", 0, NULL); ++ weteknims.fec_reset = desc_to_gpio(desc); ++ ++ desc = of_get_named_gpiod_flags(pdev->dev.of_node, "power_ctrl_gpio-gpios", 0, NULL); ++ weteknims.power_ctrl = desc_to_gpio(desc); ++ /* FEC_RESET GPIOY 13*/ ++ gpio_request(weteknims.fec_reset, "nimdetect"); ++ ++ /* INPUT1 POWER CTRL GPIOY 15*/ ++ gpio_request(weteknims.power_ctrl, "nimdetect"); ++ ++ ++ /* RESET DEMOD(s) */ ++ reset_demod(); ++#else + /* FEC_RESET */ + amlogic_gpio_request(GPIOD_8, "nimdetect"); + @@ -6086,54 +10799,77 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + amlogic_gpio_direction_output(GPIOAO_9, 0, "nimdetect"); //SWITCH OFF INPUT2 POWER + + /* RESET DEMOD(s) */ -+ amlogic_gpio_direction_output(GPIOD_8, 0, "nimdetect"); -+ msleep(600); -+ amlogic_gpio_direction_output(GPIOD_8, 1, "nimdetect"); -+ msleep(200); -+ ++ reset_demod(); ++#endif + + dev_info(&pdev->dev, "Wetek NIM(s) detection in progress ...\n"); + + for (i = 0; i < TOTAL_DEMODS; i++) { -+ if (i == 0) { -+ dev_info(&pdev->dev, "Checking for Sony CXD2837 DVB-C/T/T2 demod ...\n"); -+ -+ weteknims.fe[i] = dvb_attach(cxd2837_attach, weteknims.i2c[i], &cxd2837cfg); -+ -+ if (weteknims.fe[i] != NULL) { -+ -+ if (dvb_attach(mxl603_attach, weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg) == NULL) { -+ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); -+ dev_info(&pdev->dev, "Detaching Sony CXD2837 DVB-C/T/T2 frontend!\n"); ++ ++#ifndef CONFIG_ARM64 ++ dev_info(&pdev->dev, "Checking for Sony CXD2837 DVB-C/T/T2 demod ...\n"); ++ ++ weteknims.fe[i] = cxd2837_attach(weteknims.i2c[i], &cxd2837cfg); ++ ++ if (weteknims.fe[i] != NULL) { ++ if (mxl603_attach(weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg) == NULL) { ++ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); ++ dev_info(&pdev->dev, "Detaching Sony CXD2837 DVB-C/T/T2 frontend!\n"); ++ dvb_frontend_detach(weteknims.fe[i]); ++ goto panasonic; ++ } ++ ++ weteknims.total_nims++; ++ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); ++ return 0; ++ } ++#else ++ dev_info(&pdev->dev, "Checking for Sony CXD2841ER DVB-C/T/T2 demod ...\n"); ++ ++ weteknims.fe[i] = cxd2841er_attach_t_c(&cxd2841cfg, weteknims.i2c[i]); ++ ++ if (weteknims.fe[i] != NULL) { ++ if (mxl603_attach(weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg) == NULL) { ++ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); ++ cxd2841cfg.if_agc = 1; ++ cxd2841cfg.ifagc_adc_range = 0x50; ++ if (ascot3_attach(weteknims.fe[i], &ascot3cfg, weteknims.i2c[i]) == NULL) { ++ dev_info(&pdev->dev, "Failed to find Sony ASCOT3 tuner!\n"); + dvb_frontend_detach(weteknims.fe[i]); -+ return 0; ++ goto panasonic; + } -+ -+ weteknims.total_nims++; -+ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); -+ return 0; -+ } -+ -+ dev_info(&pdev->dev, "Checking for Panasonic MN88436 ATSC demod ...\n"); -+ -+ weteknims.fe[i] = dvb_attach(mn88436_attach, weteknims.i2c[i], 0); ++ } else ++ cxd2841cfg.mxl603 = 1; ++ ++ weteknims.total_nims++; ++ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); ++ return 0; ++ } ++#endif ++ ++panasonic: ++ reset_demod(); ++ dev_info(&pdev->dev, "Checking for Panasonic MN88436 ATSC demod ...\n"); + -+ if (weteknims.fe[i] != NULL) { ++ weteknims.fe[i] = mn88436_attach(weteknims.i2c[i], 0); ++ ++ if (weteknims.fe[i] != NULL) { + -+ if (dvb_attach(mxl603_attach, weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg_atsc) == NULL) { -+ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); -+ dev_info(&pdev->dev, "Detaching Panasonic MN88436 ATSC frontend!\n"); -+ dvb_frontend_detach(weteknims.fe[i]); -+ return 0; -+ } ++ if (mxl603_attach(weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg_atsc) == NULL) { ++ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); ++ dev_info(&pdev->dev, "Detaching Panasonic MN88436 ATSC frontend!\n"); ++ dvb_frontend_detach(weteknims.fe[i]); ++ goto avl6211; ++ } + -+ weteknims.total_nims++; -+ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); -+ return 0; -+ } ++ weteknims.total_nims++; ++ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); ++ return 0; + } ++avl6211: ++ reset_demod(); + dev_info(&pdev->dev, "Checking for AVL6211 DVB-S/S2 demod ...\n"); -+ weteknims.fe[i] = dvb_attach(avl6211_attach, weteknims.i2c[i], &avl6211cfg[i], i); ++ weteknims.fe[i] = avl6211_attach( weteknims.i2c[i], &avl6211cfg[i], i); + if (i == 0 && weteknims.fe[i] == NULL) { + dev_info(&pdev->dev, "No available NIM(s) found ...\n"); + return 0; @@ -6160,12 +10896,26 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + if (weteknims.i2c[i] != NULL) + i2c_put_adapter(weteknims.i2c[i]); + } ++#ifdef CONFIG_ARM64 ++ gpio_free(weteknims.fec_reset); ++ gpio_free(weteknims.power_ctrl); ++#else + amlogic_gpio_free(GPIOD_8, "nimdetect"); + amlogic_gpio_free(GPIOAO_8, "nimdetect"); + amlogic_gpio_free(GPIOAO_9, "nimdetect"); ++#endif ++#ifdef CONFIG_ARM64 ++ devm_pinctrl_put(weteknims.ts[0].pinctrl); ++ reset_control_assert(dvb_uparsertop_reset_ctl); ++ reset_control_assert(dvb_ahbarb0_reset_ctl); ++ reset_control_assert(dvb_afifo_reset_ctl); ++ reset_control_assert(dvb_demux_reset_ctl); ++#else + nim_dvb_pinctrl_put(&weteknims); ++#endif + return 0; +} ++#ifndef CONFIG_ARM64 +static int wetekcard_probe(struct platform_device *pdev) +{ + if (pdev->dev.of_node) @@ -6179,6 +10929,7 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + devm_pinctrl_put(weteknims.card_pinctrl); + return 0; +} ++#endif +static const struct of_device_id nim_dvb_dt_match[] = { + { + .compatible = "amlogic,dvb", @@ -6194,7 +10945,7 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + .of_match_table = nim_dvb_dt_match, + } +}; -+ ++#ifndef CONFIG_ARM64 +static const struct of_device_id wetekcard_dt_match[]={ + { .compatible = "amlogic,smartcard", + }, @@ -6210,6 +10961,7 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + .of_match_table = wetekcard_dt_match, + } +}; ++#endif + +int __init nim_dvb_init(void) +{ @@ -6218,15 +10970,18 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect + memset(&weteknims, 0, sizeof(struct wetek_nims)); + + ret = platform_driver_register(&nim_dvb_detection); ++#ifndef CONFIG_ARM64 + if (!ret) + return platform_driver_register(&wetekcard_driver); -+ ++#endif + return ret; +} +void __exit nim_dvb_exit(void) +{ + platform_driver_unregister(&nim_dvb_detection); ++#ifndef CONFIG_ARM64 + platform_driver_unregister(&wetekcard_driver); ++#endif +} + +module_init(nim_dvb_init); @@ -6235,10 +10990,12 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.c b/drivers/amlogic/wetek/nimdetect +MODULE_DESCRIPTION("Wetek NIMs DVB detection"); +MODULE_AUTHOR("Sasa Savic "); +MODULE_LICENSE("GPL"); -diff -Naur a/drivers/amlogic/wetek/nimdetect.h b/drivers/amlogic/wetek/nimdetect.h ---- a/drivers/amlogic/wetek/nimdetect.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/drivers/amlogic/wetek/nimdetect.h 2015-01-26 21:27:14.000000000 +0100 -@@ -0,0 +1,50 @@ +diff --git a/drivers/amlogic/wetek/nimdetect.h b/drivers/amlogic/wetek/nimdetect.h +new file mode 100644 +index 0000000..ea38c82 +--- /dev/null ++++ b/drivers/amlogic/wetek/nimdetect.h +@@ -0,0 +1,54 @@ +/* + * Wetek NIM tuner(s) detection + * @@ -6283,16 +11040,21 @@ diff -Naur a/drivers/amlogic/wetek/nimdetect.h b/drivers/amlogic/wetek/nimdetect + struct platform_device *pdev; + struct pinctrl *card_pinctrl; + u32 total_nims; ++#ifdef CONFIG_ARM64 ++ int fec_reset; ++ int power_ctrl; ++#endif +}; + +void get_nims_infos(struct wetek_nims *p); +int set_external_vol_gpio(int *demod_id, int on); + +#endif /* __NIMDETECT_H */ -diff -Naur a/drivers/amlogic/wifi/wifi_dt.c b/drivers/amlogic/wifi/wifi_dt.c ---- a/drivers/amlogic/wifi/wifi_dt.c 2015-02-14 20:42:24.000000000 +0100 -+++ b/drivers/amlogic/wifi/wifi_dt.c 2015-02-14 20:24:00.000000000 +0100 -@@ -162,11 +162,48 @@ +diff --git a/drivers/amlogic/wifi/wifi_dt.c b/drivers/amlogic/wifi/wifi_dt.c +index f007063..2324580 100755 +--- a/drivers/amlogic/wifi/wifi_dt.c ++++ b/drivers/amlogic/wifi/wifi_dt.c +@@ -162,11 +162,48 @@ static struct platform_driver wifi_plat_driver = { .of_match_table = wifi_match }, }; @@ -6341,7 +11103,7 @@ diff -Naur a/drivers/amlogic/wifi/wifi_dt.c b/drivers/amlogic/wifi/wifi_dt.c return ret; } // module_init(wifi_dt_init); -@@ -175,6 +212,7 @@ +@@ -175,6 +212,7 @@ fs_initcall_sync(wifi_dt_init); static void __exit wifi_dt_exit(void) { platform_driver_unregister(&wifi_plat_driver); @@ -6349,7 +11111,7 @@ diff -Naur a/drivers/amlogic/wifi/wifi_dt.c b/drivers/amlogic/wifi/wifi_dt.c } module_exit(wifi_dt_exit); -@@ -247,6 +285,27 @@ +@@ -247,6 +285,27 @@ int wifi_setup_dt() SHOW_PIN_OWN("power_on_pin2", wifi_info.power_on_pin2); } @@ -6377,3 +11139,6 @@ diff -Naur a/drivers/amlogic/wifi/wifi_dt.c b/drivers/amlogic/wifi/wifi_dt.c return 0; } EXPORT_SYMBOL(wifi_setup_dt); +-- +2.7.4 + diff --git a/projects/WeTek_Play/patches/linux/020-meson6_emulate_poweroff.patch b/projects/WeTek_Play/patches/linux/020-meson6_emulate_poweroff.patch new file mode 100644 index 0000000000..df66e9ac7d --- /dev/null +++ b/projects/WeTek_Play/patches/linux/020-meson6_emulate_poweroff.patch @@ -0,0 +1,12 @@ +diff --git a/arch/arm/mach-meson6/pm.c b/arch/arm/mach-meson6/pm.c +index 45c0500968f..c5de8f8ca3e 100755 +--- a/arch/arm/mach-meson6/pm.c ++++ b/arch/arm/mach-meson6/pm.c +@@ -1143,6 +1143,7 @@ static struct platform_driver meson_pm_driver = { + static int __init meson_pm_init(void) + { + printk("enter %s\n",__func__); ++ pm_power_off = meson_pm_suspend; + return platform_driver_probe(&meson_pm_driver, meson_pm_probe); + } + late_initcall(meson_pm_init); diff --git a/projects/WeTek_Play/patches/linux/060-wetek-dvb-less-log-spam.patch b/projects/WeTek_Play/patches/linux/060-wetek-dvb-less-log-spam.patch deleted file mode 100644 index d3e00d1776..0000000000 --- a/projects/WeTek_Play/patches/linux/060-wetek-dvb-less-log-spam.patch +++ /dev/null @@ -1,175 +0,0 @@ -From 8b7d9e995c6af7ac0a5ae231afcf02790d99b671 Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Fri, 7 Aug 2015 15:03:23 +0300 -Subject: [PATCH] wetek/dvb: less log spam - ---- - drivers/amlogic/wetek/avl6211.c | 8 ++++---- - drivers/amlogic/wetek/cxd2837.c | 18 +++++++++--------- - drivers/amlogic/wetek/mn88436.c | 2 +- - drivers/amlogic/wetek/mxl603.c | 4 ++-- - 4 files changed, 16 insertions(+), 16 deletions(-) - -diff --git a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c -index 0bb0f23..74eb19f 100644 ---- a/drivers/amlogic/wetek/avl6211.c -+++ b/drivers/amlogic/wetek/avl6211.c -@@ -628,7 +628,7 @@ static int av2011_lock(struct dvb_frontend* fe) - BW = 40000; - BF = (BW * 127 + 21100/2) / 21100; - -- dev_info(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); -+ dev_dbg(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); - - reg[5] = (u8)BF; - -@@ -1578,7 +1578,7 @@ static int avl6211_set_frontend(struct dvb_frontend* fe) - - state->locked = 0; - -- dev_info(&state->i2c->dev, -+ dev_dbg(&state->i2c->dev, - "%s: delivery_system=%d frequency=%d symbol_rate=%d\n", - __func__, c->delivery_system, c->frequency, c->symbol_rate); - -@@ -1611,7 +1611,7 @@ static int avl6211_set_frontend(struct dvb_frontend* fe) - goto err; - } - -- dev_info(&state->i2c->dev, "Tuner successfully lock!\n"); -+ dev_dbg(&state->i2c->dev, "Tuner successfully lock!\n"); - - state->flags = (CI_FLAG_IQ_NO_SWAPPED) << CI_FLAG_IQ_BIT; //Normal IQ - state->flags |= (CI_FLAG_IQ_AUTO_BIT_AUTO) << CI_FLAG_IQ_AUTO_BIT; //Enable automatic IQ swap detection -@@ -1644,7 +1644,7 @@ static int avl6211_set_frontend(struct dvb_frontend* fe) - ret = -EAGAIN; - goto err; - } -- dev_info(&state->i2c->dev, "Service locked!!!\n"); -+ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); - - ret = avl6211_send_op(OP_RX_RESET_BERPER, state); - if (ret) -diff --git a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c -index 0638f38..33658d5 100644 ---- a/drivers/amlogic/wetek/cxd2837.c -+++ b/drivers/amlogic/wetek/cxd2837.c -@@ -795,7 +795,7 @@ static int set_parameters(struct dvb_frontend *fe) - fe_status_t status; - ret = read_status(fe, &status); - if (!ret && status == 0x1F) { -- dev_info(&state->i2c->dev, "Ignoring tuning to same freq, allready locked!\n"); -+ dev_dbg(&state->i2c->dev, "Ignoring tuning to same freq, allready locked!\n"); - return 0; - } - } -@@ -1056,7 +1056,7 @@ static int get_ber_t(struct cxd_state *state, u32 *ber) - unfreeze_regst(state); - - if (!(BERRegs[0] & 0x10)) { -- dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); - return 0; - } - -@@ -1093,7 +1093,7 @@ static int get_ber_t2(struct cxd_state *state, u32 *ber) - unfreeze_regst(state); - - if (!(BERRegs[0] & 0x10)) { -- dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); - return 0; - } - -@@ -1102,7 +1102,7 @@ static int get_ber_t2(struct cxd_state *state, u32 *ber) - n_ldpc = ((plp & 0x03) == 0 ? 16200 : 64800); - - if (bitError > ((1U << periodExp) * n_ldpc)) { -- dev_info(&state->i2c->dev, "%s: invalid BER value\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s: invalid BER value\n", __func__); - return -EINVAL; - } - -@@ -1142,7 +1142,7 @@ static int get_ber_c(struct cxd_state *state, u32 *ber) - - - if ((BERRegs[0] & 0x80) == 0) { -- dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); - return 0; - } - -@@ -1150,7 +1150,7 @@ static int get_ber_c(struct cxd_state *state, u32 *ber) - periodExp = (Scale & 0x1F); - - if ((periodExp <= 11) && (bitError > (1U << periodExp) * 204 * 8)) { -- dev_info(&state->i2c->dev, "%s: invalid BER value\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s: invalid BER value\n", __func__); - return -EINVAL; - } - -@@ -1223,7 +1223,7 @@ static void GetSignalToNoiseT2(struct cxd_state *state, int *SignalToNoise) - - reg = ((u32)Data[0] << 8) | (u32)Data[1]; - if (reg == 0) { -- dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); - return; - } - if (reg > 10876) -@@ -1245,7 +1245,7 @@ static void GetSignalToNoiseT(struct cxd_state *state, int *SignalToNoise) - - reg = ((u32)Data[0] << 8) | (u32)Data[1]; - if (reg == 0) { -- dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); - return; - } - if (reg > 4996) -@@ -1272,7 +1272,7 @@ static void GetSignalToNoiseC(struct cxd_state *state, int *SignalToNoise) - - reg = ((u32)(Data[0] & 0x1F) << 8) | ((u32)Data[1]); - if (reg == 0) { -- dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); -+ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); - return; - } - -diff --git a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c -index 7d49d44..2ee5990 100644 ---- a/drivers/amlogic/wetek/mn88436.c -+++ b/drivers/amlogic/wetek/mn88436.c -@@ -168,7 +168,7 @@ static int mn88436_set_frontend(struct dvb_frontend* fe) - goto err; - } - -- dev_info(&state->i2c->dev, "Service locked!!!\n"); -+ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); - - state->current_frequency = p->frequency; - state->current_modulation = p->modulation; -diff --git a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c -index 8f18fb5..2fb2ad3 100644 ---- a/drivers/amlogic/wetek/mxl603.c -+++ b/drivers/amlogic/wetek/mxl603.c -@@ -798,7 +798,7 @@ static int mxl603_get_status(struct dvb_frontend *fe, u32 *status) - if (ret) - goto err; - -- dev_info(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", -+ dev_dbg(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", - ref_locked ? "ref locked" : ""); - - if ((rf_locked) || (ref_locked)) -@@ -827,7 +827,7 @@ static int mxl603_set_params(struct dvb_frontend *fe) - int ret; - u32 freq = c->frequency; - -- dev_info(&state->i2c->dev, -+ dev_dbg(&state->i2c->dev, - "%s: delivery_system=%d frequency=%d bandwidth_hz=%d\n", - __func__, c->delivery_system, c->frequency, c->bandwidth_hz); - --- -1.7.10.4 - diff --git a/projects/WeTek_Play/patches/linux/070-linux-010_tivo_slide_pro.patch b/projects/WeTek_Play/patches/linux/070-linux-010_tivo_slide_pro.patch deleted file mode 100644 index 4fea696523..0000000000 --- a/projects/WeTek_Play/patches/linux/070-linux-010_tivo_slide_pro.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 716d6bc9f73bd366d4b64b473055af79810d67fc Mon Sep 17 00:00:00 2001 -From: Forest -Date: Thu, 12 Mar 2015 23:43:12 -0700 -Subject: [PATCH] hid: enable all buttons on the TiVo Slide Pro remote - -The linux kernel has supported the TiVo Slide remote control for some time, -but does not recognize the USB ID of the newer Slide Pro. This patch adds -the missing data structures so the newer remote will be recognized by the -driver, thereby allowing the TiVo, LiveTV, and Thumbs Up/Down buttons to be -mapped with a hwdb file. - -Signed-off-by: Forest ---- - drivers/hid/hid-core.c | 1 + - drivers/hid/hid-ids.h | 1 + - drivers/hid/hid-tivo.c | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index 1d0f2b6..722a925 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1980,6 +1980,7 @@ static const struct hid_device_id hid_have_special_driver[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 2dd6485..c739d3b 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -900,6 +900,7 @@ - #define USB_VENDOR_ID_TIVO 0x150a - #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 - #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 -+#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 - - #define USB_VENDOR_ID_TOPSEED 0x0766 - #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 -diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c -index d790d8d..d986969 100644 ---- a/drivers/hid/hid-tivo.c -+++ b/drivers/hid/hid-tivo.c -@@ -64,6 +64,7 @@ static const struct hid_device_id tivo_devices[] = { - /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, - { } - }; - MODULE_DEVICE_TABLE(hid, tivo_devices); --- -1.9.1 - diff --git a/projects/WeTek_Play_2/bootloader/release b/projects/WeTek_Play_2/bootloader/release deleted file mode 100755 index 28c339b330..0000000000 --- a/projects/WeTek_Play_2/bootloader/release +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -. config/options $1 - -mkdir -p $RELEASE_DIR/3rdparty/bootloader -cp $INSTALL/usr/share/bootloader/dtb.img $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/WeTek_Play_2/filesystem/etc/amremote/remote.conf b/projects/WeTek_Play_2/filesystem/etc/amremote/remote.conf deleted file mode 100644 index a7b4b591d9..0000000000 --- a/projects/WeTek_Play_2/filesystem/etc/amremote/remote.conf +++ /dev/null @@ -1,140 +0,0 @@ -#********************************************************************************************************* -#this file is configuration for each factory remote device -# work_mode 0 :software mode 1 :hardware mode -# repeat_enable 0 :disable repeat 1 :enable repeat -# -# factory_code each device has it's unique factory code. -# pattern:custom_code(16bit)+index_code(16bit) -# examble: 0xff000001 = 0xff00(custom cod) 0001 (index) -# -# release_delay unit:ms.release will report from kernel to user layer after this period of time -# from press or repeat triggered. -# -# debug_enable 0 :debug disable 1 :debug disable -# -# SW MODE: -# bit_count how many bits in each frame -# tw_leader_act time window for leader active -# tw_bit0 time window for bit0 time. -# tw_bit1 time window for bit1 time -# tw_repeat_leader time window for repeat leader -# REG -# reg_base_gen set value for PREG_IR_DEC_BASE_GEN -# reg_control set value for PREG_IR_DEC_CONTROL -# reg_leader_act set value for PREG_IR_DEC_LEADER_ACTIVE -# reg_leader_idle set value for PREG_IR_DEC_LEADER_IDLE -# reg_repeat_leader set value for PREG_IR_DEC_REPEAT_IDLE -# reg_bit0_time set value for PREG_IR_DEC_BIT0_TIME -#************************************************************************************************************* -#amlogic NEC remote -factory_code = 0x5f5e0001 -work_mode = 0 -repeat_enable = 1 -repeat_delay = 40 -repeat_peroid = 39 -release_delay = 121 -debug_enable = 1 - -fn_key_scancode = 0x84 -up_key_scancode = 0x50 -down_key_scancode = 0x4b -left_key_scancode = 0x4c -right_key_scancode = 0x4d -ok_key_scancode = 0x47 - -mouse_begin - 0 0x4c - 1 0x4d - 2 0x50 - 3 0x4b -mouse_end - -key_begin - 0x02 116 # power - 0x46 88 # 2nd power button (F12, ends WeTV) - 0x10 113 # volume mute - 0x22 2 # 1 - 0x23 3 # 2 - 0x24 4 # 3 - 0x25 5 # 4 - 0x26 6 # 5 - 0x27 7 # 6 - 0x28 8 # 7 - 0x29 9 # 8 - 0x30 10 # 9 - 0x71 14 # delete - 0x21 11 # 0 - 0x72 87 # capslock (mapped as F11) - 0x48 127 # menu - 0x03 102 # home - 0x61 158 # back - 0x83 580 # app_switch - 0x77 373 # assist - 0x50 103 # up - 0x4b 108 # down - 0x4c 105 # left - 0x4d 106 # right - 0x47 28 # ok - 0x44 115 # volume up - 0x43 114 # volume down - 0x41 402 # channel up - 0x42 403 # channel down - 0x4f 64 # * (mapped as f6) - 0x82 388 # teletext - 0x73 398 # red - 0x74 399 # green - 0x75 400 # yellow - 0x76 401 # blue - 0x67 165 # previous - 0x79 168 # rewind - 0x80 208 # fast fprward - 0x81 163 # next - 0x04 167 # record - 0x2c 164 # play/pause - 0x2b 166 # stop -key_end - -repeat_key_begin - 0x02 116 # power - 0x46 88 # 2nd power button (F12, ends WeTV) - 0x10 113 # volume mute - 0x22 2 # 1 - 0x23 3 # 2 - 0x24 4 # 3 - 0x25 5 # 4 - 0x26 6 # 5 - 0x27 7 # 6 - 0x28 8 # 7 - 0x29 9 # 8 - 0x30 10 # 9 - 0x71 14 # delete - 0x21 11 # 0 - 0x72 58 # caps lock - 0x48 127 # menu - 0x03 102 # home - 0x61 158 # back - 0x83 580 # app_switch - 0x77 373 # assist - 0x50 103 # up - 0x4b 108 # down - 0x4c 105 # left - 0x4d 106 # right - 0x47 353 # ok - 0x44 115 # volume up - 0x43 114 # volume down - 0x41 402 # channel up - 0x42 403 # channel down - 0x4f 64 # * (mapped as f6) - 0x82 388 # teletext - 0x73 398 # red - 0x74 399 # green - 0x75 400 # yellow - 0x76 401 # blue - 0x67 165 # previous - 0x79 168 # rewind - 0x80 208 # fast fprward - 0x81 163 # next - 0x04 167 # record - 0x2c 164 # play/pause - 0x2b 166 # stop -repeat_key_end diff --git a/projects/WeTek_Play_2/filesystem/usr/lib/systemd/system/serial-console.service b/projects/WeTek_Play_2/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index e267da5aa6..0000000000 --- a/projects/WeTek_Play_2/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,21 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/ttyS0 -DefaultDependencies=no -ConditionKernelCommandLine=console=ttyS0,115200 - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/ttyS0 -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/WeTek_Play_2/filesystem/usr/share/bootloader/update.sh b/projects/WeTek_Play_2/filesystem/usr/share/bootloader/update.sh deleted file mode 100755 index 81ce46dcd5..0000000000 --- a/projects/WeTek_Play_2/filesystem/usr/share/bootloader/update.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" -[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" - -IMAGE_KERNEL="/flash/kernel.img" - -# parse command line arguments -for arg in $(cat /proc/cmdline); do - case $arg in - BOOT_IMAGE=*) - IMAGE_KERNEL="${arg#*=}" - ;; - esac -done - - -# mount $BOOT_ROOT r/w - mount -o remount,rw $BOOT_ROOT - -if [ -b $IMAGE_KERNEL ]; then - dd if="$SYSTEM_ROOT/usr/share/bootloader/dtb.img" of="/dev/dtb" bs=262144 2>&1 -else - cp -p $SYSTEM_ROOT/usr/share/bootloader/dtb.img $BOOT_ROOT -fi - -# mount $BOOT_ROOT r/o - sync - mount -o remount,ro $BOOT_ROOT diff --git a/projects/WeTek_Play_2/initramfs/platform_init b/projects/WeTek_Play_2/initramfs/platform_init deleted file mode 100755 index 371399ffa6..0000000000 --- a/projects/WeTek_Play_2/initramfs/platform_init +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 Team LibreELEC -# -# LibreELEC 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. -# -# LibreELEC 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. -# -# You should have received a copy of the GNU General Public License -# along with LibreELEC. If not, see . -################################################################################ - -hdmimode=1080p60hz - -# Parse command line arguments -for arg in $(cat /proc/cmdline); do - case $arg in - hdmimode=*) - hdmimode="${arg#*=}" - ;; - esac -done - -# Enable first framebuffer -echo 0 > /sys/class/graphics/fb0/blank - -# Disable second framebuffer -echo 1 > /sys/class/graphics/fb1/blank - -# Disable framebuffer scaling -echo 0 > /sys/class/graphics/fb0/free_scale -echo 0 > /sys/class/graphics/fb1/free_scale - -# set initial video state -echo 1 > /sys/class/video/disable_video - -# Set framebuffer geometry to match the resolution -case $hdmimode in - 480*) X=720 Y=480 ;; - 576*) X=720 Y=576 ;; - 720p*) X=1280 Y=720 ;; - *) X=1920 Y=1080 ;; -esac - -fbset -fb /dev/fb0 -g $X $Y 1920 2160 32 -fbset -fb /dev/fb1 -g 32 32 32 32 32 - -# Enable scaling for 4K output -case $hdmimode in - 4k*|smpte*|2160*) - echo 0 0 1919 1079 > /sys/class/graphics/fb0/free_scale_axis - echo 0 0 3839 2159 > /sys/class/graphics/fb0/window_axis - echo 1920 > /sys/class/graphics/fb0/scale_width - echo 1080 > /sys/class/graphics/fb0/scale_height - echo 0x10001 > /sys/class/graphics/fb0/free_scale - ;; -esac - -# Include deinterlacer into default VFM map -echo rm default > /sys/class/vfm/map -echo add default decoder ppmgr deinterlace amvideo > /sys/class/vfm/map diff --git a/projects/WeTek_Play_2/install/updater-script b/projects/WeTek_Play_2/install/updater-script deleted file mode 100644 index 06848b2499..0000000000 --- a/projects/WeTek_Play_2/install/updater-script +++ /dev/null @@ -1,36 +0,0 @@ -show_progress(0.500000, 3); -set_bootloader_env("upgrade_step", "3"); - -ui_print("Wiping Userdata"); -format("ext4", "EMMC", "/dev/block/data", "0", "/data"); - -ui_print("Writing kernel image"); -assert(package_extract_file("KERNEL", "/tmp/boot.img"), - write_raw_image("/tmp/boot.img", "boot"), - delete("/tmp/boot.img")); - -ui_print("Writing device tree image"); -write_dtb_image(package_extract_file("dtb.img")); - -show_progress(0.020000, 0); - -ui_print("Wiping System"); -format("ext4", "EMMC", "/dev/block/system", "0", "/system"); -mount("ext4", "EMMC", "/dev/block/system", "/system"); -ui_print("Writing system files"); -package_extract_dir("system", "/system"); -unmount("/system"); - -show_progress(0.300000, 60); - -ui_print("Writing recovery"); -write_raw_image(package_extract_file("recovery.img"), "recovery"); - -show_progress(0.018000, 0); - -ui_print("Writing bootloader"); -write_raw_image(package_extract_file("bootloader.img"), "bootloader"); - -set_bootloader_env("upgrade_step", "1"); -show_progress(0.100000, 0); -ui_print("LibreELEC Installed Successfully"); diff --git a/projects/WeTek_Play_2/kodi/advancedsettings.xml b/projects/WeTek_Play_2/kodi/advancedsettings.xml deleted file mode 100644 index bcca951759..0000000000 --- a/projects/WeTek_Play_2/kodi/advancedsettings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - false - - - 30 - - diff --git a/projects/WeTek_Play_2/linux/linux.aarch64.conf b/projects/WeTek_Play_2/linux/linux.aarch64.conf deleted file mode 100644 index f49419b859..0000000000 --- a/projects/WeTek_Play_2/linux/linux.aarch64.conf +++ /dev/null @@ -1,3856 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm64 3.14.29 Kernel Configuration -# -CONFIG_ARM64=y -CONFIG_ARM64_HAS_SG_CHAIN=y -CONFIG_64BIT=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_NO_IOPORT=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -CONFIG_KERNEL_MODE_NEON=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_FHANDLE=y -# CONFIG_AUDIT is not set - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_SPARSE_IRQ=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_PREEMPT_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_RCU_USER_QS is not set -CONFIG_RCU_FANOUT=32 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FANOUT_EXACT is not set -# CONFIG_RCU_FAST_NO_HZ is not set -CONFIG_TREE_RCU_TRACE=y -# CONFIG_RCU_NOCB_CPU is not set -CONFIG_IKCONFIG=m -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_RESOURCE_COUNTERS=y -CONFIG_MEMCG=y -CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_MEMCG_KMEM=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -# CONFIG_CFS_BANDWIDTH is not set -# CONFIG_RT_GROUP_SCHED is not set -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -CONFIG_MM_OWNER=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_LZ4 is not set -CONFIG_INITRAMFS_COMPRESSION_NONE=y -# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_EXPERT=y -CONFIG_UID16=y -CONFIG_SYSCTL_SYSCALL=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -# CONFIG_AIO is not set -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -# CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_PROFILING is not set -CONFIG_JUMP_LABEL=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -CONFIG_STOP_MACHINE=y -CONFIG_BLOCK=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -CONFIG_BLK_DEV_THROTTLING=y -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -CONFIG_BLOCK_COMPAT=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -# CONFIG_DEFAULT_DEADLINE is not set -# CONFIG_DEFAULT_CFQ is not set -CONFIG_DEFAULT_NOOP=y -CONFIG_DEFAULT_IOSCHED="noop" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# Platform selection -# -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_MESON64_ODROIDC2 is not set - -# -# Bus support -# -CONFIG_ARM_AMBA=y - -# -# ARM errata workarounds via the alternatives framework -# -CONFIG_ARM64_ERRATUM_845719=y -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_ERRATUM_835769=y - -# -# Kernel Features -# -# CONFIG_ARM64_64K_PAGES is not set -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_SMP=y -CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set -# CONFIG_DISABLE_CPU_SCHED_DOMAIN_BALANCE is not set -CONFIG_SCHED_HMP=y -# CONFIG_SCHED_HMP_PRIO_FILTER is not set -CONFIG_HMP_FAST_CPU_MASK="" -CONFIG_HMP_SLOW_CPU_MASK="" -# CONFIG_HMP_VARIABLE_SCALE is not set -# CONFIG_SCHED_HMP_LITTLE_PACKING is not set -CONFIG_NR_CPUS=4 -CONFIG_HOTPLUG_CPU=y -CONFIG_SWP_EMULATE=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -CONFIG_HZ=100 -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_ARMV7_COMPAT=y -CONFIG_ARMV7_COMPAT_CPUINFO=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_ZONE_DMA_FLAG=0 -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 -# CONFIG_TRANSPARENT_HUGEPAGE is not set -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CLEANCACHE=y -CONFIG_FRONTSWAP=y -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZBUD is not set -# CONFIG_ZSWAP is not set -CONFIG_ZSMALLOC=y -# CONFIG_PGTABLE_MAPPING is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -# CONFIG_XEN is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -# CONFIG_SECCOMP is not set - -# -# Boot options -# -CONFIG_CMDLINE="" -# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_COREDUMP=y -CONFIG_COMPAT=y -CONFIG_SYSVIPC_COMPAT=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_HAS_WAKELOCK=y -CONFIG_HAS_EARLYSUSPEND=y -CONFIG_WAKELOCK=y -CONFIG_WAKELOCK_STAT=y -CONFIG_USER_WAKELOCK=y -CONFIG_EARLYSUSPEND=y -CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL=y -# CONFIG_CONSOLE_EARLYSUSPEND is not set -# CONFIG_FB_EARLYSUSPEND is not set -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -CONFIG_PM_RUNTIME=y -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -CONFIG_ARCH_HAS_OPP=y -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_CPU_PM=y -# CONFIG_SUSPEND_TIME is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_HOTPLUG=y -CONFIG_CPU_FREQ_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -# CONFIG_GENERIC_CPUFREQ_CPU0 is not set - -# -# ARM CPU frequency scaling drivers -# -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARM64_CPU_SUSPEND=y - -# -# CPU Power Management -# - -# -# CPU Idle -# -# CONFIG_CPU_IDLE is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_GRE is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_ANDROID_PARANOID_NETWORK is not set -# CONFIG_NET_ACTIVITY_STATS is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=y - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA2 is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -CONFIG_NF_NAT_IPV4=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_IP_NF_MANGLE is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RT is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -# CONFIG_IP6_NF_MANGLE is not set -# CONFIG_IP6_NF_RAW is not set -CONFIG_NF_NAT_IPV6=m -# CONFIG_IP6_NF_TARGET_MASQUERADE is not set -# CONFIG_IP6_NF_TARGET_NPT is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_IEEE802154 is not set -CONFIG_6LOWPAN_IPHC=m -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_HSR is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -CONFIG_CGROUP_NET_PRIO=y -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTSDIO=m -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_LL=y -# CONFIG_BT_HCIUART_3WIRE is not set -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -# CONFIG_BT_HCIVHCI is not set -CONFIG_BT_MRVL=m -CONFIG_BT_MRVL_SDIO=m -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -# CONFIG_MAC80211_RC_PID is not set -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -# CONFIG_WIMAX is not set -CONFIG_RFKILL=y -CONFIG_RFKILL_PM=y -CONFIG_RFKILL_LEDS=y -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set - -# -# Device Drivers -# - -# -# Amlogic Device Drivers -# -CONFIG_MESON_TIMER=y -# CONFIG_MESON_LOCAL_TIMER is not set -CONFIG_MESON_BC_TIMER=y -CONFIG_AM_UART=y -CONFIG_SERIAL_MESON_CONSOLE=y -# CONFIG_PRINTK_NOBLOCK_MODE is not set -CONFIG_AML_CPU_VERSION=y -CONFIG_AML_MESON64_VERSION=y -# CONFIG_AML_M8_VERSION is not set -CONFIG_AMLOGIC_IOMAP=y -CONFIG_PINCTRL_AMLOGIC=y - -# -# USB Support -# -CONFIG_AMLOGIC_USB=y -CONFIG_USB_DWC_OTG_HCD=y -CONFIG_USB_HOST_ELECT_TEST=y - -# -# I2C Hardware Bus support -# -CONFIG_I2C_AML=y -# CONFIG_I2C_SLAVE_AML is not set -# CONFIG_I2C_SW_AML is not set -# CONFIG_BCM2079X_I2C is not set -# CONFIG_AML_PWM is not set - -# -# HDMI TX Support -# -CONFIG_AML_HDMI_TX=y -CONFIG_AML_HDMI_TX_20=y -# CONFIG_AML_HDMI_TX_14 is not set -# CONFIG_AML_RTC is not set -CONFIG_AML_VRTC=y -# CONFIG_AM_IRBLASTER is not set -# CONFIG_AML_DEBUG is not set -CONFIG_AML_REG_ACCESS=y - -# -# Power Management Support -# -# CONFIG_AML_POWER_SUPPORT is not set -# CONFIG_AML_PMU_ALGORITHM_SUPPORT is not set -# CONFIG_AML_PMU4 is not set - -# -# Ethernet Support -# -# CONFIG_AM_PHY is not set -CONFIG_PHYLIB=y - -# -# MMC/SD/SDIO Host Controller Drivers -# - -# -# Multimedia Card support -# -CONFIG_MMC_AML=y -# CONFIG_MMC_AML_DEBUG is not set -# CONFIG_AML_MMC_DEBUG_FORCE_SINGLE_BLOCK_RW is not set - -# -# Amlogic VPU Drivers -# - -# -# Amlogic VPU Driver -# -CONFIG_AML_VPU=y -# CONFIG_AML_VPU_DYNAMIC_ADJ is not set - -# -# ION support -# -CONFIG_AMLOGIC_ION=y - -# -# Amlogic Display Driver -# -CONFIG_AML_DISPLAY=y - -# -# Amlogic VOUT Module -# -CONFIG_AM_VOUT=y -CONFIG_AM_TV_OUTPUT=y -CONFIG_AML_VOUT_FRAMERATE_AUTOMATION=y -# CONFIG_AML_VDAC_HW_SWITCH is not set - -# -# Amlogic OSD Module -# -CONFIG_AM_FB=y -# CONFIG_FB_OSD_SUPPORT_SYNC_FENCE is not set -CONFIG_FB_OSD_VSYNC_RDMA=y -CONFIG_FB_OSD2_ENABLE=y -# CONFIG_FB_OSD2_CURSOR is not set - -# -# Amlogic VOUT2 Module -# -# CONFIG_AM_VOUT2 is not set -# CONFIG_AM_TV_OUTPUT2 is not set - -# -# Amlogic OSD_EXT Module -# -# CONFIG_AM_FB_EXT is not set -CONFIG_AM_GE2D=y -CONFIG_AM_LOGO=y - -# -# Amlogic LCD Output Module -# -# CONFIG_AML_LCD is not set - -# -# Amlogic Backlight Support -# -# CONFIG_AML_BACKLIGHT is not set -# CONFIG_AMLOGIC_LED is not set - -# -# Canvas management driver -# -CONFIG_AML_CANVAS=y -CONFIG_AMLOGIC_CLK=y -CONFIG_AMLOGIC_SEC=y -# CONFIG_AML_SERR is not set -CONFIG_AMLOGIC_SECURITY_KEY=y -CONFIG_AM_PTSSERVER=y -# CONFIG_H264_4K2K_SINGLE_CORE is not set -CONFIG_VSYNC_RDMA=y -# CONFIG_TVIN_VIUIN is not set -CONFIG_AM_VIDEO=y -# CONFIG_AM_VIDEO2 is not set -# CONFIG_SUPPORT_VIDEO_ON_VPP2 is not set -CONFIG_GE2D_KEEP_FRAME=y - -# -# Video Decoders -# -CONFIG_AM_VDEC_MPEG12=y -CONFIG_AM_VDEC_MPEG4=y -CONFIG_AM_VDEC_VC1=y -CONFIG_AM_VDEC_H264=y -CONFIG_AM_VDEC_H264MVC=y -CONFIG_AM_VDEC_H264_4K2K=y -CONFIG_AM_VDEC_H265=y -CONFIG_AM_VDEC_VP9=y -CONFIG_AM_VDEC_MJPEG=y -CONFIG_AM_ENCODER=y -CONFIG_AM_JPEG_ENCODER=y -CONFIG_AM_PIC_DEC=y -CONFIG_AM_VDEC_REAL=y -CONFIG_AM_VDEC_AVS=y -# CONFIG_AM_JPEGDEC is not set -CONFIG_AM_TIMESYNC=y -CONFIG_AM_STREAMING=y -CONFIG_AM_SUBTITLE=y -CONFIG_AM_VIDEOCAPTURE=y -# CONFIG_AM_HEVCENC is not set - -# -# Deinterlace driver -# -CONFIG_DEINTERLACE=y -# CONFIG_AM_DEINTERLACE_SD_ONLY is not set -CONFIG_AML_VFM=y - -# -# EFUSE Support -# -CONFIG_EFUSE=y -# CONFIG_EFUSE_WRITE_VERSION_PERMIT is not set - -# -# key management Support -# -CONFIG_KEY_MANAGE=y - -# -# Audio Interface -# -CONFIG_AMAUDIO=y - -# -# Amlogic Audio Interface V2 -# -# CONFIG_AMAUDIO2 is not set - -# -# Audio dsp process -# -CONFIG_AML_AUDIO_DSP=y - -# -# Post Process Manager driver -# -CONFIG_POST_PROCESS_MANAGER=y -CONFIG_POST_PROCESS_MANAGER_PPSCALER=y -CONFIG_POST_PROCESS_MANAGER_3D_PROCESS=y - -# -# Amlogic Wifi Driver -# -CONFIG_AM_WIFI=y -# CONFIG_BCMDHD_USE_STATIC_BUF is not set -CONFIG_AML_POWER_RESET=y -# CONFIG_M8_POWER_RESET is not set -CONFIG_GXBB_POWER_RESET=y - -# -# Amlogic Bt Rfkill Driver -# -CONFIG_BT_DEVICE=y -# CONFIG_BLUESLEEP is not set - -# -# Amlogic ion video support -# -# CONFIG_VIDEOBUF2_ION is not set -# CONFIG_AMLOGIC_IONVIDEO is not set - -# -# V4L2 Video Support -# -CONFIG_V4L_AMLOGIC_VIDEO=y -# CONFIG_V4L_AMLOGIC_VIDEO2 is not set - -# -# Amlogic TVIN Drivers -# -CONFIG_TVIN=y -# CONFIG_TVIN_VDIN is not set -# CONFIG_TVIN_AFE is not set -CONFIG_TVIN_HDMI=y -# CONFIG_TVIN_HDMI_CEC is not set -# CONFIG_TVIN_BT656 is not set -# CONFIG_VIUIN is not set -# CONFIG_TVIN_ISP is not set - -# -# Amlogic VECM Drivers -# - -# -# Amlogic amvecm Driver -# -# CONFIG_AM_VECM is not set -# CONFIG_AML_NAND is not set -CONFIG_AM_INPUT=y -CONFIG_AM_SARADC=y -CONFIG_MESON_NEW_INPUT_REMOTE=y -CONFIG_NEW_AM_REMOTE=y -CONFIG_MESON_INPUT_KEYBOARD=y -# CONFIG_ADC_KEYPADS_AM is not set -CONFIG_AML_GPIO_KEY=y -# CONFIG_SENSOR_DEVICES is not set -# CONFIG_AMLOGIC_AVIN_DETECT is not set -# CONFIG_AMLOGIC_MESON_CPUFREQ is not set -CONFIG_AMLOGIC_SCPI_CPUFREQ=y -CONFIG_MESON_SUSPEND=y -# CONFIG_M8M2_SUSPEND is not set -CONFIG_GXBB_SUSPEND=y - -# -# WetekPlay driver -# -CONFIG_AM_DVB=y - -# -# MESON MHU mailbox Support -# -CONFIG_MESON_MHU_MBOX=y -CONFIG_ARM_SCPI_PROTOCOL=y - -# -# RDMA management driver -# -CONFIG_AML_RDMA=y - -# -# Amlogic temperature sensor -# -CONFIG_AML_TEMP_SENSOR=y -# CONFIG_AUDIO_DATA is not set -# CONFIG_INSTABOOT is not set - -# -# Amlogic Camera Support -# -# CONFIG_VIDEO_AMLOGIC_CAPTURE is not set -CONFIG_AML_CODEC_MM=y -# CONFIG_AML_WDT is not set - -# -# AMLOGIC SPI Hardware bus support -# -# CONFIG_AMLOGIC_SPICC_MASTER is not set -# CONFIG_AMLOGIC_JTAG is not set -CONFIG_AMLOGIC_CPU_INFO=y - -# -# defend img file update support -# -# CONFIG_DEFEND_IMG is not set - -# -# AO CEC Support -# -CONFIG_AML_AO_CEC=y - -# -# Amlogic Crypto Support -# -# CONFIG_CRYPTO_AML is not set - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER_PATH="/sbin/mdev" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -CONFIG_FW_LOADER_USER_HELPER=y -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_HAVE_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=8 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -# CONFIG_CONNECTOR is not set -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set - -# -# RAM/ROM/Flash chip drivers -# -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_M25P80 is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_IDS=y -CONFIG_MTD_NAND_ECC=y -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND=y -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR flash memory drivers -# -# CONFIG_MTD_LPDDR is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_DTC=y -CONFIG_OF=y - -# -# Device Tree and Open Firmware support -# -CONFIG_PROC_DEVICETREE=y -# CONFIG_OF_SELFTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_MTD=y -CONFIG_OF_RESERVED_MEM=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -CONFIG_ZRAM=y -# CONFIG_ZRAM_DEBUG is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -CONFIG_VIRTIO_BLK=y -# CONFIG_BLK_DEV_RBD is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_UID_STAT is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_HAVE_PATA_PLATFORM=y -# CONFIG_ATA is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_TEAM is not set -CONFIG_MACVLAN=m -# CONFIG_MACVTAP is not set -CONFIG_VXLAN=m -CONFIG_NETCONSOLE=y -# CONFIG_NETCONSOLE_DYNAMIC is not set -CONFIG_NETPOLL=y -# CONFIG_NETPOLL_TRAP is not set -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -CONFIG_VETH=m -# CONFIG_VIRTIO_NET is not set -# CONFIG_NLMON is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_ARC=y -# CONFIG_ARC_EMAC is not set -# CONFIG_NET_CADENCE is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_CALXEDA_XGMAC is not set -# CONFIG_DNET is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_ETHOC is not set -# CONFIG_SH_ETH is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_STMMAC_ETH=y -CONFIG_STMMAC_PLATFORM=y -CONFIG_DWMAC_MESON=y -CONFIG_STMMAC_DEBUG_FS=y -CONFIG_STMMAC_DA=y -CONFIG_NET_VENDOR_VIA=y -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set - -# -# MII PHY device drivers -# -# CONFIG_AMLOGIC_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_AMD_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_FIXED_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPPOLAC=y -CONFIG_PPPOPNS=y -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=y - -# -# USB Network Adapters -# -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=m -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=y -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -CONFIG_WLAN=y -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_AT76C50X_USB is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_WIFI_CONTROL_FUNC is not set -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_WOW is not set -# CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set -# CONFIG_ATH9K_RFKILL is not set -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -CONFIG_CARL9170_HWRNG=y -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -CONFIG_AR5523=m -# CONFIG_ATH10K is not set -# CONFIG_WCN36XX is not set -CONFIG_B43=m -CONFIG_B43_SSB=y -# CONFIG_B43_SDIO is not set -CONFIG_B43_PIO=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -# CONFIG_BRCMFMAC_SDIO is not set -CONFIG_BRCMFMAC_USB=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -# CONFIG_HOSTAP is not set -# CONFIG_LIBERTAS is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -# CONFIG_P54_SPI is not set -CONFIG_P54_LEDS=y -CONFIG_RT2X00=m -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -# CONFIG_RT2800USB_RT3573 is not set -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_RTL_CARDS=m -# CONFIG_RTL8192CU is not set -# CONFIG_WL_TI is not set -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_KEYRESET is not set -# CONFIG_INPUT_KEYCOMBO is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYCHORD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_GPIO is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -CONFIG_DEVKMEM=y - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SUPPORT_SYSRQ is not set -CONFIG_TTY_PRINTK=y -# CONFIG_VIRTIO_CONSOLE is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=m -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_ATMEL is not set -CONFIG_HW_RANDOM_MESON=m -# CONFIG_HW_RANDOM_VIRTIO is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_R3964 is not set - -# -# PCMCIA character devices -# -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -CONFIG_I2C_GPIO=y -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_CAPRI is not set -# CONFIG_PINCTRL_MSM8X74 is not set -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_GPIO_SYSFS is not set - -# -# Memory mapped GPIO drivers: -# -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_GRGPIO is not set - -# -# I2C GPIO expanders: -# -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set - -# -# PCI GPIO expanders: -# - -# -# SPI GPIO expanders: -# -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_74X164 is not set - -# -# AC97 GPIO expanders: -# - -# -# LPC GPIO expanders: -# - -# -# MODULbus GPIO expanders: -# -# CONFIG_GPIO_BCM_KONA is not set - -# -# USB GPIO expanders: -# -# CONFIG_W1 is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27x00 is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_SMB347 is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_GPIO is not set -CONFIG_POWER_RESET_VEXPRESS=y -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_AVS is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_USER_SPACE is not set -CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y -CONFIG_CPU_THERMAL=y -# CONFIG_DEVFREQ_THERMAL is not set -CONFIG_CPUCORE_THERMAL=y -CONFIG_GPU_THERMAL=y -CONFIG_GPUCORE_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set - -# -# Texas Instruments thermal drivers -# -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -CONFIG_VEXPRESS_CONFIG=y -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_REGULATOR_VEXPRESS is not set -CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_RESOURCE=y -CONFIG_VIDEOBUF_DVB=m -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=y -CONFIG_RC_MAP=m -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_RC5_SZ_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_MESON=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -# CONFIG_VIDEO_USBTV is not set - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_TLG2300 is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_STK1160_COMMON is not set - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -CONFIG_DVB_USB_GL861=m -CONFIG_DVB_USB_IT913X=m -CONFIG_DVB_USB_LME2510=m -CONFIG_DVB_USB_MXL111SF=m -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -# CONFIG_VIDEO_EM28XX_V4L2 is not set -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -# CONFIG_V4L_PLATFORM_DRIVERS is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m -# CONFIG_RADIO_ADAPTERS is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=y - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=y -CONFIG_MEDIA_TUNER_SIMPLE=y -CONFIG_MEDIA_TUNER_TDA8290=y -CONFIG_MEDIA_TUNER_TDA827X=y -CONFIG_MEDIA_TUNER_TDA18271=y -CONFIG_MEDIA_TUNER_TDA9887=y -CONFIG_MEDIA_TUNER_TEA5761=y -CONFIG_MEDIA_TUNER_TEA5767=y -CONFIG_MEDIA_TUNER_MT20XX=y -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=y -CONFIG_MEDIA_TUNER_XC5000=y -CONFIG_MEDIA_TUNER_XC4000=y -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=y -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88TS2022=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LG2160=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_IT913X_FE=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -# CONFIG_DRM is not set -# CONFIG_VGASTATE is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -CONFIG_VEXPRESS_DVI_CONTROL=y -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_EXYNOS_VIDEO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=y -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_ADF is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -# CONFIG_FB_SSD1307 is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_HRTIMER=m -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_VERBOSE_PROCFS is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -# CONFIG_SND_DRIVERS is not set -# CONFIG_SND_SPI is not set -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_6FIRE=m -# CONFIG_SND_USB_HIFACE is not set -CONFIG_SND_SOC=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_AML_M8_SOC=y -CONFIG_SND_AML_M8=y -CONFIG_SND_AML_SPLIT_MODE=y -# CONFIG_SND_AML_SPLIT_MODE_MMAP is not set -CONFIG_SND_SOC_I2C_AND_SPI=y -CONFIG_SND_SOC_DUMMY_CODEC=y -CONFIG_SND_SOC_TAS5707=y -CONFIG_SND_SOC_TAS5717=y -CONFIG_SND_SOC_TAS5731=y -CONFIG_SND_SOC_PCM2BT=y -CONFIG_SND_SOC_AMLT9015=y -CONFIG_SND_SOC_AMLT9015S=y -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SOUND_PRIME is not set - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -# CONFIG_UHID is not set -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_DIA_REMOTE is not set -# CONFIG_HID_PRODIKEYS is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_HUION is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -CONFIG_HID_LENOVO_TPKBD=m -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PETALYNX=y -CONFIG_HID_PICOLCD=m -CONFIG_HID_PICOLCD_FB=y -CONFIG_HID_PICOLCD_BACKLIGHT=y -CONFIG_HID_PICOLCD_LCD=y -CONFIG_HID_PICOLCD_LEDS=y -# CONFIG_HID_PICOLCD_CIR is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -# CONFIG_SONY_FF is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SUNPLUS=y -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_EHCI_HCD is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FUSBH200_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_RENESAS_USBHS is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_CHIPIDEA is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=y -CONFIG_USB_SERIAL_CONSOLE=y -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=m -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=m -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -CONFIG_USB_SERIAL_IUU=m -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=y -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_ZTE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WAKELOCK is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_ULPI is not set -# CONFIG_AMLOGIC_USBPHY is not set -# CONFIG_AMLOGIC_USB2PHY is not set -# CONFIG_AMLOGIC_USB3PHY is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=2 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_AUDIO is not set -# CONFIG_USB_ETH is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_PXP_MMC=y -CONFIG_MMC_UNSAFE_RESUME=y -# CONFIG_MMC_CLKGATE is not set -# CONFIG_MMC_EMBEDDED_SDIO is not set -# CONFIG_MMC_PARANOID_SD_INIT is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_ARMMMCI=y -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y - -# -# LED drivers -# -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9685 is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_BLINKM is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -CONFIG_SWITCH=y -# CONFIG_SWITCH_GPIO is not set -# CONFIG_ACCESSIBILITY is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_DS2404 is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_MOXART is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_DMADEVICES is not set -# CONFIG_AUXDISPLAY is not set -CONFIG_UIO=y -# CONFIG_UIO_PDRV_GENIRQ is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO=y - -# -# Virtio drivers -# -# CONFIG_VIRTIO_BALLOON is not set -CONFIG_VIRTIO_MMIO=y -# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -# CONFIG_USBIP_CORE is not set -# CONFIG_W35UND is not set -# CONFIG_PRISM2_USB is not set -# CONFIG_ECHO is not set -# CONFIG_COMEDI is not set -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -# CONFIG_R8188EU is not set -# CONFIG_RTS5139 is not set -# CONFIG_TRANZPORT is not set -# CONFIG_LINE6_USB is not set -# CONFIG_USB_SERIAL_QUATECH2 is not set -CONFIG_VT6656=m -# CONFIG_USB_ENESTORAGE is not set -# CONFIG_BCM_WIMAX is not set -# CONFIG_FT1000 is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -CONFIG_STAGING_MEDIA=y -CONFIG_DVB_AS102=m -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_USB_MSI3101 is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_USB_SN9C102 is not set -CONFIG_LIRC_STAGING=y -CONFIG_LIRC_IGORPLUGUSB=m -# CONFIG_LIRC_IMON is not set -# CONFIG_LIRC_SASEM is not set -# CONFIG_LIRC_SERIAL is not set -# CONFIG_LIRC_SIR is not set -# CONFIG_LIRC_ZILOG is not set - -# -# Android -# -CONFIG_ANDROID=y -# CONFIG_ANDROID_BINDER_IPC is not set -# CONFIG_ASHMEM is not set -# CONFIG_ANDROID_LOGGER is not set -# CONFIG_ANDROID_TIMED_OUTPUT is not set -# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set -# CONFIG_ANDROID_INTF_ALARM_DEV is not set -CONFIG_SYNC=y -# CONFIG_SW_SYNC is not set -CONFIG_ION=y -# CONFIG_ION_TEST is not set -# CONFIG_ION_DUMMY is not set -# CONFIG_FIQ_DEBUGGER is not set -# CONFIG_FIQ_WATCHDOG is not set -# CONFIG_USB_WPAN_HCD is not set -# CONFIG_WIMAX_GDM72XX is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_CED1401 is not set -# CONFIG_DGRP is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_XILLYBUS is not set -# CONFIG_DGAP is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -CONFIG_COMMON_CLK_VERSATILE=y -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -CONFIG_COMMON_CLK_XGENE=y -CONFIG_COMMON_CLK_SCPI=y -# CONFIG_COMMON_CLK_QCOM is not set - -# -# Hardware Spinlock drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_MAILBOX=y -# CONFIG_PL320_MBOX is not set -CONFIG_IOMMU_SUPPORT=y -CONFIG_OF_IOMMU=y -# CONFIG_ARM_SMMU is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# -CONFIG_PM_DEVFREQ=y - -# -# DEVFREQ Governors -# -# CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND is not set -# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set -# CONFIG_DEVFREQ_GOV_POWERSAVE is not set -# CONFIG_DEVFREQ_GOV_USERSPACE is not set - -# -# DEVFREQ Drivers -# -# CONFIG_EXTCON is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_PWM is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V3=y -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_POWERCAP is not set -# CONFIG_CORESIGHT is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_REISERFS_FS_XATTR is not set -CONFIG_JFS_FS=m -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=m -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=y - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_EXFAT_FS is not set -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLBFS is not set -# CONFIG_HUGETLB_PAGE is not set -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=y -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS2_FS is not set -CONFIG_UBIFS_FS=y -# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -CONFIG_SQUASHFS_FILE_CACHE=y -# CONFIG_SQUASHFS_FILE_DIRECT is not set -CONFIG_SQUASHFS_DECOMP_SINGLE=y -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -# CONFIG_F2FS_CHECK_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -# CONFIG_NFS_V4_2 is not set -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -# CONFIG_NFS_V4_1_MIGRATION is not set -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set -# CONFIG_VIRTUALIZATION is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_DYNAMIC_DEBUG=y - -# -# Compile-time checks and compiler options -# -CONFIG_DEBUG_INFO=y -# CONFIG_DEBUG_INFO_REDUCED is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -# CONFIG_MAGIC_SYSRQ is not set -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHEDSTATS is not set -CONFIG_TIMER_STATS=y - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -CONFIG_STACKTRACE=y -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_CPU_STALL_INFO is not set -CONFIG_RCU_TRACE=y -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_ENABLE_DEFAULT_TRACERS is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_STACK_TRACER is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_PROBE_EVENTS is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_MODULE is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_CHECK_ISR_TIME is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_PID_IN_CONTEXTIDR is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -CONFIG_SECURITYFS=y -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=m -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_PCOMP2=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -# CONFIG_CRYPTO_GCM is not set -CONFIG_CRYPTO_SEQIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set -CONFIG_CRYPTO_CRCT10DIF=m -# CONFIG_CRYPTO_GHASH is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -# CONFIG_CRYPTO_ZLIB is not set -CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=m -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -CONFIG_CRYPTO_HW=y -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ARM64_CRYPTO is not set -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=m -CONFIG_BITREVERSE=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=m -CONFIG_CRC16=y -CONFIG_CRC_T10DIF=m -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m -# CONFIG_CRC8 is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_AVERAGE=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y diff --git a/projects/WeTek_Play_2/options b/projects/WeTek_Play_2/options deleted file mode 100644 index abf1356f48..0000000000 --- a/projects/WeTek_Play_2/options +++ /dev/null @@ -1,138 +0,0 @@ -################################################################################ -# setup system defaults -################################################################################ - - # The TARGET_CPU variable controls which processor should be targeted for - # generated code. - case $TARGET_ARCH in - aarch64) - # TARGET_CPU: - # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d - # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c - # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t - # arm720t arm740t strongarm strongarm110 strongarm1100 - # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t - # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi - # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e - # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s - # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 - # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. - # - TARGET_CPU="cortex-a53" - TARGET_CPU_FLAGS="+crc+fp+simd" - ;; - esac - - # Bootloader to use (syslinux / u-boot / atv-bootloader / bcm2835-bootloader) - BOOTLOADER="u-boot" - - # u-boot version to use (default) - UBOOT_VERSION="" - - # Configuration for u-boot - UBOOT_CONFIG="" - - # Target Configfile for u-boot - UBOOT_CONFIGFILE="" - - # Kernel target - KERNEL_TARGET="Image.lzo" - - # Kernel extra targets to build - KERNEL_UBOOT_EXTRA_TARGET="gxbb_p200_2G_wetek_play_2.dtb" - - # Build Android kernel image using mkbootimg - BUILD_ANDROID_BOOTIMG="yes" - - # Additional options to be passed to Android mkbootimg - ANDROID_BOOTIMG_OPTIONS="--second arch/arm64/boot/dts/amlogic/gxbb_p200_2G_wetek_play_2.dtb --base 0x0 --kernel_offset 0x1080000" - - # Additional kernel make parameters (for example to specify the u-boot loadaddress) - KERNEL_MAKE_EXTRACMD="" - - # Kernel to use. values can be: - # default: default mainline kernel - LINUX="amlogic-3.14" - - -################################################################################ -# setup build defaults -################################################################################ - - # Project CFLAGS - PROJECT_CFLAGS="" - - # SquashFS compression method (gzip / lzo / xz) - SQUASHFS_COMPRESSION="lzo" - -################################################################################ -# setup project defaults -################################################################################ - - # build and install ALSA Audio support (yes / no) - ALSA_SUPPORT="yes" - - # OpenGL(X) implementation to use (no / Mesa) - OPENGL="no" - - # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson6) - OPENGLES="opengl-meson" - - # Amlogic Meson SOC family (8 / 6 / gxbb) - MESON_FAMILY="gxbb" - - # include uvesafb support (yes / no) - UVESAFB_SUPPORT="no" - - # Displayserver to use (x11 / no) - DISPLAYSERVER="no" - - # Windowmanager to use (ratpoison / fluxbox / none) - WINDOWMANAGER="none" - - # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau) - # Space separated list is supported, - # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau" - GRAPHIC_DRIVERS="" - - # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap / libamcodec) - KODIPLAYER_DRIVER="libamcodec" - - # Modules to install in initramfs for early boot - INITRAMFS_MODULES="" - - # additional drivers to install: - # for a list of additinoal drivers see packages/linux-drivers - # Space separated list is supported, - # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="gpu-aml brcmap6xxx-aml wetekdvb" - - # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) - # Space separated list is supported, - # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-aml" - - # build and install ATV IR remote support (yes / no) - ATVCLIENT_SUPPORT="no" - - # Amlogic IR remote support (yes / no) - AMREMOTE_SUPPORT="yes" - - # build with swap support (yes / no) - SWAP_SUPPORT="no" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - - # build with installer (yes / no) - INSTALLER_SUPPORT="no" - - # extra build dependeices - EXTRA_DEPS="mkimage" - EXTRA_DEPS_PKG="u-boot-tools" - - # kernel image name - KERNEL_NAME="kernel.img" diff --git a/projects/WeTek_Play_2/patches/linux/bt_device_on_after_probe.patch b/projects/WeTek_Play_2/patches/linux/bt_device_on_after_probe.patch deleted file mode 100644 index a7c7ac24b3..0000000000 --- a/projects/WeTek_Play_2/patches/linux/bt_device_on_after_probe.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/amlogic/bluetooth/bt_device.c b/drivers/amlogic/bluetooth/bt_device.c -index 6ebd7f2..87d1916 100644 ---- a/drivers/amlogic/bluetooth/bt_device.c -+++ b/drivers/amlogic/bluetooth/bt_device.c -@@ -235,6 +235,7 @@ static int bt_probe(struct platform_device *pdev) - register_early_suspend(&bt_early_suspend); - #endif - -+ bt_device_on(pdata); - return 0; - - err_rfkill: diff --git a/projects/WeTek_Play_2/patches/linux/hdmi_always_connected.patch b/projects/WeTek_Play_2/patches/linux/hdmi_always_connected.patch deleted file mode 100644 index 4204ed9467..0000000000 --- a/projects/WeTek_Play_2/patches/linux/hdmi_always_connected.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/drivers/amlogic/display/logo/logo.c b/drivers/amlogic/display/logo/logo.c -index 9266be3..c2f10bd 100644 ---- a/drivers/amlogic/display/logo/logo.c -+++ b/drivers/amlogic/display/logo/logo.c -@@ -117,7 +117,7 @@ int set_osd_freescaler(int index, enum vmode_e new_mode) - static int refresh_mode_and_logo(bool first) - { - enum vmode_e cur_mode = VMODE_MAX; -- int hdp_state = get_hpd_state(); -+ int hdp_state = 1;//get_hpd_state(); - - if (!first && osd_get_logo_index() != logo_info.index) - return -1; diff --git a/projects/WeTek_Play_2/patches/linux/revert_default_dvb_core.patch b/projects/WeTek_Play_2/patches/linux/revert_default_dvb_core.patch deleted file mode 100644 index f17383e98c..0000000000 --- a/projects/WeTek_Play_2/patches/linux/revert_default_dvb_core.patch +++ /dev/null @@ -1,3024 +0,0 @@ -diff --git a/drivers/media/dvb-core/demux.h b/drivers/media/dvb-core/demux.h -index db46a78..833191bc 100644 ---- a/drivers/media/dvb-core/demux.h -+++ b/drivers/media/dvb-core/demux.h -@@ -83,46 +83,6 @@ enum dmx_success { - #define TS_DEMUX 8 /* in case TS_PACKET is set, send the TS to - the demux device, not to the dvr device */ - --/* PES type for filters which write to built-in decoder */ --/* these should be kept identical to the types in dmx.h */ -- --enum dmx_ts_pes_e { -- /* also send packets to decoder (if it exists) */ -- DMX_TS_PES_AUDIO0, -- DMX_TS_PES_VIDEO0, -- DMX_TS_PES_TELETEXT0, -- DMX_TS_PES_SUBTITLE0, -- DMX_TS_PES_PCR0, -- -- DMX_TS_PES_AUDIO1, -- DMX_TS_PES_VIDEO1, -- DMX_TS_PES_TELETEXT1, -- DMX_TS_PES_SUBTITLE1, -- DMX_TS_PES_PCR1, -- -- DMX_TS_PES_AUDIO2, -- DMX_TS_PES_VIDEO2, -- DMX_TS_PES_TELETEXT2, -- DMX_TS_PES_SUBTITLE2, -- DMX_TS_PES_PCR2, -- -- DMX_TS_PES_AUDIO3, -- DMX_TS_PES_VIDEO3, -- DMX_TS_PES_TELETEXT3, -- DMX_TS_PES_SUBTITLE3, -- DMX_TS_PES_PCR3, -- -- DMX_TS_PES_OTHER --}; -- -- --#define DMX_TS_PES_AUDIO DMX_TS_PES_AUDIO0 --#define DMX_TS_PES_VIDEO DMX_TS_PES_VIDEO0 --#define DMX_TS_PES_TELETEXT DMX_TS_PES_TELETEXT0 --#define DMX_TS_PES_SUBTITLE DMX_TS_PES_SUBTITLE0 --#define DMX_TS_PES_PCR DMX_TS_PES_PCR0 -- -- - struct dmx_ts_feed { - int is_filtering; /* Set to non-zero when filtering in progress */ - struct dmx_demux *parent; /* Back-pointer */ -@@ -246,37 +206,35 @@ struct dmx_demux { - u32 capabilities; /* Bitfield of capability flags */ - struct dmx_frontend* frontend; /* Front-end connected to the demux */ - void* priv; /* Pointer to private data of the API client */ -- int (*open)(struct dmx_demux *demux); -- int (*close)(struct dmx_demux *demux); -- int (*write)(struct dmx_demux *demux, -- const char __user *buf, size_t count); -- int (*allocate_ts_feed)(struct dmx_demux *demux, -- struct dmx_ts_feed **feed, -+ int (*open) (struct dmx_demux* demux); -+ int (*close) (struct dmx_demux* demux); -+ int (*write) (struct dmx_demux* demux, const char __user *buf, size_t count); -+ int (*allocate_ts_feed) (struct dmx_demux* demux, -+ struct dmx_ts_feed** feed, - dmx_ts_cb callback); -- int (*release_ts_feed)(struct dmx_demux *demux, -+ int (*release_ts_feed) (struct dmx_demux* demux, - struct dmx_ts_feed* feed); -- int (*allocate_section_feed)(struct dmx_demux *demux, -- struct dmx_section_feed **feed, -+ int (*allocate_section_feed) (struct dmx_demux* demux, -+ struct dmx_section_feed** feed, - dmx_section_cb callback); -- int (*release_section_feed)(struct dmx_demux *demux, -- struct dmx_section_feed *feed); -- int (*add_frontend)(struct dmx_demux *demux, -- struct dmx_frontend *frontend); -- int (*remove_frontend)(struct dmx_demux *demux, -- struct dmx_frontend *frontend); -- struct list_head* (*get_frontends)(struct dmx_demux *demux); -- int (*connect_frontend)(struct dmx_demux *demux, -- struct dmx_frontend *frontend); -- int (*disconnect_frontend)(struct dmx_demux *demux); -+ int (*release_section_feed) (struct dmx_demux* demux, -+ struct dmx_section_feed* feed); -+ int (*add_frontend) (struct dmx_demux* demux, -+ struct dmx_frontend* frontend); -+ int (*remove_frontend) (struct dmx_demux* demux, -+ struct dmx_frontend* frontend); -+ struct list_head* (*get_frontends) (struct dmx_demux* demux); -+ int (*connect_frontend) (struct dmx_demux* demux, -+ struct dmx_frontend* frontend); -+ int (*disconnect_frontend) (struct dmx_demux* demux); - -- int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids); -+ int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids); - -- int (*get_caps)(struct dmx_demux *demux, struct dmx_caps *caps); -+ int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps); - -- int (*set_source)(struct dmx_demux *demux, -- const enum dmx_source_t *src); -+ int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src); - -- int (*get_stc)(struct dmx_demux *demux, unsigned int num, -+ int (*get_stc) (struct dmx_demux* demux, unsigned int num, - u64 *stc, unsigned int *base); - }; - -diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c -index 8959f71..c0363f1 100644 ---- a/drivers/media/dvb-core/dmxdev.c -+++ b/drivers/media/dvb-core/dmxdev.c -@@ -51,7 +51,6 @@ static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf, - free = dvb_ringbuffer_free(buf); - if (len > free) { - dprintk("dmxdev: buffer overflow\n"); -- pr_err("dmxdev: buffer overflow, bs=%zd\n", buf->size); - return -EOVERFLOW; - } - -@@ -207,8 +206,6 @@ static int dvb_dvr_release(struct inode *inode, struct file *file) - /* TODO */ - dvbdev->users--; - if (dvbdev->users == 1 && dmxdev->exit == 1) { -- fops_put(file->f_op); -- file->f_op = NULL; - mutex_unlock(&dmxdev->mutex); - wake_up(&dvbdev->wait_queue); - } else -@@ -563,7 +560,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev, - { - struct timespec timeout = { 0 }; - struct dmx_pes_filter_params *para = &filter->params.pes; -- enum dmx_output_t otype; -+ dmx_output_t otype; - int ret; - int ts_type; - enum dmx_ts_pes ts_pes; -@@ -788,7 +785,7 @@ static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, - return 0; - } - --static inline void invert_mode(struct dmx_filter *filter) -+static inline void invert_mode(dmx_filter_t *filter) - { - int i; - -@@ -1121,8 +1118,6 @@ static int dvb_demux_release(struct inode *inode, struct file *file) - mutex_lock(&dmxdev->mutex); - dmxdev->dvbdev->users--; - if(dmxdev->dvbdev->users==1 && dmxdev->exit==1) { -- fops_put(file->f_op); -- file->f_op = NULL; - mutex_unlock(&dmxdev->mutex); - wake_up(&dmxdev->dvbdev->wait_queue); - } else -@@ -1131,17 +1126,6 @@ static int dvb_demux_release(struct inode *inode, struct file *file) - return ret; - } - --#ifdef CONFIG_COMPAT --static long dvb_demux_compat_ioctl(struct file *filp, -- unsigned int cmd, unsigned long args) --{ -- unsigned long ret; -- args = (unsigned long)compat_ptr(args); -- ret = dvb_demux_ioctl(filp, cmd, args); -- return ret; --} --#endif -- - static const struct file_operations dvb_demux_fops = { - .owner = THIS_MODULE, - .read = dvb_demux_read, -@@ -1150,9 +1134,6 @@ static const struct file_operations dvb_demux_fops = { - .release = dvb_demux_release, - .poll = dvb_demux_poll, - .llseek = default_llseek, --#ifdef CONFIG_COMPAT -- .compat_ioctl = dvb_demux_compat_ioctl, --#endif - }; - - static struct dvb_device dvbdev_demux = { -@@ -1214,18 +1195,6 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) - return mask; - } - --#ifdef CONFIG_COMPAT --static long dvb_dvr_compat_ioctl(struct file *filp, -- unsigned int cmd, unsigned long args) --{ -- unsigned long ret; -- -- args = (unsigned long)compat_ptr(args); -- ret = dvb_dvr_ioctl(filp, cmd, args); -- return ret; --} --#endif -- - static const struct file_operations dvb_dvr_fops = { - .owner = THIS_MODULE, - .read = dvb_dvr_read, -@@ -1235,9 +1204,6 @@ static const struct file_operations dvb_dvr_fops = { - .release = dvb_dvr_release, - .poll = dvb_dvr_poll, - .llseek = default_llseek, --#ifdef CONFIG_COMPAT -- .compat_ioctl = dvb_dvr_compat_ioctl, --#endif - }; - - static struct dvb_device dvbdev_dvr = { -diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c -index 3485655..6c7ff0c 100644 ---- a/drivers/media/dvb-core/dvb_demux.c -+++ b/drivers/media/dvb-core/dvb_demux.c -@@ -435,7 +435,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) - dprintk_tscheck("TEI detected. " - "PID=0x%x data1=0x%x\n", - pid, buf[1]); -- /* data in this packet cant be trusted - drop it unless -+ /* data in this packet can't be trusted - drop it unless - * module option dvb_demux_feed_err_pkts is set */ - if (!dvb_demux_feed_err_pkts) - return; -@@ -476,7 +476,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) - void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, - size_t count) - { -- spin_lock(&demux->lock); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&demux->lock, flags); - - while (count--) { - if (buf[0] == 0x47) -@@ -484,7 +486,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, - buf += 188; - } - -- spin_unlock(&demux->lock); -+ spin_unlock_irqrestore(&demux->lock, flags); - } - - EXPORT_SYMBOL(dvb_dmx_swfilter_packets); -@@ -519,8 +521,9 @@ static inline void _dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, - { - int p = 0, i, j; - const u8 *q; -+ unsigned long flags; - -- spin_lock(&demux->lock); -+ spin_lock_irqsave(&demux->lock, flags); - - if (demux->tsbufp) { /* tsbuf[0] is now 0x47. */ - i = demux->tsbufp; -@@ -564,7 +567,7 @@ static inline void _dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, - } - - bailout: -- spin_unlock(&demux->lock); -+ spin_unlock_irqrestore(&demux->lock, flags); - } - - void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) -@@ -581,11 +584,13 @@ EXPORT_SYMBOL(dvb_dmx_swfilter_204); - - void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t count) - { -- spin_lock(&demux->lock); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&demux->lock, flags); - - demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, DMX_OK); - -- spin_unlock(&demux->lock); -+ spin_unlock_irqrestore(&demux->lock, flags); - } - EXPORT_SYMBOL(dvb_dmx_swfilter_raw); - -@@ -1027,8 +1032,13 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, - return -EINVAL; - } - -- if (feed->is_filtering) -+ if (feed->is_filtering) { -+ /* release dvbdmx->mutex as far as it is -+ acquired by stop_filtering() itself */ -+ mutex_unlock(&dvbdmx->mutex); - feed->stop_filtering(feed); -+ mutex_lock(&dvbdmx->mutex); -+ } - - spin_lock_irq(&dvbdmx->lock); - f = dvbdmxfeed->filter; -diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c -index ec3d417..1f925e8 100644 ---- a/drivers/media/dvb-core/dvb_frontend.c -+++ b/drivers/media/dvb-core/dvb_frontend.c -@@ -52,10 +52,6 @@ static int dvb_force_auto_inversion; - static int dvb_override_tune_delay; - static int dvb_powerdown_on_sleep = 1; - static int dvb_mfe_wait_time = 5; --static int dvb_afc_debug; --static int disable_set_frotend_param; --static int dvb_dtv_debug; -- - - module_param_named(frontend_debug, dvb_frontend_debug, int, 0644); - MODULE_PARM_DESC(frontend_debug, "Turn on/off frontend core debugging (default:off)."); -@@ -69,19 +65,6 @@ module_param(dvb_powerdown_on_sleep, int, 0644); - MODULE_PARM_DESC(dvb_powerdown_on_sleep, "0: do not power down, 1: turn LNB voltage off on sleep (default)"); - module_param(dvb_mfe_wait_time, int, 0644); - MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to seconds on open() for multi-frontend to become available (default:5 seconds)"); --module_param(dvb_afc_debug, int, 0644); --MODULE_PARM_DESC(dvb_afc_debug, "vb_afc_debug"); --module_param(disable_set_frotend_param, int, 0644); --MODULE_PARM_DESC(disable_set_frotend_param, "disable_set_frotend_param"); --module_param(dvb_dtv_debug, int, 0644); --MODULE_PARM_DESC(dvb_dtv_debug, "vb_afc_debug"); -- --#define dprintk(a...)\ -- do {\ -- if (dvb_frontend_debug)\ -- printk(a);\ -- } while (0) --/*#define dtvprintk if (dvb_dtv_debug) printk*/ - - #define FESTATE_IDLE 1 - #define FESTATE_RETUNE 2 -@@ -118,21 +101,14 @@ MODULE_PARM_DESC(dvb_dtv_debug, "vb_afc_debug"); - #define DVB_FE_DEVICE_REMOVED 2 - - static DEFINE_MUTEX(frontend_mutex); --/*extern unsigned int jiffies_to_msecs(const unsigned long j);*/ --int jiffiestime; --/*define LOCK_TIMEOUT 2000*/ --static int LOCK_TIMEOUT = 2000; - - struct dvb_frontend_private { -+ - /* thread/frontend values */ - struct dvb_device *dvbdev; -- struct dvb_frontend_parameters parameters_in; - struct dvb_frontend_parameters parameters_out; - struct dvb_fe_events events; - struct semaphore sem; -- struct dvbsx_blindscan_events blindscan_events; -- struct semaphore blindscan_sem; -- bool in_blindscan; - struct list_head list_head; - wait_queue_head_t wait_queue; - struct task_struct *thread; -@@ -146,12 +122,6 @@ struct dvb_frontend_private { - int tone; - int voltage; - -- /*set_frontend ops async support*/ -- wait_queue_head_t setfrontendasync_wait_queue; -- unsigned int setfrontendasync_wakeup; -- unsigned int setfrontendasync_needwakeup; -- unsigned int setfrontendasync_interruptwakeup; -- - /* swzigzag values */ - unsigned int state; - unsigned int bending; -@@ -166,7 +136,6 @@ struct dvb_frontend_private { - int quality; - unsigned int check_wrapped; - enum dvbfe_search algo_status; -- int user_delay; - }; - - static void dvb_frontend_wakeup(struct dvb_frontend *fe); -@@ -191,7 +160,6 @@ enum dvbv3_emulation_type { - DVBV3_QAM, - DVBV3_OFDM, - DVBV3_ATSC, -- DVBV3_ANALOG - }; - - static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system) -@@ -215,8 +183,6 @@ static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system) - case SYS_ATSCMH: - case SYS_DVBC_ANNEX_B: - return DVBV3_ATSC; -- case SYS_ANALOG: -- return DVBV3_ANALOG; - case SYS_UNDEFINED: - case SYS_ISDBC: - case SYS_DVBH: -@@ -241,13 +207,9 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) - - dev_dbg(fe->dvb->device, "%s:\n", __func__); - -- if (fe->dtv_property_cache.delivery_system == SYS_ANALOG) { -- if ((status & FE_HAS_LOCK) && has_get_frontend(fe)) -- dtv_get_frontend(fe, &fepriv->parameters_out); -- } else{ -- if (/*(status & FE_HAS_LOCK) && */has_get_frontend(fe)) -- dtv_get_frontend(fe, &fepriv->parameters_out); -- } -+ if ((status & FE_HAS_LOCK) && has_get_frontend(fe)) -+ dtv_get_frontend(fe, &fepriv->parameters_out); -+ - mutex_lock(&events->mtx); - - wp = (events->eventw + 1) % MAX_EVENT; -@@ -259,6 +221,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) - e = &events->events[events->eventw]; - e->status = status; - e->parameters = fepriv->parameters_out; -+ - events->eventw = wp; - - mutex_unlock(&events->mtx); -@@ -290,7 +253,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, - ret = wait_event_interruptible (events->wait_queue, - events->eventw != events->eventr); - -- if (down_interruptible(&fepriv->sem)) -+ if (down_interruptible (&fepriv->sem)) - return -ERESTARTSYS; - - if (ret < 0) -@@ -305,95 +268,6 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, - return 0; - } - --static void dvbsx_blindscan_add_event(struct dvb_frontend *fe, -- struct dvbsx_blindscanevent *pbsevent) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- struct dvbsx_blindscan_events *events = &fepriv->blindscan_events; -- struct dvbsx_blindscanevent *e; -- int wp; -- -- dprintk("%s\n", __func__); -- -- if (mutex_lock_interruptible(&events->mtx)) -- return; -- -- wp = (events->eventw + 1) % MAX_BLINDSCAN_EVENT; -- -- if (wp == events->eventr) { -- events->overflow = 1; -- events->eventr = (events->eventr + 1) % MAX_BLINDSCAN_EVENT; -- } -- -- e = &events->events[events->eventw]; -- -- memcpy(e, pbsevent, sizeof(struct dvbsx_blindscanevent)); -- -- events->eventw = wp; -- -- mutex_unlock(&events->mtx); -- -- wake_up_interruptible(&events->wait_queue); --} -- --static int dvbsx_blindscan_get_event(struct dvb_frontend *fe, -- struct dvbsx_blindscanevent *event , int flags) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- struct dvbsx_blindscan_events *events = &fepriv->blindscan_events; -- -- dprintk("%s\n", __func__); -- -- if (events->overflow) { -- events->overflow = 0; -- return -EOVERFLOW; -- } -- -- if (events->eventw == events->eventr) { -- int ret; -- -- if (flags & O_NONBLOCK) -- return -EWOULDBLOCK; -- -- up(&fepriv->blindscan_sem); -- -- ret = wait_event_interruptible_timeout(events->wait_queue, -- events->eventw != events->eventr, -- fe->ops.blindscan_ops.info.bspara.timeout * HZ); -- -- if (down_interruptible(&fepriv->blindscan_sem)) -- return -ERESTARTSYS; -- -- if (ret < 0) -- return ret; -- } -- -- if (mutex_lock_interruptible(&events->mtx)) -- return -ERESTARTSYS; -- -- memcpy(event, &events->events[events->eventr], -- sizeof(struct dvbsx_blindscanevent)); -- -- events->eventr = (events->eventr + 1) % MAX_BLINDSCAN_EVENT; -- -- mutex_unlock(&events->mtx); -- -- return 0; --} -- --static int dvbsx_blindscan_event_callback(struct dvb_frontend *fe, -- struct dvbsx_blindscanevent *pbsevent) --{ -- dprintk("%s\n", __func__); -- -- if ((!fe) || (!pbsevent)) -- return -1; -- -- dvbsx_blindscan_add_event(fe, pbsevent); -- -- return 0; --} -- - static void dvb_frontend_clear_events(struct dvb_frontend *fe) - { - struct dvb_frontend_private *fepriv = fe->frontend_priv; -@@ -460,7 +334,6 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra - int autoinversion; - int ready = 0; - int fe_set_err = 0; -- int time = 0; - struct dvb_frontend_private *fepriv = fe->frontend_priv; - struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; - int original_inversion = c->inversion; -@@ -539,13 +412,8 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra - if (autoinversion) - c->inversion = fepriv->inversion; - tmp = *c; -- time = jiffies_to_msecs(jiffies)-jiffiestime; -- dprintk("2---auto tune,time is %d\n", time); -- if (fe->ops.set_frontend && (time >= LOCK_TIMEOUT)) { -+ if (fe->ops.set_frontend) - fe_set_err = fe->ops.set_frontend(fe); -- jiffiestime = jiffies_to_msecs(jiffies); -- } -- fepriv->parameters_out = fepriv->parameters_in; - *c = tmp; - if (fe_set_err < 0) { - fepriv->state = FESTATE_ERROR; -@@ -559,35 +427,12 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra - return 0; - } - --/* --*#if 0 --*#if (defined CONFIG_AM_SI2176) --*int si2176_get_strength(void); --*#endif --*#if ((defined CONFIG_AM_SI2177) || (defined CONFIG_AM_SI2157)) --*int si2177_get_strength(void); --*#endif --*#endif --*/ -- - static void dvb_frontend_swzigzag(struct dvb_frontend *fe) - { -- fe_status_t s; -- int retval; -- int time; -- int dtmb_status, i, has_singal; -+ fe_status_t s = 0; -+ int retval = 0; - struct dvb_frontend_private *fepriv = fe->frontend_priv; - struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; --#if (((defined CONFIG_AM_SI2176) || (defined CONFIG_AM_SI2177)\ -- || (defined CONFIG_AM_SI2157)) && (defined CONFIG_AM_M6_DEMOD)) -- int strength; --#endif --#if (defined CONFIG_AM_M6_DEMOD) -- int newcount; -- int count; -- count = 0; --#endif -- s = retval = time = 0; - - /* if we've got no parameters, just keep idling */ - if (fepriv->state & FESTATE_IDLE) { -@@ -619,16 +464,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) - } else { - if (fe->ops.read_status) - fe->ops.read_status(fe, &s); -- time = jiffies_to_msecs(jiffies)-jiffiestime; -- dprintk("read status,time is %d,s is %d,status is %d\n", -- time, s, fepriv->status); -- if (((s != fepriv->status) && (time >= LOCK_TIMEOUT)) || -- ((s != fepriv->status) && -- (s == (FE_HAS_LOCK|FE_HAS_SIGNAL| -- FE_HAS_CARRIER|FE_HAS_VITERBI|FE_HAS_SYNC)))) { -- dev_dbg(fe->dvb->device, -- "event s=%d,fepriv->status is %d\n", -- s, fepriv->status); -+ if (s != fepriv->status) { - dvb_frontend_add_event(fe, s); - fepriv->status = s; - } -@@ -646,188 +482,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) - } - return; - } --/*auto_mode qam 201306-rsj*/ --#if (defined CONFIG_AM_M6_DEMOD) --/*dvbc auto qam*/ -- if (c->modulation == QAM_AUTO) { -- while ((dvbc_get_status() <= 3) && (count <= 20)) { -- msleep(30); -- if (count == 20) { -- fe->ops.read_status(fe, &s); -- dev_dbg(fe->dvb->device, -- "event s=%d,fepriv->status is %d\n", -- s, fepriv->status); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- } -- count++; -- } -- count = 0; -- while ((dvbc_get_status() > 3) && -- (dvbc_get_status() != 5) && (count < 5)) { -- if (count == 0) -- c->modulation = QAM_64; -- else if (count == 1) -- c->modulation = QAM_256; -- else if (count == 2) -- c->modulation = QAM_128; -- else if (count == 3) -- c->modulation = QAM_16; -- else -- c->modulation = QAM_32; -- -- if (fe->ops.set_qam_mode) -- fe->ops.set_qam_mode(fe); -- for (newcount = 0; newcount < 6; newcount++) { -- if (dvbc_get_status() == 5) -- break; -- msleep(50); -- } -- newcount = 0; -- count++; -- if (dvbc_get_status() == 5) { -- if (fe->ops.read_status) -- fe->ops.read_status(fe, &s); -- -- if (((s != fepriv->status) && -- (s == (FE_HAS_LOCK|FE_HAS_SIGNAL| -- FE_HAS_CARRIER|FE_HAS_VITERBI| -- FE_HAS_SYNC)))) { -- dev_dbg(fe->dvb->device, -- "event s=%d,fepriv->status is %d\n", -- s, fepriv->status); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- break; -- } -- } -- -- } -- } else if (c->modulation == QAM_AUTO) { -- /*fepriv->parameters_out = fepriv->parameters_in;*/ -- msleep(100); -- #if (defined CONFIG_AM_SI2176) -- strength = fe->ops.tuner_ops.get_strength(fe)-256; -- if (strength <= (-85)) { -- s = 32; -- dev_dbg(fe->dvb->device, -- "5-strength is %d\n", strength); -- if (s != fepriv->status) { -- dev_dbg(fe->dvb->device, -- "5event s=%d,fepriv->status is %d!\n", -- s, fepriv->status); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- jiffiestime = jiffies_to_msecs(jiffies); -- } -- return; -- -- } -- #elif ((defined CONFIG_AM_SI2177) || (defined CONFIG_AM_SI2157)) -- strength = fe->ops.tuner_ops.get_strength(fe)-256; -- if (strength <= (-85)) { -- s = 32; -- dev_dbg(fe->dvb->device, -- "5-strength is %d\n", strength); -- if (s != fepriv->nstatus) { -- dev_dbg(fe->dvb->device, -- "event s=%d,fepriv->status is %d\n", -- s, fepriv->status); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- jiffiestime = jiffies_to_msecs(jiffies); -- } -- return; -- -- } -- #endif -- while (((atsc_read_iqr_reg()>>16) != 0x1f) && (count < 2)) { -- if (count == 0) { -- /*if (fe->ops.set_frontend)*/ -- /*fe->ops.set_frontend(fe, &fepriv->parameters_in);*/ -- } -- /*fepriv->parameters_in.u.vsb.modulation=QAM_256;*/ -- else if (count == 1) { -- c->modulation = QAM_64; -- if (fe->ops.set_qam_mode) -- fe->ops.set_qam_mode(fe); -- } -- for (newcount = 0; newcount < 10; newcount++) { -- if ((atsc_read_iqr_reg()>>16) == 0x1f) -- break; -- msleep(50); -- } -- newcount = 0; -- count++; -- if ((atsc_read_iqr_reg()>>16) == 0x1f) { -- if (fe->ops.read_status) -- fe->ops.read_status(fe, &s); -- if (((s != fepriv->status) && -- (s == (FE_HAS_LOCK|FE_HAS_SIGNAL| -- FE_HAS_CARRIER|FE_HAS_VITERBI| -- FE_HAS_SYNC)))) { -- dev_dbg(fe->dvb->device, -- "event s=%d,fepriv->status is %d!\n", -- s, fepriv->status); -- dev_dbg(fe->dvb->device, -- "fepriv-frequency is %d\n", -- fepriv->parameters_in.frequency); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- jiffiestime = jiffies_to_msecs(jiffies); -- return; -- } -- } -- if ((count == 2) && -- ((atsc_read_iqr_reg()>>16) != 0x1f)) { -- if (fe->ops.read_status) -- fe->ops.read_status(fe, &s); -- if (s != fepriv->status) { -- dev_dbg(fe->dvb->device, -- "event s=%d,fepriv->status is %d!!\n", -- s, fepriv->status); -- dev_dbg(fe->dvb->device, -- "fepriv->parameters_in.frequency is %d\n", -- fepriv->parameters_in.frequency); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- jiffiestime = jiffies_to_msecs(jiffies); -- return; -- } -- } -- } -- -- } - -- --#endif --#if 1 -- /*signal_detec dtmb 201512-rsj*/ -- if (fe->ops.read_dtmb_fsm) { -- LOCK_TIMEOUT = 10000; -- has_singal = 0; -- msleep(100); -- fe->ops.read_dtmb_fsm(fe, &dtmb_status); -- for (i = 0 ; i < 8 ; i++) { -- if (((dtmb_status >> (i*4)) & 0xf) > 4) { -- /*has signal*/ -- /* dprintk("has signal\n");*/ -- has_singal = 1; -- } -- } -- dprintk("[DTV]has_singal is %d\n", has_singal); -- if (has_singal == 0) { -- s = FE_TIMEDOUT; -- dprintk( -- "event s=%d,fepriv->status is %d\n", -- s, fepriv->status); -- dvb_frontend_add_event(fe, s); -- fepriv->status = s; -- return; -- } -- } -- --#endif - /* if we are tuned already, check we're still locked */ - if (fepriv->state & FESTATE_TUNED) { - dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); -@@ -870,13 +525,8 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) - } - - /* fast zigzag. */ -- if ((fepriv->state & FESTATE_SEARCHING_FAST) || -- (fepriv->state & FESTATE_RETUNE)) { -- if (fepriv->state & FESTATE_SEARCHING_FAST) -- /*if not lock signal ,then wait 25 jiffies*/ -- fepriv->delay = fepriv->min_delay + HZ / 5; -- else -- fepriv->delay = fepriv->min_delay; -+ if ((fepriv->state & FESTATE_SEARCHING_FAST) || (fepriv->state & FESTATE_RETUNE)) { -+ fepriv->delay = fepriv->min_delay; - - /* perform a tune */ - retval = dvb_frontend_swzigzag_autotune(fe, -@@ -949,11 +599,11 @@ static int dvb_frontend_thread(void *data) - { - struct dvb_frontend *fe = data; - struct dvb_frontend_private *fepriv = fe->frontend_priv; -- unsigned long timeout; - fe_status_t s; - enum dvbfe_algo algo; - -- struct dvb_frontend_parameters *params = NULL; -+ bool re_tune = false; -+ bool semheld = false; - - dev_dbg(fe->dvb->device, "%s:\n", __func__); - -@@ -970,13 +620,15 @@ static int dvb_frontend_thread(void *data) - while (1) { - up(&fepriv->sem); /* is locked when we enter the thread... */ - restart: -- timeout = wait_event_interruptible_timeout(fepriv->wait_queue, -+ wait_event_interruptible_timeout(fepriv->wait_queue, - dvb_frontend_should_wakeup(fe) || kthread_should_stop() - || freezing(current), - fepriv->delay); - - if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { - /* got signal or quitting */ -+ if (!down_interruptible(&fepriv->sem)) -+ semheld = true; - fepriv->exit = DVB_FE_NORMAL_EXIT; - break; - } -@@ -1001,25 +653,18 @@ restart: - algo = fe->ops.get_frontend_algo(fe); - switch (algo) { - case DVBFE_ALGO_HW: -- dev_dbg(fe->dvb->device, -- "%s: Frontend ALGO = DVBFE_ALGO_HW\n", -- __func__); -+ dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__); - - if (fepriv->state & FESTATE_RETUNE) { -- dprintk( -- "%s:Retune requested,FESTATE_RETUNE\n", -- __func__); -- params = &fepriv->parameters_in; -+ dev_dbg(fe->dvb->device, "%s: Retune requested, FESTATE_RETUNE\n", __func__); -+ re_tune = true; - fepriv->state = FESTATE_TUNED; -+ } else { -+ re_tune = false; - } - - if (fe->ops.tune) -- fe->ops.tune(fe, -- params, -- fepriv->tune_mode_flags, -- &fepriv->delay, &s); -- if (params) -- fepriv->parameters_out = *params; -+ fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); - - if (s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) { - dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__); -@@ -1038,36 +683,26 @@ restart: - fepriv->state = FESTATE_TUNED; - } - /* Case where we are going to search for a carrier -- * User asked us to retune again -- *for some reason, possibly -+ * User asked us to retune again for some reason, possibly - * requesting a search with a new set of parameters - */ - if (fepriv->algo_status & DVBFE_ALGO_SEARCH_AGAIN) { - if (fe->ops.search) { - fepriv->algo_status = fe->ops.search(fe); -- /* We did do a search as was requested, -- *the flags are now unset as well and has -- * the flags wrt to search. -- */ -+ /* We did do a search as was requested, the flags are -+ * now unset as well and has the flags wrt to search. -+ */ - } else { -- fepriv->algo_status &= -- ~DVBFE_ALGO_SEARCH_AGAIN; -+ fepriv->algo_status &= ~DVBFE_ALGO_SEARCH_AGAIN; - } - } - /* Track the carrier if the search was successful */ -- if (fepriv->algo_status -- == DVBFE_ALGO_SEARCH_SUCCESS) { -- if (fe->ops.track) -- fe->ops.track(fe, -- &fepriv->parameters_in); -- s = FE_HAS_LOCK; -- } else { -- /*fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;*/ -+ if (fepriv->algo_status != DVBFE_ALGO_SEARCH_SUCCESS) { -+ fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; - fepriv->delay = HZ / 2; -- s = FE_TIMEDOUT; - } - dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); -- /*fe->ops.read_status(fe, &s);*/ -+ fe->ops.read_status(fe, &s); - if (s != fepriv->status) { - dvb_frontend_add_event(fe, s); /* update event list */ - fepriv->status = s; -@@ -1109,6 +744,8 @@ restart: - fepriv->exit = DVB_FE_NO_EXIT; - mb(); - -+ if (semheld) -+ up(&fepriv->sem); - dvb_frontend_wakeup(fe); - return 0; - } -@@ -1197,7 +834,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe) - - if (signal_pending(current)) - return -EINTR; -- if (down_interruptible(&fepriv->sem)) -+ if (down_interruptible (&fepriv->sem)) - return -EINTR; - - fepriv->state = FESTATE_IDLE; -@@ -1339,128 +976,6 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) - return 0; - } - --static int dvb_frontend_asyncshouldwakeup(struct dvb_frontend *fe) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- dprintk("%s:%d\n", __func__, fepriv->setfrontendasync_wakeup); -- -- return fepriv->setfrontendasync_wakeup; --} -- --static int dvb_frontend_asyncnotbusy(struct dvb_frontend *fe) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- dprintk("%s:%d\n", __func__, fepriv->setfrontendasync_needwakeup); -- -- return !fepriv->setfrontendasync_needwakeup; --} -- --static void dvb_frontend_asyncwakeup(struct dvb_frontend *fe) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- if (!fe) -- return; -- -- if (!fe->ops.asyncinfo.set_frontend_asyncenable) -- return; -- -- -- dprintk("%s:%d\n", __func__, fepriv->setfrontendasync_needwakeup); -- -- if (fepriv->setfrontendasync_needwakeup) { -- fepriv->setfrontendasync_wakeup = 1; -- wake_up_interruptible(&fepriv->setfrontendasync_wait_queue); -- -- up(&fepriv->sem); -- wait_event_interruptible(fepriv->setfrontendasync_wait_queue, -- dvb_frontend_asyncnotbusy(fe)); -- if (down_interruptible(&fepriv->sem)) -- return; -- } --} -- --static int dvb_frontend_asyncpreproc(struct dvb_frontend *fe) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- if (!fe) -- return -1; -- -- if (!fe->ops.asyncinfo.set_frontend_asyncenable) -- return -1; -- -- fepriv->setfrontendasync_needwakeup = 1; -- fepriv->setfrontendasync_wakeup = 0; -- -- dprintk("%s:%d\n", __func__, fepriv->setfrontendasync_needwakeup); -- -- /*enable other frontend ops run*/ -- up(&fepriv->sem); -- -- return 0; --} -- --static int dvb_frontend_asyncwait(struct dvb_frontend *fe, u32 ms_timeout) --{ -- int ret = 0; -- unsigned long wait_ret = 0; -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- if (!fe) -- return -1; -- -- if (!fe->ops.asyncinfo.set_frontend_asyncenable) -- return -1; -- -- wait_ret = wait_event_interruptible_timeout -- (fepriv->setfrontendasync_wait_queue, -- dvb_frontend_asyncshouldwakeup(fe), -- ms_timeout * HZ / 1000); -- -- dprintk("%s:%d/%ld\n", __func__, ms_timeout, wait_ret); -- -- if (wait_ret > 0) -- ret = 1; -- else if (wait_ret == 0) -- ret = 0; -- -- return ret; --} -- --static int dvb_frontend_asyncpostproc(struct dvb_frontend *fe, -- int asyncwait_ret) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- if (!fe) -- return -1; -- -- if (!fe->ops.asyncinfo.set_frontend_asyncenable) -- return -1; -- -- if (down_interruptible(&fepriv->sem)) -- return -1; -- -- fepriv->setfrontendasync_needwakeup = 0; -- -- wake_up_interruptible(&fepriv->setfrontendasync_wait_queue); -- -- if (asyncwait_ret > 0) -- fepriv->setfrontendasync_interruptwakeup = 1; -- else if (asyncwait_ret == 0) -- fepriv->setfrontendasync_interruptwakeup = 0; -- else -- fepriv->setfrontendasync_interruptwakeup = 0; -- dprintk("%s:%d/%d\n", __func__, -- asyncwait_ret, -- fepriv->setfrontendasync_needwakeup); -- -- return 0; --} -- - #define _DTV_CMD(n, s, b) \ - [n] = { \ - .name = #n, \ -@@ -1632,7 +1147,6 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe, - c->transmission_mode = p->u.ofdm.transmission_mode; - c->guard_interval = p->u.ofdm.guard_interval; - c->hierarchy = p->u.ofdm.hierarchy_information; -- c->ofdm_mode = p->u.ofdm.ofdm_mode; - break; - case DVBV3_ATSC: - dev_dbg(fe->dvb->device, "%s: Preparing ATSC req\n", __func__); -@@ -1644,14 +1158,6 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe, - else - c->delivery_system = SYS_DVBC_ANNEX_B; - break; -- case DVBV3_ANALOG: -- c->analog.soundsys = p->u.analog.soundsys; -- c->analog.audmode = p->u.analog.audmode; -- c->analog.std = p->u.analog.std; -- c->analog.flag = p->u.analog.flag; -- c->analog.afc_range = p->u.analog.afc_range; -- c->analog.reserved = p->u.analog.reserved; -- break; - case DVBV3_UNKNOWN: - dev_err(fe->dvb->device, - "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n", -@@ -1672,7 +1178,7 @@ static int dtv_property_legacy_params_sync(struct dvb_frontend *fe, - - p->frequency = c->frequency; - p->inversion = c->inversion; -- /*dtvprintk("[get frontend]p is %d\n", p->frequency);*/ -+ - switch (dvbv3_type(c->delivery_system)) { - case DVBV3_UNKNOWN: - dev_err(fe->dvb->device, -@@ -1721,21 +1227,11 @@ static int dtv_property_legacy_params_sync(struct dvb_frontend *fe, - p->u.ofdm.transmission_mode = c->transmission_mode; - p->u.ofdm.guard_interval = c->guard_interval; - p->u.ofdm.hierarchy_information = c->hierarchy; -- p->u.ofdm.ofdm_mode = c->ofdm_mode; - break; - case DVBV3_ATSC: - dev_dbg(fe->dvb->device, "%s: Preparing VSB req\n", __func__); - p->u.vsb.modulation = c->modulation; - break; -- case DVBV3_ANALOG: -- p->u.analog.soundsys = c->analog.soundsys; -- p->u.analog.audmode = c->analog.audmode; -- p->u.analog.std = c->analog.std; -- p->u.analog.flag = c->analog.flag; -- p->u.analog.afc_range = c->analog.afc_range; -- p->u.analog.reserved = c->analog.reserved; -- break; -- - } - return 0; - } -@@ -2007,14 +1503,8 @@ static bool is_dvbv3_delsys(u32 delsys) - { - bool status; - -- status = (delsys == SYS_DVBT) || -- (delsys == SYS_DVBC_ANNEX_A) || -- (delsys == SYS_DVBS) || -- (delsys == SYS_ATSC) || -- (delsys == SYS_DTMB) || -- (delsys == SYS_ISDBT) || -- (delsys == SYS_ANALOG) || -- (delsys == SYS_DVBS2); -+ status = (delsys == SYS_DVBT) || (delsys == SYS_DVBC_ANNEX_A) || -+ (delsys == SYS_DVBS) || (delsys == SYS_ATSC); - - return status; - } -@@ -2409,38 +1899,10 @@ static int dvb_frontend_ioctl(struct file *file, - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - struct dvb_frontend_private *fepriv = fe->frontend_priv; - int err = -EOPNOTSUPP; -- int need_lock = 1; -- int need_blindscan = 0; - - dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); -- if (fepriv->exit != DVB_FE_NO_EXIT) -- return -ENODEV; -- -- if ((file->f_flags & O_ACCMODE) == O_RDONLY && -- (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT || -- cmd == FE_DISEQC_RECV_SLAVE_REPLY)) -- return -EPERM; -- -- if (cmd == FE_READ_STATUS || -- cmd == FE_READ_BER || -- cmd == FE_READ_SIGNAL_STRENGTH || -- cmd == FE_READ_SNR || -- cmd == FE_READ_UNCORRECTED_BLOCKS || -- cmd == FE_GET_FRONTEND || -- cmd == FE_READ_AFC || -- cmd == FE_SET_BLINDSCAN || -- cmd == FE_GET_BLINDSCANEVENT || -- cmd == FE_SET_BLINDSCANCANCEl) -- need_lock = 0; -- -- if (cmd == FE_SET_BLINDSCAN || -- cmd == FE_GET_BLINDSCANEVENT || -- cmd == FE_SET_BLINDSCANCANCEl) -- need_blindscan = 1; -- -- if (need_lock) -- if (down_interruptible(&fepriv->sem)) -- return -ERESTARTSYS; -+ if (down_interruptible(&fepriv->sem)) -+ return -ERESTARTSYS; - - if (fepriv->exit != DVB_FE_NO_EXIT) { - up(&fepriv->sem); -@@ -2454,14 +1916,6 @@ static int dvb_frontend_ioctl(struct file *file, - return -EPERM; - } - -- if (need_blindscan) -- if (down_interruptible(&fepriv->blindscan_sem)) -- return -ERESTARTSYS; -- -- if (cmd == FE_SET_FRONTEND || -- cmd == FE_SET_MODE) -- dvb_frontend_asyncwakeup(fe); -- - if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY)) - err = dvb_frontend_ioctl_properties(file, cmd, parg); - else { -@@ -2469,12 +1923,7 @@ static int dvb_frontend_ioctl(struct file *file, - err = dvb_frontend_ioctl_legacy(file, cmd, parg); - } - -- if (need_blindscan) -- up(&fepriv->blindscan_sem); -- -- if (need_lock) -- up(&fepriv->sem); -- -+ up(&fepriv->sem); - return err; - } - -@@ -2509,18 +1958,12 @@ static int dvb_frontend_ioctl_properties(struct file *file, - err = -ENOMEM; - goto out; - } --#ifdef CONFIG_COMPAT -- if (copy_from_user(tvp, compat_ptr((unsigned long)tvps->props), -- tvps->num * sizeof(struct dtv_property))) { -- err = -EFAULT; -- goto out; -- } --#else -+ - if (copy_from_user(tvp, tvps->props, tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; - } --#endif -+ - for (i = 0; i < tvps->num; i++) { - err = dtv_property_process_set(fe, tvp + i, file); - if (err < 0) -@@ -2548,18 +1991,12 @@ static int dvb_frontend_ioctl_properties(struct file *file, - err = -ENOMEM; - goto out; - } --#ifdef CONFIG_COMPAT -- if (copy_from_user(tvp, compat_ptr((unsigned long)tvps->props), -- tvps->num * sizeof(struct dtv_property))) { -- err = -EFAULT; -- goto out; -- } --#else -+ - if (copy_from_user(tvp, tvps->props, tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; - } --#endif -+ - /* - * Fills the cache out struct with the cache contents, plus - * the data retrieved from get_frontend, if the frontend -@@ -2576,18 +2013,11 @@ static int dvb_frontend_ioctl_properties(struct file *file, - goto out; - (tvp + i)->result = err; - } --#ifdef CONFIG_COMPAT -- if (copy_to_user(compat_ptr((unsigned long)tvps->props), tvp, -- tvps->num * sizeof(struct dtv_property))) { -- err = -EFAULT; -- goto out; -- } --#else -+ - if (copy_to_user(tvps->props, tvp, tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; - } --#endif - - } else - err = -EOPNOTSUPP; -@@ -2603,7 +2033,6 @@ static int dtv_set_frontend(struct dvb_frontend *fe) - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - struct dvb_frontend_tune_settings fetunesettings; - u32 rolloff = 0; -- dev_dbg(fe->dvb->device, "dtv_set_frontend\n"); - - if (dvb_frontend_check_parameters(fe) < 0) - return -EINVAL; -@@ -2678,18 +2107,16 @@ static int dtv_set_frontend(struct dvb_frontend *fe) - case SYS_DVBC_ANNEX_A: - case SYS_DVBC_ANNEX_C: - fepriv->min_delay = HZ / 20; -- fepriv->step_size = 0; -- fepriv->max_drift = 0; -+ fepriv->step_size = c->symbol_rate / 16000; -+ fepriv->max_drift = c->symbol_rate / 2000; - break; - case SYS_DVBT: - case SYS_DVBT2: - case SYS_ISDBT: - case SYS_DTMB: - fepriv->min_delay = HZ / 20; -- /*fe->ops.info.frequency_stepsize * 2;*/ -- fepriv->step_size = 0; -- /*(fe->ops.info.frequency_stepsize * 2) + 1;*/ -- fepriv->max_drift = 0; -+ fepriv->step_size = fe->ops.info.frequency_stepsize * 2; -+ fepriv->max_drift = (fe->ops.info.frequency_stepsize * 2) + 1; - break; - default: - /* -@@ -2709,18 +2136,10 @@ static int dtv_set_frontend(struct dvb_frontend *fe) - - /* Request the search algorithm to search */ - fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; -- if (c->delivery_system == SYS_ANALOG && -- (c->analog.flag & ANALOG_FLAG_ENABLE_AFC)) { -- /*dvb_frontend_add_event(fe, 0); */ -- dvb_frontend_clear_events(fe); -- dvb_frontend_wakeup(fe); -- } else if (fe->ops.set_frontend) { -- fe->ops.set_frontend(fe); -- if (c->delivery_system != SYS_ANALOG) -- dvb_frontend_clear_events(fe); -- dvb_frontend_add_event(fe, 0); -- dvb_frontend_wakeup(fe); -- } -+ -+ dvb_frontend_clear_events(fe); -+ dvb_frontend_add_event(fe, 0); -+ dvb_frontend_wakeup(fe); - fepriv->status = 0; - - return 0; -@@ -2906,10 +2325,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file, - int i; - u8 last = 1; - if (dvb_frontend_debug) -- dev_dbg(fe->dvb->device, -- "%s switch command: 0x%04lx\n", -- __func__, -- swcmd); -+ printk("%s switch command: 0x%04lx\n", __func__, swcmd); - do_gettimeofday(&nexttime); - if (dvb_frontend_debug) - tv[0] = nexttime; -@@ -2932,12 +2348,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file, - dvb_frontend_sleep_until(&nexttime, 8000); - } - if (dvb_frontend_debug) { -- dev_dbg(fe->dvb->device, "%s(%d): switch delay (should be 32k followed by all 8k\n", -+ printk("%s(%d): switch delay (should be 32k followed by all 8k\n", - __func__, fe->dvb->num); - for (i = 1; i < 10; i++) -- dev_dbg(fe->dvb->device, -- "%d: %d\n", i, -- timeval_usec_diff(tv[i-1] , tv[i])); -+ printk("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); - } - err = 0; - fepriv->state = FESTATE_DISEQC; -@@ -2956,19 +2370,15 @@ static int dvb_frontend_ioctl_legacy(struct file *file, - break; - - case FE_SET_FRONTEND: -- if (disable_set_frotend_param) -- break; -- dev_dbg(fe->dvb->device, "FE_SET_FRONTEND\n"); - err = dvbv3_set_delivery_system(fe); - if (err) - break; -+ - err = dtv_property_cache_sync(fe, c, parg); - if (err) - break; -- jiffiestime = jiffies_to_msecs(jiffies); - err = dtv_set_frontend(fe); - break; -- - case FE_GET_EVENT: - err = dvb_frontend_get_event (fe, parg, file->f_flags); - break; -@@ -2981,164 +2391,6 @@ static int dvb_frontend_ioctl_legacy(struct file *file, - fepriv->tune_mode_flags = (unsigned long) parg; - err = 0; - break; -- -- case FE_SET_DELAY: -- fepriv->user_delay = (long)parg; -- err = 0; -- break; -- -- case FE_SET_MODE: -- /* -- set thread idle to avoid unnecessary EVT notification. -- potential calls due to the EVT/s -- may destroy the internal info. -- */ -- fepriv->state = FESTATE_IDLE; -- -- if (fe->ops.set_mode) { -- err = fe->ops.set_mode(fe, (long)parg); -- if (err == 0) { -- switch ((long)parg) { -- case FE_QPSK: -- /*DVBV3_QPSK;*/ -- c->delivery_system = SYS_DVBS2; -- break; -- case FE_QAM: -- /*DVBV3_QAM;*/ -- c->delivery_system = SYS_DVBC_ANNEX_A; -- break; -- case FE_OFDM: -- /*DVBV3_OFDM;*/ -- c->delivery_system = SYS_DVBT; -- break; -- case FE_ATSC: -- /*DVBV3_ATSC;*/ -- c->delivery_system = SYS_ATSC; -- break; -- case FE_ANALOG: -- /*DVBV3_ANALOG;*/ -- c->delivery_system = SYS_ANALOG; -- break; -- case FE_DTMB: -- /*DVBV3_OFDM;*/ -- c->delivery_system = SYS_DTMB; -- break; -- case FE_ISDBT: -- /*DVBV3_OFDM;*/ -- c->delivery_system = SYS_ISDBT; -- break; -- } -- } -- } -- break; -- -- case FE_READ_TS: -- if (fe->ops.read_ts) -- err = fe->ops.read_ts(fe, (int *)parg); -- break; -- case FE_FINE_TUNE: -- if (fe->ops.tuner_ops.fine_tune) { -- err = -- fe->ops.tuner_ops.fine_tune(fe, *((int *)parg)); -- } -- break; -- case FE_READ_TUNER_STATUS: -- if (fe->ops.tuner_ops.get_tuner_status) { -- struct tuner_status_s parm_status = {0}; -- struct tuner_status_s *tmsp = parg; -- err = -- fe->ops.tuner_ops.get_tuner_status(fe, &parm_status); -- memcpy(tmsp, &parm_status, -- sizeof(struct tuner_status_s)); -- } -- break; -- case FE_READ_ANALOG_STATUS: -- if (fe->ops.analog_ops.get_atv_status) { -- struct atv_status_s atv_stats = {0}; -- struct atv_status_s *tmap = parg; -- err = fe->ops.analog_ops.get_atv_status(fe, &atv_stats); -- memcpy(tmap, &atv_stats, sizeof(struct atv_status_s)); -- } -- break; -- case FE_READ_SD_STATUS: -- if (fe->ops.analog_ops.get_sd_status) { -- struct sound_status_s sound_sts = {0}; -- err = fe->ops.analog_ops.get_sd_status(fe, &sound_sts); -- memcpy(parg, &sound_sts, sizeof(struct sound_status_s)); -- } -- break; -- case FE_SET_PARAM_BOX: -- if (fe->ops.tuner_ops.set_config) { -- struct tuner_param_s tuner_parm = {0}; -- memcpy(&tuner_parm, parg, sizeof(struct tuner_param_s)); -- err = fe->ops.tuner_ops.set_config(fe, &tuner_parm); -- memcpy(parg, &tuner_parm, sizeof(struct tuner_param_s)); -- } -- break; -- -- case FE_SET_BLINDSCAN: -- memcpy(&(fe->ops.blindscan_ops.info.bspara), -- parg, sizeof(struct dvbsx_blindscanpara)); -- -- dprintk("FE_SET_BLINDSCAN %d %d %d %d %d %d %d\n", -- fe->ops.blindscan_ops.info.bspara.minfrequency, -- fe->ops.blindscan_ops.info.bspara.maxfrequency, -- fe->ops.blindscan_ops.info.bspara.minSymbolRate, -- fe->ops.blindscan_ops.info.bspara.maxSymbolRate, -- fe->ops.blindscan_ops.info.bspara.frequencyRange, -- fe->ops.blindscan_ops.info.bspara.frequencyStep, -- fe->ops.blindscan_ops.info.bspara.timeout); -- -- /*register*/ -- fe->ops.blindscan_ops.info.blindscan_callback -- = dvbsx_blindscan_event_callback; -- -- fepriv->in_blindscan = true; -- -- if (fe->ops.blindscan_ops.blindscan_scan) -- err = fe->ops.blindscan_ops.blindscan_scan(fe, -- &(fe->ops.blindscan_ops.info.bspara)); -- break; -- -- case FE_GET_BLINDSCANEVENT: -- { -- struct dvbsx_blindscanevent *p_tmp_bsevent = NULL; -- err = dvbsx_blindscan_get_event(fe, -- (struct dvbsx_blindscanevent *)parg, -- file->f_flags); -- -- p_tmp_bsevent = (struct dvbsx_blindscanevent *)parg; -- -- dprintk("FE_GET_BLINDSCANEVENT status:%d\n", -- p_tmp_bsevent->status); -- if (p_tmp_bsevent->status == BLINDSCAN_UPDATESTARTFREQ) { -- dprintk("start freq %d\n", -- p_tmp_bsevent->u.m_uistartfreq_khz); -- } else if (p_tmp_bsevent->status == BLINDSCAN_UPDATEPROCESS) { -- dprintk("process %d\n", p_tmp_bsevent->u.m_uiprogress); -- } else if (p_tmp_bsevent->status -- == BLINDSCAN_UPDATERESULTFREQ) { -- dprintk("result freq %d symb %d\n", -- p_tmp_bsevent->u.parameters.frequency, -- p_tmp_bsevent->u.parameters.u.qpsk.symbol_rate); -- } -- } -- break; -- -- case FE_SET_BLINDSCANCANCEl: -- dprintk("FE_SET_BLINDSCANCANCEl\n"); -- -- -- if (fe->ops.blindscan_ops.blindscan_cancel) -- err = fe->ops.blindscan_ops.blindscan_cancel(fe); -- -- fepriv->in_blindscan = false; -- -- /*unregister*/ -- fe->ops.blindscan_ops.info.blindscan_callback = NULL; -- -- break; -- - } - - return err; -@@ -3240,8 +2492,6 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) - - /* empty event queue */ - fepriv->events.eventr = fepriv->events.eventw = 0; -- fepriv->blindscan_events.eventr -- = fepriv->blindscan_events.eventw = 0; - } - - if (adapter->mfe_shared) -@@ -3286,18 +2536,6 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) - return ret; - } - --#ifdef CONFIG_COMPAT --static long dvb_frontend_compat_ioctl(struct file *filp, -- unsigned int cmd, unsigned long args) --{ -- unsigned long ret; -- -- args = (unsigned long)compat_ptr(args); -- ret = dvb_generic_ioctl(filp, cmd, args); -- return ret; --} --#endif -- - static const struct file_operations dvb_frontend_fops = { - .owner = THIS_MODULE, - .unlocked_ioctl = dvb_generic_ioctl, -@@ -3305,10 +2543,6 @@ static const struct file_operations dvb_frontend_fops = { - .open = dvb_frontend_open, - .release = dvb_frontend_release, - .llseek = noop_llseek, --#ifdef CONFIG_COMPAT -- .compat_ioctl = dvb_frontend_compat_ioctl, --#endif -- - }; - - int dvb_frontend_suspend(struct dvb_frontend *fe) -@@ -3349,31 +2583,6 @@ int dvb_frontend_resume(struct dvb_frontend *fe) - } - EXPORT_SYMBOL(dvb_frontend_resume); - -- --static ssize_t dvbc_lock_show(struct class *cls, -- struct class_attribute *attr, -- char *buf) --{ -- return sprintf(buf, "dvbc_autoflags: %s\n", LOCK_TIMEOUT?"on":"off"); --} --static ssize_t dvbc_lock_store(struct class *cls, -- struct class_attribute *attr, -- const char *buf, -- size_t count) --{ -- /*int mode = simple_strtol(buf, 0, 16);*/ -- int mode = 0; -- count = kstrtol(buf, 0, (long *)&mode); -- LOCK_TIMEOUT = mode; -- return count; -- --} -- --static CLASS_ATTR(lock_time, 0644, dvbc_lock_show, dvbc_lock_store); -- --struct class *tongfang_clsp; --#define LOCK_DEVICE_NAME "tongfang" -- - int dvb_register_frontend(struct dvb_adapter* dvb, - struct dvb_frontend* fe) - { -@@ -3386,7 +2595,6 @@ int dvb_register_frontend(struct dvb_adapter* dvb, - .kernel_ioctl = dvb_frontend_ioctl - }; - -- int ret; - dev_dbg(dvb->device, "%s:\n", __func__); - - if (mutex_lock_interruptible(&frontend_mutex)) -@@ -3400,44 +2608,19 @@ int dvb_register_frontend(struct dvb_adapter* dvb, - fepriv = fe->frontend_priv; - - sema_init(&fepriv->sem, 1); -- sema_init(&fepriv->blindscan_sem, 1); -- init_waitqueue_head(&fepriv->wait_queue); -- init_waitqueue_head(&fepriv->events.wait_queue); -- init_waitqueue_head(&fepriv->blindscan_events.wait_queue); -+ init_waitqueue_head (&fepriv->wait_queue); -+ init_waitqueue_head (&fepriv->events.wait_queue); - mutex_init(&fepriv->events.mtx); -- mutex_init(&fepriv->blindscan_events.mtx); - fe->dvb = dvb; - fepriv->inversion = INVERSION_OFF; - -- init_waitqueue_head(&fepriv->setfrontendasync_wait_queue); -- fepriv->setfrontendasync_wakeup = 0; -- fepriv->setfrontendasync_needwakeup = 0; -- fepriv->setfrontendasync_interruptwakeup = 0; -- -- fe->ops.asyncinfo.set_frontend_asyncpreproc = dvb_frontend_asyncpreproc; -- fe->ops.asyncinfo.set_frontend_asyncwait = dvb_frontend_asyncwait; -- fe->ops.asyncinfo.set_frontend_asyncpostproc -- = dvb_frontend_asyncpostproc; -- - dev_info(fe->dvb->device, - "DVB: registering adapter %i frontend %i (%s)...\n", - fe->dvb->num, fe->id, fe->ops.info.name); - - dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template, - fe, DVB_DEVICE_FRONTEND); -- dev_dbg(fe->dvb->device, "For tongfang\n"); -- ret = 0; -- tongfang_clsp = class_create(THIS_MODULE, LOCK_DEVICE_NAME); -- if (!tongfang_clsp) { -- dev_dbg(fe->dvb->device, -- "[tongfang]%s:create class error.\n", __func__); -- return PTR_ERR(tongfang_clsp); -- } -- ret = class_create_file(tongfang_clsp, &class_attr_lock_time); -- if (ret) { -- /* printk("[tongfang]%s create -- class file error.\n", __func__); */ -- } -+ - /* - * Initialize the cache to the proper values according with the - * first supported delivery system (ops->delsys[0]) -@@ -3466,8 +2649,6 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) - - mutex_lock(&frontend_mutex); - dvb_unregister_device (fepriv->dvbdev); -- class_remove_file(tongfang_clsp, &class_attr_lock_time); -- class_destroy(tongfang_clsp); - - /* fe is invalid now */ - kfree(fepriv); -@@ -3513,17 +2694,3 @@ void dvb_frontend_detach(struct dvb_frontend* fe) - } - #endif - EXPORT_SYMBOL(dvb_frontend_detach); -- --void dvb_frontend_retune(struct dvb_frontend *fe) --{ -- struct dvb_frontend_private *fepriv = fe->frontend_priv; -- -- fepriv->state = FESTATE_RETUNE; -- -- fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; -- -- dvb_frontend_wakeup(fe); -- fepriv->status = 0; --} --EXPORT_SYMBOL(dvb_frontend_retune); -- -diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h -index 70ea290..371b6ca 100644 ---- a/drivers/media/dvb-core/dvb_frontend.h -+++ b/drivers/media/dvb-core/dvb_frontend.h -@@ -38,7 +38,6 @@ - #include - #include - --#include - #include - - #include "dvbdev.h" -@@ -49,11 +48,6 @@ - */ - #define MAX_DELSYS 8 - --#if (defined CONFIG_AM_M6_DEMOD) --extern u32 dvbc_get_status(void); --extern unsigned long atsc_read_iqr_reg(void); --#endif -- - struct dvb_frontend_tune_settings { - int min_delay_ms; - int step_size; -@@ -77,16 +71,8 @@ struct dvb_tuner_info { - struct analog_parameters { - unsigned int frequency; - unsigned int mode; -- unsigned int soundsys;/* A2,BTSC/EIAJ/NICAM */ - unsigned int audmode; -- unsigned int lock_range; -- unsigned int leap_step; - u64 std; -- /*for amlatvdemod*/ -- unsigned int tuner_id; -- unsigned int if_freq; -- unsigned int if_inv; -- unsigned int reserved; - }; - - enum dvbfe_modcod { -@@ -232,21 +218,14 @@ struct dvb_tuner_ops { - - #define TUNER_STATUS_LOCKED 1 - #define TUNER_STATUS_STEREO 2 -- int (*get_status)(struct dvb_frontend *fe, void *status); -- void (*get_pll_status)(struct dvb_frontend *fe, void *status); -+ int (*get_status)(struct dvb_frontend *fe, u32 *status); - int (*get_rf_strength)(struct dvb_frontend *fe, u16 *strength); - int (*get_afc)(struct dvb_frontend *fe, s32 *afc); -- int (*get_snr)(struct dvb_frontend *fe); - - /** These are provided separately from set_params in order to facilitate silicon - * tuners which require sophisticated tuning loops, controlling each parameter separately. */ - int (*set_frequency)(struct dvb_frontend *fe, u32 frequency); - int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); -- int (*set_tuner)(struct dvb_frontend *fe, -- struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_tuner_sys *tuner_sys); -- int (*get_strength)(struct dvb_frontend *fe); - - /* - * These are provided separately from set_params in order to facilitate silicon -@@ -254,12 +233,6 @@ struct dvb_tuner_ops { - */ - int (*set_state)(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state); - int (*get_state)(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state); -- /*add function to get tuner status*/ -- int (*get_tuner_status)(struct dvb_frontend *fe, -- struct tuner_status_s *tuner_status); -- /* add special fine tune function */ -- int (*fine_tune)(struct dvb_frontend *fe, -- int offset_khz); - }; - - struct analog_demod_info { -@@ -272,12 +245,8 @@ struct analog_demod_ops { - - void (*set_params)(struct dvb_frontend *fe, - struct analog_parameters *params); -- int (*has_signal)(struct dvb_frontend *fe, u16 *signal); -- int (*get_afc)(struct dvb_frontend *fe, s32 *afc); -- int (*is_stereo)(struct dvb_frontend *fe); -- int (*get_snr)(struct dvb_frontend *fe); -- int (*get_status)(struct dvb_frontend *fe, void *status); -- void (*get_pll_status)(struct dvb_frontend *fe, void *status); -+ int (*has_signal)(struct dvb_frontend *fe, u16 *signal); -+ int (*get_afc)(struct dvb_frontend *fe, s32 *afc); - void (*tuner_status)(struct dvb_frontend *fe); - void (*standby)(struct dvb_frontend *fe); - void (*release)(struct dvb_frontend *fe); -@@ -285,42 +254,10 @@ struct analog_demod_ops { - - /** This is to allow setting tuner-specific configuration */ - int (*set_config)(struct dvb_frontend *fe, void *priv_cfg); -- /* add function to get atv_demod & stereo_demod status */ -- int (*get_atv_status)(struct dvb_frontend *fe, -- struct atv_status_s *atv_status); -- int (*get_sd_status)(struct dvb_frontend *fe, -- struct sound_status_s *sd_status); - }; - - struct dtv_frontend_properties; - --struct dvbsx_blindscan_info { -- /* timeout of get blindscan event */ -- struct dvbsx_blindscanpara bspara; -- int (*blindscan_callback)(struct dvb_frontend *fe, -- struct dvbsx_blindscanevent *pbsevent); --}; -- --struct dvbsx_blindscan_ops { -- struct dvbsx_blindscan_info info; -- -- /* -- * These are provided start and stop blindscan -- */ -- int (*blindscan_scan)(struct dvb_frontend *fe, -- struct dvbsx_blindscanpara *pbspara); -- int (*blindscan_cancel)(struct dvb_frontend *fe); --}; -- --struct dvb_frontend_asyncinfo { -- int set_frontend_asyncenable; -- int (*set_frontend_asyncpreproc)(struct dvb_frontend *fe); -- /*return value = 1 interrupt, = 0 timeout, = -1 error*/ -- int (*set_frontend_asyncwait)(struct dvb_frontend *fe, u32 timeout); -- int (*set_frontend_asyncpostproc)(struct dvb_frontend *fe, -- int asyncwait_ret); --}; -- - struct dvb_frontend_ops { - - struct dvb_frontend_info info; -@@ -330,13 +267,13 @@ struct dvb_frontend_ops { - void (*release)(struct dvb_frontend* fe); - void (*release_sec)(struct dvb_frontend* fe); - -- int (*init)(struct dvb_frontend *fe); -- int (*sleep)(struct dvb_frontend *fe); -+ int (*init)(struct dvb_frontend* fe); -+ int (*sleep)(struct dvb_frontend* fe); - -- int (*write)(struct dvb_frontend *fe, const u8 buf[], int len); -+ int (*write)(struct dvb_frontend* fe, const u8 buf[], int len); - - /* if this is set, it overrides the default swzigzag */ -- int (*tune)(struct dvb_frontend *fe, -+ int (*tune)(struct dvb_frontend* fe, - bool re_tune, - unsigned int mode_flags, - unsigned int *delay, -@@ -346,23 +283,20 @@ struct dvb_frontend_ops { - - /* these two are only used for the swzigzag code */ - int (*set_frontend)(struct dvb_frontend *fe); -- int (*get_tune_settings)(struct dvb_frontend *fe, -- struct dvb_frontend_tune_settings *settings); -+ int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings); -+ - int (*get_frontend)(struct dvb_frontend *fe); - -- int (*read_status)(struct dvb_frontend *fe, fe_status_t *status); -- int (*read_ber)(struct dvb_frontend *fe, u32 *ber); -- int (*read_signal_strength)(struct dvb_frontend *fe, u16 *strength); -- int (*read_snr)(struct dvb_frontend *fe, u16 *snr); -- int (*read_ucblocks)(struct dvb_frontend *fe, u32 *ucblocks); -- int (*set_qam_mode)(struct dvb_frontend *fe); -- int (*diseqc_reset_overload)(struct dvb_frontend *fe); -- int (*diseqc_send_master_cmd)(struct dvb_frontend *fe, -- struct dvb_diseqc_master_cmd *cmd); -- int (*diseqc_recv_slave_reply)(struct dvb_frontend *fe, -- struct dvb_diseqc_slave_reply *reply); -- int (*diseqc_send_burst)(struct dvb_frontend *fe, -- fe_sec_mini_cmd_t minicmd); -+ int (*read_status)(struct dvb_frontend* fe, fe_status_t* status); -+ int (*read_ber)(struct dvb_frontend* fe, u32* ber); -+ int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength); -+ int (*read_snr)(struct dvb_frontend* fe, u16* snr); -+ int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks); -+ -+ int (*diseqc_reset_overload)(struct dvb_frontend* fe); -+ int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd); -+ int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply); -+ int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd); - int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone); - int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); - int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg); -@@ -375,23 +309,15 @@ struct dvb_frontend_ops { - * tuning algorithms, rather than a simple swzigzag - */ - enum dvbfe_search (*search)(struct dvb_frontend *fe); -- int (*track)(struct dvb_frontend *fe, -- struct dvb_frontend_parameters *p); -+ - struct dvb_tuner_ops tuner_ops; - struct analog_demod_ops analog_ops; - -- int (*set_property)(struct dvb_frontend *fe, struct dtv_property *tvp); -- int (*get_property)(struct dvb_frontend *fe, struct dtv_property *tvp); -- -- struct dvbsx_blindscan_ops blindscan_ops; -- -- int (*set_mode)(struct dvb_frontend *fe, fe_type_t type); -- int (*read_ts)(struct dvb_frontend *fe, int *ts); -- int (*read_dtmb_fsm)(struct dvb_frontend *fe, u32 *fsm_status); -- -- struct dvb_frontend_asyncinfo asyncinfo; -+ int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp); -+ int (*get_property)(struct dvb_frontend* fe, struct dtv_property* tvp); - }; - -+#ifdef __DVB_CORE__ - #define MAX_EVENT 8 - - struct dvb_fe_events { -@@ -402,17 +328,7 @@ struct dvb_fe_events { - wait_queue_head_t wait_queue; - struct mutex mtx; - }; -- --#define MAX_BLINDSCAN_EVENT 32 -- --struct dvbsx_blindscan_events { -- struct dvbsx_blindscanevent events[MAX_BLINDSCAN_EVENT]; -- int eventw; -- int eventr; -- int overflow; -- wait_queue_head_t wait_queue; -- struct mutex mtx; --}; -+#endif - - struct dtv_frontend_properties { - -@@ -428,7 +344,7 @@ struct dtv_frontend_properties { - fe_code_rate_t fec_inner; - fe_transmit_mode_t transmission_mode; - u32 bandwidth_hz; /* 0 = AUTO */ -- fe_guard_interval_t guard_interval; -+ fe_guard_interval_t guard_interval; - fe_hierarchy_t hierarchy; - u32 symbol_rate; - fe_code_rate_t code_rate_HP; -@@ -437,8 +353,6 @@ struct dtv_frontend_properties { - fe_pilot_t pilot; - fe_rolloff_t rolloff; - -- enum fe_ofdm_mode ofdm_mode; -- - fe_delivery_system_t delivery_system; - - enum fe_interleaving interleaving; -@@ -460,11 +374,6 @@ struct dtv_frontend_properties { - /* Multistream specifics */ - u32 stream_id; - -- u32 dvbt2_plp_id; -- -- /* Analog specifics */ -- struct dvb_analog_parameters analog; -- struct dvb_analog_parameters param; - /* ATSC-MH specifics */ - u8 atscmh_fic_ver; - u8 atscmh_parade_id; -diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c -index dbffaa0..983db75 100644 ---- a/drivers/media/dvb-core/dvbdev.c -+++ b/drivers/media/dvb-core/dvbdev.c -@@ -47,7 +47,7 @@ static DEFINE_MUTEX(dvbdev_register_lock); - - static const char * const dnames[] = { - "video", "audio", "sec", "frontend", "demux", "dvr", "ca", -- "net", "osd", "dsc" -+ "net", "osd" - }; - - #ifdef CONFIG_DVB_DYNAMIC_MINORS -@@ -74,22 +74,15 @@ static int dvb_device_open(struct inode *inode, struct file *file) - - if (dvbdev && dvbdev->fops) { - int err = 0; -- const struct file_operations *old_fops; -+ const struct file_operations *new_fops; - -- file->private_data = dvbdev; -- old_fops = file->f_op; -- file->f_op = fops_get(dvbdev->fops); -- if (file->f_op == NULL) { -- file->f_op = old_fops; -+ new_fops = fops_get(dvbdev->fops); -+ if (!new_fops) - goto fail; -- } -+ file->private_data = dvbdev; -+ replace_fops(file, new_fops); - if (file->f_op->open) - err = file->f_op->open(inode,file); -- if (err) { -- fops_put(file->f_op); -- file->f_op = fops_get(old_fops); -- } -- fops_put(old_fops); - up_read(&minor_rwsem); - mutex_unlock(&dvbdev_mutex); - return err; -diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h -index d2bee9c..93a9470 100644 ---- a/drivers/media/dvb-core/dvbdev.h -+++ b/drivers/media/dvb-core/dvbdev.h -@@ -47,7 +47,6 @@ - #define DVB_DEVICE_CA 6 - #define DVB_DEVICE_NET 7 - #define DVB_DEVICE_OSD 8 --#define DVB_DEVICE_DSC 9 - - #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \ - static short adapter_nr[] = \ -diff --git a/include/uapi/linux/dvb/aml_demod.h b/include/uapi/linux/dvb/aml_demod.h -deleted file mode 100644 -index 96990a5..0000000 ---- a/include/uapi/linux/dvb/aml_demod.h -+++ /dev/null -@@ -1,214 +0,0 @@ --#ifndef AML_DEMOD_H --#define AML_DEMOD_H --#ifndef CONFIG_AM_DEMOD_FPGA_VER --#define CONFIG_AM_DEMOD_FPGA_VER --#endif /*CONFIG_AM_DEMOD_FPGA_VER */ -- --/*#include */ --#define u8_t u8 --#define u16_t u16 --#define u32_t u32 --#define u64_t u64 -- --struct aml_demod_i2c { -- u8_t tuner; /*type */ -- u8_t addr; /*slave addr */ -- u32_t scl_oe; -- u32_t scl_out; -- u32_t scl_in; -- u8_t scl_bit; -- u32_t sda_oe; -- u32_t sda_out; -- u32_t sda_in; -- u8_t sda_bit; -- u8_t udelay; /*us */ -- u8_t retries; -- u8_t debug; /*1:debug */ -- u8_t tmp; /*spare */ -- u8_t i2c_id; -- void *i2c_priv; --}; -- --struct aml_tuner_sys { -- u8_t mode; -- u8_t amp; -- u8_t if_agc_speed; -- u32_t ch_freq; -- u32_t if_freq; -- u32_t rssi; -- u32_t delay; -- u8_t bandwith; --}; -- --struct aml_demod_sys { -- u8_t clk_en; /* 1:on */ -- u8_t clk_src; /*2 bits */ -- u8_t clk_div; /*7 bits */ -- u8_t pll_n; /*5 bits */ -- u16_t pll_m; /*9 bits */ -- u8_t pll_od; /*7 bits */ -- u8_t pll_sys_xd; /*5 bits */ -- u8_t pll_adc_xd; /*5 bits */ -- u8_t agc_sel; /*pin mux */ -- u8_t adc_en; /*1:on */ -- u8_t debug; /*1:debug */ -- u32_t i2c; /*pointer */ -- u32_t adc_clk; -- u32_t demod_clk; --}; -- --struct aml_demod_sts { -- u32_t ch_sts; -- u32_t freq_off; /*Hz */ -- u32_t ch_pow; -- u32_t ch_snr; -- u32_t ch_ber; -- u32_t ch_per; -- u32_t symb_rate; -- u32_t dat0; -- u32_t dat1; --}; -- --struct aml_demod_sta { -- u8_t clk_en; /*on/off */ -- u8_t adc_en; /*on/off */ -- u32_t clk_freq; /*kHz */ -- u32_t adc_freq; /*kHz */ -- u8_t dvb_mode; /*dvb-t/c mode */ -- u8_t ch_mode; /* 16,32,..,256QAM or 2K,4K,8K */ -- u8_t agc_mode; /*if, rf or both. */ -- u8_t tuner; /*type */ -- u32_t ch_freq; /*kHz */ -- u16_t ch_if; /*kHz */ -- u16_t ch_bw; /*kHz */ -- u16_t symb_rate; /*kHz */ -- u8_t debug; -- u8_t tmp; -- u32_t sts; /*pointer */ -- u8_t spectrum; --}; -- --struct aml_demod_dvbc { -- u8_t mode; -- u8_t tmp; -- u16_t symb_rate; -- u32_t ch_freq; -- u32_t dat0; -- u32_t dat1; --}; -- --struct aml_demod_dvbt { -- u8_t bw; -- u8_t sr; -- u8_t ifreq; -- u8_t agc_mode; -- u32_t ch_freq; -- u32_t dat0; -- u32_t dat1; -- u32_t layer; -- --}; -- --struct aml_demod_dtmb { -- u8_t bw; -- u8_t sr; -- u8_t ifreq; -- u8_t agc_mode; -- u32_t ch_freq; -- u32_t dat0; -- u32_t dat1; -- u32_t mode; -- --}; -- --struct aml_demod_atsc { -- u8_t bw; -- u8_t sr; -- u8_t ifreq; -- u8_t agc_mode; -- u32_t ch_freq; -- u32_t dat0; -- u32_t dat1; -- u32_t mode; -- --}; -- --struct aml_demod_mem { -- u32_t addr; -- u32_t dat; -- --}; -- --struct aml_cap_data { -- u32_t cap_addr; -- u32_t cap_size; -- u32_t cap_afifo; -- char *cap_dev_name; --}; -- --struct aml_demod_reg { -- u8_t mode; -- u8_t rw; /* 0: read, 1: write. */ -- u32_t addr; -- u32_t val; --/* u32_t val_high;*/ --}; -- --struct aml_demod_regs { -- u8_t mode; -- u8_t rw; /* 0: read, 1: write. */ -- u32_t addr; -- u32_t addr_len; -- u32_t n; -- u32_t vals[1]; /*[mode i2c]: write:n*u32_t, read:n*u8_t */ --}; --struct fpga_m1_sdio { -- unsigned long addr; -- unsigned long byte_count; -- unsigned char *data_buf; --}; -- --#define AML_DEMOD_SET_SYS _IOW('D', 0, struct aml_demod_sys) --#define AML_DEMOD_GET_SYS _IOR('D', 1, struct aml_demod_sys) --#define AML_DEMOD_TEST _IOR('D', 2, u32_t) --#define AML_DEMOD_TURN_ON _IOR('D', 3, u32_t) --#define AML_DEMOD_TURN_OFF _IOR('D', 4, u32_t) --#define AML_DEMOD_SET_TUNER _IOW('D', 5, struct aml_tuner_sys) --#define AML_DEMOD_GET_RSSI _IOR('D', 6, struct aml_tuner_sys) -- --#define AML_DEMOD_DVBC_SET_CH _IOW('D', 10, struct aml_demod_dvbc) --#define AML_DEMOD_DVBC_GET_CH _IOR('D', 11, struct aml_demod_dvbc) --#define AML_DEMOD_DVBC_TEST _IOR('D', 12, u32_t) -- --#define AML_DEMOD_DVBT_SET_CH _IOW('D', 20, struct aml_demod_dvbt) --#define AML_DEMOD_DVBT_GET_CH _IOR('D', 21, struct aml_demod_dvbt) --#define AML_DEMOD_DVBT_TEST _IOR('D', 22, u32_t) -- --#define AML_DEMOD_DTMB_SET_CH _IOW('D', 50, struct aml_demod_dtmb) --#define AML_DEMOD_DTMB_GET_CH _IOR('D', 51, struct aml_demod_dtmb) --#define AML_DEMOD_DTMB_TEST _IOR('D', 52, u32_t) -- --#define AML_DEMOD_ATSC_SET_CH _IOW('D', 60, struct aml_demod_atsc) --#define AML_DEMOD_ATSC_GET_CH _IOR('D', 61, struct aml_demod_atsc) --#define AML_DEMOD_ATSC_TEST _IOR('D', 62, u32_t) --#define AML_DEMOD_ATSC_IRQ _IOR('D', 63, u32_t) -- --#define AML_DEMOD_RESET_MEM _IOR('D', 70, u32_t) --#define AML_DEMOD_READ_MEM _IOR('D', 71, u32_t) --#define AML_DEMOD_SET_MEM _IOR('D', 72, struct aml_demod_mem) -- --#define AML_DEMOD_SET_REG _IOW('D', 30, struct aml_demod_reg) --#define AML_DEMOD_GET_REG _IOR('D', 31, struct aml_demod_reg) --/* #define AML_DEMOD_SET_REGS _IOW('D', 32, struct aml_demod_regs)*/ --/*#define AML_DEMOD_GET_REGS _IOR('D', 33, struct aml_demod_regs)*/ --#define FPGA2M1_SDIO_WR_DDR _IOW('D', 40, struct fpga_m1_sdio) --#define FPGA2M1_SDIO_RD_DDR _IOR('D', 41, struct fpga_m1_sdio) --#define FPGA2M1_SDIO_INIT _IO('D', 42) --#define FPGA2M1_SDIO_EXIT _IO('D', 43) -- --int read_memory_to_file(struct aml_cap_data *cap); --int read_reg(int addr); --void wait_capture(int cap_cur_addr, int depth_MB, int start); --int cap_adc_data(struct aml_cap_data *cap); -- --#endif /* AML_DEMOD_H */ -diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h -index 029400a..b4fb650 100644 ---- a/include/uapi/linux/dvb/dmx.h -+++ b/include/uapi/linux/dvb/dmx.h -@@ -29,25 +29,30 @@ - #include - #endif - -+ - #define DMX_FILTER_SIZE 16 - --enum dmx_output_t { -- DMX_OUT_DECODER, /* Streaming directly to decoder. */ -- DMX_OUT_TAP, /* Output going to a memory buffer */ -- /* (to be retrieved via the read command). */ -- DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */ -- /* (to be retrieved by reading from the */ -- /* logical DVR device). */ -- DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved */ -- /*from the DMX device */ --}; -+typedef enum -+{ -+ DMX_OUT_DECODER, /* Streaming directly to decoder. */ -+ DMX_OUT_TAP, /* Output going to a memory buffer */ -+ /* (to be retrieved via the read command).*/ -+ DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */ -+ /* (to be retrieved by reading from the */ -+ /* logical DVR device). */ -+ DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */ -+} dmx_output_t; - --enum dmx_input_t { -- DMX_IN_FRONTEND, /* Input from a front-end device. */ -- DMX_IN_DVR /* Input from the logical DVR device. */ --}; - --enum dmx_ts_pes { -+typedef enum -+{ -+ DMX_IN_FRONTEND, /* Input from a front-end device. */ -+ DMX_IN_DVR /* Input from the logical DVR device. */ -+} dmx_input_t; -+ -+ -+typedef enum dmx_ts_pes -+{ - DMX_PES_AUDIO0, - DMX_PES_VIDEO0, - DMX_PES_TELETEXT0, -@@ -73,7 +78,7 @@ enum dmx_ts_pes { - DMX_PES_PCR3, - - DMX_PES_OTHER --}; -+} dmx_pes_type_t; - - #define DMX_PES_AUDIO DMX_PES_AUDIO0 - #define DMX_PES_VIDEO DMX_PES_VIDEO0 -@@ -81,31 +86,35 @@ enum dmx_ts_pes { - #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 - #define DMX_PES_PCR DMX_PES_PCR0 - --struct dmx_filter { -- __u8 filter[DMX_FILTER_SIZE]; -- __u8 mask[DMX_FILTER_SIZE]; -- __u8 mode[DMX_FILTER_SIZE]; --}; - --struct dmx_sct_filter_params { -- __u16 pid; -- struct dmx_filter filter; -- __u32 timeout; -- __u32 flags; -+typedef struct dmx_filter -+{ -+ __u8 filter[DMX_FILTER_SIZE]; -+ __u8 mask[DMX_FILTER_SIZE]; -+ __u8 mode[DMX_FILTER_SIZE]; -+} dmx_filter_t; -+ -+ -+struct dmx_sct_filter_params -+{ -+ __u16 pid; -+ dmx_filter_t filter; -+ __u32 timeout; -+ __u32 flags; - #define DMX_CHECK_CRC 1 - #define DMX_ONESHOT 2 - #define DMX_IMMEDIATE_START 4 - #define DMX_KERNEL_CLIENT 0x8000 --#define DMX_USE_SWFILTER 0x100 -- - }; - --struct dmx_pes_filter_params { -- __u16 pid; -- enum dmx_input_t input; -- enum dmx_output_t output; -- enum dmx_ts_pes pes_type; -- __u32 flags; -+ -+struct dmx_pes_filter_params -+{ -+ __u16 pid; -+ dmx_input_t input; -+ dmx_output_t output; -+ dmx_pes_type_t pes_type; -+ __u32 flags; - }; - - typedef struct dmx_caps { -@@ -113,19 +122,16 @@ typedef struct dmx_caps { - int num_decoders; - } dmx_caps_t; - --enum dmx_source_t { -+typedef enum { - DMX_SOURCE_FRONT0 = 0, - DMX_SOURCE_FRONT1, - DMX_SOURCE_FRONT2, - DMX_SOURCE_FRONT3, -- DMX_SOURCE_DVR0 = 16, -+ DMX_SOURCE_DVR0 = 16, - DMX_SOURCE_DVR1, - DMX_SOURCE_DVR2, -- DMX_SOURCE_DVR3, -- DMX_SOURCE_FRONT0_OFFSET = 100, -- DMX_SOURCE_FRONT1_OFFSET, -- DMX_SOURCE_FRONT2_OFFSET --}; -+ DMX_SOURCE_DVR3 -+} dmx_source_t; - - struct dmx_stc { - unsigned int num; /* input : which STC? 0..N */ -@@ -133,6 +139,7 @@ struct dmx_stc { - __u64 stc; /* output: stc in 'base'*90 kHz units */ - }; - -+ - #define DMX_START _IO('o', 41) - #define DMX_STOP _IO('o', 42) - #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) -@@ -140,7 +147,7 @@ struct dmx_stc { - #define DMX_SET_BUFFER_SIZE _IO('o', 45) - #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) - #define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) --#define DMX_SET_SOURCE _IOW('o', 49, enum dmx_source_t) -+#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) - #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) - #define DMX_ADD_PID _IOW('o', 51, __u16) - #define DMX_REMOVE_PID _IOW('o', 52, __u16) -diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h -index 9f9e75b..c56d77c 100644 ---- a/include/uapi/linux/dvb/frontend.h -+++ b/include/uapi/linux/dvb/frontend.h -@@ -27,115 +27,101 @@ - #define _DVBFRONTEND_H_ - - #include --#include - - typedef enum fe_type { - FE_QPSK, - FE_QAM, - FE_OFDM, -- FE_ATSC, -- FE_ANALOG, -- FE_DTMB, -- FE_ISDBT -+ FE_ATSC - } fe_type_t; - --enum fe_layer { -- Layer_A_B_C, -- Layer_A, -- Layer_B, -- Layer_C, --}; - --enum fe_caps { -- FE_IS_STUPID = 0, -- FE_CAN_INVERSION_AUTO = 0x1, -- FE_CAN_FEC_1_2 = 0x2, -- FE_CAN_FEC_2_3 = 0x4, -- FE_CAN_FEC_3_4 = 0x8, -- FE_CAN_FEC_4_5 = 0x10, -- FE_CAN_FEC_5_6 = 0x20, -- FE_CAN_FEC_6_7 = 0x40, -- FE_CAN_FEC_7_8 = 0x80, -- FE_CAN_FEC_8_9 = 0x100, -- FE_CAN_FEC_AUTO = 0x200, -- FE_CAN_QPSK = 0x400, -- FE_CAN_QAM_16 = 0x800, -- FE_CAN_QAM_32 = 0x1000, -- FE_CAN_QAM_64 = 0x2000, -- FE_CAN_QAM_128 = 0x4000, -- FE_CAN_QAM_256 = 0x8000, -- FE_CAN_QAM_AUTO = 0x10000, -- FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, -- FE_CAN_BANDWIDTH_AUTO = 0x40000, -- FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, -- FE_CAN_HIERARCHY_AUTO = 0x100000, -- FE_CAN_8VSB = 0x200000, -- FE_CAN_16VSB = 0x400000, -- FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for*/ -- /* newer APIs, indicate this. */ -- FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports */ -- /*multistream filtering */ -- FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports */ -- /*"turbo fec modulation" */ -- FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports */ -- /*"2nd generation modulation" (DVB-S2) */ -- FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't */ -- /*use (frontend requires frequency bending) */ -- FE_CAN_RECOVER = 0x40000000, /* frontend can recover from */ -- /*a cable unplug automatically */ -- FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop */ -- /*spurious TS data output */ --}; -+typedef enum fe_caps { -+ FE_IS_STUPID = 0, -+ FE_CAN_INVERSION_AUTO = 0x1, -+ FE_CAN_FEC_1_2 = 0x2, -+ FE_CAN_FEC_2_3 = 0x4, -+ FE_CAN_FEC_3_4 = 0x8, -+ FE_CAN_FEC_4_5 = 0x10, -+ FE_CAN_FEC_5_6 = 0x20, -+ FE_CAN_FEC_6_7 = 0x40, -+ FE_CAN_FEC_7_8 = 0x80, -+ FE_CAN_FEC_8_9 = 0x100, -+ FE_CAN_FEC_AUTO = 0x200, -+ FE_CAN_QPSK = 0x400, -+ FE_CAN_QAM_16 = 0x800, -+ FE_CAN_QAM_32 = 0x1000, -+ FE_CAN_QAM_64 = 0x2000, -+ FE_CAN_QAM_128 = 0x4000, -+ FE_CAN_QAM_256 = 0x8000, -+ FE_CAN_QAM_AUTO = 0x10000, -+ FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, -+ FE_CAN_BANDWIDTH_AUTO = 0x40000, -+ FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, -+ FE_CAN_HIERARCHY_AUTO = 0x100000, -+ FE_CAN_8VSB = 0x200000, -+ FE_CAN_16VSB = 0x400000, -+ FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ -+ FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */ -+ FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ -+ FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ -+ FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ -+ FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ -+ FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ -+} fe_caps_t; - --#define FE_CAN_3_LAYER FE_CAN_MULTISTREAM - - struct dvb_frontend_info { -- char name[128]; -- /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ -- enum fe_type type; -- __u32 frequency_min; -- __u32 frequency_max; -- __u32 frequency_stepsize; -- __u32 frequency_tolerance; -- __u32 symbol_rate_min; -- __u32 symbol_rate_max; -- __u32 symbol_rate_tolerance; /* ppm */ -- __u32 notifier_delay; /* DEPRECATED */ -- enum fe_caps caps; -+ char name[128]; -+ fe_type_t type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ -+ __u32 frequency_min; -+ __u32 frequency_max; -+ __u32 frequency_stepsize; -+ __u32 frequency_tolerance; -+ __u32 symbol_rate_min; -+ __u32 symbol_rate_max; -+ __u32 symbol_rate_tolerance; /* ppm */ -+ __u32 notifier_delay; /* DEPRECATED */ -+ fe_caps_t caps; - }; - -+ - /** - * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for - * the meaning of this struct... - */ - struct dvb_diseqc_master_cmd { -- __u8 msg[6]; /* { framing, address, command, data [3] } */ -- __u8 msg_len; /* valid values are 3...6 */ -+ __u8 msg [6]; /* { framing, address, command, data [3] } */ -+ __u8 msg_len; /* valid values are 3...6 */ - }; - -+ - struct dvb_diseqc_slave_reply { -- __u8 msg[4]; /* { framing, data [3] } */ -- __u8 msg_len; /* valid values are 0...4, 0 means no msg */ -- int timeout; /* return from ioctl after timeout ms with */ --}; /* errorcode when no message was received */ -+ __u8 msg [4]; /* { framing, data [3] } */ -+ __u8 msg_len; /* valid values are 0...4, 0 means no msg */ -+ int timeout; /* return from ioctl after timeout ms with */ -+}; /* errorcode when no message was received */ -+ - - typedef enum fe_sec_voltage { - SEC_VOLTAGE_13, - SEC_VOLTAGE_18, -- SEC_VOLTAGE_OFF, -- SEC_VOLTAGE_ON /*for ISDBT antenna control */ -+ SEC_VOLTAGE_OFF - } fe_sec_voltage_t; - -+ - typedef enum fe_sec_tone_mode { - SEC_TONE_ON, - SEC_TONE_OFF - } fe_sec_tone_mode_t; - -+ - typedef enum fe_sec_mini_cmd { - SEC_MINI_A, - SEC_MINI_B - } fe_sec_mini_cmd_t; - -+ - /** - * enum fe_status - enumerates the possible frontend status - * @FE_HAS_SIGNAL: found something above the noise level -@@ -149,15 +135,14 @@ typedef enum fe_sec_mini_cmd { - */ - - typedef enum fe_status { -- FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ -- FE_HAS_CARRIER = 0x02, /* found a DVB signal */ -- FE_HAS_VITERBI = 0x04, /* FEC is stable */ -- FE_HAS_SYNC = 0x08, /* found sync bytes */ -- FE_HAS_LOCK = 0x10, /* everything's working... */ -- FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ -- FE_REINIT = 0x40 /* frontend was reinitialized, */ --} fe_status_t; /* application is recommended to reset */ -- /* DiSEqC, tone and parameters */ -+ FE_HAS_SIGNAL = 0x01, -+ FE_HAS_CARRIER = 0x02, -+ FE_HAS_VITERBI = 0x04, -+ FE_HAS_SYNC = 0x08, -+ FE_HAS_LOCK = 0x10, -+ FE_TIMEDOUT = 0x20, -+ FE_REINIT = 0x40, -+} fe_status_t; - - typedef enum fe_spectral_inversion { - INVERSION_OFF, -@@ -165,6 +150,7 @@ typedef enum fe_spectral_inversion { - INVERSION_AUTO - } fe_spectral_inversion_t; - -+ - typedef enum fe_code_rate { - FEC_NONE = 0, - FEC_1_2, -@@ -181,6 +167,7 @@ typedef enum fe_code_rate { - FEC_2_5, - } fe_code_rate_t; - -+ - typedef enum fe_modulation { - QPSK, - QAM_16, -@@ -210,8 +197,8 @@ typedef enum fe_transmit_mode { - TRANSMISSION_MODE_C3780, - } fe_transmit_mode_t; - --/*#if defined(__DVB_CORE__) || !defined (__KERNEL__)*/ --enum fe_bandwidth { -+#if defined(__DVB_CORE__) || !defined (__KERNEL__) -+typedef enum fe_bandwidth { - BANDWIDTH_8_MHZ, - BANDWIDTH_7_MHZ, - BANDWIDTH_6_MHZ, -@@ -219,8 +206,8 @@ enum fe_bandwidth { - BANDWIDTH_5_MHZ, - BANDWIDTH_10_MHZ, - BANDWIDTH_1_712_MHZ, --}; --/*#endif*/ -+} fe_bandwidth_t; -+#endif - - typedef enum fe_guard_interval { - GUARD_INTERVAL_1_32, -@@ -236,6 +223,7 @@ typedef enum fe_guard_interval { - GUARD_INTERVAL_PN945, - } fe_guard_interval_t; - -+ - typedef enum fe_hierarchy { - HIERARCHY_NONE, - HIERARCHY_1, -@@ -251,70 +239,42 @@ enum fe_interleaving { - INTERLEAVING_720, - }; - --enum fe_ofdm_mode { -- OFDM_DVBT, -- OFDM_DVBT2, --}; -- --/*#if defined(__DVB_CORE__) || !defined (__KERNEL__)*/ -+#if defined(__DVB_CORE__) || !defined (__KERNEL__) - struct dvb_qpsk_parameters { -- __u32 symbol_rate; /* symbol rate in Symbols per second */ -- /* forward error correction (see above) */ -- enum fe_code_rate fec_inner; -+ __u32 symbol_rate; /* symbol rate in Symbols per second */ -+ fe_code_rate_t fec_inner; /* forward error correction (see above) */ - }; - - struct dvb_qam_parameters { -- /* symbol rate in Symbols per second */ -- __u32 symbol_rate; -- /* forward error correction (see above) */ -- enum fe_code_rate fec_inner; -- /* modulation type (see above) */ -- enum fe_modulation modulation; -+ __u32 symbol_rate; /* symbol rate in Symbols per second */ -+ fe_code_rate_t fec_inner; /* forward error correction (see above) */ -+ fe_modulation_t modulation; /* modulation type (see above) */ - }; - - struct dvb_vsb_parameters { -- enum fe_modulation modulation; /* modulation type (see above) */ -+ fe_modulation_t modulation; /* modulation type (see above) */ - }; - - struct dvb_ofdm_parameters { -- enum fe_bandwidth bandwidth; -- /* high priority stream code rate */ -- enum fe_code_rate code_rate_HP; -- /* low priority stream code rate */ -- enum fe_code_rate code_rate_LP; -- /* modulation type (see above) */ -- enum fe_modulation constellation; -- enum fe_transmit_mode transmission_mode; -- enum fe_guard_interval guard_interval; -- enum fe_hierarchy hierarchy_information; -- enum fe_ofdm_mode ofdm_mode; -+ fe_bandwidth_t bandwidth; -+ fe_code_rate_t code_rate_HP; /* high priority stream code rate */ -+ fe_code_rate_t code_rate_LP; /* low priority stream code rate */ -+ fe_modulation_t constellation; /* modulation type (see above) */ -+ fe_transmit_mode_t transmission_mode; -+ fe_guard_interval_t guard_interval; -+ fe_hierarchy_t hierarchy_information; - }; - --#define ANALOG_FLAG_ENABLE_AFC 0X00000001 --#define ANALOG_FLAG_MANUL_SCAN 0x00000011 --struct dvb_analog_parameters { -- /*V4L2_TUNER_MODE_MONO,V4L2_TUNER_MODE_STEREO, -- V4L2_TUNER_MODE_LANG2,V4L2_TUNER_MODE_SAP, -- V4L2_TUNER_MODE_LANG1,V4L2_TUNER_MODE_LANG1_LANG2 */ -- unsigned int audmode; -- unsigned int soundsys; /*A2,BTSC,EIAJ,NICAM */ -- v4l2_std_id std; -- unsigned int flag; -- unsigned int afc_range; -- unsigned int reserved; --}; - - struct dvb_frontend_parameters { -- /* (absolute) frequency in Hz for QAM/OFDM/ATSC */ -- __u32 frequency; -- /* intermediate frequency in kHz for QPSK */ -+ __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */ -+ /* intermediate frequency in kHz for QPSK */ - fe_spectral_inversion_t inversion; - union { - struct dvb_qpsk_parameters qpsk; -- struct dvb_qam_parameters qam; -+ struct dvb_qam_parameters qam; - struct dvb_ofdm_parameters ofdm; - struct dvb_vsb_parameters vsb; -- struct dvb_analog_parameters analog; - } u; - }; - -@@ -322,7 +282,7 @@ struct dvb_frontend_event { - fe_status_t status; - struct dvb_frontend_parameters parameters; - }; --/*#endif*/ -+#endif - - /* S2API Commands */ - #define DTV_UNDEFINED 0 -@@ -385,8 +345,6 @@ struct dvb_frontend_event { - - #define DTV_ENUM_DELSYS 44 - --#define DTV_DVBT2_PLP_ID DTV_DVBT2_PLP_ID_LEGACY -- - /* ATSC-MH */ - #define DTV_ATSCMH_FIC_VER 45 - #define DTV_ATSCMH_PARADE_ID 46 -@@ -417,9 +375,7 @@ struct dvb_frontend_event { - #define DTV_STAT_ERROR_BLOCK_COUNT 68 - #define DTV_STAT_TOTAL_BLOCK_COUNT 69 - --#define DTV_DVBT2_DATA_PLPS 70 -- --#define DTV_MAX_COMMAND DTV_DVBT2_DATA_PLPS -+#define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT - - typedef enum fe_pilot { - PILOT_ON, -@@ -428,7 +384,7 @@ typedef enum fe_pilot { - } fe_pilot_t; - - typedef enum fe_rolloff { -- ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ -+ ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ - ROLLOFF_20, - ROLLOFF_25, - ROLLOFF_AUTO, -@@ -452,59 +408,58 @@ typedef enum fe_delivery_system { - SYS_CMMB, - SYS_DAB, - SYS_DVBT2, -- SYS_ANALOG, - SYS_TURBO, -- SYS_DVBC_ANNEX_C -+ SYS_DVBC_ANNEX_C, - } fe_delivery_system_t; - - /* backward compatibility */ - #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A --#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */ -+#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */ - - /* ATSC-MH */ - - enum atscmh_sccc_block_mode { -- ATSCMH_SCCC_BLK_SEP = 0, -- ATSCMH_SCCC_BLK_COMB = 1, -- ATSCMH_SCCC_BLK_RES = 2, -+ ATSCMH_SCCC_BLK_SEP = 0, -+ ATSCMH_SCCC_BLK_COMB = 1, -+ ATSCMH_SCCC_BLK_RES = 2, - }; - - enum atscmh_sccc_code_mode { -- ATSCMH_SCCC_CODE_HLF = 0, -- ATSCMH_SCCC_CODE_QTR = 1, -- ATSCMH_SCCC_CODE_RES = 2, -+ ATSCMH_SCCC_CODE_HLF = 0, -+ ATSCMH_SCCC_CODE_QTR = 1, -+ ATSCMH_SCCC_CODE_RES = 2, - }; - - enum atscmh_rs_frame_ensemble { -- ATSCMH_RSFRAME_ENS_PRI = 0, -- ATSCMH_RSFRAME_ENS_SEC = 1, -+ ATSCMH_RSFRAME_ENS_PRI = 0, -+ ATSCMH_RSFRAME_ENS_SEC = 1, - }; - - enum atscmh_rs_frame_mode { -- ATSCMH_RSFRAME_PRI_ONLY = 0, -- ATSCMH_RSFRAME_PRI_SEC = 1, -- ATSCMH_RSFRAME_RES = 2, -+ ATSCMH_RSFRAME_PRI_ONLY = 0, -+ ATSCMH_RSFRAME_PRI_SEC = 1, -+ ATSCMH_RSFRAME_RES = 2, - }; - - enum atscmh_rs_code_mode { -- ATSCMH_RSCODE_211_187 = 0, -- ATSCMH_RSCODE_223_187 = 1, -- ATSCMH_RSCODE_235_187 = 2, -- ATSCMH_RSCODE_RES = 3, -+ ATSCMH_RSCODE_211_187 = 0, -+ ATSCMH_RSCODE_223_187 = 1, -+ ATSCMH_RSCODE_235_187 = 2, -+ ATSCMH_RSCODE_RES = 3, - }; - - #define NO_STREAM_ID_FILTER (~0U) - #define LNA_AUTO (~0U) - - struct dtv_cmds_h { -- char *name; /* A display name for debugging purposes */ -+ char *name; /* A display name for debugging purposes */ - -- __u32 cmd; /* A unique ID */ -+ __u32 cmd; /* A unique ID */ - - /* Flags */ -- __u32 set:1; /* Either a set or get property */ -- __u32 buffer:1; /* Does this property use the buffer? */ -- __u32 reserved:30; /* Align */ -+ __u32 set:1; /* Either a set or get property */ -+ __u32 buffer:1; /* Does this property use the buffer? */ -+ __u32 reserved:30; /* Align */ - }; - - /** -@@ -558,13 +513,14 @@ enum fecap_scale_params { - * u.st.len = 4; - */ - struct dtv_stats { -- __u8 scale; /* enum fecap_scale_params type */ -+ __u8 scale; /* enum fecap_scale_params type */ - union { - __u64 uvalue; /* for counters and relative scales */ - __s64 svalue; /* for 0.0001 dB measures */ - }; - } __attribute__ ((packed)); - -+ - #define MAX_DTV_STATS 4 - - struct dtv_fe_stats { -@@ -584,7 +540,6 @@ struct dtv_property { - __u32 reserved1[3]; - void *reserved2; - } buffer; -- __u32 reserved[14]; - } u; - int result; - } __attribute__ ((packed)); -@@ -594,113 +549,12 @@ struct dtv_property { - - struct dtv_properties { - __u32 num; -- union { -- struct dtv_property *props; -- __u64 reserved; -- }; --}; --/* for atv */ --struct tuner_status_s { -- unsigned int frequency; -- unsigned int rssi; -- unsigned char mode; /*dtv:0 or atv:1 */ -- unsigned char tuner_locked; /*notlocked:0,locked:1 */ -- union { -- void *ressrved; -- __u64 reserved1; -- }; --}; -- --struct atv_status_s { -- unsigned char atv_lock; /*notlocked:0,locked 1 */ -- v4l2_std_id std; -- unsigned int audmode; -- int snr; -- int afc; -- union { -- void *resrvred; -- __u64 reserved1; -- }; --}; -- --struct sound_status_s { -- /*A2DK/A2BG/NICAM BG/NICAM DK/BTSC/EIAJ */ -- unsigned short sound_sys; -- unsigned short sound_mode; /*SETERO/DUAL/MONO/SAP */ -- union { -- void *resrvred; -- __u64 reserved1; -- }; --}; --enum tuner_param_cmd_e { -- TUNER_CMD_AUDIO_MUTE = 0x0000, -- /*0x0001 */ -- TUNER_CMD_AUDIO_ON, -- TUNER_CMD_TUNER_POWER_ON, -- TUNER_CMD_TUNER_POWER_DOWN, -- TUNER_CMD_SET_VOLUME, -- TUNER_CMD_SET_LEAP_SETP_SIZE, -- TUNER_CMD_GET_MONO_MODE, -- TUNER_CMD_SET_BEST_LOCK_RANGE, -- TUNER_CMD_GET_BEST_LOCK_RANGE, -- TUNER_CMD_SET_CVBS_AMP_OUT, -- TUNER_CMD_GET_CVBS_AMP_OUT, -- TUNER_CMD_NULL, --}; --/*parameter for set param box*/ --struct tuner_param_s { -- enum tuner_param_cmd_e cmd; -- unsigned int parm; -- unsigned int resvred; -+ struct dtv_property *props; - }; - - #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) - #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) - --/* Satellite blind scan settings */ --struct dvbsx_blindscanpara { -- /* minimum tuner frequency in kHz */ -- __u32 minfrequency; -- /* maximum tuner frequency in kHz */ -- __u32 maxfrequency; -- /* minimum symbol rate in sym/sec */ -- __u32 minSymbolRate; -- /* maximum symbol rate in sym/sec */ -- __u32 maxSymbolRate; -- /* search range in kHz. freq -/+freqRange will be searched */ -- __u32 frequencyRange; -- /* tuner step frequency in kHz */ -- __u32 frequencyStep; -- /* blindscan event timeout */ -- __s32 timeout; --}; -- --/* Satellite blind scan status */ --enum dvbsx_blindscanstatus { -- BLINDSCAN_NONEDO, -- BLINDSCAN_UPDATESTARTFREQ, -- BLINDSCAN_UPDATEPROCESS, -- BLINDSCAN_UPDATERESULTFREQ --}; -- --/* Satellite blind scan event */ --struct dvbsx_blindscanevent { -- enum dvbsx_blindscanstatus status; -- union { -- __u16 m_uiprogress; -- /* The percentage completion of the blind scan procedure. -- A value of 100 indicates that the blind scan is finished. */ -- __u32 m_uistartfreq_khz; -- /* The start scan frequency in units of kHz. -- The minimum value depends on the tuner specification. */ -- struct dvb_frontend_parameters parameters; -- /* Blind scan channel info. */ -- } u; --}; -- --#define FE_SET_BLINDSCAN _IOW('o', 84, struct dvbsx_blindscanpara) --#define FE_GET_BLINDSCANEVENT _IOR('o', 85, struct dvbsx_blindscanevent) --#define FE_SET_BLINDSCANCANCEl _IO('o', 86) - - /** - * When set, this flag will disable any zigzagging or other "normal" tuning -@@ -711,38 +565,29 @@ struct dvbsx_blindscanevent { - */ - #define FE_TUNE_MODE_ONESHOT 0x01 - -+ - #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) - - #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) - #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) - #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) --#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ -+#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ - --#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ --#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ --#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ -+#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ -+#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ -+#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ - - #define FE_READ_STATUS _IOR('o', 69, fe_status_t) - #define FE_READ_BER _IOR('o', 70, __u32) - #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) - #define FE_READ_SNR _IOR('o', 72, __u16) - #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) -+ - #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) - #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) --#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ -+#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ - #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) - --#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ -- --#define FE_SET_DELAY _IO('o', 100) -+#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ - --#define FE_SET_MODE _IO('o', 90) --#define FE_READ_AFC _IOR('o', 91, __u32) --#define FE_FINE_TUNE _IOW('o', 92, __u32) --#define FE_READ_TUNER_STATUS _IOR('o', 93, struct tuner_status_s) --#define FE_READ_ANALOG_STATUS _IOR('o', 94, struct atv_status_s) --#define FE_READ_SD_STATUS _IOR('o', 95, struct sound_status_s) --#define FE_READ_TS _IOR('o', 96, int) --/*set & get the tuner parameters only atv*/ --#define FE_SET_PARAM_BOX _IOWR('o', 97, struct tuner_param_s) - #endif /*_DVBFRONTEND_H_*/ diff --git a/projects/WeTek_Play_2/patches/linux/temporarily_use_hdmimode_param_instead_of_vout.patch b/projects/WeTek_Play_2/patches/linux/temporarily_use_hdmimode_param_instead_of_vout.patch deleted file mode 100644 index 23f6b0e9f6..0000000000 --- a/projects/WeTek_Play_2/patches/linux/temporarily_use_hdmimode_param_instead_of_vout.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/drivers/amlogic/display/logo/logo.c b/drivers/amlogic/display/logo/logo.c -index 9266be3..6803f10 100644 ---- a/drivers/amlogic/display/logo/logo.c -+++ b/drivers/amlogic/display/logo/logo.c -@@ -246,6 +246,7 @@ __setup("logo=", logo_setup); - static int __init get_hdmi_mode(char *str) - { - hdmimode = vmode_name_to_mode(str); -+ set_vout_init_vmode(str); - - pr_info("get hdmimode: %s\n", str); - return 1; -diff --git a/drivers/amlogic/display/vout/vout_serve.c b/drivers/amlogic/display/vout/vout_serve.c -index fae61b3..a248367 100644 ---- a/drivers/amlogic/display/vout/vout_serve.c -+++ b/drivers/amlogic/display/vout/vout_serve.c -@@ -664,7 +664,16 @@ static int __init get_vout_init_mode(char *str) - - return 0; - } --__setup("vout=", get_vout_init_mode); -+//__setup("vout=", get_vout_init_mode); -+ -+void set_vout_init_vmode(char *str) -+{ -+ char str2[1024]; -+ strcpy(str2, str); -+ strcat(str2, ",en"); // logo was already displayed by uboot -+ get_vout_init_mode(str2); -+} -+EXPORT_SYMBOL(set_vout_init_vmode); - - MODULE_AUTHOR("Platform-BJ "); - MODULE_DESCRIPTION("VOUT Server Module"); -diff --git a/include/linux/amlogic/vout/vout_notify.h b/include/linux/amlogic/vout/vout_notify.h -index 2e4922a..659da93 100644 ---- a/include/linux/amlogic/vout/vout_notify.h -+++ b/include/linux/amlogic/vout/vout_notify.h -@@ -102,6 +102,7 @@ extern enum vmode_e validate_vmode2(char *); - extern void set_vout2_mode_internal(char *name); - extern enum vmode_e get_logo_vmode(void); - extern int set_logo_vmode(enum vmode_e); -+extern void set_vout_init_vmode(char *); - - extern int vout2_suspend(void); - extern int vout2_resume(void); diff --git a/projects/WeTek_Play_2/patches/linux/wetek_dvb.patch b/projects/WeTek_Play_2/patches/linux/wetek_dvb.patch deleted file mode 100644 index 94eea2a5ca..0000000000 --- a/projects/WeTek_Play_2/patches/linux/wetek_dvb.patch +++ /dev/null @@ -1,46433 +0,0 @@ -diff --git a/drivers/amlogic/dvb_tv/Kconfig b/drivers/amlogic/dvb_tv/Kconfig -index 10c45ff..7b59154 100644 ---- a/drivers/amlogic/dvb_tv/Kconfig -+++ b/drivers/amlogic/dvb_tv/Kconfig -@@ -1,289 +1,14 @@ - # --# DVB driver configuration -+# WetekPlay driver configuration - # - --menu "Amlogic DVB driver" -+menu "WetekPlay driver" - - config AM_DVB -- tristate "AMLOGIC DVB driver" -+ tristate "WetekPlay driver" - default n - select DVB_CORE - help -- Select to enable AMLogic DVB driver. -- Y: enable -- N: disable -- M: build as module -- --config AM_ATVDEMOD -- tristate "Amlogic ATVDEMOD device driver" -- default n -- help -- ATVDEMOD device driver. -- Y: enable -- N: disable -- M: build as module -- --config AM_DTVDEMOD -- tristate "Amlogic DTVDEMOD device driver" -- default n -- depends on AM_DVB -- help -- DTVDEMOD device driver. -- Y: enable -- N: disable -- M: build as module --menu "AMLOGIC CI Driver" -- --config AM_CI -- tristate "Amlogic Common Interface driver" -- default n -- depends on AM_DVB -- select AM_PCMCIA -- select AM_IOBUS -- help -- Select to enable Amlogic CI driver. -- Y: enable -- N: disable -- M: build as module --config AM_PCMCIA -- tristate "Amlogic PCMCIA driver" -- default n -- help -- Select to enable Amlogic PCMCIA driver. -- Y: enable -- N: disable -- M: build as module --config AM_IOBUS -- tristate "Amlogic IOBUS driver" -- default n -- help -- Select to enable Amlogic IOBUS driver. -- Y: enable -- N: disable -- M: build as module --endmenu -- --if !OF -- --config AMLOGIC_TS0 -- bool "Enable TS0" -- default n -- depends on AM_DVB -- help -- Enable TS0. -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_S_TS0 -- bool "Serial TS0" -- default n -- depends on AMLOGIC_TS0 -- help -- TS0 in serial mode. -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS0_INVERT_S2P1_FEC_ERROR -- bool "Invert FEC_ERROR TS0" -- default n -- depends on AMLOGIC_S_TS0 -- help -- TS0 FEC_ERROR invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS0_INVERT_S2P1_FEC_DATA -- bool "Invert FEC_DATA TS0" -- default n -- depends on AMLOGIC_S_TS0 -- help -- TS0 FEC_DATA invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS0_INVERT_S2P1_FEC_SYNC -- bool "Invert FEC_SYNC TS0" -- default n -- depends on AMLOGIC_S_TS0 -- help -- TS0 FEC_SYNC invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS0_INVERT_S2P1_FEC_VALID -- bool "Invert FEC_VALID TS0" -- default n -- depends on AMLOGIC_S_TS0 -- help -- TS0 FEC_VALID invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS0_INVERT_S2P1_FEC_CLK -- bool "Invert FEC_CLK TS0" -- default n -- depends on AMLOGIC_S_TS0 -- help -- TS0 FEC_CLK invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS1 -- bool "Enable TS1" -- default n -- depends on AM_DVB -- help -- Enable TS1. -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_S_TS1 -- bool "Serial TS1" -- default n -- depends on AMLOGIC_TS1 -- help -- TS1 in serial mode. -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS1_INVERT_S2P1_FEC_ERROR -- bool "Invert FEC_ERROR TS1" -- default n -- depends on AMLOGIC_S_TS1 -- help -- TS1 FEC_ERROR invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS1_INVERT_S2P1_FEC_DATA -- bool "Invert FEC_DATA TS1" -- default n -- depends on AMLOGIC_S_TS1 -- help -- TS1 FEC_DATA invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS1_INVERT_S2P1_FEC_SYNC -- bool "Invert FEC_SYNC TS1" -- default n -- depends on AMLOGIC_S_TS1 -- help -- TS1 FEC_SYNC invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS1_INVERT_S2P1_FEC_VALID -- bool "Invert FEC_VALID TS1" -- default n -- depends on AMLOGIC_S_TS1 -- help -- TS1 FEC_VALID invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS1_INVERT_S2P1_FEC_CLK -- bool "Invert FEC_CLK TS1" -- default n -- depends on AMLOGIC_S_TS1 -- help -- TS1 FEC_CLK invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS2 -- bool "Enable TS2" -- default n -- depends on AM_DVB -- help -- Enable TS2. -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_S_TS2 -- bool "Serial TS2" -- default n -- depends on AMLOGIC_TS2 -- help -- TS2 in serial mode. -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS2_INVERT_S2P1_FEC_ERROR -- bool "Invert FEC_ERROR TS2" -- default n -- depends on AMLOGIC_S_TS2 -- help -- TS2 FEC_ERROR invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS2_INVERT_S2P1_FEC_DATA -- bool "Invert FEC_DATA TS2" -- default n -- depends on AMLOGIC_S_TS2 -- help -- TS2 FEC_DATA invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS2_INVERT_S2P1_FEC_SYNC -- bool "Invert FEC_SYNC TS2" -- default n -- depends on AMLOGIC_S_TS2 -- help -- TS2 FEC_SYNC invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS2_INVERT_S2P1_FEC_VALID -- bool "Invert FEC_VALID TS2" -- default n -- depends on AMLOGIC_S_TS2 -- help -- TS2 FEC_VALID invert -- Y: enable -- N: disable -- M: build as module --config AMLOGIC_TS2_INVERT_S2P1_FEC_CLK -- bool "Invert FEC_CLK TS2" -- default n -- depends on AMLOGIC_S_TS2 -- help -- TS2 FEC_CLK invert -- Y: enable -- N: disable -- M: build as module --endif --source "drivers/amlogic/dvb_tv/smartcard/Kconfig" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+ Select to enable WetekPlay driver. - endmenu - -diff --git a/drivers/amlogic/dvb_tv/Makefile b/drivers/amlogic/dvb_tv/Makefile -index 14f0e74..cf5a0af 100644 ---- a/drivers/amlogic/dvb_tv/Makefile -+++ b/drivers/amlogic/dvb_tv/Makefile -@@ -1,62 +1,10 @@ - # --# Makefile for the DVB driver. -+# Makefile for the WetekPlay driver. - # - --obj-$(CONFIG_AM_DVB) += aml.o -+obj-$(CONFIG_AM_DVB) += wetekplay.o - --aml-objs=aml_dvb.o aml_dmx.o -+wetekplay-objs = nimdetect.o mxl603.o avl6211.o mn88436.o cxd2841er.o ascot3.o - --obj-$(CONFIG_AM_DVB) += aml_fe.o -- --#obj-$(CONFIG_AM_CI) += amlci/ -- --obj-$(CONFIG_AM_DTVDEMOD) += amldemod/ -- --obj-$(CONFIG_AM_ATVDEMOD) += amlatvdemod/ -- --obj-$(CONFIG_AML_SMARTCARD) += smartcard/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --ccflags-y += -I. -+EXTRA_CFLAGS += -Idrivers/media/dvb-core -Idrivers/media/tuners -+EXTRA_CFLAGS += -I. -diff --git a/drivers/amlogic/dvb_tv/aml_dmx.c b/drivers/amlogic/dvb_tv/aml_dmx.c -deleted file mode 100644 -index c6ee5d0..0000000 ---- a/drivers/amlogic/dvb_tv/aml_dmx.c -+++ /dev/null -@@ -1,4573 +0,0 @@ --/* -- * AMLOGIC demux driver. -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#ifdef ARC_700 --#include --#else --#include "c_stb_define.h" --#include "c_stb_regs_define.h" --#endif -- --#include -- --#include "../amports/streambuf.h" --#include "aml_dvb.h" --#include "aml_dvb_reg.h" -- -- --#include -- --#define ENABLE_SEC_BUFF_WATCHDOG --#define USE_AHB_MODE -- --#define pr_dbg_flag(_f, _args...)\ -- do {\ -- if (debug_dmx&(_f))\ -- printk(_args);\ -- } while (0) --#define pr_dbg_irq_flag(_f, _args...)\ -- do {\ -- if (debug_irq&(_f))\ -- printk(_args);\ -- } while (0) --#define pr_dbg(args...) pr_dbg_flag(0x1, args) --#define pr_dbg_irq(args...)pr_dbg_irq_flag(0x1, args) --#define pr_dbg_irq_dvr(args...)pr_dbg_irq_flag(0x2, args) --#define pr_dbg_sf(args...) pr_dbg_flag(0x4, args) --#define pr_dbg_irq_sf(args...) pr_dbg_irq_flag(0x4, args) --#define pr_dbg_ss(args...) pr_dbg_flag(0x8, args) --#define pr_dbg_irq_ss(args...) pr_dbg_irq_flag(0x8, args) -- --#define pr_error(fmt, args...) printk("DVB: " fmt, ## args) --#define pr_inf(fmt, args...) printk("DVB: " fmt, ## args) -- --#define dump(b, l) \ -- do { \ -- int i; \ -- printk("dump: "); \ -- for (i = 0; i < (l); i++) {\ -- if (!(i&0xf)) \ -- printk("\n\t"); \ -- printk("%02x ", *(((unsigned char *)(b))+i)); \ -- } \ -- printk("\n"); \ -- } while (0) -- --MODULE_PARM_DESC(debug_dmx, "\n\t\t Enable demux debug information"); --static int debug_dmx; --module_param(debug_dmx, int, 0644); -- --MODULE_PARM_DESC(debug_irq, "\n\t\t Enable demux IRQ debug information"); --static int debug_irq; --module_param(debug_irq, int, 0644); -- --static int npids = CHANNEL_COUNT; --#define MOD_PARAM_DECLARE_CHANPIDS(_dmx) \ --MODULE_PARM_DESC(debug_dmx##_dmx##_chanpids, "\n\t\t pids of dmx channels"); \ --static short debug_dmx##_dmx##_chanpids[CHANNEL_COUNT] = \ -- {[0 ... (CHANNEL_COUNT - 1)] = -1}; \ --module_param_array(debug_dmx##_dmx##_chanpids, short, &npids, 0444) -- --MOD_PARAM_DECLARE_CHANPIDS(0); --MOD_PARAM_DECLARE_CHANPIDS(1); --MOD_PARAM_DECLARE_CHANPIDS(2); -- --#define set_debug_dmx_chanpids(_dmx, _idx, _pid)\ -- do { \ -- if ((_dmx) == 0) \ -- debug_dmx0_chanpids[(_idx)] = (_pid); \ -- else if ((_dmx) == 1) \ -- debug_dmx1_chanpids[(_idx)] = (_pid); \ -- else if ((_dmx) == 2) \ -- debug_dmx2_chanpids[(_idx)] = (_pid); \ -- } while (0) -- --MODULE_PARM_DESC(debug_sf_user, "\n\t\t only for sf mode check"); --static int debug_sf_user; --module_param(debug_sf_user, int, 0444); -- --MODULE_PARM_DESC(force_sec_sf, "\n\t\t force sf mode for sec filter"); --static int force_sec_sf; --module_param(force_sec_sf, int, 0644); -- --MODULE_PARM_DESC(force_pes_sf, "\n\t\t force sf mode for pes filter"); --static int force_pes_sf; --module_param(force_pes_sf, int, 0644); -- --#define DMX_READ_REG(i, r)\ -- ((i)?((i == 1)?READ_MPEG_REG(r##_2) :\ -- READ_MPEG_REG(r##_3)) : READ_MPEG_REG(r)) -- --#define DMX_WRITE_REG(i, r, d)\ -- do {\ -- if (i == 1) {\ -- WRITE_MPEG_REG(r##_2, d);\ -- } else if (i == 2) {\ -- WRITE_MPEG_REG(r##_3, d);\ -- } \ -- else {\ -- WRITE_MPEG_REG(r, d);\ -- } \ -- } while (0) -- --#define READ_PERI_REG READ_CBUS_REG --#define WRITE_PERI_REG WRITE_CBUS_REG -- --#define READ_ASYNC_FIFO_REG(i, r)\ -- ((i) ? READ_PERI_REG(ASYNC_FIFO2_##r) : READ_PERI_REG(ASYNC_FIFO_##r)) -- --#define WRITE_ASYNC_FIFO_REG(i, r, d)\ -- do {\ -- if (i == 1) {\ -- WRITE_PERI_REG(ASYNC_FIFO2_##r, d);\ -- } else {\ -- WRITE_PERI_REG(ASYNC_FIFO_##r, d);\ -- } \ -- } while (0) -- --#define CLEAR_ASYNC_FIFO_REG_MASK(i, reg, mask) \ -- WRITE_ASYNC_FIFO_REG(i, reg, \ -- (READ_ASYNC_FIFO_REG(i, reg)&(~(mask)))) -- --#define DVR_FEED(f) \ -- ((f) && ((f)->type == DMX_TYPE_TS) && \ -- (((f)->ts_type & (TS_PACKET | TS_DEMUX)) == TS_PACKET)) -- --#define MOD_PARAM_DECLARE_CHANREC(_dmx) \ --MODULE_PARM_DESC(dmx##_dmx##_chanrec_enable, \ -- "\n\t\t record by channel, one time use in the beginning"); \ --static int dmx##_dmx##_chanrec_enable; \ --module_param(dmx##_dmx##_chanrec_enable, int, 0644); \ --MODULE_PARM_DESC(dmx##_dmx##_chanrec, "\n\t\t record channels bits"); \ --static int dmx##_dmx##_chanrec; \ --module_param(dmx##_dmx##_chanrec, int, 0644) -- --MOD_PARAM_DECLARE_CHANREC(0); --MOD_PARAM_DECLARE_CHANREC(1); --MOD_PARAM_DECLARE_CHANREC(2); -- --#define MOD_PARAM_DECLARE_CHANPROC(_dmx) \ --MODULE_PARM_DESC(dmx##_dmx##_chanproc_enable, "channel further processing"); \ --static int dmx##_dmx##_chanproc_enable; \ --module_param(dmx##_dmx##_chanproc_enable, int, 0644); \ --MODULE_PARM_DESC(dmx##_dmx##_chanproc, "further process channels bits"); \ --static int dmx##_dmx##_chanproc; \ --module_param(dmx##_dmx##_chanproc, int, 0644) -- --MOD_PARAM_DECLARE_CHANPROC(0); --MOD_PARAM_DECLARE_CHANPROC(1); --MOD_PARAM_DECLARE_CHANPROC(2); -- --#define DMX_CH_OP_CHANREC 0 --#define DMX_CH_OP_CHANPROC 1 -- --static inline int _setbit(int v, int b) { return v|(1<id == SF_DMX_ID) \ -- && ((struct aml_dvb *)(_dmx)->demux.priv)->swfilter.user) --#define sf_afifo_sf(_afifo) \ -- (((_afifo)->id == SF_AFIFO_ID) && (_afifo)->dvb->swfilter.user) --#define dmx_get_dev(dmx) (((struct aml_dvb *)((dmx)->demux.priv))->dev) --#define asyncfifo_get_dev(afifo) ((afifo)->dvb->dev) -- -- --/*Section buffer watchdog*/ --static void section_buffer_watchdog_func(unsigned long arg) --{ -- struct aml_dvb *dvb = (struct aml_dvb *)arg; -- struct aml_dmx *dmx; -- u32 section_busy32 = 0, om_cmd_status32 = 0, -- demux_channel_activity32 = 0; -- u16 demux_int_status1 = 0; -- u32 device_no = 0; -- u32 filter_number = 0; -- u32 i = 0; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- for (device_no = 0; device_no < DMX_DEV_COUNT; device_no++) { -- -- dmx = &dvb->dmx[device_no]; -- -- if (dvb->dmx_watchdog_disable[device_no]) -- continue; -- -- if (!dmx->init) -- continue; -- -- om_cmd_status32 = -- DMX_READ_REG(device_no, OM_CMD_STATUS); -- demux_channel_activity32 = -- DMX_READ_REG(device_no, DEMUX_CHANNEL_ACTIVITY); -- section_busy32 = -- DMX_READ_REG(device_no, SEC_BUFF_BUSY); --#if 1 -- if (om_cmd_status32 & 0x8fc2) { -- /* bit 15:12 -- om_cmd_count */ -- /* bit 11:9 -- overflow_count */ -- /* bit 8:6 -- om_overwrite_count */ -- /* bit 1 -- om_cmd_overflow */ -- /*BUG: If the recoder is running, return */ -- if (dmx->record) -- goto end; -- /*Reset the demux */ -- pr_dbg("reset the demux\n" -- "%04x\t%03x\t%03x\t%03x\t%01x\t%01x\t" -- "%x\t%x\tdmx%d:status:0x%x\n", -- (om_cmd_status32 >> 12) & 0xf, -- (om_cmd_status32 >> 9) & 0x7, -- (om_cmd_status32 >> 6) & 0x7, -- (om_cmd_status32 >> 3) & 0x7, -- (om_cmd_status32 >> 2) & 0x1, -- (om_cmd_status32 >> 1) & 0x1, -- demux_channel_activity32, section_busy32, -- dmx->id, om_cmd_status32); -- -- dmx_reset_dmx_hw_ex_unlock(dvb, dmx, 0); -- goto end; -- } --#else -- /* bit 15:12 -- om_cmd_count (read only) */ -- /* bit 11:9 -- overflow_count // -- bit 11:9 -- om_cmd_wr_ptr (read only) */ -- /* bit 8:6 -- om_overwrite_count // -- bit 8:6 -- om_cmd_rd_ptr (read only) */ -- /* bit 5:3 -- type_stb_om_w_rd (read only) */ -- /* bit 2 -- unit_start_stb_om_w_rd (read only) */ -- /* bit 1 -- om_cmd_overflow (read only) */ -- /* bit 0 -- om_cmd_pending (read) */ -- /* bit 0 -- om_cmd_read_finished (write) */ -- if (om_cmd_status32 & 0x0002) { -- pr_error("reset the demux\n"); -- dmx_reset_hw_ex(dvb, 0); -- goto end; -- } --#endif -- section_busy32 = -- DMX_READ_REG(device_no, SEC_BUFF_BUSY); -- if (LARGE_SEC_BUFF_MASK == -- (section_busy32 & LARGE_SEC_BUFF_MASK)) { -- /*All the largest section buffers occupied, -- * clear buffers */ -- DMX_WRITE_REG(device_no, -- SEC_BUFF_READY, section_busy32); -- } else { -- for (i = 0; i < SEC_BUF_COUNT; i++) { -- if (!(section_busy32 & (1 << i))) -- continue; -- DMX_WRITE_REG(device_no, SEC_BUFF_NUMBER, i); -- filter_number = DMX_READ_REG(device_no, -- SEC_BUFF_NUMBER); -- filter_number >>= 8; -- if ((filter_number >= FILTER_COUNT) -- /* >=31, do not handle this case */ -- || ((filter_number < FILTER_COUNT) -- && dmx->filter[filter_number].used)) -- section_busy32 &= ~(1 << i); -- } -- if (section_busy32 & (dmx->smallsec.enable ? -- 0x7FFFFFFF : -- LARGE_SEC_BUFF_MASK)) { -- /*Clear invalid buffers */ -- DMX_WRITE_REG(device_no, -- SEC_BUFF_READY, -- section_busy32); -- pr_error("clear invalid buffer 0x%x\n", -- section_busy32); -- } --#if 0 -- section_busy32 = 0x7fffffff; -- for (i = 0; i < SEC_BUF_BUSY_SIZE; i++) { -- dmx->section_busy[i] = ( -- (i == SEC_BUF_BUSY_SIZE - 1) ? -- DMX_READ_REG(device_no, SEC_BUFF_BUSY) : -- dmx->section_busy[i + 1]); -- section_busy32 &= dmx->section_busy[i]; -- } -- -- /*count the number of '1' bits */ -- i = section_busy32; -- i = (i & 0x55555555) + ((i & 0xaaaaaaaa) >> 1); -- i = (i & 0x33333333) + ((i & 0xcccccccc) >> 2); -- i = (i & 0x0f0f0f0f) + ((i & 0xf0f0f0f0) >> 4); -- i = (i & 0x00ff00ff) + ((i & 0xff00ff00) >> 8); -- i = (i & 0x0000ffff) + ((i & 0xffff0000) >> 16); -- if (i > LARGE_SEC_BUFF_COUNT) { -- /*too long some of the section -- buffers are being processed */ -- DMX_WRITE_REG(device_no, SEC_BUFF_READY, -- section_busy32); -- } --#endif -- } -- demux_int_status1 = -- DMX_READ_REG(device_no, STB_INT_STATUS) & 0xfff7; -- if (demux_int_status1 & (1 << TS_ERROR_PIN)) { -- DMX_WRITE_REG(device_no, -- STB_INT_STATUS, -- (1 << TS_ERROR_PIN)); -- } -- } -- --end: -- spin_unlock_irqrestore(&dvb->slock, flags); --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- mod_timer(&dvb->watchdog_timer, -- jiffies + msecs_to_jiffies(WATCHDOG_TIMER)); --#endif -- return; --} -- --static inline int sec_filter_match(struct aml_dmx *dmx, struct aml_filter *f, -- u8 *p) --{ -- int b; -- u8 neq = 0; -- -- if (!f->used || !dmx->channel[f->chan_id].used) -- return 0; -- -- for (b = 0; b < FILTER_LEN; b++) { -- u8 xor = p[b] ^ f->value[b]; -- -- if (xor & f->maskandmode[b]) -- return 0; -- -- if (xor & f->maskandnotmode[b]) -- neq = 1; -- } -- -- if (f->neq && !neq) -- return 0; -- -- return 1; --} -- --static int section_crc(struct aml_dmx *dmx, struct aml_filter *f, u8 *p) --{ -- int sec_len = (((p[1] & 0xF) << 8) | p[2]) + 3; -- struct dvb_demux_feed *feed = dmx->channel[f->chan_id].feed; -- -- if (feed->feed.sec.check_crc) { -- struct dvb_demux *demux = feed->demux; -- struct dmx_section_feed *sec = &feed->feed.sec; -- int section_syntax_indicator; -- -- section_syntax_indicator = ((p[1] & 0x80) != 0); -- sec->seclen = sec_len; -- sec->crc_val = ~0; -- if (demux->check_crc32(feed, p, sec_len)) { -- pr_error("section CRC check failed!\n"); -- --#if 0 -- int i; -- -- for (i = 0; i < sec_len; i++) { -- pr_dbg("%02x ", p[i]); -- if (!((i + 1) % 16)) -- pr_dbg("\n"); -- } -- pr_dbg("\nerror section data\n"); --#endif -- return 0; -- } --#if 0 -- int i; -- -- for (i = 0; i < sec_len; i++) { -- pr_dbg("%02x ", p[i]); -- if (!((i + 1) % 16)) -- pr_dbg("\n"); -- } -- pr_dbg("\nsection data\n"); --#endif -- } -- -- return 1; --} -- --static void section_notify(struct aml_dmx *dmx, struct aml_filter *f, u8 *p) --{ -- int sec_len = (((p[1] & 0xF) << 8) | p[2]) + 3; -- struct dvb_demux_feed *feed = dmx->channel[f->chan_id].feed; -- -- if (feed && feed->cb.sec) -- feed->cb.sec(p, sec_len, NULL, 0, f->filter, DMX_OK); --} -- --static void hardware_match_section(struct aml_dmx *dmx, -- u16 sec_num, u16 buf_num) --{ -- u8 *p = (u8 *) dmx->sec_buf[buf_num].addr; -- struct aml_filter *f; -- int chid, i; -- int need_crc = 1; -- -- if (sec_num >= FILTER_COUNT) { -- pr_dbg("sec_num invalid: %d\n", sec_num); -- return; -- } -- -- dma_sync_single_for_cpu(dmx_get_dev(dmx), -- dmx->sec_pages_map + (buf_num << 0x0c), -- (1 << 0x0c), DMA_FROM_DEVICE); -- -- f = &dmx->filter[sec_num]; -- chid = f->chan_id; -- -- for (i = 0; i < FILTER_COUNT; i++) { -- f = &dmx->filter[i]; -- if (f->chan_id != chid) -- continue; -- if (sec_filter_match(dmx, f, p)) { -- if (need_crc) { -- if (!section_crc(dmx, f, p)) -- return; -- need_crc = 0; -- } -- -- section_notify(dmx, f, p); -- } -- } --} -- --static void software_match_section(struct aml_dmx *dmx, u16 buf_num) --{ -- u8 *p = (u8 *) dmx->sec_buf[buf_num].addr; -- struct aml_filter *f, *fmatch = NULL; -- int i, fid = -1; -- -- dma_sync_single_for_cpu(dmx_get_dev(dmx), -- dmx->sec_pages_map + (buf_num << 0x0c), -- (1 << 0x0c), DMA_FROM_DEVICE); -- -- for (i = 0; i < FILTER_COUNT; i++) { -- f = &dmx->filter[i]; -- -- if (sec_filter_match(dmx, f, p)) { -- pr_dbg("[software match]filter %d match, pid %d\n", -- i, dmx->channel[f->chan_id].pid); -- if (!fmatch) { -- fmatch = f; -- fid = i; -- } else { -- pr_dbg("software match]Muli-filter match this\n" -- "section, will skip this section\n"); -- return; -- } -- } -- } -- -- if (fmatch) { -- pr_dbg("[software match]dispatch\n" -- "section to filter %d pid %d\n", -- fid, dmx->channel[fmatch->chan_id].pid); -- if (section_crc(dmx, fmatch, p)) -- section_notify(dmx, fmatch, p); -- } else { -- pr_dbg("[software match]this section do not\n" -- "match any filter!!!\n"); -- } --} -- -- --static int _rbuf_write(struct dvb_ringbuffer *buf, const u8 *src, size_t len) --{ -- ssize_t free; -- -- if (!len) -- return 0; -- if (!buf->data) -- return 0; -- -- free = dvb_ringbuffer_free(buf); -- if (len > free) { -- pr_error("sf: buffer overflow\n"); -- return -EOVERFLOW; -- } -- -- return dvb_ringbuffer_write(buf, src, len); --} -- --static int _rbuf_filter_pkts(struct dvb_ringbuffer *rb, -- u8 *wrapbuf, -- void (*swfilter_packets)(struct dvb_demux *demux, -- const u8 *buf, -- size_t count), -- struct dvb_demux *demux) --{ -- ssize_t len1 = 0; -- ssize_t len2 = 0; -- size_t off; -- size_t count; -- size_t size; -- -- if (debug_irq & 0x4) -- dump(&rb->data[rb->pread], (debug_irq & 0xFFF00) >> 8); -- -- /* -- rb|====--------===[0x47]====| -- ^ ^ -- wr rd -- */ -- -- len1 = rb->pwrite - rb->pread; -- if (len1 < 0) { -- len1 = rb->size - rb->pread; -- len2 = rb->pwrite; -- } -- -- for (off = 0; off < len1; off++) { -- if (rb->data[rb->pread + off] == 0x47) -- break; -- } -- -- if (off) -- pr_dbg_irq_sf("off ->|%zd\n", off); -- -- len1 -= off; -- rb->pread = (rb->pread + off) % rb->size; -- -- count = len1 / 188; -- if (count) { -- pr_dbg_irq_sf("pkt >> 1[%zd<->%zd]\n", rb->pread, rb->pwrite); -- swfilter_packets(demux, rb->data + rb->pread, count); -- -- size = count * 188; -- len1 -= size; -- rb->pread += size; -- } -- -- if (len2 && len1 && ((len1 + len2) > 188)) { -- pr_dbg_irq_sf("pkt >> 2[%zd<->%zd]\n", rb->pread, rb->pwrite); -- size = 188 - len1; -- memcpy(wrapbuf, rb->data + rb->pread, len1); -- memcpy(wrapbuf + len1, rb->data, size); -- swfilter_packets(demux, wrapbuf, 1); -- rb->pread = size; -- len2 -= size; -- } -- -- if (len2) { -- pr_dbg_irq_sf("pkt >> 3[%zd<->%zd]\n", rb->pread, rb->pwrite); -- count = len2 / 188; -- if (count) { -- swfilter_packets(demux, rb->data + rb->pread, count); -- rb->pread += count * 188; -- } -- } -- return 0; --} -- --static void smallsection_match_section(struct aml_dmx *dmx, u8 *p, u16 sec_num) --{ -- struct aml_filter *f; -- int chid, i; -- int need_crc = 1; -- -- if (sec_num >= FILTER_COUNT) { -- pr_dbg("sec_num invalid: %d\n", sec_num); -- return; -- } -- -- f = &dmx->filter[sec_num]; -- chid = f->chan_id; -- -- for (i = 0; i < FILTER_COUNT; i++) { -- f = &dmx->filter[i]; -- if (f->chan_id != chid) -- continue; -- if (sec_filter_match(dmx, f, p)) { -- if (need_crc) { -- if (!section_crc(dmx, f, p)) -- return; -- need_crc = 0; -- } -- -- section_notify(dmx, f, p); -- } -- } -- --} --static void process_smallsection(struct aml_dmx *dmx) --{ -- -- u32 v, wr, rd; -- u32 data32; -- struct aml_smallsec *ss = &dmx->smallsec; -- -- v = DMX_READ_REG(dmx->id, DEMUX_SMALL_SEC_CTL); -- wr = (v >> 8) & 0xff; -- rd = (v >> 16) & 0xff; -- -- if (rd != wr) { -- int n1 = wr - rd, -- n2 = 0, -- max = (ss->bufsize>>8); -- int i; -- u8 *p; -- int sec_len; -- -- pr_dbg_irq_ss("secbuf[31] ctrl:0x%x\n", v); -- -- if (n1 < 0) { -- n1 = max - rd; -- n2 = wr; -- } -- if (n1) { -- pr_dbg_irq_ss("n1:%d\n", n1); -- dma_sync_single_for_cpu(dmx_get_dev(dmx), -- ss->buf_map+(rd<<8), -- n1<<8, -- DMA_FROM_DEVICE); -- for (i = 0; i < n1; i++) { -- p = (u8 *)ss->buf+((rd+i)<<8); -- sec_len = (((p[1] & 0xF) << 8) | p[2]) + 3; -- smallsection_match_section(dmx, p, -- *(p+sec_len+1)); -- } -- } -- if (n2) { -- pr_dbg_irq_ss("n2:%d\n", n2); -- dma_sync_single_for_cpu(dmx_get_dev(dmx), -- ss->buf_map, -- n2<<8, -- DMA_FROM_DEVICE); -- for (i = 0; i < n2; i++) { -- p = (u8 *)ss->buf+(i<<8); -- sec_len = (((p[1] & 0xF) << 8) | p[2]) + 3; -- smallsection_match_section(dmx, p, -- *(p+sec_len+1)); -- } -- } -- -- rd = wr; -- data32 = (DMX_READ_REG(dmx->id, DEMUX_SMALL_SEC_CTL) -- & 0xff00ffff) -- | (rd << 16); -- DMX_WRITE_REG(dmx->id, DEMUX_SMALL_SEC_CTL, data32); -- } --} -- -- --static void process_section(struct aml_dmx *dmx) --{ -- u32 ready, i, sec_busy; -- u16 sec_num; -- -- /*pr_dbg("section\n"); */ -- ready = DMX_READ_REG(dmx->id, SEC_BUFF_READY); -- if (ready) { --#ifdef USE_AHB_MODE -- /* WRITE_ISA_REG(AHB_BRIDGE_CTRL1, -- READ_ISA_REG (AHB_BRIDGE_CTRL1) | (1 << 31)); */ -- /* WRITE_ISA_REG(AHB_BRIDGE_CTRL1, -- READ_ISA_REG (AHB_BRIDGE_CTRL1) & (~ (1 << 31))); */ --#endif -- -- if ((ready & (1<<31)) && dmx->smallsec.enable) { -- u32 v, wr, rd; -- v = DMX_READ_REG(dmx->id, DEMUX_SMALL_SEC_CTL); -- wr = (v >> 8) & 0xff; -- rd = (v >> 16) & 0xff; -- if ((wr < rd) && (5 > (rd - wr))) -- pr_error("warning: small ss buf [w%dr%d]\n", -- wr, rd); -- pr_dbg_irq_ss("ss>%x\n", -- DMX_READ_REG(dmx->id, DEMUX_SMALL_SEC_CTL)); -- process_smallsection(dmx); -- /*tasklet_hi_schedule(&dmx->dmx_tasklet);*/ -- /*tasklet_schedule(&dmx->dmx_tasklet);*/ -- DMX_WRITE_REG(dmx->id, SEC_BUFF_READY, (1<<31)); -- return; -- } -- -- for (i = 0; i < SEC_BUF_COUNT; i++) { -- -- if (!(ready & (1 << i))) -- continue; -- -- /* get section busy */ -- sec_busy = DMX_READ_REG(dmx->id, SEC_BUFF_BUSY); -- /* get filter number */ -- DMX_WRITE_REG(dmx->id, SEC_BUFF_NUMBER, i); -- sec_num = (DMX_READ_REG(dmx->id, SEC_BUFF_NUMBER) >> 8); -- -- /* -- * sec_buf_watchdog_count dispatch: -- * byte0 -- always busy=0 's watchdog count -- * byte1 -- always busy=1 & filter_num=31 's -- * watchdog count -- */ -- -- /* sec_busy is not set, check busy=0 watchdog count */ -- if (!(sec_busy & (1 << i))) { -- /* clear other wd count of this buffer */ -- dmx->sec_buf_watchdog_count[i] &= 0x000000ff; -- dmx->sec_buf_watchdog_count[i] += 0x1; -- pr_dbg("bit%d ready=1, busy=0,\n" -- "sec_num=%d for %d times\n", -- i, sec_num, -- dmx->sec_buf_watchdog_count[i]); -- if (dmx->sec_buf_watchdog_count[i] >= 5) { -- pr_dbg("busy=0 reach the max count,\n" -- "try software match.\n"); -- software_match_section(dmx, i); -- dmx->sec_buf_watchdog_count[i] = 0; -- DMX_WRITE_REG(dmx->id, SEC_BUFF_READY, -- (1 << i)); -- } -- continue; -- } -- -- /* filter_num == 31 && busy == 1,check watchdog count */ -- if (sec_num >= FILTER_COUNT) { -- /* clear other wd count of this buffer */ -- dmx->sec_buf_watchdog_count[i] &= 0x0000ff00; -- dmx->sec_buf_watchdog_count[i] += 0x100; -- pr_dbg("bit%d ready=1,busy=1,\n" -- "sec_num=%d for %d times\n", -- i, sec_num, -- dmx->sec_buf_watchdog_count[i] >> 8); -- if (dmx->sec_buf_watchdog_count[i] >= 0x500) { -- pr_dbg("busy=1&filter_num=31\n" -- " reach the max count, clear\n" -- " the buf ready & busy!\n"); -- software_match_section(dmx, i); -- dmx->sec_buf_watchdog_count[i] = 0; -- DMX_WRITE_REG(dmx->id, -- SEC_BUFF_READY, -- (1 << i)); -- DMX_WRITE_REG(dmx->id, -- SEC_BUFF_BUSY, -- (1 << i)); -- } -- continue; -- } -- -- /* now, ready & busy are both set and -- filter number is valid */ -- if (dmx->sec_buf_watchdog_count[i] != 0) -- dmx->sec_buf_watchdog_count[i] = 0; -- -- /* process this section */ -- hardware_match_section(dmx, sec_num, i); -- -- /* clear the ready & busy bit */ -- DMX_WRITE_REG(dmx->id, SEC_BUFF_READY, (1 << i)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_BUSY, (1 << i)); -- } -- } --} -- --#ifdef NO_SUB --static void process_sub(struct aml_dmx *dmx) --{ -- -- u32 rd_ptr = 0; -- -- u32 wr_ptr = READ_MPEG_REG(PARSER_SUB_WP); -- u32 start_ptr = READ_MPEG_REG(PARSER_SUB_START_PTR); -- u32 end_ptr = READ_MPEG_REG(PARSER_SUB_END_PTR); -- -- u32 buffer1 = 0, buffer2 = 0; -- unsigned char *buffer1_virt = 0, *buffer2_virt = 0; -- u32 len1 = 0, len2 = 0; -- -- rd_ptr = READ_MPEG_REG(PARSER_SUB_RP); -- if (!rd_ptr) -- return; -- if (rd_ptr > wr_ptr) { -- len1 = end_ptr - rd_ptr + 8; -- buffer1 = rd_ptr; -- -- len2 = wr_ptr - start_ptr; -- buffer2 = start_ptr; -- -- rd_ptr = start_ptr + len2; -- } else if (rd_ptr < wr_ptr) { -- len1 = wr_ptr - rd_ptr; -- buffer1 = rd_ptr; -- rd_ptr += len1; -- len2 = 0; -- } else if (rd_ptr == wr_ptr) { -- pr_dbg("no data\n"); -- } -- -- if (buffer1) -- buffer1_virt = phys_to_virt(buffer1); -- if (buffer2) -- buffer2_virt = phys_to_virt(buffer2); -- -- if (len1) -- dma_sync_single_for_cpu(dmx_get_dev(dmx), -- (dma_addr_t) buffer1, len1, -- DMA_FROM_DEVICE); -- if (len2) -- dma_sync_single_for_cpu(dmx_get_dev(dmx), -- (dma_addr_t) buffer2, len2, -- DMA_FROM_DEVICE); -- -- if (dmx->channel[2].used) { -- if (dmx->channel[2].feed && dmx->channel[2].feed->cb.ts) { -- dmx->channel[2].feed->cb.ts(buffer1_virt, len1, -- buffer2_virt, len2, -- &dmx->channel[2].feed->feed.ts, -- DMX_OK); -- } -- } -- WRITE_MPEG_REG(PARSER_SUB_RP, rd_ptr); --} --#endif -- --static void process_pes(struct aml_dmx *dmx) --{ --} -- --static void process_om_read(struct aml_dmx *dmx) --{ -- unsigned i; -- unsigned short om_cmd_status_data_0 = 0; -- unsigned short om_cmd_status_data_1 = 0; --/* unsigned short om_cmd_status_data_2 = 0;*/ -- unsigned short om_cmd_data_out = 0; -- -- om_cmd_status_data_0 = DMX_READ_REG(dmx->id, OM_CMD_STATUS); -- om_cmd_status_data_1 = DMX_READ_REG(dmx->id, OM_CMD_DATA); --/* om_cmd_status_data_2 = DMX_READ_REG(dmx->id, OM_CMD_DATA2);*/ -- -- if (om_cmd_status_data_0 & 1) { -- DMX_WRITE_REG(dmx->id, OM_DATA_RD_ADDR, -- (1 << 15) | ((om_cmd_status_data_1 & 0xff) << 2)); -- for (i = 0; i < (((om_cmd_status_data_1 >> 7) & 0x1fc) >> 1); -- i++) { -- om_cmd_data_out = DMX_READ_REG(dmx->id, OM_DATA_RD); -- } -- -- om_cmd_data_out = DMX_READ_REG(dmx->id, OM_DATA_RD_ADDR); -- DMX_WRITE_REG(dmx->id, OM_DATA_RD_ADDR, 0); -- DMX_WRITE_REG(dmx->id, OM_CMD_STATUS, 1); -- } --} -- --static void dmx_irq_bh_handler(unsigned long arg) --{ -- struct aml_dmx *dmx = (struct aml_dmx *)arg; --#if 0 -- u32 status; -- -- status = DMX_READ_REG(dmx->id, STB_INT_STATUS); -- -- if (status) -- DMX_WRITE_REG(dmx->id, STB_INT_STATUS, status); --#endif -- process_smallsection(dmx); -- return; --} -- --static irqreturn_t dmx_irq_handler(int irq_number, void *para) --{ -- struct aml_dmx *dmx = (struct aml_dmx *)para; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- u32 status; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- status = DMX_READ_REG(dmx->id, STB_INT_STATUS); -- if (!status) -- goto irq_handled; -- -- pr_dbg_irq("demux %d irq status: 0x08%x\n", dmx->id, status); -- -- if (status & (1 << SECTION_BUFFER_READY)) -- process_section(dmx); --#ifdef NO_SUB -- if (status & (1 << SUB_PES_READY)) { -- /*If the subtitle is set by tsdemux, -- do not parser in demux driver. */ -- if (dmx->sub_chan == -1) -- process_sub(dmx); -- } --#endif -- if (status & (1 << OTHER_PES_READY)) -- process_pes(dmx); -- if (status & (1 << OM_CMD_READ_PENDING)) -- process_om_read(dmx); -- /* -- if (status & (1 << DUPLICATED_PACKET)) { -- } -- if (status & (1 << DIS_CONTINUITY_PACKET)) { -- } -- if (status & (1 << VIDEO_SPLICING_POINT)) { -- } -- if (status & (1 << AUDIO_SPLICING_POINT)) { -- } -- if (status & (1 << TS_ERROR_PIN)) { -- pr_error("TS_ERROR_PIN\n"); -- }*/ -- -- if (status & (1 << NEW_PDTS_READY)) { -- u32 pdts_status = DMX_READ_REG(dmx->id, STB_PTS_DTS_STATUS); -- -- if (pdts_status & (1 << VIDEO_PTS_READY)) { -- video_pts = DMX_READ_REG(dmx->id, VIDEO_PTS_DEMUX); -- if (!first_video_pts -- || 0 > (int)(video_pts - first_video_pts)) -- first_video_pts = video_pts; -- } -- -- if (pdts_status & (1 << AUDIO_PTS_READY)) { -- audio_pts = DMX_READ_REG(dmx->id, AUDIO_PTS_DEMUX); -- if (!first_audio_pts -- || 0 > (int)(audio_pts - first_audio_pts)) -- first_audio_pts = audio_pts; -- } -- } -- -- if (dmx->irq_handler) -- dmx->irq_handler(dmx->dmx_irq, (void *)(long)dmx->id); -- -- DMX_WRITE_REG(dmx->id, STB_INT_STATUS, status); -- -- /*tasklet_schedule(&dmx->dmx_tasklet);*/ -- -- { -- if (!dmx->int_check_time) { -- dmx->int_check_time = jiffies; -- dmx->int_check_count = 0; -- } -- -- if (jiffies_to_msecs(jiffies - dmx->int_check_time) >= 100 -- || dmx->int_check_count > 1000) { -- if (dmx->int_check_count > 1000) { -- struct aml_dvb *dvb = -- (struct aml_dvb *)dmx->demux.priv; -- pr_error("Too many interrupts " -- "(%d interrupts in %d ms)!\n", -- dmx->int_check_count, -- jiffies_to_msecs(jiffies - -- dmx->int_check_time)); -- if (dmx->fe && !dmx->in_tune) { -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, 0); -- dvb_frontend_retune(dmx->fe); -- } -- dmx_reset_hw_ex(dvb, 0); -- } -- dmx->int_check_time = 0; -- } -- -- dmx->int_check_count++; -- -- if (dmx->in_tune) { -- dmx->error_check++; -- if (dmx->error_check > 200) -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, 0); -- } -- } -- --irq_handled: -- spin_unlock_irqrestore(&dvb->slock, flags); -- return IRQ_HANDLED; --} -- --static inline int dmx_get_order(unsigned long size) --{ -- int order; -- -- order = -1; -- do { -- size >>= 1; -- order++; -- } while (size); -- -- return order; --} -- --static void dvr_process_channel(struct aml_asyncfifo *afifo, -- struct aml_channel *channel, -- u32 total, u32 size, -- struct aml_swfilter *sf) --{ -- int cnt; -- int ret = 0; -- -- if (afifo->buf_read > afifo->buf_toggle) { -- cnt = total - afifo->buf_read; -- dma_sync_single_for_cpu(asyncfifo_get_dev(afifo), -- afifo->pages_map+afifo->buf_read*size, -- cnt*size, -- DMA_FROM_DEVICE); -- if (sf) -- ret = _rbuf_write(&sf->rbuf, -- (u8 *)afifo->pages+afifo->buf_read*size, -- cnt*size); -- else -- channel->dvr_feed->cb.ts( -- (u8 *)afifo->pages+afifo->buf_read*size, -- cnt*size, NULL, 0, -- &channel->dvr_feed->feed.ts, DMX_OK); -- afifo->buf_read = 0; -- } -- -- if (afifo->buf_toggle > afifo->buf_read) { -- cnt = afifo->buf_toggle - afifo->buf_read; -- dma_sync_single_for_cpu(asyncfifo_get_dev(afifo), -- afifo->pages_map+afifo->buf_read*size, -- cnt*size, -- DMA_FROM_DEVICE); -- if (sf) { -- if (ret >= 0) -- ret = _rbuf_write(&sf->rbuf, -- (u8 *)afifo->pages+afifo->buf_read*size, -- cnt*size); -- } else -- channel->dvr_feed->cb.ts( -- (u8 *)afifo->pages+afifo->buf_read*size, -- cnt*size, NULL, 0, -- &channel->dvr_feed->feed.ts, DMX_OK); -- afifo->buf_read = afifo->buf_toggle; -- } -- -- if (sf && ret > 0) { -- _rbuf_filter_pkts(&sf->rbuf, sf->wrapbuf, -- dvb_dmx_swfilter_packets, -- channel->dvr_feed->demux); -- } else if (sf && ret <= 0) -- pr_error("sf rbuf write error[%d]\n", ret); -- else -- pr_dbg_irq_dvr("write data to dvr\n"); --} -- --static void dvr_irq_bh_handler(unsigned long arg) --{ -- struct aml_asyncfifo *afifo = (struct aml_asyncfifo *)arg; -- struct aml_dvb *dvb = afifo->dvb; -- struct aml_dmx *dmx; -- u32 size, total; -- int i, factor; -- unsigned long flags; -- -- pr_dbg_irq_dvr("async fifo %d irq\n", afifo->id); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dvb && afifo->source >= AM_DMX_0 && afifo->source < AM_DMX_MAX) { -- dmx = &dvb->dmx[afifo->source]; -- if (dmx->init && dmx->record) { -- struct aml_swfilter *sf = &dvb->swfilter; -- int issf = 0; -- -- total = afifo->buf_len / afifo->flush_size; -- factor = dmx_get_order(total); -- size = afifo->buf_len >> factor; -- -- if (sf->user && (sf->afifo == afifo)) -- issf = 1; -- -- for (i = 0; i < CHANNEL_COUNT; i++) { -- if (dmx->channel[i].used -- && dmx->channel[i].dvr_feed) { -- dvr_process_channel(afifo, -- &dmx->channel[i], -- total, -- size, -- issf?sf:NULL); -- break; -- } -- } -- -- } -- } -- spin_unlock_irqrestore(&dvb->slock, flags); -- return; --} -- --static irqreturn_t dvr_irq_handler(int irq_number, void *para) --{ -- struct aml_asyncfifo *afifo = (struct aml_asyncfifo *)para; -- int factor = dmx_get_order(afifo->buf_len / afifo->flush_size); -- -- afifo->buf_toggle++; -- afifo->buf_toggle %= (1 << factor); -- tasklet_schedule(&afifo->asyncfifo_tasklet); -- return IRQ_HANDLED; --} -- --/*Enable the STB*/ --static void stb_enable(struct aml_dvb *dvb) --{ -- int out_src, des_in, en_des, fec_clk, hiu, dec_clk_en; -- int src, tso_src, i; -- u32 fec_s0, fec_s1; -- u32 invert0, invert1; -- -- switch (dvb->stb_source) { -- case AM_TS_SRC_DMX0: -- src = dvb->dmx[0].source; -- break; -- case AM_TS_SRC_DMX1: -- src = dvb->dmx[1].source; -- break; -- case AM_TS_SRC_DMX2: -- src = dvb->dmx[2].source; -- break; -- default: -- src = dvb->stb_source; -- break; -- } -- -- switch (src) { -- case AM_TS_SRC_TS0: -- fec_clk = tsfile_clkdiv; -- hiu = 0; -- break; -- case AM_TS_SRC_TS1: -- fec_clk = tsfile_clkdiv; -- hiu = 0; -- break; -- case AM_TS_SRC_TS2: -- fec_clk = tsfile_clkdiv; -- hiu = 0; -- break; -- case AM_TS_SRC_S_TS0: -- fec_clk = tsfile_clkdiv; -- hiu = 0; -- break; -- case AM_TS_SRC_S_TS1: -- fec_clk = tsfile_clkdiv; -- hiu = 0; -- break; -- case AM_TS_SRC_S_TS2: -- fec_clk = tsfile_clkdiv; -- hiu = 0; -- break; -- case AM_TS_SRC_HIU: -- fec_clk = tsfile_clkdiv; -- hiu = 1; -- break; -- default: -- fec_clk = 0; -- hiu = 0; -- break; -- } -- -- switch (dvb->dsc[0].source) { -- case AM_TS_SRC_DMX0: -- des_in = 0; -- en_des = 1; -- dec_clk_en = 1; -- break; -- case AM_TS_SRC_DMX1: -- des_in = 1; -- en_des = 1; -- dec_clk_en = 1; -- break; -- case AM_TS_SRC_DMX2: -- des_in = 2; -- en_des = 1; -- dec_clk_en = 1; -- break; -- default: -- des_in = 0; -- en_des = 0; -- dec_clk_en = 0; -- break; -- } -- -- switch (dvb->tso_source) { -- case AM_TS_SRC_DMX0: -- tso_src = dvb->dmx[0].source; -- break; -- case AM_TS_SRC_DMX1: -- tso_src = dvb->dmx[1].source; -- break; -- case AM_TS_SRC_DMX2: -- tso_src = dvb->dmx[2].source; -- break; -- default: -- tso_src = dvb->tso_source; -- break; -- } -- -- switch (tso_src) { -- case AM_TS_SRC_TS0: -- out_src = 0; -- break; -- case AM_TS_SRC_TS1: -- out_src = 1; -- break; -- case AM_TS_SRC_TS2: -- out_src = 2; -- break; -- case AM_TS_SRC_S_TS0: -- case AM_TS_SRC_S_TS1: -- case AM_TS_SRC_S_TS2: -- out_src = 6; -- break; -- case AM_TS_SRC_HIU: -- out_src = 7; -- break; -- default: -- out_src = 0; -- break; -- } -- -- pr_dbg("[stb]src: %d, dsc1in: %d, tso: %d\n", src, des_in, out_src); -- -- fec_s0 = 0; -- fec_s1 = 0; -- invert0 = 0; -- invert1 = 0; -- -- for (i = 0; i < TS_IN_COUNT; i++) { -- if (dvb->ts[i].s2p_id == 0) -- fec_s0 = i; -- else if (dvb->ts[i].s2p_id == 1) -- fec_s1 = i; -- } -- -- invert0 = dvb->s2p[0].invert; -- invert1 = dvb->s2p[1].invert; -- -- WRITE_MPEG_REG(STB_TOP_CONFIG, -- (invert1 << INVERT_S2P1_FEC_CLK) | -- (fec_s1 << S2P1_FEC_SERIAL_SEL) | -- (out_src << TS_OUTPUT_SOURCE) | -- (des_in << DES_INPUT_SEL) | -- (en_des << ENABLE_DES_PL) | -- (dec_clk_en << ENABLE_DES_PL_CLK) | -- (invert0 << INVERT_S2P0_FEC_CLK) | -- (fec_s0 << S2P0_FEC_SERIAL_SEL)); -- -- if (dvb->reset_flag) -- hiu = 0; -- -- WRITE_MPEG_REG(TS_FILE_CONFIG, -- (demux_skipbyte << 16) | -- (6 << DES_OUT_DLY) | -- (3 << TRANSPORT_SCRAMBLING_CONTROL_ODD) | -- (3 << TRANSPORT_SCRAMBLING_CONTROL_ODD_2) | -- (hiu << TS_HIU_ENABLE) | (fec_clk << FEC_FILE_CLK_DIV)); --} -- --int dsc_set_pid(struct aml_dsc_channel *ch, int pid) --{ -- struct aml_dsc *dsc = ch->dsc; -- int is_dsc2 = (dsc->id == 1) ? 1 : 0; -- u32 data; -- -- WRITE_MPEG_REG(TS_PL_PID_INDEX, -- ((ch->id & 0x0f) >> 1)+(is_dsc2 ? 4 : 0)); -- data = READ_MPEG_REG(TS_PL_PID_DATA); -- if (ch->id & 1) { -- data &= 0xFFFF0000; -- data |= pid & 0x1fff; -- if (!ch->used) -- data |= 1 << PID_MATCH_DISABLE_LOW; -- } else { -- data &= 0xFFFF; -- data |= (pid & 0x1fff) << 16; -- if (!ch->used) -- data |= 1 << PID_MATCH_DISABLE_HIGH; -- } -- WRITE_MPEG_REG(TS_PL_PID_INDEX, -- ((ch->id & 0x0f) >> 1)+(is_dsc2 ? 4 : 0)); -- WRITE_MPEG_REG(TS_PL_PID_DATA, data); -- WRITE_MPEG_REG(TS_PL_PID_INDEX, 0); -- -- if (ch->used) -- pr_dbg("set DSC %d ch %d PID %d\n", dsc->id, ch->id, pid); -- else -- pr_dbg("disable DSC %d ch %d\n", dsc->id, ch->id); -- return 0; --} -- --int dsc_set_key(struct aml_dsc_channel *ch, int type, u8 *key) --{ -- struct aml_dsc *dsc = ch->dsc; -- int is_dsc2 = (dsc->id == 1) ? 1 : 0; -- u16 k0, k1, k2, k3; -- u32 key0, key1; -- -- k0 = (key[0] << 8) | key[1]; -- k1 = (key[2] << 8) | key[3]; -- k2 = (key[4] << 8) | key[5]; -- k3 = (key[6] << 8) | key[7]; -- -- key0 = (k0 << 16) | k1; -- key1 = (k2 << 16) | k3; -- WRITE_MPEG_REG(COMM_DESC_KEY0, key0); -- WRITE_MPEG_REG(COMM_DESC_KEY1, key1); -- WRITE_MPEG_REG(COMM_DESC_KEY_RW, -- (ch->id + type * DSC_COUNT)+(is_dsc2 ? 16 : 0)); -- -- pr_dbg("set DSC %d ch %d type %d key %04x %04x %04x %04x\n", -- dsc->id, ch->id, type, k0, k1, k2, k3); -- return 0; --} -- --int dsc_enable(struct aml_dsc *dsc, int enable) --{ -- if (dsc->id == 0) { -- WRITE_MPEG_REG(STB_TOP_CONFIG, -- READ_MPEG_REG(STB_TOP_CONFIG) & -- ~((0x11 << DES_INPUT_SEL)| -- (1 << ENABLE_DES_PL)| -- (1 << ENABLE_DES_PL_CLK))); -- } else if (dsc->id == 1) { -- WRITE_MPEG_REG(COMM_DESC_2_CTL, 0); -- } -- return 0; --} -- --/*Set section buffer*/ --static int dmx_alloc_sec_buffer(struct aml_dmx *dmx) --{ -- unsigned long base; -- unsigned long grp_addr[SEC_BUF_GRP_COUNT]; -- int grp_len[SEC_BUF_GRP_COUNT]; -- int i; -- -- if (dmx->sec_pages) -- return 0; -- -- grp_len[0] = (1 << SEC_GRP_LEN_0) * 8; -- grp_len[1] = (1 << SEC_GRP_LEN_1) * 8; -- grp_len[2] = (1 << SEC_GRP_LEN_2) * 8; -- grp_len[3] = (1 << SEC_GRP_LEN_3) * 8; -- -- dmx->sec_total_len = grp_len[0] + grp_len[1] + grp_len[2] + grp_len[3]; -- dmx->sec_pages = -- __get_free_pages(GFP_KERNEL, get_order(dmx->sec_total_len)); -- if (!dmx->sec_pages) { -- pr_error("cannot allocate section buffer %d bytes %d order\n", -- dmx->sec_total_len, get_order(dmx->sec_total_len)); -- return -1; -- } -- dmx->sec_pages_map = -- dma_map_single(dmx_get_dev(dmx), (void *)dmx->sec_pages, -- dmx->sec_total_len, DMA_FROM_DEVICE); -- -- grp_addr[0] = dmx->sec_pages_map; -- -- grp_addr[1] = grp_addr[0] + grp_len[0]; -- grp_addr[2] = grp_addr[1] + grp_len[1]; -- grp_addr[3] = grp_addr[2] + grp_len[2]; -- -- dmx->sec_buf[0].addr = dmx->sec_pages; -- dmx->sec_buf[0].len = grp_len[0] / 8; -- -- for (i = 1; i < SEC_BUF_COUNT; i++) { -- dmx->sec_buf[i].addr = -- dmx->sec_buf[i - 1].addr + dmx->sec_buf[i - 1].len; -- dmx->sec_buf[i].len = grp_len[i / 8] / 8; -- } -- -- base = grp_addr[0] & 0xFFFF0000; -- DMX_WRITE_REG(dmx->id, SEC_BUFF_BASE, base >> 16); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_01_START, -- (((grp_addr[0] - base) >> 8) << 16) | -- ((grp_addr[1] - base) >> 8)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_23_START, -- (((grp_addr[2] - base) >> 8) << 16) | -- ((grp_addr[3] - base) >> 8)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_SIZE, -- SEC_GRP_LEN_0 | -- (SEC_GRP_LEN_1 << 4) | -- (SEC_GRP_LEN_2 << 8) | -- (SEC_GRP_LEN_3 << 12)); -- -- return 0; --} -- --#ifdef NO_SUB --/*Set subtitle buffer*/ --static int dmx_alloc_sub_buffer(struct aml_dmx *dmx) --{ -- unsigned long addr; -- -- if (dmx->sub_pages) -- return 0; -- -- dmx->sub_buf_len = 64 * 1024; -- dmx->sub_pages = -- __get_free_pages(GFP_KERNEL, get_order(dmx->sub_buf_len)); -- if (!dmx->sub_pages) { -- pr_error("cannot allocate subtitle buffer\n"); -- return -1; -- } -- dmx->sub_pages_map = -- dma_map_single(dmx_get_dev(dmx), (void *)dmx->sub_pages, -- dmx->sub_buf_len, DMA_FROM_DEVICE); -- -- addr = virt_to_phys((void *)dmx->sub_pages); -- DMX_WRITE_REG(dmx->id, SB_START, addr >> 12); -- DMX_WRITE_REG(dmx->id, SB_LAST_ADDR, (dmx->sub_buf_len >> 3) - 1); -- return 0; --} --#endif /*NO_SUB */ -- --/*Set PES buffer*/ --static int dmx_alloc_pes_buffer(struct aml_dmx *dmx) --{ -- unsigned long addr; -- -- if (dmx->pes_pages) -- return 0; -- -- dmx->pes_buf_len = 64 * 1024; -- dmx->pes_pages = -- __get_free_pages(GFP_KERNEL, get_order(dmx->pes_buf_len)); -- if (!dmx->pes_pages) { -- pr_error("cannot allocate pes buffer\n"); -- return -1; -- } -- dmx->pes_pages_map = -- dma_map_single(dmx_get_dev(dmx), (void *)dmx->pes_pages, -- dmx->pes_buf_len, DMA_FROM_DEVICE); -- -- addr = virt_to_phys((void *)dmx->pes_pages); -- DMX_WRITE_REG(dmx->id, OB_START, addr >> 12); -- DMX_WRITE_REG(dmx->id, OB_LAST_ADDR, (dmx->pes_buf_len >> 3) - 1); -- return 0; --} -- --/*Allocate ASYNC FIFO Buffer*/ --static unsigned long asyncfifo_alloc_buffer(int len) --{ -- unsigned long pages = __get_free_pages(GFP_KERNEL, get_order(len)); -- if (!pages) { -- pr_error("cannot allocate async fifo buffer\n"); -- return 0; -- } -- return pages; --} --static void asyncfifo_free_buffer(unsigned long buf, int len) --{ -- free_pages(buf, get_order(len)); --} -- --static int asyncfifo_set_buffer(struct aml_asyncfifo *afifo, -- int len, unsigned long buf) --{ -- if (afifo->pages) -- return -1; -- -- afifo->buf_toggle = 0; -- afifo->buf_read = 0; -- afifo->buf_len = len; -- pr_error("async fifo %d buf size %d, flush size %d\n", -- afifo->id, afifo->buf_len, afifo->flush_size); -- -- if (afifo->flush_size <= 0) -- afifo->flush_size = afifo->buf_len>>1; -- -- afifo->pages = buf; -- if (!afifo->pages) -- return -1; -- -- afifo->pages_map = dma_map_single(asyncfifo_get_dev(afifo), -- (void *)afifo->pages, afifo->buf_len, DMA_FROM_DEVICE); -- -- return 0; --} --static void asyncfifo_put_buffer(struct aml_asyncfifo *afifo) --{ -- if (afifo->pages) { -- dma_unmap_single(asyncfifo_get_dev(afifo), -- afifo->pages_map, afifo->buf_len, DMA_FROM_DEVICE); -- asyncfifo_free_buffer(afifo->pages, afifo->buf_len); -- afifo->pages_map = 0; -- afifo->pages = 0; -- } --} -- --int async_fifo_init(struct aml_asyncfifo *afifo, int initirq, -- int buf_len, unsigned long buf) --{ -- int ret = 0; -- int irq; -- -- if (afifo->init) -- return -1; -- -- afifo->source = AM_DMX_MAX; -- afifo->pages = 0; -- afifo->buf_toggle = 0; -- afifo->buf_read = 0; -- afifo->buf_len = 0; -- -- if (afifo->asyncfifo_irq == -1) { -- pr_error("no irq for ASYNC_FIFO%d\n", afifo->id); -- /*Do not return error*/ -- return -1; -- } -- -- tasklet_init(&afifo->asyncfifo_tasklet, -- dvr_irq_bh_handler, (unsigned long)afifo); -- if (initirq) -- irq = request_irq(afifo->asyncfifo_irq, dvr_irq_handler, -- IRQF_SHARED|IRQF_TRIGGER_RISING, -- "dvr irq", afifo); -- else -- enable_irq(afifo->asyncfifo_irq); -- -- /*alloc buffer*/ -- ret = asyncfifo_set_buffer(afifo, buf_len, buf); -- -- afifo->init = 1; -- -- return ret; --} -- --int async_fifo_deinit(struct aml_asyncfifo *afifo, int freeirq) --{ -- if (!afifo->init) -- return 0; -- -- CLEAR_ASYNC_FIFO_REG_MASK(afifo->id, REG1, 1 << ASYNC_FIFO_FLUSH_EN); -- CLEAR_ASYNC_FIFO_REG_MASK(afifo->id, REG2, 1 << ASYNC_FIFO_FILL_EN); -- -- asyncfifo_put_buffer(afifo); -- -- afifo->source = AM_DMX_MAX; -- afifo->buf_toggle = 0; -- afifo->buf_read = 0; -- afifo->buf_len = 0; -- -- if (afifo->asyncfifo_irq != -1) { -- if (freeirq) -- free_irq(afifo->asyncfifo_irq, afifo); -- else -- disable_irq(afifo->asyncfifo_irq); -- } -- tasklet_kill(&afifo->asyncfifo_tasklet); -- -- afifo->init = 0; -- -- return 0; --} -- --static int _dmx_smallsec_enable(struct aml_smallsec *ss, int bufsize) --{ -- if (!ss->buf) { -- -- ss->buf = __get_free_pages(GFP_KERNEL, -- get_order(bufsize)); -- if (!ss->buf) { -- pr_error("cannot allocate smallsec buffer\n" -- "%d bytes %d order\n", -- bufsize, get_order(bufsize)); -- return -1; -- } -- ss->buf_map = dma_map_single(dmx_get_dev(ss->dmx), -- (void *)ss->buf, -- bufsize, DMA_FROM_DEVICE); -- } -- -- DMX_WRITE_REG(ss->dmx->id, DEMUX_SMALL_SEC_ADDR, -- ss->buf_map); -- DMX_WRITE_REG(ss->dmx->id, DEMUX_SMALL_SEC_CTL, -- ((((bufsize>>8)-1)&0xff)<<24) | -- (1<<1) |/*enable reset the wr ptr*/ -- (1<<0)); -- -- ss->bufsize = bufsize; -- ss->enable = 1; -- -- pr_inf("demux%d smallsec buf start: %lx, size: %d\n", -- ss->dmx->id, ss->buf, ss->bufsize); -- return 0; --} -- --static int _dmx_smallsec_disable(struct aml_smallsec *ss) --{ -- DMX_WRITE_REG(ss->dmx->id, DEMUX_SMALL_SEC_CTL, 0); -- if (ss->buf) { -- dma_unmap_single(dmx_get_dev(ss->dmx), ss->buf_map, -- ss->bufsize, DMA_FROM_DEVICE); -- free_pages(ss->buf, get_order(ss->bufsize)); -- ss->buf = 0; -- ss->buf_map = 0; -- } -- ss->enable = 0; -- pr_inf("demux%d smallsec buf disable\n", ss->dmx->id); -- return 0; --} -- --static int dmx_smallsec_set(struct aml_smallsec *ss, int enable, int bufsize, -- int force) --{ -- if (!enable) {/*disable*/ -- -- if (ss->enable || force) -- _dmx_smallsec_disable(ss); -- -- } else {/*enable*/ -- -- if (bufsize < 0) -- bufsize = SS_BUFSIZE_DEF; -- else if (!bufsize) -- bufsize = ss->bufsize; -- else { -- /*unit:FF max:FF00*/ -- bufsize &= ~0xFF; -- bufsize &= 0x1FF00; -- } -- -- if ((ss->enable && (bufsize != ss->bufsize)) || force) -- _dmx_smallsec_disable(ss); -- -- if (!ss->enable) -- _dmx_smallsec_enable(ss, bufsize); -- } -- -- return 0; --} -- --static int _dmx_timeout_enable(struct aml_dmxtimeout *dto, int timeout, -- int ch_dis, int match) --{ -- -- DMX_WRITE_REG(dto->dmx->id, DEMUX_INPUT_TIMEOUT_C, ch_dis); -- DMX_WRITE_REG(dto->dmx->id, DEMUX_INPUT_TIMEOUT, -- ((!!match)<<31) | -- (timeout&0x7fffffff)); -- -- dto->ch_disable = ch_dis; -- dto->match = match; -- dto->timeout = timeout; -- dto->trigger = 0; -- dto->enable = 1; -- -- pr_inf("demux%d timeout enable:timeout(%d),ch(0x%x),match(%d)\n", -- dto->dmx->id, dto->timeout, dto->ch_disable, dto->match); -- -- return 0; --} --static int _dmx_timeout_disable(struct aml_dmxtimeout *dto) --{ -- -- DMX_WRITE_REG(dto->dmx->id, DEMUX_INPUT_TIMEOUT, 0); -- dto->enable = 0; -- dto->trigger = 0; -- pr_inf("demux%d timeout disable\n", dto->dmx->id); -- -- return 0; --} -- --static int dmx_timeout_set(struct aml_dmxtimeout *dto, int enable, -- int timeout, int ch_dis, int match, -- int force) --{ -- -- if (!enable) {/*disable*/ -- -- if (dto->enable || force) -- _dmx_timeout_disable(dto); -- -- } else {/*enable*/ -- -- if (timeout < 0) { -- timeout = DTO_TIMEOUT_DEF; -- ch_dis = DTO_CHDIS_VAS; -- match = dto->match; -- } else if (!timeout) { -- timeout = dto->timeout; -- ch_dis = dto->ch_disable; -- match = dto->match; -- } -- -- if ((dto->enable && (timeout != dto->timeout)) -- || force) -- _dmx_timeout_disable(dto); -- -- if (!dto->enable) -- _dmx_timeout_enable(dto, timeout, ch_dis, match); -- } -- -- return 0; --} -- --/*Initalize the registers*/ --static int dmx_init(struct aml_dmx *dmx) --{ -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- int irq; -- -- if (dmx->init) -- return 0; -- -- pr_inf("demux init\n"); -- -- /*Register irq handlers */ -- if (dmx->dmx_irq != -1) { -- pr_dbg("request irq\n"); -- tasklet_init(&dmx->dmx_tasklet, -- dmx_irq_bh_handler, -- (unsigned long)dmx); -- irq = request_irq(dmx->dmx_irq, dmx_irq_handler, -- IRQF_SHARED|IRQF_TRIGGER_RISING, -- "dmx irq", dmx); -- } -- -- /*Allocate buffer */ -- if (dmx_alloc_sec_buffer(dmx) < 0) -- return -1; --#ifdef NO_SUB -- if (dmx_alloc_sub_buffer(dmx) < 0) -- return -1; --#endif -- if (dmx_alloc_pes_buffer(dmx) < 0) -- return -1; -- -- /*Reset the hardware */ -- if (!dvb->dmx_init) { -- init_timer(&dvb->watchdog_timer); -- dvb->watchdog_timer.function = section_buffer_watchdog_func; -- dvb->watchdog_timer.expires = -- jiffies + msecs_to_jiffies(WATCHDOG_TIMER); -- dvb->watchdog_timer.data = (unsigned long)dvb; --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- add_timer(&dvb->watchdog_timer); --#endif -- dmx_reset_hw(dvb); -- } -- -- dvb->dmx_init++; -- -- memset(dmx->sec_buf_watchdog_count, 0, -- sizeof(dmx->sec_buf_watchdog_count)); -- -- dmx->init = 1; -- -- return 0; --} -- --/*Release the resource*/ --static int dmx_deinit(struct aml_dmx *dmx) --{ -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- -- if (!dmx->init) -- return 0; -- -- DMX_WRITE_REG(dmx->id, DEMUX_CONTROL, 0); -- -- dvb->dmx_init--; -- -- /*Reset the hardware */ -- if (!dvb->dmx_init) { -- dmx_reset_hw(dvb); --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- del_timer_sync(&dvb->watchdog_timer); --#endif -- } -- -- if (dmx->sec_pages) { -- dma_unmap_single(dmx_get_dev(dmx), dmx->sec_pages_map, -- dmx->sec_total_len, DMA_FROM_DEVICE); -- free_pages(dmx->sec_pages, get_order(dmx->sec_total_len)); -- dmx->sec_pages = 0; -- dmx->sec_pages_map = 0; -- } --#ifdef NO_SUB -- if (dmx->sub_pages) { -- dma_unmap_single(dmx_get_dev(dmx), dmx->sub_pages_map, -- dmx->sub_buf_len, DMA_FROM_DEVICE); -- free_pages(dmx->sub_pages, get_order(dmx->sub_buf_len)); -- dmx->sub_pages = 0; -- } --#endif -- if (dmx->pes_pages) { -- dma_unmap_single(dmx_get_dev(dmx), dmx->pes_pages_map, -- dmx->pes_buf_len, DMA_FROM_DEVICE); -- free_pages(dmx->pes_pages, get_order(dmx->pes_buf_len)); -- dmx->pes_pages = 0; -- } -- -- if (dmx->dmx_irq != -1) { -- free_irq(dmx->dmx_irq, dmx); -- tasklet_kill(&dmx->dmx_tasklet); -- } -- -- dmx->init = 0; -- -- return 0; --} -- --/*Check the record flag*/ --static int dmx_get_record_flag(struct aml_dmx *dmx) --{ -- int i, linked = 0, record_flag = 0; -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- -- /*Check whether a async fifo connected to this dmx */ -- for (i = 0; i < ASYNCFIFO_COUNT; i++) { -- if (!dvb->asyncfifo[i].init) -- continue; -- if ((dvb->asyncfifo[i].source == dmx->id) -- /*&& !(dvb->swfilter.user && (i==SF_AFIFO_ID)) */ -- /*sf mode reserved */ -- ) { -- linked = 1; -- break; -- } -- } -- -- for (i = 0; i < CHANNEL_COUNT; i++) { -- if (dmx->channel[i].used && dmx->channel[i].dvr_feed) { -- if (!dmx->record) { -- dmx->record = 1; -- -- if (linked) { -- /*A new record will start, -- must reset the async fifos for -- linking the right demux */ -- reset_async_fifos(dvb); -- } -- } -- if (linked) -- record_flag = 1; -- goto find_done; -- } -- } -- -- if (dmx->record) { -- dmx->record = 0; -- if (linked) { -- /*A record will stop, reset the async fifos -- for linking the right demux */ -- reset_async_fifos(dvb); -- } -- } -- --find_done: -- return record_flag; --} -- --/*Enable the demux device*/ --static int dmx_enable(struct aml_dmx *dmx) --{ -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- int fec_sel, hi_bsf, fec_ctrl, record; -- int fec_core_sel = 0; -- int set_stb = 0, fec_s = 0; -- int s2p_id; -- u32 invert0 = 0, invert1 = 0, fec_s0 = 0, fec_s1 = 0; -- -- record = dmx_get_record_flag(dmx); -- -- switch (dmx->source) { -- case AM_TS_SRC_TS0: -- fec_sel = 0; -- fec_ctrl = dvb->ts[0].control; -- record = record ? 1 : 0; -- break; -- case AM_TS_SRC_TS1: -- fec_sel = 1; -- fec_ctrl = dvb->ts[1].control; -- record = record ? 1 : 0; -- break; -- case AM_TS_SRC_TS2: -- fec_sel = 2; -- fec_ctrl = dvb->ts[2].control; -- record = record ? 1 : 0; -- break; -- case AM_TS_SRC_S_TS0: -- case AM_TS_SRC_S_TS1: -- case AM_TS_SRC_S_TS2: -- s2p_id = 0; -- fec_ctrl = 0; -- if (dmx->source == AM_TS_SRC_S_TS0) { -- s2p_id = dvb->ts[0].s2p_id; -- fec_ctrl = dvb->ts[0].control; -- } else if (dmx->source == AM_TS_SRC_S_TS1) { -- s2p_id = dvb->ts[1].s2p_id; -- fec_ctrl = dvb->ts[1].control; -- } else if (dmx->source == AM_TS_SRC_S_TS2) { -- s2p_id = dvb->ts[2].s2p_id; -- fec_ctrl = dvb->ts[2].control; -- } -- fec_sel = (s2p_id == 1) ? 5 : 6; -- record = record ? 1 : 0; -- set_stb = 1; -- fec_s = dmx->source - AM_TS_SRC_S_TS0; -- break; -- case AM_TS_SRC_HIU: -- fec_sel = 7; -- fec_ctrl = 0; -- record = 0; -- break; -- default: -- fec_sel = 0; -- fec_ctrl = 0; -- record = 0; -- break; -- } -- -- if (dmx->channel[0].used || dmx->channel[1].used) -- hi_bsf = 1; -- else -- hi_bsf = 0; -- -- if ((dvb->dsc[0].dst != -1) -- && ((dvb->dsc[0].dst - AM_TS_SRC_DMX0) == dmx->id)) -- fec_core_sel = 1; -- -- if ((dvb->dsc[1].dst != -1) -- && ((dvb->dsc[1].dst - AM_TS_SRC_DMX0) == dmx->id)) { -- int des_in, des_out, en_des = 0; -- switch (dvb->dsc[1].source) { -- case AM_TS_SRC_DMX0: -- des_in = 0; -- en_des = 1; -- break; -- case AM_TS_SRC_DMX1: -- des_in = 1; -- en_des = 1; -- break; -- case AM_TS_SRC_DMX2: -- des_in = 2; -- en_des = 1; -- break; -- default: -- des_in = 0; -- en_des = 0; -- break; -- } -- -- switch (dvb->dsc[1].dst) { -- case AM_TS_SRC_DMX0: -- des_out = 1; -- break; -- case AM_TS_SRC_DMX1: -- des_out = 2; -- break; -- case AM_TS_SRC_DMX2: -- des_out = 4; -- break; -- default: -- des_out = 0; -- break; -- } -- -- if (!des_out) -- en_des = 0; -- -- WRITE_MPEG_REG(COMM_DESC_2_CTL, -- (6 << 8) |/*des_out_dly_2*/ -- ((!!en_des) << 6) |/* des_pl_clk_2*/ -- ((!!en_des) << 5) |/* des_pl_2*/ -- (des_out << 2) |/*use_des_2*/ -- (des_in)/*des_i_sel_2*/ -- ); -- fec_core_sel = 1; -- pr_dbg("dsc2 ctrl: 0x%x\n", READ_MPEG_REG(COMM_DESC_2_CTL)); -- } -- -- pr_dbg("[dmx-%d]src: %d, rec: %d, hi_bsf: %d, dsc: %d\n", -- dmx->id, dmx->source, record, hi_bsf, fec_core_sel); -- -- if (dmx->chan_count) { -- if (set_stb) { -- u32 v = READ_MPEG_REG(STB_TOP_CONFIG); -- int i; -- -- for (i = 0; i < TS_IN_COUNT; i++) { -- if (dvb->ts[i].s2p_id == 0) -- fec_s0 = i; -- else if (dvb->ts[i].s2p_id == 1) -- fec_s1 = i; -- } -- -- invert0 = dvb->s2p[0].invert; -- invert1 = dvb->s2p[1].invert; -- -- v &= ~((0x3 << S2P0_FEC_SERIAL_SEL) | -- (0x1f << INVERT_S2P0_FEC_CLK) | -- (0x3 << S2P1_FEC_SERIAL_SEL) | -- (0x1f << INVERT_S2P1_FEC_CLK)); -- -- v |= (fec_s0 << S2P0_FEC_SERIAL_SEL) | -- (invert0 << INVERT_S2P0_FEC_CLK) | -- (fec_s1 << S2P1_FEC_SERIAL_SEL) | -- (invert1 << INVERT_S2P1_FEC_CLK); -- WRITE_MPEG_REG(STB_TOP_CONFIG, v); -- } -- -- /*Initialize the registers */ -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, DEMUX_INT_MASK); -- DMX_WRITE_REG(dmx->id, DEMUX_MEM_REQ_EN, --#ifdef USE_AHB_MODE -- (1 << SECTION_AHB_DMA_EN) | -- (0 << SUB_AHB_DMA_EN) | -- (1 << OTHER_PES_AHB_DMA_EN) | --#endif -- (1 << SECTION_PACKET) | -- (1 << VIDEO_PACKET) | -- (1 << AUDIO_PACKET) | -- (1 << SUB_PACKET) | -- (1 << SCR_ONLY_PACKET) | -- (1 << OTHER_PES_PACKET)); -- DMX_WRITE_REG(dmx->id, PES_STRONG_SYNC, 0x1234); -- DMX_WRITE_REG(dmx->id, DEMUX_ENDIAN, -- (7 << OTHER_ENDIAN) | -- (7 << BYPASS_ENDIAN) | (0 << SECTION_ENDIAN)); -- DMX_WRITE_REG(dmx->id, TS_HIU_CTL, -- (0 << LAST_BURST_THRESHOLD) | -- (hi_bsf << USE_HI_BSF_INTERFACE)); -- -- DMX_WRITE_REG(dmx->id, FEC_INPUT_CONTROL, -- (fec_core_sel << FEC_CORE_SEL) | -- (fec_sel << FEC_SEL) | (fec_ctrl << 0)); -- DMX_WRITE_REG(dmx->id, STB_OM_CTL, -- (0x40 << MAX_OM_DMA_COUNT) | -- (0x7f << LAST_OM_ADDR)); -- DMX_WRITE_REG(dmx->id, DEMUX_CONTROL, -- (0 << BYPASS_USE_RECODER_PATH) | -- (0 << INSERT_AUDIO_PES_STRONG_SYNC) | -- (0 << INSERT_VIDEO_PES_STRONG_SYNC) | -- (0 << OTHER_INT_AT_PES_BEGINING) | -- (0 << DISCARD_AV_PACKAGE) | -- ((!!dmx->dump_ts_select) << TS_RECORDER_SELECT) | -- (record << TS_RECORDER_ENABLE) | -- (1 << KEEP_DUPLICATE_PACKAGE) | -- (1 << SECTION_END_WITH_TABLE_ID) | -- (1 << ENABLE_FREE_CLK_FEC_DATA_VALID) | -- (1 << ENABLE_FREE_CLK_STB_REG) | -- (1 << STB_DEMUX_ENABLE) | -- (1 << NOT_USE_OF_SOP_INPUT)); -- } else { -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, 0); -- DMX_WRITE_REG(dmx->id, FEC_INPUT_CONTROL, 0); -- DMX_WRITE_REG(dmx->id, DEMUX_CONTROL, 0); -- } -- -- return 0; --} -- --static int dmx_set_misc(struct aml_dmx *dmx, int hi_bsf, int en_dsc) --{ -- if (hi_bsf >= 0) { -- DMX_WRITE_REG(dmx->id, TS_HIU_CTL, -- hi_bsf ? -- (DMX_READ_REG(dmx->id, TS_HIU_CTL) | -- (1 << USE_HI_BSF_INTERFACE)) -- : -- (DMX_READ_REG(dmx->id, TS_HIU_CTL) & -- (~(1 << USE_HI_BSF_INTERFACE)))); -- } -- -- if (en_dsc >= 0) { -- DMX_WRITE_REG(dmx->id, FEC_INPUT_CONTROL, -- en_dsc ? -- (DMX_READ_REG(dmx->id, FEC_INPUT_CONTROL) | -- (1 << FEC_CORE_SEL)) -- : -- (DMX_READ_REG(dmx->id, FEC_INPUT_CONTROL) & -- (~(1 << FEC_CORE_SEL)))); -- } -- -- return 0; --} -- --static int dmx_set_misc_id(struct aml_dvb *dvb, int id, int hi_bsf, int en_dsc) --{ -- return dmx_set_misc(&dvb->dmx[id], hi_bsf, en_dsc); --} -- --/*Get the channel's ID by its PID*/ --static int dmx_get_chan(struct aml_dmx *dmx, int pid) --{ -- int id; -- -- for (id = 0; id < CHANNEL_COUNT; id++) { -- if (dmx->channel[id].used && dmx->channel[id].pid == pid) -- return id; -- } -- -- return -1; --} -- --/*Get the channel's target*/ --static u32 dmx_get_chan_target(struct aml_dmx *dmx, int cid) --{ -- u32 type; -- -- if (!dmx->channel[cid].used) -- return 0xFFFF; -- -- if (dmx->channel[cid].type == DMX_TYPE_SEC) { -- type = SECTION_PACKET; -- } else { -- switch (dmx->channel[cid].pes_type) { -- case DMX_PES_AUDIO: -- type = AUDIO_PACKET; -- break; -- case DMX_PES_VIDEO: -- type = VIDEO_PACKET; -- break; -- case DMX_PES_SUBTITLE: -- case DMX_PES_TELETEXT: -- type = SUB_PACKET; -- break; -- case DMX_PES_PCR: -- type = SCR_ONLY_PACKET; -- break; -- default: -- type = OTHER_PES_PACKET; -- break; -- } -- } -- -- pr_dbg("chan target: %x %x\n", type, dmx->channel[cid].pid); -- return (type << PID_TYPE) | dmx->channel[cid].pid; --} -- --/*Get the advance value of the channel*/ --static inline u32 dmx_get_chan_advance(struct aml_dmx *dmx, int cid) --{ -- return 0; --} -- --/*Set the channel registers*/ --static int dmx_set_chan_regs(struct aml_dmx *dmx, int cid) --{ -- u32 data, addr, advance, max; -- -- pr_dbg("set channel (id:%d PID:0x%x) registers\n", cid, -- dmx->channel[cid].pid); -- -- while (DMX_READ_REG(dmx->id, FM_WR_ADDR) & 0x8000) -- udelay(1); -- -- if (cid & 1) { -- data = -- (dmx_get_chan_target(dmx, cid - 1) << 16) | -- dmx_get_chan_target(dmx, cid); -- advance = -- (dmx_get_chan_advance(dmx, cid) << 8) | -- dmx_get_chan_advance(dmx, cid - 1); -- } else { -- data = -- (dmx_get_chan_target(dmx, cid) << 16) | -- dmx_get_chan_target(dmx, cid + 1); -- advance = -- (dmx_get_chan_advance(dmx, cid + 1) << 8) | -- dmx_get_chan_advance(dmx, cid); -- } -- addr = cid >> 1; -- DMX_WRITE_REG(dmx->id, FM_WR_DATA, data); -- DMX_WRITE_REG(dmx->id, FM_WR_ADDR, (advance << 16) | 0x8000 | addr); -- -- pr_dbg("write fm %x:%x\n", (advance << 16) | 0x8000 | addr, data); -- -- for (max = CHANNEL_COUNT - 1; max > 0; max--) { -- if (dmx->channel[max].used) -- break; -- } -- -- data = DMX_READ_REG(dmx->id, MAX_FM_COMP_ADDR) & 0xF0; -- DMX_WRITE_REG(dmx->id, MAX_FM_COMP_ADDR, data | (max >> 1)); -- -- pr_dbg("write fm comp %x\n", data | (max >> 1)); -- -- if (DMX_READ_REG(dmx->id, OM_CMD_STATUS) & 0x8e00) { -- pr_error("error send cmd %x\n", -- DMX_READ_REG(dmx->id, OM_CMD_STATUS)); -- } -- -- if (cid == 0) -- first_video_pts = 0; -- else if (cid == 1) -- first_audio_pts = 0; -- -- return 0; --} -- --/*Get the filter target*/ --static int dmx_get_filter_target(struct aml_dmx *dmx, int fid, u32 *target, -- u8 *advance) --{ -- struct dmx_section_filter *filter; -- struct aml_filter *f; -- int i, cid, neq_bytes; -- -- fid = fid & 0xFFFF; -- f = &dmx->filter[fid]; -- -- if (!f->used) { -- target[0] = 0x1fff; -- advance[0] = 0; -- for (i = 1; i < FILTER_LEN; i++) { -- target[i] = 0x9fff; -- advance[i] = 0; -- } -- return 0; -- } -- -- cid = f->chan_id; -- filter = f->filter; -- -- neq_bytes = 0; -- if (filter->filter_mode[0] != 0xFF) { -- neq_bytes = 2; -- } else { -- for (i = 3; i < FILTER_LEN; i++) { -- if (filter->filter_mode[i] != 0xFF) -- neq_bytes++; -- } -- } -- -- f->neq = 0; -- -- for (i = 0; i < FILTER_LEN; i++) { -- u8 value = filter->filter_value[i]; -- u8 mask = filter->filter_mask[i]; -- u8 mode = filter->filter_mode[i]; -- u8 mb, mb1, nb, v, t, adv = 0; -- -- if (!i) { -- mb = 1; -- mb1 = 1; -- v = 0; -- if ((mode == 0xFF) && mask) { -- t = mask & 0xF0; -- if (t) { -- mb1 = 0; -- adv |= t^0xF0; -- } -- v |= (value & 0xF0) | adv; -- -- t = mask & 0x0F; -- if (t) { -- mb = 0; -- adv |= t^0x0F; -- } -- v |= (value & 0x0F) | adv; -- } -- -- target[i] = (mb << SECTION_FIRSTBYTE_MASKLOW) | -- (mb1 << SECTION_FIRSTBYTE_MASKHIGH) | -- (0 << SECTION_FIRSTBYTE_DISABLE_PID_CHECK) | -- (cid << SECTION_FIRSTBYTE_PID_INDEX) | v; -- advance[i] = adv; -- } else { -- if (i < 3) { -- value = 0; -- mask = 0; -- mode = 0xff; -- } -- mb = 1; -- nb = 0; -- v = 0; -- -- if ((i >= 3) && mask) { -- if (mode == 0xFF) { -- mb = 0; -- nb = 0; -- adv = mask ^ 0xFF; -- v = value | adv; -- } else { -- if (neq_bytes == 1) { -- mb = 0; -- nb = 1; -- adv = mask ^ 0xFF; -- v = value & ~adv; -- } -- } -- } -- target[i] = (mb << SECTION_RESTBYTE_MASK) | -- (nb << SECTION_RESTBYTE_MASK_EQ) | -- (0 << SECTION_RESTBYTE_DISABLE_PID_CHECK) | -- (cid << SECTION_RESTBYTE_PID_INDEX) | v; -- advance[i] = adv; -- } -- -- f->value[i] = value; -- f->maskandmode[i] = mask & mode; -- f->maskandnotmode[i] = mask & ~mode; -- -- if (f->maskandnotmode[i]) -- f->neq = 1; -- } -- -- return 0; --} -- --/*Set the filter registers*/ --static int dmx_set_filter_regs(struct aml_dmx *dmx, int fid) --{ -- u32 t1[FILTER_LEN], t2[FILTER_LEN]; -- u8 advance1[FILTER_LEN], advance2[FILTER_LEN]; -- u32 addr, data, max, adv; -- int i; -- -- pr_dbg("set filter (id:%d) registers\n", fid); -- -- if (fid & 1) { -- dmx_get_filter_target(dmx, fid - 1, t1, advance1); -- dmx_get_filter_target(dmx, fid, t2, advance2); -- } else { -- dmx_get_filter_target(dmx, fid, t1, advance1); -- dmx_get_filter_target(dmx, fid + 1, t2, advance2); -- } -- -- for (i = 0; i < FILTER_LEN; i++) { -- while (DMX_READ_REG(dmx->id, FM_WR_ADDR) & 0x8000) -- udelay(1); -- -- data = (t1[i] << 16) | t2[i]; -- addr = (fid >> 1) | ((i + 1) << 4); -- adv = (advance1[i] << 8) | advance2[i]; -- -- DMX_WRITE_REG(dmx->id, FM_WR_DATA, data); -- DMX_WRITE_REG(dmx->id, FM_WR_ADDR, (adv << 16) | 0x8000 | addr); -- -- pr_dbg("write fm %x:%x\n", (adv << 16) | 0x8000 | addr, data); -- } -- -- for (max = FILTER_COUNT - 1; max > 0; max--) { -- if (dmx->filter[max].used) -- break; -- } -- -- data = DMX_READ_REG(dmx->id, MAX_FM_COMP_ADDR) & 0xF; -- DMX_WRITE_REG(dmx->id, MAX_FM_COMP_ADDR, data | ((max >> 1) << 4)); -- -- pr_dbg("write fm comp %x\n", data | ((max >> 1) << 4)); -- -- if (DMX_READ_REG(dmx->id, OM_CMD_STATUS) & 0x8e00) { -- pr_error("error send cmd %x\n", -- DMX_READ_REG(dmx->id, OM_CMD_STATUS)); -- } -- -- return 0; --} -- --/*Clear the filter's buffer*/ --static void dmx_clear_filter_buffer(struct aml_dmx *dmx, int fid) --{ -- u32 section_busy32 = DMX_READ_REG(dmx->id, SEC_BUFF_READY); -- u32 filter_number; -- int i; -- -- if (!section_busy32) -- return; -- -- for (i = 0; i < SEC_BUF_COUNT; i++) { -- if (section_busy32 & (1 << i)) { -- DMX_WRITE_REG(dmx->id, SEC_BUFF_NUMBER, i); -- filter_number = -- (DMX_READ_REG(dmx->id, SEC_BUFF_NUMBER) >> 8); -- if (filter_number != fid) -- section_busy32 &= ~(1 << i); -- } -- } -- -- if (section_busy32) -- DMX_WRITE_REG(dmx->id, SEC_BUFF_READY, section_busy32); --} -- --static void async_fifo_set_regs(struct aml_asyncfifo *afifo, int source_val) --{ -- u32 start_addr = virt_to_phys((void *)afifo->pages); -- u32 size = afifo->buf_len; -- u32 flush_size = afifo->flush_size; -- int factor = dmx_get_order(size / flush_size); -- -- pr_dbg("ASYNC FIFO id=%d, link to DMX%d, start_addr %x, buf_size %d," -- "source value 0x%x, factor %d\n", -- afifo->id, afifo->source, start_addr, size, source_val, factor); -- /* Destination address */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG0, start_addr); -- -- /* Setup flush parameters */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG1, -- (0 << ASYNC_FIFO_TO_HIU) | -- (0 << ASYNC_FIFO_FLUSH) | -- /* don't flush the path */ -- (1 << ASYNC_FIFO_RESET) | -- /* reset the path */ -- (1 << ASYNC_FIFO_WRAP_EN) | -- /* wrap enable */ -- (0 << ASYNC_FIFO_FLUSH_EN) | -- /* disable the flush path */ -- /*(0x3 << ASYNC_FIFO_FLUSH_CNT_LSB); -- // flush 3 x 32 32-bit words */ -- /*(0x7fff << ASYNC_FIFO_FLUSH_CNT_LSB); -- // flush 4MBytes of data */ -- (((size >> 7) & 0x7fff) << ASYNC_FIFO_FLUSH_CNT_LSB)); -- /* number of 128-byte blocks to flush */ -- -- /* clear the reset signal */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG1, -- READ_ASYNC_FIFO_REG(afifo->id, -- REG1) & ~(1 << ASYNC_FIFO_RESET)); -- /* Enable flush */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG1, -- READ_ASYNC_FIFO_REG(afifo->id, -- REG1) | (1 << ASYNC_FIFO_FLUSH_EN)); -- -- /*Setup Fill parameters */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG2, -- (1 << ASYNC_FIFO_ENDIAN_LSB) | -- (0 << ASYNC_FIFO_FILL_EN) | -- /* disable fill path to reset fill path */ -- /*(96 << ASYNC_FIFO_FILL_CNT_LSB); -- // 3 x 32 32-bit words */ -- (0 << ASYNC_FIFO_FILL_CNT_LSB)); -- /* forever FILL; */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG2, -- READ_ASYNC_FIFO_REG(afifo->id, REG2) | -- (1 << ASYNC_FIFO_FILL_EN));/*Enable fill path*/ -- -- /* generate flush interrupt */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG3, -- (READ_ASYNC_FIFO_REG(afifo->id, REG3) & 0xffff0000) | -- ((((size >> (factor + 7)) - 1) & 0x7fff) << -- ASYNC_FLUSH_SIZE_IRQ_LSB)); -- -- /* Connect the STB DEMUX to ASYNC_FIFO */ -- WRITE_ASYNC_FIFO_REG(afifo->id, REG2, -- READ_ASYNC_FIFO_REG(afifo->id, REG2) | -- (source_val << ASYNC_FIFO_SOURCE_LSB)); --} -- --/*Reset the ASYNC FIFOS when a ASYNC FIFO connect to a different DMX*/ --static void reset_async_fifos(struct aml_dvb *dvb) --{ -- struct aml_asyncfifo *low_dmx_fifo = NULL; -- struct aml_asyncfifo *high_dmx_fifo = NULL; -- int i, j; -- int record_enable; -- -- pr_dbg("reset ASYNC FIFOs\n"); -- for (i = 0; i < ASYNCFIFO_COUNT; i++) { -- if (!dvb->asyncfifo[i].init) -- continue; -- pr_dbg("Disable ASYNC FIFO id=%d\n", dvb->asyncfifo[i].id); -- CLEAR_ASYNC_FIFO_REG_MASK(dvb->asyncfifo[i].id, REG1, -- 1 << ASYNC_FIFO_FLUSH_EN); -- CLEAR_ASYNC_FIFO_REG_MASK(dvb->asyncfifo[i].id, REG2, -- 1 << ASYNC_FIFO_FILL_EN); -- if (READ_ASYNC_FIFO_REG(dvb->asyncfifo[i].id, REG2) & -- (1 << ASYNC_FIFO_FILL_EN) || -- READ_ASYNC_FIFO_REG(dvb->asyncfifo[i].id, REG1) & -- (1 << ASYNC_FIFO_FLUSH_EN)) { -- pr_dbg("Set reg failed\n"); -- } else -- pr_dbg("Set reg ok\n"); -- dvb->asyncfifo[i].buf_toggle = 0; -- dvb->asyncfifo[i].buf_read = 0; -- } -- -- for (j = 0; j < DMX_DEV_COUNT; j++) { -- if (!dvb->dmx[j].init) -- continue; -- record_enable = 0; -- for (i = 0; i < ASYNCFIFO_COUNT; i++) { -- if (!dvb->asyncfifo[i].init) -- continue; -- -- if (dvb->dmx[j].record -- && dvb->dmx[j].id == dvb->asyncfifo[i].source) { -- /*This dmx is linked to the async fifo, -- Enable the TS_RECORDER_ENABLE */ -- record_enable = 1; -- if (!low_dmx_fifo) { -- low_dmx_fifo = &dvb->asyncfifo[i]; -- } else if (low_dmx_fifo->source > -- dvb->asyncfifo[i].source) { -- high_dmx_fifo = low_dmx_fifo; -- low_dmx_fifo = &dvb->asyncfifo[i]; -- } else if (low_dmx_fifo->source < -- dvb->asyncfifo[i].source) { -- high_dmx_fifo = &dvb->asyncfifo[i]; -- } -- -- break; -- } -- } -- pr_dbg("Set DMX%d TS_RECORDER_ENABLE to %d\n", dvb->dmx[j].id, -- record_enable ? 1 : 0); -- if (record_enable) { -- /*DMX_SET_REG_MASK(dvb->dmx[j].id, -- DEMUX_CONTROL, 1<dmx[j].id, DEMUX_CONTROL, -- DMX_READ_REG(dvb->dmx[j].id, DEMUX_CONTROL) | -- (1 << TS_RECORDER_ENABLE)); -- } else { -- /*DMX_CLEAR_REG_MASK(dvb->dmx[j].id, -- DEMUX_CONTROL, 1<dmx[j].id, DEMUX_CONTROL, -- DMX_READ_REG(dvb->dmx[j].id, DEMUX_CONTROL) & -- (~(1 << TS_RECORDER_ENABLE))); -- } -- } -- -- /*Set the async fifo regs */ -- if (low_dmx_fifo) { -- async_fifo_set_regs(low_dmx_fifo, 0x3); -- -- if (high_dmx_fifo) -- async_fifo_set_regs(high_dmx_fifo, 0x2); -- } --} -- --/*Reset the demux device*/ --void dmx_reset_hw(struct aml_dvb *dvb) --{ -- dmx_reset_hw_ex(dvb, 1); --} -- --/*Reset the demux device*/ --void dmx_reset_hw_ex(struct aml_dvb *dvb, int reset_irq) --{ -- int id, times; -- -- pr_dbg("demux reset begin\n"); -- -- for (id = 0; id < DMX_DEV_COUNT; id++) { -- if (!dvb->dmx[id].init) -- continue; -- if (reset_irq) { -- if (dvb->dmx[id].dmx_irq != -1) -- disable_irq(dvb->dmx[id].dmx_irq); -- if (dvb->dmx[id].dvr_irq != -1) -- disable_irq(dvb->dmx[id].dvr_irq); -- } -- } --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- if (reset_irq) -- del_timer_sync(&dvb->watchdog_timer); --#endif -- -- WRITE_MPEG_REG(RESET1_REGISTER, RESET_DEMUXSTB); -- -- for (id = 0; id < DMX_DEV_COUNT; id++) { -- times = 0; -- while (times++ < 1000000) { -- if (!(DMX_READ_REG(id, OM_CMD_STATUS) & 0x01)) -- break; -- } -- } -- -- WRITE_MPEG_REG(STB_TOP_CONFIG, 0); -- -- for (id = 0; id < DMX_DEV_COUNT; id++) { -- u32 version, data; -- -- if (!dvb->dmx[id].init) -- continue; -- -- if (reset_irq) { -- if (dvb->dmx[id].dmx_irq != -1) -- enable_irq(dvb->dmx[id].dmx_irq); -- if (dvb->dmx[id].dvr_irq != -1) -- enable_irq(dvb->dmx[id].dvr_irq); -- } -- DMX_WRITE_REG(id, DEMUX_CONTROL, 0x0000); -- version = DMX_READ_REG(id, STB_VERSION); -- DMX_WRITE_REG(id, STB_TEST_REG, version); -- pr_dbg("STB %d hardware version : %d\n", id, version); -- DMX_WRITE_REG(id, STB_TEST_REG, 0x5550); -- data = DMX_READ_REG(id, STB_TEST_REG); -- if (data != 0x5550) -- pr_error("STB %d register access failed\n", id); -- DMX_WRITE_REG(id, STB_TEST_REG, 0xaaa0); -- data = DMX_READ_REG(id, STB_TEST_REG); -- if (data != 0xaaa0) -- pr_error("STB %d register access failed\n", id); -- DMX_WRITE_REG(id, MAX_FM_COMP_ADDR, 0x0000); -- DMX_WRITE_REG(id, STB_INT_MASK, 0); -- DMX_WRITE_REG(id, STB_INT_STATUS, 0xffff); -- DMX_WRITE_REG(id, FEC_INPUT_CONTROL, 0); -- } -- -- stb_enable(dvb); -- -- for (id = 0; id < DMX_DEV_COUNT; id++) { -- struct aml_dmx *dmx = &dvb->dmx[id]; -- int n; -- unsigned long addr; -- unsigned long base; -- unsigned long grp_addr[SEC_BUF_GRP_COUNT]; -- int grp_len[SEC_BUF_GRP_COUNT]; -- if (!dvb->dmx[id].init) -- continue; -- -- if (dmx->sec_pages) { -- grp_len[0] = (1 << SEC_GRP_LEN_0) * 8; -- grp_len[1] = (1 << SEC_GRP_LEN_1) * 8; -- grp_len[2] = (1 << SEC_GRP_LEN_2) * 8; -- grp_len[3] = (1 << SEC_GRP_LEN_3) * 8; -- -- grp_addr[0] = virt_to_phys((void *)dmx->sec_pages); -- grp_addr[1] = grp_addr[0] + grp_len[0]; -- grp_addr[2] = grp_addr[1] + grp_len[1]; -- grp_addr[3] = grp_addr[2] + grp_len[2]; -- -- base = grp_addr[0] & 0xFFFF0000; -- DMX_WRITE_REG(dmx->id, SEC_BUFF_BASE, base >> 16); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_01_START, -- (((grp_addr[0] - base) >> 8) << 16) | -- ((grp_addr[1] - base) >> 8)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_23_START, -- (((grp_addr[2] - base) >> 8) << 16) | -- ((grp_addr[3] - base) >> 8)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_SIZE, -- SEC_GRP_LEN_0 | -- (SEC_GRP_LEN_1 << 4) | -- (SEC_GRP_LEN_2 << 8) | -- (SEC_GRP_LEN_3 << 12)); -- } -- -- if (dmx->sub_pages) { -- addr = virt_to_phys((void *)dmx->sub_pages); -- DMX_WRITE_REG(dmx->id, SB_START, addr >> 12); -- DMX_WRITE_REG(dmx->id, SB_LAST_ADDR, -- (dmx->sub_buf_len >> 3) - 1); -- } -- -- if (dmx->pes_pages) { -- addr = virt_to_phys((void *)dmx->pes_pages); -- DMX_WRITE_REG(dmx->id, OB_START, addr >> 12); -- DMX_WRITE_REG(dmx->id, OB_LAST_ADDR, -- (dmx->pes_buf_len >> 3) - 1); -- } -- -- for (n = 0; n < CHANNEL_COUNT; n++) { -- /*struct aml_channel *chan = &dmx->channel[n];*/ -- -- /*if (chan->used)*/ -- { -- dmx_set_chan_regs(dmx, n); -- } -- } -- -- for (n = 0; n < FILTER_COUNT; n++) { -- struct aml_filter *filter = &dmx->filter[n]; -- -- if (filter->used) -- dmx_set_filter_regs(dmx, n); -- } -- -- dmx_enable(&dvb->dmx[id]); -- -- dmx_smallsec_set(&dmx->smallsec, -- dmx->smallsec.enable, -- dmx->smallsec.bufsize, -- 1); -- -- dmx_timeout_set(&dmx->timeout, -- dmx->timeout.enable, -- dmx->timeout.timeout, -- dmx->timeout.ch_disable, -- dmx->timeout.match, -- 1); -- } -- -- for (id = 0; id < DSC_DEV_COUNT; id++) { -- struct aml_dsc *dsc = &dvb->dsc[id]; -- int n; -- -- for (n = 0; n < DSC_COUNT; n++) { -- struct aml_dsc_channel *ch = &dsc->channel[n]; -- /*if(ch->used) */ -- { -- ch->id = n; -- dsc_set_pid(ch, ch->pid); -- -- if (ch->set & 1) -- dsc_set_key(ch, 0, ch->even); -- if (ch->set & 2) -- dsc_set_key(ch, 1, ch->odd); -- } -- } -- } --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- if (reset_irq) { -- mod_timer(&dvb->watchdog_timer, -- jiffies + msecs_to_jiffies(WATCHDOG_TIMER)); -- } --#endif -- -- pr_dbg("demux reset end\n"); --} -- --/*Reset the individual demux*/ --void dmx_reset_dmx_hw_ex_unlock(struct aml_dvb *dvb, struct aml_dmx *dmx, -- int reset_irq) --{ -- { -- if (!dmx->init) -- return; -- if (reset_irq) { -- if (dmx->dmx_irq != -1) -- disable_irq(dmx->dmx_irq); -- if (dmx->dvr_irq != -1) -- disable_irq(dmx->dvr_irq); -- } -- } --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- if (reset_irq) { -- /*del_timer_sync(&dvb->watchdog_timer); */ -- dvb->dmx_watchdog_disable[dmx->id] = 1; -- } --#endif -- -- WRITE_MPEG_REG(RESET3_REGISTER, -- (dmx->id) ? ((dmx->id == -- 1) ? RESET_DEMUX1 : RESET_DEMUX2) : -- RESET_DEMUX0); -- WRITE_MPEG_REG(RESET3_REGISTER, RESET_DES); -- -- { -- int times; -- -- times = 0; -- while (times++ < 1000000) { -- if (!(DMX_READ_REG(dmx->id, OM_CMD_STATUS) & 0x01)) -- break; -- } -- } -- -- /*WRITE_MPEG_REG(STB_TOP_CONFIG, 0); */ -- -- { -- u32 version, data; -- -- if (!dmx->init) -- return; -- -- if (reset_irq) { -- if (dmx->dmx_irq != -1) -- enable_irq(dmx->dmx_irq); -- if (dmx->dvr_irq != -1) -- enable_irq(dmx->dvr_irq); -- } -- DMX_WRITE_REG(dmx->id, DEMUX_CONTROL, 0x0000); -- version = DMX_READ_REG(dmx->id, STB_VERSION); -- DMX_WRITE_REG(dmx->id, STB_TEST_REG, version); -- pr_dbg("STB %d hardware version : %d\n", dmx->id, version); -- DMX_WRITE_REG(dmx->id, STB_TEST_REG, 0x5550); -- data = DMX_READ_REG(dmx->id, STB_TEST_REG); -- if (data != 0x5550) -- pr_error("STB %d register access failed\n", dmx->id); -- DMX_WRITE_REG(dmx->id, STB_TEST_REG, 0xaaa0); -- data = DMX_READ_REG(dmx->id, STB_TEST_REG); -- if (data != 0xaaa0) -- pr_error("STB %d register access failed\n", dmx->id); -- DMX_WRITE_REG(dmx->id, MAX_FM_COMP_ADDR, 0x0000); -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, 0); -- DMX_WRITE_REG(dmx->id, STB_INT_STATUS, 0xffff); -- DMX_WRITE_REG(dmx->id, FEC_INPUT_CONTROL, 0); -- } -- -- stb_enable(dvb); -- -- { -- int n; -- unsigned long addr; -- unsigned long base; -- unsigned long grp_addr[SEC_BUF_GRP_COUNT]; -- int grp_len[SEC_BUF_GRP_COUNT]; -- -- if (!dmx->init) -- return; -- -- if (dmx->sec_pages) { -- grp_len[0] = (1 << SEC_GRP_LEN_0) * 8; -- grp_len[1] = (1 << SEC_GRP_LEN_1) * 8; -- grp_len[2] = (1 << SEC_GRP_LEN_2) * 8; -- grp_len[3] = (1 << SEC_GRP_LEN_3) * 8; -- -- grp_addr[0] = virt_to_phys((void *)dmx->sec_pages); -- grp_addr[1] = grp_addr[0] + grp_len[0]; -- grp_addr[2] = grp_addr[1] + grp_len[1]; -- grp_addr[3] = grp_addr[2] + grp_len[2]; -- -- base = grp_addr[0] & 0xFFFF0000; -- DMX_WRITE_REG(dmx->id, SEC_BUFF_BASE, base >> 16); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_01_START, -- (((grp_addr[0] - base) >> 8) << 16) | -- ((grp_addr[1] - base) >> 8)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_23_START, -- (((grp_addr[2] - base) >> 8) << 16) | -- ((grp_addr[3] - base) >> 8)); -- DMX_WRITE_REG(dmx->id, SEC_BUFF_SIZE, -- SEC_GRP_LEN_0 | -- (SEC_GRP_LEN_1 << 4) | -- (SEC_GRP_LEN_2 << 8) | -- (SEC_GRP_LEN_3 << 12)); -- } -- -- if (dmx->sub_pages) { -- addr = virt_to_phys((void *)dmx->sub_pages); -- DMX_WRITE_REG(dmx->id, SB_START, addr >> 12); -- DMX_WRITE_REG(dmx->id, SB_LAST_ADDR, -- (dmx->sub_buf_len >> 3) - 1); -- } -- -- if (dmx->pes_pages) { -- addr = virt_to_phys((void *)dmx->pes_pages); -- DMX_WRITE_REG(dmx->id, OB_START, addr >> 12); -- DMX_WRITE_REG(dmx->id, OB_LAST_ADDR, -- (dmx->pes_buf_len >> 3) - 1); -- } -- -- for (n = 0; n < CHANNEL_COUNT; n++) { -- /*struct aml_channel *chan = &dmx->channel[n];*/ -- -- /*if (chan->used)*/ -- { -- dmx_set_chan_regs(dmx, n); -- } -- } -- -- for (n = 0; n < FILTER_COUNT; n++) { -- struct aml_filter *filter = &dmx->filter[n]; -- -- if (filter->used) -- dmx_set_filter_regs(dmx, n); -- } -- -- dmx_enable(dmx); -- -- dmx_smallsec_set(&dmx->smallsec, -- dmx->smallsec.enable, -- dmx->smallsec.bufsize, -- 1); -- -- dmx_timeout_set(&dmx->timeout, -- dmx->timeout.enable, -- dmx->timeout.timeout, -- dmx->timeout.ch_disable, -- dmx->timeout.match, -- 1); -- } -- -- { -- int id; -- for (id = 0; id < DSC_DEV_COUNT; id++) { -- struct aml_dsc *dsc = &dvb->dsc[id]; -- int n; -- -- for (n = 0; n < DSC_COUNT; n++) { -- struct aml_dsc_channel *ch = &dsc->channel[n]; -- /*if(ch->used) */ -- { -- dsc_set_pid(ch, ch->pid); -- -- if (ch->set & 1) -- dsc_set_key(ch, 0, ch->even); -- if (ch->set & 2) -- dsc_set_key(ch, 1, ch->odd); -- } -- } -- } -- } --#ifdef ENABLE_SEC_BUFF_WATCHDOG -- if (reset_irq) { -- /*mod_timer(&dvb->watchdog_timer, -- jiffies+msecs_to_jiffies(WATCHDOG_TIMER)); */ -- dvb->dmx_watchdog_disable[dmx->id] = 0; -- } --#endif --} -- --void dmx_reset_dmx_id_hw_ex_unlock(struct aml_dvb *dvb, int id, int reset_irq) --{ -- dmx_reset_dmx_hw_ex_unlock(dvb, &dvb->dmx[id], reset_irq); --} -- --void dmx_reset_dmx_hw_ex(struct aml_dvb *dvb, struct aml_dmx *dmx, -- int reset_irq) --{ -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- dmx_reset_dmx_hw_ex_unlock(dvb, dmx, reset_irq); -- spin_unlock_irqrestore(&dvb->slock, flags); --} -- --void dmx_reset_dmx_id_hw_ex(struct aml_dvb *dvb, int id, int reset_irq) --{ -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- dmx_reset_dmx_id_hw_ex_unlock(dvb, id, reset_irq); -- spin_unlock_irqrestore(&dvb->slock, flags); --} -- --void dmx_reset_dmx_hw(struct aml_dvb *dvb, int id) --{ -- dmx_reset_dmx_id_hw_ex(dvb, id, 1); --} -- --/*Allocate subtitle pes buffer*/ --static int alloc_subtitle_pes_buffer(struct aml_dmx *dmx) --{ -- int start_ptr = 0; -- struct stream_buf_s *sbuff = 0; -- u32 phy_addr; -- start_ptr = READ_MPEG_REG(PARSER_SUB_START_PTR); -- if (start_ptr) { -- WRITE_MPEG_REG(PARSER_SUB_RP, start_ptr); -- goto exit; -- } -- sbuff = get_stream_buffer(BUF_TYPE_SUBTITLE); -- if (sbuff) { -- if (sbuff->flag & BUF_FLAG_IOMEM) -- phy_addr = sbuff->buf_start; -- else -- phy_addr = virt_to_phys((void *)sbuff->buf_start); -- -- WRITE_MPEG_REG(PARSER_SUB_RP, phy_addr); -- WRITE_MPEG_REG(PARSER_SUB_START_PTR, phy_addr); -- WRITE_MPEG_REG(PARSER_SUB_END_PTR, -- phy_addr + sbuff->buf_size - 8); -- -- pr_dbg("pes buff=:%x %x\n", phy_addr, sbuff->buf_size); -- } else -- pr_dbg("Error stream buffer\n"); --exit: -- return 0; --} -- --/*Allocate a new channel*/ --int dmx_alloc_chan(struct aml_dmx *dmx, int type, int pes_type, int pid) --{ -- int id = -1; -- int ret; -- -- if (type == DMX_TYPE_TS) { -- switch (pes_type) { -- case DMX_PES_VIDEO: -- if (!dmx->channel[0].used) -- id = 0; -- break; -- case DMX_PES_AUDIO: -- if (!dmx->channel[1].used) -- id = 1; -- break; -- case DMX_PES_SUBTITLE: -- case DMX_PES_TELETEXT: -- if (!dmx->channel[2].used) -- id = 2; -- alloc_subtitle_pes_buffer(dmx); -- break; -- case DMX_PES_PCR: -- if (!dmx->channel[3].used) -- id = 3; -- break; -- case DMX_PES_OTHER: -- { -- int i; -- for (i = SYS_CHAN_COUNT; -- i < CHANNEL_COUNT; i++) { -- if (!dmx->channel[i].used) { -- id = i; -- break; -- } -- } -- } -- break; -- default: -- break; -- } -- } else { -- int i; -- for (i = SYS_CHAN_COUNT; i < CHANNEL_COUNT; i++) { -- if (!dmx->channel[i].used) { -- id = i; -- break; -- } -- } -- } -- -- if (id == -1) { -- pr_error("too many channels\n"); -- return -1; -- } -- -- pr_dbg("allocate channel(id:%d PID:0x%x)\n", id, pid); -- -- if (id <= 3) { -- ret = dmx_get_chan(dmx, pid); -- if (ret >= 0 && DVR_FEED(dmx->channel[ret].feed)) { -- dmx_remove_feed(dmx, dmx->channel[ret].feed); -- dmx->channel[id].dvr_feed = dmx->channel[ret].feed; -- dmx->channel[id].dvr_feed->priv = (void *)(long)id; -- } else { -- dmx->channel[id].dvr_feed = NULL; -- } -- } -- -- dmx->channel[id].type = type; -- dmx->channel[id].pes_type = pes_type; -- dmx->channel[id].pid = pid; -- dmx->channel[id].used = 1; -- dmx->channel[id].filter_count = 0; -- -- dmx_set_chan_regs(dmx, id); -- -- set_debug_dmx_chanpids(dmx->id, id, pid); -- -- dmx->chan_count++; -- -- dmx_enable(dmx); -- -- return id; --} -- --/*Free a channel*/ --void dmx_free_chan(struct aml_dmx *dmx, int cid) --{ -- pr_dbg("free channel(id:%d PID:0x%x)\n", cid, dmx->channel[cid].pid); -- -- dmx->channel[cid].used = 0; -- dmx_set_chan_regs(dmx, cid); -- -- if (cid == 2) { -- u32 parser_sub_start_ptr; -- -- parser_sub_start_ptr = READ_MPEG_REG(PARSER_SUB_START_PTR); -- WRITE_MPEG_REG(PARSER_SUB_RP, parser_sub_start_ptr); -- WRITE_MPEG_REG(PARSER_SUB_WP, parser_sub_start_ptr); -- } -- -- set_debug_dmx_chanpids(dmx->id, cid, -1); -- dmx->chan_count--; -- -- dmx_enable(dmx); -- -- /*Special pes type channel, check its dvr feed */ -- if (cid <= 3 && dmx->channel[cid].dvr_feed) { -- /*start the dvr feed */ -- dmx_add_feed(dmx, dmx->channel[cid].dvr_feed); -- } --} -- --/*Add a section*/ --static int dmx_chan_add_filter(struct aml_dmx *dmx, int cid, -- struct dvb_demux_filter *filter) --{ -- int id = -1; -- int i; -- -- for (i = 0; i < FILTER_COUNT; i++) { -- if (!dmx->filter[i].used) { -- id = i; -- break; -- } -- } -- -- if (id == -1) { -- pr_error("too many filters\n"); -- return -1; -- } -- -- pr_dbg("channel(id:%d PID:0x%x) add filter(id:%d)\n", cid, -- filter->feed->pid, id); -- -- dmx->filter[id].chan_id = cid; -- dmx->filter[id].used = 1; -- dmx->filter[id].filter = (struct dmx_section_filter *)filter; -- dmx->channel[cid].filter_count++; -- -- dmx_set_filter_regs(dmx, id); -- -- return id; --} -- --static void dmx_remove_filter(struct aml_dmx *dmx, int cid, int fid) --{ -- pr_dbg("channel(id:%d PID:0x%x) remove filter(id:%d)\n", cid, -- dmx->channel[cid].pid, fid); -- -- dmx->filter[fid].used = 0; -- dmx->channel[cid].filter_count--; -- -- dmx_set_filter_regs(dmx, fid); -- dmx_clear_filter_buffer(dmx, fid); --} -- --static int sf_add_feed(struct aml_dmx *src_dmx, struct dvb_demux_feed *feed) --{ -- int ret; -- -- struct aml_dvb *dvb = (struct aml_dvb *)src_dmx->demux.priv; -- struct aml_swfilter *sf = &dvb->swfilter; -- -- pr_dbg_sf("sf add pid[%d]\n", feed->pid); -- -- /*init sf */ -- if (!sf->user) { -- void *mem; -- mem = vmalloc(SF_BUFFER_SIZE); -- if (!mem) -- return -ENOMEM; -- dvb_ringbuffer_init(&sf->rbuf, mem, SF_BUFFER_SIZE); -- -- sf->dmx = &dvb->dmx[SF_DMX_ID]; -- sf->afifo = &dvb->asyncfifo[SF_AFIFO_ID]; -- -- sf->dmx->source = src_dmx->source; -- sf->afifo->source = sf->dmx->id; -- sf->track_dmx = src_dmx->id; -- /*sf->afifo->flush_size = 188*10; */ -- -- pr_dbg_sf("init sf mode.\n"); -- -- } else if (sf->dmx->source != src_dmx->source) { -- pr_error(" pid=%d[src:%d] already used with sfdmx%d[src:%d]\n", -- feed->pid, src_dmx->source, sf->dmx->id, -- sf->dmx->source); -- return -EBUSY; -- } -- -- /*setup feed */ -- ret = dmx_get_chan(sf->dmx, feed->pid); -- if (ret >= 0) { -- pr_error(" pid=%d[dmx:%d] already used [dmx:%d].\n", -- feed->pid, src_dmx->id, -- ((struct aml_dmx *)sf->dmx->channel[ret].feed-> -- demux)->id); -- return -EBUSY; -- } -- ret = -- dmx_alloc_chan(sf->dmx, DMX_TYPE_TS, DMX_PES_OTHER, -- feed->pid); -- if (ret < 0) { -- pr_error(" %s: alloc chan error, ret=%d\n", __func__, ret); -- return ret; -- } -- sf->dmx->channel[ret].feed = feed; -- feed->priv = (void *)(long)ret; -- -- sf->dmx->channel[ret].dvr_feed = feed; -- -- sf->user++; -- debug_sf_user = sf->user; -- -- dmx_enable(sf->dmx); -- -- return 0; --} -- --static int sf_remove_feed(struct aml_dmx *src_dmx, struct dvb_demux_feed *feed) --{ -- int ret; -- -- struct aml_dvb *dvb = (struct aml_dvb *)src_dmx->demux.priv; -- struct aml_swfilter *sf = &dvb->swfilter; -- -- if (!sf->user || (sf->dmx->source != src_dmx->source)) -- return 0; -- -- ret = dmx_get_chan(sf->dmx, feed->pid); -- if (ret < 0) -- return 0; -- -- pr_dbg_sf("sf remove pid[%d]\n", feed->pid); -- -- dmx_free_chan(sf->dmx, (long)feed->priv); -- -- sf->dmx->channel[ret].feed = NULL; -- sf->dmx->channel[ret].dvr_feed = NULL; -- -- sf->user--; -- debug_sf_user = sf->user; -- -- if (!sf->user) { -- sf->dmx->source = -1; -- sf->afifo->source = AM_DMX_MAX; -- sf->track_dmx = -1; -- /*sf->afifo->flush_size = sf->afifo->buf_len>>1; */ -- -- if (sf->rbuf.data) { -- void *mem = sf->rbuf.data; -- sf->rbuf.data = NULL; -- vfree(mem); -- } -- pr_dbg_sf("exit sf mode.\n"); -- } -- -- return 0; --} -- --static int sf_feed_sf(struct aml_dmx *dmx, struct dvb_demux_feed *feed, -- int add_not_remove) --{ -- int sf = 0; -- -- if (sf_dmx_sf(dmx)) { -- pr_error("%s: demux %d is in sf mode\n", __func__, dmx->id); -- return -EINVAL; -- } -- -- switch (feed->type) { -- case DMX_TYPE_TS:{ -- struct dmxdev_filter *dmxdevfilter = -- feed->feed.ts.priv; -- if (!DVR_FEED(feed)) { -- if (dmxdevfilter->params.pes. -- flags & DMX_USE_SWFILTER) -- sf = 1; -- if (force_pes_sf) -- sf = 1; -- } -- } -- break; -- -- case DMX_TYPE_SEC:{ -- struct dvb_demux_filter *filter; -- for (filter = feed->filter; filter; -- filter = filter->next) { -- struct dmxdev_filter *dmxdevfilter = -- filter->filter.priv; -- if (dmxdevfilter->params.sec. -- flags & DMX_USE_SWFILTER) -- sf = 1; -- if (add_not_remove) -- filter->hw_handle = (u16)-1; -- } -- if (force_sec_sf) -- sf = 1; -- } -- break; -- } -- -- return sf ? 0 : 1; --} -- --static int sf_check_feed(struct aml_dmx *dmx, struct dvb_demux_feed *feed, -- int add_not_remove) --{ -- int ret = 0; -- -- ret = sf_feed_sf(dmx, feed, add_not_remove); -- if (ret) -- return ret; -- -- pr_dbg_sf("%s [pid:%d] %s\n", -- (feed->type == DMX_TYPE_TS) ? "DMX_TYPE_TS" : "DMX_TYPE_SEC", -- feed->pid, add_not_remove ? "-> sf mode" : "sf mode ->"); -- -- if (add_not_remove) -- ret = sf_add_feed(dmx, feed); -- else -- ret = sf_remove_feed(dmx, feed); -- -- if (ret < 0) { -- pr_error("sf %s feed fail[%d]\n", -- add_not_remove ? "add" : "remove", ret); -- } -- return ret; --} -- --static int dmx_add_feed(struct aml_dmx *dmx, struct dvb_demux_feed *feed) --{ -- int id, ret = 0; -- struct dvb_demux_filter *filter; -- struct dvb_demux_feed *dfeed = NULL; -- int sf_ret = 0; /*<0:error, =0:sf_on, >0:sf_off */ -- -- sf_ret = sf_check_feed(dmx, feed, 1/*SF_FEED_OP_ADD */); -- if (sf_ret < 0) -- return sf_ret; -- -- switch (feed->type) { -- case DMX_TYPE_TS: -- pr_dbg("%s: DMX_TYPE_TS\n", __func__); -- ret = dmx_get_chan(dmx, feed->pid); -- if (ret >= 0) { -- if (DVR_FEED(dmx->channel[ret].feed)) { -- if (DVR_FEED(feed)) { -- /*dvr feed already work */ -- pr_error("PID %d already used(DVR)\n", -- feed->pid); -- return -EBUSY; -- } -- if (sf_ret) { -- /*if sf_on, we do not reset the -- previous dvr feed, just load the pes -- feed on the sf, a diffrent data path.*/ -- dfeed = dmx->channel[ret].feed; -- dmx_remove_feed(dmx, dfeed); -- } -- } else { -- if (DVR_FEED(feed) -- && (!dmx->channel[ret].dvr_feed)) { -- /*just store the dvr_feed */ -- dmx->channel[ret].dvr_feed = feed; -- feed->priv = (void *)(long)ret; -- if (!dmx->record) -- dmx_enable(dmx); -- dmx_add_recchan(dmx->id, ret); -- return 0; -- } else { -- pr_error("PID %d already used\n", -- feed->pid); -- return -EBUSY; -- } -- } -- } -- -- if (sf_ret) { /*not sf feed. */ -- ret = -- dmx_alloc_chan(dmx, feed->type, -- feed->pes_type, feed->pid); -- if (ret < 0) { -- pr_dbg("%s: alloc chan error, ret=%d\n", -- __func__, ret); -- return ret; -- } -- dmx->channel[ret].feed = feed; -- feed->priv = (void *)(long)ret; -- dmx->channel[ret].dvr_feed = NULL; -- } -- /*dvr */ -- if (DVR_FEED(feed)) { -- dmx->channel[ret].dvr_feed = feed; -- feed->priv = (void *)(long)ret; -- if (!dmx->record) -- dmx_enable(dmx); -- dmx_add_recchan(dmx->id, ret); -- } else if (dfeed && sf_ret) { -- dmx->channel[ret].dvr_feed = dfeed; -- dfeed->priv = (void *)(long)ret; -- if (!dmx->record) -- dmx_enable(dmx); -- dmx_add_recchan(dmx->id, ret); -- } -- -- break; -- case DMX_TYPE_SEC: -- pr_dbg("%s: DMX_TYPE_SEC\n", __func__); -- ret = dmx_get_chan(dmx, feed->pid); -- if (ret >= 0) { -- if (DVR_FEED(dmx->channel[ret].feed)) { -- if (sf_ret) { -- /*if sf_on, we do not reset the -- previous dvr feed, just load the pes -- feed on the sf,a diffrent data path.*/ -- dfeed = dmx->channel[ret].feed; -- dmx_remove_feed(dmx, dfeed); -- } -- } else { -- pr_error("PID %d already used\n", feed->pid); -- return -EBUSY; -- } -- } -- if (sf_ret) { /*not sf feed. */ -- id = dmx_alloc_chan(dmx, feed->type, -- feed->pes_type, feed->pid); -- if (id < 0) -- return id; -- for (filter = feed->filter; filter; -- filter = filter->next) { -- ret = dmx_chan_add_filter(dmx, id, filter); -- if (ret >= 0) -- filter->hw_handle = ret; -- else -- filter->hw_handle = (u16)-1; -- } -- dmx->channel[id].feed = feed; -- feed->priv = (void *)(long)id; -- dmx->channel[id].dvr_feed = NULL; -- -- if (dfeed) { -- dmx->channel[id].dvr_feed = dfeed; -- dfeed->priv = (void *)(long)id; -- if (!dmx->record) -- dmx_enable(dmx); -- dmx_add_recchan(dmx->id, id); -- } -- } -- break; -- default: -- return -EINVAL; -- break; -- } -- -- dmx->feed_count++; -- -- return 0; --} -- --static int dmx_remove_feed(struct aml_dmx *dmx, struct dvb_demux_feed *feed) --{ -- struct dvb_demux_filter *filter; -- struct dvb_demux_feed *dfeed = NULL; -- -- int sf_ret = 0; /*<0:error, =0:sf_on, >0:sf_off */ -- -- sf_ret = sf_check_feed(dmx, feed, 0/*SF_FEED_OP_RM */); -- if (sf_ret <= 0) -- return sf_ret; -- -- switch (feed->type) { -- case DMX_TYPE_TS: -- if (dmx->channel[(long)feed->priv].feed == -- dmx->channel[(long)feed->priv].dvr_feed) { -- dmx_rm_recchan(dmx->id, (long)feed->priv); -- dmx_free_chan(dmx, (long)feed->priv); -- } else { -- if (feed == dmx->channel[(long)feed->priv].feed) { -- dfeed = dmx->channel[(long)feed->priv].dvr_feed; -- dmx_rm_recchan(dmx->id, (long)feed->priv); -- dmx_free_chan(dmx, (long)feed->priv); -- if (dfeed) { -- /*start the dvr feed */ -- dmx_add_feed(dmx, dfeed); -- } -- } else if (feed == -- dmx->channel[(long)feed->priv].dvr_feed) { -- /*just remove the dvr_feed */ -- dmx->channel[(long)feed->priv].dvr_feed = NULL; -- dmx_rm_recchan(dmx->id, (long)feed->priv); -- if (dmx->record) { -- dmx_enable(dmx); -- } -- } else { -- /*This must never happen */ -- pr_error("%s: unknown feed\n", __func__); -- return -EINVAL; -- } -- } -- -- break; -- case DMX_TYPE_SEC: -- for (filter = feed->filter; filter; filter = filter->next) { -- if (filter->hw_handle != (u16)-1) -- dmx_remove_filter(dmx, (long)feed->priv, -- (int)filter->hw_handle); -- } -- -- dfeed = dmx->channel[(long)feed->priv].dvr_feed; -- dmx_rm_recchan(dmx->id, (long)feed->priv); -- dmx_free_chan(dmx, (long)feed->priv); -- if (dfeed) { -- /*start the dvr feed */ -- dmx_add_feed(dmx, dfeed); -- } -- break; -- default: -- return -EINVAL; -- break; -- } -- -- dmx->feed_count--; -- return 0; --} -- --int aml_dmx_hw_init(struct aml_dmx *dmx) --{ -- /* -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- unsigned long flags; -- */ -- int ret; -- -- /*Demux initialize */ -- /*spin_lock_irqsave(&dvb->slock, flags);*/ -- ret = dmx_init(dmx); -- /*spin_unlock_irqrestore(&dvb->slock, flags);*/ -- -- return ret; --} -- --int aml_dmx_hw_deinit(struct aml_dmx *dmx) --{ -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- unsigned long flags; -- int ret; -- spin_lock_irqsave(&dvb->slock, flags); -- ret = dmx_deinit(dmx); -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --/*extern void afifo_reset(int v);*/ -- --int aml_asyncfifo_hw_init(struct aml_asyncfifo *afifo) --{ -- --/* -- struct aml_dvb *dvb = afifo->dvb; -- unsigned long flags; --*/ -- int ret; -- -- int len = ASYNCFIFO_BUFFER_SIZE_DEFAULT; -- unsigned long buf = asyncfifo_alloc_buffer(len); -- if (!buf) -- return -1; -- -- /*Async FIFO initialize*/ --/* -- spin_lock_irqsave(&dvb->slock, flags); --*/ --/* --#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 -- CLK_GATE_ON(ASYNC_FIFO); --#endif --*/ -- /*afifo_reset(0);*/ -- -- WRITE_MPEG_REG(RESET6_REGISTER, (1<<11)|(1<<12)); -- -- ret = async_fifo_init(afifo, 1, len, buf); --/* -- spin_unlock_irqrestore(&dvb->slock, flags); --*/ -- if (ret < 0) -- asyncfifo_free_buffer(buf, len); -- -- return ret; --} -- --int aml_asyncfifo_hw_deinit(struct aml_asyncfifo *afifo) --{ -- struct aml_dvb *dvb = afifo->dvb; -- unsigned long flags; -- int ret; -- -- spin_lock_irqsave(&dvb->slock, flags); -- ret = async_fifo_deinit(afifo, 1); --/* --#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 -- CLK_GATE_OFF(ASYNC_FIFO); --#endif --*/ -- /*afifo_reset(1);*/ -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --int aml_asyncfifo_hw_reset(struct aml_asyncfifo *afifo) --{ -- struct aml_dvb *dvb = afifo->dvb; -- unsigned long flags; -- int ret, src = -1; -- -- int len = ASYNCFIFO_BUFFER_SIZE_DEFAULT; -- unsigned long buf = asyncfifo_alloc_buffer(len); -- if (!buf) -- return -1; -- -- spin_lock_irqsave(&dvb->slock, flags); -- if (afifo->init) { -- src = afifo->source; -- async_fifo_deinit(afifo, 0); -- } -- ret = async_fifo_init(afifo, 0, len, buf); -- /* restore the source */ -- if (src != -1) -- afifo->source = src; -- -- if ((ret == 0) && afifo->dvb) -- reset_async_fifos(afifo->dvb); -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- if (ret < 0) -- asyncfifo_free_buffer(buf, len); -- -- return ret; --} -- --int aml_dmx_hw_start_feed(struct dvb_demux_feed *dvbdmxfeed) --{ -- struct aml_dmx *dmx = (struct aml_dmx *)dvbdmxfeed->demux; -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- unsigned long flags; -- int ret = 0; -- -- spin_lock_irqsave(&dvb->slock, flags); -- ret = dmx_add_feed(dmx, dvbdmxfeed); -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --int aml_dmx_hw_stop_feed(struct dvb_demux_feed *dvbdmxfeed) --{ -- struct aml_dmx *dmx = (struct aml_dmx *)dvbdmxfeed->demux; -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- dmx_remove_feed(dmx, dvbdmxfeed); -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; --} -- --int sf_dmx_track_source(struct aml_dmx *dmx) --{ -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- struct aml_swfilter *sf = &dvb->swfilter; -- if (sf->user && (dmx->id == sf->track_dmx)) { -- pr_dbg_sf("tracking dmx src [%d -> %d]\n", -- sf->dmx->source, dmx->source); -- sf->dmx->source = dmx->source; -- dmx_reset_dmx_hw_ex_unlock(dvb, sf->dmx, 0); -- } -- return 0; --} -- --int aml_dmx_hw_set_source(struct dmx_demux *demux, enum dmx_source_t src) --{ -- struct aml_dmx *dmx = (struct aml_dmx *)demux; -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- int ret = 0; -- int hw_src; -- unsigned long flags; -- -- if (sf_dmx_sf(dmx)) { -- pr_error("%s: demux %d is in sf mode\n", __func__, dmx->id); -- return -EINVAL; -- } -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- hw_src = dmx->source; -- -- switch (src) { -- case DMX_SOURCE_FRONT0: -- hw_src = -- (dvb->ts[0].mode == -- AM_TS_SERIAL) ? AM_TS_SRC_S_TS0 : AM_TS_SRC_TS0; -- break; -- case DMX_SOURCE_FRONT1: -- hw_src = -- (dvb->ts[1].mode == -- AM_TS_SERIAL) ? AM_TS_SRC_S_TS1 : AM_TS_SRC_TS1; -- break; -- case DMX_SOURCE_FRONT2: -- hw_src = -- (dvb->ts[2].mode == -- AM_TS_SERIAL) ? AM_TS_SRC_S_TS2 : AM_TS_SRC_TS2; -- break; -- case DMX_SOURCE_DVR0: -- hw_src = AM_TS_SRC_HIU; -- break; -- default: -- pr_error("illegal demux source %d\n", src); -- ret = -EINVAL; -- break; -- } -- -- if (hw_src != dmx->source) { -- dmx->source = hw_src; -- dmx_reset_dmx_hw_ex_unlock(dvb, dmx, 0); -- sf_dmx_track_source(dmx); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --#define IS_SRC_DMX(_src) ((_src) >= AM_TS_SRC_DMX0 && (_src) <= AM_TS_SRC_DMX2) -- --int aml_stb_hw_set_source(struct aml_dvb *dvb, enum dmx_source_t src) --{ -- unsigned long flags; -- int hw_src; -- int ret; -- ret = 0; -- spin_lock_irqsave(&dvb->slock, flags); -- -- hw_src = dvb->stb_source; -- -- switch (src) { -- case DMX_SOURCE_FRONT0: -- hw_src = -- (dvb->ts[0].mode == -- AM_TS_SERIAL) ? AM_TS_SRC_S_TS0 : AM_TS_SRC_TS0; -- break; -- case DMX_SOURCE_FRONT1: -- hw_src = -- (dvb->ts[1].mode == -- AM_TS_SERIAL) ? AM_TS_SRC_S_TS1 : AM_TS_SRC_TS1; -- break; -- case DMX_SOURCE_FRONT2: -- hw_src = -- (dvb->ts[2].mode == -- AM_TS_SERIAL) ? AM_TS_SRC_S_TS2 : AM_TS_SRC_TS2; -- break; -- case DMX_SOURCE_DVR0: -- hw_src = AM_TS_SRC_HIU; -- break; -- case DMX_SOURCE_FRONT0_OFFSET: -- hw_src = AM_TS_SRC_DMX0; -- break; -- case DMX_SOURCE_FRONT1_OFFSET: -- hw_src = AM_TS_SRC_DMX1; -- break; -- case DMX_SOURCE_FRONT2_OFFSET: -- hw_src = AM_TS_SRC_DMX2; -- break; -- default: -- pr_error("illegal demux source %d\n", src); -- ret = -EINVAL; -- break; -- } -- -- if (dvb->stb_source != hw_src) { -- int old_source = dvb->stb_source; -- dvb->stb_source = hw_src; -- -- if (IS_SRC_DMX(old_source)) { -- dmx_set_misc_id(dvb, -- (old_source - AM_TS_SRC_DMX0), 0, -1); -- } else { -- /*which dmx for av-play is unknown, -- can't avoid reset-all */ -- dmx_reset_hw_ex(dvb, 0); -- } -- -- if (IS_SRC_DMX(dvb->stb_source)) { -- dmx_set_misc_id(dvb, -- (dvb->stb_source - AM_TS_SRC_DMX0), 1, -1); -- /*dmx_reset_dmx_id_hw_ex_unlock -- (dvb, (dvb->stb_source-AM_TS_SRC_DMX0), 0); */ -- } else { -- /*which dmx for av-play is unknown, -- can't avoid reset-all */ -- dmx_reset_hw_ex(dvb, 0); -- } -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --int aml_dsc_hw_set_source(struct aml_dsc *dsc, -- enum dmx_source_t src, enum dmx_source_t dst) --{ -- struct aml_dvb *dvb = dsc->dvb; -- int ret = 0; -- unsigned long flags; -- int hw_src = -1, hw_dst = -1, org_src = -1, org_dst = -1; -- int src_reset = 0, dst_reset = 0; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- hw_src = dsc->source; -- hw_dst = dsc->dst; -- -- switch (src) { -- case DMX_SOURCE_FRONT0_OFFSET: -- hw_src = AM_TS_SRC_DMX0; -- break; -- case DMX_SOURCE_FRONT1_OFFSET: -- hw_src = AM_TS_SRC_DMX1; -- break; -- case DMX_SOURCE_FRONT2_OFFSET: -- hw_src = AM_TS_SRC_DMX2; -- break; -- default: -- hw_src = -1; -- break; -- } -- switch (dst) { -- case DMX_SOURCE_FRONT0_OFFSET: -- hw_dst = AM_TS_SRC_DMX0; -- break; -- case DMX_SOURCE_FRONT1_OFFSET: -- hw_dst = AM_TS_SRC_DMX1; -- break; -- case DMX_SOURCE_FRONT2_OFFSET: -- hw_dst = AM_TS_SRC_DMX2; -- break; -- default: -- hw_dst = -1; -- break; -- } -- -- if (hw_src != dsc->source) { -- org_src = dsc->source; -- dsc->source = hw_src; -- src_reset = 1; -- } -- if (hw_dst != dsc->dst) { -- org_dst = dsc->dst; -- dsc->dst = hw_dst; -- dst_reset = 1; -- } -- -- if (src_reset) { -- pr_dbg("dsc%d source changed: %d -> %d\n", -- dsc->id, org_src, hw_src); -- if (org_src != -1) { -- pr_dbg("reset dmx%d\n", (org_src - AM_TS_SRC_DMX0)); -- dmx_reset_dmx_id_hw_ex_unlock(dvb, -- (org_src - AM_TS_SRC_DMX0), 0); -- } -- if (hw_src != -1) { -- pr_dbg("reset dmx%d\n", (hw_src - AM_TS_SRC_DMX0)); -- dmx_reset_dmx_id_hw_ex_unlock(dvb, -- (hw_src - AM_TS_SRC_DMX0), 0); -- } else -- dsc_enable(dsc, 0); -- } -- if (dst_reset) { -- pr_dbg("dsc%d dest changed: %d -> %d\n", -- dsc->id, org_dst, hw_dst); -- if (((!src_reset) && (org_dst != -1)) || -- (src_reset && (org_dst != -1) && -- (org_dst != org_src) && (org_dst != hw_src))) { -- pr_dbg("reset dmx%d\n", (org_dst - AM_TS_SRC_DMX0)); -- dmx_reset_dmx_id_hw_ex_unlock(dvb, -- (org_dst - AM_TS_SRC_DMX0), 0); -- } -- if (((!src_reset) && (hw_dst != -1)) || -- (src_reset && (hw_dst != -1) -- && (hw_dst != org_src) && (hw_dst != hw_src))) { -- pr_dbg("reset dmx%d\n", (hw_dst - AM_TS_SRC_DMX0)); -- dmx_reset_dmx_id_hw_ex_unlock(dvb, -- (hw_dst - AM_TS_SRC_DMX0), 0); -- } -- if (hw_dst == -1) -- dsc_enable(dsc, 0); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --int aml_tso_hw_set_source(struct aml_dvb *dvb, enum dmx_source_t src) --{ -- int ret = 0; -- unsigned long flags; -- int hw_src; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- hw_src = dvb->tso_source; -- -- switch (src) { -- case DMX_SOURCE_FRONT0: -- hw_src = (dvb->ts[0].mode == AM_TS_SERIAL) -- ? AM_TS_SRC_S_TS0 : AM_TS_SRC_TS0; -- break; -- case DMX_SOURCE_FRONT1: -- hw_src = (dvb->ts[1].mode == AM_TS_SERIAL) -- ? AM_TS_SRC_S_TS1 : AM_TS_SRC_TS1; -- break; -- case DMX_SOURCE_FRONT2: -- hw_src = (dvb->ts[2].mode == AM_TS_SERIAL) -- ? AM_TS_SRC_S_TS2 : AM_TS_SRC_TS2; -- break; -- case DMX_SOURCE_DVR0: -- hw_src = AM_TS_SRC_HIU; -- break; -- case DMX_SOURCE_FRONT0 + 100: -- hw_src = AM_TS_SRC_DMX0; -- break; -- case DMX_SOURCE_FRONT1 + 100: -- hw_src = AM_TS_SRC_DMX1; -- break; -- case DMX_SOURCE_FRONT2 + 100: -- hw_src = AM_TS_SRC_DMX2; -- break; -- default: -- hw_src = -1; -- ret = -EINVAL; -- break; -- } -- -- if (hw_src != dvb->tso_source) { -- dvb->tso_source = hw_src; -- stb_enable(dvb); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --int aml_asyncfifo_hw_set_source(struct aml_asyncfifo *afifo, -- enum aml_dmx_id_t src) --{ -- struct aml_dvb *dvb = afifo->dvb; -- int ret = -1; -- unsigned long flags; -- -- if (sf_afifo_sf(afifo)) { -- pr_error("%s: afifo %d is in sf mode\n", __func__, afifo->id); -- return -EINVAL; -- } -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- pr_dbg("asyncfifo %d set source %d->%d", -- afifo->id, afifo->source, src); -- switch (src) { -- case AM_DMX_0: -- case AM_DMX_1: -- case AM_DMX_2: -- if (afifo->source != src) { -- afifo->source = src; -- ret = 0; -- } -- break; -- default: -- pr_error("illegal async fifo source %d\n", src); -- ret = -EINVAL; -- break; -- } -- -- if (ret == 0 && afifo->dvb) -- reset_async_fifos(afifo->dvb); -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --int aml_dmx_hw_set_dump_ts_select(struct dmx_demux *demux, int dump_ts_select) --{ -- struct aml_dmx *dmx = (struct aml_dmx *)demux; -- struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv; -- int ret = 0; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- dump_ts_select = !!dump_ts_select; -- if (dmx->dump_ts_select != dump_ts_select) { -- dmx->dump_ts_select = dump_ts_select; -- dmx_reset_dmx_hw_ex_unlock(dvb, dmx, 0); -- } -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --u32 aml_dmx_get_video_pts(struct aml_dvb *dvb) --{ -- unsigned long flags; -- u32 pts; -- -- spin_lock_irqsave(&dvb->slock, flags); -- pts = video_pts; -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return pts; --} -- --u32 aml_dmx_get_audio_pts(struct aml_dvb *dvb) --{ -- unsigned long flags; -- u32 pts; -- -- spin_lock_irqsave(&dvb->slock, flags); -- pts = audio_pts; -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return pts; --} -- --u32 aml_dmx_get_first_video_pts(struct aml_dvb *dvb) --{ -- unsigned long flags; -- u32 pts; -- -- spin_lock_irqsave(&dvb->slock, flags); -- pts = first_video_pts; -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return pts; --} -- --u32 aml_dmx_get_first_audio_pts(struct aml_dvb *dvb) --{ -- unsigned long flags; -- u32 pts; -- -- spin_lock_irqsave(&dvb->slock, flags); -- pts = first_audio_pts; -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return pts; --} -- --int aml_dmx_set_skipbyte(struct aml_dvb *dvb, int skipbyte) --{ -- if (demux_skipbyte != skipbyte) { -- pr_dbg("set skip byte %d\n", skipbyte); -- demux_skipbyte = skipbyte; -- dmx_reset_hw_ex(dvb, 0); -- } -- -- return 0; --} -- --int aml_dmx_set_demux(struct aml_dvb *dvb, int id) --{ -- aml_stb_hw_set_source(dvb, DMX_SOURCE_DVR0); -- if (id < DMX_DEV_COUNT) { -- struct aml_dmx *dmx = &dvb->dmx[id]; -- aml_dmx_hw_set_source((struct dmx_demux *)dmx, -- DMX_SOURCE_DVR0); -- } -- -- return 0; --} -- --int _set_tsfile_clkdiv(struct aml_dvb *dvb, int clkdiv) --{ -- if (tsfile_clkdiv != clkdiv) { -- pr_dbg("set ts file clock div %d\n", clkdiv); -- tsfile_clkdiv = clkdiv; -- dmx_reset_hw(dvb); -- } -- -- return 0; --} -- --static ssize_t stb_set_tsfile_clkdiv(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- /*int div = (int)simple_strtol(buf, NULL, 10);*/ -- long div; -- if (kstrtol(buf, 0, &div) == 0) -- _set_tsfile_clkdiv(aml_get_dvb_device(), (int)div); -- return size; --} -- --static ssize_t stb_get_tsfile_clkdiv(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- ssize_t ret; -- ret = sprintf(buf, "%d\n", tsfile_clkdiv); -- return ret; --} -- -- --static int dmx_id; -- --static ssize_t dmx_smallsec_show(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- ssize_t ret; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- ret = sprintf(buf, "%d:%d\n", dvb->dmx[dmx_id].smallsec.enable, -- dvb->dmx[dmx_id].smallsec.bufsize); -- return ret; --} --static ssize_t dmx_smallsec_store(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- int i, e, s = 0, f = 0; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- -- i = sscanf(buf, "%d:%i:%d", &e, &s, &f); -- if (i <= 0) -- return size; -- -- dmx_smallsec_set(&dvb->dmx[dmx_id].smallsec, e, s, f); -- return size; --} -- --static ssize_t dmx_timeout_show(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- ssize_t ret; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- ret = sprintf(buf, "%d:%d:0x%x:%d:%d\n", -- dvb->dmx[dmx_id].timeout.enable, -- dvb->dmx[dmx_id].timeout.timeout, -- dvb->dmx[dmx_id].timeout.ch_disable, -- dvb->dmx[dmx_id].timeout.match, -- (DMX_READ_REG(dmx_id, STB_INT_STATUS)&(1<dmx[dmx_id].timeout, e, t, c, m, f); -- return size; --} -- -- --#define DEMUX_SCAMBLE_FUNC_DECL(i) \ --static ssize_t dmx_reg_value_show_demux##i##_scramble(struct class *class, \ --struct class_attribute *attr, char *buf)\ --{\ -- int data = 0;\ -- int aflag = 0;\ -- int vflag = 0;\ -- ssize_t ret = 0;\ -- data = DMX_READ_REG(i, DEMUX_SCRAMBLING_STATE);\ -- if ((data & 0x01) == 0x01) \ -- vflag = 1;\ -- if ((data & 0x02) == 0x02) \ -- aflag = 1;\ -- ret = sprintf(buf, "%d %d\n", vflag, aflag);\ -- return ret;\ --} -- --#if DMX_DEV_COUNT > 0 --DEMUX_SCAMBLE_FUNC_DECL(0) --#endif --#if DMX_DEV_COUNT > 1 --DEMUX_SCAMBLE_FUNC_DECL(1) --#endif --#if DMX_DEV_COUNT > 2 --DEMUX_SCAMBLE_FUNC_DECL(2) --#endif -- --static ssize_t dmx_reg_addr_show_source(struct class *class, -- struct class_attribute *attr, -- char *buf); --static ssize_t dmx_reg_addr_store_source(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size); --static ssize_t dmx_id_show_source(struct class *class, -- struct class_attribute *attr, char *buf); --static ssize_t dmx_id_store_source(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size); --static ssize_t dmx_reg_value_show_source(struct class *class, -- struct class_attribute *attr, -- char *buf); --static ssize_t dmx_reg_value_store_source(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size); -- --static int reg_addr; -- --static struct class_attribute aml_dmx_class_attrs[] = { -- __ATTR(dmx_id, S_IRUGO | S_IWUSR, dmx_id_show_source, -- dmx_id_store_source), -- __ATTR(register_addr, S_IRUGO | S_IWUSR, dmx_reg_addr_show_source, -- dmx_reg_addr_store_source), -- __ATTR(register_value, S_IRUGO | S_IWUSR, dmx_reg_value_show_source, -- dmx_reg_value_store_source), -- __ATTR(tsfile_clkdiv, S_IRUGO | S_IWUSR, stb_get_tsfile_clkdiv, -- stb_set_tsfile_clkdiv), -- --#define DEMUX_SCAMBLE_ATTR_DECL(i)\ -- __ATTR(demux##i##_scramble, S_IRUGO | S_IWUSR, \ -- dmx_reg_value_show_demux##i##_scramble, NULL) --#if DMX_DEV_COUNT > 0 -- DEMUX_SCAMBLE_ATTR_DECL(0), --#endif --#if DMX_DEV_COUNT > 1 -- DEMUX_SCAMBLE_ATTR_DECL(1), --#endif --#if DMX_DEV_COUNT > 2 -- DEMUX_SCAMBLE_ATTR_DECL(2), --#endif -- -- __ATTR(dmx_smallsec, S_IRUGO | S_IWUSR, -- dmx_smallsec_show, -- dmx_smallsec_store), -- __ATTR(dmx_timeout, S_IRUGO | S_IWUSR, -- dmx_timeout_show, -- dmx_timeout_store), -- -- __ATTR_NULL --}; -- --static struct class aml_dmx_class = { -- .name = "dmx", -- .class_attrs = aml_dmx_class_attrs, --}; -- --static ssize_t dmx_id_show_source(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- int ret; -- ret = sprintf(buf, "%d\n", dmx_id); -- return ret; --} -- --static ssize_t dmx_id_store_source(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- int id = 0; -- long value = 0; -- if (kstrtol(buf, 0, &value) == 0) -- id = (int)value; -- /*id = simple_strtol(buf, 0, 16);*/ -- -- if (id < 0 || id > 2) -- pr_dbg("dmx id must 0 ~2\n"); -- else -- dmx_id = id; -- -- return size; --} -- --static ssize_t dmx_reg_addr_show_source(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- int ret; -- ret = sprintf(buf, "%x\n", reg_addr); -- return ret; --} -- --static ssize_t dmx_reg_addr_store_source(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- int addr = 0; -- /*addr = simple_strtol(buf, 0, 16);*/ -- long value = 0; -- if (kstrtol(buf, 0, &value) == 0) -- addr = (int)value; -- reg_addr = addr; -- return size; --} -- --static ssize_t dmx_reg_value_show_source(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- int ret, value; -- value = READ_MPEG_REG(reg_addr); -- ret = sprintf(buf, "%x\n", value); -- return ret; --} -- --static ssize_t dmx_reg_value_store_source(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- int value = 0; -- /*value = simple_strtol(buf, 0, 16);*/ -- long val = 0; -- if (kstrtol(buf, 0, &val) == 0) -- value = (int)val; -- WRITE_MPEG_REG(reg_addr, value); -- return size; --} -- --int aml_regist_dmx_class(void) --{ -- -- if (class_register(&aml_dmx_class) < 0) -- pr_error("register class error\n"); -- -- return 0; --} -- --int aml_unregist_dmx_class(void) --{ -- -- class_unregister(&aml_dmx_class); -- return 0; --} -- --static struct aml_dmx *get_dmx_from_src(enum aml_ts_source_t src) --{ -- int i; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_dmx *dmx = NULL; -- if (dvb) { -- switch (src) { -- case AM_TS_SRC_TS0: -- case AM_TS_SRC_TS1: -- case AM_TS_SRC_TS2: -- case AM_TS_SRC_S_TS0: -- case AM_TS_SRC_S_TS1: -- case AM_TS_SRC_S_TS2: -- for (i = 0; i < 3; i++) { -- if (dvb->dmx[i].source == src) { -- dmx = &dvb->dmx[i]; -- break; -- } -- break; -- case AM_TS_SRC_DMX0: -- /*if (0 > DMX_DEV_COUNT) */ -- /*dmx = &dvb->dmx[0]; */ -- break; -- case AM_TS_SRC_DMX1: -- /*if (1 > DMX_DEV_COUNT) */ -- /*dmx = &dvb->dmx[1]; */ -- break; -- case AM_TS_SRC_DMX2: -- /*if (2 > DMX_DEV_COUNT) */ -- /*dmx = &dvb->dmx[2]; */ -- break; -- default: -- break; -- } -- } -- } -- return dmx; -- --} -- --void aml_dmx_register_frontend(enum aml_ts_source_t src, -- struct dvb_frontend *fe) --{ -- unsigned long flags; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_dmx *dmx = get_dmx_from_src(src); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx) -- dmx->fe = fe; -- -- spin_unlock_irqrestore(&dvb->slock, flags); --} -- --void aml_dmx_before_retune(enum aml_ts_source_t src, struct dvb_frontend *fe) --{ -- unsigned long flags; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_dmx *dmx = get_dmx_from_src(src); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx) { -- dmx->fe = fe; -- dmx->in_tune = 1; -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, 0); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); --} -- --void aml_dmx_after_retune(enum aml_ts_source_t src, struct dvb_frontend *fe) --{ -- unsigned long flags; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_dmx *dmx = get_dmx_from_src(src); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx) { -- dmx->fe = fe; -- dmx->in_tune = 0; -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, DEMUX_INT_MASK); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); --} --EXPORT_SYMBOL(aml_dmx_after_retune); -- --void aml_dmx_start_error_check(enum aml_ts_source_t src, -- struct dvb_frontend *fe) --{ -- unsigned long flags; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_dmx *dmx = get_dmx_from_src(src); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx) { -- dmx->fe = fe; -- dmx->error_check = 0; -- dmx->int_check_time = 0; -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, DEMUX_INT_MASK); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); --} --EXPORT_SYMBOL(aml_dmx_start_error_check); -- --int aml_dmx_stop_error_check(enum aml_ts_source_t src, struct dvb_frontend *fe) --{ -- unsigned long flags; -- int ret = 0; -- -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_dmx *dmx = get_dmx_from_src(src); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx) { -- dmx->fe = fe; -- ret = dmx->error_check; -- DMX_WRITE_REG(dmx->id, STB_INT_MASK, DEMUX_INT_MASK); -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} --EXPORT_SYMBOL(aml_dmx_stop_error_check); -diff --git a/drivers/amlogic/dvb_tv/aml_dvb.c b/drivers/amlogic/dvb_tv/aml_dvb.c -deleted file mode 100644 -index 0c21f6d..0000000 ---- a/drivers/amlogic/dvb_tv/aml_dvb.c -+++ /dev/null -@@ -1,1857 +0,0 @@ -- /* -- * AMLOGIC DVB driver. -- */ -- --#define ENABLE_DEMUX_DRIVER -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#ifdef ARC_700 --#include --#else --#include "c_stb_define.h" --#include "c_stb_regs_define.h" --#endif -- --/*#include */ --#include --#include --#include --#include --#include -- --#include -- --#include "linux/amlogic/cpu_version.h" -- --#include "aml_dvb.h" --#include "aml_dvb_reg.h" -- --#define pr_dbg(args...)\ -- do {\ -- if (debug_dvb)\ -- printk(args);\ -- } while (0) --#define pr_error(fmt, args...) printk("DVB: " fmt, ## args) --#define pr_inf(fmt, args...) printk("DVB: " fmt, ## args) -- --MODULE_PARM_DESC(debug_dvb, "\n\t\t Enable dvb debug information"); --static int debug_dvb = 1; --module_param(debug_dvb, int, 0644); -- --#define CARD_NAME "amlogic-dvb" -- --DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); -- --MODULE_PARM_DESC(dsc_max, "max number of dsc"); --static int dsc_max = DSC_DEV_COUNT; --module_param(dsc_max, int, 0644); -- --static struct aml_dvb aml_dvb_device; --static struct class aml_stb_class; --static struct reset_control *aml_dvb_demux_reset_ctl; --static struct reset_control *aml_dvb_afifo_reset_ctl; --static struct reset_control *aml_dvb_ahbarb0_reset_ctl; --static struct reset_control *aml_dvb_uparsertop_reset_ctl; -- -- --static int aml_tsdemux_reset(void); --static int aml_tsdemux_set_reset_flag(void); --static int aml_tsdemux_request_irq(irq_handler_t handler, void *data); --static int aml_tsdemux_free_irq(void); --static int aml_tsdemux_set_vid(int vpid); --static int aml_tsdemux_set_aid(int apid); --static int aml_tsdemux_set_sid(int spid); --static int aml_tsdemux_set_pcrid(int pcrpid); --static int aml_tsdemux_set_skipbyte(int skipbyte); --static int aml_tsdemux_set_demux(int id); -- --static struct tsdemux_ops aml_tsdemux_ops = { -- .reset = aml_tsdemux_reset, -- .set_reset_flag = aml_tsdemux_set_reset_flag, -- .request_irq = aml_tsdemux_request_irq, -- .free_irq = aml_tsdemux_free_irq, -- .set_vid = aml_tsdemux_set_vid, -- .set_aid = aml_tsdemux_set_aid, -- .set_sid = aml_tsdemux_set_sid, -- .set_pcrid = aml_tsdemux_set_pcrid, -- .set_skipbyte = aml_tsdemux_set_skipbyte, -- .set_demux = aml_tsdemux_set_demux --}; -- --static int control_ts_on_csi_port(int tsin, int enable) --{ --/*#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8*/ -- if (is_meson_m8_cpu() || is_meson_m8b_cpu() || is_meson_m8m2_cpu()) { -- unsigned int temp_data; -- if (tsin == 2 && enable) { -- /*TS2 is on CSI port. */ -- /*power on mipi csi phy */ -- pr_error("power on mipi csi phy for TSIN2\n"); -- WRITE_CBUS_REG(HHI_CSI_PHY_CNTL0, 0xfdc1ff81); -- WRITE_CBUS_REG(HHI_CSI_PHY_CNTL1, 0x3fffff); -- temp_data = READ_CBUS_REG(HHI_CSI_PHY_CNTL2); -- temp_data &= 0x7ff00000; -- temp_data |= 0x80000fc0; -- WRITE_CBUS_REG(HHI_CSI_PHY_CNTL2, temp_data); -- } -- } --/*#endif*/ -- return 0; --} -- --static void aml_dvb_dmx_release(struct aml_dvb *advb, struct aml_dmx *dmx) --{ -- int i; -- -- dvb_net_release(&dmx->dvb_net); -- aml_dmx_hw_deinit(dmx); -- dmx->demux.dmx.close(&dmx->demux.dmx); -- dmx->demux.dmx.remove_frontend(&dmx->demux.dmx, &dmx->mem_fe); -- -- for (i = 0; i < DMX_DEV_COUNT; i++) -- dmx->demux.dmx.remove_frontend(&dmx->demux.dmx, &dmx->hw_fe[i]); -- -- dvb_dmxdev_release(&dmx->dmxdev); -- dvb_dmx_release(&dmx->demux); --} -- --static int aml_dvb_dmx_init(struct aml_dvb *advb, struct aml_dmx *dmx, int id) --{ -- int i, ret; --#ifndef CONFIG_OF -- struct resource *res; -- char buf[32]; --#endif -- switch (id) { -- case 0: -- dmx->dmx_irq = INT_DEMUX; -- break; -- case 1: -- dmx->dmx_irq = INT_DEMUX_1; -- break; -- case 2: -- dmx->dmx_irq = INT_DEMUX_2; -- break; -- } -- --#ifndef CONFIG_OF -- snprintf(buf, sizeof(buf), "demux%d_irq", id); -- res = platform_get_resource_byname(advb->pdev, IORESOURCE_IRQ, buf); -- if (res) -- dmx->dmx_irq = res->start; --#endif -- -- dmx->source = -1; -- dmx->dump_ts_select = 0; -- dmx->dvr_irq = -1; -- -- dmx->demux.dmx.capabilities = -- (DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_PES_FILTERING | -- DMX_MEMORY_BASED_FILTERING | DMX_TS_DESCRAMBLING); -- dmx->demux.filternum = dmx->demux.feednum = FILTER_COUNT; -- dmx->demux.priv = advb; -- dmx->demux.start_feed = aml_dmx_hw_start_feed; -- dmx->demux.stop_feed = aml_dmx_hw_stop_feed; -- dmx->demux.write_to_decoder = NULL; -- ret = dvb_dmx_init(&dmx->demux); -- if (ret < 0) { -- pr_error("dvb_dmx failed: error %d\n", ret); -- goto error_dmx_init; -- } -- -- dmx->dmxdev.filternum = dmx->demux.feednum; -- dmx->dmxdev.demux = &dmx->demux.dmx; -- dmx->dmxdev.capabilities = 0; -- ret = dvb_dmxdev_init(&dmx->dmxdev, &advb->dvb_adapter); -- if (ret < 0) { -- pr_error("dvb_dmxdev_init failed: error %d\n", ret); -- goto error_dmxdev_init; -- } -- -- for (i = 0; i < DMX_DEV_COUNT; i++) { -- int source = i + DMX_FRONTEND_0; -- dmx->hw_fe[i].source = source; -- ret = -- dmx->demux.dmx.add_frontend(&dmx->demux.dmx, -- &dmx->hw_fe[i]); -- if (ret < 0) { -- pr_error("adding hw_frontend to dmx failed: error %d", -- ret); -- dmx->hw_fe[i].source = 0; -- goto error_add_hw_fe; -- } -- } -- -- dmx->mem_fe.source = DMX_MEMORY_FE; -- ret = dmx->demux.dmx.add_frontend(&dmx->demux.dmx, &dmx->mem_fe); -- if (ret < 0) { -- pr_error("adding mem_frontend to dmx failed: error %d", ret); -- goto error_add_mem_fe; -- } -- ret = dmx->demux.dmx.connect_frontend(&dmx->demux.dmx, &dmx->hw_fe[1]); -- if (ret < 0) { -- pr_error("connect frontend failed: error %d", ret); -- goto error_connect_fe; -- } -- -- dmx->id = id; -- dmx->aud_chan = -1; -- dmx->vid_chan = -1; -- dmx->sub_chan = -1; -- dmx->pcr_chan = -1; -- -- /*smallsec*/ -- dmx->smallsec.enable = 0; -- dmx->smallsec.bufsize = SS_BUFSIZE_DEF; -- dmx->smallsec.dmx = dmx; -- -- /*input timeout*/ -- dmx->timeout.enable = 1; -- dmx->timeout.timeout = DTO_TIMEOUT_DEF; -- dmx->timeout.ch_disable = DTO_CHDIS_VAS; -- dmx->timeout.match = 1; -- dmx->timeout.trigger = 0; -- dmx->timeout.dmx = dmx; -- -- ret = aml_dmx_hw_init(dmx); -- if (ret < 0) { -- pr_error("demux hw init error %d", ret); -- dmx->id = -1; -- goto error_dmx_hw_init; -- } -- -- dvb_net_init(&advb->dvb_adapter, &dmx->dvb_net, &dmx->demux.dmx); -- -- return 0; --error_dmx_hw_init: --error_connect_fe: -- dmx->demux.dmx.remove_frontend(&dmx->demux.dmx, &dmx->mem_fe); --error_add_mem_fe: --error_add_hw_fe: -- for (i = 0; i < DMX_DEV_COUNT; i++) { -- if (dmx->hw_fe[i].source) -- dmx->demux.dmx.remove_frontend(&dmx->demux.dmx, -- &dmx->hw_fe[i]); -- } -- dvb_dmxdev_release(&dmx->dmxdev); --error_dmxdev_init: -- dvb_dmx_release(&dmx->demux); --error_dmx_init: -- return ret; --} -- --struct aml_dvb *aml_get_dvb_device(void) --{ -- return &aml_dvb_device; --} --EXPORT_SYMBOL(aml_get_dvb_device); -- --static int dvb_dsc_open(struct inode *inode, struct file *file) --{ -- struct dvb_device *dvbdev = file->private_data; -- struct aml_dsc *dsc = dvbdev->priv; -- struct aml_dvb *dvb = dsc->dvb; -- struct aml_dsc_channel *ch = NULL; -- int id; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- for (id = 0; id < DSC_COUNT; id++) { -- ch = &dsc->channel[id]; -- if (!ch->used) { -- ch->used = 1; -- dsc->dev->users++; -- break; -- } -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- if (!ch || (id >= DSC_COUNT)) { -- pr_error("too many descrambler channels\n"); -- return -EBUSY; -- } -- -- ch->id = id; -- ch->pid = 0x1fff; -- ch->set = 0; -- ch->dsc = dsc; -- -- file->private_data = ch; -- return 0; --} -- --static long dvb_dsc_ioctl(struct file *file, unsigned int cmd, -- unsigned long arg) --{ -- struct aml_dsc_channel *ch = file->private_data; -- struct aml_dvb *dvb = ch->dsc->dvb; -- struct am_dsc_key key; -- int ret = 0; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- switch (cmd) { -- case AMDSC_IOC_SET_PID: -- if (ch->used && (ch->pid == arg)) -- ret = -EBUSY; -- ch->pid = arg; -- dsc_set_pid(ch, ch->pid); -- break; -- case AMDSC_IOC_SET_KEY: -- if (copy_from_user -- (&key, (void __user *)arg, sizeof(struct am_dsc_key))) { -- ret = -EFAULT; -- } else { -- if (key.type) -- memcpy(ch->odd, key.key, 8); -- else -- memcpy(ch->even, key.key, 8); -- ch->set |= 1 << (key.type); -- dsc_set_key(ch, key.type, key.key); -- } -- break; -- default: -- ret = -EINVAL; -- break; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return ret; --} -- --static int dvb_dsc_release(struct inode *inode, struct file *file) --{ -- struct aml_dsc_channel *ch = file->private_data; -- struct aml_dvb *dvb = ch->dsc->dvb; -- unsigned long flags; -- -- /*dvb_generic_release(inode, file); */ -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- ch->used = 0; -- dsc_set_pid(ch, 0x1fff); -- -- ch->pid = 0x1fff; -- ch->set = 0; -- ch->dsc->dev->users--; -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; --} -- --#ifdef CONFIG_COMPAT --static long dvb_dsc_compat_ioctl(struct file *filp, -- unsigned int cmd, unsigned long args) --{ -- unsigned long ret; -- -- args = (unsigned long)compat_ptr(args); -- ret = dvb_dsc_ioctl(filp, cmd, args); -- return ret; --} --#endif -- -- --static const struct file_operations dvb_dsc_fops = { -- .owner = THIS_MODULE, -- .read = NULL, -- .write = NULL, -- .unlocked_ioctl = dvb_dsc_ioctl, -- .open = dvb_dsc_open, -- .release = dvb_dsc_release, -- .poll = NULL, --#ifdef CONFIG_COMPAT -- .compat_ioctl = dvb_dsc_compat_ioctl, --#endif --}; -- --static struct dvb_device dvbdev_dsc = { -- .priv = NULL, -- .users = DSC_COUNT, -- .writers = DSC_COUNT, -- .fops = &dvb_dsc_fops, --}; -- --static int aml_dvb_asyncfifo_init(struct aml_dvb *advb, -- struct aml_asyncfifo *asyncfifo, int id) --{ --#ifndef CONFIG_OF -- struct resource *res; -- char buf[32]; --#endif -- -- if (id == 0) -- asyncfifo->asyncfifo_irq = INT_ASYNC_FIFO_FLUSH; -- else -- asyncfifo->asyncfifo_irq = INT_ASYNC_FIFO2_FLUSH; -- --#ifndef CONFIG_OF -- snprintf(buf, sizeof(buf), "dvr%d_irq", id); -- res = platform_get_resource_byname(advb->pdev, IORESOURCE_IRQ, buf); -- if (res) -- asyncfifo->asyncfifo_irq = res->start; --#endif -- -- asyncfifo->dvb = advb; -- asyncfifo->id = id; -- asyncfifo->init = 0; -- asyncfifo->flush_size = 256 * 1024; -- -- return aml_asyncfifo_hw_init(asyncfifo); --} -- --static void aml_dvb_asyncfifo_release(struct aml_dvb *advb, -- struct aml_asyncfifo *asyncfifo) --{ -- aml_asyncfifo_hw_deinit(asyncfifo); --} -- --static int aml_dvb_dsc_init(struct aml_dvb *advb, -- struct aml_dsc *dsc, int id) --{ -- int i; -- -- for (i = 0; i < DSC_COUNT; i++) { -- dsc->channel[i].id = i; -- dsc->channel[i].used = 0; -- dsc->channel[i].set = 0; -- dsc->channel[i].pid = 0x1fff; -- dsc->channel[i].dsc = dsc; -- } -- dsc->dvb = advb; -- dsc->id = id; -- dsc->source = -1; -- dsc->dst = -1; -- -- /*Register descrambler device */ -- return dvb_register_device(&advb->dvb_adapter, &dsc->dev, -- &dvbdev_dsc, dsc, DVB_DEVICE_DSC); --} --static void aml_dvb_dsc_release(struct aml_dvb *advb, -- struct aml_dsc *dsc) --{ -- if (dsc->dev) -- dvb_unregister_device(dsc->dev); -- dsc->dev = NULL; --} -- -- --/*Show the STB input source*/ --static ssize_t stb_show_source(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- ssize_t ret = 0; -- char *src; -- -- switch (dvb->stb_source) { -- case AM_TS_SRC_TS0: -- case AM_TS_SRC_S_TS0: -- src = "ts0"; -- break; -- case AM_TS_SRC_TS1: -- case AM_TS_SRC_S_TS1: -- src = "ts1"; -- break; -- case AM_TS_SRC_TS2: -- case AM_TS_SRC_S_TS2: -- src = "ts2"; -- break; -- case AM_TS_SRC_HIU: -- src = "hiu"; -- break; -- case AM_TS_SRC_DMX0: -- src = "dmx0"; -- break; -- case AM_TS_SRC_DMX1: -- src = "dmx1"; -- break; -- case AM_TS_SRC_DMX2: -- src = "dmx2"; -- break; -- default: -- src = "disable"; -- break; -- } -- -- ret = sprintf(buf, "%s\n", src); -- return ret; --} -- --/*Set the STB input source*/ --static ssize_t stb_store_source(struct class *class, -- struct class_attribute *attr, const char *buf, -- size_t size) --{ -- enum dmx_source_t src = -1; -- -- if (!strncmp("ts0", buf, 3)) -- src = DMX_SOURCE_FRONT0; -- else if (!strncmp("ts1", buf, 3)) -- src = DMX_SOURCE_FRONT1; -- else if (!strncmp("ts2", buf, 3)) -- src = DMX_SOURCE_FRONT2; -- else if (!strncmp("hiu", buf, 3)) -- src = DMX_SOURCE_DVR0; -- else if (!strncmp("dmx0", buf, 4)) -- src = DMX_SOURCE_FRONT0 + 100; -- else if (!strncmp("dmx1", buf, 4)) -- src = DMX_SOURCE_FRONT1 + 100; -- else if (!strncmp("dmx2", buf, 4)) -- src = DMX_SOURCE_FRONT2 + 100; -- if (src != -1) -- aml_stb_hw_set_source(&aml_dvb_device, src); -- -- return size; --} -- --#define CASE_PREFIX -- --/*Show the descrambler's input source*/ --#define DSC_SOURCE_FUNC_DECL(i) \ --static ssize_t dsc##i##_show_source(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_dsc *dsc = &dvb->dsc[i];\ -- ssize_t ret = 0;\ -- char *src, *dst;\ -- switch (dsc->source) {\ -- CASE_PREFIX case AM_TS_SRC_DMX0:\ -- src = "dmx0";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_DMX1:\ -- src = "dmx1";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_DMX2:\ -- src = "dmx2";\ -- break;\ -- CASE_PREFIX default :\ -- src = "bypass";\ -- break;\ -- } \ -- switch (dsc->dst) {\ -- CASE_PREFIX case AM_TS_SRC_DMX0:\ -- dst = "dmx0";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_DMX1:\ -- dst = "dmx1";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_DMX2:\ -- dst = "dmx2";\ -- break;\ -- CASE_PREFIX default :\ -- dst = "bypass";\ -- break;\ -- } \ -- ret = sprintf(buf, "%s-%s\n", src, dst);\ -- return ret;\ --} \ --static ssize_t dsc##i##_store_source(struct class *class, \ -- struct class_attribute *attr, const char *buf, size_t size)\ --{\ -- enum dmx_source_t src = -1, dst = -1;\ -- \ -- if (!strncmp("dmx0", buf, 4)) {\ -- src = DMX_SOURCE_FRONT0 + 100;\ -- } else if (!strncmp("dmx1", buf, 4)) {\ -- src = DMX_SOURCE_FRONT1 + 100;\ -- } else if (!strncmp("dmx2", buf, 4)) {\ -- src = DMX_SOURCE_FRONT2 + 100;\ -- } \ -- if (buf[4] == '-') {\ -- if (!strncmp("dmx0", buf+5, 4)) {\ -- dst = DMX_SOURCE_FRONT0 + 100;\ -- } else if (!strncmp("dmx1", buf+5, 4)) {\ -- dst = DMX_SOURCE_FRONT1 + 100;\ -- } else if (!strncmp("dmx2", buf+5, 4)) {\ -- dst = DMX_SOURCE_FRONT2 + 100;\ -- } \ -- } \ -- else \ -- dst = src; \ -- aml_dsc_hw_set_source(&aml_dvb_device.dsc[i], src, dst);\ -- return size;\ --} -- --/*Show free descramblers count*/ --#define DSC_FREE_FUNC_DECL(i) \ --static ssize_t dsc##i##_show_free_dscs(struct class *class, \ -- struct class_attribute *attr, char *buf) \ --{ \ -- struct aml_dvb *dvb = &aml_dvb_device; \ -- int fid, count; \ -- ssize_t ret = 0; \ -- unsigned long flags;\ --\ -- spin_lock_irqsave(&dvb->slock, flags); \ -- count = 0; \ -- for (fid = 0; fid < DSC_COUNT; fid++) { \ -- if (!dvb->dsc[i].channel[fid].used) \ -- count++; \ -- } \ -- spin_unlock_irqrestore(&dvb->slock, flags); \ --\ -- ret = sprintf(buf, "%d\n", count); \ -- return ret; \ --} -- --#if DSC_DEV_COUNT > 0 -- DSC_SOURCE_FUNC_DECL(0) -- DSC_FREE_FUNC_DECL(0) --#endif --#if DSC_DEV_COUNT > 1 -- DSC_SOURCE_FUNC_DECL(1) -- DSC_FREE_FUNC_DECL(1) --#endif -- --/*Show the TS output source*/ --static ssize_t tso_show_source(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- ssize_t ret = 0; -- char *src; -- -- switch (dvb->tso_source) { -- case AM_TS_SRC_TS0: -- case AM_TS_SRC_S_TS0: -- src = "ts0"; -- break; -- case AM_TS_SRC_TS1: -- case AM_TS_SRC_S_TS1: -- src = "ts1"; -- break; -- case AM_TS_SRC_TS2: -- case AM_TS_SRC_S_TS2: -- src = "ts2"; -- break; -- case AM_TS_SRC_HIU: -- src = "hiu"; -- break; -- case AM_TS_SRC_DMX0: -- src = "dmx0"; -- break; -- case AM_TS_SRC_DMX1: -- src = "dmx1"; -- break; -- case AM_TS_SRC_DMX2: -- src = "dmx2"; -- break; -- default: -- src = "default"; -- break; -- } -- -- ret = sprintf(buf, "%s\n", src); -- return ret; --} -- --/*Set the TS output source*/ --static ssize_t tso_store_source(struct class *class, -- struct class_attribute *attr, const char *buf, -- size_t size) --{ -- enum dmx_source_t src = -1; -- -- if (!strncmp("ts0", buf, 3)) -- src = DMX_SOURCE_FRONT0; -- else if (!strncmp("ts1", buf, 3)) -- src = DMX_SOURCE_FRONT1; -- else if (!strncmp("ts2", buf, 3)) -- src = DMX_SOURCE_FRONT2; -- else if (!strncmp("hiu", buf, 3)) -- src = DMX_SOURCE_DVR0; -- else if (!strncmp("dmx0", buf, 4)) -- src = DMX_SOURCE_FRONT0 + 100; -- else if (!strncmp("dmx1", buf, 4)) -- src = DMX_SOURCE_FRONT1 + 100; -- else if (!strncmp("dmx2", buf, 4)) -- src = DMX_SOURCE_FRONT2 + 100; -- -- aml_tso_hw_set_source(&aml_dvb_device, src); -- -- return size; --} -- --/*Show PCR*/ --#define DEMUX_PCR_FUNC_DECL(i) \ --static ssize_t demux##i##_show_pcr(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- int f = 0;\ -- if (i == 0)\ -- f = READ_MPEG_REG(PCR_DEMUX);\ -- else if (i == 1)\ -- f = READ_MPEG_REG(PCR_DEMUX_2);\ -- else if (i == 2)\ -- f = READ_MPEG_REG(PCR_DEMUX_3);\ -- return sprintf(buf, "%08x\n", f);\ --} -- --/*Show the STB input source*/ --#define DEMUX_SOURCE_FUNC_DECL(i) \ --static ssize_t demux##i##_show_source(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_dmx *dmx = &dvb->dmx[i];\ -- ssize_t ret = 0;\ -- char *src;\ -- switch (dmx->source) {\ -- CASE_PREFIX case AM_TS_SRC_TS0:\ -- CASE_PREFIX case AM_TS_SRC_S_TS0:\ -- src = "ts0";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_TS1:\ -- CASE_PREFIX case AM_TS_SRC_S_TS1:\ -- src = "ts1";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_TS2:\ -- CASE_PREFIX case AM_TS_SRC_S_TS2:\ -- src = "ts2";\ -- break;\ -- CASE_PREFIX case AM_TS_SRC_HIU:\ -- src = "hiu";\ -- break;\ -- CASE_PREFIX default :\ -- src = "";\ -- break;\ -- } \ -- ret = sprintf(buf, "%s\n", src);\ -- return ret;\ --} \ --static ssize_t demux##i##_store_source(struct class *class, \ -- struct class_attribute *attr, const char *buf, size_t size)\ --{\ -- enum dmx_source_t src = -1;\ -- \ -- if (!strncmp("ts0", buf, 3)) {\ -- src = DMX_SOURCE_FRONT0;\ -- } else if (!strncmp("ts1", buf, 3)) {\ -- src = DMX_SOURCE_FRONT1;\ -- } else if (!strncmp("ts2", buf, 3)) {\ -- src = DMX_SOURCE_FRONT2;\ -- } else if (!strncmp("hiu", buf, 3)) {\ -- src = DMX_SOURCE_DVR0;\ -- } \ -- if (src != -1) {\ -- aml_dmx_hw_set_source(aml_dvb_device.dmx[i].dmxdev.demux, src);\ -- } \ -- return size;\ --} -- --/*Show free filters count*/ --#define DEMUX_FREE_FILTERS_FUNC_DECL(i) \ --static ssize_t demux##i##_show_free_filters(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct dvb_demux *dmx = &dvb->dmx[i].demux;\ -- int fid, count;\ -- ssize_t ret = 0;\ -- if (mutex_lock_interruptible(&dmx->mutex)) \ -- return -ERESTARTSYS; \ -- count = 0;\ -- for (fid = 0; fid < dmx->filternum; fid++) {\ -- if (!dmx->filter[fid].state != DMX_STATE_FREE)\ -- count++;\ -- } \ -- mutex_unlock(&dmx->mutex);\ -- ret = sprintf(buf, "%d\n", count);\ -- return ret;\ --} -- --/*Show filter users count*/ --#define DEMUX_FILTER_USERS_FUNC_DECL(i) \ --static ssize_t demux##i##_show_filter_users(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_dmx *dmx = &dvb->dmx[i];\ -- int dmxdevfid, count;\ -- ssize_t ret = 0;\ -- unsigned long flags;\ -- spin_lock_irqsave(&dvb->slock, flags);\ -- count = 0;\ -- for (dmxdevfid = 0; dmxdevfid < dmx->dmxdev.filternum; dmxdevfid++) {\ -- if (dmx->dmxdev.filter[dmxdevfid].state >= \ -- DMXDEV_STATE_ALLOCATED)\ -- count++;\ -- } \ -- if (count > dmx->demux_filter_user) {\ -- count = dmx->demux_filter_user;\ -- } else{\ -- dmx->demux_filter_user = count;\ -- } \ -- spin_unlock_irqrestore(&dvb->slock, flags);\ -- ret = sprintf(buf, "%d\n", count);\ -- return ret;\ --} \ --static ssize_t demux##i##_store_filter_used(struct class *class, \ -- struct class_attribute *attr, const char *buf, size_t size)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_dmx *dmx = &dvb->dmx[i];\ -- unsigned long filter_used;\ -- unsigned long flags;/*char *endp;*/\ -- /*filter_used = simple_strtol(buf, &endp, 0);*/\ -- int ret = kstrtol(buf, 0, &filter_used);\ -- spin_lock_irqsave(&dvb->slock, flags);\ -- if (ret == 0 && filter_used) {\ -- if (dmx->demux_filter_user < FILTER_COUNT)\ -- dmx->demux_filter_user++;\ -- } else {\ -- if (dmx->demux_filter_user > 0)\ -- dmx->demux_filter_user--;\ -- } \ -- spin_unlock_irqrestore(&dvb->slock, flags);\ -- return size;\ --} -- --/*Show ts header*/ --#define DEMUX_TS_HEADER_FUNC_DECL(i) \ --static ssize_t demux##i##_show_ts_header(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- int hdr = 0;\ -- if (i == 0)\ -- hdr = READ_MPEG_REG(TS_HEAD_1);\ -- else if (i == 1)\ -- hdr = READ_MPEG_REG(TS_HEAD_1_2);\ -- else if (i == 2)\ -- hdr = READ_MPEG_REG(TS_HEAD_1_3);\ -- return sprintf(buf, "%08x\n", hdr);\ --} -- --/*Show channel activity*/ --#define DEMUX_CHANNEL_ACTIVITY_FUNC_DECL(i) \ --static ssize_t demux##i##_show_channel_activity(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- int f = 0;\ -- if (i == 0)\ -- f = READ_MPEG_REG(DEMUX_CHANNEL_ACTIVITY);\ -- else if (i == 1)\ -- f = READ_MPEG_REG(DEMUX_CHANNEL_ACTIVITY_2);\ -- else if (i == 2)\ -- f = READ_MPEG_REG(DEMUX_CHANNEL_ACTIVITY_3);\ -- return sprintf(buf, "%08x\n", f);\ --} -- --#define DEMUX_RESET_FUNC_DECL(i) \ --static ssize_t demux##i##_reset_store(struct class *class, \ -- struct class_attribute *attr, \ -- const char *buf, size_t size)\ --{\ -- if (!strncmp("1", buf, 1)) { \ -- struct aml_dvb *dvb = &aml_dvb_device; \ -- pr_info("Reset demux["#i"], call dmx_reset_dmx_hw\n"); \ -- dmx_reset_dmx_id_hw_ex(dvb, i, 0); \ -- } \ -- return size; \ --} -- --/*DVR record mode*/ --#define DVR_MODE_FUNC_DECL(i) \ --static ssize_t dvr##i##_show_mode(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_dmx *dmx = &dvb->dmx[i];\ -- ssize_t ret = 0;\ -- char *mode;\ -- if (dmx->dump_ts_select) {\ -- mode = "ts";\ -- } else {\ -- mode = "pid";\ -- } \ -- ret = sprintf(buf, "%s\n", mode);\ -- return ret;\ --} \ --static ssize_t dvr##i##_store_mode(struct class *class, \ -- struct class_attribute *attr, const char *buf, size_t size)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_dmx *dmx = &dvb->dmx[i];\ -- int dump_ts_select = -1;\ -- \ -- if (!strncmp("pid", buf, 3) && dmx->dump_ts_select) {\ -- dump_ts_select = 0;\ -- } else if (!strncmp("ts", buf, 2) && !dmx->dump_ts_select) {\ -- dump_ts_select = 1;\ -- } \ -- if (dump_ts_select != -1) {\ -- aml_dmx_hw_set_dump_ts_select(\ -- aml_dvb_device.dmx[i].dmxdev.demux, dump_ts_select);\ -- } \ -- return size;\ --} -- --#if DMX_DEV_COUNT > 0 -- DEMUX_PCR_FUNC_DECL(0) -- DEMUX_SOURCE_FUNC_DECL(0) -- DEMUX_FREE_FILTERS_FUNC_DECL(0) -- DEMUX_FILTER_USERS_FUNC_DECL(0) -- DVR_MODE_FUNC_DECL(0) -- DEMUX_TS_HEADER_FUNC_DECL(0) -- DEMUX_CHANNEL_ACTIVITY_FUNC_DECL(0) -- DEMUX_RESET_FUNC_DECL(0) --#endif --#if DMX_DEV_COUNT > 1 -- DEMUX_PCR_FUNC_DECL(1) -- DEMUX_SOURCE_FUNC_DECL(1) -- DEMUX_FREE_FILTERS_FUNC_DECL(1) -- DEMUX_FILTER_USERS_FUNC_DECL(1) -- DVR_MODE_FUNC_DECL(1) -- DEMUX_TS_HEADER_FUNC_DECL(1) -- DEMUX_CHANNEL_ACTIVITY_FUNC_DECL(1) -- DEMUX_RESET_FUNC_DECL(1) --#endif --#if DMX_DEV_COUNT > 2 -- DEMUX_PCR_FUNC_DECL(2) -- DEMUX_SOURCE_FUNC_DECL(2) -- DEMUX_FREE_FILTERS_FUNC_DECL(2) -- DEMUX_FILTER_USERS_FUNC_DECL(2) -- DVR_MODE_FUNC_DECL(2) -- DEMUX_TS_HEADER_FUNC_DECL(2) -- DEMUX_CHANNEL_ACTIVITY_FUNC_DECL(2) -- DEMUX_RESET_FUNC_DECL(2) --#endif -- --/*Show the async fifo source*/ --#define ASYNCFIFO_SOURCE_FUNC_DECL(i) \ --static ssize_t asyncfifo##i##_show_source(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\ -- ssize_t ret = 0;\ -- char *src;\ -- switch (afifo->source) {\ -- CASE_PREFIX case AM_DMX_0:\ -- src = "dmx0";\ -- break;\ -- CASE_PREFIX case AM_DMX_1:\ -- src = "dmx1";\ -- break; \ -- CASE_PREFIX case AM_DMX_2:\ -- src = "dmx2";\ -- break;\ -- CASE_PREFIX default :\ -- src = "";\ -- break;\ -- } \ -- ret = sprintf(buf, "%s\n", src);\ -- return ret;\ --} \ --static ssize_t asyncfifo##i##_store_source(struct class *class, \ -- struct class_attribute *attr, const char *buf, size_t size)\ --{\ -- enum aml_dmx_id_t src = -1;\ -- \ -- if (!strncmp("dmx0", buf, 4)) {\ -- src = AM_DMX_0;\ -- } else if (!strncmp("dmx1", buf, 4)) {\ -- src = AM_DMX_1;\ -- } else if (!strncmp("dmx2", buf, 4)) {\ -- src = AM_DMX_2;\ -- } \ -- if (src != -1) {\ -- aml_asyncfifo_hw_set_source(&aml_dvb_device.asyncfifo[i], src);\ -- } \ -- return size;\ --} -- --#if ASYNCFIFO_COUNT > 0 --ASYNCFIFO_SOURCE_FUNC_DECL(0) --#endif --#if ASYNCFIFO_COUNT > 1 -- ASYNCFIFO_SOURCE_FUNC_DECL(1) --#endif --/*Show the async fifo flush size*/ --#define ASYNCFIFO_FLUSHSIZE_FUNC_DECL(i) \ --static ssize_t asyncfifo##i##_show_flush_size(struct class *class, \ -- struct class_attribute *attr, char *buf)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\ -- ssize_t ret = 0;\ -- ret = sprintf(buf, "%d\n", afifo->flush_size);\ -- return ret;\ --} \ --static ssize_t asyncfifo##i##_store_flush_size(struct class *class, \ -- struct class_attribute *attr, \ -- const char *buf, size_t size)\ --{\ -- struct aml_dvb *dvb = &aml_dvb_device;\ -- struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\ -- /*int fsize = simple_strtol(buf, NULL, 10);*/\ -- int fsize = 0;\ -- long value;\ -- int ret = kstrtol(buf, 0, &value);\ -- if (ret == 0)\ -- fsize = value;\ -- if (fsize != afifo->flush_size) {\ -- afifo->flush_size = fsize;\ -- aml_asyncfifo_hw_reset(&aml_dvb_device.asyncfifo[i]);\ -- } \ -- return size;\ --} -- --#if ASYNCFIFO_COUNT > 0 --ASYNCFIFO_FLUSHSIZE_FUNC_DECL(0) --#endif -- --#if ASYNCFIFO_COUNT > 1 -- ASYNCFIFO_FLUSHSIZE_FUNC_DECL(1) --#endif --/*Reset the Demux*/ --static ssize_t demux_do_reset(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- if (!strncmp("1", buf, 1)) { -- struct aml_dvb *dvb = &aml_dvb_device; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- pr_dbg("Reset demux, call dmx_reset_hw\n"); -- dmx_reset_hw_ex(dvb, 0); -- spin_unlock_irqrestore(&dvb->slock, flags); -- } -- -- return size; --} -- --/*Show the Video PTS value*/ --static ssize_t demux_show_video_pts(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- ssize_t ret = 0; -- -- ret = sprintf(buf, "%u\n", aml_dmx_get_video_pts(dvb)); -- -- return ret; --} -- --/*Show the Audio PTS value*/ --static ssize_t demux_show_audio_pts(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- ssize_t ret = 0; -- -- ret = sprintf(buf, "%u\n", aml_dmx_get_audio_pts(dvb)); -- -- return ret; --} -- --/*Show the First Video PTS value*/ --static ssize_t demux_show_first_video_pts(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- ssize_t ret = 0; -- -- ret = sprintf(buf, "%u\n", aml_dmx_get_first_video_pts(dvb)); -- -- return ret; --} -- --/*Show the First Audio PTS value*/ --static ssize_t demux_show_first_audio_pts(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- ssize_t ret = 0; -- -- ret = sprintf(buf, "%u\n", aml_dmx_get_first_audio_pts(dvb)); -- -- return ret; --} -- --static ssize_t stb_show_hw_setting(struct class *class, -- struct class_attribute *attr, char *buf) --{ -- int r, total = 0; -- int i; -- struct aml_dvb *dvb = &aml_dvb_device; -- int invert, ctrl; -- -- for (i = 0; i < TS_IN_COUNT; i++) { -- struct aml_ts_input *ts = &dvb->ts[i]; -- -- if (ts->s2p_id != -1) -- invert = dvb->s2p[ts->s2p_id].invert; -- else -- invert = 0; -- -- ctrl = ts->control; -- -- r = sprintf(buf, "ts%d %s control: 0x%x invert: 0x%x\n", i, -- ts->mode == AM_TS_DISABLE ? "disable" : -- (ts->mode == AM_TS_SERIAL ? "serial" : -- "parallel"), ctrl, invert); -- buf += r; -- total += r; -- } -- -- return total; --} -- --static ssize_t stb_store_hw_setting(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t count) --{ -- int id, ctrl, invert, r, mode; -- char mname[32]; -- char pname[32]; -- unsigned long flags; -- struct aml_ts_input *ts; -- struct aml_dvb *dvb = &aml_dvb_device; -- -- r = sscanf(buf, "%d %s %x %x", &id, mname, &ctrl, &invert); -- if (r != 4) -- return -EINVAL; -- -- if (id < 0 || id >= TS_IN_COUNT) -- return -EINVAL; -- -- if ((mname[0] == 's') || (mname[0] == 'S')) { -- sprintf(pname, "s_ts%d", id); -- mode = AM_TS_SERIAL; -- } else if ((mname[0] == 'p') || (mname[0] == 'P')) { -- sprintf(pname, "p_ts%d", id); -- mode = AM_TS_PARALLEL; -- } else -- mode = AM_TS_DISABLE; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- ts = &dvb->ts[id]; -- -- if ((mode == AM_TS_SERIAL) && (ts->mode != AM_TS_SERIAL)) { -- int i; -- int scnt = 0; -- -- for (i = 0; i < TS_IN_COUNT; i++) { -- if (dvb->ts[i].s2p_id != -1) -- scnt++; -- } -- -- if (scnt >= S2P_COUNT) -- pr_error("no free s2p\n"); -- else -- ts->s2p_id = scnt; -- } -- -- if ((mode != AM_TS_SERIAL) || (ts->s2p_id != -1)) { -- if (ts->pinctrl) { -- devm_pinctrl_put(ts->pinctrl); -- ts->pinctrl = NULL; -- } -- -- ts->pinctrl = devm_pinctrl_get_select(&dvb->pdev->dev, pname); --/* if(IS_ERR_VALUE(ts->pinctrl))*/ --/* ts->pinctrl = NULL;*/ -- ts->mode = mode; -- ts->control = ctrl; -- -- if (mode == AM_TS_SERIAL) -- dvb->s2p[ts->s2p_id].invert = invert; -- else -- ts->s2p_id = -1; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return count; --} -- --static struct class_attribute aml_stb_class_attrs[] = { -- __ATTR(hw_setting, S_IRUGO | S_IWUSR | S_IWGRP, stb_show_hw_setting, -- stb_store_hw_setting), -- __ATTR(source, S_IRUGO | S_IWUSR | S_IWGRP, stb_show_source, -- stb_store_source), -- __ATTR(tso_source, S_IRUGO | S_IWUSR, tso_show_source, -- tso_store_source), --#define DEMUX_SOURCE_ATTR_PCR(i)\ -- __ATTR(demux##i##_pcr, S_IRUGO | S_IWUSR, demux##i##_show_pcr, NULL) --#define DEMUX_SOURCE_ATTR_DECL(i)\ -- __ATTR(demux##i##_source, S_IRUGO | S_IWUSR | S_IWGRP,\ -- demux##i##_show_source, demux##i##_store_source) --#define DEMUX_FREE_FILTERS_ATTR_DECL(i)\ -- __ATTR(demux##i##_free_filters, S_IRUGO | S_IWUSR, \ -- demux##i##_show_free_filters, NULL) --#define DEMUX_FILTER_USERS_ATTR_DECL(i)\ -- __ATTR(demux##i##_filter_users, S_IRUGO | S_IWUSR, \ -- demux##i##_show_filter_users, demux##i##_store_filter_used) --#define DVR_MODE_ATTR_DECL(i)\ -- __ATTR(dvr##i##_mode, S_IRUGO | S_IWUSR, dvr##i##_show_mode, \ -- dvr##i##_store_mode) --#define DEMUX_TS_HEADER_ATTR_DECL(i)\ -- __ATTR(demux##i##_ts_header, S_IRUGO | S_IWUSR, \ -- demux##i##_show_ts_header, NULL) --#define DEMUX_CHANNEL_ACTIVITY_ATTR_DECL(i)\ -- __ATTR(demux##i##_channel_activity, S_IRUGO | S_IWUSR, \ -- demux##i##_show_channel_activity, NULL) --#define DMX_RESET_ATTR_DECL(i)\ -- __ATTR(demux##i##_reset, S_IRUGO | S_IWUSR, NULL, \ -- demux##i##_reset_store) -- --#if DMX_DEV_COUNT > 0 -- DEMUX_SOURCE_ATTR_PCR(0), -- DEMUX_SOURCE_ATTR_DECL(0), -- DEMUX_FREE_FILTERS_ATTR_DECL(0), -- DEMUX_FILTER_USERS_ATTR_DECL(0), -- DVR_MODE_ATTR_DECL(0), -- DEMUX_TS_HEADER_ATTR_DECL(0), -- DEMUX_CHANNEL_ACTIVITY_ATTR_DECL(0), -- DMX_RESET_ATTR_DECL(0), --#endif --#if DMX_DEV_COUNT > 1 -- DEMUX_SOURCE_ATTR_PCR(1), -- DEMUX_SOURCE_ATTR_DECL(1), -- DEMUX_FREE_FILTERS_ATTR_DECL(1), -- DEMUX_FILTER_USERS_ATTR_DECL(1), -- DVR_MODE_ATTR_DECL(1), -- DEMUX_TS_HEADER_ATTR_DECL(1), -- DEMUX_CHANNEL_ACTIVITY_ATTR_DECL(1), -- DMX_RESET_ATTR_DECL(1), --#endif --#if DMX_DEV_COUNT > 2 -- DEMUX_SOURCE_ATTR_PCR(2), -- DEMUX_SOURCE_ATTR_DECL(2), -- DEMUX_FREE_FILTERS_ATTR_DECL(2), -- DEMUX_FILTER_USERS_ATTR_DECL(2), -- DVR_MODE_ATTR_DECL(2), -- DEMUX_TS_HEADER_ATTR_DECL(2), -- DEMUX_CHANNEL_ACTIVITY_ATTR_DECL(2), -- DMX_RESET_ATTR_DECL(2), --#endif -- --#define ASYNCFIFO_SOURCE_ATTR_DECL(i)\ -- __ATTR(asyncfifo##i##_source, S_IRUGO | S_IWUSR | S_IWGRP, \ -- asyncfifo##i##_show_source, asyncfifo##i##_store_source) --#define ASYNCFIFO_FLUSHSIZE_ATTR_DECL(i)\ -- __ATTR(asyncfifo##i##_flush_size, S_IRUGO | S_IWUSR | S_IWGRP,\ -- asyncfifo##i##_show_flush_size, \ -- asyncfifo##i##_store_flush_size) --#if ASYNCFIFO_COUNT > 0 -- ASYNCFIFO_SOURCE_ATTR_DECL(0), -- ASYNCFIFO_FLUSHSIZE_ATTR_DECL(0), --#endif --#if ASYNCFIFO_COUNT > 1 -- ASYNCFIFO_SOURCE_ATTR_DECL(1), -- ASYNCFIFO_FLUSHSIZE_ATTR_DECL(1), --#endif -- -- __ATTR(demux_reset, S_IRUGO | S_IWUSR, NULL, demux_do_reset), -- __ATTR(video_pts, S_IRUGO | S_IWUSR | S_IWGRP, demux_show_video_pts, -- NULL), -- __ATTR(audio_pts, S_IRUGO | S_IWUSR | S_IWGRP, demux_show_audio_pts, -- NULL), -- __ATTR(first_video_pts, S_IRUGO | S_IWUSR, demux_show_first_video_pts, -- NULL), -- __ATTR(first_audio_pts, S_IRUGO | S_IWUSR, demux_show_first_audio_pts, -- NULL), -- --#define DSC_SOURCE_ATTR_DECL(i)\ -- __ATTR(dsc##i##_source, S_IRUGO | S_IWUSR | S_IWGRP,\ -- dsc##i##_show_source, dsc##i##_store_source) --#define DSC_FREE_ATTR_DECL(i) \ -- __ATTR(dsc##i##_free_dscs, S_IRUGO | S_IWUSR, \ -- dsc##i##_show_free_dscs, NULL) -- --#if DSC_DEV_COUNT > 0 -- DSC_SOURCE_ATTR_DECL(0), -- DSC_FREE_ATTR_DECL(0), --#endif --#if DSC_DEV_COUNT > 1 -- DSC_SOURCE_ATTR_DECL(1), -- DSC_FREE_ATTR_DECL(1), --#endif -- -- __ATTR_NULL --}; -- --static struct class aml_stb_class = { -- .name = "stb", -- .class_attrs = aml_stb_class_attrs, --}; -- --/* --extern int aml_regist_dmx_class(void); --extern int aml_unregist_dmx_class(void); --*/ --/* --void afifo_reset(int v) --{ -- if (v) -- reset_control_assert(aml_dvb_afifo_reset_ctl); -- else -- reset_control_deassert(aml_dvb_afifo_reset_ctl); --} --*/ -- --static int aml_dvb_probe(struct platform_device *pdev) --{ -- struct aml_dvb *advb; -- int i, ret = 0; -- struct devio_aml_platform_data *pd_dvb; -- -- pr_inf("probe amlogic dvb driver\n"); -- -- /*switch_mod_gate_by_name("demux", 1); */ -- aml_dvb_demux_reset_ctl = -- devm_reset_control_get(&pdev->dev, "demux"); -- pr_inf("dmx rst ctl = %p\n", aml_dvb_demux_reset_ctl); -- reset_control_deassert(aml_dvb_demux_reset_ctl); -- -- aml_dvb_afifo_reset_ctl = -- devm_reset_control_get(&pdev->dev, "asyncfifo"); -- pr_inf("asyncfifo rst ctl = %p\n", aml_dvb_afifo_reset_ctl); -- reset_control_deassert(aml_dvb_afifo_reset_ctl); -- -- aml_dvb_ahbarb0_reset_ctl = -- devm_reset_control_get(&pdev->dev, "ahbarb0"); -- pr_inf("ahbarb0 rst ctl = %p\n", aml_dvb_ahbarb0_reset_ctl); -- reset_control_deassert(aml_dvb_ahbarb0_reset_ctl); -- -- aml_dvb_uparsertop_reset_ctl = -- devm_reset_control_get(&pdev->dev, "uparsertop"); -- pr_inf("uparsertop rst ctl = %p\n", aml_dvb_uparsertop_reset_ctl); -- reset_control_deassert(aml_dvb_uparsertop_reset_ctl); -- -- advb = &aml_dvb_device; -- memset(advb, 0, sizeof(aml_dvb_device)); -- -- spin_lock_init(&advb->slock); -- -- advb->dev = &pdev->dev; -- advb->pdev = pdev; -- advb->stb_source = -1; -- advb->tso_source = -1; -- -- for (i = 0; i < DMX_DEV_COUNT; i++) { -- advb->dmx[i].dmx_irq = -1; -- advb->dmx[i].dvr_irq = -1; -- } -- --#ifdef CONFIG_OF -- if (pdev->dev.of_node) { -- int s2p_id = 0; -- -- for (i = 0; i < TS_IN_COUNT; i++) { -- char buf[32]; -- const char *str; -- u32 value; -- -- advb->ts[i].mode = AM_TS_DISABLE; -- advb->ts[i].s2p_id = -1; -- -- snprintf(buf, sizeof(buf), "ts%d", i); -- ret = -- of_property_read_string(pdev->dev.of_node, buf, -- &str); -- if (!ret) { -- if (!strcmp(str, "serial")) { -- pr_inf("%s: serial\n", buf); -- -- if (s2p_id >= S2P_COUNT) -- pr_error("no free s2p\n"); -- else { -- snprintf(buf, sizeof(buf), -- "s_ts%d", i); -- advb->ts[i].mode = AM_TS_SERIAL; -- advb->ts[i].pinctrl = -- devm_pinctrl_get_select -- (&pdev->dev, buf); -- advb->ts[i].s2p_id = s2p_id; -- -- s2p_id++; -- } -- } else if (!strcmp(str, "parallel")) { -- pr_inf("%s: parallel\n", buf); -- snprintf(buf, sizeof(buf), "p_ts%d", i); -- advb->ts[i].mode = AM_TS_PARALLEL; -- advb->ts[i].pinctrl = -- devm_pinctrl_get_select(&pdev->dev, -- buf); -- } else { -- advb->ts[i].mode = AM_TS_DISABLE; -- advb->ts[i].pinctrl = NULL; -- } -- -- /* if(IS_ERR_VALUE(advb->ts[i].pinctrl)) */ -- /* advb->ts[i].pinctrl = NULL; */ -- -- control_ts_on_csi_port(i, -- (advb->ts[i].mode == -- AM_TS_DISABLE) ? 0 : 1); -- } -- -- snprintf(buf, sizeof(buf), "ts%d_control", i); -- ret = -- of_property_read_u32(pdev->dev.of_node, buf, -- &value); -- if (!ret) { -- pr_inf("%s: 0x%x\n", buf, value); -- advb->ts[i].control = value; -- } -- -- if (advb->ts[i].s2p_id != -1) { -- snprintf(buf, sizeof(buf), "ts%d_invert", i); -- ret = -- of_property_read_u32(pdev->dev.of_node, buf, -- &value); -- if (!ret) { -- pr_inf("%s: 0x%x\n", buf, value); -- advb->s2p[advb->ts[i].s2p_id].invert = -- value; -- } -- } -- } -- } --#endif -- -- pd_dvb = (struct devio_aml_platform_data *)advb->dev->platform_data; -- -- ret = -- dvb_register_adapter(&advb->dvb_adapter, CARD_NAME, THIS_MODULE, -- advb->dev, adapter_nr); -- if (ret < 0) -- return ret; -- -- for (i = 0; i < DMX_DEV_COUNT; i++) -- advb->dmx[i].id = -1; -- -- advb->dvb_adapter.priv = advb; -- dev_set_drvdata(advb->dev, advb); -- -- for (i = 0; i < DSC_DEV_COUNT; i++) { -- ret = aml_dvb_dsc_init(advb, &advb->dsc[i], i); -- if (ret < 0) -- goto error; -- } -- -- for (i = 0; i < DMX_DEV_COUNT; i++) { -- ret = aml_dvb_dmx_init(advb, &advb->dmx[i], i); -- if (ret < 0) -- goto error; -- } -- -- /*Init the async fifos */ -- for (i = 0; i < ASYNCFIFO_COUNT; i++) { -- ret = aml_dvb_asyncfifo_init(advb, &advb->asyncfifo[i], i); -- if (ret < 0) -- goto error; -- } -- -- aml_regist_dmx_class(); -- -- if (class_register(&aml_stb_class) < 0) { -- pr_error("register class error\n"); -- goto error; -- } -- -- tsdemux_set_ops(&aml_tsdemux_ops); -- -- return ret; --error: -- for (i = 0; i < ASYNCFIFO_COUNT; i++) { -- if (advb->asyncfifo[i].id != -1) -- aml_dvb_asyncfifo_release(advb, &advb->asyncfifo[i]); -- } -- -- for (i = 0; i < DMX_DEV_COUNT; i++) { -- if (advb->dmx[i].id != -1) -- aml_dvb_dmx_release(advb, &advb->dmx[i]); -- } -- -- for (i = 0; i < DSC_DEV_COUNT; i++) { -- if (advb->dsc[i].id != -1) -- aml_dvb_dsc_release(advb, &advb->dsc[i]); -- } -- -- dvb_unregister_adapter(&advb->dvb_adapter); -- -- return ret; --} -- --static int aml_dvb_remove(struct platform_device *pdev) --{ -- struct aml_dvb *advb = (struct aml_dvb *)dev_get_drvdata(&pdev->dev); -- int i; -- -- tsdemux_set_ops(NULL); -- -- aml_unregist_dmx_class(); -- class_unregister(&aml_stb_class); -- -- for (i = 0; i < DSC_DEV_COUNT; i++) -- aml_dvb_dsc_release(advb, &advb->dsc[i]); -- -- for (i = 0; i < DMX_DEV_COUNT; i++) -- aml_dvb_dmx_release(advb, &advb->dmx[i]); -- -- dvb_unregister_adapter(&advb->dvb_adapter); -- -- for (i = 0; i < TS_IN_COUNT; i++) { -- if (advb->ts[i].pinctrl) -- devm_pinctrl_put(advb->ts[i].pinctrl); -- } -- -- /*switch_mod_gate_by_name("demux", 0); */ -- reset_control_assert(aml_dvb_uparsertop_reset_ctl); -- reset_control_assert(aml_dvb_ahbarb0_reset_ctl); -- reset_control_assert(aml_dvb_afifo_reset_ctl); -- reset_control_assert(aml_dvb_demux_reset_ctl); -- -- return 0; --} -- --#ifdef CONFIG_OF --static const struct of_device_id aml_dvb_dt_match[] = { -- { -- .compatible = "amlogic, dvb", -- }, -- {}, --}; --#endif /*CONFIG_OF */ -- --static struct platform_driver aml_dvb_driver = { -- .probe = aml_dvb_probe, -- .remove = aml_dvb_remove, -- .driver = { -- .name = "amlogic-dvb", -- .owner = THIS_MODULE, --#ifdef CONFIG_OF -- .of_match_table = aml_dvb_dt_match, --#endif -- } --}; -- --static int __init aml_dvb_init(void) --{ -- pr_dbg("aml dvb init\n"); -- return platform_driver_register(&aml_dvb_driver); --} -- --static void __exit aml_dvb_exit(void) --{ -- pr_dbg("aml dvb exit\n"); -- platform_driver_unregister(&aml_dvb_driver); --} -- --/*Get the STB source demux*/ --static struct aml_dmx *get_stb_dmx(void) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx = NULL; -- int i; -- -- switch (dvb->stb_source) { -- case AM_TS_SRC_DMX0: -- dmx = &dvb->dmx[0]; -- break; -- case AM_TS_SRC_DMX1: -- dmx = &dvb->dmx[1]; -- break; -- case AM_TS_SRC_DMX2: -- dmx = &dvb->dmx[2]; -- break; -- default: -- for (i = 0; i < DMX_DEV_COUNT; i++) { -- dmx = &dvb->dmx[i]; -- if (dmx->source == dvb->stb_source) -- return dmx; -- } -- break; -- } -- -- return dmx; --} -- --static int aml_tsdemux_reset(void) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- if (dvb->reset_flag) { -- struct aml_dmx *dmx = get_stb_dmx(); -- dvb->reset_flag = 0; -- if (dmx) -- dmx_reset_dmx_hw_ex_unlock(dvb, dmx, 0); -- } -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; --} -- --static int aml_tsdemux_set_reset_flag(void) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- dvb->reset_flag = 1; -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; -- --} -- --/*Add the amstream irq handler*/ --static int aml_tsdemux_request_irq(irq_handler_t handler, void *data) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- dmx = get_stb_dmx(); -- if (dmx) { -- dmx->irq_handler = handler; -- dmx->irq_data = data; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; --} -- --/*Free the amstream irq handler*/ --static int aml_tsdemux_free_irq(void) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- dmx = get_stb_dmx(); -- if (dmx) { -- dmx->irq_handler = NULL; -- dmx->irq_data = NULL; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; --} -- --/*Reset the video PID*/ --static int aml_tsdemux_set_vid(int vpid) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx; -- unsigned long flags; -- int ret = 0; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- dmx = get_stb_dmx(); -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- if (dmx) { -- mutex_lock(&dmx->dmxdev.mutex); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx->vid_chan != -1) { -- dmx_free_chan(dmx, dmx->vid_chan); -- dmx->vid_chan = -1; -- } -- -- if ((vpid >= 0) && (vpid < 0x1FFF)) { -- dmx->vid_chan = -- dmx_alloc_chan(dmx, DMX_TYPE_TS, -- DMX_PES_VIDEO, vpid); -- if (dmx->vid_chan == -1) -- ret = -1; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- mutex_unlock(&dmx->dmxdev.mutex); -- } -- -- return ret; --} -- --/*Reset the audio PID*/ --static int aml_tsdemux_set_aid(int apid) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx; -- unsigned long flags; -- int ret = 0; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- dmx = get_stb_dmx(); -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- if (dmx) { -- mutex_lock(&dmx->dmxdev.mutex); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx->aud_chan != -1) { -- dmx_free_chan(dmx, dmx->aud_chan); -- dmx->aud_chan = -1; -- } -- -- if ((apid >= 0) && (apid < 0x1FFF)) { -- dmx->aud_chan = -- dmx_alloc_chan(dmx, DMX_TYPE_TS, -- DMX_PES_AUDIO, apid); -- if (dmx->aud_chan == -1) -- ret = -1; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- mutex_unlock(&dmx->dmxdev.mutex); -- } -- -- return ret; --} -- --/*Reset the subtitle PID*/ --static int aml_tsdemux_set_sid(int spid) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx; -- unsigned long flags; -- int ret = 0; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- dmx = get_stb_dmx(); -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- if (dmx) { -- mutex_lock(&dmx->dmxdev.mutex); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx->sub_chan != -1) { -- dmx_free_chan(dmx, dmx->sub_chan); -- dmx->sub_chan = -1; -- } -- -- if ((spid >= 0) && (spid < 0x1FFF)) { -- dmx->sub_chan = -- dmx_alloc_chan(dmx, DMX_TYPE_TS, -- DMX_PES_SUBTITLE, spid); -- if (dmx->sub_chan == -1) -- ret = -1; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- mutex_unlock(&dmx->dmxdev.mutex); -- } -- -- return ret; --} -- --static int aml_tsdemux_set_pcrid(int pcrpid) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- struct aml_dmx *dmx; -- unsigned long flags; -- int ret = 0; -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- dmx = get_stb_dmx(); -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- if (dmx) { -- mutex_lock(&dmx->dmxdev.mutex); -- -- spin_lock_irqsave(&dvb->slock, flags); -- -- if (dmx->pcr_chan != -1) { -- dmx_free_chan(dmx, dmx->pcr_chan); -- dmx->pcr_chan = -1; -- } -- -- if ((pcrpid >= 0) && (pcrpid < 0x1FFF)) { -- dmx->pcr_chan = -- dmx_alloc_chan(dmx, DMX_TYPE_TS, -- DMX_PES_PCR, pcrpid); -- if (dmx->pcr_chan == -1) -- ret = -1; -- } -- -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- mutex_unlock(&dmx->dmxdev.mutex); -- } -- -- return ret; --} -- --static int aml_tsdemux_set_skipbyte(int skipbyte) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- unsigned long flags; -- -- spin_lock_irqsave(&dvb->slock, flags); -- aml_dmx_set_skipbyte(dvb, skipbyte); -- spin_unlock_irqrestore(&dvb->slock, flags); -- -- return 0; --} -- --static int aml_tsdemux_set_demux(int id) --{ -- struct aml_dvb *dvb = &aml_dvb_device; -- -- aml_dmx_set_demux(dvb, id); -- return 0; --} -- --module_init(aml_dvb_init); --module_exit(aml_dvb_exit); -- --MODULE_DESCRIPTION("driver for the AMLogic DVB card"); --MODULE_AUTHOR("AMLOGIC"); --MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/aml_dvb.h b/drivers/amlogic/dvb_tv/aml_dvb.h -deleted file mode 100644 -index ef7b4e0..0000000 ---- a/drivers/amlogic/dvb_tv/aml_dvb.h -+++ /dev/null -@@ -1,339 +0,0 @@ --#ifndef _AML_DVB_H_ --#define _AML_DVB_H_ -- --#include --#include --#include --#include -- --#include --#include --#include --#include --#include --#include --#include -- --#include --#include --#include -- --#ifdef CONFIG_HAS_EARLYSUSPEND --#include --#endif -- -- --#include "drivers/media/dvb-core/dvbdev.h" --#include "drivers/media/dvb-core/demux.h" --#include "drivers/media/dvb-core/dvb_demux.h" --#include "drivers/media/dvb-core/dmxdev.h" --#include "drivers/media/dvb-core/dvb_filter.h" --#include "drivers/media/dvb-core/dvb_net.h" --#include "drivers/media/dvb-core/dvb_ringbuffer.h" --#include "drivers/media/dvb-core/dvb_frontend.h" -- --#include --#include -- --#define TS_IN_COUNT 3 --#define S2P_COUNT 2 -- --#define DMX_DEV_COUNT 3 --#define FE_DEV_COUNT 2 --#define CHANNEL_COUNT 31 --#define FILTER_COUNT 31 --#define FILTER_LEN 15 --#define DSC_DEV_COUNT 2 --#define DSC_COUNT 8 --#define SEC_BUF_GRP_COUNT 4 --#define SEC_BUF_BUSY_SIZE 4 --#define SEC_BUF_COUNT (SEC_BUF_GRP_COUNT*8) --#define ASYNCFIFO_COUNT 2 -- --enum aml_dmx_id_t { -- AM_DMX_0 = 0, -- AM_DMX_1, -- AM_DMX_2, -- AM_DMX_MAX, --}; -- --enum aml_ts_source_t { -- AM_TS_SRC_TS0, -- AM_TS_SRC_TS1, -- AM_TS_SRC_TS2, -- AM_TS_SRC_S_TS0, -- AM_TS_SRC_S_TS1, -- AM_TS_SRC_S_TS2, -- AM_TS_SRC_HIU, -- AM_TS_SRC_DMX0, -- AM_TS_SRC_DMX1, -- AM_TS_SRC_DMX2 --}; -- --struct aml_sec_buf { -- unsigned long addr; -- int len; --}; -- --struct aml_channel { -- int type; -- enum dmx_ts_pes pes_type; -- int pid; -- int used; -- int filter_count; -- struct dvb_demux_feed *feed; -- struct dvb_demux_feed *dvr_feed; --}; -- --struct aml_filter { -- int chan_id; -- int used; -- struct dmx_section_filter *filter; -- u8 value[FILTER_LEN]; -- u8 maskandmode[FILTER_LEN]; -- u8 maskandnotmode[FILTER_LEN]; -- u8 neq; --}; -- --struct aml_dsc_channel { -- int pid; -- u8 even[8]; -- u8 odd[8]; -- int used; -- int set; -- int id; -- struct aml_dsc *dsc; --}; -- --struct aml_dsc { -- struct dvb_device *dev; -- struct aml_dsc_channel channel[DSC_COUNT]; -- enum aml_ts_source_t source; -- enum aml_ts_source_t dst; -- struct aml_dvb *dvb; -- int id; --}; -- --struct aml_smallsec { -- struct aml_dmx *dmx; -- -- int enable; -- int bufsize; --#define SS_BUFSIZE_DEF (16*4*256) /*16KB*/ -- long buf; -- long buf_map; --}; -- --struct aml_dmxtimeout { -- struct aml_dmx *dmx; -- -- int enable; -- -- int timeout; --#define DTO_TIMEOUT_DEF (9000) /*0.5s*/ -- u32 ch_disable; --#define DTO_CHDIS_VAS (0xfffffff8) /*v/a/s only*/ -- int match; -- -- int trigger; --}; -- --struct aml_dmx { -- struct dvb_demux demux; -- struct dmxdev dmxdev; -- int id; -- int feed_count; -- int chan_count; -- enum aml_ts_source_t source; -- int init; -- int record; -- struct dmx_frontend hw_fe[DMX_DEV_COUNT]; -- struct dmx_frontend mem_fe; -- struct dvb_net dvb_net; -- int dmx_irq; -- int dvr_irq; -- struct tasklet_struct dmx_tasklet; -- struct tasklet_struct dvr_tasklet; -- unsigned long sec_pages; -- unsigned long sec_pages_map; -- int sec_total_len; -- struct aml_sec_buf sec_buf[SEC_BUF_COUNT]; -- unsigned long pes_pages; -- unsigned long pes_pages_map; -- int pes_buf_len; -- unsigned long sub_pages; -- unsigned long sub_pages_map; -- int sub_buf_len; -- struct aml_channel channel[CHANNEL_COUNT+1]; -- struct aml_filter filter[FILTER_COUNT+1]; -- irq_handler_t irq_handler; -- void *irq_data; -- int aud_chan; -- int vid_chan; -- int sub_chan; -- int pcr_chan; -- u32 section_busy[SEC_BUF_BUSY_SIZE]; -- struct dvb_frontend *fe; -- int int_check_count; -- u32 int_check_time; -- int in_tune; -- int error_check; -- int dump_ts_select; -- int sec_buf_watchdog_count[SEC_BUF_COUNT]; -- -- struct aml_smallsec smallsec; -- struct aml_dmxtimeout timeout; -- -- int demux_filter_user; --}; -- --struct aml_asyncfifo { -- int id; -- int init; -- int asyncfifo_irq; -- enum aml_dmx_id_t source; -- unsigned long pages; -- unsigned long pages_map; -- int buf_len; -- int buf_toggle; -- int buf_read; -- int flush_size; -- struct tasklet_struct asyncfifo_tasklet; -- struct aml_dvb *dvb; --}; -- --enum{ -- AM_TS_DISABLE, -- AM_TS_PARALLEL, -- AM_TS_SERIAL --}; -- --struct aml_ts_input { -- int mode; -- struct pinctrl *pinctrl; -- int control; -- int s2p_id; --}; -- --struct aml_s2p { -- int invert; --}; -- --struct aml_swfilter { -- int user; -- struct aml_dmx *dmx; -- struct aml_asyncfifo *afifo; -- -- struct dvb_ringbuffer rbuf; --#define SF_BUFFER_SIZE (10*188*1024) -- -- u8 wrapbuf[188]; -- int track_dmx; --}; -- --struct aml_dvb { -- struct dvb_device dvb_dev; -- -- struct dvb_frontend *fe; -- struct work_struct aml_fe_wq; -- -- struct aml_ts_input ts[TS_IN_COUNT]; -- struct aml_s2p s2p[S2P_COUNT]; -- struct aml_dmx dmx[DMX_DEV_COUNT]; -- struct aml_dsc dsc[DSC_DEV_COUNT]; -- struct aml_asyncfifo asyncfifo[ASYNCFIFO_COUNT]; -- struct dvb_adapter dvb_adapter; -- struct device *dev; -- struct platform_device *pdev; -- enum aml_ts_source_t stb_source; -- enum aml_ts_source_t tso_source; -- int dmx_init; -- int reset_flag; -- spinlock_t slock; -- struct timer_list watchdog_timer; -- int dmx_watchdog_disable[DMX_DEV_COUNT]; -- struct aml_swfilter swfilter; --}; -- -- --/*AMLogic demux interface*/ --extern int aml_dmx_hw_init(struct aml_dmx *dmx); --extern int aml_dmx_hw_deinit(struct aml_dmx *dmx); --extern int aml_dmx_hw_start_feed(struct dvb_demux_feed *dvbdmxfeed); --extern int aml_dmx_hw_stop_feed(struct dvb_demux_feed *dvbdmxfeed); --extern int aml_dmx_hw_set_source(struct dmx_demux *demux, -- enum dmx_source_t src); --extern int aml_stb_hw_set_source(struct aml_dvb *dvb, enum dmx_source_t src); --extern int aml_dsc_hw_set_source(struct aml_dsc *dsc, -- enum dmx_source_t src, enum dmx_source_t dst); --extern int aml_tso_hw_set_source(struct aml_dvb *dvb, enum dmx_source_t src); --extern int aml_dmx_set_skipbyte(struct aml_dvb *dvb, int skipbyte); --extern int aml_dmx_set_demux(struct aml_dvb *dvb, int id); --extern int aml_dmx_hw_set_dump_ts_select -- (struct dmx_demux *demux, int dump_ts_select); -- --extern int dmx_alloc_chan(struct aml_dmx *dmx, int type, -- int pes_type, int pid); --extern void dmx_free_chan(struct aml_dmx *dmx, int cid); -- --extern int dmx_get_ts_serial(enum aml_ts_source_t src); -- --/*AMLogic dsc interface*/ --extern int dsc_set_pid(struct aml_dsc_channel *ch, int pid); --extern int dsc_set_key(struct aml_dsc_channel *ch, int type, u8 *key); -- --/*AMLogic ASYNC FIFO interface*/ --extern int aml_asyncfifo_hw_init(struct aml_asyncfifo *afifo); --extern int aml_asyncfifo_hw_deinit(struct aml_asyncfifo *afifo); --extern int aml_asyncfifo_hw_set_source(struct aml_asyncfifo *afifo, -- enum aml_dmx_id_t src); --extern int aml_asyncfifo_hw_reset(struct aml_asyncfifo *afifo); -- --/*Get the Audio & Video PTS*/ --extern u32 aml_dmx_get_video_pts(struct aml_dvb *dvb); --extern u32 aml_dmx_get_audio_pts(struct aml_dvb *dvb); --extern u32 aml_dmx_get_first_video_pts(struct aml_dvb *dvb); --extern u32 aml_dmx_get_first_audio_pts(struct aml_dvb *dvb); -- --/*Get the DVB device*/ --extern struct aml_dvb *aml_get_dvb_device(void); -- --/*Demod interface*/ --extern void aml_dmx_register_frontend(enum aml_ts_source_t src, -- struct dvb_frontend *fe); --extern void aml_dmx_before_retune(enum aml_ts_source_t src, -- struct dvb_frontend *fe); --extern void aml_dmx_after_retune(enum aml_ts_source_t src, -- struct dvb_frontend *fe); --extern void aml_dmx_start_error_check(enum aml_ts_source_t src, -- struct dvb_frontend *fe); --extern int aml_dmx_stop_error_check(enum aml_ts_source_t src, -- struct dvb_frontend *fe); --extern int aml_regist_dmx_class(void); --extern int aml_unregist_dmx_class(void); --extern void dvb_frontend_retune(struct dvb_frontend *fe); -- --struct devio_aml_platform_data { -- int (*io_setup)(void *); -- int (*io_cleanup)(void *); -- int (*io_power)(void *, int enable); -- int (*io_reset)(void *, int enable); --}; -- --/*Reset the demux device*/ --void dmx_reset_hw(struct aml_dvb *dvb); --void dmx_reset_hw_ex(struct aml_dvb *dvb, int reset_irq); -- --/*Reset the individual demux*/ --void dmx_reset_dmx_hw(struct aml_dvb *dvb, int id); --void dmx_reset_dmx_id_hw_ex(struct aml_dvb *dvb, int id, int reset_irq); --void dmx_reset_dmx_id_hw_ex_unlock(struct aml_dvb *dvb, int id, int reset_irq); --void dmx_reset_dmx_hw_ex(struct aml_dvb *dvb, -- struct aml_dmx *dmx, -- int reset_irq); --void dmx_reset_dmx_hw_ex_unlock(struct aml_dvb *dvb, -- struct aml_dmx *dmx, -- int reset_irq); -- --#endif -- -diff --git a/drivers/amlogic/dvb_tv/aml_dvb_reg.h b/drivers/amlogic/dvb_tv/aml_dvb_reg.h -deleted file mode 100644 -index fdeffd3..0000000 ---- a/drivers/amlogic/dvb_tv/aml_dvb_reg.h -+++ /dev/null -@@ -1,46 +0,0 @@ --/* -- * drivers/amlogic/dvb_tv/dvb_reg.h -- * -- * Copyright (C) 2015 Amlogic, Inc. All rights reserved. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program 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. -- * --*/ -- --#ifndef _DVB_REG_H_ --#define _DVB_REG_H_ -- --#include -- --#include "c_stb_define.h" --#include "c_stb_regs_define.h" -- --#define WRITE_MPEG_REG(_r, _v) aml_write_cbus(_r, _v) --#define READ_MPEG_REG(_r) aml_read_cbus(_r) -- --#define WRITE_CBUS_REG(_r, _v) aml_write_cbus(_r, _v) --#define READ_CBUS_REG(_r) aml_read_cbus(_r) -- --#define WRITE_VCBUS_REG(_r, _v) aml_write_vcbus(_r, _v) --#define READ_VCBUS_REG(_r) aml_read_vcbus(_r) -- --#define BASE_IRQ 32 --#define AM_IRQ(reg) (reg + BASE_IRQ) --#define INT_DEMUX AM_IRQ(23) --#define INT_DEMUX_1 AM_IRQ(5) --#define INT_DEMUX_2 AM_IRQ(53) --#define INT_ASYNC_FIFO_FILL AM_IRQ(18) --#define INT_ASYNC_FIFO_FLUSH AM_IRQ(19) --#define INT_ASYNC_FIFO2_FILL AM_IRQ(24) --#define INT_ASYNC_FIFO2_FLUSH AM_IRQ(25) -- --#endif -- -diff --git a/drivers/amlogic/dvb_tv/aml_fe.c b/drivers/amlogic/dvb_tv/aml_fe.c -deleted file mode 100644 -index 6a31fb5..0000000 ---- a/drivers/amlogic/dvb_tv/aml_fe.c -+++ /dev/null -@@ -1,2860 +0,0 @@ --/* -- * AMLOGIC DVB frontend driver. -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include "aml_fe.h" --#include "amlatvdemod/atvdemod_func.h" -- -- --#ifdef pr_dbg --#undef pr_dbg --#define pr_dbg(fmt, args ...) \ -- do { \ -- if (debug_fe) \ -- pr_info("FE: " fmt, ## args); \ -- } while (0) --#endif --#define pr_error(fmt, args ...) pr_err("FE: " fmt, ## args) --#define pr_inf(fmt, args ...) pr_info("FE: " fmt, ## args) -- --#define AFC_BEST_LOCK 50 --#define ATV_AFC_500KHZ 500000 --#define ATV_AFC_1_0MHZ 1000000 --#define ATV_AFC_2_0MHZ 2000000 -- --#define AML_FE_MAX_RES 50 -- --MODULE_PARM_DESC(debug_fe, "\n\t\t Enable frontend debug information"); --static int debug_fe; --module_param(debug_fe, int, 0644); -- --static int slow_mode; --module_param(slow_mode, int, 0644); --MODULE_DESCRIPTION("search the channel by slow_mode,by add +1MHz\n"); -- --static int video_mode_manul; --module_param(video_mode_manul, int, 0644); --MODULE_DESCRIPTION("search the video manully by get_frontend api\n"); -- --static int audio_mode_manul; --module_param(audio_mode_manul, int, 0644); --MODULE_DESCRIPTION("search the audio manully by get_froutend api\n"); -- --static int tuner_status_cnt = 16; /*4-->16 test on sky mxl661 */ --module_param(tuner_status_cnt, int, 0644); --MODULE_DESCRIPTION("after write a freq, max cnt value of read tuner status\n"); -- --static int delay_cnt = 10; /*10-->20ms test on sky mxl661 */ --module_param(delay_cnt, int, 0644); --MODULE_DESCRIPTION("delay_cnt value of read cvd format\n"); -- --static int delay_afc = 40; /*ms new add on sky mxl661 */ --module_param(delay_afc, int, 0644); --MODULE_DESCRIPTION("search the channel delay_afc,by add +1ms\n"); -- --static struct aml_fe_drv *tuner_drv_list; --static struct aml_fe_drv *atv_demod_drv_list; --static struct aml_fe_drv *dtv_demod_drv_list; --static struct aml_fe_man fe_man; --static long aml_fe_suspended; --static int memstart = 0x1ef00000; -- --static int afc_offset; --module_param(afc_offset, uint, 0644); --MODULE_PARM_DESC(afc_offset, "\n afc_offset\n"); --static int no_sig_cnt; --struct timer_list aml_timer; --#define AML_INTERVAL (HZ/100) /* 10ms, #define HZ 100 */ --static unsigned int timer_init_state; --static unsigned int aft_thread_enable; --static unsigned int aml_timer_en = 1; --module_param(aml_timer_en, uint, 0644); --MODULE_PARM_DESC(aml_timer_en, "\n aml_timer_en\n"); -- --static DEFINE_SPINLOCK(lock); --static int aml_fe_afc_closer(struct dvb_frontend *fe, int minafcfreq, -- int maxafcfreq, int isAutoSearch); -- --typedef int (*hook_func_t) (void); --hook_func_t aml_fe_hook_atv_status = NULL; --hook_func_t aml_fe_hook_hv_lock = NULL; --hook_func_t aml_fe_hook_get_fmt = NULL; --void aml_fe_hook_cvd(hook_func_t atv_mode, hook_func_t cvd_hv_lock, -- hook_func_t get_fmt) --{ -- aml_fe_hook_atv_status = atv_mode; -- aml_fe_hook_hv_lock = cvd_hv_lock; -- aml_fe_hook_get_fmt = get_fmt; -- pr_dbg("[aml_fe]%s\n", __func__); --} --EXPORT_SYMBOL(aml_fe_hook_cvd); -- --int amlogic_gpio_direction_output(unsigned int pin, int value, -- const char *owner) --{ -- gpio_direction_output(pin, value); -- return 0; --} -- --int amlogic_gpio_request(unsigned int pin, const char *label) --{ -- return 0; --} -- --static v4l2_std_id trans_tvin_fmt_to_v4l2_std(int fmt) --{ -- v4l2_std_id std = 0; -- switch (fmt) { -- case TVIN_SIG_FMT_CVBS_NTSC_M: -- case TVIN_SIG_FMT_CVBS_NTSC_443: -- std = V4L2_COLOR_STD_NTSC; -- break; -- case TVIN_SIG_FMT_CVBS_PAL_I: -- case TVIN_SIG_FMT_CVBS_PAL_M: -- case TVIN_SIG_FMT_CVBS_PAL_60: -- case TVIN_SIG_FMT_CVBS_PAL_CN: -- std = V4L2_COLOR_STD_PAL; -- break; -- -- case TVIN_SIG_FMT_CVBS_SECAM: -- std = V4L2_COLOR_STD_SECAM; -- break; -- default: -- pr_err("%s err fmt: 0x%x\n", __func__, fmt); -- break; -- } -- return std; --} -- --static v4l2_std_id demod_fmt_2_v4l2_std(int fmt) --{ -- v4l2_std_id std = 0; -- switch (fmt) { -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK: -- std = V4L2_STD_PAL_DK; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I: -- std = V4L2_STD_PAL_I; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG: -- std = V4L2_STD_PAL_BG; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M: -- std = V4L2_STD_PAL_M; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_DK: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_I: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_BG: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_M: -- std = V4L2_STD_NTSC_M; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L: -- std = V4L2_STD_SECAM_L; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK2: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK3: -- std = V4L2_STD_SECAM_DK; -- break; -- default: -- pr_err("%s unsupport fmt:0x%0x !!!\n", __func__, fmt); -- } -- return std; --} -- --static struct aml_fe_drv **aml_get_fe_drv_list(enum aml_fe_dev_type_t type) --{ -- switch (type) { -- case AM_DEV_TUNER: -- return &tuner_drv_list; -- case AM_DEV_ATV_DEMOD: -- return &atv_demod_drv_list; -- case AM_DEV_DTV_DEMOD: -- return &dtv_demod_drv_list; -- default: -- return NULL; -- } --} -- --int aml_register_fe_drv(enum aml_fe_dev_type_t type, struct aml_fe_drv *drv) --{ -- if (drv) { -- struct aml_fe_drv **list = aml_get_fe_drv_list(type); -- unsigned long flags; -- -- spin_lock_irqsave(&lock, flags); -- -- drv->next = *list; -- *list = drv; -- -- drv->ref = 0; -- -- spin_unlock_irqrestore(&lock, flags); -- } -- -- return 0; --} --EXPORT_SYMBOL(aml_register_fe_drv); -- --int aml_unregister_fe_drv(enum aml_fe_dev_type_t type, struct aml_fe_drv *drv) --{ -- int ret = 0; -- -- if (drv) { -- struct aml_fe_drv *pdrv, *pprev; -- struct aml_fe_drv **list = aml_get_fe_drv_list(type); -- unsigned long flags; -- -- spin_lock_irqsave(&lock, flags); -- -- if (!drv->ref) { -- for (pprev = NULL, pdrv = *list; -- pdrv; pprev = pdrv, pdrv = pdrv->next) { -- if (pdrv == drv) { -- if (pprev) -- pprev->next = pdrv->next; -- else -- *list = pdrv->next; -- break; -- } -- } -- } else { -- pr_error("fe driver %d is inused\n", drv->id); -- ret = -1; -- } -- -- spin_unlock_irqrestore(&lock, flags); -- } -- -- return ret; --} --EXPORT_SYMBOL(aml_unregister_fe_drv); -- --struct dvb_frontend *get_si2177_tuner(void) --{ -- int i; -- struct aml_fe_dev *dev; -- -- for (i = 0; i < FE_DEV_COUNT; i++) { -- dev = &fe_man.tuner[i]; -- if (dev == NULL || dev->drv == NULL || dev->fe == NULL) -- continue; --#if (defined CONFIG_AM_SI2177) -- if (!strcmp(dev->drv->name, "si2177_tuner")) -- return dev->fe->fe; --#elif (defined CONFIG_AM_MXL661) -- if (!strcmp(dev->drv->name, "mxl661_tuner")) -- return dev->fe->fe; --#elif (defined CONFIG_AM_R840) -- if (!strcmp(dev->drv->name, "r840_tuner")) -- return dev->fe->fe; --#else --#endif -- if (!strcmp(dev->drv->name, "r842_tuner")) -- return dev->fe->fe; -- return dev->fe->fe; -- } -- pr_error("can not find out tuner drv\n"); -- return NULL; --} --EXPORT_SYMBOL(get_si2177_tuner); -- --void set_aft_thread_enable(int enable) --{ -- aft_thread_enable = enable; --} -- --static void aml_fe_do_work(struct work_struct *work) --{ -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct dvb_frontend *fe = dvb->fe; -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- int afc = 100; -- static int afc_wave_cnt; -- struct aml_fe *fee; -- fee = fe->demodulator_priv; -- retrieve_frequency_offset(&afc); -- afc = afc*488/1000; -- if (abs(afc) < AFC_BEST_LOCK) { -- afc_wave_cnt = 0; -- return; -- } else { -- afc_wave_cnt++; -- } -- if (afc_wave_cnt < 10) { -- if (debug_fe & 0x1) -- pr_err("%s,afc is wave,ignore\n", __func__); -- return; -- } -- if (abs(afc_offset) >= 2000) { -- no_sig_cnt++; -- if (no_sig_cnt == 20) { -- c->frequency -= afc_offset*1000; -- if (fe->ops.tuner_ops.set_params) -- fe->ops.tuner_ops.set_params(fe); -- afc_offset = 0; -- } -- return; -- } -- no_sig_cnt = 0; -- c->frequency += afc*1000; -- afc_offset += afc; -- if (fe->ops.tuner_ops.set_params) -- fe->ops.tuner_ops.set_params(fe); --} -- --void aml_timer_hander(unsigned long arg) --{ -- struct dvb_frontend *fe = (struct dvb_frontend *)arg; -- struct aml_dvb *dvb = aml_get_dvb_device(); -- aml_timer.expires = jiffies + AML_INTERVAL*10;/* 100ms timer */ -- add_timer(&aml_timer); -- if (!aft_thread_enable) { -- pr_info("%s, stop aft thread\n", __func__); -- return; -- } -- if ((aml_timer_en == 0) || (FE_ANALOG != fe->ops.info.type)) -- return; -- -- dvb->fe = (struct dvb_frontend *)arg; -- schedule_work(&dvb->aml_fe_wq); --} -- --int aml_fe_analog_set_frontend(struct dvb_frontend *fe) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct analog_parameters p; -- fe_status_t tuner_state = FE_TIMEDOUT; -- int ret = -1; -- struct aml_fe *fee; -- fee = fe->demodulator_priv; -- -- if (fe->ops.tuner_ops.set_params) -- ret = fe->ops.tuner_ops.set_params(fe); -- if (fe->ops.tuner_ops.get_status) -- fe->ops.tuner_ops.get_status(fe, &tuner_state); -- -- if (fee->tuner->drv->id == AM_TUNER_R840) -- p.tuner_id = AM_TUNER_R840; -- else if (fee->tuner->drv->id == AM_TUNER_SI2151) -- p.tuner_id = AM_TUNER_SI2151; -- else if (fee->tuner->drv->id == AM_TUNER_MXL661) -- p.tuner_id = AM_TUNER_MXL661; -- p.if_freq = fee->demod_param.if_freq; -- p.if_inv = fee->demod_param.if_inv; -- -- p.frequency = c->frequency; -- p.soundsys = c->analog.soundsys; -- p.audmode = c->analog.audmode; -- p.std = c->analog.std; -- p.reserved = c->analog.reserved; -- -- /*set tuner&ademod such as philipse tuner */ -- if (fe->ops.analog_ops.set_params) { -- fe->ops.analog_ops.set_params(fe, &p); -- ret = 0; -- } -- -- if (ret == 0) { -- afe->params.frequency = c->frequency; -- afe->params.inversion = c->inversion; -- afe->params.analog = c->analog; -- } -- /* afc tune */ -- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_MG9TV) { -- if (aml_timer_en == 1) { -- if (timer_init_state == 1) { -- del_timer_sync(&aml_timer); -- timer_init_state = 0; -- } -- } -- -- if (aml_timer_en == 1 && aft_thread_enable) { -- init_timer(&aml_timer); -- aml_timer.function = aml_timer_hander; -- aml_timer.data = (ulong) fe; -- /* after 5s enable demod auto detect */ -- aml_timer.expires = jiffies + AML_INTERVAL*500; -- afc_offset = 0; -- no_sig_cnt = 0; -- add_timer(&aml_timer); -- timer_init_state = 1; -- } -- } -- -- return ret; --} --EXPORT_SYMBOL(aml_fe_analog_set_frontend); -- --static int aml_fe_analog_get_frontend(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *p = &fe->dtv_property_cache; -- struct aml_fe *afe = fe->demodulator_priv; -- int audio = 0; -- v4l2_std_id std_bk = 0; -- int varify_cnt = 0, i = 0; -- fe_status_t tuner_state = FE_TIMEDOUT; -- fe_status_t ade_state = FE_TIMEDOUT; -- -- p->frequency = afe->params.frequency; -- -- -- if (video_mode_manul) { -- fe->ops.tuner_ops.get_pll_status(fe, &tuner_state); -- fe->ops.analog_ops.get_pll_status(fe, &ade_state); -- if ((FE_HAS_LOCK == ade_state) || -- (FE_HAS_LOCK == tuner_state)) { -- for (i = 0; i < 100; i++) { -- if (aml_fe_hook_get_fmt == NULL) -- break; -- std_bk = aml_fe_hook_get_fmt(); -- if (std_bk) -- varify_cnt++; -- if (varify_cnt > 3) -- break; -- msleep(20); -- } -- if (std_bk == 0) { -- pr_err("%s, failed to get v fmt\n", -- __func__); -- p->analog.std &= 0x00ffffff; -- p->analog.std |= V4L2_COLOR_STD_PAL; -- } else { -- p->analog.std &= 0x00ffffff; -- p->analog.std |= -- trans_tvin_fmt_to_v4l2_std(std_bk); -- pr_err("%s,frequency:%d,std_bk:0x%x,std:0x%x\n", -- __func__, p->frequency, -- (unsigned int)std_bk, -- (unsigned int)p->analog.std); -- } -- } -- } -- if (audio_mode_manul) { -- std_bk = p->analog.std & 0xff000000; -- if (std_bk == V4L2_COLOR_STD_NTSC) { -- audio = V4L2_STD_NTSC_M; -- } else if (std_bk == V4L2_COLOR_STD_SECAM) { -- audio = V4L2_STD_SECAM_L; -- } else { -- amlatvdemod_set_std( -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK); -- audio = aml_audiomode_autodet(fe); -- amlatvdemod_set_std(audio); -- audio = demod_fmt_2_v4l2_std(audio); -- } -- p->analog.audmode = audio; -- p->analog.std &= 0xff000000; -- p->analog.std |= audio; -- pr_err("[%s] params.frequency:%d, audio:0x%0x, vfmt:0x%x\n", -- __func__, p->frequency, (unsigned int)p->analog.audmode, -- (unsigned int)p->analog.std); -- } -- return 0; --} -- --static int aml_fe_analog_sync_frontend(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *p = &fe->dtv_property_cache; -- struct aml_fe *afe = fe->demodulator_priv; -- -- afe->params.frequency = p->frequency; -- afe->params.inversion = p->inversion; -- afe->params.analog = p->analog; -- -- return 0; --} -- --static int aml_fe_analog_read_status(struct dvb_frontend *fe, -- fe_status_t *status) --{ -- int ret = 0; -- -- if (!status) -- return -1; -- /*atv only demod locked is vaild */ -- if (fe->ops.analog_ops.get_status) -- fe->ops.analog_ops.get_status(fe, status); -- else if (fe->ops.tuner_ops.get_status) -- ret = fe->ops.tuner_ops.get_status(fe, status); -- -- return ret; --} -- --static int aml_fe_analog_read_signal_strength(struct dvb_frontend *fe, -- u16 *strength) --{ -- int ret = -1; -- u16 s; -- -- s = 0; -- if (fe->ops.analog_ops.has_signal) { -- fe->ops.analog_ops.has_signal(fe, &s); -- *strength = s; -- ret = 0; -- } else if (fe->ops.tuner_ops.get_rf_strength) { -- ret = fe->ops.tuner_ops.get_rf_strength(fe, strength); -- } -- -- return ret; --} -- --static int aml_fe_analog_read_signal_snr(struct dvb_frontend *fe, u16 *snr) --{ -- if (!snr) { -- pr_error("[aml_fe..]%s null pointer error.\n", __func__); -- return -1; -- } -- if (fe->ops.analog_ops.get_snr) -- *snr = (unsigned short)fe->ops.analog_ops.get_snr(fe); -- return 0; --} -- --static enum dvbfe_algo aml_fe_get_analog_algo(struct dvb_frontend *dev) --{ -- return DVBFE_ALGO_CUSTOM; --} -- -- -- --/*this func set two ways to search the channel*/ --/*if the afc_range>1Mhz,set the freq more than once*/ --/*if the afc_range<=1MHz,set the freq only once ,on the mid freq*/ --static enum dvbfe_search aml_fe_analog_search(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *p = &fe->dtv_property_cache; -- fe_status_t tuner_state = FE_TIMEDOUT; -- fe_status_t ade_state = FE_TIMEDOUT; -- struct atv_status_s atv_status; -- __u32 set_freq = 0; -- __u32 minafcfreq, maxafcfreq; -- __u32 frist_step; -- __u32 afc_step; -- int tuner_status_cnt_local = tuner_status_cnt; -- int atv_cvd_format, hv_lock_status, snr_vale; -- v4l2_std_id std_bk = 0; -- struct aml_fe *fee; -- int audio = 0; -- int try_ntsc = 0, get_vfmt_maxcnt = 50; -- int varify_cnt = 0, i = 0; -- --#ifdef DEBUG_TIME_CUS -- unsigned int time_start, time_end, time_delta; -- time_start = jiffies_to_msecs(jiffies); --#endif -- fee = fe->demodulator_priv; -- if ((fe == NULL) || (p == NULL) || (fee == NULL)) -- return DVBFE_ALGO_SEARCH_FAILED; -- atv_cvd_format = 0; -- hv_lock_status = 0; -- snr_vale = 0; -- pr_dbg("[%s],afc_range=%d,flag=0x%x[1->auto,11->mannul], freq=[%d]\n", -- __func__, p->analog.afc_range, p->analog.flag, p->frequency); -- pr_dbg("the tuner type is [%d]\n", fee->tuner->drv->id); -- /* backup the freq by api */ -- set_freq = p->frequency; -- -- if (p->analog.std == 0) { -- p->analog.std = (V4L2_COLOR_STD_NTSC | V4L2_STD_NTSC_M); -- pr_dbg("%s, user analog.std is 0, so set it to NTSC | M\n", -- __func__); -- } -- if (p->analog.afc_range == 0) { -- pr_dbg("[%s]:afc_range==0,skip the search\n", __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } --/*set the frist_step*/ -- if (p->analog.afc_range > ATV_AFC_1_0MHZ) -- frist_step = ATV_AFC_1_0MHZ; -- else -- frist_step = p->analog.afc_range; --/*set the afc_range and start freq*/ -- minafcfreq = p->frequency - p->analog.afc_range; -- maxafcfreq = p->frequency + p->analog.afc_range; --/*from the min freq start,and set the afc_step*/ -- /*if step is 2Mhz,r840 will miss program*/ -- if (slow_mode || (fee->tuner->drv->id == AM_TUNER_R840)) { -- pr_dbg("[%s]this is slow mode to search the channel\n", -- __func__); -- p->frequency = minafcfreq; -- afc_step = ATV_AFC_1_0MHZ; -- } else if (!slow_mode) { -- p->frequency = minafcfreq; -- afc_step = ATV_AFC_2_0MHZ; -- } else { -- pr_dbg("[%s]unknown tuner type, slow_mode search the channel\n", -- __func__); -- p->frequency = minafcfreq; -- afc_step = ATV_AFC_1_0MHZ; -- } -- -- /**enter manual search mode**/ -- if (p->analog.flag == ANALOG_FLAG_MANUL_SCAN) { -- /*manul search force to ntsc_m */ -- std_bk = p->analog.std; -- pr_dbg("%s Manully user analog.std:0x%08x\n", -- __func__, (uint32_t)std_bk); -- if (get_cpu_type() < MESON_CPU_MAJOR_ID_MG9TV) -- p->analog.std = (V4L2_COLOR_STD_NTSC | V4L2_STD_NTSC_M); -- -- if (fe->ops.set_frontend(fe)) { -- pr_error("[%s]the func of set_param err.\n", __func__); -- p->analog.std = std_bk; -- fe->ops.set_frontend(fe); -- std_bk = 0; -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- -- /*delete it will be not get program*/ -- if (fee->tuner->drv->id == AM_TUNER_MXL661) -- usleep_range((delay_cnt+20)*1000, -- (delay_cnt+20)*1000+100); -- else -- usleep_range(delay_cnt*1000, delay_cnt*1000+100); -- -- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_MG9TV) { -- if ((fe->ops.tuner_ops.get_pll_status == NULL) || -- (fe->ops.analog_ops.get_pll_status == NULL)) { -- pr_info("[%s]error:the func of get_pll_status is NULL.\n", -- __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- fe->ops.tuner_ops.get_pll_status(fe, &tuner_state); -- fe->ops.analog_ops.get_pll_status(fe, &ade_state); -- } else { -- if ((fe->ops.tuner_ops.get_status == NULL) || -- (fe->ops.analog_ops.get_status == NULL)) { -- pr_info("[%s]error:the func of get_status is NULL.\n", -- __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- fe->ops.tuner_ops.get_status(fe, &tuner_state); -- fe->ops.analog_ops.get_status(fe, &ade_state); -- } -- if (((FE_HAS_LOCK == ade_state || -- FE_HAS_LOCK == tuner_state) && -- (fee->tuner->drv->id != AM_TUNER_R840)) || -- ((FE_HAS_LOCK == ade_state && -- FE_HAS_LOCK == tuner_state) && -- (fee->tuner->drv->id == AM_TUNER_R840))) { -- if (debug_fe & 0x1) -- pr_err("[%s][%d]freq:%d pll lock success\n", -- __func__, __LINE__, p->frequency); -- if (fee->tuner->drv->id == AM_TUNER_MXL661) { -- fe->ops.analog_ops.get_atv_status(fe, -- &atv_status); -- if (atv_status.atv_lock) -- usleep_range(20*1000, 20*1000+100); -- } -- if (fee->tuner->drv->id == AM_TUNER_MXL661) -- usleep_range(40*1000, 40*1000+100); -- -- if (aml_fe_afc_closer(fe, p->frequency, -- p->frequency + ATV_AFC_500KHZ, 1) -- == 0) { -- try_ntsc = 0; -- get_vfmt_maxcnt = 200; -- p->analog.std = -- (V4L2_COLOR_STD_PAL | V4L2_STD_PAL_I); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- usleep_range(10*1000, 10*1000+100); -- -- while (1) { -- for (i = 0; i < get_vfmt_maxcnt; i++) { -- if (aml_fe_hook_get_fmt == NULL) -- break; -- std_bk = aml_fe_hook_get_fmt(); -- if (std_bk) -- varify_cnt++; -- if (varify_cnt > 3) -- break; -- if (i == (get_vfmt_maxcnt/3) || -- (i == (get_vfmt_maxcnt/3)*2)) { -- p->analog.std = -- (V4L2_COLOR_STD_NTSC -- | V4L2_STD_NTSC_M); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- } -- usleep_range(20*1000, 20*1000+100); -- } -- if (std_bk == 0) { -- pr_err("%s, failed to get v fmt !!\n", -- __func__); -- if (try_ntsc > 0) { -- pr_err("%s,vfmt assume PAL!!\n", -- __func__); -- std_bk = -- TVIN_SIG_FMT_CVBS_PAL_I; -- break; -- } else { -- p->analog.std = -- (V4L2_COLOR_STD_NTSC -- | V4L2_STD_NTSC_M); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- usleep_range(10*1000, -- 10*1000+100); -- try_ntsc++; -- continue; -- } -- } -- break; -- } -- if (try_ntsc) { -- p->analog.std = -- (V4L2_COLOR_STD_PAL | V4L2_STD_PAL_DK); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- usleep_range(10*1000, 10*1000+100); -- } -- std_bk = trans_tvin_fmt_to_v4l2_std(std_bk); -- if (std_bk == V4L2_COLOR_STD_NTSC) { -- amlatvdemod_set_std( -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK); -- audio = aml_audiomode_autodet(fe); -- audio = demod_fmt_2_v4l2_std(audio); -- if (audio == V4L2_STD_PAL_M) -- audio = V4L2_STD_NTSC_M; -- else -- std_bk = V4L2_COLOR_STD_PAL; -- } else if (std_bk == V4L2_COLOR_STD_SECAM) { -- audio = V4L2_STD_SECAM_L; -- } else { -- amlatvdemod_set_std( -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK); -- audio = aml_audiomode_autodet(fe); -- audio = demod_fmt_2_v4l2_std(audio); -- if (audio == V4L2_STD_PAL_M) { -- audio = demod_fmt_2_v4l2_std( -- broad_std_except_pal_m); -- pr_err("select best audio mode 0x%x\n", -- audio); -- } -- } -- pr_err("%s,Manual freq:%d: std_bk:0x%x ,audmode:0x%x\n", -- __func__, p->frequency, -- (unsigned int)std_bk, audio); -- if (std_bk != 0) { -- p->analog.audmode = audio; -- p->analog.std = std_bk | audio; -- /*avoid std unenable */ -- p->frequency -= 1; -- std_bk = 0; -- } --#ifdef DEBUG_TIME_CUS -- time_end = jiffies_to_msecs(jiffies); -- time_delta = time_end - time_start; -- pr_dbg("[ATV_SEARCH_SUCCESS]%s: time_delta:%d ms\n", -- __func__, time_delta); --#endif -- /*sync param */ -- aml_fe_analog_sync_frontend(fe); -- return DVBFE_ALGO_SEARCH_SUCCESS; -- -- } -- } -- usleep_range(10*1000, 10*1000+100); -- p->frequency += afc_step; -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- /**enter auto search mode**/ -- pr_dbg("%s Autosearch user analog.std:0x%08x\n", -- __func__, (uint32_t)p->analog.std); -- if (fe->ops.set_frontend(fe)) { -- pr_error("[%s]the func of set_param err.\n", __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } --#ifdef DEBUG_TIME_CUS -- time_end = jiffies_to_msecs(jiffies); -- time_delta = time_end - time_start; -- pr_dbg -- ("[ATV_SEARCH_SET_FRONTEND]%s: time_delta_001:%d ms,afc_step:%d\n", -- __func__, time_delta, afc_step); --#endif --/* atuo bettween afc range */ -- if (unlikely(!fe->ops.tuner_ops.get_status || -- !fe->ops.analog_ops.get_status || !fe->ops.set_frontend)) { -- pr_error("[%s]error: NULL func.\n", __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- while (p->frequency <= maxafcfreq) { -- if (debug_fe & 0x3) -- pr_err("[%s] p->frequency=[%d] is processing,maxafcfreq:[%d]\n", -- __func__, p->frequency, maxafcfreq); -- if (fee->tuner->drv->id != AM_TUNER_R840 && -- fee->tuner->drv->id != AM_TUNER_MXL661 && -- fee->tuner->drv->id != AM_TUNER_SI2151) { -- do { -- if (get_cpu_type() != MESON_CPU_MAJOR_ID_GXTVBB) -- usleep_range(delay_cnt*1000, -- delay_cnt*1000+100); -- if ((fe->ops.tuner_ops.get_pll_status == NULL) -- || -- (fe->ops.analog_ops.get_pll_status == -- NULL)) { -- pr_info("[%s]error:the func of get_pll_status is NULL.\n", -- __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- fe->ops.tuner_ops.get_pll_status(fe, -- &tuner_state); -- fe->ops.analog_ops.get_pll_status(fe, -- &ade_state); -- tuner_status_cnt_local--; -- if (FE_HAS_LOCK == ade_state || -- FE_HAS_LOCK == tuner_state || -- tuner_status_cnt_local == 0) -- break; -- } while (1); -- tuner_status_cnt_local = tuner_status_cnt; -- if (FE_HAS_LOCK == ade_state || -- FE_HAS_LOCK == tuner_state) { -- pr_dbg("[%s] pll lock success\n", __func__); -- do { -- tuner_status_cnt_local--; -- /*tvafe_cvd2_get_atv_format(); */ -- if (aml_fe_hook_atv_status != NULL) -- atv_cvd_format = -- aml_fe_hook_atv_status(); -- /*tvafe_cvd2_get_hv_lock(); */ -- if (aml_fe_hook_hv_lock != NULL) -- hv_lock_status = -- aml_fe_hook_hv_lock(); -- if (fe->ops.analog_ops.get_snr != NULL) -- snr_vale = -- fe->ops.analog_ops.get_snr(fe); -- -- pr_dbg("[%s] atv_cvd_format:0x%x;" -- "hv_lock_status:0x%x;" -- "snr_vale:%d, v fmt:0x%x\n", -- __func__, atv_cvd_format, -- hv_lock_status, snr_vale, -- (unsigned int)std_bk); -- if (((atv_cvd_format & 0x4) == 0) -- || ((hv_lock_status == 0x4) -- && (snr_vale < 10))) { -- std_bk = p->analog.std -- & 0xff000000; -- audio = -- aml_audiomode_autodet(fe); -- p->analog.std = std_bk | -- demod_fmt_2_v4l2_std(audio); -- p->analog.audmode = -- demod_fmt_2_v4l2_std(audio); -- /*avoid std unenable */ -- p->frequency += 1; -- pr_dbg("[%s] maybe ntsc m\n", -- __func__); -- break; -- } -- if (tuner_status_cnt_local == 0) -- break; -- if (get_cpu_type() != MESON_CPU_MAJOR_ID_GXTVBB) -- usleep_range(delay_cnt*1000, -- delay_cnt*1000+100); -- } while (1); -- } -- if (tuner_status_cnt_local != 0) { -- if (fe->ops.set_frontend(fe)) { -- pr_info("[%s] the func of set_frontend err.\n", -- __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- } -- } -- tuner_status_cnt_local = tuner_status_cnt; -- do { -- if (fee->tuner->drv->id == AM_TUNER_MXL661) -- usleep_range((delay_cnt+15)*1000, -- (delay_cnt+15)*1000+100); --/* if (fee->tuner->drv->id == AM_TUNER_R840) -- usleep_range(delay_cnt*1000, -- delay_cnt*1000+100); --*/ -- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_MG9TV) { -- if ((fe->ops.tuner_ops.get_pll_status == NULL) -- || -- (fe->ops.analog_ops.get_pll_status == -- NULL)) { -- pr_info("[%s]error:the func of get_pll_status is NULL.\n", -- __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- fe->ops.tuner_ops.get_pll_status(fe, -- &tuner_state); -- fe->ops.analog_ops.get_pll_status(fe, -- &ade_state); -- } else { -- if ((fe->ops.tuner_ops.get_status == NULL) -- || -- (fe->ops.analog_ops.get_status == -- NULL)) { -- pr_info("[%s]error:the func of get_status is NULL.\n", -- __func__); -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- fe->ops.tuner_ops.get_status(fe, &tuner_state); -- fe->ops.analog_ops.get_status(fe, &ade_state); -- } -- tuner_status_cnt_local--; -- if (((FE_HAS_LOCK == ade_state || -- FE_HAS_LOCK == tuner_state) && -- (fee->tuner->drv->id != AM_TUNER_R840)) || -- ((FE_HAS_LOCK == ade_state && -- FE_HAS_LOCK == tuner_state) && -- (fee->tuner->drv->id == AM_TUNER_R840)) || -- (tuner_status_cnt_local == 0)) -- break; -- } while (1); -- tuner_status_cnt_local = tuner_status_cnt; -- if (((FE_HAS_LOCK == ade_state || -- FE_HAS_LOCK == tuner_state) && -- (fee->tuner->drv->id != AM_TUNER_R840)) || -- ((FE_HAS_LOCK == ade_state && -- FE_HAS_LOCK == tuner_state) && -- (fee->tuner->drv->id == AM_TUNER_R840))) { -- if (debug_fe & 0x1) -- pr_err("[%s][%d]freq:%d pll lock success\n", -- __func__, __LINE__, p->frequency); -- if (fee->tuner->drv->id == AM_TUNER_MXL661) { -- fe->ops.analog_ops.get_atv_status(fe, -- &atv_status); -- if (atv_status.atv_lock) -- usleep_range(20*1000, 20*1000+100); -- } -- if (aml_fe_afc_closer(fe, minafcfreq, -- maxafcfreq + ATV_AFC_500KHZ, 1) == 0) { -- try_ntsc = 0; -- get_vfmt_maxcnt = 200; -- while (1) { -- for (i = 0; i < get_vfmt_maxcnt; i++) { -- if (aml_fe_hook_get_fmt == NULL) -- break; -- std_bk = aml_fe_hook_get_fmt(); -- if (std_bk) -- varify_cnt++; -- if (fee->tuner->drv->id == AM_TUNER_R840) { -- if (varify_cnt > 0) -- break; -- } -- if (varify_cnt > 3) -- break; -- if (i == (get_vfmt_maxcnt/3) || -- (i == (get_vfmt_maxcnt/3)*2)) { -- p->analog.std = -- (V4L2_COLOR_STD_NTSC -- | V4L2_STD_NTSC_M); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- } -- usleep_range(20*1000, 20*1000+100); -- } -- if (debug_fe & 0x2) -- pr_err("get std_bk cnt:%d\n", i); -- -- if (std_bk == 0) { -- pr_err("%s, failed to get v fmt !!\n", -- __func__); -- if (try_ntsc > 0) { -- pr_err("%s,vfmt assume PAL!!\n", -- __func__); -- std_bk = -- TVIN_SIG_FMT_CVBS_PAL_I; -- break; -- } else { -- p->analog.std = -- (V4L2_COLOR_STD_NTSC -- | V4L2_STD_NTSC_M); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- usleep_range(10*1000, -- 10*1000+100); -- try_ntsc++; -- continue; -- } -- } -- break; -- } -- if (try_ntsc) { -- p->analog.std = (V4L2_COLOR_STD_PAL -- | V4L2_STD_PAL_DK); -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- usleep_range(10*1000, 10*1000+100); -- } -- std_bk = trans_tvin_fmt_to_v4l2_std(std_bk); -- -- if (std_bk == V4L2_COLOR_STD_NTSC) { -- amlatvdemod_set_std( -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK); -- audio = aml_audiomode_autodet(fe); -- audio = demod_fmt_2_v4l2_std(audio); -- if (audio == V4L2_STD_PAL_M) -- audio = V4L2_STD_NTSC_M; -- else -- std_bk = V4L2_COLOR_STD_PAL; -- } else if (std_bk == V4L2_COLOR_STD_SECAM) { -- audio = V4L2_STD_SECAM_L; -- } else { -- amlatvdemod_set_std( -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK); -- audio = aml_audiomode_autodet(fe); -- audio = demod_fmt_2_v4l2_std(audio); -- if (audio == V4L2_STD_PAL_M) { -- audio = demod_fmt_2_v4l2_std( -- broad_std_except_pal_m); -- pr_err("select the audio mode 0x%x\n", -- audio); -- } -- } -- pr_err("%s,Auto search freq:%d: std_bk:0x%x ,audmode:0x%x\n", -- __func__, p->frequency, -- (unsigned int)std_bk, audio); -- if (std_bk != 0) { -- p->analog.audmode = audio; -- p->analog.std = std_bk | audio; -- /*avoid std unenable */ -- p->frequency -= 1; -- std_bk = 0; -- } --#ifdef DEBUG_TIME_CUS -- time_end = jiffies_to_msecs(jiffies); -- time_delta = time_end - time_start; -- pr_dbg("[ATV_SEARCH_SUCCESS]%s: time_delta:%d ms\n", -- __func__, time_delta); --#endif -- /*sync param */ -- aml_fe_analog_sync_frontend(fe); -- return DVBFE_ALGO_SEARCH_SUCCESS; -- } -- } -- /*avoid sound format is not match after search over */ -- if (std_bk != 0) { -- p->analog.std = std_bk; -- fe->ops.set_frontend(fe); -- std_bk = 0; -- } -- pr_dbg("[%s] freq[analog.std:0x%08x] is[%d] unlock\n", -- __func__, (uint32_t)p->analog.std, p->frequency); -- p->frequency += afc_step; -- if (p->frequency > maxafcfreq) { -- pr_dbg("[%s] p->frequency=[%d] over maxafcfreq=[%d].search failed.\n", -- __func__, p->frequency, maxafcfreq); -- /*back original freq to api */ -- p->frequency = set_freq; -- fe->ops.set_frontend(fe); --#ifdef DEBUG_TIME_CUS -- time_end = jiffies_to_msecs(jiffies); -- time_delta = time_end - time_start; -- pr_dbg("[ATV_SEARCH_FAILED]%s: time_delta:%d ms\n", -- __func__, time_delta); --#endif -- return DVBFE_ALGO_SEARCH_FAILED; -- } -- fe->ops.set_frontend(fe); -- } --#ifdef DEBUG_TIME_CUS -- time_end = jiffies_to_msecs(jiffies); -- time_delta = time_end - time_start; -- pr_dbg("[ATV_SEARCH_FAILED]%s: time_delta:%d ms\n", -- __func__, time_delta); --#endif -- return DVBFE_ALGO_SEARCH_FAILED; --} -- --static int aml_fe_afc_closer(struct dvb_frontend *fe, int minafcfreq, -- int maxafcfreq, int isAutoSearch) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- int afc = 100; -- __u32 set_freq; -- int count = 25; -- int lock_cnt = 0; -- struct aml_fe *fee; -- static int freq_success; -- static int temp_freq, temp_afc; -- struct timespec time_now; -- static struct timespec success_time; -- fee = fe->demodulator_priv; -- if (debug_fe & 0x2) -- pr_err("%s: freq_success:%d,freq:%d,minfreq:%d,maxfreq:%d\n", -- __func__, freq_success, c->frequency, -- minafcfreq, maxafcfreq); -- -- /* avoid more search the same program */ -- if (abs(c->frequency - freq_success) < 3000000) { -- ktime_get_ts(&time_now); -- if (debug_fe & 0x2) -- pr_err("%s: tv_sec now:%ld,tv_sec success:%ld\n", -- __func__, time_now.tv_sec, success_time.tv_sec); -- /* beyond 10s search same frequency is ok */ -- if ((time_now.tv_sec - success_time.tv_sec) < 10) -- return -1; -- } -- /*do the auto afc make sure the afc<50k or the range from api */ -- if ((fe->ops.analog_ops.get_afc || fe->ops.tuner_ops.get_afc) && -- fe->ops.set_frontend) { -- /* -- delete it will miss program -- when c->frequency equal program frequency -- */ -- c->frequency++; -- if (fe->ops.tuner_ops.set_params) -- fe->ops.tuner_ops.set_params(fe); -- if (fee->tuner->drv->id == AM_TUNER_SI2151 -- || fee->tuner->drv->id == AM_TUNER_R840) -- usleep_range(10*1000, 10*1000+100); -- else if (fee->tuner->drv->id == AM_TUNER_MXL661) -- usleep_range(20*1000, 20*1000+100); -- /*****************************/ -- set_freq = c->frequency; -- while (abs(afc) > AFC_BEST_LOCK) { -- if ((fe->ops.analog_ops.get_afc) && -- ((fee->tuner->drv->id == AM_TUNER_R840) || -- (fee->tuner->drv->id == AM_TUNER_SI2151) || -- (fee->tuner->drv->id == AM_TUNER_MXL661))) -- fe->ops.analog_ops.get_afc(fe, &afc); -- else if (fe->ops.tuner_ops.get_afc) -- fe->ops.tuner_ops.get_afc(fe, &afc); -- -- if (afc == 0xffff) { -- /*last lock, but this unlock,so try get afc*/ -- if (lock_cnt > 0) { -- c->frequency = -- temp_freq + temp_afc*1000; -- if (debug_fe & 0x2) -- pr_err("%s,force lock,f:%d\n", -- __func__, c->frequency); -- freq_success = c->frequency; -- ktime_get_ts(&success_time); -- return 0; -- } else -- afc = 500; -- } else { -- lock_cnt++; -- temp_freq = c->frequency; -- if (afc > 50) -- temp_afc = 500; -- else if (afc < -50) -- temp_afc = -500; -- else -- temp_afc = afc; -- } -- -- if (((abs(afc) > (500 - AFC_BEST_LOCK)) -- && (abs(afc) < (500 + AFC_BEST_LOCK)) -- && (abs(afc) != 500)) -- || ((abs(afc) == 500) && (lock_cnt > 0))) { -- c->frequency += afc * 1000; -- break; -- } -- -- if (afc >= (500 + AFC_BEST_LOCK)) -- afc = 500; -- -- c->frequency += afc * 1000; -- -- if (unlikely(c->frequency > maxafcfreq)) { -- if (debug_fe & 0x2) -- pr_err("[%s]:[%d] is exceed maxafcfreq[%d]\n", -- __func__, c->frequency, -- maxafcfreq); -- c->frequency = set_freq; -- return -1; -- } -- #if 0 /*if enable ,it would miss program*/ -- if (unlikely(c->frequency < minafcfreq)) { -- pr_dbg("[%s]:[%d ] is exceed minafcfreq[%d]\n", -- __func__, c->frequency, minafcfreq); -- c->frequency = set_freq; -- return -1; -- } -- #endif -- if (likely(!(count--))) { -- if (debug_fe & 0x2) -- pr_err("[%s]:exceed the afc count\n", -- __func__); -- c->frequency = set_freq; -- return -1; -- } -- -- /* afc tune */ -- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_MG9TV) { -- if (aml_timer_en == 1) { -- if (timer_init_state == 1) { -- del_timer_sync(&aml_timer); -- timer_init_state = 0; -- } -- } -- -- if (aml_timer_en == 1 && aft_thread_enable) { -- init_timer(&aml_timer); -- aml_timer.function = aml_timer_hander; -- aml_timer.data = (ulong) fe; -- /* after 5s enable demod auto detect*/ -- aml_timer.expires = -- jiffies + AML_INTERVAL*500; -- afc_offset = 0; -- no_sig_cnt = 0; -- add_timer(&aml_timer); -- timer_init_state = 1; -- } -- } -- c->frequency++; -- if (fe->ops.tuner_ops.set_params) -- fe->ops.tuner_ops.set_params(fe); -- -- /*delete it will miss program*/ -- if (fee->tuner->drv->id == AM_TUNER_MXL661) -- usleep_range(20*1000, 20*1000+100); -- else -- usleep_range(10*1000, 10*1000+100); -- -- if (debug_fe & 0x2) -- pr_err("[aml_fe..]%s get afc %d khz, freq %u.\n", -- __func__, afc, c->frequency); -- } -- freq_success = c->frequency; -- ktime_get_ts(&success_time); -- if (debug_fe & 0x2) -- pr_err("[aml_fe..]%s get afc %d khz done, freq %u.\n", -- __func__, afc, c->frequency); -- } -- return 0; --} -- --static int aml_fe_set_mode(struct dvb_frontend *dev, fe_type_t type) --{ -- struct aml_fe *fe; -- enum aml_fe_mode_t mode; -- unsigned long flags; -- int ret = 0; -- -- fe = dev->demodulator_priv; -- /*type=FE_ATSC; */ -- switch (type) { -- case FE_QPSK: -- mode = AM_FE_QPSK; -- pr_dbg("set mode -> QPSK\n"); -- break; -- case FE_QAM: -- pr_dbg("set mode -> QAM\n"); -- mode = AM_FE_QAM; -- break; -- case FE_OFDM: -- pr_dbg("set mode -> OFDM\n"); -- mode = AM_FE_OFDM; -- break; -- case FE_ATSC: -- pr_dbg("set mode -> ATSC\n"); -- mode = AM_FE_ATSC; -- break; -- case FE_ISDBT: -- pr_dbg("set mode -> ISDBT\n"); -- mode = AM_FE_ISDBT; -- break; -- case FE_DTMB: -- pr_dbg("set mode -> DTMB\n"); -- mode = AM_FE_DTMB; -- break; -- case FE_ANALOG: -- pr_dbg("set mode -> ANALOG\n"); -- mode = AM_FE_ANALOG; -- break; -- default: -- pr_error("illegal fe type %d\n", type); -- return -1; -- } -- -- if (fe->mode == mode) { -- pr_dbg("[%s]:the mode is not change!!!!\n", __func__); -- return 0; -- } -- -- if (fe->mode != AM_FE_UNKNOWN) { -- pr_dbg("leave mode %d\n", fe->mode); -- -- if (fe->dtv_demod && (fe->dtv_demod->drv->capability & fe->mode) -- && fe->dtv_demod->drv->leave_mode) -- fe->dtv_demod->drv->leave_mode(fe, fe->mode); -- if (fe->atv_demod && (fe->atv_demod->drv->capability & fe->mode) -- && fe->atv_demod->drv->leave_mode) -- fe->atv_demod->drv->leave_mode(fe, fe->mode); -- if (fe->tuner && (fe->tuner->drv->capability & fe->mode) -- && fe->tuner->drv->leave_mode) -- fe->tuner->drv->leave_mode(fe, fe->mode); -- -- if (fe->mode & AM_FE_DTV_MASK) -- aml_dmx_register_frontend(fe->ts, NULL); -- -- fe->mode = AM_FE_UNKNOWN; -- } -- -- if (!(mode & fe->capability)) { -- int i; -- -- spin_lock_irqsave(&lock, flags); -- for (i = 0; i < FE_DEV_COUNT; i++) { -- if ((mode & fe_man.fe[i].capability) -- && (fe_man.fe[i].dev_id == fe->dev_id)) -- break; -- } -- spin_unlock_irqrestore(&lock, flags); -- -- if (i >= FE_DEV_COUNT) { -- pr_error -- ("frend %p don't support mode %x, capability %x\n", -- fe, mode, fe->capability); -- return -1; -- } -- -- fe = &fe_man.fe[i]; -- dev->demodulator_priv = fe; -- } -- -- if (fe->mode & AM_FE_DTV_MASK) { -- aml_dmx_register_frontend(fe->ts, NULL); -- fe->mode = 0; -- } -- -- spin_lock_irqsave(&fe->slock, flags); -- -- memset(&fe->fe->ops.tuner_ops, 0, sizeof(fe->fe->ops.tuner_ops)); -- memset(&fe->fe->ops.analog_ops, 0, sizeof(fe->fe->ops.analog_ops)); -- memset(&fe->fe->ops.info, 0, sizeof(fe->fe->ops.info)); -- fe->fe->ops.release = NULL; -- fe->fe->ops.release_sec = NULL; -- fe->fe->ops.init = NULL; -- fe->fe->ops.sleep = NULL; -- fe->fe->ops.write = NULL; -- fe->fe->ops.tune = NULL; -- fe->fe->ops.get_frontend_algo = NULL; -- fe->fe->ops.set_frontend = NULL; -- fe->fe->ops.get_tune_settings = NULL; -- fe->fe->ops.get_frontend = NULL; -- fe->fe->ops.read_status = NULL; -- fe->fe->ops.read_ber = NULL; -- fe->fe->ops.read_signal_strength = NULL; -- fe->fe->ops.read_snr = NULL; -- fe->fe->ops.read_ucblocks = NULL; -- fe->fe->ops.set_qam_mode = NULL; -- fe->fe->ops.diseqc_reset_overload = NULL; -- fe->fe->ops.diseqc_send_master_cmd = NULL; -- fe->fe->ops.diseqc_recv_slave_reply = NULL; -- fe->fe->ops.diseqc_send_burst = NULL; -- fe->fe->ops.set_tone = NULL; -- fe->fe->ops.set_voltage = NULL; -- fe->fe->ops.enable_high_lnb_voltage = NULL; -- fe->fe->ops.dishnetwork_send_legacy_command = NULL; -- fe->fe->ops.i2c_gate_ctrl = NULL; -- fe->fe->ops.ts_bus_ctrl = NULL; -- fe->fe->ops.search = NULL; -- fe->fe->ops.track = NULL; -- fe->fe->ops.set_property = NULL; -- fe->fe->ops.get_property = NULL; -- memset(&fe->fe->ops.blindscan_ops, 0, -- sizeof(fe->fe->ops.blindscan_ops)); -- fe->fe->ops.asyncinfo.set_frontend_asyncenable = 0; -- if (fe->tuner && fe->tuner->drv && (mode & fe->tuner->drv->capability) -- && fe->tuner->drv->get_ops) -- fe->tuner->drv->get_ops(fe->tuner, mode, -- &fe->fe->ops.tuner_ops); -- -- if (fe->atv_demod && fe->atv_demod->drv -- && (mode & fe->atv_demod->drv->capability) -- && fe->atv_demod->drv->get_ops) { -- fe->atv_demod->drv->get_ops(fe->atv_demod, mode, -- &fe->fe->ops.analog_ops); -- fe->fe->ops.set_frontend = aml_fe_analog_set_frontend; -- fe->fe->ops.get_frontend = aml_fe_analog_get_frontend; -- fe->fe->ops.read_status = aml_fe_analog_read_status; -- fe->fe->ops.read_signal_strength = -- aml_fe_analog_read_signal_strength; -- fe->fe->ops.read_snr = aml_fe_analog_read_signal_snr; -- fe->fe->ops.get_frontend_algo = aml_fe_get_analog_algo; -- fe->fe->ops.search = aml_fe_analog_search; -- } -- -- if (fe->dtv_demod && fe->dtv_demod->drv -- && (mode & fe->dtv_demod->drv->capability) -- && fe->dtv_demod->drv->get_ops) -- fe->dtv_demod->drv->get_ops(fe->dtv_demod, mode, &fe->fe->ops); -- -- spin_unlock_irqrestore(&fe->slock, flags); -- -- pr_dbg("enter mode %d\n", mode); -- -- if (fe->dtv_demod && (fe->dtv_demod->drv->capability & mode) -- && fe->dtv_demod->drv->enter_mode) -- ret = fe->dtv_demod->drv->enter_mode(fe, mode); -- if (fe->atv_demod && (fe->atv_demod->drv->capability & mode) -- && fe->atv_demod->drv->enter_mode) -- ret = fe->atv_demod->drv->enter_mode(fe, mode); -- if (fe->tuner && (fe->tuner->drv->capability & mode) -- && fe->tuner->drv->enter_mode) -- ret = fe->tuner->drv->enter_mode(fe, mode); -- if (ret != 0) { -- pr_error("enter mode %d fail, ret %d\n", mode, ret); -- return ret; -- } -- -- pr_dbg("register demux frontend\n"); -- if (mode & AM_FE_DTV_MASK) -- aml_dmx_register_frontend(fe->ts, fe->fe); -- strcpy(fe->fe->ops.info.name, "amlogic dvb frontend"); -- -- fe->fe->ops.info.type = type; -- fe->mode = mode; -- -- pr_dbg("set mode ok\n"); -- -- return 0; --} -- --static int aml_fe_read_ts(struct dvb_frontend *dev, int *ts) --{ -- struct aml_fe *fe; -- -- fe = dev->demodulator_priv; -- -- *ts = fe->ts; -- return 0; --} -- --#ifndef CONFIG_OF --struct resource *aml_fe_platform_get_resource_byname(const char *name) --{ -- int i; -- -- for (i = 0; i < aml_fe_num_resources; i++) { -- struct resource *r = &aml_fe_resource[i]; -- -- if (!strcmp(r->name, name)) -- return r; -- } -- return NULL; --} --#endif /*CONFIG_OF */ --#if (defined CONFIG_AM_DTVDEMOD) --static int rmem_demod_device_init(struct reserved_mem *rmem, struct device *dev) --{ -- unsigned int demod_mem_start; -- unsigned int demod_mem_size; -- -- demod_mem_start = rmem->base; -- demod_mem_size = rmem->size; -- memstart = demod_mem_start; -- pr_info("demod reveser memory 0x%x, size %dMB.\n", -- demod_mem_start, (demod_mem_size >> 20)); -- return 1; --} -- --static void rmem_demod_device_release(struct reserved_mem *rmem, -- struct device *dev) --{ --} -- --static const struct reserved_mem_ops rmem_demod_ops = { -- .device_init = rmem_demod_device_init, -- .device_release = rmem_demod_device_release, --}; -- --static int __init rmem_demod_setup(struct reserved_mem *rmem) --{ -- /* -- * struct cma *cma; -- * int err; -- * pr_info("%s setup.\n",__func__); -- * err = cma_init_reserved_mem(rmem->base, rmem->size, 0, &cma); -- * if (err) { -- * pr_err("Reserved memory: unable to setup CMA region\n"); -- * return err; -- * } -- */ -- rmem->ops = &rmem_demod_ops; -- /* rmem->priv = cma; */ -- -- pr_info -- ("DTV demod reserved memory: %pa, size %ld MiB\n", -- &rmem->base, (unsigned long)rmem->size / SZ_1M); -- -- return 0; --} -- --RESERVEDMEM_OF_DECLARE(demod, "amlogic, demod-mem", rmem_demod_setup); --#endif --static int aml_fe_dev_init(struct aml_dvb *dvb, struct platform_device *pdev, -- enum aml_fe_dev_type_t type, struct aml_fe_dev *dev, -- int id) --{ --#ifndef CONFIG_OF -- struct resource *res; --#endif -- char *name = NULL; -- char buf[32]; -- int ret; -- u32 value; -- const char *str; -- -- switch (type) { -- case AM_DEV_TUNER: -- name = "tuner"; -- break; -- case AM_DEV_ATV_DEMOD: -- name = "atv_demod"; -- break; -- case AM_DEV_DTV_DEMOD: -- name = "dtv_demod"; -- break; -- default: -- break; -- } -- -- pr_dbg("init %s %d pdev: %p\n", name, id, pdev); -- -- snprintf(buf, sizeof(buf), "%s%d", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_string(pdev->dev.of_node, buf, &str); -- if (ret) { -- pr_error("cannot find resource \"%s\"\n", buf); -- return 0; -- } else { -- struct aml_fe_drv **list = aml_get_fe_drv_list(type); -- struct aml_fe_drv *drv; -- unsigned long flags; -- -- spin_lock_irqsave(&lock, flags); -- -- for (drv = *list; drv; drv = drv->next) -- if (!strcmp(drv->name, str)) -- break; -- -- if (dev->drv != drv) { -- if (dev->drv) { -- dev->drv->ref--; -- if (dev->drv->owner) -- module_put(dev->drv->owner); -- } -- if (drv) { -- drv->ref++; -- if (drv->owner) -- try_module_get(drv->owner); -- } -- dev->drv = drv; -- } -- -- spin_unlock_irqrestore(&lock, flags); -- -- if (drv) { -- pr_inf("found %s%d driver: %s\n", name, id, str); -- } else { -- pr_err("cannot find %s%d driver: %s\n", name, id, str); -- return -1; -- } -- } -- --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- struct aml_fe_drv **list = aml_get_fe_drv_list(type); -- struct aml_fe_drv *drv; -- int type = res->start; -- unsigned long flags; -- -- spin_lock_irqsave(&lock, flags); -- -- for (drv = *list; drv; drv = drv->next) { -- if (drv->id == type) { -- drv->ref++; -- if (drv->owner) -- try_module_get(drv->owner); -- break; -- } -- } -- -- spin_unlock_irqrestore(&lock, flags); -- -- if (drv) { -- dev->drv = drv; -- } else { -- pr_error("cannot find %s%d driver: %d\n", name, id, -- type); -- return -1; -- } -- } else { -- pr_dbg("cannot find resource \"%s\"\n", buf); -- return 0; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "%s%d_i2c_adap_id", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- dev->i2c_adap_id = value; -- dev->i2c_adap = i2c_get_adapter(value); -- pr_inf("%s: %d[%p]\n", buf, dev->i2c_adap_id, dev->i2c_adap); -- } else { -- dev->i2c_adap_id = -1; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int adap = res->start; -- -- dev->i2c_adap_id = adap; -- dev->i2c_adap = i2c_get_adapter(adap); -- } else { -- dev->i2c_adap_id = -1; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "%s%d_i2c_addr", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- dev->i2c_addr = value; -- pr_inf("%s: %d\n", buf, dev->i2c_addr); -- } else { -- dev->i2c_addr = -1; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int addr = res->start; -- -- dev->i2c_addr = addr; -- pr_inf("%s: %d\n", buf, dev->i2c_addr); -- } else { -- dev->i2c_addr = -1; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#endif -- -- snprintf(buf, sizeof(buf), "%s%d_reset_gpio", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_string(pdev->dev.of_node, buf, &str); -- if (!ret) { -- dev->reset_gpio = -- desc_to_gpio(of_get_named_gpiod_flags(pdev->dev.of_node, -- buf, 0, NULL)); -- pr_inf("%s: %s\n", buf, str); -- } else { -- dev->reset_gpio = -1; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int gpio = res->start; -- -- dev->reset_gpio = gpio; -- pr_inf("%s: %x\n", buf, gpio); -- } else { -- dev->reset_gpio = -1; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "%s%d_reset_value", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- dev->reset_value = value; -- pr_inf("%s: %d\n", buf, dev->reset_value); -- } else { -- dev->reset_value = -1; -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int v = res->start; -- -- dev->reset_value = v; -- pr_inf("%s: %d\n", buf, dev->reset_value); -- } else { -- dev->reset_value = 0; -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "%s%d_tunerpower", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_string(pdev->dev.of_node, buf, &str); -- if (!ret) { -- dev->tuner_power_gpio = -- desc_to_gpio(of_get_named_gpiod_flags(pdev->dev.of_node, -- buf, 0, NULL)); -- pr_inf("%s: %s\n", buf, str); -- } else { -- dev->tuner_power_gpio = -1; -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int gpio = res->start; -- -- dev->tuner_power_gpio = gpio; -- } else { -- dev->tuner_power_gpio = -1; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "%s%d_lnbpower", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_string(pdev->dev.of_node, buf, &str); -- if (!ret) { -- dev->lnb_power_gpio = -- desc_to_gpio(of_get_named_gpiod_flags(pdev->dev.of_node, -- buf, 0, NULL)); -- pr_inf("%s: %s\n", buf, str); -- } else { -- dev->lnb_power_gpio = -1; -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int gpio = res->start; -- -- dev->lnb_power_gpio = gpio; -- } else { -- dev->lnb_power_gpio = -1; -- } --#endif -- -- snprintf(buf, sizeof(buf), "%s%d_antoverload", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_string(pdev->dev.of_node, buf, &str); -- if (!ret) { -- dev->antoverload_gpio = -- desc_to_gpio(of_get_named_gpiod_flags(pdev->dev.of_node, -- buf, 0, NULL)); -- pr_inf("%s: %s\n", buf, str); -- } else { -- dev->antoverload_gpio = -1; -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int gpio = res->start; -- -- dev->antoverload_gpio = gpio; -- } else { -- dev->antoverload_gpio = -1; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "%s%d_spectrum", name, id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- dev->spectrum = value; -- pr_inf("%s: %d\n", buf, value); -- } else { -- dev->spectrum = 2; -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int spectrum = res->start; -- -- dev->spectrum = spectrum; -- } else { -- dev->spectrum = 0; -- } --#endif -- -- --#ifdef CONFIG_OF -- dev->mem_start = memstart; --#endif -- -- if (dev->drv->init) { -- ret = dev->drv->init(dev); -- if (ret != 0) { -- dev->drv = NULL; -- pr_error("[aml_fe..]%s error.\n", __func__); -- return ret; -- } -- } -- -- return 0; --} -- --static int aml_fe_dev_release(struct aml_dvb *dvb, enum aml_fe_dev_type_t type, -- struct aml_fe_dev *dev) --{ -- if (dev->drv) { -- if (dev->drv->owner) -- module_put(dev->drv->owner); -- dev->drv->ref--; -- if (dev->drv->release) -- dev->drv->release(dev); -- } -- -- dev->drv = NULL; -- return 0; --} -- --static void aml_fe_man_run(struct aml_dvb *dvb, struct aml_fe *fe) --{ -- int tuner_cap = 0xFFFFFFFF; -- int demod_cap = 0; -- -- if (fe->init) -- return; -- -- if (fe->tuner && fe->tuner->drv) { -- tuner_cap = fe->tuner->drv->capability; -- fe->init = 1; -- } -- -- if (fe->atv_demod && fe->atv_demod->drv) { -- demod_cap |= fe->atv_demod->drv->capability; -- fe->init = 1; -- } -- -- if (fe->dtv_demod && fe->dtv_demod->drv) { -- demod_cap |= fe->dtv_demod->drv->capability; -- fe->init = 1; -- } -- -- if (fe->init) { -- int reg = 1; -- int ret; -- int id; -- -- spin_lock_init(&fe->slock); -- fe->mode = AM_FE_UNKNOWN; -- fe->capability = (tuner_cap & demod_cap); -- pr_dbg("fe: %p cap: %x tuner: %x demod: %x\n", fe, -- fe->capability, tuner_cap, demod_cap); -- -- for (id = 0; id < FE_DEV_COUNT; id++) { -- struct aml_fe *prev_fe = &fe_man.fe[id]; -- -- if (prev_fe == fe) -- continue; -- if (prev_fe->init && (prev_fe->dev_id == fe->dev_id)) { -- reg = 0; -- break; -- } -- } -- fe->fe = &fe_man.dev[fe->dev_id]; -- if (reg) { -- fe->fe->demodulator_priv = fe; -- fe->fe->ops.set_mode = aml_fe_set_mode; -- fe->fe->ops.read_ts = aml_fe_read_ts; -- -- ret = dvb_register_frontend(&dvb->dvb_adapter, fe->fe); -- if (ret) { -- pr_error("register fe%d failed\n", fe->dev_id); -- return; -- } -- } -- -- if (fe->tuner) -- fe->tuner->fe = fe; -- if (fe->atv_demod) -- fe->atv_demod->fe = fe; -- if (fe->dtv_demod) -- fe->dtv_demod->fe = fe; -- } --} -- --static int aml_fe_man_init(struct aml_dvb *dvb, struct platform_device *pdev, -- struct aml_fe *fe, int id) --{ --#ifndef CONFIG_OF -- struct resource *res; --#endif -- char buf[32]; -- u32 value; -- int ret; -- -- snprintf(buf, sizeof(buf), "fe%d_tuner", id); -- --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- int id = value; -- if ((id < 0) || (id >= FE_DEV_COUNT) || !fe_man.tuner[id].drv) { -- pr_error("invalid tuner device id %d\n", id); -- return -1; -- } -- -- fe->tuner = &fe_man.tuner[id]; -- -- pr_dbg("%s: %d\n", buf, id); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int id = res->start; -- if ((id < 0) || (id >= FE_DEV_COUNT) || !fe_man.tuner[id].drv) { -- pr_error("invalid tuner device id %d\n", id); -- return -1; -- } -- -- fe->tuner = &fe_man.tuner[id]; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "fe%d_atv_demod", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- int id = value; -- if ((id < 0) || (id >= FE_DEV_COUNT) -- || !fe_man.atv_demod[id].drv) { -- pr_error("invalid ATV demod device id %d\n", id); -- return -1; -- } -- -- fe->atv_demod = &fe_man.atv_demod[id]; -- pr_dbg("%s: %d\n", buf, id); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int id = res->start; -- if ((id < 0) || (id >= FE_DEV_COUNT) -- || !fe_man.atv_demod[id].drv) { -- pr_error("invalid ATV demod device id %d\n", id); -- return -1; -- } -- -- fe->atv_demod = &fe_man.atv_demod[id]; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "fe%d_dtv_demod", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- int id = value; -- if ((id < 0) || (id >= FE_DEV_COUNT) -- || !fe_man.dtv_demod[id].drv) { -- pr_error("invalid DTV demod device id %d\n", id); -- return -1; -- } -- -- fe->dtv_demod = &fe_man.dtv_demod[id]; -- pr_dbg("%s: %d\n", buf, id); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int id = res->start; -- -- pr_dbg("[dvb] res->start is %d\n", res->start); -- if ((id < 0) || (id >= FE_DEV_COUNT) -- || !fe_man.dtv_demod[id].drv) { -- pr_error("invalid DTV demod device id %d\n", id); -- return -1; -- } -- -- fe->dtv_demod = &fe_man.dtv_demod[id]; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "fe%d_ts", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- int id = value; -- enum aml_ts_source_t ts = AM_TS_SRC_TS0; -- -- switch (id) { -- case 0: -- ts = AM_TS_SRC_TS0; -- break; -- case 1: -- ts = AM_TS_SRC_TS1; -- break; -- case 2: -- ts = AM_TS_SRC_TS2; -- break; -- default: -- break; -- } -- -- fe->ts = ts; -- pr_dbg("%s: %d\n", buf, id); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int id = res->start; -- enum aml_ts_source_t ts = AM_TS_SRC_TS0; -- -- switch (id) { -- case 0: -- ts = AM_TS_SRC_TS0; -- break; -- case 1: -- ts = AM_TS_SRC_TS1; -- break; -- case 2: -- ts = AM_TS_SRC_TS2; -- break; -- default: -- break; -- } -- -- fe->ts = ts; -- } --#endif /*CONFIG_OF */ -- -- snprintf(buf, sizeof(buf), "fe%d_dev", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(pdev->dev.of_node, buf, &value); -- if (!ret) { -- int id = value; -- -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fe->dev_id = id; -- else -- fe->dev_id = 0; -- pr_dbg("%s: %d\n", buf, fe->dev_id); -- } else { -- fe->dev_id = 0; -- pr_dbg("cannot get resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF */ -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -- if (res) { -- int id = res->start; -- -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fe->dev_id = id; -- else -- fe->dev_id = 0; -- pr_dbg("%s: %d\n", buf, fe->dev_id); -- } else { -- fe->dev_id = 0; -- pr_dbg("cannot get resource \"%s\"\n", buf); -- } --#endif /*CONFIG_OF */ -- -- aml_fe_man_run(dvb, fe); -- -- return 0; --} -- --static int aml_fe_man_release(struct aml_dvb *dvb, struct aml_fe *fe) --{ -- if (fe->init) { -- aml_dmx_register_frontend(fe->ts, NULL); -- dvb_unregister_frontend(fe->fe); -- dvb_frontend_detach(fe->fe); -- -- fe->tuner = NULL; -- fe->atv_demod = NULL; -- fe->dtv_demod = NULL; -- fe->init = 0; -- } -- -- return 0; --} -- --static ssize_t tuner_name_show(struct class *cls, struct class_attribute *attr, -- char *buf) --{ -- size_t len = 0; -- struct aml_fe_drv *drv; -- unsigned long flags; -- -- struct aml_fe_drv **list = aml_get_fe_drv_list(AM_DEV_TUNER); -- -- spin_lock_irqsave(&lock, flags); -- for (drv = *list; drv; drv = drv->next) -- len += sprintf(buf + len, "%s\n", drv->name); -- spin_unlock_irqrestore(&lock, flags); -- return len; --} -- --static ssize_t atv_demod_name_show(struct class *cls, -- struct class_attribute *attr, char *buf) --{ -- size_t len = 0; -- struct aml_fe_drv *drv; -- unsigned long flags; -- -- struct aml_fe_drv **list = aml_get_fe_drv_list(AM_DEV_ATV_DEMOD); -- -- spin_lock_irqsave(&lock, flags); -- for (drv = *list; drv; drv = drv->next) -- len += sprintf(buf + len, "%s\n", drv->name); -- spin_unlock_irqrestore(&lock, flags); -- return len; --} -- --static ssize_t dtv_demod_name_show(struct class *cls, -- struct class_attribute *attr, char *buf) --{ -- size_t len = 0; -- struct aml_fe_drv *drv; -- unsigned long flags; -- -- struct aml_fe_drv **list = aml_get_fe_drv_list(AM_DEV_DTV_DEMOD); -- -- spin_lock_irqsave(&lock, flags); -- for (drv = *list; drv; drv = drv->next) -- len += sprintf(buf + len, "%s\n", drv->name); -- spin_unlock_irqrestore(&lock, flags); -- return len; --} -- --static ssize_t setting_show(struct class *cls, struct class_attribute *attr, -- char *buf) --{ -- int r, total = 0; -- int i; -- struct aml_fe_man *fm = &fe_man; -- -- r = sprintf(buf, "tuner:\n"); -- buf += r; -- total += r; -- for (i = 0; i < FE_DEV_COUNT; i++) { -- struct aml_fe_dev *dev = &fm->tuner[i]; -- if (dev->drv) { -- r = sprintf(buf, -- "\t%d: %s i2s_id: %d i2c_addr: 0x%x reset_gpio: 0x%x reset_level: %d\n", -- i, dev->drv->name, dev->i2c_adap_id, -- dev->i2c_addr, dev->reset_gpio, -- dev->reset_value); -- buf += r; -- total += r; -- } -- } -- -- r = sprintf(buf, "atv_demod:\n"); -- buf += r; -- total += r; -- for (i = 0; i < FE_DEV_COUNT; i++) { -- struct aml_fe_dev *dev = &fm->atv_demod[i]; -- if (dev->drv) { -- r = sprintf(buf, -- "\t%d: %s i2s_id: %d i2c_addr: 0x%x reset_gpio: 0x%x reset_level: %d\n", -- i, dev->drv->name, dev->i2c_adap_id, -- dev->i2c_addr, dev->reset_gpio, -- dev->reset_value); -- buf += r; -- total += r; -- } -- } -- -- r = sprintf(buf, "dtv_demod:\n"); -- buf += r; -- total += r; -- for (i = 0; i < FE_DEV_COUNT; i++) { -- struct aml_fe_dev *dev = &fm->dtv_demod[i]; -- if (dev->drv) { -- r = sprintf(buf, -- "\t%d: %s i2s_id: %d i2c_addr: 0x%x reset_gpio: 0x%x reset_level: %d\n", -- i, dev->drv->name, dev->i2c_adap_id, -- dev->i2c_addr, dev->reset_gpio, -- dev->reset_value); -- buf += r; -- total += r; -- } -- } -- -- r = sprintf(buf, "frontend:\n"); -- buf += r; -- total += r; -- for (i = 0; i < FE_DEV_COUNT; i++) { -- struct aml_fe *fe = &fm->fe[i]; -- -- r = sprintf(buf, -- "\t%d: %s device: %d ts: %d tuner: %s atv_demod: %s dtv_demod: %s\n", -- i, fe->init ? "enabled" : "disabled", fe->dev_id, -- fe->ts, fe->tuner ? fe->tuner->drv->name : "none", -- fe->atv_demod ? fe->atv_demod->drv->name : "none", -- fe->dtv_demod ? fe->dtv_demod->drv->name : "none"); -- buf += r; -- total += r; -- } -- -- return total; --} -- --static void reset_drv(int id, enum aml_fe_dev_type_t type, const char *name) --{ -- struct aml_fe_man *fm = &fe_man; -- struct aml_fe_drv **list; -- struct aml_fe_drv **pdrv; -- struct aml_fe_drv *drv; -- struct aml_fe_drv *old; -- -- if ((id < 0) || (id >= FE_DEV_COUNT)) -- return; -- -- if (fm->fe[id].init) { -- pr_error("cannot reset driver when the device is inused\n"); -- return; -- } -- -- list = aml_get_fe_drv_list(type); -- for (drv = *list; drv; drv = drv->next) -- if (!strcmp(drv->name, name)) -- break; -- -- switch (type) { -- case AM_DEV_TUNER: -- pdrv = &fm->tuner[id].drv; -- break; -- case AM_DEV_ATV_DEMOD: -- pdrv = &fm->atv_demod[id].drv; -- break; -- case AM_DEV_DTV_DEMOD: -- pdrv = &fm->dtv_demod[id].drv; -- break; -- default: -- return; -- } -- -- old = *pdrv; -- if (old == drv) -- return; -- -- if (old) { -- old->ref--; -- if (old->owner) -- module_put(old->owner); -- } -- -- if (drv) { -- drv->ref++; -- if (drv->owner) -- try_module_get(drv->owner); -- } -- -- *pdrv = drv; --} -- --static ssize_t setting_store(struct class *class, struct class_attribute *attr, -- const char *buf, size_t size) --{ -- struct aml_dvb *dvb = aml_get_dvb_device(); -- struct aml_fe_man *fm = &fe_man; -- int id, val; -- char dev_name[32]; -- char gpio_name[32]; -- unsigned long flags; -- -- spin_lock_irqsave(&lock, flags); -- -- if (sscanf(buf, "tuner %i driver %s", &id, dev_name) == 2) { -- reset_drv(id, AM_DEV_TUNER, dev_name); -- } else if (sscanf(buf, "tuner %i i2c_id %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) { -- fm->tuner[id].i2c_adap_id = val; -- fm->tuner[id].i2c_adap = i2c_get_adapter(val); -- } -- } else if (sscanf(buf, "tuner %i i2c_addr %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->tuner[id].i2c_addr = val; --#ifdef CONFIG_OF -- } else if (sscanf(buf, "tuner %i reset_gpio %s", &id, gpio_name) == 2) { -- val = -- desc_to_gpio(of_get_named_gpiod_flags -- (dvb->pdev->dev.of_node, gpio_name, 0, NULL)); --#else -- } else if (sscanf(buf, "tuner %i reset_gpio %i", &id, &val) == 2) { --#endif -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->tuner[id].reset_gpio = val; -- } else if (sscanf(buf, "tuner %i reset_level %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->tuner[id].reset_value = val; -- } else if (sscanf(buf, "atv_demod %i driver %s", &id, dev_name) == 2) { -- reset_drv(id, AM_DEV_ATV_DEMOD, dev_name); -- } else if (sscanf(buf, "atv_demod %i i2c_id %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) { -- fm->atv_demod[id].i2c_adap_id = val; -- fm->dtv_demod[id].i2c_adap = i2c_get_adapter(val); -- } -- } else if (sscanf(buf, "atv_demod %i i2c_addr %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->atv_demod[id].i2c_addr = val; --#ifdef CONFIG_OF -- } else if (sscanf(buf, "atv_demod %i reset_gpio %s", &id, gpio_name) == -- 2) { -- val = -- desc_to_gpio(of_get_named_gpiod_flags -- (dvb->pdev->dev.of_node, gpio_name, 0, NULL)); --#else -- } else if (sscanf(buf, "atv_demod %i reset_gpio %i", &id, &val) == 2) { --#endif -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->atv_demod[id].reset_gpio = val; -- } else if (sscanf(buf, "atv_demod %i reset_level %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->atv_demod[id].reset_value = val; -- } else if (sscanf(buf, "dtv_demod %i driver %s", &id, dev_name) == 2) { -- reset_drv(id, AM_DEV_DTV_DEMOD, dev_name); -- } else if (sscanf(buf, "dtv_demod %i i2c_id %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) { -- fm->dtv_demod[id].i2c_adap_id = val; -- fm->dtv_demod[id].i2c_adap = i2c_get_adapter(val); -- } -- } else if (sscanf(buf, "dtv_demod %i i2c_addr %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->dtv_demod[id].i2c_addr = val; --#ifdef CONFIG_OF -- } else if (sscanf(buf, "dtv_demod %i reset_gpio %s", &id, gpio_name) == -- 2) { -- val = -- desc_to_gpio(of_get_named_gpiod_flags -- (dvb->pdev->dev.of_node, gpio_name, 0, NULL)); --#else -- } else if (sscanf(buf, "dtv_demod %i reset_gpio %i", &id, &val) == 2) { --#endif -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->dtv_demod[id].reset_gpio = val; -- } else if (sscanf(buf, "dtv_demod %i reset_level %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->dtv_demod[id].reset_value = val; -- } else if (sscanf(buf, "frontend %i device %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->fe[id].dev_id = val; -- } else if (sscanf(buf, "frontend %i ts %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- fm->fe[id].ts = val; -- } else if (sscanf(buf, "frontend %i tuner %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT) && (val >= 0) -- && (val < FE_DEV_COUNT) && fm->tuner[val].drv) -- fm->fe[id].tuner = &fm->tuner[val]; -- } else if (sscanf(buf, "frontend %i atv_demod %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT) && (val >= 0) -- && (val < FE_DEV_COUNT) && fm->atv_demod[val].drv) -- fm->fe[id].atv_demod = &fm->atv_demod[val]; -- } else if (sscanf(buf, "frontend %i dtv_demod %i", &id, &val) == 2) { -- if ((id >= 0) && (id < FE_DEV_COUNT) && (val >= 0) -- && (val < FE_DEV_COUNT) && fm->dtv_demod[val].drv) -- fm->fe[id].dtv_demod = &fm->dtv_demod[val]; -- } -- -- spin_unlock_irqrestore(&lock, flags); -- -- if (sscanf(buf, "enable %i", &id) == 1) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- aml_fe_man_run(dvb, &fm->fe[id]); -- } else if (sscanf(buf, "disable %i", &id) == 1) { -- if ((id >= 0) && (id < FE_DEV_COUNT)) -- aml_fe_man_release(dvb, &fm->fe[id]); -- } else if (strstr(buf, "autoload")) { -- for (id = 0; id < FE_DEV_COUNT; id++) { -- aml_fe_dev_init(dvb, fm->pdev, AM_DEV_TUNER, -- &fm->tuner[id], id); -- aml_fe_dev_init(dvb, fm->pdev, AM_DEV_ATV_DEMOD, -- &fm->atv_demod[id], id); -- aml_fe_dev_init(dvb, fm->pdev, AM_DEV_DTV_DEMOD, -- &fm->dtv_demod[id], id); -- } -- -- for (id = 0; id < FE_DEV_COUNT; id++) -- aml_fe_man_init(dvb, fm->pdev, &fm->fe[id], id); -- } else if (strstr(buf, "disableall")) { -- for (id = 0; id < FE_DEV_COUNT; id++) -- aml_fe_man_release(dvb, &fm->fe[id]); -- -- for (id = 0; id < FE_DEV_COUNT; id++) { -- aml_fe_dev_release(dvb, AM_DEV_DTV_DEMOD, -- &fm->dtv_demod[id]); -- aml_fe_dev_release(dvb, AM_DEV_ATV_DEMOD, -- &fm->atv_demod[id]); -- aml_fe_dev_release(dvb, AM_DEV_TUNER, &fm->tuner[id]); -- } -- } -- -- return size; --} -- --static ssize_t aml_fe_show_suspended_flag(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- ssize_t ret = 0; -- -- ret = sprintf(buf, "%ld\n", aml_fe_suspended); -- -- return ret; --} -- --static ssize_t aml_fe_store_suspended_flag(struct class *class, -- struct class_attribute *attr, -- const char *buf, size_t size) --{ -- /*aml_fe_suspended = simple_strtol(buf, 0, 0); */ -- int ret = kstrtol(buf, 0, &aml_fe_suspended); -- -- if (ret) -- return ret; -- return size; --} -- --static struct class_attribute aml_fe_cls_attrs[] = { -- __ATTR(tuner_name, -- S_IRUGO | S_IWUSR, -- tuner_name_show, NULL), -- __ATTR(atv_demod_name, -- S_IRUGO | S_IWUSR, -- atv_demod_name_show, NULL), -- __ATTR(dtv_demod_name, -- S_IRUGO | S_IWUSR, -- dtv_demod_name_show, NULL), -- __ATTR(setting, -- S_IRUGO | S_IWUSR, -- setting_show, setting_store), -- __ATTR(aml_fe_suspended_flag, -- S_IRUGO | S_IWUSR, -- aml_fe_show_suspended_flag, -- aml_fe_store_suspended_flag), -- __ATTR_NULL --}; -- --static struct class aml_fe_class = { -- .name = "amlfe", -- .class_attrs = aml_fe_cls_attrs, --}; -- --static int aml_fe_probe(struct platform_device *pdev) --{ -- struct aml_dvb *dvb = aml_get_dvb_device(); -- int i; -- -- of_reserved_mem_device_init(&pdev->dev); -- for (i = 0; i < FE_DEV_COUNT; i++) { -- if (aml_fe_dev_init -- (dvb, pdev, AM_DEV_TUNER, &fe_man.tuner[i], i) < 0) -- goto probe_end; -- if (aml_fe_dev_init -- (dvb, pdev, AM_DEV_ATV_DEMOD, &fe_man.atv_demod[i], i) < 0) -- goto probe_end; -- if (aml_fe_dev_init -- (dvb, pdev, AM_DEV_DTV_DEMOD, &fe_man.dtv_demod[i], i) < 0) -- goto probe_end; -- } -- -- for (i = 0; i < FE_DEV_COUNT; i++) -- if (aml_fe_man_init(dvb, pdev, &fe_man.fe[i], i) < 0) -- goto probe_end; -- -- probe_end: -- -- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_MG9TV) -- INIT_WORK(&dvb->aml_fe_wq, -- (void (*)(struct work_struct *))aml_fe_do_work); -- -- --#ifdef CONFIG_OF -- fe_man.pinctrl = devm_pinctrl_get_select_default(&pdev->dev); --#endif -- -- platform_set_drvdata(pdev, &fe_man); -- -- if (class_register(&aml_fe_class) < 0) -- pr_error("[aml_fe..] register class error\n"); -- -- fe_man.pdev = pdev; -- -- pr_dbg("[aml_fe..] probe ok.\n"); -- -- return 0; --} -- --static int aml_fe_remove(struct platform_device *pdev) --{ -- struct aml_fe_man *fe_man = platform_get_drvdata(pdev); -- struct aml_dvb *dvb = aml_get_dvb_device(); -- int i; -- -- if (fe_man) { -- platform_set_drvdata(pdev, NULL); -- for (i = 0; i < FE_DEV_COUNT; i++) -- aml_fe_man_release(dvb, &fe_man->fe[i]); -- for (i = 0; i < FE_DEV_COUNT; i++) { -- aml_fe_dev_release(dvb, AM_DEV_DTV_DEMOD, -- &fe_man->dtv_demod[i]); -- aml_fe_dev_release(dvb, AM_DEV_ATV_DEMOD, -- &fe_man->atv_demod[i]); -- aml_fe_dev_release(dvb, AM_DEV_TUNER, -- &fe_man->tuner[i]); -- } -- -- if (fe_man->pinctrl) -- devm_pinctrl_put(fe_man->pinctrl); -- } -- -- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_MG9TV) -- cancel_work_sync(&dvb->aml_fe_wq); -- -- class_unregister(&aml_fe_class); -- -- return 0; --} -- --static int aml_fe_suspend(struct platform_device *dev, pm_message_t state) --{ -- int i; -- -- for (i = 0; i < FE_DEV_COUNT; i++) { -- struct aml_fe *fe = &fe_man.fe[i]; -- -- if (fe->tuner && fe->tuner->drv && fe->tuner->drv->suspend) -- fe->tuner->drv->suspend(fe->tuner); -- -- if (fe->atv_demod && fe->atv_demod->drv -- && fe->atv_demod->drv->suspend) -- fe->atv_demod->drv->suspend(fe->atv_demod); -- -- if (fe->dtv_demod && fe->dtv_demod->drv -- && fe->dtv_demod->drv->suspend) -- fe->dtv_demod->drv->suspend(fe->dtv_demod); -- } -- -- aml_fe_suspended = 1; -- -- return 0; --} -- --static int aml_fe_resume(struct platform_device *dev) --{ -- int i; -- -- for (i = 0; i < FE_DEV_COUNT; i++) { -- struct aml_fe *fe = &fe_man.fe[i]; -- -- if (fe->tuner && fe->tuner->drv && fe->tuner->drv->resume) -- fe->tuner->drv->resume(fe->tuner); -- if (fe->atv_demod && fe->atv_demod->drv -- && fe->atv_demod->drv->resume) -- fe->atv_demod->drv->resume(fe->atv_demod); -- -- if (fe->dtv_demod && fe->dtv_demod->drv -- && fe->dtv_demod->drv->resume) -- fe->dtv_demod->drv->resume(fe->dtv_demod); -- } -- -- return 0; --} -- --#ifdef CONFIG_OF --static const struct of_device_id aml_fe_dt_match[] = { -- { -- .compatible = "amlogic, dvbfe", -- }, -- {}, --}; --#endif /*CONFIG_OF */ -- --static struct platform_driver aml_fe_driver = { -- .probe = aml_fe_probe, -- .remove = aml_fe_remove, -- .suspend = aml_fe_suspend, -- .resume = aml_fe_resume, -- .driver = { -- .name = "amlogic-dvb-fe", -- .owner = THIS_MODULE, --#ifdef CONFIG_OF -- .of_match_table = aml_fe_dt_match, --#endif -- } --}; -- --const char *audmode_to_str(unsigned short audmode) --{ -- /* switch(audmode) -- * { -- * case V4L2_TUNER_AUDMODE_NULL: -- * return "V4L2_TUNER_AUDMODE_NULL"; -- * break; -- * case V4L2_TUNER_MODE_MONO: -- * return "V4L2_TUNER_MODE_MONO"; -- * break; -- * case V4L2_TUNER_MODE_STEREO: -- * return "V4L2_TUNER_MODE_STEREO"; -- * break; -- * case V4L2_TUNER_MODE_LANG2: -- * return "V4L2_TUNER_MODE_LANG2"; -- * break; -- * case V4L2_TUNER_MODE_SAP: -- * return "V4L2_TUNER_MODE_SAP"; -- * break; -- * case V4L2_TUNER_SUB_LANG1: -- * return "V4L2_TUNER_SUB_LANG1"; -- * break; -- * case V4L2_TUNER_MODE_LANG1_LANG2: -- * return "V4L2_TUNER_MODE_LANG1_LANG2"; -- * break; -- * default: -- * return "NO AUDMODE"; -- * break; -- * } */ -- return 0; --} --EXPORT_SYMBOL(audmode_to_str); -- --const char *soundsys_to_str(unsigned short sys) --{ -- /*switch(sys){ -- * case V4L2_TUNER_SYS_NULL: -- * return "V4L2_TUNER_SYS_NULL"; -- * break; -- * case V4L2_TUNER_SYS_A2_BG: -- * return "V4L2_TUNER_SYS_A2_BG"; -- * break; -- * case V4L2_TUNER_SYS_A2_DK1: -- * return "V4L2_TUNER_SYS_A2_DK1"; -- * break; -- * case V4L2_TUNER_SYS_A2_DK2: -- * return "V4L2_TUNER_SYS_A2_DK2"; -- * break; -- * case V4L2_TUNER_SYS_A2_DK3: -- * return "V4L2_TUNER_SYS_A2_DK3"; -- * break; -- * case V4L2_TUNER_SYS_A2_M: -- * return "V4L2_TUNER_SYS_A2_M"; -- * break; -- * case V4L2_TUNER_SYS_NICAM_BG: -- * return "V4L2_TUNER_SYS_NICAM_BG"; -- * break; -- * case V4L2_TUNER_SYS_NICAM_I: -- * return "V4L2_TUNER_SYS_NICAM_I"; -- * break; -- * case V4L2_TUNER_SYS_NICAM_DK: -- * return "V4L2_TUNER_SYS_NICAM_DK"; -- * break; -- * case V4L2_TUNER_SYS_NICAM_L: -- * return "V4L2_TUNER_SYS_NICAM_L"; -- * break; -- * case V4L2_TUNER_SYS_EIAJ: -- * return "V4L2_TUNER_SYS_EIAJ"; -- * break; -- * case V4L2_TUNER_SYS_BTSC: -- * return "V4L2_TUNER_SYS_BTSC"; -- * break; -- * case V4L2_TUNER_SYS_FM_RADIO: -- * return "V4L2_TUNER_SYS_FM_RADIO"; -- * break; -- * default: -- * return "NO SOUND SYS"; -- * break; -- * } */ -- return 0; --} --EXPORT_SYMBOL(soundsys_to_str); -- --const char *v4l2_std_to_str(v4l2_std_id std) --{ -- switch (std) { -- case V4L2_STD_PAL_B: -- return "V4L2_STD_PAL_B"; -- break; -- case V4L2_STD_PAL_B1: -- return "V4L2_STD_PAL_B1"; -- break; -- case V4L2_STD_PAL_G: -- return "V4L2_STD_PAL_G"; -- break; -- case V4L2_STD_PAL_H: -- return "V4L2_STD_PAL_H"; -- break; -- case V4L2_STD_PAL_I: -- return "V4L2_STD_PAL_I"; -- break; -- case V4L2_STD_PAL_D: -- return "V4L2_STD_PAL_D"; -- break; -- case V4L2_STD_PAL_D1: -- return "V4L2_STD_PAL_D1"; -- break; -- case V4L2_STD_PAL_K: -- return "V4L2_STD_PAL_K"; -- break; -- case V4L2_STD_PAL_M: -- return "V4L2_STD_PAL_M"; -- break; -- case V4L2_STD_PAL_N: -- return "V4L2_STD_PAL_N"; -- break; -- case V4L2_STD_PAL_Nc: -- return "V4L2_STD_PAL_Nc"; -- break; -- case V4L2_STD_PAL_60: -- return "V4L2_STD_PAL_60"; -- break; -- case V4L2_STD_NTSC_M: -- return "V4L2_STD_NTSC_M"; -- break; -- case V4L2_STD_NTSC_M_JP: -- return "V4L2_STD_NTSC_M_JP"; -- break; -- case V4L2_STD_NTSC_443: -- return "V4L2_STD_NTSC_443"; -- break; -- case V4L2_STD_NTSC_M_KR: -- return "V4L2_STD_NTSC_M_KR"; -- break; -- case V4L2_STD_SECAM_B: -- return "V4L2_STD_SECAM_B"; -- break; -- case V4L2_STD_SECAM_D: -- return "V4L2_STD_SECAM_D"; -- break; -- case V4L2_STD_SECAM_G: -- return "V4L2_STD_SECAM_G"; -- break; -- case V4L2_STD_SECAM_H: -- return "V4L2_STD_SECAM_H"; -- break; -- case V4L2_STD_SECAM_K: -- return "V4L2_STD_SECAM_K"; -- break; -- case V4L2_STD_SECAM_K1: -- return "V4L2_STD_SECAM_K1"; -- break; -- case V4L2_STD_SECAM_L: -- return "V4L2_STD_SECAM_L"; -- break; -- case V4L2_STD_SECAM_LC: -- return "V4L2_STD_SECAM_LC"; -- break; -- case V4L2_STD_ATSC_8_VSB: -- return "V4L2_STD_ATSC_8_VSB"; -- break; -- case V4L2_STD_ATSC_16_VSB: -- return "V4L2_STD_ATSC_16_VSB"; -- break; -- case V4L2_COLOR_STD_PAL: -- return "V4L2_COLOR_STD_PAL"; -- break; -- case V4L2_COLOR_STD_NTSC: -- return "V4L2_COLOR_STD_NTSC"; -- break; -- case V4L2_COLOR_STD_SECAM: -- return "V4L2_COLOR_STD_SECAM"; -- break; -- case V4L2_STD_MN: -- return "V4L2_STD_MN"; -- break; -- case V4L2_STD_B: -- return "V4L2_STD_B"; -- break; -- case V4L2_STD_GH: -- return "V4L2_STD_GH"; -- break; -- case V4L2_STD_DK: -- return "V4L2_STD_DK"; -- break; -- case V4L2_STD_PAL_BG: -- return "V4L2_STD_PAL_BG"; -- break; -- case V4L2_STD_PAL_DK: -- return "V4L2_STD_PAL_DK"; -- break; -- case V4L2_STD_PAL: -- return "V4L2_STD_PAL"; -- break; -- case V4L2_STD_NTSC: -- return "V4L2_STD_NTSC"; -- break; -- case V4L2_STD_SECAM_DK: -- return "V4L2_STD_SECAM_DK"; -- break; -- case V4L2_STD_SECAM: -- return "V4L2_STD_SECAM"; -- break; -- case V4L2_STD_525_60: -- return "V4L2_STD_525_60"; -- break; -- case V4L2_STD_625_50: -- return "V4L2_STD_625_50"; -- break; -- case V4L2_STD_ATSC: -- return "V4L2_STD_ATSC"; -- break; -- case V4L2_STD_ALL: -- return "V4L2_STD_ALL"; -- break; -- default: -- return "V4L2_STD_UNKNOWN"; -- break; -- } --} --EXPORT_SYMBOL(v4l2_std_to_str); -- --const char *fe_type_to_str(fe_type_t type) --{ -- switch (type) { -- case FE_QPSK: -- return "FE_QPSK"; -- break; -- case FE_QAM: -- return "FE_QAM"; -- break; -- case FE_OFDM: -- return "FE_OFDM"; -- break; -- case FE_ATSC: -- return "FE_ATSC"; -- break; -- case FE_ANALOG: -- return "FE_ANALOG"; -- break; -- case FE_ISDBT: -- return "FE_ISDBT"; -- break; -- case FE_DTMB: -- return "FE_DTMB"; -- break; -- default: -- return "UNKONW TYPE"; -- break; -- } --} --EXPORT_SYMBOL(fe_type_to_str); -- --static int __init aml_fe_init(void) --{ -- return platform_driver_register(&aml_fe_driver); --} -- --static void __exit aml_fe_exit(void) --{ -- platform_driver_unregister(&aml_fe_driver); --} -- --module_init(aml_fe_init); --module_exit(aml_fe_exit); -- --MODULE_DESCRIPTION("amlogic frontend driver"); --MODULE_AUTHOR("L+#= +0=1"); -diff --git a/drivers/amlogic/dvb_tv/aml_fe.h b/drivers/amlogic/dvb_tv/aml_fe.h -deleted file mode 100644 -index 62a06cd..0000000 ---- a/drivers/amlogic/dvb_tv/aml_fe.h -+++ /dev/null -@@ -1,206 +0,0 @@ --#ifndef _AML_FE_H_ --#define _AML_FE_H_ -- -- --#include --#include --#include --#include -- --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#ifdef CONFIG_HAS_EARLYSUSPEND --#include --#endif -- --#include "drivers/media/dvb-core/dvbdev.h" --#include "drivers/media/dvb-core/demux.h" --#include "drivers/media/dvb-core/dvb_demux.h" --#include "drivers/media/dvb-core/dmxdev.h" --#include "drivers/media/dvb-core/dvb_filter.h" --#include "drivers/media/dvb-core/dvb_net.h" --#include "drivers/media/dvb-core/dvb_ringbuffer.h" --#include "drivers/media/dvb-core/dvb_frontend.h" --#include "aml_dvb.h" --#include "linux/videodev2.h" -- --#include -- --#include --#include --#include --#include --#include -- --enum aml_fe_mode_t { -- AM_FE_UNKNOWN = 0, -- AM_FE_QPSK = 1, -- AM_FE_QAM = 2, -- AM_FE_OFDM = 4, -- AM_FE_ATSC = 8, -- AM_FE_ANALOG = 16, -- AM_FE_DTMB = 32, -- AM_FE_ISDBT = 64 --}; -- --#define AM_FE_DTV_MASK (AM_FE_QPSK | AM_FE_QAM | AM_FE_OFDM | \ -- AM_FE_ATSC | AM_FE_DTMB | AM_FE_ISDBT) -- --enum aml_tuner_type_t { -- AM_TUNER_SI2176 = 1, -- AM_TUNER_SI2196 = 2, -- AM_TUNER_FQ1216 = 3, -- AM_TUNER_HTM = 4, -- AM_TUNER_CTC703 = 5, -- AM_TUNER_SI2177 = 6, -- AM_TUNER_R840 = 7, -- AM_TUNER_SI2157 = 8, -- AM_TUNER_SI2151 = 9, -- AM_TUNER_MXL661 = 10 --}; -- --enum aml_atv_demod_type_t { -- AM_ATV_DEMOD_SI2176 = 1, -- AM_ATV_DEMOD_SI2196 = 2, -- AM_ATV_DEMOD_FQ1216 = 3, -- AM_ATV_DEMOD_HTM = 4, -- AM_ATV_DEMOD_CTC703 = 5, -- AM_ATV_DEMOD_SI2177 = 6, -- AM_ATV_DEMOD_AML = 7, -- AM_ATV_DEMOD_R840 = 8 --}; -- --enum aml_dtv_demod_type_t { -- AM_DTV_DEMOD_M1 = 0, -- AM_DTV_DEMOD_SI2176 = 1, -- AM_DTV_DEMOD_MXL101 = 2, -- AM_DTV_DEMOD_SI2196 = 3, -- AM_DTV_DEMOD_AVL6211 = 4, -- AM_DTV_DEMOD_SI2168 = 5, -- AM_DTV_DEMOD_ITE9133 = 6, -- AM_DTV_DEMOD_ITE9173 = 7, -- AM_DTV_DEMOD_DIB8096 = 8, -- AM_DTV_DEMOD_ATBM8869 = 9, -- AM_DTV_DEMOD_MXL241 = 10, -- AM_DTV_DEMOD_AVL68xx = 11, -- AM_DTV_DEMOD_MXL683 = 12 --}; -- --enum aml_fe_dev_type_t { -- AM_DEV_TUNER, -- AM_DEV_ATV_DEMOD, -- AM_DEV_DTV_DEMOD --}; -- --struct aml_fe_dev; --struct aml_fe; --struct aml_fe_drv { -- struct module *owner; -- struct aml_fe_drv *next; -- enum aml_tuner_type_t id; -- char *name; -- int capability; -- int (*init)(struct aml_fe_dev *dev); -- int (*release)(struct aml_fe_dev *dev); -- int (*resume)(struct aml_fe_dev *dev); -- int (*suspend)(struct aml_fe_dev *dev); -- int (*get_ops)(struct aml_fe_dev *dev, int mode, -- void *ops); -- int (*enter_mode)(struct aml_fe *fe, int mode); -- int (*leave_mode)(struct aml_fe *fe, int mode); -- int ref; --}; -- --struct aml_fe_dev { -- /*point to parent aml_fe */ -- struct aml_fe *fe; -- int i2c_adap_id; -- int i2c_addr; -- struct i2c_adapter *i2c_adap; -- int reset_gpio; -- int reset_value; -- struct aml_fe_drv *drv; -- wait_queue_head_t lock_wq; -- void *priv_data; -- -- /*for tuner power control */ -- int tuner_power_gpio; -- /*for dtv dvbsx lnb power control */ -- int lnb_power_gpio; -- /*for ant overload control, */ -- /*it possible in dtv dvbsx and depond on fe hw */ -- int antoverload_gpio; -- -- /*for mem reserved*/ -- int mem_start; -- int mem_end; -- -- /*for dtv spectrum*/ -- int spectrum; --}; --struct aml_demod_param { -- /*for tuner video if to amlatvdemod*/ -- unsigned int if_freq; /*HZ*/ -- /*for tuner output*/ -- unsigned int if_inv; --}; -- --struct aml_fe { -- struct dvb_frontend *fe; --#ifdef CONFIG_HAS_EARLYSUSPEND -- struct early_suspend es; --#endif /*CONFIG_HAS_EARLYSUSPEND */ -- spinlock_t slock; -- int init; -- int mode; -- int dev_id; -- int capability; -- enum aml_ts_source_t ts; -- struct aml_demod_param demod_param; -- struct aml_fe_dev *tuner; -- struct aml_fe_dev *atv_demod; -- struct aml_fe_dev *dtv_demod; -- /*struct dvb_frontend_parameters params;*/ -- struct dtv_frontend_properties params; --}; -- --struct aml_fe_man { -- struct aml_fe fe[FE_DEV_COUNT]; -- struct aml_fe_dev tuner[FE_DEV_COUNT]; -- struct aml_fe_dev atv_demod[FE_DEV_COUNT]; -- struct aml_fe_dev dtv_demod[FE_DEV_COUNT]; -- struct dvb_frontend dev[FE_DEV_COUNT]; -- struct pinctrl *pinctrl; -- struct platform_device *pdev; --}; -- --extern int aml_register_fe_drv(enum aml_fe_dev_type_t type, -- struct aml_fe_drv *drv); --extern int aml_unregister_fe_drv(enum aml_fe_dev_type_t type, -- struct aml_fe_drv *drv); -- --extern struct dvb_frontend *get_si2177_tuner(void); --extern const char *soundsys_to_str(unsigned short soundsys); --extern const char *audmode_to_str(unsigned short soundsys); --extern const char *v4l2_std_to_str(v4l2_std_id std); --extern const char *fe_type_to_str(enum fe_type type); -- --extern int amlogic_gpio_name_map_num(const char *name); --extern int amlogic_gpio_direction_output(unsigned int pin, int value, -- const char *owner); --extern int amlogic_gpio_request(unsigned int pin, const char *label); -- --/* vdac ctrl,adc/dac ref signal,cvbs out signal -- * module index: atv demod:0x01; dtv demod:0x02; tvafe:0x4; dac:0x8 --*/ --extern void vdac_enable(bool on, unsigned int module_sel); --extern void set_aft_thread_enable(int enable); --#endif /*_AML_FE_H_*/ -diff --git a/drivers/amlogic/dvb_tv/amlatvdemod/Makefile b/drivers/amlogic/dvb_tv/amlatvdemod/Makefile -deleted file mode 100644 -index 8a773c9..0000000 ---- a/drivers/amlogic/dvb_tv/amlatvdemod/Makefile -+++ /dev/null -@@ -1,7 +0,0 @@ --obj-$(CONFIG_AM_ATVDEMOD) += atvdemod_fe.o -- --atvdemod_fe-objs =atvdemod_func.o atvdemod_frontend.o -- --ccflags-y += -I. --ccflags-y += -Idrivers/media/dvb-core -- -diff --git a/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_frontend.c b/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_frontend.c -deleted file mode 100644 -index dd06e24..0000000 ---- a/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_frontend.c -+++ /dev/null -@@ -1,760 +0,0 @@ --/* -- * Silicon labs atvdemod Device Driver -- * -- * Author: dezhi.kong -- * -- * -- * Copyright (C) 2014 Amlogic Inc. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- */ -- --/* Standard Liniux Headers */ --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --/* Amlogic Headers */ -- --/* Local Headers */ --#include "atvdemod_func.h" --#include "../aml_fe.h" --#include --#include -- --#define ATVDEMOD_DEVICE_NAME "amlatvdemod" --#define ATVDEMOD_DRIVER_NAME "amlatvdemod" --#define ATVDEMOD_MODULE_NAME "amlatvdemod" --#define ATVDEMOD_CLASS_NAME "amlatvdemod" -- --struct amlatvdemod_device_s *amlatvdemod_devp; --#define AMLATVDEMOD_VER "Ref.2015/09/01a" -- --static int afc_wave_cnt; --static int last_frq, last_std; -- --unsigned int reg_23cf = 0x88188832; /*IIR filter*/ --module_param(reg_23cf, uint, 0664); --MODULE_PARM_DESC(reg_23cf, "\n reg_23cf\n"); -- --unsigned int atvdemod_scan_mode = 0; /*IIR filter*/ --module_param(atvdemod_scan_mode, uint, 0664); --MODULE_PARM_DESC(atvdemod_scan_mode, "\n atvdemod_scan_mode\n"); -- --int is_atvdemod_scan_mode(void) --{ -- return atvdemod_scan_mode; --} --EXPORT_SYMBOL(is_atvdemod_scan_mode); -- --static int aml_atvdemod_enter_mode(struct aml_fe *fe, int mode); --/*static void sound_store(const char *buff, v4l2_std_id *std);*/ --static ssize_t aml_atvdemod_store(struct class *cls, -- struct class_attribute *attr, const char *buf, -- size_t count) --{ -- int n = 0; -- unsigned int ret = 0; -- char *buf_orig, *ps, *token; -- char *parm[4]; -- unsigned int data_snr[128]; -- unsigned int data_snr_avg; -- int data_afc, block_addr, block_reg, block_val = 0; -- int i, val = 0; -- unsigned long tmp = 0; -- struct aml_fe *atvdemod_fe = NULL; -- buf_orig = kstrdup(buf, GFP_KERNEL); -- ps = buf_orig; -- block_addr = 0; -- block_reg = 0; -- while (1) { -- token = strsep(&ps, "\n"); -- if (token == NULL) -- break; -- if (*token == '\0') -- continue; -- parm[n++] = token; -- } -- if (!strncmp(parm[0], "init", strlen("init"))) { -- ret = aml_atvdemod_enter_mode(atvdemod_fe, 0); -- if (ret) -- pr_info("[tuner..] atv_restart error.\n"); -- } else if (!strcmp(parm[0], "tune")) { -- /* val = simple_strtol(parm[1], NULL, 10);*/ -- } else if (!strcmp(parm[0], "set")) { -- if (!strncmp(parm[1], "avout_gain", strlen("avout_gain"))) { -- if (kstrtoul(buf+strlen("avout_offset")+1, 10, -- &tmp) == 0) -- val = tmp; -- atv_dmd_wr_byte(0x0c, 0x01, val&0xff); -- } else if (!strncmp(parm[1], "avout_offset", -- strlen("avout_offset"))) { -- if (kstrtoul(buf+strlen("avout_offset")+1, 10, -- &tmp) == 0) -- val = tmp; -- atv_dmd_wr_byte(0x0c, 0x04, val&0xff); -- } else if (!strncmp(parm[1], "atv_gain", strlen("atv_gain"))) { -- if (kstrtoul(buf+strlen("atv_gain")+1, 10, &tmp) == 0) -- val = tmp; -- atv_dmd_wr_byte(0x19, 0x01, val&0xff); -- } else if (!strncmp(parm[1], "atv_offset", -- strlen("atv_offset"))) { -- if (kstrtoul(buf+strlen("atv_offset")+1, 10, -- &tmp) == 0) -- val = tmp; -- atv_dmd_wr_byte(0x19, 0x04, val&0xff); -- } -- } else if (!strcmp(parm[0], "get")) { -- if (!strncmp(parm[1], "avout_gain", strlen("avout_gain"))) { -- val = atv_dmd_rd_byte(0x0c, 0x01); -- pr_dbg("avout_gain:0x%x\n", val); -- } else if (!strncmp(parm[1], "avout_offset", -- strlen("avout_offset"))) { -- val = atv_dmd_rd_byte(0x0c, 0x04); -- pr_dbg("avout_offset:0x%x\n", val); -- } else if (!strncmp(parm[1], "atv_gain", strlen("atv_gain"))) { -- val = atv_dmd_rd_byte(0x19, 0x01); -- pr_dbg("atv_gain:0x%x\n", val); -- } else if (!strncmp(parm[1], "atv_offset", -- strlen("atv_offset"))) { -- val = atv_dmd_rd_byte(0x19, 0x04); -- pr_dbg("atv_offset:0x%x\n", val); -- } -- } else if (!strncmp(parm[0], "snr_hist", strlen("snr_hist"))) { -- data_snr_avg = 0; -- for (i = 0; i < 128; i++) { -- data_snr[i] = -- (atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x50) >> 8); -- usleep_range(50*1000, 50*1000+100); -- data_snr_avg += data_snr[i]; -- } -- data_snr_avg = data_snr_avg / 128; -- pr_dbg("**********snr_hist_128avg:0x%x(%d)*********\n", -- data_snr_avg, data_snr_avg); -- } else if (!strncmp(parm[0], "afc_info", strlen("afc_info"))) { -- data_afc = retrieve_vpll_carrier_afc(); -- pr_dbg("[amlatvdemod..]afc %d Khz.\n", data_afc); -- } else if (!strncmp(parm[0], "ver_info", strlen("ver_info"))) { -- pr_dbg("[amlatvdemod..]aml_atvdemod_ver %s.\n", -- AMLATVDEMOD_VER); -- } else if (!strncmp(parm[0], "audio_autodet", -- strlen("audio_autodet"))) { -- aml_audiomode_autodet(NULL); -- } else if (!strncmp(parm[0], "overmodule_det", -- strlen("overmodule_det"))) { -- /* unsigned long over_threshold, */ -- /* int det_mode = auto_det_mode; */ -- aml_atvdemod_overmodule_det(); -- } else if (!strncmp(parm[0], "audio_gain_set", -- strlen("audio_gain_set"))) { -- if (kstrtoul(buf+strlen("audio_gain_set")+1, 16, &tmp) == 0) -- val = tmp; -- aml_audio_valume_gain_set(val); -- pr_dbg("audio_gain_set : %d\n", val); -- } else if (!strncmp(parm[0], "audio_gain_get", -- strlen("audio_gain_get"))) { -- val = aml_audio_valume_gain_get(); -- pr_dbg("audio_gain_get : %d\n", val); -- } else if (!strncmp(parm[0], "fix_pwm_adj", strlen("fix_pwm_adj"))) { -- if (kstrtoul(parm[1], 10, &tmp) == 0) { -- val = tmp; -- aml_fix_PWM_adjust(val); -- } -- } else if (!strncmp(parm[0], "rs", strlen("rs"))) { -- if (kstrtoul(parm[1], 16, &tmp) == 0) -- block_addr = tmp; -- if (kstrtoul(parm[2], 16, &tmp) == 0) -- block_reg = tmp; -- if (block_addr < APB_BLOCK_ADDR_TOP) -- block_val = atv_dmd_rd_long(block_addr, block_reg); -- pr_info("rs block_addr:0x%x,block_reg:0x%x,block_val:0x%x\n", -- block_addr, block_reg, block_val); -- } else if (!strncmp(parm[0], "ws", strlen("ws"))) { -- if (kstrtoul(parm[1], 16, &tmp) == 0) -- block_addr = tmp; -- if (kstrtoul(parm[2], 16, &tmp) == 0) -- block_reg = tmp; -- if (kstrtoul(parm[3], 16, &tmp) == 0) -- block_val = tmp; -- if (block_addr < APB_BLOCK_ADDR_TOP) -- atv_dmd_wr_long(block_addr, block_reg, block_val); -- pr_info("ws block_addr:0x%x,block_reg:0x%x,block_val:0x%x\n", -- block_addr, block_reg, block_val); -- block_val = atv_dmd_rd_long(block_addr, block_reg); -- pr_info("readback_val:0x%x\n", block_val); -- } else if (!strncmp(parm[0], "pin_mux", strlen("pin_mux"))) { -- amlatvdemod_devp->pin = -- devm_pinctrl_get_select(amlatvdemod_devp->dev, -- amlatvdemod_devp->pin_name); -- pr_dbg("atvdemod agc pinmux name:%s\n", -- amlatvdemod_devp->pin_name); -- } else if (!strncmp(parm[0], "snr_cur", strlen("snr_cur"))) { -- data_snr_avg = aml_atvdemod_get_snr_ex(); -- pr_dbg("**********snr_cur:%d*********\n", data_snr_avg); -- } else -- pr_dbg("invalid command\n"); -- kfree(buf_orig); -- return count; --} -- --static ssize_t aml_atvdemod_show(struct class *cls, -- struct class_attribute *attr, char *buff) --{ -- pr_dbg("\n usage:\n"); -- pr_dbg("[get soft version] echo ver_info > /sys/class/amlatvdemod/atvdemod_debug\n"); -- pr_dbg("[get afc value] echo afc_info > /sys/class/amlatvdemod/atvdemod_debug\n"); -- pr_dbg("[reinit atvdemod] echo init > /sys/class/amlatvdemod/atvdemod_debug\n"); -- pr_dbg("[get av-out-gain/av-out-offset/atv-gain/atv-offset]:\n" -- "echo get av_gain/av_offset/atv_gain/atv_offset > /sys/class/amlatvdemod/atvdemod_debug\n"); -- pr_dbg("[set av-out-gain/av-out-offset/atv-gain/atv-offset]:\n" -- "echo set av_gain/av_offset/atv_gain/atv_offset val(0~255) > /sys/class/amlatvdemod/atvdemod_debug\n"); -- return 0; --} --static CLASS_ATTR(atvdemod_debug, 0644, aml_atvdemod_show, aml_atvdemod_store); -- --void aml_atvdemod_set_frequency(unsigned int freq) --{ --} -- --/*static void aml_atvdemod_set_std(void);*/ -- --/*try audmode B,CH,I,DK,return the sound level*/ --/*static unsigned char set_video_audio_mode(unsigned char color, --unsigned char audmode);*/ --/*static void aml_atvdemod_get_status(struct dvb_frontend *fe, --void *stat);*/ --/*static void aaaml_atvdemod_get_pll_status(struct dvb_frontend *fe, --void *stat);*/ -- --static int aml_atvdemod_fe_init(struct aml_fe_dev *dev) --{ -- -- int error_code = 0; -- if (!dev) { -- pr_dbg("[amlatvdemod..]%s: null pointer error.\n", __func__); -- return -1; -- } -- return error_code; --} -- --static int aml_atvdemod_enter_mode(struct aml_fe *fe, int mode) --{ -- int err_code; -- if (amlatvdemod_devp->pin_name != NULL) -- amlatvdemod_devp->pin = -- devm_pinctrl_get_select(amlatvdemod_devp->dev, -- amlatvdemod_devp->pin_name); -- /* printk("\n%s: set atvdemod pll...\n",__func__); */ -- adc_set_pll_cntl(1, 0x1); -- atvdemod_clk_init(); -- err_code = atvdemod_init(); -- if (err_code) { -- pr_dbg("[amlatvdemod..]%s init atvdemod error.\n", __func__); -- return err_code; -- } -- -- set_aft_thread_enable(1); -- return 0; --} -- --static int aml_atvdemod_leave_mode(struct aml_fe *fe, int mode) --{ -- set_aft_thread_enable(0); -- atvdemod_uninit(); -- if (amlatvdemod_devp->pin != NULL) { -- devm_pinctrl_put(amlatvdemod_devp->pin); -- amlatvdemod_devp->pin = NULL; -- } -- /* reset adc pll flag */ -- /* printk("\n%s: init atvdemod flag...\n",__func__); */ -- adc_set_pll_cntl(0, 0x1); -- -- return 0; --} -- --static int aml_atvdemod_suspend(struct aml_fe_dev *dev) --{ -- return 0; --} -- --static int aml_atvdemod_resume(struct aml_fe_dev *dev) --{ -- return 0; --} -- --/* --static int aml_atvdemod_get_afc(struct dvb_frontend *fe,int *afc) --{ -- return 0; --}*/ -- --/*ret:5~100;the val is bigger,the signal is better*/ --int aml_atvdemod_get_snr(struct dvb_frontend *fe) --{ --#if 1 -- return get_atvdemod_snr_val(); --#else -- unsigned int snr_val; -- int ret; -- snr_val = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x50) >> 8; -- /* snr_val:900000~0xffffff,ret:5~15 */ -- if (snr_val > 900000) -- ret = 15 - (snr_val - 900000)*10/(0xffffff - 900000); -- /* snr_val:158000~900000,ret:15~30 */ -- else if (snr_val > 158000) -- ret = 30 - (snr_val - 158000)*15/(900000 - 158000); -- /* snr_val:31600~158000,ret:30~50 */ -- else if (snr_val > 31600) -- ret = 50 - (snr_val - 31600)*20/(158000 - 31600); -- /* snr_val:316~31600,ret:50~80 */ -- else if (snr_val > 316) -- ret = 80 - (snr_val - 316)*30/(31600 - 316); -- /* snr_val:0~316,ret:80~100 */ -- else -- ret = 100 - (316 - snr_val)*20/316; -- return ret; --#endif --} --EXPORT_SYMBOL(aml_atvdemod_get_snr); -- --int aml_atvdemod_get_snr_ex(void) --{ --#if 1 -- return get_atvdemod_snr_val(); --#else -- unsigned int snr_val; -- int ret; -- snr_val = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x50) >> 8; -- /* snr_val:900000~0xffffff,ret:5~15 */ -- if (snr_val > 900000) -- ret = 15 - (snr_val - 900000)*10/(0xffffff - 900000); -- /* snr_val:158000~900000,ret:15~30 */ -- else if (snr_val > 158000) -- ret = 30 - (snr_val - 158000)*15/(900000 - 158000); -- /* snr_val:31600~158000,ret:30~50 */ -- else if (snr_val > 31600) -- ret = 50 - (snr_val - 31600)*20/(158000 - 31600); -- /* snr_val:316~31600,ret:50~80 */ -- else if (snr_val > 316) -- ret = 80 - (snr_val - 316)*30/(31600 - 316); -- /* snr_val:0~316,ret:80~100 */ -- else -- ret = 100 - (316 - snr_val)*20/316; -- return ret; --#endif --} --EXPORT_SYMBOL(aml_atvdemod_get_snr_ex); -- --/*tuner lock status & demod lock status should be same in silicon tuner*/ --static int aml_atvdemod_get_status(struct dvb_frontend *fe, void *stat) --{ -- int video_lock; -- fe_status_t *status = (fe_status_t *) stat; -- retrieve_video_lock(&video_lock); -- if ((video_lock & 0x1) == 0) { -- /* *status = FE_HAS_LOCK;*/ -- *status = FE_TIMEDOUT; -- pr_info("video lock:locked\n"); -- } else { -- pr_info("video lock:unlocked\n"); -- *status = FE_TIMEDOUT; -- /* *status = FE_HAS_LOCK;*/ -- } -- return 0; --} -- --/*tuner lock status & demod lock status should be same in silicon tuner*/ --/* force return lock, for atvdemo status not sure */ --static void aml_atvdemod_get_pll_status(struct dvb_frontend *fe, void *stat) --{ -- int vpll_lock; -- fe_status_t *status = (fe_status_t *) stat; -- retrieve_vpll_carrier_lock(&vpll_lock); -- if ((vpll_lock&0x1) == 0) { -- *status = FE_HAS_LOCK; -- pr_info("visual carrier lock:locked\n"); -- } else { -- pr_info("visual carrier lock:unlocked\n"); -- *status = FE_TIMEDOUT; -- /* *status = FE_HAS_LOCK;*/ -- } -- return; --} -- --static int aml_atvdemod_get_atv_status(struct dvb_frontend *fe, -- struct atv_status_s *atv_status) --{ -- int vpll_lock, line_lock; -- int try_std = 1; -- int loop_cnt = 5; -- int cnt = 10; -- int try_std_cnt = 0; -- static int last_report_freq; -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- -- while (fe && atv_status && loop_cnt--) { -- atv_status->afc = retrieve_vpll_carrier_afc(); -- retrieve_vpll_carrier_lock(&vpll_lock); -- line_lock = atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x4f)&0x10; -- if ((vpll_lock&0x1) == 0 || line_lock == 0) { -- atv_status->atv_lock = 1; -- try_std_cnt = 2; -- while (try_std_cnt--) { -- atv_status->afc = retrieve_vpll_carrier_afc(); -- if (atv_status->afc > 1500 -- && atvdemod_scan_mode) { -- if ((c->analog.std & 0xff000000) -- != V4L2_COLOR_STD_PAL) { -- c->analog.std = -- V4L2_COLOR_STD_PAL -- | V4L2_STD_PAL_BG; -- c->frequency += 1; -- fe->ops.set_frontend(fe); -- msleep(20); -- } else { -- c->analog.std = -- V4L2_COLOR_STD_NTSC -- | V4L2_STD_NTSC_M; -- c->frequency += 1; -- fe->ops.set_frontend(fe); -- msleep(20); -- } -- atv_status->afc = -- retrieve_vpll_carrier_afc(); -- -- cnt = 4; -- while (cnt--) { -- if (atv_status->afc < 1500) -- break; -- atv_status->afc = -- retrieve_vpll_carrier_afc(); -- usleep_range(5*1000, 5*1000+100); -- } -- if (atv_status->afc < 1500) -- break; -- } -- } -- -- if (atv_status->afc > 4000 && !atvdemod_scan_mode) -- atv_status->atv_lock = 0; -- -- if (last_report_freq != c->frequency) -- last_report_freq = c->frequency; -- -- if (atvdemod_scan_mode) -- pr_err("%s,freq:%d, afc:%d\n", __func__, -- c->frequency, atv_status->afc); -- break; -- -- } else if (try_std%3 == 0 && atvdemod_scan_mode) { -- if ((c->analog.std & 0xff000000) -- != V4L2_COLOR_STD_PAL) { -- c->analog.std = -- V4L2_COLOR_STD_PAL | V4L2_STD_PAL_DK; -- } -- if (1000000 < abs(c->frequency - last_report_freq)) { -- c->frequency -= 500000; -- pr_err("@@@ %s freq:%d unlock,try back 0.25M\n", -- __func__, c->frequency); -- } else -- c->frequency += 1; -- fe->ops.set_frontend(fe); -- usleep_range(10*1000, 10*1000+100); -- } -- if (atvdemod_scan_mode) -- pr_err("@@@ %s freq:%d unlock, read lock again\n", -- __func__, c->frequency); -- else -- break; -- atv_status->atv_lock = 0; -- try_std++; -- } -- if (0 == atvdemod_scan_mode) { -- if (20 > abs(atv_status->afc)) -- afc_wave_cnt = 0; -- if (500*1000 > abs(last_frq - c->frequency) -- && 20 < abs(atv_status->afc) -- && 200 > abs(atv_status->afc)) { -- afc_wave_cnt++; -- pr_err("%s play mode,afc_wave_cnt:%d\n", -- __func__, afc_wave_cnt); -- if (afc_wave_cnt < 20) { -- atv_status->afc = 0; -- pr_err("%s, afc is wave,ignore\n", __func__); -- } -- } -- } -- return 0; --} -- --void aml_atvdemod_set_params(struct dvb_frontend *fe, -- struct analog_parameters *p) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- if (FE_ANALOG == fe->ops.info.type) { -- if ((p->std != amlatvdemod_devp->parm.std) || -- (p->tuner_id == AM_TUNER_R840) || -- (p->tuner_id == AM_TUNER_SI2151) || -- (p->tuner_id == AM_TUNER_MXL661)) { -- amlatvdemod_devp->parm.std = p->std; -- amlatvdemod_devp->parm.if_freq = p->if_freq; -- amlatvdemod_devp->parm.if_inv = p->if_inv; -- amlatvdemod_devp->parm.tuner_id = p->tuner_id; -- /* open AGC if needed */ -- if (amlatvdemod_devp->pin != NULL) -- devm_pinctrl_put(amlatvdemod_devp->pin); -- if (amlatvdemod_devp->pin_name) -- amlatvdemod_devp->pin = -- devm_pinctrl_get_select(amlatvdemod_devp->dev, -- amlatvdemod_devp->pin_name); -- atv_dmd_set_std(); -- last_frq = c->frequency; -- last_std = c->analog.std; -- pr_info("[amlatvdemod..]%s set std color %s, audio type %s.\n", -- __func__, -- v4l2_std_to_str(0xff000000&amlatvdemod_devp->parm.std), -- v4l2_std_to_str(0xffffff&amlatvdemod_devp->parm.std)); -- pr_info("[amlatvdemod..]%s set if_freq 0x%x, if_inv 0x%x.\n", -- __func__, amlatvdemod_devp->parm.if_freq, -- amlatvdemod_devp->parm.if_inv); -- } -- } -- return; --} --static int aml_atvdemod_get_afc(struct dvb_frontend *fe, s32 *afc) --{ -- *afc = retrieve_vpll_carrier_afc(); -- pr_info("[amlatvdemod..]%s afc %d.\n", __func__, *afc); -- return 0; --} -- --static int aml_atvdemod_get_ops(struct aml_fe_dev *dev, int mode, void *ops) --{ -- struct analog_demod_ops *aml_analog_ops = -- (struct analog_demod_ops *)ops; -- if (!ops) { -- pr_dbg("[amlatvdemod..]%s null pointer error.\n", __func__); -- return -1; -- } -- aml_analog_ops->get_afc = aml_atvdemod_get_afc; -- aml_analog_ops->get_snr = aml_atvdemod_get_snr; -- aml_analog_ops->get_status = aml_atvdemod_get_status; -- aml_analog_ops->set_params = aml_atvdemod_set_params; -- aml_analog_ops->get_pll_status = aml_atvdemod_get_pll_status; -- aml_analog_ops->get_atv_status = aml_atvdemod_get_atv_status; -- return 0; --} -- --static struct aml_fe_drv aml_atvdemod_drv = { -- .name = "aml_atv_demod", -- .capability = AM_FE_ANALOG, -- .id = AM_ATV_DEMOD_AML, -- .get_ops = aml_atvdemod_get_ops, -- .init = aml_atvdemod_fe_init, -- .enter_mode = aml_atvdemod_enter_mode, -- .leave_mode = aml_atvdemod_leave_mode, -- .suspend = aml_atvdemod_suspend, -- .resume = aml_atvdemod_resume, --}; -- --struct class *aml_atvdemod_clsp; -- --static void aml_atvdemod_dt_parse(struct platform_device *pdev) --{ -- struct device_node *node; -- unsigned int val; -- int ret; -- node = pdev->dev.of_node; -- /* get interger value */ -- if (node) { -- ret = of_property_read_u32(node, "reg_23cf", &val); -- if (ret) -- pr_dbg("Can't find reg_23cf.\n"); -- else -- reg_23cf = val; -- ret = of_property_read_u32(node, "audio_gain_val", &val); -- if (ret) -- pr_dbg("Can't find audio_gain_val.\n"); -- else -- set_audio_gain_val(val); -- ret = of_property_read_u32(node, "video_gain_val", &val); -- if (ret) -- pr_dbg("Can't find video_gain_val.\n"); -- else -- set_video_gain_val(val); -- /* agc pin mux */ -- ret = of_property_read_string(node, "pinctrl-names", -- &amlatvdemod_devp->pin_name); -- if (!ret) { -- /* amlatvdemod_devp->pin = */ -- /* devm_pinctrl_get_select(&pdev->dev, */ -- /* amlatvdemod_devp->pin_name); */ -- pr_dbg("atvdemod agc pinmux name:%s\n", -- amlatvdemod_devp->pin_name); -- } -- } --} --static struct resource amlatvdemod_memobj; --void __iomem *amlatvdemod_reg_base; --void __iomem *amlatvdemod_hiu_reg_base; --void __iomem *amlatvdemod_periphs_reg_base; --int amlatvdemod_reg_read(unsigned int reg, unsigned int *val) --{ -- *val = readl(amlatvdemod_reg_base + reg); -- return 0; --} -- --int amlatvdemod_reg_write(unsigned int reg, unsigned int val) --{ -- writel(val, (amlatvdemod_reg_base + reg)); -- return 0; --} -- --int amlatvdemod_hiu_reg_read(unsigned int reg, unsigned int *val) --{ -- *val = readl(amlatvdemod_hiu_reg_base + ((reg - 0x1000)<<2)); -- return 0; --} -- --int amlatvdemod_hiu_reg_write(unsigned int reg, unsigned int val) --{ -- writel(val, (amlatvdemod_hiu_reg_base + ((reg - 0x1000)<<2))); -- return 0; --} --int amlatvdemod_periphs_reg_read(unsigned int reg, unsigned int *val) --{ -- *val = readl(amlatvdemod_periphs_reg_base + ((reg - 0x1000)<<2)); -- return 0; --} -- --int amlatvdemod_periphs_reg_write(unsigned int reg, unsigned int val) --{ -- writel(val, (amlatvdemod_periphs_reg_base + ((reg - 0x1000)<<2))); -- return 0; --} -- --static int aml_atvdemod_probe(struct platform_device *pdev) --{ -- int ret = 0; -- struct resource *res; -- int size_io_reg; -- res = &amlatvdemod_memobj; -- amlatvdemod_devp = kmalloc(sizeof(struct amlatvdemod_device_s), -- GFP_KERNEL); -- if (!amlatvdemod_devp) -- goto fail_alloc_region; -- memset(amlatvdemod_devp, 0, sizeof(struct amlatvdemod_device_s)); -- amlatvdemod_devp->clsp = class_create(THIS_MODULE, -- ATVDEMOD_DEVICE_NAME); -- if (!amlatvdemod_devp->clsp) -- goto fail_create_class; -- ret = class_create_file(amlatvdemod_devp->clsp, -- &class_attr_atvdemod_debug); -- if (ret) -- goto fail_class_create_file; -- amlatvdemod_devp->dev = &pdev->dev; -- -- /*reg mem*/ -- pr_info("%s:amlatvdemod start get ioremap .\n", __func__); -- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- if (!res) { -- dev_err(&pdev->dev, "missing memory resource\n"); -- return -ENODEV; -- } -- size_io_reg = resource_size(res); -- pr_info("amlatvdemod_probe reg=%p,size=%x\n", -- (void *)res->start, size_io_reg); -- amlatvdemod_reg_base = -- devm_ioremap_nocache(&pdev->dev, res->start, size_io_reg); -- if (!amlatvdemod_reg_base) { -- dev_err(&pdev->dev, "amlatvdemod ioremap failed\n"); -- return -ENOMEM; -- } -- pr_info("%s: amlatvdemod maped reg_base =%p, size=%x\n", -- __func__, amlatvdemod_reg_base, size_io_reg); -- /*remap hiu mem*/ -- amlatvdemod_hiu_reg_base = ioremap(0xc883c000, 0x2000); -- /*remap periphs mem*/ -- amlatvdemod_periphs_reg_base = ioremap(0xc8834000, 0x2000); -- -- /*initialize the tuner common struct and register*/ -- aml_register_fe_drv(AM_DEV_ATV_DEMOD, &aml_atvdemod_drv); -- -- aml_atvdemod_dt_parse(pdev); -- pr_dbg("[amlatvdemod.] : probe ok.\n"); -- return 0; -- --fail_class_create_file: -- pr_dbg("[amlatvdemod.] : atvdemod class file create error.\n"); -- class_destroy(amlatvdemod_devp->clsp); --fail_create_class: -- pr_dbg("[amlatvdemod.] : atvdemod class create error.\n"); -- kfree(amlatvdemod_devp); --fail_alloc_region: -- pr_dbg("[amlatvdemod.] : atvdemod alloc error.\n"); -- pr_dbg("[amlatvdemod.] : atvdemod_init fail.\n"); -- return ret; --} -- --static int __exit aml_atvdemod_remove(struct platform_device *pdev) --{ -- if (amlatvdemod_devp == NULL) -- return -1; -- class_destroy(amlatvdemod_devp->clsp); -- aml_unregister_fe_drv(AM_DEV_ATV_DEMOD, &aml_atvdemod_drv); -- kfree(amlatvdemod_devp); -- pr_dbg("[amlatvdemod.] : amvecm_remove.\n"); -- return 0; --} -- -- --static const struct of_device_id aml_atvdemod_dt_match[] = { -- { -- .compatible = "amlogic, aml_atv_demod", -- }, -- {}, --}; -- --static struct platform_driver aml_atvdemod_driver = { -- .driver = { -- .name = "aml_atv_demod", -- .owner = THIS_MODULE, -- .of_match_table = aml_atvdemod_dt_match, -- }, -- .probe = aml_atvdemod_probe, -- .remove = __exit_p(aml_atvdemod_remove), --}; -- -- --static int __init aml_atvdemod_init(void) --{ -- if (platform_driver_register(&aml_atvdemod_driver)) { -- pr_err("failed to register amlatvdemod driver module\n"); -- return -ENODEV; -- } -- pr_dbg("[amlatvdemod..]%s.\n", __func__); -- return 0; --} -- --static void __exit aml_atvdemod_exit(void) --{ -- platform_driver_unregister(&aml_atvdemod_driver); -- pr_dbg("[amlatvdemod..]%s: driver removed ok.\n", __func__); --} -- --MODULE_AUTHOR("dezhi.kong "); --MODULE_DESCRIPTION("aml atv demod device driver"); --MODULE_LICENSE("GPL"); -- --fs_initcall(aml_atvdemod_init); --module_exit(aml_atvdemod_exit); -diff --git a/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_func.c b/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_func.c -deleted file mode 100644 -index a19d1cd..0000000 ---- a/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_func.c -+++ /dev/null -@@ -1,2073 +0,0 @@ --/* -- * Silicon labs amlogic Atvdemod Device Driver -- * -- * Author: dezhi kong -- * -- * -- * Copyright (C) 2014 Amlogic Inc. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- */ -- --/* Standard Liniux Headers */ --#include --#include --#include --#include --#include --#include --#include -- --#include "atvdemod_func.h" --#include "../aml_dvb_reg.h" -- --static int broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC; --module_param(broad_std, int, 0644); --MODULE_PARM_DESC(broad_std, "\n broad_std\n"); -- --static unsigned long over_threshold = 0xffff; --module_param(over_threshold, ulong, 0644); --MODULE_PARM_DESC(over_threshold, "\n over_threshold\n"); -- --static unsigned long input_amplitude = 0xffff; --module_param(input_amplitude, ulong, 0644); --MODULE_PARM_DESC(input_amplitude, "\n input_amplitude\n"); -- --static bool audio_det_en; --module_param(audio_det_en, bool, 0644); --MODULE_PARM_DESC(audio_det_en, "\n audio_det_en\n"); -- --static bool non_std_en; --module_param(non_std_en, bool, 0644); --MODULE_PARM_DESC(non_std__en, "\n non_std_en\n"); -- --static int atv_video_gain; --module_param(atv_video_gain, int, 0644); --MODULE_PARM_DESC(atv_video_gain, "\n atv_video_gain\n"); -- --static int audio_det_mode = AUDIO_AUTO_DETECT; --module_param(audio_det_mode, int, 0644); --MODULE_PARM_DESC(audio_det_mode, "\n audio_det_mode\n"); -- --static int aud_dmd_jilinTV; --module_param(aud_dmd_jilinTV, int, 0644); --MODULE_PARM_DESC(aud_dmd_jilinTV, "\naud dmodulation setting for jilin TV\n"); -- --static unsigned int if_freq = 4250000; /*PAL-DK:3250000;NTSC-M:4250000*/ --module_param(if_freq, uint, 0644); --MODULE_PARM_DESC(if_freq, "\n if_freq\n"); -- --static int if_inv; --module_param(if_inv, int, 0644); --MODULE_PARM_DESC(if_inv, "\n if_inv\n"); -- --static int afc_default = CARR_AFC_DEFAULT_VAL; --module_param(afc_default, int, 0644); --MODULE_PARM_DESC(afc_default, "\n afc_default\n"); -- --/*GDE_Curve -- 0: CURVE-M -- 1: CURVE-A -- 2: CURVE-B -- 3: CURVE-CHINA -- 4: BYPASS --BG --> CURVE-B(BYPASS) --DK --> CURVE-CHINA --NM --> CURVE-M --I --> BYPASS --SECAM --> BYPASS*/ --static int gde_curve; --module_param(gde_curve, int, 0644); --MODULE_PARM_DESC(gde_curve, "\n gde_curve\n"); -- --static int sound_format; --module_param(sound_format, int, 0644); --MODULE_PARM_DESC(sound_format, "\n sound_format\n"); -- --static unsigned int freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT; --module_param(freq_hz_cvrt, int, 0644); --MODULE_PARM_DESC(freq_hz_cvrt, "\n freq_hz\n"); -- --int atvdemod_debug_en = 0; --module_param(atvdemod_debug_en, int, 0644); --MODULE_PARM_DESC(atvdemod_debug_en, "\n atvdemod_debug_en\n"); -- --/*1:gpio mode output low;2:pwm mode*/ --static unsigned int atvdemod_agc_pinmux = 2; --module_param(atvdemod_agc_pinmux, int, 0644); --MODULE_PARM_DESC(atvdemod_agc_pinmux, "\n atvdemod_agc_pinmux\n"); -- --static unsigned int atvdemod_afc_range = 5; --module_param(atvdemod_afc_range, uint, 0644); --MODULE_PARM_DESC(atvdemod_afc_range, "\n atvdemod_afc_range\n"); -- --static unsigned int atvdemod_afc_offset = 500; --module_param(atvdemod_afc_offset, uint, 0644); --MODULE_PARM_DESC(atvdemod_afc_offset, "\n atvdemod_afc_offset\n"); -- --static unsigned int atvdemod_timer_en = 1; --module_param(atvdemod_timer_en, uint, 0644); --MODULE_PARM_DESC(atvdemod_timer_en, "\n atvdemod_timer_en\n"); -- --static unsigned int atvdemod_afc_en; --module_param(atvdemod_afc_en, uint, 0644); --MODULE_PARM_DESC(atvdemod_afc_en, "\n atvdemod_afc_en\n"); -- --static unsigned int atvdemod_monitor_en; --module_param(atvdemod_monitor_en, uint, 0644); --MODULE_PARM_DESC(atvdemod_monitor_en, "\n atvdemod_monitor_en\n"); -- --static unsigned int atvdemod_det_snr_en = 1; --module_param(atvdemod_det_snr_en, uint, 0644); --MODULE_PARM_DESC(atvdemod_det_snr_en, "\n atvdemod_det_snr_en\n"); -- --static unsigned int pwm_kp = 0x19; --module_param(pwm_kp, uint, 0644); --MODULE_PARM_DESC(pwm_kp, "\n pwm_kp\n"); -- --static unsigned int reg_dbg_en; --module_param(reg_dbg_en, uint, 0644); --MODULE_PARM_DESC(reg_dbg_en, "\n reg_dbg_en\n"); -- --static unsigned int audio_gain_val = 512; --module_param(audio_gain_val, uint, 0644); --MODULE_PARM_DESC(audio_gain_val, "\n audio_gain_val\n"); -- --enum AUDIO_SCAN_ID { -- ID_PAL_I = 0, -- ID_PAL_M, -- ID_PAL_DK, -- ID_PAL_BG, -- ID_MAX, --}; -- --static unsigned int mix1_freq; --static unsigned int timer_init_flag; --struct timer_list atvdemod_timer; --static int snr_val; --int broad_std_except_pal_m = 0; -- --int get_atvdemod_snr_val(void) --{ -- return snr_val; --} --EXPORT_SYMBOL(get_atvdemod_snr_val); -- --void amlatvdemod_set_std(int val) --{ -- broad_std = val; --} --EXPORT_SYMBOL(amlatvdemod_set_std); -- --void atv_dmd_wr_reg(unsigned char block, unsigned char reg, unsigned long data) --{ -- /* unsigned long data_tmp; */ -- unsigned long reg_addr = (block<<8) + reg * 4; -- amlatvdemod_reg_write(reg_addr, data); --} -- --unsigned long atv_dmd_rd_reg(unsigned char block, unsigned char reg) --{ -- unsigned long data = 0; -- unsigned long reg_addr = (block<<8) + reg * 4; -- amlatvdemod_reg_read(reg_addr, (unsigned int *)&data); -- return data; --} -- --unsigned long atv_dmd_rd_byte(unsigned long block_addr, unsigned long reg_addr) --{ -- unsigned long data; -- data = atv_dmd_rd_long(block_addr, reg_addr); -- /*R_APB_REG((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2); -- *((volatile unsigned long *) (ATV_DMD_APB_BASE_ADDR+ -- ((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2)));*/ -- if ((reg_addr & 0x3) == 0) -- data = data >> 24; -- else if ((reg_addr & 0x3) == 1) -- data = (data >> 16 & 0xff); -- else if ((reg_addr & 0x3) == 2) -- data = (data >> 8 & 0xff); -- else if ((reg_addr & 0x3) == 3) -- data = (data >> 0 & 0xff); -- return data; --} -- --unsigned long atv_dmd_rd_word(unsigned long block_addr, unsigned long reg_addr) --{ -- unsigned long data; -- data = atv_dmd_rd_long(block_addr, reg_addr); -- /*R_APB_REG((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2); -- *((volatile unsigned long *) (ATV_DMD_APB_BASE_ADDR+ -- ((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2)));*/ -- if ((reg_addr & 0x3) == 0) -- data = data >> 16; -- else if ((reg_addr & 0x3) == 1) -- data = (data >> 8 & 0xffff); -- else if ((reg_addr & 0x3) == 2) -- data = (data >> 0 & 0xffff); -- else if ((reg_addr & 0x3) == 3) -- data = (((data & 0xff) << 8) | ((data >> 24) & 0xff)); -- return data; --} -- --unsigned long atv_dmd_rd_long(unsigned long block_addr, unsigned long reg_addr) --{ -- unsigned long data; -- /*data = *((volatile unsigned long *) (ATV_DMD_APB_BASE_ADDR+ -- ((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2)));*/ -- data = -- R_ATVDEMOD_REG((((block_addr & 0xff) << 6) + -- ((reg_addr & 0xff) >> 2)) << 2); -- -- return data; --} --EXPORT_SYMBOL(atv_dmd_rd_long); -- --void atv_dmd_wr_long(unsigned long block_addr, unsigned long reg_addr, -- unsigned long data) --{ -- W_ATVDEMOD_REG((((block_addr & 0xff) << 6) + -- ((reg_addr & 0xff) >> 2)) << 2, data); -- if (reg_dbg_en) -- pr_dbg("block_addr:0x%x,reg_addr:0x%x;data:0x%x\n", -- (unsigned int)block_addr, (unsigned int)reg_addr, -- (unsigned int)data); -- /**((volatile unsigned long *) -- (ATV_DMD_APB_BASE_ADDR+((((block_addr & 0xff) << 6) + -- ((reg_addr & 0xff) >> 2)) << 2))) = data;*/ -- --} --EXPORT_SYMBOL(atv_dmd_wr_long); -- --void atv_dmd_wr_word(unsigned long block_addr, unsigned long reg_addr, -- unsigned long data) --{ -- unsigned long data_tmp; -- data_tmp = atv_dmd_rd_long(block_addr, reg_addr); -- data = data & 0xffff; -- if ((reg_addr & 0x3) == 0) -- data = (data << 16 | (data_tmp & 0xffff)); -- else if ((reg_addr & 0x3) == 1) -- data = -- ((data_tmp & 0xff000000) | (data << 8) | (data_tmp & 0xff)); -- else if ((reg_addr & 0x3) == 2) -- data = (data | (data_tmp & 0xffff0000)); -- else if ((reg_addr & 0x3) == 3) -- data = -- (((data & 0xff) << 24) | ((data_tmp & 0xffff0000) >> 8) | -- ((data & 0xff00) >> 8)); -- -- /**((volatile unsigned long *) (ATV_DMD_APB_BASE_ADDR+ -- ((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2))) = data;*/ -- atv_dmd_wr_long(block_addr, reg_addr, data); -- /*W_ATVDEMOD_REG(((((block_addr & 0xff) <<6) + -- ((reg_addr & 0xff) >>2)) << 2), data);*/ -- --} -- --void atv_dmd_wr_byte(unsigned long block_addr, unsigned long reg_addr, -- unsigned long data) --{ -- unsigned long data_tmp; -- data_tmp = atv_dmd_rd_long(block_addr, reg_addr); -- -- /*pr_info("atv demod wr byte, read block addr %lx\n",block_addr);*/ -- /*pr_info("atv demod wr byte, read reg addr %lx\n", reg_addr);*/ -- /*pr_info("atv demod wr byte, wr data %lx\n",data);*/ -- /*pr_info("atv demod wr byte, read data out %lx\n",data_tmp);*/ -- -- data = data & 0xff; -- /*pr_info("atv demod wr byte, data & 0xff %lx\n",data);*/ -- if ((reg_addr & 0x3) == 0) { -- data = (data << 24 | (data_tmp & 0xffffff)); -- /*pr_info("atv demod wr byte, reg_addr & 0x3 == 0, -- wr data %lx\n",data);*/ -- } else if ((reg_addr & 0x3) == 1) -- data = -- ((data_tmp & 0xff000000) | (data << 16) | -- (data_tmp & 0xffff)); -- else if ((reg_addr & 0x3) == 2) -- data = -- ((data_tmp & 0xffff0000) | (data << 8) | (data_tmp & 0xff)); -- else if ((reg_addr & 0x3) == 3) -- data = ((data_tmp & 0xffffff00) | (data & 0xff)); -- -- /*pr_info("atv demod wr byte, wr data %lx\n",data);*/ -- -- /**((volatile unsigned long *) (ATV_DMD_APB_BASE_ADDR+ -- ((((block_addr & 0xff) <<6) + ((reg_addr & 0xff) >>2)) << 2))) = data;*/ -- atv_dmd_wr_long(block_addr, reg_addr, data); -- /*W_ATVDEMOD_REG(((((block_addr & 0xff) <<6) + -- ((reg_addr & 0xff) >>2)) << 2), data);*/ --} -- --void set_audio_gain_val(int val) --{ -- audio_gain_val = val; --} -- --void set_video_gain_val(int val) --{ -- atv_video_gain = val; --} -- --void atv_dmd_soft_reset(void) --{ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SYSTEM_MGT, 0x0, 0x0); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SYSTEM_MGT, 0x0, 0x1); --} -- --void atv_dmd_input_clk_32m(void) --{ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_ADC_MGR, 0x2, 0x1); --} -- --void read_version_register(void) --{ -- unsigned long data, Byte1, Byte2, Word; -- -- pr_info("ATV-DMD read version register\n"); -- Byte1 = atv_dmd_rd_byte(APB_BLOCK_ADDR_VERS_REGISTER, 0x0); -- Byte2 = atv_dmd_rd_byte(APB_BLOCK_ADDR_VERS_REGISTER, 0x1); -- Word = atv_dmd_rd_word(APB_BLOCK_ADDR_VERS_REGISTER, 0x2); -- data = atv_dmd_rd_long(APB_BLOCK_ADDR_VERS_REGISTER, 0x0); -- -- pr_info("atv demod read version register data out %lx\n", data); -- -- if ((data != 0x516EAB13) -- || (((Byte1 << 24) | (Byte2 << 16) | Word) != 0x516EAB13)) -- pr_info("atv demod read version reg failed\n"); --} -- --void check_communication_interface(void) --{ -- unsigned long data_tmp; -- -- pr_info("ATV-DMD check communication intf\n"); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VERS_REGISTER, 0x0, 0xA1B2C3D4); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VERS_REGISTER, 0x1, 0x34); -- atv_dmd_wr_word(APB_BLOCK_ADDR_VERS_REGISTER, 0x2, 0xBCDE); -- data_tmp = atv_dmd_rd_long(APB_BLOCK_ADDR_VERS_REGISTER, 0x0); -- pr_info("atv demod check communication intf data out %lx\n", data_tmp); -- -- if (data_tmp != 0xa134bcde) -- pr_info("atv demod check communication intf failed\n"); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VERS_REGISTER, 0x0, 0x516EAB13); --} -- --void power_on_receiver(void) --{ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_ADC_MGR, 0x2, 0x11); --} -- --void atv_dmd_misc(void) --{ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_AGC_PWM, 0x08, 0x38); /*zhuangwei*/ -- /*cpu.write_byte(8'h1A,8'h0E,8'h06);//zhuangwei*/ -- /*cpu.write_byte(8'h19,8'h01,8'h7f);//zhuangwei*/ -- atv_dmd_wr_byte(0x0f, 0x45, 0x90); /*zhuangwei*/ -- -- atv_dmd_wr_long(0x0f, 0x44, 0x5c8808c1);/*zhuangwei*/ -- if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_R840) { -- atv_dmd_wr_long(0x0f, 0x3c, reg_23cf);/*zhuangwei*/ -- /*guanzhong@20150804a*/ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_STG_2, 0x00, 0x1); -- atv_dmd_wr_long(APB_BLOCK_ADDR_AGC_PWM, 0x08, 0x60180200); -- /*dezhi@20150610a 0x1a maybe better?!*/ -- /* atv_dmd_wr_byte(APB_BLOCK_ADDR_AGC_PWM, 0x09, 0x19); */ -- } else { -- atv_dmd_wr_long(0x0f, 0x3c, 0x88188832);/*zhuangwei*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_AGC_PWM, 0x08, 0x46170200); -- } -- -- if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_MXL661) { -- atv_dmd_wr_long(0x0c, 0x04, 0xbffa0000) ;/*test in sky*/ -- atv_dmd_wr_long(0x0c, 0x00, 0x5a4000);/*test in sky*/ -- /*guanzhong@20151013 fix nonstd def is:0x0c010301;0x0c020601*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_CARR_RCVY, 0x24, 0x0c030901); -- } else { -- /*zhuangwei 0xdafa0000*/ -- atv_dmd_wr_long(0x0c, 0x04, 0xc8fa0000); -- atv_dmd_wr_long(0x0c, 0x00, 0x554000);/*zhuangwei*/ -- } -- atv_dmd_wr_long(0x19, 0x04, 0xdafa0000);/*zhuangwei*/ -- atv_dmd_wr_long(0x19, 0x00, 0x4a4000);/*zhuangwei*/ -- /*atv_dmd_wr_byte(0x0c,0x01,0x28);//pwd-out gain*/ -- /*atv_dmd_wr_byte(0x0c,0x04,0xc0);//pwd-out offset*/ -- if (is_meson_gxtvbb_cpu()) { -- aml_audio_valume_gain_set(audio_gain_val); -- /* 20160121 fix audio demodulation over */ -- atv_dmd_wr_long(0x09, 0x00, 0x1030501); -- atv_dmd_wr_long(0x09, 0x04, 0x1900000); -- if (aud_dmd_jilinTV) -- atv_dmd_wr_long(0x09, 0x00, 0x2030503); -- if (non_std_en == 1) { -- atv_dmd_wr_long(0x09, 0x00, 0x2030503); -- atv_dmd_wr_long(0x0f, 0x44, 0x7c8808c1); -- atv_dmd_wr_long(0x06, 0x24, 0x0c010801); -- } else { -- atv_dmd_wr_long(0x09, 0x00, 0x1030501); -- if (atv_video_gain) -- atv_dmd_wr_long(0x0f, 0x44, atv_video_gain); -- else -- atv_dmd_wr_long(0x0f, 0x44, 0xfc0808c1); -- atv_dmd_wr_long(0x06, 0x24, 0xc030901); -- } -- -- } --} -- --/*Broadcast_Standard*/ --/* 0: NTSC*/ --/* 1: NTSC-J*/ --/* 2: PAL-M,*/ --/* 3: PAL-BG*/ --/* 4: DTV*/ --/* 5: SECAM- DK2*/ --/* 6: SECAM -DK3*/ --/* 7: PAL-BG, NICAM*/ --/* 8: PAL-DK-CHINA*/ --/* 9: SECAM-L / SECAM-DK3*/ --/* 10: PAL-I*/ --/* 11: PAL-DK1*/ --/*GDE_Curve*/ --/* 0: CURVE-M*/ --/* 1: CURVE-A*/ --/* 2: CURVE-B*/ --/* 3: CURVE-CHINA*/ --/* 4: BYPASS*/ --/*sound format 0: MONO;1:NICAM*/ --void configure_receiver(int Broadcast_Standard, unsigned int Tuner_IF_Frequency, -- int Tuner_Input_IF_inverted, int GDE_Curve, -- int sound_format) --{ -- int tmp_int; -- int mixer1 = 0; -- int mixer3 = 0; -- int mixer3_bypass = 0; -- int cv = 0; -- /*int if_freq = 0;*/ -- -- int i = 0; -- int super_coef0 = 0; -- int super_coef1 = 0; -- int super_coef2 = 0; -- int gp_coeff_1[37]; -- int gp_coeff_2[37]; -- int gp_cv_g1 = 0; -- int gp_cv_g2 = 0; -- int crvy_reg_1 = 0; -- int crvy_reg_2 = 0; -- int sif_co_mx = 0; -- int sif_fi_mx = 0; -- int sif_ic_bw = 0; -- int sif_bb_bw = 0; -- int sif_deemp = 0; -- int sif_cfg_demod = 0; -- int sif_fm_gain = 0; -- int gd_coeff[6]; -- int gd_bypass; -- -- pr_info("ATV-DMD configure receiver register\n"); -- -- if ((Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_J) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_DK) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_BG) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_I)) { -- gp_coeff_1[0] = 0x57777; -- gp_coeff_1[1] = 0xdd777; -- gp_coeff_1[2] = 0x7d777; -- gp_coeff_1[3] = 0x75777; -- gp_coeff_1[4] = 0x75777; -- gp_coeff_1[5] = 0x7c777; -- gp_coeff_1[6] = 0x5c777; -- gp_coeff_1[7] = 0x44777; -- gp_coeff_1[8] = 0x54777; -- gp_coeff_1[9] = 0x47d77; -- gp_coeff_1[10] = 0x55d77; -- gp_coeff_1[11] = 0x55577; -- gp_coeff_1[12] = 0x77577; -- gp_coeff_1[13] = 0xc4c77; -- gp_coeff_1[14] = 0xd7d77; -- gp_coeff_1[15] = 0x75477; -- gp_coeff_1[16] = 0xcc477; -- gp_coeff_1[17] = 0x575d7; -- gp_coeff_1[18] = 0xc4c77; -- gp_coeff_1[19] = 0xdd757; -- gp_coeff_1[20] = 0xdd477; -- gp_coeff_1[21] = 0x77dd7; -- gp_coeff_1[22] = 0x5dc77; -- gp_coeff_1[23] = 0x47c47; -- gp_coeff_1[24] = 0x57477; -- gp_coeff_1[25] = 0x5c7c7; -- gp_coeff_1[26] = 0xccc77; -- gp_coeff_1[27] = 0x5ddd5; -- gp_coeff_1[28] = 0x54477; -- gp_coeff_1[29] = 0x7757d; -- gp_coeff_1[30] = 0x755d7; -- gp_coeff_1[31] = 0x47cc4; -- gp_coeff_1[32] = 0x57d57; -- gp_coeff_1[33] = 0x554cc; -- gp_coeff_1[34] = 0x755d7; -- gp_coeff_1[35] = 0x7d3b2; -- gp_coeff_1[36] = 0x73a91; -- gp_coeff_2[0] = 0xd5777; -- gp_coeff_2[1] = 0x77777; -- gp_coeff_2[2] = 0x7c777; -- gp_coeff_2[3] = 0xcc777; -- gp_coeff_2[4] = 0xc7777; -- gp_coeff_2[5] = 0xdd777; -- gp_coeff_2[6] = 0x44c77; -- gp_coeff_2[7] = 0x54c77; -- gp_coeff_2[8] = 0xdd777; -- gp_coeff_2[9] = 0x7c777; -- gp_coeff_2[10] = 0xc7c77; -- gp_coeff_2[11] = 0x75c77; -- gp_coeff_2[12] = 0xdd577; -- gp_coeff_2[13] = 0x44777; -- gp_coeff_2[14] = 0xd5c77; -- gp_coeff_2[15] = 0xdc777; -- gp_coeff_2[16] = 0xd7757; -- gp_coeff_2[17] = 0x4c757; -- gp_coeff_2[18] = 0x7d777; -- gp_coeff_2[19] = 0x75477; -- gp_coeff_2[20] = 0x57547; -- gp_coeff_2[21] = 0xdc747; -- gp_coeff_2[22] = 0x74777; -- gp_coeff_2[23] = 0x75757; -- gp_coeff_2[24] = 0x4cc75; -- gp_coeff_2[25] = 0xd4747; -- gp_coeff_2[26] = 0x7d7d7; -- gp_coeff_2[27] = 0xd5577; -- gp_coeff_2[28] = 0xc4c75; -- gp_coeff_2[29] = 0xcc477; -- gp_coeff_2[30] = 0xdd54c; -- gp_coeff_2[31] = 0x7547d; -- gp_coeff_2[32] = 0x55547; -- gp_coeff_2[33] = 0x5575c; -- gp_coeff_2[34] = 0xd543a; -- gp_coeff_2[35] = 0x57b3a; -- gp_coeff_2[36] = 0x77777; -- gp_cv_g1 = 0x2b062d; -- gp_cv_g2 = 0x40fa2d; -- } else if ((Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK2) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK3) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG_NICAM)) { -- gp_coeff_1[0] = 0x75777; -- gp_coeff_1[1] = 0x57777; -- gp_coeff_1[2] = 0x7d777; -- gp_coeff_1[3] = 0x75777; -- gp_coeff_1[4] = 0x75777; -- gp_coeff_1[5] = 0x7c777; -- gp_coeff_1[6] = 0x47777; -- gp_coeff_1[7] = 0x74777; -- gp_coeff_1[8] = 0xd5d77; -- gp_coeff_1[9] = 0xc7777; -- gp_coeff_1[10] = 0x77577; -- gp_coeff_1[11] = 0xd7d77; -- gp_coeff_1[12] = 0x75d77; -- gp_coeff_1[13] = 0xdd477; -- gp_coeff_1[14] = 0x77d77; -- gp_coeff_1[15] = 0x75c77; -- gp_coeff_1[16] = 0xc4477; -- gp_coeff_1[17] = 0x4c777; -- gp_coeff_1[18] = 0x5d5d7; -- gp_coeff_1[19] = 0xd7d57; -- gp_coeff_1[20] = 0x47577; -- gp_coeff_1[21] = 0xd7dd7; -- gp_coeff_1[22] = 0xd7d57; -- gp_coeff_1[23] = 0xdd757; -- gp_coeff_1[24] = 0xc75c7; -- gp_coeff_1[25] = 0x7d477; -- gp_coeff_1[26] = 0x5d747; -- gp_coeff_1[27] = 0x7ddc7; -- gp_coeff_1[28] = 0xc4c77; -- gp_coeff_1[29] = 0xd4c75; -- gp_coeff_1[30] = 0xc755d; -- gp_coeff_1[31] = 0x47cc7; -- gp_coeff_1[32] = 0xdd7d4; -- gp_coeff_1[33] = 0x4c75d; -- gp_coeff_1[34] = 0xc7dcc; -- gp_coeff_1[35] = 0xd52a2; -- gp_coeff_1[36] = 0x555a1; -- gp_coeff_2[0] = 0x5d777; -- gp_coeff_2[1] = 0x47777; -- gp_coeff_2[2] = 0x7d777; -- gp_coeff_2[3] = 0xcc777; -- gp_coeff_2[4] = 0xd7777; -- gp_coeff_2[5] = 0x7c777; -- gp_coeff_2[6] = 0x7dd77; -- gp_coeff_2[7] = 0xdd777; -- gp_coeff_2[8] = 0x7c777; -- gp_coeff_2[9] = 0x57c77; -- gp_coeff_2[10] = 0x7c777; -- gp_coeff_2[11] = 0xd5777; -- gp_coeff_2[12] = 0xd7c77; -- gp_coeff_2[13] = 0xdd777; -- gp_coeff_2[14] = 0x77477; -- gp_coeff_2[15] = 0xc7d77; -- gp_coeff_2[16] = 0xc4777; -- gp_coeff_2[17] = 0x57557; -- gp_coeff_2[18] = 0xd5577; -- gp_coeff_2[19] = 0xd5577; -- gp_coeff_2[20] = 0x7d547; -- gp_coeff_2[21] = 0x74757; -- gp_coeff_2[22] = 0xc7577; -- gp_coeff_2[23] = 0xcc7d5; -- gp_coeff_2[24] = 0x4c747; -- gp_coeff_2[25] = 0xddc77; -- gp_coeff_2[26] = 0x54447; -- gp_coeff_2[27] = 0xcc447; -- gp_coeff_2[28] = 0x5755d; -- gp_coeff_2[29] = 0x5dd57; -- gp_coeff_2[30] = 0x54747; -- gp_coeff_2[31] = 0x5747c; -- gp_coeff_2[32] = 0xc77dd; -- gp_coeff_2[33] = 0x47557; -- gp_coeff_2[34] = 0x7a22a; -- gp_coeff_2[35] = 0xc73aa; -- gp_coeff_2[36] = 0x77777; -- gp_cv_g1 = 0x2b2834; -- gp_cv_g2 = 0x3f6c2e; -- } else if ((Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK3)) { -- gp_coeff_1[0] = 0x47777; -- gp_coeff_1[1] = 0x77777; -- gp_coeff_1[2] = 0x5d777; -- gp_coeff_1[3] = 0x47777; -- gp_coeff_1[4] = 0x75777; -- gp_coeff_1[5] = 0x5c777; -- gp_coeff_1[6] = 0x57777; -- gp_coeff_1[7] = 0x44777; -- gp_coeff_1[8] = 0x55d77; -- gp_coeff_1[9] = 0x7d777; -- gp_coeff_1[10] = 0x55577; -- gp_coeff_1[11] = 0xd5d77; -- gp_coeff_1[12] = 0xd7d77; -- gp_coeff_1[13] = 0x47477; -- gp_coeff_1[14] = 0xdc777; -- gp_coeff_1[15] = 0x4cc77; -- gp_coeff_1[16] = 0x77d57; -- gp_coeff_1[17] = 0xc4777; -- gp_coeff_1[18] = 0xdd7d7; -- gp_coeff_1[19] = 0x7c757; -- gp_coeff_1[20] = 0xd4477; -- gp_coeff_1[21] = 0x755c7; -- gp_coeff_1[22] = 0x47d57; -- gp_coeff_1[23] = 0xd7c47; -- gp_coeff_1[24] = 0xd4cc7; -- gp_coeff_1[25] = 0x47577; -- gp_coeff_1[26] = 0x5c7d5; -- gp_coeff_1[27] = 0x4c75d; -- gp_coeff_1[28] = 0xd57d7; -- gp_coeff_1[29] = 0x44755; -- gp_coeff_1[30] = 0x7557d; -- gp_coeff_1[31] = 0xc477d; -- gp_coeff_1[32] = 0xd5d44; -- gp_coeff_1[33] = 0xdd77d; -- gp_coeff_1[34] = 0x5d75b; -- gp_coeff_1[35] = 0x74332; -- gp_coeff_1[36] = 0xd4311; -- gp_coeff_2[0] = 0xd7777; -- gp_coeff_2[1] = 0x77777; -- gp_coeff_2[2] = 0xdd777; -- gp_coeff_2[3] = 0xdc777; -- gp_coeff_2[4] = 0xc7777; -- gp_coeff_2[5] = 0xdd777; -- gp_coeff_2[6] = 0x77d77; -- gp_coeff_2[7] = 0x77777; -- gp_coeff_2[8] = 0x55777; -- gp_coeff_2[9] = 0xc7d77; -- gp_coeff_2[10] = 0xd4777; -- gp_coeff_2[11] = 0xc7477; -- gp_coeff_2[12] = 0x7c777; -- gp_coeff_2[13] = 0xd5577; -- gp_coeff_2[14] = 0xdd557; -- gp_coeff_2[15] = 0x47577; -- gp_coeff_2[16] = 0xd7477; -- gp_coeff_2[17] = 0x55747; -- gp_coeff_2[18] = 0xdd757; -- gp_coeff_2[19] = 0xd7477; -- gp_coeff_2[20] = 0x7d7d5; -- gp_coeff_2[21] = 0xddd47; -- gp_coeff_2[22] = 0xdd777; -- gp_coeff_2[23] = 0x575d5; -- gp_coeff_2[24] = 0x47547; -- gp_coeff_2[25] = 0x555c7; -- gp_coeff_2[26] = 0x7d447; -- gp_coeff_2[27] = 0xd7447; -- gp_coeff_2[28] = 0x757dd; -- gp_coeff_2[29] = 0x7dc77; -- gp_coeff_2[30] = 0x54747; -- gp_coeff_2[31] = 0xc743b; -- gp_coeff_2[32] = 0xd7c7c; -- gp_coeff_2[33] = 0xd7557; -- gp_coeff_2[34] = 0x55c7a; -- gp_coeff_2[35] = 0x4cc29; -- gp_coeff_2[36] = 0x77777; -- gp_cv_g1 = 0x20682b; -- gp_cv_g2 = 0x29322f; -- } else if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I) { -- gp_coeff_1[0] = 0x77777; -- gp_coeff_1[1] = 0x75777; -- gp_coeff_1[2] = 0x7d777; -- gp_coeff_1[3] = 0xd7777; -- gp_coeff_1[4] = 0x74777; -- gp_coeff_1[5] = 0xcc777; -- gp_coeff_1[6] = 0x57777; -- gp_coeff_1[7] = 0x5d577; -- gp_coeff_1[8] = 0x5dd77; -- gp_coeff_1[9] = 0x74777; -- gp_coeff_1[10] = 0x77577; -- gp_coeff_1[11] = 0x77c77; -- gp_coeff_1[12] = 0xdc477; -- gp_coeff_1[13] = 0x5d577; -- gp_coeff_1[14] = 0x575d7; -- gp_coeff_1[15] = 0xc7d57; -- gp_coeff_1[16] = 0x77777; -- gp_coeff_1[17] = 0x557d7; -- gp_coeff_1[18] = 0xc7557; -- gp_coeff_1[19] = 0x75c77; -- gp_coeff_1[20] = 0x477d7; -- gp_coeff_1[21] = 0xcc747; -- gp_coeff_1[22] = 0x47dd7; -- gp_coeff_1[23] = 0x775d7; -- gp_coeff_1[24] = 0x47447; -- gp_coeff_1[25] = 0x75cc7; -- gp_coeff_1[26] = 0xc7777; -- gp_coeff_1[27] = 0xc75d5; -- gp_coeff_1[28] = 0x44c7d; -- gp_coeff_1[29] = 0x74c47; -- gp_coeff_1[30] = 0x47d75; -- gp_coeff_1[31] = 0x7d57c; -- gp_coeff_1[32] = 0xd5dc4; -- gp_coeff_1[33] = 0xdd575; -- gp_coeff_1[34] = 0xdb3bb; -- gp_coeff_1[35] = 0x5c752; -- gp_coeff_1[36] = 0x90880; -- gp_coeff_2[0] = 0x5d777; -- gp_coeff_2[1] = 0xd7777; -- gp_coeff_2[2] = 0x77777; -- gp_coeff_2[3] = 0xd5d77; -- gp_coeff_2[4] = 0xc7777; -- gp_coeff_2[5] = 0xd7777; -- gp_coeff_2[6] = 0xddd77; -- gp_coeff_2[7] = 0x55777; -- gp_coeff_2[8] = 0x57777; -- gp_coeff_2[9] = 0x54c77; -- gp_coeff_2[10] = 0x4c477; -- gp_coeff_2[11] = 0x74777; -- gp_coeff_2[12] = 0xd5d77; -- gp_coeff_2[13] = 0x47757; -- gp_coeff_2[14] = 0x75577; -- gp_coeff_2[15] = 0xc7577; -- gp_coeff_2[16] = 0x4c747; -- gp_coeff_2[17] = 0x7d477; -- gp_coeff_2[18] = 0x7c757; -- gp_coeff_2[19] = 0x55dd5; -- gp_coeff_2[20] = 0x57577; -- gp_coeff_2[21] = 0x44c47; -- gp_coeff_2[22] = 0x5cc75; -- gp_coeff_2[23] = 0x4cc77; -- gp_coeff_2[24] = 0x47547; -- gp_coeff_2[25] = 0x777d5; -- gp_coeff_2[26] = 0xcccc7; -- gp_coeff_2[27] = 0x57447; -- gp_coeff_2[28] = 0xdc757; -- gp_coeff_2[29] = 0x5755c; -- gp_coeff_2[30] = 0x44747; -- gp_coeff_2[31] = 0x5d5dd; -- gp_coeff_2[32] = 0x5747b; -- gp_coeff_2[33] = 0x77557; -- gp_coeff_2[34] = 0xdcb2a; -- gp_coeff_2[35] = 0xd5779; -- gp_coeff_2[36] = 0x77777; -- gp_cv_g1 = 0x72242f; -- gp_cv_g2 = 0x28822a; -- } -- -- if ((Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC) || -- (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_J)) { -- sif_co_mx = 0xb8; -- sif_fi_mx = 0x0; -- sif_ic_bw = 0x1; -- sif_bb_bw = 0x1; -- sif_deemp = 0x1; -- sif_cfg_demod = (sound_format == 0) ? 0x0:0x2; -- sif_fm_gain = 0x4; -- } else if ((Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG) -- || (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_BG)) { -- sif_co_mx = 0xa6; -- sif_fi_mx = 0x10; -- sif_ic_bw = 0x2; -- sif_bb_bw = 0x0; -- sif_deemp = 0x2; -- sif_cfg_demod = (sound_format == 0) ? 0x0:0x2; -- sif_fm_gain = 0x3; -- } else if (Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK1) { -- sif_co_mx = 154; -- sif_fi_mx = 240; -- sif_ic_bw = 2; -- sif_bb_bw = 0; -- sif_deemp = 2; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } else if (Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK2) { -- sif_co_mx = 150; -- sif_fi_mx = 16; -- sif_ic_bw = 2; -- sif_bb_bw = 0; -- sif_deemp = 2; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } else if (Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK3) { -- sif_co_mx = 158; -- sif_fi_mx = 208; -- sif_ic_bw = 3; -- sif_bb_bw = 0; -- sif_deemp = 2; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } else if ((Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I) -- || (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_I)) { -- sif_co_mx = 153; -- sif_fi_mx = 56; -- sif_ic_bw = 3; -- sif_bb_bw = 0; -- sif_deemp = 2; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } else if (Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG_NICAM) { -- sif_co_mx = 163; -- sif_fi_mx = 40; -- sif_ic_bw = 0; -- sif_bb_bw = 0; -- sif_deemp = 2; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } else if (Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L) { -- sif_co_mx = 159; -- sif_fi_mx = 200; -- sif_ic_bw = 3; -- sif_bb_bw = 0; -- sif_deemp = 0; -- sif_cfg_demod = (sound_format == 0) ? 1:2; -- sif_fm_gain = 5; -- } else if ((Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK) -- || (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_DK)) { -- sif_co_mx = 159; -- sif_fi_mx = 200; -- sif_ic_bw = 3; -- sif_bb_bw = 0; -- sif_deemp = 2; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } else if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M) { -- sif_co_mx = 182; -- sif_fi_mx = 16; -- sif_ic_bw = 1; -- sif_bb_bw = 0; -- sif_deemp = 1; -- sif_cfg_demod = (sound_format == 0) ? 0:2; -- sif_fm_gain = 3; -- } -- sif_fm_gain -= 2; /*avoid sound overflow@guanzhong*/ -- /*FE PATH*/ -- pr_info("ATV-DMD configure mixer\n"); -- if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) { -- tmp_int = (Tuner_IF_Frequency/125000); -- if (Tuner_Input_IF_inverted == 0x0) -- mixer1 = -tmp_int; -- else -- mixer1 = tmp_int; -- -- mixer3 = 0; -- mixer3_bypass = 0; -- } else { -- tmp_int = (Tuner_IF_Frequency/125000); -- pr_info("ATV-DMD configure mixer 1\n"); -- -- if (Tuner_Input_IF_inverted == 0x0) -- mixer1 = 0xe8 - tmp_int; -- else -- mixer1 = tmp_int - 0x18; -- -- pr_info("ATV-DMD configure mixer 2\n"); -- mixer3 = 0x30; -- mixer3_bypass = 0x1; -- } -- -- pr_info("ATV-DMD configure mixer 3\n"); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_MIXER_1, 0x0, mixer1); -- atv_dmd_wr_word(APB_BLOCK_ADDR_MIXER_3, 0x0, -- (((mixer3 & 0xff) << 8) | (mixer3_bypass & 0xff))); -- -- if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L) -- atv_dmd_wr_long(APB_BLOCK_ADDR_ADC_SE, 0x0, 0x03180e0f); -- else -- atv_dmd_wr_long(APB_BLOCK_ADDR_ADC_SE, 0x0, 0x03150e0f); -- if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_R840) { -- /*config pwm for tuner r840*/ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_ADC_SE, 1, 0xf); -- } -- -- /*GP Filter*/ -- pr_info("ATV-DMD configure GP_filter\n"); -- if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) { -- cv = gp_cv_g1; -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x0, -- (0x08000000 | (cv & 0x7fffff))); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x4, 0x04); -- for (i = 0; i < 9; i = i + 1) { -- /*super_coef = {gp_coeff_1[i*4],gp_coeff_1[i*4+1], -- gp_coeff_1[i*4+2],gp_coeff_1[i*4+3]};*/ -- super_coef0 = -- (((gp_coeff_1[i * 4 + 2] & 0xfff) << 20) | -- (gp_coeff_1[i * 4 + 3] & 0xfffff)); -- super_coef1 = -- (((gp_coeff_1[i * 4] & 0xf) << 28) | -- ((gp_coeff_1[i * 4 + 1] & 0xfffff) << 8) | -- ((gp_coeff_1[i * 4 + 2] >> 12) & 0xff)); -- super_coef2 = ((gp_coeff_1[i * 4] >> 4) & 0xffff); -- -- /*atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, -- 0x8,super_coef[79:48]);*/ -- /*atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, -- 0xC,super_coef[47:16]);*/ -- /*atv_dmd_wr_word(APB_BLOCK_ADDR_GP_VD_FLT, -- 0x10,super_coef[15:0]);*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x8, -- (((super_coef2 & 0xffff) << 16) | -- ((super_coef1 & 0xffff0000) >> 16))); -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0xC, -- (((super_coef1 & 0xffff) << 16) | -- ((super_coef0 & 0xffff0000) >> 16))); -- atv_dmd_wr_word(APB_BLOCK_ADDR_GP_VD_FLT, 0x10, -- (super_coef0 & 0xffff)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x05, i); -- } -- /*atv_dmd_wr_long -- (APB_BLOCK_ADDR_GP_VD_FLT,0x8,{gp_coeff_1[36],12'd0});*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x8, -- ((gp_coeff_1[36] & 0xfffff) << 12)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x05, 0x09); -- -- } else { -- cv = gp_cv_g1 - gp_cv_g2; -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x0, cv & 0x7fffff); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x4, 0x00); -- for (i = 0; i < 9; i = i + 1) { -- /*super_coef = {gp_coeff_1[i*4],gp_coeff_1[i*4+1], -- gp_coeff_1[i*4+2],gp_coeff_1[i*4+3]};*/ -- super_coef0 = -- (((gp_coeff_1[i * 4 + 2] & 0xfff) << 20) | -- (gp_coeff_1[i * 4 + 3] & 0xfffff)); -- super_coef1 = -- (((gp_coeff_1[i * 4] & 0xf) << 28) | -- ((gp_coeff_1[i * 4 + 1] & 0xfffff) << 8) | -- ((gp_coeff_1[i * 4 + 2] >> 12) & 0xff)); -- super_coef2 = ((gp_coeff_1[i * 4] >> 4) & 0xffff); -- -- /*atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, -- 0x8,super_coef[79:48]);*/ -- /*atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, -- 0xC,super_coef[47:16]);*/ -- /*atv_dmd_wr_word(APB_BLOCK_ADDR_GP_VD_FLT, -- 0x10,super_coef[15:0]);*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x8, -- (((super_coef2 & 0xffff) << 16) | -- ((super_coef1 & 0xffff0000) >> 16))); -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0xC, -- (((super_coef1 & 0xffff) << 16) | -- ((super_coef0 & 0xffff0000) >> 16))); -- atv_dmd_wr_word(APB_BLOCK_ADDR_GP_VD_FLT, 0x10, -- (super_coef0 & 0xffff)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x05, i); -- -- /*atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, -- 0x8,{gp_coeff_1[36],12'd0});*/ -- } -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x8, -- ((gp_coeff_1[36] & 0xfffff) << 12)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x05, 9); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x4, 0x01); -- -- for (i = 0; i < 9; i = i + 1) { -- /*super_coef = {gp_coeff_2[i*4],gp_coeff_2[i*4+1], -- gp_coeff_2[i*4+2],gp_coeff_2[i*4+3]};*/ -- super_coef0 = -- (((gp_coeff_2[i * 4 + 2] & 0xfff) << 20) | -- (gp_coeff_2[i * 4 + 3] & 0xfffff)); -- super_coef1 = -- (((gp_coeff_2[i * 4] & 0xf) << 28) | -- ((gp_coeff_2[i * 4 + 1] & 0xfffff) << 8) | -- ((gp_coeff_2[i * 4 + 2] >> 12) & 0xff)); -- super_coef2 = ((gp_coeff_2[i * 4] >> 4) & 0xffff); -- -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x8, -- (((super_coef2 & 0xffff) << 16) | -- ((super_coef1 & 0xffff0000) >> 16))); -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0xC, -- (((super_coef1 & 0xffff) << 16) | -- ((super_coef0 & 0xffff0000) >> 16))); -- atv_dmd_wr_word(APB_BLOCK_ADDR_GP_VD_FLT, 0x10, -- (super_coef0 & 0xffff)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x05, i); -- } -- -- atv_dmd_wr_long(APB_BLOCK_ADDR_GP_VD_FLT, 0x8, -- ((gp_coeff_2[36] & 0xfffff) << 12)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GP_VD_FLT, 0x05, 0x09); -- } -- -- /*CRVY*/ -- pr_info("ATV-DMD configure CRVY\n"); -- if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) { -- crvy_reg_1 = 0xFF; -- crvy_reg_2 = 0x00; -- } else { -- crvy_reg_1 = 0x04; -- crvy_reg_2 = 0x01; -- } -- -- atv_dmd_wr_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x29, crvy_reg_1); -- pr_info("ATV-DMD configure rcvy 2\n"); -- pr_info("ATV-DMD configure rcvy, crvy_reg_2 = %x\n", crvy_reg_2); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x20, crvy_reg_2); -- -- /*SOUND SUPPRESS*/ -- pr_info("ATV-DMD configure sound suppress\n"); -- -- if ((Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) || -- (sound_format == 0)) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_VD_IF, 0x02, 0x01); -- else -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_VD_IF, 0x02, 0x00); -- -- /*SIF*/ -- pr_info("ATV-DMD configure sif\n"); -- if (!(Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV)) { -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_IC_STD, 0x03, sif_ic_bw); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_IC_STD, 0x01, sif_fi_mx); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_IC_STD, 0x02, sif_co_mx); -- -- atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_2, 0x00, -- (((sif_bb_bw & 0xff) << 24) | -- ((sif_deemp & 0xff) << 16) | 0x0500 | -- sif_fm_gain)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_STG_2, 0x06, sif_cfg_demod); -- } -- -- if (Broadcast_Standard != AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) { -- if (sound_format == 0) { -- tmp_int = 0; -- atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_3, 0x00, -- (0x01000000 | (tmp_int & 0xffffff))); -- } else { -- tmp_int = (256 - sif_co_mx) << 13; -- atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_3, 0x00, -- (tmp_int & 0xffffff)); -- } -- } -- -- if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) { -- atv_dmd_wr_long(APB_BLOCK_ADDR_IC_AGC, 0x00, 0x02040E0A); -- atv_dmd_wr_word(APB_BLOCK_ADDR_IC_AGC, 0x04, 0x0F0D); -- } else if (sound_format == 0) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_IC_AGC, 0x00, 0x04); -- else if (Broadcast_Standard == -- AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L) { -- atv_dmd_wr_long(APB_BLOCK_ADDR_IC_AGC, 0x00, 0x0003140A); -- atv_dmd_wr_word(APB_BLOCK_ADDR_IC_AGC, 0x04, 0x1244); -- } else { -- atv_dmd_wr_long(APB_BLOCK_ADDR_IC_AGC, 0x00, 0x00040E0A); -- atv_dmd_wr_word(APB_BLOCK_ADDR_IC_AGC, 0x04, 0x0D68); -- } -- -- /*VAGC*/ -- pr_info("ATV-DMD configure vagc\n"); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VDAGC, 0x48, 0x9B6F2C00); -- /*bw select mode*/ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x37, 0x1C); -- /*disable prefilter*/ -- -- if (Broadcast_Standard == AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L) { -- atv_dmd_wr_word(APB_BLOCK_ADDR_VDAGC, 0x44, 0x4450); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x46, 0x44); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VDAGC, 0x4, 0x3E04FC); -- atv_dmd_wr_word(APB_BLOCK_ADDR_VDAGC, 0x3C, 0x4848); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x3E, 0x48); -- } else { -- atv_dmd_wr_word(APB_BLOCK_ADDR_VDAGC, 0x44, 0xB800); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x46, 0x08); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VDAGC, 0x4, 0x3C04FC); -- atv_dmd_wr_word(APB_BLOCK_ADDR_VDAGC, 0x3C, 0x1818); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x3E, 0x10); -- } -- -- /*tmp_real = $itor(Hz_Freq)/0.23841858; //TODO*/ -- /*tmp_int = $rtoi(tmp_real); //TODO*/ -- /*tmp_int = Hz_Freq/0.23841858; //TODO*/ -- /*tmp_int_2 = ((unsigned long)15625)*10000/23841858;*/ -- /*tmp_int_2 = ((unsigned long)Hz_Freq)*10000/23841858;*/ -- atv_dmd_wr_word(APB_BLOCK_ADDR_VDAGC, 0x10, -- (freq_hz_cvrt >> 8) & 0xffff); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x12, (freq_hz_cvrt & 0xff)); -- -- /*OUTPUT STAGE*/ -- pr_info("ATV-DMD configure output stage\n"); -- if (Broadcast_Standard != AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV) { -- atv_dmd_wr_byte(APB_BLOCK_ADDR_DAC_UPS, 0x0, 0x00); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_DAC_UPS, 0x1, 0x40); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_DAC_UPS, 0x2, 0x40); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_DAC_UPS, 0x4, 0xFA); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_DAC_UPS, 0x5, 0xFA); -- } -- -- /*GDE FILTER*/ -- pr_info("ATV-DMD configure gde filter\n"); -- if (GDE_Curve == 0) { -- gd_coeff[0] = 0x020; /*12'sd32;*/ -- gd_coeff[1] = 0xf5f; /*-12'sd161;*/ -- gd_coeff[2] = 0x1fe; /*12'sd510;*/ -- gd_coeff[3] = 0xc0b; /*-12'sd1013;*/ -- gd_coeff[4] = 0x536; /*12'sd1334;*/ -- gd_coeff[5] = 0xb34; /*-12'sd1228;*/ -- gd_bypass = 0x1; -- } else if (GDE_Curve == 1) { -- gd_coeff[0] = 0x8; /*12'sd8;*/ -- gd_coeff[1] = 0xfd5; /*-12'sd43;*/ -- gd_coeff[2] = 0x8d; /*12'sd141;*/ -- gd_coeff[3] = 0xe69; /*-12'sd407;*/ -- gd_coeff[4] = 0x1f1; /*12'sd497;*/ -- gd_coeff[5] = 0xe7e; /*-12'sd386;*/ -- gd_bypass = 0x1; -- } else if (GDE_Curve == 2) { -- gd_coeff[0] = 0x35; /*12'sd53;*/ -- gd_coeff[1] = 0xf41; /*-12'sd191;*/ -- gd_coeff[2] = 0x68; /*12'sd104;*/ -- gd_coeff[3] = 0xea5; /*-12'sd347;*/ -- gd_coeff[4] = 0x322; /*12'sd802;*/ -- gd_coeff[5] = 0x1bb; /*12'sd443;*/ -- gd_bypass = 0x1; -- } else if (GDE_Curve == 3) { -- gd_coeff[0] = 0xf; /*12'sd15;*/ -- gd_coeff[1] = 0xfb5; /*-12'sd75;*/ -- gd_coeff[2] = 0xcc; /*12'sd204;*/ -- gd_coeff[3] = 0xe51; -- gd_coeff[4] = 0x226; /*12'sd550;*/ -- gd_coeff[5] = 0xd02; -- gd_bypass = 0x1; -- } else -- gd_bypass = 0x0; -- -- if (gd_bypass == 0x0) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GDE_EQUAL, 0x0D, gd_bypass); -- else { -- for (i = 0; i < 6; i = i + 1) -- atv_dmd_wr_word(APB_BLOCK_ADDR_GDE_EQUAL, i << 1, -- gd_coeff[i]); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GDE_EQUAL, 0x0C, 0x01); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_GDE_EQUAL, 0x0D, gd_bypass); -- } -- -- /*PWM*/ -- pr_info("ATV-DMD configure pwm\n"); -- atv_dmd_wr_long(APB_BLOCK_ADDR_AGC_PWM, 0x00, 0x1f40); /*4KHz*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_AGC_PWM, 0x04, 0xc8); -- /*26 dB dynamic range*/ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_AGC_PWM, 0x09, 0xa); -- if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_R840) { -- /*config pwm for tuner r840*/ -- atv_dmd_wr_long(APB_BLOCK_ADDR_AGC_PWM, 0, 0xc80); -- /* guanzhong for Tuner AGC shock */ -- atv_dmd_wr_long(APB_BLOCK_ADDR_AGC_PWM, 0x08, 0x46180200); -- /* atv_dmd_wr_byte(APB_BLOCK_ADDR_ADC_SE,1,0xf);//Kd = 0xf */ -- } --} -- --void retrieve_adc_power(int *adc_level) --{ -- *adc_level = atv_dmd_rd_long(APB_BLOCK_ADDR_ADC_SE, 0x0c); -- /*adc_level = adc_level/32768*100;*/ -- *adc_level = (*adc_level) * 100 / 32768; --} -- --void retrieve_vpll_carrier_lock(int *lock) --{ -- unsigned int data; -- data = atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x43); -- *lock = (data & 0x1); --} --int retrieve_vpll_carrier_afc(void) --{ -- int data_ret, pll_lock, field_lock, line_lock, line_lock_strong; -- unsigned int data_h, data_l, data_exg = 0; -- pll_lock = atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x43)&0x1; -- field_lock = atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x4f)&0x4; -- line_lock = atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x4f)&0x10; -- line_lock_strong = atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x4f)&0x8; -- /* if((atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY,0x43)&0x1) == 1){ */ -- if ((pll_lock == 1) || (line_lock == 0x10)) { -- /*if pll unlock, afc is invalid*/ -- data_ret = 0xffff;/* 500; */ -- return data_ret; -- } -- data_h = atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x40); -- data_l = atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x41); -- data_exg = ((data_h&0x7) << 8) | data_l; -- if (data_h&0x8) { -- data_ret = (((~data_exg)&0x7ff) - 1); -- data_ret = data_ret*488*(-1)/1000; -- } else { -- data_ret = data_exg; -- data_ret = data_ret*488/1000; -- } -- if ((abs(data_ret) < 50) && (line_lock_strong == 0x8) && -- (field_lock == 0x4)) { -- data_ret = 100; -- return data_ret; -- } -- return data_ret; --} --void set_pll_lpf(unsigned int lock) --{ -- atv_dmd_wr_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x24, lock); --} -- --void retrieve_frequency_offset(int *freq_offset) --{ -- /*unsigned int data; -- data = atv_dmd_rd_word(APB_BLOCK_ADDR_CARR_RCVY,0x40); -- *freq_offset = (int)data;*/ -- unsigned int data_h, data_l, data_exg; -- int data_ret; -- data_h = atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x40); -- data_l = atv_dmd_rd_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x41); -- data_exg = ((data_h&0x7)<<8) | data_l; -- if (data_h&0x8) { -- data_ret = (((~data_exg) & 0x7ff) - 1); -- data_ret = data_ret*(-1); -- /* data_ret = data_ret*488*(-1) /1000; */ -- } else -- data_ret = data_exg;/* data_ret = data_ret*488/100; */ -- *freq_offset = data_ret; --} --EXPORT_SYMBOL(retrieve_frequency_offset); --void retrieve_video_lock(int *lock) --{ -- unsigned int data, wlock, slock; -- data = atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x4f); -- wlock = data & 0x10; -- slock = data & 0x80; -- *lock = wlock & slock; --} -- --void retrieve_fh_frequency(int *fh) --{ -- unsigned long data1, data2; -- data1 = atv_dmd_rd_word(APB_BLOCK_ADDR_VDAGC, 0x58); -- data2 = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x10); -- data1 = data1 >> 11; -- data2 = data2 >> 3; -- *fh = data1 + data2; --} --/*tune mix to adapt afc*/ --void atvdemod_afc_tune(void) --{ -- /* int adc_level,lock,freq_offset,fh; */ -- int freq_offset, lock, mix1_freq_cur, delta_mix1_freq; -- -- /* retrieve_adc_power(&adc_level); */ -- /* pr_info("adc_level: 0x%x\n",adc_level); */ -- retrieve_vpll_carrier_lock(&lock); -- mix1_freq_cur = atv_dmd_rd_byte(APB_BLOCK_ADDR_MIXER_1, 0x0); -- delta_mix1_freq = abs(mix1_freq_cur - mix1_freq); -- if ((lock&0x1) == 0) -- pr_info("%s visual carrier lock:locked\n", __func__); -- else -- pr_info("%s visual carrier lock:unlocked\n", __func__); -- /* set_pll_lpf(lock); */ -- retrieve_frequency_offset(&freq_offset); -- freq_offset = freq_offset*488/1000; -- /* pr_info("visual carrier offset:%d Hz\n", -- freq_offset*48828125/100000); */ -- /* retrieve_video_lock(&lock); */ -- if ((lock&0x1) == 1) { -- if (delta_mix1_freq == atvdemod_afc_range) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_MIXER_1, 0x0, mix1_freq); -- else if ((freq_offset >= atvdemod_afc_offset) && -- (delta_mix1_freq < atvdemod_afc_range)) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_MIXER_1, 0x0, -- mix1_freq_cur-1); -- else if ((freq_offset <= (-1)*atvdemod_afc_offset) && -- (delta_mix1_freq < atvdemod_afc_range-1)) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_MIXER_1, 0x0, -- mix1_freq_cur+1); -- /* pr_info("video lock:locked\n"); */ -- } -- /* retrieve_fh_frequency(&fh); */ -- /* pr_info("horizontal frequency:%d Hz\n",fh*190735/100000); */ --} --static enum amlatvdemod_snr_level_e aml_atvdemod_get_snr_level(void) --{ -- unsigned int snr_val, i, snr_d[8]; -- enum amlatvdemod_snr_level_e ret; -- unsigned long fsnr; -- snr_val = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x50)>>8; -- fsnr = snr_val; -- for (i = 1; i < 8; i++) { -- snr_d[i] = snr_d[i-1]; -- fsnr = fsnr + snr_d[i]; -- } -- snr_d[0] = snr_val; -- fsnr = fsnr >> 3; -- if (fsnr < 316) -- ret = high; -- else if (fsnr < 31600) -- ret = ok_plus; -- else if (fsnr < 158000) -- ret = ok_minus; -- else if (fsnr < 700000) -- ret = low; -- else -- ret = very_low; -- return ret; --} -- --void atvdemod_monitor_serice(void) --{ -- enum amlatvdemod_snr_level_e snr_level; -- unsigned int vagc_bw_typ, vagc_bw_fast, vpll_kptrack, vpll_kitrack; -- unsigned int agc_register, vfmat_reg, agc_pll_kptrack, agc_pll_kitrack; -- /*1.get current snr*/ -- snr_level = aml_atvdemod_get_snr_level(); -- /*2.*/ -- if (snr_level > very_low) { -- vagc_bw_typ = 0x1818; -- vagc_bw_fast = (snr_level == low) ? 0x18:0x10; -- vpll_kptrack = 0x05; -- vpll_kitrack = 0x0c; -- agc_pll_kptrack = 0x6; -- agc_pll_kitrack = 0xc; -- } else { -- vagc_bw_typ = 0x6f6f; -- vagc_bw_fast = 0x6f; -- vpll_kptrack = 0x06; -- vpll_kitrack = 0x0e; -- agc_pll_kptrack = 0x8; -- agc_pll_kitrack = 0xf; -- } -- atv_dmd_wr_word(APB_BLOCK_ADDR_VDAGC, 0x3c, vagc_bw_typ); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x3e, vagc_bw_fast); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x23, vpll_kptrack); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_CARR_RCVY, 0x24, vpll_kitrack); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x0c, -- ((atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x0c) & 0xf0)| -- agc_pll_kptrack)); -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x0d, -- ((atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x0d) & 0xf0)| -- agc_pll_kitrack)); -- /*3.*/ -- agc_register = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x28); -- if (snr_level < low) { -- agc_register = ((agc_register&0xff80fe03) | (25 << 16) | -- (15 << 2)); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VDAGC, 0x28, agc_register); -- } else if (snr_level > low) { -- agc_register = ((agc_register&0xff80fe03) | (38 << 16) | -- (30 << 2)); -- atv_dmd_wr_long(APB_BLOCK_ADDR_VDAGC, 0x28, agc_register); -- } -- /*4.*/ -- if (snr_level < ok_minus) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x47, -- (atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x47) & 0x7f)); -- else -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VDAGC, 0x47, -- (atv_dmd_rd_byte(APB_BLOCK_ADDR_VDAGC, 0x47) | 0x80)); -- /*5.vformat*/ -- if (snr_level < ok_minus) { -- if (atv_dmd_rd_byte(APB_BLOCK_ADDR_VFORMAT, 0xe) != 0xf) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VFORMAT, 0xe, 0xf); -- } else if (snr_level > ok_minus) { -- vfmat_reg = atv_dmd_rd_word(APB_BLOCK_ADDR_VFORMAT, 0x16); -- if ((vfmat_reg << 4) < 0xf000) { -- if (atv_dmd_rd_byte(APB_BLOCK_ADDR_VFORMAT, 0xe) == -- 0x0f) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VFORMAT, 0xe, -- 0x6); -- else -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VFORMAT, 0xe, -- 0x6); -- } -- } else { -- if (atv_dmd_rd_byte(APB_BLOCK_ADDR_VFORMAT, 0xe) == 0x0f) -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VFORMAT, 0xe, 0xe); -- else -- atv_dmd_wr_byte(APB_BLOCK_ADDR_VFORMAT, 0xe, 0xe); -- } --} -- --static int atvdemod_get_snr(struct dvb_frontend *fe) --{ -- unsigned int snr_val = 0; -- int ret = 0; -- snr_val = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x50) >> 8; -- /* snr_val:900000~0xffffff,ret:5~15 */ -- if (snr_val > 900000) -- ret = 15 - (snr_val - 900000)*10/(0xffffff - 900000); -- /* snr_val:158000~900000,ret:15~30 */ -- else if (snr_val > 158000) -- ret = 30 - (snr_val - 158000)*15/(900000 - 158000); -- /* snr_val:31600~158000,ret:30~50 */ -- else if (snr_val > 31600) -- ret = 50 - (snr_val - 31600)*20/(158000 - 31600); -- /* snr_val:316~31600,ret:50~80 */ -- else if (snr_val > 316) -- ret = 80 - (snr_val - 316)*30/(31600 - 316); -- /* snr_val:0~316,ret:80~100 */ -- else -- ret = 100 - (316 - snr_val)*20/316; -- return ret; --} -- --void atvdemod_det_snr_serice(void) --{ -- snr_val = atvdemod_get_snr(NULL); --} -- --void atvdemod_timer_hander(unsigned long arg) --{ -- if (atvdemod_timer_en == 0) -- return; -- atvdemod_timer.expires = jiffies + ATVDEMOD_INTERVAL*10;/*100ms timer*/ -- add_timer(&atvdemod_timer); -- if (atvdemod_afc_en) -- atvdemod_afc_tune(); -- if (atvdemod_monitor_en) -- atvdemod_monitor_serice(); -- if (audio_det_en) -- aml_atvdemod_overmodule_det(); -- if (atvdemod_det_snr_en) -- atvdemod_det_snr_serice(); --} -- --int atvdemod_clk_init(void) --{ -- /* clocks_set_hdtv (); */ -- /* 1.set system clock */ --#if 0 /* now set pll in tvafe_general.c */ -- if (is_meson_txl_cpu()) { -- amlatvdemod_hiu_reg_write(HHI_VDAC_CNTL0, 0x6e0201); -- amlatvdemod_hiu_reg_write(HHI_VDAC_CNTL1, 0x8); -- /* for TXL(T962) */ -- pr_err("%s in TXL\n", __func__); -- -- /* W_HIU_REG(HHI_ADC_PLL_CNTL, 0x30c54260); */ -- #if 0 -- W_HIU_REG(HHI_ADC_PLL_CNTL, 0x30f14250); -- W_HIU_REG(HHI_ADC_PLL_CNTL1, 0x22000442); -- W_HIU_REG(HHI_ADC_PLL_CNTL2, 0x5ba00380); -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0xac6a2114); -- W_HIU_REG(HHI_ADC_PLL_CNTL4, 0x02953004); -- W_HIU_REG(HHI_ADC_PLL_CNTL5, 0x00030a00); -- W_HIU_REG(HHI_ADC_PLL_CNTL6, 0x00005000); -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0x2c6a2114); -- #else /* get from feijun 2015/07/19 */ -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0x4a6a2110); -- W_HIU_REG(HHI_ADC_PLL_CNTL, 0x30f14250); -- W_HIU_REG(HHI_ADC_PLL_CNTL1, 0x22000442); -- /*0x5ba00380 from pll;0x5ba00384 clk -- form crystal*/ -- W_HIU_REG(HHI_ADC_PLL_CNTL2, 0x5ba00384); -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0x4a6a2110); -- W_HIU_REG(HHI_ADC_PLL_CNTL4, 0x02913004); -- W_HIU_REG(HHI_ADC_PLL_CNTL5, 0x00034a00); -- W_HIU_REG(HHI_ADC_PLL_CNTL6, 0x00005000); -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0xca6a2110); -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0x4a6a2110); -- #endif -- W_HIU_REG(HHI_DADC_CNTL, 0x00102038); -- W_HIU_REG(HHI_DADC_CNTL2, 0x00000406); -- W_HIU_REG(HHI_DADC_CNTL3, 0x00082183); -- -- } else { -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0xca2a2110); -- W_HIU_REG(HHI_ADC_PLL_CNTL4, 0x2933800); -- W_HIU_REG(HHI_ADC_PLL_CNTL, 0xe0644220); -- W_HIU_REG(HHI_ADC_PLL_CNTL2, 0x34e0bf84); -- W_HIU_REG(HHI_ADC_PLL_CNTL3, 0x4a2a2110); -- -- W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x80); -- /* TVFE reset */ -- W_HIU_BIT(RESET1_REGISTER, 1, 7, 1); -- } --#endif -- W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x80); -- -- /* read_version_register(); */ -- -- /*2.set atv demod top page control register*/ -- atv_dmd_input_clk_32m(); -- atv_dmd_wr_long(APB_BLOCK_ADDR_TOP, ATV_DMD_TOP_CTRL, 0x1037); -- atv_dmd_wr_long(APB_BLOCK_ADDR_TOP, (ATV_DMD_TOP_CTRL1 << 2), 0x1f); -- -- /*3.configure atv demod*/ -- check_communication_interface(); -- power_on_receiver(); -- pr_err("%s done\n", __func__); -- -- return 0; --} -- --int atvdemod_init(void) --{ -- /* unsigned long data32; */ -- if (atvdemod_timer_en == 1) { -- if (timer_init_flag == 1) { -- del_timer_sync(&atvdemod_timer); -- timer_init_flag = 0; -- } -- } -- -- /* 1.set system clock when atv enter*/ -- -- configure_receiver(broad_std, if_freq, if_inv, gde_curve, sound_format); -- atv_dmd_misc(); -- /*4.software reset*/ -- atv_dmd_soft_reset(); -- atv_dmd_soft_reset(); -- atv_dmd_soft_reset(); -- atv_dmd_soft_reset(); -- -- /* ????? -- while (!all_lock) { -- data32 = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC,0x13<<2); -- if ((data32 & 0x1c) == 0x0) { -- all_lock = 1; -- } -- delay_us(400); -- }*/ -- #if 1/* temp mark */ -- if (atvdemod_timer_en == 1) { -- /*atvdemod timer hander*/ -- init_timer(&atvdemod_timer); -- /* atvdemod_timer.data = (ulong) devp; */ -- atvdemod_timer.function = atvdemod_timer_hander; -- /* after 3s enable demod auto detect */ -- atvdemod_timer.expires = jiffies + ATVDEMOD_INTERVAL*300; -- add_timer(&atvdemod_timer); -- mix1_freq = atv_dmd_rd_byte(APB_BLOCK_ADDR_MIXER_1, 0x0); -- timer_init_flag = 1; -- } -- #endif -- pr_info("delay done\n"); -- return 0; --} --void atvdemod_uninit(void) --{ -- /* del the timer */ -- if (atvdemod_timer_en == 1) { -- if (timer_init_flag == 1) { -- del_timer_sync(&atvdemod_timer); -- timer_init_flag = 0; -- } -- } --} -- --void atv_dmd_set_std(void) --{ -- v4l2_std_id ptstd = amlatvdemod_devp->parm.std; -- /* set broad standard of tuner*/ -- if ((ptstd & V4L2_COLOR_STD_PAL) && ((ptstd & V4L2_STD_B) || -- (ptstd & V4L2_STD_G))) { -- amlatvdemod_devp->fre_offset = 2250000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_50HZ_VERT; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG; -- if_freq = 3250000; -- gde_curve = 2; -- } else if ((ptstd & V4L2_COLOR_STD_PAL) && (ptstd & V4L2_STD_DK)) { -- amlatvdemod_devp->fre_offset = 2250000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_50HZ_VERT; -- if_freq = 3250000; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK; -- gde_curve = 3; -- } else if ((ptstd & V4L2_COLOR_STD_PAL) && (ptstd & V4L2_STD_PAL_M)) { -- amlatvdemod_devp->fre_offset = 2250000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M; -- if_freq = 4250000; -- gde_curve = 0; -- } else if ((ptstd & V4L2_COLOR_STD_NTSC) && (ptstd & V4L2_STD_NTSC_M)) { -- amlatvdemod_devp->fre_offset = 1750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT; -- if_freq = 4250000; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC; -- gde_curve = 0; -- } else if ((ptstd & V4L2_COLOR_STD_NTSC) && (ptstd & V4L2_STD_DK)) { -- amlatvdemod_devp->fre_offset = 1750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT; -- if_freq = 4250000; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_DK; -- gde_curve = 0; -- } else if ((ptstd & V4L2_COLOR_STD_NTSC) && (ptstd & V4L2_STD_BG)) { -- amlatvdemod_devp->fre_offset = 1750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT; -- if_freq = 4250000; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_BG; -- gde_curve = 0; -- } else if ((ptstd & V4L2_COLOR_STD_NTSC) && (ptstd & V4L2_STD_PAL_I)) { -- amlatvdemod_devp->fre_offset = 1750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_60HZ_VERT; -- if_freq = 4250000; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_I; -- gde_curve = 0; -- } else if ((ptstd & V4L2_COLOR_STD_NTSC) && -- (ptstd & V4L2_STD_NTSC_M_JP)) { -- amlatvdemod_devp->fre_offset = 1750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_50HZ_VERT; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_J; -- if_freq = 4250000; -- gde_curve = 0; -- } else if ((ptstd & V4L2_COLOR_STD_PAL) && (ptstd & V4L2_STD_PAL_I)) { -- amlatvdemod_devp->fre_offset = 2750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_50HZ_VERT; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I; -- if_freq = 3250000; -- gde_curve = 4; -- } else if (ptstd & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) { -- amlatvdemod_devp->fre_offset = 2750000; -- freq_hz_cvrt = AML_ATV_DEMOD_FREQ_50HZ_VERT; -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L; -- gde_curve = 4; -- } -- if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_R840) { -- if_freq = amlatvdemod_devp->parm.if_freq; -- if_inv = amlatvdemod_devp->parm.if_inv; -- } else if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_MXL661) { -- if_freq = amlatvdemod_devp->parm.if_freq; -- if_inv = amlatvdemod_devp->parm.if_inv; -- } else if (amlatvdemod_devp->parm.tuner_id == AM_TUNER_SI2151) { -- if_freq = amlatvdemod_devp->parm.if_freq; -- if_inv = amlatvdemod_devp->parm.if_inv; -- } -- pr_info -- ("[atvdemod..]%s: broad_std %d,freq_hz_cvrt:0x%x,fre_offset:%d.\n", -- __func__, broad_std, freq_hz_cvrt, amlatvdemod_devp->fre_offset); -- if (atvdemod_init()) -- pr_info("[atvdemod..]%s: atv restart error.\n", __func__); --} -- --int aml_audiomode_autodet(struct dvb_frontend *fe) --{ -- unsigned long carrier_power = 0; -- unsigned long carrier_power_max = 0; -- unsigned long carrier_power_average_max = 0; -- unsigned long carrier_power_average[4] = {0}; -- unsigned long reg_addr = 0x03 , temp_data; -- int carrier_lock_count = 0; -- int lock = 0; -- int broad_std_final = 0; -- int num = 0, i = 0, final_id = 0; -- int delay_ms = 10, delay_ms_default = 10; -- int cur_std = ID_PAL_DK; -- struct dtv_frontend_properties -- *p = fe != NULL ? &fe->dtv_property_cache:NULL; --#if 0 -- temp_data = atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data | 0x80;/* 0x40 */ -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); --#endif -- -- switch (broad_std) { -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M: -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_DK: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_I: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_BG: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_M: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC: -- -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_M; -- atvdemod_init(); -- temp_data = atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data & (~0x80); /* 0xbf; */ -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- /* pr_err("%s, SECAM ,audio set SECAM_L\n", __func__); */ -- return broad_std; -- -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK2: -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK3: -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L; -- atvdemod_init(); -- temp_data = atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- -- temp_data = temp_data & (~0x80); /* 0xbf; */ -- -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- /* pr_err("%s, SECAM ,audio set SECAM_L\n", __func__); */ -- return broad_std; -- default: -- pr_err("unsupport broadcast_standard!!!\n"); -- temp_data = atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data & (~0x80); /* 0xbf; */ -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- return broad_std; -- } -- /* ----------------read carrier_power--------------------- */ -- /* SIF_STG_2[0x09],address 0x03 */ -- while (1) { -- if (num >= 4) { -- temp_data = -- atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data & (~0x80); -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, -- temp_data); -- carrier_power_max = carrier_power_average[0]; -- for (i = 0; i < ID_MAX; i++) { -- if (carrier_power_max -- < carrier_power_average[i]) { -- carrier_power_max = -- carrier_power_average[i]; -- final_id = i; -- } -- } -- switch (final_id) { -- case ID_PAL_I: -- broad_std_final = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I; -- break; -- case ID_PAL_BG: -- broad_std_final = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG; -- break; -- case ID_PAL_M: -- broad_std_final = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M; -- break; -- case ID_PAL_DK: -- broad_std_final = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK; -- break; -- } -- carrier_power_average_max = carrier_power_max; -- broad_std = broad_std_final; -- pr_err("%s:broad_std:%d,carrier_power_average_max:%lu\n", -- __func__, broad_std, carrier_power_average_max); -- if (carrier_power_average_max < 150) -- pr_err("%s,carrier too low error\n", __func__); -- if (broad_std == AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M) { -- /*the max except palm*/ -- carrier_power_average[final_id] = 0; -- final_id = 0; -- carrier_power_max = carrier_power_average[0]; -- for (i = 0; i < ID_MAX; i++) { -- if (carrier_power_max -- < carrier_power_average[i]) { -- carrier_power_max = -- carrier_power_average[i]; -- final_id = i; -- } -- } -- switch (final_id) { -- case ID_PAL_I: -- broad_std_except_pal_m = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I; -- break; -- case ID_PAL_BG: -- broad_std_except_pal_m = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG; -- break; -- case ID_PAL_DK: -- broad_std_except_pal_m = -- AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK; -- break; -- } -- } -- if (p != NULL) { -- p->analog.std = V4L2_COLOR_STD_PAL; -- switch (broad_std) { -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK: -- p->analog.std |= V4L2_STD_PAL_DK; -- p->analog.audmode = V4L2_STD_PAL_DK; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I: -- p->analog.std |= V4L2_STD_PAL_I; -- p->analog.audmode = V4L2_STD_PAL_I; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG: -- p->analog.std |= V4L2_STD_PAL_BG; -- p->analog.audmode = V4L2_STD_PAL_BG; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M: -- p->analog.std |= V4L2_STD_PAL_M; -- p->analog.audmode = V4L2_STD_PAL_M; -- break; -- default: -- p->analog.std |= V4L2_STD_PAL_DK; -- p->analog.audmode = V4L2_STD_PAL_DK; -- } -- p->frequency += 1; -- fe->ops.set_frontend(fe); -- } -- return broad_std; -- } -- switch (broad_std) { -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK: -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I; -- cur_std = ID_PAL_I; -- if (p != NULL) { -- p->analog.std = -- V4L2_COLOR_STD_PAL | V4L2_STD_PAL_I; -- p->frequency += 1; -- p->analog.audmode = V4L2_STD_PAL_I; -- } -- delay_ms = delay_ms_default; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I: -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG; -- cur_std = ID_PAL_BG; -- if (p != NULL) { -- p->analog.std = -- V4L2_COLOR_STD_PAL | V4L2_STD_PAL_BG; -- p->frequency += 1; -- p->analog.audmode = V4L2_STD_PAL_BG; -- } -- delay_ms = delay_ms_default; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG: -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M; -- cur_std = ID_PAL_M; -- if (p != NULL) { -- p->analog.std = -- V4L2_COLOR_STD_PAL | V4L2_STD_PAL_M; -- p->frequency += 1; -- p->analog.audmode = V4L2_STD_PAL_M; -- } -- delay_ms = delay_ms_default; -- break; -- case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M: -- broad_std = AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK; -- cur_std = ID_PAL_DK; -- if (p != NULL) { -- p->analog.std = -- V4L2_COLOR_STD_PAL | V4L2_STD_PAL_DK; -- p->frequency += 1; -- p->analog.audmode = V4L2_STD_PAL_DK; -- } -- delay_ms = delay_ms_default; -- break; -- -- default: -- pr_err("unsupport broadcast_standard!!!\n"); -- break; -- } -- if (p != NULL) -- fe->ops.set_frontend(fe); -- /* atvdemod_init(); //set_frontend has already been called it */ -- -- /* enable audio detect function */ -- temp_data = atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data | 0x80;/* 0x40 */ -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- -- usleep_range(delay_ms*1000, delay_ms*1000+100); -- -- carrier_lock_count = 0; -- i = 4; -- while (i--) { -- retrieve_vpll_carrier_lock(&lock); -- if (lock == 0) -- break; -- carrier_lock_count++; -- if (carrier_lock_count >= 20) { -- pr_err("%s step2, retrieve_vpll_carrier_lock failed\n", -- __func__); -- /* return broad_std; */ -- } -- usleep_range(6000, 9000); -- } -- /* ----------------read carrier_power--------------------- */ -- for (i = 0; i < 100; i++) { -- carrier_power = -- atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, -- reg_addr); -- carrier_power_max += carrier_power; -- } -- carrier_power = carrier_power_max/i; -- carrier_power_max = 0; -- pr_err("[amlatvdemod.. %d,std:%d ]%s: atvdemo audio carrier power report:%lu. @@@@@@@@@@\n", -- num, broad_std, __func__, carrier_power); -- carrier_power_average[cur_std] += carrier_power; -- num++; -- } -- -- return broad_std; --} -- --void aml_audio_valume_gain_set(unsigned int audio_gain) --{ -- unsigned long audio_gain_data , temp_data; -- if (audio_gain > 0xfff) { -- pr_err("Error: atv in gain max 7.998, min 0.002! gain = value/512\n"); -- pr_err("value (0~0xfff)\n"); -- return; -- } -- audio_gain_data = audio_gain & 0xfff; -- temp_data = atv_dmd_rd_word(APB_BLOCK_ADDR_MONO_PROC, 0x52); -- temp_data = (temp_data & 0xf000) | audio_gain_data; -- atv_dmd_wr_word(APB_BLOCK_ADDR_MONO_PROC, 0x52, temp_data); --} -- --unsigned int aml_audio_valume_gain_get(void) --{ -- unsigned long audio_gain_data; -- audio_gain_data = atv_dmd_rd_word(APB_BLOCK_ADDR_MONO_PROC, 0x52); -- audio_gain_data = audio_gain_data & 0xfff; -- return audio_gain_data; --} -- --void aml_atvdemod_overmodule_det(void) --{ -- unsigned long temp_data , temp_data2;/* , temp_data3 , temp_data4; */ -- unsigned long counter_report; -- int carrier_lock_count = 0; -- int vlock = 0; -- switch (audio_det_mode) { -- case AUDIO_AUTO_DETECT: -- aml_audiomode_autodet(NULL); -- return; --#if 0 -- while (1) { -- retrieve_vpll_carrier_lock(&vlock); -- if (vlock) -- break; -- carrier_lock_count++; -- if (carrier_lock_count >= 1000) -- return; -- /* ------------whether need timer delays between the detect lock---- */ -- } -- /* -----------------enable auto_adjust_en------------- */ -- temp_data = atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data | 0x100; -- /* set the bit 9 of the temp_data to 1 */ -- atv_dmd_wr_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- /* -----------------enable auto_adjust_en end----------------- */ -- /* -----------------begain to set ov_cnt_en enable------------- */ -- temp_data2 = atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data2 = temp_data2 | 0x80; -- /* set the bit 8 of the temp_data to 1 */ -- atv_dmd_wr_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data2); -- /* ------------------set ov_cnt_en enable end---------------- */ -- udelay(1000);/* timer delay needed , */ -- /* ------------------------------------------------------------ */ -- /* -----------------disable auto_adjust_en------------- */ -- temp_data3 = atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data3 = temp_data3 & 0xfeff; -- /* set the bit 9 of the temp_data to 0 */ -- atv_dmd_wr_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data3); -- /* -----------------disable auto_adjust_en end------------ */ -- /* -----------------begain to set ov_cnt_en disable------------- */ -- temp_data4 = atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data4 = temp_data4 & 0xff7f; -- /* set the bit 8 of the temp_data to 0 */ -- atv_dmd_wr_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data4); -- break; -- /* ------------------set ov_cnt_en disable end------ */ --#endif -- case AUDIO_MANUAL_DETECT: -- while (1) { -- retrieve_vpll_carrier_lock(&vlock); -- if (vlock) -- break; -- carrier_lock_count++; -- if (carrier_lock_count >= 1000) -- return; -- } -- -- /* -----------------begain to set ov_cnt_en enable---- */ -- temp_data = atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data = temp_data | 0x80; -- /* set the bit 8 of the temp_data to 1 */ -- atv_dmd_wr_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- /* ------------------set ov_cnt_en enable end--------------- */ -- /* -----------------disable auto_adjust_en------------- */ -- temp_data2 = atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- temp_data2 = temp_data2 & 0xfeff; -- /* set the bit 9 of the temp_data to 0 */ -- atv_dmd_wr_word(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data2); -- /* -----------------disable auto_adjust_en end------------ */ -- udelay(1000);/* timer delay needed , */ -- /* ------------------------------------------------------- */ -- counter_report = -- atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x04); -- -- while (counter_report > over_threshold) { -- -- unsigned long shift_gain , shift_gain_report; -- temp_data2 = atv_dmd_rd_byte( -- APB_BLOCK_ADDR_SIF_STG_2, 0x00); -- shift_gain = temp_data2 & 0x07; -- shift_gain--; -- temp_data2 = (temp_data2 & 0xf8) | shift_gain; -- atv_dmd_wr_byte(APB_BLOCK_ADDR_SIF_STG_2, 0x00, -- temp_data2); -- shift_gain_report = ( -- (atv_dmd_rd_long(APB_BLOCK_ADDR_SIF_STG_2, 0x04) -- & 0x00070000) >> 16); -- -- if (shift_gain_report != shift_gain) -- pr_info("[atvdemo...]:set shift_gain error\n"); -- /* ------------------timer delay needed- */ -- udelay(1000);/* timer delay needed , */ -- /* ----------------------- */ -- counter_report = -- atv_dmd_rd_word(APB_BLOCK_ADDR_SIF_STG_2, 0x04); -- } -- break; -- default: -- pr_info("invalid over_module_det mode!!!\n"); -- break; -- } --} -- --void aml_fix_PWM_adjust(int enable) --{ -- unsigned long temp_data; -- /* -- temp_data = atv_dmd_rd_byte(APB_BLOCK_ADDR_AGC_PWM, 0x08); -- temp_data = temp_data | 0x01; -- atv_dmd_wr_byte(APB_BLOCK_ADDR_AGC_PWM, 0x08, temp_data); -- */ -- temp_data = atv_dmd_rd_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02); -- if (enable) -- temp_data = temp_data & ~((0x3)<<8); -- else -- temp_data = temp_data & ~((0x1)<<9); -- -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- if (enable) { -- temp_data = temp_data | ((0x3)<<8); -- atv_dmd_wr_reg(APB_BLOCK_ADDR_SIF_STG_2, 0x02, temp_data); -- } --} -- -- -diff --git a/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_func.h b/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_func.h -deleted file mode 100644 -index 0c1c9d9..0000000 ---- a/drivers/amlogic/dvb_tv/amlatvdemod/atvdemod_func.h -+++ /dev/null -@@ -1,318 +0,0 @@ --/* -- * ATVDEMOD Device Driver -- * -- * Author: dezhi kong -- * -- * -- * Copyright (C) 2014 Amlogic Inc. -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License version 2 as -- * published by the Free Software Foundation. -- */ -- --#ifndef __ATVDEMOD_FUN_H --#define __ATVDEMOD_FUN_H -- --/*#include "../aml_fe.h"*/ --#include --#include "../aml_fe.h" --#include -- --/*#define TVFE_APB_BASE_ADDR 0xd0046000*/ --#define ATV_DMD_APB_BASE_ADDR 0xc8008000 --#define ATV_DMD_APB_BASE_ADDR_GXTVBB 0xc8840000 -- --#define HHI_ATV_DMD_SYS_CLK_CNTL 0x10f3 -- --extern int atvdemod_debug_en; --extern struct amlatvdemod_device_s *amlatvdemod_devp; --extern unsigned int reg_23cf; /* IIR filter */ --extern int broad_std_except_pal_m; --#undef pr_info --#define pr_info(args...)\ -- do {\ -- if (atvdemod_debug_en)\ -- printk(args);\ -- } while (0) --#undef pr_dbg --#define pr_dbg(a...) \ -- do {\ -- if (1)\ -- printk(a);\ -- } while (0) -- --#define ATVDEMOD_INTERVAL (HZ/100) /*10ms, #define HZ 100*/ -- --extern int amlatvdemod_reg_read(unsigned int reg, unsigned int *val); --extern int amlatvdemod_reg_write(unsigned int reg, unsigned int val); --extern int amlatvdemod_hiu_reg_read(unsigned int reg, unsigned int *val); --extern int amlatvdemod_hiu_reg_write(unsigned int reg, unsigned int val); -- --static inline uint32_t R_ATVDEMOD_REG(uint32_t reg) --{ -- unsigned int val; -- amlatvdemod_reg_read(reg, &val); -- return val; --} -- --static inline void W_ATVDEMOD_REG(uint32_t reg, -- const uint32_t val) --{ -- amlatvdemod_reg_write(reg, val); --} -- --static inline void W_ATVDEMOD_BIT(uint32_t reg, -- const uint32_t value, -- const uint32_t start, -- const uint32_t len) --{ -- W_ATVDEMOD_REG(reg, ((R_ATVDEMOD_REG(reg) & -- ~(((1L << (len)) - 1) << (start))) | -- (((value) & ((1L << (len)) - 1)) << (start)))); --} -- --static inline uint32_t R_ATVDEMOD_BIT(uint32_t reg, -- const uint32_t start, -- const uint32_t len) --{ -- uint32_t val; -- -- val = ((R_ATVDEMOD_REG(reg) >> (start)) & ((1L << (len)) - 1)); -- -- return val; --} -- --static inline uint32_t R_HIU_REG(uint32_t reg) --{ -- unsigned int val; -- amlatvdemod_hiu_reg_read(reg, &val); -- return val; --} -- --static inline void W_HIU_REG(uint32_t reg, -- const uint32_t val) --{ -- amlatvdemod_hiu_reg_write(reg, val); --} -- --static inline void W_HIU_BIT(uint32_t reg, -- const uint32_t value, -- const uint32_t start, -- const uint32_t len) --{ -- W_HIU_REG(reg, ((R_HIU_REG(reg) & -- ~(((1L << (len)) - 1) << (start))) | -- (((value) & ((1L << (len)) - 1)) << (start)))); --} -- --static inline uint32_t R_HIU_BIT(uint32_t reg, -- const uint32_t start, -- const uint32_t len) --{ -- uint32_t val; -- -- val = ((R_HIU_REG(reg) >> (start)) & ((1L << (len)) - 1)); -- -- return val; --} -- --enum broadcast_standard_e { -- ATVDEMOD_STD_NTSC = 0, -- ATVDEMOD_STD_NTSC_J, -- ATVDEMOD_STD_PAL_M, -- ATVDEMOD_STD_PAL_BG, -- ATVDEMOD_STD_DTV, -- ATVDEMOD_STD_SECAM_DK2, -- ATVDEMOD_STD_SECAM_DK3, -- ATVDEMOD_STD_PAL_BG_NICAM, -- ATVDEMOD_STD_PAL_DK_CHINA, -- ATVDEMOD_STD_SECAM_L, -- ATVDEMOD_STD_PAL_I, -- ATVDEMOD_STD_PAL_DK1, -- ATVDEMOD_STD_MAX, --}; --enum gde_curve_e { -- ATVDEMOD_CURVE_M = 0, -- ATVDEMOD_CURVE_A, -- ATVDEMOD_CURVE_B, -- ATVDEMOD_CURVE_CHINA, -- ATVDEMOD_CURVE_MAX, --}; --enum sound_format_e { -- ATVDEMOD_SOUND_STD_MONO = 0, -- ATVDEMOD_SOUND_STD_NICAM, -- ATVDEMOD_SOUND_STD_MAX, --}; --extern void atv_dmd_wr_reg(unsigned char block, unsigned char reg, -- unsigned long data); --extern unsigned long atv_dmd_rd_reg(unsigned char block, unsigned char reg); --extern unsigned long atv_dmd_rd_byte(unsigned long block_address, -- unsigned long reg_addr); --extern unsigned long atv_dmd_rd_word(unsigned long block_address, -- unsigned long reg_addr); --extern unsigned long atv_dmd_rd_long(unsigned long block_address, -- unsigned long reg_addr); --extern void atv_dmd_wr_long(unsigned long block_address, -- unsigned long reg_addr, -- unsigned long data); --extern void atv_dmd_wr_word(unsigned long block_address, -- unsigned long reg_addr, -- unsigned long data); --extern void atv_dmd_wr_byte(unsigned long block_address, -- unsigned long reg_addr, -- unsigned long data); --extern void set_audio_gain_val(int val); --extern void set_video_gain_val(int val); --extern void atv_dmd_soft_reset(void); --extern void atv_dmd_input_clk_32m(void); --extern void read_version_register(void); --extern void check_communication_interface(void); --extern void power_on_receiver(void); --extern void atv_dmd_misc(void); --extern void configure_receiver(int Broadcast_Standard, -- unsigned int Tuner_IF_Frequency, -- int Tuner_Input_IF_inverted, int GDE_Curve, -- int sound_format); --extern int atvdemod_clk_init(void); --extern int atvdemod_init(void); --extern void atvdemod_uninit(void); --extern void atv_dmd_set_std(void); --extern void retrieve_vpll_carrier_lock(int *lock); --extern void retrieve_video_lock(int *lock); --extern int retrieve_vpll_carrier_afc(void); -- --extern int get_atvdemod_snr_val(void); --extern int aml_atvdemod_get_snr(struct dvb_frontend *fe); -- --/*atv demod block address*/ --/*address interval is 4, because it's 32bit interface, -- but the address is in byte*/ --#define ATV_DMD_TOP_CTRL 0x0 --#define ATV_DMD_TOP_CTRL1 0x4 --#define ATV_DMD_RST_CTRL 0x8 -- --#define APB_BLOCK_ADDR_SYSTEM_MGT 0x0 --#define APB_BLOCK_ADDR_AA_LP_NOTCH 0x1 --#define APB_BLOCK_ADDR_MIXER_1 0x2 --#define APB_BLOCK_ADDR_MIXER_3 0x3 --#define APB_BLOCK_ADDR_ADC_SE 0x4 --#define APB_BLOCK_ADDR_PWR_ANL 0x5 --#define APB_BLOCK_ADDR_CARR_RCVY 0x6 --#define APB_BLOCK_ADDR_FE_DROOP_MDF 0x7 --#define APB_BLOCK_ADDR_SIF_IC_STD 0x8 --#define APB_BLOCK_ADDR_SIF_STG_2 0x9 --#define APB_BLOCK_ADDR_SIF_STG_3 0xa --#define APB_BLOCK_ADDR_IC_AGC 0xb --#define APB_BLOCK_ADDR_DAC_UPS 0xc --#define APB_BLOCK_ADDR_GDE_EQUAL 0xd --#define APB_BLOCK_ADDR_VFORMAT 0xe --#define APB_BLOCK_ADDR_VDAGC 0xf --#define APB_BLOCK_ADDR_VERS_REGISTER 0x10 --#define APB_BLOCK_ADDR_INTERPT_MGT 0x11 --#define APB_BLOCK_ADDR_ADC_MGR 0x12 --#define APB_BLOCK_ADDR_GP_VD_FLT 0x13 --#define APB_BLOCK_ADDR_CARR_DMD 0x14 --#define APB_BLOCK_ADDR_SIF_VD_IF 0x15 --#define APB_BLOCK_ADDR_VD_PKING 0x16 --#define APB_BLOCK_ADDR_FE_DR_SMOOTH 0x17 --#define APB_BLOCK_ADDR_AGC_PWM 0x18 --#define APB_BLOCK_ADDR_DAC_UPS_24M 0x19 --#define APB_BLOCK_ADDR_VFORMAT_DP 0x1a --#define APB_BLOCK_ADDR_VD_PKING_DAC 0x1b --#define APB_BLOCK_ADDR_MONO_PROC 0x1c --#define APB_BLOCK_ADDR_TOP 0x1d -- --#define SLAVE_BLOCKS_NUMBER 0x1d /*indeed totals 0x1e, adding top*/ -- --/*Broadcast_Standard*/ --/* 0: NTSC*/ --/* 1: NTSC-J*/ --/* 2: PAL-M,*/ --/* 3: PAL-BG*/ --/* 4: DTV*/ --/* 5: SECAM- DK2*/ --/* 6: SECAM -DK3*/ --/* 7: PAL-BG, NICAM*/ --/* 8: PAL-DK-CHINA*/ --/* 9: SECAM-L / SECAM-DK3*/ --/* 10: PAL-I*/ --/* 11: PAL-DK1*/ --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC 0 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_J 1 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M 2 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG 3 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_DTV 4 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK2 5 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_DK3 6 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_BG_NICAM 7 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK 8 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_SECAM_L 9 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_I 10 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_DK1 11 --/* new add @20150813 begin */ --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_DK 12 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_BG 13 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_I 14 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC_M 15 --/* new add @20150813 end */ -- --/*GDE_Curve*/ --/* 0: CURVE-M*/ --/* 1: CURVE-A*/ --/* 2: CURVE-B*/ --/* 3: CURVE-CHINA*/ --/* 4: BYPASS*/ --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_CURVE_M 0 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_CURVE_A 1 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_CURVE_B 2 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_CURVE_CHINA 3 --#define AML_ATV_DEMOD_VIDEO_MODE_PROP_CURVE_BYPASS 4 -- --/*sound format 0: MONO;1:NICAM*/ --#define AML_ATV_DEMOD_SOUND_MODE_PROP_MONO 0 --#define AML_ATV_DEMOD_SOUND_MODE_PROP_NICAM 1 --/** --freq_hz:hs_freq --freq_hz_cvrt=hs_freq/0.23841858 --vs_freq==50,freq_hz=15625;freq_hz_cvrt=0xffff --vs_freq==60,freq_hz=15734,freq_hz_cvrt=0x101c9 --**/ --#define AML_ATV_DEMOD_FREQ_50HZ_VERT 0xffff /*65535*/ --#define AML_ATV_DEMOD_FREQ_60HZ_VERT 0x101c9 /*65993*/ -- --#define CARR_AFC_DEFAULT_VAL 0xffff -- --enum amlatvdemod_snr_level_e { -- very_low = 1, -- low, -- ok_minus, -- ok_plus, -- high, --}; -- --enum audio_detect_mode { -- AUDIO_AUTO_DETECT = 0, -- AUDIO_MANUAL_DETECT, --}; -- --struct amlatvdemod_device_s { -- struct class *clsp; -- struct device *dev; -- struct analog_parameters parm; -- int fre_offset; -- struct pinctrl *pin; -- const char *pin_name; --}; -- --extern void amlatvdemod_set_std(int val); --extern struct amlatvdemod_device_s *amlatvdemod_devp; --extern void aml_fix_PWM_adjust(int enable); --extern void aml_audio_valume_gain_set(unsigned int audio_gain); --extern unsigned int aml_audio_valume_gain_get(void); --extern void aml_atvdemod_overmodule_det(void); --extern int aml_audiomode_autodet(struct dvb_frontend *fe); --extern void retrieve_frequency_offset(int *freq_offset); --extern int aml_atvdemod_get_snr_ex(void); -- --#endif /* __ATVDEMOD_FUN_H */ -diff --git a/drivers/amlogic/dvb_tv/amldemod/Makefile b/drivers/amlogic/dvb_tv/amldemod/Makefile -deleted file mode 100644 -index 039a53b..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/Makefile -+++ /dev/null -@@ -1,29 +0,0 @@ -- --obj-$(CONFIG_AM_DTVDEMOD) += aml_fe.o -- --aml_fe-objs := demod_func.o dvbc_func.o i2c_func.o tuner_func.o #dvbt_func.o -- --#aml_fe-objs += mxl/MxL5007.o --#aml_fe-objs += mxl/MxL5007_API.o --#aml_fe-objs += mxl/MxL_User_Define.o --#aml_fe-objs += nxp/tuner_fj2207.o --#aml_fe-objs += nxp/tmbslNT220x.o --#aml_fe-objs += nxp/tmbslNT220xInstance.o --#aml_fe-objs += nxp/tmddNT220x.o --#aml_fe-objs += nxp/tmddNT220xInstance.o --#aml_fe-objs += nxp/tmddNT220x_Advanced.o --#aml_fe-objs += si2176/si2176_func.o -- --##ifeq ($(CONFIG_AM_DEMOD_DVBAPI), y) --aml_fe-objs += amlfrontend.o --##endif -- --##ifeq ($(CONFIG_AM_DEMOD_DEBUG), y) --aml_fe-objs += aml_demod.o --##endif -- --ccflags-y += -I. --ccflags-y += -Idrivers/media/dvb-core --ccflags-y += -Idrivers/amlogic/dvb_tv/amldemod/include --ccflags-y += -Idrivers/amlogic/dvb_tv/ -- -diff --git a/drivers/amlogic/dvb_tv/amldemod/aml_demod.c b/drivers/amlogic/dvb_tv/amldemod/aml_demod.c -deleted file mode 100644 -index 1b9d4da..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/aml_demod.c -+++ /dev/null -@@ -1,700 +0,0 @@ --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --/* #include */ --#include --#include -- --/* #include */ --#include --#include --#include "demod_func.h" -- --#include --#ifdef CONFIG_COMPAT --#include --#endif --/*#include "sdio/sdio_init.h"*/ --#define DRIVER_NAME "aml_demod" --#define MODULE_NAME "aml_demod" --#define DEVICE_NAME "aml_demod" --#define DEVICE_UI_NAME "aml_demod_ui" -- --#define pr_dbg(a ...) \ -- do { \ -- if (1) { \ -- printk(a); \ -- } \ -- } while (0) -- -- --const char aml_demod_dev_id[] = "aml_demod"; -- --/*#ifndef CONFIG_AM_DEMOD_DVBAPI -- * static struct aml_demod_i2c demod_i2c; -- * static struct aml_demod_sta demod_sta; -- * #else -- * extern struct aml_demod_i2c demod_i2c; -- * extern struct aml_demod_sta demod_sta; -- #endif*/ -- --static struct aml_demod_i2c demod_i2c; --static struct aml_demod_sta demod_sta; --static int read_start; -- --int sdio_read_ddr(unsigned long sdio_addr, unsigned long byte_count, -- unsigned char *data_buf) --{ -- return 0; --} -- --int sdio_write_ddr(unsigned long sdio_addr, unsigned long byte_count, -- unsigned char *data_buf) --{ -- return 0; --} -- --int read_reg(int addr) --{ -- addr = addr + DEMOD_BASE; -- return apb_read_reg(addr); --} -- --void wait_capture(int cap_cur_addr, int depth_MB, int start) --{ -- int readfirst; -- int tmp; -- int time_out; -- int last = 0x90000000; -- -- time_out = readfirst = 0; -- tmp = depth_MB << 20; -- while (tmp && (time_out < 1000)) { /*10seconds time out */ -- time_out = time_out + 1; -- msleep(20); -- readfirst = app_apb_read_reg(cap_cur_addr); -- if ((last - readfirst) > 0) -- tmp = 0; -- else -- last = readfirst; -- /* usleep(1000); */ -- /* readsecond= app_apb_read_reg(cap_cur_addr); */ -- -- /* if((readsecond-start)>tmp) */ --/* tmp=0;*/ --/* if((readsecond-readfirst)<0) // turn around*/ --/* tmp=0;*/ -- pr_dbg("First %x = [%08x],[%08x]%x\n", cap_cur_addr, readfirst, -- last, (last - readfirst)); --/* printf("Second %x = [%08x]\n",cap_cur_addr, readsecond);*/ -- msleep(20); -- } -- read_start = readfirst + 0x40000000; -- pr_dbg("read_start is %x\n", read_start); --} -- --int cap_adc_data(struct aml_cap_data *cap) --{ -- int tmp; -- int tb_depth; -- -- pr_dbg("capture ADC\n "); -- /* printf("set mem_start (you can read in kernel start log -- * (memstart is ).(hex) : ");*/ -- /* scanf("%x",&tmp);*/ -- tmp = 0x94400000; -- app_apb_write_reg(0x9d, cap->cap_addr); -- app_apb_write_reg(0x9e, cap->cap_addr + cap->cap_size * 0x100000); -- /*0x8000000-128m, 0x400000-4m */ -- read_start = tmp + 0x40000000; -- /*printf("set afifo rate. (hex)(adc_clk/demod_clk)*256+2 : "); // -- * (adc_clk/demod_clk)*256+2 */ -- /* scanf("%x",&tmp); */ -- cap->cap_afifo = 0x60; -- app_apb_write_reg(0x15, 0x18715f2); -- app_apb_write_reg(0x15, (app_apb_read_reg(0x15) & 0xfff00fff) | -- ((cap->cap_afifo & 0xff) << 12)); /* set afifo */ -- app_apb_write_reg(0x9b, 0x1c9); /* capture ADC 10bits */ -- app_apb_write_reg(0x7f, 0x00008000); /* enable testbus 0x8000 */ -- -- tb_depth = cap->cap_size; /*127; */ -- tmp = 9; -- app_apb_write_reg(0x9b, (app_apb_read_reg(0x9b) & ~0x1f) | tmp); -- /* set testbus width */ -- -- tmp = 0x100000; -- app_apb_write_reg(0x9c, tmp); /* by ADC data enable */ -- /* printf("Set test mode. (0 is normal ,1 is testmode) : "); //0 */ -- /* scanf("%d",&tmp); */ -- tmp = 0; -- if (tmp == 1) -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) | (1 << 10)); -- /* set test mode; */ -- else -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) & ~(1 << 10)); -- /* close test mode; */ -- -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) & ~(1 << 9)); -- /* close cap; */ -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) | (1 << 9)); -- /* open cap; */ -- -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) | (1 << 7)); -- /* close tb; */ -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) & ~(1 << 7)); -- /* open tb; */ -- -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) | (1 << 5)); -- /* close intlv; */ -- -- app_apb_write_reg(0x303, 0x8); /* open dc_arbit */ -- -- tmp = 0; -- if (tmp) -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) & ~(1 << 5)); -- /* open intlv; */ -- -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) & ~(1 << 8)); -- /* go tb; */ -- -- wait_capture(0x9f, tb_depth, app_apb_read_reg(0x9d)); -- -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) | (1 << 8)); -- /* stop tb; */ -- app_apb_write_reg(0x9b, app_apb_read_reg(0x9b) | (1 << 7)); -- /* close tb; */ -- return 0; --} -- --static DECLARE_WAIT_QUEUE_HEAD(lock_wq); -- --static ssize_t aml_demod_info(struct class *cla, -- struct class_attribute *attr, char *buf) --{ -- return 0; --} -- --static struct class_attribute aml_demod_class_attrs[] = { -- __ATTR(info, -- S_IRUGO | S_IWUSR, -- aml_demod_info, -- NULL), -- __ATTR_NULL --}; -- --static struct class aml_demod_class = { -- .name = "aml_demod", -- .class_attrs = aml_demod_class_attrs, --}; -- --#if 0 -- --static irqreturn_t aml_demod_isr(int irq, void *dev_id) --{ -- if (demod_sta.dvb_mode == 0) { -- /*dvbc_isr(&demod_sta); */ -- if (dvbc_isr_islock()) { -- pr_dbg("sync4\n"); -- if (waitqueue_active(&lock_wq)) -- wake_up_interruptible(&lock_wq); -- } -- } else { -- dvbt_isr(&demod_sta); -- } -- -- return IRQ_HANDLED; --} --#endif -- --static int aml_demod_open(struct inode *inode, struct file *file) --{ -- pr_dbg("Amlogic Demod DVB-T/C Open\n"); -- return 0; --} -- --static int aml_demod_release(struct inode *inode, struct file *file) --{ -- pr_dbg("Amlogic Demod DVB-T/C Release\n"); -- return 0; --} -- --#if 0 --static int amdemod_islock(void) --{ -- struct aml_demod_sts demod_sts; -- -- if (demod_sta.dvb_mode == 0) { -- dvbc_status(&demod_sta, &demod_i2c, &demod_sts); -- return demod_sts.ch_sts & 0x1; -- } else if (demod_sta.dvb_mode == 1) { -- dvbt_status(&demod_sta, &demod_i2c, &demod_sts); -- return demod_sts.ch_sts >> 12 & 0x1; -- } -- return 0; --} --#endif -- --void mem_read(struct aml_demod_mem *arg) --{ -- int data; -- int addr; -- -- addr = arg->addr; -- data = arg->dat; --/* memcpy(mem_buf[addr],data,1);*/ -- pr_dbg("[addr %x] data is %x\n", addr, data); --} --static long aml_demod_ioctl(struct file *file, -- unsigned int cmd, unsigned long arg) --{ -- int strength = 0; -- struct dvb_frontend *dvbfe; -- struct aml_tuner_sys *tuner; -- switch (cmd) { -- case AML_DEMOD_GET_RSSI: -- pr_dbg("Ioctl Demod GET_RSSI.\n"); -- dvbfe = get_si2177_tuner(); -- if (dvbfe != NULL) -- strength = dvbfe->ops.tuner_ops.get_strength(dvbfe); -- pr_dbg("[si2177] strength is %d\n", strength - 256); -- if (strength < 0) -- strength = 0 - strength; -- tuner = (struct aml_tuner_sys *)arg; -- tuner->rssi = strength; -- break; -- -- case AML_DEMOD_SET_TUNER: -- pr_dbg("Ioctl Demod Set Tuner.\n"); -- dvbfe = get_si2177_tuner(); -- if (dvbfe != NULL) -- dvbfe->ops.tuner_ops.set_tuner(dvbfe, &demod_sta, -- &demod_i2c, -- (struct aml_tuner_sys *) -- arg); -- break; -- -- case AML_DEMOD_SET_SYS: -- pr_dbg("Ioctl Demod Set System\n"); -- demod_set_sys(&demod_sta, &demod_i2c, -- (struct aml_demod_sys *)arg); -- break; -- -- case AML_DEMOD_GET_SYS: -- pr_dbg("Ioctl Demod Get System\n"); -- -- /*demod_get_sys(&demod_i2c, (struct aml_demod_sys *)arg); */ -- break; -- -- case AML_DEMOD_TEST: -- pr_dbg("Ioctl Demod Test. It is blank now\n"); -- /*demod_msr_clk(13); */ -- /*demod_msr_clk(14); */ -- /*demod_calc_clk(&demod_sta); */ -- break; -- -- case AML_DEMOD_TURN_ON: -- pr_dbg("Ioctl Demod Turn ON.It is blank now\n"); -- /*demod_turn_on(&demod_sta, (struct aml_demod_sys *)arg); */ -- break; -- -- case AML_DEMOD_TURN_OFF: -- pr_dbg("Ioctl Demod Turn OFF.It is blank now\n"); -- /*demod_turn_off(&demod_sta, (struct aml_demod_sys *)arg); */ -- break; -- -- case AML_DEMOD_DVBC_SET_CH: -- pr_dbg("Ioctl DVB-C Set Channel.\n"); -- dvbc_set_ch(&demod_sta, &demod_i2c, -- (struct aml_demod_dvbc *)arg); -- break; -- -- case AML_DEMOD_DVBC_GET_CH: -- /* pr_dbg("Ioctl DVB-C Get Channel. It is blank\n"); */ -- dvbc_status(&demod_sta, &demod_i2c, -- (struct aml_demod_sts *)arg); -- break; -- case AML_DEMOD_DVBC_TEST: -- pr_dbg("Ioctl DVB-C Test. It is blank\n"); -- /*dvbc_get_test_out(0xb, 1000, (u32 *)arg); */ -- break; -- case AML_DEMOD_DVBT_SET_CH: -- pr_dbg("Ioctl DVB-T Set Channel\n"); -- dvbt_set_ch(&demod_sta, &demod_i2c, -- (struct aml_demod_dvbt *)arg); -- break; -- -- case AML_DEMOD_DVBT_GET_CH: -- pr_dbg("Ioctl DVB-T Get Channel\n"); -- /*dvbt_status(&demod_sta, &demod_i2c, -- * (struct aml_demod_sts *)arg); */ -- break; -- -- case AML_DEMOD_DVBT_TEST: -- pr_dbg("Ioctl DVB-T Test. It is blank\n"); -- /*dvbt_get_test_out(0x1e, 1000, (u32 *)arg); */ -- break; -- -- case AML_DEMOD_DTMB_SET_CH: -- dtmb_set_ch(&demod_sta, &demod_i2c, -- (struct aml_demod_dtmb *)arg); -- break; -- -- case AML_DEMOD_DTMB_GET_CH: -- break; -- -- case AML_DEMOD_DTMB_TEST: -- break; -- -- case AML_DEMOD_ATSC_SET_CH: -- atsc_set_ch(&demod_sta, &demod_i2c, -- (struct aml_demod_atsc *)arg); -- break; -- -- case AML_DEMOD_ATSC_GET_CH: -- check_atsc_fsm_status(); -- break; -- -- case AML_DEMOD_ATSC_TEST: -- break; -- -- case AML_DEMOD_SET_REG: -- /* pr_dbg("Ioctl Set Register\n"); */ -- demod_set_reg((struct aml_demod_reg *)arg); -- break; -- -- case AML_DEMOD_GET_REG: -- /* pr_dbg("Ioctl Get Register\n"); */ -- demod_get_reg((struct aml_demod_reg *)arg); -- break; -- --/* case AML_DEMOD_SET_REGS: */ --/* break; */ -- --/* case AML_DEMOD_GET_REGS: */ --/* break; */ -- -- case AML_DEMOD_RESET_MEM: -- pr_dbg("set mem ok\n"); -- break; -- -- case AML_DEMOD_READ_MEM: -- break; -- case AML_DEMOD_SET_MEM: -- /*step=(struct aml_demod_mem)arg; -- * pr_dbg("[%x]0x%x------------------\n",i,mem_buf[step]); -- * for(i=step;i<1024-1;i++){ -- * pr_dbg("0x%x,",mem_buf[i]); -- * } */ -- mem_read((struct aml_demod_mem *)arg); -- break; -- -- case AML_DEMOD_ATSC_IRQ: -- atsc_read_iqr_reg(); -- break; -- -- default: -- pr_dbg("Enter Default ! 0x%X\n", cmd); --/* pr_dbg("AML_DEMOD_GET_REGS=0x%08X\n", AML_DEMOD_GET_REGS); */ --/* pr_dbg("AML_DEMOD_SET_REGS=0x%08X\n", AML_DEMOD_SET_REGS); */ -- return -EINVAL; -- } -- -- return 0; --} -- --#ifdef CONFIG_COMPAT -- --static long aml_demod_compat_ioctl(struct file *file, unsigned int cmd, -- ulong arg) --{ -- return aml_demod_ioctl(file, cmd, (ulong)compat_ptr(arg)); --} -- --#endif -- -- --static const struct file_operations aml_demod_fops = { -- .owner = THIS_MODULE, -- .open = aml_demod_open, -- .release = aml_demod_release, -- .unlocked_ioctl = aml_demod_ioctl, --#ifdef CONFIG_COMPAT -- .compat_ioctl = aml_demod_compat_ioctl, --#endif --}; -- --static int aml_demod_ui_open(struct inode *inode, struct file *file) --{ -- pr_dbg("Amlogic aml_demod_ui_open Open\n"); -- return 0; --} -- --static int aml_demod_ui_release(struct inode *inode, struct file *file) --{ -- pr_dbg("Amlogic aml_demod_ui_open Release\n"); -- return 0; --} --char buf_all[100]; --static ssize_t aml_demod_ui_read(struct file *file, char __user *buf, -- size_t count, loff_t *ppos) --{ -- char *capture_buf = buf_all; -- int res = 0; -- -- if (count >= 4 * 1024 * 1024) -- count = 4 * 1024 * 1024; -- else if (count == 0) -- return 0; -- -- res = copy_to_user((void *)buf, (char *)capture_buf, count); -- if (res < 0) { -- pr_dbg("[aml_demod_ui_read]res is %d", res); -- return res; -- } -- -- return count; --} -- --static ssize_t aml_demod_ui_write(struct file *file, const char *buf, -- size_t count, loff_t *ppos) --{ -- return 0; --} -- --static struct device *aml_demod_ui_dev; --static dev_t aml_demod_devno_ui; --static struct cdev *aml_demod_cdevp_ui; --static const struct file_operations aml_demod_ui_fops = { -- .owner = THIS_MODULE, -- .open = aml_demod_ui_open, -- .release = aml_demod_ui_release, -- .read = aml_demod_ui_read, -- .write = aml_demod_ui_write, -- /* .unlocked_ioctl = aml_demod_ui_ioctl, */ --}; -- --#if 0 --static ssize_t aml_demod_ui_info(struct class *cla, -- struct class_attribute *attr, char *buf) --{ -- return 0; --} -- --static struct class_attribute aml_demod_ui_class_attrs[] = { -- __ATTR(info, -- S_IRUGO | S_IWUSR, -- aml_demod_ui_info, -- NULL), -- __ATTR_NULL --}; --#endif -- --static struct class aml_demod_ui_class = { -- .name = "aml_demod_ui", --/* .class_attrs = aml_demod_ui_class_attrs,*/ --}; -- --int aml_demod_ui_init(void) --{ -- int r = 0; -- -- r = class_register(&aml_demod_ui_class); -- if (r) { -- pr_dbg("create aml_demod class fail\r\n"); -- class_unregister(&aml_demod_ui_class); -- return r; -- } -- -- r = alloc_chrdev_region(&aml_demod_devno_ui, 0, 1, DEVICE_UI_NAME); -- if (r < 0) { -- pr_dbg(KERN_ERR "aml_demod_ui: faild to alloc major number\n"); -- r = -ENODEV; -- unregister_chrdev_region(aml_demod_devno_ui, 1); -- class_unregister(&aml_demod_ui_class); -- return r; -- } -- -- aml_demod_cdevp_ui = kmalloc(sizeof(struct cdev), GFP_KERNEL); -- if (!aml_demod_cdevp_ui) { -- pr_dbg(KERN_ERR "aml_demod_ui: failed to allocate memory\n"); -- r = -ENOMEM; -- unregister_chrdev_region(aml_demod_devno_ui, 1); -- kfree(aml_demod_cdevp_ui); -- class_unregister(&aml_demod_ui_class); -- return r; -- } -- /* connect the file operation with cdev */ -- cdev_init(aml_demod_cdevp_ui, &aml_demod_ui_fops); -- aml_demod_cdevp_ui->owner = THIS_MODULE; -- /* connect the major/minor number to cdev */ -- r = cdev_add(aml_demod_cdevp_ui, aml_demod_devno_ui, 1); -- if (r) { -- pr_dbg(KERN_ERR "aml_demod_ui:failed to add cdev\n"); -- unregister_chrdev_region(aml_demod_devno_ui, 1); -- cdev_del(aml_demod_cdevp_ui); -- kfree(aml_demod_cdevp_ui); -- class_unregister(&aml_demod_ui_class); -- return r; -- } -- -- aml_demod_ui_dev = device_create(&aml_demod_ui_class, NULL, -- MKDEV(MAJOR(aml_demod_devno_ui), 0), -- NULL, DEVICE_UI_NAME); -- -- if (IS_ERR(aml_demod_ui_dev)) { -- pr_dbg("Can't create aml_demod device\n"); -- unregister_chrdev_region(aml_demod_devno_ui, 1); -- cdev_del(aml_demod_cdevp_ui); -- kfree(aml_demod_cdevp_ui); -- class_unregister(&aml_demod_ui_class); -- return r; -- } -- -- return r; --} -- --void aml_demod_exit_ui(void) --{ -- unregister_chrdev_region(aml_demod_devno_ui, 1); -- cdev_del(aml_demod_cdevp_ui); -- kfree(aml_demod_cdevp_ui); -- class_unregister(&aml_demod_ui_class); --} -- --static struct device *aml_demod_dev; --static dev_t aml_demod_devno; --static struct cdev *aml_demod_cdevp; -- --#ifdef CONFIG_AM_DEMOD_DVBAPI --int aml_demod_init(void) --#else --static int __init aml_demod_init(void) --#endif --{ -- int r = 0; -- -- pr_dbg("Amlogic Demod DVB-T/C DebugIF Init\n"); -- -- init_waitqueue_head(&lock_wq); -- -- /* hook demod isr */ -- /* r = request_irq(INT_DEMOD, &aml_demod_isr, -- * IRQF_SHARED, "aml_demod", -- * (void *)aml_demod_dev_id); -- * if (r) { -- * pr_dbg("aml_demod irq register error.\n"); -- * r = -ENOENT; -- * goto err0; -- * }*/ -- -- /* sysfs node creation */ -- r = class_register(&aml_demod_class); -- if (r) { -- pr_dbg("create aml_demod class fail\r\n"); -- goto err1; -- } -- -- r = alloc_chrdev_region(&aml_demod_devno, 0, 1, DEVICE_NAME); -- if (r < 0) { -- pr_dbg(KERN_ERR "aml_demod: faild to alloc major number\n"); -- r = -ENODEV; -- goto err2; -- } -- -- aml_demod_cdevp = kmalloc(sizeof(struct cdev), GFP_KERNEL); -- if (!aml_demod_cdevp) { -- pr_dbg(KERN_ERR "aml_demod: failed to allocate memory\n"); -- r = -ENOMEM; -- goto err3; -- } -- /* connect the file operation with cdev */ -- cdev_init(aml_demod_cdevp, &aml_demod_fops); -- aml_demod_cdevp->owner = THIS_MODULE; -- /* connect the major/minor number to cdev */ -- r = cdev_add(aml_demod_cdevp, aml_demod_devno, 1); -- if (r) { -- pr_dbg(KERN_ERR "aml_demod:failed to add cdev\n"); -- goto err4; -- } -- -- aml_demod_dev = device_create(&aml_demod_class, NULL, -- MKDEV(MAJOR(aml_demod_devno), 0), NULL, -- DEVICE_NAME); -- -- if (IS_ERR(aml_demod_dev)) { -- pr_dbg("Can't create aml_demod device\n"); -- goto err5; -- } -- pr_dbg("Amlogic Demod DVB-T/C DebugIF Init ok----------------\n"); --#if defined(CONFIG_AM_AMDEMOD_FPGA_VER) && !defined(CONFIG_AM_DEMOD_DVBAPI) -- pr_dbg("sdio_init\n"); -- sdio_init(); --#endif -- aml_demod_ui_init(); -- -- return 0; -- --err5: -- cdev_del(aml_demod_cdevp); --err4: -- kfree(aml_demod_cdevp); -- --err3: -- unregister_chrdev_region(aml_demod_devno, 1); -- --err2: --/* free_irq(INT_DEMOD, (void *)aml_demod_dev_id);*/ -- --err1: -- class_unregister(&aml_demod_class); -- --/* err0:*/ -- return r; --} -- --#ifdef CONFIG_AM_DEMOD_DVBAPI --void aml_demod_exit(void) --#else --static void __exit aml_demod_exit(void) --#endif --{ -- pr_dbg("Amlogic Demod DVB-T/C DebugIF Exit\n"); -- -- unregister_chrdev_region(aml_demod_devno, 1); -- device_destroy(&aml_demod_class, MKDEV(MAJOR(aml_demod_devno), 0)); -- cdev_del(aml_demod_cdevp); -- kfree(aml_demod_cdevp); -- -- /* free_irq(INT_DEMOD, (void *)aml_demod_dev_id); */ -- -- class_unregister(&aml_demod_class); -- -- aml_demod_exit_ui(); --} -- --#ifndef CONFIG_AM_DEMOD_DVBAPI --module_init(aml_demod_init); --module_exit(aml_demod_exit); -- --MODULE_LICENSE("GPL"); --/*MODULE_AUTHOR(DRV_AUTHOR);*/ --/*MODULE_DESCRIPTION(DRV_DESC);*/ --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/amlfrontend.c b/drivers/amlogic/dvb_tv/amldemod/amlfrontend.c -deleted file mode 100644 -index f58b2d4..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/amlfrontend.c -+++ /dev/null -@@ -1,1318 +0,0 @@ --/***************************************************************** --** --** Copyright (C) 2009 Amlogic,Inc. --** All rights reserved --** Filename : amlfrontend.c --** --** comment: --** Driver for m6_demod demodulator --** author : --** Shijie.Rong@amlogic --** version : --** v1.0 12/3/13 --** v2.0 15/10/12 --*****************************************************************/ -- --/* -- * Driver for gxtv_demod demodulator -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#ifdef ARC_700 --#include --#else --/* #include */ --#endif --#include --#include --#include "../aml_fe.h" -- --#include --#include "demod_func.h" --#include "../aml_dvb.h" --#include "amlfrontend.h" -- --MODULE_PARM_DESC(debug_aml, "\n\t\t Enable frontend debug information"); --static int debug_aml; --module_param(debug_aml, int, 0644); -- --#define pr_dbg(a ...) \ -- do { \ -- if (debug_aml) { \ -- printk(a); \ -- } \ -- } while (0) --#define pr_error(fmt, args ...) pr_err("GXTV_DEMOD: "fmt, ## args) -- --static int last_lock = -1; --#define DEMOD_DEVICE_NAME "gxtv_demod" --static int cci_thread; --static int freq_dvbc; --static struct aml_demod_sta demod_status; --static fe_modulation_t atsc_mode = VSB_8; -- --long *mem_buf; -- --MODULE_PARM_DESC(frontend_mode, "\n\t\t Frontend mode 0-DVBC, 1-DVBT"); --static int frontend_mode = -1; --module_param(frontend_mode, int, S_IRUGO); -- --MODULE_PARM_DESC(frontend_i2c, "\n\t\t IIc adapter id of frontend"); --static int frontend_i2c = -1; --module_param(frontend_i2c, int, S_IRUGO); -- --MODULE_PARM_DESC(frontend_tuner, -- "\n\t\t Frontend tuner type 0-NULL, 1-DCT7070, 2-Maxliner, 3-FJ2207, 4-TD1316"); --static int frontend_tuner = -1; --module_param(frontend_tuner, int, S_IRUGO); -- --MODULE_PARM_DESC(frontend_tuner_addr, "\n\t\t Tuner IIC address of frontend"); --static int frontend_tuner_addr = -1; --module_param(frontend_tuner_addr, int, S_IRUGO); --static int autoflags, autoFlagsTrig; --static struct mutex aml_lock; -- --static int Gxtv_Demod_Dvbc_Init(struct aml_fe_dev *dev, int mode); -- --static ssize_t dvbc_auto_sym_show(struct class *cls, -- struct class_attribute *attr, char *buf) --{ -- return sprintf(buf, "dvbc_autoflags: %s\n", autoflags ? "on" : "off"); --} -- --static ssize_t dvbc_auto_sym_store(struct class *cls, -- struct class_attribute *attr, -- const char *buf, size_t count) --{ -- -- return 0; --} -- --static unsigned dtmb_mode; -- --enum { -- DTMB_READ_STRENGTH = 0, -- DTMB_READ_SNR = 1, -- DTMB_READ_LOCK = 2, -- DTMB_READ_BCH = 3, --}; -- -- -- --int convert_snr(int in_snr) --{ -- int out_snr; -- static int calce_snr[40] = { -- 5, 6, 8, 10, 13, -- 16, 20, 25, 32, 40, -- 50, 63, 80, 100, 126, -- 159, 200, 252, 318, 400, -- 504, 634, 798, 1005, 1265, -- 1592, 2005, 2524, 3177, 4000, -- 5036, 6340, 7981, 10048, 12649, -- 15924, 20047, 25238, 31773, 40000}; -- for (out_snr = 1 ; out_snr <= 40; out_snr++) -- if (in_snr <= calce_snr[out_snr]) -- break; -- -- return out_snr; --} -- -- --static ssize_t dtmb_para_show(struct class *cls, -- struct class_attribute *attr, char *buf) --{ -- int snr, lock_status, bch, agc_if_gain; -- struct dvb_frontend *dvbfe; -- int strength = 0; -- if (dtmb_mode == DTMB_READ_STRENGTH) { -- dvbfe = get_si2177_tuner(); -- if (dvbfe != NULL) -- if (dvbfe->ops.tuner_ops.get_strength) { -- strength = -- dvbfe->ops.tuner_ops.get_strength(dvbfe); -- } -- if (strength <= -56) { -- agc_if_gain = -- ((dtmb_read_reg(DTMB_TOP_FRONT_AGC))&0x3ff); -- strength = dtmb_get_power_strength(agc_if_gain); -- } -- return sprintf(buf, "strength is %d\n", strength); -- } else if (dtmb_mode == DTMB_READ_SNR) { -- snr = dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR) & 0x3fff; -- snr = convert_snr(snr); -- return sprintf(buf, "snr is %d\n", snr); -- } else if (dtmb_mode == DTMB_READ_LOCK) { -- lock_status = -- (dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR) >> 14) & 0x1; -- return sprintf(buf, "lock_status is %d\n", lock_status); -- } else if (dtmb_mode == DTMB_READ_BCH) { -- bch = dtmb_read_reg(DTMB_TOP_FEC_BCH_ACC); -- return sprintf(buf, "bch is %d\n", bch); -- } else { -- return sprintf(buf, "dtmb_para_show can't match mode\n"); -- } --} -- -- -- --static ssize_t dtmb_para_store(struct class *cls, -- struct class_attribute *attr, -- const char *buf, size_t count) --{ -- if (buf[0] == '0') -- dtmb_mode = DTMB_READ_STRENGTH; -- else if (buf[0] == '1') -- dtmb_mode = DTMB_READ_SNR; -- else if (buf[0] == '2') -- dtmb_mode = DTMB_READ_LOCK; -- else if (buf[0] == '3') -- dtmb_mode = DTMB_READ_BCH; -- -- return count; --} -- --static int readregdata; -- --static ssize_t dvbc_reg_show(struct class *cls, struct class_attribute *attr, -- char *buf) --{ --/* int readregaddr=0;*/ -- char *pbuf = buf; -- -- pbuf += sprintf(pbuf, "%x", readregdata); -- -- pr_dbg("read dvbc_reg\n"); -- return pbuf - buf; --} -- --static ssize_t dvbc_reg_store(struct class *cls, struct class_attribute *attr, -- const char *buf, size_t count) --{ -- return 0; --} -- --static CLASS_ATTR(auto_sym, 0644, dvbc_auto_sym_show, dvbc_auto_sym_store); --static CLASS_ATTR(dtmb_para, 0644, dtmb_para_show, dtmb_para_store); --static CLASS_ATTR(dvbc_reg, 0666, dvbc_reg_show, dvbc_reg_store); -- --#if 0 --static irqreturn_t amdemod_isr(int irq, void *data) --{ --/* struct aml_fe_dev *state = data; -- * -- * #define dvb_isr_islock() (((frontend_mode==0)&&dvbc_isr_islock()) \ -- * ||((frontend_mode==1)&&dvbt_isr_islock())) -- * #define dvb_isr_monitor() do {\ -- * if(frontend_mode==1) dvbt_isr_monitor(); }while(0) -- * #define dvb_isr_cancel() do { if(frontend_mode==1) dvbt_isr_cancel(); \ -- * else if(frontend_mode==0) dvbc_isr_cancel();}while(0) -- * -- * dvb_isr_islock(); -- * { -- * if(waitqueue_active(&state->lock_wq)) -- * wake_up_interruptible(&state->lock_wq); -- * } -- * -- * dvb_isr_monitor(); -- * -- * dvb_isr_cancel();*/ -- -- return IRQ_HANDLED; --} --#endif -- --static int install_isr(struct aml_fe_dev *state) --{ -- int r = 0; -- -- /* hook demod isr */ --/* pr_dbg("amdemod irq register[IRQ(%d)].\n", INT_DEMOD); -- * r = request_irq(INT_DEMOD, &amdemod_isr, -- * IRQF_SHARED, "amldemod", -- * (void *)state); -- * if (r) { -- * pr_error("amdemod irq register error.\n"); -- * }*/ -- return r; --} -- --static void uninstall_isr(struct aml_fe_dev *state) --{ --/* pr_dbg("amdemod irq unregister[IRQ(%d)].\n", INT_DEMOD);*/ -- --/* free_irq(INT_DEMOD, (void*)state);*/ --} -- --static int amdemod_qam(fe_modulation_t qam) --{ -- switch (qam) { -- case QAM_16: -- return 0; -- case QAM_32: -- return 1; -- case QAM_64: -- return 2; -- case QAM_128: -- return 3; -- case QAM_256: -- return 4; -- case VSB_8: -- return 5; -- case QAM_AUTO: -- return 6; -- default: -- return 2; -- } -- return 2; --} -- --static int amdemod_stat_islock(struct aml_fe_dev *dev, int mode) --{ -- struct aml_demod_sts demod_sts; -- int lock_status; -- int dvbt_status1; -- -- if (mode == 0) { -- /*DVBC*/ -- /*dvbc_status(state->sta, state->i2c, &demod_sts);*/ -- demod_sts.ch_sts = apb_read_reg(QAM_BASE + 0x18); -- return demod_sts.ch_sts & 0x1; -- } else if (mode == 1) { -- /*DVBT*/ -- dvbt_status1 = -- ((apb_read_reg(DVBT_BASE + (0x0a << 2)) >> 20) & 0x3ff); -- lock_status = (apb_read_reg(DVBT_BASE + (0x2a << 2))) & 0xf; -- if ((((lock_status) == 9) || ((lock_status) == 10)) -- && ((dvbt_status1) != 0)) -- return 1; -- else -- return 0; -- /*((apb_read_reg(DVBT_BASE+0x0)>>12)&0x1);// -- * dvbt_get_status_ops()->get_status(&demod_sts, &demod_sta);*/ -- } else if (mode == 2) { -- /*ISDBT*/ -- /*return dvbt_get_status_ops()->get_status -- * (demod_sts, demod_sta);*/ -- } else if (mode == 3) { -- /*ATSC*/ -- if ((atsc_mode == QAM_64) || (atsc_mode == QAM_256)) -- return (atsc_read_iqr_reg() >> 16) == 0x1f; -- else if (atsc_mode == VSB_8) -- return atsc_read_reg(0x0980) == 0x79; -- else -- return (atsc_read_iqr_reg() >> 16) == 0x1f; -- } else if (mode == 4) { -- /*DTMB*/ -- /* pr_dbg("DTMB lock status is %u\n", -- ((dtmb_read_reg(DTMB_BASE + (0x0e3 << 2)) >> 14) & -- 0x1));*/ -- return (dtmb_read_reg(DTMB_BASE + (0x0e3 << 2)) >> 14) & 0x1; -- } -- return 0; --} -- --#define amdemod_dvbc_stat_islock(dev) amdemod_stat_islock((dev), 0) --#define amdemod_dvbt_stat_islock(dev) amdemod_stat_islock((dev), 1) --#define amdemod_isdbt_stat_islock(dev) amdemod_stat_islock((dev), 2) --#define amdemod_atsc_stat_islock(dev) amdemod_stat_islock((dev), 3) --#define amdemod_dtmb_stat_islock(dev) amdemod_stat_islock((dev), 4) -- --static int gxtv_demod_dvbc_set_qam_mode(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_demod_dvbc param; /*mode 0:16, 1:32, 2:64, 3:128, 4:256*/ -- -- memset(¶m, 0, sizeof(param)); -- param.mode = amdemod_qam(c->modulation); -- dvbc_set_qam_mode(param.mode); -- return 0; --} -- --static void gxtv_demod_dvbc_release(struct dvb_frontend *fe) --{ -- struct aml_fe_dev *state = fe->demodulator_priv; -- -- uninstall_isr(state); -- -- kfree(state); --} -- --static int gxtv_demod_dvbc_read_status -- (struct dvb_frontend *fe, fe_status_t *status) --{ --/* struct aml_fe_dev *dev = afe->dtv_demod;*/ -- struct aml_demod_sts demod_sts; --/* struct aml_demod_sta demod_sta;*/ --/* struct aml_demod_i2c demod_i2c;*/ -- int ilock; -- -- demod_sts.ch_sts = apb_read_reg(QAM_BASE + 0x18); --/* dvbc_status(&demod_sta, &demod_i2c, &demod_sts);*/ -- if (demod_sts.ch_sts & 0x1) { -- ilock = 1; -- *status = -- FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | -- FE_HAS_VITERBI | FE_HAS_SYNC; -- } else { -- ilock = 0; -- *status = FE_TIMEDOUT; -- } -- if (last_lock != ilock) { -- pr_error("%s.\n", -- ilock ? "!! >> LOCK << !!" : "!! >> UNLOCK << !!"); -- last_lock = ilock; -- } -- -- return 0; --} -- --static int gxtv_demod_dvbc_read_ber(struct dvb_frontend *fe, u32 *ber) --{ -- /*struct aml_fe_dev *dev = afe->dtv_demod;*/ -- struct aml_demod_sts demod_sts; -- struct aml_demod_i2c demod_i2c; -- struct aml_demod_sta demod_sta; -- -- dvbc_status(&demod_sta, &demod_i2c, &demod_sts); -- *ber = demod_sts.ch_ber; -- return 0; --} -- --static int gxtv_demod_dvbc_read_signal_strength -- (struct dvb_frontend *fe, u16 *strength) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- *strength = 256 - tuner_get_ch_power(dev); -- -- return 0; --} -- --static int gxtv_demod_dvbc_read_snr(struct dvb_frontend *fe, u16 *snr) --{ -- struct aml_demod_sts demod_sts; -- struct aml_demod_i2c demod_i2c; -- struct aml_demod_sta demod_sta; -- -- dvbc_status(&demod_sta, &demod_i2c, &demod_sts); -- *snr = demod_sts.ch_snr / 100; -- return 0; --} -- --static int gxtv_demod_dvbc_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) --{ -- *ucblocks = 0; -- return 0; --} -- --/*extern int aml_fe_analog_set_frontend(struct dvb_frontend *fe);*/ -- --static int gxtv_demod_dvbc_set_frontend(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_demod_dvbc param; /*mode 0:16, 1:32, 2:64, 3:128, 4:256*/ -- struct aml_demod_sts demod_sts; -- struct aml_demod_i2c demod_i2c; -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- int error, times; -- -- demod_i2c.tuner = dev->drv->id; -- demod_i2c.addr = dev->i2c_addr; -- times = 2; -- memset(¶m, 0, sizeof(param)); -- param.ch_freq = c->frequency / 1000; -- param.mode = amdemod_qam(c->modulation); -- param.symb_rate = c->symbol_rate / 1000; -- if ((param.mode == 3) && (demod_status.tmp != Adc_mode)) { -- Gxtv_Demod_Dvbc_Init(dev, Adc_mode); -- pr_dbg("Gxtv_Demod_Dvbc_Init,Adc_mode\n"); -- } else { -- /*Gxtv_Demod_Dvbc_Init(dev,Cry_mode);*/ -- } -- if (autoflags == 0) { -- /*pr_dbg("QAM_TUNING mode\n");*/ -- /*flag=0;*/ -- } -- if ((autoflags == 1) && (autoFlagsTrig == 0) -- && (freq_dvbc == param.ch_freq)) { -- pr_dbg("now is auto symbrating\n"); -- return 0; -- } -- autoFlagsTrig = 0; -- last_lock = -1; -- pr_dbg("[gxtv_demod_dvbc_set_frontend]PARA\t" -- "demod_i2c.tuner is %d||||demod_i2c.addr is %d||||\t" -- "param.ch_freq is %d||||param.symb_rate is %d,\t" -- "param.mode is %d\n", -- demod_i2c.tuner, demod_i2c.addr, param.ch_freq, -- param.symb_rate, param.mode); --retry: -- aml_dmx_before_retune(afe->ts, fe); -- aml_fe_analog_set_frontend(fe); -- dvbc_set_ch(&demod_status, &demod_i2c, ¶m); -- if (autoflags == 1) { -- pr_dbg("QAM_PLAYING mode,start auto sym\n"); -- dvbc_set_auto_symtrack(); -- /* flag=1;*/ -- } --/*rsj_debug*/ -- -- dvbc_status(&demod_status, &demod_i2c, &demod_sts); -- freq_dvbc = param.ch_freq; -- -- times--; -- if (amdemod_dvbc_stat_islock(dev) && times) { -- int lock; -- -- aml_dmx_start_error_check(afe->ts, fe); -- msleep(20); -- error = aml_dmx_stop_error_check(afe->ts, fe); -- lock = amdemod_dvbc_stat_islock(dev); -- if ((error > 200) || !lock) { -- pr_error -- ("amlfe too many error, error count:%d\t" -- "lock statuc:%d, retry\n", -- error, lock); -- goto retry; -- } -- } -- -- aml_dmx_after_retune(afe->ts, fe); -- -- afe->params = *c; --/* afe->params.frequency = c->frequency; -- * afe->params.u.qam.symbol_rate = c->symbol_rate; -- * afe->params.u.qam.modulation = c->modulation;*/ -- -- pr_dbg("AML amldemod => frequency=%d,symbol_rate=%d\r\n", c->frequency, -- c->symbol_rate); -- return 0; --} -- --static int gxtv_demod_dvbc_get_frontend(struct dvb_frontend *fe) --{ /*these content will be writed into eeprom .*/ -- struct aml_fe *afe = fe->demodulator_priv; -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- int qam_mode; -- -- qam_mode = apb_read_reg(QAM_BASE + 0x008); -- afe->params.modulation = (qam_mode & 7) + 1; -- pr_dbg("[mode] is %d\n", afe->params.modulation); -- -- *c = afe->params; --/* c->modulation= afe->params.u.qam.modulation; -- * c->frequency= afe->params.frequency; -- * c->symbol_rate= afe->params.u.qam.symbol_rate;*/ -- return 0; --} -- --static int Gxtv_Demod_Dvbc_Init(struct aml_fe_dev *dev, int mode) --{ -- struct aml_demod_sys sys; -- struct aml_demod_i2c i2c; -- -- pr_dbg("AML Demod DVB-C init\r\n"); -- memset(&sys, 0, sizeof(sys)); -- memset(&i2c, 0, sizeof(i2c)); -- i2c.tuner = dev->drv->id; -- i2c.addr = dev->i2c_addr; -- /* 0 -DVBC, 1-DVBT, ISDBT, 2-ATSC*/ -- demod_status.dvb_mode = Gxtv_Dvbc; -- -- if (mode == Adc_mode) { -- sys.adc_clk = Adc_Clk_25M; -- sys.demod_clk = Demod_Clk_200M; -- demod_status.tmp = Adc_mode; -- } else { -- sys.adc_clk = Adc_Clk_24M; -- sys.demod_clk = Demod_Clk_72M; -- demod_status.tmp = Cry_mode; -- } -- demod_status.ch_if = Si2176_5M_If * 1000; -- pr_dbg("[%s]adc_clk is %d,demod_clk is %d\n", __func__, sys.adc_clk, -- sys.demod_clk); -- autoFlagsTrig = 0; -- demod_set_sys(&demod_status, &i2c, &sys); -- return 0; --} -- --static void gxtv_demod_dvbt_release(struct dvb_frontend *fe) --{ -- struct aml_fe_dev *state = fe->demodulator_priv; -- -- uninstall_isr(state); -- -- kfree(state); --} -- --static int gxtv_demod_dvbt_read_status -- (struct dvb_frontend *fe, fe_status_t *status) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ -- struct aml_demod_i2c demod_i2c; -- struct aml_demod_sta demod_sta; -- int ilock; -- unsigned char s = 0; -- -- s = dvbt_get_status_ops()->get_status(&demod_sta, &demod_i2c); -- if (s == 1) { -- ilock = 1; -- *status = -- FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | -- FE_HAS_VITERBI | FE_HAS_SYNC; -- } else { -- ilock = 0; -- *status = FE_TIMEDOUT; -- } -- if (last_lock != ilock) { -- pr_error("%s.\n", -- ilock ? "!! >> LOCK << !!" : "!! >> UNLOCK << !!"); -- last_lock = ilock; -- } -- -- return 0; --} -- --static int gxtv_demod_dvbt_read_ber(struct dvb_frontend *fe, u32 *ber) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ -- struct aml_demod_i2c demod_i2c; -- struct aml_demod_sta demod_sta; -- -- *ber = dvbt_get_status_ops()->get_ber(&demod_sta, &demod_i2c) & 0xffff; -- return 0; --} -- --static int gxtv_demod_dvbt_read_signal_strength -- (struct dvb_frontend *fe, u16 *strength) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- *strength = 256 - tuner_get_ch_power(dev); -- pr_dbg("[RSJ]tuner strength is %d dbm\n", *strength); -- return 0; --} -- --static int gxtv_demod_dvbt_read_snr(struct dvb_frontend *fe, u16 *snr) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ --/* struct aml_demod_sts demod_sts;*/ -- struct aml_demod_i2c demod_i2c; -- struct aml_demod_sta demod_sta; -- -- *snr = dvbt_get_status_ops()->get_snr(&demod_sta, &demod_i2c); -- *snr /= 8; -- pr_dbg("[RSJ]snr is %d dbm\n", *snr); -- return 0; --} -- --static int gxtv_demod_dvbt_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) --{ -- *ucblocks = 0; -- return 0; --} -- --static int gxtv_demod_dvbt_set_frontend(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- /*struct aml_demod_sts demod_sts;*/ -- struct aml_demod_i2c demod_i2c; -- int error, times; -- struct aml_demod_dvbt param; -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- demod_i2c.tuner = dev->drv->id; -- demod_i2c.addr = dev->i2c_addr; -- -- times = 2; -- -- /*////////////////////////////////////*/ -- /* bw == 0 : 8M*/ -- /* 1 : 7M*/ -- /* 2 : 6M*/ -- /* 3 : 5M*/ -- /* agc_mode == 0: single AGC*/ -- /* 1: dual AGC*/ -- /*////////////////////////////////////*/ -- memset(¶m, 0, sizeof(param)); -- param.ch_freq = c->frequency / 1000; -- param.bw = c->bandwidth_hz; -- param.agc_mode = 1; -- /*ISDBT or DVBT : 0 is QAM, 1 is DVBT, 2 is ISDBT, -- * 3 is DTMB, 4 is ATSC */ -- param.dat0 = 1; -- last_lock = -1; -- --retry: -- aml_dmx_before_retune(AM_TS_SRC_TS2, fe); -- aml_fe_analog_set_frontend(fe); -- dvbt_set_ch(&demod_status, &demod_i2c, ¶m); -- -- /* for(count=0;count<10;count++){ -- * if(amdemod_dvbt_stat_islock(dev)){ -- * pr_dbg("first lock success\n"); -- * break; -- * } -- * -- * msleep(200); -- * } */ --/*rsj_debug*/ -- --/**/ -- -- times--; -- if (amdemod_dvbt_stat_islock(dev) && times) { -- int lock; -- -- aml_dmx_start_error_check(AM_TS_SRC_TS2, fe); -- msleep(20); -- error = aml_dmx_stop_error_check(AM_TS_SRC_TS2, fe); -- lock = amdemod_dvbt_stat_islock(dev); -- if ((error > 200) || !lock) { -- pr_error -- ("amlfe too many error,\t" -- "error count:%d lock statuc:%d, retry\n", -- error, lock); -- goto retry; -- } -- } -- -- aml_dmx_after_retune(AM_TS_SRC_TS2, fe); -- -- afe->params = *c; -- -- /*pr_dbg("AML amldemod => frequency=%d,symbol_rate=%d\r\n", -- * p->frequency,p->u.qam.symbol_rate);*/ -- return 0; --} -- --static int gxtv_demod_dvbt_get_frontend(struct dvb_frontend *fe) --{ /*these content will be writed into eeprom .*/ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_fe *afe = fe->demodulator_priv; -- -- *c = afe->params; -- return 0; --} -- --int Gxtv_Demod_Dvbt_Init(struct aml_fe_dev *dev) --{ -- struct aml_demod_sys sys; -- struct aml_demod_i2c i2c; -- -- pr_dbg("AML Demod DVB-T init\r\n"); -- -- memset(&sys, 0, sizeof(sys)); -- memset(&i2c, 0, sizeof(i2c)); -- memset(&demod_status, 0, sizeof(demod_status)); -- i2c.tuner = dev->drv->id; -- i2c.addr = dev->i2c_addr; -- /* 0 -DVBC, 1-DVBT, ISDBT, 2-ATSC*/ -- demod_status.dvb_mode = Gxtv_Dvbt_Isdbt; -- sys.adc_clk = Adc_Clk_24M; -- sys.demod_clk = Demod_Clk_60M; -- demod_status.ch_if = Si2176_5M_If * 1000; -- demod_set_sys(&demod_status, &i2c, &sys); -- return 0; --} -- --static void gxtv_demod_atsc_release(struct dvb_frontend *fe) --{ -- struct aml_fe_dev *state = fe->demodulator_priv; -- -- uninstall_isr(state); -- -- kfree(state); --} -- --static int gxtv_demod_atsc_set_qam_mode(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_demod_atsc param; /*mode 3:64, 5:256, 7:vsb*/ -- fe_modulation_t mode; -- -- memset(¶m, 0, sizeof(param)); -- mode = c->modulation; -- pr_dbg("mode is %d\n", mode); -- atsc_qam_set(mode); -- return 0; --} -- --static int gxtv_demod_atsc_read_status -- (struct dvb_frontend *fe, fe_status_t *status) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; --/* struct aml_demod_i2c demod_i2c;*/ --/* struct aml_demod_sta demod_sta;*/ -- int ilock; -- unsigned char s = 0; -- -- s = amdemod_atsc_stat_islock(dev); -- if (s == 1) { -- ilock = 1; -- *status = -- FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | -- FE_HAS_VITERBI | FE_HAS_SYNC; -- } else { -- ilock = 0; -- *status = FE_TIMEDOUT; -- } -- if (last_lock != ilock) { -- pr_error("%s.\n", -- ilock ? "!! >> LOCK << !!" : "!! >> UNLOCK << !!"); -- last_lock = ilock; -- } -- -- return 0; --} -- --static int gxtv_demod_atsc_read_ber(struct dvb_frontend *fe, u32 *ber) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ --/* struct aml_fe_dev *dev = afe->dtv_demod;*/ --/* struct aml_demod_sts demod_sts;*/ --/* struct aml_demod_i2c demod_i2c;*/ --/* struct aml_demod_sta demod_sta;*/ -- --/* check_atsc_fsm_status();*/ -- return 0; --} -- --static int gxtv_demod_atsc_read_signal_strength -- (struct dvb_frontend *fe, u16 *strength) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- *strength = tuner_get_ch_power(dev); -- return 0; --} -- --static int gxtv_demod_atsc_read_snr(struct dvb_frontend *fe, u16 *snr) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ --/* struct aml_fe_dev *dev = afe->dtv_demod;*/ -- --/* struct aml_demod_sts demod_sts;*/ --/* struct aml_demod_i2c demod_i2c;*/ --/* struct aml_demod_sta demod_sta;*/ -- --/* * snr=check_atsc_fsm_status();*/ -- return 0; --} -- --static int gxtv_demod_atsc_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) --{ -- *ucblocks = 0; -- return 0; --} -- --static int gxtv_demod_atsc_set_frontend(struct dvb_frontend *fe) --{ --/* struct amlfe_state *state = fe->demodulator_priv;*/ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_demod_atsc param; --/* struct aml_demod_sta demod_sta;*/ --/* struct aml_demod_sts demod_sts;*/ -- struct aml_demod_i2c demod_i2c; -- int error, times; -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- demod_i2c.tuner = dev->drv->id; -- demod_i2c.addr = dev->i2c_addr; -- times = 2; -- -- memset(¶m, 0, sizeof(param)); -- param.ch_freq = c->frequency / 1000; -- -- last_lock = -1; -- /*p->u.vsb.modulation=QAM_64;*/ -- atsc_mode = c->modulation; -- /* param.mode = amdemod_qam(p->u.vsb.modulation);*/ -- param.mode = c->modulation; -- --retry: -- aml_dmx_before_retune(AM_TS_SRC_TS2, fe); -- aml_fe_analog_set_frontend(fe); -- atsc_set_ch(&demod_status, &demod_i2c, ¶m); -- -- /*{ -- * int ret; -- * ret = wait_event_interruptible_timeout( -- * dev->lock_wq, amdemod_atsc_stat_islock(dev), 4*HZ); -- * if(!ret) pr_error("amlfe wait lock timeout.\n"); -- * } */ --/*rsj_debug*/ -- /* int count; -- * for(count=0;count<10;count++){ -- * if(amdemod_atsc_stat_islock(dev)){ -- * pr_dbg("first lock success\n"); -- * break; -- * } -- * -- * msleep(200); -- * } */ -- -- times--; -- if (amdemod_atsc_stat_islock(dev) && times) { -- int lock; -- -- aml_dmx_start_error_check(AM_TS_SRC_TS2, fe); -- msleep(20); -- error = aml_dmx_stop_error_check(AM_TS_SRC_TS2, fe); -- lock = amdemod_atsc_stat_islock(dev); -- if ((error > 200) || !lock) { -- pr_error -- ("amlfe too many error,\t" -- "error count:%d lock statuc:%d, retry\n", -- error, lock); -- goto retry; -- } -- } -- -- aml_dmx_after_retune(AM_TS_SRC_TS2, fe); -- -- afe->params = *c; -- /*pr_dbg("AML amldemod => frequency=%d,symbol_rate=%d\r\n", -- * p->frequency,p->u.qam.symbol_rate);*/ -- return 0; --} -- --static int gxtv_demod_atsc_get_frontend(struct dvb_frontend *fe) --{ /*these content will be writed into eeprom .*/ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_fe *afe = fe->demodulator_priv; -- -- pr_dbg("c->frequency is %d\n", c->frequency); -- *c = afe->params; -- return 0; --} -- --int Gxtv_Demod_Atsc_Init(struct aml_fe_dev *dev) --{ -- struct aml_demod_sys sys; -- struct aml_demod_i2c i2c; -- -- pr_dbg("AML Demod ATSC init\r\n"); -- -- memset(&sys, 0, sizeof(sys)); -- memset(&i2c, 0, sizeof(i2c)); -- memset(&demod_status, 0, sizeof(demod_status)); -- /* 0 -DVBC, 1-DVBT, ISDBT, 2-ATSC*/ -- demod_status.dvb_mode = Gxtv_Atsc; -- sys.adc_clk = Adc_Clk_25_2M; /*Adc_Clk_26M;*/ -- sys.demod_clk = Demod_Clk_75M; /*Demod_Clk_71M;//Demod_Clk_78M;*/ -- demod_status.ch_if = 6350; -- demod_status.tmp = Adc_mode; -- demod_set_sys(&demod_status, &i2c, &sys); -- return 0; --} -- --static void gxtv_demod_dtmb_release(struct dvb_frontend *fe) --{ -- struct aml_fe_dev *state = fe->demodulator_priv; -- -- uninstall_isr(state); -- -- kfree(state); --} -- --static int gxtv_demod_dtmb_read_status -- (struct dvb_frontend *fe, fe_status_t *status) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; --/* struct aml_demod_i2c demod_i2c;*/ --/* struct aml_demod_sta demod_sta;*/ -- int ilock; -- unsigned char s = 0; -- --/* s = amdemod_dtmb_stat_islock(dev);*/ --/* if(s==1)*/ -- if (is_meson_txl_cpu()) -- s = dtmb_check_status_txl(fe); -- else -- s = dtmb_check_status_gxtv(fe); -- s = amdemod_dtmb_stat_islock(dev); --/* s=1;*/ -- if (s == 1) { -- ilock = 1; -- *status = -- FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | -- FE_HAS_VITERBI | FE_HAS_SYNC; -- } else { -- ilock = 0; -- *status = FE_TIMEDOUT; -- } -- if (last_lock != ilock) { -- pr_error("%s.\n", -- ilock ? "!! >> LOCK << !!" : "!! >> UNLOCK << !!"); -- last_lock = ilock; -- } -- -- return 0; --} -- --static int gxtv_demod_dtmb_read_ber(struct dvb_frontend *fe, u32 *ber) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ --/* struct aml_fe_dev *dev = afe->dtv_demod;*/ --/* struct aml_demod_sts demod_sts;*/ --/* struct aml_demod_i2c demod_i2c;*/ --/* struct aml_demod_sta demod_sta;*/ -- --/* check_atsc_fsm_status();*/ --/* int fec_bch_add; */ --/* fec_bch_add = dtmb_read_reg(0xdf); */ --/* *ber = fec_bch_add; */ -- return 0; --} -- --static int gxtv_demod_dtmb_read_signal_strength -- (struct dvb_frontend *fe, u16 *strength) --{ -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- *strength = tuner_get_ch_power(dev); -- return 0; --} -- --static int gxtv_demod_dtmb_read_snr(struct dvb_frontend *fe, u16 *snr) --{ --/* struct aml_fe *afe = fe->demodulator_priv;*/ --/* struct aml_fe_dev *dev = afe->dtv_demod;*/ --#if 1 -- int tmp, snr_avg; -- tmp = snr_avg = 0; -- tmp = dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR); --/* snr_avg = (tmp >> 16) & 0x3fff; -- if (snr_avg >= 2048) -- snr_avg = snr_avg - 4096; -- snr_avg = snr_avg / 32;*/ -- *snr = tmp&0xff; --#endif -- return 0; --} -- --static int gxtv_demod_dtmb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) --{ -- *ucblocks = 0; -- return 0; --} -- --static int gxtv_demod_dtmb_read_fsm(struct dvb_frontend *fe, u32 *fsm_status) --{ -- int tmp; -- tmp = dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0); -- *fsm_status = tmp&0xffffffff; -- pr_dbg("[rsj] fsm_status is %x\n", *fsm_status); -- return 0; --} -- -- --static int gxtv_demod_dtmb_set_frontend(struct dvb_frontend *fe) --{ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_demod_dtmb param; --/* struct aml_demod_sta demod_sta;*/ --/* struct aml_demod_sts demod_sts;*/ -- struct aml_demod_i2c demod_i2c; -- int times; -- struct aml_fe *afe = fe->demodulator_priv; -- struct aml_fe_dev *dev = afe->dtv_demod; -- -- demod_i2c.tuner = dev->drv->id; -- demod_i2c.addr = dev->i2c_addr; -- times = 2; -- pr_dbg("gxtv_demod_dtmb_set_frontend,freq is %d\n", c->frequency); -- memset(¶m, 0, sizeof(param)); -- param.ch_freq = c->frequency / 1000; -- -- last_lock = -1; --/* demod_power_switch(PWR_OFF); */ -- aml_fe_analog_set_frontend(fe); -- msleep(100); --/* demod_power_switch(PWR_ON); */ -- dtmb_set_ch(&demod_status, &demod_i2c, ¶m); -- afe->params = *c; -- /* pr_dbg("AML amldemod => frequency=%d,symbol_rate=%d\r\n", -- * p->frequency,p->u.qam.symbol_rate);*/ -- return 0; --} -- --static int gxtv_demod_dtmb_get_frontend(struct dvb_frontend *fe) --{ /*these content will be writed into eeprom .*/ -- struct dtv_frontend_properties *c = &fe->dtv_property_cache; -- struct aml_fe *afe = fe->demodulator_priv; -- -- *c = afe->params; --/* pr_dbg("[get frontend]c->frequency is %d\n",c->frequency);*/ -- return 0; --} -- --int Gxtv_Demod_Dtmb_Init(struct aml_fe_dev *dev) --{ -- struct aml_demod_sys sys; -- struct aml_demod_i2c i2c; -- pr_dbg("AML Demod DTMB init\r\n"); -- -- memset(&sys, 0, sizeof(sys)); -- memset(&i2c, 0, sizeof(i2c)); -- memset(&demod_status, 0, sizeof(demod_status)); -- /* 0 -DVBC, 1-DVBT, ISDBT, 2-ATSC*/ -- demod_status.dvb_mode = Gxtv_Dtmb; -- if (is_meson_txl_cpu()) { -- sys.adc_clk = Adc_Clk_25M; /*Adc_Clk_26M;*/ -- sys.demod_clk = Demod_Clk_225M; -- } else { -- sys.adc_clk = Adc_Clk_25M; /*Adc_Clk_26M;*/ -- sys.demod_clk = Demod_Clk_200M; -- } -- demod_status.ch_if = Si2176_5M_If; -- demod_status.tmp = Adc_mode; -- demod_status.spectrum = dev->spectrum; -- demod_set_sys(&demod_status, &i2c, &sys); -- return 0; --} -- --static int gxtv_demod_fe_get_ops(struct aml_fe_dev *dev, int mode, void *ops) --{ -- struct dvb_frontend_ops *fe_ops = (struct dvb_frontend_ops *)ops; -- -- if (mode == AM_FE_OFDM) { -- fe_ops->info.frequency_min = 51000000; -- fe_ops->info.frequency_max = 858000000; -- fe_ops->info.frequency_stepsize = 0; -- fe_ops->info.frequency_tolerance = 0; -- fe_ops->info.caps = -- FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | -- FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | -- FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | -- FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | -- FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | -- FE_CAN_RECOVER | FE_CAN_MUTE_TS; -- fe_ops->release = gxtv_demod_dvbt_release; -- fe_ops->set_frontend = gxtv_demod_dvbt_set_frontend; -- fe_ops->get_frontend = gxtv_demod_dvbt_get_frontend; -- fe_ops->read_status = gxtv_demod_dvbt_read_status; -- fe_ops->read_ber = gxtv_demod_dvbt_read_ber; -- fe_ops->read_signal_strength = -- gxtv_demod_dvbt_read_signal_strength; -- fe_ops->read_snr = gxtv_demod_dvbt_read_snr; -- fe_ops->read_ucblocks = gxtv_demod_dvbt_read_ucblocks; -- -- pr_dbg("=========================dvbt demod init\r\n"); -- Gxtv_Demod_Dvbt_Init(dev); -- } else if (mode == AM_FE_QAM) { -- fe_ops->info.frequency_min = 51000000; -- fe_ops->info.frequency_max = 858000000; -- fe_ops->info.frequency_stepsize = 0; -- fe_ops->info.frequency_tolerance = 0; -- fe_ops->info.caps = -- FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | -- FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | -- FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_32 | -- FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_QAM_64 | -- FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | -- FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | -- FE_CAN_RECOVER | FE_CAN_MUTE_TS; -- -- fe_ops->release = gxtv_demod_dvbc_release; -- fe_ops->set_frontend = gxtv_demod_dvbc_set_frontend; -- fe_ops->get_frontend = gxtv_demod_dvbc_get_frontend; -- fe_ops->read_status = gxtv_demod_dvbc_read_status; -- fe_ops->read_ber = gxtv_demod_dvbc_read_ber; -- fe_ops->read_signal_strength = -- gxtv_demod_dvbc_read_signal_strength; -- fe_ops->read_snr = gxtv_demod_dvbc_read_snr; -- fe_ops->read_ucblocks = gxtv_demod_dvbc_read_ucblocks; -- fe_ops->set_qam_mode = gxtv_demod_dvbc_set_qam_mode; -- install_isr(dev); -- pr_dbg("=========================dvbc demod init\r\n"); -- Gxtv_Demod_Dvbc_Init(dev, Adc_mode); -- } else if (mode == AM_FE_ATSC) { -- fe_ops->info.frequency_min = 51000000; -- fe_ops->info.frequency_max = 858000000; -- fe_ops->info.frequency_stepsize = 0; -- fe_ops->info.frequency_tolerance = 0; -- fe_ops->info.caps = -- FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | -- FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | -- FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | -- FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | -- FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | -- FE_CAN_RECOVER | FE_CAN_MUTE_TS; -- -- fe_ops->release = gxtv_demod_atsc_release; -- fe_ops->set_frontend = gxtv_demod_atsc_set_frontend; -- fe_ops->get_frontend = gxtv_demod_atsc_get_frontend; -- fe_ops->read_status = gxtv_demod_atsc_read_status; -- fe_ops->read_ber = gxtv_demod_atsc_read_ber; -- fe_ops->read_signal_strength = -- gxtv_demod_atsc_read_signal_strength; -- fe_ops->read_snr = gxtv_demod_atsc_read_snr; -- fe_ops->read_ucblocks = gxtv_demod_atsc_read_ucblocks; -- fe_ops->set_qam_mode = gxtv_demod_atsc_set_qam_mode; -- Gxtv_Demod_Atsc_Init(dev); -- } else if (mode == AM_FE_DTMB) { -- fe_ops->info.frequency_min = 51000000; -- fe_ops->info.frequency_max = 900000000; -- fe_ops->info.frequency_stepsize = 0; -- fe_ops->info.frequency_tolerance = 0; -- fe_ops->info.caps = -- FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | -- FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | -- FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | -- FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | -- FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | -- FE_CAN_RECOVER | FE_CAN_MUTE_TS; -- -- fe_ops->release = gxtv_demod_dtmb_release; -- fe_ops->set_frontend = gxtv_demod_dtmb_set_frontend; -- fe_ops->get_frontend = gxtv_demod_dtmb_get_frontend; -- fe_ops->read_status = gxtv_demod_dtmb_read_status; -- fe_ops->read_ber = gxtv_demod_dtmb_read_ber; -- fe_ops->read_signal_strength = -- gxtv_demod_dtmb_read_signal_strength; -- fe_ops->read_snr = gxtv_demod_dtmb_read_snr; -- fe_ops->read_ucblocks = gxtv_demod_dtmb_read_ucblocks; -- fe_ops->read_dtmb_fsm = gxtv_demod_dtmb_read_fsm; -- Gxtv_Demod_Dtmb_Init(dev); -- } -- return 0; --} -- --static int gxtv_demod_fe_resume(struct aml_fe_dev *dev) --{ -- pr_dbg("gxtv_demod_fe_resume\n"); --/* demod_power_switch(PWR_ON);*/ -- Gxtv_Demod_Dtmb_Init(dev); -- return 0; --} -- --static int gxtv_demod_fe_suspend(struct aml_fe_dev *dev) --{ -- pr_dbg("gxtv_demod_fe_suspend\n"); --/* demod_power_switch(PWR_OFF);*/ -- return 0; --} -- --static int gxtv_demod_fe_enter_mode(struct aml_fe *fe, int mode) --{ -- struct aml_fe_dev *dev = fe->dtv_demod; -- int memstart_dtmb; -- -- /* must enable the adc ref signal for demod, */ -- vdac_enable(1, 0x2); -- -- autoFlagsTrig = 1; -- if (cci_thread) -- if (dvbc_get_cci_task() == 1) -- dvbc_create_cci_task(); -- memstart_dtmb = fe->dtv_demod->mem_start; -- pr_dbg("[im]memstart is %x\n", memstart_dtmb); -- /*mem_buf = (long *)phys_to_virt(memstart);*/ -- if (mode == AM_FE_DTMB) { -- Gxtv_Demod_Dtmb_Init(dev); -- dtmb_write_reg(DTMB_FRONT_MEM_ADDR, memstart_dtmb); -- pr_dbg("[dtmb]mem_buf is 0x%x\n", -- dtmb_read_reg(DTMB_FRONT_MEM_ADDR)); -- } else if (mode == AM_FE_QAM) { -- Gxtv_Demod_Dvbc_Init(dev, Adc_mode); -- } -- -- return 0; --} -- --static int gxtv_demod_fe_leave_mode(struct aml_fe *fe, int mode) --{ -- dtvpll_init_flag(0); -- /*dvbc_timer_exit();*/ -- if (cci_thread) -- dvbc_kill_cci_task(); -- -- /* should disable the adc ref signal for demod */ -- vdac_enable(0, 0x2); -- -- return 0; --} -- --static struct aml_fe_drv gxtv_demod_dtv_demod_drv = { -- .id = AM_DTV_DEMOD_M1, -- .name = "AMLDEMOD", -- .capability = -- AM_FE_QPSK | AM_FE_QAM | AM_FE_ATSC | AM_FE_OFDM | AM_FE_DTMB, -- .get_ops = gxtv_demod_fe_get_ops, -- .suspend = gxtv_demod_fe_suspend, -- .resume = gxtv_demod_fe_resume, -- .enter_mode = gxtv_demod_fe_enter_mode, -- .leave_mode = gxtv_demod_fe_leave_mode --}; -- --struct class *gxtv_clsp; --struct class *gxtv_para_clsp; -- --static int __init gxtvdemodfrontend_init(void) --{ -- int ret; -- -- pr_dbg("register gxtv_demod demod driver\n"); -- ret = 0; -- -- dtvpll_lock_init(); -- mutex_init(&aml_lock); -- -- gxtv_clsp = class_create(THIS_MODULE, DEMOD_DEVICE_NAME); -- if (!gxtv_clsp) { -- pr_error("[gxtv demod]%s:create class error.\n", __func__); -- return PTR_ERR(gxtv_clsp); -- } -- ret = class_create_file(gxtv_clsp, &class_attr_auto_sym); -- if (ret) -- pr_error("[gxtv demod]%s create class error.\n", __func__); -- -- ret = class_create_file(gxtv_clsp, &class_attr_dtmb_para); -- if (ret) -- pr_error("[gxtv demod]%s create class error.\n", __func__); -- -- ret = class_create_file(gxtv_clsp, &class_attr_dvbc_reg); -- if (ret) -- pr_error("[gxtv demod]%s create class error.\n", __func__); -- -- return aml_register_fe_drv(AM_DEV_DTV_DEMOD, &gxtv_demod_dtv_demod_drv); --} -- --static void __exit gxtvdemodfrontend_exit(void) --{ -- pr_dbg("unregister gxtv_demod demod driver\n"); -- -- mutex_destroy(&aml_lock); -- -- class_remove_file(gxtv_clsp, &class_attr_auto_sym); -- class_remove_file(gxtv_clsp, &class_attr_dtmb_para); -- class_remove_file(gxtv_clsp, &class_attr_dvbc_reg); -- class_destroy(gxtv_clsp); -- aml_unregister_fe_drv(AM_DEV_DTV_DEMOD, &gxtv_demod_dtv_demod_drv); --} -- --fs_initcall(gxtvdemodfrontend_init); --module_exit(gxtvdemodfrontend_exit); -- --MODULE_DESCRIPTION("gxtv_demod DVB-T/DVB-C/DTMB Demodulator driver"); --MODULE_AUTHOR("RSJ"); --MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/amldemod/demod_func.c b/drivers/amlogic/dvb_tv/amldemod/demod_func.c -deleted file mode 100644 -index 4058861..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/demod_func.c -+++ /dev/null -@@ -1,2852 +0,0 @@ --/*#include "register.h"*/ --/*#include "c_arc_pointer_reg.h"*/ --/*#include "a9_func.h"*/ --/*#include "clk_util.h"*/ --/*#include "c_stimulus.h"*/ --/*#include "a9_l2_func.h"*/ -- --#include "demod_func.h" --#include --#include --#include --#include "acf_filter_coefficient.h" --#include -- --#define M6D -- --/* static void __iomem * demod_meson_reg_map[4]; */ -- --#define pr_dbg(fmt, args ...) \ -- do { \ -- if (debug_demod) \ -- pr_info("FE: " fmt, ## args); \ -- } while (0) --#define pr_error(fmt, args ...) printk("FE: " fmt, ## args) -- --MODULE_PARM_DESC(debug_demod, "\n\t\t Enable frontend debug information"); --static int debug_demod; --module_param(debug_demod, int, 0644); -- --MODULE_PARM_DESC(demod_timeout, "\n\t\t timeout debug information"); --static int demod_timeout = 120; --module_param(demod_timeout, int, 0644); -- --MODULE_PARM_DESC(demod_sync_count, "\n\t\t timeout debug information"); --static int demod_sync_count = 60; --module_param(demod_sync_count, int, 0644); -- --MODULE_PARM_DESC(demod_sync_delay_time, "\n\t\t timeout debug information"); --static int demod_sync_delay_time = 8; --module_param(demod_sync_delay_time, int, 0644); -- -- -- --MODULE_PARM_DESC(demod_mobile_power, "\n\t\t demod_mobile_power debug information"); --static int demod_mobile_power = 100; --module_param(demod_mobile_power, int, 0644); -- --MODULE_PARM_DESC(demod_enable_performance, "\n\t\t demod_enable_performance information"); --static int demod_enable_performance = 1; --module_param(demod_enable_performance, int, 0644); -- -- --static struct mutex mp; --static struct mutex dtvpll_init_lock; --static int dtvpll_init; --static int dtmb_spectrum = 2; -- -- --/* 8vsb */ --static struct atsc_cfg list_8vsb[22] = { -- {0x0733, 0x00, 0}, -- {0x0734, 0xff, 0}, -- {0x0716, 0x02, 0}, /* F06[7] invert spectrum 0x02 0x06 */ -- {0x05e7, 0x00, 0}, -- {0x05e8, 0x00, 0}, -- {0x0f06, 0x80, 0}, -- {0x0f09, 0x04, 0}, -- {0x070c, 0x18, 0}, -- {0x070d, 0x9d, 0}, -- {0x070e, 0x89, 0}, -- {0x070f, 0x6a, 0}, -- {0x0710, 0x75, 0}, -- {0x0711, 0x6f, 0}, -- {0x072a, 0x02, 0}, -- {0x072c, 0x02, 0}, -- {0x090d, 0x03, 0}, -- {0x090e, 0x02, 0}, -- {0x090f, 0x00, 0}, -- {0x0900, 0x01, 0}, -- {0x0900, 0x00, 0}, -- {0x0f00, 0x01, 0}, -- {0x0000, 0x00, 1} --}; -- --/* 64qam */ --static struct atsc_cfg list_qam64[111] = { -- {0x0900, 0x01, 0}, -- {0x0f04, 0x08, 0}, -- {0x0f06, 0x80, 0}, -- {0x0f07, 0x00, 0}, -- {0x0f00, 0xe0, 0}, -- {0x0f00, 0xec, 0}, -- {0x0001, 0x05, 0}, -- {0x0002, 0x61, 0}, /* /0x61 invert spectrum */ -- {0x0003, 0x3e, 0}, -- {0x0004, 0xed, 0}, /* 0x9d */ -- {0x0005, 0x10, 0}, -- {0x0006, 0xc0, 0}, -- {0x0007, 0x5c, 0}, -- {0x0008, 0x0f, 0}, -- {0x0009, 0x4f, 0}, -- {0x000a, 0xfc, 0}, -- {0x000b, 0x0c, 0}, -- {0x000c, 0x6c, 0}, -- {0x000d, 0x3a, 0}, -- {0x000e, 0x10, 0}, -- {0x000f, 0x02, 0}, -- {0x0011, 0x00, 0}, -- {0x0012, 0xf5, 0}, -- {0x0013, 0x74, 0}, -- {0x0014, 0xb9, 0}, -- {0x0015, 0x1f, 0}, -- {0x0016, 0x80, 0}, -- {0x0017, 0x1f, 0}, -- {0x0018, 0x0f, 0}, -- {0x001e, 0x00, 0}, -- {0x001f, 0x00, 0}, -- {0x0023, 0x03, 0}, -- {0x0025, 0x20, 0}, -- {0x0026, 0xff, 0}, -- {0x0027, 0xff, 0}, -- {0x0028, 0xf8, 0}, -- {0x0200, 0x20, 0}, -- {0x0201, 0x62, 0}, -- {0x0202, 0x23, 0}, -- {0x0204, 0x19, 0}, -- {0x0205, 0x74, 0}, -- {0x0206, 0xab, 0}, -- {0x0207, 0xff, 0}, -- {0x0208, 0xc0, 0}, -- {0x0209, 0xff, 0}, -- {0x0211, 0xc0, 0}, -- {0x0212, 0xb0, 0}, -- {0x0213, 0x05, 0}, -- {0x0215, 0x08, 0}, -- {0x0222, 0xe0, 0}, -- {0x0223, 0xf0, 0}, -- {0x0226, 0x40, 0}, -- {0x0229, 0x23, 0}, -- {0x022a, 0x02, 0}, -- {0x022c, 0x01, 0}, -- {0x022e, 0x01, 0}, -- {0x022f, 0x25, 0}, -- {0x0230, 0x40, 0}, -- {0x0231, 0x01, 0}, -- {0x0734, 0xff, 0}, -- {0x073a, 0xff, 0}, -- {0x073b, 0x04, 0}, -- {0x073c, 0x08, 0}, -- {0x073d, 0x08, 0}, -- {0x073e, 0x01, 0}, -- {0x073f, 0xf8, 0}, -- {0x0740, 0xf1, 0}, -- {0x0741, 0xf3, 0}, -- {0x0742, 0xff, 0}, -- {0x0743, 0x0f, 0}, -- {0x0744, 0x1a, 0}, -- {0x0745, 0x16, 0}, -- {0x0746, 0x00, 0}, -- {0x0747, 0xe3, 0}, -- {0x0748, 0xce, 0}, -- {0x0749, 0xd4, 0}, -- {0x074a, 0x00, 0}, -- {0x074b, 0x4b, 0}, -- {0x074c, 0x00, 0}, -- {0x074d, 0xa2, 0}, -- {0x074e, 0x00, 0}, -- {0x074f, 0xe6, 0}, -- {0x0750, 0x00, 0}, -- {0x0751, 0x00, 0}, -- {0x0752, 0x01, 0}, -- {0x0753, 0x03, 0}, -- {0x0400, 0x00, 0}, -- {0x0408, 0x04, 0}, -- {0x040e, 0xe0, 0}, -- {0x0500, 0x02, 0}, -- {0x05e7, 0x00, 0}, -- {0x05e8, 0x00, 0}, -- {0x0f09, 0x18, 0}, -- {0x070c, 0x20, 0}, -- {0x070d, 0x41, 0}, /* 0x49 */ -- {0x070e, 0x04, 0}, /* 0x37 */ -- {0x070f, 0x00, 0}, -- {0x0710, 0x00, 0}, -- {0x0711, 0x00, 0}, -- {0x0716, 0xf0, 0}, -- {0x090f, 0x00, 0}, -- {0x0900, 0x01, 1}, -- {0x0900, 0x00, 0}, -- {0x0001, 0xf5, 0}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0x05, 0}, -- {0x0001, 0x05, 1}, -- {0x0000, 0x00, 1} --}; -- --/* 256qam */ --static struct atsc_cfg list_qam256[113] = { -- {0x0900, 0x01, 0}, -- {0x0f04, 0x08, 0}, -- {0x0f06, 0x80, 0}, -- {0x0f00, 0xe0, 0}, -- {0x0f00, 0xec, 0}, -- {0x0001, 0x05, 0}, -- {0x0002, 0x01, 0}, /* 0x09 */ -- {0x0003, 0x2c, 0}, -- {0x0004, 0x91, 0}, -- {0x0005, 0x10, 0}, -- {0x0006, 0xc0, 0}, -- {0x0007, 0x5c, 0}, -- {0x0008, 0x0f, 0}, -- {0x0009, 0x4f, 0}, -- {0x000a, 0xfc, 0}, -- {0x000b, 0x0c, 0}, -- {0x000c, 0x6c, 0}, -- {0x000d, 0x3a, 0}, -- {0x000e, 0x10, 0}, -- {0x000f, 0x02, 0}, -- {0x0011, 0x80, 0}, -- {0x0012, 0xf5, 0}, /* a5 */ -- {0x0013, 0x74, 0}, -- {0x0014, 0xb9, 0}, -- {0x0015, 0x1f, 0}, -- {0x0016, 0x80, 0}, -- {0x0017, 0x1f, 0}, -- {0x0018, 0x0f, 0}, -- {0x001e, 0x00, 0}, -- {0x001f, 0x00, 0}, -- {0x0023, 0x03, 0}, -- {0x0025, 0x20, 0}, -- {0x0026, 0xff, 0}, -- {0x0027, 0xff, 0}, -- {0x0028, 0xf8, 0}, -- {0x0200, 0x20, 0}, -- {0x0201, 0x62, 0}, -- {0x0202, 0x23, 0}, -- {0x0204, 0x19, 0}, -- {0x0205, 0x76, 0}, -- {0x0206, 0xd2, 0}, -- {0x0207, 0xff, 0}, -- {0x0208, 0xc0, 0}, -- {0x0209, 0xff, 0}, -- {0x0211, 0xc0, 0}, -- {0x0212, 0xb0, 0}, -- {0x0213, 0x05, 0}, -- {0x0215, 0x08, 0}, -- {0x0222, 0xf0, 0}, -- {0x0223, 0xff, 0}, -- {0x0226, 0x40, 0}, -- {0x0229, 0x23, 0}, -- {0x022a, 0x02, 0}, -- {0x022c, 0x01, 0}, -- {0x022e, 0x01, 0}, -- {0x022f, 0x05, 0}, -- {0x0230, 0x40, 0}, -- {0x0231, 0x01, 0}, -- {0x0400, 0x02, 0}, -- {0x0401, 0x30, 0}, -- {0x0402, 0x13, 0}, -- {0x0406, 0x06, 0}, -- {0x0408, 0x04, 0}, -- {0x040e, 0xe0, 0}, -- {0x0411, 0x02, 0}, -- {0x073a, 0x02, 0}, -- {0x073b, 0x09, 0}, -- {0x073c, 0x0c, 0}, -- {0x073d, 0x08, 0}, -- {0x073e, 0xfd, 0}, -- {0x073f, 0xf2, 0}, -- {0x0740, 0xed, 0}, -- {0x0741, 0xf4, 0}, -- {0x0742, 0x03, 0}, -- {0x0743, 0x15, 0}, -- {0x0744, 0x1d, 0}, -- {0x0745, 0x15, 0}, -- {0x0746, 0xfc, 0}, -- {0x0747, 0xde, 0}, -- {0x0748, 0xcc, 0}, -- {0x0749, 0xd6, 0}, -- {0x074a, 0x04, 0}, -- {0x074b, 0x4f, 0}, -- {0x074c, 0x00, 0}, -- {0x074d, 0xa2, 0}, -- {0x074e, 0x00, 0}, -- {0x074f, 0xe3, 0}, -- {0x0750, 0x00, 0}, -- {0x0751, 0xfc, 0}, -- {0x0752, 0x00, 0}, -- {0x0753, 0x03, 0}, -- {0x0500, 0x02, 0}, -- {0x05e7, 0x00, 0}, -- {0x05e8, 0x00, 0}, -- {0x0f09, 0x18, 0}, -- {0x070c, 0x20, 0}, -- {0x070d, 0x49, 0}, -- {0x070e, 0x37, 0}, -- {0x070f, 0x00, 0}, -- {0x0710, 0x00, 0}, -- {0x0711, 0x00, 0}, -- {0x0716, 0xf0, 0}, -- {0x090f, 0x00, 0}, -- {0x0900, 0x01, 1}, -- {0x0900, 0x00, 0}, -- {0x0001, 0xf5, 0}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0xf5, 1}, -- {0x0001, 0x05, 0}, -- {0x0001, 0x05, 1}, -- {0x0000, 0x00, 1} --}; -- --void dtvpll_lock_init(void) --{ -- mutex_init(&dtvpll_init_lock); --} -- --void dtvpll_init_flag(int on) --{ -- mutex_lock(&dtvpll_init_lock); -- dtvpll_init = on; -- mutex_unlock(&dtvpll_init_lock); -- pr_err("%s %d\n", __func__, on); --} -- --int get_dtvpll_init_flag(void) --{ -- int val; -- mutex_lock(&dtvpll_init_lock); -- val = dtvpll_init; -- mutex_unlock(&dtvpll_init_lock); -- if (!val) -- pr_err("%s: %d\n", __func__, val); -- return val; --} -- --void adc_dpll_setup(int clk_a, int clk_b, int clk_sys) --{ -- int unit, found, ena, enb, div2; -- int pll_m, pll_n, pll_od_a, pll_od_b, pll_xd_a, pll_xd_b; -- long freq_osc, freq_dco, freq_b, freq_a, freq_sys; -- long freq_b_act, freq_a_act, freq_sys_act, err_tmp, best_err; -- union adc_pll_cntl adc_pll_cntl; -- union adc_pll_cntl2 adc_pll_cntl2; -- union adc_pll_cntl3 adc_pll_cntl3; -- union adc_pll_cntl4 adc_pll_cntl4; -- union demod_dig_clk dig_clk_cfg; -- -- adc_pll_cntl.d32 = 0; -- adc_pll_cntl2.d32 = 0; -- adc_pll_cntl3.d32 = 0; -- adc_pll_cntl4.d32 = 0; -- -- pr_dbg("target clk_a %d clk_b %d\n", clk_a, clk_b); -- -- unit = 10000; /* 10000 as 1 MHz, 0.1 kHz resolution. */ -- freq_osc = 24 * unit; -- -- if (clk_a < 1000) -- freq_a = clk_a * unit; -- else -- freq_a = clk_a * (unit / 1000); -- -- if (clk_b < 1000) -- freq_b = clk_b * unit; -- else -- freq_b = clk_b * (unit / 1000); -- -- ena = clk_a > 0 ? 1 : 0; -- enb = clk_b > 0 ? 1 : 0; -- -- if (ena || enb) -- adc_pll_cntl3.b.enable = 1; -- adc_pll_cntl3.b.reset = 1; -- -- found = 0; -- best_err = 100 * unit; -- pll_od_a = 1; -- pll_od_b = 1; -- pll_n = 1; -- for (pll_m = 1; pll_m < 512; pll_m++) { -- /* for (pll_n=1; pll_n<=5; pll_n++) { */ -- if (is_meson_txl_cpu()) { -- freq_dco = freq_osc * pll_m / pll_n / 2;/*txl add div2*/ -- if (freq_dco < 700 * unit || freq_dco > 1000 * unit) -- continue; -- } else { -- freq_dco = freq_osc * pll_m / pll_n; -- if (freq_dco < 750 * unit || freq_dco > 1550 * unit) -- continue; -- } -- pll_xd_a = freq_dco / (1 << pll_od_a) / freq_a; -- pll_xd_b = freq_dco / (1 << pll_od_b) / freq_b; -- -- freq_a_act = freq_dco / (1 << pll_od_a) / pll_xd_a; -- freq_b_act = freq_dco / (1 << pll_od_b) / pll_xd_b; -- -- err_tmp = (freq_a_act - freq_a) * ena + (freq_b_act - freq_b) * -- enb; -- -- if (err_tmp >= best_err) -- continue; -- -- adc_pll_cntl.b.pll_m = pll_m; -- adc_pll_cntl.b.pll_n = pll_n; -- adc_pll_cntl.b.pll_od0 = pll_od_b; -- adc_pll_cntl.b.pll_od1 = pll_od_a; -- adc_pll_cntl.b.pll_xd0 = pll_xd_b; -- adc_pll_cntl.b.pll_xd1 = pll_xd_a; -- if (is_meson_txl_cpu()) { -- adc_pll_cntl4.b.pll_od3 = 0; -- adc_pll_cntl.b.pll_od2 = 0; -- } else { -- adc_pll_cntl2.b.div2_ctrl = -- freq_dco > 1000 * unit ? 1 : 0; -- } -- found = 1; -- best_err = err_tmp; -- /* } */ -- } -- -- pll_m = adc_pll_cntl.b.pll_m; -- pll_n = adc_pll_cntl.b.pll_n; -- pll_od_b = adc_pll_cntl.b.pll_od0; -- pll_od_a = adc_pll_cntl.b.pll_od1; -- pll_xd_b = adc_pll_cntl.b.pll_xd0; -- pll_xd_a = adc_pll_cntl.b.pll_xd1; -- -- if (is_meson_txl_cpu()) -- div2 = 1; -- else -- div2 = adc_pll_cntl2.b.div2_ctrl; -- /* -- * p_adc_pll_cntl = adc_pll_cntl.d32; -- * p_adc_pll_cntl2 = adc_pll_cntl2.d32; -- * p_adc_pll_cntl3 = adc_pll_cntl3.d32; -- * p_adc_pll_cntl4 = adc_pll_cntl4.d32; -- */ -- adc_pll_cntl3.b.reset = 0; -- /* *p_adc_pll_cntl3 = adc_pll_cntl3.d32; */ -- if (!found) { -- pr_dbg(" ERROR can't setup %7ld kHz %7ld kHz\n", -- freq_b / (unit / 1000), freq_a / (unit / 1000)); -- } else { -- if (is_meson_txl_cpu()) -- freq_dco = freq_osc * pll_m / pll_n / 2; -- else -- freq_dco = freq_osc * pll_m / pll_n; -- pr_dbg(" ADC PLL M %3d N %3d\n", pll_m, pll_n); -- pr_dbg(" ADC PLL DCO %ld kHz\n", freq_dco / (unit / 1000)); -- -- pr_dbg(" ADC PLL XD %3d OD %3d\n", pll_xd_b, pll_od_b); -- pr_dbg(" ADC PLL XD %3d OD %3d\n", pll_xd_a, pll_od_a); -- -- freq_a_act = freq_dco / (1 << pll_od_a) / pll_xd_a; -- freq_b_act = freq_dco / (1 << pll_od_b) / pll_xd_b; -- -- pr_dbg(" B %7ld kHz %7ld kHz\n", -- freq_b / (unit / 1000), freq_b_act / (unit / 1000)); -- pr_dbg(" A %7ld kHz %7ld kHz\n", -- freq_a / (unit / 1000), freq_a_act / (unit / 1000)); -- -- if (clk_sys > 0) { -- dig_clk_cfg.b.demod_clk_en = 1; -- dig_clk_cfg.b.demod_clk_sel = 3; -- if (clk_sys < 1000) -- freq_sys = clk_sys * unit; -- else -- freq_sys = clk_sys * (unit / 1000); -- -- dig_clk_cfg.b.demod_clk_div = freq_dco / (1 + div2) / -- freq_sys - 1; -- freq_sys_act = freq_dco / (1 + div2) / -- (dig_clk_cfg.b.demod_clk_div + 1); -- pr_dbg(" SYS %7ld kHz div %d+1 %7ld kHz\n", -- freq_sys / (unit / 1000), -- dig_clk_cfg.b.demod_clk_div, -- freq_sys_act / (unit / 1000)); -- } else { -- dig_clk_cfg.b.demod_clk_en = 0; -- } -- -- /* *p_demod_dig_clk = dig_clk_cfg.d32; */ -- } -- if (is_meson_txl_cpu()) { -- demod_set_demod_reg(TXLTV_ADC_RESET_VALUE, ADC_REG3); -- demod_set_demod_reg(adc_pll_cntl.d32, ADC_REG1); -- demod_set_demod_reg(dig_clk_cfg.d32, ADC_REG6); -- demod_set_demod_reg(TXLTV_ADC_REG3_VALUE, ADC_REG3); -- /* debug */ -- pr_dbg("[adc][%x]%x\n", ADC_REG1, -- demod_read_demod_reg(ADC_REG1)); -- pr_dbg("[adc][%x]%x\n", ADC_REG2, -- demod_read_demod_reg(ADC_REG2)); -- pr_dbg("[adc][%x]%x\n", ADC_REG3, -- demod_read_demod_reg(ADC_REG3)); -- pr_dbg("[adc][%x]%x\n", ADC_REG4, -- demod_read_demod_reg(ADC_REG4)); -- pr_dbg("[adc][%x]%x\n", ADC_REG5, -- demod_read_demod_reg(ADC_REG5)); -- pr_dbg("[adc][%x]%x\n", ADC_REG6, -- demod_read_demod_reg(ADC_REG6)); -- pr_dbg("[adc][%x]%x\n", ADC_REG7, -- demod_read_demod_reg(ADC_REG7)); -- pr_dbg("[adc][%x]%x\n", ADC_REG8, -- demod_read_demod_reg(ADC_REG8)); -- pr_dbg("[adc][%x]%x\n", ADC_REG9, -- demod_read_demod_reg(ADC_REG9)); -- pr_dbg("[adc][%x]%x\n", ADC_REGB, -- demod_read_demod_reg(ADC_REGB)); -- pr_dbg("[adc][%x]%x\n", ADC_REGC, -- demod_read_demod_reg(ADC_REGC)); -- pr_dbg("[adc][%x]%x\n", ADC_REGD, -- demod_read_demod_reg(ADC_REGD)); -- pr_dbg("[adc][%x]%x\n", ADC_REGE, -- demod_read_demod_reg(ADC_REGE)); -- pr_dbg("[demod][%x]%x\n", DEMOD_REG1, -- demod_read_demod_reg(DEMOD_REG1)); -- pr_dbg("[demod][%x]%x\n", DEMOD_REG2, -- demod_read_demod_reg(DEMOD_REG2)); -- pr_dbg("[demod][%x]%x\n", DEMOD_REG3, -- demod_read_demod_reg(DEMOD_REG3)); -- } else { -- demod_set_demod_reg(ADC_RESET_VALUE, ADC_REG3); /* adc reset */ -- demod_set_demod_reg(adc_pll_cntl.d32, ADC_REG1); -- demod_set_demod_reg(dig_clk_cfg.d32, ADC_REG6); -- demod_set_demod_reg(ADC_REG3_VALUE, ADC_REG3); -- /* debug */ -- pr_dbg("[adc][%x]%x\n", ADC_REG1, -- demod_read_demod_reg(ADC_REG1)); -- pr_dbg("[adc][%x]%x\n", ADC_REG2, -- demod_read_demod_reg(ADC_REG2)); -- pr_dbg("[adc][%x]%x\n", ADC_REG3, -- demod_read_demod_reg(ADC_REG3)); -- pr_dbg("[adc][%x]%x\n", ADC_REG4, -- demod_read_demod_reg(ADC_REG4)); -- pr_dbg("[adc][%x]%x\n", ADC_REG6, -- demod_read_demod_reg(ADC_REG6)); -- pr_dbg("[demod][%x]%x\n", DEMOD_REG1, -- demod_read_demod_reg(DEMOD_REG1)); -- pr_dbg("[demod][%x]%x\n", DEMOD_REG2, -- demod_read_demod_reg(DEMOD_REG2)); -- pr_dbg("[demod][%x]%x\n", DEMOD_REG3, -- demod_read_demod_reg(DEMOD_REG3)); -- } -- dtvpll_init_flag(1); --} -- --void demod_set_adc_core_clk(int adc_clk, int sys_clk, int dvb_mode) --{ -- adc_dpll_setup(25, adc_clk, sys_clk); --} -- --void demod_set_cbus_reg(unsigned data, unsigned addr) --{ -- void __iomem *vaddr; -- pr_dbg("[cbus][write]%x\n", (IO_CBUS_PHY_BASE + (addr << 2))); -- vaddr = ioremap((IO_CBUS_PHY_BASE + (addr << 2)), 0x4); -- writel(data, vaddr); -- iounmap(vaddr); --} -- --unsigned demod_read_cbus_reg(unsigned addr) --{ --/* return __raw_readl(CBUS_REG_ADDR(addr)); */ -- unsigned tmp; -- void __iomem *vaddr; -- vaddr = ioremap((IO_CBUS_PHY_BASE + (addr << 2)), 0x4); -- tmp = readl(vaddr); -- iounmap(vaddr); --/* tmp = aml_read_cbus(addr); */ -- pr_dbg("[cbus][read]%x,data is %x\n", -- (IO_CBUS_PHY_BASE + (addr << 2)), tmp); -- return tmp; --} -- --void demod_set_ao_reg(unsigned data, unsigned addr) --{ -- void __iomem *vaddr; -- --/* pr_dbg("[ao][write]%x,data is %x\n",(IO_AOBUS_BASE+addr),data); */ -- vaddr = ioremap((IO_AOBUS_BASE + addr), 0x4); -- writel(data, vaddr); -- iounmap(vaddr); --} -- --unsigned demod_read_ao_reg(unsigned addr) --{ -- unsigned tmp; -- void __iomem *vaddr; -- --/* pr_dbg("[ao][read]%x\n",(IO_AOBUS_BASE+addr)); */ -- vaddr = ioremap((IO_AOBUS_BASE + addr), 0x4); -- tmp = readl(vaddr); --/* pr_dbg("[ao][read]%x,data is %x\n",(IO_AOBUS_BASE+addr),tmp); */ -- iounmap(vaddr); -- return tmp; --} -- --void demod_set_demod_reg(unsigned data, unsigned addr) --{ -- void __iomem *vaddr; -- mutex_lock(&mp); --/* printk("[demod][write]%x,data is %x\n",(addr),data); */ -- vaddr = ioremap((addr), 0x4); -- writel(data, vaddr); -- iounmap(vaddr); -- mutex_unlock(&mp); --} -- --unsigned demod_read_demod_reg(unsigned addr) --{ -- unsigned tmp; -- void __iomem *vaddr; -- mutex_lock(&mp); -- vaddr = ioremap((addr), 0x4); -- tmp = readl(vaddr); -- iounmap(vaddr); -- mutex_unlock(&mp); --/* printk("[demod][read]%x,data is %x\n",(addr),tmp); */ -- return tmp; --} -- --void demod_power_switch(int pwr_cntl) --{ -- int reg_data; --#if 1 -- if (pwr_cntl == PWR_ON) { -- pr_dbg("[PWR]: Power on demod_comp %x,%x\n", -- AO_RTI_GEN_PWR_SLEEP0, AO_RTI_GEN_PWR_ISO0); -- /* Powerup demod_comb */ -- reg_data = demod_read_ao_reg(AO_RTI_GEN_PWR_SLEEP0); -- demod_set_ao_reg((reg_data & (~(0x1 << 10))), -- AO_RTI_GEN_PWR_SLEEP0); -- /* [10] power on */ -- pr_dbg("[PWR]: Power on demod_comp %x,%x\n", -- HHI_DEMOD_MEM_PD_REG, RESET0_LEVEL); -- /* Power up memory */ -- demod_set_demod_reg((demod_read_demod_reg(HHI_DEMOD_MEM_PD_REG) -- & (~0x2fff)), HHI_DEMOD_MEM_PD_REG); -- /* reset */ -- demod_set_demod_reg((demod_read_demod_reg(RESET0_LEVEL) & -- (~(0x1 << 8))), RESET0_LEVEL); -- /* msleep(20);*/ -- -- /* remove isolation */ -- demod_set_ao_reg( -- (demod_read_ao_reg(AO_RTI_GEN_PWR_ISO0) & -- (~(0x3 << 14))), AO_RTI_GEN_PWR_ISO0); -- /* pull up reset */ -- demod_set_demod_reg((demod_read_demod_reg(RESET0_LEVEL) | -- (0x1 << 8)), RESET0_LEVEL); --/* *P_RESET0_LEVEL |= (0x1<<8); */ -- } else { -- pr_dbg("[PWR]: Power off demod_comp\n"); -- /* add isolation */ -- -- demod_set_ao_reg( -- (demod_read_ao_reg(AO_RTI_GEN_PWR_ISO0) | -- (0x3 << 14)), AO_RTI_GEN_PWR_ISO0); -- -- /* power down memory */ -- demod_set_demod_reg((demod_read_demod_reg(HHI_DEMOD_MEM_PD_REG) -- | 0x2fff), HHI_DEMOD_MEM_PD_REG); -- /* power down demod_comb */ -- reg_data = demod_read_ao_reg(AO_RTI_GEN_PWR_SLEEP0); -- demod_set_ao_reg((reg_data | (0x1 << 10)), -- AO_RTI_GEN_PWR_SLEEP0); -- /* [10] power on */ -- } --#endif --} -- --static void clocks_set_sys_defaults(unsigned char dvb_mode) --{ -- union demod_cfg0 cfg0; -- union demod_cfg2 cfg2; -- -- demod_power_switch(PWR_ON); -- -- if (is_meson_gxtvbb_cpu()) { -- pr_dbg("GX_TV config\n"); -- demod_set_demod_reg(ADC_RESET_VALUE, ADC_REG3); -- demod_set_demod_reg(ADC_REG1_VALUE, ADC_REG1); -- demod_set_demod_reg(ADC_REG2_VALUE, ADC_REG2); -- demod_set_demod_reg(ADC_REG4_VALUE, ADC_REG4); -- demod_set_demod_reg(ADC_REG3_VALUE, ADC_REG3); -- /* dadc */ -- demod_set_demod_reg(ADC_REG7_VALUE, ADC_REG7); -- demod_set_demod_reg(ADC_REG8_VALUE, ADC_REG8); -- demod_set_demod_reg(ADC_REG9_VALUE, ADC_REG9); -- demod_set_demod_reg(ADC_REGA_VALUE, ADC_REGA); -- } else if (is_meson_txl_cpu()) { -- pr_dbg("TXL_TV config\n"); -- demod_set_demod_reg(TXLTV_ADC_REG3_VALUE, ADC_REG3); -- demod_set_demod_reg(TXLTV_ADC_REG1_VALUE, ADC_REG1); -- demod_set_demod_reg(TXLTV_ADC_REGB_VALUE, ADC_REGB); -- demod_set_demod_reg(TXLTV_ADC_REG2_VALUE, ADC_REG2); -- demod_set_demod_reg(TXLTV_ADC_REG3_VALUE, ADC_REG3); -- demod_set_demod_reg(TXLTV_ADC_REG4_VALUE, ADC_REG4); -- demod_set_demod_reg(TXLTV_ADC_REGC_VALUE, ADC_REGC); -- demod_set_demod_reg(TXLTV_ADC_REGD_VALUE, ADC_REGD); -- demod_set_demod_reg(TXLTV_ADC_RESET_VALUE, ADC_REG3); -- demod_set_demod_reg(TXLTV_ADC_REG3_VALUE, ADC_REG3); -- -- /* dadc */ -- demod_set_demod_reg(TXLTV_ADC_REG7_VALUE, ADC_REG7); -- demod_set_demod_reg(TXLTV_ADC_REG8_VALUE, ADC_REG8); -- demod_set_demod_reg(TXLTV_ADC_REG9_VALUE, ADC_REG9); -- demod_set_demod_reg(TXLTV_ADC_REGE_VALUE, ADC_REGE); -- } -- -- demod_set_demod_reg(DEMOD_REG1_VALUE, DEMOD_REG1); -- demod_set_demod_reg(DEMOD_REG2_VALUE, DEMOD_REG2); -- demod_set_demod_reg(DEMOD_REG3_VALUE, DEMOD_REG3); -- cfg0.b.mode = 7; -- cfg0.b.adc_format = 1; -- if (dvb_mode == Gxtv_Dvbc) { /* // 0 -DVBC, 1-DVBT, ISDBT, 2-ATSC */ -- cfg0.b.ts_sel = 2; -- } else if ((dvb_mode == Gxtv_Dvbt_Isdbt) || (dvb_mode == Gxtv_Dtmb)) { -- cfg0.b.ts_sel = 1; -- cfg0.b.adc_regout = 1; -- } else if (dvb_mode == Gxtv_Atsc) { -- cfg0.b.ts_sel = 4; -- } -- demod_set_demod_reg(cfg0.d32, DEMOD_REG1); -- cfg2.b.biasgen_en = 1; -- cfg2.b.en_adc = 1; -- demod_set_demod_reg(cfg2.d32, DEMOD_REG3); -- pr_dbg("0xc8020c00 is %x,dvb_mode is %d\n", -- demod_read_demod_reg(DEMOD_REG1), dvb_mode); --} -- --void dtmb_write_reg(int reg_addr, int reg_data) --{ -- if (!get_dtvpll_init_flag()) -- return; -- demod_set_demod_reg(reg_data, reg_addr); --/* apb_write_reg(reg_addr,reg_data); */ --} -- --int dtmb_read_reg(int reg_addr) --{ -- if (!get_dtvpll_init_flag()) -- return 0; -- return demod_read_demod_reg(reg_addr); /* apb_read_reg(reg_addr); */ --} -- --void atsc_write_reg(int reg_addr, int reg_data) --{ -- if (!get_dtvpll_init_flag()) -- return; -- apb_write_reg(ATSC_BASE, (reg_addr & 0xffff) << 8 | (reg_data & 0xff)); --} -- --unsigned long atsc_read_reg(int reg_addr) --{ -- unsigned long tmp; -- -- if (!get_dtvpll_init_flag()) -- return 0; -- apb_write_reg(ATSC_BASE + 4, (reg_addr & 0xffff) << 8); -- tmp = apb_read_reg(ATSC_BASE); -- -- return tmp & 0xff; --} -- --unsigned long atsc_read_iqr_reg(void) --{ -- unsigned long tmp; -- -- tmp = apb_read_reg(ATSC_BASE + 8); -- pr_dbg("[atsc irq] is %lx\n", tmp); -- return tmp & 0xffffffff; --} -- --int atsc_qam_set(fe_modulation_t mode) --{ -- int i, j; -- -- if (mode == VSB_8) { /* 5-8vsb, 2-64qam, 4-256qam */ -- for (i = 0; list_8vsb[i].adr != 0; i++) { -- if (list_8vsb[i].rw) -- atsc_read_reg(list_8vsb[i].adr); -- /* msleep(20); */ -- else -- atsc_write_reg(list_8vsb[i].adr, -- list_8vsb[i].dat); -- /* msleep(20); */ -- } -- j = 15589; -- pr_dbg("8-vsb mode\n"); -- } else if (mode == QAM_64) { -- for (i = 0; list_qam64[i].adr != 0; i++) { -- if (list_qam64[i].rw) { -- atsc_read_reg(list_qam64[i].adr); -- msleep(20); -- } else { -- atsc_write_reg(list_qam64[i].adr, -- list_qam64[i].dat); -- msleep(20); -- } -- } -- j = 16588; /* 33177; */ -- pr_dbg("64qam mode\n"); -- } else if (mode == QAM_256) { -- for (i = 0; list_qam256[i].adr != 0; i++) { -- if (list_qam256[i].rw) { -- atsc_read_reg(list_qam256[i].adr); -- msleep(20); -- } else { -- atsc_write_reg(list_qam256[i].adr, -- list_qam256[i].dat); -- msleep(20); -- } -- } -- j = 15649; /* 31298; */ -- pr_dbg("256qam mode\n"); -- } else { -- for (i = 0; list_qam256[i].adr != 0; i++) { -- if (list_qam256[i].rw) { -- atsc_read_reg(list_qam256[i].adr); -- msleep(20); -- } else { -- atsc_write_reg(list_qam256[i].adr, -- list_qam256[i].dat); -- msleep(20); -- } -- } -- j = 15649; /* 31298; */ -- pr_dbg("256qam mode\n"); -- } -- return j; --} -- --void atsc_initial(struct aml_demod_sta *demod_sta) --{ -- int fc, fs, cr, ck, j; -- fe_modulation_t mode; -- -- mode = demod_sta->ch_mode; -- -- j = atsc_qam_set(mode); /* set mode */ -- -- fs = demod_sta->adc_freq; /* KHZ 25200 */ -- fc = demod_sta->ch_if; /* KHZ 6350 */ -- -- cr = (fc * (1 << 17) / fs) * (1 << 6); -- ck = fs * j / 10 - (1 << 25); -- /* ck_rate = (f_samp / f_vsb /2 -1)*(1<<25); -- double f_vsb = 10.76238;// double f_64q = 5.056941; -- // double f_256q = 5.360537; */ -- -- atsc_write_reg(0x070e, cr & 0xff); -- atsc_write_reg(0x070d, (cr >> 8) & 0xff); -- atsc_write_reg(0x070c, (cr >> 16) & 0xff); -- -- if (demod_sta->ch_mode == VSB_8) { -- atsc_write_reg(0x0711, ck & 0xff); -- atsc_write_reg(0x0710, (ck >> 8) & 0xff); -- atsc_write_reg(0x070f, (ck >> 16) & 0xff); -- } -- pr_dbg("0x70e is %x, 0x70d is %x, 0x70c is %x\n", cr & 0xff, -- (cr >> 8) & 0xff, (cr >> 16) & 0xff); -- pr_dbg("fs is %d(SR),fc is %d(IF),cr is %x,ck is %x\n", fs, fc, cr, ck); --} -- --int atsc_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_atsc *demod_atsc) --{ -- int ret = 0; -- u8 demod_mode; -- u8 bw, sr, ifreq, agc_mode; -- u32 ch_freq; -- -- bw = demod_atsc->bw; -- sr = demod_atsc->sr; -- ifreq = demod_atsc->ifreq; -- agc_mode = demod_atsc->agc_mode; -- ch_freq = demod_atsc->ch_freq; -- demod_mode = demod_atsc->dat0; -- demod_sta->ch_mode = demod_atsc->mode; /* TODO */ -- demod_sta->agc_mode = agc_mode; -- demod_sta->ch_freq = ch_freq; -- demod_sta->dvb_mode = demod_mode; -- demod_sta->ch_bw = (8 - bw) * 1000; -- atsc_initial(demod_sta); -- pr_dbg("ATSC mode\n"); -- return ret; --} -- --#if 0 --static dtmb_cfg_t list_dtmb_v1[99] = { -- {0x00000000, 0x01, 0}, -- {0x00001000, 0x02, 0}, -- {0x00000000, 0x03, 0}, -- {0x00000000, 0x04, 0}, -- {0x00000000, 0x05, 0}, -- {0x00000000, 0x06, 0}, -- {0x007fffff, 0x07, 0}, -- {0x0000000f, 0x08, 0}, -- {0x00003000, 0x09, 0}, -- {0x00000001, 0x0a, 0}, -- {0x0c403006, 0x0b, 0}, -- {0x44444400, 0x0c, 0}, -- {0x1412c320, 0x0d, 0}, -- {0x00000152, 0x10, 0}, -- {0x47080137, 0x11, 0}, -- {0x02200a16, 0x12, 0}, -- {0x42190190, 0x13, 0}, -- {0x7f807f80, 0x14, 0}, -- {0x0000199a, 0x15, 0}, -- {0x000a1466, 0x18, 0}, -- {0x00274217, 0x1a, 0}, -- {0x00131036, 0x1b, 1}, -- {0x00000396, 0x1c, 0}, -- {0x0037f3cc, 0x1d, 0}, -- {0x00000029, 0x1e, 0}, -- {0x0004f031, 0x1f, 0}, -- {0x00f3cbd4, 0x20, 0}, -- {0x0000007e, 0x21, 0}, -- {0x23270b6a, 0x22, 0}, -- {0x5f700c1b, 0x23, 0}, -- {0x00133c2b, 0x24, 0}, -- {0x2d3e0f12, 0x25, 0}, -- {0x06363038, 0x26, 0}, -- {0x060e0a3e, 0x27, 0}, -- {0x0015161f, 0x28, 0}, -- {0x0809031b, 0x29, 0}, -- {0x181c0307, 0x2a, 0}, -- {0x051f1a1b, 0x2b, 0}, -- {0x00451dce, 0x2c, 0}, -- {0x242fde12, 0x2d, 0}, -- {0x0034e8fa, 0x2e, 0}, -- {0x00000007, 0x30, 0}, -- {0x16000d0c, 0x31, 0}, -- {0x0000011f, 0x32, 0}, -- {0x01000200, 0x33, 0}, -- {0x10bbf376, 0x34, 0}, -- {0x00000044, 0x35, 0}, -- {0x00000000, 0x36, 0}, -- {0x00000000, 0x37, 0}, -- {0x00000000, 0x38, 0}, -- {0x00000000, 0x39, 0}, -- {0x00000031, 0x3a, 0}, -- {0x4d6b0a58, 0x3b, 0}, -- {0x00000c04, 0x3c, 0}, -- {0x0d3b0a50, 0x3d, 0}, -- {0x03140480, 0x3e, 0}, -- {0x05e60452, 0x3f, 0}, -- {0x05780400, 0x40, 0}, -- {0x0063c025, 0x41, 0}, -- {0x05050202, 0x42, 0}, -- {0x5e4a0a14, 0x43, 0}, -- {0x00003b42, 0x44, 0}, -- {0xa53080ff, 0x45, 0}, -- {0x00000000, 0x46, 0}, -- {0x00133202, 0x47, 0}, -- {0x01f00000, 0x48, 0}, -- {0x00000000, 0x49, 0}, -- {0x00000000, 0x4a, 0}, -- {0x00000000, 0x4b, 0}, -- {0x00000000, 0x4c, 0}, -- {0x20405dc8, 0x4d, 0}, -- {0x00000000, 0x4e, 0}, -- {0x1f0205df, 0x4f, 0}, -- {0x00001120, 0x50, 0}, -- {0x4f190803, 0x51, 0}, -- {0x00000000, 0x52, 0}, -- {0x00000040, 0x53, 0}, -- {0x00100050, 0x54, 0}, -- {0x00cd1000, 0x55, 0}, -- {0x00010fab, 0x56, 0}, -- {0x03f0fc3f, 0x58, 0}, -- {0x02005014, 0x59, 0}, -- {0x01405014, 0x5a, 0}, -- {0x00014284, 0x5b, 0}, -- {0x00000320, 0x5c, 0}, -- {0x14130e05, 0x5d, 0}, -- {0x4321c963, 0x5f, 0}, -- {0x624668f8, 0x60, 0}, -- {0xccc08888, 0x61, 0}, -- {0x13212111, 0x62, 0}, -- {0x21100000, 0x63, 0}, -- {0x624668f8, 0x64, 0}, -- {0xccc08888, 0x65, 0}, -- {0x13212111, 0x66, 0}, -- {0x21100000, 0x67, 0}, -- {0x624668f8, 0x68, 0}, -- {0xccc08888, 0x69, 0}, -- {0x0, 0x0, 0} --}; --#endif -- --void dtmb_all_reset(void) --{ -- int temp_data = 0; -- if (is_meson_txl_cpu()) { -- dtmb_write_reg(DTMB_FRONT_AFIFO_ADC, 0x1f); -- dtmb_write_reg(DTMB_CHE_TPS_CONFIG, 0xc00000); -- dtmb_write_reg(DTMB_FRONT_AGC_CONFIG1, 0x101a7); -- } else { -- dtmb_write_reg(DTMB_FRONT_AGC_CONFIG1, 0x10127); -- dtmb_write_reg(DTMB_CHE_IBDFE_CONFIG6, 0x943228cc); -- dtmb_write_reg(DTMB_CHE_IBDFE_CONFIG7, 0xc09aa8cd); -- dtmb_write_reg(DTMB_CHE_FD_TD_COEFF, 0x0); -- dtmb_write_reg(DTMB_CHE_EQ_CONFIG, 0x9dc59); -- /*0x2 is auto,0x406 is invert spectrum*/ -- if (dtmb_spectrum == 0) -- dtmb_write_reg(DTMB_TOP_CTRL_TPS, 0x406); -- else if (dtmb_spectrum == 1) -- dtmb_write_reg(DTMB_TOP_CTRL_TPS, 0x402); -- else -- dtmb_write_reg(DTMB_TOP_CTRL_TPS, 0x2); -- -- pr_dbg("dtmb_spectrum is %d\n", dtmb_spectrum); -- dtmb_write_reg(DTMB_TOP_CTRL_FEC, 0x41444400); -- dtmb_write_reg(DTMB_TOP_CTRL_INTLV_TIME, 0x180300); -- dtmb_write_reg(DTMB_FRONT_DDC_BYPASS, 0x662ca0); -- dtmb_write_reg(DTMB_FRONT_AFIFO_ADC, 0x29); -- dtmb_write_reg(DTMB_FRONT_DC_HOLD, 0xa1066); -- /*cci para*/ -- dtmb_write_reg(DTMB_CHE_M_CCI_THR_CONFIG3, 0x80201f6); -- dtmb_write_reg(DTMB_CHE_M_CCI_THR_CONFIG2, 0x3f20080); -- dtmb_write_reg(DTMB_CHE_TPS_CONFIG, 0xc00000); -- dtmb_write_reg(DTMB_TOP_CTRL_AGC, 0x3); -- dtmb_write_reg(DTMB_TOP_CTRL_TS_SFO_CFO, 0x20403006); -- dtmb_write_reg(DTMB_FRONT_AGC_CONFIG2, 0x7200a16); -- dtmb_write_reg(DTMB_FRONT_DEBUG_CFG, 0x1e00000); -- dtmb_write_reg(DTMB_TOP_CTRL_ENABLE, 0x7fffff); -- /*close ts3 timing loop*/ -- dtmb_write_reg(DTMB_TOP_CTRL_DAGC_CCI, 0x305); -- /*dektec card issue,close f case snr drop*/ -- dtmb_write_reg(DTMB_CHE_MC_SC_TIMING_POWTHR, 0xc06100a); -- if (demod_enable_performance) { -- dtmb_write_reg(DTMB_CHE_IBDFE_CONFIG1, 0x4040002); -- temp_data = dtmb_read_reg(DTMB_CHE_FD_TD_COEFF); -- temp_data = (temp_data & ~0x3fff)|(0x241f & 0x3fff); -- temp_data = temp_data | (1<<21); -- /*Set freeze_mode and reset coeff*/ -- dtmb_write_reg(DTMB_CHE_FD_TD_COEFF, temp_data); -- temp_data = temp_data & ~(1<<21); -- /*Set freeze_mode and reset coeff*/ -- dtmb_write_reg(DTMB_CHE_FD_TD_COEFF, temp_data); -- } -- } --} -- --void dtmb_initial(struct aml_demod_sta *demod_sta) --{ --/* dtmb_write_reg(0x049, memstart); //only for init */ -- dtmb_spectrum = 1; -- dtmb_spectrum = demod_sta->spectrum; -- dtmb_register_reset(); -- dtmb_all_reset(); --#if 0 -- int i; -- for (i = 0; list_dtmb_v1[i].adr != 0; i++) { -- if (list_dtmb_v1[i].rw) -- apb_read_reg(DTMB_BASE + ((list_dtmb_v1[i].adr) << 2)); -- /* msleep(20); */ -- else -- apb_write_reg(DTMB_BASE + ((list_dtmb_v1[i].adr) << 2), -- list_dtmb_v1[i].dat); -- /* msleep(20); */ -- } --#endif --} -- --int check_dtmb_fec_lock(void) --{ -- int fec_lock, snr, status; -- fec_lock = (dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR) >> 14) & 0x1; -- snr = dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR) & 0x3fff; -- if (fec_lock && (snr > 4)) -- status = 1; -- else -- status = 0; -- return status; --} -- --int check_dtmb_mobile_det(void) --{ -- int mobile_det = 0; -- mobile_det = (dtmb_read_reg(DTMB_TOP_CTRL_SYS_OFDM_CNT) >> 8) & 0x7ffff; -- return mobile_det; -- --} -- -- --int dtmb_information(void) --{ -- int tps, snr, fec_lock, fec_bch_add, fec_ldpc_unc_acc, fec_ldpc_it_avg, -- tmp, che_snr; -- struct aml_fe_dev *dev; -- -- dev = NULL; -- tps = dtmb_read_reg(DTMB_TOP_CTRL_CHE_WORKCNT); -- tmp = dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR); -- che_snr = tmp & 0xfff; -- snr = che_snr; -- /* if (che_snr >= 8192) */ -- /* che_snr = che_snr - 16384;*/ -- /* snr = che_snr / 32;*/ -- /* snr = 10*log10(snr)-6; */ -- fec_lock = (dtmb_read_reg(DTMB_TOP_FEC_LOCK_SNR) >> 14) & 0x1; -- fec_bch_add = dtmb_read_reg(DTMB_TOP_FEC_BCH_ACC); -- fec_ldpc_unc_acc = dtmb_read_reg(DTMB_TOP_FEC_LDPC_UNC_ACC); -- fec_ldpc_it_avg = dtmb_read_reg(DTMB_TOP_FEC_LDPC_IT_AVG); -- pr_dbg("¡¾FSM ¡¿: %x %x %x %x\n", -- dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0), -- dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE1), -- dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE2), -- dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE3)); -- pr_dbg -- ("¡¾AGC ¡¿: agc_power %d,agc_if_gain %d,agc_rf_gain %d,", -- (-(((dtmb_read_reg(DTMB_TOP_FRONT_AGC) >> 22) & 0x3ff) / 16)), -- ((dtmb_read_reg(DTMB_TOP_FRONT_AGC)) & 0x3ff), -- ((dtmb_read_reg(DTMB_TOP_FRONT_AGC) >> 11) & 0x7ff)); -- pr_dbg -- ("dagc_power %3d,dagc_gain %3d mobi_det_power %d\n", -- ((dtmb_read_reg(DTMB_TOP_FRONT_DAGC) >> 0) & 0xff), -- ((dtmb_read_reg(DTMB_TOP_FRONT_DAGC) >> 8) & 0xfff), -- (dtmb_read_reg(DTMB_TOP_CTRL_SYS_OFDM_CNT) >> 8) & 0x7ffff); -- pr_dbg -- ("¡¾TPS ¡¿ SC or MC %2d,f_r %2d qam_nr %2d ", -- (dtmb_read_reg(DTMB_TOP_CHE_OBS_STATE1) >> 1) & 0x1, -- (tps >> 22) & 0x1, (tps >> 21) & 0x1); -- pr_dbg -- ("intlv %2d,cr %2d constl %2d\n", -- (tps >> 20) & 0x1, -- (tps >> 18) & 0x3, (tps >> 16) & 0x3); -- -- pr_dbg -- ("[dtmb] snr is %d,fec_lock is %d,fec_bch_add is %d,", -- snr, fec_lock, fec_bch_add); -- pr_dbg -- ("fec_ldpc_unc_acc is %d ,fec_ldpc_it_avg is %d\n", -- fec_ldpc_unc_acc, -- fec_ldpc_it_avg / 256); -- pr_dbg -- ("------------------------------------------------------------\n"); -- -- tuner_get_ch_power(dev); -- -- return 0; --} -- --int dtmb_check_cci(void) --{ -- int cci_det = 0; -- cci_det = -- ((dtmb_read_reg(DTMB_TOP_SYNC_CCI_NF2_POSITION) >> 22) -- & 0x3); -- if (cci_det > 0) { -- pr_dbg("find cci\n"); -- dtmb_write_reg(DTMB_CHE_CCIDET_CONFIG, 0x20210290); -- dtmb_write_reg(DTMB_CHE_M_CCI_THR_CONFIG3, 0x20081f6); -- dtmb_write_reg(DTMB_CHE_M_CCI_THR_CONFIG2, 0x3f08020); -- } -- return cci_det; --} -- --int dtmb_check_fsm(void) --{ -- int tmp, fsm_status, i, has_singal; -- tmp = dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0); -- fsm_status = tmp&0xffffffff; -- has_singal = 0; -- pr_dbg("[rsj1] fsm_status is %x\n", fsm_status); -- for (i = 0 ; i < 8 ; i++) { -- if (((fsm_status >> (i*4)) & 0xf) > 3) { -- /*has signal*/ -- /* pr_dbg("has signal\n");*/ -- has_singal = 1; -- } -- } -- return has_singal; -- --} -- --int patch_ts3(int delay1_us, int delay2_us) --{ -- if (((dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0)&0xf) == 0x7)&1) { -- dtmb_write_reg(DTMB_TOP_CTRL_FSM, 0x300f); -- dtmb_write_reg(DTMB_TOP_CTRL_FSM, 0x310f); -- msleep(delay1_us); -- dtmb_write_reg(DTMB_TOP_CTRL_ENABLE, 0xffdfff); -- dtmb_write_reg(DTMB_TOP_CTRL_ENABLE, 0xffffff); -- dtmb_write_reg(DTMB_TOP_CTRL_FSM, 0x3110); -- dtmb_write_reg(DTMB_TOP_CTRL_FSM, 0x3010); -- dtmb_write_reg(DTMB_TOP_CTRL_FSM, 0x3000); -- return 1; -- } else -- return 0; --} -- -- --int read_cfo_all(void) --{ -- int icfo_all, fcfo_all; -- icfo_all = dtmb_read_reg(DTMB_TOP_CTRL_ICFO_ALL) & 0xfffff; -- fcfo_all = dtmb_read_reg(DTMB_TOP_CTRL_FCFO_ALL) & 0x3fff; -- if (icfo_all > (1 << 19)) -- icfo_all = icfo_all - (1 << 20); -- if (fcfo_all > (1 << 13)) -- fcfo_all = fcfo_all - (1 << 14); -- -- return (int)(icfo_all*4+fcfo_all); -- --} -- -- --int dtmb_v3_soft_sync(int cfo_init) --{ -- --/* int cfo_all;*/ --/* int cfo_setting;*/ -- -- if (cfo_init == 0) { -- cfo_init = patch_ts3(11, 0); -- #if 0 -- if (cfo_init == 1) { -- cfo_all = read_cfo_all(); -- cfo_setting = dtmb_read_reg(DTMB_FRONT_DDC_BYPASS); -- dtmb_write_reg(DTMB_FRONT_DDC_BYPASS, -- cfo_setting+cfo_all); -- dtmb_write_reg(DTMB_TOP_CTRL_LOOP, 0x3); -- dtmb_reset(); -- } -- #endif -- } -- return cfo_init; -- --} -- --int dtmb_check_status_gxtv(struct dvb_frontend *fe) --{ -- int local_state; -- int time_cnt;/* cci_det, src_config;*/ -- int cfo_init, count; -- -- dtmb_information(); -- time_cnt = 0; -- local_state = 0; -- cfo_init = 0; -- if (check_dtmb_fec_lock() != 1) { -- dtmb_register_reset(); -- dtmb_all_reset(); -- count = 15; -- while ((count) && -- ((dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0)&0xf) < 0x6)) { -- msleep(20); -- count--; -- } -- -- count = demod_sync_count; -- while ((count) && (cfo_init == 0)) { -- -- cfo_init = dtmb_v3_soft_sync(cfo_init); -- -- msleep(demod_sync_delay_time); -- count--; -- } -- if ((cfo_init == 0) && -- ((dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0)&0xf) <= 7)) { -- pr_dbg("over 400ms,status is %x, need reset\n", -- (dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0)&0xf)); -- return 0; -- } -- while ((time_cnt < 10) && (check_dtmb_fec_lock() != 1)) { -- msleep(demod_timeout); -- time_cnt++; -- local_state = AMLOGIC_DTMB_STEP3; -- dtmb_information(); -- dtmb_check_cci(); -- if (time_cnt > 8) -- pr_dbg -- ("* local_state = %d\n", local_state); -- } -- if (time_cnt >= 10 && (check_dtmb_fec_lock() != 1)) { -- local_state = AMLOGIC_DTMB_STEP4; -- time_cnt = 0; -- pr_dbg -- ("*all reset,timeout is %d\n", demod_timeout); -- } -- } else { -- dtmb_check_cci(); -- #if 0 -- cci_det = dtmb_check_cci(); -- if ((check_dtmb_mobile_det() <= demod_mobile_power) -- && (cci_det == 0)) { -- /* open */ -- src_config = (dtmb_read_reg(DTMB_FRONT_SRC_CONFIG1)); -- dtmb_write_reg(DTMB_FRONT_SRC_CONFIG1, -- src_config & (~(0x1 << 28))); -- } else { -- /* close */ -- src_config = (dtmb_read_reg(DTMB_FRONT_SRC_CONFIG1)); -- dtmb_write_reg(DTMB_FRONT_SRC_CONFIG1, -- src_config | (0x1 << 28)); -- } -- #endif -- } -- if (check_dtmb_fec_lock() == 1) -- dtmb_write_reg(DTMB_TOP_CTRL_LOOP, 0xf); -- return 0; --} -- -- --int dtmb_check_status_txl(struct dvb_frontend *fe) --{ -- dtmb_information(); -- return 0; --} -- -- --void dtmb_reset(void) --{ -- union DTMB_TOP_CTRL_SW_RST_BITS sw_rst; -- -- sw_rst.b.ctrl_sw_rst = 1; -- sw_rst.b.ctrl_sw_rst_noreg = 1; -- dtmb_write_reg(DTMB_TOP_CTRL_SW_RST, sw_rst.d32); -- sw_rst.b.ctrl_sw_rst = 0; -- sw_rst.b.ctrl_sw_rst_noreg = 0; -- dtmb_write_reg(DTMB_TOP_CTRL_SW_RST, sw_rst.d32); --} -- --void dtmb_register_reset(void) --{ -- union DTMB_TOP_CTRL_SW_RST_BITS sw_rst; -- -- sw_rst.b.ctrl_sw_rst = 1; -- dtmb_write_reg(DTMB_TOP_CTRL_SW_RST, sw_rst.d32); -- sw_rst.b.ctrl_sw_rst = 0; -- dtmb_write_reg(DTMB_TOP_CTRL_SW_RST, sw_rst.d32); --} -- --int dtmb_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dtmb *demod_dtmb) --{ -- int ret = 0; -- u8 demod_mode; -- u8 bw, sr, ifreq, agc_mode; -- u32 ch_freq; -- -- bw = demod_dtmb->bw; -- sr = demod_dtmb->sr; -- ifreq = demod_dtmb->ifreq; -- agc_mode = demod_dtmb->agc_mode; -- ch_freq = demod_dtmb->ch_freq; -- demod_mode = demod_dtmb->dat0; -- demod_sta->ch_mode = demod_dtmb->mode; /* TODO */ -- demod_sta->agc_mode = agc_mode; -- demod_sta->ch_freq = ch_freq; -- demod_sta->dvb_mode = demod_mode; -- demod_sta->ch_bw = (8 - bw) * 1000; -- dtmb_initial(demod_sta); -- pr_dbg("DTMB mode\n"); -- return ret; --} -- --int dvbt_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dvbt *demod_dvbt) --{ -- int ret = 0; -- u8_t demod_mode = 1; -- u8_t bw, sr, ifreq, agc_mode; -- u32_t ch_freq; -- -- bw = demod_dvbt->bw; -- sr = demod_dvbt->sr; -- ifreq = demod_dvbt->ifreq; -- agc_mode = demod_dvbt->agc_mode; -- ch_freq = demod_dvbt->ch_freq; -- demod_mode = demod_dvbt->dat0; -- if (ch_freq < 1000 || ch_freq > 900000000) { -- /* pr_dbg("Error: Invalid Channel Freq option %d\n", -- ch_freq); */ -- ch_freq = 474000; -- ret = -1; -- } -- -- if (demod_mode < 0 || demod_mode > 4) { -- /* pr_dbg("Error: Invalid demod mode option %d\n", -- demod_mode); */ -- demod_mode = 1; -- ret = -1; -- } -- -- /* demod_sta->dvb_mode = 1; */ -- demod_sta->ch_mode = 0; /* TODO */ -- demod_sta->agc_mode = agc_mode; -- demod_sta->ch_freq = ch_freq; -- demod_sta->dvb_mode = demod_mode; -- /* if (demod_i2c->tuner == 1) -- * demod_sta->ch_if = 36130; -- * else if (demod_i2c->tuner == 2) -- * demod_sta->ch_if = 4570; -- * else if (demod_i2c->tuner == 3) -- * demod_sta->ch_if = 4000;// It is nouse.(alan) -- * else if (demod_i2c->tuner == 7) -- * demod_sta->ch_if = 5000;//silab 5000kHz IF*/ -- -- demod_sta->ch_bw = (8 - bw) * 1000; -- demod_sta->symb_rate = 0; /* TODO */ -- --/* bw=0; */ -- demod_mode = 1; -- /* for si2176 IF:5M sr 28.57 */ -- sr = 4; -- ifreq = 4; -- if (bw == BANDWIDTH_AUTO) -- demod_mode = 2; -- ofdm_initial(bw, -- /* 00:8M 01:7M 10:6M 11:5M */ -- sr, -- /* 00:45M 01:20.8333M 10:20.7M 11:28.57 100:24m */ -- ifreq, -- /* 000:36.13M 001:-5.5M 010:4.57M 011:4M 100:5M */ -- demod_mode - 1, -- /* 00:DVBT,01:ISDBT */ -- 1 -- /* 0: Unsigned, 1:TC */ -- ); -- pr_dbg("DVBT/ISDBT mode\n"); -- -- return ret; --} -- --int demod_set_sys(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_sys *demod_sys) --{ --/* int adc_clk; */ --/* demod_sta->tmp=Adc_mode; */ -- unsigned char dvb_mode; -- int clk_adc, clk_dem; -- int gpioDV_2; -- int gpiW_2; -- -- dvb_mode = demod_sta->dvb_mode; -- clk_adc = demod_sys->adc_clk; -- clk_dem = demod_sys->demod_clk; -- pr_dbg -- ("demod_set_sys,clk_adc is %d,clk_demod is %d\n", -- clk_adc, clk_dem); -- mutex_init(&mp); -- clocks_set_sys_defaults(dvb_mode); -- /* open dtv adc pinmux */ -- if (is_meson_txl_cpu()) { -- gpioDV_2 = demod_read_demod_reg(0xc8834400 + (0x2e << 2)); -- pr_dbg("[R840]set adc pinmux,gpioDV_2 %x\n", gpioDV_2); -- gpioDV_2 = gpioDV_2 | (0x1 << 22); -- gpioDV_2 = gpioDV_2 & ~(0x3 << 19); -- gpioDV_2 = gpioDV_2 & ~(0x1 << 23); -- gpioDV_2 = gpioDV_2 & ~(0x1 << 31); -- demod_set_demod_reg(gpioDV_2, 0xc8834400 + (0x2e << 2)); -- pr_dbg("[R840]set adc pinmux,gpioDV_2 %x\n", gpioDV_2); -- } else { -- gpiW_2 = demod_read_demod_reg(0xc88344c4); -- gpiW_2 = gpiW_2 | (0x1 << 25); -- gpiW_2 = gpiW_2 & ~(0xd << 24); -- demod_set_demod_reg(gpiW_2, 0xc88344c4); -- pr_dbg("[R840]set adc pinmux,gpiW_2 %x\n", gpiW_2); -- } -- /* set adc clk */ -- demod_set_adc_core_clk(clk_adc, clk_dem, dvb_mode); -- /* init for dtmb */ -- if (dvb_mode == Gxtv_Dtmb) { -- /* open arbit */ -- demod_set_demod_reg(0x8, DEMOD_REG4); -- } -- demod_sta->adc_freq = clk_adc; -- demod_sta->clk_freq = clk_dem; -- return 0; --} -- --void demod_set_reg(struct aml_demod_reg *demod_reg) --{ -- switch (demod_reg->mode) { -- case 0: -- demod_reg->addr = demod_reg->addr + QAM_BASE; -- break; -- case 1: -- case 2: -- demod_reg->addr = DTMB_TOP_ADDR(demod_reg->addr); -- break; -- case 3: -- /* demod_reg->addr=ATSC_BASE; */ -- break; -- case 4: -- demod_reg->addr = demod_reg->addr * 4 + DEMOD_CFG_BASE; -- break; -- case 5: -- demod_reg->addr = demod_reg->addr + DEMOD_BASE; -- break; -- case 6: -- /* demod_reg->addr=demod_reg->addr*4+DEMOD_CFG_BASE; */ -- break; -- case 11: -- demod_reg->addr = demod_reg->addr; -- break; -- case 10: -- /* demod_reg->addr=(u32_t)phys_to_virt(demod_reg->addr); */ -- break; -- } -- -- if (demod_reg->mode == 3) -- atsc_write_reg(demod_reg->addr, demod_reg->val); -- else if (demod_reg->mode == 11) -- demod_set_cbus_reg(demod_reg->val, demod_reg->addr); -- else if (demod_reg->mode == 10) -- apb_write_reg_collect(demod_reg->addr, demod_reg->val); -- /* demod_reg->val_high = apb_read_reg_high(demod_reg->addr); */ -- else -- demod_set_demod_reg(demod_reg->val, demod_reg->addr); --} -- --void demod_get_reg(struct aml_demod_reg *demod_reg) --{ -- if (demod_reg->mode == 0) { -- demod_reg->addr = demod_reg->addr + QAM_BASE; -- } else if ((demod_reg->mode == 1) || (demod_reg->mode == 2)) { -- demod_reg->addr = DTMB_TOP_ADDR(demod_reg->addr); -- } else if (demod_reg->mode == 3) { -- /* demod_reg->addr=demod_reg->addr+ATSC_BASE; */ -- } else if (demod_reg->mode == 4) { -- demod_reg->addr = demod_reg->addr * 4 + DEMOD_CFG_BASE; -- } else if (demod_reg->mode == 5) { -- demod_reg->addr = demod_reg->addr + DEMOD_BASE; -- } else if (demod_reg->mode == 6) { -- /* demod_reg->addr=demod_reg->addr*4+DEMOD_CFG_BASE; */ -- } else if (demod_reg->mode == 11) { -- demod_reg->addr = demod_reg->addr; -- } else if (demod_reg->mode == 10) { -- /* printk("demod_reg->addr is %x\n",demod_reg->addr); */ -- /* test=(unsigned long)phys_to_virt(test); */ --/* demod_reg->addr=(unsigned long)phys_to_virt(demod_reg->addr); */ --/* printk("demod_reg->addr is %lx %x\n",test,demod_reg->addr); */ -- } -- -- if (demod_reg->mode == 3) { -- demod_reg->val = atsc_read_reg(demod_reg->addr); -- /* apb_write_reg(ATSC_BASE+4, (demod_reg->addr&0xffff)<<8); */ -- /* demod_reg->val = apb_read_reg(ATSC_BASE)&0xff; */ -- } else if (demod_reg->mode == 6) { -- demod_reg->val = atsc_read_iqr_reg(); -- /* apb_write_reg(ATSC_BASE+4, (demod_reg->addr&0xffff)<<8); */ -- /* demod_reg->val = apb_read_reg(ATSC_BASE)&0xff; */ -- } else if (demod_reg->mode == 11) { -- demod_reg->val = demod_read_cbus_reg(demod_reg->addr); -- } else if (demod_reg->mode == 10) { -- demod_reg->val = apb_read_reg_collect(demod_reg->addr); -- /* demod_reg->val_high = apb_read_reg_high(demod_reg->addr);*/ -- } else { -- demod_reg->val = demod_read_demod_reg(demod_reg->addr); -- } --} -- --void apb_write_reg_collect(unsigned int addr, unsigned int data) --{ -- writel(data, ((void __iomem *)(phys_to_virt(addr)))); --/* *(volatile unsigned int*)addr = data; */ --} -- --unsigned long apb_read_reg_collect(unsigned long addr) --{ -- unsigned long tmp; --/* void __iomem *vaddr; -- vaddr = ioremap(((unsigned long)phys_to_virt(addr)), 0x4); -- tmp = readl(vaddr); -- iounmap(vaddr);*/ -- tmp = readl((void __iomem *)(phys_to_virt(addr))); --/*tmp = *(volatile unsigned long *)((unsigned long)phys_to_virt(addr));*/ --/* printk("[all][read]%lx,data is %lx\n",addr,tmp); */ -- return tmp & 0xffffffff; --} -- -- -- --void apb_write_reg(unsigned int addr, unsigned int data) --{ -- demod_set_demod_reg(data, addr); --} -- --unsigned long apb_read_reg_high(unsigned long addr) --{ -- unsigned long tmp; -- tmp = 0; -- return (tmp >> 32) & 0xffffffff; --} -- --unsigned long apb_read_reg(unsigned long addr) --{ -- return demod_read_demod_reg(addr); --} -- --void apb_write_regb(unsigned long addr, int index, unsigned long data) --{ -- /*to achieve write func*/ --} -- --void enable_qam_int(int idx) --{ -- unsigned long mask; -- -- mask = apb_read_reg(QAM_BASE + 0xd0); -- mask |= (1 << idx); -- apb_write_reg(QAM_BASE + 0xd0, mask); --} -- --void disable_qam_int(int idx) --{ -- unsigned long mask; -- -- mask = apb_read_reg(QAM_BASE + 0xd0); -- mask &= ~(1 << idx); -- apb_write_reg(QAM_BASE + 0xd0, mask); --} -- --char *qam_int_name[] = { " ADC", -- " Symbol", -- " RS", -- " In_Sync0", -- " In_Sync1", -- " In_Sync2", -- " In_Sync3", -- " In_Sync4", -- "Out_Sync0", -- "Out_Sync1", -- "Out_Sync2", -- "Out_Sync3", -- "Out_Sync4", -- "In_SyncCo", -- "OutSyncCo", -- " In_Dagc", -- " Out_Dagc", -- " Eq_Mode", -- "RS_Uncorr" --}; -- --#define OFDM_INT_STS 0 --#define OFDM_INT_EN 0 -- --void enable_ofdm_int(int ofdm_irq) --{ -- --} -- --void disable_ofdm_int(int ofdm_irq) --{ -- --} -- --char *ofdm_int_name[] = { "PFS_FCFO", -- "PFS_ICFO", -- " CS_FCFO", -- " PFS_SFO", -- " PFS_TPS", -- " SP", -- " CCI", -- " Symbol", -- " In_Sync", -- "Out_Sync", -- "FSM Stat" --}; -- --unsigned long read_ofdm_int(void) --{ -- -- return 0; --} -- --#define PHS_LOOP_OPEN -- --void qam_read_all_regs(void) --{ -- --} -- --void ini_icfo_pn_index(int mode) --{ /* 00:DVBT,01:ISDBT */ -- if (mode == 0) { -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000031); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x00030000); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000032); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x00057036); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000033); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x0009c08d); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000034); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x000c90c0); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000035); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x001170ff); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000036); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x0014d11a); -- } else if (mode == 1) { -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000031); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x00085046); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000032); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x0019a0e9); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000033); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x0024b1dc); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000034); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x003b3313); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000035); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x0048d409); -- apb_write_reg(DVBT_BASE + 0x3f8, 0x00000036); -- apb_write_reg(DVBT_BASE + 0x3fc, 0x00527509); -- } --} -- --static int coef[] = { -- 0xf900, 0xfe00, 0x0000, 0x0000, 0x0100, 0x0100, 0x0000, 0x0000, -- 0xfd00, 0xf700, 0x0000, 0x0000, 0x4c00, 0x0000, 0x0000, 0x0000, -- 0x2200, 0x0c00, 0x0000, 0x0000, 0xf700, 0xf700, 0x0000, 0x0000, -- 0x0300, 0x0900, 0x0000, 0x0000, 0x0600, 0x0600, 0x0000, 0x0000, -- 0xfc00, 0xf300, 0x0000, 0x0000, 0x2e00, 0x0000, 0x0000, 0x0000, -- 0x3900, 0x1300, 0x0000, 0x0000, 0xfa00, 0xfa00, 0x0000, 0x0000, -- 0x0100, 0x0200, 0x0000, 0x0000, 0xf600, 0x0000, 0x0000, 0x0000, -- 0x0700, 0x0700, 0x0000, 0x0000, 0xfe00, 0xfb00, 0x0000, 0x0000, -- 0x0900, 0x0000, 0x0000, 0x0000, 0x3200, 0x1100, 0x0000, 0x0000, -- 0x0400, 0x0400, 0x0000, 0x0000, 0xfe00, 0xfb00, 0x0000, 0x0000, -- 0x0e00, 0x0000, 0x0000, 0x0000, 0xfb00, 0xfb00, 0x0000, 0x0000, -- 0x0100, 0x0200, 0x0000, 0x0000, 0xf400, 0x0000, 0x0000, 0x0000, -- 0x3900, 0x1300, 0x0000, 0x0000, 0x1700, 0x1700, 0x0000, 0x0000, -- 0xfc00, 0xf300, 0x0000, 0x0000, 0x0c00, 0x0000, 0x0000, 0x0000, -- 0x0300, 0x0900, 0x0000, 0x0000, 0xee00, 0x0000, 0x0000, 0x0000, -- 0x2200, 0x0c00, 0x0000, 0x0000, 0x2600, 0x2600, 0x0000, 0x0000, -- 0xfd00, 0xf700, 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, -- 0xf900, 0xfe00, 0x0000, 0x0000, 0x0400, 0x0b00, 0x0000, 0x0000, -- 0xf900, 0x0000, 0x0000, 0x0000, 0x0700, 0x0200, 0x0000, 0x0000, -- 0x2100, 0x2100, 0x0000, 0x0000, 0x0200, 0x0700, 0x0000, 0x0000, -- 0xf900, 0x0000, 0x0000, 0x0000, 0x0b00, 0x0400, 0x0000, 0x0000, -- 0xfe00, 0xf900, 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, -- 0xf700, 0xfd00, 0x0000, 0x0000, 0x2600, 0x2600, 0x0000, 0x0000, -- 0x0c00, 0x2200, 0x0000, 0x0000, 0xee00, 0x0000, 0x0000, 0x0000, -- 0x0900, 0x0300, 0x0000, 0x0000, 0x0c00, 0x0000, 0x0000, 0x0000, -- 0xf300, 0xfc00, 0x0000, 0x0000, 0x1700, 0x1700, 0x0000, 0x0000, -- 0x1300, 0x3900, 0x0000, 0x0000, 0xf400, 0x0000, 0x0000, 0x0000, -- 0x0200, 0x0100, 0x0000, 0x0000, 0xfb00, 0xfb00, 0x0000, 0x0000, -- 0x0e00, 0x0000, 0x0000, 0x0000, 0xfb00, 0xfe00, 0x0000, 0x0000, -- 0x0400, 0x0400, 0x0000, 0x0000, 0x1100, 0x3200, 0x0000, 0x0000, -- 0x0900, 0x0000, 0x0000, 0x0000, 0xfb00, 0xfe00, 0x0000, 0x0000, -- 0x0700, 0x0700, 0x0000, 0x0000, 0xf600, 0x0000, 0x0000, 0x0000, -- 0x0200, 0x0100, 0x0000, 0x0000, 0xfa00, 0xfa00, 0x0000, 0x0000, -- 0x1300, 0x3900, 0x0000, 0x0000, 0x2e00, 0x0000, 0x0000, 0x0000, -- 0xf300, 0xfc00, 0x0000, 0x0000, 0x0600, 0x0600, 0x0000, 0x0000, -- 0x0900, 0x0300, 0x0000, 0x0000, 0xf700, 0xf700, 0x0000, 0x0000, -- 0x0c00, 0x2200, 0x0000, 0x0000, 0x4c00, 0x0000, 0x0000, 0x0000, -- 0xf700, 0xfd00, 0x0000, 0x0000, 0x0100, 0x0100, 0x0000, 0x0000, -- 0xfe00, 0xf900, 0x0000, 0x0000, 0x0b00, 0x0400, 0x0000, 0x0000, -- 0xfc00, 0xfc00, 0x0000, 0x0000, 0x0200, 0x0700, 0x0000, 0x0000, -- 0x4200, 0x0000, 0x0000, 0x0000, 0x0700, 0x0200, 0x0000, 0x0000, -- 0xfc00, 0xfc00, 0x0000, 0x0000, 0x0400, 0x0b00, 0x0000, 0x0000 --}; -- --void tfd_filter_coff_ini(void) --{ -- int i = 0; -- -- for (i = 0; i < 336; i++) { -- apb_write_reg(DVBT_BASE + 0x99 * 4, (i << 16) | coef[i]); -- apb_write_reg(DVBT_BASE + 0x03 * 4, (1 << 12)); -- } --} -- --void ofdm_initial(int bandwidth, -- /* 00:8M 01:7M 10:6M 11:5M */ -- int samplerate, -- /* 00:45M 01:20.8333M 10:20.7M 11:28.57 100: 24.00 */ -- int IF, -- /* 000:36.13M 001:-5.5M 010:4.57M 011:4M 100:5M */ -- int mode, -- /* 00:DVBT,01:ISDBT */ -- int tc_mode -- /* 0: Unsigned, 1:TC */ -- ) --{ --#if 0 -- int tmp; -- int ch_if; -- int adc_freq; -- pr_dbg -- ("[ofdm_initial]bandwidth is %d,samplerate is %d", -- bandwidth, samplerate); -- pr_dbg -- ("IF is %d, mode is %d,tc_mode is %d\n", -- IF, mode, tc_mode); -- switch (IF) { -- case 0: -- ch_if = 36130; -- break; -- case 1: -- ch_if = -5500; -- break; -- case 2: -- ch_if = 4570; -- break; -- case 3: -- ch_if = 4000; -- break; -- case 4: -- ch_if = 5000; -- break; -- default: -- ch_if = 4000; -- break; -- } -- switch (samplerate) { -- case 0: -- adc_freq = 45000; -- break; -- case 1: -- adc_freq = 20833; -- break; -- case 2: -- adc_freq = 20700; -- break; -- case 3: -- adc_freq = 28571; -- break; -- case 4: -- adc_freq = 24000; -- break; -- default: -- adc_freq = 28571; -- break; -- } -- -- apb_write_reg(DVBT_BASE + (0x02 << 2), 0x00800000); -- /* SW reset bit[23] ; write anything to zero */ -- apb_write_reg(DVBT_BASE + (0x00 << 2), 0x00000000); -- -- apb_write_reg(DVBT_BASE + (0xe << 2), 0xffff); -- /* enable interrupt */ -- -- if (mode == 0) { /* DVBT */ -- switch (samplerate) { -- case 0: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00005a00); -- break; /* 45MHz */ -- case 1: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x000029aa); -- break; /* 20.833 */ -- case 2: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00002966); -- break; /* 20.7 SAMPLERATE*512 */ -- case 3: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00003924); -- break; /* 28.571 */ -- case 4: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00003000); -- break; /* 24 */ -- default: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00003924); -- break; /* 28.571 */ -- } -- } else { /* ISDBT */ -- switch (samplerate) { -- case 0: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x0000580d); -- break; /* 45MHz */ -- case 1: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x0000290d); -- break; /* 20.833 = 56/7 * 20.8333 / (512/63)*512 */ -- case 2: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x000028da); -- break; /* 20.7 */ -- case 3: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x0000383F); -- break; /* 28.571 3863 */ -- case 4: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00002F40); -- break; /* 24 */ -- default: -- apb_write_reg(DVBT_BASE + (0x08 << 2), 0x00003863); -- break; /* 28.571 */ -- } -- } --/* memstart=0x93900000; */ -- pr_dbg("memstart is %x\n", memstart); -- apb_write_reg(DVBT_BASE + (0x10 << 2), memstart); -- /* 0x8f300000 */ -- -- apb_write_reg(DVBT_BASE + (0x14 << 2), 0xe81c4ff6); -- /* AGC_TARGET 0xf0121385 */ -- -- switch (samplerate) { -- case 0: -- apb_write_reg(DVBT_BASE + (0x15 << 2), 0x018c2df2); -- break; -- case 1: -- apb_write_reg(DVBT_BASE + (0x15 << 2), 0x0185bdf2); -- break; -- case 2: -- apb_write_reg(DVBT_BASE + (0x15 << 2), 0x0185bdf2); -- break; -- case 3: -- apb_write_reg(DVBT_BASE + (0x15 << 2), 0x0187bdf2); -- break; -- case 4: -- apb_write_reg(DVBT_BASE + (0x15 << 2), 0x0187bdf2); -- break; -- default: -- apb_write_reg(DVBT_BASE + (0x15 << 2), 0x0187bdf2); -- break; -- } -- if (tc_mode == 1) -- apb_write_regb(DVBT_BASE + (0x15 << 2), 11, 0); -- /* For TC mode. Notice, For ADC input is Unsigned, -- For Capture Data, It is TC. */ -- apb_write_regb(DVBT_BASE + (0x15 << 2), 26, 1); -- /* [19:0] = [I , Q], I is high, Q is low. This bit is swap I/Q. */ -- -- apb_write_reg(DVBT_BASE + (0x16 << 2), 0x00047f80); -- /* AGC_IFGAIN_CTRL */ -- apb_write_reg(DVBT_BASE + (0x17 << 2), 0x00027f80); -- /* AGC_RFGAIN_CTRL */ -- apb_write_reg(DVBT_BASE + (0x18 << 2), 0x00000190); -- /* AGC_IFGAIN_ACCUM */ -- apb_write_reg(DVBT_BASE + (0x19 << 2), 0x00000190); -- /* AGC_RFGAIN_ACCUM */ -- if (ch_if < 0) -- ch_if += adc_freq; -- if (ch_if > adc_freq) -- ch_if -= adc_freq; -- -- tmp = ch_if * (1 << 15) / adc_freq; -- apb_write_reg(DVBT_BASE + (0x20 << 2), tmp); -- -- apb_write_reg(DVBT_BASE + (0x21 << 2), 0x001ff000); -- /* DDC CS_FCFO_ADJ_CTRL */ -- apb_write_reg(DVBT_BASE + (0x22 << 2), 0x00000000); -- /* DDC ICFO_ADJ_CTRL */ -- apb_write_reg(DVBT_BASE + (0x23 << 2), 0x00004000); -- /* DDC TRACK_FCFO_ADJ_CTRL */ -- -- apb_write_reg(DVBT_BASE + (0x27 << 2), (1 << 23) -- | (3 << 19) | (3 << 15) | (1000 << 4) | 9); -- /* {8'd0,1'd1,4'd3,4'd3,11'd50,4'd9});//FSM_1 */ -- apb_write_reg(DVBT_BASE + (0x28 << 2), (100 << 13) | 1000); -- /* {8'd0,11'd40,13'd50});//FSM_2 */ -- apb_write_reg(DVBT_BASE + (0x29 << 2), (31 << 20) | (1 << 16) | -- (24 << 9) | (3 << 6) | 20); -- /* {5'd0,7'd127,1'd0,3'd0,7'd24,3'd5,6'd20}); */ -- -- if (mode == 0) { /* DVBT */ -- if (bandwidth == 0) { /* 8M */ -- switch (samplerate) { -- case 0: -- ini_acf_iireq_src_45m_8m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x004ebf2e); -- break; /* 45M */ -- case 1: -- ini_acf_iireq_src_207m_8m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00247551); -- break; /* 20.833M */ -- case 2: -- ini_acf_iireq_src_207m_8m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00243999); -- break; /* 20.7M */ -- case 3: -- ini_acf_iireq_src_2857m_8m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0031ffcd); -- break; /* 28.57M */ -- case 4: -- ini_acf_iireq_src_24m_8m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x002A0000); -- break; /* 24M */ -- default: -- ini_acf_iireq_src_2857m_8m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0031ffcd); -- break; /* 28.57M */ -- } -- } else if (bandwidth == 1) { /* 7M */ -- switch (samplerate) { -- case 0: -- ini_acf_iireq_src_45m_7m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0059ff10); -- break; /* 45M */ -- case 1: -- ini_acf_iireq_src_207m_7m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0029aaa6); -- break; /* 20.833M */ -- case 2: -- ini_acf_iireq_src_207m_7m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00296665); -- break; /* 20.7M */ -- case 3: -- ini_acf_iireq_src_2857m_7m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00392491); -- break; /* 28.57M */ -- case 4: -- ini_acf_iireq_src_24m_7m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00300000); -- break; /* 24M */ -- default: -- ini_acf_iireq_src_2857m_7m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00392491); -- break; /* 28.57M */ -- } -- } else if (bandwidth == 2) { /* 6M */ -- switch (samplerate) { -- case 0: -- ini_acf_iireq_src_45m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00690000); -- break; /* 45M */ -- case 1: -- ini_acf_iireq_src_207m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00309c3e); -- break; /* 20.833M */ -- case 2: -- ini_acf_iireq_src_207m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x002eaaaa); -- break; /* 20.7M */ -- case 3: -- ini_acf_iireq_src_2857m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0042AA69); -- break; /* 28.57M */ -- case 4: -- ini_acf_iireq_src_24m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00380000); -- break; /* 24M */ -- default: -- ini_acf_iireq_src_2857m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0042AA69); -- break; /* 28.57M */ -- } -- } else { /* 5M */ -- switch (samplerate) { -- case 0: -- ini_acf_iireq_src_45m_5m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x007dfbe0); -- break; /* 45M */ -- case 1: -- ini_acf_iireq_src_207m_5m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x003a554f); -- break; /* 20.833M */ -- case 2: -- ini_acf_iireq_src_207m_5m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x0039f5c0); -- break; /* 20.7M */ -- case 3: -- ini_acf_iireq_src_2857m_5m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x004FFFFE); -- break; /* 28.57M */ -- case 4: -- ini_acf_iireq_src_24m_5m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x00433333); -- break; /* 24M */ -- default: -- ini_acf_iireq_src_2857m_5m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), -- 0x004FFFFE); -- break; /* 28.57M */ -- } -- } -- } else { /* ISDBT */ -- switch (samplerate) { -- case 0: -- ini_acf_iireq_src_45m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), 0x00589800); -- break; /* 45M -- SampleRate/(symbolRate)*2^20, -- symbolRate = 512/63 for isdbt */ -- case 1: -- ini_acf_iireq_src_207m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), 0x002903d4); -- break; /* 20.833M */ -- case 2: -- ini_acf_iireq_src_207m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), 0x00280ccc); -- break; /* 20.7M */ -- case 3: -- ini_acf_iireq_src_2857m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), 0x00383fc8); -- break; /* 28.57M */ -- case 4: -- ini_acf_iireq_src_24m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), 0x002F4000); -- break; /* 24M */ -- default: -- ini_acf_iireq_src_2857m_6m(); -- apb_write_reg(DVBT_BASE + (0x44 << 2), 0x00383fc8); -- break; /* 28.57M */ -- } -- } -- -- if (mode == 0) /* DVBT */ -- apb_write_reg(DVBT_BASE + (0x02 << 2), -- (bandwidth << 20) | 0x10002); -- else /* ISDBT */ -- apb_write_reg(DVBT_BASE + (0x02 << 2), (1 << 20) | 0x1001a); -- /* {0x000,2'h1,20'h1_001a}); // For ISDBT , bandwith should be 1, */ -- -- apb_write_reg(DVBT_BASE + (0x45 << 2), 0x00000000); -- /* SRC SFO_ADJ_CTRL */ -- apb_write_reg(DVBT_BASE + (0x46 << 2), 0x02004000); -- /* SRC SFO_ADJ_CTRL */ -- apb_write_reg(DVBT_BASE + (0x48 << 2), 0x000c0287); -- /* DAGC_CTRL1 */ -- apb_write_reg(DVBT_BASE + (0x49 << 2), 0x00000005); -- /* DAGC_CTRL2 */ -- apb_write_reg(DVBT_BASE + (0x4c << 2), 0x00000bbf); -- /* CCI_RP */ -- apb_write_reg(DVBT_BASE + (0x4d << 2), 0x00000376); -- /* CCI_RPSQ */ -- apb_write_reg(DVBT_BASE + (0x4e << 2), 0x0f0f1d09); -- /* CCI_CTRL */ -- apb_write_reg(DVBT_BASE + (0x4f << 2), 0x00000000); -- /* CCI DET_INDX1 */ -- apb_write_reg(DVBT_BASE + (0x50 << 2), 0x00000000); -- /* CCI DET_INDX2 */ -- apb_write_reg(DVBT_BASE + (0x51 << 2), 0x00000000); -- /* CCI_NOTCH1_A1 */ -- apb_write_reg(DVBT_BASE + (0x52 << 2), 0x00000000); -- /* CCI_NOTCH1_A2 */ -- apb_write_reg(DVBT_BASE + (0x53 << 2), 0x00000000); -- /* CCI_NOTCH1_B1 */ -- apb_write_reg(DVBT_BASE + (0x54 << 2), 0x00000000); -- /* CCI_NOTCH2_A1 */ -- apb_write_reg(DVBT_BASE + (0x55 << 2), 0x00000000); -- /* CCI_NOTCH2_A2 */ -- apb_write_reg(DVBT_BASE + (0x56 << 2), 0x00000000); -- /* CCI_NOTCH2_B1 */ -- apb_write_reg(DVBT_BASE + (0x58 << 2), 0x00000885); -- /* MODE_DETECT_CTRL // 582 */ -- if (mode == 0) /* DVBT */ -- apb_write_reg(DVBT_BASE + (0x5c << 2), 0x00001011); /* */ -- else -- apb_write_reg(DVBT_BASE + (0x5c << 2), 0x00000753); -- /* ICFO_EST_CTRL ISDBT ICFO thres = 2 */ -- -- apb_write_reg(DVBT_BASE + (0x5f << 2), 0x0ffffe10); -- /* TPS_FCFO_CTRL */ -- apb_write_reg(DVBT_BASE + (0x61 << 2), 0x0000006c); -- /* FWDT ctrl */ -- apb_write_reg(DVBT_BASE + (0x68 << 2), 0x128c3929); -- apb_write_reg(DVBT_BASE + (0x69 << 2), 0x91017f2d); -- /* 0x1a8 */ -- apb_write_reg(DVBT_BASE + (0x6b << 2), 0x00442211); -- /* 0x1a8 */ -- apb_write_reg(DVBT_BASE + (0x6c << 2), 0x01fc400a); -- /* 0x */ -- apb_write_reg(DVBT_BASE + (0x6d << 2), 0x0030303f); -- /* 0x */ -- apb_write_reg(DVBT_BASE + (0x73 << 2), 0xffffffff); -- /* CCI0_PILOT_UPDATE_CTRL */ -- apb_write_reg(DVBT_BASE + (0x74 << 2), 0xffffffff); -- /* CCI0_DATA_UPDATE_CTRL */ -- apb_write_reg(DVBT_BASE + (0x75 << 2), 0xffffffff); -- /* CCI1_PILOT_UPDATE_CTRL */ -- apb_write_reg(DVBT_BASE + (0x76 << 2), 0xffffffff); -- /* CCI1_DATA_UPDATE_CTRL */ -- -- tmp = mode == 0 ? 0x000001a2 : 0x00000da2; -- apb_write_reg(DVBT_BASE + (0x78 << 2), tmp); /* FEC_CTR */ -- -- apb_write_reg(DVBT_BASE + (0x7d << 2), 0x0000009d); -- apb_write_reg(DVBT_BASE + (0x7e << 2), 0x00004000); -- apb_write_reg(DVBT_BASE + (0x7f << 2), 0x00008000); -- -- apb_write_reg(DVBT_BASE + ((0x8b + 0) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 1) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 2) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 3) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 4) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 5) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 6) << 2), 0x20002000); -- apb_write_reg(DVBT_BASE + ((0x8b + 7) << 2), 0x20002000); -- -- apb_write_reg(DVBT_BASE + (0x93 << 2), 0x31); -- apb_write_reg(DVBT_BASE + (0x94 << 2), 0x00); -- apb_write_reg(DVBT_BASE + (0x95 << 2), 0x7f1); -- apb_write_reg(DVBT_BASE + (0x96 << 2), 0x20); -- -- apb_write_reg(DVBT_BASE + (0x98 << 2), 0x03f9115a); -- apb_write_reg(DVBT_BASE + (0x9b << 2), 0x000005df); -- -- apb_write_reg(DVBT_BASE + (0x9c << 2), 0x00100000); -- /* TestBus write valid, 0 is system clk valid */ -- apb_write_reg(DVBT_BASE + (0x9d << 2), 0x01000000); -- /* DDR Start address */ -- apb_write_reg(DVBT_BASE + (0x9e << 2), 0x02000000); -- /* DDR End address */ -- -- apb_write_regb(DVBT_BASE + (0x9b << 2), 7, 0); -- /* Enable Testbus dump to DDR */ -- apb_write_regb(DVBT_BASE + (0x9b << 2), 8, 0); -- /* Run Testbus dump to DDR */ -- -- apb_write_reg(DVBT_BASE + (0xd6 << 2), 0x00000003); -- /* apb_write_reg(DVBT_BASE+(0xd7<<2), 0x00000008); */ -- apb_write_reg(DVBT_BASE + (0xd8 << 2), 0x00000120); -- apb_write_reg(DVBT_BASE + (0xd9 << 2), 0x01010101); -- -- ini_icfo_pn_index(mode); -- tfd_filter_coff_ini(); -- -- calculate_cordic_para(); -- msleep(20); -- /* delay_us(1); */ -- -- apb_write_reg(DVBT_BASE + (0x02 << 2), -- apb_read_reg(DVBT_BASE + (0x02 << 2)) | (1 << 0)); -- apb_write_reg(DVBT_BASE + (0x02 << 2), -- apb_read_reg(DVBT_BASE + (0x02 << 2)) | (1 << 24)); --#endif --/* dvbt_check_status(); */ --} -- --void calculate_cordic_para(void) --{ -- apb_write_reg(DVBT_BASE + 0x0c, 0x00000040); --} -- --char *ofdm_fsm_name[] = { " IDLE", -- " AGC", -- " CCI", -- " ACQ", -- " SYNC", -- "TRACKING", -- " TIMING", -- " SP_SYNC", -- " TPS_DEC", -- "FEC_LOCK", -- "FEC_LOST" --}; -- --void check_fsm_state(void) --{ -- unsigned long tmp; -- -- tmp = apb_read_reg(DVBT_BASE + 0xa8); -- /* printk(">>>>>>>>>>>>>>>>>>>>>>>>> OFDM FSM From %d -- to %d\n", tmp>>4&0xf, tmp&0xf); */ -- -- if ((tmp & 0xf) == 3) { -- apb_write_regb(DVBT_BASE + (0x9b << 2), 8, 1); -- /* Stop dump testbus; */ -- apb_write_regb(DVBT_BASE + (0x0f << 2), 0, 1); -- tmp = apb_read_reg(DVBT_BASE + (0x9f << 2)); -- /* printk(">>>>>>>>>>>>>>>>>>>>>>>>> STOP DUMP DATA To DDR : -- End Addr %d,Is it overflow?%d\n", tmp>>1, tmp&0x1); */ -- } --} -- --void ofdm_read_all_regs(void) --{ -- int i; -- unsigned long tmp; -- -- for (i = 0; i < 0xff; i++) -- tmp = apb_read_reg(DVBT_BASE + 0x00 + i * 4); -- /* printk("OFDM Reg (0x%x) is 0x%x\n", i, tmp); */ -- --} -- --static int dvbt_get_status(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- return apb_read_reg(DVBT_BASE + 0x0) >> 12 & 1; --} -- --static int dvbt_get_ber(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ --/* pr_dbg("[RSJ]per is %u\n",apb_read_reg(DVBT_BASE+(0xbf<<2))); */ -- return apb_read_reg(DVBT_BASE + (0xbf << 2)); --} -- --static int dvbt_get_snr(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ --/* pr_dbg("2snr is %u\n",((apb_read_reg(DVBT_BASE+(0x0a<<2)))>>20)&0x3ff); */ -- return ((apb_read_reg(DVBT_BASE + (0x0a << 2))) >> 20) & 0x3ff; -- /*dBm: bit0~bit2=decimal */ --} -- --static int dvbt_get_strength(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ --/* int dbm = dvbt_get_ch_power(demod_sta, demod_i2c); */ --/* return dbm; */ -- return 0; --} -- --static int dvbt_get_ucblocks(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- return 0; --/* return dvbt_get_per(); */ --} -- --struct demod_status_ops *dvbt_get_status_ops(void) --{ -- static struct demod_status_ops ops = { -- .get_status = dvbt_get_status, -- .get_ber = dvbt_get_ber, -- .get_snr = dvbt_get_snr, -- .get_strength = dvbt_get_strength, -- .get_ucblocks = dvbt_get_ucblocks, -- }; -- -- return &ops; --} -- --int app_apb_read_reg(int addr) --{ -- addr = DTMB_TOP_ADDR(addr); -- return (int)demod_read_demod_reg(addr); --} -- --int app_apb_write_reg(int addr, int data) --{ -- addr = DTMB_TOP_ADDR(addr); -- demod_set_demod_reg(data, addr); -- return 0; --} -- --void monitor_isdbt(void) --{ -- int SNR; -- int SNR_SP = 500; -- int SNR_TPS = 0; -- int SNR_CP = 0; -- int timeStamp = 0; -- int SFO_residual = 0; -- int SFO_esti = 0; -- int FCFO_esti = 0; -- int FCFO_residual = 0; -- int AGC_Gain = 0; -- int RF_AGC = 0; -- int Signal_power = 0; -- int FECFlag = 0; -- int EQ_seg_ratio = 0; -- int tps_0 = 0; -- int tps_1 = 0; -- int tps_2 = 0; -- -- int time_stamp; -- int SFO; -- int FCFO; -- int timing_adj; -- int RS_CorrectNum; -- -- int cnt; -- int tmpAGCGain; -- -- tmpAGCGain = 0; -- cnt = 0; -- --/* app_apb_write_reg(0x8, app_apb_read_reg(0x8) & ~(1 << 17)); --// TPS symbol index update : active high */ -- time_stamp = app_apb_read_reg(0x07) & 0xffff; -- SNR = app_apb_read_reg(0x0a); -- FECFlag = (app_apb_read_reg(0x00) >> 11) & 0x3; -- SFO = app_apb_read_reg(0x47) & 0xfff; -- SFO_esti = app_apb_read_reg(0x60) & 0xfff; -- FCFO_esti = (app_apb_read_reg(0x60) >> 11) & 0xfff; -- FCFO = (app_apb_read_reg(0x26)) & 0xffffff; -- RF_AGC = app_apb_read_reg(0x0c) & 0x1fff; -- timing_adj = app_apb_read_reg(0x6f) & 0x1fff; -- RS_CorrectNum = app_apb_read_reg(0xc1) & 0xfffff; -- Signal_power = (app_apb_read_reg(0x1b)) & 0x1ff; -- EQ_seg_ratio = app_apb_read_reg(0x6e) & 0x3ffff; -- tps_0 = app_apb_read_reg(0x64); -- tps_1 = app_apb_read_reg(0x65); -- tps_2 = app_apb_read_reg(0x66) & 0xf; -- -- timeStamp = (time_stamp >> 8) * 68 + (time_stamp & 0x7f); -- SFO_residual = (SFO > 0x7ff) ? (SFO - 0x1000) : SFO; -- FCFO_residual = (FCFO > 0x7fffff) ? (FCFO - 0x1000000) : FCFO; -- /* RF_AGC = (RF_AGC>0x3ff)? (RF_AGC - 0x800): RF_AGC; */ -- FCFO_esti = (FCFO_esti > 0x7ff) ? (FCFO_esti - 0x1000) : FCFO_esti; -- SNR_CP = (SNR) & 0x3ff; -- SNR_TPS = (SNR >> 10) & 0x3ff; -- SNR_SP = (SNR >> 20) & 0x3ff; -- SNR_SP = (SNR_SP > 0x1ff) ? SNR_SP - 0x400 : SNR_SP; -- SNR_TPS = (SNR_TPS > 0x1ff) ? SNR_TPS - 0x400 : SNR_TPS; -- SNR_CP = (SNR_CP > 0x1ff) ? SNR_CP - 0x400 : SNR_CP; -- AGC_Gain = tmpAGCGain >> 4; -- tmpAGCGain = (AGC_Gain > 0x3ff) ? AGC_Gain - 0x800 : AGC_Gain; -- timing_adj = (timing_adj > 0xfff) ? timing_adj - 0x2000 : timing_adj; -- EQ_seg_ratio = -- (EQ_seg_ratio > 0x1ffff) ? EQ_seg_ratio - 0x40000 : EQ_seg_ratio; -- -- pr_dbg -- ("T %4x SP %3d TPS %3d CP %3d EQS %8x RSC %4d", -- app_apb_read_reg(0xbf) -- , SNR_SP, SNR_TPS, SNR_CP --/* ,EQ_seg_ratio */ -- , app_apb_read_reg(0x62) -- , RS_CorrectNum); -- pr_dbg -- ("SFO %4d FCFO %4d Vit %4x Timing %3d SigP %3x", -- SFO_residual, FCFO_residual, RF_AGC, timing_adj, -- Signal_power); -- pr_dbg -- ("FEC %x RSErr %8x ReSyn %x tps %03x%08x", -- FECFlag, app_apb_read_reg(0x0b) -- , (app_apb_read_reg(0xc0) >> 20) & 0xff, -- app_apb_read_reg(0x05) & 0xfff, app_apb_read_reg(0x04) -- ); -- pr_dbg("\n"); --} -- --int find_2(int data, int *table, int len) --{ -- int end; -- int index; -- int start; -- int cnt = 0; -- -- start = 0; -- end = len; -- /* printf("data is %d\n",data); */ -- while ((len > 1) && (cnt < 10)) { -- cnt++; -- index = (len / 2); -- if (data > table[start + index]) { -- start = start + index; -- len = len - index - 1; -- } -- if (data < table[start + index]) { -- len = index + 1; -- } else if (data == table[start + index]) { -- start = start + index; -- break; -- } -- } -- return start; --} -- --int read_atsc_all_reg(void) --{ -- return 0; --#if 0 -- int i, j, k; -- j = 4; -- unsigned long data; -- pr_dbg("system agc is:"); /* system agc */ -- for (i = 0xc00; i <= 0xc0c; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0xc80; i <= 0xc87; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n vsb control is:"); /*vsb control */ -- j = 4; -- for (i = 0x900; i <= 0x905; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x908; i <= 0x912; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x917; i <= 0x91b; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x980; i <= 0x992; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n vsb demod is:"); /*vsb demod */ -- j = 4; -- for (i = 0x700; i <= 0x711; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x716; i <= 0x720; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x722; i <= 0x724; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x726; i <= 0x72c; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x730; i <= 0x732; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x735; i <= 0x751; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x780; i <= 0x795; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x752; i <= 0x755; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n vsb equalizer is:"); /*vsb equalizer */ -- j = 4; -- for (i = 0x501; i <= 0x5ff; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n vsb fec is:"); /*vsb fec */ -- j = 4; -- for (i = 0x601; i <= 0x601; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x682; i <= 0x685; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n qam demod is:"); /*qam demod */ -- j = 4; -- for (i = 0x1; i <= 0x1a; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x25; i <= 0x28; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x101; i <= 0x10b; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x206; i <= 0x207; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n qam equalize is:"); /*qam equalize */ -- j = 4; -- for (i = 0x200; i <= 0x23d; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- j = 4; -- for (i = 0x260; i <= 0x275; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n qam fec is:"); /*qam fec */ -- j = 4; -- for (i = 0x400; i <= 0x418; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n system mpeg formatter is:"); /*system mpeg formatter */ -- j = 4; -- for (i = 0xf00; i <= 0xf09; i++) { -- data = atsc_read_reg(i); -- if (j == 4) { -- pr_dbg("\n[addr:0x%x]", i); -- j = 0; -- } -- pr_dbg("%02x ", data); -- j++; -- } -- pr_dbg("\n\n"); -- return 0; --#endif --} -- --int check_atsc_fsm_status(void) --{ -- int SNR; -- int atsc_snr = 0; -- int SNR_dB; -- int SNR_table[56] = { 0, 7, 9, 11, 14, -- 17, -- 22, -- 27, 34, 43, 54, -- 68, 86, 108, 136, 171, -- 215, -- 271, 341, -- 429, 540, -- 566, 592, 620, 649, 680, -- 712, -- 746, 781, -- 818, 856, -- 896, 939, 983, 1029, 1078, -- 1182, -- 1237, -- 1237, 1296, 1357, -- 1708, 2150, 2707, 3408, 4291, -- 5402, -- 6800, -- 8561, 10778, 13568, -- 16312, 17081, 18081, 19081, 65536 -- }; -- int SNR_dB_table[56] = { 360, 350, 340, 330, 320, 310, 300, -- 290, -- 280, -- 270, 260, -- 250, 240, 230, 220, 210, 200, 190, -- 180, -- 170, -- 160, -- 158, 156, 154, 152, 150, 148, 146, -- 144, -- 142, -- 140, -- 138, 136, 134, 132, 130, 128, 126, -- 124, -- 122, -- 120, -- 110, 100, 90, 80, 70, 60, 50, -- 40, -- 30, -- 20, -- 12, 10, 4, 2, 0 -- }; -- -- int tmp[3]; -- int cr; -- int ck; -- int SM; -- int tni; -- int ber; -- int per; -- -- int cnt; -- -- cnt = 0; -- ber = 0; -- per = 0; -- --/* g_demod_mode = 2; */ -- tni = atsc_read_reg((0x08) >> 16); --/* g_demod_mode = 4; */ -- tmp[0] = atsc_read_reg(0x0511); -- tmp[1] = atsc_read_reg(0x0512); -- SNR = (tmp[0] << 8) + tmp[1]; -- SNR_dB = SNR_dB_table[find_2(SNR, SNR_table, 56)]; -- -- tmp[0] = atsc_read_reg(0x0780); -- tmp[1] = atsc_read_reg(0x0781); -- tmp[2] = atsc_read_reg(0x0782); -- cr = tmp[0] + (tmp[1] << 8) + (tmp[2] << 16); -- tmp[0] = atsc_read_reg(0x0786); -- tmp[1] = atsc_read_reg(0x0787); -- tmp[2] = atsc_read_reg(0x0788); -- ck = (tmp[0] << 16) + (tmp[1] << 8) + tmp[2]; -- ck = (ck > 8388608) ? ck - 16777216 : ck; -- SM = atsc_read_reg(0x0980); --/* ber per */ -- atsc_write_reg(0x0601, atsc_read_reg(0x0601) & (~(1 << 3))); -- atsc_write_reg(0x0601, atsc_read_reg(0x0601) | (1 << 3)); -- ber = atsc_read_reg(0x0683) + (atsc_read_reg(0x0682) << 8); -- per = atsc_read_reg(0x0685) + (atsc_read_reg(0x0684) << 8); -- --/* read_atsc_all_reg(); */ -- -- pr_dbg -- ("INT %x SNR %x SNRdB %d.%d FSM %x cr %d ck %d", -- tni, SNR, (SNR_dB / 10) -- , (SNR_dB - (SNR_dB / 10) * 10) -- , SM, cr, ck); -- pr_dbg -- ("ber is %d, per is %d\n", -- ber, per); -- -- atsc_snr = (SNR_dB / 10); -- return atsc_snr; -- -- /* unsigned long sm,snr1,snr2,snr; -- * static int fec_lock_cnt = 0; -- * -- * delay_us(10000); -- * sm = atsc_read_reg(0x0980); -- * snr1 = atsc_read_reg(0x0511)&0xff; -- * snr2 = atsc_read_reg(0x0512)&0xff; -- * snr = (snr1 << 8) + snr2; -- * -- * printk(">>>>>>>>>>>>>>>>>>>>>>>>> -- OFDM FSM %x SNR %x\n", sm&0xff, snr); -- * -- * if (sm == 0x79) stimulus_finish_pass();*/ --} -diff --git a/drivers/amlogic/dvb_tv/amldemod/dvbc_func.c b/drivers/amlogic/dvb_tv/amldemod/dvbc_func.c -deleted file mode 100644 -index 4db65c5..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/dvbc_func.c -+++ /dev/null -@@ -1,1238 +0,0 @@ --#include --#include --#include --#include --#include "demod_func.h" --#include -- --static int debug_amldvbc = 1; --#define dprintk(a ...) do { if (debug_amldvbc) printk(a); } while (0) -- --static struct task_struct *cci_task; --int cciflag = 0; --struct timer_list mytimer; -- --static void dvbc_cci_timer(unsigned long data) --{ --#if 0 -- int count; -- int maxCCI_p, re, im, j, i, times, maxCCI, sum, sum1, reg_0xf0, tmp1, -- tmp, tmp2, reg_0xa8, reg_0xac; -- int reg_0xa8_t, reg_0xac_t; -- count = 100; -- if ((((apb_read_reg(QAM_BASE + 0x18)) & 0x1) == 1)) { -- dprintk("[cci]lock "); -- if (cciflag == 0) { -- apb_write_reg(QAM_BASE + 0xa8, 0); -- -- cciflag = 0; -- } -- dprintk("\n"); -- mdelay(500); -- mod_timer(&mytimer, jiffies + 2 * HZ); -- return; -- } -- if (cciflag == 1) { -- dprintk("[cci]cciflag is 1,wait 20\n"); -- mdelay(20000); -- } -- times = 300; -- tmp = 0x2be2be3; -- /*0x2ae4772; IF = 6M, fs = 35M, dec2hex(round(8*IF/fs*2^25)) */ -- tmp2 = 0x2000; -- tmp1 = 8; -- reg_0xa8 = 0xc0000000; /* bypass CCI */ -- reg_0xac = 0xc0000000; /* bypass CCI */ -- -- maxCCI = 0; -- maxCCI_p = 0; -- for (i = 0; i < times; i++) { -- /*reg_0xa8 = app_apb_read_reg(0xa8); */ -- reg_0xa8_t = reg_0xa8 + tmp + i * tmp2; -- apb_write_reg(QAM_BASE + 0xa8, reg_0xa8_t); -- reg_0xac_t = reg_0xac + tmp - i * tmp2; -- apb_write_reg(QAM_BASE + 0xac, reg_0xac_t); -- sum = 0; -- sum1 = 0; -- for (j = 0; j < tmp1; j++) { -- /* msleep(20); */ -- /* mdelay(20); */ -- reg_0xf0 = apb_read_reg(QAM_BASE + 0xf0); -- re = (reg_0xf0 >> 24) & 0xff; -- im = (reg_0xf0 >> 16) & 0xff; -- if (re > 127) -- /*re = re - 256; */ -- re = 256 - re; -- if (im > 127) -- /*im = im - 256; */ -- im = 256 - im; -- -- sum += re + im; -- re = (reg_0xf0 >> 8) & 0xff; -- im = (reg_0xf0 >> 0) & 0xff; -- if (re > 127) -- /*re = re - 256; */ -- re = 256 - re; -- if (im > 127) -- /*im = im - 256; */ -- im = 256 - im; -- -- sum1 += re + im; -- } -- sum = sum / tmp1; -- sum1 = sum1 / tmp1; -- if (sum1 > sum) { -- sum = sum1; -- reg_0xa8_t = reg_0xac_t; -- } -- if (sum > maxCCI) { -- maxCCI = sum; -- if (maxCCI > 24) -- maxCCI_p = reg_0xa8_t & 0x7fffffff; -- } -- if ((sum < 24) && (maxCCI_p > 0)) -- break; /* stop CCI detect. */ -- } -- -- if (maxCCI_p > 0) { -- apb_write_reg(QAM_BASE + 0xa8, maxCCI_p & 0x7fffffff); -- /* enable CCI */ -- apb_write_reg(QAM_BASE + 0xac, maxCCI_p & 0x7fffffff); -- /* enable CCI */ -- /* if(dvbc.mode == 4) // 256QAM */ -- apb_write_reg(QAM_BASE + 0x54, 0xa25705fa); -- /**/ cciflag = 1; -- mdelay(1000); -- } else { -- dprintk -- ("[cci] ------------ find NO CCI -------------------\n"); -- cciflag = 0; -- } -- -- dprintk("[cci][%s]--------------------------\n", __func__); -- mod_timer(&mytimer, jiffies + 2 * HZ); -- return; --/* }*/ --#endif --} -- --int dvbc_timer_init(void) --{ -- dprintk("%s\n", __func__); -- setup_timer(&mytimer, dvbc_cci_timer, (unsigned long)"Hello, world!"); -- mytimer.expires = jiffies + 2 * HZ; -- add_timer(&mytimer); -- return 0; --} -- --void dvbc_timer_exit(void) --{ -- dprintk("%s\n", __func__); -- del_timer(&mytimer); --} -- --int dvbc_cci_task(void *data) --{ -- int count; -- int maxCCI_p, re, im, j, i, times, maxCCI, sum, sum1, reg_0xf0, tmp1, -- tmp, tmp2, reg_0xa8, reg_0xac; -- int reg_0xa8_t, reg_0xac_t; -- -- count = 100; -- while (1) { -- msleep(200); -- if ((((apb_read_reg(QAM_BASE + 0x18)) & 0x1) == 1)) { -- dprintk("[cci]lock "); -- if (cciflag == 0) { -- apb_write_reg(QAM_BASE + 0xa8, 0); -- apb_write_reg(QAM_BASE + 0xac, 0); -- dprintk("no cci "); -- cciflag = 0; -- } -- dprintk("\n"); -- msleep(500); -- continue; -- } -- -- if (cciflag == 1) { -- dprintk("[cci]cciflag is 1,wait 20\n"); -- msleep(20000); -- } -- times = 300; -- tmp = 0x2be2be3; -- /*0x2ae4772; IF = 6M,fs = 35M, dec2hex(round(8*IF/fs*2^25)) */ -- tmp2 = 0x2000; -- tmp1 = 8; -- reg_0xa8 = 0xc0000000; /* bypass CCI */ -- reg_0xac = 0xc0000000; /* bypass CCI */ -- -- maxCCI = 0; -- maxCCI_p = 0; -- for (i = 0; i < times; i++) { -- /*reg_0xa8 = app_apb_read_reg(0xa8); */ -- reg_0xa8_t = reg_0xa8 + tmp + i * tmp2; -- apb_write_reg(QAM_BASE + 0xa8, reg_0xa8_t); -- reg_0xac_t = reg_0xac + tmp - i * tmp2; -- apb_write_reg(QAM_BASE + 0xac, reg_0xac_t); -- sum = 0; -- sum1 = 0; -- for (j = 0; j < tmp1; j++) { -- /* msleep(1); */ -- reg_0xf0 = apb_read_reg(QAM_BASE + 0xf0); -- re = (reg_0xf0 >> 24) & 0xff; -- im = (reg_0xf0 >> 16) & 0xff; -- if (re > 127) -- /*re = re - 256; */ -- re = 256 - re; -- if (im > 127) -- /*im = im - 256; */ -- im = 256 - im; -- -- sum += re + im; -- -- re = (reg_0xf0 >> 8) & 0xff; -- im = (reg_0xf0 >> 0) & 0xff; -- if (re > 127) -- /*re = re - 256; */ -- re = 256 - re; -- if (im > 127) -- /*im = im - 256; */ -- im = 256 - im; -- -- sum1 += re + im; -- } -- sum = sum / tmp1; -- sum1 = sum1 / tmp1; -- if (sum1 > sum) { -- sum = sum1; -- reg_0xa8_t = reg_0xac_t; -- } -- if (sum > maxCCI) { -- maxCCI = sum; -- if (maxCCI > 24) -- maxCCI_p = reg_0xa8_t & 0x7fffffff; -- } -- -- if ((sum < 24) && (maxCCI_p > 0)) -- break; /* stop CCI detect. */ -- } -- -- if (maxCCI_p > 0) { -- apb_write_reg(QAM_BASE + 0xa8, maxCCI_p & 0x7fffffff); -- /* enable CCI */ -- apb_write_reg(QAM_BASE + 0xac, maxCCI_p & 0x7fffffff); -- /* enable CCI */ -- /* if(dvbc.mode == 4) // 256QAM */ -- apb_write_reg(QAM_BASE + 0x54, 0xa25705fa); -- /**/ cciflag = 1; -- msleep(1000); -- } else { -- cciflag = 0; -- } -- -- dprintk("[cci][%s]--------------------------\n", __func__); -- } -- return 0; --} -- --int dvbc_get_cci_task(void) --{ -- if (cci_task) -- return 0; -- else -- return 1; --} -- --void dvbc_create_cci_task(void) --{ -- int ret; -- -- /*apb_write_reg(QAM_BASE+0xa8, 0x42b2ebe3); // enable CCI */ -- /* apb_write_reg(QAM_BASE+0xac, 0x42b2ebe3); // enable CCI */ --/* if(dvbc.mode == 4) // 256QAM*/ -- /* apb_write_reg(QAM_BASE+0x54, 0xa25705fa); // */ -- ret = 0; -- cci_task = kthread_create(dvbc_cci_task, NULL, "cci_task"); -- if (ret != 0) { -- dprintk("[%s]Create cci kthread error!\n", __func__); -- cci_task = NULL; -- return; -- } -- wake_up_process(cci_task); -- dprintk("[%s]Create cci kthread and wake up!\n", __func__); --} -- --void dvbc_kill_cci_task(void) --{ -- if (cci_task) { -- kthread_stop(cci_task); -- cci_task = NULL; -- dprintk("[%s]kill cci kthread !\n", __func__); -- } --} -- --u32 dvbc_set_qam_mode(unsigned char mode) --{ -- dprintk("auto change mode ,now mode is %d\n", mode); -- apb_write_reg(QAM_BASE + 0x008, (mode & 7)); -- /* qam mode */ -- switch (mode) { -- case 0: /* 16 QAM */ -- apb_write_reg(QAM_BASE + 0x054, 0x23460224); -- /* EQ_FIR_CTL, */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- apb_write_reg(QAM_BASE + 0x074, 0x50001a0); -- /* EQ_TH_LMS 40db 13db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x003001e9); -- /* EQ_NORM and EQ_TH_MMA */ -- /*apb_write_reg(QAM_BASE+0x080, 0x000be1ff); -- * // EQ_TH_SMMA0*/ -- apb_write_reg(QAM_BASE + 0x080, 0x000e01fe); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x00000000); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2b); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292b); -- * // Pilips Tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292d); -- * // Pilips Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092d); -- /* Pilips Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f66); -- /* by raymond 20121213 */ -- break; -- -- case 1: /* 32 QAM */ -- apb_write_reg(QAM_BASE + 0x054, 0x24560506); -- /* EQ_FIR_CTL, */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x5000260); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x50001f0); -- /* EQ_TH_LMS 40db 17.5db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x00500102); -- /* EQ_TH_MMA 0x000001cc */ -- apb_write_reg(QAM_BASE + 0x080, 0x00077140); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x001fb000); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2b); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292b); -- * // Pilips Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092b); -- /* Pilips Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f66); -- /* by raymond 20121213 */ -- break; -- -- case 2: /* 64 QAM */ -- /*apb_write_reg(QAM_BASE+0x054, 0x2256033a); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0x2336043a); -- /* EQ_FIR_CTL, by raymond */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x5000260); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000230); -- /* EQ_TH_LMS 40db 17.5db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x007001bd); -- /* EQ_TH_MMA */ -- apb_write_reg(QAM_BASE + 0x080, 0x000580ed); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x001771fb); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f802b3d); -- /* Pilips Tuner & maxlinear Tuner */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f802b3a); -- * // Pilips Tuner & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f66); -- /* by raymond 20121213 */ -- break; -- -- case 3: /* 128 QAM */ -- /*apb_write_reg(QAM_BASE+0x054, 0x2557046a); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0x2437067a); -- /* EQ_FIR_CTL, by raymond 20121213 */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000d0); -- /* EQ_CRTH_SNR */ -- /* apb_write_reg(QAM_BASE+0x074, 0x02440240); -- * // EQ_TH_LMS 18.5db 18db*/ -- /* apb_write_reg(QAM_BASE+0x074, 0x04000400); -- * // EQ_TH_LMS 22db 22.5db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000260); -- /* EQ_TH_LMS 40db 19db */ -- /*apb_write_reg(QAM_BASE+0x07c, 0x00b000f2); -- * // EQ_TH_MMA0x000000b2*/ -- apb_write_reg(QAM_BASE + 0x07c, 0x00b00132); -- /* EQ_TH_MMA0x000000b2 by raymond 20121213 */ -- apb_write_reg(QAM_BASE + 0x080, 0x0003a09d); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x000f8150); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x001a51f8); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092c); -- /* Pilips Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f66); -- /* by raymond 20121213 */ -- break; -- -- case 4: /* 256 QAM */ -- /*apb_write_reg(QAM_BASE+0x054, 0xa2580588); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0xa25905f9); -- /* EQ_FIR_CTL, by raymond 20121213 */ -- apb_write_reg(QAM_BASE + 0x068, 0x01e00220); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x50002a0); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000270); -- /* EQ_TH_LMS 40db 19db by raymond 201211213 */ -- apb_write_reg(QAM_BASE + 0x07c, 0x00f001a5); -- /* EQ_TH_MMA */ -- apb_write_reg(QAM_BASE + 0x080, 0x0002c077); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x000bc0fe); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x0013f17e); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x01bc01f9); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips Tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292d); -- * // Maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092d); -- /* Maxlinear Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213, when adc=35M,sys=70M, -- * its better than 0x61f2f66*/ -- break; -- default: /*64qam */ -- /*apb_write_reg(QAM_BASE+0x054, 0x2256033a); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0x2336043a); -- /* EQ_FIR_CTL, by raymond */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x5000260); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000230); -- /* EQ_TH_LMS 40db 17.5db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x007001bd); -- /* EQ_TH_MMA */ -- apb_write_reg(QAM_BASE + 0x080, 0x000580ed); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x001771fb); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f802b3d); -- /* Pilips Tuner & maxlinear Tuner */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f802b3a); -- * // Pilips Tuner & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f66); -- /* by raymond 20121213 */ -- break; -- } -- return 0; --} -- --u32 dvbc_get_status(void) --{ --/* dprintk("c4 is %x\n",apb_read_reg(QAM_BASE+0xc4));*/ -- return apb_read_reg(QAM_BASE + 0xc4) & 0xf; --} -- --EXPORT_SYMBOL(dvbc_get_status); -- --static u32 dvbc_get_ch_power(void) --{ -- u32 tmp; -- u32 ad_power; -- u32 agc_gain; -- u32 ch_power; -- -- tmp = apb_read_reg(QAM_BASE + 0x09c); -- -- ad_power = (tmp >> 22) & 0x1ff; -- agc_gain = (tmp >> 0) & 0x7ff; -- -- ad_power = ad_power >> 4; -- /* ch_power = lookuptable(agc_gain) + ad_power; TODO */ -- ch_power = (ad_power & 0xffff) + ((agc_gain & 0xffff) << 16); -- -- return ch_power; --} -- --static u32 dvbc_get_snr(void) --{ -- u32 tmp, snr; -- -- tmp = apb_read_reg(QAM_BASE + 0x14) & 0xfff; -- snr = tmp * 100 / 32; /* * 1e2 */ -- -- return snr; --} -- --static u32 dvbc_get_ber(void) --{ -- u32 rs_ber; -- u32 rs_packet_len; -- -- rs_packet_len = apb_read_reg(QAM_BASE + 0x10) & 0xffff; -- rs_ber = apb_read_reg(QAM_BASE + 0x14) >> 12 & 0xfffff; -- -- /* rs_ber = rs_ber / 204.0 / 8.0 / rs_packet_len; */ -- if (rs_packet_len == 0) -- rs_ber = 1000000; -- else -- rs_ber = rs_ber * 613 / rs_packet_len; /* 1e-6 */ -- -- return rs_ber; --} -- --static u32 dvbc_get_per(void) --{ -- u32 rs_per; -- u32 rs_packet_len; -- u32 acc_rs_per_times; -- -- rs_packet_len = apb_read_reg(QAM_BASE + 0x10) & 0xffff; -- rs_per = apb_read_reg(QAM_BASE + 0x18) >> 16 & 0xffff; -- -- acc_rs_per_times = apb_read_reg(QAM_BASE + 0xcc) & 0xffff; -- /*rs_per = rs_per / rs_packet_len; */ -- -- if (rs_packet_len == 0) -- rs_per = 10000; -- else -- rs_per = 10000 * rs_per / rs_packet_len; /* 1e-4 */ -- -- /*return rs_per; */ -- return acc_rs_per_times; --} -- --static u32 dvbc_get_symb_rate(void) --{ -- u32 tmp; -- u32 adc_freq; -- u32 symb_rate; -- -- adc_freq = apb_read_reg(QAM_BASE + 0x34) >> 16 & 0xffff; -- tmp = apb_read_reg(QAM_BASE + 0xb8); -- -- if ((tmp >> 15) == 0) -- symb_rate = 0; -- else -- symb_rate = 10 * (adc_freq << 12) / (tmp >> 15); -- /* 1e4 */ -- -- return symb_rate; --} -- --static int dvbc_get_freq_off(void) --{ -- int tmp; -- int symb_rate; -- int freq_off; -- -- symb_rate = dvbc_get_symb_rate(); -- tmp = apb_read_reg(QAM_BASE + 0xe0) & 0x3fffffff; -- if (tmp >> 29 & 1) -- tmp -= (1 << 30); -- -- freq_off = ((tmp >> 16) * 25 * (symb_rate >> 10)) >> 3; -- -- return freq_off; --} -- --static void dvbc_set_test_bus(u8 sel) --{ -- u32 tmp; -- -- tmp = apb_read_reg(QAM_BASE + 0x08); -- tmp &= ~(0x1f << 4); -- tmp |= ((sel & 0x1f) << 4) | (1 << 3); -- apb_write_reg(QAM_BASE + 0x08, tmp); --} -- --void dvbc_get_test_out(u8 sel, u32 len, u32 *buf) --{ -- int i, cnt; -- -- dvbc_set_test_bus(sel); -- -- for (i = 0, cnt = 0; i < len - 4 && cnt < 1000000; i++) { -- buf[i] = apb_read_reg(QAM_BASE + 0xb0); -- if (buf[i] >> 11 & 1) { -- buf[i++] = apb_read_reg(QAM_BASE + 0xb0); -- buf[i++] = apb_read_reg(QAM_BASE + 0xb0); -- buf[i++] = apb_read_reg(QAM_BASE + 0xb0); -- buf[i++] = apb_read_reg(QAM_BASE + 0xb0); -- } else { -- i--; -- } -- -- cnt++; -- } --} -- --#if 0 --static void dvbc_sw_reset(int addr, int idx) --{ -- u32 tmp; -- -- tmp = apb_read_reg(QAM_BASE + addr); -- -- tmp &= ~(1 << idx); -- apb_write_reg(QAM_BASE + addr, tmp); -- -- udelay(1); -- -- tmp |= (1 << idx); -- apb_write_reg(QAM_BASE + addr, tmp); --} -- --static void dvbc_reset(void) --{ -- dvbc_sw_reset(0x04, 0); --} -- --static void dvbc_eq_reset(void) --{ -- dvbc_sw_reset(0x50, 3); --} -- --static void dvbc_eq_smma_reset(void) --{ -- dvbc_sw_reset(0xe8, 0); --} --#endif --static void dvbc_reg_initial(struct aml_demod_sta *demod_sta) --{ -- u32 clk_freq; -- u32 adc_freq; -- u8 tuner; -- u8 ch_mode; -- u8 agc_mode; -- u32 ch_freq; -- u16 ch_if; -- u16 ch_bw; -- u16 symb_rate; -- u32 phs_cfg; -- int afifo_ctr; -- int max_frq_off, tmp; -- -- clk_freq = demod_sta->clk_freq; /* kHz */ -- adc_freq = demod_sta->adc_freq; /* kHz */ --/* adc_freq = 25414;*/ -- tuner = demod_sta->tuner; -- ch_mode = demod_sta->ch_mode; -- agc_mode = demod_sta->agc_mode; -- ch_freq = demod_sta->ch_freq; /* kHz */ -- ch_if = demod_sta->ch_if; /* kHz */ -- ch_bw = demod_sta->ch_bw; /* kHz */ -- symb_rate = demod_sta->symb_rate; /* k/sec */ -- dprintk("ch_if is %d, %d, %d, %d, %d\n", -- ch_if, ch_mode, ch_freq, ch_bw, symb_rate); --/* ch_mode=4;*/ --/* apb_write_reg(DEMOD_CFG_BASE,0x00000007);*/ -- /* disable irq */ -- apb_write_reg(QAM_BASE + 0xd0, 0); -- -- /* reset */ -- /*dvbc_reset(); */ -- apb_write_reg(QAM_BASE + 0x4, apb_read_reg(QAM_BASE + 0x4) & ~(1 << 4)); -- /* disable fsm_en */ -- apb_write_reg(QAM_BASE + 0x4, apb_read_reg(QAM_BASE + 0x4) & ~(1 << 0)); -- /* Sw disable demod */ -- apb_write_reg(QAM_BASE + 0x4, apb_read_reg(QAM_BASE + 0x4) | (1 << 0)); -- /* Sw enable demod */ -- -- apb_write_reg(QAM_BASE + 0x000, 0x00000000); -- /* QAM_STATUS */ -- apb_write_reg(QAM_BASE + 0x004, 0x00000f00); -- /* QAM_GCTL0 */ -- apb_write_reg(QAM_BASE + 0x008, (ch_mode & 7)); -- /* qam mode */ -- -- switch (ch_mode) { -- case 0: /* 16 QAM */ -- apb_write_reg(QAM_BASE + 0x054, 0x23460224); -- /* EQ_FIR_CTL, */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- apb_write_reg(QAM_BASE + 0x074, 0x50001a0); -- /* EQ_TH_LMS 40db 13db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x003001e9); -- /* EQ_NORM and EQ_TH_MMA */ -- /*apb_write_reg(QAM_BASE+0x080, 0x000be1ff); -- * // EQ_TH_SMMA0*/ -- apb_write_reg(QAM_BASE + 0x080, 0x000e01fe); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x00000000); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2b); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292b); -- * // Pilips Tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292d); -- * // Pilips Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092d); -- /* Pilips Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213 */ -- break; -- -- case 1: /* 32 QAM */ -- apb_write_reg(QAM_BASE + 0x054, 0x24560506); -- /* EQ_FIR_CTL, */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x5000260); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x50001f0); -- /* EQ_TH_LMS 40db 17.5db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x00500102); -- /* EQ_TH_MMA 0x000001cc */ -- apb_write_reg(QAM_BASE + 0x080, 0x00077140); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x001fb000); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2b); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292b); -- * // Pilips Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092b); -- /* Pilips Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213 */ -- break; -- -- case 2: /* 64 QAM */ -- /*apb_write_reg(QAM_BASE+0x054, 0x2256033a); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0x2336043a); -- /* EQ_FIR_CTL, by raymond */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x5000260); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000230); -- /* EQ_TH_LMS 40db 17.5db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x007001bd); -- /* EQ_TH_MMA */ -- apb_write_reg(QAM_BASE + 0x080, 0x000580ed); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x001771fb); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f802b3d); -- /* Pilips Tuner & maxlinear Tuner */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f802b3a); -- * // Pilips Tuner & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213 */ -- break; -- -- case 3: /* 128 QAM */ -- /*apb_write_reg(QAM_BASE+0x054, 0x2557046a); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0x2437067a); -- /* EQ_FIR_CTL, by raymond 20121213 */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000d0); -- /* EQ_CRTH_SNR */ -- /* apb_write_reg(QAM_BASE+0x074, 0x02440240); -- * // EQ_TH_LMS 18.5db 18db*/ -- /* apb_write_reg(QAM_BASE+0x074, 0x04000400); -- * // EQ_TH_LMS 22db 22.5db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000260); -- /* EQ_TH_LMS 40db 19db */ -- /*apb_write_reg(QAM_BASE+0x07c, 0x00b000f2); -- * // EQ_TH_MMA0x000000b2*/ -- apb_write_reg(QAM_BASE + 0x07c, 0x00b00132); -- /* EQ_TH_MMA0x000000b2 by raymond 20121213 */ -- apb_write_reg(QAM_BASE + 0x080, 0x0003a09d); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x000f8150); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x001a51f8); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092c); -- /* Pilips Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213 */ -- break; -- -- case 4: /* 256 QAM */ -- /*apb_write_reg(QAM_BASE+0x054, 0xa2580588); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0xa25905f9); -- /* EQ_FIR_CTL, by raymond 20121213 */ -- apb_write_reg(QAM_BASE + 0x068, 0x01e00220); -- /* EQ_CRTH_SNR */ -- /*apb_write_reg(QAM_BASE+0x074, 0x50002a0); -- * // EQ_TH_LMS 40db 19db*/ -- apb_write_reg(QAM_BASE + 0x074, 0x5000270); -- /* EQ_TH_LMS 40db 19db by raymond 201211213 */ -- apb_write_reg(QAM_BASE + 0x07c, 0x00f001a5); -- /* EQ_TH_MMA */ -- apb_write_reg(QAM_BASE + 0x080, 0x0002c077); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x000bc0fe); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x0013f17e); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x01bc01f9); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips Tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292d); -- * // Maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f80092d); -- /* Maxlinear Tuner */ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213, when adc=35M,sys=70M, -- * its better than 0x61f2f66*/ -- break; -- default: /*64qam */ -- /*apb_write_reg(QAM_BASE+0x054, 0x2256033a); -- * // EQ_FIR_CTL,*/ -- apb_write_reg(QAM_BASE + 0x054, 0x2336043a); -- /* EQ_FIR_CTL, by raymond */ -- apb_write_reg(QAM_BASE + 0x068, 0x00c000c0); -- /* EQ_CRTH_SNR */ -- /* EQ_TH_LMS 40db 19db */ -- apb_write_reg(QAM_BASE + 0x074, 0x5000230); -- /* EQ_TH_LMS 40db 17.5db */ -- apb_write_reg(QAM_BASE + 0x07c, 0x007001bd); -- /* EQ_TH_MMA */ -- apb_write_reg(QAM_BASE + 0x080, 0x000580ed); -- /* EQ_TH_SMMA0 */ -- apb_write_reg(QAM_BASE + 0x084, 0x001771fb); -- /* EQ_TH_SMMA1 */ -- apb_write_reg(QAM_BASE + 0x088, 0x00000000); -- /* EQ_TH_SMMA2 */ -- apb_write_reg(QAM_BASE + 0x08c, 0x00000000); -- /* EQ_TH_SMMA3 */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f800d2c); -- * // AGC_CTRL ALPS tuner*/ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292c); -- * // Pilips & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x094, 0x7f802b3d); -- /* Pilips Tuner & maxlinear Tuner */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f802b3a); -- * // Pilips Tuner & maxlinear Tuner*/ -- apb_write_reg(QAM_BASE + 0x0c0, 0x061f2f67); -- /* by raymond 20121213 */ -- break; -- } -- -- /*apb_write_reg(QAM_BASE+0x00c, 0xfffffffe); -- * // adc_cnt, symb_cnt*/ -- apb_write_reg(QAM_BASE + 0x00c, 0xffff8ffe); -- /* adc_cnt, symb_cnt by raymond 20121213 */ -- if (clk_freq == 0) -- afifo_ctr = 0; -- else -- afifo_ctr = (adc_freq * 256 / clk_freq) + 2; -- if (afifo_ctr > 255) -- afifo_ctr = 255; -- apb_write_reg(QAM_BASE + 0x010, (afifo_ctr << 16) | 8000); -- /* afifo, rs_cnt_cfg */ -- -- /*apb_write_reg(QAM_BASE+0x020, 0x21353e54); -- * // PHS_reset & TIM_CTRO_ACCURATE sw_tim_select=0*/ -- /*apb_write_reg(QAM_BASE+0x020, 0x21b53e54); -- * //modified by qiancheng*/ -- apb_write_reg(QAM_BASE + 0x020, 0x61b53e54); -- /*modified by qiancheng by raymond 20121208 0x63b53e54 for cci */ -- /* apb_write_reg(QAM_BASE+0x020, 0x6192bfe2); -- * //modifed by ligg 20130613 auto symb_rate scan*/ -- if (adc_freq == 0) -- phs_cfg = 0; -- else -- phs_cfg = (1 << 31) / adc_freq * ch_if / (1 << 8); -- /* 8*fo/fs*2^20 fo=36.125, fs = 28.57114, = 21d775 */ -- /* dprintk("phs_cfg = %x\n", phs_cfg); */ -- apb_write_reg(QAM_BASE + 0x024, 0x4c000000 | (phs_cfg & 0x7fffff)); -- /* PHS_OFFSET, IF offset, */ -- -- if (adc_freq == 0) { -- max_frq_off = 0; -- } else { -- max_frq_off = (1 << 29) / symb_rate; -- /* max_frq_off = (400KHz * 2^29) / -- (AD=28571 * symbol_rate=6875) */ -- tmp = 40000000 / adc_freq; -- max_frq_off = tmp * max_frq_off; -- } -- dprintk("max_frq_off is %x,\n", max_frq_off); -- apb_write_reg(QAM_BASE + 0x02c, max_frq_off & 0x3fffffff); -- /* max frequency offset, by raymond 20121208 */ -- -- /*apb_write_reg(QAM_BASE+0x030, 0x011bf400); -- * // TIM_CTL0 start speed is 0, when know symbol rate*/ -- apb_write_reg(QAM_BASE + 0x030, 0x245cf451); -- /*MODIFIED BY QIANCHENG */ --/* apb_write_reg(QAM_BASE+0x030, 0x245bf451); -- * //modified by ligg 20130613 --auto symb_rate scan*/ -- apb_write_reg(QAM_BASE + 0x034, -- ((adc_freq & 0xffff) << 16) | (symb_rate & 0xffff)); -- -- apb_write_reg(QAM_BASE + 0x038, 0x00400000); -- /* TIM_SWEEP_RANGE 16000 */ -- --/************* hw state machine config **********/ -- apb_write_reg(QAM_BASE + 0x040, 0x003c); --/* configure symbol rate step step 0*/ -- -- /* modified 0x44 0x48 */ -- apb_write_reg(QAM_BASE + 0x044, (symb_rate & 0xffff) * 256); -- /* blind search, configure max symbol_rate for 7218 fb=3.6M */ -- /*apb_write_reg(QAM_BASE+0x048, 3600*256); -- * // configure min symbol_rate fb = 6.95M*/ -- apb_write_reg(QAM_BASE + 0x048, 3400 * 256); -- /* configure min symbol_rate fb = 6.95M */ -- -- /*apb_write_reg(QAM_BASE+0x0c0, 0xffffff68); // threshold */ -- /*apb_write_reg(QAM_BASE+0x0c0, 0xffffff6f); // threshold */ -- /*apb_write_reg(QAM_BASE+0x0c0, 0xfffffd68); // threshold */ -- /*apb_write_reg(QAM_BASE+0x0c0, 0xffffff68); // threshold */ -- /*apb_write_reg(QAM_BASE+0x0c0, 0xffffff68); // threshold */ -- /*apb_write_reg(QAM_BASE+0x0c0, 0xffff2f67); -- * // threshold for skyworth*/ -- /* apb_write_reg(QAM_BASE+0x0c0, 0x061f2f67); // by raymond 20121208 */ -- /* apb_write_reg(QAM_BASE+0x0c0, 0x061f2f66); -- * // by raymond 20121213, remove it to every constellation*/ --/************* hw state machine config **********/ -- -- apb_write_reg(QAM_BASE + 0x04c, 0x00008800); /* reserved */ -- -- /*apb_write_reg(QAM_BASE+0x050, 0x00000002); // EQ_CTL0 */ -- apb_write_reg(QAM_BASE + 0x050, 0x01472002); -- /* EQ_CTL0 by raymond 20121208 */ -- -- /*apb_write_reg(QAM_BASE+0x058, 0xff550e1e); // EQ_FIR_INITPOS */ -- apb_write_reg(QAM_BASE + 0x058, 0xff100e1e); -- /* EQ_FIR_INITPOS for skyworth */ -- -- apb_write_reg(QAM_BASE + 0x05c, 0x019a0000); /* EQ_FIR_INITVAL0 */ -- apb_write_reg(QAM_BASE + 0x060, 0x019a0000); /* EQ_FIR_INITVAL1 */ -- -- /*apb_write_reg(QAM_BASE+0x064, 0x01101128); // EQ_CRTH_TIMES */ -- apb_write_reg(QAM_BASE + 0x064, 0x010a1128); -- /* EQ_CRTH_TIMES for skyworth */ -- apb_write_reg(QAM_BASE + 0x06c, 0x00041a05); /* EQ_CRTH_PPM */ -- -- apb_write_reg(QAM_BASE + 0x070, 0xffb9aa01); /* EQ_CRLP */ -- -- /*apb_write_reg(QAM_BASE+0x090, 0x00020bd5); // agc control */ -- apb_write_reg(QAM_BASE + 0x090, 0x00000bd5); /* agc control */ -- -- /* agc control */ -- /* apb_write_reg(QAM_BASE+0x094, 0x7f800d2c);// AGC_CTRL ALPS tuner */ -- /* apb_write_reg(QAM_BASE+0x094, 0x7f80292c); // Pilips Tuner */ -- if ((agc_mode & 1) == 0) -- /* freeze if agc */ -- apb_write_reg(QAM_BASE + 0x094, -- apb_read_reg(QAM_BASE + 0x94) | (0x1 << 10)); -- if ((agc_mode & 2) == 0) { -- /* IF control */ -- /*freeze rf agc */ -- apb_write_reg(QAM_BASE + 0x094, -- apb_read_reg(QAM_BASE + 0x94) | (0x1 << 13)); -- } -- /*Maxlinear Tuner */ -- /*apb_write_reg(QAM_BASE+0x094, 0x7f80292d); */ -- apb_write_reg(QAM_BASE + 0x098, 0x9fcc8190); -- /* AGC_IFGAIN_CTRL */ -- /*apb_write_reg(QAM_BASE+0x0a0, 0x0e028c00); -- * // AGC_RFGAIN_CTRL 0x0e020800*/ -- /*apb_write_reg(QAM_BASE+0x0a0, 0x0e03cc00); -- * // AGC_RFGAIN_CTRL 0x0e020800*/ -- /*apb_write_reg(QAM_BASE+0x0a0, 0x0e028700); -- * // AGC_RFGAIN_CTRL 0x0e020800 now*/ -- /*apb_write_reg(QAM_BASE+0x0a0, 0x0e03cd00); -- * // AGC_RFGAIN_CTRL 0x0e020800*/ -- /*apb_write_reg(QAM_BASE+0x0a0, 0x0603cd11); -- * // AGC_RFGAIN_CTRL 0x0e020800 by raymond, -- * if Adjcent channel test, maybe it need change.20121208 ad invert*/ -- apb_write_reg(QAM_BASE + 0x0a0, 0x0603cd10); -- /* AGC_RFGAIN_CTRL 0x0e020800 by raymond, -- * if Adjcent channel test, maybe it need change. -- * 20121208 ad invert,20130221, suit for two path channel.*/ -- -- apb_write_reg(QAM_BASE + 0x004, apb_read_reg(QAM_BASE + 0x004) | 0x33); -- /* IMQ, QAM Enable */ -- -- /* start hardware machine */ -- /*dvbc_sw_reset(0x004, 4); */ -- apb_write_reg(QAM_BASE + 0x4, apb_read_reg(QAM_BASE + 0x4) | (1 << 4)); -- apb_write_reg(QAM_BASE + 0x0e8, -- (apb_read_reg(QAM_BASE + 0x0e8) | (1 << 2))); -- -- /* clear irq status */ -- apb_read_reg(QAM_BASE + 0xd4); -- -- /* enable irq */ -- apb_write_reg(QAM_BASE + 0xd0, 0x7fff << 3); -- --/*auto track*/ -- /* dvbc_set_auto_symtrack(); */ --} -- --u32 dvbc_set_auto_symtrack(void) --{ -- apb_write_reg(QAM_BASE + 0x030, 0x245bf45c); /*open track */ -- apb_write_reg(QAM_BASE + 0x020, 0x61b2bf5c); -- apb_write_reg(QAM_BASE + 0x044, (7000 & 0xffff) * 256); -- apb_write_reg(QAM_BASE + 0x038, 0x00220000); -- apb_write_reg(QAM_BASE + 0x4, apb_read_reg(QAM_BASE + 0x4) & ~(1 << 0)); -- /* Sw disable demod */ -- apb_write_reg(QAM_BASE + 0x4, apb_read_reg(QAM_BASE + 0x4) | (1 << 0)); -- /* Sw enable demod */ -- return 0; --} -- --int dvbc_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dvbc *demod_dvbc) --{ -- int ret = 0; -- u16 symb_rate; -- u8 mode; -- u32 ch_freq; -- dprintk("f=%d, s=%d, q=%d\n", -- demod_dvbc->ch_freq, demod_dvbc->symb_rate, demod_dvbc->mode); -- demod_i2c->tuner = 7; -- mode = demod_dvbc->mode; -- symb_rate = demod_dvbc->symb_rate; -- ch_freq = demod_dvbc->ch_freq; -- if (mode > 4) { -- dprintk("Error: Invalid QAM mode option %d\n", mode); -- mode = 2; -- ret = -1; -- } -- -- if (symb_rate < 1000 || symb_rate > 7000) { -- dprintk("Error: Invalid Symbol Rate option %d\n", symb_rate); -- symb_rate = 6875; -- ret = -1; -- } -- -- if (ch_freq < 1000 || ch_freq > 900000) { -- dprintk("Error: Invalid Channel Freq option %d\n", ch_freq); -- ch_freq = 474000; -- ret = -1; -- } -- /* if (ret != 0) return ret; */ -- demod_sta->dvb_mode = 0; -- demod_sta->ch_mode = mode; -- /* 0:16, 1:32, 2:64, 3:128, 4:256 */ -- demod_sta->agc_mode = 1; -- /* 0:NULL, 1:IF, 2:RF, 3:both */ -- demod_sta->ch_freq = ch_freq; -- demod_sta->tuner = demod_i2c->tuner; -- -- if (demod_i2c->tuner == 1) -- demod_sta->ch_if = 36130; /* TODO DCT tuner */ -- else if (demod_i2c->tuner == 2) -- demod_sta->ch_if = 4570; /* TODO Maxlinear tuner */ -- else if (demod_i2c->tuner == 7) -- /* demod_sta->ch_if = 5000; // TODO Si2176 tuner */ -- -- demod_sta->ch_bw = 8000; /* TODO */ -- if (demod_sta->ch_if == 0) -- demod_sta->ch_if = 5000; -- demod_sta->symb_rate = symb_rate; -- dvbc_reg_initial(demod_sta); -- -- return ret; --} -- --int dvbc_status(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_sts *demod_sts) --{ -- struct aml_fe_dev *dev; -- --/* int ftmp, tmp; */ -- dev = NULL; -- demod_sts->ch_sts = apb_read_reg(QAM_BASE + 0x18); -- demod_sts->ch_pow = dvbc_get_ch_power(); -- demod_sts->ch_snr = dvbc_get_snr(); -- demod_sts->ch_ber = dvbc_get_ber(); -- demod_sts->ch_per = dvbc_get_per(); -- demod_sts->symb_rate = dvbc_get_symb_rate(); -- demod_sts->freq_off = dvbc_get_freq_off(); -- /*demod_sts->dat0 = apb_read_reg(QAM_BASE+0x28); */ --/* demod_sts->dat0 = tuner_get_ch_power(demod_i2c);*/ -- demod_sts->dat1 = tuner_get_ch_power(dev); --#if 0 -- -- ftmp = demod_sts->ch_sts; -- dprintk("[dvbc debug] ch_sts is %x\n", ftmp); -- ftmp = demod_sts->ch_snr; -- ftmp /= 100; -- dprintk("snr %d dB ", ftmp); -- ftmp = demod_sts->ch_ber; -- dprintk("ber %.d ", ftmp); -- tmp = demod_sts->ch_per; -- dprintk("per %d ", tmp); -- ftmp = demod_sts->symb_rate; -- dprintk("srate %.d ", ftmp); -- ftmp = demod_sts->freq_off; -- dprintk("freqoff %.d kHz ", ftmp); -- tmp = demod_sts->dat1; -- dprintk("strength %ddb 0xe0 status is %lu ,b4 status is %lu", tmp, -- (apb_read_reg(QAM_BASE + 0xe0) & 0xffff), -- (apb_read_reg(QAM_BASE + 0xb4) & 0xffff)); -- dprintk("dagc_gain is %lu ", apb_read_reg(QAM_BASE + 0xa4) & 0x7f); -- tmp = demod_sts->ch_pow; -- dprintk("power is %ddb\n", (tmp & 0xffff)); -- --#endif -- -- return 0; --} -- --void dvbc_enable_irq(int dvbc_irq) --{ -- u32 mask; -- -- /* clear status */ -- apb_read_reg(QAM_BASE + 0xd4); -- /* enable irq */ -- mask = apb_read_reg(QAM_BASE + 0xd0); -- mask |= (1 << dvbc_irq); -- apb_write_reg(QAM_BASE + 0xd0, mask); --} -- --void dvbc_disable_irq(int dvbc_irq) --{ -- u32 mask; -- -- /* disable irq */ -- mask = apb_read_reg(QAM_BASE + 0xd0); -- mask &= ~(1 << dvbc_irq); -- apb_write_reg(QAM_BASE + 0xd0, mask); -- /* clear status */ -- apb_read_reg(QAM_BASE + 0xd4); --} -- --char *dvbc_irq_name[] = { -- " ADC", -- " Symbol", -- " RS", -- " In_Sync0", -- " In_Sync1", -- " In_Sync2", -- " In_Sync3", -- " In_Sync4", -- "Out_Sync0", -- "Out_Sync1", -- "Out_Sync2", -- "Out_Sync3", -- "Out_Sync4", -- "In_SyncCo", -- "OutSyncCo", -- " In_Dagc", -- " Out_Dagc", -- " Eq_Mode", -- "RS_Uncorr" --}; -- --void dvbc_isr(struct aml_demod_sta *demod_sta) --{ -- u32 stat, mask; -- int dvbc_irq; -- -- stat = apb_read_reg(QAM_BASE + 0xd4); -- mask = apb_read_reg(QAM_BASE + 0xd0); -- stat &= mask; -- -- for (dvbc_irq = 0; dvbc_irq < 20; dvbc_irq++) { -- if (stat >> dvbc_irq & 1) { -- if (demod_sta->debug) -- dprintk("irq: dvbc %2d %s %8x\n", -- dvbc_irq, dvbc_irq_name[dvbc_irq], -- stat); -- /* dvbc_disable_irq(dvbc_irq); */ -- } -- } --} -- --int dvbc_isr_islock(void) --{ --#define IN_SYNC4_MASK (0x80) -- -- u32 stat, mask; -- -- stat = apb_read_reg(QAM_BASE + 0xd4); -- apb_write_reg(QAM_BASE + 0xd4, 0); -- mask = apb_read_reg(QAM_BASE + 0xd0); -- stat &= mask; -- -- return (stat & IN_SYNC4_MASK) == IN_SYNC4_MASK; --} -diff --git a/drivers/amlogic/dvb_tv/amldemod/dvbt_func.c b/drivers/amlogic/dvb_tv/amldemod/dvbt_func.c -deleted file mode 100644 -index b407520..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/dvbt_func.c -+++ /dev/null -@@ -1,2160 +0,0 @@ --#include --#include --#include --#include --#include "demod_func.h" -- --static int debug_amldvbt; -- --module_param(debug_amldvbt, int, 0644); --MODULE_PARM_DESC(debug_amldvbt, "turn on debugging (default: 0)"); --#define dprintk(args ...) do { if (debug_amldvbt) printk(args); } while (0) -- --static int tuner_type = 3; -- --static void set_ACF_coef(int ADsample, int bandwidth) --{ -- if (ADsample == 45) { -- /* Set ACF and IIREQ */ -- if (bandwidth == 0) { -- /*8M Hz */ -- apb_write_reg(2, 0x2c, 0x255); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x0B5); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x091); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x02E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x253); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x0CB); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x2CD); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x07C); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x250); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0E4); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x276); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05D); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x24D); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0F3); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x25E); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x24A); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0FD); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x256); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003effff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003cefbe); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003adf7c); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x0038bf39); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x003696f5); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x003466b0); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00322e69); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x002fee21); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x002dadd9); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002b6d91); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x00291d48); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x0026ccfe); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x00245cb2); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0021d463); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x001f2410); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x001c3bb6); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x00192b57); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x0015e2f1); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x00127285); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x000eca14); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x000ac99b); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x00063913); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x0000c073); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x003a3fb4); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00347ecf); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x002ff649); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x002a8dab); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x002444f0); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x001d0c1b); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x000fc300); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x000118ce); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x003c17c3); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x00000751); -- } else if (bandwidth == 1) { -- /* 7Mhz */ -- apb_write_reg(2, 0x2c, 0x24B); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x0BD); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x04B); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x03E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x246); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x0D1); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x2A2); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x07C); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x241); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0E7); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x25B); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05D); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x23D); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0F5); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x248); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x23A); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0FD); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x242); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f07ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003cffbf); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003aef7e); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x0038d73c); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x0036b6f9); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x003486b3); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00324e6d); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x00300e25); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x002dcddd); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002b8594); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x00292d4b); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x0026d500); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x00245cb3); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0021cc62); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x001f0c0d); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x001c1bb3); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x0018fb52); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x0015b2eb); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x00123a7f); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x000e9a0e); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x000a9995); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0006090d); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x0000a06e); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x003a57b3); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x0034ded8); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x00309659); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x002b75c4); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x0025350e); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x001dec37); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x00126b28); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x00031130); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x003cffec); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x00000767); -- } else if (bandwidth == 2) { -- /* 6MHz */ -- apb_write_reg(2, 0x2c, 0x240); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x0C6); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x3F9); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x03E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x23A); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x0D7); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x27B); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x07C); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x233); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0EA); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x244); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05D); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x22F); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0F6); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x235); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x22B); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0FD); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x231); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f07ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003cffbf); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003aef7e); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x0038d73c); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x0036b6f8); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x003486b3); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x0032466c); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x002ffe24); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x002dadda); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002b5d90); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x0028fd45); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002694f9); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x002414ab); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x00217458); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x001ea402); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x001ba3a5); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x00187342); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x00151ad9); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x0011926b); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x000dc9f6); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x0009a178); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0004d8eb); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x003f4045); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x0038e785); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00337eab); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x002f3e2d); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x002a1599); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x0023ace1); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x001b33fb); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x000cd29c); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x0001c0c1); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x003cefde); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x0000076a); -- } else { -- /* 5MHz */ -- apb_write_reg(2, 0x2c, 0x236); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x0CE); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x39A); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x03E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x22F); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x0DE); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x257); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x07C); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x227); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0EE); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x230); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05D); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x222); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0F8); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x225); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x21E); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0FE); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x222); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003effff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003ce7bd); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003ac77a); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x0038a737); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x00367ef2); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x00344eac); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00321e66); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x002fee20); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x002dbdda); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002b8d94); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x00295d4e); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x00272508); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0024dcc0); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x00227475); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x001fe426); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x001d1bd1); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x001a2374); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x0016e311); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x00136aa6); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x000fba33); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x000ba9b8); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0007092e); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x0001988e); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x003b37d0); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x0035aef3); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x00316673); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x002c45de); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x0025e527); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x001da444); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x000deaea); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x000178bf); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x003cb7d6); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x00000765); -- } -- } else if (ADsample == 28) { -- /* 28.5714 MHz Set ACF */ -- if (bandwidth == 0) { -- /*8M Hz */ -- apb_write_reg(2, 0x2c, 0x2DB); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x05B); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x163); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x00E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x2D5); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x08B); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x3BC); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x06D); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x2CF); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0BF); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x321); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x008); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x2C9); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0E3); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x2EE); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x058); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x2C3); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0F8); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x2DD); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04D); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003ef7ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d37c0); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003c3f94); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003b0f78); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x0038c73f); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x00369ef1); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x003576be); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x0033b698); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x0031164d); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002f1dfd); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002de5cf); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002c15a2); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0029f560); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0027bd1b); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x00252ccf); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x0022bc7c); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x00207c34); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001da3e5); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001a9b83); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x0017db27); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x001432c6); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x000fa23e); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000b91af); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x00077136); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x0002c090); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003ec01a); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003a3f92); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x00354efa); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x002fee54); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x002a35a3); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x0023f4e4); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x001cdc12); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x00000316); -- } else if (bandwidth == 1) { -- apb_write_reg(2, 0x2c, 0x2C2); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x069); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x134); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x00E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x2B7); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x095); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x36F); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x06D); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x2AA); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0C6); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x2E5); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x008); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x2A1); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0E6); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x2BA); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x058); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x299); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0F9); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x2AC); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04D); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003ee7ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d1fbc); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003bf790); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003a876a); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x00388f31); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x0036c6f3); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x003536bf); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x00334689); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x00310644); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002ef5fd); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002d45c2); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002b7d8c); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x00298550); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x00278510); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x00252ccc); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x0022847c); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x00201427); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001e03e0); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001b6b9b); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x0017c336); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x0013e2b8); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0010b246); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000d81e8); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x00084966); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x0003089c); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003f0022); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003aaf9c); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x00360f0c); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x00312e74); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x002c05d3); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x00268d2a); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x0020bc76); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x000003b3); -- } else if (bandwidth == 2) { -- /* 6MHz */ -- apb_write_reg(2, 0x2c, 0x2A9); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x078); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x0F4); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x01E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x299); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x0A1); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x321); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x078); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x288); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0CD); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x2AE); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05F); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x27C); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0E9); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x28B); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x058); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x273); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0FA); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x281); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04D); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f17ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d3fc4); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003b7f8a); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x0039df55); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x00381720); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x00360ee2); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00342ea1); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x0032ee6e); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x0031e64e); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x00300e22); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002daddc); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002b758f); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0029ad51); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0027ad18); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x00250ccd); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x00227476); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x00204c2a); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001de3e6); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001a838a); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x0016ab12); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x00137a9d); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x00113a4a); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000db1f8); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x0007c15f); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00022883); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003df803); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x00398f79); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x0034d6e6); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x002fd64b); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x002a8da7); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x002504fa); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x001f2443); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x00000382); -- } else { -- apb_write_reg(2, 0x2c, 0x28F); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x088); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x09E); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x01E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x27C); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x0AD); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x2D6); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x078); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x268); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0D4); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x27C); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05F); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x25B); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0ED); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x262); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x058); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x252); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0FB); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x25A); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04D); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f17ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d4fc5); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003baf8e); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003a3f5d); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x0038df32); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x00374703); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00354ec9); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x00333e88); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x00314e47); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002f860c); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002d9dd2); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002b5590); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0028cd42); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x00266cf2); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x00245cab); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x00225c6b); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x00200427); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001d4bd5); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001a9b7d); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x00183b2b); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x0015b2e1); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x00122a83); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000d49fc); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x0007594e); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00024080); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003e980e); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003ab796); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x00368f15); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x00320e8a); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x002d25f4); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x0027ad4f); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x00219496); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x000003c9); -- } -- } else { -- /* 20.7 MHz Set ACF */ -- if (bandwidth == 0) { -- /*8M Hz */ -- apb_write_reg(2, 0x2c, 0x318); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x03E); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x1AE); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x00E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x326); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x074); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x074); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x06F); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x336); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0B1); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x3C9); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x008); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x33F); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0DC); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x384); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x340); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0F6); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x36D); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f37ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d97cc); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003bf798); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003a4f64); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x0038a72f); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x0036f6f9); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x003546c3); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x0033868c); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x0031be54); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002fe61a); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002e05df); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002c15a2); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x002a1562); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0027f520); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x0025c4dc); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x00236c93); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x0020f446); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001e4bf4); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001b739d); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x00185b3d); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x0014ead5); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x00111a62); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000cb9df); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x00079148); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00030093); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003f802a); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003b77b2); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x0036a725); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x0030ae7b); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x00285d9f); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x001abc46); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x000f8a85); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x00000187); -- } else if (bandwidth == 1) { -- apb_write_reg(2, 0x2c, 0x2F9); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x04C); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x18E); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x00E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x2FD); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x07F); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x01A); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x06D); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x300); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0B8); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x372); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05F); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x301); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0DF); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x335); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x2FE); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0F7); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x320); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f37ff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d8fcc); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003bef97); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003a4762); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x0038972d); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x0036e6f7); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00352ec1); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x00336e89); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x00319e50); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002fce16); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002de5db); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002bf59d); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0029ed5e); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0027d51c); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x00259cd7); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x0023448e); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x0020cc41); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001e23ef); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001b4b98); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x00183339); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x0014cad1); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0010fa5e); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000c99dc); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x00078145); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x0002f892); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003f802a); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003b8fb3); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x0036d729); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x00310682); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x00290dae); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x001c0c67); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x0010a2ad); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x000001a8); -- } else if (bandwidth == 2) { -- /* 6MHz */ -- apb_write_reg(2, 0x2c, 0x2D9); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x05C); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x161); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x00E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x2D4); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x08B); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x3B8); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x06B); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x2CD); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0C0); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x31E); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05F); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x2C7); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0E3); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x2EB); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x2C1); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0F8); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x2DA); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f2fff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d87cb); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003bdf96); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003a2f60); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x00387f2a); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x0036c6f4); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x00350ebd); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x00334684); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x0031764b); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002f9e11); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002db5d4); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002bbd97); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0029b557); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x00279515); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x00255ccf); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x00230c87); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x0020943a); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001debe8); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001b1b91); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x00180b33); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x0014aacc); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0010e25a); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000c91da); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x00078945); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00031895); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003fa82e); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003bbfb8); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x00371730); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x0031668c); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x00299dbc); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x001d1480); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x00119acf); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x000001c4); -- } else { -- apb_write_reg(2, 0x2c, 0x2B9); /* ACF_STAGE1_A1 */ -- apb_write_reg(2, 0x2d, 0x06E); /* ACF_STAGE1_A2 */ -- apb_write_reg(2, 0x2e, 0x11E); /* ACF_STAGE1_B1 */ -- apb_write_reg(2, 0x2f, 0x01E); /* ACF_STAGE1_GAIN */ -- apb_write_reg(2, 0x30, 0x2AB); /* ACF_STAGE2_A1 */ -- apb_write_reg(2, 0x31, 0x099); /* ACF_STAGE2_A2 */ -- apb_write_reg(2, 0x32, 0x351); /* ACF_STAGE2_B1 */ -- apb_write_reg(2, 0x33, 0x06B); /* ACF_STAGE2_GAIN */ -- apb_write_reg(2, 0x34, 0x29D); /* ACF_STAGE3_A1 */ -- apb_write_reg(2, 0x35, 0x0C8); /* ACF_STAGE3_A2 */ -- apb_write_reg(2, 0x36, 0x2D0); /* ACF_STAGE3_B1 */ -- apb_write_reg(2, 0x37, 0x05F); /* ACF_STAGE3_GAIN */ -- apb_write_reg(2, 0x38, 0x292); /* ACF_STAGE4_A1 */ -- apb_write_reg(2, 0x39, 0x0E7); /* ACF_STAGE4_A2 */ -- apb_write_reg(2, 0x3a, 0x2A8); /* ACF_STAGE4_B1 */ -- apb_write_reg(2, 0x3b, 0x05A); /* ACF_STAGE4_GAIN */ -- apb_write_reg(2, 0x3c, 0x28A); /* ACF_STAGE5_A1 */ -- apb_write_reg(2, 0x3d, 0x0F9); /* ACF_STAGE5_A2 */ -- apb_write_reg(2, 0x3e, 0x29B); /* ACF_STAGE5_B1 */ -- apb_write_reg(2, 0x3f, 0x04B); /* ACF_STAGE5_GAIN */ -- -- apb_write_reg(2, 0xfe, 0x000); -- apb_write_reg(2, 0xff, 0x003f2fff); -- apb_write_reg(2, 0xfe, 0x001); -- apb_write_reg(2, 0xff, 0x003d7fca); -- apb_write_reg(2, 0xfe, 0x002); -- apb_write_reg(2, 0xff, 0x003bcf94); -- apb_write_reg(2, 0xfe, 0x003); -- apb_write_reg(2, 0xff, 0x003a1f5e); -- apb_write_reg(2, 0xfe, 0x004); -- apb_write_reg(2, 0xff, 0x00386727); -- apb_write_reg(2, 0xfe, 0x005); -- apb_write_reg(2, 0xff, 0x0036a6f0); -- apb_write_reg(2, 0xfe, 0x006); -- apb_write_reg(2, 0xff, 0x0034e6b8); -- apb_write_reg(2, 0xfe, 0x007); -- apb_write_reg(2, 0xff, 0x0033167f); -- apb_write_reg(2, 0xfe, 0x008); -- apb_write_reg(2, 0xff, 0x00314645); -- apb_write_reg(2, 0xfe, 0x009); -- apb_write_reg(2, 0xff, 0x002f660a); -- apb_write_reg(2, 0xfe, 0x00a); -- apb_write_reg(2, 0xff, 0x002d75cd); -- apb_write_reg(2, 0xfe, 0x00b); -- apb_write_reg(2, 0xff, 0x002b758e); -- apb_write_reg(2, 0xfe, 0x00c); -- apb_write_reg(2, 0xff, 0x0029654e); -- apb_write_reg(2, 0xfe, 0x00d); -- apb_write_reg(2, 0xff, 0x0027450a); -- apb_write_reg(2, 0xfe, 0x00e); -- apb_write_reg(2, 0xff, 0x002504c4); -- apb_write_reg(2, 0xfe, 0x00f); -- apb_write_reg(2, 0xff, 0x0022a47b); -- apb_write_reg(2, 0xfe, 0x010); -- apb_write_reg(2, 0xff, 0x0020242d); -- apb_write_reg(2, 0xfe, 0x011); -- apb_write_reg(2, 0xff, 0x001d7bdb); -- apb_write_reg(2, 0xfe, 0x012); -- apb_write_reg(2, 0xff, 0x001aa383); -- apb_write_reg(2, 0xfe, 0x013); -- apb_write_reg(2, 0xff, 0x00178b24); -- apb_write_reg(2, 0xfe, 0x014); -- apb_write_reg(2, 0xff, 0x00142abd); -- apb_write_reg(2, 0xfe, 0x015); -- apb_write_reg(2, 0xff, 0x0010624a); -- apb_write_reg(2, 0xfe, 0x016); -- apb_write_reg(2, 0xff, 0x000c11ca); -- apb_write_reg(2, 0xfe, 0x017); -- apb_write_reg(2, 0xff, 0x00070935); -- apb_write_reg(2, 0xfe, 0x018); -- apb_write_reg(2, 0xff, 0x00029885); -- apb_write_reg(2, 0xfe, 0x019); -- apb_write_reg(2, 0xff, 0x003f281e); -- apb_write_reg(2, 0xfe, 0x01a); -- apb_write_reg(2, 0xff, 0x003b3fa9); -- apb_write_reg(2, 0xfe, 0x01b); -- apb_write_reg(2, 0xff, 0x00369720); -- apb_write_reg(2, 0xfe, 0x01c); -- apb_write_reg(2, 0xff, 0x0030ce7b); -- apb_write_reg(2, 0xfe, 0x01d); -- apb_write_reg(2, 0xff, 0x0028dda7); -- apb_write_reg(2, 0xfe, 0x01e); -- apb_write_reg(2, 0xff, 0x001c6464); -- apb_write_reg(2, 0xfe, 0x01f); -- apb_write_reg(2, 0xff, 0x0011b2c7); -- apb_write_reg(2, 0xfe, 0x020); -- apb_write_reg(2, 0xff, 0x000001cb); -- } -- } --} -- --static void dvbt_reg_initial(struct aml_demod_sta *demod_sta) --{ -- u32 clk_freq; -- u32 adc_freq; -- u8 ch_mode; -- u8 agc_mode; -- u32 ch_freq; -- u16 ch_if; -- u16 ch_bw; -- u16 symb_rate; -- -- u8 bw; -- u8 sr; -- u8 ifreq; -- u32 tmp; -- -- clk_freq = demod_sta->clk_freq; /* kHz */ -- adc_freq = demod_sta->adc_freq; /* kHz */ -- ch_mode = demod_sta->ch_mode; -- agc_mode = demod_sta->agc_mode; -- ch_freq = demod_sta->ch_freq; /* kHz */ -- ch_if = demod_sta->ch_if; /* kHz */ -- ch_bw = demod_sta->ch_bw; /* kHz */ -- symb_rate = demod_sta->symb_rate; /* k/sec */ -- -- bw = 8 - ch_bw / 1000; -- sr = adc_freq > 40000 ? 3 : adc_freq > 24000 ? 2 : -- adc_freq > 20770 ? 1 : 0; -- ifreq = ch_if > 35000 ? 0 : 1; -- -- /*//////////////////////////////////// */ -- /* bw == 0 : 8M */ -- /* 1 : 7M */ -- /* 2 : 6M */ -- /* 3 : 5M */ -- /* sr == 0 : 20.7M */ -- /* 1 : 20.8333M */ -- /* 2 : 28.5714M */ -- /* 3 : 45M */ -- /* ifreq == 0: 36.13MHz */ -- /* 1: 4.57MHz */ -- /* agc_mode == 0: single AGC */ -- /* 1: dual AGC */ -- /*//////////////////////////////////// */ -- apb_write_reg(2, 0x02, 0x00800000); -- /* SW reset bit[23] ; write anything to zero */ -- apb_write_reg(2, 0x00, 0x00000000); -- -- switch (sr) { -- case 0: -- apb_write_reg(2, 0x08, 0x00002966); -- break; -- case 1: -- apb_write_reg(2, 0x08, 0x00002999); -- break; -- case 2: -- apb_write_reg(2, 0x08, 0x00003924); -- break; -- case 3: -- apb_write_reg(2, 0x08, 0x00005a00); -- break; /*sample_rate /*45M */ -- default: -- break; -- } -- -- apb_write_reg(2, 0x0d, 0x00000000); -- apb_write_reg(2, 0x0e, 0x00000000); -- dvbt_enable_irq(8); -- -- apb_write_reg(2, 0x11, 0x00100002); /* FSM [15:0] TIMER_FEC_LOST */ -- apb_write_reg(2, 0x12, 0x02100201); /* FSM */ -- apb_write_reg(2, 0x14, 0xe81c4ff6); /* AGC_TARGET 0xf0121385 */ -- apb_write_reg(2, 0x15, 0x02050ca6); /* AGC_CTRL */ -- -- switch (sr) { -- case 0: -- apb_write_reg(2, 0x15, apb_read_reg(2, 0x15) | (0x5b << 12)); -- break; -- case 1: -- apb_write_reg(2, 0x15, apb_read_reg(2, 0x15) | (0x5b << 12)); -- break; -- case 2: -- apb_write_reg(2, 0x15, apb_read_reg(2, 0x15) | (0x7b << 12)); -- break; -- case 3: -- apb_write_reg(2, 0x15, apb_read_reg(2, 0x15) | (0xc2 << 12)); -- break; /* sample_rate /*45M */ -- default: -- break; -- } -- -- if (agc_mode == 0) -- apb_write_reg(2, 0x16, 0x67f80); /* AGC_IFGAIN_CTRL */ -- else if (agc_mode == 1) -- apb_write_reg(2, 0x16, 0x07f80); /* AGC_IFGAIN_CTRL */ -- -- apb_write_reg(2, 0x17, 0x07f80); /* AGC_RFGAIN_CTRL */ -- apb_write_reg(2, 0x18, 0x00000000); /* AGC_IFGAIN_ACCUM */ -- apb_write_reg(2, 0x19, 0x00000000); /* AGC_RFGAIN_ACCUM */ -- -- if (ifreq == 0) { -- switch (sr) { -- case 0: -- apb_write_reg(2, 0x20, 0x00002096); -- break; -- /* DDC NORM_PHASE 36.13M IF For 20.7M sample rate */ -- case 1: -- apb_write_reg(2, 0x20, 0x000021a9); -- break; -- /* DDC NORM_PHASE 36.13M IF For 20.8333M sample rate*/ -- case 2: -- apb_write_reg(2, 0x20, 0x000021dc); -- break; -- /* DDC NORM_PHASE 36.13M IF For 28.57142M sample rate*/ -- case 3: -- apb_write_reg(2, 0x20, 0x000066e2); -- break; -- /* DDC NORM_PHASE 36.13M IF For 45M sample rate */ -- default: -- break; -- } -- } else if (ifreq == 1) { -- switch (sr) { -- case 0: -- apb_write_reg(2, 0x20, 0x00001c42); -- break; -- /* DDC NORM_PHASE 4.57M IF For 20.7M sample rate */ -- case 1: -- apb_write_reg(2, 0x20, 0x00001c1f); -- break; -- /* DDC NORM_PHASE 4.57M IF For 20.8333M sample rate */ -- case 2: -- apb_write_reg(2, 0x20, 0x00001479); -- break; -- /* DDC NORM_PHASE 4.57M IF For 28.57142M sample rate*/ -- case 3: -- apb_write_reg(2, 0x20, 0x0000d00); -- break; -- /* DDC NORM_PHASE 4.57M IF For 45M sample rate */ -- default: -- break; -- } -- } -- */tmp = ch_if * (1 << 15)/adc_freq; -- tmp &= 0x3fff; -- apb_write_reg(2, 0x20, tmp); -- if (demod_sta->debug) -- dprintk("IF: %d kHz ADC: %d kHz DDC: %04x\n", ch_if, adc_freq, -- tmp); -- -- apb_write_reg(2, 0x21, 0x001ff000); /* DDC CS_FCFO_ADJ_CTRL */ -- apb_write_reg(2, 0x22, 0x00000000); /* DDC ICFO_ADJ_CTRL */ -- apb_write_reg(2, 0x23, 0x00004000); /* DDC TRACK_FCFO_ADJ_CTRL */ -- apb_write_reg(2, 0x27, 0x00a98200); -- /*[23] agc state mode [22:19] icfo_time_limit ;[18:15] tps_time_limit ; -- * [14:4] cs_cfo_thres ; [3:0] fsm_state_d; */ -- /* 1 010,1 001,1 -- * 000,0010,0000, xxxx */ -- apb_write_reg(2, 0x28, 0x04028032); -- /* [31:24] cs_Q_thres; [23:13] sfo_thres; FSM [12:0] fcfo_thres;; */ -- /* 0000,0100, 0000,0010,100 0,0000,0011,0010 */ -- apb_write_reg(2, 0x29, 0x0051117F); -- /*apb_write_reg(2, 0x29, 0x00010f7F); */ -- /* [18:16] fec_rs_sh_ctrl ;[15:9] fsm_total_timer; -- * [8:6] modeDet_time_limit; FSM [5:0] sfo_time_limit; ; */ -- /* 01, () 0000,111 1,01 11,1111 */ -- -- /* SRC NORM_INRATE */ -- switch (bw) { -- case 0: -- tmp = (1 << 14) * adc_freq / 125 / 8 * 7; -- break; -- case 1: -- tmp = (1 << 14) * adc_freq / 125; -- break; -- case 2: -- tmp = (1 << 14) * adc_freq / 125 / 6 * 7; -- break; -- case 3: -- tmp = (1 << 14) * adc_freq / 125 / 5 * 7; -- break; -- default: -- tmp = (1 << 14) * adc_freq / 125 / 8 * 7; -- break; -- } -- -- apb_write_reg(2, 0x44, tmp & 0x7fffff); -- -- apb_write_reg(2, 0x45, 0x00000000); /* SRC SRC_PHASE_INI */ -- apb_write_reg(2, 0x46, 0x02004000); -- /* SRC SFO_ADJ_CTRL SFO limit 0x100!! */ -- apb_write_reg(2, 0x48, 0xc0287); /* DAGC_CTRL */ -- apb_write_reg(2, 0x49, 0x00000005); /* DAGC_CTRL1 */ -- apb_write_reg(2, 0x4c, 0x00000bbf); /* CCI_RP */ -- apb_write_reg(2, 0x4d, 0x00000376); /* CCI_RPSQ */ -- apb_write_reg(2, 0x4e, 0x00202109); /* CCI_CTRL */ -- apb_write_reg(2, 0x52, 0x00000000); /* CCI_NOTCH1_A2 */ -- apb_write_reg(2, 0x53, 0x00000000); /* CCI_NOTCH1_B1 */ -- apb_write_reg(2, 0x54, 0x00c00000); /* CCI_NOTCH2_A1 */ -- apb_write_reg(2, 0x55, 0x00000000); /* CCI_NOTCH2_A2 */ -- apb_write_reg(2, 0x56, 0x00000000); /* CCI_NOTCH2_B1 */ -- apb_write_reg(2, 0x57, 0x00000000); /* CCI_NOTCH2_B1 */ -- apb_write_reg(2, 0x58, 0x00000886); /* MODE_DETECT_CTRL */ -- apb_write_reg(2, 0x5c, 0x00001011); /* ICFO_EST_CTRL */ -- apb_write_reg(2, 0x5f, 0x00010503); /* TPS_FCFO_CTRL */ -- apb_write_reg(2, 0x61, 0x00000003); /* DE_PN_CTRL */ -- apb_write_reg(2, 0x61, apb_read_reg(2, 0x61) | (1 << 2)); -- /* DE_PN_CTRL SP sync close , Use TPS only ; */ -- apb_write_reg(2, 0x68, 0x004060c0); /* CHAN_EST_CTRL0 */ -- apb_write_reg(2, 0x68, apb_read_reg(2, 0x68) & ~(1 << 7)); -- /* SNR report filter; */ -- /*apb_write_reg(2, 0x68, apb_read_reg(2, 0x68) &~(1<<13)); // -- * Timing Adjust Shutdown; */ -- apb_write_reg(2, 0x69, 0x148c3812); /* CHAN_EST_CTRL1 */ -- /*apb_write_reg(2, 0x69, apb_read_reg(2, 0x69) | (1<<10)); // -- * Disable FD data update */ -- /*apb_write_reg(2, 0x69, apb_read_reg(2, 0x69) | (1<<9)); // -- * set FD coeff */ -- /*apb_write_reg(2, 0x69, apb_read_reg(2, 0x69) | (1<<8)); // -- * set TD coeff */ -- apb_write_reg(2, 0x6a, 0x9101012d); /* CHAN_EST_CTRL2 */ -- apb_write_reg(2, 0x6b, 0x00442211); /* CHAN_EST_CTRL2 */ -- apb_write_reg(2, 0x6c, 0x01fc040a); /* CHAN_EST_CTRL3 */ -- apb_write_reg(2, 0x6d, 0x0030303f); /* SET SNR THRESHOLD */ -- apb_write_reg(2, 0x73, 0xffffffff); /* CCI0_PILOT_UPDATE_CTRL */ -- apb_write_reg(2, 0x74, 0xffffffff); /* CCI0_DATA_UPDATE_CTRL */ -- apb_write_reg(2, 0x75, 0xffffffff); /* CCI1_PILOT_UPDATE_CTRL */ -- apb_write_reg(2, 0x76, 0xffffffff); /* CCI1_DATA_UPDATE_CTRL */ -- -- /* Set ACF and ACFEQ coeffecient */ -- switch (sr) { -- case 0: -- set_ACF_coef(21, bw); -- break; -- case 1: -- set_ACF_coef(21, bw); -- break; -- case 2: -- set_ACF_coef(28, bw); -- break; -- case 3: -- set_ACF_coef(45, bw); -- break; -- default: -- break; -- } -- -- apb_write_reg(2, 0x78, 0x000001a2); -- /* FEC_CTRL parallel mode ; [27:24] is TS clk/valid/sync/error */ -- apb_write_reg(2, 0x7d, 0x0000009d); -- apb_write_reg(2, 0xd6, 0x00000003); -- apb_write_reg(2, 0xd7, 0x00000008); -- apb_write_reg(2, 0xd8, 0x00000120); -- apb_write_reg(2, 0xd9, 0x01010101); -- apb_write_reg(2, 0x04, 0x00000000); -- /* TPS Current, QPSK, none Hierarchy, HP, LP 1/2 */ -- -- tmp = (1 << 25) | ((bw & 3) << 20) | (1 << 16) | (1 << 1); -- apb_write_reg(2, 0x02, tmp); -- apb_write_reg(2, 0x03, (1 << 6)); /* Cordic parameter Calc */ -- -- udelay(1); -- -- tmp = apb_read_reg(2, 0x02); -- tmp |= (1 << 24) | 1; /* FSM, Demod enable. */ -- apb_write_reg(2, 0x02, tmp); --} -- --int dvbt_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dvbt *demod_dvbt) --{ -- int ret = 0; -- u8 bw, sr, ifreq, agc_mode; -- u32 ch_freq; -- -- bw = demod_dvbt->bw; -- sr = demod_dvbt->sr; -- ifreq = demod_dvbt->ifreq; -- agc_mode = demod_dvbt->agc_mode; -- ch_freq = demod_dvbt->ch_freq; -- -- /* Set registers */ -- /*//////////////////////////////////// */ -- /* bw == 0 : 8M */ -- /* 1 : 7M */ -- /* 2 : 6M */ -- /* 3 : 5M */ -- /* sr == 0 : 20.7M */ -- /* 1 : 20.8333M */ -- /* 2 : 28.5714M */ -- /* 3 : 45M */ -- /* ifreq == 0: 36.13MHz */ -- /* 1: 4.57MHz */ -- /* agc_mode == 0: single AGC */ -- /* 1: dual AGC */ -- /*//////////////////////////////////// */ -- if (bw > 3) { -- dprintk("Error: Invalid Bandwidth option %d\n", bw); -- bw = 0; -- ret = -1; -- } -- -- if (sr > 3) { -- dprintk("Error: Invalid Sampling Freq option %d\n", sr); -- sr = 2; -- ret = -1; -- } -- -- if (ifreq > 1) { -- dprintk("Error: Invalid IFreq option %d\n", ifreq); -- ifreq = 0; -- ret = -1; -- } -- -- if (agc_mode > 3) { -- dprintk("Error: Invalid AGC mode option %d\n", agc_mode); -- agc_mode = 0; -- ret = -1; -- } -- /* if (ret != 0) return ret; */ -- -- /* Set DVB-T */ -- (*DEMOD_REG0) |= 1; -- -- demod_sta->dvb_mode = 1; -- demod_sta->ch_mode = 0; /* TODO */ -- demod_sta->agc_mode = agc_mode; -- demod_sta->ch_freq = ch_freq; -- if (demod_i2c->tuner == 1) -- demod_sta->ch_if = 36130; -- else if (demod_i2c->tuner == 2) -- demod_sta->ch_if = 4570; -- -- demod_sta->ch_bw = (8 - bw) * 1000; -- demod_sta->symb_rate = 0; /* TODO */ -- -- /* Set Tuner */ -- if (ch_freq < 1000 || ch_freq > 900000) { -- dprintk -- ( -- "Error: Invalid Channel Freq option %d, Skip Set tuner\n", -- ch_freq); -- /*ch_freq = 474000; */ -- ret = -1; -- } else { -- /* tuner_set_ch(demod_sta, demod_i2c); */ -- } -- -- if ((ch_freq % 100) == 2) -- dprintk("Input frequency is XXX002, Skip initial demod\n"); -- else -- dvbt_reg_initial(demod_sta); -- -- dvbt_enable_irq(7); /* open symbolhead int */ -- -- tuner_type = demod_i2c->tuner; -- -- return ret; --} -- --static int dvbt_get_ch_power(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- u32 ad_power; -- -- ad_power = -- agc_power_to_dbm((apb_read_reg(2, 0x1c) & 0x7ff), -- apb_read_reg(2, 0x1b) & 0x1ff, 0, -- demod_i2c->tuner); -- return ad_power; --} -- --int dvbt_sfo(void) --{ -- int sfo; -- -- sfo = apb_read_reg(2, 0x47) & 0xfff; -- sfo = (sfo > 0x7ff) ? (sfo - 0x1000) : sfo; -- return sfo; --} -- --int dvbt_fcfo(void) --{ -- int fcfo; -- -- fcfo = (apb_read_reg(2, 0x26)) & 0xffffff; -- fcfo = (fcfo > 0x7fffff) ? (fcfo - 0x1000000) : fcfo; -- return fcfo; --} -- --static int dvbt_total_packet_error(void) --{ -- return apb_read_reg(2, 0xbf); --} -- --static int dvbt_super_frame_counter(void) --{ -- return apb_read_reg(2, 0xc0) & 0xfffff; --} -- --static int dvbt_packet_correct_in_sframe(void) --{ -- return apb_read_reg(2, 0xc1) & 0xfffff; --} -- --/*static int dvbt_resync_counter(void) -- * {return((apb_read_reg(2, 0xc0)>>20)&0xff);}*/ --static int dvbt_packets_per_sframe(void) --{ -- u32 tmp; -- int hier_mode; -- int constel; -- int hp_code_rate; -- int lp_code_rate; -- int hier_sel; -- int code_rate; -- int ret; -- -- tmp = apb_read_reg(2, 0x06); -- constel = tmp >> 13 & 3; -- hier_mode = tmp >> 10 & 7; -- hp_code_rate = tmp >> 7 & 7; -- lp_code_rate = tmp >> 4 & 7; -- -- if (hier_mode == 0) { -- code_rate = hp_code_rate; -- } else { -- tmp = apb_read_reg(2, 0x78); -- hier_sel = tmp >> 9 & 1; -- if (hier_sel == 0) { -- constel = 0; /* QPSK; */ -- code_rate = hp_code_rate; -- } else { -- constel = constel == 2 ? 1 : 0; -- code_rate = lp_code_rate; -- } -- } -- -- switch (code_rate) { -- case 0: -- ret = (constel == 0) ? 1008 : (constel == 1) ? 2016 : 3024; -- break; -- case 1: -- ret = (constel == 0) ? 1344 : (constel == 1) ? 2688 : 4032; -- break; -- case 2: -- ret = (constel == 0) ? 1512 : (constel == 1) ? 3024 : 4536; -- break; -- case 3: -- ret = (constel == 0) ? 1680 : (constel == 1) ? 3360 : 5040; -- break; -- case 4: -- ret = (constel == 0) ? 1764 : (constel == 1) ? 3528 : 5292; -- break; -- default: -- ret = (constel == 0) ? 1008 : (constel == 1) ? 2016 : 3024; -- break; -- } -- return ret; --} -- --static int dvbt_get_per(void) --{ -- int packets_per_sframe; -- int error; -- int per; -- -- packets_per_sframe = dvbt_packets_per_sframe(); -- error = packets_per_sframe - dvbt_packet_correct_in_sframe(); -- per = 1000 * error / packets_per_sframe; -- -- return per; --} -- --static void dvbt_set_test_bus(u8 sel) --{ -- u32 tmp; -- -- tmp = apb_read_reg(2, 0x7f); -- tmp &= ~(0x1f); -- tmp |= ((1 << 15) | (1 << 5) | (sel & 0x1f)); -- apb_write_reg(2, 0x7f, tmp); --} -- --/* -- * void dvbt_get_test_out(u8 sel, u32 len, u32 *buf) -- * { -- * int i; -- * -- * dvbt_set_test_bus(sel); -- * -- * for (i=0; i> 10) & 0x1) { -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- buf[i++] = apb_read_reg(2, 0x13); -- } else { -- i--; -- } -- -- cnt++; -- } --} -- --static int dvbt_get_avg_per(void) --{ -- int packets_per_sframe; -- static int err_last; -- static int err_now; -- static int rsnum_now; -- static int rsnum_last; -- int per; -- -- packets_per_sframe = dvbt_packets_per_sframe(); -- rsnum_last = rsnum_now; -- rsnum_now = dvbt_super_frame_counter(); -- err_last = err_now; -- err_now = dvbt_total_packet_error(); -- if (rsnum_now != rsnum_last) -- per = 1000 * (err_now - err_last) / -- ((rsnum_now - rsnum_last) * packets_per_sframe); -- else -- per = 123; -- -- return per; --} -- --int dvbt_status(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_sts *demod_sts) --{ -- /* if parameters are needed to calc, pass the struct to func. */ -- /* all small funcs like read_snr() should be static. */ -- -- demod_sts->ch_snr = apb_read_reg(2, 0x0a); -- demod_sts->ch_per = dvbt_get_per(); -- demod_sts->ch_pow = dvbt_get_ch_power(demod_sta, demod_i2c); -- demod_sts->ch_ber = apb_read_reg(2, 0x0b); -- demod_sts->ch_sts = apb_read_reg(2, 0); -- demod_sts->dat0 = dvbt_get_avg_per(); -- demod_sts->dat1 = apb_read_reg(2, 0x06); -- return 0; --} -- --static int dvbt_get_status(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- return apb_read_reg(2, 0x0) >> 12 & 1; --} -- --static int dvbt_ber(void); -- --static int dvbt_get_ber(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- return dvbt_ber(); /*unit: 1e-7 */ --} -- --static int dvbt_get_snr(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- return apb_read_reg(2, 0x0a) & 0x3ff; /*dBm: bit0~bit2=decimal */ --} -- --static int dvbt_get_strength(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- int dbm = dvbt_get_ch_power(demod_sta, demod_i2c); -- -- return dbm; --} -- --static int dvbt_get_ucblocks(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c) --{ -- return dvbt_get_per(); --} -- --struct demod_status_ops *dvbt_get_status_ops(void) --{ -- static struct demod_status_ops ops = { -- .get_status = dvbt_get_status, -- .get_ber = dvbt_get_ber, -- .get_snr = dvbt_get_snr, -- .get_strength = dvbt_get_strength, -- .get_ucblocks = dvbt_get_ucblocks, -- }; -- -- return &ops; --} -- --void dvbt_enable_irq(int dvbt_irq) --{ -- /* clear status & enable irq */ -- (*OFDM_INT_STS) &= ~(1 << dvbt_irq); -- (*OFDM_INT_EN) |= (1 << dvbt_irq); --} -- --void dvbt_disable_irq(int dvbt_irq) --{ -- /* disable irq & clear status */ -- (*OFDM_INT_EN) &= ~(1 << dvbt_irq); -- (*OFDM_INT_STS) &= ~(1 << dvbt_irq); --} -- --char *dvbt_irq_name[] = { -- "PFS_FCFO", -- "PFS_ICFO", -- " CS_FCFO", -- " PFS_SFO", -- " PFS_TPS", -- " SP", -- " CCI", -- " Symbol", -- " In_Sync", -- "Out_Sync", -- "FSM Stat" --}; -- --void dvbt_isr(struct aml_demod_sta *demod_sta) --{ -- u32 stat, mask; -- int dvbt_irq; -- -- stat = (*OFDM_INT_STS); -- mask = (*OFDM_INT_EN); -- stat &= mask; -- -- for (dvbt_irq = 0; dvbt_irq < 11; dvbt_irq++) { -- if (stat >> dvbt_irq & 1) { -- if (demod_sta->debug) -- dprintk("irq: aml_demod dvbt %2d %s %8x %8x\n", -- dvbt_irq, dvbt_irq_name[dvbt_irq], stat, -- mask); -- /* dvbt_disable_irq(dvbt_irq); */ -- } -- } -- /* clear status */ -- (*OFDM_INT_STS) = 0; --} -- --static int demod_monitor_ave(void); --int dvbt_isr_islock(void) --{ --#define IN_SYNC_MASK (0x100) -- -- u32 stat, mask; -- -- stat = (*OFDM_INT_STS); -- *OFDM_INT_STS = stat & (~IN_SYNC_MASK); -- -- mask = (*OFDM_INT_EN); -- stat &= mask; -- -- return (stat & IN_SYNC_MASK) == IN_SYNC_MASK; --} -- --int dvbt_isr_monitor(void) --{ --#define SYM_HEAD_MASK (0x80) -- u32 stat, mask; -- -- stat = (*OFDM_INT_STS); -- *OFDM_INT_STS = stat & (~SYM_HEAD_MASK); -- -- mask = (*OFDM_INT_EN); -- stat &= mask; -- /* symbol_head int */ -- if ((stat & SYM_HEAD_MASK) == SYM_HEAD_MASK) -- demod_monitor_ave(); -- return 0; --} -- --int dvbt_isr_cancel(void) --{ -- *OFDM_INT_STS = 0; -- *OFDM_INT_EN = 0; -- return 0; --} -- --static int demod_monitor_instant(void) --{ -- int SNR; -- int SNR_SP = 500; -- int SNR_TPS = 0; -- int SNR_CP = 0; -- int SFO_residual = 0; -- int SFO_esti = 0; -- int FCFO_esti = 0; -- int FCFO_residual = 0; -- int AGC_Gain = 0; -- int be_vit_error = 0; -- int Signal_power = 0; -- int FECFlag = 0; -- int EQ_seg_ratio = 0; -- int tps_0 = 0; -- int tps_1 = 0; -- int tps_2 = 0; -- int cci_blank = 0; -- -- int SFO; -- int FCFO; -- int timing_adj; -- int RS_CorrectNum; -- int RS_Error_sum; -- int resync_times; -- int tps_summary; -- -- int tps_window; -- int tps_guard; -- int tps_constell; -- int tps_Hier_none; -- int tps_Hier_alpha; -- int tps_HP_cr; -- int tps_LP_cr; -- -- int tmpAGCGain; -- -- /* Read Registers */ -- SNR = apb_read_reg(2, 0x0a); -- FECFlag = (apb_read_reg(2, 0x00) >> 11) & 0x3; -- SFO = apb_read_reg(2, 0x47) & 0xfff; -- SFO_esti = apb_read_reg(2, 0x60) & 0xfff; -- FCFO_esti = (apb_read_reg(2, 0x60) >> 11) & 0xfff; -- FCFO = (apb_read_reg(2, 0x26)) & 0xffffff; -- be_vit_error = apb_read_reg(2, 0x0c) & 0x1fff; -- timing_adj = apb_read_reg(2, 0x6f) & 0x1fff; -- RS_CorrectNum = apb_read_reg(2, 0xc1) & 0xfffff; -- Signal_power = (apb_read_reg(2, 0x1b)) & 0x1ff; -- EQ_seg_ratio = apb_read_reg(2, 0x6e) & 0x3ffff; -- tps_0 = apb_read_reg(2, 0x64); -- tps_1 = apb_read_reg(2, 0x65); -- tps_2 = apb_read_reg(2, 0x66) & 0xf; -- tps_summary = apb_read_reg(2, 0x04) & 0x7fff; -- cci_blank = (apb_read_reg(2, 0x66) >> 16); -- RS_Error_sum = apb_read_reg(2, 0xbf) & 0x3ffff; -- resync_times = (apb_read_reg(2, 0xc0) >> 20) & 0xff; -- AGC_Gain = apb_read_reg(2, 0x1c) & 0x7ff; -- -- /* Calc */ -- SFO_residual = (SFO > 0x7ff) ? (SFO - 0x1000) : SFO; -- FCFO_residual = (FCFO > 0x7fffff) ? (FCFO - 0x1000000) : FCFO; -- FCFO_esti = (FCFO_esti > 0x7ff) ? (FCFO_esti - 0x1000) : FCFO_esti; -- SNR_CP = (SNR) & 0x3ff; -- SNR_TPS = (SNR >> 10) & 0x3ff; -- SNR_SP = (SNR >> 20) & 0x3ff; -- SNR_SP = (SNR_SP > 0x1ff) ? SNR_SP - 0x400 : SNR_SP; -- SNR_TPS = (SNR_TPS > 0x1ff) ? SNR_TPS - 0x400 : SNR_TPS; -- SNR_CP = (SNR_CP > 0x1ff) ? SNR_CP - 0x400 : SNR_CP; -- tmpAGCGain = AGC_Gain; -- timing_adj = (timing_adj > 0xfff) ? timing_adj - 0x2000 : timing_adj; -- -- tps_window = (tps_summary & 0x3); -- tps_guard = ((tps_summary >> 2) & 0x3); -- tps_constell = ((tps_summary >> 13) & 0x3); -- tps_Hier_none = (((tps_summary >> 10) & 0x7) == 0) ? 1 : 0; -- tps_Hier_alpha = (tps_summary >> 11) & 0x3; -- tps_Hier_alpha = (tps_Hier_alpha == 3) ? 4 : tps_Hier_alpha; -- tps_LP_cr = (tps_summary >> 4) & 0x7; -- tps_HP_cr = (tps_summary >> 7) & 0x7; -- -- dprintk("\n\n"); -- switch (tps_window) { -- case 0: -- dprintk("2K "); -- break; -- case 1: -- dprintk("8K "); -- break; -- case 2: -- dprintk("4K "); -- break; -- default: -- dprintk("UnWin "); -- break; -- } -- switch (tps_guard) { -- case 0: -- dprintk("1/32 "); -- break; -- case 1: -- dprintk("1/16 "); -- break; -- case 2: -- dprintk("1/ 8 "); -- break; -- case 3: -- dprintk("1/ 4 "); -- break; -- default: -- dprintk("UnGuard "); -- break; -- } -- switch (tps_constell) { -- case 0: -- dprintk(" QPSK "); -- break; -- case 1: -- dprintk("16QAM "); -- break; -- case 2: -- dprintk("64QAM "); -- break; -- default: -- dprintk("UnConstl "); -- break; -- } -- switch (tps_Hier_none) { -- case 0: -- dprintk("Hiera "); -- break; -- case 1: -- dprintk("non-H "); -- break; -- default: -- dprintk("UnHier "); -- break; -- } -- dprintk("%d ", tps_Hier_alpha); -- dprintk("HP "); -- switch (tps_HP_cr) { -- case 0: -- dprintk("1/2 "); -- break; -- case 1: -- dprintk("2/3 "); -- break; -- case 2: -- dprintk("3/4 "); -- break; -- case 3: -- dprintk("5/6 "); -- break; -- case 4: -- dprintk("7/8 "); -- break; -- default: -- dprintk("UnHCr "); -- break; -- } -- dprintk("LP "); -- switch (tps_LP_cr) { -- case 0: -- dprintk("1/2 "); -- break; -- case 1: -- dprintk("2/3 "); -- break; -- case 2: -- dprintk("3/4 "); -- break; -- case 3: -- dprintk("5/6 "); -- break; -- case 4: -- dprintk("7/8 "); -- break; -- default: -- dprintk("UnLCr "); -- break; -- } -- dprintk("\n"); -- dprintk("P %4x ", RS_Error_sum); -- dprintk("SP %2d ", SNR_SP); -- dprintk("TPS %2d ", SNR_TPS); -- dprintk("CP %2d ", SNR_CP); -- dprintk("EQS %2x ", EQ_seg_ratio); -- dprintk("RSC %4d ", RS_CorrectNum); -- dprintk("SFO %3d ", SFO_residual); -- dprintk("FCFO %4d ", FCFO_residual); -- dprintk("Vit %3x ", be_vit_error); -- dprintk("Timing %3d ", timing_adj); -- dprintk("SigP %3x ", Signal_power); -- dprintk("AGC %d ", tmpAGCGain); -- dprintk("SigP %d ", -- agc_power_to_dbm(tmpAGCGain, Signal_power, 0, tuner_type)); -- dprintk("FEC %x ", FECFlag); -- dprintk("ReSyn %x ", resync_times); -- dprintk("cciB %x", cci_blank); -- -- dprintk("\n"); -- -- return 0; --} -- --int serial_div(int a, int b) --{ -- int c; -- int cnt; -- int b_buf; -- -- if (b == 0) -- return 0x7fffffff; -- if (a == 0) -- return 0; -- -- c = 0; -- cnt = 0; -- -- a = (a < 0) ? -1 * a : a; -- b = (b < 0) ? -1 * b : b; -- -- b_buf = b; -- -- while (a >= b) { -- b = b << 1; -- cnt++; -- } -- while (b > b_buf) { -- b = b >> 1; -- c = c << 1; -- if (a > b) { -- c = c + 1; -- a = a - b; -- } -- } -- return c; --} -- --static int ave0, bit_unit_L; -- --static int dvbt_ber(void) --{ -- int BER_e_n7 = serial_div(ave0 * 40, bit_unit_L); -- -- return BER_e_n7; --} -- --static int demod_monitor_ave(void) --{ -- static int i; -- static int ave[3] = { 0, 0, 0 }; -- -- ave[0] = ave[0] + (apb_read_reg(2, 0x0b) & 0x7ff); -- ave[1] = ave[1] + (apb_read_reg(2, 0x0a) & 0x3ff); -- ave[2] = ave[2] + (apb_read_reg(2, 0x0c) & 0x1fff); -- -- i++; -- -- if (i >= 8192) { -- int tps_mode; -- int tps_constell; -- int r_t; -- int mode_L; -- int const_L; -- int SNR_Int; -- int SNR_fra; -- -- if (debug_amldvbt) -- demod_monitor_instant(); -- -- r_t = apb_read_reg(2, 0x04); -- tps_mode = r_t & 0x3; -- tps_constell = (r_t >> 13) & 0x3; -- mode_L = (tps_mode == 0) ? 1 : (tps_mode == 1) ? 4 : 2; -- const_L = (tps_constell == 0) ? 2 : (tps_constell == 1) ? 4 : 6; -- bit_unit_L = 189 * mode_L * const_L; -- SNR_Int = (ave[1] >> 16); -- switch ((ave[1] >> 13) & 0x7) { -- case 0: -- SNR_fra = 0; -- break; -- case 1: -- SNR_fra = 125; -- break; -- case 2: -- SNR_fra = 250; -- break; -- case 3: -- SNR_fra = 375; -- break; -- case 4: -- SNR_fra = 500; -- break; -- case 5: -- SNR_fra = 625; -- break; -- case 6: -- SNR_fra = 750; -- break; -- case 7: -- SNR_fra = 875; -- break; -- default: -- SNR_fra = 0; -- break; -- } -- -- ave0 = ave[0]; -- -- if (debug_amldvbt) -- dprintk("RSBi %d Thresh %d SNR %d.%d Vit %x\n\n", -- (ave[0] >> 3) * 5, (bit_unit_L * 8), SNR_Int, -- SNR_fra, (ave[2] >> 13)); -- i = 0; -- ave[0] = ave[1] = ave[2] = 0; -- } -- -- return i; --} -- --int dvbt_switch_to_HP(void) --{ -- apb_write_reg(2, 0x78, apb_read_reg(2, 0x78) & ~(1 << 9)); -- return 0; --} -- --int dvbt_switch_to_LP(void) --{ -- apb_write_reg(2, 0x78, apb_read_reg(2, 0x78) | (1 << 9)); -- return 0; --} -- --int dvbt_shutdown(void) --{ -- apb_write_reg(2, 0x02, 0x00800000); -- /* SW reset bit[23] ; write anything to zero */ -- apb_write_reg(2, 0x00, 0x00000000); -- return 0; --} -- --int dvbt_get_params(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *adap, int *code_rate_HP, -- /* high priority stream code rate */ -- int *code_rate_LP, /* low priority stream code rate */ -- int *constellation, /* modulation type (see above) */ -- int *transmission_mode, -- int *guard_interval, int *hierarchy_information) --{ -- int tps_summary, tps_window, tps_guard, tps_constell, tps_Hier_none; -- int tps_Hier_alpha, tps_LP_cr, tps_HP_cr; -- tps_summary = apb_read_reg(2, 0x04) & 0x7fff; -- tps_window = (tps_summary & 0x3); -- tps_guard = ((tps_summary >> 2) & 0x3); -- tps_constell = ((tps_summary >> 13) & 0x3); -- tps_Hier_none = (((tps_summary >> 10) & 0x7) == 0) ? 1 : 0; -- tps_Hier_alpha = (tps_summary >> 11) & 0x3; -- tps_Hier_alpha = (tps_Hier_alpha == 3) ? 4 : tps_Hier_alpha; -- tps_LP_cr = (tps_summary >> 4) & 0x7; -- tps_HP_cr = (tps_summary >> 7) & 0x7; -- if (code_rate_HP) -- *code_rate_HP = tps_HP_cr; /*1/2:2/3:3/4:5/6:7/8 */ -- if (code_rate_LP) -- *code_rate_LP = tps_LP_cr; /*1/2:2/3:3/4:5/6:7/8 */ -- if (constellation) -- *constellation = tps_constell; /*QPSK/16QAM/64QAM */ -- if (transmission_mode) -- *transmission_mode = tps_window; /*2K/8K/4K */ -- if (guard_interval) -- *guard_interval = tps_guard; /*1/32:1/16:1/8:1/4 */ -- if (hierarchy_information) -- *hierarchy_information = tps_Hier_alpha; /*1/2/4 */ -- return 0; --} -diff --git a/drivers/amlogic/dvb_tv/amldemod/i2c_func.c b/drivers/amlogic/dvb_tv/amldemod/i2c_func.c -deleted file mode 100644 -index b00d14b..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/i2c_func.c -+++ /dev/null -@@ -1,22 +0,0 @@ --#include --#include --#include --#include --#include "demod_func.h" -- --int am_demod_i2c_xfer(struct aml_demod_i2c *adap, struct i2c_msg msgs[], -- int num) --{ -- int ret = 0; -- if (adap->scl_oe) { -- /* ret = aml_i2c_sw_bit_xfer(adap, msgs, num);*/ -- } else { -- if (adap->i2c_priv) -- ret = i2c_transfer((struct i2c_adapter *)adap->i2c_priv, -- msgs, num); -- else -- ; -- /* printk("i2c error, no valid i2c\n");*/ -- } -- return ret; --} -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/acf_filter_coefficient.h b/drivers/amlogic/dvb_tv/amldemod/include/acf_filter_coefficient.h -deleted file mode 100644 -index b1437a2..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/acf_filter_coefficient.h -+++ /dev/null -@@ -1,395 +0,0 @@ --void program_acf(int acf1[20], int acf2[33]) --{ -- int i; -- -- for (i = 0; i < 20; i++) -- apb_write_reg(DVBT_BASE + (0x2c + i) * 4, acf1[i]); -- for (i = 0; i < 33; i++) { -- apb_write_reg(DVBT_BASE + 0xfe * 4, i); -- apb_write_reg(DVBT_BASE + 0xff * 4, acf2[i]); -- } --} -- --void ini_acf_iireq_src_45m_8m(void) --{ -- int acf1[] = { 0x294, 0x085, 0x076, 0x01e, -- 0x27c, 0x0af, 0x2bf, 0x06d, -- 0x265, 0x0d8, 0x270, 0x05e, -- 0x257, 0x0ef, 0x25b, 0x04b, -- 0x24f, 0x0fc, 0x254, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3da7cd, 0x3c0f9b, 0x3a7768, 0x38df35, -- 0x373f01, -- 0x3596cd, 0x33ee98, 0x323e62, 0x307e2b, 0x2eb5f3, -- 0x2ce5b9, -- 0x2b057e, 0x290d41, 0x26fd00, 0x24dcbd, 0x229477, -- 0x202c2c, -- 0x1d93dc, 0x1ac386, 0x17b328, 0x144ac1, 0x106a4d, -- 0x0be1c8, -- 0x07e129, 0x04d0cc, 0x015064, 0x3d47ec, 0x38675e, -- 0x326eb1, -- 0x326e4d, 0x326e4d, 0x00064d -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_45m_7m(void) --{ -- int acf1[] = { 0x283, 0x091, 0x02f, 0x01e, -- 0x26a, 0x0b8, 0x296, 0x06d, -- 0x253, 0x0dc, 0x257, 0x05e, -- 0x245, 0x0f1, 0x246, 0x04b, -- 0x23d, 0x0fc, 0x241, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3dafce, 0x3c1f9c, 0x3a8769, 0x38ef37, -- 0x374f03, -- 0x35aecf, 0x34069b, 0x325665, 0x30962e, 0x2ecdf6, -- 0x2cfdbc, -- 0x2b1581, 0x291d43, 0x271503, 0x24e4bf, 0x229c78, -- 0x202c2d, -- 0x1d8bdc, 0x1ab384, 0x179325, 0x141abc, 0x102a46, -- 0x0b81be, -- 0x07711c, 0x0448bd, 0x00b052, 0x3c7fd6, 0x374740, -- 0x308684, -- 0x308610, 0x308610, 0x000610 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_45m_6m(void) --{ -- int acf1[] = { 0x272, 0x09e, 0x3dc, 0x01e, -- 0x259, 0x0c0, 0x272, 0x06d, -- 0x242, 0x0e1, 0x240, 0x05e, -- 0x235, 0x0f3, 0x234, 0x04b, -- 0x22e, 0x0fd, 0x230, 0x04d -- }; -- int acf2[] = { 0x3f47ff, 0x3dbfcf, 0x3c379e, 0x3aa76d, 0x391f3c, -- 0x378709, -- 0x35e6d6, 0x343ea2, 0x328e6d, 0x30d636, 0x2f0dfe, -- 0x2d35c4, -- 0x2b4d88, 0x294d49, 0x273d08, 0x2504c4, 0x22b47c, -- 0x203c2f, -- 0x1d9bde, 0x1ac386, 0x17a327, 0x1432bf, 0x104249, -- 0x0ba9c2, -- 0x07a922, 0x0490c5, 0x01185c, 0x3d0fe5, 0x383f58, -- 0x3286af, -- 0x328650, 0x328650, 0x000650 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_45m_5m(void) --{ -- int acf1[] = { 0x260, 0x0ab, 0x37e, 0x02e, -- 0x249, 0x0ca, 0x251, 0x06d, -- 0x233, 0x0e6, 0x22d, 0x05e, -- 0x227, 0x0f5, 0x224, 0x04b, -- 0x220, 0x0fd, 0x221, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3db7cf, 0x3c279d, 0x3a9f6c, 0x39073a, -- 0x377707, -- 0x35d6d4, 0x3436a0, 0x328e6b, 0x30d636, 0x2f15ff, -- 0x2d4dc6, -- 0x2b758c, 0x29854f, 0x278511, 0x256ccf, 0x232c89, -- 0x20cc3f, -- 0x1e33f0, 0x1b6b9b, 0x185b3d, 0x14e2d5, 0x10f260, -- 0x0c51d7, -- 0x082934, 0x04f8d4, 0x014066, 0x3ccfe4, 0x372f46, -- 0x2f5673, -- 0x2f55ea, 0x2f55ea, 0x0005ea -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_2857m_8m(void) --{ -- int acf1[] = { 0x2df, 0x059, 0x144, 0x00e, -- 0x2d3, 0x08f, 0x38d, 0x06f, -- 0x2c6, 0x0c5, 0x302, 0x05e, -- 0x2be, 0x0e7, 0x2d6, 0x04b, -- 0x2b7, 0x0f9, 0x2c8, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3dbfcf, 0x3c379e, 0x3aaf6d, 0x391f3c, -- 0x37870a, -- 0x35eed7, 0x344ea3, 0x32a66f, 0x30f639, 0x2f3602, -- 0x2d65c9, -- 0x2b858e, 0x299552, 0x278d12, 0x2564cf, 0x231c88, -- 0x20b43d, -- 0x1e13ec, 0x1b3395, 0x181336, 0x1492cc, 0x109254, -- 0x0be1cb, -- 0x07c127, 0x0498c7, 0x00f85b, 0x3cbfde, 0x377747, -- 0x309e88, -- 0x309e13, 0x309e13, 0x000613 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_2857m_7m(void) --{ -- int acf1[] = { 0x2c6, 0x067, 0x10f, 0x01e, -- 0x2b4, 0x099, 0x344, 0x06f, -- 0x2a2, 0x0cb, 0x2cb, 0x05e, -- 0x297, 0x0ea, 0x2a7, 0x04b, -- 0x28f, 0x0fa, 0x29c, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3dbfcf, 0x3c379e, 0x3aa76d, 0x39173b, -- 0x378709, -- 0x35e6d6, 0x3446a2, 0x329e6d, 0x30e637, 0x2f2600, -- 0x2d4dc7, -- 0x2b6d8c, 0x297d4e, 0x276d0e, 0x2544cb, 0x22fc84, -- 0x208438, -- 0x1de3e7, 0x1b0b90, 0x17eb30, 0x146ac7, 0x107250, -- 0x0bc9c6, -- 0x07b124, 0x0490c5, 0x00f85b, 0x3cc7df, 0x37974a, -- 0x30ce8d, -- 0x30ce19, 0x30ce19, 0x000619 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_2857m_6m(void) --{ -- int acf1[] = { 0x2ac, 0x076, 0x0c9, 0x01e, -- 0x297, 0x0a4, 0x2fd, 0x06d, -- 0x281, 0x0d2, 0x299, 0x05e, -- 0x274, 0x0ed, 0x27d, 0x04b, -- 0x26c, 0x0fb, 0x274, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3db7cf, 0x3c279d, 0x3a976b, 0x390739, -- 0x376f07, -- 0x35ced3, 0x342e9f, 0x327e6a, 0x30c634, 0x2f05fc, -- 0x2d35c4, -- 0x2b5d89, 0x29654c, 0x275d0c, 0x253cca, 0x22fc83, -- 0x209439, -- 0x1dfbe9, 0x1b2b93, 0x181b35, 0x14b2ce, 0x10ca5a, -- 0x0c41d4, -- 0x084935, 0x0538d9, 0x01c071, 0x3db7fa, 0x38bf6b, -- 0x327eb9, -- 0x327e4f, 0x327e4f, 0x00064f -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_2857m_5m(void) --{ -- int acf1[] = { 0x292, 0x087, 0x06e, 0x01e, -- 0x27a, 0x0b0, 0x2b9, 0x06d, -- 0x262, 0x0d8, 0x26d, 0x05e, -- 0x254, 0x0f0, 0x258, 0x04b, -- 0x24c, 0x0fc, 0x252, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3db7ce, 0x3c279d, 0x3a976b, 0x38ff38, -- 0x376706, -- 0x35c6d2, 0x341e9d, 0x326e68, 0x30ae31, 0x2eedf9, -- 0x2d15c0, -- 0x2b2d84, 0x293546, 0x272506, 0x24fcc2, 0x22ac7b, -- 0x203c2f, -- 0x1d9bde, 0x1ac386, 0x17a327, 0x1422be, 0x103247, -- 0x0b91bf, -- 0x07891e, 0x0470c1, 0x00e858, 0x3ccfde, 0x37bf4d, -- 0x313e96, -- 0x313e27, 0x313e27, 0x000627 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_24m_8m(void) --{ -- int acf1[] = { 0x303, 0x048, 0x17e, 0x00e, -- 0x302, 0x081, 0x3f8, 0x00a, -- 0x300, 0x0bd, 0x35b, 0x05e, -- 0x2fe, 0x0e3, 0x325, 0x04b, -- 0x2fb, 0x0f8, 0x313, 0x04d -- }; -- int acf2[] = { 0x3f47ff, 0x3dc7d0, 0x3c3fa0, 0x3abf6f, 0x392f3e, -- 0x37a70d, -- 0x360eda, 0x346ea7, 0x32c673, 0x31163d, 0x2f5606, -- 0x2d8dce, -- 0x2bad93, 0x29bd56, 0x27b517, 0x258cd4, 0x23448d, -- 0x20cc41, -- 0x1e2bf0, 0x1b4b98, 0x182338, 0x149ace, 0x109255, -- 0x0bd1ca, -- 0x07a123, 0x0468c2, 0x00b054, 0x3c5fd4, 0x37073a, -- 0x302e79, -- 0x302e05, 0x302e05, 0x000605 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_24m_7m(void) --{ -- int acf1[] = { 0x2e7, 0x055, 0x153, 0x00e, -- 0x2dd, 0x08b, 0x3a5, 0x06f, -- 0x2d2, 0x0c4, 0x315, 0x05e, -- 0x2cb, 0x0e6, 0x2e7, 0x04b, -- 0x2c5, 0x0f9, 0x2d8, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3dbfcf, 0x3c379e, 0x3aaf6d, 0x391f3c, -- 0x37870a, -- 0x35eed7, 0x344ea3, 0x32a66f, 0x30ee39, 0x2f2e02, -- 0x2d65c9, -- 0x2b858e, 0x298d51, 0x278511, 0x255cce, 0x231487, -- 0x20a43c, -- 0x1e0beb, 0x1b3394, 0x181335, 0x1492cb, 0x109254, -- 0x0be1ca, -- 0x07b925, 0x0480c5, 0x00d858, 0x3c87d8, 0x373740, -- 0x305e80, -- 0x305e0b, 0x305e0b, 0x00060b -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_24m_6m(void) --{ -- int acf1[] = { 0x2c9, 0x065, 0x118, 0x01e, -- 0x2b9, 0x097, 0x34f, 0x06f, -- 0x2a7, 0x0ca, 0x2d3, 0x05e, -- 0x29c, 0x0e9, 0x2ae, 0x04b, -- 0x295, 0x0fa, 0x2a2, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3db7cf, 0x3c2f9d, 0x3a9f6c, 0x390f3a, -- 0x377707, -- 0x35d6d4, 0x342ea0, 0x32866b, 0x30ce34, 0x2f05fd, -- 0x2d35c3, -- 0x2b5588, 0x295d4b, 0x27550b, 0x252cc8, 0x22dc80, -- 0x206c35, -- 0x1dcbe4, 0x1af38c, 0x17cb2d, 0x144ac3, 0x104a4b, -- 0x0b99c1, -- 0x07791d, 0x0448be, 0x00b052, 0x3c6fd4, 0x37473f, -- 0x30c686, -- 0x30c618, 0x30c618, 0x000618 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_24m_5m(void) --{ -- int acf1[] = { 0x2ab, 0x077, 0x0c6, 0x01e, -- 0x295, 0x0a5, 0x2fa, 0x06d, -- 0x27f, 0x0d2, 0x297, 0x05e, -- 0x272, 0x0ed, 0x27b, 0x04b, -- 0x26a, 0x0fb, 0x272, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3db7cf, 0x3c2f9e, 0x3aa76c, 0x39173b, -- 0x377f08, -- 0x35ded5, 0x343ea1, 0x328e6c, 0x30de36, 0x2f15ff, -- 0x2d45c6, -- 0x2b658a, 0x29754d, 0x27650d, 0x253cca, 0x22f483, -- 0x208438, -- 0x1de3e7, 0x1b0b90, 0x17eb30, 0x1472c7, 0x107a51, -- 0x0bd9c8, -- 0x07c927, 0x04a8c9, 0x01205f, 0x3cf7e4, 0x37e752, -- 0x31669a, -- 0x31662c, 0x31662c, 0x00062c -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_207m_8m(void) --{ -- int acf1[] = { 0x327, 0x039, 0x1a5, 0x07b, -- 0x332, 0x076, 0x05c, 0x06e, -- 0x33e, 0x0b6, 0x3b8, 0x05e, -- 0x344, 0x0e0, 0x37a, 0x04b, -- 0x345, 0x0f7, 0x365, 0x04d -- }; -- int acf2[] = { 0x3f47ff, 0x3dcfd1, 0x3c57a1, 0x3ad772, 0x394f42, -- 0x37c711, -- 0x3636df, 0x34a6ad, 0x32fe7a, 0x315645, 0x2f9e0f, -- 0x2dd5d7, -- 0x2bfd9d, 0x2a0d61, 0x280d21, 0x25e4df, 0x239c98, -- 0x212c4d, -- 0x1e8bfc, 0x1baba4, 0x188344, 0x14fad9, 0x10ea61, -- 0x0c29d4, -- 0x07e92d, 0x04a8cb, 0x00f05c, 0x3c87da, 0x371f3e, -- 0x30267a, -- 0x302604, 0x302604, 0x000604 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_207m_7m(void) --{ -- int acf1[] = { 0x307, 0x046, 0x182, 0x00e, -- 0x306, 0x080, 0x002, 0x00a, -- 0x306, 0x0bd, 0x364, 0x05e, -- 0x304, 0x0e3, 0x32d, 0x04b, -- 0x301, 0x0f8, 0x31b, 0x04d -- }; -- int acf2[] = { 0x3f47ff, 0x3dc7d0, 0x3c47a0, 0x3abf6f, 0x39373f, -- 0x37a70d, -- 0x3616db, 0x3476a8, 0x32d674, 0x31263f, 0x2f6608, -- 0x2d9dd0, -- 0x2bbd96, 0x29d559, 0x27cd19, 0x25a4d7, 0x235c90, -- 0x20ec45, -- 0x1e53f4, 0x1b739d, 0x18533d, 0x14d2d4, 0x10d25c, -- 0x0c19d1, -- 0x07e12c, 0x04a8ca, 0x00f05c, 0x3c8fdb, 0x372740, -- 0x302e7c, -- 0x302e05, 0x302e05, 0x000605 -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_207m_6m(void) --{ -- int acf1[] = { 0x2e6, 0x056, 0x151, 0x00e, -- 0x2db, 0x08c, 0x3a1, 0x06f, -- 0x2d0, 0x0c4, 0x312, 0x05e, -- 0x2c9, 0x0e6, 0x2e4, 0x04b, -- 0x2c3, 0x0f9, 0x2d6, 0x04d -- }; -- int acf2[] = { 0x3f47ff, 0x3dbfd0, 0x3c3f9f, 0x3ab76e, 0x39273d, -- 0x37970b, -- 0x35fed9, 0x345ea5, 0x32b671, 0x31063b, 0x2f4604, -- 0x2d75cb, -- 0x2b9590, 0x29a553, 0x279513, 0x256cd0, 0x232489, -- 0x20b43d, -- 0x1e0bec, 0x1b3395, 0x180b35, 0x148acb, 0x108253, -- 0x0bd1c8, -- 0x07a123, 0x0470c2, 0x00c055, 0x3c77d6, 0x372f3e, -- 0x306e80, -- 0x306e0d, 0x306e0d, 0x00060d -- }; -- -- program_acf(acf1, acf2); --} -- --void ini_acf_iireq_src_207m_5m(void) --{ -- int acf1[] = { 0x2c3, 0x068, 0x109, 0x01e, -- 0x2b1, 0x09a, 0x33d, 0x06f, -- 0x29f, 0x0cc, 0x2c6, 0x05e, -- 0x293, 0x0ea, 0x2a3, 0x04b, -- 0x28c, 0x0fa, 0x298, 0x04d -- }; -- int acf2[] = { 0x3f3fff, 0x3db7ce, 0x3c279d, 0x3a976b, 0x38ff38, -- 0x376706, -- 0x35c6d2, 0x341e9e, 0x327669, 0x30be32, 0x2ef5fb, -- 0x2d25c1, -- 0x2b4586, 0x295549, 0x274509, 0x251cc6, 0x22dc80, -- 0x206c34, -- 0x1dcbe4, 0x1afb8d, 0x17db2e, 0x1462c5, 0x106a4f, -- 0x0bc9c6, -- 0x07b124, 0x0488c5, 0x00e859, 0x3cafdc, 0x377f47, -- 0x30ee8c, -- 0x30ee1d, 0x30ee1d, 0x00061d -- }; -- -- program_acf(acf1, acf2); --} -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_che.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_che.h -deleted file mode 100644 -index 01ff783..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_che.h -+++ /dev/null -@@ -1,58 +0,0 @@ --#ifndef __ADDR_DTMB_CHE_H__ --#define __ADDR_DTMB_CHE_H__ -- --#include "addr_dtmb_top.h" -- --#define DTMB_CHE_ADDR(x) (DTMB_DEMOD_BASE + (x << 2)) -- --#define DTMB_CHE_TE_HREB_SNR DTMB_CHE_ADDR(0x8d) --#define DTMB_CHE_MC_SC_TIMING_POWTHR DTMB_CHE_ADDR(0x8e) --#define DTMB_CHE_MC_SC_PROTECT_GD DTMB_CHE_ADDR(0x8f) --#define DTMB_CHE_TIMING_LIMIT DTMB_CHE_ADDR(0x90) --#define DTMB_CHE_TPS_CONFIG DTMB_CHE_ADDR(0x91) --#define DTMB_CHE_FD_TD_STEPSIZE DTMB_CHE_ADDR(0x92) --#define DTMB_CHE_QSTEP_SET DTMB_CHE_ADDR(0x93) --#define DTMB_CHE_SEG_CONFIG DTMB_CHE_ADDR(0x94) --#define DTMB_CHE_FD_TD_LEAKSIZE_CONFIG1 DTMB_CHE_ADDR(0x95) --#define DTMB_CHE_FD_TD_LEAKSIZE_CONFIG2 DTMB_CHE_ADDR(0x96) --#define DTMB_CHE_FD_TD_COEFF DTMB_CHE_ADDR(0x97) --#define DTMB_CHE_M_CCI_THR_CONFIG1 DTMB_CHE_ADDR(0x98) --#define DTMB_CHE_M_CCI_THR_CONFIG2 DTMB_CHE_ADDR(0x99) --#define DTMB_CHE_M_CCI_THR_CONFIG3 DTMB_CHE_ADDR(0x9a) --#define DTMB_CHE_CCIDET_CONFIG DTMB_CHE_ADDR(0x9b) --#define DTMB_CHE_IBDFE_CONFIG1 DTMB_CHE_ADDR(0x9d) --#define DTMB_CHE_IBDFE_CONFIG2 DTMB_CHE_ADDR(0x9e) --#define DTMB_CHE_IBDFE_CONFIG3 DTMB_CHE_ADDR(0x9f) --#define DTMB_CHE_TD_COEFF DTMB_CHE_ADDR(0xa0) --#define DTMB_CHE_FD_TD_STEPSIZE_ADJ DTMB_CHE_ADDR(0xa1) --#define DTMB_CHE_FD_COEFF_FRZ DTMB_CHE_ADDR(0xa2) --#define DTMB_CHE_FD_COEFF DTMB_CHE_ADDR(0xa3) --#define DTMB_CHE_FD_LEAKSIZE DTMB_CHE_ADDR(0xa4) --#define DTMB_CHE_IBDFE_CONFIG4 DTMB_CHE_ADDR(0xa5) --#define DTMB_CHE_IBDFE_CONFIG5 DTMB_CHE_ADDR(0xa6) --#define DTMB_CHE_IBDFE_CONFIG6 DTMB_CHE_ADDR(0xa7) --#define DTMB_CHE_IBDFE_CONFIG7 DTMB_CHE_ADDR(0xa8) --#define DTMB_CHE_DCM_SC_MC_GD_LEN DTMB_CHE_ADDR(0xa9) --#define DTMB_CHE_EQMC_PICK_THR DTMB_CHE_ADDR(0xaa) --#define DTMB_CHE_EQMC_THRESHOLD DTMB_CHE_ADDR(0xab) --#define DTMB_CHE_EQSC_PICK_THR DTMB_CHE_ADDR(0xad) --#define DTMB_CHE_EQSC_THRESHOLD DTMB_CHE_ADDR(0xae) --#define DTMB_CHE_PROTECT_GD_TPS DTMB_CHE_ADDR(0xaf) --#define DTMB_CHE_FD_TD_STEPSIZE_THR1 DTMB_CHE_ADDR(0xb0) --#define DTMB_CHE_TDFD_SWITCH_SYM1 DTMB_CHE_ADDR(0xb1) --#define DTMB_CHE_TDFD_SWITCH_SYM2 DTMB_CHE_ADDR(0xb2) --#define DTMB_CHE_EQ_CONFIG DTMB_CHE_ADDR(0xb3) --#define DTMB_CHE_EQSC_SNR_IMP_THR1 DTMB_CHE_ADDR(0xb4) --#define DTMB_CHE_EQSC_SNR_IMP_THR2 DTMB_CHE_ADDR(0xb5) --#define DTMB_CHE_EQMC_SNR_IMP_THR1 DTMB_CHE_ADDR(0xb6) --#define DTMB_CHE_EQMC_SNR_IMP_THR2 DTMB_CHE_ADDR(0xb7) --#define DTMB_CHE_EQSC_SNR_DROP_THR DTMB_CHE_ADDR(0xb8) --#define DTMB_CHE_EQMC_SNR_DROP_THR DTMB_CHE_ADDR(0xb9) --#define DTMB_CHE_M_CCI_THR DTMB_CHE_ADDR(0xba) --#define DTMB_CHE_TPS_MC DTMB_CHE_ADDR(0xbb) --#define DTMB_CHE_TPS_SC DTMB_CHE_ADDR(0xbc) --#define DTMB_CHE_CHE_SET_FSM DTMB_CHE_ADDR(0xbd) --#define DTMB_CHE_ZERO_NUM_THR DTMB_CHE_ADDR(0xbe) --#define DTMB_CHE_TIMING_READY DTMB_CHE_ADDR(0xbf) -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_che_bit.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_che_bit.h -deleted file mode 100644 -index edb848c..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_che_bit.h -+++ /dev/null -@@ -1,247 +0,0 @@ --#ifndef __ADDR_DTMB_CHE_BIT_H__ --#define __ADDR_DTMB_CHE_BIT_H__ -- --struct DTMB_CHE_TE_HREB_SNR_BITS { -- unsigned int te_hreb_snr:21, reserved0:11; --}; --struct DTMB_CHE_MC_SC_TIMING_POWTHR_BITS { -- unsigned int mc_timing_powthr1:5, -- reserved1:3, -- mc_timing_powthr0:5, -- reserved2:2, -- sc_timing_powthr1:5, reserved3:4, sc_timing_powthr0:5, reserved4:3; --}; --struct DTMB_CHE_MC_SC_PROTECT_GD_BITS { -- unsigned int h_valid:2, -- reserved5:2, -- dist:3, -- reserved6:1, -- ma_size:3, -- reserved7:1, -- mc_protect_gd:5, reserved8:3, sc_protect_gd:5, reserved9:7; --}; --struct DTMB_CHE_TIMING_LIMIT_BITS { -- unsigned int ncoh_thd:3, -- reserved10:1, -- coh_thd:3, -- reserved11:1, -- strong_loc_thd:8, reserved12:4, timing_limit:5, reserved13:7; --}; --struct DTMB_CHE_TPS_CONFIG_BITS { -- unsigned int tps_pst_num:5, -- reserved14:3, -- tps_pre_num:5, reserved15:3, chi_power_thr:8, reserved16:8; --}; --struct DTMB_CHE_FD_TD_STEPSIZE_BITS { -- unsigned int fd_stepsize_thr03:5, -- fd_stepsize_thr02:5, -- fd_stepsize_thr01:5, -- td_stepsize_thr03:5, -- td_stepsize_thr02:5, td_stepsize_thr01:5, reserved17:2; --}; --struct DTMB_CHE_QSTEP_SET_BITS { -- unsigned int factor_stable_thres:10, -- reserved18:2, qstep_set:13, qstep_set_val:1, reserved19:6; --}; --struct DTMB_CHE_SEG_CONFIG_BITS { -- unsigned int seg_bypass:1, -- seg_num_1seg_log2:3, -- seg_alpha:3, -- seg_read_val:1, seg_read_addr:12, noise_input_shift:4, reserved20:8; --}; --struct DTMB_CHE_FD_TD_LEAKSIZE_CONFIG1_BITS { -- unsigned int fd_leaksize_thr03:5, -- fd_leaksize_thr02:5, -- fd_leaksize_thr01:5, -- td_leaksize_thr03:5, -- td_leaksize_thr02:5, td_leaksize_thr01:5, reserved21:2; --}; --struct DTMB_CHE_FD_TD_LEAKSIZE_CONFIG2_BITS { -- unsigned int fd_leaksize_thr13:5, -- fd_leaksize_thr12:5, -- fd_leaksize_thr11:5, -- td_leaksize_thr13:5, -- td_leaksize_thr12:5, td_leaksize_thr11:5, reserved22:2; --}; --struct DTMB_CHE_FD_TD_COEFF_BITS { -- unsigned int td_coeff_frz:14, -- reserved23:2, -- td_coeff_addr:4, -- td_coeff_init:1, -- td_coeff_rst:1, -- fd_coeff_init:1, -- fd_coeff_done:1, -- fd_coeff_rst:1, td_coeff_done:1, fd_coeff_addr:5, reserved24:1; --}; --struct DTMB_CHE_M_CCI_THR_CONFIG1_BITS { -- unsigned int m_cci_thr_mc1:10, -- m_cci_thr_mc2:10, m_cci_thr_mc3:10, reserved25:2; --}; --struct DTMB_CHE_M_CCI_THR_CONFIG2_BITS { -- unsigned int m_cci_thr_sc2:10, -- m_cci_thr_sc3:10, m_cci_thr_mc0:10, reserved26:2; --}; --struct DTMB_CHE_M_CCI_THR_CONFIG3_BITS { -- unsigned int m_cci_thr_ma:10, -- m_cci_thr_sc0:10, m_cci_thr_sc1:10, reserved27:2; --}; --struct DTMB_CHE_CCIDET_CONFIG_BITS { -- unsigned int ccidet_dly:7, -- ccidet_malpha:3, -- ccidet_sc_mask_rng:5, -- ccidet_mc_mask_rng:5, -- ccidet_masize:4, -- ccidect_sat_sft:3, -- ccicnt_out_sel:2, tune_mask:1, m_cci_bypass:1, reserved28:1; --}; --struct DTMB_CHE_IBDFE_CONFIG1_BITS { -- unsigned int ibdfe_cci_just_thr:13, -- reserved29:3, -- ibdfe_dmsg_point:5, reserved30:3, ibdfe_dmsg_alp:3, reserved31:5; --}; --struct DTMB_CHE_IBDFE_CONFIG2_BITS { -- unsigned int ibdfe_rou_rat_1:10, -- reserved32:6, ibdfe_rou_rat_0:10, reserved33:6; --}; --struct DTMB_CHE_IBDFE_CONFIG3_BITS { -- unsigned int ibdfe_rou_rat_3:10, -- reserved34:6, ibdfe_rou_rat_2:10, reserved35:6; --}; --struct DTMB_CHE_TD_COEFF_BITS { -- unsigned int td_coeff:24, reserved36:8; --}; --struct DTMB_CHE_FD_TD_STEPSIZE_ADJ_BITS { -- unsigned int fd_stepsize_adj:3, td_stepsize_adj:3, reserved37:26; --}; --struct DTMB_CHE_FD_COEFF_BITS { -- unsigned int fd_coeff:24, reserved38:8; --}; --struct DTMB_CHE_FD_LEAKSIZE_BITS { -- unsigned int fd_leaksize:18, reserved39:14; --}; --struct DTMB_CHE_IBDFE_CONFIG4_BITS { -- unsigned int ibdfe_fdbk_iter:4, -- ibdfe_eqout_iter:4, -- eq_dist_thr_tps:4, -- eq_soft_slicer_en:1, -- reserved40:3, -- gd_len:5, ibdfe_blank_y:1, reserved41:1, ibdfe_dmsg_start_cnt:9; --}; --struct DTMB_CHE_IBDFE_CONFIG5_BITS { -- unsigned int ibdfe_init_snr:12, -- reserved42:4, eq_init_snr:12, reserved43:4; --}; --struct DTMB_CHE_IBDFE_CONFIG6_BITS { -- unsigned int ibdfe_const_thr3:4, -- ibdfe_const_thr2:4, -- ibdfe_const_thr1:4, -- ibdfe_const_thr0:4, -- ibdfe_threshold3:4, -- ibdfe_threshold2:4, ibdfe_threshold1:4, ibdfe_threshold0:4; --}; --struct DTMB_CHE_IBDFE_CONFIG7_BITS { -- unsigned int ibdfe_pick_thr3:8, -- ibdfe_pick_thr2:8, ibdfe_pick_thr1:8, ibdfe_pick_thr0:8; --}; --struct DTMB_CHE_DCM_SC_MC_GD_LEN_BITS { -- unsigned int dcm_mc_gd_len:6, -- reserved44:2, dcm_sc_gd_len:6, reserved45:2, eq_dsnr_slc2drm:16; --}; --struct DTMB_CHE_EQMC_PICK_THR_BITS { -- unsigned int eqmc_pick_thr3:8, -- eqmc_pick_thr2:8, eqmc_pick_thr1:8, eqmc_pick_thr0:8; --}; --struct DTMB_CHE_EQMC_THRESHOLD_BITS { -- unsigned int eqmc_const_thr3:4, -- eqmc_const_thr2:4, -- eqmc_const_thr1:4, -- eqmc_const_thr0:4, -- eqmc_threshold3:4, -- eqmc_threshold2:4, eqmc_threshold1:4, eqmc_threshold0:4; --}; --struct DTMB_CHE_EQSC_PICK_THR_BITS { -- unsigned int eqsc_pick_thr3:8, -- eqsc_pick_thr2:8, eqsc_pick_thr1:8, eqsc_pick_thr0:8; --}; --struct DTMB_CHE_EQSC_THRESHOLD_BITS { -- unsigned int eqsc_const_thr3:4, -- eqsc_const_thr2:4, -- eqsc_const_thr1:4, -- eqsc_const_thr0:4, -- eqsc_threshold3:4, -- eqsc_threshold2:4, eqsc_threshold1:4, eqsc_threshold0:4; --}; --struct DTMB_CHE_PROTECT_GD_TPS_BITS { -- unsigned int pow_norm:10, -- ncoh_thd_tps:3, -- coh_thd_tps:3, thr_max:10, protect_gd_tps:5, reserved46:1; --}; --struct DTMB_CHE_FD_TD_STEPSIZE_THR1_BITS { -- unsigned int fd_stepsize_thr13:5, -- fd_stepsize_thr12:5, -- fd_stepsize_thr11:5, -- td_stepsize_thr13:5, -- td_stepsize_thr12:5, td_stepsize_thr11:5, reserved47:2; --}; --struct DTMB_CHE_TDFD_SWITCH_SYM1_BITS { -- unsigned int tdfd_switch_sym00:16, tdfd_switch_sym01:16; --}; --struct DTMB_CHE_TDFD_SWITCH_SYM2_BITS { -- unsigned int tdfd_switch_sym10:16, tdfd_switch_sym11:16; --}; --struct DTMB_CHE_EQ_CONFIG_BITS { -- unsigned int eq_dsnr_h2drm:6, -- eq_cmp_en:1, -- eq_imp_setzero_en:1, -- dcm_sc_bypass:1, -- dcm_mc_bypass:1, -- dcm_sc_h_limit:4, -- dcm_mc_h_limit:4, -- eqsnr_imp_alp:3, eqsnr_avg_alp:3, dcm_alpha:2, reserved48:6; --}; --struct DTMB_CHE_EQSC_SNR_IMP_THR1_BITS { -- unsigned int eqsc_snr_imp_thr1:12, eqsc_snr_imp_thr0:12, reserved49:8; --}; --struct DTMB_CHE_EQSC_SNR_IMP_THR2_BITS { -- unsigned int eqsc_snr_imp_thr3:12, eqsc_snr_imp_thr2:12, reserved50:8; --}; --struct DTMB_CHE_EQMC_SNR_IMP_THR1_BITS { -- unsigned int eqmc_snr_imp_thr1:12, eqmc_snr_imp_thr0:12, reserved51:8; --}; --struct DTMB_CHE_EQMC_SNR_IMP_THR2_BITS { -- unsigned int eqmc_snr_imp_thr3:12, eqmc_snr_imp_thr2:12, reserved52:8; --}; --struct DTMB_CHE_EQSC_SNR_DROP_THR_BITS { -- unsigned int eqsc_snr_drop_thr3:8, -- eqsc_snr_drop_thr2:8, eqsc_snr_drop_thr1:8, eqsc_snr_drop_thr0:8; --}; --struct DTMB_CHE_EQMC_SNR_DROP_THR_BITS { -- unsigned int eqmc_snr_drop_thr3:8, -- eqmc_snr_drop_thr2:8, eqmc_snr_drop_thr1:8, eqmc_snr_drop_thr0:8; --}; --struct DTMB_CHE_M_CCI_THR_BITS { -- unsigned int ccidet_mask_rng_tps:5, -- m_cci_thr_tps:10, m_cci_thr_ma_tps:10, reserved53:7; --}; --struct DTMB_CHE_TPS_MC_BITS { -- unsigned int tps_mc_run_tim_limit:10, -- tps_mc_suc_limit:7, tps_mc_q_thr:7, tps_mc_alpha:3, reserved54:5; --}; --struct DTMB_CHE_TPS_SC_BITS { -- unsigned int tps_sc_run_tim_limit:10, -- tps_sc_suc_limit:7, tps_sc_q_thr:7, tps_sc_alpha:3, reserved55:5; --}; --struct DTMB_CHE_CHE_SET_FSM_BITS { -- unsigned int che_open_loop_len:12, -- reserved56:4, -- che_set_fsm_st:3, reserved57:1, che_set_fsm_en:1, reserved58:11; --}; --struct DTMB_CHE_ZERO_NUM_THR_BITS { -- unsigned int null_frame_thr:16, zero_num_thr:12, reserved59:4; --}; --struct DTMB_CHE_TIMING_READY_BITS { -- unsigned int timing_offset:11, -- reserved60:5, timing_ready:1, reserved61:15; --}; -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_front.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_front.h -deleted file mode 100644 -index aa404a5..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_front.h -+++ /dev/null -@@ -1,48 +0,0 @@ --#ifndef __ADDR_DTMB_FRONT_H__ --#define __ADDR_DTMB_FRONT_H__ -- --#include "addr_dtmb_top.h" -- --#define DTMB_FRONT_ADDR(x) (DTMB_DEMOD_BASE + (x << 2)) -- --#define DTMB_FRONT_AFIFO_ADC DTMB_FRONT_ADDR(0x20) --#define DTMB_FRONT_AGC_CONFIG1 DTMB_FRONT_ADDR(0x21) --#define DTMB_FRONT_AGC_CONFIG2 DTMB_FRONT_ADDR(0x22) --#define DTMB_FRONT_AGC_CONFIG3 DTMB_FRONT_ADDR(0x23) --#define DTMB_FRONT_AGC_CONFIG4 DTMB_FRONT_ADDR(0x24) --#define DTMB_FRONT_DDC_BYPASS DTMB_FRONT_ADDR(0x25) --#define DTMB_FRONT_DC_HOLD DTMB_FRONT_ADDR(0x28) --#define DTMB_FRONT_DAGC_TARGET_POWER DTMB_FRONT_ADDR(0x29) --#define DTMB_FRONT_ACF_BYPASS DTMB_FRONT_ADDR(0x2a) --#define DTMB_FRONT_COEF_SET1 DTMB_FRONT_ADDR(0x2b) --#define DTMB_FRONT_COEF_SET2 DTMB_FRONT_ADDR(0x2c) --#define DTMB_FRONT_COEF_SET3 DTMB_FRONT_ADDR(0x2d) --#define DTMB_FRONT_COEF_SET4 DTMB_FRONT_ADDR(0x2e) --#define DTMB_FRONT_COEF_SET5 DTMB_FRONT_ADDR(0x2f) --#define DTMB_FRONT_COEF_SET6 DTMB_FRONT_ADDR(0x30) --#define DTMB_FRONT_COEF_SET7 DTMB_FRONT_ADDR(0x31) --#define DTMB_FRONT_COEF_SET8 DTMB_FRONT_ADDR(0x32) --#define DTMB_FRONT_COEF_SET9 DTMB_FRONT_ADDR(0x33) --#define DTMB_FRONT_COEF_SET10 DTMB_FRONT_ADDR(0x34) --#define DTMB_FRONT_COEF_SET11 DTMB_FRONT_ADDR(0x35) --#define DTMB_FRONT_COEF_SET12 DTMB_FRONT_ADDR(0x36) --#define DTMB_FRONT_COEF_SET13 DTMB_FRONT_ADDR(0x37) --#define DTMB_FRONT_COEF_SET14 DTMB_FRONT_ADDR(0x38) --#define DTMB_FRONT_COEF_SET15 DTMB_FRONT_ADDR(0x39) --#define DTMB_FRONT_COEF_SET16 DTMB_FRONT_ADDR(0x3a) --#define DTMB_FRONT_COEF_SET17 DTMB_FRONT_ADDR(0x3b) --#define DTMB_FRONT_COEF_SET18 DTMB_FRONT_ADDR(0x3c) --#define DTMB_FRONT_COEF_SET19 DTMB_FRONT_ADDR(0x3d) --#define DTMB_FRONT_SRC_CONFIG1 DTMB_FRONT_ADDR(0x3e) --#define DTMB_FRONT_SRC_CONFIG2 DTMB_FRONT_ADDR(0x3f) --#define DTMB_FRONT_SFIFO_OUT_LEN DTMB_FRONT_ADDR(0x40) --#define DTMB_FRONT_DAGC_GAIN DTMB_FRONT_ADDR(0x41) --#define DTMB_FRONT_IQIB_STEP DTMB_FRONT_ADDR(0x42) --#define DTMB_FRONT_IQIB_CONFIG DTMB_FRONT_ADDR(0x43) --#define DTMB_FRONT_ST_CONFIG DTMB_FRONT_ADDR(0x44) --#define DTMB_FRONT_ST_FREQ DTMB_FRONT_ADDR(0x45) -- --#define DTMB_FRONT_DEBUG_CFG DTMB_FRONT_ADDR(0x48) --#define DTMB_FRONT_MEM_ADDR DTMB_FRONT_ADDR(0x49) -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_front_bit.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_front_bit.h -deleted file mode 100644 -index b6df7f6..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_front_bit.h -+++ /dev/null -@@ -1,312 +0,0 @@ --#ifndef __ADDR_DTMB_FRONT_BIT_H__ --#define __ADDR_DTMB_FRONT_BIT_H__ -- --union DTMB_FRONT_AFIFO_ADC_BITS { -- unsigned int d32; -- struct { -- unsigned int afifo_nco_rate:8, -- afifo_data_format:1, -- afifo_bypass:1, -- adc_sample:6, -- adc_IQ:1, -- reserved0:15; -- } b; --}; --struct DTMB_FRONT_AGC_CONFIG1_BITS { -- unsigned int agc_target:4, -- agc_cal_intv:2, -- reserved1:2, -- agc_gain_step2:6, -- reserved2:2, -- agc_gain_step1:6, -- reserved3:2, -- agc_a_filter_coef2:3, -- reserved4:1, -- agc_a_filter_coef1:3, -- reserved5:1; --}; --struct DTMB_FRONT_AGC_CONFIG2_BITS { -- unsigned int agc_imp_thresh:4, -- agc_imp_en:1, -- agc_iq_exchange:1, -- reserved6:2, -- agc_clip_ratio:5, -- reserved7:3, -- agc_signal_clip_thr:6, -- reserved8:2, -- agc_sd_rate:7, -- reserved9:1; --}; --struct DTMB_FRONT_AGC_CONFIG3_BITS { -- unsigned int agc_rffb_value:11, -- reserved10:1, -- agc_iffb_value:11, -- reserved11:1, -- agc_gain_step_rf:1, -- agc_rfgain_freeze:1, -- agc_tuning_slope:1, -- agc_rffb_set:1, -- agc_gain_step_if:1, -- agc_ifgain_freeze:1, -- agc_if_only:1, -- agc_iffb_set:1; --}; --struct DTMB_FRONT_AGC_CONFIG4_BITS { -- unsigned int agc_rffb_gain_sat_i:8, -- agc_rffb_gain_sat:8, -- agc_iffb_gain_sat_i:8, -- agc_iffb_gain_sat:8; --}; --struct DTMB_FRONT_DDC_BYPASS_BITS { -- unsigned int ddc_phase:25, -- reserved12:3, -- ddc_bypass:1, -- reserved13:3; --}; --struct DTMB_FRONT_DC_HOLD_BITS { -- unsigned int dc_hold:1, -- dc_alpha:3, -- mobi_det_accu_len:3, -- reserved14:1, -- mobi_det_observe_len:3, -- reserved15:1, -- channel_static_th:4, -- channel_portable_th:4, -- dc_bypass:1, -- reserved16:3, -- dc_len:3, -- reserved17:5; --}; --struct DTMB_FRONT_DAGC_TARGET_POWER_BITS { -- unsigned int dagc_target_power_l:8, -- dagc_target_power_h:8, -- dagc_target_power_ler:8, -- dagc_target_power_her:8; --}; --struct DTMB_FRONT_ACF_BYPASS_BITS { -- unsigned int coef65:11, -- reserved18:1, -- coef66:11, -- reserved19:1, -- acf_bypass:1, -- reserved20:7; --}; --struct DTMB_FRONT_COEF_SET1_BITS { -- unsigned int coef63:11, -- reserved21:1, -- coef64:11, -- reserved22:9; --}; --struct DTMB_FRONT_COEF_SET2_BITS { -- unsigned int coef62:10, -- reserved23:22; --}; --struct DTMB_FRONT_COEF_SET3_BITS { -- unsigned int coef60:10, -- reserved24:2, -- coef61:10, -- reserved25:10; --}; --struct DTMB_FRONT_COEF_SET4_BITS { -- unsigned int coef59:9, -- reserved26:23; --}; --struct DTMB_FRONT_COEF_SET5_BITS { -- unsigned int coef57:9, -- reserved27:3, -- coef58:9, -- reserved28:11; --}; --struct DTMB_FRONT_COEF_SET6_BITS { -- unsigned int coef54:8, -- coef55:8, -- coef56:8, -- reserved29:8; --}; --struct DTMB_FRONT_COEF_SET7_BITS { -- unsigned int coef53:7, -- reserved30:25; --}; --struct DTMB_FRONT_COEF_SET8_BITS { -- unsigned int coef49:7, -- reserved31:1, -- coef50:7, -- reserved32:1, -- coef51:7, -- reserved33:1, -- coef52:7, -- reserved34:1; --}; --struct DTMB_FRONT_COEF_SET9_BITS { -- unsigned int coef45:7, -- reserved35:1, -- coef46:7, -- reserved36:1, -- coef47:7, -- reserved37:1, -- coef48:7, -- reserved38:1; --}; --struct DTMB_FRONT_COEF_SET10_BITS { -- unsigned int coef42:6, -- reserved39:2, -- coef43:6, -- reserved40:2, -- coef44:6, -- reserved41:10; --}; --struct DTMB_FRONT_COEF_SET11_BITS { -- unsigned int coef38:6, -- reserved42:2, -- coef39:6, -- reserved43:2, -- coef40:6, -- reserved44:2, -- coef41:6, -- reserved45:2; --}; --struct DTMB_FRONT_COEF_SET12_BITS { -- unsigned int coef34:6, -- reserved46:2, -- coef35:6, -- reserved47:2, -- coef36:6, -- reserved48:2, -- coef37:6, -- reserved49:2; --}; --struct DTMB_FRONT_COEF_SET13_BITS { -- unsigned int coef30:6, -- reserved50:2, -- coef31:6, -- reserved51:2, -- coef32:6, -- reserved52:2, -- coef33:6, -- reserved53:2; --}; --struct DTMB_FRONT_COEF_SET14_BITS { -- unsigned int coef27:5, -- reserved54:3, -- coef28:5, -- reserved55:3, -- coef29:5, -- reserved56:11; --}; --struct DTMB_FRONT_COEF_SET15_BITS { -- unsigned int coef23:5, -- reserved57:3, -- coef24:5, -- reserved58:3, -- coef25:5, -- reserved59:3, -- coef26:5, -- reserved60:3; --}; --struct DTMB_FRONT_COEF_SET16_BITS { -- unsigned int coef19:5, -- reserved61:3, -- coef20:5, -- reserved62:3, -- coef21:5, -- reserved63:3, -- coef22:5, -- reserved64:3; --}; --struct DTMB_FRONT_COEF_SET17_BITS { -- unsigned int coef15:5, -- reserved65:3, -- coef16:5, -- reserved66:3, -- coef17:5, -- reserved67:3, -- coef18:5, -- reserved68:3; --}; --struct DTMB_FRONT_COEF_SET18_BITS { -- unsigned int coef08:4, -- coef09:4, -- coef10:4, -- coef11:4, -- coef12:4, -- coef13:4, -- coef14:4, -- reserved69:4; --}; --struct DTMB_FRONT_COEF_SET19_BITS { -- unsigned int coef00:4, -- coef01:4, -- coef02:4, -- coef03:4, -- coef04:4, -- coef05:4, -- coef06:4, -- coef07:4; --}; --struct DTMB_FRONT_SRC_CONFIG1_BITS { -- unsigned int src_norm_inrate:24, -- src_tim_shr:4, -- src_ted_disable:1, -- reserved70:3; --}; --struct DTMB_FRONT_SRC_CONFIG2_BITS { -- unsigned int src_stable_timeout:4, -- src_seg_len:3, -- reserved71:1, -- src_ted_beta:3, -- reserved72:1, -- src_time_err_thr:4, -- src_time_mu1:5, -- reserved73:3, -- src_time_mu2:5, -- reserved74:3; --}; --struct DTMB_FRONT_SFIFO_OUT_LEN_BITS { -- unsigned int sfifo_out_len:4, -- reserved75:28; --}; --struct DTMB_FRONT_DAGC_GAIN_BITS { -- unsigned int dagc_bypass:1, -- dagc_power_alpha:2, -- dagc_bw:3, -- dagc_gain_ctrl:12, -- dagc_gain_step_er:6, -- dagc_gain_step:6, -- reserved76:2; --}; --struct DTMB_FRONT_IQIB_STEP_BITS { -- unsigned int iqib_step_b:2, -- iqib_step_a:2, -- iqib_period:3, -- reserved77:1, -- iqib_bypass:1, -- reserved78:23; --}; --struct DTMB_FRONT_IQIB_CONFIG_BITS { -- unsigned int iqib_set_b:12, -- iqib_set_a:10, -- reserved79:2, -- iqib_set_val:1, -- iqib_hold:1, -- reserved80:6; --}; --struct DTMB_FRONT_ST_CONFIG_BITS { -- unsigned int st_enable:1, -- reserved81:3, -- st_dc_len:3, -- reserved82:1, -- st_alpha:3, -- reserved83:1, -- st_Q_thrsh:8, -- st_dist:3, -- reserved84:1, -- st_len:5, -- reserved85:3; --}; --struct DTMB_FRONT_ST_FREQ_BITS { -- unsigned int st_freq_v:1, -- st_freq_i:19, -- reserved86:12; --}; -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_sync.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_sync.h -deleted file mode 100644 -index 0455a4e..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_sync.h -+++ /dev/null -@@ -1,34 +0,0 @@ --#ifndef __ADDR_DTMB_SYNC_H__ --#define __ADDR_DTMB_SYNC_H__ -- --#include "addr_dtmb_top.h" --#define DTMB_SYNC_ADDR(x) (DTMB_DEMOD_BASE + (x << 2)) -- --#define DTMB_SYNC_TS_CFO_PN_VALUE DTMB_SYNC_ADDR(0x57) --#define DTMB_SYNC_TS_CFO_ERR_LIMIT DTMB_SYNC_ADDR(0x58) --#define DTMB_SYNC_TS_CFO_PN_MODIFY DTMB_SYNC_ADDR(0x59) --#define DTMB_SYNC_TS_GAIN DTMB_SYNC_ADDR(0x5a) --#define DTMB_SYNC_FE_CONFIG DTMB_SYNC_ADDR(0x5b) --#define DTMB_SYNC_PNPHASE_OFFSET DTMB_SYNC_ADDR(0x5c) --#define DTMB_SYNC_PNPHASE_CONFIG DTMB_SYNC_ADDR(0x5d) --#define DTMB_SYNC_SFO_SFO_PN0_MODIFY DTMB_SYNC_ADDR(0x5e) --#define DTMB_SYNC_SFO_SFO_PN1_MODIFY DTMB_SYNC_ADDR(0x5f) --#define DTMB_SYNC_SFO_SFO_PN2_MODIFY DTMB_SYNC_ADDR(0x60) --#define DTMB_SYNC_SFO_CONFIG DTMB_SYNC_ADDR(0x61) --#define DTMB_SYNC_FEC_CFG DTMB_SYNC_ADDR(0x67) --#define DTMB_SYNC_FEC_DEBUG_CFG DTMB_SYNC_ADDR(0x68) --#define DTMB_SYNC_DATA_DDR_ADR DTMB_SYNC_ADDR(0x69) --#define DTMB_SYNC_DEBUG_DDR_ADR DTMB_SYNC_ADDR(0x6a) --#define DTMB_SYNC_FEC_SIM_CFG1 DTMB_SYNC_ADDR(0x6b) --#define DTMB_SYNC_FEC_SIM_CFG2 DTMB_SYNC_ADDR(0x6c) --#define DTMB_SYNC_TRACK_CFO_MAX DTMB_SYNC_ADDR(0x6d) --#define DTMB_SYNC_CCI_DAGC_CONFIG1 DTMB_SYNC_ADDR(0x6e) --#define DTMB_SYNC_CCI_DAGC_CONFIG2 DTMB_SYNC_ADDR(0x6f) --#define DTMB_SYNC_CCI_RP DTMB_SYNC_ADDR(0x70) --#define DTMB_SYNC_CCI_DET_THRES DTMB_SYNC_ADDR(0x71) --#define DTMB_SYNC_CCI_NOTCH1_CONFIG1 DTMB_SYNC_ADDR(0x72) --#define DTMB_SYNC_CCI_NOTCH1_CONFIG2 DTMB_SYNC_ADDR(0x73) --#define DTMB_SYNC_CCI_NOTCH2_CONFIG1 DTMB_SYNC_ADDR(0x74) --#define DTMB_SYNC_CCI_NOTCH2_CONFIG2 DTMB_SYNC_ADDR(0x75) -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_sync_bit.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_sync_bit.h -deleted file mode 100644 -index 51c2517..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_sync_bit.h -+++ /dev/null -@@ -1,91 +0,0 @@ --#ifndef __ADDR_DTMB_SYNC_BIT_H__ --#define __ADDR_DTMB_SYNC_BIT_H__ -- --struct DTMB_SYNC_TS_CFO_PN_VALUE_BITS { -- unsigned int ts_cfo_pn1_value:16, ts_cfo_pn0_value:16; --}; --struct DTMB_SYNC_TS_CFO_ERR_LIMIT_BITS { -- unsigned int ts_cfo_err_limit:16, ts_cfo_pn2_value:16; --}; --struct DTMB_SYNC_TS_CFO_PN_MODIFY_BITS { -- unsigned int ts_cfo_pn1_modify:16, ts_cfo_pn0_modify:16; --}; --struct DTMB_SYNC_TS_GAIN_BITS { -- unsigned int ts_gain:2, -- reserved0:2, -- ts_sat_shift:3, -- reserved1:1, -- ts_fixpn_en:1, -- ts_fixpn:2, reserved2:1, ts_cfo_cut:4, ts_cfo_pn2_modify:16; --}; --struct DTMB_SYNC_FE_CONFIG_BITS { -- unsigned int fe_lock_len:4, -- fe_sat_shift:3, reserved3:1, fe_cut:4, reserved4:4, fe_modify:16; --}; --struct DTMB_SYNC_PNPHASE_OFFSET_BITS { -- unsigned int pnphase_offset2:4, -- pnphase_offset1:4, pnphase_offset0:4, reserved5:20; --}; --struct DTMB_SYNC_PNPHASE_CONFIG_BITS { -- unsigned int pnphase_gain:2, -- reserved6:2, -- pnphase_sat_shift:4, pnphase_cut:4, reserved7:4, pnphase_modify:16; --}; --struct DTMB_SYNC_SFO_SFO_PN0_MODIFY_BITS { -- unsigned int sfo_cfo_pn0_modify:16, sfo_sfo_pn0_modify:16; --}; --struct DTMB_SYNC_SFO_SFO_PN1_MODIFY_BITS { -- unsigned int sfo_cfo_pn1_modify:16, sfo_sfo_pn1_modify:16; --}; --struct DTMB_SYNC_SFO_SFO_PN2_MODIFY_BITS { -- unsigned int sfo_cfo_pn2_modify:16, sfo_sfo_pn2_modify:16; --}; --struct DTMB_SYNC_SFO_CONFIG_BITS { -- unsigned int sfo_sat_shift:4, -- sfo_gain:2, -- reserved8:2, -- sfo_dist:2, -- reserved9:2, -- sfo_cfo_cut:4, sfo_sfo_cut:4, sfo_cci_th:4, reserved10:8; --}; --struct DTMB_SYNC_TRACK_CFO_MAX_BITS { -- unsigned int track_cfo_max:8, -- track_sfo_max:8, track_max_en:1, ctrl_fe_to_th:4, reserved11:11; --}; --struct DTMB_SYNC_CCI_DAGC_CONFIG1_BITS { -- unsigned int cci_dagc_bypass:1, -- cci_dagc_power_alpha:2, -- cci_dagc_bw:3, -- cci_dagc_gain_ctrl:12, -- cci_dagc_gain_step_er:6, cci_dagc_gain_step:6, reserved12:2; --}; --struct DTMB_SYNC_CCI_DAGC_CONFIG2_BITS { -- unsigned int cci_dagc_target_power_l:8, -- cci_dagc_target_power_h:8, -- cci_dagc_target_power_ler:8, cci_dagc_target_power_her:8; --}; --struct DTMB_SYNC_CCI_RP_BITS { -- unsigned int cci_rpsq_n:10, reserved13:2, cci_rp_n:13, reserved14:7; --}; --struct DTMB_SYNC_CCI_DET_THRES_BITS { -- unsigned int cci_avr_times:5, -- reserved15:3, cci_det_thres:3, reserved16:21; --}; --struct DTMB_SYNC_CCI_NOTCH1_CONFIG1_BITS { -- unsigned int cci_notch1_a1:10, -- reserved17:2, cci_notch1_en:1, reserved18:19; --}; --struct DTMB_SYNC_CCI_NOTCH1_CONFIG2_BITS { -- unsigned int cci_notch1_b1:10, -- reserved19:2, cci_notch1_a2:10, reserved20:10; --}; --struct DTMB_SYNC_CCI_NOTCH2_CONFIG1_BITS { -- unsigned int cci_notch2_a1:10, -- reserved21:2, cci_notch2_en:1, reserved22:3, cci_mpthres:16; --}; --struct DTMB_SYNC_CCI_NOTCH2_CONFIG2_BITS { -- unsigned int cci_notch2_b1:10, -- reserved23:2, cci_notch2_a2:10, reserved24:10; --}; -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_top.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_top.h -deleted file mode 100644 -index 827c87a..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_top.h -+++ /dev/null -@@ -1,71 +0,0 @@ --#ifndef __ADDR_DTMB_TOP_H__ --#define __ADDR_DTMB_TOP_H__ -- --#include "addr_dtmb_top_bit.h" --#include "addr_dtmb_sync.h" --#include "addr_dtmb_sync_bit.h" --#include "addr_dtmb_che.h" --#include "addr_dtmb_che_bit.h" --#include "addr_dtmb_front.h" --#include "addr_dtmb_front_bit.h" -- --#define DTMB_DEMOD_BASE DEMOD_REG_ADDR(0x0) --#define DTMB_TOP_ADDR(x) (DTMB_DEMOD_BASE + (x << 2)) -- --#define DTMB_TOP_CTRL_SW_RST DTMB_TOP_ADDR(0x1) --#define DTMB_TOP_TESTBUS DTMB_TOP_ADDR(0x2) --#define DTMB_TOP_TB DTMB_TOP_ADDR(0x3) --#define DTMB_TOP_TB_V DTMB_TOP_ADDR(0x4) --#define DTMB_TOP_TB_ADDR_BEGIN DTMB_TOP_ADDR(0x5) --#define DTMB_TOP_TB_ADDR_END DTMB_TOP_ADDR(0x6) --#define DTMB_TOP_CTRL_ENABLE DTMB_TOP_ADDR(0x7) --#define DTMB_TOP_CTRL_LOOP DTMB_TOP_ADDR(0x8) --#define DTMB_TOP_CTRL_FSM DTMB_TOP_ADDR(0x9) --#define DTMB_TOP_CTRL_AGC DTMB_TOP_ADDR(0xa) --#define DTMB_TOP_CTRL_TS_SFO_CFO DTMB_TOP_ADDR(0xb) --#define DTMB_TOP_CTRL_FEC DTMB_TOP_ADDR(0xc) --#define DTMB_TOP_CTRL_INTLV_TIME DTMB_TOP_ADDR(0xd) --#define DTMB_TOP_CTRL_DAGC_CCI DTMB_TOP_ADDR(0xe) --#define DTMB_TOP_CTRL_TPS DTMB_TOP_ADDR(0xf) --#define DTMB_TOP_TPS_BIT DTMB_TOP_ADDR(0x10) --#define DTMB_TOP_CCI_FLG DTMB_TOP_ADDR(0xc7) --#define DTMB_TOP_TESTBUS_OUT DTMB_TOP_ADDR(0xc8) --#define DTMB_TOP_TBUS_DC_ADDR DTMB_TOP_ADDR(0xc9) --#define DTMB_TOP_FRONT_IQIB_CHECK DTMB_TOP_ADDR(0xca) --#define DTMB_TOP_SYNC_TS DTMB_TOP_ADDR(0xcb) --#define DTMB_TOP_SYNC_PNPHASE DTMB_TOP_ADDR(0xcd) --#define DTMB_TOP_CTRL_DDC_ICFO DTMB_TOP_ADDR(0xd2) --#define DTMB_TOP_CTRL_DDC_FCFO DTMB_TOP_ADDR(0xd3) --#define DTMB_TOP_CTRL_FSM_STATE0 DTMB_TOP_ADDR(0xd4) --#define DTMB_TOP_CTRL_FSM_STATE1 DTMB_TOP_ADDR(0xd5) --#define DTMB_TOP_CTRL_FSM_STATE2 DTMB_TOP_ADDR(0xd6) --#define DTMB_TOP_CTRL_FSM_STATE3 DTMB_TOP_ADDR(0xd7) --#define DTMB_TOP_CTRL_TS2 DTMB_TOP_ADDR(0xd8) --#define DTMB_TOP_FRONT_AGC DTMB_TOP_ADDR(0xd9) --#define DTMB_TOP_FRONT_DAGC DTMB_TOP_ADDR(0xda) --#define DTMB_TOP_FEC_TIME_STS DTMB_TOP_ADDR(0xdb) --#define DTMB_TOP_FEC_LDPC_STS DTMB_TOP_ADDR(0xdc) --#define DTMB_TOP_FEC_LDPC_IT_AVG DTMB_TOP_ADDR(0xdd) --#define DTMB_TOP_FEC_LDPC_UNC_ACC DTMB_TOP_ADDR(0xde) --#define DTMB_TOP_FEC_BCH_ACC DTMB_TOP_ADDR(0xdf) --#define DTMB_TOP_CTRL_ICFO_ALL DTMB_TOP_ADDR(0xe0) --#define DTMB_TOP_CTRL_FCFO_ALL DTMB_TOP_ADDR(0xe1) --#define DTMB_TOP_CTRL_SFO_ALL DTMB_TOP_ADDR(0xe2) --#define DTMB_TOP_FEC_LOCK_SNR DTMB_TOP_ADDR(0xe3) --#define DTMB_TOP_CHE_SEG_FACTOR DTMB_TOP_ADDR(0xe4) --#define DTMB_TOP_CTRL_CHE_WORKCNT DTMB_TOP_ADDR(0xe5) --#define DTMB_TOP_CHE_OBS_STATE1 DTMB_TOP_ADDR(0xe6) --#define DTMB_TOP_CHE_OBS_STATE2 DTMB_TOP_ADDR(0xe7) --#define DTMB_TOP_CHE_OBS_STATE3 DTMB_TOP_ADDR(0xe8) --#define DTMB_TOP_CHE_OBS_STATE4 DTMB_TOP_ADDR(0xe9) --#define DTMB_TOP_CHE_OBS_STATE5 DTMB_TOP_ADDR(0xea) --#define DTMB_TOP_SYNC_CCI_NF1 DTMB_TOP_ADDR(0xee) --#define DTMB_TOP_SYNC_CCI_NF2 DTMB_TOP_ADDR(0xef) --#define DTMB_TOP_SYNC_CCI_NF2_POSITION DTMB_TOP_ADDR(0xf0) --#define DTMB_TOP_CTRL_SYS_OFDM_CNT DTMB_TOP_ADDR(0xf1) --#define DTMB_TOP_CTRL_TPS_Q_FINAL DTMB_TOP_ADDR(0xf2) --#define DTMB_TOP_FRONT_DC DTMB_TOP_ADDR(0xf3) --#define DTMB_TOP_CHE_DEBUG DTMB_TOP_ADDR(0xf6) --#define DTMB_TOP_CTRL_TOTPS_READY_CNT DTMB_TOP_ADDR(0xff) -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_top_bit.h b/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_top_bit.h -deleted file mode 100644 -index 4a6df5d..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/addr_dtmb_top_bit.h -+++ /dev/null -@@ -1,159 +0,0 @@ --#ifndef __ADDR_DTMB_TOP_BIT_H__ --#define __ADDR_DTMB_TOP_BIT_H__ -- --union DTMB_TOP_CTRL_SW_RST_BITS { -- unsigned int d32; -- struct { -- unsigned int ctrl_sw_rst:1, ctrl_sw_rst_noreg:1, reserved0:30; -- } b; --}; --struct DTMB_TOP_TESTBUS_BITS { -- unsigned int testbus_addr:16, testbus_en:1, reserved1:15; --}; --struct DTMB_TOP_TB_BITS { -- unsigned int tb_act_width:5, -- reserved2:3, -- tb_dc_mk:3, -- reserved3:1, tb_capture_stop:1, tb_self_test:1, reserved4:18; --}; --struct DTMB_TOP_CTRL_ENABLE_BITS { -- unsigned int ctrl_enable:24, reserved5:8; --}; --struct DTMB_TOP_CTRL_LOOP_BITS { -- unsigned int ctrl_src_pnphase_loop:1, -- ctrl_src_sfo_loop:1, -- ctrl_ddc_fcfo_loop:1, ctrl_ddc_icfo_loop:1, reserved6:28; --}; --struct DTMB_TOP_CTRL_FSM_BITS { -- unsigned int ctrl_fsm_state:5, -- reserved7:3, -- ctrl_fsm_v:1, reserved8:3, ctrl_reset_state:4, reserved9:16; --}; --struct DTMB_TOP_CTRL_AGC_BITS { -- unsigned int ctrl_fast_agc:1, -- ctrl_agc_bypass:1, -- ts_cfo_bypass:1, sfo_strong0_bypass:1, reserved10:28; --}; --struct DTMB_TOP_CTRL_TS_SFO_CFO_BITS { -- unsigned int ctrl_ts_q:10, -- reserved11:2, -- ctrl_pnphase_q:7, reserved12:1, ctrl_sfo_q:4, ctrl_cfo_q:8; --}; --struct DTMB_TOP_CTRL_FEC_BITS { -- unsigned int reserved13:8, -- ctrl_ts_to_th:4, -- ctrl_pnphase_to_th:4, -- ctrl_sfo_to_th:4, -- ctrl_fe_to_th:4, ctrl_che_to_th:4, ctrl_fec_to_th:4; --}; --struct DTMB_TOP_CTRL_INTLV_TIME_BITS { -- unsigned int ctrl_intlv720_time:12, ctrl_intlv240_time:12, reserved14:8; --}; --struct DTMB_TOP_CTRL_DAGC_CCI_BITS { -- unsigned int dagc_mode:2, -- cci_dagc_mode:2, -- cci_bypass:1, -- fe_bypass:1, -- reserved15:1, -- new_sync1:1, new_sync2:1, fec_inzero_check:1, reserved16:22; --}; --struct DTMB_TOP_CTRL_TPS_BITS { -- unsigned int sfo_gain:2, -- freq_reverse:1, -- qam4_nr:1, -- intlv_mode:1, -- code_rate:2, -- constell:2, -- tps_carrier_mode:1, -- freq_reverse_known:1, tps_known:1, ctrl_tps_to_th:4, reserved17:16; --}; --struct DTMB_TOP_CCI_FLG_BITS { -- unsigned int cci_flg_cnt:8, m_cci_ready:1, reserved18:23; --}; --struct DTMB_TOP_FRONT_IQIB_CHECK_BITS { -- unsigned int front_iqib_check_b:12, -- front_iqib_check_a:10, reserved19:10; --}; --struct DTMB_TOP_SYNC_TS_BITS { -- unsigned int sync_ts_idx:2, sync_ts_pos:13, sync_ts_q:10, reserved20:7; --}; --struct DTMB_TOP_SYNC_PNPHASE_BITS { -- unsigned int sync_pnphase_max_q_idx:2, -- sync_pnphase:8, sync_pnphase_max_q:7, reserved21:15; --}; --struct DTMB_TOP_CTRL_DDC_ICFO_BITS { -- unsigned int ctrl_ddc_icfo:20, reserved22:12; --}; --struct DTMB_TOP_CTRL_DDC_FCFO_BITS { -- unsigned int ctrl_src_sfo:17, ctrl_ddc_fcfo:14, reserved23:1; --}; --struct DTMB_TOP_CTRL_TS2_BITS { -- unsigned int ctrl_ts2_workcnt:8, -- ctrl_pnphase_workcnt:8, ctrl_sfo_workcnt:8, sync_fe_workcnt:8; --}; --struct DTMB_TOP_FRONT_AGC_BITS { -- unsigned int front_agc_if_gain:11, -- front_agc_rf_gain:11, front_agc_power:10; --}; --struct DTMB_TOP_FRONT_DAGC_BITS { -- unsigned int front_dagc_power:8, front_dagc_gain:12, reserved24:12; --}; --struct DTMB_TOP_FEC_LDPC_IT_AVG_BITS { -- unsigned int fec_ldpc_it_avg:16, fec_ldpc_per_rpt:13, reserved25:3; --}; --struct DTMB_TOP_CTRL_ICFO_ALL_BITS { -- unsigned int ctrl_icfo_all:20, reserved26:12; --}; --struct DTMB_TOP_CTRL_FCFO_ALL_BITS { -- unsigned int ctrl_fcfo_all:20, reserved27:12; --}; --struct DTMB_TOP_CTRL_SFO_ALL_BITS { -- unsigned int ctrl_sfo_all:25, reserved28:7; --}; --struct DTMB_TOP_FEC_LOCK_SNR_BITS { -- unsigned int che_snr:14, -- fec_lock:1, reserved29:1, che_snr_average:14, reserved30:2; --}; --struct DTMB_TOP_CHE_SEG_FACTOR_BITS { -- unsigned int che_seg_factor:14, reserved31:18; --}; --struct DTMB_TOP_CTRL_CHE_WORKCNT_BITS { -- unsigned int ctrl_che_workcnt:8, -- ctrl_fec_workcnt:8, -- ctrl_constell:2, -- ctrl_code_rate:2, -- ctrl_intlv_mode:1, -- ctrl_qam4_nr:1, ctrl_freq_reverse:1, reserved32:9; --}; --struct DTMB_TOP_SYNC_CCI_NF1_BITS { -- unsigned int sync_cci_nf1_b1:10, -- sync_cci_nf1_a2:10, sync_cci_nf1_a1:10, reserved33:2; --}; --struct DTMB_TOP_SYNC_CCI_NF2_BITS { -- unsigned int sync_cci_nf2_b1:10, -- sync_cci_nf2_a2:10, sync_cci_nf2_a1:10, reserved34:2; --}; --struct DTMB_TOP_SYNC_CCI_NF2_POSITION_BITS { -- unsigned int sync_cci_nf2_position:11, -- sync_cci_nf1_position:11, -- sync_cci_nf2_det:1, sync_cci_nf1_det:1, reserved35:8; --}; --struct DTMB_TOP_CTRL_SYS_OFDM_CNT_BITS { -- unsigned int ctrl_sys_ofdm_cnt:8, -- mobi_det_power_var:19, -- reserved36:1, ctrl_che_working_state:2, reserved37:2; --}; --struct DTMB_TOP_CTRL_TPS_Q_FINAL_BITS { -- unsigned int ctrl_tps_q_final:7, ctrl_tps_suc_cnt:7, reserved38:18; --}; --struct DTMB_TOP_FRONT_DC_BITS { -- unsigned int front_dc_q:10, front_dc_i:10, reserved39:12; --}; --struct DTMB_TOP_CTRL_TOTPS_READY_CNT_BITS { -- unsigned int ctrl_dead_lock_det:1, -- ctrl_dead_lock:1, -- reserved40:2, -- ctrl_dead_cnt:4, reserved41:8, ctrl_totps_ready_cnt:16; --}; -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/aml_dtv_demod_reg.h b/drivers/amlogic/dvb_tv/amldemod/include/aml_dtv_demod_reg.h -deleted file mode 100644 -index 9c318b1..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/aml_dtv_demod_reg.h -+++ /dev/null -@@ -1,9 +0,0 @@ --#ifndef _DTV_REG_H_ --#define _DTV_REG_H_ -- --#include -- --#define DTV_WRITE_CBUS_REG(_r, _v) aml_write_cbus(_r, _v) --#define DTV_READ_CBUS_REG(_r) aml_read_cbus(_r) -- --#endif /* */ -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/amlfrontend.h b/drivers/amlogic/dvb_tv/amldemod/include/amlfrontend.h -deleted file mode 100644 -index 0114306..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/amlfrontend.h -+++ /dev/null -@@ -1,64 +0,0 @@ --/***************************************************************** --** --** Copyright (C) 2010 Amlogic,Inc. --** All rights reserved --** Filename : amlfrontend.h --** --** comment: --** Driver for aml demodulator --** --*****************************************************************/ -- --#ifndef _AMLFRONTEND_H --#define _AMLFRONTEND_H -- --struct amlfe_config { -- int fe_mode; -- int i2c_id; -- int tuner_type; -- int tuner_addr; --}; --enum Gxtv_Demod_Tuner_If { -- Si2176_5M_If = 5, -- Si2176_6M_If = 6 --}; --/* 0 -DVBC, 1-DVBT, ISDBT, 2-ATSC */ --enum Gxtv_Demod_Dvb_Mode { -- Gxtv_Dvbc = 0, -- Gxtv_Dvbt_Isdbt = 1, -- Gxtv_Atsc = 2, -- Gxtv_Dtmb = 3, --}; --#define Adc_Clk_35M 35714 /* adc clk dvbc */ --#define Demod_Clk_71M 71428 /* demod clk */ -- --#define Adc_Clk_24M 24000 --#define Demod_Clk_72M 72000 --#define Demod_Clk_60M 60000 -- --#define Adc_Clk_28M 28571 /* dvbt,isdbt */ --#define Demod_Clk_66M 66666 -- --#define Adc_Clk_26M 26000 /* atsc air */ --#define Demod_Clk_78M 78000 /* */ -- --#define Adc_Clk_25_2M 25200 /* atsc cable */ --#define Demod_Clk_75M 75600 /* */ -- --#define Adc_Clk_25M 25000 /* dtmb */ --#define Demod_Clk_100M 100000 /* */ --#define Demod_Clk_180M 180000 /* */ --#define Demod_Clk_200M 200000 /* */ --#define Demod_Clk_225M 225000 -- --#define Adc_Clk_27M 27777 /* atsc */ --#define Demod_Clk_83M 83333 /* */ -- --enum M6_Demod_Pll_Mode { -- Cry_mode = 0, -- Adc_mode = 1 --}; -- --int M6_Demod_Dtmb_Init(struct aml_fe_dev *dev); -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/include/demod_func.h b/drivers/amlogic/dvb_tv/amldemod/include/demod_func.h -deleted file mode 100644 -index 4587b09..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/include/demod_func.h -+++ /dev/null -@@ -1,604 +0,0 @@ --#ifdef DEMOD_FUNC_H --#else --#define DEMOD_FUNC_H -- --#include --/* #include */ --/*#include -- * #include -- #include */ --#include --#include "aml_fe.h" --#include "amlfrontend.h" --#include "addr_dtmb_top.h" --#include "c_stb_define.h" --#include "c_stb_regs_define.h" --#include -- --/* #define G9_TV */ --#define GX_TV --#define safe_addr -- --#define PWR_ON 1 --#define PWR_OFF 0 -- --#define dtmb_mobile_mode -- -- --/* void __iomem *meson_reg_demod_map[1024]; */ -- --#define IO_CBUS_PHY_BASE (0xc0800000) -- --#ifdef safe_addr --#define IO_DEMOD_BASE (0xc8844000) --#define IO_AOBUS_BASE (0xc8100000) --#define IO_HIU_BASE (0xc883c000) --#else --#define IO_DEMOD_BASE (0xda844000) --#define IO_AOBUS_BASE (0xda100000) --#define IO_HIU_BASE (0xda83c000) --#endif -- --#define DEMOD_REG_OFFSET(reg) (reg & 0xfffff) --#define DEMOD_REG_ADDR(reg) (IO_DEMOD_BASE + DEMOD_REG_OFFSET(reg)) -- --#define DEMOD_CBUS_REG_OFFSET(reg) (reg << 2) --#define DEMOD_CBUS_REG_ADDR(reg) (IO_CBUS_PHY_BASE + \ -- DEMOD_CBUS_REG_OFFSET(reg)) -- --#define DEMOD_AOBUS_REG_OFFSET(reg) ((reg)) --#define DEMOD_AOBUS_REG_ADDR(reg) (IO_AOBUS_BASE + \ -- DEMOD_AOBUS_REG_OFFSET(reg)) -- --/* #define DEMOD_BASE APB_REG_ADDR(0x20000) */ --#define DEMOD_BASE DEMOD_REG_ADDR(0x0) /* 0xc8020000 */ -- --/* #define DEMOD_BASE 0xc8020000 */ --#define DTMB_BASE (DEMOD_BASE + 0x000) --#define DVBT_BASE (DEMOD_BASE + 0x000) --#define ISDBT_BASE (DEMOD_BASE + 0x000) --#define QAM_BASE (DEMOD_BASE + 0x400) --#define ATSC_BASE (DEMOD_BASE + 0x800) --#define DEMOD_CFG_BASE (DEMOD_BASE + 0xC00) -- --/* #ifdef TXL_TV */ --#define TXLTV_ADC_RESET_VALUE 0xca6a2110 /* 0xce7a2110 */ --#define TXLTV_ADC_REG1_VALUE 0x5d414260 --#define TXLTV_ADC_REG2_VALUE 0x5ba00384 /* 0x34e0bf81 */ --#define TXLTV_ADC_REG2_VALUE_CRY 0x34e0bf81 --#define TXLTV_ADC_REG3_VALUE 0x4a6a2110 /* 0x4e7a2110 */ --#define TXLTV_ADC_REG4_VALUE 0x02913004 --#define TXLTV_ADC_REG4_CRY_VALUE 0x301 --#define TXLTV_ADC_REG7_VALUE 0x00102038 --#define TXLTV_ADC_REG8_VALUE 0x00000406 --#define TXLTV_ADC_REG9_VALUE 0x00082183 --#define TXLTV_ADC_REGA_VALUE 0x80480240 --#define TXLTV_ADC_REGB_VALUE 0x22000442 --#define TXLTV_ADC_REGC_VALUE 0x00034a00 --#define TXLTV_ADC_REGD_VALUE 0x00005000 --#define TXLTV_ADC_REGE_VALUE 0x00000200 -- -- --/* DADC DPLL */ --#define ADC_REG1 (IO_HIU_BASE + (0xaa << 2)) --#define ADC_REG2 (IO_HIU_BASE + (0xab << 2)) --#define ADC_REG3 (IO_HIU_BASE + (0xac << 2)) --#define ADC_REG4 (IO_HIU_BASE + (0xad << 2)) -- --#define ADC_REG5 (IO_HIU_BASE + (0x73 << 2)) --#define ADC_REG6 (IO_HIU_BASE + (0x74 << 2)) -- --#define ADC_REGB (IO_HIU_BASE + (0xaf << 2)) --#define ADC_REGC (IO_HIU_BASE + (0x9e << 2)) --#define ADC_REGD (IO_HIU_BASE + (0x9f << 2)) -- --/* DADC REG */ --#define ADC_REG7 (IO_HIU_BASE + (0x27 << 2)) --#define ADC_REG8 (IO_HIU_BASE + (0x28 << 2)) --#define ADC_REG9 (IO_HIU_BASE + (0x2a << 2)) --#define ADC_REGA (IO_HIU_BASE + (0x2b << 2)) --#define ADC_REGE (IO_HIU_BASE + (0xbd << 2)) -- --/* #endif */ -- -- --/* #ifdef GX_TV */ -- --#define ADC_RESET_VALUE 0x8a2a2110 /* 0xce7a2110 */ --#define ADC_REG1_VALUE 0x00100228 --#define ADC_REG2_VALUE 0x34e0bf80 /* 0x34e0bf81 */ --#define ADC_REG2_VALUE_CRY 0x34e0bf81 --#define ADC_REG3_VALUE 0x0a2a2110 /* 0x4e7a2110 */ --#define ADC_REG4_VALUE 0x02933800 --#define ADC_REG4_CRY_VALUE 0x301 --#define ADC_REG7_VALUE 0x01411036 --#define ADC_REG8_VALUE 0x00000000 --#define ADC_REG9_VALUE 0x00430036 --#define ADC_REGA_VALUE 0x80480240 --#if 0 --/* DADC DPLL */ --#define ADC_REG1 (IO_HIU_BASE + (0xaa << 2)) --#define ADC_REG2 (IO_HIU_BASE + (0xab << 2)) --#define ADC_REG3 (IO_HIU_BASE + (0xac << 2)) --#define ADC_REG4 (IO_HIU_BASE + (0xad << 2)) -- --#define ADC_REG5 (IO_HIU_BASE + (0x73 << 2)) --#define ADC_REG6 (IO_HIU_BASE + (0x74 << 2)) -- --/* DADC REG */ --#define ADC_REG7 (IO_HIU_BASE + (0x27 << 2)) --#define ADC_REG8 (IO_HIU_BASE + (0x28 << 2)) --#define ADC_REG9 (IO_HIU_BASE + (0x2a << 2)) --#define ADC_REGA (IO_HIU_BASE + (0x2b << 2)) --#endif --/* #endif */ -- --#ifdef G9_TV -- --#define ADC_RESET_VALUE 0x8a2a2110 /* 0xce7a2110 */ --#define ADC_REG1_VALUE 0x00100228 --#define ADC_REG2_VALUE 0x34e0bf80 /* 0x34e0bf81 */ --#define ADC_REG2_VALUE_CRY 0x34e0bf81 --#define ADC_REG3_VALUE 0x0a2a2110 /* 0x4e7a2110 */ --#define ADC_REG4_VALUE 0x02933800 --#define ADC_REG4_CRY_VALUE 0x301 --#define ADC_REG7_VALUE 0x01411036 --#define ADC_REG8_VALUE 0x00000000 --#define ADC_REG9_VALUE 0x00430036 --#define ADC_REGA_VALUE 0x80480240 -- --/* DADC DPLL */ --#define ADC_REG1 0x10aa --#define ADC_REG2 0x10ab --#define ADC_REG3 0x10ac --#define ADC_REG4 0x10ad -- --#define ADC_REG5 0x1073 --#define ADC_REG6 0x1074 -- --/* DADC REG */ --#define ADC_REG7 0x1027 --#define ADC_REG8 0x1028 --#define ADC_REG9 0x102a --#define ADC_REGA 0x102b --#endif -- --#ifdef M6_TV --#define ADC_REG1_VALUE 0x003b0232 --#define ADC_REG2_VALUE 0x814d3928 --#define ADC_REG3_VALUE 0x6b425012 --#define ADC_REG4_VALUE 0x101 --#define ADC_REG4_CRY_VALUE 0x301 --#define ADC_REG5_VALUE 0x70b --#define ADC_REG6_VALUE 0x713 -- --#define ADC_REG1 0x10aa --#define ADC_REG2 0x10ab --#define ADC_REG3 0x10ac --#define ADC_REG4 0x10ad --#define ADC_REG5 0x1073 --#define ADC_REG6 0x1074 --#endif -- --#define DEMOD_REG1_VALUE 0x0000d007 --#define DEMOD_REG2_VALUE 0x2e805400 --#define DEMOD_REG3_VALUE 0x201 -- --#define DEMOD_REG1 (DEMOD_BASE + 0xc00) --#define DEMOD_REG2 (DEMOD_BASE + 0xc04) --#define DEMOD_REG3 (DEMOD_BASE + 0xc08) --#define DEMOD_REG4 (DEMOD_BASE + 0xc0c) -- --/* #define Wr(addr, data) WRITE_CBUS_REG(addr, data)*/ --/* #define Rd(addr) READ_CBUS_REG(addr) */ -- --/*#define Wr(addr, data) *(volatile unsigned long *)(addr) = (data)*/ --/*#define Rd(addr) *(volatile unsigned long *)(addr)*/ -- --enum { -- enable_mobile, -- disable_mobile --}; -- --enum { -- OPEN_TIME_EQ, -- CLOSE_TIME_EQ --}; -- --enum { -- AMLOGIC_DTMB_STEP0, -- AMLOGIC_DTMB_STEP1, -- AMLOGIC_DTMB_STEP2, -- AMLOGIC_DTMB_STEP3, -- AMLOGIC_DTMB_STEP4, -- AMLOGIC_DTMB_STEP5, /* time eq */ -- AMLOGIC_DTMB_STEP6, /* set normal mode sc */ -- AMLOGIC_DTMB_STEP7, -- AMLOGIC_DTMB_STEP8, /* set time eq mode */ -- AMLOGIC_DTMB_STEP9, /* reset */ -- AMLOGIC_DTMB_STEP10, /* set normal mode mc */ -- AMLOGIC_DTMB_STEP11, --}; -- --enum { -- DTMB_IDLE = 0, -- DTMB_AGC_READY = 1, -- DTMB_TS1_READY = 2, -- DTMB_TS2_READY = 3, -- DTMB_FE_READY = 4, -- DTMB_PNPHASE_READY = 5, -- DTMB_SFO_INIT_READY = 6, -- DTMB_TS3_READY = 7, -- DTMB_PM_INIT_READY = 8, -- DTMB_CHE_INIT_READY = 9, -- DTMB_FEC_READY = 10 --}; -- --/* i2c functions */ --/* int aml_i2c_sw_test_bus(struct aml_demod_i2c *adap, char *name); */ --int am_demod_i2c_xfer(struct aml_demod_i2c *adap, struct i2c_msg *msgs, -- int num); --int init_tuner_fj2207(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *adap); --int set_tuner_fj2207(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *adap); -- --int get_fj2207_ch_power(void); --int tuner_get_ch_power(struct aml_fe_dev *adap); --int tda18273_tuner_set_frequncy(unsigned int dwFrequency, -- unsigned int dwStandard); --int dtmb_get_power_strength(int agc_gain); -- -- --int tuner_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c); -- --/* dvbt */ --int dvbt_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dvbt *demod_dvbt); -- --struct demod_status_ops { -- int (*get_status)(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c); -- int (*get_ber)(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c); -- int (*get_snr)(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c); -- int (*get_strength)(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c); -- int (*get_ucblocks)(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c); --}; -- --struct demod_status_ops *dvbt_get_status_ops(void); -- --/* dvbc */ -- --int dvbc_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dvbc *demod_dvbc); --int dvbc_status(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_sts *demod_sts); --int dvbc_isr_islock(void); --void dvbc_isr(struct aml_demod_sta *demod_sta); --u32 dvbc_set_qam_mode(unsigned char mode); --u32 dvbc_get_status(void); --u32 dvbc_set_auto_symtrack(void); --int dvbc_timer_init(void); --void dvbc_timer_exit(void); --int dvbc_cci_task(void *); --int dvbc_get_cci_task(void); --void dvbc_create_cci_task(void); --void dvbc_kill_cci_task(void); -- --/* atsc */ -- --int atsc_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_atsc *demod_atsc); --int check_atsc_fsm_status(void); -- --void atsc_write_reg(int reg_addr, int reg_data); -- --unsigned long atsc_read_reg(int reg_addr); -- --unsigned long atsc_read_iqr_reg(void); -- --int atsc_qam_set(fe_modulation_t mode); -- --void qam_initial(int qam_id); -- --/* dtmb */ -- --int dtmb_set_ch(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_dtmb *demod_atsc); -- --void dtmb_reset(void); -- --int dtmb_check_status_gxtv(struct dvb_frontend *fe); --int dtmb_check_status_txl(struct dvb_frontend *fe); -- -- --void dtmb_write_reg(int reg_addr, int reg_data); --int dtmb_read_reg(int reg_addr); --void dtmb_register_reset(void); -- --/* demod functions */ --unsigned long apb_read_reg_collect(unsigned long addr); --void apb_write_reg_collect(unsigned int addr, unsigned int data); --void apb_write_reg(unsigned int reg, unsigned int val); --unsigned long apb_read_reg_high(unsigned long addr); --unsigned long apb_read_reg(unsigned long reg); --int app_apb_write_reg(int addr, int data); --int app_apb_read_reg(int addr); -- --void demod_set_cbus_reg(unsigned data, unsigned addr); --unsigned demod_read_cbus_reg(unsigned addr); --void demod_set_demod_reg(unsigned data, unsigned addr); --unsigned demod_read_demod_reg(unsigned addr); -- --/* extern int clk_measure(char index); */ -- --void ofdm_initial(int bandwidth, -- /* 00:8M 01:7M 10:6M 11:5M */ -- int samplerate, -- /* 00:45M 01:20.8333M 10:20.7M 11:28.57 */ -- int IF, -- /* 000:36.13M 001:-5.5M 010:4.57M 011:4M 100:5M */ -- int mode, -- /* 00:DVBT,01:ISDBT */ -- int tc_mode -- /* 0: Unsigned, 1:TC */); -- --void monitor_isdbt(void); --void demod_set_reg(struct aml_demod_reg *demod_reg); --void demod_get_reg(struct aml_demod_reg *demod_reg); -- --/* void demod_calc_clk(struct aml_demod_sta *demod_sta); */ --int demod_set_sys(struct aml_demod_sta *demod_sta, -- struct aml_demod_i2c *demod_i2c, -- struct aml_demod_sys *demod_sys); --/* int demod_get_sys(struct aml_demod_i2c *demod_i2c, */ --/* struct aml_demod_sys *demod_sys); */ --/* int dvbt_set_ch(struct aml_demod_sta *demod_sta, */ --/* struct aml_demod_i2c *demod_i2c, */ --/* struct aml_demod_dvbt *demod_dvbt); */ --/* int tuner_set_ch (struct aml_demod_sta *demod_sta, */ --/* struct aml_demod_i2c *demod_i2c); */ -- --/* typedef char int8_t; */ --/* typedef short int int16_t; */ --/* typedef int int32_t; */ --/* typedef long int64_t; */ --/*typedef unsigned char uint8_t; -- * typedef unsigned short int uint16_t; -- * typedef unsigned int uint32_t; -- * typedef unsigned long uint64_t;*/ -- --/*typedef unsigned char u8_t; -- * typedef signed char s8_t; -- * typedef unsigned short u16_t; -- * typedef signed short s16_t; -- * typedef unsigned int u32_t; -- * typedef signed int s32_t; -- * typedef unsigned long u64_t; -- * typedef signed long s64_t;*/ -- --/* #define extadc */ -- --/* for g9tv */ --void adc_dpll_setup(int clk_a, int clk_b, int clk_sys); --void demod_power_switch(int pwr_cntl); -- --union adc_pll_cntl { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned pll_m:9; -- unsigned pll_n:5; -- unsigned pll_od0:2; -- unsigned pll_od1:2; -- unsigned pll_od2:2; -- unsigned pll_xd0:6; -- unsigned pll_xd1:6; -- } b; --}; -- --union adc_pll_cntl2 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned output_mux_ctrl:4; -- unsigned div2_ctrl:1; -- unsigned b_polar_control:1; -- unsigned a_polar_control:1; -- unsigned gate_ctrl:6; -- unsigned tdc_buf:8; -- unsigned lm_s:6; -- unsigned lm_w:4; -- unsigned reserved:1; -- } b; --}; -- --union adc_pll_cntl3 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned afc_dsel_in:1; -- unsigned afc_dsel_bypass:1; -- unsigned dco_sdmck_sel:2; -- unsigned dc_vc_in:2; -- unsigned dco_m_en:1; -- unsigned dpfd_lmode:1; -- unsigned filter_acq1:11; -- unsigned enable:1; -- unsigned filter_acq2:11; -- unsigned reset:1; -- } b; --}; -- --union adc_pll_cntl4 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned reve:12; -- unsigned tdc_en:1; -- unsigned dco_sdm_en:1; -- unsigned dco_iup:2; -- unsigned pvt_fix_en:1; -- unsigned iir_bypass_n:1; -- unsigned pll_od3:2; -- unsigned filter_pvt1:4; -- unsigned filter_pvt2:4; -- unsigned reserved:4; -- } b; --}; -- --/* ///////////////////////////////////////////////////////////////// */ -- --union demod_dig_clk { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned demod_clk_div:7; -- unsigned reserved0:1; -- unsigned demod_clk_en:1; -- unsigned demod_clk_sel:2; -- unsigned reserved1:5; -- unsigned adc_extclk_div:7; /* 34 */ -- unsigned use_adc_extclk:1; /* 1 */ -- unsigned adc_extclk_en:1; /* 1 */ -- unsigned adc_extclk_sel:3; /* 1 */ -- unsigned reserved2:4; -- } b; --}; -- --union demod_adc_clk { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned pll_m:9; -- unsigned pll_n:5; -- unsigned pll_od:2; -- unsigned pll_xd:5; -- unsigned reserved0:3; -- unsigned pll_ss_clk:4; -- unsigned pll_ss_en:1; -- unsigned reset:1; -- unsigned pll_pd:1; -- unsigned reserved1:1; -- } b; --}; -- --union demod_cfg0 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned mode:4; -- unsigned ts_sel:4; -- unsigned test_bus_clk:1; -- unsigned adc_ext:1; -- unsigned adc_rvs:1; -- unsigned adc_swap:1; -- unsigned adc_format:1; -- unsigned adc_regout:1; -- unsigned adc_regsel:1; -- unsigned adc_regadj:5; -- unsigned adc_value:10; -- unsigned adc_test:1; -- unsigned ddr_sel:1; -- } b; --}; -- --union demod_cfg1 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned reserved:8; -- unsigned ref_top:2; -- unsigned ref_bot:2; -- unsigned cml_xs:2; -- unsigned cml_1s:2; -- unsigned vdda_sel:2; -- unsigned bias_sel_sha:2; -- unsigned bias_sel_mdac2:2; -- unsigned bias_sel_mdac1:2; -- unsigned fast_chg:1; -- unsigned rin_sel:3; -- unsigned en_ext_vbg:1; -- unsigned en_cmlgen_res:1; -- unsigned en_ext_vdd12:1; -- unsigned en_ext_ref:1; -- } b; --}; -- --union demod_cfg2 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned en_adc:1; -- unsigned biasgen_ibipt_sel:2; -- unsigned biasgen_ibic_sel:2; -- unsigned biasgen_rsv:4; -- unsigned biasgen_en:1; -- unsigned biasgen_bias_sel_adc:2; -- unsigned biasgen_bias_sel_cml1:2; -- unsigned biasgen_bias_sel_ref_op:2; -- unsigned clk_phase_sel:1; -- unsigned reserved:15; -- } b; --}; -- --union demod_cfg3 { -- /** raw register data */ -- uint32_t d32; -- /** register bits */ -- struct { -- unsigned dc_arb_mask:3; -- unsigned dc_arb_enable:1; -- unsigned reserved:28; -- } b; --}; -- --struct atsc_cfg { -- int adr; -- int dat; -- int rw; --}; -- --struct agc_power_tab { -- char name[128]; -- int level; -- int ncalcE; -- int *calcE; --}; -- --struct dtmb_cfg { -- int dat; -- int adr; -- int rw; --}; -- --void dtvpll_lock_init(void); --void dtvpll_init_flag(int on); --void demod_set_irq_mask(void); --void demod_clr_irq_stat(void); --void demod_set_adc_core_clk(int, int, int); --void demod_set_adc_core_clk_fix(int clk_adc, int clk_dem); --void calculate_cordic_para(void); --void ofdm_read_all_regs(void); --extern int aml_fe_analog_set_frontend(struct dvb_frontend *fe); -- --#endif -diff --git a/drivers/amlogic/dvb_tv/amldemod/tuner_func.c b/drivers/amlogic/dvb_tv/amldemod/tuner_func.c -deleted file mode 100644 -index 20df299..0000000 ---- a/drivers/amlogic/dvb_tv/amldemod/tuner_func.c -+++ /dev/null -@@ -1,169 +0,0 @@ --#include --#include --#include --#include "demod_func.h" --#include "../aml_fe.h" -- --int tuner_get_ch_power(struct aml_fe_dev *adap) --{ -- int strength = 0; -- int agc_if_gain; -- -- struct dvb_frontend *dvbfe; -- dvbfe = get_si2177_tuner(); -- if (dvbfe != NULL) -- if (dvbfe->ops.tuner_ops.get_strength) -- strength = dvbfe->ops.tuner_ops.get_strength(dvbfe); -- if (strength <= -56) { -- agc_if_gain = -- ((dtmb_read_reg(DTMB_TOP_FRONT_AGC))&0x3ff); -- strength = dtmb_get_power_strength(agc_if_gain); -- } -- -- return strength; --} -- --struct dvb_tuner_info *tuner_get_info(int type, int mode) --{ -- /*type : 0-NULL, 1-DCT7070, 2-Maxliner, 3-FJ2207, 4-TD1316 */ -- /*mode: 0-DVBC 1-DVBT */ -- static struct dvb_tuner_info tinfo_null = { }; -- -- static struct dvb_tuner_info tinfo_MXL5003S[2] = { -- [1] = { /*DVBT*/ .name = "Maxliner", -- .frequency_min = 44000000, -- .frequency_max = 885000000, } -- }; -- static struct dvb_tuner_info tinfo_FJ2207[2] = { -- [0] = { /*DVBC*/ .name = "FJ2207", -- .frequency_min = 54000000, -- .frequency_max = 870000000, }, -- [1] = { /*DVBT*/ .name = "FJ2207", -- .frequency_min = 174000000, -- .frequency_max = 864000000, }, -- }; -- static struct dvb_tuner_info tinfo_DCT7070[2] = { -- [0] = { /*DVBC*/ .name = "DCT7070", -- .frequency_min = 51000000, -- .frequency_max = 860000000, } -- }; -- static struct dvb_tuner_info tinfo_TD1316[2] = { -- [1] = { /*DVBT*/ .name = "TD1316", -- .frequency_min = 51000000, -- .frequency_max = 858000000, } -- }; -- static struct dvb_tuner_info tinfo_SI2176[2] = { -- [0] = { /*DVBC*/ -- /*#error please add SI2176 code*/ -- .name = "SI2176", -- .frequency_min = 51000000, -- .frequency_max = 860000000, -- } -- }; -- -- struct dvb_tuner_info *tinfo[] = { -- &tinfo_null, -- tinfo_DCT7070, -- tinfo_MXL5003S, -- tinfo_FJ2207, -- tinfo_TD1316, -- tinfo_SI2176 -- }; -- -- if ((type < 0) || (type > 4) || (mode < 0) || (mode > 1)) -- return tinfo[0]; -- -- return &tinfo[type][mode]; --} -- --struct agc_power_tab *tuner_get_agc_power_table(int type) --{ -- /*type : 0-NULL, 1-DCT7070, 2-Maxliner, 3-FJ2207, 4-TD1316 */ -- static int calcE_FJ2207[31] = { -- 87, 118, 138, 154, 172, 197, 245, -- 273, 292, 312, 327, 354, 406, 430, -- 448, 464, 481, 505, 558, 583, 599, -- 616, 632, 653, 698, 725, 745, 762, -- 779, 801, 831 }; -- static int calcE_Maxliner[79] = { -- 543, 552, 562, 575, 586, 596, 608, -- 618, 627, 635, 645, 653, 662, 668, -- 678, 689, 696, 705, 715, 725, 733, -- 742, 752, 763, 769, 778, 789, 800, -- 807, 816, 826, 836, 844, 854, 864, -- 874, 884, 894, 904, 913, 923, 932, -- 942, 951, 961, 970, 980, 990, 1000, -- 1012, 1022, 1031, 1040, 1049, 1059, -- 1069, 1079, 1088, 1098, 1107, 1115, -- 1123, 1132, 1140, 1148, 1157, 1165, -- 1173, 1179, 1186, 1192, 1198, 1203, -- 1208, 1208, 1214, 1217, 1218, 1220 }; -- -- static struct agc_power_tab power_tab[] = { -- [0] = { "null", 0, 0, NULL }, -- [1] = { -- .name = "DCT7070", -- .level = 0, -- .ncalcE = 0, -- .calcE = NULL, -- }, -- [2] = { -- .name = "Maxlear", -- .level = -22, -- .ncalcE = sizeof(calcE_Maxliner) / sizeof(int), -- .calcE = calcE_Maxliner, -- }, -- [3] = { -- .name = "FJ2207", -- .level = -62, -- .ncalcE = sizeof(calcE_FJ2207) / sizeof(int), -- .calcE = calcE_FJ2207, -- }, -- [4] = { -- .name = "TD1316", -- .level = 0, -- .ncalcE = 0, -- .calcE = NULL, -- }, -- }; -- -- if (type >= 2 && type <= 3) -- return &power_tab[type]; -- else -- return &power_tab[3]; --}; -- --int agc_power_to_dbm(int agc_gain, int ad_power, int offset, int tuner) --{ -- struct agc_power_tab *ptab = tuner_get_agc_power_table(tuner); -- int est_rf_power; -- int j; -- -- for (j = 0; j < ptab->ncalcE; j++) -- if (agc_gain <= ptab->calcE[j]) -- break; -- -- est_rf_power = ptab->level - j - (ad_power >> 4) + 12 + offset; -- -- return est_rf_power; --} -- --int dtmb_get_power_strength(int agc_gain) --{ -- int strength; -- int j; -- static int calcE_R840[13] = { -- 1010, 969, 890, 840, 800, -- 760, 720, 680, 670, 660, -- 510, 440, 368}; -- for (j = 0; j < sizeof(calcE_R840)/sizeof(int); j++) -- if (agc_gain >= calcE_R840[j]) -- break; -- if (agc_gain >= 440) -- strength = -90+j*3; -- else -- strength = -56; -- return strength; --} -- -- -diff --git a/drivers/amlogic/dvb_tv/amsmc.h b/drivers/amlogic/dvb_tv/amsmc.h -deleted file mode 100644 -index 53b9d29..0000000 ---- a/drivers/amlogic/dvb_tv/amsmc.h -+++ /dev/null -@@ -1,61 +0,0 @@ --/* -- * AMLOGIC Smart card driver. -- * -- * 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 named License, -- * or any later version. -- * -- * This program 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. -- */ -- --#ifndef _AMSMC_H --#define _AMSMC_H -- --/* #include */ --#include -- --#define AMSMC_MAX_ATR_LEN 33 -- --enum { -- AMSMC_CARDOUT = 0, -- AMSMC_CARDIN = 1 --}; -- --struct am_smc_atr { -- char atr[AMSMC_MAX_ATR_LEN]; -- int atr_len; --}; -- --struct am_smc_param { -- int f; -- int d; -- int n; -- int bwi; -- int cwi; -- int bgt; -- int freq; -- int recv_invert; -- int recv_lsb_msb; -- int recv_no_parity; -- int recv_parity; -- int xmit_invert; -- int xmit_lsb_msb; -- int xmit_retries; -- int xmit_repeat_dis; -- int xmit_parity; --}; -- --#define AMSMC_IOC_MAGIC 'C' -- --#define AMSMC_IOC_RESET _IOR(AMSMC_IOC_MAGIC, 0x00, struct am_smc_atr) --#define AMSMC_IOC_GET_STATUS _IOR(AMSMC_IOC_MAGIC, 0x01, int) --#define AMSMC_IOC_ACTIVE _IO(AMSMC_IOC_MAGIC, 0x02) --#define AMSMC_IOC_DEACTIVE _IO(AMSMC_IOC_MAGIC, 0x03) --#define AMSMC_IOC_GET_PARAM _IOR(AMSMC_IOC_MAGIC, 0x04, struct am_smc_param) --#define AMSMC_IOC_SET_PARAM _IOW(AMSMC_IOC_MAGIC, 0x05, struct am_smc_param) -- --#endif -diff --git a/drivers/amlogic/dvb_tv/ascot3.c b/drivers/amlogic/dvb_tv/ascot3.c -new file mode 100644 -index 0000000..0b424e8 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/ascot3.c -@@ -0,0 +1,563 @@ -+/* -+ * ascot3.c -+ * -+ * Sony Ascot3 DVB-T/T2/C tuner driver -+ * -+ * Copyright (C) 2015 Sasa Savic -+ * -+ * Based on ascot2e driver -+ * -+ * Copyright 2012 Sony Corporation -+ * Copyright (C) 2014 NetUP Inc. -+ * Copyright (C) 2014 Sergey Kozlov -+ * Copyright (C) 2014 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include "ascot3.h" -+#include "dvb_frontend.h" -+ -+#define MAX_WRITE_REGSIZE 32 -+ -+enum ascot3_state { -+ STATE_UNKNOWN, -+ STATE_SLEEP, -+ STATE_ACTIVE -+}; -+ -+struct ascot3_priv { -+ u32 frequency; -+ u8 i2c_address; -+ struct i2c_adapter *i2c; -+ enum ascot3_state state; -+}; -+ -+enum ascot3_tv_system_t { -+ ASCOT3_DTV_DVBT_5, -+ ASCOT3_DTV_DVBT_6, -+ ASCOT3_DTV_DVBT_7, -+ ASCOT3_DTV_DVBT_8, -+ ASCOT3_DTV_DVBT2_1_7, -+ ASCOT3_DTV_DVBT2_5, -+ ASCOT3_DTV_DVBT2_6, -+ ASCOT3_DTV_DVBT2_7, -+ ASCOT3_DTV_DVBT2_8, -+ ASCOT3_DTV_DVBC_6, -+ ASCOT3_DTV_DVBC_8, -+ ASCOT3_DTV_DVBC2_6, -+ ASCOT3_DTV_DVBC2_8, -+ ASCOT3_DTV_UNKNOWN -+}; -+ -+struct ascot3_band_sett { -+ u8 outlmt; -+ u8 rf_gain; -+ u8 if_bpf_gc; -+ u8 rfovld_det_lv1_vl; -+ u8 rfovld_det_lv1_vh; -+ u8 rfovld_det_lv1_u; -+ u8 ifovld_det_lv_vl; -+ u8 ifovld_det_lv_vh; -+ u8 ifovld_det_lv_u; -+ u8 if_bpf_f0; -+ u8 bw; -+ u8 fif_offset; -+ u8 bw_offset; -+ u8 agc_sel; -+ u8 if_out_sel; -+ u8 is_lowerlocal; -+}; -+ -+#define ASCOT3_AUTO 0xff -+#define ASCOT3_OFFSET(ofs) ((u8)(ofs) & 0x1F) -+#define ASCOT3_BW_6 0x00 -+#define ASCOT3_BW_7 0x01 -+#define ASCOT3_BW_8 0x02 -+#define ASCOT3_BW_1_7 0x03 -+ -+static struct ascot3_band_sett ascot3_sett[] = { -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_7, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-5), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_8, ASCOT3_OFFSET(-4), ASCOT3_OFFSET(-6), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_1_7,ASCOT3_OFFSET(-10),ASCOT3_OFFSET(-10),ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_6, ASCOT3_OFFSET(-8), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_7, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-5), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x09, 0x0C, 0x0C, 0x0C, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_8, ASCOT3_OFFSET(-4), ASCOT3_OFFSET(-6), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x05, 0x09, 0x09, 0x09, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_6, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-4), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x05, 0x09, 0x09, 0x09, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_8, ASCOT3_OFFSET(-2), ASCOT3_OFFSET(-3), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x03, 0x0A, 0x0A, 0x0A, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_6, ASCOT3_OFFSET(-6), ASCOT3_OFFSET(-2), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 }, -+ { 0x00, ASCOT3_AUTO, 0x03, 0x0A, 0x0A, 0x0A, 0x02, 0x02, 0x02, 0x00, -+ ASCOT3_BW_8, ASCOT3_OFFSET(-2), ASCOT3_OFFSET(0), ASCOT3_AUTO, ASCOT3_AUTO, 0x00 } -+}; -+ -+static int ascot3_write_regs(struct ascot3_priv *priv, -+ u8 reg, const u8 *data, u32 len) -+{ -+ int ret; -+ u8 buf[MAX_WRITE_REGSIZE + 1]; -+ struct i2c_msg msg[1] = { -+ { -+ .addr = priv->i2c_address, -+ .flags = 0, -+ .len = len + 1, -+ .buf = buf, -+ } -+ }; -+ -+ if (len + 1 >= sizeof(buf)) { -+ dev_warn(&priv->i2c->dev,"wr reg=%04x: len=%d is too big!\n", -+ reg, len + 1); -+ return -E2BIG; -+ } -+ -+ -+ buf[0] = reg; -+ memcpy(&buf[1], data, len); -+ ret = i2c_transfer(priv->i2c, msg, 1); -+ if (ret >= 0 && ret != 1) -+ ret = -EREMOTEIO; -+ if (ret < 0) { -+ dev_warn(&priv->i2c->dev, -+ "i2c wr failed=%d reg=%02x len=%d\n", -+ ret, reg, len); -+ return ret; -+ } -+ return 0; -+} -+ -+static int ascot3_write_reg(struct ascot3_priv *priv, u8 reg, u8 val) -+{ -+ return ascot3_write_regs(priv, reg, &val, 1); -+} -+ -+static int ascot3_read_regs(struct ascot3_priv *priv, -+ u8 reg, u8 *val, u32 len) -+{ -+ int ret; -+ struct i2c_msg msg[2] = { -+ { -+ .addr = priv->i2c_address, -+ .flags = 0, -+ .len = 1, -+ .buf = ®, -+ }, { -+ .addr = priv->i2c_address, -+ .flags = I2C_M_RD, -+ .len = len, -+ .buf = val, -+ } -+ }; -+ -+ ret = i2c_transfer(priv->i2c, &msg[0], 1); -+ if (ret >= 0 && ret != 1) -+ ret = -EREMOTEIO; -+ if (ret < 0) { -+ dev_warn(&priv->i2c->dev, -+ "I2C rw failed=%d addr=%02x reg=%02x\n", -+ ret, priv->i2c_address, reg); -+ return ret; -+ } -+ ret = i2c_transfer(priv->i2c, &msg[1], 1); -+ if (ret >= 0 && ret != 1) -+ ret = -EREMOTEIO; -+ if (ret < 0) { -+ dev_warn(&priv->i2c->dev, -+ "i2c rd failed=%d addr=%02x reg=%02x\n", -+ ret, priv->i2c_address, reg); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int ascot3_read_reg(struct ascot3_priv *priv, u8 reg, u8 *val) -+{ -+ return ascot3_read_regs(priv, reg, val, 1); -+} -+ -+static int ascot3_set_reg_bits(struct ascot3_priv *priv, -+ u8 reg, u8 data, u8 mask) -+{ -+ int res; -+ u8 rdata; -+ -+ if (mask != 0xff) { -+ res = ascot3_read_reg(priv, reg, &rdata); -+ if (res != 0) -+ return res; -+ data = ((data & mask) | (rdata & (mask ^ 0xFF))); -+ } -+ return ascot3_write_reg(priv, reg, data); -+} -+ -+static int ascot3_enter_power_save(struct ascot3_priv *priv) -+{ -+ u8 data[3]; -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ -+ if (priv->state == STATE_SLEEP) -+ return 0; -+ -+ /* Loop Through setting And RFIN matching in Power Save */ -+ ascot3_write_reg(priv, 0x67, 0x06); -+ /* Disable IF signal output (IF_OUT_SEL setting) */ -+ ascot3_set_reg_bits(priv, 0x74, 0x02, 0x03); -+ /* Power save setting for analog block */ -+ data[0] = 0x15; -+ data[1] = 0x00; -+ data[2] = 0x00; -+ ascot3_write_regs(priv, 0x5E, data, 3); -+ /* Standby setting for CPU */ -+ ascot3_write_reg(priv, 0x88, 0x00); -+ /* Standby setting for internal logic block */ -+ ascot3_write_reg(priv, 0x87, 0xC0); -+ priv->state = STATE_SLEEP; -+ return 0; -+} -+ -+static int ascot3_init(struct dvb_frontend *fe) -+{ -+ struct ascot3_priv *priv = fe->tuner_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ return 0; -+} -+ -+static int ascot3_release(struct dvb_frontend *fe) -+{ -+ struct ascot3_priv *priv = fe->tuner_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ kfree(fe->tuner_priv); -+ fe->tuner_priv = NULL; -+ return 0; -+} -+ -+static int ascot3_sleep(struct dvb_frontend *fe) -+{ -+ struct ascot3_priv *priv = fe->tuner_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ ascot3_enter_power_save(priv); -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ return 0; -+} -+ -+static enum ascot3_tv_system_t ascot3_get_tv_system(struct dvb_frontend *fe) -+{ -+ enum ascot3_tv_system_t system = ASCOT3_DTV_UNKNOWN; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct ascot3_priv *priv = fe->tuner_priv; -+ -+ if (p->delivery_system == SYS_DVBT) { -+ if (p->bandwidth_hz <= 5000000) -+ system = ASCOT3_DTV_DVBT_5; -+ else if (p->bandwidth_hz <= 6000000) -+ system = ASCOT3_DTV_DVBT_6; -+ else if (p->bandwidth_hz <= 7000000) -+ system = ASCOT3_DTV_DVBT_7; -+ else if (p->bandwidth_hz <= 8000000) -+ system = ASCOT3_DTV_DVBT_8; -+ else { -+ system = ASCOT3_DTV_DVBT_8; -+ p->bandwidth_hz = 8000000; -+ } -+ } else if (p->delivery_system == SYS_DVBT2) { -+ if (p->bandwidth_hz <= 5000000) -+ system = ASCOT3_DTV_DVBT2_5; -+ else if (p->bandwidth_hz <= 6000000) -+ system = ASCOT3_DTV_DVBT2_6; -+ else if (p->bandwidth_hz <= 7000000) -+ system = ASCOT3_DTV_DVBT2_7; -+ else if (p->bandwidth_hz <= 8000000) -+ system = ASCOT3_DTV_DVBT2_8; -+ else { -+ system = ASCOT3_DTV_DVBT2_8; -+ p->bandwidth_hz = 8000000; -+ } -+ } else if (p->delivery_system == SYS_DVBC_ANNEX_A) { -+ if (p->bandwidth_hz <= 6000000) -+ system = ASCOT3_DTV_DVBC_6; -+ else if (p->bandwidth_hz <= 8000000) -+ system = ASCOT3_DTV_DVBC_8; -+ } -+ dev_dbg(&priv->i2c->dev, -+ "%s(): ASCOT2E DTV system %d (delsys %d, bandwidth %d)\n", -+ __func__, (int)system, p->delivery_system, p->bandwidth_hz); -+ return system; -+} -+ -+static int ascot3_set_params(struct dvb_frontend *fe) -+{ -+ u8 data[20]; -+ u32 frequency; -+ enum ascot3_tv_system_t tv_system; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct ascot3_priv *priv = fe->tuner_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s(): tune frequency %dkHz\n", -+ __func__, p->frequency / 1000); -+ tv_system = ascot3_get_tv_system(fe); -+ -+ if (tv_system == ASCOT3_DTV_UNKNOWN) { -+ dev_dbg(&priv->i2c->dev, "%s(): unknown DTV system\n", -+ __func__); -+ return -EINVAL; -+ } -+ -+ frequency = roundup(p->frequency / 1000, 25); -+ -+ /* Disable IF signal output (IF_OUT_SEL setting) */ -+ ascot3_set_reg_bits(priv, 0x74, 0x02, 0x03); -+ /* Clock enable for internal logic block, CPU wake-up */ -+ data[0] = 0xC4; -+ data[1] = 0x40; -+ ascot3_write_regs(priv, 0x87, data, 2); -+ -+ /* Initial setting for internal analog block */ -+ if (tv_system == ASCOT3_DTV_DVBC_6 || -+ tv_system == ASCOT3_DTV_DVBC_8) { -+ data[0] = 0x16; -+ data[1] = 0x26; -+ } else { -+ data[0] = 0x10; -+ data[1] = 0x20; -+ } -+ ascot3_write_regs(priv, 0x91, data, 2); -+ -+ /* Setting for analog block */ -+ data[0] = 0x00; -+ data[1] = (u8)(ascot3_sett[tv_system].is_lowerlocal & 0x01); -+ ascot3_write_regs(priv, 0x9C, data, 2); -+ -+ /* Enable for analog block */ -+ data[0] = 0xEE; -+ data[1] = 0x02; -+ data[2] = 0x1E; -+ /* Tuning setting for CPU */ -+ data[3] = 0x67; -+ /* Setting for PLL reference divider (REF_R) */ -+ data[4] = 0x02; -+ /* Tuning setting for analog block*/ -+ if (tv_system == ASCOT3_DTV_DVBC_6 || -+ tv_system == ASCOT3_DTV_DVBC_8) { -+ data[5] = 0x50; -+ data[6] = 0x78; -+ data[7] = 0x08; -+ data[8] = 0x30; -+ } else { -+ data[5] = 0xAF; -+ data[6] = 0x78; -+ data[7] = 0x08; -+ data[8] = 0x30; -+ } -+ ascot3_write_regs(priv, 0x5E, data, 9); -+ -+ /* Setting for IFOUT_LIMIT */ -+ data[0] = (u8)(ascot3_sett[tv_system].outlmt & 0x03); -+ /* Setting for IF BPF buffer gain */ -+ /* RF_GAIN setting */ -+ if (ascot3_sett[tv_system].rf_gain == ASCOT3_AUTO) -+ data[1] = 0x80; -+ else -+ data[1] = (u8)((ascot3_sett[tv_system].rf_gain << 4) & 0x70); -+ -+ /* IF_BPF_GC setting */ -+ data[1] |= (u8)(ascot3_sett[tv_system].if_bpf_gc & 0x0F); -+ -+ /* Setting for internal RFAGC */ -+ data[2] = 0x00; -+ if (frequency <= 172000) { -+ data[3] = (u8)(ascot3_sett[tv_system].rfovld_det_lv1_vl & 0x0F); -+ data[4] = (u8)(ascot3_sett[tv_system].ifovld_det_lv_vl & 0x07); -+ } else if (frequency <= 464000) { -+ data[3] = (u8)(ascot3_sett[tv_system].rfovld_det_lv1_vh & 0x0F); -+ data[4] = (u8)(ascot3_sett[tv_system].ifovld_det_lv_vh & 0x07); -+ } else { -+ data[3] = (u8)(ascot3_sett[tv_system].rfovld_det_lv1_u & 0x0F); -+ data[4] = (u8)(ascot3_sett[tv_system].ifovld_det_lv_u & 0x07); -+ } -+ data[4] |= 0x20; -+ -+ /* Setting for IF frequency and bandwidth */ -+ data[5] = (u8)((ascot3_sett[tv_system].if_bpf_f0 << 4) & 0x30); -+ data[5] |= (u8)(ascot3_sett[tv_system].bw & 0x03); -+ data[6] = (u8)(ascot3_sett[tv_system].fif_offset & 0x1F); -+ data[7] = (u8)(ascot3_sett[tv_system].bw_offset & 0x1F); -+ -+ /* RF tuning frequency setting */ -+ data[8] = (u8)(frequency & 0xFF); /* 0x10: FRF_L */ -+ data[9] = (u8)((frequency >> 8) & 0xFF); /* 0x11: FRF_M */ -+ data[10] = (u8)((frequency >> 16) & 0x0F); /* 0x12: FRF_H (bit[3:0]) */ -+ /* Tuning command */ -+ data[11] = 0xFF; -+ /* Enable IF output, AGC and IFOUT pin selection */ -+ data[12] = 0x11; -+ /* Tuning setting for analog block*/ -+ if (tv_system == ASCOT3_DTV_DVBC_6 || -+ tv_system == ASCOT3_DTV_DVBC_8) { -+ data[13] = 0xD9; -+ data[14] = 0x0F; -+ data[15] = 0x25; -+ data[16] = 0x87; -+ } else { -+ data[13] = 0x99; -+ data[14] = 0x00; -+ data[15] = 0x24; -+ data[16] = 0x87; -+ } -+ ascot3_write_regs(priv, 0x68, data, 17); -+ -+ msleep(50); -+ -+ priv->state = STATE_ACTIVE; -+ ascot3_write_reg(priv, 0x88, 0x00); -+ ascot3_write_reg(priv, 0x87, 0xC0); -+ -+ priv->frequency = frequency; -+ return 0; -+} -+ -+static int ascot3_get_frequency(struct dvb_frontend *fe, u32 *frequency) -+{ -+ struct ascot3_priv *priv = fe->tuner_priv; -+ -+ *frequency = priv->frequency * 1000; -+ return 0; -+} -+ -+static struct dvb_tuner_ops ascot3_tuner_ops = { -+ .info = { -+ .name = "Sony ASCOT3", -+ .frequency_min = 1000000, -+ .frequency_max = 1200000000, -+ .frequency_step = 25000, -+ }, -+ .init = ascot3_init, -+ .release = ascot3_release, -+ .sleep = ascot3_sleep, -+ .set_params = ascot3_set_params, -+ .get_frequency = ascot3_get_frequency, -+}; -+ -+struct dvb_frontend *ascot3_attach(struct dvb_frontend *fe, -+ const struct ascot3_config *config, -+ struct i2c_adapter *i2c) -+{ -+ u8 data[20]; -+ struct ascot3_priv *priv = NULL; -+ -+ priv = kzalloc(sizeof(struct ascot3_priv), GFP_KERNEL); -+ if (priv == NULL) -+ return NULL; -+ priv->i2c_address = config->i2c_address; -+ priv->i2c = i2c; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ /* Check if tuner is Sony ASCOT3 */ -+ data[0] = 0x00; -+ ascot3_read_reg(priv, 0x7F, data); -+ if (((data[0] & 0xF0) != 0xC0) && ((data[0] & 0xF0) != 0xD0)) { -+ kfree(priv); -+ return NULL; -+ } -+ /* Initial setting for internal logic block */ -+ data[0] = 0x7A; -+ data[1] = 0x01; -+ ascot3_write_regs(priv, 0x99, data, 2); -+ /* 16 MHz xTal frequency */ -+ data[0] = 16; -+ /* Driver current setting for crystal oscillator */ -+ /* Load capacitance setting for crystal oscillator */ -+ data[1] = 0x84; -+ data[2] = 0xB0; -+ /* Setting for REFOUT signal output */ -+ data[3] = 0x00; -+ /* GPIO0, GPIO1 port setting */ -+ data[4] = 0x00; -+ data[5] = 0x00; -+ /* Logic wake up, CPU boot */ -+ data[6] = 0xC4; -+ data[7] = 0x40; -+ /* For burst-write */ -+ data[8] = 0x10; -+ /* Setting for internal RFAGC */ -+ data[9] = 0x00; -+ data[10] = 0x45; -+ data[11] = 0x56; -+ /* Setting for analog block */ -+ data[12] = 0x07; -+ /* Initial setting for internal analog block */ -+ data[13] = 0x1C; -+ data[14] = 0x3F; -+ data[15] = 0x02; -+ data[16] = 0x10; -+ data[17] = 0x20; -+ data[18] = 0x0A; -+ data[19] = 0x00; -+ ascot3_write_regs(priv, 0x81, data, 20); -+ /* Setting for internal RFAGC */ -+ ascot3_write_reg(priv, 0x9B, 0x00); -+ msleep(10); -+ /* VCO current setting */ -+ data[0] = 0x8D; -+ data[1] = 0x06; -+ ascot3_write_regs(priv, 0x17, data, 2); -+ msleep(1); -+ ascot3_read_reg(priv, 0x19, data); -+ ascot3_write_reg(priv, 0x95, ((data[0] >> 4) & 0x0F)); -+ ascot3_enter_power_save(priv); -+ /* Load capacitance control setting for crystal oscillator */ -+ ascot3_write_reg(priv, 0x80, 0x01); -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ memcpy(&fe->ops.tuner_ops, &ascot3_tuner_ops, -+ sizeof(struct dvb_tuner_ops)); -+ fe->tuner_priv = priv; -+ dev_info(&priv->i2c->dev, -+ "Sony ASCOT3 attached on addr=%x at I2C adapter %p\n", -+ priv->i2c_address, priv->i2c); -+ return fe; -+} -+EXPORT_SYMBOL(ascot3_attach); -+ -+MODULE_DESCRIPTION("Sony ASCOT3 terr/cab tuner driver"); -+MODULE_AUTHOR("sasa.savic.sr@gmail.com"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/ascot3.h b/drivers/amlogic/dvb_tv/ascot3.h -new file mode 100644 -index 0000000..e245539 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/ascot3.h -@@ -0,0 +1,46 @@ -+/* -+ * ascot3.h -+ * -+ * Sony Ascot3 DVB-T/T2/C tuner driver -+ * -+ * Copyright (C) 2015 Sasa Savic -+ * -+ * Based on ascot2e driver -+ * -+ * Copyright 2012 Sony Corporation -+ * Copyright (C) 2014 NetUP Inc. -+ * Copyright (C) 2014 Sergey Kozlov -+ * Copyright (C) 2014 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef __DVB_ASCOT3_H__ -+#define __DVB_ASCOT3_H__ -+ -+#include -+#include -+#include -+ -+/** -+ * struct ascot3_config - the configuration of Ascot2E tuner driver -+ * @i2c_address: I2C address of the tuner -+ * @xtal_freq_mhz: Oscillator frequency, MHz -+ */ -+struct ascot3_config { -+ u8 i2c_address; -+ u8 xtal_freq_mhz; -+}; -+ -+extern struct dvb_frontend *ascot3_attach(struct dvb_frontend *fe, -+ const struct ascot3_config *config, -+ struct i2c_adapter *i2c); -+#endif -diff --git a/drivers/amlogic/dvb_tv/avl6211.c b/drivers/amlogic/dvb_tv/avl6211.c -new file mode 100644 -index 0000000..278f026 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/avl6211.c -@@ -0,0 +1,1979 @@ -+/* -+ * Driver for the Availink AVL6211+AV2011 DVB-S/S2 demod+tuner -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "dvb_frontend.h" -+#include "avl6211_reg.h" -+#include "avl6211.h" -+ -+ -+const struct avl6211_pllconf pll_conf[] = { -+ /* The following set of PLL configuration at different reference clock frequencies refer to demod operation */ -+ /* in standard performance mode. */ -+ { 503, 1, 7, 4, 2, 4000, 11200, 16800, 25200 } /* Reference clock 4 MHz, Demod clock 112 MHz, FEC clock 168 MHz, MPEG clock 252 MHz */ -+ ,{ 447, 1, 7, 4, 2, 4500, 11200, 16800, 25200 } /* Reference clock 4.5 MHz, Demod clock 112 MHz, FEC clock 168 MHz, MPEG clock 252 MHz */ -+ ,{ 503, 4, 7, 4, 2, 10000, 11200, 16800, 25200 } /* Reference clock 10 MHz, Demod clock 112 MHz, FEC clock 168 MHz, MPEG clock 252 MHz */ -+ ,{ 503, 7, 7, 4, 2, 16000, 11200, 16800, 25200 } /* Reference clock 16 MHz, Demod clock 112 MHz, FEC clock 168 MHz, MPEG clock 252 MHz */ -+ ,{ 111, 2, 7, 4, 2, 27000, 11200, 16800, 25200 } /* Reference clock 27 MHz, Demod clock 112 MHz, FEC clock 168 MHz, MPEG clock 252 MHz */ -+ -+ /* The following set of PLL configuration at different reference clock frequencies refer to demod operation */ -+ /* in high performance mode. */ -+ ,{ 566, 1, 7, 4, 2, 4000, 12600, 18900, 28350 } /* Reference clock 4 MHz, Demod clock 126 MHz, FEC clock 189 MHz, MPEG clock 283.5 MHz */ -+ ,{ 503, 1, 7, 4, 2, 4500, 12600, 18900, 28350 } /* Reference clock 4.5 MHz, Demod clock 126 MHz, FEC clock 189 MHz, MPEG clock 283.5 MHz */ -+ ,{ 566, 4, 7, 4, 2, 10000, 12600, 18900, 28350 } /* Reference clock 10 MHz, Demod clock 126 MHz, FEC clock 189 MHz, MPEG clock 283.5 MHz */ -+ ,{ 566, 7, 7, 4, 2, 16000, 12600, 18900, 28350 } /* Reference clock 16 MHz, Demod clock 126 MHz, FEC clock 189 MHz, MPEG clock 283.5 MHz */ -+ ,{ 377, 8, 7, 4, 2, 27000, 12600, 18900, 28350 } /* Reference clock 27 MHz, Demod clock 126 MHz, FEC clock 189 MHz, MPEG clock 283.5 MHz */ -+}; -+ -+const unsigned short pll_array_size = sizeof(pll_conf) / sizeof(struct avl6211_pllconf); -+ -+struct avl6211_state -+{ -+ struct i2c_adapter* i2c; -+ struct avl6211_config* config; -+ struct dvb_frontend frontend; -+ -+ u8 diseqc_status; -+ u16 locked; -+ u32 frequency; -+ u32 symbol_rate; -+ u32 flags; -+ -+ int demod_id; -+ -+ u16 tuner_lpf; -+ u16 demod_freq; /* Demod clock in 10kHz units */ -+ u16 fec_freq; /* FEC clock in 10kHz units */ -+ u16 mpeg_freq; /* MPEG clock in 10kHz units */ -+ -+ bool boot; -+ bool gpio_on; -+}; -+struct avl6211_diseqc_tx_status -+{ -+ u8 tx_done; -+ u8 tx_fifo_cnt; -+}; -+static u16 extract_16(const u8 * buf) -+{ -+ u16 data; -+ data = buf[0]; -+ data = (u16)(data << 8) + buf[1]; -+ return data; -+} -+static u32 extract_32(const u8 * buf) -+{ -+ unsigned int data; -+ data = buf[0]; -+ data = (data << 8) + buf[1]; -+ data = (data << 8) + buf[2]; -+ data = (data << 8) + buf[3]; -+ return data; -+} -+static int avl6211_i2c_writereg(struct avl6211_state *state, u8 *data, u16 *size) -+{ -+ int ret; -+ struct i2c_msg msg[1] = { -+ { -+ .addr = state->config->demod_address, -+ .flags = 0, -+ .buf = data, -+ .len = *size, -+ } -+ }; -+ -+ ret = i2c_transfer(state->i2c, msg, 1); -+ if (ret == 1) { -+ ret = 0; -+ } else { -+ dev_warn(&state->i2c->dev, "i2c wr failed=%d", ret); -+ ret = -EREMOTEIO; -+ } -+ -+ return ret; -+} -+static int avl6211_i2c_readreg(struct avl6211_state* state, u8 * data, u16 * size) -+{ -+ int ret; -+ struct i2c_msg msg[1] = { -+ { -+ .addr = state->config->demod_address, -+ .flags = I2C_M_RD, -+ .buf = data, -+ .len = *size, -+ } -+ }; -+ -+ ret = i2c_transfer(state->i2c, msg, 1); -+ -+ if (ret == 1) { -+ ret = 0; -+ } else { -+ dev_warn(&state->i2c->dev, "i2c rd failed=%d", ret); -+ ret = -EREMOTEIO; -+ } -+ -+ return ret; -+} -+static int avl6211_i2c_read(struct avl6211_state* state, u32 offset, u8 * buf, u16 buf_size) -+{ -+ int ret; -+ u8 buf_tmp[3]; -+ u16 x1 = 3, x2 = 0; -+ u16 size; -+ -+ format_addr(offset, buf_tmp); -+ ret = avl6211_i2c_writereg(state, buf_tmp, &x1); -+ if (ret) -+ goto err; -+ -+ if (buf_size & 1) -+ size = buf_size - 1; -+ else -+ size = buf_size; -+ -+ while (size > I2C_MAX_READ) { -+ x1 = I2C_MAX_READ; -+ ret = avl6211_i2c_readreg(state, buf + x2, &x1); -+ if (ret) -+ goto err; -+ x2 += I2C_MAX_READ; -+ size -= I2C_MAX_READ; -+ } -+ -+ if (size != 0) { -+ ret = avl6211_i2c_readreg(state, buf + x2, &size); -+ if (ret) -+ goto err; -+ } -+ -+ if (buf_size & 1) { -+ x1 = 2; -+ ret = avl6211_i2c_readreg(state, buf_tmp, &x1); -+ if (ret) -+ goto err; -+ buf[buf_size-1] = buf_tmp[0]; -+ } -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_write(struct avl6211_state* state, u8 * buf, u16 buf_size) -+{ -+ int ret; -+ u8 buf_tmp[5], *x3; -+ u16 x1, x2 = 0, tmp; -+ u16 size; -+ u32 addr; -+ -+ if (WARN_ON(buf_size < 3)) -+ return -EINVAL; -+ -+ /* Actual data size */ -+ buf_size -= 3; -+ /* Dump address */ -+ addr = buf[0]; -+ addr = addr << 8; -+ addr += buf[1]; -+ addr = addr << 8; -+ addr += buf[2]; -+ -+ if (buf_size & 1) -+ size = buf_size -1; -+ else -+ size = buf_size; -+ -+ tmp = (I2C_MAX_WRITE - 3) & 0xfffe; /* How many bytes data we can transfer every time */ -+ -+ x2 = 0; -+ while( size > tmp ) { -+ x1 = tmp + 3; -+ /* Save the data */ -+ buf_tmp[0] = buf[x2]; -+ buf_tmp[1] = buf[x2 + 1]; -+ buf_tmp[2] = buf[x2 + 2]; -+ x3 = buf + x2; -+ format_addr(addr, x3); -+ ret = avl6211_i2c_writereg(state, buf + x2, &x1); -+ if (ret) -+ goto err; -+ /* Restore data */ -+ buf[x2] = buf_tmp[0]; -+ buf[x2 + 1] = buf_tmp[1]; -+ buf[x2 + 2] = buf_tmp[2]; -+ addr += tmp; -+ x2 += tmp; -+ size -= tmp; -+ } -+ -+ x1 = size + 3; -+ /* Save the data */ -+ buf_tmp[0] = buf[x2]; -+ buf_tmp[1] = buf[x2 + 1]; -+ buf_tmp[2] = buf[x2 + 2]; -+ x3 = buf + x2; -+ format_addr(addr, x3); -+ ret = avl6211_i2c_writereg(state, buf + x2, &x1); -+ if (ret) -+ goto err; -+ /* Restore data */ -+ buf[x2] = buf_tmp[0]; -+ buf[x2 + 1] = buf_tmp[1]; -+ buf[x2 + 2] = buf_tmp[2]; -+ addr += size; -+ x2 += size; -+ -+ if (buf_size & 1) { -+ format_addr(addr, buf_tmp); -+ x1 = 3; -+ ret = avl6211_i2c_writereg(state, buf_tmp, &x1); -+ if (ret) -+ goto err; -+ x1 = 2; -+ ret = avl6211_i2c_readreg(state, buf_tmp + 3, &x1); -+ goto err; -+ buf_tmp[3] = buf[x2 + 3]; -+ x1 = 5; -+ ret = avl6211_i2c_writereg(state, buf_tmp, &x1); -+ if (ret) -+ goto err; -+ } -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_read16(struct avl6211_state* state, u32 addr, u16 *data) -+{ -+ int ret; -+ u8 buf[2]; -+ -+ ret = avl6211_i2c_read(state, addr, buf, 2); -+ if (ret) -+ goto err; -+ -+ *data = extract_16(buf); -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_read32(struct avl6211_state* state, u32 addr, u32 *data) -+{ -+ int ret; -+ u8 buf[4]; -+ -+ ret = avl6211_i2c_read(state, addr, buf, 4); -+ if (ret) -+ goto err; -+ -+ *data = extract_32(buf); -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_write16(struct avl6211_state* state, u32 addr, u16 data) -+{ -+ int ret; -+ u8 buf[5], *p; -+ -+ format_addr(addr, buf); -+ p = buf + 3; -+ format_16(data, p); -+ -+ ret = avl6211_i2c_write(state, buf, 5); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_write32(struct avl6211_state* state, u32 addr, u32 data) -+{ -+ int ret; -+ u8 buf[7], *p; -+ -+ format_addr(addr, buf); -+ p = buf + 3; -+ format_32(data, p); -+ ret = avl6211_i2c_write(state, buf, 7); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_get_op_status(struct avl6211_state* state) -+{ -+ int ret; -+ u8 buf[2]; -+ -+ ret = avl6211_i2c_read(state, rx_cmd_addr, buf, 2); -+ if (ret) -+ goto err; -+ -+ if (buf[1] != 0) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_send_op(u8 ucOpCmd, struct avl6211_state* state) -+{ -+ int ret; -+ u8 buf[2]; -+ u16 x1; -+ int cnt = 20; -+ -+ do { -+ ret = avl6211_get_op_status(state); -+ if (!ret) -+ break; -+ -+ msleep(10); -+ cnt--; -+ } while (cnt != 0); -+ -+ if (ret) -+ goto err; -+ -+ buf[0] = 0; -+ buf[1] = ucOpCmd; -+ x1 = extract_16(buf); -+ ret = avl6211_i2c_write16(state, rx_cmd_addr, x1); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_repeater_get_status(struct avl6211_state* state) -+{ -+ int ret; -+ u8 buf[2]; -+ -+ ret = avl6211_i2c_read(state, i2cm_cmd_addr + I2CM_CMD_LENGTH - 2, buf, 2); -+ if (ret) -+ goto err; -+ -+ if (buf[1] != 0) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int avl6211_i2c_repeater_exec(struct avl6211_state* state, u8 * buf, u8 size) -+{ -+ int ret, i = 0; -+ -+ do { -+ ret = avl6211_i2c_repeater_get_status(state); -+ if (ret && 60 < i++) -+ goto err; -+ -+ msleep(5); -+ -+ } while (ret); -+ -+ ret = avl6211_i2c_write(state, buf, size); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_repeater_send(struct avl6211_state* state, u8 * buf, u16 size) -+{ -+ int ret; -+ u8 tmp_buf[I2CM_CMD_LENGTH + 3]; -+ u16 i, j; -+ u16 cmd_size; -+ -+ if (WARN_ON(size > I2CM_CMD_LENGTH - 3)) -+ return -EINVAL; -+ -+ memset(tmp_buf, 0, sizeof(tmp_buf)); -+ -+ cmd_size = ((size + 3) % 2) + 3 + size; -+ format_addr(i2cm_cmd_addr + I2CM_CMD_LENGTH - cmd_size, tmp_buf); -+ -+ i = 3 + ((3 + size) % 2); /* skip one byte if the size +3 is odd */ -+ -+ for (j = 0; j < size; j++) -+ tmp_buf[i++] = buf[j]; -+ -+ tmp_buf[i++] = (u8)size; -+ tmp_buf[i++] = state->config->tuner_address; -+ tmp_buf[i++] = OP_I2CM_WRITE; -+ -+ -+ ret = avl6211_i2c_repeater_exec(state, tmp_buf, (u8)(cmd_size + 3)); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int avl6211_i2c_repeater_recv(struct avl6211_state* state, u8 * buf, u16 size) -+{ -+ int ret, i = 0; -+ u8 tmp_buf[I2CM_RSP_LENGTH]; -+ -+ if (WARN_ON(size > I2CM_RSP_LENGTH)) -+ return -EINVAL; -+ -+ memset(tmp_buf, 0, sizeof(tmp_buf)); -+ -+ format_addr(i2cm_cmd_addr + I2CM_CMD_LENGTH - 4, tmp_buf); -+ tmp_buf[3] = 0x0; -+ tmp_buf[4] = (u8)size; -+ tmp_buf[5] = state->config->tuner_address; -+ tmp_buf[6] = OP_I2CM_READ; -+ -+ ret = avl6211_i2c_repeater_exec(state, tmp_buf, 7); -+ if (ret) -+ goto err; -+ -+ do { -+ ret = avl6211_i2c_repeater_get_status(state); -+ if (ret && 100 < i++) -+ goto err; -+ -+ msleep(10); -+ -+ } while (ret); -+ -+ ret = avl6211_i2c_read(state, i2cm_rsp_addr, buf, size); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_i2c_repeater_init(u16 bus_clk, struct avl6211_state* state) -+{ -+ u8 buf[5]; -+ int ret; -+ -+ ret = avl6211_i2c_write16(state, rc_i2cm_speed_kHz_addr, bus_clk); -+ if (ret) -+ goto err; -+ -+ format_addr(i2cm_cmd_addr + I2CM_CMD_LENGTH - 2, buf); -+ buf[3] = 0x01; -+ buf[4] = OP_I2CM_INIT; -+ ret = avl6211_i2c_repeater_exec(state, buf, 5); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int AV2011_I2C_write(u8 reg_start, u8* buff, u8 len, struct avl6211_state* state) -+{ -+ int ret, i = 0; -+ u8 ucTemp[50] = { 0 }; -+ -+ msleep(5); -+ ucTemp[0] = reg_start; -+ ret = avl6211_i2c_repeater_get_status(state); -+ -+ do { -+ ret = avl6211_i2c_repeater_get_status(state); -+ if (ret && 100 < i++) -+ goto err; -+ -+ msleep(1); -+ -+ } while (ret); -+ -+ for (i = 1; i < len + 1; i++) -+ ucTemp[i] = *(buff + i - 1); -+ -+ ret = avl6211_i2c_repeater_send(state, ucTemp, len+1); -+ if (ret) -+ goto err; -+ -+ msleep(5); -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int av2011_tuner_lock_status(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u8 lock = 0x0b; -+ u8 locked = 0; -+ ret = avl6211_i2c_repeater_send(state, &lock, 1); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_repeater_recv(state, &locked, 1); -+ if (ret) -+ goto err; -+ -+ if (!(locked & 0x01)) -+ return -EINVAL; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int av2011_lock(struct dvb_frontend* fe) -+{ -+ int ret; -+ struct avl6211_state *state = fe->demodulator_priv; -+ u8 reg[50]; -+ u32 fracN; -+ u32 BW; -+ u32 BF; -+ u32 freq = state->frequency / 1000; -+ u32 LPF = state->tuner_lpf * 100; -+ -+ memset(reg, 0, sizeof(reg)); -+ -+ msleep(50); -+ -+ fracN = (freq + 27/2) / 27; -+ if (fracN > 0xff) -+ fracN = 0xff; -+ -+ reg[0] = (char)(fracN & 0xff); -+ fracN = (freq << 17) / 27; -+ fracN = fracN & 0x1ffff; -+ reg[1] = (char)((fracN >> 9) & 0xff); -+ reg[2] = (char)((fracN >> 1) & 0xff); -+ reg[3] = (char)((fracN << 7) & 0x80) | 0x50; -+ -+ BW = (LPF * 135) / 200; -+ if (LPF < 6500) -+ BW = BW + 6000; -+ BW = BW + 2000; -+ BW = BW*108/100; -+ -+ if (BW < 4000) -+ BW = 4000; -+ if ( BW > 40000) -+ BW = 40000; -+ BF = (BW * 127 + 21100/2) / 21100; -+ -+ dev_dbg(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); -+ -+ reg[5] = (u8)BF; -+ -+ msleep(5); -+ ret = AV2011_I2C_write(0, reg, 4, state); -+ if (ret) -+ goto err; -+ -+ msleep(5); -+ -+ ret = AV2011_I2C_write(5, reg+5, 1, state); -+ if (ret) -+ goto err; -+ -+ msleep(5); -+ -+ reg[37] = 0x06; -+ ret = AV2011_I2C_write(37, reg+37, 1, state); -+ if (ret) -+ goto err;; -+ -+ msleep(5); -+ -+ reg[12] = 0x96 + (1 << 6); -+ ret = AV2011_I2C_write(12, reg+12, 1, state); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int av2011_tuner_reg_init(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ -+ u8 reg[50] = { -+ 0x38, 0x00, 0x00, 0x50, 0x1f, 0xa3, 0xfd, 0x58, 0x0e, -+ 0xc2, 0x88, 0xb4, 0xd6, 0x40, 0x94, 0x9a, 0x66, 0x40, -+ 0x80, 0x2b, 0x6a, 0x50, 0x91, 0x27, 0x8f, 0xcc, 0x21, -+ 0x10, 0x80, 0x02, 0xf5, 0x7f, 0x4a, 0x9b, 0xe0, 0xe0, -+ 0x36, 0x00, 0xab, 0x97, 0xc5, 0xa8, -+ }; -+ -+ ret = AV2011_I2C_write(0, reg, 12, state); -+ if (ret) -+ goto err; -+ -+ msleep(1); -+ -+ ret = AV2011_I2C_write(13, reg+13, 12, state); -+ if (ret) -+ goto err; -+ -+ ret = AV2011_I2C_write(25, reg+25, 11, state); -+ if (ret) -+ goto err; -+ -+ ret = AV2011_I2C_write(36, reg+36, 6, state); -+ if (ret) -+ goto err; -+ -+ msleep(1); -+ -+ ret = AV2011_I2C_write(12, reg+12, 1, state); -+ if (ret) -+ goto err; -+ -+ msleep(10); -+ -+ ret = AV2011_I2C_write(0, reg, 12, state); -+ if (ret) -+ goto err; -+ -+ msleep(1); -+ -+ ret = AV2011_I2C_write(13, reg+13 , 12, state); -+ if (ret) -+ goto err; -+ -+ ret = AV2011_I2C_write(25, reg+25 , 11, state); -+ if (ret) -+ goto err; -+ -+ ret = AV2011_I2C_write(36, reg+36, 6, state); -+ if (ret) -+ goto err; -+ -+ msleep(1); -+ -+ ret = AV2011_I2C_write(12, reg+12, 1, state); -+ if (ret) -+ goto err; -+ -+ msleep(5); -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int av2011_tuner_init(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ -+ ret = avl6211_i2c_write16(state, rc_tuner_slave_addr_addr, state->config->tuner_address); -+ if (ret) -+ goto err; -+ /* Use external control */ -+ ret = avl6211_i2c_write16(state, rc_tuner_use_internal_control_addr, 0); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_tuner_LPF_margin_100kHz_addr, 0); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_tuner_max_LPF_100kHz_addr, 360 ); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_repeater_init(state->config->tuner_i2c_clock, state); -+ if (ret) -+ goto err; -+ -+ ret = av2011_tuner_reg_init(fe); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int avl6211_diseqc_init(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 x1; -+ -+ ret = avl6211_i2c_write32(state, diseqc_srst_addr, 1); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, diseqc_samp_frac_n_addr, 200); /* 2M = 200 * 10kHz */ -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, diseqc_samp_frac_d_addr, state->demod_freq); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, diseqc_tone_frac_n_addr, (22 << 1)); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, diseqc_tone_frac_d_addr, state->demod_freq * 10); -+ if (ret) -+ goto err; -+ -+ /* Initialize the tx_control */ -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0x00000300; -+ x1 |= 0x20; /* Reset tx_fifo */ -+ x1 |= (u32)(0 << 6); -+ x1 |= (u32)(0 << 4); -+ x1 |= (1 << 3); /* Enable tx gap */ -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ x1 &= ~(0x20); /* Release tx_fifo reset */ -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ /* Initialize the rx_control */ -+ x1 = (u32)(0 << 2); -+ x1 |= (1 << 1); /* Activate the receiver */ -+ x1 |= (1 << 3); /* Envelop high when tone present */ -+ ret = avl6211_i2c_write32(state, diseqc_rx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ x1 = (u32)(0 >> 12); -+ ret = avl6211_i2c_write32(state, diseqc_rx_msg_tim_addr, x1); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_write32(state, diseqc_srst_addr, 0); -+ if (ret) -+ goto err; -+ -+ -+ state->diseqc_status = DISEQC_STATUS_INIT; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_diseqc_switch_mode(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret = 0; -+ u32 x1; -+ -+ switch (state->diseqc_status) { -+ case DISEQC_STATUS_MOD: -+ case DISEQC_STATUS_TONE: -+ ret = avl6211_i2c_read32(state, diseqc_tx_st_addr, &x1); -+ if (ret) -+ goto err; -+ if (((x1 & 0x00000040) >> 6) != 1) -+ ret = -EINVAL; -+ break; -+ case DISEQC_STATUS_CONTINUOUS: -+ case DISEQC_STATUS_INIT: -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_diseqc_get_tx_status(struct dvb_frontend* fe, struct avl6211_diseqc_tx_status * pTxStatus) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 x1; -+ -+ if ((state->diseqc_status == DISEQC_STATUS_MOD) || -+ (state->diseqc_status == DISEQC_STATUS_TONE)) { -+ ret = avl6211_i2c_read32(state, diseqc_tx_st_addr, &x1); -+ if (ret) -+ goto err; -+ -+ pTxStatus->tx_done = (u8)((x1 & 0x00000040) >> 6); -+ pTxStatus->tx_fifo_cnt = (u8)((x1 & 0x0000003c) >> 2); -+ } -+ else -+ ret = -EINVAL; -+ -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_diseqc_send_mod_data(struct dvb_frontend* fe, const u8 * buf, u8 size) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 x1, x2; -+ int cnt = 0; -+ u8 buf_tmp[8]; -+ u8 Continuousflag = 0; -+ -+ -+ if (WARN_ON(size > 8)) -+ return -EINVAL; -+ else { -+ ret = avl6211_diseqc_switch_mode(fe); -+ if (ret) -+ goto err; -+ -+ if (state->diseqc_status == DISEQC_STATUS_CONTINUOUS) { -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ if ((x1 >> 10) & 0x01) { -+ Continuousflag = 1; -+ x1 &= 0xfffff3ff; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ msleep(20); -+ } -+ } -+ /* Reset rx_fifo */ -+ ret = avl6211_i2c_read32(state, diseqc_rx_cntrl_addr, &x2); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, diseqc_rx_cntrl_addr, (x2 | 0x01)); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, diseqc_rx_cntrl_addr, (x2 & 0xfffffffe)); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffff8; //set to modulation mode and put it to FIFO load mode -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ /* Trunk address */ -+ format_addr(diseqc_tx_fifo_map_addr, buf_tmp); -+ buf_tmp[3] = 0; -+ buf_tmp[4] = 0; -+ buf_tmp[5] = 0; -+ for (x2 = 0; x2 < size; x2++) { -+ buf_tmp[6] = buf[x2]; -+ ret = avl6211_i2c_write(state, buf_tmp, 7); -+ if (ret) -+ goto err; -+ } -+ -+ x1 |= (1 << 2); //start fifo transmit. -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ state->diseqc_status = DISEQC_STATUS_MOD; -+ do -+ { -+ msleep(1); -+ if (++cnt > 500) { -+ ret = -ETIME; -+ goto err; -+ } -+ ret = avl6211_i2c_read32(state, diseqc_tx_st_addr, &x1); -+ if (ret) -+ goto err; -+ } while ( 1 != ((x1 & 0x00000040) >> 6) ); -+ -+ msleep(20); -+ if (Continuousflag == 1) //resume to send out wave -+ { -+ //No data in FIFO -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffff8; -+ x1 |= 0x03; //switch to continuous mode -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ //start to send out wave -+ x1 |= (1<<10); -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ state->diseqc_status = DISEQC_STATUS_CONTINUOUS; -+ } -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret;; -+} -+ -+static int avl6211_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *d) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ struct avl6211_diseqc_tx_status tx_status; -+ int cnt = 100; -+ int ret; -+ -+ if ((d->msg_len < 3) || (d->msg_len > 6)) -+ return -EINVAL; -+ -+ ret = avl6211_diseqc_send_mod_data(fe, d->msg, d->msg_len); -+ if (ret) -+ goto err; -+ -+ msleep(55); -+ -+ do { -+ ret = avl6211_diseqc_get_tx_status(fe, &tx_status); -+ if (ret) -+ goto err; -+ -+ if ( tx_status.tx_done == 1 ) -+ break; -+ -+ msleep(10); -+ cnt--; -+ if (!cnt) { -+ ret = -ETIME; -+ goto err; -+ } -+ } while (tx_status.tx_done != 1); -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int avl6211_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ struct avl6211_diseqc_tx_status tx_status; -+ int cnt = 100; -+ int tx_cnt = 0; -+ int ret; -+ u32 x1; -+ u8 buf[8]; -+ u8 Continuousflag = 0; -+ -+ ret = avl6211_diseqc_switch_mode(fe); -+ if (ret) -+ goto err; -+ -+ if (state->diseqc_status == DISEQC_STATUS_CONTINUOUS) { -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ if ((x1 >> 10) & 0x01) { -+ Continuousflag = 1; -+ x1 &= 0xfffff3ff; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ msleep(20); -+ } -+ } -+ /* No data in the FIFO */ -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffff8; /* Put it into the FIFO load mode */ -+ if (burst == SEC_MINI_A) -+ x1 |= 0x02; -+ else -+ x1 |= 0x01; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ /* Trunk address */ -+ format_addr(diseqc_tx_fifo_map_addr, buf); -+ buf[3] = 0; -+ buf[4] = 0; -+ buf[5] = 0; -+ buf[6] = 1; -+ -+ ret = avl6211_i2c_write(state, buf, 7); -+ if (ret) -+ goto err; -+ -+ x1 |= (1<<2); /* Start fifo transmit */ -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ state->diseqc_status = DISEQC_STATUS_TONE; -+ -+ do -+ { -+ msleep(1); -+ if (++tx_cnt > 500) { -+ ret = -ETIME; -+ goto err; -+ } -+ ret = avl6211_i2c_read32(state, diseqc_tx_st_addr, &x1); -+ if (ret) -+ goto err; -+ } while ( 1 != ((x1 & 0x00000040) >> 6) ); -+ -+ msleep(20); -+ -+ if (Continuousflag == 1) //resume to send out wave -+ { -+ //No data in FIFO -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffff8; -+ x1 |= 0x03; //switch to continuous mode -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ //start to send out wave -+ x1 |= (1<<10); -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ state->diseqc_status = DISEQC_STATUS_CONTINUOUS; -+ -+ } -+ do { -+ ret = avl6211_diseqc_get_tx_status(fe, &tx_status); -+ if ( tx_status.tx_done == 1 ) -+ break; -+ -+ msleep(10); -+ cnt--; -+ if (!cnt) { -+ ret = -ETIME; -+ goto err; -+ } -+ } while (tx_status.tx_done != 1); -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 x1; -+ -+ if (tone == SEC_TONE_ON) { -+ -+ ret = avl6211_diseqc_switch_mode(fe); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffff8; -+ x1 |= 0x03; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ x1 |= (1 << 10); -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ -+ state->diseqc_status = DISEQC_STATUS_CONTINUOUS; -+ } else { -+ -+ if (state->diseqc_status == DISEQC_STATUS_CONTINUOUS) { -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffff3ff; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ } -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_set_voltage(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 x1; -+ -+ if (voltage == SEC_VOLTAGE_OFF) { -+ -+ if (state->config->set_external_vol_gpio) -+ state->config->set_external_vol_gpio(&state->demod_id, 0); -+ -+ state->gpio_on = false; -+ -+ return 0; -+ } -+ if (voltage == SEC_VOLTAGE_13) { -+ if (state->config->use_lnb_pin59) { -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffdff; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ msleep(20); //delay 20ms -+ } -+ -+ if (state->config->use_lnb_pin60) { -+ -+ ret = avl6211_i2c_read32(state, gpio_reg_enb, &x1); -+ if (ret) -+ goto err; -+ x1 &= ~(1<<1); -+ ret = avl6211_i2c_write32(state, gpio_reg_enb, x1); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_read32(state, gpio_data_reg_out, &x1); -+ if (ret) -+ goto err; -+ x1 &= ~(1<<1) ; -+ ret = avl6211_i2c_write32(state, gpio_data_reg_out, x1); -+ if (ret) -+ goto err; -+ msleep(20); -+ -+ } -+ } else if (voltage == SEC_VOLTAGE_18) { -+ -+ if (state->config->use_lnb_pin59) { -+ ret = avl6211_i2c_read32(state, diseqc_tx_cntrl_addr, &x1); -+ if (ret) -+ goto err; -+ x1 &= 0xfffffdff; -+ x1 |= 0x200; -+ ret = avl6211_i2c_write32(state, diseqc_tx_cntrl_addr, x1); -+ if (ret) -+ goto err; -+ msleep(20); //delay 20ms -+ } -+ if (state->config->use_lnb_pin60) { -+ ret = avl6211_i2c_read32(state, gpio_reg_enb, &x1); -+ if (ret) -+ goto err; -+ x1 &= ~(1<<1); -+ ret = avl6211_i2c_write32(state, gpio_reg_enb, x1); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_read32(state, gpio_data_reg_out, &x1); -+ if (ret) -+ goto err; -+ x1 |= 1<<1 ; -+ ret = avl6211_i2c_write32(state, gpio_data_reg_out, x1); -+ if (ret) -+ goto err; -+ msleep(20); -+ } -+ } -+ -+ if (!state->gpio_on) { -+ state->gpio_on = true; -+ if (state->config->set_external_vol_gpio) -+ state->config->set_external_vol_gpio(&state->demod_id, 1); -+ } -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_read_ber(struct dvb_frontend* fe, u32* ber) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 r_ber; -+ -+ *ber = 0; -+ -+ if (state->locked == 1) { -+ ret = avl6211_i2c_read32(state, rp_uint_BER_addr, &r_ber); -+ if (ret) -+ goto err; -+ -+ if (r_ber > 0) -+ *ber = r_ber / 1000000000; -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+u8 DVBS_SNR[6] = { 12, 32, 41, 52, 58, 62 }; -+u8 DVBS2Qpsk_SNR[8] = { 10, 24, 32, 41, 47, 52, 63, 65 }; -+u8 DVBS28psk_SNR[6] = { 57, 67, 80, 95, 100, 110 }; -+static int avl6211_read_snr(struct dvb_frontend* fe, u16 *snr) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u8 SNRrefer = 0; -+ u32 r_snr, code_rate, modulation; -+ -+ *snr = 0; -+ -+ if (state->locked == 1) { -+ ret = avl6211_i2c_read32(state, rs_int_SNR_dB_addr, &r_snr); -+ if (ret) -+ goto err; -+ if (r_snr < 10000) { -+ ret = avl6211_i2c_read32(state, rs_code_rate_addr, &code_rate); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_read32(state, rs_modulation_addr, &modulation); -+ if (ret) -+ goto err; -+ -+ if (code_rate < 6) -+ SNRrefer = DVBS_SNR[code_rate]; -+ else { -+ if (modulation == 1) -+ SNRrefer = DVBS28psk_SNR[code_rate - 10]; -+ else -+ SNRrefer = DVBS2Qpsk_SNR[code_rate - 9]; -+ } -+ if ((r_snr / 10) > SNRrefer) { -+ r_snr = r_snr/10 - SNRrefer; -+ if (r_snr >= 100) -+ *snr = 99; -+ else if (r_snr >= 50) // >5.0dB -+ *snr = 80+ (r_snr - 50)*20/50; -+ else if (r_snr >= 25) // > 2.5dB -+ *snr = 50+ (r_snr - 25)*30/25; -+ else if (r_snr >= 10) // > 1dB -+ *snr = 25+ (r_snr - 10)*25/15; -+ else -+ *snr = 5 + (r_snr)*20/10; -+ -+ *snr = (*snr * 65535) / 100; -+ } -+ } -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+struct Signal_Level -+{ -+ u16 SignalLevel; -+ short SignalDBM; -+}; -+struct Signal_Level AGC_LUT [91]= -+{ -+ {63688, 0},{62626, -1},{61840, -2},{61175, -3},{60626, -4},{60120, -5},{59647, -6},{59187, -7},{58741, -8},{58293, -9}, -+ {57822,-10},{57387,-11},{56913,-12},{56491,-13},{55755,-14},{55266,-15},{54765,-16},{54221,-17},{53710,-18},{53244,-19}, -+ {52625,-20},{52043,-21},{51468,-22},{50904,-23},{50331,-24},{49772,-25},{49260,-26},{48730,-27},{48285,-28},{47804,-29}, -+ {47333,-30},{46880,-31},{46460,-32},{46000,-33},{45539,-34},{45066,-35},{44621,-36},{44107,-37},{43611,-38},{43082,-39}, -+ {42512,-40},{41947,-41},{41284,-42},{40531,-43},{39813,-44},{38978,-45},{38153,-46},{37294,-47},{36498,-48},{35714,-49}, -+ {35010,-50},{34432,-51},{33814,-52},{33315,-53},{32989,-54},{32504,-55},{32039,-56},{31608,-57},{31141,-58},{30675,-59}, -+ {30215,-60},{29711,-61},{29218,-62},{28688,-63},{28183,-64},{27593,-65},{26978,-66},{26344,-67},{25680,-68},{24988,-69}, -+ {24121,-70},{23285,-71},{22460,-72},{21496,-73},{20495,-74},{19320,-75},{18132,-76},{16926,-77},{15564,-78},{14398,-79}, -+ {12875,-80},{11913,-81},{10514,-82},{ 9070,-83},{ 7588,-84},{ 6044,-85},{ 4613,-86},{ 3177,-87},{ 1614,-88},{ 123,-89}, -+ { 0,-90} -+}; -+static int avl6211_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) -+{ -+ #define Level_High_Stage 36 -+ #define Level_Low_Stage 76 -+ -+ #define Percent_Space_High 10 -+ #define Percent_Space_Mid 30 -+ #define Percent_Space_Low 60 -+ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 rf; -+ u16 Level; -+ int i = 0; -+ int Percent = 0; -+ *signal_strength = 0; -+ -+ if (state->locked == 1) { -+ ret = avl6211_i2c_read32(state, rx_aagc_gain, &rf); -+ if (ret) -+ goto err; -+ -+ rf += 0x800000; -+ rf &= 0xffffff; -+ Level = (u16)(rf >> 8); -+ -+ while( Level < AGC_LUT[i++].SignalLevel); -+ -+ if (i <= Level_High_Stage) -+ Percent = Percent_Space_Low+Percent_Space_Mid+ (Level_High_Stage-i)*Percent_Space_High/Level_High_Stage; -+ else if(i<=Level_Low_Stage) -+ Percent = Percent_Space_Low+ (Level_Low_Stage-i)*Percent_Space_Mid/(Level_Low_Stage-Level_High_Stage); -+ else -+ Percent =(90-i)*Percent_Space_Low/(90-Level_Low_Stage); -+ -+ *signal_strength = (Percent * 65535) / 100; -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_read_status(struct dvb_frontend* fe, fe_status_t* status) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ *status = 0; -+ -+ ret = avl6211_i2c_read16(state, rs_fec_lock_addr, &state->locked); -+ if (ret) -+ goto err; -+ -+ if (state->locked == 1) -+ *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | -+ FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) -+{ -+ *ucblocks = 0; -+ return 0; -+} -+static int avl6211_get_frontend(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ u32 code_rate; -+ u16 ret; -+ -+ if (!state->locked) -+ return 0; -+ -+ ret = avl6211_i2c_read32(state, rs_code_rate_addr, &code_rate); -+ if (ret) -+ goto err; -+ -+ p->frequency = state->frequency; -+ p->inversion = INVERSION_AUTO; -+ p->symbol_rate = state->symbol_rate; -+ -+ switch (code_rate) { -+ case 0: -+ p->fec_inner = FEC_1_2; -+ break; -+ case 1: -+ p->fec_inner = FEC_2_3; -+ break; -+ case 2: -+ p->fec_inner = FEC_3_4; -+ break; -+ case 13: -+ p->fec_inner = FEC_4_5; -+ break; -+ case 14: -+ p->fec_inner = FEC_5_6; -+ break; -+ case 4: -+ p->fec_inner = FEC_6_7; -+ break; -+ case 5: -+ p->fec_inner = FEC_7_8; -+ break; -+ case 15: -+ p->fec_inner = FEC_8_9; -+ break; -+ case 10: -+ p->fec_inner = FEC_3_5; -+ break; -+ case 16: -+ p->fec_inner = FEC_9_10; -+ break; -+ default: -+ p->fec_inner = FEC_AUTO; -+ break; -+ } -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_channel_lock(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u32 IQ; -+ u32 autoIQ_Detect; -+ u16 Standard; -+ u16 auto_manual_lock; -+ int cnt = 0; -+ -+ ret = avl6211_i2c_write16(state, rc_lock_mode_addr, 0); -+ if (ret) -+ goto err; -+ -+ IQ = ((state->flags) & CI_FLAG_IQ_BIT_MASK) >> CI_FLAG_IQ_BIT; -+ ret = avl6211_i2c_write32(state, rc_specinv_addr, IQ); -+ if (ret) -+ goto err; -+ -+ Standard = (u16)(((state->flags) & CI_FLAG_DVBS2_BIT_MASK) >> CI_FLAG_DVBS2_BIT); -+ autoIQ_Detect = (((state->flags) & CI_FLAG_IQ_AUTO_BIT_MASK) >> CI_FLAG_IQ_AUTO_BIT); -+ auto_manual_lock = (u16)(((state->flags) & CI_FLAG_MANUAL_LOCK_MODE_BIT_MASK) >> CI_FLAG_MANUAL_LOCK_MODE_BIT); -+ -+ -+ if((Standard == CI_FLAG_DVBS2_UNDEF) || (autoIQ_Detect == 1)) -+ Standard = 0x14; -+ -+ if (state->symbol_rate == 0) -+ state->symbol_rate = 1; -+ -+ ret = avl6211_i2c_write16(state, rc_fec_bypass_coderate_addr, auto_manual_lock); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_decode_mode_addr, Standard); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_iq_mode_addr, (u16)autoIQ_Detect); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, rc_int_sym_rate_MHz_addr, state->symbol_rate); -+ if (ret) -+ goto err; -+ -+ -+ ret = avl6211_send_op(OP_RX_INIT_GO, state); -+ if (ret) -+ goto err; -+ -+ do { -+ ret = avl6211_get_op_status(state); -+ if(!ret) -+ break; -+ msleep(1); -+ } while(cnt++ < 200); -+ -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_set_frontend(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ int ret; -+ u16 cnt; -+ u32 max_time; -+ -+ -+ state->frequency = c->frequency; -+ state->symbol_rate = c->symbol_rate; -+ -+ state->locked = 0; -+ -+ dev_dbg(&state->i2c->dev, -+ "%s: delivery_system=%d frequency=%d symbol_rate=%d\n", -+ __func__, c->delivery_system, c->frequency, c->symbol_rate); -+ -+ state->tuner_lpf = (state->symbol_rate / 100000); -+ if (state->tuner_lpf > 440) -+ state->tuner_lpf = 440; -+ -+ ret = av2011_lock(fe); -+ if (ret) -+ goto err; -+ -+ /* Wait for tuner locking */ -+ max_time = 150; /* Max waiting time: 150ms */ -+ -+ cnt = max_time / 10; -+ do { -+ ret = av2011_tuner_lock_status(fe); -+ -+ if (!ret) -+ break; -+ else { -+ msleep(10); /* Wait 10ms for demod to lock the channel */ -+ continue; -+ } -+ -+ } while (--cnt); -+ -+ if (!cnt) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ dev_dbg(&state->i2c->dev, "Tuner successfully lock!\n"); -+ -+ state->flags = (CI_FLAG_IQ_NO_SWAPPED) << CI_FLAG_IQ_BIT; //Normal IQ -+ state->flags |= (CI_FLAG_IQ_AUTO_BIT_AUTO) << CI_FLAG_IQ_AUTO_BIT; //Enable automatic IQ swap detection -+ state->flags |= (CI_FLAG_DVBS2_UNDEF) << CI_FLAG_DVBS2_BIT; //Enable automatic standard detection -+ -+ //This function should be called after tuner locked to lock the channel. -+ ret = avl6211_channel_lock(fe); -+ if (ret) -+ goto err; -+ -+ /* Wait a bit more when we have slow symbol rates */ -+ if (c->symbol_rate < 5000000) -+ max_time = 5000*2; /* Max waiting time: 1000ms */ -+ else if (c->symbol_rate < 10000000) -+ max_time = 600*2; /* Max waiting time: 600ms */ -+ else -+ max_time = 250*2; /* Max waiting time: 250ms */ -+ -+ cnt = max_time / 10; -+ do { -+ ret = avl6211_i2c_read16(state, rs_fec_lock_addr, &state->locked); -+ -+ if (!ret && state->locked == 1) -+ break; -+ -+ msleep(10); /* Wait 10ms for demod to lock the channel */ -+ } while (--cnt); -+ -+ if (!cnt) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); -+ -+ ret = avl6211_send_op(OP_RX_RESET_BERPER, state); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+ -+} -+ -+static int avl6211_get_demod_status(struct dvb_frontend* fe) -+{ -+ struct avl6211_state *state = fe->demodulator_priv; -+ int ret; -+ u8 buf[2]; -+ u32 x1 = 0; -+ -+ ret = avl6211_i2c_read32(state, core_reset_b_reg, &x1); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_read16(state, core_ready_word_addr, (u16 *)buf); -+ if (ret) -+ goto err; -+ -+ if ((x1 == 0) || (buf[0] != 0x5a) || (buf[1] != 0xa5)) { -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int avl6211_setup_pll(struct avl6211_state* state, const struct avl6211_pllconf * pll_ptr) -+{ -+ int ret; -+ -+ ret = avl6211_i2c_write32(state, pll_clkf_map_addr, pll_ptr->m_uiClkf); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, pll_bwadj_map_addr, pll_ptr->m_uiClkf); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, pll_clkr_map_addr, pll_ptr->m_uiClkr); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, pll_od_map_addr, pll_ptr->m_uiPllod); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, pll_od2_map_addr, pll_ptr->m_uiPllod2); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, pll_od3_map_addr, pll_ptr->m_uiPllod3); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, pll_softvalue_en_map_addr, 1); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, reset_register_addr, 0); -+ if (ret) -+ goto err; -+ -+ /* Reset do not check for error */ -+ avl6211_i2c_write32(state, reset_register_addr, 1); -+ -+ state->demod_freq = pll_ptr->demod_freq; -+ state->fec_freq = pll_ptr->fec_freq; -+ state->mpeg_freq = pll_ptr->mpeg_freq; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int avl6211_load_firmware(struct dvb_frontend* fe) -+{ -+ struct avl6211_state* state = fe->demodulator_priv; -+ const struct firmware *fw = NULL; -+ u8 *buffer = NULL; -+ u32 buf_size, data_size; -+ u32 i = 4; -+ int ret; -+ -+ ret = avl6211_i2c_write32(state, core_reset_b_reg, 0); -+ if (ret) -+ goto err; -+ -+ dev_dbg(&state->i2c->dev, "Uploading demod firmware (%s)...\n", AVL6211_DEMOD_FW); -+ ret = request_firmware(&fw, AVL6211_DEMOD_FW, &state->i2c->dev); -+ if (ret) { -+ dev_dbg(&state->i2c->dev, "Firmware upload failed. Timeout or file not found\n"); -+ goto err; -+ } -+ -+ buffer = kmalloc(fw->size , GFP_KERNEL); -+ if (!buffer) { -+ release_firmware(fw); -+ fw = NULL; -+ dev_dbg(&state->i2c->dev, "Failed to allocate tmp memory for firmware\n"); -+ return -ENOMEM; -+ } -+ memcpy(buffer, fw->data, fw->size); -+ -+ release_firmware(fw); -+ fw = NULL; -+ -+ data_size = extract_32(buffer); -+ while (i < data_size) -+ { -+ buf_size = extract_32(buffer + i); -+ i += 4; -+ ret = avl6211_i2c_write(state, buffer + i + 1, (u16)(buf_size + 3)); -+ if (ret) -+ goto err; -+ -+ i += 4 + buf_size; -+ } -+ -+ ret = avl6211_i2c_write32(state, 0x00000000, 0x00003ffc); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, core_ready_word_addr, 0x0000); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, error_msg_addr, 0x00000000); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, error_msg_addr + 4, 0x00000000); -+ if (ret) -+ goto err; -+ -+ /* Reset do not check for error */ -+ avl6211_i2c_write32(state, core_reset_b_reg, 1); -+ -+ kfree(buffer); -+ return 0; -+ -+err: -+ kfree(buffer); -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int avl6211_init(struct dvb_frontend* fe) -+{ -+ struct avl6211_state* state = fe->demodulator_priv; -+ int ret; -+ -+ if (state->boot) -+ return 0; -+ -+ ret = avl6211_setup_pll(state, (const struct avl6211_pllconf * )(pll_conf + state->config->demod_refclk)); -+ if (ret) -+ goto err; -+ -+ msleep(100); -+ -+ ret = avl6211_load_firmware(fe); -+ if (ret) -+ goto err; -+ -+ msleep(100); -+ -+ ret = avl6211_get_demod_status(fe); -+ if (ret) -+ goto err; -+ -+ -+ ret = avl6211_i2c_write32(state, 0x263E, 50000); -+ if (ret) -+ goto err; -+ /* Set clk to match the PLL */ -+ ret = avl6211_i2c_write16(state, rc_int_dmd_clk_MHz_addr, state->demod_freq); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_int_fec_clk_MHz_addr, state->fec_freq); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_int_mpeg_clk_MHz_addr, state->mpeg_freq); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, rc_format_addr, 1); -+ if (ret) -+ goto err; -+ -+ /* Set AGC polarization */ -+ ret = avl6211_i2c_write32(state, rc_rfagc_pol_addr, (u32)state->config->tuner_rfagc); -+ if (ret) -+ goto err; -+ /* Drive RF AGC */ -+ ret = avl6211_i2c_write16(state, rc_aagc_ref_addr, 0x30); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write32(state, rc_rfagc_tri_enb, 1); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_write16(state, rc_blind_scan_tuner_spectrum_inversion_addr, (u16)state->config->tuner_spectrum); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_write32(state, rc_mpeg_mode_addr, (u32)(state->config->mpeg_format)); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_mpeg_serial_addr, (u16)(state->config->mpeg_mode)); -+ if (ret) -+ goto err; -+ ret = avl6211_i2c_write16(state, rc_mpeg_posedge_addr, (u16)(state->config->mpeg_pol)); -+ if (ret) -+ goto err; -+ -+ if (state->config->mpeg_mode) { -+ ret = avl6211_i2c_write32(state, rc_outpin_sel_addr, (u32)(state->config->mpeg_pin)); -+ if (ret) -+ goto err; -+ } -+ -+ ret = avl6211_i2c_write32(state, rc_mpeg_bus_tri_enb, 1); -+ if (ret) -+ goto err; -+ -+ ret = av2011_tuner_init(fe); -+ if (ret) -+ goto err; -+ ret = avl6211_diseqc_init(fe); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_write32(state, gpio_data_reg_out, 0); -+ if (ret) -+ goto err; -+ -+ ret = avl6211_i2c_write32(state, gpio_reg_enb, 0); -+ if (ret) -+ goto err; -+ -+ state->boot = true; -+ -+ dev_dbg(&state->i2c->dev, "AVL6211+AV2011 init OK\n"); -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static void avl6211_release(struct dvb_frontend* fe) -+{ -+ struct avl6211_state* state = fe->demodulator_priv; -+ kfree(state); -+} -+ -+static struct dvb_frontend_ops avl6211_ops = { -+ .delsys = { SYS_DVBS, SYS_DVBS2 }, -+ .info = { -+ .name = "Availink AVL6211+AV2011 DVB-S/S2", -+ .frequency_min = 950000, -+ .frequency_max = 2150000, -+ .frequency_stepsize = 0, -+ .frequency_tolerance = 0, -+ .symbol_rate_min = 800000, /* Min = 800K */ -+ .symbol_rate_max = 50000000, /* Max = 50M */ -+ .caps = FE_CAN_INVERSION_AUTO | -+ FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | -+ FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | -+ FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO | -+ FE_CAN_QPSK | FE_CAN_RECOVER | FE_CAN_2G_MODULATION -+ }, -+ -+ .init = avl6211_init, -+ .release = avl6211_release, -+ .read_status = avl6211_read_status, -+ .read_ber = avl6211_read_ber, -+ .read_signal_strength = avl6211_read_signal_strength, -+ .read_snr = avl6211_read_snr, -+ .read_ucblocks = avl6211_read_ucblocks, -+ .set_tone = avl6211_set_tone, -+ .set_voltage = avl6211_set_voltage, -+ .diseqc_send_master_cmd = avl6211_send_diseqc_msg, -+ .diseqc_send_burst = avl6211_diseqc_send_burst, -+ .set_frontend = avl6211_set_frontend, -+ .get_frontend = avl6211_get_frontend, -+}; -+ -+struct dvb_frontend* avl6211_attach(struct i2c_adapter* i2c, -+ struct avl6211_config* config, -+ int id) -+ -+{ -+ struct avl6211_state* state = NULL; -+ int ret; -+ u32 ChipID = 0; -+ -+ state = kzalloc(sizeof(struct avl6211_state), GFP_KERNEL); -+ if (!state) { -+ ret = -ENOMEM; -+ dev_err(&i2c->dev, "kzalloc() failed\n"); -+ goto err1; -+ } -+ -+ state->config = config; -+ state->i2c = i2c; -+ state->demod_id = id; -+ -+ ret = avl6211_i2c_read32(state, rs_cust_chip_id_addr, &ChipID); -+ if (ret || ChipID != 0x0000000F) -+ goto err2; -+ -+ dev_info(&i2c->dev, "AVL6211+AV2011 DVB-S/S2 successfully attached\n"); -+ -+ memcpy(&state->frontend.ops, &avl6211_ops, sizeof(struct dvb_frontend_ops)); -+ state->frontend.demodulator_priv = state; -+ -+ return &state->frontend; -+ -+err2: -+ kfree(state); -+err1: -+ dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return NULL; -+} -+ -+EXPORT_SYMBOL(avl6211_attach); -+ -+MODULE_DESCRIPTION("Availink AVL6211+AV2011 demod+tuner driver"); -+MODULE_AUTHOR("Sasa Savic "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/avl6211.h b/drivers/amlogic/dvb_tv/avl6211.h -new file mode 100644 -index 0000000..75c68cf ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/avl6211.h -@@ -0,0 +1,156 @@ -+/* -+ * Driver for the Availink AVL6211+AV2011 DVB-S/S2 demod+tuner -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __AVL6211_H_ -+#define __AVL6211_H_ -+ -+#include -+#include -+ -+ -+#define AVL6211_DEMOD_FW "dvb-fe-avl6211.fw" -+ -+#define I2C_MAX_READ 64 -+#define I2C_MAX_WRITE 64 -+ -+ -+#define CI_FLAG_IQ_BIT 0x00000000 -+#define CI_FLAG_IQ_BIT_MASK 0x00000001 -+#define CI_FLAG_IQ_NO_SWAPPED 0x00000000 -+#define CI_FLAG_IQ_SWAPPED 0x00000001 -+#define CI_FLAG_IQ_AUTO_BIT_MASK 0x00000020 -+ -+ -+#define CI_FLAG_IQ_AUTO_BIT 0x00000005 -+#define CI_FLAG_IQ_AUTO_BIT_AUTO 0x00000001 -+ -+#define CI_FLAG_DVBS2_BIT 0x00000002 -+#define CI_FLAG_DVBS2_UNDEF 0x00000004 -+#define CI_FLAG_DVBS2_BIT_MASK 0x0000001c -+ -+#define CI_FLAG_MANUAL_LOCK_MODE_BIT 0x00000001 -+#define CI_FLAG_MANUAL_LOCK_MODE_BIT_MASK 0x00000002 -+#define CI_FLAG_LOCK_MODE_BIT_MASK 0x00000040 -+ -+ -+#define ENABLE_FAST_REACQ 0x01 -+#define DISABLE_FAST_REACQ 0x00 -+#define ENABLE_CCI 0x03 -+#define DISABLE_CCI 0x02 -+#define MAX_LOWIF_SR 5000000 -+#define IF_OFFSET 500 -+ -+ -+/* Demod commands */ -+#define OP_RX_NOOP 0x00 -+#define OP_RX_LD_DEFAULT 0x01 -+#define OP_RX_INIT_GO 0x02 -+#define OP_RX_RESET_BERPER 0x03 -+#define OP_RX_HALT 0x04 -+#define OP_RX_SLEEP 0x05 -+#define OP_RX_WAKE 0x06 -+#define OP_RX_BLIND_SCAN 0x08 -+#define OP_RX_STDOUT_MODE 0x09 -+ -+/* Diseqc status */ -+#define DISEQC_STATUS_UNINIT 0x00 -+#define DISEQC_STATUS_INIT 0x01 -+#define DISEQC_STATUS_CONTINUOUS 0x02 -+#define DISEQC_STATUS_TONE 0x03 -+#define DISEQC_STATUS_MOD 0x04 -+ -+#define I2CM_CMD_LENGTH 0x14 -+#define I2CM_RSP_LENGTH 0x14 -+ -+#define OP_I2CM_NOOP 0x00 -+#define OP_I2CM_INIT 0x01 -+#define OP_I2CM_WRITE 0x02 -+#define OP_I2CM_READ 0x03 -+ -+ -+ -+#define format_addr(X, Y) \ -+ do { \ -+ Y[0] =(u8)((X) >> 16); \ -+ Y[1] =(u8)((X) >> 8); \ -+ Y[2] =(u8)(X); \ -+ } while (0) -+ -+ -+#define format_16(X, Y) \ -+ do { \ -+ Y[0] =(u8)((X) >> 8); \ -+ Y[1] =(u8)((X) & 0xFF); \ -+ } while (0) -+ -+ -+#define format_32(X, Y) \ -+ do { \ -+ Y[0] =(u8)((X) >> 24); \ -+ Y[1] =(u8)((X) >> 16); \ -+ Y[2] =(u8)((X) >> 8); \ -+ Y[3] =(u8)((X) & 0xFF); \ -+ } while (0) -+ -+ -+struct avl6211_pllconf -+{ -+ u16 m_uiClkf; /* Feedback clock divider */ -+ u16 m_uiClkr; /* Reference clock divider */ -+ u16 m_uiPllod; /* PLL output divider */ -+ u16 m_uiPllod2; /* PLL output divider 2 */ -+ u16 m_uiPllod3; /* PLL output divider 3 */ -+ u16 ref_freq; /* Reference clock in kHz */ -+ u16 demod_freq; /* Demod clock in 10kHz */ -+ u16 fec_freq; /* FEC clock in 10kHz */ -+ u16 mpeg_freq; /* MPEG clock in 10kHz */ -+}; -+ -+struct avl6211_config -+{ -+ u8 tuner_address; /* Tuner i2c address */ -+ u16 tuner_i2c_clock; -+ u8 demod_address; /* The demodulator's i2c address 0x0C */ -+ -+ u8 mpeg_pol; /* 0 - Falling, 1 - Rising */ -+ u8 mpeg_mode; /* 0 - Parallel, 1 - Serial */ -+ u8 mpeg_format; /* 0 - Default TS stream, 1 - TS stream plus parity format */ -+ -+ u8 demod_refclk; /* Reference clock frequency selection */ -+ -+ /* Serial data is output on pin */ -+ u8 mpeg_pin; /* 0 - MPEG_DATA_0, 1 - MPEG_DATA_7 */ -+ -+ u8 tuner_rfagc; /* 0 - Normal pol, 1 - Inverted pol */ -+ u8 tuner_spectrum; /* 0 - signal spectrum normal, 1 - signal spectrum inverted */ -+ -+ u8 use_lnb_pin59; /* control 13/18V over demod GPIO pin59 */ -+ u8 use_lnb_pin60; /* control 13/18V over demod GPIO pin60 */ -+ -+ int (*set_external_vol_gpio)(int *demod_id, int on); /* external 13/18V control */ -+}; -+ -+ -+ -+extern struct dvb_frontend* avl6211_attach(struct i2c_adapter* i2c, -+ struct avl6211_config* config, -+ int id); -+ -+#endif -\ No newline at end of file -diff --git a/drivers/amlogic/dvb_tv/avl6211_reg.h b/drivers/amlogic/dvb_tv/avl6211_reg.h -new file mode 100644 -index 0000000..b7a0fe5 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/avl6211_reg.h -@@ -0,0 +1,101 @@ -+/* -+ * Driver for the Availink AVL6211+AV2011 DVB-S/S2 demod+tuner -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __AVL6211_REG_H_ -+#define __AVL6211_REG_H_ -+ -+ -+#define core_reset_b_reg 0x600000 -+#define gpio_data_in_to_reg 0x6C0004 -+#define gpio_data_reg_out 0x6C0008 -+#define gpio_reg_enb 0x6C000C -+ -+#define pll_clkr_map_addr 0x6C40C0 -+#define pll_clkf_map_addr 0x6C4100 -+#define pll_od_map_addr 0x6C4080 -+#define pll_od2_map_addr 0x6C4140 -+#define pll_od3_map_addr 0x6C4180 -+#define pll_bwadj_map_addr 0x6C41C0 -+#define pll_softvalue_en_map_addr 0x6C4200 -+#define reset_register_addr 0x6C4000 -+ -+ -+#define rx_aagc_gain 0x0040004C -+#define rc_rfagc_tri_enb 0x006C002C -+#define rc_mpeg_bus_tri_enb 0x006C0028 -+ -+ -+#define raptor_status_addr (0x00000860 + 0x0) -+#define rx_state_addr (0x00000690 + 0x0) -+#define rx_cmd_addr (0x00000400 + 0x0) -+#define i2cm_cmd_addr (0x00000404 + 0x0) -+#define i2cm_rsp_addr (0x00000418 + 0x0) -+#define error_msg_addr (0x0000042c + 0x0) -+#define rx_config_addr (0x0000043c + 0x0) -+#define core_ready_word_addr (0x00000434 + 0x0) -+ -+#define rs_cust_chip_id_addr 0x006C0034 -+ -+#define rp_uint_BER_addr (raptor_status_addr + 0x0) -+#define rc_rfagc_pol_addr (rx_config_addr + 0x0) -+#define rc_equalizer_addr (rx_config_addr + 0x8) -+#define rs_code_rate_addr (rx_state_addr + 0x8) -+#define rs_modulation_addr (rx_state_addr + 0xc) -+#define rc_format_addr (rx_config_addr + 0x10) -+#define rc_mpeg_mode_addr (rx_config_addr + 0x20) -+#define rc_outpin_sel_addr (rx_config_addr + 0x24) -+#define rs_int_SNR_dB_addr (rx_state_addr + 0x40) -+#define rc_aagc_ref_addr (rx_config_addr + 0xaa) -+#define rc_mpeg_posedge_addr (rx_config_addr + 0xbc) -+#define rc_mpeg_serial_addr (rx_config_addr + 0xbe) -+#define rs_fec_lock_addr (rx_state_addr + 0x164) -+#define rc_specinv_addr (rx_config_addr + 0x34) -+#define rc_int_sym_rate_MHz_addr (rx_config_addr + 0x54) -+#define rc_dvbs_ber_addr (rx_config_addr + 0x98) -+#define rc_int_dmd_clk_MHz_addr (rx_config_addr + 0x162) -+#define rc_int_fec_clk_MHz_addr (rx_config_addr + 0x164) -+#define rc_int_mpeg_clk_MHz_addr (rx_config_addr + 0x166) -+#define rc_int_carrier_freq_half_range_MHz_addr (rx_config_addr + 0x16c) -+#define rc_fec_bypass_coderate_addr (rx_config_addr + 0x194) -+#define rc_i2cm_speed_kHz_addr (rx_config_addr + 0x1ae) -+#define rc_tuner_slave_addr_addr (rx_config_addr + 0x1b6) -+#define rc_tuner_max_LPF_100kHz_addr (rx_config_addr + 0x1b8) -+#define rc_tuner_LPF_margin_100kHz_addr (rx_config_addr + 0x1ba) -+#define rc_tuner_use_internal_control_addr (rx_config_addr + 0x1bc) -+ -+#define rc_decode_mode_addr (rx_config_addr + 0x202) -+#define rc_iq_mode_addr (rx_config_addr + 0x204) -+#define rc_lock_mode_addr (rx_config_addr + 0x20a) -+#define rc_blind_scan_tuner_spectrum_inversion_addr (rx_config_addr + 0x220) -+ -+ -+ -+#define diseqc_tx_cntrl_addr 0x00700000 -+#define diseqc_tone_frac_n_addr 0x00700004 -+#define diseqc_tone_frac_d_addr 0x00700008 -+#define diseqc_tx_st_addr 0x0070000c -+#define diseqc_rx_msg_tim_addr 0x00700014 -+#define diseqc_rx_cntrl_addr 0x0070001c -+#define diseqc_srst_addr 0x00700020 -+#define diseqc_samp_frac_n_addr 0x00700028 -+#define diseqc_samp_frac_d_addr 0x0070002c -+#define diseqc_tx_fifo_map_addr 0x00700080 -+ -+#endif -diff --git a/drivers/amlogic/dvb_tv/c_stb_define.h b/drivers/amlogic/dvb_tv/c_stb_define.h -deleted file mode 100644 -index 66e30f1..0000000 ---- a/drivers/amlogic/dvb_tv/c_stb_define.h -+++ /dev/null -@@ -1,1162 +0,0 @@ --/* ----------------------------------------------------------------------*/ --/* This file is automatically generated from the script:*/ --/**/ --/* ./create_stb_define_for_C_code.pl*/ --/**/ --/* and was applied to the file*/ --/**/ --/* ./stb_define.h*/ --/**/ --/* DO NOT EDIT!!!!!*/ --/* ----------------------------------------------------------------------*/ --/**/ --#ifdef C_STB_DEFINE_H --#else --#define C_STB_DEFINE_H -- --/*=================================================*/ --/* STB Registers Start*/ --/*=================================================*/ --/* -----------------------------------------------*/ --#define STB_CBUS_BASE 0x1600 --/* -----------------------------------------------*/ --/* There are two instantiations under one CBUS slave. -- * Each CBUS slave can support*/ --/* 256 registers. -- * Each demux is allocated 128 registers so set the offset in*/ --/* the middle*/ --/* Copy this define but don't add a base address*/ --#define DEMUX_1_OFFSET 0x00 --#define DEMUX_2_OFFSET 0x50 --#define DEMUX_3_OFFSET 0xa0 --/*======================================================*/ --/* STB TOP Registers (8'hf0 - 8'hf7)*/ --/*======================================================*/ --/* bit 30:28 -- ciplus_o_sel*/ --/* bit 27:26 -- ciplus_i_sel*/ --/* bit 25 -- use FAIL fro TS2*/ --/* bit 24 -- use FAIL fro TS1*/ --/* bit 23 -- use FAIL fro TS0*/ --/* bit 22 -- invert fec_error for S2P1*/ --/* bit 21 -- invert fec_data for S2P1*/ --/* bit 20 -- invert fec_sync for S2P1*/ --/* bit 19 -- invert fec_valid for S2P1*/ --/* bit 18 -- invert fec_clk for S2P1*/ --/* bit 17:16 -- fec_s_sel for S2P1 -- * 00 - select TS0, 01 -- select TS1, 10 -- select TS2, 11 - reserved*/ --/* Bit 15 -- enable_des_pl_clk*/ --/* Bit 14:13 -- reserved*/ --/* Bit 12:10 -- ts_out_select, -- * 0-TS0, 1-TS1, 2-TS2, 3,4-Reserved, 5-S2P1, 6-S2P0, 7-File*/ --/* bit 9:8 -- des_i_sel 00 -- select demux0 as des input, --* 01 -- select_demux1, 10 -- select_demux2, 11 - reserved*/ --/* bit 7 -- enable_des_pl*/ --/* bit 6 -- invert fec_error for S2P0*/ --/* bit 5 -- invert fec_data for S2P0*/ --/* bit 4 -- invert fec_sync for S2P0*/ --/* bit 3 -- invert fec_valid for S2P0*/ --/* bit 2 -- invert fec_clk for S2P0*/ --/* bit 1:0 -- fec_s_sel for S2P0 -- * 00 - select TS0, 01 -- select TS1, 10 -- select TS2, 11 - reserved*/ --/*#define STB_TOP_CONFIG (STB_CBUS_BASE + 0xf0) // 0x16f0*/ --/*----------- bit define -----------*/ --#define INVERT_S2P1_FEC_ERROR 22 --#define INVERT_S2P1_FEC_DATA 21 --#define INVERT_S2P1_FEC_SYNC 20 --#define INVERT_S2P1_FEC_VALID 19 --#define INVERT_S2P1_FEC_CLK 18 --#define S2P1_FEC_SERIAL_SEL 16 --#define ENABLE_DES_PL_CLK 15 --#define TS_OUTPUT_SOURCE 10 --#define DES_INPUT_SEL 8 --#define ENABLE_DES_PL 7 --#define INVERT_S2P0_FEC_ERROR 6 --#define INVERT_S2P0_FEC_DATA 5 --#define INVERT_S2P0_FEC_SYNC 4 --#define INVERT_S2P0_FEC_VALID 3 --#define INVERT_S2P0_FEC_CLK 2 --#define S2P0_FEC_SERIAL_SEL 0 -- --/* 31:28 - s2p1_clk_div*/ --/* 27:24 - s2p0_clk_div*/ --/* 23 - s2p1_disable*/ --/* 22 - s2p0_disable*/ --/* 21 - Reserved*/ --/* 20 -- TS_OUT_error_INVERT*/ --/* 19 -- TS_OUT_data_INVERT*/ --/* 18 -- TS_OUT_sync_INVERT*/ --/* 17 -- TS_OUT_valid_INVERT*/ --/* 16 -- TS_OUT_clk_INVERT*/ --/* 15:8 -- TS_package_length_sub_1 (default : 187)*/ --/* 7:0 -- fec_sync_byte (default : 0x47)*/ --/*#define TS_TOP_CONFIG (STB_CBUS_BASE + 0xf1) // 0x16f1*/ --/*----------- bit define -----------*/ --#define TS_PACKAGE_LENGTH_SUB_1 8 --#define FEC_DEFAULT_SYNC_BYTE 0 -- --/* Bit 25:24 -- transport_scrambling_control_odd_2 // should be 3*/ --/* Bit 23:16 -- file_m2ts_skip_bytes*/ --/* Bit 15:8 -- des_out_dly*/ --/* Bit 7:6 -- transport_scrambling_control_odd // should be 3*/ --/* Bit 5 -- ts_hiu_enable*/ --/* Bit 4:0 -- fec_clk_div*/ --/*#define TS_FILE_CONFIG (STB_CBUS_BASE + 0xf2) // 0x16f2*/ --/*----------- bit define -----------*/ --#define TRANSPORT_SCRAMBLING_CONTROL_ODD_2 24 --#define FILE_M2TS_SKIP_BYTES 16 --#define DES_OUT_DLY 8 --#define TRANSPORT_SCRAMBLING_CONTROL_ODD 6 --#define TS_HIU_ENABLE 5 --#define FEC_FILE_CLK_DIV 0 -- --/* Bit 19:14 -- des_2 ts pl state -- Read Only*/ --/* Bit 13:8 -- des ts pl state -- Read Only*/ --/* Bit 3:0 PID index to 8 PID to get key-set*/ --/* auto increse after TS_PL_PID_DATA read/write*/ --/*#define TS_PL_PID_INDEX (STB_CBUS_BASE + 0xf3) // 0x16f3*/ --/*----------- bit define -----------*/ --#define DES_TS_PL_STATE 8 --#define DES_2_TS_PL_STATE 14 -- --/* Bit 13 -- PID match disble*/ --/* Bit 12:0 -- PID*/ --/*#define TS_PL_PID_DATA (STB_CBUS_BASE + 0xf4) // 0x16f4*/ --/*----------- bit define -----------*/ --#define PID_MATCH_DISABLE_HIGH 29 --#define PID_MATCH_HIGH 16 --#define PID_MATCH_DISABLE_LOW 13 --#define PID_MATCH_LOW 0 -- --/*#define COMM_DESC_KEY0 -- * (STB_CBUS_BASE + 0xf5) // 0x16f5 -- Common descrambler key (key bits[63:32])*/ --/*#define COMM_DESC_KEY1 -- * (STB_CBUS_BASE + 0xf6) // 0x16f6 -- Common descrambler key (key bits[31:0])*/ --/*#define COMM_DESC_KEY_RW -- * (STB_CBUS_BASE + 0xf7) // 0x16f7 // bits[3:0] -- * point to the address to write the key -- * {COMM_DESC_KEY3,...,COMM_DESC_KEY0}*/ --/* Writing this register writes the key to RAM*/ -- --/* bit 15:8 - des_out_dly_2*/ --/* bit 7 - reserved*/ --/* Bit 6-- enable_des_pl_clk_2*/ --/* bit 5 - enable_des_pl_2*/ --/* bit 4:2 -- use_des_2 bit[2] -- demux0, bit[3] -- demux1, bit[4] -- demux2*/ --/* bit 1:0 -- des_i_sel_2 00 -- select_fec_0, 01 -- select_fec_1, -- * 10 -- select_fec_2, 11 - reserved*/ --#define COMM_DESC_2_CTL (STB_CBUS_BASE + 0xff) /*0x16ff*/ -- --/*=======================================================*/ --/* Multiple STB Registers (8'h00 - 8'h45)*/ --/*=======================================================*/ --/* STB registers are 8'h0x*/ --/* Bit 15:0 -- version number : 0x0002 (v0.01)*/ --/*#define STB_VERSION -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x00) // 0x1600 // read only*/ --/*#define STB_VERSION_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x00) // 0x1650 // read only*/ --/*#define STB_VERSION_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x00) // 0x16a0 // read only*/ -- --/*#define STB_TEST_REG -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x01) // 0x1601*/ --/*#define STB_TEST_REG_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x01) // 0x1651*/ --/*#define STB_TEST_REG_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x01) // 0x16a1*/ -- --/* Bit 15 -- fec_core_select 1 - select descramble output*/ --/* Bit 14:12 - fec_select -- * 0-TS0, 1-TS1, 2-TS2, 3,4-Reserved, 5-S2P1, 6-S2P0, 7-File*/ --/* Bit 11 -- FEC_CLK*/ --/* Bit 10 -- SOP*/ --/* Bit 9 -- D_VALID*/ --/* Bit 8 -- D_FAIL*/ --/* Bit 7:0 -- D_DATA 7:0*/ --/*#define FEC_INPUT_CONTROL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x02) // 0x1602*/ --/*#define FEC_INPUT_CONTROL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x02) // 0x1652*/ --/*#define FEC_INPUT_CONTROL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x02) // 0x16a2*/ --/*----------- bit define -----------*/ --#define FEC_CORE_SEL 15 --#define FEC_SEL 12 --#define FEC_INPUT_FEC_CLK 11 --#define FEC_INPUT_SOP 10 --#define FEC_INPUT_D_VALID 9 --#define FEC_INPUT_D_FAIL 8 -- --/*#define FEC_INPUT_DATA -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x03) // 0x1603 // read only*/ --/*#define FEC_INPUT_DATA_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x03) // 0x1653 // read only*/ --/*#define FEC_INPUT_DATA_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x03) // 0x16a3 // read only*/ -- --/* bit 31 -- enable_free_clk_fec_data_valid*/ --/* bit 30 -- enable_free_clk_stb_reg*/ --/* bit 29 -- always_use_pes_package_length*/ --/* bit 28 -- disable_pre_incomplete_section_fix*/ --/* bit 27 -- pointer_field_multi_pre_en*/ --/* bit 26 -- ignore_pre_incomplete_section*/ --/* bit 25 -- video2_enable*/ --/* bit 24:22 -- video2_type*/ --/* bit 21 -- do_not_trust_pes_package_length*/ --/* bit 20 (bit 4) -- Bypass use recoder path*/ --/* bit 19 (bit 3) -- clear_PID_continuity_counter_valid*/ --/* bit 18 (bit 2) -- Disable Splicing*/ --/* bit 17 (bit 1) -- Insert PES_STRONG_SYNC in Audio PES*/ --/* bit 16 (bit 0) -- Insert PES_STRONG_SYNC in Video PES*/ --/* Bit 15 - do not trust section length*/ --/* Bit 14 - om cmd push even zero*/ --/* Bit 13 - reserved*/ --/* Bit 12 - SUB, OTHER PES interrupt at beginning of PES*/ --/* Bit 11 - discard_av_package -- for ts_recorder use only*/ --/* Bit 10 - ts_recorder_select 0:after PID filter 1:before PID filter*/ --/* Bit 9 - ts_recorder_enable*/ --/* Bit 8 - (table_id == 0xff) means section_end*/ --/* Bit 7 - do not send uncomplete section*/ --/* Bit 6 - do not discard duplicate package*/ --/* Bit 5 - search SOP when trasport_error_indicator*/ --/* Bit 4 - stb demux enable*/ --/* Bit 3 - do not reset state machine on SOP*/ --/* Bit 2 - search SOP when error happened -- * ( when ignore_fail_n_sop, will have this case)*/ --/* Bit 1 - do not use SOP input ( check FEC sync byte instead )*/ --/* Bit 0 - ignore fec_error bit when non sop ( check error on SOP only)*/ --/*#define DEMUX_CONTROL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x04) // 0x1604*/ --/*#define DEMUX_CONTROL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x04) // 0x1654*/ --/*#define DEMUX_CONTROL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x04) // 0x16a4*/ --/*----------- bit define -----------*/ --#define ENABLE_FREE_CLK_FEC_DATA_VALID 31 --#define ENABLE_FREE_CLK_STB_REG 30 --#define BYPASS_USE_RECODER_PATH 20 --#define CLEAR_PID_CONTINUITY_COUNTER_VALID 19 --#define DISABLE_SPLICING 18 --#define INSERT_AUDIO_PES_STRONG_SYNC 17 --#define INSERT_VIDEO_PES_STRONG_SYNC 16 --#define SECTION_LENGTH_UNTRUSTY 15 --#define OM_CMD_PUSH_EVEN_ZERO 14 --#define OTHER_INT_AT_PES_BEGINING 12 --#define DISCARD_AV_PACKAGE 11 --#define TS_RECORDER_SELECT 10 --#define TS_RECORDER_ENABLE 9 --#define SECTION_END_WITH_TABLE_ID 8 --#define SEND_COMPLETE_SECTION_ONLY 7 --#define KEEP_DUPLICATE_PACKAGE 6 --#define SEACH_SOP_ON_TRANSPORT_ERROR 5 --#define STB_DEMUX_ENABLE 4 --#define NO_RESET_ON_SOP 3 --#define SEARCH_SOP_ON_ERROR 2 --#define NOT_USE_OF_SOP_INPUT 1 --#define IGNORE_NONSOP_FEC_ERROR 0 -- --/* bit 15:8 demux package length - 1 ( default : 187 )*/ --/* bit 7:0 default is 0x47*/ --/*#define FEC_SYNC_BYTE -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x05) // 0x1605*/ --/*#define FEC_SYNC_BYTE_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x05) // 0x1655*/ --/*#define FEC_SYNC_BYTE_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x05) // 0x16a5*/ -- --/**************************************** -- * FM Memory Usage : -- * 0-15 (32 PID filter target) ---- 15:13-PID type 12:0-PID target or force data -- * (force data : 1 will mask corespoding bit, -- * 0 will disable this PID filter channel) -- * advanced setting -- bit 7:0 -- * bit 7 -- PID bit 12:11 compare result force -- * bit 6 -- PID bit 10:9 compare result force -- * bit 5 -- PID bit 8:7 compare result force -- * bit 4 -- PID bit 6:5 compare result force -- * bit 3 -- PID bit 4:3 compare result force -- * bit 2 -- PID bit 2 compare result force -- * bit 1 -- PID bit 1 compare result force -- * bit 0 -- PID bit 0 compare result force -- * 16-255(15x32 Section filter target) -- * For first byte : Table_ID -- * ---- 15-Mask High 4-bits -- * 14-Mask Low 4-bits -- * 13-disable_PID_check -- * 12:8-PIDindex -- * 7:0-section target (always EQ) -- * For rest of bytes : -- * ---- 15-Mask 14-EQ/NE 13-disable_PID_check -- * ----12:8-PIDindex 7:0-section target (or force data) -- * advanced setting -- bit 7:0 force compare result -- **************************************************/ --/*----------- bit define -----------*/ --#define PID_TYPE 13 --#define PID_TARGET 0 -- --#define SECTION_FIRSTBYTE_MASKHIGH 15 --#define SECTION_FIRSTBYTE_MASKLOW 14 --#define SECTION_FIRSTBYTE_DISABLE_PID_CHECK 13 --#define SECTION_FIRSTBYTE_PID_INDEX 8 --#define SECTION_TARGET 0 -- --#define SECTION_RESTBYTE_MASK 15 --#define SECTION_RESTBYTE_MASK_EQ 14 --#define SECTION_RESTBYTE_DISABLE_PID_CHECK 13 --#define SECTION_RESTBYTE_PID_INDEX 8 -- --/* bit 31:16 -- filter memory write data hi[31:16]*/ --/* bit 15:0 -- filter memory write data low [15:0]*/ --/*#define FM_WR_DATA -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x06) // 0x1606*/ --/*#define FM_WR_DATA_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x06) // 0x1656*/ --/*#define FM_WR_DATA_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x06) // 0x16a6*/ --/*----------- bit define -----------*/ --#define FM_WR_DATA_HI 16 -- --/* bit 31:24 -- advanced setting hi*/ --/* bit 23:16 -- advanced setting low*/ --/* bit 15 -- filter memory write data request*/ --/* bit 7:0 -- filter memory write addr*/ --/*#define FM_WR_ADDR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x07) // 0x1607*/ --/*#define FM_WR_ADDR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x07) // 0x1657*/ --/*#define FM_WR_ADDR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x07) // 0x16a7*/ --/*----------- bit define -----------*/ --#define FM_ADVANCED_SETTING_HI 24 --#define FM_ADVANCED_SETTING_LO 16 --#define FM_WR_DATA_REQUEST 15 -- --/* bit 13:8 demux state -- read only*/ --/* bit 7:4 -- maxnum section filter compare address*/ --/* bit 3:0 -- maxnum PID filter compare address*/ --/*#define MAX_FM_COMP_ADDR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x08) // 0x1608*/ --/*#define MAX_FM_COMP_ADDR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x08) // 0x1658*/ --/*#define MAX_FM_COMP_ADDR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x08) // 0x16a8*/ --/*----------- bit define -----------*/ --#define DEMUX_STATE 8 --#define MAX_FM_SECTION_FILTER_COMP_ADDR 4 -- --/* bit 15 - transport_error_indicator*/ --/* bit 14 - payload_unit_start_indicator*/ --/* bit 13 - transport_priority*/ --/* bit 12:0 - PID*/ --/*#define TS_HEAD_0 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x09) // 0x1609*/ --/*#define TS_HEAD_0_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x09) // 0x1659*/ --/*#define TS_HEAD_0_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x09) // 0x16a9*/ --/*----------- bit define -----------*/ --#define TRANSPORT_ERROR_INDICATOR 15 --#define PAYLOAD_UNIT_START_INDICATOR 14 --#define TRANSPORT_PRIORITY 13 -- --/* bit 7:6 transport_scrambling_control*/ --/* bit 5:4 adaptation_field_control*/ --/* bit 3:0 continuity_counter*/ --/*#define TS_HEAD_1 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x0a) // 0x160a*/ --/*#define TS_HEAD_1_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x0a) // 0x165a*/ --/*#define TS_HEAD_1_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x0a) // 0x16aa*/ --/*----------- bit define -----------*/ --#define TRANSPORT_SCRAMBLING_CONTROL 6 --#define ADAPTATION_FIELD_CONTROL 4 -- --/* bit 15:12 -- om_cmd_count (read only)*/ --/* bit 11:9 -- overflow_count // bit 11:9 -- om_cmd_wr_ptr (read only)*/ --/* bit 8:6 -- om_overwrite_count // bit 8:6 -- om_cmd_rd_ptr (read only)*/ --/* bit 5:3 -- type_stb_om_w_rd (read only)*/ --/* bit 2 -- unit_start_stb_om_w_rd (read only)*/ --/* bit 1 -- om_cmd_overflow (read only)*/ --/* bit 0 -- om_cmd_pending (read)*/ --/* bit 0 -- om_cmd_read_finished (write)*/ --/*#define OM_CMD_STATUS -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x0b) // 0x160b*/ --/*#define OM_CMD_STATUS_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x0b) // 0x165b*/ --/*#define OM_CMD_STATUS_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x0b) // 0x16ab*/ --/*----------- bit define -----------*/ --#define OM_CMD_COUNT 12 --#define OM_OVERFLOW_COUNT 9 --#define OM_OVERWRITE_COUNT 6 --#define TYPE_STB_OM_W_RD 3 --#define UNIT_START_STB_OM_W_RD 2 --#define OM_CMD_OVERFLOW 1 -- --/* bit 15:9 -- count_stb_om_w_rd (read only)*/ --/* bit 8:0 -- start_stb_om_wa_rd (read only)*/ --/*#define OM_CMD_DATA -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x0c) // 0x160c*/ --/*#define OM_CMD_DATA_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x0c) // 0x165c*/ --/*#define OM_CMD_DATA_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x0c) // 0x16ac*/ --/*----------- bit define -----------*/ --#define COUNT_STB_OM_W_RD 9 -- --/* bit 11:0 -- offset for section data*/ --/*#define OM_CMD_DATA2 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x0d) // 0x160d*/ --/*#define OM_CMD_DATA2_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x0d) // 0x165d*/ --/*#define OM_CMD_DATA2_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x0d) // 0x16ad*/ -- --/* bit 31:16 -- base address for section buffer group 0 -- * (*0x400 to get real address)*/ --/* bit 15:0 -- base address for section buffer group 1 -- * (*0x400 to get real address)*/ --/*#define SEC_BUFF_01_START -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x0e) // 0x160e*/ --/*#define SEC_BUFF_01_START_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x0e) // 0x165e*/ --/*#define SEC_BUFF_01_START_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x0e) // 0x16ae*/ --/*----------- bit define -----------*/ --#define SEC_BUFF_0_BASE_ADDR 16 -- --/* bit 31:16 -- base address for section buffer group 2 -- * (*0x400 to get real address)*/ --/* bit 15:0 -- base address for section buffer group 3 -- * (*0x400 to get real address)*/ --/*#define SEC_BUFF_23_START -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x0f) // 0x160f*/ --/*#define SEC_BUFF_23_START_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x0f) // 0x165f*/ --/*#define SEC_BUFF_23_START_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x0f) // 0x16af*/ --/*----------- bit define -----------*/ --#define SEC_BUFF_2_BASE_ADDR 16 -- --/* bit 15:12 -- section buffer size for group 3*/ --/* bit 11:8 -- section buffer size for group 2*/ --/* bit 7:4 -- section buffer size for group 1*/ --/* bit 3:0 -- section buffer size for group 0 -- * (bit used, for example, 10 means 1K)*/ --/*#define SEC_BUFF_SIZE -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x10) // 0x1610*/ --/*#define SEC_BUFF_SIZE_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x10) // 0x1660*/ --/*#define SEC_BUFF_SIZE_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x10) // 0x16b0*/ --/*----------- bit define -----------*/ --#define SEC_BUFF_3_SIZE 12 --#define SEC_BUFF_2_SIZE 8 --#define SEC_BUFF_1_SIZE 4 -- --/* section buffer busy status for buff 31:0 ( Read Only )*/ --/*#define SEC_BUFF_BUSY -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x11) // 0x1611*/ --/*#define SEC_BUFF_BUSY_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x11) // 0x1661*/ --/*#define SEC_BUFF_BUSY_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x11) // 0x16b1*/ -- --/* section buffer write status for buff 31:0 -- Read*/ --/* clear buffer status ( buff READY and BUSY ) -- write*/ --/*#define SEC_BUFF_READY -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x12) // 0x1612*/ --/*#define SEC_BUFF_READY_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x12) // 0x1662*/ --/*#define SEC_BUFF_READY_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x12) // 0x16b2*/ -- --/* bit 15 -- section_reset_busy (Read Only)*/ --/* bit 14 -- output_section_buffer_valid*/ --/* bit 12:8 -- SEC_BUFFER_NUMBER for the INDEX buffer Read_Only*/ --/* bit 4:0 -- SEC_BUFFER_INDEX RW*/ --/*#define SEC_BUFF_NUMBER -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x13) // 0x1613*/ --/*#define SEC_BUFF_NUMBER_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x13) // 0x1663*/ --/*#define SEC_BUFF_NUMBER_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x13) // 0x16b3*/ --/*----------- bit define -----------*/ --#define SECTION_RESET_BUSY 15 --#define OUTPUT_SECTION_BUFFER_VALID 14 --#define INDEXED_SEC_BUFF_NUMBER 8 -- --/* bit 9:5 -- BYPASS PID number*/ --/* bit 4:0 -- PCR PID number*/ --/*#define ASSIGN_PID_NUMBER -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x14) // 0x1614*/ --/*#define ASSIGN_PID_NUMBER_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x14) // 0x1664*/ --/*#define ASSIGN_PID_NUMBER_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x14) // 0x16b4*/ --/*----------- bit define -----------*/ --#define BYPASS_PID_NUMBER 5 -- --/* bit 15:0 -- stream_id filter bit enable*/ --/* bit 7:0 -- stream_id filter target*/ --/*#define VIDEO_STREAM_ID -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x15) // 0x1615*/ --/*#define VIDEO_STREAM_ID_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x15) // 0x1665*/ --/*#define VIDEO_STREAM_ID_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x15) // 0x16b5*/ -- --/*#define AUDIO_STREAM_ID -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x16) // 0x1616*/ --/*#define AUDIO_STREAM_ID_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x16) // 0x1666*/ --/*#define AUDIO_STREAM_ID_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x16) // 0x16b6*/ -- --/*#define SUB_STREAM_ID -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x17) // 0x1617*/ --/*#define SUB_STREAM_ID_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x17) // 0x1667*/ --/*#define SUB_STREAM_ID_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x17) // 0x16b7*/ -- --/*#define OTHER_STREAM_ID -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x18) // 0x1618*/ --/*#define OTHER_STREAM_ID_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x18) // 0x1668*/ --/*#define OTHER_STREAM_ID_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x18) // 0x16b8*/ -- --/* bit 12 -- PCR_EN*/ --/* bit 11:0 -- PCR90K_DIV*/ --/*#define PCR90K_CTL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x19) // 0x1619*/ --/*#define PCR90K_CTL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x19) // 0x1669*/ --/*#define PCR90K_CTL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x19) // 0x16b9*/ --/*----------- bit define -----------*/ --#define PCR_EN 12 -- --/* bit 15:0 -- PCR[31:0] R/W*/ --/*#define PCR_DEMUX -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x1a) // 0x161a*/ --/*#define PCR_DEMUX_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x1a) // 0x166a*/ --/*#define PCR_DEMUX_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x1a) // 0x16ba*/ -- --/* bit 15:0 -- VPTS[31:0] R/W*/ --/*#define VIDEO_PTS_DEMUX -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x1b) // 0x161b*/ --/*#define VIDEO_PTS_DEMUX_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x1b) // 0x166b*/ --/*#define VIDEO_PTS_DEMUX_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x1b) // 0x16bb*/ -- --/* bit 15:0 -- VDTS[31:0] R/W*/ --/*#define VIDEO_DTS_DEMUX -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x1c) // 0x161c*/ --/*#define VIDEO_DTS_DEMUX_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x1c) // 0x166c*/ --/*#define VIDEO_DTS_DEMUX_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x1c) // 0x16bc*/ -- --/* bit 15:0 -- APTS[31:0] R/W*/ --/*#define AUDIO_PTS_DEMUX -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x1d) // 0x161d*/ --/*#define AUDIO_PTS_DEMUX_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x1d) // 0x166d*/ --/*#define AUDIO_PTS_DEMUX_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x1d) // 0x16bd*/ -- --/* bit 15:0 -- SPTS[31:0] R/W*/ --/*#define SUB_PTS_DEMUX -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x1e) // 0x161e*/ --/*#define SUB_PTS_DEMUX_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x1e) // 0x166e*/ --/*#define SUB_PTS_DEMUX_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x1e) // 0x16be*/ -- --/* read -- status, write 1 clear status*/ --/* bit 15 -- SUB_PTS[32]*/ --/* bit 14 -- AUDIO_PTS[32]*/ --/* bit 13 -- VIDEO_DTS[32]*/ --/* bit 12 -- VIDEO_PTS[32]*/ --/* bit 3 -- sub_pts_ready*/ --/* bit 2 -- audio_pts_ready*/ --/* bit 1 -- video_dts_ready*/ --/* bit 0 -- video_pts_ready*/ --/*#define STB_PTS_DTS_STATUS -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x1f) // 0x161f*/ --/*#define STB_PTS_DTS_STATUS_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x1f) // 0x166f*/ --/*#define STB_PTS_DTS_STATUS_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x1f) // 0x16bf*/ --/*----------- bit define -----------*/ --#define SUB_PTS_BIT32 15 --#define AUDIO_PTS_BIT32 14 --#define VIDEO_DTS_BIT32 13 --#define VIDEO_PTS_BIT32 12 --#define SUB_PTS_READY 3 --#define AUDIO_PTS_READY 2 --#define VIDEO_DTS_READY 1 --#define VIDEO_PTS_READY 0 -- --/* bit 3:0 --*/ --/* 0 -- adaptation_field_length[7:0], adaption_field_byte_1[7:0]*/ --/* 1 -- stream_id[7:0], pes_header_bytes_left[7:0]*/ --/* 2 -- pes_package_bytes_left[15:0]*/ --/* 3 -- pes_ctr_byte[7:0], pes_flag_byte[7:0]*/ --/*#define STB_DEBUG_INDEX -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x20) // 0x1620*/ --/*#define STB_DEBUG_INDEX_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x20) // 0x1670*/ --/*#define STB_DEBUG_INDEX_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x20) // 0x16c0*/ -- --/* read only*/ --/*#define STB_DEBUG_DATA_OUT -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x21) // 0x1621*/ --/*#define STB_DEBUG_DATA_OUT_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x21) // 0x1671*/ --/*#define STB_DEBUG_DATA_OUT_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x21) // 0x16c1*/ -- --/* bit[31] -- no_match_record_en*/ --/* bit[30:16] - reserved*/ --/* default : 0x807f*/ --/* bit 15:9 -- MAX OM DMA COUNT (default: 0x40)*/ --/* bit 8:0 -- LAST ADDR OF OM ADDR (default: 127)*/ --#define STB_OM_CTL \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x22) /* 0x1622*/ --#define STB_OM_CTL_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x22) /* 0x1672*/ --#define STB_OM_CTL_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x22) /* 0x16c2*/ --/*----------- bit define -----------*/ --#define MAX_OM_DMA_COUNT 9 --#define LAST_OM_ADDR 0 -- --/* 15:0 WRITE 1 CLEAR to clear interrupt source*/ --/*12 -- INPUT_TIME_OUT*/ --/*11 -- PCR_ready*/ --/*10 -- audio_splicing_point*/ --/* 9 -- video_splicing_point*/ --/* 8 -- other_PES_int*/ --/* 7 -- sub_PES_int*/ --/* 6 -- discontinuity*/ --/* 5 -- duplicated_pack_found*/ --/* 4 -- New PDTS ready*/ --/* 3 -- om_cmd_buffer ready for access*/ --/* 2 -- section buffer ready*/ --/* 1 -- transport_error_indicator*/ --/* 0 -- TS ERROR PIN*/ --/*#define STB_INT_STATUS -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x23) // 0x1623*/ --/*#define STB_INT_STATUS_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x23) // 0x1673*/ --/*#define STB_INT_STATUS_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x23) // 0x16c3*/ --/*----------- bit define -----------*/ --#define INPUT_TIME_OUT 12 --#define PCR_READY 11 --#define AUDIO_SPLICING_POINT 10 --#define VIDEO_SPLICING_POINT 9 --#define OTHER_PES_READY 8 --#define SUB_PES_READY 7 --#define DIS_CONTINUITY_PACKET 6 --#define DUPLICATED_PACKET 5 --#define NEW_PDTS_READY 4 --#define OM_CMD_READ_PENDING 3 --#define SECTION_BUFFER_READY 2 --#define TS_ERROR_PACKAGE 1 --#define TS_ERROR_PIN 0 -- --/* When Bit 31 - 1 write will indicate all type use sepertate endian -- * (Write Only)*/ --/* When Bit 31 - 0 write will indicate all type else use Bit 8:6*/ --/* Bit 23:21 - demux om write endian control for OTHER_PES_PACKET*/ --/* Bit 20:18 - demux om write endian control for SCR_ONLY_PACKET*/ --/* Bit 17:15 - demux om write endian control for SUB_PACKET*/ --/* Bit 14:12 - demux om write endian control for AUDIO_PACKET*/ --/* Bit 11:9 - demux om write endian control for VIDEO_PACKET*/ --/* Bit 8:6 - demux om write endian control for else*/ --/* Bit 5:3 - demux om write endian control for bypass*/ --/* Bit 2:0 - demux om write endian control for section*/ --/*#define DEMUX_ENDIAN -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x24) // 0x1624*/ --/*#define DEMUX_ENDIAN_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x24) // 0x1674*/ --/*#define DEMUX_ENDIAN_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x24) // 0x16c4*/ --/*----------- bit define -----------*/ --#define SEPERATE_ENDIAN 31 --#define OTHER_PES_ENDIAN 21 --#define SCR_ENDIAN 18 --#define SUB_ENDIAN 15 --#define AUDIO_ENDIAN 12 --#define VIDEO_ENDIAN 9 --#define OTHER_ENDIAN 6 --#define BYPASS_ENDIAN 3 --#define SECTION_ENDIAN 0 -- --/* Bit 15:8 -- last_burst_threshold*/ --/* Bit 7 -- use hi_bsf interface*/ --/* Bit 6:2 - fec_clk_div*/ --/* Bit 1 ts_source_sel */ --/* Bit 0 - Hiu TS generate enable */ --/*#define TS_HIU_CTL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x25) // 0x1625*/ --/*#define TS_HIU_CTL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x25) // 0x1675*/ --/*#define TS_HIU_CTL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x25) // 0x16c5*/ --/*----------- bit define -----------*/ --#define LAST_BURST_THRESHOLD 8 --#define USE_HI_BSF_INTERFACE 7 -- --/* bit 15:0 -- base address for section buffer start -- * (*0x10000 to get real base)*/ --/*#define SEC_BUFF_BASE -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x26) // 0x1626*/ --/*#define SEC_BUFF_BASE_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x26) // 0x1676*/ --/*#define SEC_BUFF_BASE_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x26) // 0x16c6*/ -- --/* bit 11 -- mask bit for OTHER_PES_AHB_DMA_EN*/ --/* bit 10 -- mask bit for SUB_AHB_DMA_EN*/ --/* bit 9 -- mask bit for BYPASS_AHB_DMA_EN*/ --/* bit 8 -- mask bit for SECTION_AHB_DMA_EN*/ --/* bit 7 -- mask bit for recoder stream*/ --/* bit 6:0 -- mask bit for each type*/ --/*#define DEMUX_MEM_REQ_EN -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x27) // 0x1627*/ --/*#define DEMUX_MEM_REQ_EN_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x27) // 0x1677*/ --/*#define DEMUX_MEM_REQ_EN_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x27) // 0x16c7*/ --/*----------- bit define -----------*/ --#define VIDEO2_DMA_EN_BIT 12 --#define OTHER_PES_AHB_DMA_EN 11 --#define SUB_AHB_DMA_EN 10 --#define BYPASS_AHB_DMA_EN 9 --#define SECTION_AHB_DMA_EN 8 --#define RECORDER_STREAM 7 --#define OTHER_PES_PACKET 6 --#define SCR_ONLY_PACKET 5 /*will never be used*/ --#define BYPASS_PACKET 4 --#define SECTION_PACKET 3 --#define SUB_PACKET 2 --#define AUDIO_PACKET 1 --#define VIDEO_PACKET 0 -- --/* bit 31:0 -- vb_wr_ptr for video PDTS*/ --/*#define VIDEO_PDTS_WR_PTR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x28) // 0x1628*/ --/*#define VIDEO_PDTS_WR_PTR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x28) // 0x1678*/ --/*#define VIDEO_PDTS_WR_PTR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x28) // 0x16c8*/ -- --/* bit 31:0 -- ab_wr_ptr for audio PDTS*/ --/*#define AUDIO_PDTS_WR_PTR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x29) // 0x1629*/ --/*#define AUDIO_PDTS_WR_PTR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x29) // 0x1679*/ --/*#define AUDIO_PDTS_WR_PTR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x29) // 0x16c9*/ -- --/* bit 20:0 -- SB_WRITE_PTR (sb_wr_ptr << 3 == byte write position)*/ --/*#define SUB_WR_PTR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x2a) // 0x162a*/ --/*#define SUB_WR_PTR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x2a) // 0x167a*/ --/*#define SUB_WR_PTR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x2a) // 0x16ca*/ -- --/* bit 19:0 -- SB_START (sb_start << 12 == byte address);*/ --/*#define SB_START -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x2b) // 0x162b*/ --/*#define SB_START_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x2b) // 0x167b*/ --/*#define SB_START_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x2b) // 0x16cb*/ -- --/* bit 20:0 -- SB_SIZE (sb_size << 3 == byte size, 16M maximun)*/ --/*#define SB_LAST_ADDR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x2c) // 0x162c*/ --/*#define SB_LAST_ADDR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x2c) // 0x167c*/ --/*#define SB_LAST_ADDR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x2c) // 0x16cc*/ -- --/* bit 31:0 -- sb_wr_ptr for sub PES*/ --/*#define SB_PES_WRITE_PTR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x2d) // 0x162d*/ --/*#define SB_PES_WRITE_PTR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x2d) // 0x167d*/ --/*#define SB_PES_WRITE_PTR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x2d) // 0x16cd*/ -- --/* bit 31:16 -- ob_wr_ptr for other PES*/ --/* bit 20:0 -- OB_WRITE_PTR (ob_wr_ptr << 3 == byte write position)*/ --/*#define OTHER_WR_PTR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x2e) // 0x162e*/ --/*#define OTHER_WR_PTR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x2e) // 0x167e*/ --/*#define OTHER_WR_PTR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x2e) // 0x16ce*/ -- --/* bit 19:0 -- OB_START (ob_start << 12 == byte address);*/ --/*#define OB_START -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x2f) // 0x162f*/ --/*#define OB_START_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x2f) // 0x167f*/ --/*#define OB_START_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x2f) // 0x16cf*/ -- --/* bit 20:0 -- OB_SIZE (ob_size << 3 == byte size, 16M maximun)*/ --/*#define OB_LAST_ADDR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x30) // 0x1630*/ --/*#define OB_LAST_ADDR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x30) // 0x1680*/ --/*#define OB_LAST_ADDR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x30) // 0x16d0*/ -- --/* bit 31:0 -- ob_wr_ptr for sub PES*/ --/*#define OB_PES_WRITE_PTR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x31) // 0x1631*/ --/*#define OB_PES_WRITE_PTR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x31) // 0x1681*/ --/*#define OB_PES_WRITE_PTR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x31) // 0x16d1*/ -- --/* 15:0 DEMUX interrupt MASK*/ --/* 11 -- PCR_READY*/ --/* 10 -- audio_splicing_point*/ --/* 9 -- video_splicing_point*/ --/* 8 -- other_PES_int*/ --/* 7 -- sub_PES_int*/ --/* 6 -- discontinuity*/ --/* 5 -- duplicated_pack_found*/ --/* 4 -- New PDTS ready*/ --/* 3 -- om_cmd_buffer ready for access*/ --/* 2 -- section buffer ready*/ --/* 1 -- transport_error_indicator*/ --/* 0 -- TS ERROR PIN*/ --/*#define STB_INT_MASK -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x32) // 0x1632*/ --/*#define STB_INT_MASK_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x32) // 0x1682*/ --/*#define STB_INT_MASK_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x32) // 0x16d2*/ -- --/* 31:16 VIDEO PID filter data*/ --/*15 -- splicing VIDEO PID change enable*/ --/*14:10 -- VIDEO PID FILTER ADDRESS*/ --/* 9 -- PES splicing active (Read Only)*/ --/* 8 -- splicing active (Read Only)*/ --/* 7:0 splicing countdown (Read Only)*/ --/*#define VIDEO_SPLICING_CTL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x33) // 0x1633*/ --/*#define VIDEO_SPLICING_CTL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x33) // 0x1683*/ --/*#define VIDEO_SPLICING_CTL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x33) // 0x16d3*/ --/*----------- bit define -----------*/ --#define VIDEO_PID_FILTER_DATA 16 --#define VIDEO_SPLICING_PID_CHANGE_ENABLE 15 --#define VIDEO_PID_FILTER_ADDRESS 10 --#define VIDEO_PES_SPLICING_ACTIVE 9 --#define VIDEO_SPLICING_ACTIVE 8 -- -- --/* 31:16 AUDIO PID filter data*/ --/*15 -- splicing AUDIO PID change enable*/ --/*14:10 -- AUDIO PID FILTER ADDRESS*/ --/* 9 -- PES splicing active (Read Only)*/ --/* 8 -- splicing active (Read Only)*/ --/* 7:0 splicing countdown (Read Only)*/ --/*#define AUDIO_SPLICING_CTL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x34) // 0x1634*/ --/*#define AUDIO_SPLICING_CTL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x34) // 0x1684*/ --/*#define AUDIO_SPLICING_CTL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x34) // 0x16d4*/ --/*----------- bit define -----------*/ --#define AUDIO_PID_FILTER_DATA 16 --#define AUDIO_SPLICING_PID_CHANGE_ENABLE 15 --#define AUDIO_PID_FILTER_ADDRESS 10 --#define AUDIO_PES_SPLICING_ACTIVE 9 --#define AUDIO_SPLICING_ACTIVE 8 -- --/* 23:16 M2TS_SKIP_BYTES*/ --/* 15:8 LAST TS PACKAGE BYTE COUNT (Read Only)*/ --/* 7:0 PACKAGE BYTE COUNT (Read Only)*/ --/*#define TS_PACKAGE_BYTE_COUNT -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x35) // 0x1635*/ --/*#define TS_PACKAGE_BYTE_COUNT_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x35) // 0x1685*/ --/*#define TS_PACKAGE_BYTE_COUNT_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x35) // 0x16d5*/ --/*----------- bit define -----------*/ --#define M2TS_SKIP_BYTES 16 --#define LAST_TS_PACKAGE_BYTE_COUNT 8 -- --/* 15:0 2 bytes strong sync add to PES*/ --/*#define PES_STRONG_SYNC -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x36) // 0x1636*/ --/*#define PES_STRONG_SYNC_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x36) // 0x1686*/ --/*#define PES_STRONG_SYNC_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x36) // 0x16d6*/ -- --/* bit 15 -- stb_om_ren*/ --/* bit 14:11 -- reserved*/ --/* bit 10:0 -- OM_DATA_RD_ADDR*/ --/*#define OM_DATA_RD_ADDR -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x37) // 0x1637*/ --/*#define OM_DATA_RD_ADDR_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x37) // 0x1687*/ --/*#define OM_DATA_RD_ADDR_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x37) // 0x16d7*/ --/*----------- bit define -----------*/ --#define STB_OM_REN 15 -- --/* bit 15:0 -- OM_DATA_RD*/ --/*#define OM_DATA_RD -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x38) // 0x1638*/ --/*#define OM_DATA_RD_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x38) // 0x1688*/ --/*#define OM_DATA_RD_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x38) // 0x16d8*/ -- --/* AUTO STOP SETTING for 32 channels*/ --/* 4-bits per channel*/ --/* when write*/ --/* bit 3 -- set section active*/ --/* bit 2:0 -- auto stop after count (0 means never stop)*/ --/* when read*/ --/* bit 3 -- current active status (1 - active, 0 - stopped )*/ --/* bit 2:0 -- count down to auto stop*/ --/* section 31:24*/ --/*#define SECTION_AUTO_STOP_3 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x39) // 0x1639*/ --/*#define SECTION_AUTO_STOP_3_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x39) // 0x1689*/ --/*#define SECTION_AUTO_STOP_3_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x39) // 0x16d9*/ --/* section 23:16*/ --/*#define SECTION_AUTO_STOP_2 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x3a) // 0x163a*/ --/*#define SECTION_AUTO_STOP_2_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x3a) // 0x168a*/ --/*#define SECTION_AUTO_STOP_2_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x3a) // 0x16da*/ --/* section 15:8*/ --/*#define SECTION_AUTO_STOP_1 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x3b) // 0x163b*/ --/*#define SECTION_AUTO_STOP_1_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x3b) // 0x168b*/ --/*#define SECTION_AUTO_STOP_1_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x3b) // 0x16db*/ --/* section 7:0*/ --/*#define SECTION_AUTO_STOP_0 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x3c) // 0x163c*/ --/*#define SECTION_AUTO_STOP_0_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x3c) // 0x168c*/ --/*#define SECTION_AUTO_STOP_0_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x3c) // 0x16dc*/ -- --/* bit 31:0 reset channel status - each bit reset each channel*/ --/* read -- 32 channel status*/ --/*#define DEMUX_CHANNEL_RESET -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x3d) // 0x163d*/ --/*#define DEMUX_CHANNEL_RESET_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x3d) // 0x168d*/ --/*#define DEMUX_CHANNEL_RESET_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x3d) // 0x16dd*/ -- --/*#define DEMUX_SCRAMBLING_STATE -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x3e) // 0x163e*/ --/*#define DEMUX_SCRAMBLING_STATE_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x3e) // 0x168e*/ --/*#define DEMUX_SCRAMBLING_STATE_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x3e) // 0x16de*/ -- --/*#define DEMUX_CHANNEL_ACTIVITY -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x3f) // 0x163f*/ --/*#define DEMUX_CHANNEL_ACTIVITY_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x3f) // 0x168f*/ --/*#define DEMUX_CHANNEL_ACTIVITY_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x3f) // 0x16df*/ -- --/* bit 4 -- video_stamp_use_dts*/ --/* bit 3 -- audio_stamp_sync_1_en*/ --/* bit 2 -- audio_stamp_insert_en*/ --/* bit 1 -- video_stamp_sync_1_en*/ --/* bit 0 -- video_stamp_insert_en*/ --/*#define DEMUX_STAMP_CTL -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x40) // 0x1640*/ --/*#define DEMUX_STAMP_CTL_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x40) // 0x1690*/ --/*#define DEMUX_STAMP_CTL_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x40) // 0x16e0*/ -- --/*#define DEMUX_VIDEO_STAMP_SYNC_0 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x41) // 0x1641*/ --/*#define DEMUX_VIDEO_STAMP_SYNC_0_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x41) // 0x1691*/ --/*#define DEMUX_VIDEO_STAMP_SYNC_0_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x41) // 0x16e1*/ -- --/*#define DEMUX_VIDEO_STAMP_SYNC_1 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x42) // 0x1642*/ --/*#define DEMUX_VIDEO_STAMP_SYNC_1_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x42) // 0x1692*/ --/*#define DEMUX_VIDEO_STAMP_SYNC_1_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x42) // 0x16e2*/ -- --/*#define DEMUX_AUDIO_STAMP_SYNC_0 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x43) // 0x1643*/ --/*#define DEMUX_AUDIO_STAMP_SYNC_0_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x43) // 0x1693*/ --/*#define DEMUX_AUDIO_STAMP_SYNC_0_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x43) // 0x16e3*/ -- --/*#define DEMUX_AUDIO_STAMP_SYNC_1 -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x44) // 0x1644*/ --/*#define DEMUX_AUDIO_STAMP_SYNC_1_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x44) // 0x1694*/ --/*#define DEMUX_AUDIO_STAMP_SYNC_1_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x44) // 0x16e4*/ -- --/* Write : Bit[4:0] secter filter number for reset*/ --/* Read : select according to output_section_buffer_valid :*/ --/* per bit per section buffer valid status*/ --/* or section_buffer_ignore*/ --/*#define DEMUX_SECTION_RESET -- * (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x45) // 0x1645*/ --/*#define DEMUX_SECTION_RESET_2 -- * (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x45) // 0x1695*/ --/*#define DEMUX_SECTION_RESET_3 -- * (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x45) // 0x16e5*/ -- -- --/* bit[31:0] - channel_reset_timeout_disable*/ --#define DEMUX_INPUT_TIMEOUT_C \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x46) /* 0x1646*/ --#define DEMUX_INPUT_TIMEOUT_C_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x46) /* 0x1696*/ --#define DEMUX_INPUT_TIMEOUT_C_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x46) /* 0x16e6*/ --/* bit[31] - no_match_reset_timeout_disable*/ --/* bit[30:0] input_time_out_int_cnt (0 -- means disable) Wr-setting, Rd-count*/ --#define DEMUX_INPUT_TIMEOUT \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x47) /* 0x1647*/ --#define DEMUX_INPUT_TIMEOUT_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x47) /* 0x1697*/ --#define DEMUX_INPUT_TIMEOUT_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x47) /* 0x16e7*/ -- --/* bit[31:0] - channel_packet_count_disable*/ --#define DEMUX_PACKET_COUNT_C \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x48) /* 0x1648*/ --#define DEMUX_PACKET_COUNT_C_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x48) /* 0x1698*/ --#define DEMUX_PACKET_COUNT_C_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x48) /* 0x16e8*/ --/* bit[31] - no_match_packet_count_disable*/ --/* bit[30:0] input_packet_count*/ --#define DEMUX_PACKET_COUNT \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x49) /* 0x1649*/ --#define DEMUX_PACKET_COUNT_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x49) /* 0x1699*/ --#define DEMUX_PACKET_COUNT_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x49) /* 0x16e9*/ -- --/* bit[31:0] channel_record_enable*/ --#define DEMUX_CHAN_RECORD_EN \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x4a) /* 0x164a*/ --#define DEMUX_CHAN_RECORD_EN_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x4a) /* 0x169a*/ --#define DEMUX_CHAN_RECORD_EN_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x4a) /* 0x16ea*/ -- --/* bit[31:0] channel_process_enable*/ --#define DEMUX_CHAN_PROCESS_EN \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x4b) /* 0x164b*/ --#define DEMUX_CHAN_PROCESS_EN_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x4b) /* 0x169b*/ --#define DEMUX_CHAN_PROCESS_EN_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x4b) /* 0x16eb*/ -- --/* bit[31:24] small_sec_size ((n+1) * 256 Bytes)*/ --/* bit[23:16] small_sec_rd_ptr */ --/* bit[15:8] small_sec_wr_ptr */ --/* bit[7:2] reserved*/ --/* bit[1] small_sec_wr_ptr_wr_enable*/ --/* bit[0] small_section_enable*/ --#define DEMUX_SMALL_SEC_CTL \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x4c) /* 0x164c*/ --#define DEMUX_SMALL_SEC_CTL_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x4c) /* 0x169c*/ --#define DEMUX_SMALL_SEC_CTL_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x4c) /* 0x16ec*/ --/* bit[31:0] small_sec_start_addr*/ --#define DEMUX_SMALL_SEC_ADDR \ -- (STB_CBUS_BASE + DEMUX_1_OFFSET + 0x4d) /* 0x164d*/ --#define DEMUX_SMALL_SEC_ADDR_2 \ -- (STB_CBUS_BASE + DEMUX_2_OFFSET + 0x4d) /* 0x169d*/ --#define DEMUX_SMALL_SEC_ADDR_3 \ -- (STB_CBUS_BASE + DEMUX_3_OFFSET + 0x4d) /* 0x16ed*/ -- -- --/*======================================================*/ --/* STB Registers End*/ --/*====================================================*/ --/* ----------------------------*/ --/* ASYNC FIFO (4)*/ --/* ----------------------------*/ --/*#define ASYNC_FIFO_REG0 0x2310*/ --/*#define ASYNC_FIFO_REG1 0x2311*/ --#define ASYNC_FIFO_FLUSH_STATUS 31 --#define ASYNC_FIFO_ERR 30 --#define ASYNC_FIFO_FIFO_EMPTY 29 --#define ASYNC_FIFO_TO_HIU 24 --#define ASYNC_FIFO_FLUSH 23 --#define ASYNC_FIFO_RESET 22 --#define ASYNC_FIFO_WRAP_EN 21 --#define ASYNC_FIFO_FLUSH_EN 20 --#define ASYNC_FIFO_RESIDUAL_MSB 19 --#define ASYNC_FIFO_RESIDUAL_LSB 15 --#define ASYNC_FIFO_FLUSH_CNT_MSB 14 --#define ASYNC_FIFO_FLUSH_CNT_LSB 0 --/*#define ASYNC_FIFO_REG2 0x2312*/ --#define ASYNC_FIFO_FIFO_FULL 26 --#define ASYNC_FIFO_FILL_STATUS 25 --#define ASYNC_FIFO_SOURCE_MSB 24 --#define ASYNC_FIFO_SOURCE_LSB 23 --#define ASYNC_FIFO_ENDIAN_MSB 22 --#define ASYNC_FIFO_ENDIAN_LSB 21 --#define ASYNC_FIFO_FILL_EN 20 --#define ASYNC_FIFO_FILL_CNT_MSB 19 --#define ASYNC_FIFO_FILL_CNT_LSB 0 --/*#define ASYNC_FIFO_REG3 0x2313*/ --#define ASYNC_FLUSH_SIZE_IRQ_MSB 15 --#define ASYNC_FLUSH_SIZE_IRQ_LSB 0 --/* ----------------------------*/ --/* ASYNC FIFO (4)*/ --/* ----------------------------*/ --/*#define ASYNC_FIFO2_REG0 0x2314*/ --/*#define ASYNC_FIFO2_REG1 0x2315*/ --/*#define ASYNC_FIFO2_REG2 0x2316*/ --/*#define ASYNC_FIFO2_REG3 0x2317*/ -- --#define RESET_DEMUXSTB (1 << 1) --#endif /* C_STB_DEFINE_H*/ -diff --git a/drivers/amlogic/dvb_tv/c_stb_regs_define.h b/drivers/amlogic/dvb_tv/c_stb_regs_define.h -deleted file mode 100644 -index 2612fa6..0000000 ---- a/drivers/amlogic/dvb_tv/c_stb_regs_define.h -+++ /dev/null -@@ -1,8889 +0,0 @@ --/* -- * This file is automaticly generated by genregs.awk. Please do not edit it -- * Base files are .. -- * .. -- * .. -- * Tue Oct 22 15:28:48 CST 2013 -- **/ --#ifndef __MACH_MESON8_REG_ADDR_H_ --#define __MACH_MESON8_REG_ADDR_H_ --#include --#define CBUS_REG_ADDR(_r) aml_read_cbus(_r) --#define HHI_DEMOD_MEM_PD_REG (0xc883c000 + (0x43 << 2)) --#define STB_TOP_CONFIG 0x16f0 --#define P_STB_TOP_CONFIG CBUS_REG_ADDR(STB_TOP_CONFIG) --#define TS_TOP_CONFIG 0x16f1 --#define P_TS_TOP_CONFIG CBUS_REG_ADDR(TS_TOP_CONFIG) --#define TS_FILE_CONFIG 0x16f2 --#define P_TS_FILE_CONFIG CBUS_REG_ADDR(TS_FILE_CONFIG) --#define TS_PL_PID_INDEX 0x16f3 --#define P_TS_PL_PID_INDEX CBUS_REG_ADDR(TS_PL_PID_INDEX) --#define TS_PL_PID_DATA 0x16f4 --#define P_TS_PL_PID_DATA CBUS_REG_ADDR(TS_PL_PID_DATA) --#define COMM_DESC_KEY0 0x16f5 --#define P_COMM_DESC_KEY0 CBUS_REG_ADDR(COMM_DESC_KEY0) --#define COMM_DESC_KEY1 0x16f6 --#define P_COMM_DESC_KEY1 CBUS_REG_ADDR(COMM_DESC_KEY1) --#define COMM_DESC_KEY_RW 0x16f7 --#define P_COMM_DESC_KEY_RW CBUS_REG_ADDR(COMM_DESC_KEY_RW) --#define CIPLUS_KEY0 0x16f8 --#define P_CIPLUS_KEY0 CBUS_REG_ADDR(CIPLUS_KEY0) --#define CIPLUS_KEY1 0x16f9 --#define P_CIPLUS_KEY1 CBUS_REG_ADDR(CIPLUS_KEY1) --#define CIPLUS_KEY2 0x16fa --#define P_CIPLUS_KEY2 CBUS_REG_ADDR(CIPLUS_KEY2) --#define CIPLUS_KEY3 0x16fb --#define P_CIPLUS_KEY3 CBUS_REG_ADDR(CIPLUS_KEY3) --#define CIPLUS_KEY_WR 0x16fc --#define P_CIPLUS_KEY_WR CBUS_REG_ADDR(CIPLUS_KEY_WR) --#define CIPLUS_CONFIG 0x16fd --#define P_CIPLUS_CONFIG CBUS_REG_ADDR(CIPLUS_CONFIG) --#define CIPLUS_ENDIAN 0x16fe --#define P_CIPLUS_ENDIAN CBUS_REG_ADDR(CIPLUS_ENDIAN) --#define PREG_CTLREG0_ADDR 0x2000 --#define P_PREG_CTLREG0_ADDR CBUS_REG_ADDR(PREG_CTLREG0_ADDR) --#define PREG_PAD_GPIO6_EN_N 0x2008 --#define P_PREG_PAD_GPIO6_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO6_EN_N) --#define PREG_PAD_GPIO6_O 0x2009 --#define P_PREG_PAD_GPIO6_O CBUS_REG_ADDR(PREG_PAD_GPIO6_O) --#define PREG_PAD_GPIO6_I 0x200a --#define P_PREG_PAD_GPIO6_I CBUS_REG_ADDR(PREG_PAD_GPIO6_I) --#define PREG_JTAG_GPIO_ADDR 0x200b --#define P_PREG_JTAG_GPIO_ADDR CBUS_REG_ADDR(PREG_JTAG_GPIO_ADDR) --#define PREG_PAD_GPIO0_EN_N 0x200c --#define P_PREG_PAD_GPIO0_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO0_EN_N) --#define PREG_PAD_GPIO0_O 0x200d --#define P_PREG_PAD_GPIO0_O CBUS_REG_ADDR(PREG_PAD_GPIO0_O) --#define PREG_PAD_GPIO0_I 0x200e --#define P_PREG_PAD_GPIO0_I CBUS_REG_ADDR(PREG_PAD_GPIO0_I) --#define PREG_PAD_GPIO1_EN_N 0x200f --#define P_PREG_PAD_GPIO1_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO1_EN_N) --#define PREG_PAD_GPIO1_O 0x2010 --#define P_PREG_PAD_GPIO1_O CBUS_REG_ADDR(PREG_PAD_GPIO1_O) --#define PREG_PAD_GPIO1_I 0x2011 --#define P_PREG_PAD_GPIO1_I CBUS_REG_ADDR(PREG_PAD_GPIO1_I) --#define PREG_PAD_GPIO2_EN_N 0x2012 --#define P_PREG_PAD_GPIO2_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO2_EN_N) --#define PREG_PAD_GPIO2_O 0x2013 --#define P_PREG_PAD_GPIO2_O CBUS_REG_ADDR(PREG_PAD_GPIO2_O) --#define PREG_PAD_GPIO2_I 0x2014 --#define P_PREG_PAD_GPIO2_I CBUS_REG_ADDR(PREG_PAD_GPIO2_I) --#define PREG_PAD_GPIO3_EN_N 0x2015 --#define P_PREG_PAD_GPIO3_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO3_EN_N) --#define PREG_PAD_GPIO3_O 0x2016 --#define P_PREG_PAD_GPIO3_O CBUS_REG_ADDR(PREG_PAD_GPIO3_O) --#define PREG_PAD_GPIO3_I 0x2017 --#define P_PREG_PAD_GPIO3_I CBUS_REG_ADDR(PREG_PAD_GPIO3_I) --#define PREG_PAD_GPIO4_EN_N 0x2018 --#define P_PREG_PAD_GPIO4_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO4_EN_N) --#define PREG_PAD_GPIO4_O 0x2019 --#define P_PREG_PAD_GPIO4_O CBUS_REG_ADDR(PREG_PAD_GPIO4_O) --#define PREG_PAD_GPIO4_I 0x201a --#define P_PREG_PAD_GPIO4_I CBUS_REG_ADDR(PREG_PAD_GPIO4_I) --#define PREG_PAD_GPIO5_EN_N 0x201b --#define P_PREG_PAD_GPIO5_EN_N CBUS_REG_ADDR(PREG_PAD_GPIO5_EN_N) --#define PREG_PAD_GPIO5_O 0x201c --#define P_PREG_PAD_GPIO5_O CBUS_REG_ADDR(PREG_PAD_GPIO5_O) --#define PREG_PAD_GPIO5_I 0x201d --#define P_PREG_PAD_GPIO5_I CBUS_REG_ADDR(PREG_PAD_GPIO5_I) --#define A9_STATUS1 0x201f --#define P_A9_STATUS1 CBUS_REG_ADDR(A9_STATUS1) --#define A9_CFG0 0x2020 --#define P_A9_CFG0 CBUS_REG_ADDR(A9_CFG0) --#define A9_CFG1 0x2021 --#define P_A9_CFG1 CBUS_REG_ADDR(A9_CFG1) --#define A9_CFG2 0x2022 --#define P_A9_CFG2 CBUS_REG_ADDR(A9_CFG2) --#define A9_PERIPH_BASE 0x2023 --#define P_A9_PERIPH_BASE CBUS_REG_ADDR(A9_PERIPH_BASE) --#define A9_L2_REG_BASE 0x2024 --#define P_A9_L2_REG_BASE CBUS_REG_ADDR(A9_L2_REG_BASE) --#define A9_L2_STATUS 0x2025 --#define P_A9_L2_STATUS CBUS_REG_ADDR(A9_L2_STATUS) --#define A9_POR_CFG 0x2026 --#define P_A9_POR_CFG CBUS_REG_ADDR(A9_POR_CFG) --#define A9_STATUS2 0x2027 --#define P_A9_STATUS2 CBUS_REG_ADDR(A9_STATUS2) --#define AXI_REG_EN 0x2028 --#define P_AXI_REG_EN CBUS_REG_ADDR(AXI_REG_EN) --#define A9_CFG3 0x2029 --#define P_A9_CFG3 CBUS_REG_ADDR(A9_CFG3) --#define A9_CFG4 0x202a --#define P_A9_CFG4 CBUS_REG_ADDR(A9_CFG4) --#define A9_STATUS3 0x202b --#define P_A9_STATUS3 CBUS_REG_ADDR(A9_STATUS3) --#define PERIPHS_PIN_MUX_0 0x202c --#define P_PERIPHS_PIN_MUX_0 CBUS_REG_ADDR(PERIPHS_PIN_MUX_0) --#define PERIPHS_PIN_MUX_1 0x202d --#define P_PERIPHS_PIN_MUX_1 CBUS_REG_ADDR(PERIPHS_PIN_MUX_1) --#define PERIPHS_PIN_MUX_2 0x202e --#define P_PERIPHS_PIN_MUX_2 CBUS_REG_ADDR(PERIPHS_PIN_MUX_2) --#define PERIPHS_PIN_MUX_3 0x202f --#define P_PERIPHS_PIN_MUX_3 CBUS_REG_ADDR(PERIPHS_PIN_MUX_3) --#define PERIPHS_PIN_MUX_4 0x2030 --#define P_PERIPHS_PIN_MUX_4 CBUS_REG_ADDR(PERIPHS_PIN_MUX_4) --#define PERIPHS_PIN_MUX_5 0x2031 --#define P_PERIPHS_PIN_MUX_5 CBUS_REG_ADDR(PERIPHS_PIN_MUX_5) --#define PERIPHS_PIN_MUX_6 0x2032 --#define P_PERIPHS_PIN_MUX_6 CBUS_REG_ADDR(PERIPHS_PIN_MUX_6) --#define PERIPHS_PIN_MUX_7 0x2033 --#define P_PERIPHS_PIN_MUX_7 CBUS_REG_ADDR(PERIPHS_PIN_MUX_7) --#define PERIPHS_PIN_MUX_8 0x2034 --#define P_PERIPHS_PIN_MUX_8 CBUS_REG_ADDR(PERIPHS_PIN_MUX_8) --#define PERIPHS_PIN_MUX_9 0x2035 --#define P_PERIPHS_PIN_MUX_9 CBUS_REG_ADDR(PERIPHS_PIN_MUX_9) --#define PERIPHS_PIN_MUX_10 0x2036 --#define P_PERIPHS_PIN_MUX_10 CBUS_REG_ADDR(PERIPHS_PIN_MUX_10) --#define PERIPHS_PIN_MUX_11 0x2037 --#define P_PERIPHS_PIN_MUX_11 CBUS_REG_ADDR(PERIPHS_PIN_MUX_11) --#define PERIPHS_PIN_MUX_12 0x2038 --#define P_PERIPHS_PIN_MUX_12 CBUS_REG_ADDR(PERIPHS_PIN_MUX_12) --#define PAD_PULL_UP_REG6 0x2039 --#define P_PAD_PULL_UP_REG6 CBUS_REG_ADDR(PAD_PULL_UP_REG6) --#define PAD_PULL_UP_REG0 0x203a --#define P_PAD_PULL_UP_REG0 CBUS_REG_ADDR(PAD_PULL_UP_REG0) --#define PAD_PULL_UP_REG1 0x203b --#define P_PAD_PULL_UP_REG1 CBUS_REG_ADDR(PAD_PULL_UP_REG1) --#define PAD_PULL_UP_REG2 0x203c --#define P_PAD_PULL_UP_REG2 CBUS_REG_ADDR(PAD_PULL_UP_REG2) --#define PAD_PULL_UP_REG3 0x203d --#define P_PAD_PULL_UP_REG3 CBUS_REG_ADDR(PAD_PULL_UP_REG3) --#define PAD_PULL_UP_REG4 0x203e --#define P_PAD_PULL_UP_REG4 CBUS_REG_ADDR(PAD_PULL_UP_REG4) --#define PAD_PULL_UP_REG5 0x203f --#define P_PAD_PULL_UP_REG5 CBUS_REG_ADDR(PAD_PULL_UP_REG5) --#define RAND64_ADDR0 0x2040 --#define P_RAND64_ADDR0 CBUS_REG_ADDR(RAND64_ADDR0) --#define RAND64_ADDR1 0x2041 --#define P_RAND64_ADDR1 CBUS_REG_ADDR(RAND64_ADDR1) --#define PREG_ETHERNET_ADDR0 0x2042 --#define P_PREG_ETHERNET_ADDR0 CBUS_REG_ADDR(PREG_ETHERNET_ADDR0) --#define PREG_AM_ANALOG_ADDR 0x2043 --#define P_PREG_AM_ANALOG_ADDR CBUS_REG_ADDR(PREG_AM_ANALOG_ADDR) --#define PREG_MALI_BYTE_CNTL 0x2044 --#define P_PREG_MALI_BYTE_CNTL CBUS_REG_ADDR(PREG_MALI_BYTE_CNTL) --#define PREG_WIFI_CNTL 0x2045 --#define P_PREG_WIFI_CNTL CBUS_REG_ADDR(PREG_WIFI_CNTL) --#define PAD_PULL_UP_EN_REG0 0x2048 --#define P_PAD_PULL_UP_EN_REG0 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG0) --#define PAD_PULL_UP_EN_REG1 0x2049 --#define P_PAD_PULL_UP_EN_REG1 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG1) --#define PAD_PULL_UP_EN_REG2 0x204a --#define P_PAD_PULL_UP_EN_REG2 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG2) --#define PAD_PULL_UP_EN_REG3 0x204b --#define P_PAD_PULL_UP_EN_REG3 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG3) --#define PAD_PULL_UP_EN_REG4 0x204c --#define P_PAD_PULL_UP_EN_REG4 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG4) --#define PAD_PULL_UP_EN_REG5 0x204d --#define P_PAD_PULL_UP_EN_REG5 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG5) --#define PAD_PULL_UP_EN_REG6 0x204e --#define P_PAD_PULL_UP_EN_REG6 CBUS_REG_ADDR(PAD_PULL_UP_EN_REG6) --/* add from M8M2*/ --#define PREG_ETH_REG0 0x2050 --#define P_PREG_ETH_REG0 CBUS_REG_ADDR(PREG_ETH_REG0) --#define PREG_ETH_REG1 0x2051 --#define P_PREG_ETH_REG1 CBUS_REG_ADDR(PREG_ETH_REG1) --/***************/ --#define PROD_TEST_REG0 0x2068 --#define P_PROD_TEST_REG0 CBUS_REG_ADDR(PROD_TEST_REG0) --#define PROD_TEST_REG1 0x2067 --#define P_PROD_TEST_REG1 CBUS_REG_ADDR(PROD_TEST_REG1) --#define METAL_REVISION 0x206a --#define P_METAL_REVISION CBUS_REG_ADDR(METAL_REVISION) --#define ADC_TOP_MISC 0x206b --#define P_ADC_TOP_MISC CBUS_REG_ADDR(ADC_TOP_MISC) --#define DPLL_TOP_MISC 0x206c --#define P_DPLL_TOP_MISC CBUS_REG_ADDR(DPLL_TOP_MISC) --#define ANALOG_TOP_MISC 0x206d --#define P_ANALOG_TOP_MISC CBUS_REG_ADDR(ANALOG_TOP_MISC) --#define AM_ANALOG_TOP_REG0 0x206e --#define P_AM_ANALOG_TOP_REG0 CBUS_REG_ADDR(AM_ANALOG_TOP_REG0) --#define AM_ANALOG_TOP_REG1 0x206f --#define P_AM_ANALOG_TOP_REG1 CBUS_REG_ADDR(AM_ANALOG_TOP_REG1) --#define PREG_STICKY_REG0 0x207c --#define P_PREG_STICKY_REG0 CBUS_REG_ADDR(PREG_STICKY_REG0) --#define PREG_STICKY_REG1 0x207d --#define P_PREG_STICKY_REG1 CBUS_REG_ADDR(PREG_STICKY_REG1) --#define PREG_WRITE_ONCE_REG 0x207e --#define P_PREG_WRITE_ONCE_REG CBUS_REG_ADDR(PREG_WRITE_ONCE_REG) --#define AM_RING_OSC_REG0 0x207f --#define P_AM_RING_OSC_REG0 CBUS_REG_ADDR(AM_RING_OSC_REG0) --#define SMARTCARD_REG0 0x2110 --#define P_SMARTCARD_REG0 CBUS_REG_ADDR(SMARTCARD_REG0) --#define SMARTCARD_REG1 0x2111 --#define P_SMARTCARD_REG1 CBUS_REG_ADDR(SMARTCARD_REG1) --#define SMARTCARD_REG2 0x2112 --#define P_SMARTCARD_REG2 CBUS_REG_ADDR(SMARTCARD_REG2) --#define SMARTCARD_STATUS 0x2113 --#define P_SMARTCARD_STATUS CBUS_REG_ADDR(SMARTCARD_STATUS) --#define SMARTCARD_INTR 0x2114 --#define P_SMARTCARD_INTR CBUS_REG_ADDR(SMARTCARD_INTR) --#define SMARTCARD_REG5 0x2115 --#define P_SMARTCARD_REG5 CBUS_REG_ADDR(SMARTCARD_REG5) --#define SMARTCARD_REG6 0x2116 --#define P_SMARTCARD_REG6 CBUS_REG_ADDR(SMARTCARD_REG6) --#define SMARTCARD_FIFO 0x2117 --#define P_SMARTCARD_FIFO CBUS_REG_ADDR(SMARTCARD_FIFO) --#define SMARTCARD_REG8 0x2118 --#define P_SMARTCARD_REG8 CBUS_REG_ADDR(SMARTCARD_REG8) --#define IR_DEC_LDR_ACTIVE 0x2120 --#define P_IR_DEC_LDR_ACTIVE CBUS_REG_ADDR(IR_DEC_LDR_ACTIVE) --#define IR_DEC_LDR_IDLE 0x2121 --#define P_IR_DEC_LDR_IDLE CBUS_REG_ADDR(IR_DEC_LDR_IDLE) --#define IR_DEC_LDR_REPEAT 0x2122 --#define P_IR_DEC_LDR_REPEAT CBUS_REG_ADDR(IR_DEC_LDR_REPEAT) --#define IR_DEC_BIT_0 0x2123 --#define P_IR_DEC_BIT_0 CBUS_REG_ADDR(IR_DEC_BIT_0) --#define IR_DEC_REG0 0x2124 --#define P_IR_DEC_REG0 CBUS_REG_ADDR(IR_DEC_REG0) --#define IR_DEC_FRAME 0x2125 --#define P_IR_DEC_FRAME CBUS_REG_ADDR(IR_DEC_FRAME) --#define IR_DEC_STATUS 0x2126 --#define P_IR_DEC_STATUS CBUS_REG_ADDR(IR_DEC_STATUS) --#define IR_DEC_REG1 0x2127 --#define P_IR_DEC_REG1 CBUS_REG_ADDR(IR_DEC_REG1) --#define DEMOD_ADC_SAMPLING 0x212d --#define P_DEMOD_ADC_SAMPLING CBUS_REG_ADDR(DEMOD_ADC_SAMPLING) --#define UART0_WFIFO 0x2130 --#define P_UART0_WFIFO CBUS_REG_ADDR(UART0_WFIFO) --#define UART0_RFIFO 0x2131 --#define P_UART0_RFIFO CBUS_REG_ADDR(UART0_RFIFO) --#define UART0_CONTROL 0x2132 --#define P_UART0_CONTROL CBUS_REG_ADDR(UART0_CONTROL) --#define UART0_STATUS 0x2133 --#define P_UART0_STATUS CBUS_REG_ADDR(UART0_STATUS) --#define UART0_MISC 0x2134 --#define P_UART0_MISC CBUS_REG_ADDR(UART0_MISC) --#define UART0_REG5 0x2135 --#define P_UART0_REG5 CBUS_REG_ADDR(UART0_REG5) --#define UART1_WFIFO 0x2137 --#define P_UART1_WFIFO CBUS_REG_ADDR(UART1_WFIFO) --#define UART1_RFIFO 0x2138 --#define P_UART1_RFIFO CBUS_REG_ADDR(UART1_RFIFO) --#define UART1_CONTROL 0x2139 --#define P_UART1_CONTROL CBUS_REG_ADDR(UART1_CONTROL) --#define UART1_STATUS 0x213a --#define P_UART1_STATUS CBUS_REG_ADDR(UART1_STATUS) --#define UART1_MISC 0x213b --#define P_UART1_MISC CBUS_REG_ADDR(UART1_MISC) --#define UART1_REG5 0x213c --#define P_UART1_REG5 CBUS_REG_ADDR(UART1_REG5) --#define I2C_M_0_CONTROL_REG 0x2140 --#define P_I2C_M_0_CONTROL_REG CBUS_REG_ADDR(I2C_M_0_CONTROL_REG) --#define I2C_M_0_SLAVE_ADDR 0x2141 --#define P_I2C_M_0_SLAVE_ADDR CBUS_REG_ADDR(I2C_M_0_SLAVE_ADDR) --#define I2C_M_0_TOKEN_LIST0 0x2142 --#define P_I2C_M_0_TOKEN_LIST0 CBUS_REG_ADDR(I2C_M_0_TOKEN_LIST0) --#define I2C_M_0_TOKEN_LIST1 0x2143 --#define P_I2C_M_0_TOKEN_LIST1 CBUS_REG_ADDR(I2C_M_0_TOKEN_LIST1) --#define I2C_M_0_WDATA_REG0 0x2144 --#define P_I2C_M_0_WDATA_REG0 CBUS_REG_ADDR(I2C_M_0_WDATA_REG0) --#define I2C_M_0_WDATA_REG1 0x2145 --#define P_I2C_M_0_WDATA_REG1 CBUS_REG_ADDR(I2C_M_0_WDATA_REG1) --#define I2C_M_0_RDATA_REG0 0x2146 --#define P_I2C_M_0_RDATA_REG0 CBUS_REG_ADDR(I2C_M_0_RDATA_REG0) --#define I2C_M_0_RDATA_REG1 0x2147 --#define P_I2C_M_0_RDATA_REG1 CBUS_REG_ADDR(I2C_M_0_RDATA_REG1) --#define I2C_S_CONTROL_REG 0x2150 --#define P_I2C_S_CONTROL_REG CBUS_REG_ADDR(I2C_S_CONTROL_REG) --#define I2C_S_SEND_REG 0x2151 --#define P_I2C_S_SEND_REG CBUS_REG_ADDR(I2C_S_SEND_REG) --#define I2C_S_RECV_REG 0x2152 --#define P_I2C_S_RECV_REG CBUS_REG_ADDR(I2C_S_RECV_REG) --#define I2C_S_CNTL1_REG 0x2153 --#define P_I2C_S_CNTL1_REG CBUS_REG_ADDR(I2C_S_CNTL1_REG) --#define PWM_PWM_A 0x2154 --#define P_PWM_PWM_A CBUS_REG_ADDR(PWM_PWM_A) --#define PWM_PWM_B 0x2155 --#define P_PWM_PWM_B CBUS_REG_ADDR(PWM_PWM_B) --#define PWM_MISC_REG_AB 0x2156 --#define P_PWM_MISC_REG_AB CBUS_REG_ADDR(PWM_MISC_REG_AB) --#define PWM_DELTA_SIGMA_AB 0x2157 --#define P_PWM_DELTA_SIGMA_AB CBUS_REG_ADDR(PWM_DELTA_SIGMA_AB) --#define ATAPI_IDEREG0 0x2160 --#define P_ATAPI_IDEREG0 CBUS_REG_ADDR(ATAPI_IDEREG0) --#define ATAPI_IDEREG1 0x2161 --#define P_ATAPI_IDEREG1 CBUS_REG_ADDR(ATAPI_IDEREG1) --#define ATAPI_IDEREG2 0x2162 --#define P_ATAPI_IDEREG2 CBUS_REG_ADDR(ATAPI_IDEREG2) --#define ATAPI_CYCTIME 0x2163 --#define P_ATAPI_CYCTIME CBUS_REG_ADDR(ATAPI_CYCTIME) --#define ATAPI_IDETIME 0x2164 --#define P_ATAPI_IDETIME CBUS_REG_ADDR(ATAPI_IDETIME) --#define ATAPI_PIO_TIMING 0x2165 --#define P_ATAPI_PIO_TIMING CBUS_REG_ADDR(ATAPI_PIO_TIMING) --#define ATAPI_TABLE_ADD_REG 0x2166 --#define P_ATAPI_TABLE_ADD_REG CBUS_REG_ADDR(ATAPI_TABLE_ADD_REG) --#define ATAPI_IDEREG3 0x2167 --#define P_ATAPI_IDEREG3 CBUS_REG_ADDR(ATAPI_IDEREG3) --#define ATAPI_UDMA_REG0 0x2168 --#define P_ATAPI_UDMA_REG0 CBUS_REG_ADDR(ATAPI_UDMA_REG0) --#define ATAPI_UDMA_REG1 0x2169 --#define P_ATAPI_UDMA_REG1 CBUS_REG_ADDR(ATAPI_UDMA_REG1) --#define TRANS_PWMA_REG0 0x2170 --#define P_TRANS_PWMA_REG0 CBUS_REG_ADDR(TRANS_PWMA_REG0) --#define TRANS_PWMA_REG1 0x2171 --#define P_TRANS_PWMA_REG1 CBUS_REG_ADDR(TRANS_PWMA_REG1) --#define TRANS_PWMA_MUX0 0x2172 --#define P_TRANS_PWMA_MUX0 CBUS_REG_ADDR(TRANS_PWMA_MUX0) --#define TRANS_PWMA_MUX1 0x2173 --#define P_TRANS_PWMA_MUX1 CBUS_REG_ADDR(TRANS_PWMA_MUX1) --#define TRANS_PWMA_MUX2 0x2174 --#define P_TRANS_PWMA_MUX2 CBUS_REG_ADDR(TRANS_PWMA_MUX2) --#define TRANS_PWMA_MUX3 0x2175 --#define P_TRANS_PWMA_MUX3 CBUS_REG_ADDR(TRANS_PWMA_MUX3) --#define TRANS_PWMA_MUX4 0x2176 --#define P_TRANS_PWMA_MUX4 CBUS_REG_ADDR(TRANS_PWMA_MUX4) --#define TRANS_PWMA_MUX5 0x2177 --#define P_TRANS_PWMA_MUX5 CBUS_REG_ADDR(TRANS_PWMA_MUX5) --#define TRANS_PWMB_REG0 0x2178 --#define P_TRANS_PWMB_REG0 CBUS_REG_ADDR(TRANS_PWMB_REG0) --#define TRANS_PWMB_REG1 0x2179 --#define P_TRANS_PWMB_REG1 CBUS_REG_ADDR(TRANS_PWMB_REG1) --#define TRANS_PWMB_MUX0 0x217a --#define P_TRANS_PWMB_MUX0 CBUS_REG_ADDR(TRANS_PWMB_MUX0) --#define TRANS_PWMB_MUX1 0x217b --#define P_TRANS_PWMB_MUX1 CBUS_REG_ADDR(TRANS_PWMB_MUX1) --#define TRANS_PWMB_MUX2 0x217c --#define P_TRANS_PWMB_MUX2 CBUS_REG_ADDR(TRANS_PWMB_MUX2) --#define TRANS_PWMB_MUX3 0x217d --#define P_TRANS_PWMB_MUX3 CBUS_REG_ADDR(TRANS_PWMB_MUX3) --#define TRANS_PWMB_MUX4 0x217e --#define P_TRANS_PWMB_MUX4 CBUS_REG_ADDR(TRANS_PWMB_MUX4) --#define TRANS_PWMB_MUX5 0x217f --#define P_TRANS_PWMB_MUX5 CBUS_REG_ADDR(TRANS_PWMB_MUX5) --#define NAND_START 0x2180 --#define P_NAND_START CBUS_REG_ADDR(NAND_START) --#define NAND_ADR_CMD 0x218a --#define P_NAND_ADR_CMD CBUS_REG_ADDR(NAND_ADR_CMD) --#define NAND_ADR_STS 0x218b --#define P_NAND_ADR_STS CBUS_REG_ADDR(NAND_ADR_STS) --#define NAND_END 0x218f --#define P_NAND_END CBUS_REG_ADDR(NAND_END) --#define PWM_PWM_C 0x2194 --#define P_PWM_PWM_C CBUS_REG_ADDR(PWM_PWM_C) --#define PWM_PWM_D 0x2195 --#define P_PWM_PWM_D CBUS_REG_ADDR(PWM_PWM_D) --#define PWM_MISC_REG_CD 0x2196 --#define P_PWM_MISC_REG_CD CBUS_REG_ADDR(PWM_MISC_REG_CD) --#define PWM_DELTA_SIGMA_CD 0x2197 --#define P_PWM_DELTA_SIGMA_CD CBUS_REG_ADDR(PWM_DELTA_SIGMA_CD) --#define ISP_LED_CTRL 0x2198 --#define P_ISP_LED_CTRL CBUS_REG_ADDR(ISP_LED_CTRL) --#define ISP_LED_TIMING1 0x2199 --#define P_ISP_LED_TIMING1 CBUS_REG_ADDR(ISP_LED_TIMING1) --#define ISP_LED_TIMING2 0x219a --#define P_ISP_LED_TIMING2 CBUS_REG_ADDR(ISP_LED_TIMING2) --#define ISP_LED_TIMING3 0x219b --#define P_ISP_LED_TIMING3 CBUS_REG_ADDR(ISP_LED_TIMING3) --#define ISP_LED_TIMING4 0x219c --#define P_ISP_LED_TIMING4 CBUS_REG_ADDR(ISP_LED_TIMING4) --#define ISP_LED_TIMING5 0x219d --#define P_ISP_LED_TIMING5 CBUS_REG_ADDR(ISP_LED_TIMING5) --#define ISP_LED_TIMING6 0x219e --#define P_ISP_LED_TIMING6 CBUS_REG_ADDR(ISP_LED_TIMING6) --#define SAR_ADC_REG0 0x21a0 --#define P_SAR_ADC_REG0 CBUS_REG_ADDR(SAR_ADC_REG0) --#define SAR_ADC_CHAN_LIST 0x21a1 --#define P_SAR_ADC_CHAN_LIST CBUS_REG_ADDR(SAR_ADC_CHAN_LIST) --#define SAR_ADC_AVG_CNTL 0x21a2 --#define P_SAR_ADC_AVG_CNTL CBUS_REG_ADDR(SAR_ADC_AVG_CNTL) --#define SAR_ADC_REG3 0x21a3 --#define P_SAR_ADC_REG3 CBUS_REG_ADDR(SAR_ADC_REG3) --#define SAR_ADC_DELAY 0x21a4 --#define P_SAR_ADC_DELAY CBUS_REG_ADDR(SAR_ADC_DELAY) --#define SAR_ADC_LAST_RD 0x21a5 --#define P_SAR_ADC_LAST_RD CBUS_REG_ADDR(SAR_ADC_LAST_RD) --#define SAR_ADC_FIFO_RD 0x21a6 --#define P_SAR_ADC_FIFO_RD CBUS_REG_ADDR(SAR_ADC_FIFO_RD) --#define SAR_ADC_AUX_SW 0x21a7 --#define P_SAR_ADC_AUX_SW CBUS_REG_ADDR(SAR_ADC_AUX_SW) --#define SAR_ADC_CHAN_10_SW 0x21a8 --#define P_SAR_ADC_CHAN_10_SW CBUS_REG_ADDR(SAR_ADC_CHAN_10_SW) --#define SAR_ADC_DETECT_IDLE_SW 0x21a9 --#define P_SAR_ADC_DETECT_IDLE_SW \ -- CBUS_REG_ADDR(SAR_ADC_DETECT_IDLE_SW) --#define SAR_ADC_DELTA_10 0x21aa --#define P_SAR_ADC_DELTA_10 CBUS_REG_ADDR(SAR_ADC_DELTA_10) --#define PWM_PWM_E 0x21b0 --#define P_PWM_PWM_E CBUS_REG_ADDR(PWM_PWM_E) --#define PWM_PWM_F 0x21b1 --#define P_PWM_PWM_F CBUS_REG_ADDR(PWM_PWM_F) --#define PWM_MISC_REG_EF 0x21b2 --#define P_PWM_MISC_REG_EF CBUS_REG_ADDR(PWM_MISC_REG_EF) --#define PWM_DELTA_SIGMA_EF 0x21b3 --#define P_PWM_DELTA_SIGMA_EF CBUS_REG_ADDR(PWM_DELTA_SIGMA_EF) --#define UART2_WFIFO 0x21c0 --#define P_UART2_WFIFO CBUS_REG_ADDR(UART2_WFIFO) --#define UART2_RFIFO 0x21c1 --#define P_UART2_RFIFO CBUS_REG_ADDR(UART2_RFIFO) --#define UART2_CONTROL 0x21c2 --#define P_UART2_CONTROL CBUS_REG_ADDR(UART2_CONTROL) --#define UART2_STATUS 0x21c3 --#define P_UART2_STATUS CBUS_REG_ADDR(UART2_STATUS) --#define UART2_MISC 0x21c4 --#define P_UART2_MISC CBUS_REG_ADDR(UART2_MISC) --#define UART2_REG5 0x21c5 --#define P_UART2_REG5 CBUS_REG_ADDR(UART2_REG5) --#define UART3_WFIFO 0x21c8 --#define P_UART3_WFIFO CBUS_REG_ADDR(UART3_WFIFO) --#define UART3_RFIFO 0x21c9 --#define P_UART3_RFIFO CBUS_REG_ADDR(UART3_RFIFO) --#define UART3_CONTROL 0x21ca --#define P_UART3_CONTROL CBUS_REG_ADDR(UART3_CONTROL) --#define UART3_STATUS 0x21cb --#define P_UART3_STATUS CBUS_REG_ADDR(UART3_STATUS) --#define UART3_MISC 0x21cc --#define P_UART3_MISC CBUS_REG_ADDR(UART3_MISC) --#define UART3_REG5 0x21cd --#define P_UART3_REG5 CBUS_REG_ADDR(UART3_REG5) --#define RTC_ADDR0 0x21d0 --#define P_RTC_ADDR0 CBUS_REG_ADDR(RTC_ADDR0) --#define RTC_ADDR1 0x21d1 --#define P_RTC_ADDR1 CBUS_REG_ADDR(RTC_ADDR1) --#define RTC_ADDR2 0x21d2 --#define P_RTC_ADDR2 CBUS_REG_ADDR(RTC_ADDR2) --#define RTC_ADDR3 0x21d3 --#define P_RTC_ADDR3 CBUS_REG_ADDR(RTC_ADDR3) --#define RTC_ADDR4 0x21d4 --#define P_RTC_ADDR4 CBUS_REG_ADDR(RTC_ADDR4) --#define MSR_CLK_DUTY 0x21d6 --#define P_MSR_CLK_DUTY CBUS_REG_ADDR(MSR_CLK_DUTY) --#define MSR_CLK_REG0 0x21d7 --#define P_MSR_CLK_REG0 CBUS_REG_ADDR(MSR_CLK_REG0) --#define MSR_CLK_REG1 0x21d8 --#define P_MSR_CLK_REG1 CBUS_REG_ADDR(MSR_CLK_REG1) --#define MSR_CLK_REG2 0x21d9 --#define P_MSR_CLK_REG2 CBUS_REG_ADDR(MSR_CLK_REG2) --/*add from M8M2*/ --#define MSR_CLK_REG3 0x21da --#define P_MSR_CLK_REG3 CBUS_REG_ADDR(MSR_CLK_REG3) --#define MSR_CLK_REG4 0x21db --#define P_MSR_CLK_REG4 CBUS_REG_ADDR(MSR_CLK_REG4) --#define MSR_CLK_REG5 0x21de --#define P_MSR_CLK_REG5 CBUS_REG_ADDR(MSR_CLK_REG5) --/**/ --/* -- * #define LED_PWM_REG0 0x21da -- * #define P_LED_PWM_REG0 CBUS_REG_ADDR(LED_PWM_REG0) -- * #define LED_PWM_REG1 0x21db -- * #define P_LED_PWM_REG1 CBUS_REG_ADDR(LED_PWM_REG1) -- * #define LED_PWM_REG2 0x21dc -- * #define P_LED_PWM_REG2 CBUS_REG_ADDR(LED_PWM_REG2) -- * #define LED_PWM_REG3 0x21dd -- * #define P_LED_PWM_REG3 CBUS_REG_ADDR(LED_PWM_REG3) -- * #define LED_PWM_REG4 0x21de -- * #define P_LED_PWM_REG4 CBUS_REG_ADDR(LED_PWM_REG4) -- * #define LED_PWM_REG5 0x21df -- * #define P_LED_PWM_REG5 CBUS_REG_ADDR(LED_PWM_REG5) -- * #define LED_PWM_REG6 0x21e0 -- * #define P_LED_PWM_REG6 CBUS_REG_ADDR(LED_PWM_REG6) -- */ --#define VGHL_PWM_REG0 0x21e1 --#define P_VGHL_PWM_REG0 CBUS_REG_ADDR(VGHL_PWM_REG0) --#define VGHL_PWM_REG1 0x21e2 --#define P_VGHL_PWM_REG1 CBUS_REG_ADDR(VGHL_PWM_REG1) --#define VGHL_PWM_REG2 0x21e3 --#define P_VGHL_PWM_REG2 CBUS_REG_ADDR(VGHL_PWM_REG2) --#define VGHL_PWM_REG3 0x21e4 --#define P_VGHL_PWM_REG3 CBUS_REG_ADDR(VGHL_PWM_REG3) --#define VGHL_PWM_REG4 0x21e5 --#define P_VGHL_PWM_REG4 CBUS_REG_ADDR(VGHL_PWM_REG4) --#define VGHL_PWM_REG5 0x21e6 --#define P_VGHL_PWM_REG5 CBUS_REG_ADDR(VGHL_PWM_REG5) --#define VGHL_PWM_REG6 0x21e7 --#define P_VGHL_PWM_REG6 CBUS_REG_ADDR(VGHL_PWM_REG6) --#define I2C_M_1_CONTROL_REG 0x21f0 --#define P_I2C_M_1_CONTROL_REG CBUS_REG_ADDR(I2C_M_1_CONTROL_REG) --#define I2C_M_1_SLAVE_ADDR 0x21f1 --#define P_I2C_M_1_SLAVE_ADDR CBUS_REG_ADDR(I2C_M_1_SLAVE_ADDR) --#define I2C_M_1_TOKEN_LIST0 0x21f2 --#define P_I2C_M_1_TOKEN_LIST0 CBUS_REG_ADDR(I2C_M_1_TOKEN_LIST0) --#define I2C_M_1_TOKEN_LIST1 0x21f3 --#define P_I2C_M_1_TOKEN_LIST1 CBUS_REG_ADDR(I2C_M_1_TOKEN_LIST1) --#define I2C_M_1_WDATA_REG0 0x21f4 --#define P_I2C_M_1_WDATA_REG0 CBUS_REG_ADDR(I2C_M_1_WDATA_REG0) --#define I2C_M_1_WDATA_REG1 0x21f5 --#define P_I2C_M_1_WDATA_REG1 CBUS_REG_ADDR(I2C_M_1_WDATA_REG1) --#define I2C_M_1_RDATA_REG0 0x21f6 --#define P_I2C_M_1_RDATA_REG0 CBUS_REG_ADDR(I2C_M_1_RDATA_REG0) --#define I2C_M_1_RDATA_REG1 0x21f7 --#define P_I2C_M_1_RDATA_REG1 CBUS_REG_ADDR(I2C_M_1_RDATA_REG1) --#define I2C_M_2_CONTROL_REG 0x21f8 --#define P_I2C_M_2_CONTROL_REG CBUS_REG_ADDR(I2C_M_2_CONTROL_REG) --#define I2C_M_2_SLAVE_ADDR 0x21f9 --#define P_I2C_M_2_SLAVE_ADDR CBUS_REG_ADDR(I2C_M_2_SLAVE_ADDR) --#define I2C_M_2_TOKEN_LIST0 0x21fa --#define P_I2C_M_2_TOKEN_LIST0 CBUS_REG_ADDR(I2C_M_2_TOKEN_LIST0) --#define I2C_M_2_TOKEN_LIST1 0x21fb --#define P_I2C_M_2_TOKEN_LIST1 CBUS_REG_ADDR(I2C_M_2_TOKEN_LIST1) --#define I2C_M_2_WDATA_REG0 0x21fc --#define P_I2C_M_2_WDATA_REG0 CBUS_REG_ADDR(I2C_M_2_WDATA_REG0) --#define I2C_M_2_WDATA_REG1 0x21fd --#define P_I2C_M_2_WDATA_REG1 CBUS_REG_ADDR(I2C_M_2_WDATA_REG1) --#define I2C_M_2_RDATA_REG0 0x21fe --#define P_I2C_M_2_RDATA_REG0 CBUS_REG_ADDR(I2C_M_2_RDATA_REG0) --#define I2C_M_2_RDATA_REG1 0x21ff --#define P_I2C_M_2_RDATA_REG1 CBUS_REG_ADDR(I2C_M_2_RDATA_REG1) --#define USB_ADDR0 0x2200 --#define P_USB_ADDR0 CBUS_REG_ADDR(USB_ADDR0) --#define USB_ADDR1 0x2201 --#define P_USB_ADDR1 CBUS_REG_ADDR(USB_ADDR1) --#define USB_ADDR2 0x2202 --#define P_USB_ADDR2 CBUS_REG_ADDR(USB_ADDR2) --#define USB_ADDR3 0x2203 --#define P_USB_ADDR3 CBUS_REG_ADDR(USB_ADDR3) --#define USB_ADDR4 0x2204 --#define P_USB_ADDR4 CBUS_REG_ADDR(USB_ADDR4) --#define USB_ADDR5 0x2205 --#define P_USB_ADDR5 CBUS_REG_ADDR(USB_ADDR5) --#define USB_ADDR6 0x2206 --#define P_USB_ADDR6 CBUS_REG_ADDR(USB_ADDR6) --#define USB_ADDR7 0x2207 --#define P_USB_ADDR7 CBUS_REG_ADDR(USB_ADDR7) --#define USB_ADDR8 0x2208 --#define P_USB_ADDR8 CBUS_REG_ADDR(USB_ADDR8) --#define USB_ADDR9 0x2209 --#define P_USB_ADDR9 CBUS_REG_ADDR(USB_ADDR9) --#define USB_ADDR10 0x220a --#define P_USB_ADDR10 CBUS_REG_ADDR(USB_ADDR10) --#define USB_ADDR11 0x220b --#define P_USB_ADDR11 CBUS_REG_ADDR(USB_ADDR11) --#define USB_ADDR12 0x220c --#define P_USB_ADDR12 CBUS_REG_ADDR(USB_ADDR12) --#define USB_ADDR13 0x220d --#define P_USB_ADDR13 CBUS_REG_ADDR(USB_ADDR13) --#define USB_ADDR14 0x220e --#define P_USB_ADDR14 CBUS_REG_ADDR(USB_ADDR14) --#define USB_ADDR15 0x220f --#define P_USB_ADDR15 CBUS_REG_ADDR(USB_ADDR15) --#define USB_ADDR16 0x2210 --#define P_USB_ADDR16 CBUS_REG_ADDR(USB_ADDR16) --#define USB_ADDR17 0x2211 --#define P_USB_ADDR17 CBUS_REG_ADDR(USB_ADDR17) --#define USB_ADDR18 0x2212 --#define P_USB_ADDR18 CBUS_REG_ADDR(USB_ADDR18) --#define USB_ADDR19 0x2213 --#define P_USB_ADDR19 CBUS_REG_ADDR(USB_ADDR19) --#define USB_ADDR20 0x2214 --#define P_USB_ADDR20 CBUS_REG_ADDR(USB_ADDR20) --#define USB_ADDR21 0x2215 --#define P_USB_ADDR21 CBUS_REG_ADDR(USB_ADDR21) --#define USB_ADDR22 0x2216 --#define P_USB_ADDR22 CBUS_REG_ADDR(USB_ADDR22) --#define USB_ADDR23 0x2217 --#define P_USB_ADDR23 CBUS_REG_ADDR(USB_ADDR23) --#define USB_ADDR24 0x2218 --#define P_USB_ADDR24 CBUS_REG_ADDR(USB_ADDR24) --#define USB_ADDR25 0x2219 --#define P_USB_ADDR25 CBUS_REG_ADDR(USB_ADDR25) --#define USB_ADDR26 0x221a --#define P_USB_ADDR26 CBUS_REG_ADDR(USB_ADDR26) --#define USB_ADDR27 0x221b --#define P_USB_ADDR27 CBUS_REG_ADDR(USB_ADDR27) --#define USB_ADDR28 0x221c --#define P_USB_ADDR28 CBUS_REG_ADDR(USB_ADDR28) --#define USB_ADDR29 0x221d --#define P_USB_ADDR29 CBUS_REG_ADDR(USB_ADDR29) --#define USB_ADDR30 0x221e --#define P_USB_ADDR30 CBUS_REG_ADDR(USB_ADDR30) --#define USB_ADDR31 0x221f --#define P_USB_ADDR31 CBUS_REG_ADDR(USB_ADDR31) --/*add from M8M2*/ --#define SANA_STREAM_CONTROL 0x2220 --#define P_SANA_STREAM_CONTROL CBUS_REG_ADDR(SANA_STREAM_CONTROL) --#define SANA_STREAM_START_ADDR 0x2221 --#define P_SANA_STREAM_START_ADDR \ -- CBUS_REG_ADDR(SANA_STREAM_START_ADDR) --#define SANA_STREAM_END_ADDR 0x2222 --#define P_SANA_STREAM_END_ADDR CBUS_REG_ADDR(SANA_STREAM_END_ADDR) --#define SANA_STREAM_WR_PTR 0x2223 --#define P_SANA_STREAM_WR_PTR CBUS_REG_ADDR(SANA_STREAM_WR_PTR) --#define SANA_STREAM_RD_PTR 0x2224 --#define P_SANA_STREAM_RD_PTR CBUS_REG_ADDR(SANA_STREAM_RD_PTR) --#define SANA_STREAM_LEVEL 0x2225 --#define P_SANA_STREAM_LEVEL CBUS_REG_ADDR(SANA_STREAM_LEVEL) --#define SANA_STREAM_FIFO_CTL 0x2226 --#define P_SANA_STREAM_FIFO_CTL CBUS_REG_ADDR(SANA_STREAM_FIFO_CTL) --#define SANA_SHIFT_CONTROL 0x2227 --#define P_SANA_SHIFT_CONTROL CBUS_REG_ADDR(SANA_SHIFT_CONTROL) --#define SANA_SHIFT_STARTCODE 0x2228 --#define P_SANA_SHIFT_STARTCODE CBUS_REG_ADDR(SANA_SHIFT_STARTCODE) --#define SANA_SHIFT_EMULATECODE 0x2229 --#define P_SANA_SHIFT_EMULATECODE \ -- CBUS_REG_ADDR(SANA_SHIFT_EMULATECODE) --#define SANA_SHIFT_STATUS 0x222a --#define P_SANA_SHIFT_STATUS CBUS_REG_ADDR(SANA_SHIFT_STATUS) --#define SANA_SHIFTED_DATA 0x222b --#define P_SANA_SHIFTED_DATA CBUS_REG_ADDR(SANA_SHIFTED_DATA) --#define SANA_SHIFT_BYTE_COUNT 0x222c --#define P_SANA_SHIFT_BYTE_COUNT \ -- CBUS_REG_ADDR(SANA_SHIFT_BYTE_COUNT) --#define SANA_SHIFT_COMMAND 0x222d --#define P_SANA_SHIFT_COMMAND CBUS_REG_ADDR(SANA_SHIFT_COMMAND) --#define SANA_ELEMENT_RESULT 0x222e --#define P_SANA_ELEMENT_RESULT CBUS_REG_ADDR(SANA_ELEMENT_RESULT) --#define ATOM_LOCK 0x222f --#define P_ATOM_LOCK CBUS_REG_ADDR(ATOM_LOCK) --/**/ --#define NDMA_CNTL_REG0 0x2270 --#define P_NDMA_CNTL_REG0 CBUS_REG_ADDR(NDMA_CNTL_REG0) --#define NDMA_TABLE_ADD_REG 0x2272 --#define P_NDMA_TABLE_ADD_REG CBUS_REG_ADDR(NDMA_TABLE_ADD_REG) --#define NDMA_TDES_KEY_LO 0x2273 --#define P_NDMA_TDES_KEY_LO CBUS_REG_ADDR(NDMA_TDES_KEY_LO) --#define NDMA_TDES_KEY_HI 0x2274 --#define P_NDMA_TDES_KEY_HI CBUS_REG_ADDR(NDMA_TDES_KEY_HI) --#define NDMA_TDES_CONTROL 0x2275 --#define P_NDMA_TDES_CONTROL CBUS_REG_ADDR(NDMA_TDES_CONTROL) --#define NDMA_RIJNDAEL_CONTROL 0x2276 --#define P_NDMA_RIJNDAEL_CONTROL \ -- CBUS_REG_ADDR(NDMA_RIJNDAEL_CONTROL) --#define NDMA_RIJNDAEL_RK_FIFO 0x2277 --#define P_NDMA_RIJNDAEL_RK_FIFO \ -- CBUS_REG_ADDR(NDMA_RIJNDAEL_RK_FIFO) --#define NDMA_CRC_OUT 0x2278 --#define P_NDMA_CRC_OUT CBUS_REG_ADDR(NDMA_CRC_OUT) --#define NDMA_THREAD_REG 0x2279 --#define P_NDMA_THREAD_REG CBUS_REG_ADDR(NDMA_THREAD_REG) --#define NDMA_THREAD_TABLE_START0 0x2280 --#define P_NDMA_THREAD_TABLE_START0 \ -- CBUS_REG_ADDR(NDMA_THREAD_TABLE_START0) --#define NDMA_THREAD_TABLE_CURR0 0x2281 -- --#define NDMA_CNTL_REG1 0x228c --#define P_NDMA_CNTL_REG1 CBUS_REG_ADDR(NDMA_CNTL_REG1) --#define NDMA_AES_KEY_0 0x2290 --#define P_NDMA_AES_KEY_0 CBUS_REG_ADDR(NDMA_AES_KEY_0) --#define NDMA_AES_KEY_1 0x2291 --#define P_NDMA_AES_KEY_1 CBUS_REG_ADDR(NDMA_AES_KEY_1) --#define NDMA_AES_KEY_2 0x2292 --#define P_NDMA_AES_KEY_2 CBUS_REG_ADDR(NDMA_AES_KEY_2) --#define NDMA_AES_KEY_3 0x2293 --#define P_NDMA_AES_KEY_3 CBUS_REG_ADDR(NDMA_AES_KEY_3) --#define NDMA_AES_KEY_4 0x2294 --#define P_NDMA_AES_KEY_4 CBUS_REG_ADDR(NDMA_AES_KEY_4) --#define NDMA_AES_KEY_5 0x2295 --#define P_NDMA_AES_KEY_5 CBUS_REG_ADDR(NDMA_AES_KEY_5) --#define NDMA_AES_KEY_6 0x2296 --#define P_NDMA_AES_KEY_6 CBUS_REG_ADDR(NDMA_AES_KEY_6) --#define NDMA_AES_KEY_7 0x2297 --#define P_NDMA_AES_KEY_7 CBUS_REG_ADDR(NDMA_AES_KEY_7) --#define NDMA_AES_IV_0 0x2298 --#define P_NDMA_AES_IV_0 CBUS_REG_ADDR(NDMA_AES_IV_0) --#define NDMA_AES_IV_1 0x2299 --#define P_NDMA_AES_IV_1 CBUS_REG_ADDR(NDMA_AES_IV_1) --#define NDMA_AES_IV_2 0x229a --#define P_NDMA_AES_IV_2 CBUS_REG_ADDR(NDMA_AES_IV_2) --#define NDMA_AES_IV_3 0x229b --#define P_NDMA_AES_IV_3 CBUS_REG_ADDR(NDMA_AES_IV_3) --#define NDMA_AES_REG0 0x229c --#define P_NDMA_AES_REG0 CBUS_REG_ADDR(NDMA_AES_REG0) --#define STREAM_EVENT_INFO 0x2300 --#define P_STREAM_EVENT_INFO CBUS_REG_ADDR(STREAM_EVENT_INFO) --#define STREAM_OUTPUT_CONFIG 0x2301 --#define P_STREAM_OUTPUT_CONFIG CBUS_REG_ADDR(STREAM_OUTPUT_CONFIG) --#define C_D_BUS_CONTROL 0x2302 --#define P_C_D_BUS_CONTROL CBUS_REG_ADDR(C_D_BUS_CONTROL) --#define C_DATA 0x2303 --#define P_C_DATA CBUS_REG_ADDR(C_DATA) --#define STREAM_BUS_CONFIG 0x2304 --#define P_STREAM_BUS_CONFIG CBUS_REG_ADDR(STREAM_BUS_CONFIG) --#define STREAM_EVENT_CTL 0x2307 --#define P_STREAM_EVENT_CTL CBUS_REG_ADDR(STREAM_EVENT_CTL) --#define CMD_ARGUMENT 0x2308 --#define P_CMD_ARGUMENT CBUS_REG_ADDR(CMD_ARGUMENT) --#define CMD_SEND 0x2309 --#define P_CMD_SEND CBUS_REG_ADDR(CMD_SEND) --#define SDIO_CONFIG 0x230a --#define P_SDIO_CONFIG CBUS_REG_ADDR(SDIO_CONFIG) --#define SDIO_STATUS_IRQ 0x230b --#define P_SDIO_STATUS_IRQ CBUS_REG_ADDR(SDIO_STATUS_IRQ) --#define SDIO_IRQ_CONFIG 0x230c --#define P_SDIO_IRQ_CONFIG CBUS_REG_ADDR(SDIO_IRQ_CONFIG) --#define SDIO_MULT_CONFIG 0x230d --#define P_SDIO_MULT_CONFIG CBUS_REG_ADDR(SDIO_MULT_CONFIG) --#define SDIO_M_ADDR 0x230e --#define P_SDIO_M_ADDR CBUS_REG_ADDR(SDIO_M_ADDR) --#define SDIO_EXTENSION 0x230f --#define P_SDIO_EXTENSION CBUS_REG_ADDR(SDIO_EXTENSION) --#define ASYNC_FIFO_REG0 0x2310 --#define P_ASYNC_FIFO_REG0 CBUS_REG_ADDR(ASYNC_FIFO_REG0) --#define ASYNC_FIFO_REG1 0x2311 --#define P_ASYNC_FIFO_REG1 CBUS_REG_ADDR(ASYNC_FIFO_REG1) --#define ASYNC_FIFO_REG2 0x2312 --#define P_ASYNC_FIFO_REG2 CBUS_REG_ADDR(ASYNC_FIFO_REG2) --#define ASYNC_FIFO_REG3 0x2313 --#define P_ASYNC_FIFO_REG3 CBUS_REG_ADDR(ASYNC_FIFO_REG3) --#define ASYNC_FIFO2_REG0 0x2314 --#define P_ASYNC_FIFO2_REG0 CBUS_REG_ADDR(ASYNC_FIFO2_REG0) --#define ASYNC_FIFO2_REG1 0x2315 --#define P_ASYNC_FIFO2_REG1 CBUS_REG_ADDR(ASYNC_FIFO2_REG1) --#define ASYNC_FIFO2_REG2 0x2316 --#define P_ASYNC_FIFO2_REG2 CBUS_REG_ADDR(ASYNC_FIFO2_REG2) --#define ASYNC_FIFO2_REG3 0x2317 --#define P_ASYNC_FIFO2_REG3 CBUS_REG_ADDR(ASYNC_FIFO2_REG3) --#define SDIO_AHB_CBUS_CTRL 0x2318 --#define P_SDIO_AHB_CBUS_CTRL CBUS_REG_ADDR(SDIO_AHB_CBUS_CTRL) --#define SDIO_AHB_CBUS_M_DATA 0x2319 --#define P_SDIO_AHB_CBUS_M_DATA CBUS_REG_ADDR(SDIO_AHB_CBUS_M_DATA) --#define SPI_FLASH_CMD 0x2320 --#define P_SPI_FLASH_CMD CBUS_REG_ADDR(SPI_FLASH_CMD) --#define SPI_FLASH_ADDR 0x2321 --#define P_SPI_FLASH_ADDR CBUS_REG_ADDR(SPI_FLASH_ADDR) --#define SPI_FLASH_CTRL 0x2322 --#define P_SPI_FLASH_CTRL CBUS_REG_ADDR(SPI_FLASH_CTRL) --#define SPI_FLASH_CTRL1 0x2323 --#define P_SPI_FLASH_CTRL1 CBUS_REG_ADDR(SPI_FLASH_CTRL1) --#define SPI_FLASH_STATUS 0x2324 --#define P_SPI_FLASH_STATUS CBUS_REG_ADDR(SPI_FLASH_STATUS) --#define SPI_FLASH_CTRL2 0x2325 --#define P_SPI_FLASH_CTRL2 CBUS_REG_ADDR(SPI_FLASH_CTRL2) --#define SPI_FLASH_CLOCK 0x2326 --#define P_SPI_FLASH_CLOCK CBUS_REG_ADDR(SPI_FLASH_CLOCK) --#define SPI_FLASH_USER 0x2327 --#define P_SPI_FLASH_USER CBUS_REG_ADDR(SPI_FLASH_USER) --#define SPI_FLASH_USER1 0x2328 --#define P_SPI_FLASH_USER1 CBUS_REG_ADDR(SPI_FLASH_USER1) --#define SPI_FLASH_USER2 0x2329 --#define P_SPI_FLASH_USER2 CBUS_REG_ADDR(SPI_FLASH_USER2) --#define SPI_FLASH_USER3 0x232a --#define P_SPI_FLASH_USER3 CBUS_REG_ADDR(SPI_FLASH_USER3) --#define SPI_FLASH_USER4 0x232b --#define P_SPI_FLASH_USER4 CBUS_REG_ADDR(SPI_FLASH_USER4) --#define SPI_FLASH_SLAVE 0x232c --#define P_SPI_FLASH_SLAVE CBUS_REG_ADDR(SPI_FLASH_SLAVE) --#define SPI_FLASH_SLAVE1 0x232d --#define P_SPI_FLASH_SLAVE1 CBUS_REG_ADDR(SPI_FLASH_SLAVE1) --#define SPI_FLASH_SLAVE2 0x232e --#define P_SPI_FLASH_SLAVE2 CBUS_REG_ADDR(SPI_FLASH_SLAVE2) --#define SPI_FLASH_SLAVE3 0x232f --#define P_SPI_FLASH_SLAVE3 CBUS_REG_ADDR(SPI_FLASH_SLAVE3) --#define SPI_FLASH_C0 0x2330 --#define P_SPI_FLASH_C0 CBUS_REG_ADDR(SPI_FLASH_C0) --#define SPI_FLASH_C1 0x2331 --#define P_SPI_FLASH_C1 CBUS_REG_ADDR(SPI_FLASH_C1) --#define SPI_FLASH_C2 0x2332 --#define P_SPI_FLASH_C2 CBUS_REG_ADDR(SPI_FLASH_C2) --#define SPI_FLASH_C3 0x2333 --#define P_SPI_FLASH_C3 CBUS_REG_ADDR(SPI_FLASH_C3) --#define SPI_FLASH_C4 0x2334 --#define P_SPI_FLASH_C4 CBUS_REG_ADDR(SPI_FLASH_C4) --#define SPI_FLASH_C5 0x2335 --#define P_SPI_FLASH_C5 CBUS_REG_ADDR(SPI_FLASH_C5) --#define SPI_FLASH_C6 0x2336 --#define P_SPI_FLASH_C6 CBUS_REG_ADDR(SPI_FLASH_C6) --#define SPI_FLASH_C7 0x2337 --#define P_SPI_FLASH_C7 CBUS_REG_ADDR(SPI_FLASH_C7) --#define SPI_FLASH_B8 0x2338 --#define P_SPI_FLASH_B8 CBUS_REG_ADDR(SPI_FLASH_B8) --#define SPI_FLASH_B9 0x2339 --#define P_SPI_FLASH_B9 CBUS_REG_ADDR(SPI_FLASH_B9) --#define SPI_FLASH_B10 0x233a --#define P_SPI_FLASH_B10 CBUS_REG_ADDR(SPI_FLASH_B10) --#define SPI_FLASH_B11 0x233b --#define P_SPI_FLASH_B11 CBUS_REG_ADDR(SPI_FLASH_B11) --#define SPI_FLASH_B12 0x233c --#define P_SPI_FLASH_B12 CBUS_REG_ADDR(SPI_FLASH_B12) --#define SPI_FLASH_B13 0x233d --#define P_SPI_FLASH_B13 CBUS_REG_ADDR(SPI_FLASH_B13) --#define SPI_FLASH_B14 0x233e --#define P_SPI_FLASH_B14 CBUS_REG_ADDR(SPI_FLASH_B14) --#define SPI_FLASH_B15 0x233f --#define P_SPI_FLASH_B15 CBUS_REG_ADDR(SPI_FLASH_B15) --#define I2C_M_3_CONTROL_REG 0x2348 --#define P_I2C_M_3_CONTROL_REG CBUS_REG_ADDR(I2C_M_3_CONTROL_REG) --#define I2C_M_3_SLAVE_ADDR 0x2349 --#define P_I2C_M_3_SLAVE_ADDR CBUS_REG_ADDR(I2C_M_3_SLAVE_ADDR) --#define I2C_M_3_TOKEN_LIST0 0x234a --#define P_I2C_M_3_TOKEN_LIST0 CBUS_REG_ADDR(I2C_M_3_TOKEN_LIST0) --#define I2C_M_3_TOKEN_LIST1 0x234b --#define P_I2C_M_3_TOKEN_LIST1 CBUS_REG_ADDR(I2C_M_3_TOKEN_LIST1) --#define I2C_M_3_WDATA_REG0 0x234c --#define P_I2C_M_3_WDATA_REG0 CBUS_REG_ADDR(I2C_M_3_WDATA_REG0) --#define I2C_M_3_WDATA_REG1 0x234d --#define P_I2C_M_3_WDATA_REG1 CBUS_REG_ADDR(I2C_M_3_WDATA_REG1) --#define I2C_M_3_RDATA_REG0 0x234e --#define P_I2C_M_3_RDATA_REG0 CBUS_REG_ADDR(I2C_M_3_RDATA_REG0) --#define I2C_M_3_RDATA_REG1 0x234f --#define P_I2C_M_3_RDATA_REG1 CBUS_REG_ADDR(I2C_M_3_RDATA_REG1) --#define SPICC_RXDATA 0x2360 --#define P_SPICC_RXDATA CBUS_REG_ADDR(SPICC_RXDATA) --#define SPICC_TXDATA 0x2361 --#define P_SPICC_TXDATA CBUS_REG_ADDR(SPICC_TXDATA) --#define SPICC_CONREG 0x2362 --#define P_SPICC_CONREG CBUS_REG_ADDR(SPICC_CONREG) --#define SPICC_INTREG 0x2363 --#define P_SPICC_INTREG CBUS_REG_ADDR(SPICC_INTREG) --#define SPICC_DMAREG 0x2364 --#define P_SPICC_DMAREG CBUS_REG_ADDR(SPICC_DMAREG) --#define SPICC_STATREG 0x2365 --#define P_SPICC_STATREG CBUS_REG_ADDR(SPICC_STATREG) --#define SPICC_PERIODREG 0x2366 --#define P_SPICC_PERIODREG CBUS_REG_ADDR(SPICC_PERIODREG) --#define SPICC_TESTREG 0x2367 --#define P_SPICC_TESTREG CBUS_REG_ADDR(SPICC_TESTREG) --#define SPICC_DRADDR 0x2368 --#define P_SPICC_DRADDR CBUS_REG_ADDR(SPICC_DRADDR) --#define SPICC_DWADDR 0x2369 --#define P_SPICC_DWADDR CBUS_REG_ADDR(SPICC_DWADDR) --#define SD_REG0_ARGU 0x2380 --#define P_SD_REG0_ARGU CBUS_REG_ADDR(SD_REG0_ARGU) --#define SD_REG1_SEND 0x2381 --#define P_SD_REG1_SEND CBUS_REG_ADDR(SD_REG1_SEND) --#define SD_REG2_CNTL 0x2382 --#define P_SD_REG2_CNTL CBUS_REG_ADDR(SD_REG2_CNTL) --#define SD_REG3_STAT 0x2383 --#define P_SD_REG3_STAT CBUS_REG_ADDR(SD_REG3_STAT) --#define SD_REG4_CLKC 0x2384 --#define P_SD_REG4_CLKC CBUS_REG_ADDR(SD_REG4_CLKC) --#define SD_REG5_ADDR 0x2385 --#define P_SD_REG5_ADDR CBUS_REG_ADDR(SD_REG5_ADDR) --#define SD_REG6_PDMA 0x2386 --#define P_SD_REG6_PDMA CBUS_REG_ADDR(SD_REG6_PDMA) --#define SD_REG7_MISC 0x2387 --#define P_SD_REG7_MISC CBUS_REG_ADDR(SD_REG7_MISC) --#define SD_REG8_DATA 0x2388 --#define P_SD_REG8_DATA CBUS_REG_ADDR(SD_REG8_DATA) --#define SD_REG9_ICTL 0x2389 --#define P_SD_REG9_ICTL CBUS_REG_ADDR(SD_REG9_ICTL) --#define SD_REGA_ISTA 0x238a --#define P_SD_REGA_ISTA CBUS_REG_ADDR(SD_REGA_ISTA) --#define SD_REGB_SRST 0x238b --#define P_SD_REGB_SRST CBUS_REG_ADDR(SD_REGB_SRST) --#define SD_REGC_ESTA 0x238c --#define P_SD_REGC_ESTA CBUS_REG_ADDR(SD_REGC_ESTA) --#define SD_REGD_ENHC 0x238d --#define P_SD_REGD_ENHC CBUS_REG_ADDR(SD_REGD_ENHC) --#define SD_REGE_CLK2 0x238e --#define P_SD_REGE_CLK2 CBUS_REG_ADDR(SD_REGE_CLK2) --#define ISA_DEBUG_REG0 0x2600 --#define P_ISA_DEBUG_REG0 CBUS_REG_ADDR(ISA_DEBUG_REG0) --#define ISA_DEBUG_REG1 0x2601 --#define P_ISA_DEBUG_REG1 CBUS_REG_ADDR(ISA_DEBUG_REG1) --#define ISA_DEBUG_REG2 0x2602 --#define P_ISA_DEBUG_REG2 CBUS_REG_ADDR(ISA_DEBUG_REG2) --#define ISA_DEBUG_REG3 0x2603 --#define P_ISA_DEBUG_REG3 CBUS_REG_ADDR(ISA_DEBUG_REG3) --#define ISA_PLL_CLK_SIM0 0x2608 --#define P_ISA_PLL_CLK_SIM0 CBUS_REG_ADDR(ISA_PLL_CLK_SIM0) --#define ISA_CNTL_REG0 0x2609 --#define P_ISA_CNTL_REG0 CBUS_REG_ADDR(ISA_CNTL_REG0) --#define AO_CPU_IRQ_IN0_INTR_STAT 0x2610 --#define P_AO_CPU_IRQ_IN0_INTR_STAT \ -- CBUS_REG_ADDR(AO_CPU_IRQ_IN0_INTR_STAT) --#define AO_CPU_IRQ_IN0_INTR_STAT_CLR 0x2611 --#define P_AO_CPU_IRQ_IN0_INTR_STAT_CLR \ -- CBUS_REG_ADDR(AO_CPU_IRQ_IN0_INTR_STAT_CLR) --#define AO_CPU_IRQ_IN0_INTR_MASK 0x2612 --#define P_AO_CPU_IRQ_IN0_INTR_MASK \ -- CBUS_REG_ADDR(AO_CPU_IRQ_IN0_INTR_MASK) --#define AO_CPU_IRQ_IN0_INTR_FIRQ_SEL 0x2613 --#define P_AO_CPU_IRQ_IN0_INTR_FIRQ_SEL \ -- CBUS_REG_ADDR(AO_CPU_IRQ_IN0_INTR_FIRQ_SEL) --#define GPIO_INTR_EDGE_POL 0x2620 --#define P_GPIO_INTR_EDGE_POL CBUS_REG_ADDR(GPIO_INTR_EDGE_POL) --#define GPIO_INTR_GPIO_SEL0 0x2621 --#define P_GPIO_INTR_GPIO_SEL0 CBUS_REG_ADDR(GPIO_INTR_GPIO_SEL0) --#define GPIO_INTR_GPIO_SEL1 0x2622 --#define P_GPIO_INTR_GPIO_SEL1 CBUS_REG_ADDR(GPIO_INTR_GPIO_SEL1) --#define GPIO_INTR_FILTER_SEL0 0x2623 --#define P_GPIO_INTR_FILTER_SEL0 \ -- CBUS_REG_ADDR(GPIO_INTR_FILTER_SEL0) --#define MEDIA_CPU_INTR_STAT 0x2628 --#define P_MEDIA_CPU_INTR_STAT CBUS_REG_ADDR(MEDIA_CPU_INTR_STAT) --#define ISA_BIST_REG1 0x2631 --#define P_ISA_BIST_REG1 CBUS_REG_ADDR(ISA_BIST_REG1) --#define WATCHDOG_TC 0x2640 --#define P_WATCHDOG_TC CBUS_REG_ADDR(WATCHDOG_TC) --#define WATCHDOG_RESET 0x2641 --#define P_WATCHDOG_RESET CBUS_REG_ADDR(WATCHDOG_RESET) --#define AHB_ARBITER_REG 0x2642 --#define P_AHB_ARBITER_REG CBUS_REG_ADDR(AHB_ARBITER_REG) --#define AHB_ARBDEC_REG 0x2643 --#define P_AHB_ARBDEC_REG CBUS_REG_ADDR(AHB_ARBDEC_REG) --#define AHB_ARBITER2_REG 0x264a --#define P_AHB_ARBITER2_REG CBUS_REG_ADDR(AHB_ARBITER2_REG) --#define DEVICE_MMCP_CNTL 0x264b --#define P_DEVICE_MMCP_CNTL CBUS_REG_ADDR(DEVICE_MMCP_CNTL) --#define AUDIO_MMCP_CNTL 0x264c --#define P_AUDIO_MMCP_CNTL CBUS_REG_ADDR(AUDIO_MMCP_CNTL) --#define ISA_TIMER_MUX 0x2650 --#define P_ISA_TIMER_MUX CBUS_REG_ADDR(ISA_TIMER_MUX) --#define ISA_TIMERA 0x2651 --#define P_ISA_TIMERA CBUS_REG_ADDR(ISA_TIMERA) --#define ISA_TIMERB 0x2652 --#define P_ISA_TIMERB CBUS_REG_ADDR(ISA_TIMERB) --#define ISA_TIMERC 0x2653 --#define P_ISA_TIMERC CBUS_REG_ADDR(ISA_TIMERC) --#define ISA_TIMERD 0x2654 --#define P_ISA_TIMERD CBUS_REG_ADDR(ISA_TIMERD) --#define ISA_TIMERE 0x2655 --#define P_ISA_TIMERE CBUS_REG_ADDR(ISA_TIMERE) --#define FBUF_ADDR 0x2656 --#define P_FBUF_ADDR CBUS_REG_ADDR(FBUF_ADDR) --#define SDRAM_CTL0 0x2657 --#define P_SDRAM_CTL0 CBUS_REG_ADDR(SDRAM_CTL0) --#define SDRAM_CTL2 0x2658 --#define P_SDRAM_CTL2 CBUS_REG_ADDR(SDRAM_CTL2) --#define SDRAM_CTL4 0x265a --#define P_SDRAM_CTL4 CBUS_REG_ADDR(SDRAM_CTL4) --#define SDRAM_CTL5 0x265b --#define P_SDRAM_CTL5 CBUS_REG_ADDR(SDRAM_CTL5) --#define SDRAM_CTL6 0x265c --#define P_SDRAM_CTL6 CBUS_REG_ADDR(SDRAM_CTL6) --#define SDRAM_CTL7 0x265d --#define P_SDRAM_CTL7 CBUS_REG_ADDR(SDRAM_CTL7) --#define SDRAM_CTL8 0x265e --#define P_SDRAM_CTL8 CBUS_REG_ADDR(SDRAM_CTL8) --#define AHB_MP4_MC_CTL 0x265f --#define P_AHB_MP4_MC_CTL CBUS_REG_ADDR(AHB_MP4_MC_CTL) --#define MEDIA_CPU_PCR 0x2660 --#define P_MEDIA_CPU_PCR CBUS_REG_ADDR(MEDIA_CPU_PCR) --#define MEDIA_CPU_CTL 0x2661 --#define P_MEDIA_CPU_CTL CBUS_REG_ADDR(MEDIA_CPU_CTL) --#define ISA_TIMER_MUX1 0x2664 --#define P_ISA_TIMER_MUX1 CBUS_REG_ADDR(ISA_TIMER_MUX1) --#define ISA_TIMERF 0x2665 --#define P_ISA_TIMERF CBUS_REG_ADDR(ISA_TIMERF) --#define ISA_TIMERG 0x2666 --#define P_ISA_TIMERG CBUS_REG_ADDR(ISA_TIMERG) --#define ISA_TIMERH 0x2667 --#define P_ISA_TIMERH CBUS_REG_ADDR(ISA_TIMERH) --#define ISA_TIMERI 0x2668 --#define P_ISA_TIMERI CBUS_REG_ADDR(ISA_TIMERI) --#define ABUF_WR_CTL0 0x2670 --#define P_ABUF_WR_CTL0 CBUS_REG_ADDR(ABUF_WR_CTL0) --#define ABUF_WR_CTL1 0x2671 --#define P_ABUF_WR_CTL1 CBUS_REG_ADDR(ABUF_WR_CTL1) --#define ABUF_WR_CTL2 0x2672 --#define P_ABUF_WR_CTL2 CBUS_REG_ADDR(ABUF_WR_CTL2) --#define ABUF_WR_CTL3 0x2673 --#define P_ABUF_WR_CTL3 CBUS_REG_ADDR(ABUF_WR_CTL3) --#define ABUF_RD_CTL0 0x2674 --#define P_ABUF_RD_CTL0 CBUS_REG_ADDR(ABUF_RD_CTL0) --#define ABUF_RD_CTL1 0x2675 --#define P_ABUF_RD_CTL1 CBUS_REG_ADDR(ABUF_RD_CTL1) --#define ABUF_RD_CTL2 0x2676 --#define P_ABUF_RD_CTL2 CBUS_REG_ADDR(ABUF_RD_CTL2) --#define ABUF_RD_CTL3 0x2677 --#define P_ABUF_RD_CTL3 CBUS_REG_ADDR(ABUF_RD_CTL3) --#define ABUF_ARB_CTL0 0x2678 --#define P_ABUF_ARB_CTL0 CBUS_REG_ADDR(ABUF_ARB_CTL0) --#define ABUF_FIFO_CTL0 0x2679 --#define P_ABUF_FIFO_CTL0 CBUS_REG_ADDR(ABUF_FIFO_CTL0) --#define AHB_BRIDGE_CNTL_WR 0x2680 --#define P_AHB_BRIDGE_CNTL_WR CBUS_REG_ADDR(AHB_BRIDGE_CNTL_WR) --#define AHB_BRIDGE_REMAP0 0x2681 --#define P_AHB_BRIDGE_REMAP0 CBUS_REG_ADDR(AHB_BRIDGE_REMAP0) --#define AHB_BRIDGE_REMAP1 0x2682 --#define P_AHB_BRIDGE_REMAP1 CBUS_REG_ADDR(AHB_BRIDGE_REMAP1) --#define AHB_BRIDGE_REMAP2 0x2683 --#define P_AHB_BRIDGE_REMAP2 CBUS_REG_ADDR(AHB_BRIDGE_REMAP2) --#define AHB_BRIDGE_REMAP3 0x2684 --#define P_AHB_BRIDGE_REMAP3 CBUS_REG_ADDR(AHB_BRIDGE_REMAP3) --#define AHB_BRIDGE_CNTL_REG1 0x2685 --#define P_AHB_BRIDGE_CNTL_REG1 CBUS_REG_ADDR(AHB_BRIDGE_CNTL_REG1) --#define AHB_BRIDGE_CNTL_REG2 0x2686 --#define P_AHB_BRIDGE_CNTL_REG2 CBUS_REG_ADDR(AHB_BRIDGE_CNTL_REG2) --#define IQ_OM_WIDTH 0x2510 --#define P_IQ_OM_WIDTH CBUS_REG_ADDR(IQ_OM_WIDTH) --#define DBG_ADDR_START 0x2ff0 --#define P_DBG_ADDR_START CBUS_REG_ADDR(DBG_ADDR_START) --#define DBG_ADDR_END 0x2fff --#define P_DBG_ADDR_END CBUS_REG_ADDR(DBG_ADDR_END) --#define DBG_CTRL 0x2ff1 --#define P_DBG_CTRL CBUS_REG_ADDR(DBG_CTRL) --#define DBG_LED 0x2ff2 --#define P_DBG_LED CBUS_REG_ADDR(DBG_LED) --#define DBG_SWITCH 0x2ff3 --#define P_DBG_SWITCH CBUS_REG_ADDR(DBG_SWITCH) --#define DBG_VERSION 0x2ff4 --#define P_DBG_VERSION CBUS_REG_ADDR(DBG_VERSION) --#define VERSION_CTRL 0x1100 --#define P_VERSION_CTRL CBUS_REG_ADDR(VERSION_CTRL) --#define RESET0_REGISTER 0x1101 --#define P_RESET0_REGISTER CBUS_REG_ADDR(RESET0_REGISTER) --#define RESET1_REGISTER 0x1102 --#define P_RESET1_REGISTER CBUS_REG_ADDR(RESET1_REGISTER) --#define RESET2_REGISTER 0x1103 --#define P_RESET2_REGISTER CBUS_REG_ADDR(RESET2_REGISTER) --#define RESET3_REGISTER 0x1104 --#define P_RESET3_REGISTER CBUS_REG_ADDR(RESET3_REGISTER) --#define RESET4_REGISTER 0x1105 --#define P_RESET4_REGISTER CBUS_REG_ADDR(RESET4_REGISTER) --#define RESET5_REGISTER 0x1106 --#define P_RESET5_REGISTER CBUS_REG_ADDR(RESET5_REGISTER) --#define RESET6_REGISTER 0x1107 --#define P_RESET6_REGISTER CBUS_REG_ADDR(RESET6_REGISTER) --#define RESET7_REGISTER 0x1108 --#define P_RESET7_REGISTER CBUS_REG_ADDR(RESET7_REGISTER) --#define RESET0_MASK 0x1110 --#define P_RESET0_MASK CBUS_REG_ADDR(RESET0_MASK) --#define RESET1_MASK 0x1111 --#define P_RESET1_MASK CBUS_REG_ADDR(RESET1_MASK) --#define RESET2_MASK 0x1112 --#define P_RESET2_MASK CBUS_REG_ADDR(RESET2_MASK) --#define RESET3_MASK 0x1113 --#define P_RESET3_MASK CBUS_REG_ADDR(RESET3_MASK) --#define RESET4_MASK 0x1114 --#define P_RESET4_MASK CBUS_REG_ADDR(RESET4_MASK) --#define RESET5_MASK 0x1115 --#define P_RESET5_MASK CBUS_REG_ADDR(RESET5_MASK) --#define RESET6_MASK 0x1116 --#define P_RESET6_MASK CBUS_REG_ADDR(RESET6_MASK) --#define CRT_MASK 0x1117 --#define P_CRT_MASK CBUS_REG_ADDR(CRT_MASK) --#define RESET7_MASK 0x1118 --#define P_RESET7_MASK CBUS_REG_ADDR(RESET7_MASK) --/*add from M8M2*/ --#define RESET0_LEVEL 0xc1104480 --#define RESET1_LEVEL 0x1121 --#define P_RESET1_LEVEL CBUS_REG_ADDR(RESET1_LEVEL) --#define RESET2_LEVEL 0x1122 --#define P_RESET2_LEVEL CBUS_REG_ADDR(RESET2_LEVEL) --#define RESET3_LEVEL 0x1123 --#define P_RESET3_LEVEL CBUS_REG_ADDR(RESET3_LEVEL) --#define RESET4_LEVEL 0x1124 --#define P_RESET4_LEVEL CBUS_REG_ADDR(RESET4_LEVEL) --#define RESET5_LEVEL 0x1125 --#define P_RESET5_LEVEL CBUS_REG_ADDR(RESET5_LEVEL) --#define RESET6_LEVEL 0x1126 --#define P_RESET6_LEVEL CBUS_REG_ADDR(RESET6_LEVEL) --#define RESET7_LEVEL 0x1127 --#define P_RESET7_LEVEL CBUS_REG_ADDR(RESET7_LEVEL) --/**/ --#define SCR_HIU 0x100b --#define P_SCR_HIU CBUS_REG_ADDR(SCR_HIU) --#define HPG_TIMER 0x100f --#define P_HPG_TIMER CBUS_REG_ADDR(HPG_TIMER) --/*add from M8M2*/ --#define HHI_GP_PLL_CNTL 0x1010 --#define P_HHI_GP_PLL_CNTL CBUS_REG_ADDR(HHI_GP_PLL_CNTL) --#define HHI_GP_PLL_CNTL2 0x1011 --#define P_HHI_GP_PLL_CNTL2 CBUS_REG_ADDR(HHI_GP_PLL_CNTL2) --#define HHI_GP_PLL_CNTL3 0x1012 --#define P_HHI_GP_PLL_CNTL3 CBUS_REG_ADDR(HHI_GP_PLL_CNTL3) --#define HHI_GP_PLL_CNTL4 0x1013 --#define P_HHI_GP_PLL_CNTL4 CBUS_REG_ADDR(HHI_GP_PLL_CNTL4) --#define HHI_GP_PLL_CNTL5 0x1014 --#define P_HHI_GP_PLL_CNTL5 CBUS_REG_ADDR(HHI_GP_PLL_CNTL5) --/**/ -- --#define HHI_DADC_CNTL 0x1027 --#define P_HHI_DADC_CNTL CBUS_REG_ADDR(HHI_DADC_CNTL) --#define HHI_DADC_CNTL2 0x1028 --#define P_HHI_DADC_CNTL2 CBUS_REG_ADDR(HHI_DADC_CNTL2) --#define HHI_DADC_RDBK0_I 0x1029 --#define P_HHI_DADC_RDBK0_I CBUS_REG_ADDR(HHI_DADC_RDBK0_I) --#define HHI_DADC_CNTL3 0x102a --#define P_HHI_DADC_CNTL3 CBUS_REG_ADDR(HHI_DADC_CNTL3) --#define HHI_DADC_CNTL4 0x102b --#define P_HHI_DADC_CNTL4 CBUS_REG_ADDR(HHI_DADC_CNTL4) -- -- --#define HARM_ASB_MB0 0x1030 --#define P_HARM_ASB_MB0 CBUS_REG_ADDR(HARM_ASB_MB0) --#define HARM_ASB_MB1 0x1031 --#define P_HARM_ASB_MB1 CBUS_REG_ADDR(HARM_ASB_MB1) --#define HARM_ASB_MB2 0x1032 --#define P_HARM_ASB_MB2 CBUS_REG_ADDR(HARM_ASB_MB2) --#define HARM_ASB_MB3 0x1033 --#define P_HARM_ASB_MB3 CBUS_REG_ADDR(HARM_ASB_MB3) --#define HASB_ARM_MB0 0x1034 --#define P_HASB_ARM_MB0 CBUS_REG_ADDR(HASB_ARM_MB0) --#define HASB_ARM_MB1 0x1035 --#define P_HASB_ARM_MB1 CBUS_REG_ADDR(HASB_ARM_MB1) --#define HASB_ARM_MB2 0x1036 --#define P_HASB_ARM_MB2 CBUS_REG_ADDR(HASB_ARM_MB2) --#define HASB_ARM_MB3 0x1037 --#define P_HASB_ARM_MB3 CBUS_REG_ADDR(HASB_ARM_MB3) --#define HHI_TIMER90K 0x103b --#define P_HHI_TIMER90K CBUS_REG_ADDR(HHI_TIMER90K) --#define HHI_MEM_PD_REG0 0x1040 --#define P_HHI_MEM_PD_REG0 CBUS_REG_ADDR(HHI_MEM_PD_REG0) --#define HHI_VPU_MEM_PD_REG0 0x1041 --#define P_HHI_VPU_MEM_PD_REG0 CBUS_REG_ADDR(HHI_VPU_MEM_PD_REG0) --#define HHI_VPU_MEM_PD_REG1 0x1042 --#define P_HHI_VPU_MEM_PD_REG1 CBUS_REG_ADDR(HHI_VPU_MEM_PD_REG1) --#define HHI_AUD_DAC_CTRL 0x1044 --#define P_HHI_AUD_DAC_CTRL CBUS_REG_ADDR(HHI_AUD_DAC_CTRL) --#define HHI_VIID_CLK_DIV 0x104a --#define P_HHI_VIID_CLK_DIV CBUS_REG_ADDR(HHI_VIID_CLK_DIV) --#define HHI_VIID_CLK_CNTL 0x104b --#define P_HHI_VIID_CLK_CNTL CBUS_REG_ADDR(HHI_VIID_CLK_CNTL) --#define HHI_VIID_DIVIDER_CNTL 0x104c --#define P_HHI_VIID_DIVIDER_CNTL \ -- CBUS_REG_ADDR(HHI_VIID_DIVIDER_CNTL) --#define HHI_GCLK_MPEG0 0x1050 --#define P_HHI_GCLK_MPEG0 CBUS_REG_ADDR(HHI_GCLK_MPEG0) --#define HHI_GCLK_MPEG1 0x1051 --#define P_HHI_GCLK_MPEG1 CBUS_REG_ADDR(HHI_GCLK_MPEG1) --#define HHI_GCLK_MPEG2 0x1052 --#define P_HHI_GCLK_MPEG2 CBUS_REG_ADDR(HHI_GCLK_MPEG2) --#define HHI_GCLK_OTHER 0x1054 --#define P_HHI_GCLK_OTHER CBUS_REG_ADDR(HHI_GCLK_OTHER) --#define HHI_GCLK_AO 0x1055 --#define P_HHI_GCLK_AO CBUS_REG_ADDR(HHI_GCLK_AO) --#define HHI_SYS_CPU_CLK_CNTL1 0x1057 --#define P_HHI_SYS_CPU_CLK_CNTL1 \ -- CBUS_REG_ADDR(HHI_SYS_CPU_CLK_CNTL1) --#define HHI_VID_CLK_DIV 0x1059 --#define P_HHI_VID_CLK_DIV CBUS_REG_ADDR(HHI_VID_CLK_DIV) --#define HHI_MPEG_CLK_CNTL 0x105d --#define P_HHI_MPEG_CLK_CNTL CBUS_REG_ADDR(HHI_MPEG_CLK_CNTL) --#define HHI_AUD_CLK_CNTL 0x105e --#define P_HHI_AUD_CLK_CNTL CBUS_REG_ADDR(HHI_AUD_CLK_CNTL) --#define HHI_VID_CLK_CNTL 0x105f --#define P_HHI_VID_CLK_CNTL CBUS_REG_ADDR(HHI_VID_CLK_CNTL) --#define HHI_WIFI_CLK_CNTL 0x1060 --#define P_HHI_WIFI_CLK_CNTL CBUS_REG_ADDR(HHI_WIFI_CLK_CNTL) --#define HHI_WIFI_PLL_CNTL 0x1061 --#define P_HHI_WIFI_PLL_CNTL CBUS_REG_ADDR(HHI_WIFI_PLL_CNTL) --#define HHI_WIFI_PLL_CNTL2 0x1062 --#define P_HHI_WIFI_PLL_CNTL2 CBUS_REG_ADDR(HHI_WIFI_PLL_CNTL2) --#define HHI_WIFI_PLL_CNTL3 0x1063 --#define P_HHI_WIFI_PLL_CNTL3 CBUS_REG_ADDR(HHI_WIFI_PLL_CNTL3) --#define HHI_AUD_CLK_CNTL2 0x1064 --#define P_HHI_AUD_CLK_CNTL2 CBUS_REG_ADDR(HHI_AUD_CLK_CNTL2) --/*add from M8m2*/ --#define HHI_VID_CLK_CNTL2 0x1065 --#define P_HHI_VID_CLK_CNTL2 CBUS_REG_ADDR(HHI_VID_CLK_CNTL2) --/**/ --#define HHI_VID_DIVIDER_CNTL 0x1066 --#define P_HHI_VID_DIVIDER_CNTL CBUS_REG_ADDR(HHI_VID_DIVIDER_CNTL) --#define HHI_SYS_CPU_CLK_CNTL 0x1067 --#define P_HHI_SYS_CPU_CLK_CNTL CBUS_REG_ADDR(HHI_SYS_CPU_CLK_CNTL) --#define HHI_MALI_CLK_CNTL 0x106c --#define P_HHI_MALI_CLK_CNTL CBUS_REG_ADDR(HHI_MALI_CLK_CNTL) --#define HHI_MIPI_PHY_CLK_CNTL 0x106e --#define P_HHI_MIPI_PHY_CLK_CNTL \ -- CBUS_REG_ADDR(HHI_MIPI_PHY_CLK_CNTL) --#define HHI_VPU_CLK_CNTL 0x106f --#define P_HHI_VPU_CLK_CNTL CBUS_REG_ADDR(HHI_VPU_CLK_CNTL) --#define HHI_OTHER_PLL_CNTL 0x1070 --#define P_HHI_OTHER_PLL_CNTL CBUS_REG_ADDR(HHI_OTHER_PLL_CNTL) --#define HHI_OTHER_PLL_CNTL2 0x1071 --#define P_HHI_OTHER_PLL_CNTL2 CBUS_REG_ADDR(HHI_OTHER_PLL_CNTL2) --#define HHI_OTHER_PLL_CNTL3 0x1072 --#define P_HHI_OTHER_PLL_CNTL3 CBUS_REG_ADDR(HHI_OTHER_PLL_CNTL3) --#define HHI_HDMI_CLK_CNTL 0x1073 --#define P_HHI_HDMI_CLK_CNTL CBUS_REG_ADDR(HHI_HDMI_CLK_CNTL) --#define HHI_DEMOD_CLK_CNTL 0x1074 --#define P_HHI_DEMOD_CLK_CNTL CBUS_REG_ADDR(HHI_DEMOD_CLK_CNTL) --#define HHI_SATA_CLK_CNTL 0x1075 --#define P_HHI_SATA_CLK_CNTL CBUS_REG_ADDR(HHI_SATA_CLK_CNTL) --#define HHI_ETH_CLK_CNTL 0x1076 --#define P_HHI_ETH_CLK_CNTL CBUS_REG_ADDR(HHI_ETH_CLK_CNTL) --#define HHI_CLK_DOUBLE_CNTL 0x1077 --#define P_HHI_CLK_DOUBLE_CNTL CBUS_REG_ADDR(HHI_CLK_DOUBLE_CNTL) --#define HHI_VDEC_CLK_CNTL 0x1078 --#define P_HHI_VDEC_CLK_CNTL CBUS_REG_ADDR(HHI_VDEC_CLK_CNTL) --#define HHI_VDEC2_CLK_CNTL 0x1079 --#define P_HHI_VDEC2_CLK_CNTL CBUS_REG_ADDR(HHI_VDEC2_CLK_CNTL) --/*add from M8M2*/ --#define HHI_VDEC3_CLK_CNTL 0x107a --#define P_HHI_VDEC3_CLK_CNTL CBUS_REG_ADDR(HHI_VDEC3_CLK_CNTL) --#define HHI_VDEC4_CLK_CNTL 0x107b --#define P_HHI_VDEC4_CLK_CNTL CBUS_REG_ADDR(HHI_VDEC4_CLK_CNTL) --/**/ --#define HHI_HDMI_PLL_CNTL 0x107c --#define P_HHI_HDMI_PLL_CNTL CBUS_REG_ADDR(HHI_HDMI_PLL_CNTL) --#define HHI_HDMI_PLL_CNTL1 0x107d --#define P_HHI_HDMI_PLL_CNTL1 CBUS_REG_ADDR(HHI_HDMI_PLL_CNTL1) --#define HHI_HDMI_PLL_CNTL2 0x107e --#define P_HHI_HDMI_PLL_CNTL2 CBUS_REG_ADDR(HHI_HDMI_PLL_CNTL2) --#define HHI_HDMI_AFC_CNTL 0x107f --#define P_HHI_HDMI_AFC_CNTL CBUS_REG_ADDR(HHI_HDMI_AFC_CNTL) --#define HHI_HDMIRX_CLK_CNTL 0x1080 --#define P_HHI_HDMIRX_CLK_CNTL CBUS_REG_ADDR(HHI_HDMIRX_CLK_CNTL) --#define HHI_HDMIRX_AUD_CLK_CNTL 0x1081 --#define P_HHI_HDMIRX_AUD_CLK_CNTL \ -- CBUS_REG_ADDR(HHI_HDMIRX_AUD_CLK_CNTL) --/*M8 M8M2 diff*/ --#define HHI_EDP_APB_CLK_CNTL_M8M2 0x1082 --#define HHI_EDP_APB_CLK_CNTL 0x107b --#define P_HHI_EDP_APB_CLK_CNTL CBUS_REG_ADDR(HHI_EDP_APB_CLK_CNTL) --#define P_HHI_EDP_APB_CLK_CNTL_M8M2 \ -- CBUS_REG_ADDR(HHI_EDP_APB_CLK_CNTL_M8M2) --/**/ --#define HHI_VID_PLL_MOD_CNTL0 0x1084 --#define P_HHI_VID_PLL_MOD_CNTL0 \ -- CBUS_REG_ADDR(HHI_VID_PLL_MOD_CNTL0) --#define HHI_VID_PLL_MOD_LOW_TCNT 0x1085 --#define P_HHI_VID_PLL_MOD_LOW_TCNT \ -- CBUS_REG_ADDR(HHI_VID_PLL_MOD_LOW_TCNT) --#define HHI_VID_PLL_MOD_HIGH_TCNT 0x1086 --#define P_HHI_VID_PLL_MOD_HIGH_TCNT \ -- CBUS_REG_ADDR(HHI_VID_PLL_MOD_HIGH_TCNT) --#define HHI_VID_PLL_MOD_NOM_TCNT 0x1087 --#define P_HHI_VID_PLL_MOD_NOM_TCNT \ -- CBUS_REG_ADDR(HHI_VID_PLL_MOD_NOM_TCNT) --#define HHI_USB_CLK_CNTL 0x1089 --#define P_HHI_USB_CLK_CNTL CBUS_REG_ADDR(HHI_USB_CLK_CNTL) --#define HHI_GEN_CLK_CNTL 0x108a --#define P_HHI_GEN_CLK_CNTL CBUS_REG_ADDR(HHI_GEN_CLK_CNTL) --#define HHI_GEN_CLK_CNTL2 0x108b --#define P_HHI_GEN_CLK_CNTL2 CBUS_REG_ADDR(HHI_GEN_CLK_CNTL2) --#define HHI_JTAG_CONFIG 0x108e --#define P_HHI_JTAG_CONFIG CBUS_REG_ADDR(HHI_JTAG_CONFIG) --#define HHI_VAFE_CLKXTALIN_CNTL 0x108f --#define P_HHI_VAFE_CLKXTALIN_CNTL \ -- CBUS_REG_ADDR(HHI_VAFE_CLKXTALIN_CNTL) --#define HHI_VAFE_CLKOSCIN_CNTL 0x1090 --#define P_HHI_VAFE_CLKOSCIN_CNTL \ -- CBUS_REG_ADDR(HHI_VAFE_CLKOSCIN_CNTL) --#define HHI_VAFE_CLKIN_CNTL 0x1091 --#define P_HHI_VAFE_CLKIN_CNTL CBUS_REG_ADDR(HHI_VAFE_CLKIN_CNTL) --#define HHI_TVFE_AUTOMODE_CLK_CNTL 0x1092 --#define P_HHI_TVFE_AUTOMODE_CLK_CNTL \ -- CBUS_REG_ADDR(HHI_TVFE_AUTOMODE_CLK_CNTL) --#define HHI_VAFE_CLKPI_CNTL 0x1093 --#define P_HHI_VAFE_CLKPI_CNTL CBUS_REG_ADDR(HHI_VAFE_CLKPI_CNTL) --#define HHI_VDIN_MEAS_CLK_CNTL 0x1094 --#define HHI_PCM2_CLK_CNTL 0x1095 --#define P_HHI_PCM2_CLK_CNTL CBUS_REG_ADDR(HHI_PCM2_CLK_CNTL) --#define HHI_PCM_CLK_CNTL 0x1096 --#define P_HHI_PCM_CLK_CNTL CBUS_REG_ADDR(HHI_PCM_CLK_CNTL) --#define HHI_NAND_CLK_CNTL 0x1097 --#define P_HHI_NAND_CLK_CNTL CBUS_REG_ADDR(HHI_NAND_CLK_CNTL) --#define HHI_ISP_LED_CLK_CNTL 0x1098 --#define P_HHI_ISP_LED_CLK_CNTL CBUS_REG_ADDR(HHI_ISP_LED_CLK_CNTL) --#define HHI_EDP_TX_PHY_CNTL0 0x109c --#define P_HHI_EDP_TX_PHY_CNTL0 CBUS_REG_ADDR(HHI_EDP_TX_PHY_CNTL0) --#define HHI_EDP_TX_PHY_CNTL1 0x109d --#define P_HHI_EDP_TX_PHY_CNTL1 CBUS_REG_ADDR(HHI_EDP_TX_PHY_CNTL1) --#define HHI_MPLL_CNTL 0x10a0 --#define P_HHI_MPLL_CNTL CBUS_REG_ADDR(HHI_MPLL_CNTL) --#define HHI_MPLL_CNTL2 0x10a1 --#define P_HHI_MPLL_CNTL2 CBUS_REG_ADDR(HHI_MPLL_CNTL2) --#define HHI_MPLL_CNTL3 0x10a2 --#define P_HHI_MPLL_CNTL3 CBUS_REG_ADDR(HHI_MPLL_CNTL3) --#define HHI_MPLL_CNTL4 0x10a3 --#define P_HHI_MPLL_CNTL4 CBUS_REG_ADDR(HHI_MPLL_CNTL4) --#define HHI_MPLL_CNTL5 0x10a4 --#define P_HHI_MPLL_CNTL5 CBUS_REG_ADDR(HHI_MPLL_CNTL5) --#define HHI_MPLL_CNTL6 0x10a5 --#define P_HHI_MPLL_CNTL6 CBUS_REG_ADDR(HHI_MPLL_CNTL6) --#define HHI_MPLL_CNTL7 0x10a6 --#define P_HHI_MPLL_CNTL7 CBUS_REG_ADDR(HHI_MPLL_CNTL7) --#define HHI_MPLL_CNTL8 0x10a7 --#define P_HHI_MPLL_CNTL8 CBUS_REG_ADDR(HHI_MPLL_CNTL8) --#define HHI_MPLL_CNTL9 0x10a8 --#define P_HHI_MPLL_CNTL9 CBUS_REG_ADDR(HHI_MPLL_CNTL9) --#define HHI_MPLL_CNTL10 0x10a9 --#define P_HHI_MPLL_CNTL10 CBUS_REG_ADDR(HHI_MPLL_CNTL10) -- -- --#define HHI_ADC_PLL_CNTL 0x10aa --#define P_HHI_ADC_PLL_CNTL CBUS_REG_ADDR(HHI_ADC_PLL_CNTL) --#define HHI_ADC_PLL_CNTL2 0x10ab --#define P_HHI_ADC_PLL_CNTL2 CBUS_REG_ADDR(HHI_ADC_PLL_CNTL2) --#define HHI_ADC_PLL_CNTL3 0x10ac --#define P_HHI_ADC_PLL_CNTL3 CBUS_REG_ADDR(HHI_ADC_PLL_CNTL3) --#define HHI_ADC_PLL_CNTL4 0x10ad --#define P_HHI_ADC_PLL_CNTL4 CBUS_REG_ADDR(HHI_ADC_PLL_CNTL4) --#define HHI_ADC_PLL_CNTL5 0x109e --#define P_HHI_ADC_PLL_CNTL5 CBUS_REG_ADDR(HHI_ADC_PLL_CNTL5) --#define HHI_ADC_PLL_CNTL6 0x109f --#define P_HHI_ADC_PLL_CNTL6 CBUS_REG_ADDR(HHI_ADC_PLL_CNTL6) --#define HHI_ADC_PLL_CNTL1 0x10af --#define P_HHI_ADC_PLL_CNTL1 CBUS_REG_ADDR(HHI_ADC_PLL_CNTL1) -- -- --#define HHI_AUDCLK_PLL_CNTL 0x10b0 --#define P_HHI_AUDCLK_PLL_CNTL CBUS_REG_ADDR(HHI_AUDCLK_PLL_CNTL) --#define HHI_AUDCLK_PLL_CNTL2 0x10b1 --#define P_HHI_AUDCLK_PLL_CNTL2 CBUS_REG_ADDR(HHI_AUDCLK_PLL_CNTL2) --#define HHI_AUDCLK_PLL_CNTL3 0x10b2 --#define P_HHI_AUDCLK_PLL_CNTL3 CBUS_REG_ADDR(HHI_AUDCLK_PLL_CNTL3) --#define HHI_AUDCLK_PLL_CNTL4 0x10b3 --#define P_HHI_AUDCLK_PLL_CNTL4 CBUS_REG_ADDR(HHI_AUDCLK_PLL_CNTL4) --#define HHI_AUDCLK_PLL_CNTL5 0x10b4 --#define P_HHI_AUDCLK_PLL_CNTL5 CBUS_REG_ADDR(HHI_AUDCLK_PLL_CNTL5) --#define HHI_AUDCLK_PLL_CNTL6 0x10b5 --#define P_HHI_AUDCLK_PLL_CNTL6 CBUS_REG_ADDR(HHI_AUDCLK_PLL_CNTL6) --#define HHI_L2_DDR_CLK_CNTL 0x10b6 --#define P_HHI_L2_DDR_CLK_CNTL CBUS_REG_ADDR(HHI_L2_DDR_CLK_CNTL) --#define HHI_VDAC_CNTL0 0x10bd --#define P_HHI_VDAC_CNTL0 CBUS_REG_ADDR(HHI_VDAC_CNTL0) --#define HHI_VDAC_CNTL1 0x10be --#define P_HHI_VDAC_CNTL1 CBUS_REG_ADDR(HHI_VDAC_CNTL1) --#define HHI_SYS_PLL_CNTL 0x10c0 --#define P_HHI_SYS_PLL_CNTL CBUS_REG_ADDR(HHI_SYS_PLL_CNTL) --#define HHI_SYS_PLL_CNTL2 0x10c1 --#define P_HHI_SYS_PLL_CNTL2 CBUS_REG_ADDR(HHI_SYS_PLL_CNTL2) --#define HHI_SYS_PLL_CNTL3 0x10c2 --#define P_HHI_SYS_PLL_CNTL3 CBUS_REG_ADDR(HHI_SYS_PLL_CNTL3) --#define HHI_SYS_PLL_CNTL4 0x10c3 --#define P_HHI_SYS_PLL_CNTL4 CBUS_REG_ADDR(HHI_SYS_PLL_CNTL4) --#define HHI_SYS_PLL_CNTL5 0x10c4 --#define P_HHI_SYS_PLL_CNTL5 CBUS_REG_ADDR(HHI_SYS_PLL_CNTL5) --#define HHI_DPLL_TOP_0 0x10c6 --#define P_HHI_DPLL_TOP_0 CBUS_REG_ADDR(HHI_DPLL_TOP_0) --#define HHI_DPLL_TOP_1 0x10c7 --#define P_HHI_DPLL_TOP_1 CBUS_REG_ADDR(HHI_DPLL_TOP_1) --#define HHI_VID_PLL_CNTL 0x10c8 --#define P_HHI_VID_PLL_CNTL CBUS_REG_ADDR(HHI_VID_PLL_CNTL) --#define HHI_VID_PLL_CNTL2 0x10c9 --#define P_HHI_VID_PLL_CNTL2 CBUS_REG_ADDR(HHI_VID_PLL_CNTL2) --#define HHI_VID_PLL_CNTL3 0x10ca --#define P_HHI_VID_PLL_CNTL3 CBUS_REG_ADDR(HHI_VID_PLL_CNTL3) --#define HHI_VID_PLL_CNTL4 0x10cb --#define P_HHI_VID_PLL_CNTL4 CBUS_REG_ADDR(HHI_VID_PLL_CNTL4) --#define HHI_VID_PLL_CNTL5 0x10cc --#define P_HHI_VID_PLL_CNTL5 CBUS_REG_ADDR(HHI_VID_PLL_CNTL5) --#define HHI_VID_PLL_CNTL6 0x10cd --#define P_HHI_VID_PLL_CNTL6 CBUS_REG_ADDR(HHI_VID_PLL_CNTL6) --#define HHI_CSI_PHY_CNTL0 0x10d3 --#define P_HHI_CSI_PHY_CNTL0 CBUS_REG_ADDR(HHI_CSI_PHY_CNTL0) --#define HHI_CSI_PHY_CNTL1 0x10d4 --#define P_HHI_CSI_PHY_CNTL1 CBUS_REG_ADDR(HHI_CSI_PHY_CNTL1) --#define HHI_CSI_PHY_CNTL2 0x10d5 --#define P_HHI_CSI_PHY_CNTL2 CBUS_REG_ADDR(HHI_CSI_PHY_CNTL2) --#define HHI_CSI_PHY_CNTL3 0x10d6 --#define P_HHI_CSI_PHY_CNTL3 CBUS_REG_ADDR(HHI_CSI_PHY_CNTL3) --#define HHI_CSI_PHY_CNTL4 0x10d7 --#define P_HHI_CSI_PHY_CNTL4 CBUS_REG_ADDR(HHI_CSI_PHY_CNTL4) --#define HHI_DIF_CSI_PHY_CNTL0 0x10d8 --#define P_HHI_DIF_CSI_PHY_CNTL0 \ -- CBUS_REG_ADDR(HHI_DIF_CSI_PHY_CNTL0) --#define HHI_DIF_CSI_PHY_CNTL1 0x10d9 --#define P_HHI_DIF_CSI_PHY_CNTL1 \ -- CBUS_REG_ADDR(HHI_DIF_CSI_PHY_CNTL1) --#define HHI_DIF_CSI_PHY_CNTL2 0x10da --#define P_HHI_DIF_CSI_PHY_CNTL2 \ -- CBUS_REG_ADDR(HHI_DIF_CSI_PHY_CNTL2) --#define HHI_DIF_CSI_PHY_CNTL3 0x10db --#define P_HHI_DIF_CSI_PHY_CNTL3 \ -- CBUS_REG_ADDR(HHI_DIF_CSI_PHY_CNTL3) --#define HHI_DIF_CSI_PHY_CNTL4 0x10dc --#define P_HHI_DIF_CSI_PHY_CNTL4 \ -- CBUS_REG_ADDR(HHI_DIF_CSI_PHY_CNTL4) --#define HHI_DIF_CSI_PHY_CNTL5 0x10dd --#define P_HHI_DIF_CSI_PHY_CNTL5 \ -- CBUS_REG_ADDR(HHI_DIF_CSI_PHY_CNTL5) --#define HHI_LVDS_TX_PHY_CNTL0 0x10de --#define P_HHI_LVDS_TX_PHY_CNTL0 \ -- CBUS_REG_ADDR(HHI_LVDS_TX_PHY_CNTL0) --#define HHI_LVDS_TX_PHY_CNTL1 0x10df --#define P_HHI_LVDS_TX_PHY_CNTL1 \ -- CBUS_REG_ADDR(HHI_LVDS_TX_PHY_CNTL1) --#define HHI_VID2_PLL_CNTL 0x10e0 --#define P_HHI_VID2_PLL_CNTL CBUS_REG_ADDR(HHI_VID2_PLL_CNTL) --#define HHI_VID2_PLL_CNTL2 0x10e1 --#define P_HHI_VID2_PLL_CNTL2 CBUS_REG_ADDR(HHI_VID2_PLL_CNTL2) --#define HHI_VID2_PLL_CNTL3 0x10e2 --#define P_HHI_VID2_PLL_CNTL3 CBUS_REG_ADDR(HHI_VID2_PLL_CNTL3) --#define HHI_VID2_PLL_CNTL4 0x10e3 --#define P_HHI_VID2_PLL_CNTL4 CBUS_REG_ADDR(HHI_VID2_PLL_CNTL4) --#define HHI_VID2_PLL_CNTL5 0x10e4 --#define P_HHI_VID2_PLL_CNTL5 CBUS_REG_ADDR(HHI_VID2_PLL_CNTL5) --#define HHI_VID2_PLL_CNTL6 0x10e5 --#define P_HHI_VID2_PLL_CNTL6 CBUS_REG_ADDR(HHI_VID2_PLL_CNTL6) --#define HHI_HDMI_PHY_CNTL0 0x10e8 --#define P_HHI_HDMI_PHY_CNTL0 CBUS_REG_ADDR(HHI_HDMI_PHY_CNTL0) --#define HHI_HDMI_PHY_CNTL1 0x10e9 --#define P_HHI_HDMI_PHY_CNTL1 CBUS_REG_ADDR(HHI_HDMI_PHY_CNTL1) --#define HHI_HDMI_PHY_CNTL2 0x10ea --#define P_HHI_HDMI_PHY_CNTL2 CBUS_REG_ADDR(HHI_HDMI_PHY_CNTL2) --#define PARSER_CONTROL 0x2960 --#define P_PARSER_CONTROL CBUS_REG_ADDR(PARSER_CONTROL) --#define PARSER_FETCH_ADDR 0x2961 --#define P_PARSER_FETCH_ADDR CBUS_REG_ADDR(PARSER_FETCH_ADDR) --#define PARSER_FETCH_CMD 0x2962 --#define P_PARSER_FETCH_CMD CBUS_REG_ADDR(PARSER_FETCH_CMD) --#define PARSER_FETCH_LEVEL 0x2964 --#define P_PARSER_FETCH_LEVEL CBUS_REG_ADDR(PARSER_FETCH_LEVEL) --#define PARSER_CONFIG 0x2965 --#define P_PARSER_CONFIG CBUS_REG_ADDR(PARSER_CONFIG) --#define PFIFO_WR_PTR 0x2966 --#define P_PFIFO_WR_PTR CBUS_REG_ADDR(PFIFO_WR_PTR) --#define PFIFO_RD_PTR 0x2967 --#define P_PFIFO_RD_PTR CBUS_REG_ADDR(PFIFO_RD_PTR) --#define PFIFO_DATA 0x2968 --#define P_PFIFO_DATA CBUS_REG_ADDR(PFIFO_DATA) --#define PARSER_SEARCH_PATTERN 0x2969 --#define P_PARSER_SEARCH_PATTERN \ -- CBUS_REG_ADDR(PARSER_SEARCH_PATTERN) --#define PARSER_SEARCH_MASK 0x296a --#define P_PARSER_SEARCH_MASK CBUS_REG_ADDR(PARSER_SEARCH_MASK) --#define PARSER_INT_ENABLE 0x296b --#define P_PARSER_INT_ENABLE CBUS_REG_ADDR(PARSER_INT_ENABLE) --#define PARSER_INT_STATUS 0x296c --#define P_PARSER_INT_STATUS CBUS_REG_ADDR(PARSER_INT_STATUS) --#define PARSER_SCR_CTL 0x296d --#define P_PARSER_SCR_CTL CBUS_REG_ADDR(PARSER_SCR_CTL) --#define PARSER_SCR 0x296e --#define P_PARSER_SCR CBUS_REG_ADDR(PARSER_SCR) --#define PARSER_PARAMETER 0x296f --#define P_PARSER_PARAMETER CBUS_REG_ADDR(PARSER_PARAMETER) --#define PARSER_INSERT_DATA 0x2970 --#define P_PARSER_INSERT_DATA CBUS_REG_ADDR(PARSER_INSERT_DATA) --#define VAS_STREAM_ID 0x2971 --#define P_VAS_STREAM_ID CBUS_REG_ADDR(VAS_STREAM_ID) --#define VIDEO_DTS 0x2972 --#define P_VIDEO_DTS CBUS_REG_ADDR(VIDEO_DTS) --#define VIDEO_PTS 0x2973 --#define P_VIDEO_PTS CBUS_REG_ADDR(VIDEO_PTS) --#define VIDEO_PTS_DTS_WR_PTR 0x2974 --#define P_VIDEO_PTS_DTS_WR_PTR CBUS_REG_ADDR(VIDEO_PTS_DTS_WR_PTR) --#define AUDIO_PTS 0x2975 --#define P_AUDIO_PTS CBUS_REG_ADDR(AUDIO_PTS) --#define AUDIO_PTS_WR_PTR 0x2976 --#define P_AUDIO_PTS_WR_PTR CBUS_REG_ADDR(AUDIO_PTS_WR_PTR) --#define PARSER_ES_CONTROL 0x2977 --#define P_PARSER_ES_CONTROL CBUS_REG_ADDR(PARSER_ES_CONTROL) --#define PFIFO_MONITOR 0x2978 --#define P_PFIFO_MONITOR CBUS_REG_ADDR(PFIFO_MONITOR) --#define PARSER_VIDEO_START_PTR 0x2980 --#define P_PARSER_VIDEO_START_PTR \ -- CBUS_REG_ADDR(PARSER_VIDEO_START_PTR) --#define PARSER_VIDEO_END_PTR 0x2981 --#define P_PARSER_VIDEO_END_PTR CBUS_REG_ADDR(PARSER_VIDEO_END_PTR) --#define PARSER_VIDEO_WP 0x2982 --#define P_PARSER_VIDEO_WP CBUS_REG_ADDR(PARSER_VIDEO_WP) --#define PARSER_VIDEO_RP 0x2983 --#define P_PARSER_VIDEO_RP CBUS_REG_ADDR(PARSER_VIDEO_RP) --#define PARSER_VIDEO_HOLE 0x2984 --#define P_PARSER_VIDEO_HOLE CBUS_REG_ADDR(PARSER_VIDEO_HOLE) --#define PARSER_AUDIO_START_PTR 0x2985 --#define P_PARSER_AUDIO_START_PTR \ -- CBUS_REG_ADDR(PARSER_AUDIO_START_PTR) --#define PARSER_AUDIO_END_PTR 0x2986 --#define P_PARSER_AUDIO_END_PTR CBUS_REG_ADDR(PARSER_AUDIO_END_PTR) --#define PARSER_AUDIO_WP 0x2987 --#define P_PARSER_AUDIO_WP CBUS_REG_ADDR(PARSER_AUDIO_WP) --#define PARSER_AUDIO_RP 0x2988 --#define P_PARSER_AUDIO_RP CBUS_REG_ADDR(PARSER_AUDIO_RP) --#define PARSER_AUDIO_HOLE 0x2989 --#define P_PARSER_AUDIO_HOLE CBUS_REG_ADDR(PARSER_AUDIO_HOLE) --#define PARSER_SUB_START_PTR 0x298a --#define P_PARSER_SUB_START_PTR CBUS_REG_ADDR(PARSER_SUB_START_PTR) --#define PARSER_SUB_END_PTR 0x298b --#define P_PARSER_SUB_END_PTR CBUS_REG_ADDR(PARSER_SUB_END_PTR) --#define PARSER_SUB_WP 0x298c --#define P_PARSER_SUB_WP CBUS_REG_ADDR(PARSER_SUB_WP) --#define PARSER_SUB_RP 0x298d --#define P_PARSER_SUB_RP CBUS_REG_ADDR(PARSER_SUB_RP) --#define PARSER_SUB_HOLE 0x298e --#define P_PARSER_SUB_HOLE CBUS_REG_ADDR(PARSER_SUB_HOLE) --#define PARSER_FETCH_INFO 0x298f --#define P_PARSER_FETCH_INFO CBUS_REG_ADDR(PARSER_FETCH_INFO) --#define PARSER_STATUS 0x2990 --#define P_PARSER_STATUS CBUS_REG_ADDR(PARSER_STATUS) --#define PARSER_AV_WRAP_COUNT 0x2991 --#define P_PARSER_AV_WRAP_COUNT CBUS_REG_ADDR(PARSER_AV_WRAP_COUNT) --#define WRRSP_PARSER 0x2992 --#define P_WRRSP_PARSER CBUS_REG_ADDR(WRRSP_PARSER) --#define PARSER_VIDEO2_START_PTR 0x2993 --#define P_PARSER_VIDEO2_START_PTR \ -- CBUS_REG_ADDR(PARSER_VIDEO2_START_PTR) --#define PARSER_VIDEO2_END_PTR 0x2994 --#define P_PARSER_VIDEO2_END_PTR \ -- CBUS_REG_ADDR(PARSER_VIDEO2_END_PTR) --#define PARSER_VIDEO2_WP 0x2995 --#define P_PARSER_VIDEO2_WP CBUS_REG_ADDR(PARSER_VIDEO2_WP) --#define PARSER_VIDEO2_RP 0x2996 --#define P_PARSER_VIDEO2_RP CBUS_REG_ADDR(PARSER_VIDEO2_RP) --#define PARSER_VIDEO2_HOLE 0x2997 --#define P_PARSER_VIDEO2_HOLE CBUS_REG_ADDR(PARSER_VIDEO2_HOLE) --#define PARSER_AV2_WRAP_COUNT 0x2998 --#define P_PARSER_AV2_WRAP_COUNT \ -- CBUS_REG_ADDR(PARSER_AV2_WRAP_COUNT) --#define DVIN_FRONT_END_CTRL 0x12e0 --#define P_DVIN_FRONT_END_CTRL CBUS_REG_ADDR(DVIN_FRONT_END_CTRL) --#define DVIN_HS_LEAD_VS_ODD 0x12e1 --#define P_DVIN_HS_LEAD_VS_ODD CBUS_REG_ADDR(DVIN_HS_LEAD_VS_ODD) --#define DVIN_ACTIVE_START_PIX 0x12e2 --#define P_DVIN_ACTIVE_START_PIX \ -- CBUS_REG_ADDR(DVIN_ACTIVE_START_PIX) --#define DVIN_ACTIVE_START_LINE 0x12e3 --#define P_DVIN_ACTIVE_START_LINE \ -- CBUS_REG_ADDR(DVIN_ACTIVE_START_LINE) --#define DVIN_DISPLAY_SIZE 0x12e4 --#define P_DVIN_DISPLAY_SIZE CBUS_REG_ADDR(DVIN_DISPLAY_SIZE) --#define DVIN_CTRL_STAT 0x12e5 --#define P_DVIN_CTRL_STAT CBUS_REG_ADDR(DVIN_CTRL_STAT) --#define AIU_958_BPF 0x1500 --#define P_AIU_958_BPF CBUS_REG_ADDR(AIU_958_BPF) --#define AIU_958_BRST 0x1501 --#define P_AIU_958_BRST CBUS_REG_ADDR(AIU_958_BRST) --#define AIU_958_LENGTH 0x1502 --#define P_AIU_958_LENGTH CBUS_REG_ADDR(AIU_958_LENGTH) --#define AIU_958_PADDSIZE 0x1503 --#define P_AIU_958_PADDSIZE CBUS_REG_ADDR(AIU_958_PADDSIZE) --#define AIU_958_MISC 0x1504 --#define P_AIU_958_MISC CBUS_REG_ADDR(AIU_958_MISC) --#define AIU_958_FORCE_LEFT 0x1505 --#define P_AIU_958_FORCE_LEFT CBUS_REG_ADDR(AIU_958_FORCE_LEFT) --#define AIU_958_DISCARD_NUM 0x1506 --#define P_AIU_958_DISCARD_NUM CBUS_REG_ADDR(AIU_958_DISCARD_NUM) --#define AIU_958_DCU_FF_CTRL 0x1507 --#define P_AIU_958_DCU_FF_CTRL CBUS_REG_ADDR(AIU_958_DCU_FF_CTRL) --#define AIU_958_CHSTAT_L0 0x1508 --#define P_AIU_958_CHSTAT_L0 CBUS_REG_ADDR(AIU_958_CHSTAT_L0) --#define AIU_958_CHSTAT_L1 0x1509 --#define P_AIU_958_CHSTAT_L1 CBUS_REG_ADDR(AIU_958_CHSTAT_L1) --#define AIU_958_CTRL 0x150a --#define P_AIU_958_CTRL CBUS_REG_ADDR(AIU_958_CTRL) --#define AIU_958_RPT 0x150b --#define P_AIU_958_RPT CBUS_REG_ADDR(AIU_958_RPT) --#define AIU_I2S_MUTE_SWAP 0x150c --#define P_AIU_I2S_MUTE_SWAP CBUS_REG_ADDR(AIU_I2S_MUTE_SWAP) --#define AIU_I2S_SOURCE_DESC 0x150d --#define P_AIU_I2S_SOURCE_DESC CBUS_REG_ADDR(AIU_I2S_SOURCE_DESC) --#define AIU_I2S_MED_CTRL 0x150e --#define P_AIU_I2S_MED_CTRL CBUS_REG_ADDR(AIU_I2S_MED_CTRL) --#define AIU_I2S_MED_THRESH 0x150f --#define P_AIU_I2S_MED_THRESH CBUS_REG_ADDR(AIU_I2S_MED_THRESH) --#define AIU_I2S_DAC_CFG 0x1510 --#define P_AIU_I2S_DAC_CFG CBUS_REG_ADDR(AIU_I2S_DAC_CFG) --#define AIU_I2S_SYNC 0x1511 --#define P_AIU_I2S_SYNC CBUS_REG_ADDR(AIU_I2S_SYNC) --#define AIU_I2S_MISC 0x1512 --#define P_AIU_I2S_MISC CBUS_REG_ADDR(AIU_I2S_MISC) --#define AIU_I2S_OUT_CFG 0x1513 --#define P_AIU_I2S_OUT_CFG CBUS_REG_ADDR(AIU_I2S_OUT_CFG) --#define AIU_I2S_FF_CTRL 0x1514 --#define P_AIU_I2S_FF_CTRL CBUS_REG_ADDR(AIU_I2S_FF_CTRL) --#define AIU_RST_SOFT 0x1515 --#define P_AIU_RST_SOFT CBUS_REG_ADDR(AIU_RST_SOFT) --#define AIU_CLK_CTRL 0x1516 --#define P_AIU_CLK_CTRL CBUS_REG_ADDR(AIU_CLK_CTRL) --#define AIU_MIX_ADCCFG 0x1517 --#define P_AIU_MIX_ADCCFG CBUS_REG_ADDR(AIU_MIX_ADCCFG) --#define AIU_MIX_CTRL 0x1518 --#define P_AIU_MIX_CTRL CBUS_REG_ADDR(AIU_MIX_CTRL) --#define AIU_CLK_CTRL_MORE 0x1519 --#define P_AIU_CLK_CTRL_MORE CBUS_REG_ADDR(AIU_CLK_CTRL_MORE) --#define AIU_958_POP 0x151a --#define P_AIU_958_POP CBUS_REG_ADDR(AIU_958_POP) --#define AIU_MIX_GAIN 0x151b --#define P_AIU_MIX_GAIN CBUS_REG_ADDR(AIU_MIX_GAIN) --#define AIU_958_SYNWORD1 0x151c --#define P_AIU_958_SYNWORD1 CBUS_REG_ADDR(AIU_958_SYNWORD1) --#define AIU_958_SYNWORD2 0x151d --#define P_AIU_958_SYNWORD2 CBUS_REG_ADDR(AIU_958_SYNWORD2) --#define AIU_958_SYNWORD3 0x151e --#define P_AIU_958_SYNWORD3 CBUS_REG_ADDR(AIU_958_SYNWORD3) --#define AIU_958_SYNWORD1_MASK 0x151f --#define P_AIU_958_SYNWORD1_MASK \ -- CBUS_REG_ADDR(AIU_958_SYNWORD1_MASK) --#define AIU_958_SYNWORD2_MASK 0x1520 --#define P_AIU_958_SYNWORD2_MASK \ -- CBUS_REG_ADDR(AIU_958_SYNWORD2_MASK) --#define AIU_958_SYNWORD3_MASK 0x1521 --#define P_AIU_958_SYNWORD3_MASK \ -- CBUS_REG_ADDR(AIU_958_SYNWORD3_MASK) --#define AIU_958_FFRDOUT_THD 0x1522 --#define P_AIU_958_FFRDOUT_THD CBUS_REG_ADDR(AIU_958_FFRDOUT_THD) --#define AIU_958_LENGTH_PER_PAUSE 0x1523 --#define P_AIU_958_LENGTH_PER_PAUSE \ -- CBUS_REG_ADDR(AIU_958_LENGTH_PER_PAUSE) --#define AIU_958_PAUSE_NUM 0x1524 --#define P_AIU_958_PAUSE_NUM CBUS_REG_ADDR(AIU_958_PAUSE_NUM) --#define AIU_958_PAUSE_PAYLOAD 0x1525 --#define P_AIU_958_PAUSE_PAYLOAD \ -- CBUS_REG_ADDR(AIU_958_PAUSE_PAYLOAD) --#define AIU_958_AUTO_PAUSE 0x1526 --#define P_AIU_958_AUTO_PAUSE CBUS_REG_ADDR(AIU_958_AUTO_PAUSE) --#define AIU_958_PAUSE_PD_LENGTH 0x1527 --#define P_AIU_958_PAUSE_PD_LENGTH \ -- CBUS_REG_ADDR(AIU_958_PAUSE_PD_LENGTH) --#define AIU_CODEC_DAC_LRCLK_CTRL 0x1528 --#define P_AIU_CODEC_DAC_LRCLK_CTRL \ -- CBUS_REG_ADDR(AIU_CODEC_DAC_LRCLK_CTRL) --#define AIU_CODEC_ADC_LRCLK_CTRL 0x1529 --#define P_AIU_CODEC_ADC_LRCLK_CTRL \ -- CBUS_REG_ADDR(AIU_CODEC_ADC_LRCLK_CTRL) --#define AIU_CODEC_CLK_DATA_CTRL 0x152b --#define P_AIU_CODEC_CLK_DATA_CTRL \ -- CBUS_REG_ADDR(AIU_CODEC_CLK_DATA_CTRL) --#define AIU_958_CHSTAT_R0 0x1530 --#define P_AIU_958_CHSTAT_R0 CBUS_REG_ADDR(AIU_958_CHSTAT_R0) --#define AIU_958_CHSTAT_R1 0x1531 --#define P_AIU_958_CHSTAT_R1 CBUS_REG_ADDR(AIU_958_CHSTAT_R1) --#define AIU_958_VALID_CTRL 0x1532 --#define P_AIU_958_VALID_CTRL CBUS_REG_ADDR(AIU_958_VALID_CTRL) --#define AIU_AUDIO_AMP_REG0 0x153c --#define P_AIU_AUDIO_AMP_REG0 CBUS_REG_ADDR(AIU_AUDIO_AMP_REG0) --#define AIU_AUDIO_AMP_REG1 0x153d --#define P_AIU_AUDIO_AMP_REG1 CBUS_REG_ADDR(AIU_AUDIO_AMP_REG1) --#define AIU_AUDIO_AMP_REG2 0x153e --#define P_AIU_AUDIO_AMP_REG2 CBUS_REG_ADDR(AIU_AUDIO_AMP_REG2) --#define AIU_AUDIO_AMP_REG3 0x153f --#define P_AIU_AUDIO_AMP_REG3 CBUS_REG_ADDR(AIU_AUDIO_AMP_REG3) --#define AIU_AIFIFO2_CTRL 0x1540 --#define P_AIU_AIFIFO2_CTRL CBUS_REG_ADDR(AIU_AIFIFO2_CTRL) --#define AIU_AIFIFO2_STATUS 0x1541 --#define P_AIU_AIFIFO2_STATUS CBUS_REG_ADDR(AIU_AIFIFO2_STATUS) --#define AIU_AIFIFO2_GBIT 0x1542 --#define P_AIU_AIFIFO2_GBIT CBUS_REG_ADDR(AIU_AIFIFO2_GBIT) --#define AIU_AIFIFO2_CLB 0x1543 --#define P_AIU_AIFIFO2_CLB CBUS_REG_ADDR(AIU_AIFIFO2_CLB) --#define AIU_CRC_CTRL 0x1544 --#define P_AIU_CRC_CTRL CBUS_REG_ADDR(AIU_CRC_CTRL) --#define AIU_CRC_STATUS 0x1545 --#define P_AIU_CRC_STATUS CBUS_REG_ADDR(AIU_CRC_STATUS) --#define AIU_CRC_SHIFT_REG 0x1546 --#define P_AIU_CRC_SHIFT_REG CBUS_REG_ADDR(AIU_CRC_SHIFT_REG) --#define AIU_CRC_IREG 0x1547 --#define P_AIU_CRC_IREG CBUS_REG_ADDR(AIU_CRC_IREG) --#define AIU_CRC_CAL_REG1 0x1548 --#define P_AIU_CRC_CAL_REG1 CBUS_REG_ADDR(AIU_CRC_CAL_REG1) --#define AIU_CRC_CAL_REG0 0x1549 --#define P_AIU_CRC_CAL_REG0 CBUS_REG_ADDR(AIU_CRC_CAL_REG0) --#define AIU_CRC_POLY_COEF1 0x154a --#define P_AIU_CRC_POLY_COEF1 CBUS_REG_ADDR(AIU_CRC_POLY_COEF1) --#define AIU_CRC_POLY_COEF0 0x154b --#define P_AIU_CRC_POLY_COEF0 CBUS_REG_ADDR(AIU_CRC_POLY_COEF0) --#define AIU_CRC_BIT_SIZE1 0x154c --#define P_AIU_CRC_BIT_SIZE1 CBUS_REG_ADDR(AIU_CRC_BIT_SIZE1) --#define AIU_CRC_BIT_SIZE0 0x154d --#define P_AIU_CRC_BIT_SIZE0 CBUS_REG_ADDR(AIU_CRC_BIT_SIZE0) --#define AIU_CRC_BIT_CNT1 0x154e --#define P_AIU_CRC_BIT_CNT1 CBUS_REG_ADDR(AIU_CRC_BIT_CNT1) --#define AIU_CRC_BIT_CNT0 0x154f --#define P_AIU_CRC_BIT_CNT0 CBUS_REG_ADDR(AIU_CRC_BIT_CNT0) --#define AIU_AMCLK_GATE_HI 0x1550 --#define P_AIU_AMCLK_GATE_HI CBUS_REG_ADDR(AIU_AMCLK_GATE_HI) --#define AIU_AMCLK_GATE_LO 0x1551 --#define P_AIU_AMCLK_GATE_LO CBUS_REG_ADDR(AIU_AMCLK_GATE_LO) --#define AIU_AMCLK_MSR 0x1552 --#define P_AIU_AMCLK_MSR CBUS_REG_ADDR(AIU_AMCLK_MSR) --#define AIU_AUDAC_CTRL0 0x1553 --#define P_AIU_AUDAC_CTRL0 CBUS_REG_ADDR(AIU_AUDAC_CTRL0) --#define AIU_DELTA_SIGMA0 0x1555 --#define P_AIU_DELTA_SIGMA0 CBUS_REG_ADDR(AIU_DELTA_SIGMA0) --#define AIU_DELTA_SIGMA1 0x1556 --#define P_AIU_DELTA_SIGMA1 CBUS_REG_ADDR(AIU_DELTA_SIGMA1) --#define AIU_DELTA_SIGMA2 0x1557 --#define P_AIU_DELTA_SIGMA2 CBUS_REG_ADDR(AIU_DELTA_SIGMA2) --#define AIU_DELTA_SIGMA3 0x1558 --#define P_AIU_DELTA_SIGMA3 CBUS_REG_ADDR(AIU_DELTA_SIGMA3) --#define AIU_DELTA_SIGMA4 0x1559 --#define P_AIU_DELTA_SIGMA4 CBUS_REG_ADDR(AIU_DELTA_SIGMA4) --#define AIU_DELTA_SIGMA5 0x155a --#define P_AIU_DELTA_SIGMA5 CBUS_REG_ADDR(AIU_DELTA_SIGMA5) --#define AIU_DELTA_SIGMA6 0x155b --#define P_AIU_DELTA_SIGMA6 CBUS_REG_ADDR(AIU_DELTA_SIGMA6) --#define AIU_DELTA_SIGMA7 0x155c --#define P_AIU_DELTA_SIGMA7 CBUS_REG_ADDR(AIU_DELTA_SIGMA7) --#define AIU_DELTA_SIGMA_LCNTS 0x155d --#define P_AIU_DELTA_SIGMA_LCNTS \ -- CBUS_REG_ADDR(AIU_DELTA_SIGMA_LCNTS) --#define AIU_DELTA_SIGMA_RCNTS 0x155e --#define P_AIU_DELTA_SIGMA_RCNTS \ -- CBUS_REG_ADDR(AIU_DELTA_SIGMA_RCNTS) --#define AIU_MEM_I2S_START_PTR 0x1560 --#define P_AIU_MEM_I2S_START_PTR \ -- CBUS_REG_ADDR(AIU_MEM_I2S_START_PTR) --#define AIU_MEM_I2S_RD_PTR 0x1561 --#define P_AIU_MEM_I2S_RD_PTR CBUS_REG_ADDR(AIU_MEM_I2S_RD_PTR) --#define AIU_MEM_I2S_END_PTR 0x1562 --#define P_AIU_MEM_I2S_END_PTR CBUS_REG_ADDR(AIU_MEM_I2S_END_PTR) --#define AIU_MEM_I2S_MASKS 0x1563 --#define P_AIU_MEM_I2S_MASKS CBUS_REG_ADDR(AIU_MEM_I2S_MASKS) --#define AIU_MEM_I2S_CONTROL 0x1564 --#define P_AIU_MEM_I2S_CONTROL CBUS_REG_ADDR(AIU_MEM_I2S_CONTROL) --#define AIU_MEM_IEC958_START_PTR 0x1565 --#define P_AIU_MEM_IEC958_START_PTR \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_START_PTR) --#define AIU_MEM_IEC958_RD_PTR 0x1566 --#define P_AIU_MEM_IEC958_RD_PTR \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_RD_PTR) --#define AIU_MEM_IEC958_END_PTR 0x1567 --#define AIU_MEM_AIFIFO2_START_PTR 0x156a --#define P_AIU_MEM_AIFIFO2_START_PTR \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_START_PTR) --#define AIU_MEM_AIFIFO2_CURR_PTR 0x156b --#define P_AIU_MEM_AIFIFO2_CURR_PTR \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_CURR_PTR) --#define AIU_MEM_AIFIFO2_BYTES_AVAIL 0x156d --#define P_AIU_MEM_AIFIFO2_BYTES_AVAIL \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_BYTES_AVAIL) --#define AIU_MEM_AIFIFO2_CONTROL 0x156e --#define P_AIU_MEM_AIFIFO2_CONTROL \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_CONTROL) --#define AIU_MEM_AIFIFO2_LEVEL 0x1571 --#define P_AIU_MEM_AIFIFO2_LEVEL \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_LEVEL) --#define AIU_MEM_AIFIFO2_BUF_CNTL 0x1572 --#define P_AIU_MEM_AIFIFO2_BUF_CNTL \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_BUF_CNTL) --#define AIU_MEM_I2S_MAN_WP 0x1573 --#define P_AIU_MEM_I2S_MAN_WP CBUS_REG_ADDR(AIU_MEM_I2S_MAN_WP) --#define AIU_MEM_I2S_MAN_RP 0x1574 --#define P_AIU_MEM_I2S_MAN_RP CBUS_REG_ADDR(AIU_MEM_I2S_MAN_RP) --#define AIU_MEM_I2S_LEVEL 0x1575 --#define P_AIU_MEM_I2S_LEVEL CBUS_REG_ADDR(AIU_MEM_I2S_LEVEL) --#define AIU_MEM_I2S_BUF_CNTL 0x1576 --#define P_AIU_MEM_I2S_BUF_CNTL CBUS_REG_ADDR(AIU_MEM_I2S_BUF_CNTL) --#define AIU_MEM_I2S_BUF_WRAP_COUNT 0x1577 --#define P_AIU_MEM_I2S_BUF_WRAP_COUNT \ -- CBUS_REG_ADDR(AIU_MEM_I2S_BUF_WRAP_COUNT) --#define AIU_MEM_I2S_MEM_CTL 0x1578 --#define P_AIU_MEM_I2S_MEM_CTL CBUS_REG_ADDR(AIU_MEM_I2S_MEM_CTL) --#define AIU_MEM_IEC958_WRAP_COUNT 0x157a --#define P_AIU_MEM_IEC958_WRAP_COUNT \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_WRAP_COUNT) --#define AIU_MEM_IEC958_IRQ_LEVEL 0x157b --#define P_AIU_MEM_IEC958_IRQ_LEVEL \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_IRQ_LEVEL) --#define AIU_MEM_IEC958_MAN_WP 0x157c --#define P_AIU_MEM_IEC958_MAN_WP \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_MAN_WP) --#define AIU_MEM_IEC958_MAN_RP 0x157d --#define P_AIU_MEM_IEC958_MAN_RP \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_MAN_RP) --#define AIU_MEM_IEC958_LEVEL 0x157e --#define P_AIU_MEM_IEC958_LEVEL \ -- CBUS_REG_ADDR(AIU_MEM_IEC958_LEVEL) --#define AIU_AIFIFO_CTRL 0x1580 --#define P_AIU_AIFIFO_CTRL CBUS_REG_ADDR(AIU_AIFIFO_CTRL) --#define AIU_AIFIFO_STATUS 0x1581 --#define P_AIU_AIFIFO_STATUS CBUS_REG_ADDR(AIU_AIFIFO_STATUS) --#define AIU_AIFIFO_GBIT 0x1582 --#define P_AIU_AIFIFO_GBIT CBUS_REG_ADDR(AIU_AIFIFO_GBIT) --#define AIU_AIFIFO_CLB 0x1583 --#define P_AIU_AIFIFO_CLB CBUS_REG_ADDR(AIU_AIFIFO_CLB) --#define AIU_MEM_AIFIFO_START_PTR 0x1584 --#define P_AIU_MEM_AIFIFO_START_PTR \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO_START_PTR) --#define AIU_MEM_AIFIFO_BYTES_AVAIL 0x1587 --#define P_AIU_MEM_AIFIFO_BYTES_AVAIL \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO_BYTES_AVAIL) --#define AIU_MEM_AIFIFO_MAN_WP 0x1589 --#define P_AIU_MEM_AIFIFO_MAN_WP \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO_MAN_WP) --#define AIU_MEM_AIFIFO_MAN_RP 0x158a --#define P_AIU_MEM_AIFIFO_MAN_RP \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO_MAN_RP) --#define AIU_MEM_AIFIFO_BUF_WRAP_COUNT 0x158d --#define P_AIU_MEM_AIFIFO_BUF_WRAP_COUNT \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO_BUF_WRAP_COUNT) --#define AIU_MEM_AIFIFO2_BUF_WRAP_COUNT 0x158e --#define P_AIU_MEM_AIFIFO2_BUF_WRAP_COUNT \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_BUF_WRAP_COUNT) --#define AIFIFO_TIME_STAMP_SYNC_0 0x1591 --#define P_AIFIFO_TIME_STAMP_SYNC_0 \ -- CBUS_REG_ADDR(AIFIFO_TIME_STAMP_SYNC_0) --#define AIFIFO_TIME_STAMP_SYNC_1 0x1592 --#define P_AIFIFO_TIME_STAMP_SYNC_1 \ -- CBUS_REG_ADDR(AIFIFO_TIME_STAMP_SYNC_1) --#define AIFIFO_TIME_STAMP_0 0x1593 --#define P_AIFIFO_TIME_STAMP_0 CBUS_REG_ADDR(AIFIFO_TIME_STAMP_0) --#define AIFIFO_TIME_STAMP_1 0x1594 --#define P_AIFIFO_TIME_STAMP_1 CBUS_REG_ADDR(AIFIFO_TIME_STAMP_1) --#define AIFIFO_TIME_STAMP_2 0x1595 --#define P_AIFIFO_TIME_STAMP_2 CBUS_REG_ADDR(AIFIFO_TIME_STAMP_2) --#define AIFIFO_TIME_STAMP_3 0x1596 --#define P_AIFIFO_TIME_STAMP_3 CBUS_REG_ADDR(AIFIFO_TIME_STAMP_3) --#define AIFIFO_TIME_STAMP_LENGTH 0x1597 --#define P_AIFIFO_TIME_STAMP_LENGTH \ -- CBUS_REG_ADDR(AIFIFO_TIME_STAMP_LENGTH) --#define AIFIFO2_TIME_STAMP_CNTL 0x1598 --#define P_AIFIFO2_TIME_STAMP_CNTL \ -- CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_CNTL) --#define AIFIFO2_TIME_STAMP_SYNC_0 0x1599 --#define P_AIFIFO2_TIME_STAMP_SYNC_0 \ -- CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_SYNC_0) --#define AIFIFO2_TIME_STAMP_SYNC_1 0x159a --#define P_AIFIFO2_TIME_STAMP_SYNC_1 \ -- CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_SYNC_1) --#define AIFIFO2_TIME_STAMP_0 0x159b --#define P_AIFIFO2_TIME_STAMP_0 CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_0) --#define AIFIFO2_TIME_STAMP_1 0x159c --#define P_AIFIFO2_TIME_STAMP_1 CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_1) --#define AIFIFO2_TIME_STAMP_2 0x159d --#define P_AIFIFO2_TIME_STAMP_2 CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_2) --#define AIFIFO2_TIME_STAMP_3 0x159e --#define P_AIFIFO2_TIME_STAMP_3 CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_3) --#define AIFIFO2_TIME_STAMP_LENGTH 0x159f --#define P_AIFIFO2_TIME_STAMP_LENGTH \ -- CBUS_REG_ADDR(AIFIFO2_TIME_STAMP_LENGTH) --#define IEC958_TIME_STAMP_SYNC_0 0x15a1 --#define P_IEC958_TIME_STAMP_SYNC_0 \ -- CBUS_REG_ADDR(IEC958_TIME_STAMP_SYNC_0) --#define IEC958_TIME_STAMP_SYNC_1 0x15a2 --#define P_IEC958_TIME_STAMP_SYNC_1 \ -- CBUS_REG_ADDR(IEC958_TIME_STAMP_SYNC_1) --#define IEC958_TIME_STAMP_0 0x15a3 --#define P_IEC958_TIME_STAMP_0 CBUS_REG_ADDR(IEC958_TIME_STAMP_0) --#define IEC958_TIME_STAMP_1 0x15a4 --#define P_IEC958_TIME_STAMP_1 CBUS_REG_ADDR(IEC958_TIME_STAMP_1) --#define IEC958_TIME_STAMP_2 0x15a5 --#define P_IEC958_TIME_STAMP_2 CBUS_REG_ADDR(IEC958_TIME_STAMP_2) --#define IEC958_TIME_STAMP_3 0x15a6 --#define P_IEC958_TIME_STAMP_3 CBUS_REG_ADDR(IEC958_TIME_STAMP_3) --#define IEC958_TIME_STAMP_LENGTH 0x15a7 --#define P_IEC958_TIME_STAMP_LENGTH \ -- CBUS_REG_ADDR(IEC958_TIME_STAMP_LENGTH) --#define AIU_MEM_AIFIFO2_MEM_CTL 0x15a8 --#define P_AIU_MEM_AIFIFO2_MEM_CTL \ -- CBUS_REG_ADDR(AIU_MEM_AIFIFO2_MEM_CTL) --#define AIU_I2S_CBUS_DDR_CNTL 0x15a9 --#define P_AIU_I2S_CBUS_DDR_CNTL \ -- CBUS_REG_ADDR(AIU_I2S_CBUS_DDR_CNTL) --#define AIU_I2S_CBUS_DDR_WDATA 0x15aa --#define P_AIU_I2S_CBUS_DDR_WDATA \ -- CBUS_REG_ADDR(AIU_I2S_CBUS_DDR_WDATA) --#define AIU_I2S_CBUS_DDR_ADDR 0x15ab --#define P_AIU_I2S_CBUS_DDR_ADDR \ -- CBUS_REG_ADDR(AIU_I2S_CBUS_DDR_ADDR) --#define GE2D_GEN_CTRL0 0x18a0 --#define P_GE2D_GEN_CTRL0 CBUS_REG_ADDR(GE2D_GEN_CTRL0) --#define GE2D_GEN_CTRL1 0x18a1 --#define P_GE2D_GEN_CTRL1 CBUS_REG_ADDR(GE2D_GEN_CTRL1) --#define GE2D_GEN_CTRL2 0x18a2 --#define P_GE2D_GEN_CTRL2 CBUS_REG_ADDR(GE2D_GEN_CTRL2) --#define GE2D_CMD_CTRL 0x18a3 --#define P_GE2D_CMD_CTRL CBUS_REG_ADDR(GE2D_CMD_CTRL) --#define GE2D_STATUS0 0x18a4 --#define P_GE2D_STATUS0 CBUS_REG_ADDR(GE2D_STATUS0) --#define GE2D_STATUS1 0x18a5 --#define P_GE2D_STATUS1 CBUS_REG_ADDR(GE2D_STATUS1) --#define GE2D_SRC1_DEF_COLOR 0x18a6 --#define P_GE2D_SRC1_DEF_COLOR CBUS_REG_ADDR(GE2D_SRC1_DEF_COLOR) --#define GE2D_SRC1_CLIPX_START_END 0x18a7 --#define P_GE2D_SRC1_CLIPX_START_END \ -- CBUS_REG_ADDR(GE2D_SRC1_CLIPX_START_END) --#define GE2D_SRC1_CLIPY_START_END 0x18a8 --#define P_GE2D_SRC1_CLIPY_START_END \ -- CBUS_REG_ADDR(GE2D_SRC1_CLIPY_START_END) --#define GE2D_SRC1_CANVAS 0x18a9 --#define P_GE2D_SRC1_CANVAS CBUS_REG_ADDR(GE2D_SRC1_CANVAS) --#define GE2D_SRC1_X_START_END 0x18aa --#define P_GE2D_SRC1_X_START_END \ -- CBUS_REG_ADDR(GE2D_SRC1_X_START_END) --#define GE2D_SRC1_Y_START_END 0x18ab --#define P_GE2D_SRC1_Y_START_END \ -- CBUS_REG_ADDR(GE2D_SRC1_Y_START_END) --#define GE2D_SRC1_LUT_ADDR 0x18ac --#define P_GE2D_SRC1_LUT_ADDR \ -- CBUS_REG_ADDR(GE2D_SRC1_LUT_ADDR) --#define GE2D_SRC1_LUT_DAT 0x18ad --#define P_GE2D_SRC1_LUT_DAT \ -- CBUS_REG_ADDR(GE2D_SRC1_LUT_DAT) --#define GE2D_SRC1_FMT_CTRL 0x18ae --#define P_GE2D_SRC1_FMT_CTRL \ -- CBUS_REG_ADDR(GE2D_SRC1_FMT_CTRL) --#define GE2D_SRC2_DEF_COLOR 0x18af --#define P_GE2D_SRC2_DEF_COLOR CBUS_REG_ADDR(GE2D_SRC2_DEF_COLOR) --#define GE2D_SRC2_CLIPX_START_END 0x18b0 --#define P_GE2D_SRC2_CLIPX_START_END \ -- CBUS_REG_ADDR(GE2D_SRC2_CLIPX_START_END) --#define GE2D_SRC2_CLIPY_START_END 0x18b1 --#define P_GE2D_SRC2_CLIPY_START_END \ -- CBUS_REG_ADDR(GE2D_SRC2_CLIPY_START_END) --#define GE2D_SRC2_X_START_END 0x18b2 --#define P_GE2D_SRC2_X_START_END \ -- CBUS_REG_ADDR(GE2D_SRC2_X_START_END) --#define GE2D_SRC2_Y_START_END 0x18b3 --#define P_GE2D_SRC2_Y_START_END \ -- CBUS_REG_ADDR(GE2D_SRC2_Y_START_END) --#define GE2D_DST_CLIPX_START_END 0x18b4 --#define P_GE2D_DST_CLIPX_START_END \ -- CBUS_REG_ADDR(GE2D_DST_CLIPX_START_END) --#define GE2D_DST_CLIPY_START_END 0x18b5 --#define P_GE2D_DST_CLIPY_START_END \ -- CBUS_REG_ADDR(GE2D_DST_CLIPY_START_END) --#define GE2D_DST_X_START_END 0x18b6 --#define P_GE2D_DST_X_START_END CBUS_REG_ADDR(GE2D_DST_X_START_END) --#define GE2D_DST_Y_START_END 0x18b7 --#define P_GE2D_DST_Y_START_END CBUS_REG_ADDR(GE2D_DST_Y_START_END) --#define GE2D_SRC2_DST_CANVAS 0x18b8 --#define P_GE2D_SRC2_DST_CANVAS CBUS_REG_ADDR(GE2D_SRC2_DST_CANVAS) --#define GE2D_VSC_PHASE_SLOPE 0x18ba --#define P_GE2D_VSC_PHASE_SLOPE CBUS_REG_ADDR(GE2D_VSC_PHASE_SLOPE) --#define GE2D_VSC_INI_CTRL 0x18bb --#define P_GE2D_VSC_INI_CTRL CBUS_REG_ADDR(GE2D_VSC_INI_CTRL) --#define GE2D_HSC_PHASE_SLOPE 0x18bd --#define P_GE2D_HSC_PHASE_SLOPE CBUS_REG_ADDR(GE2D_HSC_PHASE_SLOPE) --#define GE2D_HSC_INI_CTRL 0x18be --#define P_GE2D_HSC_INI_CTRL CBUS_REG_ADDR(GE2D_HSC_INI_CTRL) --#define GE2D_HSC_ADV_CTRL 0x18bf --#define P_GE2D_HSC_ADV_CTRL CBUS_REG_ADDR(GE2D_HSC_ADV_CTRL) --#define GE2D_SC_MISC_CTRL 0x18c0 --#define P_GE2D_SC_MISC_CTRL CBUS_REG_ADDR(GE2D_SC_MISC_CTRL) --#define GE2D_VSC_NRND_POINT 0x18c1 --#define P_GE2D_VSC_NRND_POINT CBUS_REG_ADDR(GE2D_VSC_NRND_POINT) --#define GE2D_VSC_NRND_PHASE 0x18c2 --#define P_GE2D_VSC_NRND_PHASE CBUS_REG_ADDR(GE2D_VSC_NRND_PHASE) --#define GE2D_HSC_NRND_POINT 0x18c3 --#define P_GE2D_HSC_NRND_POINT CBUS_REG_ADDR(GE2D_HSC_NRND_POINT) --#define GE2D_HSC_NRND_PHASE 0x18c4 --#define P_GE2D_HSC_NRND_PHASE CBUS_REG_ADDR(GE2D_HSC_NRND_PHASE) --#define GE2D_MATRIX_COEF00_01 0x18c6 --#define P_GE2D_MATRIX_COEF00_01 \ -- CBUS_REG_ADDR(GE2D_MATRIX_COEF00_01) --#define GE2D_MATRIX_COEF02_10 0x18c7 --#define P_GE2D_MATRIX_COEF02_10 \ -- CBUS_REG_ADDR(GE2D_MATRIX_COEF02_10) --#define GE2D_MATRIX_COEF11_12 0x18c8 --#define P_GE2D_MATRIX_COEF11_12 \ -- CBUS_REG_ADDR(GE2D_MATRIX_COEF11_12) --#define GE2D_MATRIX_COEF20_21 0x18c9 --#define P_GE2D_MATRIX_COEF20_21 \ -- CBUS_REG_ADDR(GE2D_MATRIX_COEF20_21) --#define GE2D_MATRIX_COEF22_CTRL 0x18ca --#define P_GE2D_MATRIX_COEF22_CTRL \ -- CBUS_REG_ADDR(GE2D_MATRIX_COEF22_CTRL) --#define GE2D_MATRIX_OFFSET 0x18cb --#define P_GE2D_MATRIX_OFFSET CBUS_REG_ADDR(GE2D_MATRIX_OFFSET) --#define GE2D_ALU_OP_CTRL 0x18cc --#define P_GE2D_ALU_OP_CTRL CBUS_REG_ADDR(GE2D_ALU_OP_CTRL) --#define GE2D_ALU_CONST_COLOR 0x18cd --#define P_GE2D_ALU_CONST_COLOR CBUS_REG_ADDR(GE2D_ALU_CONST_COLOR) --#define GE2D_SRC1_KEY 0x18ce --#define P_GE2D_SRC1_KEY CBUS_REG_ADDR(GE2D_SRC1_KEY) --#define GE2D_SRC1_KEY_MASK 0x18cf --#define P_GE2D_SRC1_KEY_MASK CBUS_REG_ADDR(GE2D_SRC1_KEY_MASK) --#define GE2D_SRC2_KEY 0x18d0 --#define P_GE2D_SRC2_KEY CBUS_REG_ADDR(GE2D_SRC2_KEY) --#define GE2D_SRC2_KEY_MASK 0x18d1 --#define P_GE2D_SRC2_KEY_MASK CBUS_REG_ADDR(GE2D_SRC2_KEY_MASK) --#define GE2D_DST_BITMASK 0x18d2 --#define P_GE2D_DST_BITMASK CBUS_REG_ADDR(GE2D_DST_BITMASK) --#define GE2D_DP_ONOFF_CTRL 0x18d3 --#define P_GE2D_DP_ONOFF_CTRL CBUS_REG_ADDR(GE2D_DP_ONOFF_CTRL) --#define GE2D_SCALE_COEF_IDX 0x18d4 --#define P_GE2D_SCALE_COEF_IDX CBUS_REG_ADDR(GE2D_SCALE_COEF_IDX) --#define GE2D_SCALE_COEF 0x18d5 --#define P_GE2D_SCALE_COEF CBUS_REG_ADDR(GE2D_SCALE_COEF) --#define GE2D_ANTIFLICK_CTRL0 0x18d8 --#define P_GE2D_ANTIFLICK_CTRL0 CBUS_REG_ADDR(GE2D_ANTIFLICK_CTRL0) --#define GE2D_ANTIFLICK_CTRL1 0x18d9 --#define P_GE2D_ANTIFLICK_CTRL1 CBUS_REG_ADDR(GE2D_ANTIFLICK_CTRL1) --#define GE2D_ANTIFLICK_COLOR_FILT0 0x18da --#define P_GE2D_ANTIFLICK_COLOR_FILT0 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_COLOR_FILT0) --#define GE2D_ANTIFLICK_COLOR_FILT1 0x18db --#define P_GE2D_ANTIFLICK_COLOR_FILT1 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_COLOR_FILT1) --#define GE2D_ANTIFLICK_COLOR_FILT2 0x18dc --#define P_GE2D_ANTIFLICK_COLOR_FILT2 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_COLOR_FILT2) --#define GE2D_ANTIFLICK_COLOR_FILT3 0x18dd --#define P_GE2D_ANTIFLICK_COLOR_FILT3 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_COLOR_FILT3) --#define GE2D_ANTIFLICK_ALPHA_FILT0 0x18de --#define P_GE2D_ANTIFLICK_ALPHA_FILT0 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_ALPHA_FILT0) --#define GE2D_ANTIFLICK_ALPHA_FILT1 0x18df --#define P_GE2D_ANTIFLICK_ALPHA_FILT1 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_ALPHA_FILT1) --#define GE2D_ANTIFLICK_ALPHA_FILT2 0x18e0 --#define P_GE2D_ANTIFLICK_ALPHA_FILT2 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_ALPHA_FILT2) --#define GE2D_ANTIFLICK_ALPHA_FILT3 0x18e1 --#define P_GE2D_ANTIFLICK_ALPHA_FILT3 \ -- CBUS_REG_ADDR(GE2D_ANTIFLICK_ALPHA_FILT3) --#define GE2D_SRC1_RANGE_MAP_Y_CTRL 0x18e3 --#define P_GE2D_SRC1_RANGE_MAP_Y_CTRL \ -- CBUS_REG_ADDR(GE2D_SRC1_RANGE_MAP_Y_CTRL) --#define GE2D_SRC1_RANGE_MAP_CB_CTRL 0x18e4 --#define P_GE2D_SRC1_RANGE_MAP_CB_CTRL \ -- CBUS_REG_ADDR(GE2D_SRC1_RANGE_MAP_CB_CTRL) --#define GE2D_SRC1_RANGE_MAP_CR_CTRL 0x18e5 --#define P_GE2D_SRC1_RANGE_MAP_CR_CTRL \ -- CBUS_REG_ADDR(GE2D_SRC1_RANGE_MAP_CR_CTRL) --#define GE2D_ARB_BURST_NUM 0x18e6 --#define P_GE2D_ARB_BURST_NUM CBUS_REG_ADDR(GE2D_ARB_BURST_NUM) --#define GE2D_TID_TOKEN 0x18e7 --#define P_GE2D_TID_TOKEN CBUS_REG_ADDR(GE2D_TID_TOKEN) --#define GE2D_GEN_CTRL3 0x18e8 --#define P_GE2D_GEN_CTRL3 CBUS_REG_ADDR(GE2D_GEN_CTRL3) --#define GE2D_STATUS2 0x18e9 --#define P_GE2D_STATUS2 CBUS_REG_ADDR(GE2D_STATUS2) --#define GE2D_GEN_CTRL4 0x18ea --#define P_GE2D_GEN_CTRL4 CBUS_REG_ADDR(GE2D_GEN_CTRL4) --#define AUDIO_COP_CTL2 0x1f01 --#define P_AUDIO_COP_CTL2 CBUS_REG_ADDR(AUDIO_COP_CTL2) --#define OPERAND_M_CTL 0x1f02 --#define P_OPERAND_M_CTL CBUS_REG_ADDR(OPERAND_M_CTL) --#define OPERAND1_ADDR 0x1f03 --#define P_OPERAND1_ADDR CBUS_REG_ADDR(OPERAND1_ADDR) --#define OPERAND2_ADDR 0x1f04 --#define P_OPERAND2_ADDR CBUS_REG_ADDR(OPERAND2_ADDR) --#define RESULT_M_CTL 0x1f05 --#define P_RESULT_M_CTL CBUS_REG_ADDR(RESULT_M_CTL) --#define RESULT1_ADDR 0x1f06 --#define P_RESULT1_ADDR CBUS_REG_ADDR(RESULT1_ADDR) --#define RESULT2_ADDR 0x1f07 --#define P_RESULT2_ADDR CBUS_REG_ADDR(RESULT2_ADDR) --#define ADD_SHFT_CTL 0x1f08 --#define P_ADD_SHFT_CTL CBUS_REG_ADDR(ADD_SHFT_CTL) --#define OPERAND_ONE_H 0x1f09 --#define P_OPERAND_ONE_H CBUS_REG_ADDR(OPERAND_ONE_H) --#define OPERAND_ONE_L 0x1f0a --#define P_OPERAND_ONE_L CBUS_REG_ADDR(OPERAND_ONE_L) --#define OPERAND_TWO_H 0x1f0b --#define P_OPERAND_TWO_H CBUS_REG_ADDR(OPERAND_TWO_H) --#define OPERAND_TWO_L 0x1f0c --#define P_OPERAND_TWO_L CBUS_REG_ADDR(OPERAND_TWO_L) --#define RESULT_H 0x1f0d --#define P_RESULT_H CBUS_REG_ADDR(RESULT_H) --#define RESULT_M 0x1f0e --#define P_RESULT_M CBUS_REG_ADDR(RESULT_M) --#define RESULT_L 0x1f0f --#define P_RESULT_L CBUS_REG_ADDR(RESULT_L) --#define WMEM_R_PTR 0x1f10 --#define P_WMEM_R_PTR CBUS_REG_ADDR(WMEM_R_PTR) --#define WMEM_W_PTR 0x1f11 --#define P_WMEM_W_PTR CBUS_REG_ADDR(WMEM_W_PTR) --#define AUDIO_LAYER 0x1f20 --#define P_AUDIO_LAYER CBUS_REG_ADDR(AUDIO_LAYER) --#define AC3_DECODING 0x1f21 --#define P_AC3_DECODING CBUS_REG_ADDR(AC3_DECODING) --#define AC3_DYNAMIC 0x1f22 --#define P_AC3_DYNAMIC CBUS_REG_ADDR(AC3_DYNAMIC) --#define AC3_MELODY 0x1f23 --#define P_AC3_MELODY CBUS_REG_ADDR(AC3_MELODY) --#define AC3_VOCAL 0x1f24 --#define P_AC3_VOCAL CBUS_REG_ADDR(AC3_VOCAL) --#define ASSIST_AMR_SCRATCH0 0x1f4f --#define P_ASSIST_AMR_SCRATCH0 CBUS_REG_ADDR(ASSIST_AMR_SCRATCH0) --#define ASSIST_AMR_SCRATCH1 0x1f50 --#define P_ASSIST_AMR_SCRATCH1 CBUS_REG_ADDR(ASSIST_AMR_SCRATCH1) --#define ASSIST_AMR_SCRATCH2 0x1f51 --#define P_ASSIST_AMR_SCRATCH2 CBUS_REG_ADDR(ASSIST_AMR_SCRATCH2) --#define ASSIST_AMR_SCRATCH3 0x1f52 --#define P_ASSIST_AMR_SCRATCH3 CBUS_REG_ADDR(ASSIST_AMR_SCRATCH3) --#define ASSIST_HW_REV 0x1f53 --#define P_ASSIST_HW_REV CBUS_REG_ADDR(ASSIST_HW_REV) --#define ASSIST_POR_CONFIG 0x1f55 --#define P_ASSIST_POR_CONFIG CBUS_REG_ADDR(ASSIST_POR_CONFIG) --#define ASSIST_SPARE16_REG1 0x1f56 --#define P_ASSIST_SPARE16_REG1 CBUS_REG_ADDR(ASSIST_SPARE16_REG1) --#define ASSIST_SPARE16_REG2 0x1f57 --#define P_ASSIST_SPARE16_REG2 CBUS_REG_ADDR(ASSIST_SPARE16_REG2) --#define ASSIST_SPARE8_REG1 0x1f58 --#define P_ASSIST_SPARE8_REG1 CBUS_REG_ADDR(ASSIST_SPARE8_REG1) --#define ASSIST_SPARE8_REG2 0x1f59 --#define P_ASSIST_SPARE8_REG2 CBUS_REG_ADDR(ASSIST_SPARE8_REG2) --#define ASSIST_SPARE8_REG3 0x1f5a --#define P_ASSIST_SPARE8_REG3 CBUS_REG_ADDR(ASSIST_SPARE8_REG3) --#define AC3_CTRL_REG1 0x1f5b --#define P_AC3_CTRL_REG1 CBUS_REG_ADDR(AC3_CTRL_REG1) --#define AC3_CTRL_REG2 0x1f5c --#define P_AC3_CTRL_REG2 CBUS_REG_ADDR(AC3_CTRL_REG2) --#define AC3_CTRL_REG3 0x1f5d --#define P_AC3_CTRL_REG3 CBUS_REG_ADDR(AC3_CTRL_REG3) --#define AC3_CTRL_REG4 0x1f5e --#define P_AC3_CTRL_REG4 CBUS_REG_ADDR(AC3_CTRL_REG4) --#define ASSIST_GEN_CNTL 0x1f68 --#define P_ASSIST_GEN_CNTL CBUS_REG_ADDR(ASSIST_GEN_CNTL) --#define EE_ASSIST_MBOX0_IRQ_REG 0x1f70 -- --#define EE_ASSIST_MBOX3_MASK 0x1f7e --#define P_EE_ASSIST_MBOX3_MASK CBUS_REG_ADDR(EE_ASSIST_MBOX3_MASK) --#define AUDIN_SPDIF_MODE 0x2800 --#define P_AUDIN_SPDIF_MODE CBUS_REG_ADDR(AUDIN_SPDIF_MODE) --#define AUDIN_SPDIF_MISC 0x2804 --#define P_AUDIN_SPDIF_MISC CBUS_REG_ADDR(AUDIN_SPDIF_MISC) --#define AUDIN_SPDIF_END 0x280f --#define P_AUDIN_SPDIF_END CBUS_REG_ADDR(AUDIN_SPDIF_END) --#define AUDIN_I2SIN_CTRL 0x2810 --#define P_AUDIN_I2SIN_CTRL CBUS_REG_ADDR(AUDIN_I2SIN_CTRL) --#define AUDIN_SOURCE_SEL 0x2811 --#define P_AUDIN_SOURCE_SEL CBUS_REG_ADDR(AUDIN_SOURCE_SEL) --#define AUDIN_DECODE_FORMAT 0x2812 --#define P_AUDIN_DECODE_FORMAT CBUS_REG_ADDR(AUDIN_DECODE_FORMAT) --#define AUDIN_DECODE_CONTROL_STATUS 0x2813 --#define P_AUDIN_DECODE_CONTROL_STATUS \ -- CBUS_REG_ADDR(AUDIN_DECODE_CONTROL_STATUS) --#define AUDIN_DECODE_CHANNEL_STATUS_A_0 0x2814 --#define P_AUDIN_DECODE_CHANNEL_STATUS_A_0 \ -- CBUS_REG_ADDR(AUDIN_DECODE_CHANNEL_STATUS_A_0) --#define AUDIN_DECODE_CHANNEL_STATUS_A_1 0x2815 --#define P_AUDIN_DECODE_CHANNEL_STATUS_A_1 \ -- CBUS_REG_ADDR(AUDIN_DECODE_CHANNEL_STATUS_A_1) --#define AUDIN_DECODE_CHANNEL_STATUS_A_2 0x2816 --#define P_AUDIN_DECODE_CHANNEL_STATUS_A_2 \ -- CBUS_REG_ADDR(AUDIN_DECODE_CHANNEL_STATUS_A_2) --#define AUDIN_DECODE_CHANNEL_STATUS_A_3 0x2817 --#define P_AUDIN_DECODE_CHANNEL_STATUS_A_3 \ -- CBUS_REG_ADDR(AUDIN_DECODE_CHANNEL_STATUS_A_3) --#define AUDIN_DECODE_CHANNEL_STATUS_A_4 0x2818 --#define P_AUDIN_DECODE_CHANNEL_STATUS_A_4 \ -- CBUS_REG_ADDR(AUDIN_DECODE_CHANNEL_STATUS_A_4) --#define AUDIN_DECODE_CHANNEL_STATUS_A_5 0x2819 --#define P_AUDIN_DECODE_CHANNEL_STATUS_A_5 \ -- CBUS_REG_ADDR(AUDIN_DECODE_CHANNEL_STATUS_A_5) --#define AUDIN_FIFO0_START 0x2820 --#define P_AUDIN_FIFO0_START CBUS_REG_ADDR(AUDIN_FIFO0_START) --#define AUDIN_FIFO0_END 0x2821 --#define P_AUDIN_FIFO0_END CBUS_REG_ADDR(AUDIN_FIFO0_END) --#define AUDIN_FIFO0_PTR 0x2822 --#define P_AUDIN_FIFO0_PTR CBUS_REG_ADDR(AUDIN_FIFO0_PTR) --#define AUDIN_FIFO0_INTR 0x2823 --#define P_AUDIN_FIFO0_INTR CBUS_REG_ADDR(AUDIN_FIFO0_INTR) --#define AUDIN_FIFO0_RDPTR 0x2824 --#define P_AUDIN_FIFO0_RDPTR CBUS_REG_ADDR(AUDIN_FIFO0_RDPTR) --#define AUDIN_FIFO0_CTRL 0x2825 --#define P_AUDIN_FIFO0_CTRL CBUS_REG_ADDR(AUDIN_FIFO0_CTRL) --#define AUDIN_FIFO0_CTRL1 0x2826 --#define P_AUDIN_FIFO0_CTRL1 CBUS_REG_ADDR(AUDIN_FIFO0_CTRL1) --#define AUDIN_FIFO0_LVL0 0x2827 --#define P_AUDIN_FIFO0_LVL0 CBUS_REG_ADDR(AUDIN_FIFO0_LVL0) --#define AUDIN_FIFO0_LVL1 0x2828 --#define P_AUDIN_FIFO0_LVL1 CBUS_REG_ADDR(AUDIN_FIFO0_LVL1) --#define AUDIN_FIFO0_LVL2 0x2829 --#define P_AUDIN_FIFO0_LVL2 CBUS_REG_ADDR(AUDIN_FIFO0_LVL2) --#define AUDIN_FIFO0_REQID 0x2830 --#define P_AUDIN_FIFO0_REQID CBUS_REG_ADDR(AUDIN_FIFO0_REQID) --#define AUDIN_FIFO0_WRAP 0x2831 --#define P_AUDIN_FIFO0_WRAP CBUS_REG_ADDR(AUDIN_FIFO0_WRAP) --#define AUDIN_FIFO1_START 0x2833 --#define P_AUDIN_FIFO1_START CBUS_REG_ADDR(AUDIN_FIFO1_START) --#define AUDIN_FIFO1_END 0x2834 --#define P_AUDIN_FIFO1_END CBUS_REG_ADDR(AUDIN_FIFO1_END) --#define AUDIN_FIFO1_PTR 0x2835 --#define P_AUDIN_FIFO1_PTR CBUS_REG_ADDR(AUDIN_FIFO1_PTR) --#define AUDIN_FIFO1_INTR 0x2836 --#define P_AUDIN_FIFO1_INTR CBUS_REG_ADDR(AUDIN_FIFO1_INTR) --#define AUDIN_FIFO1_RDPTR 0x2837 --#define P_AUDIN_FIFO1_RDPTR CBUS_REG_ADDR(AUDIN_FIFO1_RDPTR) --#define AUDIN_FIFO1_CTRL 0x2838 --#define P_AUDIN_FIFO1_CTRL CBUS_REG_ADDR(AUDIN_FIFO1_CTRL) --#define AUDIN_FIFO1_CTRL1 0x2839 --#define P_AUDIN_FIFO1_CTRL1 CBUS_REG_ADDR(AUDIN_FIFO1_CTRL1) --#define AUDIN_FIFO1_LVL0 0x2840 --#define P_AUDIN_FIFO1_LVL0 CBUS_REG_ADDR(AUDIN_FIFO1_LVL0) --#define AUDIN_FIFO1_LVL1 0x2841 --#define P_AUDIN_FIFO1_LVL1 CBUS_REG_ADDR(AUDIN_FIFO1_LVL1) --#define AUDIN_FIFO1_LVL2 0x2842 --#define P_AUDIN_FIFO1_LVL2 CBUS_REG_ADDR(AUDIN_FIFO1_LVL2) --#define AUDIN_FIFO1_REQID 0x2843 --#define P_AUDIN_FIFO1_REQID CBUS_REG_ADDR(AUDIN_FIFO1_REQID) --#define AUDIN_FIFO1_WRAP 0x2844 --#define P_AUDIN_FIFO1_WRAP CBUS_REG_ADDR(AUDIN_FIFO1_WRAP) --#define AUDIN_FIFO2_START 0x2845 --#define P_AUDIN_FIFO2_START CBUS_REG_ADDR(AUDIN_FIFO2_START) --#define AUDIN_FIFO2_END 0x2846 --#define P_AUDIN_FIFO2_END CBUS_REG_ADDR(AUDIN_FIFO2_END) --#define AUDIN_FIFO2_PTR 0x2847 --#define P_AUDIN_FIFO2_PTR CBUS_REG_ADDR(AUDIN_FIFO2_PTR) --#define AUDIN_FIFO2_INTR 0x2848 --#define P_AUDIN_FIFO2_INTR CBUS_REG_ADDR(AUDIN_FIFO2_INTR) --#define AUDIN_FIFO2_RDPTR 0x2849 --#define P_AUDIN_FIFO2_RDPTR CBUS_REG_ADDR(AUDIN_FIFO2_RDPTR) --#define AUDIN_FIFO2_CTRL 0x284a --#define P_AUDIN_FIFO2_CTRL CBUS_REG_ADDR(AUDIN_FIFO2_CTRL) --#define AUDIN_FIFO2_CTRL1 0x284b --#define P_AUDIN_FIFO2_CTRL1 CBUS_REG_ADDR(AUDIN_FIFO2_CTRL1) --#define AUDIN_FIFO2_LVL0 0x284c --#define P_AUDIN_FIFO2_LVL0 CBUS_REG_ADDR(AUDIN_FIFO2_LVL0) --#define AUDIN_FIFO2_LVL1 0x284d --#define P_AUDIN_FIFO2_LVL1 CBUS_REG_ADDR(AUDIN_FIFO2_LVL1) --#define AUDIN_FIFO2_LVL2 0x284e --#define P_AUDIN_FIFO2_LVL2 CBUS_REG_ADDR(AUDIN_FIFO2_LVL2) --#define AUDIN_FIFO2_REQID 0x284f --#define P_AUDIN_FIFO2_REQID CBUS_REG_ADDR(AUDIN_FIFO2_REQID) --#define AUDIN_FIFO2_WRAP 0x2850 --#define P_AUDIN_FIFO2_WRAP CBUS_REG_ADDR(AUDIN_FIFO2_WRAP) --#define AUDIN_INT_CTRL 0x2851 --#define P_AUDIN_INT_CTRL CBUS_REG_ADDR(AUDIN_INT_CTRL) --#define AUDIN_FIFO_INT 0x2852 --#define P_AUDIN_FIFO_INT CBUS_REG_ADDR(AUDIN_FIFO_INT) --#define PCMIN_CTRL0 0x2860 --#define P_PCMIN_CTRL0 CBUS_REG_ADDR(PCMIN_CTRL0) --#define PCMIN_CTRL1 0x2861 --#define P_PCMIN_CTRL1 CBUS_REG_ADDR(PCMIN_CTRL1) --#define PCMIN1_CTRL0 0x2862 --#define P_PCMIN1_CTRL0 CBUS_REG_ADDR(PCMIN1_CTRL0) --#define PCMIN1_CTRL1 0x2863 --#define P_PCMIN1_CTRL1 CBUS_REG_ADDR(PCMIN1_CTRL1) --#define PCMOUT_CTRL0 0x2870 --#define P_PCMOUT_CTRL0 CBUS_REG_ADDR(PCMOUT_CTRL0) --#define PCMOUT_CTRL1 0x2871 --#define P_PCMOUT_CTRL1 CBUS_REG_ADDR(PCMOUT_CTRL1) --#define PCMOUT_CTRL2 0x2872 --#define P_PCMOUT_CTRL2 CBUS_REG_ADDR(PCMOUT_CTRL2) --#define PCMOUT_CTRL3 0x2873 --#define P_PCMOUT_CTRL3 CBUS_REG_ADDR(PCMOUT_CTRL3) --#define PCMOUT1_CTRL0 0x2874 --#define P_PCMOUT1_CTRL0 CBUS_REG_ADDR(PCMOUT1_CTRL0) --#define PCMOUT1_CTRL1 0x2875 --#define P_PCMOUT1_CTRL1 CBUS_REG_ADDR(PCMOUT1_CTRL1) --#define PCMOUT1_CTRL2 0x2876 --#define P_PCMOUT1_CTRL2 CBUS_REG_ADDR(PCMOUT1_CTRL2) --#define PCMOUT1_CTRL3 0x2877 --#define P_PCMOUT1_CTRL3 CBUS_REG_ADDR(PCMOUT1_CTRL3) --#define AUDOUT_CTRL 0x2880 --#define P_AUDOUT_CTRL CBUS_REG_ADDR(AUDOUT_CTRL) --#define AUDOUT_CTRL1 0x2881 --#define P_AUDOUT_CTRL1 CBUS_REG_ADDR(AUDOUT_CTRL1) --#define AUDOUT_BUF0_STA 0x2882 --#define P_AUDOUT_BUF0_STA CBUS_REG_ADDR(AUDOUT_BUF0_STA) --#define AUDOUT_BUF0_EDA 0x2883 --#define P_AUDOUT_BUF0_EDA CBUS_REG_ADDR(AUDOUT_BUF0_EDA) --#define AUDOUT_BUF0_WPTR 0x2884 --#define P_AUDOUT_BUF0_WPTR CBUS_REG_ADDR(AUDOUT_BUF0_WPTR) --#define AUDOUT_BUF1_STA 0x2885 --#define P_AUDOUT_BUF1_STA CBUS_REG_ADDR(AUDOUT_BUF1_STA) --#define AUDOUT_BUF1_EDA 0x2886 --#define P_AUDOUT_BUF1_EDA CBUS_REG_ADDR(AUDOUT_BUF1_EDA) --#define AUDOUT_BUF1_WPTR 0x2887 --#define P_AUDOUT_BUF1_WPTR CBUS_REG_ADDR(AUDOUT_BUF1_WPTR) --#define AUDOUT_FIFO_RPTR 0x2888 --#define P_AUDOUT_FIFO_RPTR CBUS_REG_ADDR(AUDOUT_FIFO_RPTR) --#define AUDOUT_INTR_PTR 0x2889 --#define P_AUDOUT_INTR_PTR CBUS_REG_ADDR(AUDOUT_INTR_PTR) --#define AUDOUT_FIFO_STS 0x288a --#define P_AUDOUT_FIFO_STS CBUS_REG_ADDR(AUDOUT_FIFO_STS) --#define AUDOUT1_CTRL 0x2890 --#define P_AUDOUT1_CTRL CBUS_REG_ADDR(AUDOUT1_CTRL) --#define AUDOUT1_CTRL1 0x2891 --#define P_AUDOUT1_CTRL1 CBUS_REG_ADDR(AUDOUT1_CTRL1) --#define AUDOUT1_BUF0_STA 0x2892 --#define P_AUDOUT1_BUF0_STA CBUS_REG_ADDR(AUDOUT1_BUF0_STA) --#define AUDOUT1_BUF0_EDA 0x2893 --#define P_AUDOUT1_BUF0_EDA CBUS_REG_ADDR(AUDOUT1_BUF0_EDA) --#define AUDOUT1_BUF0_WPTR 0x2894 --#define P_AUDOUT1_BUF0_WPTR CBUS_REG_ADDR(AUDOUT1_BUF0_WPTR) --#define AUDOUT1_BUF1_STA 0x2895 --#define P_AUDOUT1_BUF1_STA CBUS_REG_ADDR(AUDOUT1_BUF1_STA) --#define AUDOUT1_BUF1_EDA 0x2896 --#define P_AUDOUT1_BUF1_EDA CBUS_REG_ADDR(AUDOUT1_BUF1_EDA) --#define AUDOUT1_BUF1_WPTR 0x2897 --#define P_AUDOUT1_BUF1_WPTR CBUS_REG_ADDR(AUDOUT1_BUF1_WPTR) --#define AUDOUT1_FIFO_RPTR 0x2898 --#define P_AUDOUT1_FIFO_RPTR CBUS_REG_ADDR(AUDOUT1_FIFO_RPTR) --#define AUDOUT1_INTR_PTR 0x2899 --#define P_AUDOUT1_INTR_PTR CBUS_REG_ADDR(AUDOUT1_INTR_PTR) --#define AUDOUT1_FIFO_STS 0x289a --#define P_AUDOUT1_FIFO_STS CBUS_REG_ADDR(AUDOUT1_FIFO_STS) --#define AUDIN_HDMI_MEAS_CTRL 0x28a0 --#define P_AUDIN_HDMI_MEAS_CTRL CBUS_REG_ADDR(AUDIN_HDMI_MEAS_CTRL) --#define AUDIN_HDMI_MEAS_CYCLES_M1 0x28a1 --#define AUDIN_FIFO0_PIO_STS 0x28b0 --#define P_AUDIN_FIFO0_PIO_STS CBUS_REG_ADDR(AUDIN_FIFO0_PIO_STS) --#define AUDIN_FIFO0_PIO_RDL 0x28b1 --#define P_AUDIN_FIFO0_PIO_RDL CBUS_REG_ADDR(AUDIN_FIFO0_PIO_RDL) --#define AUDIN_FIFO0_PIO_RDH 0x28b2 --#define P_AUDIN_FIFO0_PIO_RDH CBUS_REG_ADDR(AUDIN_FIFO0_PIO_RDH) --#define AUDIN_FIFO1_PIO_STS 0x28b3 --#define P_AUDIN_FIFO1_PIO_STS CBUS_REG_ADDR(AUDIN_FIFO1_PIO_STS) --#define AUDIN_FIFO1_PIO_RDL 0x28b4 --#define P_AUDIN_FIFO1_PIO_RDL CBUS_REG_ADDR(AUDIN_FIFO1_PIO_RDL) --#define AUDIN_FIFO1_PIO_RDH 0x28b5 --#define P_AUDIN_FIFO1_PIO_RDH CBUS_REG_ADDR(AUDIN_FIFO1_PIO_RDH) --#define AUDIN_FIFO2_PIO_STS 0x28b6 --#define P_AUDIN_FIFO2_PIO_STS CBUS_REG_ADDR(AUDIN_FIFO2_PIO_STS) --#define AUDIN_FIFO2_PIO_RDL 0x28b7 --#define P_AUDIN_FIFO2_PIO_RDL CBUS_REG_ADDR(AUDIN_FIFO2_PIO_RDL) --#define AUDIN_FIFO2_PIO_RDH 0x28b8 --#define P_AUDIN_FIFO2_PIO_RDH CBUS_REG_ADDR(AUDIN_FIFO2_PIO_RDH) --#define AUDOUT_FIFO_PIO_STS 0x28b9 --#define P_AUDOUT_FIFO_PIO_STS CBUS_REG_ADDR(AUDOUT_FIFO_PIO_STS) --#define AUDOUT_FIFO_PIO_WRL 0x28ba --#define P_AUDOUT_FIFO_PIO_WRL CBUS_REG_ADDR(AUDOUT_FIFO_PIO_WRL) --#define AUDOUT_FIFO_PIO_WRH 0x28bb --#define P_AUDOUT_FIFO_PIO_WRH CBUS_REG_ADDR(AUDOUT_FIFO_PIO_WRH) --#define AUDOUT1_FIFO_PIO_STS 0x28bc --#define P_AUDOUT1_FIFO_PIO_STS CBUS_REG_ADDR(AUDOUT1_FIFO_PIO_STS) --#define AUDOUT1_FIFO_PIO_WRL 0x28bd --#define P_AUDOUT1_FIFO_PIO_WRL CBUS_REG_ADDR(AUDOUT1_FIFO_PIO_WRL) --#define AUDOUT1_FIFO_PIO_WRH 0x28be --#define P_AUDOUT1_FIFO_PIO_WRH CBUS_REG_ADDR(AUDOUT1_FIFO_PIO_WRH) --#define AUDIN_ADDR_END 0x28bf --#define P_AUDIN_ADDR_END CBUS_REG_ADDR(AUDIN_ADDR_END) --#define VDIN_SCALE_COEF_IDX 0x1200 --#define P_VDIN_SCALE_COEF_IDX VCBUS_REG_ADDR(VDIN_SCALE_COEF_IDX) --#define VDIN_SCALE_COEF 0x1201 --#define P_VDIN_SCALE_COEF VCBUS_REG_ADDR(VDIN_SCALE_COEF) --#define VDIN_COM_CTRL0 0x1202 --#define P_VDIN_COM_CTRL0 VCBUS_REG_ADDR(VDIN_COM_CTRL0) --#define VDIN_ACTIVE_MAX_PIX_CNT_STATUS 0x1203 --#define VDIN_LCNT_STATUS 0x1204 --#define P_VDIN_LCNT_STATUS VCBUS_REG_ADDR(VDIN_LCNT_STATUS) --#define VDIN_COM_STATUS0 0x1205 --#define P_VDIN_COM_STATUS0 VCBUS_REG_ADDR(VDIN_COM_STATUS0) --#define VDIN_COM_STATUS1 0x1206 --#define P_VDIN_COM_STATUS1 VCBUS_REG_ADDR(VDIN_COM_STATUS1) --#define VDIN_LCNT_SHADOW_STATUS 0x1207 --#define VDIN_ASFIFO_CTRL0 0x1208 --#define P_VDIN_ASFIFO_CTRL0 VCBUS_REG_ADDR(VDIN_ASFIFO_CTRL0) --#define VDIN_ASFIFO_CTRL1 0x1209 --#define P_VDIN_ASFIFO_CTRL1 VCBUS_REG_ADDR(VDIN_ASFIFO_CTRL1) --#define VDIN_WIDTHM1I_WIDTHM1O 0x120a --#define VDIN_SC_MISC_CTRL 0x120b --#define P_VDIN_SC_MISC_CTRL VCBUS_REG_ADDR(VDIN_SC_MISC_CTRL) --#define VDIN_HSC_PHASE_STEP 0x120c --#define P_VDIN_HSC_PHASE_STEP VCBUS_REG_ADDR(VDIN_HSC_PHASE_STEP) --#define VDIN_HSC_INI_CTRL 0x120d --#define P_VDIN_HSC_INI_CTRL VCBUS_REG_ADDR(VDIN_HSC_INI_CTRL) --#define VDIN_COM_STATUS2 0x120e --#define P_VDIN_COM_STATUS2 VCBUS_REG_ADDR(VDIN_COM_STATUS2) --#define VDIN_ASFIFO_CTRL2 0x120f --#define P_VDIN_ASFIFO_CTRL2 VCBUS_REG_ADDR(VDIN_ASFIFO_CTRL2) --#define VDIN_MATRIX_CTRL 0x1210 --#define P_VDIN_MATRIX_CTRL VCBUS_REG_ADDR(VDIN_MATRIX_CTRL) --#define VDIN_LFIFO_CTRL 0x121a --#define P_VDIN_LFIFO_CTRL VCBUS_REG_ADDR(VDIN_LFIFO_CTRL) --#define VDIN_COM_GCLK_CTRL 0x121b --#define P_VDIN_COM_GCLK_CTRL VCBUS_REG_ADDR(VDIN_COM_GCLK_CTRL) --#define VDIN_INTF_WIDTHM1 0x121c --#define P_VDIN_INTF_WIDTHM1 VCBUS_REG_ADDR(VDIN_INTF_WIDTHM1) --#define VDIN_WR_CTRL2 0x121f --#define P_VDIN_WR_CTRL2 VCBUS_REG_ADDR(VDIN_WR_CTRL2) --#define VDIN_WR_CTRL 0x1220 --#define P_VDIN_WR_CTRL VCBUS_REG_ADDR(VDIN_WR_CTRL) --#define VDIN_WR_H_START_END 0x1221 --#define P_VDIN_WR_H_START_END VCBUS_REG_ADDR(VDIN_WR_H_START_END) --#define VDIN_WR_V_START_END 0x1222 --#define P_VDIN_WR_V_START_END VCBUS_REG_ADDR(VDIN_WR_V_START_END) --#define VDIN_VSC_PHASE_STEP 0x1223 --#define P_VDIN_VSC_PHASE_STEP VCBUS_REG_ADDR(VDIN_VSC_PHASE_STEP) --#define VDIN_VSC_INI_CTRL 0x1224 --#define P_VDIN_VSC_INI_CTRL VCBUS_REG_ADDR(VDIN_VSC_INI_CTRL) --#define VDIN_SCIN_HEIGHTM1 0x1225 --#define P_VDIN_SCIN_HEIGHTM1 VCBUS_REG_ADDR(VDIN_SCIN_HEIGHTM1) --#define VDIN_DUMMY_DATA 0x1226 --#define P_VDIN_DUMMY_DATA VCBUS_REG_ADDR(VDIN_DUMMY_DATA) --#define VDIN_HIST_MAX_MIN 0x1233 --#define P_VDIN_HIST_MAX_MIN VCBUS_REG_ADDR(VDIN_HIST_MAX_MIN) --#define VDIN_HIST_SPL_VAL 0x1234 --#define P_VDIN_HIST_SPL_VAL VCBUS_REG_ADDR(VDIN_HIST_SPL_VAL) --#define VDIN_HIST_SPL_PIX_CNT 0x1235 --#define P_VDIN_HIST_CHROMA_SUM VCBUS_REG_ADDR(VDIN_HIST_CHROMA_SUM) --#define VDIN_DNLP_HIST00 0x1237 --#define P_VDIN_DNLP_HIST00 VCBUS_REG_ADDR(VDIN_DNLP_HIST00) --#define VDIN_DNLP_HIST01 0x1238 --#define P_VDIN_DNLP_HIST01 VCBUS_REG_ADDR(VDIN_DNLP_HIST01) --#define VDIN_DNLP_HIST02 0x1239 --#define P_VDIN_DNLP_HIST02 VCBUS_REG_ADDR(VDIN_DNLP_HIST02) --#define VDIN_DNLP_HIST03 0x123a --#define P_VDIN_DNLP_HIST03 VCBUS_REG_ADDR(VDIN_DNLP_HIST03) --#define VDIN_DNLP_HIST04 0x123b --#define P_VDIN_DNLP_HIST04 VCBUS_REG_ADDR(VDIN_DNLP_HIST04) --#define VDIN_DNLP_HIST05 0x123c --#define P_VDIN_DNLP_HIST05 VCBUS_REG_ADDR(VDIN_DNLP_HIST05) --#define VDIN_DNLP_HIST06 0x123d --#define P_VDIN_DNLP_HIST06 VCBUS_REG_ADDR(VDIN_DNLP_HIST06) --#define VDIN_DNLP_HIST07 0x123e --#define P_VDIN_DNLP_HIST07 VCBUS_REG_ADDR(VDIN_DNLP_HIST07) --#define VDIN_DNLP_HIST08 0x123f --#define P_VDIN_DNLP_HIST08 VCBUS_REG_ADDR(VDIN_DNLP_HIST08) --#define VDIN_DNLP_HIST09 0x1240 --#define P_VDIN_DNLP_HIST09 VCBUS_REG_ADDR(VDIN_DNLP_HIST09) --#define VDIN_DNLP_HIST10 0x1241 --#define P_VDIN_DNLP_HIST10 VCBUS_REG_ADDR(VDIN_DNLP_HIST10) --#define VDIN_DNLP_HIST11 0x1242 --#define P_VDIN_DNLP_HIST11 VCBUS_REG_ADDR(VDIN_DNLP_HIST11) --#define VDIN_DNLP_HIST12 0x1243 --#define P_VDIN_DNLP_HIST12 VCBUS_REG_ADDR(VDIN_DNLP_HIST12) --#define VDIN_DNLP_HIST13 0x1244 --#define P_VDIN_DNLP_HIST13 VCBUS_REG_ADDR(VDIN_DNLP_HIST13) --#define VDIN_DNLP_HIST14 0x1245 --#define P_VDIN_DNLP_HIST14 VCBUS_REG_ADDR(VDIN_DNLP_HIST14) --#define VDIN_DNLP_HIST15 0x1246 --#define P_VDIN_DNLP_HIST15 VCBUS_REG_ADDR(VDIN_DNLP_HIST15) --#define VDIN_DNLP_HIST16 0x1247 --#define P_VDIN_DNLP_HIST16 VCBUS_REG_ADDR(VDIN_DNLP_HIST16) --#define VDIN_DNLP_HIST17 0x1248 --#define P_VDIN_DNLP_HIST17 VCBUS_REG_ADDR(VDIN_DNLP_HIST17) --#define VDIN_DNLP_HIST18 0x1249 --#define P_VDIN_DNLP_HIST18 VCBUS_REG_ADDR(VDIN_DNLP_HIST18) --#define VDIN_DNLP_HIST19 0x124a --#define P_VDIN_DNLP_HIST19 VCBUS_REG_ADDR(VDIN_DNLP_HIST19) --#define VDIN_DNLP_HIST20 0x124b --#define P_VDIN_DNLP_HIST20 VCBUS_REG_ADDR(VDIN_DNLP_HIST20) --#define VDIN_DNLP_HIST21 0x124c --#define P_VDIN_DNLP_HIST21 VCBUS_REG_ADDR(VDIN_DNLP_HIST21) --#define VDIN_DNLP_HIST22 0x124d --#define P_VDIN_DNLP_HIST22 VCBUS_REG_ADDR(VDIN_DNLP_HIST22) --#define VDIN_DNLP_HIST23 0x124e --#define P_VDIN_DNLP_HIST23 VCBUS_REG_ADDR(VDIN_DNLP_HIST23) --#define VDIN_DNLP_HIST24 0x124f --#define P_VDIN_DNLP_HIST24 VCBUS_REG_ADDR(VDIN_DNLP_HIST24) --#define VDIN_DNLP_HIST25 0x1250 --#define P_VDIN_DNLP_HIST25 VCBUS_REG_ADDR(VDIN_DNLP_HIST25) --#define VDIN_DNLP_HIST26 0x1251 --#define P_VDIN_DNLP_HIST26 VCBUS_REG_ADDR(VDIN_DNLP_HIST26) --#define VDIN_DNLP_HIST27 0x1252 --#define P_VDIN_DNLP_HIST27 VCBUS_REG_ADDR(VDIN_DNLP_HIST27) --#define VDIN_DNLP_HIST28 0x1253 --#define P_VDIN_DNLP_HIST28 VCBUS_REG_ADDR(VDIN_DNLP_HIST28) --#define VDIN_DNLP_HIST29 0x1254 --#define P_VDIN_DNLP_HIST29 VCBUS_REG_ADDR(VDIN_DNLP_HIST29) --#define VDIN_DNLP_HIST30 0x1255 --#define P_VDIN_DNLP_HIST30 VCBUS_REG_ADDR(VDIN_DNLP_HIST30) --#define VDIN_DNLP_HIST31 0x1256 --#define P_VDIN_DNLP_HIST31 VCBUS_REG_ADDR(VDIN_DNLP_HIST31) -- --#define P_VDIN1_ASFIFO_CTRL3 VCBUS_REG_ADDR(VDIN1_ASFIFO_CTRL3) --#define VPP_DUMMY_DATA 0x1d00 --#define P_VPP_DUMMY_DATA VCBUS_REG_ADDR(VPP_DUMMY_DATA) --#define VPP_LINE_IN_LENGTH 0x1d01 --#define P_VPP_LINE_IN_LENGTH VCBUS_REG_ADDR(VPP_LINE_IN_LENGTH) --#define VPP_PIC_IN_HEIGHT 0x1d02 --#define P_VPP_PIC_IN_HEIGHT VCBUS_REG_ADDR(VPP_PIC_IN_HEIGHT) --#define VPP_SCALE_COEF_IDX 0x1d03 --#define P_VPP_SCALE_COEF_IDX VCBUS_REG_ADDR(VPP_SCALE_COEF_IDX) --#define VPP_SCALE_COEF 0x1d04 --#define P_VPP_SCALE_COEF VCBUS_REG_ADDR(VPP_SCALE_COEF) -- --#define VPP_VSC_PHASE_CTRL 0x1d0d --#define P_VPP_VSC_PHASE_CTRL VCBUS_REG_ADDR(VPP_VSC_PHASE_CTRL) --#define VPP_VSC_INI_PHASE 0x1d0e --#define P_VPP_VSC_INI_PHASE VCBUS_REG_ADDR(VPP_VSC_INI_PHASE) --#define VPP_HSC_REGION12_STARTP 0x1d10 -- --#define VPP_DUMMY_DATA1 0x1d69 --#define P_VPP_DUMMY_DATA1 VCBUS_REG_ADDR(VPP_DUMMY_DATA1) --#define VPP_GAINOFF_CTRL0 0x1d6a --#define P_VPP_GAINOFF_CTRL0 VCBUS_REG_ADDR(VPP_GAINOFF_CTRL0) --#define VPP_GAINOFF_CTRL1 0x1d6b --#define P_VPP_GAINOFF_CTRL1 VCBUS_REG_ADDR(VPP_GAINOFF_CTRL1) --#define VPP_GAINOFF_CTRL2 0x1d6c --#define P_VPP_GAINOFF_CTRL2 VCBUS_REG_ADDR(VPP_GAINOFF_CTRL2) --#define VPP_GAINOFF_CTRL3 0x1d6d --#define P_VPP_GAINOFF_CTRL3 VCBUS_REG_ADDR(VPP_GAINOFF_CTRL3) --#define VPP_GAINOFF_CTRL4 0x1d6e --#define P_VPP_GAINOFF_CTRL4 VCBUS_REG_ADDR(VPP_GAINOFF_CTRL4) --#define VPP_CHROMA_ADDR_PORT 0x1d70 --#define P_VPP_CHROMA_ADDR_PORT VCBUS_REG_ADDR(VPP_CHROMA_ADDR_PORT) --#define VPP_CHROMA_DATA_PORT 0x1d71 --#define P_VPP_CHROMA_DATA_PORT VCBUS_REG_ADDR(VPP_CHROMA_DATA_PORT) --#define VPP_GCLK_CTRL0 0x1d72 --#define P_VPP_GCLK_CTRL0 VCBUS_REG_ADDR(VPP_GCLK_CTRL0) --#define VPP_GCLK_CTRL1 0x1d73 --#define P_VPP_GCLK_CTRL1 VCBUS_REG_ADDR(VPP_GCLK_CTRL1) --#define VPP_SC_GCLK_CTRL 0x1d74 --#define P_VPP_SC_GCLK_CTRL VCBUS_REG_ADDR(VPP_SC_GCLK_CTRL) --#define VPP_MISC1 0x1d76 --#define P_VPP_MISC1 VCBUS_REG_ADDR(VPP_MISC1) --#define VPP_BLACKEXT_CTRL 0x1d80 --#define P_VPP_BLACKEXT_CTRL VCBUS_REG_ADDR(VPP_BLACKEXT_CTRL) --#define VPP_DNLP_CTRL_00 0x1d81 --#define P_VPP_DNLP_CTRL_00 VCBUS_REG_ADDR(VPP_DNLP_CTRL_00) --#define VPP_DNLP_CTRL_01 0x1d82 --#define P_VPP_DNLP_CTRL_01 VCBUS_REG_ADDR(VPP_DNLP_CTRL_01) --#define VPP_DNLP_CTRL_02 0x1d83 --#define P_VPP_DNLP_CTRL_02 VCBUS_REG_ADDR(VPP_DNLP_CTRL_02) --#define VPP_DNLP_CTRL_03 0x1d84 --#define P_VPP_DNLP_CTRL_03 VCBUS_REG_ADDR(VPP_DNLP_CTRL_03) --#define VPP_DNLP_CTRL_04 0x1d85 --#define P_VPP_DNLP_CTRL_04 VCBUS_REG_ADDR(VPP_DNLP_CTRL_04) --#define VPP_DNLP_CTRL_05 0x1d86 --#define P_VPP_DNLP_CTRL_05 VCBUS_REG_ADDR(VPP_DNLP_CTRL_05) --#define VPP_DNLP_CTRL_06 0x1d87 --#define P_VPP_DNLP_CTRL_06 VCBUS_REG_ADDR(VPP_DNLP_CTRL_06) --#define VPP_DNLP_CTRL_07 0x1d88 --#define P_VPP_DNLP_CTRL_07 VCBUS_REG_ADDR(VPP_DNLP_CTRL_07) --#define VPP_DNLP_CTRL_08 0x1d89 --#define P_VPP_DNLP_CTRL_08 VCBUS_REG_ADDR(VPP_DNLP_CTRL_08) --#define VPP_DNLP_CTRL_09 0x1d8a --#define P_VPP_DNLP_CTRL_09 VCBUS_REG_ADDR(VPP_DNLP_CTRL_09) --#define VPP_DNLP_CTRL_10 0x1d8b --#define P_VPP_DNLP_CTRL_10 VCBUS_REG_ADDR(VPP_DNLP_CTRL_10) --#define VPP_DNLP_CTRL_11 0x1d8c --#define P_VPP_DNLP_CTRL_11 VCBUS_REG_ADDR(VPP_DNLP_CTRL_11) --#define VPP_DNLP_CTRL_12 0x1d8d --#define P_VPP_DNLP_CTRL_12 VCBUS_REG_ADDR(VPP_DNLP_CTRL_12) --#define VPP_DNLP_CTRL_13 0x1d8e --#define P_VPP_DNLP_CTRL_13 VCBUS_REG_ADDR(VPP_DNLP_CTRL_13) --#define VPP_DNLP_CTRL_14 0x1d8f --#define P_VPP_DNLP_CTRL_14 VCBUS_REG_ADDR(VPP_DNLP_CTRL_14) --#define VPP_DNLP_CTRL_15 0x1d90 --#define P_VPP_DNLP_CTRL_15 VCBUS_REG_ADDR(VPP_DNLP_CTRL_15) --#define VPP_PEAKING_HGAIN 0x1d91 --#define P_VPP_PEAKING_HGAIN VCBUS_REG_ADDR(VPP_PEAKING_HGAIN) --#define VPP_PEAKING_VGAIN 0x1d92 --#define P_VPP_PEAKING_VGAIN VCBUS_REG_ADDR(VPP_PEAKING_VGAIN) --#define VPP_PEAKING_NLP_1 0x1d93 --#define P_VPP_PEAKING_NLP_1 VCBUS_REG_ADDR(VPP_PEAKING_NLP_1) --#define VPP_PEAKING_NLP_2 0x1d94 --#define P_VPP_PEAKING_NLP_2 VCBUS_REG_ADDR(VPP_PEAKING_NLP_2) --#define VPP_PEAKING_NLP_3 0x1d95 --#define P_VPP_PEAKING_NLP_3 VCBUS_REG_ADDR(VPP_PEAKING_NLP_3) --#define VPP_PEAKING_NLP_4 0x1d96 --#define P_VPP_PEAKING_NLP_4 VCBUS_REG_ADDR(VPP_PEAKING_NLP_4) --#define VPP_PEAKING_NLP_5 0x1d97 --#define P_VPP_PEAKING_NLP_5 VCBUS_REG_ADDR(VPP_PEAKING_NLP_5) --#define VPP_SHARP_LIMIT 0x1d98 --#define P_VPP_SHARP_LIMIT VCBUS_REG_ADDR(VPP_SHARP_LIMIT) --#define VPP_VLTI_CTRL 0x1d99 --#define P_VPP_VLTI_CTRL VCBUS_REG_ADDR(VPP_VLTI_CTRL) --#define VPP_HLTI_CTRL 0x1d9a --#define P_VPP_HLTI_CTRL VCBUS_REG_ADDR(VPP_HLTI_CTRL) --#define VPP_CTI_CTRL 0x1d9b --#define P_VPP_CTI_CTRL VCBUS_REG_ADDR(VPP_CTI_CTRL) --#define VPP_BLUE_STRETCH_1 0x1d9c --#define P_VPP_BLUE_STRETCH_1 VCBUS_REG_ADDR(VPP_BLUE_STRETCH_1) --#define VPP_BLUE_STRETCH_2 0x1d9d --#define P_VPP_BLUE_STRETCH_2 VCBUS_REG_ADDR(VPP_BLUE_STRETCH_2) --#define VPP_BLUE_STRETCH_3 0x1d9e --#define P_VPP_BLUE_STRETCH_3 VCBUS_REG_ADDR(VPP_BLUE_STRETCH_3) --#define VPP_CCORING_CTRL 0x1da0 --#define P_VPP_CCORING_CTRL VCBUS_REG_ADDR(VPP_CCORING_CTRL) --#define VPP_VE_ENABLE_CTRL 0x1da1 --#define P_VPP_VE_ENABLE_CTRL VCBUS_REG_ADDR(VPP_VE_ENABLE_CTRL) --#define VPP_INPUT_CTRL 0x1dab --#define P_VPP_INPUT_CTRL VCBUS_REG_ADDR(VPP_INPUT_CTRL) --#define VPP_CTI_CTRL2 0x1dac --#define P_VPP_CTI_CTRL2 VCBUS_REG_ADDR(VPP_CTI_CTRL2) --#define VPP_PEAKING_SAT_THD1 0x1dad --#define P_VPP_PEAKING_SAT_THD1 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD1) --#define VPP_PEAKING_SAT_THD2 0x1dae --#define P_VPP_PEAKING_SAT_THD2 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD2) --#define VPP_PEAKING_SAT_THD3 0x1daf --#define P_VPP_PEAKING_SAT_THD3 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD3) --#define VPP_PEAKING_SAT_THD4 0x1db0 --#define P_VPP_PEAKING_SAT_THD4 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD4) --#define VPP_PEAKING_SAT_THD5 0x1db1 --#define P_VPP_PEAKING_SAT_THD5 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD5) --#define VPP_PEAKING_SAT_THD6 0x1db2 --#define P_VPP_PEAKING_SAT_THD6 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD6) --#define VPP_PEAKING_SAT_THD7 0x1db3 --#define P_VPP_PEAKING_SAT_THD7 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD7) --#define VPP_PEAKING_SAT_THD8 0x1db4 --#define P_VPP_PEAKING_SAT_THD8 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD8) --#define VPP_PEAKING_SAT_THD9 0x1db5 --#define P_VPP_PEAKING_SAT_THD9 VCBUS_REG_ADDR(VPP_PEAKING_SAT_THD9) --#define VPP_PEAKING_GAIN_ADD1 0x1db6 --#define VPP2_GCLK_CTRL0 0x1972 --#define P_VPP2_GCLK_CTRL0 VCBUS_REG_ADDR(VPP2_GCLK_CTRL0) --#define VPP2_GCLK_CTRL1 0x1973 --#define P_VPP2_GCLK_CTRL1 VCBUS_REG_ADDR(VPP2_GCLK_CTRL1) --#define VPP2_SC_GCLK_CTRL 0x1974 --#define P_VPP2_SC_GCLK_CTRL VCBUS_REG_ADDR(VPP2_SC_GCLK_CTRL) --#define VPP2_MISC1 0x1976 --#define P_VPP2_MISC1 VCBUS_REG_ADDR(VPP2_MISC1) --#define VPP2_DNLP_CTRL_00 0x1981 --#define P_VPP2_DNLP_CTRL_00 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_00) --#define VPP2_DNLP_CTRL_01 0x1982 --#define P_VPP2_DNLP_CTRL_01 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_01) --#define VPP2_DNLP_CTRL_02 0x1983 --#define P_VPP2_DNLP_CTRL_02 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_02) --#define VPP2_DNLP_CTRL_03 0x1984 --#define P_VPP2_DNLP_CTRL_03 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_03) --#define VPP2_DNLP_CTRL_04 0x1985 --#define P_VPP2_DNLP_CTRL_04 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_04) --#define VPP2_DNLP_CTRL_05 0x1986 --#define P_VPP2_DNLP_CTRL_05 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_05) --#define VPP2_DNLP_CTRL_06 0x1987 --#define P_VPP2_DNLP_CTRL_06 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_06) --#define VPP2_DNLP_CTRL_07 0x1988 --#define P_VPP2_DNLP_CTRL_07 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_07) --#define VPP2_DNLP_CTRL_08 0x1989 --#define P_VPP2_DNLP_CTRL_08 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_08) --#define VPP2_DNLP_CTRL_09 0x198a --#define P_VPP2_DNLP_CTRL_09 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_09) --#define VPP2_DNLP_CTRL_10 0x198b --#define P_VPP2_DNLP_CTRL_10 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_10) --#define VPP2_DNLP_CTRL_11 0x198c --#define P_VPP2_DNLP_CTRL_11 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_11) --#define VPP2_DNLP_CTRL_12 0x198d --#define P_VPP2_DNLP_CTRL_12 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_12) --#define VPP2_DNLP_CTRL_13 0x198e --#define P_VPP2_DNLP_CTRL_13 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_13) --#define VPP2_DNLP_CTRL_14 0x198f --#define P_VPP2_DNLP_CTRL_14 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_14) --#define VPP2_DNLP_CTRL_15 0x1990 --#define P_VPP2_DNLP_CTRL_15 VCBUS_REG_ADDR(VPP2_DNLP_CTRL_15) --#define VPP2_VE_ENABLE_CTRL 0x19a1 --#define P_VPP2_VE_ENABLE_CTRL VCBUS_REG_ADDR(VPP2_VE_ENABLE_CTRL) --#define VPP2_VE_DEMO_LEFT_TOP_SCREEN_WIDTH 0x19a2 --#define VPP2_OSD_SCALE_COEF 0x19cd --#define P_VPP2_OSD_SCALE_COEF VCBUS_REG_ADDR(VPP2_OSD_SCALE_COEF) --#define VPP2_INT_LINE_NUM 0x19ce --#define P_VPP2_INT_LINE_NUM VCBUS_REG_ADDR(VPP2_INT_LINE_NUM) --#define VIU_ADDR_START 0x1a00 --#define P_VIU_ADDR_START VCBUS_REG_ADDR(VIU_ADDR_START) --#define VIU_ADDR_END 0x1aff --#define P_VIU_ADDR_END VCBUS_REG_ADDR(VIU_ADDR_END) --#define VIU_SW_RESET 0x1a01 --#define P_VIU_SW_RESET VCBUS_REG_ADDR(VIU_SW_RESET) --#define VIU_MISC_CTRL0 0x1a06 --#define P_VIU_MISC_CTRL0 VCBUS_REG_ADDR(VIU_MISC_CTRL0) --#define D2D3_INTF_LENGTH 0x1a08 --#define P_D2D3_INTF_LENGTH VCBUS_REG_ADDR(D2D3_INTF_LENGTH) --#define D2D3_INTF_CTRL0 0x1a09 --#define P_D2D3_INTF_CTRL0 VCBUS_REG_ADDR(D2D3_INTF_CTRL0) --#define VIU_OSD1_CTRL_STAT 0x1a10 --#define P_VIU_OSD1_CTRL_STAT VCBUS_REG_ADDR(VIU_OSD1_CTRL_STAT) --#define VIU_OSD1_CTRL_STAT2 0x1a2d --#define P_VIU_OSD1_CTRL_STAT2 VCBUS_REG_ADDR(VIU_OSD1_CTRL_STAT2) --#define VIU_OSD1_COLOR_ADDR 0x1a11 --#define P_VIU_OSD1_COLOR_ADDR VCBUS_REG_ADDR(VIU_OSD1_COLOR_ADDR) --#define VIU_OSD1_COLOR 0x1a12 --#define P_VIU_OSD1_COLOR VCBUS_REG_ADDR(VIU_OSD1_COLOR) --#define VIU_OSD1_TCOLOR_AG0 0x1a17 --#define P_VIU_OSD1_TCOLOR_AG0 VCBUS_REG_ADDR(VIU_OSD1_TCOLOR_AG0) --#define VIU_OSD1_TCOLOR_AG1 0x1a18 --#define P_VIU_OSD1_TCOLOR_AG1 VCBUS_REG_ADDR(VIU_OSD1_TCOLOR_AG1) --#define VIU_OSD1_TCOLOR_AG2 0x1a19 --#define P_VIU_OSD1_TCOLOR_AG2 VCBUS_REG_ADDR(VIU_OSD1_TCOLOR_AG2) --#define VIU_OSD1_TCOLOR_AG3 0x1a1a --#define P_VIU_OSD1_TCOLOR_AG3 VCBUS_REG_ADDR(VIU_OSD1_TCOLOR_AG3) --#define VIU_OSD1_BLK0_CFG_W0 0x1a1b --#define P_VIU_OSD1_BLK0_CFG_W0 VCBUS_REG_ADDR(VIU_OSD1_BLK0_CFG_W0) --#define VIU_OSD1_BLK1_CFG_W0 0x1a1f --#define P_VIU_OSD1_BLK1_CFG_W0 VCBUS_REG_ADDR(VIU_OSD1_BLK1_CFG_W0) --#define VIU_OSD1_BLK2_CFG_W0 0x1a23 --#define P_VIU_OSD1_BLK2_CFG_W0 VCBUS_REG_ADDR(VIU_OSD1_BLK2_CFG_W0) --#define VIU_OSD1_BLK3_CFG_W0 0x1a27 --#define P_VIU_OSD1_BLK3_CFG_W0 VCBUS_REG_ADDR(VIU_OSD1_BLK3_CFG_W0) --#define VIU_OSD1_BLK0_CFG_W1 0x1a1c --#define P_VIU_OSD1_BLK0_CFG_W1 VCBUS_REG_ADDR(VIU_OSD1_BLK0_CFG_W1) --#define VIU_OSD1_BLK1_CFG_W1 0x1a20 --#define P_VIU_OSD1_BLK1_CFG_W1 VCBUS_REG_ADDR(VIU_OSD1_BLK1_CFG_W1) --#define VIU_OSD1_BLK2_CFG_W1 0x1a24 --#define P_VIU_OSD1_BLK2_CFG_W1 VCBUS_REG_ADDR(VIU_OSD1_BLK2_CFG_W1) --#define VIU_OSD1_BLK3_CFG_W1 0x1a28 --#define P_VIU_OSD1_BLK3_CFG_W1 VCBUS_REG_ADDR(VIU_OSD1_BLK3_CFG_W1) --#define VIU_OSD1_BLK0_CFG_W2 0x1a1d --#define P_VIU_OSD1_BLK0_CFG_W2 VCBUS_REG_ADDR(VIU_OSD1_BLK0_CFG_W2) --#define VIU_OSD1_BLK1_CFG_W2 0x1a21 --#define P_VIU_OSD1_BLK1_CFG_W2 VCBUS_REG_ADDR(VIU_OSD1_BLK1_CFG_W2) --#define VIU_OSD1_BLK2_CFG_W2 0x1a25 --#define P_VIU_OSD1_BLK2_CFG_W2 VCBUS_REG_ADDR(VIU_OSD1_BLK2_CFG_W2) --#define VIU_OSD1_BLK3_CFG_W2 0x1a29 --#define P_VIU_OSD1_BLK3_CFG_W2 VCBUS_REG_ADDR(VIU_OSD1_BLK3_CFG_W2) --#define VIU_OSD1_BLK0_CFG_W3 0x1a1e --#define P_VIU_OSD1_BLK0_CFG_W3 VCBUS_REG_ADDR(VIU_OSD1_BLK0_CFG_W3) --#define VIU_OSD1_BLK1_CFG_W3 0x1a22 --#define P_VIU_OSD1_BLK1_CFG_W3 VCBUS_REG_ADDR(VIU_OSD1_BLK1_CFG_W3) --#define VIU_OSD1_BLK2_CFG_W3 0x1a26 --#define P_VIU_OSD1_BLK2_CFG_W3 VCBUS_REG_ADDR(VIU_OSD1_BLK2_CFG_W3) --#define VIU_OSD1_BLK3_CFG_W3 0x1a2a --#define P_VIU_OSD1_BLK3_CFG_W3 VCBUS_REG_ADDR(VIU_OSD1_BLK3_CFG_W3) --#define VIU_OSD1_BLK0_CFG_W4 0x1a13 --#define P_VIU_OSD1_BLK0_CFG_W4 VCBUS_REG_ADDR(VIU_OSD1_BLK0_CFG_W4) --#define VIU_OSD1_BLK1_CFG_W4 0x1a14 --#define P_VIU_OSD1_BLK1_CFG_W4 VCBUS_REG_ADDR(VIU_OSD1_BLK1_CFG_W4) --#define VIU_OSD1_BLK2_CFG_W4 0x1a15 --#define P_VIU_OSD1_BLK2_CFG_W4 VCBUS_REG_ADDR(VIU_OSD1_BLK2_CFG_W4) --#define VIU_OSD1_BLK3_CFG_W4 0x1a16 --#define P_VIU_OSD1_BLK3_CFG_W4 VCBUS_REG_ADDR(VIU_OSD1_BLK3_CFG_W4) --#define VIU_OSD1_TEST_RDDATA 0x1a2c --#define P_VIU_OSD1_TEST_RDDATA VCBUS_REG_ADDR(VIU_OSD1_TEST_RDDATA) --#define VIU_OSD1_PROT_CTRL 0x1a2e --#define P_VIU_OSD1_PROT_CTRL VCBUS_REG_ADDR(VIU_OSD1_PROT_CTRL) --#define VIU_OSD2_CTRL_STAT 0x1a30 --#define P_VIU_OSD2_CTRL_STAT VCBUS_REG_ADDR(VIU_OSD2_CTRL_STAT) --#define VIU_OSD2_CTRL_STAT2 0x1a4d --#define P_VIU_OSD2_CTRL_STAT2 VCBUS_REG_ADDR(VIU_OSD2_CTRL_STAT2) --#define VIU_OSD2_COLOR_ADDR 0x1a31 --#define P_VIU_OSD2_COLOR_ADDR VCBUS_REG_ADDR(VIU_OSD2_COLOR_ADDR) --#define VIU_OSD2_COLOR 0x1a32 --#define P_VIU_OSD2_COLOR VCBUS_REG_ADDR(VIU_OSD2_COLOR) --#define VIU_OSD2_HL1_H_START_END 0x1a33 --#define VIU_OSD2_TCOLOR_AG0 0x1a37 --#define P_VIU_OSD2_TCOLOR_AG0 VCBUS_REG_ADDR(VIU_OSD2_TCOLOR_AG0) --#define VIU_OSD2_TCOLOR_AG1 0x1a38 --#define P_VIU_OSD2_TCOLOR_AG1 VCBUS_REG_ADDR(VIU_OSD2_TCOLOR_AG1) --#define VIU_OSD2_TCOLOR_AG2 0x1a39 --#define P_VIU_OSD2_TCOLOR_AG2 VCBUS_REG_ADDR(VIU_OSD2_TCOLOR_AG2) --#define VIU_OSD2_TCOLOR_AG3 0x1a3a --#define P_VIU_OSD2_TCOLOR_AG3 VCBUS_REG_ADDR(VIU_OSD2_TCOLOR_AG3) --#define VIU_OSD2_BLK0_CFG_W0 0x1a3b --#define P_VIU_OSD2_BLK0_CFG_W0 VCBUS_REG_ADDR(VIU_OSD2_BLK0_CFG_W0) --#define VIU_OSD2_BLK1_CFG_W0 0x1a3f --#define P_VIU_OSD2_BLK1_CFG_W0 VCBUS_REG_ADDR(VIU_OSD2_BLK1_CFG_W0) --#define VIU_OSD2_BLK2_CFG_W0 0x1a43 --#define P_VIU_OSD2_BLK2_CFG_W0 VCBUS_REG_ADDR(VIU_OSD2_BLK2_CFG_W0) --#define VIU_OSD2_BLK3_CFG_W0 0x1a47 --#define P_VIU_OSD2_BLK3_CFG_W0 VCBUS_REG_ADDR(VIU_OSD2_BLK3_CFG_W0) --#define VIU_OSD2_BLK0_CFG_W1 0x1a3c --#define P_VIU_OSD2_BLK0_CFG_W1 VCBUS_REG_ADDR(VIU_OSD2_BLK0_CFG_W1) --#define VIU_OSD2_BLK1_CFG_W1 0x1a40 --#define P_VIU_OSD2_BLK1_CFG_W1 VCBUS_REG_ADDR(VIU_OSD2_BLK1_CFG_W1) --#define VIU_OSD2_BLK2_CFG_W1 0x1a44 --#define P_VIU_OSD2_BLK2_CFG_W1 VCBUS_REG_ADDR(VIU_OSD2_BLK2_CFG_W1) --#define VIU_OSD2_BLK3_CFG_W1 0x1a48 --#define P_VIU_OSD2_BLK3_CFG_W1 VCBUS_REG_ADDR(VIU_OSD2_BLK3_CFG_W1) --#define VIU_OSD2_BLK0_CFG_W2 0x1a3d --#define P_VIU_OSD2_BLK0_CFG_W2 VCBUS_REG_ADDR(VIU_OSD2_BLK0_CFG_W2) --#define VIU_OSD2_BLK1_CFG_W2 0x1a41 --#define P_VIU_OSD2_BLK1_CFG_W2 VCBUS_REG_ADDR(VIU_OSD2_BLK1_CFG_W2) --#define VIU_OSD2_BLK2_CFG_W2 0x1a45 --#define P_VIU_OSD2_BLK2_CFG_W2 VCBUS_REG_ADDR(VIU_OSD2_BLK2_CFG_W2) --#define VIU_OSD2_BLK3_CFG_W2 0x1a49 --#define P_VIU_OSD2_BLK3_CFG_W2 VCBUS_REG_ADDR(VIU_OSD2_BLK3_CFG_W2) --#define VIU_OSD2_BLK0_CFG_W3 0x1a3e --#define P_VIU_OSD2_BLK0_CFG_W3 VCBUS_REG_ADDR(VIU_OSD2_BLK0_CFG_W3) --#define VIU_OSD2_BLK1_CFG_W3 0x1a42 --#define P_VIU_OSD2_BLK1_CFG_W3 VCBUS_REG_ADDR(VIU_OSD2_BLK1_CFG_W3) --#define VIU_OSD2_BLK2_CFG_W3 0x1a46 --#define P_VIU_OSD2_BLK2_CFG_W3 VCBUS_REG_ADDR(VIU_OSD2_BLK2_CFG_W3) --#define VIU_OSD2_BLK3_CFG_W3 0x1a4a --#define P_VIU_OSD2_BLK3_CFG_W3 VCBUS_REG_ADDR(VIU_OSD2_BLK3_CFG_W3) --#define VIU_OSD2_BLK0_CFG_W4 0x1a64 --#define P_VIU_OSD2_BLK0_CFG_W4 VCBUS_REG_ADDR(VIU_OSD2_BLK0_CFG_W4) --#define VIU_OSD2_BLK1_CFG_W4 0x1a65 --#define P_VIU_OSD2_BLK1_CFG_W4 VCBUS_REG_ADDR(VIU_OSD2_BLK1_CFG_W4) --#define VIU_OSD2_BLK2_CFG_W4 0x1a66 --#define P_VIU_OSD2_BLK2_CFG_W4 VCBUS_REG_ADDR(VIU_OSD2_BLK2_CFG_W4) --#define VIU_OSD2_BLK3_CFG_W4 0x1a67 --#define P_VIU_OSD2_BLK3_CFG_W4 VCBUS_REG_ADDR(VIU_OSD2_BLK3_CFG_W4) --#define VIU_OSD2_TEST_RDDATA 0x1a4c --#define P_VIU_OSD2_TEST_RDDATA VCBUS_REG_ADDR(VIU_OSD2_TEST_RDDATA) --#define VIU_OSD2_PROT_CTRL 0x1a4e --#define P_VIU_OSD2_PROT_CTRL VCBUS_REG_ADDR(VIU_OSD2_PROT_CTRL) --#define VD1_IF0_GEN_REG 0x1a50 --#define P_VD1_IF0_GEN_REG VCBUS_REG_ADDR(VD1_IF0_GEN_REG) --#define VD1_IF0_CANVAS0 0x1a51 --#define P_VD1_IF0_CANVAS0 VCBUS_REG_ADDR(VD1_IF0_CANVAS0) --#define VD1_IF0_CANVAS1 0x1a52 --#define P_VD1_IF0_CANVAS1 VCBUS_REG_ADDR(VD1_IF0_CANVAS1) --#define VD1_IF0_LUMA_X0 0x1a53 --#define P_VD1_IF0_LUMA_X0 VCBUS_REG_ADDR(VD1_IF0_LUMA_X0) --#define VD1_IF0_LUMA_Y0 0x1a54 --#define P_VD1_IF0_LUMA_Y0 VCBUS_REG_ADDR(VD1_IF0_LUMA_Y0) --#define VD1_IF0_CHROMA_X0 0x1a55 --#define P_VD1_IF0_CHROMA_X0 VCBUS_REG_ADDR(VD1_IF0_CHROMA_X0) --#define VD1_IF0_CHROMA_Y0 0x1a56 --#define P_VD1_IF0_CHROMA_Y0 VCBUS_REG_ADDR(VD1_IF0_CHROMA_Y0) --#define VD1_IF0_LUMA_X1 0x1a57 --#define P_VD1_IF0_LUMA_X1 VCBUS_REG_ADDR(VD1_IF0_LUMA_X1) --#define VD1_IF0_LUMA_Y1 0x1a58 --#define P_VD1_IF0_LUMA_Y1 VCBUS_REG_ADDR(VD1_IF0_LUMA_Y1) --#define VD1_IF0_CHROMA_X1 0x1a59 --#define P_VD1_IF0_CHROMA_X1 VCBUS_REG_ADDR(VD1_IF0_CHROMA_X1) --#define VD1_IF0_CHROMA_Y1 0x1a5a --#define P_VD1_IF0_CHROMA_Y1 VCBUS_REG_ADDR(VD1_IF0_CHROMA_Y1) --#define VD1_IF0_RPT_LOOP 0x1a5b --#define P_VD1_IF0_RPT_LOOP VCBUS_REG_ADDR(VD1_IF0_RPT_LOOP) -- --#define VD1_IF0_LUMA_PSEL 0x1a60 --#define P_VD1_IF0_LUMA_PSEL VCBUS_REG_ADDR(VD1_IF0_LUMA_PSEL) --#define VD1_IF0_CHROMA_PSEL 0x1a61 --#define P_VD1_IF0_CHROMA_PSEL VCBUS_REG_ADDR(VD1_IF0_CHROMA_PSEL) --#define VD1_IF0_DUMMY_PIXEL 0x1a62 --#define P_VD1_IF0_DUMMY_PIXEL VCBUS_REG_ADDR(VD1_IF0_DUMMY_PIXEL) --#define VD1_IF0_RANGE_MAP_Y 0x1a6a --#define P_VD1_IF0_RANGE_MAP_Y VCBUS_REG_ADDR(VD1_IF0_RANGE_MAP_Y) --#define VD1_IF0_RANGE_MAP_CB 0x1a6b --#define P_VD1_IF0_RANGE_MAP_CB VCBUS_REG_ADDR(VD1_IF0_RANGE_MAP_CB) --#define VD1_IF0_RANGE_MAP_CR 0x1a6c --#define P_VD1_IF0_RANGE_MAP_CR VCBUS_REG_ADDR(VD1_IF0_RANGE_MAP_CR) --#define VD1_IF0_GEN_REG2 0x1a6d --#define P_VD1_IF0_GEN_REG2 VCBUS_REG_ADDR(VD1_IF0_GEN_REG2) --#define VD1_IF0_PROT_CNTL 0x1a6e --#define P_VD1_IF0_PROT_CNTL VCBUS_REG_ADDR(VD1_IF0_PROT_CNTL) --#define VIU_VD1_FMT_CTRL 0x1a68 --#define P_VIU_VD1_FMT_CTRL VCBUS_REG_ADDR(VIU_VD1_FMT_CTRL) --#define VIU_VD1_FMT_W 0x1a69 --#define P_VIU_VD1_FMT_W VCBUS_REG_ADDR(VIU_VD1_FMT_W) --#define VD2_IF0_GEN_REG 0x1a70 --#define P_VD2_IF0_GEN_REG VCBUS_REG_ADDR(VD2_IF0_GEN_REG) --#define VD2_IF0_CANVAS0 0x1a71 --#define P_VD2_IF0_CANVAS0 VCBUS_REG_ADDR(VD2_IF0_CANVAS0) --#define VD2_IF0_CANVAS1 0x1a72 --#define P_VD2_IF0_CANVAS1 VCBUS_REG_ADDR(VD2_IF0_CANVAS1) --#define VD2_IF0_LUMA_X0 0x1a73 --#define P_VD2_IF0_LUMA_X0 VCBUS_REG_ADDR(VD2_IF0_LUMA_X0) --#define VD2_IF0_LUMA_Y0 0x1a74 --#define P_VD2_IF0_LUMA_Y0 VCBUS_REG_ADDR(VD2_IF0_LUMA_Y0) --#define VD2_IF0_CHROMA_X0 0x1a75 --#define P_VD2_IF0_CHROMA_X0 VCBUS_REG_ADDR(VD2_IF0_CHROMA_X0) --#define VD2_IF0_CHROMA_Y0 0x1a76 --#define P_VD2_IF0_CHROMA_Y0 VCBUS_REG_ADDR(VD2_IF0_CHROMA_Y0) --#define VD2_IF0_LUMA_X1 0x1a77 --#define P_VD2_IF0_LUMA_X1 VCBUS_REG_ADDR(VD2_IF0_LUMA_X1) --#define VD2_IF0_LUMA_Y1 0x1a78 --#define P_VD2_IF0_LUMA_Y1 VCBUS_REG_ADDR(VD2_IF0_LUMA_Y1) --#define VD2_IF0_CHROMA_X1 0x1a79 --#define P_VD2_IF0_CHROMA_X1 VCBUS_REG_ADDR(VD2_IF0_CHROMA_X1) --#define VD2_IF0_CHROMA_Y1 0x1a7a --#define P_VD2_IF0_CHROMA_Y1 VCBUS_REG_ADDR(VD2_IF0_CHROMA_Y1) -- --#define VD2_IF0_LUMA_PSEL 0x1a80 --#define P_VD2_IF0_LUMA_PSEL VCBUS_REG_ADDR(VD2_IF0_LUMA_PSEL) --#define VD2_IF0_CHROMA_PSEL 0x1a81 --#define P_VD2_IF0_CHROMA_PSEL VCBUS_REG_ADDR(VD2_IF0_CHROMA_PSEL) --#define VD2_IF0_DUMMY_PIXEL 0x1a82 --#define P_VD2_IF0_DUMMY_PIXEL VCBUS_REG_ADDR(VD2_IF0_DUMMY_PIXEL) --#define VD2_IF0_LUMA_FIFO_SIZE 0x1a83 --#define P_VD2_IF0_RANGE_MAP_Y VCBUS_REG_ADDR(VD2_IF0_RANGE_MAP_Y) --#define VD2_IF0_RANGE_MAP_CB 0x1a8b --#define P_VD2_IF0_RANGE_MAP_CB VCBUS_REG_ADDR(VD2_IF0_RANGE_MAP_CB) --#define VD2_IF0_RANGE_MAP_CR 0x1a8c --#define P_VD2_IF0_RANGE_MAP_CR VCBUS_REG_ADDR(VD2_IF0_RANGE_MAP_CR) --#define VD2_IF0_GEN_REG2 0x1a8d --#define P_VD2_IF0_GEN_REG2 VCBUS_REG_ADDR(VD2_IF0_GEN_REG2) --#define VD2_IF0_PROT_CNTL 0x1a8e --#define P_VD2_IF0_PROT_CNTL VCBUS_REG_ADDR(VD2_IF0_PROT_CNTL) --#define VIU_VD2_FMT_CTRL 0x1a88 --#define P_VIU_VD2_FMT_CTRL VCBUS_REG_ADDR(VIU_VD2_FMT_CTRL) --#define VIU_VD2_FMT_W 0x1a89 --#define P_VIU_VD2_FMT_W VCBUS_REG_ADDR(VIU_VD2_FMT_W) --#define LDIM_STTS_GCLK_CTRL0 0x1a90 --#define P_LDIM_STTS_GCLK_CTRL0 VCBUS_REG_ADDR(LDIM_STTS_GCLK_CTRL0) --#define LDIM_STTS_CTRL0 0x1a91 --#define P_LDIM_STTS_CTRL0 VCBUS_REG_ADDR(LDIM_STTS_CTRL0) -- --#define DI_PRE_CTRL 0x1700 --#define P_DI_PRE_CTRL VCBUS_REG_ADDR(DI_PRE_CTRL) --#define DI_POST_CTRL 0x1701 --#define P_DI_POST_CTRL VCBUS_REG_ADDR(DI_POST_CTRL) --#define DI_POST_SIZE 0x1702 --#define P_DI_POST_SIZE VCBUS_REG_ADDR(DI_POST_SIZE) --#define DI_PRE_SIZE 0x1703 --#define P_DI_PRE_SIZE VCBUS_REG_ADDR(DI_PRE_SIZE) --#define DI_EI_CTRL0 0x1704 --#define P_DI_EI_CTRL0 VCBUS_REG_ADDR(DI_EI_CTRL0) --#define DI_EI_CTRL1 0x1705 --#define P_DI_EI_CTRL1 VCBUS_REG_ADDR(DI_EI_CTRL1) --#define DI_EI_CTRL2 0x1706 --#define P_DI_EI_CTRL2 VCBUS_REG_ADDR(DI_EI_CTRL2) --#define DI_NR_CTRL0 0x1707 --#define P_DI_NR_CTRL0 VCBUS_REG_ADDR(DI_NR_CTRL0) --#define DI_NR_CTRL1 0x1708 --#define P_DI_NR_CTRL1 VCBUS_REG_ADDR(DI_NR_CTRL1) --#define DI_NR_CTRL2 0x1709 --#define P_DI_NR_CTRL2 VCBUS_REG_ADDR(DI_NR_CTRL2) --#define DI_NR_CTRL3 0x170a --#define P_DI_NR_CTRL3 VCBUS_REG_ADDR(DI_NR_CTRL3) --#define DI_MTN_CTRL 0x170b --#define P_DI_MTN_CTRL VCBUS_REG_ADDR(DI_MTN_CTRL) --#define DI_MTN_CTRL1 0x170c --#define P_DI_MTN_CTRL1 VCBUS_REG_ADDR(DI_MTN_CTRL1) --#define DI_BLEND_CTRL 0x170d --#define P_DI_BLEND_CTRL VCBUS_REG_ADDR(DI_BLEND_CTRL) --#define DI_BLEND_CTRL1 0x170e --#define P_DI_BLEND_CTRL1 VCBUS_REG_ADDR(DI_BLEND_CTRL1) --#define DI_BLEND_CTRL2 0x170f --#define P_DI_BLEND_CTRL2 VCBUS_REG_ADDR(DI_BLEND_CTRL2) --#define DI_BLEND_REG0_X 0x1710 --#define P_DI_BLEND_REG0_X VCBUS_REG_ADDR(DI_BLEND_REG0_X) --#define DI_BLEND_REG0_Y 0x1711 --#define P_DI_BLEND_REG0_Y VCBUS_REG_ADDR(DI_BLEND_REG0_Y) --#define DI_BLEND_REG1_X 0x1712 --#define P_DI_BLEND_REG1_X VCBUS_REG_ADDR(DI_BLEND_REG1_X) --#define DI_BLEND_REG1_Y 0x1713 --#define P_DI_BLEND_REG1_Y VCBUS_REG_ADDR(DI_BLEND_REG1_Y) --#define DI_BLEND_REG2_X 0x1714 --#define P_DI_BLEND_REG2_X VCBUS_REG_ADDR(DI_BLEND_REG2_X) --#define DI_BLEND_REG2_Y 0x1715 --#define P_DI_BLEND_REG2_Y VCBUS_REG_ADDR(DI_BLEND_REG2_Y) --#define DI_BLEND_REG3_X 0x1716 --#define P_DI_BLEND_REG3_X VCBUS_REG_ADDR(DI_BLEND_REG3_X) --#define DI_BLEND_REG3_Y 0x1717 --#define P_DI_BLEND_REG3_Y VCBUS_REG_ADDR(DI_BLEND_REG3_Y) --#define DI_CLKG_CTRL 0x1718 --#define P_DI_CLKG_CTRL VCBUS_REG_ADDR(DI_CLKG_CTRL) --#define DI_EI_CTRL3 0x1719 --#define P_DI_EI_CTRL3 VCBUS_REG_ADDR(DI_EI_CTRL3) --#define DI_EI_CTRL4 0x171a --#define P_DI_EI_CTRL4 VCBUS_REG_ADDR(DI_EI_CTRL4) --#define DI_EI_CTRL5 0x171b --#define P_DI_EI_CTRL5 VCBUS_REG_ADDR(DI_EI_CTRL5) --#define DI_EI_CTRL6 0x171c --#define P_DI_EI_CTRL6 VCBUS_REG_ADDR(DI_EI_CTRL6) --#define DI_EI_CTRL7 0x171d --#define P_DI_EI_CTRL7 VCBUS_REG_ADDR(DI_EI_CTRL7) --#define DI_EI_CTRL8 0x171e --#define P_DI_EI_CTRL8 VCBUS_REG_ADDR(DI_EI_CTRL8) --#define DI_EI_CTRL9 0x171f --#define P_DI_EI_CTRL9 VCBUS_REG_ADDR(DI_EI_CTRL9) --#define DI_EI_CTRL10 0x1793 --#define P_DI_EI_CTRL10 VCBUS_REG_ADDR(DI_EI_CTRL10) --#define DI_EI_CTRL11 0x179e --#define P_DI_EI_CTRL11 VCBUS_REG_ADDR(DI_EI_CTRL11) --#define DI_EI_CTRL12 0x179f --#define P_DI_EI_CTRL12 VCBUS_REG_ADDR(DI_EI_CTRL12) --#define DI_EI_CTRL13 0x17a8 --#define P_DI_EI_CTRL13 VCBUS_REG_ADDR(DI_EI_CTRL13) --#define DI_EI_XWIN0 0x1798 --#define P_DI_EI_XWIN0 VCBUS_REG_ADDR(DI_EI_XWIN0) --#define DI_EI_XWIN1 0x1799 --#define P_DI_EI_XWIN1 VCBUS_REG_ADDR(DI_EI_XWIN1) --#define DI_MC_REG0_X 0x1720 --#define P_DI_MC_REG0_X VCBUS_REG_ADDR(DI_MC_REG0_X) --#define DI_MC_REG0_Y 0x1721 --#define P_DI_MC_REG0_Y VCBUS_REG_ADDR(DI_MC_REG0_Y) --#define DI_MC_REG1_X 0x1722 --#define P_DI_MC_REG1_X VCBUS_REG_ADDR(DI_MC_REG1_X) --#define DI_MC_REG1_Y 0x1723 --#define P_DI_MC_REG1_Y VCBUS_REG_ADDR(DI_MC_REG1_Y) --#define DI_MC_REG2_X 0x1724 --#define P_DI_MC_REG2_X VCBUS_REG_ADDR(DI_MC_REG2_X) --#define DI_MC_REG2_Y 0x1725 --#define P_DI_MC_REG2_Y VCBUS_REG_ADDR(DI_MC_REG2_Y) --#define DI_MC_REG3_X 0x1726 --#define P_DI_MC_REG3_X VCBUS_REG_ADDR(DI_MC_REG3_X) --#define DI_MC_REG3_Y 0x1727 --#define P_DI_MC_REG3_Y VCBUS_REG_ADDR(DI_MC_REG3_Y) --#define DI_MC_REG4_X 0x1728 --#define P_DI_MC_REG4_X VCBUS_REG_ADDR(DI_MC_REG4_X) --#define DI_MC_REG4_Y 0x1729 --#define P_DI_MC_REG4_Y VCBUS_REG_ADDR(DI_MC_REG4_Y) --#define DI_MC_32LVL0 0x172a --#define P_DI_MC_32LVL0 VCBUS_REG_ADDR(DI_MC_32LVL0) --#define DI_MC_32LVL1 0x172b --#define P_DI_MC_32LVL1 VCBUS_REG_ADDR(DI_MC_32LVL1) --#define DI_MC_22LVL0 0x172c --#define P_DI_MC_22LVL0 VCBUS_REG_ADDR(DI_MC_22LVL0) --#define DI_MC_22LVL1 0x172d --#define P_DI_MC_22LVL1 VCBUS_REG_ADDR(DI_MC_22LVL1) --#define DI_MC_22LVL2 0x172e --#define P_DI_MC_22LVL2 VCBUS_REG_ADDR(DI_MC_22LVL2) --#define DI_MC_CTRL 0x172f --#define P_DI_MC_CTRL VCBUS_REG_ADDR(DI_MC_CTRL) --#define DI_INTR_CTRL 0x1730 --#define P_DI_INTR_CTRL VCBUS_REG_ADDR(DI_INTR_CTRL) --#define DI_INFO_ADDR 0x1731 --#define P_DI_INFO_ADDR VCBUS_REG_ADDR(DI_INFO_ADDR) --#define DI_INFO_DATA 0x1732 --#define P_DI_INFO_DATA VCBUS_REG_ADDR(DI_INFO_DATA) --#define DI_PRE_HOLD 0x1733 --#define P_DI_PRE_HOLD VCBUS_REG_ADDR(DI_PRE_HOLD) --#define DI_MTN_1_CTRL1 0x1740 --#define P_DI_MTN_1_CTRL1 VCBUS_REG_ADDR(DI_MTN_1_CTRL1) --#define DI_MTN_1_CTRL2 0x1741 --#define P_DI_MTN_1_CTRL2 VCBUS_REG_ADDR(DI_MTN_1_CTRL2) --#define DI_MTN_1_CTRL3 0x1742 --#define P_DI_MTN_1_CTRL3 VCBUS_REG_ADDR(DI_MTN_1_CTRL3) --#define DI_MTN_1_CTRL4 0x1743 --#define P_DI_MTN_1_CTRL4 VCBUS_REG_ADDR(DI_MTN_1_CTRL4) --#define DI_MTN_1_CTRL5 0x1744 --#define P_DI_MTN_1_CTRL5 VCBUS_REG_ADDR(DI_MTN_1_CTRL5) --#define DI_MTN_1_CTRL6 0x17a9 --#define P_DI_MTN_1_CTRL6 VCBUS_REG_ADDR(DI_MTN_1_CTRL6) --#define DI_MTN_1_CTRL7 0x17aa --#define P_DI_MTN_1_CTRL7 VCBUS_REG_ADDR(DI_MTN_1_CTRL7) --#define DI_MTN_1_CTRL8 0x17ab --#define P_DI_MTN_1_CTRL8 VCBUS_REG_ADDR(DI_MTN_1_CTRL8) --#define DI_MTN_1_CTRL9 0x17ac --#define P_DI_MTN_1_CTRL9 VCBUS_REG_ADDR(DI_MTN_1_CTRL9) --#define DI_MTN_1_CTRL10 0x17ad --#define P_DI_MTN_1_CTRL10 VCBUS_REG_ADDR(DI_MTN_1_CTRL10) --#define DI_MTN_1_CTRL11 0x17ae --#define P_DI_MTN_1_CTRL11 VCBUS_REG_ADDR(DI_MTN_1_CTRL11) --#define DI_MTN_1_CTRL12 0x17af --#define P_DI_MTN_1_CTRL12 VCBUS_REG_ADDR(DI_MTN_1_CTRL12) --#define DET3D_MOTN_CFG 0x1734 --#define P_DET3D_MOTN_CFG VCBUS_REG_ADDR(DET3D_MOTN_CFG) --#define DET3D_CB_CFG 0x1735 --#define P_DET3D_CB_CFG VCBUS_REG_ADDR(DET3D_CB_CFG) --#define DET3D_SPLT_CFG 0x1736 --#define P_DET3D_SPLT_CFG VCBUS_REG_ADDR(DET3D_SPLT_CFG) --#define DET3D_HV_MUTE 0x1737 --#define P_DET3D_HV_MUTE VCBUS_REG_ADDR(DET3D_HV_MUTE) --#define DET3D_MAT_STA_P1M1 0x1738 --#define P_DET3D_MAT_STA_P1M1 VCBUS_REG_ADDR(DET3D_MAT_STA_P1M1) --#define DET3D_MAT_STA_P1TH 0x1739 --#define P_DET3D_MAT_STA_P1TH VCBUS_REG_ADDR(DET3D_MAT_STA_P1TH) --#define DET3D_MAT_STA_M1TH 0x173a --#define P_DET3D_MAT_STA_M1TH VCBUS_REG_ADDR(DET3D_MAT_STA_M1TH) --#define DET3D_MAT_STA_RSFT 0x173b --#define P_DET3D_MAT_STA_RSFT VCBUS_REG_ADDR(DET3D_MAT_STA_RSFT) --#define DET3D_MAT_SYMTC_TH 0x173c --#define P_DET3D_MAT_SYMTC_TH VCBUS_REG_ADDR(DET3D_MAT_SYMTC_TH) --#define DET3D_RO_DET_CB_HOR 0x173d --#define P_DET3D_RO_DET_CB_HOR VCBUS_REG_ADDR(DET3D_RO_DET_CB_HOR) --#define DET3D_RO_DET_CB_VER 0x173e --#define P_DET3D_RO_DET_CB_VER VCBUS_REG_ADDR(DET3D_RO_DET_CB_VER) --#define DET3D_RO_SPLT_HT 0x173f --#define P_DET3D_RO_SPLT_HT VCBUS_REG_ADDR(DET3D_RO_SPLT_HT) --#define NR2_MET_NM_CTRL 0x1745 --#define P_NR2_MET_NM_CTRL VCBUS_REG_ADDR(NR2_MET_NM_CTRL) --#define NR2_MET_NM_YCTRL 0x1746 --#define P_NR2_MET_NM_YCTRL VCBUS_REG_ADDR(NR2_MET_NM_YCTRL) --#define NR2_MET_NM_CCTRL 0x1747 --#define P_NR2_MET_NM_CCTRL VCBUS_REG_ADDR(NR2_MET_NM_CCTRL) -- --#define NR2_MATNR_SNR_EDGE2B 0x1757 --#define P_NR2_MATNR_SNR_EDGE2B VCBUS_REG_ADDR(NR2_MATNR_SNR_EDGE2B) --#define NR2_MATNR_BETA_EGAIN 0x1758 --#define P_NR2_MATNR_BETA_EGAIN VCBUS_REG_ADDR(NR2_MATNR_BETA_EGAIN) --#define NR2_MATNR_BETA_BRT 0x1759 --#define P_NR2_MATNR_BETA_BRT VCBUS_REG_ADDR(NR2_MATNR_BETA_BRT) --#define NR2_MATNR_XBETA_CFG 0x175a --#define P_NR2_MATNR_XBETA_CFG VCBUS_REG_ADDR(NR2_MATNR_XBETA_CFG) --#define NR2_MATNR_YBETA_SCL 0x175b --#define P_NR2_MATNR_YBETA_SCL VCBUS_REG_ADDR(NR2_MATNR_YBETA_SCL) --#define NR2_MATNR_CBETA_SCL 0x175c --#define P_NR2_MATNR_CBETA_SCL VCBUS_REG_ADDR(NR2_MATNR_CBETA_SCL) --#define NR2_SNR_MASK 0x175d --#define P_NR2_SNR_MASK VCBUS_REG_ADDR(NR2_SNR_MASK) --#define NR2_SAD2NORM_LUT0 0x175e --#define P_NR2_SAD2NORM_LUT0 VCBUS_REG_ADDR(NR2_SAD2NORM_LUT0) --#define NR2_SAD2NORM_LUT1 0x175f --#define P_NR2_SAD2NORM_LUT1 VCBUS_REG_ADDR(NR2_SAD2NORM_LUT1) --#define NR2_SAD2NORM_LUT2 0x1760 --#define P_NR2_SAD2NORM_LUT2 VCBUS_REG_ADDR(NR2_SAD2NORM_LUT2) --#define NR2_SAD2NORM_LUT3 0x1761 --#define P_NR2_SAD2NORM_LUT3 VCBUS_REG_ADDR(NR2_SAD2NORM_LUT3) --#define NR2_EDGE2BETA_LUT0 0x1762 --#define P_NR2_EDGE2BETA_LUT0 VCBUS_REG_ADDR(NR2_EDGE2BETA_LUT0) --#define NR2_EDGE2BETA_LUT1 0x1763 --#define P_NR2_EDGE2BETA_LUT1 VCBUS_REG_ADDR(NR2_EDGE2BETA_LUT1) --#define NR2_EDGE2BETA_LUT2 0x1764 --#define P_NR2_EDGE2BETA_LUT2 VCBUS_REG_ADDR(NR2_EDGE2BETA_LUT2) --#define NR2_EDGE2BETA_LUT3 0x1765 --#define P_NR2_EDGE2BETA_LUT3 VCBUS_REG_ADDR(NR2_EDGE2BETA_LUT3) --#define NR2_MOTION2BETA_LUT0 0x1766 --#define P_NR2_MOTION2BETA_LUT0 VCBUS_REG_ADDR(NR2_MOTION2BETA_LUT0) --#define NR2_MOTION2BETA_LUT1 0x1767 --#define P_NR2_MOTION2BETA_LUT1 VCBUS_REG_ADDR(NR2_MOTION2BETA_LUT1) --#define NR2_MOTION2BETA_LUT2 0x1768 --#define P_NR2_MOTION2BETA_LUT2 VCBUS_REG_ADDR(NR2_MOTION2BETA_LUT2) --#define NR2_MOTION2BETA_LUT3 0x1769 --#define P_NR2_MOTION2BETA_LUT3 VCBUS_REG_ADDR(NR2_MOTION2BETA_LUT3) --#define NR2_MATNR_MTN_CRTL 0x176a --#define P_NR2_MATNR_MTN_CRTL VCBUS_REG_ADDR(NR2_MATNR_MTN_CRTL) --#define NR2_MATNR_MTN_CRTL2 0x176b --#define P_NR2_MATNR_MTN_CRTL2 VCBUS_REG_ADDR(NR2_MATNR_MTN_CRTL2) --#define NR2_MATNR_MTN_COR 0x176c --#define P_NR2_MATNR_MTN_COR VCBUS_REG_ADDR(NR2_MATNR_MTN_COR) --#define NR2_MATNR_MTN_GAIN 0x176d --#define P_NR2_MATNR_MTN_GAIN VCBUS_REG_ADDR(NR2_MATNR_MTN_GAIN) --#define NR2_MATNR_DEGHOST 0x176e --#define P_NR2_MATNR_DEGHOST VCBUS_REG_ADDR(NR2_MATNR_DEGHOST) --#define NR2_MATNR_MTNB_BRT 0x1777 --#define P_NR2_MATNR_MTNB_BRT VCBUS_REG_ADDR(NR2_MATNR_MTNB_BRT) --#define NR2_CUE_MODE 0x1778 --#define P_NR2_CUE_MODE VCBUS_REG_ADDR(NR2_CUE_MODE) --#define NR2_CUE_CON_MOT_TH 0x1779 --#define P_NR2_CUE_CON_MOT_TH VCBUS_REG_ADDR(NR2_CUE_CON_MOT_TH) --#define NR2_CUE_CON_DIF0 0x177a --#define P_NR2_CUE_CON_DIF0 VCBUS_REG_ADDR(NR2_CUE_CON_DIF0) --#define NR2_CUE_CON_DIF1 0x177b --#define P_NR2_CUE_CON_DIF1 VCBUS_REG_ADDR(NR2_CUE_CON_DIF1) --#define NR2_CUE_CON_DIF2 0x177c --#define P_NR2_CUE_CON_DIF2 VCBUS_REG_ADDR(NR2_CUE_CON_DIF2) --#define NR2_CUE_CON_DIF3 0x177d --#define P_NR2_CUE_CON_DIF3 VCBUS_REG_ADDR(NR2_CUE_CON_DIF3) --#define NR2_CUE_PRG_DIF 0x177e --#define P_NR2_CUE_PRG_DIF VCBUS_REG_ADDR(NR2_CUE_PRG_DIF) --#define NR2_CONV_MODE 0x177f --#define P_NR2_CONV_MODE VCBUS_REG_ADDR(NR2_CONV_MODE) --#define DET3D_RO_SPLT_HB 0x1780 --#define P_DET3D_RO_SPLT_HB VCBUS_REG_ADDR(DET3D_RO_SPLT_HB) --#define DET3D_RO_SPLT_VL 0x1781 --#define P_DET3D_RO_SPLT_VL VCBUS_REG_ADDR(DET3D_RO_SPLT_VL) --#define DET3D_RO_SPLT_VR 0x1782 --#define P_DET3D_RO_SPLT_VR VCBUS_REG_ADDR(DET3D_RO_SPLT_VR) --#define DET3D_RO_MAT_LUMA_LR 0x1783 --#define P_DET3D_RO_MAT_LUMA_LR VCBUS_REG_ADDR(DET3D_RO_MAT_LUMA_LR) --#define DET3D_RO_MAT_LUMA_TB 0x1784 --#define P_DET3D_RO_MAT_LUMA_TB VCBUS_REG_ADDR(DET3D_RO_MAT_LUMA_TB) --#define DET3D_RO_MAT_CHRU_LR 0x1785 --#define P_DET3D_RO_MAT_CHRU_LR VCBUS_REG_ADDR(DET3D_RO_MAT_CHRU_LR) --#define DET3D_RO_MAT_CHRU_TB 0x1786 --#define P_DET3D_RO_MAT_CHRU_TB VCBUS_REG_ADDR(DET3D_RO_MAT_CHRU_TB) --#define DET3D_RO_MAT_CHRV_LR 0x1787 --#define P_DET3D_RO_MAT_CHRV_LR VCBUS_REG_ADDR(DET3D_RO_MAT_CHRV_LR) --#define NR2_CFR_PARA_CFG0 0x179c --#define P_NR2_CFR_PARA_CFG0 VCBUS_REG_ADDR(NR2_CFR_PARA_CFG0) --#define NR2_CFR_PARA_CFG1 0x179d --#define P_NR2_CFR_PARA_CFG1 VCBUS_REG_ADDR(NR2_CFR_PARA_CFG1) --#define DI_NR_1_CTRL0 0x1794 --#define P_DI_NR_1_CTRL0 VCBUS_REG_ADDR(DI_NR_1_CTRL0) --#define DI_NR_1_CTRL1 0x1795 --#define P_DI_NR_1_CTRL1 VCBUS_REG_ADDR(DI_NR_1_CTRL1) --#define DI_NR_1_CTRL2 0x1796 --#define P_DI_NR_1_CTRL2 VCBUS_REG_ADDR(DI_NR_1_CTRL2) --#define DI_NR_1_CTRL3 0x1797 --#define P_DI_NR_1_CTRL3 VCBUS_REG_ADDR(DI_NR_1_CTRL3) --#define DI_CONTWR_X 0x17a0 --#define P_DI_CONTWR_X VCBUS_REG_ADDR(DI_CONTWR_X) --#define DI_CONTWR_Y 0x17a1 --#define P_DI_CONTWR_Y VCBUS_REG_ADDR(DI_CONTWR_Y) --#define DI_CONTWR_CTRL 0x17a2 --#define P_DI_CONTWR_CTRL VCBUS_REG_ADDR(DI_CONTWR_CTRL) --#define DI_CONTPRD_X 0x17a3 --#define P_DI_CONTPRD_X VCBUS_REG_ADDR(DI_CONTPRD_X) --#define DI_CONTPRD_Y 0x17a4 --#define P_DI_CONTPRD_Y VCBUS_REG_ADDR(DI_CONTPRD_Y) --#define DI_CONTP2RD_X 0x17a5 --#define P_DI_CONTP2RD_X VCBUS_REG_ADDR(DI_CONTP2RD_X) --#define DI_CONTP2RD_Y 0x17a6 --#define P_DI_CONTP2RD_Y VCBUS_REG_ADDR(DI_CONTP2RD_Y) --#define DI_CONTRD_CTRL 0x17a7 --#define P_DI_CONTRD_CTRL VCBUS_REG_ADDR(DI_CONTRD_CTRL) --#define DI_NRWR_X 0x17c0 --#define P_DI_NRWR_X VCBUS_REG_ADDR(DI_NRWR_X) --#define DI_NRWR_Y 0x17c1 --#define P_DI_NRWR_Y VCBUS_REG_ADDR(DI_NRWR_Y) --#define DI_NRWR_CTRL 0x17c2 --#define P_DI_NRWR_CTRL VCBUS_REG_ADDR(DI_NRWR_CTRL) --#define DI_MTNWR_X 0x17c3 --#define P_DI_MTNWR_X VCBUS_REG_ADDR(DI_MTNWR_X) --#define DI_MTNWR_Y 0x17c4 --#define P_DI_MTNWR_Y VCBUS_REG_ADDR(DI_MTNWR_Y) --#define DI_MTNWR_CTRL 0x17c5 --#define P_DI_MTNWR_CTRL VCBUS_REG_ADDR(DI_MTNWR_CTRL) --#define DI_DIWR_X 0x17c6 --#define P_DI_DIWR_X VCBUS_REG_ADDR(DI_DIWR_X) --#define DI_DIWR_Y 0x17c7 --#define P_DI_DIWR_Y VCBUS_REG_ADDR(DI_DIWR_Y) --#define DI_DIWR_CTRL 0x17c8 --#define P_DI_DIWR_CTRL VCBUS_REG_ADDR(DI_DIWR_CTRL) --#define DI_MTNCRD_X 0x17c9 --#define P_DI_MTNCRD_X VCBUS_REG_ADDR(DI_MTNCRD_X) --#define DI_MTNCRD_Y 0x17ca --#define P_DI_MTNCRD_Y VCBUS_REG_ADDR(DI_MTNCRD_Y) --#define DI_MTNPRD_X 0x17cb --#define P_DI_MTNPRD_X VCBUS_REG_ADDR(DI_MTNPRD_X) --#define DI_MTNPRD_Y 0x17cc --#define P_DI_MTNPRD_Y VCBUS_REG_ADDR(DI_MTNPRD_Y) --#define DI_MTNRD_CTRL 0x17cd --#define P_DI_MTNRD_CTRL VCBUS_REG_ADDR(DI_MTNRD_CTRL) --#define DI_INP_GEN_REG 0x17ce --#define P_DI_INP_GEN_REG VCBUS_REG_ADDR(DI_INP_GEN_REG) --#define DI_INP_CANVAS0 0x17cf --#define P_DI_INP_CANVAS0 VCBUS_REG_ADDR(DI_INP_CANVAS0) --#define DI_INP_LUMA_X0 0x17d0 --#define P_DI_INP_LUMA_X0 VCBUS_REG_ADDR(DI_INP_LUMA_X0) --#define DI_INP_LUMA_Y0 0x17d1 --#define P_DI_INP_LUMA_Y0 VCBUS_REG_ADDR(DI_INP_LUMA_Y0) --#define DI_INP_CHROMA_X0 0x17d2 --#define P_DI_INP_CHROMA_X0 VCBUS_REG_ADDR(DI_INP_CHROMA_X0) --#define DI_INP_CHROMA_Y0 0x17d3 --#define P_DI_INP_CHROMA_Y0 VCBUS_REG_ADDR(DI_INP_CHROMA_Y0) --#define DI_INP_RPT_LOOP 0x17d4 --#define P_DI_INP_RPT_LOOP VCBUS_REG_ADDR(DI_INP_RPT_LOOP) --#define DI_INP_LUMA0_RPT_PAT 0x17d5 --#define P_DI_INP_LUMA0_RPT_PAT VCBUS_REG_ADDR(DI_INP_LUMA0_RPT_PAT) --#define DI_INP_CHROMA0_RPT_PAT 0x17d6 -- --#define DI_INP_RANGE_MAP_Y 0x17ba --#define P_DI_INP_RANGE_MAP_Y VCBUS_REG_ADDR(DI_INP_RANGE_MAP_Y) --#define DI_INP_RANGE_MAP_CB 0x17bb --#define P_DI_INP_RANGE_MAP_CB VCBUS_REG_ADDR(DI_INP_RANGE_MAP_CB) --#define DI_INP_RANGE_MAP_CR 0x17bc --#define P_DI_INP_RANGE_MAP_CR VCBUS_REG_ADDR(DI_INP_RANGE_MAP_CR) --#define DI_INP_GEN_REG2 0x1791 --#define P_DI_INP_GEN_REG2 VCBUS_REG_ADDR(DI_INP_GEN_REG2) --#define DI_INP_FMT_CTRL 0x17d9 --#define P_DI_INP_FMT_CTRL VCBUS_REG_ADDR(DI_INP_FMT_CTRL) --#define DI_INP_FMT_W 0x17da --#define P_DI_INP_FMT_W VCBUS_REG_ADDR(DI_INP_FMT_W) --#define DI_MEM_GEN_REG 0x17db --#define P_DI_MEM_GEN_REG VCBUS_REG_ADDR(DI_MEM_GEN_REG) --#define DI_MEM_CANVAS0 0x17dc --#define P_DI_MEM_CANVAS0 VCBUS_REG_ADDR(DI_MEM_CANVAS0) --#define DI_MEM_LUMA_X0 0x17dd --#define P_DI_MEM_LUMA_X0 VCBUS_REG_ADDR(DI_MEM_LUMA_X0) --#define DI_MEM_LUMA_Y0 0x17de --#define P_DI_MEM_LUMA_Y0 VCBUS_REG_ADDR(DI_MEM_LUMA_Y0) --#define DI_MEM_CHROMA_X0 0x17df --#define P_DI_MEM_CHROMA_X0 VCBUS_REG_ADDR(DI_MEM_CHROMA_X0) --#define DI_MEM_CHROMA_Y0 0x17e0 --#define P_DI_MEM_CHROMA_Y0 VCBUS_REG_ADDR(DI_MEM_CHROMA_Y0) --#define DI_MEM_RPT_LOOP 0x17e1 --#define P_DI_MEM_RPT_LOOP VCBUS_REG_ADDR(DI_MEM_RPT_LOOP) -- --#define DI_MEM_RANGE_MAP_Y 0x17bd --#define P_DI_MEM_RANGE_MAP_Y VCBUS_REG_ADDR(DI_MEM_RANGE_MAP_Y) --#define DI_MEM_RANGE_MAP_CB 0x17be --#define P_DI_MEM_RANGE_MAP_CB VCBUS_REG_ADDR(DI_MEM_RANGE_MAP_CB) --#define DI_MEM_RANGE_MAP_CR 0x17bf --#define P_DI_MEM_RANGE_MAP_CR VCBUS_REG_ADDR(DI_MEM_RANGE_MAP_CR) --#define DI_MEM_GEN_REG2 0x1792 --#define P_DI_MEM_GEN_REG2 VCBUS_REG_ADDR(DI_MEM_GEN_REG2) --#define DI_MEM_FMT_CTRL 0x17e6 --#define P_DI_MEM_FMT_CTRL VCBUS_REG_ADDR(DI_MEM_FMT_CTRL) --#define DI_MEM_FMT_W 0x17e7 --#define P_DI_MEM_FMT_W VCBUS_REG_ADDR(DI_MEM_FMT_W) --#define DI_IF1_GEN_REG 0x17e8 --#define P_DI_IF1_GEN_REG VCBUS_REG_ADDR(DI_IF1_GEN_REG) --#define DI_IF1_CANVAS0 0x17e9 --#define P_DI_IF1_CANVAS0 VCBUS_REG_ADDR(DI_IF1_CANVAS0) --#define DI_IF1_LUMA_X0 0x17ea --#define P_DI_IF1_LUMA_X0 VCBUS_REG_ADDR(DI_IF1_LUMA_X0) --#define DI_IF1_LUMA_Y0 0x17eb --#define P_DI_IF1_LUMA_Y0 VCBUS_REG_ADDR(DI_IF1_LUMA_Y0) --#define DI_IF1_CHROMA_X0 0x17ec --#define P_DI_IF1_CHROMA_X0 VCBUS_REG_ADDR(DI_IF1_CHROMA_X0) --#define DI_IF1_CHROMA_Y0 0x17ed --#define P_DI_IF1_CHROMA_Y0 VCBUS_REG_ADDR(DI_IF1_CHROMA_Y0) --#define DI_IF1_RPT_LOOP 0x17ee --#define P_DI_IF1_RPT_LOOP VCBUS_REG_ADDR(DI_IF1_RPT_LOOP) --#define DI_IF1_LUMA0_RPT_PAT 0x17ef --#define P_DI_IF1_LUMA0_RPT_PAT VCBUS_REG_ADDR(DI_IF1_LUMA0_RPT_PAT) --#define DI_IF1_CHROMA0_RPT_PAT 0x17f0 --#define P_DI_IF1_DUMMY_PIXEL VCBUS_REG_ADDR(DI_IF1_DUMMY_PIXEL) --#define DI_IF1_LUMA_FIFO_SIZE 0x17f2 -- --#define DI_CHAN2_GEN_REG2 0x17b7 --#define P_DI_CHAN2_GEN_REG2 VCBUS_REG_ADDR(DI_CHAN2_GEN_REG2) --#define DI_CHAN2_FMT_CTRL 0x17b8 --#define P_DI_CHAN2_FMT_CTRL VCBUS_REG_ADDR(DI_CHAN2_FMT_CTRL) --#define DI_CHAN2_FMT_W 0x17b9 --#define P_DI_CHAN2_FMT_W VCBUS_REG_ADDR(DI_CHAN2_FMT_W) --#define VIU2_ADDR_START 0x1e00 --#define P_VIU2_ADDR_START VCBUS_REG_ADDR(VIU2_ADDR_START) --#define VIU2_ADDR_END 0x1eff --#define P_VIU2_ADDR_END VCBUS_REG_ADDR(VIU2_ADDR_END) --#define VIU2_SW_RESET 0x1e01 --#define P_VIU2_SW_RESET VCBUS_REG_ADDR(VIU2_SW_RESET) --#define VIU2_OSD1_CTRL_STAT 0x1e10 --#define P_VIU2_OSD1_CTRL_STAT VCBUS_REG_ADDR(VIU2_OSD1_CTRL_STAT) --#define VIU2_OSD1_CTRL_STAT2 0x1e2d --#define P_VIU2_OSD1_CTRL_STAT2 VCBUS_REG_ADDR(VIU2_OSD1_CTRL_STAT2) --#define VIU2_OSD1_COLOR_ADDR 0x1e11 --#define P_VIU2_OSD1_COLOR_ADDR VCBUS_REG_ADDR(VIU2_OSD1_COLOR_ADDR) --#define VIU2_OSD1_COLOR 0x1e12 --#define P_VIU2_OSD1_COLOR VCBUS_REG_ADDR(VIU2_OSD1_COLOR) --#define VIU2_OSD1_TCOLOR_AG0 0x1e17 --#define P_VIU2_OSD1_TCOLOR_AG0 VCBUS_REG_ADDR(VIU2_OSD1_TCOLOR_AG0) --#define VIU2_OSD1_TCOLOR_AG1 0x1e18 --#define P_VIU2_OSD1_TCOLOR_AG1 VCBUS_REG_ADDR(VIU2_OSD1_TCOLOR_AG1) --#define VIU2_OSD1_TCOLOR_AG2 0x1e19 --#define P_VIU2_OSD1_TCOLOR_AG2 VCBUS_REG_ADDR(VIU2_OSD1_TCOLOR_AG2) --#define VIU2_OSD1_TCOLOR_AG3 0x1e1a --#define P_VIU2_OSD1_TCOLOR_AG3 VCBUS_REG_ADDR(VIU2_OSD1_TCOLOR_AG3) -- -- --#define VENC_SYNC_ROUTE 0x1b60 --#define P_VENC_SYNC_ROUTE VCBUS_REG_ADDR(VENC_SYNC_ROUTE) --#define VENC_VIDEO_EXSRC 0x1b61 --#define P_VENC_VIDEO_EXSRC VCBUS_REG_ADDR(VENC_VIDEO_EXSRC) --#define VENC_DVI_SETTING 0x1b62 --#define P_VENC_DVI_SETTING VCBUS_REG_ADDR(VENC_DVI_SETTING) --#define VENC_C656_CTRL 0x1b63 --#define P_VENC_C656_CTRL VCBUS_REG_ADDR(VENC_C656_CTRL) --#define VENC_UPSAMPLE_CTRL0 0x1b64 --#define P_VENC_UPSAMPLE_CTRL0 VCBUS_REG_ADDR(VENC_UPSAMPLE_CTRL0) --#define VENC_UPSAMPLE_CTRL1 0x1b65 --#define P_VENC_UPSAMPLE_CTRL1 VCBUS_REG_ADDR(VENC_UPSAMPLE_CTRL1) --#define VENC_UPSAMPLE_CTRL2 0x1b66 --#define P_VENC_UPSAMPLE_CTRL2 VCBUS_REG_ADDR(VENC_UPSAMPLE_CTRL2) --#define TCON_INVERT_CTL 0x1b67 --#define P_TCON_INVERT_CTL VCBUS_REG_ADDR(TCON_INVERT_CTL) --#define VENC_VIDEO_PROG_MODE 0x1b68 --#define P_VENC_VIDEO_PROG_MODE VCBUS_REG_ADDR(VENC_VIDEO_PROG_MODE) --#define VENC_ENCI_LINE 0x1b69 --#define P_VENC_ENCI_LINE VCBUS_REG_ADDR(VENC_ENCI_LINE) --#define VENC_ENCI_PIXEL 0x1b6a --#define P_VENC_ENCI_PIXEL VCBUS_REG_ADDR(VENC_ENCI_PIXEL) --#define VENC_ENCP_LINE 0x1b6b --#define P_VENC_ENCP_LINE VCBUS_REG_ADDR(VENC_ENCP_LINE) --#define VENC_ENCP_PIXEL 0x1b6c --#define P_VENC_ENCP_PIXEL VCBUS_REG_ADDR(VENC_ENCP_PIXEL) --#define VENC_STATA 0x1b6d --#define P_VENC_STATA VCBUS_REG_ADDR(VENC_STATA) --#define VENC_INTCTRL 0x1b6e --#define P_VENC_INTCTRL VCBUS_REG_ADDR(VENC_INTCTRL) --#define VENC_INTFLAG 0x1b6f --#define P_VENC_INTFLAG VCBUS_REG_ADDR(VENC_INTFLAG) --#define VENC_VIDEO_TST_EN 0x1b70 --#define P_VENC_VIDEO_TST_EN VCBUS_REG_ADDR(VENC_VIDEO_TST_EN) --#define VENC_VIDEO_TST_MDSEL 0x1b71 --#define P_VENC_VIDEO_TST_MDSEL VCBUS_REG_ADDR(VENC_VIDEO_TST_MDSEL) --#define VENC_VIDEO_TST_Y 0x1b72 --#define P_VENC_VIDEO_TST_Y VCBUS_REG_ADDR(VENC_VIDEO_TST_Y) --#define VENC_VIDEO_TST_CB 0x1b73 --#define P_VENC_VIDEO_TST_CB VCBUS_REG_ADDR(VENC_VIDEO_TST_CB) --#define VENC_VIDEO_TST_CR 0x1b74 --#define P_VENC_VIDEO_TST_CR VCBUS_REG_ADDR(VENC_VIDEO_TST_CR) --#define VENC_VIDEO_TST_CLRBAR_STRT 0x1b75 --#define VENC_VDAC_FIFO_CTRL 0x1bfc --#define P_VENC_VDAC_FIFO_CTRL VCBUS_REG_ADDR(VENC_VDAC_FIFO_CTRL) --#define ENCL_TCON_INVERT_CTL 0x1bfd --#define P_ENCL_TCON_INVERT_CTL VCBUS_REG_ADDR(ENCL_TCON_INVERT_CTL) --#define ENCP_VIDEO_EN 0x1b80 --#define P_ENCP_VIDEO_EN VCBUS_REG_ADDR(ENCP_VIDEO_EN) --#define ENCP_VIDEO_SYNC_MODE 0x1b81 --#define P_ENCP_VIDEO_SYNC_MODE VCBUS_REG_ADDR(ENCP_VIDEO_SYNC_MODE) --#define ENCP_MACV_EN 0x1b82 --#define P_ENCP_MACV_EN VCBUS_REG_ADDR(ENCP_MACV_EN) --#define ENCP_VIDEO_Y_SCL 0x1b83 --#define P_ENCP_VIDEO_Y_SCL VCBUS_REG_ADDR(ENCP_VIDEO_Y_SCL) --#define ENCP_VIDEO_PB_SCL 0x1b84 --#define P_ENCP_VIDEO_PB_SCL VCBUS_REG_ADDR(ENCP_VIDEO_PB_SCL) --#define ENCP_VIDEO_PR_SCL 0x1b85 --#define P_ENCP_VIDEO_PR_SCL VCBUS_REG_ADDR(ENCP_VIDEO_PR_SCL) --#define ENCP_VIDEO_SYNC_SCL 0x1b86 --#define P_ENCP_VIDEO_SYNC_SCL VCBUS_REG_ADDR(ENCP_VIDEO_SYNC_SCL) --#define ENCP_VIDEO_MACV_SCL 0x1b87 --#define P_ENCP_VIDEO_MACV_SCL VCBUS_REG_ADDR(ENCP_VIDEO_MACV_SCL) --#define ENCP_VIDEO_Y_OFFST 0x1b88 --#define P_ENCP_VIDEO_Y_OFFST VCBUS_REG_ADDR(ENCP_VIDEO_Y_OFFST) --#define ENCP_VIDEO_PB_OFFST 0x1b89 --#define P_ENCP_VIDEO_PB_OFFST VCBUS_REG_ADDR(ENCP_VIDEO_PB_OFFST) --#define ENCP_VIDEO_PR_OFFST 0x1b8a --#define P_ENCP_VIDEO_PR_OFFST VCBUS_REG_ADDR(ENCP_VIDEO_PR_OFFST) --#define ENCP_VIDEO_MACV_OFFST 0x1b8c --#define ENCP_VIDEO_MODE 0x1b8d --#define P_ENCP_VIDEO_MODE VCBUS_REG_ADDR(ENCP_VIDEO_MODE) --#define ENCP_VIDEO_MODE_ADV 0x1b8e --#define P_ENCP_VIDEO_MODE_ADV VCBUS_REG_ADDR(ENCP_VIDEO_MODE_ADV) --#define ENCP_DBG_PX_RST 0x1b90 --#define P_ENCP_DBG_PX_RST VCBUS_REG_ADDR(ENCP_DBG_PX_RST) --#define ENCP_DBG_LN_RST 0x1b91 --#define P_ENCP_DBG_LN_RST VCBUS_REG_ADDR(ENCP_DBG_LN_RST) --#define ENCP_DBG_PX_INT 0x1b92 --#define P_ENCP_DBG_PX_INT VCBUS_REG_ADDR(ENCP_DBG_PX_INT) --#define ENCP_DBG_LN_INT 0x1b93 --#define P_ENCP_DBG_LN_INT VCBUS_REG_ADDR(ENCP_DBG_LN_INT) --#define ENCP_VIDEO_YFP1_HTIME 0x1b94 --#define ENCP_VIDEO_YFP2_HTIME 0x1b95 --#define ENCP_VIDEO_YC_DLY 0x1b96 --#define P_ENCP_VIDEO_YC_DLY VCBUS_REG_ADDR(ENCP_VIDEO_YC_DLY) --#define ENCP_VIDEO_MAX_PXCNT 0x1b97 --#define P_ENCP_VIDEO_MAX_PXCNT VCBUS_REG_ADDR(ENCP_VIDEO_MAX_PXCNT) --#define ENCP_VIDEO_HSO_END 0x1ba8 --#define P_ENCP_VIDEO_HSO_END VCBUS_REG_ADDR(ENCP_VIDEO_HSO_END) --#define ENCP_VIDEO_VSO_BEGIN 0x1ba9 --#define P_ENCP_VIDEO_VSO_BEGIN VCBUS_REG_ADDR(ENCP_VIDEO_VSO_BEGIN) --#define ENCP_VIDEO_VSO_END 0x1baa --#define P_ENCP_VIDEO_VSO_END VCBUS_REG_ADDR(ENCP_VIDEO_VSO_END) --#define ENCP_VIDEO_VSO_BLINE 0x1bab --#define P_ENCP_VIDEO_VSO_BLINE VCBUS_REG_ADDR(ENCP_VIDEO_VSO_BLINE) --#define ENCP_VIDEO_VSO_ELINE 0x1bac --#define P_ENCP_VIDEO_VSO_ELINE VCBUS_REG_ADDR(ENCP_VIDEO_VSO_ELINE) --#define ENCP_VIDEO_SYNC_WAVE_CURVE 0x1bad --#define ENCP_VIDEO_MAX_LNCNT 0x1bae --#define P_ENCP_VIDEO_MAX_LNCNT VCBUS_REG_ADDR(ENCP_VIDEO_MAX_LNCNT) --#define ENCP_VIDEO_SY_VAL 0x1bb0 --#define P_ENCP_VIDEO_SY_VAL VCBUS_REG_ADDR(ENCP_VIDEO_SY_VAL) --#define ENCP_VIDEO_SY2_VAL 0x1bb1 --#define P_ENCP_VIDEO_SY2_VAL VCBUS_REG_ADDR(ENCP_VIDEO_SY2_VAL) --#define ENCP_VIDEO_BLANKY_VAL 0x1bb2 --#define ENCP_VIDEO_HOFFST 0x1bb5 --#define P_ENCP_VIDEO_HOFFST VCBUS_REG_ADDR(ENCP_VIDEO_HOFFST) --#define ENCP_VIDEO_VOFFST 0x1bb6 --#define P_ENCP_VIDEO_VOFFST VCBUS_REG_ADDR(ENCP_VIDEO_VOFFST) --#define ENCP_VIDEO_RGB_CTRL 0x1bb7 --#define P_ENCP_VIDEO_RGB_CTRL VCBUS_REG_ADDR(ENCP_VIDEO_RGB_CTRL) --#define ENCP_VIDEO_FILT_CTRL 0x1bb8 --#define P_ENCP_VIDEO_FILT_CTRL VCBUS_REG_ADDR(ENCP_VIDEO_FILT_CTRL) --#define ENCP_VIDEO_OFLD_VPEQ_OFST 0x1bb9 --#define ENCP_MACV_TIME_DOWN 0x1bcb --#define P_ENCP_MACV_TIME_DOWN VCBUS_REG_ADDR(ENCP_MACV_TIME_DOWN) --#define ENCP_MACV_TIME_LO 0x1bcc --#define P_ENCP_MACV_TIME_LO VCBUS_REG_ADDR(ENCP_MACV_TIME_LO) --#define ENCP_MACV_TIME_UP 0x1bcd --#define P_ENCP_MACV_TIME_UP VCBUS_REG_ADDR(ENCP_MACV_TIME_UP) --#define ENCP_MACV_TIME_RST 0x1bce --#define P_ENCP_MACV_TIME_RST VCBUS_REG_ADDR(ENCP_MACV_TIME_RST) --#define ENCP_VBI_CTRL 0x1bd0 --#define P_ENCP_VBI_CTRL VCBUS_REG_ADDR(ENCP_VBI_CTRL) --#define ENCP_VBI_SETTING 0x1bd1 --#define P_ENCP_VBI_SETTING VCBUS_REG_ADDR(ENCP_VBI_SETTING) --#define ENCP_VBI_BEGIN 0x1bd2 --#define P_ENCP_VBI_BEGIN VCBUS_REG_ADDR(ENCP_VBI_BEGIN) --#define ENCP_VBI_WIDTH 0x1bd3 --#define P_ENCP_VBI_WIDTH VCBUS_REG_ADDR(ENCP_VBI_WIDTH) --#define ENCP_VBI_HVAL 0x1bd4 --#define P_ENCP_VBI_HVAL VCBUS_REG_ADDR(ENCP_VBI_HVAL) --#define ENCP_VBI_DATA0 0x1bd5 --#define P_ENCP_VBI_DATA0 VCBUS_REG_ADDR(ENCP_VBI_DATA0) --#define ENCP_VBI_DATA1 0x1bd6 --#define P_ENCP_VBI_DATA1 VCBUS_REG_ADDR(ENCP_VBI_DATA1) --#define C656_HS_ST 0x1be0 --#define P_C656_HS_ST VCBUS_REG_ADDR(C656_HS_ST) --#define C656_HS_ED 0x1be1 --#define P_C656_HS_ED VCBUS_REG_ADDR(C656_HS_ED) --#define C656_VS_LNST_E 0x1be2 --#define P_C656_VS_LNST_E VCBUS_REG_ADDR(C656_VS_LNST_E) --#define C656_VS_LNST_O 0x1be3 --#define P_C656_VS_LNST_O VCBUS_REG_ADDR(C656_VS_LNST_O) --#define C656_VS_LNED_E 0x1be4 --#define P_C656_VS_LNED_E VCBUS_REG_ADDR(C656_VS_LNED_E) --#define C656_VS_LNED_O 0x1be5 --#define P_C656_VS_LNED_O VCBUS_REG_ADDR(C656_VS_LNED_O) --#define C656_FS_LNST 0x1be6 --#define P_C656_FS_LNST VCBUS_REG_ADDR(C656_FS_LNST) --#define C656_FS_LNED 0x1be7 --#define P_C656_FS_LNED VCBUS_REG_ADDR(C656_FS_LNED) --#define ENCI_VIDEO_MODE 0x1b00 --#define P_ENCI_VIDEO_MODE VCBUS_REG_ADDR(ENCI_VIDEO_MODE) --#define ENCI_VIDEO_MODE_ADV 0x1b01 --#define P_ENCI_VIDEO_MODE_ADV VCBUS_REG_ADDR(ENCI_VIDEO_MODE_ADV) --#define ENCI_VIDEO_FSC_ADJ 0x1b02 --#define P_ENCI_VIDEO_FSC_ADJ VCBUS_REG_ADDR(ENCI_VIDEO_FSC_ADJ) --#define ENCI_VIDEO_BRIGHT 0x1b03 --#define P_ENCI_VIDEO_BRIGHT VCBUS_REG_ADDR(ENCI_VIDEO_BRIGHT) --#define ENCI_VIDEO_CONT 0x1b04 --#define P_ENCI_VIDEO_CONT VCBUS_REG_ADDR(ENCI_VIDEO_CONT) --#define ENCI_VIDEO_SAT 0x1b05 --#define P_ENCI_VIDEO_SAT VCBUS_REG_ADDR(ENCI_VIDEO_SAT) --#define ENCI_VIDEO_HUE 0x1b06 --#define P_ENCI_VIDEO_HUE VCBUS_REG_ADDR(ENCI_VIDEO_HUE) --#define ENCI_VIDEO_SCH 0x1b07 --#define P_ENCI_VIDEO_SCH VCBUS_REG_ADDR(ENCI_VIDEO_SCH) --#define ENCI_SYNC_MODE 0x1b08 --#define P_ENCI_SYNC_MODE VCBUS_REG_ADDR(ENCI_SYNC_MODE) --#define ENCI_SYNC_CTRL 0x1b09 --#define P_ENCI_SYNC_CTRL VCBUS_REG_ADDR(ENCI_SYNC_CTRL) --#define ENCI_SYNC_HSO_BEGIN 0x1b0a --#define P_ENCI_SYNC_HSO_BEGIN VCBUS_REG_ADDR(ENCI_SYNC_HSO_BEGIN) --#define ENCI_SYNC_HSO_END 0x1b0b --#define P_ENCI_SYNC_HSO_END VCBUS_REG_ADDR(ENCI_SYNC_HSO_END) --#define ENCI_SYNC_VSO_EVN 0x1b0c --#define P_ENCI_SYNC_VSO_EVN VCBUS_REG_ADDR(ENCI_SYNC_VSO_EVN) --#define ENCI_SYNC_VSO_ODD 0x1b0d --#define P_ENCI_SYNC_VSO_ODD VCBUS_REG_ADDR(ENCI_SYNC_VSO_ODD) --#define ENCI_SYNC_VSO_EVNLN 0x1b0e --#define P_ENCI_SYNC_VSO_EVNLN VCBUS_REG_ADDR(ENCI_SYNC_VSO_EVNLN) --#define ENCI_SYNC_VSO_ODDLN 0x1b0f --#define P_ENCI_SYNC_VSO_ODDLN VCBUS_REG_ADDR(ENCI_SYNC_VSO_ODDLN) --#define ENCI_SYNC_HOFFST 0x1b10 --#define P_ENCI_SYNC_HOFFST VCBUS_REG_ADDR(ENCI_SYNC_HOFFST) --#define ENCI_SYNC_VOFFST 0x1b11 --#define P_ENCI_SYNC_VOFFST VCBUS_REG_ADDR(ENCI_SYNC_VOFFST) --#define ENCI_SYNC_ADJ 0x1b12 --#define P_ENCI_SYNC_ADJ VCBUS_REG_ADDR(ENCI_SYNC_ADJ) --#define ENCI_RGB_SETTING 0x1b13 --#define P_ENCI_RGB_SETTING VCBUS_REG_ADDR(ENCI_RGB_SETTING) --#define ENCI_DE_H_BEGIN 0x1b16 --#define P_ENCI_DE_H_BEGIN VCBUS_REG_ADDR(ENCI_DE_H_BEGIN) --#define ENCI_DE_H_END 0x1b17 --#define P_ENCI_DE_H_END VCBUS_REG_ADDR(ENCI_DE_H_END) --#define ENCI_DE_V_BEGIN_EVEN 0x1b18 --#define P_ENCI_DE_V_BEGIN_EVEN VCBUS_REG_ADDR(ENCI_DE_V_BEGIN_EVEN) --#define ENCI_DE_V_END_EVEN 0x1b19 --#define P_ENCI_DE_V_END_EVEN VCBUS_REG_ADDR(ENCI_DE_V_END_EVEN) --#define ENCI_DE_V_BEGIN_ODD 0x1b1a --#define P_ENCI_DE_V_BEGIN_ODD VCBUS_REG_ADDR(ENCI_DE_V_BEGIN_ODD) --#define ENCI_DE_V_END_ODD 0x1b1b --#define P_ENCI_DE_V_END_ODD VCBUS_REG_ADDR(ENCI_DE_V_END_ODD) --#define ENCI_VBI_SETTING 0x1b20 --#define P_ENCI_VBI_SETTING VCBUS_REG_ADDR(ENCI_VBI_SETTING) --#define ENCI_VBI_CCDT_EVN 0x1b21 --#define P_ENCI_VBI_CCDT_EVN VCBUS_REG_ADDR(ENCI_VBI_CCDT_EVN) --#define ENCI_VBI_CCDT_ODD 0x1b22 --#define P_ENCI_VBI_CCDT_ODD VCBUS_REG_ADDR(ENCI_VBI_CCDT_ODD) --#define ENCI_VBI_CC525_LN 0x1b23 --#define P_ENCI_VBI_CC525_LN VCBUS_REG_ADDR(ENCI_VBI_CC525_LN) --#define ENCI_VBI_CC625_LN 0x1b24 --#define P_ENCI_VBI_CC625_LN VCBUS_REG_ADDR(ENCI_VBI_CC625_LN) --#define ENCI_VBI_WSSDT 0x1b25 --#define P_ENCI_VBI_WSSDT VCBUS_REG_ADDR(ENCI_VBI_WSSDT) --#define ENCI_VBI_WSS_LN 0x1b26 --#define P_ENCI_VBI_WSS_LN VCBUS_REG_ADDR(ENCI_VBI_WSS_LN) --#define ENCI_VBI_CGMSDT_L 0x1b27 --#define P_ENCI_VBI_CGMSDT_L VCBUS_REG_ADDR(ENCI_VBI_CGMSDT_L) --#define ENCI_VBI_CGMSDT_H 0x1b28 --#define P_ENCI_VBI_CGMSDT_H VCBUS_REG_ADDR(ENCI_VBI_CGMSDT_H) --#define ENCI_VBI_CGMS_LN 0x1b29 --#define P_ENCI_VBI_CGMS_LN VCBUS_REG_ADDR(ENCI_VBI_CGMS_LN) --#define ENCI_VBI_TTX_HTIME 0x1b2a --#define P_ENCI_VBI_TTX_HTIME VCBUS_REG_ADDR(ENCI_VBI_TTX_HTIME) --#define ENCI_VBI_TTX_LN 0x1b2b --#define P_ENCI_VBI_TTX_LN VCBUS_REG_ADDR(ENCI_VBI_TTX_LN) --#define ENCI_VBI_TTXDT0 0x1b2c --#define P_ENCI_VBI_TTXDT0 VCBUS_REG_ADDR(ENCI_VBI_TTXDT0) --#define ENCI_VBI_TTXDT1 0x1b2d --#define P_ENCI_VBI_TTXDT1 VCBUS_REG_ADDR(ENCI_VBI_TTXDT1) --#define ENCI_VBI_TTXDT2 0x1b2e --#define P_ENCI_VBI_TTXDT2 VCBUS_REG_ADDR(ENCI_VBI_TTXDT2) --#define ENCI_VBI_TTXDT3 0x1b2f --#define P_ENCI_VBI_TTXDT3 VCBUS_REG_ADDR(ENCI_VBI_TTXDT3) --#define ENCI_MACV_N0 0x1b30 --#define P_ENCI_MACV_N0 VCBUS_REG_ADDR(ENCI_MACV_N0) --#define ENCI_MACV_N1 0x1b31 --#define P_ENCI_MACV_N1 VCBUS_REG_ADDR(ENCI_MACV_N1) --#define ENCI_MACV_N2 0x1b32 --#define P_ENCI_MACV_N2 VCBUS_REG_ADDR(ENCI_MACV_N2) --#define ENCI_MACV_N3 0x1b33 --#define P_ENCI_MACV_N3 VCBUS_REG_ADDR(ENCI_MACV_N3) --#define ENCI_MACV_N4 0x1b34 --#define P_ENCI_MACV_N4 VCBUS_REG_ADDR(ENCI_MACV_N4) --#define ENCI_MACV_N5 0x1b35 --#define P_ENCI_MACV_N5 VCBUS_REG_ADDR(ENCI_MACV_N5) --#define ENCI_MACV_N6 0x1b36 --#define P_ENCI_MACV_N6 VCBUS_REG_ADDR(ENCI_MACV_N6) --#define ENCI_MACV_N7 0x1b37 --#define P_ENCI_MACV_N7 VCBUS_REG_ADDR(ENCI_MACV_N7) --#define ENCI_MACV_N8 0x1b38 --#define P_ENCI_MACV_N8 VCBUS_REG_ADDR(ENCI_MACV_N8) --#define ENCI_MACV_N9 0x1b39 --#define P_ENCI_MACV_N9 VCBUS_REG_ADDR(ENCI_MACV_N9) --#define ENCI_MACV_N10 0x1b3a --#define P_ENCI_MACV_N10 VCBUS_REG_ADDR(ENCI_MACV_N10) --#define ENCI_MACV_N11 0x1b3b --#define P_ENCI_MACV_N11 VCBUS_REG_ADDR(ENCI_MACV_N11) --#define ENCI_MACV_N12 0x1b3c --#define P_ENCI_MACV_N12 VCBUS_REG_ADDR(ENCI_MACV_N12) --#define ENCI_MACV_N13 0x1b3d --#define P_ENCI_MACV_N13 VCBUS_REG_ADDR(ENCI_MACV_N13) --#define ENCI_MACV_N14 0x1b3e --#define P_ENCI_MACV_N14 VCBUS_REG_ADDR(ENCI_MACV_N14) --#define ENCI_MACV_N15 0x1b3f --#define P_ENCI_MACV_N15 VCBUS_REG_ADDR(ENCI_MACV_N15) --#define ENCI_MACV_N16 0x1b40 --#define P_ENCI_MACV_N16 VCBUS_REG_ADDR(ENCI_MACV_N16) --#define ENCI_MACV_N17 0x1b41 --#define P_ENCI_MACV_N17 VCBUS_REG_ADDR(ENCI_MACV_N17) --#define ENCI_MACV_N18 0x1b42 --#define P_ENCI_MACV_N18 VCBUS_REG_ADDR(ENCI_MACV_N18) --#define ENCI_MACV_N19 0x1b43 --#define P_ENCI_MACV_N19 VCBUS_REG_ADDR(ENCI_MACV_N19) --#define ENCI_MACV_N20 0x1b44 --#define P_ENCI_MACV_N20 VCBUS_REG_ADDR(ENCI_MACV_N20) --#define ENCI_MACV_N21 0x1b45 --#define P_ENCI_MACV_N21 VCBUS_REG_ADDR(ENCI_MACV_N21) --#define ENCI_MACV_N22 0x1b46 --#define P_ENCI_MACV_N22 VCBUS_REG_ADDR(ENCI_MACV_N22) --#define ENCI_DBG_PX_RST 0x1b48 --#define P_ENCI_DBG_PX_RST VCBUS_REG_ADDR(ENCI_DBG_PX_RST) --#define ENCI_DBG_FLDLN_RST 0x1b49 --#define P_ENCI_DBG_FLDLN_RST VCBUS_REG_ADDR(ENCI_DBG_FLDLN_RST) --#define ENCI_DBG_PX_INT 0x1b4a --#define P_ENCI_DBG_PX_INT VCBUS_REG_ADDR(ENCI_DBG_PX_INT) --#define ENCI_DBG_FLDLN_INT 0x1b4b --#define P_ENCI_DBG_FLDLN_INT VCBUS_REG_ADDR(ENCI_DBG_FLDLN_INT) --#define ENCI_DBG_MAXPX 0x1b4c --#define P_ENCI_DBG_MAXPX VCBUS_REG_ADDR(ENCI_DBG_MAXPX) --#define ENCI_DBG_MAXLN 0x1b4d --#define P_ENCI_DBG_MAXLN VCBUS_REG_ADDR(ENCI_DBG_MAXLN) --#define ENCI_MACV_MAX_AMP 0x1b50 --#define P_ENCI_MACV_MAX_AMP VCBUS_REG_ADDR(ENCI_MACV_MAX_AMP) --#define ENCI_MACV_PULSE_LO 0x1b51 --#define P_ENCI_MACV_PULSE_LO VCBUS_REG_ADDR(ENCI_MACV_PULSE_LO) --#define ENCI_MACV_PULSE_HI 0x1b52 --#define P_ENCI_MACV_PULSE_HI VCBUS_REG_ADDR(ENCI_MACV_PULSE_HI) --#define ENCI_MACV_BKP_MAX 0x1b53 --#define P_ENCI_MACV_BKP_MAX VCBUS_REG_ADDR(ENCI_MACV_BKP_MAX) --#define ENCI_CFILT_CTRL 0x1b54 --#define P_ENCI_CFILT_CTRL VCBUS_REG_ADDR(ENCI_CFILT_CTRL) --#define ENCI_CFILT7 0x1b55 --#define P_ENCI_CFILT7 VCBUS_REG_ADDR(ENCI_CFILT7) --#define ENCI_YC_DELAY 0x1b56 --#define P_ENCI_YC_DELAY VCBUS_REG_ADDR(ENCI_YC_DELAY) --#define ENCI_VIDEO_EN 0x1b57 --#define P_ENCI_VIDEO_EN VCBUS_REG_ADDR(ENCI_VIDEO_EN) --#define ENCI_DVI_HSO_BEGIN 0x1c00 --#define P_ENCI_DVI_HSO_BEGIN VCBUS_REG_ADDR(ENCI_DVI_HSO_BEGIN) --#define ENCI_DVI_HSO_END 0x1c01 --#define P_ENCI_DVI_HSO_END VCBUS_REG_ADDR(ENCI_DVI_HSO_END) --#define ENCI_DVI_VSO_END_ODD 0x1c09 --#define P_ENCI_DVI_VSO_END_ODD VCBUS_REG_ADDR(ENCI_DVI_VSO_END_ODD) --#define ENCI_CFILT_CTRL2 0x1c0a --#define P_ENCI_CFILT_CTRL2 VCBUS_REG_ADDR(ENCI_CFILT_CTRL2) --#define ENCI_DACSEL_0 0x1c0b --#define P_ENCI_DACSEL_0 VCBUS_REG_ADDR(ENCI_DACSEL_0) --#define ENCI_DACSEL_1 0x1c0c --#define P_ENCI_DACSEL_1 VCBUS_REG_ADDR(ENCI_DACSEL_1) --#define ENCP_DACSEL_0 0x1c0d --#define P_ENCP_DACSEL_0 VCBUS_REG_ADDR(ENCP_DACSEL_0) --#define ENCP_DACSEL_1 0x1c0e --#define P_ENCP_DACSEL_1 VCBUS_REG_ADDR(ENCP_DACSEL_1) --#define ENCI_TST_EN 0x1c10 --#define P_ENCI_TST_EN VCBUS_REG_ADDR(ENCI_TST_EN) --#define ENCI_TST_MDSEL 0x1c11 --#define P_ENCI_TST_MDSEL VCBUS_REG_ADDR(ENCI_TST_MDSEL) --#define ENCI_TST_Y 0x1c12 --#define P_ENCI_TST_Y VCBUS_REG_ADDR(ENCI_TST_Y) --#define ENCI_TST_CB 0x1c13 --#define P_ENCI_TST_CB VCBUS_REG_ADDR(ENCI_TST_CB) --#define ENCI_TST_CR 0x1c14 --#define P_ENCI_TST_CR VCBUS_REG_ADDR(ENCI_TST_CR) --#define ENCI_TST_CLRBAR_STRT 0x1c15 --#define ENCT_VFIFO2VD_CTL2 0x1c27 --#define P_ENCT_VFIFO2VD_CTL2 VCBUS_REG_ADDR(ENCT_VFIFO2VD_CTL2) --#define ENCT_TST_EN 0x1c28 --#define P_ENCT_TST_EN VCBUS_REG_ADDR(ENCT_TST_EN) --#define ENCT_TST_MDSEL 0x1c29 --#define P_ENCT_TST_MDSEL VCBUS_REG_ADDR(ENCT_TST_MDSEL) --#define ENCT_TST_Y 0x1c2a --#define P_ENCT_TST_Y VCBUS_REG_ADDR(ENCT_TST_Y) --#define ENCT_TST_CB 0x1c2b --#define P_ENCT_TST_CB VCBUS_REG_ADDR(ENCT_TST_CB) --#define ENCT_TST_CR 0x1c2c --#define P_ENCT_TST_CR VCBUS_REG_ADDR(ENCT_TST_CR) --#define ENCT_TST_CLRBAR_STRT 0x1c2d --#define P_ENCT_TST_CLRBAR_STRT VCBUS_REG_ADDR(ENCT_TST_CLRBAR_STRT) --#define ENCT_TST_CLRBAR_WIDTH 0x1c2e --#define ENCT_TST_VDCNT_STSET 0x1c2f --#define P_ENCT_TST_VDCNT_STSET VCBUS_REG_ADDR(ENCT_TST_VDCNT_STSET) --#define ENCP_DVI_HSO_BEGIN 0x1c30 --#define P_ENCP_DVI_HSO_BEGIN VCBUS_REG_ADDR(ENCP_DVI_HSO_BEGIN) --#define ENCP_DVI_HSO_END 0x1c31 --#define P_ENCP_DVI_HSO_END VCBUS_REG_ADDR(ENCP_DVI_HSO_END) --#define ENCP_DVI_VSO_END_EVN 0x1c38 --#define P_ENCP_DVI_VSO_END_EVN VCBUS_REG_ADDR(ENCP_DVI_VSO_END_EVN) --#define ENCP_DVI_VSO_END_ODD 0x1c39 --#define P_ENCP_DVI_VSO_END_ODD VCBUS_REG_ADDR(ENCP_DVI_VSO_END_ODD) --#define ENCP_DE_H_BEGIN 0x1c3a --#define P_ENCP_DE_H_BEGIN VCBUS_REG_ADDR(ENCP_DE_H_BEGIN) --#define ENCP_DE_H_END 0x1c3b --#define P_ENCP_DE_H_END VCBUS_REG_ADDR(ENCP_DE_H_END) --#define ENCP_DE_V_BEGIN_EVEN 0x1c3c --#define P_ENCP_DE_V_BEGIN_EVEN VCBUS_REG_ADDR(ENCP_DE_V_BEGIN_EVEN) --#define ENCP_DE_V_END_EVEN 0x1c3d --#define P_ENCP_DE_V_END_EVEN VCBUS_REG_ADDR(ENCP_DE_V_END_EVEN) --#define ENCP_DE_V_BEGIN_ODD 0x1c3e --#define P_ENCP_DE_V_BEGIN_ODD VCBUS_REG_ADDR(ENCP_DE_V_BEGIN_ODD) --#define ENCP_DE_V_END_ODD 0x1c3f --#define P_ENCP_DE_V_END_ODD VCBUS_REG_ADDR(ENCP_DE_V_END_ODD) -- --#define ENCI_SYNC_PIXEL_EN 0x1c41 --#define P_ENCI_SYNC_PIXEL_EN VCBUS_REG_ADDR(ENCI_SYNC_PIXEL_EN) --#define ENCI_SYNC_TO_LINE_EN 0x1c42 --#define P_ENCI_SYNC_TO_LINE_EN VCBUS_REG_ADDR(ENCI_SYNC_TO_LINE_EN) --#define ENCI_SYNC_TO_PIXEL 0x1c43 --#define P_ENCI_SYNC_TO_PIXEL VCBUS_REG_ADDR(ENCI_SYNC_TO_PIXEL) -- --#define ENCT_VIDEO_EN 0x1c60 --#define P_ENCT_VIDEO_EN VCBUS_REG_ADDR(ENCT_VIDEO_EN) --#define ENCT_VIDEO_Y_SCL 0x1c61 --#define P_ENCT_VIDEO_Y_SCL VCBUS_REG_ADDR(ENCT_VIDEO_Y_SCL) --#define ENCT_VIDEO_PB_SCL 0x1c62 --#define P_ENCT_VIDEO_PB_SCL VCBUS_REG_ADDR(ENCT_VIDEO_PB_SCL) --#define ENCT_VIDEO_PR_SCL 0x1c63 --#define P_ENCT_VIDEO_PR_SCL VCBUS_REG_ADDR(ENCT_VIDEO_PR_SCL) --#define ENCT_VIDEO_Y_OFFST 0x1c64 --#define P_ENCT_VIDEO_Y_OFFST VCBUS_REG_ADDR(ENCT_VIDEO_Y_OFFST) --#define ENCT_VIDEO_PB_OFFST 0x1c65 --#define P_ENCT_VIDEO_PB_OFFST VCBUS_REG_ADDR(ENCT_VIDEO_PB_OFFST) --#define ENCT_VIDEO_PR_OFFST 0x1c66 --#define P_ENCT_VIDEO_PR_OFFST VCBUS_REG_ADDR(ENCT_VIDEO_PR_OFFST) --#define ENCT_VIDEO_MODE 0x1c67 --#define P_ENCT_VIDEO_MODE VCBUS_REG_ADDR(ENCT_VIDEO_MODE) --#define ENCT_VIDEO_MODE_ADV 0x1c68 --#define P_ENCT_VIDEO_MODE_ADV VCBUS_REG_ADDR(ENCT_VIDEO_MODE_ADV) --#define ENCT_DBG_PX_RST 0x1c69 --#define P_ENCT_DBG_PX_RST VCBUS_REG_ADDR(ENCT_DBG_PX_RST) --#define ENCT_DBG_LN_RST 0x1c6a --#define P_ENCT_DBG_LN_RST VCBUS_REG_ADDR(ENCT_DBG_LN_RST) --#define ENCT_DBG_PX_INT 0x1c6b --#define P_ENCT_DBG_PX_INT VCBUS_REG_ADDR(ENCT_DBG_PX_INT) --#define ENCT_DBG_LN_INT 0x1c6c --#define P_ENCT_DBG_LN_INT VCBUS_REG_ADDR(ENCT_DBG_LN_INT) --#define ENCL_TST_VDCNT_STSET 0x1c9f --#define P_ENCL_TST_VDCNT_STSET VCBUS_REG_ADDR(ENCL_TST_VDCNT_STSET) --#define ENCL_VIDEO_EN 0x1ca0 --#define P_ENCL_VIDEO_EN VCBUS_REG_ADDR(ENCL_VIDEO_EN) --#define ENCL_VIDEO_Y_SCL 0x1ca1 --#define P_ENCL_VIDEO_Y_SCL VCBUS_REG_ADDR(ENCL_VIDEO_Y_SCL) --#define ENCL_VIDEO_PB_SCL 0x1ca2 --#define P_ENCL_VIDEO_PB_SCL VCBUS_REG_ADDR(ENCL_VIDEO_PB_SCL) --#define ENCL_VIDEO_PR_SCL 0x1ca3 --#define P_ENCL_VIDEO_PR_SCL VCBUS_REG_ADDR(ENCL_VIDEO_PR_SCL) --#define ENCL_VIDEO_Y_OFFST 0x1ca4 --#define P_ENCL_VIDEO_Y_OFFST VCBUS_REG_ADDR(ENCL_VIDEO_Y_OFFST) --#define ENCL_VIDEO_PB_OFFST 0x1ca5 --#define P_ENCL_VIDEO_PB_OFFST VCBUS_REG_ADDR(ENCL_VIDEO_PB_OFFST) --#define ENCL_VIDEO_PR_OFFST 0x1ca6 --#define P_ENCL_VIDEO_PR_OFFST VCBUS_REG_ADDR(ENCL_VIDEO_PR_OFFST) --#define ENCL_VIDEO_MODE 0x1ca7 --#define P_ENCL_VIDEO_MODE VCBUS_REG_ADDR(ENCL_VIDEO_MODE) --#define ENCL_VIDEO_MODE_ADV 0x1ca8 --#define P_ENCL_VIDEO_MODE_ADV VCBUS_REG_ADDR(ENCL_VIDEO_MODE_ADV) --#define ENCL_DBG_PX_RST 0x1ca9 --#define P_ENCL_DBG_PX_RST VCBUS_REG_ADDR(ENCL_DBG_PX_RST) --#define ENCL_DBG_LN_RST 0x1caa --#define P_ENCL_DBG_LN_RST VCBUS_REG_ADDR(ENCL_DBG_LN_RST) --#define ENCL_DBG_PX_INT 0x1cab --#define P_ENCL_DBG_PX_INT VCBUS_REG_ADDR(ENCL_DBG_PX_INT) --#define ENCL_DBG_LN_INT 0x1cac --#define P_ENCL_DBG_LN_INT VCBUS_REG_ADDR(ENCL_DBG_LN_INT) --#define ENCL_VIDEO_YC_DLY 0x1caf --#define P_ENCL_VIDEO_YC_DLY VCBUS_REG_ADDR(ENCL_VIDEO_YC_DLY) --#define ENCL_VIDEO_MAX_PXCNT 0x1cb0 --#define P_ENCL_VIDEO_MAX_PXCNT VCBUS_REG_ADDR(ENCL_VIDEO_MAX_PXCNT) --#define ENCL_VIDEO_HAVON_END 0x1cb1 --#define P_ENCL_VIDEO_HAVON_END VCBUS_REG_ADDR(ENCL_VIDEO_HAVON_END) --#define ENCL_VIDEO_HSO_BEGIN 0x1cb5 --#define P_ENCL_VIDEO_HSO_BEGIN VCBUS_REG_ADDR(ENCL_VIDEO_HSO_BEGIN) --#define ENCL_VIDEO_HSO_END 0x1cb6 --#define P_ENCL_VIDEO_HSO_END VCBUS_REG_ADDR(ENCL_VIDEO_HSO_END) --#define ENCL_VIDEO_VSO_BEGIN 0x1cb7 --#define P_ENCL_VIDEO_VSO_BEGIN VCBUS_REG_ADDR(ENCL_VIDEO_VSO_BEGIN) --#define ENCL_VIDEO_VSO_END 0x1cb8 --#define P_ENCL_VIDEO_VSO_END VCBUS_REG_ADDR(ENCL_VIDEO_VSO_END) --#define ENCL_VIDEO_VSO_BLINE 0x1cb9 --#define P_ENCL_VIDEO_VSO_BLINE VCBUS_REG_ADDR(ENCL_VIDEO_VSO_BLINE) --#define ENCL_VIDEO_VSO_ELINE 0x1cba --#define P_ENCL_VIDEO_VSO_ELINE VCBUS_REG_ADDR(ENCL_VIDEO_VSO_ELINE) --#define ENCL_VIDEO_MAX_LNCNT 0x1cbb --#define P_ENCL_VIDEO_MAX_LNCNT VCBUS_REG_ADDR(ENCL_VIDEO_MAX_LNCNT) --#define ENCL_VIDEO_BLANKY_VAL 0x1cbc --#define RDMA_AHB_END_ADDR_3 0x1cf7 --#define P_RDMA_AHB_END_ADDR_3 VCBUS_REG_ADDR(RDMA_AHB_END_ADDR_3) --#define RDMA_ACCESS_AUTO 0x1cf8 --#define P_RDMA_ACCESS_AUTO VCBUS_REG_ADDR(RDMA_ACCESS_AUTO) --#define RDMA_ACCESS_MAN 0x1cf9 --#define P_RDMA_ACCESS_MAN VCBUS_REG_ADDR(RDMA_ACCESS_MAN) --#define RDMA_CTRL 0x1cfa --#define P_RDMA_CTRL VCBUS_REG_ADDR(RDMA_CTRL) --#define RDMA_STATUS 0x1cfb --#define P_RDMA_STATUS VCBUS_REG_ADDR(RDMA_STATUS) --#define L_GAMMA_CNTL_PORT 0x1400 --#define P_L_GAMMA_CNTL_PORT VCBUS_REG_ADDR(L_GAMMA_CNTL_PORT) --#define L_GAMMA_DATA_PORT 0x1401 --#define P_L_GAMMA_DATA_PORT VCBUS_REG_ADDR(L_GAMMA_DATA_PORT) --#define L_GAMMA_ADDR_PORT 0x1402 --#define P_L_GAMMA_ADDR_PORT VCBUS_REG_ADDR(L_GAMMA_ADDR_PORT) --#define L_GAMMA_VCOM_HSWITCH_ADDR 0x1403 --#define L_GAMMA_PROBE_POS_X 0x140d --#define P_L_GAMMA_PROBE_POS_X VCBUS_REG_ADDR(L_GAMMA_PROBE_POS_X) --#define L_GAMMA_PROBE_POS_Y 0x140e --#define P_L_GAMMA_PROBE_POS_Y VCBUS_REG_ADDR(L_GAMMA_PROBE_POS_Y) --#define L_STH1_HS_ADDR 0x1410 --#define P_L_STH1_HS_ADDR VCBUS_REG_ADDR(L_STH1_HS_ADDR) --#define L_STH1_HE_ADDR 0x1411 --#define P_L_STH1_HE_ADDR VCBUS_REG_ADDR(L_STH1_HE_ADDR) --#define L_STH1_VS_ADDR 0x1412 --#define P_L_STH1_VS_ADDR VCBUS_REG_ADDR(L_STH1_VS_ADDR) --#define L_STH1_VE_ADDR 0x1413 --#define P_L_STH1_VE_ADDR VCBUS_REG_ADDR(L_STH1_VE_ADDR) --#define L_STH2_HS_ADDR 0x1414 --#define P_L_STH2_HS_ADDR VCBUS_REG_ADDR(L_STH2_HS_ADDR) --#define L_STH2_HE_ADDR 0x1415 --#define P_L_STH2_HE_ADDR VCBUS_REG_ADDR(L_STH2_HE_ADDR) --#define L_STH2_VS_ADDR 0x1416 --#define P_L_STH2_VS_ADDR VCBUS_REG_ADDR(L_STH2_VS_ADDR) --#define L_STH2_VE_ADDR 0x1417 --#define P_L_STH2_VE_ADDR VCBUS_REG_ADDR(L_STH2_VE_ADDR) --#define L_OEH_HS_ADDR 0x1418 --#define P_L_OEH_HS_ADDR VCBUS_REG_ADDR(L_OEH_HS_ADDR) --#define L_OEH_HE_ADDR 0x1419 --#define P_L_OEH_HE_ADDR VCBUS_REG_ADDR(L_OEH_HE_ADDR) --#define L_OEH_VS_ADDR 0x141a --#define P_L_OEH_VS_ADDR VCBUS_REG_ADDR(L_OEH_VS_ADDR) --#define L_OEH_VE_ADDR 0x141b --#define P_L_OEH_VE_ADDR VCBUS_REG_ADDR(L_OEH_VE_ADDR) --#define L_VCOM_HSWITCH_ADDR 0x141c --#define P_L_VCOM_HSWITCH_ADDR VCBUS_REG_ADDR(L_VCOM_HSWITCH_ADDR) --#define L_VCOM_VS_ADDR 0x141d --#define P_L_VCOM_VS_ADDR VCBUS_REG_ADDR(L_VCOM_VS_ADDR) --#define L_VCOM_VE_ADDR 0x141e --#define P_L_VCOM_VE_ADDR VCBUS_REG_ADDR(L_VCOM_VE_ADDR) --#define L_CPV1_HS_ADDR 0x141f --#define P_L_CPV1_HS_ADDR VCBUS_REG_ADDR(L_CPV1_HS_ADDR) --#define L_CPV1_HE_ADDR 0x1420 --#define P_L_CPV1_HE_ADDR VCBUS_REG_ADDR(L_CPV1_HE_ADDR) --#define L_CPV1_VS_ADDR 0x1421 --#define P_L_CPV1_VS_ADDR VCBUS_REG_ADDR(L_CPV1_VS_ADDR) --#define L_CPV1_VE_ADDR 0x1422 --#define P_L_CPV1_VE_ADDR VCBUS_REG_ADDR(L_CPV1_VE_ADDR) --#define L_CPV2_HS_ADDR 0x1423 --#define P_L_CPV2_HS_ADDR VCBUS_REG_ADDR(L_CPV2_HS_ADDR) --#define L_CPV2_HE_ADDR 0x1424 --#define P_L_CPV2_HE_ADDR VCBUS_REG_ADDR(L_CPV2_HE_ADDR) --#define L_CPV2_VS_ADDR 0x1425 --#define P_L_CPV2_VS_ADDR VCBUS_REG_ADDR(L_CPV2_VS_ADDR) --#define L_CPV2_VE_ADDR 0x1426 --#define P_L_CPV2_VE_ADDR VCBUS_REG_ADDR(L_CPV2_VE_ADDR) --#define L_STV1_HS_ADDR 0x1427 --#define P_L_STV1_HS_ADDR VCBUS_REG_ADDR(L_STV1_HS_ADDR) --#define L_STV1_HE_ADDR 0x1428 --#define P_L_STV1_HE_ADDR VCBUS_REG_ADDR(L_STV1_HE_ADDR) --#define L_STV1_VS_ADDR 0x1429 --#define P_L_STV1_VS_ADDR VCBUS_REG_ADDR(L_STV1_VS_ADDR) --#define L_STV1_VE_ADDR 0x142a --#define P_L_STV1_VE_ADDR VCBUS_REG_ADDR(L_STV1_VE_ADDR) --#define L_STV2_HS_ADDR 0x142b --#define P_L_STV2_HS_ADDR VCBUS_REG_ADDR(L_STV2_HS_ADDR) --#define L_STV2_HE_ADDR 0x142c --#define P_L_STV2_HE_ADDR VCBUS_REG_ADDR(L_STV2_HE_ADDR) --#define L_STV2_VS_ADDR 0x142d --#define P_L_STV2_VS_ADDR VCBUS_REG_ADDR(L_STV2_VS_ADDR) --#define L_STV2_VE_ADDR 0x142e --#define P_L_STV2_VE_ADDR VCBUS_REG_ADDR(L_STV2_VE_ADDR) --#define L_OEV1_HS_ADDR 0x142f --#define P_L_OEV1_HS_ADDR VCBUS_REG_ADDR(L_OEV1_HS_ADDR) --#define L_OEV1_HE_ADDR 0x1430 --#define P_L_OEV1_HE_ADDR VCBUS_REG_ADDR(L_OEV1_HE_ADDR) --#define L_OEV1_VS_ADDR 0x1431 --#define P_L_OEV1_VS_ADDR VCBUS_REG_ADDR(L_OEV1_VS_ADDR) --#define L_OEV1_VE_ADDR 0x1432 --#define P_L_OEV1_VE_ADDR VCBUS_REG_ADDR(L_OEV1_VE_ADDR) --#define L_OEV2_HS_ADDR 0x1433 --#define P_L_OEV2_HS_ADDR VCBUS_REG_ADDR(L_OEV2_HS_ADDR) --#define L_OEV2_HE_ADDR 0x1434 --#define P_L_OEV2_HE_ADDR VCBUS_REG_ADDR(L_OEV2_HE_ADDR) --#define L_OEV2_VS_ADDR 0x1435 --#define P_L_OEV2_VS_ADDR VCBUS_REG_ADDR(L_OEV2_VS_ADDR) --#define L_OEV2_VE_ADDR 0x1436 --#define P_L_OEV2_VE_ADDR VCBUS_REG_ADDR(L_OEV2_VE_ADDR) --#define L_OEV3_HS_ADDR 0x1437 --#define P_L_OEV3_HS_ADDR VCBUS_REG_ADDR(L_OEV3_HS_ADDR) --#define L_OEV3_HE_ADDR 0x1438 --#define P_L_OEV3_HE_ADDR VCBUS_REG_ADDR(L_OEV3_HE_ADDR) --#define L_OEV3_VS_ADDR 0x1439 --#define P_L_OEV3_VS_ADDR VCBUS_REG_ADDR(L_OEV3_VS_ADDR) --#define L_OEV3_VE_ADDR 0x143a --#define P_L_OEV3_VE_ADDR VCBUS_REG_ADDR(L_OEV3_VE_ADDR) --#define L_LCD_PWR_ADDR 0x143b --#define P_L_LCD_PWR_ADDR VCBUS_REG_ADDR(L_LCD_PWR_ADDR) --#define L_LCD_PWM0_LO_ADDR 0x143c --#define P_L_LCD_PWM0_LO_ADDR VCBUS_REG_ADDR(L_LCD_PWM0_LO_ADDR) --#define L_LCD_PWM0_HI_ADDR 0x143d --#define P_L_LCD_PWM0_HI_ADDR VCBUS_REG_ADDR(L_LCD_PWM0_HI_ADDR) --#define L_LCD_PWM1_LO_ADDR 0x143e --#define P_L_LCD_PWM1_LO_ADDR VCBUS_REG_ADDR(L_LCD_PWM1_LO_ADDR) --#define L_LCD_PWM1_HI_ADDR 0x143f --#define P_L_LCD_PWM1_HI_ADDR VCBUS_REG_ADDR(L_LCD_PWM1_HI_ADDR) --#define L_INV_CNT_ADDR 0x1440 --#define P_L_INV_CNT_ADDR VCBUS_REG_ADDR(L_INV_CNT_ADDR) --#define L_TCON_MISC_SEL_ADDR 0x1441 --#define P_L_TCON_MISC_SEL_ADDR VCBUS_REG_ADDR(L_TCON_MISC_SEL_ADDR) --#define MLVDS_CLK_CTL1_HI 0x1443 --#define P_MLVDS_CLK_CTL1_HI VCBUS_REG_ADDR(MLVDS_CLK_CTL1_HI) --#define MLVDS_CLK_CTL1_LO 0x1444 --#define P_MLVDS_CLK_CTL1_LO VCBUS_REG_ADDR(MLVDS_CLK_CTL1_LO) --#define L_TCON_DOUBLE_CTL 0x1449 --#define P_L_TCON_DOUBLE_CTL VCBUS_REG_ADDR(L_TCON_DOUBLE_CTL) --#define L_TCON_PATTERN_HI 0x144a --#define P_L_TCON_PATTERN_HI VCBUS_REG_ADDR(L_TCON_PATTERN_HI) --#define L_TCON_PATTERN_LO 0x144b --#define P_L_TCON_PATTERN_LO VCBUS_REG_ADDR(L_TCON_PATTERN_LO) --#define LDIM_BL_ADDR_PORT 0x144e --#define P_LDIM_BL_ADDR_PORT VCBUS_REG_ADDR(LDIM_BL_ADDR_PORT) --#define LDIM_BL_DATA_PORT 0x144f --#define P_LDIM_BL_DATA_PORT VCBUS_REG_ADDR(LDIM_BL_DATA_PORT) --#define L_DE_HS_ADDR 0x1451 --#define P_L_DE_HS_ADDR VCBUS_REG_ADDR(L_DE_HS_ADDR) --#define L_DE_HE_ADDR 0x1452 --#define P_L_DE_HE_ADDR VCBUS_REG_ADDR(L_DE_HE_ADDR) --#define L_DE_VS_ADDR 0x1453 --#define P_L_DE_VS_ADDR VCBUS_REG_ADDR(L_DE_VS_ADDR) --#define L_DE_VE_ADDR 0x1454 --#define P_L_DE_VE_ADDR VCBUS_REG_ADDR(L_DE_VE_ADDR) --#define L_HSYNC_HS_ADDR 0x1455 --#define P_L_HSYNC_HS_ADDR VCBUS_REG_ADDR(L_HSYNC_HS_ADDR) --#define L_HSYNC_HE_ADDR 0x1456 --#define P_L_HSYNC_HE_ADDR VCBUS_REG_ADDR(L_HSYNC_HE_ADDR) --#define L_HSYNC_VS_ADDR 0x1457 --#define P_L_HSYNC_VS_ADDR VCBUS_REG_ADDR(L_HSYNC_VS_ADDR) --#define L_HSYNC_VE_ADDR 0x1458 --#define P_L_HSYNC_VE_ADDR VCBUS_REG_ADDR(L_HSYNC_VE_ADDR) --#define L_VSYNC_HS_ADDR 0x1459 --#define P_L_VSYNC_HS_ADDR VCBUS_REG_ADDR(L_VSYNC_HS_ADDR) --#define L_VSYNC_HE_ADDR 0x145a --#define P_L_VSYNC_HE_ADDR VCBUS_REG_ADDR(L_VSYNC_HE_ADDR) --#define L_VSYNC_VS_ADDR 0x145b --#define P_L_VSYNC_VS_ADDR VCBUS_REG_ADDR(L_VSYNC_VS_ADDR) --#define L_VSYNC_VE_ADDR 0x145c --#define P_L_VSYNC_VE_ADDR VCBUS_REG_ADDR(L_VSYNC_VE_ADDR) --#define L_LCD_MCU_CTL 0x145d --#define P_L_LCD_MCU_CTL VCBUS_REG_ADDR(L_LCD_MCU_CTL) --#define DUAL_MLVDS_CTL 0x1460 --#define P_DUAL_MLVDS_CTL VCBUS_REG_ADDR(DUAL_MLVDS_CTL) -- --#define V_INVERSION_PIXEL 0x1470 --#define P_V_INVERSION_PIXEL VCBUS_REG_ADDR(V_INVERSION_PIXEL) --#define V_INVERSION_LINE 0x1471 --#define P_V_INVERSION_LINE VCBUS_REG_ADDR(V_INVERSION_LINE) --#define V_INVERSION_CONTROL 0x1472 --#define P_V_INVERSION_CONTROL VCBUS_REG_ADDR(V_INVERSION_CONTROL) --#define MLVDS2_CONTROL 0x1474 --#define P_MLVDS2_CONTROL VCBUS_REG_ADDR(MLVDS2_CONTROL) --#define MLVDS2_CONFIG_HI 0x1475 --#define P_MLVDS2_CONFIG_HI VCBUS_REG_ADDR(MLVDS2_CONFIG_HI) --#define MLVDS2_CONFIG_LO 0x1476 --#define P_MLVDS2_CONFIG_LO VCBUS_REG_ADDR(MLVDS2_CONFIG_LO) --#define MLVDS2_DUAL_GATE_WR_START 0x1477 --#define RGB_BASE_ADDR 0x1485 --#define P_RGB_BASE_ADDR VCBUS_REG_ADDR(RGB_BASE_ADDR) --#define RGB_COEFF_ADDR 0x1486 --#define P_RGB_COEFF_ADDR VCBUS_REG_ADDR(RGB_COEFF_ADDR) --#define POL_CNTL_ADDR 0x1487 --#define P_POL_CNTL_ADDR VCBUS_REG_ADDR(POL_CNTL_ADDR) --#define DITH_CNTL_ADDR 0x1488 --#define P_DITH_CNTL_ADDR VCBUS_REG_ADDR(DITH_CNTL_ADDR) --#define GAMMA_PROBE_CTRL 0x1489 --#define P_GAMMA_PROBE_CTRL VCBUS_REG_ADDR(GAMMA_PROBE_CTRL) --#define GAMMA_PROBE_COLOR_L 0x148a --#define P_GAMMA_PROBE_COLOR_L VCBUS_REG_ADDR(GAMMA_PROBE_COLOR_L) --#define GAMMA_PROBE_COLOR_H 0x148b --#define P_GAMMA_PROBE_COLOR_H VCBUS_REG_ADDR(GAMMA_PROBE_COLOR_H) --#define GAMMA_PROBE_HL_COLOR 0x148c --#define P_GAMMA_PROBE_HL_COLOR VCBUS_REG_ADDR(GAMMA_PROBE_HL_COLOR) --#define GAMMA_PROBE_POS_X 0x148d --#define P_GAMMA_PROBE_POS_X VCBUS_REG_ADDR(GAMMA_PROBE_POS_X) --#define GAMMA_PROBE_POS_Y 0x148e --#define P_GAMMA_PROBE_POS_Y VCBUS_REG_ADDR(GAMMA_PROBE_POS_Y) --#define STH1_HS_ADDR 0x1490 --#define P_STH1_HS_ADDR VCBUS_REG_ADDR(STH1_HS_ADDR) --#define STH1_HE_ADDR 0x1491 --#define P_STH1_HE_ADDR VCBUS_REG_ADDR(STH1_HE_ADDR) --#define STH1_VS_ADDR 0x1492 --#define P_STH1_VS_ADDR VCBUS_REG_ADDR(STH1_VS_ADDR) --#define STH1_VE_ADDR 0x1493 --#define P_STH1_VE_ADDR VCBUS_REG_ADDR(STH1_VE_ADDR) --#define STH2_HS_ADDR 0x1494 --#define P_STH2_HS_ADDR VCBUS_REG_ADDR(STH2_HS_ADDR) --#define STH2_HE_ADDR 0x1495 --#define P_STH2_HE_ADDR VCBUS_REG_ADDR(STH2_HE_ADDR) --#define STH2_VS_ADDR 0x1496 --#define P_STH2_VS_ADDR VCBUS_REG_ADDR(STH2_VS_ADDR) --#define STH2_VE_ADDR 0x1497 --#define P_STH2_VE_ADDR VCBUS_REG_ADDR(STH2_VE_ADDR) --#define OEH_HS_ADDR 0x1498 --#define P_OEH_HS_ADDR VCBUS_REG_ADDR(OEH_HS_ADDR) --#define OEH_HE_ADDR 0x1499 --#define P_OEH_HE_ADDR VCBUS_REG_ADDR(OEH_HE_ADDR) --#define OEH_VS_ADDR 0x149a --#define P_OEH_VS_ADDR VCBUS_REG_ADDR(OEH_VS_ADDR) --#define OEH_VE_ADDR 0x149b --#define P_OEH_VE_ADDR VCBUS_REG_ADDR(OEH_VE_ADDR) --#define VCOM_HSWITCH_ADDR 0x149c --#define P_VCOM_HSWITCH_ADDR VCBUS_REG_ADDR(VCOM_HSWITCH_ADDR) --#define VCOM_VS_ADDR 0x149d --#define P_VCOM_VS_ADDR VCBUS_REG_ADDR(VCOM_VS_ADDR) --#define VCOM_VE_ADDR 0x149e --#define P_VCOM_VE_ADDR VCBUS_REG_ADDR(VCOM_VE_ADDR) --#define CPV1_HS_ADDR 0x149f --#define P_CPV1_HS_ADDR VCBUS_REG_ADDR(CPV1_HS_ADDR) --#define CPV1_HE_ADDR 0x14a0 --#define P_CPV1_HE_ADDR VCBUS_REG_ADDR(CPV1_HE_ADDR) --#define CPV1_VS_ADDR 0x14a1 --#define P_CPV1_VS_ADDR VCBUS_REG_ADDR(CPV1_VS_ADDR) --#define CPV1_VE_ADDR 0x14a2 --#define P_CPV1_VE_ADDR VCBUS_REG_ADDR(CPV1_VE_ADDR) --#define CPV2_HS_ADDR 0x14a3 --#define P_CPV2_HS_ADDR VCBUS_REG_ADDR(CPV2_HS_ADDR) --#define CPV2_HE_ADDR 0x14a4 --#define P_CPV2_HE_ADDR VCBUS_REG_ADDR(CPV2_HE_ADDR) --#define CPV2_VS_ADDR 0x14a5 --#define P_CPV2_VS_ADDR VCBUS_REG_ADDR(CPV2_VS_ADDR) --#define CPV2_VE_ADDR 0x14a6 --#define P_CPV2_VE_ADDR VCBUS_REG_ADDR(CPV2_VE_ADDR) --#define STV1_HS_ADDR 0x14a7 --#define P_STV1_HS_ADDR VCBUS_REG_ADDR(STV1_HS_ADDR) --#define STV1_HE_ADDR 0x14a8 --#define P_STV1_HE_ADDR VCBUS_REG_ADDR(STV1_HE_ADDR) --#define STV1_VS_ADDR 0x14a9 --#define P_STV1_VS_ADDR VCBUS_REG_ADDR(STV1_VS_ADDR) --#define STV1_VE_ADDR 0x14aa --#define P_STV1_VE_ADDR VCBUS_REG_ADDR(STV1_VE_ADDR) --#define STV2_HS_ADDR 0x14ab --#define P_STV2_HS_ADDR VCBUS_REG_ADDR(STV2_HS_ADDR) --#define STV2_HE_ADDR 0x14ac --#define P_STV2_HE_ADDR VCBUS_REG_ADDR(STV2_HE_ADDR) --#define STV2_VS_ADDR 0x14ad --#define P_STV2_VS_ADDR VCBUS_REG_ADDR(STV2_VS_ADDR) --#define STV2_VE_ADDR 0x14ae --#define P_STV2_VE_ADDR VCBUS_REG_ADDR(STV2_VE_ADDR) --#define OEV1_HS_ADDR 0x14af --#define P_OEV1_HS_ADDR VCBUS_REG_ADDR(OEV1_HS_ADDR) --#define OEV1_HE_ADDR 0x14b0 --#define P_OEV1_HE_ADDR VCBUS_REG_ADDR(OEV1_HE_ADDR) --#define OEV1_VS_ADDR 0x14b1 --#define P_OEV1_VS_ADDR VCBUS_REG_ADDR(OEV1_VS_ADDR) --#define OEV1_VE_ADDR 0x14b2 --#define P_OEV1_VE_ADDR VCBUS_REG_ADDR(OEV1_VE_ADDR) --#define OEV2_HS_ADDR 0x14b3 --#define P_OEV2_HS_ADDR VCBUS_REG_ADDR(OEV2_HS_ADDR) --#define OEV2_HE_ADDR 0x14b4 --#define P_OEV2_HE_ADDR VCBUS_REG_ADDR(OEV2_HE_ADDR) --#define OEV2_VS_ADDR 0x14b5 --#define P_OEV2_VS_ADDR VCBUS_REG_ADDR(OEV2_VS_ADDR) --#define OEV2_VE_ADDR 0x14b6 --#define P_OEV2_VE_ADDR VCBUS_REG_ADDR(OEV2_VE_ADDR) --#define OEV3_HS_ADDR 0x14b7 --#define P_OEV3_HS_ADDR VCBUS_REG_ADDR(OEV3_HS_ADDR) --#define OEV3_HE_ADDR 0x14b8 --#define P_OEV3_HE_ADDR VCBUS_REG_ADDR(OEV3_HE_ADDR) --#define OEV3_VS_ADDR 0x14b9 --#define P_OEV3_VS_ADDR VCBUS_REG_ADDR(OEV3_VS_ADDR) --#define OEV3_VE_ADDR 0x14ba --#define P_OEV3_VE_ADDR VCBUS_REG_ADDR(OEV3_VE_ADDR) --#define LCD_PWR_ADDR 0x14bb --#define P_LCD_PWR_ADDR VCBUS_REG_ADDR(LCD_PWR_ADDR) --#define LCD_PWM0_LO_ADDR 0x14bc --#define P_LCD_PWM0_LO_ADDR VCBUS_REG_ADDR(LCD_PWM0_LO_ADDR) --#define LCD_PWM0_HI_ADDR 0x14bd --#define P_LCD_PWM0_HI_ADDR VCBUS_REG_ADDR(LCD_PWM0_HI_ADDR) --#define LCD_PWM1_LO_ADDR 0x14be --#define P_LCD_PWM1_LO_ADDR VCBUS_REG_ADDR(LCD_PWM1_LO_ADDR) --#define LCD_PWM1_HI_ADDR 0x14bf --#define P_LCD_PWM1_HI_ADDR VCBUS_REG_ADDR(LCD_PWM1_HI_ADDR) --#define INV_CNT_ADDR 0x14c0 --#define P_INV_CNT_ADDR VCBUS_REG_ADDR(INV_CNT_ADDR) --#define TCON_MISC_SEL_ADDR 0x14c1 --#define P_TCON_MISC_SEL_ADDR VCBUS_REG_ADDR(TCON_MISC_SEL_ADDR) --#define DUAL_PORT_CNTL_ADDR 0x14c2 --#define P_DUAL_PORT_CNTL_ADDR VCBUS_REG_ADDR(DUAL_PORT_CNTL_ADDR) --#define MLVDS_CONTROL 0x14c3 --#define P_MLVDS_CONTROL VCBUS_REG_ADDR(MLVDS_CONTROL) --#define MLVDS_CONFIG_HI 0x14c7 --#define P_MLVDS_CONFIG_HI VCBUS_REG_ADDR(MLVDS_CONFIG_HI) --#define MLVDS_CONFIG_LO 0x14c8 --#define P_MLVDS_CONFIG_LO VCBUS_REG_ADDR(MLVDS_CONFIG_LO) --#define TCON_DOUBLE_CTL 0x14c9 --#define P_TCON_DOUBLE_CTL VCBUS_REG_ADDR(TCON_DOUBLE_CTL) --#define TCON_PATTERN_HI 0x14ca --#define P_TCON_PATTERN_HI VCBUS_REG_ADDR(TCON_PATTERN_HI) --#define TCON_PATTERN_LO 0x14cb --#define P_TCON_PATTERN_LO VCBUS_REG_ADDR(TCON_PATTERN_LO) --#define TCON_CONTROL_HI 0x14cc --#define P_TCON_CONTROL_HI VCBUS_REG_ADDR(TCON_CONTROL_HI) --#define TCON_CONTROL_LO 0x14cd --#define P_TCON_CONTROL_LO VCBUS_REG_ADDR(TCON_CONTROL_LO) --#define LVDS_BLANK_DATA_HI 0x14ce --#define P_LVDS_BLANK_DATA_HI VCBUS_REG_ADDR(LVDS_BLANK_DATA_HI) --#define LVDS_BLANK_DATA_LO 0x14cf --#define P_LVDS_BLANK_DATA_LO VCBUS_REG_ADDR(LVDS_BLANK_DATA_LO) --#define LVDS_PACK_CNTL_ADDR 0x14d0 --#define P_LVDS_PACK_CNTL_ADDR VCBUS_REG_ADDR(LVDS_PACK_CNTL_ADDR) --#define DE_HS_ADDR 0x14d1 --#define P_DE_HS_ADDR VCBUS_REG_ADDR(DE_HS_ADDR) --#define DE_HE_ADDR 0x14d2 --#define P_DE_HE_ADDR VCBUS_REG_ADDR(DE_HE_ADDR) --#define DE_VS_ADDR 0x14d3 --#define P_DE_VS_ADDR VCBUS_REG_ADDR(DE_VS_ADDR) --#define DE_VE_ADDR 0x14d4 --#define P_DE_VE_ADDR VCBUS_REG_ADDR(DE_VE_ADDR) --#define HSYNC_HS_ADDR 0x14d5 --#define P_HSYNC_HS_ADDR VCBUS_REG_ADDR(HSYNC_HS_ADDR) --#define HSYNC_HE_ADDR 0x14d6 --#define P_HSYNC_HE_ADDR VCBUS_REG_ADDR(HSYNC_HE_ADDR) --#define HSYNC_VS_ADDR 0x14d7 --#define P_HSYNC_VS_ADDR VCBUS_REG_ADDR(HSYNC_VS_ADDR) --#define HSYNC_VE_ADDR 0x14d8 --#define P_HSYNC_VE_ADDR VCBUS_REG_ADDR(HSYNC_VE_ADDR) --#define VSYNC_HS_ADDR 0x14d9 --#define P_VSYNC_HS_ADDR VCBUS_REG_ADDR(VSYNC_HS_ADDR) --#define VSYNC_HE_ADDR 0x14da --#define P_VSYNC_HE_ADDR VCBUS_REG_ADDR(VSYNC_HE_ADDR) --#define VSYNC_VS_ADDR 0x14db --#define P_VSYNC_VS_ADDR VCBUS_REG_ADDR(VSYNC_VS_ADDR) --#define VSYNC_VE_ADDR 0x14dc --#define P_VSYNC_VE_ADDR VCBUS_REG_ADDR(VSYNC_VE_ADDR) --#define LCD_MCU_CTL 0x14dd --#define P_LCD_MCU_CTL VCBUS_REG_ADDR(LCD_MCU_CTL) --#define LCD_MCU_DATA_0 0x14de --#define P_LCD_MCU_DATA_0 VCBUS_REG_ADDR(LCD_MCU_DATA_0) --#define LCD_MCU_DATA_1 0x14df --#define P_LCD_MCU_DATA_1 VCBUS_REG_ADDR(LCD_MCU_DATA_1) --#define LVDS_GEN_CNTL 0x14e0 --#define P_LVDS_GEN_CNTL VCBUS_REG_ADDR(LVDS_GEN_CNTL) --#define LVDS_PHY_CNTL0 0x14e1 --#define P_LVDS_PHY_CNTL0 VCBUS_REG_ADDR(LVDS_PHY_CNTL0) --#define LVDS_PHY_CNTL1 0x14e2 --#define P_LVDS_PHY_CNTL1 VCBUS_REG_ADDR(LVDS_PHY_CNTL1) --#define LVDS_PHY_CNTL2 0x14e3 --#define P_LVDS_PHY_CNTL2 VCBUS_REG_ADDR(LVDS_PHY_CNTL2) --#define LVDS_PHY_CNTL3 0x14e4 --#define P_LVDS_PHY_CNTL3 VCBUS_REG_ADDR(LVDS_PHY_CNTL3) --#define LVDS_PHY_CNTL4 0x14e5 --#define P_LVDS_PHY_CNTL4 VCBUS_REG_ADDR(LVDS_PHY_CNTL4) --#define LVDS_PHY_CNTL5 0x14e6 --#define P_LVDS_PHY_CNTL5 VCBUS_REG_ADDR(LVDS_PHY_CNTL5) --#define LVDS_SRG_TEST 0x14e8 --#define P_LVDS_SRG_TEST VCBUS_REG_ADDR(LVDS_SRG_TEST) --#define LVDS_BIST_MUX0 0x14e9 --#define P_LVDS_BIST_MUX0 VCBUS_REG_ADDR(LVDS_BIST_MUX0) --#define LVDS_BIST_MUX1 0x14ea --#define P_LVDS_BIST_MUX1 VCBUS_REG_ADDR(LVDS_BIST_MUX1) --#define LVDS_BIST_FIXED0 0x14eb --#define P_LVDS_BIST_FIXED0 VCBUS_REG_ADDR(LVDS_BIST_FIXED0) --#define LVDS_BIST_FIXED1 0x14ec --#define P_LVDS_BIST_FIXED1 VCBUS_REG_ADDR(LVDS_BIST_FIXED1) --#define P_VPU_OSD1_MMC_CTRL VCBUS_REG_ADDR(VPU_OSD1_MMC_CTRL) --#define VPU_OSD2_MMC_CTRL 0x2702 --#define P_VPU_OSD2_MMC_CTRL VCBUS_REG_ADDR(VPU_OSD2_MMC_CTRL) --#define VPU_VD1_MMC_CTRL 0x2703 --#define P_VPU_VD1_MMC_CTRL VCBUS_REG_ADDR(VPU_VD1_MMC_CTRL) --#define VPU_VD2_MMC_CTRL 0x2704 --#define P_VPU_VD2_MMC_CTRL VCBUS_REG_ADDR(VPU_VD2_MMC_CTRL) --#define VPU_DI_IF1_MMC_CTRL 0x2705 --#define P_VPU_DI_IF1_MMC_CTRL VCBUS_REG_ADDR(VPU_DI_IF1_MMC_CTRL) --#define VPU_DI_MEM_MMC_CTRL 0x2706 --#define P_VPU_DI_MEM_MMC_CTRL VCBUS_REG_ADDR(VPU_DI_MEM_MMC_CTRL) --#define VPU_DI_INP_MMC_CTRL 0x2707 --#define P_VPU_DI_INP_MMC_CTRL VCBUS_REG_ADDR(VPU_DI_INP_MMC_CTRL) --#define VPU_DI_NRWR_MMC_CTRL 0x270b --#define P_VPU_DI_NRWR_MMC_CTRL VCBUS_REG_ADDR(VPU_DI_NRWR_MMC_CTRL) --#define VPU_DI_DIWR_MMC_CTRL 0x270c --#define P_VPU_DI_DIWR_MMC_CTRL VCBUS_REG_ADDR(VPU_DI_DIWR_MMC_CTRL) --#define VPU_VDIN0_MMC_CTRL 0x270d --#define P_VPU_VDIN0_MMC_CTRL VCBUS_REG_ADDR(VPU_VDIN0_MMC_CTRL) --#define VPU_VDIN1_MMC_CTRL 0x270e --#define P_VPU_VDIN1_MMC_CTRL VCBUS_REG_ADDR(VPU_VDIN1_MMC_CTRL) --#define VPU_BT656_MMC_CTRL 0x270f --#define P_VPU_BT656_MMC_CTRL VCBUS_REG_ADDR(VPU_BT656_MMC_CTRL) --#define VPU_TVD3D_MMC_CTRL 0x2710 --#define P_VPU_TVD3D_MMC_CTRL VCBUS_REG_ADDR(VPU_TVD3D_MMC_CTRL) --#define VPU_TVDVBI_MMC_CTRL 0x2711 --#define P_VPU_TVDVBI_MMC_CTRL VCBUS_REG_ADDR(VPU_TVDVBI_MMC_CTRL) --#define VPU_TVDVBI_VSLATCH_ADDR 0x2712 --#define VPU_HDMI_SETTING 0x271b --#define P_VPU_HDMI_SETTING VCBUS_REG_ADDR(VPU_HDMI_SETTING) --#define ENCI_INFO_READ 0x271c --#define P_ENCI_INFO_READ VCBUS_REG_ADDR(ENCI_INFO_READ) --#define ENCP_INFO_READ 0x271d --#define P_ENCP_INFO_READ VCBUS_REG_ADDR(ENCP_INFO_READ) --#define ENCT_INFO_READ 0x271e --#define P_ENCT_INFO_READ VCBUS_REG_ADDR(ENCT_INFO_READ) --#define ENCL_INFO_READ 0x271f --#define P_ENCL_INFO_READ VCBUS_REG_ADDR(ENCL_INFO_READ) --#define VPU_SW_RESET 0x2720 --#define P_VPU_SW_RESET VCBUS_REG_ADDR(VPU_SW_RESET) --#define VPU_D2D3_MMC_CTRL 0x2721 --#define P_VPU_D2D3_MMC_CTRL VCBUS_REG_ADDR(VPU_D2D3_MMC_CTRL) --#define VPU_CONT_MMC_CTRL 0x2722 --#define P_VPU_CONT_MMC_CTRL VCBUS_REG_ADDR(VPU_CONT_MMC_CTRL) --#define VPU_CLK_GATE 0x2723 --#define P_VPU_CLK_GATE VCBUS_REG_ADDR(VPU_CLK_GATE) --#define VPU_RDMA_MMC_CTRL 0x2724 --#define P_VPU_RDMA_MMC_CTRL VCBUS_REG_ADDR(VPU_RDMA_MMC_CTRL) --#define VPU_MEM_PD_REG0 0x2725 --#define P_VPU_MEM_PD_REG0 VCBUS_REG_ADDR(VPU_MEM_PD_REG0) --#define VPU_MEM_PD_REG1 0x2726 --#define P_VPU_MEM_PD_REG1 VCBUS_REG_ADDR(VPU_MEM_PD_REG1) --#define VPU_HDMI_DATA_OVR 0x2727 --#define P_VPU_HDMI_DATA_OVR VCBUS_REG_ADDR(VPU_HDMI_DATA_OVR) --#define VPU_PROT1_MMC_CTRL 0x2728 --#define P_VPU_PROT1_MMC_CTRL VCBUS_REG_ADDR(VPU_PROT1_MMC_CTRL) --#define VPU_PROT2_MMC_CTRL 0x2729 --#define P_VPU_PROT2_MMC_CTRL VCBUS_REG_ADDR(VPU_PROT2_MMC_CTRL) --#define VPU_PROT3_MMC_CTRL 0x272a --#define P_VPU_PROT3_MMC_CTRL VCBUS_REG_ADDR(VPU_PROT3_MMC_CTRL) --#define VPU_ARB4_V1_MMC_CTRL 0x272b --#define P_VPU_ARB4_V1_MMC_CTRL VCBUS_REG_ADDR(VPU_ARB4_V1_MMC_CTRL) --#define VPU_ARB4_V2_MMC_CTRL 0x272c --#define P_VPU_ARB4_V2_MMC_CTRL VCBUS_REG_ADDR(VPU_ARB4_V2_MMC_CTRL) --#define VPU_VPU_PWM_V0 0x2730 --#define P_VPU_VPU_PWM_V0 VCBUS_REG_ADDR(VPU_VPU_PWM_V0) --#define VPU_VPU_PWM_V1 0x2731 --#define P_VPU_VPU_PWM_V1 VCBUS_REG_ADDR(VPU_VPU_PWM_V1) --#define VPU_VPU_PWM_V2 0x2732 --#define P_VPU_VPU_PWM_V2 VCBUS_REG_ADDR(VPU_VPU_PWM_V2) --#define VPU_VPU_PWM_V3 0x2733 --#define P_VPU_VPU_PWM_V3 VCBUS_REG_ADDR(VPU_VPU_PWM_V3) --#define VPU_VPU_PWM_H0 0x2734 --#define P_VPU_VPU_PWM_H0 VCBUS_REG_ADDR(VPU_VPU_PWM_H0) --#define VPU_VPU_PWM_H1 0x2735 --#define P_VPU_VPU_PWM_H1 VCBUS_REG_ADDR(VPU_VPU_PWM_H1) --#define VPU_VPU_PWM_H2 0x2736 --#define VPU_PROT2_Y_LEN_STEP 0x2764 --#define P_VPU_PROT2_Y_LEN_STEP VCBUS_REG_ADDR(VPU_PROT2_Y_LEN_STEP) --#define VPU_PROT2_RPT_LOOP 0x2765 --#define P_VPU_PROT2_RPT_LOOP VCBUS_REG_ADDR(VPU_PROT2_RPT_LOOP) --#define VPU_PROT2_RPT_PAT 0x2766 --#define P_VPU_PROT2_RPT_PAT VCBUS_REG_ADDR(VPU_PROT2_RPT_PAT) --#define VPU_PROT2_DDR 0x2767 --#define P_VPU_PROT2_DDR VCBUS_REG_ADDR(VPU_PROT2_DDR) --#define VPU_PROT2_RBUF_ROOM 0x2768 --#define P_VPU_PROT2_RBUF_ROOM VCBUS_REG_ADDR(VPU_PROT2_RBUF_ROOM) --#define VPU_PROT2_STAT_0 0x2769 --#define P_VPU_PROT2_STAT_0 VCBUS_REG_ADDR(VPU_PROT2_STAT_0) --#define VPU_PROT2_STAT_1 0x276a --#define P_VPU_PROT2_STAT_1 VCBUS_REG_ADDR(VPU_PROT2_STAT_1) --#define VPU_PROT2_STAT_2 0x276b --#define MC_CTRL_REG 0x0900 --#define P_MC_CTRL_REG DOS_REG_ADDR(MC_CTRL_REG) --#define MC_MB_INFO 0x0901 --#define P_MC_MB_INFO DOS_REG_ADDR(MC_MB_INFO) --#define MC_PIC_INFO 0x0902 --#define P_MC_PIC_INFO DOS_REG_ADDR(MC_PIC_INFO) --#define MC_HALF_PEL_ONE 0x0903 --#define P_MC_HALF_PEL_ONE DOS_REG_ADDR(MC_HALF_PEL_ONE) --#define MC_HALF_PEL_TWO 0x0904 --#define P_MC_HALF_PEL_TWO DOS_REG_ADDR(MC_HALF_PEL_TWO) --#define POWER_CTL_MC 0x0905 --#define P_POWER_CTL_MC DOS_REG_ADDR(POWER_CTL_MC) --#define MC_CMD 0x0906 --#define P_MC_CMD DOS_REG_ADDR(MC_CMD) --#define MC_CTRL0 0x0907 --#define P_MC_CTRL0 DOS_REG_ADDR(MC_CTRL0) --#define MC_PIC_W_H 0x0908 --#define P_MC_PIC_W_H DOS_REG_ADDR(MC_PIC_W_H) --#define MC_STATUS0 0x0909 --#define P_MC_STATUS0 DOS_REG_ADDR(MC_STATUS0) --#define MC_STATUS1 0x090a --#define P_MC_STATUS1 DOS_REG_ADDR(MC_STATUS1) --#define MC_CTRL1 0x090b --#define P_MC_CTRL1 DOS_REG_ADDR(MC_CTRL1) --#define MC_MIX_RATIO0 0x090c --#define P_MC_MIX_RATIO0 DOS_REG_ADDR(MC_MIX_RATIO0) --#define MC_MIX_RATIO1 0x090d --#define P_MC_MIX_RATIO1 DOS_REG_ADDR(MC_MIX_RATIO1) --#define MC_DP_MB_XY 0x090e --#define P_MC_DP_MB_XY DOS_REG_ADDR(MC_DP_MB_XY) --#define MC_OM_MB_XY 0x090f --#define P_MC_OM_MB_XY DOS_REG_ADDR(MC_OM_MB_XY) --#define PSCALE_RST 0x0910 --#define P_PSCALE_RST DOS_REG_ADDR(PSCALE_RST) --#define PSCALE_CTRL 0x0911 --#define P_PSCALE_CTRL DOS_REG_ADDR(PSCALE_CTRL) --#define PSCALE_PICI_W 0x0912 --#define P_PSCALE_PICI_W DOS_REG_ADDR(PSCALE_PICI_W) --#define PSCALE_PICI_H 0x0913 --#define P_PSCALE_PICI_H DOS_REG_ADDR(PSCALE_PICI_H) --#define PSCALE_PICO_W 0x0914 --#define P_PSCALE_PICO_W DOS_REG_ADDR(PSCALE_PICO_W) --#define PSCALE_PICO_H 0x0915 --#define P_PSCALE_PICO_H DOS_REG_ADDR(PSCALE_PICO_H) --#define PSCALE_PICO_START_X 0x0916 --#define P_PSCALE_PICO_START_X DOS_REG_ADDR(PSCALE_PICO_START_X) --#define PSCALE_PICO_START_Y 0x0917 --#define P_PSCALE_PICO_START_Y DOS_REG_ADDR(PSCALE_PICO_START_Y) --#define PSCALE_DUMMY 0x0918 --#define P_PSCALE_DUMMY DOS_REG_ADDR(PSCALE_DUMMY) --#define PSCALE_FILT0_COEF0 0x0919 --#define P_PSCALE_FILT0_COEF0 DOS_REG_ADDR(PSCALE_FILT0_COEF0) --#define PSCALE_FILT0_COEF1 0x091a --#define P_PSCALE_FILT0_COEF1 DOS_REG_ADDR(PSCALE_FILT0_COEF1) --#define PSCALE_CMD_CTRL 0x091b --#define P_PSCALE_CMD_CTRL DOS_REG_ADDR(PSCALE_CMD_CTRL) --#define PSCALE_CMD_BLK_X 0x091c --#define P_PSCALE_CMD_BLK_X DOS_REG_ADDR(PSCALE_CMD_BLK_X) --#define PSCALE_CMD_BLK_Y 0x091d --#define P_PSCALE_CMD_BLK_Y DOS_REG_ADDR(PSCALE_CMD_BLK_Y) --#define PSCALE_STATUS 0x091e --#define P_PSCALE_STATUS DOS_REG_ADDR(PSCALE_STATUS) --#define PSCALE_BMEM_ADDR 0x091f --#define P_PSCALE_BMEM_ADDR DOS_REG_ADDR(PSCALE_BMEM_ADDR) --#define PSCALE_BMEM_DAT 0x0920 --#define P_PSCALE_BMEM_DAT DOS_REG_ADDR(PSCALE_BMEM_DAT) --#define PSCALE_DRAM_BUF_CTRL 0x0921 --#define P_PSCALE_DRAM_BUF_CTRL DOS_REG_ADDR(PSCALE_DRAM_BUF_CTRL) --#define PSCALE_MCMD_CTRL 0x0922 --#define P_PSCALE_MCMD_CTRL DOS_REG_ADDR(PSCALE_MCMD_CTRL) --#define PSCALE_MCMD_XSIZE 0x0923 --#define P_PSCALE_MCMD_XSIZE DOS_REG_ADDR(PSCALE_MCMD_XSIZE) --#define PSCALE_MCMD_YSIZE 0x0924 --#define P_PSCALE_MCMD_YSIZE DOS_REG_ADDR(PSCALE_MCMD_YSIZE) --#define PSCALE_PICO_SHIFT_XY 0x0928 --#define P_PSCALE_PICO_SHIFT_XY DOS_REG_ADDR(PSCALE_PICO_SHIFT_XY) --#define PSCALE_CTRL1 0x0929 --#define P_PSCALE_CTRL1 DOS_REG_ADDR(PSCALE_CTRL1) --#define PSCALE_SRCKEY_CTRL0 0x092a --#define PSCALE_CTRL2 0x092e --#define P_PSCALE_CTRL2 DOS_REG_ADDR(PSCALE_CTRL2) --/*add from M8m2*/ --#define HDEC_MC_OMEM_AUTO 0x0930 --#define P_HDEC_MC_OMEM_AUTO DOS_REG_ADDR(HDEC_MC_OMEM_AUTO) --#define HDEC_MC_MBRIGHT_IDX 0x0931 --#define P_HDEC_MC_MBRIGHT_IDX DOS_REG_ADDR(HDEC_MC_MBRIGHT_IDX) --#define HDEC_MC_MBRIGHT_RD 0x0932 --#define P_HDEC_MC_MBRIGHT_RD DOS_REG_ADDR(HDEC_MC_MBRIGHT_RD) --/**/ --#define MC_MPORT_CTRL 0x0940 --#define P_MC_MPORT_CTRL DOS_REG_ADDR(MC_MPORT_CTRL) --#define MC_MPORT_DAT 0x0941 --#define P_MC_MPORT_DAT DOS_REG_ADDR(MC_MPORT_DAT) --#define MC_WT_PRED_CTRL 0x0942 --#define P_MC_WT_PRED_CTRL DOS_REG_ADDR(MC_WT_PRED_CTRL) --#define MC_MBBOT_ST_ODD_ADDR 0x0945 --#define P_MC_MBBOT_ST_ODD_ADDR DOS_REG_ADDR(MC_MBBOT_ST_ODD_ADDR) --#define MC_DPDN_MB_XY 0x0946 --#define P_MC_DPDN_MB_XY DOS_REG_ADDR(MC_DPDN_MB_XY) --#define MC_OMDN_MB_XY 0x0947 --#define P_MC_OMDN_MB_XY DOS_REG_ADDR(MC_OMDN_MB_XY) --#define MC_HCMDBUF_H 0x0948 --#define P_MC_HCMDBUF_H DOS_REG_ADDR(MC_HCMDBUF_H) --#define MC_HCMDBUF_L 0x0949 --#define P_MC_HCMDBUF_L DOS_REG_ADDR(MC_HCMDBUF_L) --#define MC_HCMD_H 0x094a --#define P_MC_HCMD_H DOS_REG_ADDR(MC_HCMD_H) --#define MC_HCMD_L 0x094b --#define P_MC_HCMD_L DOS_REG_ADDR(MC_HCMD_L) --#define MC_IDCT_DAT 0x094c --#define P_MC_IDCT_DAT DOS_REG_ADDR(MC_IDCT_DAT) --#define MC_CTRL_GCLK_CTRL 0x094d --#define P_MC_CTRL_GCLK_CTRL DOS_REG_ADDR(MC_CTRL_GCLK_CTRL) --#define MC_OTHER_GCLK_CTRL 0x094e --#define P_MC_OTHER_GCLK_CTRL DOS_REG_ADDR(MC_OTHER_GCLK_CTRL) --#define MC_CTRL2 0x094f --#define P_MC_CTRL2 DOS_REG_ADDR(MC_CTRL2) --#define MDEC_PIC_DC_CTRL 0x098e --#define P_MDEC_PIC_DC_CTRL DOS_REG_ADDR(MDEC_PIC_DC_CTRL) --#define MDEC_PIC_DC_STATUS 0x098f --#define P_MDEC_PIC_DC_STATUS DOS_REG_ADDR(MDEC_PIC_DC_STATUS) --#define ANC0_CANVAS_ADDR 0x0990 --#define P_ANC0_CANVAS_ADDR DOS_REG_ADDR(ANC0_CANVAS_ADDR) --#define ANC1_CANVAS_ADDR 0x0991 --#define P_ANC1_CANVAS_ADDR DOS_REG_ADDR(ANC1_CANVAS_ADDR) --#define ANC2_CANVAS_ADDR 0x0992 --#define P_ANC2_CANVAS_ADDR DOS_REG_ADDR(ANC2_CANVAS_ADDR) --#define ANC3_CANVAS_ADDR 0x0993 --#define P_ANC3_CANVAS_ADDR DOS_REG_ADDR(ANC3_CANVAS_ADDR) --#define ANC4_CANVAS_ADDR 0x0994 --#define P_ANC4_CANVAS_ADDR DOS_REG_ADDR(ANC4_CANVAS_ADDR) --#define ANC5_CANVAS_ADDR 0x0995 --#define P_ANC5_CANVAS_ADDR DOS_REG_ADDR(ANC5_CANVAS_ADDR) --#define ANC6_CANVAS_ADDR 0x0996 --#define P_ANC6_CANVAS_ADDR DOS_REG_ADDR(ANC6_CANVAS_ADDR) --#define ANC7_CANVAS_ADDR 0x0997 --#define P_ANC7_CANVAS_ADDR DOS_REG_ADDR(ANC7_CANVAS_ADDR) --#define ANC8_CANVAS_ADDR 0x0998 --#define P_ANC8_CANVAS_ADDR DOS_REG_ADDR(ANC8_CANVAS_ADDR) --#define ANC9_CANVAS_ADDR 0x0999 --#define P_ANC9_CANVAS_ADDR DOS_REG_ADDR(ANC9_CANVAS_ADDR) --#define ANC10_CANVAS_ADDR 0x099a --#define P_ANC10_CANVAS_ADDR DOS_REG_ADDR(ANC10_CANVAS_ADDR) --#define ANC11_CANVAS_ADDR 0x099b --#define P_ANC11_CANVAS_ADDR DOS_REG_ADDR(ANC11_CANVAS_ADDR) --#define ANC12_CANVAS_ADDR 0x099c --#define P_ANC12_CANVAS_ADDR DOS_REG_ADDR(ANC12_CANVAS_ADDR) --#define ANC13_CANVAS_ADDR 0x099d --#define P_ANC13_CANVAS_ADDR DOS_REG_ADDR(ANC13_CANVAS_ADDR) --#define ANC14_CANVAS_ADDR 0x099e --#define P_ANC14_CANVAS_ADDR DOS_REG_ADDR(ANC14_CANVAS_ADDR) --#define ANC15_CANVAS_ADDR 0x099f --#define P_ANC15_CANVAS_ADDR DOS_REG_ADDR(ANC15_CANVAS_ADDR) --#define ANC16_CANVAS_ADDR 0x09a0 --#define P_ANC16_CANVAS_ADDR DOS_REG_ADDR(ANC16_CANVAS_ADDR) --#define ANC17_CANVAS_ADDR 0x09a1 --#define P_ANC17_CANVAS_ADDR DOS_REG_ADDR(ANC17_CANVAS_ADDR) --#define ANC18_CANVAS_ADDR 0x09a2 --#define P_ANC18_CANVAS_ADDR DOS_REG_ADDR(ANC18_CANVAS_ADDR) --#define ANC19_CANVAS_ADDR 0x09a3 --#define P_ANC19_CANVAS_ADDR DOS_REG_ADDR(ANC19_CANVAS_ADDR) --#define ANC20_CANVAS_ADDR 0x09a4 --#define P_ANC20_CANVAS_ADDR DOS_REG_ADDR(ANC20_CANVAS_ADDR) --#define ANC21_CANVAS_ADDR 0x09a5 --#define P_ANC21_CANVAS_ADDR DOS_REG_ADDR(ANC21_CANVAS_ADDR) --#define ANC22_CANVAS_ADDR 0x09a6 --#define P_ANC22_CANVAS_ADDR DOS_REG_ADDR(ANC22_CANVAS_ADDR) --#define ANC23_CANVAS_ADDR 0x09a7 --#define P_ANC23_CANVAS_ADDR DOS_REG_ADDR(ANC23_CANVAS_ADDR) --#define ANC24_CANVAS_ADDR 0x09a8 --#define P_ANC24_CANVAS_ADDR DOS_REG_ADDR(ANC24_CANVAS_ADDR) --#define ANC25_CANVAS_ADDR 0x09a9 --#define P_ANC25_CANVAS_ADDR DOS_REG_ADDR(ANC25_CANVAS_ADDR) --#define ANC26_CANVAS_ADDR 0x09aa --#define P_ANC26_CANVAS_ADDR DOS_REG_ADDR(ANC26_CANVAS_ADDR) --#define ANC27_CANVAS_ADDR 0x09ab --#define P_ANC27_CANVAS_ADDR DOS_REG_ADDR(ANC27_CANVAS_ADDR) --#define ANC28_CANVAS_ADDR 0x09ac --#define P_ANC28_CANVAS_ADDR DOS_REG_ADDR(ANC28_CANVAS_ADDR) --#define ANC29_CANVAS_ADDR 0x09ad --#define P_ANC29_CANVAS_ADDR DOS_REG_ADDR(ANC29_CANVAS_ADDR) --#define ANC30_CANVAS_ADDR 0x09ae --#define P_ANC30_CANVAS_ADDR DOS_REG_ADDR(ANC30_CANVAS_ADDR) --#define ANC31_CANVAS_ADDR 0x09af --#define P_ANC31_CANVAS_ADDR DOS_REG_ADDR(ANC31_CANVAS_ADDR) --#define DBKR_CANVAS_ADDR 0x09b0 --#define P_DBKR_CANVAS_ADDR DOS_REG_ADDR(DBKR_CANVAS_ADDR) --#define DBKW_CANVAS_ADDR 0x09b1 --#define P_DBKW_CANVAS_ADDR DOS_REG_ADDR(DBKW_CANVAS_ADDR) --#define REC_CANVAS_ADDR 0x09b2 --#define P_REC_CANVAS_ADDR DOS_REG_ADDR(REC_CANVAS_ADDR) --#define CURR_CANVAS_CTRL 0x09b3 --#define P_CURR_CANVAS_CTRL DOS_REG_ADDR(CURR_CANVAS_CTRL) --#define MDEC_PIC_DC_THRESH 0x09b8 --#define P_MDEC_PIC_DC_THRESH DOS_REG_ADDR(MDEC_PIC_DC_THRESH) --#define MDEC_PICR_BUF_STATUS 0x09b9 --#define P_MDEC_PICR_BUF_STATUS DOS_REG_ADDR(MDEC_PICR_BUF_STATUS) --#define MDEC_PICW_BUF_STATUS 0x09ba --#define P_MDEC_PICW_BUF_STATUS DOS_REG_ADDR(MDEC_PICW_BUF_STATUS) --#define MCW_DBLK_WRRSP_CNT 0x09bb --#define P_MCW_DBLK_WRRSP_CNT DOS_REG_ADDR(MCW_DBLK_WRRSP_CNT) --#define MC_MBBOT_WRRSP_CNT 0x09bc --#define P_MC_MBBOT_WRRSP_CNT DOS_REG_ADDR(MC_MBBOT_WRRSP_CNT) --#define WRRSP_FIFO_PICW_DBK 0x09be --#define P_WRRSP_FIFO_PICW_DBK DOS_REG_ADDR(WRRSP_FIFO_PICW_DBK) --#define WRRSP_FIFO_PICW_MC 0x09bf --#define P_WRRSP_FIFO_PICW_MC DOS_REG_ADDR(WRRSP_FIFO_PICW_MC) --#define AV_SCRATCH_0 0x09c0 --#define P_AV_SCRATCH_0 DOS_REG_ADDR(AV_SCRATCH_0) --#define AV_SCRATCH_1 0x09c1 --#define P_AV_SCRATCH_1 DOS_REG_ADDR(AV_SCRATCH_1) --#define AV_SCRATCH_2 0x09c2 --#define P_AV_SCRATCH_2 DOS_REG_ADDR(AV_SCRATCH_2) --#define AV_SCRATCH_3 0x09c3 --#define P_AV_SCRATCH_3 DOS_REG_ADDR(AV_SCRATCH_3) --#define AV_SCRATCH_4 0x09c4 --#define P_AV_SCRATCH_4 DOS_REG_ADDR(AV_SCRATCH_4) --#define AV_SCRATCH_5 0x09c5 --#define P_AV_SCRATCH_5 DOS_REG_ADDR(AV_SCRATCH_5) --#define AV_SCRATCH_6 0x09c6 --#define P_AV_SCRATCH_6 DOS_REG_ADDR(AV_SCRATCH_6) --#define AV_SCRATCH_7 0x09c7 --#define P_AV_SCRATCH_7 DOS_REG_ADDR(AV_SCRATCH_7) --#define AV_SCRATCH_8 0x09c8 --#define P_AV_SCRATCH_8 DOS_REG_ADDR(AV_SCRATCH_8) --#define AV_SCRATCH_9 0x09c9 --#define P_AV_SCRATCH_9 DOS_REG_ADDR(AV_SCRATCH_9) --#define AV_SCRATCH_A 0x09ca --#define P_AV_SCRATCH_A DOS_REG_ADDR(AV_SCRATCH_A) --#define AV_SCRATCH_B 0x09cb --#define P_AV_SCRATCH_B DOS_REG_ADDR(AV_SCRATCH_B) --#define AV_SCRATCH_C 0x09cc --#define P_AV_SCRATCH_C DOS_REG_ADDR(AV_SCRATCH_C) --#define AV_SCRATCH_D 0x09cd --#define P_AV_SCRATCH_D DOS_REG_ADDR(AV_SCRATCH_D) --#define AV_SCRATCH_E 0x09ce --#define P_AV_SCRATCH_E DOS_REG_ADDR(AV_SCRATCH_E) --#define AV_SCRATCH_F 0x09cf --#define P_AV_SCRATCH_F DOS_REG_ADDR(AV_SCRATCH_F) --#define AV_SCRATCH_G 0x09d0 --#define P_AV_SCRATCH_G DOS_REG_ADDR(AV_SCRATCH_G) --#define AV_SCRATCH_H 0x09d1 --#define P_AV_SCRATCH_H DOS_REG_ADDR(AV_SCRATCH_H) --#define AV_SCRATCH_I 0x09d2 --#define P_AV_SCRATCH_I DOS_REG_ADDR(AV_SCRATCH_I) --#define AV_SCRATCH_J 0x09d3 --#define P_AV_SCRATCH_J DOS_REG_ADDR(AV_SCRATCH_J) --#define AV_SCRATCH_K 0x09d4 --#define P_AV_SCRATCH_K DOS_REG_ADDR(AV_SCRATCH_K) --#define AV_SCRATCH_L 0x09d5 --#define P_AV_SCRATCH_L DOS_REG_ADDR(AV_SCRATCH_L) --#define AV_SCRATCH_M 0x09d6 --#define P_AV_SCRATCH_M DOS_REG_ADDR(AV_SCRATCH_M) --#define AV_SCRATCH_N 0x09d7 --#define P_AV_SCRATCH_N DOS_REG_ADDR(AV_SCRATCH_N) --#define WRRSP_CO_MB 0x09d8 --#define P_WRRSP_CO_MB DOS_REG_ADDR(WRRSP_CO_MB) --#define WRRSP_DCAC 0x09d9 --#define P_WRRSP_DCAC DOS_REG_ADDR(WRRSP_DCAC) --/*add from M8M2*/ --#define WRRSP_VLD 0x09da --#define P_WRRSP_VLD DOS_REG_ADDR(WRRSP_VLD) --#define MDEC_DOUBLEW_CFG0 0x09db --#define P_MDEC_DOUBLEW_CFG0 DOS_REG_ADDR(MDEC_DOUBLEW_CFG0) --#define MDEC_DOUBLEW_CFG1 0x09dc --#define P_MDEC_DOUBLEW_CFG1 DOS_REG_ADDR(MDEC_DOUBLEW_CFG1) --#define MDEC_DOUBLEW_CFG2 0x09dd --#define P_MDEC_DOUBLEW_CFG2 DOS_REG_ADDR(MDEC_DOUBLEW_CFG2) --#define MDEC_DOUBLEW_CFG3 0x09de --#define P_MDEC_DOUBLEW_CFG3 DOS_REG_ADDR(MDEC_DOUBLEW_CFG3) --#define MDEC_DOUBLEW_CFG4 0x09df --#define P_MDEC_DOUBLEW_CFG4 DOS_REG_ADDR(MDEC_DOUBLEW_CFG4) --#define MDEC_DOUBLEW_CFG5 0x09e0 --#define P_MDEC_DOUBLEW_CFG5 DOS_REG_ADDR(MDEC_DOUBLEW_CFG5) --#define MDEC_DOUBLEW_CFG6 0x09e1 --#define P_MDEC_DOUBLEW_CFG6 DOS_REG_ADDR(MDEC_DOUBLEW_CFG6) --#define MDEC_DOUBLEW_CFG7 0x09e2 --#define P_MDEC_DOUBLEW_CFG7 DOS_REG_ADDR(MDEC_DOUBLEW_CFG7) --#define MDEC_DOUBLEW_STATUS 0x09e3 --#define P_MDEC_DOUBLEW_STATUS DOS_REG_ADDR(MDEC_DOUBLEW_STATUS) --/**/ --#define DBLK_RST 0x0950 --#define P_DBLK_RST DOS_REG_ADDR(DBLK_RST) --#define DBLK_CTRL 0x0951 --#define P_DBLK_CTRL DOS_REG_ADDR(DBLK_CTRL) --#define DBLK_MB_WID_HEIGHT 0x0952 --#define P_DBLK_MB_WID_HEIGHT DOS_REG_ADDR(DBLK_MB_WID_HEIGHT) --#define DBLK_STATUS 0x0953 --#define P_DBLK_STATUS DOS_REG_ADDR(DBLK_STATUS) --#define DBLK_CMD_CTRL 0x0954 --#define P_DBLK_CMD_CTRL DOS_REG_ADDR(DBLK_CMD_CTRL) --#define DBLK_MB_XY 0x0955 --#define P_DBLK_MB_XY DOS_REG_ADDR(DBLK_MB_XY) --#define DBLK_QP 0x0956 --#define P_DBLK_QP DOS_REG_ADDR(DBLK_QP) --#define DBLK_Y_BHFILT 0x0957 --#define P_DBLK_Y_BHFILT DOS_REG_ADDR(DBLK_Y_BHFILT) --#define DBLK_Y_BHFILT_HIGH 0x0958 --#define P_DBLK_Y_BHFILT_HIGH DOS_REG_ADDR(DBLK_Y_BHFILT_HIGH) --#define DBLK_Y_BVFILT 0x0959 --#define P_DBLK_Y_BVFILT DOS_REG_ADDR(DBLK_Y_BVFILT) --#define DBLK_CB_BFILT 0x095a --#define P_DBLK_CB_BFILT DOS_REG_ADDR(DBLK_CB_BFILT) --#define DBLK_CR_BFILT 0x095b --#define P_DBLK_CR_BFILT DOS_REG_ADDR(DBLK_CR_BFILT) --#define DBLK_Y_HFILT 0x095c --#define P_DBLK_Y_HFILT DOS_REG_ADDR(DBLK_Y_HFILT) --#define DBLK_Y_HFILT_HIGH 0x095d --#define P_DBLK_Y_HFILT_HIGH DOS_REG_ADDR(DBLK_Y_HFILT_HIGH) --#define DBLK_Y_VFILT 0x095e --#define P_DBLK_Y_VFILT DOS_REG_ADDR(DBLK_Y_VFILT) --#define DBLK_CB_FILT 0x095f --#define P_DBLK_CB_FILT DOS_REG_ADDR(DBLK_CB_FILT) --#define DBLK_CR_FILT 0x0960 --#define P_DBLK_CR_FILT DOS_REG_ADDR(DBLK_CR_FILT) --#define DBLK_BETAX_QP_SEL 0x0961 --#define P_DBLK_BETAX_QP_SEL DOS_REG_ADDR(DBLK_BETAX_QP_SEL) --#define DBLK_CLIP_CTRL0 0x0962 --#define P_DBLK_CLIP_CTRL0 DOS_REG_ADDR(DBLK_CLIP_CTRL0) --#define DBLK_CLIP_CTRL1 0x0963 --#define P_DBLK_CLIP_CTRL1 DOS_REG_ADDR(DBLK_CLIP_CTRL1) --#define DBLK_CLIP_CTRL2 0x0964 --#define P_DBLK_CLIP_CTRL2 DOS_REG_ADDR(DBLK_CLIP_CTRL2) --#define DBLK_CLIP_CTRL3 0x0965 --#define P_DBLK_CLIP_CTRL3 DOS_REG_ADDR(DBLK_CLIP_CTRL3) --#define DBLK_CLIP_CTRL4 0x0966 --#define P_DBLK_CLIP_CTRL4 DOS_REG_ADDR(DBLK_CLIP_CTRL4) --#define DBLK_CLIP_CTRL5 0x0967 --#define P_DBLK_CLIP_CTRL5 DOS_REG_ADDR(DBLK_CLIP_CTRL5) --#define DBLK_CLIP_CTRL6 0x0968 --#define P_DBLK_CLIP_CTRL6 DOS_REG_ADDR(DBLK_CLIP_CTRL6) --#define DBLK_CLIP_CTRL7 0x0969 --#define P_DBLK_CLIP_CTRL7 DOS_REG_ADDR(DBLK_CLIP_CTRL7) --#define DBLK_CLIP_CTRL8 0x096a --#define P_DBLK_CLIP_CTRL8 DOS_REG_ADDR(DBLK_CLIP_CTRL8) --#define DBLK_STATUS1 0x096b --#define P_DBLK_STATUS1 DOS_REG_ADDR(DBLK_STATUS1) --#define DBLK_GCLK_FREE 0x096c --#define P_DBLK_GCLK_FREE DOS_REG_ADDR(DBLK_GCLK_FREE) --#define DBLK_GCLK_OFF 0x096d --#define P_DBLK_GCLK_OFF DOS_REG_ADDR(DBLK_GCLK_OFF) --#define DBLK_AVSFLAGS 0x096e --#define P_DBLK_AVSFLAGS DOS_REG_ADDR(DBLK_AVSFLAGS) --#define DBLK_CBPY 0x0970 --#define P_DBLK_CBPY DOS_REG_ADDR(DBLK_CBPY) --#define DBLK_CBPY_ADJ 0x0971 --#define P_DBLK_CBPY_ADJ DOS_REG_ADDR(DBLK_CBPY_ADJ) --#define DBLK_CBPC 0x0972 --#define P_DBLK_CBPC DOS_REG_ADDR(DBLK_CBPC) --#define DBLK_CBPC_ADJ 0x0973 --#define P_DBLK_CBPC_ADJ DOS_REG_ADDR(DBLK_CBPC_ADJ) --#define DBLK_VHMVD 0x0974 --#define P_DBLK_VHMVD DOS_REG_ADDR(DBLK_VHMVD) --#define DBLK_STRONG 0x0975 --#define P_DBLK_STRONG DOS_REG_ADDR(DBLK_STRONG) --#define DBLK_RV8_QUANT 0x0976 --#define P_DBLK_RV8_QUANT DOS_REG_ADDR(DBLK_RV8_QUANT) --#define DBLK_CBUS_HCMD2 0x0977 --#define P_DBLK_CBUS_HCMD2 DOS_REG_ADDR(DBLK_CBUS_HCMD2) --#define DBLK_CBUS_HCMD1 0x0978 --#define P_DBLK_CBUS_HCMD1 DOS_REG_ADDR(DBLK_CBUS_HCMD1) --#define DBLK_CBUS_HCMD0 0x0979 --#define P_DBLK_CBUS_HCMD0 DOS_REG_ADDR(DBLK_CBUS_HCMD0) --#define DBLK_VLD_HCMD2 0x097a --#define P_DBLK_VLD_HCMD2 DOS_REG_ADDR(DBLK_VLD_HCMD2) --#define DBLK_VLD_HCMD1 0x097b --#define P_DBLK_VLD_HCMD1 DOS_REG_ADDR(DBLK_VLD_HCMD1) --#define DBLK_VLD_HCMD0 0x097c --#define P_DBLK_VLD_HCMD0 DOS_REG_ADDR(DBLK_VLD_HCMD0) --#define DBLK_OST_YBASE 0x097d --#define P_DBLK_OST_YBASE DOS_REG_ADDR(DBLK_OST_YBASE) --#define DBLK_OST_CBCRDIFF 0x097e --#define P_DBLK_OST_CBCRDIFF DOS_REG_ADDR(DBLK_OST_CBCRDIFF) --#define DBLK_CTRL1 0x097f --#define P_DBLK_CTRL1 DOS_REG_ADDR(DBLK_CTRL1) --#define MCRCC_CTL1 0x0980 --#define P_MCRCC_CTL1 DOS_REG_ADDR(MCRCC_CTL1) --#define MCRCC_CTL2 0x0981 --#define P_MCRCC_CTL2 DOS_REG_ADDR(MCRCC_CTL2) --#define MCRCC_CTL3 0x0982 --#define P_MCRCC_CTL3 DOS_REG_ADDR(MCRCC_CTL3) --#define GCLK_EN 0x0983 --#define P_GCLK_EN DOS_REG_ADDR(GCLK_EN) --#define MDEC_SW_RESET 0x0984 --#define P_MDEC_SW_RESET DOS_REG_ADDR(MDEC_SW_RESET) --#define VLD_STATUS_CTRL 0x0c00 --#define P_VLD_STATUS_CTRL DOS_REG_ADDR(VLD_STATUS_CTRL) --#define MPEG1_2_REG 0x0c01 --#define P_MPEG1_2_REG DOS_REG_ADDR(MPEG1_2_REG) --#define F_CODE_REG 0x0c02 --#define P_F_CODE_REG DOS_REG_ADDR(F_CODE_REG) --#define PIC_HEAD_INFO 0x0c03 --#define P_PIC_HEAD_INFO DOS_REG_ADDR(PIC_HEAD_INFO) --#define QP_VALUE_REG 0x0c05 --#define P_QP_VALUE_REG DOS_REG_ADDR(QP_VALUE_REG) --#define MBA_INC 0x0c06 --#define P_MBA_INC DOS_REG_ADDR(MBA_INC) --#define MB_MOTION_MODE 0x0c07 --#define P_MB_MOTION_MODE DOS_REG_ADDR(MB_MOTION_MODE) --#define POWER_CTL_VLD 0x0c08 --#define P_POWER_CTL_VLD DOS_REG_ADDR(POWER_CTL_VLD) --#define MB_WIDTH 0x0c09 --#define P_MB_WIDTH DOS_REG_ADDR(MB_WIDTH) --#define SLICE_QP 0x0c0a --#define P_SLICE_QP DOS_REG_ADDR(SLICE_QP) --#define PRE_START_CODE 0x0c0b --#define P_PRE_START_CODE DOS_REG_ADDR(PRE_START_CODE) --#define SLICE_START_BYTE_01 0x0c0c --#define P_SLICE_START_BYTE_01 DOS_REG_ADDR(SLICE_START_BYTE_01) --#define SLICE_START_BYTE_23 0x0c0d --#define P_SLICE_START_BYTE_23 DOS_REG_ADDR(SLICE_START_BYTE_23) --#define RESYNC_MARKER_LENGTH 0x0c0e --#define P_RESYNC_MARKER_LENGTH DOS_REG_ADDR(RESYNC_MARKER_LENGTH) --#define DECODER_BUFFER_INFO 0x0c0f --#define P_DECODER_BUFFER_INFO DOS_REG_ADDR(DECODER_BUFFER_INFO) --#define FST_FOR_MV_X 0x0c10 --#define P_FST_FOR_MV_X DOS_REG_ADDR(FST_FOR_MV_X) --#define FST_FOR_MV_Y 0x0c11 --#define P_FST_FOR_MV_Y DOS_REG_ADDR(FST_FOR_MV_Y) --#define SCD_FOR_MV_X 0x0c12 --#define P_SCD_FOR_MV_X DOS_REG_ADDR(SCD_FOR_MV_X) --#define SCD_FOR_MV_Y 0x0c13 --#define P_SCD_FOR_MV_Y DOS_REG_ADDR(SCD_FOR_MV_Y) --#define FST_BAK_MV_X 0x0c14 --#define P_FST_BAK_MV_X DOS_REG_ADDR(FST_BAK_MV_X) --#define FST_BAK_MV_Y 0x0c15 --#define P_FST_BAK_MV_Y DOS_REG_ADDR(FST_BAK_MV_Y) --#define SCD_BAK_MV_X 0x0c16 --#define P_SCD_BAK_MV_X DOS_REG_ADDR(SCD_BAK_MV_X) --#define SCD_BAK_MV_Y 0x0c17 --#define P_SCD_BAK_MV_Y DOS_REG_ADDR(SCD_BAK_MV_Y) --#define VLD_DECODE_CONTROL 0x0c18 --#define P_VLD_DECODE_CONTROL DOS_REG_ADDR(VLD_DECODE_CONTROL) --#define VLD_REVERVED_19 0x0c19 --#define P_VLD_REVERVED_19 DOS_REG_ADDR(VLD_REVERVED_19) --#define VIFF_BIT_CNT 0x0c1a --#define P_VIFF_BIT_CNT DOS_REG_ADDR(VIFF_BIT_CNT) --#define BYTE_ALIGN_PEAK_HI 0x0c1b --#define P_BYTE_ALIGN_PEAK_HI DOS_REG_ADDR(BYTE_ALIGN_PEAK_HI) --#define BYTE_ALIGN_PEAK_LO 0x0c1c --#define P_BYTE_ALIGN_PEAK_LO DOS_REG_ADDR(BYTE_ALIGN_PEAK_LO) --#define NEXT_ALIGN_PEAK 0x0c1d --#define P_NEXT_ALIGN_PEAK DOS_REG_ADDR(NEXT_ALIGN_PEAK) --#define VC1_CONTROL_REG 0x0c1e --#define P_VC1_CONTROL_REG DOS_REG_ADDR(VC1_CONTROL_REG) --#define PMV1_X 0x0c20 --#define P_PMV1_X DOS_REG_ADDR(PMV1_X) --#define PMV1_Y 0x0c21 --#define P_PMV1_Y DOS_REG_ADDR(PMV1_Y) --#define PMV2_X 0x0c22 --#define P_PMV2_X DOS_REG_ADDR(PMV2_X) --#define PMV2_Y 0x0c23 --#define P_PMV2_Y DOS_REG_ADDR(PMV2_Y) --#define PMV3_X 0x0c24 --#define P_PMV3_X DOS_REG_ADDR(PMV3_X) --#define PMV3_Y 0x0c25 --#define P_PMV3_Y DOS_REG_ADDR(PMV3_Y) --#define PMV4_X 0x0c26 --#define P_PMV4_X DOS_REG_ADDR(PMV4_X) --#define PMV4_Y 0x0c27 --#define P_PMV4_Y DOS_REG_ADDR(PMV4_Y) --#define M4_TABLE_SELECT 0x0c28 --#define P_M4_TABLE_SELECT DOS_REG_ADDR(M4_TABLE_SELECT) --#define M4_CONTROL_REG 0x0c29 --#define P_M4_CONTROL_REG DOS_REG_ADDR(M4_CONTROL_REG) --#define BLOCK_NUM 0x0c2a --#define P_BLOCK_NUM DOS_REG_ADDR(BLOCK_NUM) --#define PATTERN_CODE 0x0c2b --#define P_PATTERN_CODE DOS_REG_ADDR(PATTERN_CODE) --#define MB_INFO 0x0c2c --#define P_MB_INFO DOS_REG_ADDR(MB_INFO) --#define VLD_DC_PRED 0x0c2d --#define P_VLD_DC_PRED DOS_REG_ADDR(VLD_DC_PRED) --#define VLD_ERROR_MASK 0x0c2e --#define P_VLD_ERROR_MASK DOS_REG_ADDR(VLD_ERROR_MASK) --#define VLD_DC_PRED_C 0x0c2f --#define P_VLD_DC_PRED_C DOS_REG_ADDR(VLD_DC_PRED_C) --#define LAST_SLICE_MV_ADDR 0x0c30 --#define P_LAST_SLICE_MV_ADDR DOS_REG_ADDR(LAST_SLICE_MV_ADDR) --#define LAST_MVX 0x0c31 --#define P_LAST_MVX DOS_REG_ADDR(LAST_MVX) --#define LAST_MVY 0x0c32 --#define P_LAST_MVY DOS_REG_ADDR(LAST_MVY) --#define VLD_C38 0x0c38 --#define P_VLD_C38 DOS_REG_ADDR(VLD_C38) --#define VLD_C39 0x0c39 --#define P_VLD_C39 DOS_REG_ADDR(VLD_C39) --#define VLD_STATUS 0x0c3a --#define P_VLD_STATUS DOS_REG_ADDR(VLD_STATUS) --#define VLD_SHIFT_STATUS 0x0c3b --#define P_VLD_SHIFT_STATUS DOS_REG_ADDR(VLD_SHIFT_STATUS) --#define VOFF_STATUS 0x0c3c --#define P_VOFF_STATUS DOS_REG_ADDR(VOFF_STATUS) --#define VLD_C3D 0x0c3d --#define P_VLD_C3D DOS_REG_ADDR(VLD_C3D) --#define VLD_DBG_INDEX 0x0c3e --#define P_VLD_DBG_INDEX DOS_REG_ADDR(VLD_DBG_INDEX) --#define VLD_DBG_DATA 0x0c3f --#define P_VLD_DBG_DATA DOS_REG_ADDR(VLD_DBG_DATA) --#define VLD_MEM_VIFIFO_START_PTR 0x0c40 --#define P_VLD_TIME_STAMP_0 DOS_REG_ADDR(VLD_TIME_STAMP_0) --#define VLD_TIME_STAMP_1 0x0c4d --#define P_VLD_TIME_STAMP_1 DOS_REG_ADDR(VLD_TIME_STAMP_1) --#define VLD_TIME_STAMP_2 0x0c4e --#define P_VLD_TIME_STAMP_2 DOS_REG_ADDR(VLD_TIME_STAMP_2) --#define VLD_TIME_STAMP_3 0x0c4f --#define P_VLD_TIME_STAMP_3 DOS_REG_ADDR(VLD_TIME_STAMP_3) --#define VLD_MEM_VBUF2_RD_PTR 0x0c54 --#define P_VLD_MEM_VBUF2_RD_PTR DOS_REG_ADDR(VLD_MEM_VBUF2_RD_PTR) --#define VLD_MEM_SWAP_ADDR 0x0c55 --#define P_VLD_MEM_SWAP_ADDR DOS_REG_ADDR(VLD_MEM_SWAP_ADDR) --#define VLD_MEM_SWAP_CTL 0x0c56 --#define P_VLD_MEM_SWAP_CTL DOS_REG_ADDR(VLD_MEM_SWAP_CTL) --#define VCOP_CTRL_REG 0x0e00 --#define P_VCOP_CTRL_REG DOS_REG_ADDR(VCOP_CTRL_REG) --#define QP_CTRL_REG 0x0e01 --#define P_QP_CTRL_REG DOS_REG_ADDR(QP_CTRL_REG) --#define INTRA_QUANT_MATRIX 0x0e02 --#define P_INTRA_QUANT_MATRIX DOS_REG_ADDR(INTRA_QUANT_MATRIX) --#define NON_I_QUANT_MATRIX 0x0e03 --#define P_NON_I_QUANT_MATRIX DOS_REG_ADDR(NON_I_QUANT_MATRIX) --#define DC_SCALER 0x0e04 --#define P_DC_SCALER DOS_REG_ADDR(DC_SCALER) --#define DC_AC_CTRL 0x0e05 --#define P_DC_AC_CTRL DOS_REG_ADDR(DC_AC_CTRL) --#define DC_AC_SCALE_MUL 0x0e06 --#define P_DC_AC_SCALE_MUL DOS_REG_ADDR(DC_AC_SCALE_MUL) --#define DC_AC_SCALE_DIV 0x0e07 --#define P_DC_AC_SCALE_DIV DOS_REG_ADDR(DC_AC_SCALE_DIV) --#define POWER_CTL_IQIDCT 0x0e08 --#define P_POWER_CTL_IQIDCT DOS_REG_ADDR(POWER_CTL_IQIDCT) --#define RV_AI_Y_X 0x0e09 --#define P_RV_AI_Y_X DOS_REG_ADDR(RV_AI_Y_X) --#define RV_AI_U_X 0x0e0a --#define P_RV_AI_U_X DOS_REG_ADDR(RV_AI_U_X) --#define RV_AI_V_X 0x0e0b --#define P_RV_AI_V_X DOS_REG_ADDR(RV_AI_V_X) --#define RV_AI_MB_COUNT 0x0e0c --#define P_RV_AI_MB_COUNT DOS_REG_ADDR(RV_AI_MB_COUNT) --#define IQIDCT_CONTROL 0x0e0e --#define P_IQIDCT_CONTROL DOS_REG_ADDR(IQIDCT_CONTROL) --#define IQIDCT_DEBUG_INFO_0 0x0e0f --#define P_IQIDCT_DEBUG_INFO_0 DOS_REG_ADDR(IQIDCT_DEBUG_INFO_0) --#define DEBLK_CMD 0x0e10 --#define P_DEBLK_CMD DOS_REG_ADDR(DEBLK_CMD) --#define IQIDCT_DEBUG_IDCT 0x0e11 --#define P_IQIDCT_DEBUG_IDCT DOS_REG_ADDR(IQIDCT_DEBUG_IDCT) --#define DCAC_DMA_CTRL 0x0e12 --#define P_DCAC_DMA_CTRL DOS_REG_ADDR(DCAC_DMA_CTRL) --#define DCAC_DMA_ADDRESS 0x0e13 --#define P_DCAC_DMA_ADDRESS DOS_REG_ADDR(DCAC_DMA_ADDRESS) --#define DCAC_CPU_ADDRESS 0x0e14 --#define P_DCAC_CPU_ADDRESS DOS_REG_ADDR(DCAC_CPU_ADDRESS) --#define DCAC_CPU_DATA 0x0e15 --#define P_DCAC_CPU_DATA DOS_REG_ADDR(DCAC_CPU_DATA) --#define DCAC_MB_COUNT 0x0e16 --#define P_DCAC_MB_COUNT DOS_REG_ADDR(DCAC_MB_COUNT) --#define IQ_QUANT 0x0e17 --#define P_IQ_QUANT DOS_REG_ADDR(IQ_QUANT) --#define VC1_BITPLANE_CTL 0x0e18 --#define P_VC1_BITPLANE_CTL DOS_REG_ADDR(VC1_BITPLANE_CTL) --#define MSP 0x0300 --#define P_MSP DOS_REG_ADDR(MSP) --#define MPSR 0x0301 --#define P_MPSR DOS_REG_ADDR(MPSR) --#define MINT_VEC_BASE 0x0302 --#define P_MINT_VEC_BASE DOS_REG_ADDR(MINT_VEC_BASE) --#define MCPU_INTR_GRP 0x0303 --#define P_MCPU_INTR_GRP DOS_REG_ADDR(MCPU_INTR_GRP) --#define MCPU_INTR_MSK 0x0304 --#define P_MCPU_INTR_MSK DOS_REG_ADDR(MCPU_INTR_MSK) --#define MCPU_INTR_REQ 0x0305 --#define P_MCPU_INTR_REQ DOS_REG_ADDR(MCPU_INTR_REQ) --#define MPC_P 0x0306 --#define P_MPC_P DOS_REG_ADDR(MPC_P) --#define MPC_D 0x0307 --#define P_MPC_D DOS_REG_ADDR(MPC_D) --#define MPC_E 0x0308 --#define P_MPC_E DOS_REG_ADDR(MPC_E) --#define MPC_W 0x0309 --#define P_MPC_W DOS_REG_ADDR(MPC_W) --#define MINDEX0_REG 0x030a --#define P_MINDEX0_REG DOS_REG_ADDR(MINDEX0_REG) --#define MINDEX1_REG 0x030b --#define P_MINDEX1_REG DOS_REG_ADDR(MINDEX1_REG) --#define MINDEX2_REG 0x030c --#define P_MINDEX2_REG DOS_REG_ADDR(MINDEX2_REG) --#define MINDEX3_REG 0x030d --#define P_MINDEX3_REG DOS_REG_ADDR(MINDEX3_REG) --#define MINDEX4_REG 0x030e --#define P_MINDEX4_REG DOS_REG_ADDR(MINDEX4_REG) --#define MINDEX5_REG 0x030f --#define P_MINDEX5_REG DOS_REG_ADDR(MINDEX5_REG) --#define MINDEX6_REG 0x0310 --#define P_MINDEX6_REG DOS_REG_ADDR(MINDEX6_REG) --#define MINDEX7_REG 0x0311 --#define P_MINDEX7_REG DOS_REG_ADDR(MINDEX7_REG) --#define MMIN_REG 0x0312 --#define P_MMIN_REG DOS_REG_ADDR(MMIN_REG) --#define MMAX_REG 0x0313 --#define P_MMAX_REG DOS_REG_ADDR(MMAX_REG) --#define MBREAK0_REG 0x0314 --#define P_MBREAK0_REG DOS_REG_ADDR(MBREAK0_REG) --#define MBREAK1_REG 0x0315 --#define P_MBREAK1_REG DOS_REG_ADDR(MBREAK1_REG) --#define MBREAK2_REG 0x0316 --#define P_MBREAK2_REG DOS_REG_ADDR(MBREAK2_REG) --#define MBREAK3_REG 0x0317 --#define P_MBREAK3_REG DOS_REG_ADDR(MBREAK3_REG) --#define MBREAK_TYPE 0x0318 --#define P_MBREAK_TYPE DOS_REG_ADDR(MBREAK_TYPE) --#define MBREAK_CTRL 0x0319 --#define P_MBREAK_CTRL DOS_REG_ADDR(MBREAK_CTRL) --#define MBREAK_STAUTS 0x031a --#define P_MBREAK_STAUTS DOS_REG_ADDR(MBREAK_STAUTS) --#define MDB_ADDR_REG 0x031b --#define P_MDB_ADDR_REG DOS_REG_ADDR(MDB_ADDR_REG) --#define MDB_DATA_REG 0x031c --#define P_MDB_DATA_REG DOS_REG_ADDR(MDB_DATA_REG) --#define MDB_CTRL 0x031d --#define P_MDB_CTRL DOS_REG_ADDR(MDB_CTRL) --#define MSFTINT0 0x031e --#define P_MSFTINT0 DOS_REG_ADDR(MSFTINT0) --#define MSFTINT1 0x031f --#define P_MSFTINT1 DOS_REG_ADDR(MSFTINT1) --#define CSP 0x0320 --#define P_CSP DOS_REG_ADDR(CSP) --#define CPSR 0x0321 --#define P_CPSR DOS_REG_ADDR(CPSR) --#define CINT_VEC_BASE 0x0322 --#define P_CINT_VEC_BASE DOS_REG_ADDR(CINT_VEC_BASE) --#define CCPU_INTR_GRP 0x0323 --#define P_CCPU_INTR_GRP DOS_REG_ADDR(CCPU_INTR_GRP) --#define CCPU_INTR_MSK 0x0324 --#define P_CCPU_INTR_MSK DOS_REG_ADDR(CCPU_INTR_MSK) --#define CCPU_INTR_REQ 0x0325 --#define P_CCPU_INTR_REQ DOS_REG_ADDR(CCPU_INTR_REQ) --#define CPC_P 0x0326 --#define P_CPC_P DOS_REG_ADDR(CPC_P) --#define CPC_D 0x0327 --#define P_CPC_D DOS_REG_ADDR(CPC_D) --#define CPC_E 0x0328 --#define P_CPC_E DOS_REG_ADDR(CPC_E) --#define CPC_W 0x0329 --#define P_CPC_W DOS_REG_ADDR(CPC_W) --#define CINDEX0_REG 0x032a --#define P_CINDEX0_REG DOS_REG_ADDR(CINDEX0_REG) --#define CINDEX1_REG 0x032b --#define P_CINDEX1_REG DOS_REG_ADDR(CINDEX1_REG) --#define CINDEX2_REG 0x032c --#define P_CINDEX2_REG DOS_REG_ADDR(CINDEX2_REG) --#define CINDEX3_REG 0x032d --#define P_CINDEX3_REG DOS_REG_ADDR(CINDEX3_REG) --#define CINDEX4_REG 0x032e --#define P_CINDEX4_REG DOS_REG_ADDR(CINDEX4_REG) --#define CINDEX5_REG 0x032f --#define P_CINDEX5_REG DOS_REG_ADDR(CINDEX5_REG) --#define CINDEX6_REG 0x0330 --#define P_CINDEX6_REG DOS_REG_ADDR(CINDEX6_REG) --#define CINDEX7_REG 0x0331 --#define P_CINDEX7_REG DOS_REG_ADDR(CINDEX7_REG) --#define CMIN_REG 0x0332 --#define P_CMIN_REG DOS_REG_ADDR(CMIN_REG) --#define CMAX_REG 0x0333 --#define P_CMAX_REG DOS_REG_ADDR(CMAX_REG) --#define CBREAK0_REG 0x0334 --#define P_CBREAK0_REG DOS_REG_ADDR(CBREAK0_REG) --#define CBREAK1_REG 0x0335 --#define P_CBREAK1_REG DOS_REG_ADDR(CBREAK1_REG) --#define CBREAK2_REG 0x0336 --#define P_CBREAK2_REG DOS_REG_ADDR(CBREAK2_REG) --#define CBREAK3_REG 0x0337 --#define P_CBREAK3_REG DOS_REG_ADDR(CBREAK3_REG) --#define CBREAK_TYPE 0x0338 --#define P_CBREAK_TYPE DOS_REG_ADDR(CBREAK_TYPE) --#define CBREAK_CTRL 0x0339 --#define P_CBREAK_CTRL DOS_REG_ADDR(CBREAK_CTRL) --#define CBREAK_STAUTS 0x033a --#define P_CBREAK_STAUTS DOS_REG_ADDR(CBREAK_STAUTS) --#define CDB_ADDR_REG 0x033b --#define P_CDB_ADDR_REG DOS_REG_ADDR(CDB_ADDR_REG) --#define CDB_DATA_REG 0x033c --#define P_CDB_DATA_REG DOS_REG_ADDR(CDB_DATA_REG) --#define CDB_CTRL 0x033d --#define P_CDB_CTRL DOS_REG_ADDR(CDB_CTRL) --#define CSFTINT0 0x033e --#define P_CSFTINT0 DOS_REG_ADDR(CSFTINT0) --#define CSFTINT1 0x033f --#define P_CSFTINT1 DOS_REG_ADDR(CSFTINT1) --#define IMEM_DMA_CTRL 0x0340 --#define P_IMEM_DMA_CTRL DOS_REG_ADDR(IMEM_DMA_CTRL) --#define IMEM_DMA_ADR 0x0341 --#define P_IMEM_DMA_ADR DOS_REG_ADDR(IMEM_DMA_ADR) --#define IMEM_DMA_COUNT 0x0342 --#define P_IMEM_DMA_COUNT DOS_REG_ADDR(IMEM_DMA_COUNT) --#define WRRSP_IMEM 0x0343 --#define P_WRRSP_IMEM DOS_REG_ADDR(WRRSP_IMEM) --#define LMEM_DMA_CTRL 0x0350 --#define P_LMEM_DMA_CTRL DOS_REG_ADDR(LMEM_DMA_CTRL) --#define LMEM_DMA_ADR 0x0351 --#define P_LMEM_DMA_ADR DOS_REG_ADDR(LMEM_DMA_ADR) --#define LMEM_DMA_COUNT 0x0352 --#define P_LMEM_DMA_COUNT DOS_REG_ADDR(LMEM_DMA_COUNT) --#define WRRSP_LMEM 0x0353 --#define P_WRRSP_LMEM DOS_REG_ADDR(WRRSP_LMEM) --#define MAC_CTRL1 0x0360 --#define P_MAC_CTRL1 DOS_REG_ADDR(MAC_CTRL1) --#define ACC0REG1 0x0361 --#define P_ACC0REG1 DOS_REG_ADDR(ACC0REG1) --#define ACC1REG1 0x0362 --#define P_ACC1REG1 DOS_REG_ADDR(ACC1REG1) --#define MAC_CTRL2 0x0370 --#define P_MAC_CTRL2 DOS_REG_ADDR(MAC_CTRL2) --#define ACC0REG2 0x0371 --#define P_ACC0REG2 DOS_REG_ADDR(ACC0REG2) --#define ACC1REG2 0x0372 --#define P_ACC1REG2 DOS_REG_ADDR(ACC1REG2) --#define CPU_TRACE 0x0380 --#define P_CPU_TRACE DOS_REG_ADDR(CPU_TRACE) --#define HENC_SCRATCH_0 0x1ac0 --#define P_HENC_SCRATCH_0 DOS_REG_ADDR(HENC_SCRATCH_0) --#define HENC_SCRATCH_1 0x1ac1 --#define P_HENC_SCRATCH_1 DOS_REG_ADDR(HENC_SCRATCH_1) --#define HENC_SCRATCH_2 0x1ac2 --#define P_HENC_SCRATCH_2 DOS_REG_ADDR(HENC_SCRATCH_2) --#define HENC_SCRATCH_3 0x1ac3 --#define P_HENC_SCRATCH_3 DOS_REG_ADDR(HENC_SCRATCH_3) --#define HENC_SCRATCH_4 0x1ac4 --#define P_HENC_SCRATCH_4 DOS_REG_ADDR(HENC_SCRATCH_4) --#define HENC_SCRATCH_5 0x1ac5 --#define P_HENC_SCRATCH_5 DOS_REG_ADDR(HENC_SCRATCH_5) --#define HENC_SCRATCH_6 0x1ac6 --#define P_HENC_SCRATCH_6 DOS_REG_ADDR(HENC_SCRATCH_6) --#define HENC_SCRATCH_7 0x1ac7 --#define P_HENC_SCRATCH_7 DOS_REG_ADDR(HENC_SCRATCH_7) --#define HENC_SCRATCH_8 0x1ac8 --#define P_HENC_SCRATCH_8 DOS_REG_ADDR(HENC_SCRATCH_8) --#define HENC_SCRATCH_9 0x1ac9 --#define P_HENC_SCRATCH_9 DOS_REG_ADDR(HENC_SCRATCH_9) --#define HENC_SCRATCH_A 0x1aca --#define P_HENC_SCRATCH_A DOS_REG_ADDR(HENC_SCRATCH_A) --#define HENC_SCRATCH_B 0x1acb --#define P_HENC_SCRATCH_B DOS_REG_ADDR(HENC_SCRATCH_B) --#define HENC_SCRATCH_C 0x1acc --#define P_HENC_SCRATCH_C DOS_REG_ADDR(HENC_SCRATCH_C) --#define HENC_SCRATCH_D 0x1acd --#define P_HENC_SCRATCH_D DOS_REG_ADDR(HENC_SCRATCH_D) --#define HENC_SCRATCH_E 0x1ace --#define P_HENC_SCRATCH_E DOS_REG_ADDR(HENC_SCRATCH_E) --#define HENC_SCRATCH_F 0x1acf --#define P_HENC_SCRATCH_F DOS_REG_ADDR(HENC_SCRATCH_F) --#define HENC_SCRATCH_G 0x1ad0 --#define P_HENC_SCRATCH_G DOS_REG_ADDR(HENC_SCRATCH_G) --#define HENC_SCRATCH_H 0x1ad1 --#define P_HENC_SCRATCH_H DOS_REG_ADDR(HENC_SCRATCH_H) --#define HENC_SCRATCH_I 0x1ad2 --#define P_HENC_SCRATCH_I DOS_REG_ADDR(HENC_SCRATCH_I) --#define HENC_SCRATCH_J 0x1ad3 --#define P_HENC_SCRATCH_J DOS_REG_ADDR(HENC_SCRATCH_J) --#define HENC_SCRATCH_K 0x1ad4 --#define P_HENC_SCRATCH_K DOS_REG_ADDR(HENC_SCRATCH_K) --#define HENC_SCRATCH_L 0x1ad5 --#define P_HENC_SCRATCH_L DOS_REG_ADDR(HENC_SCRATCH_L) --#define HENC_SCRATCH_M 0x1ad6 --#define P_HENC_SCRATCH_M DOS_REG_ADDR(HENC_SCRATCH_M) --#define HENC_SCRATCH_N 0x1ad7 --#define P_HENC_SCRATCH_N DOS_REG_ADDR(HENC_SCRATCH_N) --#define VLC_STATUS_CTRL 0x1d00 --#define P_VLC_STATUS_CTRL DOS_REG_ADDR(VLC_STATUS_CTRL) --#define VLC_CONFIG 0x1d01 --#define P_VLC_CONFIG DOS_REG_ADDR(VLC_CONFIG) --#define VLC_VB_START_PTR 0x1d10 --#define P_VLC_VB_START_PTR DOS_REG_ADDR(VLC_VB_START_PTR) --#define VLC_VB_END_PTR 0x1d11 --#define P_VLC_VB_END_PTR DOS_REG_ADDR(VLC_VB_END_PTR) --#define VLC_VB_WR_PTR 0x1d12 --#define P_VLC_VB_WR_PTR DOS_REG_ADDR(VLC_VB_WR_PTR) --#define VLC_VB_RD_PTR 0x1d13 --#define P_VLC_VB_RD_PTR DOS_REG_ADDR(VLC_VB_RD_PTR) --#define VLC_VB_SW_RD_PTR 0x1d14 --#define P_VLC_VB_SW_RD_PTR DOS_REG_ADDR(VLC_VB_SW_RD_PTR) --#define VLC_VB_LEFT 0x1d15 --#define P_VLC_VB_LEFT DOS_REG_ADDR(VLC_VB_LEFT) --#define VLC_VB_CONTROL 0x1d16 --#define P_VLC_VB_CONTROL DOS_REG_ADDR(VLC_VB_CONTROL) --#define VLC_VB_MEM_CTL 0x1d17 --#define P_VLC_VB_MEM_CTL DOS_REG_ADDR(VLC_VB_MEM_CTL) --#define VLC_VB_INT_PTR 0x1d18 --#define P_VLC_VB_INT_PTR DOS_REG_ADDR(VLC_VB_INT_PTR) --#define VLC_WRRSP 0x1d19 --#define P_VLC_WRRSP DOS_REG_ADDR(VLC_WRRSP) --#define VLC_TOTAL_BYTES 0x1d1a --#define P_VLC_TOTAL_BYTES DOS_REG_ADDR(VLC_TOTAL_BYTES) --#define VLC_VB_BUFF 0x1d1b --#define P_VLC_VB_BUFF DOS_REG_ADDR(VLC_VB_BUFF) --#define VLC_VB_PRE_BUFF_HI 0x1d1c --#define P_VLC_VB_PRE_BUFF_HI DOS_REG_ADDR(VLC_VB_PRE_BUFF_HI) --#define VLC_VB_PRE_BUFF_LOW 0x1d1d --#define P_VLC_VB_PRE_BUFF_LOW DOS_REG_ADDR(VLC_VB_PRE_BUFF_LOW) --#define VLC_STREAM_BUFF 0x1d1e --#define P_VLC_STREAM_BUFF DOS_REG_ADDR(VLC_STREAM_BUFF) --#define VLC_PUSH_STREAM 0x1d1f --#define P_VLC_PUSH_STREAM DOS_REG_ADDR(VLC_PUSH_STREAM) --#define VLC_PUSH_ELEMENT 0x1d20 --#define P_VLC_PUSH_ELEMENT DOS_REG_ADDR(VLC_PUSH_ELEMENT) --#define VLC_ELEMENT_DATA 0x1d21 --#define P_VLC_ELEMENT_DATA DOS_REG_ADDR(VLC_ELEMENT_DATA) --/*add from M8M2*/ --#define VLC_SPECIAL_CTL 0x1d22 --#define P_VLC_SPECIAL_CTL DOS_REG_ADDR(VLC_SPECIAL_CTL) --#define VLC_HCMD_T_L_INFO 0x1d23 --#define P_VLC_HCMD_T_L_INFO DOS_REG_ADDR(VLC_HCMD_T_L_INFO) --#define VLC_HCMD_CUR_INFO 0x1d24 --#define P_VLC_HCMD_CUR_INFO DOS_REG_ADDR(VLC_HCMD_CUR_INFO) --/**/ --#define IE_CONTROL 0x1f40 --#define P_IE_CONTROL DOS_REG_ADDR(IE_CONTROL) --#define IE_MB_POSITION 0x1f41 --#define P_IE_MB_POSITION DOS_REG_ADDR(IE_MB_POSITION) --#define IE_ME_MB_INFO 0x1f42 --#define P_IE_ME_MB_INFO DOS_REG_ADDR(IE_ME_MB_INFO) --#define SAD_CONTROL 0x1f43 --#define P_SAD_CONTROL DOS_REG_ADDR(SAD_CONTROL) --#define IE_RESULT_BUFFER 0x1f44 --#define P_IE_RESULT_BUFFER DOS_REG_ADDR(IE_RESULT_BUFFER) --#define IE_I4_PRED_MODE_HI 0x1f45 --#define P_IE_I4_PRED_MODE_HI DOS_REG_ADDR(IE_I4_PRED_MODE_HI) --#define IE_I4_PRED_MODE_LO 0x1f46 --#define P_IE_I4_PRED_MODE_LO DOS_REG_ADDR(IE_I4_PRED_MODE_LO) --#define IE_C_PRED_MODE 0x1f47 --#define P_IE_C_PRED_MODE DOS_REG_ADDR(IE_C_PRED_MODE) --#define IE_CUR_REF_SEL 0x1f48 --#define P_IE_CUR_REF_SEL DOS_REG_ADDR(IE_CUR_REF_SEL) --#define ME_CONTROL 0x1f49 --#define P_ME_CONTROL DOS_REG_ADDR(ME_CONTROL) --#define ME_START_POSITION 0x1f4a --#define P_ME_START_POSITION DOS_REG_ADDR(ME_START_POSITION) --#define ME_STATUS 0x1f4b --#define P_ME_STATUS DOS_REG_ADDR(ME_STATUS) --#define ME_DEBUG 0x1f4c --#define P_ME_DEBUG DOS_REG_ADDR(ME_DEBUG) --#define ME_SKIP_LINE 0x1f4d --#define P_ME_SKIP_LINE DOS_REG_ADDR(ME_SKIP_LINE) --#define ME_AB_MEM_CTL 0x1f4e --#define P_ME_AB_MEM_CTL DOS_REG_ADDR(ME_AB_MEM_CTL) --#define ME_PIC_INFO 0x1f4f --#define P_ME_PIC_INFO DOS_REG_ADDR(ME_PIC_INFO) --#define ME_SAD_ENOUGH_01 0x1f50 --#define P_ME_SAD_ENOUGH_01 DOS_REG_ADDR(ME_SAD_ENOUGH_01) --#define ME_SAD_ENOUGH_23 0x1f51 --#define P_ME_SAD_ENOUGH_23 DOS_REG_ADDR(ME_SAD_ENOUGH_23) --#define ME_STEP0_CLOSE_MV 0x1f52 --#define P_ME_STEP0_CLOSE_MV DOS_REG_ADDR(ME_STEP0_CLOSE_MV) --#define ME_F_SKIP_SAD 0x1f53 --#define P_ME_F_SKIP_SAD DOS_REG_ADDR(ME_F_SKIP_SAD) --#define ME_F_SKIP_WEIGHT 0x1f54 --#define P_ME_F_SKIP_WEIGHT DOS_REG_ADDR(ME_F_SKIP_WEIGHT) --#define ME_MV_MERGE_CTL 0x1f55 --#define P_ME_MV_MERGE_CTL DOS_REG_ADDR(ME_MV_MERGE_CTL) --#define ME_MV_WEIGHT_01 0x1f56 --#define P_ME_MV_WEIGHT_01 DOS_REG_ADDR(ME_MV_WEIGHT_01) --#define ME_MV_WEIGHT_23 0x1f57 --#define P_ME_MV_WEIGHT_23 DOS_REG_ADDR(ME_MV_WEIGHT_23) --#define ME_SAD_RANGE_INC 0x1f58 --#define P_ME_SAD_RANGE_INC DOS_REG_ADDR(ME_SAD_RANGE_INC) --#define ME_SUB_MERGE_CTL 0x1f59 --#define P_ME_SUB_MERGE_CTL DOS_REG_ADDR(ME_SUB_MERGE_CTL) --#define ME_SUB_REF_MV_CTL 0x1f5a --#define P_ME_SUB_REF_MV_CTL DOS_REG_ADDR(ME_SUB_REF_MV_CTL) --#define ME_SUB_FIX_SAD 0x1f5c --#define P_ME_SUB_FIX_SAD DOS_REG_ADDR(ME_SUB_FIX_SAD) --#define ME_SUB_FIX_MIN_SAD 0x1f5d --#define P_ME_SUB_FIX_MIN_SAD DOS_REG_ADDR(ME_SUB_FIX_MIN_SAD) --#define ME_SUB_SNAP_GLITCH 0x1f5e --#define P_ME_SUB_SNAP_GLITCH DOS_REG_ADDR(ME_SUB_SNAP_GLITCH) --#define ME_SUB_ACT_CTL 0x1f5f --#define P_ME_SUB_ACT_CTL DOS_REG_ADDR(ME_SUB_ACT_CTL) --/*add from M8M2*/ --#define HEVC_ASSIST_GCLK_EN 0x3003 --#define P_HEVC_ASSIST_GCLK_EN DOS_REG_ADDR(HEVC_ASSIST_GCLK_EN) --#define HEVC_ASSIST_SW_RESET 0x3004 --#define P_HEVC_ASSIST_SW_RESET DOS_REG_ADDR(HEVC_ASSIST_SW_RESET) --#define HEVC_ASSIST_AMR1_INT0 0x3025 --#define HEVC_ASSIST_DMA_INT2 0x3066 --#define P_HEVC_ASSIST_DMA_INT2 DOS_REG_ADDR(HEVC_ASSIST_DMA_INT2) --#define HEVC_PARSER_VERSION 0x3100 --#define P_HEVC_PARSER_VERSION DOS_REG_ADDR(HEVC_PARSER_VERSION) --#define HEVC_STREAM_CONTROL 0x3101 --#define P_HEVC_STREAM_CONTROL DOS_REG_ADDR(HEVC_STREAM_CONTROL) --#define HEVC_STREAM_END_ADDR 0x3103 --#define P_HEVC_STREAM_END_ADDR DOS_REG_ADDR(HEVC_STREAM_END_ADDR) --#define HEVC_STREAM_WR_PTR 0x3104 --#define P_HEVC_STREAM_WR_PTR DOS_REG_ADDR(HEVC_STREAM_WR_PTR) --#define HEVC_STREAM_RD_PTR 0x3105 --#define P_HEVC_STREAM_RD_PTR DOS_REG_ADDR(HEVC_STREAM_RD_PTR) --#define HEVC_STREAM_LEVEL 0x3106 --#define P_HEVC_STREAM_LEVEL DOS_REG_ADDR(HEVC_STREAM_LEVEL) --#define HEVC_STREAM_FIFO_CTL 0x3107 --#define P_HEVC_STREAM_FIFO_CTL DOS_REG_ADDR(HEVC_STREAM_FIFO_CTL) --#define HEVC_SHIFT_CONTROL 0x3108 --#define P_HEVC_SHIFT_CONTROL DOS_REG_ADDR(HEVC_SHIFT_CONTROL) --#define HEVC_SHIFT_STARTCODE 0x3109 --#define P_HEVC_SHIFT_STARTCODE DOS_REG_ADDR(HEVC_SHIFT_STARTCODE) --#define HEVC_SHIFT_STATUS 0x310b --#define P_HEVC_SHIFT_STATUS DOS_REG_ADDR(HEVC_SHIFT_STATUS) --#define HEVC_SHIFTED_DATA 0x310c --#define P_HEVC_SHIFTED_DATA DOS_REG_ADDR(HEVC_SHIFTED_DATA) --#define HEVC_PARSER_RESULT_0 0x3118 --#define P_HEVC_PARSER_RESULT_0 DOS_REG_ADDR(HEVC_PARSER_RESULT_0) --#define HEVC_PARSER_RESULT_1 0x3119 --#define P_HEVC_PARSER_RESULT_1 DOS_REG_ADDR(HEVC_PARSER_RESULT_1) --#define HEVC_PARSER_RESULT_2 0x311a --#define P_HEVC_PARSER_RESULT_2 DOS_REG_ADDR(HEVC_PARSER_RESULT_2) --#define HEVC_PARSER_RESULT_3 0x311b --#define P_HEVC_PARSER_RESULT_3 DOS_REG_ADDR(HEVC_PARSER_RESULT_3) --#define HEVC_CABAC_TOP_INFO 0x311c --#define P_HEVC_CABAC_TOP_INFO DOS_REG_ADDR(HEVC_CABAC_TOP_INFO) --#define HEVC_SAO_IF_STATUS 0x3130 --#define P_HEVC_SAO_IF_STATUS DOS_REG_ADDR(HEVC_SAO_IF_STATUS) --#define HEVC_SAO_IF_DATA_Y 0x3131 --#define P_HEVC_SAO_IF_DATA_Y DOS_REG_ADDR(HEVC_SAO_IF_DATA_Y) --#define HEVC_SAO_IF_DATA_U 0x3132 --#define P_HEVC_SAO_IF_DATA_U DOS_REG_ADDR(HEVC_SAO_IF_DATA_U) --#define HEVC_SAO_IF_DATA_V 0x3133 --#define P_HEVC_SAO_IF_DATA_V DOS_REG_ADDR(HEVC_SAO_IF_DATA_V) --#define HEVC_STREAM_SWAP_ADDR 0x3134 --#define HEVC_MPRED_VERSION 0x3200 --#define P_HEVC_MPRED_VERSION DOS_REG_ADDR(HEVC_MPRED_VERSION) --#define HEVC_MPRED_CTRL0 0x3201 --#define P_HEVC_MPRED_CTRL0 DOS_REG_ADDR(HEVC_MPRED_CTRL0) --#define HEVC_MPRED_CTRL1 0x3202 --#define P_HEVC_MPRED_CTRL1 DOS_REG_ADDR(HEVC_MPRED_CTRL1) --#define HEVC_MPRED_INT_EN 0x3203 --#define P_HEVC_MPRED_INT_EN DOS_REG_ADDR(HEVC_MPRED_INT_EN) --#define HEVC_MPRED_INT_STATUS 0x3204 -- --#define HEVC_MPRED_REF_NUM 0x3209 --#define P_HEVC_MPRED_REF_NUM DOS_REG_ADDR(HEVC_MPRED_REF_NUM) --#define HEVC_MPRED_LT_REF 0x320a --#define P_HEVC_MPRED_LT_REF DOS_REG_ADDR(HEVC_MPRED_LT_REF) --#define HEVC_MPRED_LT_COLREF 0x320b --#define P_HEVC_MPRED_LT_COLREF DOS_REG_ADDR(HEVC_MPRED_LT_COLREF) --#define HEVC_MPRED_REF_EN_L0 0x320c --#define P_HEVC_MPRED_REF_EN_L0 DOS_REG_ADDR(HEVC_MPRED_REF_EN_L0) --#define HEVC_MPRED_REF_EN_L1 0x320d --#define P_HEVC_MPRED_REF_EN_L1 DOS_REG_ADDR(HEVC_MPRED_REF_EN_L1) --#define HEVC_MPRED_CURR_LCU 0x3219 --#define P_HEVC_MPRED_CURR_LCU DOS_REG_ADDR(HEVC_MPRED_CURR_LCU) --#define HEVC_MPRED_ABV_WPTR 0x321a --#define P_HEVC_MPRED_ABV_WPTR DOS_REG_ADDR(HEVC_MPRED_ABV_WPTR) --#define HEVC_MPRED_ABV_RPTR 0x321b --#define P_HEVC_MPRED_ABV_RPTR DOS_REG_ADDR(HEVC_MPRED_ABV_RPTR) --#define HEVC_MPRED_CTRL2 0x321c --#define P_HEVC_MPRED_CTRL2 DOS_REG_ADDR(HEVC_MPRED_CTRL2) --#define HEVC_MPRED_CTRL3 0x321d --#define P_HEVC_MPRED_CTRL3 DOS_REG_ADDR(HEVC_MPRED_CTRL3) --#define HEVC_MPRED_MV_WLCUY 0x321e --#define P_HEVC_MPRED_MV_WLCUY DOS_REG_ADDR(HEVC_MPRED_MV_WLCUY) --#define HEVC_MPRED_MV_RLCUY 0x321f --#define P_HEVC_MPRED_MV_RLCUY DOS_REG_ADDR(HEVC_MPRED_MV_RLCUY) -- --#define HEVC_MPRED_DBG_MODE0 0x3241 --#define P_HEVC_MPRED_DBG_MODE0 DOS_REG_ADDR(HEVC_MPRED_DBG_MODE0) --#define HEVC_MPRED_DBG_MODE1 0x3242 --#define P_HEVC_MPRED_DBG_MODE1 DOS_REG_ADDR(HEVC_MPRED_DBG_MODE1) --#define HEVC_MPRED_DBG2_MODE 0x3243 --#define P_HEVC_MPRED_DBG2_MODE DOS_REG_ADDR(HEVC_MPRED_DBG2_MODE) --#define HEVC_MPRED_IMP_CMD0 0x3244 --#define P_HEVC_MPRED_IMP_CMD0 DOS_REG_ADDR(HEVC_MPRED_IMP_CMD0) --#define HEVC_MPRED_IMP_CMD1 0x3245 --#define P_HEVC_MPRED_IMP_CMD1 DOS_REG_ADDR(HEVC_MPRED_IMP_CMD1) --#define HEVC_MPRED_IMP_CMD2 0x3246 --#define P_HEVC_MPRED_IMP_CMD2 DOS_REG_ADDR(HEVC_MPRED_IMP_CMD2) --#define HEVC_MPRED_IMP_CMD3 0x3247 --#define P_HEVC_MPRED_IMP_CMD3 DOS_REG_ADDR(HEVC_MPRED_IMP_CMD3) --#define HEVCD_IPP_TOP_LCUCONFIG 0x3406 --#define P_HEVC_DBLK_CFG0 DOS_REG_ADDR(HEVC_DBLK_CFG0) --#define HEVC_DBLK_CFG1 0x3501 --#define P_HEVC_DBLK_CFG1 DOS_REG_ADDR(HEVC_DBLK_CFG1) --#define HEVC_DBLK_CFG2 0x3502 --#define P_HEVC_DBLK_CFG2 DOS_REG_ADDR(HEVC_DBLK_CFG2) --#define HEVC_DBLK_CFG3 0x3503 --#define P_HEVC_DBLK_CFG3 DOS_REG_ADDR(HEVC_DBLK_CFG3) --#define HEVC_DBLK_CFG4 0x3504 --#define P_HEVC_DBLK_CFG4 DOS_REG_ADDR(HEVC_DBLK_CFG4) --#define HEVC_DBLK_CFG5 0x3505 --#define P_HEVC_DBLK_CFG5 DOS_REG_ADDR(HEVC_DBLK_CFG5) --#define HEVC_DBLK_CFG6 0x3506 --#define P_HEVC_DBLK_CFG6 DOS_REG_ADDR(HEVC_DBLK_CFG6) --#define HEVC_DBLK_CFG7 0x3507 --#define P_HEVC_DBLK_CFG7 DOS_REG_ADDR(HEVC_DBLK_CFG7) --#define HEVC_DBLK_CFG8 0x3508 --#define P_HEVC_DBLK_CFG8 DOS_REG_ADDR(HEVC_DBLK_CFG8) --#define HEVC_DBLK_CFG9 0x3509 --#define P_HEVC_DBLK_CFG9 DOS_REG_ADDR(HEVC_DBLK_CFG9) --#define HEVC_DBLK_CFGA 0x350a --#define P_HEVC_DBLK_CFGA DOS_REG_ADDR(HEVC_DBLK_CFGA) --#define HEVC_DBLK_STS0 0x350b --#define P_HEVC_DBLK_STS0 DOS_REG_ADDR(HEVC_DBLK_STS0) --#define HEVC_DBLK_STS1 0x350c --#define P_HEVC_DBLK_STS1 DOS_REG_ADDR(HEVC_DBLK_STS1) --#define HEVC_SAO_VERSION 0x3600 --#define P_HEVC_SAO_VERSION DOS_REG_ADDR(HEVC_SAO_VERSION) --#define HEVC_SAO_CTRL0 0x3601 --#define P_HEVC_SAO_CTRL0 DOS_REG_ADDR(HEVC_SAO_CTRL0) --#define HEVC_SAO_CTRL1 0x3602 --#define P_HEVC_SAO_CTRL1 DOS_REG_ADDR(HEVC_SAO_CTRL1) --#define HEVC_SAO_INT_EN 0x3603 --#define P_HEVC_SAO_INT_EN DOS_REG_ADDR(HEVC_SAO_INT_EN) --#define HEVC_SAO_INT_STATUS 0x3604 --#define P_HEVC_SAO_INT_STATUS DOS_REG_ADDR(HEVC_SAO_INT_STATUS) -- --#define HEVC_SAO_TILE_START 0x3607 --#define P_HEVC_SAO_TILE_START DOS_REG_ADDR(HEVC_SAO_TILE_START) --#define HEVC_SAO_AXI_WCTRL 0x3609 --#define P_HEVC_SAO_AXI_WCTRL DOS_REG_ADDR(HEVC_SAO_AXI_WCTRL) --#define HEVC_SAO_AXI_RCTRL 0x360a --#define P_HEVC_SAO_AXI_RCTRL DOS_REG_ADDR(HEVC_SAO_AXI_RCTRL) -- --#define HEVC_SAO_ABV_WPTR 0x3614 --#define P_HEVC_SAO_ABV_WPTR DOS_REG_ADDR(HEVC_SAO_ABV_WPTR) --#define HEVC_SAO_ABV_RPTR 0x3615 --#define P_HEVC_SAO_ABV_RPTR DOS_REG_ADDR(HEVC_SAO_ABV_RPTR) --#define HEVC_SAO_VB_WPTR 0x3616 --#define P_HEVC_SAO_VB_WPTR DOS_REG_ADDR(HEVC_SAO_VB_WPTR) --#define HEVC_SAO_VB_RPTR 0x3617 --#define P_HEVC_SAO_VB_RPTR DOS_REG_ADDR(HEVC_SAO_VB_RPTR) --#define HEVC_SAO_DBG_MODE0 0x361e --#define P_HEVC_SAO_DBG_MODE0 DOS_REG_ADDR(HEVC_SAO_DBG_MODE0) --#define HEVC_SAO_DBG_MODE1 0x361f --#define P_HEVC_SAO_DBG_MODE1 DOS_REG_ADDR(HEVC_SAO_DBG_MODE1) --#define HEVC_SAO_CTRL2 0x3620 --#define P_HEVC_SAO_CTRL2 DOS_REG_ADDR(HEVC_SAO_CTRL2) --#define HEVC_SAO_CTRL3 0x3621 --#define P_HEVC_SAO_CTRL3 DOS_REG_ADDR(HEVC_SAO_CTRL3) --#define HEVC_SAO_CTRL4 0x3622 --#define P_HEVC_SAO_CTRL4 DOS_REG_ADDR(HEVC_SAO_CTRL4) --#define HEVC_SAO_CTRL5 0x3623 --#define P_HEVC_SAO_CTRL5 DOS_REG_ADDR(HEVC_SAO_CTRL5) --#define HEVC_SAO_CTRL6 0x3624 --#define P_HEVC_SAO_CTRL6 DOS_REG_ADDR(HEVC_SAO_CTRL6) --#define HEVC_SAO_CTRL7 0x3625 --#define P_HEVC_SAO_CTRL7 DOS_REG_ADDR(HEVC_SAO_CTRL7) --#define HEVC_SAO_DBG_DATA_0 0x3630 --#define P_HEVC_SAO_DBG_DATA_0 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_0) --#define HEVC_SAO_DBG_DATA_1 0x3631 --#define P_HEVC_SAO_DBG_DATA_1 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_1) --#define HEVC_SAO_DBG_DATA_2 0x3632 --#define P_HEVC_SAO_DBG_DATA_2 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_2) --#define HEVC_SAO_DBG_DATA_3 0x3633 --#define P_HEVC_SAO_DBG_DATA_3 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_3) --#define HEVC_SAO_DBG_DATA_4 0x3634 --#define P_HEVC_SAO_DBG_DATA_4 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_4) --#define HEVC_SAO_DBG_DATA_5 0x3635 --#define P_HEVC_SAO_DBG_DATA_5 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_5) --#define HEVC_SAO_DBG_DATA_6 0x3636 --#define P_HEVC_SAO_DBG_DATA_6 DOS_REG_ADDR(HEVC_SAO_DBG_DATA_6) --#define HEVC_IQIT_STAT_GEN0 0x3708 --#define P_HEVC_IQIT_STAT_GEN0 DOS_REG_ADDR(HEVC_IQIT_STAT_GEN0) --#define HEVC_QP_WRITE 0x3709 --#define P_HEVC_QP_WRITE DOS_REG_ADDR(HEVC_QP_WRITE) --#define HEVC_IQIT_STAT_GEN1 0x370a --#define P_HEVC_IQIT_STAT_GEN1 DOS_REG_ADDR(HEVC_IQIT_STAT_GEN1) --/**/ --#define DOS_SW_RESET0 0x3f00 --#define P_DOS_SW_RESET0 DOS_REG_ADDR(DOS_SW_RESET0) --#define DOS_GCLK_EN0 0x3f01 --#define P_DOS_GCLK_EN0 DOS_REG_ADDR(DOS_GCLK_EN0) --#define DOS_GEN_CTRL0 0x3f02 --#define P_DOS_GEN_CTRL0 DOS_REG_ADDR(DOS_GEN_CTRL0) --#define DOS_APB_ERR_CTRL 0x3f03 --#define P_DOS_APB_ERR_CTRL DOS_REG_ADDR(DOS_APB_ERR_CTRL) --#define DOS_APB_ERR_STAT 0x3f04 --#define P_DOS_APB_ERR_STAT DOS_REG_ADDR(DOS_APB_ERR_STAT) --#define DOS_VDEC_INT_EN 0x3f05 --#define P_DOS_VDEC_INT_EN DOS_REG_ADDR(DOS_VDEC_INT_EN) --#define DOS_HCODEC_INT_EN 0x3f06 --#define P_DOS_HCODEC_INT_EN DOS_REG_ADDR(DOS_HCODEC_INT_EN) --#define DOS_SW_RESET1 0x3f07 --#define P_DOS_SW_RESET1 DOS_REG_ADDR(DOS_SW_RESET1) --#define DOS_SW_RESET2 0x3f08 --#define P_DOS_SW_RESET2 DOS_REG_ADDR(DOS_SW_RESET2) --#define DOS_GCLK_EN1 0x3f09 --#define P_DOS_GCLK_EN1 DOS_REG_ADDR(DOS_GCLK_EN1) --#define DOS_VDEC2_INT_EN 0x3f0a --#define P_DOS_VDEC2_INT_EN DOS_REG_ADDR(DOS_VDEC2_INT_EN) --#define DOS_VDIN_LCNT 0x3f0b --#define P_DOS_VDIN_LCNT DOS_REG_ADDR(DOS_VDIN_LCNT) --#define DOS_VDIN_FCNT 0x3f0c --#define P_DOS_VDIN_FCNT DOS_REG_ADDR(DOS_VDIN_FCNT) --#define DOS_VDIN_CCTL 0x3f0d --#define P_DOS_VDIN_CCTL DOS_REG_ADDR(DOS_VDIN_CCTL) --#define DOS_SCRATCH0 0x3f10 --#define P_DOS_SCRATCH0 DOS_REG_ADDR(DOS_SCRATCH0) --#define DOS_SCRATCH1 0x3f11 --#define P_DOS_SCRATCH1 DOS_REG_ADDR(DOS_SCRATCH1) --#define DOS_SCRATCH2 0x3f12 --#define P_DOS_SCRATCH2 DOS_REG_ADDR(DOS_SCRATCH2) --#define DOS_SCRATCH3 0x3f13 --#define P_DOS_SCRATCH3 DOS_REG_ADDR(DOS_SCRATCH3) --#define DOS_SCRATCH4 0x3f14 --#define P_DOS_SCRATCH4 DOS_REG_ADDR(DOS_SCRATCH4) --#define DOS_SCRATCH5 0x3f15 --#define P_DOS_SCRATCH5 DOS_REG_ADDR(DOS_SCRATCH5) --#define DOS_SCRATCH6 0x3f16 --#define P_DOS_SCRATCH6 DOS_REG_ADDR(DOS_SCRATCH6) --#define DOS_SCRATCH7 0x3f17 --#define P_DOS_SCRATCH7 DOS_REG_ADDR(DOS_SCRATCH7) --#define DOS_SCRATCH8 0x3f18 --#define P_DOS_SCRATCH8 DOS_REG_ADDR(DOS_SCRATCH8) --#define DOS_SCRATCH9 0x3f19 --#define P_DOS_SCRATCH9 DOS_REG_ADDR(DOS_SCRATCH9) --#define DOS_SCRATCH10 0x3f1a --#define P_DOS_SCRATCH10 DOS_REG_ADDR(DOS_SCRATCH10) --#define DOS_SCRATCH11 0x3f1b --#define P_DOS_SCRATCH11 DOS_REG_ADDR(DOS_SCRATCH11) --#define DOS_SCRATCH12 0x3f1c --#define P_DOS_SCRATCH12 DOS_REG_ADDR(DOS_SCRATCH12) --#define DOS_SCRATCH13 0x3f1d --#define P_DOS_SCRATCH13 DOS_REG_ADDR(DOS_SCRATCH13) --#define DOS_SCRATCH14 0x3f1e --#define P_DOS_SCRATCH14 DOS_REG_ADDR(DOS_SCRATCH14) --#define DOS_SCRATCH15 0x3f1f --#define P_DOS_SCRATCH15 DOS_REG_ADDR(DOS_SCRATCH15) --#define DOS_SCRATCH16 0x3f20 --#define P_DOS_SCRATCH16 DOS_REG_ADDR(DOS_SCRATCH16) --#define DOS_SCRATCH17 0x3f21 --#define P_DOS_SCRATCH17 DOS_REG_ADDR(DOS_SCRATCH17) --#define DOS_SCRATCH18 0x3f22 --#define P_DOS_SCRATCH18 DOS_REG_ADDR(DOS_SCRATCH18) --#define DOS_SCRATCH19 0x3f23 --#define P_DOS_SCRATCH19 DOS_REG_ADDR(DOS_SCRATCH19) --#define DOS_SCRATCH20 0x3f24 --#define P_DOS_SCRATCH20 DOS_REG_ADDR(DOS_SCRATCH20) --#define DOS_SCRATCH21 0x3f25 --#define P_DOS_SCRATCH21 DOS_REG_ADDR(DOS_SCRATCH21) --#define DOS_SCRATCH22 0x3f26 --#define P_DOS_SCRATCH22 DOS_REG_ADDR(DOS_SCRATCH22) --#define DOS_SCRATCH23 0x3f27 --#define P_DOS_SCRATCH23 DOS_REG_ADDR(DOS_SCRATCH23) --#define DOS_SCRATCH24 0x3f28 --#define P_DOS_SCRATCH24 DOS_REG_ADDR(DOS_SCRATCH24) --#define DOS_SCRATCH25 0x3f29 --#define P_DOS_SCRATCH25 DOS_REG_ADDR(DOS_SCRATCH25) --#define DOS_SCRATCH26 0x3f2a --#define P_DOS_SCRATCH26 DOS_REG_ADDR(DOS_SCRATCH26) --#define DOS_SCRATCH27 0x3f2b --#define P_DOS_SCRATCH27 DOS_REG_ADDR(DOS_SCRATCH27) --#define DOS_SCRATCH28 0x3f2c --#define P_DOS_SCRATCH28 DOS_REG_ADDR(DOS_SCRATCH28) --#define DOS_SCRATCH29 0x3f2d --#define P_DOS_SCRATCH29 DOS_REG_ADDR(DOS_SCRATCH29) --#define DOS_SCRATCH30 0x3f2e --#define P_DOS_SCRATCH30 DOS_REG_ADDR(DOS_SCRATCH30) --#define DOS_SCRATCH31 0x3f2f --#define P_DOS_SCRATCH31 DOS_REG_ADDR(DOS_SCRATCH31) --#define DOS_MEM_PD_VDEC 0x3f30 --#define P_DOS_MEM_PD_VDEC DOS_REG_ADDR(DOS_MEM_PD_VDEC) --#define DOS_MEM_PD_VDEC2 0x3f31 --#define P_DOS_MEM_PD_VDEC2 DOS_REG_ADDR(DOS_MEM_PD_VDEC2) --#define DOS_MEM_PD_HCODEC 0x3f32 --#define P_DOS_MEM_PD_HCODEC DOS_REG_ADDR(DOS_MEM_PD_HCODEC) --/*add from M8M2*/ --#define DOS_MEM_PD_HEVC 0x3f33 --#define P_DOS_MEM_PD_HEVC DOS_REG_ADDR(DOS_MEM_PD_HEVC) --#define DOS_SW_RESET3 0x3f34 --#define P_DOS_SW_RESET3 DOS_REG_ADDR(DOS_SW_RESET3) --#define DOS_GCLK_EN3 0x3f35 --#define P_DOS_GCLK_EN3 DOS_REG_ADDR(DOS_GCLK_EN3) --#define DOS_HEVC_INT_EN 0x3f36 --#define P_DOS_HEVC_INT_EN DOS_REG_ADDR(DOS_HEVC_INT_EN) --/**/ -- --#define HCODEC_MC_CTRL_REG 0x1900 --#define P_HCODEC_MC_CTRL_REG DOS_REG_ADDR(HCODEC_MC_CTRL_REG) --#define HCODEC_MC_MB_INFO 0x1901 --#define P_HCODEC_MC_MB_INFO DOS_REG_ADDR(HCODEC_MC_MB_INFO) --#define HCODEC_MC_PIC_INFO 0x1902 --#define P_HCODEC_MC_PIC_INFO DOS_REG_ADDR(HCODEC_MC_PIC_INFO) --#define HCODEC_POWER_CTL_MC 0x1905 --#define P_HCODEC_POWER_CTL_MC DOS_REG_ADDR(HCODEC_POWER_CTL_MC) --#define HCODEC_MC_CMD 0x1906 --#define P_HCODEC_MC_CMD DOS_REG_ADDR(HCODEC_MC_CMD) --#define HCODEC_MC_CTRL0 0x1907 --#define P_HCODEC_MC_CTRL0 DOS_REG_ADDR(HCODEC_MC_CTRL0) --#define HCODEC_MC_PIC_W_H 0x1908 --#define P_HCODEC_MC_PIC_W_H DOS_REG_ADDR(HCODEC_MC_PIC_W_H) --#define HCODEC_MC_STATUS0 0x1909 --#define P_HCODEC_MC_STATUS0 DOS_REG_ADDR(HCODEC_MC_STATUS0) --#define HCODEC_MC_STATUS1 0x190a --#define P_HCODEC_MC_STATUS1 DOS_REG_ADDR(HCODEC_MC_STATUS1) --#define HCODEC_MC_CTRL1 0x190b --#define P_HCODEC_MC_CTRL1 DOS_REG_ADDR(HCODEC_MC_CTRL1) --#define HCODEC_MC_MIX_RATIO0 0x190c --#define P_HCODEC_MC_MIX_RATIO0 DOS_REG_ADDR(HCODEC_MC_MIX_RATIO0) --#define HCODEC_MC_MIX_RATIO1 0x190d --#define P_HCODEC_MC_MIX_RATIO1 DOS_REG_ADDR(HCODEC_MC_MIX_RATIO1) --#define HCODEC_MC_DP_MB_XY 0x190e --#define P_HCODEC_MC_DP_MB_XY DOS_REG_ADDR(HCODEC_MC_DP_MB_XY) --#define HCODEC_MC_OM_MB_XY 0x190f --#define P_HCODEC_MC_OM_MB_XY DOS_REG_ADDR(HCODEC_MC_OM_MB_XY) --#define HCODEC_PSCALE_RST 0x1910 --#define P_HCODEC_PSCALE_RST DOS_REG_ADDR(HCODEC_PSCALE_RST) --#define HCODEC_PSCALE_CTRL 0x1911 --#define P_HCODEC_PSCALE_CTRL DOS_REG_ADDR(HCODEC_PSCALE_CTRL) --#define HCODEC_PSCALE_PICI_W 0x1912 --#define P_HCODEC_PSCALE_PICI_W DOS_REG_ADDR(HCODEC_PSCALE_PICI_W) --#define HCODEC_PSCALE_PICI_H 0x1913 --#define P_HCODEC_PSCALE_PICI_H DOS_REG_ADDR(HCODEC_PSCALE_PICI_H) --#define HCODEC_PSCALE_PICO_W 0x1914 --#define P_HCODEC_PSCALE_PICO_W DOS_REG_ADDR(HCODEC_PSCALE_PICO_W) --#define HCODEC_PSCALE_PICO_H 0x1915 --#define P_HCODEC_PSCALE_PICO_H DOS_REG_ADDR(HCODEC_PSCALE_PICO_H) --#define HCODEC_PSCALE_PICO_START_X 0x1916 -- -- --/**/ --#define HCODEC_MC_MPORT_CTRL 0x1940 --#define P_HCODEC_MC_MPORT_CTRL DOS_REG_ADDR(HCODEC_MC_MPORT_CTRL) --#define HCODEC_MC_MPORT_DAT 0x1941 --#define P_HCODEC_MC_MPORT_DAT DOS_REG_ADDR(HCODEC_MC_MPORT_DAT) --#define HCODEC_MC_DPDN_MB_XY 0x1946 --#define P_HCODEC_MC_DPDN_MB_XY DOS_REG_ADDR(HCODEC_MC_DPDN_MB_XY) --#define HCODEC_MC_OMDN_MB_XY 0x1947 --#define HCODEC_AV_SCRATCH_0 0x19c0 --#define P_HCODEC_AV_SCRATCH_0 DOS_REG_ADDR(HCODEC_AV_SCRATCH_0) --#define HCODEC_AV_SCRATCH_1 0x19c1 --#define P_HCODEC_AV_SCRATCH_1 DOS_REG_ADDR(HCODEC_AV_SCRATCH_1) --#define HCODEC_AV_SCRATCH_2 0x19c2 --#define P_HCODEC_AV_SCRATCH_2 DOS_REG_ADDR(HCODEC_AV_SCRATCH_2) --#define HCODEC_AV_SCRATCH_3 0x19c3 --#define P_HCODEC_AV_SCRATCH_3 DOS_REG_ADDR(HCODEC_AV_SCRATCH_3) --#define HCODEC_AV_SCRATCH_4 0x19c4 --#define P_HCODEC_AV_SCRATCH_4 DOS_REG_ADDR(HCODEC_AV_SCRATCH_4) --#define HCODEC_AV_SCRATCH_5 0x19c5 --#define P_HCODEC_AV_SCRATCH_5 DOS_REG_ADDR(HCODEC_AV_SCRATCH_5) --#define HCODEC_AV_SCRATCH_6 0x19c6 --#define P_HCODEC_AV_SCRATCH_6 DOS_REG_ADDR(HCODEC_AV_SCRATCH_6) --#define HCODEC_AV_SCRATCH_7 0x19c7 --#define P_HCODEC_AV_SCRATCH_7 DOS_REG_ADDR(HCODEC_AV_SCRATCH_7) --#define HCODEC_AV_SCRATCH_8 0x19c8 --#define P_HCODEC_AV_SCRATCH_8 DOS_REG_ADDR(HCODEC_AV_SCRATCH_8) --#define HCODEC_AV_SCRATCH_9 0x19c9 --#define P_HCODEC_AV_SCRATCH_9 DOS_REG_ADDR(HCODEC_AV_SCRATCH_9) --#define HCODEC_AV_SCRATCH_A 0x19ca --#define P_HCODEC_AV_SCRATCH_A DOS_REG_ADDR(HCODEC_AV_SCRATCH_A) --#define HCODEC_AV_SCRATCH_B 0x19cb --#define P_HCODEC_AV_SCRATCH_B DOS_REG_ADDR(HCODEC_AV_SCRATCH_B) --#define HCODEC_AV_SCRATCH_C 0x19cc --#define P_HCODEC_AV_SCRATCH_C DOS_REG_ADDR(HCODEC_AV_SCRATCH_C) --#define HCODEC_AV_SCRATCH_D 0x19cd --#define P_HCODEC_AV_SCRATCH_D DOS_REG_ADDR(HCODEC_AV_SCRATCH_D) --#define HCODEC_AV_SCRATCH_E 0x19ce --#define P_HCODEC_AV_SCRATCH_E DOS_REG_ADDR(HCODEC_AV_SCRATCH_E) --#define HCODEC_AV_SCRATCH_F 0x19cf --#define P_HCODEC_AV_SCRATCH_F DOS_REG_ADDR(HCODEC_AV_SCRATCH_F) --#define HCODEC_AV_SCRATCH_G 0x19d0 --#define P_HCODEC_AV_SCRATCH_G DOS_REG_ADDR(HCODEC_AV_SCRATCH_G) --#define HCODEC_AV_SCRATCH_H 0x19d1 --#define P_HCODEC_AV_SCRATCH_H DOS_REG_ADDR(HCODEC_AV_SCRATCH_H) --#define HCODEC_AV_SCRATCH_I 0x19d2 --#define P_HCODEC_AV_SCRATCH_I DOS_REG_ADDR(HCODEC_AV_SCRATCH_I) --#define HCODEC_AV_SCRATCH_J 0x19d3 --#define P_HCODEC_AV_SCRATCH_J DOS_REG_ADDR(HCODEC_AV_SCRATCH_J) --#define HCODEC_AV_SCRATCH_K 0x19d4 --#define P_HCODEC_AV_SCRATCH_K DOS_REG_ADDR(HCODEC_AV_SCRATCH_K) --#define HCODEC_AV_SCRATCH_L 0x19d5 --#define P_HCODEC_AV_SCRATCH_L DOS_REG_ADDR(HCODEC_AV_SCRATCH_L) --#define HCODEC_AV_SCRATCH_M 0x19d6 --#define P_HCODEC_AV_SCRATCH_M DOS_REG_ADDR(HCODEC_AV_SCRATCH_M) --#define HCODEC_AV_SCRATCH_N 0x19d7 --#define P_HCODEC_AV_SCRATCH_N DOS_REG_ADDR(HCODEC_AV_SCRATCH_N) --#define HCODEC_WRRSP_CO_MB 0x19d8 --#define P_HCODEC_WRRSP_CO_MB DOS_REG_ADDR(HCODEC_WRRSP_CO_MB) --#define HCODEC_WRRSP_DCAC 0x19d9 --#define P_HCODEC_WRRSP_DCAC DOS_REG_ADDR(HCODEC_WRRSP_DCAC) --/*add from M8M2*/ --#define VDEC2_AV_SCRATCH_0 0x29c0 --#define P_VDEC2_AV_SCRATCH_0 DOS_REG_ADDR(VDEC2_AV_SCRATCH_0) --#define VDEC2_AV_SCRATCH_1 0x29c1 --#define P_VDEC2_AV_SCRATCH_1 DOS_REG_ADDR(VDEC2_AV_SCRATCH_1) --#define VDEC2_AV_SCRATCH_2 0x29c2 --#define P_VDEC2_AV_SCRATCH_2 DOS_REG_ADDR(VDEC2_AV_SCRATCH_2) --#define VDEC2_AV_SCRATCH_3 0x29c3 --#define P_VDEC2_AV_SCRATCH_3 DOS_REG_ADDR(VDEC2_AV_SCRATCH_3) --#define VDEC2_AV_SCRATCH_4 0x29c4 --#define P_VDEC2_AV_SCRATCH_4 DOS_REG_ADDR(VDEC2_AV_SCRATCH_4) --#define VDEC2_AV_SCRATCH_5 0x29c5 --#define P_VDEC2_AV_SCRATCH_5 DOS_REG_ADDR(VDEC2_AV_SCRATCH_5) --#define VDEC2_AV_SCRATCH_6 0x29c6 --#define P_VDEC2_AV_SCRATCH_6 DOS_REG_ADDR(VDEC2_AV_SCRATCH_6) --#define VDEC2_AV_SCRATCH_7 0x29c7 --#define P_VDEC2_AV_SCRATCH_7 DOS_REG_ADDR(VDEC2_AV_SCRATCH_7) --#define VDEC2_AV_SCRATCH_8 0x29c8 --#define P_VDEC2_AV_SCRATCH_8 DOS_REG_ADDR(VDEC2_AV_SCRATCH_8) --#define VDEC2_AV_SCRATCH_9 0x29c9 --#define P_VDEC2_AV_SCRATCH_9 DOS_REG_ADDR(VDEC2_AV_SCRATCH_9) --#define VDEC2_AV_SCRATCH_A 0x29ca --#define P_VDEC2_AV_SCRATCH_A DOS_REG_ADDR(VDEC2_AV_SCRATCH_A) --#define VDEC2_AV_SCRATCH_B 0x29cb --#define P_VDEC2_AV_SCRATCH_B DOS_REG_ADDR(VDEC2_AV_SCRATCH_B) --#define VDEC2_AV_SCRATCH_C 0x29cc --#define P_VDEC2_AV_SCRATCH_C DOS_REG_ADDR(VDEC2_AV_SCRATCH_C) --#define VDEC2_AV_SCRATCH_D 0x29cd --#define P_VDEC2_AV_SCRATCH_D DOS_REG_ADDR(VDEC2_AV_SCRATCH_D) --#define VDEC2_AV_SCRATCH_E 0x29ce --#define P_VDEC2_AV_SCRATCH_E DOS_REG_ADDR(VDEC2_AV_SCRATCH_E) --#define VDEC2_AV_SCRATCH_F 0x29cf --#define P_VDEC2_AV_SCRATCH_F DOS_REG_ADDR(VDEC2_AV_SCRATCH_F) --#define VDEC2_AV_SCRATCH_G 0x29d0 --#define P_VDEC2_AV_SCRATCH_G DOS_REG_ADDR(VDEC2_AV_SCRATCH_G) --#define VDEC2_AV_SCRATCH_H 0x29d1 --#define P_VDEC2_AV_SCRATCH_H DOS_REG_ADDR(VDEC2_AV_SCRATCH_H) --#define VDEC2_AV_SCRATCH_I 0x29d2 --#define P_VDEC2_AV_SCRATCH_I DOS_REG_ADDR(VDEC2_AV_SCRATCH_I) --#define VDEC2_AV_SCRATCH_J 0x29d3 --#define P_VDEC2_AV_SCRATCH_J DOS_REG_ADDR(VDEC2_AV_SCRATCH_J) --#define VDEC2_AV_SCRATCH_K 0x29d4 --#define P_VDEC2_AV_SCRATCH_K DOS_REG_ADDR(VDEC2_AV_SCRATCH_K) --#define VDEC2_AV_SCRATCH_L 0x29d5 --#define P_VDEC2_AV_SCRATCH_L DOS_REG_ADDR(VDEC2_AV_SCRATCH_L) --#define VDEC2_AV_SCRATCH_M 0x29d6 --#define P_VDEC2_AV_SCRATCH_M DOS_REG_ADDR(VDEC2_AV_SCRATCH_M) --#define VDEC2_AV_SCRATCH_N 0x29d7 --#define P_VDEC2_AV_SCRATCH_N DOS_REG_ADDR(VDEC2_AV_SCRATCH_N) --#define VDEC2_WRRSP_CO_MB 0x29d8 --#define P_VDEC2_WRRSP_CO_MB DOS_REG_ADDR(VDEC2_WRRSP_CO_MB) --#define VDEC2_WRRSP_DCAC 0x29d9 --#define P_VDEC2_WRRSP_DCAC DOS_REG_ADDR(VDEC2_WRRSP_DCAC) --/*add from M8M2*/ --/**/ --#define VDEC2_DBLK_RST 0x2950 --#define P_VDEC2_DBLK_RST DOS_REG_ADDR(VDEC2_DBLK_RST) --#define VDEC2_DBLK_CTRL 0x2951 --#define P_VDEC2_DBLK_CTRL DOS_REG_ADDR(VDEC2_DBLK_CTRL) --#define VDEC2_DBLK_MB_WID_HEIGHT 0x2952 --#define VDEC2_DBLK_STATUS 0x2953 --#define P_VDEC2_DBLK_STATUS DOS_REG_ADDR(VDEC2_DBLK_STATUS) --#define VDEC2_DBLK_CMD_CTRL 0x2954 --#define P_VDEC2_DBLK_CMD_CTRL DOS_REG_ADDR(VDEC2_DBLK_CMD_CTRL) --#define VDEC2_DBLK_MB_XY 0x2955 --#define P_VDEC2_DBLK_MB_XY DOS_REG_ADDR(VDEC2_DBLK_MB_XY) --#define VDEC2_DBLK_QP 0x2956 --#define P_VDEC2_DBLK_QP DOS_REG_ADDR(VDEC2_DBLK_QP) --#define VDEC2_DBLK_Y_BHFILT 0x2957 --#define P_VDEC2_DBLK_Y_BHFILT DOS_REG_ADDR(VDEC2_DBLK_Y_BHFILT) --#define VDEC2_DBLK_Y_BHFILT_HIGH 0x2958 --#define VDEC2_DBLK_Y_BVFILT 0x2959 --#define P_VDEC2_DBLK_Y_BVFILT DOS_REG_ADDR(VDEC2_DBLK_Y_BVFILT) --#define VDEC2_DBLK_CB_BFILT 0x295a --#define P_VDEC2_DBLK_CB_BFILT DOS_REG_ADDR(VDEC2_DBLK_CB_BFILT) --#define VDEC2_DBLK_CR_BFILT 0x295b --#define P_VDEC2_DBLK_CR_BFILT DOS_REG_ADDR(VDEC2_DBLK_CR_BFILT) --#define VDEC2_DBLK_Y_HFILT 0x295c --#define P_VDEC2_DBLK_Y_HFILT DOS_REG_ADDR(VDEC2_DBLK_Y_HFILT) --#define VDEC2_DBLK_Y_VFILT 0x295e --#define P_VDEC2_DBLK_Y_VFILT DOS_REG_ADDR(VDEC2_DBLK_Y_VFILT) --#define VDEC2_DBLK_CB_FILT 0x295f --#define P_VDEC2_DBLK_CB_FILT DOS_REG_ADDR(VDEC2_DBLK_CB_FILT) --#define VDEC2_DBLK_CR_FILT 0x2960 --#define P_VDEC2_DBLK_CR_FILT DOS_REG_ADDR(VDEC2_DBLK_CR_FILT) --#define VDEC2_DBLK_STATUS1 0x296b --#define P_VDEC2_DBLK_STATUS1 DOS_REG_ADDR(VDEC2_DBLK_STATUS1) --#define VDEC2_DBLK_GCLK_FREE 0x296c --#define P_VDEC2_DBLK_GCLK_FREE DOS_REG_ADDR(VDEC2_DBLK_GCLK_FREE) --#define VDEC2_DBLK_GCLK_OFF 0x296d --#define P_VDEC2_DBLK_GCLK_OFF DOS_REG_ADDR(VDEC2_DBLK_GCLK_OFF) --#define VDEC2_DBLK_AVSFLAGS 0x296e --#define P_VDEC2_DBLK_AVSFLAGS DOS_REG_ADDR(VDEC2_DBLK_AVSFLAGS) --#define VDEC2_DBLK_CBPY 0x2970 --#define P_VDEC2_DBLK_CBPY DOS_REG_ADDR(VDEC2_DBLK_CBPY) --#define VDEC2_DBLK_CBPY_ADJ 0x2971 --#define P_VDEC2_DBLK_CBPY_ADJ DOS_REG_ADDR(VDEC2_DBLK_CBPY_ADJ) --#define VDEC2_DBLK_CBPC 0x2972 --#define P_VDEC2_DBLK_CBPC DOS_REG_ADDR(VDEC2_DBLK_CBPC) --#define VDEC2_DBLK_CBPC_ADJ 0x2973 --#define P_VDEC2_DBLK_CBPC_ADJ DOS_REG_ADDR(VDEC2_DBLK_CBPC_ADJ) --#define VDEC2_DBLK_VHMVD 0x2974 --#define P_VDEC2_DBLK_VHMVD DOS_REG_ADDR(VDEC2_DBLK_VHMVD) --#define VDEC2_DBLK_STRONG 0x2975 --#define P_VDEC2_DBLK_STRONG DOS_REG_ADDR(VDEC2_DBLK_STRONG) --#define VDEC2_DBLK_RV8_QUANT 0x2976 --#define P_VDEC2_DBLK_RV8_QUANT DOS_REG_ADDR(VDEC2_DBLK_RV8_QUANT) --#define VDEC2_DBLK_CBUS_HCMD2 0x2977 --#define VDEC2_DBLK_VLD_HCMD2 0x297a --#define P_VDEC2_DBLK_VLD_HCMD2 DOS_REG_ADDR(VDEC2_DBLK_VLD_HCMD2) --#define VDEC2_DBLK_VLD_HCMD1 0x297b --#define P_VDEC2_DBLK_VLD_HCMD1 DOS_REG_ADDR(VDEC2_DBLK_VLD_HCMD1) --#define VDEC2_DBLK_VLD_HCMD0 0x297c --#define P_VDEC2_DBLK_VLD_HCMD0 DOS_REG_ADDR(VDEC2_DBLK_VLD_HCMD0) --#define VDEC2_MCRCC_CTL1 0x2980 --#define P_VDEC2_MCRCC_CTL1 DOS_REG_ADDR(VDEC2_MCRCC_CTL1) --#define VDEC2_MCRCC_CTL2 0x2981 --#define P_VDEC2_MCRCC_CTL2 DOS_REG_ADDR(VDEC2_MCRCC_CTL2) --#define VDEC2_MCRCC_CTL3 0x2982 --#define P_VDEC2_MCRCC_CTL3 DOS_REG_ADDR(VDEC2_MCRCC_CTL3) --#define VDEC2_GCLK_EN 0x2983 --#define P_VDEC2_GCLK_EN DOS_REG_ADDR(VDEC2_GCLK_EN) --#define VDEC2_MDEC_SW_RESET 0x2984 --#define P_VDEC2_MDEC_SW_RESET DOS_REG_ADDR(VDEC2_MDEC_SW_RESET) --/*add from M8M2*/ --#define HEVC_MC_CTRL_REG 0x3900 --#define P_HEVC_MC_CTRL_REG DOS_REG_ADDR(HEVC_MC_CTRL_REG) --#define HEVC_MC_MB_INFO 0x3901 --#define P_HEVC_MC_MB_INFO DOS_REG_ADDR(HEVC_MC_MB_INFO) --#define HEVC_MC_PIC_INFO 0x3902 --#define P_HEVC_MC_PIC_INFO DOS_REG_ADDR(HEVC_MC_PIC_INFO) --#define HEVC_MC_HALF_PEL_ONE 0x3903 --#define P_HEVC_MC_HALF_PEL_ONE DOS_REG_ADDR(HEVC_MC_HALF_PEL_ONE) --#define HEVC_MC_HALF_PEL_TWO 0x3904 --#define P_HEVC_MC_HALF_PEL_TWO DOS_REG_ADDR(HEVC_MC_HALF_PEL_TWO) --#define HEVC_POWER_CTL_MC 0x3905 --#define P_HEVC_POWER_CTL_MC DOS_REG_ADDR(HEVC_POWER_CTL_MC) --#define HEVC_MC_CMD 0x3906 --#define P_HEVC_MC_CMD DOS_REG_ADDR(HEVC_MC_CMD) --#define HEVC_MC_CTRL0 0x3907 --#define P_HEVC_MC_CTRL0 DOS_REG_ADDR(HEVC_MC_CTRL0) --#define HEVC_MC_PIC_W_H 0x3908 --#define P_HEVC_MC_PIC_W_H DOS_REG_ADDR(HEVC_MC_PIC_W_H) --#define HEVC_MC_STATUS0 0x3909 --#define P_HEVC_MC_STATUS0 DOS_REG_ADDR(HEVC_MC_STATUS0) --#define HEVC_MC_STATUS1 0x390a --#define P_HEVC_MC_STATUS1 DOS_REG_ADDR(HEVC_MC_STATUS1) --#define HEVC_MC_CTRL1 0x390b --#define P_HEVC_MC_CTRL1 DOS_REG_ADDR(HEVC_MC_CTRL1) --#define HEVC_MC_MIX_RATIO0 0x390c --#define P_HEVC_MC_MIX_RATIO0 DOS_REG_ADDR(HEVC_MC_MIX_RATIO0) --#define HEVC_MC_MIX_RATIO1 0x390d --#define P_HEVC_MC_MIX_RATIO1 DOS_REG_ADDR(HEVC_MC_MIX_RATIO1) --#define HEVC_MC_DP_MB_XY 0x390e --#define P_HEVC_MC_DP_MB_XY DOS_REG_ADDR(HEVC_MC_DP_MB_XY) --#define HEVC_MC_OM_MB_XY 0x390f --#define P_HEVC_MC_OM_MB_XY DOS_REG_ADDR(HEVC_MC_OM_MB_XY) --#define HEVC_PSCALE_RST 0x3910 --#define P_HEVC_PSCALE_RST DOS_REG_ADDR(HEVC_PSCALE_RST) --#define HEVC_PSCALE_CTRL 0x3911 --#define P_HEVC_PSCALE_CTRL DOS_REG_ADDR(HEVC_PSCALE_CTRL) --#define HEVC_PSCALE_PICI_W 0x3912 --#define P_HEVC_PSCALE_PICI_W DOS_REG_ADDR(HEVC_PSCALE_PICI_W) --#define HEVC_PSCALE_PICI_H 0x3913 --#define P_HEVC_PSCALE_PICI_H DOS_REG_ADDR(HEVC_PSCALE_PICI_H) --#define HEVC_PSCALE_PICO_W 0x3914 --#define P_HEVC_PSCALE_PICO_W DOS_REG_ADDR(HEVC_PSCALE_PICO_W) --#define HEVC_PSCALE_PICO_H 0x3915 --#define P_HEVC_PSCALE_PICO_H DOS_REG_ADDR(HEVC_PSCALE_PICO_H) -- --#define HEVC_MC_DPDN_MB_XY 0x3946 --#define P_HEVC_MC_DPDN_MB_XY DOS_REG_ADDR(HEVC_MC_DPDN_MB_XY) --#define HEVC_MC_OMDN_MB_XY 0x3947 --#define P_HEVC_MC_OMDN_MB_XY DOS_REG_ADDR(HEVC_MC_OMDN_MB_XY) --#define HEVC_MC_HCMDBUF_H 0x3948 --#define P_HEVC_MC_HCMDBUF_H DOS_REG_ADDR(HEVC_MC_HCMDBUF_H) --#define HEVC_MC_HCMDBUF_L 0x3949 --#define P_HEVC_MC_HCMDBUF_L DOS_REG_ADDR(HEVC_MC_HCMDBUF_L) --#define HEVC_MC_HCMD_H 0x394a --#define P_HEVC_MC_HCMD_H DOS_REG_ADDR(HEVC_MC_HCMD_H) --#define HEVC_MC_HCMD_L 0x394b --#define P_HEVC_MC_HCMD_L DOS_REG_ADDR(HEVC_MC_HCMD_L) --#define HEVC_MC_IDCT_DAT 0x394c --#define P_HEVC_MC_IDCT_DAT DOS_REG_ADDR(HEVC_MC_IDCT_DAT) --#define HEVC_MC_OTHER_GCLK_CTRL 0x394e -- --#define HEVC_AV_SCRATCH_0 0x39c0 --#define P_HEVC_AV_SCRATCH_0 DOS_REG_ADDR(HEVC_AV_SCRATCH_0) --#define HEVC_AV_SCRATCH_1 0x39c1 --#define P_HEVC_AV_SCRATCH_1 DOS_REG_ADDR(HEVC_AV_SCRATCH_1) --#define HEVC_AV_SCRATCH_2 0x39c2 --#define P_HEVC_AV_SCRATCH_2 DOS_REG_ADDR(HEVC_AV_SCRATCH_2) --#define HEVC_AV_SCRATCH_3 0x39c3 --#define P_HEVC_AV_SCRATCH_3 DOS_REG_ADDR(HEVC_AV_SCRATCH_3) --#define HEVC_AV_SCRATCH_4 0x39c4 --#define P_HEVC_AV_SCRATCH_4 DOS_REG_ADDR(HEVC_AV_SCRATCH_4) --#define HEVC_AV_SCRATCH_5 0x39c5 --#define P_HEVC_AV_SCRATCH_5 DOS_REG_ADDR(HEVC_AV_SCRATCH_5) --#define HEVC_AV_SCRATCH_6 0x39c6 --#define P_HEVC_AV_SCRATCH_6 DOS_REG_ADDR(HEVC_AV_SCRATCH_6) --#define HEVC_AV_SCRATCH_7 0x39c7 --#define P_HEVC_AV_SCRATCH_7 DOS_REG_ADDR(HEVC_AV_SCRATCH_7) --#define HEVC_AV_SCRATCH_8 0x39c8 --#define P_HEVC_AV_SCRATCH_8 DOS_REG_ADDR(HEVC_AV_SCRATCH_8) --#define HEVC_AV_SCRATCH_9 0x39c9 --#define P_HEVC_AV_SCRATCH_9 DOS_REG_ADDR(HEVC_AV_SCRATCH_9) --#define HEVC_AV_SCRATCH_A 0x39ca --#define P_HEVC_AV_SCRATCH_A DOS_REG_ADDR(HEVC_AV_SCRATCH_A) --#define HEVC_AV_SCRATCH_B 0x39cb --#define P_HEVC_AV_SCRATCH_B DOS_REG_ADDR(HEVC_AV_SCRATCH_B) --#define HEVC_AV_SCRATCH_C 0x39cc --#define P_HEVC_AV_SCRATCH_C DOS_REG_ADDR(HEVC_AV_SCRATCH_C) --#define HEVC_AV_SCRATCH_D 0x39cd --#define P_HEVC_AV_SCRATCH_D DOS_REG_ADDR(HEVC_AV_SCRATCH_D) --#define HEVC_AV_SCRATCH_E 0x39ce --#define P_HEVC_AV_SCRATCH_E DOS_REG_ADDR(HEVC_AV_SCRATCH_E) --#define HEVC_AV_SCRATCH_F 0x39cf --#define P_HEVC_AV_SCRATCH_F DOS_REG_ADDR(HEVC_AV_SCRATCH_F) --#define HEVC_AV_SCRATCH_G 0x39d0 --#define P_HEVC_AV_SCRATCH_G DOS_REG_ADDR(HEVC_AV_SCRATCH_G) --#define HEVC_AV_SCRATCH_H 0x39d1 --#define P_HEVC_AV_SCRATCH_H DOS_REG_ADDR(HEVC_AV_SCRATCH_H) --#define HEVC_AV_SCRATCH_I 0x39d2 --#define P_HEVC_AV_SCRATCH_I DOS_REG_ADDR(HEVC_AV_SCRATCH_I) --#define HEVC_AV_SCRATCH_J 0x39d3 --#define P_HEVC_AV_SCRATCH_J DOS_REG_ADDR(HEVC_AV_SCRATCH_J) --#define HEVC_AV_SCRATCH_K 0x39d4 --#define P_HEVC_AV_SCRATCH_K DOS_REG_ADDR(HEVC_AV_SCRATCH_K) --#define HEVC_AV_SCRATCH_L 0x39d5 --#define P_HEVC_AV_SCRATCH_L DOS_REG_ADDR(HEVC_AV_SCRATCH_L) --#define HEVC_AV_SCRATCH_M 0x39d6 --#define P_HEVC_AV_SCRATCH_M DOS_REG_ADDR(HEVC_AV_SCRATCH_M) --#define HEVC_AV_SCRATCH_N 0x39d7 --#define P_HEVC_AV_SCRATCH_N DOS_REG_ADDR(HEVC_AV_SCRATCH_N) --#define HEVC_WRRSP_CO_MB 0x39d8 --#define P_HEVC_WRRSP_CO_MB DOS_REG_ADDR(HEVC_WRRSP_CO_MB) -- --#define HEVC_DBLK_RST 0x3950 --#define P_HEVC_DBLK_RST DOS_REG_ADDR(HEVC_DBLK_RST) --#define HEVC_DBLK_CTRL 0x3951 --#define P_HEVC_DBLK_CTRL DOS_REG_ADDR(HEVC_DBLK_CTRL) --#define HEVC_DBLK_MB_WID_HEIGHT 0x3952 --#define HEVC_DBLK_STATUS 0x3953 --#define P_HEVC_DBLK_STATUS DOS_REG_ADDR(HEVC_DBLK_STATUS) --#define HEVC_DBLK_CMD_CTRL 0x3954 --#define P_HEVC_DBLK_CMD_CTRL DOS_REG_ADDR(HEVC_DBLK_CMD_CTRL) --#define HEVC_DBLK_MB_XY 0x3955 --#define P_HEVC_DBLK_MB_XY DOS_REG_ADDR(HEVC_DBLK_MB_XY) --#define HEVC_DBLK_QP 0x3956 --#define P_HEVC_DBLK_QP DOS_REG_ADDR(HEVC_DBLK_QP) --#define HEVC_DBLK_Y_BHFILT 0x3957 --#define P_HEVC_DBLK_Y_BHFILT DOS_REG_ADDR(HEVC_DBLK_Y_BHFILT) --#define HEVC_DBLK_Y_BVFILT 0x3959 --#define P_HEVC_DBLK_Y_BVFILT DOS_REG_ADDR(HEVC_DBLK_Y_BVFILT) --#define HEVC_DBLK_CB_BFILT 0x395a --#define P_HEVC_DBLK_CB_BFILT DOS_REG_ADDR(HEVC_DBLK_CB_BFILT) --#define HEVC_DBLK_CR_BFILT 0x395b --#define P_HEVC_DBLK_CR_BFILT DOS_REG_ADDR(HEVC_DBLK_CR_BFILT) --#define HEVC_DBLK_Y_HFILT 0x395c --#define P_HEVC_DBLK_Y_HFILT DOS_REG_ADDR(HEVC_DBLK_Y_HFILT) --#define HEVC_DBLK_Y_VFILT 0x395e --#define P_HEVC_DBLK_Y_VFILT DOS_REG_ADDR(HEVC_DBLK_Y_VFILT) --#define HEVC_DBLK_CB_FILT 0x395f --#define P_HEVC_DBLK_CB_FILT DOS_REG_ADDR(HEVC_DBLK_CB_FILT) --#define HEVC_DBLK_CR_FILT 0x3960 --#define P_HEVC_DBLK_CR_FILT DOS_REG_ADDR(HEVC_DBLK_CR_FILT) --#define HEVC_DBLK_CLIP_CTRL0 0x3962 --#define P_HEVC_DBLK_CLIP_CTRL0 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL0) --#define HEVC_DBLK_CLIP_CTRL1 0x3963 --#define P_HEVC_DBLK_CLIP_CTRL1 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL1) --#define HEVC_DBLK_CLIP_CTRL2 0x3964 --#define P_HEVC_DBLK_CLIP_CTRL2 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL2) --#define HEVC_DBLK_CLIP_CTRL3 0x3965 --#define P_HEVC_DBLK_CLIP_CTRL3 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL3) --#define HEVC_DBLK_CLIP_CTRL4 0x3966 --#define P_HEVC_DBLK_CLIP_CTRL4 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL4) --#define HEVC_DBLK_CLIP_CTRL5 0x3967 --#define P_HEVC_DBLK_CLIP_CTRL5 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL5) --#define HEVC_DBLK_CLIP_CTRL6 0x3968 --#define P_HEVC_DBLK_CLIP_CTRL6 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL6) --#define HEVC_DBLK_CLIP_CTRL7 0x3969 --#define P_HEVC_DBLK_CLIP_CTRL7 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL7) --#define HEVC_DBLK_CLIP_CTRL8 0x396a --#define P_HEVC_DBLK_CLIP_CTRL8 DOS_REG_ADDR(HEVC_DBLK_CLIP_CTRL8) --#define HEVC_DBLK_STATUS1 0x396b --#define P_HEVC_DBLK_STATUS1 DOS_REG_ADDR(HEVC_DBLK_STATUS1) --#define HEVC_DBLK_GCLK_FREE 0x396c --#define P_HEVC_DBLK_GCLK_FREE DOS_REG_ADDR(HEVC_DBLK_GCLK_FREE) --#define HEVC_DBLK_GCLK_OFF 0x396d --#define P_HEVC_DBLK_GCLK_OFF DOS_REG_ADDR(HEVC_DBLK_GCLK_OFF) --#define HEVC_DBLK_AVSFLAGS 0x396e --#define P_HEVC_DBLK_AVSFLAGS DOS_REG_ADDR(HEVC_DBLK_AVSFLAGS) --#define HEVC_DBLK_CBPY 0x3970 --#define P_HEVC_DBLK_CBPY DOS_REG_ADDR(HEVC_DBLK_CBPY) --#define HEVC_DBLK_CBPY_ADJ 0x3971 --#define P_HEVC_DBLK_CBPY_ADJ DOS_REG_ADDR(HEVC_DBLK_CBPY_ADJ) --#define HEVC_DBLK_CBPC 0x3972 --#define P_HEVC_DBLK_CBPC DOS_REG_ADDR(HEVC_DBLK_CBPC) --#define HEVC_DBLK_CBPC_ADJ 0x3973 --#define P_HEVC_DBLK_CBPC_ADJ DOS_REG_ADDR(HEVC_DBLK_CBPC_ADJ) --#define HEVC_DBLK_VHMVD 0x3974 --#define P_HEVC_DBLK_VHMVD DOS_REG_ADDR(HEVC_DBLK_VHMVD) --#define HEVC_DBLK_STRONG 0x3975 --#define P_HEVC_DBLK_STRONG DOS_REG_ADDR(HEVC_DBLK_STRONG) --#define HEVC_DBLK_RV8_QUANT 0x3976 --#define P_HEVC_DBLK_RV8_QUANT DOS_REG_ADDR(HEVC_DBLK_RV8_QUANT) --#define HEVC_DBLK_CBUS_HCMD2 0x3977 --#define P_HEVC_DBLK_CBUS_HCMD2 DOS_REG_ADDR(HEVC_DBLK_CBUS_HCMD2) --#define HEVC_DBLK_CBUS_HCMD1 0x3978 --#define P_HEVC_DBLK_CBUS_HCMD1 DOS_REG_ADDR(HEVC_DBLK_CBUS_HCMD1) --#define HEVC_DBLK_CBUS_HCMD0 0x3979 --#define P_HEVC_DBLK_CBUS_HCMD0 DOS_REG_ADDR(HEVC_DBLK_CBUS_HCMD0) --#define HEVC_DBLK_VLD_HCMD2 0x397a --#define P_HEVC_DBLK_VLD_HCMD2 DOS_REG_ADDR(HEVC_DBLK_VLD_HCMD2) --#define HEVC_DBLK_VLD_HCMD1 0x397b --#define P_HEVC_DBLK_VLD_HCMD1 DOS_REG_ADDR(HEVC_DBLK_VLD_HCMD1) --#define HEVC_DBLK_VLD_HCMD0 0x397c --#define P_HEVC_DBLK_VLD_HCMD0 DOS_REG_ADDR(HEVC_DBLK_VLD_HCMD0) --#define HEVC_DBLK_OST_YBASE 0x397d --#define P_HEVC_DBLK_OST_YBASE DOS_REG_ADDR(HEVC_DBLK_OST_YBASE) --#define HEVC_DBLK_CTRL1 0x397f --#define P_HEVC_DBLK_CTRL1 DOS_REG_ADDR(HEVC_DBLK_CTRL1) --#define HEVC_MCRCC_CTL1 0x3980 --#define P_HEVC_MCRCC_CTL1 DOS_REG_ADDR(HEVC_MCRCC_CTL1) --#define HEVC_MCRCC_CTL2 0x3981 --#define P_HEVC_MCRCC_CTL2 DOS_REG_ADDR(HEVC_MCRCC_CTL2) --#define HEVC_MCRCC_CTL3 0x3982 --#define P_HEVC_MCRCC_CTL3 DOS_REG_ADDR(HEVC_MCRCC_CTL3) --#define HEVC_GCLK_EN 0x3983 --#define P_HEVC_GCLK_EN DOS_REG_ADDR(HEVC_GCLK_EN) --#define HEVC_MDEC_SW_RESET 0x3984 --#define P_HEVC_MDEC_SW_RESET DOS_REG_ADDR(HEVC_MDEC_SW_RESET) --/**/ --#define HEVC_DCAC_CPU_DATA 0x3e15 --#define P_HEVC_DCAC_CPU_DATA DOS_REG_ADDR(HEVC_DCAC_CPU_DATA) --#define HEVC_DCAC_MB_COUNT 0x3e16 --#define P_HEVC_DCAC_MB_COUNT DOS_REG_ADDR(HEVC_DCAC_MB_COUNT) --#define HEVC_IQ_QUANT 0x3e17 --#define P_HEVC_IQ_QUANT DOS_REG_ADDR(HEVC_IQ_QUANT) --/**/ --#define HCODEC_MSP 0x1300 --#define P_HCODEC_MSP DOS_REG_ADDR(HCODEC_MSP) --#define HCODEC_MPSR 0x1301 --#define P_HCODEC_MPSR DOS_REG_ADDR(HCODEC_MPSR) --#define HCODEC_MINT_VEC_BASE 0x1302 --#define P_HCODEC_MINT_VEC_BASE DOS_REG_ADDR(HCODEC_MINT_VEC_BASE) --#define HCODEC_MCPU_INTR_GRP 0x1303 --#define P_HCODEC_MCPU_INTR_GRP DOS_REG_ADDR(HCODEC_MCPU_INTR_GRP) --#define HCODEC_MCPU_INTR_MSK 0x1304 --#define P_HCODEC_MCPU_INTR_MSK DOS_REG_ADDR(HCODEC_MCPU_INTR_MSK) --#define HCODEC_MCPU_INTR_REQ 0x1305 --#define P_HCODEC_MCPU_INTR_REQ DOS_REG_ADDR(HCODEC_MCPU_INTR_REQ) --#define HCODEC_MPC_P 0x1306 --#define P_HCODEC_MPC_P DOS_REG_ADDR(HCODEC_MPC_P) --#define HCODEC_MPC_D 0x1307 --#define P_HCODEC_MPC_D DOS_REG_ADDR(HCODEC_MPC_D) --#define HCODEC_MPC_E 0x1308 --#define P_HCODEC_MPC_E DOS_REG_ADDR(HCODEC_MPC_E) --#define HCODEC_MPC_W 0x1309 --#define P_HCODEC_MPC_W DOS_REG_ADDR(HCODEC_MPC_W) --#define HCODEC_MINDEX0_REG 0x130a --#define P_HCODEC_MINDEX0_REG DOS_REG_ADDR(HCODEC_MINDEX0_REG) --#define HCODEC_MINDEX1_REG 0x130b --#define P_HCODEC_MINDEX1_REG DOS_REG_ADDR(HCODEC_MINDEX1_REG) --#define HCODEC_MINDEX2_REG 0x130c --#define P_HCODEC_MINDEX2_REG DOS_REG_ADDR(HCODEC_MINDEX2_REG) --#define HCODEC_MINDEX3_REG 0x130d --#define P_HCODEC_MINDEX3_REG DOS_REG_ADDR(HCODEC_MINDEX3_REG) --#define HCODEC_MINDEX4_REG 0x130e --#define P_HCODEC_MINDEX4_REG DOS_REG_ADDR(HCODEC_MINDEX4_REG) --#define HCODEC_MINDEX5_REG 0x130f --#define P_HCODEC_MINDEX5_REG DOS_REG_ADDR(HCODEC_MINDEX5_REG) --#define HCODEC_MINDEX6_REG 0x1310 --#define P_HCODEC_MINDEX6_REG DOS_REG_ADDR(HCODEC_MINDEX6_REG) --#define HCODEC_MINDEX7_REG 0x1311 --#define P_HCODEC_MINDEX7_REG DOS_REG_ADDR(HCODEC_MINDEX7_REG) --#define HCODEC_MMIN_REG 0x1312 --#define P_HCODEC_MMIN_REG DOS_REG_ADDR(HCODEC_MMIN_REG) --#define HCODEC_MMAX_REG 0x1313 --#define P_HCODEC_MMAX_REG DOS_REG_ADDR(HCODEC_MMAX_REG) --#define HCODEC_MBREAK0_REG 0x1314 --#define P_HCODEC_MBREAK0_REG DOS_REG_ADDR(HCODEC_MBREAK0_REG) --#define HCODEC_MBREAK1_REG 0x1315 --#define P_HCODEC_MBREAK1_REG DOS_REG_ADDR(HCODEC_MBREAK1_REG) --#define HCODEC_MBREAK2_REG 0x1316 --#define P_HCODEC_MBREAK2_REG DOS_REG_ADDR(HCODEC_MBREAK2_REG) --#define HCODEC_MBREAK3_REG 0x1317 --#define P_HCODEC_MBREAK3_REG DOS_REG_ADDR(HCODEC_MBREAK3_REG) --#define HCODEC_MBREAK_TYPE 0x1318 --#define P_HCODEC_MBREAK_TYPE DOS_REG_ADDR(HCODEC_MBREAK_TYPE) --#define HCODEC_MBREAK_CTRL 0x1319 --#define P_HCODEC_MBREAK_CTRL DOS_REG_ADDR(HCODEC_MBREAK_CTRL) --#define HCODEC_MBREAK_STAUTS 0x131a --#define P_HCODEC_MBREAK_STAUTS DOS_REG_ADDR(HCODEC_MBREAK_STAUTS) --#define HCODEC_MDB_ADDR_REG 0x131b --#define P_HCODEC_MDB_ADDR_REG DOS_REG_ADDR(HCODEC_MDB_ADDR_REG) --#define HCODEC_MDB_DATA_REG 0x131c --#define P_HCODEC_MDB_DATA_REG DOS_REG_ADDR(HCODEC_MDB_DATA_REG) --#define HCODEC_MDB_CTRL 0x131d --#define P_HCODEC_MDB_CTRL DOS_REG_ADDR(HCODEC_MDB_CTRL) --#define HCODEC_MSFTINT0 0x131e --#define P_HCODEC_MSFTINT0 DOS_REG_ADDR(HCODEC_MSFTINT0) --#define HCODEC_MSFTINT1 0x131f --#define P_HCODEC_MSFTINT1 DOS_REG_ADDR(HCODEC_MSFTINT1) --#define HCODEC_CSP 0x1320 --#define P_HCODEC_CSP DOS_REG_ADDR(HCODEC_CSP) --#define HCODEC_CPSR 0x1321 --#define P_HCODEC_CPSR DOS_REG_ADDR(HCODEC_CPSR) --#define HCODEC_CINT_VEC_BASE 0x1322 --#define P_HCODEC_CINT_VEC_BASE DOS_REG_ADDR(HCODEC_CINT_VEC_BASE) --#define HCODEC_CCPU_INTR_GRP 0x1323 --#define P_HCODEC_CCPU_INTR_GRP DOS_REG_ADDR(HCODEC_CCPU_INTR_GRP) --#define HCODEC_CCPU_INTR_MSK 0x1324 --#define P_HCODEC_CCPU_INTR_MSK DOS_REG_ADDR(HCODEC_CCPU_INTR_MSK) --#define HCODEC_CCPU_INTR_REQ 0x1325 --#define P_HCODEC_CCPU_INTR_REQ DOS_REG_ADDR(HCODEC_CCPU_INTR_REQ) --#define HCODEC_CPC_P 0x1326 --#define P_HCODEC_CPC_P DOS_REG_ADDR(HCODEC_CPC_P) --#define HCODEC_CPC_D 0x1327 --#define P_HCODEC_CPC_D DOS_REG_ADDR(HCODEC_CPC_D) --#define HCODEC_CPC_E 0x1328 --#define P_HCODEC_CPC_E DOS_REG_ADDR(HCODEC_CPC_E) --#define HCODEC_CPC_W 0x1329 --#define P_HCODEC_CPC_W DOS_REG_ADDR(HCODEC_CPC_W) --#define HCODEC_CINDEX0_REG 0x132a --#define P_HCODEC_CINDEX0_REG DOS_REG_ADDR(HCODEC_CINDEX0_REG) --#define HCODEC_CINDEX1_REG 0x132b --#define P_HCODEC_CINDEX1_REG DOS_REG_ADDR(HCODEC_CINDEX1_REG) --#define HCODEC_CINDEX2_REG 0x132c --#define P_HCODEC_CINDEX2_REG DOS_REG_ADDR(HCODEC_CINDEX2_REG) --#define HCODEC_CINDEX3_REG 0x132d --#define P_HCODEC_CINDEX3_REG DOS_REG_ADDR(HCODEC_CINDEX3_REG) --#define HCODEC_CINDEX4_REG 0x132e --#define P_HCODEC_CINDEX4_REG DOS_REG_ADDR(HCODEC_CINDEX4_REG) --#define HCODEC_CINDEX5_REG 0x132f --#define P_HCODEC_CINDEX5_REG DOS_REG_ADDR(HCODEC_CINDEX5_REG) --#define HCODEC_CINDEX6_REG 0x1330 --#define P_HCODEC_CINDEX6_REG DOS_REG_ADDR(HCODEC_CINDEX6_REG) --#define HCODEC_CINDEX7_REG 0x1331 --#define P_HCODEC_CINDEX7_REG DOS_REG_ADDR(HCODEC_CINDEX7_REG) --#define HCODEC_CMIN_REG 0x1332 --#define P_HCODEC_CMIN_REG DOS_REG_ADDR(HCODEC_CMIN_REG) --#define HCODEC_CMAX_REG 0x1333 --#define P_HCODEC_CMAX_REG DOS_REG_ADDR(HCODEC_CMAX_REG) --#define HCODEC_CBREAK0_REG 0x1334 --#define P_HCODEC_CBREAK0_REG DOS_REG_ADDR(HCODEC_CBREAK0_REG) --#define HCODEC_CBREAK1_REG 0x1335 --#define P_HCODEC_CBREAK1_REG DOS_REG_ADDR(HCODEC_CBREAK1_REG) --#define HCODEC_CBREAK2_REG 0x1336 --#define P_HCODEC_CBREAK2_REG DOS_REG_ADDR(HCODEC_CBREAK2_REG) --#define HCODEC_CBREAK3_REG 0x1337 --#define P_HCODEC_CBREAK3_REG DOS_REG_ADDR(HCODEC_CBREAK3_REG) --#define HCODEC_CBREAK_TYPE 0x1338 --#define P_HCODEC_CBREAK_TYPE DOS_REG_ADDR(HCODEC_CBREAK_TYPE) --#define HCODEC_CBREAK_CTRL 0x1339 --#define P_HCODEC_CBREAK_CTRL DOS_REG_ADDR(HCODEC_CBREAK_CTRL) --#define HCODEC_CBREAK_STAUTS 0x133a --#define P_HCODEC_CBREAK_STAUTS DOS_REG_ADDR(HCODEC_CBREAK_STAUTS) --#define HCODEC_CDB_ADDR_REG 0x133b --#define P_HCODEC_CDB_ADDR_REG DOS_REG_ADDR(HCODEC_CDB_ADDR_REG) --#define HCODEC_CDB_DATA_REG 0x133c --#define P_HCODEC_CDB_DATA_REG DOS_REG_ADDR(HCODEC_CDB_DATA_REG) --#define HCODEC_CDB_CTRL 0x133d --#define P_HCODEC_CDB_CTRL DOS_REG_ADDR(HCODEC_CDB_CTRL) --#define HCODEC_CSFTINT0 0x133e --#define P_HCODEC_CSFTINT0 DOS_REG_ADDR(HCODEC_CSFTINT0) --#define HCODEC_CSFTINT1 0x133f --#define P_HCODEC_CSFTINT1 DOS_REG_ADDR(HCODEC_CSFTINT1) --#define HCODEC_IMEM_DMA_CTRL 0x1340 --#define P_HCODEC_IMEM_DMA_CTRL DOS_REG_ADDR(HCODEC_IMEM_DMA_CTRL) --#define HCODEC_IMEM_DMA_ADR 0x1341 --#define P_HCODEC_IMEM_DMA_ADR DOS_REG_ADDR(HCODEC_IMEM_DMA_ADR) --#define HCODEC_WRRSP_IMEM 0x1343 --#define P_HCODEC_WRRSP_IMEM DOS_REG_ADDR(HCODEC_WRRSP_IMEM) --#define HCODEC_LMEM_DMA_CTRL 0x1350 --#define P_HCODEC_LMEM_DMA_CTRL DOS_REG_ADDR(HCODEC_LMEM_DMA_CTRL) --#define HCODEC_LMEM_DMA_ADR 0x1351 --#define P_HCODEC_LMEM_DMA_ADR DOS_REG_ADDR(HCODEC_LMEM_DMA_ADR) --#define HCODEC_WRRSP_LMEM 0x1353 --#define P_HCODEC_WRRSP_LMEM DOS_REG_ADDR(HCODEC_WRRSP_LMEM) --#define HCODEC_MAC_CTRL1 0x1360 --#define P_HCODEC_MAC_CTRL1 DOS_REG_ADDR(HCODEC_MAC_CTRL1) --#define HCODEC_ACC0REG1 0x1361 --#define P_HCODEC_ACC0REG1 DOS_REG_ADDR(HCODEC_ACC0REG1) --#define HCODEC_ACC1REG1 0x1362 --#define P_HCODEC_ACC1REG1 DOS_REG_ADDR(HCODEC_ACC1REG1) --#define HCODEC_MAC_CTRL2 0x1370 --#define P_HCODEC_MAC_CTRL2 DOS_REG_ADDR(HCODEC_MAC_CTRL2) --#define HCODEC_ACC0REG2 0x1371 --#define P_HCODEC_ACC0REG2 DOS_REG_ADDR(HCODEC_ACC0REG2) --#define HCODEC_ACC1REG2 0x1372 --#define P_HCODEC_ACC1REG2 DOS_REG_ADDR(HCODEC_ACC1REG2) --#define HCODEC_CPU_TRACE 0x1380 --#define P_HCODEC_CPU_TRACE DOS_REG_ADDR(HCODEC_CPU_TRACE) --#define VDEC2_MSP 0x2300 --#define P_VDEC2_MSP DOS_REG_ADDR(VDEC2_MSP) --#define VDEC2_MPSR 0x2301 --#define P_VDEC2_MPSR DOS_REG_ADDR(VDEC2_MPSR) --#define VDEC2_MINT_VEC_BASE 0x2302 --#define P_VDEC2_MINT_VEC_BASE DOS_REG_ADDR(VDEC2_MINT_VEC_BASE) --#define VDEC2_MCPU_INTR_GRP 0x2303 --#define P_VDEC2_MCPU_INTR_GRP DOS_REG_ADDR(VDEC2_MCPU_INTR_GRP) --#define VDEC2_MCPU_INTR_MSK 0x2304 --#define P_VDEC2_MCPU_INTR_MSK DOS_REG_ADDR(VDEC2_MCPU_INTR_MSK) --#define VDEC2_MCPU_INTR_REQ 0x2305 --#define P_VDEC2_MCPU_INTR_REQ DOS_REG_ADDR(VDEC2_MCPU_INTR_REQ) --#define VDEC2_MPC_P 0x2306 --#define P_VDEC2_MPC_P DOS_REG_ADDR(VDEC2_MPC_P) --#define VDEC2_MPC_D 0x2307 --#define P_VDEC2_MPC_D DOS_REG_ADDR(VDEC2_MPC_D) --#define VDEC2_MPC_E 0x2308 --#define P_VDEC2_MPC_E DOS_REG_ADDR(VDEC2_MPC_E) --#define VDEC2_MPC_W 0x2309 --#define P_VDEC2_MPC_W DOS_REG_ADDR(VDEC2_MPC_W) --#define VDEC2_MINDEX0_REG 0x230a --#define P_VDEC2_MINDEX0_REG DOS_REG_ADDR(VDEC2_MINDEX0_REG) --#define VDEC2_MINDEX1_REG 0x230b --#define P_VDEC2_MINDEX1_REG DOS_REG_ADDR(VDEC2_MINDEX1_REG) --#define VDEC2_MINDEX2_REG 0x230c --#define P_VDEC2_MINDEX2_REG DOS_REG_ADDR(VDEC2_MINDEX2_REG) --#define VDEC2_MINDEX3_REG 0x230d --#define P_VDEC2_MINDEX3_REG DOS_REG_ADDR(VDEC2_MINDEX3_REG) --#define VDEC2_MINDEX4_REG 0x230e --#define P_VDEC2_MINDEX4_REG DOS_REG_ADDR(VDEC2_MINDEX4_REG) --#define VDEC2_MINDEX5_REG 0x230f --#define P_VDEC2_MINDEX5_REG DOS_REG_ADDR(VDEC2_MINDEX5_REG) --#define VDEC2_MINDEX6_REG 0x2310 --#define P_VDEC2_MINDEX6_REG DOS_REG_ADDR(VDEC2_MINDEX6_REG) --#define VDEC2_MINDEX7_REG 0x2311 --#define P_VDEC2_MINDEX7_REG DOS_REG_ADDR(VDEC2_MINDEX7_REG) --#define VDEC2_MMIN_REG 0x2312 --#define P_VDEC2_MMIN_REG DOS_REG_ADDR(VDEC2_MMIN_REG) --#define VDEC2_MMAX_REG 0x2313 --#define P_VDEC2_MMAX_REG DOS_REG_ADDR(VDEC2_MMAX_REG) --#define VDEC2_MBREAK0_REG 0x2314 --#define P_VDEC2_MBREAK0_REG DOS_REG_ADDR(VDEC2_MBREAK0_REG) --#define VDEC2_MBREAK1_REG 0x2315 --#define P_VDEC2_MBREAK1_REG DOS_REG_ADDR(VDEC2_MBREAK1_REG) --#define VDEC2_MBREAK2_REG 0x2316 --#define P_VDEC2_MBREAK2_REG DOS_REG_ADDR(VDEC2_MBREAK2_REG) --#define VDEC2_MBREAK3_REG 0x2317 --#define P_VDEC2_MBREAK3_REG DOS_REG_ADDR(VDEC2_MBREAK3_REG) --#define VDEC2_MBREAK_TYPE 0x2318 --#define P_VDEC2_MBREAK_TYPE DOS_REG_ADDR(VDEC2_MBREAK_TYPE) --#define VDEC2_MBREAK_CTRL 0x2319 --#define P_VDEC2_MBREAK_CTRL DOS_REG_ADDR(VDEC2_MBREAK_CTRL) --#define VDEC2_MBREAK_STAUTS 0x231a --#define P_VDEC2_MBREAK_STAUTS DOS_REG_ADDR(VDEC2_MBREAK_STAUTS) --#define VDEC2_MDB_ADDR_REG 0x231b --#define P_VDEC2_MDB_ADDR_REG DOS_REG_ADDR(VDEC2_MDB_ADDR_REG) --#define VDEC2_MDB_DATA_REG 0x231c --#define P_VDEC2_MDB_DATA_REG DOS_REG_ADDR(VDEC2_MDB_DATA_REG) --#define VDEC2_MDB_CTRL 0x231d --#define P_VDEC2_MDB_CTRL DOS_REG_ADDR(VDEC2_MDB_CTRL) --#define VDEC2_MSFTINT0 0x231e --#define P_VDEC2_MSFTINT0 DOS_REG_ADDR(VDEC2_MSFTINT0) --#define VDEC2_MSFTINT1 0x231f --#define P_VDEC2_MSFTINT1 DOS_REG_ADDR(VDEC2_MSFTINT1) --#define VDEC2_CSP 0x2320 --#define P_VDEC2_CSP DOS_REG_ADDR(VDEC2_CSP) --#define VDEC2_CPSR 0x2321 --#define P_VDEC2_CPSR DOS_REG_ADDR(VDEC2_CPSR) --#define VDEC2_CINT_VEC_BASE 0x2322 --#define P_VDEC2_CINT_VEC_BASE DOS_REG_ADDR(VDEC2_CINT_VEC_BASE) --#define VDEC2_CCPU_INTR_GRP 0x2323 --#define P_VDEC2_CCPU_INTR_GRP DOS_REG_ADDR(VDEC2_CCPU_INTR_GRP) --#define VDEC2_CCPU_INTR_MSK 0x2324 --#define P_VDEC2_CCPU_INTR_MSK DOS_REG_ADDR(VDEC2_CCPU_INTR_MSK) --#define VDEC2_CCPU_INTR_REQ 0x2325 --#define P_VDEC2_CCPU_INTR_REQ DOS_REG_ADDR(VDEC2_CCPU_INTR_REQ) --#define VDEC2_CPC_P 0x2326 --#define P_VDEC2_CPC_P DOS_REG_ADDR(VDEC2_CPC_P) --#define VDEC2_CPC_D 0x2327 --#define P_VDEC2_CPC_D DOS_REG_ADDR(VDEC2_CPC_D) --#define VDEC2_CPC_E 0x2328 --#define P_VDEC2_CPC_E DOS_REG_ADDR(VDEC2_CPC_E) --#define VDEC2_CPC_W 0x2329 --#define P_VDEC2_CPC_W DOS_REG_ADDR(VDEC2_CPC_W) --#define VDEC2_CINDEX0_REG 0x232a --#define P_VDEC2_CINDEX0_REG DOS_REG_ADDR(VDEC2_CINDEX0_REG) --#define VDEC2_CINDEX1_REG 0x232b --#define P_VDEC2_CINDEX1_REG DOS_REG_ADDR(VDEC2_CINDEX1_REG) --#define VDEC2_CINDEX2_REG 0x232c --#define P_VDEC2_CINDEX2_REG DOS_REG_ADDR(VDEC2_CINDEX2_REG) --#define VDEC2_CINDEX3_REG 0x232d --#define P_VDEC2_CINDEX3_REG DOS_REG_ADDR(VDEC2_CINDEX3_REG) --#define VDEC2_CINDEX4_REG 0x232e --#define P_VDEC2_CINDEX4_REG DOS_REG_ADDR(VDEC2_CINDEX4_REG) --#define VDEC2_CINDEX5_REG 0x232f --#define P_VDEC2_CINDEX5_REG DOS_REG_ADDR(VDEC2_CINDEX5_REG) --#define VDEC2_CINDEX6_REG 0x2330 --#define P_VDEC2_CINDEX6_REG DOS_REG_ADDR(VDEC2_CINDEX6_REG) --#define VDEC2_CINDEX7_REG 0x2331 --#define P_VDEC2_CINDEX7_REG DOS_REG_ADDR(VDEC2_CINDEX7_REG) --#define VDEC2_CMIN_REG 0x2332 --#define P_VDEC2_CMIN_REG DOS_REG_ADDR(VDEC2_CMIN_REG) --#define VDEC2_CMAX_REG 0x2333 --#define P_VDEC2_CMAX_REG DOS_REG_ADDR(VDEC2_CMAX_REG) --#define VDEC2_CBREAK0_REG 0x2334 --#define P_VDEC2_CBREAK0_REG DOS_REG_ADDR(VDEC2_CBREAK0_REG) --#define VDEC2_CBREAK1_REG 0x2335 --#define P_VDEC2_CBREAK1_REG DOS_REG_ADDR(VDEC2_CBREAK1_REG) --#define VDEC2_CBREAK2_REG 0x2336 --#define P_VDEC2_CBREAK2_REG DOS_REG_ADDR(VDEC2_CBREAK2_REG) --#define VDEC2_CBREAK3_REG 0x2337 --#define P_VDEC2_CBREAK3_REG DOS_REG_ADDR(VDEC2_CBREAK3_REG) --#define VDEC2_CBREAK_TYPE 0x2338 --#define P_VDEC2_CBREAK_TYPE DOS_REG_ADDR(VDEC2_CBREAK_TYPE) --#define VDEC2_CBREAK_CTRL 0x2339 --#define P_VDEC2_CBREAK_CTRL DOS_REG_ADDR(VDEC2_CBREAK_CTRL) --#define VDEC2_CBREAK_STAUTS 0x233a --#define P_VDEC2_CBREAK_STAUTS DOS_REG_ADDR(VDEC2_CBREAK_STAUTS) --#define VDEC2_CDB_ADDR_REG 0x233b --#define P_VDEC2_CDB_ADDR_REG DOS_REG_ADDR(VDEC2_CDB_ADDR_REG) --#define VDEC2_CDB_DATA_REG 0x233c --#define P_VDEC2_CDB_DATA_REG DOS_REG_ADDR(VDEC2_CDB_DATA_REG) --#define VDEC2_CDB_CTRL 0x233d --#define P_VDEC2_CDB_CTRL DOS_REG_ADDR(VDEC2_CDB_CTRL) --#define VDEC2_CSFTINT0 0x233e --#define P_VDEC2_CSFTINT0 DOS_REG_ADDR(VDEC2_CSFTINT0) --#define VDEC2_CSFTINT1 0x233f --#define P_VDEC2_CSFTINT1 DOS_REG_ADDR(VDEC2_CSFTINT1) --#define VDEC2_IMEM_DMA_CTRL 0x2340 --#define P_VDEC2_IMEM_DMA_CTRL DOS_REG_ADDR(VDEC2_IMEM_DMA_CTRL) --#define VDEC2_IMEM_DMA_ADR 0x2341 --#define P_VDEC2_IMEM_DMA_ADR DOS_REG_ADDR(VDEC2_IMEM_DMA_ADR) --#define VDEC2_IMEM_DMA_COUNT 0x2342 --#define P_VDEC2_IMEM_DMA_COUNT DOS_REG_ADDR(VDEC2_IMEM_DMA_COUNT) --#define VDEC2_WRRSP_IMEM 0x2343 --#define P_VDEC2_WRRSP_IMEM DOS_REG_ADDR(VDEC2_WRRSP_IMEM) --#define VDEC2_LMEM_DMA_CTRL 0x2350 --#define P_VDEC2_LMEM_DMA_CTRL DOS_REG_ADDR(VDEC2_LMEM_DMA_CTRL) --#define VDEC2_LMEM_DMA_ADR 0x2351 --#define P_VDEC2_LMEM_DMA_ADR DOS_REG_ADDR(VDEC2_LMEM_DMA_ADR) --#define VDEC2_LMEM_DMA_COUNT 0x2352 --#define P_VDEC2_LMEM_DMA_COUNT DOS_REG_ADDR(VDEC2_LMEM_DMA_COUNT) --#define VDEC2_WRRSP_LMEM 0x2353 --#define P_VDEC2_WRRSP_LMEM DOS_REG_ADDR(VDEC2_WRRSP_LMEM) --#define VDEC2_MAC_CTRL1 0x2360 --#define P_VDEC2_MAC_CTRL1 DOS_REG_ADDR(VDEC2_MAC_CTRL1) --#define VDEC2_ACC0REG1 0x2361 --#define P_VDEC2_ACC0REG1 DOS_REG_ADDR(VDEC2_ACC0REG1) --#define VDEC2_ACC1REG1 0x2362 --#define P_VDEC2_ACC1REG1 DOS_REG_ADDR(VDEC2_ACC1REG1) --#define VDEC2_MAC_CTRL2 0x2370 --#define P_VDEC2_MAC_CTRL2 DOS_REG_ADDR(VDEC2_MAC_CTRL2) --#define VDEC2_ACC0REG2 0x2371 --#define P_VDEC2_ACC0REG2 DOS_REG_ADDR(VDEC2_ACC0REG2) --#define VDEC2_ACC1REG2 0x2372 --#define P_VDEC2_ACC1REG2 DOS_REG_ADDR(VDEC2_ACC1REG2) --#define VDEC2_CPU_TRACE 0x2380 --#define P_VDEC2_CPU_TRACE DOS_REG_ADDR(VDEC2_CPU_TRACE) --/*add from M8M2*/ --#define HEVC_MSP 0x3300 --#define P_HEVC_MSP DOS_REG_ADDR(HEVC_MSP) --#define HEVC_MPSR 0x3301 --#define P_HEVC_MPSR DOS_REG_ADDR(HEVC_MPSR) --#define HEVC_MINT_VEC_BASE 0x3302 --#define P_HEVC_MINT_VEC_BASE DOS_REG_ADDR(HEVC_MINT_VEC_BASE) --#define HEVC_MCPU_INTR_GRP 0x3303 --#define P_HEVC_MCPU_INTR_GRP DOS_REG_ADDR(HEVC_MCPU_INTR_GRP) --#define HEVC_MCPU_INTR_MSK 0x3304 --#define P_HEVC_MCPU_INTR_MSK DOS_REG_ADDR(HEVC_MCPU_INTR_MSK) --#define HEVC_MCPU_INTR_REQ 0x3305 --#define P_HEVC_MCPU_INTR_REQ DOS_REG_ADDR(HEVC_MCPU_INTR_REQ) --#define HEVC_MPC_P 0x3306 --#define P_HEVC_MPC_P DOS_REG_ADDR(HEVC_MPC_P) --#define HEVC_MPC_D 0x3307 --#define P_HEVC_MPC_D DOS_REG_ADDR(HEVC_MPC_D) --#define HEVC_MPC_E 0x3308 --#define P_HEVC_MPC_E DOS_REG_ADDR(HEVC_MPC_E) --#define HEVC_MPC_W 0x3309 --#define P_HEVC_MPC_W DOS_REG_ADDR(HEVC_MPC_W) --#define HEVC_MINDEX0_REG 0x330a --#define P_HEVC_MINDEX0_REG DOS_REG_ADDR(HEVC_MINDEX0_REG) --#define HEVC_MINDEX1_REG 0x330b --#define P_HEVC_MINDEX1_REG DOS_REG_ADDR(HEVC_MINDEX1_REG) --#define HEVC_MINDEX2_REG 0x330c --#define P_HEVC_MINDEX2_REG DOS_REG_ADDR(HEVC_MINDEX2_REG) --#define HEVC_MINDEX3_REG 0x330d --#define P_HEVC_MINDEX3_REG DOS_REG_ADDR(HEVC_MINDEX3_REG) --#define HEVC_MINDEX4_REG 0x330e --#define P_HEVC_MINDEX4_REG DOS_REG_ADDR(HEVC_MINDEX4_REG) --#define HEVC_MINDEX5_REG 0x330f --#define P_HEVC_MINDEX5_REG DOS_REG_ADDR(HEVC_MINDEX5_REG) --#define HEVC_MINDEX6_REG 0x3310 --#define P_HEVC_MINDEX6_REG DOS_REG_ADDR(HEVC_MINDEX6_REG) --#define HEVC_MINDEX7_REG 0x3311 --#define P_HEVC_MINDEX7_REG DOS_REG_ADDR(HEVC_MINDEX7_REG) --#define HEVC_MMIN_REG 0x3312 --#define P_HEVC_MMIN_REG DOS_REG_ADDR(HEVC_MMIN_REG) --#define HEVC_MMAX_REG 0x3313 --#define P_HEVC_MMAX_REG DOS_REG_ADDR(HEVC_MMAX_REG) --#define HEVC_MBREAK0_REG 0x3314 --#define P_HEVC_MBREAK0_REG DOS_REG_ADDR(HEVC_MBREAK0_REG) --#define HEVC_MBREAK1_REG 0x3315 --#define P_HEVC_MBREAK1_REG DOS_REG_ADDR(HEVC_MBREAK1_REG) --#define HEVC_MBREAK2_REG 0x3316 --#define P_HEVC_MBREAK2_REG DOS_REG_ADDR(HEVC_MBREAK2_REG) --#define HEVC_MBREAK3_REG 0x3317 --#define P_HEVC_MBREAK3_REG DOS_REG_ADDR(HEVC_MBREAK3_REG) --#define HEVC_MBREAK_TYPE 0x3318 --#define P_HEVC_MBREAK_TYPE DOS_REG_ADDR(HEVC_MBREAK_TYPE) --#define HEVC_MBREAK_CTRL 0x3319 --#define P_HEVC_MBREAK_CTRL DOS_REG_ADDR(HEVC_MBREAK_CTRL) --#define HEVC_MBREAK_STAUTS 0x331a --#define P_HEVC_MBREAK_STAUTS DOS_REG_ADDR(HEVC_MBREAK_STAUTS) --#define HEVC_MDB_ADDR_REG 0x331b --#define P_HEVC_MDB_ADDR_REG DOS_REG_ADDR(HEVC_MDB_ADDR_REG) --#define HEVC_MDB_DATA_REG 0x331c --#define P_HEVC_MDB_DATA_REG DOS_REG_ADDR(HEVC_MDB_DATA_REG) --#define HEVC_MDB_CTRL 0x331d --#define P_HEVC_MDB_CTRL DOS_REG_ADDR(HEVC_MDB_CTRL) --#define HEVC_MSFTINT0 0x331e --#define P_HEVC_MSFTINT0 DOS_REG_ADDR(HEVC_MSFTINT0) --#define HEVC_MSFTINT1 0x331f --#define P_HEVC_MSFTINT1 DOS_REG_ADDR(HEVC_MSFTINT1) --#define HEVC_CSP 0x3320 --#define P_HEVC_CSP DOS_REG_ADDR(HEVC_CSP) --#define HEVC_CPSR 0x3321 --#define P_HEVC_CPSR DOS_REG_ADDR(HEVC_CPSR) --#define HEVC_CINT_VEC_BASE 0x3322 --#define P_HEVC_CINT_VEC_BASE DOS_REG_ADDR(HEVC_CINT_VEC_BASE) --#define HEVC_CCPU_INTR_GRP 0x3323 --#define P_HEVC_CCPU_INTR_GRP DOS_REG_ADDR(HEVC_CCPU_INTR_GRP) --#define HEVC_CCPU_INTR_MSK 0x3324 --#define P_HEVC_CCPU_INTR_MSK DOS_REG_ADDR(HEVC_CCPU_INTR_MSK) --#define HEVC_CCPU_INTR_REQ 0x3325 --#define P_HEVC_CCPU_INTR_REQ DOS_REG_ADDR(HEVC_CCPU_INTR_REQ) --#define HEVC_CPC_P 0x3326 --#define P_HEVC_CPC_P DOS_REG_ADDR(HEVC_CPC_P) --#define HEVC_CPC_D 0x3327 --#define P_HEVC_CPC_D DOS_REG_ADDR(HEVC_CPC_D) --#define HEVC_CPC_E 0x3328 --#define P_HEVC_CPC_E DOS_REG_ADDR(HEVC_CPC_E) --#define HEVC_CPC_W 0x3329 --#define P_HEVC_CPC_W DOS_REG_ADDR(HEVC_CPC_W) --#define HEVC_CINDEX0_REG 0x332a --#define P_HEVC_CINDEX0_REG DOS_REG_ADDR(HEVC_CINDEX0_REG) --#define HEVC_CINDEX1_REG 0x332b --#define P_HEVC_CINDEX1_REG DOS_REG_ADDR(HEVC_CINDEX1_REG) --#define HEVC_CINDEX2_REG 0x332c --#define P_HEVC_CINDEX2_REG DOS_REG_ADDR(HEVC_CINDEX2_REG) --#define HEVC_CINDEX3_REG 0x332d --#define P_HEVC_CINDEX3_REG DOS_REG_ADDR(HEVC_CINDEX3_REG) --#define HEVC_CINDEX4_REG 0x332e --#define P_HEVC_CINDEX4_REG DOS_REG_ADDR(HEVC_CINDEX4_REG) --#define HEVC_CINDEX5_REG 0x332f --#define P_HEVC_CINDEX5_REG DOS_REG_ADDR(HEVC_CINDEX5_REG) --#define HEVC_CINDEX6_REG 0x3330 --#define P_HEVC_CINDEX6_REG DOS_REG_ADDR(HEVC_CINDEX6_REG) --#define HEVC_CINDEX7_REG 0x3331 --#define P_HEVC_CINDEX7_REG DOS_REG_ADDR(HEVC_CINDEX7_REG) --#define HEVC_CMIN_REG 0x3332 --#define P_HEVC_CMIN_REG DOS_REG_ADDR(HEVC_CMIN_REG) --#define HEVC_CMAX_REG 0x3333 --#define P_HEVC_CMAX_REG DOS_REG_ADDR(HEVC_CMAX_REG) --#define HEVC_CBREAK0_REG 0x3334 --#define P_HEVC_CBREAK0_REG DOS_REG_ADDR(HEVC_CBREAK0_REG) --#define HEVC_CBREAK1_REG 0x3335 --#define P_HEVC_CBREAK1_REG DOS_REG_ADDR(HEVC_CBREAK1_REG) --#define HEVC_CBREAK2_REG 0x3336 --#define P_HEVC_CBREAK2_REG DOS_REG_ADDR(HEVC_CBREAK2_REG) --#define HEVC_CBREAK3_REG 0x3337 --#define P_HEVC_CBREAK3_REG DOS_REG_ADDR(HEVC_CBREAK3_REG) --#define HEVC_CBREAK_TYPE 0x3338 --#define P_HEVC_CBREAK_TYPE DOS_REG_ADDR(HEVC_CBREAK_TYPE) --#define HEVC_CBREAK_CTRL 0x3339 --#define P_HEVC_CBREAK_CTRL DOS_REG_ADDR(HEVC_CBREAK_CTRL) --#define HEVC_CBREAK_STAUTS 0x333a --#define P_HEVC_CBREAK_STAUTS DOS_REG_ADDR(HEVC_CBREAK_STAUTS) --#define HEVC_CDB_ADDR_REG 0x333b --#define P_HEVC_CDB_ADDR_REG DOS_REG_ADDR(HEVC_CDB_ADDR_REG) --#define HEVC_CDB_DATA_REG 0x333c --#define P_HEVC_CDB_DATA_REG DOS_REG_ADDR(HEVC_CDB_DATA_REG) --#define HEVC_CDB_CTRL 0x333d --#define P_HEVC_CDB_CTRL DOS_REG_ADDR(HEVC_CDB_CTRL) --#define HEVC_CSFTINT0 0x333e --#define P_HEVC_CSFTINT0 DOS_REG_ADDR(HEVC_CSFTINT0) --#define HEVC_CSFTINT1 0x333f --#define P_HEVC_CSFTINT1 DOS_REG_ADDR(HEVC_CSFTINT1) --#define HEVC_IMEM_DMA_CTRL 0x3340 --#define P_HEVC_IMEM_DMA_CTRL DOS_REG_ADDR(HEVC_IMEM_DMA_CTRL) --#define HEVC_IMEM_DMA_ADR 0x3341 --#define P_HEVC_IMEM_DMA_ADR DOS_REG_ADDR(HEVC_IMEM_DMA_ADR) --#define HEVC_IMEM_DMA_COUNT 0x3342 --#define P_HEVC_IMEM_DMA_COUNT DOS_REG_ADDR(HEVC_IMEM_DMA_COUNT) --#define HEVC_WRRSP_IMEM 0x3343 --#define P_HEVC_WRRSP_IMEM DOS_REG_ADDR(HEVC_WRRSP_IMEM) --#define HEVC_LMEM_DMA_CTRL 0x3350 --#define P_HEVC_LMEM_DMA_CTRL DOS_REG_ADDR(HEVC_LMEM_DMA_CTRL) --#define HEVC_LMEM_DMA_ADR 0x3351 --#define P_HEVC_LMEM_DMA_ADR DOS_REG_ADDR(HEVC_LMEM_DMA_ADR) --#define HEVC_LMEM_DMA_COUNT 0x3352 --#define P_HEVC_LMEM_DMA_COUNT DOS_REG_ADDR(HEVC_LMEM_DMA_COUNT) --#define HEVC_WRRSP_LMEM 0x3353 --#define P_HEVC_WRRSP_LMEM DOS_REG_ADDR(HEVC_WRRSP_LMEM) --#define HEVC_MAC_CTRL1 0x3360 --#define P_HEVC_MAC_CTRL1 DOS_REG_ADDR(HEVC_MAC_CTRL1) --#define HEVC_ACC0REG1 0x3361 --#define P_HEVC_ACC0REG1 DOS_REG_ADDR(HEVC_ACC0REG1) --#define HEVC_ACC1REG1 0x3362 --#define P_HEVC_ACC1REG1 DOS_REG_ADDR(HEVC_ACC1REG1) --#define HEVC_MAC_CTRL2 0x3370 --#define P_HEVC_MAC_CTRL2 DOS_REG_ADDR(HEVC_MAC_CTRL2) --#define HEVC_ACC0REG2 0x3371 --#define P_HEVC_ACC0REG2 DOS_REG_ADDR(HEVC_ACC0REG2) --#define HEVC_ACC1REG2 0x3372 --#define P_HEVC_ACC1REG2 DOS_REG_ADDR(HEVC_ACC1REG2) --#define HEVC_CPU_TRACE 0x3380 --#define P_HEVC_CPU_TRACE DOS_REG_ADDR(HEVC_CPU_TRACE) --/**/ --#define HCODEC_VLC_MB_INFO 0x1d35 --#define P_HCODEC_VLC_MB_INFO DOS_REG_ADDR(HCODEC_VLC_MB_INFO) --#define HCODEC_VLC_ENC_PEND_CMD 0x1d36 -- --#define HCODEC_VLC_DC_RD_REQ 0x1d45 --#define P_HCODEC_VLC_DC_RD_REQ DOS_REG_ADDR(HCODEC_VLC_DC_RD_REQ) --#define HCODEC_VLC_DC 0x1d46 --#define P_HCODEC_VLC_DC DOS_REG_ADDR(HCODEC_VLC_DC) --#define HCODEC_VLC_DC_INFO 0x1d47 --#define P_HCODEC_VLC_DC_INFO DOS_REG_ADDR(HCODEC_VLC_DC_INFO) --#define HCODEC_VLC_MV_INDEX 0x1d48 --#define P_HCODEC_VLC_MV_INDEX DOS_REG_ADDR(HCODEC_VLC_MV_INDEX) --#define HCODEC_VLC_MV 0x1d49 --#define P_HCODEC_VLC_MV DOS_REG_ADDR(HCODEC_VLC_MV) --#define HCODEC_HENC_TOP_MV_0 0x1d4a --#define P_HCODEC_HENC_TOP_MV_0 DOS_REG_ADDR(HCODEC_HENC_TOP_MV_0) --#define HCODEC_HENC_TOP_MV_1 0x1d4b --#define P_HCODEC_HENC_TOP_MV_1 DOS_REG_ADDR(HCODEC_HENC_TOP_MV_1) --#define HCODEC_HENC_TOP_MV_2 0x1d4c --#define P_HCODEC_HENC_TOP_MV_2 DOS_REG_ADDR(HCODEC_HENC_TOP_MV_2) --#define HCODEC_HENC_TOP_MV_3 0x1d4d --#define P_HCODEC_HENC_TOP_MV_3 DOS_REG_ADDR(HCODEC_HENC_TOP_MV_3) --#define HCODEC_HENC_LEFT_MV_0 0x1d4e -- --/*add from M8M2*/ --#define HCODEC_QDCT_I_PRED_REF_WR_IDX 0x1f32 --#define P_HCODEC_QDCT_I_PRED_REF_WR_IDX \ -- DOS_REG_ADDR(HCODEC_QDCT_I_PRED_REF_WR_IDX) --#define HCODEC_QDCT_I_PRED_REF_WR_DATA 0x1f33 --#define P_HCODEC_QDCT_I_PRED_REF_WR_DATA \ -- DOS_REG_ADDR(HCODEC_QDCT_I_PRED_REF_WR_DATA) --/**/ --#define HCODEC_IE_CONTROL 0x1f40 --#define P_HCODEC_IE_CONTROL DOS_REG_ADDR(HCODEC_IE_CONTROL) --#define HCODEC_IE_MB_POSITION 0x1f41 --#define P_HCODEC_IE_MB_POSITION \ -- DOS_REG_ADDR(HCODEC_IE_MB_POSITION) --#define HCODEC_IE_ME_MB_INFO 0x1f42 --#define P_HCODEC_IE_ME_MB_INFO DOS_REG_ADDR(HCODEC_IE_ME_MB_INFO) --#define HCODEC_SAD_CONTROL 0x1f43 --#define P_HCODEC_SAD_CONTROL DOS_REG_ADDR(HCODEC_SAD_CONTROL) --#define HCODEC_IE_I4_PRED_MODE_HI 0x1f45 --#define P_HCODEC_IE_I4_PRED_MODE_HI \ -- DOS_REG_ADDR(HCODEC_IE_I4_PRED_MODE_HI) --#define HCODEC_IE_I4_PRED_MODE_LO 0x1f46 --#define P_HCODEC_IE_I4_PRED_MODE_LO \ -- DOS_REG_ADDR(HCODEC_IE_I4_PRED_MODE_LO) --#define HCODEC_IE_C_PRED_MODE 0x1f47 --#define P_HCODEC_IE_C_PRED_MODE \ -- DOS_REG_ADDR(HCODEC_IE_C_PRED_MODE) --#define HCODEC_IE_CUR_REF_SEL 0x1f48 --#define P_HCODEC_IE_CUR_REF_SEL \ -- DOS_REG_ADDR(HCODEC_IE_CUR_REF_SEL) --#define HCODEC_ME_CONTROL 0x1f49 --#define P_HCODEC_ME_CONTROL DOS_REG_ADDR(HCODEC_ME_CONTROL) --#define HCODEC_ME_START_POSITION 0x1f4a --#define P_HCODEC_ME_START_POSITION \ -- DOS_REG_ADDR(HCODEC_ME_START_POSITION) --#define HCODEC_ME_STATUS 0x1f4b --#define P_HCODEC_ME_STATUS DOS_REG_ADDR(HCODEC_ME_STATUS) --#define HCODEC_ME_DEBUG 0x1f4c --#define P_HCODEC_ME_DEBUG DOS_REG_ADDR(HCODEC_ME_DEBUG) --#define HCODEC_ME_SKIP_LINE 0x1f4d --#define P_HCODEC_ME_SKIP_LINE DOS_REG_ADDR(HCODEC_ME_SKIP_LINE) --#define HCODEC_ME_AB_MEM_CTL 0x1f4e --#define P_HCODEC_ME_AB_MEM_CTL DOS_REG_ADDR(HCODEC_ME_AB_MEM_CTL) --#define HCODEC_ME_PIC_INFO 0x1f4f --#define P_HCODEC_ME_PIC_INFO DOS_REG_ADDR(HCODEC_ME_PIC_INFO) --#define HCODEC_ME_SAD_ENOUGH_01 0x1f50 --#define P_HCODEC_ME_SAD_ENOUGH_01 \ -- DOS_REG_ADDR(HCODEC_ME_SAD_ENOUGH_01) --#define HCODEC_ME_SAD_ENOUGH_23 0x1f51 --#define P_HCODEC_ME_SAD_ENOUGH_23 \ -- DOS_REG_ADDR(HCODEC_ME_SAD_ENOUGH_23) --#define HCODEC_ME_STEP0_CLOSE_MV 0x1f52 --#define P_HCODEC_ME_STEP0_CLOSE_MV \ -- DOS_REG_ADDR(HCODEC_ME_STEP0_CLOSE_MV) --#define HCODEC_ME_F_SKIP_SAD 0x1f53 --#define P_HCODEC_ME_F_SKIP_SAD \ -- DOS_REG_ADDR(HCODEC_ME_F_SKIP_SAD) --#define HCODEC_ME_F_SKIP_WEIGHT 0x1f54 --#define P_HCODEC_ME_F_SKIP_WEIGHT \ -- DOS_REG_ADDR(HCODEC_ME_F_SKIP_WEIGHT) --#define HCODEC_ME_MV_MERGE_CTL 0x1f55 --#define P_HCODEC_ME_MV_MERGE_CTL \ -- DOS_REG_ADDR(HCODEC_ME_MV_MERGE_CTL) --#define HCODEC_ME_MV_WEIGHT_01 0x1f56 --#define P_HCODEC_ME_MV_WEIGHT_01 \ -- DOS_REG_ADDR(HCODEC_ME_MV_WEIGHT_01) --#define HCODEC_ME_MV_WEIGHT_23 0x1f57 --#define P_HCODEC_ME_MV_WEIGHT_23 \ -- DOS_REG_ADDR(HCODEC_ME_MV_WEIGHT_23) --#define HCODEC_ME_SAD_RANGE_INC 0x1f58 --#define P_HCODEC_ME_SAD_RANGE_INC \ -- DOS_REG_ADDR(HCODEC_ME_SAD_RANGE_INC) --#define HCODEC_ME_SUB_MERGE_CTL 0x1f59 --#define P_HCODEC_ME_SUB_MERGE_CTL \ -- DOS_REG_ADDR(HCODEC_ME_SUB_MERGE_CTL) --#define HCODEC_ME_SUB_REF_MV_CTL 0x1f5a --#define P_HCODEC_ME_SUB_REF_MV_CTL \ -- DOS_REG_ADDR(HCODEC_ME_SUB_REF_MV_CTL) --#define HCODEC_ME_SUB_ANY_WEIGHT_SAD 0x1f5b --#define P_HCODEC_ME_SUB_ANY_WEIGHT_SAD \ -- DOS_REG_ADDR(HCODEC_ME_SUB_ANY_WEIGHT_SAD) --#define HCODEC_ME_SUB_FIX_SAD 0x1f5c --#define P_HCODEC_ME_SUB_FIX_SAD \ -- DOS_REG_ADDR(HCODEC_ME_SUB_FIX_SAD) --#define HCODEC_ME_SUB_FIX_MIN_SAD 0x1f5d --#define P_HCODEC_ME_SUB_FIX_MIN_SAD \ -- DOS_REG_ADDR(HCODEC_ME_SUB_FIX_MIN_SAD) --#define HCODEC_ME_SUB_SNAP_GLITCH 0x1f5e --#define P_HCODEC_ME_SUB_SNAP_GLITCH \ -- DOS_REG_ADDR(HCODEC_ME_SUB_SNAP_GLITCH) --#define HCODEC_ME_SUB_ACT_CTL 0x1f5f --#define P_HCODEC_ME_SUB_ACT_CTL \ -- DOS_REG_ADDR(HCODEC_ME_SUB_ACT_CTL) --#define AO_RTI_STATUS_REG0 ((0x00 << 10) | (0x00 << 2)) --#define P_AO_RTI_STATUS_REG0 AOBUS_REG_ADDR(AO_RTI_STATUS_REG0) --#define AO_RTI_STATUS_REG1 ((0x00 << 10) | (0x01 << 2)) --#define P_AO_RTI_STATUS_REG1 AOBUS_REG_ADDR(AO_RTI_STATUS_REG1) --#define AO_RTI_STATUS_REG2 ((0x00 << 10) | (0x02 << 2)) --#define P_AO_RTI_STATUS_REG2 AOBUS_REG_ADDR(AO_RTI_STATUS_REG2) --#define AO_RTI_PWR_CNTL_REG1 ((0x00 << 10) | (0x03 << 2)) --#define P_AO_RTI_PWR_CNTL_REG1 AOBUS_REG_ADDR(AO_RTI_PWR_CNTL_REG1) --#define AO_RTI_PWR_CNTL_REG0 ((0x00 << 10) | (0x04 << 2)) --#define P_AO_RTI_PWR_CNTL_REG0 AOBUS_REG_ADDR(AO_RTI_PWR_CNTL_REG0) --#define AO_RTI_PIN_MUX_REG ((0x00 << 10) | (0x05 << 2)) --#define P_AO_RTI_PIN_MUX_REG AOBUS_REG_ADDR(AO_RTI_PIN_MUX_REG) --#define AO_WD_GPIO_REG ((0x00 << 10) | (0x06 << 2)) --#define P_AO_WD_GPIO_REG AOBUS_REG_ADDR(AO_WD_GPIO_REG) --#define AO_REMAP_REG0 ((0x00 << 10) | (0x07 << 2)) --#define P_AO_REMAP_REG0 AOBUS_REG_ADDR(AO_REMAP_REG0) --#define AO_REMAP_REG1 ((0x00 << 10) | (0x08 << 2)) --#define P_AO_REMAP_REG1 AOBUS_REG_ADDR(AO_REMAP_REG1) --#define AO_GPIO_O_EN_N ((0x00 << 10) | (0x09 << 2)) --#define P_AO_GPIO_O_EN_N AOBUS_REG_ADDR(AO_GPIO_O_EN_N) --#define AO_GPIO_I ((0x00 << 10) | (0x0A << 2)) --#define P_AO_GPIO_I AOBUS_REG_ADDR(AO_GPIO_I) --#define AO_RTI_PULL_UP_REG ((0x00 << 10) | (0x0B << 2)) --#define P_AO_RTI_PULL_UP_REG AOBUS_REG_ADDR(AO_RTI_PULL_UP_REG) --#define AO_RTI_WD_MARK ((0x00 << 10) | (0x0D << 2)) --#define P_AO_RTI_WD_MARK AOBUS_REG_ADDR(AO_RTI_WD_MARK) --#define AO_CPU_CNTL ((0x00 << 10) | (0x0E << 2)) --#define P_AO_CPU_CNTL AOBUS_REG_ADDR(AO_CPU_CNTL) --#define AO_CPU_STAT ((0x00 << 10) | (0x0F << 2)) --#define P_AO_CPU_STAT AOBUS_REG_ADDR(AO_CPU_STAT) --#define AO_RTI_GEN_CNTL_REG0 ((0x00 << 10) | (0x10 << 2)) --#define P_AO_RTI_GEN_CNTL_REG0 AOBUS_REG_ADDR(AO_RTI_GEN_CNTL_REG0) --#define AO_WATCHDOG_REG ((0x00 << 10) | (0x11 << 2)) --#define P_AO_WATCHDOG_REG AOBUS_REG_ADDR(AO_WATCHDOG_REG) --#define AO_WATCHDOG_RESET ((0x00 << 10) | (0x12 << 2)) --#define P_AO_WATCHDOG_RESET AOBUS_REG_ADDR(AO_WATCHDOG_RESET) --#define AO_TIMER_REG ((0x00 << 10) | (0x13 << 2)) --#define P_AO_TIMER_REG AOBUS_REG_ADDR(AO_TIMER_REG) --#define AO_TIMERA_REG ((0x00 << 10) | (0x14 << 2)) --#define P_AO_TIMERA_REG AOBUS_REG_ADDR(AO_TIMERA_REG) --#define AO_TIMERE_REG ((0x00 << 10) | (0x15 << 2)) --#define P_AO_TIMERE_REG AOBUS_REG_ADDR(AO_TIMERE_REG) --#define AO_AHB2DDR_CNTL ((0x00 << 10) | (0x18 << 2)) --#define P_AO_AHB2DDR_CNTL AOBUS_REG_ADDR(AO_AHB2DDR_CNTL) --#define AO_IRQ_MASK_FIQ_SEL ((0x00 << 10) | (0x20 << 2)) --#define P_AO_IRQ_MASK_FIQ_SEL AOBUS_REG_ADDR(AO_IRQ_MASK_FIQ_SEL) --#define AO_IRQ_GPIO_REG ((0x00 << 10) | (0x21 << 2)) --#define P_AO_IRQ_GPIO_REG AOBUS_REG_ADDR(AO_IRQ_GPIO_REG) --#define AO_IRQ_STAT ((0x00 << 10) | (0x22 << 2)) --#define P_AO_IRQ_STAT AOBUS_REG_ADDR(AO_IRQ_STAT) --#define AO_IRQ_STAT_CLR ((0x00 << 10) | (0x23 << 2)) --#define P_AO_IRQ_STAT_CLR AOBUS_REG_ADDR(AO_IRQ_STAT_CLR) --#define AO_DEBUG_REG0 ((0x00 << 10) | (0x28 << 2)) --#define P_AO_DEBUG_REG0 AOBUS_REG_ADDR(AO_DEBUG_REG0) --#define AO_DEBUG_REG1 ((0x00 << 10) | (0x29 << 2)) --#define P_AO_DEBUG_REG1 AOBUS_REG_ADDR(AO_DEBUG_REG1) --#define AO_DEBUG_REG2 ((0x00 << 10) | (0x2a << 2)) --#define P_AO_DEBUG_REG2 AOBUS_REG_ADDR(AO_DEBUG_REG2) --#define AO_DEBUG_REG3 ((0x00 << 10) | (0x2b << 2)) --#define P_AO_DEBUG_REG3 AOBUS_REG_ADDR(AO_DEBUG_REG3) --#define AO_IR_BLASTER_ADDR0 ((0x00 << 10) | (0x30 << 2)) --#define P_AO_IR_BLASTER_ADDR0 AOBUS_REG_ADDR(AO_IR_BLASTER_ADDR0) --#define AO_IR_BLASTER_ADDR1 ((0x00 << 10) | (0x31 << 2)) --#define P_AO_IR_BLASTER_ADDR1 AOBUS_REG_ADDR(AO_IR_BLASTER_ADDR1) --#define AO_IR_BLASTER_ADDR2 ((0x00 << 10) | (0x32 << 2)) --#define P_AO_IR_BLASTER_ADDR2 AOBUS_REG_ADDR(AO_IR_BLASTER_ADDR2) --/*add from M8M2*/ --#define AO_JTAG_TRIGGER_CNTL ((0x00 << 10) | (0x34 << 2)) --#define P_AO_JTAG_TRIGGER_CNTL AOBUS_REG_ADDR(AO_JTAG_TRIGGER_CNTL) --/**/ --#define AO_RTI_PWR_A9_CNTL0 ((0x00 << 10) | (0x38 << 2)) --#define P_AO_RTI_PWR_A9_CNTL0 AOBUS_REG_ADDR(AO_RTI_PWR_A9_CNTL0) --#define AO_RTI_PWR_A9_CNTL1 ((0x00 << 10) | (0x39 << 2)) --#define P_AO_RTI_PWR_A9_CNTL1 AOBUS_REG_ADDR(AO_RTI_PWR_A9_CNTL1) --#define AO_RTI_GEN_PWR_SLEEP0 ((0x00 << 10) | (0x3a << 2)) --#define P_AO_RTI_GEN_PWR_SLEEP0 \ -- AOBUS_REG_ADDR(AO_RTI_GEN_PWR_SLEEP0) --#define AO_RTI_GEN_PWR_ISO0 ((0x00 << 10) | (0x3b << 2)) --#define P_AO_RTI_GEN_PWR_ISO0 AOBUS_REG_ADDR(AO_RTI_GEN_PWR_ISO0) --#define AO_CEC_GEN_CNTL ((0x00 << 10) | (0x40 << 2)) --#define P_AO_CEC_GEN_CNTL AOBUS_REG_ADDR(AO_CEC_GEN_CNTL) --#define AO_CEC_RW_REG ((0x00 << 10) | (0x41 << 2)) --#define P_AO_CEC_RW_REG AOBUS_REG_ADDR(AO_CEC_RW_REG) --#define AO_CEC_INTR_MASKN ((0x00 << 10) | (0x42 << 2)) --#define P_AO_CEC_INTR_MASKN AOBUS_REG_ADDR(AO_CEC_INTR_MASKN) --#define AO_CEC_INTR_CLR ((0x00 << 10) | (0x43 << 2)) --#define P_AO_CEC_INTR_CLR AOBUS_REG_ADDR(AO_CEC_INTR_CLR) --#define AO_CEC_INTR_STAT ((0x00 << 10) | (0x44 << 2)) --#define P_AO_CEC_INTR_STAT AOBUS_REG_ADDR(AO_CEC_INTR_STAT) --#define AO_IR_DEC_LDR_ACTIVE ((0x01 << 10) | (0x20 << 2)) --#define P_AO_IR_DEC_LDR_ACTIVE AOBUS_REG_ADDR(AO_IR_DEC_LDR_ACTIVE) --#define AO_IR_DEC_LDR_IDLE ((0x01 << 10) | (0x21 << 2)) --#define P_AO_IR_DEC_LDR_IDLE AOBUS_REG_ADDR(AO_IR_DEC_LDR_IDLE) --#define AO_IR_DEC_LDR_REPEAT ((0x01 << 10) | (0x22 << 2)) --#define P_AO_IR_DEC_LDR_REPEAT AOBUS_REG_ADDR(AO_IR_DEC_LDR_REPEAT) --#define AO_IR_DEC_BIT_0 ((0x01 << 10) | (0x23 << 2)) --#define P_AO_IR_DEC_BIT_0 AOBUS_REG_ADDR(AO_IR_DEC_BIT_0) --#define AO_IR_DEC_REG0 ((0x01 << 10) | (0x24 << 2)) --#define P_AO_IR_DEC_REG0 AOBUS_REG_ADDR(AO_IR_DEC_REG0) --#define AO_IR_DEC_FRAME ((0x01 << 10) | (0x25 << 2)) --#define P_AO_IR_DEC_FRAME AOBUS_REG_ADDR(AO_IR_DEC_FRAME) --#define AO_IR_DEC_STATUS ((0x01 << 10) | (0x26 << 2)) --#define P_AO_IR_DEC_STATUS AOBUS_REG_ADDR(AO_IR_DEC_STATUS) --#define AO_IR_DEC_REG1 ((0x01 << 10) | (0x27 << 2)) --#define P_AO_IR_DEC_REG1 AOBUS_REG_ADDR(AO_IR_DEC_REG1) --#define AO_UART_WFIFO ((0x01 << 10) | (0x30 << 2)) --#define P_AO_UART_WFIFO AOBUS_REG_ADDR(AO_UART_WFIFO) --#define AO_UART_RFIFO ((0x01 << 10) | (0x31 << 2)) --#define P_AO_UART_RFIFO AOBUS_REG_ADDR(AO_UART_RFIFO) --#define AO_UART_CONTROL ((0x01 << 10) | (0x32 << 2)) --#define P_AO_UART_CONTROL AOBUS_REG_ADDR(AO_UART_CONTROL) --#define AO_UART_STATUS ((0x01 << 10) | (0x33 << 2)) --#define P_AO_UART_STATUS AOBUS_REG_ADDR(AO_UART_STATUS) --#define AO_UART_MISC ((0x01 << 10) | (0x34 << 2)) --#define P_AO_UART_MISC AOBUS_REG_ADDR(AO_UART_MISC) --#define AO_UART_REG5 ((0x01 << 10) | (0x35 << 2)) --#define P_AO_UART_REG5 AOBUS_REG_ADDR(AO_UART_REG5) --#define AO_UART2_WFIFO ((0x01 << 10) | (0x38 << 2)) --#define P_AO_UART2_WFIFO AOBUS_REG_ADDR(AO_UART2_WFIFO) --#define AO_UART2_RFIFO ((0x01 << 10) | (0x39 << 2)) --#define P_AO_UART2_RFIFO AOBUS_REG_ADDR(AO_UART2_RFIFO) --#define AO_UART2_CONTROL ((0x01 << 10) | (0x3a << 2)) --#define P_AO_UART2_CONTROL AOBUS_REG_ADDR(AO_UART2_CONTROL) --#define AO_UART2_STATUS ((0x01 << 10) | (0x3b << 2)) --#define P_AO_UART2_STATUS AOBUS_REG_ADDR(AO_UART2_STATUS) --#define AO_UART2_MISC ((0x01 << 10) | (0x3c << 2)) --#define P_AO_UART2_MISC AOBUS_REG_ADDR(AO_UART2_MISC) --#define AO_UART2_REG5 ((0x01 << 10) | (0x3d << 2)) --#define P_AO_UART2_REG5 AOBUS_REG_ADDR(AO_UART2_REG5) --#define AO_I2C_M_0_CONTROL_REG ((0x01 << 10) | (0x40 << 2)) --#define P_AO_I2C_M_0_CONTROL_REG \ -- AOBUS_REG_ADDR(AO_I2C_M_0_CONTROL_REG) --#define AO_I2C_M_0_SLAVE_ADDR ((0x01 << 10) | (0x41 << 2)) --#define P_AO_I2C_M_0_SLAVE_ADDR \ -- AOBUS_REG_ADDR(AO_I2C_M_0_SLAVE_ADDR) --#define AO_I2C_M_0_TOKEN_LIST0 ((0x01 << 10) | (0x42 << 2)) --#define P_AO_I2C_M_0_TOKEN_LIST0 \ -- AOBUS_REG_ADDR(AO_I2C_M_0_TOKEN_LIST0) --#define AO_I2C_M_0_TOKEN_LIST1 ((0x01 << 10) | (0x43 << 2)) --#define P_AO_I2C_M_0_TOKEN_LIST1 \ -- AOBUS_REG_ADDR(AO_I2C_M_0_TOKEN_LIST1) --#define AO_I2C_M_0_WDATA_REG0 ((0x01 << 10) | (0x44 << 2)) --#define P_AO_I2C_M_0_WDATA_REG0 \ -- AOBUS_REG_ADDR(AO_I2C_M_0_WDATA_REG0) --#define AO_I2C_M_0_WDATA_REG1 ((0x01 << 10) | (0x45 << 2)) --#define P_AO_I2C_M_0_WDATA_REG1 \ -- AOBUS_REG_ADDR(AO_I2C_M_0_WDATA_REG1) --#define AO_I2C_M_0_RDATA_REG0 ((0x01 << 10) | (0x46 << 2)) --#define P_AO_I2C_M_0_RDATA_REG0 \ -- AOBUS_REG_ADDR(AO_I2C_M_0_RDATA_REG0) --#define AO_I2C_M_0_RDATA_REG1 ((0x01 << 10) | (0x47 << 2)) --#define P_AO_I2C_M_0_RDATA_REG1 \ -- AOBUS_REG_ADDR(AO_I2C_M_0_RDATA_REG1) --#define AO_I2C_S_CONTROL_REG ((0x01 << 10) | (0x50 << 2)) --#define P_AO_I2C_S_CONTROL_REG AOBUS_REG_ADDR(AO_I2C_S_CONTROL_REG) --#define AO_I2C_S_SEND_REG ((0x01 << 10) | (0x51 << 2)) --#define P_AO_I2C_S_SEND_REG AOBUS_REG_ADDR(AO_I2C_S_SEND_REG) --#define AO_I2C_S_RECV_REG ((0x01 << 10) | (0x52 << 2)) --#define P_AO_I2C_S_RECV_REG AOBUS_REG_ADDR(AO_I2C_S_RECV_REG) --#define AO_I2C_S_CNTL1_REG ((0x01 << 10) | (0x53 << 2)) --#define P_AO_I2C_S_CNTL1_REG AOBUS_REG_ADDR(AO_I2C_S_CNTL1_REG) --#define AO_RTC_ADDR0 ((0x01 << 10) | (0xd0 << 2)) --#define P_AO_RTC_ADDR0 AOBUS_REG_ADDR(AO_RTC_ADDR0) --#define AO_RTC_ADDR1 ((0x01 << 10) | (0xd1 << 2)) --#define P_AO_RTC_ADDR1 AOBUS_REG_ADDR(AO_RTC_ADDR1) --#define AO_RTC_ADDR2 ((0x01 << 10) | (0xd2 << 2)) --#define P_AO_RTC_ADDR2 AOBUS_REG_ADDR(AO_RTC_ADDR2) --#define AO_RTC_ADDR3 ((0x01 << 10) | (0xd3 << 2)) --#define P_AO_RTC_ADDR3 AOBUS_REG_ADDR(AO_RTC_ADDR3) --#define AO_RTC_ADDR4 ((0x01 << 10) | (0xd4 << 2)) --#define P_AO_RTC_ADDR4 AOBUS_REG_ADDR(AO_RTC_ADDR4) --#define AO_MF_IR_DEC_LDR_ACTIVE ((0x01 << 10) | (0x60 << 2)) --#define P_AO_MF_IR_DEC_LDR_ACTIVE \ -- AOBUS_REG_ADDR(AO_MF_IR_DEC_LDR_ACTIVE) --#define AO_MF_IR_DEC_LDR_IDLE ((0x01 << 10) | (0x61 << 2)) --#define P_AO_MF_IR_DEC_LDR_IDLE \ -- AOBUS_REG_ADDR(AO_MF_IR_DEC_LDR_IDLE) --#define AO_MF_IR_DEC_LDR_REPEAT ((0x01 << 10) | (0x62 << 2)) --#define P_AO_MF_IR_DEC_LDR_REPEAT \ -- AOBUS_REG_ADDR(AO_MF_IR_DEC_LDR_REPEAT) --#define AO_MF_IR_DEC_BIT_0 ((0x01 << 10) | (0x63 << 2)) --#define P_AO_MF_IR_DEC_BIT_0 AOBUS_REG_ADDR(AO_MF_IR_DEC_BIT_0) --#define AO_MF_IR_DEC_REG0 ((0x01 << 10) | (0x64 << 2)) --#define P_AO_MF_IR_DEC_REG0 AOBUS_REG_ADDR(AO_MF_IR_DEC_REG0) --#define AO_MF_IR_DEC_FRAME ((0x01 << 10) | (0x65 << 2)) --#define P_AO_MF_IR_DEC_FRAME AOBUS_REG_ADDR(AO_MF_IR_DEC_FRAME) --#define AO_MF_IR_DEC_STATUS ((0x01 << 10) | (0x66 << 2)) --#define P_AO_MF_IR_DEC_STATUS AOBUS_REG_ADDR(AO_MF_IR_DEC_STATUS) --#define AO_MF_IR_DEC_REG1 ((0x01 << 10) | (0x67 << 2)) --#define P_AO_MF_IR_DEC_REG1 AOBUS_REG_ADDR(AO_MF_IR_DEC_REG1) --#define AO_MF_IR_DEC_REG2 ((0x01 << 10) | (0x68 << 2)) --#define P_AO_MF_IR_DEC_REG2 AOBUS_REG_ADDR(AO_MF_IR_DEC_REG2) --#define AO_MF_IR_DEC_DURATN2 ((0x01 << 10) | (0x69 << 2)) --#define P_AO_MF_IR_DEC_DURATN2 AOBUS_REG_ADDR(AO_MF_IR_DEC_DURATN2) --#define AO_MF_IR_DEC_DURATN3 ((0x01 << 10) | (0x6a << 2)) --#define P_AO_MF_IR_DEC_DURATN3 AOBUS_REG_ADDR(AO_MF_IR_DEC_DURATN3) --#define AO_MF_IR_DEC_FRAME1 ((0x01 << 10) | (0x6b << 2)) --#define P_AO_MF_IR_DEC_FRAME1 AOBUS_REG_ADDR(AO_MF_IR_DEC_FRAME1) --#define AM_DDR_PLL_CNTL 0x0400 --#define P_AM_DDR_PLL_CNTL MMC_REG_ADDR(AM_DDR_PLL_CNTL) --#define AM_DDR_PLL_CNTL1 0x0404 --#define P_AM_DDR_PLL_CNTL1 MMC_REG_ADDR(AM_DDR_PLL_CNTL1) --#define AM_DDR_PLL_CNTL2 0x0408 --#define P_AM_DDR_PLL_CNTL2 MMC_REG_ADDR(AM_DDR_PLL_CNTL2) --#define AM_DDR_PLL_CNTL3 0x040c --#define P_AM_DDR_PLL_CNTL3 MMC_REG_ADDR(AM_DDR_PLL_CNTL3) --#define AM_DDR_PLL_CNTL4 0x0410 --#define P_AM_DDR_PLL_CNTL4 MMC_REG_ADDR(AM_DDR_PLL_CNTL4) --#define AM_DDR_PLL_STS 0x0414 --#define P_AM_DDR_PLL_STS MMC_REG_ADDR(AM_DDR_PLL_STS) --#define AM_DDR_CLK_CNTL 0x0418 --#define P_AM_DDR_CLK_CNTL MMC_REG_ADDR(AM_DDR_CLK_CNTL) --#define DDR0_PCTL_SCFG 0x0000 --#define P_DDR0_PCTL_SCFG MMC_REG_ADDR(DDR0_PCTL_SCFG) --#define DDR0_PCTL_SCTL 0x0004 --#define P_DDR0_PCTL_SCTL MMC_REG_ADDR(DDR0_PCTL_SCTL) --#define DDR0_PCTL_STAT 0x0008 --#define P_DDR0_PCTL_STAT MMC_REG_ADDR(DDR0_PCTL_STAT) --#define DDR0_PCTL_INTRSTAT 0x000c --#define P_DDR0_PCTL_INTRSTAT MMC_REG_ADDR(DDR0_PCTL_INTRSTAT) --#define DDR0_PCTL_POWSTAT 0x0048 --#define P_DDR0_PCTL_POWSTAT MMC_REG_ADDR(DDR0_PCTL_POWSTAT) --#define DDR0_PCTL_MRRSTAT0 0x0064 --#define P_DDR0_PCTL_MRRSTAT0 MMC_REG_ADDR(DDR0_PCTL_MRRSTAT0) --#define DDR0_PCTL_CMDTSTAT 0x004c --#define P_DDR0_PCTL_CMDTSTAT MMC_REG_ADDR(DDR0_PCTL_CMDTSTAT) --#define DDR0_PCTL_MCMD 0x0040 --#define P_DDR0_PCTL_MCMD MMC_REG_ADDR(DDR0_PCTL_MCMD) --#define DDR0_PCTL_MRRSTAT1 0x0068 --#define P_DDR0_PCTL_MRRSTAT1 MMC_REG_ADDR(DDR0_PCTL_MRRSTAT1) --#define DDR0_PCTL_MRRCFG0 0x0060 --#define P_DDR0_PCTL_MRRCFG0 MMC_REG_ADDR(DDR0_PCTL_MRRCFG0) --#define DDR0_PCTL_CMDTSTATEN 0x0050 --#define P_DDR0_PCTL_CMDTSTATEN MMC_REG_ADDR(DDR0_PCTL_CMDTSTATEN) --#define DDR0_PCTL_POWCTL 0x0044 --#define P_DDR0_PCTL_POWCTL MMC_REG_ADDR(DDR0_PCTL_POWCTL) --#define DDR0_PCTL_PPCFG 0x0084 --#define P_DDR0_PCTL_PPCFG MMC_REG_ADDR(DDR0_PCTL_PPCFG) --#define DDR0_PCTL_MCFG1 0x007c --#define P_DDR0_PCTL_MCFG1 MMC_REG_ADDR(DDR0_PCTL_MCFG1) --#define DDR0_PCTL_MSTAT 0x0088 --#define P_DDR0_PCTL_MSTAT MMC_REG_ADDR(DDR0_PCTL_MSTAT) --#define DDR0_PCTL_MCFG 0x0080 --#define P_DDR0_PCTL_MCFG MMC_REG_ADDR(DDR0_PCTL_MCFG) --#define DDR0_PCTL_DTUAWDT 0x00b0 --#define P_DDR0_PCTL_DTUAWDT MMC_REG_ADDR(DDR0_PCTL_DTUAWDT) --#define DDR0_PCTL_DTUPRD2 0x00a8 --#define P_DDR0_PCTL_DTUPRD2 MMC_REG_ADDR(DDR0_PCTL_DTUPRD2) --#define DDR0_PCTL_DTUPRD3 0x00ac --#define P_DDR0_PCTL_DTUPRD3 MMC_REG_ADDR(DDR0_PCTL_DTUPRD3) --#define DDR0_PCTL_DTUNE 0x009c --#define P_DDR0_PCTL_DTUNE MMC_REG_ADDR(DDR0_PCTL_DTUNE) --#define DDR0_PCTL_DTUPDES 0x0094 --#define P_DDR0_PCTL_DTUPDES MMC_REG_ADDR(DDR0_PCTL_DTUPDES) --#define DDR0_PCTL_DTUNA 0x0098 --#define P_DDR0_PCTL_DTUNA MMC_REG_ADDR(DDR0_PCTL_DTUNA) --#define DDR0_PCTL_DTUPRD0 0x00a0 --#define P_DDR0_PCTL_DTUPRD0 MMC_REG_ADDR(DDR0_PCTL_DTUPRD0) --#define DDR0_PCTL_DTUPRD1 0x00a4 --#define P_DDR0_PCTL_DTUPRD1 MMC_REG_ADDR(DDR0_PCTL_DTUPRD1) --#define DDR0_PCTL_TCKSRE 0x0124 --#define P_DDR0_PCTL_TCKSRE MMC_REG_ADDR(DDR0_PCTL_TCKSRE) --#define DDR0_PCTL_TZQCSI 0x011c --#define P_DDR0_PCTL_TZQCSI MMC_REG_ADDR(DDR0_PCTL_TZQCSI) --#define DDR0_PCTL_TINIT 0x00c4 --#define P_DDR0_PCTL_TINIT MMC_REG_ADDR(DDR0_PCTL_TINIT) --#define DDR0_PCTL_TDPD 0x0144 --#define P_DDR0_PCTL_TDPD MMC_REG_ADDR(DDR0_PCTL_TDPD) --#define DDR0_PCTL_TOGCNT1U 0x00c0 --#define P_DDR0_PCTL_TOGCNT1U MMC_REG_ADDR(DDR0_PCTL_TOGCNT1U) --#define DDR0_PCTL_TCKE 0x012c --#define P_DDR0_PCTL_TCKE MMC_REG_ADDR(DDR0_PCTL_TCKE) --#define DDR0_PCTL_TMOD 0x0130 --#define P_DDR0_PCTL_TMOD MMC_REG_ADDR(DDR0_PCTL_TMOD) --#define DDR0_PCTL_TEXSR 0x010c --#define P_DDR0_PCTL_TEXSR MMC_REG_ADDR(DDR0_PCTL_TEXSR) --#define DDR0_PCTL_TAL 0x00e4 --#define P_DDR0_PCTL_TAL MMC_REG_ADDR(DDR0_PCTL_TAL) --#define DDR0_PCTL_TRTP 0x0100 --#define P_DDR0_PCTL_TRTP MMC_REG_ADDR(DDR0_PCTL_TRTP) --#define DDR0_PCTL_TCKSRX 0x0128 --#define P_DDR0_PCTL_TCKSRX MMC_REG_ADDR(DDR0_PCTL_TCKSRX) --#define DDR0_PCTL_TRTW 0x00e0 --#define P_DDR0_PCTL_TRTW MMC_REG_ADDR(DDR0_PCTL_TRTW) --#define DDR0_PCTL_TCWL 0x00ec --#define P_DDR0_PCTL_TCWL MMC_REG_ADDR(DDR0_PCTL_TCWL) --#define DDR0_PCTL_TWR 0x0104 --#define P_DDR0_PCTL_TWR MMC_REG_ADDR(DDR0_PCTL_TWR) --#define DDR0_PCTL_TCL 0x00e8 --#define P_DDR0_PCTL_TCL MMC_REG_ADDR(DDR0_PCTL_TCL) --#define DDR0_PCTL_TDQS 0x0120 --#define P_DDR0_PCTL_TDQS MMC_REG_ADDR(DDR0_PCTL_TDQS) --#define DDR0_PCTL_TRSTH 0x00c8 --#define P_DDR0_PCTL_TRSTH MMC_REG_ADDR(DDR0_PCTL_TRSTH) --#define DDR0_PCTL_TRCD 0x00f8 --#define P_DDR0_PCTL_TRCD MMC_REG_ADDR(DDR0_PCTL_TRCD) --#define DDR0_PCTL_TXP 0x0110 --#define P_DDR0_PCTL_TXP MMC_REG_ADDR(DDR0_PCTL_TXP) --#define DDR0_PCTL_TOGCNT100N 0x00cc --#define P_DDR0_PCTL_TOGCNT100N MMC_REG_ADDR(DDR0_PCTL_TOGCNT100N) --#define DDR0_PCTL_TMRD 0x00d4 --#define P_DDR0_PCTL_TMRD MMC_REG_ADDR(DDR0_PCTL_TMRD) --#define DDR0_PCTL_TRSTL 0x0134 --#define P_DDR0_PCTL_TRSTL MMC_REG_ADDR(DDR0_PCTL_TRSTL) --#define DDR0_PCTL_TREFI 0x00d0 --#define P_DDR0_PCTL_TREFI MMC_REG_ADDR(DDR0_PCTL_TREFI) --#define DDR0_PCTL_TRAS 0x00f0 --#define P_DDR0_PCTL_TRAS MMC_REG_ADDR(DDR0_PCTL_TRAS) --#define DDR0_PCTL_TREFI_MEM_DDR3 0x0148 --#define P_DDR0_PCTL_TWTR MMC_REG_ADDR(DDR0_PCTL_TWTR) --#define DDR0_PCTL_TRC 0x00f4 --#define P_DDR0_PCTL_TRC MMC_REG_ADDR(DDR0_PCTL_TRC) --#define DDR0_PCTL_TRFC 0x00d8 --#define P_DDR0_PCTL_TRFC MMC_REG_ADDR(DDR0_PCTL_TRFC) --#define DDR0_PCTL_TMRR 0x013c --#define P_DDR0_PCTL_TMRR MMC_REG_ADDR(DDR0_PCTL_TMRR) --#define DDR0_PCTL_TCKESR 0x0140 --#define P_DDR0_PCTL_TCKESR MMC_REG_ADDR(DDR0_PCTL_TCKESR) --#define DDR0_PCTL_TZQCL 0x0138 --#define P_DDR0_PCTL_TZQCL MMC_REG_ADDR(DDR0_PCTL_TZQCL) --#define DDR0_PCTL_TRRD 0x00fc --#define P_DDR0_PCTL_TRRD MMC_REG_ADDR(DDR0_PCTL_TRRD) --#define DDR0_PCTL_TRP 0x00dc --#define P_DDR0_PCTL_TRP MMC_REG_ADDR(DDR0_PCTL_TRP) --#define DDR0_PCTL_TZQCS 0x0118 --#define P_DDR0_PCTL_TZQCS MMC_REG_ADDR(DDR0_PCTL_TZQCS) --#define DDR0_PCTL_TXPDLL 0x0114 --#define P_DDR0_PCTL_TXPDLL MMC_REG_ADDR(DDR0_PCTL_TXPDLL) --#define DDR0_PCTL_ECCCFG 0x0180 --#define P_DDR0_PCTL_ECCCFG MMC_REG_ADDR(DDR0_PCTL_ECCCFG) --#define DDR0_PCTL_ECCLOG 0x018c --#define P_DDR0_PCTL_ECCLOG MMC_REG_ADDR(DDR0_PCTL_ECCLOG) --#define DDR0_PCTL_ECCCLR 0x0188 --#define P_DDR0_PCTL_ECCCLR MMC_REG_ADDR(DDR0_PCTL_ECCCLR) --#define DDR0_PCTL_ECCTST 0x0184 --#define P_DDR0_PCTL_ECCTST MMC_REG_ADDR(DDR0_PCTL_ECCTST) --#define DDR0_PCTL_DTUWD0 0x0210 --#define P_DDR0_PCTL_DTUWD0 MMC_REG_ADDR(DDR0_PCTL_DTUWD0) --#define DDR0_PCTL_DTUWD1 0x0214 --#define P_DDR0_PCTL_DTUWD1 MMC_REG_ADDR(DDR0_PCTL_DTUWD1) --#define DDR0_PCTL_DTUWACTL 0x0200 --#define P_DDR0_PCTL_DTUWACTL MMC_REG_ADDR(DDR0_PCTL_DTUWACTL) --#define DDR0_PCTL_DTULFSRRD 0x0238 --#define P_DDR0_PCTL_DTULFSRRD MMC_REG_ADDR(DDR0_PCTL_DTULFSRRD) --#define DDR0_PCTL_DTUWD2 0x0218 --#define P_DDR0_PCTL_DTUWD2 MMC_REG_ADDR(DDR0_PCTL_DTUWD2) --#define DDR0_PCTL_DTUWD3 0x021c --#define P_DDR0_PCTL_DTUWD3 MMC_REG_ADDR(DDR0_PCTL_DTUWD3) --#define DDR0_PCTL_DTULFSRWD 0x0234 --#define P_DDR0_PCTL_DTULFSRWD MMC_REG_ADDR(DDR0_PCTL_DTULFSRWD) --#define DDR0_PCTL_DTURACTL 0x0204 --#define P_DDR0_PCTL_DTURACTL MMC_REG_ADDR(DDR0_PCTL_DTURACTL) --#define DDR0_PCTL_DTUWDM 0x0220 --#define P_DDR0_PCTL_DTUWDM MMC_REG_ADDR(DDR0_PCTL_DTUWDM) --#define DDR0_PCTL_DTURD0 0x0224 --#define P_DDR0_PCTL_DTURD0 MMC_REG_ADDR(DDR0_PCTL_DTURD0) --#define DDR0_PCTL_DTURD1 0x0228 --#define P_DDR0_PCTL_DTURD1 MMC_REG_ADDR(DDR0_PCTL_DTURD1) --#define DDR0_PCTL_DTURD2 0x022c --#define P_DDR0_PCTL_DTURD2 MMC_REG_ADDR(DDR0_PCTL_DTURD2) --#define DDR0_PCTL_DTURD3 0x0230 --#define P_DDR0_PCTL_DTURD3 MMC_REG_ADDR(DDR0_PCTL_DTURD3) --#define DDR0_PCTL_DTUCFG 0x0208 --#define P_DDR0_PCTL_DTUCFG MMC_REG_ADDR(DDR0_PCTL_DTUCFG) --#define DDR0_PCTL_DTUEAF 0x023c --#define P_DDR0_PCTL_DTUEAF MMC_REG_ADDR(DDR0_PCTL_DTUEAF) --#define DDR0_PCTL_DTUECTL 0x020c --#define P_DDR0_PCTL_DTUECTL MMC_REG_ADDR(DDR0_PCTL_DTUECTL) --#define DDR0_PCTL_DFIODTCFG1 0x0248 -- --#define DDR0_PCTL_DFITDRAMCLKDIS 0x02d4 --#define P_DDR0_PCTL_DFITDRAMCLKDIS \ -- MMC_REG_ADDR(DDR0_PCTL_DFITDRAMCLKDIS) --#define DDR0_PCTL_DFILPCFG0 0x02f0 --#define P_DDR0_PCTL_DFILPCFG0 \ -- MMC_REG_ADDR(DDR0_PCTL_DFILPCFG0) --#define DDR0_PCTL_DFITRWRLVLDELAY0 0x0318 --#define P_DDR0_PCTL_DFITRWRLVLDELAY0 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRWRLVLDELAY0) --#define DDR0_PCTL_DFITRWRLVLDELAY1 0x031c --#define P_DDR0_PCTL_DFITRWRLVLDELAY1 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRWRLVLDELAY1) --#define DDR0_PCTL_DFITRWRLVLDELAY2 0x0320 --#define P_DDR0_PCTL_DFITRWRLVLDELAY2 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRWRLVLDELAY2) --#define DDR0_PCTL_DFITRRDLVLRESP0 0x030c --#define P_DDR0_PCTL_DFITRRDLVLRESP0 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLRESP0) --#define DDR0_PCTL_DFITRRDLVLRESP1 0x0310 --#define P_DDR0_PCTL_DFITRRDLVLRESP1 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLRESP1) --#define DDR0_PCTL_DFITRRDLVLRESP2 0x0314 --#define P_DDR0_PCTL_DFITRRDLVLRESP2 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLRESP2) --#define DDR0_PCTL_DFITRWRLVLRESP0 0x0300 --#define P_DDR0_PCTL_DFITRWRLVLRESP0 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRWRLVLRESP0) --#define DDR0_PCTL_DFITRRDLVLDELAY0 0x0324 --#define P_DDR0_PCTL_DFITRRDLVLDELAY0 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLDELAY0) --#define DDR0_PCTL_DFITRRDLVLDELAY1 0x0328 --#define P_DDR0_PCTL_DFITRRDLVLDELAY1 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLDELAY1) --#define DDR0_PCTL_DFITRWRLVLRESP1 0x0304 --#define P_DDR0_PCTL_DFITRWRLVLRESP1 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRWRLVLRESP1) --#define DDR0_PCTL_DFITRRDLVLDELAY2 0x032c --#define P_DDR0_PCTL_DFITRRDLVLDELAY2 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLDELAY2) --#define DDR0_PCTL_DFITRWRLVLRESP2 0x0308 --#define P_DDR0_PCTL_DFITRWRLVLRESP2 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRWRLVLRESP2) --#define DDR0_PCTL_DFITRRDLVLGATEDELAY0 0x0330 --#define P_DDR0_PCTL_DFITRRDLVLGATEDELAY0 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLGATEDELAY0) --#define DDR0_PCTL_DFITRCMD 0x033c --#define P_DDR0_PCTL_DFITRCMD MMC_REG_ADDR(DDR0_PCTL_DFITRCMD) --#define DDR0_PCTL_DFITRRDLVLGATEDELAY1 0x0334 --#define P_DDR0_PCTL_DFITRRDLVLGATEDELAY1 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLGATEDELAY1) --#define DDR0_PCTL_DFITRRDLVLGATEDELAY2 0x0338 --#define P_DDR0_PCTL_DFITRRDLVLGATEDELAY2 \ -- MMC_REG_ADDR(DDR0_PCTL_DFITRRDLVLGATEDELAY2) --#define DDR0_PCTL_IPTR 0x03fc --#define P_DDR0_PCTL_IPTR MMC_REG_ADDR(DDR0_PCTL_IPTR) --#define DDR0_PCTL_IPVR 0x03f8 --#define P_DDR0_PCTL_IPVR MMC_REG_ADDR(DDR0_PCTL_IPVR) --#define DDR0_PUB_RIDR (0x1000 + (0x00 << 2)) --#define P_DDR0_PUB_RIDR MMC_REG_ADDR(DDR0_PUB_RIDR) --#define DDR0_PUB_PIR (0x1000 + (0x01 << 2)) --#define P_DDR0_PUB_PIR MMC_REG_ADDR(DDR0_PUB_PIR) --#define DDR0_PUB_PGCR0 (0x1000 + (0x02 << 2)) --#define P_DDR0_PUB_PGCR0 MMC_REG_ADDR(DDR0_PUB_PGCR0) --#define DDR0_PUB_PGCR1 (0x1000 + (0x03 << 2)) --#define P_DDR0_PUB_PGCR1 MMC_REG_ADDR(DDR0_PUB_PGCR1) --#define DDR0_PUB_PGCR2 (0x1000 + (0x04 << 2)) --#define P_DDR0_PUB_PGCR2 MMC_REG_ADDR(DDR0_PUB_PGCR2) --#define DDR0_PUB_PGCR3 (0x1000 + (0x05 << 2)) --#define P_DDR0_PUB_PGCR3 MMC_REG_ADDR(DDR0_PUB_PGCR3) --#define DDR0_PUB_PGSR0 (0x1000 + (0x06 << 2)) --#define P_DDR0_PUB_PGSR0 MMC_REG_ADDR(DDR0_PUB_PGSR0) --#define DDR0_PUB_PGSR1 (0x1000 + (0x07 << 2)) --#define P_DDR0_PUB_PGSR1 MMC_REG_ADDR(DDR0_PUB_PGSR1) --#define DDR0_PUB_PLLCR (0x1000 + (0x08 << 2)) --#define P_DDR0_PUB_PLLCR MMC_REG_ADDR(DDR0_PUB_PLLCR) --#define DDR0_PUB_PTR0 (0x1000 + (0x09 << 2)) --#define P_DDR0_PUB_PTR0 MMC_REG_ADDR(DDR0_PUB_PTR0) --#define DDR0_PUB_PTR1 (0x1000 + (0x0A << 2)) --#define P_DDR0_PUB_PTR1 MMC_REG_ADDR(DDR0_PUB_PTR1) --#define DDR0_PUB_PTR2 (0x1000 + (0x0B << 2)) --#define P_DDR0_PUB_PTR2 MMC_REG_ADDR(DDR0_PUB_PTR2) --#define DDR0_PUB_PTR3 (0x1000 + (0x0C << 2)) --#define P_DDR0_PUB_PTR3 MMC_REG_ADDR(DDR0_PUB_PTR3) --#define DDR0_PUB_PTR4 (0x1000 + (0x0D << 2)) --#define P_DDR0_PUB_PTR4 MMC_REG_ADDR(DDR0_PUB_PTR4) --#define DDR0_PUB_ACMDLR (0x1000 + (0x0E << 2)) --#define P_DDR0_PUB_ACMDLR MMC_REG_ADDR(DDR0_PUB_ACMDLR) --#define DDR0_PUB_ACLCDLR (0x1000 + (0x0F << 2)) --#define P_DDR0_PUB_ACLCDLR MMC_REG_ADDR(DDR0_PUB_ACLCDLR) --#define DDR0_PUB_ACBDLR0 (0x1000 + (0x10 << 2)) --#define P_DDR0_PUB_ACBDLR0 MMC_REG_ADDR(DDR0_PUB_ACBDLR0) --#define DDR0_PUB_ACBDLR1 (0x1000 + (0x11 << 2)) --#define P_DDR0_PUB_ACBDLR1 MMC_REG_ADDR(DDR0_PUB_ACBDLR1) --#define DDR0_PUB_ACBDLR2 (0x1000 + (0x12 << 2)) --#define P_DDR0_PUB_ACBDLR2 MMC_REG_ADDR(DDR0_PUB_ACBDLR2) --#define DDR0_PUB_ACBDLR3 (0x1000 + (0x13 << 2)) --#define P_DDR0_PUB_ACBDLR3 MMC_REG_ADDR(DDR0_PUB_ACBDLR3) --#define DDR0_PUB_ACBDLR4 (0x1000 + (0x14 << 2)) --#define P_DDR0_PUB_ACBDLR4 MMC_REG_ADDR(DDR0_PUB_ACBDLR4) --#define DDR0_PUB_ACBDLR5 (0x1000 + (0x15 << 2)) --#define P_DDR0_PUB_ACBDLR5 MMC_REG_ADDR(DDR0_PUB_ACBDLR5) --#define DDR0_PUB_ACBDLR6 (0x1000 + (0x16 << 2)) --#define P_DDR0_PUB_ACBDLR6 MMC_REG_ADDR(DDR0_PUB_ACBDLR6) --#define DDR0_PUB_ACBDLR7 (0x1000 + (0x17 << 2)) --#define P_DDR0_PUB_ACBDLR7 MMC_REG_ADDR(DDR0_PUB_ACBDLR7) --#define DDR0_PUB_ACBDLR8 (0x1000 + (0x18 << 2)) --#define P_DDR0_PUB_ACBDLR8 MMC_REG_ADDR(DDR0_PUB_ACBDLR8) --#define DDR0_PUB_ACBDLR9 (0x1000 + (0x19 << 2)) --#define P_DDR0_PUB_ACBDLR9 MMC_REG_ADDR(DDR0_PUB_ACBDLR9) --#define DDR0_PUB_ACIOCR0 (0x1000 + (0x1A << 2)) --#define P_DDR0_PUB_ACIOCR0 MMC_REG_ADDR(DDR0_PUB_ACIOCR0) --#define DDR0_PUB_ACIOCR1 (0x1000 + (0x1B << 2)) --#define P_DDR0_PUB_ACIOCR1 MMC_REG_ADDR(DDR0_PUB_ACIOCR1) --#define DDR0_PUB_ACIOCR2 (0x1000 + (0x1C << 2)) --#define P_DDR0_PUB_ACIOCR2 MMC_REG_ADDR(DDR0_PUB_ACIOCR2) --#define DDR0_PUB_ACIOCR3 (0x1000 + (0x1D << 2)) --#define P_DDR0_PUB_ACIOCR3 MMC_REG_ADDR(DDR0_PUB_ACIOCR3) --#define DDR0_PUB_ACIOCR4 (0x1000 + (0x1E << 2)) --#define P_DDR0_PUB_ACIOCR4 MMC_REG_ADDR(DDR0_PUB_ACIOCR4) --#define DDR0_PUB_ACIOCR5 (0x1000 + (0x1F << 2)) --#define P_DDR0_PUB_ACIOCR5 MMC_REG_ADDR(DDR0_PUB_ACIOCR5) --#define DDR0_PUB_DXCCR (0x1000 + (0x20 << 2)) --#define P_DDR0_PUB_DXCCR MMC_REG_ADDR(DDR0_PUB_DXCCR) --#define DDR0_PUB_DSGCR (0x1000 + (0x21 << 2)) --#define P_DDR0_PUB_DSGCR MMC_REG_ADDR(DDR0_PUB_DSGCR) --#define DDR0_PUB_DCR (0x1000 + (0x22 << 2)) --#define P_DDR0_PUB_DCR MMC_REG_ADDR(DDR0_PUB_DCR) --#define DDR0_PUB_DTPR0 (0x1000 + (0x23 << 2)) --#define P_DDR0_PUB_DTPR0 MMC_REG_ADDR(DDR0_PUB_DTPR0) --#define DDR0_PUB_DTPR1 (0x1000 + (0x24 << 2)) --#define P_DDR0_PUB_DTPR1 MMC_REG_ADDR(DDR0_PUB_DTPR1) --#define DDR0_PUB_DTPR2 (0x1000 + (0x25 << 2)) --#define P_DDR0_PUB_DTPR2 MMC_REG_ADDR(DDR0_PUB_DTPR2) --#define DDR0_PUB_DTPR3 (0x1000 + (0x26 << 2)) --#define P_DDR0_PUB_DTPR3 MMC_REG_ADDR(DDR0_PUB_DTPR3) --#define DDR0_PUB_MR0 (0x1000 + (0x27 << 2)) --#define P_DDR0_PUB_MR0 MMC_REG_ADDR(DDR0_PUB_MR0) --#define DDR0_PUB_MR1 (0x1000 + (0x28 << 2)) --#define P_DDR0_PUB_MR1 MMC_REG_ADDR(DDR0_PUB_MR1) --#define DDR0_PUB_MR2 (0x1000 + (0x29 << 2)) --#define P_DDR0_PUB_MR2 MMC_REG_ADDR(DDR0_PUB_MR2) --#define DDR0_PUB_MR3 (0x1000 + (0x2A << 2)) --#define P_DDR0_PUB_MR3 MMC_REG_ADDR(DDR0_PUB_MR3) --#define DDR0_PUB_ODTCR (0x1000 + (0x2B << 2)) --#define P_DDR0_PUB_ODTCR MMC_REG_ADDR(DDR0_PUB_ODTCR) --#define DDR0_PUB_DTCR (0x1000 + (0x2C << 2)) --#define P_DDR0_PUB_DTCR MMC_REG_ADDR(DDR0_PUB_DTCR) --#define DDR0_PUB_DTAR0 (0x1000 + (0x2D << 2)) --#define P_DDR0_PUB_DTAR0 MMC_REG_ADDR(DDR0_PUB_DTAR0) --#define DDR0_PUB_DTAR1 (0x1000 + (0x2E << 2)) --#define P_DDR0_PUB_DTAR1 MMC_REG_ADDR(DDR0_PUB_DTAR1) --#define DDR0_PUB_DTAR2 (0x1000 + (0x2F << 2)) --#define P_DDR0_PUB_DTAR2 MMC_REG_ADDR(DDR0_PUB_DTAR2) --#define DDR0_PUB_DTAR3 (0x1000 + (0x30 << 2)) --#define P_DDR0_PUB_DTAR3 MMC_REG_ADDR(DDR0_PUB_DTAR3) --#define DDR0_PUB_DTDR0 (0x1000 + (0x31 << 2)) --#define P_DDR0_PUB_DTDR0 MMC_REG_ADDR(DDR0_PUB_DTDR0) --#define DDR0_PUB_DTDR1 (0x1000 + (0x32 << 2)) --#define P_DDR0_PUB_DTDR1 MMC_REG_ADDR(DDR0_PUB_DTDR1) --#define DDR0_PUB_DTEDR0 (0x1000 + (0x33 << 2)) --#define P_DDR0_PUB_DTEDR0 MMC_REG_ADDR(DDR0_PUB_DTEDR0) --#define DDR0_PUB_DTEDR1 (0x1000 + (0x34 << 2)) --#define P_DDR0_PUB_DTEDR1 MMC_REG_ADDR(DDR0_PUB_DTEDR1) --#define DDR0_PUB_RDIMMGCR0 (0x1000 + (0x35 << 2)) --#define P_DDR0_PUB_RDIMMGCR0 MMC_REG_ADDR(DDR0_PUB_RDIMMGCR0) --#define DDR0_PUB_RDIMMGCR1 (0x1000 + (0x36 << 2)) --#define P_DDR0_PUB_RDIMMGCR1 MMC_REG_ADDR(DDR0_PUB_RDIMMGCR1) --#define DDR0_PUB_RDIMMCR0 (0x1000 + (0x37 << 2)) --#define P_DDR0_PUB_RDIMMCR0 MMC_REG_ADDR(DDR0_PUB_RDIMMCR0) --#define DDR0_PUB_RDIMMCR1 (0x1000 + (0x38 << 2)) --#define P_DDR0_PUB_RDIMMCR1 MMC_REG_ADDR(DDR0_PUB_RDIMMCR1) --#define DDR0_PUB_GPR0 (0x1000 + (0x39 << 2)) --#define P_DDR0_PUB_GPR0 MMC_REG_ADDR(DDR0_PUB_GPR0) --#define DDR0_PUB_GPR1 (0x1000 + (0x3A << 2)) --#define P_DDR0_PUB_GPR1 MMC_REG_ADDR(DDR0_PUB_GPR1) --#define DDR0_PUB_CATR0 (0x1000 + (0x3B << 2)) --#define P_DDR0_PUB_CATR0 MMC_REG_ADDR(DDR0_PUB_CATR0) --#define DDR0_PUB_CATR1 (0x1000 + (0x3C << 2)) --#define P_DDR0_PUB_CATR1 MMC_REG_ADDR(DDR0_PUB_CATR1) --#define DDR0_PUB_DCUAR (0x1000 + (0x60 << 2)) --#define P_DDR0_PUB_DCUAR MMC_REG_ADDR(DDR0_PUB_DCUAR) --#define DDR0_PUB_DCUDR (0x1000 + (0x61 << 2)) --#define P_DDR0_PUB_DCUDR MMC_REG_ADDR(DDR0_PUB_DCUDR) --#define DDR0_PUB_DCURR (0x1000 + (0x62 << 2)) --#define P_DDR0_PUB_DCURR MMC_REG_ADDR(DDR0_PUB_DCURR) --#define DDR0_PUB_DCULR (0x1000 + (0x63 << 2)) --#define P_DDR0_PUB_DCULR MMC_REG_ADDR(DDR0_PUB_DCULR) --#define DDR0_PUB_DCUGCR (0x1000 + (0x64 << 2)) --#define P_DDR0_PUB_DCUGCR MMC_REG_ADDR(DDR0_PUB_DCUGCR) --#define DDR0_PUB_DCUTPR (0x1000 + (0x65 << 2)) --#define P_DDR0_PUB_DCUTPR MMC_REG_ADDR(DDR0_PUB_DCUTPR) --#define DDR0_PUB_DCUSR0 (0x1000 + (0x66 << 2)) --#define P_DDR0_PUB_DCUSR0 MMC_REG_ADDR(DDR0_PUB_DCUSR0) --#define DDR0_PUB_DCUSR1 (0x1000 + (0x67 << 2)) --#define P_DDR0_PUB_DCUSR1 MMC_REG_ADDR(DDR0_PUB_DCUSR1) --#define DDR0_PUB_BISTRR (0x1000 + (0x70 << 2)) --#define P_DDR0_PUB_BISTRR MMC_REG_ADDR(DDR0_PUB_BISTRR) --#define DDR0_PUB_BISTWCR (0x1000 + (0x71 << 2)) --#define P_DDR0_PUB_BISTWCR MMC_REG_ADDR(DDR0_PUB_BISTWCR) --#define DDR0_PUB_BISTMSKR0 (0x1000 + (0x72 << 2)) --#define P_DDR0_PUB_BISTMSKR0 MMC_REG_ADDR(DDR0_PUB_BISTMSKR0) --#define DDR0_PUB_BISTMSKR1 (0x1000 + (0x73 << 2)) --#define P_DDR0_PUB_BISTMSKR1 MMC_REG_ADDR(DDR0_PUB_BISTMSKR1) --#define DDR0_PUB_BISTMSKR2 (0x1000 + (0x74 << 2)) --#define P_DDR0_PUB_BISTMSKR2 MMC_REG_ADDR(DDR0_PUB_BISTMSKR2) --#define DDR0_PUB_BISTLSR (0x1000 + (0x75 << 2)) --#define P_DDR0_PUB_BISTLSR MMC_REG_ADDR(DDR0_PUB_BISTLSR) --#define DDR0_PUB_BISTAR0 (0x1000 + (0x76 << 2)) --#define P_DDR0_PUB_BISTAR0 MMC_REG_ADDR(DDR0_PUB_BISTAR0) --#define DDR0_PUB_BISTAR1 (0x1000 + (0x77 << 2)) --#define P_DDR0_PUB_BISTAR1 MMC_REG_ADDR(DDR0_PUB_BISTAR1) --#define DDR0_PUB_BISTAR2 (0x1000 + (0x78 << 2)) --#define P_DDR0_PUB_BISTAR2 MMC_REG_ADDR(DDR0_PUB_BISTAR2) --#define DDR0_PUB_BISTUDPR (0x1000 + (0x79 << 2)) --#define P_DDR0_PUB_BISTUDPR MMC_REG_ADDR(DDR0_PUB_BISTUDPR) --#define DDR0_PUB_BISTGSR (0x1000 + (0x7A << 2)) --#define P_DDR0_PUB_BISTGSR MMC_REG_ADDR(DDR0_PUB_BISTGSR) --#define DDR0_PUB_BISTWER (0x1000 + (0x7B << 2)) --#define P_DDR0_PUB_BISTWER MMC_REG_ADDR(DDR0_PUB_BISTWER) --#define DDR0_PUB_BISTBER0 (0x1000 + (0x7C << 2)) --#define P_DDR0_PUB_BISTBER0 MMC_REG_ADDR(DDR0_PUB_BISTBER0) --#define DDR0_PUB_BISTBER1 (0x1000 + (0x7D << 2)) --#define P_DDR0_PUB_BISTBER1 MMC_REG_ADDR(DDR0_PUB_BISTBER1) --#define DDR0_PUB_BISTBER2 (0x1000 + (0x7E << 2)) --#define P_DDR0_PUB_BISTBER2 MMC_REG_ADDR(DDR0_PUB_BISTBER2) --#define DDR0_PUB_BISTBER3 (0x1000 + (0x7F << 2)) --#define P_DDR0_PUB_BISTBER3 MMC_REG_ADDR(DDR0_PUB_BISTBER3) --#define DDR0_PUB_BISTWCSR (0x1000 + (0x80 << 2)) --#define P_DDR0_PUB_BISTWCSR MMC_REG_ADDR(DDR0_PUB_BISTWCSR) --#define DDR0_PUB_BISTFWR0 (0x1000 + (0x81 << 2)) --#define P_DDR0_PUB_BISTFWR0 MMC_REG_ADDR(DDR0_PUB_BISTFWR0) --#define DDR0_PUB_BISTFWR1 (0x1000 + (0x82 << 2)) --#define P_DDR0_PUB_BISTFWR1 MMC_REG_ADDR(DDR0_PUB_BISTFWR1) --#define DDR0_PUB_BISTFWR2 (0x1000 + (0x83 << 2)) --#define P_DDR0_PUB_BISTFWR2 MMC_REG_ADDR(DDR0_PUB_BISTFWR2) --#define DDR0_PUB_IOVCR0 (0x1000 + (0x8E << 2)) --#define P_DDR0_PUB_IOVCR0 MMC_REG_ADDR(DDR0_PUB_IOVCR0) --#define DDR0_PUB_IOVCR1 (0x1000 + (0x8F << 2)) --#define P_DDR0_PUB_IOVCR1 MMC_REG_ADDR(DDR0_PUB_IOVCR1) --#define DDR0_PUB_ZQCR (0x1000 + (0x90 << 2)) --#define P_DDR0_PUB_ZQCR MMC_REG_ADDR(DDR0_PUB_ZQCR) --#define DDR0_PUB_ZQ0PR (0x1000 + (0x91 << 2)) --#define P_DDR0_PUB_ZQ0PR MMC_REG_ADDR(DDR0_PUB_ZQ0PR) --#define DDR0_PUB_ZQ0DR (0x1000 + (0x92 << 2)) --#define P_DDR0_PUB_ZQ0DR MMC_REG_ADDR(DDR0_PUB_ZQ0DR) --#define DDR0_PUB_ZQ0SR (0x1000 + (0x93 << 2)) --#define P_DDR0_PUB_ZQ0SR MMC_REG_ADDR(DDR0_PUB_ZQ0SR) --#define DDR0_PUB_ZQ1PR (0x1000 + (0x95 << 2)) --#define P_DDR0_PUB_ZQ1PR MMC_REG_ADDR(DDR0_PUB_ZQ1PR) --#define DDR0_PUB_ZQ1DR (0x1000 + (0x96 << 2)) --#define P_DDR0_PUB_ZQ1DR MMC_REG_ADDR(DDR0_PUB_ZQ1DR) --#define DDR0_PUB_ZQ1SR (0x1000 + (0x97 << 2)) --#define P_DDR0_PUB_ZQ1SR MMC_REG_ADDR(DDR0_PUB_ZQ1SR) --#define DDR0_PUB_ZQ2PR (0x1000 + (0x99 << 2)) --#define P_DDR0_PUB_ZQ2PR MMC_REG_ADDR(DDR0_PUB_ZQ2PR) --#define DDR0_PUB_ZQ2DR (0x1000 + (0x9A << 2)) --#define P_DDR0_PUB_ZQ2DR MMC_REG_ADDR(DDR0_PUB_ZQ2DR) --#define DDR0_PUB_ZQ2SR (0x1000 + (0x9B << 2)) --#define P_DDR0_PUB_ZQ2SR MMC_REG_ADDR(DDR0_PUB_ZQ2SR) --#define DDR0_PUB_ZQ3PR (0x1000 + (0x9D << 2)) --#define P_DDR0_PUB_ZQ3PR MMC_REG_ADDR(DDR0_PUB_ZQ3PR) --#define DDR0_PUB_ZQ3DR (0x1000 + (0x9E << 2)) --#define P_DDR0_PUB_ZQ3DR MMC_REG_ADDR(DDR0_PUB_ZQ3DR) --#define DDR0_PUB_ZQ3SR (0x1000 + (0x9F << 2)) --#define P_DDR0_PUB_ZQ3SR MMC_REG_ADDR(DDR0_PUB_ZQ3SR) --#define DDR0_PUB_DX0GCR0 (0x1000 + (0xA0 << 2)) --#define P_DDR0_PUB_DX0GCR0 MMC_REG_ADDR(DDR0_PUB_DX0GCR0) --#define DDR0_PUB_DX0GCR1 (0x1000 + (0xA1 << 2)) --#define P_DDR0_PUB_DX0GCR1 MMC_REG_ADDR(DDR0_PUB_DX0GCR1) --#define DDR0_PUB_DX0GCR2 (0x1000 + (0xA2 << 2)) --#define P_DDR0_PUB_DX0GCR2 MMC_REG_ADDR(DDR0_PUB_DX0GCR2) --#define DDR0_PUB_DX0GCR3 (0x1000 + (0xA3 << 2)) --#define P_DDR0_PUB_DX0GCR3 MMC_REG_ADDR(DDR0_PUB_DX0GCR3) --#define DDR0_PUB_DX0GSR0 (0x1000 + (0xA4 << 2)) --#define P_DDR0_PUB_DX0GSR0 MMC_REG_ADDR(DDR0_PUB_DX0GSR0) --#define DDR0_PUB_DX0GSR1 (0x1000 + (0xA5 << 2)) --#define P_DDR0_PUB_DX0GSR1 MMC_REG_ADDR(DDR0_PUB_DX0GSR1) --#define DDR0_PUB_DX0GSR2 (0x1000 + (0xA6 << 2)) --#define P_DDR0_PUB_DX0GSR2 MMC_REG_ADDR(DDR0_PUB_DX0GSR2) --#define DDR0_PUB_DX0BDLR0 (0x1000 + (0xA7 << 2)) --#define P_DDR0_PUB_DX0BDLR0 MMC_REG_ADDR(DDR0_PUB_DX0BDLR0) --#define DDR0_PUB_DX0BDLR1 (0x1000 + (0xA8 << 2)) --#define P_DDR0_PUB_DX0BDLR1 MMC_REG_ADDR(DDR0_PUB_DX0BDLR1) --#define DDR0_PUB_DX0BDLR2 (0x1000 + (0xA9 << 2)) --#define P_DDR0_PUB_DX0BDLR2 MMC_REG_ADDR(DDR0_PUB_DX0BDLR2) --#define DDR0_PUB_DX0BDLR3 (0x1000 + (0xAA << 2)) --#define P_DDR0_PUB_DX0BDLR3 MMC_REG_ADDR(DDR0_PUB_DX0BDLR3) --#define DDR0_PUB_DX0BDLR4 (0x1000 + (0xAB << 2)) --#define P_DDR0_PUB_DX0BDLR4 MMC_REG_ADDR(DDR0_PUB_DX0BDLR4) --#define DDR0_PUB_DX0BDLR5 (0x1000 + (0xAC << 2)) --#define P_DDR0_PUB_DX0BDLR5 MMC_REG_ADDR(DDR0_PUB_DX0BDLR5) --#define DDR0_PUB_DX0BDLR6 (0x1000 + (0xAD << 2)) --#define P_DDR0_PUB_DX0BDLR6 MMC_REG_ADDR(DDR0_PUB_DX0BDLR6) --#define DDR0_PUB_DX0LCDLR0 (0x1000 + (0xAE << 2)) --#define P_DDR0_PUB_DX0LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX0LCDLR0) --#define DDR0_PUB_DX0LCDLR1 (0x1000 + (0xAF << 2)) --#define P_DDR0_PUB_DX0LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX0LCDLR1) --#define DDR0_PUB_DX0LCDLR2 (0x1000 + (0xB0 << 2)) --#define P_DDR0_PUB_DX0LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX0LCDLR2) --#define DDR0_PUB_DX0MDLR (0x1000 + (0xB1 << 2)) --#define P_DDR0_PUB_DX0MDLR MMC_REG_ADDR(DDR0_PUB_DX0MDLR) --#define DDR0_PUB_DX0GTR (0x1000 + (0xB2 << 2)) --#define P_DDR0_PUB_DX0GTR MMC_REG_ADDR(DDR0_PUB_DX0GTR) --#define DDR0_PUB_DX1GCR0 (0x1000 + (0xC0 << 2)) --#define P_DDR0_PUB_DX1GCR0 MMC_REG_ADDR(DDR0_PUB_DX1GCR0) --#define DDR0_PUB_DX1GCR1 (0x1000 + (0xC1 << 2)) --#define P_DDR0_PUB_DX1GCR1 MMC_REG_ADDR(DDR0_PUB_DX1GCR1) --#define DDR0_PUB_DX1GCR2 (0x1000 + (0xC2 << 2)) --#define P_DDR0_PUB_DX1GCR2 MMC_REG_ADDR(DDR0_PUB_DX1GCR2) --#define DDR0_PUB_DX1GCR3 (0x1000 + (0xC3 << 2)) --#define P_DDR0_PUB_DX1GCR3 MMC_REG_ADDR(DDR0_PUB_DX1GCR3) --#define DDR0_PUB_DX1GSR0 (0x1000 + (0xC4 << 2)) --#define P_DDR0_PUB_DX1GSR0 MMC_REG_ADDR(DDR0_PUB_DX1GSR0) --#define DDR0_PUB_DX1GSR1 (0x1000 + (0xC5 << 2)) --#define P_DDR0_PUB_DX1GSR1 MMC_REG_ADDR(DDR0_PUB_DX1GSR1) --#define DDR0_PUB_DX1GSR2 (0x1000 + (0xC6 << 2)) --#define P_DDR0_PUB_DX1GSR2 MMC_REG_ADDR(DDR0_PUB_DX1GSR2) --#define DDR0_PUB_DX1BDLR0 (0x1000 + (0xC7 << 2)) --#define P_DDR0_PUB_DX1BDLR0 MMC_REG_ADDR(DDR0_PUB_DX1BDLR0) --#define DDR0_PUB_DX1BDLR1 (0x1000 + (0xC8 << 2)) --#define P_DDR0_PUB_DX1BDLR1 MMC_REG_ADDR(DDR0_PUB_DX1BDLR1) --#define DDR0_PUB_DX1BDLR2 (0x1000 + (0xC9 << 2)) --#define P_DDR0_PUB_DX1BDLR2 MMC_REG_ADDR(DDR0_PUB_DX1BDLR2) --#define DDR0_PUB_DX1BDLR3 (0x1000 + (0xCA << 2)) --#define P_DDR0_PUB_DX1BDLR3 MMC_REG_ADDR(DDR0_PUB_DX1BDLR3) --#define DDR0_PUB_DX1BDLR4 (0x1000 + (0xCB << 2)) --#define P_DDR0_PUB_DX1BDLR4 MMC_REG_ADDR(DDR0_PUB_DX1BDLR4) --#define DDR0_PUB_DX1BDLR5 (0x1000 + (0xCC << 2)) --#define P_DDR0_PUB_DX1BDLR5 MMC_REG_ADDR(DDR0_PUB_DX1BDLR5) --#define DDR0_PUB_DX1BDLR6 (0x1000 + (0xCD << 2)) --#define P_DDR0_PUB_DX1BDLR6 MMC_REG_ADDR(DDR0_PUB_DX1BDLR6) --#define DDR0_PUB_DX1LCDLR0 (0x1000 + (0xCE << 2)) --#define P_DDR0_PUB_DX1LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX1LCDLR0) --#define DDR0_PUB_DX1LCDLR1 (0x1000 + (0xCF << 2)) --#define P_DDR0_PUB_DX1LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX1LCDLR1) --#define DDR0_PUB_DX1LCDLR2 (0x1000 + (0xD0 << 2)) --#define P_DDR0_PUB_DX1LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX1LCDLR2) --#define DDR0_PUB_DX1MDLR (0x1000 + (0xD1 << 2)) --#define P_DDR0_PUB_DX1MDLR MMC_REG_ADDR(DDR0_PUB_DX1MDLR) --#define DDR0_PUB_DX1GTR (0x1000 + (0xD2 << 2)) --#define P_DDR0_PUB_DX1GTR MMC_REG_ADDR(DDR0_PUB_DX1GTR) --#define DDR0_PUB_DX2GCR0 (0x1000 + (0xE0 << 2)) --#define P_DDR0_PUB_DX2GCR0 MMC_REG_ADDR(DDR0_PUB_DX2GCR0) --#define DDR0_PUB_DX2GCR1 (0x1000 + (0xE1 << 2)) --#define P_DDR0_PUB_DX2GCR1 MMC_REG_ADDR(DDR0_PUB_DX2GCR1) --#define DDR0_PUB_DX2GCR2 (0x1000 + (0xE2 << 2)) --#define P_DDR0_PUB_DX2GCR2 MMC_REG_ADDR(DDR0_PUB_DX2GCR2) --#define DDR0_PUB_DX2GCR3 (0x1000 + (0xE3 << 2)) --#define P_DDR0_PUB_DX2GCR3 MMC_REG_ADDR(DDR0_PUB_DX2GCR3) --#define DDR0_PUB_DX2GSR0 (0x1000 + (0xE4 << 2)) --#define P_DDR0_PUB_DX2GSR0 MMC_REG_ADDR(DDR0_PUB_DX2GSR0) --#define DDR0_PUB_DX2GSR1 (0x1000 + (0xE5 << 2)) --#define P_DDR0_PUB_DX2GSR1 MMC_REG_ADDR(DDR0_PUB_DX2GSR1) --#define DDR0_PUB_DX2GSR2 (0x1000 + (0xE6 << 2)) --#define P_DDR0_PUB_DX2GSR2 MMC_REG_ADDR(DDR0_PUB_DX2GSR2) --#define DDR0_PUB_DX2BDLR0 (0x1000 + (0xE7 << 2)) --#define P_DDR0_PUB_DX2BDLR0 MMC_REG_ADDR(DDR0_PUB_DX2BDLR0) --#define DDR0_PUB_DX2BDLR1 (0x1000 + (0xE8 << 2)) --#define P_DDR0_PUB_DX2BDLR1 MMC_REG_ADDR(DDR0_PUB_DX2BDLR1) --#define DDR0_PUB_DX2BDLR2 (0x1000 + (0xE9 << 2)) --#define P_DDR0_PUB_DX2BDLR2 MMC_REG_ADDR(DDR0_PUB_DX2BDLR2) --#define DDR0_PUB_DX2BDLR3 (0x1000 + (0xEA << 2)) --#define P_DDR0_PUB_DX2BDLR3 MMC_REG_ADDR(DDR0_PUB_DX2BDLR3) --#define DDR0_PUB_DX2BDLR4 (0x1000 + (0xEB << 2)) --#define P_DDR0_PUB_DX2BDLR4 MMC_REG_ADDR(DDR0_PUB_DX2BDLR4) --#define DDR0_PUB_DX2BDLR5 (0x1000 + (0xEC << 2)) --#define P_DDR0_PUB_DX2BDLR5 MMC_REG_ADDR(DDR0_PUB_DX2BDLR5) --#define DDR0_PUB_DX2BDLR6 (0x1000 + (0xED << 2)) --#define P_DDR0_PUB_DX2BDLR6 MMC_REG_ADDR(DDR0_PUB_DX2BDLR6) --#define DDR0_PUB_DX2LCDLR0 (0x1000 + (0xEE << 2)) --#define P_DDR0_PUB_DX2LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX2LCDLR0) --#define DDR0_PUB_DX2LCDLR1 (0x1000 + (0xEF << 2)) --#define P_DDR0_PUB_DX2LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX2LCDLR1) --#define DDR0_PUB_DX2LCDLR2 (0x1000 + (0xF0 << 2)) --#define P_DDR0_PUB_DX2LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX2LCDLR2) --#define DDR0_PUB_DX2MDLR (0x1000 + (0xF1 << 2)) --#define P_DDR0_PUB_DX2MDLR MMC_REG_ADDR(DDR0_PUB_DX2MDLR) --#define DDR0_PUB_DX2GTR (0x1000 + (0xF2 << 2)) --#define P_DDR0_PUB_DX2GTR MMC_REG_ADDR(DDR0_PUB_DX2GTR) --#define DDR0_PUB_DX3GCR0 (0x1000 + (0x100 << 2)) --#define P_DDR0_PUB_DX3GCR0 MMC_REG_ADDR(DDR0_PUB_DX3GCR0) --#define DDR0_PUB_DX3GCR1 (0x1000 + (0x101 << 2)) --#define P_DDR0_PUB_DX3GCR1 MMC_REG_ADDR(DDR0_PUB_DX3GCR1) --#define DDR0_PUB_DX3GCR2 (0x1000 + (0x102 << 2)) --#define P_DDR0_PUB_DX3GCR2 MMC_REG_ADDR(DDR0_PUB_DX3GCR2) --#define DDR0_PUB_DX3GCR3 (0x1000 + (0x103 << 2)) --#define P_DDR0_PUB_DX3GCR3 MMC_REG_ADDR(DDR0_PUB_DX3GCR3) --#define DDR0_PUB_DX3GSR0 (0x1000 + (0x104 << 2)) --#define P_DDR0_PUB_DX3GSR0 MMC_REG_ADDR(DDR0_PUB_DX3GSR0) --#define DDR0_PUB_DX3GSR1 (0x1000 + (0x105 << 2)) --#define P_DDR0_PUB_DX3GSR1 MMC_REG_ADDR(DDR0_PUB_DX3GSR1) --#define DDR0_PUB_DX3GSR2 (0x1000 + (0x106 << 2)) --#define P_DDR0_PUB_DX3GSR2 MMC_REG_ADDR(DDR0_PUB_DX3GSR2) --#define DDR0_PUB_DX3BDLR0 (0x1000 + (0x107 << 2)) --#define P_DDR0_PUB_DX3BDLR0 MMC_REG_ADDR(DDR0_PUB_DX3BDLR0) --#define DDR0_PUB_DX3BDLR1 (0x1000 + (0x108 << 2)) --#define P_DDR0_PUB_DX3BDLR1 MMC_REG_ADDR(DDR0_PUB_DX3BDLR1) --#define DDR0_PUB_DX3BDLR2 (0x1000 + (0x109 << 2)) --#define P_DDR0_PUB_DX3BDLR2 MMC_REG_ADDR(DDR0_PUB_DX3BDLR2) --#define DDR0_PUB_DX3BDLR3 (0x1000 + (0x10A << 2)) --#define P_DDR0_PUB_DX3BDLR3 MMC_REG_ADDR(DDR0_PUB_DX3BDLR3) --#define DDR0_PUB_DX3BDLR4 (0x1000 + (0x10B << 2)) --#define P_DDR0_PUB_DX3BDLR4 MMC_REG_ADDR(DDR0_PUB_DX3BDLR4) --#define DDR0_PUB_DX3BDLR5 (0x1000 + (0x10C << 2)) --#define P_DDR0_PUB_DX3BDLR5 MMC_REG_ADDR(DDR0_PUB_DX3BDLR5) --#define DDR0_PUB_DX3BDLR6 (0x1000 + (0x10D << 2)) --#define P_DDR0_PUB_DX3BDLR6 MMC_REG_ADDR(DDR0_PUB_DX3BDLR6) --#define DDR0_PUB_DX3LCDLR0 (0x1000 + (0x10E << 2)) --#define P_DDR0_PUB_DX3LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX3LCDLR0) --#define DDR0_PUB_DX3LCDLR1 (0x1000 + (0x10F << 2)) --#define P_DDR0_PUB_DX3LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX3LCDLR1) --#define DDR0_PUB_DX3LCDLR2 (0x1000 + (0x110 << 2)) --#define P_DDR0_PUB_DX3LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX3LCDLR2) --#define DDR0_PUB_DX3MDLR (0x1000 + (0x111 << 2)) --#define P_DDR0_PUB_DX3MDLR MMC_REG_ADDR(DDR0_PUB_DX3MDLR) --#define DDR0_PUB_DX3GTR (0x1000 + (0x112 << 2)) --#define P_DDR0_PUB_DX3GTR MMC_REG_ADDR(DDR0_PUB_DX3GTR) --#define DDR0_PUB_DX4GCR0 (0x1000 + (0x120 << 2)) --#define P_DDR0_PUB_DX4GCR0 MMC_REG_ADDR(DDR0_PUB_DX4GCR0) --#define DDR0_PUB_DX4GCR1 (0x1000 + (0x121 << 2)) --#define P_DDR0_PUB_DX4GCR1 MMC_REG_ADDR(DDR0_PUB_DX4GCR1) --#define DDR0_PUB_DX4GCR2 (0x1000 + (0x122 << 2)) --#define P_DDR0_PUB_DX4GCR2 MMC_REG_ADDR(DDR0_PUB_DX4GCR2) --#define DDR0_PUB_DX4GCR3 (0x1000 + (0x123 << 2)) --#define P_DDR0_PUB_DX4GCR3 MMC_REG_ADDR(DDR0_PUB_DX4GCR3) --#define DDR0_PUB_DX4GSR0 (0x1000 + (0x124 << 2)) --#define P_DDR0_PUB_DX4GSR0 MMC_REG_ADDR(DDR0_PUB_DX4GSR0) --#define DDR0_PUB_DX4GSR1 (0x1000 + (0x125 << 2)) --#define P_DDR0_PUB_DX4GSR1 MMC_REG_ADDR(DDR0_PUB_DX4GSR1) --#define DDR0_PUB_DX4GSR2 (0x1000 + (0x126 << 2)) --#define P_DDR0_PUB_DX4GSR2 MMC_REG_ADDR(DDR0_PUB_DX4GSR2) --#define DDR0_PUB_DX4BDLR0 (0x1000 + (0x127 << 2)) --#define P_DDR0_PUB_DX4BDLR0 MMC_REG_ADDR(DDR0_PUB_DX4BDLR0) --#define DDR0_PUB_DX4BDLR1 (0x1000 + (0x128 << 2)) --#define P_DDR0_PUB_DX4BDLR1 MMC_REG_ADDR(DDR0_PUB_DX4BDLR1) --#define DDR0_PUB_DX4BDLR2 (0x1000 + (0x129 << 2)) --#define P_DDR0_PUB_DX4BDLR2 MMC_REG_ADDR(DDR0_PUB_DX4BDLR2) --#define DDR0_PUB_DX4BDLR3 (0x1000 + (0x12A << 2)) --#define P_DDR0_PUB_DX4BDLR3 MMC_REG_ADDR(DDR0_PUB_DX4BDLR3) --#define DDR0_PUB_DX4BDLR4 (0x1000 + (0x12B << 2)) --#define P_DDR0_PUB_DX4BDLR4 MMC_REG_ADDR(DDR0_PUB_DX4BDLR4) --#define DDR0_PUB_DX4BDLR5 (0x1000 + (0x12C << 2)) --#define P_DDR0_PUB_DX4BDLR5 MMC_REG_ADDR(DDR0_PUB_DX4BDLR5) --#define DDR0_PUB_DX4BDLR6 (0x1000 + (0x12D << 2)) --#define P_DDR0_PUB_DX4BDLR6 MMC_REG_ADDR(DDR0_PUB_DX4BDLR6) --#define DDR0_PUB_DX4LCDLR0 (0x1000 + (0x12E << 2)) --#define P_DDR0_PUB_DX4LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX4LCDLR0) --#define DDR0_PUB_DX4LCDLR1 (0x1000 + (0x12F << 2)) --#define P_DDR0_PUB_DX4LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX4LCDLR1) --#define DDR0_PUB_DX4LCDLR2 (0x1000 + (0x130 << 2)) --#define P_DDR0_PUB_DX4LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX4LCDLR2) --#define DDR0_PUB_DX4MDLR (0x1000 + (0x131 << 2)) --#define P_DDR0_PUB_DX4MDLR MMC_REG_ADDR(DDR0_PUB_DX4MDLR) --#define DDR0_PUB_DX4GTR (0x1000 + (0x132 << 2)) --#define P_DDR0_PUB_DX4GTR MMC_REG_ADDR(DDR0_PUB_DX4GTR) --#define DDR0_PUB_DX5GCR0 (0x1000 + (0x140 << 2)) --#define P_DDR0_PUB_DX5GCR0 MMC_REG_ADDR(DDR0_PUB_DX5GCR0) --#define DDR0_PUB_DX5GCR1 (0x1000 + (0x141 << 2)) --#define P_DDR0_PUB_DX5GCR1 MMC_REG_ADDR(DDR0_PUB_DX5GCR1) --#define DDR0_PUB_DX5GCR2 (0x1000 + (0x142 << 2)) --#define P_DDR0_PUB_DX5GCR2 MMC_REG_ADDR(DDR0_PUB_DX5GCR2) --#define DDR0_PUB_DX5GCR3 (0x1000 + (0x143 << 2)) --#define P_DDR0_PUB_DX5GCR3 MMC_REG_ADDR(DDR0_PUB_DX5GCR3) --#define DDR0_PUB_DX5GSR0 (0x1000 + (0x144 << 2)) --#define P_DDR0_PUB_DX5GSR0 MMC_REG_ADDR(DDR0_PUB_DX5GSR0) --#define DDR0_PUB_DX5GSR1 (0x1000 + (0x145 << 2)) --#define P_DDR0_PUB_DX5GSR1 MMC_REG_ADDR(DDR0_PUB_DX5GSR1) --#define DDR0_PUB_DX5GSR2 (0x1000 + (0x146 << 2)) --#define P_DDR0_PUB_DX5GSR2 MMC_REG_ADDR(DDR0_PUB_DX5GSR2) --#define DDR0_PUB_DX5BDLR0 (0x1000 + (0x147 << 2)) --#define P_DDR0_PUB_DX5BDLR0 MMC_REG_ADDR(DDR0_PUB_DX5BDLR0) --#define DDR0_PUB_DX5BDLR1 (0x1000 + (0x148 << 2)) --#define P_DDR0_PUB_DX5BDLR1 MMC_REG_ADDR(DDR0_PUB_DX5BDLR1) --#define DDR0_PUB_DX5BDLR2 (0x1000 + (0x149 << 2)) --#define P_DDR0_PUB_DX5BDLR2 MMC_REG_ADDR(DDR0_PUB_DX5BDLR2) --#define DDR0_PUB_DX5BDLR3 (0x1000 + (0x14A << 2)) --#define P_DDR0_PUB_DX5BDLR3 MMC_REG_ADDR(DDR0_PUB_DX5BDLR3) --#define DDR0_PUB_DX5BDLR4 (0x1000 + (0x14B << 2)) --#define P_DDR0_PUB_DX5BDLR4 MMC_REG_ADDR(DDR0_PUB_DX5BDLR4) --#define DDR0_PUB_DX5BDLR5 (0x1000 + (0x14C << 2)) --#define P_DDR0_PUB_DX5BDLR5 MMC_REG_ADDR(DDR0_PUB_DX5BDLR5) --#define DDR0_PUB_DX5BDLR6 (0x1000 + (0x14D << 2)) --#define P_DDR0_PUB_DX5BDLR6 MMC_REG_ADDR(DDR0_PUB_DX5BDLR6) --#define DDR0_PUB_DX5LCDLR0 (0x1000 + (0x14E << 2)) --#define P_DDR0_PUB_DX5LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX5LCDLR0) --#define DDR0_PUB_DX5LCDLR1 (0x1000 + (0x14F << 2)) --#define P_DDR0_PUB_DX5LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX5LCDLR1) --#define DDR0_PUB_DX5LCDLR2 (0x1000 + (0x150 << 2)) --#define P_DDR0_PUB_DX5LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX5LCDLR2) --#define DDR0_PUB_DX5MDLR (0x1000 + (0x151 << 2)) --#define P_DDR0_PUB_DX5MDLR MMC_REG_ADDR(DDR0_PUB_DX5MDLR) --#define DDR0_PUB_DX5GTR (0x1000 + (0x152 << 2)) --#define P_DDR0_PUB_DX5GTR MMC_REG_ADDR(DDR0_PUB_DX5GTR) --#define DDR0_PUB_DX6GCR0 (0x1000 + (0x160 << 2)) --#define P_DDR0_PUB_DX6GCR0 MMC_REG_ADDR(DDR0_PUB_DX6GCR0) --#define DDR0_PUB_DX6GCR1 (0x1000 + (0x161 << 2)) --#define P_DDR0_PUB_DX6GCR1 MMC_REG_ADDR(DDR0_PUB_DX6GCR1) --#define DDR0_PUB_DX6GCR2 (0x1000 + (0x162 << 2)) --#define P_DDR0_PUB_DX6GCR2 MMC_REG_ADDR(DDR0_PUB_DX6GCR2) --#define DDR0_PUB_DX6GCR3 (0x1000 + (0x163 << 2)) --#define P_DDR0_PUB_DX6GCR3 MMC_REG_ADDR(DDR0_PUB_DX6GCR3) --#define DDR0_PUB_DX6GSR0 (0x1000 + (0x164 << 2)) --#define P_DDR0_PUB_DX6GSR0 MMC_REG_ADDR(DDR0_PUB_DX6GSR0) --#define DDR0_PUB_DX6GSR1 (0x1000 + (0x165 << 2)) --#define P_DDR0_PUB_DX6GSR1 MMC_REG_ADDR(DDR0_PUB_DX6GSR1) --#define DDR0_PUB_DX6GSR2 (0x1000 + (0x166 << 2)) --#define P_DDR0_PUB_DX6GSR2 MMC_REG_ADDR(DDR0_PUB_DX6GSR2) --#define DDR0_PUB_DX6BDLR0 (0x1000 + (0x167 << 2)) --#define P_DDR0_PUB_DX6BDLR0 MMC_REG_ADDR(DDR0_PUB_DX6BDLR0) --#define DDR0_PUB_DX6BDLR1 (0x1000 + (0x168 << 2)) --#define P_DDR0_PUB_DX6BDLR1 MMC_REG_ADDR(DDR0_PUB_DX6BDLR1) --#define DDR0_PUB_DX6BDLR2 (0x1000 + (0x169 << 2)) --#define P_DDR0_PUB_DX6BDLR2 MMC_REG_ADDR(DDR0_PUB_DX6BDLR2) --#define DDR0_PUB_DX6BDLR3 (0x1000 + (0x16A << 2)) --#define P_DDR0_PUB_DX6BDLR3 MMC_REG_ADDR(DDR0_PUB_DX6BDLR3) --#define DDR0_PUB_DX6BDLR4 (0x1000 + (0x16B << 2)) --#define P_DDR0_PUB_DX6BDLR4 MMC_REG_ADDR(DDR0_PUB_DX6BDLR4) --#define DDR0_PUB_DX6BDLR5 (0x1000 + (0x16C << 2)) --#define P_DDR0_PUB_DX6BDLR5 MMC_REG_ADDR(DDR0_PUB_DX6BDLR5) --#define DDR0_PUB_DX6BDLR6 (0x1000 + (0x16D << 2)) --#define P_DDR0_PUB_DX6BDLR6 MMC_REG_ADDR(DDR0_PUB_DX6BDLR6) --#define DDR0_PUB_DX6LCDLR0 (0x1000 + (0x16E << 2)) --#define P_DDR0_PUB_DX6LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX6LCDLR0) --#define DDR0_PUB_DX6LCDLR1 (0x1000 + (0x16F << 2)) --#define P_DDR0_PUB_DX6LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX6LCDLR1) --#define DDR0_PUB_DX6LCDLR2 (0x1000 + (0x170 << 2)) --#define P_DDR0_PUB_DX6LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX6LCDLR2) --#define DDR0_PUB_DX6MDLR (0x1000 + (0x171 << 2)) --#define P_DDR0_PUB_DX6MDLR MMC_REG_ADDR(DDR0_PUB_DX6MDLR) --#define DDR0_PUB_DX6GTR (0x1000 + (0x172 << 2)) --#define P_DDR0_PUB_DX6GTR MMC_REG_ADDR(DDR0_PUB_DX6GTR) --#define DDR0_PUB_DX7GCR0 (0x1000 + (0x180 << 2)) --#define P_DDR0_PUB_DX7GCR0 MMC_REG_ADDR(DDR0_PUB_DX7GCR0) --#define DDR0_PUB_DX7GCR1 (0x1000 + (0x181 << 2)) --#define P_DDR0_PUB_DX7GCR1 MMC_REG_ADDR(DDR0_PUB_DX7GCR1) --#define DDR0_PUB_DX7GCR2 (0x1000 + (0x182 << 2)) --#define P_DDR0_PUB_DX7GCR2 MMC_REG_ADDR(DDR0_PUB_DX7GCR2) --#define DDR0_PUB_DX7GCR3 (0x1000 + (0x183 << 2)) --#define P_DDR0_PUB_DX7GCR3 MMC_REG_ADDR(DDR0_PUB_DX7GCR3) --#define DDR0_PUB_DX7GSR0 (0x1000 + (0x184 << 2)) --#define P_DDR0_PUB_DX7GSR0 MMC_REG_ADDR(DDR0_PUB_DX7GSR0) --#define DDR0_PUB_DX7GSR1 (0x1000 + (0x185 << 2)) --#define P_DDR0_PUB_DX7GSR1 MMC_REG_ADDR(DDR0_PUB_DX7GSR1) --#define DDR0_PUB_DX7GSR2 (0x1000 + (0x186 << 2)) --#define P_DDR0_PUB_DX7GSR2 MMC_REG_ADDR(DDR0_PUB_DX7GSR2) --#define DDR0_PUB_DX7BDLR0 (0x1000 + (0x187 << 2)) --#define P_DDR0_PUB_DX7BDLR0 MMC_REG_ADDR(DDR0_PUB_DX7BDLR0) --#define DDR0_PUB_DX7BDLR1 (0x1000 + (0x188 << 2)) --#define P_DDR0_PUB_DX7BDLR1 MMC_REG_ADDR(DDR0_PUB_DX7BDLR1) --#define DDR0_PUB_DX7BDLR2 (0x1000 + (0x189 << 2)) --#define P_DDR0_PUB_DX7BDLR2 MMC_REG_ADDR(DDR0_PUB_DX7BDLR2) --#define DDR0_PUB_DX7BDLR3 (0x1000 + (0x18A << 2)) --#define P_DDR0_PUB_DX7BDLR3 MMC_REG_ADDR(DDR0_PUB_DX7BDLR3) --#define DDR0_PUB_DX7BDLR4 (0x1000 + (0x18B << 2)) --#define P_DDR0_PUB_DX7BDLR4 MMC_REG_ADDR(DDR0_PUB_DX7BDLR4) --#define DDR0_PUB_DX7BDLR5 (0x1000 + (0x18C << 2)) --#define P_DDR0_PUB_DX7BDLR5 MMC_REG_ADDR(DDR0_PUB_DX7BDLR5) --#define DDR0_PUB_DX7BDLR6 (0x1000 + (0x18D << 2)) --#define P_DDR0_PUB_DX7BDLR6 MMC_REG_ADDR(DDR0_PUB_DX7BDLR6) --#define DDR0_PUB_DX7LCDLR0 (0x1000 + (0x18E << 2)) --#define P_DDR0_PUB_DX7LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX7LCDLR0) --#define DDR0_PUB_DX7LCDLR1 (0x1000 + (0x18F << 2)) --#define P_DDR0_PUB_DX7LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX7LCDLR1) --#define DDR0_PUB_DX7LCDLR2 (0x1000 + (0x190 << 2)) --#define P_DDR0_PUB_DX7LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX7LCDLR2) --#define DDR0_PUB_DX7MDLR (0x1000 + (0x191 << 2)) --#define P_DDR0_PUB_DX7MDLR MMC_REG_ADDR(DDR0_PUB_DX7MDLR) --#define DDR0_PUB_DX7GTR (0x1000 + (0x192 << 2)) --#define P_DDR0_PUB_DX7GTR MMC_REG_ADDR(DDR0_PUB_DX7GTR) --#define DDR0_PUB_DX8GCR0 (0x1000 + (0x1A0 << 2)) --#define P_DDR0_PUB_DX8GCR0 MMC_REG_ADDR(DDR0_PUB_DX8GCR0) --#define DDR0_PUB_DX8GCR1 (0x1000 + (0x1A1 << 2)) --#define P_DDR0_PUB_DX8GCR1 MMC_REG_ADDR(DDR0_PUB_DX8GCR1) --#define DDR0_PUB_DX8GCR2 (0x1000 + (0x1A2 << 2)) --#define P_DDR0_PUB_DX8GCR2 MMC_REG_ADDR(DDR0_PUB_DX8GCR2) --#define DDR0_PUB_DX8GCR3 (0x1000 + (0x1A3 << 2)) --#define P_DDR0_PUB_DX8GCR3 MMC_REG_ADDR(DDR0_PUB_DX8GCR3) --#define DDR0_PUB_DX8GSR0 (0x1000 + (0x1A4 << 2)) --#define P_DDR0_PUB_DX8GSR0 MMC_REG_ADDR(DDR0_PUB_DX8GSR0) --#define DDR0_PUB_DX8GSR1 (0x1000 + (0x1A5 << 2)) --#define P_DDR0_PUB_DX8GSR1 MMC_REG_ADDR(DDR0_PUB_DX8GSR1) --#define DDR0_PUB_DX8GSR2 (0x1000 + (0x1A6 << 2)) --#define P_DDR0_PUB_DX8GSR2 MMC_REG_ADDR(DDR0_PUB_DX8GSR2) --#define DDR0_PUB_DX8BDLR0 (0x1000 + (0x1A7 << 2)) --#define P_DDR0_PUB_DX8BDLR0 MMC_REG_ADDR(DDR0_PUB_DX8BDLR0) --#define DDR0_PUB_DX8BDLR1 (0x1000 + (0x1A8 << 2)) --#define P_DDR0_PUB_DX8BDLR1 MMC_REG_ADDR(DDR0_PUB_DX8BDLR1) --#define DDR0_PUB_DX8BDLR2 (0x1000 + (0x1A9 << 2)) --#define P_DDR0_PUB_DX8BDLR2 MMC_REG_ADDR(DDR0_PUB_DX8BDLR2) --#define DDR0_PUB_DX8BDLR3 (0x1000 + (0x1AA << 2)) --#define P_DDR0_PUB_DX8BDLR3 MMC_REG_ADDR(DDR0_PUB_DX8BDLR3) --#define DDR0_PUB_DX8BDLR4 (0x1000 + (0x1AB << 2)) --#define P_DDR0_PUB_DX8BDLR4 MMC_REG_ADDR(DDR0_PUB_DX8BDLR4) --#define DDR0_PUB_DX8BDLR5 (0x1000 + (0x1AC << 2)) --#define P_DDR0_PUB_DX8BDLR5 MMC_REG_ADDR(DDR0_PUB_DX8BDLR5) --#define DDR0_PUB_DX8BDLR6 (0x1000 + (0x1AD << 2)) --#define P_DDR0_PUB_DX8BDLR6 MMC_REG_ADDR(DDR0_PUB_DX8BDLR6) --#define DDR0_PUB_DX8LCDLR0 (0x1000 + (0x1AE << 2)) --#define P_DDR0_PUB_DX8LCDLR0 MMC_REG_ADDR(DDR0_PUB_DX8LCDLR0) --#define DDR0_PUB_DX8LCDLR1 (0x1000 + (0x1AF << 2)) --#define P_DDR0_PUB_DX8LCDLR1 MMC_REG_ADDR(DDR0_PUB_DX8LCDLR1) --#define DDR0_PUB_DX8LCDLR2 (0x1000 + (0x1B0 << 2)) --#define P_DDR0_PUB_DX8LCDLR2 MMC_REG_ADDR(DDR0_PUB_DX8LCDLR2) --#define DDR0_PUB_DX8MDLR (0x1000 + (0x1B1 << 2)) --#define P_DDR0_PUB_DX8MDLR MMC_REG_ADDR(DDR0_PUB_DX8MDLR) --#define DDR0_PUB_DX8GTR (0x1000 + (0x1B2 << 2)) --#define P_DDR0_PUB_DX8GTR MMC_REG_ADDR(DDR0_PUB_DX8GTR) -- --#define DDR1_PCTL_DFILPCFG0 0x22f0 --#define P_DDR1_PCTL_DFILPCFG0 MMC_REG_ADDR(DDR1_PCTL_DFILPCFG0) --#define DDR1_PCTL_DFITRWRLVLDELAY0 0x2318 --#define P_DDR1_PCTL_DFITRWRLVLDELAY0 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRWRLVLDELAY0) --#define DDR1_PCTL_DFITRWRLVLDELAY1 0x231c --#define P_DDR1_PCTL_DFITRWRLVLDELAY1 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRWRLVLDELAY1) --#define DDR1_PCTL_DFITRWRLVLDELAY2 0x2320 --#define P_DDR1_PCTL_DFITRWRLVLDELAY2 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRWRLVLDELAY2) --#define DDR1_PCTL_DFITRRDLVLRESP0 0x230c --#define P_DDR1_PCTL_DFITRRDLVLRESP0 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLRESP0) --#define DDR1_PCTL_DFITRRDLVLRESP1 0x2310 --#define P_DDR1_PCTL_DFITRRDLVLRESP1 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLRESP1) --#define DDR1_PCTL_DFITRRDLVLRESP2 0x2314 --#define P_DDR1_PCTL_DFITRRDLVLRESP2 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLRESP2) --#define DDR1_PCTL_DFITRWRLVLRESP0 0x2300 --#define P_DDR1_PCTL_DFITRWRLVLRESP0 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRWRLVLRESP0) --#define DDR1_PCTL_DFITRRDLVLDELAY0 0x2324 --#define P_DDR1_PCTL_DFITRRDLVLDELAY0 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLDELAY0) --#define DDR1_PCTL_DFITRWRLVLRESP1 0x2304 --#define P_DDR1_PCTL_DFITRWRLVLRESP1 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRWRLVLRESP1) --#define DDR1_PCTL_DFITRRDLVLDELAY2 0x232c --#define P_DDR1_PCTL_DFITRRDLVLDELAY2 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLDELAY2) --#define DDR1_PCTL_DFITRWRLVLRESP2 0x2308 --#define P_DDR1_PCTL_DFITRWRLVLRESP2 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRWRLVLRESP2) --#define DDR1_PCTL_DFITRRDLVLGATEDELAY0 0x2330 --#define P_DDR1_PCTL_DFITRRDLVLGATEDELAY0 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLGATEDELAY0) --#define DDR1_PCTL_DFITRCMD 0x233c --#define P_DDR1_PCTL_DFITRCMD MMC_REG_ADDR(DDR1_PCTL_DFITRCMD) --#define DDR1_PCTL_DFITRRDLVLGATEDELAY1 0x2334 --#define P_DDR1_PCTL_DFITRRDLVLGATEDELAY1 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLGATEDELAY1) --#define DDR1_PCTL_DFITRRDLVLGATEDELAY2 0x2338 --#define P_DDR1_PCTL_DFITRRDLVLGATEDELAY2 \ -- MMC_REG_ADDR(DDR1_PCTL_DFITRRDLVLGATEDELAY2) --#define DDR1_PCTL_IPTR 0x23fc --#define P_DDR1_PCTL_IPTR MMC_REG_ADDR(DDR1_PCTL_IPTR) --#define DDR1_PCTL_IPVR 0x23f8 --#define P_DDR1_PCTL_IPVR MMC_REG_ADDR(DDR1_PCTL_IPVR) --#define DDR1_PUB_RIDR (0x3000 + (0x00 << 2)) --#define P_DDR1_PUB_RIDR MMC_REG_ADDR(DDR1_PUB_RIDR) --#define DDR1_PUB_PIR (0x3000 + (0x01 << 2)) --#define P_DDR1_PUB_PIR MMC_REG_ADDR(DDR1_PUB_PIR) --#define DDR1_PUB_PGCR0 (0x3000 + (0x02 << 2)) --#define P_DDR1_PUB_PGCR0 MMC_REG_ADDR(DDR1_PUB_PGCR0) --#define DDR1_PUB_PGCR1 (0x3000 + (0x03 << 2)) --#define P_DDR1_PUB_PGCR1 MMC_REG_ADDR(DDR1_PUB_PGCR1) --#define DDR1_PUB_PGCR2 (0x3000 + (0x04 << 2)) --#define P_DDR1_PUB_PGCR2 MMC_REG_ADDR(DDR1_PUB_PGCR2) --#define DDR1_PUB_PGCR3 (0x3000 + (0x05 << 2)) --#define P_DDR1_PUB_PGCR3 MMC_REG_ADDR(DDR1_PUB_PGCR3) --#define DDR1_PUB_PGSR0 (0x3000 + (0x06 << 2)) --#define P_DDR1_PUB_PGSR0 MMC_REG_ADDR(DDR1_PUB_PGSR0) --#define DDR1_PUB_PGSR1 (0x3000 + (0x07 << 2)) --#define P_DDR1_PUB_PGSR1 MMC_REG_ADDR(DDR1_PUB_PGSR1) --#define DDR1_PUB_PLLCR (0x3000 + (0x08 << 2)) --#define P_DDR1_PUB_PLLCR MMC_REG_ADDR(DDR1_PUB_PLLCR) --#define DDR1_PUB_PTR0 (0x3000 + (0x09 << 2)) --#define P_DDR1_PUB_PTR0 MMC_REG_ADDR(DDR1_PUB_PTR0) --#define DDR1_PUB_PTR1 (0x3000 + (0x0A << 2)) --#define P_DDR1_PUB_PTR1 MMC_REG_ADDR(DDR1_PUB_PTR1) --#define DDR1_PUB_PTR2 (0x3000 + (0x0B << 2)) --#define P_DDR1_PUB_PTR2 MMC_REG_ADDR(DDR1_PUB_PTR2) --#define DDR1_PUB_PTR3 (0x3000 + (0x0C << 2)) --#define P_DDR1_PUB_PTR3 MMC_REG_ADDR(DDR1_PUB_PTR3) --#define DDR1_PUB_PTR4 (0x3000 + (0x0D << 2)) --#define P_DDR1_PUB_PTR4 MMC_REG_ADDR(DDR1_PUB_PTR4) --#define DDR1_PUB_ACMDLR (0x3000 + (0x0E << 2)) --#define P_DDR1_PUB_ACMDLR MMC_REG_ADDR(DDR1_PUB_ACMDLR) --#define DDR1_PUB_ACLCDLR (0x3000 + (0x0F << 2)) --#define P_DDR1_PUB_ACLCDLR MMC_REG_ADDR(DDR1_PUB_ACLCDLR) --#define DDR1_PUB_ACBDLR0 (0x3000 + (0x10 << 2)) --#define P_DDR1_PUB_ACBDLR0 MMC_REG_ADDR(DDR1_PUB_ACBDLR0) --#define DDR1_PUB_ACBDLR1 (0x3000 + (0x11 << 2)) --#define P_DDR1_PUB_ACBDLR1 MMC_REG_ADDR(DDR1_PUB_ACBDLR1) --#define DDR1_PUB_ACBDLR2 (0x3000 + (0x12 << 2)) --#define P_DDR1_PUB_ACBDLR2 MMC_REG_ADDR(DDR1_PUB_ACBDLR2) --#define DDR1_PUB_ACBDLR3 (0x3000 + (0x13 << 2)) --#define P_DDR1_PUB_ACBDLR3 MMC_REG_ADDR(DDR1_PUB_ACBDLR3) --#define DDR1_PUB_ACBDLR4 (0x3000 + (0x14 << 2)) --#define P_DDR1_PUB_ACBDLR4 MMC_REG_ADDR(DDR1_PUB_ACBDLR4) --#define DDR1_PUB_ACBDLR5 (0x3000 + (0x15 << 2)) --#define P_DDR1_PUB_ACBDLR5 MMC_REG_ADDR(DDR1_PUB_ACBDLR5) --#define DDR1_PUB_ACBDLR6 (0x3000 + (0x16 << 2)) --#define P_DDR1_PUB_ACBDLR6 MMC_REG_ADDR(DDR1_PUB_ACBDLR6) --#define DDR1_PUB_ACBDLR7 (0x3000 + (0x17 << 2)) --#define P_DDR1_PUB_ACBDLR7 MMC_REG_ADDR(DDR1_PUB_ACBDLR7) --#define DDR1_PUB_ACBDLR8 (0x3000 + (0x18 << 2)) --#define P_DDR1_PUB_ACBDLR8 MMC_REG_ADDR(DDR1_PUB_ACBDLR8) --#define DDR1_PUB_ACBDLR9 (0x3000 + (0x19 << 2)) --#define P_DDR1_PUB_ACBDLR9 MMC_REG_ADDR(DDR1_PUB_ACBDLR9) --#define DDR1_PUB_ACIOCR0 (0x3000 + (0x1A << 2)) --#define P_DDR1_PUB_ACIOCR0 MMC_REG_ADDR(DDR1_PUB_ACIOCR0) --#define DDR1_PUB_ACIOCR1 (0x3000 + (0x1B << 2)) --#define P_DDR1_PUB_ACIOCR1 MMC_REG_ADDR(DDR1_PUB_ACIOCR1) --#define DDR1_PUB_ACIOCR2 (0x3000 + (0x1C << 2)) --#define P_DDR1_PUB_ACIOCR2 MMC_REG_ADDR(DDR1_PUB_ACIOCR2) --#define DDR1_PUB_ACIOCR3 (0x3000 + (0x1D << 2)) --#define P_DDR1_PUB_ACIOCR3 MMC_REG_ADDR(DDR1_PUB_ACIOCR3) --#define DDR1_PUB_ACIOCR4 (0x3000 + (0x1E << 2)) --#define P_DDR1_PUB_ACIOCR4 MMC_REG_ADDR(DDR1_PUB_ACIOCR4) --#define DDR1_PUB_ACIOCR5 (0x3000 + (0x1F << 2)) --#define P_DDR1_PUB_ACIOCR5 MMC_REG_ADDR(DDR1_PUB_ACIOCR5) --#define DDR1_PUB_DXCCR (0x3000 + (0x20 << 2)) --#define P_DDR1_PUB_DXCCR MMC_REG_ADDR(DDR1_PUB_DXCCR) --#define DDR1_PUB_DSGCR (0x3000 + (0x21 << 2)) --#define P_DDR1_PUB_DSGCR MMC_REG_ADDR(DDR1_PUB_DSGCR) --#define DDR1_PUB_DCR (0x3000 + (0x22 << 2)) --#define P_DDR1_PUB_DCR MMC_REG_ADDR(DDR1_PUB_DCR) --#define DDR1_PUB_DTPR0 (0x3000 + (0x23 << 2)) --#define P_DDR1_PUB_DTPR0 MMC_REG_ADDR(DDR1_PUB_DTPR0) --#define DDR1_PUB_DTPR1 (0x3000 + (0x24 << 2)) --#define P_DDR1_PUB_DTPR1 MMC_REG_ADDR(DDR1_PUB_DTPR1) --#define DDR1_PUB_DTPR2 (0x3000 + (0x25 << 2)) --#define P_DDR1_PUB_DTPR2 MMC_REG_ADDR(DDR1_PUB_DTPR2) --#define DDR1_PUB_DTPR3 (0x3000 + (0x26 << 2)) --#define P_DDR1_PUB_DTPR3 MMC_REG_ADDR(DDR1_PUB_DTPR3) --#define DDR1_PUB_MR0 (0x3000 + (0x27 << 2)) --#define P_DDR1_PUB_MR0 MMC_REG_ADDR(DDR1_PUB_MR0) --#define DDR1_PUB_MR1 (0x3000 + (0x28 << 2)) --#define P_DDR1_PUB_MR1 MMC_REG_ADDR(DDR1_PUB_MR1) --#define DDR1_PUB_MR2 (0x3000 + (0x29 << 2)) --#define P_DDR1_PUB_MR2 MMC_REG_ADDR(DDR1_PUB_MR2) --#define DDR1_PUB_MR3 (0x3000 + (0x2A << 2)) --#define P_DDR1_PUB_MR3 MMC_REG_ADDR(DDR1_PUB_MR3) --#define DDR1_PUB_ODTCR (0x3000 + (0x2B << 2)) --#define P_DDR1_PUB_ODTCR MMC_REG_ADDR(DDR1_PUB_ODTCR) --#define DDR1_PUB_DTCR (0x3000 + (0x2C << 2)) --#define P_DDR1_PUB_DTCR MMC_REG_ADDR(DDR1_PUB_DTCR) --#define DDR1_PUB_DTAR0 (0x3000 + (0x2D << 2)) --#define P_DDR1_PUB_DTAR0 MMC_REG_ADDR(DDR1_PUB_DTAR0) --#define DDR1_PUB_DTAR1 (0x3000 + (0x2E << 2)) --#define P_DDR1_PUB_DTAR1 MMC_REG_ADDR(DDR1_PUB_DTAR1) --#define DDR1_PUB_DTAR2 (0x3000 + (0x2F << 2)) --#define P_DDR1_PUB_DTAR2 MMC_REG_ADDR(DDR1_PUB_DTAR2) --#define DDR1_PUB_DTAR3 (0x3000 + (0x30 << 2)) --#define P_DDR1_PUB_DTAR3 MMC_REG_ADDR(DDR1_PUB_DTAR3) --#define DDR1_PUB_DTDR0 (0x3000 + (0x31 << 2)) --#define P_DDR1_PUB_DTDR0 MMC_REG_ADDR(DDR1_PUB_DTDR0) --#define DDR1_PUB_DTDR1 (0x3000 + (0x32 << 2)) --#define P_DDR1_PUB_DTDR1 MMC_REG_ADDR(DDR1_PUB_DTDR1) --#define DDR1_PUB_DTEDR0 (0x3000 + (0x33 << 2)) --#define P_DDR1_PUB_DTEDR0 MMC_REG_ADDR(DDR1_PUB_DTEDR0) --#define DDR1_PUB_DTEDR1 (0x3000 + (0x34 << 2)) --#define P_DDR1_PUB_DTEDR1 MMC_REG_ADDR(DDR1_PUB_DTEDR1) --#define DDR1_PUB_RDIMMGCR0 (0x3000 + (0x35 << 2)) --#define P_DDR1_PUB_RDIMMGCR0 MMC_REG_ADDR(DDR1_PUB_RDIMMGCR0) --#define DDR1_PUB_RDIMMGCR1 (0x3000 + (0x36 << 2)) --#define P_DDR1_PUB_RDIMMGCR1 MMC_REG_ADDR(DDR1_PUB_RDIMMGCR1) --#define DDR1_PUB_RDIMMCR0 (0x3000 + (0x37 << 2)) --#define P_DDR1_PUB_RDIMMCR0 MMC_REG_ADDR(DDR1_PUB_RDIMMCR0) --#define DDR1_PUB_RDIMMCR1 (0x3000 + (0x38 << 2)) --#define P_DDR1_PUB_RDIMMCR1 MMC_REG_ADDR(DDR1_PUB_RDIMMCR1) --#define DDR1_PUB_GPR0 (0x3000 + (0x39 << 2)) --#define P_DDR1_PUB_GPR0 MMC_REG_ADDR(DDR1_PUB_GPR0) --#define DDR1_PUB_GPR1 (0x3000 + (0x3A << 2)) --#define P_DDR1_PUB_GPR1 MMC_REG_ADDR(DDR1_PUB_GPR1) --#define DDR1_PUB_CATR0 (0x3000 + (0x3B << 2)) --#define P_DDR1_PUB_CATR0 MMC_REG_ADDR(DDR1_PUB_CATR0) --#define DDR1_PUB_CATR1 (0x3000 + (0x3C << 2)) --#define P_DDR1_PUB_CATR1 MMC_REG_ADDR(DDR1_PUB_CATR1) --#define DDR1_PUB_DCUAR (0x3000 + (0x60 << 2)) --#define P_DDR1_PUB_DCUAR MMC_REG_ADDR(DDR1_PUB_DCUAR) --#define DDR1_PUB_DCUDR (0x3000 + (0x61 << 2)) --#define P_DDR1_PUB_DCUDR MMC_REG_ADDR(DDR1_PUB_DCUDR) --#define DDR1_PUB_DCURR (0x3000 + (0x62 << 2)) --#define P_DDR1_PUB_DCURR MMC_REG_ADDR(DDR1_PUB_DCURR) --#define DDR1_PUB_DCULR (0x3000 + (0x63 << 2)) --#define P_DDR1_PUB_DCULR MMC_REG_ADDR(DDR1_PUB_DCULR) --#define DDR1_PUB_DCUGCR (0x3000 + (0x64 << 2)) --#define P_DDR1_PUB_DCUGCR MMC_REG_ADDR(DDR1_PUB_DCUGCR) --#define DDR1_PUB_DCUTPR (0x3000 + (0x65 << 2)) --#define P_DDR1_PUB_DCUTPR MMC_REG_ADDR(DDR1_PUB_DCUTPR) --#define DDR1_PUB_DCUSR0 (0x3000 + (0x66 << 2)) --#define P_DDR1_PUB_DCUSR0 MMC_REG_ADDR(DDR1_PUB_DCUSR0) --#define DDR1_PUB_DCUSR1 (0x3000 + (0x67 << 2)) --#define P_DDR1_PUB_DCUSR1 MMC_REG_ADDR(DDR1_PUB_DCUSR1) --#define DDR1_PUB_BISTRR (0x3000 + (0x70 << 2)) --#define P_DDR1_PUB_BISTRR MMC_REG_ADDR(DDR1_PUB_BISTRR) --#define DDR1_PUB_BISTWCR (0x3000 + (0x71 << 2)) --#define P_DDR1_PUB_BISTWCR MMC_REG_ADDR(DDR1_PUB_BISTWCR) --#define DDR1_PUB_BISTMSKR0 (0x3000 + (0x72 << 2)) --#define P_DDR1_PUB_BISTMSKR0 MMC_REG_ADDR(DDR1_PUB_BISTMSKR0) --#define DDR1_PUB_BISTMSKR1 (0x3000 + (0x73 << 2)) --#define P_DDR1_PUB_BISTMSKR1 MMC_REG_ADDR(DDR1_PUB_BISTMSKR1) --#define DDR1_PUB_BISTMSKR2 (0x3000 + (0x74 << 2)) --#define P_DDR1_PUB_BISTMSKR2 MMC_REG_ADDR(DDR1_PUB_BISTMSKR2) --#define DDR1_PUB_BISTLSR (0x3000 + (0x75 << 2)) --#define P_DDR1_PUB_BISTLSR MMC_REG_ADDR(DDR1_PUB_BISTLSR) --#define DDR1_PUB_BISTAR0 (0x3000 + (0x76 << 2)) --#define P_DDR1_PUB_BISTAR0 MMC_REG_ADDR(DDR1_PUB_BISTAR0) --#define DDR1_PUB_BISTAR1 (0x3000 + (0x77 << 2)) --#define P_DDR1_PUB_BISTAR1 MMC_REG_ADDR(DDR1_PUB_BISTAR1) --#define DDR1_PUB_BISTAR2 (0x3000 + (0x78 << 2)) --#define P_DDR1_PUB_BISTAR2 MMC_REG_ADDR(DDR1_PUB_BISTAR2) --#define DDR1_PUB_BISTUDPR (0x3000 + (0x79 << 2)) --#define P_DDR1_PUB_BISTUDPR MMC_REG_ADDR(DDR1_PUB_BISTUDPR) --#define DDR1_PUB_BISTGSR (0x3000 + (0x7A << 2)) --#define P_DDR1_PUB_BISTGSR MMC_REG_ADDR(DDR1_PUB_BISTGSR) --#define DDR1_PUB_BISTWER (0x3000 + (0x7B << 2)) --#define P_DDR1_PUB_BISTWER MMC_REG_ADDR(DDR1_PUB_BISTWER) --#define DDR1_PUB_BISTBER0 (0x3000 + (0x7C << 2)) --#define P_DDR1_PUB_BISTBER0 MMC_REG_ADDR(DDR1_PUB_BISTBER0) --#define DDR1_PUB_BISTBER1 (0x3000 + (0x7D << 2)) --#define P_DDR1_PUB_BISTBER1 MMC_REG_ADDR(DDR1_PUB_BISTBER1) --#define DDR1_PUB_BISTBER2 (0x3000 + (0x7E << 2)) --#define P_DDR1_PUB_BISTBER2 MMC_REG_ADDR(DDR1_PUB_BISTBER2) --#define DDR1_PUB_BISTBER3 (0x3000 + (0x7F << 2)) --#define P_DDR1_PUB_BISTBER3 MMC_REG_ADDR(DDR1_PUB_BISTBER3) --#define DDR1_PUB_BISTWCSR (0x3000 + (0x80 << 2)) --#define P_DDR1_PUB_BISTWCSR MMC_REG_ADDR(DDR1_PUB_BISTWCSR) --#define DDR1_PUB_BISTFWR0 (0x3000 + (0x81 << 2)) --#define P_DDR1_PUB_BISTFWR0 MMC_REG_ADDR(DDR1_PUB_BISTFWR0) --#define DDR1_PUB_BISTFWR1 (0x3000 + (0x82 << 2)) --#define P_DDR1_PUB_BISTFWR1 MMC_REG_ADDR(DDR1_PUB_BISTFWR1) --#define DDR1_PUB_BISTFWR2 (0x3000 + (0x83 << 2)) --#define P_DDR1_PUB_BISTFWR2 MMC_REG_ADDR(DDR1_PUB_BISTFWR2) --#define DDR1_PUB_IOVCR0 (0x3000 + (0x8E << 2)) --#define P_DDR1_PUB_IOVCR0 MMC_REG_ADDR(DDR1_PUB_IOVCR0) --#define DDR1_PUB_IOVCR1 (0x3000 + (0x8F << 2)) --#define P_DDR1_PUB_IOVCR1 MMC_REG_ADDR(DDR1_PUB_IOVCR1) --#define DDR1_PUB_ZQCR (0x3000 + (0x90 << 2)) --#define P_DDR1_PUB_ZQCR MMC_REG_ADDR(DDR1_PUB_ZQCR) --#define DDR1_PUB_ZQ0PR (0x3000 + (0x91 << 2)) --#define P_DDR1_PUB_ZQ0PR MMC_REG_ADDR(DDR1_PUB_ZQ0PR) --#define DDR1_PUB_ZQ0DR (0x3000 + (0x92 << 2)) --#define P_DDR1_PUB_ZQ0DR MMC_REG_ADDR(DDR1_PUB_ZQ0DR) --#define DDR1_PUB_ZQ0SR (0x3000 + (0x93 << 2)) --#define P_DDR1_PUB_ZQ0SR MMC_REG_ADDR(DDR1_PUB_ZQ0SR) --#define DDR1_PUB_ZQ1PR (0x3000 + (0x95 << 2)) --#define P_DDR1_PUB_ZQ1PR MMC_REG_ADDR(DDR1_PUB_ZQ1PR) --#define DDR1_PUB_ZQ1DR (0x3000 + (0x96 << 2)) --#define P_DDR1_PUB_ZQ1DR MMC_REG_ADDR(DDR1_PUB_ZQ1DR) --#define DDR1_PUB_ZQ1SR (0x3000 + (0x97 << 2)) --#define P_DDR1_PUB_ZQ1SR MMC_REG_ADDR(DDR1_PUB_ZQ1SR) --#define DDR1_PUB_ZQ2PR (0x3000 + (0x99 << 2)) --#define P_DDR1_PUB_ZQ2PR MMC_REG_ADDR(DDR1_PUB_ZQ2PR) --#define DDR1_PUB_ZQ2DR (0x3000 + (0x9A << 2)) --#define P_DDR1_PUB_ZQ2DR MMC_REG_ADDR(DDR1_PUB_ZQ2DR) --#define DDR1_PUB_ZQ2SR (0x3000 + (0x9B << 2)) --#define P_DDR1_PUB_ZQ2SR MMC_REG_ADDR(DDR1_PUB_ZQ2SR) --#define DDR1_PUB_ZQ3PR (0x3000 + (0x9D << 2)) --#define P_DDR1_PUB_ZQ3PR MMC_REG_ADDR(DDR1_PUB_ZQ3PR) --#define DDR1_PUB_ZQ3DR (0x3000 + (0x9E << 2)) --#define P_DDR1_PUB_ZQ3DR MMC_REG_ADDR(DDR1_PUB_ZQ3DR) --#define DDR1_PUB_ZQ3SR (0x3000 + (0x9F << 2)) --#define P_DDR1_PUB_ZQ3SR MMC_REG_ADDR(DDR1_PUB_ZQ3SR) --#define DDR1_PUB_DX0GCR0 (0x3000 + (0xA0 << 2)) --#define P_DDR1_PUB_DX0GCR0 MMC_REG_ADDR(DDR1_PUB_DX0GCR0) --#define DDR1_PUB_DX0GCR1 (0x3000 + (0xA1 << 2)) --#define P_DDR1_PUB_DX0GCR1 MMC_REG_ADDR(DDR1_PUB_DX0GCR1) --#define DDR1_PUB_DX0GCR2 (0x3000 + (0xA2 << 2)) --#define P_DDR1_PUB_DX0GCR2 MMC_REG_ADDR(DDR1_PUB_DX0GCR2) --#define DDR1_PUB_DX0GCR3 (0x3000 + (0xA3 << 2)) --#define P_DDR1_PUB_DX0GCR3 MMC_REG_ADDR(DDR1_PUB_DX0GCR3) --#define DDR1_PUB_DX0GSR0 (0x3000 + (0xA4 << 2)) --#define P_DDR1_PUB_DX0GSR0 MMC_REG_ADDR(DDR1_PUB_DX0GSR0) --#define DDR1_PUB_DX0GSR1 (0x3000 + (0xA5 << 2)) --#define P_DDR1_PUB_DX0GSR1 MMC_REG_ADDR(DDR1_PUB_DX0GSR1) --#define DDR1_PUB_DX0GSR2 (0x3000 + (0xA6 << 2)) --#define P_DDR1_PUB_DX0GSR2 MMC_REG_ADDR(DDR1_PUB_DX0GSR2) --#define DDR1_PUB_DX0BDLR0 (0x3000 + (0xA7 << 2)) --#define P_DDR1_PUB_DX0BDLR0 MMC_REG_ADDR(DDR1_PUB_DX0BDLR0) --#define DDR1_PUB_DX0BDLR1 (0x3000 + (0xA8 << 2)) --#define P_DDR1_PUB_DX0BDLR1 MMC_REG_ADDR(DDR1_PUB_DX0BDLR1) --#define DDR1_PUB_DX0BDLR2 (0x3000 + (0xA9 << 2)) --#define P_DDR1_PUB_DX0BDLR2 MMC_REG_ADDR(DDR1_PUB_DX0BDLR2) --#define DDR1_PUB_DX0BDLR3 (0x3000 + (0xAA << 2)) --#define P_DDR1_PUB_DX0BDLR3 MMC_REG_ADDR(DDR1_PUB_DX0BDLR3) --#define DDR1_PUB_DX0BDLR4 (0x3000 + (0xAB << 2)) --#define P_DDR1_PUB_DX0BDLR4 MMC_REG_ADDR(DDR1_PUB_DX0BDLR4) --#define DDR1_PUB_DX0BDLR5 (0x3000 + (0xAC << 2)) --#define P_DDR1_PUB_DX0BDLR5 MMC_REG_ADDR(DDR1_PUB_DX0BDLR5) --#define DDR1_PUB_DX0BDLR6 (0x3000 + (0xAD << 2)) --#define P_DDR1_PUB_DX0BDLR6 MMC_REG_ADDR(DDR1_PUB_DX0BDLR6) --#define DDR1_PUB_DX0LCDLR0 (0x3000 + (0xAE << 2)) --#define P_DDR1_PUB_DX0LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX0LCDLR0) --#define DDR1_PUB_DX0LCDLR1 (0x3000 + (0xAF << 2)) --#define P_DDR1_PUB_DX0LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX0LCDLR1) --#define DDR1_PUB_DX0LCDLR2 (0x3000 + (0xB0 << 2)) --#define P_DDR1_PUB_DX0LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX0LCDLR2) --#define DDR1_PUB_DX0MDLR (0x3000 + (0xB1 << 2)) --#define P_DDR1_PUB_DX0MDLR MMC_REG_ADDR(DDR1_PUB_DX0MDLR) --#define DDR1_PUB_DX0GTR (0x3000 + (0xB2 << 2)) --#define P_DDR1_PUB_DX0GTR MMC_REG_ADDR(DDR1_PUB_DX0GTR) --#define DDR1_PUB_DX1GCR0 (0x3000 + (0xC0 << 2)) --#define P_DDR1_PUB_DX1GCR0 MMC_REG_ADDR(DDR1_PUB_DX1GCR0) --#define DDR1_PUB_DX1GCR1 (0x3000 + (0xC1 << 2)) --#define P_DDR1_PUB_DX1GCR1 MMC_REG_ADDR(DDR1_PUB_DX1GCR1) --#define DDR1_PUB_DX1GCR2 (0x3000 + (0xC2 << 2)) --#define P_DDR1_PUB_DX1GCR2 MMC_REG_ADDR(DDR1_PUB_DX1GCR2) --#define DDR1_PUB_DX1GCR3 (0x3000 + (0xC3 << 2)) --#define P_DDR1_PUB_DX1GCR3 MMC_REG_ADDR(DDR1_PUB_DX1GCR3) --#define DDR1_PUB_DX1GSR0 (0x3000 + (0xC4 << 2)) --#define P_DDR1_PUB_DX1GSR0 MMC_REG_ADDR(DDR1_PUB_DX1GSR0) --#define DDR1_PUB_DX1GSR1 (0x3000 + (0xC5 << 2)) --#define P_DDR1_PUB_DX1GSR1 MMC_REG_ADDR(DDR1_PUB_DX1GSR1) --#define DDR1_PUB_DX1GSR2 (0x3000 + (0xC6 << 2)) --#define P_DDR1_PUB_DX1GSR2 MMC_REG_ADDR(DDR1_PUB_DX1GSR2) --#define DDR1_PUB_DX1BDLR0 (0x3000 + (0xC7 << 2)) --#define P_DDR1_PUB_DX1BDLR0 MMC_REG_ADDR(DDR1_PUB_DX1BDLR0) --#define DDR1_PUB_DX1BDLR1 (0x3000 + (0xC8 << 2)) --#define P_DDR1_PUB_DX1BDLR1 MMC_REG_ADDR(DDR1_PUB_DX1BDLR1) --#define DDR1_PUB_DX1BDLR2 (0x3000 + (0xC9 << 2)) --#define P_DDR1_PUB_DX1BDLR2 MMC_REG_ADDR(DDR1_PUB_DX1BDLR2) --#define DDR1_PUB_DX1BDLR3 (0x3000 + (0xCA << 2)) --#define P_DDR1_PUB_DX1BDLR3 MMC_REG_ADDR(DDR1_PUB_DX1BDLR3) --#define DDR1_PUB_DX1BDLR4 (0x3000 + (0xCB << 2)) --#define P_DDR1_PUB_DX1BDLR4 MMC_REG_ADDR(DDR1_PUB_DX1BDLR4) --#define DDR1_PUB_DX1BDLR5 (0x3000 + (0xCC << 2)) --#define P_DDR1_PUB_DX1BDLR5 MMC_REG_ADDR(DDR1_PUB_DX1BDLR5) --#define DDR1_PUB_DX1BDLR6 (0x3000 + (0xCD << 2)) --#define P_DDR1_PUB_DX1BDLR6 MMC_REG_ADDR(DDR1_PUB_DX1BDLR6) --#define DDR1_PUB_DX1LCDLR0 (0x3000 + (0xCE << 2)) --#define P_DDR1_PUB_DX1LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX1LCDLR0) --#define DDR1_PUB_DX1LCDLR1 (0x3000 + (0xCF << 2)) --#define P_DDR1_PUB_DX1LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX1LCDLR1) --#define DDR1_PUB_DX1LCDLR2 (0x3000 + (0xD0 << 2)) --#define P_DDR1_PUB_DX1LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX1LCDLR2) --#define DDR1_PUB_DX1MDLR (0x3000 + (0xD1 << 2)) --#define P_DDR1_PUB_DX1MDLR MMC_REG_ADDR(DDR1_PUB_DX1MDLR) --#define DDR1_PUB_DX1GTR (0x3000 + (0xD2 << 2)) --#define P_DDR1_PUB_DX1GTR MMC_REG_ADDR(DDR1_PUB_DX1GTR) --#define DDR1_PUB_DX2GCR0 (0x3000 + (0xE0 << 2)) --#define P_DDR1_PUB_DX2GCR0 MMC_REG_ADDR(DDR1_PUB_DX2GCR0) --#define DDR1_PUB_DX2GCR1 (0x3000 + (0xE1 << 2)) --#define P_DDR1_PUB_DX2GCR1 MMC_REG_ADDR(DDR1_PUB_DX2GCR1) --#define DDR1_PUB_DX2GCR2 (0x3000 + (0xE2 << 2)) --#define P_DDR1_PUB_DX2GCR2 MMC_REG_ADDR(DDR1_PUB_DX2GCR2) --#define DDR1_PUB_DX2GCR3 (0x3000 + (0xE3 << 2)) --#define P_DDR1_PUB_DX2GCR3 MMC_REG_ADDR(DDR1_PUB_DX2GCR3) --#define DDR1_PUB_DX2GSR0 (0x3000 + (0xE4 << 2)) --#define P_DDR1_PUB_DX2GSR0 MMC_REG_ADDR(DDR1_PUB_DX2GSR0) --#define DDR1_PUB_DX2GSR1 (0x3000 + (0xE5 << 2)) --#define P_DDR1_PUB_DX2GSR1 MMC_REG_ADDR(DDR1_PUB_DX2GSR1) --#define DDR1_PUB_DX2GSR2 (0x3000 + (0xE6 << 2)) --#define P_DDR1_PUB_DX2GSR2 MMC_REG_ADDR(DDR1_PUB_DX2GSR2) --#define DDR1_PUB_DX2BDLR0 (0x3000 + (0xE7 << 2)) --#define P_DDR1_PUB_DX2BDLR0 MMC_REG_ADDR(DDR1_PUB_DX2BDLR0) --#define DDR1_PUB_DX2BDLR1 (0x3000 + (0xE8 << 2)) --#define P_DDR1_PUB_DX2BDLR1 MMC_REG_ADDR(DDR1_PUB_DX2BDLR1) --#define DDR1_PUB_DX2BDLR2 (0x3000 + (0xE9 << 2)) --#define P_DDR1_PUB_DX2BDLR2 MMC_REG_ADDR(DDR1_PUB_DX2BDLR2) --#define DDR1_PUB_DX2BDLR3 (0x3000 + (0xEA << 2)) --#define P_DDR1_PUB_DX2BDLR3 MMC_REG_ADDR(DDR1_PUB_DX2BDLR3) --#define DDR1_PUB_DX2BDLR4 (0x3000 + (0xEB << 2)) --#define P_DDR1_PUB_DX2BDLR4 MMC_REG_ADDR(DDR1_PUB_DX2BDLR4) --#define DDR1_PUB_DX2BDLR5 (0x3000 + (0xEC << 2)) --#define P_DDR1_PUB_DX2BDLR5 MMC_REG_ADDR(DDR1_PUB_DX2BDLR5) --#define DDR1_PUB_DX2BDLR6 (0x3000 + (0xED << 2)) --#define P_DDR1_PUB_DX2BDLR6 MMC_REG_ADDR(DDR1_PUB_DX2BDLR6) --#define DDR1_PUB_DX2LCDLR0 (0x3000 + (0xEE << 2)) --#define P_DDR1_PUB_DX2LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX2LCDLR0) --#define DDR1_PUB_DX2LCDLR1 (0x3000 + (0xEF << 2)) --#define P_DDR1_PUB_DX2LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX2LCDLR1) --#define DDR1_PUB_DX2LCDLR2 (0x3000 + (0xF0 << 2)) --#define P_DDR1_PUB_DX2LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX2LCDLR2) --#define DDR1_PUB_DX2MDLR (0x3000 + (0xF1 << 2)) --#define P_DDR1_PUB_DX2MDLR MMC_REG_ADDR(DDR1_PUB_DX2MDLR) --#define DDR1_PUB_DX2GTR (0x3000 + (0xF2 << 2)) --#define P_DDR1_PUB_DX2GTR MMC_REG_ADDR(DDR1_PUB_DX2GTR) --#define DDR1_PUB_DX3GCR0 (0x3000 + (0x100 << 2)) --#define P_DDR1_PUB_DX3GCR0 MMC_REG_ADDR(DDR1_PUB_DX3GCR0) --#define DDR1_PUB_DX3GCR1 (0x3000 + (0x101 << 2)) --#define P_DDR1_PUB_DX3GCR1 MMC_REG_ADDR(DDR1_PUB_DX3GCR1) --#define DDR1_PUB_DX3GCR2 (0x3000 + (0x102 << 2)) --#define P_DDR1_PUB_DX3GCR2 MMC_REG_ADDR(DDR1_PUB_DX3GCR2) --#define DDR1_PUB_DX3GCR3 (0x3000 + (0x103 << 2)) --#define P_DDR1_PUB_DX3GCR3 MMC_REG_ADDR(DDR1_PUB_DX3GCR3) --#define DDR1_PUB_DX3GSR0 (0x3000 + (0x104 << 2)) --#define P_DDR1_PUB_DX3GSR0 MMC_REG_ADDR(DDR1_PUB_DX3GSR0) --#define DDR1_PUB_DX3GSR1 (0x3000 + (0x105 << 2)) --#define P_DDR1_PUB_DX3GSR1 MMC_REG_ADDR(DDR1_PUB_DX3GSR1) --#define DDR1_PUB_DX3GSR2 (0x3000 + (0x106 << 2)) --#define P_DDR1_PUB_DX3GSR2 MMC_REG_ADDR(DDR1_PUB_DX3GSR2) --#define DDR1_PUB_DX3BDLR0 (0x3000 + (0x107 << 2)) --#define P_DDR1_PUB_DX3BDLR0 MMC_REG_ADDR(DDR1_PUB_DX3BDLR0) --#define DDR1_PUB_DX3BDLR1 (0x3000 + (0x108 << 2)) --#define P_DDR1_PUB_DX3BDLR1 MMC_REG_ADDR(DDR1_PUB_DX3BDLR1) --#define DDR1_PUB_DX3BDLR2 (0x3000 + (0x109 << 2)) --#define P_DDR1_PUB_DX3BDLR2 MMC_REG_ADDR(DDR1_PUB_DX3BDLR2) --#define DDR1_PUB_DX3BDLR3 (0x3000 + (0x10A << 2)) --#define P_DDR1_PUB_DX3BDLR3 MMC_REG_ADDR(DDR1_PUB_DX3BDLR3) --#define DDR1_PUB_DX3BDLR4 (0x3000 + (0x10B << 2)) --#define P_DDR1_PUB_DX3BDLR4 MMC_REG_ADDR(DDR1_PUB_DX3BDLR4) --#define DDR1_PUB_DX3BDLR5 (0x3000 + (0x10C << 2)) --#define P_DDR1_PUB_DX3BDLR5 MMC_REG_ADDR(DDR1_PUB_DX3BDLR5) --#define DDR1_PUB_DX3BDLR6 (0x3000 + (0x10D << 2)) --#define P_DDR1_PUB_DX3BDLR6 MMC_REG_ADDR(DDR1_PUB_DX3BDLR6) --#define DDR1_PUB_DX3LCDLR0 (0x3000 + (0x10E << 2)) --#define P_DDR1_PUB_DX3LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX3LCDLR0) --#define DDR1_PUB_DX3LCDLR1 (0x3000 + (0x10F << 2)) --#define P_DDR1_PUB_DX3LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX3LCDLR1) --#define DDR1_PUB_DX3LCDLR2 (0x3000 + (0x110 << 2)) --#define P_DDR1_PUB_DX3LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX3LCDLR2) --#define DDR1_PUB_DX3MDLR (0x3000 + (0x111 << 2)) --#define P_DDR1_PUB_DX3MDLR MMC_REG_ADDR(DDR1_PUB_DX3MDLR) --#define DDR1_PUB_DX3GTR (0x3000 + (0x112 << 2)) --#define P_DDR1_PUB_DX3GTR MMC_REG_ADDR(DDR1_PUB_DX3GTR) --#define DDR1_PUB_DX4GCR0 (0x3000 + (0x120 << 2)) --#define P_DDR1_PUB_DX4GCR0 MMC_REG_ADDR(DDR1_PUB_DX4GCR0) --#define DDR1_PUB_DX4GCR1 (0x3000 + (0x121 << 2)) --#define P_DDR1_PUB_DX4GCR1 MMC_REG_ADDR(DDR1_PUB_DX4GCR1) --#define DDR1_PUB_DX4GCR2 (0x3000 + (0x122 << 2)) --#define P_DDR1_PUB_DX4GCR2 MMC_REG_ADDR(DDR1_PUB_DX4GCR2) --#define DDR1_PUB_DX4GCR3 (0x3000 + (0x123 << 2)) --#define P_DDR1_PUB_DX4GCR3 MMC_REG_ADDR(DDR1_PUB_DX4GCR3) --#define DDR1_PUB_DX4GSR0 (0x3000 + (0x124 << 2)) --#define P_DDR1_PUB_DX4GSR0 MMC_REG_ADDR(DDR1_PUB_DX4GSR0) --#define DDR1_PUB_DX4GSR1 (0x3000 + (0x125 << 2)) --#define P_DDR1_PUB_DX4GSR1 MMC_REG_ADDR(DDR1_PUB_DX4GSR1) --#define DDR1_PUB_DX4GSR2 (0x3000 + (0x126 << 2)) --#define P_DDR1_PUB_DX4GSR2 MMC_REG_ADDR(DDR1_PUB_DX4GSR2) --#define DDR1_PUB_DX4BDLR0 (0x3000 + (0x127 << 2)) --#define P_DDR1_PUB_DX4BDLR0 MMC_REG_ADDR(DDR1_PUB_DX4BDLR0) --#define DDR1_PUB_DX4BDLR1 (0x3000 + (0x128 << 2)) --#define P_DDR1_PUB_DX4BDLR1 MMC_REG_ADDR(DDR1_PUB_DX4BDLR1) --#define DDR1_PUB_DX4BDLR2 (0x3000 + (0x129 << 2)) --#define P_DDR1_PUB_DX4BDLR2 MMC_REG_ADDR(DDR1_PUB_DX4BDLR2) --#define DDR1_PUB_DX4BDLR3 (0x3000 + (0x12A << 2)) --#define P_DDR1_PUB_DX4BDLR3 MMC_REG_ADDR(DDR1_PUB_DX4BDLR3) --#define DDR1_PUB_DX4BDLR4 (0x3000 + (0x12B << 2)) --#define P_DDR1_PUB_DX4BDLR4 MMC_REG_ADDR(DDR1_PUB_DX4BDLR4) --#define DDR1_PUB_DX4BDLR5 (0x3000 + (0x12C << 2)) --#define P_DDR1_PUB_DX4BDLR5 MMC_REG_ADDR(DDR1_PUB_DX4BDLR5) --#define DDR1_PUB_DX4BDLR6 (0x3000 + (0x12D << 2)) --#define P_DDR1_PUB_DX4BDLR6 MMC_REG_ADDR(DDR1_PUB_DX4BDLR6) --#define DDR1_PUB_DX4LCDLR0 (0x3000 + (0x12E << 2)) --#define P_DDR1_PUB_DX4LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX4LCDLR0) --#define DDR1_PUB_DX4LCDLR1 (0x3000 + (0x12F << 2)) --#define P_DDR1_PUB_DX4LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX4LCDLR1) --#define DDR1_PUB_DX4LCDLR2 (0x3000 + (0x130 << 2)) --#define P_DDR1_PUB_DX4LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX4LCDLR2) --#define DDR1_PUB_DX4MDLR (0x3000 + (0x131 << 2)) --#define P_DDR1_PUB_DX4MDLR MMC_REG_ADDR(DDR1_PUB_DX4MDLR) --#define DDR1_PUB_DX4GTR (0x3000 + (0x132 << 2)) --#define P_DDR1_PUB_DX4GTR MMC_REG_ADDR(DDR1_PUB_DX4GTR) --#define DDR1_PUB_DX5GCR0 (0x3000 + (0x140 << 2)) --#define P_DDR1_PUB_DX5GCR0 MMC_REG_ADDR(DDR1_PUB_DX5GCR0) --#define DDR1_PUB_DX5GCR1 (0x3000 + (0x141 << 2)) --#define P_DDR1_PUB_DX5GCR1 MMC_REG_ADDR(DDR1_PUB_DX5GCR1) --#define DDR1_PUB_DX5GCR2 (0x3000 + (0x142 << 2)) --#define P_DDR1_PUB_DX5GCR2 MMC_REG_ADDR(DDR1_PUB_DX5GCR2) --#define DDR1_PUB_DX5GCR3 (0x3000 + (0x143 << 2)) --#define P_DDR1_PUB_DX5GCR3 MMC_REG_ADDR(DDR1_PUB_DX5GCR3) --#define DDR1_PUB_DX5GSR0 (0x3000 + (0x144 << 2)) --#define P_DDR1_PUB_DX5GSR0 MMC_REG_ADDR(DDR1_PUB_DX5GSR0) --#define DDR1_PUB_DX5GSR1 (0x3000 + (0x145 << 2)) --#define P_DDR1_PUB_DX5GSR1 MMC_REG_ADDR(DDR1_PUB_DX5GSR1) --#define DDR1_PUB_DX5GSR2 (0x3000 + (0x146 << 2)) --#define P_DDR1_PUB_DX5GSR2 MMC_REG_ADDR(DDR1_PUB_DX5GSR2) --#define DDR1_PUB_DX5BDLR0 (0x3000 + (0x147 << 2)) --#define P_DDR1_PUB_DX5BDLR0 MMC_REG_ADDR(DDR1_PUB_DX5BDLR0) --#define DDR1_PUB_DX5BDLR1 (0x3000 + (0x148 << 2)) --#define P_DDR1_PUB_DX5BDLR1 MMC_REG_ADDR(DDR1_PUB_DX5BDLR1) --#define DDR1_PUB_DX5BDLR2 (0x3000 + (0x149 << 2)) --#define P_DDR1_PUB_DX5BDLR2 MMC_REG_ADDR(DDR1_PUB_DX5BDLR2) --#define DDR1_PUB_DX5BDLR3 (0x3000 + (0x14A << 2)) --#define P_DDR1_PUB_DX5BDLR3 MMC_REG_ADDR(DDR1_PUB_DX5BDLR3) --#define DDR1_PUB_DX5BDLR4 (0x3000 + (0x14B << 2)) --#define P_DDR1_PUB_DX5BDLR4 MMC_REG_ADDR(DDR1_PUB_DX5BDLR4) --#define DDR1_PUB_DX5BDLR5 (0x3000 + (0x14C << 2)) --#define P_DDR1_PUB_DX5BDLR5 MMC_REG_ADDR(DDR1_PUB_DX5BDLR5) --#define DDR1_PUB_DX5BDLR6 (0x3000 + (0x14D << 2)) --#define P_DDR1_PUB_DX5BDLR6 MMC_REG_ADDR(DDR1_PUB_DX5BDLR6) --#define DDR1_PUB_DX5LCDLR0 (0x3000 + (0x14E << 2)) --#define P_DDR1_PUB_DX5LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX5LCDLR0) --#define DDR1_PUB_DX5LCDLR1 (0x3000 + (0x14F << 2)) --#define P_DDR1_PUB_DX5LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX5LCDLR1) --#define DDR1_PUB_DX5LCDLR2 (0x3000 + (0x150 << 2)) --#define P_DDR1_PUB_DX5LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX5LCDLR2) --#define DDR1_PUB_DX5MDLR (0x3000 + (0x151 << 2)) --#define P_DDR1_PUB_DX5MDLR MMC_REG_ADDR(DDR1_PUB_DX5MDLR) --#define DDR1_PUB_DX5GTR (0x3000 + (0x152 << 2)) --#define P_DDR1_PUB_DX5GTR MMC_REG_ADDR(DDR1_PUB_DX5GTR) --#define DDR1_PUB_DX6GCR0 (0x3000 + (0x160 << 2)) --#define P_DDR1_PUB_DX6GCR0 MMC_REG_ADDR(DDR1_PUB_DX6GCR0) --#define DDR1_PUB_DX6GCR1 (0x3000 + (0x161 << 2)) --#define P_DDR1_PUB_DX6GCR1 MMC_REG_ADDR(DDR1_PUB_DX6GCR1) --#define DDR1_PUB_DX6GCR2 (0x3000 + (0x162 << 2)) --#define P_DDR1_PUB_DX6GCR2 MMC_REG_ADDR(DDR1_PUB_DX6GCR2) --#define DDR1_PUB_DX6GCR3 (0x3000 + (0x163 << 2)) --#define P_DDR1_PUB_DX6GCR3 MMC_REG_ADDR(DDR1_PUB_DX6GCR3) --#define DDR1_PUB_DX6GSR0 (0x3000 + (0x164 << 2)) --#define P_DDR1_PUB_DX6GSR0 MMC_REG_ADDR(DDR1_PUB_DX6GSR0) --#define DDR1_PUB_DX6GSR1 (0x3000 + (0x165 << 2)) --#define P_DDR1_PUB_DX6GSR1 MMC_REG_ADDR(DDR1_PUB_DX6GSR1) --#define DDR1_PUB_DX6GSR2 (0x3000 + (0x166 << 2)) --#define P_DDR1_PUB_DX6GSR2 MMC_REG_ADDR(DDR1_PUB_DX6GSR2) --#define DDR1_PUB_DX6BDLR0 (0x3000 + (0x167 << 2)) --#define P_DDR1_PUB_DX6BDLR0 MMC_REG_ADDR(DDR1_PUB_DX6BDLR0) --#define DDR1_PUB_DX6BDLR1 (0x3000 + (0x168 << 2)) --#define P_DDR1_PUB_DX6BDLR1 MMC_REG_ADDR(DDR1_PUB_DX6BDLR1) --#define DDR1_PUB_DX6BDLR2 (0x3000 + (0x169 << 2)) --#define P_DDR1_PUB_DX6BDLR2 MMC_REG_ADDR(DDR1_PUB_DX6BDLR2) --#define DDR1_PUB_DX6BDLR3 (0x3000 + (0x16A << 2)) --#define P_DDR1_PUB_DX6BDLR3 MMC_REG_ADDR(DDR1_PUB_DX6BDLR3) --#define DDR1_PUB_DX6BDLR4 (0x3000 + (0x16B << 2)) --#define P_DDR1_PUB_DX6BDLR4 MMC_REG_ADDR(DDR1_PUB_DX6BDLR4) --#define DDR1_PUB_DX6BDLR5 (0x3000 + (0x16C << 2)) --#define P_DDR1_PUB_DX6BDLR5 MMC_REG_ADDR(DDR1_PUB_DX6BDLR5) --#define DDR1_PUB_DX6BDLR6 (0x3000 + (0x16D << 2)) --#define P_DDR1_PUB_DX6BDLR6 MMC_REG_ADDR(DDR1_PUB_DX6BDLR6) --#define DDR1_PUB_DX6LCDLR0 (0x3000 + (0x16E << 2)) --#define P_DDR1_PUB_DX6LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX6LCDLR0) --#define DDR1_PUB_DX6LCDLR1 (0x3000 + (0x16F << 2)) --#define P_DDR1_PUB_DX6LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX6LCDLR1) --#define DDR1_PUB_DX6LCDLR2 (0x3000 + (0x170 << 2)) --#define P_DDR1_PUB_DX6LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX6LCDLR2) --#define DDR1_PUB_DX6MDLR (0x3000 + (0x171 << 2)) --#define P_DDR1_PUB_DX6MDLR MMC_REG_ADDR(DDR1_PUB_DX6MDLR) --#define DDR1_PUB_DX6GTR (0x3000 + (0x172 << 2)) --#define P_DDR1_PUB_DX6GTR MMC_REG_ADDR(DDR1_PUB_DX6GTR) --#define DDR1_PUB_DX7GCR0 (0x3000 + (0x180 << 2)) --#define P_DDR1_PUB_DX7GCR0 MMC_REG_ADDR(DDR1_PUB_DX7GCR0) --#define DDR1_PUB_DX7GCR1 (0x3000 + (0x181 << 2)) --#define P_DDR1_PUB_DX7GCR1 MMC_REG_ADDR(DDR1_PUB_DX7GCR1) --#define DDR1_PUB_DX7GCR2 (0x3000 + (0x182 << 2)) --#define P_DDR1_PUB_DX7GCR2 MMC_REG_ADDR(DDR1_PUB_DX7GCR2) --#define DDR1_PUB_DX7GCR3 (0x3000 + (0x183 << 2)) --#define P_DDR1_PUB_DX7GCR3 MMC_REG_ADDR(DDR1_PUB_DX7GCR3) --#define DDR1_PUB_DX7GSR0 (0x3000 + (0x184 << 2)) --#define P_DDR1_PUB_DX7GSR0 MMC_REG_ADDR(DDR1_PUB_DX7GSR0) --#define DDR1_PUB_DX7GSR1 (0x3000 + (0x185 << 2)) --#define P_DDR1_PUB_DX7GSR1 MMC_REG_ADDR(DDR1_PUB_DX7GSR1) --#define DDR1_PUB_DX7GSR2 (0x3000 + (0x186 << 2)) --#define P_DDR1_PUB_DX7GSR2 MMC_REG_ADDR(DDR1_PUB_DX7GSR2) --#define DDR1_PUB_DX7BDLR0 (0x3000 + (0x187 << 2)) --#define P_DDR1_PUB_DX7BDLR0 MMC_REG_ADDR(DDR1_PUB_DX7BDLR0) --#define DDR1_PUB_DX7BDLR1 (0x3000 + (0x188 << 2)) --#define P_DDR1_PUB_DX7BDLR1 MMC_REG_ADDR(DDR1_PUB_DX7BDLR1) --#define DDR1_PUB_DX7BDLR2 (0x3000 + (0x189 << 2)) --#define P_DDR1_PUB_DX7BDLR2 MMC_REG_ADDR(DDR1_PUB_DX7BDLR2) --#define DDR1_PUB_DX7BDLR3 (0x3000 + (0x18A << 2)) --#define P_DDR1_PUB_DX7BDLR3 MMC_REG_ADDR(DDR1_PUB_DX7BDLR3) --#define DDR1_PUB_DX7BDLR4 (0x3000 + (0x18B << 2)) --#define P_DDR1_PUB_DX7BDLR4 MMC_REG_ADDR(DDR1_PUB_DX7BDLR4) --#define DDR1_PUB_DX7BDLR5 (0x3000 + (0x18C << 2)) --#define P_DDR1_PUB_DX7BDLR5 MMC_REG_ADDR(DDR1_PUB_DX7BDLR5) --#define DDR1_PUB_DX7BDLR6 (0x3000 + (0x18D << 2)) --#define P_DDR1_PUB_DX7BDLR6 MMC_REG_ADDR(DDR1_PUB_DX7BDLR6) --#define DDR1_PUB_DX7LCDLR0 (0x3000 + (0x18E << 2)) --#define P_DDR1_PUB_DX7LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX7LCDLR0) --#define DDR1_PUB_DX7LCDLR1 (0x3000 + (0x18F << 2)) --#define P_DDR1_PUB_DX7LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX7LCDLR1) --#define DDR1_PUB_DX7LCDLR2 (0x3000 + (0x190 << 2)) --#define P_DDR1_PUB_DX7LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX7LCDLR2) --#define DDR1_PUB_DX7MDLR (0x3000 + (0x191 << 2)) --#define P_DDR1_PUB_DX7MDLR MMC_REG_ADDR(DDR1_PUB_DX7MDLR) --#define DDR1_PUB_DX7GTR (0x3000 + (0x192 << 2)) --#define P_DDR1_PUB_DX7GTR MMC_REG_ADDR(DDR1_PUB_DX7GTR) --#define DDR1_PUB_DX8GCR0 (0x3000 + (0x1A0 << 2)) --#define P_DDR1_PUB_DX8GCR0 MMC_REG_ADDR(DDR1_PUB_DX8GCR0) --#define DDR1_PUB_DX8GCR1 (0x3000 + (0x1A1 << 2)) --#define P_DDR1_PUB_DX8GCR1 MMC_REG_ADDR(DDR1_PUB_DX8GCR1) --#define DDR1_PUB_DX8GCR2 (0x3000 + (0x1A2 << 2)) --#define P_DDR1_PUB_DX8GCR2 MMC_REG_ADDR(DDR1_PUB_DX8GCR2) --#define DDR1_PUB_DX8GCR3 (0x3000 + (0x1A3 << 2)) --#define P_DDR1_PUB_DX8GCR3 MMC_REG_ADDR(DDR1_PUB_DX8GCR3) --#define DDR1_PUB_DX8GSR0 (0x3000 + (0x1A4 << 2)) --#define P_DDR1_PUB_DX8GSR0 MMC_REG_ADDR(DDR1_PUB_DX8GSR0) --#define DDR1_PUB_DX8GSR1 (0x3000 + (0x1A5 << 2)) --#define P_DDR1_PUB_DX8GSR1 MMC_REG_ADDR(DDR1_PUB_DX8GSR1) --#define DDR1_PUB_DX8GSR2 (0x3000 + (0x1A6 << 2)) --#define P_DDR1_PUB_DX8GSR2 MMC_REG_ADDR(DDR1_PUB_DX8GSR2) --#define DDR1_PUB_DX8BDLR0 (0x3000 + (0x1A7 << 2)) --#define P_DDR1_PUB_DX8BDLR0 MMC_REG_ADDR(DDR1_PUB_DX8BDLR0) --#define DDR1_PUB_DX8BDLR1 (0x3000 + (0x1A8 << 2)) --#define P_DDR1_PUB_DX8BDLR1 MMC_REG_ADDR(DDR1_PUB_DX8BDLR1) --#define DDR1_PUB_DX8BDLR2 (0x3000 + (0x1A9 << 2)) --#define P_DDR1_PUB_DX8BDLR2 MMC_REG_ADDR(DDR1_PUB_DX8BDLR2) --#define DDR1_PUB_DX8BDLR3 (0x3000 + (0x1AA << 2)) --#define P_DDR1_PUB_DX8BDLR3 MMC_REG_ADDR(DDR1_PUB_DX8BDLR3) --#define DDR1_PUB_DX8BDLR4 (0x3000 + (0x1AB << 2)) --#define P_DDR1_PUB_DX8BDLR4 MMC_REG_ADDR(DDR1_PUB_DX8BDLR4) --#define DDR1_PUB_DX8BDLR5 (0x3000 + (0x1AC << 2)) --#define P_DDR1_PUB_DX8BDLR5 MMC_REG_ADDR(DDR1_PUB_DX8BDLR5) --#define DDR1_PUB_DX8BDLR6 (0x3000 + (0x1AD << 2)) --#define P_DDR1_PUB_DX8BDLR6 MMC_REG_ADDR(DDR1_PUB_DX8BDLR6) --#define DDR1_PUB_DX8LCDLR0 (0x3000 + (0x1AE << 2)) --#define P_DDR1_PUB_DX8LCDLR0 MMC_REG_ADDR(DDR1_PUB_DX8LCDLR0) --#define DDR1_PUB_DX8LCDLR1 (0x3000 + (0x1AF << 2)) --#define P_DDR1_PUB_DX8LCDLR1 MMC_REG_ADDR(DDR1_PUB_DX8LCDLR1) --#define DDR1_PUB_DX8LCDLR2 (0x3000 + (0x1B0 << 2)) --#define P_DDR1_PUB_DX8LCDLR2 MMC_REG_ADDR(DDR1_PUB_DX8LCDLR2) --#define DDR1_PUB_DX8MDLR (0x3000 + (0x1B1 << 2)) --#define P_DDR1_PUB_DX8MDLR MMC_REG_ADDR(DDR1_PUB_DX8MDLR) --#define DDR1_PUB_DX8GTR (0x3000 + (0x1B2 << 2)) --#define P_DDR1_PUB_DX8GTR MMC_REG_ADDR(DDR1_PUB_DX8GTR) --/*add from M8m2*/ --#define S_DMC_REG_BASE 0x6000 --#define DMC_REQ_CTRL (S_DMC_REG_BASE + (0x00 << 2)) --#define P_DMC_REQ_CTRL MMC_REG_ADDR(DMC_REQ_CTRL) --#define DMC_SOFT_RST (S_DMC_REG_BASE + (0x01 << 2)) --#define P_DMC_SOFT_RST MMC_REG_ADDR(DMC_SOFT_RST) --#define DMC_SOFT_RST1 (S_DMC_REG_BASE + (0x02 << 2)) --#define P_DMC_SOFT_RST1 MMC_REG_ADDR(DMC_SOFT_RST1) --#define DMC_RST_STS (S_DMC_REG_BASE + (0x03 << 2)) --#define P_DMC_RST_STS MMC_REG_ADDR(DMC_RST_STS) --#define DMC_RST_STS1 (S_DMC_REG_BASE + (0x04 << 2)) --#define P_DMC_RST_STS1 MMC_REG_ADDR(DMC_RST_STS1) --#define DMC_VERSION (S_DMC_REG_BASE + (0x05 << 2)) --#define P_DMC_VERSION MMC_REG_ADDR(DMC_VERSION) --#define DMC_DDR_CTRL (S_DMC_REG_BASE + (0x10 << 2)) --#define P_DMC_DDR_CTRL MMC_REG_ADDR(DMC_DDR_CTRL) --#define DMC_DDR_CTRL1 (S_DMC_REG_BASE + (0x11 << 2)) --#define P_DMC_DDR_CTRL1 MMC_REG_ADDR(DMC_DDR_CTRL1) --#define DC_CAV_LUT_DATAL_M8M2 (S_DMC_REG_BASE + (0x12 << 2)) --#define P_DC_CAV_LUT_DATAL_M8M2 MMC_REG_ADDR(DC_CAV_LUT_DATAL_M8M2) --#define DC_CAV_LUT_DATAH_M8M2 (S_DMC_REG_BASE + (0x13 << 2)) --#define P_DC_CAV_LUT_DATAH_M8M2 MMC_REG_ADDR(DC_CAV_LUT_DATAH_M8M2) --#define DC_CAV_LUT_ADDR_M8M2 (S_DMC_REG_BASE + (0x14 << 2)) --#define P_DC_CAV_LUT_ADDR_M8M2 MMC_REG_ADDR(DC_CAV_LUT_ADDR_M8M2) --#define DC_CAV_LUT_RDATAL_M8M2 (S_DMC_REG_BASE + (0x15 << 2)) --#define P_DC_CAV_LUT_RDATAL_M8M2 MMC_REG_ADDR(DC_CAV_LUT_RDATAL_M8M2) --#define DC_CAV_LUT_RDATAH_M8M2 (S_DMC_REG_BASE + (0x16 << 2)) --#define P_DC_CAV_LUT_RDATAH_M8M2 MMC_REG_ADDR(DC_CAV_LUT_RDATAH_M8M2) --#define DMC_2ARB_CTRL (S_DMC_REG_BASE + (0x20 << 2)) --#define P_DMC_2ARB_CTRL MMC_REG_ADDR(DMC_2ARB_CTRL) --#define DMC_REFR_CTRL1 (S_DMC_REG_BASE + (0x23 << 2)) --#define P_DMC_REFR_CTRL1 MMC_REG_ADDR(DMC_REFR_CTRL1) --#define DMC_REFR_CTRL2 (S_DMC_REG_BASE + (0x24 << 2)) --#define P_DMC_REFR_CTRL2 MMC_REG_ADDR(DMC_REFR_CTRL2) --#define DMC_PARB_CTRL (S_DMC_REG_BASE + (0x25 << 2)) --#define P_DMC_PARB_CTRL MMC_REG_ADDR(DMC_PARB_CTRL) --#define DMC_MON_CTRL2 (S_DMC_REG_BASE + (0x26 << 2)) --#define P_DMC_MON_CTRL2 MMC_REG_ADDR(DMC_MON_CTRL2) --#define DMC_MON_CTRL3 (S_DMC_REG_BASE + (0x27 << 2)) --#define P_DMC_MON_CTRL3 MMC_REG_ADDR(DMC_MON_CTRL3) --#define DMC_MON_ALL_REQ_CNT (S_DMC_REG_BASE + (0x28 << 2)) --#define P_DMC_MON_ALL_REQ_CNT MMC_REG_ADDR(DMC_MON_ALL_REQ_CNT) --#define DMC_MON_ALL_GRANT_CNT (S_DMC_REG_BASE + (0x29 << 2)) --#define P_DMC_MON_ALL_GRANT_CNT \ -- MMC_REG_ADDR(DMC_MON_ALL_GRANT_CNT) --#define DMC_MON_ONE_GRANT_CNT (S_DMC_REG_BASE + (0x2a << 2)) --#define P_DMC_MON_ONE_GRANT_CNT \ -- MMC_REG_ADDR(DMC_MON_ONE_GRANT_CNT) --#define DMC_CLKG_CTRL0 (S_DMC_REG_BASE + (0x30 << 2)) --#define P_DMC_CLKG_CTRL0 MMC_REG_ADDR(DMC_CLKG_CTRL0) --#define DMC_CLKG_CTRL1 (S_DMC_REG_BASE + (0x31 << 2)) --#define P_DMC_CLKG_CTRL1 MMC_REG_ADDR(DMC_CLKG_CTRL1) --#define DMC_CHAN_STS (S_DMC_REG_BASE + (0x32 << 2)) --#define P_DMC_CHAN_STS MMC_REG_ADDR(DMC_CHAN_STS) --#define DMC_CMD_FILTER_CTRL1 (S_DMC_REG_BASE + (0x40 << 2)) --#define P_DMC_CMD_FILTER_CTRL1 MMC_REG_ADDR(DMC_CMD_FILTER_CTRL1) --#define DMC_CMD_FILTER_CTRL2 (S_DMC_REG_BASE + (0x41 << 2)) --#define P_DMC_CMD_FILTER_CTRL2 MMC_REG_ADDR(DMC_CMD_FILTER_CTRL2) --#define DMC_CMD_FILTER_CTRL3 (S_DMC_REG_BASE + (0x42 << 2)) --#define P_DMC_CMD_FILTER_CTRL3 MMC_REG_ADDR(DMC_CMD_FILTER_CTRL3) --#define DMC_CMD_FILTER_CTRL4 (S_DMC_REG_BASE + (0x43 << 2)) --#define P_DMC_CMD_FILTER_CTRL4 MMC_REG_ADDR(DMC_CMD_FILTER_CTRL4) --#define DMC_CMD_BUFFER_CTRL (S_DMC_REG_BASE + (0x44 << 2)) --#define P_DMC_CMD_BUFFER_CTRL MMC_REG_ADDR(DMC_CMD_BUFFER_CTRL) --#define DMC_AM0_CHAN_CTRL (S_DMC_REG_BASE + (0x60 << 2)) --#define P_DMC_AM0_CHAN_CTRL MMC_REG_ADDR(DMC_AM0_CHAN_CTRL) --#define DMC_AM0_HOLD_CTRL (S_DMC_REG_BASE + (0x61 << 2)) --#define P_DMC_AM0_HOLD_CTRL MMC_REG_ADDR(DMC_AM0_HOLD_CTRL) --#define DMC_AM0_QOS_INC (S_DMC_REG_BASE + (0x62 << 2)) --#define P_DMC_AM0_QOS_INC MMC_REG_ADDR(DMC_AM0_QOS_INC) --#define DMC_AM0_QOS_INCBK (S_DMC_REG_BASE + (0x63 << 2)) --#define P_DMC_AM0_QOS_INCBK MMC_REG_ADDR(DMC_AM0_QOS_INCBK) --#define DMC_AM0_QOS_DEC (S_DMC_REG_BASE + (0x64 << 2)) --#define P_DMC_AM0_QOS_DEC MMC_REG_ADDR(DMC_AM0_QOS_DEC) --#define DMC_AM0_QOS_DECBK (S_DMC_REG_BASE + (0x65 << 2)) --#define P_DMC_AM0_QOS_DECBK MMC_REG_ADDR(DMC_AM0_QOS_DECBK) --#define DMC_AM0_QOS_DIS (S_DMC_REG_BASE + (0x66 << 2)) --#define P_DMC_AM0_QOS_DIS MMC_REG_ADDR(DMC_AM0_QOS_DIS) --#define DMC_AM0_QOS_DISBK (S_DMC_REG_BASE + (0x67 << 2)) --#define P_DMC_AM0_QOS_DISBK MMC_REG_ADDR(DMC_AM0_QOS_DISBK) --#define DMC_AM0_QOS_CTRL0 (S_DMC_REG_BASE + (0x68 << 2)) --#define P_DMC_AM0_QOS_CTRL0 MMC_REG_ADDR(DMC_AM0_QOS_CTRL0) --#define DMC_AM0_QOS_CTRL1 (S_DMC_REG_BASE + (0x69 << 2)) --#define P_DMC_AM0_QOS_CTRL1 MMC_REG_ADDR(DMC_AM0_QOS_CTRL1) --#define DMC_AM1_CHAN_CTRL (S_DMC_REG_BASE + (0x6a << 2)) --#define P_DMC_AM1_CHAN_CTRL MMC_REG_ADDR(DMC_AM1_CHAN_CTRL) --#define DMC_AM1_HOLD_CTRL (S_DMC_REG_BASE + (0x6b << 2)) --#define P_DMC_AM1_HOLD_CTRL MMC_REG_ADDR(DMC_AM1_HOLD_CTRL) --#define DMC_AM1_QOS_INC (S_DMC_REG_BASE + (0x6c << 2)) --#define P_DMC_AM1_QOS_INC MMC_REG_ADDR(DMC_AM1_QOS_INC) --#define DMC_AM1_QOS_INCBK (S_DMC_REG_BASE + (0x6d << 2)) --#define P_DMC_AM1_QOS_INCBK MMC_REG_ADDR(DMC_AM1_QOS_INCBK) --#define DMC_AM1_QOS_DEC (S_DMC_REG_BASE + (0x6e << 2)) --#define P_DMC_AM1_QOS_DEC MMC_REG_ADDR(DMC_AM1_QOS_DEC) --#define DMC_AM1_QOS_DECBK (S_DMC_REG_BASE + (0x6f << 2)) --#define P_DMC_AM1_QOS_DECBK MMC_REG_ADDR(DMC_AM1_QOS_DECBK) --#define DMC_AM1_QOS_DIS (S_DMC_REG_BASE + (0x70 << 2)) --#define P_DMC_AM1_QOS_DIS MMC_REG_ADDR(DMC_AM1_QOS_DIS) --#define DMC_AM1_QOS_DISBK (S_DMC_REG_BASE + (0x71 << 2)) --#define P_DMC_AM1_QOS_DISBK MMC_REG_ADDR(DMC_AM1_QOS_DISBK) --#define DMC_AM1_QOS_CTRL0 (S_DMC_REG_BASE + (0x72 << 2)) --#define P_DMC_AM1_QOS_CTRL0 MMC_REG_ADDR(DMC_AM1_QOS_CTRL0) --#define DMC_AM1_QOS_CTRL1 (S_DMC_REG_BASE + (0x73 << 2)) --#define P_DMC_AM1_QOS_CTRL1 MMC_REG_ADDR(DMC_AM1_QOS_CTRL1) --#define DMC_AM2_CHAN_CTRL (S_DMC_REG_BASE + (0x74 << 2)) --#define P_DMC_AM2_CHAN_CTRL MMC_REG_ADDR(DMC_AM2_CHAN_CTRL) --#define DMC_AM2_HOLD_CTRL (S_DMC_REG_BASE + (0x75 << 2)) --#define P_DMC_AM2_HOLD_CTRL MMC_REG_ADDR(DMC_AM2_HOLD_CTRL) --#define DMC_AM2_QOS_INC (S_DMC_REG_BASE + (0x76 << 2)) --#define P_DMC_AM2_QOS_INC MMC_REG_ADDR(DMC_AM2_QOS_INC) --#define DMC_AM2_QOS_INCBK (S_DMC_REG_BASE + (0x77 << 2)) --#define P_DMC_AM2_QOS_INCBK MMC_REG_ADDR(DMC_AM2_QOS_INCBK) --#define DMC_AM2_QOS_DEC (S_DMC_REG_BASE + (0x78 << 2)) --#define P_DMC_AM2_QOS_DEC MMC_REG_ADDR(DMC_AM2_QOS_DEC) --#define DMC_AM2_QOS_DECBK (S_DMC_REG_BASE + (0x79 << 2)) --#define P_DMC_AM2_QOS_DECBK MMC_REG_ADDR(DMC_AM2_QOS_DECBK) --#define DMC_AM2_QOS_DIS (S_DMC_REG_BASE + (0x7a << 2)) --#define P_DMC_AM2_QOS_DIS MMC_REG_ADDR(DMC_AM2_QOS_DIS) --#define DMC_AM2_QOS_DISBK (S_DMC_REG_BASE + (0x7b << 2)) --#define P_DMC_AM2_QOS_DISBK MMC_REG_ADDR(DMC_AM2_QOS_DISBK) --#define DMC_AM2_QOS_CTRL0 (S_DMC_REG_BASE + (0x7c << 2)) --#define P_DMC_AM2_QOS_CTRL0 MMC_REG_ADDR(DMC_AM2_QOS_CTRL0) --#define DMC_AM2_QOS_CTRL1 (S_DMC_REG_BASE + (0x7d << 2)) --#define P_DMC_AM2_QOS_CTRL1 MMC_REG_ADDR(DMC_AM2_QOS_CTRL1) --#define DMC_AM3_CHAN_CTRL (S_DMC_REG_BASE + (0x7e << 2)) --#define P_DMC_AM3_CHAN_CTRL MMC_REG_ADDR(DMC_AM3_CHAN_CTRL) --#define DMC_AM3_HOLD_CTRL (S_DMC_REG_BASE + (0x7f << 2)) --#define P_DMC_AM3_HOLD_CTRL MMC_REG_ADDR(DMC_AM3_HOLD_CTRL) --#define DMC_AM3_QOS_INC (S_DMC_REG_BASE + (0x80 << 2)) --#define P_DMC_AM3_QOS_INC MMC_REG_ADDR(DMC_AM3_QOS_INC) --#define DMC_AM3_QOS_INCBK (S_DMC_REG_BASE + (0x81 << 2)) --#define P_DMC_AM3_QOS_INCBK MMC_REG_ADDR(DMC_AM3_QOS_INCBK) --#define DMC_AM3_QOS_DEC (S_DMC_REG_BASE + (0x82 << 2)) --#define P_DMC_AM3_QOS_DEC MMC_REG_ADDR(DMC_AM3_QOS_DEC) --#define DMC_AM3_QOS_DECBK (S_DMC_REG_BASE + (0x83 << 2)) --#define P_DMC_AM3_QOS_DECBK MMC_REG_ADDR(DMC_AM3_QOS_DECBK) --#define DMC_AM3_QOS_DIS (S_DMC_REG_BASE + (0x84 << 2)) --#define P_DMC_AM3_QOS_DIS MMC_REG_ADDR(DMC_AM3_QOS_DIS) --#define DMC_AM3_QOS_DISBK (S_DMC_REG_BASE + (0x85 << 2)) --#define P_DMC_AM3_QOS_DISBK MMC_REG_ADDR(DMC_AM3_QOS_DISBK) --#define DMC_AM3_QOS_CTRL0 (S_DMC_REG_BASE + (0x86 << 2)) --#define P_DMC_AM3_QOS_CTRL0 MMC_REG_ADDR(DMC_AM3_QOS_CTRL0) --#define DMC_AM3_QOS_CTRL1 (S_DMC_REG_BASE + (0x87 << 2)) --#define P_DMC_AM3_QOS_CTRL1 MMC_REG_ADDR(DMC_AM3_QOS_CTRL1) --#define DMC_AM4_CHAN_CTRL (S_DMC_REG_BASE + (0x88 << 2)) --#define P_DMC_AM4_CHAN_CTRL MMC_REG_ADDR(DMC_AM4_CHAN_CTRL) --#define DMC_AM4_HOLD_CTRL (S_DMC_REG_BASE + (0x89 << 2)) --#define P_DMC_AM4_HOLD_CTRL MMC_REG_ADDR(DMC_AM4_HOLD_CTRL) --#define DMC_AM4_QOS_INC (S_DMC_REG_BASE + (0x8a << 2)) --#define P_DMC_AM4_QOS_INC MMC_REG_ADDR(DMC_AM4_QOS_INC) --#define DMC_AM4_QOS_INCBK (S_DMC_REG_BASE + (0x8b << 2)) --#define P_DMC_AM4_QOS_INCBK MMC_REG_ADDR(DMC_AM4_QOS_INCBK) --#define DMC_AM4_QOS_DEC (S_DMC_REG_BASE + (0x8c << 2)) --#define P_DMC_AM4_QOS_DEC MMC_REG_ADDR(DMC_AM4_QOS_DEC) --#define DMC_AM4_QOS_DECBK (S_DMC_REG_BASE + (0x8d << 2)) --#define P_DMC_AM4_QOS_DECBK MMC_REG_ADDR(DMC_AM4_QOS_DECBK) --#define DMC_AM4_QOS_DIS (S_DMC_REG_BASE + (0x8e << 2)) --#define P_DMC_AM4_QOS_DIS MMC_REG_ADDR(DMC_AM4_QOS_DIS) --#define DMC_AM4_QOS_DISBK (S_DMC_REG_BASE + (0x8f << 2)) --#define P_DMC_AM4_QOS_DISBK MMC_REG_ADDR(DMC_AM4_QOS_DISBK) --#define DMC_AM4_QOS_CTRL0 (S_DMC_REG_BASE + (0x90 << 2)) --#define P_DMC_AM4_QOS_CTRL0 MMC_REG_ADDR(DMC_AM4_QOS_CTRL0) --#define DMC_AM4_QOS_CTRL1 (S_DMC_REG_BASE + (0x91 << 2)) --#define P_DMC_AM4_QOS_CTRL1 MMC_REG_ADDR(DMC_AM4_QOS_CTRL1) --#define DMC_AM5_CHAN_CTRL (S_DMC_REG_BASE + (0x92 << 2)) --#define P_DMC_AM5_CHAN_CTRL MMC_REG_ADDR(DMC_AM5_CHAN_CTRL) --#define DMC_AM5_HOLD_CTRL (S_DMC_REG_BASE + (0x93 << 2)) --#define P_DMC_AM5_HOLD_CTRL MMC_REG_ADDR(DMC_AM5_HOLD_CTRL) --#define DMC_AM5_QOS_INC (S_DMC_REG_BASE + (0x94 << 2)) --#define P_DMC_AM5_QOS_INC MMC_REG_ADDR(DMC_AM5_QOS_INC) --#define DMC_AM5_QOS_INCBK (S_DMC_REG_BASE + (0x95 << 2)) --#define P_DMC_AM5_QOS_INCBK MMC_REG_ADDR(DMC_AM5_QOS_INCBK) --#define DMC_AM5_QOS_DEC (S_DMC_REG_BASE + (0x96 << 2)) --#define P_DMC_AM5_QOS_DEC MMC_REG_ADDR(DMC_AM5_QOS_DEC) --#define DMC_AM5_QOS_DECBK (S_DMC_REG_BASE + (0x97 << 2)) --#define P_DMC_AM5_QOS_DECBK MMC_REG_ADDR(DMC_AM5_QOS_DECBK) --#define DMC_AM5_QOS_DIS (S_DMC_REG_BASE + (0x98 << 2)) --#define P_DMC_AM5_QOS_DIS MMC_REG_ADDR(DMC_AM5_QOS_DIS) --#define DMC_AM5_QOS_DISBK (S_DMC_REG_BASE + (0x99 << 2)) --#define P_DMC_AM5_QOS_DISBK MMC_REG_ADDR(DMC_AM5_QOS_DISBK) --#define DMC_AM5_QOS_CTRL0 (S_DMC_REG_BASE + (0x9a << 2)) --#define P_DMC_AM5_QOS_CTRL0 MMC_REG_ADDR(DMC_AM5_QOS_CTRL0) --#define DMC_AM5_QOS_CTRL1 (S_DMC_REG_BASE + (0x9b << 2)) --#define P_DMC_AM5_QOS_CTRL1 MMC_REG_ADDR(DMC_AM5_QOS_CTRL1) --#define DMC_AM6_CHAN_CTRL (S_DMC_REG_BASE + (0x9c << 2)) --#define P_DMC_AM6_CHAN_CTRL MMC_REG_ADDR(DMC_AM6_CHAN_CTRL) --#define DMC_AM6_HOLD_CTRL (S_DMC_REG_BASE + (0x9d << 2)) --#define P_DMC_AM6_HOLD_CTRL MMC_REG_ADDR(DMC_AM6_HOLD_CTRL) --#define DMC_AM6_QOS_INC (S_DMC_REG_BASE + (0x9e << 2)) --#define P_DMC_AM6_QOS_INC MMC_REG_ADDR(DMC_AM6_QOS_INC) --#define DMC_AM6_QOS_INCBK (S_DMC_REG_BASE + (0x9f << 2)) --#define P_DMC_AM6_QOS_INCBK MMC_REG_ADDR(DMC_AM6_QOS_INCBK) --#define DMC_AM6_QOS_DEC (S_DMC_REG_BASE + (0xa0 << 2)) --#define P_DMC_AM6_QOS_DEC MMC_REG_ADDR(DMC_AM6_QOS_DEC) --#define DMC_AM6_QOS_DECBK (S_DMC_REG_BASE + (0xa1 << 2)) --#define P_DMC_AM6_QOS_DECBK MMC_REG_ADDR(DMC_AM6_QOS_DECBK) --#define DMC_AM6_QOS_DIS (S_DMC_REG_BASE + (0xa2 << 2)) --#define P_DMC_AM6_QOS_DIS MMC_REG_ADDR(DMC_AM6_QOS_DIS) --#define DMC_AM6_QOS_DISBK (S_DMC_REG_BASE + (0xa3 << 2)) --#define P_DMC_AM6_QOS_DISBK MMC_REG_ADDR(DMC_AM6_QOS_DISBK) --#define DMC_AM6_QOS_CTRL0 (S_DMC_REG_BASE + (0xa4 << 2)) --#define P_DMC_AM6_QOS_CTRL0 MMC_REG_ADDR(DMC_AM6_QOS_CTRL0) --#define DMC_AM6_QOS_CTRL1 (S_DMC_REG_BASE + (0xa5 << 2)) --#define P_DMC_AM6_QOS_CTRL1 MMC_REG_ADDR(DMC_AM6_QOS_CTRL1) --#define DMC_AM7_CHAN_CTRL (S_DMC_REG_BASE + (0xa6 << 2)) --#define P_DMC_AM7_CHAN_CTRL MMC_REG_ADDR(DMC_AM7_CHAN_CTRL) --#define DMC_AM7_HOLD_CTRL (S_DMC_REG_BASE + (0xa7 << 2)) --#define P_DMC_AM7_HOLD_CTRL MMC_REG_ADDR(DMC_AM7_HOLD_CTRL) --#define DMC_AM7_QOS_INC (S_DMC_REG_BASE + (0xa8 << 2)) --#define P_DMC_AM7_QOS_INC MMC_REG_ADDR(DMC_AM7_QOS_INC) --#define DMC_AM7_QOS_INCBK (S_DMC_REG_BASE + (0xa9 << 2)) --#define P_DMC_AM7_QOS_INCBK MMC_REG_ADDR(DMC_AM7_QOS_INCBK) --#define DMC_AM7_QOS_DEC (S_DMC_REG_BASE + (0xaa << 2)) --#define P_DMC_AM7_QOS_DEC MMC_REG_ADDR(DMC_AM7_QOS_DEC) --#define DMC_AM7_QOS_DECBK (S_DMC_REG_BASE + (0xab << 2)) --#define P_DMC_AM7_QOS_DECBK MMC_REG_ADDR(DMC_AM7_QOS_DECBK) --#define DMC_AM7_QOS_DIS (S_DMC_REG_BASE + (0xac << 2)) --#define P_DMC_AM7_QOS_DIS MMC_REG_ADDR(DMC_AM7_QOS_DIS) --#define DMC_AM7_QOS_DISBK (S_DMC_REG_BASE + (0xad << 2)) --#define P_DMC_AM7_QOS_DISBK MMC_REG_ADDR(DMC_AM7_QOS_DISBK) --#define DMC_AM7_QOS_CTRL0 (S_DMC_REG_BASE + (0xae << 2)) --#define P_DMC_AM7_QOS_CTRL0 MMC_REG_ADDR(DMC_AM7_QOS_CTRL0) --#define DMC_AM7_QOS_CTRL1 (S_DMC_REG_BASE + (0xaf << 2)) --#define P_DMC_AM7_QOS_CTRL1 MMC_REG_ADDR(DMC_AM7_QOS_CTRL1) --#define DMC_AXI0_CHAN_CTRL (S_DMC_REG_BASE + (0xb0 << 2)) --#define P_DMC_AXI0_CHAN_CTRL MMC_REG_ADDR(DMC_AXI0_CHAN_CTRL) --#define DMC_AXI0_HOLD_CTRL (S_DMC_REG_BASE + (0xb1 << 2)) --#define P_DMC_AXI0_HOLD_CTRL MMC_REG_ADDR(DMC_AXI0_HOLD_CTRL) --#define DMC_AXI0_QOS_INC (S_DMC_REG_BASE + (0xb2 << 2)) --#define P_DMC_AXI0_QOS_INC MMC_REG_ADDR(DMC_AXI0_QOS_INC) --#define DMC_AXI0_QOS_INCBK (S_DMC_REG_BASE + (0xb3 << 2)) --#define P_DMC_AXI0_QOS_INCBK MMC_REG_ADDR(DMC_AXI0_QOS_INCBK) --#define DMC_AXI0_QOS_DEC (S_DMC_REG_BASE + (0xb4 << 2)) --#define P_DMC_AXI0_QOS_DEC MMC_REG_ADDR(DMC_AXI0_QOS_DEC) --#define DMC_AXI0_QOS_DECBK (S_DMC_REG_BASE + (0xb5 << 2)) --#define P_DMC_AXI0_QOS_DECBK MMC_REG_ADDR(DMC_AXI0_QOS_DECBK) --#define DMC_AXI0_QOS_DIS (S_DMC_REG_BASE + (0xb6 << 2)) --#define P_DMC_AXI0_QOS_DIS MMC_REG_ADDR(DMC_AXI0_QOS_DIS) --#define DMC_AXI0_QOS_DISBK (S_DMC_REG_BASE + (0xb7 << 2)) --#define P_DMC_AXI0_QOS_DISBK MMC_REG_ADDR(DMC_AXI0_QOS_DISBK) --#define DMC_AXI0_QOS_CTRL0 (S_DMC_REG_BASE + (0xb8 << 2)) --#define P_DMC_AXI0_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI0_QOS_CTRL0) --#define DMC_AXI0_QOS_CTRL1 (S_DMC_REG_BASE + (0xb9 << 2)) --#define P_DMC_AXI0_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI0_QOS_CTRL1) --#define DMC_AXI1_CHAN_CTRL (S_DMC_REG_BASE + (0xba << 2)) --#define P_DMC_AXI1_CHAN_CTRL MMC_REG_ADDR(DMC_AXI1_CHAN_CTRL) --#define DMC_AXI1_HOLD_CTRL (S_DMC_REG_BASE + (0xbb << 2)) --#define P_DMC_AXI1_HOLD_CTRL MMC_REG_ADDR(DMC_AXI1_HOLD_CTRL) --#define DMC_AXI1_QOS_INC (S_DMC_REG_BASE + (0xbc << 2)) --#define P_DMC_AXI1_QOS_INC MMC_REG_ADDR(DMC_AXI1_QOS_INC) --#define DMC_AXI1_QOS_INCBK (S_DMC_REG_BASE + (0xbd << 2)) --#define P_DMC_AXI1_QOS_INCBK MMC_REG_ADDR(DMC_AXI1_QOS_INCBK) --#define DMC_AXI1_QOS_DEC (S_DMC_REG_BASE + (0xbe << 2)) --#define P_DMC_AXI1_QOS_DEC MMC_REG_ADDR(DMC_AXI1_QOS_DEC) --#define DMC_AXI1_QOS_DECBK (S_DMC_REG_BASE + (0xbf << 2)) --#define P_DMC_AXI1_QOS_DECBK MMC_REG_ADDR(DMC_AXI1_QOS_DECBK) --#define DMC_AXI1_QOS_DIS (S_DMC_REG_BASE + (0xc0 << 2)) --#define P_DMC_AXI1_QOS_DIS MMC_REG_ADDR(DMC_AXI1_QOS_DIS) --#define DMC_AXI1_QOS_DISBK (S_DMC_REG_BASE + (0xc1 << 2)) --#define P_DMC_AXI1_QOS_DISBK MMC_REG_ADDR(DMC_AXI1_QOS_DISBK) --#define DMC_AXI1_QOS_CTRL0 (S_DMC_REG_BASE + (0xc2 << 2)) --#define P_DMC_AXI1_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI1_QOS_CTRL0) --#define DMC_AXI1_QOS_CTRL1 (S_DMC_REG_BASE + (0xc3 << 2)) --#define P_DMC_AXI1_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI1_QOS_CTRL1) --#define DMC_AXI2_CHAN_CTRL (S_DMC_REG_BASE + (0xc4 << 2)) --#define P_DMC_AXI2_CHAN_CTRL MMC_REG_ADDR(DMC_AXI2_CHAN_CTRL) --#define DMC_AXI2_HOLD_CTRL (S_DMC_REG_BASE + (0xc5 << 2)) --#define P_DMC_AXI2_HOLD_CTRL MMC_REG_ADDR(DMC_AXI2_HOLD_CTRL) --#define DMC_AXI2_QOS_INC (S_DMC_REG_BASE + (0xc6 << 2)) --#define P_DMC_AXI2_QOS_INC MMC_REG_ADDR(DMC_AXI2_QOS_INC) --#define DMC_AXI2_QOS_INCBK (S_DMC_REG_BASE + (0xc7 << 2)) --#define P_DMC_AXI2_QOS_INCBK MMC_REG_ADDR(DMC_AXI2_QOS_INCBK) --#define DMC_AXI2_QOS_DEC (S_DMC_REG_BASE + (0xc8 << 2)) --#define P_DMC_AXI2_QOS_DEC MMC_REG_ADDR(DMC_AXI2_QOS_DEC) --#define DMC_AXI2_QOS_DECBK (S_DMC_REG_BASE + (0xc9 << 2)) --#define P_DMC_AXI2_QOS_DECBK MMC_REG_ADDR(DMC_AXI2_QOS_DECBK) --#define DMC_AXI2_QOS_DIS (S_DMC_REG_BASE + (0xca << 2)) --#define P_DMC_AXI2_QOS_DIS MMC_REG_ADDR(DMC_AXI2_QOS_DIS) --#define DMC_AXI2_QOS_DISBK (S_DMC_REG_BASE + (0xcb << 2)) --#define P_DMC_AXI2_QOS_DISBK MMC_REG_ADDR(DMC_AXI2_QOS_DISBK) --#define DMC_AXI2_QOS_CTRL0 (S_DMC_REG_BASE + (0xcc << 2)) --#define P_DMC_AXI2_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI2_QOS_CTRL0) --#define DMC_AXI2_QOS_CTRL1 (S_DMC_REG_BASE + (0xcd << 2)) --#define P_DMC_AXI2_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI2_QOS_CTRL1) --#define DMC_AXI3_CHAN_CTRL (S_DMC_REG_BASE + (0xce << 2)) --#define P_DMC_AXI3_CHAN_CTRL MMC_REG_ADDR(DMC_AXI3_CHAN_CTRL) --#define DMC_AXI3_HOLD_CTRL (S_DMC_REG_BASE + (0xcf << 2)) --#define P_DMC_AXI3_HOLD_CTRL MMC_REG_ADDR(DMC_AXI3_HOLD_CTRL) --#define DMC_AXI3_QOS_INC (S_DMC_REG_BASE + (0xd0 << 2)) --#define P_DMC_AXI3_QOS_INC MMC_REG_ADDR(DMC_AXI3_QOS_INC) --#define DMC_AXI3_QOS_INCBK (S_DMC_REG_BASE + (0xd1 << 2)) --#define P_DMC_AXI3_QOS_INCBK MMC_REG_ADDR(DMC_AXI3_QOS_INCBK) --#define DMC_AXI3_QOS_DEC (S_DMC_REG_BASE + (0xd2 << 2)) --#define P_DMC_AXI3_QOS_DEC MMC_REG_ADDR(DMC_AXI3_QOS_DEC) --#define DMC_AXI3_QOS_DECBK (S_DMC_REG_BASE + (0xd3 << 2)) --#define P_DMC_AXI3_QOS_DECBK MMC_REG_ADDR(DMC_AXI3_QOS_DECBK) --#define DMC_AXI3_QOS_DIS (S_DMC_REG_BASE + (0xd4 << 2)) --#define P_DMC_AXI3_QOS_DIS MMC_REG_ADDR(DMC_AXI3_QOS_DIS) --#define DMC_AXI3_QOS_DISBK (S_DMC_REG_BASE + (0xd5 << 2)) --#define P_DMC_AXI3_QOS_DISBK MMC_REG_ADDR(DMC_AXI3_QOS_DISBK) --#define DMC_AXI3_QOS_CTRL0 (S_DMC_REG_BASE + (0xd6 << 2)) --#define P_DMC_AXI3_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI3_QOS_CTRL0) --#define DMC_AXI3_QOS_CTRL1 (S_DMC_REG_BASE + (0xd7 << 2)) --#define P_DMC_AXI3_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI3_QOS_CTRL1) --#define DMC_AXI4_CHAN_CTRL (S_DMC_REG_BASE + (0xd8 << 2)) --#define P_DMC_AXI4_CHAN_CTRL MMC_REG_ADDR(DMC_AXI4_CHAN_CTRL) --#define DMC_AXI4_HOLD_CTRL (S_DMC_REG_BASE + (0xd9 << 2)) --#define P_DMC_AXI4_HOLD_CTRL MMC_REG_ADDR(DMC_AXI4_HOLD_CTRL) --#define DMC_AXI4_QOS_INC (S_DMC_REG_BASE + (0xda << 2)) --#define P_DMC_AXI4_QOS_INC MMC_REG_ADDR(DMC_AXI4_QOS_INC) --#define DMC_AXI4_QOS_INCBK (S_DMC_REG_BASE + (0xdb << 2)) --#define P_DMC_AXI4_QOS_INCBK MMC_REG_ADDR(DMC_AXI4_QOS_INCBK) --#define DMC_AXI4_QOS_DEC (S_DMC_REG_BASE + (0xdc << 2)) --#define P_DMC_AXI4_QOS_DEC MMC_REG_ADDR(DMC_AXI4_QOS_DEC) --#define DMC_AXI4_QOS_DECBK (S_DMC_REG_BASE + (0xdd << 2)) --#define P_DMC_AXI4_QOS_DECBK MMC_REG_ADDR(DMC_AXI4_QOS_DECBK) --#define DMC_AXI4_QOS_DIS (S_DMC_REG_BASE + (0xde << 2)) --#define P_DMC_AXI4_QOS_DIS MMC_REG_ADDR(DMC_AXI4_QOS_DIS) --#define DMC_AXI4_QOS_DISBK (S_DMC_REG_BASE + (0xdf << 2)) --#define P_DMC_AXI4_QOS_DISBK MMC_REG_ADDR(DMC_AXI4_QOS_DISBK) --#define DMC_AXI4_QOS_CTRL0 (S_DMC_REG_BASE + (0xe0 << 2)) --#define P_DMC_AXI4_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI4_QOS_CTRL0) --#define DMC_AXI4_QOS_CTRL1 (S_DMC_REG_BASE + (0xe1 << 2)) --#define P_DMC_AXI4_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI4_QOS_CTRL1) --#define DMC_AXI5_CHAN_CTRL (S_DMC_REG_BASE + (0xe2 << 2)) --#define P_DMC_AXI5_CHAN_CTRL MMC_REG_ADDR(DMC_AXI5_CHAN_CTRL) --#define DMC_AXI5_HOLD_CTRL (S_DMC_REG_BASE + (0xe3 << 2)) --#define P_DMC_AXI5_HOLD_CTRL MMC_REG_ADDR(DMC_AXI5_HOLD_CTRL) --#define DMC_AXI5_QOS_INC (S_DMC_REG_BASE + (0xe4 << 2)) --#define P_DMC_AXI5_QOS_INC MMC_REG_ADDR(DMC_AXI5_QOS_INC) --#define DMC_AXI5_QOS_INCBK (S_DMC_REG_BASE + (0xe5 << 2)) --#define P_DMC_AXI5_QOS_INCBK MMC_REG_ADDR(DMC_AXI5_QOS_INCBK) --#define DMC_AXI5_QOS_DEC (S_DMC_REG_BASE + (0xe6 << 2)) --#define P_DMC_AXI5_QOS_DEC MMC_REG_ADDR(DMC_AXI5_QOS_DEC) --#define DMC_AXI5_QOS_DECBK (S_DMC_REG_BASE + (0xe7 << 2)) --#define P_DMC_AXI5_QOS_DECBK MMC_REG_ADDR(DMC_AXI5_QOS_DECBK) --#define DMC_AXI5_QOS_DIS (S_DMC_REG_BASE + (0xe8 << 2)) --#define P_DMC_AXI5_QOS_DIS MMC_REG_ADDR(DMC_AXI5_QOS_DIS) --#define DMC_AXI5_QOS_DISBK (S_DMC_REG_BASE + (0xe9 << 2)) --#define P_DMC_AXI5_QOS_DISBK MMC_REG_ADDR(DMC_AXI5_QOS_DISBK) --#define DMC_AXI5_QOS_CTRL0 (S_DMC_REG_BASE + (0xea << 2)) --#define P_DMC_AXI5_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI5_QOS_CTRL0) --#define DMC_AXI5_QOS_CTRL1 (S_DMC_REG_BASE + (0xeb << 2)) --#define P_DMC_AXI5_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI5_QOS_CTRL1) --#define DMC_AXI6_CHAN_CTRL (S_DMC_REG_BASE + (0xec << 2)) --#define P_DMC_AXI6_CHAN_CTRL MMC_REG_ADDR(DMC_AXI6_CHAN_CTRL) --#define DMC_AXI6_HOLD_CTRL (S_DMC_REG_BASE + (0xed << 2)) --#define P_DMC_AXI6_HOLD_CTRL MMC_REG_ADDR(DMC_AXI6_HOLD_CTRL) --#define DMC_AXI6_QOS_INC (S_DMC_REG_BASE + (0xee << 2)) --#define P_DMC_AXI6_QOS_INC MMC_REG_ADDR(DMC_AXI6_QOS_INC) --#define DMC_AXI6_QOS_INCBK (S_DMC_REG_BASE + (0xef << 2)) --#define P_DMC_AXI6_QOS_INCBK MMC_REG_ADDR(DMC_AXI6_QOS_INCBK) --#define DMC_AXI6_QOS_DEC (S_DMC_REG_BASE + (0xf0 << 2)) --#define P_DMC_AXI6_QOS_DEC MMC_REG_ADDR(DMC_AXI6_QOS_DEC) --#define DMC_AXI6_QOS_DECBK (S_DMC_REG_BASE + (0xf1 << 2)) --#define P_DMC_AXI6_QOS_DECBK MMC_REG_ADDR(DMC_AXI6_QOS_DECBK) --#define DMC_AXI6_QOS_DIS (S_DMC_REG_BASE + (0xf2 << 2)) --#define P_DMC_AXI6_QOS_DIS MMC_REG_ADDR(DMC_AXI6_QOS_DIS) --#define DMC_AXI6_QOS_DISBK (S_DMC_REG_BASE + (0xf3 << 2)) --#define P_DMC_AXI6_QOS_DISBK MMC_REG_ADDR(DMC_AXI6_QOS_DISBK) --#define DMC_AXI6_QOS_CTRL0 (S_DMC_REG_BASE + (0xf4 << 2)) --#define P_DMC_AXI6_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI6_QOS_CTRL0) --#define DMC_AXI6_QOS_CTRL1 (S_DMC_REG_BASE + (0xf5 << 2)) --#define P_DMC_AXI6_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI6_QOS_CTRL1) --#define DMC_AXI7_CHAN_CTRL (S_DMC_REG_BASE + (0xf6 << 2)) --#define P_DMC_AXI7_CHAN_CTRL MMC_REG_ADDR(DMC_AXI7_CHAN_CTRL) --#define DMC_AXI7_HOLD_CTRL (S_DMC_REG_BASE + (0xf7 << 2)) --#define P_DMC_AXI7_HOLD_CTRL MMC_REG_ADDR(DMC_AXI7_HOLD_CTRL) --#define DMC_AXI7_QOS_INC (S_DMC_REG_BASE + (0xf8 << 2)) --#define P_DMC_AXI7_QOS_INC MMC_REG_ADDR(DMC_AXI7_QOS_INC) --#define DMC_AXI7_QOS_INCBK (S_DMC_REG_BASE + (0xf9 << 2)) --#define P_DMC_AXI7_QOS_INCBK MMC_REG_ADDR(DMC_AXI7_QOS_INCBK) --#define DMC_AXI7_QOS_DEC (S_DMC_REG_BASE + (0xfa << 2)) --#define P_DMC_AXI7_QOS_DEC MMC_REG_ADDR(DMC_AXI7_QOS_DEC) --#define DMC_AXI7_QOS_DECBK (S_DMC_REG_BASE + (0xfb << 2)) --#define P_DMC_AXI7_QOS_DECBK MMC_REG_ADDR(DMC_AXI7_QOS_DECBK) --#define DMC_AXI7_QOS_DIS (S_DMC_REG_BASE + (0xfc << 2)) --#define P_DMC_AXI7_QOS_DIS MMC_REG_ADDR(DMC_AXI7_QOS_DIS) --#define DMC_AXI7_QOS_DISBK (S_DMC_REG_BASE + (0xfd << 2)) --#define P_DMC_AXI7_QOS_DISBK MMC_REG_ADDR(DMC_AXI7_QOS_DISBK) --#define DMC_AXI7_QOS_CTRL0 (S_DMC_REG_BASE + (0xfe << 2)) --#define P_DMC_AXI7_QOS_CTRL0 MMC_REG_ADDR(DMC_AXI7_QOS_CTRL0) --#define DMC_AXI7_QOS_CTRL1 (S_DMC_REG_BASE + (0xff << 2)) --#define P_DMC_AXI7_QOS_CTRL1 MMC_REG_ADDR(DMC_AXI7_QOS_CTRL1) --/**/ --#define STB_VERSION 0x1600 --#define P_STB_VERSION CBUS_REG_ADDR(STB_VERSION) --#define STB_VERSION_2 0x1650 --#define P_STB_VERSION_2 CBUS_REG_ADDR(STB_VERSION_2) --#define STB_VERSION_3 0x16a0 --#define P_STB_VERSION_3 CBUS_REG_ADDR(STB_VERSION_3) --#define STB_TEST_REG 0x1601 --#define P_STB_TEST_REG CBUS_REG_ADDR(STB_TEST_REG) --#define STB_TEST_REG_2 0x1651 --#define P_STB_TEST_REG_2 CBUS_REG_ADDR(STB_TEST_REG_2) --#define STB_TEST_REG_3 0x16a1 --#define P_STB_TEST_REG_3 CBUS_REG_ADDR(STB_TEST_REG_3) --#define FEC_INPUT_CONTROL 0x1602 --#define P_FEC_INPUT_CONTROL CBUS_REG_ADDR(FEC_INPUT_CONTROL) --#define FEC_INPUT_CONTROL_2 0x1652 --#define P_FEC_INPUT_CONTROL_2 CBUS_REG_ADDR(FEC_INPUT_CONTROL_2) --#define FEC_INPUT_CONTROL_3 0x16a2 --#define P_FEC_INPUT_CONTROL_3 CBUS_REG_ADDR(FEC_INPUT_CONTROL_3) --#define FEC_INPUT_DATA 0x1603 --#define P_FEC_INPUT_DATA CBUS_REG_ADDR(FEC_INPUT_DATA) --#define FEC_INPUT_DATA_2 0x1653 --#define P_FEC_INPUT_DATA_2 CBUS_REG_ADDR(FEC_INPUT_DATA_2) --#define FEC_INPUT_DATA_3 0x16a3 --#define P_FEC_INPUT_DATA_3 CBUS_REG_ADDR(FEC_INPUT_DATA_3) --#define DEMUX_CONTROL 0x1604 --#define P_DEMUX_CONTROL CBUS_REG_ADDR(DEMUX_CONTROL) --#define DEMUX_CONTROL_2 0x1654 --#define P_DEMUX_CONTROL_2 CBUS_REG_ADDR(DEMUX_CONTROL_2) --#define DEMUX_CONTROL_3 0x16a4 --#define P_DEMUX_CONTROL_3 CBUS_REG_ADDR(DEMUX_CONTROL_3) --#define FEC_SYNC_BYTE 0x1605 --#define P_FEC_SYNC_BYTE CBUS_REG_ADDR(FEC_SYNC_BYTE) --#define FEC_SYNC_BYTE_2 0x1655 --#define P_FEC_SYNC_BYTE_2 CBUS_REG_ADDR(FEC_SYNC_BYTE_2) --#define FEC_SYNC_BYTE_3 0x16a5 --#define P_FEC_SYNC_BYTE_3 CBUS_REG_ADDR(FEC_SYNC_BYTE_3) --#define FM_WR_DATA 0x1606 --#define P_FM_WR_DATA CBUS_REG_ADDR(FM_WR_DATA) --#define FM_WR_DATA_2 0x1656 --#define P_FM_WR_DATA_2 CBUS_REG_ADDR(FM_WR_DATA_2) --#define FM_WR_DATA_3 0x16a6 --#define P_FM_WR_DATA_3 CBUS_REG_ADDR(FM_WR_DATA_3) --#define FM_WR_ADDR 0x1607 --#define P_FM_WR_ADDR CBUS_REG_ADDR(FM_WR_ADDR) --#define FM_WR_ADDR_2 0x1657 --#define P_FM_WR_ADDR_2 CBUS_REG_ADDR(FM_WR_ADDR_2) --#define FM_WR_ADDR_3 0x16a7 --#define P_FM_WR_ADDR_3 CBUS_REG_ADDR(FM_WR_ADDR_3) --#define MAX_FM_COMP_ADDR 0x1608 --#define P_MAX_FM_COMP_ADDR CBUS_REG_ADDR(MAX_FM_COMP_ADDR) --#define MAX_FM_COMP_ADDR_2 0x1658 --#define P_MAX_FM_COMP_ADDR_2 CBUS_REG_ADDR(MAX_FM_COMP_ADDR_2) --#define MAX_FM_COMP_ADDR_3 0x16a8 --#define P_MAX_FM_COMP_ADDR_3 CBUS_REG_ADDR(MAX_FM_COMP_ADDR_3) --#define TS_HEAD_0 0x1609 --#define P_TS_HEAD_0 CBUS_REG_ADDR(TS_HEAD_0) --#define TS_HEAD_0_2 0x1659 --#define P_TS_HEAD_0_2 CBUS_REG_ADDR(TS_HEAD_0_2) --#define TS_HEAD_0_3 0x16a9 --#define P_TS_HEAD_0_3 CBUS_REG_ADDR(TS_HEAD_0_3) --#define TS_HEAD_1 0x160a --#define P_TS_HEAD_1 CBUS_REG_ADDR(TS_HEAD_1) --#define TS_HEAD_1_2 0x165a --#define P_TS_HEAD_1_2 CBUS_REG_ADDR(TS_HEAD_1_2) --#define TS_HEAD_1_3 0x16aa --#define P_TS_HEAD_1_3 CBUS_REG_ADDR(TS_HEAD_1_3) --#define OM_CMD_STATUS 0x160b --#define P_OM_CMD_STATUS CBUS_REG_ADDR(OM_CMD_STATUS) --#define OM_CMD_STATUS_2 0x165b --#define P_OM_CMD_STATUS_2 CBUS_REG_ADDR(OM_CMD_STATUS_2) --#define OM_CMD_STATUS_3 0x16ab --#define P_OM_CMD_STATUS_3 CBUS_REG_ADDR(OM_CMD_STATUS_3) --#define OM_CMD_DATA 0x160c --#define P_OM_CMD_DATA CBUS_REG_ADDR(OM_CMD_DATA) --#define OM_CMD_DATA_2 0x165c --#define P_OM_CMD_DATA_2 CBUS_REG_ADDR(OM_CMD_DATA_2) --#define OM_CMD_DATA_3 0x16ac --#define P_OM_CMD_DATA_3 CBUS_REG_ADDR(OM_CMD_DATA_3) --#define OM_CMD_DATA2 0x160d --#define P_OM_CMD_DATA2 CBUS_REG_ADDR(OM_CMD_DATA2) --#define OM_CMD_DATA2_2 0x165d --#define P_OM_CMD_DATA2_2 CBUS_REG_ADDR(OM_CMD_DATA2_2) --#define OM_CMD_DATA2_3 0x16ad --#define P_OM_CMD_DATA2_3 CBUS_REG_ADDR(OM_CMD_DATA2_3) --#define SEC_BUFF_01_START 0x160e --#define P_SEC_BUFF_01_START CBUS_REG_ADDR(SEC_BUFF_01_START) --#define SEC_BUFF_01_START_2 0x165e --#define P_SEC_BUFF_01_START_2 CBUS_REG_ADDR(SEC_BUFF_01_START_2) --#define SEC_BUFF_01_START_3 0x16ae --#define P_SEC_BUFF_01_START_3 CBUS_REG_ADDR(SEC_BUFF_01_START_3) --#define SEC_BUFF_23_START 0x160f --#define P_SEC_BUFF_23_START CBUS_REG_ADDR(SEC_BUFF_23_START) --#define SEC_BUFF_23_START_2 0x165f --#define P_SEC_BUFF_23_START_2 CBUS_REG_ADDR(SEC_BUFF_23_START_2) --#define SEC_BUFF_23_START_3 0x16af --#define P_SEC_BUFF_23_START_3 CBUS_REG_ADDR(SEC_BUFF_23_START_3) --#define SEC_BUFF_SIZE 0x1610 --#define P_SEC_BUFF_SIZE CBUS_REG_ADDR(SEC_BUFF_SIZE) --#define SEC_BUFF_SIZE_2 0x1660 --#define P_SEC_BUFF_SIZE_2 CBUS_REG_ADDR(SEC_BUFF_SIZE_2) --#define SEC_BUFF_SIZE_3 0x16b0 --#define P_SEC_BUFF_SIZE_3 CBUS_REG_ADDR(SEC_BUFF_SIZE_3) --#define SEC_BUFF_BUSY 0x1611 --#define P_SEC_BUFF_BUSY CBUS_REG_ADDR(SEC_BUFF_BUSY) --#define SEC_BUFF_BUSY_2 0x1661 --#define P_SEC_BUFF_BUSY_2 CBUS_REG_ADDR(SEC_BUFF_BUSY_2) --#define SEC_BUFF_BUSY_3 0x16b1 --#define P_SEC_BUFF_BUSY_3 CBUS_REG_ADDR(SEC_BUFF_BUSY_3) --#define SEC_BUFF_READY 0x1612 --#define P_SEC_BUFF_READY CBUS_REG_ADDR(SEC_BUFF_READY) --#define SEC_BUFF_READY_2 0x1662 --#define P_SEC_BUFF_READY_2 CBUS_REG_ADDR(SEC_BUFF_READY_2) --#define SEC_BUFF_READY_3 0x16b2 --#define P_SEC_BUFF_READY_3 CBUS_REG_ADDR(SEC_BUFF_READY_3) --#define SEC_BUFF_NUMBER 0x1613 --#define P_SEC_BUFF_NUMBER CBUS_REG_ADDR(SEC_BUFF_NUMBER) --#define SEC_BUFF_NUMBER_2 0x1663 --#define P_SEC_BUFF_NUMBER_2 CBUS_REG_ADDR(SEC_BUFF_NUMBER_2) --#define SEC_BUFF_NUMBER_3 0x16b3 --#define P_SEC_BUFF_NUMBER_3 CBUS_REG_ADDR(SEC_BUFF_NUMBER_3) --#define ASSIGN_PID_NUMBER 0x1614 --#define P_ASSIGN_PID_NUMBER CBUS_REG_ADDR(ASSIGN_PID_NUMBER) --#define ASSIGN_PID_NUMBER_2 0x1664 --#define P_ASSIGN_PID_NUMBER_2 CBUS_REG_ADDR(ASSIGN_PID_NUMBER_2) --#define ASSIGN_PID_NUMBER_3 0x16b4 --#define P_ASSIGN_PID_NUMBER_3 CBUS_REG_ADDR(ASSIGN_PID_NUMBER_3) --#define VIDEO_STREAM_ID 0x1615 --#define P_VIDEO_STREAM_ID CBUS_REG_ADDR(VIDEO_STREAM_ID) --#define VIDEO_STREAM_ID_2 0x1665 --#define P_VIDEO_STREAM_ID_2 CBUS_REG_ADDR(VIDEO_STREAM_ID_2) --#define VIDEO_STREAM_ID_3 0x16b5 --#define P_VIDEO_STREAM_ID_3 CBUS_REG_ADDR(VIDEO_STREAM_ID_3) --#define AUDIO_STREAM_ID 0x1616 --#define P_AUDIO_STREAM_ID CBUS_REG_ADDR(AUDIO_STREAM_ID) --#define AUDIO_STREAM_ID_2 0x1666 --#define P_AUDIO_STREAM_ID_2 CBUS_REG_ADDR(AUDIO_STREAM_ID_2) --#define AUDIO_STREAM_ID_3 0x16b6 --#define P_AUDIO_STREAM_ID_3 CBUS_REG_ADDR(AUDIO_STREAM_ID_3) --#define SUB_STREAM_ID 0x1617 --#define P_SUB_STREAM_ID CBUS_REG_ADDR(SUB_STREAM_ID) --#define SUB_STREAM_ID_2 0x1667 --#define P_SUB_STREAM_ID_2 CBUS_REG_ADDR(SUB_STREAM_ID_2) --#define SUB_STREAM_ID_3 0x16b7 --#define P_SUB_STREAM_ID_3 CBUS_REG_ADDR(SUB_STREAM_ID_3) --#define OTHER_STREAM_ID 0x1618 --#define P_OTHER_STREAM_ID CBUS_REG_ADDR(OTHER_STREAM_ID) --#define OTHER_STREAM_ID_2 0x1668 --#define P_OTHER_STREAM_ID_2 CBUS_REG_ADDR(OTHER_STREAM_ID_2) --#define OTHER_STREAM_ID_3 0x16b8 --#define P_OTHER_STREAM_ID_3 CBUS_REG_ADDR(OTHER_STREAM_ID_3) --#define PCR90K_CTL 0x1619 --#define P_PCR90K_CTL CBUS_REG_ADDR(PCR90K_CTL) --#define PCR90K_CTL_2 0x1669 --#define P_PCR90K_CTL_2 CBUS_REG_ADDR(PCR90K_CTL_2) --#define PCR90K_CTL_3 0x16b9 --#define P_PCR90K_CTL_3 CBUS_REG_ADDR(PCR90K_CTL_3) --#define PCR_DEMUX 0x161a --#define P_PCR_DEMUX CBUS_REG_ADDR(PCR_DEMUX) --#define PCR_DEMUX_2 0x166a --#define P_PCR_DEMUX_2 CBUS_REG_ADDR(PCR_DEMUX_2) --#define PCR_DEMUX_3 0x16ba --#define P_PCR_DEMUX_3 CBUS_REG_ADDR(PCR_DEMUX_3) --#define VIDEO_PTS_DEMUX 0x161b --#define P_VIDEO_PTS_DEMUX CBUS_REG_ADDR(VIDEO_PTS_DEMUX) --#define VIDEO_PTS_DEMUX_2 0x166b --#define P_VIDEO_PTS_DEMUX_2 CBUS_REG_ADDR(VIDEO_PTS_DEMUX_2) --#define VIDEO_PTS_DEMUX_3 0x16bb --#define P_VIDEO_PTS_DEMUX_3 CBUS_REG_ADDR(VIDEO_PTS_DEMUX_3) --#define VIDEO_DTS_DEMUX 0x161c --#define P_VIDEO_DTS_DEMUX CBUS_REG_ADDR(VIDEO_DTS_DEMUX) --#define VIDEO_DTS_DEMUX_2 0x166c --#define P_VIDEO_DTS_DEMUX_2 CBUS_REG_ADDR(VIDEO_DTS_DEMUX_2) --#define VIDEO_DTS_DEMUX_3 0x16bc --#define P_VIDEO_DTS_DEMUX_3 CBUS_REG_ADDR(VIDEO_DTS_DEMUX_3) --#define AUDIO_PTS_DEMUX 0x161d --#define P_AUDIO_PTS_DEMUX CBUS_REG_ADDR(AUDIO_PTS_DEMUX) --#define AUDIO_PTS_DEMUX_2 0x166d --#define P_AUDIO_PTS_DEMUX_2 CBUS_REG_ADDR(AUDIO_PTS_DEMUX_2) --#define AUDIO_PTS_DEMUX_3 0x16bd --#define P_AUDIO_PTS_DEMUX_3 CBUS_REG_ADDR(AUDIO_PTS_DEMUX_3) --#define SUB_PTS_DEMUX 0x161e --#define P_SUB_PTS_DEMUX CBUS_REG_ADDR(SUB_PTS_DEMUX) --#define SUB_PTS_DEMUX_2 0x166e --#define P_SUB_PTS_DEMUX_2 CBUS_REG_ADDR(SUB_PTS_DEMUX_2) --#define SUB_PTS_DEMUX_3 0x16be --#define P_SUB_PTS_DEMUX_3 CBUS_REG_ADDR(SUB_PTS_DEMUX_3) --#define STB_PTS_DTS_STATUS 0x161f --#define P_STB_PTS_DTS_STATUS CBUS_REG_ADDR(STB_PTS_DTS_STATUS) --#define STB_PTS_DTS_STATUS_2 0x166f --#define P_STB_PTS_DTS_STATUS_2 CBUS_REG_ADDR(STB_PTS_DTS_STATUS_2) --#define STB_PTS_DTS_STATUS_3 0x16bf --#define P_STB_PTS_DTS_STATUS_3 CBUS_REG_ADDR(STB_PTS_DTS_STATUS_3) --#define STB_DEBUG_INDEX 0x1620 --#define P_STB_DEBUG_INDEX CBUS_REG_ADDR(STB_DEBUG_INDEX) --#define STB_DEBUG_INDEX_2 0x1670 --#define P_STB_DEBUG_INDEX_2 CBUS_REG_ADDR(STB_DEBUG_INDEX_2) --#define STB_DEBUG_INDEX_3 0x16c0 --#define P_STB_DEBUG_INDEX_3 CBUS_REG_ADDR(STB_DEBUG_INDEX_3) --#define STB_DEBUG_DATAUT_O 0x1621 --#define P_STB_DEBUG_DATAUT_O CBUS_REG_ADDR(STB_DEBUG_DATAUT_O) --#define STB_DEBUG_DATAUT_O_2 0x1671 --#define P_STB_DEBUG_DATAUT_O_2 CBUS_REG_ADDR(STB_DEBUG_DATAUT_O_2) --#define STB_DEBUG_DATAUT_O_3 0x16c1 --#define P_STB_DEBUG_DATAUT_O_3 CBUS_REG_ADDR(STB_DEBUG_DATAUT_O_3) --#define STBM_CTL_O 0x1622 --#define P_STBM_CTL_O CBUS_REG_ADDR(STBM_CTL_O) --#define STBM_CTL_O_2 0x1672 --#define P_STBM_CTL_O_2 CBUS_REG_ADDR(STBM_CTL_O_2) --#define STBM_CTL_O_3 0x16c2 --#define P_STBM_CTL_O_3 CBUS_REG_ADDR(STBM_CTL_O_3) --#define STB_INT_STATUS 0x1623 --#define P_STB_INT_STATUS CBUS_REG_ADDR(STB_INT_STATUS) --#define STB_INT_STATUS_2 0x1673 --#define P_STB_INT_STATUS_2 CBUS_REG_ADDR(STB_INT_STATUS_2) --#define STB_INT_STATUS_3 0x16c3 --#define P_STB_INT_STATUS_3 CBUS_REG_ADDR(STB_INT_STATUS_3) --#define DEMUX_ENDIAN 0x1624 --#define P_DEMUX_ENDIAN CBUS_REG_ADDR(DEMUX_ENDIAN) --#define DEMUX_ENDIAN_2 0x1674 --#define P_DEMUX_ENDIAN_2 CBUS_REG_ADDR(DEMUX_ENDIAN_2) --#define DEMUX_ENDIAN_3 0x16c4 --#define P_DEMUX_ENDIAN_3 CBUS_REG_ADDR(DEMUX_ENDIAN_3) --#define TS_HIU_CTL 0x1625 --#define P_TS_HIU_CTL CBUS_REG_ADDR(TS_HIU_CTL) --#define TS_HIU_CTL_2 0x1675 --#define P_TS_HIU_CTL_2 CBUS_REG_ADDR(TS_HIU_CTL_2) --#define TS_HIU_CTL_3 0x16c5 --#define P_TS_HIU_CTL_3 CBUS_REG_ADDR(TS_HIU_CTL_3) --#define SEC_BUFF_BASE 0x1626 --#define P_SEC_BUFF_BASE CBUS_REG_ADDR(SEC_BUFF_BASE) --#define SEC_BUFF_BASE_2 0x1676 --#define P_SEC_BUFF_BASE_2 CBUS_REG_ADDR(SEC_BUFF_BASE_2) --#define SEC_BUFF_BASE_3 0x16c6 --#define P_SEC_BUFF_BASE_3 CBUS_REG_ADDR(SEC_BUFF_BASE_3) --#define DEMUX_MEM_REQ_EN 0x1627 --#define P_DEMUX_MEM_REQ_EN CBUS_REG_ADDR(DEMUX_MEM_REQ_EN) --#define DEMUX_MEM_REQ_EN_2 0x1677 --#define P_DEMUX_MEM_REQ_EN_2 CBUS_REG_ADDR(DEMUX_MEM_REQ_EN_2) --#define DEMUX_MEM_REQ_EN_3 0x16c7 --#define P_DEMUX_MEM_REQ_EN_3 CBUS_REG_ADDR(DEMUX_MEM_REQ_EN_3) --#define VIDEO_PDTS_WR_PTR 0x1628 --#define P_VIDEO_PDTS_WR_PTR CBUS_REG_ADDR(VIDEO_PDTS_WR_PTR) --#define VIDEO_PDTS_WR_PTR_2 0x1678 --#define P_VIDEO_PDTS_WR_PTR_2 CBUS_REG_ADDR(VIDEO_PDTS_WR_PTR_2) --#define VIDEO_PDTS_WR_PTR_3 0x16c8 --#define P_VIDEO_PDTS_WR_PTR_3 CBUS_REG_ADDR(VIDEO_PDTS_WR_PTR_3) --#define AUDIO_PDTS_WR_PTR 0x1629 --#define P_AUDIO_PDTS_WR_PTR CBUS_REG_ADDR(AUDIO_PDTS_WR_PTR) --#define AUDIO_PDTS_WR_PTR_2 0x1679 --#define P_AUDIO_PDTS_WR_PTR_2 CBUS_REG_ADDR(AUDIO_PDTS_WR_PTR_2) --#define AUDIO_PDTS_WR_PTR_3 0x16c9 --#define P_AUDIO_PDTS_WR_PTR_3 CBUS_REG_ADDR(AUDIO_PDTS_WR_PTR_3) --#define SUB_WR_PTR 0x162a --#define P_SUB_WR_PTR CBUS_REG_ADDR(SUB_WR_PTR) --#define SUB_WR_PTR_2 0x167a --#define P_SUB_WR_PTR_2 CBUS_REG_ADDR(SUB_WR_PTR_2) --#define SUB_WR_PTR_3 0x16ca --#define P_SUB_WR_PTR_3 CBUS_REG_ADDR(SUB_WR_PTR_3) --#define SB_START 0x162b --#define P_SB_START CBUS_REG_ADDR(SB_START) --#define SB_START_2 0x167b --#define P_SB_START_2 CBUS_REG_ADDR(SB_START_2) --#define SB_START_3 0x16cb --#define P_SB_START_3 CBUS_REG_ADDR(SB_START_3) --#define SB_LAST_ADDR 0x162c --#define P_SB_LAST_ADDR CBUS_REG_ADDR(SB_LAST_ADDR) --#define SB_LAST_ADDR_2 0x167c --#define P_SB_LAST_ADDR_2 CBUS_REG_ADDR(SB_LAST_ADDR_2) --#define SB_LAST_ADDR_3 0x16cc --#define P_SB_LAST_ADDR_3 CBUS_REG_ADDR(SB_LAST_ADDR_3) --#define SB_PES_WR_PTR 0x162d --#define P_SB_PES_WR_PTR CBUS_REG_ADDR(SB_PES_WR_PTR) --#define SB_PES_WR_PTR_2 0x167d --#define P_SB_PES_WR_PTR_2 CBUS_REG_ADDR(SB_PES_WR_PTR_2) --#define SB_PES_WR_PTR_3 0x16cd --#define P_SB_PES_WR_PTR_3 CBUS_REG_ADDR(SB_PES_WR_PTR_3) --#define OTHER_WR_PTR 0x162e --#define P_OTHER_WR_PTR CBUS_REG_ADDR(OTHER_WR_PTR) --#define OTHER_WR_PTR_2 0x167e --#define P_OTHER_WR_PTR_2 CBUS_REG_ADDR(OTHER_WR_PTR_2) --#define OTHER_WR_PTR_3 0x16ce --#define P_OTHER_WR_PTR_3 CBUS_REG_ADDR(OTHER_WR_PTR_3) --#define OB_START 0x162f --#define P_OB_START CBUS_REG_ADDR(OB_START) --#define OB_START_2 0x167f --#define P_OB_START_2 CBUS_REG_ADDR(OB_START_2) --#define OB_START_3 0x16cf --#define P_OB_START_3 CBUS_REG_ADDR(OB_START_3) --#define OB_LAST_ADDR 0x1630 --#define P_OB_LAST_ADDR CBUS_REG_ADDR(OB_LAST_ADDR) --#define OB_LAST_ADDR_2 0x1680 --#define P_OB_LAST_ADDR_2 CBUS_REG_ADDR(OB_LAST_ADDR_2) --#define OB_LAST_ADDR_3 0x16d0 --#define P_OB_LAST_ADDR_3 CBUS_REG_ADDR(OB_LAST_ADDR_3) --#define OB_PES_WR_PTR 0x1631 --#define P_OB_PES_WR_PTR CBUS_REG_ADDR(OB_PES_WR_PTR) --#define OB_PES_WR_PTR_2 0x1681 --#define P_OB_PES_WR_PTR_2 CBUS_REG_ADDR(OB_PES_WR_PTR_2) --#define OB_PES_WR_PTR_3 0x16d1 --#define P_OB_PES_WR_PTR_3 CBUS_REG_ADDR(OB_PES_WR_PTR_3) --#define STB_INT_MASK 0x1632 --#define P_STB_INT_MASK CBUS_REG_ADDR(STB_INT_MASK) --#define STB_INT_MASK_2 0x1682 --#define P_STB_INT_MASK_2 CBUS_REG_ADDR(STB_INT_MASK_2) --#define STB_INT_MASK_3 0x16d2 --#define P_STB_INT_MASK_3 CBUS_REG_ADDR(STB_INT_MASK_3) --#define VIDEO_SPLICING_CTL 0x1633 --#define P_VIDEO_SPLICING_CTL CBUS_REG_ADDR(VIDEO_SPLICING_CTL) --#define VIDEO_SPLICING_CTL_2 0x1683 --#define P_VIDEO_SPLICING_CTL_2 CBUS_REG_ADDR(VIDEO_SPLICING_CTL_2) --#define VIDEO_SPLICING_CTL_3 0x16d3 --#define P_VIDEO_SPLICING_CTL_3 CBUS_REG_ADDR(VIDEO_SPLICING_CTL_3) --#define AUDIO_SPLICING_CTL 0x1634 --#define P_AUDIO_SPLICING_CTL CBUS_REG_ADDR(AUDIO_SPLICING_CTL) --#define AUDIO_SPLICING_CTL_2 0x1684 --#define P_AUDIO_SPLICING_CTL_2 CBUS_REG_ADDR(AUDIO_SPLICING_CTL_2) --#define AUDIO_SPLICING_CTL_3 0x16d4 --#define P_AUDIO_SPLICING_CTL_3 CBUS_REG_ADDR(AUDIO_SPLICING_CTL_3) --#define TS_PACKAGE_BYTE_COUNT 0x1635 --#define P_TS_PACKAGE_BYTE_COUNT \ -- CBUS_REG_ADDR(TS_PACKAGE_BYTE_COUNT) --#define TS_PACKAGE_BYTE_COUNT_2 0x1685 --#define P_TS_PACKAGE_BYTE_COUNT_2 \ -- CBUS_REG_ADDR(TS_PACKAGE_BYTE_COUNT_2) --#define TS_PACKAGE_BYTE_COUNT_3 0x16d5 --#define P_TS_PACKAGE_BYTE_COUNT_3 \ -- CBUS_REG_ADDR(TS_PACKAGE_BYTE_COUNT_3) --#define PES_STRONG_SYNC 0x1636 --#define P_PES_STRONG_SYNC CBUS_REG_ADDR(PES_STRONG_SYNC) --#define PES_STRONG_SYNC_2 0x1686 --#define P_PES_STRONG_SYNC_2 CBUS_REG_ADDR(PES_STRONG_SYNC_2) --#define PES_STRONG_SYNC_3 0x16d6 --#define P_PES_STRONG_SYNC_3 CBUS_REG_ADDR(PES_STRONG_SYNC_3) --#define OM_DATA_RD_ADDR 0x1637 --#define P_OM_DATA_RD_ADDR CBUS_REG_ADDR(OM_DATA_RD_ADDR) --#define OM_DATA_RD_ADDR_2 0x1687 --#define P_OM_DATA_RD_ADDR_2 CBUS_REG_ADDR(OM_DATA_RD_ADDR_2) --#define OM_DATA_RD_ADDR_3 0x16d7 --#define P_OM_DATA_RD_ADDR_3 CBUS_REG_ADDR(OM_DATA_RD_ADDR_3) --#define OM_DATA_RD 0x1638 --#define P_OM_DATA_RD CBUS_REG_ADDR(OM_DATA_RD) --#define OM_DATA_RD_2 0x1688 --#define P_OM_DATA_RD_2 CBUS_REG_ADDR(OM_DATA_RD_2) --#define OM_DATA_RD_3 0x16d8 --#define P_OM_DATA_RD_3 CBUS_REG_ADDR(OM_DATA_RD_3) --#define SECTION_AUTO_STOP_3 0x1639 --#define P_SECTION_AUTO_STOP_3 CBUS_REG_ADDR(SECTION_AUTO_STOP_3) --#define SECTION_AUTO_STOP_3_2 0x1689 --#define P_SECTION_AUTO_STOP_3_2 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_3_2) --#define SECTION_AUTO_STOP_3_3 0x16d9 --#define P_SECTION_AUTO_STOP_3_3 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_3_3) --#define SECTION_AUTO_STOP_2 0x163a --#define P_SECTION_AUTO_STOP_2 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_2) --#define SECTION_AUTO_STOP_2_2 0x168a --#define P_SECTION_AUTO_STOP_2_2 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_2_2) --#define SECTION_AUTO_STOP_2_3 0x16da --#define P_SECTION_AUTO_STOP_2_3 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_2_3) --#define SECTION_AUTO_STOP_1 0x163b --#define P_SECTION_AUTO_STOP_1 CBUS_REG_ADDR(SECTION_AUTO_STOP_1) --#define SECTION_AUTO_STOP_1_2 0x168b --#define P_SECTION_AUTO_STOP_1_2 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_1_2) --#define SECTION_AUTO_STOP_1_3 0x16db --#define P_SECTION_AUTO_STOP_1_3 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_1_3) --#define SECTION_AUTO_STOP_0 0x163c --#define P_SECTION_AUTO_STOP_0 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_0) --#define SECTION_AUTO_STOP_0_2 0x168c --#define P_SECTION_AUTO_STOP_0_2 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_0_2) --#define SECTION_AUTO_STOP_0_3 0x16dc --#define P_SECTION_AUTO_STOP_0_3 \ -- CBUS_REG_ADDR(SECTION_AUTO_STOP_0_3) --#define DEMUX_CHANNEL_RESET 0x163d --#define P_DEMUX_CHANNEL_RESET \ -- CBUS_REG_ADDR(DEMUX_CHANNEL_RESET) --#define DEMUX_CHANNEL_RESET_2 0x168d --#define P_DEMUX_CHANNEL_RESET_2 \ -- CBUS_REG_ADDR(DEMUX_CHANNEL_RESET_2) --#define DEMUX_CHANNEL_RESET_3 0x16dd --#define P_DEMUX_CHANNEL_RESET_3 \ -- CBUS_REG_ADDR(DEMUX_CHANNEL_RESET_3) --#define DEMUX_SCRAMBLING_STATE 0x163e --#define DEMUX_SCRAMBLING_STATE_2 0x168e --#define P_DEMUX_SCRAMBLING_STATE_2 \ -- CBUS_REG_ADDR(DEMUX_SCRAMBLING_STATE_2) --#define DEMUX_SCRAMBLING_STATE_3 0x16de --#define P_DEMUX_SCRAMBLING_STATE_3 \ -- CBUS_REG_ADDR(DEMUX_SCRAMBLING_STATE_3) --#define DEMUX_CHANNEL_ACTIVITY 0x163f --#define P_DEMUX_CHANNEL_ACTIVITY \ -- CBUS_REG_ADDR(DEMUX_CHANNEL_ACTIVITY) --#define DEMUX_CHANNEL_ACTIVITY_2 0x168f --#define P_DEMUX_CHANNEL_ACTIVITY_2 \ -- CBUS_REG_ADDR(DEMUX_CHANNEL_ACTIVITY_2) --#define DEMUX_CHANNEL_ACTIVITY_3 0x16df --#define P_DEMUX_CHANNEL_ACTIVITY_3 \ -- CBUS_REG_ADDR(DEMUX_CHANNEL_ACTIVITY_3) --#define DEMUX_STAMP_CTL 0x1640 --#define P_DEMUX_STAMP_CTL CBUS_REG_ADDR(DEMUX_STAMP_CTL) --#define DEMUX_STAMP_CTL_2 0x1690 --#define P_DEMUX_STAMP_CTL_2 \ -- CBUS_REG_ADDR(DEMUX_STAMP_CTL_2) --#define DEMUX_STAMP_CTL_3 0x16e0 --#define P_DEMUX_STAMP_CTL_3 \ -- CBUS_REG_ADDR(DEMUX_STAMP_CTL_3) --#define DEMUX_VIDEO_STAMP_SYNC_0 0x1641 --#define P_DEMUX_VIDEO_STAMP_SYNC_0 \ -- CBUS_REG_ADDR(DEMUX_VIDEO_STAMP_SYNC_0) --#define DEMUX_VIDEO_STAMP_SYNC_0_2 0x1691 --#define P_DEMUX_VIDEO_STAMP_SYNC_0_2 \ -- CBUS_REG_ADDR(DEMUX_VIDEO_STAMP_SYNC_0_2) --#define DEMUX_VIDEO_STAMP_SYNC_0_3 0x16e1 --#define P_DEMUX_VIDEO_STAMP_SYNC_0_3 \ -- CBUS_REG_ADDR(DEMUX_VIDEO_STAMP_SYNC_0_3) --#define DEMUX_VIDEO_STAMP_SYNC_1 0x1642 --#define P_DEMUX_VIDEO_STAMP_SYNC_1 \ -- CBUS_REG_ADDR(DEMUX_VIDEO_STAMP_SYNC_1) --#define DEMUX_VIDEO_STAMP_SYNC_1_2 0x1692 --#define P_DEMUX_VIDEO_STAMP_SYNC_1_2 \ -- CBUS_REG_ADDR(DEMUX_VIDEO_STAMP_SYNC_1_2) --#define DEMUX_VIDEO_STAMP_SYNC_1_3 0x16e2 --#define P_DEMUX_VIDEO_STAMP_SYNC_1_3 \ -- CBUS_REG_ADDR(DEMUX_VIDEO_STAMP_SYNC_1_3) --#define DEMUX_AUDIO_STAMP_SYNC_0 0x1643 --#define P_DEMUX_AUDIO_STAMP_SYNC_0 \ -- CBUS_REG_ADDR(DEMUX_AUDIO_STAMP_SYNC_0) --#define DEMUX_AUDIO_STAMP_SYNC_0_2 0x1693 --#define P_DEMUX_AUDIO_STAMP_SYNC_0_2 \ -- CBUS_REG_ADDR(DEMUX_AUDIO_STAMP_SYNC_0_2) --#define DEMUX_AUDIO_STAMP_SYNC_0_3 0x16e3 --#define P_DEMUX_AUDIO_STAMP_SYNC_0_3 \ -- CBUS_REG_ADDR(DEMUX_AUDIO_STAMP_SYNC_0_3) --#define DEMUX_AUDIO_STAMP_SYNC_1 0x1644 --#define P_DEMUX_AUDIO_STAMP_SYNC_1 \ -- CBUS_REG_ADDR(DEMUX_AUDIO_STAMP_SYNC_1) --#define DEMUX_AUDIO_STAMP_SYNC_1_2 0x1694 --#define P_DEMUX_AUDIO_STAMP_SYNC_1_2 \ -- CBUS_REG_ADDR(DEMUX_AUDIO_STAMP_SYNC_1_2) --#define DEMUX_AUDIO_STAMP_SYNC_1_3 0x16e4 --#define P_DEMUX_AUDIO_STAMP_SYNC_1_3 \ -- CBUS_REG_ADDR(DEMUX_AUDIO_STAMP_SYNC_1_3) --#define DEMUX_SECTION_RESET 0x1645 --#define P_DEMUX_SECTION_RESET CBUS_REG_ADDR(DEMUX_SECTION_RESET) --#define DEMUX_SECTION_RESET_2 0x1695 --#define P_DEMUX_SECTION_RESET_2 \ -- CBUS_REG_ADDR(DEMUX_SECTION_RESET_2) --#define DEMUX_SECTION_RESET_3 0x16e5 --#define P_DEMUX_SECTION_RESET_3 \ -- CBUS_REG_ADDR(DEMUX_SECTION_RESET_3) --#define EFUSE_CNTL0 0x0 --#define P_EFUSE_CNTL0 SECBUS_REG_ADDR(EFUSE_CNTL0) --#define EFUSE_CNTL1 0x1 --#define P_EFUSE_CNTL1 SECBUS_REG_ADDR(EFUSE_CNTL1) --#define EFUSE_CNTL2 0x2 --#define P_EFUSE_CNTL2 SECBUS_REG_ADDR(EFUSE_CNTL2) --#define EFUSE_CNTL3 0x3 --#define P_EFUSE_CNTL3 SECBUS_REG_ADDR(EFUSE_CNTL3) --#define EFUSE_CNTL4 0x4 --#define P_EFUSE_CNTL4 SECBUS_REG_ADDR(EFUSE_CNTL4) --#define AO_SECURE_REG0 0x00 --#define P_AO_SECURE_REG0 SECBUS2_REG_ADDR(AO_SECURE_REG0) --#define AO_SECURE_REG1 0x01 --#define P_AO_SECURE_REG1 SECBUS2_REG_ADDR(AO_SECURE_REG1) --#define AO_SECURE_REG2 0x02 --#define P_AO_SECURE_REG2 SECBUS2_REG_ADDR(AO_SECURE_REG2) --#define SEC_BLKMV_AES_REG0 0x00 --#define P_SEC_BLKMV_AES_REG0 SECBUS3_REG_ADDR(SEC_BLKMV_AES_REG0) --#define SEC_BLKMV_AES_W0 0x01 --#define P_SEC_BLKMV_AES_W0 SECBUS3_REG_ADDR(SEC_BLKMV_AES_W0) --#define SEC_BLKMV_AES_W1 0x02 --#define P_SEC_BLKMV_AES_W1 SECBUS3_REG_ADDR(SEC_BLKMV_AES_W1) --#define SEC_BLKMV_AES_W2 0x03 --#define P_SEC_BLKMV_AES_W2 SECBUS3_REG_ADDR(SEC_BLKMV_AES_W2) --#define SEC_BLKMV_AES_W3 0x04 --#define P_SEC_BLKMV_AES_W3 SECBUS3_REG_ADDR(SEC_BLKMV_AES_W3) --#define SEC_BLKMV_AES_R0 0x05 --#define P_SEC_BLKMV_AES_R0 SECBUS3_REG_ADDR(SEC_BLKMV_AES_R0) --#define SEC_BLKMV_AES_R1 0x06 --#define P_SEC_BLKMV_AES_R1 SECBUS3_REG_ADDR(SEC_BLKMV_AES_R1) --#define SEC_BLKMV_AES_R2 0x07 --#define P_SEC_BLKMV_AES_R2 SECBUS3_REG_ADDR(SEC_BLKMV_AES_R2) --#define SEC_BLKMV_AES_R3 0x08 --#define P_SEC_BLKMV_AES_R3 SECBUS3_REG_ADDR(SEC_BLKMV_AES_R3) --#define SEC_BLKMV_TDES_LAST_IV_LO 0x09 --#define P_SEC_BLKMV_TDES_LAST_IV_LO \ -- SECBUS3_REG_ADDR(SEC_BLKMV_TDES_LAST_IV_LO) --#define SEC_BLKMV_TDES_LAST_IV_HI 0x0a --#define P_SEC_BLKMV_TDES_LAST_IV_HI \ -- SECBUS3_REG_ADDR(SEC_BLKMV_TDES_LAST_IV_HI) --#define SEC_BLKMV_AES_IV_0 0x0b --#define P_SEC_BLKMV_AES_IV_0 SECBUS3_REG_ADDR(SEC_BLKMV_AES_IV_0) --#define SEC_BLKMV_AES_IV_1 0x0c --#define P_SEC_BLKMV_AES_IV_1 SECBUS3_REG_ADDR(SEC_BLKMV_AES_IV_1) --#define SEC_BLKMV_AES_IV_2 0x0d --#define P_SEC_BLKMV_AES_IV_2 SECBUS3_REG_ADDR(SEC_BLKMV_AES_IV_2) --#define SEC_BLKMV_AES_IV_3 0x0e --#define P_SEC_BLKMV_AES_IV_3 SECBUS3_REG_ADDR(SEC_BLKMV_AES_IV_3) --/*add from M8M2*/ --#define SEC_BLKMV_AES_KEY_0 0x10 --#define P_SEC_BLKMV_AES_KEY_0 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_0) --#define SEC_BLKMV_AES_KEY_1 0x11 --#define P_SEC_BLKMV_AES_KEY_1 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_1) --#define SEC_BLKMV_AES_KEY_2 0x12 --#define P_SEC_BLKMV_AES_KEY_2 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_2) --#define SEC_BLKMV_AES_KEY_3 0x13 --#define P_SEC_BLKMV_AES_KEY_3 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_3) --#define SEC_BLKMV_AES_KEY_4 0x14 --#define P_SEC_BLKMV_AES_KEY_4 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_4) --#define SEC_BLKMV_AES_KEY_5 0x15 --#define P_SEC_BLKMV_AES_KEY_5 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_5) --#define SEC_BLKMV_AES_KEY_6 0x16 --#define P_SEC_BLKMV_AES_KEY_6 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_6) --#define SEC_BLKMV_AES_KEY_7 0x17 --#define P_SEC_BLKMV_AES_KEY_7 SECBUS3_REG_ADDR(SEC_BLKMV_AES_KEY_7) --#define SEC_BLKMV_THREAD_TABLE_START0 0x18 --#define P_SEC_BLKMV_THREAD_TABLE_START0 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_START0) --#define SEC_BLKMV_THREAD_TABLE_CURR0 0x19 --#define P_SEC_BLKMV_THREAD_TABLE_CURR0 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_CURR0) --#define SEC_BLKMV_THREAD_TABLE_END0 0x1a --#define P_SEC_BLKMV_THREAD_TABLE_END0 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_END0) --#define SEC_BLKMV_THREAD_TABLE_START1 0x1b --#define P_SEC_BLKMV_THREAD_TABLE_START1 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_START1) --#define SEC_BLKMV_THREAD_TABLE_CURR1 0x1c --#define P_SEC_BLKMV_THREAD_TABLE_CURR1 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_CURR1) --#define SEC_BLKMV_THREAD_TABLE_END1 0x1d --#define P_SEC_BLKMV_THREAD_TABLE_END1 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_END1) --#define SEC_BLKMV_THREAD_TABLE_START2 0x1e --#define P_SEC_BLKMV_THREAD_TABLE_START2 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_START2) --#define SEC_BLKMV_THREAD_TABLE_CURR2 0x1f --#define P_SEC_BLKMV_THREAD_TABLE_CURR2 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_CURR2) --#define SEC_BLKMV_THREAD_TABLE_END2 0x20 --#define P_SEC_BLKMV_THREAD_TABLE_END2 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_END2) --#define SEC_BLKMV_THREAD_TABLE_START3 0x21 --#define P_SEC_BLKMV_THREAD_TABLE_START3 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_START3) --#define SEC_BLKMV_THREAD_TABLE_CURR3 0x22 --#define P_SEC_BLKMV_THREAD_TABLE_CURR3 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_CURR3) --#define SEC_BLKMV_THREAD_TABLE_END3 0x23 --#define P_SEC_BLKMV_THREAD_TABLE_END3 \ -- SECBUS3_REG_ADDR(SEC_BLKMV_THREAD_TABLE_END3) --#define SEC_BLKMV_GEN_REG0 0x24 --#define P_SEC_BLKMV_GEN_REG0 SECBUS3_REG_ADDR(SEC_BLKMV_GEN_REG0) --#endif -diff --git a/drivers/amlogic/dvb_tv/cxd2841er.c b/drivers/amlogic/dvb_tv/cxd2841er.c -new file mode 100644 -index 0000000..acbe977 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/cxd2841er.c -@@ -0,0 +1,3812 @@ -+/* -+ * cxd2841er.c -+ * -+ * Sony digital demodulator driver for -+ * CXD2841ER - DVB-S/S2/T/T2/C/C2 -+ * CXD2854ER - DVB-S/S2/T/T2/C/C2, ISDB-T/S -+ * -+ * Copyright 2012 Sony Corporation -+ * Copyright (C) 2014 NetUP Inc. -+ * Copyright (C) 2014 Sergey Kozlov -+ * Copyright (C) 2014 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "dvb_math.h" -+#include "dvb_frontend.h" -+#include "cxd2841er.h" -+#include "cxd2841er_priv.h" -+ -+#define MAX_WRITE_REGSIZE 16 -+#define LOG2_E_100X 144 -+ -+/* DVB-C constellation */ -+enum sony_dvbc_constellation_t { -+ SONY_DVBC_CONSTELLATION_16QAM, -+ SONY_DVBC_CONSTELLATION_32QAM, -+ SONY_DVBC_CONSTELLATION_64QAM, -+ SONY_DVBC_CONSTELLATION_128QAM, -+ SONY_DVBC_CONSTELLATION_256QAM -+}; -+ -+enum cxd2841er_state { -+ STATE_SHUTDOWN = 0, -+ STATE_SLEEP_S, -+ STATE_ACTIVE_S, -+ STATE_SLEEP_TC, -+ STATE_ACTIVE_TC -+}; -+ -+struct cxd2841er_priv { -+ struct dvb_frontend frontend; -+ struct i2c_adapter *i2c; -+ u8 i2c_addr_slvx; -+ u8 i2c_addr_slvt; -+ const struct cxd2841er_config *config; -+ enum cxd2841er_state state; -+ u8 system; -+ enum cxd2841er_xtal xtal; -+ enum fe_caps caps; -+}; -+ -+static const struct cxd2841er_cnr_data s_cn_data[] = { -+ { 0x033e, 0 }, { 0x0339, 100 }, { 0x0333, 200 }, -+ { 0x032e, 300 }, { 0x0329, 400 }, { 0x0324, 500 }, -+ { 0x031e, 600 }, { 0x0319, 700 }, { 0x0314, 800 }, -+ { 0x030f, 900 }, { 0x030a, 1000 }, { 0x02ff, 1100 }, -+ { 0x02f4, 1200 }, { 0x02e9, 1300 }, { 0x02de, 1400 }, -+ { 0x02d4, 1500 }, { 0x02c9, 1600 }, { 0x02bf, 1700 }, -+ { 0x02b5, 1800 }, { 0x02ab, 1900 }, { 0x02a1, 2000 }, -+ { 0x029b, 2100 }, { 0x0295, 2200 }, { 0x0290, 2300 }, -+ { 0x028a, 2400 }, { 0x0284, 2500 }, { 0x027f, 2600 }, -+ { 0x0279, 2700 }, { 0x0274, 2800 }, { 0x026e, 2900 }, -+ { 0x0269, 3000 }, { 0x0262, 3100 }, { 0x025c, 3200 }, -+ { 0x0255, 3300 }, { 0x024f, 3400 }, { 0x0249, 3500 }, -+ { 0x0242, 3600 }, { 0x023c, 3700 }, { 0x0236, 3800 }, -+ { 0x0230, 3900 }, { 0x022a, 4000 }, { 0x0223, 4100 }, -+ { 0x021c, 4200 }, { 0x0215, 4300 }, { 0x020e, 4400 }, -+ { 0x0207, 4500 }, { 0x0201, 4600 }, { 0x01fa, 4700 }, -+ { 0x01f4, 4800 }, { 0x01ed, 4900 }, { 0x01e7, 5000 }, -+ { 0x01e0, 5100 }, { 0x01d9, 5200 }, { 0x01d2, 5300 }, -+ { 0x01cb, 5400 }, { 0x01c4, 5500 }, { 0x01be, 5600 }, -+ { 0x01b7, 5700 }, { 0x01b1, 5800 }, { 0x01aa, 5900 }, -+ { 0x01a4, 6000 }, { 0x019d, 6100 }, { 0x0196, 6200 }, -+ { 0x018f, 6300 }, { 0x0189, 6400 }, { 0x0182, 6500 }, -+ { 0x017c, 6600 }, { 0x0175, 6700 }, { 0x016f, 6800 }, -+ { 0x0169, 6900 }, { 0x0163, 7000 }, { 0x015c, 7100 }, -+ { 0x0156, 7200 }, { 0x0150, 7300 }, { 0x014a, 7400 }, -+ { 0x0144, 7500 }, { 0x013e, 7600 }, { 0x0138, 7700 }, -+ { 0x0132, 7800 }, { 0x012d, 7900 }, { 0x0127, 8000 }, -+ { 0x0121, 8100 }, { 0x011c, 8200 }, { 0x0116, 8300 }, -+ { 0x0111, 8400 }, { 0x010b, 8500 }, { 0x0106, 8600 }, -+ { 0x0101, 8700 }, { 0x00fc, 8800 }, { 0x00f7, 8900 }, -+ { 0x00f2, 9000 }, { 0x00ee, 9100 }, { 0x00ea, 9200 }, -+ { 0x00e6, 9300 }, { 0x00e2, 9400 }, { 0x00de, 9500 }, -+ { 0x00da, 9600 }, { 0x00d7, 9700 }, { 0x00d3, 9800 }, -+ { 0x00d0, 9900 }, { 0x00cc, 10000 }, { 0x00c7, 10100 }, -+ { 0x00c3, 10200 }, { 0x00bf, 10300 }, { 0x00ba, 10400 }, -+ { 0x00b6, 10500 }, { 0x00b2, 10600 }, { 0x00ae, 10700 }, -+ { 0x00aa, 10800 }, { 0x00a7, 10900 }, { 0x00a3, 11000 }, -+ { 0x009f, 11100 }, { 0x009c, 11200 }, { 0x0098, 11300 }, -+ { 0x0094, 11400 }, { 0x0091, 11500 }, { 0x008e, 11600 }, -+ { 0x008a, 11700 }, { 0x0087, 11800 }, { 0x0084, 11900 }, -+ { 0x0081, 12000 }, { 0x007e, 12100 }, { 0x007b, 12200 }, -+ { 0x0079, 12300 }, { 0x0076, 12400 }, { 0x0073, 12500 }, -+ { 0x0071, 12600 }, { 0x006e, 12700 }, { 0x006c, 12800 }, -+ { 0x0069, 12900 }, { 0x0067, 13000 }, { 0x0065, 13100 }, -+ { 0x0062, 13200 }, { 0x0060, 13300 }, { 0x005e, 13400 }, -+ { 0x005c, 13500 }, { 0x005a, 13600 }, { 0x0058, 13700 }, -+ { 0x0056, 13800 }, { 0x0054, 13900 }, { 0x0052, 14000 }, -+ { 0x0050, 14100 }, { 0x004e, 14200 }, { 0x004c, 14300 }, -+ { 0x004b, 14400 }, { 0x0049, 14500 }, { 0x0047, 14600 }, -+ { 0x0046, 14700 }, { 0x0044, 14800 }, { 0x0043, 14900 }, -+ { 0x0041, 15000 }, { 0x003f, 15100 }, { 0x003e, 15200 }, -+ { 0x003c, 15300 }, { 0x003b, 15400 }, { 0x003a, 15500 }, -+ { 0x0037, 15700 }, { 0x0036, 15800 }, { 0x0034, 15900 }, -+ { 0x0033, 16000 }, { 0x0032, 16100 }, { 0x0031, 16200 }, -+ { 0x0030, 16300 }, { 0x002f, 16400 }, { 0x002e, 16500 }, -+ { 0x002d, 16600 }, { 0x002c, 16700 }, { 0x002b, 16800 }, -+ { 0x002a, 16900 }, { 0x0029, 17000 }, { 0x0028, 17100 }, -+ { 0x0027, 17200 }, { 0x0026, 17300 }, { 0x0025, 17400 }, -+ { 0x0024, 17500 }, { 0x0023, 17600 }, { 0x0022, 17800 }, -+ { 0x0021, 17900 }, { 0x0020, 18000 }, { 0x001f, 18200 }, -+ { 0x001e, 18300 }, { 0x001d, 18500 }, { 0x001c, 18700 }, -+ { 0x001b, 18900 }, { 0x001a, 19000 }, { 0x0019, 19200 }, -+ { 0x0018, 19300 }, { 0x0017, 19500 }, { 0x0016, 19700 }, -+ { 0x0015, 19900 }, { 0x0014, 20000 }, -+}; -+ -+static const struct cxd2841er_cnr_data s2_cn_data[] = { -+ { 0x05af, 0 }, { 0x0597, 100 }, { 0x057e, 200 }, -+ { 0x0567, 300 }, { 0x0550, 400 }, { 0x0539, 500 }, -+ { 0x0522, 600 }, { 0x050c, 700 }, { 0x04f6, 800 }, -+ { 0x04e1, 900 }, { 0x04cc, 1000 }, { 0x04b6, 1100 }, -+ { 0x04a1, 1200 }, { 0x048c, 1300 }, { 0x0477, 1400 }, -+ { 0x0463, 1500 }, { 0x044f, 1600 }, { 0x043c, 1700 }, -+ { 0x0428, 1800 }, { 0x0416, 1900 }, { 0x0403, 2000 }, -+ { 0x03ef, 2100 }, { 0x03dc, 2200 }, { 0x03c9, 2300 }, -+ { 0x03b6, 2400 }, { 0x03a4, 2500 }, { 0x0392, 2600 }, -+ { 0x0381, 2700 }, { 0x036f, 2800 }, { 0x035f, 2900 }, -+ { 0x034e, 3000 }, { 0x033d, 3100 }, { 0x032d, 3200 }, -+ { 0x031d, 3300 }, { 0x030d, 3400 }, { 0x02fd, 3500 }, -+ { 0x02ee, 3600 }, { 0x02df, 3700 }, { 0x02d0, 3800 }, -+ { 0x02c2, 3900 }, { 0x02b4, 4000 }, { 0x02a6, 4100 }, -+ { 0x0299, 4200 }, { 0x028c, 4300 }, { 0x027f, 4400 }, -+ { 0x0272, 4500 }, { 0x0265, 4600 }, { 0x0259, 4700 }, -+ { 0x024d, 4800 }, { 0x0241, 4900 }, { 0x0236, 5000 }, -+ { 0x022b, 5100 }, { 0x0220, 5200 }, { 0x0215, 5300 }, -+ { 0x020a, 5400 }, { 0x0200, 5500 }, { 0x01f6, 5600 }, -+ { 0x01ec, 5700 }, { 0x01e2, 5800 }, { 0x01d8, 5900 }, -+ { 0x01cf, 6000 }, { 0x01c6, 6100 }, { 0x01bc, 6200 }, -+ { 0x01b3, 6300 }, { 0x01aa, 6400 }, { 0x01a2, 6500 }, -+ { 0x0199, 6600 }, { 0x0191, 6700 }, { 0x0189, 6800 }, -+ { 0x0181, 6900 }, { 0x0179, 7000 }, { 0x0171, 7100 }, -+ { 0x0169, 7200 }, { 0x0161, 7300 }, { 0x015a, 7400 }, -+ { 0x0153, 7500 }, { 0x014b, 7600 }, { 0x0144, 7700 }, -+ { 0x013d, 7800 }, { 0x0137, 7900 }, { 0x0130, 8000 }, -+ { 0x012a, 8100 }, { 0x0124, 8200 }, { 0x011e, 8300 }, -+ { 0x0118, 8400 }, { 0x0112, 8500 }, { 0x010c, 8600 }, -+ { 0x0107, 8700 }, { 0x0101, 8800 }, { 0x00fc, 8900 }, -+ { 0x00f7, 9000 }, { 0x00f2, 9100 }, { 0x00ec, 9200 }, -+ { 0x00e7, 9300 }, { 0x00e2, 9400 }, { 0x00dd, 9500 }, -+ { 0x00d8, 9600 }, { 0x00d4, 9700 }, { 0x00cf, 9800 }, -+ { 0x00ca, 9900 }, { 0x00c6, 10000 }, { 0x00c2, 10100 }, -+ { 0x00be, 10200 }, { 0x00b9, 10300 }, { 0x00b5, 10400 }, -+ { 0x00b1, 10500 }, { 0x00ae, 10600 }, { 0x00aa, 10700 }, -+ { 0x00a6, 10800 }, { 0x00a3, 10900 }, { 0x009f, 11000 }, -+ { 0x009b, 11100 }, { 0x0098, 11200 }, { 0x0095, 11300 }, -+ { 0x0091, 11400 }, { 0x008e, 11500 }, { 0x008b, 11600 }, -+ { 0x0088, 11700 }, { 0x0085, 11800 }, { 0x0082, 11900 }, -+ { 0x007f, 12000 }, { 0x007c, 12100 }, { 0x007a, 12200 }, -+ { 0x0077, 12300 }, { 0x0074, 12400 }, { 0x0072, 12500 }, -+ { 0x006f, 12600 }, { 0x006d, 12700 }, { 0x006b, 12800 }, -+ { 0x0068, 12900 }, { 0x0066, 13000 }, { 0x0064, 13100 }, -+ { 0x0061, 13200 }, { 0x005f, 13300 }, { 0x005d, 13400 }, -+ { 0x005b, 13500 }, { 0x0059, 13600 }, { 0x0057, 13700 }, -+ { 0x0055, 13800 }, { 0x0053, 13900 }, { 0x0051, 14000 }, -+ { 0x004f, 14100 }, { 0x004e, 14200 }, { 0x004c, 14300 }, -+ { 0x004a, 14400 }, { 0x0049, 14500 }, { 0x0047, 14600 }, -+ { 0x0045, 14700 }, { 0x0044, 14800 }, { 0x0042, 14900 }, -+ { 0x0041, 15000 }, { 0x003f, 15100 }, { 0x003e, 15200 }, -+ { 0x003c, 15300 }, { 0x003b, 15400 }, { 0x003a, 15500 }, -+ { 0x0038, 15600 }, { 0x0037, 15700 }, { 0x0036, 15800 }, -+ { 0x0034, 15900 }, { 0x0033, 16000 }, { 0x0032, 16100 }, -+ { 0x0031, 16200 }, { 0x0030, 16300 }, { 0x002f, 16400 }, -+ { 0x002e, 16500 }, { 0x002d, 16600 }, { 0x002c, 16700 }, -+ { 0x002b, 16800 }, { 0x002a, 16900 }, { 0x0029, 17000 }, -+ { 0x0028, 17100 }, { 0x0027, 17200 }, { 0x0026, 17300 }, -+ { 0x0025, 17400 }, { 0x0024, 17500 }, { 0x0023, 17600 }, -+ { 0x0022, 17800 }, { 0x0021, 17900 }, { 0x0020, 18000 }, -+ { 0x001f, 18200 }, { 0x001e, 18300 }, { 0x001d, 18500 }, -+ { 0x001c, 18700 }, { 0x001b, 18900 }, { 0x001a, 19000 }, -+ { 0x0019, 19200 }, { 0x0018, 19300 }, { 0x0017, 19500 }, -+ { 0x0016, 19700 }, { 0x0015, 19900 }, { 0x0014, 20000 }, -+}; -+ -+#define MAKE_IFFREQ_CONFIG(iffreq) ((u32)(((iffreq)/41.0)*16777216.0 + 0.5)) -+#define MAKE_IFFREQ_CONFIG_XTAL(xtal, iffreq) ((xtal == SONY_XTAL_24000) ? \ -+ (u32)(((iffreq)/48.0)*16777216.0 + 0.5) : \ -+ (u32)(((iffreq)/41.0)*16777216.0 + 0.5)) -+ -+static void cxd2841er_i2c_debug(struct cxd2841er_priv *priv, -+ u8 addr, u8 reg, u8 write, -+ const u8 *data, u32 len) -+{ -+ dev_dbg(&priv->i2c->dev, -+ "cxd2841er: I2C %s addr %02x reg 0x%02x size %d\n", -+ (write == 0 ? "read" : "write"), addr, reg, len); -+ print_hex_dump_bytes("cxd2841er: I2C data: ", -+ DUMP_PREFIX_OFFSET, data, len); -+} -+ -+static int cxd2841er_write_regs(struct cxd2841er_priv *priv, -+ u8 addr, u8 reg, const u8 *data, u32 len) -+{ -+ int ret; -+ u8 buf[MAX_WRITE_REGSIZE + 1]; -+ u8 i2c_addr = (addr == I2C_SLVX ? -+ priv->i2c_addr_slvx : priv->i2c_addr_slvt); -+ struct i2c_msg msg[1] = { -+ { -+ .addr = i2c_addr, -+ .flags = 0, -+ .len = len + 1, -+ .buf = buf, -+ } -+ }; -+ -+ if (len + 1 >= sizeof(buf)) { -+ dev_warn(&priv->i2c->dev, "wr reg=%04x: len=%d is too big!\n", -+ reg, len + 1); -+ return -E2BIG; -+ } -+ -+ cxd2841er_i2c_debug(priv, i2c_addr, reg, 1, data, len); -+ buf[0] = reg; -+ memcpy(&buf[1], data, len); -+ -+ ret = i2c_transfer(priv->i2c, msg, 1); -+ if (ret >= 0 && ret != 1) -+ ret = -EIO; -+ if (ret < 0) { -+ dev_warn(&priv->i2c->dev, -+ "%s: i2c wr failed=%d addr=%02x reg=%02x len=%d\n", -+ KBUILD_MODNAME, ret, i2c_addr, reg, len); -+ return ret; -+ } -+ return 0; -+} -+ -+static int cxd2841er_write_reg(struct cxd2841er_priv *priv, -+ u8 addr, u8 reg, u8 val) -+{ -+ return cxd2841er_write_regs(priv, addr, reg, &val, 1); -+} -+ -+static int cxd2841er_read_regs(struct cxd2841er_priv *priv, -+ u8 addr, u8 reg, u8 *val, u32 len) -+{ -+ int ret; -+ u8 i2c_addr = (addr == I2C_SLVX ? -+ priv->i2c_addr_slvx : priv->i2c_addr_slvt); -+ struct i2c_msg msg[2] = { -+ { -+ .addr = i2c_addr, -+ .flags = 0, -+ .len = 1, -+ .buf = ®, -+ }, { -+ .addr = i2c_addr, -+ .flags = I2C_M_RD, -+ .len = len, -+ .buf = val, -+ } -+ }; -+ -+ ret = i2c_transfer(priv->i2c, &msg[0], 1); -+ if (ret >= 0 && ret != 1) -+ ret = -EIO; -+ if (ret < 0) { -+ dev_warn(&priv->i2c->dev, -+ "%s: i2c rw failed=%d addr=%02x reg=%02x\n", -+ KBUILD_MODNAME, ret, i2c_addr, reg); -+ return ret; -+ } -+ ret = i2c_transfer(priv->i2c, &msg[1], 1); -+ if (ret >= 0 && ret != 1) -+ ret = -EIO; -+ if (ret < 0) { -+ dev_warn(&priv->i2c->dev, -+ "%s: i2c rd failed=%d addr=%02x reg=%02x\n", -+ KBUILD_MODNAME, ret, i2c_addr, reg); -+ return ret; -+ } -+ cxd2841er_i2c_debug(priv, i2c_addr, reg, 0, val, len); -+ return 0; -+} -+ -+static int cxd2841er_read_reg(struct cxd2841er_priv *priv, -+ u8 addr, u8 reg, u8 *val) -+{ -+ return cxd2841er_read_regs(priv, addr, reg, val, 1); -+} -+ -+static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv, -+ u8 addr, u8 reg, u8 data, u8 mask) -+{ -+ int res; -+ u8 rdata; -+ -+ if (mask != 0xff) { -+ res = cxd2841er_read_reg(priv, addr, reg, &rdata); -+ if (res) -+ return res; -+ data = ((data & mask) | (rdata & (mask ^ 0xFF))); -+ } -+ return cxd2841er_write_reg(priv, addr, reg, data); -+} -+ -+static int cxd2841er_dvbs2_set_symbol_rate(struct cxd2841er_priv *priv, -+ u32 symbol_rate) -+{ -+ u32 reg_value = 0; -+ u8 data[3] = {0, 0, 0}; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ /* -+ * regValue = (symbolRateKSps * 2^14 / 1000) + 0.5 -+ * = ((symbolRateKSps * 2^14) + 500) / 1000 -+ * = ((symbolRateKSps * 16384) + 500) / 1000 -+ */ -+ reg_value = DIV_ROUND_CLOSEST(symbol_rate * 16384, 1000); -+ if ((reg_value == 0) || (reg_value > 0xFFFFF)) { -+ dev_err(&priv->i2c->dev, -+ "%s(): reg_value is out of range\n", __func__); -+ return -EINVAL; -+ } -+ data[0] = (u8)((reg_value >> 16) & 0x0F); -+ data[1] = (u8)((reg_value >> 8) & 0xFF); -+ data[2] = (u8)(reg_value & 0xFF); -+ /* Set SLV-T Bank : 0xAE */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x20, data, 3); -+ return 0; -+} -+ -+static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv, -+ u8 system); -+ -+static int cxd2841er_sleep_s_to_active_s(struct cxd2841er_priv *priv, -+ u8 system, u32 symbol_rate) -+{ -+ int ret; -+ u8 data[4] = { 0, 0, 0, 0 }; -+ -+ if (priv->state != STATE_SLEEP_S) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, (int)priv->state); -+ return -EINVAL; -+ } -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_set_ts_clock_mode(priv, SYS_DVBS); -+ /* Set demod mode */ -+ if (system == SYS_DVBS) { -+ data[0] = 0x0A; -+ } else if (system == SYS_DVBS2) { -+ data[0] = 0x0B; -+ } else { -+ dev_err(&priv->i2c->dev, "%s(): invalid delsys %d\n", -+ __func__, system); -+ return -EINVAL; -+ } -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, data[0]); -+ /* DVB-S/S2 */ -+ data[0] = 0x00; -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Enable S/S2 auto detection 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, data[0]); -+ /* Set SLV-T Bank : 0xAE */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); -+ /* Enable S/S2 auto detection 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, data[0]); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Enable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); -+ /* Enable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x01); -+ /* Enable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); -+ /* Enable ADC 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x3f); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Enable ADC 3 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); -+ /* Set SLV-T Bank : 0xA3 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa3); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xac, 0x00); -+ data[0] = 0x07; -+ data[1] = 0x3B; -+ data[2] = 0x08; -+ data[3] = 0xC5; -+ /* Set SLV-T Bank : 0xAB */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xab); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x98, data, 4); -+ data[0] = 0x05; -+ data[1] = 0x80; -+ data[2] = 0x0A; -+ data[3] = 0x80; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xa8, data, 4); -+ data[0] = 0x0C; -+ data[1] = 0xCC; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xc3, data, 2); -+ /* Set demod parameter */ -+ ret = cxd2841er_dvbs2_set_symbol_rate(priv, symbol_rate); -+ if (ret != 0) -+ return ret; -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable Hi-Z setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x10); -+ /* disable Hi-Z setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); -+ priv->state = STATE_ACTIVE_S; -+ return 0; -+} -+ -+static int cxd2841er_init_tc(struct dvb_frontend *fe); -+ -+static int cxd2841er_sleep_tc_to_active_t_band(struct cxd2841er_priv *priv, -+ u32 bandwidth); -+ -+static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, -+ u32 bandwidth); -+ -+static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, -+ u32 bandwidth); -+ -+static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv, -+ u32 bandwidth); -+ -+static int cxd2841er_active_i_to_sleep_tc(struct cxd2841er_priv *priv); -+ -+static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv); -+ -+static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv); -+ -+static int cxd2841er_retune_active(struct cxd2841er_priv *priv, -+ struct dtv_frontend_properties *p) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_S && -+ priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); -+ if (priv->state == STATE_ACTIVE_S) -+ return cxd2841er_dvbs2_set_symbol_rate( -+ priv, p->symbol_rate / 1000); -+ else if (priv->state == STATE_ACTIVE_TC) { -+ switch (priv->system) { -+ case SYS_DVBT: -+ return cxd2841er_sleep_tc_to_active_t_band( -+ priv, p->bandwidth_hz); -+ case SYS_DVBT2: -+ return cxd2841er_sleep_tc_to_active_t2_band( -+ priv, p->bandwidth_hz); -+ case SYS_DVBC_ANNEX_A: -+ return cxd2841er_sleep_tc_to_active_c_band( -+ priv, p->bandwidth_hz); -+ case SYS_ISDBT: -+ cxd2841er_active_i_to_sleep_tc(priv); -+ cxd2841er_sleep_tc_to_shutdown(priv); -+ cxd2841er_shutdown_to_sleep_tc(priv); -+ return cxd2841er_sleep_tc_to_active_i( -+ priv, p->bandwidth_hz); -+ } -+ } -+ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", -+ __func__, priv->system); -+ return -EINVAL; -+} -+ -+static int cxd2841er_active_s_to_sleep_s(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_S) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); -+ /* enable Hi-Z setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1f); -+ /* enable Hi-Z setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* disable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x00); -+ /* disable ADC 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); -+ /* disable ADC 3 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); -+ /* SADC Bias ON */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); -+ /* disable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); -+ /* Set SLV-T Bank : 0xAE */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); -+ /* disable S/S2 auto detection1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable S/S2 auto detection2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, 0x00); -+ priv->state = STATE_SLEEP_S; -+ return 0; -+} -+ -+static int cxd2841er_sleep_s_to_shutdown(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_SLEEP_S) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable DSQOUT */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); -+ /* Disable DSQIN */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x9c, 0x00); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Disable oscillator */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); -+ priv->state = STATE_SHUTDOWN; -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_SLEEP_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Disable oscillator */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); -+ priv->state = STATE_SHUTDOWN; -+ return 0; -+} -+ -+static int cxd2841er_active_t_to_sleep_tc(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); -+ /* enable Hi-Z setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); -+ /* enable Hi-Z setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* disable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable ADC 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); -+ /* Disable ADC 3 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); -+ /* Disable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Disable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); -+ priv->state = STATE_SLEEP_TC; -+ return 0; -+} -+ -+static int cxd2841er_active_t2_to_sleep_tc(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); -+ /* enable Hi-Z setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); -+ /* enable Hi-Z setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); -+ /* Cancel DVB-T2 setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x40); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x21); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xfb); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x00, 0x0f); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x00, 0x3f); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* disable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable ADC 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); -+ /* Disable ADC 3 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); -+ /* Disable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Disable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); -+ priv->state = STATE_SLEEP_TC; -+ return 0; -+} -+ -+static int cxd2841er_active_c_to_sleep_tc(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); -+ /* enable Hi-Z setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); -+ /* enable Hi-Z setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); -+ /* Cancel DVB-C setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa3, 0x00, 0x1f); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* disable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable ADC 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); -+ /* Disable ADC 3 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); -+ /* Disable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Disable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); -+ priv->state = STATE_SLEEP_TC; -+ return 0; -+} -+ -+static int cxd2841er_active_i_to_sleep_tc(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* disable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); -+ /* enable Hi-Z setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); -+ /* enable Hi-Z setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); -+ -+ /* TODO: Cancel demod parameter */ -+ -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* disable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable ADC 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); -+ /* Disable ADC 3 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); -+ /* Disable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Disable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); -+ priv->state = STATE_SLEEP_TC; -+ return 0; -+} -+ -+static int cxd2841er_shutdown_to_sleep_s(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_SHUTDOWN) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Clear all demodulator registers */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); -+ usleep_range(3000, 5000); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Set demod SW reset */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); -+ -+ switch (priv->xtal) { -+ case SONY_XTAL_20500: -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x00); -+ break; -+ case SONY_XTAL_24000: -+ /* Select demod frequency */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x03); -+ break; -+ case SONY_XTAL_41000: -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x01); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid demod xtal %d\n", -+ __func__, priv->xtal); -+ return -EINVAL; -+ } -+ -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x0a); -+ /* Clear demod SW reset */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); -+ usleep_range(1000, 2000); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* enable DSQOUT */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1F); -+ /* enable DSQIN */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x9C, 0x40); -+ /* TADC Bias On */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); -+ /* SADC Bias On */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); -+ priv->state = STATE_SLEEP_S; -+ return 0; -+} -+ -+static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv) -+{ -+ u8 data = 0; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_SHUTDOWN) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Clear all demodulator registers */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); -+ usleep_range(3000, 5000); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Set demod SW reset */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); -+ /* Select ADC clock mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x13, 0x00); -+ -+ switch (priv->xtal) { -+ case SONY_XTAL_20500: -+ data = 0x0; -+ break; -+ case SONY_XTAL_24000: -+ /* Select demod frequency */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); -+ data = 0x3; -+ break; -+ case SONY_XTAL_41000: -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); -+ data = 0x1; -+ break; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x14, data); -+ /* Clear demod SW reset */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); -+ usleep_range(1000, 2000); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* TADC Bias On */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); -+ /* SADC Bias On */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); -+ priv->state = STATE_SLEEP_TC; -+ return 0; -+} -+ -+static int cxd2841er_tune_done(struct cxd2841er_priv *priv) -+{ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0, 0); -+ /* SW Reset */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xfe, 0x01); -+ /* Enable TS output */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x00); -+ return 0; -+} -+ -+/* Set TS parallel mode */ -+static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv, -+ u8 system) -+{ -+ u8 serial_ts, ts_rate_ctrl_off, ts_in_off; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0xc4, &serial_ts); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0xd3, &ts_rate_ctrl_off); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0xde, &ts_in_off); -+ dev_dbg(&priv->i2c->dev, "%s(): ser_ts=0x%02x rate_ctrl_off=0x%02x in_off=0x%02x\n", -+ __func__, serial_ts, ts_rate_ctrl_off, ts_in_off); -+ -+ /* -+ * slave Bank Addr Bit default Name -+ * 00h D9h [7:0] 8'h08 OTSCKPERIOD -+ */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xd9, 0x08); -+ /* -+ * Disable TS IF Clock -+ * slave Bank Addr Bit default Name -+ * 00h 32h [0] 1'b1 OREG_CK_TSIF_EN -+ */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x00, 0x01); -+ /* -+ * slave Bank Addr Bit default Name -+ * 00h 33h [1:0] 2'b01 OREG_CKSEL_TSIF -+ */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x33, 0x00, 0x03); -+ /* -+ * Enable TS IF Clock -+ * slave Bank Addr Bit default Name -+ * 00h 32h [0] 1'b1 OREG_CK_TSIF_EN -+ */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x01, 0x01); -+ -+ if (system == SYS_DVBT) { -+ /* Enable parity period for DVB-T */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); -+ } else if (system == SYS_DVBC_ANNEX_A) { -+ /* Enable parity period for DVB-C */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); -+ } -+} -+ -+static u8 cxd2841er_chip_id(struct cxd2841er_priv *priv) -+{ -+ u8 chip_id = 0; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (cxd2841er_write_reg(priv, I2C_SLVT, 0, 0) == 0) -+ cxd2841er_read_reg(priv, I2C_SLVT, 0xfd, &chip_id); -+ else if (cxd2841er_write_reg(priv, I2C_SLVX, 0, 0) == 0) -+ cxd2841er_read_reg(priv, I2C_SLVX, 0xfd, &chip_id); -+ -+ return chip_id; -+} -+ -+static int cxd2841er_read_status_s(struct dvb_frontend *fe, -+ enum fe_status *status) -+{ -+ u8 reg = 0; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ *status = 0; -+ if (priv->state != STATE_ACTIVE_S) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0xA0 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); -+ /* -+ * slave Bank Addr Bit Signal name -+ * A0h 11h [2] ITSLOCK -+ */ -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x11, ®); -+ if (reg & 0x04) { -+ *status = FE_HAS_SIGNAL -+ | FE_HAS_CARRIER -+ | FE_HAS_VITERBI -+ | FE_HAS_SYNC -+ | FE_HAS_LOCK; -+ } -+ dev_dbg(&priv->i2c->dev, "%s(): result 0x%x\n", __func__, *status); -+ return 0; -+} -+ -+static int cxd2841er_read_status_t_t2(struct cxd2841er_priv *priv, -+ u8 *sync, u8 *tslock, u8 *unlock) -+{ -+ u8 data = 0; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) -+ return -EINVAL; -+ if (priv->system == SYS_DVBT) { -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ } else { -+ /* Set SLV-T Bank : 0x20 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ } -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); -+ if ((data & 0x07) == 0x07) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid hardware state detected\n", __func__); -+ *sync = 0; -+ *tslock = 0; -+ *unlock = 0; -+ } else { -+ *sync = ((data & 0x07) == 0x6 ? 1 : 0); -+ *tslock = ((data & 0x20) ? 1 : 0); -+ *unlock = ((data & 0x10) ? 1 : 0); -+ } -+ return 0; -+} -+ -+static int cxd2841er_read_status_c(struct cxd2841er_priv *priv, u8 *tslock) -+{ -+ u8 data; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) -+ return -EINVAL; -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x88, &data); -+ if ((data & 0x01) == 0) { -+ *tslock = 0; -+ } else { -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); -+ *tslock = ((data & 0x20) ? 1 : 0); -+ } -+ return 0; -+} -+ -+static int cxd2841er_read_status_i(struct cxd2841er_priv *priv, -+ u8 *sync, u8 *tslock, u8 *unlock) -+{ -+ u8 data = 0; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) -+ return -EINVAL; -+ /* Set SLV-T Bank : 0x60 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); -+ dev_dbg(&priv->i2c->dev, -+ "%s(): lock=0x%x\n", __func__, data); -+ *sync = ((data & 0x02) ? 1 : 0); -+ *tslock = ((data & 0x01) ? 1 : 0); -+ *unlock = ((data & 0x10) ? 1 : 0); -+ return 0; -+} -+ -+static int cxd2841er_read_status_tc(struct dvb_frontend *fe, -+ enum fe_status *status) -+{ -+ int ret = 0; -+ u8 sync = 0; -+ u8 tslock = 0; -+ u8 unlock = 0; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ *status = 0; -+ if (priv->state == STATE_ACTIVE_TC) { -+ if (priv->system == SYS_DVBT || priv->system == SYS_DVBT2) { -+ ret = cxd2841er_read_status_t_t2( -+ priv, &sync, &tslock, &unlock); -+ if (ret) -+ goto done; -+ if (unlock) -+ goto done; -+ if (sync) -+ *status = FE_HAS_SIGNAL | -+ FE_HAS_CARRIER | -+ FE_HAS_VITERBI | -+ FE_HAS_SYNC; -+ if (tslock) -+ *status |= FE_HAS_LOCK; -+ } else if (priv->system == SYS_ISDBT) { -+ ret = cxd2841er_read_status_i( -+ priv, &sync, &tslock, &unlock); -+ if (ret) -+ goto done; -+ if (unlock) -+ goto done; -+ if (sync) -+ *status = FE_HAS_SIGNAL | -+ FE_HAS_CARRIER | -+ FE_HAS_VITERBI | -+ FE_HAS_SYNC; -+ if (tslock) -+ *status |= FE_HAS_LOCK; -+ } else if (priv->system == SYS_DVBC_ANNEX_A) { -+ ret = cxd2841er_read_status_c(priv, &tslock); -+ if (ret) -+ goto done; -+ if (tslock) -+ *status = FE_HAS_SIGNAL | -+ FE_HAS_CARRIER | -+ FE_HAS_VITERBI | -+ FE_HAS_SYNC | -+ FE_HAS_LOCK; -+ } -+ } -+done: -+ dev_dbg(&priv->i2c->dev, "%s(): status 0x%x\n", __func__, *status); -+ return ret; -+} -+ -+static int cxd2841er_get_carrier_offset_s_s2(struct cxd2841er_priv *priv, -+ int *offset) -+{ -+ u8 data[3]; -+ u8 is_hs_mode; -+ s32 cfrl_ctrlval; -+ s32 temp_div, temp_q, temp_r; -+ -+ if (priv->state != STATE_ACTIVE_S) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ /* -+ * Get High Sampling Rate mode -+ * slave Bank Addr Bit Signal name -+ * A0h 10h [0] ITRL_LOCK -+ */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data[0]); -+ if (data[0] & 0x01) { -+ /* -+ * slave Bank Addr Bit Signal name -+ * A0h 50h [4] IHSMODE -+ */ -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x50, &data[0]); -+ is_hs_mode = (data[0] & 0x10 ? 1 : 0); -+ } else { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): unable to detect sampling rate mode\n", -+ __func__); -+ return -EINVAL; -+ } -+ /* -+ * slave Bank Addr Bit Signal name -+ * A0h 45h [4:0] ICFRL_CTRLVAL[20:16] -+ * A0h 46h [7:0] ICFRL_CTRLVAL[15:8] -+ * A0h 47h [7:0] ICFRL_CTRLVAL[7:0] -+ */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x45, data, 3); -+ cfrl_ctrlval = sign_extend32((((u32)data[0] & 0x1F) << 16) | -+ (((u32)data[1] & 0xFF) << 8) | -+ ((u32)data[2] & 0xFF), 20); -+ temp_div = (is_hs_mode ? 1048576 : 1572864); -+ if (cfrl_ctrlval > 0) { -+ temp_q = div_s64_rem(97375LL * cfrl_ctrlval, -+ temp_div, &temp_r); -+ } else { -+ temp_q = div_s64_rem(-97375LL * cfrl_ctrlval, -+ temp_div, &temp_r); -+ } -+ if (temp_r >= temp_div / 2) -+ temp_q++; -+ if (cfrl_ctrlval > 0) -+ temp_q *= -1; -+ *offset = temp_q; -+ return 0; -+} -+ -+static int cxd2841er_get_carrier_offset_i(struct cxd2841er_priv *priv, -+ u32 bandwidth, int *offset) -+{ -+ u8 data[4]; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ if (priv->system != SYS_ISDBT) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", -+ __func__, priv->system); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); -+ *offset = -1 * sign_extend32( -+ ((u32)(data[0] & 0x1F) << 24) | ((u32)data[1] << 16) | -+ ((u32)data[2] << 8) | (u32)data[3], 29); -+ -+ switch (bandwidth) { -+ case 6000000: -+ *offset = -1 * ((*offset) * 8/264); -+ break; -+ case 7000000: -+ *offset = -1 * ((*offset) * 8/231); -+ break; -+ case 8000000: -+ *offset = -1 * ((*offset) * 8/198); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", -+ __func__, bandwidth); -+ return -EINVAL; -+ } -+ -+ dev_dbg(&priv->i2c->dev, "%s(): bandwidth %d offset %d\n", -+ __func__, bandwidth, *offset); -+ -+ return 0; -+} -+ -+static int cxd2841er_get_carrier_offset_t(struct cxd2841er_priv *priv, -+ u32 bandwidth, int *offset) -+{ -+ u8 data[4]; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ if (priv->system != SYS_DVBT) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", -+ __func__, priv->system); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); -+ *offset = -1 * sign_extend32( -+ ((u32)(data[0] & 0x1F) << 24) | ((u32)data[1] << 16) | -+ ((u32)data[2] << 8) | (u32)data[3], 29); -+ *offset *= (bandwidth / 1000000); -+ *offset /= 235; -+ return 0; -+} -+ -+static int cxd2841er_get_carrier_offset_t2(struct cxd2841er_priv *priv, -+ u32 bandwidth, int *offset) -+{ -+ u8 data[4]; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ if (priv->system != SYS_DVBT2) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", -+ __func__, priv->system); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); -+ *offset = -1 * sign_extend32( -+ ((u32)(data[0] & 0x0F) << 24) | ((u32)data[1] << 16) | -+ ((u32)data[2] << 8) | (u32)data[3], 27); -+ switch (bandwidth) { -+ case 1712000: -+ *offset /= 582; -+ break; -+ case 5000000: -+ case 6000000: -+ case 7000000: -+ case 8000000: -+ *offset *= (bandwidth / 1000000); -+ *offset /= 940; -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", -+ __func__, bandwidth); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static int cxd2841er_get_carrier_offset_c(struct cxd2841er_priv *priv, -+ int *offset) -+{ -+ u8 data[2]; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ if (priv->system != SYS_DVBC_ANNEX_A) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", -+ __func__, priv->system); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x15, data, sizeof(data)); -+ *offset = div_s64(41000LL * sign_extend32((((u32)data[0] & 0x3f) << 8) -+ | (u32)data[1], 13), 16384); -+ return 0; -+} -+ -+static int cxd2841er_read_packet_errors_c( -+ struct cxd2841er_priv *priv, u32 *penum) -+{ -+ u8 data[3]; -+ -+ *penum = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); -+ if (data[2] & 0x01) -+ *penum = ((u32)data[0] << 8) | (u32)data[1]; -+ return 0; -+} -+ -+static int cxd2841er_read_packet_errors_t( -+ struct cxd2841er_priv *priv, u32 *penum) -+{ -+ u8 data[3]; -+ -+ *penum = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); -+ if (data[2] & 0x01) -+ *penum = ((u32)data[0] << 8) | (u32)data[1]; -+ return 0; -+} -+ -+static int cxd2841er_read_packet_errors_t2( -+ struct cxd2841er_priv *priv, u32 *penum) -+{ -+ u8 data[3]; -+ -+ *penum = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xfd, data, sizeof(data)); -+ if (data[0] & 0x01) -+ *penum = ((u32)data[1] << 8) | (u32)data[2]; -+ return 0; -+} -+ -+static int cxd2841er_read_packet_errors_i( -+ struct cxd2841er_priv *priv, u32 *penum) -+{ -+ u8 data[2]; -+ -+ *penum = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xA1, data, 1); -+ -+ if (!(data[0] & 0x01)) -+ return 0; -+ -+ /* Layer A */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xA2, data, sizeof(data)); -+ *penum = ((u32)data[0] << 8) | (u32)data[1]; -+ -+ /* Layer B */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xA4, data, sizeof(data)); -+ *penum += ((u32)data[0] << 8) | (u32)data[1]; -+ -+ /* Layer C */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0xA6, data, sizeof(data)); -+ *penum += ((u32)data[0] << 8) | (u32)data[1]; -+ -+ return 0; -+} -+ -+static int cxd2841er_read_ber_c(struct cxd2841er_priv *priv, -+ u32 *bit_error, u32 *bit_count) -+{ -+ u8 data[3]; -+ u32 bit_err, period_exp; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x62, data, sizeof(data)); -+ if (!(data[0] & 0x80)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): no valid BER data\n", __func__); -+ return -EINVAL; -+ } -+ bit_err = ((u32)(data[0] & 0x3f) << 16) | -+ ((u32)data[1] << 8) | -+ (u32)data[2]; -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x60, data); -+ period_exp = data[0] & 0x1f; -+ -+ if ((period_exp <= 11) && (bit_err > (1 << period_exp) * 204 * 8)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): period_exp(%u) or bit_err(%u) not in range. no valid BER data\n", -+ __func__, period_exp, bit_err); -+ return -EINVAL; -+ } -+ -+ dev_dbg(&priv->i2c->dev, -+ "%s(): period_exp(%u) or bit_err(%u) count=%d\n", -+ __func__, period_exp, bit_err, -+ ((1 << period_exp) * 204 * 8)); -+ -+ *bit_error = bit_err; -+ *bit_count = ((1 << period_exp) * 204 * 8); -+ -+ return 0; -+} -+ -+static int cxd2841er_mon_read_ber_s(struct cxd2841er_priv *priv, -+ u32 *bit_error, u32 *bit_count) -+{ -+ u8 data[11]; -+ -+ /* Set SLV-T Bank : 0xA0 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); -+ /* -+ * slave Bank Addr Bit Signal name -+ * A0h 35h [0] IFVBER_VALID -+ * A0h 36h [5:0] IFVBER_BITERR[21:16] -+ * A0h 37h [7:0] IFVBER_BITERR[15:8] -+ * A0h 38h [7:0] IFVBER_BITERR[7:0] -+ * A0h 3Dh [5:0] IFVBER_BITNUM[21:16] -+ * A0h 3Eh [7:0] IFVBER_BITNUM[15:8] -+ * A0h 3Fh [7:0] IFVBER_BITNUM[7:0] -+ */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x35, data, 11); -+ if (data[0] & 0x01) { -+ *bit_error = ((u32)(data[1] & 0x3F) << 16) | -+ ((u32)(data[2] & 0xFF) << 8) | -+ (u32)(data[3] & 0xFF); -+ *bit_count = ((u32)(data[8] & 0x3F) << 16) | -+ ((u32)(data[9] & 0xFF) << 8) | -+ (u32)(data[10] & 0xFF); -+ if ((*bit_count == 0) || (*bit_error > *bit_count)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid bit_error %d, bit_count %d\n", -+ __func__, *bit_error, *bit_count); -+ return -EINVAL; -+ } -+ return 0; -+ } -+ dev_dbg(&priv->i2c->dev, "%s(): no data available\n", __func__); -+ return -EINVAL; -+} -+ -+ -+static int cxd2841er_mon_read_ber_s2(struct cxd2841er_priv *priv, -+ u32 *bit_error, u32 *bit_count) -+{ -+ u8 data[5]; -+ u32 period; -+ -+ /* Set SLV-T Bank : 0xB2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xb2); -+ /* -+ * slave Bank Addr Bit Signal name -+ * B2h 30h [0] IFLBER_VALID -+ * B2h 31h [3:0] IFLBER_BITERR[27:24] -+ * B2h 32h [7:0] IFLBER_BITERR[23:16] -+ * B2h 33h [7:0] IFLBER_BITERR[15:8] -+ * B2h 34h [7:0] IFLBER_BITERR[7:0] -+ */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x30, data, 5); -+ if (data[0] & 0x01) { -+ /* Bit error count */ -+ *bit_error = ((u32)(data[1] & 0x0F) << 24) | -+ ((u32)(data[2] & 0xFF) << 16) | -+ ((u32)(data[3] & 0xFF) << 8) | -+ (u32)(data[4] & 0xFF); -+ -+ /* Set SLV-T Bank : 0xA0 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x7a, data); -+ /* Measurement period */ -+ period = (u32)(1 << (data[0] & 0x0F)); -+ if (period == 0) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): period is 0\n", __func__); -+ return -EINVAL; -+ } -+ if (*bit_error > (period * 64800)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid bit_err 0x%x period 0x%x\n", -+ __func__, *bit_error, period); -+ return -EINVAL; -+ } -+ *bit_count = period * 64800; -+ -+ return 0; -+ } else { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): no data available\n", __func__); -+ } -+ return -EINVAL; -+} -+ -+static int cxd2841er_read_ber_t2(struct cxd2841er_priv *priv, -+ u32 *bit_error, u32 *bit_count) -+{ -+ u8 data[4]; -+ u32 period_exp, n_ldpc; -+ -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid state %d\n", __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x39, data, sizeof(data)); -+ if (!(data[0] & 0x10)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): no valid BER data\n", __func__); -+ return -EINVAL; -+ } -+ *bit_error = ((u32)(data[0] & 0x0f) << 24) | -+ ((u32)data[1] << 16) | -+ ((u32)data[2] << 8) | -+ (u32)data[3]; -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); -+ period_exp = data[0] & 0x0f; -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x22); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x5e, data); -+ n_ldpc = ((data[0] & 0x03) == 0 ? 16200 : 64800); -+ if (*bit_error > ((1U << period_exp) * n_ldpc)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid BER value\n", __func__); -+ return -EINVAL; -+ } -+ -+ /* -+ * FIXME: the right thing would be to return bit_error untouched, -+ * but, as we don't know the scale returned by the counters, let's -+ * at least preserver BER = bit_error/bit_count. -+ */ -+ if (period_exp >= 4) { -+ *bit_count = (1U << (period_exp - 4)) * (n_ldpc / 200); -+ *bit_error *= 3125ULL; -+ } else { -+ *bit_count = (1U << period_exp) * (n_ldpc / 200); -+ *bit_error *= 50000ULL; -+ } -+ return 0; -+} -+ -+static int cxd2841er_read_ber_t(struct cxd2841er_priv *priv, -+ u32 *bit_error, u32 *bit_count) -+{ -+ u8 data[2]; -+ u32 period; -+ -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid state %d\n", __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x39, data); -+ if (!(data[0] & 0x01)) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): no valid BER data\n", __func__); -+ return 0; -+ } -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x22, data, sizeof(data)); -+ *bit_error = ((u32)data[0] << 8) | (u32)data[1]; -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); -+ period = ((data[0] & 0x07) == 0) ? 256 : (4096 << (data[0] & 0x07)); -+ -+ /* -+ * FIXME: the right thing would be to return bit_error untouched, -+ * but, as we don't know the scale returned by the counters, let's -+ * at least preserver BER = bit_error/bit_count. -+ */ -+ *bit_count = period / 128; -+ *bit_error *= 78125ULL; -+ return 0; -+} -+ -+static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, -+ u8 delsys, u32 *snr) -+{ -+ u8 data[3]; -+ u32 res = 0, value; -+ int min_index, max_index, index; -+ static const struct cxd2841er_cnr_data *cn_data; -+ -+ /* Set SLV-T Bank : 0xA1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa1); -+ /* -+ * slave Bank Addr Bit Signal name -+ * A1h 10h [0] ICPM_QUICKRDY -+ * A1h 11h [4:0] ICPM_QUICKCNDT[12:8] -+ * A1h 12h [7:0] ICPM_QUICKCNDT[7:0] -+ */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x10, data, 3); -+ if (data[0] & 0x01) { -+ value = ((u32)(data[1] & 0x1F) << 8) | (u32)(data[2] & 0xFF); -+ min_index = 0; -+ if (delsys == SYS_DVBS) { -+ cn_data = s_cn_data; -+ max_index = sizeof(s_cn_data) / -+ sizeof(s_cn_data[0]) - 1; -+ } else { -+ cn_data = s2_cn_data; -+ max_index = sizeof(s2_cn_data) / -+ sizeof(s2_cn_data[0]) - 1; -+ } -+ if (value >= cn_data[min_index].value) { -+ res = cn_data[min_index].cnr_x1000; -+ goto done; -+ } -+ if (value <= cn_data[max_index].value) { -+ res = cn_data[max_index].cnr_x1000; -+ goto done; -+ } -+ while ((max_index - min_index) > 1) { -+ index = (max_index + min_index) / 2; -+ if (value == cn_data[index].value) { -+ res = cn_data[index].cnr_x1000; -+ goto done; -+ } else if (value > cn_data[index].value) -+ max_index = index; -+ else -+ min_index = index; -+ if ((max_index - min_index) <= 1) { -+ if (value == cn_data[max_index].value) { -+ res = cn_data[max_index].cnr_x1000; -+ goto done; -+ } else { -+ res = cn_data[min_index].cnr_x1000; -+ goto done; -+ } -+ } -+ } -+ } else { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): no data available\n", __func__); -+ return -EINVAL; -+ } -+done: -+ *snr = res; -+ return 0; -+} -+ -+static uint32_t sony_log(uint32_t x) -+{ -+ return (((10000>>8)*(intlog2(x)>>16) + LOG2_E_100X/2)/LOG2_E_100X); -+} -+ -+static int cxd2841er_read_snr_c(struct cxd2841er_priv *priv, u32 *snr) -+{ -+ u32 reg; -+ u8 data[2]; -+ enum sony_dvbc_constellation_t qam = SONY_DVBC_CONSTELLATION_16QAM; -+ -+ *snr = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ -+ /* -+ * Freeze registers: ensure multiple separate register reads -+ * are from the same snapshot -+ */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); -+ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x19, data, 1); -+ qam = (enum sony_dvbc_constellation_t) (data[0] & 0x07); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x4C, data, 2); -+ -+ reg = ((u32)(data[0]&0x1f) << 8) | (u32)data[1]; -+ if (reg == 0) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): reg value out of range\n", __func__); -+ return 0; -+ } -+ -+ switch (qam) { -+ case SONY_DVBC_CONSTELLATION_16QAM: -+ case SONY_DVBC_CONSTELLATION_64QAM: -+ case SONY_DVBC_CONSTELLATION_256QAM: -+ /* SNR(dB) = -9.50 * ln(IREG_SNR_ESTIMATE / (24320)) */ -+ if (reg < 126) -+ reg = 126; -+ *snr = -95 * (int32_t)sony_log(reg) + 95941; -+ break; -+ case SONY_DVBC_CONSTELLATION_32QAM: -+ case SONY_DVBC_CONSTELLATION_128QAM: -+ /* SNR(dB) = -8.75 * ln(IREG_SNR_ESTIMATE / (20800)) */ -+ if (reg < 69) -+ reg = 69; -+ *snr = -88 * (int32_t)sony_log(reg) + 86999; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int cxd2841er_read_snr_t(struct cxd2841er_priv *priv, u32 *snr) -+{ -+ u32 reg; -+ u8 data[2]; -+ -+ *snr = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid state %d\n", __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); -+ reg = ((u32)data[0] << 8) | (u32)data[1]; -+ if (reg == 0) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): reg value out of range\n", __func__); -+ return 0; -+ } -+ if (reg > 4996) -+ reg = 4996; -+ *snr = 10000 * ((intlog10(reg) - intlog10(5350 - reg)) >> 24) + 28500; -+ return 0; -+} -+ -+static int cxd2841er_read_snr_t2(struct cxd2841er_priv *priv, u32 *snr) -+{ -+ u32 reg; -+ u8 data[2]; -+ -+ *snr = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid state %d\n", __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); -+ reg = ((u32)data[0] << 8) | (u32)data[1]; -+ if (reg == 0) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): reg value out of range\n", __func__); -+ return 0; -+ } -+ if (reg > 10876) -+ reg = 10876; -+ *snr = 10000 * ((intlog10(reg) - -+ intlog10(12600 - reg)) >> 24) + 32000; -+ return 0; -+} -+ -+static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) -+{ -+ u32 reg; -+ u8 data[2]; -+ -+ *snr = 0; -+ if (priv->state != STATE_ACTIVE_TC) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid state %d\n", __func__, -+ priv->state); -+ return -EINVAL; -+ } -+ -+ /* Freeze all registers */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); -+ -+ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); -+ reg = ((u32)data[0] << 8) | (u32)data[1]; -+ if (reg == 0) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): reg value out of range\n", __func__); -+ return 0; -+ } -+ if (reg > 4996) -+ reg = 4996; -+ *snr = 100 * intlog10(reg) - 9031; -+ return 0; -+} -+ -+static u16 cxd2841er_read_agc_gain_c(struct cxd2841er_priv *priv, -+ u8 delsys) -+{ -+ u8 data[2]; -+ -+ cxd2841er_write_reg( -+ priv, I2C_SLVT, 0x00, 0x40); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x49, data, 2); -+ dev_dbg(&priv->i2c->dev, -+ "%s(): AGC value=%u\n", -+ __func__, (((u16)data[0] & 0x0F) << 8) | -+ (u16)(data[1] & 0xFF)); -+ return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; -+} -+ -+static u16 cxd2841er_read_agc_gain_t_t2(struct cxd2841er_priv *priv, -+ u8 delsys) -+{ -+ u8 data[2]; -+ -+ cxd2841er_write_reg( -+ priv, I2C_SLVT, 0x00, (delsys == SYS_DVBT ? 0x10 : 0x20)); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); -+ dev_dbg(&priv->i2c->dev, -+ "%s(): AGC value=%u\n", -+ __func__, (((u16)data[0] & 0x0F) << 8) | -+ (u16)(data[1] & 0xFF)); -+ return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; -+} -+ -+static u16 cxd2841er_read_agc_gain_i(struct cxd2841er_priv *priv, -+ u8 delsys) -+{ -+ u8 data[2]; -+ -+ cxd2841er_write_reg( -+ priv, I2C_SLVT, 0x00, 0x60); -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); -+ -+ dev_dbg(&priv->i2c->dev, -+ "%s(): AGC value=%u\n", -+ __func__, (((u16)data[0] & 0x0F) << 8) | -+ (u16)(data[1] & 0xFF)); -+ return ((((u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; -+} -+ -+static u16 cxd2841er_read_agc_gain_s(struct cxd2841er_priv *priv) -+{ -+ u8 data[2]; -+ -+ /* Set SLV-T Bank : 0xA0 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); -+ /* -+ * slave Bank Addr Bit Signal name -+ * A0h 1Fh [4:0] IRFAGC_GAIN[12:8] -+ * A0h 20h [7:0] IRFAGC_GAIN[7:0] -+ */ -+ cxd2841er_read_regs(priv, I2C_SLVT, 0x1f, data, 2); -+ return ((((u16)data[0] & 0x1F) << 8) | (u16)(data[1] & 0xFF)) << 3; -+} -+ -+static void cxd2841er_read_ber(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ u32 ret, bit_error = 0, bit_count = 0; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ switch (p->delivery_system) { -+ case SYS_DVBC_ANNEX_A: -+ case SYS_DVBC_ANNEX_B: -+ case SYS_DVBC_ANNEX_C: -+ ret = cxd2841er_read_ber_c(priv, &bit_error, &bit_count); -+ break; -+ case SYS_DVBS: -+ ret = cxd2841er_mon_read_ber_s(priv, &bit_error, &bit_count); -+ break; -+ case SYS_DVBS2: -+ ret = cxd2841er_mon_read_ber_s2(priv, &bit_error, &bit_count); -+ break; -+ case SYS_DVBT: -+ ret = cxd2841er_read_ber_t(priv, &bit_error, &bit_count); -+ break; -+ case SYS_DVBT2: -+ ret = cxd2841er_read_ber_t2(priv, &bit_error, &bit_count); -+ break; -+ default: -+ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ return; -+ } -+ -+ if (!ret) { -+ p->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; -+ p->post_bit_error.stat[0].uvalue += bit_error; -+ p->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; -+ p->post_bit_count.stat[0].uvalue += bit_count; -+ } else { -+ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ } -+} -+ -+static void cxd2841er_read_signal_strength(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ s32 strength; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ switch (p->delivery_system) { -+ case SYS_DVBT: -+ case SYS_DVBT2: -+ strength = cxd2841er_read_agc_gain_t_t2(priv, -+ p->delivery_system); -+ p->strength.stat[0].scale = FE_SCALE_DECIBEL; -+ /* Formula was empirically determinated @ 410 MHz */ -+ p->strength.stat[0].uvalue = strength * 366 / 100 - 89520; -+ break; /* Code moved out of the function */ -+ case SYS_DVBC_ANNEX_A: -+ case SYS_DVBC_ANNEX_B: -+ case SYS_DVBC_ANNEX_C: -+ strength = cxd2841er_read_agc_gain_c(priv, -+ p->delivery_system); -+ p->strength.stat[0].scale = FE_SCALE_DECIBEL; -+ /* -+ * Formula was empirically determinated via linear regression, -+ * using frequencies: 175 MHz, 410 MHz and 800 MHz, and a -+ * stream modulated with QAM64 -+ */ -+ p->strength.stat[0].uvalue = strength * 4045 / 1000 - 85224; -+ break; -+ case SYS_ISDBT: -+ strength = cxd2841er_read_agc_gain_i(priv, p->delivery_system); -+ p->strength.stat[0].scale = FE_SCALE_DECIBEL; -+ /* -+ * Formula was empirically determinated via linear regression, -+ * using frequencies: 175 MHz, 410 MHz and 800 MHz. -+ */ -+ p->strength.stat[0].uvalue = strength * 3775 / 1000 - 90185; -+ break; -+ case SYS_DVBS: -+ case SYS_DVBS2: -+ strength = 65535 - cxd2841er_read_agc_gain_s(priv); -+ p->strength.stat[0].scale = FE_SCALE_RELATIVE; -+ p->strength.stat[0].uvalue = strength; -+ break; -+ default: -+ p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ break; -+ } -+} -+ -+static void cxd2841er_read_snr(struct dvb_frontend *fe) -+{ -+ u32 tmp = 0; -+ int ret = 0; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ switch (p->delivery_system) { -+ case SYS_DVBC_ANNEX_A: -+ case SYS_DVBC_ANNEX_B: -+ case SYS_DVBC_ANNEX_C: -+ ret = cxd2841er_read_snr_c(priv, &tmp); -+ break; -+ case SYS_DVBT: -+ ret = cxd2841er_read_snr_t(priv, &tmp); -+ break; -+ case SYS_DVBT2: -+ ret = cxd2841er_read_snr_t2(priv, &tmp); -+ break; -+ case SYS_ISDBT: -+ ret = cxd2841er_read_snr_i(priv, &tmp); -+ break; -+ case SYS_DVBS: -+ case SYS_DVBS2: -+ ret = cxd2841er_dvbs_read_snr(priv, p->delivery_system, &tmp); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): unknown delivery system %d\n", -+ __func__, p->delivery_system); -+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ return; -+ } -+ -+ if (!ret) { -+ p->cnr.stat[0].scale = FE_SCALE_DECIBEL; -+ p->cnr.stat[0].svalue = tmp; -+ } else { -+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ } -+} -+ -+static void cxd2841er_read_ucblocks(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ u32 ucblocks; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ switch (p->delivery_system) { -+ case SYS_DVBC_ANNEX_A: -+ case SYS_DVBC_ANNEX_B: -+ case SYS_DVBC_ANNEX_C: -+ cxd2841er_read_packet_errors_c(priv, &ucblocks); -+ break; -+ case SYS_DVBT: -+ cxd2841er_read_packet_errors_t(priv, &ucblocks); -+ break; -+ case SYS_DVBT2: -+ cxd2841er_read_packet_errors_t2(priv, &ucblocks); -+ break; -+ case SYS_ISDBT: -+ cxd2841er_read_packet_errors_i(priv, &ucblocks); -+ break; -+ default: -+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ return; -+ } -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ -+ p->block_error.stat[0].scale = FE_SCALE_COUNTER; -+ p->block_error.stat[0].uvalue = ucblocks; -+} -+ -+static int cxd2841er_dvbt2_set_profile( -+ struct cxd2841er_priv *priv, enum cxd2841er_dvbt2_profile_t profile) -+{ -+ u8 tune_mode; -+ u8 seq_not2d_time; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ switch (profile) { -+ case DVBT2_PROFILE_BASE: -+ tune_mode = 0x01; -+ /* Set early unlock time */ -+ seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x0E:0x0C; -+ break; -+ case DVBT2_PROFILE_LITE: -+ tune_mode = 0x05; -+ /* Set early unlock time */ -+ seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x2E:0x28; -+ break; -+ case DVBT2_PROFILE_ANY: -+ tune_mode = 0x00; -+ /* Set early unlock time */ -+ seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x2E:0x28; -+ break; -+ default: -+ return -EINVAL; -+ } -+ /* Set SLV-T Bank : 0x2E */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2e); -+ /* Set profile and tune mode */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x10, tune_mode, 0x07); -+ /* Set SLV-T Bank : 0x2B */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); -+ /* Set early unlock detection time */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x9d, seq_not2d_time); -+ return 0; -+} -+ -+static int cxd2841er_dvbt2_set_plp_config(struct cxd2841er_priv *priv, -+ u8 is_auto, u8 plp_id) -+{ -+ if (is_auto) { -+ dev_dbg(&priv->i2c->dev, -+ "%s() using auto PLP selection\n", __func__); -+ } else { -+ dev_dbg(&priv->i2c->dev, -+ "%s() using manual PLP selection, ID %d\n", -+ __func__, plp_id); -+ } -+ /* Set SLV-T Bank : 0x23 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); -+ if (!is_auto) { -+ /* Manual PLP selection mode. Set the data PLP Id. */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xaf, plp_id); -+ } -+ /* Auto PLP select (Scanning mode = 0x00). Data PLP select = 0x01. */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xad, (is_auto ? 0x00 : 0x01)); -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, -+ u32 bandwidth) -+{ -+ u32 iffreq; -+ u8 data[MAX_WRITE_REGSIZE]; -+ -+ const uint8_t nominalRate8bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x11, 0xF0, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x15, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x11, 0xF0, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t nominalRate7bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x14, 0x80, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x18, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x14, 0x80, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t nominalRate6bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x17, 0xEA, 0xAA, 0xAA, 0xAA}, /* 20.5MHz XTal */ -+ {0x1C, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x17, 0xEA, 0xAA, 0xAA, 0xAA} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t nominalRate5bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x1C, 0xB3, 0x33, 0x33, 0x33}, /* 20.5MHz XTal */ -+ {0x21, 0x99, 0x99, 0x99, 0x99}, /* 24MHz XTal */ -+ {0x1C, 0xB3, 0x33, 0x33, 0x33} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t nominalRate17bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x58, 0xE2, 0xAF, 0xE0, 0xBC}, /* 20.5MHz XTal */ -+ {0x68, 0x0F, 0xA2, 0x32, 0xD0}, /* 24MHz XTal */ -+ {0x58, 0xE2, 0xAF, 0xE0, 0xBC} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t itbCoef8bw[3][14] = { -+ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, -+ 0x23, 0xA9, 0x1F, 0xA8, 0x2C, 0xC8}, /* 20.5MHz XTal */ -+ {0x2F, 0xBA, 0x28, 0x9B, 0x28, 0x9D, 0x28, 0xA1, -+ 0x29, 0xA5, 0x2A, 0xAC, 0x29, 0xB5}, /* 24MHz XTal */ -+ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, -+ 0x23, 0xA9, 0x1F, 0xA8, 0x2C, 0xC8} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t itbCoef7bw[3][14] = { -+ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, -+ 0x29, 0xB0, 0x26, 0xA9, 0x21, 0xA5}, /* 20.5MHz XTal */ -+ {0x30, 0xB1, 0x29, 0x9A, 0x28, 0x9C, 0x28, 0xA0, -+ 0x29, 0xA2, 0x2B, 0xA6, 0x2B, 0xAD}, /* 24MHz XTal */ -+ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, -+ 0x29, 0xB0, 0x26, 0xA9, 0x21, 0xA5} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t itbCoef6bw[3][14] = { -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, -+ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ -+ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, -+ 0x29, 0xA4, 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, -+ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t itbCoef5bw[3][14] = { -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, -+ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ -+ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, -+ 0x29, 0xA4, 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, -+ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ -+ }; -+ -+ const uint8_t itbCoef17bw[3][14] = { -+ {0x25, 0xA0, 0x36, 0x8D, 0x2E, 0x94, 0x28, 0x9B, -+ 0x32, 0x90, 0x2C, 0x9D, 0x29, 0x99}, /* 20.5MHz XTal */ -+ {0x33, 0x8E, 0x2B, 0x97, 0x2D, 0x95, 0x37, 0x8B, -+ 0x30, 0x97, 0x2D, 0x9A, 0x21, 0xA4}, /* 24MHz XTal */ -+ {0x25, 0xA0, 0x36, 0x8D, 0x2E, 0x94, 0x28, 0x9B, -+ 0x32, 0x90, 0x2C, 0x9D, 0x29, 0x99} /* 41MHz XTal */ -+ }; -+ -+ /* Set SLV-T Bank : 0x20 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ -+ switch (bandwidth) { -+ case 8000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate8bw[priv->xtal], 5); -+ -+ /* Set SLV-T Bank : 0x27 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, -+ 0x7a, 0x00, 0x0f); -+ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef8bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.80); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x00, 0x07); -+ break; -+ case 7000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate7bw[priv->xtal], 5); -+ -+ /* Set SLV-T Bank : 0x27 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, -+ 0x7a, 0x00, 0x0f); -+ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef7bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.20); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x02, 0x07); -+ break; -+ case 6000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate6bw[priv->xtal], 5); -+ -+ /* Set SLV-T Bank : 0x27 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, -+ 0x7a, 0x00, 0x0f); -+ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef6bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x04, 0x07); -+ break; -+ case 5000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate5bw[priv->xtal], 5); -+ -+ /* Set SLV-T Bank : 0x27 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, -+ 0x7a, 0x00, 0x0f); -+ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef5bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x06, 0x07); -+ break; -+ case 1712000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate17bw[priv->xtal], 5); -+ -+ /* Set SLV-T Bank : 0x27 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, -+ 0x7a, 0x03, 0x0f); -+ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef17bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.50); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x03, 0x07); -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_t_band( -+ struct cxd2841er_priv *priv, u32 bandwidth) -+{ -+ u8 data[MAX_WRITE_REGSIZE]; -+ u32 iffreq; -+ u8 nominalRate8bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x11, 0xF0, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x15, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x11, 0xF0, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ u8 nominalRate7bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x14, 0x80, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x18, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x14, 0x80, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ u8 nominalRate6bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x17, 0xEA, 0xAA, 0xAA, 0xAA}, /* 20.5MHz XTal */ -+ {0x1C, 0x00, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x17, 0xEA, 0xAA, 0xAA, 0xAA} /* 41MHz XTal */ -+ }; -+ u8 nominalRate5bw[3][5] = { -+ /* TRCG Nominal Rate [37:0] */ -+ {0x1C, 0xB3, 0x33, 0x33, 0x33}, /* 20.5MHz XTal */ -+ {0x21, 0x99, 0x99, 0x99, 0x99}, /* 24MHz XTal */ -+ {0x1C, 0xB3, 0x33, 0x33, 0x33} /* 41MHz XTal */ -+ }; -+ -+ u8 itbCoef8bw[3][14] = { -+ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, 0x23, 0xA9, -+ 0x1F, 0xA8, 0x2C, 0xC8}, /* 20.5MHz XTal */ -+ {0x2F, 0xBA, 0x28, 0x9B, 0x28, 0x9D, 0x28, 0xA1, 0x29, 0xA5, -+ 0x2A, 0xAC, 0x29, 0xB5}, /* 24MHz XTal */ -+ {0x26, 0xAF, 0x06, 0xCD, 0x13, 0xBB, 0x28, 0xBA, 0x23, 0xA9, -+ 0x1F, 0xA8, 0x2C, 0xC8} /* 41MHz XTal */ -+ }; -+ u8 itbCoef7bw[3][14] = { -+ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, 0x29, 0xB0, -+ 0x26, 0xA9, 0x21, 0xA5}, /* 20.5MHz XTal */ -+ {0x30, 0xB1, 0x29, 0x9A, 0x28, 0x9C, 0x28, 0xA0, 0x29, 0xA2, -+ 0x2B, 0xA6, 0x2B, 0xAD}, /* 24MHz XTal */ -+ {0x2C, 0xBD, 0x02, 0xCF, 0x04, 0xF8, 0x23, 0xA6, 0x29, 0xB0, -+ 0x26, 0xA9, 0x21, 0xA5} /* 41MHz XTal */ -+ }; -+ u8 itbCoef6bw[3][14] = { -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, -+ 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ -+ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, 0x29, 0xA4, -+ 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, -+ 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ -+ }; -+ u8 itbCoef5bw[3][14] = { -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, -+ 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ -+ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, 0x29, 0xA4, -+ 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz XTal */ -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, 0xCF, -+ 0x00, 0xE6, 0x23, 0xA4} /* 41MHz XTal */ -+ }; -+ -+ /* Set SLV-T Bank : 0x13 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); -+ /* Echo performance optimization setting */ -+ data[0] = 0x01; -+ data[1] = 0x14; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x9C, data, 2); -+ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ switch (bandwidth) { -+ case 8000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate8bw[priv->xtal], 5); -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef8bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.80); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x00, 0x07); -+ -+ /* Demod core latency setting */ -+ if (priv->xtal == SONY_XTAL_24000) { -+ data[0] = 0x15; -+ data[1] = 0x28; -+ } else { -+ data[0] = 0x01; -+ data[1] = 0xE0; -+ } -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Notch filter setting */ -+ data[0] = 0x01; -+ data[1] = 0x02; -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); -+ break; -+ case 7000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate7bw[priv->xtal], 5); -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef7bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.20); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x02, 0x07); -+ -+ /* Demod core latency setting */ -+ if (priv->xtal == SONY_XTAL_24000) { -+ data[0] = 0x1F; -+ data[1] = 0xF8; -+ } else { -+ data[0] = 0x12; -+ data[1] = 0xF8; -+ } -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Notch filter setting */ -+ data[0] = 0x00; -+ data[1] = 0x03; -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); -+ break; -+ case 6000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate6bw[priv->xtal], 5); -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef6bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x04, 0x07); -+ -+ /* Demod core latency setting */ -+ if (priv->xtal == SONY_XTAL_24000) { -+ data[0] = 0x25; -+ data[1] = 0x4C; -+ } else { -+ data[0] = 0x1F; -+ data[1] = 0xDC; -+ } -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Notch filter setting */ -+ data[0] = 0x00; -+ data[1] = 0x03; -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); -+ break; -+ case 5000000: -+ /* */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate5bw[priv->xtal], 5); -+ /* Group delay equaliser settings for -+ * ASCOT2D, ASCOT2E and ASCOT3 tuners -+ */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef5bw[priv->xtal], 14); -+ /* */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.60); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xD7, 0x06, 0x07); -+ -+ /* Demod core latency setting */ -+ if (priv->xtal == SONY_XTAL_24000) { -+ data[0] = 0x2C; -+ data[1] = 0xC2; -+ } else { -+ data[0] = 0x26; -+ data[1] = 0x3C; -+ } -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Notch filter setting */ -+ data[0] = 0x00; -+ data[1] = 0x03; -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); -+ break; -+ } -+ -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_i_band( -+ struct cxd2841er_priv *priv, u32 bandwidth) -+{ -+ u32 iffreq; -+ u8 data[3]; -+ -+ /* TRCG Nominal Rate */ -+ u8 nominalRate8bw[3][5] = { -+ {0x00, 0x00, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x11, 0xB8, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x00, 0x00, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ -+ u8 nominalRate7bw[3][5] = { -+ {0x00, 0x00, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x14, 0x40, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x00, 0x00, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ -+ u8 nominalRate6bw[3][5] = { -+ {0x14, 0x2E, 0x00, 0x00, 0x00}, /* 20.5MHz XTal */ -+ {0x17, 0xA0, 0x00, 0x00, 0x00}, /* 24MHz XTal */ -+ {0x14, 0x2E, 0x00, 0x00, 0x00} /* 41MHz XTal */ -+ }; -+ -+ u8 itbCoef8bw[3][14] = { -+ {0x00}, /* 20.5MHz XTal */ -+ {0x2F, 0xBA, 0x28, 0x9B, 0x28, 0x9D, 0x28, 0xA1, 0x29, -+ 0xA5, 0x2A, 0xAC, 0x29, 0xB5}, /* 24MHz Xtal */ -+ {0x0}, /* 41MHz XTal */ -+ }; -+ -+ u8 itbCoef7bw[3][14] = { -+ {0x00}, /* 20.5MHz XTal */ -+ {0x30, 0xB1, 0x29, 0x9A, 0x28, 0x9C, 0x28, 0xA0, 0x29, -+ 0xA2, 0x2B, 0xA6, 0x2B, 0xAD}, /* 24MHz Xtal */ -+ {0x00}, /* 41MHz XTal */ -+ }; -+ -+ u8 itbCoef6bw[3][14] = { -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, -+ 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 20.5MHz XTal */ -+ {0x31, 0xA8, 0x29, 0x9B, 0x27, 0x9C, 0x28, 0x9E, 0x29, -+ 0xA4, 0x29, 0xA2, 0x29, 0xA8}, /* 24MHz Xtal */ -+ {0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, 0x00, -+ 0xCF, 0x00, 0xE6, 0x23, 0xA4}, /* 41MHz XTal */ -+ }; -+ -+ dev_dbg(&priv->i2c->dev, "%s() bandwidth=%u\n", __func__, bandwidth); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ -+ /* 20.5/41MHz Xtal support is not available -+ * on ISDB-T 7MHzBW and 8MHzBW -+ */ -+ if (priv->xtal != SONY_XTAL_24000 && bandwidth > 6000000) { -+ dev_err(&priv->i2c->dev, -+ "%s(): bandwidth %d supported only for 24MHz xtal\n", -+ __func__, bandwidth); -+ return -EINVAL; -+ } -+ -+ switch (bandwidth) { -+ case 8000000: -+ /* TRCG Nominal Rate */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate8bw[priv->xtal], 5); -+ /* Group delay equaliser settings for ASCOT tuners optimized */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef8bw[priv->xtal], 14); -+ -+ /* IF freq setting */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.75); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x0, 0x7); -+ -+ /* Demod core latency setting */ -+ data[0] = 0x13; -+ data[1] = 0xFC; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Acquisition optimization setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x03, 0x07); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x03); -+ break; -+ case 7000000: -+ /* TRCG Nominal Rate */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate7bw[priv->xtal], 5); -+ /* Group delay equaliser settings for ASCOT tuners optimized */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef7bw[priv->xtal], 14); -+ -+ /* IF freq setting */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 4.15); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x02, 0x7); -+ -+ /* Demod core latency setting */ -+ data[0] = 0x1A; -+ data[1] = 0xFA; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Acquisition optimization setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x03, 0x07); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x02); -+ break; -+ case 6000000: -+ /* TRCG Nominal Rate */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0x9F, nominalRate6bw[priv->xtal], 5); -+ /* Group delay equaliser settings for ASCOT tuners optimized */ -+ cxd2841er_write_regs(priv, I2C_SLVT, -+ 0xA6, itbCoef6bw[priv->xtal], 14); -+ -+ /* IF freq setting */ -+ iffreq = MAKE_IFFREQ_CONFIG_XTAL(priv->xtal, 3.55); -+ data[0] = (u8) ((iffreq >> 16) & 0xff); -+ data[1] = (u8)((iffreq >> 8) & 0xff); -+ data[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); -+ -+ /* System bandwidth setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x04, 0x7); -+ -+ /* Demod core latency setting */ -+ if (priv->xtal == SONY_XTAL_24000) { -+ data[0] = 0x1F; -+ data[1] = 0x79; -+ } else { -+ data[0] = 0x1A; -+ data[1] = 0xE2; -+ } -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Acquisition optimization setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x07, 0x07); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x02); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", -+ __func__, bandwidth); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, -+ u32 bandwidth) -+{ -+ u8 bw7_8mhz_b10_a6[] = { -+ 0x2D, 0xC7, 0x04, 0xF4, 0x07, 0xC5, 0x2A, 0xB8, -+ 0x27, 0x9E, 0x27, 0xA4, 0x29, 0xAB }; -+ u8 bw6mhz_b10_a6[] = { -+ 0x27, 0xA7, 0x28, 0xB3, 0x02, 0xF0, 0x01, 0xE8, -+ 0x00, 0xCF, 0x00, 0xE6, 0x23, 0xA4 }; -+ u8 b10_b6[3]; -+ u32 iffreq; -+ -+ dev_dbg(&priv->i2c->dev, "%s() bw=%d\n", __func__, bandwidth); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ switch (bandwidth) { -+ case 8000000: -+ case 7000000: -+ cxd2841er_write_regs( -+ priv, I2C_SLVT, 0xa6, -+ bw7_8mhz_b10_a6, sizeof(bw7_8mhz_b10_a6)); -+ iffreq = MAKE_IFFREQ_CONFIG(4.9); -+ break; -+ case 6000000: -+ cxd2841er_write_regs( -+ priv, I2C_SLVT, 0xa6, -+ bw6mhz_b10_a6, sizeof(bw6mhz_b10_a6)); -+ iffreq = MAKE_IFFREQ_CONFIG(3.7); -+ break; -+ default: -+ dev_err(&priv->i2c->dev, "%s(): unsupported bandwidth %d\n", -+ __func__, bandwidth); -+ return -EINVAL; -+ } -+ /* */ -+ b10_b6[0] = (u8) ((iffreq >> 16) & 0xff); -+ b10_b6[1] = (u8)((iffreq >> 8) & 0xff); -+ b10_b6[2] = (u8)(iffreq & 0xff); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xb6, b10_b6, sizeof(b10_b6)); -+ /* Set SLV-T Bank : 0x11 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); -+ switch (bandwidth) { -+ case 8000000: -+ case 7000000: -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xa3, 0x00, 0x1f); -+ break; -+ case 6000000: -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0xa3, 0x14, 0x1f); -+ break; -+ } -+ /* Set SLV-T Bank : 0x40 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ switch (bandwidth) { -+ case 8000000: -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0x26, 0x0b, 0x0f); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x3e); -+ break; -+ case 7000000: -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0x26, 0x09, 0x0f); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0xd6); -+ break; -+ case 6000000: -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVT, 0x26, 0x08, 0x0f); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x6e); -+ break; -+ } -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_t(struct cxd2841er_priv *priv, -+ u32 bandwidth) -+{ -+ u8 data[2] = { 0x09, 0x54 }; -+ u8 data24m[3] = {0xDC, 0x6C, 0x00}; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Enable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Enable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Enable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); -+ /* Enable ADC 2 & 3 */ -+ if (priv->xtal == SONY_XTAL_41000) { -+ data[0] = 0x0A; -+ data[1] = 0xD4; -+ } -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); -+ /* Enable ADC 4 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ /* IFAGC gain settings */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); -+ /* Set SLV-T Bank : 0x11 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); -+ /* BBAGC TARGET level setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ /* ASCOT setting ON */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); -+ /* Set SLV-T Bank : 0x18 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); -+ /* Pre-RS BER moniter setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x36, 0x40, 0x07); -+ /* FEC Auto Recovery setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x01, 0x01); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* TSIF setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); -+ -+ if (priv->xtal == SONY_XTAL_24000) { -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xBF, 0x60); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x24, data24m, 3); -+ } -+ -+ cxd2841er_sleep_tc_to_active_t_band(priv, bandwidth); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable HiZ Setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); -+ /* Disable HiZ Setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); -+ priv->state = STATE_ACTIVE_TC; -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_t2(struct cxd2841er_priv *priv, -+ u32 bandwidth) -+{ -+ u8 data[MAX_WRITE_REGSIZE]; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_set_ts_clock_mode(priv, SYS_DVBT2); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x02); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Enable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x00); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Enable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Enable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); -+ -+ if (priv->xtal == SONY_XTAL_41000) { -+ data[0] = 0x0A; -+ data[1] = 0xD4; -+ } else { -+ data[0] = 0x09; -+ data[1] = 0x54; -+ } -+ -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); -+ /* Enable ADC 4 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ /* IFAGC gain settings */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); -+ /* Set SLV-T Bank : 0x11 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); -+ /* BBAGC TARGET level setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ /* ASCOT setting ON */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); -+ /* Set SLV-T Bank : 0x20 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ /* Acquisition optimization setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x8b, 0x3c); -+ /* Set SLV-T Bank : 0x2b */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x76, 0x20, 0x70); -+ /* Set SLV-T Bank : 0x23 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); -+ /* L1 Control setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xE6, 0x00, 0x03); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* TSIF setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); -+ /* DVB-T2 initial setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x10); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x34); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xd8); -+ /* Set SLV-T Bank : 0x2a */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x04, 0x0f); -+ /* Set SLV-T Bank : 0x2b */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x20, 0x3f); -+ -+ /* 24MHz Xtal setting */ -+ if (priv->xtal == SONY_XTAL_24000) { -+ /* Set SLV-T Bank : 0x11 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); -+ data[0] = 0xEB; -+ data[1] = 0x03; -+ data[2] = 0x3B; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x33, data, 3); -+ -+ /* Set SLV-T Bank : 0x20 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); -+ data[0] = 0x5E; -+ data[1] = 0x5E; -+ data[2] = 0x47; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x95, data, 3); -+ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x99, 0x18); -+ -+ data[0] = 0x3F; -+ data[1] = 0xFF; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); -+ -+ /* Set SLV-T Bank : 0x24 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); -+ data[0] = 0x0B; -+ data[1] = 0x72; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x34, data, 2); -+ -+ data[0] = 0x93; -+ data[1] = 0xF3; -+ data[2] = 0x00; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xD2, data, 3); -+ -+ data[0] = 0x05; -+ data[1] = 0xB8; -+ data[2] = 0xD8; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xDD, data, 3); -+ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xE0, 0x00); -+ -+ /* Set SLV-T Bank : 0x25 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x25); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xED, 0x60); -+ -+ /* Set SLV-T Bank : 0x27 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xFA, 0x34); -+ -+ /* Set SLV-T Bank : 0x2B */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2B); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x4B, 0x2F); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x9E, 0x0E); -+ -+ /* Set SLV-T Bank : 0x2D */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2D); -+ data[0] = 0x89; -+ data[1] = 0x89; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x24, data, 2); -+ -+ /* Set SLV-T Bank : 0x5E */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x5E); -+ data[0] = 0x24; -+ data[1] = 0x95; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x8C, data, 2); -+ } -+ -+ cxd2841er_sleep_tc_to_active_t2_band(priv, bandwidth); -+ -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable HiZ Setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); -+ /* Disable HiZ Setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); -+ priv->state = STATE_ACTIVE_TC; -+ return 0; -+} -+ -+/* ISDB-Tb part */ -+static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv, -+ u32 bandwidth) -+{ -+ u8 data[2] = { 0x09, 0x54 }; -+ u8 data24m[2] = {0x60, 0x00}; -+ u8 data24m2[3] = {0xB7, 0x1B, 0x00}; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x06); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Enable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); -+ /* Enable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x01); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x01); -+ /* Enable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Enable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); -+ /* xtal freq 20.5MHz or 24M */ -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); -+ /* Enable ADC 4 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); -+ /* ASCOT setting ON */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); -+ /* FEC Auto Recovery setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x00, 0x01); -+ /* ISDB-T initial setting */ -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x00, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x00, 0x01); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x69, 0x04, 0x07); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x6B, 0x03, 0x07); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9D, 0x50, 0xFF); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xD3, 0x06, 0x1F); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xED, 0x00, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xE2, 0xCE, 0x80); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xF2, 0x13, 0x10); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xDE, 0x2E, 0x3F); -+ /* Set SLV-T Bank : 0x15 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xDE, 0x02, 0x03); -+ /* Set SLV-T Bank : 0x1E */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x1E); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x73, 0x68, 0xFF); -+ /* Set SLV-T Bank : 0x63 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x63); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x81, 0x00, 0x01); -+ -+ /* for xtal 24MHz */ -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xBF, data24m, 2); -+ /* Set SLV-T Bank : 0x60 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); -+ cxd2841er_write_regs(priv, I2C_SLVT, 0xA8, data24m2, 3); -+ -+ cxd2841er_sleep_tc_to_active_i_band(priv, bandwidth); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable HiZ Setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); -+ /* Disable HiZ Setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); -+ priv->state = STATE_ACTIVE_TC; -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv, -+ u32 bandwidth) -+{ -+ u8 data[2] = { 0x09, 0x54 }; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_set_ts_clock_mode(priv, SYS_DVBC_ANNEX_A); -+ /* Set SLV-X Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); -+ /* Set demod mode */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x04); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Enable demod clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); -+ /* Disable RF level monitor */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); -+ /* Enable ADC clock */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); -+ /* Enable ADC 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); -+ /* xtal freq 20.5MHz */ -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); -+ /* Enable ADC 4 */ -+ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ /* IFAGC gain settings */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x09, 0x1f); -+ /* Set SLV-T Bank : 0x11 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); -+ /* BBAGC TARGET level setting */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x48); -+ /* Set SLV-T Bank : 0x10 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ /* ASCOT setting ON */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); -+ /* Set SLV-T Bank : 0x40 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); -+ /* Demod setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc3, 0x00, 0x04); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* TSIF setting */ -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); -+ -+ cxd2841er_sleep_tc_to_active_c_band(priv, bandwidth); -+ /* Set SLV-T Bank : 0x00 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ /* Disable HiZ Setting 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); -+ /* Disable HiZ Setting 2 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); -+ priv->state = STATE_ACTIVE_TC; -+ return 0; -+} -+ -+static int cxd2841er_get_frontend(struct dvb_frontend *fe, -+ struct dtv_frontend_properties *p) -+{ -+ enum fe_status status = 0; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state == STATE_ACTIVE_S) -+ cxd2841er_read_status_s(fe, &status); -+ else if (priv->state == STATE_ACTIVE_TC) -+ cxd2841er_read_status_tc(fe, &status); -+ -+ cxd2841er_read_signal_strength(fe); -+ -+ if (status & FE_HAS_LOCK) { -+ cxd2841er_read_snr(fe); -+ cxd2841er_read_ucblocks(fe); -+ -+ cxd2841er_read_ber(fe); -+ } else { -+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ } -+ return 0; -+} -+ -+static int cxd2841er_set_frontend_s(struct dvb_frontend *fe) -+{ -+ int ret = 0, i, timeout, carr_offset; -+ enum fe_status status; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ u32 symbol_rate = p->symbol_rate/1000; -+ -+ dev_dbg(&priv->i2c->dev, "%s(): %s frequency=%d symbol_rate=%d xtal=%d\n", -+ __func__, -+ (p->delivery_system == SYS_DVBS ? "DVB-S" : "DVB-S2"), -+ p->frequency, symbol_rate, priv->xtal); -+ switch (priv->state) { -+ case STATE_SLEEP_S: -+ ret = cxd2841er_sleep_s_to_active_s( -+ priv, p->delivery_system, symbol_rate); -+ break; -+ case STATE_ACTIVE_S: -+ ret = cxd2841er_retune_active(priv, p); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ ret = -EINVAL; -+ goto done; -+ } -+ if (ret) { -+ dev_dbg(&priv->i2c->dev, "%s(): tune failed\n", __func__); -+ goto done; -+ } -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ if (fe->ops.tuner_ops.set_params) -+ fe->ops.tuner_ops.set_params(fe); -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ cxd2841er_tune_done(priv); -+ timeout = ((3000000 + (symbol_rate - 1)) / symbol_rate) + 150; -+ for (i = 0; i < timeout / CXD2841ER_DVBS_POLLING_INVL; i++) { -+ usleep_range(CXD2841ER_DVBS_POLLING_INVL*1000, -+ (CXD2841ER_DVBS_POLLING_INVL + 2) * 1000); -+ cxd2841er_read_status_s(fe, &status); -+ if (status & FE_HAS_LOCK) -+ break; -+ } -+ if (status & FE_HAS_LOCK) { -+ if (cxd2841er_get_carrier_offset_s_s2( -+ priv, &carr_offset)) { -+ ret = -EINVAL; -+ goto done; -+ } -+ dev_dbg(&priv->i2c->dev, "%s(): carrier_offset=%d\n", -+ __func__, carr_offset); -+ } -+done: -+ /* Reset stats */ -+ p->strength.stat[0].scale = FE_SCALE_RELATIVE; -+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ -+ return ret; -+} -+ -+static int cxd2841er_set_frontend_tc(struct dvb_frontend *fe) -+{ -+ int ret = 0, timeout; -+ enum fe_status status; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ -+ -+ dev_dbg(&priv->i2c->dev, "%s() delivery_system=%d bandwidth_hz=%d\n", -+ __func__, p->delivery_system, p->bandwidth_hz); -+ -+ -+ cxd2841er_active_t_to_sleep_tc(priv); -+ cxd2841er_sleep_tc_to_shutdown(priv); -+ cxd2841er_init_tc(fe); -+ -+ if (p->delivery_system == SYS_DVBT) { -+ priv->system = SYS_DVBT; -+ switch (priv->state) { -+ case STATE_SLEEP_TC: -+ ret = cxd2841er_sleep_tc_to_active_t( -+ priv, p->bandwidth_hz); -+ break; -+ case STATE_ACTIVE_TC: -+ ret = cxd2841er_retune_active(priv, p); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ ret = -EINVAL; -+ } -+ } else if (p->delivery_system == SYS_DVBT2) { -+ priv->system = SYS_DVBT2; -+ cxd2841er_dvbt2_set_plp_config(priv, -+ (int)(p->stream_id > 255), p->stream_id); -+ cxd2841er_dvbt2_set_profile(priv, DVBT2_PROFILE_BASE); -+ switch (priv->state) { -+ case STATE_SLEEP_TC: -+ ret = cxd2841er_sleep_tc_to_active_t2(priv, -+ p->bandwidth_hz); -+ break; -+ case STATE_ACTIVE_TC: -+ ret = cxd2841er_retune_active(priv, p); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ ret = -EINVAL; -+ } -+ } else if (p->delivery_system == SYS_ISDBT) { -+ priv->system = SYS_ISDBT; -+ switch (priv->state) { -+ case STATE_SLEEP_TC: -+ ret = cxd2841er_sleep_tc_to_active_i( -+ priv, p->bandwidth_hz); -+ break; -+ case STATE_ACTIVE_TC: -+ ret = cxd2841er_retune_active(priv, p); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ ret = -EINVAL; -+ } -+ } else if (p->delivery_system == SYS_DVBC_ANNEX_A || -+ p->delivery_system == SYS_DVBC_ANNEX_C) { -+ priv->system = SYS_DVBC_ANNEX_A; -+ /* correct bandwidth */ -+ if (p->bandwidth_hz != 6000000 && -+ p->bandwidth_hz != 7000000 && -+ p->bandwidth_hz != 8000000) { -+ p->bandwidth_hz = 8000000; -+ dev_dbg(&priv->i2c->dev, "%s(): forcing bandwidth to %d\n", -+ __func__, p->bandwidth_hz); -+ } -+ -+ switch (priv->state) { -+ case STATE_SLEEP_TC: -+ ret = cxd2841er_sleep_tc_to_active_c( -+ priv, p->bandwidth_hz); -+ break; -+ case STATE_ACTIVE_TC: -+ ret = cxd2841er_retune_active(priv, p); -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ ret = -EINVAL; -+ } -+ } else { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid delivery system %d\n", -+ __func__, p->delivery_system); -+ ret = -EINVAL; -+ } -+ if (ret) -+ goto done; -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ if (fe->ops.tuner_ops.set_params) -+ fe->ops.tuner_ops.set_params(fe); -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ cxd2841er_tune_done(priv); -+ timeout = 2500; -+ while (timeout > 0) { -+ ret = cxd2841er_read_status_tc(fe, &status); -+ if (ret) -+ goto done; -+ if (status & FE_HAS_LOCK) -+ break; -+ msleep(20); -+ timeout -= 20; -+ } -+ if (timeout < 0) -+ dev_dbg(&priv->i2c->dev, -+ "%s(): LOCK wait timeout\n", __func__); -+done: -+ return ret; -+} -+ -+static int cxd2841er_tune_s(struct dvb_frontend *fe, -+ bool re_tune, -+ unsigned int mode_flags, -+ unsigned int *delay, -+ enum fe_status *status) -+{ -+ int ret, carrier_offset; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ -+ dev_dbg(&priv->i2c->dev, "%s() re_tune=%d\n", __func__, re_tune); -+ if (re_tune) { -+ ret = cxd2841er_set_frontend_s(fe); -+ if (ret) -+ return ret; -+ cxd2841er_read_status_s(fe, status); -+ if (*status & FE_HAS_LOCK) { -+ if (cxd2841er_get_carrier_offset_s_s2( -+ priv, &carrier_offset)) -+ return -EINVAL; -+ p->frequency += carrier_offset; -+ ret = cxd2841er_set_frontend_s(fe); -+ if (ret) -+ return ret; -+ } -+ } -+ *delay = HZ / 5; -+ return cxd2841er_read_status_s(fe, status); -+} -+ -+static int cxd2841er_tune_tc(struct dvb_frontend *fe, -+ bool re_tune, -+ unsigned int mode_flags, -+ unsigned int *delay, -+ enum fe_status *status) -+{ -+ int ret, carrier_offset; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ -+ dev_dbg(&priv->i2c->dev, "%s(): re_tune %d bandwidth=%d\n", __func__, -+ re_tune, p->bandwidth_hz); -+ if (re_tune) { -+ ret = cxd2841er_set_frontend_tc(fe); -+ if (ret) -+ return ret; -+ cxd2841er_read_status_tc(fe, status); -+ if (*status & FE_HAS_LOCK) { -+ switch (priv->system) { -+ case SYS_ISDBT: -+ ret = cxd2841er_get_carrier_offset_i( -+ priv, p->bandwidth_hz, -+ &carrier_offset); -+ if (ret) -+ return ret; -+ break; -+ case SYS_DVBT: -+ ret = cxd2841er_get_carrier_offset_t( -+ priv, p->bandwidth_hz, -+ &carrier_offset); -+ if (ret) -+ return ret; -+ break; -+ case SYS_DVBT2: -+ ret = cxd2841er_get_carrier_offset_t2( -+ priv, p->bandwidth_hz, -+ &carrier_offset); -+ if (ret) -+ return ret; -+ break; -+ case SYS_DVBC_ANNEX_A: -+ ret = cxd2841er_get_carrier_offset_c( -+ priv, &carrier_offset); -+ if (ret) -+ return ret; -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, -+ "%s(): invalid delivery system %d\n", -+ __func__, priv->system); -+ return -EINVAL; -+ } -+ dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n", -+ __func__, carrier_offset); -+ p->frequency += carrier_offset; -+ ret = cxd2841er_set_frontend_tc(fe); -+ if (ret) -+ return ret; -+ } -+ } -+ *delay = HZ / 5; -+ return cxd2841er_read_status_tc(fe, status); -+} -+ -+static int cxd2841er_sleep_s(struct dvb_frontend *fe) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_active_s_to_sleep_s(fe->demodulator_priv); -+ cxd2841er_sleep_s_to_shutdown(fe->demodulator_priv); -+ return 0; -+} -+ -+static int cxd2841er_sleep_tc(struct dvb_frontend *fe) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ if (priv->state == STATE_ACTIVE_TC) { -+ switch (priv->system) { -+ case SYS_DVBT: -+ cxd2841er_active_t_to_sleep_tc(priv); -+ break; -+ case SYS_DVBT2: -+ cxd2841er_active_t2_to_sleep_tc(priv); -+ break; -+ case SYS_ISDBT: -+ cxd2841er_active_i_to_sleep_tc(priv); -+ break; -+ case SYS_DVBC_ANNEX_A: -+ cxd2841er_active_c_to_sleep_tc(priv); -+ break; -+ default: -+ dev_warn(&priv->i2c->dev, -+ "%s(): unknown delivery system %d\n", -+ __func__, priv->system); -+ } -+ } -+ if (priv->state != STATE_SLEEP_TC) { -+ dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ cxd2841er_sleep_tc_to_shutdown(priv); -+ return 0; -+} -+ -+static int cxd2841er_send_burst(struct dvb_frontend *fe, -+ enum fe_sec_mini_cmd burst) -+{ -+ u8 data; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s(): burst mode %s\n", __func__, -+ (burst == SEC_MINI_A ? "A" : "B")); -+ if (priv->state != STATE_SLEEP_S && -+ priv->state != STATE_ACTIVE_S) { -+ dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ data = (burst == SEC_MINI_A ? 0 : 1); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x34, 0x01); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x35, data); -+ return 0; -+} -+ -+static int cxd2841er_set_tone(struct dvb_frontend *fe, -+ enum fe_sec_tone_mode tone) -+{ -+ u8 data; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s(): tone %s\n", __func__, -+ (tone == SEC_TONE_ON ? "On" : "Off")); -+ if (priv->state != STATE_SLEEP_S && -+ priv->state != STATE_ACTIVE_S) { -+ dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ data = (tone == SEC_TONE_ON ? 1 : 0); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x36, data); -+ return 0; -+} -+ -+static int cxd2841er_send_diseqc_msg(struct dvb_frontend *fe, -+ struct dvb_diseqc_master_cmd *cmd) -+{ -+ int i; -+ u8 data[12]; -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ if (priv->state != STATE_SLEEP_S && -+ priv->state != STATE_ACTIVE_S) { -+ dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", -+ __func__, priv->state); -+ return -EINVAL; -+ } -+ dev_dbg(&priv->i2c->dev, -+ "%s(): cmd->len %d\n", __func__, cmd->msg_len); -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); -+ /* DiDEqC enable */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x33, 0x01); -+ /* cmd1 length & data */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x3d, cmd->msg_len); -+ memset(data, 0, sizeof(data)); -+ for (i = 0; i < cmd->msg_len && i < sizeof(data); i++) -+ data[i] = cmd->msg[i]; -+ cxd2841er_write_regs(priv, I2C_SLVT, 0x3e, data, sizeof(data)); -+ /* repeat count for cmd1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x37, 1); -+ /* repeat count for cmd2: always 0 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x38, 0); -+ /* start transmit */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x32, 0x01); -+ /* wait for 1 sec timeout */ -+ for (i = 0; i < 50; i++) { -+ cxd2841er_read_reg(priv, I2C_SLVT, 0x10, data); -+ if (!data[0]) { -+ dev_dbg(&priv->i2c->dev, -+ "%s(): DiSEqC cmd has been sent\n", __func__); -+ return 0; -+ } -+ msleep(20); -+ } -+ dev_dbg(&priv->i2c->dev, -+ "%s(): DiSEqC cmd transmit timeout\n", __func__); -+ return -ETIMEDOUT; -+} -+ -+static void cxd2841er_release(struct dvb_frontend *fe) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ kfree(priv); -+} -+ -+static int cxd2841er_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s(): enable=%d\n", __func__, enable); -+ cxd2841er_set_reg_bits( -+ priv, I2C_SLVX, 0x8, (enable ? 0x01 : 0x00), 0x01); -+ return 0; -+} -+ -+static enum dvbfe_algo cxd2841er_get_algo(struct dvb_frontend *fe) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ return DVBFE_ALGO_HW; -+} -+ -+static void cxd2841er_init_stats(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ -+ p->strength.len = 1; -+ p->strength.stat[0].scale = FE_SCALE_RELATIVE; -+ p->cnr.len = 1; -+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->block_error.len = 1; -+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_error.len = 1; -+ p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ p->post_bit_count.len = 1; -+ p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+} -+ -+ -+static int cxd2841er_init_s(struct dvb_frontend *fe) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ -+ /* sanity. force demod to SHUTDOWN state */ -+ if (priv->state == STATE_SLEEP_S) { -+ dev_dbg(&priv->i2c->dev, "%s() forcing sleep->shutdown\n", -+ __func__); -+ cxd2841er_sleep_s_to_shutdown(priv); -+ } else if (priv->state == STATE_ACTIVE_S) { -+ dev_dbg(&priv->i2c->dev, "%s() forcing active->sleep->shutdown\n", -+ __func__); -+ cxd2841er_active_s_to_sleep_s(priv); -+ cxd2841er_sleep_s_to_shutdown(priv); -+ } -+ -+ dev_dbg(&priv->i2c->dev, "%s()\n", __func__); -+ cxd2841er_shutdown_to_sleep_s(priv); -+ /* SONY_DEMOD_CONFIG_SAT_IFAGCNEG set to 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xb9, 0x01, 0x01); -+ -+ cxd2841er_init_stats(fe); -+ -+ return 0; -+} -+ -+static int cxd2841er_init_tc(struct dvb_frontend *fe) -+{ -+ struct cxd2841er_priv *priv = fe->demodulator_priv; -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ -+ dev_dbg(&priv->i2c->dev, "%s() bandwidth_hz=%d\n", -+ __func__, p->bandwidth_hz); -+ cxd2841er_shutdown_to_sleep_tc(priv); -+ /* SONY_DEMOD_CONFIG_IFAGCNEG = 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcb, -+ priv->config->if_agc ? 0x40 : 0x00, 0x40); -+ /* SONY_DEMOD_CONFIG_IFAGC_ADC_FS = 0 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0xcd, -+ priv->config->ifagc_adc_range); -+ /* SONY_DEMOD_CONFIG_PARALLEL_SEL = 1 */ -+ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xCB, -+ priv->config->ts_error_polarity ? 0x00 : 0x01, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xC5, -+ priv->config->clock_polarity ? 0x01 : 0x00, 0x01); -+ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, 0x00, 0x80); -+ -+ cxd2841er_init_stats(fe); -+ -+ return 0; -+} -+ -+static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops; -+static struct dvb_frontend_ops cxd2841er_t_c_ops; -+ -+static struct dvb_frontend *cxd2841er_attach(struct cxd2841er_config *cfg, -+ struct i2c_adapter *i2c, -+ u8 system) -+{ -+ u8 chip_id = 0; -+ const char *type; -+ const char *name; -+ struct cxd2841er_priv *priv = NULL; -+ -+ /* allocate memory for the internal state */ -+ priv = kzalloc(sizeof(struct cxd2841er_priv), GFP_KERNEL); -+ if (!priv) -+ return NULL; -+ priv->i2c = i2c; -+ priv->config = cfg; -+ priv->i2c_addr_slvx = cfg->i2c_addr + 2; -+ priv->i2c_addr_slvt = cfg->i2c_addr; -+ priv->xtal = cfg->xtal; -+ priv->frontend.demodulator_priv = priv; -+ dev_info(&priv->i2c->dev, -+ "%s(): I2C adapter %p SLVX addr %x SLVT addr %x\n", -+ __func__, priv->i2c, -+ priv->i2c_addr_slvx, priv->i2c_addr_slvt); -+ chip_id = cxd2841er_chip_id(priv); -+ switch (chip_id) { -+ case CXD2837ER_CHIP_ID: -+ snprintf(cxd2841er_t_c_ops.info.name, 128, -+ "Sony CXD2837ER DVB-T/T2/C demodulator"); -+ name = "CXD2837ER"; -+ break; -+ case CXD2841ER_CHIP_ID: -+ snprintf(cxd2841er_t_c_ops.info.name, 128, -+ "Sony CXD2841ER DVB-T/T2/C demodulator"); -+ name = "CXD2841ER"; -+ break; -+ case CXD2854ER_CHIP_ID: -+ snprintf(cxd2841er_t_c_ops.info.name, 128, -+ "Sony CXD2854ER DVB-T/T2/C and ISDB-T demodulator"); -+ cxd2841er_t_c_ops.delsys[3] = SYS_ISDBT; -+ name = "CXD2854ER"; -+ break; -+ default: -+ dev_err(&priv->i2c->dev, "%s(): invalid chip ID 0x%02x\n", -+ __func__, chip_id); -+ priv->frontend.demodulator_priv = NULL; -+ kfree(priv); -+ return NULL; -+ } -+ -+ /* create dvb_frontend */ -+ if (system == SYS_DVBS) { -+ memcpy(&priv->frontend.ops, -+ &cxd2841er_dvbs_s2_ops, -+ sizeof(struct dvb_frontend_ops)); -+ type = "S/S2"; -+ } else { -+ memcpy(&priv->frontend.ops, -+ &cxd2841er_t_c_ops, -+ sizeof(struct dvb_frontend_ops)); -+ type = "T/T2/C/ISDB-T"; -+ } -+ -+ dev_info(&priv->i2c->dev, -+ "%s(): attaching %s DVB-%s frontend\n", -+ __func__, name, type); -+ dev_info(&priv->i2c->dev, "%s(): chip ID 0x%02x OK.\n", -+ __func__, chip_id); -+ return &priv->frontend; -+} -+ -+struct dvb_frontend *cxd2841er_attach_s(struct cxd2841er_config *cfg, -+ struct i2c_adapter *i2c) -+{ -+ return cxd2841er_attach(cfg, i2c, SYS_DVBS); -+} -+EXPORT_SYMBOL(cxd2841er_attach_s); -+ -+struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg, -+ struct i2c_adapter *i2c) -+{ -+ return cxd2841er_attach(cfg, i2c, 0); -+} -+EXPORT_SYMBOL(cxd2841er_attach_t_c); -+ -+static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { -+ .delsys = { SYS_DVBS, SYS_DVBS2 }, -+ .info = { -+ .name = "Sony CXD2841ER DVB-S/S2 demodulator", -+ .frequency_min = 500000, -+ .frequency_max = 2500000, -+ .frequency_stepsize = 0, -+ .symbol_rate_min = 1000000, -+ .symbol_rate_max = 45000000, -+ .symbol_rate_tolerance = 500, -+ .caps = FE_CAN_INVERSION_AUTO | -+ FE_CAN_FEC_AUTO | -+ FE_CAN_QPSK, -+ }, -+ .init = cxd2841er_init_s, -+ .sleep = cxd2841er_sleep_s, -+ .release = cxd2841er_release, -+ .set_frontend = cxd2841er_set_frontend_s, -+ .get_frontend = cxd2841er_get_frontend, -+ .read_status = cxd2841er_read_status_s, -+ .i2c_gate_ctrl = cxd2841er_i2c_gate_ctrl, -+ .get_frontend_algo = cxd2841er_get_algo, -+ .set_tone = cxd2841er_set_tone, -+ .diseqc_send_burst = cxd2841er_send_burst, -+ .diseqc_send_master_cmd = cxd2841er_send_diseqc_msg, -+ .tune = cxd2841er_tune_s -+}; -+ -+static struct dvb_frontend_ops cxd2841er_t_c_ops = { -+ .delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A }, -+ .info = { -+ .name = "", /* will set in attach function */ -+ .caps = FE_CAN_FEC_1_2 | -+ FE_CAN_FEC_2_3 | -+ FE_CAN_FEC_3_4 | -+ FE_CAN_FEC_5_6 | -+ FE_CAN_FEC_7_8 | -+ FE_CAN_FEC_AUTO | -+ FE_CAN_QPSK | -+ FE_CAN_QAM_16 | -+ FE_CAN_QAM_32 | -+ FE_CAN_QAM_64 | -+ FE_CAN_QAM_128 | -+ FE_CAN_QAM_256 | -+ FE_CAN_QAM_AUTO | -+ FE_CAN_TRANSMISSION_MODE_AUTO | -+ FE_CAN_GUARD_INTERVAL_AUTO | -+ FE_CAN_HIERARCHY_AUTO | -+ FE_CAN_MUTE_TS | -+ FE_CAN_2G_MODULATION, -+ .frequency_min = 42000000, -+ .frequency_max = 1002000000 -+ }, -+ .init = cxd2841er_init_tc, -+ .sleep = cxd2841er_sleep_tc, -+ .release = cxd2841er_release, -+ .set_frontend = cxd2841er_set_frontend_tc, -+ .get_frontend = cxd2841er_get_frontend, -+ .read_status = cxd2841er_read_status_tc, -+ .tune = cxd2841er_tune_tc, -+ .i2c_gate_ctrl = cxd2841er_i2c_gate_ctrl, -+ .get_frontend_algo = cxd2841er_get_algo -+}; -+ -+MODULE_DESCRIPTION("Sony CXD2841ER/CXD2854ER DVB-C/C2/T/T2/S/S2 demodulator driver"); -+MODULE_AUTHOR("Sergey Kozlov , Abylay Ospan "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/cxd2841er.h b/drivers/amlogic/dvb_tv/cxd2841er.h -new file mode 100644 -index 0000000..98a4682 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/cxd2841er.h -@@ -0,0 +1,50 @@ -+/* -+ * cxd2841er.h -+ * -+ * Sony CXD2441ER digital demodulator driver public definitions -+ * -+ * Copyright 2012 Sony Corporation -+ * Copyright (C) 2014 NetUP Inc. -+ * Copyright (C) 2014 Sergey Kozlov -+ * Copyright (C) 2014 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef CXD2841ER_H -+#define CXD2841ER_H -+ -+#include -+#include -+ -+enum cxd2841er_xtal { -+ SONY_XTAL_20500, /* 20.5 MHz */ -+ SONY_XTAL_24000, /* 24 MHz */ -+ SONY_XTAL_41000 /* 41 MHz */ -+}; -+ -+struct cxd2841er_config { -+ u8 i2c_addr; -+ u8 if_agc; -+ u8 ifagc_adc_range; -+ u8 ts_error_polarity; -+ u8 clock_polarity; -+ u8 mxl603; -+ enum cxd2841er_xtal xtal; -+}; -+ -+extern struct dvb_frontend *cxd2841er_attach_s(struct cxd2841er_config *cfg, -+ struct i2c_adapter *i2c); -+ -+extern struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg, -+ struct i2c_adapter *i2c); -+ -+#endif -diff --git a/drivers/amlogic/dvb_tv/cxd2841er_priv.h b/drivers/amlogic/dvb_tv/cxd2841er_priv.h -new file mode 100644 -index 0000000..5e2b8d8 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/cxd2841er_priv.h -@@ -0,0 +1,45 @@ -+/* -+ * cxd2841er_priv.h -+ * -+ * Sony CXD2441ER digital demodulator driver internal definitions -+ * -+ * Copyright 2012 Sony Corporation -+ * Copyright (C) 2014 NetUP Inc. -+ * Copyright (C) 2014 Sergey Kozlov -+ * Copyright (C) 2014 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef CXD2841ER_PRIV_H -+#define CXD2841ER_PRIV_H -+ -+#define I2C_SLVX 0 -+#define I2C_SLVT 1 -+ -+#define CXD2841ER_CHIP_ID 0xa7 -+#define CXD2854ER_CHIP_ID 0xc1 -+#define CXD2837ER_CHIP_ID 0xb1 -+ -+#define CXD2841ER_DVBS_POLLING_INVL 10 -+ -+struct cxd2841er_cnr_data { -+ u32 value; -+ int cnr_x1000; -+}; -+ -+enum cxd2841er_dvbt2_profile_t { -+ DVBT2_PROFILE_ANY = 0, -+ DVBT2_PROFILE_BASE = 1, -+ DVBT2_PROFILE_LITE = 2 -+}; -+ -+#endif -diff --git a/drivers/amlogic/dvb_tv/mn88436.c b/drivers/amlogic/dvb_tv/mn88436.c -new file mode 100644 -index 0000000..d76c88d ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/mn88436.c -@@ -0,0 +1,379 @@ -+/* -+ * Driver for the Panasonic MN88436 ATSC demodulator -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "dvb_frontend.h" -+#include "mn88436.h" -+ -+struct mn88436_state { -+ struct dvb_frontend frontend; -+ struct i2c_adapter *i2c; -+ fe_modulation_t current_modulation; -+ u32 current_frequency; -+ u8 mn88436_bank[DMD_REG_BANK]; -+ bool boot; -+}; -+static int mn88436_write_reg(struct mn88436_state *state, u8 id, u8 reg, u8 val) -+{ -+ int ret; -+ u8 buf[] = { reg, val }; -+ struct i2c_msg msg = { .addr = state->mn88436_bank[id], -+ .flags = 0, -+ .buf = buf, -+ .len = 2 -+ }; -+ -+ -+ ret = i2c_transfer(state->i2c, &msg, 1); -+ if (ret == 1) { -+ ret = 0; -+ } else { -+ dev_warn(&state->i2c->dev, "i2c wr failed=%d reg=%02x " -+ , ret, reg); -+ ret = -EREMOTEIO; -+ } -+ return ret; -+} -+static int mn88436_read_reg(struct mn88436_state *state, u8 id, u8 reg, u8 *val) -+{ -+ int ret; -+ u8 buf[] = { reg }; -+ struct i2c_msg msg[] = { -+ { .addr = state->mn88436_bank[id], -+ .flags = 0, -+ .buf = buf, -+ .len = 1 -+ }, -+ { .addr = state->mn88436_bank[id], -+ .flags = I2C_M_RD, -+ .buf = val, -+ .len = 1 -+ }, -+ }; -+ -+ ret = i2c_transfer(state->i2c, msg, 2); -+ if (ret == 2) { -+ ret = 0; -+ } else { -+ dev_warn(&state->i2c->dev, "i2c rd failed=%d reg=%02x " -+ , ret, reg); -+ ret = -EREMOTEIO; -+ } -+ return ret; -+} -+static int mn88436_write_reg_mask(struct mn88436_state *state, u8 id, -+ u8 reg , u8 mask , u8 data) -+{ -+ int ret; -+ u8 rd; -+ -+ ret = mn88436_read_reg(state, id, reg, &rd); -+ if (ret) -+ goto err; -+ -+ rd |= mask & data; -+ rd &= (mask ^ 0xff) | data; -+ -+ ret = mn88436_write_reg(state, id, reg, rd); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+ -+static int mn88436_read_status(struct dvb_frontend* fe, fe_status_t* status) -+{ -+ struct mn88436_state* state = fe->demodulator_priv; -+ int ret; -+ u8 locked; -+ *status = 0; -+ -+ ret = mn88436_read_reg(state, 0, DMD_MAIN_STSMON1, &locked); -+ if (ret) -+ goto err; -+ -+ if (locked & 1) -+ *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | -+ FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+ -+} -+static int mn88436_set_frontend(struct dvb_frontend* fe) -+{ -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct mn88436_state* state = fe->demodulator_priv; -+ int cnt = 50, ret; -+ u8 locked; -+ -+ if (!state->boot) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ if (fe->ops.tuner_ops.set_params) { -+ ret = fe->ops.tuner_ops.set_params(fe); -+ if (ret) -+ goto err; -+ } -+ -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_RSTSET1, 0x77); -+ if (ret) -+ goto err; -+ -+ -+ do { -+ ret = mn88436_read_reg(state, 0, DMD_MAIN_STSMON1, &locked); -+ -+ if (!ret && (locked & 1)) -+ break; -+ -+ msleep(10); -+ -+ } while (--cnt); -+ -+ if (!cnt) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); -+ -+ state->current_frequency = p->frequency; -+ state->current_modulation = p->modulation; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int mn88436_get_frontend(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *p = &fe->dtv_property_cache; -+ struct mn88436_state *state = fe->demodulator_priv; -+ -+ p->modulation = state->current_modulation; -+ p->frequency = state->current_frequency; -+ -+ return 0; -+} -+ -+ -+static int mn88436_init(struct dvb_frontend* fe) -+{ -+ struct mn88436_state* state = fe->demodulator_priv; -+ const struct firmware *fw = NULL; -+ int ret, i; -+ u8 d; -+ -+ if (state->boot) -+ return 0; -+ -+ dev_dbg(&state->i2c->dev, "Uploading demod firmware (%s)...\n", MN88436_DEMOD_ATSC); -+ -+ ret = request_firmware(&fw, MN88436_DEMOD_ATSC, &state->i2c->dev); -+ if (ret) { -+ dev_dbg(&state->i2c->dev, "Firmware upload failed. Timeout or file not found\n"); -+ goto err1; -+ } -+ -+ for (i = 0;;) { -+ -+ if (fw->data[i] == 0xff) -+ break; -+ -+ ret = mn88436_write_reg(state, fw->data[i], fw->data[i + 1], fw->data[i + 2]); -+ if (ret) -+ goto err2; -+ -+ i = i + 3; -+ } -+ -+ release_firmware(fw); -+ fw = NULL; -+ -+ dev_dbg(&state->i2c->dev, "Uploading demod pseq (%s)...\n", MN88436_DEMOD_PSEQ); -+ ret = request_firmware(&fw, MN88436_DEMOD_PSEQ, &state->i2c->dev); -+ if (ret) { -+ dev_dbg(&state->i2c->dev, "Pseq upload failed. Timeout or file not found\n"); -+ goto err1; -+ } -+ -+ /* Load PSEQ Program */ -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_PSEQSET , 0x03); -+ if (ret) -+ goto err2; -+ -+ for (i = 0; i < fw->size; i++) { -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_PSEQPRG , fw->data[i]); -+ if (ret) -+ goto err2; -+ } -+ -+ release_firmware(fw); -+ fw = NULL; -+ -+ /* Check Parity bit */ -+ ret = mn88436_read_reg(state, 0, DMD_MAIN_PSEQSET , &d); -+ if (ret) -+ goto err1; -+ -+ if (d & 0x20) { -+ ret = -EAGAIN; -+ goto err1; -+ } -+ -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_PSEQSET , 0x00); -+ if (ret) -+ goto err1; -+ -+ -+ /* TS parallel (Fixed clock mode) */ -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_CPOSET2, 0xc1); -+ if (ret) -+ goto err1; -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_GPSET1, 0xff); -+ if (ret) -+ goto err1; -+ -+ -+ /* Set TCB Through Mode */ -+ ret = mn88436_write_reg_mask(state, 0, DMD_MAIN_TCBSET, 0x7f, 0x53); -+ if (ret) -+ goto err1; -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_TCBADR, 0x00); -+ if (ret) -+ goto err1; -+ -+ -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_VEQSET2, 0x80); -+ if (ret) -+ goto err1; -+ -+ state->boot = true; -+ -+ return 0; -+ -+err2: -+ release_firmware(fw); -+ fw = NULL; -+err1: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+ -+} -+static void mn88436_release(struct dvb_frontend* fe) -+{ -+ struct mn88436_state* state = fe->demodulator_priv; -+ kfree(state); -+} -+ -+ -+static struct dvb_frontend_ops mn88436_ops = { -+ .delsys = { SYS_ATSC }, -+ .info = { -+ .name = "Panasonic MN88436", -+ .frequency_min = 51000000, -+ .frequency_max = 858000000, -+ .caps = FE_CAN_8VSB -+ }, -+ .init = mn88436_init, -+ .release = mn88436_release, -+ .set_frontend = mn88436_set_frontend, -+ .get_frontend = mn88436_get_frontend, -+ .read_status = mn88436_read_status, -+ -+}; -+ -+struct dvb_frontend *mn88436_attach(struct i2c_adapter *i2c, -+ u8 device_id) -+{ -+ struct mn88436_state *state = NULL; -+ int ret; -+ -+ -+ state = kzalloc(sizeof(struct mn88436_state), GFP_KERNEL); -+ if (!state) { -+ ret = -ENOMEM; -+ dev_err(&i2c->dev, "kzalloc() failed\n"); -+ goto err1; -+ } -+ -+ state->i2c = i2c; -+ -+ switch (device_id) { -+ case 0: -+ default: -+ state->mn88436_bank[0] = 0x18; -+ state->mn88436_bank[1] = 0x10; -+ break; -+ case 1: -+ state->mn88436_bank[0] = 0x19; -+ state->mn88436_bank[1] = 0x11; -+ break; -+ case 2: -+ state->mn88436_bank[0] = 0x1A; -+ state->mn88436_bank[1] = 0x12; -+ break; -+ case 3: -+ state->mn88436_bank[0] = 0x1B; -+ state->mn88436_bank[1] = 0x13; -+ break; -+ } -+ /* Try SOFT reset */ -+ ret = mn88436_write_reg(state, 0, DMD_MAIN_RSTSET1, 0x77); -+ if (ret) -+ goto err2; -+ -+ dev_info(&i2c->dev, "MN88436 ATSC successfully attached\n"); -+ -+ memcpy(&state->frontend.ops, &mn88436_ops, -+ sizeof(struct dvb_frontend_ops)); -+ -+ state->frontend.demodulator_priv = state; -+ -+ return &state->frontend; -+ -+err2: -+ kfree(state); -+err1: -+ dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return NULL; -+} -+EXPORT_SYMBOL(mn88436_attach); -+ -+MODULE_DESCRIPTION("Panasonic MN88436 ATSC demod driver"); -+MODULE_AUTHOR("Sasa Savic "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/mn88436.h b/drivers/amlogic/dvb_tv/mn88436.h -new file mode 100644 -index 0000000..e16db86 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/mn88436.h -@@ -0,0 +1,47 @@ -+/* -+ * Driver for the Panasonic MN88436 ATSC demodulator -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __MN88436_H_ -+#define __MN88436_H_ -+ -+#include -+#include -+ -+ -+#define MN88436_DEMOD_ATSC "dvb-fe-mn88436-atsc.fw" -+#define MN88436_DEMOD_PSEQ "dvb-fe-mn88436-pseq.fw" -+ -+#define DMD_REG_BANK 2 -+ -+#define DMD_MAIN_CPOSET2 0x2 -+#define DMD_MAIN_GPSET1 0x5 -+#define DMD_MAIN_RSTSET1 0x10 -+#define DMD_MAIN_TCBSET 0x15 -+#define DMD_MAIN_TCBADR 0x17 -+#define DMD_MAIN_VEQSET2 0x69 -+#define DMD_MAIN_STSMON1 0xC4 -+#define DMD_MAIN_PSEQSET 0xF0 -+#define DMD_MAIN_PSEQPRG 0xF1 -+ -+ -+extern struct dvb_frontend *mn88436_attach(struct i2c_adapter *i2c, -+ u8 device_id); -+ -+#endif -\ No newline at end of file -diff --git a/drivers/amlogic/dvb_tv/mxl603.c b/drivers/amlogic/dvb_tv/mxl603.c -new file mode 100644 -index 0000000..bc7018c ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/mxl603.c -@@ -0,0 +1,1096 @@ -+/* -+ * Driver for the MaxLinear MxL603 tuner -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#include -+#include -+#include "tuner-i2c.h" -+#include "mxl603.h" -+ -+ -+enum mxl603_mode { -+ MxL603_MODE_CABLE, -+ MxL603_MODE_ISDBT_ATSC, -+ MxL603_MODE_DVBT, -+}; -+ -+enum mxl603_bw_mhz { -+ MxL603_CABLE_BW_6MHz = 0x00, -+ MxL603_CABLE_BW_7MHz = 0x01, -+ MxL603_CABLE_BW_8MHz = 0x02, -+ MxL603_TERR_BW_6MHz = 0x20, -+ MxL603_TERR_BW_7MHz = 0x21, -+ MxL603_TERR_BW_8MHz = 0x22, -+}; -+ -+struct reg_pair_t { -+ u8 reg; -+ u8 val; -+}; -+ -+struct freq_table { -+ u32 center_freq; -+ u8 reg1; -+ u8 reg2; -+}; -+ -+static struct freq_table MxL603_Cable[] = { -+ { 1 , 0x00, 0xD8 }, -+ { 695000000, 0x20, 0xD7 }, -+ { 0, 0, 0 }, -+}; -+ -+static struct freq_table MxL603_Digital[] = { -+ { 1, 0x00, 0xD8 }, -+ { 0, 0, 0 }, -+}; -+ -+static struct reg_pair_t MxL603_DigitalDvbc[] = { -+ { 0x0C, 0x00 }, -+ { 0x13, 0x04 }, -+ { 0x53, 0x7E }, -+ { 0x57, 0x91 }, -+ { 0x5C, 0xB1 }, -+ { 0x62, 0xF2 }, -+ { 0x6E, 0x03 }, -+ { 0x6F, 0xD1 }, -+ { 0x87, 0x77 }, -+ { 0x88, 0x55 }, -+ { 0x93, 0x33 }, -+ { 0x97, 0x03 }, -+ { 0xBA, 0x40 }, -+ { 0x98, 0xAF }, -+ { 0x9B, 0x20 }, -+ { 0x9C, 0x1E }, -+ { 0xA0, 0x18 }, -+ { 0xA5, 0x09 }, -+ { 0xC2, 0xA9 }, -+ { 0xC5, 0x7C }, -+ { 0xCD, 0x64 }, -+ { 0xCE, 0x7C }, -+ { 0xD5, 0x05 }, -+ { 0xD9, 0x00 }, -+ { 0xEA, 0x00 }, -+ { 0xDC, 0x1C }, -+ { 0, 0 } -+}; -+ -+static struct reg_pair_t MxL603_DigitalIsdbtAtsc[] = { -+ { 0x0C, 0x00 }, -+ { 0x13, 0x04 }, -+ { 0x53, 0xFE }, -+ { 0x57, 0x91 }, -+ { 0x62, 0xC2 }, -+ { 0x6E, 0x01 }, -+ { 0x6F, 0x51 }, -+ { 0x87, 0x77 }, -+ { 0x88, 0x55 }, -+ { 0x93, 0x22 }, -+ { 0x97, 0x02 }, -+ { 0xBA, 0x30 }, -+ { 0x98, 0xAF }, -+ { 0x9B, 0x20 }, -+ { 0x9C, 0x1E }, -+ { 0xA0, 0x18 }, -+ { 0xA5, 0x09 }, -+ { 0xC2, 0xA9 }, -+ { 0xC5, 0x7C }, -+ { 0xCD, 0xEB }, -+ { 0xCE, 0x7F }, -+ { 0xD5, 0x03 }, -+ { 0xD9, 0x04 }, -+ { 0, 0 } -+}; -+ -+static struct reg_pair_t MxL603_DigitalDvbt[] = { -+ { 0x0C, 0x00 }, -+ { 0x13, 0x04 }, -+ { 0x53, 0xFE }, -+ { 0x57, 0x91 }, -+ { 0x62, 0xC2 }, -+ { 0x6E, 0x01 }, -+ { 0x6F, 0x51 }, -+ { 0x87, 0x77 }, -+ { 0x88, 0x55 }, -+ { 0x93, 0x22 }, -+ { 0x97, 0x02 }, -+ { 0xBA, 0x30 }, -+ { 0x98, 0xAF }, -+ { 0x9B, 0x20 }, -+ { 0x9C, 0x1E }, -+ { 0xA0, 0x18 }, -+ { 0xA5, 0x09 }, -+ { 0xC2, 0xA9 }, -+ { 0xC5, 0x7C }, -+ { 0xCD, 0x64 }, -+ { 0xCE, 0x7C }, -+ { 0xD5, 0x03 }, -+ { 0xD9, 0x04 }, -+ { 0, 0 } -+}; -+ -+struct mxl603_state { -+ struct mxl603_config *config; -+ struct i2c_adapter *i2c; -+ u8 addr; -+ u32 frequency; -+ u32 bandwidth; -+}; -+ -+static int mxl603_write_reg(struct mxl603_state *state, u8 reg, u8 val) -+{ -+ -+ u8 buf[] = { reg, val }; -+ struct i2c_msg msg = { .addr = state->addr, .flags = 0, -+ .buf = buf, .len = 2 }; -+ int ret; -+ -+ ret = i2c_transfer(state->i2c, &msg, 1); -+ if (ret == 1) { -+ ret = 0; -+ } else { -+ dev_warn(&state->i2c->dev, "i2c wr failed=%d reg=%02x " -+ , ret, reg); -+ ret = -EREMOTEIO; -+ } -+ return ret; -+} -+ -+static int mxl603_write_regs(struct mxl603_state *state, -+ struct reg_pair_t *reg_pair) -+{ -+ unsigned int i = 0; -+ int ret = 0; -+ -+ while ((ret == 0) && (reg_pair[i].reg || reg_pair[i].val)) { -+ ret = mxl603_write_reg(state, -+ reg_pair[i].reg, reg_pair[i].val); -+ i++; -+ } -+ return ret; -+} -+static int mxl603_read_reg(struct mxl603_state *state, u8 reg, u8 *val) -+{ -+ -+ u8 buf[2] = { 0xfb, reg }; -+ struct i2c_msg msg[] = { -+ { .addr = state->addr, .flags = 0, -+ .buf = buf, .len = 2 }, -+ { .addr = state->addr, .flags = I2C_M_RD, -+ .buf = val, .len = 1 }, -+ }; -+ int ret; -+ -+ ret = i2c_transfer(state->i2c, msg, 2); -+ if (ret == 2) { -+ ret = 0; -+ } else { -+ dev_warn(&state->i2c->dev, "i2c rd failed=%d reg=%02x " -+ , ret, reg); -+ ret = -EREMOTEIO; -+ } -+ return ret; -+} -+static int mxl603_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ -+ *frequency = 0; -+ -+ switch (state->config->if_freq_hz) { -+ case MXL603_IF_3_65MHz: -+ *frequency = 3650000; -+ break; -+ case MXL603_IF_4MHz: -+ *frequency = 4000000; -+ break; -+ case MXL603_IF_4_1MHz: -+ *frequency = 4100000; -+ break; -+ case MXL603_IF_4_15MHz: -+ *frequency = 4150000; -+ break; -+ case MXL603_IF_4_5MHz: -+ *frequency = 4500000; -+ break; -+ case MXL603_IF_4_57MHz: -+ *frequency = 4570000; -+ break; -+ case MXL603_IF_5MHz: -+ *frequency = 5000000; -+ break; -+ case MXL603_IF_5_38MHz: -+ *frequency = 5380000; -+ break; -+ case MXL603_IF_6MHz: -+ *frequency = 6000000; -+ break; -+ case MXL603_IF_6_28MHz: -+ *frequency = 6280000; -+ break; -+ case MXL603_IF_7_2MHz: -+ *frequency = 7200000; -+ break; -+ case MXL603_IF_8_25MHz: -+ *frequency = 8250000; -+ break; -+ case MXL603_IF_35_25MHz: -+ *frequency = 35250000; -+ break; -+ case MXL603_IF_36MHz: -+ *frequency = 36000000; -+ break; -+ case MXL603_IF_36_15MHz: -+ *frequency = 36150000; -+ break; -+ case MXL603_IF_36_65MHz: -+ *frequency = 36650000; -+ break; -+ case MXL603_IF_44MHz: -+ *frequency = 44000000; -+ break; -+ } -+ return 0; -+} -+ -+static int mxl603_set_freq(struct mxl603_state *state, -+ int freq, -+ enum mxl603_mode mode, -+ enum mxl603_bw_mhz bw, -+ struct freq_table *ftable) -+{ -+ u8 d = 0, d1 = 0, d2 = 0, d3 = 0; -+ u16 f; -+ u32 tmp, div; -+ int ret; -+ int i; -+ -+ ret = mxl603_write_reg(state, 0x12, 0x00); -+ if (ret) -+ goto err; -+ -+ if (freq < 700000000) { -+ ret = mxl603_write_reg(state, 0x7C, 0x1F); -+ if (ret) -+ goto err; -+ -+ if (mode == MxL603_MODE_CABLE) -+ d = 0xC1; -+ else -+ d = 0x81; -+ -+ } else { -+ ret = mxl603_write_reg(state, 0x7C, 0x9F); -+ if (ret) -+ goto err; -+ -+ if (mode == MxL603_MODE_CABLE) -+ d = 0xD1; -+ else -+ d = 0x91; -+ } -+ -+ ret = mxl603_write_reg(state, 0x00, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x31, d); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x00); -+ if (ret) -+ goto err; -+ -+ for (i = 0; 0 != ftable->center_freq; i++, ftable++) { -+ -+ if (ftable->center_freq == 1) { -+ d1 = ftable->reg1; -+ d2 = ftable->reg2; -+ break; -+ } -+ } -+ -+ for (i = 0; 0 != ftable->center_freq; i++, ftable++) { -+ -+ if ((ftable->center_freq - 500000) <= freq && -+ (ftable->center_freq + 500000) >= freq) { -+ d1 = ftable->reg1; -+ d2 = ftable->reg2; -+ break; -+ } -+ } -+ -+ ret = mxl603_write_reg(state, 0xEA, d1); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0xEB, d2); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x0F, bw); -+ if (ret) -+ goto err; -+ -+ /* convert freq to 10.6 fixed point float [MHz] */ -+ f = freq / 1000000; -+ tmp = freq % 1000000; -+ div = 1000000; -+ for (i = 0; i < 6; i++) { -+ f <<= 1; -+ div >>= 1; -+ if (tmp > div) { -+ tmp -= div; -+ f |= 1; -+ } -+ } -+ if (tmp > 7812) -+ f++; -+ -+ d1 = f & 0xFF; -+ d2 = f >> 8; -+ -+ ret = mxl603_write_reg(state, 0x10, d1); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x11, d2); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x0B, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0x96, &d); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x00); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0xB6, &d1); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0x60, &d2); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0x5F, &d3); -+ if (ret) -+ goto err; -+ -+ if ((d & 0x10) == 0x10) { -+ -+ d1 &= 0xBF; -+ d1 |= 0x0E; -+ -+ d2 &= 0xC0; -+ d2 |= 0x0E; -+ -+ d3 &= 0xC0; -+ d3 |= 0x0E; -+ } else { -+ -+ d1 |= 0x40; -+ d1 &= 0xC0; -+ -+ d2 &= 0xC0; -+ d2 |= 0x37; -+ -+ d3 &= 0xC0; -+ d3 |= 0x37; -+ -+ } -+ -+ ret = mxl603_write_reg(state, 0x60, d2); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x5F, d3); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x00); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0xB6, d); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x12, 0x01); -+ if (ret) -+ goto err; -+ -+ msleep(20); -+ -+ d |= 0x40; -+ -+ ret = mxl603_write_reg(state, 0xB6, d); -+ if (ret) -+ goto err; -+ -+ msleep(20); -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int mxl603_set_mode(struct dvb_frontend *fe, -+ struct mxl603_state *state, -+ enum mxl603_mode mode) -+{ -+ -+ u8 cfg_0, cfg_1, pwr, dfe; -+ int ret; -+ u32 if_out_freq; -+ struct reg_pair_t *reg_table; -+ -+ ret = mxl603_get_if_frequency(fe, &if_out_freq); -+ if (!if_out_freq) -+ goto err; -+ -+ if_out_freq /= 1000; -+ -+ switch (mode) { -+ case MxL603_MODE_CABLE: -+ reg_table = MxL603_DigitalDvbc; -+ pwr = 0; -+ dfe = 0xFF; -+ -+ if (if_out_freq < 35250) { -+ cfg_0 = 0xFE; -+ cfg_1 = 0x10; -+ -+ } else { -+ cfg_0 = 0xD9; -+ cfg_1 = 0x16; -+ } -+ -+ break; -+ case MxL603_MODE_ISDBT_ATSC: -+ reg_table = MxL603_DigitalIsdbtAtsc; -+ dfe = 0x1C; -+ -+ if (if_out_freq < 35250) { -+ cfg_0 = 0xF9; -+ cfg_1 = 0x18; -+ pwr = 0xF1; -+ } else { -+ cfg_0 = 0xD9; -+ cfg_1 = 0x16; -+ pwr = 0xB1; -+ } -+ switch(state->config->if_out_gain_level) -+ { -+ case 0x09: dfe = 0x44; break; -+ case 0x08: dfe = 0x43; break; -+ case 0x07: dfe = 0x42; break; -+ case 0x06: dfe = 0x41; break; -+ case 0x05: dfe = 0x40; break; -+ default: break; -+ } -+ -+ break; -+ case MxL603_MODE_DVBT: -+ reg_table = MxL603_DigitalDvbt; -+ dfe = 0; -+ if (if_out_freq < 35250) { -+ cfg_0 = 0xFE; -+ cfg_1 = 0x18; -+ pwr = 0xF1; -+ } else { -+ cfg_0 = 0xD9; -+ cfg_1 = 0x16; -+ pwr = 0xB1; -+ } -+ switch(state->config->if_out_gain_level) -+ { -+ case 0x09: dfe = 0x44; break; -+ case 0x08: dfe = 0x43; break; -+ case 0x07: dfe = 0x42; break; -+ case 0x06: dfe = 0x41; break; -+ case 0x05: dfe = 0x40; break; -+ default: break; -+ } -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ ret = mxl603_write_regs(state, reg_table); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x5A, cfg_0); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x5B, cfg_1); -+ if (ret) -+ goto err; -+ -+ if (pwr) { -+ ret = mxl603_write_reg(state, 0x5C, pwr); -+ if (ret) -+ goto err; -+ } -+ -+ ret = mxl603_write_reg(state, 0xEA, -+ state->config->xtal_freq_hz ? 0x0E : 0x0D); -+ if (ret) -+ goto err; -+ -+ if (dfe != 0xFF) { -+ ret = mxl603_write_reg(state, 0xDC, dfe); -+ if (ret) -+ goto err; -+ } -+ -+ ret = mxl603_write_reg(state, 0x03, 0x00); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x03, 0x01); -+ if (ret) -+ goto err; -+ -+ msleep(50); -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int mxl603_set_agc(struct mxl603_state *state) -+{ -+ u8 d = 0; -+ int ret; -+ -+ ret = mxl603_read_reg(state, 0x08, &d); -+ if (ret) -+ goto err; -+ -+ d &= 0xF2; -+ d = (u8) (d | (state->config->agc_type << 2) | 0x01); -+ ret = mxl603_write_reg(state, 0x08, d); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0x09, &d); -+ if (ret) -+ goto err; -+ -+ d &= 0x80; -+ d |= (u8)(state->config->agc_set_point & 0xff); -+ ret = mxl603_write_reg(state, 0x09, d); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0x5E, &d); -+ if (ret) -+ goto err; -+ -+ d &= 0xEF; -+ d |= (state->config->agc_invert_pol << 4); -+ ret = mxl603_write_reg(state, 0x5E, d); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int mxl603_set_if_out(struct mxl603_state *state) -+{ -+ u8 d = 0; -+ int ret; -+ -+ ret = mxl603_read_reg(state, 0x04, &d); -+ if (ret) -+ goto err; -+ -+ d |= state->config->if_freq_hz; -+ -+ ret = mxl603_write_reg(state, 0x04, d); -+ if (ret) -+ goto err; -+ -+ d = 0; -+ if (state->config->invert_if) -+ d = 0x3 << 6; -+ -+ d += (state->config->gain_level & 0x0F); -+ d |= 0x20; -+ ret = mxl603_write_reg(state, 0x05, d); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int mxl603_set_xtal(struct mxl603_state *state) -+{ -+ u8 d = 0; -+ int ret; -+ -+ d = (u8)((state->config->xtal_freq_hz << 5) -+ | (state->config->xtal_cap & 0x1F)); -+ d |= (state->config->clk_out_enable << 7); -+ -+ ret = mxl603_write_reg(state, 0x01, d); -+ if (ret) -+ goto err; -+ -+ d = (0x01 & (u8)state->config->clk_out_div); -+ -+ if (state->config->xtal_sharing_mode) { -+ d |= 0x40; -+ -+ ret = mxl603_write_reg(state, 0x02, d); -+ if (ret) -+ goto err; -+ ret = mxl603_write_reg(state, 0x6D, 0x80); -+ if (ret) -+ goto err; -+ } else { -+ d &= 0x01; -+ ret = mxl603_write_reg(state, 0x02, d); -+ if (ret) -+ goto err; -+ ret = mxl603_write_reg(state, 0x6D, 0x0A); -+ if (ret) -+ goto err; -+ } -+ -+ if (state->config->single_supply_3_3V) { -+ ret = mxl603_write_reg(state, 0x0E, 0x14); -+ if (ret) -+ goto err; -+ } -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int mxl603_tuner_init_default(struct mxl603_state *state) -+{ -+ u8 d = 0; -+ int ret; -+ -+ ret = mxl603_write_reg(state, 0xFF, 0x00); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_regs(state, MxL603_DigitalDvbc); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_read_reg(state, 0x31, &d); -+ if (ret) -+ goto err; -+ -+ d &= 0x2F; -+ d |= 0xD0; -+ -+ ret = mxl603_write_reg(state, 0x31, d); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x00); -+ if (ret) -+ goto err; -+ -+ if (state->config->single_supply_3_3V) { -+ ret = mxl603_write_reg(state, 0x0E, 0x04); -+ if (ret) -+ goto err; -+ } -+ -+ mdelay(1); -+ -+ return 0; -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int mxl603_synth_lock_status(struct mxl603_state *state, -+ int *rf_locked, int *ref_locked) -+{ -+ u8 d = 0; -+ int ret; -+ -+ *rf_locked = 0; -+ *ref_locked = 0; -+ -+ ret = mxl603_read_reg(state, 0x2B, &d); -+ if (ret) -+ goto err; -+ -+ if ((d & 0x02) == 0x02) -+ *rf_locked = 1; -+ -+ if ((d & 0x01) == 0x01) -+ *ref_locked = 1; -+ -+ return 0; -+ -+err: -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int mxl603_get_status(struct dvb_frontend *fe, u32 *status) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ int rf_locked, ref_locked, ret; -+ -+ *status = 0; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ ret = mxl603_synth_lock_status(state, &rf_locked, &ref_locked); -+ if (ret) -+ goto err; -+ -+ dev_dbg(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", -+ ref_locked ? "ref locked" : ""); -+ -+ if ((rf_locked) || (ref_locked)) -+ *status |= TUNER_STATUS_LOCKED; -+ -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ return 0; -+ -+err: -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+static int mxl603_set_params(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ struct mxl603_state *state = fe->tuner_priv; -+ struct freq_table *ftable; -+ enum mxl603_bw_mhz bw; -+ enum mxl603_mode mode; -+ int ret; -+ u32 freq = c->frequency; -+ -+ dev_dbg(&state->i2c->dev, -+ "%s: delivery_system=%d frequency=%d bandwidth_hz=%d\n", -+ __func__, c->delivery_system, c->frequency, c->bandwidth_hz); -+ -+ -+ switch (c->delivery_system) { -+ case SYS_ATSC: -+ mode = MxL603_MODE_ISDBT_ATSC; -+ bw = MxL603_TERR_BW_6MHz; -+ ftable = MxL603_Digital; -+ break; -+ case SYS_DVBC_ANNEX_A: -+ mode = MxL603_MODE_CABLE; -+ ftable = MxL603_Cable; -+ bw = MxL603_CABLE_BW_8MHz; -+ break; -+ case SYS_DVBT: -+ case SYS_DVBT2: -+ mode = MxL603_MODE_DVBT; -+ ftable = MxL603_Digital; -+ switch (c->bandwidth_hz) { -+ case 6000000: -+ bw = MxL603_TERR_BW_6MHz; -+ break; -+ case 7000000: -+ bw = MxL603_TERR_BW_7MHz; -+ break; -+ case 8000000: -+ bw = MxL603_TERR_BW_8MHz; -+ break; -+ default: -+ return -EINVAL; -+ } -+ break; -+ default: -+ dev_dbg(&state->i2c->dev, "%s: err state=%d\n", -+ __func__, fe->dtv_property_cache.delivery_system); -+ return -EINVAL; -+ } -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ ret = mxl603_tuner_init_default(state); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_set_xtal(state); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_set_if_out(state); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_set_agc(state); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_set_mode(fe, state, mode); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_set_freq(state, freq, mode, bw, ftable); -+ if (ret) -+ goto err; -+ -+ state->frequency = freq; -+ state->bandwidth = c->bandwidth_hz; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ msleep(15); -+ -+ return 0; -+ -+err: -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int mxl603_get_frequency(struct dvb_frontend *fe, u32 *frequency) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ *frequency = state->frequency; -+ return 0; -+} -+ -+static int mxl603_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ *bandwidth = state->bandwidth; -+ return 0; -+} -+ -+static int mxl603_init(struct dvb_frontend *fe) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ int ret; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ /* wake from standby */ -+ ret = mxl603_write_reg(state, 0x0B, 0x01); -+ if (ret) -+ goto err; -+ ret = mxl603_write_reg(state, 0x12, 0x01); -+ if (ret) -+ goto err; -+ ret = mxl603_write_reg(state, 0x00, 0x01); -+ if (ret) -+ goto err; -+ -+ if (state->config->loop_thru_enable) -+ ret = mxl603_write_reg(state, 0x60, 0x0E); -+ else -+ ret = mxl603_write_reg(state, 0x60, 0x37); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x00, 0x00); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int mxl603_sleep(struct dvb_frontend *fe) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ int ret; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ /* enter standby mode */ -+ ret = mxl603_write_reg(state, 0x12, 0x00); -+ if (ret) -+ goto err; -+ -+ ret = mxl603_write_reg(state, 0x0B, 0x00); -+ if (ret) -+ goto err; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ return 0; -+ -+err: -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ -+static int mxl603_release(struct dvb_frontend *fe) -+{ -+ struct mxl603_state *state = fe->tuner_priv; -+ -+ fe->tuner_priv = NULL; -+ kfree(state); -+ -+ return 0; -+} -+static struct dvb_tuner_ops mxl603_tuner_ops = { -+ .info = { -+ .name = "MaxLinear MxL603", -+ .frequency_min = 1000000, -+ .frequency_max = 1200000000, -+ .frequency_step = 25000, -+ }, -+ .init = mxl603_init, -+ .sleep = mxl603_sleep, -+ .set_params = mxl603_set_params, -+ .get_status = mxl603_get_status, -+ .get_frequency = mxl603_get_frequency, -+ .get_bandwidth = mxl603_get_bandwidth, -+ .release = mxl603_release, -+ .get_if_frequency = mxl603_get_if_frequency, -+}; -+static int mxl603_get_chip_id(struct mxl603_state *state) -+{ -+ int ret; -+ u8 id; -+ -+ ret = mxl603_read_reg(state, 0x18, &id); -+ if (ret) -+ goto err; -+ -+ if (id != 0x02) { -+ ret = -ENODEV; -+ goto err; -+ } -+ -+ dev_info(&state->i2c->dev, "MxL603 detected id(%02x)\n" -+ , id); -+ -+ return ret; -+ -+err: -+ dev_warn(&state->i2c->dev, "MxL603 unable to identify device(%02x)\n" -+ , id); -+ return ret; -+} -+struct dvb_frontend *mxl603_attach(struct dvb_frontend *fe, -+ struct i2c_adapter *i2c, u8 addr, -+ struct mxl603_config *config) -+{ -+ struct mxl603_state *state = NULL; -+ int ret = 0; -+ -+ state = kzalloc(sizeof(struct mxl603_state), GFP_KERNEL); -+ if (!state) { -+ ret = -ENOMEM; -+ dev_err(&i2c->dev, "kzalloc() failed\n"); -+ goto err1; -+ } -+ -+ state->config = config; -+ state->i2c = i2c; -+ state->addr = addr; -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 1); -+ -+ ret = mxl603_get_chip_id(state); -+ -+ if (fe->ops.i2c_gate_ctrl) -+ fe->ops.i2c_gate_ctrl(fe, 0); -+ -+ /* check return value of mxl603_get_chip_id */ -+ if (ret) -+ goto err2; -+ -+ dev_info(&i2c->dev, "Attaching MxL603\n"); -+ -+ fe->tuner_priv = state; -+ -+ memcpy(&fe->ops.tuner_ops, &mxl603_tuner_ops, -+ sizeof(struct dvb_tuner_ops)); -+ -+ return fe; -+ -+err2: -+ kfree(state); -+err1: -+ return NULL; -+} -+EXPORT_SYMBOL(mxl603_attach); -+ -+MODULE_DESCRIPTION("MaxLinear MxL603 tuner driver"); -+MODULE_AUTHOR("Sasa Savic "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/mxl603.h b/drivers/amlogic/dvb_tv/mxl603.h -new file mode 100644 -index 0000000..8560a41 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/mxl603.h -@@ -0,0 +1,83 @@ -+/* -+ * Driver for the MaxLinear MxL603 tuner -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __MXL603_H__ -+#define __MXL603_H__ -+ -+#include -+#include "dvb_frontend.h" -+ -+enum mxl603_if_freq { -+ MXL603_IF_3_65MHz, -+ MXL603_IF_4MHz, -+ MXL603_IF_4_1MHz, -+ MXL603_IF_4_15MHz, -+ MXL603_IF_4_5MHz, -+ MXL603_IF_4_57MHz, -+ MXL603_IF_5MHz, -+ MXL603_IF_5_38MHz, -+ MXL603_IF_6MHz, -+ MXL603_IF_6_28MHz, -+ MXL603_IF_7_2MHz, -+ MXL603_IF_8_25MHz, -+ MXL603_IF_35_25MHz, -+ MXL603_IF_36MHz, -+ MXL603_IF_36_15MHz, -+ MXL603_IF_36_65MHz, -+ MXL603_IF_44MHz, -+}; -+ -+enum mxl603_xtal_freq { -+ MXL603_XTAL_16MHz, -+ MXL603_XTAL_24MHz, -+}; -+ -+enum mxl603_agc { -+ MXL603_AGC_SELF, -+ MXL603_AGC_EXTERNAL, -+}; -+ -+struct mxl603_config { -+ enum mxl603_xtal_freq xtal_freq_hz; -+ enum mxl603_if_freq if_freq_hz; -+ enum mxl603_agc agc_type; -+ -+ u8 xtal_cap; -+ u8 gain_level; -+ u8 if_out_gain_level; -+ u8 agc_set_point; -+ -+ u8 agc_invert_pol; -+ u8 invert_if; -+ u8 loop_thru_enable; -+ u8 clk_out_enable; -+ u8 clk_out_div; -+ u8 clk_out_ext; -+ u8 xtal_sharing_mode; -+ u8 single_supply_3_3V; -+}; -+ -+ -+ -+extern struct dvb_frontend *mxl603_attach(struct dvb_frontend *fe, -+ struct i2c_adapter *i2c, u8 addr, -+ struct mxl603_config *cfg); -+ -+#endif /* __MXL603_H__ */ -diff --git a/drivers/amlogic/dvb_tv/nimdetect.c b/drivers/amlogic/dvb_tv/nimdetect.c -new file mode 100644 -index 0000000..e20e103 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/nimdetect.c -@@ -0,0 +1,596 @@ -+/* -+ * Wetek NIMs/DVB detection -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+ -+#ifndef CONFIG_ARM64 -+#include -+#else -+#include -+#endif -+#include -+#include -+#include "nimdetect.h" -+ -+#include "ascot3.h" -+#include "cxd2841er.h" -+#include "mxl603.h" -+#include "avl6211.h" -+#include "mn88436.h" -+ -+#ifdef CONFIG_ARM64 -+static struct reset_control *dvb_demux_reset_ctl; -+static struct reset_control *dvb_afifo_reset_ctl; -+static struct reset_control *dvb_ahbarb0_reset_ctl; -+static struct reset_control *dvb_uparsertop_reset_ctl; -+#define TOTAL_I2C 1 -+#define TOTAL_DEMODS 1 -+#else -+#define TOTAL_I2C 2 -+#define TOTAL_DEMODS 2 -+#endif -+#define TOTAL_AML_INPUTS 3 -+ -+ -+static struct wetek_nims weteknims; -+ -+static struct cxd2841er_config cxd2837cfg = { -+ .i2c_addr = 0x6C, -+ .if_agc = 0, -+ .ifagc_adc_range = 0x39, -+ .ts_error_polarity = 0, -+ .clock_polarity = 1, -+ .mxl603 = 0, -+ .xtal = SONY_XTAL_20500, -+}; -+struct ascot3_config ascot3cfg = { -+ .i2c_address = 0x60, -+}; -+static struct mxl603_config mxl603cfg = { -+ .xtal_freq_hz = MXL603_XTAL_24MHz, -+ .if_freq_hz = MXL603_IF_5MHz, -+ .agc_type = MXL603_AGC_SELF, -+ .xtal_cap = 16, -+ .gain_level = 11, -+ .if_out_gain_level = 11, -+ .agc_set_point = 66, -+ .agc_invert_pol = 0, -+ .invert_if = 1, -+ .loop_thru_enable = 0, -+ .clk_out_enable = 1, -+ .clk_out_div = 0, -+ .clk_out_ext = 0, -+ .xtal_sharing_mode = 0, -+ .single_supply_3_3V = 1, -+}; -+static struct mxl603_config mxl603cfg_atsc = { -+ .xtal_freq_hz = MXL603_XTAL_24MHz, -+ .if_freq_hz = MXL603_IF_5MHz, -+ .agc_type = MXL603_AGC_EXTERNAL, -+ .xtal_cap = 31, -+ .gain_level = 11, -+ .if_out_gain_level = 11, -+ .agc_set_point = 66, -+ .agc_invert_pol = 0, -+ .invert_if = 0, -+ .loop_thru_enable = 0, -+ .clk_out_enable = 1, -+ .clk_out_div = 0, -+ .clk_out_ext = 0, -+ .xtal_sharing_mode = 0, -+ .single_supply_3_3V = 1, -+}; -+static struct avl6211_config avl6211cfg[] = { -+ { -+#ifndef CONFIG_ARM64 -+ .tuner_address = 0xC2, -+#else -+ .tuner_address = 0xC4, -+#endif -+ .tuner_i2c_clock = 200, -+ .demod_address = 0x0C, -+ .mpeg_pol = 1, -+ .mpeg_mode = 0, -+ .mpeg_format = 0, -+ .demod_refclk = 9, -+ .mpeg_pin = 0, -+ .tuner_rfagc = 1, -+ .tuner_spectrum = 0, -+ .use_lnb_pin59 = 1, -+ .use_lnb_pin60 = 0, -+ .set_external_vol_gpio = set_external_vol_gpio, -+ }, -+ { -+ .tuner_address = 0xC2, -+ .tuner_i2c_clock = 200, -+ .demod_address = 0x0C, -+ .mpeg_pol = 1, -+ .mpeg_mode = 0, -+ .mpeg_format = 0, -+ .demod_refclk = 9, -+ .mpeg_pin = 0, -+ .tuner_rfagc = 1, -+ .tuner_spectrum = 0, -+ .use_lnb_pin59 = 1, -+ .use_lnb_pin60 = 0, -+ .set_external_vol_gpio = set_external_vol_gpio, -+ } -+}; -+#ifndef CONFIG_ARM64 -+extern struct list_head usb_bus_list; -+extern struct mutex usb_bus_list_lock; -+extern struct usb_device *usb_hub_find_child(struct usb_device *hdev, int port1); -+extern struct usb_device *usb_get_dev(struct usb_device *dev); -+extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, -+ __u8 requesttype, __u16 value, __u16 index, void *data, -+ __u16 size, int timeout); -+extern const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; -+extern int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force); -+ -+EXPORT_SYMBOL(usb_bus_list); -+EXPORT_SYMBOL(usb_bus_list_lock); -+EXPORT_SYMBOL(usb_hub_find_child); -+EXPORT_SYMBOL(usb_get_dev); -+EXPORT_SYMBOL(usb_control_msg); -+EXPORT_SYMBOL(__irq_set_affinity); -+#endif -+ -+ -+int kc_class_register(struct class *cls) -+{ -+ return class_register(cls); -+} -+EXPORT_SYMBOL(kc_class_register); -+void kc_class_unregister(struct class *cls) -+{ -+ class_unregister(cls); -+} -+EXPORT_SYMBOL(kc_class_unregister); -+const struct cpumask *aml_get_cpu_mask(unsigned int cpu) -+{ -+ const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; -+ p -= cpu / BITS_PER_LONG; -+ return to_cpumask(p); -+} -+EXPORT_SYMBOL(aml_get_cpu_mask); -+ -+void get_nims_infos(struct wetek_nims *p) -+{ -+ memcpy(p, &weteknims, sizeof(struct wetek_nims)); -+} -+EXPORT_SYMBOL(get_nims_infos); -+int set_external_vol_gpio(int *demod_id, int on) -+{ -+ if (on) { -+ if (*demod_id == 0 ) -+#ifdef CONFIG_ARM64 -+ gpio_direction_output(weteknims.power_ctrl, 1); -+#else -+ amlogic_gpio_direction_output(GPIOAO_8, 1, "nimdetect"); -+#endif -+#ifndef CONFIG_ARM64 -+ else if (*demod_id == 1) -+ amlogic_gpio_direction_output(GPIOAO_9, 1, "nimdetect"); -+#endif -+ } else if (!on) { -+ if (*demod_id == 0 ) -+#ifdef CONFIG_ARM64 -+ gpio_direction_output(weteknims.power_ctrl, 0); -+#else -+ amlogic_gpio_direction_output(GPIOAO_8, 0, "nimdetect"); -+#endif -+#ifndef CONFIG_ARM64 -+ else if (*demod_id == 1) -+ amlogic_gpio_direction_output(GPIOAO_9, 0, "nimdetect"); -+#endif -+ } -+ return 0; -+} -+#ifndef CONFIG_ARM64 -+static void nim_dvb_pinctrl_put(struct wetek_nims *p) -+{ -+ if (p->ts[0].pinctrl) { -+ devm_pinctrl_put(p->ts[0].pinctrl); -+ p->ts[0].pinctrl = NULL; -+ } -+} -+static struct pinctrl * __must_check nim_dvb_pinctrl_get_select( -+ struct device *dev, struct wetek_nims *p, const char *name) -+{ -+ /*all dvb pinctrls share the ts[0]'s pinctrl.*/ -+ struct pinctrl *pctl = p->ts[0].pinctrl; -+ -+ struct pinctrl_state *s; -+ int ret; -+ -+ if (!pctl) { -+ pctl = devm_pinctrl_get(dev); -+ if (IS_ERR(pctl)) -+ return pctl; -+ -+ p->ts[0].pinctrl = pctl; -+ } -+ -+ s = pinctrl_lookup_state(pctl, name); -+ if (IS_ERR(s)) { -+ devm_pinctrl_put(pctl); -+ return ERR_CAST(s); -+ } -+ -+ ret = pinctrl_select_state(pctl, s); -+ if (ret < 0) { -+ devm_pinctrl_put(pctl); -+ return ERR_PTR(ret); -+ } -+ -+ return pctl; -+} -+#endif -+ -+void reset_demod(void) -+{ -+#ifdef CONFIG_ARM64 -+ gpio_direction_output(weteknims.fec_reset, 0); -+ msleep(600); -+ gpio_direction_output(weteknims.fec_reset, 1); -+ msleep(200); -+#else -+ amlogic_gpio_direction_output(GPIOD_8, 0, "nimdetect"); -+ msleep(600); -+ amlogic_gpio_direction_output(GPIOD_8, 1, "nimdetect"); -+ msleep(200); -+#endif -+ -+} -+static int nim_dvb_probe(struct platform_device *pdev) -+{ -+ int i; -+ int ret = 0; -+#ifdef CONFIG_ARM64 -+ struct gpio_desc *desc; -+#endif -+ weteknims.pdev = pdev; -+ weteknims.dev = &pdev->dev; -+ -+#ifdef CONFIG_ARM64 -+ for (i = 0; i < TOTAL_I2C; i++) { -+ -+ weteknims.i2c[i] = i2c_get_adapter(1); //tuner1 on I2C_D -+ -+ if (weteknims.i2c[i] != NULL) -+ dev_info(&pdev->dev, "Found Wetek i2c-1 adapter ...\n"); -+ else { -+ dev_info(&pdev->dev, "Failed to acquire Wetek i2c-1 adapter ...\n"); -+ return 0; -+ } -+ } -+#else -+ /* tuner0 on I2C_A -+ tuner1 on I2C_B -+ */ -+ for (i = 0; i < TOTAL_I2C; i++) { -+ weteknims.i2c[i] = i2c_get_adapter(i + 1); -+ if (weteknims.i2c[i] != NULL) -+ dev_info(&pdev->dev, "Found Wetek i2c-%d adapter ...\n", i + 1); -+ else { -+ dev_info(&pdev->dev, "Failed to acquire Wetek i2c-%d adapter ...\n", i + 1); -+ return 0; -+ } -+ } -+#endif -+ if (pdev->dev.of_node) { -+ for (i = 0; i < TOTAL_AML_INPUTS; i++) { -+ char buf[32]; -+ const char *str; -+ -+ snprintf(buf, sizeof(buf), "ts%d", i); -+ ret = of_property_read_string(pdev->dev.of_node, buf, &str); -+ if (!ret) { -+ if (!strcmp(str, "parallel")) { -+ dev_info(&pdev->dev, "%s: parallel\n", buf); -+ snprintf(buf, sizeof(buf), "p_ts%d", i); -+ weteknims.ts[i].mode = 1; -+#ifdef CONFIG_ARM64 -+ weteknims.ts[i].pinctrl = devm_pinctrl_get_select(&pdev->dev, buf); -+#else -+ weteknims.ts[i].pinctrl = nim_dvb_pinctrl_get_select(&pdev->dev, &weteknims, buf); -+#endif -+ } -+ } -+ } -+ } -+#ifdef CONFIG_ARM64 -+ -+ dvb_demux_reset_ctl = devm_reset_control_get(&pdev->dev, "demux"); -+ dev_info(&pdev->dev, "dmx rst ctl = %p\n", dvb_demux_reset_ctl); -+ reset_control_deassert(dvb_demux_reset_ctl); -+ -+ dvb_afifo_reset_ctl = devm_reset_control_get(&pdev->dev, "asyncfifo"); -+ dev_info(&pdev->dev, "asyncfifo rst ctl = %p\n", dvb_afifo_reset_ctl); -+ reset_control_deassert(dvb_afifo_reset_ctl); -+ -+ dvb_ahbarb0_reset_ctl = devm_reset_control_get(&pdev->dev, "ahbarb0"); -+ dev_info(&pdev->dev, "ahbarb0 rst ctl = %p\n", dvb_ahbarb0_reset_ctl); -+ reset_control_deassert(dvb_ahbarb0_reset_ctl); -+ -+ dvb_uparsertop_reset_ctl = devm_reset_control_get(&pdev->dev, "uparsertop"); -+ dev_info(&pdev->dev, "uparsertop rst ctl = %p\n", dvb_uparsertop_reset_ctl); -+ reset_control_deassert(dvb_uparsertop_reset_ctl); -+ -+ desc = of_get_named_gpiod_flags(pdev->dev.of_node, "fec_reset_gpio-gpios", 0, NULL); -+ weteknims.fec_reset = desc_to_gpio(desc); -+ -+ desc = of_get_named_gpiod_flags(pdev->dev.of_node, "power_ctrl_gpio-gpios", 0, NULL); -+ weteknims.power_ctrl = desc_to_gpio(desc); -+ /* FEC_RESET GPIOY 13*/ -+ gpio_request(weteknims.fec_reset, "nimdetect"); -+ -+ /* INPUT1 POWER CTRL GPIOY 15*/ -+ gpio_request(weteknims.power_ctrl, "nimdetect"); -+ -+ -+ /* RESET DEMOD(s) */ -+ reset_demod(); -+#else -+ /* FEC_RESET */ -+ amlogic_gpio_request(GPIOD_8, "nimdetect"); -+ -+ /* INPUT1 POWER CTRL */ -+ amlogic_gpio_request(GPIOAO_8, "nimdetect"); -+ -+ /* INPUT2 POWER CTRL */ -+ amlogic_gpio_request(GPIOAO_9, "nimdetect"); -+ -+ amlogic_gpio_direction_output(GPIOAO_8, 0, "nimdetect"); //SWITCH OFF INPUT1 POWER -+ amlogic_gpio_direction_output(GPIOAO_9, 0, "nimdetect"); //SWITCH OFF INPUT2 POWER -+ -+ /* RESET DEMOD(s) */ -+ reset_demod(); -+#endif -+ -+ dev_info(&pdev->dev, "Wetek NIM(s) detection in progress ...\n"); -+ -+ for (i = 0; i < TOTAL_DEMODS; i++) { -+ -+ dev_info(&pdev->dev, "Checking for Sony CXD2837 DVB-C/T/T2 demod ...\n"); -+ -+ weteknims.fe[i] = cxd2841er_attach_t_c(&cxd2837cfg, weteknims.i2c[i]); -+ -+ if (weteknims.fe[i] != NULL) { -+ if (mxl603_attach(weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg) == NULL) { -+ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); -+ cxd2837cfg.if_agc = 1; -+ cxd2837cfg.ifagc_adc_range = 0x50; -+ if (ascot3_attach(weteknims.fe[i], &ascot3cfg, weteknims.i2c[i]) == NULL) { -+ dev_info(&pdev->dev, "Failed to find Sony ASCOT3 tuner!\n"); -+ dvb_frontend_detach(weteknims.fe[i]); -+ goto panasonic; -+ } -+ } else -+ cxd2837cfg.mxl603 = 1; -+ -+ weteknims.total_nims++; -+ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); -+ return 0; -+ } -+panasonic: -+ reset_demod(); -+ dev_info(&pdev->dev, "Checking for Panasonic MN88436 ATSC demod ...\n"); -+ -+ weteknims.fe[i] = mn88436_attach(weteknims.i2c[i], 0); -+ -+ if (weteknims.fe[i] != NULL) { -+ -+ if (mxl603_attach(weteknims.fe[i], weteknims.i2c[i], 0x60, &mxl603cfg_atsc) == NULL) { -+ dev_info(&pdev->dev, "Failed to find MxL603 tuner!\n"); -+ dev_info(&pdev->dev, "Detaching Panasonic MN88436 ATSC frontend!\n"); -+ dvb_frontend_detach(weteknims.fe[i]); -+ goto avl6211; -+ } -+ -+ weteknims.total_nims++; -+ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); -+ return 0; -+ } -+avl6211: -+ reset_demod(); -+ dev_info(&pdev->dev, "Checking for AVL6211 DVB-S/S2 demod ...\n"); -+ weteknims.fe[i] = avl6211_attach( weteknims.i2c[i], &avl6211cfg[i], i); -+ if (i == 0 && weteknims.fe[i] == NULL) { -+ dev_info(&pdev->dev, "No available NIM(s) found ...\n"); -+ return 0; -+ } -+ if (weteknims.fe[i] != NULL) -+ weteknims.total_nims++; -+ } -+ -+ if (weteknims.total_nims > 0) -+ dev_info(&pdev->dev, "Total Wetek NIM(s) found: %d\n", weteknims.total_nims); -+ -+ return 0; -+} -+static int nim_dvb_remove(struct platform_device *pdev) -+{ -+ int i; -+ -+ for (i = 0; i < TOTAL_DEMODS; i++) { -+ if (weteknims.fe[i] != NULL) -+ dvb_frontend_detach(weteknims.fe[i]); -+ } -+ -+ for (i = 0; i < TOTAL_I2C; i++) { -+ if (weteknims.i2c[i] != NULL) -+ i2c_put_adapter(weteknims.i2c[i]); -+ } -+#ifdef CONFIG_ARM64 -+ gpio_free(weteknims.fec_reset); -+ gpio_free(weteknims.power_ctrl); -+#else -+ amlogic_gpio_free(GPIOD_8, "nimdetect"); -+ amlogic_gpio_free(GPIOAO_8, "nimdetect"); -+ amlogic_gpio_free(GPIOAO_9, "nimdetect"); -+#endif -+#ifdef CONFIG_ARM64 -+ devm_pinctrl_put(weteknims.ts[0].pinctrl); -+ reset_control_assert(dvb_uparsertop_reset_ctl); -+ reset_control_assert(dvb_ahbarb0_reset_ctl); -+ reset_control_assert(dvb_afifo_reset_ctl); -+ reset_control_assert(dvb_demux_reset_ctl); -+#else -+ nim_dvb_pinctrl_put(&weteknims); -+#endif -+ return 0; -+} -+#ifndef CONFIG_ARM64 -+static int wetekcard_probe(struct platform_device *pdev) -+{ -+ if (pdev->dev.of_node) -+ weteknims.card_pinctrl = devm_pinctrl_get_select_default(&pdev->dev); -+ -+ return 0; -+} -+static int wetekcard_remove(struct platform_device *pdev) -+{ -+ if(weteknims.card_pinctrl) -+ devm_pinctrl_put(weteknims.card_pinctrl); -+ return 0; -+} -+#endif -+static const struct of_device_id nim_dvb_dt_match[] = { -+ { -+ .compatible = "amlogic,dvb", -+ }, -+ {}, -+}; -+static struct platform_driver nim_dvb_detection = { -+ .probe = nim_dvb_probe, -+ .remove = nim_dvb_remove, -+ .driver = { -+ .name = "wetek-dvb", -+ .owner = THIS_MODULE, -+ .of_match_table = nim_dvb_dt_match, -+ } -+}; -+#ifndef CONFIG_ARM64 -+static const struct of_device_id wetekcard_dt_match[]={ -+ { .compatible = "amlogic,smartcard", -+ }, -+ {}, -+}; -+ -+static struct platform_driver wetekcard_driver = { -+ .probe = wetekcard_probe, -+ .remove = wetekcard_remove, -+ .driver = { -+ .name = "wetek-card", -+ .owner = THIS_MODULE, -+ .of_match_table = wetekcard_dt_match, -+ } -+}; -+#endif -+#ifdef CONFIG_ARM64 -+#include -+#include -+#include -+#include -+#include -+static phys_addr_t wetek_rmem_paddr; -+static void __iomem *wetek_rmem_vaddr = NULL; -+static u32 wetek_rmem_size; -+EXPORT_SYMBOL(wetek_rmem_size); -+EXPORT_SYMBOL(wetek_rmem_vaddr); -+EXPORT_SYMBOL(wetek_rmem_paddr); -+int rmem_init(struct device *dev) -+{ -+ return of_reserved_mem_device_init(dev); -+} -+EXPORT_SYMBOL(rmem_init); -+static int rmem_wetek_device_init(struct reserved_mem *rmem, struct device *dev) -+{ -+ -+ if ((wetek_rmem_paddr > 0) && (wetek_rmem_size > 0)) { -+ wetek_rmem_vaddr = ioremap_wc(wetek_rmem_paddr, wetek_rmem_size); -+ if (!wetek_rmem_vaddr) -+ printk(KERN_INFO "wetek_memory ioremap error\n"); -+ } -+ return 0; -+} -+ -+static const struct reserved_mem_ops rmem_wetek_ops = { -+ .device_init = rmem_wetek_device_init, -+}; -+ -+static int __init rmem_wetek_setup(struct reserved_mem *rmem) -+{ -+ phys_addr_t align = PAGE_SIZE; -+ phys_addr_t mask = align - 1; -+ if ((rmem->base & mask) || (rmem->size & mask)) { -+ printk(KERN_INFO "Reserved memory: incorrect alignment of region\n"); -+ return -EINVAL; -+ } -+ wetek_rmem_paddr = rmem->base; -+ wetek_rmem_size = rmem->size; -+ rmem->ops = &rmem_wetek_ops; -+ printk(KERN_INFO "Reserved memory wetek: created at 0x%p, size %ld MiB\n", -+ (void *)wetek_rmem_paddr, (unsigned long)wetek_rmem_size / ( 1024 * 1024)); -+ return 0; -+} -+RESERVEDMEM_OF_DECLARE(wetekplay, "amlogic, wetek-memory", rmem_wetek_setup); -+ -+ -+ -+#endif -+int AddWetekFB(struct platform_driver *drv) -+{ -+ return platform_driver_register(drv); -+} -+EXPORT_SYMBOL(AddWetekFB); -+void RemoveWetekFB(struct platform_driver *drv) -+{ -+ platform_driver_unregister(drv); -+} -+EXPORT_SYMBOL(RemoveWetekFB); -+ -+int __init nim_dvb_init(void) -+{ -+ int ret; -+ -+ memset(&weteknims, 0, sizeof(struct wetek_nims)); -+ -+ ret = platform_driver_register(&nim_dvb_detection); -+#ifndef CONFIG_ARM64 -+ if (!ret) -+ return platform_driver_register(&wetekcard_driver); -+#endif -+ return ret; -+} -+void __exit nim_dvb_exit(void) -+{ -+ platform_driver_unregister(&nim_dvb_detection); -+#ifndef CONFIG_ARM64 -+ platform_driver_unregister(&wetekcard_driver); -+#endif -+} -+ -+module_init(nim_dvb_init); -+module_exit(nim_dvb_exit); -+ -+MODULE_DESCRIPTION("Wetek NIMs DVB detection"); -+MODULE_AUTHOR("Sasa Savic "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/nimdetect.h b/drivers/amlogic/dvb_tv/nimdetect.h -new file mode 100644 -index 0000000..ea38c82 ---- /dev/null -+++ b/drivers/amlogic/dvb_tv/nimdetect.h -@@ -0,0 +1,54 @@ -+/* -+ * Wetek NIM tuner(s) detection -+ * -+ * Copyright (C) 2014 Sasa Savic -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#ifndef __NIMDETECT_H -+#define __NIMDETECT_H -+ -+#include -+#include -+#include -+#include -+#include -+#include "dvb_frontend.h" -+ -+struct ts_input { -+ int mode; -+ struct pinctrl *pinctrl; -+ int control; -+}; -+ -+struct wetek_nims { -+ struct dvb_frontend *fe[2]; -+ struct i2c_adapter *i2c[2]; -+ struct ts_input ts[3]; -+ struct device *dev; -+ struct platform_device *pdev; -+ struct pinctrl *card_pinctrl; -+ u32 total_nims; -+#ifdef CONFIG_ARM64 -+ int fec_reset; -+ int power_ctrl; -+#endif -+}; -+ -+void get_nims_infos(struct wetek_nims *p); -+int set_external_vol_gpio(int *demod_id, int on); -+ -+#endif /* __NIMDETECT_H */ -diff --git a/drivers/amlogic/dvb_tv/smartcard/Kconfig b/drivers/amlogic/dvb_tv/smartcard/Kconfig -deleted file mode 100644 -index 3cb4880..0000000 ---- a/drivers/amlogic/dvb_tv/smartcard/Kconfig -+++ /dev/null -@@ -1,7 +0,0 @@ --# --#Smart card driver configuration --# -- --config AML_SMARTCARD -- bool "Amlogic Smartcard driver" -- default n -diff --git a/drivers/amlogic/dvb_tv/smartcard/Makefile b/drivers/amlogic/dvb_tv/smartcard/Makefile -deleted file mode 100644 -index 8b775fb..0000000 ---- a/drivers/amlogic/dvb_tv/smartcard/Makefile -+++ /dev/null -@@ -1,8 +0,0 @@ --# --#Makefile for the Smart card driver. --# -- --obj-y += amsmc.o --#obj-$(CONFIG_AML_SMARTCARD) += amsmc.o --amsmc-objs = smartcard.o --ccflags-y += -I$(srctree)/drivers/amlogic/dvb_tv -diff --git a/drivers/amlogic/dvb_tv/smartcard/Readme.txt b/drivers/amlogic/dvb_tv/smartcard/Readme.txt -deleted file mode 100644 -index 4c7d8ff..0000000 ---- a/drivers/amlogic/dvb_tv/smartcard/Readme.txt -+++ /dev/null -@@ -1,57 +0,0 @@ --Smartcard Support for S905-- -- -- ----------------------To configure smartcard driver on your platform, -- you must following two steps below 1) -- Add configurations to your kernel config file using menuconfig, or you can add to.config.CONFIG_AML_SMARTCARD = y 2) Add dts configuration Samples below: -- -- smartcard -- { -- compatible = "amlogic,smartcard"; -- irq_trigger_type = "GPIO_IRQ_LOW"; -- -- reset_pin - gpios = <&gpio GPIOX_11 GPIO_ACTIVE_HIGH >; //Reset pin -- detect_pin - gpios = <&gpio GPIOX_20 GPIO_ACTIVE_HIGH >; //Detect pin -- enable_5v3v_pin - gpios = <&gpio GPIOX_10 GPIO_ACTIVE_HIGH >; //5V3V pin, can be ignored -- -- interrupts = <0 69 4 >; //smc irq -- -- smc0_clock_source = <0 >; //Smc clock source, if change this, you must adjust clk and divider in smartcard.c -- smc0_irq = <69 >; //smc irq -- smc0_det_invert = <0 >; //0: high voltage on detect pin indicates card in. -- smc0_5v3v_level = <0 >; -- smc_need_enable_pin = "no"; //Ordinarily, smartcard controller needs a enable pin. -- if board -- controls smartcard directly, then we don 't need it. -- reset_level = <0>; //0: pull low reset pin to reset card -- -- smc0_clk_pinmux_reg = <0x30>; -- smc0_clk_pinmux_bit = <0x80>; -- smc0_clk_oen_reg = <0x200f>; -- smc0_clk_out_reg = <0x2010>; -- smc0_clk_bit = <0x2000>; -- smc0_clk_oebit = <0x2000000>; -- smc0_clk_oubit = <0x1000000>; -- -- pinctrl-names = "default"; -- pinctrl-0 = <&smc_pins>; -- resets = <&clock GCLK_IDX_SMART_CARD_MPEG_DOMAIN>; -- reset-names = "smartcard"; -- -- status = "okay"; --}; -- --&pinmux { --smc_pins:smc_pins { //Set gpio to 7816-clk 7816-data mode. -- amlogic,setmask = <4 0x000000c0>; //Please refer to core-pin mux document -- amlogic,clrmask = <3 0x60000280>; -- amlogic,pins = "GPIOX_8","GPIOX_9"; -- }; --} -- -- --Daniel.yan --yan.yan@amlogic.com -- -- -- -- -- -diff --git a/drivers/amlogic/dvb_tv/smartcard/smartcard.c b/drivers/amlogic/dvb_tv/smartcard/smartcard.c -deleted file mode 100644 -index 8c7ba22..0000000 ---- a/drivers/amlogic/dvb_tv/smartcard/smartcard.c -+++ /dev/null -@@ -1,2660 +0,0 @@ --/* -- *AMLOGIC Smart card driver. -- * -- *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 named License, -- *or any later version. -- * -- *This program 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. -- * -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include "smartcard.h" --#include "linux/amlogic/cpu_version.h" --#include "aml_dvb_reg.h" --#include --#ifndef MESON_CPU_TYPE --#define MESON_CPU_TYPE 0x50 --#endif --#ifndef MESON_CPU_TYPE_MESON6 --#define MESON_CPU_TYPE_MESON6 0x60 --#endif --#ifdef CONFIG_ARCH_ARC700 --#include --#else --#include "c_stb_define.h" --#include "c_stb_regs_define.h" --#endif --#include --#include --/*#include < mach/gpio.h > */ --#include --#include --#include --#define OWNER_NAME "smc" --#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 --#include --#include --#endif -- --#include --#include --#include "amsmc.h" --#include --#include --#include -- --#include "smc_reg.h" -- --#define DRIVER_NAME "amsmc" --#define MODULE_NAME "amsmc" --#define DEVICE_NAME "amsmc" --#define CLASS_NAME "amsmc-class" -- --#define INPUT 0 --#define OUTPUT 1 --#define OUTLEVEL_LOW 0 --#define OUTLEVEL_HIGH 1 --#define PULLLOW 1 --#define PULLHIGH 0 -- --/*#define FILE_DEBUG*/ --#define MEM_DEBUG --#define SMC_GPIO_NUM_PROP(node, prop_name, str, gpio_pin) { \ -- if (!of_property_read_string(node, prop_name, &str)) { \ -- gpio_pin = \ -- desc_to_gpio(of_get_named_gpiod_flags(node, \ -- prop_name, 0, NULL)); \ -- } \ --} -- --#ifdef FILE_DEBUG --#define DBUF_SIZE (512*2) --#define pr_dbg(fmt, args...) \ -- do { if (smc_debug > 0) { \ -- dcnt = sprintf(dbuf, fmt, ## args); \ -- debug_write(dbuf, dcnt); \ -- } \ -- } while (0) --#define pr_dbg printk --#define Fpr(a...) \ -- do { \ -- if (smc_debug > 1) { \ -- dcnt = sprintf(dbuf, a); \ -- debug_write(dbuf, dcnt); \ -- } \ -- } while (0) --#define Ipr Fpr -- --#elif defined(MEM_DEBUG) --#define DBUF_SIZE (1024*1024*1) --#define pr_dbg(fmt, args...) \ -- do {\ -- if (smc_debug > 0) { \ -- if (dwrite > (DBUF_SIZE - 512)) \ -- sprintf(dbuf+dwrite, "lost\n"); \ -- else { \ -- dcnt = sprintf(dbuf+dwrite, fmt, ## args); \ -- dwrite += dcnt; \ -- } \ -- } \ -- } while (0) --#define Fpr(_a...) \ -- do { \ -- if (smc_debug > 1) { \ -- if (dwrite > (DBUF_SIZE - 512)) \ -- sprintf(dbuf+dwrite, "lost\n"); \ -- else { \ -- dcnt = print_time(local_clock(), dbuf+dwrite); \ -- dwrite += dcnt; \ -- dcnt = sprintf(dbuf+dwrite, _a); \ -- dwrite += dcnt; \ -- } \ -- } \ -- } while (0) --#define Ipr Fpr -- --#else --#if 1 --#define pr_dbg(fmt, args...) \ --do {\ -- if (smc_debug > 0) \ -- pr_err("Smartcard: " fmt, ## args); \ --} \ --while (0) --#define Fpr(a...) do { if (smc_debug > 1) printk(a); } while (0) --#define Ipr Fpr --#else --#define pr_dbg(fmt, args...) --#define Fpr(a...) --#endif --#endif -- --#define pr_error(fmt, args...) pr_err("Smartcard: " fmt, ## args) --#define pr_inf(fmt, args...) pr_err(fmt, ## args) --#define DEBUG_FILE_NAME "/storage/external_storage/debug.smc" --static struct file *debug_filp; --static loff_t debug_file_pos; --static int smc_debug; --static char *dbuf; --static int dread, dwrite; --static int dcnt; --static struct reset_control *aml_smartcard_reset_ctrl; --#define REG_READ 0 --#define REG_WRITE 1 --void operate_reg(unsigned reg, int read_write, unsigned *value) --{ -- void __iomem *vaddr; -- reg = round_down(reg, 0x3); -- vaddr = ioremap(reg, 0x4); -- pr_dbg("smc ioremap %x %p\n", reg, vaddr); -- if (read_write == REG_READ) -- *value = readl(vaddr); -- else if (read_write == REG_WRITE) -- writel(*value, vaddr); -- iounmap(vaddr); --} -- --void debug_write(const char __user *buf, size_t count) --{ -- mm_segment_t old_fs; -- -- if (!debug_filp) -- return; -- -- old_fs = get_fs(); -- set_fs(KERNEL_DS); -- -- if (count != vfs_write(debug_filp, buf, count, &debug_file_pos)) -- pr_dbg("Failed to write debug file\n"); -- -- set_fs(old_fs); -- -- return; --} --static void open_debug(void) --{ -- debug_filp = filp_open(DEBUG_FILE_NAME, O_WRONLY, 0); -- if (IS_ERR(debug_filp)) { -- pr_dbg("smartcard: open debug file failed\n"); -- debug_filp = NULL; -- } else { -- pr_dbg("smc: debug file[%s] open.\n", DEBUG_FILE_NAME); -- } --} --static void close_debug(void) --{ -- if (debug_filp) { -- filp_close(debug_filp, current->files); -- debug_filp = NULL; -- debug_file_pos = 0; -- } --} -- --static size_t print_time(u64 ts, char *buf) --{ -- unsigned long rem_nsec; -- -- rem_nsec = do_div(ts, 1000000000); -- -- if (!buf) -- return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts); -- -- return sprintf(buf, "[%5lu.%06lu] ", -- (unsigned long)ts, rem_nsec / 1000); --} -- --#ifdef CONFIG_OF --static const struct of_device_id smc_dt_match[] = { -- { .compatible = "amlogic,smartcard", -- }, -- {}, --}; --#else --#define smc_dt_match NULL --#endif -- -- --MODULE_PARM_DESC(smc0_irq, "\n\t\t Irq number of smartcard0"); --static int smc0_irq = -1; --module_param(smc0_irq, int, S_IRUGO); -- --MODULE_PARM_DESC(smc0_reset, "\n\t\t Reset GPIO pin of smartcard0"); --static int smc0_reset = -1; --module_param(smc0_reset, int, S_IRUGO); -- --MODULE_PARM_DESC(atr_delay, "\n\t\t atr delay"); --static int atr_delay; --module_param(atr_delay, int, 0644); -- --MODULE_PARM_DESC(atr_holdoff, "\n\t\t atr_holdoff"); --static int atr_holdoff = 1; --module_param(atr_holdoff, int, 0644); -- --MODULE_PARM_DESC(cwt_det_en, "\n\t\t cwt_det_en"); --static int cwt_det_en; --module_param(cwt_det_en, int, 0644); --MODULE_PARM_DESC(btw_det_en, "\n\t\t btw_det_en"); --static int btw_det_en; --module_param(btw_det_en, int, 0644); --MODULE_PARM_DESC(etu_msr_en, "\n\t\t etu_msr_en"); --static int etu_msr_en; --module_param(etu_msr_en, int, 0644); --MODULE_PARM_DESC(clock_source, "\n\t\t clock_source"); --static int clock_source; --module_param(clock_source, int, 0644); -- --#define NO_HOT_RESET --/*#define DISABLE_RECV_INT*/ --/*#define ATR_FROM_INT*/ --#define SW_INVERT --/*#define SMC_FIQ*/ --/*#define ATR_OUT_READ*/ --#define KEEP_PARAM_AFTER_CLOSE -- --#define CONFIG_AML_SMARTCARD_GPIO_FOR_DET --#define CONFIG_AM_SMARTCARD_GPIO_FOR_RST -- --#ifdef CONFIG_AML_SMARTCARD_GPIO_FOR_DET --#define DET_FROM_PIO --#endif --#ifdef CONFIG_AM_SMARTCARD_GPIO_FOR_RST --#define RST_FROM_PIO --#endif -- --#ifndef CONFIG_MESON_ARM_GIC_FIQ --#undef SMC_FIQ --#endif -- --#ifdef SMC_FIQ --#include < plat/fiq_bridge.h > --#ifndef ATR_FROM_INT --#define ATR_FROM_INT --#endif --#endif -- --#define RECV_BUF_SIZE 1024 --#define SEND_BUF_SIZE 1024 -- --#define RESET_ENABLE (smc->reset_level) /*reset*/ --#define RESET_DISABLE (!smc->reset_level) /*dis-reset*/ -- --enum sc_type { -- SC_DIRECT, -- SC_INVERSE, --}; -- --struct smc_dev { -- int id; -- struct device *dev; -- struct platform_device *pdev; -- int init; -- int used; -- int cardin; -- int active; -- struct mutex lock; -- spinlock_t slock; -- wait_queue_head_t rd_wq; -- wait_queue_head_t wr_wq; -- int recv_start; -- int recv_count; -- int send_start; -- int send_count; -- char recv_buf[RECV_BUF_SIZE]; -- char send_buf[SEND_BUF_SIZE]; -- struct am_smc_param param; -- struct am_smc_atr atr; -- -- struct gpio_desc *enable_pin; --#define SMC_ENABLE_PIN_NAME "smc:ENABLE" -- int enable_level; -- -- struct gpio_desc *enable_5v3v_pin; --#define SMC_ENABLE_5V3V_PIN_NAME "smc:5V3V" -- int enable_5v3v_level; -- int (*reset)(void*, int); -- u32 irq_num; -- int reset_level; -- -- u32 pin_clk_pinmux_reg; -- u32 pin_clk_pinmux_bit; -- struct gpio_desc *pin_clk_pin; --#define SMC_CLK_PIN_NAME "smc:PINCLK" -- u32 pin_clk_oen_reg; -- u32 pin_clk_out_reg; -- u32 pin_clk_oebit; -- u32 pin_clk_oubit; -- u32 use_enable_pin; -- --#ifdef SW_INVERT -- int atr_mode; -- enum sc_type sc_type; --#endif -- -- int recv_end; -- int send_end; --#ifdef SMC_FIQ -- bridge_item_t smc_fiq_bridge; --#endif -- --#ifdef DET_FROM_PIO -- struct gpio_desc *detect_pin; --#define SMC_DETECT_PIN_NAME "smc:DETECT" --#endif --#ifdef RST_FROM_PIO -- struct gpio_desc *reset_pin; --#define SMC_RESET_PIN_NAME "smc:RESET" --#endif -- -- int detect_invert; -- -- struct pinctrl *pinctrl; -- -- struct tasklet_struct tasklet; --}; -- --#define SMC_DEV_NAME "smc" --#define SMC_CLASS_NAME "smc-class" --#define SMC_DEV_COUNT 1 -- --#define SMC_READ_REG(a) READ_MPEG_REG(SMARTCARD_##a) --#define SMC_WRITE_REG(a, b) WRITE_MPEG_REG(SMARTCARD_##a, b) -- --static struct mutex smc_lock; --static int smc_major; --static struct smc_dev smc_dev[SMC_DEV_COUNT]; --static int ENA_GPIO_PULL = 1; -- --#ifdef SW_INVERT --static const unsigned char inv_table[256] = { -- 0xFF, 0x7F, 0xBF, 0x3F, 0xDF, 0x5F, 0x9F, 0x1F, -- 0xEF, 0x6F, 0xAF, 0x2F, 0xCF, 0x4F, 0x8F, 0x0F, -- 0xF7, 0x77, 0xB7, 0x37, 0xD7, 0x57, 0x97, 0x17, -- 0xE7, 0x67, 0xA7, 0x27, 0xC7, 0x47, 0x87, 0x07, -- 0xFB, 0x7B, 0xBB, 0x3B, 0xDB, 0x5B, 0x9B, 0x1B, -- 0xEB, 0x6B, 0xAB, 0x2B, 0xCB, 0x4B, 0x8B, 0x0B, -- 0xF3, 0x73, 0xB3, 0x33, 0xD3, 0x53, 0x93, 0x13, -- 0xE3, 0x63, 0xA3, 0x23, 0xC3, 0x43, 0x83, 0x03, -- 0xFD, 0x7D, 0xBD, 0x3D, 0xDD, 0x5D, 0x9D, 0x1D, -- 0xED, 0x6D, 0xAD, 0x2D, 0xCD, 0x4D, 0x8D, 0x0D, -- 0xF5, 0x75, 0xB5, 0x35, 0xD5, 0x55, 0x95, 0x15, -- 0xE5, 0x65, 0xA5, 0x25, 0xC5, 0x45, 0x85, 0x05, -- 0xF9, 0x79, 0xB9, 0x39, 0xD9, 0x59, 0x99, 0x19, -- 0xE9, 0x69, 0xA9, 0x29, 0xC9, 0x49, 0x89, 0x09, -- 0xF1, 0x71, 0xB1, 0x31, 0xD1, 0x51, 0x91, 0x11, -- 0xE1, 0x61, 0xA1, 0x21, 0xC1, 0x41, 0x81, 0x01, -- 0xFE, 0x7E, 0xBE, 0x3E, 0xDE, 0x5E, 0x9E, 0x1E, -- 0xEE, 0x6E, 0xAE, 0x2E, 0xCE, 0x4E, 0x8E, 0x0E, -- 0xF6, 0x76, 0xB6, 0x36, 0xD6, 0x56, 0x96, 0x16, -- 0xE6, 0x66, 0xA6, 0x26, 0xC6, 0x46, 0x86, 0x06, -- 0xFA, 0x7A, 0xBA, 0x3A, 0xDA, 0x5A, 0x9A, 0x1A, -- 0xEA, 0x6A, 0xAA, 0x2A, 0xCA, 0x4A, 0x8A, 0x0A, -- 0xF2, 0x72, 0xB2, 0x32, 0xD2, 0x52, 0x92, 0x12, -- 0xE2, 0x62, 0xA2, 0x22, 0xC2, 0x42, 0x82, 0x02, -- 0xFC, 0x7C, 0xBC, 0x3C, 0xDC, 0x5C, 0x9C, 0x1C, -- 0xEC, 0x6C, 0xAC, 0x2C, 0xCC, 0x4C, 0x8C, 0x0C, -- 0xF4, 0x74, 0xB4, 0x34, 0xD4, 0x54, 0x94, 0x14, -- 0xE4, 0x64, 0xA4, 0x24, 0xC4, 0x44, 0x84, 0x04, -- 0xF8, 0x78, 0xB8, 0x38, 0xD8, 0x58, 0x98, 0x18, -- 0xE8, 0x68, 0xA8, 0x28, 0xC8, 0x48, 0x88, 0x08, -- 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, -- 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00 --}; --#endif /*SW_INVERT*/ -- --#define dump(b, l) do { \ -- int i; \ -- pr_dbg("dump: "); \ -- for (i = 0; i < (l); i++) \ -- pr_dbg("%02x ", *(((unsigned char *)(b))+i)); \ -- pr_dbg("\n"); \ --} while (0) -- --static int _gpio_out(struct gpio_desc *gpio, int val, const char *owner); --static int smc_default_init(struct smc_dev *smc); --static int smc_hw_set_param(struct smc_dev *smc); --static int smc_hw_reset(struct smc_dev *smc); --static int smc_hw_active(struct smc_dev *smc); --static int smc_hw_deactive(struct smc_dev *smc); --static int smc_hw_get_status(struct smc_dev *smc, int *sret); -- --static ssize_t show_gpio_pull(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- if (ENA_GPIO_PULL > 0) -- return sprintf(buf, "%s\n", "enable GPIO pull low"); -- else -- return sprintf(buf, "%s\n", "disable GPIO pull low"); --} -- --static ssize_t set_gpio_pull(struct class *class, -- struct class_attribute *attr, -- const char *buf, -- size_t count) --{ -- int dbg; -- ssize_t r; -- -- r = sscanf(buf, "%d", &dbg); -- if (r != 1) -- return -EINVAL; -- -- ENA_GPIO_PULL = dbg; -- return count; --} -- --static ssize_t show_5v3v(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- struct smc_dev *smc = NULL; -- int enable_5v3v = 0; -- -- mutex_lock(&smc_lock); -- smc = &smc_dev[0]; -- enable_5v3v = smc->enable_5v3v_level; -- mutex_unlock(&smc_lock); -- -- return sprintf(buf, "5v3v_pin level = %d\n", enable_5v3v); --} -- --static ssize_t store_5v3v(struct class *class, -- struct class_attribute *attr, -- const char *buf, -- size_t count) --{ -- unsigned int enable_5v3v = 0; -- ssize_t r; -- struct smc_dev *smc = NULL; -- -- r = sscanf(buf, "%d", &enable_5v3v); -- if (r != 1) -- return -EINVAL; -- -- mutex_lock(&smc_lock); -- smc = &smc_dev[0]; -- smc->enable_5v3v_level = enable_5v3v; -- -- if (smc->enable_5v3v_pin != NULL) { -- _gpio_out(smc->enable_5v3v_pin, -- smc->enable_5v3v_level, -- SMC_ENABLE_5V3V_PIN_NAME); -- pr_error("enable_pin: -->(%d)\n", -- (smc->enable_5v3v_level) ? 1 : 0); -- } -- mutex_unlock(&smc_lock); -- -- return count; --} -- --static ssize_t show_freq(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- return sprintf(buf, "%dKHz\n", smc_dev[0].param.freq); --} -- --static ssize_t store_freq(struct class *class, -- struct class_attribute *attr, -- const char *buf, -- size_t count) --{ -- int freq = 0; -- int ret; -- -- ret = sscanf(buf, "%d", &freq); -- if (freq) -- smc_dev[0].param.freq = freq; -- pr_dbg("freq -> %dKHz\n", smc_dev[0].param.freq); -- return count; --} -- --#ifdef MEM_DEBUG --static ssize_t show_debug(struct class *class, -- struct class_attribute *attr, -- char *buf) --{ -- pr_inf("Usage:\n"); -- pr_inf("\techo [ 1 | 2 | 0 | dump | reset ] >"); -- pr_inf("debug : enable(1/2)|diable|dump|reset\n"); -- pr_inf("\t dump file: "DEBUG_FILE_NAME"\n"); -- return 0; --} -- --static ssize_t store_debug(struct class *class, -- struct class_attribute *attr, -- const char *buf, -- size_t count) --{ -- int smc_debug_level = 0; -- -- switch (buf[0]) { -- case '2': -- smc_debug_level++; -- case '1': { -- void *p = krealloc((const void *)dbuf, DBUF_SIZE, GFP_KERNEL); -- smc_debug_level++; -- if (p) { -- dbuf = (char *)p; -- smc_debug = smc_debug_level; -- } else { -- pr_error("krealloc(dbuf:%d) failed\n", DBUF_SIZE); -- } -- } -- break; -- case '0': -- smc_debug = 0; -- kfree(dbuf); -- dbuf = NULL; -- break; -- case 'r': -- case 'R': -- if (smc_debug) { -- memset(dbuf, 0, DBUF_SIZE); -- dwrite = 0; -- dread = 0; -- pr_inf("dbuf cleanup\n"); -- } -- break; -- case 'd': -- case 'D': -- if (smc_debug) { -- open_debug(); -- debug_write(dbuf, dwrite+5); -- close_debug(); -- pr_inf("dbuf dump ok\n"); -- } -- break; -- default: -- break; -- } -- return count; --} --#endif -- --static struct class_attribute smc_class_attrs[] = { -- __ATTR(smc_gpio_pull, S_IRUGO | S_IWUSR, show_gpio_pull, set_gpio_pull), -- __ATTR(ctrl_5v3v, S_IRUGO | S_IWUSR, show_5v3v, store_5v3v), -- __ATTR(freq, S_IRUGO | S_IWUSR, show_freq, store_freq), --#ifdef MEM_DEBUG -- __ATTR(debug, S_IRUGO | S_IWUSR, show_debug, store_debug), --#endif -- __ATTR_NULL --}; -- --static struct class smc_class = { -- .name = SMC_CLASS_NAME, -- .class_attrs = smc_class_attrs, --}; -- --static unsigned long get_clk(char *name) --{ -- struct clk *clk = NULL; -- clk = clk_get_sys(name, NULL); -- if (clk) -- return clk_get_rate(clk); -- return 0; --} -- --static unsigned long get_module_clk(int sel) --{ --#ifdef CONFIG_ARCH_ARC700 -- return get_mpeg_clk(); --#else -- -- unsigned long clk = 0; --#ifdef CONFIG_ARCH_MESON6/*M6*/ -- /*sel = [0:clk81, 1:ddr-pll, 2:fclk-div5, 3:XTAL]*/ -- switch (sel) { -- case 0: -- clk = get_clk("clk81"); -- break; -- case 1: -- clk = get_clk("pll_ddr"); -- break; -- case 2: -- clk = get_clk("fixed")/5; -- break; -- case 3: -- clk = get_clk("xtal"); -- break; -- } --#else -- /*sel = [0:fclk-div2/fclk-div4(M8 and further), -- 1:fclk-div3, 2:fclk-div5, 3:XTAL]*/ -- switch (sel) { --#if defined(MESON_CPU_TYPE_MESON8) && (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8) -- case 0: -- clk = get_clk("pll_fixed") / 4; -- break; --#else/*M6TV/TVD/TVLITE*/ -- case 0: -- clk = 1000000000; -- break; -- /*case 0: clk = get_clk("fixed")/2; -- break; */ --#endif -- case 1: -- clk = get_clk("pll_fixed") / 3; -- break; -- case 2: -- clk = get_clk("pll_fixed") / 5; -- break; -- case 3: -- clk = get_clk("xtal"); -- break; -- } --#endif /*M6*/ -- -- if (!clk) -- pr_error("fail: unknown clk source"); -- -- return clk; -- --#endif --} -- --#ifndef CONFIG_OF --static int _gpio_request(unsigned int gpio, const char *owner) --{ -- gpio_request(gpio, owner); -- return 0; --} --#endif -- --static int _gpio_out(struct gpio_desc *gpio, int val, const char *owner) --{ -- int ret = 0; -- if (val < 0) { -- pr_dbg("gpio out val = -1.\n"); -- return -1; -- } -- if (val != 0) -- val = 1; -- ret = gpiod_direction_output(gpio, val); -- pr_dbg("smc gpio out ret %d\n", ret); -- return ret; --} -- --#ifdef DET_FROM_PIO --static int _gpio_in(struct gpio_desc *gpio, const char *owner) --{ -- int ret = 0; -- -- ret = gpiod_get_value(gpio); -- return ret; --} --#endif --static int _gpio_free(struct gpio_desc *gpio, const char *owner) --{ -- -- gpiod_put(gpio); -- return 0; --} -- --static inline int smc_write_end(struct smc_dev *smc) --{ -- int ret; -- unsigned long flags; -- -- spin_lock_irqsave(&smc->slock, flags); -- ret = (!smc->cardin || !smc->send_count); -- spin_unlock_irqrestore(&smc->slock, flags); -- -- return ret; --} -- -- --static inline int smc_can_read(struct smc_dev *smc) --{ -- int ret; -- unsigned long flags; -- -- spin_lock_irqsave(&smc->slock, flags); -- ret = (!smc->cardin || smc->recv_count); -- spin_unlock_irqrestore(&smc->slock, flags); -- -- return ret; --} -- --static inline int smc_can_write(struct smc_dev *smc) --{ -- int ret; -- unsigned long flags; -- -- spin_lock_irqsave(&smc->slock, flags); -- ret = (!smc->cardin || (smc->send_count != SEND_BUF_SIZE)); -- spin_unlock_irqrestore(&smc->slock, flags); -- return ret; --} -- --static int smc_hw_set_param(struct smc_dev *smc) --{ -- unsigned long v = 0; -- struct SMCCARD_HW_Reg0 *reg0; -- struct SMCCARD_HW_Reg6 *reg6; -- struct SMCCARD_HW_Reg2 *reg2; -- struct SMCCARD_HW_Reg5 *reg5; -- /* -- SMC_ANSWER_TO_RST *reg1; -- SMC_INTERRUPT_Reg *reg_int; -- */ -- unsigned sys_clk_rate = get_module_clk(clock_source); -- unsigned long freq_cpu = -- sys_clk_rate / 1000 * 22; /**10 adjust freq temporarily*/ -- -- pr_error("hw set param\n"); -- -- v = SMC_READ_REG(REG0); -- reg0 = (struct SMCCARD_HW_Reg0 *)&v; -- reg0->etu_divider = ETU_DIVIDER_CLOCK_HZ * smc->param.f / -- (smc->param.d * smc->param.freq) - 1; -- SMC_WRITE_REG(REG0, v); -- pr_error("REG0: 0x%08lx\n", v); -- pr_error("f :%d\n", smc->param.f); -- pr_error("d :%d\n", smc->param.d); -- pr_error("freq :%d\n", smc->param.freq); -- -- v = SMC_READ_REG(REG1); -- pr_error("REG1: 0x%08lx\n", v); -- -- v = SMC_READ_REG(REG2); -- reg2 = (struct SMCCARD_HW_Reg2 *)&v; -- reg2->recv_invert = smc->param.recv_invert; -- reg2->recv_parity = smc->param.recv_parity; -- reg2->recv_lsb_msb = smc->param.recv_lsb_msb; -- reg2->xmit_invert = smc->param.xmit_invert; -- reg2->xmit_parity = smc->param.xmit_parity; -- reg2->xmit_lsb_msb = smc->param.xmit_lsb_msb; -- reg2->xmit_retries = smc->param.xmit_retries; -- reg2->xmit_repeat_dis = smc->param.xmit_repeat_dis; -- reg2->recv_no_parity = smc->param.recv_no_parity; -- reg2->clk_tcnt = freq_cpu/smc->param.freq - 1; -- reg2->det_filter_sel = DET_FILTER_SEL_DEFAULT; -- reg2->io_filter_sel = IO_FILTER_SEL_DEFAULT; -- reg2->clk_sel = clock_source; -- /*reg2->pulse_irq = 0;*/ -- SMC_WRITE_REG(REG2, v); -- pr_error("REG2: 0x%08lx\n", v); -- pr_error("recv_inv:%d\n", smc->param.recv_invert); -- pr_error("recv_lsb:%d\n", smc->param.recv_lsb_msb); -- pr_error("recv_par:%d\n", smc->param.recv_parity); -- pr_error("recv_npa:%d\n", smc->param.recv_no_parity); -- pr_error("xmit_inv:%d\n", smc->param.xmit_invert); -- pr_error("xmit_lsb:%d\n", smc->param.xmit_lsb_msb); -- pr_error("xmit_par:%d\n", smc->param.xmit_parity); -- pr_error("xmit_rep:%d\n", smc->param.xmit_repeat_dis); -- pr_error("xmit_try:%d\n", smc->param.xmit_retries); -- -- v = SMC_READ_REG(REG5); -- reg5 = (struct SMCCARD_HW_Reg5 *)&v; -- reg5->cwt_detect_en = cwt_det_en; -- reg5->bwt_base_time_gnt = BWT_BASE_DEFAULT; -- SMC_WRITE_REG(REG5, v); -- pr_error("REG5: 0x%08lx\n", v); -- -- v = SMC_READ_REG(REG6); -- reg6 = (struct SMCCARD_HW_Reg6 *)&v; -- reg6->cwi_value = smc->param.cwi; -- reg6->bwi = smc->param.bwi; -- reg6->bgt = smc->param.bgt-2; -- reg6->N_parameter = smc->param.n; -- SMC_WRITE_REG(REG6, v); -- pr_error("REG6: 0x%08lx\n", v); -- pr_error("N :%d\n", smc->param.n); -- pr_error("cwi :%d\n", smc->param.cwi); -- pr_error("bgt :%d\n", smc->param.bgt); -- pr_error("bwi :%d\n", smc->param.bwi); -- -- return 0; --} -- --static int smc_default_init(struct smc_dev *smc) --{ -- smc->param.f = F_DEFAULT; -- smc->param.d = D_DEFAULT; -- smc->param.freq = FREQ_DEFAULT; -- smc->param.recv_invert = 0; -- smc->param.recv_parity = 0; -- smc->param.recv_lsb_msb = 0; -- smc->param.recv_no_parity = 1; -- smc->param.xmit_invert = 0; -- smc->param.xmit_lsb_msb = 0; -- smc->param.xmit_retries = 1; -- smc->param.xmit_repeat_dis = 1; -- smc->param.xmit_parity = 0; -- -- /*set reg6 param value */ -- smc->param.n = N_DEFAULT; -- smc->param.bwi = BWI_DEFAULT; -- smc->param.cwi = CWI_DEFAULT; -- smc->param.bgt = BGT_DEFAULT; -- return 0; --} -- --static int smc_hw_setup(struct smc_dev *smc) --{ -- unsigned long v = 0; -- struct SMCCARD_HW_Reg0 *reg0; -- struct SMC_ANSWER_TO_RST *reg1; -- struct SMCCARD_HW_Reg2 *reg2; -- struct SMC_INTERRUPT_Reg *reg_int; -- struct SMCCARD_HW_Reg5 *reg5; -- struct SMCCARD_HW_Reg6 *reg6; -- -- unsigned sys_clk_rate = get_module_clk(clock_source); -- -- unsigned long freq_cpu = sys_clk_rate -- / 1000 * 22; /**10 adjust freq temporarily*/ -- -- pr_error("SMC CLK SOURCE - %luKHz\n", freq_cpu); -- --#ifdef RST_FROM_PIO -- _gpio_out(smc->reset_pin, RESET_ENABLE, SMC_RESET_PIN_NAME); --#endif -- -- v = SMC_READ_REG(REG0); -- reg0 = (struct SMCCARD_HW_Reg0 *)&v; -- reg0->enable = 1; -- reg0->clk_en = 0; -- reg0->clk_oen = 0; -- reg0->card_detect = 0; -- reg0->start_atr = 0; -- reg0->start_atr_en = 0; -- reg0->rst_level = RESET_ENABLE; -- reg0->io_level = 0; -- reg0->recv_fifo_threshold = FIFO_THRESHOLD_DEFAULT; -- reg0->etu_divider = ETU_DIVIDER_CLOCK_HZ * smc->param.f -- / (smc->param.d*smc->param.freq) - 1; -- reg0->first_etu_offset = 5; -- SMC_WRITE_REG(REG0, v); -- pr_error("REG0: 0x%08lx\n", v); -- pr_error("f :%d\n", smc->param.f); -- pr_error("d :%d\n", smc->param.d); -- pr_error("freq :%d\n", smc->param.freq); -- -- v = SMC_READ_REG(REG1); -- reg1 = (struct SMC_ANSWER_TO_RST *)&v; -- reg1->atr_final_tcnt = ATR_FINAL_TCNT_DEFAULT; -- reg1->atr_holdoff_tcnt = ATR_HOLDOFF_TCNT_DEFAULT; -- reg1->atr_clk_mux = ATR_CLK_MUX_DEFAULT; -- reg1->atr_holdoff_en = atr_holdoff;/*ATR_HOLDOFF_EN;*/ -- reg1->etu_clk_sel = ETU_CLK_SEL; -- SMC_WRITE_REG(REG1, v); -- pr_error("REG1: 0x%08lx\n", v); -- -- v = SMC_READ_REG(REG2); -- reg2 = (struct SMCCARD_HW_Reg2 *)&v; -- reg2->recv_invert = smc->param.recv_invert; -- reg2->recv_parity = smc->param.recv_parity; -- reg2->recv_lsb_msb = smc->param.recv_lsb_msb; -- reg2->xmit_invert = smc->param.xmit_invert; -- reg2->xmit_parity = smc->param.xmit_parity; -- reg2->xmit_lsb_msb = smc->param.xmit_lsb_msb; -- reg2->xmit_retries = smc->param.xmit_retries; -- reg2->xmit_repeat_dis = smc->param.xmit_repeat_dis; -- reg2->recv_no_parity = smc->param.recv_no_parity; -- reg2->clk_tcnt = freq_cpu/smc->param.freq - 1; -- reg2->det_filter_sel = DET_FILTER_SEL_DEFAULT; -- reg2->io_filter_sel = IO_FILTER_SEL_DEFAULT; -- reg2->clk_sel = clock_source; -- /*reg2->pulse_irq = 0;*/ -- SMC_WRITE_REG(REG2, v); -- pr_error("REG2: 0x%08lx\n", v); -- pr_error("recv_inv:%d\n", smc->param.recv_invert); -- pr_error("recv_lsb:%d\n", smc->param.recv_lsb_msb); -- pr_error("recv_par:%d\n", smc->param.recv_parity); -- pr_error("recv_npa:%d\n", smc->param.recv_no_parity); -- pr_error("xmit_inv:%d\n", smc->param.xmit_invert); -- pr_error("xmit_lsb:%d\n", smc->param.xmit_lsb_msb); -- pr_error("xmit_par:%d\n", smc->param.xmit_parity); -- pr_error("xmit_rep:%d\n", smc->param.xmit_repeat_dis); -- pr_error("xmit_try:%d\n", smc->param.xmit_retries); -- -- v = SMC_READ_REG(INTR); -- reg_int = (struct SMC_INTERRUPT_Reg *)&v; -- reg_int->recv_fifo_bytes_threshold_int_mask = 0; -- reg_int->send_fifo_last_byte_int_mask = 1; -- reg_int->cwt_expeired_int_mask = 1; -- reg_int->bwt_expeired_int_mask = 1; -- reg_int->write_full_fifo_int_mask = 1; -- reg_int->send_and_recv_confilt_int_mask = 1; -- reg_int->recv_error_int_mask = 1; -- reg_int->send_error_int_mask = 1; -- reg_int->rst_expired_int_mask = 1; -- reg_int->card_detect_int_mask = 0; -- SMC_WRITE_REG(INTR, v | 0x03FF); -- pr_error("INTR: 0x%08lx\n", v); -- -- v = SMC_READ_REG(REG5); -- reg5 = (struct SMCCARD_HW_Reg5 *)&v; -- reg5->cwt_detect_en = cwt_det_en; -- reg5->btw_detect_en = btw_det_en; -- reg5->etu_msr_en = etu_msr_en; -- reg5->bwt_base_time_gnt = BWT_BASE_DEFAULT; -- SMC_WRITE_REG(REG5, v); -- pr_error("REG5: 0x%08lx\n", v); -- -- -- v = SMC_READ_REG(REG6); -- reg6 = (struct SMCCARD_HW_Reg6 *)&v; -- reg6->N_parameter = smc->param.n; -- reg6->cwi_value = smc->param.cwi; -- reg6->bgt = smc->param.bgt-2; -- reg6->bwi = smc->param.bwi; -- SMC_WRITE_REG(REG6, v); -- pr_error("REG6: 0x%08lx\n", v); -- pr_error("N :%d\n", smc->param.n); -- pr_error("cwi :%d\n", smc->param.cwi); -- pr_error("bgt :%d\n", smc->param.bgt); -- pr_error("bwi :%d\n", smc->param.bwi); -- return 0; --} -- --static void enable_smc_clk(struct smc_dev *smc) --{ -- unsigned int _value; -- -- if ((smc->pin_clk_pinmux_reg == -1) -- || (smc->pin_clk_pinmux_bit == -1)) -- return; -- _value = READ_CBUS_REG(smc->pin_clk_pinmux_reg); -- _value |= smc->pin_clk_pinmux_bit; -- WRITE_CBUS_REG(smc->pin_clk_pinmux_reg, _value); --} -- --static void disable_smc_clk(struct smc_dev *smc) --{ -- unsigned int _value; -- -- if ((smc->pin_clk_pinmux_reg == -1) -- || (smc->pin_clk_pinmux_bit == -1)) -- return; -- -- _value = READ_CBUS_REG(smc->pin_clk_pinmux_reg); -- _value &= ~smc->pin_clk_pinmux_bit; -- WRITE_CBUS_REG(smc->pin_clk_pinmux_reg, _value); -- _value = READ_CBUS_REG(smc->pin_clk_pinmux_reg); -- -- /*pr_dbg("disable smc_clk: mux[%x]\n", _value);*/ -- -- if ((smc->pin_clk_oen_reg != -1) -- && (smc->pin_clk_out_reg != -1) -- && (smc->pin_clk_oebit != -1) -- && (smc->pin_clk_oubit != -1)) { -- -- /*force the clk pin to low.*/ -- _value = READ_CBUS_REG(smc->pin_clk_oen_reg); -- _value &= ~smc->pin_clk_oebit; -- WRITE_CBUS_REG(smc->pin_clk_oen_reg, _value); -- _value = READ_CBUS_REG(smc->pin_clk_out_reg); -- _value &= ~smc->pin_clk_oubit; -- WRITE_CBUS_REG(smc->pin_clk_out_reg, _value); -- pr_dbg("disable smc_clk: pin[%x](reg)\n", _value); -- } else if (smc->pin_clk_pin != NULL) { -- -- udelay(20); -- /* _gpio_out(smc->pin_clk_pin, -- 0, -- SMC_CLK_PIN_NAME);*/ -- udelay(1000); -- -- /*pr_dbg("disable smc_clk: pin[%x](pin)\n", smc->pin_clk_pin);*/ -- } else { -- -- pr_error("no reg/bit or pin"); -- pr_error("defined for clk-pin contrl.\n"); -- } -- -- return; --} -- --static int smc_hw_active(struct smc_dev *smc) --{ -- if (ENA_GPIO_PULL > 0) { -- enable_smc_clk(smc); -- udelay(200); -- } -- if (!smc->active) { -- -- if (smc->reset) { -- smc->reset(NULL, 0); -- pr_dbg("call reset(0) in bsp.\n"); -- } else { -- if (smc->use_enable_pin) { -- _gpio_out(smc->enable_pin, -- smc->enable_level, -- SMC_ENABLE_PIN_NAME); -- } -- } -- -- udelay(200); -- smc_hw_setup(smc); -- -- smc->active = 1; -- } -- -- return 0; --} -- --static int smc_hw_deactive(struct smc_dev *smc) --{ -- if (smc->active) { -- unsigned long sc_reg0 = SMC_READ_REG(REG0); -- struct SMCCARD_HW_Reg0 *sc_reg0_reg = (void *)&sc_reg0; -- sc_reg0_reg->rst_level = RESET_ENABLE; -- sc_reg0_reg->enable = 1; -- sc_reg0_reg->start_atr = 0; -- sc_reg0_reg->start_atr_en = 0; -- sc_reg0_reg->clk_en = 0; -- SMC_WRITE_REG(REG0, sc_reg0); --#ifdef RST_FROM_PIO -- /*_gpio_out(smc->reset_pin, RESET_ENABLE, SMC_RESET_PIN_NAME);*/ -- _gpio_out(smc->reset_pin, RESET_DISABLE, SMC_RESET_PIN_NAME); --#endif -- udelay(200); -- -- if (smc->reset) { -- smc->reset(NULL, 1); -- pr_dbg("call reset(1) in bsp.\n"); -- } else { -- if (smc->use_enable_pin) -- _gpio_out(smc->enable_pin, -- !smc->enable_level, -- SMC_ENABLE_PIN_NAME); -- } -- if (ENA_GPIO_PULL > 0) { -- disable_smc_clk(smc); -- /*smc_pull_down_data();*/ -- } -- -- smc->active = 0; -- } -- -- return 0; --} -- --#define INV(a) ((smc->sc_type == SC_INVERSE) ? inv_table[(int)(a)] : (a)) -- --#ifndef ATR_FROM_INT --static int smc_hw_get(struct smc_dev *smc, int cnt, int timeout) --{ -- unsigned long sc_status; -- int times = timeout*100; -- struct SMC_STATUS_Reg *sc_status_reg = -- (struct SMC_STATUS_Reg *)&sc_status; -- -- while ((times > 0) && (cnt > 0)) { -- sc_status = SMC_READ_REG(STATUS); -- -- /*pr_dbg("read atr status %08x\n", sc_status);*/ -- -- if (sc_status_reg->rst_expired_status) -- pr_error("atr timeout\n"); -- -- if (sc_status_reg->cwt_expeired_status) { -- pr_error("cwt timeout when get atr,"); -- pr_error("but maybe it is natural!\n"); -- } -- -- if (sc_status_reg->recv_fifo_empty_status) { -- udelay(10); -- times--; -- } else { -- while (sc_status_reg->recv_fifo_bytes_number > 0) { -- u8 byte = (SMC_READ_REG(FIFO))&0xff; -- --#ifdef SW_INVERT -- if (smc->sc_type == SC_INVERSE) -- byte = inv_table[byte]; --#endif -- -- smc->atr.atr[smc->atr.atr_len++] = byte; -- sc_status_reg->recv_fifo_bytes_number--; -- cnt--; -- if (cnt == 0) { -- pr_dbg("read atr bytes ok\n"); -- return 0; -- } -- } -- } -- } -- -- pr_error("read atr failed\n"); -- return -1; --} -- --#else -- --static int smc_fiq_get(struct smc_dev *smc, int size, int timeout) --{ -- int ret = 0; -- int times = timeout/10; -- int start, end; -- -- if (!times) -- times = 1; -- -- while ((times > 0) && (size > 0)) { -- -- start = smc->recv_start; -- end = smc->recv_end;/*momentary value*/ -- -- if (!smc->cardin) { -- ret = -ENODEV; -- } else if (start == end) { -- ret = -EAGAIN; -- } else { -- int i; -- /*ATR only, no loop*/ -- ret = end - start; -- if (ret > size) -- ret = size; -- memcpy(&smc->atr.atr[smc->atr.atr_len], -- &smc->recv_buf[start], ret); -- for (i = smc->atr.atr_len; -- i < smc->atr.atr_len+ret; -- i++) -- smc->atr.atr[i] = INV((int)smc->atr.atr[i]); -- smc->atr.atr_len += ret; -- -- smc->recv_start += ret; -- size - = ret; -- } -- -- if (ret < 0) { -- msleep(20); -- times--; -- } -- } -- -- if (size > 0) -- ret = -ETIMEDOUT; -- -- return ret; --} --#endif /*ifndef ATR_FROM_INT*/ -- --static int smc_hw_read_atr(struct smc_dev *smc) --{ -- char *ptr = smc->atr.atr; -- int his_len, t, tnext = 0, only_t0 = 1, loop_cnt = 0; -- int i; -- -- pr_dbg("read atr\n"); -- --#ifdef ATR_FROM_INT --#define smc_hw_get smc_fiq_get --#endif -- -- smc->atr.atr_len = 0; -- if (smc_hw_get(smc, 2, 2000) < 0) -- goto end; -- --#ifdef SW_INVERT -- if (0x03 == ptr[0]) { -- smc->sc_type = SC_INVERSE; -- ptr[0] = inv_table[(int)ptr[0]]; -- if (smc->atr.atr_len > 1) -- ptr[1] = inv_table[(int)ptr[1]]; -- } else if (0x3F == ptr[0]) { -- smc->sc_type = SC_INVERSE; -- if (smc->atr.atr_len > 1) -- ptr[1] = inv_table[(int)ptr[1]]; -- } else if (0x3B == ptr[0]) { -- smc->sc_type = SC_DIRECT; -- } else if (0x23 == ptr[0]) { -- smc->sc_type = SC_DIRECT; -- ptr[0] = inv_table[(int)ptr[0]]; -- if (smc->atr.atr_len > 1) -- ptr[1] = inv_table[(int)ptr[1]]; -- } --#endif /*SW_INVERT*/ -- -- ptr++; -- his_len = ptr[0]&0x0F; -- -- do { -- tnext = 0; -- loop_cnt++; -- if (ptr[0]&0x10) { -- if (smc_hw_get(smc, 1, 1000) < 0) -- goto end; -- } -- if (ptr[0]&0x20) { -- if (smc_hw_get(smc, 1, 1000) < 0) -- goto end; -- } -- if (ptr[0]&0x40) { -- if (smc_hw_get(smc, 1, 1000) < 0) -- goto end; -- } -- if (ptr[0]&0x80) { -- if (smc_hw_get(smc, 1, 1000) < 0) -- goto end; -- -- ptr = &smc->atr.atr[smc->atr.atr_len-1]; -- t = ptr[0]&0x0F; -- if (t) -- only_t0 = 0; -- if (ptr[0]&0xF0) -- tnext = 1; -- } -- } while (tnext && loop_cnt < 4); -- -- if (!only_t0) -- his_len++; -- smc_hw_get(smc, his_len, 2000); -- -- pr_dbg("get atr len:%d data: ", smc->atr.atr_len); -- for (i = 0; i < smc->atr.atr_len; i++) -- pr_dbg("%02x ", smc->atr.atr[i]); -- pr_dbg("\n"); -- --#ifdef ATR_OUT_READ -- if (smc->atr.atr_len) { -- pr_dbg("reset recv_start %d->0\n", smc->recv_start); -- smc->recv_start = 0; -- if (smc->sc_type == SC_INVERSE) { -- int i; -- for (i = 0; i < smc->atr.atr_len; i++) -- smc->recv_buf[smc->recv_start+i] = -- smc->atr.atr[i]; -- } -- } --#endif -- return 0; -- --end: -- pr_error("read atr failed\n"); -- return -EIO; --#ifdef ATR_FROM_INT --#undef smc_hw_get --#endif --} -- -- --void smc_reset_prepare(struct smc_dev *smc) --{ -- /*reset recv&send buf*/ -- smc->send_start = 0; -- smc->send_count = 0; -- smc->recv_start = 0; -- smc->recv_count = 0; -- -- /*Read ATR*/ -- smc->atr.atr_len = 0; -- smc->recv_count = 0; -- smc->send_count = 0; -- -- smc->recv_end = 0; -- smc->send_end = 0; -- --#ifdef SW_INVERT -- smc->sc_type = SC_DIRECT; -- smc->atr_mode = 1; --#endif --} -- --static int smc_hw_reset(struct smc_dev *smc) --{ -- unsigned long flags; -- int ret; -- unsigned long sc_reg0 = SMC_READ_REG(REG0); -- struct SMCCARD_HW_Reg0 *sc_reg0_reg = (void *)&sc_reg0; -- unsigned long sc_int; -- struct SMC_INTERRUPT_Reg *sc_int_reg = (void *)&sc_int; -- -- pr_dbg("smc read reg0 0x%lx\n", sc_reg0); -- -- spin_lock_irqsave(&smc->slock, flags); -- if (smc->cardin) -- ret = 0; -- else -- ret = -ENODEV; -- spin_unlock_irqrestore(&smc->slock, flags); -- -- if (ret >= 0) { -- /*Reset*/ --#ifdef NO_HOT_RESET -- smc->active = 0; --#endif -- if (smc->active) { -- -- smc_reset_prepare(smc); -- -- sc_reg0_reg->rst_level = RESET_ENABLE; -- sc_reg0_reg->clk_en = 1; -- sc_reg0_reg->etu_divider = ETU_DIVIDER_CLOCK_HZ * -- smc->param.f / (smc->param.d*smc->param.freq) - 1; -- SMC_WRITE_REG(REG0, sc_reg0); --#ifdef RST_FROM_PIO -- _gpio_out(smc->reset_pin, -- RESET_ENABLE, -- SMC_RESET_PIN_NAME); --#endif -- -- udelay(800/smc->param.freq); /*>= 400/f ;*/ -- -- /*disable receive interrupt*/ -- sc_int = SMC_READ_REG(INTR); -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 0; -- SMC_WRITE_REG(INTR, sc_int|0x3FF); -- -- sc_reg0_reg->rst_level = RESET_DISABLE; -- sc_reg0_reg->start_atr = 1; -- SMC_WRITE_REG(REG0, sc_reg0); --#ifdef RST_FROM_PIO -- _gpio_out(smc->reset_pin, -- RESET_DISABLE, -- SMC_RESET_PIN_NAME); --#endif -- } else { -- smc_hw_deactive(smc); -- -- udelay(200); -- -- smc_hw_active(smc); -- -- smc_reset_prepare(smc); -- -- sc_reg0_reg->clk_en = 1; -- sc_reg0_reg->enable = 0; -- sc_reg0_reg->rst_level = RESET_ENABLE; -- SMC_WRITE_REG(REG0, sc_reg0); --#ifdef RST_FROM_PIO -- if (smc->use_enable_pin) { -- _gpio_out(smc->enable_pin, -- smc->enable_level, -- SMC_RESET_PIN_NAME); -- udelay(100); -- } -- _gpio_out(smc->reset_pin, -- RESET_ENABLE, -- SMC_RESET_PIN_NAME); --#endif -- udelay(2000); /*>= 400/f ;*/ -- -- /*disable receive interrupt*/ -- sc_int = SMC_READ_REG(INTR); -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 0; -- SMC_WRITE_REG(INTR, sc_int|0x3FF); -- -- sc_reg0_reg->rst_level = RESET_DISABLE; -- sc_reg0_reg->start_atr_en = 1; -- sc_reg0_reg->start_atr = 1; -- sc_reg0_reg->enable = 1; -- sc_reg0_reg->etu_divider = ETU_DIVIDER_CLOCK_HZ * -- smc->param.f / (smc->param.d*smc->param.freq) - 1; -- SMC_WRITE_REG(REG0, sc_reg0); --#ifdef RST_FROM_PIO -- -- _gpio_out(smc->reset_pin, -- RESET_DISABLE, SMC_RESET_PIN_NAME); --#endif -- } -- --#if defined(ATR_FROM_INT) -- /*enable receive interrupt*/ -- sc_int = SMC_READ_REG(INTR); -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 1; -- SMC_WRITE_REG(INTR, sc_int|0x3FF); --#endif -- -- /*msleep(atr_delay);*/ -- ret = smc_hw_read_atr(smc); -- --#ifdef SW_INVERT -- smc->atr_mode = 0; --#endif -- --#if defined(ATR_FROM_INT) -- /*disable receive interrupt*/ -- sc_int = SMC_READ_REG(INTR); -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 0; -- SMC_WRITE_REG(INTR, sc_int|0x3FF); --#endif -- -- /*Disable ATR*/ -- sc_reg0 = SMC_READ_REG(REG0); -- sc_reg0_reg->start_atr_en = 0; -- sc_reg0_reg->start_atr = 0; -- SMC_WRITE_REG(REG0, sc_reg0); -- --#ifndef DISABLE_RECV_INT -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 1; --#endif -- SMC_WRITE_REG(INTR, sc_int|0x3FF); -- -- } -- -- return ret; --} -- --static int smc_hw_get_status(struct smc_dev *smc, int *sret) --{ -- unsigned long flags; --#ifndef DET_FROM_PIO -- unsigned int reg_val; -- struct SMCCARD_HW_Reg0 *reg = (struct SMCCARD_HW_Reg0 *)®_val; --#endif -- spin_lock_irqsave(&smc->slock, flags); -- --#ifdef DET_FROM_PIO -- smc->cardin = _gpio_in(smc->detect_pin, OWNER_NAME); -- pr_dbg("get_status: card detect: %d\n", smc->cardin); --#else -- reg_val = SMC_READ_REG(REG0); -- smc->cardin = reg->card_detect; -- /*pr_error("get_status: smc reg0 %08x, -- card detect: %d\n", reg_val, reg->card_detect);*/ --#endif -- /*pr_dbg("det:%d, det_invert:%d\n", -- smc->cardin, smc->detect_invert);*/ -- if (smc->detect_invert) -- smc->cardin = !smc->cardin; -- -- *sret = smc->cardin; -- -- spin_unlock_irqrestore(&smc->slock, flags); -- -- return 0; --} -- -- --static inline void _atomic_wrap_inc(int *p, int wrap) --{ -- int i = *p; -- i++; -- if (i >= wrap) -- i = 0; -- *p = i; --} -- --static inline void _atomic_wrap_add(int *p, int add, int wrap) --{ -- int i = *p; -- i += add; -- if (i >= wrap) -- i %= wrap; -- *p = i; --} -- --static inline int smc_can_recv_max(struct smc_dev *smc) --{ -- int start = smc->recv_start; -- int end = smc->recv_end; -- -- if (end >= start) -- return RECV_BUF_SIZE - end + start; -- else -- return start - end; --} -- --static int smc_hw_start_send(struct smc_dev *smc) --{ -- unsigned int sc_status; -- struct SMC_STATUS_Reg *sc_status_reg = -- (struct SMC_STATUS_Reg *)&sc_status; -- u8 byte; -- -- /*trigger only*/ -- sc_status = SMC_READ_REG(STATUS); -- if (smc->send_end != smc->send_start && -- !sc_status_reg->send_fifo_full_status) { -- pr_dbg("s i f [%d:%d]\n", smc->send_start, smc->send_end); -- byte = smc->send_buf[smc->send_end]; -- _atomic_wrap_inc(&smc->send_end, SEND_BUF_SIZE); --#ifdef SW_INVERT -- if (smc->sc_type == SC_INVERSE) -- byte = inv_table[byte]; --#endif -- SMC_WRITE_REG(FIFO, byte); -- pr_dbg("send 1st byte to hw\n"); -- } -- -- return 0; --} -- --#ifdef SMC_FIQ --static irqreturn_t smc_bridge_isr(int irq, void *dev_id) --{ -- struct smc_dev *smc = (struct smc_dev *)dev_id; -- --#ifdef DET_FROM_PIO -- smc->cardin = _gpio_in(smc->detect_pin, SMC_DETECT_PIN_NAME); -- if (smc->detect_invert) -- smc->cardin = !smc->cardin; --#endif -- -- if (smc->recv_start != smc->recv_end) -- wake_up_interruptible(&smc->rd_wq); -- if (smc->send_start == smc->send_end) -- wake_up_interruptible(&smc->wr_wq); -- -- return IRQ_HANDLED; --} -- --static void smc_irq_handler(void) --{ -- struct smc_dev *smc = &smc_dev[0]; -- unsigned int sc_status; -- unsigned int sc_reg0; -- unsigned int sc_int; -- struct SMC_STATUS_Reg *sc_status_reg = -- (struct SMC_STATUS_Reg *)&sc_status; -- struct SMC_INTERRUPT_Reg *sc_int_reg = -- (struct SMC_INTERRUPT_Reg *)&sc_int; -- struct SMCCARD_HW_Reg0 *sc_reg0_reg = -- (void *)&sc_reg0; -- -- sc_int = SMC_READ_REG(INTR); -- /*Fpr("smc intr:0x%x\n", sc_int);*/ -- -- if (sc_int_reg->recv_fifo_bytes_threshold_int) { -- -- int num = 0; -- -- sc_status = SMC_READ_REG(STATUS); -- num = sc_status_reg->recv_fifo_bytes_number; -- -- if (num > smc_can_recv_max(smc)) { -- pr_error("receive buffer overflow\n"); -- } else { -- u8 byte; -- -- while (sc_status_reg->recv_fifo_bytes_number) { -- byte = SMC_READ_REG(FIFO); --#ifdef SW_INVERT -- if (!smc->atr_mode && -- smc->sc_type == SC_INVERSE) -- byte = inv_table[byte]; --#endif -- smc->recv_buf[smc->recv_end] = byte; -- _atomic_wrap_inc(&smc->recv_end, RECV_BUF_SIZE); -- num++; -- sc_status = SMC_READ_REG(STATUS); -- Fpr("F%02x ", byte); -- } -- Fpr("Fr > %d bytes\n", num); -- -- fiq_bridge_pulse_trigger(&smc->smc_fiq_bridge); -- } -- -- sc_int_reg->recv_fifo_bytes_threshold_int = 0; -- -- } -- -- if (sc_int_reg->send_fifo_last_byte_int) { -- int start = smc->send_start; -- int cnt = 0; -- u8 byte; -- -- while (1) { -- sc_status = SMC_READ_REG(STATUS); -- if (smc->send_end == start || -- sc_status_reg->send_fifo_full_status) -- break; -- -- byte = smc->send_buf[smc->send_end]; -- Fpr("Fs > %02x ", byte); -- _atomic_wrap_inc(&smc->send_end, SEND_BUF_SIZE); --#ifdef SW_INVERT -- if (smc->sc_type == SC_INVERSE) -- byte = inv_table[byte]; --#endif -- SMC_WRITE_REG(FIFO, byte); -- cnt++; -- } -- -- Fpr("Fs > %d bytes\n", cnt); -- -- if (smc->send_end == start) { -- sc_int_reg->send_fifo_last_byte_int_mask = 0; -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 1; -- fiq_bridge_pulse_trigger(&smc->smc_fiq_bridge); -- } -- -- sc_int_reg->send_fifo_last_byte_int = 0; -- -- } -- -- SMC_WRITE_REG(INTR, sc_int|0x3FF); -- --#ifndef DET_FROM_PIO -- sc_reg0 = SMC_READ_REG(REG0); -- smc->cardin = sc_reg0_reg->card_detect; -- if (smc->detect_invert) -- smc->cardin = !smc->cardin; --#endif -- -- return; --} -- --#else -- --static int transmit_chars(struct smc_dev *smc) --{ -- unsigned int status; -- struct SMC_STATUS_Reg *status_r = (struct SMC_STATUS_Reg *)&status; -- int cnt = 0; -- u8 byte; -- int start = smc->send_start; -- -- while (1) { -- status = SMC_READ_REG(STATUS); -- if (smc->send_end == start || status_r->send_fifo_full_status) -- break; -- -- byte = smc->send_buf[smc->send_end]; -- Ipr("s > %02x\n", byte); -- _atomic_wrap_inc(&smc->send_end, SEND_BUF_SIZE); --#ifdef SW_INVERT -- if (smc->sc_type == SC_INVERSE) -- byte = inv_table[byte]; --#endif -- SMC_WRITE_REG(FIFO, byte); -- cnt++; -- } -- -- Ipr("s > %d bytes\n", cnt); -- return cnt; --} -- --static int receive_chars(struct smc_dev *smc) --{ -- unsigned int status; -- unsigned int intr; -- struct SMC_STATUS_Reg *status_r = (struct SMC_STATUS_Reg *)&status; -- int cnt = 0; -- u8 byte; -- -- status = SMC_READ_REG(STATUS); -- if (status_r->recv_fifo_empty_status > smc_can_recv_max(smc)) { -- pr_error("receive buffer overflow\n"); -- return -1; -- } -- -- /*clear recv_fifo_bytes_threshold_int_mask or INT lost*/ -- intr = SMC_READ_REG(INTR); -- SMC_WRITE_REG(INTR, (intr & ~0x103ff)); -- -- status = SMC_READ_REG(STATUS); -- while (!status_r->recv_fifo_empty_status) { -- byte = SMC_READ_REG(FIFO); --#ifdef SW_INVERT -- if (!smc->atr_mode && smc->sc_type == SC_INVERSE) -- byte = inv_table[byte]; --#endif -- smc->recv_buf[smc->recv_end] = byte; -- _atomic_wrap_inc(&smc->recv_end, RECV_BUF_SIZE); -- cnt++; -- status = SMC_READ_REG(STATUS); -- Ipr("%02x ", byte); -- } -- Ipr("r > %d bytes\n", cnt); -- -- return cnt; --} -- --static void smc_irq_bh_handler(unsigned long arg) --{ -- struct smc_dev *smc = (struct smc_dev *)arg; --#ifndef DET_FROM_PIO -- unsigned int sc_reg0; -- struct SMCCARD_HW_Reg0 *sc_reg0_reg = (void *)&sc_reg0; --#endif -- -- /*Read card status*/ --#ifndef DET_FROM_PIO -- sc_reg0 = SMC_READ_REG(REG0); -- smc->cardin = sc_reg0_reg->card_detect; --#else -- smc->cardin = _gpio_in(smc->detect_pin, SMC_DETECT_PIN_NAME); --#endif -- if (smc->detect_invert) -- smc->cardin = !smc->cardin; -- -- if (smc->recv_start != smc->recv_end) -- wake_up_interruptible(&smc->rd_wq); -- if (smc->send_start == smc->send_end) -- wake_up_interruptible(&smc->wr_wq); -- -- return; --} -- -- --static irqreturn_t smc_irq_handler(int irq, void *data) --{ -- struct smc_dev *smc = (struct smc_dev *)data; -- unsigned int sc_status; -- unsigned int sc_int; -- struct SMC_STATUS_Reg *sc_status_reg = -- (struct SMC_STATUS_Reg *)&sc_status; -- struct SMC_INTERRUPT_Reg *sc_int_reg = -- (struct SMC_INTERRUPT_Reg *)&sc_int; -- -- sc_int = SMC_READ_REG(INTR); -- Ipr("Int:0x%x\n", sc_int); -- sc_status = SMC_READ_REG(STATUS); -- Ipr("Sta:0x%x\n", sc_status); -- -- /*Receive*/ -- sc_status = SMC_READ_REG(STATUS); -- if (!sc_status_reg->recv_fifo_empty_status) -- receive_chars(smc); -- -- /* Send */ -- sc_status = SMC_READ_REG(STATUS); -- if (!sc_status_reg->send_fifo_full_status) { -- transmit_chars(smc); -- if (smc->send_end == smc->send_start) { -- sc_int_reg->send_fifo_last_byte_int_mask = 0; -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 1; -- } -- } -- -- SMC_WRITE_REG(INTR, sc_int|0x3FF); -- -- tasklet_schedule(&smc->tasklet); -- -- return IRQ_HANDLED; --} --#endif /*ifdef SMC_FIQ*/ -- --static void smc_dev_deinit(struct smc_dev *smc) --{ -- if (smc->irq_num != -1) { -- free_irq(smc->irq_num, &smc); -- smc->irq_num = -1; -- tasklet_kill(&smc->tasklet); -- } -- if (smc->use_enable_pin) -- _gpio_free(smc->enable_pin, SMC_ENABLE_PIN_NAME); -- reset_control_assert(aml_smartcard_reset_ctrl); --#if 0 -- if (smc->pin_clk_pin != -1) -- _gpio_free(smc->pin_clk_pin, SMC_CLK_PIN_NAME); --#endif --#ifdef DET_FROM_PIO -- if (smc->detect_pin != NULL) -- _gpio_free(smc->detect_pin, SMC_DETECT_PIN_NAME); --#endif --#ifdef RST_FROM_PIO -- if (smc->reset_pin != NULL) -- _gpio_free(smc->reset_pin, SMC_RESET_PIN_NAME); --#endif --#ifdef CONFIG_OF -- if (smc->pinctrl) -- devm_pinctrl_put(smc->pinctrl); --#endif -- if (smc->dev) -- device_destroy(&smc_class, MKDEV(smc_major, smc->id)); -- -- mutex_destroy(&smc->lock); -- -- smc->init = 0; -- --#if defined(MESON_CPU_TYPE_MESON8) && (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8) -- CLK_GATE_OFF(SMART_CARD_MPEG_DOMAIN); --#endif -- --} -- --static int _set_gpio(struct smc_dev *smc, struct gpio_desc **gpiod, -- char *str, int input_output, int output_level) --{ -- int ret = 0; -- *gpiod = gpiod_get(&smc->pdev->dev, str); -- /*pr_dbg("smc _set_gpio %s %p\n", str, *gpiod);*/ -- if (IS_ERR(*gpiod)) { -- pr_dbg("smc %s request failed\n", str); -- return -1; -- } -- if (input_output == OUTPUT) -- ret = gpiod_direction_output(*gpiod, output_level); -- else if (input_output == INPUT) { -- ret = gpiod_direction_input(*gpiod); -- ret |= gpiod_set_pullup(*gpiod, 1); -- } else -- pr_dbg("SMC Request gpio direction invalid\n"); -- -- return ret; --} --static int smc_dev_init(struct smc_dev *smc, int id) --{ --#ifndef CONFIG_OF -- struct resource *res; --#else -- int ret; -- u32 value; -- char buf[32]; -- const char *dts_str; --#endif -- --#if defined(MESON_CPU_TYPE_MESON8) && (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8) -- CLK_GATE_ON(SMART_CARD_MPEG_DOMAIN); --#error --#endif -- /*of_match_node(smc_dt_match, smc->pdev->dev.of_node);*/ -- smc->id = id; -- --#ifdef CONFIG_OF -- smc->pinctrl = devm_pinctrl_get_select_default(&smc->pdev->dev); -- if (IS_ERR(smc->pinctrl)) -- return -1; -- -- of_property_read_string(smc->pdev->dev.of_node, -- "smc_need_enable_pin", &dts_str); -- if (strcmp(dts_str, "yes") == 0) -- smc->use_enable_pin = 1; -- else -- smc->use_enable_pin = 0; -- if (smc->use_enable_pin == 1) { -- smc->enable_pin = NULL; -- if (smc->enable_pin == NULL) { -- snprintf(buf, sizeof(buf), "smc%d_enable_pin", id); -- _set_gpio(smc, &smc->enable_pin, "enable_pin", -- OUTPUT, OUTLEVEL_HIGH); --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else { -- smc->enable_pin = res->start; -- _gpio_request(smc->enable_pin, -- SMC_ENABLE_PIN_NAME); -- } --#endif /*CONFIG_OF*/ -- } -- -- if (smc->use_enable_pin) { -- snprintf(buf, sizeof(buf), "smc%d_enable_level", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, -- buf, &value); -- if (!ret) { -- smc->enable_level = value; -- pr_error("%s: %d\n", buf, smc->enable_level); -- if (smc->enable_pin != NULL) { -- _gpio_out(smc->enable_pin, -- !smc->enable_level, -- SMC_ENABLE_PIN_NAME); -- pr_error("enable_pin: -->(%d)\n", -- (!smc->enable_level)?1:0); -- } -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->enable_level = res->start; --#endif /*CONFIG_OF*/ -- } -- } else -- pr_dbg("Smartcard is working with no enable pin\n"); -- --#ifdef CONFIG_OF -- smc->reset_pin = NULL; -- ret = _set_gpio(smc, &smc->reset_pin, "reset_pin", -- OUTPUT, OUTLEVEL_HIGH); -- if (ret) { -- pr_dbg("smc reset pin request failed, we can not work now\n"); -- return -1; -- } -- ret = of_property_read_u32(smc->pdev->dev.of_node, -- "reset_level", &value); -- smc->reset_level = value; -- pr_dbg("smc reset_level %d\n", value); -- --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->reset_level = res->start; --#endif /*CONFIG_OF*/ -- smc->irq_num = smc0_irq; -- if (smc->irq_num == -1) { -- snprintf(buf, sizeof(buf), "smc%d_irq", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->irq_num = value; -- pr_error("%s: %d\n", buf, smc->irq_num); -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- return -1; -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_IRQ, buf); -- if (!res) { -- pr_error("cannot get resource \"%s\"\n", buf); -- return -1; -- } -- smc->irq_num = res->start; --#endif /*CONFIG_OF*/ -- } -- smc->pin_clk_pinmux_reg = -1; -- if (smc->pin_clk_pinmux_reg == -1) { -- snprintf(buf, sizeof(buf), "smc%d_clk_pinmux_reg", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->pin_clk_pinmux_reg = value; -- pr_error("%s: 0x%x\n", buf, smc->pin_clk_pinmux_reg); -- } else -- pr_error("cannot find resource \"%s\"\n", buf); --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->pin_clk_pinmux_reg = res->start; --#endif /*CONFIG_OF*/ -- } --#if 1 -- smc->pin_clk_pinmux_bit = -1; -- if (smc->pin_clk_pinmux_bit == -1) { -- snprintf(buf, sizeof(buf), "smc%d_clk_pinmux_bit", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->pin_clk_pinmux_bit = value; -- pr_error("%s: 0x%x\n", buf, smc->pin_clk_pinmux_bit); -- } else -- pr_error("cannot find resource \"%s\"\n", buf); -- /*TODO:*/ --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->pin_clk_pinmux_bit = res->start; --#endif /*CONFIG_OF*/ -- } --#endif -- smc->pin_clk_oen_reg = -1; -- if (smc->pin_clk_oen_reg == -1) { -- snprintf(buf, sizeof(buf), "smc%d_clk_oen_reg", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->pin_clk_oen_reg = value; -- pr_error("%s: 0x%x\n", buf, smc->pin_clk_oen_reg); -- } else -- pr_error("cannot find resource \"%s\"\n", buf); --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else { -- smc->pin_clk_oen_reg = res->start; --#endif /*CONFIG_OF*/ -- } -- -- smc->pin_clk_out_reg = -1; -- if (smc->pin_clk_out_reg == -1) { -- snprintf(buf, sizeof(buf), "smc%d_clk_out_reg", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->pin_clk_out_reg = value; -- pr_error("%s: 0x%x\n", buf, smc->pin_clk_out_reg); -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->pin_clk_out_reg = res->start; --#endif /*CONFIG_OF*/ -- } -- -- smc->pin_clk_oebit = -1; -- if (smc->pin_clk_oebit == -1) { -- snprintf(buf, sizeof(buf), "smc%d_clk_oebit", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->pin_clk_oebit = value; -- pr_error("%s: 0x%x\n", buf, smc->pin_clk_oebit); -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->pin_clk_oebit = res->start; --#endif /*CONFIG_OF*/ -- } -- smc->pin_clk_oubit = -1; -- if (smc->pin_clk_oubit == -1) { -- snprintf(buf, sizeof(buf), "smc%d_clk_oubit", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->pin_clk_oubit = value; -- pr_error("%s: 0x%x\n", buf, smc->pin_clk_oubit); -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->pin_clk_oubit = res->start; --#endif /*CONFIG_OF*/ -- } -- --#ifdef DET_FROM_PIO -- smc->detect_pin = NULL; -- if (smc->detect_pin == NULL) { --#ifdef CONFIG_OF -- ret = _set_gpio(smc, &smc->detect_pin, "detect_pin", INPUT, 0); -- if (ret) { -- pr_dbg("smc detect_pin request failed, we can not work\n"); -- return -1; -- } --#endif --#else /*CONFIG_OF*/ -- ret = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!ret) { -- pr_error("cannot get resource \"%s\"\n", buf); -- } else { -- smc->detect_pin = res->start; -- _gpio_request(smc->detect_pin, SMC_DETECT_PIN_NAME); -- } --#endif /*CONFIG_OF*/ -- } -- if (1) { -- snprintf(buf, sizeof(buf), "smc%d_clock_source", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- clock_source = value; -- pr_error("%s: %d\n", buf, clock_source); -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- pr_error("using clock source default: %d\n", -- clock_source); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) { -- pr_error("cannot get resource \"%s\"\n", buf); -- pr_error("using clock source default: %d\n", -- clock_source); -- } else { -- clock_source = res->start; -- } --#endif /*CONFIG_OF*/ -- } -- smc->detect_invert = 0; -- if (1) { -- snprintf(buf, sizeof(buf), "smc%d_det_invert", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->detect_invert = value; -- pr_error("%s: %d\n", buf, smc->detect_invert); -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->detect_invert = res->start; --#endif /*CONFIG_OF*/ -- } --#if 1 -- smc->enable_5v3v_pin = NULL; -- if (smc->enable_5v3v_pin == NULL) { -- snprintf(buf, sizeof(buf), "smc%d_5v3v_pin", id); --#ifdef CONFIG_OF -- ret = _set_gpio(smc, &smc->enable_5v3v_pin, -- "enable_5v3v_pin", OUTPUT, OUTLEVEL_HIGH); -- if (ret == -1) -- pr_dbg("smc 5v3v_pin is not working, we might face some problems\n"); --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) { -- pr_error("cannot get resource \"%s\"\n", buf); -- } else { -- smc->enable_5v3v_pin = res->start; -- _gpio_request(smc->enable_5v3v_pin, -- SMC_ENABLE_5V3V_PIN_NAME); -- } --#endif /*CONFIG_OF*/ -- } --#endif -- --#if 0 -- smc->enable_5v3v_level = 0; -- if (1) { -- snprintf(buf, sizeof(buf), "smc%d_5v3v_level", id); --#ifdef CONFIG_OF -- ret = of_property_read_u32(smc->pdev->dev.of_node, buf, &value); -- if (!ret) { -- smc->enable_5v3v_level = value; -- pr_error("%s: %d\n", buf, smc->enable_5v3v_level); -- if (smc->enable_5v3v_pin != -1) { -- _gpio_out(smc->enable_5v3v_pin, -- smc->enable_5v3v_level, -- SMC_ENABLE_5V3V_PIN_NAME); -- pr_error("5v3v_pin: -->(%d)\n", -- (smc->enable_5v3v_level) ? 1 : 0); -- } -- } else { -- pr_error("cannot find resource \"%s\"\n", buf); -- } --#else /*CONFIG_OF*/ -- res = platform_get_resource_byname(smc->pdev, -- IORESOURCE_MEM, buf); -- if (!res) -- pr_error("cannot get resource \"%s\"\n", buf); -- else -- smc->enable_5v3v_level = res->start; --#endif /*CONFIG_OF*/ -- } --#endif -- -- init_waitqueue_head(&smc->rd_wq); -- init_waitqueue_head(&smc->wr_wq); -- -- spin_lock_init(&smc->slock); -- mutex_init(&smc->lock); -- --#ifdef SMC_FIQ -- { -- int r = -1; -- smc->smc_fiq_bridge.handle = smc_bridge_isr; -- smc->smc_fiq_bridge.key = (u32)smc; -- smc->smc_fiq_bridge.name = "smc_bridge_isr"; -- r = register_fiq_bridge_handle(&smc->smc_fiq_bridge); -- if (r) { -- pr_error("smc fiq bridge register error.\n"); -- return -1; -- } -- } -- request_fiq(smc->irq_num, &smc_irq_handler); --#else -- smc->irq_num = request_irq(smc->irq_num, -- (irq_handler_t)smc_irq_handler, -- IRQF_SHARED, "smc", smc); -- if (smc->irq_num < 0) { -- pr_error("request irq error!\n"); -- smc_dev_deinit(smc); -- return -1; -- } -- -- tasklet_init(&smc->tasklet, smc_irq_bh_handler, (unsigned long)smc); --#endif -- snprintf(buf, sizeof(buf), "smc%d", smc->id); -- smc->dev = device_create(&smc_class, -- NULL, MKDEV(smc_major, smc->id), smc, buf); -- if (!smc->dev) { -- pr_error("create device error!\n"); -- smc_dev_deinit(smc); -- return -1; -- } -- -- smc_default_init(smc); -- -- smc->init = 1; -- -- smc_hw_setup(smc); -- -- return 0; --} -- --static int smc_open(struct inode *inode, struct file *filp) --{ -- int id = iminor(inode); -- struct smc_dev *smc = NULL; -- id = 0; -- smc = &smc_dev[id]; -- mutex_init(&smc->lock); -- mutex_lock(&smc->lock); -- --#ifdef FILE_DEBUG -- open_debug(); --#endif -- -- if (smc->used) { -- mutex_unlock(&smc->lock); -- pr_error("smartcard %d already openned!", id); -- return -EBUSY; -- } -- -- smc->used = 1; -- --#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 -- switch_mod_gate_by_name("smart_card", 1); --#endif -- -- mutex_unlock(&smc->lock); -- -- filp->private_data = smc; -- -- return 0; --} -- --static int smc_close(struct inode *inode, struct file *filp) --{ -- struct smc_dev *smc = (struct smc_dev *)filp->private_data; -- -- mutex_lock(&smc->lock); -- -- smc_hw_deactive(smc); -- --#ifndef KEEP_PARAM_AFTER_CLOSE -- smc_default_init(smc); --#endif -- -- smc->used = 0; -- --#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 -- switch_mod_gate_by_name("smart_card", 0); --#endif -- --#ifdef FILE_DEBUG -- close_debug(); --#endif -- -- mutex_unlock(&smc->lock); -- -- return 0; --} -- --static ssize_t smc_read(struct file *filp, -- char __user *buff, size_t size, loff_t *ppos) --{ -- struct smc_dev *smc = (struct smc_dev *)filp->private_data; -- unsigned long flags; -- int ret; -- int start = 0, end; -- -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- -- spin_lock_irqsave(&smc->slock, flags); -- if (ret == 0) { -- -- start = smc->recv_start; -- end = smc->recv_end; -- -- if (!smc->cardin) { -- ret = -ENODEV; -- } else if (start == end) { -- ret = -EAGAIN; -- } else { -- ret = (end > start) ? (end-start) : -- (RECV_BUF_SIZE-start+end); -- if (ret > size) -- ret = size; -- } -- } -- -- if (ret > 0) { -- int cnt = RECV_BUF_SIZE-start; -- long cr; -- -- pr_dbg("read %d bytes\n", ret); -- if (cnt >= ret) { -- cr = copy_to_user(buff, smc->recv_buf+start, ret); -- } else { -- int cnt1 = ret-cnt; -- cr = copy_to_user(buff, smc->recv_buf+start, cnt); -- cr = copy_to_user(buff+cnt, smc->recv_buf, cnt1); -- } -- _atomic_wrap_add(&smc->recv_start, ret, RECV_BUF_SIZE); -- } -- spin_unlock_irqrestore(&smc->slock, flags); -- -- mutex_unlock(&smc->lock); -- -- return ret; --} -- --static ssize_t smc_write(struct file *filp, -- const char __user *buff, size_t size, loff_t *offp) --{ -- struct smc_dev *smc = (struct smc_dev *)filp->private_data; -- unsigned long flags; -- int ret; -- unsigned long sc_int; -- struct SMC_INTERRUPT_Reg *sc_int_reg = (void *)&sc_int; -- int start = 0, end; -- -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- -- spin_lock_irqsave(&smc->slock, flags); -- -- if (ret == 0) { -- -- start = smc->send_start; -- end = smc->send_end; -- -- if (!smc->cardin) { -- ret = -ENODEV; -- } else if (start != end) { -- ret = -EAGAIN; -- } else { -- ret = size; -- if (ret >= SEND_BUF_SIZE) -- ret = SEND_BUF_SIZE-1; -- } -- } -- -- if (ret > 0) { -- int cnt = SEND_BUF_SIZE-start; -- long cr; -- -- if (cnt >= ret) { -- cr = copy_from_user(smc->send_buf+start, buff, ret); -- } else { -- int cnt1 = ret-cnt; -- cr = copy_from_user(smc->send_buf+start, buff, cnt); -- cr = copy_from_user(smc->send_buf, buff+cnt, cnt1); -- } -- _atomic_wrap_add(&smc->send_start, ret, SEND_BUF_SIZE); -- } -- -- spin_unlock_irqrestore(&smc->slock, flags); -- -- if (ret > 0) { -- sc_int = SMC_READ_REG(INTR); --#ifdef DISABLE_RECV_INT -- sc_int_reg->recv_fifo_bytes_threshold_int_mask = 0; --#endif -- sc_int_reg->send_fifo_last_byte_int_mask = 1; -- SMC_WRITE_REG(INTR, sc_int|0x3FF); -- -- pr_dbg("write %d bytes\n", ret); -- -- smc_hw_start_send(smc); -- } -- -- mutex_unlock(&smc->lock); -- -- return ret; --} -- --static unsigned int smc_poll(struct file *filp, -- struct poll_table_struct *wait) --{ -- struct smc_dev *smc = (struct smc_dev *)filp->private_data; -- unsigned int ret = 0; -- unsigned long flags; -- -- poll_wait(filp, &smc->rd_wq, wait); -- poll_wait(filp, &smc->wr_wq, wait); -- -- spin_lock_irqsave(&smc->slock, flags); -- -- if (smc->recv_start != smc->recv_end) -- ret |= POLLIN|POLLRDNORM; -- if (smc->send_start == smc->send_end) -- ret |= POLLOUT|POLLWRNORM; -- if (!smc->cardin) -- ret |= POLLERR; -- -- spin_unlock_irqrestore(&smc->slock, flags); -- -- return ret; --} -- --static long smc_ioctl(struct file *file, unsigned int cmd, ulong arg) --{ -- struct smc_dev *smc = (struct smc_dev *)file->private_data; -- int ret = 0; -- long cr; -- switch (cmd) { -- case AMSMC_IOC_RESET: -- { -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- ret = smc_hw_reset(smc); -- if (ret >= 0) -- cr = copy_to_user((void *)arg, &smc->atr, -- sizeof(struct am_smc_atr)); -- mutex_unlock(&smc->lock); -- } -- break; -- case AMSMC_IOC_GET_STATUS: -- { -- int status; -- smc_hw_get_status(smc, &status); -- cr = copy_to_user((void *)arg, &status, sizeof(int)); -- } -- break; -- case AMSMC_IOC_ACTIVE: -- { -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- -- ret = smc_hw_active(smc); -- -- mutex_unlock(&smc->lock); -- } -- break; -- case AMSMC_IOC_DEACTIVE: -- { -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- -- ret = smc_hw_deactive(smc); -- -- mutex_unlock(&smc->lock); -- } -- break; -- case AMSMC_IOC_GET_PARAM: -- { -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- cr = copy_to_user((void *)arg, &smc->param, -- sizeof(struct am_smc_param)); -- -- mutex_unlock(&smc->lock); -- } -- break; -- case AMSMC_IOC_SET_PARAM: -- { -- ret = mutex_lock_interruptible(&smc->lock); -- if (ret) -- return ret; -- -- cr = copy_from_user(&smc->param, (void *)arg, -- sizeof(struct am_smc_param)); -- ret = smc_hw_set_param(smc); -- -- mutex_unlock(&smc->lock); -- } -- break; -- default: -- ret = -EINVAL; -- break; -- } -- -- return ret; --} -- --#ifdef CONFIG_COMPAT --static long smc_ioctl_compat(struct file *filp, -- unsigned int cmd, unsigned long args) --{ -- unsigned long ret; -- -- args = (unsigned long)compat_ptr(args); -- ret = smc_ioctl(filp, cmd, args); -- return ret; --} --#endif -- -- --static const struct file_operations smc_fops = { -- .owner = THIS_MODULE, -- .open = smc_open, -- .write = smc_write, -- .read = smc_read, -- .release = smc_close, -- .unlocked_ioctl = smc_ioctl, -- .poll = smc_poll, --#ifdef CONFIG_COMPAT -- .compat_ioctl = smc_ioctl_compat, --#endif --}; -- --static int smc_probe(struct platform_device *pdev) --{ -- struct smc_dev *smc = NULL; -- int i, ret; -- mutex_lock(&smc_lock); -- -- for (i = 0; i < SMC_DEV_COUNT; i++) { -- if (!smc_dev[i].init) { -- smc = &smc_dev[i]; -- break; -- } -- } -- aml_smartcard_reset_ctrl = -- devm_reset_control_get(&pdev->dev, "smartcard"); -- reset_control_deassert(aml_smartcard_reset_ctrl); -- if (smc) { -- smc->init = 1; -- smc->pdev = pdev; -- dev_set_drvdata(&pdev->dev, smc); -- ret = smc_dev_init(smc, i); -- if (ret < 0) -- smc = NULL; -- } -- -- mutex_unlock(&smc_lock); -- -- return smc ? 0 : -1; --} -- --static int smc_remove(struct platform_device *pdev) --{ -- struct smc_dev *smc = (struct smc_dev *)dev_get_drvdata(&pdev->dev); -- -- mutex_lock(&smc_lock); -- -- smc_dev_deinit(smc); -- -- mutex_unlock(&smc_lock); -- -- return 0; --} -- --static struct platform_driver smc_driver = { -- .probe = smc_probe, -- .remove = smc_remove, -- .driver = { -- .name = "amlogic-smc", -- .owner = THIS_MODULE, -- .of_match_table = smc_dt_match, -- }, --}; -- --static int __init smc_mod_init(void) --{ -- int ret = -1; -- -- mutex_init(&smc_lock); -- smc_major = register_chrdev(0, SMC_DEV_NAME, &smc_fops); -- if (smc_major <= 0) { -- mutex_destroy(&smc_lock); -- pr_error("register chrdev error\n"); -- goto error_register_chrdev; -- } -- -- if (class_register(&smc_class) < 0) { -- pr_error("register class error\n"); -- goto error_class_register; -- } -- -- if (platform_driver_register(&smc_driver) < 0) { -- pr_error("register platform driver error\n"); -- goto error_platform_drv_register; -- } -- return 0; --error_platform_drv_register: -- class_unregister(&smc_class); --error_class_register: -- unregister_chrdev(smc_major, SMC_DEV_NAME); --error_register_chrdev: -- mutex_destroy(&smc_lock); -- return ret; --} -- --static void __exit smc_mod_exit(void) --{ -- platform_driver_unregister(&smc_driver); -- class_unregister(&smc_class); -- unregister_chrdev(smc_major, SMC_DEV_NAME); -- mutex_destroy(&smc_lock); --} -- --module_init(smc_mod_init); -- --module_exit(smc_mod_exit); -- --MODULE_AUTHOR("AMLOGIC"); -- --MODULE_DESCRIPTION("AMLOGIC smart card driver"); -- --MODULE_LICENSE("GPL"); -diff --git a/drivers/amlogic/dvb_tv/smartcard/smartcard.h b/drivers/amlogic/dvb_tv/smartcard/smartcard.h -deleted file mode 100644 -index 07a9035..0000000 ---- a/drivers/amlogic/dvb_tv/smartcard/smartcard.h -+++ /dev/null -@@ -1,8 +0,0 @@ --#ifndef _AML_SMC_H_ --#define _AML_SMC_H_ --extern int amlogic_gpio_name_map_num(const char *name); --extern int amlogic_gpio_direction_output(unsigned int pin, int value, -- const char *owner); --extern int amlogic_gpio_request(unsigned int pin, const char *label); --extern unsigned long get_mpeg_clk(void); --#endif -diff --git a/drivers/amlogic/dvb_tv/smc_reg.h b/drivers/amlogic/dvb_tv/smc_reg.h -deleted file mode 100644 -index 6cecdaa..0000000 ---- a/drivers/amlogic/dvb_tv/smc_reg.h -+++ /dev/null -@@ -1,262 +0,0 @@ --/* -- * AMLOGIC Smart card driver. -- * -- * 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 named License, -- * or any later version. -- * -- * This program 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. -- */ -- --#ifndef _SMC_REG_H --#define _SMC_REG_H -- --#include -- --#ifdef __LITTLE_ENDIAN --#ifndef __LITTLE_ENDIAN__ --#define __LITTLE_ENDIAN__ --#endif --#endif -- --#define F_DEFAULT 372 --#define D_DEFAULT 1 --#define FREQ_DEFAULT 4000 /*KHz*/ --#define FIFO_THRESHOLD_DEFAULT 1 --#define ETU_DIVIDER_CLOCK_HZ 24000 /* KHz*/ --#define ETU_CLK_SEL 0 --#define ATR_HOLDOFF_EN 1 --#define ATR_CLK_MUX_DEFAULT 4 --#define ATR_HOLDOFF_TCNT_DEFAULT 255 --#define ATR_FINAL_TCNT_DEFAULT 40000 --#define DET_FILTER_SEL_DEFAULT 3 --#define IO_FILTER_SEL_DEFAULT 3 --#define BWT_BASE_DEFAULT 999 --#define N_DEFAULT 0 --#define CWI_DEFAULT 13 --#define BWI_DEFAULT 4 --#define BGT_DEFAULT 22 -- --struct SMCCARD_HW_Reg0 { --#ifdef __LITTLE_ENDIAN__ -- unsigned etu_divider:16; /* Bit 15:0*/ -- unsigned first_etu_offset:3; /* Bit 18:16*/ -- unsigned enable:1; /* Bit 19*/ -- unsigned recv_fifo_threshold:4; /* Bit 23:20*/ -- unsigned clk_en:1; /* Bit 24*/ -- unsigned clk_oen:1; /* Bit 25*/ -- unsigned rst_level:1; /* Bit 26*/ -- unsigned start_atr:1; /* Bit 27*/ -- unsigned unused:1; /* Bit 28*/ -- unsigned io_level:1; /* Bit 29*/ -- unsigned card_detect:1; /* Bit 30*/ -- unsigned start_atr_en:1; /* Bit 31*/ --#else -- unsigned start_atr_en:1; /* Bit 31*/ -- unsigned card_detect:1; /* Bit 30*/ -- unsigned io_level:1; /* Bit 29*/ -- unsigned unused:1; /* Bit 28*/ -- unsigned start_atr:1; /* Bit 27*/ -- unsigned rst_level:1; /* Bit 26*/ -- unsigned clk_oen:1; /* Bit 25*/ -- unsigned clk_en:1; /* Bit 24*/ -- unsigned recv_fifo_threshold:4; /* Bit 23:20*/ -- unsigned enable:1; /* Bit 19*/ -- unsigned first_etu_offset:3; /* Bit 18:16*/ -- unsigned etu_divider:16; /* Bit 15:0*/ --#endif --}; -- --struct SMC_ANSWER_TO_RST { --#ifdef __LITTLE_ENDIAN__ -- unsigned atr_final_tcnt:16; /* Bit 15:0*/ -- unsigned atr_holdoff_tcnt:8; /* Bit 23:16*/ -- unsigned atr_clk_mux:3; /* Bit 26:24*/ -- unsigned atr_holdoff_en:1; /* Bit 27*/ -- unsigned etu_clk_sel:2; /* Bit 29:28*/ -- unsigned unused:2; /* Bit 31:30*/ --#else -- unsigned unused:2; /* Bit 31:30*/ -- unsigned etu_clk_sel:2; /* Bit 29:28*/ -- unsigned atr_holdoff_en:1; /* Bit 27*/ -- unsigned atr_clk_mux:3; /* Bit 26:24*/ -- unsigned atr_holdoff_tcnt:8; /* Bit 23:16*/ -- unsigned atr_final_tcnt:16; /* Bit 15:0*/ --#endif --}; -- --struct SMCCARD_HW_Reg2 { --#ifdef __LITTLE_ENDIAN__ -- unsigned xmit_invert:1; /* Bit 0*/ -- unsigned xmit_lsb_msb:1; /* Bit 1*/ -- unsigned xmit_parity:1; /* Bit 2*/ -- unsigned xmit_retries:3; /* Bit 5:3*/ -- unsigned xmit_repeat_dis:1; /* Bit 6*/ -- unsigned recv_invert:1; /* Bit 7*/ -- unsigned recv_lsb_msb:1; /* Bit 8*/ -- unsigned recv_parity:1; /* Bit 9*/ -- unsigned recv_no_parity:1; /* Bit 10*/ -- unsigned pulse_irq:1; /* Bit 11*/ -- unsigned clk_tcnt:8; /* Bit 19:12*/ -- unsigned det_filter_sel:3; /* Bit 22:20*/ -- unsigned io_filter_sel:3; /* Bit 25:23*/ -- unsigned recv_retry_cnt:3; /* Bit 28:26*/ -- unsigned reserved:1; /* Bit 29*/ -- unsigned clk_sel:2; /* Bit 31:30*/ --#else -- unsigned clk_sel:2; /* Bit 31:30*/ -- unsigned reserved:1; /* Bit 29*/ -- unsigned recv_retry_cnt:3; /* Bit 28:26*/ -- unsigned io_filter_sel:3; /* Bit 25:23*/ -- unsigned det_filter_sel:3; /* Bit 22:20*/ -- unsigned clk_tcnt:8; /* Bit 19:12*/ -- unsigned pulse_irq:1; /* Bit 11*/ -- unsigned recv_no_parity:1; /* Bit 10*/ -- unsigned recv_parity:1; /* Bit 9*/ -- unsigned recv_lsb_msb:1; /* Bit 8*/ -- unsigned recv_invert:1; /* Bit 7*/ -- unsigned xmit_repeat_dis:1; /* Bit 6*/ -- unsigned xmit_retries:3; /* Bit 5:3*/ -- unsigned xmit_parity:1; /* Bit 2*/ -- unsigned xmit_lsb_msb:1; /* Bit 1*/ -- unsigned xmit_invert:1; /* Bit 0*/ --#endif --}; -- --struct SMC_STATUS_Reg { --#ifdef __LITTLE_ENDIAN__ -- unsigned recv_fifo_threshold_status:1; /* Bit 0*/ -- unsigned send_fifo_last_byte_status:1; /* Bit 1*/ -- unsigned cwt_expeired_status:1; /* Bit 2*/ -- unsigned bwt_expeired_status:1; /* Bit 3*/ -- unsigned write_full_send_fifo_status:1; /* Bit 4*/ -- unsigned send_and_recv_confilt_status:1; /* Bit 5*/ -- unsigned recv_error_status:1; /* Bit 6*/ -- unsigned send_error_status:1; /* Bit 7*/ -- unsigned rst_expired_status:1; /* Bit 8*/ -- unsigned card_detect_status:1; /* Bit 9*/ -- unsigned unused:6; /* Bit 15:10*/ -- unsigned recv_fifo_bytes_number:4; /* Bit 19:16*/ -- unsigned recv_fifo_empty_status:1; /* Bit 20*/ -- unsigned recv_fifo_full_status:1; /* Bit 21*/ -- unsigned send_fifo_bytes_number:4; /* Bit 25:22*/ -- unsigned send_fifo_empty_status:1; /* Bit 26*/ -- unsigned send_fifo_full_status:1; /* Bit 27*/ -- unsigned recv_data_from_card_status:1; /* Bit 28*/ -- unsigned recv_module_enable_status:1; /* Bit 29*/ -- unsigned send_module_enable_status:1; /* Bit 30*/ -- unsigned wait_for_atr_status:1; /* Bit 31*/ --#else -- unsigned wait_for_atr_status:1; /* Bit 31*/ -- unsigned send_module_enable_status:1; /* Bit 30*/ -- unsigned recv_module_enable_status:1; /* Bit 29*/ -- unsigned recv_data_from_card_status:1; /* Bit 28*/ -- unsigned send_fifo_full_status:1; /* Bit 27*/ -- unsigned send_fifo_empty_status:1; /* Bit 26*/ -- unsigned send_fifo_bytes_number:4; /* Bit 25:22*/ -- unsigned recv_fifo_full_status:1; /* Bit 21*/ -- unsigned recv_fifo_empty_status:1; /* Bit 20*/ -- unsigned recv_fifo_bytes_number:4; /* Bit 19:16*/ -- unsigned unused:6; /* Bit 15:10*/ -- unsigned card_detect_status:1; /* Bit 9*/ -- unsigned rst_expired_status:1; /* Bit 8*/ -- unsigned send_error_status:1; /* Bit 7*/ -- unsigned recv_error_status:1; /* Bit 6*/ -- unsigned send_and_recv_confilt_status:1; /* Bit 5*/ -- unsigned write_full_send_fifo_status:1; /* Bit 4*/ -- unsigned bwt_expeired_status:1; /* Bit 3*/ -- unsigned cwt_expeired_status:1; /* Bit 2*/ -- unsigned send_fifo_last_byte_status:1; /* Bit 1*/ -- unsigned recv_fifo_threshold_status:1; /* Bit 0*/ --#endif --}; -- --struct SMC_INTERRUPT_Reg { --#ifdef __LITTLE_ENDIAN__ -- unsigned recv_fifo_bytes_threshold_int:1; /* Bit 0*/ -- unsigned send_fifo_last_byte_int:1; /* Bit 1*/ -- unsigned cwt_expeired_int:1; /* Bit 2*/ -- unsigned bwt_expeired_int:1; /* Bit 3*/ -- unsigned write_full_fifo_int:1; /* Bit 4*/ -- unsigned send_and_recv_confilt_int:1; /* Bit 5*/ -- unsigned recv_error_int:1; /* Bit 6*/ -- unsigned send_error_int:1; /* Bit 7*/ -- unsigned rst_expired_int:1; /* Bit 8*/ -- unsigned card_detect_int:1; /* Bit 9*/ -- unsigned unused1:6; /* Bit 15:10*/ -- unsigned recv_fifo_bytes_threshold_int_mask:1; /* Bit 16*/ -- unsigned send_fifo_last_byte_int_mask:1; /* Bit 17*/ -- unsigned cwt_expeired_int_mask:1; /* Bit 18*/ -- unsigned bwt_expeired_int_mask:1; /* Bit 19*/ -- unsigned write_full_fifo_int_mask:1; /* Bit 20*/ -- unsigned send_and_recv_confilt_int_mask:1; /* Bit 21*/ -- unsigned recv_error_int_mask:1; /* Bit 22*/ -- unsigned send_error_int_mask:1; /* Bit 23*/ -- unsigned rst_expired_int_mask:1; /* Bit 24*/ -- unsigned card_detect_int_mask:1; /* Bit 25*/ -- unsigned unused2:6; /* Bit 31:26*/ --#else -- unsigned unused2:6; /* Bit 31:26*/ -- unsigned card_detect_int_mask:1; /* Bit 25*/ -- unsigned rst_expired_int_mask:1; /* Bit 24*/ -- unsigned send_error_int_mask:1; /* Bit 23*/ -- unsigned recv_error_int_mask:1; /* Bit 22*/ -- unsigned send_and_recv_confilt_int_mask:1; /* Bit 21*/ -- unsigned write_full_fifo_int_mask:1; /* Bit 20*/ -- unsigned bwt_expeired_int_mask:1; /* Bit 19*/ -- unsigned cwt_expeired_int_mask:1; /* Bit 18*/ -- unsigned send_fifo_last_byte_int_mask:1; /* Bit 17*/ -- unsigned recv_fifo_bytes_threshold_int_mask:1; /* Bit 16*/ -- unsigned unused1:6; /* Bit 15:10*/ -- unsigned card_detect_int:1; /* Bit 9*/ -- unsigned rst_expired_int:1; /* Bit 8*/ -- unsigned send_error_int:1; /* Bit 7*/ -- unsigned recv_error_int:1; /* Bit 6*/ -- unsigned send_and_recv_confilt_int:1; /* Bit 5*/ -- unsigned write_full_fifo_int:1; /* Bit 4*/ -- unsigned bwt_expeired_int:1; /* Bit 3*/ -- unsigned cwt_expeired_int:1; /* Bit 2*/ -- unsigned send_fifo_last_byte_int:1; /* Bit 1*/ -- unsigned recv_fifo_bytes_threshold_int:1; /* Bit 0*/ --#endif --}; -- --struct SMCCARD_HW_Reg5 { --#ifdef __LITTLE_ENDIAN__ -- unsigned bwt_base_time_gnt:16; /* Bit 15:0*/ -- unsigned btw_detect_en:1; /* Bit 16*/ -- unsigned cwt_detect_en:1; /* Bit 17*/ -- unsigned etu_msr_en:1; /* Bit 18*/ -- unsigned unused:1; /* Bit 19*/ -- unsigned etu_msr_cnt:12; /* Bit 31:20*/ --#else -- unsigned etu_msr_cnt:12; /* Bit 31:20*/ -- unsigned unused:1; /* Bit 19*/ -- unsigned etu_msr_en:1; /* Bit 18*/ -- unsigned cwt_detect_en:1; /* Bit 17*/ -- unsigned btw_detect_en:1; /* Bit 16*/ -- unsigned bwt_base_time_gnt:16; /* Bit 15:0*/ --#endif --}; -- --struct SMCCARD_HW_Reg6 { --#ifdef __LITTLE_ENDIAN__ -- unsigned N_parameter:8; /* Bit 7:0*/ -- unsigned cwi_value:4; /* Bit 11:8*/ -- unsigned bgt:8; /* Bit 19:12*/ -- unsigned bwi:4; /* Bit 23:20*/ -- unsigned unused:8; /* Bit 31:24*/ --#else -- unsigned unused:8; /* Bit 31:24*/ -- unsigned bwi:4; /* Bit 23:20*/ -- unsigned bgt:8; /* Bit 19:12*/ -- unsigned cwi_value:4; /* Bit 11:8*/ -- unsigned N_parameter:8; /* Bit 7:0*/ --#endif --}; -- --#endif --- -1.7.10.4 - diff --git a/projects/imx6/bootloader/uEnv-matrix.txt b/projects/imx6/bootloader/uEnv-matrix.txt deleted file mode 100644 index f6d06340d2..0000000000 --- a/projects/imx6/bootloader/uEnv-matrix.txt +++ /dev/null @@ -1,17 +0,0 @@ -# make boot more quiet -console_arg=quiet morequiet -# or having quiet and serial console -#console_arg=console=ttymxc0,115200 quiet morequiet -# show messages in serial console -#console_arg=console=ttymxc0,115200 no_console_suspend=1 - -# enable ssh -#ssh_arg=ssh - -# enable debugging (kodi debug) -#debugging_arg=debugging - -zImage=/KERNEL -bootfile=/KERNEL -mmcargs=setenv bootargs "boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ${ssh_arg} ${console_arg} ${debugging_arg} video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 dmfc=3 consoleblank=0" -uenvcmd=if test -n $ethaddr; then true; else setenv ethaddr 1E:ED:19:27:1A:B2; fi diff --git a/projects/imx6/bootloader/uEnv-udoo.txt b/projects/imx6/bootloader/uEnv-udoo.txt deleted file mode 100644 index a23d57f235..0000000000 --- a/projects/imx6/bootloader/uEnv-udoo.txt +++ /dev/null @@ -1,32 +0,0 @@ - -# enable only one video section - -# HDMI -video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32 - -# 7" LVDS -#video=mxcfb0:dev=ldb,800x480M@60,if=RGB666,bpp=32 -#fdt_file=imx6q-udoo-7lvds.dtb -#fdt_file=imx6dl-udoo-7lvds.dtb - -# 15.6" LVDS -#video=mxcfb0:dev=ldb,1360x768M@60,if=RGB24,bpp=32 -#fdt_file=imx6q-udoo-15lvds.dtb -#fdt_file=imx6dl-udoo-15lvds.dtb - -# make boot more quiet -console_arg=quiet morequiet -# or having quiet and serial console -#console_arg=console=ttymxc0,115200 quiet morequiet -# show messages in serial console -#console_arg=console=ttymxc0,115200 no_console_suspend=1 - -# enable ssh -#ssh_arg=ssh - -# enable debugging (kodi debug) -#debugging_arg=debugging - -zImage=/KERNEL -bootfile=/KERNEL -mmcargs=setenv bootargs boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ${ssh_arg} ${console_arg} ${debugging_arg} video=${video} dmfc=3 consoleblank=0 diff --git a/projects/imx6/bootloader/uEnv.txt b/projects/imx6/bootloader/uEnv.txt deleted file mode 100644 index 3ff7e45c5d..0000000000 --- a/projects/imx6/bootloader/uEnv.txt +++ /dev/null @@ -1,16 +0,0 @@ -# make boot more quiet -console_arg=quiet morequiet -# or having quiet and serial console -#console_arg=console=ttymxc0,115200 quiet morequiet -# show messages in serial console -#console_arg=console=ttymxc0,115200 no_console_suspend=1 - -# enable ssh -#ssh_arg=ssh - -# enable debugging (kodi debug) -#debugging_arg=debugging - -zImage=/KERNEL -bootfile=/KERNEL -mmcargs=setenv bootargs "boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ${ssh_arg} ${console_arg} ${debugging_arg} video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 dmfc=3 consoleblank=0" diff --git a/projects/imx6/filesystem/usr/lib/systemd/system/imx6-poweroff.service b/projects/imx6/filesystem/usr/lib/systemd/system/imx6-poweroff.service deleted file mode 100644 index fe62bd2fa4..0000000000 --- a/projects/imx6/filesystem/usr/lib/systemd/system/imx6-poweroff.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=imx6 poweroff service -Before=systemd-poweroff.service -After=kodi-poweroff.service -DefaultDependencies=no - -[Service] -Type=oneshot -Environment=HOME=/storage -ExecStart=-/bin/sh -c "echo 0 > /sys/class/leds/imx6\:red\:front/brightness; echo 1 > /sys/class/graphics/fb0/blank" -StandardError=null -RemainAfterExit=yes - -[Install] -WantedBy=poweroff.target diff --git a/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service b/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 5043743699..0000000000 --- a/projects/imx6/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/ttymxc0 -DefaultDependencies=no -ConditionKernelCommandLine=console=ttymxc0,115200 - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/ttymxc0 -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/imx6/filesystem/usr/share/alsa/cards/imx-hdmi-soc.conf b/projects/imx6/filesystem/usr/share/alsa/cards/imx-hdmi-soc.conf deleted file mode 100644 index 78d5b8b6d4..0000000000 --- a/projects/imx6/filesystem/usr/share/alsa/cards/imx-hdmi-soc.conf +++ /dev/null @@ -1,32 +0,0 @@ -# -# Configuration for iMX6 HDMI output - /usr/share/alsa/cards/imx-hdmi-soc.conf -# - - - -imx-hdmi-soc.pcm.hdmi.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } - @args.AES1 { type integer } - @args.AES2 { type integer } - @args.AES3 { type integer } - type hooks - slave.pcm { - type hw - card $CARD - } - hooks.0 { - type ctl_elems - hook_args [ - { - interface MIXER - name "IEC958 Playback Default" - lock true - preserve true - optional true - value [ $AES0 $AES1 $AES2 $AES3 ] - } - ] - } -} diff --git a/projects/imx6/filesystem/usr/share/alsa/cards/imx-sgtl5000.conf b/projects/imx6/filesystem/usr/share/alsa/cards/imx-sgtl5000.conf deleted file mode 100644 index 40d2204303..0000000000 --- a/projects/imx6/filesystem/usr/share/alsa/cards/imx-sgtl5000.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -# Configuration for iMX6 sgtl5000 analog output - /usr/share/alsa/cards/imx-sgtl5000.conf -# - - - -imx-sgtl5000.pcm.front.0 { - @args [ CARD ] - @args.CARD { - type string - } - type hw - card $CARD - device 0 -} diff --git a/projects/imx6/filesystem/usr/share/alsa/cards/imx-spdif.conf b/projects/imx6/filesystem/usr/share/alsa/cards/imx-spdif.conf deleted file mode 100644 index 689c7322ca..0000000000 --- a/projects/imx6/filesystem/usr/share/alsa/cards/imx-spdif.conf +++ /dev/null @@ -1,32 +0,0 @@ -# -# Configuration for iMX6 SPDIF output - /usr/share/alsa/cards/imx-spdif.conf -# - - - -imx-spdif.pcm.iec958.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } - @args.AES1 { type integer } - @args.AES2 { type integer } - @args.AES3 { type integer } - type hooks - slave.pcm { - type hw - card $CARD - } - hooks.0 { - type ctl_elems - hook_args [ - { - interface MIXER - name "IEC958 Playback Default" - lock true - preserve true - optional true - value [ $AES0 $AES1 $AES2 $AES3 ] - } - ] - } -} diff --git a/projects/imx6/filesystem/usr/share/alsa/cards/imx-vt1613-audio.conf b/projects/imx6/filesystem/usr/share/alsa/cards/imx-vt1613-audio.conf deleted file mode 100644 index 5f69734d84..0000000000 --- a/projects/imx6/filesystem/usr/share/alsa/cards/imx-vt1613-audio.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -# Configuration for iMX6 VT1613 analog output - /usr/share/alsa/cards/imx-vt1613-audio.conf -# - - - -imx-vt1613-audio.pcm.front.0 { - @args [ CARD ] - @args.CARD { - type string - } - type hw - card $CARD - device 0 -} diff --git a/projects/imx6/kodi/advancedsettings.xml b/projects/imx6/kodi/advancedsettings.xml deleted file mode 100644 index e190999385..0000000000 --- a/projects/imx6/kodi/advancedsettings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - false - - 30 - - diff --git a/projects/imx6/kodi/guisettings.xml b/projects/imx6/kodi/guisettings.xml deleted file mode 100644 index 7e4ba03a97..0000000000 --- a/projects/imx6/kodi/guisettings.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - /storage/screenshots/ - - - 3 - - - ALSA:hdmi:CARD=imxhdmisoc,DEV=0 - - - diff --git a/projects/imx6/linux/3.14-mx6-sr/linux.arm.conf b/projects/imx6/linux/3.14-mx6-sr/linux.arm.conf deleted file mode 100644 index c478704f1a..0000000000 --- a/projects/imx6/linux/3.14-mx6-sr/linux.arm.conf +++ /dev/null @@ -1,4423 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm 3.14.60 Kernel Configuration -# -CONFIG_ARM=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_ARCH_HAS_CPUFREQ=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ZONE_DMA=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_GENERIC_BUG=y -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_XZ is not set -# CONFIG_KERNEL_LZO is not set -# CONFIG_KERNEL_LZ4 is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_FHANDLE=y -# CONFIG_AUDIT is not set - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_IRQ_DOMAIN=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_KTIME_SCALAR=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_PREEMPT_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_RCU_USER_QS is not set -CONFIG_RCU_FANOUT=32 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FANOUT_EXACT is not set -# CONFIG_RCU_FAST_NO_HZ is not set -# CONFIG_TREE_RCU_TRACE is not set -CONFIG_RCU_NOCB_CPU=y -# CONFIG_RCU_NOCB_CPU_NONE is not set -# CONFIG_RCU_NOCB_CPU_ZERO is not set -CONFIG_RCU_NOCB_CPU_ALL=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_FREEZER is not set -# CONFIG_CGROUP_DEVICE is not set -# CONFIG_CPUSETS is not set -# CONFIG_CGROUP_CPUACCT is not set -# CONFIG_RESOURCE_COUNTERS is not set -# CONFIG_CGROUP_SCHED is not set -# CONFIG_BLK_CGROUP is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_NAMESPACES is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE=" " -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_LZ4 is not set -CONFIG_INITRAMFS_COMPRESSION_NONE=y -# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_EXPERT=y -# CONFIG_UID16 is not set -CONFIG_SYSCTL_SYSCALL=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -# CONFIG_AIO is not set -CONFIG_PCI_QUIRKS=y -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -# CONFIG_PERF_EVENTS is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_PROFILING is not set -CONFIG_HAVE_OPROFILE=y -# CONFIG_KPROBES is not set -CONFIG_JUMP_LABEL=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -CONFIG_STOP_MACHINE=y -CONFIG_BLOCK=y -CONFIG_LBDAF=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -CONFIG_IOSCHED_BFQ=y -CONFIG_CGROUP_BFQIO=y -# CONFIG_DEFAULT_DEADLINE is not set -# CONFIG_DEFAULT_CFQ is not set -CONFIG_DEFAULT_BFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="bfq" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# System Type -# -CONFIG_MMU=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_KIRKWOOD is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_MSM_NODT is not set -# CONFIG_ARCH_SHMOBILE_LEGACY is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_S5P64X0 is not set -# CONFIG_ARCH_S5PC100 is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_EXYNOS is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_OMAP1 is not set - -# -# Multiple platform selection -# - -# -# CPU Core family selection -# -# CONFIG_ARCH_MULTI_V6 is not set -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_MULTI_V6_V7=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_BCM is not set -# CONFIG_ARCH_BERLIN is not set -CONFIG_GPIO_PCA953X=y -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HI3xxx is not set -# CONFIG_ARCH_KEYSTONE is not set -# CONFIG_ARCH_MSM_DT is not set -CONFIG_ARCH_MXC=y - -# -# Freescale i.MX support -# -# CONFIG_MXC_DEBUG_BOARD is not set -CONFIG_HAVE_IMX_ANATOP=y -CONFIG_HAVE_IMX_GPC=y -CONFIG_HAVE_IMX_MMDC=y -CONFIG_HAVE_IMX_SRC=y - -# -# i.MX51 machines: -# -# CONFIG_MACH_IMX51_DT is not set -# CONFIG_MACH_MX51_BABBAGE is not set -# CONFIG_MACH_EUKREA_CPUIMX51SD is not set - -# -# Device tree only -# -# CONFIG_SOC_IMX50 is not set -# CONFIG_SOC_IMX53 is not set -CONFIG_SOC_IMX6=y -CONFIG_SOC_IMX6Q=y -# CONFIG_SOC_IMX6SL is not set -# CONFIG_SOC_IMX6SX is not set -# CONFIG_SOC_VF610 is not set -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_PLAT_SPEAR is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_SHMOBILE_MULTI is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_ZYNQ is not set - -# -# Processor Type -# -CONFIG_CPU_V7=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y - -# -# Processor Features -# -# CONFIG_ARM_LPAE is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARM_THUMB=y -# CONFIG_ARM_THUMBEE is not set -CONFIG_ARM_VIRT_EXT=y -# CONFIG_SWP_EMULATE is not set -# CONFIG_CPU_ICACHE_DISABLE is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_KUSER_HELPERS=y -CONFIG_OUTER_CACHE=y -CONFIG_OUTER_CACHE_SYNC=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_CACHE_L2X0=y -CONFIG_CACHE_PL310=y -CONFIG_PL310_ERRATA_588369=y -CONFIG_PL310_ERRATA_727915=y -# CONFIG_PL310_ERRATA_753970 is not set -CONFIG_PL310_ERRATA_769419=y -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -CONFIG_ARM_NR_BANKS=8 -CONFIG_MULTI_IRQ_HANDLER=y -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_643719 is not set -# CONFIG_ARM_ERRATA_720789 is not set -CONFIG_ARM_ERRATA_754322=y -# CONFIG_ARM_ERRATA_754327 is not set -CONFIG_ARM_ERRATA_764369=y -CONFIG_ARM_ERRATA_775420=y -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_ERRATA_773022 is not set - -# -# Bus support -# -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_SYSCALL=y -CONFIG_PCI_MSI=y -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set - -# -# PCI host controller drivers -# -CONFIG_PCIE_DW=y -CONFIG_PCI_IMX6=y -# CONFIG_EP_MODE_IN_EP_RC_SYS is not set -# CONFIG_RC_MODE_IN_EP_RC_SYS is not set -# CONFIG_PCI_HOST_GENERIC is not set -CONFIG_PCIEPORTBUS=y -CONFIG_PCIEAER=y -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIEAER_INJECT is not set -CONFIG_PCIEASPM=y -# CONFIG_PCIEASPM_DEBUG is not set -CONFIG_PCIEASPM_DEFAULT=y -# CONFIG_PCIEASPM_POWERSAVE is not set -# CONFIG_PCIEASPM_PERFORMANCE is not set -CONFIG_PCIE_PME=y -# CONFIG_PCCARD is not set - -# -# Kernel Features -# -CONFIG_HAVE_SMP=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_ARM_CPU_TOPOLOGY=y -# CONFIG_SCHED_MC is not set -# CONFIG_SCHED_SMT is not set -CONFIG_HAVE_ARM_SCU=y -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_ARM_TWD=y -# CONFIG_MCPM is not set -# CONFIG_BIG_LITTLE is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_NR_CPUS=4 -CONFIG_HOTPLUG_CPU=y -# CONFIG_ARM_PSCI is not set -CONFIG_ARCH_NR_GPIO=0 -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -CONFIG_HZ_FIXED=0 -# CONFIG_HZ_100 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_250 is not set -CONFIG_HZ_300=y -# CONFIG_HZ_500 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=300 -CONFIG_SCHED_HRTICK=y -# CONFIG_THUMB2_KERNEL is not set -CONFIG_AEABI=y -# CONFIG_OABI_COMPAT is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -# CONFIG_PHYS_ADDR_T_64BIT is not set -CONFIG_ZONE_DMA_FLAG=1 -CONFIG_BOUNCE=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CLEANCACHE=y -CONFIG_FRONTSWAP=y -CONFIG_CMA=y -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZBUD is not set -# CONFIG_ZSWAP is not set -# CONFIG_ZSMALLOC is not set -CONFIG_FORCE_MAX_ZONEORDER=14 -CONFIG_ALIGNMENT_TRAP=y -CONFIG_UACCESS_WITH_MEMCPY=y -# CONFIG_SECCOMP is not set -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -# CONFIG_XEN is not set - -# -# Boot options -# -CONFIG_USE_OF=y -CONFIG_ATAGS=y -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -CONFIG_ZBOOT_ROM_TEXT=0 -CONFIG_ZBOOT_ROM_BSS=0 -# CONFIG_ARM_APPENDED_DTB is not set -CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init noram usbcore.autosuspend=-1 coherent_pool=2M" -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_CMDLINE_EXTEND=y -# CONFIG_CMDLINE_FORCE is not set -CONFIG_KEXEC=y -CONFIG_ATAGS_PROC=y -# CONFIG_CRASH_DUMP is not set -CONFIG_AUTO_ZRELADDR=y - -# -# CPU Power Management -# - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_INTERACTIVE=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -# CONFIG_GENERIC_CPUFREQ_CPU0 is not set - -# -# ARM CPU frequency scaling drivers -# -CONFIG_ARM_IMX6Q_CPUFREQ=y -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set - -# -# CPU Idle -# -# CONFIG_CPU_IDLE is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_NEON=y -CONFIG_KERNEL_MODE_NEON=y - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -CONFIG_PM_RUNTIME=y -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -# CONFIG_APM_EMULATION is not set -CONFIG_ARCH_HAS_OPP=y -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_PM_GENERIC_DOMAINS_SLEEP=y -CONFIG_PM_GENERIC_DOMAINS_RUNTIME=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=m -CONFIG_IP_MROUTE=y -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=m -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -CONFIG_INET_LRO=y -# CONFIG_INET_DIAG is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_GRE is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -# CONFIG_BRIDGE_NETFILTER is not set - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_NETLINK=m -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_PROCFS is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_FTP=m -# CONFIG_NF_CONNTRACK_H323 is not set -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -CONFIG_NF_CONNTRACK_SIP=m -# CONFIG_NF_CONNTRACK_TFTP is not set -CONFIG_NF_CT_NETLINK=m -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_AMANDA is not set -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_TABLES is not set -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set - -# -# Xtables matches -# -# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -CONFIG_NETFILTER_XT_MATCH_OWNER=m -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -CONFIG_NETFILTER_XT_MATCH_STATE=m -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_IP_NF_IPTABLES=m -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -CONFIG_NF_NAT_IPV4=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_H323 is not set -CONFIG_IP_NF_MANGLE=m -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_ARPTABLES is not set - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -CONFIG_IP6_NF_MANGLE=m -# CONFIG_IP6_NF_RAW is not set -# CONFIG_NF_NAT_IPV6 is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=m -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_IEEE802154 is not set -CONFIG_6LOWPAN_IPHC=m -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_HSR is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTSDIO=m -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_LL=y -# CONFIG_BT_HCIUART_3WIRE is not set -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -# CONFIG_BT_HCIVHCI is not set -CONFIG_BT_MRVL=m -CONFIG_BT_MRVL_SDIO=m -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -CONFIG_CFG80211_INTERNAL_REGDB=y -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -# CONFIG_MAC80211_RC_PID is not set -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -# CONFIG_WIMAX is not set -# CONFIG_RFKILL is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -CONFIG_HAVE_BPF_JIT=y - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin" -CONFIG_EXTRA_FIRMWARE_DIR="firmware" -# CONFIG_FW_LOADER_USER_HELPER is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_SOC_BUS=y -CONFIG_REGMAP=y -CONFIG_REGMAP_AC97=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=320 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -CONFIG_IMX_WEIM=y -# CONFIG_ARM_CCI is not set -# CONFIG_CONNECTOR is not set -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_AFS_PARTS is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PHYSMAP is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_IMPA7 is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_PMC551 is not set -CONFIG_MTD_DATAFLASH=y -# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set -# CONFIG_MTD_DATAFLASH_OTP is not set -CONFIG_MTD_SST25L=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_ECC=y -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND=y -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_GPIO is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_NANDSIM is not set -CONFIG_MTD_NAND_GPMI_NAND=y -# CONFIG_MTD_NAND_PLATFORM is not set -CONFIG_MTD_NAND_MXC=y -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR flash memory drivers -# -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_SPI_NOR is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_DTC=y -CONFIG_OF=y - -# -# Device Tree and Open Firmware support -# -# CONFIG_PROC_DEVICETREE is not set -# CONFIG_OF_SELFTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_MTD=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -CONFIG_BLK_DEV_NBD=y -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -# CONFIG_BLK_DEV_XIP is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_MG_DISK is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_PHANTOM is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_PCH_PHUB is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_SRAM=y -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -CONFIG_EEPROM_AT24=y -CONFIG_EEPROM_AT25=y -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# -CONFIG_HAVE_IDE=y -# CONFIG_IDE is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_PROC_FS is not set - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=y -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=y -CONFIG_ISCSI_BOOT_SYSFS=y -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_FCOE is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_LPFC is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DC390T is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_SRP is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_ATA=y -# CONFIG_ATA_NONSTANDARD is not set -CONFIG_ATA_VERBOSE_ERROR=y -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -# CONFIG_SATA_AHCI is not set -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_AHCI_IMX=y -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_SIL24 is not set -CONFIG_ATA_SFF=y - -# -# SFF controllers with custom DMA interface -# -# CONFIG_PDC_ADMA is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SX4 is not set -CONFIG_ATA_BMDMA=y - -# -# SATA SFF controllers with BMDMA -# -# CONFIG_ATA_PIIX is not set -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set - -# -# PATA SFF controllers with BMDMA -# -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -CONFIG_PATA_IMX=y -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set - -# -# PIO-only SFF controllers -# -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_RZ1000 is not set - -# -# Generic fallback / legacy drivers -# -# CONFIG_ATA_GENERIC is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_I2O is not set -CONFIG_NETDEVICES=y -CONFIG_MII=m -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_FC is not set -# CONFIG_NET_TEAM is not set -# CONFIG_MACVLAN is not set -# CONFIG_VXLAN is not set -CONFIG_NETCONSOLE=y -CONFIG_NETPOLL=y -# CONFIG_NETPOLL_TRAP is not set -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=y -# CONFIG_VETH is not set -# CONFIG_NLMON is not set -# CONFIG_ARCNET is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_3COM=y -# CONFIG_VORTEX is not set -# CONFIG_TYPHOON is not set -CONFIG_NET_VENDOR_ADAPTEC=y -# CONFIG_ADAPTEC_STARFIRE is not set -CONFIG_NET_VENDOR_ALTEON=y -# CONFIG_ACENIC is not set -CONFIG_NET_VENDOR_AMD=y -# CONFIG_AMD8111_ETH is not set -# CONFIG_PCNET32 is not set -# CONFIG_NET_VENDOR_ARC is not set -CONFIG_NET_VENDOR_ATHEROS=y -# CONFIG_ATL2 is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL1C is not set -# CONFIG_ALX is not set -# CONFIG_NET_CADENCE is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -CONFIG_NET_VENDOR_BROCADE=y -# CONFIG_BNA is not set -# CONFIG_NET_CALXEDA_XGMAC is not set -CONFIG_NET_VENDOR_CHELSIO=y -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -# CONFIG_NET_VENDOR_CIRRUS is not set -CONFIG_NET_VENDOR_CISCO=y -# CONFIG_ENIC is not set -# CONFIG_DM9000 is not set -# CONFIG_DNET is not set -CONFIG_NET_VENDOR_DEC=y -# CONFIG_NET_TULIP is not set -CONFIG_NET_VENDOR_DLINK=y -# CONFIG_DL2K is not set -# CONFIG_SUNDANCE is not set -CONFIG_NET_VENDOR_EMULEX=y -# CONFIG_BE2NET is not set -CONFIG_NET_VENDOR_EXAR=y -# CONFIG_S2IO is not set -# CONFIG_VXGE is not set -# CONFIG_NET_VENDOR_FARADAY is not set -CONFIG_NET_VENDOR_FREESCALE=y -CONFIG_FEC=y -CONFIG_NET_VENDOR_HP=y -# CONFIG_HP100 is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_IP1000 is not set -# CONFIG_JME is not set -# CONFIG_NET_VENDOR_MARVELL is not set -CONFIG_NET_VENDOR_MELLANOX=y -# CONFIG_MLX4_EN is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -CONFIG_NET_VENDOR_MYRI=y -# CONFIG_MYRI10GE is not set -# CONFIG_FEALNX is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -CONFIG_NET_VENDOR_NVIDIA=y -# CONFIG_FORCEDETH is not set -CONFIG_NET_VENDOR_OKI=y -# CONFIG_ETHOC is not set -CONFIG_NET_PACKET_ENGINE=y -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -CONFIG_NET_VENDOR_QLOGIC=y -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_NETXEN_NIC is not set -CONFIG_NET_VENDOR_REALTEK=y -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_R8169 is not set -# CONFIG_SH_ETH is not set -CONFIG_NET_VENDOR_RDC=y -# CONFIG_R6040 is not set -# CONFIG_NET_VENDOR_SEEQ is not set -CONFIG_NET_VENDOR_SILAN=y -# CONFIG_SC92031 is not set -CONFIG_NET_VENDOR_SIS=y -# CONFIG_SIS900 is not set -# CONFIG_SIS190 is not set -# CONFIG_SFC is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -CONFIG_NET_VENDOR_SUN=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_CASSINI is not set -# CONFIG_NIU is not set -CONFIG_NET_VENDOR_TEHUTI=y -# CONFIG_TEHUTI is not set -CONFIG_NET_VENDOR_TI=y -# CONFIG_TLAN is not set -# CONFIG_NET_VENDOR_VIA is not set -# CONFIG_NET_VENDOR_WIZNET is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PHYLIB=y - -# -# MII PHY device drivers -# -# CONFIG_AT803X_PHY is not set -# CONFIG_AMD_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_CICADA_PHY is not set -CONFIG_VITESSE_PHY=y -# CONFIG_SMSC_PHY is not set -CONFIG_BROADCOM_PHY=y -CONFIG_BCM87XX_PHY=y -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_FIXED_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_MPPE=m -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=m - -# -# USB Network Adapters -# -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -CONFIG_USB_RTL8152=m -CONFIG_USB_USBNET=m -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -CONFIG_USB_NET_DM9601=m -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=m -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_NET_INT51X1 is not set -CONFIG_USB_IPHETH=m -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_VL600 is not set -CONFIG_WLAN=y -CONFIG_LIBERTAS_THINFIRM=m -# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set -CONFIG_LIBERTAS_THINFIRM_USB=m -# CONFIG_ATMEL is not set -# CONFIG_AT76C50X_USB is not set -# CONFIG_PRISM54 is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -# CONFIG_RTL8180 is not set -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_ADM8211 is not set -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_MWL8K is not set -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH5K_PCI is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_PCI=y -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_WOW is not set -# CONFIG_ATH9K_LEGACY_RATE_CONTROL is not set -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -# CONFIG_CARL9170_HWRNG is not set -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -CONFIG_AR5523=m -# CONFIG_WIL6210 is not set -# CONFIG_ATH10K is not set -CONFIG_WCN36XX=m -# CONFIG_WCN36XX_DEBUGFS is not set -CONFIG_B43=m -CONFIG_B43_SSB=y -CONFIG_B43_PCI_AUTOSELECT=y -CONFIG_B43_PCICORE_AUTOSELECT=y -# CONFIG_B43_SDIO is not set -CONFIG_B43_PIO=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -CONFIG_BRCMUTIL=m -# CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_PROTO_BCDC=y -CONFIG_BRCMFMAC_SDIO=y -CONFIG_BRCMFMAC_USB=y -# CONFIG_BRCMFMAC_PCIE is not set -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -# CONFIG_HOSTAP is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2200 is not set -CONFIG_IWLWIFI=m -CONFIG_IWLDVM=m -# CONFIG_IWLMVM is not set -CONFIG_IWLWIFI_OPMODE_MODULAR=y - -# -# Debugging Options -# -# CONFIG_IWLWIFI_DEBUG is not set -# CONFIG_IWL4965 is not set -# CONFIG_IWL3945 is not set -# CONFIG_LIBERTAS is not set -# CONFIG_HERMES is not set -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -# CONFIG_P54_PCI is not set -# CONFIG_P54_SPI is not set -CONFIG_P54_LEDS=y -CONFIG_RT2X00=m -# CONFIG_RT2400PCI is not set -# CONFIG_RT2500PCI is not set -# CONFIG_RT61PCI is not set -# CONFIG_RT2800PCI is not set -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_RTL_CARDS=m -# CONFIG_RTL8192CE is not set -# CONFIG_RTL8192SE is not set -# CONFIG_RTL8192DE is not set -# CONFIG_RTL8723AE is not set -# CONFIG_RTL8188EE is not set -# CONFIG_RTL8192CU is not set -# CONFIG_WL_TI is not set -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_MWIFIEX is not set -# CONFIG_CW1200 is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_VMXNET3 is not set -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_INPUT_TABLET is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ADS7846=m -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DA9052 is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -CONFIG_TOUCHSCREEN_EGALAX=m -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -# CONFIG_TOUCHSCREEN_MC13783 is not set -CONFIG_TOUCHSCREEN_USB_EGALAX=y -CONFIG_TOUCHSCREEN_USB_PANJIT=y -CONFIG_TOUCHSCREEN_USB_3M=y -CONFIG_TOUCHSCREEN_USB_ITM=y -CONFIG_TOUCHSCREEN_USB_ETURBO=y -CONFIG_TOUCHSCREEN_USB_GUNZE=y -CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y -CONFIG_TOUCHSCREEN_USB_IRTOUCH=y -CONFIG_TOUCHSCREEN_USB_IDEALTEK=y -CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y -CONFIG_TOUCHSCREEN_USB_GOTOP=y -CONFIG_TOUCHSCREEN_USB_JASTEC=y -CONFIG_TOUCHSCREEN_USB_ELO=y -CONFIG_TOUCHSCREEN_USB_E2I=y -CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y -CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y -CONFIG_TOUCHSCREEN_USB_NEXIO=y -CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_W90X900 is not set -CONFIG_TOUCHSCREEN_ST1232=m -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_MC13783_PWRBUTTON is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -CONFIG_INPUT_UINPUT=y -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_DA9052_ONKEY is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_ISL29023 is not set - -# -# Hardware I/O ports -# -# CONFIG_SERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_NOZOMI is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -# CONFIG_DEVKMEM is not set - -# -# Serial drivers -# -# CONFIG_SERIAL_8250 is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_MFD_HSU is not set -CONFIG_SERIAL_IMX=y -CONFIG_SERIAL_IMX_CONSOLE=y -# CONFIG_SERIAL_SH_SCI is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_PCH_UART is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_TTY_PRINTK is not set -CONFIG_FSL_OTP=y -# CONFIG_FSL_OTP_WRITE_ENABLE is not set -# CONFIG_HVC_DCC is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_ATMEL is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -CONFIG_DEVPORT=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -# CONFIG_I2C_COMPAT is not set -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_HELPER_AUTO is not set -# CONFIG_I2C_SMBUS is not set - -# -# I2C Algorithms -# -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_ALGOPCF=m -CONFIG_I2C_ALGOPCA=m - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_EG20T is not set -# CONFIG_I2C_GPIO is not set -CONFIG_I2C_IMX=y -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -CONFIG_SPI_BITBANG=y -# CONFIG_SPI_GPIO is not set -CONFIG_SPI_IMX=y -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_TOPCLIFF_PCH is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -# CONFIG_SPI_SPIDEV is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_CAPRI is not set -CONFIG_PINCTRL_IMX=y -CONFIG_PINCTRL_IMX6Q=y -# CONFIG_PINCTRL_MSM8X74 is not set -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_GENERIC=y -# CONFIG_GPIO_DA9052 is not set - -# -# Memory mapped GPIO drivers: -# -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_EM is not set -CONFIG_GPIO_MXC=y -# CONFIG_GPIO_RCAR is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_GRGPIO is not set - -# -# I2C GPIO expanders: -# -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X_IRQ is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set - -# -# PCI GPIO expanders: -# -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_RDC321X is not set - -# -# SPI GPIO expanders: -# -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_74X164 is not set - -# -# AC97 GPIO expanders: -# - -# -# LPC GPIO expanders: -# - -# -# MODULbus GPIO expanders: -# -# CONFIG_GPIO_BCM_KONA is not set - -# -# USB GPIO expanders: -# -CONFIG_W1=m - -# -# 1-wire Bus Masters -# -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_DS2482 is not set -CONFIG_W1_MASTER_MXC=m -# CONFIG_W1_MASTER_DS1WM is not set -CONFIG_W1_MASTER_GPIO=m - -# -# 1-wire Slaves -# -CONFIG_W1_SLAVE_THERM=m -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 is not set -# CONFIG_W1_SLAVE_DS2423 is not set -# CONFIG_W1_SLAVE_DS2431 is not set -# CONFIG_W1_SLAVE_DS2433 is not set -# CONFIG_W1_SLAVE_DS2760 is not set -# CONFIG_W1_SLAVE_DS2780 is not set -# CONFIG_W1_SLAVE_DS2781 is not set -# CONFIG_W1_SLAVE_DS28E04 is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27x00 is not set -# CONFIG_BATTERY_DA9052 is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_IMX6_USB_CHARGER is not set -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_GPIO=y -# CONFIG_POWER_RESET_RESTART is not set -CONFIG_POWER_RESET_SNVS=y -# CONFIG_POWER_AVS is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_DA9052_ADC is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -CONFIG_SENSORS_GPIO_FAN=m -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX17135 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_MC13783_ADC is not set -# CONFIG_SENSORS_MAG3110 is not set -# CONFIG_MXC_MMA8451 is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_USER_SPACE is not set -CONFIG_CPU_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set -CONFIG_IMX_THERMAL=y -CONFIG_DEVICE_THERMAL=y - -# -# Texas Instruments thermal drivers -# -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=y -CONFIG_SSB_SPROM=y -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_DRIVER_PCICORE=y -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_PMIC_DA903X is not set -CONFIG_PMIC_DA9052=y -# CONFIG_MFD_DA9052_SPI is not set -CONFIG_MFD_DA9052_I2C=y -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9063 is not set -CONFIG_MFD_MXC_HDMI=y -# CONFIG_MFD_MXC_HDMI_ANDROID is not set -CONFIG_MFD_MC13XXX=m -CONFIG_MFD_MC13XXX_SPI=m -CONFIG_MFD_MC13XXX_I2C=m -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX17135 is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SYSCON=y -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MFD_TDA1997X is not set -# CONFIG_VEXPRESS_CONFIG is not set -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -CONFIG_REGULATOR_ANATOP=y -# CONFIG_REGULATOR_DA9052 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_LTC3676 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_MC13783 is not set -# CONFIG_REGULATOR_MC13892 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -# CONFIG_MEDIA_RADIO_SUPPORT is not set -CONFIG_MEDIA_RC_SUPPORT=y -# CONFIG_MEDIA_CONTROLLER is not set -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DMA_CONTIG=y -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=m -CONFIG_VIDEOBUF2_MEMOPS=m -CONFIG_VIDEOBUF2_VMALLOC=m -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=y -CONFIG_RC_MAP=y -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_RC5_SZ_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_PWC is not set -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_S2255 is not set -CONFIG_VIDEO_USBTV=m - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_TLG2300 is not set -# CONFIG_VIDEO_USBVISION is not set -CONFIG_VIDEO_STK1160_COMMON=m -# CONFIG_VIDEO_STK1160_AC97 is not set -CONFIG_VIDEO_STK1160=m - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -# CONFIG_VIDEO_CX231XX_ALSA is not set -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -# CONFIG_VIDEO_TM6000_ALSA is not set -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -# CONFIG_DVB_USB_A800 is not set -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -# CONFIG_DVB_USB_UMT_010 is not set -CONFIG_DVB_USB_CXUSB=m -# CONFIG_DVB_USB_M920X is not set -# CONFIG_DVB_USB_DIGITV is not set -CONFIG_DVB_USB_VP7045=m -# CONFIG_DVB_USB_VP702X is not set -# CONFIG_DVB_USB_GP8PSK is not set -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -# CONFIG_DVB_USB_FRIIO is not set -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -# CONFIG_DVB_USB_AU6610 is not set -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -# CONFIG_DVB_USB_GL861 is not set -CONFIG_DVB_USB_IT913X=m -CONFIG_DVB_USB_LME2510=m -# CONFIG_DVB_USB_MXL111SF is not set -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_DVB_USB_DVBSKY=m -# CONFIG_DVB_TTUSB_BUDGET is not set -# CONFIG_DVB_TTUSB_DEC is not set -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -CONFIG_VIDEO_EM28XX_V4L2=m -# CONFIG_VIDEO_EM28XX_ALSA is not set -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m -# CONFIG_MEDIA_PCI_SUPPORT is not set -CONFIG_V4L_PLATFORM_DRIVERS=y -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_TIMBERDALE is not set -CONFIG_VIDEO_MXC_OUTPUT=y -# CONFIG_VIDEO_MXC_CAPTURE is not set -CONFIG_VIDEO_MXC_IPU_OUTPUT=y -# CONFIG_VIDEO_MXC_PXP_V4L2 is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -# CONFIG_SMS_SDIO_DRV is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y - -# -# Media ancillary drivers (tuners, sensors, i2c, frontends) -# -CONFIG_MEDIA_SUBDRV_AUTOSELECT=y -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=y - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m - -# -# RDS decoders -# - -# -# Video decoders -# -CONFIG_VIDEO_SAA711X=m -CONFIG_VIDEO_TVP5150=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# - -# -# Camera sensor devices -# -CONFIG_VIDEO_MT9V011=m - -# -# Flash devices -# - -# -# Video improvement chips -# - -# -# Audio/Video compression chips -# - -# -# Miscellaneous helper chips -# - -# -# Sensors used on soc_camera driver -# -CONFIG_MEDIA_TUNER=y -CONFIG_MEDIA_TUNER_SIMPLE=y -CONFIG_MEDIA_TUNER_TDA8290=y -CONFIG_MEDIA_TUNER_TDA827X=y -CONFIG_MEDIA_TUNER_TDA18271=y -CONFIG_MEDIA_TUNER_TDA9887=y -CONFIG_MEDIA_TUNER_MT20XX=y -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=y -CONFIG_MEDIA_TUNER_XC5000=y -CONFIG_MEDIA_TUNER_XC4000=y -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=y -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88TS2022=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_SI2157=m - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_CX24120=m -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_DVBSKY_M88DS3103=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_CX22702=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_IT913X_FE=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m -CONFIG_DVB_SI2168=m -CONFIG_DVB_SP2=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set - -# -# Graphics support -# -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 - -# -# Vivante GPU support -# -CONFIG_VIVANTE_GALCORE=y -# CONFIG_DRM is not set -# CONFIG_VGASTATE is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_IMX is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_TMIO is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_VIRTUAL is not set -CONFIG_FB_VIRTUAL_PHYMEM=y -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_MX3 is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_MXS is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_EXYNOS_VIDEO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_LCD_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -# CONFIG_BACKLIGHT_PWM is not set -# CONFIG_BACKLIGHT_DA9052 is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -CONFIG_BACKLIGHT_GPIO=y -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -CONFIG_FB_MXC=y -CONFIG_FB_MXC_SYNC_PANEL=y -# CONFIG_FB_MXC_TVOUT_ADV739X is not set -CONFIG_FB_MXC_LDB=y -# CONFIG_FB_MXC_MIPI_DSI is not set -CONFIG_FB_MXC_HDMI=y -CONFIG_FB_MXC_EDID=y -# CONFIG_FB_MXC_EINK_PANEL is not set -CONFIG_FB_MXC_DCIC=y -# CONFIG_HANNSTAR_CABC is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -# CONFIG_FB_SSD1307 is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_DMAENGINE_PCM=y -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_HRTIMER=m -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_AC97_CODEC=m -# CONFIG_SND_DRIVERS is not set -CONFIG_SND_PCI=y -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_OXYGEN is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_HDA_INTEL is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_YMFPCI is not set -# CONFIG_SND_ARM is not set -# CONFIG_SND_SPI is not set -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -# CONFIG_SND_USB_CAIAQ_INPUT is not set -CONFIG_SND_USB_6FIRE=m -CONFIG_SND_USB_HIFACE=m -CONFIG_SND_SOC=y -CONFIG_SND_SOC_AC97_BUS=y -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -CONFIG_SND_SOC_FSL_ASRC=y -CONFIG_SND_SOC_FSL_SAI=y -CONFIG_SND_SOC_FSL_SSI=y -CONFIG_SND_SOC_FSL_SPDIF=y -# CONFIG_SND_SOC_FSL_ESAI is not set -CONFIG_SND_SOC_FSL_HDMI=y -CONFIG_SND_SOC_IMX_PCM_DMA=y -CONFIG_SND_SOC_IMX_AUDMUX=y -CONFIG_SND_IMX_SOC=y -CONFIG_SND_SOC_IMX_HDMI_DMA=y - -# -# SoC Audio support for Freescale i.MX boards: -# -# CONFIG_SND_SOC_IMX_CS42888 is not set -# CONFIG_SND_SOC_IMX_WM8731 is not set -# CONFIG_SND_SOC_IMX_WM8962 is not set -CONFIG_SND_SOC_IMX_SGTL5000=y -CONFIG_SND_SOC_IMX_AC97_VT1613=y -# CONFIG_SND_SOC_IMX_MQS is not set -CONFIG_SND_SOC_IMX_SPDIF=y -# CONFIG_SND_SOC_IMX_MC13783 is not set -CONFIG_SND_SOC_IMX_HDMI=y -# CONFIG_SND_SOC_IMX_SI476X is not set -# CONFIG_SND_SOC_IMX_TDA1997X is not set -CONFIG_SND_SOC_I2C_AND_SPI=y -# CONFIG_SND_SOC_CS42XX8_I2C is not set -CONFIG_SND_SOC_HDMI_CODEC=y -CONFIG_SND_SOC_SGTL5000=y -CONFIG_SND_SOC_VT1613=y -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SOUND_PRIME is not set -CONFIG_AC97_BUS=y - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -CONFIG_HIDRAW=y -CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACRUX is not set -CONFIG_HID_APPLE=y -# CONFIG_HID_APPLEIR is not set -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_PRODIKEYS is not set -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_HUION is not set -# CONFIG_HID_KEYTOUCH is not set -CONFIG_HID_KYE=y -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -CONFIG_HID_GYRATION=y -# CONFIG_HID_ICADE is not set -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -CONFIG_HID_LENOVO_TPKBD=y -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -# CONFIG_HID_MAGICMOUSE is not set -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -CONFIG_HID_ORTEK=y -CONFIG_HID_OUYA=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PETALYNX=y -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -CONFIG_SONY_FF=y -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -CONFIG_HID_SPINELPLUS=y -CONFIG_HID_SUNPLUS=y -# CONFIG_HID_GREENASIA is not set -CONFIG_HID_SMARTJOYPLUS=m -CONFIG_SMARTJOYPLUS_FF=y -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -CONFIG_HID_WIIMOTE=m -CONFIG_HID_XINMO=y -# CONFIG_HID_ZEROPLUS is not set -CONFIG_HID_ZYDACRON=y -# CONFIG_HID_SENSOR_HUB is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -CONFIG_I2C_HID=m -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -CONFIG_USB_MON=m -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_MXC is not set -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FUSBH200_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_IMX21_HCD is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_RENESAS_USBHS is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -CONFIG_USB_CHIPIDEA=y -CONFIG_USB_CHIPIDEA_UDC=y -CONFIG_USB_CHIPIDEA_HOST=y -# CONFIG_USB_CHIPIDEA_DEBUG is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -CONFIG_USB_SERIAL_CH341=m -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -CONFIG_USB_SERIAL_CP210X=m -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_EMPEG is not set -CONFIG_USB_SERIAL_FTDI_SIO=m -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_GARMIN is not set -# CONFIG_USB_SERIAL_IPW is not set -CONFIG_USB_SERIAL_IUU=m -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -CONFIG_USB_SERIAL_PL2303=m -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SAFE is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_ZTE is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_DEBUG is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_AM335X_PHY_USB is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -CONFIG_USB_MXS_PHY=y -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_ULPI is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=2 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -# CONFIG_USB_FSL_USB2 is not set -# CONFIG_USB_FUSB300 is not set -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_S3C_HSOTG is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_AMD5536UDC is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_DUMMY_HCD is not set -CONFIG_USB_LIBCOMPOSITE=m -CONFIG_USB_F_ACM=m -CONFIG_USB_F_SS_LB=m -CONFIG_USB_U_SERIAL=m -CONFIG_USB_U_ETHER=m -CONFIG_USB_F_SERIAL=m -CONFIG_USB_F_OBEX=m -CONFIG_USB_F_ECM=m -CONFIG_USB_F_SUBSET=m -CONFIG_USB_F_RNDIS=m -CONFIG_USB_F_MASS_STORAGE=m -# CONFIG_USB_CONFIGFS is not set -CONFIG_USB_ZERO=m -# CONFIG_USB_AUDIO is not set -CONFIG_USB_ETH=m -CONFIG_USB_ETH_RNDIS=y -# CONFIG_USB_ETH_EEM is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set -CONFIG_USB_MASS_STORAGE=m -# CONFIG_FSL_UTP is not set -CONFIG_USB_G_SERIAL=m -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -CONFIG_MMC_UNSAFE_RESUME=y -# CONFIG_MMC_CLKGATE is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_IO_ACCESSORS=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -CONFIG_MMC_SDHCI_ESDHC_IMX=y -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_MXC is not set -# CONFIG_MMC_TIFM_SD is not set -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MEMSTICK is not set - -# -# MXC support drivers -# -CONFIG_MXC_IPU=y -CONFIG_MXC_IPU_V3=y - -# -# MXC VPU(Video Processing Unit) support -# -CONFIG_MXC_VPU=y -# CONFIG_MXC_VPU_DEBUG is not set -CONFIG_MX6_VPU_352M=y - -# -# MXC HDMI CEC (Consumer Electronics Control) support -# -CONFIG_MXC_HDMI_CEC=y - -# -# MXC MIPI Support -# -CONFIG_MXC_MIPI_CSI2=y - -# -# MXC Media Local Bus Driver -# -CONFIG_MXC_MLB=y -CONFIG_MXC_MLB150=y -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y - -# -# LED drivers -# -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9685 is not set -# CONFIG_LEDS_DA9052 is not set -# CONFIG_LEDS_DAC124S085 is not set -CONFIG_LEDS_PWM=y -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_MC13783 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_BLINKM is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -CONFIG_RTC_INTF_DEV_UIE_EMUL=y -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -CONFIG_RTC_DRV_DS1307=y -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -CONFIG_RTC_DRV_PCF8523=y -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_CMOS is not set -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DA9052 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_DS2404 is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_IMXDI is not set -CONFIG_RTC_DRV_MC13XXX=m -CONFIG_RTC_DRV_MXC=y -CONFIG_RTC_DRV_SNVS=y -# CONFIG_RTC_DRV_MOXART is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -# CONFIG_DW_DMAC_CORE is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set -CONFIG_MX3_IPU=y -CONFIG_MX3_IPU_IRQS=4 -CONFIG_MXC_PXP_V2=y -CONFIG_MXC_PXP_CLIENT_DEVICE=y -# CONFIG_TIMB_DMA is not set -CONFIG_IMX_SDMA=y -# CONFIG_IMX_DMA is not set -CONFIG_MXS_DMA=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_UIO is not set -# CONFIG_VIRT_DRIVERS is not set - -# -# Virtio drivers -# -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -# CONFIG_ET131X is not set -# CONFIG_USBIP_CORE is not set -CONFIG_W35UND=m -# CONFIG_PRISM2_USB is not set -# CONFIG_ECHO is not set -# CONFIG_COMEDI is not set -# CONFIG_R8187SE is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTLLIB is not set -CONFIG_R8712U=m -CONFIG_R8188EU=m -CONFIG_88EU_AP_MODE=y -# CONFIG_88EU_P2P is not set -# CONFIG_R8821AE is not set -CONFIG_RTS5139=m -# CONFIG_RTS5139_DEBUG is not set -# CONFIG_RTS5208 is not set -# CONFIG_TRANZPORT is not set -# CONFIG_IDE_PHISON is not set -# CONFIG_LINE6_USB is not set -# CONFIG_USB_SERIAL_QUATECH2 is not set -# CONFIG_VT6655 is not set -CONFIG_VT6656=m -# CONFIG_DX_SEP is not set -# CONFIG_FB_SM7XX is not set -# CONFIG_CRYSTALHD is not set -# CONFIG_FB_XGI is not set -# CONFIG_USB_ENESTORAGE is not set -# CONFIG_BCM_WIMAX is not set -# CONFIG_FT1000 is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -CONFIG_STAGING_MEDIA=y -CONFIG_DVB_AS102=m -# CONFIG_DVB_CXD2099 is not set -# CONFIG_VIDEO_DT3155 is not set -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_USB_MSI3101 is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_USB_SN9C102 is not set -# CONFIG_SOLO6X10 is not set -CONFIG_LIRC_STAGING=y -# CONFIG_LIRC_BT829 is not set -CONFIG_LIRC_IGORPLUGUSB=m -# CONFIG_LIRC_IMON is not set -CONFIG_LIRC_GPIO=m -# CONFIG_LIRC_SASEM is not set -# CONFIG_LIRC_SERIAL is not set -# CONFIG_LIRC_SIR is not set -CONFIG_LIRC_XBOX=m -# CONFIG_LIRC_ZILOG is not set - -# -# Android -# -# CONFIG_ANDROID is not set -# CONFIG_USB_WPAN_HCD is not set -# CONFIG_WIMAX_GDM72XX is not set -# CONFIG_LTE_GDM724X is not set -CONFIG_NET_VENDOR_SILICOM=y -# CONFIG_SBYPASS is not set -# CONFIG_BPCTL is not set -# CONFIG_CED1401 is not set -# CONFIG_DGRP is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_XILLYBUS is not set -# CONFIG_DGNC is not set -# CONFIG_DGAP is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_QCOM is not set - -# -# Hardware Spinlock drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_MMIO=y -# CONFIG_MAILBOX is not set -# CONFIG_IOMMU_SUPPORT is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# -# CONFIG_PM_DEVFREQ is not set -# CONFIG_EXTCON is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_VME_BUS is not set -CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -CONFIG_PWM_IMX=y -# CONFIG_PWM_PCA9685 is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -# CONFIG_IPACK_BUS is not set -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -CONFIG_RESET_CONTROLLER=y -CONFIG_RESET_GPIO=y -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_POWERCAP is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_REISERFS_FS_XATTR is not set -CONFIG_JFS_FS=m -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=m -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -# CONFIG_CUSE is not set - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="ascii" -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_CONFIGFS_FS=m -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=y -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS2_FS is not set -# CONFIG_UBIFS_FS is not set -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -# CONFIG_F2FS_FS_XATTR is not set -CONFIG_F2FS_CHECK_FS=y -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -CONFIG_NFS_V4_1=y -CONFIG_NFS_V4_2=y -CONFIG_PNFS_FILE_LAYOUT=y -CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" -CONFIG_NFS_V4_1_MIGRATION=y -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -# CONFIG_NFSD is not set -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_BACKCHANNEL=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=y -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DFS_UPCALL is not set -# CONFIG_CIFS_SMB2 is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -# CONFIG_DEBUG_INFO is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -CONFIG_LOCKUP_DETECTOR=y -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_TIMER_STATS is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set - -# -# RCU Debugging -# -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=21 -# CONFIG_RCU_CPU_STALL_INFO is not set -# CONFIG_RCU_TRACE is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACING_SUPPORT=y -# CONFIG_FTRACE is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_MODULE is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_DEBUG_USER is not set -# CONFIG_DEBUG_LL is not set -CONFIG_DEBUG_IMX_UART_PORT=1 -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_UART_PL01X is not set -# CONFIG_DEBUG_UART_8250 is not set -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_PCOMP2=y -# CONFIG_CRYPTO_CRYPTODEV is not set -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCRYPT is not set -CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_CRYPTO_CRYPTD is not set -CONFIG_CRYPTO_AUTHENC=y -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -# CONFIG_CRYPTO_GCM is not set -CONFIG_CRYPTO_SEQIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=m -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -# CONFIG_CRYPTO_GHASH is not set -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA1_ARM=m -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -CONFIG_CRYPTO_AES_ARM=m -# CONFIG_CRYPTO_AES_ARM_BS is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_ZLIB is not set -CONFIG_CRYPTO_LZO=m -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set - -# -# Random Number Generation -# -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -CONFIG_CRYPTO_HW=y -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -CONFIG_CRYPTO_DEV_FSL_CAAM=y -CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y -CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 -# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set -CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y -CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y -CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y -# CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_TEST is not set -CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y -CONFIG_CRYPTO_DEV_FSL_CAAM_SM_SLOTSIZE=7 -# CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST is not set -CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y -# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set -# CONFIG_CRYPTO_DEV_SAHARA is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=m -CONFIG_BITREVERSE=y -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_STMP_DEVICE=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=m -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=m -# CONFIG_CRC8 is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=m -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_AVERAGE=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_VIRTUALIZATION is not set diff --git a/projects/imx6/linux/4.4-xbian/linux.arm.conf b/projects/imx6/linux/4.4-xbian/linux.arm.conf deleted file mode 100644 index b27e21597d..0000000000 --- a/projects/imx6/linux/4.4-xbian/linux.arm.conf +++ /dev/null @@ -1,6585 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm 4.4.19 Kernel Configuration -# -CONFIG_ARM=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_ARM_DMA_USE_IOMMU=y -CONFIG_ARM_DMA_IOMMU_ALIGNMENT=8 -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ZONE_DMA=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_GENERIC_BUG=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_XZ is not set -# CONFIG_KERNEL_LZO is not set -# CONFIG_KERNEL_LZ4 is not set -CONFIG_DEFAULT_HOSTNAME="@DISTRONAME@" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_FHANDLE=y -# CONFIG_USELIB is not set -# CONFIG_AUDIT is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_HANDLE_DOMAIN_IRQ=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -# CONFIG_NO_HZ is not set -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -# CONFIG_TICK_CPU_ACCOUNTING is not set -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -CONFIG_IRQ_TIME_ACCOUNTING=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_BSD_PROCESS_ACCT_V3=y -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_PREEMPT_RCU=y -CONFIG_RCU_EXPERT=y -CONFIG_SRCU=y -# CONFIG_TASKS_RCU is not set -CONFIG_RCU_STALL_COMMON=y -CONFIG_RCU_FANOUT=4 -CONFIG_RCU_FANOUT_LEAF=2 -# CONFIG_TREE_RCU_TRACE is not set -CONFIG_RCU_BOOST=y -CONFIG_RCU_KTHREAD_PRIO=7 -CONFIG_RCU_BOOST_DELAY=200 -CONFIG_RCU_NOCB_CPU=y -CONFIG_RCU_NOCB_CPU_NONE=y -# CONFIG_RCU_NOCB_CPU_ZERO is not set -# CONFIG_RCU_NOCB_CPU_ALL is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_BUILD_BIN2C=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=16 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=13 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_PIDS=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y -# CONFIG_MEMCG is not set -# CONFIG_CGROUP_PERF is not set -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CFS_BANDWIDTH=y -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SYSFS_DEPRECATED is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -CONFIG_RD_LZO=y -# CONFIG_RD_LZ4 is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_BPF=y -CONFIG_EXPERT=y -# CONFIG_UID16 is not set -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -CONFIG_SYSFS_SYSCALL=y -CONFIG_SYSCTL_SYSCALL=y -CONFIG_KALLSYMS=y -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -# CONFIG_BPF_SYSCALL is not set -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_ADVISE_SYSCALLS=y -CONFIG_USERFAULTFD=y -CONFIG_PCI_QUIRKS=y -CONFIG_MEMBARRIER=y -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_SLUB_DEBUG is not set -CONFIG_COMPAT_BRK=y -CONFIG_SLUB=y -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -# CONFIG_PROFILING is not set -CONFIG_TRACEPOINTS=y -CONFIG_KEXEC_CORE=y -CONFIG_HAVE_OPROFILE=y -# CONFIG_KPROBES is not set -# CONFIG_UPROBES is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_LBDAF=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -CONFIG_BLK_DEV_INTEGRITY=y -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -CONFIG_BSD_DISKLABEL=y -CONFIG_MINIX_SUBPARTITION=y -CONFIG_SOLARIS_X86_PARTITION=y -CONFIG_UNIXWARE_DISKLABEL=y -CONFIG_LDM_PARTITION=y -# CONFIG_LDM_DEBUG is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -CONFIG_SUN_PARTITION=y -CONFIG_KARMA_PARTITION=y -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -CONFIG_IOSCHED_BFQ=y -# CONFIG_CGROUP_BFQIO is not set -# CONFIG_DEFAULT_DEADLINE is not set -# CONFIG_DEFAULT_CFQ is not set -CONFIG_DEFAULT_BFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="bfq" -CONFIG_PADATA=y -CONFIG_ASN1=m -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_FREEZER=y - -# -# System Type -# -CONFIG_MMU=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_OMAP1 is not set - -# -# Multiple platform selection -# - -# -# CPU Core family selection -# -# CONFIG_ARCH_MULTI_V6 is not set -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_MULTI_V6_V7=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_ALPINE is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_BCM is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_DIGICOLOR is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_KEYSTONE is not set -# CONFIG_ARCH_MESON is not set -CONFIG_ARCH_MXC=y -CONFIG_HAVE_IMX_ANATOP=y -CONFIG_HAVE_IMX_GPC=y -CONFIG_HAVE_IMX_MMDC=y -CONFIG_HAVE_IMX_SRC=y - -# -# Device tree only -# - -# -# Cortex-A platforms -# -# CONFIG_SOC_IMX50 is not set -# CONFIG_SOC_IMX51 is not set -# CONFIG_SOC_IMX53 is not set -CONFIG_SOC_IMX6=y -CONFIG_SOC_IMX6Q=y -# CONFIG_SOC_IMX6SL is not set -# CONFIG_SOC_IMX6SX is not set -# CONFIG_SOC_IMX6UL is not set -# CONFIG_SOC_IMX7D is not set -# CONFIG_SOC_LS1021A is not set - -# -# Cortex-A/Cortex-M asymmetric multiprocessing platforms -# -# CONFIG_SOC_VF610 is not set -# CONFIG_ARCH_MEDIATEK is not set - -# -# TI OMAP/AM/DM/DRA Family -# -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_PLAT_SPEAR is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_EXYNOS is not set -# CONFIG_ARCH_SHMOBILE_MULTI is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_UNIPHIER is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_ZX is not set -# CONFIG_ARCH_ZYNQ is not set - -# -# Processor Type -# -CONFIG_CPU_V7=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y - -# -# Processor Features -# -# CONFIG_ARM_LPAE is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARM_THUMB=y -CONFIG_ARM_THUMBEE=y -CONFIG_ARM_VIRT_EXT=y -CONFIG_SWP_EMULATE=y -# CONFIG_CPU_ICACHE_DISABLE is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_KUSER_HELPERS=y -CONFIG_VDSO=y -CONFIG_OUTER_CACHE=y -CONFIG_OUTER_CACHE_SYNC=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_CACHE_L2X0=y -# CONFIG_PL310_ERRATA_588369 is not set -# CONFIG_PL310_ERRATA_727915 is not set -# CONFIG_PL310_ERRATA_753970 is not set -CONFIG_PL310_ERRATA_769419=y -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -CONFIG_ARM_HEAVY_MB=y -# CONFIG_ARM_KERNMEM_PERMS is not set -CONFIG_MULTI_IRQ_HANDLER=y -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_643719 is not set -CONFIG_ARM_ERRATA_720789=y -CONFIG_ARM_ERRATA_754322=y -# CONFIG_ARM_ERRATA_754327 is not set -CONFIG_ARM_ERRATA_764369=y -CONFIG_ARM_ERRATA_775420=y -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_ERRATA_773022 is not set - -# -# Bus support -# -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_SYSCALL=y -CONFIG_PCI_MSI=y -CONFIG_PCI_REALLOC_ENABLE_AUTO=y -CONFIG_PCI_STUB=y -CONFIG_PCI_ATS=y -CONFIG_PCI_IOV=y -CONFIG_PCI_PRI=y -CONFIG_PCI_PASID=y - -# -# PCI host controller drivers -# -CONFIG_PCIE_DW=y -CONFIG_PCI_IMX6=y -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCI_LAYERSCAPE is not set -# CONFIG_PCIE_IPROC is not set -# CONFIG_PCIE_ALTERA is not set -CONFIG_PCIEPORTBUS=y -CONFIG_PCIEAER=y -CONFIG_PCIE_ECRC=y -# CONFIG_PCIEAER_INJECT is not set -CONFIG_PCIEASPM=y -# CONFIG_PCIEASPM_DEBUG is not set -CONFIG_PCIEASPM_DEFAULT=y -# CONFIG_PCIEASPM_POWERSAVE is not set -# CONFIG_PCIEASPM_PERFORMANCE is not set -CONFIG_PCIE_PME=y -# CONFIG_PCCARD is not set - -# -# Kernel Features -# -CONFIG_HAVE_SMP=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_ARM_CPU_TOPOLOGY=y -CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set -CONFIG_HAVE_ARM_SCU=y -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_ARM_TWD=y -# CONFIG_MCPM is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_VMSPLIT_3G is not set -# CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VMSPLIT_2G=y -# CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0x80000000 -CONFIG_NR_CPUS=4 -CONFIG_HOTPLUG_CPU=y -# CONFIG_ARM_PSCI is not set -CONFIG_ARCH_NR_GPIO=0 -CONFIG_PREEMPT=y -CONFIG_PREEMPT_RT_BASE=y -CONFIG_HAVE_PREEMPT_LAZY=y -CONFIG_PREEMPT_LAZY=y -# CONFIG_PREEMPT_NONE is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -# CONFIG_PREEMPT__LL is not set -# CONFIG_PREEMPT_RTB is not set -CONFIG_PREEMPT_RT_FULL=y -CONFIG_PREEMPT_COUNT=y -CONFIG_HZ_FIXED=0 -# CONFIG_HZ_100 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_250 is not set -# CONFIG_HZ_300 is not set -CONFIG_HZ_500=y -# CONFIG_HZ_1000 is not set -CONFIG_HZ=500 -CONFIG_SCHED_HRTICK=y -# CONFIG_THUMB2_KERNEL is not set -CONFIG_AEABI=y -# CONFIG_OABI_COMPAT is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -# CONFIG_CPU_SW_DOMAIN_PAN is not set -CONFIG_HW_PERF_EVENTS=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -# CONFIG_ARM_MODULE_PLTS is not set -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -CONFIG_MEMORY_ISOLATION=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -CONFIG_COMPACTION=y -CONFIG_MIGRATION=y -# CONFIG_PHYS_ADDR_T_64BIT is not set -CONFIG_ZONE_DMA_FLAG=1 -CONFIG_BOUNCE=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=8192 -# CONFIG_CLEANCACHE is not set -# CONFIG_FRONTSWAP is not set -CONFIG_CMA=y -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_AREAS=7 -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -# CONFIG_ZSMALLOC is not set -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -CONFIG_FORCE_MAX_ZONEORDER=14 -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_UACCESS_WITH_MEMCPY is not set -# CONFIG_SECCOMP is not set -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -# CONFIG_XEN is not set - -# -# Boot options -# -CONFIG_USE_OF=y -CONFIG_ATAGS=y -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -CONFIG_ZBOOT_ROM_TEXT=0 -CONFIG_ZBOOT_ROM_BSS=0 -# CONFIG_ARM_APPENDED_DTB is not set -CONFIG_CMDLINE="root=/dev/ram0 rdinit=/init noram usbcore.autosuspend=-1 coherent_pool=2M pci=nomsi" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -# CONFIG_CMDLINE_EXTEND is not set -# CONFIG_CMDLINE_FORCE is not set -CONFIG_KEXEC=y -CONFIG_ATAGS_PROC=y -# CONFIG_CRASH_DUMP is not set -CONFIG_AUTO_ZRELADDR=y - -# -# CPU Power Management -# - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_FREQ_STAT_DETAILS=y -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y - -# -# CPU frequency scaling drivers -# -# CONFIG_CPUFREQ_DT is not set -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -CONFIG_ARM_IMX6Q_CPUFREQ=y -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -# CONFIG_QORIQ_CPUFREQ is not set - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -# CONFIG_CPU_IDLE_GOV_LADDER is not set -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_DT_IDLE_STATES=y - -# -# ARM CPU Idle Drivers -# -CONFIG_ARM_CPUIDLE=y -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_NEON=y -CONFIG_KERNEL_MODE_NEON=y - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=m -# CONFIG_COREDUMP is not set - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SUSPEND_SKIP_SYNC is not set -CONFIG_HIBERNATE_CALLBACKS=y -CONFIG_HIBERNATION=y -CONFIG_PM_STD_PARTITION="" -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -CONFIG_PM_WAKELOCKS=y -CONFIG_PM_WAKELOCKS_LIMIT=100 -CONFIG_PM_WAKELOCKS_GC=y -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -CONFIG_APM_EMULATION=m -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_PM_GENERIC_DOMAINS_SLEEP=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_NET=y -CONFIG_NET_INGRESS=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_DIAG=y -CONFIG_UNIX=y -CONFIG_UNIX_DIAG=y -CONFIG_XFRM=y -CONFIG_XFRM_ALGO=y -CONFIG_XFRM_USER=y -CONFIG_XFRM_SUB_POLICY=y -CONFIG_XFRM_MIGRATE=y -CONFIG_XFRM_STATISTICS=y -CONFIG_XFRM_IPCOMP=m -CONFIG_NET_KEY=y -CONFIG_NET_KEY_MIGRATE=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_FIB_TRIE_STATS is not set -CONFIG_IP_MULTIPLE_TABLES=y -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -CONFIG_IP_ROUTE_CLASSID=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -CONFIG_NET_IPIP=m -CONFIG_NET_IPGRE_DEMUX=m -CONFIG_NET_IP_TUNNEL=m -CONFIG_NET_IPGRE=m -CONFIG_NET_IPGRE_BROADCAST=y -CONFIG_IP_MROUTE=y -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -CONFIG_SYN_COOKIES=y -CONFIG_NET_IPVTI=m -CONFIG_NET_UDP_TUNNEL=m -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -CONFIG_INET_AH=m -CONFIG_INET_ESP=m -CONFIG_INET_IPCOMP=m -CONFIG_INET_XFRM_TUNNEL=m -CONFIG_INET_TUNNEL=m -CONFIG_INET_XFRM_MODE_TRANSPORT=m -CONFIG_INET_XFRM_MODE_TUNNEL=m -CONFIG_INET_XFRM_MODE_BEET=m -CONFIG_INET_LRO=m -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -CONFIG_INET_UDP_DIAG=m -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=m -CONFIG_IPV6_ROUTER_PREF=y -CONFIG_IPV6_ROUTE_INFO=y -CONFIG_IPV6_OPTIMISTIC_DAD=y -CONFIG_INET6_AH=m -CONFIG_INET6_ESP=m -CONFIG_INET6_IPCOMP=m -CONFIG_IPV6_MIP6=m -CONFIG_IPV6_ILA=m -CONFIG_INET6_XFRM_TUNNEL=m -CONFIG_INET6_TUNNEL=m -CONFIG_INET6_XFRM_MODE_TRANSPORT=m -CONFIG_INET6_XFRM_MODE_TUNNEL=m -CONFIG_INET6_XFRM_MODE_BEET=m -CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m -CONFIG_IPV6_VTI=m -CONFIG_IPV6_SIT=m -CONFIG_IPV6_SIT_6RD=y -CONFIG_IPV6_NDISC_NODETYPE=y -CONFIG_IPV6_TUNNEL=m -CONFIG_IPV6_GRE=m -CONFIG_IPV6_MULTIPLE_TABLES=y -CONFIG_IPV6_SUBTREES=y -CONFIG_IPV6_MROUTE=y -CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y -CONFIG_IPV6_PIMSM_V2=y -# CONFIG_NETWORK_SECMARK is not set -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=m - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_INGRESS=y -CONFIG_NETFILTER_NETLINK=m -CONFIG_NETFILTER_NETLINK_ACCT=m -CONFIG_NETFILTER_NETLINK_QUEUE=m -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -CONFIG_NF_LOG_COMMON=m -CONFIG_NF_CONNTRACK_MARK=y -CONFIG_NF_CONNTRACK_ZONES=y -CONFIG_NF_CONNTRACK_PROCFS=y -CONFIG_NF_CONNTRACK_EVENTS=y -CONFIG_NF_CONNTRACK_TIMEOUT=y -CONFIG_NF_CONNTRACK_TIMESTAMP=y -CONFIG_NF_CONNTRACK_LABELS=y -CONFIG_NF_CT_PROTO_DCCP=m -CONFIG_NF_CT_PROTO_GRE=m -CONFIG_NF_CT_PROTO_SCTP=m -CONFIG_NF_CT_PROTO_UDPLITE=m -CONFIG_NF_CONNTRACK_AMANDA=m -CONFIG_NF_CONNTRACK_FTP=m -CONFIG_NF_CONNTRACK_H323=m -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -CONFIG_NF_CONNTRACK_SNMP=m -CONFIG_NF_CONNTRACK_PPTP=m -CONFIG_NF_CONNTRACK_SANE=m -CONFIG_NF_CONNTRACK_SIP=m -CONFIG_NF_CONNTRACK_TFTP=m -CONFIG_NF_CT_NETLINK=m -CONFIG_NF_CT_NETLINK_TIMEOUT=m -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -CONFIG_NF_NAT_PROTO_DCCP=m -CONFIG_NF_NAT_PROTO_UDPLITE=m -CONFIG_NF_NAT_PROTO_SCTP=m -CONFIG_NF_NAT_AMANDA=m -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -CONFIG_NF_NAT_TFTP=m -CONFIG_NF_NAT_REDIRECT=m -CONFIG_NETFILTER_SYNPROXY=m -CONFIG_NF_TABLES=m -CONFIG_NF_TABLES_INET=m -CONFIG_NF_TABLES_NETDEV=m -CONFIG_NFT_EXTHDR=m -CONFIG_NFT_META=m -CONFIG_NFT_CT=m -CONFIG_NFT_RBTREE=m -CONFIG_NFT_HASH=m -CONFIG_NFT_COUNTER=m -CONFIG_NFT_LOG=m -CONFIG_NFT_LIMIT=m -CONFIG_NFT_MASQ=m -CONFIG_NFT_REDIR=m -CONFIG_NFT_NAT=m -CONFIG_NFT_QUEUE=m -CONFIG_NFT_REJECT=m -CONFIG_NFT_REJECT_INET=m -CONFIG_NFT_COMPAT=m -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -CONFIG_NETFILTER_XT_MARK=m -CONFIG_NETFILTER_XT_CONNMARK=m -CONFIG_NETFILTER_XT_SET=m - -# -# Xtables targets -# -CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -CONFIG_NETFILTER_XT_TARGET_CT=m -CONFIG_NETFILTER_XT_TARGET_DSCP=m -CONFIG_NETFILTER_XT_TARGET_HL=m -CONFIG_NETFILTER_XT_TARGET_HMARK=m -CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -CONFIG_NETFILTER_XT_TARGET_LED=m -CONFIG_NETFILTER_XT_TARGET_LOG=m -CONFIG_NETFILTER_XT_TARGET_MARK=m -CONFIG_NETFILTER_XT_NAT=m -CONFIG_NETFILTER_XT_TARGET_NETMAP=m -CONFIG_NETFILTER_XT_TARGET_NFLOG=m -CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -CONFIG_NETFILTER_XT_TARGET_RATEEST=m -CONFIG_NETFILTER_XT_TARGET_REDIRECT=m -CONFIG_NETFILTER_XT_TARGET_TEE=m -CONFIG_NETFILTER_XT_TARGET_TPROXY=m -CONFIG_NETFILTER_XT_TARGET_TRACE=m -CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -CONFIG_NETFILTER_XT_MATCH_BPF=m -CONFIG_NETFILTER_XT_MATCH_CGROUP=m -CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -CONFIG_NETFILTER_XT_MATCH_COMMENT=m -CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -CONFIG_NETFILTER_XT_MATCH_CPU=m -CONFIG_NETFILTER_XT_MATCH_DCCP=m -CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -CONFIG_NETFILTER_XT_MATCH_DSCP=m -CONFIG_NETFILTER_XT_MATCH_ECN=m -CONFIG_NETFILTER_XT_MATCH_ESP=m -CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -CONFIG_NETFILTER_XT_MATCH_HELPER=m -CONFIG_NETFILTER_XT_MATCH_HL=m -CONFIG_NETFILTER_XT_MATCH_IPCOMP=m -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -CONFIG_NETFILTER_XT_MATCH_IPVS=m -CONFIG_NETFILTER_XT_MATCH_L2TP=m -CONFIG_NETFILTER_XT_MATCH_LENGTH=m -CONFIG_NETFILTER_XT_MATCH_LIMIT=m -CONFIG_NETFILTER_XT_MATCH_MAC=m -CONFIG_NETFILTER_XT_MATCH_MARK=m -CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -CONFIG_NETFILTER_XT_MATCH_NFACCT=m -CONFIG_NETFILTER_XT_MATCH_OSF=m -CONFIG_NETFILTER_XT_MATCH_OWNER=m -CONFIG_NETFILTER_XT_MATCH_POLICY=m -CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -CONFIG_NETFILTER_XT_MATCH_QUOTA=m -CONFIG_NETFILTER_XT_MATCH_RATEEST=m -CONFIG_NETFILTER_XT_MATCH_REALM=m -CONFIG_NETFILTER_XT_MATCH_RECENT=m -CONFIG_NETFILTER_XT_MATCH_SCTP=m -CONFIG_NETFILTER_XT_MATCH_SOCKET=m -CONFIG_NETFILTER_XT_MATCH_STATE=m -CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -CONFIG_NETFILTER_XT_MATCH_STRING=m -CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -CONFIG_NETFILTER_XT_MATCH_TIME=m -CONFIG_NETFILTER_XT_MATCH_U32=m -CONFIG_IP_SET=m -CONFIG_IP_SET_MAX=256 -CONFIG_IP_SET_BITMAP_IP=m -CONFIG_IP_SET_BITMAP_IPMAC=m -CONFIG_IP_SET_BITMAP_PORT=m -CONFIG_IP_SET_HASH_IP=m -CONFIG_IP_SET_HASH_IPMARK=m -CONFIG_IP_SET_HASH_IPPORT=m -CONFIG_IP_SET_HASH_IPPORTIP=m -CONFIG_IP_SET_HASH_IPPORTNET=m -CONFIG_IP_SET_HASH_MAC=m -CONFIG_IP_SET_HASH_NETPORTNET=m -CONFIG_IP_SET_HASH_NET=m -CONFIG_IP_SET_HASH_NETNET=m -CONFIG_IP_SET_HASH_NETPORT=m -CONFIG_IP_SET_HASH_NETIFACE=m -CONFIG_IP_SET_LIST_SET=m -CONFIG_IP_VS=m -CONFIG_IP_VS_IPV6=y -# CONFIG_IP_VS_DEBUG is not set -CONFIG_IP_VS_TAB_BITS=12 - -# -# IPVS transport protocol load balancing support -# -CONFIG_IP_VS_PROTO_TCP=y -CONFIG_IP_VS_PROTO_UDP=y -CONFIG_IP_VS_PROTO_AH_ESP=y -CONFIG_IP_VS_PROTO_ESP=y -CONFIG_IP_VS_PROTO_AH=y -CONFIG_IP_VS_PROTO_SCTP=y - -# -# IPVS scheduler -# -CONFIG_IP_VS_RR=m -CONFIG_IP_VS_WRR=m -CONFIG_IP_VS_LC=m -CONFIG_IP_VS_WLC=m -CONFIG_IP_VS_FO=m -CONFIG_IP_VS_OVF=m -CONFIG_IP_VS_LBLC=m -CONFIG_IP_VS_LBLCR=m -CONFIG_IP_VS_DH=m -CONFIG_IP_VS_SH=m -CONFIG_IP_VS_SED=m -CONFIG_IP_VS_NQ=m - -# -# IPVS SH scheduler -# -CONFIG_IP_VS_SH_TAB_BITS=8 - -# -# IPVS application helper -# -CONFIG_IP_VS_FTP=m -CONFIG_IP_VS_NFCT=y -CONFIG_IP_VS_PE_SIP=m - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_NF_CONNTRACK_PROC_COMPAT=y -CONFIG_NF_TABLES_IPV4=m -CONFIG_NFT_CHAIN_ROUTE_IPV4=m -CONFIG_NFT_REJECT_IPV4=m -CONFIG_NFT_DUP_IPV4=m -CONFIG_NF_TABLES_ARP=m -CONFIG_NF_DUP_IPV4=m -CONFIG_NF_LOG_ARP=m -CONFIG_NF_LOG_IPV4=m -CONFIG_NF_REJECT_IPV4=m -CONFIG_NF_NAT_IPV4=m -CONFIG_NFT_CHAIN_NAT_IPV4=m -CONFIG_NF_NAT_MASQUERADE_IPV4=m -CONFIG_NFT_MASQ_IPV4=m -CONFIG_NFT_REDIR_IPV4=m -CONFIG_NF_NAT_SNMP_BASIC=m -CONFIG_NF_NAT_PROTO_GRE=m -CONFIG_NF_NAT_PPTP=m -CONFIG_NF_NAT_H323=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_AH=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_RPFILTER=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_TARGET_SYNPROXY=m -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_IP_NF_TARGET_NETMAP=m -CONFIG_IP_NF_TARGET_REDIRECT=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_CLUSTERIP=m -CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_TTL=m -CONFIG_IP_NF_RAW=m -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_NF_TABLES_IPV6=m -CONFIG_NFT_CHAIN_ROUTE_IPV6=m -CONFIG_NFT_REJECT_IPV6=m -CONFIG_NFT_DUP_IPV6=m -CONFIG_NF_DUP_IPV6=m -CONFIG_NF_REJECT_IPV6=m -CONFIG_NF_LOG_IPV6=m -CONFIG_NF_NAT_IPV6=m -CONFIG_NFT_CHAIN_NAT_IPV6=m -CONFIG_NF_NAT_MASQUERADE_IPV6=m -CONFIG_NFT_MASQ_IPV6=m -CONFIG_NFT_REDIR_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_AH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_MH=m -CONFIG_IP6_NF_MATCH_RPFILTER=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_TARGET_HL=m -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -CONFIG_IP6_NF_TARGET_SYNPROXY=m -CONFIG_IP6_NF_MANGLE=m -CONFIG_IP6_NF_RAW=m -CONFIG_IP6_NF_NAT=m -CONFIG_IP6_NF_TARGET_MASQUERADE=m -CONFIG_IP6_NF_TARGET_NPT=m -CONFIG_NF_TABLES_BRIDGE=m -CONFIG_NFT_BRIDGE_META=m -CONFIG_NFT_BRIDGE_REJECT=m -CONFIG_NF_LOG_BRIDGE=m -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_IP6=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_BRIDGE_EBT_NFLOG=m -CONFIG_IP_DCCP=m -CONFIG_INET_DCCP_DIAG=m - -# -# DCCP CCIDs Configuration -# -# CONFIG_IP_DCCP_CCID2_DEBUG is not set -CONFIG_IP_DCCP_CCID3=y -# CONFIG_IP_DCCP_CCID3_DEBUG is not set -CONFIG_IP_DCCP_TFRC_LIB=y -CONFIG_IP_SCTP=m -# CONFIG_SCTP_DBG_OBJCNT is not set -# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5 is not set -# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set -CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE=y -# CONFIG_SCTP_COOKIE_HMAC_MD5 is not set -# CONFIG_SCTP_COOKIE_HMAC_SHA1 is not set -CONFIG_RDS=m -CONFIG_RDS_TCP=m -# CONFIG_RDS_DEBUG is not set -CONFIG_TIPC=m -CONFIG_TIPC_MEDIA_UDP=y -# CONFIG_ATM is not set -CONFIG_L2TP=m -# CONFIG_L2TP_DEBUGFS is not set -CONFIG_L2TP_V3=y -CONFIG_L2TP_IP=m -CONFIG_L2TP_ETH=m -CONFIG_STP=m -CONFIG_GARP=m -CONFIG_MRP=m -CONFIG_BRIDGE=m -CONFIG_BRIDGE_IGMP_SNOOPING=y -CONFIG_BRIDGE_VLAN_FILTERING=y -CONFIG_HAVE_NET_DSA=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_HWMON=y -CONFIG_NET_DSA_TAG_EDSA=y -CONFIG_VLAN_8021Q=m -CONFIG_VLAN_8021Q_GVRP=y -CONFIG_VLAN_8021Q_MVRP=y -# CONFIG_DECNET is not set -CONFIG_LLC=m -CONFIG_LLC2=m -# CONFIG_IPX is not set -CONFIG_ATALK=m -CONFIG_DEV_APPLETALK=m -CONFIG_IPDDP=m -CONFIG_IPDDP_ENCAP=y -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -CONFIG_PHONET=m -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -CONFIG_NET_SCHED=y - -# -# Queueing/Scheduling -# -CONFIG_NET_SCH_CBQ=y -CONFIG_NET_SCH_HTB=y -CONFIG_NET_SCH_HFSC=m -CONFIG_NET_SCH_PRIO=y -CONFIG_NET_SCH_MULTIQ=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFB=m -CONFIG_NET_SCH_SFQ=y -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -CONFIG_NET_SCH_NETEM=m -CONFIG_NET_SCH_DRR=m -CONFIG_NET_SCH_MQPRIO=m -CONFIG_NET_SCH_CHOKE=m -CONFIG_NET_SCH_QFQ=y -CONFIG_NET_SCH_CODEL=m -CONFIG_NET_SCH_FQ_CODEL=m -CONFIG_NET_SCH_FQ=m -CONFIG_NET_SCH_HHF=m -CONFIG_NET_SCH_PIE=m -CONFIG_NET_SCH_INGRESS=m -CONFIG_NET_SCH_PLUG=m - -# -# Classification -# -CONFIG_NET_CLS=y -CONFIG_NET_CLS_BASIC=m -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_U32=m -CONFIG_CLS_U32_PERF=y -CONFIG_CLS_U32_MARK=y -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -CONFIG_NET_CLS_FLOW=m -CONFIG_NET_CLS_CGROUP=m -CONFIG_NET_CLS_BPF=m -CONFIG_NET_CLS_FLOWER=m -CONFIG_NET_EMATCH=y -CONFIG_NET_EMATCH_STACK=32 -CONFIG_NET_EMATCH_CMP=m -CONFIG_NET_EMATCH_NBYTE=m -CONFIG_NET_EMATCH_U32=m -CONFIG_NET_EMATCH_META=m -CONFIG_NET_EMATCH_TEXT=m -CONFIG_NET_EMATCH_CANID=m -CONFIG_NET_EMATCH_IPSET=m -CONFIG_NET_CLS_ACT=y -CONFIG_NET_ACT_POLICE=m -CONFIG_NET_ACT_GACT=m -CONFIG_GACT_PROB=y -CONFIG_NET_ACT_MIRRED=m -CONFIG_NET_ACT_IPT=m -CONFIG_NET_ACT_NAT=m -CONFIG_NET_ACT_PEDIT=m -CONFIG_NET_ACT_SIMP=m -CONFIG_NET_ACT_SKBEDIT=m -CONFIG_NET_ACT_CSUM=m -CONFIG_NET_ACT_VLAN=m -CONFIG_NET_ACT_BPF=m -CONFIG_NET_ACT_CONNMARK=m -CONFIG_NET_CLS_IND=y -CONFIG_NET_SCH_FIFO=y -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -CONFIG_OPENVSWITCH=m -CONFIG_OPENVSWITCH_GRE=m -CONFIG_OPENVSWITCH_VXLAN=m -CONFIG_VSOCKETS=m -CONFIG_NETLINK_MMAP=y -CONFIG_NETLINK_DIAG=m -CONFIG_MPLS=y -CONFIG_NET_MPLS_GSO=m -# CONFIG_MPLS_ROUTING is not set -# CONFIG_HSR is not set -CONFIG_NET_SWITCHDEV=y -CONFIG_NET_L3_MASTER_DEV=y -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -CONFIG_CGROUP_NET_PRIO=y -CONFIG_CGROUP_NET_CLASSID=y -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_HAMRADIO is not set -CONFIG_CAN=m -CONFIG_CAN_RAW=m -CONFIG_CAN_BCM=m -CONFIG_CAN_GW=m - -# -# CAN Device Drivers -# -# CONFIG_CAN_VCAN is not set -# CONFIG_CAN_SLCAN is not set -CONFIG_CAN_DEV=m -CONFIG_CAN_CALC_BITTIMING=y -# CONFIG_CAN_LEDS is not set -# CONFIG_CAN_TI_HECC is not set -CONFIG_CAN_FLEXCAN=m -# CONFIG_CAN_GRCAN is not set -# CONFIG_CAN_RCAR is not set -# CONFIG_CAN_SJA1000 is not set -# CONFIG_CAN_C_CAN is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_CC770 is not set - -# -# CAN SPI interfaces -# -# CONFIG_CAN_MCP251X is not set - -# -# CAN USB interfaces -# -CONFIG_CAN_EMS_USB=m -CONFIG_CAN_ESD_USB2=m -CONFIG_CAN_GS_USB=m -CONFIG_CAN_KVASER_USB=m -CONFIG_CAN_PEAK_USB=m -CONFIG_CAN_8DEV_USB=m -# CONFIG_CAN_SOFTING is not set -# CONFIG_CAN_DEBUG_DEVICES is not set -CONFIG_IRDA=m - -# -# IrDA protocols -# -CONFIG_IRLAN=m -CONFIG_IRNET=m -CONFIG_IRCOMM=m -CONFIG_IRDA_ULTRA=y - -# -# IrDA options -# -# CONFIG_IRDA_CACHE_LAST_LSAP is not set -CONFIG_IRDA_FAST_RR=y -# CONFIG_IRDA_DEBUG is not set - -# -# Infrared-port device drivers -# - -# -# SIR device drivers -# -CONFIG_IRTTY_SIR=m - -# -# Dongle support -# -CONFIG_DONGLE=y -CONFIG_ESI_DONGLE=m -CONFIG_ACTISYS_DONGLE=m -CONFIG_TEKRAM_DONGLE=m -CONFIG_TOIM3232_DONGLE=m -CONFIG_LITELINK_DONGLE=m -CONFIG_MA600_DONGLE=m -CONFIG_GIRBIL_DONGLE=m -CONFIG_MCP2120_DONGLE=m -CONFIG_OLD_BELKIN_DONGLE=m -CONFIG_ACT200L_DONGLE=m -CONFIG_KINGSUN_DONGLE=m -CONFIG_KSDAZZLE_DONGLE=m -CONFIG_KS959_DONGLE=m - -# -# FIR device drivers -# -CONFIG_USB_IRDA=m -CONFIG_SIGMATEL_FIR=m -CONFIG_VLSI_FIR=m -CONFIG_MCS_FIR=m -CONFIG_BT=y -CONFIG_BT_BREDR=y -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_CMTP=m -CONFIG_BT_HIDP=y -CONFIG_BT_HS=y -CONFIG_BT_LE=y -# CONFIG_BT_DEBUGFS is not set - -# -# Bluetooth device drivers -# -CONFIG_BT_INTEL=y -CONFIG_BT_BCM=y -CONFIG_BT_RTL=m -CONFIG_BT_QCA=y -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTUSB_BCM=y -CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -CONFIG_BT_HCIUART=y -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_LL=y -CONFIG_BT_HCIUART_3WIRE=y -CONFIG_BT_HCIUART_INTEL=y -CONFIG_BT_HCIUART_BCM=y -CONFIG_BT_HCIUART_QCA=y -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBPA10X=m -CONFIG_BT_HCIBFUSB=m -CONFIG_BT_HCIVHCI=m -CONFIG_BT_MRVL=m -CONFIG_BT_MRVL_SDIO=m -CONFIG_BT_ATH3K=m -CONFIG_BT_WILINK=m -CONFIG_AF_RXRPC=m -# CONFIG_AF_RXRPC_DEBUG is not set -# CONFIG_RXKAD is not set -CONFIG_FIB_RULES=y -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -CONFIG_CFG80211_CERTIFICATION_ONUS=y -# CONFIG_CFG80211_REG_CELLULAR_HINTS is not set -# CONFIG_CFG80211_REG_RELAX_NO_IR is not set -# CONFIG_CFG80211_DEFAULT_PS is not set -# CONFIG_CFG80211_DEBUGFS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -CONFIG_CFG80211_CRDA_SUPPORT=y -CONFIG_CFG80211_WEXT=y -CONFIG_CFG80211_WEXT_EXPORT=y -CONFIG_LIB80211=m -CONFIG_LIB80211_CRYPT_WEP=m -CONFIG_LIB80211_CRYPT_CCMP=m -CONFIG_LIB80211_CRYPT_TKIP=m -# CONFIG_LIB80211_DEBUG is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -CONFIG_MAC80211_RC_MINSTREL_VHT=y -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set -CONFIG_RFKILL=y -CONFIG_RFKILL_LEDS=y -CONFIG_RFKILL_INPUT=y -CONFIG_RFKILL_REGULATOR=y -CONFIG_RFKILL_GPIO=y -# CONFIG_NET_9P is not set -CONFIG_CAIF=m -# CONFIG_CAIF_DEBUG is not set -CONFIG_CAIF_NETDEV=m -CONFIG_CAIF_USB=m -CONFIG_CEPH_LIB=m -# CONFIG_CEPH_LIB_PRETTYDEBUG is not set -CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y -CONFIG_NFC=m -# CONFIG_NFC_DIGITAL is not set -# CONFIG_NFC_NCI is not set -# CONFIG_NFC_HCI is not set - -# -# Near Field Communication (NFC) devices -# -# CONFIG_NFC_PN533 is not set -# CONFIG_NFC_SIM is not set -CONFIG_LWTUNNEL=y -CONFIG_HAVE_BPF_JIT=y - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -# CONFIG_STANDALONE is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -CONFIG_FW_LOADER_USER_HELPER=y -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -CONFIG_WANT_DEV_COREDUMP=y -CONFIG_ALLOW_DEV_COREDUMP=y -CONFIG_DEV_COREDUMP=y -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_SOC_BUS=y -CONFIG_REGMAP=y -CONFIG_REGMAP_AC97=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_FENCE_TRACE is not set -CONFIG_DMA_CMA=y - -# -# Default contiguous memory area size: -# -CONFIG_CMA_SIZE_MBYTES=320 -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_ALIGNMENT=8 - -# -# Bus devices -# -# CONFIG_ARM_CCI400_PMU is not set -# CONFIG_ARM_CCI500_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_BRCMSTB_GISB_ARB is not set -CONFIG_IMX_WEIM=y -# CONFIG_VEXPRESS_CONFIG is not set -CONFIG_CONNECTOR=y -CONFIG_PROC_EVENTS=y -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_AFS_PARTS is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_PARTITIONED_MASTER is not set - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PHYSMAP is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_IMPA7 is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_PMC551 is not set -CONFIG_MTD_DATAFLASH=y -# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set -# CONFIG_MTD_DATAFLASH_OTP is not set -# CONFIG_MTD_M25P80 is not set -CONFIG_MTD_SST25L=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_ECC=y -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND=y -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_NAND_DENALI_PCI is not set -# CONFIG_MTD_NAND_DENALI_DT is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_GPMI_NAND is not set -# CONFIG_MTD_NAND_BRCMNAND is not set -# CONFIG_MTD_NAND_PLATFORM is not set -CONFIG_MTD_NAND_MXC=y -# CONFIG_MTD_NAND_HISI504 is not set -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR & LPDDR2 PCM memory drivers -# -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_LPDDR2_NVM is not set -CONFIG_MTD_SPI_NOR=m -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_SPI_FSL_QUADSPI=m -CONFIG_MTD_UBI=m -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -# CONFIG_MTD_UBI_BLOCK is not set -CONFIG_DTC=y -CONFIG_OF=y -# CONFIG_OF_UNITTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_MTD=y -CONFIG_OF_RESERVED_MEM=y -# CONFIG_OF_OVERLAY is not set -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 -CONFIG_BLK_DEV_CRYPTOLOOP=m -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_CDROM_PKTCDVD=m -CONFIG_CDROM_PKTCDVD_BUFFERS=8 -# CONFIG_CDROM_PKTCDVD_WCACHE is not set -# CONFIG_ATA_OVER_ETH is not set -CONFIG_MG_DISK=y -CONFIG_MG_DISK_RES=0 -# CONFIG_VIRTIO_BLK is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -CONFIG_BLK_DEV_NVME=y - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -CONFIG_HWLAT_DETECTOR=m -# CONFIG_PHANTOM is not set -# CONFIG_SGI_IOC4 is not set -CONFIG_TIFM_CORE=y -CONFIG_TIFM_7XX1=y -# CONFIG_ICS932S401 is not set -CONFIG_ENCLOSURE_SERVICES=y -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_SRAM=y -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -CONFIG_EEPROM_AT24=y -CONFIG_EEPROM_AT25=y -# CONFIG_EEPROM_LEGACY is not set -CONFIG_EEPROM_MAX6875=y -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set -CONFIG_CB710_CORE=y -# CONFIG_CB710_DEBUG is not set -CONFIG_CB710_DEBUG_ASSUMPTIONS=y - -# -# Texas Instruments shared transport line discipline -# -CONFIG_TI_ST=m -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -CONFIG_ALTERA_STAPL=m - -# -# Intel MIC Bus Driver -# - -# -# SCIF Bus Driver -# - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# -CONFIG_ECHO=m -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_KERNEL_API is not set -# CONFIG_CXL_EEH is not set -CONFIG_HAVE_IDE=y -# CONFIG_IDE is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -CONFIG_SCSI_NETLINK=y -# CONFIG_SCSI_MQ_DEFAULT is not set -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -CONFIG_BLK_DEV_SR_VENDOR=y -# CONFIG_CHR_DEV_SG is not set -CONFIG_CHR_DEV_SCH=m -CONFIG_SCSI_ENCLOSURE=y -# CONFIG_SCSI_CONSTANTS is not set -CONFIG_SCSI_LOGGING=y -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -CONFIG_SCSI_FC_ATTRS=m -CONFIG_SCSI_ISCSI_ATTRS=m -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=m -CONFIG_ISCSI_BOOT_SYSFS=m -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -CONFIG_SCSI_UFSHCD=m -# CONFIG_SCSI_UFSHCD_PCI is not set -CONFIG_SCSI_UFSHCD_PLATFORM=m -# CONFIG_SCSI_HPTIOP is not set -CONFIG_LIBFC=m -CONFIG_LIBFCOE=m -# CONFIG_FCOE is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_LPFC is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_DH is not set -CONFIG_SCSI_OSD_INITIATOR=m -# CONFIG_SCSI_OSD_ULD is not set -CONFIG_SCSI_OSD_DPRINT_SENSE=1 -# CONFIG_SCSI_OSD_DEBUG is not set -CONFIG_ATA=y -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_VERBOSE_ERROR is not set -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_AHCI_IMX=y -# CONFIG_AHCI_CEVA is not set -# CONFIG_AHCI_QORIQ is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_SIL24 is not set -CONFIG_ATA_SFF=y - -# -# SFF controllers with custom DMA interface -# -# CONFIG_PDC_ADMA is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SX4 is not set -CONFIG_ATA_BMDMA=y - -# -# SATA SFF controllers with BMDMA -# -# CONFIG_ATA_PIIX is not set -CONFIG_SATA_MV=y -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set - -# -# PATA SFF controllers with BMDMA -# -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -CONFIG_PATA_IMX=y -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set - -# -# PIO-only SFF controllers -# -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_RZ1000 is not set - -# -# Generic fallback / legacy drivers -# -# CONFIG_ATA_GENERIC is not set -# CONFIG_PATA_LEGACY is not set -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_AUTODETECT=y -CONFIG_MD_LINEAR=y -CONFIG_MD_RAID0=y -CONFIG_MD_RAID1=y -CONFIG_MD_RAID10=y -CONFIG_MD_RAID456=m -CONFIG_MD_MULTIPATH=m -CONFIG_MD_FAULTY=m -# CONFIG_MD_CLUSTER is not set -CONFIG_BLK_DEV_DM_BUILTIN=y -CONFIG_BLK_DEV_DM=m -# CONFIG_DM_MQ_DEFAULT is not set -# CONFIG_DM_DEBUG is not set -CONFIG_DM_BUFIO=m -CONFIG_DM_BIO_PRISON=m -CONFIG_DM_PERSISTENT_DATA=m -# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set -CONFIG_DM_CRYPT=m -CONFIG_DM_SNAPSHOT=m -CONFIG_DM_THIN_PROVISIONING=m -CONFIG_DM_CACHE=m -CONFIG_DM_CACHE_MQ=m -CONFIG_DM_CACHE_SMQ=m -CONFIG_DM_CACHE_CLEANER=m -# CONFIG_DM_ERA is not set -CONFIG_DM_MIRROR=m -CONFIG_DM_LOG_USERSPACE=m -CONFIG_DM_RAID=m -CONFIG_DM_ZERO=m -CONFIG_DM_MULTIPATH=m -CONFIG_DM_MULTIPATH_QL=m -CONFIG_DM_MULTIPATH_ST=m -CONFIG_DM_DELAY=m -CONFIG_DM_UEVENT=y -CONFIG_DM_FLAKEY=m -CONFIG_DM_VERITY=m -# CONFIG_DM_SWITCH is not set -# CONFIG_DM_LOG_WRITES is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -CONFIG_NETDEVICES=y -CONFIG_MII=m -CONFIG_NET_CORE=y -CONFIG_BONDING=m -CONFIG_DUMMY=m -CONFIG_EQUALIZER=m -# CONFIG_NET_FC is not set -# CONFIG_IFB is not set -CONFIG_NET_TEAM=m -CONFIG_NET_TEAM_MODE_BROADCAST=m -CONFIG_NET_TEAM_MODE_ROUNDROBIN=m -CONFIG_NET_TEAM_MODE_RANDOM=m -CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=m -CONFIG_NET_TEAM_MODE_LOADBALANCE=m -CONFIG_MACVLAN=m -CONFIG_MACVTAP=m -CONFIG_IPVLAN=m -CONFIG_VXLAN=m -# CONFIG_GENEVE is not set -CONFIG_NETCONSOLE=m -CONFIG_NETCONSOLE_DYNAMIC=y -CONFIG_NETPOLL=y -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=m -# CONFIG_TUN_VNET_CROSS_LE is not set -CONFIG_VETH=m -# CONFIG_VIRTIO_NET is not set -CONFIG_NLMON=m -# CONFIG_NET_VRF is not set -# CONFIG_ARCNET is not set - -# -# CAIF transport drivers -# -CONFIG_CAIF_TTY=m -CONFIG_CAIF_SPI_SLAVE=m -CONFIG_CAIF_SPI_SYNC=y -CONFIG_CAIF_HSI=m -CONFIG_CAIF_VIRTIO=m -# CONFIG_VHOST_NET is not set -CONFIG_VHOST_RING=m -# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set - -# -# Distributed Switch Architecture drivers -# -CONFIG_NET_DSA_MV88E6XXX=y -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -# CONFIG_NET_DSA_MV88E6171 is not set -CONFIG_NET_DSA_MV88E6352=y -# CONFIG_NET_DSA_BCM_SF2 is not set -CONFIG_ETHERNET=y -CONFIG_MDIO=m -# CONFIG_NET_VENDOR_3COM is not set -# CONFIG_NET_VENDOR_ADAPTEC is not set -# CONFIG_NET_VENDOR_AGERE is not set -# CONFIG_NET_VENDOR_ALTEON is not set -# CONFIG_ALTERA_TSE is not set -# CONFIG_NET_VENDOR_AMD is not set -# CONFIG_NET_VENDOR_ARC is not set -CONFIG_NET_VENDOR_ATHEROS=y -CONFIG_ATL2=m -CONFIG_ATL1=m -CONFIG_ATL1E=m -CONFIG_ATL1C=m -CONFIG_ALX=m -# CONFIG_NET_VENDOR_AURORA is not set -# CONFIG_NET_CADENCE is not set -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_VENDOR_BROCADE is not set -# CONFIG_NET_VENDOR_CAVIUM is not set -# CONFIG_NET_VENDOR_CHELSIO is not set -# CONFIG_NET_VENDOR_CIRRUS is not set -# CONFIG_NET_VENDOR_CISCO is not set -# CONFIG_DM9000 is not set -# CONFIG_DNET is not set -# CONFIG_NET_VENDOR_DEC is not set -# CONFIG_NET_VENDOR_DLINK is not set -# CONFIG_NET_VENDOR_EMULEX is not set -# CONFIG_NET_VENDOR_EZCHIP is not set -# CONFIG_NET_VENDOR_EXAR is not set -# CONFIG_NET_VENDOR_FARADAY is not set -CONFIG_NET_VENDOR_FREESCALE=y -CONFIG_FEC=y -CONFIG_FSL_PQ_MDIO=y -# CONFIG_FSL_XGMAC_MDIO is not set -CONFIG_GIANFAR=y -# CONFIG_NET_VENDOR_HISILICON is not set -# CONFIG_NET_VENDOR_HP is not set -CONFIG_NET_VENDOR_INTEL=y -# CONFIG_E100 is not set -CONFIG_E1000=m -CONFIG_E1000E=m -CONFIG_IGB=m -CONFIG_IGB_HWMON=y -CONFIG_IGBVF=m -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_FM10K is not set -CONFIG_NET_VENDOR_I825XX=y -# CONFIG_JME is not set -CONFIG_NET_VENDOR_MARVELL=y -CONFIG_MVMDIO=y -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -# CONFIG_NET_VENDOR_MELLANOX is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_MYRI is not set -# CONFIG_FEALNX is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_NVIDIA is not set -# CONFIG_NET_VENDOR_OKI is not set -# CONFIG_ETHOC is not set -# CONFIG_NET_PACKET_ENGINE is not set -# CONFIG_NET_VENDOR_QLOGIC is not set -# CONFIG_NET_VENDOR_QUALCOMM is not set -# CONFIG_NET_VENDOR_REALTEK is not set -# CONFIG_NET_VENDOR_RENESAS is not set -# CONFIG_NET_VENDOR_RDC is not set -# CONFIG_NET_VENDOR_ROCKER is not set -# CONFIG_NET_VENDOR_SAMSUNG is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SILAN is not set -# CONFIG_NET_VENDOR_SIS is not set -# CONFIG_SFC is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -# CONFIG_NET_VENDOR_SUN is not set -# CONFIG_NET_VENDOR_SYNOPSYS is not set -# CONFIG_NET_VENDOR_TEHUTI is not set -# CONFIG_NET_VENDOR_TI is not set -# CONFIG_NET_VENDOR_VIA is not set -# CONFIG_NET_VENDOR_WIZNET is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PHYLIB=y -CONFIG_SWPHY=y - -# -# MII PHY device drivers -# -# CONFIG_AQUANTIA_PHY is not set -CONFIG_AT803X_PHY=y -# CONFIG_AMD_PHY is not set -CONFIG_MARVELL_PHY=y -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -CONFIG_LXT_PHY=m -# CONFIG_CICADA_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_TERANETICS_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -CONFIG_MICROCHIP_PHY=y -CONFIG_FIXED_PHY=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_GPIO=y -CONFIG_MDIO_BUS_MUX=y -CONFIG_MDIO_BUS_MUX_GPIO=y -CONFIG_MDIO_BUS_MUX_MMIOREG=y -CONFIG_MDIO_BCM_UNIMAC=m -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -CONFIG_PPP_FILTER=y -CONFIG_PPP_MPPE=m -CONFIG_PPP_MULTILINK=y -CONFIG_PPPOE=m -CONFIG_PPTP=m -CONFIG_PPPOL2TP=m -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m -CONFIG_SLIP=m -CONFIG_SLHC=m -CONFIG_SLIP_COMPRESSED=y -CONFIG_SLIP_SMART=y -CONFIG_SLIP_MODE_SLIP6=y -CONFIG_USB_NET_DRIVERS=m -CONFIG_USB_CATC=m -CONFIG_USB_KAWETH=m -CONFIG_USB_PEGASUS=m -CONFIG_USB_RTL8150=m -CONFIG_USB_RTL8152=m -CONFIG_USB_LAN78XX=m -CONFIG_USB_USBNET=m -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=m -CONFIG_USB_NET_CDC_EEM=m -CONFIG_USB_NET_CDC_NCM=m -CONFIG_USB_NET_HUAWEI_CDC_NCM=m -CONFIG_USB_NET_CDC_MBIM=m -CONFIG_USB_NET_DM9601=m -CONFIG_USB_NET_SR9700=m -CONFIG_USB_NET_SR9800=m -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=m -CONFIG_USB_NET_GL620A=m -CONFIG_USB_NET_NET1080=m -CONFIG_USB_NET_PLUSB=m -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=m -CONFIG_USB_NET_CDC_SUBSET=m -CONFIG_USB_ALI_M5632=y -CONFIG_USB_AN2720=y -CONFIG_USB_BELKIN=y -CONFIG_USB_ARMLINUX=y -CONFIG_USB_EPSON2888=y -CONFIG_USB_KC2190=y -CONFIG_USB_NET_ZAURUS=m -CONFIG_USB_NET_CX82310_ETH=m -CONFIG_USB_NET_KALMIA=m -CONFIG_USB_NET_QMI_WWAN=m -CONFIG_USB_HSO=m -CONFIG_USB_NET_INT51X1=m -# CONFIG_USB_CDC_PHONET is not set -CONFIG_USB_IPHETH=m -CONFIG_USB_SIERRA_NET=m -CONFIG_USB_VL600=m -CONFIG_USB_NET_CH9200=m -CONFIG_WLAN=y -CONFIG_LIBERTAS_THINFIRM=m -# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set -CONFIG_LIBERTAS_THINFIRM_USB=m -CONFIG_ATMEL=m -CONFIG_PCI_ATMEL=m -CONFIG_AT76C50X_USB=m -CONFIG_PRISM54=m -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -CONFIG_ADM8211=m -CONFIG_RTL8180=m -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -CONFIG_MAC80211_HWSIM=m -CONFIG_MWL8K=m -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS is not set -CONFIG_ATH5K=m -# CONFIG_ATH5K_DEBUG is not set -# CONFIG_ATH5K_TRACER is not set -CONFIG_ATH5K_PCI=y -# CONFIG_ATH5K_TEST_CHANNELS is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_PCI=y -CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_DFS_CERTIFIED is not set -# CONFIG_ATH9K_DYNACK is not set -CONFIG_ATH9K_WOW=y -CONFIG_ATH9K_RFKILL=y -CONFIG_ATH9K_CHANNEL_CONTEXT=y -CONFIG_ATH9K_PCOEM=y -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -CONFIG_CARL9170=m -CONFIG_CARL9170_LEDS=y -CONFIG_CARL9170_WPC=y -CONFIG_CARL9170_HWRNG=y -CONFIG_ATH6KL=m -CONFIG_ATH6KL_SDIO=m -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -# CONFIG_ATH6KL_TRACING is not set -# CONFIG_ATH6KL_REGDOMAIN is not set -CONFIG_AR5523=m -CONFIG_WIL6210=m -CONFIG_WIL6210_ISR_COR=y -CONFIG_WIL6210_TRACING=y -CONFIG_ATH10K=m -CONFIG_ATH10K_PCI=m -# CONFIG_ATH10K_DEBUG is not set -# CONFIG_ATH10K_DEBUGFS is not set -# CONFIG_ATH10K_TRACING is not set -# CONFIG_ATH10K_DFS_CERTIFIED is not set -CONFIG_WCN36XX=m -# CONFIG_WCN36XX_DEBUGFS is not set -CONFIG_B43=m -CONFIG_B43_BCMA=y -CONFIG_B43_SSB=y -CONFIG_B43_BUSES_BCMA_AND_SSB=y -# CONFIG_B43_BUSES_BCMA is not set -# CONFIG_B43_BUSES_SSB is not set -CONFIG_B43_PCI_AUTOSELECT=y -CONFIG_B43_PCICORE_AUTOSELECT=y -CONFIG_B43_SDIO=y -CONFIG_B43_BCMA_PIO=y -CONFIG_B43_PIO=y -CONFIG_B43_PHY_G=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_PHY_HT=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -CONFIG_B43LEGACY=m -CONFIG_B43LEGACY_PCI_AUTOSELECT=y -CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y -CONFIG_B43LEGACY_LEDS=y -CONFIG_B43LEGACY_HWRNG=y -# CONFIG_B43LEGACY_DEBUG is not set -CONFIG_B43LEGACY_DMA=y -CONFIG_B43LEGACY_PIO=y -CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y -# CONFIG_B43LEGACY_DMA_MODE is not set -# CONFIG_B43LEGACY_PIO_MODE is not set -CONFIG_BRCMUTIL=m -CONFIG_BRCMSMAC=m -CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_PROTO_BCDC=y -CONFIG_BRCMFMAC_PROTO_MSGBUF=y -CONFIG_BRCMFMAC_SDIO=y -CONFIG_BRCMFMAC_USB=y -CONFIG_BRCMFMAC_PCIE=y -# CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y -CONFIG_HOSTAP_FIRMWARE_NVRAM=y -CONFIG_HOSTAP_PLX=m -CONFIG_HOSTAP_PCI=m -CONFIG_IPW2100=m -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2100_DEBUG is not set -CONFIG_IPW2200=m -CONFIG_IPW2200_MONITOR=y -CONFIG_IPW2200_RADIOTAP=y -CONFIG_IPW2200_PROMISCUOUS=y -CONFIG_IPW2200_QOS=y -CONFIG_IPW2200_DEBUG=y -CONFIG_LIBIPW=m -CONFIG_LIBIPW_DEBUG=y -CONFIG_IWLWIFI=m -CONFIG_IWLWIFI_LEDS=y -CONFIG_IWLDVM=m -CONFIG_IWLMVM=m -CONFIG_IWLWIFI_OPMODE_MODULAR=y -# CONFIG_IWLWIFI_BCAST_FILTERING is not set -CONFIG_IWLWIFI_UAPSD=y - -# -# Debugging Options -# -# CONFIG_IWLWIFI_DEBUG is not set -# CONFIG_IWLWIFI_DEVICE_TRACING is not set -CONFIG_IWLEGACY=m -CONFIG_IWL4965=m -CONFIG_IWL3945=m - -# -# iwl3945 / iwl4965 Debugging Options -# -# CONFIG_IWLEGACY_DEBUG is not set -CONFIG_LIBERTAS=m -CONFIG_LIBERTAS_USB=m -CONFIG_LIBERTAS_SDIO=m -CONFIG_LIBERTAS_SPI=m -# CONFIG_LIBERTAS_DEBUG is not set -CONFIG_LIBERTAS_MESH=y -CONFIG_HERMES=m -CONFIG_HERMES_PRISM=y -CONFIG_HERMES_CACHE_FW_ON_INIT=y -CONFIG_PLX_HERMES=m -CONFIG_TMD_HERMES=m -CONFIG_NORTEL_HERMES=m -CONFIG_PCI_HERMES=m -CONFIG_ORINOCO_USB=m -CONFIG_P54_COMMON=m -CONFIG_P54_USB=m -CONFIG_P54_PCI=m -CONFIG_P54_SPI=m -CONFIG_P54_SPI_DEFAULT_EEPROM=y -CONFIG_P54_LEDS=y -CONFIG_RT2X00=m -CONFIG_RT2400PCI=m -CONFIG_RT2500PCI=m -CONFIG_RT61PCI=m -CONFIG_RT2800PCI=m -CONFIG_RT2800PCI_RT33XX=y -CONFIG_RT2800PCI_RT35XX=y -CONFIG_RT2800PCI_RT53XX=y -CONFIG_RT2800PCI_RT3290=y -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2800_LIB_MMIO=m -CONFIG_RT2X00_LIB_MMIO=m -CONFIG_RT2X00_LIB_PCI=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_DEBUG is not set -CONFIG_WL_MEDIATEK=y -CONFIG_MT7601U=m -CONFIG_RTL8XXXU=m -# CONFIG_RTL8XXXU_UNTESTED is not set -# CONFIG_RTL8192CU is not set -CONFIG_WL_TI=y -CONFIG_WL1251=m -CONFIG_WL1251_SPI=m -CONFIG_WL1251_SDIO=m -CONFIG_WL12XX=m -CONFIG_WL18XX=m -CONFIG_WLCORE=m -CONFIG_WLCORE_SPI=m -CONFIG_WLCORE_SDIO=m -CONFIG_WILINK_PLATFORM_DATA=y -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -CONFIG_MWIFIEX=m -CONFIG_MWIFIEX_SDIO=m -CONFIG_MWIFIEX_PCIE=m -CONFIG_MWIFIEX_USB=m -CONFIG_CW1200=m -CONFIG_CW1200_WLAN_SDIO=m -CONFIG_CW1200_WLAN_SPI=m -CONFIG_RSI_91X=m -CONFIG_RSI_DEBUGFS=y -CONFIG_RSI_SDIO=m -CONFIG_RSI_USB=m - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -CONFIG_WAN=y -CONFIG_HDLC=m -CONFIG_HDLC_RAW=m -CONFIG_HDLC_RAW_ETH=m -CONFIG_HDLC_CISCO=m -CONFIG_HDLC_FR=m -CONFIG_HDLC_PPP=m - -# -# X.25/LAPB support is disabled -# -# CONFIG_PCI200SYN is not set -CONFIG_WANXL=m -# CONFIG_WANXL_BUILD_FIRMWARE is not set -CONFIG_PC300TOO=m -CONFIG_FARSYNC=m -CONFIG_DSCC4=m -# CONFIG_DSCC4_PCISYNC is not set -# CONFIG_DSCC4_PCI_RST is not set -# CONFIG_DLCI is not set -# CONFIG_VMXNET3 is not set -CONFIG_ISDN=y -CONFIG_ISDN_I4L=m -# CONFIG_ISDN_PPP is not set -# CONFIG_ISDN_AUDIO is not set - -# -# ISDN feature submodules -# -# CONFIG_ISDN_DIVERSION is not set - -# -# ISDN4Linux hardware drivers -# - -# -# Passive cards -# -# CONFIG_ISDN_DRV_HISAX is not set - -# -# Active cards -# -CONFIG_ISDN_CAPI=m -CONFIG_CAPI_TRACE=y -# CONFIG_ISDN_CAPI_CAPI20 is not set -# CONFIG_ISDN_CAPI_CAPIDRV is not set - -# -# CAPI hardware drivers -# -# CONFIG_CAPI_AVM is not set -# CONFIG_CAPI_EICON is not set -CONFIG_ISDN_DRV_GIGASET=m -CONFIG_GIGASET_CAPI=y -# CONFIG_GIGASET_I4L is not set -# CONFIG_GIGASET_DUMMYLL is not set -# CONFIG_GIGASET_BASE is not set -# CONFIG_GIGASET_M105 is not set -# CONFIG_GIGASET_M101 is not set -# CONFIG_GIGASET_DEBUG is not set -CONFIG_HYSDN=m -CONFIG_HYSDN_CAPI=y -CONFIG_MISDN=m -CONFIG_MISDN_DSP=m -CONFIG_MISDN_L1OIP=m - -# -# mISDN hardware drivers -# -CONFIG_MISDN_HFCPCI=m -CONFIG_MISDN_HFCMULTI=m -CONFIG_MISDN_HFCUSB=m -CONFIG_MISDN_AVMFRITZ=m -CONFIG_MISDN_SPEEDFAX=m -CONFIG_MISDN_INFINEON=m -CONFIG_MISDN_W6692=m -CONFIG_MISDN_NETJET=m -CONFIG_MISDN_IPAC=m -CONFIG_MISDN_ISAR=m -CONFIG_ISDN_HDLC=m -# CONFIG_NVM is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=m -CONFIG_INPUT_FF_MEMLESS=m -CONFIG_INPUT_POLLDEV=y -CONFIG_INPUT_SPARSEKMAP=m -CONFIG_INPUT_MATRIXKMAP=y - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=m -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=m -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_APMPOWER is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_LKKBD is not set -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_GPIO_POLLED=y -CONFIG_KEYBOARD_TCA6416=m -CONFIG_KEYBOARD_TCA8418=m -CONFIG_KEYBOARD_MATRIX=m -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -CONFIG_KEYBOARD_IMX=m -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_OMAP4 is not set -CONFIG_KEYBOARD_XTKBD=m -# CONFIG_KEYBOARD_CAP11XX is not set -# CONFIG_KEYBOARD_BCM is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=m -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -CONFIG_MOUSE_PS2_CYPRESS=y -CONFIG_MOUSE_PS2_TRACKPOINT=y -CONFIG_MOUSE_PS2_ELANTECH=y -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -CONFIG_MOUSE_PS2_FOCALTECH=y -CONFIG_MOUSE_SERIAL=m -CONFIG_MOUSE_APPLETOUCH=m -CONFIG_MOUSE_BCM5974=m -CONFIG_MOUSE_CYAPA=m -CONFIG_MOUSE_ELAN_I2C=m -CONFIG_MOUSE_ELAN_I2C_I2C=y -# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set -CONFIG_MOUSE_VSXXXAA=m -CONFIG_MOUSE_GPIO=m -CONFIG_MOUSE_SYNAPTICS_I2C=m -CONFIG_MOUSE_SYNAPTICS_USB=m -CONFIG_INPUT_JOYSTICK=y -CONFIG_JOYSTICK_ANALOG=m -CONFIG_JOYSTICK_A3D=m -CONFIG_JOYSTICK_ADI=m -CONFIG_JOYSTICK_COBRA=m -CONFIG_JOYSTICK_GF2K=m -CONFIG_JOYSTICK_GRIP=m -CONFIG_JOYSTICK_GRIP_MP=m -CONFIG_JOYSTICK_GUILLEMOT=m -CONFIG_JOYSTICK_INTERACT=m -CONFIG_JOYSTICK_SIDEWINDER=m -CONFIG_JOYSTICK_TMDC=m -CONFIG_JOYSTICK_IFORCE=m -CONFIG_JOYSTICK_IFORCE_USB=y -CONFIG_JOYSTICK_IFORCE_232=y -CONFIG_JOYSTICK_WARRIOR=m -CONFIG_JOYSTICK_MAGELLAN=m -CONFIG_JOYSTICK_SPACEORB=m -CONFIG_JOYSTICK_SPACEBALL=m -CONFIG_JOYSTICK_STINGER=m -CONFIG_JOYSTICK_TWIDJOY=m -CONFIG_JOYSTICK_ZHENHUA=m -CONFIG_JOYSTICK_AS5011=m -CONFIG_JOYSTICK_JOYDUMP=m -CONFIG_JOYSTICK_XPAD=m -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -# CONFIG_INPUT_TABLET is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -CONFIG_TOUCHSCREEN_88PM860X=m -CONFIG_TOUCHSCREEN_ADS7846=m -CONFIG_TOUCHSCREEN_AD7877=m -CONFIG_TOUCHSCREEN_AD7879=m -CONFIG_TOUCHSCREEN_AD7879_I2C=m -CONFIG_TOUCHSCREEN_AD7879_SPI=m -CONFIG_TOUCHSCREEN_AR1021_I2C=m -CONFIG_TOUCHSCREEN_ATMEL_MXT=m -CONFIG_TOUCHSCREEN_AUO_PIXCIR=m -CONFIG_TOUCHSCREEN_BU21013=m -CONFIG_TOUCHSCREEN_CHIPONE_ICN8318=m -CONFIG_TOUCHSCREEN_CY8CTMG110=m -CONFIG_TOUCHSCREEN_CYTTSP_CORE=m -CONFIG_TOUCHSCREEN_CYTTSP_I2C=m -CONFIG_TOUCHSCREEN_CYTTSP_SPI=m -CONFIG_TOUCHSCREEN_CYTTSP4_CORE=m -CONFIG_TOUCHSCREEN_CYTTSP4_I2C=m -CONFIG_TOUCHSCREEN_CYTTSP4_SPI=m -CONFIG_TOUCHSCREEN_DA9052=m -CONFIG_TOUCHSCREEN_DYNAPRO=m -CONFIG_TOUCHSCREEN_HAMPSHIRE=m -CONFIG_TOUCHSCREEN_EETI=m -CONFIG_TOUCHSCREEN_EGALAX=m -CONFIG_TOUCHSCREEN_FT6236=m -CONFIG_TOUCHSCREEN_FUJITSU=m -CONFIG_TOUCHSCREEN_GOODIX=m -CONFIG_TOUCHSCREEN_ILI210X=m -CONFIG_TOUCHSCREEN_GUNZE=m -CONFIG_TOUCHSCREEN_ELAN=m -CONFIG_TOUCHSCREEN_ELO=m -CONFIG_TOUCHSCREEN_WACOM_W8001=m -CONFIG_TOUCHSCREEN_WACOM_I2C=m -CONFIG_TOUCHSCREEN_MAX11801=m -CONFIG_TOUCHSCREEN_MCS5000=m -CONFIG_TOUCHSCREEN_MMS114=m -CONFIG_TOUCHSCREEN_MTOUCH=m -CONFIG_TOUCHSCREEN_IMX6UL_TSC=m -CONFIG_TOUCHSCREEN_INEXIO=m -CONFIG_TOUCHSCREEN_MK712=m -CONFIG_TOUCHSCREEN_PENMOUNT=m -CONFIG_TOUCHSCREEN_EDT_FT5X06=m -CONFIG_TOUCHSCREEN_TOUCHRIGHT=m -CONFIG_TOUCHSCREEN_TOUCHWIN=m -CONFIG_TOUCHSCREEN_PIXCIR=m -CONFIG_TOUCHSCREEN_WDT87XX_I2C=m -CONFIG_TOUCHSCREEN_WM97XX=m -CONFIG_TOUCHSCREEN_WM9705=y -CONFIG_TOUCHSCREEN_WM9712=y -CONFIG_TOUCHSCREEN_WM9713=y -CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -CONFIG_TOUCHSCREEN_MC13783=m -CONFIG_TOUCHSCREEN_USB_EGALAX=y -CONFIG_TOUCHSCREEN_USB_PANJIT=y -CONFIG_TOUCHSCREEN_USB_3M=y -CONFIG_TOUCHSCREEN_USB_ITM=y -CONFIG_TOUCHSCREEN_USB_ETURBO=y -CONFIG_TOUCHSCREEN_USB_GUNZE=y -CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y -CONFIG_TOUCHSCREEN_USB_IRTOUCH=y -CONFIG_TOUCHSCREEN_USB_IDEALTEK=y -CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y -CONFIG_TOUCHSCREEN_USB_GOTOP=y -CONFIG_TOUCHSCREEN_USB_JASTEC=y -CONFIG_TOUCHSCREEN_USB_ELO=y -CONFIG_TOUCHSCREEN_USB_E2I=y -CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y -CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y -CONFIG_TOUCHSCREEN_USB_NEXIO=y -CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y -CONFIG_TOUCHSCREEN_TOUCHIT213=m -CONFIG_TOUCHSCREEN_TSC_SERIO=m -CONFIG_TOUCHSCREEN_TSC200X_CORE=m -CONFIG_TOUCHSCREEN_TSC2004=m -CONFIG_TOUCHSCREEN_TSC2005=m -CONFIG_TOUCHSCREEN_TSC2007=m -CONFIG_TOUCHSCREEN_ST1232=m -CONFIG_TOUCHSCREEN_SUR40=m -CONFIG_TOUCHSCREEN_SX8654=m -CONFIG_TOUCHSCREEN_TPS6507X=m -CONFIG_TOUCHSCREEN_ZFORCE=m -CONFIG_TOUCHSCREEN_ROHM_BU21023=m -CONFIG_INPUT_MISC=y -CONFIG_INPUT_88PM860X_ONKEY=m -CONFIG_INPUT_88PM80X_ONKEY=m -CONFIG_INPUT_AD714X=m -CONFIG_INPUT_AD714X_I2C=m -CONFIG_INPUT_AD714X_SPI=m -CONFIG_INPUT_BMA150=m -CONFIG_INPUT_E3X0_BUTTON=m -CONFIG_INPUT_MC13783_PWRBUTTON=m -CONFIG_INPUT_MMA8450=y -CONFIG_INPUT_MPU3050=m -CONFIG_INPUT_GP2A=m -CONFIG_INPUT_GPIO_BEEPER=m -CONFIG_INPUT_GPIO_TILT_POLLED=m -CONFIG_INPUT_ATI_REMOTE2=m -CONFIG_INPUT_KEYSPAN_REMOTE=m -CONFIG_INPUT_KXTJ9=m -CONFIG_INPUT_KXTJ9_POLLED_MODE=y -CONFIG_INPUT_POWERMATE=m -CONFIG_INPUT_YEALINK=m -CONFIG_INPUT_CM109=m -CONFIG_INPUT_REGULATOR_HAPTIC=m -CONFIG_INPUT_UINPUT=m -CONFIG_INPUT_PCF8574=m -CONFIG_INPUT_PWM_BEEPER=m -CONFIG_INPUT_GPIO_ROTARY_ENCODER=m -CONFIG_INPUT_DA9052_ONKEY=m -CONFIG_INPUT_ADXL34X=m -CONFIG_INPUT_ADXL34X_I2C=m -CONFIG_INPUT_ADXL34X_SPI=m -CONFIG_INPUT_IMS_PCU=m -CONFIG_INPUT_CMA3000=m -CONFIG_INPUT_CMA3000_I2C=m -CONFIG_INPUT_SOC_BUTTON_ARRAY=m -CONFIG_INPUT_DRV260X_HAPTICS=m -CONFIG_INPUT_DRV2665_HAPTICS=m -CONFIG_INPUT_DRV2667_HAPTICS=m - -# -# Hardware I/O ports -# -CONFIG_SERIO=m -CONFIG_SERIO_SERPORT=m -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=m -CONFIG_SERIO_RAW=m -CONFIG_SERIO_ALTERA_PS2=m -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_APBPS2 is not set -# CONFIG_USERIO is not set -CONFIG_GAMEPORT=m -# CONFIG_GAMEPORT_NS558 is not set -# CONFIG_GAMEPORT_L4 is not set -# CONFIG_GAMEPORT_EMU10K1 is not set -# CONFIG_GAMEPORT_FM801 is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_NOZOMI is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVMEM=y -CONFIG_DEVKMEM=y - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_DMA=y -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_DW=m -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_RT288X is not set -# CONFIG_SERIAL_8250_INGENIC is not set -# CONFIG_SERIAL_8250_MID is not set - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST=y -CONFIG_SERIAL_MAX3100=m -CONFIG_SERIAL_MAX310X=m -CONFIG_SERIAL_IMX=y -CONFIG_SERIAL_IMX_CONSOLE=y -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_OF_PLATFORM is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -CONFIG_SERIAL_BCM63XX=m -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -CONFIG_SERIAL_ARC=m -CONFIG_SERIAL_ARC_NR_PORTS=1 -# CONFIG_SERIAL_RP2 is not set -CONFIG_SERIAL_FSL_LPUART=y -CONFIG_SERIAL_FSL_LPUART_CONSOLE=y -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_STM32 is not set -CONFIG_TTY_PRINTK=m -CONFIG_HVC_DRIVER=y -CONFIG_HVC_DCC=y -# CONFIG_VIRTIO_CONSOLE is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_TIMERIOMEM=m -# CONFIG_HW_RANDOM_VIRTIO is not set -# CONFIG_NVRAM is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set -CONFIG_RAW_DRIVER=m -CONFIG_MAX_RAW_DEVS=256 -# CONFIG_TCG_TPM is not set -CONFIG_DEVPORT=y -# CONFIG_XILLYBUS is not set - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -CONFIG_I2C_ARB_GPIO_CHALLENGE=y -CONFIG_I2C_MUX_GPIO=y -CONFIG_I2C_MUX_PCA9541=y -# CONFIG_I2C_MUX_PCA954x is not set -CONFIG_I2C_MUX_PINCTRL=y -# CONFIG_I2C_MUX_REG is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -CONFIG_I2C_DESIGNWARE_CORE=m -CONFIG_I2C_DESIGNWARE_PLATFORM=m -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_EMEV2 is not set -CONFIG_I2C_GPIO=y -CONFIG_I2C_IMX=y -CONFIG_I2C_OCORES=y -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -CONFIG_I2C_SLAVE=y -CONFIG_I2C_SLAVE_EEPROM=m -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -CONFIG_SPI_BITBANG=y -# CONFIG_SPI_CADENCE is not set -CONFIG_SPI_GPIO=y -CONFIG_SPI_IMX=m -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set -# CONFIG_NTP_PPS is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -CONFIG_PPS_CLIENT_LDISC=m -CONFIG_PPS_CLIENT_GPIO=m - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y -CONFIG_PTP_1588_CLOCK_GIANFAR=m -# CONFIG_DP83640_PHY is not set -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -CONFIG_GENERIC_PINCONF=y -# CONFIG_PINCTRL_AMD is not set -CONFIG_PINCTRL_SINGLE=y -CONFIG_PINCTRL_IMX=y -CONFIG_PINCTRL_IMX6Q=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_OF_GPIO=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_GENERIC=y - -# -# Memory mapped GPIO drivers -# -CONFIG_GPIO_74XX_MMIO=y -# CONFIG_GPIO_ALTERA is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_EM is not set -CONFIG_GPIO_GENERIC_PLATFORM=y -# CONFIG_GPIO_GRGPIO is not set -CONFIG_GPIO_MXC=y -CONFIG_GPIO_SYSCON=y -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GPIO_ZX is not set - -# -# I2C GPIO expanders -# -CONFIG_GPIO_ADP5588=m -CONFIG_GPIO_ADNP=m -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -CONFIG_GPIO_PCA953X=m -CONFIG_GPIO_PCF857X=m -CONFIG_GPIO_SX150X=y - -# -# MFD GPIO expanders -# -# CONFIG_GPIO_DA9052 is not set - -# -# PCI GPIO expanders -# -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_RDC321X is not set - -# -# SPI GPIO expanders -# -CONFIG_GPIO_74X164=m -# CONFIG_GPIO_MAX7301 is not set -CONFIG_GPIO_MC33880=m - -# -# SPI or I2C GPIO expanders -# -CONFIG_GPIO_MCP23S08=m - -# -# USB GPIO expanders -# -CONFIG_W1=m -CONFIG_W1_CON=y - -# -# 1-wire Bus Masters -# -CONFIG_W1_MASTER_MATROX=m -CONFIG_W1_MASTER_DS2490=m -CONFIG_W1_MASTER_DS2482=m -CONFIG_W1_MASTER_MXC=m -CONFIG_W1_MASTER_DS1WM=m -CONFIG_W1_MASTER_GPIO=m - -# -# 1-wire Slaves -# -CONFIG_W1_SLAVE_THERM=m -CONFIG_W1_SLAVE_SMEM=m -CONFIG_W1_SLAVE_DS2408=m -CONFIG_W1_SLAVE_DS2408_READBACK=y -CONFIG_W1_SLAVE_DS2413=m -CONFIG_W1_SLAVE_DS2406=m -CONFIG_W1_SLAVE_DS2423=m -CONFIG_W1_SLAVE_DS2431=m -CONFIG_W1_SLAVE_DS2433=m -CONFIG_W1_SLAVE_DS2433_CRC=y -CONFIG_W1_SLAVE_DS2760=m -CONFIG_W1_SLAVE_DS2780=m -CONFIG_W1_SLAVE_DS2781=m -CONFIG_W1_SLAVE_DS28E04=m -CONFIG_W1_SLAVE_BQ27000=m -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_APM_POWER is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -CONFIG_TEST_POWER=m -# CONFIG_BATTERY_88PM860X is not set -# CONFIG_BATTERY_DS2760 is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_DA9052 is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -CONFIG_CHARGER_GPIO=m -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_CHARGER_RT9455 is not set -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_BRCMSTB is not set -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_RESET_GPIO_RESTART=y -CONFIG_POWER_RESET_IMX=y -CONFIG_POWER_RESET_LTC2952=y -# CONFIG_POWER_RESET_QNAP is not set -CONFIG_POWER_RESET_RESTART=y -CONFIG_POWER_RESET_VERSATILE=y -# CONFIG_POWER_RESET_SNVS is not set -CONFIG_POWER_RESET_SYSCON=y -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -CONFIG_POWER_AVS=y -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_DA9052_ADC is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -CONFIG_SENSORS_MC13783_ADC=y -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -CONFIG_SENSORS_MAX1111=m -CONFIG_SENSORS_MAX16065=m -CONFIG_SENSORS_MAX1619=m -CONFIG_SENSORS_MAX1668=m -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -CONFIG_SENSORS_PWM_FAN=y -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -# CONFIG_THERMAL_WRITABLE_TRIPS is not set -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -CONFIG_THERMAL_GOV_FAIR_SHARE=y -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -CONFIG_THERMAL_GOV_USER_SPACE=y -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -CONFIG_CPU_THERMAL=y -CONFIG_CLOCK_THERMAL=y -# CONFIG_DEVFREQ_THERMAL is not set -# CONFIG_THERMAL_EMULATION is not set -CONFIG_IMX_THERMAL=y -CONFIG_WATCHDOG=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WATCHDOG_NOWAYOUT is not set - -# -# Watchdog Device Drivers -# -CONFIG_SOFT_WATCHDOG=m -# CONFIG_DA9052_WATCHDOG is not set -CONFIG_GPIO_WATCHDOG=m -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_MAX63XX_WATCHDOG is not set -CONFIG_IMX2_WDT=y -# CONFIG_ALIM7101_WDT is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_BCM7038_WDT is not set -# CONFIG_MEN_A21_WDT is not set - -# -# PCI-based Watchdog Cards -# -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_WDTPCI is not set - -# -# USB-based Watchdog Cards -# -# CONFIG_USBPCWATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=y -CONFIG_SSB_SPROM=y -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -CONFIG_SSB_SDIOHOST=y -# CONFIG_SSB_HOST_SOC is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_DRIVER_PCICORE=y -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -CONFIG_BCMA=y -CONFIG_BCMA_BLOCKIO=y -CONFIG_BCMA_HOST_PCI_POSSIBLE=y -CONFIG_BCMA_HOST_PCI=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCMA_DRIVER_PCI=y -# CONFIG_BCMA_DRIVER_GMAC_CMN is not set -# CONFIG_BCMA_DRIVER_GPIO is not set -# CONFIG_BCMA_DEBUG is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_PMIC_DA903X is not set -CONFIG_PMIC_DA9052=y -CONFIG_MFD_DA9052_SPI=y -CONFIG_MFD_DA9052_I2C=y -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -CONFIG_MFD_MXC_HDMI=y -# CONFIG_MFD_DLN2 is not set -CONFIG_MFD_MC13XXX=y -CONFIG_MFD_MC13XXX_SPI=y -CONFIG_MFD_MC13XXX_I2C=y -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -CONFIG_MFD_88PM800=y -CONFIG_MFD_88PM805=y -CONFIG_MFD_88PM860X=y -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_SEC_CORE is not set -CONFIG_MFD_SI476X_CORE=m -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SYSCON=y -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS65218 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -CONFIG_MFD_WL1273_CORE=m -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MFD_TDA1997X is not set -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_REGULATOR_VIRTUAL_CONSUMER=y -CONFIG_REGULATOR_USERSPACE_CONSUMER=m -CONFIG_REGULATOR_88PM800=y -CONFIG_REGULATOR_88PM8607=y -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -CONFIG_REGULATOR_ANATOP=y -# CONFIG_REGULATOR_DA9052 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -# CONFIG_REGULATOR_FAN53555 is not set -CONFIG_REGULATOR_GPIO=y -# CONFIG_REGULATOR_ISL9305 is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_LTC3589 is not set -# CONFIG_REGULATOR_LTC3676 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -CONFIG_REGULATOR_MC13XXX_CORE=y -CONFIG_REGULATOR_MC13783=y -CONFIG_REGULATOR_MC13892=y -# CONFIG_REGULATOR_MT6311 is not set -CONFIG_REGULATOR_PFUZE100=y -CONFIG_REGULATOR_PWM=y -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -CONFIG_MEDIA_RADIO_SUPPORT=y -CONFIG_MEDIA_SDR_SUPPORT=y -CONFIG_MEDIA_RC_SUPPORT=y -CONFIG_MEDIA_CONTROLLER=y -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2_SUBDEV_API=y -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_V4L2_MEM2MEM_DEV=m -CONFIG_VIDEO_V4L2_INT_DEVICE=m -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_DMA_SG=m -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DMA_CONTIG=y -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=y -CONFIG_VIDEOBUF2_MEMOPS=m -CONFIG_VIDEOBUF2_DMA_CONTIG=m -CONFIG_VIDEOBUF2_VMALLOC=m -CONFIG_VIDEOBUF2_DMA_SG=m -CONFIG_VIDEOBUF2_DVB=m -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=y -CONFIG_RC_MAP=y -CONFIG_RC_DECODERS=y -CONFIG_LIRC=m -CONFIG_IR_LIRC_CODEC=m -CONFIG_IR_NEC_DECODER=m -CONFIG_IR_RC5_DECODER=m -CONFIG_IR_RC6_DECODER=m -CONFIG_IR_JVC_DECODER=m -CONFIG_IR_SONY_DECODER=m -CONFIG_IR_SANYO_DECODER=m -CONFIG_IR_SHARP_DECODER=m -CONFIG_IR_MCE_KBD_DECODER=m -CONFIG_IR_XMP_DECODER=m -CONFIG_RC_DEVICES=y -CONFIG_RC_ATI_REMOTE=m -CONFIG_IR_HIX5HD2=m -CONFIG_IR_IMON=m -CONFIG_IR_MCEUSB=m -CONFIG_IR_REDRAT3=m -CONFIG_IR_STREAMZAP=m -CONFIG_IR_IGORPLUGUSB=m -CONFIG_IR_IGUANA=m -CONFIG_IR_TTUSBIR=m -CONFIG_RC_LOOPBACK=m -CONFIG_IR_GPIO_CIR=m -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -CONFIG_USB_VIDEO_CLASS=m -CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y -CONFIG_USB_GSPCA=m -CONFIG_USB_M5602=m -CONFIG_USB_STV06XX=m -CONFIG_USB_GL860=m -CONFIG_USB_GSPCA_BENQ=m -CONFIG_USB_GSPCA_CONEX=m -CONFIG_USB_GSPCA_CPIA1=m -CONFIG_USB_GSPCA_DTCS033=m -CONFIG_USB_GSPCA_ETOMS=m -CONFIG_USB_GSPCA_FINEPIX=m -CONFIG_USB_GSPCA_JEILINJ=m -CONFIG_USB_GSPCA_JL2005BCD=m -CONFIG_USB_GSPCA_KINECT=m -CONFIG_USB_GSPCA_KONICA=m -CONFIG_USB_GSPCA_MARS=m -CONFIG_USB_GSPCA_MR97310A=m -CONFIG_USB_GSPCA_NW80X=m -CONFIG_USB_GSPCA_OV519=m -CONFIG_USB_GSPCA_OV534=m -CONFIG_USB_GSPCA_OV534_9=m -CONFIG_USB_GSPCA_PAC207=m -CONFIG_USB_GSPCA_PAC7302=m -CONFIG_USB_GSPCA_PAC7311=m -CONFIG_USB_GSPCA_SE401=m -CONFIG_USB_GSPCA_SN9C2028=m -CONFIG_USB_GSPCA_SN9C20X=m -CONFIG_USB_GSPCA_SONIXB=m -CONFIG_USB_GSPCA_SONIXJ=m -CONFIG_USB_GSPCA_SPCA500=m -CONFIG_USB_GSPCA_SPCA501=m -CONFIG_USB_GSPCA_SPCA505=m -CONFIG_USB_GSPCA_SPCA506=m -CONFIG_USB_GSPCA_SPCA508=m -CONFIG_USB_GSPCA_SPCA561=m -CONFIG_USB_GSPCA_SPCA1528=m -CONFIG_USB_GSPCA_SQ905=m -CONFIG_USB_GSPCA_SQ905C=m -CONFIG_USB_GSPCA_SQ930X=m -CONFIG_USB_GSPCA_STK014=m -CONFIG_USB_GSPCA_STK1135=m -CONFIG_USB_GSPCA_STV0680=m -CONFIG_USB_GSPCA_SUNPLUS=m -CONFIG_USB_GSPCA_T613=m -CONFIG_USB_GSPCA_TOPRO=m -# CONFIG_USB_GSPCA_TOUPTEK is not set -CONFIG_USB_GSPCA_TV8532=m -CONFIG_USB_GSPCA_VC032X=m -CONFIG_USB_GSPCA_VICAM=m -CONFIG_USB_GSPCA_XIRLINK_CIT=m -CONFIG_USB_GSPCA_ZC3XX=m -CONFIG_USB_PWC=m -# CONFIG_USB_PWC_DEBUG is not set -CONFIG_USB_PWC_INPUT_EVDEV=y -CONFIG_VIDEO_CPIA2=m -CONFIG_USB_ZR364XX=m -CONFIG_USB_STKWEBCAM=m -CONFIG_USB_S2255=m -CONFIG_VIDEO_USBTV=m - -# -# Analog TV USB devices -# -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -CONFIG_VIDEO_PVRUSB2_DVB=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set -CONFIG_VIDEO_HDPVR=m -CONFIG_VIDEO_USBVISION=m -CONFIG_VIDEO_STK1160_COMMON=m -CONFIG_VIDEO_STK1160_AC97=y -CONFIG_VIDEO_STK1160=m -CONFIG_VIDEO_GO7007=m -CONFIG_VIDEO_GO7007_USB=m -CONFIG_VIDEO_GO7007_LOADER=m -CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -CONFIG_VIDEO_AU0828_RC=y -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -CONFIG_VIDEO_CX231XX_ALSA=m -CONFIG_VIDEO_CX231XX_DVB=m -CONFIG_VIDEO_TM6000=m -CONFIG_VIDEO_TM6000_ALSA=m -CONFIG_VIDEO_TM6000_DVB=m - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -CONFIG_DVB_USB_A800=m -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -CONFIG_DVB_USB_UMT_010=m -CONFIG_DVB_USB_CXUSB=m -CONFIG_DVB_USB_M920X=m -CONFIG_DVB_USB_DIGITV=m -CONFIG_DVB_USB_VP7045=m -CONFIG_DVB_USB_VP702X=m -CONFIG_DVB_USB_GP8PSK=m -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -CONFIG_DVB_USB_FRIIO=m -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -CONFIG_DVB_USB_AU6610=m -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -CONFIG_DVB_USB_GL861=m -CONFIG_DVB_USB_LME2510=m -CONFIG_DVB_USB_MXL111SF=m -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_DVB_USB_DVBSKY=m -CONFIG_DVB_TTUSB_BUDGET=m -CONFIG_DVB_TTUSB_DEC=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set -CONFIG_DVB_AS102=m - -# -# Webcam, TV (analog/digital) USB devices -# -CONFIG_VIDEO_EM28XX=m -CONFIG_VIDEO_EM28XX_V4L2=m -CONFIG_VIDEO_EM28XX_ALSA=m -CONFIG_VIDEO_EM28XX_DVB=m -CONFIG_VIDEO_EM28XX_RC=m - -# -# Software defined radio USB devices -# -CONFIG_USB_AIRSPY=m -CONFIG_USB_HACKRF=m -CONFIG_USB_MSI2500=m -CONFIG_MEDIA_PCI_SUPPORT=y - -# -# Media capture support -# -CONFIG_VIDEO_SOLO6X10=m -CONFIG_VIDEO_TW68=m - -# -# Media capture/analog TV support -# -CONFIG_VIDEO_IVTV=m -CONFIG_VIDEO_IVTV_ALSA=m -CONFIG_VIDEO_FB_IVTV=m -CONFIG_VIDEO_HEXIUM_GEMINI=m -CONFIG_VIDEO_HEXIUM_ORION=m -CONFIG_VIDEO_MXB=m -CONFIG_VIDEO_DT3155=m - -# -# Media capture/analog/hybrid TV support -# -CONFIG_VIDEO_CX18=m -CONFIG_VIDEO_CX18_ALSA=m -CONFIG_VIDEO_CX23885=m -CONFIG_MEDIA_ALTERA_CI=m -CONFIG_VIDEO_CX25821=m -CONFIG_VIDEO_CX25821_ALSA=m -CONFIG_VIDEO_CX88=m -CONFIG_VIDEO_CX88_ALSA=m -CONFIG_VIDEO_CX88_BLACKBIRD=m -CONFIG_VIDEO_CX88_DVB=m -CONFIG_VIDEO_CX88_ENABLE_VP3054=y -CONFIG_VIDEO_CX88_VP3054=m -CONFIG_VIDEO_CX88_MPEG=m -CONFIG_VIDEO_BT848=m -CONFIG_DVB_BT8XX=m -CONFIG_VIDEO_SAA7134=m -CONFIG_VIDEO_SAA7134_ALSA=m -CONFIG_VIDEO_SAA7134_RC=y -CONFIG_VIDEO_SAA7134_DVB=m -CONFIG_VIDEO_SAA7134_GO7007=m -CONFIG_VIDEO_SAA7164=m - -# -# Media digital TV PCI Adapters -# -CONFIG_DVB_AV7110_IR=y -CONFIG_DVB_AV7110=m -CONFIG_DVB_AV7110_OSD=y -CONFIG_DVB_BUDGET_CORE=m -CONFIG_DVB_BUDGET=m -CONFIG_DVB_BUDGET_CI=m -CONFIG_DVB_BUDGET_AV=m -CONFIG_DVB_BUDGET_PATCH=m -CONFIG_DVB_B2C2_FLEXCOP_PCI=m -# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set -CONFIG_DVB_PLUTO2=m -CONFIG_DVB_DM1105=m -CONFIG_DVB_PT1=m -CONFIG_DVB_PT3=m -CONFIG_MANTIS_CORE=m -CONFIG_DVB_MANTIS=m -CONFIG_DVB_HOPPER=m -CONFIG_DVB_NGENE=m -CONFIG_DVB_DDBRIDGE=m -CONFIG_DVB_SMIPCIE=m -# CONFIG_DVB_NETUP_UNIDVB is not set -CONFIG_V4L_PLATFORM_DRIVERS=y -# CONFIG_VIDEO_CAFE_CCIC is not set -CONFIG_VIDEO_MXC_OUTPUT=y -CONFIG_VIDEO_MXC_CAPTURE=m - -# -# MXC Camera/V4L2 PRP Features support -# -CONFIG_VIDEO_MXC_IPU_CAMERA=y -# CONFIG_VIDEO_MXC_CSI_CAMERA is not set -# CONFIG_MXC_TVIN_TDA1997X is not set -CONFIG_MXC_CAMERA_OV5640=m -CONFIG_MXC_CAMERA_OV5642=m -CONFIG_MXC_CAMERA_OV5640_MIPI=m -CONFIG_MXC_CAMERA_OV5647_MIPI=m -# CONFIG_MXC_HDMI_CSI2_TC358743 is not set -# CONFIG_MXC_TVIN_ADV7180 is not set -CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m -CONFIG_MXC_IPU_PRP_ENC=m -CONFIG_MXC_IPU_CSI_ENC=m -CONFIG_VIDEO_MXC_IPU_OUTPUT=y -CONFIG_VIDEO_MXC_PXP_V4L2=y -CONFIG_SOC_CAMERA=y -CONFIG_SOC_CAMERA_PLATFORM=y -# CONFIG_VIDEO_XILINX is not set -CONFIG_V4L_MEM2MEM_DRIVERS=y -# CONFIG_VIDEO_CODA is not set -CONFIG_VIDEO_MEM2MEM_DEINTERLACE=m -CONFIG_VIDEO_SH_VEU=m -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set - -# -# Supported MMC/SDIO adapters -# -CONFIG_SMS_SDIO_DRV=m -CONFIG_RADIO_ADAPTERS=y -CONFIG_RADIO_TEA575X=m -CONFIG_RADIO_SI470X=y -CONFIG_USB_SI470X=m -CONFIG_I2C_SI470X=m -CONFIG_RADIO_SI4713=m -CONFIG_USB_SI4713=m -CONFIG_PLATFORM_SI4713=m -CONFIG_I2C_SI4713=m -CONFIG_RADIO_SI476X=m -CONFIG_USB_MR800=m -CONFIG_USB_DSBR=m -CONFIG_RADIO_MAXIRADIO=m -CONFIG_RADIO_SHARK=m -CONFIG_RADIO_SHARK2=m -CONFIG_USB_KEENE=m -CONFIG_USB_RAREMONO=m -CONFIG_USB_MA901=m -CONFIG_RADIO_TEA5764=m -CONFIG_RADIO_SAA7706H=m -CONFIG_RADIO_TEF6862=m -CONFIG_RADIO_WL1273=m - -# -# Texas Instruments WL128x FM driver (ST based) -# -CONFIG_RADIO_WL128X=m -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_VIDEO_SAA7146=m -CONFIG_VIDEO_SAA7146_VV=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y -# CONFIG_SMS_SIANO_DEBUGFS is not set - -# -# Media ancillary drivers (tuners, sensors, i2c, frontends) -# -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -CONFIG_MEDIA_ATTACH=y -CONFIG_VIDEO_IR_I2C=m - -# -# Encoders, decoders, sensors and other helper chips -# - -# -# Audio decoders, processors and mixers -# -CONFIG_VIDEO_TVAUDIO=m -CONFIG_VIDEO_TDA7432=m -CONFIG_VIDEO_TDA9840=m -CONFIG_VIDEO_TEA6415C=m -CONFIG_VIDEO_TEA6420=m -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS5345=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_TLV320AIC23B=m -CONFIG_VIDEO_UDA1342=m -CONFIG_VIDEO_WM8775=m -CONFIG_VIDEO_WM8739=m -CONFIG_VIDEO_VP27SMPX=m -CONFIG_VIDEO_SONY_BTF_MPX=m - -# -# RDS decoders -# -CONFIG_VIDEO_SAA6588=m - -# -# Video decoders -# -CONFIG_VIDEO_ADV7180=m -CONFIG_VIDEO_ADV7183=m -CONFIG_VIDEO_ADV7604=m -CONFIG_VIDEO_ADV7842=m -CONFIG_VIDEO_BT819=m -CONFIG_VIDEO_BT856=m -CONFIG_VIDEO_BT866=m -CONFIG_VIDEO_KS0127=m -CONFIG_VIDEO_ML86V7667=m -CONFIG_VIDEO_SAA7110=m -CONFIG_VIDEO_SAA711X=m -CONFIG_VIDEO_TC358743=m -CONFIG_VIDEO_TVP514X=m -CONFIG_VIDEO_TVP5150=m -CONFIG_VIDEO_TVP7002=m -CONFIG_VIDEO_TW2804=m -CONFIG_VIDEO_TW9903=m -CONFIG_VIDEO_TW9906=m -CONFIG_VIDEO_VPX3220=m - -# -# Video and audio decoders -# -CONFIG_VIDEO_SAA717X=m -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# -CONFIG_VIDEO_SAA7127=m -CONFIG_VIDEO_SAA7185=m -CONFIG_VIDEO_ADV7170=m -CONFIG_VIDEO_ADV7175=m -CONFIG_VIDEO_ADV7343=m -CONFIG_VIDEO_ADV7393=m -CONFIG_VIDEO_ADV7511=m -CONFIG_VIDEO_AD9389B=m -CONFIG_VIDEO_AK881X=m -CONFIG_VIDEO_THS8200=m - -# -# Camera sensor devices -# -CONFIG_VIDEO_APTINA_PLL=m -CONFIG_VIDEO_SMIAPP_PLL=m -CONFIG_VIDEO_OV2659=m -CONFIG_VIDEO_OV7640=m -CONFIG_VIDEO_OV7670=m -CONFIG_VIDEO_OV9650=m -CONFIG_VIDEO_VS6624=m -CONFIG_VIDEO_MT9M032=m -CONFIG_VIDEO_MT9P031=m -CONFIG_VIDEO_MT9T001=m -CONFIG_VIDEO_MT9V011=m -CONFIG_VIDEO_MT9V032=m -CONFIG_VIDEO_SR030PC30=m -CONFIG_VIDEO_NOON010PC30=m -CONFIG_VIDEO_M5MOLS=m -CONFIG_VIDEO_S5K6AA=m -CONFIG_VIDEO_S5K6A3=m -CONFIG_VIDEO_S5K4ECGX=m -CONFIG_VIDEO_S5K5BAF=m -CONFIG_VIDEO_SMIAPP=m -CONFIG_VIDEO_S5C73M3=m - -# -# Flash devices -# -CONFIG_VIDEO_ADP1653=m -CONFIG_VIDEO_AS3645A=m -CONFIG_VIDEO_LM3560=m -CONFIG_VIDEO_LM3646=m - -# -# Video improvement chips -# -CONFIG_VIDEO_UPD64031A=m -CONFIG_VIDEO_UPD64083=m - -# -# Audio/Video compression chips -# -CONFIG_VIDEO_SAA6752HS=m - -# -# Miscellaneous helper chips -# -CONFIG_VIDEO_THS7303=m -CONFIG_VIDEO_M52790=m - -# -# Sensors used on soc_camera driver -# - -# -# soc_camera sensor drivers -# -CONFIG_SOC_CAMERA_IMX074=m -CONFIG_SOC_CAMERA_MT9M001=m -CONFIG_SOC_CAMERA_MT9M111=m -CONFIG_SOC_CAMERA_MT9T031=m -CONFIG_SOC_CAMERA_MT9T112=m -CONFIG_SOC_CAMERA_MT9V022=m -CONFIG_SOC_CAMERA_OV2640=m -CONFIG_SOC_CAMERA_OV5642=m -CONFIG_SOC_CAMERA_OV6650=m -CONFIG_SOC_CAMERA_OV772X=m -CONFIG_SOC_CAMERA_OV9640=m -CONFIG_SOC_CAMERA_OV9740=m -CONFIG_SOC_CAMERA_RJ54N1=m -CONFIG_SOC_CAMERA_TW9910=m -CONFIG_MEDIA_TUNER=y - -# -# Customize TV tuners -# -CONFIG_MEDIA_TUNER_SIMPLE=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_TEA5761=m -CONFIG_MEDIA_TUNER_TEA5767=m -CONFIG_MEDIA_TUNER_MSI001=m -CONFIG_MEDIA_TUNER_MT20XX=m -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_MT2131=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88RS6000T=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_SI2157=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_MXL301RF=m -CONFIG_MEDIA_TUNER_QM1D1C0042=m - -# -# Customise DVB Frontends -# - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m -CONFIG_DVB_SI2165=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24110=m -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10036=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA8083=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TDA8261=m -CONFIG_DVB_VES1X93=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_TUA6100=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_CX24117=m -CONFIG_DVB_CX24120=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_MB86A16=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_SP8870=m -CONFIG_DVB_SP887X=m -CONFIG_DVB_CX22700=m -CONFIG_DVB_CX22702=m -CONFIG_DVB_S5H1432=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_L64781=m -CONFIG_DVB_TDA1004X=m -CONFIG_DVB_NXT6000=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_DIB9000=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_HD29L2=m -CONFIG_DVB_STV0367=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_CXD2841ER=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m -CONFIG_DVB_RTL2832_SDR=m -CONFIG_DVB_SI2168=m -CONFIG_DVB_AS102_FE=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_VES1820=m -CONFIG_DVB_TDA10021=m -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_OR51211=m -CONFIG_DVB_OR51132=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LGDT3306A=m -CONFIG_DVB_LG2160=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -CONFIG_DVB_AU8522_V4L=m -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# -CONFIG_DVB_TC90522=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_DRX39XYJ=m -CONFIG_DVB_LNBH25=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6405=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_SP2=m -CONFIG_DVB_LGS8GL5=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_TDA665x=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m -CONFIG_DVB_HORUS3A=m -CONFIG_DVB_ASCOT2E=m - -# -# Tools to develop new frontends -# -CONFIG_DVB_DUMMY_FE=m - -# -# Graphics support -# -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 -# CONFIG_IMX_IPUV3_CORE is not set -CONFIG_DRM=y -# CONFIG_DRM_FBDEV_EMULATION is not set -# CONFIG_DRM_TDFX is not set -# CONFIG_DRM_R128 is not set -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_MGA is not set -# CONFIG_DRM_VIA is not set -# CONFIG_DRM_SAVAGE is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DRM_EXYNOS is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_ARMADA is not set -# CONFIG_DRM_TILCDC is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_BOCHS is not set -# CONFIG_DRM_VIRTIO_GPU is not set -# CONFIG_DRM_FSL_DCU is not set -CONFIG_DRM_BRIDGE=y - -# -# Display Interface Bridges -# -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_STI is not set -CONFIG_DRM_VIVANTE=m - -# -# Frame buffer Devices -# -CONFIG_FB=y -CONFIG_FIRMWARE_EDID=y -CONFIG_FB_CMDLINE=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -CONFIG_FB_BACKLIGHT=y -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_IMX is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -CONFIG_FB_UDL=m -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_MXS is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SM712 is not set -CONFIG_FB_MXC=y -CONFIG_FB_MXC_SYNC_PANEL=y -# CONFIG_FB_MXC_TVOUT_ADV739X is not set -CONFIG_FB_MXC_LDB=y -# CONFIG_FB_MXC_MIPI_DSI is not set -CONFIG_FB_MXC_HDMI=y -CONFIG_FB_MXC_DCIC=y -CONFIG_FB_MXC_EDID=y -# CONFIG_FB_MXC_EINK_PANEL is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -CONFIG_LCD_PLATFORM=m -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -CONFIG_BACKLIGHT_PWM=m -# CONFIG_BACKLIGHT_DA9052 is not set -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_88PM860X is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_VGASTATE is not set -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_HDMI=y - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_DMAENGINE_PCM=y -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_JACK=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_TIMER=y -CONFIG_SND_HRTIMER=y -# CONFIG_SND_DYNAMIC_MINORS is not set -# CONFIG_SND_SUPPORT_OLD_API is not set -CONFIG_SND_PROC_FS=y -# CONFIG_SND_VERBOSE_PROCFS is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_VMASTER=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_MPU401_UART=m -CONFIG_SND_AC97_CODEC=m -CONFIG_SND_DRIVERS=y -CONFIG_SND_DUMMY=m -CONFIG_SND_ALOOP=m -CONFIG_SND_MTPAV=m -CONFIG_SND_SERIAL_U16550=m -CONFIG_SND_MPU401=m -CONFIG_SND_AC97_POWER_SAVE=y -CONFIG_SND_AC97_POWER_SAVE_DEFAULT=1 -CONFIG_SND_PCI=y -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_OXYGEN is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_SE6X is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_YMFPCI is not set - -# -# HD-Audio -# -# CONFIG_SND_HDA_INTEL is not set -CONFIG_SND_HDA_PREALLOC_SIZE=1024 -CONFIG_SND_ARM=y -CONFIG_SND_SPI=y -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=m -CONFIG_SND_USB_UA101=m -CONFIG_SND_USB_CAIAQ=m -CONFIG_SND_USB_CAIAQ_INPUT=y -CONFIG_SND_USB_6FIRE=m -CONFIG_SND_USB_HIFACE=m -CONFIG_SND_BCD2000=m -CONFIG_SND_USB_LINE6=m -CONFIG_SND_USB_POD=m -CONFIG_SND_USB_PODHD=m -CONFIG_SND_USB_TONEPORT=m -CONFIG_SND_USB_VARIAX=m -CONFIG_SND_SOC=y -CONFIG_SND_SOC_AC97_BUS=y -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -# CONFIG_SND_SOC_FSL_ASRC is not set -CONFIG_SND_SOC_FSL_SAI=y -CONFIG_SND_SOC_FSL_SSI=y -CONFIG_SND_SOC_FSL_SPDIF=y -CONFIG_SND_SOC_FSL_ESAI=y -CONFIG_SND_SOC_FSL_HDMI=y -CONFIG_SND_SOC_FSL_UTILS=y -CONFIG_SND_SOC_IMX_PCM_DMA=y -CONFIG_SND_SOC_IMX_HDMI_DMA=y -CONFIG_SND_SOC_IMX_AUDMUX=y -CONFIG_SND_IMX_SOC=y - -# -# SoC Audio support for Freescale i.MX boards: -# -# CONFIG_SND_SOC_EUKREA_TLV320 is not set -# CONFIG_SND_SOC_IMX_WM8731 is not set -# CONFIG_SND_SOC_IMX_WM8962 is not set -# CONFIG_SND_SOC_IMX_ES8328 is not set -CONFIG_SND_SOC_IMX_SGTL5000=y -CONFIG_SND_SOC_IMX_AC97_VT1613=y -CONFIG_SND_SOC_IMX_SPDIF=y -# CONFIG_SND_SOC_IMX_MC13783 is not set -CONFIG_SND_SOC_IMX_HDMI=y -CONFIG_SND_SOC_FSL_ASOC_CARD=m -# CONFIG_SND_SOC_IMX_TDA1997X is not set - -# -# Allwinner SoC Audio support -# -# CONFIG_SND_SUN4I_CODEC is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -CONFIG_SND_SOC_I2C_AND_SPI=y - -# -# CODEC drivers -# -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -CONFIG_SND_SOC_HDMI_CODEC=y -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1792A is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_RT5631 is not set -# CONFIG_SND_SOC_RT5677_SPI is not set -CONFIG_SND_SOC_SGTL5000=y -CONFIG_SND_SOC_VT1613=y -CONFIG_SND_SOC_SI476X=m -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -CONFIG_SND_SOC_SPDIF=y -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA32X is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TFA9879 is not set -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TS3A227E is not set -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -# CONFIG_SND_SOC_WM8731 is not set -# CONFIG_SND_SOC_WM8737 is not set -# CONFIG_SND_SOC_WM8741 is not set -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -# CONFIG_SND_SOC_WM8804_I2C is not set -# CONFIG_SND_SOC_WM8804_SPI is not set -# CONFIG_SND_SOC_WM8903 is not set -CONFIG_SND_SOC_WM8962=m -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_TPA6130A2 is not set -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SOUND_PRIME is not set -CONFIG_AC97_BUS=y - -# -# HID support -# -CONFIG_HID=y -CONFIG_HID_BATTERY_STRENGTH=y -CONFIG_HIDRAW=y -CONFIG_UHID=m -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=m -CONFIG_HID_ACRUX=m -CONFIG_HID_ACRUX_FF=y -CONFIG_HID_APPLE=m -CONFIG_HID_APPLEIR=m -CONFIG_HID_AUREAL=m -CONFIG_HID_BELKIN=m -CONFIG_HID_BETOP_FF=m -CONFIG_HID_CHERRY=m -CONFIG_HID_CHICONY=m -# CONFIG_HID_CORSAIR is not set -CONFIG_HID_PRODIKEYS=m -CONFIG_HID_CP2112=m -CONFIG_HID_CYPRESS=m -CONFIG_HID_DRAGONRISE=m -CONFIG_DRAGONRISE_FF=y -CONFIG_HID_EMS_FF=m -CONFIG_HID_ELECOM=m -CONFIG_HID_ELO=m -CONFIG_HID_EZKEY=m -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -CONFIG_HID_HOLTEK=m -CONFIG_HOLTEK_FF=y -CONFIG_HID_GT683R=m -CONFIG_HID_KEYTOUCH=m -CONFIG_HID_KYE=m -CONFIG_HID_UCLOGIC=m -CONFIG_HID_WALTOP=m -CONFIG_HID_GYRATION=m -CONFIG_HID_ICADE=m -CONFIG_HID_TWINHAN=m -CONFIG_HID_KENSINGTON=m -CONFIG_HID_LCPOWER=m -CONFIG_HID_LENOVO=m -CONFIG_HID_LOGITECH=m -CONFIG_HID_LOGITECH_DJ=m -CONFIG_HID_LOGITECH_HIDPP=m -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -CONFIG_HID_MAGICMOUSE=m -CONFIG_HID_MICROSOFT=m -CONFIG_HID_MONTEREY=m -CONFIG_HID_MULTITOUCH=m -CONFIG_HID_NTRIG=m -CONFIG_HID_ORTEK=m -CONFIG_HID_OUYA=m -CONFIG_HID_PANTHERLORD=m -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PENMOUNT=m -CONFIG_HID_PETALYNX=m -CONFIG_HID_PICOLCD=m -CONFIG_HID_PICOLCD_FB=y -CONFIG_HID_PICOLCD_BACKLIGHT=y -CONFIG_HID_PICOLCD_LCD=y -CONFIG_HID_PICOLCD_LEDS=y -CONFIG_HID_PICOLCD_CIR=y -CONFIG_HID_PLANTRONICS=m -CONFIG_HID_PRIMAX=m -CONFIG_HID_ROCCAT=m -CONFIG_HID_SAITEK=m -CONFIG_HID_SAMSUNG=m -CONFIG_HID_SONY=m -CONFIG_SONY_FF=y -CONFIG_HID_SPEEDLINK=m -CONFIG_HID_STEELSERIES=m -CONFIG_HID_SPINELPLUS=m -CONFIG_HID_SUNPLUS=m -CONFIG_HID_RMI=m -CONFIG_HID_GREENASIA=m -CONFIG_GREENASIA_FF=y -CONFIG_HID_SMARTJOYPLUS=m -CONFIG_SMARTJOYPLUS_FF=y -CONFIG_HID_TIVO=m -CONFIG_HID_TOPSEED=m -CONFIG_HID_THINGM=m -CONFIG_HID_THRUSTMASTER=m -CONFIG_THRUSTMASTER_FF=y -CONFIG_HID_WACOM=m -CONFIG_HID_WIIMOTE=m -CONFIG_HID_XINMO=m -CONFIG_HID_ZEROPLUS=m -CONFIG_ZEROPLUS_FF=y -CONFIG_HID_ZYDACRON=m -CONFIG_HID_SENSOR_HUB=m -CONFIG_HID_SENSOR_CUSTOM_SENSOR=m - -# -# USB HID support -# -CONFIG_USB_HID=y -CONFIG_HID_PID=y -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -CONFIG_I2C_HID=m -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -CONFIG_USB_OTG=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -CONFIG_USB_OTG_FSM=y -# CONFIG_USB_ULPI_BUS is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_FSL_MPH_DR_OF=m -CONFIG_USB_EHCI_PCI=y -CONFIG_USB_EHCI_MXC=y -CONFIG_USB_EHCI_HCD_PLATFORM=y -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_IMX21_HCD is not set -# CONFIG_USB_HCD_BCMA is not set -# CONFIG_USB_HCD_SSB is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -CONFIG_USB_PRINTER=m -CONFIG_USB_WDM=m -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -CONFIG_USB_STORAGE_REALTEK=y -# CONFIG_REALTEK_AUTOPM is not set -CONFIG_USB_STORAGE_DATAFAB=y -CONFIG_USB_STORAGE_FREECOM=y -CONFIG_USB_STORAGE_ISD200=y -CONFIG_USB_STORAGE_USBAT=y -CONFIG_USB_STORAGE_SDDR09=y -CONFIG_USB_STORAGE_SDDR55=y -CONFIG_USB_STORAGE_JUMPSHOT=y -CONFIG_USB_STORAGE_ALAUDA=y -CONFIG_USB_STORAGE_ONETOUCH=y -CONFIG_USB_STORAGE_KARMA=m -CONFIG_USB_STORAGE_CYPRESS_ATACB=y -CONFIG_USB_STORAGE_ENE_UB6250=y -CONFIG_USB_UAS=y - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -CONFIG_USBIP_CORE=m -CONFIG_USBIP_VHCI_HCD=m -CONFIG_USBIP_HOST=m -# CONFIG_USBIP_DEBUG is not set -CONFIG_USB_MUSB_HDRC=m -CONFIG_USB_MUSB_HOST=y -# CONFIG_USB_MUSB_GADGET is not set -# CONFIG_USB_MUSB_DUAL_ROLE is not set - -# -# Platform Glue Layer -# - -# -# MUSB DMA mode -# -CONFIG_MUSB_PIO_ONLY=y -CONFIG_USB_DWC3=m -# CONFIG_USB_DWC3_HOST is not set -# CONFIG_USB_DWC3_GADGET is not set -CONFIG_USB_DWC3_DUAL_ROLE=y - -# -# Platform Glue Driver Support -# -CONFIG_USB_DWC3_PCI=m -CONFIG_USB_DWC2=m -# CONFIG_USB_DWC2_HOST is not set - -# -# Gadget/Dual-role mode requires USB Gadget support to be enabled -# -# CONFIG_USB_DWC2_PERIPHERAL is not set -CONFIG_USB_DWC2_DUAL_ROLE=y -CONFIG_USB_DWC2_PCI=m -# CONFIG_USB_DWC2_DEBUG is not set -# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set -CONFIG_USB_CHIPIDEA=y -CONFIG_USB_CHIPIDEA_OF=y -CONFIG_USB_CHIPIDEA_PCI=y -# CONFIG_USB_CHIPIDEA_UDC is not set -CONFIG_USB_CHIPIDEA_HOST=y -# CONFIG_USB_CHIPIDEA_DEBUG is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=y -CONFIG_USB_SERIAL_CONSOLE=y -CONFIG_USB_SERIAL_GENERIC=y -CONFIG_USB_SERIAL_SIMPLE=m -CONFIG_USB_SERIAL_AIRCABLE=m -CONFIG_USB_SERIAL_ARK3116=m -CONFIG_USB_SERIAL_BELKIN=m -CONFIG_USB_SERIAL_CH341=m -CONFIG_USB_SERIAL_WHITEHEAT=m -CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -CONFIG_USB_SERIAL_CP210X=m -CONFIG_USB_SERIAL_CYPRESS_M8=m -CONFIG_USB_SERIAL_EMPEG=m -CONFIG_USB_SERIAL_FTDI_SIO=m -CONFIG_USB_SERIAL_VISOR=m -CONFIG_USB_SERIAL_IPAQ=m -CONFIG_USB_SERIAL_IR=m -CONFIG_USB_SERIAL_EDGEPORT=m -CONFIG_USB_SERIAL_EDGEPORT_TI=m -CONFIG_USB_SERIAL_F81232=m -CONFIG_USB_SERIAL_GARMIN=m -CONFIG_USB_SERIAL_IPW=m -CONFIG_USB_SERIAL_IUU=m -CONFIG_USB_SERIAL_KEYSPAN_PDA=m -CONFIG_USB_SERIAL_KEYSPAN=m -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -CONFIG_USB_SERIAL_KEYSPAN_USA28=y -CONFIG_USB_SERIAL_KEYSPAN_USA28X=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -CONFIG_USB_SERIAL_KLSI=m -CONFIG_USB_SERIAL_KOBIL_SCT=m -CONFIG_USB_SERIAL_MCT_U232=m -CONFIG_USB_SERIAL_METRO=m -CONFIG_USB_SERIAL_MOS7720=m -CONFIG_USB_SERIAL_MOS7840=m -CONFIG_USB_SERIAL_MXUPORT=m -CONFIG_USB_SERIAL_NAVMAN=m -CONFIG_USB_SERIAL_PL2303=m -CONFIG_USB_SERIAL_OTI6858=m -CONFIG_USB_SERIAL_QCAUX=m -CONFIG_USB_SERIAL_QUALCOMM=m -CONFIG_USB_SERIAL_SPCP8X5=m -CONFIG_USB_SERIAL_SAFE=m -CONFIG_USB_SERIAL_SAFE_PADDED=y -CONFIG_USB_SERIAL_SIERRAWIRELESS=m -CONFIG_USB_SERIAL_SYMBOL=m -CONFIG_USB_SERIAL_TI=m -CONFIG_USB_SERIAL_CYBERJACK=m -CONFIG_USB_SERIAL_XIRCOM=m -CONFIG_USB_SERIAL_WWAN=m -CONFIG_USB_SERIAL_OPTION=m -CONFIG_USB_SERIAL_OMNINET=m -CONFIG_USB_SERIAL_OPTICON=m -CONFIG_USB_SERIAL_XSENS_MT=m -CONFIG_USB_SERIAL_WISHBONE=m -CONFIG_USB_SERIAL_SSU100=m -CONFIG_USB_SERIAL_QT2=m -CONFIG_USB_SERIAL_DEBUG=m - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -CONFIG_USB_EMI26=m -# CONFIG_USB_ADUTUX is not set -CONFIG_USB_SEVSEG=m -CONFIG_USB_RIO500=m -CONFIG_USB_LEGOTOWER=m -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -CONFIG_USB_CYPRESS_CY7C63=m -CONFIG_USB_CYTHERM=m -CONFIG_USB_IDMOUSE=m -# CONFIG_USB_FTDI_ELAN is not set -CONFIG_USB_APPLEDISPLAY=m -CONFIG_USB_SISUSBVGA=m -CONFIG_USB_SISUSBVGA_CON=y -CONFIG_USB_LD=m -CONFIG_USB_TRANCEVIBRATOR=m -CONFIG_USB_IOWARRIOR=m -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -CONFIG_USB_ISIGHTFW=m -# CONFIG_USB_YUREX is not set -CONFIG_USB_EZUSB_FX2=m -CONFIG_USB_HSIC_USB3503=m -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -CONFIG_NOP_USB_XCEIV=y -CONFIG_AM335X_CONTROL_USB=m -CONFIG_AM335X_PHY_USB=m -CONFIG_USB_GPIO_VBUS=m -CONFIG_USB_ISP1301=y -CONFIG_USB_MXS_PHY=y -# CONFIG_USB_ULPI is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=2 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -CONFIG_USB_FSL_USB2=y -# CONFIG_USB_FUSB300 is not set -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_MV_UDC is not set -CONFIG_USB_MV_U3D=m -# CONFIG_USB_M66592 is not set -# CONFIG_USB_BDC_UDC is not set -# CONFIG_USB_AMD5536UDC is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_DUMMY_HCD is not set -CONFIG_USB_LIBCOMPOSITE=m -CONFIG_USB_F_ACM=m -CONFIG_USB_F_SS_LB=m -CONFIG_USB_U_SERIAL=m -CONFIG_USB_U_ETHER=m -CONFIG_USB_F_SERIAL=m -CONFIG_USB_F_OBEX=m -CONFIG_USB_F_NCM=m -CONFIG_USB_F_ECM=m -CONFIG_USB_F_EEM=m -CONFIG_USB_F_SUBSET=m -CONFIG_USB_F_RNDIS=m -CONFIG_USB_F_MASS_STORAGE=m -CONFIG_USB_F_FS=m -CONFIG_USB_F_UAC1=m -CONFIG_USB_F_UAC2=m -CONFIG_USB_F_UVC=m -CONFIG_USB_F_MIDI=m -CONFIG_USB_F_HID=m -CONFIG_USB_F_PRINTER=m -CONFIG_USB_CONFIGFS=m -CONFIG_USB_CONFIGFS_SERIAL=y -CONFIG_USB_CONFIGFS_ACM=y -CONFIG_USB_CONFIGFS_OBEX=y -CONFIG_USB_CONFIGFS_NCM=y -CONFIG_USB_CONFIGFS_ECM=y -CONFIG_USB_CONFIGFS_ECM_SUBSET=y -CONFIG_USB_CONFIGFS_RNDIS=y -CONFIG_USB_CONFIGFS_EEM=y -# CONFIG_USB_CONFIGFS_PHONET is not set -CONFIG_USB_CONFIGFS_MASS_STORAGE=y -CONFIG_USB_CONFIGFS_F_LB_SS=y -CONFIG_USB_CONFIGFS_F_FS=y -CONFIG_USB_CONFIGFS_F_UAC1=y -CONFIG_USB_CONFIGFS_F_UAC2=y -CONFIG_USB_CONFIGFS_F_MIDI=y -CONFIG_USB_CONFIGFS_F_HID=y -CONFIG_USB_CONFIGFS_F_UVC=y -CONFIG_USB_CONFIGFS_F_PRINTER=y -CONFIG_USB_ZERO=m -# CONFIG_USB_ZERO_HNPTEST is not set -CONFIG_USB_AUDIO=m -# CONFIG_GADGET_UAC1 is not set -CONFIG_USB_ETH=m -CONFIG_USB_ETH_RNDIS=y -# CONFIG_USB_ETH_EEM is not set -CONFIG_USB_G_NCM=m -CONFIG_USB_GADGETFS=m -CONFIG_USB_FUNCTIONFS=m -# CONFIG_USB_FUNCTIONFS_ETH is not set -# CONFIG_USB_FUNCTIONFS_RNDIS is not set -CONFIG_USB_FUNCTIONFS_GENERIC=y -CONFIG_USB_MASS_STORAGE=m -CONFIG_USB_G_SERIAL=m -CONFIG_USB_MIDI_GADGET=m -CONFIG_USB_G_PRINTER=m -CONFIG_USB_CDC_COMPOSITE=m -# CONFIG_USB_G_NOKIA is not set -CONFIG_USB_G_ACM_MS=m -CONFIG_USB_G_MULTI=m -CONFIG_USB_G_MULTI_RNDIS=y -# CONFIG_USB_G_MULTI_CDC is not set -CONFIG_USB_G_HID=m -# CONFIG_USB_G_DBGP is not set -CONFIG_USB_G_WEBCAM=m -CONFIG_USB_LED_TRIG=y -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=8 -CONFIG_MMC_BLOCK_BOUNCE=y -CONFIG_SDIO_UART=y -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_IO_ACCESSORS=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MMC_SDHCI_OF_ARASAN=m -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_OF_ESDHC is not set -CONFIG_MMC_SDHCI_ESDHC_IMX=y -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_MXC is not set -CONFIG_MMC_TIFM_SD=m -CONFIG_MMC_CB710=m -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_DW is not set -CONFIG_MMC_VUB300=m -CONFIG_MMC_USHC=y -CONFIG_MMC_USDHI6ROL0=m -CONFIG_MMC_TOSHIBA_PCI=m -# CONFIG_MMC_MTK is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_CLASS_FLASH is not set - -# -# LED drivers -# -CONFIG_LEDS_88PM860X=y -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=m -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_DA9052 is not set -# CONFIG_LEDS_DAC124S085 is not set -CONFIG_LEDS_PWM=y -CONFIG_LEDS_REGULATOR=m -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_MC13783 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set -# CONFIG_LEDS_SYSCON is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=m -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_LEDS_TRIGGER_BACKLIGHT=m -CONFIG_LEDS_TRIGGER_GPIO=m -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -CONFIG_LEDS_TRIGGER_TRANSIENT=m -CONFIG_LEDS_TRIGGER_CAMERA=m -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -# CONFIG_RTC_SYSTOHC is not set -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -CONFIG_RTC_INTF_DEV_UIE_EMUL=y -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -CONFIG_RTC_DRV_88PM860X=y -CONFIG_RTC_DRV_88PM80X=y -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -CONFIG_RTC_DRV_PCF8523=y -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -CONFIG_RTC_DRV_S35390A=y -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set -# CONFIG_RTC_DRV_RV8803 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_MCP795 is not set - -# -# Platform RTC drivers -# -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_DA9052 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_ZYNQMP is not set - -# -# on-CPU RTC drivers -# -CONFIG_RTC_DRV_IMXDI=y -CONFIG_RTC_DRV_MC13XXX=y -CONFIG_RTC_DRV_MXC=y -CONFIG_RTC_DRV_SNVS=y - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DMA_OF=y -CONFIG_FSL_EDMA=m -# CONFIG_IMX_DMA is not set -CONFIG_IMX_SDMA=y -CONFIG_INTEL_IDMA64=y -CONFIG_MXS_DMA=y -# CONFIG_MX3_IPU is not set -CONFIG_MXC_PXP_V2=y -CONFIG_MXC_PXP_CLIENT_DEVICE=y -# CONFIG_NBPFAXI_DMA is not set -CONFIG_DW_DMAC_CORE=m -CONFIG_DW_DMAC=m -CONFIG_DW_DMAC_PCI=m - -# -# DMA Clients -# -CONFIG_ASYNC_TX_DMA=y -# CONFIG_DMATEST is not set -CONFIG_DMA_ENGINE_RAID=y -# CONFIG_AUXDISPLAY is not set -CONFIG_UIO=m -# CONFIG_UIO_CIF is not set -CONFIG_UIO_PDRV_GENIRQ=m -CONFIG_UIO_DMEM_GENIRQ=m -# CONFIG_UIO_AEC is not set -# CONFIG_UIO_SERCOS3 is not set -CONFIG_UIO_PCI_GENERIC=m -# CONFIG_UIO_NETX is not set -# CONFIG_UIO_PRUSS is not set -# CONFIG_UIO_MF624 is not set -# CONFIG_VFIO is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO=m - -# -# Virtio drivers -# -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_BALLOON is not set -# CONFIG_VIRTIO_INPUT is not set -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -CONFIG_PRISM2_USB=m -CONFIG_COMEDI=m -# CONFIG_COMEDI_DEBUG is not set -CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB=2048 -CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB=20480 -# CONFIG_COMEDI_MISC_DRIVERS is not set -# CONFIG_COMEDI_ISA_DRIVERS is not set -# CONFIG_COMEDI_PCI_DRIVERS is not set -# CONFIG_COMEDI_USB_DRIVERS is not set -# CONFIG_COMEDI_8255_SA is not set -# CONFIG_COMEDI_KCOMEDILIB is not set -CONFIG_RTL8192U=m -CONFIG_RTLLIB=m -CONFIG_RTLLIB_CRYPTO_CCMP=m -CONFIG_RTLLIB_CRYPTO_TKIP=m -CONFIG_RTLLIB_CRYPTO_WEP=m -CONFIG_RTL8192E=m -CONFIG_R8712U=m -CONFIG_R8188EU=m -CONFIG_88EU_AP_MODE=y -CONFIG_R8723AU=m -CONFIG_8723AU_AP_MODE=y -CONFIG_8723AU_BT_COEXIST=y -CONFIG_RTS5208=m -# CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set - -# -# IIO staging drivers -# - -# -# Accelerometers -# -# CONFIG_ADIS16201 is not set -# CONFIG_ADIS16203 is not set -# CONFIG_ADIS16204 is not set -# CONFIG_ADIS16209 is not set -# CONFIG_ADIS16220 is not set -# CONFIG_ADIS16240 is not set -# CONFIG_LIS3L02DQ is not set -# CONFIG_SCA3000 is not set - -# -# Analog to digital converters -# -# CONFIG_AD7606 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7816 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7280 is not set - -# -# Analog digital bi-direction converters -# -# CONFIG_ADT7316 is not set - -# -# Capacitance to digital converters -# -# CONFIG_AD7150 is not set -# CONFIG_AD7152 is not set -# CONFIG_AD7746 is not set - -# -# Direct Digital Synthesis -# -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set - -# -# Digital gyroscope sensors -# -# CONFIG_ADIS16060 is not set - -# -# Network Analyzer, Impedance Converters -# -# CONFIG_AD5933 is not set - -# -# Light sensors -# -# CONFIG_SENSORS_ISL29018 is not set -# CONFIG_SENSORS_ISL29028 is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL2x7x is not set - -# -# Magnetometer sensors -# -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set - -# -# Active energy metering IC -# -# CONFIG_ADE7753 is not set -# CONFIG_ADE7754 is not set -# CONFIG_ADE7758 is not set -# CONFIG_ADE7759 is not set -# CONFIG_ADE7854 is not set - -# -# Resolver to digital converters -# -# CONFIG_AD2S90 is not set -# CONFIG_AD2S1200 is not set -# CONFIG_AD2S1210 is not set - -# -# Triggers - standalone -# -CONFIG_IIO_PERIODIC_RTC_TRIGGER=m -# CONFIG_IIO_SIMPLE_DUMMY is not set -# CONFIG_FB_SM750 is not set -# CONFIG_FB_XGI is not set - -# -# Speakup console speech -# -CONFIG_SPEAKUP=m -CONFIG_SPEAKUP_SYNTH_ACNTSA=m -CONFIG_SPEAKUP_SYNTH_APOLLO=m -CONFIG_SPEAKUP_SYNTH_AUDPTR=m -CONFIG_SPEAKUP_SYNTH_BNS=m -CONFIG_SPEAKUP_SYNTH_DECTLK=m -CONFIG_SPEAKUP_SYNTH_DECEXT=m -CONFIG_SPEAKUP_SYNTH_LTLK=m -CONFIG_SPEAKUP_SYNTH_SOFT=m -CONFIG_SPEAKUP_SYNTH_SPKOUT=m -CONFIG_SPEAKUP_SYNTH_TXPRT=m -CONFIG_SPEAKUP_SYNTH_DUMMY=m -CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=m -CONFIG_STAGING_MEDIA=y -CONFIG_I2C_BCM2048=m -CONFIG_DVB_CXD2099=m -CONFIG_DVB_MN88472=m -CONFIG_DVB_MN88473=m -CONFIG_LIRC_STAGING=y -CONFIG_LIRC_BT829=m -CONFIG_LIRC_IMON=m -CONFIG_LIRC_HB=m -CONFIG_LIRC_XBOX=m -CONFIG_LIRC_SASEM=m -CONFIG_LIRC_SERIAL=m -CONFIG_LIRC_SERIAL_TRANSMITTER=y -CONFIG_LIRC_SIR=m -CONFIG_LIRC_ZILOG=m -CONFIG_LIRC_ATIUSB=m - -# -# Android -# -# CONFIG_STAGING_BOARD is not set -CONFIG_WIMAX_GDM72XX=m -CONFIG_WIMAX_GDM72XX_QOS=y -CONFIG_WIMAX_GDM72XX_K_MODE=y -CONFIG_WIMAX_GDM72XX_WIMAX2=y -CONFIG_WIMAX_GDM72XX_USB=y -# CONFIG_WIMAX_GDM72XX_SDIO is not set -CONFIG_WIMAX_GDM72XX_USB_PM=y -CONFIG_LTE_GDM724X=m -CONFIG_MTD_SPINAND_MT29F=m -# CONFIG_MTD_SPINAND_ONDIEECC is not set -# CONFIG_LUSTRE_FS is not set -CONFIG_DGNC=m -CONFIG_DGAP=m -# CONFIG_GS_FPGABOOT is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -CONFIG_FB_TFT=m -CONFIG_FB_TFT_AGM1264K_FL=m -CONFIG_FB_TFT_BD663474=m -CONFIG_FB_TFT_HX8340BN=m -CONFIG_FB_TFT_HX8347D=m -CONFIG_FB_TFT_HX8353D=m -CONFIG_FB_TFT_HX8357D=m -CONFIG_FB_TFT_ILI9163=m -CONFIG_FB_TFT_ILI9320=m -CONFIG_FB_TFT_ILI9325=m -CONFIG_FB_TFT_ILI9340=m -CONFIG_FB_TFT_ILI9341=m -CONFIG_FB_TFT_ILI9481=m -CONFIG_FB_TFT_ILI9486=m -CONFIG_FB_TFT_PCD8544=m -CONFIG_FB_TFT_RA8875=m -CONFIG_FB_TFT_S6D02A1=m -CONFIG_FB_TFT_S6D1121=m -CONFIG_FB_TFT_SSD1289=m -CONFIG_FB_TFT_SSD1306=m -CONFIG_FB_TFT_SSD1331=m -CONFIG_FB_TFT_SSD1351=m -CONFIG_FB_TFT_ST7735R=m -CONFIG_FB_TFT_ST7789V=m -CONFIG_FB_TFT_TINYLCD=m -CONFIG_FB_TFT_TLS8204=m -CONFIG_FB_TFT_UC1611=m -CONFIG_FB_TFT_UC1701=m -CONFIG_FB_TFT_UPD161704=m -CONFIG_FB_TFT_WATTEROTT=m -CONFIG_FB_FLEX=m -CONFIG_FB_TFT_FBTFT_DEVICE=m -# CONFIG_WILC1000_DRIVER is not set -# CONFIG_MOST is not set -# CONFIG_CHROME_PLATFORMS is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_CDCE925 is not set -# CONFIG_CLK_QORIQ is not set -# CONFIG_COMMON_CLK_PWM is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_CDCE706 is not set - -# -# Hardware Spinlock drivers -# - -# -# Clock Source drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y -CONFIG_CLKSRC_MMIO=y -# CONFIG_ARM_TIMER_SP804 is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -CONFIG_CLKSRC_IMX_GPT=y -# CONFIG_MAILBOX is not set -CONFIG_IOMMU_API=y -CONFIG_IOMMU_SUPPORT=y - -# -# Generic IOMMU Pagetable Support -# -CONFIG_IOMMU_IO_PGTABLE=y -CONFIG_IOMMU_IO_PGTABLE_LPAE=y -# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set -CONFIG_OF_IOMMU=y -CONFIG_ARM_SMMU=y - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# - -# -# SOC (System On Chip) specific Drivers -# -# CONFIG_SOC_BRCMSTB is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SOC_TI is not set -CONFIG_PM_DEVFREQ=y - -# -# DEVFREQ Governors -# -CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y -CONFIG_DEVFREQ_GOV_PERFORMANCE=y -CONFIG_DEVFREQ_GOV_POWERSAVE=y -CONFIG_DEVFREQ_GOV_USERSPACE=y - -# -# DEVFREQ Drivers -# -CONFIG_PM_DEVFREQ_EVENT=y -CONFIG_EXTCON=y - -# -# Extcon Device Drivers -# -CONFIG_EXTCON_ADC_JACK=m -CONFIG_EXTCON_GPIO=y -CONFIG_EXTCON_RT8973A=m -CONFIG_EXTCON_SM5502=m -CONFIG_EXTCON_USB_GPIO=y -CONFIG_MEMORY=y -CONFIG_IIO=m -CONFIG_IIO_BUFFER=y -# CONFIG_IIO_BUFFER_CB is not set -CONFIG_IIO_KFIFO_BUF=m -CONFIG_IIO_TRIGGERED_BUFFER=m -CONFIG_IIO_TRIGGER=y -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 - -# -# Accelerometers -# -# CONFIG_BMA180 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_HID_SENSOR_ACCEL_3D is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_KXSD9 is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMA9551 is not set -# CONFIG_MMA9553 is not set -# CONFIG_MXC4005 is not set -# CONFIG_STK8312 is not set -# CONFIG_STK8BA50 is not set - -# -# Analog to digital converters -# -# CONFIG_AD7266 is not set -# CONFIG_AD7291 is not set -# CONFIG_AD7298 is not set -# CONFIG_AD7476 is not set -# CONFIG_AD7791 is not set -# CONFIG_AD7793 is not set -# CONFIG_AD7887 is not set -# CONFIG_AD7923 is not set -# CONFIG_AD799X is not set -# CONFIG_CC10001_ADC is not set -# CONFIG_HI8435 is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_NAU7802 is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_VF610_ADC is not set - -# -# Amplifiers -# -# CONFIG_AD8366 is not set - -# -# Chemical Sensors -# -# CONFIG_VZ89X is not set - -# -# Hid Sensor IIO Common -# -CONFIG_HID_SENSOR_IIO_COMMON=m -CONFIG_HID_SENSOR_IIO_TRIGGER=m - -# -# SSP Sensor Common -# -# CONFIG_IIO_SSP_SENSORHUB is not set - -# -# Digital to analog converters -# -# CONFIG_AD5064 is not set -# CONFIG_AD5360 is not set -# CONFIG_AD5380 is not set -# CONFIG_AD5421 is not set -# CONFIG_AD5446 is not set -# CONFIG_AD5449 is not set -# CONFIG_AD5504 is not set -# CONFIG_AD5624R_SPI is not set -# CONFIG_AD5686 is not set -# CONFIG_AD5755 is not set -# CONFIG_AD5764 is not set -# CONFIG_AD5791 is not set -# CONFIG_AD7303 is not set -# CONFIG_M62332 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set - -# -# Frequency Synthesizers DDS/PLL -# - -# -# Clock Generator/Distribution -# -# CONFIG_AD9523 is not set - -# -# Phase-Locked Loop (PLL) frequency synthesizers -# -# CONFIG_ADF4350 is not set - -# -# Digital gyroscope sensors -# -# CONFIG_ADIS16080 is not set -# CONFIG_ADIS16130 is not set -# CONFIG_ADIS16136 is not set -# CONFIG_ADIS16260 is not set -# CONFIG_ADXRS450 is not set -# CONFIG_BMG160 is not set -CONFIG_HID_SENSOR_GYRO_3D=m -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_ITG3200 is not set - -# -# Humidity sensors -# -CONFIG_DHT11=m -# CONFIG_HDC100X is not set -# CONFIG_HTU21 is not set -# CONFIG_SI7005 is not set -# CONFIG_SI7020 is not set - -# -# Inertial measurement units -# -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_KMX61 is not set -# CONFIG_INV_MPU6050_IIO is not set - -# -# Light sensors -# -# CONFIG_ADJD_S311 is not set -# CONFIG_AL3320A is not set -# CONFIG_APDS9300 is not set -# CONFIG_APDS9960 is not set -# CONFIG_BH1750 is not set -# CONFIG_CM32181 is not set -# CONFIG_CM3232 is not set -# CONFIG_CM3323 is not set -# CONFIG_CM36651 is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_ISL29125 is not set -# CONFIG_HID_SENSOR_ALS is not set -# CONFIG_HID_SENSOR_PROX is not set -# CONFIG_JSA1212 is not set -# CONFIG_RPR0521 is not set -# CONFIG_LTR501 is not set -# CONFIG_OPT3001 is not set -# CONFIG_PA12203001 is not set -# CONFIG_STK3310 is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -# CONFIG_SENSORS_TSL2563 is not set -# CONFIG_TSL4531 is not set -# CONFIG_US5182D is not set -# CONFIG_VCNL4000 is not set - -# -# Magnetometer sensors -# -# CONFIG_AK8975 is not set -# CONFIG_AK09911 is not set -# CONFIG_BMC150_MAGN is not set -# CONFIG_MAG3110 is not set -# CONFIG_HID_SENSOR_MAGNETOMETER_3D is not set -# CONFIG_MMC35240 is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set - -# -# Inclinometer sensors -# -# CONFIG_HID_SENSOR_INCLINOMETER_3D is not set -# CONFIG_HID_SENSOR_DEVICE_ROTATION is not set - -# -# Triggers - standalone -# -CONFIG_IIO_INTERRUPT_TRIGGER=m -CONFIG_IIO_SYSFS_TRIGGER=m - -# -# Digital potentiometers -# -# CONFIG_MCP4531 is not set - -# -# Pressure sensors -# -# CONFIG_BMP280 is not set -# CONFIG_HID_SENSOR_PRESS is not set -# CONFIG_MPL115 is not set -# CONFIG_MPL3115 is not set -# CONFIG_MS5611 is not set -# CONFIG_MS5637 is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_T5403 is not set - -# -# Lightning sensors -# -# CONFIG_AS3935 is not set - -# -# Proximity sensors -# -# CONFIG_LIDAR_LITE_V2 is not set -# CONFIG_SX9500 is not set - -# -# Temperature sensors -# -# CONFIG_MLX90614 is not set -# CONFIG_TMP006 is not set -# CONFIG_TSYS01 is not set -# CONFIG_TSYS02D is not set -# CONFIG_NTB is not set -# CONFIG_VME_BUS is not set -CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -CONFIG_PWM_FSL_FTM=y -CONFIG_PWM_IMX=y -CONFIG_PWM_PCA9685=y -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -# CONFIG_IPACK_BUS is not set -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -CONFIG_RESET_CONTROLLER=y -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -CONFIG_GENERIC_PHY=y -CONFIG_PHY_PXA_28NM_HSIC=y -CONFIG_PHY_PXA_28NM_USB2=y -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -CONFIG_POWERCAP=y -# CONFIG_MCB is not set - -# -# Performance monitor support -# -CONFIG_ARM_PMU=y -CONFIG_RAS=y -# CONFIG_THUNDERBOLT is not set - -# -# Android -# -# CONFIG_ANDROID is not set -CONFIG_NVMEM=y -CONFIG_NVMEM_IMX_OCOTP=m -# CONFIG_STM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set -# CONFIG_INTEL_TH is not set - -# -# FPGA Configuration Support -# -# CONFIG_FPGA is not set - -# -# MXC support drivers -# -CONFIG_MXC_IPU=y - -# -# Vivante GPU support -# -CONFIG_MXC_GPU_VIV=y -CONFIG_MXC_IPU_V3_FSL=y - -# -# MXC VPU(Video Processing Unit) support -# -CONFIG_MXC_VPU=y -# CONFIG_MXC_VPU_DEBUG is not set -# CONFIG_MX6_VPU_352M is not set - -# -# MXC HDMI CEC (Consumer Electronics Control) support -# -# CONFIG_MXC_HDMI_CEC is not set -CONFIG_MXC_HDMI_CEC_SR=y - -# -# MXC MIPI Support -# -CONFIG_MXC_MIPI_CSI2=y - -# -# MXC Media Local Bus Driver -# -CONFIG_MXC_MLB=y -CONFIG_MXC_MLB150=m - -# -# Firmware Drivers -# -CONFIG_FIRMWARE_MEMMAP=y - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -CONFIG_EXT4_ENCRYPTION=m -CONFIG_EXT4_FS_ENCRYPTION=y -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_PROC_INFO is not set -CONFIG_REISERFS_FS_XATTR=y -CONFIG_REISERFS_FS_POSIX_ACL=y -# CONFIG_REISERFS_FS_SECURITY is not set -CONFIG_JFS_FS=m -CONFIG_JFS_POSIX_ACL=y -CONFIG_JFS_SECURITY=y -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_XFS_FS=m -CONFIG_XFS_QUOTA=y -CONFIG_XFS_POSIX_ACL=y -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=y -CONFIG_BTRFS_FS_POSIX_ACL=y -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_F2FS_FS=m -CONFIG_F2FS_STAT_FS=y -CONFIG_F2FS_FS_XATTR=y -CONFIG_F2FS_FS_POSIX_ACL=y -# CONFIG_F2FS_FS_SECURITY is not set -# CONFIG_F2FS_CHECK_FS is not set -# CONFIG_F2FS_FS_ENCRYPTION is not set -# CONFIG_F2FS_IO_TRACE is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -CONFIG_QUOTA=y -# CONFIG_QUOTA_NETLINK_INTERFACE is not set -CONFIG_PRINT_QUOTA_WARNING=y -# CONFIG_QUOTA_DEBUG is not set -CONFIG_QUOTA_TREE=m -CONFIG_QFMT_V1=m -CONFIG_QFMT_V2=m -CONFIG_QUOTACTL=y -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=y -CONFIG_CUSE=y -CONFIG_OVERLAY_FS=y - -# -# Caches -# -CONFIG_FSCACHE=m -# CONFIG_FSCACHE_STATS is not set -# CONFIG_FSCACHE_HISTOGRAM is not set -# CONFIG_FSCACHE_DEBUG is not set -# CONFIG_FSCACHE_OBJECT_LIST is not set -CONFIG_CACHEFILES=m -# CONFIG_CACHEFILES_DEBUG is not set -# CONFIG_CACHEFILES_HISTOGRAM is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_PROC_CHILDREN=y -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_HUGETLB_PAGE is not set -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -CONFIG_HFS_FS=m -CONFIG_HFSPLUS_FS=m -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -CONFIG_JFFS2_FS=m -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_JFFS2_FS_XATTR is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -CONFIG_JFFS2_ZLIB=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_UBIFS_FS=m -# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -# CONFIG_UBIFS_ATIME_SUPPORT is not set -CONFIG_LOGFS=m -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -CONFIG_SQUASHFS_FILE_CACHE=y -# CONFIG_SQUASHFS_FILE_DIRECT is not set -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -CONFIG_SQUASHFS_DECOMP_MULTI=y -# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set -CONFIG_SQUASHFS_XATTR=y -CONFIG_SQUASHFS_ZLIB=y -CONFIG_SQUASHFS_LZ4=y -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -CONFIG_ROMFS_FS=m -CONFIG_ROMFS_BACKED_BY_BLOCK=y -# CONFIG_ROMFS_BACKED_BY_MTD is not set -# CONFIG_ROMFS_BACKED_BY_BOTH is not set -CONFIG_ROMFS_ON_BLOCK=y -# CONFIG_PSTORE is not set -CONFIG_SYSV_FS=m -# CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -CONFIG_NFS_V3_ACL=y -CONFIG_NFS_V4=y -# CONFIG_NFS_SWAP is not set -# CONFIG_NFS_V4_1 is not set -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -CONFIG_NFS_DEBUG=y -CONFIG_NFSD=m -CONFIG_NFSD_V2_ACL=y -CONFIG_NFSD_V3=y -CONFIG_NFSD_V3_ACL=y -CONFIG_NFSD_V4=y -# CONFIG_NFSD_PNFS is not set -CONFIG_GRACE_PERIOD=y -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_ACL_SUPPORT=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_RPCSEC_GSS_KRB5=m -CONFIG_SUNRPC_DEBUG=y -# CONFIG_CEPH_FS is not set -CONFIG_CIFS=m -# CONFIG_CIFS_STATS is not set -CONFIG_CIFS_WEAK_PW_HASH=y -# CONFIG_CIFS_UPCALL is not set -CONFIG_CIFS_XATTR=y -CONFIG_CIFS_POSIX=y -CONFIG_CIFS_ACL=y -# CONFIG_CIFS_DEBUG is not set -CONFIG_CIFS_DFS_UPCALL=y -CONFIG_CIFS_SMB2=y -CONFIG_CIFS_SMB311=y -CONFIG_CIFS_FSCACHE=y -CONFIG_NCP_FS=m -# CONFIG_NCPFS_PACKET_SIGNING is not set -# CONFIG_NCPFS_IOCTL_LOCKING is not set -# CONFIG_NCPFS_STRONG is not set -# CONFIG_NCPFS_NFS_NS is not set -# CONFIG_NCPFS_OS2_NS is not set -# CONFIG_NCPFS_SMALLDOS is not set -# CONFIG_NCPFS_NLS is not set -# CONFIG_NCPFS_EXTRAS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_CODEPAGE_737=m -CONFIG_NLS_CODEPAGE_775=m -CONFIG_NLS_CODEPAGE_850=y -CONFIG_NLS_CODEPAGE_852=y -CONFIG_NLS_CODEPAGE_855=m -CONFIG_NLS_CODEPAGE_857=m -CONFIG_NLS_CODEPAGE_860=m -CONFIG_NLS_CODEPAGE_861=m -CONFIG_NLS_CODEPAGE_862=m -CONFIG_NLS_CODEPAGE_863=m -CONFIG_NLS_CODEPAGE_864=m -CONFIG_NLS_CODEPAGE_865=m -CONFIG_NLS_CODEPAGE_866=m -CONFIG_NLS_CODEPAGE_869=m -CONFIG_NLS_CODEPAGE_936=m -CONFIG_NLS_CODEPAGE_950=m -CONFIG_NLS_CODEPAGE_932=m -CONFIG_NLS_CODEPAGE_949=m -CONFIG_NLS_CODEPAGE_874=m -CONFIG_NLS_ISO8859_8=m -CONFIG_NLS_CODEPAGE_1250=y -CONFIG_NLS_CODEPAGE_1251=y -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NLS_ISO8859_2=y -CONFIG_NLS_ISO8859_3=m -CONFIG_NLS_ISO8859_4=m -CONFIG_NLS_ISO8859_5=m -CONFIG_NLS_ISO8859_6=m -CONFIG_NLS_ISO8859_7=m -CONFIG_NLS_ISO8859_9=m -CONFIG_NLS_ISO8859_13=m -CONFIG_NLS_ISO8859_14=m -CONFIG_NLS_ISO8859_15=m -CONFIG_NLS_KOI8_R=m -CONFIG_NLS_KOI8_U=m -CONFIG_NLS_MAC_ROMAN=m -CONFIG_NLS_MAC_CELTIC=m -CONFIG_NLS_MAC_CENTEURO=m -CONFIG_NLS_MAC_CROATIAN=m -CONFIG_NLS_MAC_CYRILLIC=m -CONFIG_NLS_MAC_GAELIC=m -CONFIG_NLS_MAC_GREEK=m -CONFIG_NLS_MAC_ICELAND=m -CONFIG_NLS_MAC_INUIT=m -CONFIG_NLS_MAC_ROMANIAN=m -CONFIG_NLS_MAC_TURKISH=m -CONFIG_NLS_UTF8=y -CONFIG_DLM=m -# CONFIG_DLM_DEBUG is not set - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -CONFIG_DYNAMIC_DEBUG=y - -# -# Compile-time checks and compiler options -# -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -# CONFIG_DEBUG_KERNEL is not set - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_MEMORY_INIT is not set - -# -# Debug Lockups and Hangs -# -CONFIG_PANIC_ON_OOPS=y -CONFIG_PANIC_ON_OOPS_VALUE=1 -CONFIG_PANIC_TIMEOUT=1 -# CONFIG_SCHED_INFO is not set -# CONFIG_DEBUG_TIMEKEEPING is not set - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -CONFIG_STACKTRACE=y -CONFIG_DEBUG_BUGVERBOSE=y - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=300 -CONFIG_NOP_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_RING_BUFFER=y -CONFIG_EVENT_TRACING=y -CONFIG_CONTEXT_SWITCH_TRACER=y -CONFIG_TRACING=y -CONFIG_GENERIC_TRACER=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -CONFIG_FUNCTION_TRACER=y -# CONFIG_FUNCTION_GRAPH_TRACER is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_MISSED_TIMER_OFFSETS_HIST is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_STACK_TRACER is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_UPROBE_EVENT is not set -# CONFIG_PROBE_EVENTS is not set -CONFIG_DYNAMIC_FTRACE=y -# CONFIG_FUNCTION_PROFILER is not set -CONFIG_FTRACE_MCOUNT_RECORD=y -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_TRACE_ENUM_MAP_FILE is not set -# CONFIG_TRACING_EVENTS_GPIO is not set - -# -# Runtime Testing -# -# CONFIG_LKDTM is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_MEMTEST is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_STRICT_DEVMEM is not set -CONFIG_ARM_UNWIND=y -# CONFIG_DEBUG_USER is not set -CONFIG_DEBUG_IMX_UART_PORT=1 -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_UART_8250 is not set -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_CORESIGHT is not set - -# -# Security options -# -CONFIG_KEYS=y -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_BIG_KEYS is not set -CONFIG_ENCRYPTED_KEYS=y -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=y -CONFIG_ASYNC_CORE=m -CONFIG_ASYNC_MEMCPY=m -CONFIG_ASYNC_XOR=m -CONFIG_ASYNC_PQ=m -CONFIG_ASYNC_RAID6_RECOV=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_PCOMP=y -CONFIG_CRYPTO_PCOMP2=y -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_AKCIPHER=m -CONFIG_CRYPTO_RSA=m -CONFIG_CRYPTO_CRYPTODEV=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_USER=m -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_PCRYPT=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CRYPTO_CRYPTD=y -CONFIG_CRYPTO_MCRYPTD=m -CONFIG_CRYPTO_AUTHENC=y -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=y -CONFIG_CRYPTO_GCM=y -CONFIG_CRYPTO_CHACHA20POLY1305=m -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_ECHAINIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CTR=y -CONFIG_CRYPTO_CTS=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_LRW=y -CONFIG_CRYPTO_PCBC=y -CONFIG_CRYPTO_XTS=y -CONFIG_CRYPTO_KEYWRAP=m - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_XCBC=y -CONFIG_CRYPTO_VMAC=y - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRC32=y -CONFIG_CRYPTO_CRCT10DIF=y -CONFIG_CRYPTO_GHASH=y -CONFIG_CRYPTO_POLY1305=m -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_MICHAEL_MIC=y -CONFIG_CRYPTO_RMD128=m -CONFIG_CRYPTO_RMD160=m -CONFIG_CRYPTO_RMD256=m -CONFIG_CRYPTO_RMD320=m -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA512=y -CONFIG_CRYPTO_TGR192=m -CONFIG_CRYPTO_WP512=m - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -CONFIG_CRYPTO_ANUBIS=m -CONFIG_CRYPTO_ARC4=y -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_BLOWFISH_COMMON=m -CONFIG_CRYPTO_CAMELLIA=m -CONFIG_CRYPTO_CAST_COMMON=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_FCRYPT=m -CONFIG_CRYPTO_KHAZAD=m -CONFIG_CRYPTO_SALSA20=m -CONFIG_CRYPTO_CHACHA20=m -CONFIG_CRYPTO_SEED=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_TEA=y -CONFIG_CRYPTO_TWOFISH=y -CONFIG_CRYPTO_TWOFISH_COMMON=y - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_ZLIB=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_842=m -CONFIG_CRYPTO_LZ4=y -CONFIG_CRYPTO_LZ4HC=y - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=m -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_USER_API=m -CONFIG_CRYPTO_USER_API_HASH=m -CONFIG_CRYPTO_USER_API_SKCIPHER=m -CONFIG_CRYPTO_USER_API_RNG=m -# CONFIG_CRYPTO_USER_API_AEAD is not set -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HW=y -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -CONFIG_CRYPTO_DEV_FSL_CAAM=y -CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y -CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 -# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set -CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y -CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y -CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y -CONFIG_CRYPTO_DEV_FSL_CAAM_IMX=y -CONFIG_CRYPTO_DEV_FSL_CAAM_LE=y -# CONFIG_CRYPTO_DEV_FSL_CAAM_SM is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set -# CONFIG_CRYPTO_DEV_SAHARA is not set -# CONFIG_CRYPTO_DEV_MXS_DCP is not set -CONFIG_ASYMMETRIC_KEY_TYPE=m -CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m -CONFIG_PUBLIC_KEY_ALGO_RSA=m -CONFIG_X509_CERTIFICATE_PARSER=m -CONFIG_PKCS7_MESSAGE_PARSER=m -# CONFIG_PKCS7_TEST_KEY is not set - -# -# Certificates for signature checking -# -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_ARM_CRYPTO is not set -CONFIG_BINARY_PRINTF=y - -# -# Library routines -# -CONFIG_RAID6_PQ=y -CONFIG_BITREVERSE=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_STMP_DEVICE=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=y -CONFIG_CRC16=y -CONFIG_CRC_T10DIF=y -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -CONFIG_CRC7=y -CONFIG_LIBCRC32C=y -CONFIG_CRC8=m -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_842_COMPRESS=m -CONFIG_842_DECOMPRESS=m -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_COMPRESS=y -CONFIG_LZ4HC_COMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_XZ_DEC=m -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_ARMTHUMB=y -# CONFIG_XZ_DEC_SPARC is not set -CONFIG_XZ_DEC_BCJ=y -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DECOMPRESS_LZO=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_TEXTSEARCH=y -CONFIG_TEXTSEARCH_KMP=m -CONFIG_TEXTSEARCH_BM=m -CONFIG_TEXTSEARCH_FSM=m -CONFIG_BTREE=y -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_GLOB=y -# CONFIG_GLOB_SELFTEST is not set -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_CLZ_TAB=y -CONFIG_CORDIC=y -# CONFIG_DDR is not set -CONFIG_MPILIB=m -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_SG_SPLIT is not set -CONFIG_ARCH_HAS_SG_CHAIN=y -# CONFIG_VIRTUALIZATION is not set diff --git a/projects/imx6/options b/projects/imx6/options deleted file mode 100644 index e556871fec..0000000000 --- a/projects/imx6/options +++ /dev/null @@ -1,150 +0,0 @@ -################################################################################ -# setup system defaults -################################################################################ - - # The TARGET_CPU variable controls which processor should be targeted for - # generated code. - case $TARGET_ARCH in - arm) - # TARGET_CPU: - # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d - # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c - # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t - # arm720t arm740t strongarm strongarm110 strongarm1100 - # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t - # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi - # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e - # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s - # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4 - # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312. - TARGET_CPU="cortex-a9" - - # TARGET_FLOAT: - # Specifies which floating-point ABI to use. Permissible values are: - # soft softfp hard - TARGET_FLOAT="hard" - - # TARGET_FPU: - # This specifies what floating point hardware (or hardware emulation) is - # available on the target. Permissible names are: - # fpa fpe2 fpe3 maverick vfp vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 - # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16 - # neon-vfpv4. - TARGET_FPU="neon" - ;; - esac - - # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) - BOOTLOADER="u-boot" - - # u-boot version to use (default) - UBOOT_VERSION="imx6-cuboxi" - - # Configuration for u-boot - UBOOT_CONFIG="mx6_cubox-i_config" - UBOOT_CONFIG="$UBOOT_CONFIG matrix" - - UBOOT_CONFIG_V2="udoo_config" - UBOOT_CONFIG_V2="$UBOOT_CONFIG_V2 tbs2910_config" - #UBOOT_CONFIG_V2="$UBOOT_CONFIG_V2 wandboard_config" - - # Target Configfile for u-boot - UBOOT_CONFIGFILE="" - - # Kernel target - KERNEL_TARGET="zImage" - - # Kernel extra targets to build - KERNEL_UBOOT_EXTRA_TARGET="imx6q-cubox-i.dtb imx6dl-cubox-i.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard.dtb imx6dl-hummingboard.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard2.dtb imx6dl-hummingboard2.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-tbs2910.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo.dtb imx6dl-udoo.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo-15lvds.dtb imx6q-udoo-7lvds.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6dl-udoo-15lvds.dtb imx6dl-udoo-7lvds.dtb" - - # Additional kernel make parameters (for example to specify the u-boot loadaddress) - KERNEL_MAKE_EXTRACMD="" - - # Kernel to use. - # default is 4.4 from xbian - if [ -z "$LINUX_VERSION" -o "$LINUX_VERSION" != "sr-3.14" ]; then - LINUX="imx6-4.4-xbian" - LIBCEC_TYPE="xbian" - else - LINUX="imx6" - fi - -################################################################################ -# setup build defaults -################################################################################ - - # Project CFLAGS - PROJECT_CFLAGS="" - - # SquashFS compression method (gzip / lzo / xz) - SQUASHFS_COMPRESSION="lzo" - -################################################################################ -# setup project defaults -################################################################################ - - # build and install ALSA Audio support (yes / no) - ALSA_SUPPORT="yes" - - # OpenGL(X) implementation to use (no / mesa) - OPENGL="no" - - # OpenGL-ES implementation to use (no / bcm2835-driver / imx-gpu-viv) - if [ "$LINUX" = "imx6" ]; then - OPENGLES="imx-gpu-viv" - else - OPENGLES="gpu-viv-bin-mx6q" - fi - - # include uvesafb support (yes / no) - UVESAFB_SUPPORT="no" - - # Displayserver to use (x11 / no) - DISPLAYSERVER="no" - - # Windowmanager to use (ratpoison / fluxbox / none) - WINDOWMANAGER="none" - - # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) - # Space separated list is supported, - # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" - GRAPHIC_DRIVERS="" - - # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) - KODIPLAYER_DRIVER="libfslvpuwrap" - - # Modules to install in initramfs for early boot - INITRAMFS_MODULES="" - - # additional drivers to install: - # for a list of additional drivers see packages/linux-drivers - # Space separated list is supported, - # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS" - - # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) - # Space separated list is supported, - # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" - FIRMWARE="misc-firmware wlan-firmware iwlwifi-firmware dvb-firmware brcmfmac_sdio-firmware-imx" - - # build and install ATV IR remote support (yes / no) - ATVCLIENT_SUPPORT="no" - - # build with swap support (yes / no) - SWAP_SUPPORT="no" - - # swap support enabled per default (yes / no) - SWAP_ENABLED_DEFAULT="no" - - # swapfile size if SWAP_SUPPORT=yes in MB - SWAPFILESIZE="128" - - # build with installer (yes / no) - INSTALLER_SUPPORT="no" - diff --git a/projects/imx6/patches/RTL8812AU/RTL8812AU-010-compile-3.14.patch b/projects/imx6/patches/RTL8812AU/RTL8812AU-010-compile-3.14.patch deleted file mode 100644 index af7a74193d..0000000000 --- a/projects/imx6/patches/RTL8812AU/RTL8812AU-010-compile-3.14.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c -index 492bb1a..e52134d 100644 ---- a/os_dep/linux/ioctl_cfg80211.c -+++ b/os_dep/linux/ioctl_cfg80211.c -@@ -649,20 +649,16 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) - struct wlan_network *cur_network = &(pmlmepriv->cur_network); - struct wireless_dev *pwdev = padapter->rtw_wdev; - struct cfg80211_bss *bss = NULL; --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) - struct wiphy *wiphy = pwdev->wiphy; - int freq = 2412; - struct ieee80211_channel *notify_channel; --#endif - - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); - --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) - freq = rtw_ch2freq(cur_network->network.Configuration.DSConfig); - - if (0) - DBG_871X("chan: %d, freq: %d\n", cur_network->network.Configuration.DSConfig, freq); --#endif - - if (pwdev->iftype != NL80211_IFTYPE_ADHOC) - { -@@ -713,12 +709,8 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter) - DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); - } - //notify cfg80211 that device joined an IBSS --#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) - notify_channel = ieee80211_get_channel(wiphy, freq); - cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC); --#else -- cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, GFP_ATOMIC); --#endif - } - - void rtw_cfg80211_indicate_connect(_adapter *padapter) diff --git a/projects/imx6/patches/alsa-lib/alsa-lib-enable_imx_passthrough_over_spdif_old_kernel.patch b/projects/imx6/patches/alsa-lib/alsa-lib-enable_imx_passthrough_over_spdif_old_kernel.patch deleted file mode 100644 index 72b905d1ef..0000000000 --- a/projects/imx6/patches/alsa-lib/alsa-lib-enable_imx_passthrough_over_spdif_old_kernel.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/conf/cards/aliases.conf b/src/conf/cards/aliases.conf ---- a/src/conf/cards/aliases.conf 2016-07-20 20:57:09.510009951 +0200 -+++ b/src/conf/cards/aliases.conf 2016-07-20 20:57:41.757691480 +0200 -@@ -55,6 +55,8 @@ - AV200 cards.CMI8788 - CMI8786 cards.CMI8788 - CMI8787 cards.CMI8788 -+'On-board_SPDIF' cards.imx-spdif -+'Integrated_SPDI' cards.imx-spdif - - - diff --git a/projects/imx6/patches/kodi/kodi-050-from-openbricks.patch b/projects/imx6/patches/kodi/kodi-050-from-openbricks.patch deleted file mode 100644 index af530d2d47..0000000000 --- a/projects/imx6/patches/kodi/kodi-050-from-openbricks.patch +++ /dev/null @@ -1,1772 +0,0 @@ -https://github.com/OpenBricks/openbricks/tree/krypton-glibc -https://github.com/OpenBricks/openbricks/tree/krypton-glibc/packages/multimedia/kodi/patches -https://github.com/OpenBricks/openbricks/tree//packages/multimedia/kodi/patches - -============================================================== -file 0034-IMXCODEC-Use-uint32_t-for-physical-addresses.patch -============================================================== - -From 2dc612adfcc74c6439e5df47aba2cf63573f93f1 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sat, 24 Sep 2016 15:36:23 +0200 -Subject: [PATCH] IMXCODEC: Use uint32_t for physical addresses - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 2 +- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 2 +- - xbmc/linux/imx/IMX.h | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index b1147d2..705b4a9 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -1198,7 +1198,7 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, - iHeight = (((frameInfo->pExtInfo->nFrmHeight) + 15) & ~15); - - pVirtAddr = m_frameBuffer->pbufVirtY; -- pPhysAddr = (int)m_frameBuffer->pbufY; -+ pPhysAddr = (uint32_t)m_frameBuffer->pbufY; - - #ifdef IMX_INPUT_FORMAT_I420 - iFormat = _4CC('I', '4', '2', '0'); -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index 32e3a6c..fdac8ec 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -187,7 +187,7 @@ private: - int m_fbLineLength; - int m_fbPageSize; - int m_fbPhysSize; -- int m_fbPhysAddr; -+ uint32_t m_fbPhysAddr; - uint8_t *m_fbVirtAddr; - struct fb_var_screeninfo m_fbVar; - int m_ipuHandle; -diff --git a/xbmc/linux/imx/IMX.h b/xbmc/linux/imx/IMX.h -index a269af0..2bc6761 100644 ---- a/xbmc/linux/imx/IMX.h -+++ b/xbmc/linux/imx/IMX.h -@@ -182,7 +182,7 @@ public: - public: - uint32_t iWidth; - uint32_t iHeight; -- int pPhysAddr; -+ uint32_t pPhysAddr; - uint8_t *pVirtAddr; - int iFormat; - double m_fps; --- -1.9.1 - - -============================================================== -file 0035-IMXCODEC-Fix-page-counting-avoid-compiler-warning.patch -============================================================== - -From 527cc00d7b56f01277be9abce0de48a63f388dd7 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sat, 24 Sep 2016 15:39:38 +0200 -Subject: [PATCH] IMXCODEC: Fix page counting, avoid compiler warning - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 705b4a9..9b7a9ea 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -1562,15 +1562,15 @@ void CIMXContext::SetIPUMotion(EINTERLACEMETHOD imethod) - void CIMXContext::Blit(CIMXBuffer *source_p, CIMXBuffer *source, const CRect &srcRect, - const CRect &dstRect, uint8_t fieldFmt, int page) - { -- static unsigned char pg; -+ static int pg = 0; - - if (page == RENDER_TASK_AUTOPAGE) - page = pg; -- else if (page < 0 && page >= m_fbPages) -+ else if (page < 0 || page >= m_fbPages) - return; - - IPUTaskPtr ipu(new IPUTask(source_p, source, page)); -- pg = ++pg % m_fbPages; -+ pg = (page + 1) % m_fbPages; - - #ifdef IMX_PROFILE_BUFFERS - unsigned long long before = XbmcThreads::SystemClockMillis(); --- -1.9.1 - - -============================================================== -file 0036-IMXCODEC-Honour-forced-aspect-ratio-hint.patch -============================================================== - -From eab2f97c91ec724f1c30af5b6d570d73e76689c8 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Mon, 3 Oct 2016 18:08:34 +0200 -Subject: [PATCH] IMXCODEC: Honour forced aspect ratio hint - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 6 +++++- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 1 + - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 9b7a9ea..ac2ad8d 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -546,6 +546,8 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri - #endif - - m_warnOnce = true; -+ m_forcedWidthHeightRatio = m_hints.forced_aspect ? (65536 * m_hints.aspect) : 0; -+ - switch(m_hints.codec) - { - case AV_CODEC_ID_MPEG1VIDEO: -@@ -1160,7 +1162,9 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture) - pDvdVideoPicture->iWidth = pDvdVideoPicture->IMXBuffer->m_pctWidth; - pDvdVideoPicture->iHeight = pDvdVideoPicture->IMXBuffer->m_pctHeight; - -- pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * m_frameInfo.pExtInfo->nQ16ShiftWidthDivHeightRatio) + 32767) >> 16; -+ int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : m_frameInfo.pExtInfo->nQ16ShiftWidthDivHeightRatio; -+ -+ pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * ratio) + 32767) >> 16; - pDvdVideoPicture->iDisplayHeight = pDvdVideoPicture->iHeight; - - pDvdVideoPicture->pts = pDvdVideoPicture->IMXBuffer->GetPts(); -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index fdac8ec..3d26a50 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -380,6 +380,7 @@ protected: - int m_codecControlFlags; - CCriticalSection m_signalLock; - CCriticalSection m_queuesLock; -+ int m_forcedWidthHeightRatio; - #ifdef DUMP_STREAM - FILE *m_dump; - #endif --- -1.9.1 - - -============================================================== -file 0037-IMXCODEC-Cleanup-mediainfo-logging.patch -============================================================== - -From 2ca3bdccc4f4723297a51abb1dbe09b97d7115d0 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Mon, 3 Oct 2016 18:11:31 +0200 -Subject: [PATCH] IMXCODEC: Cleanup mediainfo logging - ---- - .../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 52 +++++++++++----------- - 1 file changed, 26 insertions(+), 26 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index ac2ad8d..810537f 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -506,8 +506,6 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri - } - - m_hints = hints; -- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "Let's decode with iMX VPU\n"); - - int param = 0; - SetVPUParams(VPU_DEC_CONF_INPUTTYPE, ¶m); -@@ -516,32 +514,31 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri - #ifdef MEDIAINFO - if (g_advancedSettings.CanLogComponent(LOGVIDEO)) - { -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: CodecID %d \n", m_hints.codec); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: StreamType %d \n", m_hints.type); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Level %d \n", m_hints.level); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Profile %d \n", m_hints.profile); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: PTS_invalid %d \n", m_hints.ptsinvalid); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag %d \n", m_hints.codec_tag); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %dx%d \n", m_hints.width, m_hints.height); -- } -- { char str_tag[128]; av_get_codec_tag_string(str_tag, sizeof(str_tag), m_hints.codec_tag); -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: Tag fourcc %s\n", str_tag); -- } -- if (m_hints.extrasize) -- { -- char buf[4096]; -+ CLog::Log(LOGNOTICE, "MEDIAINFO: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: CodecID %d\n", m_hints.codec); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: StreamType %d\n", m_hints.type); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: Level %d\n", m_hints.level); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: Profile %d\n", m_hints.profile); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: PTS_invalid %d\n", m_hints.ptsinvalid); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: Tag %d\n", m_hints.codec_tag); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: %dx%d\n", m_hints.width, m_hints.height); - -- for (unsigned int i=0; i < m_hints.extrasize; i++) -- sprintf(buf+i*2, "%02x", ((uint8_t*)m_hints.extradata)[i]); -+ char str_tag[128]; -+ av_get_codec_tag_string(str_tag, sizeof(str_tag), m_hints.codec_tag); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: Tag fourcc %s\n", str_tag); - -- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %s extradata %d %s\n", *(char*)m_hints.extradata == 1 ? "AnnexB" : "avcC", m_hints.extrasize, buf); -- } -- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -- { -- CLog::Log(LOGDEBUG, "Decode: MEDIAINFO: %d / %d \n", m_hints.width, m_hints.height); -- CLog::Log(LOGDEBUG, "Decode: aspect %f - forced aspect %d\n", m_hints.aspect, m_hints.forced_aspect); -+ if (m_hints.extrasize) -+ { -+ char buf[4096]; -+ -+ for (unsigned int i=0; i < m_hints.extrasize; i++) -+ sprintf(buf+i*2, "%02x", ((uint8_t*)m_hints.extradata)[i]); -+ -+ CLog::Log(LOGNOTICE, "MEDIAINFO: %s extradata %d %s\n", *(char*)m_hints.extradata == 1 ? "AnnexB" : "avcC", m_hints.extrasize, buf); -+ } -+ -+ CLog::Log(LOGNOTICE, "MEDIAINFO: %d / %d\n", m_hints.width, m_hints.height); -+ CLog::Log(LOGNOTICE, "MEDIAINFO: aspect %f - forced_aspect %d\n", m_hints.aspect, m_hints.forced_aspect); - } - #endif - -@@ -634,6 +631,9 @@ bool CIMXCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options, std::stri - return false; - } - -+ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) -+ CLog::Log(LOGNOTICE, "Let's decode with iMX VPU\n"); -+ - std::list deintMethods({ EINTERLACEMETHOD::VS_INTERLACEMETHOD_AUTO, - EINTERLACEMETHOD::VS_INTERLACEMETHOD_RENDER_BOB }); - --- -1.9.1 - - -============================================================== -file 0038-IMXCODEC-Remove-m_frameInfo-member-variable-from-CIM.patch -============================================================== - -From 9a21a0256d49f2f9d44a08d077ef2dbc393161f6 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 1 Jan 2017 11:15:09 +0100 -Subject: [PATCH] IMXCODEC: Remove m_frameInfo member variable from CIMXCodec - class - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 10 ++++++---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 2 +- - 2 files changed, 7 insertions(+), 5 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 810537f..ee7178a 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -855,6 +855,7 @@ void CIMXCodec::AddExtraData(VpuBufferNode *bn, bool force) - void CIMXCodec::Process() - { - VpuDecFrameLengthInfo frameLengthInfo; -+ VpuDecOutFrameInfo frameInfo; - VpuBufferNode inData; - VpuBufferNode dummy; - VpuDecRetCode ret; -@@ -1002,16 +1003,16 @@ void CIMXCodec::Process() - if (!VPU_DecGetConsumedFrameInfo(m_vpuHandle, &frameLengthInfo) && frameLengthInfo.pFrame) - m_pts[frameLengthInfo.pFrame] = task->demux.pts; - -- if (m_decRet & CLASS_PICTURE && getOutputFrame(&m_frameInfo)) -+ if (m_decRet & CLASS_PICTURE && getOutputFrame(&frameInfo)) - { - ++m_nrOut; -- CDVDVideoCodecIMXBuffer *buffer = new CDVDVideoCodecIMXBuffer(&m_frameInfo, m_fps, m_decOpenParam.nMapType); -+ CDVDVideoCodecIMXBuffer *buffer = new CDVDVideoCodecIMXBuffer(&frameInfo, m_fps, m_decOpenParam.nMapType); - - /* quick & dirty fix to get proper timestamping for VP8 codec */ - if (m_decOpenParam.CodecFormat == VPU_V_VP8) - buffer->SetPts(task->demux.pts); - else -- buffer->SetPts(m_pts[m_frameInfo.pDisplayFrameBuf]); -+ buffer->SetPts(m_pts[frameInfo.pDisplayFrameBuf]); - - buffer->SetDts(task->demux.dts); - -@@ -1162,7 +1163,7 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture) - pDvdVideoPicture->iWidth = pDvdVideoPicture->IMXBuffer->m_pctWidth; - pDvdVideoPicture->iHeight = pDvdVideoPicture->IMXBuffer->m_pctHeight; - -- int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : m_frameInfo.pExtInfo->nQ16ShiftWidthDivHeightRatio; -+ int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : pDvdVideoPicture->IMXBuffer->m_widthHeightRatio; - - pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * ratio) + 32767) >> 16; - pDvdVideoPicture->iDisplayHeight = pDvdVideoPicture->iHeight; -@@ -1196,6 +1197,7 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, - { - m_pctWidth = frameInfo->pExtInfo->FrmCropRect.nRight - frameInfo->pExtInfo->FrmCropRect.nLeft; - m_pctHeight = frameInfo->pExtInfo->FrmCropRect.nBottom - frameInfo->pExtInfo->FrmCropRect.nTop; -+ m_widthHeightRatio = frameInfo->pExtInfo->nQ16ShiftWidthDivHeightRatio; - - // Some codecs (VC1?) lie about their frame size (mod 16). Adjust... - iWidth = (((frameInfo->pExtInfo->nFrmWidth) + 15) & ~15); -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index 3d26a50..aeb1692 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -268,6 +268,7 @@ public: - protected: - unsigned int m_pctWidth; - unsigned int m_pctHeight; -+ int m_widthHeightRatio; - - private: - double m_pts; -@@ -374,7 +375,6 @@ protected: - std::unordered_map - m_pts; - double m_lastPTS; -- VpuDecOutFrameInfo m_frameInfo; // Store last VPU output frame info - CBitstreamConverter *m_converter; // H264 annex B converter - bool m_warnOnce; // Track warning messages to only warn once - int m_codecControlFlags; --- -1.9.1 - - -============================================================== -file 0039-IMXCODEC-Add-enum-VPU_MAPTYPE.patch -============================================================== - -From 951095cdf14af35d0d2aefcd4122da1699075616 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 1 Jan 2017 11:32:11 +0100 -Subject: [PATCH] IMXCODEC: Add enum VPU_MAPTYPE - ---- - .../cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 14 +++++++------- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 9 ++++++++- - 2 files changed, 15 insertions(+), 8 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index ee7178a..3e77132 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -780,7 +780,7 @@ int CIMXCodec::Decode(BYTE *pData, int iSize, double dts, double pts) - else - m_fps = 60; - -- m_decOpenParam.nMapType = 1; -+ m_decOpenParam.nMapType = MAPTYPE_TILED_FRAME; - - ptrn.Flush(); - g_IMXCodec->Create(); -@@ -968,9 +968,9 @@ void CIMXCodec::Process() - if (!VpuFreeBuffers(false) || !VpuAllocFrameBuffers()) - ExitError("VPU error while registering frame buffers"); - -- if (m_initInfo.nInterlace && m_fps >= 49 && m_decOpenParam.nMapType == 1) -+ if (m_initInfo.nInterlace && m_fps >= 49 && m_decOpenParam.nMapType == MAPTYPE_TILED_FRAME) - { -- m_decOpenParam.nMapType = 0; -+ m_decOpenParam.nMapType = MAPTYPE_LINEAR_FRAME; - Dispose(); - VpuOpen(); - continue; -@@ -1188,7 +1188,7 @@ bool CIMXCodec::IsCurrentThread() const - } - - /*******************************************/ --CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int map) -+CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int mapType) - : m_dts(DVD_NOPTS_VALUE) - , m_fieldType(frameInfo->eFieldType) - , m_frameBuffer(frameInfo->pDisplayFrameBuf) -@@ -1209,9 +1209,9 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, - #ifdef IMX_INPUT_FORMAT_I420 - iFormat = _4CC('I', '4', '2', '0'); - #else -- iFormat = map == 1 ? _4CC('T', 'N', 'V', 'P'): -- map == 0 ? _4CC('N', 'V', '1', '2'): -- _4CC('T', 'N', 'V', 'F'); -+ iFormat = mapType == MAPTYPE_TILED_FRAME ? _4CC('T', 'N', 'V', 'P'): -+ mapType == MAPTYPE_LINEAR_FRAME ? _4CC('N', 'V', '1', '2'): -+ _4CC('T', 'N', 'V', 'F'); - #endif - m_fps = fps; - #if defined(IMX_PROFILE) || defined(IMX_PROFILE_BUFFERS) || defined(TRACE_FRAMES) -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index aeb1692..22da54d 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -84,6 +84,13 @@ enum RENDER_TASK - RENDER_TASK_CAPTURE = -2, - }; - -+enum VPU_MAPTYPE -+{ -+ MAPTYPE_LINEAR_FRAME = 0, -+ MAPTYPE_TILED_FRAME = 1, -+ MAPTYPE_TILED_FIELD = 2, -+}; -+ - #define CLASS_PICTURE (VPU_DEC_OUTPUT_DIS | VPU_DEC_OUTPUT_MOSAIC_DIS) - #define CLASS_NOBUF (VPU_DEC_OUTPUT_NODIS | VPU_DEC_NO_ENOUGH_BUF | VPU_DEC_OUTPUT_REPEAT) - #define CLASS_FORCEBUF (VPU_DEC_OUTPUT_EOS | VPU_DEC_NO_ENOUGH_INBUF) -@@ -244,7 +251,7 @@ class CDVDVideoCodecIMXBuffer : public CIMXBuffer - friend class CIMXCodec; - friend class CIMXContext; - public: -- CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int map); -+ CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int mapType); - virtual ~CDVDVideoCodecIMXBuffer(); - - // reference counting --- -1.9.1 - - -============================================================== -file 0040-IMXCODEC-Prevent-lkFIFO-from-returning-uninitialized.patch -============================================================== - -From c458ee2820562d7f7e6d015a6ff25c7ef126bb88 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 1 Jan 2017 11:47:08 +0100 -Subject: [PATCH] IMXCODEC: Prevent lkFIFO from returning uninitialized data - ---- - .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp | 15 +++++++++++---- - xbmc/linux/imx/IMX.h | 16 ++++++++-------- - 2 files changed, 19 insertions(+), 12 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 3e77132..773c878 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -889,7 +889,7 @@ void CIMXCodec::Process() - { - RecycleFrameBuffers(); - SAFE_DELETE(task); -- if (!(task = m_decInput.pop())) -+ if (!m_decInput.pop(task)) - task = new VPUTask(); - - #if defined(IMX_PROFILE) || defined(IMX_PROFILE_BUFFERS) -@@ -1048,7 +1048,11 @@ void CIMXCodec::Process() - - if (m_decRet & VPU_DEC_NO_ENOUGH_BUF && m_decOutput.size()) - { -- m_decOutput.pop()->Release(); -+ CDVDVideoCodecIMXBuffer *buffer; -+ -+ if (m_decOutput.pop(buffer)) -+ buffer->Release(); -+ - FlushVPU(); - continue; - } -@@ -1124,8 +1128,11 @@ void CIMXCodec::ExitError(const char *msg, ...) - - bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture) - { -- pDvdVideoPicture->IMXBuffer = m_decOutput.pop(); -- assert(pDvdVideoPicture->IMXBuffer); -+ if (!m_decOutput.pop(pDvdVideoPicture->IMXBuffer)) -+ { -+ memset(pDvdVideoPicture, 0, sizeof(*pDvdVideoPicture)); -+ return false; -+ } - - #ifdef IMX_PROFILE - static unsigned int previous = 0; -diff --git a/xbmc/linux/imx/IMX.h b/xbmc/linux/imx/IMX.h -index 2bc6761..201c1e9 100644 ---- a/xbmc/linux/imx/IMX.h -+++ b/xbmc/linux/imx/IMX.h -@@ -79,23 +79,22 @@ public: - lkFIFO() { m_size = queue.max_size(); queue.clear(); m_abort = false; } - - public: -- T pop() -+ bool pop(T &item) - { - std::unique_lock m_lock(lkqueue); - m_abort = false; - while (!queue.size() && !m_abort) - read.wait(m_lock); - -- T val; -- if (!queue.empty()) -- { -- val = queue.front(); -- queue.pop_front(); -- } -+ if (queue.empty()) -+ return false; -+ -+ item = queue.front(); -+ queue.pop_front(); - - m_lock.unlock(); - write.notify_one(); -- return val; -+ return true; - } - - bool push(const T& item) -@@ -109,6 +108,7 @@ public: - return false; - - queue.push_back(item); -+ - m_lock.unlock(); - read.notify_one(); - return true; --- -1.9.1 - - -============================================================== -file 0041-IMXCODEC-Cleanup-IMXBuffer-classes.patch -============================================================== - -From abe53ea7362fe251b9cfc7e814dd78b7b06089b9 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 1 Jan 2017 17:23:23 +0100 -Subject: [PATCH] IMXCODEC: Cleanup IMXBuffer classes - ---- - .../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 38 +++++++++++++--------- - .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 13 ++++---- - xbmc/linux/imx/IMX.h | 2 -- - 3 files changed, 29 insertions(+), 24 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 773c878..d498b45 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -1128,7 +1128,9 @@ void CIMXCodec::ExitError(const char *msg, ...) - - bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture) - { -- if (!m_decOutput.pop(pDvdVideoPicture->IMXBuffer)) -+ CDVDVideoCodecIMXBuffer *pBuffer; -+ -+ if (!m_decOutput.pop(pBuffer)) - { - memset(pDvdVideoPicture, 0, sizeof(*pDvdVideoPicture)); - return false; -@@ -1139,9 +1141,9 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture) - unsigned int current; - - current = XbmcThreads::SystemClockMillis(); -- CLog::Log(LOGDEBUG, "+G 0x%x %f/%f tm:%03d : Interlaced 0x%x\n", pDvdVideoPicture->IMXBuffer->GetIdx(), -- recalcPts(pDvdVideoPicture->IMXBuffer->GetDts()), recalcPts(pDvdVideoPicture->IMXBuffer->GetPts()), current - previous, -- m_initInfo.nInterlace ? pDvdVideoPicture->IMXBuffer->GetFieldType() : 0); -+ CLog::Log(LOGDEBUG, "+G 0x%x %f/%f tm:%03d : Interlaced 0x%x\n", pBuffer->GetIdx(), -+ recalcPts(pBuffer->GetDts()), recalcPts(pBuffer->GetPts()), current - previous, -+ m_initInfo.nInterlace ? pBuffer->GetFieldType() : 0); - previous = current; - #endif - -@@ -1151,35 +1153,37 @@ bool CIMXCodec::GetPicture(DVDVideoPicture* pDvdVideoPicture) - ++m_dropped; - } - else -- pDvdVideoPicture->iFlags = pDvdVideoPicture->IMXBuffer->GetFlags(); -+ pDvdVideoPicture->iFlags = pBuffer->GetFlags(); - - if (m_initInfo.nInterlace) - { -- if (pDvdVideoPicture->IMXBuffer->GetFieldType() == VPU_FIELD_NONE && m_warnOnce) -+ if (pBuffer->GetFieldType() == VPU_FIELD_NONE && m_warnOnce) - { - m_warnOnce = false; - CLog::Log(LOGWARNING, "Interlaced content reported by VPU, but full frames detected - Please turn off deinterlacing manually."); - } -- else if (pDvdVideoPicture->IMXBuffer->GetFieldType() == VPU_FIELD_TB || pDvdVideoPicture->IMXBuffer->GetFieldType() == VPU_FIELD_TOP) -+ else if (pBuffer->GetFieldType() == VPU_FIELD_TB || pBuffer->GetFieldType() == VPU_FIELD_TOP) - pDvdVideoPicture->iFlags |= DVP_FLAG_TOP_FIELD_FIRST; - - pDvdVideoPicture->iFlags |= DVP_FLAG_INTERLACED; - } - - pDvdVideoPicture->format = RENDER_FMT_IMXMAP; -- pDvdVideoPicture->iWidth = pDvdVideoPicture->IMXBuffer->m_pctWidth; -- pDvdVideoPicture->iHeight = pDvdVideoPicture->IMXBuffer->m_pctHeight; -+ pDvdVideoPicture->iWidth = pBuffer->GetPictureWidth(); -+ pDvdVideoPicture->iHeight = pBuffer->GetPictureHeight(); - -- int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : pDvdVideoPicture->IMXBuffer->m_widthHeightRatio; -+ int ratio = m_forcedWidthHeightRatio ? m_forcedWidthHeightRatio : pBuffer->GetWidthHeightRatio(); - - pDvdVideoPicture->iDisplayWidth = ((pDvdVideoPicture->iWidth * ratio) + 32767) >> 16; - pDvdVideoPicture->iDisplayHeight = pDvdVideoPicture->iHeight; - -- pDvdVideoPicture->pts = pDvdVideoPicture->IMXBuffer->GetPts(); -- pDvdVideoPicture->dts = pDvdVideoPicture->IMXBuffer->GetDts(); -+ pDvdVideoPicture->pts = pBuffer->GetPts(); -+ pDvdVideoPicture->dts = pBuffer->GetDts(); - - if (pDvdVideoPicture->iFlags & DVP_FLAG_DROPPED) -- SAFE_RELEASE(pDvdVideoPicture->IMXBuffer); -+ SAFE_RELEASE(pBuffer); -+ -+ pDvdVideoPicture->IMXBuffer = pBuffer; - - return true; - } -@@ -1229,15 +1233,17 @@ CDVDVideoCodecIMXBuffer::CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, - - void CDVDVideoCodecIMXBuffer::Lock() - { -- long count = ++m_iRefs; - #ifdef TRACE_FRAMES -- CLog::Log(LOGDEBUG, "R+ 0x%x - ref : %ld (VPU)\n", m_idx, count); -+ CLog::Log(LOGDEBUG, "R+ 0x%x - ref : %ld (VPU)\n", m_idx, ++m_iRefs); -+#else -+ ++m_iRefs; - #endif - } - - long CDVDVideoCodecIMXBuffer::Release() - { - long count = --m_iRefs; -+ - #ifdef TRACE_FRAMES - CLog::Log(LOGDEBUG, "R- 0x%x - ref : %ld (VPU)\n", m_idx, count); - #endif -@@ -1803,7 +1809,7 @@ bool CIMXContext::TileTask(IPUTaskPtr &ipu) - return false; - } - -- ((CDVDVideoCodecIMXBuffer*)ipu->current)->m_convBuffer = conv; -+ ((CDVDVideoCodecIMXBuffer*)ipu->current)->SetConvBuffer(conv); - vdoa.output.paddr = conv->buf_paddr; - } - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index 22da54d..91f9b8c 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -248,8 +248,6 @@ public: - // Base class of IMXVPU and IMXIPU buffer - class CDVDVideoCodecIMXBuffer : public CIMXBuffer - { --friend class CIMXCodec; --friend class CIMXContext; - public: - CDVDVideoCodecIMXBuffer(VpuDecOutFrameInfo *frameInfo, double fps, int mapType); - virtual ~CDVDVideoCodecIMXBuffer(); -@@ -272,12 +270,16 @@ public: - #endif - VpuFieldType GetFieldType() const { return m_fieldType; } - --protected: -+ unsigned int GetPictureWidth() { return m_pctWidth; } -+ unsigned int GetPictureHeight() { return m_pctHeight; } -+ int GetWidthHeightRatio() { return m_widthHeightRatio; } -+ -+ void SetConvBuffer(struct g2d_buf *b) { m_convBuffer = b; } -+ -+private: - unsigned int m_pctWidth; - unsigned int m_pctHeight; - int m_widthHeightRatio; -- --private: - double m_pts; - double m_dts; - VpuFieldType m_fieldType; -@@ -288,7 +290,6 @@ private: - static unsigned char i; - #endif - --public: - struct g2d_buf *m_convBuffer; - }; - -diff --git a/xbmc/linux/imx/IMX.h b/xbmc/linux/imx/IMX.h -index 201c1e9..50c1cdb 100644 ---- a/xbmc/linux/imx/IMX.h -+++ b/xbmc/linux/imx/IMX.h -@@ -177,8 +177,6 @@ public: - virtual void Lock() = 0; - virtual long Release() = 0; - -- int GetFormat() { return iFormat; } -- - public: - uint32_t iWidth; - uint32_t iHeight; --- -1.9.1 - - -============================================================== -file 0042-IMXRender-Refactor-to-improve-readability-and-perfor.patch -============================================================== - -From bc3d7cdaaeb4e6c532672f65d27509f312eff21e Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 1 Jan 2017 17:56:17 +0100 -Subject: [PATCH] IMXRender: Refactor to improve readability and performance - ---- - .../VideoRenderers/HwDecRender/RendererIMX.cpp | 29 ++++++++++------------ - .../VideoRenderers/HwDecRender/RendererIMX.h | 5 ++-- - 2 files changed, 15 insertions(+), 19 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp -index b5c7095..5167bd2 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp -@@ -34,13 +34,14 @@ - - CRendererIMX::CRendererIMX() - { -- m_bufHistory.clear(); -+ m_bufHistory[0] = m_bufHistory[1] = nullptr; - } - - CRendererIMX::~CRendererIMX() - { - UnInit(); -- std::for_each(m_bufHistory.begin(), m_bufHistory.end(), Release); -+ SAFE_RELEASE(m_bufHistory[1]); -+ SAFE_RELEASE(m_bufHistory[0]); - g_IMX.Deinitialize(); - } - -@@ -139,12 +140,7 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) - CDVDVideoCodecIMXBuffer *buffer = static_cast(m_buffers[m_iYV12RenderBuffer].hwDec); - if (buffer) - { -- if (!m_bufHistory.empty() && m_bufHistory.back() != buffer || m_bufHistory.empty()) -- { -- buffer->Lock(); -- m_bufHistory.push_back(buffer); -- } -- else if (!m_bufHistory.empty() && m_bufHistory.back() == buffer && flagsPrev == flags) -+ if (buffer == m_bufHistory[0] && flagsPrev == flags) - { - g_IMX.WaitVsync(); - return true; -@@ -152,12 +148,14 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) - - flagsPrev = flags; - -- int size = flags & RENDER_FLAG_FIELDMASK ? 2 : 1; -- while (m_bufHistory.size() > size) -- { -- m_bufHistory.front()->Release(); -- m_bufHistory.pop_front(); -- } -+ buffer->Lock(); -+ -+ SAFE_RELEASE(m_bufHistory[1]); -+ m_bufHistory[1] = m_bufHistory[0]; -+ m_bufHistory[0] = buffer; -+ -+ if (!(flags & RENDER_FLAG_FIELDMASK)) -+ SAFE_RELEASE(m_bufHistory[1]); - - // this hack is needed to get the 2D mode of a 3D movie going - RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode(); -@@ -206,8 +204,7 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) - } - } - -- CDVDVideoCodecIMXBuffer *buffer_p = m_bufHistory.front(); -- g_IMXContext.Blit(buffer_p == buffer ? nullptr : buffer_p, buffer, srcRect, dstRect, fieldFmt); -+ g_IMXContext.Blit(m_bufHistory[1], m_bufHistory[0], srcRect, dstRect, fieldFmt); - } - - #if 0 -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h -index fc71e89..1a1ee2c 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.h -@@ -30,6 +30,8 @@ - - class CRendererIMX : public CLinuxRendererGLES - { -+ CDVDVideoCodecIMXBuffer *m_bufHistory[2]; -+ - public: - CRendererIMX(); - virtual ~CRendererIMX(); -@@ -61,9 +63,6 @@ protected: - virtual bool RenderHook(int index); - virtual int GetImageHook(YV12Image *image, int source = AUTOSOURCE, bool readonly = false); - virtual bool RenderUpdateVideoHook(bool clear, DWORD flags = 0, DWORD alpha = 255); -- -- std::deque m_bufHistory; -- static void Release(CDVDVideoCodecIMXBuffer *&t) { if (t) t->Release(); } - }; - - #endif --- -1.9.1 - - -============================================================== -file 0043-IMXCODEC-Refactor-IPUTask-for-better-readability-and.patch -============================================================== - -From 4228f95268bf1c9b1f4dec483914ee32f2f0b621 Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Mon, 2 Jan 2017 09:20:05 +0100 -Subject: [PATCH] IMXCODEC: Refactor IPUTask for better readability and - performance - ---- - .../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 168 ++++++++++----------- - .../VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h | 28 ++-- - 2 files changed, 95 insertions(+), 101 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index d498b45..6b0e2ee 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -1588,23 +1588,23 @@ void CIMXContext::Blit(CIMXBuffer *source_p, CIMXBuffer *source, const CRect &sr - else if (page < 0 || page >= m_fbPages) - return; - -- IPUTaskPtr ipu(new IPUTask(source_p, source, page)); -+ IPUTask task(source_p, source, page); - pg = (page + 1) % m_fbPages; - - #ifdef IMX_PROFILE_BUFFERS - unsigned long long before = XbmcThreads::SystemClockMillis(); - #endif - SetFieldData(fieldFmt, source->m_fps); -- PrepareTask(ipu, srcRect, dstRect); -+ PrepareTask(task, srcRect, dstRect); - -- if (DoTask(ipu)) -- m_fbCurrentPage = ipu->page | checkIPUStrideOffset(&ipu->task.input.deinterlace, IsDoubleRate()) << 4; -+ if (DoTask(task)) -+ m_fbCurrentPage = task.targetPage | checkIPUStrideOffset(&task.input.deinterlace, IsDoubleRate()) << 4; - - m_pingFlip.Set(); - - #ifdef IMX_PROFILE_BUFFERS - unsigned long long after = XbmcThreads::SystemClockMillis(); -- CLog::Log(LOGDEBUG, "+P 0x%x@%d %d\n", ((CDVDVideoCodecIMXBuffer*)ipu->current)->GetIdx(), ipu->page, (int)(after-before)); -+ CLog::Log(LOGDEBUG, "+P 0x%x@%d %d\n", ((CDVDVideoCodecIMXBuffer*)task.currBuf)->GetIdx(), task.targetPage, (int)(after-before)); - #endif - } - -@@ -1676,7 +1676,7 @@ void CIMXContext::Clear(int page) - SetProcessInfo(m_processInfo); - } - --void CIMXContext::PrepareTask(IPUTaskPtr &ipu, CRect srcRect, CRect dstRect) -+void CIMXContext::PrepareTask(IPUTask &task, CRect srcRect, CRect dstRect) - { - CRectInt iSrcRect, iDstRect; - -@@ -1721,95 +1721,95 @@ void CIMXContext::PrepareTask(IPUTaskPtr &ipu, CRect srcRect, CRect dstRect) - iDstRect.x2 = Align2((int)dstRect.x2,8); - iDstRect.y2 = Align2((int)dstRect.y2,8); - -- ipu->task.input.crop.pos.x = iSrcRect.x1; -- ipu->task.input.crop.pos.y = iSrcRect.y1; -- ipu->task.input.crop.w = iSrcRect.Width(); -- ipu->task.input.crop.h = iSrcRect.Height(); -+ task.input.crop.pos.x = iSrcRect.x1; -+ task.input.crop.pos.y = iSrcRect.y1; -+ task.input.crop.w = iSrcRect.Width(); -+ task.input.crop.h = iSrcRect.Height(); - -- ipu->task.output.crop.pos.x = iDstRect.x1; -- ipu->task.output.crop.pos.y = iDstRect.y1; -- ipu->task.output.crop.w = iDstRect.Width(); -- ipu->task.output.crop.h = iDstRect.Height(); -+ task.output.crop.pos.x = iDstRect.x1; -+ task.output.crop.pos.y = iDstRect.y1; -+ task.output.crop.w = iDstRect.Width(); -+ task.output.crop.h = iDstRect.Height(); - - // Setup deinterlacing if enabled - if (m_currentFieldFmt) - { -- ipu->task.input.deinterlace.enable = 1; -- ipu->task.input.deinterlace.motion = ipu->previous ? m_motion : HIGH_MOTION; -- ipu->task.input.deinterlace.field_fmt = m_currentFieldFmt; -+ task.input.deinterlace.enable = 1; -+ task.input.deinterlace.motion = task.prevBuf ? m_motion : HIGH_MOTION; -+ task.input.deinterlace.field_fmt = m_currentFieldFmt; - } - } - --bool CIMXContext::TileTask(IPUTaskPtr &ipu) -+bool CIMXContext::TileTask(IPUTask &task) - { - m_zoomAllowed = true; - - // on double rate deinterlacing this is reusing previous already rasterised frame -- if (ipu->current->iFormat != _4CC('T', 'N', 'V', 'F') && ipu->current->iFormat != _4CC('T', 'N', 'V', 'P')) -+ if (task.currBuf->iFormat != _4CC('T', 'N', 'V', 'F') && task.currBuf->iFormat != _4CC('T', 'N', 'V', 'P')) - { -- if (ipu->task.input.deinterlace.enable && ipu->task.input.deinterlace.motion != HIGH_MOTION) -+ if (task.input.deinterlace.enable && task.input.deinterlace.motion != HIGH_MOTION) - { -- ipu->task.input.paddr_n = ipu->task.input.paddr; -- ipu->task.input.paddr = ipu->previous->pPhysAddr; -+ task.input.paddr_n = task.input.paddr; -+ task.input.paddr = task.prevBuf->pPhysAddr; - } - return true; - } - - // Use band mode directly to FB, as no transformations needed (eg cropping) -- if (m_fps >= 49 && m_fbWidth == 1920 && ipu->task.input.width == 1920 && !ipu->task.input.deinterlace.enable) -+ if (m_fps >= 49 && m_fbWidth == 1920 && task.input.width == 1920 && !task.input.deinterlace.enable) - { - m_zoomAllowed = false; -- ipu->task.output.crop.pos.x = ipu->task.input.crop.pos.x = 0; -- ipu->task.output.crop.pos.y = ipu->task.input.crop.pos.y = 0; -- ipu->task.output.crop.h = ipu->task.input.height = ipu->task.input.crop.h = ipu->current->iHeight; -- ipu->task.output.crop.w = ipu->task.input.width = ipu->task.input.crop.w = ipu->current->iWidth; -- if (ipu->task.input.crop.h < m_fbHeight) -- ipu->task.output.paddr += m_fbLineLength * (m_fbHeight - ipu->task.input.crop.h)/2; -+ task.output.crop.pos.x = task.input.crop.pos.x = 0; -+ task.output.crop.pos.y = task.input.crop.pos.y = 0; -+ task.output.crop.h = task.input.height = task.input.crop.h = task.currBuf->iHeight; -+ task.output.crop.w = task.input.width = task.input.crop.w = task.currBuf->iWidth; -+ if (task.input.crop.h < m_fbHeight) -+ task.output.paddr += m_fbLineLength * (m_fbHeight - task.input.crop.h)/2; - return true; - } - - // check for 3-field deinterlace (no HIGH_MOTION allowed) from tile field format -- if (ipu->previous && ipu->current->iFormat == _4CC('T', 'N', 'V', 'F')) -+ if (task.prevBuf && task.currBuf->iFormat == _4CC('T', 'N', 'V', 'F')) - { -- ipu->task.input.paddr = ipu->previous->pPhysAddr; -- ipu->task.input.paddr_n = ipu->current->pPhysAddr; -- ipu->task.input.deinterlace.field_fmt = IPU_DEINTERLACE_FIELD_TOP; -- ipu->task.input.deinterlace.enable = true; -+ task.input.paddr = task.prevBuf->pPhysAddr; -+ task.input.paddr_n = task.currBuf->pPhysAddr; -+ task.input.deinterlace.field_fmt = IPU_DEINTERLACE_FIELD_TOP; -+ task.input.deinterlace.enable = true; - -- ipu->task.output.crop.pos.x = ipu->task.input.crop.pos.x = 0; -- ipu->task.output.crop.pos.y = ipu->task.input.crop.pos.y = 0; -- ipu->task.output.crop.h = ipu->task.input.height = ipu->task.input.crop.h = ipu->current->iHeight; -- ipu->task.output.crop.w = ipu->task.input.width = ipu->task.input.crop.w = ipu->current->iWidth; -+ task.output.crop.pos.x = task.input.crop.pos.x = 0; -+ task.output.crop.pos.y = task.input.crop.pos.y = 0; -+ task.output.crop.h = task.input.height = task.input.crop.h = task.currBuf->iHeight; -+ task.output.crop.w = task.input.width = task.input.crop.w = task.currBuf->iWidth; - -- return CheckTask(ipu) == 0; -+ return CheckTask(task) == 0; - } - - // rasterize from tile (frame) - struct ipu_task vdoa; - -- memset(&vdoa, 0, sizeof(ipu->task)); -- vdoa.input.width = vdoa.output.width = ipu->current->iWidth; -- vdoa.input.height = vdoa.output.height = ipu->current->iHeight; -- vdoa.input.format = ipu->current->iFormat; -+ memset(&vdoa, 0, sizeof(vdoa)); -+ vdoa.input.width = vdoa.output.width = task.currBuf->iWidth; -+ vdoa.input.height = vdoa.output.height = task.currBuf->iHeight; -+ vdoa.input.format = task.currBuf->iFormat; - -- vdoa.input.paddr = vdoa.input.paddr_n ? ipu->previous->pPhysAddr : ipu->current->pPhysAddr; -- vdoa.output.format = ipu->task.input.format = m_fbVar.bits_per_pixel == 16 ? _4CC('Y', 'U', 'Y', 'V') : _4CC('N', 'V', '1', '2'); -+ vdoa.input.paddr = vdoa.input.paddr_n ? task.prevBuf->pPhysAddr : task.currBuf->pPhysAddr; -+ vdoa.output.format = task.input.format = m_fbVar.bits_per_pixel == 16 ? _4CC('Y', 'U', 'Y', 'V') : _4CC('N', 'V', '1', '2'); - -- int check = CheckTask(ipu); -+ int check = CheckTask(task); - if (check == IPU_CHECK_ERR_PROC_NO_NEED) - { -- vdoa.output.paddr = ipu->task.output.paddr; -+ vdoa.output.paddr = task.output.paddr; - } - else - { -- struct g2d_buf *conv = g2d_alloc(ipu->current->iWidth *ipu->current->iHeight * 3, 0); -+ struct g2d_buf *conv = g2d_alloc(task.currBuf->iWidth *task.currBuf->iHeight * 3, 0); - if (!conv) - { - CLog::Log(LOGERROR, "iMX: can't allocate crop buffer"); - return false; - } - -- ((CDVDVideoCodecIMXBuffer*)ipu->current)->SetConvBuffer(conv); -+ ((CDVDVideoCodecIMXBuffer*)task.currBuf)->SetConvBuffer(conv); - vdoa.output.paddr = conv->buf_paddr; - } - -@@ -1820,50 +1820,50 @@ bool CIMXContext::TileTask(IPUTaskPtr &ipu) - return false; - } - -- ipu->task.input.paddr = vdoa.output.paddr; -+ task.input.paddr = vdoa.output.paddr; - -- if (ipu->current->iFormat == _4CC('T', 'N', 'V', 'F')) -+ if (task.currBuf->iFormat == _4CC('T', 'N', 'V', 'F')) - return true; - - // output of VDOA task was sent directly to FB. no more processing needed. - if (check == IPU_CHECK_ERR_PROC_NO_NEED) - return true; - -- if (ipu->task.input.deinterlace.enable && ipu->task.input.deinterlace.motion != HIGH_MOTION) -+ if (task.input.deinterlace.enable && task.input.deinterlace.motion != HIGH_MOTION) - { -- ipu->task.input.paddr_n = ipu->task.input.paddr; -- ipu->task.input.paddr = ipu->previous->pPhysAddr; -+ task.input.paddr_n = task.input.paddr; -+ task.input.paddr = task.prevBuf->pPhysAddr; - } -- ipu->current->iFormat = vdoa.output.format; -- ipu->current->pPhysAddr = vdoa.output.paddr; -+ task.currBuf->iFormat = vdoa.output.format; -+ task.currBuf->pPhysAddr = vdoa.output.paddr; - - return true; - } - --int CIMXContext::CheckTask(IPUTaskPtr &ipu) -+int CIMXContext::CheckTask(IPUTask &task) - { - //We really use IPU only if we have to deinterlace (using VDIC) - int ret = IPU_CHECK_ERR_INPUT_CROP; - while (ret > IPU_CHECK_ERR_MIN) - { -- ret = ioctl(m_ipuHandle, IPU_CHECK_TASK, &ipu->task); -+ ret = ioctl(m_ipuHandle, IPU_CHECK_TASK, &task); - switch (ret) - { - case IPU_CHECK_OK: - break; - case IPU_CHECK_ERR_SPLIT_INPUTW_OVER: -- ipu->task.input.crop.w -= 8; -+ task.input.crop.w -= 8; - break; - case IPU_CHECK_ERR_SPLIT_INPUTH_OVER: -- ipu->task.input.crop.h -= 8; -+ task.input.crop.h -= 8; - break; - case IPU_CHECK_ERR_SPLIT_OUTPUTW_OVER: -- ipu->task.output.width -= 8; -- ipu->task.output.crop.w = ipu->task.output.width; -+ task.output.width -= 8; -+ task.output.crop.w = task.output.width; - break; - case IPU_CHECK_ERR_SPLIT_OUTPUTH_OVER: -- ipu->task.output.height -= 8; -- ipu->task.output.crop.h = ipu->task.output.height; -+ task.output.height -= 8; -+ task.output.crop.h = task.output.height; - break; - // deinterlacing setup changing, m_ipuHandle is closed - case -1: -@@ -1879,41 +1879,41 @@ int CIMXContext::CheckTask(IPUTaskPtr &ipu) - return 0; - } - --bool CIMXContext::DoTask(IPUTaskPtr &ipu, CRect *dest) -+bool CIMXContext::DoTask(IPUTask &task, CRect *dest) - { - // Clear page if cropping changes -- CRectInt dstRect(ipu->task.output.crop.pos.x, ipu->task.output.crop.pos.y, -- ipu->task.output.crop.pos.x + ipu->task.output.crop.w, -- ipu->task.output.crop.pos.y + ipu->task.output.crop.h); -+ CRectInt dstRect(task.output.crop.pos.x, task.output.crop.pos.y, -+ task.output.crop.pos.x + task.output.crop.w, -+ task.output.crop.pos.y + task.output.crop.h); - - // Populate input block -- ipu->task.input.width = ipu->current->iWidth; -- ipu->task.input.height = ipu->current->iHeight; -- ipu->task.input.format = ipu->current->iFormat; -- ipu->task.input.paddr = ipu->current->pPhysAddr; -+ task.input.width = task.currBuf->iWidth; -+ task.input.height = task.currBuf->iHeight; -+ task.input.format = task.currBuf->iFormat; -+ task.input.paddr = task.currBuf->pPhysAddr; - -- ipu->task.output.width = m_fbWidth; -- ipu->task.output.height = m_fbHeight; -- ipu->task.output.format = m_fbVar.nonstd; -- ipu->task.output.paddr = m_fbPhysAddr + ipu->page*m_fbPageSize; -+ task.output.width = m_fbWidth; -+ task.output.height = m_fbHeight; -+ task.output.format = m_fbVar.nonstd; -+ task.output.paddr = m_fbPhysAddr + task.targetPage*m_fbPageSize; - -- if (m_pageCrops[ipu->page] != dstRect) -+ if (m_pageCrops[task.targetPage] != dstRect) - { -- m_pageCrops[ipu->page] = dstRect; -- Clear(ipu->page); -+ m_pageCrops[task.targetPage] = dstRect; -+ Clear(task.targetPage); - } - -- if ((ipu->task.input.crop.w <= 0) || (ipu->task.input.crop.h <= 0) -- || (ipu->task.output.crop.w <= 0) || (ipu->task.output.crop.h <= 0)) -+ if ((task.input.crop.w <= 0) || (task.input.crop.h <= 0) -+ || (task.output.crop.w <= 0) || (task.output.crop.h <= 0)) - return false; - -- if (!TileTask(ipu)) -+ if (!TileTask(task)) - return false; - -- if (CheckTask(ipu) == IPU_CHECK_ERR_PROC_NO_NEED) -+ if (CheckTask(task) == IPU_CHECK_ERR_PROC_NO_NEED) - return true; - -- int ret = ioctl(m_ipuHandle, IPU_QUEUE_TASK, &ipu->task); -+ int ret = ioctl(m_ipuHandle, IPU_QUEUE_TASK, &task); - if (ret < 0) - CLog::Log(LOGERROR, "IPU task failed: %s at #%d (ret %d)\n", strerror(errno), __LINE__, ret); - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -index 91f9b8c..5b56293 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.h -@@ -149,33 +149,27 @@ public: - static const int m_fbPages; - - private: -- struct IPUTask -+ struct IPUTask : public ipu_task - { -- IPUTask(CIMXBuffer *buffer_p, CIMXBuffer *buffer, int p = 0) -- : previous(buffer_p), current(buffer), page(p) -+ IPUTask(CIMXBuffer *buffer_p, CIMXBuffer *buffer, int page) -+ : prevBuf(buffer_p), currBuf(buffer), targetPage(page) - { -- memset(&task, 0, sizeof(task)); -+ memset(this, 0, sizeof(ipu_task)); - } - - // Kept for reference -- CIMXBuffer *previous; -- CIMXBuffer *current; -+ CIMXBuffer *prevBuf; -+ CIMXBuffer *currBuf; - -- // The actual task -- struct ipu_task task; -- -- unsigned int page; -- int shift = true; -+ unsigned int targetPage; - }; - -- typedef std::shared_ptr IPUTaskPtr; -- - bool GetFBInfo(const std::string &fbdev, struct fb_var_screeninfo *fbVar); - -- void PrepareTask(IPUTaskPtr &ipu, CRect srcRect, CRect dstRect); -- bool DoTask(IPUTaskPtr &ipu, CRect *dest = nullptr); -- bool TileTask(IPUTaskPtr &ipu); -- int CheckTask(IPUTaskPtr &ipu); -+ void PrepareTask(IPUTask &task, CRect srcRect, CRect dstRect); -+ bool DoTask(IPUTask &task, CRect *dest = nullptr); -+ bool TileTask(IPUTask &task); -+ int CheckTask(IPUTask &task); - - void SetFieldData(uint8_t fieldFmt, double fps); - --- -1.9.1 - - -============================================================== -file 0044-IMXCODEC-Fix-hang-on-exit-and-invalid-file-descripto.patch -============================================================== - -From 89ab2c4de60034d81df3c91a19f7e0e7522d1b5e Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Mon, 2 Jan 2017 22:23:24 +0100 -Subject: [PATCH] IMXCODEC: Fix hang on exit and invalid file descriptor - handling - ---- - .../DVDCodecs/Video/DVDVideoCodecIMX.cpp | 28 +++++++++++++--------- - 1 file changed, 17 insertions(+), 11 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -index 6b0e2ee..9436d4e 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp -@@ -1268,11 +1268,11 @@ CDVDVideoCodecIMXBuffer::~CDVDVideoCodecIMXBuffer() - - CIMXContext::CIMXContext() - : CThread("iMX IPU") -- , m_fbHandle(0) -+ , m_fbHandle(-1) - , m_fbCurrentPage(0) - , m_fbPhysAddr(0) - , m_fbVirtAddr(NULL) -- , m_ipuHandle(0) -+ , m_ipuHandle(-1) - , m_vsync(true) - , m_pageCrops(NULL) - , m_bFbIsConfigured(false) -@@ -1281,13 +1281,17 @@ CIMXContext::CIMXContext() - , m_deviceName("/dev/fb1") - { - m_pageCrops = new CRectInt[m_fbPages]; -+ m_processInfo = 0; - OpenDevices(); - } - - CIMXContext::~CIMXContext() - { -- Stop(false); -+ Stop(); - Dispose(); -+ -+ m_processInfo = 0; -+ Clear(-1); - CloseDevices(); - } - -@@ -1439,7 +1443,7 @@ bool CIMXContext::OpenDevices() - m_fbHandle = open(m_deviceName.c_str(), O_RDWR, 0); - OpenIPU(); - -- bool opened = m_fbHandle > 0 && m_ipuHandle > 0; -+ bool opened = m_fbHandle != -1 && m_ipuHandle != -1; - if (!opened) - CLog::Log(LOGWARNING, "iMX : Failed to open framebuffer: %s\n", m_deviceName.c_str()); - -@@ -1448,10 +1452,10 @@ bool CIMXContext::OpenDevices() - - void CIMXContext::CloseIPU() - { -- if (m_ipuHandle) -+ if (m_ipuHandle != -1) - { - close(m_ipuHandle); -- m_ipuHandle = 0; -+ m_ipuHandle = -1; - } - } - -@@ -1459,10 +1463,10 @@ void CIMXContext::CloseDevices() - { - CLog::Log(LOGINFO, "iMX : Closing devices\n"); - -- if (m_fbHandle) -+ if (m_fbHandle != -1) - { - close(m_fbHandle); -- m_fbHandle = 0; -+ m_fbHandle = -1; - } - - CloseIPU(); -@@ -1470,7 +1474,7 @@ void CIMXContext::CloseDevices() - - bool CIMXContext::Blank() - { -- if (!m_fbHandle) return false; -+ if (m_fbHandle == -1) return false; - - m_bFbIsConfigured = false; - return ioctl(m_fbHandle, FBIOBLANK, 1) == 0; -@@ -1478,7 +1482,7 @@ bool CIMXContext::Blank() - - bool CIMXContext::Unblank() - { -- if (!m_fbHandle) return false; -+ if (m_fbHandle == -1) return false; - - int ret = ioctl(m_fbHandle, FBIOBLANK, FB_BLANK_UNBLANK); - m_bFbIsConfigured = true; -@@ -1620,7 +1624,7 @@ bool CIMXContext::ShowPage() - - { - CSingleLock lk(m_pageSwapLock); -- if (!m_bFbIsConfigured) -+ if (!m_bFbIsConfigured || m_fbHandle == -1 ) - return false; - } - -@@ -1632,6 +1636,8 @@ bool CIMXContext::ShowPage() - - if (ioctl(m_fbHandle, MXCFB_WAIT_FOR_VSYNC, nullptr) < 0 && !CIMX::IsBlank()) - CLog::Log(LOGWARNING, "Vsync failed: %s\n", strerror(errno)); -+ -+ return true; - } - - void CIMXContext::SetProcessInfo(CProcessInfo *m_pProcessInfo) --- -1.9.1 - - -============================================================== -file 0045-IMXRender-Fix-deinterlace-broken-by-refactor-patch.patch -============================================================== - -From 710564e27cc8fd7b83d0913ac72c311fa6fece3c Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 8 Jan 2017 16:32:13 +0100 -Subject: [PATCH] IMXRender: Fix deinterlace broken by refactor patch - ---- - .../VideoRenderers/HwDecRender/RendererIMX.cpp | 20 +++++++++----------- - 1 file changed, 9 insertions(+), 11 deletions(-) - -diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp -index 5167bd2..bd15091 100644 ---- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp -+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererIMX.cpp -@@ -140,7 +140,14 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) - CDVDVideoCodecIMXBuffer *buffer = static_cast(m_buffers[m_iYV12RenderBuffer].hwDec); - if (buffer) - { -- if (buffer == m_bufHistory[0] && flagsPrev == flags) -+ if (m_bufHistory[0] != buffer) -+ { -+ buffer->Lock(); -+ SAFE_RELEASE(m_bufHistory[1]); -+ m_bufHistory[1] = m_bufHistory[0]; -+ m_bufHistory[0] = buffer; -+ } -+ else if (flagsPrev == flags) - { - g_IMX.WaitVsync(); - return true; -@@ -148,15 +155,6 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) - - flagsPrev = flags; - -- buffer->Lock(); -- -- SAFE_RELEASE(m_bufHistory[1]); -- m_bufHistory[1] = m_bufHistory[0]; -- m_bufHistory[0] = buffer; -- -- if (!(flags & RENDER_FLAG_FIELDMASK)) -- SAFE_RELEASE(m_bufHistory[1]); -- - // this hack is needed to get the 2D mode of a 3D movie going - RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode(); - if (stereo_mode) -@@ -204,7 +202,7 @@ bool CRendererIMX::RenderUpdateVideoHook(bool clear, DWORD flags, DWORD alpha) - } - } - -- g_IMXContext.Blit(m_bufHistory[1], m_bufHistory[0], srcRect, dstRect, fieldFmt); -+ g_IMXContext.Blit(m_bufHistory[1], buffer, srcRect, dstRect, fieldFmt); - } - - #if 0 --- -2.7.4 - - -============================================================== -file 400-Boost-Center-Audio-Channel-on-Downmixing.patch -============================================================== - -commit a509bdf1ed001423cad530c2f230937825ff2254 -Author: WRXTASY -Date: Tue Aug 18 09:40:19 2015 +0800 - - Boost Center Audio Channel on Downmixing - -diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index faf423c..cf123fe 100644 ---- a/addons/resource.language.en_gb/resources/strings.po -+++ b/addons/resource.language.en_gb/resources/strings.po -@@ -18893,6 +18893,21 @@ msgstr "" - - #empty strings from id 37046 to 38009 - -+#: system/settings/settings.xml -+msgctxt "#38007" -+msgid "Boost centre channel when downmixing" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38008" -+msgid "Increase this value to make the dialogue louder compared to background sounds when downmixing multichannel audio" -+msgstr "" -+ -+#: system/settings/settings.xml -+msgctxt "#38009" -+msgid "%i dB" -+msgstr "" -+ - #: system/settings/rbp.xml - msgctxt "#38010" - msgid "GPU accelerated" -diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 3ef33e0..44a9036 100644 ---- a/system/settings/settings.xml -+++ b/system/settings/settings.xml -@@ -2040,6 +2040,18 @@ - - - -+ -+ 2 -+ 0 -+ -+ 0 -+ 1 -+ 30 -+ -+ -+ 38009 -+ -+ - - HAS_AE_QUALITY_LEVELS - 2 -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -index e4ddf9e..34d0152 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp -@@ -20,6 +20,7 @@ - - #include "cores/AudioEngine/Utils/AEUtil.h" - #include "ActiveAEResampleFFMPEG.h" -+#include "settings/Settings.h" - #include "utils/log.h" - - extern "C" { -@@ -104,6 +105,12 @@ bool CActiveAEResampleFFMPEG::Init(uint64_t dst_chan_layout, int dst_channels, i - { - av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0); - } -+ int boost_center = CSettings::GetInstance().GetInt("audiooutput.boostcenter"); -+ if (boost_center) -+ { -+ float gain = pow(10.0f, ((float)(-3 + boost_center))/20.0f); -+ av_opt_set_double(m_pContext, "center_mix_level", gain, 0); -+ } - - if (remapLayout) - { - -============================================================== -file 53-imx-fix-edid-readout.patch -============================================================== - ---- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2016-09-25 15:18:47.780677140 +0200 -+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2016-09-25 15:18:47.808677141 +0200 -@@ -336,67 +336,55 @@ - float CEGLNativeTypeIMX::GetMonitorSAR() - { - FILE *f_edid; -- char *str = NULL; -- unsigned char p; -- size_t n; -- int done = 0; -+ int len; - - // kernels <= 3.18 use ./soc0/soc.1 in official imx kernel - // kernels > 3.18 use ./soc0/soc - f_edid = fopen("/sys/devices/soc0/soc/20e0000.hdmi_video/edid", "r"); - if(!f_edid) - f_edid = fopen("/sys/devices/soc0/soc.1/20e0000.hdmi_video/edid", "r"); -+ if(!f_edid) -+ f_edid = fopen("/sys/devices/soc0/soc.0/20e0000.hdmi_video/edid", "r"); - - if(!f_edid) - return 0; - -+ len = fread(m_edid, 1, EDID_MAXSIZE, f_edid); -+ if (len < 128) -+ { -+ fclose(f_edid); -+ return 0; -+ } -+ - // first check if EDID is in binary format by reading 512bytes, compare 1st 8bytes - // against EDID 1.4 identificator [0x0,0xff,0xff,0xff,0xff,0xff,0xff,0x0] - // if no match, seek to 0 input file and continue with previous method. -- if (((done = fread(m_edid, 1, EDID_MAXSIZE, f_edid)) % 128) == 0 && done) -- if (!memcmp(m_edid, EDID_HEADER, EDID_HEADERSIZE)) -- { -- fclose(f_edid); -- return true; -- } -- -- done = 0; -- memset(m_edid, 0, EDID_MAXSIZE); -- fseek(f_edid, 0L, SEEK_SET); -- // we need to convert mxc_hdmi output format to binary array -- // mxc_hdmi provides the EDID as space delimited 1bytes blocks -- // exported as text with format specifier %x eg: -- // 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x4C 0x2D 0x7A 0x0A 0x00 0x00 0x00 0x00 -- // -- // this translates into the inner cycle where we move pointer first -- // with +2 to skip '0x', -- // we sscanf actual data (eg FF) into a byte, -- // we move over the FF and delimiting space with +3 -- // -- // this parses whole 512 byte long info into internal binary array for future -- // reference and use. current use is only to grab screen's physical params -- // at EGL init. -- while(getline(&str, &n, f_edid) > 0) -+ if (memcmp(m_edid, EDID_HEADER, EDID_HEADERSIZE) != 0) - { -- char *c = str; -- while(*c != '\n' && done < EDID_MAXSIZE) -- { -- c += 2; -- sscanf(c, "%hhx", &p); -- m_edid[done++] = p; -- c += 3; -- } -- if (str) -- free(str); -- str = NULL; -+ // we need to convert mxc_hdmi output format to binary array -+ // mxc_hdmi provides the EDID as space delimited 1bytes blocks -+ // exported as text with format specifier %x eg: -+ // 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x4C 0x2D 0x7A 0x0A 0x00 0x00 0x00 0x00 -+ // -+ // this parses whole 512 byte long info into internal binary array for future -+ // reference and use. current use is only to grab screen's physical params -+ // at EGL init. -+ len = 0; -+ fseek(f_edid, 0, SEEK_SET); -+ while (len < EDID_MAXSIZE && fscanf(f_edid, " 0x%2hhx", m_edid + len) == 1) -+ len++; - } -+ -+ if (len < EDID_MAXSIZE) -+ memset(m_edid + len, 0, EDID_MAXSIZE - len); -+ - fclose(f_edid); - - // info related to 'Basic display parameters.' is at offset 0x14-0x18. - // where W is 2nd byte, H 3rd. -- int cmWidth = (int)*(m_edid +EDID_STRUCT_DISPLAY +1); -- int cmHeight = (int)*(m_edid +EDID_STRUCT_DISPLAY +2); -- if (cmHeight > 0) -+ int cmWidth = m_edid[EDID_STRUCT_DISPLAY + 1]; -+ int cmHeight = m_edid[EDID_STRUCT_DISPLAY + 2]; -+ if (cmHeight > 0 && cmWidth > 0) - { - float t_sar = (float) cmWidth / cmHeight; - if (t_sar >= 0.33 && t_sar <= 3.0) - -============================================================== -file 55-cec-power-button.diff -============================================================== - ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp 2015-10-17 10:00:03.704969969 +0200 -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp 2015-10-17 10:00:03.724969970 +0200 -@@ -935,8 +935,14 @@ - case CEC_USER_CONTROL_CODE_POWER: - case CEC_USER_CONTROL_CODE_POWER_TOGGLE_FUNCTION: - case CEC_USER_CONTROL_CODE_POWER_OFF_FUNCTION: -- xbmcKey.iButton = XINPUT_IR_REMOTE_POWER; -- PushCecKeypress(xbmcKey); -+ // Instead of translating to XINPUT_IR_REMOTE_POWER key, we simulate -+ // CEC_OPCODE_STANDBY to avoid unconditional shutdown with some TVs. -+ { -+ cec_command command; -+ command.opcode = CEC_OPCODE_STANDBY; -+ command.initiator = CECDEVICE_TV; -+ CecCommand(this, &command); -+ } - break; - case CEC_USER_CONTROL_CODE_VOLUME_UP: - xbmcKey.iButton = XINPUT_IR_REMOTE_VOLUME_PLUS; - -============================================================== -file 58-kodi-fractional-rates.diff -============================================================== - ---- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2015-12-21 17:45:47.575690959 +0100 -+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp 2015-12-21 17:45:47.615712478 +0100 -@@ -434,7 +434,12 @@ - res->iHeight= h; - res->iScreenWidth = w; - res->iScreenHeight= h; -- res->fRefreshRate = r; -+ -+ if(r == 23 || (r % 10) == 9) -+ res->fRefreshRate = (float)((r + 1) * 1000) / 1001; -+ else -+ res->fRefreshRate = r; -+ - res->dwFlags = p[0] == 'p' ? D3DPRESENTFLAG_PROGRESSIVE : D3DPRESENTFLAG_INTERLACED; - - res->iScreen = 0; - -============================================================== -file 59-kodi-cache-embedded-thumbnails.diff -============================================================== - ---- a/xbmc/music/MusicThumbLoader.cpp 2016-01-31 15:03:34.251330287 +0100 -+++ b/xbmc/music/MusicThumbLoader.cpp 2016-01-31 15:03:34.275330288 +0100 -@@ -153,8 +153,11 @@ - - if (!pItem->HasArt("thumb")) - { -+ EmbeddedArt ea; -+ - // Look for embedded art -- if (pItem->HasMusicInfoTag() && !pItem->GetMusicInfoTag()->GetCoverArtInfo().empty()) -+ if (pItem->HasMusicInfoTag() && -+ (!pItem->GetMusicInfoTag()->GetCoverArtInfo().empty() || GetEmbeddedThumb(pItem->GetPath(), ea))) - { - // The item has got embedded art but user thumbs overrule, so check for those first - if (!FillThumb(*pItem, false)) // Check for user thumbs but ignore folder thumbs -@@ -162,6 +165,7 @@ - // No user thumb, use embedded art - std::string thumb = CTextureUtils::GetWrappedImageURL(pItem->GetPath(), "music"); - pItem->SetArt("thumb", thumb); -+ SetCachedImage(*pItem, "thumb", thumb); - } - } - else - -============================================================== -file 60-kodi-accumulate-data-for-visualisation.diff -============================================================== - ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp 2015-10-19 08:31:15.000000000 +0200 -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp 2016-02-07 18:32:00.431735589 +0100 -@@ -1315,15 +1315,19 @@ - if (!m_vizBuffers && !m_audioCallback.empty()) - { - AEAudioFormat vizFormat = m_internalFormat; -- vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0; -- vizFormat.m_dataFormat = AE_FMT_FLOAT; -- vizFormat.m_sampleRate = 44100; -+ -+ // accumulate samples for the visualization addon -+ if (vizFormat.m_frames < 1536) -+ vizFormat.m_frames = 1536; - - // input buffers -- m_vizBuffersInput = new CActiveAEBufferPool(m_internalFormat); -+ m_vizBuffersInput = new CActiveAEBufferPool(vizFormat); - m_vizBuffersInput->Create(2000); - - // resample buffers -+ vizFormat.m_channelLayout = AE_CH_LAYOUT_2_0; -+ vizFormat.m_dataFormat = AE_FMT_FLOAT; -+ vizFormat.m_sampleRate = 44100; - m_vizBuffers = new CActiveAEBufferPoolResample(m_internalFormat, vizFormat, m_settings.resampleQuality); - //! @todo use cache of sync + water level - m_vizBuffers->Create(2000, false, false); -@@ -2147,18 +2151,33 @@ - m_vizInitialized = true; - } - -+ const int vizNumSamples = 512; // !!! Hack: This should be AUDIO_BUFFER_SIZE (addons/Visualization.h) - if (!m_vizBuffersInput->m_freeSamples.empty()) - { -- // copy the samples into the viz input buffer -- CSampleBuffer *viz = m_vizBuffersInput->GetFreeBuffer(); -- int samples = out->pkt->nb_samples; -- int bytes = samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample; -- for(int i= 0; i < out->pkt->planes; i++) -+ // copy the samples into the viz input buffer -+ CSampleBuffer *viz = m_vizBuffersInput->m_freeSamples.front(); -+ int samples = std::min(vizNumSamples - viz->pkt->nb_samples, out->pkt->nb_samples); -+ -+ // don't copy more than vizNumSamples -+ if (samples > 0) - { -- memcpy(viz->pkt->data[i], out->pkt->data[i], bytes); -+ int bytes = samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample; -+ int offset = viz->pkt->nb_samples * out->pkt->config.channels / out->pkt->planes * out->pkt->bytes_per_sample; -+ for(int i = 0; i < out->pkt->planes; i++) -+ memcpy(viz->pkt->data[i] + offset, out->pkt->data[i], bytes); -+ } -+ -+ // consume complete source packet -+ viz->pkt->nb_samples += out->pkt->nb_samples; -+ if (viz->pkt->nb_samples >= viz->pkt->max_nb_samples) -+ { -+ // set valid sample count -+ viz->pkt->nb_samples = vizNumSamples; -+ -+ m_vizBuffersInput->m_freeSamples.pop_front(); -+ viz->refCount = 1; -+ m_vizBuffers->m_inputSamples.push_back(viz); - } -- viz->pkt->nb_samples = samples; -- m_vizBuffers->m_inputSamples.push_back(viz); - } - else - CLog::Log(LOGWARNING,"ActiveAE::%s - viz ran out of free buffers", __FUNCTION__); -@@ -2183,7 +2202,12 @@ - } - } - else if (m_vizBuffers) -+ { -+ if (!m_vizBuffersInput->m_freeSamples.empty()) -+ m_vizBuffersInput->m_freeSamples.front()->pkt->nb_samples = 0; -+ - m_vizBuffers->Flush(); -+ } - } - - // mix gui sounds - -============================================================== -file 65-fix-cec-dialog-text.diff -============================================================== - ---- a/addons/resource.language.en_gb/resources/strings.po 2016-08-06 13:03:04.169879835 +0200 -+++ b/addons/resource.language.en_gb/resources/strings.po 2016-08-06 13:03:04.197879836 +0200 -@@ -16416,7 +16416,7 @@ - - #: system/peripherals.xml - msgctxt "#36026" --msgid "Devices to also put in standby mode" -+msgid "Switch off the TV when the PC goes to standby" - msgstr "" - - #: xbmc/peripherals/devices/PeripheralCecAdapter.cpp - -============================================================== -file 66-fix-buffering-indicator.diff -============================================================== - ---- a/xbmc/video/windows/GUIWindowFullScreen.cpp 2016-10-01 14:30:58.000000000 +0200 -+++ b/xbmc/video/windows/GUIWindowFullScreen.cpp 2016-10-01 20:02:57.037598834 +0200 -@@ -485,14 +485,16 @@ - - void CGUIWindowFullScreen::Process(unsigned int currentTime, CDirtyRegionList &dirtyregion) - { -- if (g_application.m_pPlayer->IsRenderingGuiLayer()) -- MarkDirtyRegion(); -+ unsigned int oldDirty = dirtyregion.size(); - - CGUIWindow::Process(currentTime, dirtyregion); - - //! @todo This isn't quite optimal - ideally we'd only be dirtying up the actual video render rect - //! which is probably the job of the renderer as it can more easily track resizing etc. - m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight()); -+ -+ if (dirtyregion.size() != oldDirty || g_application.m_pPlayer->IsRenderingGuiLayer()) -+ dirtyregion.push_back(m_renderRegion); - } - - void CGUIWindowFullScreen::Render() diff --git a/projects/imx6/patches/kodi/kodi-100-libreelec-extras.patch b/projects/imx6/patches/kodi/kodi-100-libreelec-extras.patch deleted file mode 100644 index 15368aa6f7..0000000000 --- a/projects/imx6/patches/kodi/kodi-100-libreelec-extras.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 6a535e23bef1d08f20e332d3caa5f080660a7596 Mon Sep 17 00:00:00 2001 -From: Peter Vicman -Date: Sun, 1 Jan 2017 18:00:29 +0100 -Subject: [PATCH] disable suspend and hibernate - ---- - xbmc/powermanagement/linux/LogindUPowerSyscall.cpp | 4 ++-- - xbmc/powermanagement/linux/UPowerSyscall.cpp | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -index 4e5bcc6..8dc4fb1 100644 ---- a/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/LogindUPowerSyscall.cpp -@@ -52,8 +52,8 @@ CLogindUPowerSyscall::CLogindUPowerSyscall() - - m_canPowerdown = LogindCheckCapability("CanPowerOff"); - m_canReboot = LogindCheckCapability("CanReboot"); -- m_canHibernate = LogindCheckCapability("CanHibernate"); -- m_canSuspend = LogindCheckCapability("CanSuspend"); -+ m_canHibernate = false; -+ m_canSuspend = false; - - InhibitDelayLock(); - -diff --git a/xbmc/powermanagement/linux/UPowerSyscall.cpp b/xbmc/powermanagement/linux/UPowerSyscall.cpp -index e3b4725..bddb7c6 100644 ---- a/xbmc/powermanagement/linux/UPowerSyscall.cpp -+++ b/xbmc/powermanagement/linux/UPowerSyscall.cpp -@@ -262,8 +262,8 @@ bool CUPowerSyscall::PumpPowerEvents(IPowerEventsCallback *callback) - - void CUPowerSyscall::UpdateCapabilities() - { -- m_CanSuspend = CDBusUtil::GetVariant("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", "CanSuspend").asBoolean(false); -- m_CanHibernate = CDBusUtil::GetVariant("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", "CanHibernate").asBoolean(false); -+ m_CanSuspend = false; -+ m_CanHibernate = false; - } - - #endif --- -2.7.1 - diff --git a/projects/imx6/patches/libcec/libcec-100-from-xbian.patch b/projects/imx6/patches/libcec/libcec-100-from-xbian.patch deleted file mode 100644 index d13979c324..0000000000 --- a/projects/imx6/patches/libcec/libcec-100-from-xbian.patch +++ /dev/null @@ -1,1766 +0,0 @@ -From bff5c44d1c5deeda77439c0f6d8e0ab1fa76c167 Mon Sep 17 00:00:00 2001 -From: Peter Vicman -Date: Sat, 3 Dec 2016 11:33:39 +0100 -Subject: [PATCH] patch for libcec from xbian - -libcec base: libcec-209884d -libcec xbian: - https://github.com/xbianonpi/xbian-sources-libcec/tree/masterv4 2ff5a0175937d5b190256c679d0b3b6f564f903a ---- - CMakeLists.txt | 6 + - debian/control | 7 +- - debian/libcec4-dev.install | 1 + - debian/libcec4.install | 2 + - include/cec.h | 2 + - include/cectypes.h | 47 ++- - src/cec-client/CMakeLists.txt | 4 +- - src/cecc-client/cecc-client.c | 2 +- - src/libcec/CECClient.cpp | 12 +- - src/libcec/CECClient.h | 1 + - src/libcec/CECProcessor.cpp | 6 + - src/libcec/CECProcessor.h | 1 + - src/libcec/CECTypeUtils.h | 2 + - src/libcec/CMakeLists.txt | 22 +- - src/libcec/LibCEC.cpp | 5 + - src/libcec/LibCEC.h | 1 + - src/libcec/adapter/AdapterFactory.cpp | 27 +- - .../adapter/IMX/IMXCECAdapterCommunication.cpp | 381 +++++++++++++++++++++ - .../adapter/IMX/IMXCECAdapterCommunication.h | 139 ++++++++ - src/libcec/adapter/IMX/IMXCECAdapterDetection.cpp | 42 +++ - src/libcec/adapter/IMX/IMXCECAdapterDetection.h | 36 ++ - src/libcec/adapter/IMX/IMXCECAdapterMessageQueue.h | 118 +++++++ - src/libcec/adapter/IMX/mxc_hdmi-cec.h | 47 +++ - src/libcec/cmake/CheckPlatformSupport.cmake | 49 ++- - src/libcec/cmake/DisplayPlatformSupport.cmake | 10 +- - src/libcec/cmake/LinkPlatformSupport.cmake | 7 +- - src/libcec/cmake/git-rev.sh | 2 +- - src/libcec/devices/CECBusDevice.cpp | 11 +- - src/libcec/devices/CECBusDevice.h | 2 + - src/libcec/env.h.in | 3 + - src/libcec/implementations/CECCommandHandler.cpp | 16 +- - src/libcec/implementations/CECCommandHandler.h | 7 +- - src/libcec/implementations/GRCommandHandler.cpp | 92 +++++ - src/libcec/implementations/GRCommandHandler.h | 53 +++ - 34 files changed, 1102 insertions(+), 61 deletions(-) - create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp - create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterCommunication.h - create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterDetection.cpp - create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterDetection.h - create mode 100644 src/libcec/adapter/IMX/IMXCECAdapterMessageQueue.h - create mode 100644 src/libcec/adapter/IMX/mxc_hdmi-cec.h - create mode 100644 src/libcec/implementations/GRCommandHandler.cpp - create mode 100644 src/libcec/implementations/GRCommandHandler.h - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 123b3b4..cdf1317 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -5,6 +5,12 @@ set(LIBCEC_VERSION_MAJOR 4) - set(LIBCEC_VERSION_MINOR 0) - set(LIBCEC_VERSION_PATCH 0) - -+find_program(CCACHE_FOUND ccache) -+if(CCACHE_FOUND) -+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) -+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) -+endif(CCACHE_FOUND) -+ - # cec-client - add_subdirectory(src/cec-client) - add_dependencies(cec-client cec) -diff --git a/debian/control b/debian/control -index e05a063..1675c1b 100644 ---- a/debian/control -+++ b/debian/control -@@ -20,6 +20,7 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/libcec.git - Package: libcec4-dev - Architecture: any - Section: libdevel -+Replaces: libcec-dev - Depends: libcec4 (= ${binary:Version}), - ${misc:Depends} - Description: libCEC communication Library (development files) -@@ -30,6 +31,7 @@ Description: libCEC communication Library (development files) - Package: libcec4 - Architecture: any - Multi-Arch: same -+Replaces: libcec3 - Pre-Depends: ${misc:Pre-Depends} - Depends: ${shlibs:Depends}, ${misc:Depends} - Description: libCEC communication Library (shared library) -@@ -40,6 +42,7 @@ Description: libCEC communication Library (shared library) - Package: cec-utils - Architecture: any - Section: utils -+Replaces: xbian-package-cec - Depends: libcec4 (= ${binary:Version}), - ${shlibs:Depends}, - ${misc:Depends} -@@ -60,6 +63,8 @@ Description: Python bindings for libCEC - - Package: libcec - Architecture: any --Depends: ${shlibs:Depends}, ${misc:Depends}, libcec4 (= ${binary:Version}) -+Depends: ${shlibs:Depends}, ${misc:Depends}, libcec4 (= ${binary:Version}), python-libcec, cec-utils, libcec4-dev -+Provides: xbian-package-cec -+Breaks: xbian-package-cec (<<10.0) - Description: Meta package libCEC. - -diff --git a/debian/libcec4-dev.install b/debian/libcec4-dev.install -index e5bbd96..15a3585 100644 ---- a/debian/libcec4-dev.install -+++ b/debian/libcec4-dev.install -@@ -1,3 +1,4 @@ - usr/include - usr/lib/pkgconfig - usr/lib/*/*.so -+usr/lib/p8-platform -diff --git a/debian/libcec4.install b/debian/libcec4.install -index ca5ebe3..ac5e50a 100644 ---- a/debian/libcec4.install -+++ b/debian/libcec4.install -@@ -1 +1,3 @@ - usr/lib/*/libcec.so.* -+usr/lib/libp*.a -+ -diff --git a/include/cec.h b/include/cec.h -index 71450ae..b4a7d78 100644 ---- a/include/cec.h -+++ b/include/cec.h -@@ -389,6 +389,8 @@ namespace CEC - */ - virtual uint16_t GetAdapterProductId(void) const = 0; - -+ virtual bool TransmitSystemAudioModeRequest(void) = 0; -+ - virtual const char* ToString(const cec_menu_state state) = 0; - virtual const char* ToString(const cec_version version) = 0; - virtual const char* ToString(const cec_power_status status) = 0; -diff --git a/include/cectypes.h b/include/cectypes.h -index 9c91842..9fa69fc 100644 ---- a/include/cectypes.h -+++ b/include/cectypes.h -@@ -267,9 +267,19 @@ namespace CEC { - #define CEC_TDA995x_VIRTUAL_COM "CuBox" - - /*! -+ * the path to use for the i.MX CEC wire -+ */ -+#define CEC_IMX_PATH "/dev/mxc_hdmi_cec" -+ -+/*! -+ * the name of the virtual COM port to use for the i.MX CEC wire -+ */ -+#define CEC_IMX_VIRTUAL_COM "i.MX" -+ -+/*! - * the path to use for the Exynos HDMI CEC device - */ --#define CEC_EXYNOS_PATH "/dev/CEC" -+#define CEC_EXYNOS_PATH "/dev/CEC" - - /*! - * the name of the virtual COM port to use for the EXYNOS' CEC wire -@@ -296,6 +306,8 @@ namespace CEC { - */ - #define CEC_MIN_LIB_VERSION 4 - -+#define CEC_LIB_VERSION_MAJOR 4 -+ - #define MSGSTART 0xFF - #define MSGEND 0xFE - #define MSGESC 0xFD -@@ -861,6 +873,7 @@ typedef enum cec_adapter_type - ADAPTERTYPE_RPI = 0x100, - ADAPTERTYPE_TDA995x = 0x200, - ADAPTERTYPE_EXYNOS = 0x300, -+ ADAPTERTYPE_IMX = 0x400, - ADAPTERTYPE_AOCEC = 0x500 - } cec_adapter_type; - -@@ -1245,7 +1258,7 @@ typedef struct cec_device_type_list - typedef struct cec_logical_addresses - { - cec_logical_address primary; /**< the primary logical address to use */ -- int addresses[16]; /**< the list of addresses */ -+ uint16_t addresses; /**< the list of addresses */ - - #ifdef __cplusplus - /*! -@@ -1254,8 +1267,7 @@ typedef struct cec_logical_addresses - void Clear(void) - { - primary = CECDEVICE_UNREGISTERED; -- for (unsigned int iPtr = 0; iPtr < 16; iPtr++) -- addresses[iPtr] = 0; -+ addresses = 0; - } - - /*! -@@ -1263,7 +1275,7 @@ typedef struct cec_logical_addresses - */ - bool IsEmpty(void) const - { -- return primary == CECDEVICE_UNREGISTERED; -+ return primary == CECDEVICE_UNREGISTERED && addresses == 0; - } - - /*! -@@ -1272,11 +1284,7 @@ typedef struct cec_logical_addresses - */ - uint16_t AckMask(void) const - { -- uint16_t mask = 0; -- for (unsigned int iPtr = 0; iPtr < 16; iPtr++) -- if (addresses[iPtr] == 1) -- mask |= 0x1 << iPtr; -- return mask; -+ return addresses; - } - - /*! -@@ -1288,7 +1296,7 @@ typedef struct cec_logical_addresses - if (primary == CECDEVICE_UNREGISTERED) - primary = address; - -- addresses[(int) address] = 1; -+ addresses |= (1 << (int) address); - } - - /*! -@@ -1300,7 +1308,7 @@ typedef struct cec_logical_addresses - if (primary == address) - primary = CECDEVICE_UNREGISTERED; - -- addresses[(int) address] = 0; -+ addresses &= ~(uint16_t)(1 << (int) address); - } - - /*! -@@ -1308,7 +1316,7 @@ typedef struct cec_logical_addresses - * @param address The address to check. - * @return True when set, false otherwise. - */ -- bool IsSet(cec_logical_address address) const { return addresses[(int) address] == 1; } -+ bool IsSet(cec_logical_address address) const { return (addresses & (1 << (int) address)); } - - /*! - * @brief Check whether an address is set in this list. -@@ -1317,18 +1325,9 @@ typedef struct cec_logical_addresses - */ - bool operator[](uint8_t pos) const { return pos < 16 ? IsSet((cec_logical_address) pos) : false; } - -- bool operator==(const cec_logical_addresses &other) const -- { -- bool bEqual(true); -- for (uint8_t iPtr = 0; iPtr < 16; iPtr++) -- bEqual &= ((addresses[(int)iPtr] == 1) == other[iPtr]); -- return bEqual; -- } -+ bool operator==(const cec_logical_addresses &other) const { return addresses == other.addresses; } - -- bool operator!=(const cec_logical_addresses &other) const -- { -- return !(*this == other); -- } -+ bool operator!=(const cec_logical_addresses &other) const { return !(*this == other); } - #endif - } cec_logical_addresses; - -diff --git a/src/cec-client/CMakeLists.txt b/src/cec-client/CMakeLists.txt -index 2cb42bb..c708fdb 100644 ---- a/src/cec-client/CMakeLists.txt -+++ b/src/cec-client/CMakeLists.txt -@@ -13,9 +13,9 @@ include(CheckLibraryExists) - include(CheckIncludeFiles) - include(CheckCXXCompilerFlag) - --check_cxx_compiler_flag("-std=c++11" SUPPORTS_CXX11) -+check_cxx_compiler_flag("-std=c++0x" SUPPORTS_CXX11) - if (SUPPORTS_CXX11) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - endif() - - find_package(p8-platform REQUIRED) -diff --git a/src/cecc-client/cecc-client.c b/src/cecc-client/cecc-client.c -index 3373109..914d4d4 100644 ---- a/src/cecc-client/cecc-client.c -+++ b/src/cecc-client/cecc-client.c -@@ -337,7 +337,7 @@ static int cec_process_command_scan(const char* data) - activeSource = g_iface.get_active_source(g_iface.connection); - for (iPtr = 0; iPtr < 16; iPtr++) - { -- if (addresses.addresses[iPtr]) -+ if (addresses.addresses & (1 << iPtr)) - { - cec_menu_language lang; - cec_osd_name osdName; -diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp -index b777faa..9f6e7c5 100644 ---- a/src/libcec/CECClient.cpp -+++ b/src/libcec/CECClient.cpp -@@ -139,10 +139,6 @@ bool CCECClient::OnRegister(void) - // set the physical address - SetPhysicalAddress(m_configuration); - -- // make the primary device the active source if the option is set -- if (m_configuration.bActivateSource == 1) -- GetPrimaryDevice()->ActivateSource(500); -- - return true; - } - -@@ -350,12 +346,13 @@ bool CCECClient::AllocateLogicalAddresses(void) - if (address == CECDEVICE_UNKNOWN) - { - LIB_CEC->AddLog(CEC_LOG_ERROR, "%s - failed to allocate device '%d', type '%s'", __FUNCTION__, iPtr, ToString(m_configuration.deviceTypes.types[iPtr])); -- return false; -+ continue; - } - - // display the registered LA - LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - device '%d', type '%s', LA '%X'", __FUNCTION__, iPtr, ToString(m_configuration.deviceTypes.types[iPtr]), address); - m_configuration.logicalAddresses.Set(address); -+ break; - } - - // persist the new configuration -@@ -1540,6 +1537,11 @@ bool CCECClient::IsLibCECActiveSource(void) - return bReturn; - } - -+bool CCECClient::TransmitSystemAudioModeRequest(void) -+{ -+ return m_processor ? m_processor->TransmitSystemAudioModeRequest(m_configuration.logicalAddresses.primary) : false; -+} -+ - void CCECClient::SourceActivated(const cec_logical_address logicalAddress) - { - LIB_CEC->AddLog(CEC_LOG_NOTICE, ">> source activated: %s (%x)", ToString(logicalAddress), logicalAddress); -diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h -index 49528ee..f02775c 100644 ---- a/src/libcec/CECClient.h -+++ b/src/libcec/CECClient.h -@@ -298,6 +298,7 @@ namespace CEC - virtual void RescanActiveDevices(void); - virtual bool IsLibCECActiveSource(void); - bool AudioEnable(bool enable); -+ virtual bool TransmitSystemAudioModeRequest(void); - - // configuration - virtual bool GetCurrentConfiguration(libcec_configuration &configuration); -diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp -index 8ce46c5..e31e24a 100644 ---- a/src/libcec/CECProcessor.cpp -+++ b/src/libcec/CECProcessor.cpp -@@ -712,6 +712,12 @@ bool CCECProcessor::TransmitPendingActiveSourceCommands(void) - return bReturn; - } - -+bool CCECProcessor::TransmitSystemAudioModeRequest(cec_logical_address initiator) -+{ -+ CCECBusDevice *device = m_busDevices->At(initiator); -+ return device && device->TransmitSystemAudioModeRequest(initiator); -+} -+ - CCECTV *CCECProcessor::GetTV(void) const - { - return CCECBusDevice::AsTV(m_busDevices->At(CECDEVICE_TV)); -diff --git a/src/libcec/CECProcessor.h b/src/libcec/CECProcessor.h -index 08917b9..1971dee 100644 ---- a/src/libcec/CECProcessor.h -+++ b/src/libcec/CECProcessor.h -@@ -149,6 +149,7 @@ namespace CEC - bool GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT); - - bool TransmitPendingActiveSourceCommands(void); -+ bool TransmitSystemAudioModeRequest(cec_logical_address initiator); - - CCECDeviceMap *GetDevices(void) const { return m_busDevices; } - CLibCEC *GetLib(void) const { return m_libcec; } -diff --git a/src/libcec/CECTypeUtils.h b/src/libcec/CECTypeUtils.h -index 0d0cf17..f6c818a 100644 ---- a/src/libcec/CECTypeUtils.h -+++ b/src/libcec/CECTypeUtils.h -@@ -766,6 +766,8 @@ namespace CEC - return "Raspberry Pi"; - case ADAPTERTYPE_TDA995x: - return "TDA995x"; -+ case ADAPTERTYPE_IMX: -+ return "i.MX"; - default: - return "unknown"; - } -diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt -index d3eefa3..6a33abf 100644 ---- a/src/libcec/CMakeLists.txt -+++ b/src/libcec/CMakeLists.txt -@@ -13,9 +13,9 @@ include(CheckIncludeFiles) - include(CheckCXXCompilerFlag) - include(../../cmake/UseMultiArch.cmake) - --check_cxx_compiler_flag("-std=c++11" SUPPORTS_CXX11) -+check_cxx_compiler_flag("-std=c++0x" SUPPORTS_CXX11) - if (SUPPORTS_CXX11) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - endif() - - find_package(p8-platform REQUIRED) -@@ -64,7 +64,8 @@ set(CEC_SOURCES_IMPLEMENTATIONS implementations/ANCommandHandler.cpp - implementations/RLCommandHandler.cpp - implementations/PHCommandHandler.cpp - implementations/RHCommandHandler.cpp -- implementations/AQCommandHandler.cpp) -+ implementations/AQCommandHandler.cpp -+ implementations/GRCommandHandler.cpp) - - # /platform/* - set(CEC_SOURCES_PLATFORM platform/adl/adl-edid.cpp -@@ -124,6 +125,7 @@ set(CEC_HEADERS devices/CECRecordingDevice.h - implementations/RHCommandHandler.h - implementations/PHCommandHandler.h - implementations/AQCommandHandler.h -+ implementations/GRCommandHandler.h - CECProcessor.h) - source_group("Header Files" FILES ${CEC_HEADERS}) - -@@ -176,13 +178,17 @@ install(FILES ${PROJECT_SOURCE_DIR}/../../include/cec.h - DESTINATION include/libcec) - - # libCEC target --add_library(cec SHARED ${CEC_SOURCES}) --install(TARGETS cec -+add_library(cecobj OBJECT ${CEC_SOURCES}) -+set_property(TARGET ${cecobj} PROPERTY POSITION_INDEPENDENT_CODE 1) -+add_library(cec SHARED $) -+add_library(cecstatic STATIC $) -+set_target_properties(cecstatic PROPERTIES OUTPUT_NAME cec) -+install(TARGETS cec cecstatic - DESTINATION ${LIB_DESTINATION}) --set_target_properties(cec PROPERTIES VERSION ${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH} -+set_target_properties(cec cecstatic PROPERTIES VERSION ${LIBCEC_VERSION_MAJOR}.${LIBCEC_VERSION_MINOR}.${LIBCEC_VERSION_PATCH} - SOVERSION ${LIBCEC_VERSION_MAJOR}) --target_link_libraries(cec ${p8-platform_LIBRARIES}) --target_link_libraries(cec ${CMAKE_THREAD_LIBS_INIT}) -+target_link_libraries(cec cecstatic ${p8-platform_LIBRARIES}) -+target_link_libraries(cec cecstatic ${CMAKE_THREAD_LIBS_INIT}) - - include(cmake/LinkPlatformSupport.cmake) - include(cmake/DisplayPlatformSupport.cmake) -diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp -index 8eedaa7..9562e06 100644 ---- a/src/libcec/LibCEC.cpp -+++ b/src/libcec/LibCEC.cpp -@@ -624,3 +624,8 @@ bool CLibCEC::AudioEnable(bool enable) - m_client->AudioEnable(enable) : - false; - } -+ -+bool CLibCEC::TransmitSystemAudioModeRequest(void) -+{ -+ return m_client ? m_client->TransmitSystemAudioModeRequest() : false; -+} -diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h -index 7155926..b9e393b 100644 ---- a/src/libcec/LibCEC.h -+++ b/src/libcec/LibCEC.h -@@ -109,6 +109,7 @@ namespace CEC - bool PersistConfiguration(libcec_configuration *configuration); - void RescanActiveDevices(void); - bool IsLibCECActiveSource(void); -+ bool TransmitSystemAudioModeRequest(void); - - const char* ToString(const cec_menu_state state) { return CCECTypeUtils::ToString(state); } - const char* ToString(const cec_version version) { return CCECTypeUtils::ToString(version); } -diff --git a/src/libcec/adapter/AdapterFactory.cpp b/src/libcec/adapter/AdapterFactory.cpp -index 1e946e6..261c60d 100644 ---- a/src/libcec/adapter/AdapterFactory.cpp -+++ b/src/libcec/adapter/AdapterFactory.cpp -@@ -63,6 +63,11 @@ - #include "AOCEC/AOCECAdapterCommunication.h" - #endif - -+#if defined(HAVE_IMX_API) -+#include "IMX/IMXCECAdapterDetection.h" -+#include "IMX/IMXCECAdapterCommunication.h" -+#endif -+ - using namespace CEC; - - int8_t CAdapterFactory::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */) -@@ -143,8 +148,21 @@ int8_t CAdapterFactory::DetectAdapters(cec_adapter_descriptor *deviceList, uint8 - } - #endif - -+#if defined(HAVE_IMX_API) -+ if (iAdaptersFound < iBufSize && CIMXCECAdapterDetection::FindAdapter() && -+ (!strDevicePath || !strcmp(strDevicePath, CEC_IMX_VIRTUAL_COM))) -+ { -+ snprintf(deviceList[iAdaptersFound].strComPath, sizeof(deviceList[iAdaptersFound].strComPath), CEC_IMX_PATH); -+ snprintf(deviceList[iAdaptersFound].strComName, sizeof(deviceList[iAdaptersFound].strComName), CEC_IMX_VIRTUAL_COM); -+ deviceList[iAdaptersFound].iVendorId = IMX_ADAPTER_VID; -+ deviceList[iAdaptersFound].iProductId = IMX_ADAPTER_PID; -+ deviceList[iAdaptersFound].adapterType = ADAPTERTYPE_IMX; -+ iAdaptersFound++; -+ } -+#endif -+ - --#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AOCEC_API) -+#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_AOCEC_API) && !defined(HAVE_IMX_API) - #error "libCEC doesn't have support for any type of adapter. please check your build system or configuration" - #endif - -@@ -173,11 +191,16 @@ IAdapterCommunication *CAdapterFactory::GetInstance(const char *strPort, uint16_ - return new CRPiCECAdapterCommunication(m_lib->m_cec); - #endif - -+#if defined(HAVE_IMX_API) -+ if (!strcmp(strPort, CEC_IMX_VIRTUAL_COM)) -+ return new CIMXCECAdapterCommunication(m_lib->m_cec); -+#endif -+ - #if defined(HAVE_P8_USB) - return new CUSBCECAdapterCommunication(m_lib->m_cec, strPort, iBaudRate); - #endif - --#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_AOCEC_API) -+#if !defined(HAVE_RPI_API) && !defined(HAVE_P8_USB) && !defined(HAVE_TDA995X_API) && !defined(HAVE_EXYNOS_API) && !defined(HAVE_AOCEC_API) && !defined(HAVE_IMX_API) - return NULL; - #endif - } -diff --git a/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp -new file mode 100644 -index 0000000..212dd75 ---- /dev/null -+++ b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.cpp -@@ -0,0 +1,381 @@ -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * IMX adpater port is Copyright (C) 2013 by Stephan Rafin -+ * Copyright (C) 2014 by Matus Kral -+ * -+ * You can redistribute this file 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * -+ */ -+ -+#include "env.h" -+ -+#if defined(HAVE_IMX_API) -+#include "IMXCECAdapterCommunication.h" -+ -+#include "CECTypeUtils.h" -+#include "LibCEC.h" -+#include -+#include -+#include -+ -+using namespace std; -+using namespace CEC; -+using namespace P8PLATFORM; -+ -+#include "IMXCECAdapterMessageQueue.h" -+ -+#define LIB_CEC m_callback->GetLib() -+ -+// these are defined in nxp private header file -+#define CEC_MSG_SUCCESS 0x00 /*Message transmisson Succeed*/ -+#define CEC_CSP_OFF_STATE 0x80 /*CSP in Off State*/ -+#define CEC_BAD_REQ_SERVICE 0x81 /*Bad .req service*/ -+#define CEC_MSG_FAIL_UNABLE_TO_ACCESS 0x82 /*Message transmisson failed: Unable to access CEC line*/ -+#define CEC_MSG_FAIL_ARBITRATION_ERROR 0x83 /*Message transmisson failed: Arbitration error*/ -+#define CEC_MSG_FAIL_BIT_TIMMING_ERROR 0x84 /*Message transmisson failed: Bit timming error*/ -+#define CEC_MSG_FAIL_DEST_NOT_ACK 0x85 /*Message transmisson failed: Destination Address not aknowledged*/ -+#define CEC_MSG_FAIL_DATA_NOT_ACK 0x86 /*Message transmisson failed: Databyte not acknowledged*/ -+ -+CIMXCECAdapterCommunication::CIMXCECAdapterCommunication(IAdapterCommunicationCallback *callback) : -+ IAdapterCommunication(callback), -+ m_PAReporter(NULL) -+{ -+ CLockObject lock(m_mutex); -+ -+ m_iNextMessage = 0; -+ m_logicalAddress = CECDEVICE_UNKNOWN; -+ m_bLogicalAddressRegistered = false; -+ m_bInitialised = false; -+ m_dev = new CCDevSocket(CEC_IMX_PATH); -+ m_physicalAddress = -1; -+} -+ -+CIMXCECAdapterCommunication::~CIMXCECAdapterCommunication(void) -+{ -+ Close(); -+ SAFE_DELETE(m_PAReporter); -+ delete m_dev; -+ m_dev = 0; -+} -+ -+bool CIMXCECAdapterCommunication::IsOpen(void) -+{ -+ return IsInitialised() && m_dev->IsOpen(); -+} -+ -+bool CIMXCECAdapterCommunication::Open(uint32_t iTimeoutMs, bool UNUSED(bSkipChecks), bool bStartListening) -+{ -+ if (m_dev->Open(iTimeoutMs)) -+ { -+ if (!bStartListening || CreateThread()) { -+ if (m_dev->Ioctl(HDMICEC_IOC_STARTDEVICE, NULL) == 0) { -+ m_bInitialised = true; -+ RegisterLogicalAddress(CECDEVICE_BROADCAST); -+ return true; -+ } -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: Unable to start device\n", __func__); -+ } -+ m_dev->Close(); -+ } -+ -+ return false; -+} -+ -+ -+void CIMXCECAdapterCommunication::Close(void) -+{ -+ m_bInitialised = false; -+ if (m_dev->Ioctl(HDMICEC_IOC_STOPDEVICE, NULL) != 0) -+ { -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: Unable to stop device\n", __func__); -+ } -+ StopThread(false); -+ m_dev->Close(); -+} -+ -+ -+std::string CIMXCECAdapterCommunication::GetError(void) const -+{ -+ std::string strError(m_strError); -+ return strError; -+} -+ -+ -+cec_adapter_message_state CIMXCECAdapterCommunication::Write( -+ const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool UNUSED(bIsReply)) -+{ -+ unsigned char message[MAX_MESSAGE_LEN]; -+ CIMXCECAdapterMessageQueueEntry *entry; -+ int msg_len = 1; -+ cec_adapter_message_state rc = ADAPTER_MESSAGE_STATE_ERROR; -+ -+ bRetry = true; -+ if ((size_t)data.parameters.size + data.opcode_set + 1 > sizeof(message)) -+ { -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: data size too large !", __func__); -+ bRetry = false; -+ return rc; -+ } -+ -+ message[0] = (data.initiator << 4) | (data.destination & 0x0f); -+ if (data.opcode_set) -+ { -+ message[1] = data.opcode; -+ msg_len++; -+ memcpy(&message[2], data.parameters.data, data.parameters.size); -+ msg_len+=data.parameters.size; -+ } -+ -+ entry = new CIMXCECAdapterMessageQueueEntry(message[0], data.opcode); -+ m_messageMutex.Lock(); -+ uint32_t msgKey = ++m_iNextMessage; -+ m_messages.insert(make_pair(msgKey, entry)); -+ m_messageMutex.Unlock(); -+ -+ if (m_dev->Write(message, msg_len) > 0) -+ { -+ if (entry->Wait(data.transmit_timeout ? data.transmit_timeout : iLineTimeout *1000)) -+ { -+ int status = entry->Result(); -+ -+ if (status == MESSAGE_TYPE_NOACK) -+ rc = ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED; -+ else if (status == MESSAGE_TYPE_SEND_SUCCESS) -+ rc = ADAPTER_MESSAGE_STATE_SENT_ACKED; -+ -+ bRetry = false; -+ } -+ else -+ { -+ rc = ADAPTER_MESSAGE_STATE_WAITING_TO_BE_SENT; -+#ifdef CEC_DEBUGGING -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: command timed out !", __func__); -+#endif -+ } -+ } -+ else -+ { -+ Sleep(CEC_DEFAULT_TRANSMIT_RETRY_WAIT); -+#ifdef CEC_DEBUGGING -+ LIB_CEC->AddLog(CEC_LOG_WARNING, "%s: write failed !", __func__); -+#endif -+ } -+ -+ m_messageMutex.Lock(); -+ m_messages.erase(msgKey); -+ m_messageMutex.Unlock(); -+ -+ delete entry; -+ -+ return rc; -+} -+ -+ -+uint16_t CIMXCECAdapterCommunication::GetFirmwareVersion(void) -+{ -+ /* FIXME add ioctl ? */ -+ return 0; -+} -+ -+ -+cec_vendor_id CIMXCECAdapterCommunication::GetVendorId(void) -+{ -+ return CEC_VENDOR_UNKNOWN; -+} -+ -+ -+uint16_t CIMXCECAdapterCommunication::GetPhysicalAddress(void) -+{ -+ uint8_t phy_addr[4]; -+ uint16_t pa_tmp; -+ -+ if (m_dev->Ioctl(HDMICEC_IOC_GETPHYADDRESS, &phy_addr) != 0) -+ { -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: HDMICEC_IOC_GETPHYADDRESS failed !", __func__); -+ return CEC_INVALID_PHYSICAL_ADDRESS; -+ } -+ -+ if ((pa_tmp = ((phy_addr[0] << 4 | phy_addr[1]) << 8) | (phy_addr[2] << 4 | phy_addr[3]))) -+ m_physicalAddress = pa_tmp; -+ -+ return m_physicalAddress; -+} -+ -+ -+cec_logical_addresses CIMXCECAdapterCommunication::GetLogicalAddresses(void) -+{ -+ cec_logical_addresses addresses; -+ addresses.Clear(); -+ -+ CLockObject lock(m_mutex); -+ if (m_bLogicalAddressRegistered) -+ addresses.Set(m_logicalAddress); -+ -+ return addresses; -+} -+ -+void CIMXCECAdapterCommunication::HandleLogicalAddressLost(cec_logical_address UNUSED(oldAddress)) -+{ -+ UnregisterLogicalAddress(); -+} -+ -+bool CIMXCECAdapterCommunication::UnregisterLogicalAddress(void) -+{ -+ { -+ CLockObject lock(m_mutex); -+ if (!m_bLogicalAddressRegistered) -+ return true; -+ } -+ -+#ifdef CEC_DEBUGGING -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - releasing previous logical address", __func__); -+#endif -+ return RegisterLogicalAddress(CECDEVICE_BROADCAST); -+} -+ -+bool CIMXCECAdapterCommunication::RegisterLogicalAddress(const cec_logical_address address) -+{ -+ { -+ CLockObject lock(m_mutex); -+ if ((m_logicalAddress == address && m_bLogicalAddressRegistered) || -+ (m_logicalAddress == address && address == CECDEVICE_BROADCAST)) -+ { -+ return true; -+ } -+ } -+ -+#ifdef CEC_DEBUGGING -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %x to %x", __func__, m_logicalAddress, address); -+#endif -+ -+ if (m_dev->Ioctl(HDMICEC_IOC_SETLOGICALADDRESS, (void *)address) != 0) -+ { -+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: HDMICEC_IOC_SETLOGICALADDRESS failed !", __func__); -+ return false; -+ } -+ -+ CLockObject lock(m_mutex); -+ -+ m_logicalAddress = address; -+ m_bLogicalAddressRegistered = (address != CECDEVICE_BROADCAST) ? true : false; -+ return true; -+} -+ -+bool CIMXCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) -+{ -+ int log_addr = addresses.primary; -+ -+ return RegisterLogicalAddress((cec_logical_address)log_addr); -+} -+ -+ -+void *CIMXCECAdapterCommunication::Process(void) -+{ -+ bool bHandled; -+ hdmi_cec_event event; -+ int ret; -+ -+ cec_logical_address initiator, destination; -+ -+ while (!IsStopped()) -+ { -+ if (IsInitialised() && (ret = m_dev->Read((char *)&event, sizeof(event), 0)) > 0) -+ { -+ -+ initiator = cec_logical_address(event.msg[0] >> 4); -+ destination = cec_logical_address(event.msg[0] & 0x0f); -+ -+ if (event.event_type == MESSAGE_TYPE_RECEIVE_SUCCESS) -+ { -+ cec_command cmd; -+ -+ cec_command::Format( -+ cmd, initiator, destination, -+ ( event.msg_len > 1 ) ? cec_opcode(event.msg[1]) : CEC_OPCODE_NONE); -+ -+ for( uint8_t i = 2; i < event.msg_len; i++ ) -+ cmd.parameters.PushBack(event.msg[i]); -+ -+ if (!IsStopped()) { -+ m_callback->OnCommandReceived(cmd); -+ } -+ } -+ else if (event.event_type == MESSAGE_TYPE_SEND_SUCCESS -+ || event.event_type == MESSAGE_TYPE_NOACK) -+ { -+ bHandled = false; -+ -+ m_messageMutex.Lock(); -+ for (map::iterator it = m_messages.begin(); -+ !bHandled && it != m_messages.end(); it++) -+ { -+ bHandled = it->second->Received(event.event_type, event.msg[0], (cec_opcode)event.msg[1]); -+ } -+ m_messageMutex.Unlock(); -+ -+ if (!bHandled) -+ LIB_CEC->AddLog(CEC_LOG_WARNING, "%s: response not matched !", __func__); -+ } -+ else if (event.event_type == MESSAGE_TYPE_DISCONNECTED) -+ { -+ /* HDMI Hotplug event - disconnect */ -+ } -+ else if (event.event_type == MESSAGE_TYPE_CONNECTED) -+ { -+ if (m_physicalAddress == 0xffff) -+ continue; -+ /* HDMI Hotplug event - connect */ -+ uint16_t oldAddress = m_physicalAddress; -+ -+ if (oldAddress != GetPhysicalAddress()) { -+ if (m_PAReporter) -+ while (m_PAReporter->IsRunning()) Sleep(5); -+ delete m_PAReporter; -+ -+ m_PAReporter = new CCECPAChangedReporter(m_callback, m_physicalAddress); -+ m_PAReporter->CreateThread(false); -+ } -+#ifdef CEC_DEBUGGING -+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: plugin event received", __func__); -+#endif -+ } -+ else -+ LIB_CEC->AddLog(CEC_LOG_WARNING, "%s: unhandled response received %d!", __func__, event.event_type); -+ } -+ } -+ -+ return 0; -+} -+ -+CCECPAChangedReporter::CCECPAChangedReporter(IAdapterCommunicationCallback *callback, uint16_t newPA) : -+ m_callback(callback), -+ m_newPA(newPA) -+{ -+} -+ -+void* CCECPAChangedReporter::Process(void) -+{ -+ m_callback->HandlePhysicalAddressChanged(m_newPA); -+ return NULL; -+} -+ -+#endif // HAVE_IMX_API -diff --git a/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h -new file mode 100644 -index 0000000..2da38c1 ---- /dev/null -+++ b/src/libcec/adapter/IMX/IMXCECAdapterCommunication.h -@@ -0,0 +1,139 @@ -+#pragma once -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * IMX adpater port is Copyright (C) 2013 by Stephan Rafin -+ * Copyright (C) 2014 by Matus Kral -+ * -+ * You can redistribute this file 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * -+ */ -+ -+#if defined(HAVE_IMX_API) -+ -+#include "adapter/AdapterCommunication.h" -+#include -+#include -+#include -+#include "adapter/IMX/mxc_hdmi-cec.h" -+#include -+ -+#define IMX_ADAPTER_VID 0x0471 /*FIXME TBD*/ -+#define IMX_ADAPTER_PID 0x1001 -+ -+typedef struct hdmi_cec_event{ -+ uint8_t event_type; -+ uint8_t msg_len; -+ uint8_t msg[MAX_MESSAGE_LEN]; -+}hdmi_cec_event; -+ -+ -+namespace P8PLATFORM -+{ -+ class CCDevSocket; -+}; -+ -+namespace CEC -+{ -+ class CIMXCECAdapterMessageQueueEntry; -+ -+ class CCECPAChangedReporter : public P8PLATFORM::CThread -+ { -+ public: -+ CCECPAChangedReporter(IAdapterCommunicationCallback *callback, uint16_t newPA); -+ void* Process(void); -+ -+ private: -+ IAdapterCommunicationCallback *m_callback; -+ uint16_t m_newPA; -+ }; -+ -+ class CIMXCECAdapterCommunication : public IAdapterCommunication, public P8PLATFORM::CThread -+ { -+ public: -+ /*! -+ * @brief Create a new USB-CEC communication handler. -+ * @param callback The callback to use for incoming CEC commands. -+ */ -+ CIMXCECAdapterCommunication(IAdapterCommunicationCallback *callback); -+ virtual ~CIMXCECAdapterCommunication(void); -+ -+ /** @name IAdapterCommunication implementation */ -+ ///{ -+ bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true); -+ void Close(void); -+ bool IsOpen(void); -+ std::string GetError(void) const; -+ cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool bIsReply); -+ -+ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; } -+ bool StartBootloader(void) { return false; } -+ bool SetLogicalAddresses(const cec_logical_addresses &addresses); -+ cec_logical_addresses GetLogicalAddresses(void); -+ bool PingAdapter(void) { return IsInitialised(); } -+ uint16_t GetFirmwareVersion(void); -+ uint32_t GetFirmwareBuildDate(void) { return 0; } -+ bool IsRunningLatestFirmware(void) { return true; } -+ bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) { return false; } -+ bool GetConfiguration(libcec_configuration & UNUSED(configuration)) { return false; } -+ std::string GetPortName(void) { return std::string("IMX"); } -+ uint16_t GetPhysicalAddress(void); -+ bool SetControlledMode(bool UNUSED(controlled)) { return true; } -+ cec_vendor_id GetVendorId(void); -+ void HandleLogicalAddressLost(cec_logical_address UNUSED(oldAddress)); -+ bool SupportsSourceLogicalAddress(const cec_logical_address address) { return address > CECDEVICE_TV && address <= CECDEVICE_BROADCAST; } -+ cec_adapter_type GetAdapterType(void) { return ADAPTERTYPE_IMX; } -+ uint16_t GetAdapterVendorId(void) const { return IMX_ADAPTER_VID; } -+ uint16_t GetAdapterProductId(void) const { return IMX_ADAPTER_PID; } -+ void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {} -+ ///} -+ -+ /** @name PLATFORM::CThread implementation */ -+ ///{ -+ void *Process(void); -+ ///} -+ -+ private: -+ bool IsInitialised(void) { return m_bInitialised; }; -+ bool RegisterLogicalAddress(const cec_logical_address address); -+ bool UnregisterLogicalAddress(void); -+ -+ std::string m_strError; /**< current error message */ -+ -+ cec_logical_address m_logicalAddress; -+ uint16_t m_physicalAddress; -+ -+ P8PLATFORM::CMutex m_mutex; -+ P8PLATFORM::CCDevSocket *m_dev; /**< the device connection */ -+ -+ P8PLATFORM::CMutex m_messageMutex; -+ uint32_t m_iNextMessage; -+ std::map m_messages; -+ -+ bool m_bLogicalAddressRegistered; -+ bool m_bInitialised; -+ -+ CCECPAChangedReporter *m_PAReporter; -+ }; -+ -+}; -+ -+#endif -diff --git a/src/libcec/adapter/IMX/IMXCECAdapterDetection.cpp b/src/libcec/adapter/IMX/IMXCECAdapterDetection.cpp -new file mode 100644 -index 0000000..6c93c45 ---- /dev/null -+++ b/src/libcec/adapter/IMX/IMXCECAdapterDetection.cpp -@@ -0,0 +1,42 @@ -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * IMX adpater port is Copyright (C) 2013 by Stephan Rafin -+ * -+ * You can redistribute this file 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * -+ */ -+ -+#include "env.h" -+#include -+ -+#if defined(HAVE_IMX_API) -+#include "IMXCECAdapterDetection.h" -+ -+ -+using namespace CEC; -+ -+bool CIMXCECAdapterDetection::FindAdapter(void) -+{ -+ return access(CEC_IMX_PATH, 0) == 0; -+} -+ -+#endif -diff --git a/src/libcec/adapter/IMX/IMXCECAdapterDetection.h b/src/libcec/adapter/IMX/IMXCECAdapterDetection.h -new file mode 100644 -index 0000000..d54891d ---- /dev/null -+++ b/src/libcec/adapter/IMX/IMXCECAdapterDetection.h -@@ -0,0 +1,36 @@ -+#pragma once -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * IMX adpater port is Copyright (C) 2013 by Stephan Rafin -+ * -+ * You can redistribute this file 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * -+ */ -+ -+namespace CEC -+{ -+ class CIMXCECAdapterDetection -+ { -+ public: -+ static bool FindAdapter(void); -+ }; -+} -diff --git a/src/libcec/adapter/IMX/IMXCECAdapterMessageQueue.h b/src/libcec/adapter/IMX/IMXCECAdapterMessageQueue.h -new file mode 100644 -index 0000000..e54c192 ---- /dev/null -+++ b/src/libcec/adapter/IMX/IMXCECAdapterMessageQueue.h -@@ -0,0 +1,118 @@ -+#pragma once -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * This program is dual-licensed; 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * -+ * Alternatively, you can license this library under a commercial license, -+ * please contact Pulse-Eight Licensing for more information. -+ * -+ * For more information contact: -+ * Pulse-Eight Licensing -+ * http://www.pulse-eight.com/ -+ * http://www.pulse-eight.net/ -+ */ -+ -+#include -+ -+namespace CEC -+{ -+ using namespace P8PLATFORM; -+ -+ class CIMXCECAdapterMessageQueueEntry -+ { -+ public: -+ CIMXCECAdapterMessageQueueEntry(uint8_t addrs, cec_opcode opcode) -+ : m_bWaiting(true), m_retval((uint32_t)-1), m_bSucceeded(false) -+ { -+ m_opcode = opcode; -+ m_addrs = addrs; -+ } -+ -+ virtual ~CIMXCECAdapterMessageQueueEntry(void) {} -+ -+ /*! -+ * @brief Query result from worker thread -+ */ -+ uint32_t Result() const -+ { -+ return m_retval; -+ } -+ -+ /*! -+ * @brief Signal waiting threads -+ */ -+ void Broadcast(void) -+ { -+ CLockObject lock(m_mutex); -+ m_condition.Broadcast(); -+ } -+ -+ /*! -+ * @brief Signal waiting thread(s) when message matches this entry -+ */ -+ bool Received(int response, uint8_t addrs, cec_opcode opcode) -+ { -+ CLockObject lock(m_mutex); -+ -+ if (!(m_addrs == addrs && m_opcode == opcode)) -+ return false; -+ -+ m_retval = response; -+ m_bSucceeded = true; -+ m_condition.Signal(); -+ return true; -+ } -+ -+ /*! -+ * @brief Wait for a response to this command. -+ * @param iTimeout The timeout to use while waiting. -+ * @return True when a response was received before the timeout passed, false otherwise. -+ */ -+ bool Wait(uint32_t iTimeout) -+ { -+ CLockObject lock(m_mutex); -+ -+ bool bReturn = m_bSucceeded ? true : m_condition.Wait(m_mutex, m_bSucceeded, iTimeout); -+ m_bWaiting = false; -+ return bReturn; -+ } -+ -+ /*! -+ * @return True while a thread is waiting for a signal or isn't waiting yet, false otherwise. -+ */ -+ bool IsWaiting(void) -+ { -+ CLockObject lock(m_mutex); -+ return m_bWaiting; -+ } -+ -+ private: -+ bool m_bWaiting; /**< true while a thread is waiting or when it hasn't started waiting yet */ -+ P8PLATFORM::CCondition m_condition; /**< the condition to wait on */ -+ P8PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */ -+ int m_retval; -+ bool m_bSucceeded; -+ uint8_t m_addrs; -+ cec_opcode m_opcode; -+ }; -+ -+}; -diff --git a/src/libcec/adapter/IMX/mxc_hdmi-cec.h b/src/libcec/adapter/IMX/mxc_hdmi-cec.h -new file mode 100644 -index 0000000..bc5bbce ---- /dev/null -+++ b/src/libcec/adapter/IMX/mxc_hdmi-cec.h -@@ -0,0 +1,47 @@ -+/* -+ * Copyright 2005-2013 Freescale Semiconductor, Inc. All Rights Reserved. -+ */ -+ -+/* -+ * The code contained herein is licensed under the GNU General Public -+ * License. You may obtain a copy of the GNU General Public License -+ * Version 2 or later at the following locations: -+ * -+ * http://www.opensource.org/licenses/gpl-license.html -+ * http://www.gnu.org/copyleft/gpl.html -+ */ -+#ifndef _HDMICEC_H_ -+#define _HDMICEC_H_ -+#include -+ -+/* -+ * Ioctl definitions -+ */ -+ -+/* Use 'k' as magic number */ -+#define HDMICEC_IOC_MAGIC 'H' -+/* -+ * S means "Set" through a ptr, -+ * T means "Tell" directly with the argument value -+ * G means "Get": reply by setting through a pointer -+ * Q means "Query": response is on the return value -+ * X means "eXchange": G and S atomically -+ * H means "sHift": T and Q atomically -+ */ -+#define HDMICEC_IOC_SETLOGICALADDRESS \ -+ _IOW(HDMICEC_IOC_MAGIC, 1, unsigned char) -+#define HDMICEC_IOC_STARTDEVICE _IO(HDMICEC_IOC_MAGIC, 2) -+#define HDMICEC_IOC_STOPDEVICE _IO(HDMICEC_IOC_MAGIC, 3) -+#define HDMICEC_IOC_GETPHYADDRESS \ -+ _IOR(HDMICEC_IOC_MAGIC, 4, unsigned char[4]) -+ -+#define MAX_MESSAGE_LEN 16 -+ -+#define MESSAGE_TYPE_RECEIVE_SUCCESS 1 -+#define MESSAGE_TYPE_NOACK 2 -+#define MESSAGE_TYPE_DISCONNECTED 3 -+#define MESSAGE_TYPE_CONNECTED 4 -+#define MESSAGE_TYPE_SEND_SUCCESS 5 -+ -+#endif /* !_HDMICEC_H_ */ -+ -diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake -index 532f213..a89e404 100644 ---- a/src/libcec/cmake/CheckPlatformSupport.cmake -+++ b/src/libcec/cmake/CheckPlatformSupport.cmake -@@ -91,24 +91,49 @@ else() - endif() - - # xrandr -- check_include_files("X11/Xlib.h;X11/Xatom.h;X11/extensions/Xrandr.h" HAVE_RANDR_HEADERS) -- check_library_exists(Xrandr XRRGetScreenResources "" HAVE_RANDR_LIB) -- if (HAVE_RANDR_HEADERS AND HAVE_RANDR_LIB) -- set(LIB_INFO "${LIB_INFO}, randr") -- list(APPEND CEC_SOURCES_PLATFORM platform/X11/randr-edid.cpp) -- SET(HAVE_RANDR ON CACHE BOOL "xrandr supported" FORCE) -+ if (${HAVE_RANDR_API}) -+ check_include_files("X11/Xlib.h;X11/Xatom.h;X11/extensions/Xrandr.h" HAVE_RANDR_HEADERS) -+ check_library_exists(Xrandr XRRGetScreenResources "" HAVE_RANDR_LIB) -+ if (HAVE_RANDR_HEADERS AND HAVE_RANDR_LIB) -+ set(LIB_INFO "${LIB_INFO}, randr") -+ list(APPEND CEC_SOURCES_PLATFORM platform/X11/randr-edid.cpp) -+ set(HAVE_RANDR 1) -+ else() -+ set(HAVE_RANDR 0) -+ endif() -+ else() -+ set(HAVE_RANDR 0) - endif() - -+ # iMX6 -+ if (${HAVE_IMX_API}) -+ set(LIB_INFO "${LIB_INFO}, iMX6") -+ set(HAVE_IMX_API 1) -+ set(CEC_SOURCES_ADAPTER_IMX adapter/IMX/IMXCECAdapterDetection.cpp -+ adapter/IMX/IMXCECAdapterCommunication.cpp) -+ source_group("Source Files\\adapter\\iMX6" FILES ${CEC_SOURCES_ADAPTER_IMX}) -+ list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_IMX}) -+ set(HAVE_RPI_API 0) -+ else() -+ set(HAVE_IMX_API 0) -+ set(HAVE_RPI_API 1) -+ endif() -+ - # raspberry pi -- find_library(RPI_BCM_HOST bcm_host "${RPI_LIB_DIR}") -- check_library_exists(bcm_host bcm_host_init "${RPI_LIB_DIR}" HAVE_RPI_LIB) -- if (HAVE_RPI_LIB) -- SET(HAVE_RPI_API ON CACHE BOOL "raspberry pi supported" FORCE) -+ if (HAVE_RPI_API) -+ find_library(RPI_BCM_HOST bcm_host "${RPI_LIB_DIR}") -+ check_library_exists(bcm_host bcm_host_init "${RPI_LIB_DIR}" HAVE_RPI_API) -+ endif() -+ if (HAVE_RPI_API) - find_library(RPI_VCOS vcos "${RPI_LIB_DIR}") - find_library(RPI_VCHIQ_ARM vchiq_arm "${RPI_LIB_DIR}") - include_directories(${RPI_INCLUDE_DIR} ${RPI_INCLUDE_DIR}/interface/vcos/pthreads ${RPI_INCLUDE_DIR}/interface/vmcs_host/linux) - -- set(LIB_INFO "${LIB_INFO}, RPi") -+ set(LIB_INFO "${LIB_INFO}, 'RPi'") -+ # find includes files on Raspberry Pi -+ include_directories(/opt/vc/include /opt/vc/include/interface/vcos/pthreads /opt/vc/include/interface/vmcs_host/linux) -+ list(APPEND CMAKE_REQUIRED_LIBRARIES "vcos") -+ list(APPEND CMAKE_REQUIRED_LIBRARIES "vchiq_arm") - set(CEC_SOURCES_ADAPTER_RPI adapter/RPi/RPiCECAdapterDetection.cpp - adapter/RPi/RPiCECAdapterCommunication.cpp - adapter/RPi/RPiCECAdapterMessageQueue.cpp) -@@ -148,6 +173,8 @@ else() - else() - set(HAVE_AOCEC_API 0) - endif() -+ -+ - endif() - - # rt -diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake -index 7ec10f5..2262638 100644 ---- a/src/libcec/cmake/DisplayPlatformSupport.cmake -+++ b/src/libcec/cmake/DisplayPlatformSupport.cmake -@@ -45,9 +45,15 @@ else() - endif() - - if (HAVE_AOCEC_API) -- message(STATUS "AOCEC support: yes") -+ message(STATUS "AOCEC support: yes") - else() -- message(STATUS "AOCEC support: no") -+ message(STATUS "AOCEC support: no") -+endif() -+ -+if (HAVE_IMX_API) -+ message(STATUS "i.MX6 support: yes") -+else() -+ message(STATUS "i.MX6 support: no") - endif() - - if (HAVE_PYTHON) -diff --git a/src/libcec/cmake/LinkPlatformSupport.cmake b/src/libcec/cmake/LinkPlatformSupport.cmake -index fc27353..b203f6f 100644 ---- a/src/libcec/cmake/LinkPlatformSupport.cmake -+++ b/src/libcec/cmake/LinkPlatformSupport.cmake -@@ -28,7 +28,12 @@ endif() - - # raspberry pi - if (HAVE_RPI_API) -- target_link_libraries(cec ${RPI_VCOS} ${RPI_VCHIQ_ARM} ${RPI_BCM_HOST}) -+ find_library (VCOS vcos) -+ target_link_libraries(cec ${VCOS}) -+ find_library (VCHIQ_ARM vchiq_arm) -+ target_link_libraries(cec ${VCHIP_ARM}) -+ find_library (BCM_HOST bcm_host) -+ target_link_libraries(cec ${BCM_HOST}) - endif() - - # Apple -diff --git a/src/libcec/cmake/git-rev.sh b/src/libcec/cmake/git-rev.sh -index db682c1..15b6a23 100755 ---- a/src/libcec/cmake/git-rev.sh -+++ b/src/libcec/cmake/git-rev.sh -@@ -2,7 +2,7 @@ - - ## cmake doesn't read the variable when it doesn't end with a newline, and I haven't figured out how to have it add a newline directly... - if git rev-parse --git-dir > /dev/null 2>&1; then -- last_tag=`git describe --tags --abbrev=0` -+ last_tag=`git describe --tags --abbrev=0 --all` - last_hash=`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h"` - commits_since_tag=`git log ${last_tag}..HEAD --oneline | wc -l` - git_dirty=`git diff HEAD | wc -l` -diff --git a/src/libcec/devices/CECBusDevice.cpp b/src/libcec/devices/CECBusDevice.cpp -index 612be6d..2be9816 100644 ---- a/src/libcec/devices/CECBusDevice.cpp -+++ b/src/libcec/devices/CECBusDevice.cpp -@@ -44,6 +44,7 @@ - #include "implementations/RLCommandHandler.h" - #include "implementations/RHCommandHandler.h" - #include "implementations/AQCommandHandler.h" -+#include "implementations/GRCommandHandler.h" - #include "LibCEC.h" - #include "CECTypeUtils.h" - #include -@@ -217,6 +218,9 @@ bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */) - case CEC_VENDOR_SHARP2: - m_handler = new CAQCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); - break; -+ case CEC_VENDOR_GRUNDIG: -+ m_handler = new CGRCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); -+ break; - default: - m_handler = new CCECCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); - break; -@@ -1263,7 +1267,7 @@ bool CCECBusDevice::PowerOn(const cec_logical_address initiator) - - MarkBusy(); - cec_power_status currentStatus; -- if (m_iLogicalAddress == CECDEVICE_TV || -+ if ((m_iLogicalAddress == CECDEVICE_TV && !ImageViewOnSent()) || - ((currentStatus = GetPowerStatus(initiator, false)) != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON && - currentStatus != CEC_POWER_STATUS_ON)) - { -@@ -1498,3 +1502,8 @@ bool CCECBusDevice::TransmitMuteAudio(const cec_logical_address source) - return TransmitKeypress(source, CEC_USER_CONTROL_CODE_MUTE) && - TransmitKeyRelease(source); - } -+ -+bool CCECBusDevice::TransmitSystemAudioModeRequest(const cec_logical_address initiator) -+{ -+ return m_handler->TransmitSystemAudioModeRequest(initiator, m_iPhysicalAddress, false); -+} -diff --git a/src/libcec/devices/CECBusDevice.h b/src/libcec/devices/CECBusDevice.h -index b8255aa..8493d48 100644 ---- a/src/libcec/devices/CECBusDevice.h -+++ b/src/libcec/devices/CECBusDevice.h -@@ -199,6 +199,8 @@ namespace CEC - void SignalOpcode(cec_opcode opcode); - bool WaitForOpcode(cec_opcode opcode); - -+ virtual bool TransmitSystemAudioModeRequest(const cec_logical_address initiator); -+ - CCECAudioSystem * AsAudioSystem(void); - static CCECAudioSystem * AsAudioSystem(CCECBusDevice *device); - CCECPlaybackDevice * AsPlaybackDevice(void); -diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in -index fe6c83d..91c7a27 100644 ---- a/src/libcec/env.h.in -+++ b/src/libcec/env.h.in -@@ -66,6 +66,9 @@ - /* Define to 1 for Raspberry Pi support */ - #cmakedefine HAVE_RPI_API @HAVE_RPI_API@ - -+/* Define to 1 for iMX6 support */ -+#cmakedefine HAVE_IMX_API @HAVE_IMX_API@ -+ - /* Define to 1 for TDA995x support */ - #cmakedefine HAVE_TDA995X_API @HAVE_TDA995X_API@ - -diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp -index 71c2230..5a1e7a0 100644 ---- a/src/libcec/implementations/CECCommandHandler.cpp -+++ b/src/libcec/implementations/CECCommandHandler.cpp -@@ -62,6 +62,7 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice, - m_iTransmitRetries(iTransmitRetries), - m_bHandlerInited(false), - m_bOPTSendDeckStatusUpdateOnActiveSource(false), -+ m_bOPTSendMenuStatusUpdateOnActiveSource(true), - m_vendorId(CEC_VENDOR_UNKNOWN), - m_iActiveSourcePending(iActiveSourcePending), - m_iPowerStatusRequested(0) -@@ -1133,6 +1134,19 @@ bool CCECCommandHandler::TransmitAudioStatus(const cec_logical_address iInitiato - return Transmit(command, false, bIsReply); - } - -+bool CCECCommandHandler::TransmitSystemAudioModeRequest(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, bool bIsReply) -+{ -+ cec_command command; -+ cec_command::Format(command, iInitiator, CECDEVICE_AUDIOSYSTEM, CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST); -+ command.parameters.PushBack((uint8_t) ((iPhysicalAddress >> 8) & 0xFF)); -+ command.parameters.PushBack((uint8_t) (iPhysicalAddress & 0xFF)); -+ -+ if (Transmit(command, true, bIsReply)) -+ return true; -+ -+ return false; -+} -+ - bool CCECCommandHandler::TransmitSetSystemAudioMode(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state, bool bIsReply) - { - cec_command command; -@@ -1307,7 +1321,7 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f - if (!bActiveSourceFailed && bSourceSwitchAllowed) - { - bActiveSourceFailed = !m_busDevice->TransmitActiveSource(false); -- if (bTvPresent && !bActiveSourceFailed) -+ if (bTvPresent && !bActiveSourceFailed && SendMenuStatusUpdateOnActiveSource()) - m_busDevice->TransmitMenuState(CECDEVICE_TV, false); - - // update the deck status for playback devices -diff --git a/src/libcec/implementations/CECCommandHandler.h b/src/libcec/implementations/CECCommandHandler.h -index 8ff9a1e..eb52ed3 100644 ---- a/src/libcec/implementations/CECCommandHandler.h -+++ b/src/libcec/implementations/CECCommandHandler.h -@@ -60,7 +60,9 @@ namespace CEC - virtual bool HandleCommand(const cec_command &command); - virtual cec_vendor_id GetVendorId(void) { return m_vendorId; }; - virtual void SetVendorId(cec_vendor_id vendorId) { m_vendorId = vendorId; } -- static bool HasSpecificHandler(cec_vendor_id vendorId) { return vendorId == CEC_VENDOR_LG || vendorId == CEC_VENDOR_SAMSUNG || vendorId == CEC_VENDOR_PANASONIC || vendorId == CEC_VENDOR_PHILIPS || vendorId == CEC_VENDOR_SHARP || vendorId == CEC_VENDOR_SHARP2 || vendorId == CEC_VENDOR_TOSHIBA || vendorId == CEC_VENDOR_TOSHIBA2 || vendorId == CEC_VENDOR_ONKYO;} -+ static bool HasSpecificHandler(cec_vendor_id vendorId) { return vendorId == CEC_VENDOR_LG || vendorId == CEC_VENDOR_SAMSUNG || vendorId == CEC_VENDOR_PANASONIC || vendorId == CEC_VENDOR_PHILIPS -+ || vendorId == CEC_VENDOR_SHARP || vendorId == CEC_VENDOR_SHARP2 || vendorId == CEC_VENDOR_TOSHIBA || vendorId == CEC_VENDOR_TOSHIBA2 || vendorId == CEC_VENDOR_ONKYO -+ || vendorId == CEC_VENDOR_GRUNDIG; } - - virtual bool InitHandler(void) { return true; } - virtual bool ActivateSource(bool bTransmitDelayedCommandsOnly = false); -@@ -89,6 +91,7 @@ namespace CEC - virtual bool TransmitPowerState(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_power_status state, bool bIsReply); - virtual bool TransmitVendorID(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint64_t iVendorId, bool bIsReply); - virtual bool TransmitAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint8_t state, bool bIsReply); -+ virtual bool TransmitSystemAudioModeRequest(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, bool bIsReply); - virtual bool TransmitSetSystemAudioMode(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state, bool bIsReply); - virtual bool TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state, bool bIsReply); - virtual bool TransmitDeckStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_deck_info state, bool bIsReply); -@@ -97,6 +100,7 @@ namespace CEC - virtual bool TransmitSystemAudioModeRequest(const cec_logical_address iInitiator, uint16_t iPhysicalAddress); - virtual bool TransmitSetStreamPath(uint16_t iStreamPath, bool bIsReply); - virtual bool SendDeckStatusUpdateOnActiveSource(void) const { return m_bOPTSendDeckStatusUpdateOnActiveSource; }; -+ virtual bool SendMenuStatusUpdateOnActiveSource(void) const { return m_bOPTSendMenuStatusUpdateOnActiveSource; }; - - virtual void ScheduleActivateSource(uint64_t iDelay); - -@@ -165,6 +169,7 @@ namespace CEC - int8_t m_iTransmitRetries; - bool m_bHandlerInited; - bool m_bOPTSendDeckStatusUpdateOnActiveSource; -+ bool m_bOPTSendMenuStatusUpdateOnActiveSource; - cec_vendor_id m_vendorId; - int64_t m_iActiveSourcePending; - P8PLATFORM::CMutex m_mutex; -diff --git a/src/libcec/implementations/GRCommandHandler.cpp b/src/libcec/implementations/GRCommandHandler.cpp -new file mode 100644 -index 0000000..af49af9 ---- /dev/null -+++ b/src/libcec/implementations/GRCommandHandler.cpp -@@ -0,0 +1,92 @@ -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * This program is dual-licensed; 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -+ * 02110-1301 USA -+ * -+ * -+ * Alternatively, you can license this library under a commercial license, -+ * please contact Pulse-Eight Licensing for more information. -+ * -+ * For more information contact: -+ * Pulse-Eight Licensing -+ * http://www.pulse-eight.com/ -+ * http://www.pulse-eight.net/ -+ */ -+ -+#include "env.h" -+#include "GRCommandHandler.h" -+ -+#include "devices/CECBusDevice.h" -+#include "CECProcessor.h" -+#include "LibCEC.h" -+#include "CECClient.h" -+ -+using namespace CEC; -+ -+#define LIB_CEC m_busDevice->GetProcessor()->GetLib() -+#define ToString(p) LIB_CEC->ToString(p) -+ -+CGRCommandHandler::CGRCommandHandler(CCECBusDevice *busDevice, -+ int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */, -+ int32_t iTransmitWait /* = CEC_DEFAULT_TRANSMIT_WAIT */, -+ int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */, -+ int64_t iActiveSourcePending /* = 0 */) : -+ CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending) -+{ -+ m_vendorId = CEC_VENDOR_GRUNDIG; -+ m_bOPTSendMenuStatusUpdateOnActiveSource = false; -+ -+ m_busDevice->SetCecVersion(CEC_VERSION_1_3A); -+ -+ /* Grundig devices return "" as language */ -+ cec_menu_language lang; -+ snprintf(lang, 4, "eng"); -+ m_busDevice->SetMenuLanguage(lang); -+} -+ -+bool CGRCommandHandler::InitHandler(void) -+{ -+ if (m_bHandlerInited) -+ return true; -+ m_bHandlerInited = true; -+ -+ if (m_busDevice->GetLogicalAddress() != CECDEVICE_TV) -+ return true; -+ -+ CCECBusDevice *primary = m_processor->GetPrimaryDevice(); -+ if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED) -+ { -+ /* imitate Toshiba devices */ -+ if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) -+ { -+ primary->SetVendorId(CEC_VENDOR_GRUNDIG); -+ primary->ReplaceHandler(false); -+ } -+ -+ if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) -+ { -+ /* send the vendor id */ -+ primary->TransmitVendorID(CECDEVICE_BROADCAST, false, false); -+ } -+ } -+ -+ return true; -+} -diff --git a/src/libcec/implementations/GRCommandHandler.h b/src/libcec/implementations/GRCommandHandler.h -new file mode 100644 -index 0000000..e01c7fc ---- /dev/null -+++ b/src/libcec/implementations/GRCommandHandler.h -@@ -0,0 +1,53 @@ -+#pragma once -+/* -+ * This file is part of the libCEC(R) library. -+ * -+ * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. -+ * libCEC(R) is an original work, containing original code. -+ * -+ * libCEC(R) is a trademark of Pulse-Eight Limited. -+ * -+ * This program is dual-licensed; 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 program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -+ * 02110-1301 USA -+ * -+ * -+ * Alternatively, you can license this library under a commercial license, -+ * please contact Pulse-Eight Licensing for more information. -+ * -+ * For more information contact: -+ * Pulse-Eight Licensing -+ * http://www.pulse-eight.com/ -+ * http://www.pulse-eight.net/ -+ */ -+ -+#include "env.h" -+#include "CECCommandHandler.h" -+#include "p8-platform/threads/threads.h" -+ -+namespace CEC -+{ -+ class CGRCommandHandler : public CCECCommandHandler -+ { -+ public: -+ CGRCommandHandler(CCECBusDevice *busDevice, -+ int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, -+ int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, -+ int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, -+ int64_t iActiveSourcePending = 0); -+ -+ bool InitHandler(void); -+ virtual ~CGRCommandHandler(void) {}; -+ }; -+}; --- -2.7.1 - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch b/projects/imx6/patches/linux/3.14-mx6-sr/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch deleted file mode 100644 index 8091ff256f..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/999.01-LLVMLinux_use_static_inline_in_ARM_ftrace.h.patch +++ /dev/null @@ -1,52 +0,0 @@ -From aeea3592a13bf12861943e44fc48f1f270941f8d Mon Sep 17 00:00:00 2001 -From: Behan Webster -Date: Wed, 24 Sep 2014 01:06:46 +0100 -Subject: ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h - -With compilers which follow the C99 standard (like modern versions of gcc and -clang), "extern inline" does the wrong thing (emits code for an externally -linkable version of the inline function). In this case using static inline -and removing the NULL version of return_address in return_address.c does -the right thing. - -Signed-off-by: Behan Webster -Reviewed-by: Mark Charlebois -Acked-by: Steven Rostedt -Signed-off-by: Russell King ---- - arch/arm/include/asm/ftrace.h | 2 +- - arch/arm/kernel/return_address.c | 5 ----- - 2 files changed, 1 insertion(+), 6 deletions(-) - -diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h -index 39eb16b..bfe2a2f 100644 ---- a/arch/arm/include/asm/ftrace.h -+++ b/arch/arm/include/asm/ftrace.h -@@ -45,7 +45,7 @@ void *return_address(unsigned int); - - #else - --extern inline void *return_address(unsigned int level) -+static inline void *return_address(unsigned int level) - { - return NULL; - } -diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c -index fafedd8..f6aa84d 100644 ---- a/arch/arm/kernel/return_address.c -+++ b/arch/arm/kernel/return_address.c -@@ -63,11 +63,6 @@ void *return_address(unsigned int level) - #warning "TODO: return_address should use unwind tables" - #endif - --void *return_address(unsigned int level) --{ -- return NULL; --} -- - #endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */ - - EXPORT_SYMBOL_GPL(return_address); --- -cgit v0.11.2 - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch b/projects/imx6/patches/linux/3.14-mx6-sr/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch deleted file mode 100644 index 0ab03fb9da..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/999.02-ARM-LLVMLinux-Change-extern-inline-to-static-inline.patch +++ /dev/null @@ -1,59 +0,0 @@ -From a2561791169351cbf1ac5ca0c4299a0eef7eca65 Mon Sep 17 00:00:00 2001 -From: Behan Webster -Date: Tue, 3 Sep 2013 22:27:26 -0400 -Subject: [PATCH] ARM: LLVMLinux: Change "extern inline" to "static inline" in - glue-cache.h - -With compilers which follow the C99 standard (like modern versions of gcc and -clang), "extern inline" does the wrong thing (emits code for an externally -linkable version of the inline function). "static inline" is the correct choice -instead. - -Author: Behan Webster -Signed-off-by: Behan Webster -Reviewed-by: Mark Charlebois ---- - arch/arm/include/asm/glue-cache.h | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h -index c81adc0..a3c24cd 100644 ---- a/arch/arm/include/asm/glue-cache.h -+++ b/arch/arm/include/asm/glue-cache.h -@@ -130,22 +130,22 @@ - #endif - - #ifndef __ASSEMBLER__ --extern inline void nop_flush_icache_all(void) { } --extern inline void nop_flush_kern_cache_all(void) { } --extern inline void nop_flush_kern_cache_louis(void) { } --extern inline void nop_flush_user_cache_all(void) { } --extern inline void nop_flush_user_cache_range(unsigned long a, -+static inline void nop_flush_icache_all(void) { } -+static inline void nop_flush_kern_cache_all(void) { } -+static inline void nop_flush_kern_cache_louis(void) { } -+static inline void nop_flush_user_cache_all(void) { } -+static inline void nop_flush_user_cache_range(unsigned long a, - unsigned long b, unsigned int c) { } - --extern inline void nop_coherent_kern_range(unsigned long a, unsigned long b) { } --extern inline int nop_coherent_user_range(unsigned long a, -+static inline void nop_coherent_kern_range(unsigned long a, unsigned long b) { } -+static inline int nop_coherent_user_range(unsigned long a, - unsigned long b) { return 0; } --extern inline void nop_flush_kern_dcache_area(void *a, size_t s) { } -+static inline void nop_flush_kern_dcache_area(void *a, size_t s) { } - --extern inline void nop_dma_flush_range(const void *a, const void *b) { } -+static inline void nop_dma_flush_range(const void *a, const void *b) { } - --extern inline void nop_dma_map_area(const void *s, size_t l, int f) { } --extern inline void nop_dma_unmap_area(const void *s, size_t l, int f) { } -+static inline void nop_dma_map_area(const void *s, size_t l, int f) { } -+static inline void nop_dma_unmap_area(const void *s, size_t l, int f) { } - #endif - - #ifndef MULTI_CACHE --- -2.1.4 - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-002-rename-sgtl5000-codec.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-002-rename-sgtl5000-codec.patch deleted file mode 100644 index ca6b807064..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-002-rename-sgtl5000-codec.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 3499e0d1703d361277e65419178152d792bd55dc Mon Sep 17 00:00:00 2001 -From: Peter Vicman -Date: Mon, 4 Jan 2016 19:55:37 +0100 -Subject: [PATCH] rename sgtl5000 codec - ---- - arch/arm/boot/dts/imx6qdl-hummingboard.dtsi | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi -index 2003262..d2446ef 100644 ---- a/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-hummingboard.dtsi -@@ -62,7 +62,7 @@ - "Mic Jack", "Mic Bias", - "Headphone Jack", "HP_OUT"; - compatible = "fsl,imx-audio-sgtl5000"; -- model = "On-board Codec"; -+ model = "imx-sgtl5000"; - mux-ext-port = <5>; - mux-int-port = <1>; - ssi-controller = <&ssi1>; --- -1.8.1.2 - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-004-fix-build-with-gcc-5.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-004-fix-build-with-gcc-5.patch deleted file mode 100644 index 89800d7bca..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-004-fix-build-with-gcc-5.patch +++ /dev/null @@ -1,16 +0,0 @@ -# see https://github.com/wongsyrone/openwrt-1/commit/93c0a5173414cfa7684547de3c3a1f3dc4240383 -# and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932 - -diff -Naur linux-cuboxi-3.14-ea83bda.orig/arch/arm/Makefile linux-cuboxi-3.14-ea83bda/arch/arm/Makefile ---- linux-cuboxi-3.14-ea83bda.orig/arch/arm/Makefile 2015-05-06 10:05:43.000000000 -0700 -+++ linux-cuboxi-3.14-ea83bda/arch/arm/Makefile 2015-10-05 13:51:43.641612713 -0700 -@@ -120,7 +120,8 @@ - endif - - # Need -Uarm for gcc < 3.x --KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm -+# Maybe we need -fno-ipa-sra for gcc > 4.9.x -+KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm -fno-ipa-sra - KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float - - CHECKFLAGS += -D__arm__ diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-007-config_cmdline.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-007-config_cmdline.patch deleted file mode 100644 index 60b772db0e..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-007-config_cmdline.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -urN a/drivers/of/fdt.c b/drivers/of/fdt.c ---- a/drivers/of/fdt.c 2015-01-13 20:49:42.799509145 +0100 -+++ b/drivers/of/fdt.c 2015-01-13 20:56:29.118557900 +0100 -@@ -804,6 +804,7 @@ - { - unsigned long l; - char *p; -+ char tmp_command_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; - - pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); - -@@ -822,12 +823,23 @@ - * CONFIG_CMDLINE is meant to be a default in case nothing else - * managed to set the command line, unless CONFIG_CMDLINE_FORCE - * is set in which case we override whatever was found earlier. -+ * -+ * But we do prepend CONFIG_CMDLINE to bootloader arguments anyway. - */ - #ifdef CONFIG_CMDLINE - #ifndef CONFIG_CMDLINE_FORCE - if (!((char *)data)[0]) --#endif - strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -+ else { -+ /* append bootloader arguments to CONFIG_CMDLINE */ -+ strlcat(tmp_command_line, " ", COMMAND_LINE_SIZE); -+ strlcat(tmp_command_line, data, COMMAND_LINE_SIZE); -+ /* copy everything back */ -+ strlcpy(data, tmp_command_line, COMMAND_LINE_SIZE); -+ } -+#else -+ strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -+#endif /* CONFIG_CMDLINE_FORCE */ - #endif /* CONFIG_CMDLINE */ - - pr_debug("Command line is: %s\n", (char*)data); diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-010_tivo_slide_pro.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-010_tivo_slide_pro.patch deleted file mode 100644 index 4fea696523..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-010_tivo_slide_pro.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 716d6bc9f73bd366d4b64b473055af79810d67fc Mon Sep 17 00:00:00 2001 -From: Forest -Date: Thu, 12 Mar 2015 23:43:12 -0700 -Subject: [PATCH] hid: enable all buttons on the TiVo Slide Pro remote - -The linux kernel has supported the TiVo Slide remote control for some time, -but does not recognize the USB ID of the newer Slide Pro. This patch adds -the missing data structures so the newer remote will be recognized by the -driver, thereby allowing the TiVo, LiveTV, and Thumbs Up/Down buttons to be -mapped with a hwdb file. - -Signed-off-by: Forest ---- - drivers/hid/hid-core.c | 1 + - drivers/hid/hid-ids.h | 1 + - drivers/hid/hid-tivo.c | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index 1d0f2b6..722a925 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1980,6 +1980,7 @@ static const struct hid_device_id hid_have_special_driver[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 2dd6485..c739d3b 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -900,6 +900,7 @@ - #define USB_VENDOR_ID_TIVO 0x150a - #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 - #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 -+#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 - - #define USB_VENDOR_ID_TOPSEED 0x0766 - #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 -diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c -index d790d8d..d986969 100644 ---- a/drivers/hid/hid-tivo.c -+++ b/drivers/hid/hid-tivo.c -@@ -64,6 +64,7 @@ static const struct hid_device_id tivo_devices[] = { - /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, - { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, - { } - }; - MODULE_DEVICE_TABLE(hid, tivo_devices); --- -1.9.1 - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-051-ouya_controller_support.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-051-ouya_controller_support.patch deleted file mode 100644 index 48b36bdfa7..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-051-ouya_controller_support.patch +++ /dev/null @@ -1,315 +0,0 @@ -diff -Naur linux-3.15-rc6.orig/drivers/hid/hid-core.c linux-3.15-rc6/drivers/hid/hid-core.c ---- linux-3.15-rc6.orig/drivers/hid/hid-core.c 2014-06-06 13:46:49.711845049 -0700 -+++ linux-3.15-rc6/drivers/hid/hid-core.c 2014-06-06 13:50:33.019965538 -0700 -@@ -1848,6 +1848,7 @@ - { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2) }, -diff -Naur linux-3.15-rc6.orig/drivers/hid/hid-ids.h linux-3.15-rc6/drivers/hid/hid-ids.h ---- linux-3.15-rc6.orig/drivers/hid/hid-ids.h 2014-06-06 13:46:49.711845049 -0700 -+++ linux-3.15-rc6/drivers/hid/hid-ids.h 2014-06-06 13:51:36.146564828 -0700 -@@ -700,6 +700,9 @@ - #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 - #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 - -+#define USB_VENDOR_ID_OUYA 0x2836 -+#define USB_DEVICE_ID_OUYA_CONTROLLER 0x0001 -+ - #define USB_VENDOR_ID_PANASONIC 0x04da - #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044 - #define USB_DEVICE_ID_PANABOARD_UBT880 0x104d -diff -Naur linux-3.15-rc6.orig/drivers/hid/hid-ouya.c linux-3.15-rc6/drivers/hid/hid-ouya.c ---- linux-3.15-rc6.orig/drivers/hid/hid-ouya.c 1969-12-31 16:00:00.000000000 -0800 -+++ linux-3.15-rc6/drivers/hid/hid-ouya.c 2014-06-06 13:52:22.785007560 -0700 -@@ -0,0 +1,260 @@ -+/* -+ * HID driver for OUYA Game Controller(s) -+ * -+ * Copyright (c) 2013 OUYA -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "hid-ids.h" -+ -+#define OUYA_TOUCHPAD_FIXUP (1 << 0) -+ -+struct ouya_sc { -+ unsigned long quirks; -+}; -+ -+/* Fixed report descriptor */ -+static __u8 ouya_rdesc_fixed[] = { -+ -+ 0x05, 0x01, /* Usage Page (Desktop), */ -+ 0x09, 0x05, /* Usage (Game Pad), */ -+ -+ 0xA1, 0x01, /* Collection (Application), */ -+ 0x85, 0x07, /* Report ID (7), */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x30, /* Usage (X), */ -+ 0x09, 0x31, /* Usage (Y), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x02, /* Report Count (2), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x33, /* Usage (Rx), */ -+ 0x09, 0x34, /* Usage (Ry), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x02, /* Report Count (2), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x32, /* Usage (Z), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x09, 0x35, /* Usage (Rz), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x35, 0x00, /* Physical Minimum (0), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0x05, 0x09, /* Usage Page (Button), */ -+ 0x19, 0x01, /* Usage Minimum (01h), */ -+ 0x29, 0x10, /* Usage Maximum (10h), */ -+ 0x95, 0x10, /* Report Count (16), */ -+ 0x75, 0x01, /* Report Size (1), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ -+ /* ORIGINAL REPORT DESCRIPTOR FOR TOUCHPAD INPUT */ -+ /* 06 00 ff a1 02 09 02 15 00 26 ff 00 35 00 46 ff 00 95 03 75 08 81 02 c0 */ -+ -+ 0x06, 0x00, 0xFF, /* Usage Page (Custom), */ -+ 0x09, 0x02, /* Usage (Mouse), */ -+ 0x09, 0x01, /* Usage (Pointer), */ -+ 0xA1, 0x00, /* Collection (Physical), */ -+ 0x05, 0x09, /* Usage Page (Button), */ -+ 0x19, 0x01, /* Usage Minimum (01h), */ -+ 0x29, 0x03, /* Usage Maximum (03h), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x25, 0x01, /* Logical Maximum (1), */ -+ 0x95, 0x03, /* Report Count (3), */ -+ 0x75, 0x01, /* Report Size (1), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x75, 0x05, /* Report Size (5), */ -+ 0x81, 0x01, /* Input (Constant), */ -+ 0x05, 0x01, /* Usage Page (Desktop), */ -+ 0x09, 0x30, /* Usage (X), */ -+ 0x09, 0x31, /* Usage (Y), */ -+ 0x15, 0x81, /* Logical Minimum (-127), */ -+ 0x25, 0x7f, /* Logical Maximum (127), */ -+ 0x95, 0x02, /* Report Count (2), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x81, 0x06, /* Input (Relative), */ -+ 0xC0, /* End Collection, */ -+ -+ 0x06, 0x00, 0xFF, /* Usage Page (Custom), */ -+ 0xA1, 0x02, /* Collection (Logical), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x95, 0x07, /* Report Count (7), */ -+ 0x46, 0xFF, 0x00, /* Physical Maximum (255), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x09, 0x01, /* Usage (Pointer), */ -+ 0x91, 0x02, /* Output (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xC0, /* End Collection */ -+ -+ -+ 0x06, 0x00, 0xFF, /* Usage Page (Custom), */ -+ 0x05, 0x0C, /* Usage Page (Consumer), */ -+ 0x09, 0x01, /* Usage (Consumer Control), */ -+ -+ 0xA1, 0x01, /* Collection (Application), */ -+ 0x85, 0x03, /* Report ID (3), */ -+ 0x05, 0x01, /* Usage Page (Desktop), */ -+ 0x09, 0x06, /* Usage (Keyboard), */ -+ 0xA1, 0x02, /* Collection (Logical), */ -+ 0x05, 0x06, /* Usage Page (Generic), */ -+ 0x09, 0x20, /* Usage (Battery Strgth), */ -+ 0x15, 0x00, /* Logical Minimum (0), */ -+ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x95, 0x01, /* Report Count (1), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0x06, 0xBC, 0xFF, /* Usage Page (Custom), */ -+ -+ 0x0A, 0xAD, 0xBD, /* UNKNOWN */ -+ -+ 0x75, 0x08, /* Report Size (8), */ -+ 0x95, 0x06, /* Report Count (6), */ -+ 0x81, 0x02, /* Input (Variable), */ -+ 0xC0, /* End Collection, */ -+ -+ 0xC0, /* End Collection */ -+ -+ 0x00 -+}; -+ -+static __u8 *ouya_report_fixup(struct hid_device *hdev, __u8 *rdesc, -+ unsigned int *rsize) -+{ -+ struct ouya_sc *sc = hid_get_drvdata(hdev); -+ -+ if (sc->quirks & OUYA_TOUCHPAD_FIXUP) { -+ rdesc = ouya_rdesc_fixed; -+ *rsize = sizeof(ouya_rdesc_fixed); -+ } -+ return rdesc; -+} -+ -+static int ouya_input_mapping(struct hid_device *hdev, struct hid_input *hi, -+ struct hid_field *field, struct hid_usage *usage, -+ unsigned long **bit, int *max) -+{ -+ struct ouya_sc *sc = hid_get_drvdata(hdev); -+ -+ if (!(sc->quirks & OUYA_TOUCHPAD_FIXUP)) { -+ return 0; -+ } -+ -+ if ((usage->hid & 0x90000) == 0x90000 && -+ (field->physical & 0xff000000) == 0xff000000 && -+ usage->collection_index == 5 && -+ field->report_count == 3) { -+ -+ hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_MOUSE + (usage->hid - 0x90001)); -+ -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static int ouya_probe(struct hid_device *hdev, const struct hid_device_id *id) -+{ -+ int ret; -+ struct ouya_sc *sc; -+ -+ sc = kzalloc(sizeof(*sc), GFP_KERNEL); -+ if (sc == NULL) { -+ hid_err(hdev, "can't alloc ouya descriptor\n"); -+ return -ENOMEM; -+ } -+ -+ if(((hdev->version & 0xff00) == 0x0100 && (hdev->version & 0xff) >= 0x04) || -+ ((hdev->version & 0xff00) == 0xe100 && (hdev->version & 0xff) >= 0x3a)) { -+ hid_info(hdev, "ouya controller - new version\n"); -+ sc->quirks = OUYA_TOUCHPAD_FIXUP; -+ } else { -+ sc->quirks = 0; -+ } -+ hid_set_drvdata(hdev, sc); -+ -+ ret = hid_parse(hdev); -+ if (ret) { -+ hid_err(hdev, "parse failed\n"); -+ goto err_free; -+ } -+ -+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | -+ HID_CONNECT_HIDDEV_FORCE); -+ if (ret) { -+ hid_err(hdev, "hw start failed\n"); -+ goto err_free; -+ } -+ -+ return 0; -+ -+err_free: -+ kfree(sc); -+ return ret; -+} -+ -+static void ouya_remove(struct hid_device *hdev) -+{ -+ hid_hw_stop(hdev); -+ kfree(hid_get_drvdata(hdev)); -+} -+ -+static const struct hid_device_id ouya_devices[] = { -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) }, -+ { } -+}; -+MODULE_DEVICE_TABLE(hid, ouya_devices); -+ -+static struct hid_driver ouya_driver = { -+ .name = "ouya", -+ .id_table = ouya_devices, -+ .probe = ouya_probe, -+ .remove = ouya_remove, -+ .input_mapping = ouya_input_mapping, -+ .report_fixup = ouya_report_fixup -+}; -+ -+static int __init ouya_init(void) -+{ -+ return hid_register_driver(&ouya_driver); -+} -+ -+static void __exit ouya_exit(void) -+{ -+ hid_unregister_driver(&ouya_driver); -+} -+ -+module_init(ouya_init); -+module_exit(ouya_exit); -diff -Naur linux-3.15-rc6.orig/drivers/hid/Kconfig linux-3.15-rc6/drivers/hid/Kconfig ---- linux-3.15-rc6.orig/drivers/hid/Kconfig 2014-06-06 13:46:49.710845040 -0700 -+++ linux-3.15-rc6/drivers/hid/Kconfig 2014-06-06 13:48:41.674908325 -0700 -@@ -499,6 +499,12 @@ - - Ortek WKB-2000 - - Skycable wireless presenter - -+config HID_OUYA -+ tristate "OUYA Game Controller" -+ depends on USB_HID -+ ---help--- -+ Support for OUYA Game Controller. -+ - config HID_PANTHERLORD - tristate "Pantherlord/GreenAsia game controller" - depends on HID -diff -Naur linux-3.15-rc6.orig/drivers/hid/Makefile linux-3.15-rc6/drivers/hid/Makefile ---- linux-3.15-rc6.orig/drivers/hid/Makefile 2014-06-06 13:46:49.710845040 -0700 -+++ linux-3.15-rc6/drivers/hid/Makefile 2014-06-06 13:49:23.951309760 -0700 -@@ -68,6 +68,7 @@ - obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o - obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o - obj-$(CONFIG_HID_ORTEK) += hid-ortek.o -+obj-$(CONFIG_HID_OUYA) += hid-ouya.o - obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o - obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o - obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-052-XBOX_remote_support.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-052-XBOX_remote_support.patch deleted file mode 100644 index 6b43f9b315..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-052-XBOX_remote_support.patch +++ /dev/null @@ -1,1029 +0,0 @@ -diff -Naur linux-3.9.4/drivers/staging/media/lirc/Kconfig linux-3.9.4.patch/drivers/staging/media/lirc/Kconfig ---- linux-3.9.4/drivers/staging/media/lirc/Kconfig 2013-05-24 20:45:59.000000000 +0200 -+++ linux-3.9.4.patch/drivers/staging/media/lirc/Kconfig 2013-05-30 18:18:57.238957100 +0200 -@@ -63,10 +63,17 @@ - help - Driver for the SIR IrDA port - -+config LIRC_XBOX -+ tristate "XBOX USB IR Remote" -+ depends on LIRC && USB -+ help -+ Driver for the Microsoft XBOX USB IR Remote -+ - config LIRC_ZILOG - tristate "Zilog/Hauppauge IR Transmitter" - depends on LIRC && I2C - help - Driver for the Zilog/Hauppauge IR Transmitter, found on - PVR-150/500, HVR-1200/1250/1700/1800, HD-PVR and other cards -+ - endif -diff -Naur linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c linux-3.9.4.patch/drivers/staging/media/lirc/lirc_xbox.c ---- linux-3.9.4/drivers/staging/media/lirc/lirc_xbox.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.9.4.patch/drivers/staging/media/lirc/lirc_xbox.c 2013-05-30 18:40:22.523775446 +0200 -@@ -0,0 +1,995 @@ -+/* -+ * lirc_xbox - USB remote support for LIRC -+ * (supports Microsoft XBOX DVD Dongle) -+ * -+ * Copyright (C) 2003-2004 Paul Miller -+ * -+ * This driver was derived from: -+ * Vladimir Dergachev 's 2002 -+ * "USB ATI Remote support" (input device) -+ * Adrian Dewhurst 's 2002 -+ * "USB StreamZap remote driver" (LIRC) -+ * Artur Lipowski 's 2002 -+ * "lirc_dev" and "lirc_gpio" LIRC modules -+ * Michael Wojciechowski -+ * initial xbox support -+ * Vassilis Virvilis 2006 -+ * reworked the patch for lirc submission -+ * Paul Miller's 2004 -+ * lirc_atiusb - removed all ati remote support -+ * $Id: lirc_xbox.c,v 1.88 2011/06/03 11:11:11 jmartin Exp $ -+ */ -+ -+/* -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+ -+//#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) -+//#include -+//#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+//#include "drivers/kcompat.h" -+//#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) -+#include -+#include -+//#else -+//#include "drivers/lirc.h" -+//#include "drivers/lirc_dev/lirc_dev.h" -+//#endif -+ -+#define DRIVER_VERSION "$Revision: 0.01 $" -+#define DRIVER_AUTHOR "Jason Martin " -+#define DRIVER_DESC "XBOX DVD Dongle USB remote driver for LIRC" -+#define DRIVER_NAME "lirc_xbox" -+ -+#define CODE_LENGTH 6 -+#define CODE_MIN_LENGTH 6 -+#define DECODE_LENGTH 1 -+ -+#ifndef URB_ASYNC_UNLINK -+#define URB_ASYNC_UNLINK 0 -+#endif -+ -+/* module parameters */ -+#ifdef CONFIG_USB_DEBUG -+static int debug = 1; -+#else -+static int debug; -+#endif -+ -+#define dprintk(fmt, args...) \ -+ do { \ -+ if (debug) \ -+ printk(KERN_DEBUG fmt, ## args); \ -+ } while (0) -+ -+/* -+ * USB_BUFF_LEN must be the maximum value of the code_length array. -+ * It is used for static arrays. -+ */ -+#define USB_BUFF_LEN 6 -+ -+static int mask = 0xFFFF; /* channel acceptance bit mask */ -+static int unique; /* enable channel-specific codes */ -+static int repeat = 10; /* repeat time in 1/100 sec */ -+static unsigned long repeat_jiffies; /* repeat timeout */ -+ -+/* get hi and low bytes of a 16-bits int */ -+#define HI(a) ((unsigned char)((a) >> 8)) -+#define LO(a) ((unsigned char)((a) & 0xff)) -+ -+/* general constants */ -+#define SEND_FLAG_IN_PROGRESS 1 -+#define SEND_FLAG_COMPLETE 2 -+#define FREE_ALL 0xFF -+ -+/* endpoints */ -+#define EP_KEYS 0 -+#define EP_MOUSE 1 -+#define EP_MOUSE_ADDR 0x81 -+#define EP_KEYS_ADDR 0x82 -+ -+/* USB vendor ids for XBOX DVD Dongles */ -+#define VENDOR_MS1 0x040b -+#define VENDOR_MS2 0x045e -+#define VENDOR_MS3 0xFFFF -+ -+static struct usb_device_id usb_remote_table[] = { -+ /* Gamester Xbox DVD Movie Playback Kit IR */ -+ { USB_DEVICE(VENDOR_MS1, 0x6521) }, -+ -+ /* Microsoft Xbox DVD Movie Playback Kit IR */ -+ { USB_DEVICE(VENDOR_MS2, 0x0284) }, -+ -+ /* -+ * Some Chinese manufacturer -- conflicts with the joystick from the -+ * same manufacturer -+ */ -+ { USB_DEVICE(VENDOR_MS3, 0xFFFF) }, -+ -+ /* Terminating entry */ -+ { } -+}; -+ -+/* init strings */ -+#define USB_OUTLEN 7 -+ -+static char init1[] = {0x01, 0x00, 0x20, 0x14}; -+static char init2[] = {0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20}; -+ -+struct in_endpt { -+ /* inner link in list of endpoints for the remote specified by ir */ -+ struct list_head iep_list_link; -+ struct xbox_dev *ir; -+ struct urb *urb; -+ struct usb_endpoint_descriptor *ep; -+ -+ /* buffers and dma */ -+ unsigned char *buf; -+ unsigned int len; -+ dma_addr_t dma; -+ -+ /* handle repeats */ -+ unsigned char old[USB_BUFF_LEN]; -+ unsigned long old_jiffies; -+}; -+ -+struct out_endpt { -+ struct xbox_dev *ir; -+ struct urb *urb; -+ struct usb_endpoint_descriptor *ep; -+ -+ /* buffers and dma */ -+ unsigned char *buf; -+ dma_addr_t dma; -+ -+ /* handle sending (init strings) */ -+ int send_flags; -+ wait_queue_head_t wait; -+}; -+ -+ -+/* data structure for each usb remote */ -+struct xbox_dev { -+ /* inner link in list of all remotes managed by this module */ -+ struct list_head remote_list_link; -+ /* Number of usb interfaces associated with this device */ -+ int dev_refcount; -+ -+ /* usb */ -+ struct usb_device *usbdev; -+ /* Head link to list of all inbound endpoints in this remote */ -+ struct list_head iep_listhead; -+ struct out_endpt *out_init; -+ int devnum; -+ -+ /* lirc */ -+ struct lirc_driver *d; -+ int connected; -+ -+ /* locking */ -+ struct mutex lock; -+}; -+ -+/* list of all registered devices via the remote_list_link in xbox_dev */ -+static struct list_head remote_list; -+ -+/* -+ * Convenience macros to retrieve a pointer to the surrounding struct from -+ * the given list_head reference within, pointed at by link. -+ */ -+#define get_iep_from_link(link) \ -+ list_entry((link), struct in_endpt, iep_list_link); -+#define get_irctl_from_link(link) \ -+ list_entry((link), struct xbox_dev, remote_list_link); -+ -+/* send packet - used to initialize remote */ -+static void send_packet(struct out_endpt *oep, u16 cmd, unsigned char *data) -+{ -+ struct xbox_dev *ir = oep->ir; -+ DECLARE_WAITQUEUE(wait, current); -+ int timeout = HZ; /* 1 second */ -+ unsigned char buf[USB_OUTLEN]; -+ -+ dprintk(DRIVER_NAME "[%d]: send called (%#x)\n", ir->devnum, cmd); -+ -+ mutex_lock(&ir->lock); -+ oep->urb->transfer_buffer_length = LO(cmd) + 1; -+ oep->urb->dev = oep->ir->usbdev; -+ oep->send_flags = SEND_FLAG_IN_PROGRESS; -+ -+ memcpy(buf+1, data, LO(cmd)); -+ buf[0] = HI(cmd); -+ memcpy(oep->buf, buf, LO(cmd)+1); -+ -+ set_current_state(TASK_INTERRUPTIBLE); -+ add_wait_queue(&oep->wait, &wait); -+ -+ if (usb_submit_urb(oep->urb, GFP_ATOMIC)) { -+ set_current_state(TASK_RUNNING); -+ remove_wait_queue(&oep->wait, &wait); -+ mutex_unlock(&ir->lock); -+ return; -+ } -+ mutex_unlock(&ir->lock); -+ -+ while (timeout && (oep->urb->status == -EINPROGRESS) -+ && !(oep->send_flags & SEND_FLAG_COMPLETE)) { -+ timeout = schedule_timeout(timeout); -+ rmb(); -+ } -+ -+ dprintk(DRIVER_NAME "[%d]: send complete (%#x)\n", ir->devnum, cmd); -+ -+ set_current_state(TASK_RUNNING); -+ remove_wait_queue(&oep->wait, &wait); -+ oep->urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(oep->urb); -+} -+ -+static int unregister_from_lirc(struct xbox_dev *ir) -+{ -+ struct lirc_driver *d = ir->d; -+ int devnum; -+ -+ devnum = ir->devnum; -+ dprintk(DRIVER_NAME "[%d]: unregister from lirc called\n", devnum); -+ -+ lirc_unregister_driver(d->minor); -+ -+ printk(DRIVER_NAME "[%d]: usb remote disconnected\n", devnum); -+ return 0; -+} -+ -+static int set_use_inc(void *data) -+{ -+ struct xbox_dev *ir = data; -+ struct list_head *pos, *n; -+ struct in_endpt *iep; -+ int rtn; -+ -+ if (!ir) { -+ printk(DRIVER_NAME "[?]: set_use_inc called with no context\n"); -+ return -EIO; -+ } -+ dprintk(DRIVER_NAME "[%d]: set use inc\n", ir->devnum); -+ -+ mutex_lock(&ir->lock); -+ if (!ir->connected) { -+ if (!ir->usbdev) { -+ mutex_unlock(&ir->lock); -+ dprintk(DRIVER_NAME "[%d]: !ir->usbdev\n", ir->devnum); -+ return -ENOENT; -+ } -+ -+ /* Iterate through the inbound endpoints */ -+ list_for_each_safe(pos, n, &ir->iep_listhead) { -+ /* extract the current in_endpt */ -+ iep = get_iep_from_link(pos); -+ iep->urb->dev = ir->usbdev; -+ dprintk(DRIVER_NAME "[%d]: linking iep 0x%02x (%p)\n", -+ ir->devnum, iep->ep->bEndpointAddress, iep); -+ rtn = usb_submit_urb(iep->urb, GFP_ATOMIC); -+ if (rtn) { -+ printk(DRIVER_NAME "[%d]: open result = %d " -+ "error submitting urb\n", -+ ir->devnum, rtn); -+ mutex_unlock(&ir->lock); -+ return -EIO; -+ } -+ } -+ ir->connected = 1; -+ } -+ mutex_unlock(&ir->lock); -+ -+ return 0; -+} -+ -+static void set_use_dec(void *data) -+{ -+ struct xbox_dev *ir = data; -+ struct list_head *pos, *n; -+ struct in_endpt *iep; -+ -+ if (!ir) { -+ printk(DRIVER_NAME "[?]: set_use_dec called with no context\n"); -+ return; -+ } -+ dprintk(DRIVER_NAME "[%d]: set use dec\n", ir->devnum); -+ -+ mutex_lock(&ir->lock); -+ if (ir->connected) { -+ /* Free inbound usb urbs */ -+ list_for_each_safe(pos, n, &ir->iep_listhead) { -+ iep = get_iep_from_link(pos); -+ dprintk(DRIVER_NAME "[%d]: unlinking iep 0x%02x (%p)\n", -+ ir->devnum, iep->ep->bEndpointAddress, iep); -+ usb_kill_urb(iep->urb); -+ } -+ ir->connected = 0; -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+static void print_data(struct in_endpt *iep, char *buf, int len) -+{ -+ const int clen = CODE_LENGTH; -+ char codes[clen * 3 + 1]; -+ int i; -+ -+ if (len <= 0) -+ return; -+ -+ for (i = 0; i < len && i < clen; i++) -+ snprintf(codes+i*3, 4, "%02x ", buf[i] & 0xFF); -+ printk(DRIVER_NAME "[%d]: data received %s (ep=0x%x length=%d)\n", -+ iep->ir->devnum, codes, iep->ep->bEndpointAddress, len); -+} -+ -+static int code_check_xbox(struct in_endpt *iep, int len) -+{ -+ // struct xbox_dev *ir = iep->ir; -+ const int clen = CODE_LENGTH; -+ -+ if (len != clen) { -+ dprintk(DRIVER_NAME ": We got %d instead of %d bytes from xbox " -+ "ir.. ?\n", len, clen); -+ return -1; -+ } -+ -+ /* check for repeats */ -+ if (memcmp(iep->old, iep->buf, len) == 0) { -+ if (iep->old_jiffies + repeat_jiffies > jiffies) -+ return -1; -+ } else { -+ /* -+ * the third byte of xbox ir packet seems to contain key info -+ * the last two bytes are.. some kind of clock? -+ */ -+ iep->buf[0] = iep->buf[2]; -+ memset(iep->buf + 1, 0, len - 1); -+ memcpy(iep->old, iep->buf, len); -+ } -+ iep->old_jiffies = jiffies; -+ -+ return 0; -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) -+static void usb_remote_recv(struct urb *urb, struct pt_regs *regs) -+#else -+static void usb_remote_recv(struct urb *urb) -+#endif -+{ -+ struct in_endpt *iep; -+ int len, result = -1; -+ -+ if (!urb) -+ return; -+ iep = urb->context; -+ if (!iep) { -+ urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(urb); -+ return; -+ } -+ if (!iep->ir->usbdev) -+ return; -+ -+ len = urb->actual_length; -+ if (debug) -+ print_data(iep, urb->transfer_buffer, len); -+ -+ switch (urb->status) { -+ -+ case 0: -+ result = code_check_xbox(iep, len); -+ -+ if (result < 0) -+ break; -+ -+ lirc_buffer_write(iep->ir->d->rbuf, iep->buf); -+ wake_up(&iep->ir->d->rbuf->wait_poll); -+ break; -+ -+ case -ECONNRESET: -+ case -ENOENT: -+ case -ESHUTDOWN: -+ urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(urb); -+ return; -+ -+ case -EPIPE: -+ default: -+ break; -+ } -+ -+ usb_submit_urb(urb, GFP_ATOMIC); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) -+static void usb_remote_send(struct urb *urb, struct pt_regs *regs) -+#else -+static void usb_remote_send(struct urb *urb) -+#endif -+{ -+ struct out_endpt *oep; -+ -+ if (!urb) -+ return; -+ oep = urb->context; -+ if (!oep) { -+ urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(urb); -+ return; -+ } -+ if (!oep->ir->usbdev) -+ return; -+ -+ dprintk(DRIVER_NAME "[%d]: usb out called\n", oep->ir->devnum); -+ -+ if (urb->status) -+ return; -+ -+ oep->send_flags |= SEND_FLAG_COMPLETE; -+ wmb(); -+ if (waitqueue_active(&oep->wait)) -+ wake_up(&oep->wait); -+} -+ -+ -+/* -+ * Initialization and removal -+ */ -+ -+/* -+ * Free iep according to mem_failure which specifies a checkpoint into the -+ * initialization sequence for rollback recovery. -+ */ -+static void free_in_endpt(struct in_endpt *iep, int mem_failure) -+{ -+ struct xbox_dev *ir; -+ dprintk(DRIVER_NAME ": free_in_endpt(%p, %d)\n", iep, mem_failure); -+ if (!iep) -+ return; -+ -+ ir = iep->ir; -+ if (!ir) { -+ dprintk(DRIVER_NAME ": free_in_endpt: WARNING! null ir\n"); -+ return; -+ } -+ mutex_lock(&ir->lock); -+ switch (mem_failure) { -+ case FREE_ALL: -+ case 5: -+ list_del(&iep->iep_list_link); -+ dprintk(DRIVER_NAME "[%d]: free_in_endpt removing ep=0x%0x " -+ "from list\n", ir->devnum, iep->ep->bEndpointAddress); -+ case 4: -+ if (iep->urb) { -+ iep->urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(iep->urb); -+ usb_free_urb(iep->urb); -+ iep->urb = 0; -+ } else -+ dprintk(DRIVER_NAME "[%d]: free_in_endpt null urb!\n", -+ ir->devnum); -+ case 3: -+ usb_free_coherent(iep->ir->usbdev, iep->len, iep->buf, iep->dma); -+ iep->buf = 0; -+ case 2: -+ kfree(iep); -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+/* -+ * Construct a new inbound endpoint for this remote, and add it to the list of -+ * in_epts in ir. -+ */ -+static struct in_endpt *new_in_endpt(struct xbox_dev *ir, -+ struct usb_endpoint_descriptor *ep) -+{ -+ struct usb_device *dev = ir->usbdev; -+ struct in_endpt *iep; -+ int pipe, maxp, len, addr; -+ int mem_failure; -+ -+ addr = ep->bEndpointAddress; -+ pipe = usb_rcvintpipe(dev, addr); -+ maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); -+ -+/* len = (maxp > USB_BUFLEN) ? USB_BUFLEN : maxp; -+ * len -= (len % CODE_LENGTH); */ -+ len = CODE_LENGTH; -+ -+ dprintk(DRIVER_NAME "[%d]: acceptable inbound endpoint (0x%x) found " -+ "(maxp=%d len=%d)\n", ir->devnum, addr, maxp, len); -+ -+ mem_failure = 0; -+ iep = kzalloc(sizeof(*iep), GFP_KERNEL); -+ if (!iep) { -+ mem_failure = 1; -+ goto new_in_endpt_failure_check; -+ } -+ iep->ir = ir; -+ iep->ep = ep; -+ iep->len = len; -+ -+ iep->buf = usb_alloc_coherent(dev, len, GFP_ATOMIC, &iep->dma); -+ if (!iep->buf) { -+ mem_failure = 2; -+ goto new_in_endpt_failure_check; -+ } -+ -+ iep->urb = usb_alloc_urb(0, GFP_KERNEL); -+ if (!iep->urb) -+ mem_failure = 3; -+ -+new_in_endpt_failure_check: -+ -+ if (mem_failure) { -+ free_in_endpt(iep, mem_failure); -+ printk(DRIVER_NAME "[%d]: ep=0x%x out of memory (code=%d)\n", -+ ir->devnum, addr, mem_failure); -+ return NULL; -+ } -+ list_add_tail(&iep->iep_list_link, &ir->iep_listhead); -+ dprintk(DRIVER_NAME "[%d]: adding ep=0x%0x to list\n", -+ ir->devnum, iep->ep->bEndpointAddress); -+ return iep; -+} -+ -+static void free_out_endpt(struct out_endpt *oep, int mem_failure) -+{ -+ struct xbox_dev *ir; -+ dprintk(DRIVER_NAME ": free_out_endpt(%p, %d)\n", oep, mem_failure); -+ if (!oep) -+ return; -+ -+ wake_up_all(&oep->wait); -+ -+ ir = oep->ir; -+ if (!ir) { -+ dprintk(DRIVER_NAME ": free_out_endpt: WARNING! null ir\n"); -+ return; -+ } -+ mutex_lock(&ir->lock); -+ switch (mem_failure) { -+ case FREE_ALL: -+ case 4: -+ if (oep->urb) { -+ oep->urb->transfer_flags |= URB_ASYNC_UNLINK; -+ usb_unlink_urb(oep->urb); -+ usb_free_urb(oep->urb); -+ oep->urb = 0; -+ } else { -+ dprintk(DRIVER_NAME "[%d]: free_out_endpt: null urb!\n", -+ ir->devnum); -+ } -+ case 3: -+ usb_free_coherent(oep->ir->usbdev, USB_OUTLEN, -+ oep->buf, oep->dma); -+ oep->buf = 0; -+ case 2: -+ kfree(oep); -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+static struct out_endpt *new_out_endpt(struct xbox_dev *ir, -+ struct usb_endpoint_descriptor *ep) -+{ -+ struct usb_device *dev = ir->usbdev; -+ struct out_endpt *oep; -+ int mem_failure; -+ -+ dprintk(DRIVER_NAME "[%d]: acceptable outbound endpoint (0x%x) found\n", -+ ir->devnum, ep->bEndpointAddress); -+ -+ mem_failure = 0; -+ oep = kzalloc(sizeof(*oep), GFP_KERNEL); -+ if (!oep) -+ mem_failure = 1; -+ else { -+ oep->ir = ir; -+ oep->ep = ep; -+ init_waitqueue_head(&oep->wait); -+ -+ oep->buf = usb_alloc_coherent(dev, USB_OUTLEN, -+ GFP_ATOMIC, &oep->dma); -+ if (!oep->buf) -+ mem_failure = 2; -+ else { -+ oep->urb = usb_alloc_urb(0, GFP_KERNEL); -+ if (!oep->urb) -+ mem_failure = 3; -+ } -+ } -+ if (mem_failure) { -+ free_out_endpt(oep, mem_failure); -+ printk(DRIVER_NAME "[%d]: ep=0x%x out of memory (code=%d)\n", -+ ir->devnum, ep->bEndpointAddress, mem_failure); -+ return NULL; -+ } -+ return oep; -+} -+ -+static void free_irctl(struct xbox_dev *ir, int mem_failure) -+{ -+ struct list_head *pos, *n; -+ struct in_endpt *in; -+ dprintk(DRIVER_NAME ": free_irctl(%p, %d)\n", ir, mem_failure); -+ -+ if (!ir) -+ return; -+ -+ list_for_each_safe(pos, n, &ir->iep_listhead) { -+ in = get_iep_from_link(pos); -+ free_in_endpt(in, FREE_ALL); -+ } -+ if (ir->out_init) { -+ free_out_endpt(ir->out_init, FREE_ALL); -+ ir->out_init = NULL; -+ } -+ -+ mutex_lock(&ir->lock); -+ switch (mem_failure) { -+ case FREE_ALL: -+ case 6: -+ if (!--ir->dev_refcount) { -+ list_del(&ir->remote_list_link); -+ dprintk(DRIVER_NAME "[%d]: free_irctl: removing " -+ "remote from list\n", ir->devnum); -+ } else { -+ dprintk(DRIVER_NAME "[%d]: free_irctl: refcount at %d," -+ "aborting free_irctl\n", -+ ir->devnum, ir->dev_refcount); -+ mutex_unlock(&ir->lock); -+ return; -+ } -+ case 5: -+ case 4: -+ case 3: -+ if (ir->d) { -+ switch (mem_failure) { -+ case 5: -+ lirc_buffer_free(ir->d->rbuf); -+ case 4: -+ kfree(ir->d->rbuf); -+ case 3: -+ kfree(ir->d); -+ } -+ } else -+ printk(DRIVER_NAME "[%d]: ir->d is a null pointer!\n", -+ ir->devnum); -+ case 2: -+ mutex_unlock(&ir->lock); -+ kfree(ir); -+ return; -+ } -+ mutex_unlock(&ir->lock); -+} -+ -+static struct xbox_dev *new_irctl(struct usb_interface *intf) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ struct xbox_dev *ir; -+ struct lirc_driver *driver; -+ int devnum, dclen; -+ int mem_failure; -+ -+ devnum = dev->devnum; -+ -+ dprintk(DRIVER_NAME "[%d]: remote type = XBOX DVD Dongle\n", devnum); -+ -+ mem_failure = 0; -+ ir = kzalloc(sizeof(*ir), GFP_KERNEL); -+ if (!ir) { -+ mem_failure = 1; -+ goto new_irctl_failure_check; -+ } -+ -+ dclen = DECODE_LENGTH; -+ -+ /* -+ * add this infrared remote struct to remote_list, keeping track -+ * of the number of drivers registered. -+ */ -+ dprintk(DRIVER_NAME "[%d]: adding remote to list\n", devnum); -+ list_add_tail(&ir->remote_list_link, &remote_list); -+ ir->dev_refcount = 1; -+ -+ driver = kzalloc(sizeof(*driver), GFP_KERNEL); -+ if (!driver) { -+ mem_failure = 2; -+ goto new_irctl_failure_check; -+ } -+ -+ ir->d = driver; -+ driver->rbuf = kmalloc(sizeof(*(driver->rbuf)), GFP_KERNEL); -+ if (!driver->rbuf) { -+ mem_failure = 3; -+ goto new_irctl_failure_check; -+ } -+ -+ if (lirc_buffer_init(driver->rbuf, dclen, 2)) { -+ mem_failure = 4; -+ goto new_irctl_failure_check; -+ } -+ -+ strcpy(driver->name, DRIVER_NAME " "); -+ driver->minor = -1; -+ driver->code_length = dclen * 8; -+ driver->features = LIRC_CAN_REC_LIRCCODE; -+ driver->data = ir; -+ driver->set_use_inc = &set_use_inc; -+ driver->set_use_dec = &set_use_dec; -+ driver->dev = &intf->dev; -+ driver->owner = THIS_MODULE; -+ ir->usbdev = dev; -+ ir->devnum = devnum; -+ -+ mutex_init(&ir->lock); -+ INIT_LIST_HEAD(&ir->iep_listhead); -+ -+new_irctl_failure_check: -+ -+ if (mem_failure) { -+ free_irctl(ir, mem_failure); -+ printk(DRIVER_NAME "[%d]: out of memory (code=%d)\n", -+ devnum, mem_failure); -+ return NULL; -+ } -+ return ir; -+} -+ -+/* -+ * Scan the global list of remotes to see if the device listed is one of them. -+ * If it is, the corresponding xbox_dev is returned, with its dev_refcount -+ * incremented. Otherwise, returns null. -+ */ -+static struct xbox_dev *get_prior_reg_ir(struct usb_device *dev) -+{ -+ struct list_head *pos; -+ struct xbox_dev *ir = NULL; -+ -+ dprintk(DRIVER_NAME "[%d]: scanning remote_list...\n", dev->devnum); -+ list_for_each(pos, &remote_list) { -+ ir = get_irctl_from_link(pos); -+ if (ir->usbdev != dev) { -+ dprintk(DRIVER_NAME "[%d]: device %d isn't it...", -+ dev->devnum, ir->devnum); -+ ir = NULL; -+ } else { -+ dprintk(DRIVER_NAME "[%d]: prior instance found.\n", -+ dev->devnum); -+ ir->dev_refcount++; -+ break; -+ } -+ } -+ return ir; -+} -+ -+/* -+ * If the USB interface has an out endpoint for control. -+ */ -+static void send_outbound_init(struct xbox_dev *ir) -+{ -+ if (ir->out_init) { -+ struct out_endpt *oep = ir->out_init; -+ dprintk(DRIVER_NAME "[%d]: usb_remote_probe: initializing " -+ "outbound ep\n", ir->devnum); -+ usb_fill_int_urb(oep->urb, ir->usbdev, -+ usb_sndintpipe(ir->usbdev, oep->ep->bEndpointAddress), -+ oep->buf, USB_OUTLEN, usb_remote_send, -+ oep, oep->ep->bInterval); -+ oep->urb->transfer_dma = oep->dma; -+ oep->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; -+ -+ send_packet(oep, 0x8004, init1); -+ send_packet(oep, 0x8007, init2); -+ } -+} -+ -+/* Log driver and usb info */ -+static void log_usb_dev_info(struct usb_device *dev) -+{ -+ char buf[63], name[128] = ""; -+ -+ if (dev->descriptor.iManufacturer -+ && usb_string(dev, dev->descriptor.iManufacturer, -+ buf, sizeof(buf)) > 0) -+ strlcpy(name, buf, sizeof(name)); -+ if (dev->descriptor.iProduct -+ && usb_string(dev, dev->descriptor.iProduct, buf, sizeof(buf)) > 0) -+ snprintf(name + strlen(name), sizeof(name) - strlen(name), -+ " %s", buf); -+ printk(DRIVER_NAME "[%d]: %s on usb%d:%d\n", dev->devnum, name, -+ dev->bus->busnum, dev->devnum); -+} -+ -+ -+static int usb_remote_probe(struct usb_interface *intf, -+ const struct usb_device_id *id) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ struct usb_host_interface *idesc; -+ struct usb_endpoint_descriptor *ep; -+ struct in_endpt *iep; -+ struct xbox_dev *ir; -+ int i; -+ -+ dprintk(DRIVER_NAME "[%d]: usb_remote_probe: dev:%p, intf:%p, id:%p)\n", -+ dev->devnum, dev, intf, id); -+ -+ idesc = intf->cur_altsetting; -+ -+ /* Check if a usb remote has already been registered for this device */ -+ ir = get_prior_reg_ir(dev); -+ -+ if (!ir) { -+ ir = new_irctl(intf); -+ if (!ir) -+ return -ENOMEM; -+ } -+ -+ /* -+ * step through the endpoints to find first in and first out endpoint -+ * of type interrupt transfer -+ */ -+ for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { -+ ep = &idesc->endpoint[i].desc; -+ dprintk(DRIVER_NAME "[%d]: processing endpoint %d\n", -+ dev->devnum, i); -+ if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == -+ USB_DIR_IN) && -+ ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == -+ USB_ENDPOINT_XFER_INT)) { -+ -+ iep = new_in_endpt(ir, ep); -+ if (iep) -+ { -+ usb_fill_int_urb(iep->urb, dev, -+ usb_rcvintpipe(dev, -+ iep->ep->bEndpointAddress), -+ iep->buf, iep->len, usb_remote_recv, -+ iep, iep->ep->bInterval); -+ iep->urb->transfer_dma = iep->dma; -+ iep->urb->transfer_flags |= -+ URB_NO_TRANSFER_DMA_MAP; -+ } -+ } -+ -+ if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == -+ USB_DIR_OUT) && -+ ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == -+ USB_ENDPOINT_XFER_INT) && -+ (ir->out_init == NULL)) -+ ir->out_init = new_out_endpt(ir, ep); -+ } -+ if (list_empty(&ir->iep_listhead)) { -+ printk(DRIVER_NAME "[%d]: inbound endpoint not found\n", -+ ir->devnum); -+ free_irctl(ir, FREE_ALL); -+ return -ENODEV; -+ } -+ if (ir->dev_refcount == 1) { -+ ir->d->minor = lirc_register_driver(ir->d); -+ if (ir->d->minor < 0) { -+ free_irctl(ir, FREE_ALL); -+ return -ENODEV; -+ } -+ -+ /* Note new driver registration in kernel logs */ -+ log_usb_dev_info(dev); -+ -+ /* outbound data (initialization) */ -+ send_outbound_init(ir); -+ } -+ -+ usb_set_intfdata(intf, ir); -+ return 0; -+} -+ -+static void usb_remote_disconnect(struct usb_interface *intf) -+{ -+ /* struct usb_device *dev = interface_to_usbdev(intf); */ -+ struct xbox_dev *ir = usb_get_intfdata(intf); -+ usb_set_intfdata(intf, NULL); -+ -+ dprintk(DRIVER_NAME ": disconnecting remote %d:\n", -+ (ir ? ir->devnum : -1)); -+ if (!ir || !ir->d) -+ return; -+ -+ if (ir->usbdev) { -+ /* Only unregister once */ -+ ir->usbdev = NULL; -+ unregister_from_lirc(ir); -+ } -+ -+ /* This also removes the current remote from remote_list */ -+ free_irctl(ir, FREE_ALL); -+} -+ -+static struct usb_driver usb_remote_driver = { -+ .name = DRIVER_NAME, -+ .probe = usb_remote_probe, -+ .disconnect = usb_remote_disconnect, -+ .id_table = usb_remote_table -+}; -+ -+static int __init usb_remote_init(void) -+{ -+ int i; -+ -+ INIT_LIST_HEAD(&remote_list); -+ -+ printk(KERN_INFO "\n" DRIVER_NAME ": " DRIVER_DESC " " -+ DRIVER_VERSION "\n"); -+ printk(DRIVER_NAME ": " DRIVER_AUTHOR "\n"); -+ dprintk(DRIVER_NAME ": debug mode enabled: " -+ "$Id: lirc_xbox.c,v 1.88 2011/06/05 11:11:11 jmartin Exp $\n"); -+ -+ repeat_jiffies = repeat*HZ/100; -+ -+ i = usb_register(&usb_remote_driver); -+ if (i) { -+ printk(DRIVER_NAME ": usb register failed, result = %d\n", i); -+ return -ENODEV; -+ } -+ -+ return 0; -+} -+ -+static void __exit usb_remote_exit(void) -+{ -+ usb_deregister(&usb_remote_driver); -+} -+ -+module_init(usb_remote_init); -+module_exit(usb_remote_exit); -+ -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_AUTHOR(DRIVER_AUTHOR); -+MODULE_LICENSE("GPL"); -+MODULE_DEVICE_TABLE(usb, usb_remote_table); -+ -+module_param(debug, bool, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(debug, "Debug enabled or not (default: 0)"); -+ -+module_param(mask, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(mask, "Set channel acceptance bit mask (default: 0xFFFF)"); -+ -+module_param(unique, bool, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(unique, "Enable channel-specific codes (default: 0)"); -+ -+module_param(repeat, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(repeat, "Repeat timeout (1/100 sec) (default: 10)"); -diff -Naur linux-3.9.4/drivers/staging/media/lirc/Makefile linux-3.9.4.patch/drivers/staging/media/lirc/Makefile ---- linux-3.9.4/drivers/staging/media/lirc/Makefile 2013-05-24 20:45:59.000000000 +0200 -+++ linux-3.9.4.patch/drivers/staging/media/lirc/Makefile 2013-05-30 18:17:39.163634834 +0200 -@@ -10,4 +10,5 @@ - obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o - obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o - obj-$(CONFIG_LIRC_SIR) += lirc_sir.o -+obj-$(CONFIG_LIRC_XBOX) += lirc_xbox.o - obj-$(CONFIG_LIRC_ZILOG) += lirc_zilog.o diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-053-spinelplus-remote-0.2.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-053-spinelplus-remote-0.2.patch deleted file mode 100644 index f110183d85..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-053-spinelplus-remote-0.2.patch +++ /dev/null @@ -1,161 +0,0 @@ -diff -Naur linux-3.9/drivers/hid/hid-core.c linux-3.9.patch/drivers/hid/hid-core.c ---- linux-3.9/drivers/hid/hid-core.c 2013-04-29 02:36:01.000000000 +0200 -+++ linux-3.9.patch/drivers/hid/hid-core.c 2013-04-29 17:08:40.528324010 +0200 -@@ -1681,6 +1681,9 @@ - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, - #if IS_ENABLED(CONFIG_HID_ROCCAT) - { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, -diff -Naur linux-3.9/drivers/hid/hid-ids.h linux-3.9.patch/drivers/hid/hid-ids.h ---- linux-3.9/drivers/hid/hid-ids.h 2013-04-29 02:36:01.000000000 +0200 -+++ linux-3.9.patch/drivers/hid/hid-ids.h 2013-04-29 17:08:40.537323981 +0200 -@@ -663,6 +663,9 @@ - - #define USB_VENDOR_ID_PHILIPS 0x0471 - #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617 -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1 0x206c -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2 0x20cc -+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3 0x0613 - - #define USB_VENDOR_ID_PI_ENGINEERING 0x05f3 - #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff -diff -Naur linux-3.9/drivers/hid/hid-spinelplus.c linux-3.9.patch/drivers/hid/hid-spinelplus.c ---- linux-3.9/drivers/hid/hid-spinelplus.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.9.patch/drivers/hid/hid-spinelplus.c 2013-04-29 17:08:40.537323981 +0200 -@@ -0,0 +1,104 @@ -+/* -+ * HID driver for "PHILIPS MCE USB IR Receiver- Spinel plus" remotes -+ * -+ * Copyright (c) 2010 Panagiotis Skintzos -+ * -+ * Renamed to Spinel, cleanup and modified to also support -+ * Spinel Plus 0471:20CC by Stephan Raue 2012. -+ */ -+ -+/* -+ * 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 "hid-ids.h" -+ -+#define spinelplus_map_key(c) set_bit(EV_REP, hi->input->evbit); \ -+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) -+ -+static int spinelplus_input_mapping(struct hid_device *hdev, -+ struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, -+ unsigned long **bit, int *max) -+{ -+ switch (usage->hid) { -+ case 0xffbc000d: spinelplus_map_key(KEY_MEDIA); break; -+ case 0xffbc0024: spinelplus_map_key(KEY_MEDIA); break; -+ case 0xffbc0027: spinelplus_map_key(KEY_ZOOM); break; -+ case 0xffbc0033: spinelplus_map_key(KEY_HOME); break; -+ case 0xffbc0035: spinelplus_map_key(KEY_CAMERA); break; -+ case 0xffbc0036: spinelplus_map_key(KEY_EPG); break; -+ case 0xffbc0037: spinelplus_map_key(KEY_DVD); break; -+ case 0xffbc0038: spinelplus_map_key(KEY_HOME); break; -+ case 0xffbc0039: spinelplus_map_key(KEY_MP3); break; -+ case 0xffbc003a: spinelplus_map_key(KEY_VIDEO); break; -+ case 0xffbc005a: spinelplus_map_key(KEY_TEXT); break; -+ case 0xffbc005b: spinelplus_map_key(KEY_RED); break; -+ case 0xffbc005c: spinelplus_map_key(KEY_GREEN); break; -+ case 0xffbc005d: spinelplus_map_key(KEY_YELLOW); break; -+ case 0xffbc005e: spinelplus_map_key(KEY_BLUE); break; -+ default: -+ return 0; -+ } -+ return 1; -+} -+ -+static int spinelplus_probe(struct hid_device *hdev, -+ const struct hid_device_id *id) -+{ -+ int ret; -+ /* Connect only to hid input (not hiddev & hidraw)*/ -+ unsigned int cmask = HID_CONNECT_HIDINPUT; -+ -+ ret = hid_parse(hdev); -+ if (ret) { -+ dev_err(&hdev->dev, "parse failed\n"); -+ goto err_free; -+ } -+ -+ ret = hid_hw_start(hdev, cmask); -+ if (ret) { -+ dev_err(&hdev->dev, "hw start failed\n"); -+ goto err_free; -+ } -+ -+ return 0; -+err_free: -+ return ret; -+} -+ -+static const struct hid_device_id spinelplus_devices[] = { -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3) }, -+ { } -+}; -+MODULE_DEVICE_TABLE(hid, spinelplus_devices); -+ -+static struct hid_driver spinelplus_driver = { -+ .name = "SpinelPlus", -+ .id_table = spinelplus_devices, -+ .input_mapping = spinelplus_input_mapping, -+ .probe = spinelplus_probe, -+}; -+ -+static int __init spinelplus_init(void) -+{ -+ return hid_register_driver(&spinelplus_driver); -+} -+ -+static void __exit spinelplus_exit(void) -+{ -+ hid_unregister_driver(&spinelplus_driver); -+} -+ -+module_init(spinelplus_init); -+module_exit(spinelplus_exit); -+MODULE_LICENSE("GPL"); -diff -Naur linux-3.9/drivers/hid/Kconfig linux-3.9.patch/drivers/hid/Kconfig ---- linux-3.9/drivers/hid/Kconfig 2013-04-29 02:36:01.000000000 +0200 -+++ linux-3.9.patch/drivers/hid/Kconfig 2013-04-29 17:08:40.538323977 +0200 -@@ -602,6 +602,12 @@ - ---help--- - Support for Steelseries SRW-S1 steering wheel - -+config HID_SPINELPLUS -+ tristate "Spinel Plus remote control" -+ depends on USB_HID -+ ---help--- -+ Say Y here if you have a Spinel Plus (0471:206c/20cc/0613) remote -+ - config HID_SUNPLUS - tristate "Sunplus wireless desktop" - depends on USB_HID -diff -Naur linux-3.9/drivers/hid/Makefile linux-3.9.patch/drivers/hid/Makefile ---- linux-3.9/drivers/hid/Makefile 2013-04-29 02:36:01.000000000 +0200 -+++ linux-3.9.patch/drivers/hid/Makefile 2013-04-29 17:09:26.744173841 +0200 -@@ -101,6 +101,7 @@ - obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o - obj-$(CONFIG_HID_SONY) += hid-sony.o - obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o -+obj-$(CONFIG_HID_SPINELPLUS) += hid-spinelplus.o - obj-$(CONFIG_HID_STEELSERIES) += hid-steelseries.o - obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o - obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-055-add_Formosa_eHome_Infrared_Receiver.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-055-add_Formosa_eHome_Infrared_Receiver.patch deleted file mode 100644 index e2afb63e3d..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-055-add_Formosa_eHome_Infrared_Receiver.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- linux-3.2.2.orig/drivers/media/rc/mceusb.c 2012-01-30 23:37:12.374473509 +0100 -+++ linux-3.2.2/drivers/media/rc/mceusb.c 2012-01-30 23:40:57.989652931 +0100 -@@ -350,6 +350,8 @@ - { USB_DEVICE(VENDOR_FORMOSA, 0xe015) }, - /* Formosa21 / eHome Infrared Receiver */ - { USB_DEVICE(VENDOR_FORMOSA, 0xe016) }, -+ /* Formosa21 / eHome Infrared Receiver */ -+ { USB_DEVICE(VENDOR_FORMOSA, 0xe042) }, - /* Formosa aim / Trust MCE Infrared Receiver */ - { USB_DEVICE(VENDOR_FORMOSA, 0xe017), - .driver_info = MCE_GEN2_NO_TX }, diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch deleted file mode 100644 index a063ac1425..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c -index baa1203..fee1f95 100644 ---- a/drivers/media/rc/mceusb.c -+++ b/drivers/media/rc/mceusb.c -@@ -200,6 +200,7 @@ static bool debug; - #define VENDOR_CONEXANT 0x0572 - #define VENDOR_TWISTEDMELON 0x2596 - #define VENDOR_HAUPPAUGE 0x2040 -+#define VENDOR_ADAPTEC 0x03f3 - - enum mceusb_model_type { - MCE_GEN2 = 0, /* Most boards */ -@@ -414,6 +415,8 @@ static struct usb_device_id mceusb_dev_table[] = { - /* Hauppauge WINTV-HVR-HVR 930C-HD - based on cx231xx */ - { USB_DEVICE(VENDOR_HAUPPAUGE, 0xb130), - .driver_info = HAUPPAUGE_CX_HYBRID_TV }, -+ /* Adaptec / HP eHome Receiver */ -+ { USB_DEVICE(VENDOR_ADAPTEC, 0x0094) }, - /* Terminating entry */ - { } - }; diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch deleted file mode 100644 index 9f84e6659f..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- linux/drivers/media/rc/ir-rc6-decoder.c 2012-11-25 22:08:13.148418669 -0800 -+++ linux.patch/drivers/media/rc/ir-rc6-decoder.c 2012-11-25 22:07:48.864417975 -0800 -@@ -39,7 +39,6 @@ - #define RC6_STARTBIT_MASK 0x08 /* for the header bits */ - #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ - #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ --#define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ - #ifndef CHAR_BIT - #define CHAR_BIT 8 /* Normally in */ - #endif -@@ -242,9 +241,8 @@ again: - } - - scancode = data->body; -- if (data->count == RC6_6A_32_NBITS && -- (scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { -- /* MCE RC */ -+ if (data->count == RC6_6A_32_NBITS) { -+ /* MCE compatible RC */ - toggle = (scancode & RC6_6A_MCE_TOGGLE_MASK) ? 1 : 0; - scancode &= ~RC6_6A_MCE_TOGGLE_MASK; - } else { diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch deleted file mode 100644 index 67fc7a0de8..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -Naur linux-3.9.4/drivers/media/rc/mceusb.c linux-3.9.4.patch/drivers/media/rc/mceusb.c ---- linux-3.9.4/drivers/media/rc/mceusb.c 2013-05-24 20:45:59.000000000 +0200 -+++ linux-3.9.4.patch/drivers/media/rc/mceusb.c 2013-05-27 12:28:12.811230633 +0200 -@@ -309,6 +309,9 @@ - /* SMK/I-O Data GV-MC7/RCKIT Receiver */ - { USB_DEVICE(VENDOR_SMK, 0x0353), - .driver_info = MCE_GEN2_NO_TX }, -+ /* SMK Manufacturing, Inc. Receiver */ -+ { USB_DEVICE(VENDOR_SMK, 0x0357), -+ .driver_info = MCE_GEN2_NO_TX }, - /* Tatung eHome Infrared Transceiver */ - { USB_DEVICE(VENDOR_TATUNG, 0x9150) }, - /* Shuttle eHome Infrared Transceiver */ diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch deleted file mode 100644 index ac0b7c6466..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch +++ /dev/null @@ -1,59 +0,0 @@ -Betreff: [RFC] hid/sony: add autorepeat for PS3 remotes -Von: David Dillow -Datum: 28.06.2013 04:28 -An: linux-input@vger.kernel.org -Kopie (CC): Stephan Raue - -Some applications using the PS3 remote would like to have autorepeat -from the device. Use the input subsystem's software emulation to provide -this capability, and enable those that don't need it to turn it off. ---- -I'm not sure this is the correct approach, or if it is even appropriate -for a remote to do autorepeat. However, the media/rc subsystem does do -it by default, and it's been requested by users, so there is at least -some demand. - -This compiled against the hid-sony driver with the PS3 remote changes -merged, but I have done no testing of it. If the approach seems -reasonable, I'll try to test it when the MythTV is idle. - - drivers/hid/hid-sony.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff -Naur linux-3.14/drivers/hid/hid-sony.c linux-3.14.patch/drivers/hid/hid-sony.c ---- linux-3.14/drivers/hid/hid-sony.c 2014-03-31 05:40:15.000000000 +0200 -+++ linux-3.14.patch/drivers/hid/hid-sony.c 2014-03-31 11:50:35.755949680 +0200 -@@ -546,6 +546,24 @@ - return 1; - } - -+static int ps3remote_setup_repeat(struct hid_device *hdev) -+{ -+ struct hid_input *hidinput = list_first_entry(&hdev->inputs, -+ struct hid_input, list); -+ struct input_dev *input = hidinput->input; -+ -+ /* -+ * Set up autorepeat defaults per the remote control subsystem; -+ * this must be done after hid_hw_start(), as having these non-zero -+ * at the time of input_register_device() tells the input system that -+ * the hardware does the autorepeat, and the PS3 remote does not. -+ */ -+ set_bit(EV_REP, input->evbit); -+ input->rep[REP_DELAY] = 500; -+ input->rep[REP_PERIOD] = 125; -+ -+ return 0; -+} - - /* Sony Vaio VGX has wrongly mouse pointer declared as constant */ - static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, -@@ -1074,6 +1092,8 @@ - } - else if (sc->quirks & SIXAXIS_CONTROLLER_BT) - ret = sixaxis_set_operational_bt(hdev); -+ else if (sc->quirks & PS3REMOTE) -+ ret = ps3remote_setup_repeat(hdev); - else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { - /* Report 5 (31 bytes) is used to send data to the controller via USB */ - ret = sony_set_output_report(sc, 0x05, 248); diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.06-hid_sony-add_SMK_link.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.06-hid_sony-add_SMK_link.patch deleted file mode 100644 index a9b505c693..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-058.06-hid_sony-add_SMK_link.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index 61b604f..0ad4515 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1828,6 +1828,7 @@ static const struct hid_device_id hid_have_special_driver[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, - { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 0af8e93..f14b038 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -775,6 +775,7 @@ - #define USB_VENDOR_ID_SKYCABLE 0x1223 - #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 - -+#define USB_VENDOR_ID_SMK 0x0609 - #define USB_VENDOR_ID_SONY 0x054c - #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b - #define USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE 0x0374 -diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c -index 1235405..69e2bf6 100644 ---- a/drivers/hid/hid-sony.c -+++ b/drivers/hid/hid-sony.c -@@ -1153,6 +1153,9 @@ static const struct hid_device_id sony_devices[] = { - .driver_data = DUALSHOCK4_CONTROLLER_USB }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER), - .driver_data = DUALSHOCK4_CONTROLLER_BT }, -+ /* SMK-Link Universal Remote Control VP3700 */ -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SONY_PS3_BDREMOTE), -+ .driver_data = PS3REMOTE }, - { } - }; - MODULE_DEVICE_TABLE(hid, sony_devices); diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-059-remove_some_xpad_pids-0.2.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-059-remove_some_xpad_pids-0.2.patch deleted file mode 100644 index 4a6d1c7a08..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-059-remove_some_xpad_pids-0.2.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur linux-3.8.4/drivers/input/joystick/xpad.c linux-3.8.4.patch/drivers/input/joystick/xpad.c ---- linux-3.8.4/drivers/input/joystick/xpad.c 2013-03-20 21:11:19.000000000 +0100 -+++ linux-3.8.4.patch/drivers/input/joystick/xpad.c 2013-03-26 20:24:29.273978355 +0100 -@@ -174,7 +174,6 @@ - { 0x1bad, 0xf901, "Gamestop Xbox 360 Controller", 0, XTYPE_XBOX360 }, - { 0x1bad, 0xf903, "Tron Xbox 360 controller", 0, XTYPE_XBOX360 }, - { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, -- { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, - { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } - }; - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-060-add_AUGUST_DVB-T205.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-060-add_AUGUST_DVB-T205.patch deleted file mode 100644 index 78a3468d38..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-060-add_AUGUST_DVB-T205.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur linux-cuboxi-3.14-aab1674/drivers/media/usb/dvb-usb-v2/rtl28xxu.c linux-cuboxi-3.14-aab1674.patch/drivers/media/usb/dvb-usb-v2/rtl28xxu.c ---- linux-cuboxi-3.14-aab1674/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 2014-08-26 14:31:42.000000000 +0200 -+++ linux-cuboxi-3.14-aab1674.patch/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 2014-08-26 18:23:05.035432084 +0200 -@@ -1441,6 +1441,8 @@ - &rtl2832u_props, "Sveon STV20", NULL) }, - { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV27, - &rtl2832u_props, "Sveon STV27", NULL) }, -+ { DVB_USB_DEVICE(USB_VID_GTEK, 0xa803, -+ &rtl2832u_props, "Realtek RTL2832U reference design", NULL) }, - - /* RTL2832P devices: */ - { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131, diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-061-valve-xpad-rework.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-061-valve-xpad-rework.patch deleted file mode 100644 index c485a63e49..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-061-valve-xpad-rework.patch +++ /dev/null @@ -1,462 +0,0 @@ ---- a/drivers/input/joystick/xpad.c 2016-11-02 11:32:23.105562200 +0100 -+++ b/drivers/input/joystick/xpad.c 2016-11-02 11:33:00.065676100 +0100 -@@ -281,17 +281,21 @@ struct usb_xpad { - struct urb *irq_out; /* urb for interrupt out report */ - unsigned char *odata; /* output data */ - dma_addr_t odata_dma; -- struct mutex odata_mutex; -+ spinlock_t odata_lock; - #endif - - #if defined(CONFIG_JOYSTICK_XPAD_LEDS) - struct xpad_led *led; - #endif -+ -+ int joydev_id; - - char phys[64]; /* physical device path */ - - int mapping; /* map d-pad to buttons or to axes */ - int xtype; /* type of xbox device */ -+ -+ const char *name; - }; - - /* -@@ -435,6 +439,109 @@ static void xpad360_process_packet(struc - - input_sync(dev); - } -+static void xpad_send_led_command(struct usb_xpad *xpad, int command); -+static int xpad_open(struct input_dev *dev); -+static void xpad_close(struct input_dev *dev); -+static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs); -+static int xpad_init_ff(struct usb_xpad *xpad); -+static int xpad_find_joydev(struct device *dev, void *data) -+{ -+ if (strstr(dev_name(dev), "js")) -+ return 1; -+ -+ return 0; -+} -+ -+static struct workqueue_struct *my_wq; -+ -+typedef struct { -+ struct work_struct my_work; -+ struct usb_xpad *xpad; -+} my_work_t; -+ -+static void my_wq_function( struct work_struct *work) -+{ -+ my_work_t *my_work = (my_work_t *)work; -+ -+ struct usb_xpad *xpad = my_work->xpad; -+ -+ if (xpad->pad_present) { -+ -+ struct input_dev *input_dev; -+ int i; -+ -+ input_dev = input_allocate_device(); -+ -+ xpad->dev = input_dev; -+ input_dev->name = xpad->name; -+ input_dev->phys = xpad->phys; -+ usb_to_input_id(xpad->udev, &input_dev->id); -+ input_dev->dev.parent = &xpad->intf->dev; -+ -+ input_set_drvdata(input_dev, xpad); -+ -+ input_dev->open = xpad_open; -+ input_dev->close = xpad_close; -+ -+ input_dev->evbit[0] = BIT_MASK(EV_KEY); -+ -+ if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { -+ input_dev->evbit[0] |= BIT_MASK(EV_ABS); -+ /* set up axes */ -+ for (i = 0; xpad_abs[i] >= 0; i++) -+ xpad_set_up_abs(input_dev, xpad_abs[i]); -+ } -+ -+ /* set up standard buttons */ -+ for (i = 0; xpad_common_btn[i] >= 0; i++) -+ __set_bit(xpad_common_btn[i], input_dev->keybit); -+ -+ /* set up model-specific ones */ -+ if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W) { -+ for (i = 0; xpad360_btn[i] >= 0; i++) -+ __set_bit(xpad360_btn[i], input_dev->keybit); -+ } else { -+ for (i = 0; xpad_btn[i] >= 0; i++) -+ __set_bit(xpad_btn[i], input_dev->keybit); -+ } -+ -+ if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { -+ for (i = 0; xpad_btn_pad[i] >= 0; i++) -+ __set_bit(xpad_btn_pad[i], input_dev->keybit); -+ } else { -+ for (i = 0; xpad_abs_pad[i] >= 0; i++) -+ xpad_set_up_abs(input_dev, xpad_abs_pad[i]); -+ } -+ -+ if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { -+ for (i = 0; xpad_btn_triggers[i] >= 0; i++) -+ __set_bit(xpad_btn_triggers[i], input_dev->keybit); -+ } else { -+ for (i = 0; xpad_abs_triggers[i] >= 0; i++) -+ xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); -+ } -+ -+ input_register_device(xpad->dev); -+ -+ { -+ struct device* joydev_dev = device_find_child(&xpad->dev->dev, NULL, xpad_find_joydev); -+ -+ if (joydev_dev) { -+// printk("found joydev child with minor %i\n", MINOR(joydev_dev->devt)); -+ xpad->joydev_id = MINOR(joydev_dev->devt); -+ xpad_send_led_command(xpad, (xpad->joydev_id % 4) + 2); -+ } -+ } -+ -+ xpad_init_ff(xpad); -+ } else { -+ input_unregister_device(xpad->dev); -+ } -+ -+ kfree( (void *)work ); -+ -+ return; -+} - - /* - * xpad360w_process_packet -@@ -456,11 +563,35 @@ static void xpad360w_process_packet(stru - /* Presence change */ - if (data[0] & 0x08) { - if (data[1] & 0x80) { -- xpad->pad_present = 1; -- usb_submit_urb(xpad->bulk_out, GFP_ATOMIC); -- } else -- xpad->pad_present = 0; -+ -+ if (!xpad->pad_present) -+ { -+ my_work_t * work; -+ xpad->pad_present = 1; -+ usb_submit_urb(xpad->bulk_out, GFP_ATOMIC); -+ -+ work = (my_work_t *)kmalloc(sizeof(my_work_t), GFP_KERNEL); -+ INIT_WORK( (struct work_struct *)work, my_wq_function ); -+ work->xpad = xpad; -+ queue_work( my_wq, (struct work_struct *)work ); -+ } -+ -+ } else { -+ if (xpad->pad_present) -+ { -+ my_work_t * work; -+ xpad->pad_present = 0; -+ -+ work = (my_work_t *)kmalloc(sizeof(my_work_t), GFP_KERNEL); -+ INIT_WORK( (struct work_struct *)work, my_wq_function ); -+ work->xpad = xpad; -+ queue_work( my_wq, (struct work_struct *)work ); -+ } -+// printk("got kill packet for id %i\n", xpad->joydev_id); -+ } - } -+ -+// printk("xpad packet %hhX %hhX %hhX %hhX %hhX %hhX\n", data[0], data[1], data[2], data[3], data[4], data[5]); - - /* Valid pad data */ - if (!(data[1] & 0x1)) -@@ -476,6 +607,8 @@ static void xpad_irq_in(struct urb *urb) - int retval, status; - - status = urb->status; -+ -+// printk("xpad_irq_in %i\n", status); - - switch (status) { - case 0: -@@ -584,8 +717,6 @@ static int xpad_init_output(struct usb_i - goto fail1; - } - -- mutex_init(&xpad->odata_mutex); -- - xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); - if (!xpad->irq_out) { - error = -ENOMEM; -@@ -714,15 +845,38 @@ struct xpad_led { - - static void xpad_send_led_command(struct usb_xpad *xpad, int command) - { -- if (command >= 0 && command < 14) { -- mutex_lock(&xpad->odata_mutex); -- xpad->odata[0] = 0x01; -- xpad->odata[1] = 0x03; -- xpad->odata[2] = command; -- xpad->irq_out->transfer_buffer_length = 3; -- usb_submit_urb(xpad->irq_out, GFP_KERNEL); -- mutex_unlock(&xpad->odata_mutex); -+ if ((unsigned)command > 15) -+ return; -+ -+ spin_lock(&xpad->odata_lock); -+ -+ switch (xpad->xtype) { -+ -+ case XTYPE_XBOX360: -+ xpad->odata[0] = 0x01; -+ xpad->odata[1] = 0x03; -+ xpad->odata[2] = command; -+ xpad->irq_out->transfer_buffer_length = 3; -+ break; -+ case XTYPE_XBOX360W: -+ xpad->odata[0] = 0x00; -+ xpad->odata[1] = 0x00; -+ xpad->odata[2] = 0x08; -+ xpad->odata[3] = 0x40 + (command % 0x0e); -+ xpad->odata[4] = 0x00; -+ xpad->odata[5] = 0x00; -+ xpad->odata[6] = 0x00; -+ xpad->odata[7] = 0x00; -+ xpad->odata[8] = 0x00; -+ xpad->odata[9] = 0x00; -+ xpad->odata[10] = 0x00; -+ xpad->odata[11] = 0x00; -+ xpad->irq_out->transfer_buffer_length = 12; -+ break; - } -+ -+ usb_submit_urb(xpad->irq_out, GFP_KERNEL); -+ spin_unlock(&xpad->odata_lock); - } - - static void xpad_led_set(struct led_classdev *led_cdev, -@@ -741,8 +895,10 @@ static int xpad_led_probe(struct usb_xpa - struct xpad_led *led; - struct led_classdev *led_cdev; - int error; -+ -+// printk("xpad_led_probe\n"); - -- if (xpad->xtype != XTYPE_XBOX360) -+ if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX360W) - return 0; - - xpad->led = led = kzalloc(sizeof(struct xpad_led), GFP_KERNEL); -@@ -765,11 +921,6 @@ static int xpad_led_probe(struct usb_xpa - return error; - } - -- /* -- * Light up the segment corresponding to controller number -- */ -- xpad_send_led_command(xpad, (led_no % 4) + 2); -- - return 0; - } - -@@ -791,6 +942,7 @@ static void xpad_led_disconnect(struct u - static int xpad_open(struct input_dev *dev) - { - struct usb_xpad *xpad = input_get_drvdata(dev); -+// printk("xpad open driver data %x\n", (unsigned int)xpad); - - /* URB was submitted in probe */ - if (xpad->xtype == XTYPE_XBOX360W) -@@ -846,19 +998,20 @@ static int xpad_probe(struct usb_interfa - if (intf->cur_altsetting->desc.bNumEndpoints != 2) - return -ENODEV; - -+ if (!my_wq) { -+ my_wq = create_workqueue("xpad_queue"); -+ } -+ - for (i = 0; xpad_device[i].idVendor; i++) { - if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && - (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) - break; - } - - xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); -- input_dev = input_allocate_device(); -- if (!xpad || !input_dev) { -- error = -ENOMEM; -- goto fail1; -- } - -+ xpad->name = xpad_device[i].name; -+ - xpad->idata = usb_alloc_coherent(udev, XPAD_PKT_LEN, - GFP_KERNEL, &xpad->idata_dma); - if (!xpad->idata) { -@@ -894,65 +1047,12 @@ static int xpad_probe(struct usb_interfa - xpad->mapping |= MAP_STICKS_TO_NULL; - } - -- xpad->dev = input_dev; -- usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); -- strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); -- -- input_dev->name = xpad_device[i].name; -- input_dev->phys = xpad->phys; -- usb_to_input_id(udev, &input_dev->id); -- input_dev->dev.parent = &intf->dev; -- -- input_set_drvdata(input_dev, xpad); -- -- input_dev->open = xpad_open; -- input_dev->close = xpad_close; -- -- input_dev->evbit[0] = BIT_MASK(EV_KEY); -- -- if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { -- input_dev->evbit[0] |= BIT_MASK(EV_ABS); -- /* set up axes */ -- for (i = 0; xpad_abs[i] >= 0; i++) -- xpad_set_up_abs(input_dev, xpad_abs[i]); -- } -- -- /* set up standard buttons */ -- for (i = 0; xpad_common_btn[i] >= 0; i++) -- __set_bit(xpad_common_btn[i], input_dev->keybit); -- -- /* set up model-specific ones */ -- if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W) { -- for (i = 0; xpad360_btn[i] >= 0; i++) -- __set_bit(xpad360_btn[i], input_dev->keybit); -- } else { -- for (i = 0; xpad_btn[i] >= 0; i++) -- __set_bit(xpad_btn[i], input_dev->keybit); -- } -- -- if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { -- for (i = 0; xpad_btn_pad[i] >= 0; i++) -- __set_bit(xpad_btn_pad[i], input_dev->keybit); -- } else { -- for (i = 0; xpad_abs_pad[i] >= 0; i++) -- xpad_set_up_abs(input_dev, xpad_abs_pad[i]); -- } -- -- if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { -- for (i = 0; xpad_btn_triggers[i] >= 0; i++) -- __set_bit(xpad_btn_triggers[i], input_dev->keybit); -- } else { -- for (i = 0; xpad_abs_triggers[i] >= 0; i++) -- xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); -- } -- - error = xpad_init_output(intf, xpad); - if (error) - goto fail3; - -- error = xpad_init_ff(xpad); -- if (error) -- goto fail4; -+ usb_make_path(xpad->udev, xpad->phys, sizeof(xpad->phys)); -+ strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); - - error = xpad_led_probe(xpad); - if (error) -@@ -966,10 +1066,6 @@ static int xpad_probe(struct usb_interfa - xpad->irq_in->transfer_dma = xpad->idata_dma; - xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - -- error = input_register_device(xpad->dev); -- if (error) -- goto fail6; -- - usb_set_intfdata(intf, xpad); - - if (xpad->xtype == XTYPE_XBOX360W) { -@@ -977,6 +1073,7 @@ static int xpad_probe(struct usb_interfa - * Setup the message to set the LEDs on the - * controller when it shows up - */ -+ spin_lock(&xpad->odata_lock); - xpad->bulk_out = usb_alloc_urb(0, GFP_KERNEL); - if (!xpad->bulk_out) { - error = -ENOMEM; -@@ -1028,23 +1125,55 @@ static int xpad_probe(struct usb_interfa - */ - xpad->irq_in->dev = xpad->udev; - error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); -+ -+ spin_unlock(&xpad->odata_lock); - if (error) - goto fail9; -+ -+ // I don't know how to check controller state on driver load so just slam them -+ // off so that people have to turn them on, triggering a state update -+ -+ // got the power off packet from an OSX reverse-engineered driver: -+ // http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver#toc1 -+ spin_lock(&xpad->odata_lock); -+ xpad->odata[0] = 0x00; -+ xpad->odata[1] = 0x00; -+ xpad->odata[2] = 0x08; -+ xpad->odata[3] = 0xC0; -+ xpad->odata[4] = 0x00; -+ xpad->odata[5] = 0x00; -+ xpad->odata[6] = 0x00; -+ xpad->odata[7] = 0x00; -+ xpad->odata[8] = 0x00; -+ xpad->odata[9] = 0x00; -+ xpad->odata[10] = 0x00; -+ xpad->odata[11] = 0x00; -+ xpad->irq_out->transfer_buffer_length = 12; -+ usb_submit_urb(xpad->irq_out, GFP_KERNEL); -+ spin_unlock(&xpad->odata_lock); -+ } else { -+ my_work_t *work; -+ xpad->pad_present = 1; -+ -+ work = (my_work_t *)kmalloc(sizeof(my_work_t), GFP_KERNEL); -+ INIT_WORK( (struct work_struct *)work, my_wq_function ); -+ work->xpad = xpad; -+ queue_work( my_wq, (struct work_struct *)work ); - } - - return 0; - - fail9: kfree(xpad->bdata); - fail8: usb_free_urb(xpad->bulk_out); -- fail7: input_unregister_device(input_dev); -- input_dev = NULL; -+ fail7: //input_unregister_device(input_dev); -+ //input_dev = NULL; - fail6: xpad_led_disconnect(xpad); -- fail5: if (input_dev) -- input_ff_destroy(input_dev); -+ fail5: //if (input_dev) -+ //input_ff_destroy(input_dev); - fail4: xpad_deinit_output(xpad); - fail3: usb_free_urb(xpad->irq_in); - fail2: usb_free_coherent(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); -- fail1: input_free_device(input_dev); -+ fail1: //input_free_device(input_dev); - kfree(xpad); - return error; - -@@ -1054,8 +1183,14 @@ static void xpad_disconnect(struct usb_i - { - struct usb_xpad *xpad = usb_get_intfdata (intf); - -+// printk("xpad_disconnect\n"); - xpad_led_disconnect(xpad); -- input_unregister_device(xpad->dev); -+ -+ if (xpad->pad_present) -+ { -+ xpad->pad_present = 0; -+ input_unregister_device(xpad->dev); -+ } - xpad_deinit_output(xpad); - - if (xpad->xtype == XTYPE_XBOX360W) { diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-203-stb0899_enable_low_symbol_rate.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-203-stb0899_enable_low_symbol_rate.patch deleted file mode 100644 index f302b6ce1b..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-203-stb0899_enable_low_symbol_rate.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c ---- linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-16 10:25:43.479645317 +0100 -@@ -1581,7 +1581,7 @@ - .frequency_max = 2150000, - .frequency_stepsize = 0, - .frequency_tolerance = 0, -- .symbol_rate_min = 5000000, -+ .symbol_rate_min = 1000000, - .symbol_rate_max = 45000000, - - .caps = FE_CAN_INVERSION_AUTO | diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-210-dvbsky.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-210-dvbsky.patch deleted file mode 100644 index 7102fc318b..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-210-dvbsky.patch +++ /dev/null @@ -1,6132 +0,0 @@ -diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig -index 49db718..6ddcfc9 100644 ---- a/drivers/media/dvb-frontends/Kconfig -+++ b/drivers/media/dvb-frontends/Kconfig -@@ -248,6 +248,20 @@ config DVB_CX24117 - help - A Dual DVB-S/S2 tuner module. Say Y when you want to support this frontend. - -+config DVB_DVBSKY_M88DS3103 -+ tristate "Montage M88DS3103 based (dvbsky)" -+ depends on DVB_CORE && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT -+ help -+ A DVB-S/S2 tuner module. Say Y when you want to support this frontend. -+ -+config DVB_DVBSKY_M88DC2800 -+ tristate "Montage M88DC2800 based (dvbsky)" -+ depends on DVB_CORE && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT -+ help -+ A DVB-C tuner module. Say Y when you want to support this frontend. -+ - config DVB_SI21XX - tristate "Silicon Labs SI21XX based" - depends on DVB_CORE && I2C -diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile -index 9b21488..edaae0d 100644 ---- a/drivers/media/dvb-frontends/Makefile -+++ b/drivers/media/dvb-frontends/Makefile -@@ -112,4 +112,5 @@ obj-$(CONFIG_DVB_RTL2830) += rtl2830.o - obj-$(CONFIG_DVB_RTL2832) += rtl2832.o - obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o - obj-$(CONFIG_DVB_AF9033) += af9033.o -- -+obj-$(CONFIG_DVB_DVBSKY_M88DS3103) += dvbsky_m88ds3103.o -+obj-$(CONFIG_DVB_DVBSKY_M88DC2800) += dvbsky_m88dc2800.o -diff --git a/drivers/media/dvb-frontends/dvbsky_m88dc2800.c b/drivers/media/dvb-frontends/dvbsky_m88dc2800.c -new file mode 100644 -index 0000000..3c933b4 ---- /dev/null -+++ b/drivers/media/dvb-frontends/dvbsky_m88dc2800.c -@@ -0,0 +1,2124 @@ -+/* -+ M88DC2800/M88TC2800 - DVB-C demodulator and tuner from Montage -+ -+ Copyright (C) 2012 Max nibble -+ Copyright (C) 2011 Montage Technology / www.montage-tech.com -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "dvb_frontend.h" -+#include "dvbsky_m88dc2800.h" -+ -+struct dvbsky_m88dc2800_state { -+ struct i2c_adapter *i2c; -+ const struct dvbsky_m88dc2800_config *config; -+ struct dvb_frontend frontend; -+ u32 freq; -+ u32 ber; -+ u32 sym; -+ u16 qam; -+ u8 inverted; -+ u32 xtal; -+ /* tuner state */ -+ u8 tuner_init_OK; /* Tuner initialize status */ -+ u8 tuner_dev_addr; /* Tuner device address */ -+ u32 tuner_freq; /* RF frequency to be set, unit: KHz */ -+ u16 tuner_qam; /* Reserved */ -+ u16 tuner_mode; -+ u8 tuner_bandwidth; /* Bandwidth of the channel, unit: MHz, 6/7/8 */ -+ u8 tuner_loopthrough; /* Tuner loop through switch, 0/1 */ -+ u32 tuner_crystal; /* Tuner crystal frequency, unit: KHz */ -+ u32 tuner_dac; /* Tuner DAC frequency, unit: KHz */ -+ u16 tuner_mtt; /* Tuner chip version, D1: 0x0d, E0: 0x0e, E1: 0x8e */ -+ u16 tuner_custom_cfg; -+ u32 tuner_version; /* Tuner driver version number */ -+ u32 tuner_time; -+}; -+ -+static int debug; -+module_param(debug, int, 0644); -+MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); -+ -+#define dprintk(args...) \ -+ do { \ -+ if (debug) \ -+ printk(KERN_INFO "m88dc2800: " args); \ -+ } while (0) -+ -+ -+static int dvbsky_m88dc2800_i2c_write(struct dvbsky_m88dc2800_state *state, u8 addr, -+ u8 * p_data, u8 len) -+{ -+ struct i2c_msg msg = { .flags = 0 }; -+ -+ msg.addr = addr; -+ msg.buf = p_data; -+ msg.len = len; -+ -+ return i2c_transfer(state->i2c, &msg, 1); -+} -+ -+static int dvbsky_m88dc2800_i2c_read(struct dvbsky_m88dc2800_state *state, u8 addr, -+ u8 * p_data, u8 len) -+{ -+ struct i2c_msg msg = { .flags = I2C_M_RD }; -+ -+ msg.addr = addr; -+ msg.buf = p_data; -+ msg.len = len; -+ -+ return i2c_transfer(state->i2c, &msg, 1); -+} -+ -+/*demod register operations.*/ -+static int WriteReg(struct dvbsky_m88dc2800_state *state, u8 reg, u8 data) -+{ -+ u8 buf[] = { reg, data }; -+ u8 addr = state->config->demod_address; -+ int err; -+ -+ dprintk("%s: write reg 0x%02x, value 0x%02x\n", __func__, reg, data); -+ -+ err = dvbsky_m88dc2800_i2c_write(state, addr, buf, 2); -+ -+ if (err != 1) { -+ printk(KERN_ERR -+ "%s: writereg error(err == %i, reg == 0x%02x," -+ " value == 0x%02x)\n", __func__, err, reg, data); -+ return -EIO; -+ } -+ return 0; -+} -+ -+static int ReadReg(struct dvbsky_m88dc2800_state *state, u8 reg) -+{ -+ int ret; -+ u8 b0[] = { reg }; -+ u8 b1[] = { 0 }; -+ u8 addr = state->config->demod_address; -+ -+ ret = dvbsky_m88dc2800_i2c_write(state, addr, b0, 1); -+ -+ if (ret != 1) { -+ printk(KERN_ERR "%s: reg=0x%x (error=%d)\n", -+ __func__, reg, ret); -+ return -EIO; -+ } -+ -+ ret = dvbsky_m88dc2800_i2c_read(state, addr, b1, 1); -+ -+ dprintk("%s: read reg 0x%02x, value 0x%02x\n", __func__, reg, b1[0]); -+ return b1[0]; -+} -+ -+static int _mt_fe_tn_set_reg(struct dvbsky_m88dc2800_state *state, u8 reg, -+ u8 data) -+{ -+ int ret; -+ u8 buf[2]; -+ u8 addr = state->tuner_dev_addr; -+ -+ buf[1] = ReadReg(state, 0x86); -+ buf[1] |= 0x80; -+ ret = WriteReg(state, 0x86, buf[1]); -+ -+ buf[0] = reg; -+ buf[1] = data; -+ -+ ret = dvbsky_m88dc2800_i2c_write(state, addr, buf, 2); -+ if (ret != 1) -+ return -EIO; -+ return 0; -+} -+ -+static int _mt_fe_tn_get_reg(struct dvbsky_m88dc2800_state *state, u8 reg, -+ u8 * p_data) -+{ -+ int ret; -+ u8 buf[2]; -+ u8 addr = state->tuner_dev_addr; -+ -+ buf[1] = ReadReg(state, 0x86); -+ buf[1] |= 0x80; -+ ret = WriteReg(state, 0x86, buf[1]); -+ -+ buf[0] = reg; -+ ret = dvbsky_m88dc2800_i2c_write(state, addr, buf, 1); -+ -+ msleep(1); -+ -+ buf[1] = ReadReg(state, 0x86); -+ buf[1] |= 0x80; -+ ret = WriteReg(state, 0x86, buf[1]); -+ -+ return dvbsky_m88dc2800_i2c_read(state, addr, p_data, 1); -+} -+ -+/* Tuner operation functions.*/ -+static int _mt_fe_tn_set_RF_front_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ u32 freq_KHz = state->tuner_freq; -+ u8 a, b, c; -+ if (state->tuner_mtt == 0xD1) { /* D1 */ -+ if (freq_KHz <= 123000) { -+ if (freq_KHz <= 56000) { -+ a = 0x00; b = 0x00; c = 0x00; -+ } else if (freq_KHz <= 64000) { -+ a = 0x10; b = 0x01; c = 0x08; -+ } else if (freq_KHz <= 72000) { -+ a = 0x20; b = 0x02; c = 0x10; -+ } else if (freq_KHz <= 80000) { -+ a = 0x30; b = 0x03; c = 0x18; -+ } else if (freq_KHz <= 88000) { -+ a = 0x40; b = 0x04; c = 0x20; -+ } else if (freq_KHz <= 96000) { -+ a = 0x50; b = 0x05; c = 0x28; -+ } else if (freq_KHz <= 104000) { -+ a = 0x60; b = 0x06; c = 0x30; -+ } else { -+ a = 0x70; b = 0x07; c = 0x38; -+ } -+ _mt_fe_tn_set_reg(state, 0x58, 0x9b); -+ _mt_fe_tn_set_reg(state, 0x59, a); -+ _mt_fe_tn_set_reg(state, 0x5d, b); -+ _mt_fe_tn_set_reg(state, 0x5e, c); -+ _mt_fe_tn_set_reg(state, 0x5a, 0x75); -+ _mt_fe_tn_set_reg(state, 0x73, 0x0c); -+ } else { /* if (freq_KHz > 112000) */ -+ _mt_fe_tn_set_reg(state, 0x58, 0x7b); -+ if (freq_KHz <= 304000) { -+ if (freq_KHz <= 136000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x40); -+ } else if (freq_KHz <= 160000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x48); -+ } else if (freq_KHz <= 184000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x50); -+ } else if (freq_KHz <= 208000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x58); -+ } else if (freq_KHz <= 232000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x60); -+ } else if (freq_KHz <= 256000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x68); -+ } else if (freq_KHz <= 280000) { -+ _mt_fe_tn_set_reg(state, 0x5e, 0x70); -+ } else { /* if (freq_KHz <= 304000) */ -+ _mt_fe_tn_set_reg(state, 0x5e, 0x78); -+ } -+ if (freq_KHz <= 171000) { -+ _mt_fe_tn_set_reg(state, 0x73, 0x08); -+ } else if (freq_KHz <= 211000) { -+ _mt_fe_tn_set_reg(state, 0x73, 0x0a); -+ } else { -+ _mt_fe_tn_set_reg(state, 0x73, 0x0e); -+ } -+ } else { /* if (freq_KHz > 304000) */ -+ _mt_fe_tn_set_reg(state, 0x5e, 0x88); -+ if (freq_KHz <= 400000) { -+ _mt_fe_tn_set_reg(state, 0x73, 0x0c); -+ } else if (freq_KHz <= 450000) { -+ _mt_fe_tn_set_reg(state, 0x73, 0x09); -+ } else if (freq_KHz <= 550000) { -+ _mt_fe_tn_set_reg(state, 0x73, 0x0e); -+ } else if (freq_KHz <= 650000) { -+ _mt_fe_tn_set_reg(state, 0x73, 0x0d); -+ } else { /*if (freq_KHz > 650000) */ -+ _mt_fe_tn_set_reg(state, 0x73, 0x0e); -+ } -+ } -+ } -+ if (freq_KHz > 800000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x24); -+ else if (freq_KHz > 700000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x34); -+ else if (freq_KHz > 500000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x44); -+ else if (freq_KHz > 300000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x43); -+ else if (freq_KHz > 220000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ else if (freq_KHz > 110000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x14); -+ else -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ if (freq_KHz > 600000) -+ _mt_fe_tn_set_reg(state, 0x6a, 0x53); -+ else if (freq_KHz > 500000) -+ _mt_fe_tn_set_reg(state, 0x6a, 0x57); -+ else -+ _mt_fe_tn_set_reg(state, 0x6a, 0x59); -+ if (freq_KHz < 200000) { -+ _mt_fe_tn_set_reg(state, 0x20, 0x5d); -+ } else if (freq_KHz < 500000) { -+ _mt_fe_tn_set_reg(state, 0x20, 0x7d); -+ } else { -+ _mt_fe_tn_set_reg(state, 0x20, 0xfd); -+ } /* end of 0xD1 */ -+ } else if (state->tuner_mtt == 0xE1) { /* E1 */ -+ if (freq_KHz <= 112000) { /* 123MHz */ -+ if (freq_KHz <= 56000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x01); -+ } else if (freq_KHz <= 64000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x09); -+ } else if (freq_KHz <= 72000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x11); -+ } else if (freq_KHz <= 80000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x19); -+ } else if (freq_KHz <= 88000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x21); -+ } else if (freq_KHz <= 96000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x29); -+ } else if (freq_KHz <= 104000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x31); -+ } else { /* if (freq_KHz <= 112000) */ -+ _mt_fe_tn_set_reg(state, 0x5c, 0x39); -+ } -+ _mt_fe_tn_set_reg(state, 0x5b, 0x30); -+ } else { /* if (freq_KHz > 112000) */ -+ if (freq_KHz <= 304000) { -+ if (freq_KHz <= 136000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x41); -+ } else if (freq_KHz <= 160000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x49); -+ } else if (freq_KHz <= 184000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x51); -+ } else if (freq_KHz <= 208000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x59); -+ } else if (freq_KHz <= 232000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x61); -+ } else if (freq_KHz <= 256000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x69); -+ } else if (freq_KHz <= 280000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x71); -+ } else { /* if (freq_KHz <= 304000) */ -+ _mt_fe_tn_set_reg(state, 0x5c, 0x79); -+ } -+ if (freq_KHz <= 150000) { -+ _mt_fe_tn_set_reg(state, 0x5b, 0x28); -+ } else if (freq_KHz <= 256000) { -+ _mt_fe_tn_set_reg(state, 0x5b, 0x29); -+ } else { -+ _mt_fe_tn_set_reg(state, 0x5b, 0x2a); -+ } -+ } else { /* if (freq_KHz > 304000) */ -+ if (freq_KHz <= 400000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x89); -+ } else if (freq_KHz <= 450000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x91); -+ } else if (freq_KHz <= 650000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0x98); -+ } else if (freq_KHz <= 850000) { -+ _mt_fe_tn_set_reg(state, 0x5c, 0xa0); -+ } else { -+ _mt_fe_tn_set_reg(state, 0x5c, 0xa8); -+ } -+ _mt_fe_tn_set_reg(state, 0x5b, 0x08); -+ } -+ } -+ } /* end of 0xE1 */ -+ return 0; -+} -+ -+static int _mt_fe_tn_cali_PLL_tc2800(struct dvbsky_m88dc2800_state *state, -+ u32 freq_KHz, -+ u32 cali_freq_thres_div2, -+ u32 cali_freq_thres_div3r, -+ u32 cali_freq_thres_div3) -+{ -+ s32 N, F, MUL; -+ u8 buf, tmp, tmp2; -+ s32 M; -+ const s32 crystal_KHz = state->tuner_crystal; -+ if (state->tuner_mtt == 0xD1) { -+ M = state->tuner_crystal / 4000; -+ if (freq_KHz > cali_freq_thres_div2) { -+ MUL = 4; -+ tmp = 2; -+ } else if (freq_KHz > 300000) { -+ MUL = 8; -+ tmp = 3; -+ } else if (freq_KHz > (cali_freq_thres_div2 / 2)) { -+ MUL = 8; -+ tmp = 4; -+ } else if (freq_KHz > (cali_freq_thres_div2 / 4)) { -+ MUL = 16; -+ tmp = 5; -+ } else if (freq_KHz > (cali_freq_thres_div2 / 8)) { -+ MUL = 32; -+ tmp = 6; -+ } else if (freq_KHz > (cali_freq_thres_div2 / 16)) { -+ MUL = 64; -+ tmp = 7; -+ } else { /* invalid */ -+ MUL = 0; -+ tmp = 0; -+ return 1; -+ } -+ } else if (state->tuner_mtt == 0xE1) { -+ M = state->tuner_crystal / 1000; -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_set_reg(state, 0x32, 0xe0); -+ _mt_fe_tn_set_reg(state, 0x33, 0x86); -+ _mt_fe_tn_set_reg(state, 0x37, 0x70); -+ _mt_fe_tn_set_reg(state, 0x38, 0x20); -+ _mt_fe_tn_set_reg(state, 0x39, 0x18); -+ _mt_fe_tn_set_reg(state, 0x89, 0x83); -+ if (freq_KHz > cali_freq_thres_div2) { -+ M = M / 4; -+ MUL = 4; -+ tmp = 2; -+ tmp2 = M + 16; /* 48 */ -+ } else if (freq_KHz > cali_freq_thres_div3r) { -+ M = M / 3; -+ MUL = 6; -+ tmp = 2; -+ tmp2 = M + 32; /* 32 */ -+ } else if (freq_KHz > cali_freq_thres_div3) { -+ M = M / 3; -+ MUL = 6; -+ tmp = 2; -+ tmp2 = M; /* 16 */ -+ } else if (freq_KHz > 304000) { -+ M = M / 4; -+ MUL = 8; -+ tmp = 3; -+ tmp2 = M + 16; /* 48 */ -+ } else if (freq_KHz > (cali_freq_thres_div2 / 2)) { -+ M = M / 4; -+ MUL = 8; -+ tmp = 4; -+ tmp2 = M + 16; /* 48 */ -+ } else if (freq_KHz > (cali_freq_thres_div3r / 2)) { -+ M = M / 3; -+ MUL = 12; -+ tmp = 4; -+ tmp2 = M + 32; /* 32 */ -+ } else if (freq_KHz > (cali_freq_thres_div3 / 2)) { -+ M = M / 3; -+ MUL = 12; -+ tmp = 4; -+ tmp2 = M; /* 16 */ -+ } else if (freq_KHz > (cali_freq_thres_div2 / 4)) { -+ M = M / 4; -+ MUL = 16; -+ tmp = 5; -+ tmp2 = M + 16; /* 48 */ -+ } else if (freq_KHz > (cali_freq_thres_div3r / 4)) { -+ M = M / 3; -+ MUL = 24; -+ tmp = 5; -+ tmp2 = M + 32; /* 32 */ -+ } else if (freq_KHz > (cali_freq_thres_div3 / 4)) { -+ M = M / 3; -+ MUL = 24; -+ tmp = 5; -+ tmp2 = M; /* 16 */ -+ } else if (freq_KHz > (cali_freq_thres_div2 / 8)) { -+ M = M / 4; -+ MUL = 32; -+ tmp = 6; -+ tmp2 = M + 16; /* 48 */ -+ } else if (freq_KHz > (cali_freq_thres_div3r / 8)) { -+ M = M / 3; -+ MUL = 48; -+ tmp = 6; -+ tmp2 = M + 32; /* 32 */ -+ } else if (freq_KHz > (cali_freq_thres_div3 / 8)) { -+ M = M / 3; -+ MUL = 48; -+ tmp = 6; -+ tmp2 = M; /* 16 */ -+ } else if (freq_KHz > (cali_freq_thres_div2 / 16)) { -+ M = M / 4; -+ MUL = 64; -+ tmp = 7; -+ tmp2 = M + 16; /* 48 */ -+ } else if (freq_KHz > (cali_freq_thres_div3r / 16)) { -+ M = M / 3; -+ MUL = 96; -+ tmp = 7; -+ tmp2 = M + 32; /* 32 */ -+ } else if (freq_KHz > (cali_freq_thres_div3 / 16)) { -+ M = M / 3; -+ MUL = 96; -+ tmp = 7; -+ tmp2 = M; /* 16 */ -+ } else { /* invalid */ -+ M = M / 4; -+ MUL = 0; -+ tmp = 0; -+ tmp2 = 48; -+ return 1; -+ } -+ if (freq_KHz == 291000) { -+ M = state->tuner_crystal / 1000 / 3; -+ MUL = 12; -+ tmp = 4; -+ tmp2 = M + 32; /* 32 */ -+ } -+ /* -+ if (freq_KHz == 578000) { -+ M = state->tuner_crystal / 1000 / 4; -+ MUL = 4; -+ tmp = 2; -+ tmp2 = M + 16; // 48 -+ } -+ */ -+ if (freq_KHz == 690000) { -+ M = state->tuner_crystal / 1000 / 3; -+ MUL = 4; -+ tmp = 2; -+ tmp2 = M + 16; /* 48 */ -+ } -+ _mt_fe_tn_get_reg(state, 0x33, &buf); -+ buf &= 0xc0; -+ buf += tmp2; -+ _mt_fe_tn_set_reg(state, 0x33, buf); -+ } else { -+ return 1; -+ } -+ _mt_fe_tn_get_reg(state, 0x39, &buf); -+ buf &= 0xf8; -+ buf += tmp; -+ _mt_fe_tn_set_reg(state, 0x39, buf); -+ N = (freq_KHz * MUL * M / crystal_KHz) / 2 * 2 - 256; -+ buf = (N >> 8) & 0xcf; -+ if (state->tuner_mtt == 0xE1) { -+ buf |= 0x30; -+ } -+ _mt_fe_tn_set_reg(state, 0x34, buf); -+ buf = N & 0xff; -+ _mt_fe_tn_set_reg(state, 0x35, buf); -+ F = ((freq_KHz * MUL * M / (crystal_KHz / 1000) / 2) - -+ (freq_KHz * MUL * M / crystal_KHz / 2 * 1000)) * 64 / 1000; -+ buf = F & 0xff; -+ _mt_fe_tn_set_reg(state, 0x36, buf); -+ if (F == 0) { -+ if (state->tuner_mtt == 0xD1) { -+ _mt_fe_tn_set_reg(state, 0x3d, 0xca); -+ } else if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_set_reg(state, 0x3d, 0xfe); -+ } else { -+ return 1; -+ } -+ _mt_fe_tn_set_reg(state, 0x3e, 0x9c); -+ _mt_fe_tn_set_reg(state, 0x3f, 0x34); -+ } -+ if (F > 0) { -+ if (state->tuner_mtt == 0xD1) { -+ if ((F == 32) || (F == 16) || (F == 48)) { -+ _mt_fe_tn_set_reg(state, 0x3e, 0xa4); -+ _mt_fe_tn_set_reg(state, 0x3d, 0x4a); -+ _mt_fe_tn_set_reg(state, 0x3f, 0x36); -+ } else { -+ _mt_fe_tn_set_reg(state, 0x3e, 0xa4); -+ _mt_fe_tn_set_reg(state, 0x3d, 0x4a); -+ _mt_fe_tn_set_reg(state, 0x3f, 0x36); -+ } -+ } else if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_set_reg(state, 0x3e, 0xa4); -+ _mt_fe_tn_set_reg(state, 0x3d, 0x7e); -+ _mt_fe_tn_set_reg(state, 0x3f, 0x36); -+ _mt_fe_tn_set_reg(state, 0x89, 0x84); -+ _mt_fe_tn_get_reg(state, 0x39, &buf); -+ buf = buf & 0x1f; -+ _mt_fe_tn_set_reg(state, 0x39, buf); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = buf | 0x02; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ } else { -+ return 1; -+ } -+ } -+ _mt_fe_tn_set_reg(state, 0x41, 0x00); -+ if (state->tuner_mtt == 0xD1) { -+ msleep(5); -+ } else if (state->tuner_mtt == 0xE1) { -+ msleep(2); -+ } else { -+ return 1; -+ } -+ _mt_fe_tn_set_reg(state, 0x41, 0x02); -+ _mt_fe_tn_set_reg(state, 0x30, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_set_reg(state, 0x31, 0x80); -+ _mt_fe_tn_set_reg(state, 0x31, 0x00); -+ -+ return 0; -+} -+ -+static int _mt_fe_tn_set_PLL_freq_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ u8 buf, buf1; -+ u32 freq_thres_div2_KHz, freq_thres_div3r_KHz, -+ freq_thres_div3_KHz; -+ const u32 freq_KHz = state->tuner_freq; -+ if (state->tuner_mtt == 0xD1) { -+ _mt_fe_tn_set_reg(state, 0x32, 0xe1); -+ _mt_fe_tn_set_reg(state, 0x33, 0xa6); -+ _mt_fe_tn_set_reg(state, 0x37, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x38, 0x20); -+ _mt_fe_tn_set_reg(state, 0x39, 0x18); -+ _mt_fe_tn_set_reg(state, 0x40, 0x40); -+ freq_thres_div2_KHz = 520000; -+ _mt_fe_tn_cali_PLL_tc2800(state, freq_KHz, -+ freq_thres_div2_KHz, 0, 0); -+ msleep(5); -+ _mt_fe_tn_get_reg(state, 0x3a, &buf); -+ buf1 = buf; -+ buf = buf & 0x03; -+ buf1 = buf1 & 0x01; -+ if ((buf1 == 0) || (buf == 3)) { -+ freq_thres_div2_KHz = 420000; -+ _mt_fe_tn_cali_PLL_tc2800(state, freq_KHz, -+ freq_thres_div2_KHz, 0, -+ 0); -+ msleep(5); -+ _mt_fe_tn_get_reg(state, 0x3a, &buf); -+ buf = buf & 0x07; -+ if (buf == 5) { -+ freq_thres_div2_KHz = 520000; -+ _mt_fe_tn_cali_PLL_tc2800(state, freq_KHz, -+ freq_thres_div2_KHz, -+ 0, 0); -+ msleep(5); -+ } -+ } -+ _mt_fe_tn_get_reg(state, 0x38, &buf); -+ _mt_fe_tn_set_reg(state, 0x38, buf); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = buf | 0x10; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ _mt_fe_tn_set_reg(state, 0x30, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = buf & 0xdf; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ _mt_fe_tn_set_reg(state, 0x40, 0x0); -+ _mt_fe_tn_set_reg(state, 0x30, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_set_reg(state, 0x31, 0x80); -+ _mt_fe_tn_set_reg(state, 0x31, 0x00); -+ msleep(5); -+ _mt_fe_tn_get_reg(state, 0x39, &buf); -+ buf = buf >> 5; -+ if (buf < 5) { -+ _mt_fe_tn_get_reg(state, 0x39, &buf); -+ buf = buf | 0xa0; -+ buf = buf & 0xbf; -+ _mt_fe_tn_set_reg(state, 0x39, buf); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = buf | 0x02; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ } -+ _mt_fe_tn_get_reg(state, 0x37, &buf); -+ if (buf > 0x70) { -+ buf = 0x7f; -+ _mt_fe_tn_set_reg(state, 0x40, 0x40); -+ } -+ _mt_fe_tn_set_reg(state, 0x37, buf); -+ _mt_fe_tn_get_reg(state, 0x38, &buf); -+ if (buf < 0x0f) { -+ buf = (buf & 0x0f) << 2; -+ buf = buf + 0x0f; -+ _mt_fe_tn_set_reg(state, 0x37, buf); -+ } else if (buf < 0x1f) { -+ buf = buf + 0x0f; -+ _mt_fe_tn_set_reg(state, 0x37, buf); -+ } -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = (buf | 0x20) & 0xef; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ _mt_fe_tn_set_reg(state, 0x41, 0x00); -+ msleep(5); -+ _mt_fe_tn_set_reg(state, 0x41, 0x02); -+ } else if (state->tuner_mtt == 0xE1) { -+ freq_thres_div2_KHz = 580000; -+ freq_thres_div3r_KHz = 500000; -+ freq_thres_div3_KHz = 440000; -+ _mt_fe_tn_cali_PLL_tc2800(state, freq_KHz, -+ freq_thres_div2_KHz, -+ freq_thres_div3r_KHz, -+ freq_thres_div3_KHz); -+ msleep(3); -+ _mt_fe_tn_get_reg(state, 0x38, &buf); -+ _mt_fe_tn_set_reg(state, 0x38, buf); -+ _mt_fe_tn_set_reg(state, 0x30, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_set_reg(state, 0x31, 0x80); -+ _mt_fe_tn_set_reg(state, 0x31, 0x00); -+ msleep(3); -+ _mt_fe_tn_get_reg(state, 0x38, &buf); -+ _mt_fe_tn_set_reg(state, 0x38, buf); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = buf | 0x10; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ _mt_fe_tn_set_reg(state, 0x30, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = buf & 0xdf; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ _mt_fe_tn_set_reg(state, 0x31, 0x80); -+ _mt_fe_tn_set_reg(state, 0x31, 0x00); -+ msleep(3); -+ _mt_fe_tn_get_reg(state, 0x37, &buf); -+ _mt_fe_tn_set_reg(state, 0x37, buf); -+ /* -+ if ((freq_KHz == 802000) || (freq_KHz == 826000)) { -+ _mt_fe_tn_set_reg(state, 0x37, 0x5e); -+ } -+ */ -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = (buf & 0xef) | 0x30; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ _mt_fe_tn_set_reg(state, 0x41, 0x00); -+ msleep(2); -+ _mt_fe_tn_set_reg(state, 0x41, 0x02); -+ } else { -+ return 1; -+ } -+ return 0; -+} -+ -+static int _mt_fe_tn_set_BB_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ return 0; -+} -+ -+ static int _mt_fe_tn_set_appendix_tc2800(struct dvbsky_m88dc2800_state *state) -+ -+{ -+ u8 buf; -+ const u32 freq_KHz = state->tuner_freq; -+ if (state->tuner_mtt == 0xD1) { -+ if ((freq_KHz == 123000) || (freq_KHz == 147000) || -+ (freq_KHz == 171000) || (freq_KHz == 195000)) { -+ _mt_fe_tn_set_reg(state, 0x20, 0x1b); -+ } -+ if ((freq_KHz == 371000) || (freq_KHz == 419000) || -+ (freq_KHz == 610000) || (freq_KHz == 730000) || -+ (freq_KHz == 754000) || (freq_KHz == 826000)) { -+ _mt_fe_tn_get_reg(state, 0x0d, &buf); -+ _mt_fe_tn_set_reg(state, 0x0d, (u8) (buf + 1)); -+ } -+ if ((freq_KHz == 522000) || (freq_KHz == 578000) || -+ (freq_KHz == 634000) || (freq_KHz == 690000) || -+ (freq_KHz == 834000)) { -+ _mt_fe_tn_get_reg(state, 0x0d, &buf); -+ _mt_fe_tn_set_reg(state, 0x0d, (u8) (buf - 1)); -+ } -+ } else if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_set_reg(state, 0x20, 0xfc); -+ if (freq_KHz == 123000 || freq_KHz == 147000 || -+ freq_KHz == 171000 || freq_KHz == 195000 || -+ freq_KHz == 219000 || freq_KHz == 267000 || -+ freq_KHz == 291000 || freq_KHz == 339000 || -+ freq_KHz == 387000 || freq_KHz == 435000 || -+ freq_KHz == 482000 || freq_KHz == 530000 || -+ freq_KHz == 722000 || -+ (state->tuner_custom_cfg == 1 && freq_KHz == 315000)) { -+ _mt_fe_tn_set_reg(state, 0x20, 0x5c); -+ } -+ } -+ return 0; -+} -+ -+ static int _mt_fe_tn_set_DAC_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ u8 buf, tempnumber; -+ s32 N; -+ s32 f1f2number, f1, f2, delta1, Totalnum1; -+ s32 cntT, cntin, NCOI, z0, z1, z2, tmp; -+ u32 fc, fadc, fsd, f2d; -+ u32 FreqTrue108_Hz; -+ s32 M = state->tuner_crystal / 4000; -+ /* const u8 bandwidth = state->tuner_bandwidth; */ -+ const u16 DAC_fre = 108; -+ const u32 crystal_KHz = state->tuner_crystal; -+ const u32 DACFreq_KHz = state->tuner_dac; -+ const u32 freq_KHz = state->tuner_freq; -+ -+ if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_get_reg(state, 0x33, &buf); -+ M = buf & 0x0f; -+ if (M == 0) -+ M = 6; -+ } -+ _mt_fe_tn_get_reg(state, 0x34, &buf); -+ N = buf & 0x07; -+ _mt_fe_tn_get_reg(state, 0x35, &buf); -+ N = (N << 8) + buf; -+ buf = ((N + 256) * crystal_KHz / M / DAC_fre + 500) / 1000; -+ if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_set_appendix_tc2800(state); -+ if (freq_KHz == 187000 || freq_KHz == 195000 || -+ freq_KHz == 131000 || freq_KHz == 211000 || -+ freq_KHz == 219000 || freq_KHz == 227000 || -+ freq_KHz == 267000 || freq_KHz == 299000 || -+ freq_KHz == 347000 || freq_KHz == 363000 || -+ freq_KHz == 395000 || freq_KHz == 403000 || -+ freq_KHz == 435000 || freq_KHz == 482000 || -+ freq_KHz == 474000 || freq_KHz == 490000 || -+ freq_KHz == 610000 || freq_KHz == 642000 || -+ freq_KHz == 666000 || freq_KHz == 722000 || -+ freq_KHz == 754000 || -+ ((freq_KHz == 379000 || freq_KHz == 467000 || -+ freq_KHz == 762000) && state->tuner_custom_cfg != 1)) { -+ buf = buf + 1; -+ } -+ if (freq_KHz == 123000 || freq_KHz == 139000 || -+ freq_KHz == 147000 || freq_KHz == 171000 || -+ freq_KHz == 179000 || freq_KHz == 203000 || -+ freq_KHz == 235000 || freq_KHz == 251000 || -+ freq_KHz == 259000 || freq_KHz == 283000 || -+ freq_KHz == 331000 || freq_KHz == 363000 || -+ freq_KHz == 371000 || freq_KHz == 387000 || -+ freq_KHz == 411000 || freq_KHz == 427000 || -+ freq_KHz == 443000 || freq_KHz == 451000 || -+ freq_KHz == 459000 || freq_KHz == 506000 || -+ freq_KHz == 514000 || freq_KHz == 538000 || -+ freq_KHz == 546000 || freq_KHz == 554000 || -+ freq_KHz == 562000 || freq_KHz == 570000 || -+ freq_KHz == 578000 || freq_KHz == 602000 || -+ freq_KHz == 626000 || freq_KHz == 658000 || -+ freq_KHz == 690000 || freq_KHz == 714000 || -+ freq_KHz == 746000 || freq_KHz == 522000 || -+ freq_KHz == 826000 || freq_KHz == 155000 || -+ freq_KHz == 530000 || -+ ((freq_KHz == 275000 || freq_KHz == 355000) && -+ state->tuner_custom_cfg != 1) || -+ ((freq_KHz == 467000 || freq_KHz == 762000 || -+ freq_KHz == 778000 || freq_KHz == 818000) && -+ state->tuner_custom_cfg == 1)) { -+ buf = buf - 1; -+ } -+ } -+ _mt_fe_tn_set_reg(state, 0x0e, buf); -+ _mt_fe_tn_set_reg(state, 0x0d, buf); -+ f1f2number = -+ (((DACFreq_KHz * M * buf) / crystal_KHz) << 16) / (N + 256) + -+ (((DACFreq_KHz * M * buf) % crystal_KHz) << 16) / ((N + 256) * -+ crystal_KHz); -+ _mt_fe_tn_set_reg(state, 0xf1, (f1f2number & 0xff00) >> 8); -+ _mt_fe_tn_set_reg(state, 0xf2, f1f2number & 0x00ff); -+ FreqTrue108_Hz = -+ (N + 256) * crystal_KHz / (M * buf) * 1000 + -+ (((N + 256) * crystal_KHz) % (M * buf)) * 1000 / (M * buf); -+ f1 = 4096; -+ fc = FreqTrue108_Hz; -+ fadc = fc / 4; -+ fsd = 27000000; -+ f2d = state->tuner_bandwidth * 1000 / 2 - 150; -+ f2 = (fsd / 250) * f2d / ((fc + 500) / 1000); -+ delta1 = ((f1 - f2) << 15) / f2; -+ Totalnum1 = ((f1 - f2) << 15) - delta1 * f2; -+ cntT = f2; -+ cntin = Totalnum1; -+ NCOI = delta1; -+ z0 = cntin; -+ z1 = cntT; -+ z2 = NCOI; -+ tempnumber = (z0 & 0xff00) >> 8; -+ _mt_fe_tn_set_reg(state, 0xc9, (u8) (tempnumber & 0x0f)); -+ tempnumber = (z0 & 0xff); -+ _mt_fe_tn_set_reg(state, 0xca, tempnumber); -+ tempnumber = (z1 & 0xff00) >> 8; -+ _mt_fe_tn_set_reg(state, 0xcb, tempnumber); -+ tempnumber = (z1 & 0xff); -+ _mt_fe_tn_set_reg(state, 0xcc, tempnumber); -+ tempnumber = (z2 & 0xff00) >> 8; -+ _mt_fe_tn_set_reg(state, 0xcd, tempnumber); -+ tempnumber = (z2 & 0xff); -+ _mt_fe_tn_set_reg(state, 0xce, tempnumber); -+ tmp = f1; -+ f1 = f2; -+ f2 = tmp / 2; -+ delta1 = ((f1 - f2) << 15) / f2; -+ Totalnum1 = ((f1 - f2) << 15) - delta1 * f2; -+ NCOI = (f1 << 15) / f2 - (1 << 15); -+ cntT = f2; -+ cntin = Totalnum1; -+ z0 = cntin; -+ z1 = cntT; -+ z2 = NCOI; -+ tempnumber = (z0 & 0xff00) >> 8; -+ _mt_fe_tn_set_reg(state, 0xd9, (u8) (tempnumber & 0x0f)); -+ tempnumber = (z0 & 0xff); -+ _mt_fe_tn_set_reg(state, 0xda, tempnumber); -+ tempnumber = (z1 & 0xff00) >> 8; -+ _mt_fe_tn_set_reg(state, 0xdb, tempnumber); -+ tempnumber = (z1 & 0xff); -+ _mt_fe_tn_set_reg(state, 0xdc, tempnumber); -+ tempnumber = (z2 & 0xff00) >> 8; -+ _mt_fe_tn_set_reg(state, 0xdd, tempnumber); -+ tempnumber = (z2 & 0xff); -+ _mt_fe_tn_set_reg(state, 0xde, tempnumber); -+ -+ return 0; -+} -+ -+static int _mt_fe_tn_preset_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ if (state->tuner_mtt == 0xD1) { -+ _mt_fe_tn_set_reg(state, 0x19, 0x4a); -+ _mt_fe_tn_set_reg(state, 0x1b, 0x4b); -+ _mt_fe_tn_set_reg(state, 0x04, 0x04); -+ _mt_fe_tn_set_reg(state, 0x17, 0x0d); -+ _mt_fe_tn_set_reg(state, 0x62, 0x6c); -+ _mt_fe_tn_set_reg(state, 0x63, 0xf4); -+ _mt_fe_tn_set_reg(state, 0x1f, 0x0e); -+ _mt_fe_tn_set_reg(state, 0x6b, 0xf4); -+ _mt_fe_tn_set_reg(state, 0x14, 0x01); -+ _mt_fe_tn_set_reg(state, 0x5a, 0x75); -+ _mt_fe_tn_set_reg(state, 0x66, 0x74); -+ _mt_fe_tn_set_reg(state, 0x72, 0xe0); -+ _mt_fe_tn_set_reg(state, 0x70, 0x07); -+ _mt_fe_tn_set_reg(state, 0x15, 0x7b); -+ _mt_fe_tn_set_reg(state, 0x55, 0x71); -+ _mt_fe_tn_set_reg(state, 0x75, 0x55); -+ _mt_fe_tn_set_reg(state, 0x76, 0xac); -+ _mt_fe_tn_set_reg(state, 0x77, 0x6c); -+ _mt_fe_tn_set_reg(state, 0x78, 0x8b); -+ _mt_fe_tn_set_reg(state, 0x79, 0x42); -+ _mt_fe_tn_set_reg(state, 0x7a, 0xd2); -+ _mt_fe_tn_set_reg(state, 0x81, 0x01); -+ _mt_fe_tn_set_reg(state, 0x82, 0x00); -+ _mt_fe_tn_set_reg(state, 0x82, 0x02); -+ _mt_fe_tn_set_reg(state, 0x82, 0x04); -+ _mt_fe_tn_set_reg(state, 0x82, 0x06); -+ _mt_fe_tn_set_reg(state, 0x82, 0x08); -+ _mt_fe_tn_set_reg(state, 0x82, 0x09); -+ _mt_fe_tn_set_reg(state, 0x82, 0x29); -+ _mt_fe_tn_set_reg(state, 0x82, 0x49); -+ _mt_fe_tn_set_reg(state, 0x82, 0x58); -+ _mt_fe_tn_set_reg(state, 0x82, 0x59); -+ _mt_fe_tn_set_reg(state, 0x82, 0x98); -+ _mt_fe_tn_set_reg(state, 0x82, 0x99); -+ _mt_fe_tn_set_reg(state, 0x10, 0x05); -+ _mt_fe_tn_set_reg(state, 0x10, 0x0d); -+ _mt_fe_tn_set_reg(state, 0x11, 0x95); -+ _mt_fe_tn_set_reg(state, 0x11, 0x9d); -+ if (state->tuner_loopthrough != 0) { -+ _mt_fe_tn_set_reg(state, 0x67, 0x25); -+ } else { -+ _mt_fe_tn_set_reg(state, 0x67, 0x05); -+ } -+ } else if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_set_reg(state, 0x1b, 0x47); -+ if (state->tuner_mode == 0) { /* DVB-C */ -+ _mt_fe_tn_set_reg(state, 0x66, 0x74); -+ _mt_fe_tn_set_reg(state, 0x62, 0x2c); -+ _mt_fe_tn_set_reg(state, 0x63, 0x54); -+ _mt_fe_tn_set_reg(state, 0x68, 0x0b); -+ _mt_fe_tn_set_reg(state, 0x14, 0x00); -+ } else { /* CTTB */ -+ _mt_fe_tn_set_reg(state, 0x66, 0x74); -+ _mt_fe_tn_set_reg(state, 0x62, 0x0c); -+ _mt_fe_tn_set_reg(state, 0x63, 0x54); -+ _mt_fe_tn_set_reg(state, 0x68, 0x0b); -+ _mt_fe_tn_set_reg(state, 0x14, 0x05); -+ } -+ _mt_fe_tn_set_reg(state, 0x6f, 0x00); -+ _mt_fe_tn_set_reg(state, 0x84, 0x04); -+ _mt_fe_tn_set_reg(state, 0x5e, 0xbe); -+ _mt_fe_tn_set_reg(state, 0x87, 0x07); -+ _mt_fe_tn_set_reg(state, 0x8a, 0x1f); -+ _mt_fe_tn_set_reg(state, 0x8b, 0x1f); -+ _mt_fe_tn_set_reg(state, 0x88, 0x30); -+ _mt_fe_tn_set_reg(state, 0x58, 0x34); -+ _mt_fe_tn_set_reg(state, 0x61, 0x8c); -+ _mt_fe_tn_set_reg(state, 0x6a, 0x42); -+ } -+ return 0; -+} -+ -+static int mt_fe_tn_wakeup_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ _mt_fe_tn_set_reg(state, 0x16, 0xb1); -+ _mt_fe_tn_set_reg(state, 0x09, 0x7d); -+ return 0; -+} -+ -+ static int mt_fe_tn_sleep_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ _mt_fe_tn_set_reg(state, 0x16, 0xb0); -+ _mt_fe_tn_set_reg(state, 0x09, 0x6d); -+ return 0; -+} -+ -+ static int mt_fe_tn_init_tc2800(struct dvbsky_m88dc2800_state *state) -+{ -+ if (state->tuner_init_OK != 1) { -+ state->tuner_dev_addr = 0x61; /* TUNER_I2C_ADDR_TC2800 */ -+ state->tuner_freq = 650000; -+ state->tuner_qam = 0; -+ state->tuner_mode = 0; // 0: DVB-C, 1: CTTB -+ state->tuner_bandwidth = 8; -+ state->tuner_loopthrough = 0; -+ state->tuner_crystal = 24000; -+ state->tuner_dac = 7200; -+ state->tuner_mtt = 0x00; -+ state->tuner_custom_cfg = 0; -+ state->tuner_version = 30022; /* Driver version number */ -+ state->tuner_time = 12092611; -+ state->tuner_init_OK = 1; -+ } -+ _mt_fe_tn_set_reg(state, 0x2b, 0x46); -+ _mt_fe_tn_set_reg(state, 0x2c, 0x75); -+ if (state->tuner_mtt == 0x00) { -+ u8 tmp = 0; -+ _mt_fe_tn_get_reg(state, 0x01, &tmp); -+ printk(KERN_INFO "m88dc2800: tuner id = 0x%02x ", tmp); -+ switch (tmp) { -+ case 0x0d: -+ state->tuner_mtt = 0xD1; -+ break; -+ case 0x8e: -+ default: -+ state->tuner_mtt = 0xE1; -+ break; -+ } -+ } -+ return 0; -+} -+ -+ static int mt_fe_tn_set_freq_tc2800(struct dvbsky_m88dc2800_state *state, -+ u32 freq_KHz) -+{ -+ u8 buf; -+ u8 buf1; -+ -+ mt_fe_tn_init_tc2800(state); -+ state->tuner_freq = freq_KHz; -+ _mt_fe_tn_set_reg(state, 0x21, freq_KHz > 500000 ? 0xb9 : 0x99); -+ mt_fe_tn_wakeup_tc2800(state); -+ _mt_fe_tn_set_reg(state, 0x05, 0x7f); -+ _mt_fe_tn_set_reg(state, 0x06, 0xf8); -+ _mt_fe_tn_set_RF_front_tc2800(state); -+ _mt_fe_tn_set_PLL_freq_tc2800(state); -+ _mt_fe_tn_set_DAC_tc2800(state); -+ _mt_fe_tn_set_BB_tc2800(state); -+ _mt_fe_tn_preset_tc2800(state); -+ _mt_fe_tn_set_reg(state, 0x05, 0x00); -+ _mt_fe_tn_set_reg(state, 0x06, 0x00); -+ if (state->tuner_mtt == 0xD1) { -+ _mt_fe_tn_set_reg(state, 0x00, 0x01); -+ _mt_fe_tn_set_reg(state, 0x00, 0x00); -+ msleep(5); -+ _mt_fe_tn_set_reg(state, 0x41, 0x00); -+ msleep(5); -+ _mt_fe_tn_set_reg(state, 0x41, 0x02); -+ -+ _mt_fe_tn_get_reg(state, 0x69, &buf1); -+ buf1 = buf1 & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x61, &buf); -+ buf = buf & 0x0f; -+ if (buf == 0x0c) -+ _mt_fe_tn_set_reg(state, 0x6a, 0x59); -+ if (buf1 > 0x02) { -+ if (freq_KHz > 600000) -+ _mt_fe_tn_set_reg(state, 0x66, 0x44); -+ else if (freq_KHz > 500000) -+ _mt_fe_tn_set_reg(state, 0x66, 0x64); -+ else -+ _mt_fe_tn_set_reg(state, 0x66, 0x74); -+ } -+ if (buf1 < 0x03) { -+ if (freq_KHz > 800000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x64); -+ else if (freq_KHz > 600000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ else if (freq_KHz > 500000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ else if (freq_KHz > 300000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x43); -+ else if (freq_KHz > 220000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ else if (freq_KHz > 110000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x14); -+ else -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ msleep(5); -+ } else if (buf < 0x0c) { -+ if (freq_KHz > 800000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x14); -+ else if (freq_KHz > 600000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x14); -+ else if (freq_KHz > 500000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x34); -+ else if (freq_KHz > 300000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x43); -+ else if (freq_KHz > 220000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ else if (freq_KHz > 110000) -+ _mt_fe_tn_set_reg(state, 0x87, 0x14); -+ else -+ _mt_fe_tn_set_reg(state, 0x87, 0x54); -+ msleep(5); -+ } -+ } else if ((state->tuner_mtt == 0xE1)) { -+ _mt_fe_tn_set_reg(state, 0x00, 0x01); -+ _mt_fe_tn_set_reg(state, 0x00, 0x00); -+ msleep(20); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = (buf & 0xef) | 0x28; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ msleep(50); -+ _mt_fe_tn_get_reg(state, 0x38, &buf); -+ _mt_fe_tn_set_reg(state, 0x38, buf); -+ _mt_fe_tn_get_reg(state, 0x32, &buf); -+ buf = (buf & 0xf7) | 0x10; -+ _mt_fe_tn_set_reg(state, 0x32, buf); -+ msleep(10); -+ _mt_fe_tn_get_reg(state, 0x69, &buf); -+ buf = buf & 0x03; -+ _mt_fe_tn_set_reg(state, 0x2a, buf); -+ if (buf > 0) { -+ msleep(20); -+ _mt_fe_tn_get_reg(state, 0x84, &buf); -+ buf = buf & 0x1f; -+ _mt_fe_tn_set_reg(state, 0x68, 0x0a); -+ _mt_fe_tn_get_reg(state, 0x88, &buf1); -+ buf1 = buf1 & 0x1f; -+ if (buf <= buf1) -+ _mt_fe_tn_set_reg(state, 0x66, 0x44); -+ else -+ _mt_fe_tn_set_reg(state, 0x66, 0x74); -+ } else { -+ if (freq_KHz <= 600000) -+ _mt_fe_tn_set_reg(state, 0x68, 0x0c); -+ else -+ _mt_fe_tn_set_reg(state, 0x68, 0x0e); -+ _mt_fe_tn_set_reg(state, 0x30, 0xfb); -+ _mt_fe_tn_set_reg(state, 0x30, 0xff); -+ _mt_fe_tn_set_reg(state, 0x31, 0x04); -+ _mt_fe_tn_set_reg(state, 0x31, 0x00); -+ } -+ if (state->tuner_loopthrough != 0) { -+ _mt_fe_tn_get_reg(state, 0x28, &buf); -+ if (buf == 0) { -+ _mt_fe_tn_set_reg(state, 0x28, 0xff); -+ _mt_fe_tn_get_reg(state, 0x61, &buf); -+ buf = buf & 0x0f; -+ if (buf > 9) -+ _mt_fe_tn_set_reg(state, 0x67, 0x74); -+ else if (buf > 6) -+ _mt_fe_tn_set_reg(state, 0x67, 0x64); -+ else if (buf > 3) -+ _mt_fe_tn_set_reg(state, 0x67, 0x54); -+ else -+ _mt_fe_tn_set_reg(state, 0x67, 0x44); -+ } -+ } else { -+ _mt_fe_tn_set_reg(state, 0x67, 0x34); -+ } -+ } else { -+ return 1; -+ } -+ return 0; -+} -+ -+ -+/* -+static int mt_fe_tn_set_BB_filter_band_tc2800(struct dvbsky_m88dc2800_state *state, -+ u8 bandwidth) -+{ -+ u8 buf, tmp; -+ -+ _mt_fe_tn_get_reg(state, 0x53, &tmp); -+ -+ if (bandwidth == 6) -+ buf = 0x01 << 1; -+ else if (bandwidth == 7) -+ buf = 0x02 << 1; -+ else if (bandwidth == 8) -+ buf = 0x04 << 1; -+ else -+ buf = 0x04 << 1; -+ -+ tmp &= 0xf1; -+ tmp |= buf; -+ _mt_fe_tn_set_reg(state, 0x53, tmp); -+ state->tuner_bandwidth = bandwidth; -+ return 0; -+} -+*/ -+ -+static s32 mt_fe_tn_get_signal_strength_tc2800(struct dvbsky_m88dc2800_state -+ *state) -+{ -+ s32 level = -107; -+ s32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; -+ s32 val1, val2, val; -+ s32 result2, result3, result4, result5, result6; -+ s32 append; -+ u8 tmp; -+ s32 freq_KHz = (s32) state->tuner_freq; -+ if (state->tuner_mtt == 0xD1) { -+ _mt_fe_tn_get_reg(state, 0x61, &tmp); -+ tmp1 = tmp & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x69, &tmp); -+ tmp2 = tmp & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x73, &tmp); -+ tmp3 = tmp & 0x07; -+ _mt_fe_tn_get_reg(state, 0x7c, &tmp); -+ tmp4 = (tmp >> 4) & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x7b, &tmp); -+ tmp5 = tmp & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x7f, &tmp); -+ tmp6 = (tmp >> 5) & 0x01; -+ if (tmp1 > 6) { -+ val1 = 0; -+ if (freq_KHz <= 200000) { -+ val2 = (tmp1 - 6) * 267; -+ } else if (freq_KHz <= 600000) { -+ val2 = (tmp1 - 6) * 280; -+ } else { -+ val2 = (tmp1 - 6) * 290; -+ } -+ val = val1 + val2; -+ } else { -+ if (tmp1 == 0) { -+ val1 = -550; -+ } else { -+ val1 = 0; -+ } -+ if ((tmp1 < 4) && (freq_KHz >= 506000)) { -+ val1 = -850; -+ } -+ val2 = 0; -+ val = val1 + val2; -+ } -+ if (freq_KHz <= 95000) { -+ result2 = tmp2 * 289; -+ } else if (freq_KHz <= 155000) { -+ result2 = tmp2 * 278; -+ } else if (freq_KHz <= 245000) { -+ result2 = tmp2 * 267; -+ } else if (freq_KHz <= 305000) { -+ result2 = tmp2 * 256; -+ } else if (freq_KHz <= 335000) { -+ result2 = tmp2 * 244; -+ } else if (freq_KHz <= 425000) { -+ result2 = tmp2 * 233; -+ } else if (freq_KHz <= 575000) { -+ result2 = tmp2 * 222; -+ } else if (freq_KHz <= 665000) { -+ result2 = tmp2 * 211; -+ } else { -+ result2 = tmp2 * 200; -+ } -+ result3 = (6 - tmp3) * 100; -+ result4 = 300 * tmp4; -+ result5 = 50 * tmp5; -+ result6 = 300 * tmp6; -+ if (freq_KHz < 105000) { -+ append = -450; -+ } else if (freq_KHz <= 227000) { -+ append = -4 * (freq_KHz / 1000 - 100) + 150; -+ } else if (freq_KHz <= 305000) { -+ append = -4 * (freq_KHz / 1000 - 100); -+ } else if (freq_KHz <= 419000) { -+ append = 500 - 40 * (freq_KHz / 1000 - 300) / 17 + 130; -+ } else if (freq_KHz <= 640000) { -+ append = 500 - 40 * (freq_KHz / 1000 - 300) / 17; -+ } else { -+ append = -500; -+ } -+ level = append - (val + result2 + result3 + result4 + -+ result5 + result6); -+ level /= 100; -+ } else if (state->tuner_mtt == 0xE1) { -+ _mt_fe_tn_get_reg(state, 0x61, &tmp); -+ tmp1 = tmp & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x84, &tmp); -+ tmp2 = tmp & 0x1f; -+ _mt_fe_tn_get_reg(state, 0x69, &tmp); -+ tmp3 = tmp & 0x03; -+ _mt_fe_tn_get_reg(state, 0x73, &tmp); -+ tmp4 = tmp & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x7c, &tmp); -+ tmp5 = (tmp >> 4) & 0x0f; -+ _mt_fe_tn_get_reg(state, 0x7b, &tmp); -+ tmp6 = tmp & 0x0f; -+ if (freq_KHz < 151000) { -+ result2 = (1150 - freq_KHz / 100) * 163 / 33 + 4230; -+ result3 = (1150 - freq_KHz / 100) * 115 / 33 + 1850; -+ result4 = -3676 * (freq_KHz / 1000) / 100 + 6115; -+ } else if (freq_KHz < 257000) { -+ result2 = (1540 - freq_KHz / 100) * 11 / 4 + 3870; -+ result3 = (1540 - freq_KHz / 100) * 205 / 96 + 2100; -+ result4 = -21 * freq_KHz / 1000 + 5084; -+ } else if (freq_KHz < 305000) { -+ result2 = (2620 - freq_KHz / 100) * 5 / 3 + 2770; -+ result3 = (2620 - freq_KHz / 100) * 10 / 7 + 1700; -+ result4 = 650; -+ } else if (freq_KHz < 449000) { -+ result2 = (307 - freq_KHz / 1000) * 82 / 27 + 11270; -+ result3 = (3100 - freq_KHz / 100) * 5 / 3 + 10000; -+ result4 = 134 * freq_KHz / 10000 + 11875; -+ } else { -+ result2 = (307 - freq_KHz / 1000) * 82 / 27 + 11270; -+ result3 = 8400; -+ result4 = 5300; -+ } -+ if (tmp1 > 6) { -+ val1 = result2; -+ val2 = 2900; -+ val = 500; -+ } else if (tmp1 > 0) { -+ val1 = result3; -+ val2 = 2700; -+ val = 500; -+ } else { -+ val1 = result4; -+ val2 = 2700; -+ val = 400; -+ } -+ level = val1 - (val2 * tmp1 + 500 * tmp2 + 3000 * tmp3 - -+ 500 * tmp4 + 3000 * tmp5 + val * tmp6) - 1000; -+ level /= 1000; -+ } -+ return level; -+} -+ -+ -+/* m88dc2800 operation functions */ -+u8 M88DC2000GetLock(struct dvbsky_m88dc2800_state * state) -+{ -+ u8 u8ret = 0; -+ if (ReadReg(state, 0x80) < 0x06) { -+ if ((ReadReg(state, 0xdf) & 0x80) == 0x80 -+ &&(ReadReg(state, 0x91) & 0x23) == 0x03 -+ &&(ReadReg(state, 0x43) & 0x08) == 0x08) -+ u8ret = 1; -+ else -+ u8ret = 0; -+ } else { -+ if ((ReadReg(state, 0x85) & 0x08) == 0x08) -+ u8ret = 1; -+ else -+ u8ret = 0; -+ } -+ dprintk("%s, lock=%d\n", __func__, u8ret); -+ return u8ret; -+} -+ -+static int M88DC2000SetTsType(struct dvbsky_m88dc2800_state *state, u8 type) -+{ -+ u8 regC2H; -+ -+ if (type == 3) { -+ WriteReg(state, 0x84, 0x6A); -+ WriteReg(state, 0xC0, 0x43); -+ WriteReg(state, 0xE2, 0x06); -+ regC2H = ReadReg(state, 0xC2); -+ regC2H &= 0xC0; -+ regC2H |= 0x1B; -+ WriteReg(state, 0xC2, regC2H); -+ WriteReg(state, 0xC1, 0x60); /* common interface */ -+ } else if (type == 1) { -+ WriteReg(state, 0x84, 0x6A); -+ WriteReg(state, 0xC0, 0x47); /* serial format */ -+ WriteReg(state, 0xE2, 0x02); -+ regC2H = ReadReg(state, 0xC2); -+ regC2H &= 0xC7; -+ WriteReg(state, 0xC2, regC2H); -+ WriteReg(state, 0xC1, 0x00); -+ } else { -+ WriteReg(state, 0x84, 0x6C); -+ WriteReg(state, 0xC0, 0x43); /* parallel format */ -+ WriteReg(state, 0xE2, 0x06); -+ regC2H = ReadReg(state, 0xC2); -+ regC2H &= 0xC7; -+ WriteReg(state, 0xC2, regC2H); -+ WriteReg(state, 0xC1, 0x00); -+ } -+ return 0; -+} -+ -+static int M88DC2000RegInitial_TC2800(struct dvbsky_m88dc2800_state *state) -+{ -+ u8 RegE3H, RegE4H; -+ -+ WriteReg(state, 0x00, 0x48); -+ WriteReg(state, 0x01, 0x09); -+ WriteReg(state, 0xFB, 0x0A); -+ WriteReg(state, 0xFC, 0x0B); -+ WriteReg(state, 0x02, 0x0B); -+ WriteReg(state, 0x03, 0x18); -+ WriteReg(state, 0x05, 0x0D); -+ WriteReg(state, 0x36, 0x80); -+ WriteReg(state, 0x43, 0x40); -+ WriteReg(state, 0x55, 0x7A); -+ WriteReg(state, 0x56, 0xD9); -+ WriteReg(state, 0x57, 0xDF); -+ WriteReg(state, 0x58, 0x39); -+ WriteReg(state, 0x5A, 0x00); -+ WriteReg(state, 0x5C, 0x71); -+ WriteReg(state, 0x5D, 0x23); -+ WriteReg(state, 0x86, 0x40); -+ WriteReg(state, 0xF9, 0x08); -+ WriteReg(state, 0x61, 0x40); -+ WriteReg(state, 0x62, 0x0A); -+ WriteReg(state, 0x90, 0x06); -+ WriteReg(state, 0xDE, 0x00); -+ WriteReg(state, 0xA0, 0x03); -+ WriteReg(state, 0xDF, 0x81); -+ WriteReg(state, 0xFA, 0x40); -+ WriteReg(state, 0x37, 0x10); -+ WriteReg(state, 0xF0, 0x40); -+ WriteReg(state, 0xF2, 0x9C); -+ WriteReg(state, 0xF3, 0x40); -+ RegE3H = ReadReg(state, 0xE3); -+ RegE4H = ReadReg(state, 0xE4); -+ if (((RegE3H & 0xC0) == 0x00) && ((RegE4H & 0xC0) == 0x00)) { -+ WriteReg(state, 0x30, 0xFF); -+ WriteReg(state, 0x31, 0x00); -+ WriteReg(state, 0x32, 0x00); -+ WriteReg(state, 0x33, 0x00); -+ WriteReg(state, 0x35, 0x32); -+ WriteReg(state, 0x40, 0x00); -+ WriteReg(state, 0x41, 0x10); -+ WriteReg(state, 0xF1, 0x02); -+ WriteReg(state, 0xF4, 0x04); -+ WriteReg(state, 0xF5, 0x00); -+ WriteReg(state, 0x42, 0x14); -+ WriteReg(state, 0xE1, 0x25); -+ } else if (((RegE3H & 0xC0) == 0x80) && ((RegE4H & 0xC0) == 0x40)) { -+ WriteReg(state, 0x30, 0xFF); -+ WriteReg(state, 0x31, 0x00); -+ WriteReg(state, 0x32, 0x00); -+ WriteReg(state, 0x33, 0x00); -+ WriteReg(state, 0x35, 0x32); -+ WriteReg(state, 0x39, 0x00); -+ WriteReg(state, 0x3A, 0x00); -+ WriteReg(state, 0x40, 0x00); -+ WriteReg(state, 0x41, 0x10); -+ WriteReg(state, 0xF1, 0x00); -+ WriteReg(state, 0xF4, 0x00); -+ WriteReg(state, 0xF5, 0x40); -+ WriteReg(state, 0x42, 0x14); -+ WriteReg(state, 0xE1, 0x25); -+ } else if ((RegE3H == 0x80 || RegE3H == 0x81) -+ && (RegE4H == 0x80 || RegE4H == 0x81)) { -+ WriteReg(state, 0x30, 0xFF); -+ WriteReg(state, 0x31, 0x00); -+ WriteReg(state, 0x32, 0x00); -+ WriteReg(state, 0x33, 0x00); -+ WriteReg(state, 0x35, 0x32); -+ WriteReg(state, 0x39, 0x00); -+ WriteReg(state, 0x3A, 0x00); -+ WriteReg(state, 0xF1, 0x00); -+ WriteReg(state, 0xF4, 0x00); -+ WriteReg(state, 0xF5, 0x40); -+ WriteReg(state, 0x42, 0x24); -+ WriteReg(state, 0xE1, 0x25); -+ WriteReg(state, 0x92, 0x7F); -+ WriteReg(state, 0x93, 0x91); -+ WriteReg(state, 0x95, 0x00); -+ WriteReg(state, 0x2B, 0x33); -+ WriteReg(state, 0x2A, 0x2A); -+ WriteReg(state, 0x2E, 0x80); -+ WriteReg(state, 0x25, 0x25); -+ WriteReg(state, 0x2D, 0xFF); -+ WriteReg(state, 0x26, 0xFF); -+ WriteReg(state, 0x27, 0x00); -+ WriteReg(state, 0x24, 0x25); -+ WriteReg(state, 0xA4, 0xFF); -+ WriteReg(state, 0xA3, 0x0D); -+ } else { -+ WriteReg(state, 0x30, 0xFF); -+ WriteReg(state, 0x31, 0x00); -+ WriteReg(state, 0x32, 0x00); -+ WriteReg(state, 0x33, 0x00); -+ WriteReg(state, 0x35, 0x32); -+ WriteReg(state, 0x39, 0x00); -+ WriteReg(state, 0x3A, 0x00); -+ WriteReg(state, 0xF1, 0x00); -+ WriteReg(state, 0xF4, 0x00); -+ WriteReg(state, 0xF5, 0x40); -+ WriteReg(state, 0x42, 0x24); -+ WriteReg(state, 0xE1, 0x27); -+ WriteReg(state, 0x92, 0x7F); -+ WriteReg(state, 0x93, 0x91); -+ WriteReg(state, 0x95, 0x00); -+ WriteReg(state, 0x2B, 0x33); -+ WriteReg(state, 0x2A, 0x2A); -+ WriteReg(state, 0x2E, 0x80); -+ WriteReg(state, 0x25, 0x25); -+ WriteReg(state, 0x2D, 0xFF); -+ WriteReg(state, 0x26, 0xFF); -+ WriteReg(state, 0x27, 0x00); -+ WriteReg(state, 0x24, 0x25); -+ WriteReg(state, 0xA4, 0xFF); -+ WriteReg(state, 0xA3, 0x10); -+ } -+ WriteReg(state, 0xF6, 0x4E); -+ WriteReg(state, 0xF7, 0x20); -+ WriteReg(state, 0x89, 0x02); -+ WriteReg(state, 0x14, 0x08); -+ WriteReg(state, 0x6F, 0x0D); -+ WriteReg(state, 0x10, 0xFF); -+ WriteReg(state, 0x11, 0x00); -+ WriteReg(state, 0x12, 0x30); -+ WriteReg(state, 0x13, 0x23); -+ WriteReg(state, 0x60, 0x00); -+ WriteReg(state, 0x69, 0x00); -+ WriteReg(state, 0x6A, 0x03); -+ WriteReg(state, 0xE0, 0x75); -+ WriteReg(state, 0x8D, 0x29); -+ WriteReg(state, 0x4E, 0xD8); -+ WriteReg(state, 0x88, 0x80); -+ WriteReg(state, 0x52, 0x79); -+ WriteReg(state, 0x53, 0x03); -+ WriteReg(state, 0x59, 0x30); -+ WriteReg(state, 0x5E, 0x02); -+ WriteReg(state, 0x5F, 0x0F); -+ WriteReg(state, 0x71, 0x03); -+ WriteReg(state, 0x72, 0x12); -+ WriteReg(state, 0x73, 0x12); -+ -+ return 0; -+} -+ -+static int M88DC2000AutoTSClock_P(struct dvbsky_m88dc2800_state *state, u32 sym, -+ u16 qam) -+{ -+ u32 dataRate; -+ u8 clk_div, value; -+ printk(KERN_INFO -+ "m88dc2800: M88DC2000AutoTSClock_P, symrate=%d qam=%d\n", -+ sym, qam); -+ switch (qam) { -+ case 16: -+ dataRate = 4; -+ break; -+ case 32: -+ dataRate = 5; -+ break; -+ case 128: -+ dataRate = 7; -+ break; -+ case 256: -+ dataRate = 8; -+ break; -+ case 64: -+ default: -+ dataRate = 6; -+ break; -+ } -+ dataRate *= sym * 105; -+ dataRate /= 800; -+ if (dataRate <= 4115) -+ clk_div = 0x05; -+ else if (dataRate <= 4800) -+ clk_div = 0x04; -+ else if (dataRate <= 5760) -+ clk_div = 0x03; -+ else if (dataRate <= 7200) -+ clk_div = 0x02; -+ else if (dataRate <= 9600) -+ clk_div = 0x01; -+ else -+ clk_div = 0x00; -+ value = ReadReg(state, 0xC2); -+ value &= 0xc0; -+ value |= clk_div; -+ WriteReg(state, 0xC2, value); -+ return 0; -+} -+ -+static int M88DC2000AutoTSClock_C(struct dvbsky_m88dc2800_state *state, u32 sym, -+ u16 qam) -+{ -+ u32 dataRate; -+ u8 clk_div, value; -+ printk(KERN_INFO -+ "m88dc2800: M88DC2000AutoTSClock_C, symrate=%d qam=%d\n", -+ sym, qam); -+ switch (qam) { -+ case 16: -+ dataRate = 4; -+ break; -+ case 32: -+ dataRate = 5; -+ break; -+ case 128: -+ dataRate = 7; -+ break; -+ case 256: -+ dataRate = 8; -+ break; -+ case 64: -+ default: -+ dataRate = 6; -+ break; -+ } -+ dataRate *= sym * 105; -+ dataRate /= 800; -+ if (dataRate <= 4115) -+ clk_div = 0x3F; -+ else if (dataRate <= 4800) -+ clk_div = 0x36; -+ else if (dataRate <= 5760) -+ clk_div = 0x2D; -+ else if (dataRate <= 7200) -+ clk_div = 0x24; -+ else if (dataRate <= 9600) -+ clk_div = 0x1B; -+ else -+ clk_div = 0x12; -+ value = ReadReg(state, 0xC2); -+ value &= 0xc0; -+ value |= clk_div; -+ WriteReg(state, 0xC2, value); -+ return 0; -+} -+ -+static int M88DC2000SetTxMode(struct dvbsky_m88dc2800_state *state, u8 inverted, -+ u8 j83) -+{ -+ u8 value = 0; -+ if (inverted) -+ value |= 0x08; /* spectrum inverted */ -+ if (j83) -+ value |= 0x01; /* J83C */ -+ WriteReg(state, 0x83, value); -+ return 0; -+} -+ -+static int M88DC2000SoftReset(struct dvbsky_m88dc2800_state *state) -+{ -+ WriteReg(state, 0x80, 0x01); -+ WriteReg(state, 0x82, 0x00); -+ msleep(1); -+ WriteReg(state, 0x80, 0x00); -+ return 0; -+} -+ -+static int M88DC2000SetSym(struct dvbsky_m88dc2800_state *state, u32 sym, u32 xtal) -+{ -+ u8 value; -+ u8 reg6FH, reg12H; -+ u64 fValue; -+ u32 dwValue; -+ -+ printk(KERN_INFO "%s, sym=%d, xtal=%d\n", __func__, sym, xtal); -+ fValue = 4294967296 * (sym + 10); -+ do_div(fValue, xtal); -+ -+ /* fValue = 4294967296 * (sym + 10) / xtal; */ -+ dwValue = (u32) fValue; -+ printk(KERN_INFO "%s, fvalue1=%x\n", __func__, dwValue); -+ WriteReg(state, 0x58, (u8) ((dwValue >> 24) & 0xff)); -+ WriteReg(state, 0x57, (u8) ((dwValue >> 16) & 0xff)); -+ WriteReg(state, 0x56, (u8) ((dwValue >> 8) & 0xff)); -+ WriteReg(state, 0x55, (u8) ((dwValue >> 0) & 0xff)); -+ -+ /* fValue = 2048 * xtal / sym; */ -+ fValue = 2048 * xtal; -+ do_div(fValue, sym); -+ dwValue = (u32) fValue; -+ printk(KERN_INFO "%s, fvalue2=%x\n", __func__, dwValue); -+ WriteReg(state, 0x5D, (u8) ((dwValue >> 8) & 0xff)); -+ WriteReg(state, 0x5C, (u8) ((dwValue >> 0) & 0xff)); -+ value = ReadReg(state, 0x5A); -+ if (((dwValue >> 16) & 0x0001) == 0) -+ value &= 0x7F; -+ else -+ value |= 0x80; -+ WriteReg(state, 0x5A, value); -+ value = ReadReg(state, 0x89); -+ if (sym <= 1800) -+ value |= 0x01; -+ else -+ value &= 0xFE; -+ WriteReg(state, 0x89, value); -+ if (sym >= 6700) { -+ reg6FH = 0x0D; -+ reg12H = 0x30; -+ } else if (sym >= 4000) { -+ fValue = 22 * 4096 / sym; -+ reg6FH = (u8) fValue; -+ reg12H = 0x30; -+ } else if (sym >= 2000) { -+ fValue = 14 * 4096 / sym; -+ reg6FH = (u8) fValue; -+ reg12H = 0x20; -+ } else { -+ fValue = 7 * 4096 / sym; -+ reg6FH = (u8) fValue; -+ reg12H = 0x10; -+ } -+ WriteReg(state, 0x6F, reg6FH); -+ WriteReg(state, 0x12, reg12H); -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) { -+ if (sym < 3000) { -+ WriteReg(state, 0x6C, 0x16); -+ WriteReg(state, 0x6D, 0x10); -+ WriteReg(state, 0x6E, 0x18); -+ } else { -+ WriteReg(state, 0x6C, 0x14); -+ WriteReg(state, 0x6D, 0x0E); -+ WriteReg(state, 0x6E, 0x36); -+ } -+ } else { -+ WriteReg(state, 0x6C, 0x16); -+ WriteReg(state, 0x6D, 0x10); -+ WriteReg(state, 0x6E, 0x18); -+ } -+ return 0; -+} -+ -+static int M88DC2000SetQAM(struct dvbsky_m88dc2800_state *state, u16 qam) -+{ -+ u8 reg00H, reg4AH, regC2H, reg44H, reg4CH, reg4DH, reg74H, value; -+ u8 reg8BH, reg8EH; -+ printk(KERN_INFO "%s, qam=%d\n", __func__, qam); -+ regC2H = ReadReg(state, 0xC2); -+ regC2H &= 0xF8; -+ switch (qam) { -+ case 16: /* 16 QAM */ -+ reg00H = 0x08; -+ reg4AH = 0x0F; -+ regC2H |= 0x02; -+ reg44H = 0xAA; -+ reg4CH = 0x0C; -+ reg4DH = 0xF7; -+ reg74H = 0x0E; -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) { -+ reg8BH = 0x5A; -+ reg8EH = 0xBD; -+ } else { -+ reg8BH = 0x5B; -+ reg8EH = 0x9D; -+ } -+ WriteReg(state, 0x6E, 0x18); -+ break; -+ case 32: /* 32 QAM */ -+ reg00H = 0x18; -+ reg4AH = 0xFB; -+ regC2H |= 0x02; -+ reg44H = 0xAA; -+ reg4CH = 0x0C; -+ reg4DH = 0xF7; -+ reg74H = 0x0E; -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) { -+ reg8BH = 0x5A; -+ reg8EH = 0xBD; -+ } else { -+ reg8BH = 0x5B; -+ reg8EH = 0x9D; -+ } -+ WriteReg(state, 0x6E, 0x18); -+ break; -+ case 64: /* 64 QAM */ -+ reg00H = 0x48; -+ reg4AH = 0xCD; -+ regC2H |= 0x02; -+ reg44H = 0xAA; -+ reg4CH = 0x0C; -+ reg4DH = 0xF7; -+ reg74H = 0x0E; -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) { -+ reg8BH = 0x5A; -+ reg8EH = 0xBD; -+ } else { -+ reg8BH = 0x5B; -+ reg8EH = 0x9D; -+ } -+ break; -+ case 128: /* 128 QAM */ -+ reg00H = 0x28; -+ reg4AH = 0xFF; -+ regC2H |= 0x02; -+ reg44H = 0xA9; -+ reg4CH = 0x08; -+ reg4DH = 0xF5; -+ reg74H = 0x0E; -+ reg8BH = 0x5B; -+ reg8EH = 0x9D; -+ break; -+ case 256: /* 256 QAM */ -+ reg00H = 0x38; -+ reg4AH = 0xCD; -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) { -+ regC2H |= 0x02; -+ } else { -+ regC2H |= 0x01; -+ } -+ reg44H = 0xA9; -+ reg4CH = 0x08; -+ reg4DH = 0xF5; -+ reg74H = 0x0E; -+ reg8BH = 0x5B; -+ reg8EH = 0x9D; -+ break; -+ default: /* 64 QAM */ -+ reg00H = 0x48; -+ reg4AH = 0xCD; -+ regC2H |= 0x02; -+ reg44H = 0xAA; -+ reg4CH = 0x0C; -+ reg4DH = 0xF7; -+ reg74H = 0x0E; -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) { -+ reg8BH = 0x5A; -+ reg8EH = 0xBD; -+ } else { -+ reg8BH = 0x5B; -+ reg8EH = 0x9D; -+ } -+ break; -+ } -+ WriteReg(state, 0x00, reg00H); -+ value = ReadReg(state, 0x88); -+ value |= 0x08; -+ WriteReg(state, 0x88, value); -+ WriteReg(state, 0x4B, 0xFF); -+ WriteReg(state, 0x4A, reg4AH); -+ value &= 0xF7; -+ WriteReg(state, 0x88, value); -+ WriteReg(state, 0xC2, regC2H); -+ WriteReg(state, 0x44, reg44H); -+ WriteReg(state, 0x4C, reg4CH); -+ WriteReg(state, 0x4D, reg4DH); -+ WriteReg(state, 0x74, reg74H); -+ WriteReg(state, 0x8B, reg8BH); -+ WriteReg(state, 0x8E, reg8EH); -+ return 0; -+} -+ -+static int M88DC2000WriteTuner_TC2800(struct dvbsky_m88dc2800_state *state, -+ u32 freq_KHz) -+{ -+ printk(KERN_INFO "%s, freq=%d KHz\n", __func__, freq_KHz); -+ return mt_fe_tn_set_freq_tc2800(state, freq_KHz); -+} -+ -+static int dvbsky_m88dc2800_init(struct dvb_frontend *fe) -+{ -+ dprintk("%s()\n", __func__); -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_set_parameters(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ u8 is_annex_c, is_update; -+ u16 temp_qam; -+ s32 waiting_time; -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ -+ is_annex_c = c->delivery_system == SYS_DVBC_ANNEX_C ? 1 : 0; -+ -+ switch (c->modulation) { -+ case QAM_16: -+ temp_qam = 16; -+ break; -+ case QAM_32: -+ temp_qam = 32; -+ break; -+ case QAM_128: -+ temp_qam = 128; -+ break; -+ case QAM_256: -+ temp_qam = 256; -+ break; -+ default: /* QAM_64 */ -+ temp_qam = 64; -+ break; -+ } -+ -+ state->inverted = c->inversion == INVERSION_ON ? 1 : 0; -+ -+ printk(KERN_INFO -+ "m88dc2800: state, freq=%d qam=%d sym=%d inverted=%d xtal=%d\n", -+ state->freq, state->qam, state->sym, state->inverted, -+ state->xtal); -+ printk(KERN_INFO -+ "m88dc2800: set frequency to %d qam=%d symrate=%d annex-c=%d\n", -+ c->frequency, temp_qam, c->symbol_rate, is_annex_c); -+ -+ is_update = 0; -+ WriteReg(state, 0x80, 0x01); -+ if (c->frequency != state->freq) { -+ M88DC2000WriteTuner_TC2800(state, c->frequency / 1000); -+ state->freq = c->frequency; -+ } -+ if (c->symbol_rate != state->sym) { -+ M88DC2000SetSym(state, c->symbol_rate / 1000, state->xtal); -+ state->sym = c->symbol_rate; -+ is_update = 1; -+ } -+ if (temp_qam != state->qam) { -+ M88DC2000SetQAM(state, temp_qam); -+ state->qam = temp_qam; -+ is_update = 1; -+ } -+ -+ if (is_update != 0) { -+ if (state->config->ts_mode == 3) -+ M88DC2000AutoTSClock_C(state, state->sym / 1000, -+ temp_qam); -+ else -+ M88DC2000AutoTSClock_P(state, state->sym / 1000, -+ temp_qam); -+ } -+ -+ M88DC2000SetTxMode(state, state->inverted, is_annex_c); -+ M88DC2000SoftReset(state); -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) -+ && ((ReadReg(state, 0xE4) & 0x80) == 0x80)) -+ waiting_time = 800; -+ else -+ waiting_time = 500; -+ while (waiting_time > 0) { -+ msleep(50); -+ waiting_time -= 50; -+ if (M88DC2000GetLock(state)) -+ return 0; -+ } -+ -+ state->inverted = (state->inverted != 0) ? 0 : 1; -+ M88DC2000SetTxMode(state, state->inverted, is_annex_c); -+ M88DC2000SoftReset(state); -+ if (((ReadReg(state, 0xE3) & 0x80) == 0x80) && -+ ((ReadReg(state, 0xE4) & 0x80) == 0x80)) -+ waiting_time = 800; -+ else -+ waiting_time = 500; -+ while (waiting_time > 0) { -+ msleep(50); -+ waiting_time -= 50; -+ if (M88DC2000GetLock(state)) -+ return 0; -+ } -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_read_status(struct dvb_frontend *fe, -+ fe_status_t * status) -+{ -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ *status = 0; -+ -+ if (M88DC2000GetLock(state)) { -+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER -+ |FE_HAS_SYNC | FE_HAS_VITERBI | FE_HAS_LOCK; -+ } -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_read_ber(struct dvb_frontend *fe, u32 * ber) -+{ -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ u16 tmp; -+ -+ if (M88DC2000GetLock(state) == 0) { -+ state->ber = 0; -+ } else if ((ReadReg(state, 0xA0) & 0x80) != 0x80) { -+ tmp = ReadReg(state, 0xA2) << 8; -+ tmp += ReadReg(state, 0xA1); -+ state->ber = tmp; -+ WriteReg(state, 0xA0, 0x05); -+ WriteReg(state, 0xA0, 0x85); -+ } -+ *ber = state->ber; -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_read_signal_strength(struct dvb_frontend *fe, -+ u16 * strength) -+{ -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ s16 tuner_strength; -+ -+ tuner_strength = mt_fe_tn_get_signal_strength_tc2800(state); -+ *strength = tuner_strength < -107 ? 0 : tuner_strength + 107; -+ -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_read_snr(struct dvb_frontend *fe, u16 * snr) -+{ -+ static const u32 mes_log[] = { -+ 0, 3010, 4771, 6021, 6990, 7781, 8451, 9031, 9542, 10000, -+ 10414, 10792, 11139, 11461, 11761, 12041, 12304, 12553, 12788, -+ 13010, 13222, 13424, 13617, 13802, 13979, 14150, 14314, 14472, -+ 14624, 14771, 14914, 15052, 15185, 15315, 15441, 15563, 15682, -+ 15798, 15911, 16021, 16128, 16232, 16335, 16435, 16532, 16628, -+ 16721, 16812, 16902, 16990, 17076, 17160, 17243, 17324, 17404, -+ 17482, 17559, 17634, 17709, 17782, 17853, 17924, 17993, 18062, -+ 18129, 18195, 18261, 18325, 18388, 18451, 18513, 18573, 18633, -+ 18692, 18751, 18808, 18865, 18921, 18976, 19031 -+ }; -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ u8 i; -+ u32 _snr, mse; -+ -+ if ((ReadReg(state, 0x91) & 0x23) != 0x03) { -+ *snr = 0; -+ return 0; -+ } -+ mse = 0; -+ for (i = 0; i < 30; i++) { -+ mse += (ReadReg(state, 0x08) << 8) + ReadReg(state, 0x07); -+ } -+ mse /= 30; -+ if (mse > 80) -+ mse = 80; -+ switch (state->qam) { -+ case 16: -+ _snr = 34080; -+ break; /* 16QAM */ -+ case 32: -+ _snr = 37600; -+ break; /* 32QAM */ -+ case 64: -+ _snr = 40310; -+ break; /* 64QAM */ -+ case 128: -+ _snr = 43720; -+ break; /* 128QAM */ -+ case 256: -+ _snr = 46390; -+ break; /* 256QAM */ -+ default: -+ _snr = 40310; -+ break; -+ } -+ _snr -= mes_log[mse - 1]; /* C - 10*log10(MSE) */ -+ _snr /= 1000; -+ if (_snr > 0xff) -+ _snr = 0xff; -+ *snr = _snr; -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks) -+{ -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ u8 u8Value; -+ -+ u8Value = ReadReg(state, 0xdf); -+ u8Value |= 0x02; /* Hold */ -+ WriteReg(state, 0xdf, u8Value); -+ -+ *ucblocks = ReadReg(state, 0xd5); -+ *ucblocks = (*ucblocks << 8) | ReadReg(state, 0xd4); -+ -+ u8Value &= 0xfe; /* Clear */ -+ WriteReg(state, 0xdf, u8Value); -+ u8Value &= 0xfc; /* Update */ -+ u8Value |= 0x01; -+ WriteReg(state, 0xdf, u8Value); -+ -+ return 0; -+} -+ -+static int dvbsky_m88dc2800_sleep(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ -+ mt_fe_tn_sleep_tc2800(state); -+ state->freq = 0; -+ -+ return 0; -+} -+ -+static void dvbsky_m88dc2800_release(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88dc2800_state *state = fe->demodulator_priv; -+ kfree(state); -+} -+ -+static struct dvb_frontend_ops dvbsky_m88dc2800_ops; -+ -+struct dvb_frontend *dvbsky_m88dc2800_attach(const struct dvbsky_m88dc2800_config -+ *config, struct i2c_adapter *i2c) -+{ -+ struct dvbsky_m88dc2800_state *state = NULL; -+ -+ /* allocate memory for the internal state */ -+ state = kzalloc(sizeof(struct dvbsky_m88dc2800_state), GFP_KERNEL); -+ if (state == NULL) -+ goto error; -+ -+ /* setup the state */ -+ state->config = config; -+ state->i2c = i2c; -+ state->xtal = 28800; -+ -+ WriteReg(state, 0x80, 0x01); -+ M88DC2000RegInitial_TC2800(state); -+ M88DC2000SetTsType(state, state->config->ts_mode); -+ mt_fe_tn_init_tc2800(state); -+ -+ /* create dvb_frontend */ -+ memcpy(&state->frontend.ops, &dvbsky_m88dc2800_ops, -+ sizeof(struct dvb_frontend_ops)); -+ state->frontend.demodulator_priv = state; -+ return &state->frontend; -+ -+ error: -+ kfree(state); -+ return NULL; -+} -+ -+EXPORT_SYMBOL(dvbsky_m88dc2800_attach); -+ -+static struct dvb_frontend_ops dvbsky_m88dc2800_ops = { -+ .delsys = {SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_C}, -+ .info = { -+ .name = "Montage M88DC2800 DVB-C", -+ .frequency_stepsize = 62500, -+ .frequency_min = 48000000, -+ .frequency_max = 870000000, -+ .symbol_rate_min = 870000, -+ .symbol_rate_max = 9000000, -+ .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | -+ FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO -+ }, -+ .release = dvbsky_m88dc2800_release, -+ .init = dvbsky_m88dc2800_init, -+ .sleep = dvbsky_m88dc2800_sleep, -+ .set_frontend = dvbsky_m88dc2800_set_parameters, -+ .read_status = dvbsky_m88dc2800_read_status, -+ .read_ber = dvbsky_m88dc2800_read_ber, -+ .read_signal_strength = dvbsky_m88dc2800_read_signal_strength, -+ .read_snr = dvbsky_m88dc2800_read_snr, -+ .read_ucblocks = dvbsky_m88dc2800_read_ucblocks, -+}; -+ -+MODULE_DESCRIPTION("Montage DVB-C demodulator driver"); -+MODULE_AUTHOR("Max Nibble "); -+MODULE_LICENSE("GPL"); -+MODULE_VERSION("1.00"); -diff --git a/drivers/media/dvb-frontends/dvbsky_m88dc2800.h b/drivers/media/dvb-frontends/dvbsky_m88dc2800.h -new file mode 100644 -index 0000000..0844a66 ---- /dev/null -+++ b/drivers/media/dvb-frontends/dvbsky_m88dc2800.h -@@ -0,0 +1,44 @@ -+/* -+ M88DC2800/M88TC2800 - DVB-C demodulator and tuner from Montage -+ -+ Copyright (C) 2012 Max Nibble -+ Copyright (C) 2011 Montage Technology - www.montage-tech.com -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+*/ -+ -+#ifndef dvbsky_m88dc2800_H -+#define dvbsky_m88dc2800_H -+ -+#include -+#include -+ -+struct dvbsky_m88dc2800_config { -+ u8 demod_address; -+ u8 ts_mode; -+}; -+ -+#if IS_ENABLED(CONFIG_DVB_DVBSKY_M88DC2800) -+extern struct dvb_frontend* dvbsky_m88dc2800_attach(const struct dvbsky_m88dc2800_config* config, -+ struct i2c_adapter* i2c); -+#else -+static inline struct dvb_frontend* dvbsky_m88dc2800_attach(const struct dvbsky_m88dc2800_config* config, -+ struct i2c_adapter* i2c) -+{ -+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); -+ return NULL; -+} -+#endif /* CONFIG_DVB_DVBSKY_M88DC2800 */ -+#endif /* dvbsky_m88dc2800_H */ -diff --git a/drivers/media/dvb-frontends/dvbsky_m88ds3103.c b/drivers/media/dvb-frontends/dvbsky_m88ds3103.c -new file mode 100644 -index 0000000..99985a7 ---- /dev/null -+++ b/drivers/media/dvb-frontends/dvbsky_m88ds3103.c -@@ -0,0 +1,1707 @@ -+/* -+ Montage Technology M88DS3103/M88TS2022 - DVBS/S2 Satellite demod/tuner driver -+ -+ Copyright (C) 2011 Max nibble -+ Copyright (C) 2010 Montage Technology -+ Copyright (C) 2009 Konstantin Dimitrov. -+ -+ 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. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "dvb_frontend.h" -+#include "dvbsky_m88ds3103.h" -+#include "dvbsky_m88ds3103_priv.h" -+ -+static int debug; -+module_param(debug, int, 0644); -+MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); -+ -+#define dprintk(args...) \ -+ do { \ -+ if (debug) \ -+ printk(KERN_INFO "m88ds3103: " args); \ -+ } while (0) -+ -+/*demod register operations.*/ -+static int dvbsky_m88ds3103_writereg(struct dvbsky_m88ds3103_state *state, int reg, int data) -+{ -+ u8 buf[] = { reg, data }; -+ struct i2c_msg msg = { .addr = state->config->demod_address, -+ .flags = 0, .buf = buf, .len = 2 }; -+ int err; -+ -+ if (debug > 1) -+ printk("m88ds3103: %s: write reg 0x%02x, value 0x%02x\n", -+ __func__, reg, data); -+ -+ err = i2c_transfer(state->i2c, &msg, 1); -+ if (err != 1) { -+ printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x," -+ " value == 0x%02x)\n", __func__, err, reg, data); -+ return -EREMOTEIO; -+ } -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_readreg(struct dvbsky_m88ds3103_state *state, u8 reg) -+{ -+ int ret; -+ u8 b0[] = { reg }; -+ u8 b1[] = { 0 }; -+ struct i2c_msg msg[] = { -+ { .addr = state->config->demod_address, .flags = 0, -+ .buf = b0, .len = 1 }, -+ { .addr = state->config->demod_address, .flags = I2C_M_RD, -+ .buf = b1, .len = 1 } -+ }; -+ ret = i2c_transfer(state->i2c, msg, 2); -+ -+ if (ret != 2) { -+ printk(KERN_ERR "%s: reg=0x%x (error=%d)\n", -+ __func__, reg, ret); -+ return ret; -+ } -+ -+ if (debug > 1) -+ printk(KERN_INFO "m88ds3103: read reg 0x%02x, value 0x%02x\n", -+ reg, b1[0]); -+ -+ return b1[0]; -+} -+ -+/*tuner register operations.*/ -+static int dvbsky_m88ds3103_tuner_writereg(struct dvbsky_m88ds3103_state *state, int reg, int data) -+{ -+ u8 buf[] = { reg, data }; -+ struct i2c_msg msg = { .addr = 0x60, -+ .flags = 0, .buf = buf, .len = 2 }; -+ int err; -+ -+ dvbsky_m88ds3103_writereg(state, 0x03, 0x11); -+ err = i2c_transfer(state->i2c, &msg, 1); -+ -+ if (err != 1) { -+ printk("%s: writereg error(err == %i, reg == 0x%02x," -+ " value == 0x%02x)\n", __func__, err, reg, data); -+ return -EREMOTEIO; -+ } -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_tuner_readreg(struct dvbsky_m88ds3103_state *state, u8 reg) -+{ -+ int ret; -+ u8 b0[] = { reg }; -+ u8 b1[] = { 0 }; -+ struct i2c_msg msg[] = { -+ { .addr = 0x60, .flags = 0, -+ .buf = b0, .len = 1 }, -+ { .addr = 0x60, .flags = I2C_M_RD, -+ .buf = b1, .len = 1 } -+ }; -+ -+ dvbsky_m88ds3103_writereg(state, 0x03, 0x11); -+ ret = i2c_transfer(state->i2c, msg, 2); -+ -+ if (ret != 2) { -+ printk(KERN_ERR "%s: reg=0x%x(error=%d)\n", __func__, reg, ret); -+ return ret; -+ } -+ -+ return b1[0]; -+} -+ -+/* Bulk demod I2C write, for firmware download. */ -+static int dvbsky_m88ds3103_writeregN(struct dvbsky_m88ds3103_state *state, int reg, -+ const u8 *data, u16 len) -+{ -+ int ret = -EREMOTEIO; -+ struct i2c_msg msg; -+ u8 *buf; -+ -+ buf = kmalloc(len + 1, GFP_KERNEL); -+ if (buf == NULL) { -+ printk("Unable to kmalloc\n"); -+ ret = -ENOMEM; -+ goto error; -+ } -+ -+ *(buf) = reg; -+ memcpy(buf + 1, data, len); -+ -+ msg.addr = state->config->demod_address; -+ msg.flags = 0; -+ msg.buf = buf; -+ msg.len = len + 1; -+ -+ if (debug > 1) -+ printk(KERN_INFO "m88ds3103: %s: write regN 0x%02x, len = %d\n", -+ __func__, reg, len); -+ -+ ret = i2c_transfer(state->i2c, &msg, 1); -+ if (ret != 1) { -+ printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x\n", -+ __func__, ret, reg); -+ ret = -EREMOTEIO; -+ } -+ -+error: -+ kfree(buf); -+ -+ return ret; -+} -+ -+static int dvbsky_m88ds3103_load_firmware(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ const struct firmware *fw; -+ int i, ret = 0; -+ -+ dprintk("%s()\n", __func__); -+ -+ if (state->skip_fw_load) -+ return 0; -+ /* Load firmware */ -+ /* request the firmware, this will block until someone uploads it */ -+ if(state->demod_id == DS3000_ID){ -+ printk(KERN_INFO "%s: Waiting for firmware upload (%s)...\n", __func__, -+ DS3000_DEFAULT_FIRMWARE); -+ ret = request_firmware(&fw, DS3000_DEFAULT_FIRMWARE, -+ state->i2c->dev.parent); -+ }else if(state->demod_id == DS3103_ID){ -+ printk(KERN_INFO "%s: Waiting for firmware upload (%s)...\n", __func__, -+ DS3103_DEFAULT_FIRMWARE); -+ ret = request_firmware(&fw, DS3103_DEFAULT_FIRMWARE, -+ state->i2c->dev.parent); -+ } -+ -+ printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n", __func__); -+ if (ret) { -+ printk(KERN_ERR "%s: No firmware uploaded (timeout or file not " -+ "found?)\n", __func__); -+ return ret; -+ } -+ -+ /* Make sure we don't recurse back through here during loading */ -+ state->skip_fw_load = 1; -+ -+ dprintk("Firmware is %zu bytes (%02x %02x .. %02x %02x)\n", -+ fw->size, -+ fw->data[0], -+ fw->data[1], -+ fw->data[fw->size - 2], -+ fw->data[fw->size - 1]); -+ -+ /* stop internal mcu. */ -+ dvbsky_m88ds3103_writereg(state, 0xb2, 0x01); -+ /* split firmware to download.*/ -+ for(i = 0; i < FW_DOWN_LOOP; i++){ -+ ret = dvbsky_m88ds3103_writeregN(state, 0xb0, &(fw->data[FW_DOWN_SIZE*i]), FW_DOWN_SIZE); -+ if(ret != 1) break; -+ } -+ /* start internal mcu. */ -+ if(ret == 1) -+ dvbsky_m88ds3103_writereg(state, 0xb2, 0x00); -+ -+ release_firmware(fw); -+ -+ dprintk("%s: Firmware upload %s\n", __func__, -+ ret == 1 ? "complete" : "failed"); -+ -+ if(ret == 1) ret = 0; -+ -+ /* Ensure firmware is always loaded if required */ -+ state->skip_fw_load = 0; -+ -+ return ret; -+} -+ -+ -+static int dvbsky_m88ds3103_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 data; -+ -+ dprintk("%s(%d)\n", __func__, voltage); -+ -+ dprintk("m88ds3103:pin_ctrl = (%02x)\n", state->config->pin_ctrl); -+ -+ if(state->config->set_voltage) -+ state->config->set_voltage(fe, voltage); -+ -+ data = dvbsky_m88ds3103_readreg(state, 0xa2); -+ -+ if(state->config->pin_ctrl & 0x80){ /*If control pin is assigned.*/ -+ data &= ~0x03; /* bit0 V/H, bit1 off/on */ -+ if(state->config->pin_ctrl & 0x02) -+ data |= 0x02; -+ -+ switch (voltage) { -+ case SEC_VOLTAGE_18: -+ if((state->config->pin_ctrl & 0x01) == 0) -+ data |= 0x01; -+ break; -+ case SEC_VOLTAGE_13: -+ if(state->config->pin_ctrl & 0x01) -+ data |= 0x01; -+ break; -+ case SEC_VOLTAGE_OFF: -+ if(state->config->pin_ctrl & 0x02) -+ data &= ~0x02; -+ else -+ data |= 0x02; -+ break; -+ } -+ } -+ -+ dvbsky_m88ds3103_writereg(state, 0xa2, data); -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_read_status(struct dvb_frontend *fe, fe_status_t* status) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ int lock = 0; -+ -+ *status = 0; -+ -+ switch (state->delivery_system){ -+ case SYS_DVBS: -+ lock = dvbsky_m88ds3103_readreg(state, 0xd1); -+ dprintk("%s: SYS_DVBS status=%x.\n", __func__, lock); -+ -+ if ((lock & 0x07) == 0x07){ -+ /*if((dvbsky_m88ds3103_readreg(state, 0x0d) & 0x07) == 0x07)*/ -+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER -+ | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; -+ -+ } -+ break; -+ case SYS_DVBS2: -+ lock = dvbsky_m88ds3103_readreg(state, 0x0d); -+ dprintk("%s: SYS_DVBS2 status=%x.\n", __func__, lock); -+ -+ if ((lock & 0x8f) == 0x8f) -+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER -+ | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; -+ -+ break; -+ default: -+ break; -+ } -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_read_ber(struct dvb_frontend *fe, u32* ber) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 tmp1, tmp2, tmp3; -+ u32 ldpc_frame_cnt, pre_err_packags, code_rate_fac = 0; -+ -+ dprintk("%s()\n", __func__); -+ -+ switch (state->delivery_system) { -+ case SYS_DVBS: -+ dvbsky_m88ds3103_writereg(state, 0xf9, 0x04); -+ tmp3 = dvbsky_m88ds3103_readreg(state, 0xf8); -+ if ((tmp3&0x10) == 0){ -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0xf7); -+ tmp2 = dvbsky_m88ds3103_readreg(state, 0xf6); -+ tmp3 |= 0x10; -+ dvbsky_m88ds3103_writereg(state, 0xf8, tmp3); -+ state->preBer = (tmp1<<8) | tmp2; -+ } -+ break; -+ case SYS_DVBS2: -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0x7e) & 0x0f; -+ switch(tmp1){ -+ case 0: code_rate_fac = 16008 - 80; break; -+ case 1: code_rate_fac = 21408 - 80; break; -+ case 2: code_rate_fac = 25728 - 80; break; -+ case 3: code_rate_fac = 32208 - 80; break; -+ case 4: code_rate_fac = 38688 - 80; break; -+ case 5: code_rate_fac = 43040 - 80; break; -+ case 6: code_rate_fac = 48408 - 80; break; -+ case 7: code_rate_fac = 51648 - 80; break; -+ case 8: code_rate_fac = 53840 - 80; break; -+ case 9: code_rate_fac = 57472 - 80; break; -+ case 10: code_rate_fac = 58192 - 80; break; -+ } -+ -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0xd7) & 0xff; -+ tmp2 = dvbsky_m88ds3103_readreg(state, 0xd6) & 0xff; -+ tmp3 = dvbsky_m88ds3103_readreg(state, 0xd5) & 0xff; -+ ldpc_frame_cnt = (tmp1 << 16) | (tmp2 << 8) | tmp3; -+ -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0xf8) & 0xff; -+ tmp2 = dvbsky_m88ds3103_readreg(state, 0xf7) & 0xff; -+ pre_err_packags = tmp1<<8 | tmp2; -+ -+ if (ldpc_frame_cnt > 1000){ -+ dvbsky_m88ds3103_writereg(state, 0xd1, 0x01); -+ dvbsky_m88ds3103_writereg(state, 0xf9, 0x01); -+ dvbsky_m88ds3103_writereg(state, 0xf9, 0x00); -+ dvbsky_m88ds3103_writereg(state, 0xd1, 0x00); -+ state->preBer = pre_err_packags; -+ } -+ break; -+ default: -+ break; -+ } -+ *ber = state->preBer; -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_read_signal_strength(struct dvb_frontend *fe, -+ u16 *signal_strength) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u16 gain; -+ u8 gain1, gain2, gain3 = 0; -+ -+ dprintk("%s()\n", __func__); -+ -+ gain1 = dvbsky_m88ds3103_tuner_readreg(state, 0x3d) & 0x1f; -+ dprintk("%s: gain1 = 0x%02x \n", __func__, gain1); -+ -+ if (gain1 > 15) gain1 = 15; -+ gain2 = dvbsky_m88ds3103_tuner_readreg(state, 0x21) & 0x1f; -+ dprintk("%s: gain2 = 0x%02x \n", __func__, gain2); -+ -+ if(state->tuner_id == TS2022_ID){ -+ gain3 = (dvbsky_m88ds3103_tuner_readreg(state, 0x66)>>3) & 0x07; -+ dprintk("%s: gain3 = 0x%02x \n", __func__, gain3); -+ -+ if (gain2 > 16) gain2 = 16; -+ if (gain2 < 2) gain2 = 2; -+ if (gain3 > 6) gain3 = 6; -+ }else{ -+ if (gain2 > 13) gain2 = 13; -+ gain3 = 0; -+ } -+ -+ gain = gain1*23 + gain2*35 + gain3*29; -+ *signal_strength = 60000 - gain*55; -+ -+ return 0; -+} -+ -+ -+static int dvbsky_m88ds3103_read_snr(struct dvb_frontend *fe, u16 *p_snr) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 val, npow1, npow2, spow1, cnt; -+ u16 tmp, snr; -+ u32 npow, spow, snr_total; -+ static const u16 mes_log10[] ={ -+ 0, 3010, 4771, 6021, 6990, 7781, 8451, 9031, 9542, 10000, -+ 10414, 10792, 11139, 11461, 11761, 12041, 12304, 12553, 12788, 13010, -+ 13222, 13424, 13617, 13802, 13979, 14150, 14314, 14472, 14624, 14771, -+ 14914, 15052, 15185, 15315, 15441, 15563, 15682, 15798, 15911, 16021, -+ 16128, 16232, 16335, 16435, 16532, 16628, 16721, 16812, 16902, 16990, -+ 17076, 17160, 17243, 17324, 17404, 17482, 17559, 17634, 17709, 17782, -+ 17853, 17924, 17993, 18062, 18129, 18195, 18261, 18325, 18388, 18451, -+ 18513, 18573, 18633, 18692, 18751, 18808, 18865, 18921, 18976, 19031 -+ }; -+ static const u16 mes_loge[] ={ -+ 0, 6931, 10986, 13863, 16094, 17918, 19459, 20794, 21972, 23026, -+ 23979, 24849, 25649, 26391, 27081, 27726, 28332, 28904, 29444, 29957, -+ 30445, 30910, 31355, 31781, 32189, 32581, 32958, 33322, 33673, 34012, -+ 34340, 34657, -+ }; -+ -+ dprintk("%s()\n", __func__); -+ -+ snr = 0; -+ -+ switch (state->delivery_system){ -+ case SYS_DVBS: -+ cnt = 10; snr_total = 0; -+ while(cnt > 0){ -+ val = dvbsky_m88ds3103_readreg(state, 0xff); -+ snr_total += val; -+ cnt--; -+ } -+ tmp = (u16)(snr_total/80); -+ if(tmp > 0){ -+ if (tmp > 32) tmp = 32; -+ snr = (mes_loge[tmp - 1] * 100) / 45; -+ }else{ -+ snr = 0; -+ } -+ break; -+ case SYS_DVBS2: -+ cnt = 10; npow = 0; spow = 0; -+ while(cnt >0){ -+ npow1 = dvbsky_m88ds3103_readreg(state, 0x8c) & 0xff; -+ npow2 = dvbsky_m88ds3103_readreg(state, 0x8d) & 0xff; -+ npow += (((npow1 & 0x3f) + (u16)(npow2 << 6)) >> 2); -+ -+ spow1 = dvbsky_m88ds3103_readreg(state, 0x8e) & 0xff; -+ spow += ((spow1 * spow1) >> 1); -+ cnt--; -+ } -+ npow /= 10; spow /= 10; -+ if(spow == 0){ -+ snr = 0; -+ }else if(npow == 0){ -+ snr = 19; -+ }else{ -+ if(spow > npow){ -+ tmp = (u16)(spow / npow); -+ if (tmp > 80) tmp = 80; -+ snr = mes_log10[tmp - 1]*3; -+ }else{ -+ tmp = (u16)(npow / spow); -+ if (tmp > 80) tmp = 80; -+ snr = -(mes_log10[tmp - 1] / 1000); -+ } -+ } -+ break; -+ default: -+ break; -+ } -+ *p_snr = snr; -+ -+ return 0; -+} -+ -+ -+static int dvbsky_m88ds3103_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 tmp1, tmp2, tmp3, data; -+ -+ dprintk("%s()\n", __func__); -+ -+ switch (state->delivery_system) { -+ case SYS_DVBS: -+ data = dvbsky_m88ds3103_readreg(state, 0xf8); -+ data |= 0x40; -+ dvbsky_m88ds3103_writereg(state, 0xf8, data); -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0xf5); -+ tmp2 = dvbsky_m88ds3103_readreg(state, 0xf4); -+ *ucblocks = (tmp1 <<8) | tmp2; -+ data &= ~0x20; -+ dvbsky_m88ds3103_writereg(state, 0xf8, data); -+ data |= 0x20; -+ dvbsky_m88ds3103_writereg(state, 0xf8, data); -+ data &= ~0x40; -+ dvbsky_m88ds3103_writereg(state, 0xf8, data); -+ break; -+ case SYS_DVBS2: -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0xda); -+ tmp2 = dvbsky_m88ds3103_readreg(state, 0xd9); -+ tmp3 = dvbsky_m88ds3103_readreg(state, 0xd8); -+ *ucblocks = (tmp1 <<16)|(tmp2 <<8)|tmp3; -+ data = dvbsky_m88ds3103_readreg(state, 0xd1); -+ data |= 0x01; -+ dvbsky_m88ds3103_writereg(state, 0xd1, data); -+ data &= ~0x01; -+ dvbsky_m88ds3103_writereg(state, 0xd1, data); -+ break; -+ default: -+ break; -+ } -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 data_a1, data_a2; -+ -+ dprintk("%s(%d)\n", __func__, tone); -+ if ((tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF)) { -+ printk(KERN_ERR "%s: Invalid, tone=%d\n", __func__, tone); -+ return -EINVAL; -+ } -+ -+ data_a1 = dvbsky_m88ds3103_readreg(state, 0xa1); -+ data_a2 = dvbsky_m88ds3103_readreg(state, 0xa2); -+ if(state->demod_id == DS3103_ID) -+ data_a2 &= 0xdf; /* Normal mode */ -+ switch (tone) { -+ case SEC_TONE_ON: -+ dprintk("%s: SEC_TONE_ON\n", __func__); -+ data_a1 |= 0x04; -+ data_a1 &= ~0x03; -+ data_a1 &= ~0x40; -+ data_a2 &= ~0xc0; -+ break; -+ case SEC_TONE_OFF: -+ dprintk("%s: SEC_TONE_OFF\n", __func__); -+ data_a2 &= ~0xc0; -+ data_a2 |= 0x80; -+ break; -+ } -+ dvbsky_m88ds3103_writereg(state, 0xa2, data_a2); -+ dvbsky_m88ds3103_writereg(state, 0xa1, data_a1); -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_send_diseqc_msg(struct dvb_frontend *fe, -+ struct dvb_diseqc_master_cmd *d) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ int i, ret = 0; -+ u8 tmp, time_out; -+ -+ /* Dump DiSEqC message */ -+ if (debug) { -+ printk(KERN_INFO "m88ds3103: %s(", __func__); -+ for (i = 0 ; i < d->msg_len ;) { -+ printk(KERN_INFO "0x%02x", d->msg[i]); -+ if (++i < d->msg_len) -+ printk(KERN_INFO ", "); -+ } -+ } -+ -+ tmp = dvbsky_m88ds3103_readreg(state, 0xa2); -+ tmp &= ~0xc0; -+ if(state->demod_id == DS3103_ID) -+ tmp &= ~0x20; -+ dvbsky_m88ds3103_writereg(state, 0xa2, tmp); -+ -+ for (i = 0; i < d->msg_len; i ++) -+ dvbsky_m88ds3103_writereg(state, (0xa3+i), d->msg[i]); -+ -+ tmp = dvbsky_m88ds3103_readreg(state, 0xa1); -+ tmp &= ~0x38; -+ tmp &= ~0x40; -+ tmp |= ((d->msg_len-1) << 3) | 0x07; -+ tmp &= ~0x80; -+ dvbsky_m88ds3103_writereg(state, 0xa1, tmp); -+ /* 1.5 * 9 * 8 = 108ms */ -+ time_out = 150; -+ while (time_out > 0){ -+ msleep(10); -+ time_out -= 10; -+ tmp = dvbsky_m88ds3103_readreg(state, 0xa1); -+ if ((tmp & 0x40) == 0) -+ break; -+ } -+ if (time_out == 0){ -+ tmp = dvbsky_m88ds3103_readreg(state, 0xa1); -+ tmp &= ~0x80; -+ tmp |= 0x40; -+ dvbsky_m88ds3103_writereg(state, 0xa1, tmp); -+ ret = 1; -+ } -+ tmp = dvbsky_m88ds3103_readreg(state, 0xa2); -+ tmp &= ~0xc0; -+ tmp |= 0x80; -+ dvbsky_m88ds3103_writereg(state, 0xa2, tmp); -+ return ret; -+} -+ -+ -+static int dvbsky_m88ds3103_diseqc_send_burst(struct dvb_frontend *fe, -+ fe_sec_mini_cmd_t burst) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 val, time_out; -+ -+ dprintk("%s()\n", __func__); -+ -+ val = dvbsky_m88ds3103_readreg(state, 0xa2); -+ val &= ~0xc0; -+ if(state->demod_id == DS3103_ID) -+ val &= 0xdf; /* Normal mode */ -+ dvbsky_m88ds3103_writereg(state, 0xa2, val); -+ /* DiSEqC burst */ -+ if (burst == SEC_MINI_B) -+ dvbsky_m88ds3103_writereg(state, 0xa1, 0x01); -+ else -+ dvbsky_m88ds3103_writereg(state, 0xa1, 0x02); -+ -+ msleep(13); -+ -+ time_out = 5; -+ do{ -+ val = dvbsky_m88ds3103_readreg(state, 0xa1); -+ if ((val & 0x40) == 0) -+ break; -+ msleep(1); -+ time_out --; -+ } while (time_out > 0); -+ -+ val = dvbsky_m88ds3103_readreg(state, 0xa2); -+ val &= ~0xc0; -+ val |= 0x80; -+ dvbsky_m88ds3103_writereg(state, 0xa2, val); -+ -+ return 0; -+} -+ -+static void dvbsky_m88ds3103_release(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ -+ dprintk("%s\n", __func__); -+ kfree(state); -+} -+ -+static int dvbsky_m88ds3103_check_id(struct dvbsky_m88ds3103_state *state) -+{ -+ int val_00, val_01; -+ -+ /*check demod id*/ -+ val_01 = dvbsky_m88ds3103_readreg(state, 0x01); -+ printk(KERN_INFO "DS3000 chip version: %x attached.\n", val_01); -+ -+ if(val_01 == 0xD0) -+ state->demod_id = DS3103_ID; -+ else if(val_01 == 0xC0) -+ state->demod_id = DS3000_ID; -+ else -+ state->demod_id = UNKNOW_ID; -+ -+ /*check tuner id*/ -+ val_00 = dvbsky_m88ds3103_tuner_readreg(state, 0x00); -+ printk(KERN_INFO "TS202x chip version[1]: %x attached.\n", val_00); -+ val_00 &= 0x03; -+ if(val_00 == 0) -+ { -+ dvbsky_m88ds3103_tuner_writereg(state, 0x00, 0x01); -+ msleep(3); -+ } -+ dvbsky_m88ds3103_tuner_writereg(state, 0x00, 0x03); -+ msleep(5); -+ -+ val_00 = dvbsky_m88ds3103_tuner_readreg(state, 0x00); -+ printk(KERN_INFO "TS202x chip version[2]: %x attached.\n", val_00); -+ val_00 &= 0xff; -+ if((val_00 == 0x01) || (val_00 == 0x41) || (val_00 == 0x81)) -+ state->tuner_id = TS2020_ID; -+ else if(((val_00 & 0xc0)== 0xc0) || (val_00 == 0x83)) -+ state->tuner_id = TS2022_ID; -+ else -+ state->tuner_id = UNKNOW_ID; -+ -+ return state->demod_id; -+} -+ -+static struct dvb_frontend_ops dvbsky_m88ds3103_ops; -+static int dvbsky_m88ds3103_initilaze(struct dvb_frontend *fe); -+ -+struct dvb_frontend *dvbsky_m88ds3103_attach(const struct dvbsky_m88ds3103_config *config, -+ struct i2c_adapter *i2c) -+{ -+ struct dvbsky_m88ds3103_state *state = NULL; -+ -+ dprintk("%s\n", __func__); -+ -+ /* allocate memory for the internal state */ -+ state = kzalloc(sizeof(struct dvbsky_m88ds3103_state), GFP_KERNEL); -+ if (state == NULL) { -+ printk(KERN_ERR "Unable to kmalloc\n"); -+ goto error2; -+ } -+ -+ state->config = config; -+ state->i2c = i2c; -+ state->preBer = 0xffff; -+ state->delivery_system = SYS_DVBS; /*Default to DVB-S.*/ -+ -+ /* check demod id */ -+ if(dvbsky_m88ds3103_check_id(state) == UNKNOW_ID){ -+ printk(KERN_ERR "Unable to find Montage chip\n"); -+ goto error3; -+ } -+ -+ memcpy(&state->frontend.ops, &dvbsky_m88ds3103_ops, -+ sizeof(struct dvb_frontend_ops)); -+ state->frontend.demodulator_priv = state; -+ -+ dvbsky_m88ds3103_initilaze(&state->frontend); -+ -+ return &state->frontend; -+ -+error3: -+ kfree(state); -+error2: -+ return NULL; -+} -+EXPORT_SYMBOL(dvbsky_m88ds3103_attach); -+ -+static int dvbsky_m88ds3103_set_carrier_offset(struct dvb_frontend *fe, -+ s32 carrier_offset_khz) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ s32 tmp; -+ -+ tmp = carrier_offset_khz; -+ tmp *= 65536; -+ -+ tmp = (2*tmp + MT_FE_MCLK_KHZ) / (2*MT_FE_MCLK_KHZ); -+ -+ if (tmp < 0) -+ tmp += 65536; -+ -+ dvbsky_m88ds3103_writereg(state, 0x5f, tmp >> 8); -+ dvbsky_m88ds3103_writereg(state, 0x5e, tmp & 0xff); -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_set_symrate(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ u16 value; -+ -+ value = (((c->symbol_rate / 1000) << 15) + (MT_FE_MCLK_KHZ / 4)) / (MT_FE_MCLK_KHZ / 2); -+ dvbsky_m88ds3103_writereg(state, 0x61, value & 0x00ff); -+ dvbsky_m88ds3103_writereg(state, 0x62, (value & 0xff00) >> 8); -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_set_CCI(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 tmp; -+ -+ tmp = dvbsky_m88ds3103_readreg(state, 0x56); -+ tmp &= ~0x01; -+ dvbsky_m88ds3103_writereg(state, 0x56, tmp); -+ -+ tmp = dvbsky_m88ds3103_readreg(state, 0x76); -+ tmp &= ~0x80; -+ dvbsky_m88ds3103_writereg(state, 0x76, tmp); -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_init_reg(struct dvbsky_m88ds3103_state *state, const u8 *p_reg_tab, u32 size) -+{ -+ u32 i; -+ -+ for(i = 0; i < size; i+=2) -+ dvbsky_m88ds3103_writereg(state, p_reg_tab[i], p_reg_tab[i+1]); -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_get_locked_sym_rate(struct dvbsky_m88ds3103_state *state, u32 *sym_rate_KSs) -+{ -+ u16 tmp; -+ u32 sym_rate_tmp; -+ u8 val_0x6d, val_0x6e; -+ -+ val_0x6d = dvbsky_m88ds3103_readreg(state, 0x6d); -+ val_0x6e = dvbsky_m88ds3103_readreg(state, 0x6e); -+ -+ tmp = (u16)((val_0x6e<<8) | val_0x6d); -+ -+ sym_rate_tmp = (u32)(tmp * MT_FE_MCLK_KHZ); -+ sym_rate_tmp = (u32)(sym_rate_tmp / (1<<16)); -+ *sym_rate_KSs = sym_rate_tmp; -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_get_channel_info(struct dvbsky_m88ds3103_state *state, u8 *p_mode, u8 *p_coderate) -+{ -+ u8 tmp, val_0x7E; -+ -+ if(state->delivery_system == SYS_DVBS2){ -+ val_0x7E = dvbsky_m88ds3103_readreg(state, 0x7e); -+ tmp = (u8)((val_0x7E&0xC0) >> 6); -+ *p_mode = tmp; -+ tmp = (u8)(val_0x7E & 0x0f); -+ *p_coderate = tmp; -+ } else { -+ *p_mode = 0; -+ tmp = dvbsky_m88ds3103_readreg(state, 0xe6); -+ tmp = (u8)(tmp >> 5); -+ *p_coderate = tmp; -+ } -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_set_clock_ratio(struct dvbsky_m88ds3103_state *state) -+{ -+ u8 val, mod_fac, tmp1, tmp2; -+ u32 input_datarate, locked_sym_rate_KSs; -+ u32 MClk_KHz = 96000; -+ u8 mod_mode, code_rate, divid_ratio = 0; -+ -+ locked_sym_rate_KSs = 0; -+ dvbsky_m88ds3103_get_locked_sym_rate(state, &locked_sym_rate_KSs); -+ if(locked_sym_rate_KSs == 0) -+ return 0; -+ -+ dvbsky_m88ds3103_get_channel_info(state, &mod_mode, &code_rate); -+ -+ if (state->delivery_system == SYS_DVBS2) -+ { -+ switch(mod_mode) { -+ case 1: mod_fac = 3; break; -+ case 2: mod_fac = 4; break; -+ case 3: mod_fac = 5; break; -+ default: mod_fac = 2; break; -+ } -+ -+ switch(code_rate) { -+ case 0: input_datarate = locked_sym_rate_KSs*mod_fac/8/4; break; -+ case 1: input_datarate = locked_sym_rate_KSs*mod_fac/8/3; break; -+ case 2: input_datarate = locked_sym_rate_KSs*mod_fac*2/8/5; break; -+ case 3: input_datarate = locked_sym_rate_KSs*mod_fac/8/2; break; -+ case 4: input_datarate = locked_sym_rate_KSs*mod_fac*3/8/5; break; -+ case 5: input_datarate = locked_sym_rate_KSs*mod_fac*2/8/3; break; -+ case 6: input_datarate = locked_sym_rate_KSs*mod_fac*3/8/4; break; -+ case 7: input_datarate = locked_sym_rate_KSs*mod_fac*4/8/5; break; -+ case 8: input_datarate = locked_sym_rate_KSs*mod_fac*5/8/6; break; -+ case 9: input_datarate = locked_sym_rate_KSs*mod_fac*8/8/9; break; -+ case 10: input_datarate = locked_sym_rate_KSs*mod_fac*9/8/10; break; -+ default: input_datarate = locked_sym_rate_KSs*mod_fac*2/8/3; break; -+ } -+ -+ if(state->demod_id == DS3000_ID) -+ input_datarate = input_datarate * 115 / 100; -+ -+ if(input_datarate < 4800) {tmp1 = 15;tmp2 = 15;} //4.8MHz TS clock -+ else if(input_datarate < 4966) {tmp1 = 14;tmp2 = 15;} //4.966MHz TS clock -+ else if(input_datarate < 5143) {tmp1 = 14;tmp2 = 14;} //5.143MHz TS clock -+ else if(input_datarate < 5333) {tmp1 = 13;tmp2 = 14;} //5.333MHz TS clock -+ else if(input_datarate < 5538) {tmp1 = 13;tmp2 = 13;} //5.538MHz TS clock -+ else if(input_datarate < 5760) {tmp1 = 12;tmp2 = 13;} //5.76MHz TS clock allan 0809 -+ else if(input_datarate < 6000) {tmp1 = 12;tmp2 = 12;} //6MHz TS clock -+ else if(input_datarate < 6260) {tmp1 = 11;tmp2 = 12;} //6.26MHz TS clock -+ else if(input_datarate < 6545) {tmp1 = 11;tmp2 = 11;} //6.545MHz TS clock -+ else if(input_datarate < 6857) {tmp1 = 10;tmp2 = 11;} //6.857MHz TS clock -+ else if(input_datarate < 7200) {tmp1 = 10;tmp2 = 10;} //7.2MHz TS clock -+ else if(input_datarate < 7578) {tmp1 = 9;tmp2 = 10;} //7.578MHz TS clock -+ else if(input_datarate < 8000) {tmp1 = 9;tmp2 = 9;} //8MHz TS clock -+ else if(input_datarate < 8470) {tmp1 = 8;tmp2 = 9;} //8.47MHz TS clock -+ else if(input_datarate < 9000) {tmp1 = 8;tmp2 = 8;} //9MHz TS clock -+ else if(input_datarate < 9600) {tmp1 = 7;tmp2 = 8;} //9.6MHz TS clock -+ else if(input_datarate < 10285) {tmp1 = 7;tmp2 = 7;} //10.285MHz TS clock -+ else if(input_datarate < 12000) {tmp1 = 6;tmp2 = 6;} //12MHz TS clock -+ else if(input_datarate < 14400) {tmp1 = 5;tmp2 = 5;} //14.4MHz TS clock -+ else if(input_datarate < 18000) {tmp1 = 4;tmp2 = 4;} //18MHz TS clock -+ else {tmp1 = 3;tmp2 = 3;} //24MHz TS clock -+ -+ if(state->demod_id == DS3000_ID) { -+ val = (u8)((tmp1<<4) + tmp2); -+ dvbsky_m88ds3103_writereg(state, 0xfe, val); -+ } else { -+ tmp1 = dvbsky_m88ds3103_readreg(state, 0x22); -+ tmp2 = dvbsky_m88ds3103_readreg(state, 0x24); -+ -+ tmp1 >>= 6; -+ tmp1 &= 0x03; -+ tmp2 >>= 6; -+ tmp2 &= 0x03; -+ -+ if((tmp1 == 0x00) && (tmp2 == 0x01)) -+ MClk_KHz = 144000; -+ else if((tmp1 == 0x00) && (tmp2 == 0x03)) -+ MClk_KHz = 72000; -+ else if((tmp1 == 0x01) && (tmp2 == 0x01)) -+ MClk_KHz = 115200; -+ else if((tmp1 == 0x02) && (tmp2 == 0x01)) -+ MClk_KHz = 96000; -+ else if((tmp1 == 0x03) && (tmp2 == 0x00)) -+ MClk_KHz = 192000; -+ else -+ return 0; -+ -+ if(input_datarate < 5200) /*Max. 2011-12-23 11:55*/ -+ input_datarate = 5200; -+ -+ if(input_datarate != 0) -+ divid_ratio = (u8)(MClk_KHz / input_datarate); -+ else -+ divid_ratio = 0xFF; -+ -+ if(divid_ratio > 128) -+ divid_ratio = 128; -+ -+ if(divid_ratio < 2) -+ divid_ratio = 2; -+ -+ tmp1 = (u8)(divid_ratio / 2); -+ tmp2 = (u8)(divid_ratio / 2); -+ -+ if((divid_ratio % 2) != 0) -+ tmp2 += 1; -+ -+ tmp1 -= 1; -+ tmp2 -= 1; -+ -+ tmp1 &= 0x3f; -+ tmp2 &= 0x3f; -+ -+ val = dvbsky_m88ds3103_readreg(state, 0xfe); -+ val &= 0xF0; -+ val |= (tmp2 >> 2) & 0x0f; -+ dvbsky_m88ds3103_writereg(state, 0xfe, val); -+ -+ val = (u8)((tmp2 & 0x03) << 6); -+ val |= tmp1; -+ dvbsky_m88ds3103_writereg(state, 0xea, val); -+ } -+ } else { -+ mod_fac = 2; -+ -+ switch(code_rate) { -+ case 4: input_datarate = locked_sym_rate_KSs*mod_fac/2/8; break; -+ case 3: input_datarate = locked_sym_rate_KSs*mod_fac*2/3/8; break; -+ case 2: input_datarate = locked_sym_rate_KSs*mod_fac*3/4/8; break; -+ case 1: input_datarate = locked_sym_rate_KSs*mod_fac*5/6/8; break; -+ case 0: input_datarate = locked_sym_rate_KSs*mod_fac*7/8/8; break; -+ default: input_datarate = locked_sym_rate_KSs*mod_fac*3/4/8; break; -+ } -+ -+ if(state->demod_id == DS3000_ID) -+ input_datarate = input_datarate * 115 / 100; -+ -+ if(input_datarate < 6857) {tmp1 = 7;tmp2 = 7;} //6.857MHz TS clock -+ else if(input_datarate < 7384) {tmp1 = 6;tmp2 = 7;} //7.384MHz TS clock -+ else if(input_datarate < 8000) {tmp1 = 6;tmp2 = 6;} //8MHz TS clock -+ else if(input_datarate < 8727) {tmp1 = 5;tmp2 = 6;} //8.727MHz TS clock -+ else if(input_datarate < 9600) {tmp1 = 5;tmp2 = 5;} //9.6MHz TS clock -+ else if(input_datarate < 10666) {tmp1 = 4;tmp2 = 5;} //10.666MHz TS clock -+ else if(input_datarate < 12000) {tmp1 = 4;tmp2 = 4;} //12MHz TS clock -+ else if(input_datarate < 13714) {tmp1 = 3;tmp2 = 4;} //13.714MHz TS clock -+ else if(input_datarate < 16000) {tmp1 = 3;tmp2 = 3;} //16MHz TS clock -+ else if(input_datarate < 19200) {tmp1 = 2;tmp2 = 3;} //19.2MHz TS clock -+ else {tmp1 = 2;tmp2 = 2;} //24MHz TS clock -+ -+ if(state->demod_id == DS3000_ID) { -+ val = dvbsky_m88ds3103_readreg(state, 0xfe); -+ val &= 0xc0; -+ val |= ((u8)((tmp1<<3) + tmp2)); -+ dvbsky_m88ds3103_writereg(state, 0xfe, val); -+ } else { -+ if(input_datarate < 5200) /*Max. 2011-12-23 11:55*/ -+ input_datarate = 5200; -+ -+ if(input_datarate != 0) -+ divid_ratio = (u8)(MClk_KHz / input_datarate); -+ else -+ divid_ratio = 0xFF; -+ -+ if(divid_ratio > 128) -+ divid_ratio = 128; -+ -+ if(divid_ratio < 2) -+ divid_ratio = 2; -+ -+ tmp1 = (u8)(divid_ratio / 2); -+ tmp2 = (u8)(divid_ratio / 2); -+ -+ if((divid_ratio % 2) != 0) -+ tmp2 += 1; -+ -+ tmp1 -= 1; -+ tmp2 -= 1; -+ -+ tmp1 &= 0x3f; -+ tmp2 &= 0x3f; -+ -+ val = dvbsky_m88ds3103_readreg(state, 0xfe); -+ val &= 0xF0; -+ val |= (tmp2 >> 2) & 0x0f; -+ dvbsky_m88ds3103_writereg(state, 0xfe, val); -+ -+ val = (u8)((tmp2 & 0x03) << 6); -+ val |= tmp1; -+ dvbsky_m88ds3103_writereg(state, 0xea, val); -+ } -+ } -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_demod_connect(struct dvb_frontend *fe, s32 carrier_offset_khz) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ u16 value; -+ u8 val1,val2,data; -+ -+ dprintk("connect delivery system = %d\n", state->delivery_system); -+ -+ /* ds3000 global reset */ -+ dvbsky_m88ds3103_writereg(state, 0x07, 0x80); -+ dvbsky_m88ds3103_writereg(state, 0x07, 0x00); -+ /* ds3000 build-in uC reset */ -+ dvbsky_m88ds3103_writereg(state, 0xb2, 0x01); -+ /* ds3000 software reset */ -+ dvbsky_m88ds3103_writereg(state, 0x00, 0x01); -+ -+ switch (state->delivery_system) { -+ case SYS_DVBS: -+ /* initialise the demod in DVB-S mode */ -+ if(state->demod_id == DS3000_ID){ -+ dvbsky_m88ds3103_init_reg(state, ds3000_dvbs_init_tab, sizeof(ds3000_dvbs_init_tab)); -+ -+ value = dvbsky_m88ds3103_readreg(state, 0xfe); -+ value &= 0xc0; -+ value |= 0x1b; -+ dvbsky_m88ds3103_writereg(state, 0xfe, value); -+ -+ if(state->config->ci_mode) -+ val1 = 0x80; -+ else if(state->config->ts_mode) -+ val1 = 0x60; -+ else -+ val1 = 0x20; -+ dvbsky_m88ds3103_writereg(state, 0xfd, val1); -+ -+ }else if(state->demod_id == DS3103_ID){ -+ dvbsky_m88ds3103_init_reg(state, ds3103_dvbs_init_tab, sizeof(ds3103_dvbs_init_tab)); -+ -+ /* set ts clock */ -+ if(state->config->ci_mode == 2){ -+ val1 = 6; val2 = 6; -+ }else if(state->config->ts_mode == 0) { -+ val1 = 3; val2 = 3; -+ }else{ -+ val1 = 0; val2 = 0; -+ } -+ val1 -= 1; val2 -= 1; -+ val1 &= 0x3f; val2 &= 0x3f; -+ data = dvbsky_m88ds3103_readreg(state, 0xfe); -+ data &= 0xf0; -+ data |= (val2 >> 2) & 0x0f; -+ dvbsky_m88ds3103_writereg(state, 0xfe, data); -+ data = (val2 & 0x03) << 6; -+ data |= val1; -+ dvbsky_m88ds3103_writereg(state, 0xea, data); -+ -+ dvbsky_m88ds3103_writereg(state, 0x4d, 0xfd & dvbsky_m88ds3103_readreg(state, 0x4d)); -+ dvbsky_m88ds3103_writereg(state, 0x30, 0xef & dvbsky_m88ds3103_readreg(state, 0x30)); -+ -+ /* set master clock */ -+ val1 = dvbsky_m88ds3103_readreg(state, 0x22); -+ val2 = dvbsky_m88ds3103_readreg(state, 0x24); -+ -+ val1 &= 0x3f; -+ val2 &= 0x3f; -+ val1 |= 0x80; -+ val2 |= 0x40; -+ -+ dvbsky_m88ds3103_writereg(state, 0x22, val1); -+ dvbsky_m88ds3103_writereg(state, 0x24, val2); -+ -+ if(state->config->ci_mode){ -+ if(state->config->ci_mode == 2) -+ val1 = 0x43; -+ else -+ val1 = 0x03; -+ } -+ else if(state->config->ts_mode) -+ val1 = 0x06; -+ else -+ val1 = 0x42; -+ dvbsky_m88ds3103_writereg(state, 0xfd, val1); -+ } -+ break; -+ case SYS_DVBS2: -+ /* initialise the demod in DVB-S2 mode */ -+ if(state->demod_id == DS3000_ID){ -+ dvbsky_m88ds3103_init_reg(state, ds3000_dvbs2_init_tab, sizeof(ds3000_dvbs2_init_tab)); -+ -+ if (c->symbol_rate >= 30000000) -+ dvbsky_m88ds3103_writereg(state, 0xfe, 0x54); -+ else -+ dvbsky_m88ds3103_writereg(state, 0xfe, 0x98); -+ -+ }else if(state->demod_id == DS3103_ID){ -+ dvbsky_m88ds3103_init_reg(state, ds3103_dvbs2_init_tab, sizeof(ds3103_dvbs2_init_tab)); -+ -+ /* set ts clock */ -+ if(state->config->ci_mode == 2){ -+ val1 = 6; val2 = 6; -+ }else if(state->config->ts_mode == 0){ -+ val1 = 5; val2 = 4; -+ }else{ -+ val1 = 0; val2 = 0; -+ } -+ val1 -= 1; val2 -= 1; -+ val1 &= 0x3f; val2 &= 0x3f; -+ data = dvbsky_m88ds3103_readreg(state, 0xfe); -+ data &= 0xf0; -+ data |= (val2 >> 2) & 0x0f; -+ dvbsky_m88ds3103_writereg(state, 0xfe, data); -+ data = (val2 & 0x03) << 6; -+ data |= val1; -+ dvbsky_m88ds3103_writereg(state, 0xea, data); -+ -+ dvbsky_m88ds3103_writereg(state, 0x4d, 0xfd & dvbsky_m88ds3103_readreg(state, 0x4d)); -+ dvbsky_m88ds3103_writereg(state, 0x30, 0xef & dvbsky_m88ds3103_readreg(state, 0x30)); -+ -+ /* set master clock */ -+ val1 = dvbsky_m88ds3103_readreg(state, 0x22); -+ val2 = dvbsky_m88ds3103_readreg(state, 0x24); -+ -+ val1 &= 0x3f; -+ val2 &= 0x3f; -+ if((state->config->ci_mode == 2) || (state->config->ts_mode == 1)){ -+ val1 |= 0x80; -+ val2 |= 0x40; -+ }else{ -+ if (c->symbol_rate >= 28000000){ -+ val1 |= 0xc0; -+ }else if (c->symbol_rate >= 18000000){ -+ val2 |= 0x40; -+ }else{ -+ val1 |= 0x80; -+ val2 |= 0x40; -+ } -+ } -+ dvbsky_m88ds3103_writereg(state, 0x22, val1); -+ dvbsky_m88ds3103_writereg(state, 0x24, val2); -+ } -+ -+ if(state->config->ci_mode){ -+ if(state->config->ci_mode == 2) -+ val1 = 0x43; -+ else -+ val1 = 0x03; -+ } -+ else if(state->config->ts_mode) -+ val1 = 0x06; -+ else -+ val1 = 0x42; -+ dvbsky_m88ds3103_writereg(state, 0xfd, val1); -+ -+ break; -+ default: -+ return 1; -+ } -+ /* disable 27MHz clock output */ -+ dvbsky_m88ds3103_writereg(state, 0x29, 0x80); -+ /* enable ac coupling */ -+ dvbsky_m88ds3103_writereg(state, 0x25, 0x8a); -+ -+ if ((c->symbol_rate / 1000) <= 3000){ -+ dvbsky_m88ds3103_writereg(state, 0xc3, 0x08); /* 8 * 32 * 100 / 64 = 400*/ -+ dvbsky_m88ds3103_writereg(state, 0xc8, 0x20); -+ dvbsky_m88ds3103_writereg(state, 0xc4, 0x08); /* 8 * 0 * 100 / 128 = 0*/ -+ dvbsky_m88ds3103_writereg(state, 0xc7, 0x00); -+ }else if((c->symbol_rate / 1000) <= 10000){ -+ dvbsky_m88ds3103_writereg(state, 0xc3, 0x08); /* 8 * 16 * 100 / 64 = 200*/ -+ dvbsky_m88ds3103_writereg(state, 0xc8, 0x10); -+ dvbsky_m88ds3103_writereg(state, 0xc4, 0x08); /* 8 * 0 * 100 / 128 = 0*/ -+ dvbsky_m88ds3103_writereg(state, 0xc7, 0x00); -+ }else{ -+ dvbsky_m88ds3103_writereg(state, 0xc3, 0x08); /* 8 * 6 * 100 / 64 = 75*/ -+ dvbsky_m88ds3103_writereg(state, 0xc8, 0x06); -+ dvbsky_m88ds3103_writereg(state, 0xc4, 0x08); /* 8 * 0 * 100 / 128 = 0*/ -+ dvbsky_m88ds3103_writereg(state, 0xc7, 0x00); -+ } -+ -+ dvbsky_m88ds3103_set_symrate(fe); -+ -+ dvbsky_m88ds3103_set_CCI(fe); -+ -+ dvbsky_m88ds3103_set_carrier_offset(fe, carrier_offset_khz); -+ -+ /* ds3000 out of software reset */ -+ dvbsky_m88ds3103_writereg(state, 0x00, 0x00); -+ /* start ds3000 build-in uC */ -+ dvbsky_m88ds3103_writereg(state, 0xb2, 0x00); -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_set_frontend(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ -+ int i; -+ fe_status_t status; -+ u8 lpf_mxdiv, mlpf_max, mlpf_min, nlpf, div4, capCode, changePLL; -+ s32 offset_khz, lpf_offset_KHz; -+ u16 value, ndiv, lpf_coeff; -+ u32 f3db, gdiv28, realFreq; -+ u8 RFgain; -+ -+ dprintk("%s() ", __func__); -+ dprintk("c frequency = %d\n", c->frequency); -+ dprintk("symbol rate = %d\n", c->symbol_rate); -+ dprintk("delivery system = %d\n", c->delivery_system); -+ -+ state->delivery_system = c->delivery_system; -+ -+ realFreq = c->frequency; -+ lpf_offset_KHz = 0; -+ if(c->symbol_rate < 5000000){ -+ lpf_offset_KHz = FREQ_OFFSET_AT_SMALL_SYM_RATE_KHz; -+ realFreq += FREQ_OFFSET_AT_SMALL_SYM_RATE_KHz; -+ } -+ -+ if (state->config->set_ts_params) -+ state->config->set_ts_params(fe, 0); -+ -+ div4 = 0; -+ RFgain = 0; -+ if(state->tuner_id == TS2022_ID){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x0a); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x11, 0x40); -+ if (realFreq < 1103000) { -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x1b); -+ div4 = 1; -+ ndiv = (realFreq * (6 + 8) * 4)/MT_FE_CRYSTAL_KHZ; -+ }else { -+ ndiv = (realFreq * (6 + 8) * 2)/MT_FE_CRYSTAL_KHZ; -+ } -+ ndiv = ndiv + ndiv%2; -+ if(ndiv < 4095) -+ ndiv = ndiv - 1024; -+ else if (ndiv < 6143) -+ ndiv = ndiv + 1024; -+ else -+ ndiv = ndiv + 3072; -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x01, (ndiv & 0x3f00) >> 8); -+ }else{ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x00); -+ if (realFreq < 1146000){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x11); -+ div4 = 1; -+ ndiv = (realFreq * (6 + 8) * 4) / MT_FE_CRYSTAL_KHZ; -+ }else{ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x01); -+ ndiv = (realFreq * (6 + 8) * 2) / MT_FE_CRYSTAL_KHZ; -+ } -+ ndiv = ndiv + ndiv%2; -+ ndiv = ndiv - 1024; -+ dvbsky_m88ds3103_tuner_writereg(state, 0x01, (ndiv>>8)&0x0f); -+ } -+ /* set pll */ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x02, ndiv & 0x00ff); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x03, 0x06); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x0f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x10); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ -+ if(state->tuner_id == TS2022_ID){ -+ if(( realFreq >= 1650000 ) && (realFreq <= 1850000)){ -+ msleep(5); -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x14); -+ value &= 0x7f; -+ if(value < 64){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x82); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x11, 0x6f); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x0f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x10); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ } -+ } -+ msleep(5); -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x14); -+ value &= 0x1f; -+ -+ if(value > 19){ -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x10); -+ value &= 0x1d; -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, value); -+ } -+ }else{ -+ msleep(5); -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x66); -+ changePLL = (((value & 0x80) >> 7) != div4); -+ -+ if(changePLL){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x10, 0x11); -+ div4 = 1; -+ ndiv = (realFreq * (6 + 8) * 4)/MT_FE_CRYSTAL_KHZ; -+ ndiv = ndiv + ndiv%2; -+ ndiv = ndiv - 1024; -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x01, (ndiv>>8) & 0x0f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x02, ndiv & 0xff); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x0f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x10); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ } -+ } -+ /*set the RF gain*/ -+ if(state->tuner_id == TS2020_ID) -+ dvbsky_m88ds3103_tuner_writereg(state, 0x60, 0x79); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x17); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x08); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ msleep(5); -+ -+ if(state->tuner_id == TS2020_ID){ -+ RFgain = dvbsky_m88ds3103_tuner_readreg(state, 0x3d); -+ RFgain &= 0x0f; -+ if(RFgain < 15){ -+ if(RFgain < 4) -+ RFgain = 0; -+ else -+ RFgain = RFgain -3; -+ value = ((RFgain << 3) | 0x01) & 0x79; -+ dvbsky_m88ds3103_tuner_writereg(state, 0x60, value); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x17); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x08); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ } -+ } -+ -+ /* set the LPF */ -+ if(state->tuner_id == TS2022_ID){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x25, 0x00); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x27, 0x70); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x41, 0x09); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x08, 0x0b); -+ } -+ -+ f3db = ((c->symbol_rate / 1000) *135) / 200 + 2000; -+ f3db += lpf_offset_KHz; -+ if (f3db < 7000) -+ f3db = 7000; -+ if (f3db > 40000) -+ f3db = 40000; -+ -+ gdiv28 = (MT_FE_CRYSTAL_KHZ / 1000 * 1694 + 500) / 1000; -+ dvbsky_m88ds3103_tuner_writereg(state, 0x04, gdiv28 & 0xff); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1b); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x04); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ msleep(5); -+ -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x26); -+ capCode = value & 0x3f; -+ if(state->tuner_id == TS2022_ID){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x41, 0x0d); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1b); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x04); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ -+ msleep(2); -+ -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x26); -+ value &= 0x3f; -+ value = (capCode + value) / 2; -+ } -+ else -+ value = capCode; -+ -+ gdiv28 = gdiv28 * 207 / (value * 2 + 151); -+ mlpf_max = gdiv28 * 135 / 100; -+ mlpf_min = gdiv28 * 78 / 100; -+ if (mlpf_max > 63) -+ mlpf_max = 63; -+ -+ if(state->tuner_id == TS2022_ID) -+ lpf_coeff = 3200; -+ else -+ lpf_coeff = 2766; -+ -+ nlpf = (f3db * gdiv28 * 2 / lpf_coeff / (MT_FE_CRYSTAL_KHZ / 1000) + 1) / 2 ; -+ if (nlpf > 23) nlpf = 23; -+ if (nlpf < 1) nlpf = 1; -+ -+ lpf_mxdiv = (nlpf * (MT_FE_CRYSTAL_KHZ / 1000) * lpf_coeff * 2 / f3db + 1) / 2; -+ -+ if (lpf_mxdiv < mlpf_min){ -+ nlpf++; -+ lpf_mxdiv = (nlpf * (MT_FE_CRYSTAL_KHZ / 1000) * lpf_coeff * 2 / f3db + 1) / 2; -+ } -+ -+ if (lpf_mxdiv > mlpf_max) -+ lpf_mxdiv = mlpf_max; -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x04, lpf_mxdiv); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x06, nlpf); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1b); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x04); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ msleep(5); -+ -+ if(state->tuner_id == TS2022_ID){ -+ msleep(2); -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x26); -+ capCode = value & 0x3f; -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x41, 0x09); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1b); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x04); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ -+ msleep(2); -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x26); -+ value &= 0x3f; -+ value = (capCode + value) / 2; -+ -+ value = value | 0x80; -+ dvbsky_m88ds3103_tuner_writereg(state, 0x25, value); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x27, 0x30); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x08, 0x09); -+ } -+ -+ /* Set the BB gain */ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1e); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x01); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ if(state->tuner_id == TS2020_ID){ -+ if(RFgain == 15){ -+ msleep(40); -+ value = dvbsky_m88ds3103_tuner_readreg(state, 0x21); -+ value &= 0x0f; -+ if(value < 3){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x60, 0x61); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x17); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x51, 0x1f); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x08); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x50, 0x00); -+ } -+ } -+ } -+ msleep(60); -+ -+ offset_khz = (ndiv - ndiv % 2 + 1024) * MT_FE_CRYSTAL_KHZ -+ / (6 + 8) / (div4 + 1) / 2 - realFreq; -+ -+ dvbsky_m88ds3103_demod_connect(fe, offset_khz+lpf_offset_KHz); -+ -+ for (i = 0; i < 30 ; i++) { -+ dvbsky_m88ds3103_read_status(fe, &status); -+ if (status & FE_HAS_LOCK){ -+ break; -+ } -+ msleep(20); -+ } -+ -+ if (status & FE_HAS_LOCK){ -+ if(state->config->ci_mode == 2) -+ dvbsky_m88ds3103_set_clock_ratio(state); -+ if(state->config->start_ctrl){ -+ if(state->first_lock == 0){ -+ state->config->start_ctrl(fe); -+ state->first_lock = 1; -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+static int dvbsky_m88ds3103_tune(struct dvb_frontend *fe, -+ bool re_tune, -+ unsigned int mode_flags, -+ unsigned int *delay, -+ fe_status_t *status) -+{ -+ *delay = HZ / 5; -+ -+ dprintk("%s() ", __func__); -+ dprintk("re_tune = %d\n", re_tune); -+ -+ if (re_tune) { -+ int ret = dvbsky_m88ds3103_set_frontend(fe); -+ if (ret) -+ return ret; -+ } -+ -+ return dvbsky_m88ds3103_read_status(fe, status); -+} -+ -+static enum dvbfe_algo dvbsky_m88ds3103_get_algo(struct dvb_frontend *fe) -+{ -+ return DVBFE_ALGO_HW; -+} -+ -+ /* -+ * Power config will reset and load initial firmware if required -+ */ -+static int dvbsky_m88ds3103_initilaze(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ int ret; -+ -+ dprintk("%s()\n", __func__); -+ /* hard reset */ -+ dvbsky_m88ds3103_writereg(state, 0x07, 0x80); -+ dvbsky_m88ds3103_writereg(state, 0x07, 0x00); -+ msleep(1); -+ -+ dvbsky_m88ds3103_writereg(state, 0x08, 0x01 | dvbsky_m88ds3103_readreg(state, 0x08)); -+ msleep(1); -+ -+ if(state->tuner_id == TS2020_ID){ -+ /* TS2020 init */ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x42, 0x73); -+ msleep(2); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x05, 0x01); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x62, 0xb5); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x07, 0x02); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x08, 0x01); -+ } -+ else if(state->tuner_id == TS2022_ID){ -+ /* TS2022 init */ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x62, 0x6c); -+ msleep(2); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x42, 0x6c); -+ msleep(2); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x7d, 0x9d); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x7c, 0x9a); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x7a, 0x76); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x3b, 0x01); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x63, 0x88); -+ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x61, 0x85); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x22, 0x30); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x30, 0x40); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x20, 0x23); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x24, 0x02); -+ dvbsky_m88ds3103_tuner_writereg(state, 0x12, 0xa0); -+ } -+ -+ if(state->demod_id == DS3103_ID){ -+ dvbsky_m88ds3103_writereg(state, 0x07, 0xe0); -+ dvbsky_m88ds3103_writereg(state, 0x07, 0x00); -+ msleep(1); -+ } -+ dvbsky_m88ds3103_writereg(state, 0xb2, 0x01); -+ -+ /* Load the firmware if required */ -+ ret = dvbsky_m88ds3103_load_firmware(fe); -+ if (ret != 0){ -+ printk(KERN_ERR "%s: Unable initialize firmware\n", __func__); -+ return ret; -+ } -+ if(state->demod_id == DS3103_ID){ -+ dvbsky_m88ds3103_writereg(state, 0x4d, 0xfd & dvbsky_m88ds3103_readreg(state, 0x4d)); -+ dvbsky_m88ds3103_writereg(state, 0x30, 0xef & dvbsky_m88ds3103_readreg(state, 0x30)); -+ } -+ -+ return 0; -+} -+ -+/* -+ * Initialise or wake up device -+ */ -+static int dvbsky_m88ds3103_initfe(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ u8 val; -+ -+ dprintk("%s()\n", __func__); -+ -+ /* 1st step to wake up demod */ -+ dvbsky_m88ds3103_writereg(state, 0x08, 0x01 | dvbsky_m88ds3103_readreg(state, 0x08)); -+ dvbsky_m88ds3103_writereg(state, 0x04, 0xfe & dvbsky_m88ds3103_readreg(state, 0x04)); -+ dvbsky_m88ds3103_writereg(state, 0x23, 0xef & dvbsky_m88ds3103_readreg(state, 0x23)); -+ -+ /* 2nd step to wake up tuner */ -+ val = dvbsky_m88ds3103_tuner_readreg(state, 0x00) & 0xff; -+ if((val & 0x01) == 0){ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x00, 0x01); -+ msleep(50); -+ } -+ dvbsky_m88ds3103_tuner_writereg(state, 0x00, 0x03); -+ msleep(50); -+ -+ return 0; -+} -+ -+/* Put device to sleep */ -+static int dvbsky_m88ds3103_sleep(struct dvb_frontend *fe) -+{ -+ struct dvbsky_m88ds3103_state *state = fe->demodulator_priv; -+ -+ dprintk("%s()\n", __func__); -+ -+ /* 1st step to sleep tuner */ -+ dvbsky_m88ds3103_tuner_writereg(state, 0x00, 0x00); -+ -+ /* 2nd step to sleep demod */ -+ dvbsky_m88ds3103_writereg(state, 0x08, 0xfe & dvbsky_m88ds3103_readreg(state, 0x08)); -+ dvbsky_m88ds3103_writereg(state, 0x04, 0x01 | dvbsky_m88ds3103_readreg(state, 0x04)); -+ dvbsky_m88ds3103_writereg(state, 0x23, 0x10 | dvbsky_m88ds3103_readreg(state, 0x23)); -+ -+ -+ return 0; -+} -+ -+static struct dvb_frontend_ops dvbsky_m88ds3103_ops = { -+ .delsys = { SYS_DVBS, SYS_DVBS2}, -+ .info = { -+ .name = "Montage DS3103/TS2022", -+ .type = FE_QPSK, -+ .frequency_min = 950000, -+ .frequency_max = 2150000, -+ .frequency_stepsize = 1011, /* kHz for QPSK frontends */ -+ .frequency_tolerance = 5000, -+ .symbol_rate_min = 1000000, -+ .symbol_rate_max = 45000000, -+ .caps = FE_CAN_INVERSION_AUTO | -+ FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | -+ FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | -+ FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | -+ FE_CAN_2G_MODULATION | -+ FE_CAN_QPSK | FE_CAN_RECOVER -+ }, -+ -+ .release = dvbsky_m88ds3103_release, -+ -+ .init = dvbsky_m88ds3103_initfe, -+ .sleep = dvbsky_m88ds3103_sleep, -+ .read_status = dvbsky_m88ds3103_read_status, -+ .read_ber = dvbsky_m88ds3103_read_ber, -+ .read_signal_strength = dvbsky_m88ds3103_read_signal_strength, -+ .read_snr = dvbsky_m88ds3103_read_snr, -+ .read_ucblocks = dvbsky_m88ds3103_read_ucblocks, -+ .set_tone = dvbsky_m88ds3103_set_tone, -+ .set_voltage = dvbsky_m88ds3103_set_voltage, -+ .diseqc_send_master_cmd = dvbsky_m88ds3103_send_diseqc_msg, -+ .diseqc_send_burst = dvbsky_m88ds3103_diseqc_send_burst, -+ .get_frontend_algo = dvbsky_m88ds3103_get_algo, -+ .tune = dvbsky_m88ds3103_tune, -+ .set_frontend = dvbsky_m88ds3103_set_frontend, -+}; -+ -+MODULE_DESCRIPTION("DVB Frontend module for Montage DS3103/TS2022 hardware"); -+MODULE_AUTHOR("Max nibble"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/media/dvb-frontends/dvbsky_m88ds3103.h b/drivers/media/dvb-frontends/dvbsky_m88ds3103.h -new file mode 100644 -index 0000000..df95253 ---- /dev/null -+++ b/drivers/media/dvb-frontends/dvbsky_m88ds3103.h -@@ -0,0 +1,53 @@ -+/* -+ Montage Technology M88DS3103/M88TS2022 - DVBS/S2 Satellite demod/tuner driver -+ -+ 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. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#ifndef dvbsky_m88ds3103_H -+#define dvbsky_m88ds3103_H -+ -+#include -+#include -+ -+struct dvbsky_m88ds3103_config { -+ /* the demodulator's i2c address */ -+ u8 demod_address; -+ u8 ci_mode; -+ u8 pin_ctrl; -+ u8 ts_mode; /* 0: Parallel, 1: Serial */ -+ -+ /* Set device param to start dma */ -+ int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); -+ /* Start to transfer data */ -+ int (*start_ctrl)(struct dvb_frontend *fe); -+ /* Set LNB voltage */ -+ int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); -+}; -+ -+#if IS_ENABLED(CONFIG_DVB_DVBSKY_M88DS3103) -+extern struct dvb_frontend *dvbsky_m88ds3103_attach( -+ const struct dvbsky_m88ds3103_config *config, -+ struct i2c_adapter *i2c); -+#else -+static inline struct dvb_frontend *dvbsky_m88ds3103_attach( -+ const struct dvbsky_m88ds3103_config *config, -+ struct i2c_adapter *i2c) -+{ -+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); -+ return NULL; -+} -+#endif /* CONFIG_DVB_DVBSKY_M88DS3103 */ -+#endif /* dvbsky_m88ds3103_H */ -diff --git a/drivers/media/dvb-frontends/dvbsky_m88ds3103_priv.h b/drivers/media/dvb-frontends/dvbsky_m88ds3103_priv.h -new file mode 100644 -index 0000000..dfb3f8b ---- /dev/null -+++ b/drivers/media/dvb-frontends/dvbsky_m88ds3103_priv.h -@@ -0,0 +1,403 @@ -+/* -+ Montage Technology M88DS3103/M88TS2022 - DVBS/S2 Satellite demod/tuner driver -+ -+ 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. -+ -+ This program 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. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#ifndef dvbsky_m88ds3103_PRIV_H -+#define dvbsky_m88ds3103_PRIV_H -+ -+#define FW_DOWN_SIZE 32 -+#define FW_DOWN_LOOP (8192/FW_DOWN_SIZE) -+#define DS3103_DEFAULT_FIRMWARE "dvb-fe-ds3103.fw" -+#define DS3000_DEFAULT_FIRMWARE "dvb-fe-ds300x.fw" -+#define MT_FE_MCLK_KHZ 96000 /* in kHz */ -+#define MT_FE_CRYSTAL_KHZ 27000 /* in kHz */ -+#define FREQ_OFFSET_AT_SMALL_SYM_RATE_KHz 3000 -+#define DS3000_ID 0x3000 -+#define DS3103_ID 0x3103 -+#define TS2020_ID 0x2020 -+#define TS2022_ID 0x2022 -+#define UNKNOW_ID 0x0000 -+ -+struct dvbsky_m88ds3103_state { -+ struct i2c_adapter *i2c; -+ const struct dvbsky_m88ds3103_config *config; -+ -+ struct dvb_frontend frontend; -+ -+ u32 preBer; -+ u8 skip_fw_load; -+ u8 first_lock; /* The first time of signal lock */ -+ u16 demod_id; /* demod chip type */ -+ u16 tuner_id; /* tuner chip type */ -+ fe_delivery_system_t delivery_system; -+}; -+ -+/* For M88DS3103 demod dvbs mode.*/ -+static u8 ds3103_dvbs_init_tab[] = { -+ 0x23, 0x07, -+ 0x08, 0x03, -+ 0x0c, 0x02, -+ 0x21, 0x54, -+ 0x25, 0x82, -+ 0x27, 0x31, -+ 0x30, 0x08, -+ 0x31, 0x40, -+ 0x32, 0x32, -+ 0x33, 0x35, -+ 0x35, 0xff, -+ 0x3a, 0x00, -+ 0x37, 0x10, -+ 0x38, 0x10, -+ 0x39, 0x02, -+ 0x42, 0x60, -+ 0x4a, 0x80, -+ 0x4b, 0x04, -+ 0x4d, 0x91, -+ 0x5d, 0xc8, -+ 0x50, 0x36, -+ 0x51, 0x36, -+ 0x52, 0x36, -+ 0x53, 0x36, -+ 0x63, 0x0f, -+ 0x64, 0x30, -+ 0x65, 0x40, -+ 0x68, 0x26, -+ 0x69, 0x4c, -+ 0x70, 0x20, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x40, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x60, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x80, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0xa0, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x1f, -+ 0x76, 0x38, -+ 0x77, 0xa6, -+ 0x78, 0x0c, -+ 0x79, 0x80, -+ 0x7f, 0x14, -+ 0x7c, 0x00, -+ 0xae, 0x82, -+ 0x80, 0x64, -+ 0x81, 0x66, -+ 0x82, 0x44, -+ 0x85, 0x04, -+ 0xcd, 0xf4, -+ 0x90, 0x33, -+ 0xa0, 0x44, -+ 0xc0, 0x08, -+ 0xc3, 0x10, -+ 0xc4, 0x08, -+ 0xc5, 0xf0, -+ 0xc6, 0xff, -+ 0xc7, 0x00, -+ 0xc8, 0x1a, -+ 0xc9, 0x80, -+ 0xe0, 0xf8, -+ 0xe6, 0x8b, -+ 0xd0, 0x40, -+ 0xf8, 0x20, -+ 0xfa, 0x0f, -+ 0x00, 0x00, -+ 0xbd, 0x01, -+ 0xb8, 0x00, -+}; -+/* For M88DS3103 demod dvbs2 mode.*/ -+static u8 ds3103_dvbs2_init_tab[] = { -+ 0x23, 0x07, -+ 0x08, 0x07, -+ 0x0c, 0x02, -+ 0x21, 0x54, -+ 0x25, 0x82, -+ 0x27, 0x31, -+ 0x30, 0x08, -+ 0x32, 0x32, -+ 0x33, 0x35, -+ 0x35, 0xff, -+ 0x3a, 0x00, -+ 0x37, 0x10, -+ 0x38, 0x10, -+ 0x39, 0x02, -+ 0x42, 0x60, -+ 0x4a, 0x80, -+ 0x4b, 0x04, -+ 0x4d, 0x91, -+ 0x5d, 0xc8, -+ 0x50, 0x36, -+ 0x51, 0x36, -+ 0x52, 0x36, -+ 0x53, 0x36, -+ 0x63, 0x0f, -+ 0x64, 0x10, -+ 0x65, 0x20, -+ 0x68, 0x46, -+ 0x69, 0xcd, -+ 0x70, 0x20, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x40, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x60, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x80, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0xa0, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x1f, -+ 0x76, 0x38, -+ 0x77, 0xa6, -+ 0x78, 0x0c, -+ 0x79, 0x80, -+ 0x7f, 0x14, -+ 0x85, 0x08, -+ 0xcd, 0xf4, -+ 0x90, 0x33, -+ 0x86, 0x00, -+ 0x87, 0x0f, -+ 0x89, 0x00, -+ 0x8b, 0x44, -+ 0x8c, 0x66, -+ 0x9d, 0xc1, -+ 0x8a, 0x10, -+ 0xad, 0x40, -+ 0xa0, 0x44, -+ 0xc0, 0x08, -+ 0xc1, 0x10, -+ 0xc2, 0x08, -+ 0xc3, 0x10, -+ 0xc4, 0x08, -+ 0xc5, 0xf0, -+ 0xc6, 0xff, -+ 0xc7, 0x00, -+ 0xc8, 0x1a, -+ 0xc9, 0x80, -+ 0xca, 0x23, -+ 0xcb, 0x24, -+ 0xcc, 0xf4, -+ 0xce, 0x74, -+ 0x00, 0x00, -+ 0xbd, 0x01, -+ 0xb8, 0x00, -+}; -+ -+/* For M88DS3000 demod dvbs mode.*/ -+static u8 ds3000_dvbs_init_tab[] = { -+ 0x23, 0x05, -+ 0x08, 0x03, -+ 0x0c, 0x02, -+ 0x21, 0x54, -+ 0x25, 0x82, -+ 0x27, 0x31, -+ 0x30, 0x08, -+ 0x31, 0x40, -+ 0x32, 0x32, -+ 0x33, 0x35, -+ 0x35, 0xff, -+ 0x3a, 0x00, -+ 0x37, 0x10, -+ 0x38, 0x10, -+ 0x39, 0x02, -+ 0x42, 0x60, -+ 0x4a, 0x40, -+ 0x4b, 0x04, -+ 0x4d, 0x91, -+ 0x5d, 0xc8, -+ 0x50, 0x77, -+ 0x51, 0x77, -+ 0x52, 0x36, -+ 0x53, 0x36, -+ 0x56, 0x01, -+ 0x63, 0x47, -+ 0x64, 0x30, -+ 0x65, 0x40, -+ 0x68, 0x26, -+ 0x69, 0x4c, -+ 0x70, 0x20, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x40, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x60, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x80, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0xa0, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x1f, -+ 0x76, 0x00, -+ 0x77, 0xd1, -+ 0x78, 0x0c, -+ 0x79, 0x80, -+ 0x7f, 0x04, -+ 0x7c, 0x00, -+ 0x80, 0x86, -+ 0x81, 0xa6, -+ 0x85, 0x04, -+ 0xcd, 0xf4, -+ 0x90, 0x33, -+ 0xa0, 0x44, -+ 0xc0, 0x18, -+ 0xc3, 0x10, -+ 0xc4, 0x08, -+ 0xc5, 0x80, -+ 0xc6, 0x80, -+ 0xc7, 0x0a, -+ 0xc8, 0x1a, -+ 0xc9, 0x80, -+ 0xfe, 0xb6, -+ 0xe0, 0xf8, -+ 0xe6, 0x8b, -+ 0xd0, 0x40, -+ 0xf8, 0x20, -+ 0xfa, 0x0f, -+ 0xad, 0x20, -+ 0xae, 0x07, -+ 0xb8, 0x00, -+}; -+ -+/* For M88DS3000 demod dvbs2 mode.*/ -+static u8 ds3000_dvbs2_init_tab[] = { -+ 0x23, 0x0f, -+ 0x08, 0x07, -+ 0x0c, 0x02, -+ 0x21, 0x54, -+ 0x25, 0x82, -+ 0x27, 0x31, -+ 0x30, 0x08, -+ 0x31, 0x32, -+ 0x32, 0x32, -+ 0x33, 0x35, -+ 0x35, 0xff, -+ 0x3a, 0x00, -+ 0x37, 0x10, -+ 0x38, 0x10, -+ 0x39, 0x02, -+ 0x42, 0x60, -+ 0x4a, 0x80, -+ 0x4b, 0x04, -+ 0x4d, 0x91, -+ 0x5d, 0x88, -+ 0x50, 0x36, -+ 0x51, 0x36, -+ 0x52, 0x36, -+ 0x53, 0x36, -+ 0x63, 0x60, -+ 0x64, 0x10, -+ 0x65, 0x10, -+ 0x68, 0x04, -+ 0x69, 0x29, -+ 0x70, 0x20, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x40, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x60, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x80, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0xa0, -+ 0x71, 0x70, -+ 0x72, 0x04, -+ 0x73, 0x00, -+ 0x70, 0x1f, -+ 0xa0, 0x44, -+ 0xc0, 0x08, -+ 0xc1, 0x10, -+ 0xc2, 0x08, -+ 0xc3, 0x10, -+ 0xc4, 0x08, -+ 0xc5, 0xf0, -+ 0xc6, 0xf0, -+ 0xc7, 0x0a, -+ 0xc8, 0x1a, -+ 0xc9, 0x80, -+ 0xca, 0x23, -+ 0xcb, 0x24, -+ 0xce, 0x74, -+ 0x56, 0x01, -+ 0x90, 0x03, -+ 0x76, 0x80, -+ 0x77, 0x42, -+ 0x78, 0x0a, -+ 0x79, 0x80, -+ 0xad, 0x40, -+ 0xae, 0x07, -+ 0x7f, 0xd4, -+ 0x7c, 0x00, -+ 0x80, 0xa8, -+ 0x81, 0xda, -+ 0x7c, 0x01, -+ 0x80, 0xda, -+ 0x81, 0xec, -+ 0x7c, 0x02, -+ 0x80, 0xca, -+ 0x81, 0xeb, -+ 0x7c, 0x03, -+ 0x80, 0xba, -+ 0x81, 0xdb, -+ 0x85, 0x08, -+ 0x86, 0x00, -+ 0x87, 0x02, -+ 0x89, 0x80, -+ 0x8b, 0x44, -+ 0x8c, 0xaa, -+ 0x8a, 0x10, -+ 0xba, 0x00, -+ 0xf5, 0x04, -+ 0xd2, 0x32, -+ 0xb8, 0x00, -+}; -+ -+#endif /* dvbsky_m88ds3103_PRIV_H */ -diff --git a/drivers/media/pci/cx23885/Kconfig b/drivers/media/pci/cx23885/Kconfig -index d1dcb1d..a5fbc89 100644 ---- a/drivers/media/pci/cx23885/Kconfig -+++ b/drivers/media/pci/cx23885/Kconfig -@@ -23,6 +23,8 @@ config VIDEO_CX23885 - select DVB_STB6100 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT - select DVB_CX24116 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_DVBSKY_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_DVBSKY_M88DC2800 if MEDIA_SUBDRV_AUTOSELECT - select DVB_CX24117 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT - select DVB_DS3000 if MEDIA_SUBDRV_AUTOSELECT -diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c -index 16fa7ea..2b63f78 100644 ---- a/drivers/media/pci/cx23885/cimax2.c -+++ b/drivers/media/pci/cx23885/cimax2.c -@@ -426,7 +426,7 @@ int netup_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, - return state->status; - } - --int netup_ci_init(struct cx23885_tsport *port) -+int netup_ci_init(struct cx23885_tsport *port, bool isDVBSky) - { - struct netup_ci_state *state; - u8 cimax_init[34] = { -@@ -475,6 +475,11 @@ int netup_ci_init(struct cx23885_tsport *port) - goto err; - } - -+ if(isDVBSky) { -+ cimax_init[32] = 0x22; -+ cimax_init[33] = 0x00; -+ } -+ - port->port_priv = state; - - switch (port->nr) { -@@ -548,3 +553,19 @@ void netup_ci_exit(struct cx23885_tsport *port) - dvb_ca_en50221_release(&state->ca); - kfree(state); - } -+ -+/* CI irq handler for DVBSky board*/ -+int dvbsky_ci_slot_status(struct cx23885_dev *dev) -+{ -+ struct cx23885_tsport *port = NULL; -+ struct netup_ci_state *state = NULL; -+ -+ ci_dbg_print("%s:\n", __func__); -+ -+ port = &dev->ts1; -+ state = port->port_priv; -+ schedule_work(&state->work); -+ ci_dbg_print("%s: Wakeup CI0\n", __func__); -+ -+ return 1; -+} -diff --git a/drivers/media/pci/cx23885/cimax2.h b/drivers/media/pci/cx23885/cimax2.h -index 518744a..39f3db7 100644 ---- a/drivers/media/pci/cx23885/cimax2.h -+++ b/drivers/media/pci/cx23885/cimax2.h -@@ -41,7 +41,9 @@ extern int netup_ci_slot_ts_ctl(struct dvb_ca_en50221 *en50221, int slot); - extern int netup_ci_slot_status(struct cx23885_dev *dev, u32 pci_status); - extern int netup_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, - int slot, int open); --extern int netup_ci_init(struct cx23885_tsport *port); -+extern int netup_ci_init(struct cx23885_tsport *port, bool isDVBSky); - extern void netup_ci_exit(struct cx23885_tsport *port); - -+extern int dvbsky_ci_slot_status(struct cx23885_dev *dev); -+ - #endif -diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c -index 79f20c8..cb00710 100644 ---- a/drivers/media/pci/cx23885/cx23885-cards.c -+++ b/drivers/media/pci/cx23885/cx23885-cards.c -@@ -613,6 +613,34 @@ struct cx23885_board cx23885_boards[] = { - .name = "TeVii S471", - .portb = CX23885_MPEG_DVB, - }, -+ [CX23885_BOARD_BST_PS8512] = { -+ .name = "Bestunar PS8512", -+ .portb = CX23885_MPEG_DVB, -+ }, -+ [CX23885_BOARD_DVBSKY_S950] = { -+ .name = "DVBSKY S950", -+ .portb = CX23885_MPEG_DVB, -+ }, -+ [CX23885_BOARD_DVBSKY_S952] = { -+ .name = "DVBSKY S952", -+ .portb = CX23885_MPEG_DVB, -+ .portc = CX23885_MPEG_DVB, -+ }, -+ [CX23885_BOARD_DVBSKY_S950_CI] = { -+ .ci_type = 3, -+ .name = "DVBSKY S950CI DVB-S2 CI", -+ .portb = CX23885_MPEG_DVB, -+ }, -+ [CX23885_BOARD_DVBSKY_C2800E_CI] = { -+ .ci_type = 3, -+ .name = "DVBSKY C2800E DVB-C CI", -+ .portb = CX23885_MPEG_DVB, -+ }, -+ [CX23885_BOARD_DVBSKY_T9580] = { -+ .name = "DVBSKY T9580", -+ .portb = CX23885_MPEG_DVB, -+ .portc = CX23885_MPEG_DVB, -+ }, - [CX23885_BOARD_PROF_8000] = { - .name = "Prof Revolution DVB-S2 8000", - .portb = CX23885_MPEG_DVB, -@@ -874,6 +902,30 @@ struct cx23885_subid cx23885_subids[] = { - .subdevice = 0x9022, - .card = CX23885_BOARD_TEVII_S471, - }, { -+ .subvendor = 0x14f1, -+ .subdevice = 0x8512, -+ .card = CX23885_BOARD_BST_PS8512, -+ }, { -+ .subvendor = 0x4254, -+ .subdevice = 0x0950, -+ .card = CX23885_BOARD_DVBSKY_S950, -+ }, { -+ .subvendor = 0x4254, -+ .subdevice = 0x0952, -+ .card = CX23885_BOARD_DVBSKY_S952, -+ }, { -+ .subvendor = 0x4254, -+ .subdevice = 0x950C, -+ .card = CX23885_BOARD_DVBSKY_S950_CI, -+ }, { -+ .subvendor = 0x4254, -+ .subdevice = 0x2800, -+ .card = CX23885_BOARD_DVBSKY_C2800E_CI, -+ }, { -+ .subvendor = 0x4254, -+ .subdevice = 0x9580, -+ .card = CX23885_BOARD_DVBSKY_T9580, -+ }, { - .subvendor = 0x8000, - .subdevice = 0x3034, - .card = CX23885_BOARD_PROF_8000, -@@ -1483,9 +1535,84 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) - cx_set(GP0_IO, 0x00040004); - mdelay(60); - break; -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_BST_PS8512: -+ cx23885_gpio_enable(dev, GPIO_2, 1); -+ cx23885_gpio_clear(dev, GPIO_2); -+ msleep(100); -+ cx23885_gpio_set(dev, GPIO_2); -+ break; -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_T9580: -+ cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */ -+ -+ cx23885_gpio_enable(dev, GPIO_2, 1); -+ cx23885_gpio_enable(dev, GPIO_11, 1); -+ -+ cx23885_gpio_clear(dev, GPIO_2); -+ cx23885_gpio_clear(dev, GPIO_11); -+ msleep(100); -+ cx23885_gpio_set(dev, GPIO_2); -+ cx23885_gpio_set(dev, GPIO_11); -+ break; -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ /* GPIO-0 INTA from CiMax, input -+ GPIO-1 reset CiMax, output, high active -+ GPIO-2 reset demod, output, low active -+ GPIO-3 to GPIO-10 data/addr for CAM -+ GPIO-11 ~CS0 to CiMax1 -+ GPIO-12 ~CS1 to CiMax2 -+ GPIO-13 ADL0 load LSB addr -+ GPIO-14 ADL1 load MSB addr -+ GPIO-15 ~RDY from CiMax -+ GPIO-17 ~RD to CiMax -+ GPIO-18 ~WR to CiMax -+ */ -+ cx_set(GP0_IO, 0x00060002); /* GPIO 1/2 as output */ -+ cx_clear(GP0_IO, 0x00010004); /*GPIO 0 as input*/ -+ mdelay(100);/* reset delay */ -+ cx_set(GP0_IO, 0x00060004); /* GPIO as out, reset high */ -+ cx_clear(GP0_IO, 0x00010002); -+ cx_write(MC417_CTL, 0x00000037);/* enable GPIO3-18 pins */ -+ /* GPIO-15 IN as ~ACK, rest as OUT */ -+ cx_write(MC417_OEN, 0x00001000); -+ /* ~RD, ~WR high; ADL0, ADL1 low; ~CS0, ~CS1 high */ -+ cx_write(MC417_RWD, 0x0000c300); -+ /* enable irq */ -+ cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/ -+ break; - } - } - -+static int cx23885_ir_patch(struct i2c_adapter *i2c, u8 reg, u8 mask) -+{ -+ struct i2c_msg msgs[2]; -+ u8 tx_buf[2], rx_buf[1]; -+ /* Write register address */ -+ tx_buf[0] = reg; -+ msgs[0].addr = 0x4c; -+ msgs[0].flags = 0; -+ msgs[0].len = 1; -+ msgs[0].buf = (char *) tx_buf; -+ /* Read data from register */ -+ msgs[1].addr = 0x4c; -+ msgs[1].flags = I2C_M_RD; -+ msgs[1].len = 1; -+ msgs[1].buf = (char *) rx_buf; -+ -+ i2c_transfer(i2c, msgs, 2); -+ -+ tx_buf[0] = reg; -+ tx_buf[1] = rx_buf[0] | mask; -+ msgs[0].addr = 0x4c; -+ msgs[0].flags = 0; -+ msgs[0].len = 2; -+ msgs[0].buf = (char *) tx_buf; -+ -+ return i2c_transfer(i2c, msgs, 1); -+} -+ - int cx23885_ir_init(struct cx23885_dev *dev) - { - static struct v4l2_subdev_io_pin_config ir_rxtx_pin_cfg[] = { -@@ -1573,6 +1700,23 @@ int cx23885_ir_init(struct cx23885_dev *dev) - v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, - ir_rx_pin_cfg_count, ir_rx_pin_cfg); - break; -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: -+ dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); -+ if (dev->sd_ir == NULL) { -+ ret = -ENODEV; -+ break; -+ } -+ v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, -+ ir_rx_pin_cfg_count, ir_rx_pin_cfg); -+ -+ cx23885_ir_patch(&(dev->i2c_bus[2].i2c_adap),0x1f,0x80); -+ cx23885_ir_patch(&(dev->i2c_bus[2].i2c_adap),0x23,0x80); -+ break; - case CX23885_BOARD_HAUPPAUGE_HVR1250: - if (!enable_885_ir) - break; -@@ -1602,6 +1746,12 @@ void cx23885_ir_fini(struct cx23885_dev *dev) - cx23888_ir_remove(dev); - dev->sd_ir = NULL; - break; -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: - case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: - case CX23885_BOARD_TEVII_S470: - case CX23885_BOARD_HAUPPAUGE_HVR1250: -@@ -1649,6 +1799,12 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) - if (dev->sd_ir) - cx23885_irq_add_enable(dev, PCI_MSK_IR); - break; -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: - case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: - case CX23885_BOARD_TEVII_S470: - case CX23885_BOARD_HAUPPAUGE_HVR1250: -@@ -1752,6 +1908,10 @@ void cx23885_card_setup(struct cx23885_dev *dev) - ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ - ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; - break; -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: - case CX23885_BOARD_TEVII_S470: - case CX23885_BOARD_TEVII_S471: - case CX23885_BOARD_DVBWORLD_2005: -@@ -1800,6 +1960,22 @@ void cx23885_card_setup(struct cx23885_dev *dev) - ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ - ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; - break; -+ case CX23885_BOARD_DVBSKY_S952: -+ ts1->gen_ctrl_val = 0x5; /* Parallel */ -+ ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ -+ ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; -+ ts2->gen_ctrl_val = 0xe; /* Serial bus + punctured clock */ -+ ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ -+ ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; -+ break; -+ case CX23885_BOARD_DVBSKY_T9580: -+ ts1->gen_ctrl_val = 0x5; /* Parallel */ -+ ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ -+ ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; -+ ts2->gen_ctrl_val = 0x8; /* Serial bus */ -+ ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ -+ ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; -+ break; - case CX23885_BOARD_HAUPPAUGE_HVR1250: - case CX23885_BOARD_HAUPPAUGE_HVR1500: - case CX23885_BOARD_HAUPPAUGE_HVR1500Q: -@@ -1857,6 +2033,12 @@ void cx23885_card_setup(struct cx23885_dev *dev) - case CX23885_BOARD_MPX885: - case CX23885_BOARD_MYGICA_X8507: - case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: - case CX23885_BOARD_AVERMEDIA_HC81R: - case CX23885_BOARD_TBS_6980: - case CX23885_BOARD_TBS_6981: -diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c -index edcd79d..4b57eef 100644 ---- a/drivers/media/pci/cx23885/cx23885-core.c -+++ b/drivers/media/pci/cx23885/cx23885-core.c -@@ -1909,6 +1909,10 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) - (pci_status & PCI_MSK_GPIO0)) - handled += altera_ci_irq(dev); - -+ if (cx23885_boards[dev->board].ci_type == 3 && -+ (pci_status & PCI_MSK_GPIO0)) -+ handled += dvbsky_ci_slot_status(dev); -+ - if (ts1_status) { - if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) - handled += cx23885_irq_ts(ts1, ts1_status); -@@ -2141,6 +2145,8 @@ static int cx23885_initdev(struct pci_dev *pci_dev, - cx23885_irq_add_enable(dev, PCI_MSK_GPIO1 | PCI_MSK_GPIO0); - break; - case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: - cx23885_irq_add_enable(dev, PCI_MSK_GPIO0); - break; - } -diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c -index 0549205..201523a 100644 ---- a/drivers/media/pci/cx23885/cx23885-dvb.c -+++ b/drivers/media/pci/cx23885/cx23885-dvb.c -@@ -52,6 +52,8 @@ - #include "lnbh24.h" - #include "cx24116.h" - #include "cx24117.h" -+#include "dvbsky_m88ds3103.h" -+#include "dvbsky_m88dc2800.h" - #include "cimax2.h" - #include "lgs8gxx.h" - #include "netup-eeprom.h" -@@ -507,6 +509,93 @@ static struct xc5000_config mygica_x8507_xc5000_config = { - .if_khz = 4000, - }; - -+/* bst control */ -+int bst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -+{ -+ struct cx23885_tsport *port = fe->dvb->priv; -+ struct cx23885_dev *dev = port->dev; -+ -+ cx23885_gpio_enable(dev, GPIO_1, 1); -+ cx23885_gpio_enable(dev, GPIO_0, 1); -+ -+ switch (voltage) { -+ case SEC_VOLTAGE_13: -+ cx23885_gpio_set(dev, GPIO_1); -+ cx23885_gpio_clear(dev, GPIO_0); -+ break; -+ case SEC_VOLTAGE_18: -+ cx23885_gpio_set(dev, GPIO_1); -+ cx23885_gpio_set(dev, GPIO_0); -+ break; -+ case SEC_VOLTAGE_OFF: -+ cx23885_gpio_clear(dev, GPIO_1); -+ cx23885_gpio_clear(dev, GPIO_0); -+ break; -+ } -+ return 0; -+} -+ -+int dvbsky_set_voltage_sec(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -+{ -+ struct cx23885_tsport *port = fe->dvb->priv; -+ struct cx23885_dev *dev = port->dev; -+ -+ cx23885_gpio_enable(dev, GPIO_12, 1); -+ cx23885_gpio_enable(dev, GPIO_13, 1); -+ -+ switch (voltage) { -+ case SEC_VOLTAGE_13: -+ cx23885_gpio_set(dev, GPIO_13); -+ cx23885_gpio_clear(dev, GPIO_12); -+ break; -+ case SEC_VOLTAGE_18: -+ cx23885_gpio_set(dev, GPIO_13); -+ cx23885_gpio_set(dev, GPIO_12); -+ break; -+ case SEC_VOLTAGE_OFF: -+ cx23885_gpio_clear(dev, GPIO_13); -+ cx23885_gpio_clear(dev, GPIO_12); -+ break; -+ } -+ return 0; -+} -+ -+/* bestunar single dvb-s2 */ -+static struct dvbsky_m88ds3103_config bst_ds3103_config = { -+ .demod_address = 0x68, -+ .ci_mode = 0, -+ .pin_ctrl = 0x82, -+ .ts_mode = 0, -+ .set_voltage = bst_set_voltage, -+}; -+/* DVBSKY dual dvb-s2 */ -+static struct dvbsky_m88ds3103_config dvbsky_ds3103_config_pri = { -+ .demod_address = 0x68, -+ .ci_mode = 0, -+ .pin_ctrl = 0x82, -+ .ts_mode = 0, -+ .set_voltage = bst_set_voltage, -+}; -+static struct dvbsky_m88ds3103_config dvbsky_ds3103_config_sec = { -+ .demod_address = 0x68, -+ .ci_mode = 0, -+ .pin_ctrl = 0x82, -+ .ts_mode = 1, -+ .set_voltage = dvbsky_set_voltage_sec, -+}; -+ -+static struct dvbsky_m88ds3103_config dvbsky_ds3103_ci_config = { -+ .demod_address = 0x68, -+ .ci_mode = 2, -+ .pin_ctrl = 0x82, -+ .ts_mode = 0, -+}; -+ -+static struct dvbsky_m88dc2800_config dvbsky_dc2800_config = { -+ .demod_address = 0x1c, -+ .ts_mode = 3, -+}; -+ - static struct stv090x_config prof_8000_stv090x_config = { - .device = STV0903, - .demod_mode = STV090x_SINGLE, -@@ -1311,6 +1400,57 @@ static int dvb_register(struct cx23885_tsport *port) - &tevii_ts2020_config, &i2c_bus->i2c_adap); - } - break; -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ i2c_bus = &dev->i2c_bus[1]; -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88ds3103_attach, -+ &bst_ds3103_config, -+ &i2c_bus->i2c_adap); -+ break; -+ case CX23885_BOARD_DVBSKY_S952: -+ switch (port->nr) { -+ /* port B */ -+ case 1: -+ i2c_bus = &dev->i2c_bus[1]; -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_ds3103_config_pri, -+ &i2c_bus->i2c_adap); -+ break; -+ /* port C */ -+ case 2: -+ i2c_bus = &dev->i2c_bus[0]; -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_ds3103_config_sec, -+ &i2c_bus->i2c_adap); -+ break; -+ } -+ break; -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ i2c_bus = &dev->i2c_bus[1]; -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_ds3103_ci_config, -+ &i2c_bus->i2c_adap); -+ break; -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ i2c_bus = &dev->i2c_bus[1]; -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88dc2800_attach, -+ &dvbsky_dc2800_config, -+ &i2c_bus->i2c_adap); -+ break; -+ case CX23885_BOARD_DVBSKY_T9580: -+ switch (port->nr) { -+ /* port B */ -+ case 1: -+ i2c_bus = &dev->i2c_bus[1]; -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_ds3103_config_pri, -+ &i2c_bus->i2c_adap); -+ break; -+ /* port C */ -+ case 2: -+ break; -+ } -+ break; - case CX23885_BOARD_PROF_8000: - i2c_bus = &dev->i2c_bus[0]; - -@@ -1386,7 +1526,7 @@ static int dvb_register(struct cx23885_tsport *port) - printk(KERN_INFO "NetUP Dual DVB-S2 CI card port%d MAC=%pM\n", - port->nr, port->frontends.adapter.proposed_mac); - -- netup_ci_init(port); -+ netup_ci_init(port, false); - break; - } - case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: { -@@ -1413,6 +1553,41 @@ static int dvb_register(struct cx23885_tsport *port) - memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xa0, 6); - break; - } -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_T9580:{ -+ u8 eeprom[256]; /* 24C02 i2c eeprom */ -+ -+ if(port->nr > 2) -+ break; -+ -+ dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; -+ tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, sizeof(eeprom)); -+ printk(KERN_INFO "DVBSKY PCIe MAC= %pM\n", eeprom + 0xc0+(port->nr-1)*8); -+ memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xc0 + -+ (port->nr-1)*8, 6); -+ break; -+ } -+ case CX23885_BOARD_DVBSKY_S950_CI: { -+ u8 eeprom[256]; /* 24C02 i2c eeprom */ -+ -+ if(port->nr > 2) -+ break; -+ -+ dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; -+ tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, sizeof(eeprom)); -+ printk(KERN_INFO "DVBSKY PCIe MAC= %pM\n", eeprom + 0xc0+(port->nr-1)*8); -+ memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xc0 + -+ (port->nr-1)*8, 6); -+ -+ netup_ci_init(port, true); -+ break; -+ } -+ case CX23885_BOARD_DVBSKY_C2800E_CI: { -+ netup_ci_init(port, true); -+ break; -+ } - } - - return ret; -@@ -1495,6 +1670,8 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port) - - switch (port->dev->board) { - case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: - netup_ci_exit(port); - break; - case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: -diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c -index 8a49e7c..a5e4639 100644 ---- a/drivers/media/pci/cx23885/cx23885-input.c -+++ b/drivers/media/pci/cx23885/cx23885-input.c -@@ -89,6 +89,12 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events) - case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: - case CX23885_BOARD_TEVII_S470: - case CX23885_BOARD_HAUPPAUGE_HVR1250: -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: - case CX23885_BOARD_MYGICA_X8507: - case CX23885_BOARD_TBS_6980: - case CX23885_BOARD_TBS_6981: -@@ -143,6 +149,12 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev) - case CX23885_BOARD_HAUPPAUGE_HVR1850: - case CX23885_BOARD_HAUPPAUGE_HVR1290: - case CX23885_BOARD_HAUPPAUGE_HVR1250: -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: - case CX23885_BOARD_MYGICA_X8507: - /* - * The IR controller on this board only returns pulse widths. -@@ -295,6 +307,18 @@ int cx23885_input_init(struct cx23885_dev *dev) - /* A guess at the remote */ - rc_map = RC_MAP_TEVII_NEC; - break; -+ case CX23885_BOARD_BST_PS8512: -+ case CX23885_BOARD_DVBSKY_S950: -+ case CX23885_BOARD_DVBSKY_S952: -+ case CX23885_BOARD_DVBSKY_S950_CI: -+ case CX23885_BOARD_DVBSKY_C2800E_CI: -+ case CX23885_BOARD_DVBSKY_T9580: -+ /* Integrated CX2388[58] IR controller */ -+ driver_type = RC_DRIVER_IR_RAW; -+ allowed_protos = RC_BIT_ALL; -+ /* A guess at the remote */ -+ rc_map = RC_MAP_DVBSKY; -+ break; - case CX23885_BOARD_MYGICA_X8507: - /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; -diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h -index 0fa4048..7084a4e 100644 ---- a/drivers/media/pci/cx23885/cx23885.h -+++ b/drivers/media/pci/cx23885/cx23885.h -@@ -97,6 +97,14 @@ - #define CX23885_BOARD_TBS_6980 41 - #define CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200 42 - -+#define CX23885_BOARD_BASE_INDEX 43 -+#define CX23885_BOARD_BST_PS8512 (CX23885_BOARD_BASE_INDEX) -+#define CX23885_BOARD_DVBSKY_S952 (CX23885_BOARD_BASE_INDEX+1) -+#define CX23885_BOARD_DVBSKY_S950 (CX23885_BOARD_BASE_INDEX+2) -+#define CX23885_BOARD_DVBSKY_S950_CI (CX23885_BOARD_BASE_INDEX+3) -+#define CX23885_BOARD_DVBSKY_C2800E_CI (CX23885_BOARD_BASE_INDEX+4) -+#define CX23885_BOARD_DVBSKY_T9580 (CX23885_BOARD_BASE_INDEX+5) -+ - #define GPIO_0 0x00000001 - #define GPIO_1 0x00000002 - #define GPIO_2 0x00000004 -@@ -234,7 +242,7 @@ struct cx23885_board { - */ - u32 clk_freq; - struct cx23885_input input[MAX_CX23885_INPUT]; -- int ci_type; /* for NetUP */ -+ int ci_type; /* 1 and 2 for NetUP, 3 for DVBSky. */ - /* Force bottom field first during DMA (888 workaround) */ - u32 force_bff; - }; -diff --git a/drivers/media/pci/cx88/Kconfig b/drivers/media/pci/cx88/Kconfig -index a63a9ad..7deb300 100644 ---- a/drivers/media/pci/cx88/Kconfig -+++ b/drivers/media/pci/cx88/Kconfig -@@ -57,6 +57,7 @@ config VIDEO_CX88_DVB - select DVB_ISL6421 if MEDIA_SUBDRV_AUTOSELECT - select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT - select DVB_CX24116 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_DVBSKY_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV0299 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV0288 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STB6000 if MEDIA_SUBDRV_AUTOSELECT -diff --git a/drivers/media/pci/cx88/cx88-cards.c b/drivers/media/pci/cx88/cx88-cards.c -index e18a7ac..317511d 100644 ---- a/drivers/media/pci/cx88/cx88-cards.c -+++ b/drivers/media/pci/cx88/cx88-cards.c -@@ -2314,6 +2314,18 @@ static const struct cx88_board cx88_boards[] = { - } }, - .mpeg = CX88_MPEG_DVB, - }, -+ [CX88_BOARD_BST_PS8312] = { -+ .name = "Bestunar PS8312 DVB-S/S2", -+ .tuner_type = UNSET, -+ .radio_type = UNSET, -+ .tuner_addr = ADDR_UNSET, -+ .radio_addr = ADDR_UNSET, -+ .input = { { -+ .type = CX88_VMUX_DVB, -+ .vmux = 0, -+ } }, -+ .mpeg = CX88_MPEG_DVB, -+ }, - }; - - /* ------------------------------------------------------------------ */ -@@ -2818,6 +2830,10 @@ static const struct cx88_subid cx88_subids[] = { - .subvendor = 0x1822, - .subdevice = 0x0023, - .card = CX88_BOARD_TWINHAN_VP1027_DVBS, -+ }, { -+ .subvendor = 0x14f1, -+ .subdevice = 0x8312, -+ .card = CX88_BOARD_BST_PS8312, - }, - }; - -@@ -3551,6 +3567,12 @@ static void cx88_card_setup(struct cx88_core *core) - cx_write(MO_SRST_IO, 1); - msleep(100); - break; -+ case CX88_BOARD_BST_PS8312: -+ cx_write(MO_GP1_IO, 0x808000); -+ msleep(100); -+ cx_write(MO_GP1_IO, 0x808080); -+ msleep(100); -+ break; - } /*end switch() */ - - -diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c -index 053ed1b..955b916 100644 ---- a/drivers/media/pci/cx88/cx88-dvb.c -+++ b/drivers/media/pci/cx88/cx88-dvb.c -@@ -54,6 +54,7 @@ - #include "stv0288.h" - #include "stb6000.h" - #include "cx24116.h" -+#include "dvbsky_m88ds3103.h" - #include "stv0900.h" - #include "stb6100.h" - #include "stb6100_proc.h" -@@ -459,6 +460,56 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, - return core->prev_set_voltage(fe, voltage); - return 0; - } -+/*CX88_BOARD_BST_PS8312*/ -+static int bst_dvbs_set_voltage(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage) -+{ -+ struct cx8802_dev *dev= fe->dvb->priv; -+ struct cx88_core *core = dev->core; -+ -+ cx_write(MO_GP1_IO, 0x111111); -+ switch (voltage) { -+ case SEC_VOLTAGE_13: -+ cx_write(MO_GP1_IO, 0x020200); -+ break; -+ case SEC_VOLTAGE_18: -+ cx_write(MO_GP1_IO, 0x020202); -+ break; -+ case SEC_VOLTAGE_OFF: -+ cx_write(MO_GP1_IO, 0x111100); -+ break; -+ } -+ -+ if (core->prev_set_voltage) -+ return core->prev_set_voltage(fe, voltage); -+ return 0; -+} -+ -+static int bst_dvbs_set_voltage_v2(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage) -+{ -+ struct cx8802_dev *dev= fe->dvb->priv; -+ struct cx88_core *core = dev->core; -+ -+ cx_write(MO_GP1_IO, 0x111101); -+ switch (voltage) { -+ case SEC_VOLTAGE_13: -+ cx_write(MO_GP1_IO, 0x020200); -+ break; -+ case SEC_VOLTAGE_18: -+ -+ cx_write(MO_GP1_IO, 0x020202); -+ break; -+ case SEC_VOLTAGE_OFF: -+ -+ cx_write(MO_GP1_IO, 0x111110); -+ break; -+ } -+ -+ if (core->prev_set_voltage) -+ return core->prev_set_voltage(fe, voltage); -+ return 0; -+} - - static int vp1027_set_voltage(struct dvb_frontend *fe, - fe_sec_voltage_t voltage) -@@ -706,6 +757,11 @@ static struct ts2020_config tevii_ts2020_config = { - .clk_out_div = 1, - }; - -+static struct dvbsky_m88ds3103_config dvbsky_ds3103_config = { -+ .demod_address = 0x68, -+ .set_ts_params = ds3000_set_ts_param, -+}; -+ - static const struct stv0900_config prof_7301_stv0900_config = { - .demod_address = 0x6a, - /* demod_mode = 0,*/ -@@ -1487,6 +1543,35 @@ static int dvb_register(struct cx8802_dev *dev) - tevii_dvbs_set_voltage; - } - break; -+ case CX88_BOARD_BST_PS8312: -+ fe0->dvb.frontend = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_ds3103_config, -+ &core->i2c_adap); -+ if (fe0->dvb.frontend != NULL){ -+ int ret; -+ u8 b0[] = { 0x60 }; -+ u8 b1[2] = { 0 }; -+ struct i2c_msg msg[] = { -+ { -+ .addr = 0x50, -+ .flags = 0, -+ .buf = b0, -+ .len = 1 -+ }, { -+ .addr = 0x50, -+ .flags = I2C_M_RD, -+ .buf = b1, -+ .len = 2 -+ } -+ }; -+ ret = i2c_transfer(&core->i2c_adap, msg, 2); -+ printk("PS8312: config = %02x, %02x", b1[0],b1[1]); -+ if(b1[0] == 0xaa) -+ fe0->dvb.frontend->ops.set_voltage = bst_dvbs_set_voltage_v2; -+ else -+ fe0->dvb.frontend->ops.set_voltage = bst_dvbs_set_voltage; -+ } -+ break; - case CX88_BOARD_OMICOM_SS4_PCI: - case CX88_BOARD_TBS_8920: - case CX88_BOARD_PROF_7300: -diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c -index f29e18c..42a911c 100644 ---- a/drivers/media/pci/cx88/cx88-input.c -+++ b/drivers/media/pci/cx88/cx88-input.c -@@ -419,6 +419,10 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) - rc_type = RC_BIT_NEC; - ir->sampling = 0xff00; /* address */ - break; -+ case CX88_BOARD_BST_PS8312: -+ ir_codes = RC_MAP_DVBSKY; -+ ir->sampling = 0xff00; /* address */ -+ break; - } - - if (!ir_codes) { -diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h -index 28893a6..5fa5f48 100644 ---- a/drivers/media/pci/cx88/cx88.h -+++ b/drivers/media/pci/cx88/cx88.h -@@ -237,6 +237,7 @@ extern const struct sram_channel cx88_sram_channels[]; - #define CX88_BOARD_WINFAST_DTV1800H_XC4000 88 - #define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36 89 - #define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43 90 -+#define CX88_BOARD_BST_PS8312 91 - - enum cx88_itype { - CX88_VMUX_COMPOSITE1 = 1, -diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile -index 0b8c549..abf6079 100644 ---- a/drivers/media/rc/keymaps/Makefile -+++ b/drivers/media/rc/keymaps/Makefile -@@ -28,6 +28,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ - rc-dm1105-nec.o \ - rc-dntv-live-dvb-t.o \ - rc-dntv-live-dvbt-pro.o \ -+ rc-dvbsky.o \ - rc-em-terratec.o \ - rc-encore-enltv2.o \ - rc-encore-enltv.o \ -diff --git a/drivers/media/rc/keymaps/rc-dvbsky.c b/drivers/media/rc/keymaps/rc-dvbsky.c -new file mode 100644 -index 0000000..bfc41fb ---- /dev/null -+++ b/drivers/media/rc/keymaps/rc-dvbsky.c -@@ -0,0 +1,78 @@ -+/* rc-dvbsky.c - Keytable for Dvbsky Remote Controllers -+ * -+ * keymap imported from ir-keymaps.c -+ * -+ * -+ * Copyright (c) 2010-2012 by Nibble Max -+ * -+ * 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 -+/* -+ * This table contains the complete RC5 code, instead of just the data part -+ */ -+ -+static struct rc_map_table rc5_dvbsky[] = { -+ { 0x0000, KEY_0 }, -+ { 0x0001, KEY_1 }, -+ { 0x0002, KEY_2 }, -+ { 0x0003, KEY_3 }, -+ { 0x0004, KEY_4 }, -+ { 0x0005, KEY_5 }, -+ { 0x0006, KEY_6 }, -+ { 0x0007, KEY_7 }, -+ { 0x0008, KEY_8 }, -+ { 0x0009, KEY_9 }, -+ { 0x000a, KEY_MUTE }, -+ { 0x000d, KEY_OK }, -+ { 0x000b, KEY_STOP }, -+ { 0x000c, KEY_EXIT }, -+ { 0x000e, KEY_CAMERA }, /*Snap shot*/ -+ { 0x000f, KEY_SUBTITLE }, /*PIP*/ -+ { 0x0010, KEY_VOLUMEUP }, -+ { 0x0011, KEY_VOLUMEDOWN }, -+ { 0x0012, KEY_FAVORITES }, -+ { 0x0013, KEY_LIST }, /*Info*/ -+ { 0x0016, KEY_PAUSE }, -+ { 0x0017, KEY_PLAY }, -+ { 0x001f, KEY_RECORD }, -+ { 0x0020, KEY_CHANNELDOWN }, -+ { 0x0021, KEY_CHANNELUP }, -+ { 0x0025, KEY_POWER2 }, -+ { 0x0026, KEY_REWIND }, -+ { 0x0027, KEY_FASTFORWARD }, -+ { 0x0029, KEY_LAST }, -+ { 0x002b, KEY_MENU }, -+ { 0x002c, KEY_EPG }, -+ { 0x002d, KEY_ZOOM }, -+}; -+ -+static struct rc_map_list rc5_dvbsky_map = { -+ .map = { -+ .scan = rc5_dvbsky, -+ .size = ARRAY_SIZE(rc5_dvbsky), -+ .rc_type = RC_TYPE_RC5, -+ .name = RC_MAP_DVBSKY, -+ } -+}; -+ -+static int __init init_rc_map_rc5_dvbsky(void) -+{ -+ return rc_map_register(&rc5_dvbsky_map); -+} -+ -+static void __exit exit_rc_map_rc5_dvbsky(void) -+{ -+ rc_map_unregister(&rc5_dvbsky_map); -+} -+ -+module_init(init_rc_map_rc5_dvbsky) -+module_exit(exit_rc_map_rc5_dvbsky) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Nibble Max "); -diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig -index 2059d0c..24a4ec2 100644 ---- a/drivers/media/usb/dvb-usb-v2/Kconfig -+++ b/drivers/media/usb/dvb-usb-v2/Kconfig -@@ -147,3 +147,9 @@ config DVB_USB_RTL28XXU - help - Say Y here to support the Realtek RTL28xxU DVB USB receiver. - -+config DVB_USB_DVBSKY -+ tristate "DVBSky USB2.0 support" -+ depends on DVB_USB_V2 -+ select DVB_DVBSKY_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT -+ help -+ Say Y here to support the USB receivers from DVBSky. -diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile -index 2c06714..926f12d 100644 ---- a/drivers/media/usb/dvb-usb-v2/Makefile -+++ b/drivers/media/usb/dvb-usb-v2/Makefile -@@ -40,6 +40,9 @@ obj-$(CONFIG_DVB_USB_MXL111SF) += mxl111sf-tuner.o - dvb-usb-rtl28xxu-objs := rtl28xxu.o - obj-$(CONFIG_DVB_USB_RTL28XXU) += dvb-usb-rtl28xxu.o - -+dvb-usb-dvbsky-objs := dvbsky.o -+obj-$(CONFIG_DVB_USB_DVBSKY) += dvb-usb-dvbsky.o -+ - ccflags-y += -I$(srctree)/drivers/media/dvb-core - ccflags-y += -I$(srctree)/drivers/media/dvb-frontends - ccflags-y += -I$(srctree)/drivers/media/tuners -diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c -new file mode 100644 -index 0000000..9033d92 ---- /dev/null -+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c -@@ -0,0 +1,739 @@ -+/* -+ * Driver for DVBSky USB2.0 receiver -+ * -+ * Copyright (C) 2013 Max nibble -+ * -+ * CIMax code is copied and modified from: -+ * CIMax2(R) SP2 driver in conjunction with NetUp Dual DVB-S2 CI card -+ * Copyright (C) 2009 NetUP Inc. -+ * Copyright (C) 2009 Igor M. Liplianin -+ * Copyright (C) 2009 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include "dvb_ca_en50221.h" -+#include "dvb_usb.h" -+#include "dvbsky_m88ds3103.h" -+ -+static int dvbsky_debug; -+module_param(dvbsky_debug, int, 0644); -+MODULE_PARM_DESC(dvbsky_debug, "Activates dvbsky usb debugging (default:0)"); -+ -+#define DVBSKY_CI_CTL 0x04 -+#define DVBSKY_CI_RD 1 -+ -+#define dprintk(args...) \ -+ do { \ -+ if (dvbsky_debug) \ -+ printk(KERN_INFO "dvbsky_usb: " args); \ -+ } while (0) -+ -+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); -+ -+struct dvbsky_state { -+ struct mutex stream_mutex; -+ u8 has_ci; -+ u8 ci_attached; -+ struct dvb_ca_en50221 ci; -+ unsigned long next_status_checked_time; -+ u8 ci_i2c_addr; -+ u8 current_ci_flag; -+ int ci_status; -+}; -+ -+static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) -+{ -+ struct dvbsky_state *state = d_to_priv(d); -+ int ret; -+ u8 obuf_pre[3] = { 0x37, 0, 0 }; -+ u8 obuf_post[3] = { 0x36, 3, 0 }; -+ dprintk("%s() -off \n", __func__); -+ mutex_lock(&state->stream_mutex); -+ ret = dvb_usbv2_generic_write(d, obuf_pre, 3); -+ if (!ret && onoff) { -+ msleep(10); -+ ret = dvb_usbv2_generic_write(d, obuf_post, 3); -+ dprintk("%s() -on \n", __func__); -+ } -+ mutex_unlock(&state->stream_mutex); -+ return ret; -+} -+ -+/* CI opertaions */ -+static int dvbsky_ci_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, -+ u8 *buf, int len) -+{ -+ int ret; -+ struct i2c_msg msg[] = { -+ { -+ .addr = addr, -+ .flags = 0, -+ .buf = ®, -+ .len = 1 -+ }, { -+ .addr = addr, -+ .flags = I2C_M_RD, -+ .buf = buf, -+ .len = len -+ } -+ }; -+ -+ ret = i2c_transfer(i2c_adap, msg, 2); -+ -+ if (ret != 2) { -+ dprintk("%s: error, Reg = 0x%02x, Status = %d\n", __func__, reg, ret); -+ return -1; -+ } -+ return 0; -+} -+ -+static int dvbsky_ci_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, -+ u8 *buf, int len) -+{ -+ int ret; -+ u8 buffer[len + 1]; -+ -+ struct i2c_msg msg = { -+ .addr = addr, -+ .flags = 0, -+ .buf = &buffer[0], -+ .len = len + 1 -+ }; -+ -+ buffer[0] = reg; -+ memcpy(&buffer[1], buf, len); -+ -+ ret = i2c_transfer(i2c_adap, &msg, 1); -+ -+ if (ret != 1) { -+ dprintk("%s: error, Reg=[0x%02x], Status=%d\n", __func__, reg, ret); -+ return -1; -+ } -+ return 0; -+} -+ -+static int dvbsky_ci_op_cam(struct dvb_ca_en50221 *ci, int slot, -+ u8 flag, u8 read, int addr, u8 data) -+{ -+ struct dvb_usb_device *d = ci->data; -+ struct dvbsky_state *state = d_to_priv(d); -+ u8 store; -+ int ret; -+ u8 command[4], respond[2], command_size, respond_size; -+ -+ /*dprintk("%s()\n", __func__);*/ -+ if (0 != slot) -+ return -EINVAL; -+ -+ if (state->current_ci_flag != flag) { -+ ret = dvbsky_ci_read_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &store, 1); -+ if (ret != 0) -+ return ret; -+ -+ store &= ~0x0c; -+ store |= flag; -+ -+ ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &store, 1); -+ if (ret != 0) -+ return ret; -+ } -+ state->current_ci_flag = flag; -+ -+ command[1] = (u8)((addr >> 8) & 0xff); /*high part of address*/ -+ command[2] = (u8)(addr & 0xff); /*low part of address*/ -+ if (read) { -+ command[0] = 0x71; -+ command_size = 3; -+ respond_size = 2; -+ } else { -+ command[0] = 0x70; -+ command[3] = data; -+ command_size = 4; -+ respond_size = 1; -+ } -+ ret = dvb_usbv2_generic_rw(d, command, command_size, respond, respond_size); -+ -+ return (read) ? respond[1] : 0; -+} -+ -+static int dvbsky_ci_read_attribute_mem(struct dvb_ca_en50221 *ci, -+ int slot, int addr) -+{ -+ return dvbsky_ci_op_cam(ci, slot, 0, DVBSKY_CI_RD, addr, 0); -+} -+ -+static int dvbsky_ci_write_attribute_mem(struct dvb_ca_en50221 *ci, -+ int slot, int addr, u8 data) -+{ -+ return dvbsky_ci_op_cam(ci, slot, 0, 0, addr, data); -+} -+ -+static int dvbsky_ci_read_cam_ctl(struct dvb_ca_en50221 *ci, int slot, u8 addr) -+{ -+ return dvbsky_ci_op_cam(ci, slot, DVBSKY_CI_CTL, DVBSKY_CI_RD, addr, 0); -+} -+ -+static int dvbsky_ci_write_cam_ctl(struct dvb_ca_en50221 *ci, int slot, -+ u8 addr, u8 data) -+{ -+ return dvbsky_ci_op_cam(ci, slot, DVBSKY_CI_CTL, 0, addr, data); -+} -+ -+static int dvbsky_ci_slot_reset(struct dvb_ca_en50221 *ci, int slot) -+{ -+ struct dvb_usb_device *d = ci->data; -+ struct dvbsky_state *state = d_to_priv(d); -+ u8 buf = 0x80; -+ int ret; -+ dprintk("%s() slot=%d\n", __func__, slot); -+ -+ if (0 != slot) -+ return -EINVAL; -+ -+ udelay(500); -+ ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &buf, 1); -+ -+ if (ret != 0) -+ return ret; -+ -+ udelay(500); -+ -+ buf = 0x00; -+ ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &buf, 1); -+ msleep(1000); -+ dprintk("%s() slot=%d complete\n", __func__, slot); -+ return 0; -+ -+} -+ -+static int dvbsky_ci_slot_shutdown(struct dvb_ca_en50221 *ci, int slot) -+{ -+ /* not implemented */ -+ dprintk("%s()\n", __func__); -+ return 0; -+} -+ -+static int dvbsky_ci_slot_ts_enable(struct dvb_ca_en50221 *ci, int slot) -+{ -+ struct dvb_usb_device *d = ci->data; -+ struct dvbsky_state *state = d_to_priv(d); -+ u8 buf; -+ int ret; -+ -+ dprintk("%s()\n", __func__); -+ if (0 != slot) -+ return -EINVAL; -+ -+ dvbsky_ci_read_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &buf, 1); -+ buf |= 0x60; -+ -+ ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &buf, 1); -+ return ret; -+} -+ -+static int dvbsky_ci_poll_slot_status(struct dvb_ca_en50221 *ci, int slot, -+ int open) -+{ -+ struct dvb_usb_device *d = ci->data; -+ struct dvbsky_state *state = d_to_priv(d); -+ int ret = 0; -+ u8 buf = 0; -+ /*dprintk("%s()\n", __func__);*/ -+ -+ /* CAM module INSERT/REMOVE processing. slow operation because of i2c -+ * transfers */ -+ if (time_after(jiffies, state->next_status_checked_time)) { -+ ret = dvbsky_ci_read_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &buf, 1); -+ -+ /*dprintk("%s() status=%x\n", __func__, buf);*/ -+ -+ state->next_status_checked_time = jiffies -+ + msecs_to_jiffies(1000); -+ -+ if (ret != 0) -+ return 0; -+ -+ if (buf & 1) { -+ state->ci_status = DVB_CA_EN50221_POLL_CAM_PRESENT | -+ DVB_CA_EN50221_POLL_CAM_READY; -+ } -+ else -+ state->ci_status = 0; -+ } -+ /*dprintk("%s() ret=%x\n", __func__, state->ci_status);*/ -+ return state->ci_status; -+} -+ -+static int dvbsky_ci_init(struct dvb_usb_device *d) -+{ -+ struct dvbsky_state *state = d_to_priv(d); -+ int ret; -+ u8 cimax_init[34] = { -+ 0x00, /* module A control*/ -+ 0x00, /* auto select mask high A */ -+ 0x00, /* auto select mask low A */ -+ 0x00, /* auto select pattern high A */ -+ 0x00, /* auto select pattern low A */ -+ 0x44, /* memory access time A */ -+ 0x00, /* invert input A */ -+ 0x00, /* RFU */ -+ 0x00, /* RFU */ -+ 0x00, /* module B control*/ -+ 0x00, /* auto select mask high B */ -+ 0x00, /* auto select mask low B */ -+ 0x00, /* auto select pattern high B */ -+ 0x00, /* auto select pattern low B */ -+ 0x44, /* memory access time B */ -+ 0x00, /* invert input B */ -+ 0x00, /* RFU */ -+ 0x00, /* RFU */ -+ 0x00, /* auto select mask high Ext */ -+ 0x00, /* auto select mask low Ext */ -+ 0x00, /* auto select pattern high Ext */ -+ 0x00, /* auto select pattern low Ext */ -+ 0x00, /* RFU */ -+ 0x02, /* destination - module A */ -+ 0x01, /* power on (use it like store place) */ -+ 0x00, /* RFU */ -+ 0x00, /* int status read only */ -+ 0x00, /* Max: Disable the interrupt in USB solution.*/ -+ 0x05, /* EXTINT=active-high, INT=push-pull */ -+ 0x00, /* USCG1 */ -+ 0x04, /* ack active low */ -+ 0x00, /* LOCK = 0 */ -+ 0x22, /* serial mode, rising in, rising out, MSB first*/ -+ 0x00 /* synchronization */ -+ }; -+ dprintk("%s()\n", __func__); -+ state->current_ci_flag = 0xff; -+ state->ci_status = 0; -+ state->next_status_checked_time = jiffies + msecs_to_jiffies(1000); -+ state->ci_i2c_addr = 0x40; -+ -+ state->ci.owner = THIS_MODULE; -+ state->ci.read_attribute_mem = dvbsky_ci_read_attribute_mem; -+ state->ci.write_attribute_mem = dvbsky_ci_write_attribute_mem; -+ state->ci.read_cam_control = dvbsky_ci_read_cam_ctl; -+ state->ci.write_cam_control = dvbsky_ci_write_cam_ctl; -+ state->ci.slot_reset = dvbsky_ci_slot_reset; -+ state->ci.slot_shutdown = dvbsky_ci_slot_shutdown; -+ state->ci.slot_ts_enable = dvbsky_ci_slot_ts_enable; -+ state->ci.poll_slot_status = dvbsky_ci_poll_slot_status; -+ state->ci.data = d; -+ -+ ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0, &cimax_init[0], 34); -+ /* lock registers */ -+ ret |= dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0x1f, &cimax_init[0x18], 1); -+ /* power on slots */ -+ ret |= dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -+ 0x18, &cimax_init[0x18], 1); -+ if (0 != ret) -+ return ret; -+ -+ ret = dvb_ca_en50221_init(&d->adapter[0].dvb_adap, &state->ci, 0, 1); -+ if (ret) -+ return ret; -+ state->ci_attached = 1; -+ dprintk("%s() complete.\n", __func__); -+ return 0; -+} -+ -+static void dvbsky_ci_release(struct dvb_usb_device *d) -+{ -+ struct dvbsky_state *state = d_to_priv(d); -+ -+ /* detach CI */ -+ if (state->ci_attached) -+ dvb_ca_en50221_release(&state->ci); -+ -+ return; -+} -+ -+static int dvbsky_streaming_ctrl(struct dvb_frontend *fe, int onoff) -+{ -+ struct dvb_usb_device *d = fe_to_d(fe); -+ /*dprintk("%s() %d\n", __func__, onoff);*/ -+ return dvbsky_stream_ctrl(d, (onoff == 0) ? 0 : 1); -+} -+ -+/* GPIO */ -+static int dvbsky_gpio_ctrl(struct dvb_usb_device *d, u8 gport, u8 value) -+{ -+ u8 obuf[64], ibuf[64]; -+ obuf[0] = 0x0e; -+ obuf[1] = gport; -+ obuf[2] = value; -+ return dvb_usbv2_generic_rw(d, obuf, 3, ibuf, 1); -+} -+ -+/* I2C */ -+static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], -+ int num) -+{ -+ struct dvb_usb_device *d = i2c_get_adapdata(adap); -+ int ret = 0; -+ u8 ibuf[64], obuf[64]; -+ -+ if (mutex_lock_interruptible(&d->i2c_mutex) < 0) -+ return -EAGAIN; -+ -+ if (num > 2) { -+ printk(KERN_ERR "dvbsky_usb: too many i2c messages[%d] than 2.", num); -+ ret = -EOPNOTSUPP; -+ goto i2c_error; -+ } -+ -+ if(num == 1) { -+ if (msg[0].len > 60) { -+ printk(KERN_ERR "dvbsky_usb: too many i2c bytes[%d] than 60.", msg[0].len); -+ ret = -EOPNOTSUPP; -+ goto i2c_error; -+ } -+ if (msg[0].flags & I2C_M_RD) { -+ /* single read */ -+ obuf[0] = 0x09; -+ obuf[1] = 0; -+ obuf[2] = msg[0].len; -+ obuf[3] = msg[0].addr; -+ ret = dvb_usbv2_generic_rw(d, obuf, 4, ibuf, msg[0].len + 1); -+ /*dprintk("%s(): read status = %d\n", __func__, ibuf[0]);*/ -+ if (!ret) -+ memcpy(msg[0].buf, &ibuf[1], msg[0].len); -+ } else { -+ /* write */ -+ obuf[0] = 0x08; -+ obuf[1] = msg[0].addr; -+ obuf[2] = msg[0].len; -+ memcpy(&obuf[3], msg[0].buf, msg[0].len); -+ ret = dvb_usbv2_generic_rw(d, obuf, msg[0].len + 3, ibuf, 1); -+ /*dprintk("%s(): write status = %d\n", __func__, ibuf[0]);*/ -+ } -+ } else { -+ if ((msg[0].len > 60) || (msg[1].len > 60)) { -+ printk(KERN_ERR "dvbsky_usb: too many i2c bytes[w-%d][r-%d] than 60.", msg[0].len, msg[1].len); -+ ret = -EOPNOTSUPP; -+ goto i2c_error; -+ } -+ /* write then read */ -+ obuf[0] = 0x09; -+ obuf[1] = msg[0].len; -+ obuf[2] = msg[1].len; -+ obuf[3] = msg[0].addr; -+ memcpy(&obuf[4], msg[0].buf, msg[0].len); -+ ret = dvb_usbv2_generic_rw(d, obuf, msg[0].len + 4, ibuf, msg[1].len + 1); -+ /*dprintk("%s(): write then read status = %d\n", __func__, ibuf[0]);*/ -+ if (!ret) -+ memcpy(msg[1].buf, &ibuf[1], msg[1].len); -+ } -+i2c_error: -+ mutex_unlock(&d->i2c_mutex); -+ return (ret) ? ret : num; -+} -+ -+static u32 dvbsky_i2c_func(struct i2c_adapter *adapter) -+{ -+ return I2C_FUNC_I2C; -+} -+ -+static struct i2c_algorithm dvbsky_i2c_algo = { -+ .master_xfer = dvbsky_i2c_xfer, -+ .functionality = dvbsky_i2c_func, -+}; -+ -+#if IS_ENABLED(CONFIG_RC_CORE) -+static int dvbsky_rc_query(struct dvb_usb_device *d) -+{ -+ u32 code = 0xffff; -+ u8 obuf[2], ibuf[2], toggle; -+ int ret; -+ obuf[0] = 0x10; -+ ret = dvb_usbv2_generic_rw(d, obuf, 1, ibuf, 2); -+ if(ret == 0) -+ code = (ibuf[0] << 8) | ibuf[1]; -+ -+ if (code != 0xffff) { -+ dprintk("rc code: %x", code); -+ toggle = (code & 0x800) ? 1 : 0; -+ code &= 0x3f; -+ rc_keydown(d->rc_dev, code, toggle); -+ } -+ return 0; -+} -+ -+static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) -+{ -+ rc->allowed_protos = RC_BIT_RC5; -+ rc->query = dvbsky_rc_query; -+ rc->interval = 300; -+ return 0; -+} -+#else -+ #define dvbsky_get_rc_config NULL -+#endif -+ -+static int dvbsky_sync_ctrl(struct dvb_frontend *fe) -+{ -+ struct dvb_usb_device *d = fe_to_d(fe); -+ return dvbsky_stream_ctrl(d, 1); -+} -+ -+static int dvbsky_usb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -+{ -+ struct dvb_usb_device *d = fe_to_d(fe); -+ u8 value; -+ -+ if (voltage == SEC_VOLTAGE_OFF) -+ value = 0; -+ else -+ value = 1; -+ return dvbsky_gpio_ctrl(d, 0x80, value); -+} -+ -+static int dvbsky_usb_ci_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -+{ -+ struct dvb_usb_device *d = fe_to_d(fe); -+ u8 value; -+ -+ if (voltage == SEC_VOLTAGE_OFF) -+ value = 0; -+ else -+ value = 1; -+ return dvbsky_gpio_ctrl(d, 0x00, value); -+} -+ -+static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6]) -+{ -+ struct dvb_usb_device *d = adap_to_d(adap); -+ u8 obuf[] = { 0x1e, 0x00 }; -+ u8 ibuf[6] = { 0 }; -+ struct i2c_msg msg[] = { -+ { -+ .addr = 0x51, -+ .flags = 0, -+ .buf = obuf, -+ .len = 2, -+ }, { -+ .addr = 0x51, -+ .flags = I2C_M_RD, -+ .buf = ibuf, -+ .len = 6, -+ -+ } -+ }; -+ -+ if (i2c_transfer(&d->i2c_adap, msg, 2) == 2) -+ memcpy(mac, ibuf, 6); -+ -+ printk(KERN_INFO "dvbsky_usb MAC address=%pM\n", mac); -+ -+ return 0; -+} -+ -+static struct dvbsky_m88ds3103_config dvbsky_usb_ds3103_config = { -+ .demod_address = 0x68, -+ .ci_mode = 1, -+ .pin_ctrl = 0x83, -+ .ts_mode = 0, -+ .start_ctrl = dvbsky_sync_ctrl, -+ .set_voltage = dvbsky_usb_set_voltage, -+}; -+ -+static int dvbsky_s960_attach(struct dvb_usb_adapter *adap) -+{ -+ struct dvbsky_state *state = adap_to_priv(adap); -+ struct dvb_usb_device *d = adap_to_d(adap); -+ int ret = 0; -+ -+ dprintk("%s()\n", __func__); -+ -+ dvbsky_gpio_ctrl(d, 0x04, 1); -+ -+ dvbsky_gpio_ctrl(d, 0x83, 0); -+ msleep(50); -+ dvbsky_gpio_ctrl(d, 0x83, 1); -+ msleep(20); -+ -+ adap->fe[0] = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_usb_ds3103_config, -+ &d->i2c_adap); -+ if (!adap->fe[0]) { -+ printk(KERN_ERR "dvbsky_s960_attach fail."); -+ ret = -ENODEV; -+ } -+ -+ state->has_ci = 0; -+ -+ return ret; -+} -+ -+static struct dvbsky_m88ds3103_config dvbsky_usb_ds3103_ci_config = { -+ .demod_address = 0x68, -+ .ci_mode = 2, -+ .pin_ctrl = 0x82, -+ .ts_mode = 0, -+ .start_ctrl = dvbsky_sync_ctrl, -+ .set_voltage = dvbsky_usb_ci_set_voltage, -+}; -+ -+static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) -+{ -+ struct dvbsky_state *state = adap_to_priv(adap); -+ struct dvb_usb_device *d = adap_to_d(adap); -+ int ret = 0; -+ -+ dvbsky_gpio_ctrl(d, 0x04, 1); -+ -+ dvbsky_gpio_ctrl(d, 0x83, 0); -+ msleep(50); -+ dvbsky_gpio_ctrl(d, 0x83, 1); -+ msleep(20); -+ -+ adap->fe[0] = dvb_attach(dvbsky_m88ds3103_attach, -+ &dvbsky_usb_ds3103_ci_config, -+ &d->i2c_adap); -+ if (!adap->fe[0]) { -+ printk(KERN_ERR "dvbsky_s960c_attach fail."); -+ ret = -ENODEV; -+ } -+ -+ state->has_ci = 1; -+ -+ return ret; -+} -+ -+static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) -+{ -+ return WARM; -+} -+ -+static int dvbsky_init(struct dvb_usb_device *d) -+{ -+ struct dvbsky_state *state = d_to_priv(d); -+ int ret; -+ -+ /* use default interface */ -+ ret = usb_set_interface(d->udev, 0, 0); -+ if (ret) -+ return ret; -+ -+ mutex_init(&state->stream_mutex); -+ -+ /* attach CI */ -+ if (state->has_ci) { -+ dvbsky_gpio_ctrl(d, 0xc0, 1); -+ msleep(100); -+ dvbsky_gpio_ctrl(d, 0xc0, 0); -+ msleep(50); -+ state->ci_attached = 0; -+ ret = dvbsky_ci_init(d); -+ if (ret) -+ return ret; -+ } -+ return 0; -+} -+ -+static void dvbsky_exit(struct dvb_usb_device *d) -+{ -+ return dvbsky_ci_release(d); -+} -+ -+/* DVB USB Driver stuff */ -+static struct dvb_usb_device_properties dvbsky_s960c_props = { -+ .driver_name = KBUILD_MODNAME, -+ .owner = THIS_MODULE, -+ .adapter_nr = adapter_nr, -+ .size_of_priv = sizeof(struct dvbsky_state), -+ -+ .generic_bulk_ctrl_endpoint = 0x01, -+ .generic_bulk_ctrl_endpoint_response = 0x81, -+ -+ .i2c_algo = &dvbsky_i2c_algo, -+ .frontend_attach = dvbsky_s960c_attach, -+ .init = dvbsky_init, -+ .get_rc_config = dvbsky_get_rc_config, -+ .streaming_ctrl = dvbsky_streaming_ctrl, -+ .identify_state = dvbsky_identify_state, -+ .exit = dvbsky_exit, -+ -+ .num_adapters = 1, -+ .adapter = { -+ { -+ .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), -+ } -+ } -+}; -+ -+static struct dvb_usb_device_properties dvbsky_s960_props = { -+ .driver_name = KBUILD_MODNAME, -+ .owner = THIS_MODULE, -+ .adapter_nr = adapter_nr, -+ .size_of_priv = sizeof(struct dvbsky_state), -+ -+ .generic_bulk_ctrl_endpoint = 0x01, -+ .generic_bulk_ctrl_endpoint_response = 0x81, -+ -+ .i2c_algo = &dvbsky_i2c_algo, -+ .frontend_attach = dvbsky_s960_attach, -+ .init = dvbsky_init, -+ .get_rc_config = dvbsky_get_rc_config, -+ .streaming_ctrl = dvbsky_streaming_ctrl, -+ .identify_state = dvbsky_identify_state, -+ .exit = dvbsky_exit, -+ .read_mac_address = dvbsky_read_mac_addr, -+ -+ .num_adapters = 1, -+ .adapter = { -+ { -+ .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), -+ } -+ } -+}; -+ -+static const struct usb_device_id dvbsky_id_table[] = { -+ { DVB_USB_DEVICE(0x0572, 0x960c, -+ &dvbsky_s960c_props, "DVBSky S960CI", RC_MAP_DVBSKY) }, -+ { DVB_USB_DEVICE(0x0572, 0x6831, -+ &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, -+ { } -+}; -+MODULE_DEVICE_TABLE(usb, dvbsky_id_table); -+ -+static struct usb_driver dvbsky_usb_driver = { -+ .name = KBUILD_MODNAME, -+ .id_table = dvbsky_id_table, -+ .probe = dvb_usbv2_probe, -+ .disconnect = dvb_usbv2_disconnect, -+ .suspend = dvb_usbv2_suspend, -+ .resume = dvb_usbv2_resume, -+ .reset_resume = dvb_usbv2_reset_resume, -+ .no_dynamic_id = 1, -+ .soft_unbind = 1, -+}; -+ -+module_usb_driver(dvbsky_usb_driver); -+ -+MODULE_AUTHOR("Max nibble "); -+MODULE_DESCRIPTION("Driver for DVBSky USB2.0"); -+MODULE_LICENSE("GPL"); -diff --git a/include/media/rc-map.h b/include/media/rc-map.h -index a20ed97..73f8c92 100644 ---- a/include/media/rc-map.h -+++ b/include/media/rc-map.h -@@ -119,6 +119,7 @@ void rc_map_init(void); - #define RC_MAP_DM1105_NEC "rc-dm1105-nec" - #define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" - #define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" -+#define RC_MAP_DVBSKY "rc-dvbsky" - #define RC_MAP_EMPTY "rc-empty" - #define RC_MAP_EM_TERRATEC "rc-em-terratec" - #define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2" diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-212-mantis_stb0899_faster_lock.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-212-mantis_stb0899_faster_lock.patch deleted file mode 100644 index eef4e1effc..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-212-mantis_stb0899_faster_lock.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_algo.c linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_algo.c ---- linux-3.7.2/drivers/media/dvb-frontends/stb0899_algo.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_algo.c 2013-01-16 10:28:33.633409961 +0100 -@@ -206,7 +206,6 @@ - static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) - { - struct stb0899_internal *internal = &state->internal; -- struct stb0899_params *params = &state->params; - - short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; -@@ -216,10 +215,9 @@ - - /* timing loop computation & symbol rate optimisation */ - derot_limit = (internal->sub_range / 2L) / internal->mclk; -- derot_step = (params->srate / 2L) / internal->mclk; -+ derot_step = internal->derot_step * 4; /* dertot_step = decreasing delta */ - - while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { -- index++; - derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ - - if (abs(derot_freq) > derot_limit) -@@ -230,6 +228,7 @@ - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - } -+ index++; - internal->direction = -internal->direction; /* Change zigzag direction */ - } - -@@ -278,14 +277,18 @@ - { - struct stb0899_internal *internal = &state->internal; - -- short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; -+ short int derot_freq = 0, last_derot_freq = 0, derot_limit, derot_step, next_loop = 3; - int index = 0; -+ int base_freq; - u8 cfr[2]; - u8 reg; - - internal->status = NOCARRIER; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_freq = internal->derot_freq; -+ derot_step = internal->derot_step * 2; -+ last_derot_freq = internal->derot_freq; -+ base_freq = internal->derot_freq; - - reg = stb0899_read_reg(state, STB0899_CFD); - STB0899_SETFIELD_VAL(CFD_ON, reg, 1); -@@ -294,11 +297,10 @@ - do { - dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); - if (stb0899_check_carrier(state) == NOCARRIER) { -- index++; - last_derot_freq = derot_freq; -- derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ -+ derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ - -- if(abs(derot_freq) > derot_limit) -+ if (derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit) - next_loop--; - - if (next_loop) { -@@ -310,9 +312,10 @@ - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - } -+ index++; -+ internal->direction = -internal->direction; /* Change zigzag direction */ - } - -- internal->direction = -internal->direction; /* Change zigzag direction */ - } while ((internal->status != CARRIEROK) && next_loop); - - if (internal->status == CARRIEROK) { -@@ -338,6 +341,7 @@ - int lock = 0, index = 0, dataTime = 500, loop; - u8 reg; - -+ msleep(1); - internal->status = NODATA; - - /* RESET FEC */ -@@ -348,6 +352,7 @@ - reg = stb0899_read_reg(state, STB0899_TSTRES); - STB0899_SETFIELD_VAL(FRESACS, reg, 0); - stb0899_write_reg(state, STB0899_TSTRES, reg); -+ msleep(1); - - if (params->srate <= 2000000) - dataTime = 2000; -@@ -363,6 +368,7 @@ - - stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop */ - while (1) { -+ msleep(1); // Alex: added 1 mSec - /* WARNING! VIT LOCKED has to be tested before VIT_END_LOOOP */ - reg = stb0899_read_reg(state, STB0899_VSTATUS); - lock = STB0899_GETFIELD(VSTATUS_LOCKEDVIT, reg); -@@ -390,20 +396,21 @@ - short int derot_freq, derot_step, derot_limit, next_loop = 3; - u8 cfr[2]; - u8 reg; -- int index = 1; -+ int index = 0; -+ int base_freq; - - struct stb0899_internal *internal = &state->internal; -- struct stb0899_params *params = &state->params; - -- derot_step = (params->srate / 4L) / internal->mclk; -+ derot_step = internal->derot_step; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_freq = internal->derot_freq; -+ base_freq = internal->derot_freq; - - do { - if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { - - derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ -- if (abs(derot_freq) > derot_limit) -+ if (derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit) - next_loop--; - - if (next_loop) { -@@ -417,9 +424,9 @@ - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - - stb0899_check_carrier(state); -- index++; - } - } -+ index++; - internal->direction = -internal->direction; /* change zig zag direction */ - } while ((internal->status != DATAOK) && next_loop); - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-222-stb0899_signal_quality.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-222-stb0899_signal_quality.patch deleted file mode 100644 index fd6539d2bf..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-222-stb0899_signal_quality.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c ---- linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-16 10:33:10.323380937 +0100 -@@ -971,6 +971,16 @@ - - *strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val); - *strength += 750; -+ -+ const int MIN_STRENGTH_DVBS = 0; -+ const int MAX_STRENGTH_DVBS = 680; -+ if (*strength < MIN_STRENGTH_DVBS) -+ *strength = 0; -+ else if(*strength > MAX_STRENGTH_DVBS) -+ *strength = 0xFFFF; -+ else -+ *strength = (*strength - MIN_STRENGTH_DVBS) * 0xFFFF / (MAX_STRENGTH_DVBS - MIN_STRENGTH_DVBS); -+ - dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm", - val & 0xff, *strength); - } -@@ -983,6 +993,7 @@ - - *strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val); - *strength += 950; -+ *strength = *strength << 4; - dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm", - val & 0x3fff, *strength); - } -@@ -1016,6 +1027,16 @@ - val = MAKEWORD16(buf[0], buf[1]); - - *snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val); -+ -+ const int MIN_SNR_DVBS = 0; -+ const int MAX_SNR_DVBS = 200; -+ if (*snr < MIN_SNR_DVBS) -+ *snr = 0; -+ else if(*snr > MAX_SNR_DVBS) -+ *snr = 0xFFFF; -+ else -+ *snr = (*snr - MIN_SNR_DVBS) * 0xFFFF / (MAX_SNR_DVBS - MIN_SNR_DVBS); -+ - dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n", - buf[0], buf[1], val, *snr); - } -@@ -1040,6 +1061,16 @@ - val = (quantn - estn) / 10; - } - *snr = val; -+ -+ const int MIN_SNR_DVBS2 = 10; -+ const int MAX_SNR_DVBS2 = 70; -+ if (*snr < MIN_SNR_DVBS2) -+ *snr = 0; -+ else if(*snr > MAX_SNR_DVBS2) -+ *snr = 0xFFFF; -+ else -+ *snr = (*snr - MIN_SNR_DVBS2) * 0xFFFF / (MAX_SNR_DVBS2 - MIN_SNR_DVBS2); -+ - dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm", - quant, quantn, est, estn, val); - } diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch deleted file mode 100644 index 7aaabc48c0..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -Naur linux-3.7.9/drivers/media/usb/dvb-usb/pctv452e.c linux-3.7.9.patch/drivers/media/usb/dvb-usb/pctv452e.c ---- linux-3.7.9/drivers/media/usb/dvb-usb/pctv452e.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.9.patch/drivers/media/usb/dvb-usb/pctv452e.c 2013-01-16 10:35:01.131342123 +0100 -@@ -995,11 +995,11 @@ - /* parameter for the MPEG2-data transfer */ - .stream = { - .type = USB_ISOC, -- .count = 7, -+ .count = 4, - .endpoint = 0x02, - .u = { - .isoc = { -- .framesperurb = 4, -+ .framesperurb = 64, - .framesize = 940, - .interval = 1 - } diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-224-geniatech-t220-dvb-t2-fix.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-224-geniatech-t220-dvb-t2-fix.patch deleted file mode 100644 index 17488409ff..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-224-geniatech-t220-dvb-t2-fix.patch +++ /dev/null @@ -1,97 +0,0 @@ -diff --git a/drivers/media/dvb-frontends/cxd2820r.h b/drivers/media/dvb-frontends/cxd2820r.h -index 82b3d93..6095dbc 100644 ---- a/drivers/media/dvb-frontends/cxd2820r.h -+++ b/drivers/media/dvb-frontends/cxd2820r.h -@@ -52,6 +52,12 @@ struct cxd2820r_config { - */ - u8 ts_mode; - -+ /* TS clock inverted. -+ * Default: 0 -+ * Values: 0, 1 -+ */ -+ bool ts_clock_inv; -+ - /* IF AGC polarity. - * Default: 0 - * Values: 0, 1 -diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c -index 5c6ab49..0f4657e 100644 ---- a/drivers/media/dvb-frontends/cxd2820r_c.c -+++ b/drivers/media/dvb-frontends/cxd2820r_c.c -@@ -45,6 +45,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) - { 0x1008b, 0x07, 0xff }, - { 0x1001f, priv->cfg.if_agc_polarity << 7, 0x80 }, - { 0x10070, priv->cfg.ts_mode, 0xff }, -+ { 0x10071, !priv->cfg.ts_clock_inv << 4, 0x10 }, - }; - - dev_dbg(&priv->i2c->dev, "%s: frequency=%d symbol_rate=%d\n", __func__, -diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c -index fa184ca..9b5a45b 100644 ---- a/drivers/media/dvb-frontends/cxd2820r_t.c -+++ b/drivers/media/dvb-frontends/cxd2820r_t.c -@@ -46,6 +46,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) - { 0x00088, 0x01, 0xff }, - - { 0x00070, priv->cfg.ts_mode, 0xff }, -+ { 0x00071, !priv->cfg.ts_clock_inv << 4, 0x10 }, - { 0x000cb, priv->cfg.if_agc_polarity << 6, 0x40 }, - { 0x000a5, 0x00, 0x01 }, - { 0x00082, 0x20, 0x60 }, -diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c -index 2ba130e..9c0c4f4 100644 ---- a/drivers/media/dvb-frontends/cxd2820r_t2.c -+++ b/drivers/media/dvb-frontends/cxd2820r_t2.c -@@ -47,6 +47,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) - { 0x02083, 0x0a, 0xff }, - { 0x020cb, priv->cfg.if_agc_polarity << 6, 0x40 }, - { 0x02070, priv->cfg.ts_mode, 0xff }, -+ { 0x02071, !priv->cfg.ts_clock_inv << 6, 0x40 }, - { 0x020b5, priv->cfg.spec_inv << 4, 0x10 }, - { 0x02567, 0x07, 0x0f }, - { 0x02569, 0x03, 0x03 }, -diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c -index ae0f56a..7135a3e 100644 ---- a/drivers/media/usb/dvb-usb/dw2102.c -+++ b/drivers/media/usb/dvb-usb/dw2102.c -@@ -1109,6 +1109,7 @@ static struct ds3000_config su3000_ds3000_config = { - static struct cxd2820r_config cxd2820r_config = { - .i2c_address = 0x6c, /* (0xd8 >> 1) */ - .ts_mode = 0x38, -+ .ts_clock_inv = 1, - }; - - static struct tda18271_config tda18271_config = { -@@ -1387,20 +1388,27 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d) - - static int t220_frontend_attach(struct dvb_usb_adapter *d) - { -- u8 obuf[3] = { 0xe, 0x80, 0 }; -+ u8 obuf[3] = { 0xe, 0x87, 0 }; - u8 ibuf[] = { 0 }; - - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) - err("command 0x0e transfer failed."); - - obuf[0] = 0xe; -- obuf[1] = 0x83; -+ obuf[1] = 0x86; -+ obuf[2] = 1; -+ -+ if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) -+ err("command 0x0e transfer failed."); -+ -+ obuf[0] = 0xe; -+ obuf[1] = 0x80; - obuf[2] = 0; - - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) - err("command 0x0e transfer failed."); - -- msleep(100); -+ msleep(50); - - obuf[0] = 0xe; - obuf[1] = 0x80; - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-225-ct2-devices.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-225-ct2-devices.patch deleted file mode 100644 index 62729d84dd..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-225-ct2-devices.patch +++ /dev/null @@ -1,4334 +0,0 @@ -diff -urN a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h ---- a/drivers/media/dvb-core/dvb-usb-ids.h 2015-03-22 14:14:48.000000000 +0200 -+++ b/drivers/media/dvb-core/dvb-usb-ids.h 2015-03-22 14:17:59.566225151 +0200 -@@ -285,6 +285,8 @@ - #define USB_PID_REALTEK_RTL2832U 0x2832 - #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 - #define USB_PID_TECHNOTREND_CONNECT_S2_3650_CI 0x300a -+#define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI 0x3012 -+#define USB_PID_TECHNOTREND_TVSTICK_CT2_4400 0x3014 - #define USB_PID_NEBULA_DIGITV 0x0201 - #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 - #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 -diff -urN a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig ---- a/drivers/media/dvb-frontends/Kconfig 2015-03-22 14:16:43.000000000 +0200 -+++ b/drivers/media/dvb-frontends/Kconfig 2015-03-22 14:17:59.566225151 +0200 -@@ -768,6 +768,16 @@ - depends on DVB_CORE && I2C - default m if !MEDIA_SUBDRV_AUTOSELECT - -+config DVB_SI2168 -+ tristate "Afatech AF9033 DVB-T demodulator" -+ depends on DVB_CORE && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT -+ -+config DVB_SP2 -+ tristate "Afatech AF9033 DVB-T demodulator" -+ depends on DVB_CORE && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT -+ - comment "Tools to develop new frontends" - - config DVB_DUMMY_FE -diff -urN a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c ---- a/drivers/media/dvb-frontends/m88ds3103.c 2014-11-02 15:07:14.000000000 +0200 -+++ b/drivers/media/dvb-frontends/m88ds3103.c 2015-03-22 14:20:15.000000000 +0200 -@@ -1,5 +1,5 @@ - /* -- * Montage M88DS3103 demodulator driver -+ * Montage M88DS3103/M88RS6000 demodulator driver - * - * Copyright (C) 2013 Antti Palosaari - * -@@ -159,9 +159,10 @@ - { - int ret, i, j; - u8 buf[83]; -+ - dev_dbg(&priv->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len); - -- if (tab_len > 83) { -+ if (tab_len > 86) { - ret = -EINVAL; - goto err; - } -@@ -244,11 +245,12 @@ - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret, len; - const struct m88ds3103_reg_val *init; -- u8 u8tmp, u8tmp1, u8tmp2; -- u8 buf[2]; -- u16 u16tmp, divide_ratio; -- u32 tuner_frequency, target_mclk, ts_clk; -+ u8 u8tmp, u8tmp1 = 0, u8tmp2 = 0; /* silence compiler warning */ -+ u8 buf[3]; -+ u16 u16tmp, divide_ratio = 0; -+ u32 tuner_frequency, target_mclk; - s32 s32tmp; -+ - dev_dbg(&priv->i2c->dev, - "%s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", - __func__, c->delivery_system, -@@ -260,6 +262,22 @@ - goto err; - } - -+ /* reset */ -+ ret = m88ds3103_wr_reg(priv, 0x07, 0x80); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_wr_reg(priv, 0x07, 0x00); -+ if (ret) -+ goto err; -+ -+ /* Disable demod clock path */ -+ if (priv->chip_id == M88RS6000_CHIP_ID) { -+ ret = m88ds3103_wr_reg(priv, 0x06, 0xe0); -+ if (ret) -+ goto err; -+ } -+ - /* program tuner */ - if (fe->ops.tuner_ops.set_params) { - ret = fe->ops.tuner_ops.set_params(fe); -@@ -271,54 +289,53 @@ - ret = fe->ops.tuner_ops.get_frequency(fe, &tuner_frequency); - if (ret) - goto err; -+ } else { -+ /* -+ * Use nominal target frequency as tuner driver does not provide -+ * actual frequency used. Carrier offset calculation is not -+ * valid. -+ */ -+ tuner_frequency = c->frequency; - } - -- /* reset */ -- ret = m88ds3103_wr_reg(priv, 0x07, 0x80); -- if (ret) -- goto err; -- -- ret = m88ds3103_wr_reg(priv, 0x07, 0x00); -- if (ret) -- goto err; -- -- ret = m88ds3103_wr_reg(priv, 0xb2, 0x01); -- if (ret) -- goto err; -+ /* select M88RS6000 demod main mclk and ts mclk from tuner die. */ -+ if (priv->chip_id == M88RS6000_CHIP_ID) { -+ if (c->symbol_rate > 45010000) -+ priv->mclk_khz = 110250; -+ else -+ priv->mclk_khz = 96000; - -- ret = m88ds3103_wr_reg(priv, 0x00, 0x01); -- if (ret) -- goto err; -+ if (c->delivery_system == SYS_DVBS) -+ target_mclk = 96000; -+ else -+ target_mclk = 144000; - -- switch (c->delivery_system) { -- case SYS_DVBS: -- len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); -- init = m88ds3103_dvbs_init_reg_vals; -- target_mclk = 96000; -- break; -- case SYS_DVBS2: -- len = ARRAY_SIZE(m88ds3103_dvbs2_init_reg_vals); -- init = m88ds3103_dvbs2_init_reg_vals; -+ /* Enable demod clock path */ -+ ret = m88ds3103_wr_reg(priv, 0x06, 0x00); -+ if (ret) -+ goto err; -+ usleep_range(10000, 20000); -+ } else { -+ /* set M88DS3103 mclk and ts mclk. */ -+ priv->mclk_khz = 96000; - - switch (priv->cfg->ts_mode) { - case M88DS3103_TS_SERIAL: - case M88DS3103_TS_SERIAL_D7: -- if (c->symbol_rate < 18000000) -- target_mclk = 96000; -- else -- target_mclk = 144000; -+ target_mclk = priv->cfg->ts_clk; - break; - case M88DS3103_TS_PARALLEL: -- case M88DS3103_TS_PARALLEL_12: -- case M88DS3103_TS_PARALLEL_16: -- case M88DS3103_TS_PARALLEL_19_2: - case M88DS3103_TS_CI: -- if (c->symbol_rate < 18000000) -+ if (c->delivery_system == SYS_DVBS) - target_mclk = 96000; -- else if (c->symbol_rate < 28000000) -- target_mclk = 144000; -- else -- target_mclk = 192000; -+ else { -+ if (c->symbol_rate < 18000000) -+ target_mclk = 96000; -+ else if (c->symbol_rate < 28000000) -+ target_mclk = 144000; -+ else -+ target_mclk = 192000; -+ } - break; - default: - dev_dbg(&priv->i2c->dev, "%s: invalid ts_mode\n", -@@ -326,6 +343,55 @@ - ret = -EINVAL; - goto err; - } -+ -+ switch (target_mclk) { -+ case 96000: -+ u8tmp1 = 0x02; /* 0b10 */ -+ u8tmp2 = 0x01; /* 0b01 */ -+ break; -+ case 144000: -+ u8tmp1 = 0x00; /* 0b00 */ -+ u8tmp2 = 0x01; /* 0b01 */ -+ break; -+ case 192000: -+ u8tmp1 = 0x03; /* 0b11 */ -+ u8tmp2 = 0x00; /* 0b00 */ -+ break; -+ } -+ ret = m88ds3103_wr_reg_mask(priv, 0x22, u8tmp1 << 6, 0xc0); -+ if (ret) -+ goto err; -+ ret = m88ds3103_wr_reg_mask(priv, 0x24, u8tmp2 << 6, 0xc0); -+ if (ret) -+ goto err; -+ } -+ -+ ret = m88ds3103_wr_reg(priv, 0xb2, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_wr_reg(priv, 0x00, 0x01); -+ if (ret) -+ goto err; -+ -+ switch (c->delivery_system) { -+ case SYS_DVBS: -+ if (priv->chip_id == M88RS6000_CHIP_ID) { -+ len = ARRAY_SIZE(m88rs6000_dvbs_init_reg_vals); -+ init = m88rs6000_dvbs_init_reg_vals; -+ } else { -+ len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals); -+ init = m88ds3103_dvbs_init_reg_vals; -+ } -+ break; -+ case SYS_DVBS2: -+ if (priv->chip_id == M88RS6000_CHIP_ID) { -+ len = ARRAY_SIZE(m88rs6000_dvbs2_init_reg_vals); -+ init = m88rs6000_dvbs2_init_reg_vals; -+ } else { -+ len = ARRAY_SIZE(m88ds3103_dvbs2_init_reg_vals); -+ init = m88ds3103_dvbs2_init_reg_vals; -+ } - break; - default: - dev_dbg(&priv->i2c->dev, "%s: invalid delivery_system\n", -@@ -341,37 +407,44 @@ - goto err; - } - -- u8tmp1 = 0; /* silence compiler warning */ -+ if (priv->chip_id == M88RS6000_CHIP_ID) { -+ if ((c->delivery_system == SYS_DVBS2) -+ && ((c->symbol_rate / 1000) <= 5000)) { -+ ret = m88ds3103_wr_reg(priv, 0xc0, 0x04); -+ if (ret) -+ goto err; -+ buf[0] = 0x09; -+ buf[1] = 0x22; -+ buf[2] = 0x88; -+ ret = m88ds3103_wr_regs(priv, 0x8a, buf, 3); -+ if (ret) -+ goto err; -+ } -+ ret = m88ds3103_wr_reg_mask(priv, 0x9d, 0x08, 0x08); -+ if (ret) -+ goto err; -+ ret = m88ds3103_wr_reg(priv, 0xf1, 0x01); -+ if (ret) -+ goto err; -+ ret = m88ds3103_wr_reg_mask(priv, 0x30, 0x80, 0x80); -+ if (ret) -+ goto err; -+ } -+ - switch (priv->cfg->ts_mode) { - case M88DS3103_TS_SERIAL: - u8tmp1 = 0x00; -- ts_clk = 0; -- u8tmp = 0x46; -+ u8tmp = 0x06; - break; - case M88DS3103_TS_SERIAL_D7: - u8tmp1 = 0x20; -- ts_clk = 0; -- u8tmp = 0x46; -+ u8tmp = 0x06; - break; - case M88DS3103_TS_PARALLEL: -- ts_clk = 24000; -- u8tmp = 0x42; -- break; -- case M88DS3103_TS_PARALLEL_12: -- ts_clk = 12000; -- u8tmp = 0x42; -- break; -- case M88DS3103_TS_PARALLEL_16: -- ts_clk = 16000; -- u8tmp = 0x42; -- break; -- case M88DS3103_TS_PARALLEL_19_2: -- ts_clk = 19200; -- u8tmp = 0x42; -+ u8tmp = 0x02; - break; - case M88DS3103_TS_CI: -- ts_clk = 6000; -- u8tmp = 0x43; -+ u8tmp = 0x03; - break; - default: - dev_dbg(&priv->i2c->dev, "%s: invalid ts_mode\n", __func__); -@@ -379,6 +452,9 @@ - goto err; - } - -+ if (priv->cfg->ts_clk_pol) -+ u8tmp |= 0x40; -+ - /* TS mode */ - ret = m88ds3103_wr_reg(priv, 0xfd, u8tmp); - if (ret) -@@ -390,21 +466,20 @@ - ret = m88ds3103_wr_reg_mask(priv, 0x29, u8tmp1, 0x20); - if (ret) - goto err; -- } -- -- if (ts_clk) { -- divide_ratio = DIV_ROUND_UP(target_mclk, ts_clk); -- u8tmp1 = divide_ratio / 2; -- u8tmp2 = DIV_ROUND_UP(divide_ratio, 2); -- } else { -- divide_ratio = 0; - u8tmp1 = 0; - u8tmp2 = 0; -+ break; -+ default: -+ if (priv->cfg->ts_clk) { -+ divide_ratio = DIV_ROUND_UP(target_mclk, priv->cfg->ts_clk); -+ u8tmp1 = divide_ratio / 2; -+ u8tmp2 = DIV_ROUND_UP(divide_ratio, 2); -+ } - } - - dev_dbg(&priv->i2c->dev, - "%s: target_mclk=%d ts_clk=%d divide_ratio=%d\n", -- __func__, target_mclk, ts_clk, divide_ratio); -+ __func__, target_mclk, priv->cfg->ts_clk, divide_ratio); - - u8tmp1--; - u8tmp2--; -@@ -427,41 +502,6 @@ - if (ret) - goto err; - -- switch (target_mclk) { -- case 72000: -- u8tmp1 = 0x00; /* 0b00 */ -- u8tmp2 = 0x03; /* 0b11 */ -- break; -- case 96000: -- u8tmp1 = 0x02; /* 0b10 */ -- u8tmp2 = 0x01; /* 0b01 */ -- break; -- case 115200: -- u8tmp1 = 0x01; /* 0b01 */ -- u8tmp2 = 0x01; /* 0b01 */ -- break; -- case 144000: -- u8tmp1 = 0x00; /* 0b00 */ -- u8tmp2 = 0x01; /* 0b01 */ -- break; -- case 192000: -- u8tmp1 = 0x03; /* 0b11 */ -- u8tmp2 = 0x00; /* 0b00 */ -- break; -- default: -- dev_dbg(&priv->i2c->dev, "%s: invalid target_mclk\n", __func__); -- ret = -EINVAL; -- goto err; -- } -- -- ret = m88ds3103_wr_reg_mask(priv, 0x22, u8tmp1 << 6, 0xc0); -- if (ret) -- goto err; -- -- ret = m88ds3103_wr_reg_mask(priv, 0x24, u8tmp2 << 6, 0xc0); -- if (ret) -- goto err; -- - if (c->symbol_rate <= 3000000) - u8tmp = 0x20; - else if (c->symbol_rate <= 10000000) -@@ -485,7 +525,7 @@ - if (ret) - goto err; - -- u16tmp = DIV_ROUND_CLOSEST((c->symbol_rate / 1000) << 15, M88DS3103_MCLK_KHZ / 2); -+ u16tmp = DIV_ROUND_CLOSEST((c->symbol_rate / 1000) << 15, priv->mclk_khz / 2); - buf[0] = (u16tmp >> 0) & 0xff; - buf[1] = (u16tmp >> 8) & 0xff; - ret = m88ds3103_wr_regs(priv, 0x61, buf, 2); -@@ -508,7 +548,7 @@ - (tuner_frequency - c->frequency)); - - s32tmp = 0x10000 * (tuner_frequency - c->frequency); -- s32tmp = DIV_ROUND_CLOSEST(s32tmp, M88DS3103_MCLK_KHZ); -+ s32tmp = DIV_ROUND_CLOSEST(s32tmp, priv->mclk_khz); - if (s32tmp < 0) - s32tmp += 0x10000; - -@@ -539,8 +579,9 @@ - struct m88ds3103_priv *priv = fe->demodulator_priv; - int ret, len, remaining; - const struct firmware *fw = NULL; -- u8 *fw_file = M88DS3103_FIRMWARE; -+ u8 *fw_file; - u8 u8tmp; -+ - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); - - /* set cold state by default */ -@@ -559,15 +600,6 @@ - if (ret) - goto err; - -- /* reset */ -- ret = m88ds3103_wr_reg(priv, 0x07, 0x60); -- if (ret) -- goto err; -- -- ret = m88ds3103_wr_reg(priv, 0x07, 0x00); -- if (ret) -- goto err; -- - /* firmware status */ - ret = m88ds3103_rd_reg(priv, 0xb9, &u8tmp); - if (ret) -@@ -578,10 +610,23 @@ - if (u8tmp) - goto skip_fw_download; - -+ /* global reset, global diseqc reset, golbal fec reset */ -+ ret = m88ds3103_wr_reg(priv, 0x07, 0xe0); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_wr_reg(priv, 0x07, 0x00); -+ if (ret) -+ goto err; -+ - /* cold state - try to download firmware */ - dev_info(&priv->i2c->dev, "%s: found a '%s' in cold state\n", - KBUILD_MODNAME, m88ds3103_ops.info.name); - -+ if (priv->chip_id == M88RS6000_CHIP_ID) -+ fw_file = M88RS6000_FIRMWARE; -+ else -+ fw_file = M88DS3103_FIRMWARE; - /* request the firmware, this will block and timeout */ - ret = request_firmware(&fw, fw_file, priv->i2c->dev.parent); - if (ret) { -@@ -595,7 +640,7 @@ - - ret = m88ds3103_wr_reg(priv, 0xb2, 0x01); - if (ret) -- goto err; -+ goto error_fw_release; - - for (remaining = fw->size; remaining > 0; - remaining -= (priv->cfg->i2c_wr_max - 1)) { -@@ -609,13 +654,13 @@ - dev_err(&priv->i2c->dev, - "%s: firmware download failed=%d\n", - KBUILD_MODNAME, ret); -- goto err; -+ goto error_fw_release; - } - } - - ret = m88ds3103_wr_reg(priv, 0xb2, 0x00); - if (ret) -- goto err; -+ goto error_fw_release; - - release_firmware(fw); - fw = NULL; -@@ -641,10 +686,10 @@ - priv->warm = true; - - return 0; --err: -- if (fw) -- release_firmware(fw); - -+error_fw_release: -+ release_firmware(fw); -+err: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; - } -@@ -653,12 +698,18 @@ - { - struct m88ds3103_priv *priv = fe->demodulator_priv; - int ret; -+ u8 u8tmp; -+ - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); - - priv->delivery_system = SYS_UNDEFINED; - - /* TS Hi-Z */ -- ret = m88ds3103_wr_reg_mask(priv, 0x27, 0x00, 0x01); -+ if (priv->chip_id == M88RS6000_CHIP_ID) -+ u8tmp = 0x29; -+ else -+ u8tmp = 0x27; -+ ret = m88ds3103_wr_reg_mask(priv, u8tmp, 0x00, 0x01); - if (ret) - goto err; - -@@ -687,6 +738,7 @@ - struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret; - u8 buf[3]; -+ - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); - - if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) { -@@ -711,9 +763,6 @@ - case 1: - c->inversion = INVERSION_ON; - break; -- default: -- dev_dbg(&priv->i2c->dev, "%s: invalid inversion\n", -- __func__); - } - - switch ((buf[1] >> 5) & 0x07) { -@@ -793,9 +842,6 @@ - case 1: - c->pilot = PILOT_ON; - break; -- default: -- dev_dbg(&priv->i2c->dev, "%s: invalid pilot\n", -- __func__); - } - - switch ((buf[0] >> 6) & 0x07) { -@@ -823,9 +869,6 @@ - case 1: - c->inversion = INVERSION_ON; - break; -- default: -- dev_dbg(&priv->i2c->dev, "%s: invalid inversion\n", -- __func__); - } - - switch ((buf[2] >> 0) & 0x03) { -@@ -855,7 +898,7 @@ - goto err; - - c->symbol_rate = 1ull * ((buf[1] << 8) | (buf[0] << 0)) * -- M88DS3103_MCLK_KHZ * 1000 / 0x10000; -+ priv->mclk_khz * 1000 / 0x10000; - - return 0; - err: -@@ -871,6 +914,7 @@ - u8 buf[3]; - u16 noise, signal; - u32 noise_tot, signal_tot; -+ - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); - /* reports SNR in resolution of 0.1 dB */ - -@@ -893,7 +937,7 @@ - /* SNR(X) dB = 10 * ln(X) / ln(10) dB */ - tmp = DIV_ROUND_CLOSEST(tmp, 8 * M88DS3103_SNR_ITERATIONS); - if (tmp) -- *snr = 100ul * intlog2(tmp) / intlog2(10); -+ *snr = div_u64((u64) 100 * intlog2(tmp), intlog2(10)); - else - *snr = 0; - break; -@@ -922,7 +966,7 @@ - /* SNR(X) dB = 10 * log10(X) dB */ - if (signal > noise) { - tmp = signal / noise; -- *snr = 100ul * intlog10(tmp) / (1 << 24); -+ *snr = div_u64((u64) 100 * intlog10(tmp), (1 << 24)); - } else { - *snr = 0; - } -@@ -940,6 +984,87 @@ - return ret; - } - -+static int m88ds3103_read_ber(struct dvb_frontend *fe, u32 *ber) -+{ -+ struct m88ds3103_priv *priv = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ int ret; -+ unsigned int utmp; -+ u8 buf[3], u8tmp; -+ -+ dev_dbg(&priv->i2c->dev, "%s:\n", __func__); -+ -+ switch (c->delivery_system) { -+ case SYS_DVBS: -+ ret = m88ds3103_wr_reg(priv, 0xf9, 0x04); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_rd_reg(priv, 0xf8, &u8tmp); -+ if (ret) -+ goto err; -+ -+ if (!(u8tmp & 0x10)) { -+ u8tmp |= 0x10; -+ -+ ret = m88ds3103_rd_regs(priv, 0xf6, buf, 2); -+ if (ret) -+ goto err; -+ -+ priv->ber = (buf[1] << 8) | (buf[0] << 0); -+ -+ /* restart counters */ -+ ret = m88ds3103_wr_reg(priv, 0xf8, u8tmp); -+ if (ret) -+ goto err; -+ } -+ break; -+ case SYS_DVBS2: -+ ret = m88ds3103_rd_regs(priv, 0xd5, buf, 3); -+ if (ret) -+ goto err; -+ -+ utmp = (buf[2] << 16) | (buf[1] << 8) | (buf[0] << 0); -+ -+ if (utmp > 3000) { -+ ret = m88ds3103_rd_regs(priv, 0xf7, buf, 2); -+ if (ret) -+ goto err; -+ -+ priv->ber = (buf[1] << 8) | (buf[0] << 0); -+ -+ /* restart counters */ -+ ret = m88ds3103_wr_reg(priv, 0xd1, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_wr_reg(priv, 0xf9, 0x01); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_wr_reg(priv, 0xf9, 0x00); -+ if (ret) -+ goto err; -+ -+ ret = m88ds3103_wr_reg(priv, 0xd1, 0x00); -+ if (ret) -+ goto err; -+ } -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s: invalid delivery_system\n", -+ __func__); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ *ber = priv->ber; -+ -+ return 0; -+err: -+ dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} - - static int m88ds3103_set_tone(struct dvb_frontend *fe, - fe_sec_tone_mode_t fe_sec_tone_mode) -@@ -947,6 +1072,7 @@ - struct m88ds3103_priv *priv = fe->demodulator_priv; - int ret; - u8 u8tmp, tone, reg_a1_mask; -+ - dev_dbg(&priv->i2c->dev, "%s: fe_sec_tone_mode=%d\n", __func__, - fe_sec_tone_mode); - -@@ -958,7 +1084,7 @@ - switch (fe_sec_tone_mode) { - case SEC_TONE_ON: - tone = 0; -- reg_a1_mask = 0x87; -+ reg_a1_mask = 0x47; - break; - case SEC_TONE_OFF: - tone = 1; -@@ -987,12 +1113,64 @@ - return ret; - } - -+static int m88ds3103_set_voltage(struct dvb_frontend *fe, -+ fe_sec_voltage_t fe_sec_voltage) -+{ -+ struct m88ds3103_priv *priv = fe->demodulator_priv; -+ int ret; -+ u8 u8tmp; -+ bool voltage_sel, voltage_dis; -+ -+ dev_dbg(&priv->i2c->dev, "%s: fe_sec_voltage=%d\n", __func__, -+ fe_sec_voltage); -+ -+ if (!priv->warm) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ switch (fe_sec_voltage) { -+ case SEC_VOLTAGE_18: -+ voltage_sel = true; -+ voltage_dis = false; -+ break; -+ case SEC_VOLTAGE_13: -+ voltage_sel = false; -+ voltage_dis = false; -+ break; -+ case SEC_VOLTAGE_OFF: -+ voltage_sel = false; -+ voltage_dis = true; -+ break; -+ default: -+ dev_dbg(&priv->i2c->dev, "%s: invalid fe_sec_voltage\n", -+ __func__); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ /* output pin polarity */ -+ voltage_sel ^= priv->cfg->lnb_hv_pol; -+ voltage_dis ^= priv->cfg->lnb_en_pol; -+ -+ u8tmp = voltage_dis << 1 | voltage_sel << 0; -+ ret = m88ds3103_wr_reg_mask(priv, 0xa2, u8tmp, 0x03); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); -+ return ret; -+} -+ - static int m88ds3103_diseqc_send_master_cmd(struct dvb_frontend *fe, - struct dvb_diseqc_master_cmd *diseqc_cmd) - { - struct m88ds3103_priv *priv = fe->demodulator_priv; - int ret, i; - u8 u8tmp; -+ - dev_dbg(&priv->i2c->dev, "%s: msg=%*ph\n", __func__, - diseqc_cmd->msg_len, diseqc_cmd->msg); - -@@ -1064,6 +1242,7 @@ - struct m88ds3103_priv *priv = fe->demodulator_priv; - int ret, i; - u8 u8tmp, burst; -+ - dev_dbg(&priv->i2c->dev, "%s: fe_sec_mini_cmd=%d\n", __func__, - fe_sec_mini_cmd); - -@@ -1136,6 +1315,7 @@ - static void m88ds3103_release(struct dvb_frontend *fe) - { - struct m88ds3103_priv *priv = fe->demodulator_priv; -+ - i2c_del_mux_adapter(priv->i2c_adapter); - kfree(priv); - } -@@ -1198,18 +1378,22 @@ - priv->i2c = i2c; - mutex_init(&priv->i2c_mutex); - -- ret = m88ds3103_rd_reg(priv, 0x01, &chip_id); -+ /* 0x00: chip id[6:0], 0x01: chip ver[7:0], 0x02: chip ver[15:8] */ -+ ret = m88ds3103_rd_reg(priv, 0x00, &chip_id); - if (ret) - goto err; - -- dev_dbg(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id); -+ chip_id >>= 1; -+ dev_info(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id); - - switch (chip_id) { -- case 0xd0: -+ case M88RS6000_CHIP_ID: -+ case M88DS3103_CHIP_ID: - break; - default: - goto err; - } -+ priv->chip_id = chip_id; - - switch (priv->cfg->clock_out) { - case M88DS3103_CLOCK_OUT_DISABLED: -@@ -1225,6 +1409,11 @@ - goto err; - } - -+ /* 0x29 register is defined differently for m88rs6000. */ -+ /* set internal tuner address to 0x21 */ -+ if (chip_id == M88RS6000_CHIP_ID) -+ u8tmp = 0x00; -+ - ret = m88ds3103_wr_reg(priv, 0x29, u8tmp); - if (ret) - goto err; -@@ -1252,6 +1441,9 @@ - - /* create dvb_frontend */ - memcpy(&priv->fe.ops, &m88ds3103_ops, sizeof(struct dvb_frontend_ops)); -+ if (priv->chip_id == M88RS6000_CHIP_ID) -+ strncpy(priv->fe.ops.info.name, -+ "Montage M88RS6000", sizeof(priv->fe.ops.info.name)); - priv->fe.demodulator_priv = priv; - - return &priv->fe; -@@ -1298,14 +1490,17 @@ - - .read_status = m88ds3103_read_status, - .read_snr = m88ds3103_read_snr, -+ .read_ber = m88ds3103_read_ber, - - .diseqc_send_master_cmd = m88ds3103_diseqc_send_master_cmd, - .diseqc_send_burst = m88ds3103_diseqc_send_burst, - - .set_tone = m88ds3103_set_tone, -+ .set_voltage = m88ds3103_set_voltage, - }; - - MODULE_AUTHOR("Antti Palosaari "); - MODULE_DESCRIPTION("Montage M88DS3103 DVB-S/S2 demodulator driver"); - MODULE_LICENSE("GPL"); - MODULE_FIRMWARE(M88DS3103_FIRMWARE); -+MODULE_FIRMWARE(M88RS6000_FIRMWARE); -diff -urN a/drivers/media/dvb-frontends/m88ds3103.h b/drivers/media/dvb-frontends/m88ds3103.h ---- a/drivers/media/dvb-frontends/m88ds3103.h 2014-11-02 15:07:14.000000000 +0200 -+++ b/drivers/media/dvb-frontends/m88ds3103.h 2015-03-22 14:22:03.000000000 +0200 -@@ -47,14 +47,23 @@ - */ - #define M88DS3103_TS_SERIAL 0 /* TS output pin D0, normal */ - #define M88DS3103_TS_SERIAL_D7 1 /* TS output pin D7 */ --#define M88DS3103_TS_PARALLEL 2 /* 24 MHz, normal */ --#define M88DS3103_TS_PARALLEL_12 3 /* 12 MHz */ --#define M88DS3103_TS_PARALLEL_16 4 /* 16 MHz */ --#define M88DS3103_TS_PARALLEL_19_2 5 /* 19.2 MHz */ --#define M88DS3103_TS_CI 6 /* 6 MHz */ -+#define M88DS3103_TS_PARALLEL 2 /* TS Parallel mode */ -+#define M88DS3103_TS_CI 3 /* TS CI Mode */ - u8 ts_mode; - - /* -+ * TS clk in KHz -+ * Default: 0. -+ */ -+ u32 ts_clk; -+ -+ /* -+ * TS clk polarity. -+ * Default: 0. 1-active at falling edge; 0-active at rising edge. -+ */ -+ u8 ts_clk_pol:1; -+ -+ /* - * spectrum inversion - * Default: 0 - */ -@@ -86,6 +95,22 @@ - * Default: none, must set - */ - u8 agc; -+ -+ /* -+ * LNB H/V pin polarity -+ * Default: 0. -+ * 1: pin high set to VOLTAGE_13, pin low to set VOLTAGE_18. -+ * 0: pin high set to VOLTAGE_18, pin low to set VOLTAGE_13. -+ */ -+ u8 lnb_hv_pol:1; -+ -+ /* -+ * LNB enable pin polarity -+ * Default: 0. -+ * 1: pin high to enable, pin low to disable. -+ * 0: pin high to disable, pin low to enable. -+ */ -+ u8 lnb_en_pol:1; - }; - - /* -diff -urN a/drivers/media/dvb-frontends/m88ds3103_priv.h b/drivers/media/dvb-frontends/m88ds3103_priv.h ---- a/drivers/media/dvb-frontends/m88ds3103_priv.h 2014-11-02 15:07:15.000000000 +0200 -+++ b/drivers/media/dvb-frontends/m88ds3103_priv.h 2015-03-22 14:23:04.000000000 +0200 -@@ -22,9 +22,13 @@ - #include "dvb_math.h" - #include - #include -+#include - - #define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw" -+#define M88RS6000_FIRMWARE "dvb-demod-m88rs6000.fw" - #define M88DS3103_MCLK_KHZ 96000 -+#define M88RS6000_CHIP_ID 0x74 -+#define M88DS3103_CHIP_ID 0x70 - - struct m88ds3103_priv { - struct i2c_adapter *i2c; -@@ -34,8 +38,13 @@ - struct dvb_frontend fe; - fe_delivery_system_t delivery_system; - fe_status_t fe_status; -+ u32 ber; - bool warm; /* FW running */ - struct i2c_adapter *i2c_adapter; -+ /* auto detect chip id to do different config */ -+ u8 chip_id; -+ /* main mclk is calculated for M88RS6000 dynamically */ -+ u32 mclk_khz; - }; - - struct m88ds3103_reg_val { -@@ -212,4 +221,178 @@ - {0xb8, 0x00}, - }; - -+static const struct m88ds3103_reg_val m88rs6000_dvbs_init_reg_vals[] = { -+ {0x23, 0x07}, -+ {0x08, 0x03}, -+ {0x0c, 0x02}, -+ {0x20, 0x00}, -+ {0x21, 0x54}, -+ {0x25, 0x82}, -+ {0x27, 0x31}, -+ {0x30, 0x08}, -+ {0x31, 0x40}, -+ {0x32, 0x32}, -+ {0x33, 0x35}, -+ {0x35, 0xff}, -+ {0x3a, 0x00}, -+ {0x37, 0x10}, -+ {0x38, 0x10}, -+ {0x39, 0x02}, -+ {0x42, 0x60}, -+ {0x4a, 0x80}, -+ {0x4b, 0x04}, -+ {0x4d, 0x91}, -+ {0x5d, 0xc8}, -+ {0x50, 0x36}, -+ {0x51, 0x36}, -+ {0x52, 0x36}, -+ {0x53, 0x36}, -+ {0x63, 0x0f}, -+ {0x64, 0x30}, -+ {0x65, 0x40}, -+ {0x68, 0x26}, -+ {0x69, 0x4c}, -+ {0x70, 0x20}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x40}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x60}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x80}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0xa0}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x1f}, -+ {0x76, 0x38}, -+ {0x77, 0xa6}, -+ {0x78, 0x0c}, -+ {0x79, 0x80}, -+ {0x7f, 0x14}, -+ {0x7c, 0x00}, -+ {0xae, 0x82}, -+ {0x80, 0x64}, -+ {0x81, 0x66}, -+ {0x82, 0x44}, -+ {0x85, 0x04}, -+ {0xcd, 0xf4}, -+ {0x90, 0x33}, -+ {0xa0, 0x44}, -+ {0xbe, 0x00}, -+ {0xc0, 0x08}, -+ {0xc3, 0x10}, -+ {0xc4, 0x08}, -+ {0xc5, 0xf0}, -+ {0xc6, 0xff}, -+ {0xc7, 0x00}, -+ {0xc8, 0x1a}, -+ {0xc9, 0x80}, -+ {0xe0, 0xf8}, -+ {0xe6, 0x8b}, -+ {0xd0, 0x40}, -+ {0xf8, 0x20}, -+ {0xfa, 0x0f}, -+ {0x00, 0x00}, -+ {0xbd, 0x01}, -+ {0xb8, 0x00}, -+ {0x29, 0x11}, -+}; -+ -+static const struct m88ds3103_reg_val m88rs6000_dvbs2_init_reg_vals[] = { -+ {0x23, 0x07}, -+ {0x08, 0x07}, -+ {0x0c, 0x02}, -+ {0x20, 0x00}, -+ {0x21, 0x54}, -+ {0x25, 0x82}, -+ {0x27, 0x31}, -+ {0x30, 0x08}, -+ {0x32, 0x32}, -+ {0x33, 0x35}, -+ {0x35, 0xff}, -+ {0x3a, 0x00}, -+ {0x37, 0x10}, -+ {0x38, 0x10}, -+ {0x39, 0x02}, -+ {0x42, 0x60}, -+ {0x4a, 0x80}, -+ {0x4b, 0x04}, -+ {0x4d, 0x91}, -+ {0x5d, 0xc8}, -+ {0x50, 0x36}, -+ {0x51, 0x36}, -+ {0x52, 0x36}, -+ {0x53, 0x36}, -+ {0x63, 0x0f}, -+ {0x64, 0x10}, -+ {0x65, 0x20}, -+ {0x68, 0x46}, -+ {0x69, 0xcd}, -+ {0x70, 0x20}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x40}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x60}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x80}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0xa0}, -+ {0x71, 0x70}, -+ {0x72, 0x04}, -+ {0x73, 0x00}, -+ {0x70, 0x1f}, -+ {0x76, 0x38}, -+ {0x77, 0xa6}, -+ {0x78, 0x0c}, -+ {0x79, 0x80}, -+ {0x7f, 0x14}, -+ {0x85, 0x08}, -+ {0xcd, 0xf4}, -+ {0x90, 0x33}, -+ {0x86, 0x00}, -+ {0x87, 0x0f}, -+ {0x89, 0x00}, -+ {0x8b, 0x44}, -+ {0x8c, 0x66}, -+ {0x9d, 0xc1}, -+ {0x8a, 0x10}, -+ {0xad, 0x40}, -+ {0xa0, 0x44}, -+ {0xbe, 0x00}, -+ {0xc0, 0x08}, -+ {0xc1, 0x10}, -+ {0xc2, 0x08}, -+ {0xc3, 0x10}, -+ {0xc4, 0x08}, -+ {0xc5, 0xf0}, -+ {0xc6, 0xff}, -+ {0xc7, 0x00}, -+ {0xc8, 0x1a}, -+ {0xc9, 0x80}, -+ {0xca, 0x23}, -+ {0xcb, 0x24}, -+ {0xcc, 0xf4}, -+ {0xce, 0x74}, -+ {0x00, 0x00}, -+ {0xbd, 0x01}, -+ {0xb8, 0x00}, -+ {0x29, 0x01}, -+}; - #endif -diff -urN a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile ---- a/drivers/media/dvb-frontends/Makefile 2015-03-22 14:16:43.000000000 +0200 -+++ b/drivers/media/dvb-frontends/Makefile 2015-03-22 14:17:59.566225151 +0200 -@@ -105,5 +105,7 @@ - obj-$(CONFIG_DVB_RTL2832) += rtl2832.o - obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o - obj-$(CONFIG_DVB_AF9033) += af9033.o -+obj-$(CONFIG_DVB_SP2) += sp2.o -+obj-$(CONFIG_DVB_SI2168) += si2168.o - obj-$(CONFIG_DVB_DVBSKY_M88DS3103) += dvbsky_m88ds3103.o - obj-$(CONFIG_DVB_DVBSKY_M88DC2800) += dvbsky_m88dc2800.o -diff -urN a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c ---- a/drivers/media/dvb-frontends/si2168.c 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/dvb-frontends/si2168.c 2015-03-22 14:17:59.570225151 +0200 -@@ -0,0 +1,756 @@ -+/* -+ * Silicon Labs Si2168 DVB-T/T2/C demodulator driver -+ * -+ * Copyright (C) 2014 Antti Palosaari -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include "si2168_priv.h" -+ -+static const struct dvb_frontend_ops si2168_ops; -+ -+/* execute firmware command */ -+static int si2168_cmd_execute(struct si2168 *s, struct si2168_cmd *cmd) -+{ -+ int ret; -+ unsigned long timeout; -+ -+ mutex_lock(&s->i2c_mutex); -+ -+ if (cmd->wlen) { -+ /* write cmd and args for firmware */ -+ ret = i2c_master_send(s->client, cmd->args, cmd->wlen); -+ if (ret < 0) { -+ goto err_mutex_unlock; -+ } else if (ret != cmd->wlen) { -+ ret = -EREMOTEIO; -+ goto err_mutex_unlock; -+ } -+ } -+ -+ if (cmd->rlen) { -+ /* wait cmd execution terminate */ -+ #define TIMEOUT 50 -+ timeout = jiffies + msecs_to_jiffies(TIMEOUT); -+ while (!time_after(jiffies, timeout)) { -+ ret = i2c_master_recv(s->client, cmd->args, cmd->rlen); -+ if (ret < 0) { -+ goto err_mutex_unlock; -+ } else if (ret != cmd->rlen) { -+ ret = -EREMOTEIO; -+ goto err_mutex_unlock; -+ } -+ -+ /* firmware ready? */ -+ if ((cmd->args[0] >> 7) & 0x01) -+ break; -+ } -+ -+ dev_dbg(&s->client->dev, "cmd execution took %d ms\n", -+ jiffies_to_msecs(jiffies) - -+ (jiffies_to_msecs(timeout) - TIMEOUT)); -+ -+ if (!((cmd->args[0] >> 7) & 0x01)) { -+ ret = -ETIMEDOUT; -+ goto err_mutex_unlock; -+ } -+ } -+ -+ ret = 0; -+ -+err_mutex_unlock: -+ mutex_unlock(&s->i2c_mutex); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2168_read_status(struct dvb_frontend *fe, fe_status_t *status) -+{ -+ struct si2168 *s = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ int ret; -+ struct si2168_cmd cmd; -+ -+ *status = 0; -+ -+ if (!s->active) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ switch (c->delivery_system) { -+ case SYS_DVBT: -+ memcpy(cmd.args, "\xa0\x01", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 13; -+ break; -+ case SYS_DVBC_ANNEX_A: -+ memcpy(cmd.args, "\x90\x01", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 9; -+ break; -+ case SYS_DVBT2: -+ memcpy(cmd.args, "\x50\x01", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 14; -+ break; -+ default: -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* -+ * Possible values seen, in order from strong signal to weak: -+ * 16 0001 0110 full lock -+ * 1e 0001 1110 partial lock -+ * 1a 0001 1010 partial lock -+ * 18 0001 1000 no lock -+ * -+ * [b3:b1] lock bits -+ * [b4] statistics ready? Set in a few secs after lock is gained. -+ */ -+ -+ switch ((cmd.args[2] >> 1) & 0x03) { -+ case 0x01: -+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; -+ break; -+ case 0x03: -+ *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | -+ FE_HAS_SYNC | FE_HAS_LOCK; -+ break; -+ } -+ -+ s->fe_status = *status; -+ -+ if (*status & FE_HAS_LOCK) { -+ c->cnr.len = 1; -+ c->cnr.stat[0].scale = FE_SCALE_DECIBEL; -+ c->cnr.stat[0].svalue = cmd.args[3] * 1000 / 4; -+ } else { -+ c->cnr.len = 1; -+ c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; -+ } -+ -+ dev_dbg(&s->client->dev, "status=%02x args=%*ph\n", -+ *status, cmd.rlen, cmd.args); -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2168_set_frontend(struct dvb_frontend *fe) -+{ -+ struct si2168 *s = fe->demodulator_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ int ret; -+ struct si2168_cmd cmd; -+ u8 bandwidth, delivery_system; -+ -+ dev_dbg(&s->client->dev, -+ "delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%u, stream_id=%d\n", -+ c->delivery_system, c->modulation, -+ c->frequency, c->bandwidth_hz, c->symbol_rate, -+ c->inversion, c->stream_id); -+ -+ if (!s->active) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ switch (c->delivery_system) { -+ case SYS_DVBT: -+ delivery_system = 0x20; -+ break; -+ case SYS_DVBC_ANNEX_A: -+ delivery_system = 0x30; -+ break; -+ case SYS_DVBT2: -+ delivery_system = 0x70; -+ break; -+ default: -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ if (c->bandwidth_hz <= 5000000) -+ bandwidth = 0x05; -+ else if (c->bandwidth_hz <= 6000000) -+ bandwidth = 0x06; -+ else if (c->bandwidth_hz <= 7000000) -+ bandwidth = 0x07; -+ else if (c->bandwidth_hz <= 8000000) -+ bandwidth = 0x08; -+ else if (c->bandwidth_hz <= 9000000) -+ bandwidth = 0x09; -+ else if (c->bandwidth_hz <= 10000000) -+ bandwidth = 0x0a; -+ else -+ bandwidth = 0x0f; -+ -+ /* program tuner */ -+ if (fe->ops.tuner_ops.set_params) { -+ ret = fe->ops.tuner_ops.set_params(fe); -+ if (ret) -+ goto err; -+ } -+ -+ memcpy(cmd.args, "\x88\x02\x02\x02\x02", 5); -+ cmd.wlen = 5; -+ cmd.rlen = 5; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* that has no big effect */ -+ if (c->delivery_system == SYS_DVBT) -+ memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6); -+ else if (c->delivery_system == SYS_DVBC_ANNEX_A) -+ memcpy(cmd.args, "\x89\x21\x06\x11\x89\xf0", 6); -+ else if (c->delivery_system == SYS_DVBT2) -+ memcpy(cmd.args, "\x89\x21\x06\x11\x89\x20", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 3; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ if (c->delivery_system == SYS_DVBT2) { -+ /* select PLP */ -+ cmd.args[0] = 0x52; -+ cmd.args[1] = c->stream_id & 0xff; -+ cmd.args[2] = c->stream_id == NO_STREAM_ID_FILTER ? 0 : 1; -+ cmd.wlen = 3; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ } -+ -+ memcpy(cmd.args, "\x51\x03", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 12; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x12\x08\x04", 3); -+ cmd.wlen = 3; -+ cmd.rlen = 3; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x0c\x10\x12\x00", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x06\x10\x24\x00", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x07\x10\x00\x24", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); -+ cmd.args[4] = delivery_system | bandwidth; -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* set DVB-C symbol rate */ -+ if (c->delivery_system == SYS_DVBC_ANNEX_A) { -+ memcpy(cmd.args, "\x14\x00\x02\x11", 4); -+ cmd.args[4] = (c->symbol_rate / 1000) & 0xff; -+ cmd.args[5] = ((c->symbol_rate / 1000) >> 8) & 0xff; -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ } -+ -+ memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x08", 6); -+ cmd.args[5] |= s->ts_clock_inv ? 0x00 : 0x10; -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); -+ cmd.args[5] |= s->ts_clock_inv ? 0x00 : 0x10; -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x00", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x85", 1); -+ cmd.wlen = 1; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ s->delivery_system = c->delivery_system; -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2168_init(struct dvb_frontend *fe) -+{ -+ struct si2168 *s = fe->demodulator_priv; -+ int ret, len, remaining; -+ const struct firmware *fw = NULL; -+ u8 *fw_file; -+ const unsigned int i2c_wr_max = 8; -+ struct si2168_cmd cmd; -+ unsigned int chip_id; -+ -+ dev_dbg(&s->client->dev, "\n"); -+ -+ /* initialize */ -+ memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); -+ cmd.wlen = 13; -+ cmd.rlen = 0; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ if (s->fw_loaded) { -+ /* resume */ -+ memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8); -+ cmd.wlen = 8; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ memcpy(cmd.args, "\x85", 1); -+ cmd.wlen = 1; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ goto warm; -+ } -+ -+ /* power up */ -+ memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); -+ cmd.wlen = 8; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* query chip revision */ -+ memcpy(cmd.args, "\x02", 1); -+ cmd.wlen = 1; -+ cmd.rlen = 13; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 | -+ cmd.args[4] << 0; -+ -+ #define SI2168_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0) -+ #define SI2168_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0) -+ #define SI2168_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0) -+ -+ switch (chip_id) { -+ case SI2168_A20: -+ fw_file = SI2168_A20_FIRMWARE; -+ break; -+ case SI2168_A30: -+ fw_file = SI2168_A30_FIRMWARE; -+ break; -+ case SI2168_B40: -+ fw_file = SI2168_B40_FIRMWARE; -+ break; -+ default: -+ dev_err(&s->client->dev, -+ "unknown chip version Si21%d-%c%c%c\n", -+ cmd.args[2], cmd.args[1], -+ cmd.args[3], cmd.args[4]); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ /* cold state - try to download firmware */ -+ dev_info(&s->client->dev, "found a '%s' in cold state\n", -+ si2168_ops.info.name); -+ -+ /* request the firmware, this will block and timeout */ -+ ret = request_firmware(&fw, fw_file, &s->client->dev); -+ if (ret) { -+ /* fallback mechanism to handle old name for Si2168 B40 fw */ -+ if (chip_id == SI2168_B40) { -+ fw_file = SI2168_B40_FIRMWARE_FALLBACK; -+ ret = request_firmware(&fw, fw_file, &s->client->dev); -+ } -+ -+ if (ret == 0) { -+ dev_notice(&s->client->dev, -+ "please install firmware file '%s'\n", -+ SI2168_B40_FIRMWARE); -+ } else { -+ dev_err(&s->client->dev, -+ "firmware file '%s' not found\n", -+ fw_file); -+ goto error_fw_release; -+ } -+ } -+ -+ dev_info(&s->client->dev, "downloading firmware from file '%s'\n", -+ fw_file); -+ -+ if ((fw->size % 17 == 0) && (fw->data[0] > 5)) { -+ /* firmware is in the new format */ -+ for (remaining = fw->size; remaining > 0; remaining -= 17) { -+ len = fw->data[fw->size - remaining]; -+ memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); -+ cmd.wlen = len; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) { -+ dev_err(&s->client->dev, -+ "firmware download failed=%d\n", -+ ret); -+ goto error_fw_release; -+ } -+ } -+ } else { -+ /* firmware is in the old format */ -+ for (remaining = fw->size; remaining > 0; remaining -= i2c_wr_max) { -+ len = remaining; -+ if (len > i2c_wr_max) -+ len = i2c_wr_max; -+ -+ memcpy(cmd.args, &fw->data[fw->size - remaining], len); -+ cmd.wlen = len; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) { -+ dev_err(&s->client->dev, -+ "firmware download failed=%d\n", -+ ret); -+ goto error_fw_release; -+ } -+ } -+ } -+ -+ release_firmware(fw); -+ fw = NULL; -+ -+ memcpy(cmd.args, "\x01\x01", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 1; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* query firmware version */ -+ memcpy(cmd.args, "\x11", 1); -+ cmd.wlen = 1; -+ cmd.rlen = 10; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ dev_dbg(&s->client->dev, "firmware version: %c.%c.%d\n", -+ cmd.args[6], cmd.args[7], cmd.args[8]); -+ -+ /* set ts mode */ -+ memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); -+ cmd.args[4] |= s->ts_mode; -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ s->fw_loaded = true; -+ -+ dev_info(&s->client->dev, "found a '%s' in warm state\n", -+ si2168_ops.info.name); -+warm: -+ s->active = true; -+ -+ return 0; -+ -+error_fw_release: -+ release_firmware(fw); -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2168_sleep(struct dvb_frontend *fe) -+{ -+ struct si2168 *s = fe->demodulator_priv; -+ int ret; -+ struct si2168_cmd cmd; -+ -+ dev_dbg(&s->client->dev, "\n"); -+ -+ s->active = false; -+ -+ memcpy(cmd.args, "\x13", 1); -+ cmd.wlen = 1; -+ cmd.rlen = 0; -+ ret = si2168_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2168_get_tune_settings(struct dvb_frontend *fe, -+ struct dvb_frontend_tune_settings *s) -+{ -+ s->min_delay_ms = 900; -+ -+ return 0; -+} -+ -+/* -+ * I2C gate logic -+ * We must use unlocked i2c_transfer() here because I2C lock is already taken -+ * by tuner driver. -+ */ -+static int si2168_select(struct i2c_adapter *adap, void *mux_priv, u32 chan) -+{ -+ struct si2168 *s = mux_priv; -+ int ret; -+ struct i2c_msg gate_open_msg = { -+ .addr = s->client->addr, -+ .flags = 0, -+ .len = 3, -+ .buf = "\xc0\x0d\x01", -+ }; -+ -+ mutex_lock(&s->i2c_mutex); -+ -+ /* open tuner I2C gate */ -+ ret = __i2c_transfer(s->client->adapter, &gate_open_msg, 1); -+ if (ret != 1) { -+ dev_warn(&s->client->dev, "i2c write failed=%d\n", ret); -+ if (ret >= 0) -+ ret = -EREMOTEIO; -+ } else { -+ ret = 0; -+ } -+ -+ return ret; -+} -+ -+static int si2168_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan) -+{ -+ struct si2168 *s = mux_priv; -+ int ret; -+ struct i2c_msg gate_close_msg = { -+ .addr = s->client->addr, -+ .flags = 0, -+ .len = 3, -+ .buf = "\xc0\x0d\x00", -+ }; -+ -+ /* close tuner I2C gate */ -+ ret = __i2c_transfer(s->client->adapter, &gate_close_msg, 1); -+ if (ret != 1) { -+ dev_warn(&s->client->dev, "i2c write failed=%d\n", ret); -+ if (ret >= 0) -+ ret = -EREMOTEIO; -+ } else { -+ ret = 0; -+ } -+ -+ mutex_unlock(&s->i2c_mutex); -+ -+ return ret; -+} -+ -+static const struct dvb_frontend_ops si2168_ops = { -+ .delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A}, -+ .info = { -+ .name = "Silicon Labs Si2168", -+ .caps = FE_CAN_FEC_1_2 | -+ FE_CAN_FEC_2_3 | -+ FE_CAN_FEC_3_4 | -+ FE_CAN_FEC_5_6 | -+ FE_CAN_FEC_7_8 | -+ FE_CAN_FEC_AUTO | -+ FE_CAN_QPSK | -+ FE_CAN_QAM_16 | -+ FE_CAN_QAM_32 | -+ FE_CAN_QAM_64 | -+ FE_CAN_QAM_128 | -+ FE_CAN_QAM_256 | -+ FE_CAN_QAM_AUTO | -+ FE_CAN_TRANSMISSION_MODE_AUTO | -+ FE_CAN_GUARD_INTERVAL_AUTO | -+ FE_CAN_HIERARCHY_AUTO | -+ FE_CAN_MUTE_TS | -+ FE_CAN_2G_MODULATION | -+ FE_CAN_MULTISTREAM -+ }, -+ -+ .get_tune_settings = si2168_get_tune_settings, -+ -+ .init = si2168_init, -+ .sleep = si2168_sleep, -+ -+ .set_frontend = si2168_set_frontend, -+ -+ .read_status = si2168_read_status, -+}; -+ -+static int si2168_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct si2168_config *config = client->dev.platform_data; -+ struct si2168 *s; -+ int ret; -+ -+ dev_dbg(&client->dev, "\n"); -+ -+ s = kzalloc(sizeof(struct si2168), GFP_KERNEL); -+ if (!s) { -+ ret = -ENOMEM; -+ dev_err(&client->dev, "kzalloc() failed\n"); -+ goto err; -+ } -+ -+ s->client = client; -+ mutex_init(&s->i2c_mutex); -+ -+ /* create mux i2c adapter for tuner */ -+ s->adapter = i2c_add_mux_adapter(client->adapter, &client->dev, s, -+ 0, 0, 0, si2168_select, si2168_deselect); -+ if (s->adapter == NULL) { -+ ret = -ENODEV; -+ goto err; -+ } -+ -+ /* create dvb_frontend */ -+ memcpy(&s->fe.ops, &si2168_ops, sizeof(struct dvb_frontend_ops)); -+ s->fe.demodulator_priv = s; -+ -+ *config->i2c_adapter = s->adapter; -+ *config->fe = &s->fe; -+ s->ts_mode = config->ts_mode; -+ s->ts_clock_inv = config->ts_clock_inv; -+ s->fw_loaded = false; -+ -+ i2c_set_clientdata(client, s); -+ -+ dev_info(&s->client->dev, -+ "Silicon Labs Si2168 successfully attached\n"); -+ return 0; -+err: -+ kfree(s); -+ dev_dbg(&client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2168_remove(struct i2c_client *client) -+{ -+ struct si2168 *s = i2c_get_clientdata(client); -+ -+ dev_dbg(&client->dev, "\n"); -+ -+ i2c_del_mux_adapter(s->adapter); -+ -+ s->fe.ops.release = NULL; -+ s->fe.demodulator_priv = NULL; -+ -+ kfree(s); -+ -+ return 0; -+} -+ -+static const struct i2c_device_id si2168_id[] = { -+ {"si2168", 0}, -+ {} -+}; -+MODULE_DEVICE_TABLE(i2c, si2168_id); -+ -+static struct i2c_driver si2168_driver = { -+ .driver = { -+ .owner = THIS_MODULE, -+ .name = "si2168", -+ }, -+ .probe = si2168_probe, -+ .remove = si2168_remove, -+ .id_table = si2168_id, -+}; -+ -+module_i2c_driver(si2168_driver); -+ -+MODULE_AUTHOR("Antti Palosaari "); -+MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver"); -+MODULE_LICENSE("GPL"); -+MODULE_FIRMWARE(SI2168_A20_FIRMWARE); -+MODULE_FIRMWARE(SI2168_A30_FIRMWARE); -+MODULE_FIRMWARE(SI2168_B40_FIRMWARE); -diff -urN a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h ---- a/drivers/media/dvb-frontends/si2168.h 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/dvb-frontends/si2168.h 2015-03-22 14:17:59.570225151 +0200 -@@ -0,0 +1,49 @@ -+/* -+ * Silicon Labs Si2168 DVB-T/T2/C demodulator driver -+ * -+ * Copyright (C) 2014 Antti Palosaari -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef SI2168_H -+#define SI2168_H -+ -+#include -+/* -+ * I2C address -+ * 0x64 -+ */ -+struct si2168_config { -+ /* -+ * frontend -+ * returned by driver -+ */ -+ struct dvb_frontend **fe; -+ -+ /* -+ * tuner I2C adapter -+ * returned by driver -+ */ -+ struct i2c_adapter **i2c_adapter; -+ -+ /* TS mode */ -+ u8 ts_mode; -+ -+ /* TS clock inverted */ -+ bool ts_clock_inv; -+ -+}; -+ -+#define SI2168_TS_PARALLEL 0x06 -+#define SI2168_TS_SERIAL 0x03 -+ -+#endif -diff -urN a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h ---- a/drivers/media/dvb-frontends/si2168_priv.h 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/dvb-frontends/si2168_priv.h 2015-03-22 14:17:59.570225151 +0200 -@@ -0,0 +1,52 @@ -+/* -+ * Silicon Labs Si2168 DVB-T/T2/C demodulator driver -+ * -+ * Copyright (C) 2014 Antti Palosaari -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef SI2168_PRIV_H -+#define SI2168_PRIV_H -+ -+#include "si2168.h" -+#include "dvb_frontend.h" -+#include -+#include -+ -+#define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw" -+#define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw" -+#define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw" -+#define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw" -+ -+/* state struct */ -+struct si2168 { -+ struct i2c_client *client; -+ struct i2c_adapter *adapter; -+ struct mutex i2c_mutex; -+ struct dvb_frontend fe; -+ fe_delivery_system_t delivery_system; -+ fe_status_t fe_status; -+ bool active; -+ bool fw_loaded; -+ u8 ts_mode; -+ bool ts_clock_inv; -+}; -+ -+/* firmare command struct */ -+#define SI2168_ARGLEN 30 -+struct si2168_cmd { -+ u8 args[SI2168_ARGLEN]; -+ unsigned wlen; -+ unsigned rlen; -+}; -+ -+#endif -diff -urN a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c ---- a/drivers/media/dvb-frontends/sp2.c 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/dvb-frontends/sp2.c 2015-03-22 14:17:59.570225151 +0200 -@@ -0,0 +1,444 @@ -+/* -+ * CIMaX SP2/SP2HF (Atmel T90FJR) CI driver -+ * -+ * Copyright (C) 2014 Olli Salonen -+ * -+ * Heavily based on CIMax2(R) SP2 driver in conjunction with NetUp Dual -+ * DVB-S2 CI card (cimax2) with following copyrights: -+ * -+ * Copyright (C) 2009 NetUP Inc. -+ * Copyright (C) 2009 Igor M. Liplianin -+ * Copyright (C) 2009 Abylay Ospan -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include "sp2_priv.h" -+ -+static int sp2_read_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) -+{ -+ int ret; -+ struct i2c_client *client = s->client; -+ struct i2c_adapter *adap = client->adapter; -+ struct i2c_msg msg[] = { -+ { -+ .addr = client->addr, -+ .flags = 0, -+ .buf = ®, -+ .len = 1 -+ }, { -+ .addr = client->addr, -+ .flags = I2C_M_RD, -+ .buf = buf, -+ .len = len -+ } -+ }; -+ -+ ret = i2c_transfer(adap, msg, 2); -+ -+ if (ret != 2) { -+ dev_err(&client->dev, "i2c read error, reg = 0x%02x, status = %d\n", -+ reg, ret); -+ if (ret < 0) -+ return ret; -+ else -+ return -EIO; -+ } -+ -+ dev_dbg(&s->client->dev, "addr=0x%04x, reg = 0x%02x, data = %02x\n", -+ client->addr, reg, buf[0]); -+ -+ return 0; -+} -+ -+static int sp2_write_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) -+{ -+ int ret; -+ u8 buffer[35]; -+ struct i2c_client *client = s->client; -+ struct i2c_adapter *adap = client->adapter; -+ struct i2c_msg msg = { -+ .addr = client->addr, -+ .flags = 0, -+ .buf = &buffer[0], -+ .len = len + 1 -+ }; -+ -+ if ((len + 1) > sizeof(buffer)) { -+ dev_err(&client->dev, "i2c wr reg=%02x: len=%d is too big!\n", -+ reg, len); -+ return -EINVAL; -+ } -+ -+ buffer[0] = reg; -+ memcpy(&buffer[1], buf, len); -+ -+ ret = i2c_transfer(adap, &msg, 1); -+ -+ if (ret != 1) { -+ dev_err(&client->dev, "i2c write error, reg = 0x%02x, status = %d\n", -+ reg, ret); -+ if (ret < 0) -+ return ret; -+ else -+ return -EIO; -+ } -+ -+ dev_dbg(&s->client->dev, "addr=0x%04x, reg = 0x%02x, data = %*ph\n", -+ client->addr, reg, len, buf); -+ -+ return 0; -+} -+ -+static int sp2_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, u8 acs, -+ u8 read, int addr, u8 data) -+{ -+ struct sp2 *s = en50221->data; -+ u8 store; -+ int mem, ret; -+ int (*ci_op_cam)(void*, u8, int, u8, int*) = s->ci_control; -+ -+ if (slot != 0) -+ return -EINVAL; -+ -+ /* -+ * change module access type between IO space and attribute memory -+ * when needed -+ */ -+ if (s->module_access_type != acs) { -+ ret = sp2_read_i2c(s, 0x00, &store, 1); -+ -+ if (ret) -+ return ret; -+ -+ store &= ~(SP2_MOD_CTL_ACS1 | SP2_MOD_CTL_ACS0); -+ store |= acs; -+ -+ ret = sp2_write_i2c(s, 0x00, &store, 1); -+ if (ret) -+ return ret; -+ } -+ -+ s->module_access_type = acs; -+ -+ /* implementation of ci_op_cam is device specific */ -+ if (ci_op_cam) { -+ ret = ci_op_cam(s->priv, read, addr, data, &mem); -+ } else { -+ dev_err(&s->client->dev, "callback not defined"); -+ return -EINVAL; -+ } -+ -+ if (ret) -+ return ret; -+ -+ dev_dbg(&s->client->dev, "%s: slot=%d, addr=0x%04x, %s, data=%x", -+ (read) ? "read" : "write", slot, addr, -+ (acs == SP2_CI_ATTR_ACS) ? "attr" : "io", -+ (read) ? mem : data); -+ -+ if (read) -+ return mem; -+ else -+ return 0; -+ -+} -+ -+int sp2_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221, -+ int slot, int addr) -+{ -+ return sp2_ci_op_cam(en50221, slot, SP2_CI_ATTR_ACS, -+ SP2_CI_RD, addr, 0); -+} -+ -+int sp2_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221, -+ int slot, int addr, u8 data) -+{ -+ return sp2_ci_op_cam(en50221, slot, SP2_CI_ATTR_ACS, -+ SP2_CI_WR, addr, data); -+} -+ -+int sp2_ci_read_cam_control(struct dvb_ca_en50221 *en50221, -+ int slot, u8 addr) -+{ -+ return sp2_ci_op_cam(en50221, slot, SP2_CI_IO_ACS, -+ SP2_CI_RD, addr, 0); -+} -+ -+int sp2_ci_write_cam_control(struct dvb_ca_en50221 *en50221, -+ int slot, u8 addr, u8 data) -+{ -+ return sp2_ci_op_cam(en50221, slot, SP2_CI_IO_ACS, -+ SP2_CI_WR, addr, data); -+} -+ -+int sp2_ci_slot_reset(struct dvb_ca_en50221 *en50221, int slot) -+{ -+ struct sp2 *s = en50221->data; -+ u8 buf; -+ int ret; -+ -+ dev_dbg(&s->client->dev, "slot: %d\n", slot); -+ -+ if (slot != 0) -+ return -EINVAL; -+ -+ /* RST on */ -+ buf = SP2_MOD_CTL_RST; -+ ret = sp2_write_i2c(s, 0x00, &buf, 1); -+ -+ if (ret) -+ return ret; -+ -+ usleep_range(500, 600); -+ -+ /* RST off */ -+ buf = 0x00; -+ ret = sp2_write_i2c(s, 0x00, &buf, 1); -+ -+ if (ret) -+ return ret; -+ -+ msleep(1000); -+ -+ return 0; -+} -+ -+int sp2_ci_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot) -+{ -+ struct sp2 *s = en50221->data; -+ -+ dev_dbg(&s->client->dev, "slot:%d\n", slot); -+ -+ /* not implemented */ -+ return 0; -+} -+ -+int sp2_ci_slot_ts_enable(struct dvb_ca_en50221 *en50221, int slot) -+{ -+ struct sp2 *s = en50221->data; -+ u8 buf; -+ -+ dev_dbg(&s->client->dev, "slot:%d\n", slot); -+ -+ if (slot != 0) -+ return -EINVAL; -+ -+ sp2_read_i2c(s, 0x00, &buf, 1); -+ -+ /* disable bypass and enable TS */ -+ buf |= (SP2_MOD_CTL_TSOEN | SP2_MOD_CTL_TSIEN); -+ return sp2_write_i2c(s, 0, &buf, 1); -+} -+ -+int sp2_ci_poll_slot_status(struct dvb_ca_en50221 *en50221, -+ int slot, int open) -+{ -+ struct sp2 *s = en50221->data; -+ u8 buf[2]; -+ int ret; -+ -+ dev_dbg(&s->client->dev, "slot:%d open:%d\n", slot, open); -+ -+ /* -+ * CAM module INSERT/REMOVE processing. Slow operation because of i2c -+ * transfers. Throttle read to one per sec. -+ */ -+ if (time_after(jiffies, s->next_status_checked_time)) { -+ ret = sp2_read_i2c(s, 0x00, buf, 1); -+ s->next_status_checked_time = jiffies + msecs_to_jiffies(1000); -+ -+ if (ret) -+ return 0; -+ -+ if (buf[0] & SP2_MOD_CTL_DET) -+ s->status = DVB_CA_EN50221_POLL_CAM_PRESENT | -+ DVB_CA_EN50221_POLL_CAM_READY; -+ else -+ s->status = 0; -+ } -+ -+ return s->status; -+} -+ -+static int sp2_init(struct sp2 *s) -+{ -+ int ret = 0; -+ u8 buf; -+ u8 cimax_init[34] = { -+ 0x00, /* module A control*/ -+ 0x00, /* auto select mask high A */ -+ 0x00, /* auto select mask low A */ -+ 0x00, /* auto select pattern high A */ -+ 0x00, /* auto select pattern low A */ -+ 0x44, /* memory access time A, 600 ns */ -+ 0x00, /* invert input A */ -+ 0x00, /* RFU */ -+ 0x00, /* RFU */ -+ 0x00, /* module B control*/ -+ 0x00, /* auto select mask high B */ -+ 0x00, /* auto select mask low B */ -+ 0x00, /* auto select pattern high B */ -+ 0x00, /* auto select pattern low B */ -+ 0x44, /* memory access time B, 600 ns */ -+ 0x00, /* invert input B */ -+ 0x00, /* RFU */ -+ 0x00, /* RFU */ -+ 0x00, /* auto select mask high Ext */ -+ 0x00, /* auto select mask low Ext */ -+ 0x00, /* auto select pattern high Ext */ -+ 0x00, /* auto select pattern low Ext */ -+ 0x00, /* RFU */ -+ 0x02, /* destination - module A */ -+ 0x01, /* power control reg, VCC power on */ -+ 0x00, /* RFU */ -+ 0x00, /* int status read only */ -+ 0x00, /* Interrupt Mask Register */ -+ 0x05, /* EXTINT=active-high, INT=push-pull */ -+ 0x00, /* USCG1 */ -+ 0x04, /* ack active low */ -+ 0x00, /* LOCK = 0 */ -+ 0x22, /* unknown */ -+ 0x00, /* synchronization? */ -+ }; -+ -+ dev_dbg(&s->client->dev, "\n"); -+ -+ s->ca.owner = THIS_MODULE; -+ s->ca.read_attribute_mem = sp2_ci_read_attribute_mem; -+ s->ca.write_attribute_mem = sp2_ci_write_attribute_mem; -+ s->ca.read_cam_control = sp2_ci_read_cam_control; -+ s->ca.write_cam_control = sp2_ci_write_cam_control; -+ s->ca.slot_reset = sp2_ci_slot_reset; -+ s->ca.slot_shutdown = sp2_ci_slot_shutdown; -+ s->ca.slot_ts_enable = sp2_ci_slot_ts_enable; -+ s->ca.poll_slot_status = sp2_ci_poll_slot_status; -+ s->ca.data = s; -+ s->module_access_type = 0; -+ -+ /* initialize all regs */ -+ ret = sp2_write_i2c(s, 0x00, &cimax_init[0], 34); -+ if (ret) -+ goto err; -+ -+ /* lock registers */ -+ buf = 1; -+ ret = sp2_write_i2c(s, 0x1f, &buf, 1); -+ if (ret) -+ goto err; -+ -+ /* power on slots */ -+ ret = sp2_write_i2c(s, 0x18, &buf, 1); -+ if (ret) -+ goto err; -+ -+ ret = dvb_ca_en50221_init(s->dvb_adap, &s->ca, 0, 1); -+ if (ret) -+ goto err; -+ -+ return 0; -+ -+err: -+ dev_dbg(&s->client->dev, "init failed=%d\n", ret); -+ return ret; -+} -+ -+static int sp2_exit(struct i2c_client *client) -+{ -+ struct sp2 *s; -+ -+ dev_dbg(&client->dev, "\n"); -+ -+ if (client == NULL) -+ return 0; -+ -+ s = i2c_get_clientdata(client); -+ if (s == NULL) -+ return 0; -+ -+ if (s->ca.data == NULL) -+ return 0; -+ -+ dvb_ca_en50221_release(&s->ca); -+ -+ return 0; -+} -+ -+static int sp2_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct sp2_config *cfg = client->dev.platform_data; -+ struct sp2 *s; -+ int ret; -+ -+ dev_dbg(&client->dev, "\n"); -+ -+ s = kzalloc(sizeof(struct sp2), GFP_KERNEL); -+ if (!s) { -+ ret = -ENOMEM; -+ dev_err(&client->dev, "kzalloc() failed\n"); -+ goto err; -+ } -+ -+ s->client = client; -+ s->dvb_adap = cfg->dvb_adap; -+ s->priv = cfg->priv; -+ s->ci_control = cfg->ci_control; -+ -+ i2c_set_clientdata(client, s); -+ -+ ret = sp2_init(s); -+ if (ret) -+ goto err; -+ -+ dev_info(&s->client->dev, "CIMaX SP2 successfully attached\n"); -+ return 0; -+err: -+ dev_dbg(&client->dev, "init failed=%d\n", ret); -+ kfree(s); -+ -+ return ret; -+} -+ -+static int sp2_remove(struct i2c_client *client) -+{ -+ struct sp2 *s = i2c_get_clientdata(client); -+ -+ dev_dbg(&client->dev, "\n"); -+ -+ sp2_exit(client); -+ if (s != NULL) -+ kfree(s); -+ -+ return 0; -+} -+ -+static const struct i2c_device_id sp2_id[] = { -+ {"sp2", 0}, -+ {} -+}; -+MODULE_DEVICE_TABLE(i2c, sp2_id); -+ -+static struct i2c_driver sp2_driver = { -+ .driver = { -+ .owner = THIS_MODULE, -+ .name = "sp2", -+ }, -+ .probe = sp2_probe, -+ .remove = sp2_remove, -+ .id_table = sp2_id, -+}; -+ -+module_i2c_driver(sp2_driver); -+ -+MODULE_DESCRIPTION("CIMaX SP2/HF CI driver"); -+MODULE_AUTHOR("Olli Salonen "); -+MODULE_LICENSE("GPL"); -diff -urN a/drivers/media/dvb-frontends/sp2.h b/drivers/media/dvb-frontends/sp2.h ---- a/drivers/media/dvb-frontends/sp2.h 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/dvb-frontends/sp2.h 2015-03-22 14:17:59.570225151 +0200 -@@ -0,0 +1,53 @@ -+/* -+ * CIMaX SP2/HF CI driver -+ * -+ * Copyright (C) 2014 Olli Salonen -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef SP2_H -+#define SP2_H -+ -+#include -+#include "dvb_ca_en50221.h" -+ -+/* -+ * I2C address -+ * 0x40 (port 0) -+ * 0x41 (port 1) -+ */ -+struct sp2_config { -+ /* dvb_adapter to attach the ci to */ -+ struct dvb_adapter *dvb_adap; -+ -+ /* function ci_control handles the device specific ci ops */ -+ void *ci_control; -+ -+ /* priv is passed back to function ci_control */ -+ void *priv; -+}; -+ -+extern int sp2_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221, -+ int slot, int addr); -+extern int sp2_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221, -+ int slot, int addr, u8 data); -+extern int sp2_ci_read_cam_control(struct dvb_ca_en50221 *en50221, -+ int slot, u8 addr); -+extern int sp2_ci_write_cam_control(struct dvb_ca_en50221 *en50221, -+ int slot, u8 addr, u8 data); -+extern int sp2_ci_slot_reset(struct dvb_ca_en50221 *en50221, int slot); -+extern int sp2_ci_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot); -+extern int sp2_ci_slot_ts_enable(struct dvb_ca_en50221 *en50221, int slot); -+extern int sp2_ci_poll_slot_status(struct dvb_ca_en50221 *en50221, -+ int slot, int open); -+ -+#endif -diff -urN a/drivers/media/dvb-frontends/sp2_priv.h b/drivers/media/dvb-frontends/sp2_priv.h ---- a/drivers/media/dvb-frontends/sp2_priv.h 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/dvb-frontends/sp2_priv.h 2015-03-22 14:17:59.570225151 +0200 -@@ -0,0 +1,50 @@ -+/* -+ * CIMaX SP2/HF CI driver -+ * -+ * Copyright (C) 2014 Olli Salonen -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef SP2_PRIV_H -+#define SP2_PRIV_H -+ -+#include "sp2.h" -+#include "dvb_frontend.h" -+ -+/* state struct */ -+struct sp2 { -+ int status; -+ struct i2c_client *client; -+ struct dvb_adapter *dvb_adap; -+ struct dvb_ca_en50221 ca; -+ int module_access_type; -+ unsigned long next_status_checked_time; -+ void *priv; -+ void *ci_control; -+}; -+ -+#define SP2_CI_ATTR_ACS 0x00 -+#define SP2_CI_IO_ACS 0x04 -+#define SP2_CI_WR 0 -+#define SP2_CI_RD 1 -+ -+/* Module control register (0x00 module A, 0x09 module B) bits */ -+#define SP2_MOD_CTL_DET 0x01 -+#define SP2_MOD_CTL_AUTO 0x02 -+#define SP2_MOD_CTL_ACS0 0x04 -+#define SP2_MOD_CTL_ACS1 0x08 -+#define SP2_MOD_CTL_HAD 0x10 -+#define SP2_MOD_CTL_TSIEN 0x20 -+#define SP2_MOD_CTL_TSOEN 0x40 -+#define SP2_MOD_CTL_RST 0x80 -+ -+#endif -diff -urN a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig ---- a/drivers/media/tuners/Kconfig 2014-11-02 15:07:13.000000000 +0200 -+++ b/drivers/media/tuners/Kconfig 2015-03-22 14:17:59.570225151 +0200 -@@ -242,4 +242,11 @@ - default m if !MEDIA_SUBDRV_AUTOSELECT - help - Rafael Micro R820T silicon tuner driver. -+ -+config MEDIA_TUNER_SI2157 -+ tristate "Silicon Labs Si2157 silicon tuner" -+ depends on MEDIA_SUPPORT && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT -+ help -+ Si2157 silicon tuner driver. - endmenu -diff -urN a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile ---- a/drivers/media/tuners/Makefile 2014-11-02 15:07:13.000000000 +0200 -+++ b/drivers/media/tuners/Makefile 2015-03-22 14:17:59.570225151 +0200 -@@ -37,6 +37,7 @@ - obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o - obj-$(CONFIG_MEDIA_TUNER_IT913X) += tuner_it913x.o - obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o -+obj-$(CONFIG_MEDIA_TUNER_SI2157) += si2157.o - - ccflags-y += -I$(srctree)/drivers/media/dvb-core - ccflags-y += -I$(srctree)/drivers/media/dvb-frontends -diff -urN a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c ---- a/drivers/media/tuners/si2157.c 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/tuners/si2157.c 2015-03-22 14:17:59.574225151 +0200 -@@ -0,0 +1,417 @@ -+/* -+ * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver -+ * -+ * Copyright (C) 2014 Antti Palosaari -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#include "si2157_priv.h" -+ -+static const struct dvb_tuner_ops si2157_ops; -+ -+/* execute firmware command */ -+static int si2157_cmd_execute(struct si2157 *s, struct si2157_cmd *cmd) -+{ -+ int ret; -+ unsigned long timeout; -+ -+ mutex_lock(&s->i2c_mutex); -+ -+ if (cmd->wlen) { -+ /* write cmd and args for firmware */ -+ ret = i2c_master_send(s->client, cmd->args, cmd->wlen); -+ if (ret < 0) { -+ goto err_mutex_unlock; -+ } else if (ret != cmd->wlen) { -+ ret = -EREMOTEIO; -+ goto err_mutex_unlock; -+ } -+ } -+ -+ if (cmd->rlen) { -+ /* wait cmd execution terminate */ -+ #define TIMEOUT 80 -+ timeout = jiffies + msecs_to_jiffies(TIMEOUT); -+ while (!time_after(jiffies, timeout)) { -+ ret = i2c_master_recv(s->client, cmd->args, cmd->rlen); -+ if (ret < 0) { -+ goto err_mutex_unlock; -+ } else if (ret != cmd->rlen) { -+ ret = -EREMOTEIO; -+ goto err_mutex_unlock; -+ } -+ -+ /* firmware ready? */ -+ if ((cmd->args[0] >> 7) & 0x01) -+ break; -+ } -+ -+ dev_dbg(&s->client->dev, "cmd execution took %d ms\n", -+ jiffies_to_msecs(jiffies) - -+ (jiffies_to_msecs(timeout) - TIMEOUT)); -+ -+ if (!((cmd->args[0] >> 7) & 0x01)) { -+ ret = -ETIMEDOUT; -+ goto err_mutex_unlock; -+ } -+ } -+ -+ ret = 0; -+ -+err_mutex_unlock: -+ mutex_unlock(&s->i2c_mutex); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2157_init(struct dvb_frontend *fe) -+{ -+ struct si2157 *s = fe->tuner_priv; -+ int ret, len, remaining; -+ struct si2157_cmd cmd; -+ const struct firmware *fw = NULL; -+ u8 *fw_file; -+ unsigned int chip_id; -+ -+ dev_dbg(&s->client->dev, "\n"); -+ -+ if (s->fw_loaded) -+ goto warm; -+ -+ /* power up */ -+ if (s->chiptype == SI2157_CHIPTYPE_SI2146) { -+ memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9); -+ cmd.wlen = 9; -+ } else { -+ memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15); -+ cmd.wlen = 15; -+ } -+ cmd.rlen = 1; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* query chip revision */ -+ memcpy(cmd.args, "\x02", 1); -+ cmd.wlen = 1; -+ cmd.rlen = 13; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 | -+ cmd.args[4] << 0; -+ -+ #define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0) -+ #define SI2148_A20 ('A' << 24 | 48 << 16 | '2' << 8 | '0' << 0) -+ #define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0) -+ #define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0) -+ #define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0) -+ -+ switch (chip_id) { -+ case SI2158_A20: -+ case SI2148_A20: -+ fw_file = SI2158_A20_FIRMWARE; -+ break; -+ case SI2157_A30: -+ case SI2147_A30: -+ case SI2146_A10: -+ goto skip_fw_download; -+ default: -+ dev_err(&s->client->dev, -+ "unknown chip version Si21%d-%c%c%c\n", -+ cmd.args[2], cmd.args[1], -+ cmd.args[3], cmd.args[4]); -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ /* cold state - try to download firmware */ -+ dev_info(&s->client->dev, "found a '%s' in cold state\n", -+ si2157_ops.info.name); -+ -+ /* request the firmware, this will block and timeout */ -+ ret = request_firmware(&fw, fw_file, &s->client->dev); -+ if (ret) { -+ dev_err(&s->client->dev, "firmware file '%s' not found\n", -+ fw_file); -+ goto err; -+ } -+ -+ /* firmware should be n chunks of 17 bytes */ -+ if (fw->size % 17 != 0) { -+ dev_err(&s->client->dev, "firmware file '%s' is invalid\n", -+ fw_file); -+ ret = -EINVAL; -+ goto fw_release_exit; -+ } -+ -+ dev_info(&s->client->dev, "downloading firmware from file '%s'\n", -+ fw_file); -+ -+ for (remaining = fw->size; remaining > 0; remaining -= 17) { -+ len = fw->data[fw->size - remaining]; -+ memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); -+ cmd.wlen = len; -+ cmd.rlen = 1; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) { -+ dev_err(&s->client->dev, -+ "firmware download failed=%d\n", -+ ret); -+ goto fw_release_exit; -+ } -+ } -+ -+ release_firmware(fw); -+ fw = NULL; -+ -+skip_fw_download: -+ /* reboot the tuner with new firmware? */ -+ memcpy(cmd.args, "\x01\x01", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 1; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ s->fw_loaded = true; -+ -+warm: -+ s->active = true; -+ return 0; -+ -+fw_release_exit: -+ release_firmware(fw); -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2157_sleep(struct dvb_frontend *fe) -+{ -+ struct si2157 *s = fe->tuner_priv; -+ int ret; -+ struct si2157_cmd cmd; -+ -+ dev_dbg(&s->client->dev, "\n"); -+ -+ s->active = false; -+ -+ /* standby */ -+ memcpy(cmd.args, "\x16\x00", 2); -+ cmd.wlen = 2; -+ cmd.rlen = 1; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2157_set_params(struct dvb_frontend *fe) -+{ -+ struct si2157 *s = fe->tuner_priv; -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ int ret; -+ struct si2157_cmd cmd; -+ u8 bandwidth, delivery_system; -+ -+ dev_dbg(&s->client->dev, -+ "delivery_system=%d frequency=%u bandwidth_hz=%u\n", -+ c->delivery_system, c->frequency, -+ c->bandwidth_hz); -+ -+ if (!s->active) { -+ ret = -EAGAIN; -+ goto err; -+ } -+ -+ if (c->bandwidth_hz <= 6000000) -+ bandwidth = 0x06; -+ else if (c->bandwidth_hz <= 7000000) -+ bandwidth = 0x07; -+ else if (c->bandwidth_hz <= 8000000) -+ bandwidth = 0x08; -+ else -+ bandwidth = 0x0f; -+ -+ switch (c->delivery_system) { -+ case SYS_ATSC: -+ delivery_system = 0x00; -+ break; -+ case SYS_DVBC_ANNEX_B: -+ delivery_system = 0x10; -+ break; -+ case SYS_DVBT: -+ case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */ -+ delivery_system = 0x20; -+ break; -+ case SYS_DVBC_ANNEX_A: -+ delivery_system = 0x30; -+ break; -+ default: -+ ret = -EINVAL; -+ goto err; -+ } -+ -+ memcpy(cmd.args, "\x14\x00\x03\x07\x00\x00", 6); -+ cmd.args[4] = delivery_system | bandwidth; -+ if (s->inversion) -+ cmd.args[5] = 0x01; -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ if (s->chiptype == SI2157_CHIPTYPE_SI2146) -+ memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6); -+ else -+ memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6); -+ cmd.wlen = 6; -+ cmd.rlen = 4; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ /* set frequency */ -+ memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); -+ cmd.args[4] = (c->frequency >> 0) & 0xff; -+ cmd.args[5] = (c->frequency >> 8) & 0xff; -+ cmd.args[6] = (c->frequency >> 16) & 0xff; -+ cmd.args[7] = (c->frequency >> 24) & 0xff; -+ cmd.wlen = 8; -+ cmd.rlen = 1; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_dbg(&s->client->dev, "failed=%d\n", ret); -+ return ret; -+} -+ -+static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) -+{ -+ *frequency = 5000000; /* default value of property 0x0706 */ -+ return 0; -+} -+ -+static const struct dvb_tuner_ops si2157_ops = { -+ .info = { -+ .name = "Silicon Labs Si2146/2147/2148/2157/2158", -+ .frequency_min = 110000000, -+ .frequency_max = 862000000, -+ }, -+ -+ .init = si2157_init, -+ .sleep = si2157_sleep, -+ .set_params = si2157_set_params, -+ .get_if_frequency = si2157_get_if_frequency, -+}; -+ -+static int si2157_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct si2157_config *cfg = client->dev.platform_data; -+ struct dvb_frontend *fe = cfg->fe; -+ struct si2157 *s; -+ struct si2157_cmd cmd; -+ int ret; -+ -+ s = kzalloc(sizeof(struct si2157), GFP_KERNEL); -+ if (!s) { -+ ret = -ENOMEM; -+ dev_err(&client->dev, "kzalloc() failed\n"); -+ goto err; -+ } -+ -+ s->client = client; -+ s->fe = cfg->fe; -+ s->inversion = cfg->inversion; -+ s->fw_loaded = false; -+ s->chiptype = (u8)id->driver_data; -+ mutex_init(&s->i2c_mutex); -+ -+ /* check if the tuner is there */ -+ cmd.wlen = 0; -+ cmd.rlen = 1; -+ ret = si2157_cmd_execute(s, &cmd); -+ if (ret) -+ goto err; -+ -+ fe->tuner_priv = s; -+ memcpy(&fe->ops.tuner_ops, &si2157_ops, -+ sizeof(struct dvb_tuner_ops)); -+ -+ i2c_set_clientdata(client, s); -+ -+ dev_info(&s->client->dev, -+ "Silicon Labs %s successfully attached\n", -+ s->chiptype == SI2157_CHIPTYPE_SI2146 ? -+ "Si2146" : "Si2147/2148/2157/2158"); -+ -+ return 0; -+err: -+ dev_dbg(&client->dev, "failed=%d\n", ret); -+ kfree(s); -+ -+ return ret; -+} -+ -+static int si2157_remove(struct i2c_client *client) -+{ -+ struct si2157 *s = i2c_get_clientdata(client); -+ struct dvb_frontend *fe = s->fe; -+ -+ dev_dbg(&client->dev, "\n"); -+ -+ memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); -+ fe->tuner_priv = NULL; -+ kfree(s); -+ -+ return 0; -+} -+ -+static const struct i2c_device_id si2157_id[] = { -+ {"si2157", 0}, -+ {"si2146", 1}, -+ {} -+}; -+MODULE_DEVICE_TABLE(i2c, si2157_id); -+ -+static struct i2c_driver si2157_driver = { -+ .driver = { -+ .owner = THIS_MODULE, -+ .name = "si2157", -+ }, -+ .probe = si2157_probe, -+ .remove = si2157_remove, -+ .id_table = si2157_id, -+}; -+ -+module_i2c_driver(si2157_driver); -+ -+MODULE_DESCRIPTION("Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver"); -+MODULE_AUTHOR("Antti Palosaari "); -+MODULE_LICENSE("GPL"); -+MODULE_FIRMWARE(SI2158_A20_FIRMWARE); -diff -urN a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h ---- a/drivers/media/tuners/si2157.h 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/tuners/si2157.h 2015-03-22 14:17:59.574225151 +0200 -@@ -0,0 +1,39 @@ -+/* -+ * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver -+ * -+ * Copyright (C) 2014 Antti Palosaari -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef SI2157_H -+#define SI2157_H -+ -+#include -+#include "dvb_frontend.h" -+ -+/* -+ * I2C address -+ * 0x60 -+ */ -+struct si2157_config { -+ /* -+ * frontend -+ */ -+ struct dvb_frontend *fe; -+ -+ /* -+ * Spectral Inversion -+ */ -+ bool inversion; -+}; -+ -+#endif -diff -urN a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h ---- a/drivers/media/tuners/si2157_priv.h 1970-01-01 02:00:00.000000000 +0200 -+++ b/drivers/media/tuners/si2157_priv.h 2015-03-22 14:17:59.574225151 +0200 -@@ -0,0 +1,47 @@ -+/* -+ * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver -+ * -+ * Copyright (C) 2014 Antti Palosaari -+ * -+ * 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. -+ * -+ * This program 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. -+ */ -+ -+#ifndef SI2157_PRIV_H -+#define SI2157_PRIV_H -+ -+#include -+#include "si2157.h" -+ -+/* state struct */ -+struct si2157 { -+ struct mutex i2c_mutex; -+ struct i2c_client *client; -+ struct dvb_frontend *fe; -+ bool active; -+ bool fw_loaded; -+ bool inversion; -+ u8 chiptype; -+}; -+ -+#define SI2157_CHIPTYPE_SI2157 0 -+#define SI2157_CHIPTYPE_SI2146 1 -+ -+/* firmware command struct */ -+#define SI2157_ARGLEN 30 -+struct si2157_cmd { -+ u8 args[SI2157_ARGLEN]; -+ unsigned wlen; -+ unsigned rlen; -+}; -+ -+#define SI2158_A20_FIRMWARE "dvb-tuner-si2158-a20-01.fw" -+ -+#endif -diff -urN a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c ---- a/drivers/media/usb/dvb-usb-v2/dvbsky.c 2015-03-22 14:16:43.000000000 +0200 -+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c 2015-03-22 14:17:59.574225151 +0200 -@@ -3,12 +3,6 @@ - * - * Copyright (C) 2013 Max nibble - * -- * CIMax code is copied and modified from: -- * CIMax2(R) SP2 driver in conjunction with NetUp Dual DVB-S2 CI card -- * Copyright (C) 2009 NetUP Inc. -- * Copyright (C) 2009 Igor M. Liplianin -- * Copyright (C) 2009 Abylay Ospan -- * - * 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 -@@ -24,368 +18,95 @@ - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - --#include "dvb_ca_en50221.h" - #include "dvb_usb.h" --#include "dvbsky_m88ds3103.h" -- --static int dvbsky_debug; --module_param(dvbsky_debug, int, 0644); --MODULE_PARM_DESC(dvbsky_debug, "Activates dvbsky usb debugging (default:0)"); -- --#define DVBSKY_CI_CTL 0x04 --#define DVBSKY_CI_RD 1 -- --#define dprintk(args...) \ -- do { \ -- if (dvbsky_debug) \ -- printk(KERN_INFO "dvbsky_usb: " args); \ -- } while (0) -+#include "m88ds3103.h" -+#include "m88ts2022.h" -+#include "sp2.h" -+#include "si2168.h" -+#include "si2157.h" -+ -+#define DVBSKY_MSG_DELAY 0/*2000*/ -+#define DVBSKY_BUF_LEN 64 -+ -+static int dvb_usb_dvbsky_disable_rc; -+module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644); -+MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver."); - - DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); - - struct dvbsky_state { - struct mutex stream_mutex; -- u8 has_ci; -- u8 ci_attached; -- struct dvb_ca_en50221 ci; -- unsigned long next_status_checked_time; -- u8 ci_i2c_addr; -- u8 current_ci_flag; -- int ci_status; -+ u8 ibuf[DVBSKY_BUF_LEN]; -+ u8 obuf[DVBSKY_BUF_LEN]; -+ u8 last_lock; -+ struct i2c_client *i2c_client_demod; -+ struct i2c_client *i2c_client_tuner; -+ struct i2c_client *i2c_client_ci; -+ -+ /* fe hook functions*/ -+ int (*fe_set_voltage)(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage); -+ int (*fe_read_status)(struct dvb_frontend *fe, -+ fe_status_t *status); - }; - --static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) --{ -- struct dvbsky_state *state = d_to_priv(d); -- int ret; -- u8 obuf_pre[3] = { 0x37, 0, 0 }; -- u8 obuf_post[3] = { 0x36, 3, 0 }; -- dprintk("%s() -off \n", __func__); -- mutex_lock(&state->stream_mutex); -- ret = dvb_usbv2_generic_write(d, obuf_pre, 3); -- if (!ret && onoff) { -- msleep(10); -- ret = dvb_usbv2_generic_write(d, obuf_post, 3); -- dprintk("%s() -on \n", __func__); -- } -- mutex_unlock(&state->stream_mutex); -- return ret; --} -- --/* CI opertaions */ --static int dvbsky_ci_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, -- u8 *buf, int len) -+static int dvbsky_usb_generic_rw(struct dvb_usb_device *d, -+ u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) - { - int ret; -- struct i2c_msg msg[] = { -- { -- .addr = addr, -- .flags = 0, -- .buf = ®, -- .len = 1 -- }, { -- .addr = addr, -- .flags = I2C_M_RD, -- .buf = buf, -- .len = len -- } -- }; -- -- ret = i2c_transfer(i2c_adap, msg, 2); -- -- if (ret != 2) { -- dprintk("%s: error, Reg = 0x%02x, Status = %d\n", __func__, reg, ret); -- return -1; -- } -- return 0; --} -- --static int dvbsky_ci_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, -- u8 *buf, int len) --{ -- int ret; -- u8 buffer[len + 1]; -- -- struct i2c_msg msg = { -- .addr = addr, -- .flags = 0, -- .buf = &buffer[0], -- .len = len + 1 -- }; -- -- buffer[0] = reg; -- memcpy(&buffer[1], buf, len); -- -- ret = i2c_transfer(i2c_adap, &msg, 1); -- -- if (ret != 1) { -- dprintk("%s: error, Reg=[0x%02x], Status=%d\n", __func__, reg, ret); -- return -1; -- } -- return 0; --} -- --static int dvbsky_ci_op_cam(struct dvb_ca_en50221 *ci, int slot, -- u8 flag, u8 read, int addr, u8 data) --{ -- struct dvb_usb_device *d = ci->data; -- struct dvbsky_state *state = d_to_priv(d); -- u8 store; -- int ret; -- u8 command[4], respond[2], command_size, respond_size; -- -- /*dprintk("%s()\n", __func__);*/ -- if (0 != slot) -- return -EINVAL; -- -- if (state->current_ci_flag != flag) { -- ret = dvbsky_ci_read_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &store, 1); -- if (ret != 0) -- return ret; -- -- store &= ~0x0c; -- store |= flag; -- -- ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &store, 1); -- if (ret != 0) -- return ret; -- } -- state->current_ci_flag = flag; -- -- command[1] = (u8)((addr >> 8) & 0xff); /*high part of address*/ -- command[2] = (u8)(addr & 0xff); /*low part of address*/ -- if (read) { -- command[0] = 0x71; -- command_size = 3; -- respond_size = 2; -- } else { -- command[0] = 0x70; -- command[3] = data; -- command_size = 4; -- respond_size = 1; -- } -- ret = dvb_usbv2_generic_rw(d, command, command_size, respond, respond_size); -- -- return (read) ? respond[1] : 0; --} -- --static int dvbsky_ci_read_attribute_mem(struct dvb_ca_en50221 *ci, -- int slot, int addr) --{ -- return dvbsky_ci_op_cam(ci, slot, 0, DVBSKY_CI_RD, addr, 0); --} -- --static int dvbsky_ci_write_attribute_mem(struct dvb_ca_en50221 *ci, -- int slot, int addr, u8 data) --{ -- return dvbsky_ci_op_cam(ci, slot, 0, 0, addr, data); --} -- --static int dvbsky_ci_read_cam_ctl(struct dvb_ca_en50221 *ci, int slot, u8 addr) --{ -- return dvbsky_ci_op_cam(ci, slot, DVBSKY_CI_CTL, DVBSKY_CI_RD, addr, 0); --} -- --static int dvbsky_ci_write_cam_ctl(struct dvb_ca_en50221 *ci, int slot, -- u8 addr, u8 data) --{ -- return dvbsky_ci_op_cam(ci, slot, DVBSKY_CI_CTL, 0, addr, data); --} -- --static int dvbsky_ci_slot_reset(struct dvb_ca_en50221 *ci, int slot) --{ -- struct dvb_usb_device *d = ci->data; - struct dvbsky_state *state = d_to_priv(d); -- u8 buf = 0x80; -- int ret; -- dprintk("%s() slot=%d\n", __func__, slot); -- -- if (0 != slot) -- return -EINVAL; -- -- udelay(500); -- ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &buf, 1); -- -- if (ret != 0) -- return ret; -- -- udelay(500); -- -- buf = 0x00; -- ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &buf, 1); -- msleep(1000); -- dprintk("%s() slot=%d complete\n", __func__, slot); -- return 0; - --} -- --static int dvbsky_ci_slot_shutdown(struct dvb_ca_en50221 *ci, int slot) --{ -- /* not implemented */ -- dprintk("%s()\n", __func__); -- return 0; --} -+ mutex_lock(&d->usb_mutex); -+ if (wlen != 0) -+ memcpy(state->obuf, wbuf, wlen); - --static int dvbsky_ci_slot_ts_enable(struct dvb_ca_en50221 *ci, int slot) --{ -- struct dvb_usb_device *d = ci->data; -- struct dvbsky_state *state = d_to_priv(d); -- u8 buf; -- int ret; -+ ret = dvb_usbv2_generic_rw_locked(d, state->obuf, wlen, -+ state->ibuf, rlen); - -- dprintk("%s()\n", __func__); -- if (0 != slot) -- return -EINVAL; -+ if (!ret && (rlen != 0)) -+ memcpy(rbuf, state->ibuf, rlen); - -- dvbsky_ci_read_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &buf, 1); -- buf |= 0x60; -- -- ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &buf, 1); -+ mutex_unlock(&d->usb_mutex); - return ret; - } - --static int dvbsky_ci_poll_slot_status(struct dvb_ca_en50221 *ci, int slot, -- int open) --{ -- struct dvb_usb_device *d = ci->data; -- struct dvbsky_state *state = d_to_priv(d); -- int ret = 0; -- u8 buf = 0; -- /*dprintk("%s()\n", __func__);*/ -- -- /* CAM module INSERT/REMOVE processing. slow operation because of i2c -- * transfers */ -- if (time_after(jiffies, state->next_status_checked_time)) { -- ret = dvbsky_ci_read_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &buf, 1); -- -- /*dprintk("%s() status=%x\n", __func__, buf);*/ -- -- state->next_status_checked_time = jiffies -- + msecs_to_jiffies(1000); -- -- if (ret != 0) -- return 0; -- -- if (buf & 1) { -- state->ci_status = DVB_CA_EN50221_POLL_CAM_PRESENT | -- DVB_CA_EN50221_POLL_CAM_READY; -- } -- else -- state->ci_status = 0; -- } -- /*dprintk("%s() ret=%x\n", __func__, state->ci_status);*/ -- return state->ci_status; --} -- --static int dvbsky_ci_init(struct dvb_usb_device *d) -+static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) - { - struct dvbsky_state *state = d_to_priv(d); - int ret; -- u8 cimax_init[34] = { -- 0x00, /* module A control*/ -- 0x00, /* auto select mask high A */ -- 0x00, /* auto select mask low A */ -- 0x00, /* auto select pattern high A */ -- 0x00, /* auto select pattern low A */ -- 0x44, /* memory access time A */ -- 0x00, /* invert input A */ -- 0x00, /* RFU */ -- 0x00, /* RFU */ -- 0x00, /* module B control*/ -- 0x00, /* auto select mask high B */ -- 0x00, /* auto select mask low B */ -- 0x00, /* auto select pattern high B */ -- 0x00, /* auto select pattern low B */ -- 0x44, /* memory access time B */ -- 0x00, /* invert input B */ -- 0x00, /* RFU */ -- 0x00, /* RFU */ -- 0x00, /* auto select mask high Ext */ -- 0x00, /* auto select mask low Ext */ -- 0x00, /* auto select pattern high Ext */ -- 0x00, /* auto select pattern low Ext */ -- 0x00, /* RFU */ -- 0x02, /* destination - module A */ -- 0x01, /* power on (use it like store place) */ -- 0x00, /* RFU */ -- 0x00, /* int status read only */ -- 0x00, /* Max: Disable the interrupt in USB solution.*/ -- 0x05, /* EXTINT=active-high, INT=push-pull */ -- 0x00, /* USCG1 */ -- 0x04, /* ack active low */ -- 0x00, /* LOCK = 0 */ -- 0x22, /* serial mode, rising in, rising out, MSB first*/ -- 0x00 /* synchronization */ -- }; -- dprintk("%s()\n", __func__); -- state->current_ci_flag = 0xff; -- state->ci_status = 0; -- state->next_status_checked_time = jiffies + msecs_to_jiffies(1000); -- state->ci_i2c_addr = 0x40; -- -- state->ci.owner = THIS_MODULE; -- state->ci.read_attribute_mem = dvbsky_ci_read_attribute_mem; -- state->ci.write_attribute_mem = dvbsky_ci_write_attribute_mem; -- state->ci.read_cam_control = dvbsky_ci_read_cam_ctl; -- state->ci.write_cam_control = dvbsky_ci_write_cam_ctl; -- state->ci.slot_reset = dvbsky_ci_slot_reset; -- state->ci.slot_shutdown = dvbsky_ci_slot_shutdown; -- state->ci.slot_ts_enable = dvbsky_ci_slot_ts_enable; -- state->ci.poll_slot_status = dvbsky_ci_poll_slot_status; -- state->ci.data = d; -- -- ret = dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0, &cimax_init[0], 34); -- /* lock registers */ -- ret |= dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0x1f, &cimax_init[0x18], 1); -- /* power on slots */ -- ret |= dvbsky_ci_write_i2c(&d->i2c_adap, state->ci_i2c_addr, -- 0x18, &cimax_init[0x18], 1); -- if (0 != ret) -- return ret; -- -- ret = dvb_ca_en50221_init(&d->adapter[0].dvb_adap, &state->ci, 0, 1); -- if (ret) -- return ret; -- state->ci_attached = 1; -- dprintk("%s() complete.\n", __func__); -- return 0; --} -- --static void dvbsky_ci_release(struct dvb_usb_device *d) --{ -- struct dvbsky_state *state = d_to_priv(d); -- -- /* detach CI */ -- if (state->ci_attached) -- dvb_ca_en50221_release(&state->ci); -+ u8 obuf_pre[3] = { 0x37, 0, 0 }; -+ u8 obuf_post[3] = { 0x36, 3, 0 }; - -- return; -+ mutex_lock(&state->stream_mutex); -+ ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0); -+ if (!ret && onoff) { -+ msleep(20); -+ ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0); -+ } -+ mutex_unlock(&state->stream_mutex); -+ return ret; - } - - static int dvbsky_streaming_ctrl(struct dvb_frontend *fe, int onoff) - { - struct dvb_usb_device *d = fe_to_d(fe); -- /*dprintk("%s() %d\n", __func__, onoff);*/ -+ - return dvbsky_stream_ctrl(d, (onoff == 0) ? 0 : 1); - } - - /* GPIO */ - static int dvbsky_gpio_ctrl(struct dvb_usb_device *d, u8 gport, u8 value) - { -- u8 obuf[64], ibuf[64]; -+ int ret; -+ u8 obuf[3], ibuf[2]; -+ - obuf[0] = 0x0e; - obuf[1] = gport; - obuf[2] = value; -- return dvb_usbv2_generic_rw(d, obuf, 3, ibuf, 1); -+ ret = dvbsky_usb_generic_rw(d, obuf, 3, ibuf, 1); -+ if (ret) -+ dev_err(&d->udev->dev, "failed=%d\n", ret); -+ return ret; - } - - /* I2C */ -@@ -394,20 +115,23 @@ - { - struct dvb_usb_device *d = i2c_get_adapdata(adap); - int ret = 0; -- u8 ibuf[64], obuf[64]; -+ u8 ibuf[64], obuf[64]; - - if (mutex_lock_interruptible(&d->i2c_mutex) < 0) - return -EAGAIN; - - if (num > 2) { -- printk(KERN_ERR "dvbsky_usb: too many i2c messages[%d] than 2.", num); -+ dev_err(&d->udev->dev, -+ "too many i2c messages[%d], max 2.", num); - ret = -EOPNOTSUPP; - goto i2c_error; - } -- -- if(num == 1) { -+ -+ if (num == 1) { - if (msg[0].len > 60) { -- printk(KERN_ERR "dvbsky_usb: too many i2c bytes[%d] than 60.", msg[0].len); -+ dev_err(&d->udev->dev, -+ "too many i2c bytes[%d], max 60.", -+ msg[0].len); - ret = -EOPNOTSUPP; - goto i2c_error; - } -@@ -417,8 +141,10 @@ - obuf[1] = 0; - obuf[2] = msg[0].len; - obuf[3] = msg[0].addr; -- ret = dvb_usbv2_generic_rw(d, obuf, 4, ibuf, msg[0].len + 1); -- /*dprintk("%s(): read status = %d\n", __func__, ibuf[0]);*/ -+ ret = dvbsky_usb_generic_rw(d, obuf, 4, -+ ibuf, msg[0].len + 1); -+ if (ret) -+ dev_err(&d->udev->dev, "failed=%d\n", ret); - if (!ret) - memcpy(msg[0].buf, &ibuf[1], msg[0].len); - } else { -@@ -427,12 +153,16 @@ - obuf[1] = msg[0].addr; - obuf[2] = msg[0].len; - memcpy(&obuf[3], msg[0].buf, msg[0].len); -- ret = dvb_usbv2_generic_rw(d, obuf, msg[0].len + 3, ibuf, 1); -- /*dprintk("%s(): write status = %d\n", __func__, ibuf[0]);*/ -+ ret = dvbsky_usb_generic_rw(d, obuf, -+ msg[0].len + 3, ibuf, 1); -+ if (ret) -+ dev_err(&d->udev->dev, "failed=%d\n", ret); - } - } else { - if ((msg[0].len > 60) || (msg[1].len > 60)) { -- printk(KERN_ERR "dvbsky_usb: too many i2c bytes[w-%d][r-%d] than 60.", msg[0].len, msg[1].len); -+ dev_err(&d->udev->dev, -+ "too many i2c bytes[w-%d][r-%d], max 60.", -+ msg[0].len, msg[1].len); - ret = -EOPNOTSUPP; - goto i2c_error; - } -@@ -442,8 +172,11 @@ - obuf[2] = msg[1].len; - obuf[3] = msg[0].addr; - memcpy(&obuf[4], msg[0].buf, msg[0].len); -- ret = dvb_usbv2_generic_rw(d, obuf, msg[0].len + 4, ibuf, msg[1].len + 1); -- /*dprintk("%s(): write then read status = %d\n", __func__, ibuf[0]);*/ -+ ret = dvbsky_usb_generic_rw(d, obuf, -+ msg[0].len + 4, ibuf, msg[1].len + 1); -+ if (ret) -+ dev_err(&d->udev->dev, "failed=%d\n", ret); -+ - if (!ret) - memcpy(msg[1].buf, &ibuf[1], msg[1].len); - } -@@ -465,25 +198,16 @@ - #if IS_ENABLED(CONFIG_RC_CORE) - static int dvbsky_rc_query(struct dvb_usb_device *d) - { -- u32 code = 0xffff; -- u8 obuf[2], ibuf[2], toggle; -- int ret; -- obuf[0] = 0x10; -- ret = dvb_usbv2_generic_rw(d, obuf, 1, ibuf, 2); -- if(ret == 0) -- code = (ibuf[0] << 8) | ibuf[1]; -- -- if (code != 0xffff) { -- dprintk("rc code: %x", code); -- toggle = (code & 0x800) ? 1 : 0; -- code &= 0x3f; -- rc_keydown(d->rc_dev, code, toggle); -- } - return 0; - } - - static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) - { -+ if (dvb_usb_dvbsky_disable_rc) { -+ rc->map_name = NULL; -+ return 0; -+ } -+ - rc->allowed_protos = RC_BIT_RC5; - rc->query = dvbsky_rc_query; - rc->interval = 300; -@@ -493,34 +217,20 @@ - #define dvbsky_get_rc_config NULL - #endif - --static int dvbsky_sync_ctrl(struct dvb_frontend *fe) --{ -- struct dvb_usb_device *d = fe_to_d(fe); -- return dvbsky_stream_ctrl(d, 1); --} -- --static int dvbsky_usb_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) -+static int dvbsky_usb_set_voltage(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage) - { - struct dvb_usb_device *d = fe_to_d(fe); -+ struct dvbsky_state *state = d_to_priv(d); - u8 value; - - if (voltage == SEC_VOLTAGE_OFF) - value = 0; - else - value = 1; -- return dvbsky_gpio_ctrl(d, 0x80, value); --} -+ dvbsky_gpio_ctrl(d, 0x80, value); - --static int dvbsky_usb_ci_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) --{ -- struct dvb_usb_device *d = fe_to_d(fe); -- u8 value; -- -- if (voltage == SEC_VOLTAGE_OFF) -- value = 0; -- else -- value = 1; -- return dvbsky_gpio_ctrl(d, 0x00, value); -+ return state->fe_set_voltage(fe, voltage); - } - - static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6]) -@@ -539,25 +249,38 @@ - .flags = I2C_M_RD, - .buf = ibuf, - .len = 6, -- - } - }; -- -+ - if (i2c_transfer(&d->i2c_adap, msg, 2) == 2) - memcpy(mac, ibuf, 6); - -- printk(KERN_INFO "dvbsky_usb MAC address=%pM\n", mac); -- - return 0; - } - --static struct dvbsky_m88ds3103_config dvbsky_usb_ds3103_config = { -- .demod_address = 0x68, -- .ci_mode = 1, -- .pin_ctrl = 0x83, -- .ts_mode = 0, -- .start_ctrl = dvbsky_sync_ctrl, -- .set_voltage = dvbsky_usb_set_voltage, -+static int dvbsky_usb_read_status(struct dvb_frontend *fe, fe_status_t *status) -+{ -+ struct dvb_usb_device *d = fe_to_d(fe); -+ struct dvbsky_state *state = d_to_priv(d); -+ int ret; -+ -+ ret = state->fe_read_status(fe, status); -+ -+ /* it need resync slave fifo when signal change from unlock to lock.*/ -+ if ((*status & FE_HAS_LOCK) && (!state->last_lock)) -+ dvbsky_stream_ctrl(d, 1); -+ -+ state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; -+ return ret; -+} -+ -+static const struct m88ds3103_config dvbsky_s960_m88ds3103_config = { -+ .i2c_addr = 0x68, -+ .clock = 27000000, -+ .i2c_wr_max = 33, -+ .clock_out = 0, -+ .ts_mode = M88DS3103_TS_CI, -+ .agc = 0x99, - }; - - static int dvbsky_s960_attach(struct dvb_usb_adapter *adap) -@@ -565,36 +288,118 @@ - struct dvbsky_state *state = adap_to_priv(adap); - struct dvb_usb_device *d = adap_to_d(adap); - int ret = 0; -- -- dprintk("%s()\n", __func__); -- -- dvbsky_gpio_ctrl(d, 0x04, 1); -- -- dvbsky_gpio_ctrl(d, 0x83, 0); -- msleep(50); -- dvbsky_gpio_ctrl(d, 0x83, 1); -- msleep(20); -- -- adap->fe[0] = dvb_attach(dvbsky_m88ds3103_attach, -- &dvbsky_usb_ds3103_config, -- &d->i2c_adap); -+ /* demod I2C adapter */ -+ struct i2c_adapter *i2c_adapter; -+ struct i2c_client *client; -+ struct i2c_board_info info; -+ struct m88ts2022_config m88ts2022_config = { -+ .clock = 27000000, -+ }; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ -+ /* attach demod */ -+ adap->fe[0] = dvb_attach(m88ds3103_attach, -+ &dvbsky_s960_m88ds3103_config, -+ &d->i2c_adap, -+ &i2c_adapter); - if (!adap->fe[0]) { -- printk(KERN_ERR "dvbsky_s960_attach fail."); -+ dev_err(&d->udev->dev, "dvbsky_s960_attach fail.\n"); -+ ret = -ENODEV; -+ goto fail_attach; -+ } -+ -+ /* attach tuner */ -+ m88ts2022_config.fe = adap->fe[0]; -+ strlcpy(info.type, "m88ts2022", I2C_NAME_SIZE); -+ info.addr = 0x60; -+ info.platform_data = &m88ts2022_config; -+ request_module("m88ts2022"); -+ client = i2c_new_device(i2c_adapter, &info); -+ if (client == NULL || client->dev.driver == NULL) { -+ dvb_frontend_detach(adap->fe[0]); -+ ret = -ENODEV; -+ goto fail_attach; -+ } -+ -+ if (!try_module_get(client->dev.driver->owner)) { -+ i2c_unregister_device(client); -+ dvb_frontend_detach(adap->fe[0]); - ret = -ENODEV; -+ goto fail_attach; - } -- -- state->has_ci = 0; - -+ /* delegate signal strength measurement to tuner */ -+ adap->fe[0]->ops.read_signal_strength = -+ adap->fe[0]->ops.tuner_ops.get_rf_strength; -+ -+ /* hook fe: need to resync the slave fifo when signal locks. */ -+ state->fe_read_status = adap->fe[0]->ops.read_status; -+ adap->fe[0]->ops.read_status = dvbsky_usb_read_status; -+ -+ /* hook fe: LNB off/on is control by Cypress usb chip. */ -+ state->fe_set_voltage = adap->fe[0]->ops.set_voltage; -+ adap->fe[0]->ops.set_voltage = dvbsky_usb_set_voltage; -+ -+ state->i2c_client_tuner = client; -+ -+fail_attach: - return ret; - } - --static struct dvbsky_m88ds3103_config dvbsky_usb_ds3103_ci_config = { -- .demod_address = 0x68, -- .ci_mode = 2, -- .pin_ctrl = 0x82, -- .ts_mode = 0, -- .start_ctrl = dvbsky_sync_ctrl, -- .set_voltage = dvbsky_usb_ci_set_voltage, -+static int dvbsky_usb_ci_set_voltage(struct dvb_frontend *fe, -+ fe_sec_voltage_t voltage) -+{ -+ struct dvb_usb_device *d = fe_to_d(fe); -+ struct dvbsky_state *state = d_to_priv(d); -+ u8 value; -+ -+ if (voltage == SEC_VOLTAGE_OFF) -+ value = 0; -+ else -+ value = 1; -+ dvbsky_gpio_ctrl(d, 0x00, value); -+ -+ return state->fe_set_voltage(fe, voltage); -+} -+ -+static int dvbsky_ci_ctrl(void *priv, u8 read, int addr, -+ u8 data, int *mem) -+{ -+ struct dvb_usb_device *d = priv; -+ int ret = 0; -+ u8 command[4], respond[2], command_size, respond_size; -+ -+ command[1] = (u8)((addr >> 8) & 0xff); /*high part of address*/ -+ command[2] = (u8)(addr & 0xff); /*low part of address*/ -+ if (read) { -+ command[0] = 0x71; -+ command_size = 3; -+ respond_size = 2; -+ } else { -+ command[0] = 0x70; -+ command[3] = data; -+ command_size = 4; -+ respond_size = 1; -+ } -+ ret = dvbsky_usb_generic_rw(d, command, command_size, -+ respond, respond_size); -+ if (ret) -+ goto err; -+ if (read) -+ *mem = respond[1]; -+ return ret; -+err: -+ dev_err(&d->udev->dev, "ci control failed=%d\n", ret); -+ return ret; -+} -+ -+static const struct m88ds3103_config dvbsky_s960c_m88ds3103_config = { -+ .i2c_addr = 0x68, -+ .clock = 27000000, -+ .i2c_wr_max = 33, -+ .clock_out = 0, -+ .ts_mode = M88DS3103_TS_CI, -+ .agc = 0x99, - }; - - static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) -@@ -602,64 +407,319 @@ - struct dvbsky_state *state = adap_to_priv(adap); - struct dvb_usb_device *d = adap_to_d(adap); - int ret = 0; -- -- dvbsky_gpio_ctrl(d, 0x04, 1); -- -- dvbsky_gpio_ctrl(d, 0x83, 0); -- msleep(50); -- dvbsky_gpio_ctrl(d, 0x83, 1); -- msleep(20); -- -- adap->fe[0] = dvb_attach(dvbsky_m88ds3103_attach, -- &dvbsky_usb_ds3103_ci_config, -- &d->i2c_adap); -+ /* demod I2C adapter */ -+ struct i2c_adapter *i2c_adapter; -+ struct i2c_client *client_tuner, *client_ci; -+ struct i2c_board_info info; -+ struct sp2_config sp2_config; -+ struct m88ts2022_config m88ts2022_config = { -+ .clock = 27000000, -+ }; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ -+ /* attach demod */ -+ adap->fe[0] = dvb_attach(m88ds3103_attach, -+ &dvbsky_s960c_m88ds3103_config, -+ &d->i2c_adap, -+ &i2c_adapter); - if (!adap->fe[0]) { -- printk(KERN_ERR "dvbsky_s960c_attach fail."); -+ dev_err(&d->udev->dev, "dvbsky_s960ci_attach fail.\n"); -+ ret = -ENODEV; -+ goto fail_attach; -+ } -+ -+ /* attach tuner */ -+ m88ts2022_config.fe = adap->fe[0]; -+ strlcpy(info.type, "m88ts2022", I2C_NAME_SIZE); -+ info.addr = 0x60; -+ info.platform_data = &m88ts2022_config; -+ request_module("m88ts2022"); -+ client_tuner = i2c_new_device(i2c_adapter, &info); -+ if (client_tuner == NULL || client_tuner->dev.driver == NULL) { -+ ret = -ENODEV; -+ goto fail_tuner_device; -+ } -+ -+ if (!try_module_get(client_tuner->dev.driver->owner)) { -+ ret = -ENODEV; -+ goto fail_tuner_module; -+ } -+ -+ /* attach ci controller */ -+ memset(&sp2_config, 0, sizeof(sp2_config)); -+ sp2_config.dvb_adap = &adap->dvb_adap; -+ sp2_config.priv = d; -+ sp2_config.ci_control = dvbsky_ci_ctrl; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "sp2", I2C_NAME_SIZE); -+ info.addr = 0x40; -+ info.platform_data = &sp2_config; -+ request_module("sp2"); -+ client_ci = i2c_new_device(&d->i2c_adap, &info); -+ if (client_ci == NULL || client_ci->dev.driver == NULL) { - ret = -ENODEV; -+ goto fail_ci_device; - } -- -- state->has_ci = 1; - -+ if (!try_module_get(client_ci->dev.driver->owner)) { -+ ret = -ENODEV; -+ goto fail_ci_module; -+ } -+ -+ /* delegate signal strength measurement to tuner */ -+ adap->fe[0]->ops.read_signal_strength = -+ adap->fe[0]->ops.tuner_ops.get_rf_strength; -+ -+ /* hook fe: need to resync the slave fifo when signal locks. */ -+ state->fe_read_status = adap->fe[0]->ops.read_status; -+ adap->fe[0]->ops.read_status = dvbsky_usb_read_status; -+ -+ /* hook fe: LNB off/on is control by Cypress usb chip. */ -+ state->fe_set_voltage = adap->fe[0]->ops.set_voltage; -+ adap->fe[0]->ops.set_voltage = dvbsky_usb_ci_set_voltage; -+ -+ state->i2c_client_tuner = client_tuner; -+ state->i2c_client_ci = client_ci; -+ return ret; -+fail_ci_module: -+ i2c_unregister_device(client_ci); -+fail_ci_device: -+ module_put(client_tuner->dev.driver->owner); -+fail_tuner_module: -+ i2c_unregister_device(client_tuner); -+fail_tuner_device: -+ dvb_frontend_detach(adap->fe[0]); -+fail_attach: -+ return ret; -+} -+ -+static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap) -+{ -+ struct dvbsky_state *state = adap_to_priv(adap); -+ struct dvb_usb_device *d = adap_to_d(adap); -+ int ret = 0; -+ struct i2c_adapter *i2c_adapter; -+ struct i2c_client *client_demod, *client_tuner, *client_ci; -+ struct i2c_board_info info; -+ struct si2168_config si2168_config; -+ struct si2157_config si2157_config; -+ struct sp2_config sp2_config; -+ -+ /* attach demod */ -+ memset(&si2168_config, 0, sizeof(si2168_config)); -+ si2168_config.i2c_adapter = &i2c_adapter; -+ si2168_config.fe = &adap->fe[0]; -+ si2168_config.ts_mode = SI2168_TS_PARALLEL; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "si2168", I2C_NAME_SIZE); -+ info.addr = 0x64; -+ info.platform_data = &si2168_config; -+ -+ request_module(info.type); -+ client_demod = i2c_new_device(&d->i2c_adap, &info); -+ if (client_demod == NULL || -+ client_demod->dev.driver == NULL) -+ goto fail_demod_device; -+ if (!try_module_get(client_demod->dev.driver->owner)) -+ goto fail_demod_module; -+ -+ /* attach tuner */ -+ memset(&si2157_config, 0, sizeof(si2157_config)); -+ si2157_config.fe = adap->fe[0]; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "si2157", I2C_NAME_SIZE); -+ info.addr = 0x60; -+ info.platform_data = &si2157_config; -+ -+ request_module(info.type); -+ client_tuner = i2c_new_device(i2c_adapter, &info); -+ if (client_tuner == NULL || -+ client_tuner->dev.driver == NULL) -+ goto fail_tuner_device; -+ if (!try_module_get(client_tuner->dev.driver->owner)) -+ goto fail_tuner_module; -+ -+ /* attach ci controller */ -+ memset(&sp2_config, 0, sizeof(sp2_config)); -+ sp2_config.dvb_adap = &adap->dvb_adap; -+ sp2_config.priv = d; -+ sp2_config.ci_control = dvbsky_ci_ctrl; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "sp2", I2C_NAME_SIZE); -+ info.addr = 0x40; -+ info.platform_data = &sp2_config; -+ -+ request_module(info.type); -+ client_ci = i2c_new_device(&d->i2c_adap, &info); -+ -+ if (client_ci == NULL || client_ci->dev.driver == NULL) -+ goto fail_ci_device; -+ -+ if (!try_module_get(client_ci->dev.driver->owner)) -+ goto fail_ci_module; -+ -+ state->i2c_client_demod = client_demod; -+ state->i2c_client_tuner = client_tuner; -+ state->i2c_client_ci = client_ci; -+ return ret; -+fail_ci_module: -+ i2c_unregister_device(client_ci); -+fail_ci_device: -+ module_put(client_tuner->dev.driver->owner); -+fail_tuner_module: -+ i2c_unregister_device(client_tuner); -+fail_tuner_device: -+ module_put(client_demod->dev.driver->owner); -+fail_demod_module: -+ i2c_unregister_device(client_demod); -+fail_demod_device: -+ ret = -ENODEV; -+ return ret; -+} -+ -+static int dvbsky_t330_attach(struct dvb_usb_adapter *adap) -+{ -+ struct dvbsky_state *state = adap_to_priv(adap); -+ struct dvb_usb_device *d = adap_to_d(adap); -+ int ret = 0; -+ struct i2c_adapter *i2c_adapter; -+ struct i2c_client *client_demod, *client_tuner; -+ struct i2c_board_info info; -+ struct si2168_config si2168_config; -+ struct si2157_config si2157_config; -+ -+ /* attach demod */ -+ memset(&si2168_config, 0, sizeof(si2168_config)); -+ si2168_config.i2c_adapter = &i2c_adapter; -+ si2168_config.fe = &adap->fe[0]; -+ si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "si2168", I2C_NAME_SIZE); -+ info.addr = 0x64; -+ info.platform_data = &si2168_config; -+ -+ request_module(info.type); -+ client_demod = i2c_new_device(&d->i2c_adap, &info); -+ if (client_demod == NULL || -+ client_demod->dev.driver == NULL) -+ goto fail_demod_device; -+ if (!try_module_get(client_demod->dev.driver->owner)) -+ goto fail_demod_module; -+ -+ /* attach tuner */ -+ memset(&si2157_config, 0, sizeof(si2157_config)); -+ si2157_config.fe = adap->fe[0]; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "si2157", I2C_NAME_SIZE); -+ info.addr = 0x60; -+ info.platform_data = &si2157_config; -+ -+ request_module(info.type); -+ client_tuner = i2c_new_device(i2c_adapter, &info); -+ if (client_tuner == NULL || -+ client_tuner->dev.driver == NULL) -+ goto fail_tuner_device; -+ if (!try_module_get(client_tuner->dev.driver->owner)) -+ goto fail_tuner_module; -+ -+ state->i2c_client_demod = client_demod; -+ state->i2c_client_tuner = client_tuner; -+ return ret; -+fail_tuner_module: -+ i2c_unregister_device(client_tuner); -+fail_tuner_device: -+ module_put(client_demod->dev.driver->owner); -+fail_demod_module: -+ i2c_unregister_device(client_demod); -+fail_demod_device: -+ ret = -ENODEV; - return ret; - } - - static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) - { -+ dvbsky_gpio_ctrl(d, 0x04, 1); -+ msleep(20); -+ dvbsky_gpio_ctrl(d, 0x83, 0); -+ dvbsky_gpio_ctrl(d, 0xc0, 1); -+ msleep(100); -+ dvbsky_gpio_ctrl(d, 0x83, 1); -+ dvbsky_gpio_ctrl(d, 0xc0, 0); -+ msleep(50); -+ - return WARM; - } - - static int dvbsky_init(struct dvb_usb_device *d) - { - struct dvbsky_state *state = d_to_priv(d); -- int ret; - - /* use default interface */ -+ /* - ret = usb_set_interface(d->udev, 0, 0); - if (ret) - return ret; -- -+ */ - mutex_init(&state->stream_mutex); -- -- /* attach CI */ -- if (state->has_ci) { -- dvbsky_gpio_ctrl(d, 0xc0, 1); -- msleep(100); -- dvbsky_gpio_ctrl(d, 0xc0, 0); -- msleep(50); -- state->ci_attached = 0; -- ret = dvbsky_ci_init(d); -- if (ret) -- return ret; -- } -+ -+ state->last_lock = 0; -+ - return 0; - } - - static void dvbsky_exit(struct dvb_usb_device *d) - { -- return dvbsky_ci_release(d); -+ struct dvbsky_state *state = d_to_priv(d); -+ struct i2c_client *client; -+ -+ client = state->i2c_client_tuner; -+ /* remove I2C tuner */ -+ if (client) { -+ module_put(client->dev.driver->owner); -+ i2c_unregister_device(client); -+ } -+ client = state->i2c_client_demod; -+ /* remove I2C demod */ -+ if (client) { -+ module_put(client->dev.driver->owner); -+ i2c_unregister_device(client); -+ } -+ client = state->i2c_client_ci; -+ /* remove I2C ci */ -+ if (client) { -+ module_put(client->dev.driver->owner); -+ i2c_unregister_device(client); -+ } - } - - /* DVB USB Driver stuff */ -+static struct dvb_usb_device_properties dvbsky_s960_props = { -+ .driver_name = KBUILD_MODNAME, -+ .owner = THIS_MODULE, -+ .adapter_nr = adapter_nr, -+ .size_of_priv = sizeof(struct dvbsky_state), -+ -+ .generic_bulk_ctrl_endpoint = 0x01, -+ .generic_bulk_ctrl_endpoint_response = 0x81, -+ .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, -+ -+ .i2c_algo = &dvbsky_i2c_algo, -+ .frontend_attach = dvbsky_s960_attach, -+ .init = dvbsky_init, -+ .get_rc_config = dvbsky_get_rc_config, -+ .streaming_ctrl = dvbsky_streaming_ctrl, -+ .identify_state = dvbsky_identify_state, -+ .exit = dvbsky_exit, -+ .read_mac_address = dvbsky_read_mac_addr, -+ -+ .num_adapters = 1, -+ .adapter = { -+ { -+ .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), -+ } -+ } -+}; -+ - static struct dvb_usb_device_properties dvbsky_s960c_props = { - .driver_name = KBUILD_MODNAME, - .owner = THIS_MODULE, -@@ -668,6 +728,7 @@ - - .generic_bulk_ctrl_endpoint = 0x01, - .generic_bulk_ctrl_endpoint_response = 0x81, -+ .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, - - .i2c_algo = &dvbsky_i2c_algo, - .frontend_attach = dvbsky_s960c_attach, -@@ -676,6 +737,7 @@ - .streaming_ctrl = dvbsky_streaming_ctrl, - .identify_state = dvbsky_identify_state, - .exit = dvbsky_exit, -+ .read_mac_address = dvbsky_read_mac_addr, - - .num_adapters = 1, - .adapter = { -@@ -685,7 +747,7 @@ - } - }; - --static struct dvb_usb_device_properties dvbsky_s960_props = { -+static struct dvb_usb_device_properties dvbsky_t680c_props = { - .driver_name = KBUILD_MODNAME, - .owner = THIS_MODULE, - .adapter_nr = adapter_nr, -@@ -693,9 +755,37 @@ - - .generic_bulk_ctrl_endpoint = 0x01, - .generic_bulk_ctrl_endpoint_response = 0x81, -+ .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, - - .i2c_algo = &dvbsky_i2c_algo, -- .frontend_attach = dvbsky_s960_attach, -+ .frontend_attach = dvbsky_t680c_attach, -+ .init = dvbsky_init, -+ .get_rc_config = dvbsky_get_rc_config, -+ .streaming_ctrl = dvbsky_streaming_ctrl, -+ .identify_state = dvbsky_identify_state, -+ .exit = dvbsky_exit, -+ .read_mac_address = dvbsky_read_mac_addr, -+ -+ .num_adapters = 1, -+ .adapter = { -+ { -+ .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), -+ } -+ } -+}; -+ -+static struct dvb_usb_device_properties dvbsky_t330_props = { -+ .driver_name = KBUILD_MODNAME, -+ .owner = THIS_MODULE, -+ .adapter_nr = adapter_nr, -+ .size_of_priv = sizeof(struct dvbsky_state), -+ -+ .generic_bulk_ctrl_endpoint = 0x01, -+ .generic_bulk_ctrl_endpoint_response = 0x81, -+ .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, -+ -+ .i2c_algo = &dvbsky_i2c_algo, -+ .frontend_attach = dvbsky_t330_attach, - .init = dvbsky_init, - .get_rc_config = dvbsky_get_rc_config, - .streaming_ctrl = dvbsky_streaming_ctrl, -@@ -712,10 +802,22 @@ - }; - - static const struct usb_device_id dvbsky_id_table[] = { -- { DVB_USB_DEVICE(0x0572, 0x960c, -- &dvbsky_s960c_props, "DVBSky S960CI", RC_MAP_DVBSKY) }, - { DVB_USB_DEVICE(0x0572, 0x6831, - &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, -+ { DVB_USB_DEVICE(0x0572, 0x960c, -+ &dvbsky_s960c_props, "DVBSky S960CI", RC_MAP_DVBSKY) }, -+ { DVB_USB_DEVICE(0x0572, 0x680c, -+ &dvbsky_t680c_props, "DVBSky T680CI", RC_MAP_DVBSKY) }, -+ { DVB_USB_DEVICE(0x0572, 0x0320, -+ &dvbsky_t330_props, "DVBSky T330", RC_MAP_DVBSKY) }, -+ { DVB_USB_DEVICE(USB_VID_TECHNOTREND, -+ USB_PID_TECHNOTREND_TVSTICK_CT2_4400, -+ &dvbsky_t330_props, "TechnoTrend TVStick CT2-4400", -+ RC_MAP_TT_1500) }, -+ { DVB_USB_DEVICE(USB_VID_TECHNOTREND, -+ USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI, -+ &dvbsky_t680c_props, "TechnoTrend TT-connect CT2-4650 CI", -+ RC_MAP_TT_1500) }, - { } - }; - MODULE_DEVICE_TABLE(usb, dvbsky_id_table); -@@ -735,5 +837,5 @@ - module_usb_driver(dvbsky_usb_driver); - - MODULE_AUTHOR("Max nibble "); --MODULE_DESCRIPTION("Driver for DVBSky USB2.0"); -+MODULE_DESCRIPTION("Driver for DVBSky USB"); - MODULE_LICENSE("GPL"); -diff -urN a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig ---- a/drivers/media/usb/dvb-usb-v2/Kconfig 2015-03-22 14:16:43.000000000 +0200 -+++ b/drivers/media/usb/dvb-usb-v2/Kconfig 2015-03-22 14:17:59.574225151 +0200 -@@ -151,5 +151,8 @@ - tristate "DVBSky USB2.0 support" - depends on DVB_USB_V2 - select DVB_DVBSKY_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_SP2 if MEDIA_SUBDRV_AUTOSELECT -+ select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT - help - Say Y here to support the USB receivers from DVBSky. -diff -urN a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c ---- a/drivers/media/usb/em28xx/em28xx-dvb.c 2014-11-02 15:07:11.000000000 +0200 -+++ b/drivers/media/usb/em28xx/em28xx-dvb.c 2015-03-22 14:25:19.230238544 +0200 -@@ -814,7 +814,9 @@ - .clock = 27000000, - .i2c_wr_max = 33, - .clock_out = 0, -- .ts_mode = M88DS3103_TS_PARALLEL_16, -+ .ts_mode = M88DS3103_TS_PARALLEL, -+ .ts_clk = 16000, -+ .ts_clk_pol = 1, - .agc = 0x99, - }; - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-226-pctv292e-devices.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-226-pctv292e-devices.patch deleted file mode 100644 index 89ecc2e17d..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-226-pctv292e-devices.patch +++ /dev/null @@ -1,192 +0,0 @@ -diff -rupN a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c ---- a/drivers/media/usb/em28xx/em28xx-cards.c 2015-02-23 14:54:18.000000000 +0100 -+++ b/drivers/media/usb/em28xx/em28xx-cards.c 2015-02-12 16:46:54.000000000 +0100 -@@ -448,6 +448,18 @@ static struct em28xx_reg_seq speedlink_v - { -1, -1, -1, -1}, - }; - -+static struct em28xx_reg_seq pctv_292e[] = { -+ {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0}, -+ {0x0d, 0xff, 0xff, 950}, -+ {EM2874_R80_GPIO_P0_CTRL, 0xbd, 0xff, 100}, -+ {EM2874_R80_GPIO_P0_CTRL, 0xfd, 0xff, 410}, -+ {EM2874_R80_GPIO_P0_CTRL, 0x7d, 0xff, 300}, -+ {EM2874_R80_GPIO_P0_CTRL, 0x7c, 0xff, 60}, -+ {0x0d, 0x42, 0xff, 50}, -+ {EM2874_R5F_TS_ENABLE, 0x85, 0xff, 0}, -+ {-1, -1, -1, -1}, -+}; -+ - /* - * Button definitions - */ -@@ -2157,6 +2169,17 @@ struct em28xx_board em28xx_boards[] = { - .has_dvb = 1, - .ir_codes = RC_MAP_PINNACLE_PCTV_HD, - }, -+ /* 2013:025f PCTV tripleStick (292e). -+ * Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2157 */ -+ [EM28178_BOARD_PCTV_292E] = { -+ .name = "PCTV tripleStick (292e)", -+ .def_i2c_bus = 1, -+ .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ, -+ .tuner_type = TUNER_ABSENT, -+ .tuner_gpio = pctv_292e, -+ .has_dvb = 1, -+ .ir_codes = RC_MAP_PINNACLE_PCTV_HD, -+ }, - }; - EXPORT_SYMBOL_GPL(em28xx_boards); - -@@ -2330,6 +2353,8 @@ struct usb_device_id em28xx_id_table[] = - .driver_info = EM2765_BOARD_SPEEDLINK_VAD_LAPLACE }, - { USB_DEVICE(0x2013, 0x0258), - .driver_info = EM28178_BOARD_PCTV_461E }, -+ { USB_DEVICE(0x2013, 0x025f), -+ .driver_info = EM28178_BOARD_PCTV_292E }, - { }, - }; - MODULE_DEVICE_TABLE(usb, em28xx_id_table); -diff -rupN a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c ---- a/drivers/media/usb/em28xx/em28xx-dvb.c 2014-11-02 14:07:11.000000000 +0100 -+++ b/drivers/media/usb/em28xx/em28xx-dvb.c 2015-02-24 16:39:35.000000000 +0100 -@@ -53,6 +53,8 @@ - #include "mb86a20s.h" - #include "m88ds3103.h" - #include "m88ts2022.h" -+#include "si2168.h" -+#include "si2157.h" - - MODULE_AUTHOR("Mauro Carvalho Chehab "); - MODULE_LICENSE("GPL"); -@@ -91,6 +93,7 @@ struct em28xx_dvb { - struct semaphore pll_mutex; - bool dont_attach_fe1; - int lna_gpio; -+ struct i2c_client *i2c_client_demod; - struct i2c_client *i2c_client_tuner; - }; - -@@ -719,6 +722,21 @@ static int em28xx_pctv_290e_set_lna(stru - #endif - } - -+static int em28xx_pctv_292e_set_lna(struct dvb_frontend *fe) -+{ -+ struct dtv_frontend_properties *c = &fe->dtv_property_cache; -+ struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv; -+ struct em28xx *dev = i2c_bus->dev; -+ u8 lna; -+ -+ if (c->lna == 1) -+ lna = 0x01; -+ else -+ lna = 0x00; -+ -+ return em28xx_write_reg_bits(dev, EM2874_R80_GPIO_P0_CTRL, lna, 0x01); -+} -+ - static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) - { - /* Values extracted from a USB trace of the Terratec Windows driver */ -@@ -1413,6 +1431,66 @@ static int em28xx_dvb_init(struct em28xx - } - } - break; -+ case EM28178_BOARD_PCTV_292E: -+ { -+ struct i2c_adapter *adapter; -+ struct i2c_client *client; -+ struct i2c_board_info info; -+ struct si2168_config si2168_config; -+ struct si2157_config si2157_config; -+ -+ /* attach demod */ -+ memset(&si2168_config, 0, sizeof(si2168_config)); -+ si2168_config.i2c_adapter = &adapter; -+ si2168_config.fe = &dvb->fe[0]; -+ si2168_config.ts_mode = SI2168_TS_PARALLEL; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "si2168", I2C_NAME_SIZE); -+ info.addr = 0x64; -+ info.platform_data = &si2168_config; -+ request_module(info.type); -+ client = i2c_new_device(&dev->i2c_adap[dev->def_i2c_bus], &info); -+ if (client == NULL || client->dev.driver == NULL) { -+ result = -ENODEV; -+ goto out_free; -+ } -+ -+ if (!try_module_get(client->dev.driver->owner)) { -+ i2c_unregister_device(client); -+ result = -ENODEV; -+ goto out_free; -+ } -+ -+ dvb->i2c_client_demod = client; -+ -+ /* attach tuner */ -+ memset(&si2157_config, 0, sizeof(si2157_config)); -+ si2157_config.fe = dvb->fe[0]; -+ memset(&info, 0, sizeof(struct i2c_board_info)); -+ strlcpy(info.type, "si2157", I2C_NAME_SIZE); -+ info.addr = 0x60; -+ info.platform_data = &si2157_config; -+ request_module(info.type); -+ client = i2c_new_device(adapter, &info); -+ if (client == NULL || client->dev.driver == NULL) { -+ module_put(dvb->i2c_client_demod->dev.driver->owner); -+ i2c_unregister_device(dvb->i2c_client_demod); -+ result = -ENODEV; -+ goto out_free; -+ } -+ -+ if (!try_module_get(client->dev.driver->owner)) { -+ i2c_unregister_device(client); -+ module_put(dvb->i2c_client_demod->dev.driver->owner); -+ i2c_unregister_device(dvb->i2c_client_demod); -+ result = -ENODEV; -+ goto out_free; -+ } -+ -+ dvb->i2c_client_tuner = client; -+ dvb->fe[0]->ops.set_lna = em28xx_pctv_292e_set_lna; -+ } -+ break; - default: - em28xx_errdev("/2: The frontend of your DVB/ATSC card" - " isn't supported yet\n"); -@@ -1485,6 +1563,10 @@ static int em28xx_dvb_fini(struct em28xx - } - - i2c_release_client(dvb->i2c_client_tuner); -+ /* remove I2C demod */ -+ if (dvb->i2c_client_demod) { -+ i2c_unregister_device(dvb->i2c_client_demod); -+ } - em28xx_unregister_dvb(dvb); - kfree(dvb); - dev->dvb = NULL; -diff -rupN a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h ---- a/drivers/media/usb/em28xx/em28xx.h 2014-11-02 14:07:11.000000000 +0100 -+++ b/drivers/media/usb/em28xx/em28xx.h 2015-02-23 15:28:11.000000000 +0100 -@@ -137,6 +137,7 @@ - #define EM2874_BOARD_KWORLD_UB435Q_V2 90 - #define EM2765_BOARD_SPEEDLINK_VAD_LAPLACE 91 - #define EM28178_BOARD_PCTV_461E 92 -+#define EM28178_BOARD_PCTV_292E 94 - - /* Limits minimum and default number of buffers */ - #define EM28XX_MIN_BUF 4 -diff -rupN a/drivers/media/usb/em28xx/Kconfig b/drivers/media/usb/em28xx/Kconfig ---- a/drivers/media/usb/em28xx/Kconfig 2014-11-02 14:07:11.000000000 +0100 -+++ b/drivers/media/usb/em28xx/Kconfig 2015-02-12 16:46:54.000000000 +0100 -@@ -55,6 +55,8 @@ config VIDEO_EM28XX_DVB - select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT - select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT - select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT -+ select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT - ---help--- - This adds support for DVB cards based on the - Empiatech em28xx chips. diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-250-fix-dvbsky.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-250-fix-dvbsky.patch deleted file mode 100644 index f72b138978..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-250-fix-dvbsky.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -Naur linux-cuboxi-3.14-ea83bda.orig/drivers/media/usb/dvb-usb-v2/dvbsky.c linux-cuboxi-3.14-ea83bda/drivers/media/usb/dvb-usb-v2/dvbsky.c ---- linux-cuboxi-3.14-ea83bda.orig/drivers/media/usb/dvb-usb-v2/dvbsky.c 2015-05-12 07:55:11.516604741 +0200 -+++ linux-cuboxi-3.14-ea83bda/drivers/media/usb/dvb-usb-v2/dvbsky.c 2015-05-12 07:58:19.750871492 +0200 -@@ -280,7 +280,11 @@ - .i2c_wr_max = 33, - .clock_out = 0, - .ts_mode = M88DS3103_TS_CI, -+ .ts_clk = 16000, -+ .ts_clk_pol = 0, - .agc = 0x99, -+ .lnb_hv_pol = 1, -+ .lnb_en_pol = 1, - }; - - static int dvbsky_s960_attach(struct dvb_usb_adapter *adap) diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-301-tbs2910_dtb_fan.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-301-tbs2910_dtb_fan.patch deleted file mode 100644 index 7e73c1ccfc..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-301-tbs2910_dtb_fan.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/arch/arm/boot/dts/imx6q-tbs2910.dts 2016-09-17 15:27:28.950265621 +0200 -+++ b/arch/arm/boot/dts/imx6q-tbs2910.dts 2016-09-17 15:28:25.984089674 +0200 -@@ -84,17 +84,14 @@ - gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "heartbeat"; - }; -- }; - -- fan { -- compatible = "gpio-fan"; -- pinctrl-names = "default"; -- pinctrl-0 = <&pinctrl_gpio_fan>; -- gpios = <&gpio3 28 GPIO_ACTIVE_HIGH>; -- gpio-fan,speed-map = <0 0 -- 3000 1>; -+ fan { -+ gpios = <&gpio3 28 0>; -+ default-state = "off"; -+ }; - }; - -+ - sound { - compatible = "fsl,imx-audio-sgtl5000"; - model = "imx-sgtl5000"; diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-310-udoo-lvds-support.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-310-udoo-lvds-support.patch deleted file mode 100644 index 476eb6fa19..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-310-udoo-lvds-support.patch +++ /dev/null @@ -1,340 +0,0 @@ -From 21ecd35bd9e5030a6b33a41dea3a2653609b09d7 Mon Sep 17 00:00:00 2001 -From: Peter Vicman -Date: Thu, 24 Mar 2016 15:53:56 +0100 -Subject: [PATCH] dts: udoo: add both lvds displays - ---- - arch/arm/boot/dts/Makefile | 4 +++ - arch/arm/boot/dts/imx6dl-udoo-15lvds.dts | 54 +++++++++++++++++++++++++++++ - arch/arm/boot/dts/imx6dl-udoo-7lvds.dts | 49 +++++++++++++++++++++++++++ - arch/arm/boot/dts/imx6q-udoo-15lvds.dts | 58 ++++++++++++++++++++++++++++++++ - arch/arm/boot/dts/imx6q-udoo-7lvds.dts | 53 +++++++++++++++++++++++++++++ - arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 +-- - 6 files changed, 221 insertions(+), 2 deletions(-) - create mode 100644 arch/arm/boot/dts/imx6dl-udoo-15lvds.dts - create mode 100644 arch/arm/boot/dts/imx6dl-udoo-7lvds.dts - create mode 100644 arch/arm/boot/dts/imx6q-udoo-15lvds.dts - create mode 100644 arch/arm/boot/dts/imx6q-udoo-7lvds.dts - -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 08ff98a..ffffb8c 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -167,6 +167,8 @@ dtb-$(CONFIG_ARCH_MXC) += \ - imx6dl-sabresd-pf200.dtb \ - imx6dl-sabresd-hdcp.dtb \ - imx6dl-udoo.dtb \ -+ imx6dl-udoo-7lvds.dtb \ -+ imx6dl-udoo-15lvds.dtb \ - imx6dl-sbc-fx6.dtb \ - imx6dl-sbc-fx6m.dtb \ - imx6dl-wandboard.dtb \ -@@ -192,6 +194,8 @@ dtb-$(CONFIG_ARCH_MXC) += \ - imx6q-sbc-fx6m.dtb \ - imx6q-sbc6x.dtb \ - imx6q-udoo.dtb \ -+ imx6q-udoo-7lvds.dtb \ -+ imx6q-udoo-15lvds.dtb \ - imx6q-wandboard.dtb \ - imx6q-tbs2910.dtb \ - imx6sl-evk.dtb \ -diff --git a/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts b/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts -new file mode 100644 -index 0000000..ac189cc ---- /dev/null -+++ b/arch/arm/boot/dts/imx6dl-udoo-15lvds.dts -@@ -0,0 +1,63 @@ -+/* -+ * Copyright 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam -+ * Author: Ettore Chimenti -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+/dts-v1/; -+#include "imx6dl.dtsi" -+#include "imx6qdl-udoo.dtsi" -+ -+/ { -+ model = "Udoo i.MX6 Dual-lite Board"; -+ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; -+ -+ mxcfb2: fb@1 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ interface_pix_fmt = "RGB24"; -+ mode_str = "1360x768M@60"; -+ default_bpp = <32>; -+ int_clk = <0>; -+ late_init = <1>; -+ status = "okay"; -+ }; -+ -+ regulators { -+ reg_lcd0_pwr: regulator@1 { -+ status = "okay"; -+ }; -+ -+ reg_lcd0_backlight: regulator@2 { -+ status = "okay"; -+ }; -+ }; -+}; -+ -+&dcic1 { -+ status = "disabled"; -+}; -+ -+&dcic2 { -+ dcic_id = <0>; -+ status = "okay"; -+}; -+ -+&ldb { -+ status = "okay"; -+ -+ lvds-channel@0 { -+ status = "okay"; -+ fsl,data-width = <24>; -+ -+ display-timings { -+ native-mode = <&timing2>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts b/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts -new file mode 100644 -index 0000000..da6ba4d ---- /dev/null -+++ b/arch/arm/boot/dts/imx6dl-udoo-7lvds.dts -@@ -0,0 +1,58 @@ -+/* -+ * Copyright 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam -+ * Author: Ettore Chimenti -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+/dts-v1/; -+#include "imx6dl.dtsi" -+#include "imx6qdl-udoo.dtsi" -+ -+/ { -+ model = "Udoo i.MX6 Dual-lite Board"; -+ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; -+ -+ mxcfb2: fb@1 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ interface_pix_fmt = "RGB666"; -+ mode_str = "800x480M@60"; -+ default_bpp = <32>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "okay"; -+ }; -+ -+ regulators { -+ reg_lcd0_pwr: regulator@1 { -+ status = "okay"; -+ }; -+ -+ reg_lcd0_backlight: regulator@2 { -+ status = "okay"; -+ }; -+ }; -+}; -+ -+&dcic1 { -+ status = "disabled"; -+}; -+ -+&dcic2 { -+ dcic_id = <0>; -+ status = "okay"; -+}; -+ -+&ldb { -+ status = "okay"; -+ -+ lvds-channel@0 { -+ status = "okay"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/imx6q-udoo-15lvds.dts b/arch/arm/boot/dts/imx6q-udoo-15lvds.dts -new file mode 100644 -index 0000000..35e7651 ---- /dev/null -+++ b/arch/arm/boot/dts/imx6q-udoo-15lvds.dts -@@ -0,0 +1,67 @@ -+/* -+ * Copyright 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam -+ * Author: Ettore Chimenti -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+/dts-v1/; -+#include "imx6q.dtsi" -+#include "imx6qdl-udoo.dtsi" -+ -+/ { -+ model = "Udoo i.MX6 Quad Board"; -+ compatible = "udoo,imx6q-udoo", "fsl,imx6q"; -+ -+ mxcfb2: fb@1 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ interface_pix_fmt = "RGB24"; -+ mode_str = "1360x768M@60"; -+ default_bpp = <32>; -+ int_clk = <0>; -+ late_init = <1>; -+ status = "okay"; -+ }; -+ -+ regulators { -+ reg_lcd0_pwr: regulator@1 { -+ status = "okay"; -+ }; -+ -+ reg_lcd0_backlight: regulator@2 { -+ status = "okay"; -+ }; -+ }; -+}; -+ -+&sata { -+ status = "okay"; -+}; -+ -+&dcic1 { -+ status = "disabled"; -+}; -+ -+&dcic2 { -+ dcic_id = <0>; -+ status = "okay"; -+}; -+ -+&ldb { -+ status = "okay"; -+ -+ lvds-channel@0 { -+ status = "okay"; -+ fsl,data-width = <24>; -+ -+ display-timings { -+ native-mode = <&timing2>; -+ }; -+ }; -+}; -diff --git a/arch/arm/boot/dts/imx6q-udoo-7lvds.dts b/arch/arm/boot/dts/imx6q-udoo-7lvds.dts -new file mode 100644 -index 0000000..e5f3125 ---- /dev/null -+++ b/arch/arm/boot/dts/imx6q-udoo-7lvds.dts -@@ -0,0 +1,62 @@ -+/* -+ * Copyright 2013 Freescale Semiconductor, Inc. -+ * -+ * Author: Fabio Estevam -+ * Author: Ettore Chimenti -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+/dts-v1/; -+#include "imx6q.dtsi" -+#include "imx6qdl-udoo.dtsi" -+ -+/ { -+ model = "Udoo i.MX6 Quad Board"; -+ compatible = "udoo,imx6q-udoo", "fsl,imx6q"; -+ -+ mxcfb2: fb@1 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "ldb"; -+ interface_pix_fmt = "RGB666"; -+ mode_str = "800x480M@60"; -+ default_bpp = <32>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "okay"; -+ }; -+ -+ regulators { -+ reg_lcd0_pwr: regulator@1 { -+ status = "okay"; -+ }; -+ -+ reg_lcd0_backlight: regulator@2 { -+ status = "okay"; -+ }; -+ }; -+}; -+ -+&sata { -+ status = "okay"; -+}; -+ -+&dcic1 { -+ status = "disabled"; -+}; -+ -+&dcic2 { -+ dcic_id = <0>; -+ status = "okay"; -+}; -+ -+&ldb { -+ status = "okay"; -+ -+ lvds-channel@0 { -+ status = "okay"; -+ }; -+}; -diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi -index 2f6ec9a..7dca6db 100755 ---- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi -@@ -202,7 +202,7 @@ - &dcic2 { - dcic_id = <1>; - dcic_mux = "dcic-lvds1"; -- status = "okay"; -+ status = "disabled"; - }; - - &gpc { // General power controller -@@ -254,9 +254,10 @@ - vsync-len = <2>; - }; - -- timing2: 1366x768 { // 15.6" display -+ // IPU needs X and Y by modulo 8 -+ timing2: 1360x768 { // 15.6" display - clock-frequency = <76000000>; -- hactive = <1366>; -+ hactive = <1360>; - vactive = <768>; - hback-porch = <220>; - hfront-porch = <40>; diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-320-cuboxi_led_heartbeat.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-320-cuboxi_led_heartbeat.patch deleted file mode 100644 index e65e4bd519..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-320-cuboxi_led_heartbeat.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi 2014-11-25 19:23:06.332485391 +0100 -+++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi 2014-11-25 19:23:24.675776865 +0100 -@@ -31,6 +31,7 @@ - label = "imx6:red:front"; - max-brightness = <248>; - pwms = <&pwm1 0 50000>; -+ linux,default-trigger = "heartbeat"; - }; - }; - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-704-Support-for-Ubiquiti-WifiStation.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-704-Support-for-Ubiquiti-WifiStation.patch deleted file mode 100644 index 7932c0723b..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-704-Support-for-Ubiquiti-WifiStation.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 62330f8f9b6105bfe201f52b7ed86ea6ce3d5901 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 8 Sep 2013 10:33:51 +0100 -Subject: [PATCH] Add Ubiquiti WifiStation USB id to ath9k wifi driver - ---- - drivers/net/wireless/ath/ath9k/hif_usb.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c -index 75a6376..8cb8d8d 100644 ---- a/drivers/net/wireless/ath/ath9k/hif_usb.c -+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c -@@ -37,9 +37,11 @@ - { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ - { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ - { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ -+ { USB_DEVICE(0x0cf3, 0xb002) }, /* Ubiquiti WifiStation */ - { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ - { USB_DEVICE(0x0cf3, 0xb002) }, /* Ubiquiti WifiStation */ - { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ -+ { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ - - { USB_DEVICE(0x0cf3, 0x7015), - .driver_info = AR9287_USB }, /* Atheros */ --- -1.8.4 - diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch deleted file mode 100644 index 816af3b9d2..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-705-Support-for-Buffalo-WLI-UC-G300HP-V1.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/net/wireless/rt2x00/rt2800usb.c 2013-10-08 15:14:44.844047190 +0200 -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c 2013-10-08 15:15:00.279904575 +0200 -@@ -976,6 +976,7 @@ - { USB_DEVICE(0x0411, 0x015d) }, - { USB_DEVICE(0x0411, 0x016f) }, - { USB_DEVICE(0x0411, 0x01a2) }, -+ { USB_DEVICE(0x0411, 0x01a8) }, - { USB_DEVICE(0x0411, 0x01ee) }, - /* Corega */ - { USB_DEVICE(0x07aa, 0x002f) }, diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-706-Sitecom-N300.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-706-Sitecom-N300.patch deleted file mode 100644 index 9f52eeb2d5..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-706-Sitecom-N300.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur linux-3.10.16/drivers/staging/rtl8712/usb_intf.c linux-3.10.16.patch/drivers/staging/rtl8712/usb_intf.c ---- linux-3.10.16/drivers/staging/rtl8712/usb_intf.c 2013-10-14 01:08:56.000000000 +0200 -+++ linux-3.10.16.patch/drivers/staging/rtl8712/usb_intf.c 2013-10-16 13:27:44.032951265 +0200 -@@ -92,6 +92,7 @@ - {USB_DEVICE(0x0DF6, 0x005B)}, - {USB_DEVICE(0x0DF6, 0x005D)}, - {USB_DEVICE(0x0DF6, 0x0063)}, -+ {USB_DEVICE(0x0DF6, 0x006C)}, - /* Sweex */ - {USB_DEVICE(0x177F, 0x0154)}, - /* Thinkware */ diff --git a/projects/imx6/patches/linux/3.14-mx6-sr/linux-800-from-openbricks.patch b/projects/imx6/patches/linux/3.14-mx6-sr/linux-800-from-openbricks.patch deleted file mode 100644 index b9dbab6f86..0000000000 --- a/projects/imx6/patches/linux/3.14-mx6-sr/linux-800-from-openbricks.patch +++ /dev/null @@ -1,4560 +0,0 @@ -https://github.com/OpenBricks/openbricks/tree/krypton-glibc -https://github.com/OpenBricks/openbricks/tree/krypton-glibc/config/platforms/arm/imx6/machines/cuboxi/packages/linux/patches -https://github.com/OpenBricks/openbricks/tree/731d2788a4f5924cdf80314709dc303a43b5c3f5/config/platforms/arm/imx6/machines/cuboxi/packages/linux/patches - -============================================================== -file 0001-MXC-CEC-Remove-superflous-guards-that-could-even-bre.patch -============================================================== - -From 90d153b9d46ad06a4a513902d3bb72d23c45bdcc Mon Sep 17 00:00:00 2001 -From: wolfgar -Date: Mon, 31 Oct 2016 10:58:44 +0100 -Subject: [PATCH] MXC-CEC: Remove superflous guards that could even break - invocation from mxc-hdmi - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 20 ++------------------ - 1 file changed, 2 insertions(+), 18 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index ac70a0c..f787274 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -83,8 +83,6 @@ struct hdmi_cec_event { - - static LIST_HEAD(head); - --static int hdmi_cec_ready = 0; --static int hdmi_cec_started; - static int hdmi_cec_major; - static struct class *hdmi_cec_class; - static struct hdmi_cec_priv hdmi_cec_data; -@@ -314,7 +312,7 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - mutex_unlock(&hdmi_cec_data.lock); - return -EACCES; - } -- /* Ensure that there is only one writer who is the only listener of tx_cec_queue */ -+ /* Ensure that there is only one writer who is the unique listener of tx_cec_queue */ - if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) { - mutex_unlock(&hdmi_cec_data.lock); - return -EBUSY; -@@ -358,13 +356,11 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - return ret; - } - -+ - void hdmi_cec_start_device(void) - { - u8 val; - -- if (!hdmi_cec_ready || hdmi_cec_started) -- return; -- - val = hdmi_readb(HDMI_MC_CLKDIS); - val &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; - hdmi_writeb(val, HDMI_MC_CLKDIS); -@@ -377,11 +373,7 @@ void hdmi_cec_start_device(void) - hdmi_writeb(val, HDMI_CEC_MASK); - hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); - hdmi_cec_data.link_status = hdmi_readb(HDMI_PHY_STAT0) & 0x02; -- mutex_lock(&hdmi_cec_data.lock); - hdmi_cec_data.cec_state = true; -- mutex_unlock(&hdmi_cec_data.lock); -- -- hdmi_cec_started = 1; - } - EXPORT_SYMBOL(hdmi_cec_start_device); - -@@ -389,9 +381,6 @@ void hdmi_cec_stop_device(void) - { - u8 val; - -- if (!hdmi_cec_ready || !hdmi_cec_started) -- return; -- - hdmi_writeb(0x10, HDMI_CEC_CTRL); - val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_ARB_LOST | \ - HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | HDMI_IH_CEC_STAT0_DONE; -@@ -401,11 +390,7 @@ void hdmi_cec_stop_device(void) - val = hdmi_readb(HDMI_MC_CLKDIS); - val |= HDMI_MC_CLKDIS_CECCLK_DISABLE; - hdmi_writeb(val, HDMI_MC_CLKDIS); -- mutex_lock(&hdmi_cec_data.lock); - hdmi_cec_data.cec_state = false; -- mutex_unlock(&hdmi_cec_data.lock); -- -- hdmi_cec_started = 0; - } - EXPORT_SYMBOL(hdmi_cec_stop_device); - -@@ -579,7 +564,6 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - INIT_DELAYED_WORK(&hdmi_cec_data.hdmi_cec_work, mxc_hdmi_cec_worker); - - dev_info(&pdev->dev, "HDMI CEC initialized\n"); -- hdmi_cec_ready = 1; - goto out; - - err_out_class: --- -1.9.1 - - -============================================================== -file 0002-MXC-CEC-Flush-pending-events-at-close.patch -============================================================== - -From 3309b17795c3c9cc1b457caf154f0f2e87121aa3 Mon Sep 17 00:00:00 2001 -From: wolfgar -Date: Mon, 31 Oct 2016 10:59:44 +0100 -Subject: [PATCH] MXC-CEC: Flush pending events at close - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index f787274..210d764 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -465,11 +465,18 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - */ - static int hdmi_cec_release(struct inode *inode, struct file *filp) - { -+ struct hdmi_cec_event *event, *tmp_event; - mutex_lock(&hdmi_cec_data.lock); - if (open_count) { - open_count = 0; - hdmi_cec_data.cec_state = false; - hdmi_cec_data.Logical_address = 15; -+ -+ /* Flush eventual events which have not been read by user space */ -+ list_for_each_entry_safe(event, tmp_event, &head, list) { -+ list_del(&event->list); -+ vfree(event); -+ } - } - mutex_unlock(&hdmi_cec_data.lock); - --- -1.9.1 - - -============================================================== -file 0003-MXC-CEC-Remove-embedded-logics-from-the-driver-so-th.patch -============================================================== - -From 66ca526351cb7fe726e8e7ae19818e09e63fa19d Mon Sep 17 00:00:00 2001 -From: wolfgar -Date: Mon, 31 Oct 2016 11:00:46 +0100 -Subject: [PATCH] MXC-CEC: Remove embedded logics from the driver so that - libcec is responsible for all this work - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 34 ++++++---------------------------- - 1 file changed, 6 insertions(+), 28 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index 210d764..da34f27 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -132,7 +132,7 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - - void mxc_hdmi_cec_handle(u16 cec_stat) - { -- u8 val = 0, i = 0; -+ u8 i = 0; - struct hdmi_cec_event *event = NULL; - /*The current transmission is successful (for initiator only).*/ - if (!open_count) -@@ -167,27 +167,14 @@ void mxc_hdmi_cec_handle(u16 cec_stat) - } - /*An error is detected on cec line (for initiator only). */ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_INIT) { -- mutex_lock(&hdmi_cec_data.lock); -- hdmi_cec_data.send_error++; -- if (hdmi_cec_data.send_error > 2) { -- pr_err("%s:Re-transmission is attempted more than 2 times!\n", __func__); -- hdmi_cec_data.send_error = 0; -- mutex_unlock(&hdmi_cec_data.lock); -- hdmi_cec_data.tx_answer = cec_stat; -- wake_up(&tx_cec_queue); -- return; -- } -- for (i = 0; i < hdmi_cec_data.msg_len; i++) -- hdmi_writeb(hdmi_cec_data.last_msg[i], HDMI_CEC_TX_DATA0+i); -- hdmi_writeb(hdmi_cec_data.msg_len, HDMI_CEC_TX_CNT); -- val = hdmi_readb(HDMI_CEC_CTRL); -- val |= 0x01; -- hdmi_writeb(val, HDMI_CEC_CTRL); -- mutex_unlock(&hdmi_cec_data.lock); -+ hdmi_cec_data.tx_answer = cec_stat; -+ wake_up(&tx_cec_queue); -+ return; - } - /*A frame is not acknowledged in a directly addressed message. Or a frame is negatively acknowledged in - a broadcast message (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_NACK) { -+ hdmi_cec_data.send_error++; - hdmi_cec_data.tx_answer = cec_stat; - wake_up(&tx_cec_queue); - } -@@ -403,7 +390,7 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - u_long arg) - { - int ret = 0, status = 0; -- u8 val = 0, msg = 0; -+ u8 val = 0; - struct mxc_edid_cfg hdmi_edid_cfg; - pr_debug("function : %s\n", __func__); - if (!open_count) -@@ -427,15 +414,6 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - hdmi_writeb(0, HDMI_CEC_ADDR_L); - } else - ret = -EINVAL; -- /*Send Polling message with same source and destination address*/ -- if (0 == ret && 15 != hdmi_cec_data.Logical_address) { -- msg = (hdmi_cec_data.Logical_address << 4)|hdmi_cec_data.Logical_address; -- hdmi_writeb(1, HDMI_CEC_TX_CNT); -- hdmi_writeb(msg, HDMI_CEC_TX_DATA0); -- val = hdmi_readb(HDMI_CEC_CTRL); -- val |= 0x01; -- hdmi_writeb(val, HDMI_CEC_CTRL); -- } - mutex_unlock(&hdmi_cec_data.lock); - break; - case HDMICEC_IOC_STARTDEVICE: --- -1.9.1 - - -============================================================== -file 0004-MXC-CEC-Remove-some-more-unneeded-guards-variables-a.patch -============================================================== - -From 6e0fb54a084d886f1c55660485bbdde3dea57057 Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:37 +0100 -Subject: [PATCH] MXC-CEC: Remove some more unneeded guards, variables and - comments - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 82 ++++++++++++++----------------------- - 1 file changed, 31 insertions(+), 51 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index da34f27..ffaf20c 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -47,24 +47,22 @@ - #include "mxc_hdmi-cec.h" - - --#define MAX_MESSAGE_LEN 17 -+#define MAX_MESSAGE_LEN 17 - --#define MESSAGE_TYPE_RECEIVE_SUCCESS 1 -+#define MESSAGE_TYPE_RECEIVE_SUCCESS 1 - #define MESSAGE_TYPE_NOACK 2 --#define MESSAGE_TYPE_DISCONNECTED 3 -+#define MESSAGE_TYPE_DISCONNECTED 3 - #define MESSAGE_TYPE_CONNECTED 4 --#define MESSAGE_TYPE_SEND_SUCCESS 5 -+#define MESSAGE_TYPE_SEND_SUCCESS 5 - --#define CEC_TX_INPROGRESS -1 --#define CEC_TX_AVAIL 0 -+#define CEC_TX_INPROGRESS -1 -+#define CEC_TX_AVAIL 0 - - struct hdmi_cec_priv { - int receive_error; - int send_error; - u8 Logical_address; - bool cec_state; -- u8 last_msg[MAX_MESSAGE_LEN]; -- u8 msg_len; - int tx_answer; - u16 latest_cec_stat; - u8 link_status; -@@ -223,11 +221,6 @@ static void mxc_hdmi_cec_worker(struct work_struct *work) - hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); - } - --/*! -- * @brief open function for cec file operation -- * -- * @return 0 on success or negative error code on error -- */ - static int hdmi_cec_open(struct inode *inode, struct file *filp) - { - mutex_lock(&hdmi_cec_data.lock); -@@ -247,10 +240,9 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - loff_t *ppos) - { - struct hdmi_cec_event *event = NULL; -+ - pr_debug("function : %s\n", __func__); - -- if (!open_count) -- return -ENODEV; - mutex_lock(&hdmi_cec_data.lock); - if (false == hdmi_cec_data.cec_state) { - mutex_unlock(&hdmi_cec_data.lock); -@@ -292,8 +284,6 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - - pr_debug("function : %s\n", __func__); - -- if (!open_count) -- return -ENODEV; - mutex_lock(&hdmi_cec_data.lock); - if (false == hdmi_cec_data.cec_state) { - mutex_unlock(&hdmi_cec_data.lock); -@@ -321,8 +311,6 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - val = hdmi_readb(HDMI_CEC_CTRL); - val |= 0x01; - hdmi_writeb(val, HDMI_CEC_CTRL); -- memcpy(hdmi_cec_data.last_msg, msg, msg_len); -- hdmi_cec_data.msg_len = msg_len; - mutex_unlock(&hdmi_cec_data.lock); - - ret = wait_event_interruptible_timeout(tx_cec_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); -@@ -336,9 +324,9 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - /* msg correctly sent */ - ret = msg_len; - else -- ret = -EIO; -+ ret = -EIO; - -- tx_out: -+tx_out: - hdmi_cec_data.tx_answer = CEC_TX_AVAIL; - return ret; - } -@@ -381,20 +369,15 @@ void hdmi_cec_stop_device(void) - } - EXPORT_SYMBOL(hdmi_cec_stop_device); - --/*! -- * @brief IO ctrl function for vpu file operation -- * @param cmd IO ctrl command -- * @return 0 on success or negative error code on error -- */ - static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - u_long arg) - { - int ret = 0, status = 0; - u8 val = 0; - struct mxc_edid_cfg hdmi_edid_cfg; -+ - pr_debug("function : %s\n", __func__); -- if (!open_count) -- return -ENODEV; -+ - switch (cmd) { - case HDMICEC_IOC_SETLOGICALADDRESS: - mutex_lock(&hdmi_cec_data.lock); -@@ -437,13 +420,12 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - return ret; - } - --/*! -- * @brief Release function for vpu file operation -- * @return 0 on success or negative error code on error -- */ - static int hdmi_cec_release(struct inode *inode, struct file *filp) - { - struct hdmi_cec_event *event, *tmp_event; -+ -+ pr_debug("function : %s\n", __func__); -+ - mutex_lock(&hdmi_cec_data.lock); - if (open_count) { - open_count = 0; -@@ -473,7 +455,7 @@ static unsigned int hdmi_cec_poll(struct file *file, poll_table *wait) - mask = (POLLOUT | POLLWRNORM); - mutex_lock(&hdmi_cec_data.lock); - if (!list_empty(&head)) -- mask |= (POLLIN | POLLRDNORM); -+ mask |= (POLLIN | POLLRDNORM); - mutex_unlock(&hdmi_cec_data.lock); - return mask; - } -@@ -499,14 +481,14 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - - hdmi_cec_major = register_chrdev(hdmi_cec_major, "mxc_hdmi_cec", &hdmi_cec_fops); - if (hdmi_cec_major < 0) { -- dev_err(&pdev->dev, "hdmi_cec: unable to get a major for HDMI CEC\n"); -+ dev_err(&pdev->dev, "Unable to get a major for HDMI CEC\n"); - err = -EBUSY; - goto out; - } - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (unlikely(res == NULL)) { -- dev_err(&pdev->dev, "hdmi_cec:No HDMI irq line provided\n"); -+ dev_err(&pdev->dev, "No HDMI irq line provided\n"); - goto err_out_chrdev; - } - spin_lock_init(&hdmi_cec_data.irq_lock); -@@ -514,7 +496,7 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - err = devm_request_irq(&pdev->dev, irq, mxc_hdmi_cec_isr, IRQF_SHARED, - dev_name(&pdev->dev), &hdmi_cec_data); - if (err < 0) { -- dev_err(&pdev->dev, "hdmi_cec:Unable to request irq: %d\n", err); -+ dev_err(&pdev->dev, "Unable to request irq: %d\n", err); - goto err_out_chrdev; - } - -@@ -524,8 +506,8 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - goto err_out_chrdev; - } - -- temp_class = device_create(hdmi_cec_class, NULL, MKDEV(hdmi_cec_major, 0), -- NULL, "mxc_hdmi_cec"); -+ temp_class = device_create(hdmi_cec_class, NULL, -+ MKDEV(hdmi_cec_major, 0), NULL, "mxc_hdmi_cec"); - if (IS_ERR(temp_class)) { - err = PTR_ERR(temp_class); - goto err_out_class; -@@ -533,7 +515,7 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - - pinctrl = devm_pinctrl_get_select_default(&pdev->dev); - if (IS_ERR(pinctrl)) { -- dev_err(&pdev->dev, "can't get/select CEC pinctrl\n"); -+ dev_err(&pdev->dev, "Can't get/select CEC pinctrl\n"); - goto err_out_class; - } - -@@ -562,14 +544,13 @@ out: - - static int hdmi_cec_dev_remove(struct platform_device *pdev) - { -- if (hdmi_cec_data.cec_state) -- hdmi_cec_stop_device(); -- if (hdmi_cec_major > 0) { -- device_destroy(hdmi_cec_class, MKDEV(hdmi_cec_major, 0)); -- class_destroy(hdmi_cec_class); -- unregister_chrdev(hdmi_cec_major, "mxc_hdmi_cec"); -- hdmi_cec_major = 0; --} -+ hdmi_cec_stop_device(); -+ -+ device_destroy(hdmi_cec_class, MKDEV(hdmi_cec_major, 0)); -+ class_destroy(hdmi_cec_class); -+ unregister_chrdev(hdmi_cec_major, "mxc_hdmi_cec"); -+ hdmi_cec_major = 0; -+ - return 0; - } - -@@ -583,9 +564,9 @@ static struct platform_driver mxc_hdmi_cec_driver = { - .probe = hdmi_cec_dev_probe, - .remove = hdmi_cec_dev_remove, - .driver = { -- .name = "mxc_hdmi_cec", -- .of_match_table = imx_hdmi_cec_match, -- }, -+ .name = "mxc_hdmi_cec", -+ .of_match_table = imx_hdmi_cec_match, -+ }, - }; - - module_platform_driver(mxc_hdmi_cec_driver); -@@ -594,4 +575,3 @@ MODULE_AUTHOR("Freescale Semiconductor, Inc."); - MODULE_DESCRIPTION("Linux HDMI CEC driver for Freescale i.MX/MXC"); - MODULE_LICENSE("GPL"); - MODULE_ALIAS("platform:mxc_hdmi_cec"); -- --- -1.9.1 - - -============================================================== -file 0005-MXC-CEC-Restructure-code-to-avoid-race-conditions.patch -============================================================== - -From 52969de0f8a8afb87ccc43fe568e11f9a3cfccdf Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:38 +0100 -Subject: [PATCH] MXC-CEC: Restructure code to avoid race conditions - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 258 ++++++++++++++++++++++++------------ - drivers/video/mxc/mxc_hdmi.c | 7 +- - include/linux/mfd/mxc-hdmi-core.h | 1 + - 3 files changed, 175 insertions(+), 91 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index ffaf20c..f62bcbc 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -58,16 +58,32 @@ - #define CEC_TX_INPROGRESS -1 - #define CEC_TX_AVAIL 0 - -+/* These flags must not collide with HDMI_IH_CEC_STAT0_xxxx */ -+#define CEC_STAT0_EX_CONNECTED 0x0100 -+#define CEC_STAT0_EX_DISCONNECTED 0x0200 -+ -+#define CEC_STAT0_MASK_ALL (HDMI_IH_CEC_STAT0_WAKEUP | \ -+ HDMI_IH_CEC_STAT0_ERROR_FOLL | \ -+ HDMI_IH_CEC_STAT0_ARB_LOST | \ -+ HDMI_IH_CEC_STAT0_ERROR_INIT | \ -+ HDMI_IH_CEC_STAT0_NACK | \ -+ HDMI_IH_CEC_STAT0_EOM | \ -+ HDMI_IH_CEC_STAT0_DONE) -+ -+#define CEC_STAT0_MASK_DEFAULT (HDMI_IH_CEC_STAT0_WAKEUP | \ -+ HDMI_IH_CEC_STAT0_ERROR_FOLL | \ -+ HDMI_IH_CEC_STAT0_ARB_LOST) -+ - struct hdmi_cec_priv { - int receive_error; - int send_error; - u8 Logical_address; -- bool cec_state; -+ u8 cec_state; - int tx_answer; -- u16 latest_cec_stat; -+ u32 cec_stat0; - u8 link_status; - spinlock_t irq_lock; -- struct delayed_work hdmi_cec_work; -+ struct work_struct hdmi_cec_work; - struct mutex lock; - }; - -@@ -81,68 +97,79 @@ struct hdmi_cec_event { - - static LIST_HEAD(head); - -+static int hdmi_cec_irq; - static int hdmi_cec_major; - static struct class *hdmi_cec_class; - static struct hdmi_cec_priv hdmi_cec_data; - static u8 open_count; -+static u8 want_start; -+static u8 link_status; -+static u8 is_initialized; - - static wait_queue_head_t hdmi_cec_queue; - static wait_queue_head_t tx_cec_queue; - -+ -+static u32 get_hpd_stat(struct hdmi_cec_priv *hdmi_cec) -+{ -+ u32 cec_stat0 = 0; -+ -+ if (hdmi_cec->link_status ^ link_status) { -+ hdmi_cec->link_status = link_status; -+ if (hdmi_cec->link_status) -+ cec_stat0 = CEC_STAT0_EX_CONNECTED; -+ else -+ cec_stat0 = CEC_STAT0_EX_DISCONNECTED; -+ } -+ -+ return cec_stat0; -+} -+ - static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - { - struct hdmi_cec_priv *hdmi_cec = data; -- u16 cec_stat = 0; - unsigned long flags; -- u8 phy_stat0; -+ u8 cec_stat; - - spin_lock_irqsave(&hdmi_cec->irq_lock, flags); - -- hdmi_writeb(0x7f, HDMI_IH_MUTE_CEC_STAT0); -+ hdmi_writeb(CEC_STAT0_MASK_ALL, HDMI_IH_MUTE_CEC_STAT0); - -- cec_stat = hdmi_readb(HDMI_IH_CEC_STAT0); -+ cec_stat = hdmi_readb(HDMI_IH_CEC_STAT0) & CEC_STAT0_MASK_ALL; - hdmi_writeb(cec_stat, HDMI_IH_CEC_STAT0); -- phy_stat0 = hdmi_readb(HDMI_PHY_STAT0) & 0x02; -- if (hdmi_cec->link_status ^ phy_stat0) { -- /* HPD value changed */ -- hdmi_cec->link_status = phy_stat0; -- if (hdmi_cec->link_status) -- cec_stat |= 0x80; /* Connected */ -- else -- cec_stat |= 0x100; /* Disconnected */ -- } -- if ((cec_stat & (HDMI_IH_CEC_STAT0_ERROR_INIT | \ -- HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | \ -- HDMI_IH_CEC_STAT0_DONE | 0x180)) == 0) { -+ -+ if ((cec_stat & ~CEC_STAT0_MASK_DEFAULT) == 0) { -+ if (hdmi_cec->cec_state) -+ hdmi_writeb(CEC_STAT0_MASK_DEFAULT, HDMI_IH_MUTE_CEC_STAT0); - spin_unlock_irqrestore(&hdmi_cec->irq_lock, flags); -- return IRQ_HANDLED; -+ return IRQ_NONE; - } -- pr_debug("HDMI CEC interrupt received\n"); -- /* FIXME : there is a race with latest_cec_stat */ -- hdmi_cec->latest_cec_stat = cec_stat ; - -- schedule_delayed_work(&(hdmi_cec->hdmi_cec_work), msecs_to_jiffies(20)); -+ pr_debug("HDMI-CEC: interrupt received\n"); -+ -+ hdmi_cec->cec_stat0 = cec_stat | get_hpd_stat(hdmi_cec); -+ schedule_work(&hdmi_cec->hdmi_cec_work); - - spin_unlock_irqrestore(&hdmi_cec->irq_lock, flags); - - return IRQ_HANDLED; - } - --void mxc_hdmi_cec_handle(u16 cec_stat) -+static void mxc_hdmi_cec_handle(u32 cec_stat) - { - u8 i = 0; - struct hdmi_cec_event *event = NULL; -- /*The current transmission is successful (for initiator only).*/ -+ - if (!open_count) - return; - -+ /*The current transmission is successful (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_DONE) { - hdmi_cec_data.tx_answer = cec_stat; - wake_up(&tx_cec_queue); - } - /*EOM is detected so that the received data is ready in the receiver data buffer*/ - if (cec_stat & HDMI_IH_CEC_STAT0_EOM) { -- hdmi_writeb(0x02, HDMI_IH_CEC_STAT0); - event = vmalloc(sizeof(struct hdmi_cec_event)); - if (NULL == event) { - pr_err("%s: Not enough memory!\n", __func__); -@@ -181,8 +208,8 @@ void mxc_hdmi_cec_handle(u16 cec_stat) - hdmi_cec_data.receive_error++; - } - /*HDMI cable connected*/ -- if (cec_stat & 0x80) { -- pr_info("HDMI link connected\n"); -+ if (cec_stat & CEC_STAT0_EX_CONNECTED) { -+ pr_info("HDMI-CEC: link connected\n"); - event = vmalloc(sizeof(struct hdmi_cec_event)); - if (NULL == event) { - pr_err("%s: Not enough memory\n", __func__); -@@ -196,8 +223,8 @@ void mxc_hdmi_cec_handle(u16 cec_stat) - wake_up(&hdmi_cec_queue); - } - /*HDMI cable disconnected*/ -- if (cec_stat & 0x100) { -- pr_info("HDMI link disconnected\n"); -+ if (cec_stat & CEC_STAT0_EX_DISCONNECTED) { -+ pr_info("HDMI-CEC: link disconnected\n"); - event = vmalloc(sizeof(struct hdmi_cec_event)); - if (NULL == event) { - pr_err("%s: Not enough memory!\n", __func__); -@@ -210,15 +237,19 @@ void mxc_hdmi_cec_handle(u16 cec_stat) - mutex_unlock(&hdmi_cec_data.lock); - wake_up(&hdmi_cec_queue); - } -- return; - } --EXPORT_SYMBOL(mxc_hdmi_cec_handle); -+ - static void mxc_hdmi_cec_worker(struct work_struct *work) - { -- u8 val; -- mxc_hdmi_cec_handle(hdmi_cec_data.latest_cec_stat); -- val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ARB_LOST; -- hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -+ unsigned long flags; -+ -+ mxc_hdmi_cec_handle(hdmi_cec_data.cec_stat0); -+ -+ spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -+ hdmi_cec_data.cec_stat0 = 0; -+ if (hdmi_cec_data.cec_state) -+ hdmi_writeb(CEC_STAT0_MASK_DEFAULT, HDMI_IH_MUTE_CEC_STAT0); -+ spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); - } - - static int hdmi_cec_open(struct inode *inode, struct file *filp) -@@ -244,7 +275,7 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); -- if (false == hdmi_cec_data.cec_state) { -+ if (!hdmi_cec_data.cec_state) { - mutex_unlock(&hdmi_cec_data.lock); - return -EACCES; - } -@@ -278,32 +309,31 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) - { -- int ret = 0 , i = 0; -- u8 msg[MAX_MESSAGE_LEN]; -- u8 msg_len = 0, val = 0; -+ int ret = 0; -+ u8 i, msg_len, val; -+ u8 msg[MAX_MESSAGE_LEN] = { 0 }; - - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); -- if (false == hdmi_cec_data.cec_state) { -- mutex_unlock(&hdmi_cec_data.lock); -- return -EACCES; -- } -- /* Ensure that there is only one writer who is the unique listener of tx_cec_queue */ -- if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) { -+ -+ if (!hdmi_cec_data.cec_state) -+ ret = -EACCES; -+ else if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) -+ ret = -EBUSY; -+ else if (count > MAX_MESSAGE_LEN) -+ ret = -EINVAL; -+ else if (copy_from_user(&msg, buf, count)) -+ ret = -EACCES; -+ -+ if (ret) { - mutex_unlock(&hdmi_cec_data.lock); -- return -EBUSY; -+ return ret; - } -- mutex_unlock(&hdmi_cec_data.lock); -- if (count > MAX_MESSAGE_LEN) -- return -EINVAL; -- memset(&msg, 0, MAX_MESSAGE_LEN); -- ret = copy_from_user(&msg, buf, count); -- if (ret) -- return -EACCES; -- mutex_lock(&hdmi_cec_data.lock); -+ - hdmi_cec_data.send_error = 0; - hdmi_cec_data.tx_answer = CEC_TX_INPROGRESS; -+ - msg_len = count; - hdmi_writeb(msg_len, HDMI_CEC_TX_CNT); - for (i = 0; i < msg_len; i++) -@@ -311,9 +341,11 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - val = hdmi_readb(HDMI_CEC_CTRL); - val |= 0x01; - hdmi_writeb(val, HDMI_CEC_CTRL); -+ - mutex_unlock(&hdmi_cec_data.lock); - -- ret = wait_event_interruptible_timeout(tx_cec_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); -+ ret = wait_event_interruptible_timeout( -+ tx_cec_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); - - if (ret < 0) { - ret = -ERESTARTSYS; -@@ -331,10 +363,37 @@ tx_out: - return ret; - } - -+void hdmi_cec_hpd_changed(unsigned int state) -+{ -+ unsigned long flags; -+ u32 cec_stat0; -+ -+ pr_debug("function : %s\n", __func__); -+ -+ link_status = state & 1; -+ -+ if (is_initialized) { -+ spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -+ cec_stat0 = get_hpd_stat(&hdmi_cec_data); -+ spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); -+ -+ if (cec_stat0) -+ mxc_hdmi_cec_handle(cec_stat0); -+ } -+} -+EXPORT_SYMBOL(hdmi_cec_hpd_changed); - - void hdmi_cec_start_device(void) - { - u8 val; -+ unsigned long flags; -+ -+ if (!is_initialized) { -+ want_start = 1; -+ return; -+ } -+ -+ spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); - - val = hdmi_readb(HDMI_MC_CLKDIS); - val &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; -@@ -342,30 +401,44 @@ void hdmi_cec_start_device(void) - hdmi_writeb(0x02, HDMI_CEC_CTRL); - /* Force read unlock */ - hdmi_writeb(0x0, HDMI_CEC_LOCK); -+ - val = HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | HDMI_IH_CEC_STAT0_DONE; - hdmi_writeb(val, HDMI_CEC_POLARITY); -- val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ARB_LOST; -+ -+ val = CEC_STAT0_MASK_DEFAULT; - hdmi_writeb(val, HDMI_CEC_MASK); - hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -- hdmi_cec_data.link_status = hdmi_readb(HDMI_PHY_STAT0) & 0x02; -+ hdmi_cec_data.link_status = link_status; - hdmi_cec_data.cec_state = true; -+ -+ spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); - } - EXPORT_SYMBOL(hdmi_cec_start_device); - - void hdmi_cec_stop_device(void) - { - u8 val; -+ unsigned long flags; - -+ if (!is_initialized) { -+ want_start = 0; -+ return; -+ } -+ -+ spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -+ -+ hdmi_cec_data.cec_state = false; - hdmi_writeb(0x10, HDMI_CEC_CTRL); -- val = HDMI_IH_CEC_STAT0_WAKEUP | HDMI_IH_CEC_STAT0_ERROR_FOLL | HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_ARB_LOST | \ -- HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | HDMI_IH_CEC_STAT0_DONE; -+ val = CEC_STAT0_MASK_ALL; - hdmi_writeb(val, HDMI_CEC_MASK); - hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -+ - hdmi_writeb(0x0, HDMI_CEC_POLARITY); - val = hdmi_readb(HDMI_MC_CLKDIS); - val |= HDMI_MC_CLKDIS_CECCLK_DISABLE; - hdmi_writeb(val, HDMI_MC_CLKDIS); -- hdmi_cec_data.cec_state = false; -+ -+ spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); - } - EXPORT_SYMBOL(hdmi_cec_stop_device); - -@@ -381,7 +454,7 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - switch (cmd) { - case HDMICEC_IOC_SETLOGICALADDRESS: - mutex_lock(&hdmi_cec_data.lock); -- if (false == hdmi_cec_data.cec_state) { -+ if (!hdmi_cec_data.cec_state) { - mutex_unlock(&hdmi_cec_data.lock); - pr_err("Trying to set logical address while not started\n"); - return -EACCES; -@@ -474,32 +547,23 @@ const struct file_operations hdmi_cec_fops = { - static int hdmi_cec_dev_probe(struct platform_device *pdev) - { - int err = 0; -- struct device *temp_class; -- struct resource *res; - struct pinctrl *pinctrl; -- int irq = platform_get_irq(pdev, 0); -+ struct device *temp_class; -+ -+ hdmi_cec_irq = platform_get_irq(pdev, 0); -+ if (hdmi_cec_irq < 0) { -+ dev_err(&pdev->dev, "No HDMI irq line provided\n"); -+ err = -ENXIO; -+ goto err_out; -+ } - - hdmi_cec_major = register_chrdev(hdmi_cec_major, "mxc_hdmi_cec", &hdmi_cec_fops); - if (hdmi_cec_major < 0) { - dev_err(&pdev->dev, "Unable to get a major for HDMI CEC\n"); - err = -EBUSY; -- goto out; -+ goto err_out; - } - -- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); -- if (unlikely(res == NULL)) { -- dev_err(&pdev->dev, "No HDMI irq line provided\n"); -- goto err_out_chrdev; -- } -- spin_lock_init(&hdmi_cec_data.irq_lock); -- -- err = devm_request_irq(&pdev->dev, irq, mxc_hdmi_cec_isr, IRQF_SHARED, -- dev_name(&pdev->dev), &hdmi_cec_data); -- if (err < 0) { -- dev_err(&pdev->dev, "Unable to request irq: %d\n", err); -- goto err_out_chrdev; -- } -- - hdmi_cec_class = class_create(THIS_MODULE, "mxc_hdmi_cec"); - if (IS_ERR(hdmi_cec_class)) { - err = PTR_ERR(hdmi_cec_class); -@@ -507,7 +571,7 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - } - - temp_class = device_create(hdmi_cec_class, NULL, -- MKDEV(hdmi_cec_major, 0), NULL, "mxc_hdmi_cec"); -+ MKDEV(hdmi_cec_major, 0), NULL, "mxc_hdmi_cec"); - if (IS_ERR(temp_class)) { - err = PTR_ERR(temp_class); - goto err_out_class; -@@ -516,29 +580,44 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - pinctrl = devm_pinctrl_get_select_default(&pdev->dev); - if (IS_ERR(pinctrl)) { - dev_err(&pdev->dev, "Can't get/select CEC pinctrl\n"); -+ err = PTR_ERR(pinctrl); - goto err_out_class; - } - -+ INIT_LIST_HEAD(&head); -+ - init_waitqueue_head(&hdmi_cec_queue); - init_waitqueue_head(&tx_cec_queue); - -- INIT_LIST_HEAD(&head); -- - mutex_init(&hdmi_cec_data.lock); -+ spin_lock_init(&hdmi_cec_data.irq_lock); -+ - hdmi_cec_data.Logical_address = 15; - hdmi_cec_data.tx_answer = CEC_TX_AVAIL; -+ INIT_WORK(&hdmi_cec_data.hdmi_cec_work, mxc_hdmi_cec_worker); -+ - platform_set_drvdata(pdev, &hdmi_cec_data); -- INIT_DELAYED_WORK(&hdmi_cec_data.hdmi_cec_work, mxc_hdmi_cec_worker); - -- dev_info(&pdev->dev, "HDMI CEC initialized\n"); -- goto out; -+ err = devm_request_irq(&pdev->dev, hdmi_cec_irq, mxc_hdmi_cec_isr, -+ IRQF_SHARED, dev_name(&pdev->dev), &hdmi_cec_data); -+ if (err < 0) { -+ dev_err(&pdev->dev, "Unable to request irq%d: %d\n", hdmi_cec_irq, err); -+ goto err_out_class; -+ } -+ -+ is_initialized = 1; -+ if (want_start) -+ hdmi_cec_start_device(); -+ -+ pr_info("HDMI-CEC initialized\n"); -+ return 0; - - err_out_class: - device_destroy(hdmi_cec_class, MKDEV(hdmi_cec_major, 0)); - class_destroy(hdmi_cec_class); - err_out_chrdev: - unregister_chrdev(hdmi_cec_major, "mxc_hdmi_cec"); --out: -+err_out: - return err; - } - -@@ -546,6 +625,9 @@ static int hdmi_cec_dev_remove(struct platform_device *pdev) - { - hdmi_cec_stop_device(); - -+ is_initialized = 0; -+ devm_free_irq(&pdev->dev, hdmi_cec_irq, &hdmi_cec_data); -+ - device_destroy(hdmi_cec_class, MKDEV(hdmi_cec_major, 0)); - class_destroy(hdmi_cec_class); - unregister_chrdev(hdmi_cec_major, "mxc_hdmi_cec"); -diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c -index 55c39e1..591dde4 100644 ---- a/drivers/video/mxc/mxc_hdmi.c -+++ b/drivers/video/mxc/mxc_hdmi.c -@@ -212,7 +212,6 @@ static bool hdmi_inited; - static bool hdcp_init; - - extern const struct fb_videomode mxc_cea_mode[64]; --extern void mxc_hdmi_cec_handle(u16 cec_stat); - - extern int mxcfb_blank(int blank, struct fb_info *info); - -@@ -2204,7 +2203,8 @@ static void hotplug_worker(struct work_struct *work) - sprintf(event_string, "EVENT=plugin"); - kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp); - #ifdef CONFIG_MXC_HDMI_CEC -- mxc_hdmi_cec_handle(0x80); -+ if (hdmi->edid_cfg.hdmi_cap) -+ hdmi_cec_hpd_changed(1); - #endif - } else { - /* Plugout event */ -@@ -2216,7 +2216,8 @@ static void hotplug_worker(struct work_struct *work) - sprintf(event_string, "EVENT=plugout"); - kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp); - #ifdef CONFIG_MXC_HDMI_CEC -- mxc_hdmi_cec_handle(0x100); -+ if (hdmi->edid_cfg.hdmi_cap) -+ hdmi_cec_hpd_changed(0); - #endif - } - } -diff --git a/include/linux/mfd/mxc-hdmi-core.h b/include/linux/mfd/mxc-hdmi-core.h -index db16f5f..6c9c36d 100644 ---- a/include/linux/mfd/mxc-hdmi-core.h -+++ b/include/linux/mfd/mxc-hdmi-core.h -@@ -64,5 +64,6 @@ int check_hdmi_state(void); - - void hdmi_cec_start_device(void); - void hdmi_cec_stop_device(void); -+void hdmi_cec_hpd_changed(unsigned int state); - - #endif --- -1.9.1 - - -============================================================== -file 0006-MXC-CEC-Rename-variables-minor-code-style-cleanups.patch -============================================================== - -From 07f57cc3eea59941d627fb46c95776ce67309e5f Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:38 +0100 -Subject: [PATCH] MXC-CEC: Rename variables, minor code style cleanups - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 112 ++++++++++++++++++------------------ - 1 file changed, 56 insertions(+), 56 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index f62bcbc..b0619ac 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -75,13 +75,14 @@ - HDMI_IH_CEC_STAT0_ARB_LOST) - - struct hdmi_cec_priv { -- int receive_error; -- int send_error; -- u8 Logical_address; -- u8 cec_state; -+ int receive_error; -+ int send_error; - int tx_answer; - u32 cec_stat0; -+ u8 logical_address; -+ u8 is_started; - u8 link_status; -+ u8 open_count; - spinlock_t irq_lock; - struct work_struct hdmi_cec_work; - struct mutex lock; -@@ -95,19 +96,18 @@ struct hdmi_cec_event { - }; - - --static LIST_HEAD(head); -+static LIST_HEAD(ev_pending); - - static int hdmi_cec_irq; - static int hdmi_cec_major; - static struct class *hdmi_cec_class; - static struct hdmi_cec_priv hdmi_cec_data; --static u8 open_count; - static u8 want_start; - static u8 link_status; - static u8 is_initialized; - --static wait_queue_head_t hdmi_cec_queue; --static wait_queue_head_t tx_cec_queue; -+static wait_queue_head_t rx_queue; -+static wait_queue_head_t tx_queue; - - - static u32 get_hpd_stat(struct hdmi_cec_priv *hdmi_cec) -@@ -139,7 +139,7 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - hdmi_writeb(cec_stat, HDMI_IH_CEC_STAT0); - - if ((cec_stat & ~CEC_STAT0_MASK_DEFAULT) == 0) { -- if (hdmi_cec->cec_state) -+ if (hdmi_cec->is_started) - hdmi_writeb(CEC_STAT0_MASK_DEFAULT, HDMI_IH_MUTE_CEC_STAT0); - spin_unlock_irqrestore(&hdmi_cec->irq_lock, flags); - return IRQ_NONE; -@@ -160,13 +160,13 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - u8 i = 0; - struct hdmi_cec_event *event = NULL; - -- if (!open_count) -+ if (!hdmi_cec_data.open_count) - return; - - /*The current transmission is successful (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_DONE) { - hdmi_cec_data.tx_answer = cec_stat; -- wake_up(&tx_cec_queue); -+ wake_up(&tx_queue); - } - /*EOM is detected so that the received data is ready in the receiver data buffer*/ - if (cec_stat & HDMI_IH_CEC_STAT0_EOM) { -@@ -186,14 +186,14 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - event->msg[i] = hdmi_readb(HDMI_CEC_RX_DATA0+i); - hdmi_writeb(0x0, HDMI_CEC_LOCK); - mutex_lock(&hdmi_cec_data.lock); -- list_add_tail(&event->list, &head); -+ list_add_tail(&event->list, &ev_pending); - mutex_unlock(&hdmi_cec_data.lock); -- wake_up(&hdmi_cec_queue); -+ wake_up(&rx_queue); - } - /*An error is detected on cec line (for initiator only). */ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_INIT) { - hdmi_cec_data.tx_answer = cec_stat; -- wake_up(&tx_cec_queue); -+ wake_up(&tx_queue); - return; - } - /*A frame is not acknowledged in a directly addressed message. Or a frame is negatively acknowledged in -@@ -201,7 +201,7 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - if (cec_stat & HDMI_IH_CEC_STAT0_NACK) { - hdmi_cec_data.send_error++; - hdmi_cec_data.tx_answer = cec_stat; -- wake_up(&tx_cec_queue); -+ wake_up(&tx_queue); - } - /*An error is notified by a follower. Abnormal logic data bit error (for follower).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_FOLL) { -@@ -218,9 +218,9 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - memset(event, 0, sizeof(struct hdmi_cec_event)); - event->event_type = MESSAGE_TYPE_CONNECTED; - mutex_lock(&hdmi_cec_data.lock); -- list_add_tail(&event->list, &head); -+ list_add_tail(&event->list, &ev_pending); - mutex_unlock(&hdmi_cec_data.lock); -- wake_up(&hdmi_cec_queue); -+ wake_up(&rx_queue); - } - /*HDMI cable disconnected*/ - if (cec_stat & CEC_STAT0_EX_DISCONNECTED) { -@@ -233,9 +233,9 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - memset(event, 0, sizeof(struct hdmi_cec_event)); - event->event_type = MESSAGE_TYPE_DISCONNECTED; - mutex_lock(&hdmi_cec_data.lock); -- list_add_tail(&event->list, &head); -+ list_add_tail(&event->list, &ev_pending); - mutex_unlock(&hdmi_cec_data.lock); -- wake_up(&hdmi_cec_queue); -+ wake_up(&rx_queue); - } - } - -@@ -247,22 +247,22 @@ static void mxc_hdmi_cec_worker(struct work_struct *work) - - spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); - hdmi_cec_data.cec_stat0 = 0; -- if (hdmi_cec_data.cec_state) -+ if (hdmi_cec_data.is_started) - hdmi_writeb(CEC_STAT0_MASK_DEFAULT, HDMI_IH_MUTE_CEC_STAT0); - spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); - } - --static int hdmi_cec_open(struct inode *inode, struct file *filp) -+static int hdmi_cec_open(struct inode *inode, struct file *file) - { - mutex_lock(&hdmi_cec_data.lock); -- if (open_count) { -+ if (hdmi_cec_data.open_count) { - mutex_unlock(&hdmi_cec_data.lock); - return -EBUSY; - } -- open_count = 1; -- filp->private_data = (void *)(&hdmi_cec_data); -- hdmi_cec_data.Logical_address = 15; -- hdmi_cec_data.cec_state = false; -+ hdmi_cec_data.open_count = 1; -+ file->private_data = (void *)(&hdmi_cec_data); -+ hdmi_cec_data.logical_address = 15; -+ hdmi_cec_data.is_started = false; - mutex_unlock(&hdmi_cec_data.lock); - return 0; - } -@@ -275,26 +275,26 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); -- if (!hdmi_cec_data.cec_state) { -+ if (!hdmi_cec_data.is_started) { - mutex_unlock(&hdmi_cec_data.lock); - return -EACCES; - } - -- if (list_empty(&head)) { -+ if (list_empty(&ev_pending)) { - if (file->f_flags & O_NONBLOCK) { - mutex_unlock(&hdmi_cec_data.lock); - return -EAGAIN; - } else { - do { - mutex_unlock(&hdmi_cec_data.lock); -- if (wait_event_interruptible(hdmi_cec_queue, (!list_empty(&head)))) -+ if (wait_event_interruptible(rx_queue, !list_empty(&ev_pending))) - return -ERESTARTSYS; - mutex_lock(&hdmi_cec_data.lock); -- } while (list_empty(&head)); -+ } while (list_empty(&ev_pending)); - } - } - -- event = list_first_entry(&head, struct hdmi_cec_event, list); -+ event = list_first_entry(&ev_pending, struct hdmi_cec_event, list); - list_del(&event->list); - mutex_unlock(&hdmi_cec_data.lock); - if (copy_to_user(buf, event, -@@ -311,19 +311,19 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - { - int ret = 0; - u8 i, msg_len, val; -- u8 msg[MAX_MESSAGE_LEN] = { 0 }; -+ u8 msg[MAX_MESSAGE_LEN]; - - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); - -- if (!hdmi_cec_data.cec_state) -+ if (!hdmi_cec_data.is_started) - ret = -EACCES; - else if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) - ret = -EBUSY; - else if (count > MAX_MESSAGE_LEN) - ret = -EINVAL; -- else if (copy_from_user(&msg, buf, count)) -+ else if (copy_from_user(msg, buf, count)) - ret = -EACCES; - - if (ret) { -@@ -345,7 +345,7 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - mutex_unlock(&hdmi_cec_data.lock); - - ret = wait_event_interruptible_timeout( -- tx_cec_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); -+ tx_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); - - if (ret < 0) { - ret = -ERESTARTSYS; -@@ -409,7 +409,7 @@ void hdmi_cec_start_device(void) - hdmi_writeb(val, HDMI_CEC_MASK); - hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); - hdmi_cec_data.link_status = link_status; -- hdmi_cec_data.cec_state = true; -+ hdmi_cec_data.is_started = true; - - spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); - } -@@ -427,7 +427,7 @@ void hdmi_cec_stop_device(void) - - spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); - -- hdmi_cec_data.cec_state = false; -+ hdmi_cec_data.is_started = false; - hdmi_writeb(0x10, HDMI_CEC_CTRL); - val = CEC_STAT0_MASK_ALL; - hdmi_writeb(val, HDMI_CEC_MASK); -@@ -442,7 +442,7 @@ void hdmi_cec_stop_device(void) - } - EXPORT_SYMBOL(hdmi_cec_stop_device); - --static long hdmi_cec_ioctl(struct file *filp, u_int cmd, -+static long hdmi_cec_ioctl(struct file *file, u_int cmd, - u_long arg) - { - int ret = 0, status = 0; -@@ -454,18 +454,18 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - switch (cmd) { - case HDMICEC_IOC_SETLOGICALADDRESS: - mutex_lock(&hdmi_cec_data.lock); -- if (!hdmi_cec_data.cec_state) { -+ if (!hdmi_cec_data.is_started) { - mutex_unlock(&hdmi_cec_data.lock); - pr_err("Trying to set logical address while not started\n"); - return -EACCES; - } -- hdmi_cec_data.Logical_address = (u8)arg; -- if (hdmi_cec_data.Logical_address <= 7) { -- val = 1 << hdmi_cec_data.Logical_address; -+ hdmi_cec_data.logical_address = (u8)arg; -+ if (hdmi_cec_data.logical_address <= 7) { -+ val = 1 << hdmi_cec_data.logical_address; - hdmi_writeb(val, HDMI_CEC_ADDR_L); - hdmi_writeb(0, HDMI_CEC_ADDR_H); -- } else if (hdmi_cec_data.Logical_address > 7 && hdmi_cec_data.Logical_address <= 15) { -- val = 1 << (hdmi_cec_data.Logical_address - 8); -+ } else if (hdmi_cec_data.logical_address > 7 && hdmi_cec_data.logical_address <= 15) { -+ val = 1 << (hdmi_cec_data.logical_address - 8); - hdmi_writeb(val, HDMI_CEC_ADDR_H); - hdmi_writeb(0, HDMI_CEC_ADDR_L); - } else -@@ -493,20 +493,20 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd, - return ret; - } - --static int hdmi_cec_release(struct inode *inode, struct file *filp) -+static int hdmi_cec_release(struct inode *inode, struct file *file) - { - struct hdmi_cec_event *event, *tmp_event; - - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); -- if (open_count) { -- open_count = 0; -- hdmi_cec_data.cec_state = false; -- hdmi_cec_data.Logical_address = 15; -+ if (hdmi_cec_data.open_count) { -+ hdmi_cec_data.open_count = 0; -+ hdmi_cec_data.is_started = false; -+ hdmi_cec_data.logical_address = 15; - - /* Flush eventual events which have not been read by user space */ -- list_for_each_entry_safe(event, tmp_event, &head, list) { -+ list_for_each_entry_safe(event, tmp_event, &ev_pending, list) { - list_del(&event->list); - vfree(event); - } -@@ -522,12 +522,12 @@ static unsigned int hdmi_cec_poll(struct file *file, poll_table *wait) - - pr_debug("function : %s\n", __func__); - -- poll_wait(file, &hdmi_cec_queue, wait); -+ poll_wait(file, &rx_queue, wait); - - /* Always writable */ - mask = (POLLOUT | POLLWRNORM); - mutex_lock(&hdmi_cec_data.lock); -- if (!list_empty(&head)) -+ if (!list_empty(&ev_pending)) - mask |= (POLLIN | POLLRDNORM); - mutex_unlock(&hdmi_cec_data.lock); - return mask; -@@ -584,15 +584,15 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - goto err_out_class; - } - -- INIT_LIST_HEAD(&head); -+ INIT_LIST_HEAD(&ev_pending); - -- init_waitqueue_head(&hdmi_cec_queue); -- init_waitqueue_head(&tx_cec_queue); -+ init_waitqueue_head(&rx_queue); -+ init_waitqueue_head(&tx_queue); - - mutex_init(&hdmi_cec_data.lock); - spin_lock_init(&hdmi_cec_data.irq_lock); - -- hdmi_cec_data.Logical_address = 15; -+ hdmi_cec_data.logical_address = 15; - hdmi_cec_data.tx_answer = CEC_TX_AVAIL; - INIT_WORK(&hdmi_cec_data.hdmi_cec_work, mxc_hdmi_cec_worker); - --- -1.9.1 - - -============================================================== -file 0007-MXC-CEC-Use-a-more-efficient-buffer-allocation-schem.patch -============================================================== - -From 0205ed2cfff7bbeb8ecd9a17cd068309468aa323 Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:38 +0100 -Subject: [PATCH] MXC-CEC: Use a more efficient buffer allocation scheme - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 170 ++++++++++++++++++++++++------------ - 1 file changed, 115 insertions(+), 55 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index b0619ac..22447cf 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -96,6 +96,7 @@ struct hdmi_cec_event { - }; - - -+static LIST_HEAD(ev_idle); - static LIST_HEAD(ev_pending); - - static int hdmi_cec_irq; -@@ -110,6 +111,60 @@ static wait_queue_head_t rx_queue; - static wait_queue_head_t tx_queue; - - -+static struct hdmi_cec_event *alloc_event(void) -+{ -+ int i; -+ struct hdmi_cec_event *event; -+ -+ if (list_empty(&ev_idle)) { -+ event = (void *)__get_free_page(GFP_KERNEL); -+ -+ if (!event) { -+ pr_err("HDMI-CEC: Failed to allocate event buffer\n"); -+ return NULL; -+ } -+ -+ for (i = 1; i < PAGE_SIZE / sizeof(struct hdmi_cec_event); i++) -+ list_add_tail(&event[i].list, &ev_idle); -+ -+ pr_debug("HDMI-CEC: Allocated event buffer page: @%08lx (%d)\n", -+ (unsigned long)event, i); -+ } else { -+ event = list_first_entry(&ev_idle, struct hdmi_cec_event, list); -+ list_del(&event->list); -+ } -+ -+ memset(event, 0, sizeof(struct hdmi_cec_event)); -+ return event; -+} -+ -+static void free_events(void) -+{ -+ struct hdmi_cec_event *event, *tmp_event; -+ -+ /* Flush events which have not been read by user space */ -+ list_splice_init(&ev_pending, &ev_idle); -+ -+ /* Find item(s) starting on a page boundary */ -+ list_for_each_entry_safe(event, tmp_event, &ev_idle, list) { -+ if (((unsigned long)event & ~PAGE_MASK) == 0) -+ list_move_tail(&event->list, &ev_pending); -+ } -+ -+ /* Discard idle list */ -+ INIT_LIST_HEAD(&ev_idle); -+ -+ /* Empty pending list and free page(s) */ -+ while (!list_empty(&ev_pending)) { -+ event = list_first_entry(&ev_pending, struct hdmi_cec_event, list); -+ list_del(&event->list); -+ free_page((unsigned long)event); -+ -+ pr_debug("HDMI-CEC: Freed event buffer page: @%08lx\n", -+ (unsigned long)event); -+ } -+} -+ - static u32 get_hpd_stat(struct hdmi_cec_priv *hdmi_cec) - { - u32 cec_stat0 = 0; -@@ -157,12 +212,29 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - - static void mxc_hdmi_cec_handle(u32 cec_stat) - { -- u8 i = 0; -- struct hdmi_cec_event *event = NULL; -+ int i; -+ struct hdmi_cec_event *event; - - if (!hdmi_cec_data.open_count) - return; - -+ /*HDMI cable connected: handle first*/ -+ if (cec_stat & CEC_STAT0_EX_CONNECTED) { -+ pr_info("HDMI-CEC: link connected\n"); -+ -+ mutex_lock(&hdmi_cec_data.lock); -+ event = alloc_event(); -+ if (!event) { -+ mutex_unlock(&hdmi_cec_data.lock); -+ return; -+ } -+ event->event_type = MESSAGE_TYPE_CONNECTED; -+ list_add_tail(&event->list, &ev_pending); -+ mutex_unlock(&hdmi_cec_data.lock); -+ -+ wake_up(&rx_queue); -+ } -+ - /*The current transmission is successful (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_DONE) { - hdmi_cec_data.tx_answer = cec_stat; -@@ -170,24 +242,28 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - } - /*EOM is detected so that the received data is ready in the receiver data buffer*/ - if (cec_stat & HDMI_IH_CEC_STAT0_EOM) { -- event = vmalloc(sizeof(struct hdmi_cec_event)); -- if (NULL == event) { -- pr_err("%s: Not enough memory!\n", __func__); -+ mutex_lock(&hdmi_cec_data.lock); -+ event = alloc_event(); -+ if (!event) { -+ mutex_unlock(&hdmi_cec_data.lock); - return; - } -- memset(event, 0, sizeof(struct hdmi_cec_event)); -+ - event->msg_len = hdmi_readb(HDMI_CEC_RX_CNT); -- if (!event->msg_len) { -- pr_err("%s: Invalid CEC message length!\n", __func__); -+ if (!event->msg_len || event->msg_len > MAX_MESSAGE_LEN) { -+ pr_err("HDMI-CEC: Invalid CEC message length\n"); -+ list_add_tail(&event->list, &ev_idle); -+ mutex_unlock(&hdmi_cec_data.lock); - return; - } -+ - event->event_type = MESSAGE_TYPE_RECEIVE_SUCCESS; - for (i = 0; i < event->msg_len; i++) -- event->msg[i] = hdmi_readb(HDMI_CEC_RX_DATA0+i); -- hdmi_writeb(0x0, HDMI_CEC_LOCK); -- mutex_lock(&hdmi_cec_data.lock); -+ event->msg[i] = hdmi_readb(HDMI_CEC_RX_DATA0 + i); -+ - list_add_tail(&event->list, &ev_pending); - mutex_unlock(&hdmi_cec_data.lock); -+ - wake_up(&rx_queue); - } - /*An error is detected on cec line (for initiator only). */ -@@ -207,34 +283,21 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_FOLL) { - hdmi_cec_data.receive_error++; - } -- /*HDMI cable connected*/ -- if (cec_stat & CEC_STAT0_EX_CONNECTED) { -- pr_info("HDMI-CEC: link connected\n"); -- event = vmalloc(sizeof(struct hdmi_cec_event)); -- if (NULL == event) { -- pr_err("%s: Not enough memory\n", __func__); -- return; -- } -- memset(event, 0, sizeof(struct hdmi_cec_event)); -- event->event_type = MESSAGE_TYPE_CONNECTED; -- mutex_lock(&hdmi_cec_data.lock); -- list_add_tail(&event->list, &ev_pending); -- mutex_unlock(&hdmi_cec_data.lock); -- wake_up(&rx_queue); -- } -- /*HDMI cable disconnected*/ -+ -+ /*HDMI cable disconnected: handle last*/ - if (cec_stat & CEC_STAT0_EX_DISCONNECTED) { - pr_info("HDMI-CEC: link disconnected\n"); -- event = vmalloc(sizeof(struct hdmi_cec_event)); -- if (NULL == event) { -- pr_err("%s: Not enough memory!\n", __func__); -+ -+ mutex_lock(&hdmi_cec_data.lock); -+ event = alloc_event(); -+ if (!event) { -+ mutex_unlock(&hdmi_cec_data.lock); - return; - } -- memset(event, 0, sizeof(struct hdmi_cec_event)); - event->event_type = MESSAGE_TYPE_DISCONNECTED; -- mutex_lock(&hdmi_cec_data.lock); - list_add_tail(&event->list, &ev_pending); - mutex_unlock(&hdmi_cec_data.lock); -+ - wake_up(&rx_queue); - } - } -@@ -245,6 +308,9 @@ static void mxc_hdmi_cec_worker(struct work_struct *work) - - mxc_hdmi_cec_handle(hdmi_cec_data.cec_stat0); - -+ if (hdmi_cec_data.cec_stat0 & HDMI_IH_CEC_STAT0_EOM) -+ hdmi_writeb(0x0, HDMI_CEC_LOCK); -+ - spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); - hdmi_cec_data.cec_stat0 = 0; - if (hdmi_cec_data.is_started) -@@ -270,7 +336,8 @@ static int hdmi_cec_open(struct inode *inode, struct file *file) - static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - loff_t *ppos) - { -- struct hdmi_cec_event *event = NULL; -+ ssize_t len; -+ struct hdmi_cec_event *event; - - pr_debug("function : %s\n", __func__); - -@@ -284,26 +351,24 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - if (file->f_flags & O_NONBLOCK) { - mutex_unlock(&hdmi_cec_data.lock); - return -EAGAIN; -- } else { -- do { -- mutex_unlock(&hdmi_cec_data.lock); -- if (wait_event_interruptible(rx_queue, !list_empty(&ev_pending))) -- return -ERESTARTSYS; -- mutex_lock(&hdmi_cec_data.lock); -- } while (list_empty(&ev_pending)); - } -+ -+ do { -+ mutex_unlock(&hdmi_cec_data.lock); -+ if (wait_event_interruptible(rx_queue, !list_empty(&ev_pending))) -+ return -ERESTARTSYS; -+ mutex_lock(&hdmi_cec_data.lock); -+ } while (list_empty(&ev_pending)); - } - -+ len = offsetof(struct hdmi_cec_event, list); - event = list_first_entry(&ev_pending, struct hdmi_cec_event, list); -- list_del(&event->list); -+ if (copy_to_user(buf, event, len)) -+ len = -EFAULT; -+ list_move_tail(&event->list, &ev_idle); - mutex_unlock(&hdmi_cec_data.lock); -- if (copy_to_user(buf, event, -- sizeof(struct hdmi_cec_event) - sizeof(struct list_head))) { -- vfree(event); -- return -EFAULT; -- } -- vfree(event); -- return (sizeof(struct hdmi_cec_event) - sizeof(struct list_head)); -+ -+ return len; - } - - static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, -@@ -495,8 +560,6 @@ static long hdmi_cec_ioctl(struct file *file, u_int cmd, - - static int hdmi_cec_release(struct inode *inode, struct file *file) - { -- struct hdmi_cec_event *event, *tmp_event; -- - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); -@@ -505,11 +568,7 @@ static int hdmi_cec_release(struct inode *inode, struct file *file) - hdmi_cec_data.is_started = false; - hdmi_cec_data.logical_address = 15; - -- /* Flush eventual events which have not been read by user space */ -- list_for_each_entry_safe(event, tmp_event, &ev_pending, list) { -- list_del(&event->list); -- vfree(event); -- } -+ free_events(); - } - mutex_unlock(&hdmi_cec_data.lock); - -@@ -584,6 +643,7 @@ static int hdmi_cec_dev_probe(struct platform_device *pdev) - goto err_out_class; - } - -+ INIT_LIST_HEAD(&ev_idle); - INIT_LIST_HEAD(&ev_pending); - - init_waitqueue_head(&rx_queue); --- -1.9.1 - - -============================================================== -file 0008-MXC-CEC-Fix-message-length-while-keeping-compatibili.patch -============================================================== - -From 19dd5ab55ca121073d35d104a49431b8c3cf3cf1 Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:38 +0100 -Subject: [PATCH] MXC-CEC: Fix message length while keeping compatibility with - old client libs - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 18 +++++++++++++----- - 1 file changed, 13 insertions(+), 5 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index 22447cf..8777320 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -47,7 +47,7 @@ - #include "mxc_hdmi-cec.h" - - --#define MAX_MESSAGE_LEN 17 -+#define MAX_MESSAGE_LEN 16 - - #define MESSAGE_TYPE_RECEIVE_SUCCESS 1 - #define MESSAGE_TYPE_NOACK 2 -@@ -92,6 +92,7 @@ struct hdmi_cec_event { - int event_type; - int msg_len; - u8 msg[MAX_MESSAGE_LEN]; -+ u8 padding[4]; /* compatibility with old userland */ - struct list_head list; - }; - -@@ -336,15 +337,21 @@ static int hdmi_cec_open(struct inode *inode, struct file *file) - static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - loff_t *ppos) - { -- ssize_t len; -+ ssize_t len = 0; - struct hdmi_cec_event *event; - - pr_debug("function : %s\n", __func__); - - mutex_lock(&hdmi_cec_data.lock); -- if (!hdmi_cec_data.is_started) { -+ -+ if (!hdmi_cec_data.is_started) -+ len = -EACCES; -+ else if (count < offsetof(struct hdmi_cec_event, padding)) -+ len = -EINVAL; -+ -+ if (len < 0) { - mutex_unlock(&hdmi_cec_data.lock); -- return -EACCES; -+ return len; - } - - if (list_empty(&ev_pending)) { -@@ -361,7 +368,8 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - } while (list_empty(&ev_pending)); - } - -- len = offsetof(struct hdmi_cec_event, list); -+ /* Hack: older versions of libcec attempt to read more bytes than we provide */ -+ len = min(count, offsetof(struct hdmi_cec_event, list)); - event = list_first_entry(&ev_pending, struct hdmi_cec_event, list); - if (copy_to_user(buf, event, len)) - len = -EFAULT; --- -1.9.1 - - -============================================================== -file 0009-MXC-CEC-Change-return-codes-and-add-poll-support-for.patch -============================================================== - -From 57a5e256cca14fdf8f4dabd839bf21762cff2eaa Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:39 +0100 -Subject: [PATCH] MXC-CEC: Change return codes and add poll support for write - function - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 31 ++++++++++++++++++------------- - 1 file changed, 18 insertions(+), 13 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index 8777320..8134cc8 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -328,6 +328,7 @@ static int hdmi_cec_open(struct inode *inode, struct file *file) - } - hdmi_cec_data.open_count = 1; - file->private_data = (void *)(&hdmi_cec_data); -+ hdmi_cec_data.tx_answer = CEC_TX_AVAIL; - hdmi_cec_data.logical_address = 15; - hdmi_cec_data.is_started = false; - mutex_unlock(&hdmi_cec_data.lock); -@@ -393,7 +394,9 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - if (!hdmi_cec_data.is_started) - ret = -EACCES; - else if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) -- ret = -EBUSY; -+ ret = -EAGAIN; -+ else if (hdmi_cec_data.link_status != 1) -+ ret = -EAGAIN; - else if (count > MAX_MESSAGE_LEN) - ret = -EINVAL; - else if (copy_from_user(msg, buf, count)) -@@ -420,18 +423,15 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - ret = wait_event_interruptible_timeout( - tx_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); - -- if (ret < 0) { -+ if (ret < 0) - ret = -ERESTARTSYS; -- goto tx_out; -- } -- -- if (hdmi_cec_data.tx_answer & HDMI_IH_CEC_STAT0_DONE) -- /* msg correctly sent */ -- ret = msg_len; -+ else if (hdmi_cec_data.tx_answer & HDMI_IH_CEC_STAT0_DONE) -+ ret = msg_len; /* msg sent, ACK received */ -+ else if (hdmi_cec_data.tx_answer & HDMI_IH_CEC_STAT0_NACK) -+ ret = -EIO; /* msg sent, NACK received */ - else -- ret = -EIO; -+ ret = -EPIPE; /* other error */ - --tx_out: - hdmi_cec_data.tx_answer = CEC_TX_AVAIL; - return ret; - } -@@ -575,6 +575,7 @@ static int hdmi_cec_release(struct inode *inode, struct file *file) - hdmi_cec_data.open_count = 0; - hdmi_cec_data.is_started = false; - hdmi_cec_data.logical_address = 15; -+ hdmi_cec_data.tx_answer = CEC_TX_AVAIL; - - free_events(); - } -@@ -590,13 +591,17 @@ static unsigned int hdmi_cec_poll(struct file *file, poll_table *wait) - pr_debug("function : %s\n", __func__); - - poll_wait(file, &rx_queue, wait); -+ poll_wait(file, &tx_queue, wait); -+ -+ if (hdmi_cec_data.link_status == 1 && -+ hdmi_cec_data.tx_answer == CEC_TX_AVAIL) -+ mask |= POLLOUT | POLLWRNORM; - -- /* Always writable */ -- mask = (POLLOUT | POLLWRNORM); - mutex_lock(&hdmi_cec_data.lock); - if (!list_empty(&ev_pending)) -- mask |= (POLLIN | POLLRDNORM); -+ mask |= POLLIN | POLLRDNORM; - mutex_unlock(&hdmi_cec_data.lock); -+ - return mask; - } - --- -1.9.1 - - -============================================================== -file 0010-assign-minor-to-vhci.patch -============================================================== - -From 27b8b64082db6cdfda751e81e56c0f668053834b Mon Sep 17 00:00:00 2001 -From: Lucas De Marchi -Date: Tue, 18 Feb 2014 02:19:26 -0300 -Subject: [PATCH] Bluetooth: allocate static minor for vhci - -Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI -driver) added the module alias to hci_vhci module so it's possible to -create the /dev/vhci node. However creating an alias without -specifying the minor doesn't allow us to create the node ahead, -triggerring module auto-load when it's first accessed. - -Starting with depmod from kmod 16 we started to warn if there's a -devname alias without specifying the major and minor. - -Let's do the same done for uhid, kvm, fuse and others, specifying a -fixed minor. In systems with systemd as the init the following will -happen: on early boot systemd will call "kmod static-nodes" to read -/lib/modules/$(uname -r)/modules.devname and then create the nodes. When -first accessed these "dead" nodes will trigger the module loading. - -Signed-off-by: Lucas De Marchi -Acked-by: Greg Kroah-Hartman -Signed-off-by: Marcel Holtmann ---- - Documentation/devices.txt | 1 + - drivers/bluetooth/hci_vhci.c | 3 ++- - include/linux/miscdevice.h | 1 + - 3 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/Documentation/devices.txt b/Documentation/devices.txt -index 10378cc..04356f5 100644 ---- a/Documentation/devices.txt -+++ b/Documentation/devices.txt -@@ -353,6 +353,7 @@ Your cooperation is appreciated. - 133 = /dev/exttrp External device trap - 134 = /dev/apm_bios Advanced Power Management BIOS - 135 = /dev/rtc Real Time Clock -+ 137 = /dev/vhci Bluetooth virtual HCI driver - 139 = /dev/openprom SPARC OpenBoot PROM - 140 = /dev/relay8 Berkshire Products Octal relay card - 141 = /dev/relay16 Berkshire Products ISO-16 relay card -diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c -index 1ef6990..add1c6a 100644 ---- a/drivers/bluetooth/hci_vhci.c -+++ b/drivers/bluetooth/hci_vhci.c -@@ -360,7 +360,7 @@ static const struct file_operations vhci_fops = { - static struct miscdevice vhci_miscdev= { - .name = "vhci", - .fops = &vhci_fops, -- .minor = MISC_DYNAMIC_MINOR, -+ .minor = VHCI_MINOR, - }; - - static int __init vhci_init(void) -@@ -386,3 +386,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION); - MODULE_VERSION(VERSION); - MODULE_LICENSE("GPL"); - MODULE_ALIAS("devname:vhci"); -+MODULE_ALIAS_MISCDEV(VHCI_MINOR); -diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h -index 3737f72..7bb6148 100644 ---- a/include/linux/miscdevice.h -+++ b/include/linux/miscdevice.h -@@ -23,6 +23,7 @@ - #define TEMP_MINOR 131 /* Temperature Sensor */ - #define RTC_MINOR 135 - #define EFI_RTC_MINOR 136 /* EFI Time services */ -+#define VHCI_MINOR 137 - #define SUN_OPENPROM_MINOR 139 - #define DMAPI_MINOR 140 /* DMAPI */ - #define NVRAM_MINOR 144 - -============================================================== -file 0010-MXC-CEC-Use-instance-data-pointer-whenever-possible.patch -============================================================== - -From 8f0d740e104758b558d8209d4736e7fcf0238b8e Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:39 +0100 -Subject: [PATCH] MXC-CEC: Use instance data pointer whenever possible - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 191 +++++++++++++++++++----------------- - 1 file changed, 100 insertions(+), 91 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index 8134cc8..80344d9 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -183,11 +183,11 @@ static u32 get_hpd_stat(struct hdmi_cec_priv *hdmi_cec) - - static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - { -- struct hdmi_cec_priv *hdmi_cec = data; -+ struct hdmi_cec_priv *priv = data; - unsigned long flags; - u8 cec_stat; - -- spin_lock_irqsave(&hdmi_cec->irq_lock, flags); -+ spin_lock_irqsave(&priv->irq_lock, flags); - - hdmi_writeb(CEC_STAT0_MASK_ALL, HDMI_IH_MUTE_CEC_STAT0); - -@@ -195,58 +195,58 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - hdmi_writeb(cec_stat, HDMI_IH_CEC_STAT0); - - if ((cec_stat & ~CEC_STAT0_MASK_DEFAULT) == 0) { -- if (hdmi_cec->is_started) -+ if (priv->is_started) - hdmi_writeb(CEC_STAT0_MASK_DEFAULT, HDMI_IH_MUTE_CEC_STAT0); -- spin_unlock_irqrestore(&hdmi_cec->irq_lock, flags); -+ spin_unlock_irqrestore(&priv->irq_lock, flags); - return IRQ_NONE; - } - - pr_debug("HDMI-CEC: interrupt received\n"); - -- hdmi_cec->cec_stat0 = cec_stat | get_hpd_stat(hdmi_cec); -- schedule_work(&hdmi_cec->hdmi_cec_work); -+ priv->cec_stat0 = cec_stat | get_hpd_stat(priv); -+ schedule_work(&priv->hdmi_cec_work); - -- spin_unlock_irqrestore(&hdmi_cec->irq_lock, flags); -+ spin_unlock_irqrestore(&priv->irq_lock, flags); - - return IRQ_HANDLED; - } - --static void mxc_hdmi_cec_handle(u32 cec_stat) -+static void mxc_hdmi_cec_handle(struct hdmi_cec_priv *priv, u32 cec_stat) - { - int i; - struct hdmi_cec_event *event; - -- if (!hdmi_cec_data.open_count) -+ if (!priv->open_count) - return; - - /*HDMI cable connected: handle first*/ - if (cec_stat & CEC_STAT0_EX_CONNECTED) { - pr_info("HDMI-CEC: link connected\n"); - -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - event = alloc_event(); - if (!event) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return; - } - event->event_type = MESSAGE_TYPE_CONNECTED; - list_add_tail(&event->list, &ev_pending); -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - wake_up(&rx_queue); - } - - /*The current transmission is successful (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_DONE) { -- hdmi_cec_data.tx_answer = cec_stat; -+ priv->tx_answer = cec_stat; - wake_up(&tx_queue); - } - /*EOM is detected so that the received data is ready in the receiver data buffer*/ - if (cec_stat & HDMI_IH_CEC_STAT0_EOM) { -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - event = alloc_event(); - if (!event) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return; - } - -@@ -254,7 +254,7 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - if (!event->msg_len || event->msg_len > MAX_MESSAGE_LEN) { - pr_err("HDMI-CEC: Invalid CEC message length\n"); - list_add_tail(&event->list, &ev_idle); -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return; - } - -@@ -263,41 +263,41 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - event->msg[i] = hdmi_readb(HDMI_CEC_RX_DATA0 + i); - - list_add_tail(&event->list, &ev_pending); -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - wake_up(&rx_queue); - } - /*An error is detected on cec line (for initiator only). */ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_INIT) { -- hdmi_cec_data.tx_answer = cec_stat; -+ priv->tx_answer = cec_stat; - wake_up(&tx_queue); - return; - } - /*A frame is not acknowledged in a directly addressed message. Or a frame is negatively acknowledged in - a broadcast message (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_NACK) { -- hdmi_cec_data.send_error++; -- hdmi_cec_data.tx_answer = cec_stat; -+ priv->send_error++; -+ priv->tx_answer = cec_stat; - wake_up(&tx_queue); - } - /*An error is notified by a follower. Abnormal logic data bit error (for follower).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_FOLL) { -- hdmi_cec_data.receive_error++; -+ priv->receive_error++; - } - - /*HDMI cable disconnected: handle last*/ - if (cec_stat & CEC_STAT0_EX_DISCONNECTED) { - pr_info("HDMI-CEC: link disconnected\n"); - -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - event = alloc_event(); - if (!event) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return; - } - event->event_type = MESSAGE_TYPE_DISCONNECTED; - list_add_tail(&event->list, &ev_pending); -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - wake_up(&rx_queue); - } -@@ -306,32 +306,36 @@ static void mxc_hdmi_cec_handle(u32 cec_stat) - static void mxc_hdmi_cec_worker(struct work_struct *work) - { - unsigned long flags; -+ struct hdmi_cec_priv *priv = &hdmi_cec_data; - -- mxc_hdmi_cec_handle(hdmi_cec_data.cec_stat0); -+ mxc_hdmi_cec_handle(priv, priv->cec_stat0); - -- if (hdmi_cec_data.cec_stat0 & HDMI_IH_CEC_STAT0_EOM) -+ if (priv->cec_stat0 & HDMI_IH_CEC_STAT0_EOM) - hdmi_writeb(0x0, HDMI_CEC_LOCK); - -- spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -- hdmi_cec_data.cec_stat0 = 0; -- if (hdmi_cec_data.is_started) -+ spin_lock_irqsave(&priv->irq_lock, flags); -+ priv->cec_stat0 = 0; -+ if (priv->is_started) - hdmi_writeb(CEC_STAT0_MASK_DEFAULT, HDMI_IH_MUTE_CEC_STAT0); -- spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); -+ spin_unlock_irqrestore(&priv->irq_lock, flags); - } - - static int hdmi_cec_open(struct inode *inode, struct file *file) - { -- mutex_lock(&hdmi_cec_data.lock); -- if (hdmi_cec_data.open_count) { -- mutex_unlock(&hdmi_cec_data.lock); -+ struct hdmi_cec_priv *priv = &hdmi_cec_data; -+ -+ mutex_lock(&priv->lock); -+ if (priv->open_count) { -+ mutex_unlock(&priv->lock); - return -EBUSY; - } -- hdmi_cec_data.open_count = 1; -- file->private_data = (void *)(&hdmi_cec_data); -- hdmi_cec_data.tx_answer = CEC_TX_AVAIL; -- hdmi_cec_data.logical_address = 15; -- hdmi_cec_data.is_started = false; -- mutex_unlock(&hdmi_cec_data.lock); -+ file->private_data = priv; -+ -+ priv->tx_answer = CEC_TX_AVAIL; -+ priv->logical_address = 15; -+ priv->is_started = false; -+ priv->open_count = 1; -+ mutex_unlock(&priv->lock); - return 0; - } - -@@ -340,32 +344,33 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - { - ssize_t len = 0; - struct hdmi_cec_event *event; -+ struct hdmi_cec_priv *priv = file->private_data; - - pr_debug("function : %s\n", __func__); - -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - -- if (!hdmi_cec_data.is_started) -+ if (!priv->is_started) - len = -EACCES; - else if (count < offsetof(struct hdmi_cec_event, padding)) - len = -EINVAL; - - if (len < 0) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return len; - } - - if (list_empty(&ev_pending)) { - if (file->f_flags & O_NONBLOCK) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return -EAGAIN; - } - - do { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - if (wait_event_interruptible(rx_queue, !list_empty(&ev_pending))) - return -ERESTARTSYS; -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - } while (list_empty(&ev_pending)); - } - -@@ -375,7 +380,7 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - if (copy_to_user(buf, event, len)) - len = -EFAULT; - list_move_tail(&event->list, &ev_idle); -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - return len; - } -@@ -386,16 +391,17 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - int ret = 0; - u8 i, msg_len, val; - u8 msg[MAX_MESSAGE_LEN]; -+ struct hdmi_cec_priv *priv = file->private_data; - - pr_debug("function : %s\n", __func__); - -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - -- if (!hdmi_cec_data.is_started) -+ if (!priv->is_started) - ret = -EACCES; -- else if (hdmi_cec_data.tx_answer != CEC_TX_AVAIL) -+ else if (priv->tx_answer != CEC_TX_AVAIL) - ret = -EAGAIN; -- else if (hdmi_cec_data.link_status != 1) -+ else if (priv->link_status != 1) - ret = -EAGAIN; - else if (count > MAX_MESSAGE_LEN) - ret = -EINVAL; -@@ -403,12 +409,12 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - ret = -EACCES; - - if (ret) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - return ret; - } - -- hdmi_cec_data.send_error = 0; -- hdmi_cec_data.tx_answer = CEC_TX_INPROGRESS; -+ priv->send_error = 0; -+ priv->tx_answer = CEC_TX_INPROGRESS; - - msg_len = count; - hdmi_writeb(msg_len, HDMI_CEC_TX_CNT); -@@ -418,40 +424,41 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - val |= 0x01; - hdmi_writeb(val, HDMI_CEC_CTRL); - -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - ret = wait_event_interruptible_timeout( -- tx_queue, hdmi_cec_data.tx_answer != CEC_TX_INPROGRESS, HZ); -+ tx_queue, priv->tx_answer != CEC_TX_INPROGRESS, HZ); - - if (ret < 0) - ret = -ERESTARTSYS; -- else if (hdmi_cec_data.tx_answer & HDMI_IH_CEC_STAT0_DONE) -+ else if (priv->tx_answer & HDMI_IH_CEC_STAT0_DONE) - ret = msg_len; /* msg sent, ACK received */ -- else if (hdmi_cec_data.tx_answer & HDMI_IH_CEC_STAT0_NACK) -+ else if (priv->tx_answer & HDMI_IH_CEC_STAT0_NACK) - ret = -EIO; /* msg sent, NACK received */ - else - ret = -EPIPE; /* other error */ - -- hdmi_cec_data.tx_answer = CEC_TX_AVAIL; -+ priv->tx_answer = CEC_TX_AVAIL; - return ret; - } - - void hdmi_cec_hpd_changed(unsigned int state) - { -+ u32 cec_stat0; - unsigned long flags; -- u32 cec_stat0; -+ struct hdmi_cec_priv *priv = &hdmi_cec_data; - - pr_debug("function : %s\n", __func__); - - link_status = state & 1; - - if (is_initialized) { -- spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -- cec_stat0 = get_hpd_stat(&hdmi_cec_data); -- spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); -+ spin_lock_irqsave(&priv->irq_lock, flags); -+ cec_stat0 = get_hpd_stat(priv); -+ spin_unlock_irqrestore(&priv->irq_lock, flags); - - if (cec_stat0) -- mxc_hdmi_cec_handle(cec_stat0); -+ mxc_hdmi_cec_handle(priv, cec_stat0); - } - } - EXPORT_SYMBOL(hdmi_cec_hpd_changed); -@@ -515,35 +522,35 @@ void hdmi_cec_stop_device(void) - } - EXPORT_SYMBOL(hdmi_cec_stop_device); - --static long hdmi_cec_ioctl(struct file *file, u_int cmd, -- u_long arg) -+static long hdmi_cec_ioctl(struct file *file, u_int cmd, u_long arg) - { -- int ret = 0, status = 0; -- u8 val = 0; -+ u8 val; -+ int ret = 0; - struct mxc_edid_cfg hdmi_edid_cfg; -+ struct hdmi_cec_priv *priv = file->private_data; - - pr_debug("function : %s\n", __func__); - - switch (cmd) { - case HDMICEC_IOC_SETLOGICALADDRESS: -- mutex_lock(&hdmi_cec_data.lock); -- if (!hdmi_cec_data.is_started) { -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); -+ if (!priv->is_started) { -+ mutex_unlock(&priv->lock); - pr_err("Trying to set logical address while not started\n"); - return -EACCES; - } -- hdmi_cec_data.logical_address = (u8)arg; -- if (hdmi_cec_data.logical_address <= 7) { -- val = 1 << hdmi_cec_data.logical_address; -+ priv->logical_address = (u8)arg; -+ if (priv->logical_address <= 7) { -+ val = 1 << priv->logical_address; - hdmi_writeb(val, HDMI_CEC_ADDR_L); - hdmi_writeb(0, HDMI_CEC_ADDR_H); -- } else if (hdmi_cec_data.logical_address > 7 && hdmi_cec_data.logical_address <= 15) { -- val = 1 << (hdmi_cec_data.logical_address - 8); -+ } else if (priv->logical_address <= 15) { -+ val = 1 << (priv->logical_address - 8); - hdmi_writeb(val, HDMI_CEC_ADDR_H); - hdmi_writeb(0, HDMI_CEC_ADDR_L); - } else - ret = -EINVAL; -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - break; - case HDMICEC_IOC_STARTDEVICE: - hdmi_cec_start_device(); -@@ -553,10 +560,9 @@ static long hdmi_cec_ioctl(struct file *file, u_int cmd, - break; - case HDMICEC_IOC_GETPHYADDRESS: - hdmi_get_edid_cfg(&hdmi_edid_cfg); -- status = copy_to_user((void __user *)arg, -- &hdmi_edid_cfg.physical_address, -- 4*sizeof(u8)); -- if (status) -+ if (copy_to_user((void __user *)arg, -+ &hdmi_edid_cfg.physical_address, -+ 4 * sizeof(u8))) - ret = -EFAULT; - break; - default: -@@ -568,18 +574,20 @@ static long hdmi_cec_ioctl(struct file *file, u_int cmd, - - static int hdmi_cec_release(struct inode *inode, struct file *file) - { -+ struct hdmi_cec_priv *priv = &hdmi_cec_data; -+ - pr_debug("function : %s\n", __func__); - -- mutex_lock(&hdmi_cec_data.lock); -- if (hdmi_cec_data.open_count) { -- hdmi_cec_data.open_count = 0; -- hdmi_cec_data.is_started = false; -- hdmi_cec_data.logical_address = 15; -- hdmi_cec_data.tx_answer = CEC_TX_AVAIL; -+ mutex_lock(&priv->lock); -+ if (priv->open_count) { -+ priv->open_count = 0; -+ priv->is_started = false; -+ priv->logical_address = 15; -+ priv->tx_answer = CEC_TX_AVAIL; - - free_events(); - } -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - return 0; - } -@@ -587,20 +595,21 @@ static int hdmi_cec_release(struct inode *inode, struct file *file) - static unsigned int hdmi_cec_poll(struct file *file, poll_table *wait) - { - unsigned int mask = 0; -+ struct hdmi_cec_priv *priv = file->private_data; - - pr_debug("function : %s\n", __func__); - - poll_wait(file, &rx_queue, wait); - poll_wait(file, &tx_queue, wait); - -- if (hdmi_cec_data.link_status == 1 && -- hdmi_cec_data.tx_answer == CEC_TX_AVAIL) -+ if (priv->link_status == 1 && -+ priv->tx_answer == CEC_TX_AVAIL) - mask |= POLLOUT | POLLWRNORM; - -- mutex_lock(&hdmi_cec_data.lock); -+ mutex_lock(&priv->lock); - if (!list_empty(&ev_pending)) - mask |= POLLIN | POLLRDNORM; -- mutex_unlock(&hdmi_cec_data.lock); -+ mutex_unlock(&priv->lock); - - return mask; - } --- -1.9.1 - - -============================================================== -file 0011-MXC-CEC-Re-order-functions-and-remove-debug-trace-me.patch -============================================================== - -From aeefcbe8831cbdd5a54a1144b89a4d8e2a427e2c Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:39 +0100 -Subject: [PATCH] MXC-CEC: Re-order functions and remove debug trace messages - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 239 ++++++++++++++++++------------------ - 1 file changed, 118 insertions(+), 121 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index 80344d9..fcf2a28 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -241,6 +241,7 @@ static void mxc_hdmi_cec_handle(struct hdmi_cec_priv *priv, u32 cec_stat) - priv->tx_answer = cec_stat; - wake_up(&tx_queue); - } -+ - /*EOM is detected so that the received data is ready in the receiver data buffer*/ - if (cec_stat & HDMI_IH_CEC_STAT0_EOM) { - mutex_lock(&priv->lock); -@@ -267,12 +268,14 @@ static void mxc_hdmi_cec_handle(struct hdmi_cec_priv *priv, u32 cec_stat) - - wake_up(&rx_queue); - } -+ - /*An error is detected on cec line (for initiator only). */ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_INIT) { - priv->tx_answer = cec_stat; - wake_up(&tx_queue); - return; - } -+ - /*A frame is not acknowledged in a directly addressed message. Or a frame is negatively acknowledged in - a broadcast message (for initiator only).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_NACK) { -@@ -280,6 +283,7 @@ static void mxc_hdmi_cec_handle(struct hdmi_cec_priv *priv, u32 cec_stat) - priv->tx_answer = cec_stat; - wake_up(&tx_queue); - } -+ - /*An error is notified by a follower. Abnormal logic data bit error (for follower).*/ - if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_FOLL) { - priv->receive_error++; -@@ -320,6 +324,89 @@ static void mxc_hdmi_cec_worker(struct work_struct *work) - spin_unlock_irqrestore(&priv->irq_lock, flags); - } - -+ -+void hdmi_cec_hpd_changed(unsigned int state) -+{ -+ u32 cec_stat0; -+ unsigned long flags; -+ struct hdmi_cec_priv *priv = &hdmi_cec_data; -+ -+ pr_debug("function : %s (%d)\n", __func__, state); -+ -+ link_status = state & 1; -+ -+ if (is_initialized) { -+ spin_lock_irqsave(&priv->irq_lock, flags); -+ cec_stat0 = get_hpd_stat(priv); -+ spin_unlock_irqrestore(&priv->irq_lock, flags); -+ -+ if (cec_stat0) -+ mxc_hdmi_cec_handle(priv, cec_stat0); -+ } -+} -+EXPORT_SYMBOL(hdmi_cec_hpd_changed); -+ -+void hdmi_cec_start_device(void) -+{ -+ u8 val; -+ unsigned long flags; -+ -+ if (!is_initialized) { -+ want_start = 1; -+ return; -+ } -+ -+ spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -+ -+ val = hdmi_readb(HDMI_MC_CLKDIS); -+ val &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; -+ hdmi_writeb(val, HDMI_MC_CLKDIS); -+ hdmi_writeb(0x02, HDMI_CEC_CTRL); -+ /* Force read unlock */ -+ hdmi_writeb(0x0, HDMI_CEC_LOCK); -+ -+ val = HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_NACK | -+ HDMI_IH_CEC_STAT0_EOM | HDMI_IH_CEC_STAT0_DONE; -+ hdmi_writeb(val, HDMI_CEC_POLARITY); -+ -+ val = CEC_STAT0_MASK_DEFAULT; -+ hdmi_writeb(val, HDMI_CEC_MASK); -+ hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -+ hdmi_cec_data.link_status = link_status; -+ hdmi_cec_data.is_started = true; -+ -+ spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); -+} -+EXPORT_SYMBOL(hdmi_cec_start_device); -+ -+void hdmi_cec_stop_device(void) -+{ -+ u8 val; -+ unsigned long flags; -+ -+ if (!is_initialized) { -+ want_start = 0; -+ return; -+ } -+ -+ spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -+ -+ hdmi_cec_data.is_started = false; -+ hdmi_writeb(0x10, HDMI_CEC_CTRL); -+ val = CEC_STAT0_MASK_ALL; -+ hdmi_writeb(val, HDMI_CEC_MASK); -+ hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -+ -+ hdmi_writeb(0x0, HDMI_CEC_POLARITY); -+ val = hdmi_readb(HDMI_MC_CLKDIS); -+ val |= HDMI_MC_CLKDIS_CECCLK_DISABLE; -+ hdmi_writeb(val, HDMI_MC_CLKDIS); -+ -+ spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); -+} -+EXPORT_SYMBOL(hdmi_cec_stop_device); -+ -+ - static int hdmi_cec_open(struct inode *inode, struct file *file) - { - struct hdmi_cec_priv *priv = &hdmi_cec_data; -@@ -339,6 +426,24 @@ static int hdmi_cec_open(struct inode *inode, struct file *file) - return 0; - } - -+static int hdmi_cec_release(struct inode *inode, struct file *file) -+{ -+ struct hdmi_cec_priv *priv = file->private_data; -+ -+ mutex_lock(&priv->lock); -+ if (priv->open_count) { -+ priv->open_count = 0; -+ priv->is_started = false; -+ priv->logical_address = 15; -+ priv->tx_answer = CEC_TX_AVAIL; -+ -+ free_events(); -+ } -+ mutex_unlock(&priv->lock); -+ -+ return 0; -+} -+ - static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - loff_t *ppos) - { -@@ -346,8 +451,6 @@ static ssize_t hdmi_cec_read(struct file *file, char __user *buf, size_t count, - struct hdmi_cec_event *event; - struct hdmi_cec_priv *priv = file->private_data; - -- pr_debug("function : %s\n", __func__); -- - mutex_lock(&priv->lock); - - if (!priv->is_started) -@@ -393,8 +496,6 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - u8 msg[MAX_MESSAGE_LEN]; - struct hdmi_cec_priv *priv = file->private_data; - -- pr_debug("function : %s\n", __func__); -- - mutex_lock(&priv->lock); - - if (!priv->is_started) -@@ -442,85 +543,25 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - return ret; - } - --void hdmi_cec_hpd_changed(unsigned int state) --{ -- u32 cec_stat0; -- unsigned long flags; -- struct hdmi_cec_priv *priv = &hdmi_cec_data; -- -- pr_debug("function : %s\n", __func__); -- -- link_status = state & 1; -- -- if (is_initialized) { -- spin_lock_irqsave(&priv->irq_lock, flags); -- cec_stat0 = get_hpd_stat(priv); -- spin_unlock_irqrestore(&priv->irq_lock, flags); -- -- if (cec_stat0) -- mxc_hdmi_cec_handle(priv, cec_stat0); -- } --} --EXPORT_SYMBOL(hdmi_cec_hpd_changed); -- --void hdmi_cec_start_device(void) -+static unsigned int hdmi_cec_poll(struct file *file, poll_table *wait) - { -- u8 val; -- unsigned long flags; -- -- if (!is_initialized) { -- want_start = 1; -- return; -- } -- -- spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -- -- val = hdmi_readb(HDMI_MC_CLKDIS); -- val &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; -- hdmi_writeb(val, HDMI_MC_CLKDIS); -- hdmi_writeb(0x02, HDMI_CEC_CTRL); -- /* Force read unlock */ -- hdmi_writeb(0x0, HDMI_CEC_LOCK); -- -- val = HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_NACK | HDMI_IH_CEC_STAT0_EOM | HDMI_IH_CEC_STAT0_DONE; -- hdmi_writeb(val, HDMI_CEC_POLARITY); -- -- val = CEC_STAT0_MASK_DEFAULT; -- hdmi_writeb(val, HDMI_CEC_MASK); -- hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -- hdmi_cec_data.link_status = link_status; -- hdmi_cec_data.is_started = true; -- -- spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); --} --EXPORT_SYMBOL(hdmi_cec_start_device); -- --void hdmi_cec_stop_device(void) --{ -- u8 val; -- unsigned long flags; -- -- if (!is_initialized) { -- want_start = 0; -- return; -- } -+ unsigned int mask = 0; -+ struct hdmi_cec_priv *priv = file->private_data; - -- spin_lock_irqsave(&hdmi_cec_data.irq_lock, flags); -+ poll_wait(file, &rx_queue, wait); -+ poll_wait(file, &tx_queue, wait); - -- hdmi_cec_data.is_started = false; -- hdmi_writeb(0x10, HDMI_CEC_CTRL); -- val = CEC_STAT0_MASK_ALL; -- hdmi_writeb(val, HDMI_CEC_MASK); -- hdmi_writeb(val, HDMI_IH_MUTE_CEC_STAT0); -+ if (priv->link_status == 1 && -+ priv->tx_answer == CEC_TX_AVAIL) -+ mask |= POLLOUT | POLLWRNORM; - -- hdmi_writeb(0x0, HDMI_CEC_POLARITY); -- val = hdmi_readb(HDMI_MC_CLKDIS); -- val |= HDMI_MC_CLKDIS_CECCLK_DISABLE; -- hdmi_writeb(val, HDMI_MC_CLKDIS); -+ mutex_lock(&priv->lock); -+ if (!list_empty(&ev_pending)) -+ mask |= POLLIN | POLLRDNORM; -+ mutex_unlock(&priv->lock); - -- spin_unlock_irqrestore(&hdmi_cec_data.irq_lock, flags); -+ return mask; - } --EXPORT_SYMBOL(hdmi_cec_stop_device); - - static long hdmi_cec_ioctl(struct file *file, u_int cmd, u_long arg) - { -@@ -529,8 +570,6 @@ static long hdmi_cec_ioctl(struct file *file, u_int cmd, u_long arg) - struct mxc_edid_cfg hdmi_edid_cfg; - struct hdmi_cec_priv *priv = file->private_data; - -- pr_debug("function : %s\n", __func__); -- - switch (cmd) { - case HDMICEC_IOC_SETLOGICALADDRESS: - mutex_lock(&priv->lock); -@@ -572,48 +611,6 @@ static long hdmi_cec_ioctl(struct file *file, u_int cmd, u_long arg) - return ret; - } - --static int hdmi_cec_release(struct inode *inode, struct file *file) --{ -- struct hdmi_cec_priv *priv = &hdmi_cec_data; -- -- pr_debug("function : %s\n", __func__); -- -- mutex_lock(&priv->lock); -- if (priv->open_count) { -- priv->open_count = 0; -- priv->is_started = false; -- priv->logical_address = 15; -- priv->tx_answer = CEC_TX_AVAIL; -- -- free_events(); -- } -- mutex_unlock(&priv->lock); -- -- return 0; --} -- --static unsigned int hdmi_cec_poll(struct file *file, poll_table *wait) --{ -- unsigned int mask = 0; -- struct hdmi_cec_priv *priv = file->private_data; -- -- pr_debug("function : %s\n", __func__); -- -- poll_wait(file, &rx_queue, wait); -- poll_wait(file, &tx_queue, wait); -- -- if (priv->link_status == 1 && -- priv->tx_answer == CEC_TX_AVAIL) -- mask |= POLLOUT | POLLWRNORM; -- -- mutex_lock(&priv->lock); -- if (!list_empty(&ev_pending)) -- mask |= POLLIN | POLLRDNORM; -- mutex_unlock(&priv->lock); -- -- return mask; --} -- - - const struct file_operations hdmi_cec_fops = { - .owner = THIS_MODULE, --- -1.9.1 - - -============================================================== -file 0012-MXC-CEC-Provide-send-notifications.patch -============================================================== - -From 73230c020f3fb1385046890df1695d1bc2e6082e Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 09:27:40 +0100 -Subject: [PATCH] MXC-CEC: Provide send notifications - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index fcf2a28..dfb4aa4 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -494,6 +494,7 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - int ret = 0; - u8 i, msg_len, val; - u8 msg[MAX_MESSAGE_LEN]; -+ struct hdmi_cec_event *event; - struct hdmi_cec_priv *priv = file->private_data; - - mutex_lock(&priv->lock); -@@ -540,6 +541,24 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - ret = -EPIPE; /* other error */ - - priv->tx_answer = CEC_TX_AVAIL; -+ -+ if (ret >= 0 || ret == -EIO) { -+ mutex_lock(&priv->lock); -+ -+ event = alloc_event(); -+ if (event) { -+ event->event_type = (ret == -EIO) ? -+ MESSAGE_TYPE_NOACK : MESSAGE_TYPE_SEND_SUCCESS; -+ event->msg_len = msg_len; -+ memcpy(event->msg, msg, msg_len); -+ -+ list_add_tail(&event->list, &ev_pending); -+ wake_up(&rx_queue); -+ } -+ -+ mutex_unlock(&priv->lock); -+ } -+ - return ret; - } - --- -1.9.1 - - -============================================================== -file 0013-MXC-CEC-Enable-transmissions-retries-in-case-of-erro.patch -============================================================== - -From 0fd44cc4dc2fb1f5a0cb26aa74a2c11af1b0d79e Mon Sep 17 00:00:00 2001 -From: warped-rudi -Date: Wed, 9 Nov 2016 17:25:01 +0100 -Subject: [PATCH] MXC-CEC: Enable transmissions retries in case of errors and - NACKs - ---- - drivers/mxc/hdmi-cec/mxc_hdmi-cec.c | 29 +++++++++++++++-------------- - 1 file changed, 15 insertions(+), 14 deletions(-) - -diff --git a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -index dfb4aa4..4d22e38 100644 ---- a/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -+++ b/drivers/mxc/hdmi-cec/mxc_hdmi-cec.c -@@ -58,6 +58,9 @@ - #define CEC_TX_INPROGRESS -1 - #define CEC_TX_AVAIL 0 - -+#define CEC_TX_RETRIES 3 -+ -+ - /* These flags must not collide with HDMI_IH_CEC_STAT0_xxxx */ - #define CEC_STAT0_EX_CONNECTED 0x0100 - #define CEC_STAT0_EX_DISCONNECTED 0x0200 -@@ -214,6 +217,7 @@ static irqreturn_t mxc_hdmi_cec_isr(int irq, void *data) - static void mxc_hdmi_cec_handle(struct hdmi_cec_priv *priv, u32 cec_stat) - { - int i; -+ u8 val; - struct hdmi_cec_event *event; - - if (!priv->open_count) -@@ -270,18 +274,16 @@ static void mxc_hdmi_cec_handle(struct hdmi_cec_priv *priv, u32 cec_stat) - } - - /*An error is detected on cec line (for initiator only). */ -- if (cec_stat & HDMI_IH_CEC_STAT0_ERROR_INIT) { -- priv->tx_answer = cec_stat; -- wake_up(&tx_queue); -- return; -- } -- - /*A frame is not acknowledged in a directly addressed message. Or a frame is negatively acknowledged in - a broadcast message (for initiator only).*/ -- if (cec_stat & HDMI_IH_CEC_STAT0_NACK) { -- priv->send_error++; -- priv->tx_answer = cec_stat; -- wake_up(&tx_queue); -+ if (cec_stat & (HDMI_IH_CEC_STAT0_ERROR_INIT | HDMI_IH_CEC_STAT0_NACK)) { -+ if (++priv->send_error < CEC_TX_RETRIES) { -+ val = hdmi_readb(HDMI_CEC_CTRL) & ~0x07; -+ hdmi_writeb(val | 0x01, HDMI_CEC_CTRL); -+ } else { -+ priv->tx_answer = cec_stat; -+ wake_up(&tx_queue); -+ } - } - - /*An error is notified by a follower. Abnormal logic data bit error (for follower).*/ -@@ -521,10 +523,9 @@ static ssize_t hdmi_cec_write(struct file *file, const char __user *buf, - msg_len = count; - hdmi_writeb(msg_len, HDMI_CEC_TX_CNT); - for (i = 0; i < msg_len; i++) -- hdmi_writeb(msg[i], HDMI_CEC_TX_DATA0+i); -- val = hdmi_readb(HDMI_CEC_CTRL); -- val |= 0x01; -- hdmi_writeb(val, HDMI_CEC_CTRL); -+ hdmi_writeb(msg[i], HDMI_CEC_TX_DATA0 + i); -+ val = hdmi_readb(HDMI_CEC_CTRL) & ~0x07; -+ hdmi_writeb(val | 0x03, HDMI_CEC_CTRL); - - mutex_unlock(&priv->lock); - --- -1.9.1 - - -============================================================== -file 1100-ARM-Avoid-crash-on-power-off-and-reduce-power-consum.patch -============================================================== - -From 7a4bc357a0d2477c0dcdf2a1c471e57050dec041 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sat, 20 Sep 2014 14:05:50 +0200 -Subject: [PATCH] ARM: Avoid crash on power off and reduce power consumption - in 'halt' state. - -Signed-off-by: Rudi ---- - arch/arm/kernel/process.c | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index 1bdd78b..70655b9 100644 ---- a/arch/arm/kernel/process.c -+++ b/arch/arm/kernel/process.c -@@ -119,6 +119,17 @@ static void null_restart(enum reboot_mode reboot_mode, const char *cmd) - } - - /* -+ * Enter non-interruptable CPU halt state -+ */ -+static void cpu_halt(void) -+{ -+ local_irq_disable(); -+ -+ while (1) -+ cpu_do_idle(); -+} -+ -+/* - * Function pointers to optional machine specific functions - */ - void (*pm_power_off)(void); -@@ -202,8 +213,7 @@ void machine_halt(void) - local_irq_disable(); - smp_send_stop(); - -- local_irq_disable(); -- while (1); -+ cpu_halt(); - } - - /* -@@ -219,6 +229,8 @@ void machine_power_off(void) - - if (pm_power_off) - pm_power_off(); -+ -+ cpu_halt(); - } - - /* -@@ -244,8 +256,7 @@ void machine_restart(char *cmd) - - /* Whoops - the platform was unable to reboot. Tell the user! */ - printk("Reboot failed -- System halted\n"); -- local_irq_disable(); -- while (1); -+ cpu_halt(); - } - - void __show_regs(struct pt_regs *regs) --- -1.7.9.5 - - -============================================================== -file 1101-ARM-Disable-timer-events-before-entering-halt-state.patch -============================================================== - -From ae0f301a11bb9d5e484d48238cf15082928a7241 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Sun, 21 Sep 2014 13:53:21 +0200 -Subject: [PATCH] ARM: Disable timer events before entering `halt' state. - -Signed-off-by: Rudi ---- - arch/arm/kernel/process.c | 3 ++- - arch/arm/mach-imx/time.c | 11 +++++++++++ - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index 70655b9..d1e4763 100644 ---- a/arch/arm/kernel/process.c -+++ b/arch/arm/kernel/process.c -@@ -123,8 +123,9 @@ static void null_restart(enum reboot_mode reboot_mode, const char *cmd) - */ - static void cpu_halt(void) - { -+ clockevents_suspend(); -+ - local_irq_disable(); -- - while (1) - cpu_do_idle(); - } -diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c -index ae61dfd..75afcf9 100644 ---- a/arch/arm/mach-imx/time.c -+++ b/arch/arm/mach-imx/time.c -@@ -232,6 +232,16 @@ static void mxc_set_mode(enum clock_event_mode mode, - } - } - -+ -+/* -+ * Shutdown timer -+ */ -+static void mxc_suspend(struct clock_event_device *evt) -+{ -+ mxc_set_mode(CLOCK_EVT_MODE_SHUTDOWN, evt); -+} -+ -+ - /* - * IRQ handler for the timer - */ -@@ -262,6 +272,7 @@ static struct clock_event_device clockevent_mxc = { - .name = "mxc_timer1", - .features = CLOCK_EVT_FEAT_ONESHOT, - .set_mode = mxc_set_mode, -+ .suspend = mxc_suspend, - .set_next_event = mx1_2_set_next_event, - .rating = 200, - }; --- -1.7.9.5 - - -============================================================== -file 1104-interlaced-fix.patch -============================================================== - -From d6c338100ddd885a7acb1d0cf12da90fa7ac2b93 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Wed, 30 Dec 2015 11:01:32 +0100 -Subject: [PATCH] video: ipu_disp: Fix internal VSYNC clock for interlaced - modes - -Signed-off-by: Rudi ---- - drivers/mxc/ipu3/ipu_disp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/mxc/ipu3/ipu_disp.c b/drivers/mxc/ipu3/ipu_disp.c -index b5e21c5..96464b2 100644 ---- a/drivers/mxc/ipu3/ipu_disp.c -+++ b/drivers/mxc/ipu3/ipu_disp.c -@@ -1189,7 +1189,7 @@ int32_t ipu_init_sync_panel(struct ipu_soc *ipu, int disp, uint32_t pixel_clk, - _ipu_di_sync_config(ipu, - disp, /* display */ - DI_SYNC_COUNT_1, /* counter */ -- v_total*2 - 1, /* run count */ -+ v_total - 1, /* run count */ - (3 - 1), /* run_resolution, counter 1 can reference to counter 6,7,8 with run_resolution=2,3,4 */ - 1, /* offset */ - (3 - 1), /* offset resolution, 3=counter 7 */ --- -1.9.1 - - -============================================================== -file 1110-video-mxc_hdmi-Use-common-function-to-insert-video-m.patch -============================================================== - -From a86bd823319cf21eec118f238e2d3e97ede3690f Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Thu, 24 Dec 2015 08:13:24 +0100 -Subject: [PATCH] video: mxc_hdmi: Use common function to insert video modes - -To simplify further development we move the mode list entry -creation into a single function. - -Signed-off-by: Rudi ---- - drivers/video/mxc/mxc_hdmi.c | 145 ++++++++++++++++++------------------------- - 1 file changed, 60 insertions(+), 85 deletions(-) - -diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c -index 55c39e1..f71c1dd 100644 ---- a/drivers/video/mxc/mxc_hdmi.c -+++ b/drivers/video/mxc/mxc_hdmi.c -@@ -1740,7 +1740,8 @@ static int mxc_edid_read_internal(struct mxc_hdmi *hdmi, unsigned char *edid, - - static int mxc_hdmi_read_edid(struct mxc_hdmi *hdmi) - { -- int ret; -+ int ret, n; -+ struct fb_videomode *mode; - u8 edid_old[HDMI_EDID_LEN]; - u8 clkdis; - -@@ -1774,19 +1775,36 @@ static int mxc_hdmi_read_edid(struct mxc_hdmi *hdmi) - - } - -- if (ret < 0) -+ if (ret < 0) { -+ dev_err(&hdmi->pdev->dev, "Failed to read EDID\n"); - return HDMI_EDID_FAIL; -+ } - - if (memcmp(edid_old, hdmi->edid, HDMI_EDID_LEN) == 0) { -- dev_info(&hdmi->pdev->dev, "same edid\n"); -+ dev_info(&hdmi->pdev->dev, "Same EDID\n"); - return HDMI_EDID_SAME; - } - - if (hdmi->fbi->monspecs.modedb_len == 0) { -- dev_info(&hdmi->pdev->dev, "No modes read from edid\n"); -+ dev_warn(&hdmi->pdev->dev, "No modes read from EDID\n"); - return HDMI_EDID_NO_MODES; - } - -+ /* TODO: Is this really neccessary? */ -+ mode = hdmi->fbi->monspecs.modedb; -+ n = hdmi->fbi->monspecs.modedb_len; -+ while (n--) { -+ if ((mode->flag & FB_MODE_IS_STANDARD) && -+ !(mode->vmode & FB_VMODE_ASPECT_MASK)) { -+ if (mode->yres == (mode->xres * 3)/4) -+ mode->vmode |= FB_VMODE_ASPECT_4_3; -+ else -+ mode->vmode |= FB_VMODE_ASPECT_16_9; -+ } -+ -+ mode++; -+ } -+ - return HDMI_EDID_SUCCESS; - } - -@@ -1928,51 +1946,53 @@ static void mxc_hdmi_notify_fb(struct mxc_hdmi *hdmi, bool force_all) - dev_dbg(&hdmi->pdev->dev, "%s exit\n", __func__); - } - --static void mxc_hdmi_edid_rebuild_modelist(struct mxc_hdmi *hdmi) -+static void mxc_hdmi_create_modelist(struct mxc_hdmi *hdmi, int from_edid) - { -- int i, vic; -- struct fb_videomode *mode; -+ struct fb_videomode mode; -+ int i, vic, mode_count = ARRAY_SIZE(mxc_cea_mode); -+ const struct fb_videomode *mode_data = mxc_cea_mode; -+ -+ if (from_edid) { -+ mode_data = hdmi->fbi->monspecs.modedb; -+ mode_count = hdmi->fbi->monspecs.modedb_len; -+ } - - dev_dbg(&hdmi->pdev->dev, "%s\n", __func__); - - console_lock(); - - fb_destroy_modelist(&hdmi->fbi->modelist); -+ -+ /* Always insert VGA mode */ - fb_add_videomode(&vga_mode, &hdmi->fbi->modelist); - -- for (i = 0; i < hdmi->fbi->monspecs.modedb_len; i++) { -- /* -- * We might check here if mode is supported by HDMI. -- * We do not currently support interlaced modes. -- * And add CEA modes in the modelist. -- */ -- mode = &hdmi->fbi->monspecs.modedb[i]; -- -- vic = mxc_edid_mode_to_vic(mode); -- if (hdmi->edid_cfg.hdmi_cap && -- (vic == 0)) -+ for (i = 0; i < mode_count; i++) { -+ vic = from_edid ? mxc_edid_mode_to_vic(&mode_data[i]) : i; -+ -+ if (mode_data[i].xres == 0 || -+ (hdmi->edid_cfg.hdmi_cap && vic == 0)) - continue; - -- if (!(mode->vmode & FB_VMODE_ASPECT_MASK)) { -- if (mode->yres == (mode->xres * 3)/4) -- mode->vmode |= FB_VMODE_ASPECT_4_3; -- else -- mode->vmode |= FB_VMODE_ASPECT_16_9; -- } -+ mode = mode_data[i]; -+ -+ /* TODO: Discuss if we should always set default modes as standard */ -+ if (!from_edid /*&& ignore_edid*/) -+ mode.flag |= FB_MODE_IS_STANDARD; - -- if (fb_add_videomode(mode, &hdmi->fbi->modelist)) -+ if (fb_add_videomode(&mode, &hdmi->fbi->modelist)) - continue; - - dev_dbg(&hdmi->pdev->dev, "Added mode: %d, vic: %d", i, vic); - dev_dbg(&hdmi->pdev->dev, -- "xres = %d, yres = %d, ratio = %s, freq = %d, vmode = %d, flag = %d\n", -- hdmi->fbi->monspecs.modedb[i].xres, -- hdmi->fbi->monspecs.modedb[i].yres, -- mode->vmode & FB_VMODE_ASPECT_4_3 ? "4/3" : -- mode->vmode & FB_VMODE_ASPECT_16_9 ? "16/9" : "n/a", -- hdmi->fbi->monspecs.modedb[i].refresh, -- hdmi->fbi->monspecs.modedb[i].vmode, -- hdmi->fbi->monspecs.modedb[i].flag); -+ "xres = %d, yres = %d, scan = %c, ratio = %s, freq = %d, vmode = %d, flag = %d\n", -+ mode.xres, -+ mode.yres, -+ mode.vmode & FB_VMODE_INTERLACED ? 'i' : 'p', -+ mode.vmode & FB_VMODE_ASPECT_4_3 ? "4/3" : -+ mode.vmode & FB_VMODE_ASPECT_16_9 ? "16/9" : "n/a", -+ mode.refresh, -+ mode.vmode, -+ mode.flag); - } - - fb_new_modelist(hdmi->fbi); -@@ -1986,36 +2006,6 @@ static void mxc_hdmi_default_edid_cfg(struct mxc_hdmi *hdmi) - hdmi->edid_cfg.hdmi_cap = true; - } - --static void mxc_hdmi_default_modelist(struct mxc_hdmi *hdmi) --{ -- u32 i; -- struct fb_videomode mode; -- -- dev_dbg(&hdmi->pdev->dev, "%s\n", __func__); -- -- /* If not EDID data read, set up default modelist */ -- dev_info(&hdmi->pdev->dev, "No modes read from edid\n"); -- dev_info(&hdmi->pdev->dev, "create default modelist\n"); -- -- console_lock(); -- -- fb_destroy_modelist(&hdmi->fbi->modelist); -- -- /*Add all no interlaced CEA mode to default modelist */ -- for (i = 0; i < ARRAY_SIZE(mxc_cea_mode); i++) { -- mode = mxc_cea_mode[i]; -- if (mode.xres != 0) { -- if (ignore_edid) -- mode.flag |= FB_MODE_IS_STANDARD; -- fb_add_videomode(&mode, &hdmi->fbi->modelist); -- } -- } -- -- fb_new_modelist(hdmi->fbi); -- -- console_unlock(); --} -- - static void mxc_hdmi_set_mode(struct mxc_hdmi *hdmi, int edid_status) - { - const struct fb_videomode *mode; -@@ -2108,7 +2098,7 @@ static void mxc_hdmi_cable_connected(struct mxc_hdmi *hdmi) - /* HDMI Initialization Steps D, E, F */ - switch (edid_status) { - case HDMI_EDID_SUCCESS: -- mxc_hdmi_edid_rebuild_modelist(hdmi); -+ mxc_hdmi_create_modelist(hdmi, true); - break; - - /* Nothing to do if EDID same */ -@@ -2120,7 +2110,7 @@ static void mxc_hdmi_cable_connected(struct mxc_hdmi *hdmi) - /* No break here */ - case HDMI_EDID_NO_MODES: - default: -- mxc_hdmi_default_modelist(hdmi); -+ mxc_hdmi_create_modelist(hdmi, false); - break; - } - -@@ -2676,7 +2666,6 @@ static int mxc_hdmi_disp_init(struct mxc_dispdrv_handle *disp, - struct mxc_dispdrv_setting *setting) - { - int ret = 0; -- u32 i; - const struct fb_videomode *mode; - struct fb_videomode m; - struct mxc_hdmi *hdmi = mxc_dispdrv_getdata(disp); -@@ -2787,31 +2776,17 @@ static int mxc_hdmi_disp_init(struct mxc_dispdrv_handle *disp, - - spin_lock_init(&hdmi->irq_lock); - -- /* Set the default mode and modelist when disp init. */ -+ /* Create default modelist */ -+ mxc_hdmi_create_modelist(hdmi, false); -+ -+ /* Set the default mode when disp init. */ - fb_find_mode(&hdmi->fbi->var, hdmi->fbi, - hdmi->dft_mode_str, NULL, 0, NULL, - hdmi->default_bpp); -- -- console_lock(); -- -- fb_destroy_modelist(&hdmi->fbi->modelist); -- -- /*Add all no interlaced CEA mode to default modelist */ -- for (i = 0; i < ARRAY_SIZE(mxc_cea_mode); i++) { -- mode = &mxc_cea_mode[i]; -- if (mode->xres != 0) { -- struct fb_videomode m = *mode; -- m.flag |= FB_MODE_IS_STANDARD; -- fb_add_videomode(&m, &hdmi->fbi->modelist); -- } -- } -- -- console_unlock(); -- -- /* Find a nearest mode in default modelist */ - fb_var_to_videomode(&m, &hdmi->fbi->var); - hdmi->dft_mode_set = false; - -+ /* Find a nearest mode in default modelist */ - mode = fb_find_nearest_mode(&m, &hdmi->fbi->modelist); - if (!mode) { - pr_err("%s: could not find mode in modelist\n", __func__); --- -1.9.1 - - -============================================================== -file 1111-video-mxc_hdmi-Consider-modes-that-differ-only-in-as.patch -============================================================== - -From 9b245791da35efed7d3745ca5ca35d6cc73b49de Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Thu, 24 Dec 2015 08:44:50 +0100 -Subject: [PATCH] video: mxc_hdmi: Consider modes that differ only in aspect - ratio as duplicate - -Certain CEA modes differ from each other only by the aspect ratio. If an EDID -indicates support for both modes of such an otherwise identical pair, we create -a mode list entry only for the first one. This is done because our sysfs cannot -distinguish them. - -Signed-off-by: Rudi ---- - drivers/video/mxc/mxc_hdmi.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c -index f71c1dd..182ae2a 100644 ---- a/drivers/video/mxc/mxc_hdmi.c -+++ b/drivers/video/mxc/mxc_hdmi.c -@@ -1949,7 +1949,7 @@ static void mxc_hdmi_notify_fb(struct mxc_hdmi *hdmi, bool force_all) - static void mxc_hdmi_create_modelist(struct mxc_hdmi *hdmi, int from_edid) - { - struct fb_videomode mode; -- int i, vic, mode_count = ARRAY_SIZE(mxc_cea_mode); -+ int i, j, skip, vic, mode_count = ARRAY_SIZE(mxc_cea_mode); - const struct fb_videomode *mode_data = mxc_cea_mode; - - if (from_edid) { -@@ -1975,6 +1975,19 @@ static void mxc_hdmi_create_modelist(struct mxc_hdmi *hdmi, int from_edid) - - mode = mode_data[i]; - -+ /* for dual aspect ratio modes, insert the first one only */ -+ if (mode.vmode & FB_VMODE_ASPECT_MASK) { -+ skip = 0; -+ for (j = i - 1; !skip && j >= 0; j--) { -+ skip = mode.xres == mode_data[j].xres && -+ mode.yres == mode_data[j].yres && -+ mode.refresh == mode_data[j].refresh && -+ (mode.vmode ^ FB_VMODE_ASPECT_MASK) == mode_data[j].vmode; -+ } -+ if (skip) -+ continue; -+ } -+ - /* TODO: Discuss if we should always set default modes as standard */ - if (!from_edid /*&& ignore_edid*/) - mode.flag |= FB_MODE_IS_STANDARD; --- -1.9.1 - - -============================================================== -file 1112-video-mxc_hdmi-Insert-standard-VGA-mode-only-once.patch -============================================================== - -From 2e980a57c261407795511d4794c8d22e78ecb9b2 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Mon, 4 Jan 2016 08:41:22 +0100 -Subject: [PATCH] video: mxc_hdmi: Insert standard VGA mode only once - -Skip standard VGA if found in EDID. We force this mode to be present -by default and therefore should not add it a second time. - -Signed-off-by: Rudi ---- - drivers/video/mxc/mxc_hdmi.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c -index 182ae2a..ec4a438 100644 ---- a/drivers/video/mxc/mxc_hdmi.c -+++ b/drivers/video/mxc/mxc_hdmi.c -@@ -95,7 +95,7 @@ - * in HDMI Initialization Step B - */ - static const struct fb_videomode vga_mode = { -- /* 640x480 @ 60 Hz, 31.5 kHz hsync */ -+ /* 640x480 @ 59.94 Hz, 31.5 kHz hsync */ - NULL, 60, 640, 480, 39721, 48, 16, 33, 10, 96, 2, 0, - FB_VMODE_NONINTERLACED | FB_VMODE_ASPECT_4_3, FB_MODE_IS_VESA, - }; -@@ -1988,6 +1988,10 @@ static void mxc_hdmi_create_modelist(struct mxc_hdmi *hdmi, int from_edid) - continue; - } - -+ /* Skip standard VGA (already present) */ -+ if (vic == 1 && (mode.flag & FB_MODE_IS_VESA)) -+ continue; -+ - /* TODO: Discuss if we should always set default modes as standard */ - if (!from_edid /*&& ignore_edid*/) - mode.flag |= FB_MODE_IS_STANDARD; --- -1.9.1 - - -============================================================== -file 1113-video-mxc_hdmi-mxc_edid-Introduce-fractional-modes.patch -============================================================== - -From 7df36826253b618c3d44d245b2f1e074112b91c3 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Thu, 24 Dec 2015 09:26:40 +0100 -Subject: [PATCH] video: mxc_hdmi/mxc_edid: Introduce fractional modes - -In order to support fractional refresh rates (23.976, 29.97, 59.94, 119.88Hz) -we create 'synthetic' modes. These have the same timing as the corresponding -non-fractional modes (i.e. 24, 30, 60 and 120Hz). However, the refresh rate -is set to 23, 29, 59 and 119, respectively. In addition they have the mode -bit FB_VMODE_FRACTIONAL set. This bit is taken in acount when calculating -the real pixel clock. - -Signed-off-by: Rudi ---- - drivers/video/mxc/mxc_edid.c | 15 ++++++++++----- - drivers/video/mxc/mxc_hdmi.c | 25 +++++++++++++++++++++++-- - 2 files changed, 33 insertions(+), 7 deletions(-) - -diff --git a/drivers/video/mxc/mxc_edid.c b/drivers/video/mxc/mxc_edid.c -index 1aaaa68..b3a6ee1 100644 ---- a/drivers/video/mxc/mxc_edid.c -+++ b/drivers/video/mxc/mxc_edid.c -@@ -218,9 +218,9 @@ int mxc_edid_fb_mode_is_equal(bool use_aspect, - u32 mask; - - if (use_aspect) -- mask = ~0; -+ mask = ~FB_VMODE_FRACTIONAL; - else -- mask = ~FB_VMODE_ASPECT_MASK; -+ mask = ~(FB_VMODE_FRACTIONAL | FB_VMODE_ASPECT_MASK); - - return (mode1->xres == mode2->xres && - mode1->yres == mode2->yres && -@@ -823,7 +823,12 @@ const struct fb_videomode *mxc_fb_find_nearest_mode(const struct fb_videomode *m - struct fb_videomode *cmode; - static struct fb_videomode *best; - static u32 diff, diff_refresh; -- u32 mask = relax ? FB_VMODE_MASK_SIMPLE | FB_VMODE_ASPECT_MASK : ~0; -+ u32 mask = relax ? ~FB_VMODE_ASPECT_MASK : ~0; -+ int refresh = mode->refresh; -+ -+ if ((mode->flag & FB_MODE_IS_FROM_VAR) && -+ (mode->vmode & FB_VMODE_FRACTIONAL)) -+ refresh--; - - if (!relax) { - diff = -1; -@@ -844,10 +849,10 @@ const struct fb_videomode *mxc_fb_find_nearest_mode(const struct fb_videomode *m - abs(cmode->yres - mode->yres); - if (diff > d) { - diff = d; -- diff_refresh = abs(cmode->refresh - mode->refresh); -+ diff_refresh = abs(cmode->refresh - refresh); - best = cmode; - } else if (diff == d) { -- d = abs(cmode->refresh - mode->refresh); -+ d = abs(cmode->refresh - refresh); - if (diff_refresh > d) { - diff_refresh = d; - best = cmode; -diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c -index ec4a438..6156e16 100644 ---- a/drivers/video/mxc/mxc_hdmi.c -+++ b/drivers/video/mxc/mxc_hdmi.c -@@ -1999,9 +1999,30 @@ static void mxc_hdmi_create_modelist(struct mxc_hdmi *hdmi, int from_edid) - if (fb_add_videomode(&mode, &hdmi->fbi->modelist)) - continue; - -- dev_dbg(&hdmi->pdev->dev, "Added mode: %d, vic: %d", i, vic); - dev_dbg(&hdmi->pdev->dev, -- "xres = %d, yres = %d, scan = %c, ratio = %s, freq = %d, vmode = %d, flag = %d\n", -+ "Mode: vic=%d, xres=%d, yres=%d, scan=%c, ratio=%s, freq=%d, vmode=%d, flag=%d\n", -+ vic, -+ mode.xres, -+ mode.yres, -+ mode.vmode & FB_VMODE_INTERLACED ? 'i' : 'p', -+ mode.vmode & FB_VMODE_ASPECT_4_3 ? "4/3" : -+ mode.vmode & FB_VMODE_ASPECT_16_9 ? "16/9" : "n/a", -+ mode.refresh, -+ mode.vmode, -+ mode.flag); -+ -+ /* check if fractional mode should be inserted */ -+ if (vic == 0 || !(mode.refresh == 24 || (mode.refresh % 30) == 0)) -+ continue; -+ -+ mode.refresh--; -+ mode.vmode |= FB_VMODE_FRACTIONAL; -+ if (fb_add_videomode(&mode, &hdmi->fbi->modelist)) -+ continue; -+ -+ dev_dbg(&hdmi->pdev->dev, -+ "Mode: vic=%d, xres=%d, yres=%d, scan=%c, ratio=%s, freq=%d, vmode=%d, flag=%d\n", -+ vic, - mode.xres, - mode.yres, - mode.vmode & FB_VMODE_INTERLACED ? 'i' : 'p', --- -1.9.1 - - -============================================================== -file 1114-video-mxc_edid-Adjust-pixel-timings.patch -============================================================== - -From cec6f4f51f22cd0324f255cb99a85eaa7f3d0d78 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Thu, 24 Dec 2015 09:51:31 +0100 -Subject: [PATCH] video: mxc_edid: Adjust pixel timings - -Our approach for fractional mode support requires the pixel timings -in the CEA mode table to describe the non-fractional modes. This -patch sets this for the modes that were defined otherwise. -Also it tweaks the rounding when calculating the real pixel clock -from the pixel time specified in the table. - -Signed-off-by: Rudi ---- - drivers/video/mxc/mxc_edid.c | 19 ++++++++++++------- - include/video/mxc_edid.h | 4 ++-- - 2 files changed, 14 insertions(+), 9 deletions(-) - -diff --git a/drivers/video/mxc/mxc_edid.c b/drivers/video/mxc/mxc_edid.c -index b3a6ee1..edfd6e8 100644 ---- a/drivers/video/mxc/mxc_edid.c -+++ b/drivers/video/mxc/mxc_edid.c -@@ -38,20 +38,25 @@ - #define DPRINTK(fmt, args...) - #endif - -+/* -+ * Attention: pixel times for the fractional mode entries must -+ * specify the non-fractional frequency of that mode! -+ * I.e. 60Hz instead of 59.94 and 24Hz instead of 23.98. -+ */ - const struct fb_videomode mxc_cea_mode[64] = { - /* #1: 640x480p@59.94/60Hz 4:3 */ - [1] = { -- NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0, -+ NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, 0, - FB_VMODE_NONINTERLACED | FB_VMODE_ASPECT_4_3, 0, - }, - /* #2: 720x480p@59.94/60Hz 4:3 */ - [2] = { -- NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0, -+ NULL, 60, 720, 480, 37000, 60, 16, 30, 9, 62, 6, 0, - FB_VMODE_NONINTERLACED | FB_VMODE_ASPECT_4_3, 0, - }, - /* #3: 720x480p@59.94/60Hz 16:9 */ - [3] = { -- NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0, -+ NULL, 60, 720, 480, 37000, 60, 16, 30, 9, 62, 6, 0, - FB_VMODE_NONINTERLACED | FB_VMODE_ASPECT_16_9, 0, - }, - /* #4: 1280x720p@59.94/60Hz 16:9 */ -@@ -68,22 +73,22 @@ const struct fb_videomode mxc_cea_mode[64] = { - }, - /* #6: 720(1440)x480iH@59.94/60Hz 4:3 */ - [6] = { -- NULL, 60, 1440, 480, 37037, 38, 114, 8, 31, 124, 6, 0, -+ NULL, 60, 1440, 480, 37000, 38, 114, 8, 31, 124, 6, 0, - FB_VMODE_INTERLACED | FB_VMODE_ASPECT_4_3, 0, - }, - /* #7: 720(1440)x480iH@59.94/60Hz 16:9 */ - [7] = { -- NULL, 60, 1440, 480, 37037, 38, 114, 8, 31, 124, 6, 0, -+ NULL, 60, 1440, 480, 37000, 38, 114, 8, 31, 124, 6, 0, - FB_VMODE_INTERLACED | FB_VMODE_ASPECT_16_9, 0, - }, - /* #8: 720(1440)x240pH@59.94/60Hz 4:3 */ - [8] = { -- NULL, 60, 1440, 240, 37108, 114, 38, 15, 4, 124, 3, 0, -+ NULL, 60, 1440, 240, 37000, 114, 38, 15, 4, 124, 3, 0, - FB_VMODE_NONINTERLACED | FB_VMODE_ASPECT_4_3, 0, - }, - /* #9: 720(1440)x240pH@59.94/60Hz 16:9 */ - [9] = { -- NULL, 60, 1440, 240, 37108, 114, 38, 15, 4, 124, 3, 0, -+ NULL, 60, 1440, 240, 37000, 114, 38, 15, 4, 124, 3, 0, - FB_VMODE_NONINTERLACED | FB_VMODE_ASPECT_16_9, 0, - }, - /* #14: 1440x480p@59.94/60Hz 4:3 */ -diff --git a/include/video/mxc_edid.h b/include/video/mxc_edid.h -index 561fe61..2feed16 100644 ---- a/include/video/mxc_edid.h -+++ b/include/video/mxc_edid.h -@@ -100,8 +100,8 @@ struct mxc_edid_cfg { - }; - - static inline unsigned long mxcPICOS2KHZ(u32 pixclock, u32 vmode) { -- u32 x = (1000000000UL / (pixclock) * 1000 / ((vmode & FB_VMODE_FRACTIONAL) ? 1001 : 1000)); -- return x + ((1000000000UL % x) > (x / 2) ? 1 : 0); -+ return ((((vmode & FB_VMODE_FRACTIONAL) ? -+ (999000999UL*4) : (1000000000UL*4)) / pixclock) + 1) >> 2; - } - - int mxc_edid_var_to_vic(struct fb_var_screeninfo *var); --- -1.9.1 - - -============================================================== -file 1115-video-mxc_ipuv3_fb-Adjust-IPU-pixelclock.patch -============================================================== - -From 8b308a05dbfdbdffaf632857bc70a6005f95a6f5 Mon Sep 17 00:00:00 2001 -From: Rudi -Date: Tue, 29 Dec 2015 17:13:54 +0100 -Subject: [PATCH] video: mxc_ipuv3_fb: Adjust IPU pixelclock - -Use 'fractional' pixelclock calculation for IPU as well. - -Signed-off-by: Rudi ---- - drivers/video/mxc/mxc_ipuv3_fb.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/drivers/video/mxc/mxc_ipuv3_fb.c b/drivers/video/mxc/mxc_ipuv3_fb.c -index 9a3764f..8856c32 100644 ---- a/drivers/video/mxc/mxc_ipuv3_fb.c -+++ b/drivers/video/mxc/mxc_ipuv3_fb.c -@@ -49,6 +49,7 @@ - #include - #include - -+#include